From ff7c6d114e56ae947ad4c400ad9883431c740fad Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Sat, 3 Mar 2018 12:21:34 +0100 Subject: [PATCH] New upstream version 1.24.1+dfsg1 --- CONTRIBUTING.md | 76 +- README.md | 3 + RELEASES.md | 256 +- config.toml.example | 11 +- git-commit-hash | 2 +- src/Cargo.lock | 882 +- src/Cargo.toml | 11 +- src/bootstrap/Cargo.toml | 1 + src/bootstrap/bin/rustc.rs | 12 +- src/bootstrap/bin/rustdoc.rs | 4 + src/bootstrap/builder.rs | 15 +- src/bootstrap/channel.rs | 7 +- src/bootstrap/check.rs | 71 +- src/bootstrap/compile.rs | 4 + src/bootstrap/config.rs | 27 +- src/bootstrap/configure.py | 1 + src/bootstrap/dist.rs | 42 +- src/bootstrap/doc.rs | 3 +- src/bootstrap/job.rs | 2 +- src/bootstrap/lib.rs | 116 +- src/bootstrap/mk/Makefile.in | 4 +- src/bootstrap/native.rs | 7 +- src/bootstrap/sanity.rs | 2 +- src/bootstrap/tool.rs | 229 +- src/bootstrap/toolstate.rs | 42 +- src/bootstrap/util.rs | 18 +- src/build_helper/lib.rs | 83 +- src/ci/docker/README.md | 4 +- src/ci/docker/dist-i686-freebsd/Dockerfile | 10 +- .../dist-i686-freebsd/build-toolchain.sh | 112 - .../{cross => dist-various-1}/Dockerfile | 17 +- .../build-arm-musl.sh | 0 .../build-rumprun.sh | 0 .../install-mips-musl.sh | 0 .../install-mipsel-musl.sh | 0 .../install-x86_64-redox.sh | 0 .../{cross2 => dist-various-2}/Dockerfile | 5 +- .../build-fuchsia-toolchain.sh | 0 .../build-solaris-toolchain.sh | 0 .../{cross2 => dist-various-2}/shared.sh | 0 src/ci/docker/dist-x86_64-freebsd/Dockerfile | 10 +- .../dist-x86_64-freebsd/build-toolchain.sh | 112 - .../build-netbsd-toolchain.sh | 2 +- src/ci/docker/run.sh | 1 + src/ci/docker/scripts/freebsd-toolchain.sh | 103 + src/ci/docker/wasm32-unknown/Dockerfile | 36 + src/ci/docker/x86_64-gnu-aux/Dockerfile | 8 +- src/ci/docker/x86_64-gnu-cargotest/Dockerfile | 25 - src/ci/docker/x86_64-gnu-tools/Dockerfile | 27 + src/ci/docker/x86_64-gnu-tools/checktools.sh | 66 + src/ci/docker/x86_64-gnu-tools/repo.sh | 90 + src/ci/docker/x86_64-gnu/Dockerfile | 6 +- src/ci/init_repo.sh | 6 + src/ci/run.sh | 5 +- src/doc/book/README.md | 23 +- .../src/casting-between-types.md | 2 +- src/doc/book/first-edition/src/ffi.md | 12 +- src/doc/book/second-edition/dictionary.txt | 40 +- .../book/second-edition/nostarch/appendix.md | 935 +- .../book/second-edition/nostarch/chapter04.md | 2 +- .../book/second-edition/nostarch/chapter05.md | 2 +- .../book/second-edition/nostarch/chapter06.md | 2 +- .../book/second-edition/nostarch/chapter07.md | 25 +- .../book/second-edition/nostarch/chapter08.md | 19 +- .../book/second-edition/nostarch/chapter09.md | 12 +- .../book/second-edition/nostarch/chapter11.md | 928 +- .../book/second-edition/nostarch/chapter12.md | 1174 +-- .../book/second-edition/nostarch/chapter13.md | 681 +- .../book/second-edition/nostarch/chapter14.md | 16 +- .../book/second-edition/nostarch/chapter15.md | 2 +- .../book/second-edition/nostarch/chapter16.md | 4 +- .../book/second-edition/nostarch/chapter17.md | 24 +- .../book/second-edition/nostarch/chapter19.md | 30 +- .../book/second-edition/nostarch/chapter20.md | 68 +- src/doc/book/second-edition/src/SUMMARY.md | 20 +- .../src/appendix-01-keywords.md | 4 +- .../src/appendix-02-operators.md | 305 +- .../src/appendix-03-derivable-traits.md | 212 + .../second-edition/src/appendix-04-macros.md | 484 + ...nslation.md => appendix-05-translation.md} | 2 + ...ures.md => appendix-06-newest-features.md} | 0 .../src/ch01-01-installation.md | 4 +- .../second-edition/src/ch01-02-hello-world.md | 4 + .../second-edition/src/ch03-02-data-types.md | 8 +- .../src/ch03-05-control-flow.md | 4 +- .../src/ch04-01-what-is-ownership.md | 2 +- .../src/ch05-03-method-syntax.md | 2 +- .../book/second-edition/src/ch06-02-match.md | 4 +- .../src/ch07-01-mod-and-the-filesystem.md | 10 +- ...ch07-02-controlling-visibility-with-pub.md | 6 +- .../src/ch07-03-importing-names-with-use.md | 8 +- .../second-edition/src/ch08-01-vectors.md | 4 +- .../src/ch09-00-error-handling.md | 2 +- ...ch09-01-unrecoverable-errors-with-panic.md | 98 +- .../ch09-02-recoverable-errors-with-result.md | 41 +- .../src/ch09-03-to-panic-or-not-to-panic.md | 4 +- .../book/second-edition/src/ch10-02-traits.md | 4 +- .../second-edition/src/ch11-00-testing.md | 44 +- .../src/ch11-01-writing-tests.md | 465 +- .../src/ch11-02-running-tests.md | 182 +- .../src/ch11-03-test-organization.md | 234 +- .../src/ch12-00-an-io-project.md | 45 +- ...h12-01-accepting-command-line-arguments.md | 138 +- .../src/ch12-02-reading-a-file.md | 72 +- ...improving-error-handling-and-modularity.md | 448 +- ...2-04-testing-the-librarys-functionality.md | 234 +- ...2-05-working-with-environment-variables.md | 158 +- ...-06-writing-to-stderr-instead-of-stdout.md | 88 +- .../src/ch13-00-functional-features.md | 32 +- .../second-edition/src/ch13-01-closures.md | 300 +- .../second-edition/src/ch13-02-iterators.md | 132 +- .../src/ch13-03-improving-our-io-project.md | 94 +- .../second-edition/src/ch13-04-performance.md | 77 +- .../src/ch14-02-publishing-to-crates-io.md | 12 +- .../src/ch14-03-cargo-workspaces.md | 2 +- .../src/ch14-04-installing-binaries.md | 2 +- .../book/second-edition/src/ch15-01-box.md | 4 +- .../book/second-edition/src/ch15-02-deref.md | 6 +- .../book/second-edition/src/ch15-03-drop.md | 16 +- src/doc/book/second-edition/src/ch15-04-rc.md | 20 +- .../src/ch15-05-interior-mutability.md | 24 +- .../src/ch15-06-reference-cycles.md | 32 +- .../second-edition/src/ch16-01-threads.md | 21 +- .../src/ch16-02-message-passing.md | 8 +- .../src/ch17-03-oo-design-patterns.md | 26 +- .../src/ch18-02-refutability.md | 2 +- .../src/ch19-03-advanced-traits.md | 8 +- .../src/ch19-04-advanced-types.md | 26 +- .../src/ch20-01-single-threaded.md | 12 +- .../src/ch20-02-slow-requests.md | 6 +- .../src/ch20-03-designing-the-interface.md | 2 +- .../src/ch20-04-storing-threads.md | 10 +- .../ch20-05-sending-requests-via-channels.md | 30 +- .../ch20-06-graceful-shutdown-and-cleanup.md | 10 +- .../book/second-edition/tools/docx-to-md.xsl | 23 +- src/doc/man/rustc.1 | 2 +- src/doc/man/rustdoc.1 | 2 +- src/doc/nomicon/src/casts.md | 2 +- src/doc/nomicon/src/dropck.md | 12 +- src/doc/nomicon/src/other-reprs.md | 30 +- src/doc/nomicon/src/repr-rust.md | 5 +- src/doc/nomicon/src/safe-unsafe-meaning.md | 4 +- src/doc/nomicon/src/working-with-unsafe.md | 3 +- src/doc/not_found.md | 14 +- src/doc/reference/src/SUMMARY.md | 9 +- src/doc/reference/src/attributes.md | 14 +- .../reference/src/dynamically-sized-types.md | 4 +- src/doc/reference/src/expressions.md | 162 +- .../reference/src/expressions/array-expr.md | 42 +- .../reference/src/expressions/block-expr.md | 15 +- .../reference/src/expressions/call-expr.md | 9 + .../reference/src/expressions/closure-expr.md | 18 +- .../reference/src/expressions/field-expr.md | 32 +- src/doc/reference/src/expressions/if-expr.md | 37 + .../reference/src/expressions/loop-expr.md | 60 +- .../reference/src/expressions/match-expr.md | 27 +- .../src/expressions/method-call-expr.md | 9 +- .../src/expressions/operator-expr.md | 104 +- .../reference/src/expressions/path-expr.md | 13 +- .../reference/src/expressions/struct-expr.md | 16 +- src/doc/reference/src/glossary.md | 59 +- src/doc/reference/src/interior-mutability.md | 6 +- src/doc/reference/src/items/constant-items.md | 44 +- src/doc/reference/src/items/enumerations.md | 124 +- .../reference/src/items/implementations.md | 108 +- src/doc/reference/src/items/static-items.md | 45 +- src/doc/reference/src/items/traits.md | 44 +- src/doc/reference/src/items/type-aliases.md | 10 + src/doc/reference/src/items/unions.md | 10 + src/doc/reference/src/paths.md | 8 +- src/doc/reference/src/procedural-macros.md | 2 +- src/doc/reference/src/special-traits.md | 3 - .../reference/src/special-types-and-traits.md | 153 + src/doc/reference/src/statements.md | 82 +- src/doc/reference/src/the-copy-trait.md | 4 - src/doc/reference/src/the-deref-trait.md | 7 - src/doc/reference/src/the-drop-trait.md | 4 - src/doc/reference/src/the-send-trait.md | 4 - src/doc/reference/src/the-sized-trait.md | 3 - src/doc/reference/src/the-sync-trait.md | 4 - src/doc/reference/src/tokens.md | 2 +- src/doc/reference/src/type-layout.md | 287 + src/doc/reference/src/types.md | 96 +- src/doc/reference/src/unsafety.md | 2 +- src/doc/rustdoc/src/command-line-arguments.md | 4 +- src/doc/rustdoc/src/documentation-tests.md | 2 +- .../src/language-features/doc-spotlight.md | 30 + .../src/language-features/external-doc.md | 40 + .../macro-lifetime-matcher.md | 14 + .../language-features/optin-builtin-traits.md | 2 +- .../src/language-features/plugin.md | 2 +- .../src/language-features/unboxed-closures.md | 2 +- .../language-features/use-nested-groups.md | 90 + .../hint-core-should-pause.md | 41 - src/etc/cat-and-grep.sh | 89 + src/etc/installer/exe/modpath.iss | 2 +- src/etc/platform-intrinsics/x86/avx2.json | 2 +- src/etc/rust-windbg.cmd | 2 +- src/etc/test-float-parse/runtests.py | 2 +- src/etc/wasm32-shim.js | 16 +- src/liballoc/allocator.rs | 46 +- src/liballoc/arc.rs | 21 +- src/liballoc/benches/btree/map.rs | 2 +- src/liballoc/benches/slice.rs | 2 +- src/liballoc/boxed.rs | 57 +- src/liballoc/btree/set.rs | 14 +- src/liballoc/fmt.rs | 14 +- src/liballoc/linked_list.rs | 155 + src/liballoc/macros.rs | 2 +- src/liballoc/rc.rs | 23 +- src/liballoc/slice.rs | 264 +- src/liballoc/str.rs | 174 +- src/liballoc/string.rs | 7 +- src/liballoc/tests/cow_str.rs | 2 +- src/liballoc/tests/heap.rs | 45 + src/liballoc/tests/lib.rs | 4 + src/liballoc/tests/linked_list.rs | 188 + src/liballoc/tests/str.rs | 6 +- src/liballoc/vec.rs | 16 +- src/liballoc_jemalloc/build.rs | 14 +- src/liballoc_jemalloc/lib.rs | 25 +- src/liballoc_system/lib.rs | 9 +- src/libarena/lib.rs | 4 +- src/libbacktrace/configure | 2 +- src/libbacktrace/ltmain.sh | 2 +- src/libcompiler_builtins/build.rs | 500 +- src/libcompiler_builtins/ci/run.sh | 4 + src/libcompiler_builtins/src/arm_linux.rs | 25 +- src/libcompiler_builtins/src/int/addsub.rs | 124 + src/libcompiler_builtins/src/int/mod.rs | 6 + src/libcompiler_builtins/src/int/mul.rs | 35 + src/libcompiler_builtins/src/int/sdiv.rs | 11 + src/libcompiler_builtins/src/int/shift.rs | 36 + src/libcompiler_builtins/src/int/udiv.rs | 11 + src/libcompiler_builtins/src/lib.rs | 3 +- src/libcompiler_builtins/src/macros.rs | 14 + src/libcompiler_builtins/tests/i128_add.rs | 8 + src/libcompiler_builtins/tests/i128_addo.rs | 8 + src/libcompiler_builtins/tests/i128_sub.rs | 8 + src/libcompiler_builtins/tests/i128_subo.rs | 8 + src/libcompiler_builtins/tests/u128_add.rs | 8 + src/libcompiler_builtins/tests/u128_addo.rs | 8 + src/libcompiler_builtins/tests/u128_sub.rs | 8 + src/libcompiler_builtins/tests/u128_subo.rs | 8 + src/libcore/cell.rs | 15 +- src/libcore/cmp.rs | 8 +- src/libcore/fmt/builders.rs | 101 +- src/libcore/fmt/float.rs | 17 +- src/libcore/fmt/mod.rs | 58 +- src/libcore/fmt/num.rs | 2 +- src/libcore/intrinsics.rs | 5 + src/libcore/iter/iterator.rs | 18 +- src/libcore/iter/mod.rs | 18 +- src/libcore/lib.rs | 18 +- src/libcore/macros.rs | 28 +- src/libcore/marker.rs | 3 +- src/libcore/mem.rs | 2 - src/libcore/nonzero.rs | 4 +- src/libcore/num/bignum.rs | 2 +- src/libcore/num/f32.rs | 11 +- src/libcore/num/f64.rs | 11 +- src/libcore/num/mod.rs | 429 +- src/libcore/ops/deref.rs | 8 +- src/libcore/option.rs | 17 + src/libcore/ptr.rs | 131 +- src/libcore/result.rs | 18 +- src/libcore/slice/memchr.rs | 230 + src/libcore/slice/mod.rs | 33 +- src/libcore/str/mod.rs | 9 +- src/libcore/str/pattern.rs | 351 +- src/libcore/sync/atomic.rs | 35 +- src/libcore/tests/fmt/builders.rs | 55 + src/libcore/tests/fmt/float.rs | 4 + src/libcore/tests/lib.rs | 6 +- src/libcore/tests/ops.rs | 2 +- src/libcore/tests/pattern.rs | 302 + src/libcore/tests/ptr.rs | 33 + src/libgraphviz/lib.rs | 87 +- src/liblibc/.travis.yml | 3 +- src/liblibc/Cargo.lock | 58 +- src/liblibc/Cargo.toml | 2 +- .../wasm32-unknown-emscripten/node-wrapper.sh | 4 + src/liblibc/ci/run.sh | 6 +- src/liblibc/libc-test/build.rs | 64 +- src/liblibc/src/dox.rs | 1 + src/liblibc/src/fuchsia/mod.rs | 2 - src/liblibc/src/lib.rs | 2 +- src/liblibc/src/unix/bsd/apple/mod.rs | 28 +- .../src/unix/bsd/freebsdlike/dragonfly/mod.rs | 24 + .../src/unix/bsd/freebsdlike/freebsd/mod.rs | 36 +- src/liblibc/src/unix/bsd/freebsdlike/mod.rs | 51 +- src/liblibc/src/unix/bsd/mod.rs | 1 - .../src/unix/bsd/netbsdlike/netbsd/mod.rs | 103 +- .../openbsdlike/{bitrig.rs => bitrig/mod.rs} | 14 + .../{other/b32/mod.rs => bitrig/x86.rs} | 0 .../{other/b64/mod.rs => bitrig/x86_64.rs} | 0 .../unix/bsd/netbsdlike/openbsdlike/mod.rs | 30 +- .../netbsdlike/openbsdlike/openbsd/aarch64.rs | 3 + .../{openbsd.rs => openbsd/mod.rs} | 15 + .../bsd/netbsdlike/openbsdlike/openbsd/x86.rs | 3 + .../netbsdlike/openbsdlike/openbsd/x86_64.rs | 3 + .../bsd/netbsdlike/openbsdlike/other/mod.rs | 11 - src/liblibc/src/unix/haiku/mod.rs | 11 + src/liblibc/src/unix/mod.rs | 1 + src/liblibc/src/unix/notbsd/android/mod.rs | 11 + src/liblibc/src/unix/notbsd/linux/mod.rs | 32 +- src/liblibc/src/unix/notbsd/linux/musl/mod.rs | 6 - .../unix/notbsd/linux/other/b64/aarch64.rs | 5 + .../src/unix/notbsd/linux/other/mod.rs | 6 - src/liblibc/src/unix/notbsd/linux/s390x.rs | 6 - src/liblibc/src/unix/solaris/mod.rs | 53 +- src/liblibc/src/unix/uclibc/mips/mips32.rs | 2 +- src/liblibc/src/unix/uclibc/mod.rs | 2 + src/libproc_macro/lib.rs | 28 +- src/libprofiler_builtins/build.rs | 2 +- src/librustc/Cargo.toml | 9 +- src/librustc/dep_graph/dep_node.rs | 25 +- src/librustc/dep_graph/dep_tracking_map.rs | 2 +- src/librustc/dep_graph/graph.rs | 159 +- src/librustc/dep_graph/prev.rs | 4 + src/librustc/diagnostics.rs | 63 +- src/librustc/hir/check_attr.rs | 30 +- src/librustc/hir/def.rs | 27 +- src/librustc/hir/def_id.rs | 12 +- src/librustc/hir/intravisit.rs | 55 +- src/librustc/hir/lowering.rs | 969 +- src/librustc/hir/map/blocks.rs | 1 + src/librustc/hir/map/collector.rs | 51 +- src/librustc/hir/map/def_collector.rs | 54 +- src/librustc/hir/map/definitions.rs | 3 +- src/librustc/hir/map/mod.rs | 20 +- src/librustc/hir/mod.rs | 166 +- src/librustc/hir/print.rs | 171 +- src/librustc/ich/caching_codemap_view.rs | 6 +- src/librustc/ich/fingerprint.rs | 6 +- src/librustc/ich/hcx.rs | 176 +- src/librustc/ich/impls_hir.rs | 151 +- src/librustc/ich/impls_mir.rs | 133 +- src/librustc/ich/impls_syntax.rs | 40 +- src/librustc/ich/impls_ty.rs | 28 +- src/librustc/ich/mod.rs | 6 - src/librustc/infer/README.md | 2 +- src/librustc/infer/anon_types/mod.rs | 640 ++ src/librustc/infer/combine.rs | 26 +- .../error_reporting/different_lifetimes.rs | 412 - src/librustc/infer/error_reporting/mod.rs | 198 +- .../error_reporting/named_anon_conflict.rs | 101 - .../infer/error_reporting/need_type_info.rs | 4 +- .../nice_region_error/different_lifetimes.rs | 164 + .../nice_region_error/find_anon_type.rs | 291 + .../error_reporting/nice_region_error/mod.rs | 63 + .../nice_region_error/named_anon_conflict.rs | 121 + .../{ => nice_region_error}/util.rs | 125 +- src/librustc/infer/freshen.rs | 140 +- .../infer/lexical_region_resolve/mod.rs | 25 +- src/librustc/infer/mod.rs | 139 +- src/librustc/infer/outlives/bounds.rs | 218 + src/librustc/infer/outlives/env.rs | 271 +- .../infer/outlives/free_region_map.rs | 111 + src/librustc/infer/outlives/mod.rs | 4 + src/librustc/infer/outlives/obligations.rs | 29 +- src/librustc/infer/region_constraints/mod.rs | 4 +- src/librustc/infer/type_variable.rs | 5 +- src/librustc/infer/unify_key.rs | 6 +- src/librustc/lib.rs | 15 +- src/librustc/lint/builtin.rs | 37 +- src/librustc/lint/context.rs | 59 +- src/librustc/lint/mod.rs | 20 +- src/librustc/middle/borrowck.rs | 1 + src/librustc/middle/const_val.rs | 9 +- src/librustc/middle/cstore.rs | 33 +- src/librustc/middle/dead.rs | 23 +- src/librustc/middle/expr_use_visitor.rs | 39 +- src/librustc/middle/free_region.rs | 130 +- src/librustc/middle/lang_items.rs | 32 +- src/librustc/middle/mem_categorization.rs | 21 +- src/librustc/middle/reachable.rs | 4 +- src/librustc/middle/region.rs | 5 +- src/librustc/middle/resolve_lifetime.rs | 1744 ++-- src/librustc/middle/stability.rs | 2 +- .../mir}/interpret/error.rs | 17 +- src/librustc/mir/interpret/mod.rs | 269 + .../mir}/interpret/value.rs | 121 +- src/librustc/mir/mod.rs | 554 +- src/librustc/{middle/trans.rs => mir/mono.rs} | 28 +- src/librustc/mir/tcx.rs | 70 +- src/librustc/mir/visit.rs | 210 +- src/librustc/session/code_stats.rs | 18 +- src/librustc/session/config.rs | 190 +- src/librustc/session/mod.rs | 292 +- src/librustc/traits/coherence.rs | 295 +- src/librustc/traits/error_reporting.rs | 58 +- src/librustc/traits/fulfill.rs | 72 +- src/librustc/traits/mod.rs | 82 +- src/librustc/traits/object_safety.rs | 4 +- src/librustc/traits/on_unimplemented.rs | 4 +- src/librustc/traits/project.rs | 22 +- src/librustc/traits/select.rs | 186 +- src/librustc/traits/specialize/mod.rs | 60 +- .../traits/specialize/specialization_graph.rs | 81 +- src/librustc/traits/structural_impls.rs | 15 +- src/librustc/traits/trans/mod.rs | 8 +- src/librustc/traits/util.rs | 4 +- src/librustc/ty/adjustment.rs | 52 +- src/librustc/ty/cast.rs | 3 + src/librustc/ty/context.rs | 361 +- src/librustc/ty/error.rs | 22 +- src/librustc/ty/fold.rs | 54 +- src/librustc/ty/instance.rs | 87 +- src/librustc/ty/layout.rs | 2803 +++--- src/librustc/ty/maps/config.rs | 103 +- src/librustc/ty/maps/mod.rs | 38 +- src/librustc/ty/maps/on_disk_cache.rs | 560 +- src/librustc/ty/maps/plumbing.rs | 104 +- src/librustc/ty/mod.rs | 110 +- src/librustc/ty/structural_impls.rs | 380 +- src/librustc/ty/sty.rs | 300 +- src/librustc/ty/subst.rs | 10 +- src/librustc/ty/util.rs | 103 +- src/librustc/ty/wf.rs | 50 +- src/librustc/util/common.rs | 16 +- src/librustc/util/ppaux.rs | 40 +- src/librustc_apfloat/ieee.rs | 6 +- src/librustc_apfloat/lib.rs | 15 +- src/librustc_back/Cargo.toml | 2 +- src/librustc_back/lib.rs | 5 - .../target/aarch64_unknown_cloudabi.rs | 32 + .../target/armv4t_unknown_linux_gnueabi.rs | 36 + .../target/armv5te_unknown_linux_gnueabi.rs | 6 +- .../target/armv7_unknown_cloudabi_eabihf.rs | 34 + src/librustc_back/target/cloudabi_base.rs | 34 + .../target/i686_unknown_cloudabi.rs | 34 + src/librustc_back/target/mod.rs | 14 +- src/librustc_back/target/openbsd_base.rs | 1 + .../target/x86_64_unknown_cloudabi.rs | 34 + src/librustc_back/tempdir.rs | 114 - src/librustc_borrowck/Cargo.toml | 3 +- .../borrowck/gather_loans/mod.rs | 1 + src/librustc_borrowck/borrowck/mod.rs | 99 +- src/librustc_borrowck/borrowck/unused.rs | 6 +- src/librustc_borrowck/lib.rs | 3 +- src/librustc_const_eval/Cargo.toml | 3 +- src/librustc_const_eval/_match.rs | 6 +- src/librustc_const_eval/check_match.rs | 52 +- src/librustc_const_eval/eval.rs | 37 +- src/librustc_const_eval/lib.rs | 13 +- src/librustc_const_eval/pattern.rs | 4 +- src/librustc_const_math/lib.rs | 3 - src/librustc_data_structures/Cargo.toml | 9 +- src/librustc_data_structures/array_vec.rs | 9 +- src/librustc_data_structures/base_n.rs | 22 +- .../control_flow_graph/dominators/mod.rs | 2 +- src/librustc_data_structures/indexed_set.rs | 47 +- src/librustc_data_structures/indexed_vec.rs | 6 +- src/librustc_data_structures/lib.rs | 9 + .../owning_ref/LICENSE | 21 + .../owning_ref/mod.rs | 1902 ++++ src/librustc_data_structures/sync.rs | 403 + .../transitive_relation.rs | 135 +- src/librustc_driver/Cargo.toml | 3 +- src/librustc_driver/README.md | 2 +- src/librustc_driver/driver.rs | 100 +- src/librustc_driver/lib.rs | 29 +- src/librustc_driver/pretty.rs | 113 +- src/librustc_driver/test.rs | 22 +- src/librustc_errors/Cargo.toml | 1 + src/librustc_errors/diagnostic_builder.rs | 2 +- src/librustc_errors/emitter.rs | 100 +- src/librustc_errors/lib.rs | 77 +- src/librustc_errors/snippet.rs | 3 +- src/librustc_errors/styled_buffer.rs | 17 +- src/librustc_incremental/Cargo.toml | 2 +- src/librustc_incremental/persist/data.rs | 39 - .../persist/dirty_clean.rs | 178 +- .../persist/file_format.rs | 15 +- src/librustc_incremental/persist/fs.rs | 19 +- src/librustc_incremental/persist/load.rs | 207 +- src/librustc_incremental/persist/save.rs | 72 +- .../persist/work_product.rs | 4 +- src/librustc_lint/Cargo.toml | 2 +- src/librustc_lint/bad_style.rs | 26 +- src/librustc_lint/builtin.rs | 43 +- src/librustc_lint/lib.rs | 16 + src/librustc_lint/types.rs | 16 +- src/librustc_lint/unused.rs | 46 +- src/librustc_llvm/build.rs | 58 +- src/librustc_llvm/ffi.rs | 66 +- src/librustc_llvm/lib.rs | 9 +- src/librustc_metadata/Cargo.toml | 5 +- src/librustc_metadata/astencode.rs | 4 +- src/librustc_metadata/creader.rs | 109 +- src/librustc_metadata/cstore.rs | 2 +- src/librustc_metadata/cstore_impl.rs | 42 +- src/librustc_metadata/decoder.rs | 94 +- .../dynamic_lib.rs | 0 src/librustc_metadata/encoder.rs | 164 +- src/librustc_metadata/index_builder.rs | 12 +- src/librustc_metadata/isolated_encoder.rs | 120 +- src/librustc_metadata/lib.rs | 4 +- src/librustc_metadata/locator.rs | 173 +- src/librustc_metadata/schema.rs | 6 +- src/librustc_mir/Cargo.toml | 7 +- src/librustc_mir/borrow_check.rs | 1963 ---- .../borrow_check/error_reporting.rs | 768 ++ src/librustc_mir/borrow_check/flows.rs | 159 + src/librustc_mir/borrow_check/mod.rs | 2083 ++++ .../borrow_check/nll/constraint_generation.rs | 167 + .../borrow_check/nll/explain_borrow/mod.rs | 210 + src/librustc_mir/borrow_check/nll/mod.rs | 329 + .../nll/region_infer/annotation.rs | 56 + .../borrow_check/nll/region_infer/dfs.rs | 244 + .../borrow_check/nll/region_infer/dump_mir.rs | 100 + .../borrow_check/nll/region_infer/graphviz.rs | 71 + .../borrow_check/nll/region_infer/mod.rs | 1332 +++ .../borrow_check/nll/region_infer/values.rs | 438 + src/librustc_mir/borrow_check/nll/renumber.rs | 117 + .../nll/subtype_constraint_generation.rs | 84 +- .../nll/type_check/input_output.rs | 183 + .../borrow_check/nll/type_check/liveness.rs | 230 + .../nll/type_check/mod.rs} | 784 +- .../borrow_check/nll/universal_regions.rs | 832 ++ src/librustc_mir/borrow_check/prefixes.rs | 189 + src/librustc_mir/build/block.rs | 4 +- src/librustc_mir/build/cfg.rs | 21 +- src/librustc_mir/build/expr/as_operand.rs | 6 +- .../build/expr/{as_lvalue.rs => as_place.rs} | 54 +- src/librustc_mir/build/expr/as_rvalue.rs | 38 +- src/librustc_mir/build/expr/as_temp.rs | 16 +- src/librustc_mir/build/expr/category.rs | 4 +- src/librustc_mir/build/expr/into.rs | 12 +- src/librustc_mir/build/expr/mod.rs | 16 +- src/librustc_mir/build/expr/stmt.rs | 14 +- src/librustc_mir/build/into.rs | 8 +- src/librustc_mir/build/matches/mod.rs | 80 +- src/librustc_mir/build/matches/simplify.rs | 39 +- src/librustc_mir/build/matches/test.rs | 136 +- src/librustc_mir/build/matches/util.rs | 22 +- src/librustc_mir/build/misc.rs | 22 +- src/librustc_mir/build/mod.rs | 115 +- src/librustc_mir/build/scope.rs | 113 +- src/librustc_mir/dataflow/at_location.rs | 212 + .../dataflow/drop_flag_effects.rs | 120 +- src/librustc_mir/dataflow/graphviz.rs | 10 +- src/librustc_mir/dataflow/impls/borrows.rs | 667 +- src/librustc_mir/dataflow/impls/mod.rs | 301 +- .../dataflow/impls/storage_liveness.rs | 6 +- src/librustc_mir/dataflow/mod.rs | 323 +- .../dataflow/move_paths/abs_domain.rs | 6 +- .../dataflow/move_paths/builder.rs | 172 +- src/librustc_mir/dataflow/move_paths/mod.rs | 72 +- src/librustc_mir/diagnostics.rs | 4 - src/librustc_mir/hair/cx/expr.rs | 20 +- src/librustc_mir/hair/cx/mod.rs | 12 +- .../src => }/librustc_mir/interpret/cast.rs | 45 +- src/librustc_mir/interpret/const_eval.rs | 569 ++ src/librustc_mir/interpret/eval_context.rs | 1664 ++++ .../librustc_mir/interpret/machine.rs | 62 +- src/librustc_mir/interpret/memory.rs | 1083 +++ src/librustc_mir/interpret/mod.rs | 23 + .../librustc_mir/interpret/operator.rs | 19 +- src/librustc_mir/interpret/place.rs | 430 + src/librustc_mir/interpret/step.rs | 335 + .../librustc_mir/interpret/terminator/drop.rs | 35 +- .../librustc_mir/interpret/terminator/mod.rs | 130 +- src/librustc_mir/interpret/traits.rs | 90 + src/librustc_mir/lib.rs | 15 + .../monomorphize}/collector.rs | 342 +- .../monomorphize/item.rs} | 84 +- .../monomorphize/mod.rs} | 21 +- .../monomorphize}/partitioning.rs | 136 +- src/librustc_mir/shim.rs | 120 +- .../transform/add_moves_for_packed_drops.rs | 141 + src/librustc_mir/transform/add_validation.rs | 76 +- src/librustc_mir/transform/check_unsafety.rs | 181 +- src/librustc_mir/transform/copy_prop.rs | 63 +- src/librustc_mir/transform/deaggregator.rs | 10 +- src/librustc_mir/transform/elaborate_drops.rs | 62 +- src/librustc_mir/transform/generator.rs | 84 +- src/librustc_mir/transform/inline.rs | 152 +- src/librustc_mir/transform/instcombine.rs | 45 +- src/librustc_mir/transform/lower_128bit.rs | 242 + src/librustc_mir/transform/mod.rs | 18 +- .../transform/nll/constraint_generation.rs | 234 - .../transform/nll/free_regions.rs | 90 - src/librustc_mir/transform/nll/mod.rs | 204 - .../transform/nll/region_infer.rs | 443 - src/librustc_mir/transform/nll/renumber.rs | 165 - src/librustc_mir/transform/no_landing_pads.rs | 19 +- src/librustc_mir/transform/promote_consts.rs | 29 +- src/librustc_mir/transform/qualify_consts.rs | 113 +- .../transform/remove_noop_landing_pads.rs | 138 + src/librustc_mir/transform/rustc_peek.rs | 41 +- src/librustc_mir/transform/simplify.rs | 42 +- src/librustc_mir/util/alignment.rs | 74 + src/librustc_mir/util/borrowck_errors.rs | 158 +- src/librustc_mir/util/def_use.rs | 28 +- src/librustc_mir/util/elaborate_drops.rs | 175 +- src/librustc_mir/util/graphviz.rs | 6 +- src/librustc_mir/util/liveness.rs | 196 +- src/librustc_mir/util/mod.rs | 4 +- src/librustc_mir/util/patch.rs | 4 +- src/librustc_mir/util/pretty.rs | 487 +- src/librustc_passes/Cargo.toml | 2 +- src/librustc_passes/ast_validation.rs | 92 +- src/librustc_passes/consts.rs | 1 + src/librustc_passes/hir_stats.rs | 16 - src/librustc_passes/mir_stats.rs | 58 +- src/librustc_platform_intrinsics/x86.rs | 2 +- src/librustc_plugin/Cargo.toml | 1 - src/librustc_plugin/lib.rs | 3 +- src/librustc_plugin/load.rs | 6 +- src/librustc_privacy/lib.rs | 143 +- src/librustc_resolve/Cargo.toml | 2 +- src/librustc_resolve/build_reduced_graph.rs | 307 +- src/librustc_resolve/check_unused.rs | 63 +- src/librustc_resolve/lib.rs | 526 +- src/librustc_resolve/macros.rs | 73 +- src/librustc_resolve/resolve_imports.rs | 139 +- src/librustc_save_analysis/Cargo.toml | 4 +- src/librustc_save_analysis/dump_visitor.rs | 385 +- src/librustc_save_analysis/json_dumper.rs | 24 +- src/librustc_save_analysis/lib.rs | 25 +- src/librustc_save_analysis/sig.rs | 103 +- src/librustc_save_analysis/span_utils.rs | 20 +- src/librustc_trans/Cargo.toml | 7 +- src/librustc_trans/abi.rs | 856 +- src/librustc_trans/adt.rs | 497 - src/librustc_trans/asm.rs | 28 +- src/librustc_trans/assert_module_sources.rs | 6 +- src/librustc_trans/attributes.rs | 2 +- src/librustc_trans/back/archive.rs | 5 +- src/librustc_trans/back/bytecode.rs | 4 +- src/librustc_trans/back/command.rs | 72 +- src/librustc_trans/back/link.rs | 95 +- src/librustc_trans/back/lto.rs | 68 +- src/librustc_trans/back/symbol_export.rs | 3 +- src/librustc_trans/back/symbol_names.rs | 12 +- src/librustc_trans/back/write.rs | 11 +- src/librustc_trans/base.rs | 374 +- src/librustc_trans/builder.rs | 159 +- src/librustc_trans/cabi_aarch64.rs | 18 +- src/librustc_trans/cabi_arm.rs | 18 +- src/librustc_trans/cabi_asmjs.rs | 15 +- src/librustc_trans/cabi_hexagon.rs | 19 +- src/librustc_trans/cabi_mips.rs | 33 +- src/librustc_trans/cabi_mips64.rs | 33 +- src/librustc_trans/cabi_msp430.rs | 19 +- src/librustc_trans/cabi_nvptx.rs | 19 +- src/librustc_trans/cabi_nvptx64.rs | 19 +- src/librustc_trans/cabi_powerpc.rs | 32 +- src/librustc_trans/cabi_powerpc64.rs | 26 +- src/librustc_trans/cabi_s390x.rs | 47 +- src/librustc_trans/cabi_sparc.rs | 35 +- src/librustc_trans/cabi_sparc64.rs | 22 +- src/librustc_trans/cabi_x86.rs | 64 +- src/librustc_trans/cabi_x86_64.rs | 94 +- src/librustc_trans/cabi_x86_win64.rs | 44 +- src/librustc_trans/callee.rs | 10 +- src/librustc_trans/common.rs | 207 +- src/librustc_trans/consts.rs | 43 +- src/librustc_trans/context.rs | 98 +- src/librustc_trans/debuginfo/metadata.rs | 766 +- src/librustc_trans/debuginfo/mod.rs | 25 +- src/librustc_trans/debuginfo/namespace.rs | 41 +- src/librustc_trans/debuginfo/utils.rs | 13 - src/librustc_trans/diagnostics.rs | 4 +- src/librustc_trans/glue.rs | 68 +- src/librustc_trans/intrinsic.rs | 561 +- src/librustc_trans/lib.rs | 16 +- src/librustc_trans/llvm_util.rs | 5 +- src/librustc_trans/machine.rs | 79 - src/librustc_trans/metadata.rs | 2 +- src/librustc_trans/meth.rs | 28 +- src/librustc_trans/mir/analyze.rs | 133 +- src/librustc_trans/mir/block.rs | 648 +- src/librustc_trans/mir/constant.rs | 549 +- src/librustc_trans/mir/lvalue.rs | 421 - src/librustc_trans/mir/mod.rs | 266 +- src/librustc_trans/mir/operand.rs | 414 +- src/librustc_trans/mir/place.rs | 500 + src/librustc_trans/mir/rvalue.rs | 401 +- src/librustc_trans/mir/statement.rs | 59 +- src/librustc_trans/trans_item.rs | 85 +- src/librustc_trans/tvec.rs | 53 - src/librustc_trans/type_.rs | 59 +- src/librustc_trans/type_of.rs | 674 +- src/librustc_trans_utils/Cargo.toml | 5 +- src/librustc_trans_utils/common.rs | 92 - src/librustc_trans_utils/lib.rs | 9 +- src/librustc_trans_utils/link.rs | 11 +- src/librustc_trans_utils/trans_crate.rs | 12 +- src/librustc_typeck/Cargo.toml | 3 +- src/librustc_typeck/astconv.rs | 235 +- src/librustc_typeck/check/_match.rs | 26 +- src/librustc_typeck/check/autoderef.rs | 31 +- src/librustc_typeck/check/callee.rs | 9 +- src/librustc_typeck/check/cast.rs | 67 +- src/librustc_typeck/check/closure.rs | 38 +- src/librustc_typeck/check/coercion.rs | 47 +- src/librustc_typeck/check/compare_method.rs | 8 +- src/librustc_typeck/check/demand.rs | 38 +- src/librustc_typeck/check/dropck.rs | 18 +- src/librustc_typeck/check/intrinsic.rs | 6 +- src/librustc_typeck/check/method/confirm.rs | 1 + src/librustc_typeck/check/method/probe.rs | 51 +- src/librustc_typeck/check/method/suggest.rs | 204 +- src/librustc_typeck/check/mod.rs | 223 +- src/librustc_typeck/check/op.rs | 5 + src/librustc_typeck/check/regionck.rs | 23 +- src/librustc_typeck/check/upvar.rs | 528 +- src/librustc_typeck/check/wfcheck.rs | 80 +- src/librustc_typeck/check/writeback.rs | 266 +- src/librustc_typeck/check_unused.rs | 19 + src/librustc_typeck/coherence/builtin.rs | 11 +- .../coherence/inherent_impls_overlap.rs | 66 +- src/librustc_typeck/coherence/mod.rs | 13 +- src/librustc_typeck/collect.rs | 272 +- src/librustc_typeck/diagnostics.rs | 1 + src/librustc_typeck/impl_wf_check.rs | 4 +- src/librustc_typeck/lib.rs | 41 +- src/librustc_typeck/variance/constraints.rs | 1 + src/librustdoc/Cargo.toml | 5 +- src/librustdoc/build.rs | 2 +- src/librustdoc/clean/cfg.rs | 2 - src/librustdoc/clean/inline.rs | 80 +- src/librustdoc/clean/mod.rs | 386 +- src/librustdoc/clean/simplify.rs | 1 + src/librustdoc/core.rs | 10 +- src/librustdoc/html/format.rs | 109 +- src/librustdoc/html/highlight.rs | 6 +- src/librustdoc/html/layout.rs | 1 + src/librustdoc/html/render.rs | 284 +- src/librustdoc/html/static/main.js | 128 +- src/librustdoc/html/static/rustdoc.css | 229 +- src/librustdoc/html/static/styles/main.css | 109 +- src/librustdoc/lib.rs | 42 +- src/librustdoc/markdown.rs | 60 +- src/librustdoc/passes/collapse_docs.rs | 72 +- src/librustdoc/passes/mod.rs | 9 + src/librustdoc/passes/unindent_comments.rs | 15 +- src/librustdoc/plugins.rs | 2 +- src/librustdoc/test.rs | 70 +- src/librustdoc/visit_ast.rs | 15 + src/librustdoc/visit_lib.rs | 4 +- src/libserialize/collection_impls.rs | 48 + src/libserialize/json.rs | 5 +- src/libserialize/opaque.rs | 4 + src/libserialize/serialize.rs | 48 + src/libstd/ascii.rs | 297 +- src/libstd/build.rs | 18 +- src/libstd/collections/hash/set.rs | 20 +- src/libstd/collections/hash/table.rs | 3 - src/libstd/error.rs | 2 +- src/libstd/f32.rs | 98 +- src/libstd/f64.rs | 78 +- src/libstd/ffi/c_str.rs | 57 + src/libstd/ffi/os_str.rs | 58 + src/libstd/fs.rs | 134 +- src/libstd/io/buffered.rs | 2 +- src/libstd/io/cursor.rs | 25 + src/libstd/io/mod.rs | 52 +- src/libstd/lib.rs | 21 +- src/libstd/macros.rs | 69 +- src/libstd/net/addr.rs | 2 +- src/libstd/net/ip.rs | 6 +- src/libstd/net/parser.rs | 10 +- src/libstd/os/mod.rs | 72 +- src/libstd/os/raw.rs | 2 + src/libstd/panic.rs | 2 +- src/libstd/path.rs | 60 +- src/libstd/primitive_docs.rs | 128 + src/libstd/process.rs | 37 +- src/libstd/rt.rs | 50 +- src/libstd/sync/mpsc/mod.rs | 92 +- src/libstd/sync/mutex.rs | 11 + src/libstd/sync/once.rs | 1 - src/libstd/sync/rwlock.rs | 11 + src/libstd/sys/mod.rs | 99 +- src/libstd/sys/redox/fast_thread_local.rs | 2 +- src/libstd/sys/redox/memchr.rs | 2 +- src/libstd/sys/redox/os.rs | 4 + src/libstd/sys/redox/os_str.rs | 27 +- src/libstd/sys/redox/process.rs | 24 +- src/libstd/sys/redox/time.rs | 12 +- src/libstd/sys/unix/ext/process.rs | 6 + src/libstd/sys/unix/memchr.rs | 2 +- src/libstd/sys/unix/os.rs | 35 +- src/libstd/sys/unix/os_str.rs | 27 +- src/libstd/sys/unix/process/process_common.rs | 143 +- .../sys/unix/process/process_fuchsia.rs | 10 +- src/libstd/sys/unix/process/process_unix.rs | 16 +- src/libstd/sys/unix/thread.rs | 5 +- src/libstd/sys/unix/time.rs | 16 +- src/libstd/sys/wasm/memchr.rs | 2 +- src/libstd/sys/wasm/os_str.rs | 27 +- src/libstd/sys/wasm/process.rs | 15 +- src/libstd/sys/wasm/time.rs | 4 +- src/libstd/sys/windows/fs.rs | 2 +- src/libstd/sys/windows/memchr.rs | 2 +- src/libstd/sys/windows/os_str.rs | 32 +- src/libstd/sys/windows/process.rs | 96 +- src/libstd/sys/windows/thread_local.rs | 3 +- src/libstd/sys/windows/time.rs | 9 +- src/libstd/sys_common/backtrace.rs | 24 +- src/libstd/sys_common/bytestring.rs | 56 + src/libstd/sys_common/gnu/libbacktrace.rs | 2 +- src/libstd/sys_common/memchr.rs | 227 - src/libstd/sys_common/mod.rs | 3 +- src/libstd/sys_common/net.rs | 5 +- src/libstd/sys_common/process.rs | 124 + src/libstd/sys_common/thread_local.rs | 2 +- src/libstd/sys_common/wtf8.rs | 39 +- src/libstd/termination.rs | 86 + src/libstd/time/duration.rs | 65 +- src/libstd/time/mod.rs | 4 +- src/libstd_unicode/char.rs | 46 +- src/libstd_unicode/lib.rs | 1 + src/libstd_unicode/lossy.rs | 1 + src/libstd_unicode/u_str.rs | 1 + src/libsyntax/Cargo.toml | 2 +- src/libsyntax/ast.rs | 192 +- src/libsyntax/attr.rs | 39 +- src/libsyntax/codemap.rs | 85 +- src/libsyntax/config.rs | 4 +- src/libsyntax/diagnostics/metadata.rs | 15 +- src/libsyntax/ext/base.rs | 38 +- src/libsyntax/ext/build.rs | 51 +- src/libsyntax/ext/derive.rs | 2 +- src/libsyntax/ext/expand.rs | 302 +- src/libsyntax/ext/quote.rs | 23 +- src/libsyntax/ext/source_util.rs | 32 +- src/libsyntax/ext/tt/macro_parser.rs | 1 + src/libsyntax/ext/tt/macro_rules.rs | 29 +- src/libsyntax/feature_gate.rs | 276 +- src/libsyntax/fold.rs | 86 +- src/libsyntax/json.rs | 30 +- src/libsyntax/lib.rs | 2 + src/libsyntax/parse/lexer/comments.rs | 4 +- src/libsyntax/parse/lexer/mod.rs | 57 +- src/libsyntax/parse/mod.rs | 39 +- src/libsyntax/parse/obsolete.rs | 2 +- src/libsyntax/parse/parser.rs | 796 +- src/libsyntax/parse/token.rs | 41 +- src/libsyntax/print/pprust.rs | 240 +- src/libsyntax/ptr.rs | 2 +- src/libsyntax/std_inject.rs | 42 +- src/libsyntax/test.rs | 32 +- src/libsyntax/test_snippet.rs | 3 +- src/libsyntax/util/lev_distance.rs | 32 +- src/libsyntax/util/node_count.rs | 12 +- src/libsyntax/util/parser_testing.rs | 6 +- src/libsyntax/visit.rs | 89 +- src/libsyntax_ext/deriving/bounds.rs | 9 +- src/libsyntax_ext/deriving/clone.rs | 31 +- src/libsyntax_ext/deriving/cmp/eq.rs | 3 +- src/libsyntax_ext/deriving/cmp/ord.rs | 5 +- src/libsyntax_ext/deriving/cmp/partial_eq.rs | 3 +- src/libsyntax_ext/deriving/cmp/partial_ord.rs | 9 +- src/libsyntax_ext/deriving/custom.rs | 8 +- src/libsyntax_ext/deriving/debug.rs | 7 +- src/libsyntax_ext/deriving/decodable.rs | 20 +- src/libsyntax_ext/deriving/default.rs | 3 +- src/libsyntax_ext/deriving/encodable.rs | 24 +- src/libsyntax_ext/deriving/generic/mod.rs | 266 +- src/libsyntax_ext/deriving/generic/ty.rs | 87 +- src/libsyntax_ext/deriving/hash.rs | 6 +- src/libsyntax_ext/deriving/mod.rs | 41 +- src/libsyntax_ext/format_foreign.rs | 75 +- src/libsyntax_ext/lib.rs | 1 + src/libsyntax_ext/proc_macro_registrar.rs | 4 +- src/libsyntax_pos/hygiene.rs | 93 +- src/libsyntax_pos/lib.rs | 161 +- src/libsyntax_pos/symbol.rs | 21 +- src/libterm/terminfo/searcher.rs | 5 +- src/libtest/lib.rs | 125 +- src/libtest/stats.rs | 18 +- src/libunwind/build.rs | 4 +- src/rustllvm/ArchiveWrapper.cpp | 51 +- src/rustllvm/PassWrapper.cpp | 266 +- src/rustllvm/RustWrapper.cpp | 174 +- src/rustllvm/rustllvm.h | 6 +- src/stage0.txt | 8 +- src/test/COMPILER_TESTS.md | 59 +- .../item-collection/cross-crate-closures.rs | 8 +- .../cross-crate-generic-functions.rs | 9 +- .../cross-crate-trait-method.rs | 9 +- .../drop_in_place_intrinsic.rs | 9 +- .../item-collection/function-as-argument.rs | 8 +- .../item-collection/generic-drop-glue.rs | 8 +- .../item-collection/generic-functions.rs | 8 +- .../item-collection/generic-impl.rs | 9 +- .../impl-in-non-instantiated-generic.rs | 8 +- .../instantiation-through-vtable.rs | 8 +- .../items-within-generic-items.rs | 8 +- .../item-collection/non-generic-closures.rs | 8 +- .../item-collection/non-generic-drop-glue.rs | 8 +- .../item-collection/non-generic-functions.rs | 8 +- .../item-collection/static-init.rs | 10 +- .../item-collection/statics-and-consts.rs | 9 +- .../item-collection/trait-implementations.rs | 8 +- .../trait-method-as-argument.rs | 8 +- .../trait-method-default-impl.rs | 8 +- .../item-collection/transitive-drop-glue.rs | 9 +- .../item-collection/tuple-drop-glue.rs | 8 +- .../codegen-units/item-collection/unsizing.rs | 9 +- .../methods-are-with-self-type.rs | 9 +- .../partitioning/vtable-through-const.rs | 11 +- src/test/codegen/abi-sysv64.rs | 1 - src/test/codegen/adjustments.rs | 7 +- src/test/codegen/align-struct.rs | 21 + src/test/codegen/consts.rs | 4 +- src/test/codegen/function-arguments.rs | 23 +- src/test/codegen/issue-32031.rs | 4 +- src/test/codegen/issue-47278.rs | 19 + src/test/codegen/link-dead-code.rs | 27 + src/test/codegen/link_section.rs | 4 +- src/test/codegen/match-optimizes-away.rs | 20 +- src/test/codegen/nontemporal.rs | 23 + src/test/codegen/packed.rs | 5 +- src/test/codegen/prefetch.rs | 2 - src/test/codegen/refs.rs | 9 +- src/test/codegen/remap_path_prefix/main.rs | 2 +- src/test/codegen/slice-init.rs | 12 +- src/test/codegen/x86_mmx.rs | 30 + .../dropck_tarena_cycle_checked.rs | 3 +- .../dropck_tarena_unsound_drop.rs | 2 +- .../proc-macro/derive-bad.rs | 3 +- .../proc-macro/lints_in_proc_macros.rs | 2 +- src/test/compile-fail/E0004.rs | 2 +- src/test/compile-fail/E0005.rs | 1 - src/test/compile-fail/E0007.rs | 2 - src/test/compile-fail/E0008.rs | 1 - src/test/compile-fail/E0009.rs | 2 - src/test/compile-fail/E0010.rs | 1 - src/test/compile-fail/E0017.rs | 3 - src/test/compile-fail/E0023.rs | 3 - src/test/compile-fail/E0025.rs | 2 - src/test/compile-fail/E0026.rs | 1 - src/test/compile-fail/E0027.rs | 1 - src/test/compile-fail/E0029.rs | 3 - src/test/compile-fail/E0030.rs | 1 - src/test/compile-fail/E0033.rs | 3 - src/test/compile-fail/E0034.rs | 3 - src/test/compile-fail/E0038.rs | 2 - src/test/compile-fail/E0040.rs | 1 - src/test/compile-fail/E0045.rs | 1 - src/test/compile-fail/E0049.rs | 3 +- src/test/compile-fail/E0050.rs | 9 +- src/test/compile-fail/E0055.rs | 1 - src/test/compile-fail/E0060.rs | 1 - src/test/compile-fail/E0061.rs | 2 - src/test/compile-fail/E0062.rs | 3 +- src/test/compile-fail/E0063.rs | 4 - src/test/compile-fail/E0067.rs | 2 - src/test/compile-fail/E0069.rs | 1 - src/test/compile-fail/E0071.rs | 1 - src/test/compile-fail/E0076.rs | 1 - src/test/compile-fail/E0080.rs | 2 + src/test/compile-fail/E0081.rs | 3 +- src/test/compile-fail/E0084.rs | 2 +- src/test/compile-fail/E0087.rs | 2 - src/test/compile-fail/E0089.rs | 1 - src/test/compile-fail/E0090.rs | 1 - src/test/compile-fail/E0091.rs | 2 - src/test/compile-fail/E0092.rs | 2 +- src/test/compile-fail/E0093.rs | 1 - src/test/compile-fail/E0094.rs | 1 - src/test/compile-fail/E0106.rs | 3 - src/test/compile-fail/E0109.rs | 1 - src/test/compile-fail/E0110.rs | 1 - src/test/compile-fail/E0116.rs | 2 - src/test/compile-fail/E0117.rs | 3 - src/test/compile-fail/E0118.rs | 2 - src/test/compile-fail/E0119.rs | 3 +- src/test/compile-fail/E0120.rs | 1 - src/test/compile-fail/E0124.rs | 3 +- src/test/compile-fail/E0128.rs | 1 - src/test/compile-fail/E0130.rs | 1 - src/test/compile-fail/E0131.rs | 1 - src/test/compile-fail/E0132.rs | 1 - src/test/compile-fail/E0133.rs | 1 - src/test/compile-fail/E0137.rs | 3 +- src/test/compile-fail/E0138.rs | 2 - src/test/compile-fail/E0162.rs | 1 - src/test/compile-fail/E0164.rs | 1 - src/test/compile-fail/E0184.rs | 2 - src/test/compile-fail/E0191.rs | 1 - src/test/compile-fail/E0194.rs | 3 +- src/test/compile-fail/E0206.rs | 5 - src/test/compile-fail/E0207.rs | 1 - src/test/compile-fail/E0214.rs | 1 - src/test/compile-fail/E0220.rs | 2 - src/test/compile-fail/E0221.rs | 9 +- src/test/compile-fail/E0223.rs | 2 - src/test/compile-fail/E0225.rs | 1 - src/test/compile-fail/E0229.rs | 1 - src/test/compile-fail/E0232.rs | 2 - src/test/compile-fail/E0243.rs | 1 - src/test/compile-fail/E0244.rs | 1 - src/test/compile-fail/E0253.rs | 1 - src/test/compile-fail/E0254.rs | 3 - src/test/compile-fail/E0259.rs | 4 - src/test/compile-fail/E0260.rs | 3 - src/test/compile-fail/E0263.rs | 2 - src/test/compile-fail/E0267.rs | 1 - src/test/compile-fail/E0268.rs | 1 - src/test/compile-fail/E0277-2.rs | 5 - src/test/compile-fail/E0277.rs | 5 - src/test/compile-fail/E0297.rs | 1 - src/test/compile-fail/E0301.rs | 1 - src/test/compile-fail/E0302.rs | 1 - src/test/compile-fail/E0303.rs | 3 - src/test/compile-fail/E0365.rs | 2 - src/test/compile-fail/E0375.rs | 3 - src/test/compile-fail/E0389.rs | 1 - src/test/compile-fail/E0392.rs | 1 - src/test/compile-fail/E0393.rs | 2 - src/test/compile-fail/E0394.rs | 2 - src/test/compile-fail/E0395.rs | 1 - src/test/compile-fail/E0396.rs | 1 - src/test/compile-fail/E0403.rs | 2 - src/test/compile-fail/E0407.rs | 1 - src/test/compile-fail/E0408.rs | 3 +- src/test/compile-fail/E0426.rs | 1 - src/test/compile-fail/E0428.rs | 2 - src/test/compile-fail/E0435.rs | 1 - src/test/compile-fail/E0437.rs | 1 - src/test/compile-fail/E0438.rs | 1 - src/test/compile-fail/E0445.rs | 6 +- src/test/compile-fail/E0446.rs | 1 - src/test/compile-fail/E0449.rs | 4 - src/test/compile-fail/E0451.rs | 2 - src/test/compile-fail/E0453.rs | 2 - src/test/compile-fail/E0454.rs | 1 - src/test/compile-fail/E0458.rs | 2 - src/test/compile-fail/E0459.rs | 1 - src/test/compile-fail/E0463.rs | 1 - src/test/compile-fail/E0496.rs | 2 - src/test/compile-fail/E0501.rs | 15 +- src/test/compile-fail/E0506.rs | 5 +- src/test/compile-fail/E0508.rs | 7 +- src/test/compile-fail/E0517.rs | 8 +- src/test/compile-fail/E0518.rs | 4 +- src/test/compile-fail/E0520.rs | 3 - src/test/compile-fail/E0527.rs | 1 - src/test/compile-fail/E0528.rs | 1 - src/test/compile-fail/E0529.rs | 1 - src/test/compile-fail/E0532.rs | 24 + src/test/compile-fail/E0558.rs | 1 - src/test/compile-fail/E0559.rs | 2 - src/test/compile-fail/E0560.rs | 2 - src/test/compile-fail/E0594.rs | 5 +- src/test/compile-fail/E0596.rs | 5 +- src/test/compile-fail/E0597.rs | 3 +- src/test/compile-fail/E0599.rs | 15 + src/test/compile-fail/E0605.rs | 2 - src/test/compile-fail/E0618.rs | 1 - src/test/compile-fail/E0657.rs | 36 + .../absolute-paths-in-nested-use-groups.rs | 22 + src/test/compile-fail/asm-out-read-uninit.rs | 7 +- .../compile-fail/assign-imm-local-twice.rs | 12 +- .../compile-fail/associated-const-in-trait.rs | 24 + .../compile-fail/auxiliary/issue_5844_aux.rs | 6 +- .../auxiliary/private-inferred-type.rs | 2 + src/test/compile-fail/bad-env-capture.rs | 2 +- src/test/compile-fail/bad-env-capture2.rs | 2 +- src/test/compile-fail/bad-env-capture3.rs | 2 +- .../borrowck/borrowck-access-permissions.rs | 22 +- .../compile-fail/borrowck/borrowck-asm.rs | 97 + .../borrowck/borrowck-assign-comp.rs | 11 +- .../borrowck/borrowck-assign-to-constants.rs | 5 +- .../borrowck/borrowck-closures-mut-and-imm.rs | 28 +- .../borrowck/borrowck-describe-lvalue.rs | 125 +- .../borrowck/borrowck-drop-from-guard.rs | 4 +- .../borrowck/borrowck-fn-in-const-a.rs | 5 +- ...k-imm-ref-to-mut-rec-field-issue-3162-c.rs | 5 +- .../borrowck/borrowck-init-in-fru.rs | 5 +- .../borrowck/borrowck-issue-14498.rs | 30 +- .../borrowck/borrowck-lend-flow-match.rs | 5 +- .../borrowck-local-borrow-outlives-fn.rs} | 11 +- ...wck-local-borrow-with-panic-outlives-fn.rs | 24 + .../borrowck-match-already-borrowed.rs | 19 +- .../borrowck-match-binding-is-assignment.rs | 17 +- .../borrowck/borrowck-move-in-irrefut-pat.rs | 11 +- .../borrowck-move-moved-value-into-closure.rs | 6 +- ...rowck-move-out-of-overloaded-auto-deref.rs | 5 +- .../borrowck-move-out-of-static-item.rs | 5 +- .../borrowck-move-out-of-struct-with-dtor.rs | 11 +- .../borrowck-mut-borrow-linear-errors.rs | 17 +- ...k-overloaded-index-and-overloaded-deref.rs | 5 +- .../borrowck-overloaded-index-ref-index.rs | 11 +- .../borrowck/borrowck-pat-reassign-binding.rs | 5 +- .../borrowck/borrowck-storage-dead.rs | 9 +- .../borrowck-struct-update-with-dtor.rs | 8 +- ...thread-local-static-borrow-outlives-fn.rs} | 19 +- .../borrowck/borrowck-unary-move.rs | 5 +- .../borrowck/borrowck-uninit-field-access.rs | 11 +- .../borrowck/borrowck-uninit-ref-chain.rs | 19 +- .../borrowck/borrowck-union-borrow.rs | 39 +- .../borrowck/borrowck-use-in-index-lvalue.rs | 8 +- ...orrowck-use-uninitialized-in-cast-trait.rs | 5 +- .../borrowck-use-uninitialized-in-cast.rs | 5 +- .../borrowck-vec-pattern-move-tail.rs | 9 +- .../move-in-static-initializer-issue-38520.rs | 8 +- ...o-phase-activation-sharing-interference.rs | 62 + ...o-phase-allow-access-during-reservation.rs | 37 + .../two-phase-cannot-nest-mut-self-calls.rs | 34 + ...hase-reservation-sharing-interference-2.rs | 37 + ...-phase-reservation-sharing-interference.rs | 46 + .../compile-fail/borrowck/two-phase-sneaky.rs | 30 + .../cannot-mutate-captured-non-mut-var.rs | 10 +- src/test/compile-fail/capture1.rs | 2 +- src/test/compile-fail/catch-bad-lifetime.rs | 3 +- ...ure-bounds-static-cant-capture-borrowed.rs | 3 +- .../coerce-overloaded-autoderef.rs | 14 +- src/test/compile-fail/coerce-to-bang-cast.rs | 3 + src/test/compile-fail/coerce-to-bang.rs | 7 + .../compile-fail/conservative_impl_trait.rs | 18 + .../compile-fail/const-fn-feature-flags.rs | 24 - src/test/compile-fail/const-match-check.rs | 44 + .../dep_graph_crosscontaminate_tables.rs | 40 - .../derive-on-trait-item-or-impl-item.rs | 23 + .../foo/compiletest-ignore-dir} | 0 .../foo/mod_file_not_owning/aux2.rs | 9 + .../foo/mod_file_not_owning_aux2.rs | 9 + .../mod_file_not_owning.rs | 2 +- .../compiletest-ignore-dir} | 0 .../mod_file_not_owning_aux2.rs | 9 + .../unowned_mod_with_path.rs | 2 +- .../compile-fail/diverging-fn-tail-35849.rs | 10 +- .../compile-fail/dollar-crate-is-keyword-2.rs | 4 +- .../dropck_trait_cycle_checked.rs | 2 - .../compile-fail/duplicate_entry_error.rs | 2 +- .../compile-fail/empty-struct-braces-expr.rs | 4 +- src/test/compile-fail/extern-macro.rs | 18 + src/test/compile-fail/external-doc-error.rs | 16 + .../feature-gate-nested_impl_trait.rs | 39 + .../feature-gate-termination_trait.rs | 13 + .../float-int-invalid-const-cast.rs | 2 +- .../generator-yielding-or-returning-itself.rs | 45 + .../compile-fail/hrtb-identity-fn-borrows.rs | 5 +- .../compile-fail/immut-function-arguments.rs | 9 +- src/test/compile-fail/impl-trait/lifetimes.rs | 43 - .../must_outlive_least_region_or_bound.rs | 39 + .../impl-trait/needs_least_region_or_bound.rs | 23 + .../impl-trait/type_parameters_captured.rs | 24 + .../compile-fail/impl-trait/where-allowed.rs | 2 +- .../issue-10412.rs | 6 +- src/test/compile-fail/issue-10755.rs | 4 +- src/test/compile-fail/issue-12511.rs | 22 - .../compile-fail/issue-17718-const-borrow.rs | 2 - src/test/compile-fail/issue-17954.rs | 16 +- src/test/compile-fail/issue-17959.rs | 2 +- src/test/compile-fail/issue-20692.rs | 26 - src/test/compile-fail/issue-21950.rs | 23 - src/test/compile-fail/issue-22560.rs | 28 - src/test/compile-fail/issue-22638.rs | 2 +- src/test/compile-fail/issue-24036.rs | 37 - .../{run-pass => compile-fail}/issue-25439.rs | 2 +- src/test/compile-fail/issue-25579.rs | 17 +- src/test/{ui => compile-fail}/issue-26548.rs | 5 +- src/test/compile-fail/issue-27060-2.rs | 16 + src/test/compile-fail/issue-27060.rs | 43 + src/test/compile-fail/issue-27078.rs | 21 + src/test/compile-fail/issue-28848.rs | 2 +- src/test/compile-fail/issue-30079.rs | 7 +- src/test/compile-fail/issue-34334.rs | 1 - src/test/compile-fail/issue-36082.rs | 13 +- src/test/compile-fail/issue-38857.rs | 15 + src/test/compile-fail/issue-39848.rs | 20 + src/test/compile-fail/issue-41880.rs | 39 + src/test/compile-fail/issue-43355.rs | 32 + src/test/compile-fail/issue-43733-2.rs | 2 +- src/test/compile-fail/issue-45199.rs | 41 + src/test/compile-fail/issue-45965.rs | 14 + src/test/compile-fail/issue-46023.rs | 22 + ...sue-46209-private-enum-variant-reexport.rs | 51 + src/test/compile-fail/issue-46311.rs | 14 + src/test/compile-fail/issue-46771.rs | 14 + src/test/compile-fail/issue-46843.rs | 22 + src/test/compile-fail/issue-47412.rs | 31 + src/test/compile-fail/issue-5500-1.rs | 9 +- src/test/compile-fail/issue-7364.rs | 3 +- src/test/compile-fail/kindck-send-unsafe.rs | 2 +- .../lifetime-no-keyword.rs | 9 +- src/test/compile-fail/lint-ctypes.rs | 8 +- src/test/compile-fail/lint-dead-code-1.rs | 2 +- src/test/compile-fail/lint-dead-code-3.rs | 5 +- src/test/compile-fail/lint-dead-code-4.rs | 8 +- src/test/compile-fail/lint-dead-code-5.rs | 6 +- .../compile-fail/lint-dead-code-variant.rs | 2 +- .../compile-fail/lint-stability-deprecated.rs | 5 + src/test/compile-fail/lint-stability.rs | 4 + .../liveness-assign-imm-local-in-loop.rs | 9 +- .../liveness-assign-imm-local-in-op-eq.rs | 12 +- .../liveness-assign-imm-local-with-drop.rs | 26 + .../liveness-assign-imm-local-with-init.rs | 12 +- src/test/compile-fail/main-wrong-type-2.rs | 3 +- .../compile-fail/mir_check_cast_closure.rs | 22 + src/test/compile-fail/mir_check_cast_reify.rs | 52 + .../compile-fail/mir_check_cast_unsafe_fn.rs | 24 + .../compile-fail/mir_check_cast_unsize.rs | 24 + .../mut-pattern-internal-mutability.rs | 8 +- src/test/compile-fail/mutable-class-fields.rs | 6 +- .../compile-fail/never-assign-wrong-type.rs | 2 - .../nll/loan_ends_mid_block_pair.rs | 2 +- .../nll/loan_ends_mid_block_vec.rs | 2 +- .../reference-carried-through-struct-field.rs | 27 + .../nll/region-ends-after-if-condition.rs | 2 +- src/test/compile-fail/nll/return_from_loop.rs | 2 +- .../nll/where_clauses_in_functions.rs | 28 + .../nll/where_clauses_in_structs.rs | 28 + .../compile-fail/nolink-with-link-args.rs | 1 + src/test/compile-fail/non-copyable-void.rs | 2 + src/test/compile-fail/occurs-check-2.rs | 2 - src/test/compile-fail/occurs-check.rs | 2 - .../panic-runtime/libtest-unwinds.rs | 1 + .../panic-runtime/transitive-link-a-bunch.rs | 1 + .../panic-runtime/want-unwind-got-abort.rs | 1 + .../panic-runtime/want-unwind-got-abort2.rs | 1 + .../associated-item-privacy-inherent.rs | 122 + .../privacy/associated-item-privacy-trait.rs | 151 + .../associated-item-privacy-type-binding.rs | 74 + .../private-in-public-assoc-ty.rs | 43 + .../private-in-public-ill-formed.rs | 45 + .../compile-fail/private-in-public-warn.rs | 15 - .../compile-fail/private-inferred-type-3.rs | 1 + .../compile-fail/private-inferred-type.rs | 7 +- .../compile-fail/private-variant-reexport.rs | 8 +- .../compile-fail/quote-with-interpolated.rs | 19 + src/test/compile-fail/range_inclusive_gate.rs | 2 - .../region-borrow-params-issue-29793-big.rs | 10 +- .../regions-normalize-in-where-clause-list.rs | 37 + .../regions-pattern-typing-issue-19997.rs | 5 +- src/test/compile-fail/regions-static-bound.rs | 15 +- .../compile-fail/regions-struct-not-wf.rs | 12 +- .../crate-path-non-absolute.rs | 21 + .../crate-visibility-ambiguity.rs | 23 + .../keyword-crate-as-identifier.rs} | 4 +- .../auxiliary/xcrate.rs | 15 + .../non-existent-1.rs | 15 + .../non-existent-2.rs | 15 + .../non-existent-3.rs | 15 + .../single-segment.rs | 24 + .../static-mut-foreign-requires-unsafe.rs | 6 +- .../compile-fail/static-mut-not-constant.rs | 1 - src/test/compile-fail/super-at-top-level.rs | 3 +- .../termination-trait-not-satisfied.rs | 17 + src/test/compile-fail/trait-alias.rs | 27 + .../compile-fail/trait-duplicate-methods.rs | 18 - src/test/compile-fail/trait-item-privacy.rs | 10 + .../trait-suggest-where-clause.rs | 69 - ...-closures-mutated-upvar-from-fn-closure.rs | 6 +- src/test/compile-fail/unsupported-cast.rs | 6 +- .../compile-fail/use-super-global-path.rs | 2 +- src/test/compile-fail/useless_comment.rs | 2 +- src/test/compile-fail/weak-lang-item.rs | 1 + .../compile-fail/where-lifetime-resolution.rs | 4 +- src/test/debuginfo/constant-debug-locs.rs | 1 - src/test/debuginfo/shadowed-variable.rs | 32 + .../auxiliary/incremental_proc_macro_aux.rs} | 29 +- .../incremental_proc_macro.rs | 27 + src/test/incremental/change_crate_dep_kind.rs | 24 + .../incremental/hashes/call_expressions.rs | 24 +- .../incremental/hashes/closure_expressions.rs | 74 +- src/test/incremental/hashes/consts.rs | 19 +- .../incremental/hashes/enum_constructors.rs | 31 +- src/test/incremental/hashes/enum_defs.rs | 119 +- .../incremental/hashes/exported_vs_not.rs | 8 +- src/test/incremental/hashes/extern_mods.rs | 50 +- src/test/incremental/hashes/for_loops.rs | 134 +- .../incremental/hashes/function_interfaces.rs | 288 +- src/test/incremental/hashes/if_expressions.rs | 18 +- .../hashes/indexing_expressions.rs | 16 +- src/test/incremental/hashes/inherent_impls.rs | 146 +- src/test/incremental/hashes/inline_asm.rs | 77 +- .../incremental/hashes/let_expressions.rs | 270 +- .../incremental/hashes/loop_expressions.rs | 98 +- .../incremental/hashes/match_expressions.rs | 28 +- src/test/incremental/hashes/panic_exprs.rs | 187 +- .../hashes/panic_exprs_no_overflow_checks.rs | 251 - src/test/incremental/hashes/statics.rs | 28 +- .../incremental/hashes/struct_constructors.rs | 20 +- src/test/incremental/hashes/struct_defs.rs | 75 +- src/test/incremental/hashes/trait_defs.rs | 209 +- src/test/incremental/hashes/trait_impls.rs | 76 +- src/test/incremental/hashes/type_defs.rs | 20 +- .../hashes/unary_and_binary_exprs.rs | 58 +- .../incremental/hashes/while_let_loops.rs | 110 +- src/test/incremental/hashes/while_loops.rs | 110 +- .../ich_method_call_trait_scope.rs | 15 +- src/test/incremental/ich_nested_items.rs | 13 +- src/test/incremental/ich_resolve_results.rs | 40 +- src/test/incremental/issue-42602.rs | 15 +- .../incremental/remapped_paths_cc/main.rs | 2 +- src/test/incremental/source_loc_macros.rs | 30 +- .../incremental/spans_significant_w_panic.rs | 3 +- .../unchecked_dirty_clean_metadata.rs | 35 - src/test/mir-opt/basic_assignment.rs | 16 +- src/test/mir-opt/box_expr.rs | 22 +- src/test/mir-opt/combine_array_len.rs | 33 + src/test/mir-opt/copy_propagation.rs | 6 +- src/test/mir-opt/copy_propagation_arg.rs | 86 +- src/test/mir-opt/deaggregator_test.rs | 4 +- src/test/mir-opt/deaggregator_test_enum.rs | 4 +- src/test/mir-opt/deaggregator_test_enum_2.rs | 8 +- .../mir-opt/deaggregator_test_multiple.rs | 12 +- src/test/mir-opt/end_region_2.rs | 2 +- src/test/mir-opt/end_region_3.rs | 2 +- src/test/mir-opt/end_region_4.rs | 12 +- src/test/mir-opt/end_region_5.rs | 17 +- src/test/mir-opt/end_region_6.rs | 16 +- src/test/mir-opt/end_region_7.rs | 15 +- src/test/mir-opt/end_region_8.rs | 16 +- src/test/mir-opt/end_region_9.rs | 2 +- src/test/mir-opt/end_region_cyclic.rs | 30 +- .../end_region_destruction_extents_1.rs | 20 +- .../mir-opt/inline-closure-borrows-arg.rs | 50 + src/test/mir-opt/inline-closure.rs | 8 +- src/test/mir-opt/issue-38669.rs | 2 +- src/test/mir-opt/issue-41110.rs | 2 + src/test/mir-opt/issue-41697.rs | 2 +- src/test/mir-opt/lower_128bit_debug_test.rs | 239 + src/test/mir-opt/lower_128bit_test.rs | 203 + src/test/mir-opt/match_false_edges.rs | 286 +- .../mir-opt/nll/liveness-call-subtlety.rs | 16 +- .../mir-opt/nll/liveness-drop-intra-block.rs | 16 +- src/test/mir-opt/nll/liveness-interblock.rs | 22 +- src/test/mir-opt/nll/named-lifetimes-basic.rs | 25 +- src/test/mir-opt/nll/reborrow-basic.rs | 11 +- src/test/mir-opt/nll/region-liveness-basic.rs | 34 +- .../nll/region-liveness-drop-no-may-dangle.rs | 50 - .../nll/region-liveness-two-disjoint-uses.rs | 12 +- .../mir-opt/nll/region-subtyping-basic.rs | 14 +- .../mir-opt/packed-struct-drop-aligned.rs | 70 + src/test/mir-opt/return_an_array.rs | 2 +- src/test/mir-opt/simplify_if.rs | 4 +- .../mir-opt/storage_live_dead_in_statics.rs | 6 +- src/test/mir-opt/storage_ranges.rs | 2 +- src/test/mir-opt/validate_1.rs | 8 +- src/test/mir-opt/validate_2.rs | 6 +- src/test/mir-opt/validate_3.rs | 2 +- src/test/mir-opt/validate_4.rs | 17 +- src/test/mir-opt/validate_5.rs | 10 +- src/test/parse-fail/doc-after-struct-field.rs | 12 +- .../parse-fail/doc-before-struct-rbrace-1.rs | 2 +- .../parse-fail/doc-before-struct-rbrace-2.rs | 2 +- src/test/parse-fail/issue-17383.rs | 2 +- src/test/parse-fail/issue-37113.rs | 2 +- src/test/parse-fail/issue-37234.rs | 2 +- .../keywords-followed-by-double-colon.rs | 8 +- .../parse-fail/lex-bad-char-literals-3.rs | 2 +- .../parse-fail/lex-bad-char-literals-5.rs | 2 +- src/test/parse-fail/pat-lt-bracket-5.rs | 2 +- src/test/parse-fail/range_inclusive_gate.rs | 2 - .../tag-variant-disr-non-nullary.rs | 2 +- .../parse-fail/trait-object-bad-parens.rs | 6 +- .../trait-object-polytrait-priority.rs | 4 +- src/test/pretty/closure-reform-pretty.rs | 2 +- src/test/pretty/issue-4264.pp | 2 +- src/test/pretty/path-type-bounds.rs | 6 +- .../run-fail/borrowck-local-borrow.rs} | 12 +- .../run-fail/mir_trans_no_landing_pads.rs | 2 +- .../mir_trans_no_landing_pads_diverging.rs | 2 +- src/test/run-fail/return-never-coerce.rs | 2 - src/test/run-make/a-b-a-linker-guard/a.rs | 2 - src/test/run-make/atomic-lock-free/Makefile | 24 +- .../cat-and-grep-sanity-check/Makefile | 46 + .../run-make/cdylib-fewer-symbols/Makefile | 10 +- .../run-make/codegen-options-parsing/Makefile | 34 +- .../Makefile | 2 +- .../error-writing-dependencies/Makefile | 4 +- src/test/run-make/extern-fn-reachable/main.rs | 4 +- src/test/run-make/hir-tree/Makefile | 9 + .../run-make/hir-tree/input.rs} | 9 +- src/test/run-make/include_bytes_deps/Makefile | 3 +- src/test/run-make/include_bytes_deps/input.md | 1 + src/test/run-make/include_bytes_deps/main.rs | 5 + .../run-make/inline-always-many-cgu/Makefile | 2 +- src/test/run-make/invalid-library/Makefile | 2 +- src/test/run-make/invalid-staticlib/Makefile | 2 +- src/test/run-make/issue-14698/Makefile | 2 +- src/test/run-make/issue-19371/foo.rs | 12 +- src/test/run-make/issue-22131/Makefile | 2 +- src/test/run-make/issue-25581/test.c | 13 +- src/test/run-make/issue-26092/Makefile | 3 +- src/test/run-make/issue-33329/Makefile | 4 +- src/test/run-make/issue-35164/Makefile | 2 +- src/test/run-make/issue-40535/Makefile | 10 +- src/test/run-make/link-arg/Makefile | 2 +- src/test/run-make/link-cfg/Makefile | 2 +- .../run-make/linker-output-non-utf8/Makefile | 2 +- .../Makefile | 6 + .../long-linker-command-lines-cmd-exe/foo.bat | 1 + .../long-linker-command-lines-cmd-exe/foo.rs | 111 + .../run-make/long-linker-command-lines/foo.rs | 21 +- .../many-crates-but-no-match/Makefile | 12 +- .../mismatching-target-triples/Makefile | 2 +- .../missing-crate-dependency/Makefile | 2 +- src/test/run-make/no-builtins-lto/Makefile | 2 +- .../output-filename-overwrites-input/Makefile | 10 + .../output-filename-overwrites-input/foo.rs} | 4 +- src/test/run-make/print-cfg/Makefile | 14 +- .../reproducible-build/reproducible-build.rs | 2 - .../run-make/rustc-macro-dep-files/Makefile | 2 +- src/test/run-make/sanitizer-address/Makefile | 5 +- .../run-make/sanitizer-cdylib-link/Makefile | 3 +- .../run-make/sanitizer-dylib-link/Makefile | 3 +- .../sanitizer-invalid-cratetype/Makefile | 2 +- .../sanitizer-invalid-target/Makefile | 3 +- src/test/run-make/sanitizer-leak/Makefile | 10 +- src/test/run-make/sanitizer-memory/Makefile | 6 +- .../sanitizer-staticlib-link/Makefile | 2 +- src/test/run-make/sepcomp-inlining/foo.rs | 7 +- src/test/run-make/static-nobundle/Makefile | 8 +- .../run-make/symbols-are-reasonable/Makefile | 4 +- .../symbols-include-type-name/Makefile | 2 +- src/test/run-make/target-specs/Makefile | 6 +- .../run-make/target-without-atomics/Makefile | 2 +- src/test/run-make/test-harness/Makefile | 7 +- src/test/run-make/tools.mk | 3 +- src/test/run-make/treat-err-as-bug/Makefile | 2 +- .../type-mismatch-same-crate-name/Makefile | 6 +- src/test/run-make/used/Makefile | 2 +- .../run-make/volatile-intrinsics/Makefile | 3 +- .../run-make/weird-output-filenames/Makefile | 12 +- .../run-pass-fulldeps/ast_stmt_expr_attr.rs | 4 +- .../auxiliary/custom_derive_partial_eq.rs | 2 +- .../auxiliary/custom_derive_plugin.rs | 2 +- .../auxiliary/custom_derive_plugin_attr.rs | 5 +- ...ple_items_syntax_ext.rs => issue-16723.rs} | 0 .../auxiliary/linkage-visibility.rs | 4 +- ...on_phase.rs => outlive-expansion-phase.rs} | 0 .../auxiliary/roman_numerals.rs | 4 +- .../run-pass-fulldeps/create-dir-all-bare.rs | 4 +- .../derive-no-std-not-supported.rs | 6 +- src/test/run-pass-fulldeps/issue-15149.rs | 4 +- ...ple_items_syntax_ext.rs => issue-16723.rs} | 4 +- ...on-phase.rs => outlive-expansion-phase.rs} | 4 +- .../pprust-expr-roundtrip.rs | 5 +- .../auxiliary/issue-40001-plugin.rs | 5 +- .../proc-macro/auxiliary/issue-42708.rs | 28 + .../proc-macro/issue-42708.rs | 36 + .../run-pass-fulldeps/rename-directory.rs | 4 +- src/test/run-pass-fulldeps/stdio-from.rs | 4 +- src/test/run-pass-fulldeps/switch-stdout.rs | 4 +- .../vector-sort-panic-safe.rs | 1 - .../run-pass-valgrind/cast-enum-with-dtor.rs | 1 - src/test/run-pass/abi-sysv64-arg-passing.rs | 1 - .../run-pass/abi-sysv64-register-usage.rs | 3 +- src/test/run-pass/abort-on-c-abi.rs | 44 + src/test/run-pass/align-offset-sign.rs | 16 + src/test/run-pass/align-with-extern-c-fn.rs | 23 + ...arbitrary_self_types_raw_pointer_struct.rs | 37 + .../arbitrary_self_types_raw_pointer_trait.rs | 70 + src/test/run-pass/asm-in-moved.rs | 41 + src/test/run-pass/asm-out-assign.rs | 2 + ...ject-from-type-param-via-bound-in-where.rs | 2 - .../run-pass/auxiliary/issue-17718-aux.rs | 2 - src/test/run-pass/auxiliary/issue_42007_s.rs | 2 +- src/test/run-pass/auxiliary/svh-a-comment.rs | 36 - src/test/run-pass/auxiliary/svh-a-doc.rs | 38 - src/test/run-pass/auxiliary/svh-a-macro.rs | 37 - .../run-pass/auxiliary/svh-a-no-change.rs | 35 - .../run-pass/auxiliary/svh-a-redundant-cfg.rs | 37 - .../run-pass/auxiliary/svh-a-whitespace.rs | 37 - .../auxiliary/thread-local-extern-static.rs | 1 - .../borrowck-assignment-to-static-mut.rs | 5 +- .../borrowck-nll-iterating-and-updating.rs | 34 + .../borrowck-unsafe-static-mutable-borrows.rs | 2 +- .../run-pass/borrowck/two-phase-baseline.rs | 21 + ...se-control-flow-split-before-activation.rs | 28 + src/test/run-pass/box-of-array-of-drop-1.rs | 2 - src/test/run-pass/box-of-array-of-drop-2.rs | 2 - .../run-pass/cast-rfc0401-vtable-kinds.rs | 17 + src/test/run-pass/conservative_impl_trait.rs | 19 + src/test/run-pass/const-fn-feature-flags.rs | 4 +- src/test/run-pass/const-size_of-align_of.rs | 2 +- .../run-pass/deriving-with-repr-packed.rs | 45 + src/test/run-pass/diverging-fn-tail-35849.rs | 2 +- src/test/run-pass/dynamic-drop.rs | 38 +- .../run-pass/enum-discrim-manual-sizing.rs | 3 + .../enum-non-c-like-repr-c-and-int.rs | 177 + src/test/run-pass/enum-non-c-like-repr-c.rs | 177 + src/test/run-pass/enum-univariant-repr.rs | 13 + src/test/run-pass/for-loop-mut-ref-element.rs | 2 +- .../run-pass/generator/borrow-in-tail-expr.rs | 2 +- src/test/run-pass/generator/match-bindings.rs | 2 +- src/test/run-pass/generator/yield-subtype.rs | 2 +- src/test/run-pass/hygiene/auxiliary/xcrate.rs | 38 + .../run-pass/hygiene/issue-44128.rs} | 17 +- src/test/run-pass/hygiene/xcrate.rs | 21 + src/test/run-pass/i128.rs | 2 + src/test/run-pass/ifmt.rs | 4 +- .../run-pass/impl-trait/example-calendar.rs | 3 + src/test/run-pass/impl-trait/issue-42479.rs | 27 + src/test/run-pass/impl-trait/lifetimes.rs | 120 + src/test/run-pass/in-band-lifetimes.rs | 104 + src/test/run-pass/issue-16671.rs | 2 + .../issue-17718-static-unsafe-interior.rs | 3 - src/test/run-pass/issue-17718.rs | 4 - src/test/run-pass/issue-21486.rs | 2 - src/test/run-pass/issue-22066.rs | 2 +- src/test/run-pass/issue-26322.rs | 8 +- src/test/run-pass/issue-26655.rs | 2 - src/test/run-pass/issue-27060.rs | 42 + src/test/run-pass/issue-27997.rs | 2 - src/test/run-pass/issue-32292.rs | 2 +- src/test/run-pass/issue-33992.rs | 2 +- src/test/run-pass/issue-35376.rs | 2 +- src/test/run-pass/issue-43355.rs | 36 + .../issue-43483.rs} | 15 +- src/test/run-pass/issue-44373.rs | 2 + src/test/run-pass/issue-45152.rs | 31 + src/test/run-pass/issue-46069.rs | 32 + src/test/run-pass/issue-46553.rs | 32 + src/test/run-pass/issue-46845.rs | 39 + src/test/run-pass/issue-46855.rs | 34 + .../issue-46920-byte-array-patterns.rs | 37 + src/test/run-pass/issue-47139-1.rs | 87 + src/test/run-pass/issue-47139-2.rs | 75 + src/test/run-pass/issue-47638.rs | 18 + src/test/run-pass/issue-8860.rs | 1 + .../run-pass/lto-still-runs-thread-dtors.rs | 41 + .../macro-lifetime-used-with-bound.rs} | 20 +- .../macro-lifetime-used-with-labels.rs | 44 + .../macro-lifetime-used-with-static.rs | 25 + .../run-pass/macro-lifetime.rs} | 19 +- .../macro-nested_expr.rs} | 24 +- src/test/run-pass/match-pipe-binding.rs | 1 + .../run-pass/mir-typeck-normalize-fn-sig.rs | 38 + src/test/run-pass/multiple-reprs.rs | 52 +- src/test/run-pass/nested-vec-3.rs | 2 - .../next-power-of-two-overflow-debug.rs | 1 + src/test/run-pass/nll/get_default.rs | 31 + .../run-pass/nll/process_or_insert_default.rs | 37 + src/test/run-pass/nll/rc-loop.rs | 40 + src/test/run-pass/no-landing-pads.rs | 2 +- src/test/run-pass/non_modrs_mods/foors_mod.rs | 14 + .../foors_mod/compiletest-ignore-dir} | 0 .../foors_mod/inner_foors_mod.rs | 11 + .../foors_mod/inner_foors_mod/innest.rs | 11 + .../foors_mod/inner_modrs_mod/innest.rs | 11 + .../foors_mod/inner_modrs_mod/mod.rs | 11 + .../modrs_mod/compiletest-ignore-dir | 0 .../modrs_mod/inner_foors_mod.rs | 11 + .../modrs_mod/inner_foors_mod/innest.rs | 11 + .../modrs_mod/inner_modrs_mod/innest.rs | 11 + .../modrs_mod/inner_modrs_mod/mod.rs | 11 + .../run-pass/non_modrs_mods/modrs_mod/mod.rs | 12 + .../run-pass/non_modrs_mods/non_modrs_mods.rs | 26 + .../some_crazy_attr_mod_dir/arbitrary_name.rs | 11 + .../compiletest-ignore-dir | 0 .../inner_modrs_mod/innest.rs | 11 + .../inner_modrs_mod/mod.rs | 11 + src/test/run-pass/optimization-fuel-1.rs | 2 - .../run-pass/packed-struct-borrow-element.rs | 2 +- .../run-pass/packed-struct-drop-aligned.rs | 42 + .../run-pass/packed-struct-optimized-enum.rs | 45 + src/test/run-pass/panic-handler-chain.rs | 1 - src/test/run-pass/panic-handler-set-twice.rs | 1 - .../crate-path-absolute.rs | 41 + .../auxiliary/xcrate.rs | 15 + .../rfc-2126-extern-absolute-paths/basic.rs | 31 + ...e_defaults.rs => cross_crates_defaults.rs} | 0 ...te-defaults.rs => cross-crate-defaults.rs} | 6 +- src/test/run-pass/struct-order-of-eval-3.rs | 2 - src/test/run-pass/struct-order-of-eval-4.rs | 2 - src/test/run-pass/svh-add-comment.rs | 23 - src/test/run-pass/svh-add-macro.rs | 23 - src/test/run-pass/svh-add-nothing.rs | 2 +- src/test/run-pass/svh-add-redundant-cfg.rs | 23 - src/test/run-pass/svh-add-whitespace.rs | 23 - .../run-pass/syntax-extension-source-utils.rs | 2 +- .../run-pass/termination-trait-for-empty.rs | 13 + .../run-pass/termination-trait-for-i32.rs | 15 + .../run-pass/termination-trait-for-result.rs | 17 + src/test/run-pass/thinlto/weak-works.rs | 37 + src/test/run-pass/u128.rs | 2 + .../run-pass/union/union-const-eval-field.rs | 45 + src/test/run-pass/use-nested-groups.rs | 35 + src/test/run-pass/weird-exprs.rs | 1 + .../rustdoc/auxiliary/external-cross-doc.md | 4 + src/test/rustdoc/auxiliary/external-cross.rs | 15 + src/test/rustdoc/auxiliary/external-doc.md | 3 + src/test/rustdoc/auxiliary/issue-46727.rs | 17 + src/test/rustdoc/doc-cfg.rs | 2 +- src/test/rustdoc/doc-spotlight.rs | 46 + src/test/rustdoc/double-quote-escape.rs | 23 + src/test/rustdoc/escape-deref-methods.rs | 45 + src/test/rustdoc/external-cross.rs | 20 + src/test/rustdoc/external-doc.rs | 18 + src/test/rustdoc/foreigntype-reexport.rs | 66 + src/test/rustdoc/hidden-trait-struct-impls.rs | 32 + src/test/rustdoc/inline_cross/assoc-items.rs | 57 + .../inline_cross/auxiliary/assoc-items.rs | 48 + src/test/rustdoc/issue-42760.rs | 23 + src/test/rustdoc/issue-46271.rs | 15 + src/test/rustdoc/issue-46377.rs | 13 + .../rustdoc/issue-46380-2.rs} | 14 +- .../issue-46380.rs} | 8 +- src/test/rustdoc/issue-46727.rs | 17 + src/test/rustdoc/issue-46766.rs | 16 + src/test/rustdoc/issue-46767.rs | 18 + src/test/rustdoc/issue-47639.rs | 16 + src/test/rustdoc/negative-impl-sidebar.rs | 19 + .../rustdoc/sort-modules-by-appearance.rs | 23 + src/test/rustdoc/where-sized.rs | 16 + .../ui-fulldeps/custom-derive/issue-36935.rs | 2 +- .../custom-derive/issue-36935.stderr | 2 +- .../lint-plugin-forbid-attrs.rs | 3 - .../lint-plugin-forbid-attrs.stderr | 23 + .../proc-macro/auxiliary/derive-panic.rs | 0 .../proc-macro/load-panic.rs | 1 - .../ui-fulldeps/proc-macro/load-panic.stderr | 8 + .../proc-macro/signature.rs | 2 - .../ui-fulldeps/proc-macro/signature.stderr | 14 + .../ui-fulldeps/proc-macro/three-equals.rs | 10 +- .../proc-macro/three-equals.stderr | 14 +- src/test/ui-fulldeps/resolve-error.rs | 10 + src/test/ui-fulldeps/resolve-error.stderr | 36 +- src/test/ui-fulldeps/update-all-references.sh | 31 + src/test/ui-fulldeps/update-references.sh | 48 + .../ui/anonymous-higher-ranked-lifetime.rs | 22 +- .../anonymous-higher-ranked-lifetime.stderr | 44 +- .../arbitrary-self-types-not-object-safe.rs | 5 - ...rbitrary-self-types-not-object-safe.stderr | 19 + .../asm-out-assign-imm.rs | 3 +- src/test/ui/asm-out-assign-imm.stderr | 11 + .../associated-const-impl-wrong-lifetime.rs | 4 - ...ssociated-const-impl-wrong-lifetime.stderr | 20 + .../associated-const-impl-wrong-type.rs | 3 +- .../associated-const-impl-wrong-type.stderr | 11 + ...pe-projection-from-multiple-supertraits.rs | 10 - ...rojection-from-multiple-supertraits.stderr | 44 + ...ed-types-ICE-when-projecting-out-of-err.rs | 1 - ...ypes-ICE-when-projecting-out-of-err.stderr | 8 + .../associated-types-in-ambiguous-context.rs | 6 - ...sociated-types-in-ambiguous-context.stderr | 26 + .../augmented-assignments.rs | 1 - src/test/ui/augmented-assignments.stderr | 22 + .../auxiliary/cfg-target-thread-local.rs | 0 .../auxiliary/changing-crates-a1.rs | 0 .../auxiliary/changing-crates-a2.rs | 0 .../auxiliary/changing-crates-b.rs | 0 .../ui/auxiliary/coherence_lib.rs} | 21 +- .../ui/auxiliary/empty-struct.rs} | 11 +- .../auxiliary/issue-36708.rs | 0 .../auxiliary/lint_output_format.rs} | 29 +- src/test/ui/auxiliary/struct_field_privacy.rs | 19 + .../auxiliary/svh-a-base.rs | 0 .../auxiliary/svh-a-change-lit.rs | 0 .../auxiliary/svh-a-change-significant-cfg.rs | 0 .../auxiliary/svh-a-change-trait-bound.rs | 0 .../auxiliary/svh-a-change-type-arg.rs | 0 .../auxiliary/svh-a-change-type-ret.rs | 0 .../auxiliary/svh-a-change-type-static.rs | 0 .../{compile-fail => ui}/auxiliary/svh-b.rs | 0 .../auxiliary/svh-uta-base.rs | 0 .../auxiliary/svh-uta-change-use-trait.rs | 0 .../{compile-fail => ui}/auxiliary/svh-utb.rs | 0 .../auxiliary/two_macros.rs} | 8 +- .../binary-op-on-double-ref.rs | 2 - src/test/ui/binary-op-on-double-ref.stderr | 11 + .../blind-item-item-shadow.rs | 3 +- src/test/ui/blind-item-item-shadow.stderr | 17 + .../consider-removing-last-semi.rs | 4 +- .../consider-removing-last-semi.stderr | 4 +- src/test/ui/block-result/issue-11714.rs | 2 +- src/test/ui/block-result/issue-11714.stderr | 2 +- src/test/ui/block-result/issue-13428.rs | 4 +- src/test/ui/block-result/issue-13428.stderr | 4 +- src/test/ui/block-result/issue-3563.rs | 1 - src/test/ui/block-result/issue-3563.stderr | 13 +- .../block-result/unexpected-return-on-unit.rs | 2 +- .../unexpected-return-on-unit.stderr | 4 +- src/test/{compile-fail => ui}/bogus-tag.rs | 3 +- src/test/ui/bogus-tag.stderr | 11 + .../borrowck/borrowck-box-insensitivity.rs | 16 - .../borrowck-box-insensitivity.stderr | 163 + .../ui/borrowck/borrowck-closures-two-mut.rs | 7 +- .../borrowck/borrowck-closures-two-mut.stderr | 82 +- .../borrowck-escaping-closure-error-1.rs | 2 - .../borrowck-escaping-closure-error-1.stderr | 14 + .../borrowck-escaping-closure-error-2.rs | 2 - .../borrowck-escaping-closure-error-2.stderr | 14 + src/test/ui/borrowck/borrowck-in-static.rs | 2 +- .../ui/borrowck/borrowck-in-static.stderr | 2 +- .../borrowck/borrowck-move-error-with-note.rs | 12 +- .../borrowck-move-error-with-note.stderr | 36 + .../borrowck/borrowck-move-out-of-vec-tail.rs | 1 - .../borrowck-move-out-of-vec-tail.stderr | 17 + src/test/ui/borrowck/borrowck-reinit.rs | 5 +- src/test/ui/borrowck/borrowck-reinit.stderr | 8 +- .../borrowck-report-with-custom-diagnostic.rs | 3 - ...rowck-report-with-custom-diagnostic.stderr | 38 + .../borrowck/borrowck-vec-pattern-nesting.rs | 5 +- .../borrowck-vec-pattern-nesting.stderr | 82 + src/test/ui/borrowck/mut-borrow-in-loop.rs | 6 +- .../ui/borrowck/mut-borrow-in-loop.stderr | 6 +- .../ui/borrowck/mut-borrow-outside-loop.rs | 4 +- .../borrowck/mut-borrow-outside-loop.stderr | 4 +- ...es-move-upvar-from-non-once-ref-closure.rs | 2 +- ...ove-upvar-from-non-once-ref-closure.stderr | 2 +- src/test/{compile-fail => ui}/cast-as-bool.rs | 1 - src/test/ui/cast-as-bool.stderr | 10 + src/test/ui/cast-errors-issue-43825.rs | 17 + src/test/ui/cast-errors-issue-43825.stderr | 8 + .../{compile-fail => ui}/cast-rfc0401-2.rs | 1 - src/test/ui/cast-rfc0401-2.stderr | 10 + ...cast-to-unsized-trait-object-suggestion.rs | 4 +- ...-to-unsized-trait-object-suggestion.stderr | 4 +- src/test/ui/casts-differing-anon.rs | 34 + src/test/ui/casts-differing-anon.stderr | 10 + src/test/ui/casts-issue-46365.rs | 17 + src/test/ui/casts-issue-46365.stderr | 8 + .../{compile-fail => ui}/changing-crates.rs | 4 +- src/test/ui/changing-crates.stderr | 13 + src/test/ui/check_match/issue-35609.rs | 16 +- src/test/ui/check_match/issue-35609.stderr | 16 +- src/test/ui/check_match/issue-43253.rs | 2 + src/test/ui/check_match/issue-43253.stderr | 16 +- .../ui/closure_context/issue-26046-fn-mut.rs | 2 +- .../closure_context/issue-26046-fn-mut.stderr | 19 +- .../ui/closure_context/issue-26046-fn-once.rs | 2 +- .../issue-26046-fn-once.stderr | 19 +- src/test/ui/closure_context/issue-42065.rs | 2 - .../ui/codemap_tests/bad-format-args.stderr | 6 +- ...herence-overlapping-inherent-impl-trait.rs | 2 +- ...nce-overlapping-inherent-impl-trait.stderr | 2 +- src/test/ui/codemap_tests/empty_span.rs | 2 +- src/test/ui/codemap_tests/empty_span.stderr | 2 +- .../codemap_tests/huge_multispan_highlight.rs | 2 +- .../huge_multispan_highlight.stderr | 2 +- src/test/ui/codemap_tests/issue-11715.rs | 2 +- src/test/ui/codemap_tests/issue-11715.stderr | 2 +- src/test/ui/codemap_tests/issue-28308.stderr | 2 +- src/test/ui/codemap_tests/one_line.rs | 2 +- src/test/ui/codemap_tests/one_line.stderr | 2 +- .../overlapping_inherent_impls.rs | 6 +- .../overlapping_inherent_impls.stderr | 6 +- .../ui/codemap_tests/overlapping_spans.rs | 2 +- .../ui/codemap_tests/overlapping_spans.stderr | 2 +- src/test/ui/codemap_tests/tab.rs | 4 +- src/test/ui/codemap_tests/tab.stderr | 10 +- src/test/ui/codemap_tests/tab_2.rs | 2 +- src/test/ui/codemap_tests/tab_2.stderr | 4 +- src/test/ui/codemap_tests/tab_3.rs | 2 +- src/test/ui/codemap_tests/tab_3.stderr | 10 +- src/test/ui/codemap_tests/two_files.rs | 2 +- src/test/ui/codemap_tests/two_files.stderr | 2 +- src/test/ui/codemap_tests/unicode.rs | 2 +- src/test/ui/codemap_tests/unicode.stderr | 2 +- src/test/ui/codemap_tests/unicode_2.rs | 6 +- src/test/ui/codemap_tests/unicode_2.stderr | 6 +- src/test/ui/codemap_tests/unicode_3.rs | 2 + src/test/ui/codemap_tests/unicode_3.stderr | 8 +- .../ui/coercion-missing-tail-expected-type.rs | 4 +- ...coercion-missing-tail-expected-type.stderr | 4 +- .../coherence-error-suppression.rs | 0 .../ui/coherence-error-suppression.stderr | 8 + .../coherence-impls-copy.rs | 14 - src/test/ui/coherence-impls-copy.stderr | 59 + .../coherence-overlap-downstream-inherent.rs | 5 - ...herence-overlap-downstream-inherent.stderr | 22 + .../coherence-overlap-downstream.rs | 5 - .../ui/coherence-overlap-downstream.stderr | 20 + .../coherence-overlap-issue-23516-inherent.rs | 3 - ...erence-overlap-issue-23516-inherent.stderr | 13 + .../coherence-overlap-issue-23516.rs | 3 - .../ui/coherence-overlap-issue-23516.stderr | 12 + .../coherence-overlap-upstream-inherent.rs | 3 - ...coherence-overlap-upstream-inherent.stderr | 13 + .../coherence-overlap-upstream.rs | 3 - src/test/ui/coherence-overlap-upstream.stderr | 12 + src/test/ui/command-line-diagnostics.rs | 17 + src/test/ui/command-line-diagnostics.stderr | 10 + .../proj-outlives-region.stderr | 2 +- .../ui/compare-method/region-extra-2.stderr | 11 +- src/test/ui/compare-method/region-extra.rs | 2 +- .../ui/compare-method/region-extra.stderr | 4 +- .../ui/compare-method/region-unrelated.rs | 2 +- .../ui/compare-method/region-unrelated.stderr | 2 +- .../trait-bound-on-type-parameter.stderr | 2 +- .../traits-misc-mismatch-1.stderr | 14 +- .../traits-misc-mismatch-2.stderr | 11 +- .../{compile-fail => ui}/const-deref-ptr.rs | 1 - src/test/ui/const-deref-ptr.stderr | 8 + .../const-eval-overflow-2.rs | 2 +- src/test/ui/const-eval-overflow-2.stderr | 14 + .../const-eval-overflow-4.rs | 3 +- src/test/ui/const-eval-overflow-4.stderr | 16 + .../{compile-fail => ui}/const-eval-span.rs | 1 - src/test/ui/const-eval-span.stderr | 11 + src/test/ui/const-eval/issue-43197.rs | 6 +- src/test/ui/const-eval/issue-43197.stderr | 12 +- src/test/ui/const-expr-addr-operator.rs | 4 +- src/test/ui/const-expr-addr-operator.stderr | 2 +- .../{compile-fail => ui}/const-fn-error.rs | 8 +- src/test/ui/const-fn-error.stderr | 46 + .../{compile-fail => ui}/const-fn-mismatch.rs | 1 - src/test/ui/const-fn-mismatch.stderr | 8 + .../const-fn-not-in-trait.rs | 2 - src/test/ui/const-fn-not-in-trait.stderr | 14 + .../const-len-underflow-separate-spans.rs | 5 +- .../const-len-underflow-separate-spans.stderr | 22 + .../const-pattern-not-const-evaluable.rs | 2 +- .../const-pattern-not-const-evaluable.stderr | 14 + .../{compile-fail => ui}/const-unsized.rs | 8 - src/test/ui/const-unsized.stderr | 38 + .../ui/cross-crate-macro-backtrace/main.rs | 4 +- .../cross-crate-macro-backtrace/main.stderr | 6 +- .../cycle-trait-supertrait-indirect.rs | 3 - .../ui/cycle-trait-supertrait-indirect.stderr | 20 + src/test/ui/deprecated-macro_escape-inner.rs | 1 - src/test/ui/deref-suggestion.rs | 10 +- src/test/ui/deref-suggestion.stderr | 28 +- .../derived-errors/issue-31997-1.rs | 1 - .../ui/derived-errors/issue-31997-1.stderr | 8 + src/test/ui/deriving-with-repr-packed.rs | 41 + src/test/ui/deriving-with-repr-packed.stderr | 43 + src/test/ui/did_you_mean/E0178.rs | 8 +- src/test/ui/did_you_mean/E0178.stderr | 8 +- src/test/ui/did_you_mean/bad-assoc-expr.rs | 30 + .../ui/did_you_mean/bad-assoc-expr.stderr | 38 + src/test/ui/did_you_mean/bad-assoc-pat.rs | 28 + src/test/ui/did_you_mean/bad-assoc-pat.stderr | 50 + src/test/ui/did_you_mean/bad-assoc-ty.rs | 46 + src/test/ui/did_you_mean/bad-assoc-ty.stderr | 106 + ...issue-21659-show-relevant-trait-impls-1.rs | 3 - ...issue-21659-show-relevant-trait-impls-2.rs | 6 - src/test/ui/did_you_mean/issue-31424.rs | 4 +- src/test/ui/did_you_mean/issue-31424.stderr | 4 +- src/test/ui/did_you_mean/issue-34126.rs | 2 +- src/test/ui/did_you_mean/issue-34126.stderr | 2 +- src/test/ui/did_you_mean/issue-34337.rs | 2 +- src/test/ui/did_you_mean/issue-34337.stderr | 2 +- src/test/ui/did_you_mean/issue-35937.rs | 6 +- src/test/ui/did_you_mean/issue-35937.stderr | 18 +- src/test/ui/did_you_mean/issue-36798.rs | 2 +- src/test/ui/did_you_mean/issue-36798.stderr | 2 +- .../did_you_mean/issue-36798_unknown_field.rs | 2 +- .../issue-36798_unknown_field.stderr | 2 +- src/test/ui/did_you_mean/issue-37139.rs | 2 +- src/test/ui/did_you_mean/issue-37139.stderr | 2 +- ...ssue-38054-do-not-show-unresolved-names.rs | 4 +- ...-38054-do-not-show-unresolved-names.stderr | 4 +- src/test/ui/did_you_mean/issue-38147-1.rs | 2 +- src/test/ui/did_you_mean/issue-38147-1.stderr | 2 +- src/test/ui/did_you_mean/issue-38147-2.rs | 1 + src/test/ui/did_you_mean/issue-38147-2.stderr | 2 +- src/test/ui/did_you_mean/issue-38147-3.rs | 1 + src/test/ui/did_you_mean/issue-38147-3.stderr | 2 +- src/test/ui/did_you_mean/issue-38147-4.rs | 2 +- src/test/ui/did_you_mean/issue-38147-4.stderr | 2 +- src/test/ui/did_you_mean/issue-39544.rs | 23 +- src/test/ui/did_you_mean/issue-39544.stderr | 76 +- .../issue-39802-show-5-trait-impls.rs | 6 +- .../issue-39802-show-5-trait-impls.stderr | 6 +- src/test/ui/did_you_mean/issue-40006.rs | 16 +- src/test/ui/did_you_mean/issue-40006.stderr | 46 +- src/test/ui/did_you_mean/issue-40396.rs | 7 +- src/test/ui/did_you_mean/issue-40396.stderr | 8 +- src/test/ui/did_you_mean/issue-40823.rs | 2 +- src/test/ui/did_you_mean/issue-40823.stderr | 2 +- src/test/ui/did_you_mean/issue-41679.rs | 2 +- src/test/ui/did_you_mean/issue-41679.stderr | 2 +- .../issue-42599_available_fields_note.rs | 4 + .../issue-42599_available_fields_note.stderr | 12 +- src/test/ui/did_you_mean/issue-42764.rs | 1 + .../issue-43871-enum-instead-of-variant.rs | 27 + ...issue-43871-enum-instead-of-variant.stderr | 32 + .../issue-46718-struct-pattern-dotdotdot.rs | 27 + ...ssue-46718-struct-pattern-dotdotdot.stderr | 8 + src/test/ui/did_you_mean/recursion_limit.rs | 2 +- .../ui/did_you_mean/recursion_limit.stderr | 2 +- .../ui/did_you_mean/recursion_limit_deref.rs | 5 +- .../did_you_mean/recursion_limit_deref.stderr | 8 +- .../ui/did_you_mean/recursion_limit_macro.rs | 2 +- .../did_you_mean/recursion_limit_macro.stderr | 2 +- ...ect-reference-without-parens-suggestion.rs | 5 +- ...reference-without-parens-suggestion.stderr | 8 +- .../discrim-overflow-2.rs | 16 - src/test/ui/discrim-overflow-2.stderr | 66 + .../{compile-fail => ui}/discrim-overflow.rs | 11 - src/test/ui/discrim-overflow.stderr | 66 + .../{compile-fail => ui}/double-import.rs | 4 +- src/test/ui/double-import.stderr | 16 + .../ui/dropck/dropck-eyepatch-extern-crate.rs | 12 +- .../dropck-eyepatch-extern-crate.stderr | 40 +- src/test/ui/dropck/dropck-eyepatch-reorder.rs | 12 +- .../ui/dropck/dropck-eyepatch-reorder.stderr | 40 +- src/test/ui/dropck/dropck-eyepatch.rs | 12 +- src/test/ui/dropck/dropck-eyepatch.stderr | 64 +- .../duplicate-check-macro-exports.rs | 3 +- .../ui/duplicate-check-macro-exports.stderr | 14 + src/test/ui/e0119/complex-impl.rs | 5 +- src/test/ui/e0119/complex-impl.stderr | 6 +- src/test/ui/e0119/conflict-with-std.rs | 8 +- src/test/ui/e0119/conflict-with-std.stderr | 25 +- src/test/ui/e0119/issue-23563.rs | 4 +- src/test/ui/e0119/issue-23563.stderr | 6 +- src/test/ui/e0119/issue-27403.rs | 4 +- src/test/ui/e0119/issue-27403.stderr | 8 +- src/test/ui/e0119/issue-28981.rs | 5 +- src/test/ui/e0119/issue-28981.stderr | 6 +- src/test/ui/e0119/so-37347311.rs | 4 +- src/test/ui/e0119/so-37347311.stderr | 8 +- .../empty-struct-unit-expr.rs | 2 - src/test/ui/empty-struct-unit-expr.stderr | 41 + .../enum-and-module-in-same-scope.rs | 4 +- .../ui/enum-and-module-in-same-scope.stderr | 13 + src/test/ui/explain.rs | 1 + src/test/{compile-fail => ui}/fat-ptr-cast.rs | 2 - src/test/ui/fat-ptr-cast.stderr | 62 + .../feature-gate-abi-msp430-interrupt.rs | 0 .../feature-gate-abi-msp430-interrupt.stderr | 10 + .../{compile-fail => ui}/feature-gate-abi.rs | 0 src/test/ui/feature-gate-abi.stderr | 450 + .../feature-gate-abi_unadjusted.rs} | 2 - .../ui/feature-gate-abi_unadjusted.stderr | 12 + .../feature-gate-advanced-slice-features.rs | 0 ...eature-gate-advanced-slice-features.stderr | 18 + .../feature-gate-allocator_internals.rs | 0 .../feature-gate-allocator_internals.stderr | 10 + ...gate-allow-internal-unsafe-nested-macro.rs | 0 ...-allow-internal-unsafe-nested-macro.stderr | 13 + ...te-allow-internal-unstable-nested-macro.rs | 0 ...llow-internal-unstable-nested-macro.stderr | 13 + ...ure-gate-allow-internal-unstable-struct.rs | 0 ...gate-allow-internal-unstable-struct.stderr | 10 + .../feature-gate-allow-internal-unstable.rs | 0 ...eature-gate-allow-internal-unstable.stderr | 10 + .../feature-gate-allow_fail.rs | 0 src/test/ui/feature-gate-allow_fail.stderr | 10 + .../feature-gate-arbitrary-self-types.rs | 0 .../feature-gate-arbitrary-self-types.stderr | 29 + ...e-gate-arbitrary_self_types-raw-pointer.rs | 28 + ...te-arbitrary_self_types-raw-pointer.stderr | 29 + .../asm-gated.rs => ui/feature-gate-asm.rs} | 2 - src/test/ui/feature-gate-asm.stderr | 10 + .../asm-gated2.rs => ui/feature-gate-asm2.rs} | 0 src/test/ui/feature-gate-asm2.stderr | 10 + .../feature-gate-assoc-type-defaults.rs | 0 .../feature-gate-assoc-type-defaults.stderr | 10 + .../feature-gate-box-expr.rs | 0 src/test/ui/feature-gate-box-expr.stderr | 10 + .../feature-gate-box_patterns.rs} | 2 - src/test/ui/feature-gate-box_patterns.stderr | 10 + .../feature-gate-box_syntax.rs} | 2 - src/test/ui/feature-gate-box_syntax.stderr | 10 + .../feature-gate-catch_expr.rs | 0 src/test/ui/feature-gate-catch_expr.stderr | 14 + .../feature-gate-cfg-target-feature.rs | 0 .../ui/feature-gate-cfg-target-feature.stderr | 34 + .../feature-gate-cfg-target-has-atomic.rs | 0 .../feature-gate-cfg-target-has-atomic.stderr | 122 + .../feature-gate-cfg-target-thread-local.rs | 0 ...eature-gate-cfg-target-thread-local.stderr | 10 + .../feature-gate-cfg-target-vendor.rs | 0 .../ui/feature-gate-cfg-target-vendor.stderr | 34 + .../feature-gate-clone-closures.rs | 0 .../ui/feature-gate-clone-closures.stderr | 10 + .../feature-gate-compiler-builtins.rs | 0 .../ui/feature-gate-compiler-builtins.stderr | 10 + .../feature-gate-concat_idents.rs} | 2 - src/test/ui/feature-gate-concat_idents.stderr | 18 + .../feature-gate-concat_idents2.rs} | 0 .../ui/feature-gate-concat_idents2.stderr | 10 + .../feature-gate-concat_idents3.rs} | 0 .../ui/feature-gate-concat_idents3.stderr | 18 + .../feature-gate-conservative_impl_trait.rs} | 2 - ...eature-gate-conservative_impl_trait.stderr | 10 + .../feature-gate-const-indexing.rs | 0 .../ui/feature-gate-const-indexing.stderr | 8 + .../feature-gate-const_fn.rs} | 2 - src/test/ui/feature-gate-const_fn.stderr | 60 + .../feature-gate-copy-closures.rs | 0 src/test/ui/feature-gate-copy-closures.stderr | 12 + .../ui/feature-gate-crate_in_paths.rs} | 6 +- .../ui/feature-gate-crate_in_paths.stderr | 10 + .../feature-gate-crate_visibility_modifier.rs | 0 ...ture-gate-crate_visibility_modifier.stderr | 10 + .../feature-gate-custom_attribute.rs} | 2 - .../ui/feature-gate-custom_attribute.stderr | 106 + .../feature-gate-custom_attribute2.rs} | 0 .../ui/feature-gate-custom_attribute2.stderr | 138 + .../feature-gate-custom_derive.rs} | 2 - src/test/ui/feature-gate-custom_derive.stderr | 10 + .../feature-gate-decl_macro.rs | 1 - src/test/ui/feature-gate-decl_macro.stderr | 10 + ...e-gate-default_type_parameter_fallback.rs} | 2 - ...ate-default_type_parameter_fallback.stderr | 21 + .../feature-gate-doc_cfg.rs | 0 src/test/ui/feature-gate-doc_cfg.stderr | 10 + .../feature-gate-doc_masked.rs | 0 src/test/ui/feature-gate-doc_masked.stderr | 10 + src/test/ui/feature-gate-doc_spotlight.rs | 14 + src/test/ui/feature-gate-doc_spotlight.stderr | 10 + .../feature-gate-dotdoteq_in_patterns.rs | 0 .../feature-gate-dotdoteq_in_patterns.stderr | 10 + .../feature-gate-dropck-ugeh-2.rs | 0 src/test/ui/feature-gate-dropck-ugeh-2.stderr | 14 + .../feature-gate-dropck-ugeh.rs | 0 src/test/ui/feature-gate-dropck-ugeh.stderr | 10 + .../feature-gate-dyn-trait.rs | 0 src/test/ui/feature-gate-dyn-trait.stderr | 10 + .../feature-gate-exclusive-range-pattern.rs | 0 ...eature-gate-exclusive-range-pattern.stderr | 10 + .../ui/feature-gate-extern_absolute_paths.rs | 15 + .../feature-gate-extern_absolute_paths.stderr | 14 + .../feature-gate-extern_types.rs | 0 src/test/ui/feature-gate-extern_types.stderr | 10 + src/test/ui/feature-gate-external_doc.rs | 12 + src/test/ui/feature-gate-external_doc.stderr | 10 + .../feature-gate-feature-gate.rs | 0 src/test/ui/feature-gate-feature-gate.stderr | 14 + ...eature-gate-fn_must_use-cap-lints-allow.rs | 0 ...re-gate-fn_must_use-cap-lints-allow.stderr | 6 + .../feature-gate-fn_must_use.rs | 0 src/test/ui/feature-gate-fn_must_use.stderr | 22 + .../feature-gate-fundamental.rs | 0 src/test/ui/feature-gate-fundamental.stderr | 10 + .../feature-gate-generators.rs | 0 src/test/ui/feature-gate-generators.stderr | 10 + .../feature-gate-generic_associated_types.rs} | 35 +- ...ature-gate-generic_associated_types.stderr | 34 + .../feature-gate-generic_param_attrs.rs} | 2 - .../feature-gate-generic_param_attrs.stderr | 138 + .../feature-gate-global_allocator.rs | 0 .../ui/feature-gate-global_allocator.stderr | 10 + .../feature-gate-global_asm.rs | 0 src/test/ui/feature-gate-global_asm.stderr | 10 + .../feature-gate-i128_type.rs} | 2 - src/test/ui/feature-gate-i128_type.stderr | 18 + .../feature-gate-i128_type2.rs} | 0 src/test/ui/feature-gate-i128_type2.stderr | 46 + src/test/ui/feature-gate-in_band_lifetimes.rs | 72 + .../ui/feature-gate-in_band_lifetimes.stderr | 104 + .../feature-gate-intrinsics.rs | 0 src/test/ui/feature-gate-intrinsics.stderr | 21 + .../feature-gate-lang-items.rs | 0 src/test/ui/feature-gate-lang-items.stderr | 10 + .../feature-gate-link_args.rs} | 2 - src/test/ui/feature-gate-link_args.stderr | 26 + .../feature-gate-link_cfg.rs} | 2 - src/test/ui/feature-gate-link_cfg.stderr | 10 + .../feature-gate-link_llvm_intrinsics.rs} | 2 - .../feature-gate-link_llvm_intrinsics.stderr | 10 + .../feature-gate-linkage.rs} | 2 - src/test/ui/feature-gate-linkage.stderr | 10 + .../feature-gate-linker-flavor.rs | 0 src/test/ui/feature-gate-linker-flavor.stderr | 10 + .../feature-gate-log_syntax.rs} | 2 - src/test/ui/feature-gate-log_syntax.stderr | 10 + .../feature-gate-log_syntax2.rs} | 0 src/test/ui/feature-gate-log_syntax2.stderr | 10 + .../ui/feature-gate-macro-lifetime-matcher.rs | 19 + ...feature-gate-macro-lifetime-matcher.stderr | 10 + .../feature-gate-macro-vis-matcher.rs | 0 .../ui/feature-gate-macro-vis-matcher.stderr | 10 + .../{compile-fail => ui}/feature-gate-main.rs | 0 src/test/ui/feature-gate-main.stderr | 10 + .../feature-gate-match_beginning_vert.rs | 0 .../feature-gate-match_beginning_vert.stderr | 26 + .../feature-gate-match_default_bindings.rs | 0 ...feature-gate-match_default_bindings.stderr | 10 + .../feature-gate-may-dangle.rs | 1 - src/test/ui/feature-gate-may-dangle.stderr | 10 + .../feature-gate-naked_functions.rs} | 2 - .../ui/feature-gate-naked_functions.stderr | 18 + .../feature-gate-needs-allocator.rs | 0 .../ui/feature-gate-needs-allocator.stderr | 10 + .../feature-gate-negate-unsigned.rs | 0 .../ui/feature-gate-negate-unsigned.stderr | 14 + .../feature-gate-never_type.rs} | 2 - src/test/ui/feature-gate-never_type.stderr | 42 + .../ui/feature-gate-nll.rs} | 13 +- src/test/ui/feature-gate-nll.stderr | 10 + .../feature-gate-no-debug-2.rs | 0 src/test/ui/feature-gate-no-debug-2.stderr | 14 + .../feature-gate-no-debug.rs | 0 src/test/ui/feature-gate-no-debug.stderr | 10 + .../feature-gate-no_core.rs} | 2 - src/test/ui/feature-gate-no_core.stderr | 10 + .../feature-gate-non_ascii_idents.rs} | 2 - .../ui/feature-gate-non_ascii_idents.stderr | 112 + .../feature-gate-non_exhaustive.rs | 0 .../ui/feature-gate-non_exhaustive.stderr | 10 + ...re-gate-omit-gdb-pretty-printer-section.rs | 0 ...ate-omit-gdb-pretty-printer-section.stderr | 10 + .../feature-gate-on-unimplemented.rs | 0 .../ui/feature-gate-on-unimplemented.stderr | 10 + .../feature-gate-optin-builtin-traits.rs | 0 .../feature-gate-optin-builtin-traits.stderr | 26 + .../feature-gate-overlapping_marker_traits.rs | 0 ...ture-gate-overlapping_marker_traits.stderr | 10 + .../feature-gate-placement-expr.rs | 0 .../ui/feature-gate-placement-expr.stderr | 10 + .../feature-gate-plugin.rs | 0 src/test/ui/feature-gate-plugin.stderr | 10 + .../feature-gate-plugin_registrar.rs} | 2 - .../ui/feature-gate-plugin_registrar.stderr | 10 + .../feature-gate-prelude_import.rs | 0 .../ui/feature-gate-prelude_import.stderr | 10 + .../feature-gate-profiler-runtime.rs | 0 .../ui/feature-gate-profiler-runtime.stderr | 10 + .../feature-gate-repr-simd.rs | 0 src/test/ui/feature-gate-repr-simd.stderr | 10 + .../feature-gate-repr128.rs | 1 - src/test/ui/feature-gate-repr128.stderr | 12 + .../feature-gate-repr_align.rs | 0 src/test/ui/feature-gate-repr_align.stderr | 10 + .../feature-gate-rustc-attrs.rs | 0 src/test/ui/feature-gate-rustc-attrs.stderr | 26 + .../feature-gate-rustc-diagnostic-macros.rs | 0 ...eature-gate-rustc-diagnostic-macros.stderr | 20 + .../feature-gate-rustc_const_unstable.rs | 0 .../feature-gate-rustc_const_unstable.stderr | 10 + .../feature-gate-sanitizer-runtime.rs | 0 .../ui/feature-gate-sanitizer-runtime.stderr | 10 + .../feature-gate-simd-ffi.rs | 0 src/test/ui/feature-gate-simd-ffi.stderr | 18 + .../{compile-fail => ui}/feature-gate-simd.rs | 0 src/test/ui/feature-gate-simd.stderr | 10 + .../feature-gate-slice-patterns.rs | 0 .../ui/feature-gate-slice-patterns.stderr | 10 + .../feature-gate-staged_api.rs | 0 src/test/ui/feature-gate-staged_api.stderr | 14 + .../feature-gate-start.rs | 0 src/test/ui/feature-gate-start.stderr | 10 + .../feature-gate-static-nobundle.rs | 0 .../ui/feature-gate-static-nobundle.stderr | 10 + .../feature-gate-stmt_expr_attributes.rs | 0 .../feature-gate-stmt_expr_attributes.stderr | 10 + .../feature-gate-target_feature.rs} | 2 - .../ui/feature-gate-target_feature.stderr | 10 + .../feature-gate-thread_local.rs} | 2 - src/test/ui/feature-gate-thread_local.stderr | 10 + .../feature-gate-trace_macros.rs} | 2 - src/test/ui/feature-gate-trace_macros.stderr | 10 + .../feature-gate-type_ascription.rs} | 2 - .../ui/feature-gate-type_ascription.stderr | 10 + ...ture-gate-unboxed-closures-manual-impls.rs | 0 ...-gate-unboxed-closures-manual-impls.stderr | 34 + ...ture-gate-unboxed-closures-method-calls.rs | 0 ...-gate-unboxed-closures-method-calls.stderr | 26 + ...eature-gate-unboxed-closures-ufcs-calls.rs | 0 ...re-gate-unboxed-closures-ufcs-calls.stderr | 26 + .../feature-gate-unboxed-closures.rs | 0 .../ui/feature-gate-unboxed-closures.stderr | 12 + .../feature-gate-underscore-lifetimes.rs | 0 .../feature-gate-underscore-lifetimes.stderr | 10 + .../feature-gate-universal.rs | 0 src/test/ui/feature-gate-universal.stderr | 10 + .../feature-gate-unsized_tuple_coercion.rs | 0 ...feature-gate-unsized_tuple_coercion.stderr | 10 + .../feature-gate-untagged_unions.rs} | 2 - .../ui/feature-gate-untagged_unions.stderr | 32 + .../feature-gate-unwind-attributes.rs | 0 .../ui/feature-gate-unwind-attributes.stderr | 10 + src/test/ui/feature-gate-use_nested_groups.rs | 31 + .../ui/feature-gate-use_nested_groups.stderr | 26 + .../{compile-fail => ui}/feature-gate-used.rs | 0 src/test/ui/feature-gate-used.stderr | 10 + .../feature-gate-wasm_import_memory.rs | 0 .../ui/feature-gate-wasm_import_memory.stderr | 10 + .../issue-43106-gating-of-bench.rs | 0 .../issue-43106-gating-of-bench.stderr | 4 + .../issue-43106-gating-of-builtin-attrs.rs | 0 ...issue-43106-gating-of-builtin-attrs.stderr | 1354 +++ .../issue-43106-gating-of-deprecated.rs | 0 .../issue-43106-gating-of-deprecated.stderr | 8 + .../issue-43106-gating-of-derive-2.rs | 0 .../issue-43106-gating-of-derive-2.stderr | 20 + .../issue-43106-gating-of-derive.rs | 0 .../issue-43106-gating-of-derive.stderr | 38 + .../issue-43106-gating-of-inline.rs | 0 .../issue-43106-gating-of-inline.stderr | 43 + .../issue-43106-gating-of-macro_escape.rs | 0 .../issue-43106-gating-of-macro_escape.stderr | 12 + .../issue-43106-gating-of-macro_use.rs | 0 .../issue-43106-gating-of-macro_use.stderr | 20 + ...issue-43106-gating-of-proc_macro_derive.rs | 0 ...e-43106-gating-of-proc_macro_derive.stderr | 40 + .../issue-43106-gating-of-rustc_deprecated.rs | 0 ...ue-43106-gating-of-rustc_deprecated.stderr | 46 + .../issue-43106-gating-of-stable.rs | 0 .../issue-43106-gating-of-stable.stderr | 46 + .../issue-43106-gating-of-test.rs | 0 .../issue-43106-gating-of-test.stderr | 4 + .../issue-43106-gating-of-unstable.rs | 0 .../issue-43106-gating-of-unstable.stderr | 46 + src/test/ui/fmt/format-string-error.stderr | 4 +- src/test/ui/fmt/send-sync.rs | 20 + src/test/ui/fmt/send-sync.stderr | 34 + src/test/ui/generator/borrowing.stderr | 4 +- .../ref-escapes-but-not-over-yield.rs | 3 +- .../ref-escapes-but-not-over-yield.stderr | 13 +- .../generator/yield-while-local-borrowed.rs | 2 +- .../generic-type-less-params-with-defaults.rs | 1 - ...eric-type-less-params-with-defaults.stderr | 8 + .../generic-type-more-params-with-defaults.rs | 1 - ...eric-type-more-params-with-defaults.stderr | 8 + src/test/ui/hello_world/main.rs | 2 + .../{compile-fail => ui}/if-let-arm-types.rs | 2 +- src/test/ui/if-let-arm-types.stderr | 25 + .../impl-duplicate-methods.rs | 3 +- src/test/ui/impl-duplicate-methods.stderr | 10 + .../impl-trait/auto-trait-leak.rs | 13 - src/test/ui/impl-trait/auto-trait-leak.stderr | 52 + src/test/ui/impl-trait/equality.rs | 2 +- ...issue-21659-show-relevant-trait-impls-3.rs | 2 - ...e-21659-show-relevant-trait-impls-3.stderr | 3 + .../method-suggestion-no-duplication.rs | 4 - .../method-suggestion-no-duplication.stderr | 3 + .../impl-trait/no-method-suggested-traits.rs | 54 +- .../no-method-suggested-traits.stderr | 239 +- src/test/ui/impl-trait/trait_type.rs | 4 + src/test/ui/impl-trait/trait_type.stderr | 14 +- .../impl-trait/universal-mismatched-type.rs | 2 +- .../universal-mismatched-type.stderr | 2 +- .../impl-trait/universal-two-impl-traits.rs | 2 +- .../universal-two-impl-traits.stderr | 2 +- .../ui/impl-trait/universal_wrong_bounds.rs | 6 +- .../impl-trait/universal_wrong_bounds.stderr | 6 +- .../impl-unused-rps-in-assoc-type.rs | 1 - .../ui/impl-unused-rps-in-assoc-type.stderr | 8 + .../imports/auxiliary/two_macros.rs | 0 .../{compile-fail => ui}/imports/duplicate.rs | 22 +- src/test/ui/imports/duplicate.stderr | 88 + .../imports/macro-paths.rs | 10 +- src/test/ui/imports/macro-paths.stderr | 42 + .../{compile-fail => ui}/imports/macros.rs | 14 +- src/test/ui/imports/macros.stderr | 57 + .../imports/rfc-1560-warning-cycle.rs | 6 +- .../ui/imports/rfc-1560-warning-cycle.stderr | 16 + .../imports/shadow_builtin_macros.rs | 17 +- .../ui/imports/shadow_builtin_macros.stderr | 59 + .../{compile-fail => ui}/impossible_range.rs | 12 +- src/test/ui/impossible_range.stderr | 18 + src/test/ui/in-band-lifetimes/E0687.rs | 26 + src/test/ui/in-band-lifetimes/E0687.stderr | 26 + src/test/ui/in-band-lifetimes/E0687_where.rs | 18 + .../ui/in-band-lifetimes/E0687_where.stderr | 14 + src/test/ui/in-band-lifetimes/E0688.rs | 26 + src/test/ui/in-band-lifetimes/E0688.stderr | 26 + src/test/ui/in-band-lifetimes/mismatched.rs | 18 + .../ui/in-band-lifetimes/mismatched.stderr | 18 + .../ui/in-band-lifetimes/mismatched_trait.rs | 20 + .../in-band-lifetimes/mismatched_trait.stderr | 10 + .../mismatched_trait_impl.rs | 24 + .../mismatched_trait_impl.stderr | 39 + .../ui/in-band-lifetimes/mut_while_borrow.rs | 21 + .../in-band-lifetimes/mut_while_borrow.stderr | 10 + .../in-band-lifetimes/no_in_band_in_struct.rs | 22 + .../no_in_band_in_struct.stderr | 14 + .../no_introducing_in_band_in_locals.rs | 23 + .../no_introducing_in_band_in_locals.stderr | 14 + src/test/ui/in-band-lifetimes/shadow.rs | 21 + src/test/ui/in-band-lifetimes/shadow.stderr | 19 + .../single_use_lifetimes-2.rs | 16 + .../single_use_lifetimes-2.stderr | 14 + .../single_use_lifetimes-3.rs | 20 + .../single_use_lifetimes-3.stderr | 20 + .../single_use_lifetimes-4.rs | 20 + .../single_use_lifetimes-4.stderr | 20 + .../single_use_lifetimes-5.rs | 16 + .../single_use_lifetimes-5.stderr | 14 + .../in-band-lifetimes/single_use_lifetimes.rs | 16 + .../single_use_lifetimes.stderr | 14 + src/test/{compile-fail => ui}/index-help.rs | 1 - src/test/ui/index-help.stderr | 10 + .../inference-variable-behind-raw-pointer.rs | 19 + ...ference-variable-behind-raw-pointer.stderr | 10 + .../interior-mutability.rs | 2 +- .../interior-mutability.stderr | 2 +- .../invalid-module-declaration.rs | 1 + .../invalid-module-declaration.stderr | 8 +- .../invalid-path-in-const.rs | 0 src/test/ui/invalid-path-in-const.stderr | 8 + src/test/{compile-fail => ui}/issue-10969.rs | 4 +- src/test/ui/issue-10969.stderr | 26 + src/test/{compile-fail => ui}/issue-11004.rs | 2 - src/test/ui/issue-11004.stderr | 18 + src/test/{compile-fail => ui}/issue-11319.rs | 2 +- src/test/ui/issue-11319.stderr | 19 + .../{compile-fail => ui}/issue-12187-1.rs | 2 - src/test/ui/issue-12187-1.stderr | 11 + .../{compile-fail => ui}/issue-12187-2.rs | 2 - src/test/ui/issue-12187-2.stderr | 11 + .../ui/issue-12511.rs} | 12 +- src/test/ui/issue-12511.stderr | 20 + src/test/{compile-fail => ui}/issue-13058.rs | 1 - src/test/ui/issue-13058.stderr | 23 + src/test/ui/issue-13483.rs | 4 +- src/test/ui/issue-13483.stderr | 4 +- src/test/{compile-fail => ui}/issue-14092.rs | 1 - src/test/ui/issue-14092.stderr | 8 + src/test/{compile-fail => ui}/issue-15260.rs | 20 +- src/test/ui/issue-15260.stderr | 35 + src/test/{compile-fail => ui}/issue-15524.rs | 6 - src/test/ui/issue-15524.stderr | 28 + src/test/{compile-fail => ui}/issue-17263.rs | 6 - src/test/ui/issue-17263.stderr | 24 + src/test/{compile-fail => ui}/issue-17441.rs | 4 - src/test/ui/issue-17441.stderr | 46 + src/test/{compile-fail => ui}/issue-18183.rs | 1 - src/test/ui/issue-18183.stderr | 8 + src/test/{compile-fail => ui}/issue-18819.rs | 2 - src/test/ui/issue-18819.stderr | 11 + src/test/ui/issue-19100.rs | 2 - src/test/ui/issue-19100.stderr | 4 +- src/test/{compile-fail => ui}/issue-19498.rs | 9 +- src/test/ui/issue-19498.stderr | 46 + src/test/{compile-fail => ui}/issue-1962.rs | 0 src/test/ui/issue-1962.stderr | 10 + src/test/{compile-fail => ui}/issue-19707.rs | 2 - src/test/ui/issue-19707.stderr | 18 + src/test/{compile-fail => ui}/issue-19922.rs | 2 - src/test/ui/issue-19922.stderr | 10 + .../issue-26194.rs => ui/issue-20692.rs} | 13 +- src/test/ui/issue-20692.stderr | 19 + src/test/{compile-fail => ui}/issue-21546.rs | 18 - src/test/ui/issue-21546.stderr | 68 + src/test/{compile-fail => ui}/issue-21600.rs | 3 +- src/test/ui/issue-21600.stderr | 31 + src/test/ui/issue-21950.rs | 20 + src/test/ui/issue-21950.stderr | 16 + src/test/{compile-fail => ui}/issue-22370.rs | 2 - src/test/ui/issue-22370.stderr | 10 + .../div-by-zero.rs => test/ui/issue-22560.rs} | 17 +- src/test/ui/issue-22560.stderr | 34 + src/test/ui/issue-22644.rs | 16 +- src/test/ui/issue-22644.stderr | 50 +- src/test/{compile-fail => ui}/issue-22886.rs | 1 - src/test/ui/issue-22886.stderr | 8 + .../{compile-fail => ui}/issue-22933-2.rs | 2 +- src/test/ui/issue-22933-2.stderr | 11 + src/test/{compile-fail => ui}/issue-23041.rs | 1 - src/test/ui/issue-23041.stderr | 8 + src/test/ui/issue-23173.rs | 27 + src/test/ui/issue-23173.stderr | 38 + src/test/{compile-fail => ui}/issue-23217.rs | 2 +- src/test/ui/issue-23217.stderr | 10 + src/test/{compile-fail => ui}/issue-23302.rs | 4 - src/test/ui/issue-23302.stderr | 26 + src/test/{compile-fail => ui}/issue-23543.rs | 1 - src/test/ui/issue-23543.stderr | 8 + src/test/{compile-fail => ui}/issue-23544.rs | 1 - src/test/ui/issue-23544.stderr | 8 + src/test/{compile-fail => ui}/issue-23716.rs | 2 - src/test/ui/issue-23716.stderr | 20 + .../slice.rs => test/ui/issue-24036.rs} | 19 +- src/test/ui/issue-24036.stderr | 31 + src/test/{compile-fail => ui}/issue-24081.rs | 15 +- src/test/ui/issue-24081.stderr | 77 + src/test/{compile-fail => ui}/issue-24424.rs | 1 - src/test/ui/issue-24424.stderr | 10 + src/test/{compile-fail => ui}/issue-25385.rs | 1 - src/test/ui/issue-25385.stderr | 17 + src/test/{compile-fail => ui}/issue-25793.rs | 3 - src/test/ui/issue-25793.stderr | 13 + src/test/{compile-fail => ui}/issue-25826.rs | 1 - src/test/ui/issue-25826.stderr | 8 + src/test/{compile-fail => ui}/issue-26056.rs | 2 - src/test/ui/issue-26056.stderr | 10 + src/test/{compile-fail => ui}/issue-26093.rs | 2 - src/test/ui/issue-26093.stderr | 11 + src/test/{compile-fail => ui}/issue-26472.rs | 1 - src/test/ui/issue-26472.stderr | 10 + src/test/ui/issue-26548.stderr | 9 - src/test/{compile-fail => ui}/issue-26638.rs | 5 - src/test/ui/issue-26638.stderr | 28 + src/test/{compile-fail => ui}/issue-26886.rs | 5 +- src/test/ui/issue-26886.stderr | 31 + src/test/{compile-fail => ui}/issue-27842.rs | 3 - src/test/ui/issue-27842.stderr | 16 + src/test/{compile-fail => ui}/issue-27942.rs | 6 - src/test/ui/issue-27942.stderr | 52 + src/test/{compile-fail => ui}/issue-2848.rs | 3 +- src/test/ui/issue-2848.stderr | 10 + src/test/{compile-fail => ui}/issue-28568.rs | 2 - src/test/ui/issue-28568.stderr | 11 + src/test/{compile-fail => ui}/issue-28776.rs | 1 - src/test/ui/issue-28776.stderr | 8 + src/test/{compile-fail => ui}/issue-28837.rs | 15 - src/test/ui/issue-28837.stderr | 122 + src/test/{compile-fail => ui}/issue-28971.rs | 3 +- src/test/ui/issue-28971.stderr | 11 + src/test/{compile-fail => ui}/issue-29124.rs | 2 - src/test/ui/issue-29124.stderr | 18 + src/test/{compile-fail => ui}/issue-30007.rs | 2 +- src/test/ui/issue-30007.stderr | 14 + src/test/{compile-fail => ui}/issue-3008-1.rs | 3 +- src/test/ui/issue-3008-1.stderr | 13 + src/test/{compile-fail => ui}/issue-3008-2.rs | 2 - src/test/ui/issue-3008-2.stderr | 12 + src/test/{compile-fail => ui}/issue-30255.rs | 4 +- src/test/ui/issue-30255.stderr | 26 + src/test/{compile-fail => ui}/issue-30302.rs | 1 - src/test/ui/issue-30302.stderr | 25 + src/test/{compile-fail => ui}/issue-3044.rs | 1 - src/test/ui/issue-3044.stderr | 8 + src/test/{compile-fail => ui}/issue-30730.rs | 3 +- src/test/ui/issue-30730.stderr | 15 + src/test/{compile-fail => ui}/issue-31221.rs | 9 - src/test/ui/issue-31221.stderr | 32 + src/test/{compile-fail => ui}/issue-32326.rs | 3 - src/test/ui/issue-32326.stderr | 14 + src/test/{compile-fail => ui}/issue-32950.rs | 2 +- src/test/ui/issue-32950.stderr | 8 + src/test/ui/issue-33525.rs | 6 +- src/test/ui/issue-33525.stderr | 6 +- src/test/ui/issue-33941.rs | 3 +- src/test/ui/issue-33941.stderr | 4 +- src/test/{compile-fail => ui}/issue-34047.rs | 3 +- src/test/ui/issue-34047.stderr | 11 + src/test/{compile-fail => ui}/issue-34209.rs | 2 - src/test/ui/issue-34209.stderr | 10 + src/test/{compile-fail => ui}/issue-35139.rs | 1 - src/test/ui/issue-35139.stderr | 8 + src/test/ui/issue-35241.rs | 2 +- src/test/ui/issue-35241.stderr | 2 +- src/test/ui/issue-35675.rs | 17 +- src/test/ui/issue-35675.stderr | 28 +- src/test/{compile-fail => ui}/issue-35869.rs | 16 +- src/test/ui/issue-35869.stderr | 50 + src/test/ui/issue-35976.rs | 1 - src/test/ui/issue-35976.stderr | 5 +- src/test/{compile-fail => ui}/issue-36163.rs | 3 - src/test/ui/issue-36163.stderr | 20 + src/test/ui/issue-36400.rs | 2 +- src/test/ui/issue-36400.stderr | 2 +- src/test/{compile-fail => ui}/issue-36708.rs | 1 - src/test/ui/issue-36708.stderr | 8 + .../issue-37311.rs | 2 +- .../issue-37311.stderr | 2 +- src/test/{compile-fail => ui}/issue-3779.rs | 2 - src/test/ui/issue-3779.stderr | 13 + src/test/{compile-fail => ui}/issue-37884.rs | 3 - src/test/ui/issue-37884.stderr | 37 + .../ui/issue-40402-ref-hints/issue-40402-1.rs | 2 +- .../issue-40402-1.stderr | 2 +- .../ui/issue-40402-ref-hints/issue-40402-2.rs | 2 +- .../issue-40402-2.stderr | 2 +- src/test/ui/issue-40782.rs | 2 +- src/test/ui/issue-40782.stderr | 2 +- src/test/ui/issue-41652/issue_41652.rs | 2 - src/test/ui/issue-42106.rs | 2 +- src/test/ui/issue-42106.stderr | 2 +- src/test/ui/issue-42954.rs | 2 +- src/test/ui/issue-42954.stderr | 2 +- src/test/{compile-fail => ui}/issue-4335.rs | 3 - src/test/ui/issue-4335.stderr | 20 + src/test/ui/issue-44023.rs | 2 +- src/test/ui/issue-44023.stderr | 2 +- src/test/ui/issue-44078.rs | 2 +- src/test/ui/issue-44078.stderr | 2 +- src/test/ui/issue-44406.rs | 3 +- src/test/ui/issue-44406.stderr | 6 +- ...sue-45107-unnecessary-unsafe-in-closure.rs | 6 +- ...45107-unnecessary-unsafe-in-closure.stderr | 67 +- src/test/ui/issue-45296.rs | 2 +- src/test/ui/issue-45296.stderr | 2 +- src/test/ui/issue-45730.rs | 6 +- src/test/ui/issue-45730.stderr | 6 +- src/test/ui/issue-46186.rs | 15 + src/test/ui/issue-46186.stderr | 8 + .../ui/issue-46332.rs} | 20 +- src/test/ui/issue-46332.stderr | 8 + src/test/ui/issue-46471-1.rs | 21 + src/test/ui/issue-46471-1.stderr | 24 + .../issue-46471.rs} | 15 +- src/test/ui/issue-46471.stderr | 24 + src/test/ui/issue-46472.rs | 19 + src/test/ui/issue-46472.stderr | 40 + src/test/ui/issue-46576.rs | 31 + src/test/ui/issue-46576.stderr | 14 + ...-47073-zero-padded-tuple-struct-indices.rs | 22 + ...73-zero-padded-tuple-struct-indices.stderr | 14 + src/test/{compile-fail => ui}/issue-4935.rs | 1 - src/test/ui/issue-4935.stderr | 11 + src/test/{compile-fail => ui}/issue-5239-1.rs | 1 - src/test/ui/issue-5239-1.stderr | 10 + src/test/{compile-fail => ui}/issue-6458-3.rs | 1 - src/test/ui/issue-6458-3.stderr | 8 + src/test/{compile-fail => ui}/issue-6458-4.rs | 2 +- src/test/ui/issue-6458-4.stderr | 15 + src/test/{compile-fail => ui}/issue-6458.rs | 1 - src/test/ui/issue-6458.stderr | 8 + src/test/{compile-fail => ui}/issue-7813.rs | 2 - src/test/ui/issue-7813.stderr | 10 + ...-return-type-requires-explicit-lifetime.rs | 10 - ...urn-type-requires-explicit-lifetime.stderr | 54 + .../42701_one_named_and_one_anonymous.rs | 2 +- .../42701_one_named_and_one_anonymous.stderr | 2 +- ...one-existing-name-early-bound-in-struct.rs | 2 +- ...existing-name-early-bound-in-struct.stderr | 2 +- .../ex1-return-one-existing-name-if-else-2.rs | 2 +- ...-return-one-existing-name-if-else-2.stderr | 2 +- .../ex1-return-one-existing-name-if-else-3.rs | 2 +- ...-return-one-existing-name-if-else-3.stderr | 2 +- ...-one-existing-name-if-else-using-impl-2.rs | 2 +- ...-existing-name-if-else-using-impl-2.stderr | 2 +- ...-one-existing-name-if-else-using-impl-3.rs | 2 +- ...-existing-name-if-else-using-impl-3.stderr | 2 +- ...rn-one-existing-name-if-else-using-impl.rs | 2 +- ...ne-existing-name-if-else-using-impl.stderr | 2 +- .../ex1-return-one-existing-name-if-else.rs | 2 +- ...x1-return-one-existing-name-if-else.stderr | 2 +- ...n-one-existing-name-return-type-is-anon.rs | 2 +- ...e-existing-name-return-type-is-anon.stderr | 2 +- ...1-return-one-existing-name-self-is-anon.rs | 2 +- ...turn-one-existing-name-self-is-anon.stderr | 2 +- .../ex1b-return-no-names-if-else.rs | 2 +- .../ex1b-return-no-names-if-else.stderr | 2 +- .../ex2a-push-one-existing-name-2.rs | 2 +- .../ex2a-push-one-existing-name-2.stderr | 2 +- ...ex2a-push-one-existing-name-early-bound.rs | 2 +- ...-push-one-existing-name-early-bound.stderr | 2 +- .../ex2a-push-one-existing-name.rs | 2 +- .../ex2a-push-one-existing-name.stderr | 2 +- .../ex2b-push-no-existing-names.rs | 2 +- .../ex2b-push-no-existing-names.stderr | 2 +- .../ex2c-push-inference-variable.rs | 2 +- .../ex2c-push-inference-variable.stderr | 2 +- .../ex2d-push-inference-variable-2.rs | 2 +- .../ex2d-push-inference-variable-2.stderr | 2 +- .../ex2e-push-inference-variable-3.rs | 2 +- .../ex2e-push-inference-variable-3.stderr | 2 +- .../ex3-both-anon-regions-2.rs | 2 +- .../ex3-both-anon-regions-2.stderr | 2 +- .../ex3-both-anon-regions-3.rs | 3 +- .../ex3-both-anon-regions-3.stderr | 4 +- ...x3-both-anon-regions-both-are-structs-2.rs | 2 +- ...oth-anon-regions-both-are-structs-2.stderr | 2 +- ...x3-both-anon-regions-both-are-structs-3.rs | 4 +- ...oth-anon-regions-both-are-structs-3.stderr | 2 +- ...x3-both-anon-regions-both-are-structs-4.rs | 2 +- ...oth-anon-regions-both-are-structs-4.stderr | 2 +- ...ons-both-are-structs-earlybound-regions.rs | 2 +- ...both-are-structs-earlybound-regions.stderr | 2 +- ...ions-both-are-structs-latebound-regions.rs | 2 +- ...-both-are-structs-latebound-regions.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs.rs | 2 +- ...-both-anon-regions-both-are-structs.stderr | 2 +- ...ex3-both-anon-regions-latebound-regions.rs | 4 +- ...both-anon-regions-latebound-regions.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-2.rs | 2 +- ...3-both-anon-regions-one-is-struct-2.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-3.rs | 2 +- ...3-both-anon-regions-one-is-struct-3.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-4.rs | 2 +- ...3-both-anon-regions-one-is-struct-4.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct.rs | 2 +- ...ex3-both-anon-regions-one-is-struct.stderr | 2 +- ...3-both-anon-regions-return-type-is-anon.rs | 2 +- ...th-anon-regions-return-type-is-anon.stderr | 2 +- .../ex3-both-anon-regions-self-is-anon.rs | 2 +- .../ex3-both-anon-regions-self-is-anon.stderr | 2 +- .../ex3-both-anon-regions-using-fn-items.rs | 2 +- ...x3-both-anon-regions-using-fn-items.stderr | 2 +- .../ex3-both-anon-regions-using-impl-items.rs | 2 +- ...-both-anon-regions-using-impl-items.stderr | 2 +- ...3-both-anon-regions-using-trait-objects.rs | 2 +- ...th-anon-regions-using-trait-objects.stderr | 2 +- .../lifetime-errors/ex3-both-anon-regions.rs | 2 +- .../ex3-both-anon-regions.stderr | 2 +- .../liveness-assign-imm-local-notes.rs | 54 + .../liveness-assign-imm-local-notes.stderr | 64 + .../lifetimes/borrowck-let-suggestion.stderr | 8 +- .../lifetime-doesnt-live-long-enough.rs | 14 + .../lifetime-doesnt-live-long-enough.stderr | 81 +- .../{compile-fail => ui}/lint-forbid-attr.rs | 2 - src/test/ui/lint-forbid-attr.stderr | 11 + .../lint-output-format-2.rs | 2 - src/test/ui/lint-output-format-2.stderr | 24 + .../lint-unconditional-recursion.rs | 47 +- .../ui/lint-unconditional-recursion.stderr | 157 + .../ui/lint/command-line-lint-group-allow.rs | 1 + .../ui/lint/command-line-lint-group-deny.rs | 2 +- .../lint/command-line-lint-group-deny.stderr | 2 +- .../ui/lint/command-line-lint-group-forbid.rs | 2 +- .../command-line-lint-group-forbid.stderr | 2 +- .../ui/lint/command-line-lint-group-warn.rs | 1 + .../lint/command-line-lint-group-warn.stderr | 4 +- src/test/ui/lint/lint-group-style.rs | 10 +- src/test/ui/lint/lint-group-style.stderr | 10 +- src/test/ui/lint/not_found.rs | 2 + src/test/ui/lint/not_found.stderr | 12 +- src/test/ui/lint/outer-forbid.rs | 6 +- src/test/ui/lint/outer-forbid.stderr | 6 +- src/test/ui/lint/suggestions.rs | 9 + src/test/ui/lint/suggestions.stderr | 50 +- src/test/ui/lint/unreachable_pub-pub_crate.rs | 2 + .../ui/lint/unreachable_pub-pub_crate.stderr | 90 +- src/test/ui/lint/unreachable_pub.rs | 2 + src/test/ui/lint/unreachable_pub.stderr | 90 +- .../ui/lint/unused_parens_json_suggestion.rs | 1 + .../lint/unused_parens_json_suggestion.stderr | 38 +- src/test/ui/lint/use_suggestion_json.stderr | 138 +- .../liveness-return-last-stmt-semi.rs | 3 +- .../ui/liveness-return-last-stmt-semi.stderr | 51 + src/test/ui/loop-break-value-no-repeat.rs | 2 +- src/test/ui/loop-break-value-no-repeat.stderr | 2 +- .../loops-reject-duplicate-labels-2.rs | 24 +- .../ui/loops-reject-duplicate-labels-2.stderr | 72 + .../loops-reject-duplicate-labels.rs | 24 +- .../ui/loops-reject-duplicate-labels.stderr | 75 + ...loops-reject-labels-shadowing-lifetimes.rs | 35 +- ...s-reject-labels-shadowing-lifetimes.stderr | 110 + .../loops-reject-lifetime-shadowing-label.rs | 3 +- ...ops-reject-lifetime-shadowing-label.stderr | 16 + src/test/ui/lub-glb/old-lub-glb-hr.rs | 2 +- src/test/ui/lub-glb/old-lub-glb-hr.stderr | 8 +- src/test/ui/lub-glb/old-lub-glb-object.rs | 2 +- src/test/ui/lub-glb/old-lub-glb-object.stderr | 8 +- .../{compile-fail => ui}/macro-context.rs | 8 +- src/test/ui/macro-context.stderr | 45 + .../macro-invalid-fragment-spec.rs | 1 - .../ui/macro-invalid-fragment-spec.stderr | 10 + .../{compile-fail => ui}/macro-shadowing.rs | 7 +- src/test/ui/macro-shadowing.stderr | 24 + src/test/ui/macro_backtrace/auxiliary/ping.rs | 41 + .../ui/macro_backtrace/main.rs} | 26 +- src/test/ui/macro_backtrace/main.stderr | 78 + src/test/ui/macros/bad_hello.rs | 2 +- src/test/ui/macros/bad_hello.stderr | 2 +- src/test/ui/macros/format-foreign.rs | 6 +- src/test/ui/macros/format-foreign.stderr | 8 +- src/test/ui/macros/format-unused-lables.rs | 2 +- .../ui/macros/format-unused-lables.stderr | 8 +- .../macro-backtrace-invalid-internals.rs | 12 +- .../macro-backtrace-invalid-internals.stderr | 12 +- src/test/ui/macros/macro-backtrace-nested.rs | 3 +- .../ui/macros/macro-backtrace-nested.stderr | 8 +- src/test/ui/macros/macro-backtrace-println.rs | 2 +- .../ui/macros/macro-backtrace-println.stderr | 2 +- src/test/ui/macros/macro-name-typo.rs | 2 +- src/test/ui/macros/macro-name-typo.stderr | 2 +- .../ui/macros/macro_path_as_generic_bound.rs | 2 +- .../macros/macro_path_as_generic_bound.stderr | 2 +- src/test/ui/macros/macro_undefined.rs | 4 +- src/test/ui/macros/macro_undefined.stderr | 4 +- src/test/ui/macros/trace-macro.rs | 1 + src/test/ui/macros/trace-macro.stderr | 4 +- src/test/ui/macros/trace_faulty_macros.rs | 4 +- src/test/ui/macros/trace_faulty_macros.stderr | 4 +- .../main-wrong-location.rs | 2 +- src/test/ui/main-wrong-location.stderr | 11 + src/test/{compile-fail => ui}/maybe-bounds.rs | 1 - src/test/ui/maybe-bounds.stderr | 22 + src/test/ui/method-call-err-msg.rs | 8 - src/test/ui/method-call-err-msg.stderr | 33 +- .../method-missing-call.rs | 2 - src/test/ui/method-missing-call.stderr | 18 + src/test/ui/mismatched_types/E0053.rs | 8 +- src/test/ui/mismatched_types/E0053.stderr | 8 +- src/test/ui/mismatched_types/E0409.rs | 5 - src/test/ui/mismatched_types/E0631.rs | 8 +- src/test/ui/mismatched_types/E0631.stderr | 28 +- src/test/ui/mismatched_types/abridged.rs | 12 +- src/test/ui/mismatched_types/abridged.stderr | 12 +- src/test/ui/mismatched_types/binops.rs | 12 +- src/test/ui/mismatched_types/binops.stderr | 12 +- src/test/ui/mismatched_types/cast-rfc0401.rs | 68 +- .../ui/mismatched_types/cast-rfc0401.stderr | 70 +- .../ui/mismatched_types/closure-arg-count.rs | 14 + .../mismatched_types/closure-arg-count.stderr | 43 +- .../closure-arg-type-mismatch.rs | 9 +- .../closure-arg-type-mismatch.stderr | 10 +- .../ui/mismatched_types/closure-mismatch.rs | 3 +- .../mismatched_types/closure-mismatch.stderr | 4 +- .../ui/mismatched_types/const-fn-in-trait.rs | 4 +- .../mismatched_types/const-fn-in-trait.stderr | 4 +- src/test/ui/mismatched_types/fn-variance-1.rs | 4 - .../ui/mismatched_types/fn-variance-1.stderr | 20 +- .../for-loop-has-unit-body.rs | 2 - src/test/ui/mismatched_types/issue-19109.rs | 3 - .../ui/mismatched_types/issue-19109.stderr | 2 +- src/test/ui/mismatched_types/issue-26480.rs | 4 +- .../ui/mismatched_types/issue-26480.stderr | 4 +- src/test/ui/mismatched_types/issue-35030.rs | 2 +- .../ui/mismatched_types/issue-35030.stderr | 2 +- src/test/ui/mismatched_types/issue-36053-2.rs | 10 +- src/test/ui/mismatched_types/issue-38371.rs | 8 +- .../ui/mismatched_types/issue-38371.stderr | 8 +- src/test/ui/mismatched_types/main.rs | 2 +- src/test/ui/mismatched_types/main.stderr | 2 +- .../method-help-unsatisfied-bound.rs | 1 - .../mismatched_types/overloaded-calls-bad.rs | 5 - .../overloaded-calls-bad.stderr | 10 +- .../ui/mismatched_types/recovered-block.rs | 31 + .../mismatched_types/recovered-block.stderr | 18 + .../trait-bounds-cant-coerce.rs | 3 - .../trait-impl-fn-incompatibility.rs | 4 +- .../trait-impl-fn-incompatibility.stderr | 4 +- .../unboxed-closures-vtable-mismatch.rs | 9 +- .../unboxed-closures-vtable-mismatch.stderr | 7 +- .../missing-block-hint.rs | 2 - src/test/ui/missing-block-hint.stderr | 16 + src/test/ui/missing-items/issue-40221.rs | 2 +- src/test/ui/missing-items/issue-40221.stderr | 2 +- src/test/ui/missing-items/m2.rs | 2 +- src/test/ui/missing-items/m2.stderr | 5 +- .../missing-items/missing-type-parameter.rs | 2 +- .../missing-type-parameter.stderr | 2 +- src/test/ui/missing_non_modrs_mod/foo.rs | 13 + .../missing_non_modrs_mod.rs | 14 + .../missing_non_modrs_mod.stderr | 10 + .../moves-based-on-type-block-bad.rs | 1 - .../ui/moves-based-on-type-block-bad.stderr | 11 + .../moves-based-on-type-match-bindings.rs | 2 +- .../moves-based-on-type-match-bindings.stderr | 13 + .../moves-based-on-type-tuple.rs | 7 +- src/test/ui/moves-based-on-type-tuple.stderr | 22 + src/test/ui/mut-ref.rs | 2 +- src/test/ui/mut-ref.stderr | 2 +- src/test/ui/nll/capture-ref-in-struct.rs | 51 + src/test/ui/nll/capture-ref-in-struct.stderr | 16 + .../escape-argument-callee.rs | 53 + .../escape-argument-callee.stderr | 39 + .../closure-requirements/escape-argument.rs | 52 + .../escape-argument.stderr | 41 + .../escape-upvar-nested.rs | 43 + .../escape-upvar-nested.stderr | 68 + .../closure-requirements/escape-upvar-ref.rs | 43 + .../escape-upvar-ref.stderr | 45 + .../propagate-approximated-fail-no-postdom.rs | 63 + ...pagate-approximated-fail-no-postdom.stderr | 45 + .../propagate-approximated-ref.rs | 61 + .../propagate-approximated-ref.stderr | 51 + ...horter-to-static-comparing-against-free.rs | 51 + ...er-to-static-comparing-against-free.stderr | 85 + ...approximated-shorter-to-static-no-bound.rs | 53 + ...oximated-shorter-to-static-no-bound.stderr | 53 + ...roximated-shorter-to-static-wrong-bound.rs | 56 + ...mated-shorter-to-static-wrong-bound.stderr | 53 + .../propagate-approximated-to-empty.stderr | 45 + .../propagate-approximated-val.rs | 54 + .../propagate-approximated-val.stderr | 51 + .../propagate-despite-same-free-region.rs | 60 + .../propagate-despite-same-free-region.stderr | 37 + ...te-fail-to-approximate-longer-no-bounds.rs | 53 + ...ail-to-approximate-longer-no-bounds.stderr | 45 + ...fail-to-approximate-longer-wrong-bounds.rs | 57 + ...-to-approximate-longer-wrong-bounds.stderr | 45 + .../propagate-from-trait-match.rs | 60 + .../propagate-from-trait-match.stderr | 62 + ...region-lbr-anon-does-not-outlive-static.rs | 24 + ...on-lbr-anon-does-not-outlive-static.stderr | 14 + ...egion-lbr-named-does-not-outlive-static.rs | 24 + ...n-lbr-named-does-not-outlive-static.stderr | 14 + .../region-lbr1-does-not-outlive-ebr2.rs} | 4 +- .../region-lbr1-does-not-outlive-ebr2.stderr | 18 + ...does-outlive-lbr2-because-implied-bound.rs | 23 + .../return-wrong-bound-region.rs | 34 + .../return-wrong-bound-region.stderr | 37 + src/test/ui/nll/constant.rs | 21 + .../nll/drop-may-dangle.rs} | 22 +- src/test/ui/nll/drop-may-dangle.stderr | 0 src/test/ui/nll/drop-no-may-dangle.rs | 43 + src/test/ui/nll/drop-no-may-dangle.stderr | 25 + src/test/ui/nll/get_default.rs | 6 +- src/test/ui/nll/get_default.stderr | 33 +- ...initialized-drop-implicit-fragment-drop.rs | 34 + ...ialized-drop-implicit-fragment-drop.stderr | 14 + .../maybe-initialized-drop-uninitialized.rs | 29 + ...aybe-initialized-drop-uninitialized.stderr | 0 .../maybe-initialized-drop-with-fragment.rs | 32 + ...aybe-initialized-drop-with-fragment.stderr | 13 + ...lized-drop-with-uninitialized-fragments.rs | 34 + ...d-drop-with-uninitialized-fragments.stderr | 14 + src/test/ui/nll/maybe-initialized-drop.rs | 27 + src/test/ui/nll/maybe-initialized-drop.stderr | 12 + src/test/ui/nll/named-region-basic.stderr | 29 - .../nll/projection-return.rs} | 20 +- .../ui/nll/ty-outlives/impl-trait-captures.rs | 27 + .../ty-outlives/impl-trait-captures.stderr | 16 + .../ui/nll/ty-outlives/impl-trait-outlives.rs | 51 + .../ty-outlives/impl-trait-outlives.stderr | 30 + .../ty-outlives/projection-implied-bounds.rs | 56 + .../projection-implied-bounds.stderr | 16 + .../projection-no-regions-closure.rs | 68 + .../projection-no-regions-closure.stderr | 161 + .../ty-outlives/projection-no-regions-fn.rs | 53 + .../projection-no-regions-fn.stderr | 30 + .../projection-one-region-closure.rs | 106 + .../projection-one-region-closure.stderr | 200 + ...ojection-one-region-trait-bound-closure.rs | 106 + ...tion-one-region-trait-bound-closure.stderr | 204 + ...n-one-region-trait-bound-static-closure.rs | 99 + ...e-region-trait-bound-static-closure.stderr | 155 + ...ojection-two-region-trait-bound-closure.rs | 135 + ...tion-two-region-trait-bound-closure.stderr | 332 + ...y-param-closure-approximate-lower-bound.rs | 55 + ...ram-closure-approximate-lower-bound.stderr | 87 + ...param-closure-outlives-from-return-type.rs | 66 + ...m-closure-outlives-from-return-type.stderr | 62 + ...aram-closure-outlives-from-where-clause.rs | 96 + ...-closure-outlives-from-where-clause.stderr | 195 + .../ty-param-fn-body-nll-feature.rs | 41 + .../ty-param-fn-body-nll-feature.stderr | 10 + .../ui/nll/ty-outlives/ty-param-fn-body.rs | 41 + .../nll/ty-outlives/ty-param-fn-body.stderr | 16 + src/test/ui/nll/ty-outlives/ty-param-fn.rs | 51 + .../ui/nll/ty-outlives/ty-param-fn.stderr | 30 + .../ty-outlives/ty-param-implied-bounds.rs} | 38 +- .../ty-param-implied-bounds.stderr | 0 .../no-patterns-in-args.rs | 3 - src/test/ui/no-patterns-in-args.stderr | 32 + .../non-constant-expr-for-arr-len.rs | 1 - .../ui/non-constant-expr-for-arr-len.stderr | 8 + .../non-exhaustive-pattern-witness.rs | 7 - .../ui/non-exhaustive-pattern-witness.stderr | 44 + src/test/ui/non_modrs_mods/foors_mod.rs | 14 + .../foors_mod/compiletest-ignore-dir | 0 .../foors_mod/inner_foors_mod.rs | 11 + .../foors_mod/inner_foors_mod/innest.rs | 11 + .../foors_mod/inner_modrs_mod/innest.rs | 11 + .../foors_mod/inner_modrs_mod/mod.rs | 11 + .../modrs_mod/compiletest-ignore-dir | 0 .../modrs_mod/inner_foors_mod.rs | 11 + .../modrs_mod/inner_foors_mod/innest.rs | 11 + .../modrs_mod/inner_modrs_mod/innest.rs | 11 + .../modrs_mod/inner_modrs_mod/mod.rs | 11 + src/test/ui/non_modrs_mods/modrs_mod/mod.rs | 12 + src/test/ui/non_modrs_mods/non_modrs_mods.rs | 28 + .../ui/non_modrs_mods/non_modrs_mods.stderr | 38 + .../some_crazy_attr_mod_dir/arbitrary_name.rs | 11 + .../compiletest-ignore-dir | 0 .../inner_modrs_mod/innest.rs | 11 + .../inner_modrs_mod/mod.rs | 11 + .../not-enough-arguments.rs | 2 - src/test/ui/not-enough-arguments.stderr | 11 + .../{compile-fail => ui}/numeric-fields.rs | 3 - src/test/ui/numeric-fields.stderr | 16 + .../object-safety-associated-consts.rs | 2 - .../ui/object-safety-associated-consts.stderr | 10 + .../object-safety-generics.rs | 4 - src/test/ui/object-safety-generics.stderr | 18 + .../object-safety-mentions-Self.rs | 4 - .../ui/object-safety-mentions-Self.stderr | 18 + .../object-safety-sized.rs | 2 - src/test/ui/object-safety-sized.stderr | 10 + .../object-safety-supertrait-mentions-Self.rs | 2 - ...ect-safety-supertrait-mentions-Self.stderr | 10 + .../ui/on-unimplemented/bad-annotation.rs | 9 +- .../ui/on-unimplemented/bad-annotation.stderr | 26 +- .../ui/on-unimplemented/multiple-impls.rs | 9 - .../ui/on-unimplemented/multiple-impls.stderr | 16 +- src/test/ui/on-unimplemented/on-impl.rs | 3 - src/test/ui/on-unimplemented/on-trait.rs | 4 - src/test/ui/on-unimplemented/on-trait.stderr | 4 +- src/test/ui/on-unimplemented/slice-index.rs | 4 - .../ui/on-unimplemented/slice-index.stderr | 4 +- ...owl-import-generates-unused-import-lint.rs | 22 + ...import-generates-unused-import-lint.stderr | 14 + .../ui/partialeq_help.rs} | 9 +- src/test/ui/partialeq_help.stderr | 11 + .../pat-slice-old-style.rs | 2 - src/test/ui/pat-slice-old-style.stderr | 10 + src/test/ui/print-fuel/print-fuel.rs | 1 + src/test/ui/print_type_sizes/anonymous.rs | 8 +- src/test/ui/print_type_sizes/anonymous.stderr | 0 src/test/ui/print_type_sizes/anonymous.stdout | 0 src/test/ui/print_type_sizes/generics.rs | 7 +- .../ui/print_type_sizes/multiple_types.rs | 7 +- .../ui/print_type_sizes/multiple_types.stderr | 0 .../{nullable.rs => niche-filling.rs} | 24 +- .../ui/print_type_sizes/niche-filling.stdout | 80 + src/test/ui/print_type_sizes/no_duplicates.rs | 7 +- src/test/ui/print_type_sizes/nullable.stdout | 24 - src/test/ui/print_type_sizes/packed.rs | 6 +- src/test/ui/print_type_sizes/packed.stderr | 0 src/test/ui/print_type_sizes/padding.rs | 7 +- src/test/ui/print_type_sizes/repr-align.rs | 6 +- .../ui/print_type_sizes/repr-align.stderr | 0 src/test/ui/print_type_sizes/uninhabited.rs | 22 + .../ui/print_type_sizes/uninhabited.stdout | 5 + src/test/ui/print_type_sizes/variants.rs | 7 +- src/test/ui/pub/pub-restricted-error-fn.rs | 2 +- .../ui/pub/pub-restricted-error-fn.stderr | 2 +- src/test/ui/pub/pub-restricted-error.rs | 4 +- src/test/ui/pub/pub-restricted-error.stderr | 2 +- src/test/ui/pub/pub-restricted-non-path.rs | 2 +- .../ui/pub/pub-restricted-non-path.stderr | 2 +- src/test/ui/pub/pub-restricted.rs | 10 +- src/test/ui/pub/pub-restricted.stderr | 10 +- .../qualified-path-params-2.rs | 3 - src/test/ui/qualified-path-params-2.stderr | 16 + src/test/ui/reachable/expr_add.rs | 2 +- src/test/ui/reachable/expr_add.stderr | 2 +- src/test/ui/reachable/expr_again.stderr | 2 +- src/test/ui/reachable/expr_andand.rs | 2 + src/test/ui/reachable/expr_array.rs | 4 +- src/test/ui/reachable/expr_array.stderr | 4 +- src/test/ui/reachable/expr_assign.rs | 6 +- src/test/ui/reachable/expr_assign.stderr | 6 +- src/test/ui/reachable/expr_block.rs | 2 +- src/test/ui/reachable/expr_block.stderr | 4 +- src/test/ui/reachable/expr_box.rs | 2 +- src/test/ui/reachable/expr_box.stderr | 2 +- src/test/ui/reachable/expr_call.rs | 4 +- src/test/ui/reachable/expr_call.stderr | 4 +- src/test/ui/reachable/expr_cast.rs | 2 +- src/test/ui/reachable/expr_cast.stderr | 2 +- src/test/ui/reachable/expr_if.stderr | 2 +- src/test/ui/reachable/expr_loop.stderr | 6 +- src/test/ui/reachable/expr_match.rs | 2 +- src/test/ui/reachable/expr_match.stderr | 6 +- src/test/ui/reachable/expr_method.rs | 4 +- src/test/ui/reachable/expr_method.stderr | 4 +- src/test/ui/reachable/expr_oror.rs | 2 + src/test/ui/reachable/expr_repeat.rs | 2 +- src/test/ui/reachable/expr_repeat.stderr | 2 +- src/test/ui/reachable/expr_return.rs | 2 +- src/test/ui/reachable/expr_return.stderr | 2 +- src/test/ui/reachable/expr_struct.rs | 8 +- src/test/ui/reachable/expr_struct.stderr | 8 +- src/test/ui/reachable/expr_tup.rs | 4 +- src/test/ui/reachable/expr_tup.stderr | 4 +- src/test/ui/reachable/expr_type.rs | 2 +- src/test/ui/reachable/expr_type.stderr | 2 +- src/test/ui/reachable/expr_unary.rs | 6 +- src/test/ui/reachable/expr_unary.stderr | 26 +- src/test/ui/reachable/expr_while.stderr | 6 +- .../region-borrow-params-issue-29793-small.rs | 48 - ...ion-borrow-params-issue-29793-small.stderr | 246 + .../regions-nested-fns-2.rs | 2 - src/test/ui/regions-nested-fns-2.stderr | 15 + .../resolve-conflict-item-vs-import.rs | 1 - .../ui/resolve-conflict-item-vs-import.stderr | 17 + .../resolve-inconsistent-names.rs | 4 - src/test/ui/resolve-inconsistent-names.stderr | 18 + .../ui/resolve/enums-are-namespaced-xc.rs | 9 +- .../ui/resolve/enums-are-namespaced-xc.stderr | 8 +- src/test/ui/resolve/issue-14254.rs | 72 +- src/test/ui/resolve/issue-14254.stderr | 140 +- src/test/ui/resolve/issue-16058.rs | 4 - src/test/ui/resolve/issue-17518.rs | 3 +- src/test/ui/resolve/issue-17518.stderr | 2 +- src/test/ui/resolve/issue-21221-1.rs | 19 +- src/test/ui/resolve/issue-21221-1.stderr | 12 +- src/test/ui/resolve/issue-21221-2.rs | 3 +- src/test/ui/resolve/issue-21221-3.rs | 3 +- src/test/ui/resolve/issue-21221-4.rs | 3 +- src/test/ui/resolve/issue-23305.rs | 6 +- src/test/ui/resolve/issue-23305.stderr | 2 +- src/test/ui/resolve/issue-2356.rs | 51 +- src/test/ui/resolve/issue-2356.stderr | 82 +- src/test/ui/resolve/issue-24968.rs | 3 +- src/test/ui/resolve/issue-39226.rs | 3 +- src/test/ui/resolve/issue-5035.rs | 1 - src/test/ui/resolve/issue-5035.stderr | 4 +- src/test/ui/resolve/issue-6702.rs | 1 - src/test/ui/resolve/levenshtein.rs | 8 + src/test/ui/resolve/levenshtein.stderr | 28 +- src/test/ui/resolve/privacy-struct-ctor.rs | 3 - .../ui/resolve/privacy-struct-ctor.stderr | 28 +- .../ui/resolve/resolve-assoc-suggestions.rs | 27 +- .../resolve/resolve-assoc-suggestions.stderr | 32 +- src/test/ui/resolve/resolve-hint-macro.rs | 1 - .../resolve/resolve-speculative-adjustment.rs | 12 +- .../resolve-speculative-adjustment.stderr | 12 +- .../suggest-path-instead-of-mod-dot-item.rs | 9 - ...uggest-path-instead-of-mod-dot-item.stderr | 32 +- src/test/ui/resolve/token-error-correct-2.rs | 4 +- .../ui/resolve/token-error-correct-2.stderr | 4 +- src/test/ui/resolve/token-error-correct-3.rs | 8 +- .../ui/resolve/token-error-correct-3.stderr | 24 +- src/test/ui/resolve/token-error-correct.rs | 10 +- .../ui/resolve/token-error-correct.stderr | 16 +- src/test/ui/resolve/tuple-struct-alias.rs | 8 +- src/test/ui/resolve/tuple-struct-alias.stderr | 8 +- ...unboxed-closure-sugar-nonexistent-trait.rs | 4 +- ...xed-closure-sugar-nonexistent-trait.stderr | 4 +- .../resolve/unresolved_static_type_field.rs | 5 +- .../ui/resolve/use_suggestion_placement.rs | 6 +- .../resolve/use_suggestion_placement.stderr | 6 +- .../ui/rfc-2005-default-binding-mode/const.rs | 2 +- .../const.stderr | 2 +- .../ui/rfc-2005-default-binding-mode/enum.rs | 6 +- .../rfc-2005-default-binding-mode/enum.stderr | 6 +- .../explicit-mut.rs | 6 +- .../explicit-mut.stderr | 6 +- .../ui/rfc-2005-default-binding-mode/for.rs | 1 + .../issue-44912-or.rs | 1 + .../ui/rfc-2005-default-binding-mode/lit.rs | 4 +- .../rfc-2005-default-binding-mode/lit.stderr | 4 +- .../no-double-error.rs | 2 +- .../no-double-error.stderr | 4 +- .../ui/rfc-2005-default-binding-mode/slice.rs | 2 +- .../slice.stderr | 2 +- .../suggestion.rs | 2 +- .../suggestion.stderr | 4 +- .../construct_with_other_type.rs} | 29 +- .../construct_with_other_type.stderr | 8 + .../empty_generics.rs | 18 + .../empty_generics.stderr | 8 + .../generic-associated-types-where.rs | 36 + .../generic-associated-types-where.stderr | 2 + ...ic_associated_type_undeclared_lifetimes.rs | 31 + ...ssociated_type_undeclared_lifetimes.stderr | 32 + .../iterable.rs | 32 + .../iterable.stderr | 20 + .../parse/in-trait-impl.rs} | 14 +- .../parse/in-trait.rs | 33 + .../pointer_family.rs | 50 + .../pointer_family.stderr | 26 + .../streaming_iterator.rs | 38 + .../streaming_iterator.stderr | 20 + .../fn_must_use.rs | 15 +- .../fn_must_use.stderr | 32 +- src/test/{compile-fail => ui}/self-impl.rs | 4 - src/test/ui/self-impl.stderr | 18 + .../{compile-fail => ui}/shadowed-lifetime.rs | 4 - src/test/ui/shadowed-lifetime.stderr | 18 + src/test/ui/similar-tokens.rs | 2 +- src/test/ui/similar-tokens.stderr | 6 +- src/test/ui/span/E0046.rs | 2 - src/test/ui/span/E0046.stderr | 6 +- src/test/ui/span/E0057.stderr | 4 +- src/test/ui/span/E0072.rs | 2 +- src/test/ui/span/E0072.stderr | 2 +- src/test/ui/span/E0204.rs | 8 +- src/test/ui/span/E0204.stderr | 8 +- src/test/ui/span/E0493.rs | 1 + .../borrowck-call-is-borrow-issue-12224.rs | 13 +- ...borrowck-call-is-borrow-issue-12224.stderr | 37 +- .../span/borrowck-let-suggestion-suffixes.rs | 20 +- .../borrowck-let-suggestion-suffixes.stderr | 38 +- src/test/ui/span/borrowck-ref-into-rvalue.rs | 3 +- .../ui/span/borrowck-ref-into-rvalue.stderr | 14 +- src/test/ui/span/coerce-suggestions.rs | 22 - src/test/ui/span/coerce-suggestions.stderr | 37 +- src/test/ui/span/destructor-restrictions.rs | 4 +- .../ui/span/destructor-restrictions.stderr | 10 +- src/test/ui/span/dropck-object-cycle.rs | 5 +- src/test/ui/span/dropck-object-cycle.stderr | 6 +- src/test/ui/span/dropck_arr_cycle_checked.rs | 14 +- .../ui/span/dropck_arr_cycle_checked.stderr | 61 +- .../ui/span/dropck_direct_cycle_with_drop.rs | 4 +- .../span/dropck_direct_cycle_with_drop.stderr | 21 +- src/test/ui/span/dropck_misc_variants.rs | 4 +- src/test/ui/span/dropck_misc_variants.stderr | 14 +- src/test/ui/span/dropck_vec_cycle_checked.rs | 14 +- .../ui/span/dropck_vec_cycle_checked.stderr | 61 +- src/test/ui/span/gated-features-attr-spans.rs | 7 +- .../ui/span/gated-features-attr-spans.stderr | 8 +- src/test/ui/span/impl-wrong-item-for-trait.rs | 8 +- .../ui/span/impl-wrong-item-for-trait.stderr | 69 +- src/test/ui/span/issue-11925.rs | 2 +- src/test/ui/span/issue-11925.stderr | 4 +- src/test/ui/span/issue-15480.rs | 1 + src/test/ui/span/issue-15480.stderr | 8 +- ...e-23338-locals-die-before-temps-of-body.rs | 5 +- ...338-locals-die-before-temps-of-body.stderr | 14 +- src/test/ui/span/issue-23729.rs | 2 - src/test/ui/span/issue-23729.stderr | 10 +- src/test/ui/span/issue-23827.rs | 2 - src/test/ui/span/issue-23827.stderr | 10 +- src/test/ui/span/issue-24356.rs | 2 - src/test/ui/span/issue-24356.stderr | 9 +- src/test/ui/span/issue-24690.rs | 7 +- src/test/ui/span/issue-24690.stderr | 17 +- ...24805-dropck-child-has-items-via-parent.rs | 2 +- ...5-dropck-child-has-items-via-parent.stderr | 8 +- .../issue-24805-dropck-trait-has-items.rs | 6 +- .../issue-24805-dropck-trait-has-items.stderr | 18 +- .../ui/span/issue-24895-copy-clone-dropck.rs | 3 +- .../span/issue-24895-copy-clone-dropck.stderr | 8 +- src/test/ui/span/issue-25199.rs | 4 +- src/test/ui/span/issue-25199.stderr | 19 +- src/test/ui/span/issue-26656.rs | 2 +- src/test/ui/span/issue-26656.stderr | 6 +- src/test/ui/span/issue-27522.rs | 2 +- src/test/ui/span/issue-27522.stderr | 2 +- src/test/ui/span/issue-29106.rs | 6 +- src/test/ui/span/issue-29106.stderr | 18 +- src/test/ui/span/issue-33884.stderr | 2 +- src/test/ui/span/issue-34264.rs | 11 +- src/test/ui/span/issue-34264.stderr | 32 +- src/test/ui/span/issue-35987.rs | 1 + src/test/ui/span/issue-36530.rs | 4 +- src/test/ui/span/issue-36530.stderr | 4 +- src/test/ui/span/issue-36537.rs | 6 +- src/test/ui/span/issue-36537.stderr | 11 +- src/test/ui/span/issue-37767.rs | 6 +- src/test/ui/span/issue-37767.stderr | 18 +- src/test/ui/span/issue-39018.rs | 2 + src/test/ui/span/issue-39018.stderr | 4 +- src/test/ui/span/issue-39698.rs | 4 + src/test/ui/span/issue-40157.rs | 1 + src/test/ui/span/issue-40157.stderr | 8 +- .../ui/span/issue-43927-non-ADT-derive.rs | 1 + src/test/ui/span/issue-7575.rs | 19 +- src/test/ui/span/issue-7575.stderr | 25 +- src/test/ui/span/issue28498-reject-ex1.rs | 4 +- src/test/ui/span/issue28498-reject-ex1.stderr | 21 +- .../span/issue28498-reject-lifetime-param.rs | 4 +- .../issue28498-reject-lifetime-param.stderr | 18 +- .../ui/span/issue28498-reject-passed-to-fn.rs | 4 +- .../issue28498-reject-passed-to-fn.stderr | 18 +- .../ui/span/issue28498-reject-trait-bound.rs | 4 +- .../span/issue28498-reject-trait-bound.stderr | 18 +- src/test/ui/span/lint-unused-unsafe.stderr | 87 +- src/test/ui/span/loan-extend.rs | 24 - src/test/ui/span/loan-extend.stderr | 2 +- src/test/ui/span/macro-span-replacement.rs | 4 +- .../ui/span/macro-span-replacement.stderr | 10 +- src/test/ui/span/macro-ty-params.rs | 7 +- src/test/ui/span/macro-ty-params.stderr | 8 +- src/test/ui/span/missing-unit-argument.rs | 12 +- src/test/ui/span/missing-unit-argument.stderr | 34 +- src/test/ui/span/move-closure.rs | 2 +- src/test/ui/span/move-closure.stderr | 2 +- src/test/ui/span/multiline-span-E0072.rs | 2 +- src/test/ui/span/multiline-span-E0072.stderr | 2 +- src/test/ui/span/multiline-span-simple.rs | 2 +- src/test/ui/span/multiline-span-simple.stderr | 2 +- src/test/ui/span/multispan-import-lint.rs | 3 + src/test/ui/span/multispan-import-lint.stderr | 8 +- src/test/ui/span/mut-arg-hint.rs | 6 +- src/test/ui/span/mut-arg-hint.stderr | 6 +- src/test/ui/span/mut-ptr-cant-outlive-ref.rs | 3 +- .../ui/span/mut-ptr-cant-outlive-ref.stderr | 11 +- .../ui/span/non-existing-module-import.rs | 2 +- .../ui/span/non-existing-module-import.stderr | 2 +- src/test/ui/span/pub-struct-field.rs | 4 +- src/test/ui/span/pub-struct-field.stderr | 6 +- src/test/ui/span/range-2.rs | 4 +- src/test/ui/span/range-2.stderr | 16 +- src/test/ui/span/recursive-type-field.rs | 4 +- src/test/ui/span/recursive-type-field.stderr | 4 +- .../regionck-unboxed-closure-lifetimes.rs | 3 +- .../regionck-unboxed-closure-lifetimes.stderr | 14 +- .../regions-close-over-borrowed-ref-in-obj.rs | 1 + ...ions-close-over-borrowed-ref-in-obj.stderr | 12 +- .../regions-close-over-type-parameter-2.rs | 3 +- ...regions-close-over-type-parameter-2.stderr | 8 +- .../span/regions-escape-loop-via-variable.rs | 3 +- .../regions-escape-loop-via-variable.stderr | 11 +- .../ui/span/regions-escape-loop-via-vec.rs | 12 +- .../span/regions-escape-loop-via-vec.stderr | 28 +- .../regions-infer-borrow-scope-within-loop.rs | 3 +- ...ions-infer-borrow-scope-within-loop.stderr | 14 +- .../send-is-not-static-ensures-scoping.rs | 3 +- .../send-is-not-static-ensures-scoping.stderr | 24 +- .../ui/span/send-is-not-static-std-sync-2.rs | 9 +- .../span/send-is-not-static-std-sync-2.stderr | 38 +- .../ui/span/send-is-not-static-std-sync.rs | 9 +- .../span/send-is-not-static-std-sync.stderr | 49 +- src/test/ui/span/slice-borrow.stderr | 8 +- src/test/ui/span/suggestion-non-ascii.rs | 2 +- src/test/ui/span/suggestion-non-ascii.stderr | 2 +- src/test/ui/span/type-binding.rs | 1 + src/test/ui/span/typo-suggestion.rs | 4 +- src/test/ui/span/typo-suggestion.stderr | 4 +- .../span/unused-warning-point-at-signature.rs | 8 +- .../unused-warning-point-at-signature.stderr | 8 +- .../vec-must-not-hide-type-from-dropck.rs | 6 +- .../vec-must-not-hide-type-from-dropck.stderr | 21 +- .../ui/span/vec_refs_data_with_early_death.rs | 4 +- .../vec_refs_data_with_early_death.stderr | 18 +- src/test/ui/span/visibility-ty-params.rs | 1 - src/test/ui/span/visibility-ty-params.stderr | 4 +- .../ui/span/wf-method-late-bound-regions.rs | 3 +- .../span/wf-method-late-bound-regions.stderr | 12 +- .../specialization-feature-gate-default.rs | 0 ...specialization-feature-gate-default.stderr | 10 + .../specialization-feature-gate-overlap.rs | 0 ...specialization-feature-gate-overlap.stderr | 11 + src/test/ui/static-lifetime.rs | 4 +- src/test/ui/static-lifetime.stderr | 4 +- .../str-concat-on-double-ref.rs | 1 - src/test/ui/str-concat-on-double-ref.stderr | 10 + src/test/ui/str-lit-type-mismatch.rs | 6 +- src/test/ui/str-lit-type-mismatch.stderr | 24 +- src/test/ui/struct-field-init-syntax.rs | 4 +- .../struct-fields-decl-dupe.rs | 3 +- src/test/ui/struct-fields-decl-dupe.stderr | 10 + .../struct-fields-hints-no-dupe.rs | 1 - .../ui/struct-fields-hints-no-dupe.stderr | 8 + .../struct-fields-hints.rs | 1 - src/test/ui/struct-fields-hints.stderr | 8 + .../struct-fields-too-many.rs | 2 - src/test/ui/struct-fields-too-many.stderr | 10 + .../struct-path-self-type-mismatch.rs | 7 +- .../ui/struct-path-self-type-mismatch.stderr | 32 + .../suggest-private-fields.rs | 5 - src/test/ui/suggest-private-fields.stderr | 28 + .../closure-immutable-outer-variable.rs | 2 +- .../closure-immutable-outer-variable.stderr | 2 +- .../confuse-field-and-method/issue-18343.rs | 2 - .../issue-18343.stderr | 3 + .../confuse-field-and-method/issue-2392.rs | 22 - .../issue-2392.stderr | 81 +- .../confuse-field-and-method/issue-32128.rs | 2 - .../issue-32128.stderr | 3 + .../confuse-field-and-method/issue-33784.rs | 6 - .../issue-33784.stderr | 8 +- .../confuse-field-and-method/private-field.rs | 2 +- .../private-field.stderr | 5 +- .../dont-suggest-dereference-on-arg.rs | 19 + .../dont-suggest-dereference-on-arg.stderr | 10 + .../ui/suggestions/extern-crate-rename.rs | 2 +- .../ui/suggestions/extern-crate-rename.stderr | 2 +- .../issue-32354-suggest-import-rename.rs | 2 +- .../issue-32354-suggest-import-rename.stderr | 4 +- .../issue-43420-no-over-suggest.rs | 2 +- .../issue-43420-no-over-suggest.stderr | 2 +- ...6756-consider-borrowing-cast-or-binexpr.rs | 24 + ...-consider-borrowing-cast-or-binexpr.stderr | 26 + src/test/ui/suggestions/pub-ident-fn-2.rs | 16 + src/test/ui/suggestions/pub-ident-fn-2.stderr | 12 + .../suggestions/pub-ident-fn-or-struct-2.rs | 14 + .../pub-ident-fn-or-struct-2.stderr | 8 + .../ui/suggestions/pub-ident-fn-or-struct.rs | 14 + .../suggestions/pub-ident-fn-or-struct.stderr | 8 + src/test/ui/suggestions/pub-ident-fn.rs | 16 + src/test/ui/suggestions/pub-ident-fn.stderr | 12 + src/test/ui/suggestions/pub-ident-struct.rs | 14 + .../ui/suggestions/pub-ident-struct.stderr | 12 + src/test/ui/suggestions/return-type.rs | 24 + src/test/ui/suggestions/return-type.stderr | 19 + .../ui/suggestions/str-array-assignment.rs | 21 + .../suggestions/str-array-assignment.stderr | 46 + src/test/ui/suggestions/str-as-char.rs | 14 + src/test/ui/suggestions/str-as-char.stderr | 12 + src/test/ui/suggestions/suggest-labels.rs | 6 +- src/test/ui/suggestions/suggest-labels.stderr | 6 +- src/test/ui/suggestions/suggest-methods.rs | 8 +- .../ui/suggestions/suggest-methods.stderr | 11 +- src/test/ui/suggestions/try-on-option.rs | 4 +- src/test/ui/suggestions/try-on-option.stderr | 4 +- .../ui/suggestions/try-operator-on-main.rs | 8 +- .../suggestions/try-operator-on-main.stderr | 8 +- src/test/ui/suggestions/tuple-float-index.rs | 2 +- .../ui/suggestions/tuple-float-index.stderr | 2 +- .../type-ascription-instead-of-initializer.rs | 3 +- ...e-ascription-instead-of-initializer.stderr | 8 +- ...ype-ascription-instead-of-statement-end.rs | 4 +- ...ascription-instead-of-statement-end.stderr | 4 +- .../type-ascription-with-fn-call.rs | 2 +- .../type-ascription-with-fn-call.stderr | 2 +- .../{compile-fail => ui}/svh-change-lit.rs | 4 +- src/test/ui/svh-change-lit.stderr | 13 + .../svh-change-significant-cfg.rs | 4 +- src/test/ui/svh-change-significant-cfg.stderr | 13 + .../svh-change-trait-bound.rs | 4 +- src/test/ui/svh-change-trait-bound.stderr | 13 + .../svh-change-type-arg.rs | 4 +- src/test/ui/svh-change-type-arg.stderr | 13 + .../svh-change-type-ret.rs | 4 +- src/test/ui/svh-change-type-ret.stderr | 13 + .../svh-change-type-static.rs | 4 +- src/test/ui/svh-change-type-static.stderr | 13 + .../{compile-fail => ui}/svh-use-trait.rs | 4 +- src/test/ui/svh-use-trait.stderr | 13 + src/test/ui/switched-expectations.rs | 14 + src/test/ui/switched-expectations.stderr | 11 + src/test/ui/token/bounds-obj-parens.rs | 1 - src/test/ui/token/issue-10636-2.rs | 5 +- src/test/ui/token/issue-10636-2.stderr | 12 +- src/test/ui/token/issue-41155.rs | 4 +- src/test/ui/token/issue-41155.stderr | 4 +- src/test/ui/token/macro-incomplete-parse.rs | 9 +- .../ui/token/macro-incomplete-parse.stderr | 14 +- src/test/ui/token/trailing-plus-in-bounds.rs | 1 - src/test/ui/trait-alias.rs | 43 + src/test/ui/trait-alias.stderr | 38 + .../trait-duplicate-methods.rs} | 8 +- src/test/ui/trait-duplicate-methods.stderr | 12 + src/test/ui/trait-method-private.rs | 2 +- src/test/ui/trait-method-private.stderr | 8 +- .../trait-safety-fn-body.rs | 1 - src/test/ui/trait-safety-fn-body.stderr | 8 + src/test/ui/trait-suggest-where-clause.rs | 46 + src/test/ui/trait-suggest-where-clause.stderr | 67 + ...traits-multidispatch-convert-ambig-dest.rs | 1 - ...ts-multidispatch-convert-ambig-dest.stderr | 8 + src/test/ui/transmute/main.rs | 4 +- .../transmute-from-fn-item-types-error.rs | 34 +- .../ui/transmute/transmute-type-parameters.rs | 12 +- src/test/ui/type-check/assignment-in-if.rs | 4 - .../ui/type-check/assignment-in-if.stderr | 16 +- .../type-check/cannot_infer_local_or_array.rs | 2 +- .../cannot_infer_local_or_array.stderr | 2 +- .../cannot_infer_local_or_vec.stderr | 2 +- ...cannot_infer_local_or_vec_in_tuples.stderr | 2 +- src/test/ui/type-check/issue-22897.rs | 2 +- src/test/ui/type-check/issue-22897.stderr | 2 +- src/test/ui/type-check/issue-40294.rs | 2 +- src/test/ui/type-check/issue-40294.stderr | 2 +- src/test/ui/type-check/issue-41314.rs | 3 +- src/test/ui/type-check/issue-41314.stderr | 4 +- src/test/ui/type-check/missing_trait_impl.rs | 16 + .../ui/type-check/missing_trait_impl.stderr | 10 + .../ui/type-check/unknown_type_for_closure.rs | 2 +- .../unknown_type_for_closure.stderr | 2 +- .../{compile-fail => ui}/type-recursive.rs | 3 +- src/test/ui/type-recursive.stderr | 13 + .../typeck-builtin-bound-type-parameters.rs | 6 - ...ypeck-builtin-bound-type-parameters.stderr | 38 + ...typeck-default-trait-impl-outside-crate.rs | 1 - ...ck-default-trait-impl-outside-crate.stderr | 8 + .../typeck_type_placeholder_item.rs | 34 - .../ui/typeck_type_placeholder_item.stderr | 206 + .../typeck_type_placeholder_lifetime_1.rs | 1 - .../typeck_type_placeholder_lifetime_1.stderr | 8 + .../typeck_type_placeholder_lifetime_2.rs | 1 - .../typeck_type_placeholder_lifetime_2.stderr | 8 + .../unboxed-closure-no-cyclic-sig.rs} | 8 +- .../ui/unboxed-closure-no-cyclic-sig.stderr | 12 + .../unboxed-closure-sugar-wrong-trait.rs | 2 - .../unboxed-closure-sugar-wrong-trait.stderr | 14 + ...ures-infer-fn-once-move-from-projection.rs | 2 +- ...-infer-fn-once-move-from-projection.stderr | 13 +- .../unconstrained-none.rs | 1 - src/test/ui/unconstrained-none.stderr | 8 + .../{compile-fail => ui}/unconstrained-ref.rs | 1 - src/test/ui/unconstrained-ref.stderr | 8 + src/test/ui/union-fields.stderr | 32 - .../union/union-const-eval.rs | 2 +- src/test/ui/union/union-const-eval.stderr | 16 + .../union/union-derive-eq.rs | 0 src/test/ui/union/union-derive-eq.stderr | 10 + .../union-fields-1.rs} | 8 +- src/test/ui/union/union-fields-1.stderr | 32 + .../union/union-fields-2.rs} | 3 - src/test/ui/union/union-fields-2.stderr | 82 + src/test/ui/union/union-sized-field.rs | 26 + .../ui/{ => union}/union-sized-field.stderr | 6 +- .../union/union-suggest-field.rs | 2 - src/test/ui/union/union-suggest-field.stderr | 22 + .../{compile-fail => ui}/unsafe-const-fn.rs | 1 - src/test/ui/unsafe-const-fn.stderr | 8 + .../{compile-fail => ui}/unsized-enum2.rs | 0 src/test/ui/unsized-enum2.stderr | 190 + src/test/ui/update-all-references.sh | 2 +- src/test/ui/update-references.sh | 4 +- src/test/{compile-fail => ui}/use-mod.rs | 8 +- src/test/ui/use-mod.stderr | 32 + .../{compile-fail => ui}/variadic-ffi-3.rs | 4 - src/test/ui/variadic-ffi-3.stderr | 74 + .../variance-unused-type-param.rs | 3 - src/test/ui/variance-unused-type-param.stderr | 26 + .../{compile-fail => ui}/vector-no-ann.rs | 2 - src/test/ui/vector-no-ann.stderr | 10 + src/tools/build-manifest/src/main.rs | 10 +- src/tools/cargotest/main.rs | 2 +- src/tools/clippy/CHANGELOG.md | 10 + src/tools/clippy/CONTRIBUTING.md | 5 +- src/tools/clippy/Cargo.toml | 4 +- src/tools/clippy/README.md | 2 +- src/tools/clippy/clippy_lints/Cargo.toml | 2 +- src/tools/clippy/clippy_lints/src/booleans.rs | 187 +- .../clippy_lints/src/const_static_lifetime.rs | 29 +- src/tools/clippy/clippy_lints/src/consts.rs | 3 +- src/tools/clippy/clippy_lints/src/copies.rs | 21 +- src/tools/clippy/clippy_lints/src/doc.rs | 3 +- .../clippy/clippy_lints/src/enum_variants.rs | 11 +- .../clippy_lints/src/fallible_impl_from.rs | 3 +- src/tools/clippy/clippy_lints/src/lib.rs | 1 + .../clippy/clippy_lints/src/lifetimes.rs | 10 +- src/tools/clippy/clippy_lints/src/loops.rs | 4 +- src/tools/clippy/clippy_lints/src/methods.rs | 54 +- src/tools/clippy/clippy_lints/src/misc.rs | 40 +- .../clippy_lints/src/new_without_default.rs | 118 +- .../clippy/clippy_lints/src/utils/conf.rs | 2 +- .../clippy/clippy_lints/src/utils/mod.rs | 5 +- src/tools/clippy/tests/ui/booleans.rs | 3 + src/tools/clippy/tests/ui/booleans.stderr | 21 +- .../clippy/tests/ui/clone_on_copy_mut.rs | 18 + .../clippy/tests/ui/collapsible_if.stderr | 12 - .../clippy/tests/ui/const_static_lifetime.rs | 6 + .../tests/ui/const_static_lifetime.stderr | 30 + .../clippy/tests/ui/fallible_impl_from.rs | 14 + .../clippy/tests/ui/fallible_impl_from.stderr | 6 +- src/tools/clippy/tests/ui/float_cmp_const.rs | 45 + .../clippy/tests/ui/float_cmp_const.stderr | 85 + src/tools/clippy/tests/ui/for_loop.stderr | 21 - .../clippy/tests/ui/implicit_hasher.stderr | 9 - src/tools/clippy/tests/ui/int_plus_one.stderr | 3 - .../clippy/tests/ui/large_enum_variant.stderr | 2 - src/tools/clippy/tests/ui/literals.stderr | 1 - src/tools/clippy/tests/ui/matches.rs | 36 + src/tools/clippy/tests/ui/matches.stderr | 70 +- src/tools/clippy/tests/ui/methods.stderr | 1 - .../tests/ui/needless_pass_by_value.stderr | 4 - .../tests/ui/needless_range_loop.stderr | 2 - .../clippy/tests/ui/new_without_default.rs | 6 + .../tests/ui/new_without_default.stderr | 14 +- src/tools/clippy/tests/ui/ptr_arg.stderr | 3 - src/tools/clippy/tests/ui/regex.stderr | 2 +- src/tools/clippy/tests/ui/stutter.rs | 4 + src/tools/clippy/tests/ui/stutter.stderr | 6 + src/tools/clippy/tests/ui/ty_fn_sig.rs | 14 + .../clippy/tests/ui/unnecessary_clone.stderr | 10 +- .../clippy/tests/ui/unused_io_amount.stderr | 4 +- .../clippy/tests/ui/update-all-references.sh | 2 +- src/tools/compiletest/Cargo.toml | 5 +- src/tools/compiletest/src/common.rs | 16 +- src/tools/compiletest/src/header.rs | 18 +- src/tools/compiletest/src/json.rs | 19 + src/tools/compiletest/src/main.rs | 475 +- src/tools/compiletest/src/runtest.rs | 1509 +-- src/tools/linkchecker/main.rs | 23 +- src/tools/miri/.editorconfig | 25 - src/tools/miri/.travis.yml | 45 - src/tools/miri/Cargo.lock | 388 - src/tools/miri/Cargo.toml | 39 - src/tools/miri/README.md | 103 - src/tools/miri/appveyor.yml | 35 - src/tools/miri/benches/fibonacci.rs | 26 - .../miri/benches/helpers/fibonacci_helper.rs | 8 - .../helpers/fibonacci_helper_iterative.rs | 15 - src/tools/miri/benches/helpers/miri_helper.rs | 75 - src/tools/miri/benches/helpers/mod.rs | 7 - src/tools/miri/benches/helpers/repeat.rs | 4 - .../miri/benches/helpers/repeat_manual.rs | 7 - .../miri/benches/helpers/smoke_helper.rs | 2 - src/tools/miri/benches/repeat.rs | 16 - src/tools/miri/benches/smoke.rs | 35 - src/tools/miri/build.rs | 8 - src/tools/miri/cargo-miri-test/Cargo.lock | 14 - src/tools/miri/cargo-miri-test/Cargo.toml | 7 - src/tools/miri/cargo-miri-test/src/main.rs | 9 - src/tools/miri/cargo-miri-test/tests/foo.rs | 4 - src/tools/miri/miri/bin/cargo-miri.rs | 212 - src/tools/miri/miri/bin/miri.rs | 265 - src/tools/miri/miri/fn_call.rs | 653 -- src/tools/miri/miri/helpers.rs | 73 - src/tools/miri/miri/intrinsic.rs | 685 -- src/tools/miri/miri/lib.rs | 270 - src/tools/miri/miri/memory.rs | 16 - src/tools/miri/miri/operator.rs | 175 - src/tools/miri/miri/tls.rs | 142 - src/tools/miri/rustc_tests/Cargo.lock | 217 - src/tools/miri/rustc_tests/Cargo.toml | 7 - src/tools/miri/rustc_tests/src/main.rs | 292 - src/tools/miri/src/librustc_mir/Cargo.toml | 19 - .../src/librustc_mir/interpret/const_eval.rs | 258 - .../librustc_mir/interpret/eval_context.rs | 2539 ----- .../miri/src/librustc_mir/interpret/lvalue.rs | 506 - .../miri/src/librustc_mir/interpret/memory.rs | 1700 ---- .../miri/src/librustc_mir/interpret/mod.rs | 42 - .../src/librustc_mir/interpret/range_map.rs | 250 - .../miri/src/librustc_mir/interpret/step.rs | 397 - .../miri/src/librustc_mir/interpret/traits.rs | 137 - .../src/librustc_mir/interpret/validation.rs | 727 -- src/tools/miri/src/librustc_mir/lib.rs | 26 - .../undefined_byte_read.rs | 9 - .../miri/tests/compile-fail/alignment.rs | 11 - src/tools/miri/tests/compile-fail/assume.rs | 10 - .../compile-fail/bitop-beyond-alignment.rs | 37 - .../compile-fail/cast_box_int_to_fn_ptr.rs | 11 - .../miri/tests/compile-fail/cast_fn_ptr.rs | 9 - .../miri/tests/compile-fail/cast_fn_ptr2.rs | 9 - .../tests/compile-fail/cast_fn_ptr_unsafe.rs | 10 - .../tests/compile-fail/cast_fn_ptr_unsafe2.rs | 10 - .../tests/compile-fail/cast_int_to_fn_ptr.rs | 10 - .../tests/compile-fail/copy_nonoverlapping.rs | 24 - .../miri/tests/compile-fail/ctlz_nonzero.rs | 15 - .../miri/tests/compile-fail/cttz_nonzero.rs | 15 - .../compile-fail/dangling_pointer_deref.rs | 8 - .../compile-fail/deallocate-bad-alignment.rs | 15 - .../tests/compile-fail/deallocate-bad-size.rs | 15 - .../tests/compile-fail/deallocate-twice.rs | 16 - .../miri/tests/compile-fail/deref_fn_ptr.rs | 8 - .../miri/tests/compile-fail/execute_memory.rs | 12 - .../miri/tests/compile-fail/fn_ptr_offset.rs | 14 - .../miri/tests/compile-fail/invalid_bool.rs | 4 - .../compile-fail/invalid_enum_discriminant.rs | 17 - .../miri/tests/compile-fail/match_char.rs | 8 - src/tools/miri/tests/compile-fail/memleak.rs | 5 - .../miri/tests/compile-fail/memleak_rc.rs | 12 - .../tests/compile-fail/modifying_constants.rs | 6 - .../tests/compile-fail/never_say_never.rs | 12 - .../compile-fail/never_transmute_humans.rs | 14 - .../compile-fail/never_transmute_void.rs | 16 - .../tests/compile-fail/null_pointer_deref.rs | 4 - src/tools/miri/tests/compile-fail/oom.rs | 7 - src/tools/miri/tests/compile-fail/oom2.rs | 10 - .../tests/compile-fail/out_of_bounds_ptr_1.rs | 8 - .../tests/compile-fail/out_of_bounds_ptr_2.rs | 7 - .../tests/compile-fail/out_of_bounds_read.rs | 5 - .../tests/compile-fail/out_of_bounds_read2.rs | 5 - .../tests/compile-fail/overflowing-rsh-2.rs | 16 - ..._of_relocation_makes_the_rest_undefined.rs | 11 - src/tools/miri/tests/compile-fail/panic.rs | 7 - .../tests/compile-fail/pointer_byte_read_1.rs | 7 - .../tests/compile-fail/pointer_byte_read_2.rs | 7 - ...o_different_allocations_are_unorderable.rs | 7 - .../miri/tests/compile-fail/ptr_bitops.rs | 7 - .../miri/tests/compile-fail/ptr_int_cast.rs | 8 - .../tests/compile-fail/ptr_offset_overflow.rs | 6 - .../compile-fail/reading_half_a_pointer.rs | 29 - .../reallocate-bad-alignment-2.rs | 16 - .../compile-fail/reallocate-bad-alignment.rs | 16 - .../tests/compile-fail/reallocate-bad-size.rs | 15 - .../compile-fail/reallocate-change-alloc.rs | 14 - .../tests/compile-fail/reallocate-dangling.rs | 16 - .../tests/compile-fail/reference_to_packed.rs | 19 - src/tools/miri/tests/compile-fail/repeat.rs | 5 - src/tools/miri/tests/compile-fail/repeat2.rs | 5 - .../miri/tests/compile-fail/stack_free.rs | 7 - .../miri/tests/compile-fail/stack_limit.rs | 20 - .../static_memory_modification.rs | 9 - .../static_memory_modification2.rs | 12 - .../static_memory_modification3.rs | 9 - src/tools/miri/tests/compile-fail/timeout.rs | 9 - .../compile-fail/transmute-pair-undef.rs | 20 - .../miri/tests/compile-fail/transmute_fat.rs | 15 - .../miri/tests/compile-fail/transmute_fat2.rs | 13 - .../tests/compile-fail/unaligned_ptr_cast.rs | 6 - .../tests/compile-fail/unaligned_ptr_cast2.rs | 7 - .../compile-fail/unaligned_ptr_cast_zst.rs | 6 - .../compile-fail/validation_aliasing_mut1.rs | 10 - .../compile-fail/validation_aliasing_mut2.rs | 10 - .../compile-fail/validation_aliasing_mut3.rs | 10 - .../compile-fail/validation_aliasing_mut4.rs | 13 - .../validation_buggy_as_mut_slice.rs | 20 - .../validation_buggy_split_at_mut.rs | 22 - .../compile-fail/validation_illegal_write.rs | 15 - .../compile-fail/validation_lock_confusion.rs | 24 - .../validation_pointer_smuggling.rs | 20 - .../tests/compile-fail/validation_recover1.rs | 16 - .../tests/compile-fail/validation_recover2.rs | 14 - .../tests/compile-fail/validation_recover3.rs | 15 - .../tests/compile-fail/validation_undef.rs | 14 - .../tests/compile-fail/wild_pointer_deref.rs | 5 - src/tools/miri/tests/compile-fail/zst.rs | 4 - src/tools/miri/tests/compiletest.rs | 213 - .../miri/tests/run-pass-fullmir/catch.rs | 8 - .../miri/tests/run-pass-fullmir/catch.stdout | 1 - .../miri/tests/run-pass-fullmir/format.rs | 4 - .../miri/tests/run-pass-fullmir/format.stdout | 1 - .../miri/tests/run-pass-fullmir/from_utf8.rs | 4 - .../miri/tests/run-pass-fullmir/hashmap.rs | 26 - src/tools/miri/tests/run-pass-fullmir/heap.rs | 35 - .../miri/tests/run-pass-fullmir/hello.rs | 4 - .../miri/tests/run-pass-fullmir/hello.stdout | 1 - .../tests/run-pass-fullmir/integer-ops.rs | 175 - .../tests/run-pass-fullmir/issue-15080.rs | 34 - .../miri/tests/run-pass-fullmir/issue-3794.rs | 42 - .../tests/run-pass-fullmir/issue-3794.stdout | 2 - .../run-pass-fullmir/loop-break-value.rs | 143 - .../run-pass-fullmir/regions-mock-trans.rs | 66 - src/tools/miri/tests/run-pass-fullmir/u128.rs | 79 - src/tools/miri/tests/run-pass-fullmir/vecs.rs | 52 - src/tools/miri/tests/run-pass/arrays.rs | 45 - src/tools/miri/tests/run-pass/assume_bug.rs | 3 - .../miri/tests/run-pass/atomic-access-bool.rs | 30 - .../tests/run-pass/atomic-compare_exchange.rs | 36 - src/tools/miri/tests/run-pass/aux_test.rs | 9 - .../miri/tests/run-pass/auxiliary/dep.rs | 1 - src/tools/miri/tests/run-pass/bad_substs.rs | 4 - src/tools/miri/tests/run-pass/binops.rs | 91 - src/tools/miri/tests/run-pass/bools.rs | 28 - .../miri/tests/run-pass/box_box_trait.rs | 29 - src/tools/miri/tests/run-pass/btreemap.rs | 17 - src/tools/miri/tests/run-pass/c_enums.rs | 32 - .../run-pass/call_drop_on_array_elements.rs | 22 - .../call_drop_on_fat_ptr_array_elements.rs | 20 - .../call_drop_on_zst_array_elements.rs | 21 - .../run-pass/call_drop_through_owned_slice.rs | 16 - .../call_drop_through_trait_object.rs | 20 - .../call_drop_through_trait_object_rc.rs | 22 - src/tools/miri/tests/run-pass/calls.rs | 45 - .../run-pass/cast-rfc0401-vtable-kinds.rs | 59 - src/tools/miri/tests/run-pass/cast_fn_ptr.rs | 9 - .../miri/tests/run-pass/cast_fn_ptr_unsafe.rs | 8 - src/tools/miri/tests/run-pass/char.rs | 9 - src/tools/miri/tests/run-pass/closure-drop.rs | 25 - .../miri/tests/run-pass/closure-field-ty.rs | 10 - src/tools/miri/tests/run-pass/closures.rs | 48 - .../miri/tests/run-pass/const-vec-of-fns.rs | 29 - src/tools/miri/tests/run-pass/constants.rs | 9 - .../run-pass/deriving-associated-types.rs | 208 - .../miri/tests/run-pass/drop_empty_slice.rs | 7 - .../miri/tests/run-pass/dst-field-align.rs | 77 - .../tests/run-pass/dst-irrefutable-bind.rs | 24 - src/tools/miri/tests/run-pass/dst-raw.rs | 113 - .../miri/tests/run-pass/dst-struct-sole.rs | 85 - src/tools/miri/tests/run-pass/dst-struct.rs | 134 - .../enum-nullable-const-null-with-fields.rs | 22 - src/tools/miri/tests/run-pass/enums.rs | 34 - .../miri/tests/run-pass/float_fast_math.rs | 30 - src/tools/miri/tests/run-pass/floats.rs | 11 - .../fn_item_as_closure_trait_object.rs | 6 - ..._item_with_args_as_closure_trait_object.rs | 8 - ...h_multiple_args_as_closure_trait_object.rs | 18 - .../fn_ptr_as_closure_trait_object.rs | 15 - .../miri/tests/run-pass/function_pointers.rs | 46 - .../tests/run-pass/generator_control_flow.rs | 65 - .../miri/tests/run-pass/intrinsics-integer.rs | 142 - .../miri/tests/run-pass/intrinsics-math.rs | 67 - src/tools/miri/tests/run-pass/intrinsics.rs | 10 - src/tools/miri/tests/run-pass/ints.rs | 58 - .../miri/tests/run-pass/issue-15523-big.rs | 48 - src/tools/miri/tests/run-pass/issue-17877.rs | 25 - src/tools/miri/tests/run-pass/issue-20575.rs | 19 - src/tools/miri/tests/run-pass/issue-23261.rs | 70 - src/tools/miri/tests/run-pass/issue-29746.rs | 45 - src/tools/miri/tests/run-pass/issue-30530.rs | 35 - .../run-pass/issue-36278-prefix-nesting.rs | 28 - src/tools/miri/tests/run-pass/issue-5917.rs | 17 - .../miri/tests/run-pass/issue-miri-184.rs | 4 - src/tools/miri/tests/run-pass/iter_slice.rs | 12 - src/tools/miri/tests/run-pass/loops.rs | 35 - src/tools/miri/tests/run-pass/main_fn.rs | 5 - src/tools/miri/tests/run-pass/many_shr_bor.rs | 36 - src/tools/miri/tests/run-pass/match_slice.rs | 8 - .../miri/tests/run-pass/mir_coercions.rs | 80 - src/tools/miri/tests/run-pass/mir_fat_ptr.rs | 61 - .../miri/tests/run-pass/miri-issue-133.rs | 30 - .../miri/tests/run-pass/move-undef-primval.rs | 15 - .../miri/tests/run-pass/multi_arg_closure.rs | 8 - .../tests/run-pass/negative_discriminant.rs | 13 - .../run-pass/non_capture_closure_to_fn_ptr.rs | 14 - .../miri/tests/run-pass/observed_local_mut.rs | 21 - .../run-pass/option_box_transmute_ptr.rs | 15 - src/tools/miri/tests/run-pass/option_eq.rs | 3 - .../tests/run-pass/overloaded-calls-simple.rs | 33 - .../miri/tests/run-pass/packed_static.rs | 10 - .../miri/tests/run-pass/packed_struct.rs | 69 - src/tools/miri/tests/run-pass/pointers.rs | 60 - src/tools/miri/tests/run-pass/products.rs | 32 - .../miri/tests/run-pass/ptr_arith_offset.rs | 6 - .../run-pass/ptr_arith_offset_overflow.rs | 9 - .../miri/tests/run-pass/ptr_int_casts.rs | 35 - src/tools/miri/tests/run-pass/ptr_offset.rs | 6 - src/tools/miri/tests/run-pass/rc.rs | 39 - .../miri/tests/run-pass/recursive_static.rs | 12 - .../miri/tests/run-pass/ref-invalid-ptr.rs | 7 - .../regions-lifetime-nonfree-late-bound.rs | 45 - src/tools/miri/tests/run-pass/rfc1623.rs | 81 - .../miri/tests/run-pass/rust-lang-org.rs | 21 - .../run-pass/send-is-not-static-par-for.rs | 43 - .../simd-intrinsic-generic-elements.rs | 42 - .../run-pass/slice-of-zero-size-elements.rs | 58 - .../tests/run-pass/small_enum_size_bug.rs | 14 - .../miri/tests/run-pass/specialization.rs | 21 - .../run-pass/static_memory_modification.rs | 8 - src/tools/miri/tests/run-pass/static_mut.rs | 17 - src/tools/miri/tests/run-pass/std.rs | 33 - src/tools/miri/tests/run-pass/strings.rs | 27 - .../miri/tests/run-pass/subslice_array.rs | 14 - src/tools/miri/tests/run-pass/sums.rs | 59 - .../miri/tests/run-pass/tag-align-dyn-u64.rs | 37 - src/tools/miri/tests/run-pass/thread-local.rs | 67 - .../too-large-primval-write-problem.rs | 23 - src/tools/miri/tests/run-pass/traits.rs | 30 - src/tools/miri/tests/run-pass/trivial.rs | 11 - .../tuple_like_enum_variant_constructor.rs | 3 - ...ke_enum_variant_constructor_pointer_opt.rs | 4 - ..._variant_constructor_struct_pointer_opt.rs | 33 - .../run-pass/tuple_like_struct_constructor.rs | 5 - .../miri/tests/run-pass/union-overwrite.rs | 81 - src/tools/miri/tests/run-pass/union.rs | 88 - .../validation_lifetime_resolution.rs | 30 - .../miri/tests/run-pass/vec-matching-fold.rs | 58 - src/tools/miri/tests/run-pass/write-bytes.rs | 45 - .../run-pass/zero-sized-binary-heap-push.rs | 28 - src/tools/miri/tests/run-pass/zst.rs | 18 - src/tools/miri/tests/run-pass/zst2.rs | 12 - src/tools/miri/tests/run-pass/zst_box.rs | 8 - .../miri/tests/run-pass/zst_variant_drop.rs | 23 - .../miri/tex/final-presentation/latexmkrc | 12 - .../final-presentation/rust-logo-512x512.png | Bin 96029 -> 0 bytes .../miri/tex/final-presentation/slides.tex | 444 - src/tools/miri/tex/report/latexmkrc | 12 - src/tools/miri/tex/report/miri-report.tex | 663 -- src/tools/miri/xargo/Cargo.lock | 4 - src/tools/miri/xargo/Cargo.toml | 6 - src/tools/miri/xargo/Xargo.toml | 2 - src/tools/miri/xargo/build.sh | 3 - src/tools/publish_toolstate.py | 105 + src/tools/rust-installer/Cargo.toml | 2 +- src/tools/rust-installer/src/combiner.rs | 4 +- src/tools/rust-installer/src/tarballer.rs | 2 +- src/tools/tidy/src/features.rs | 13 +- src/tools/tidy/src/lib.rs | 4 +- src/tools/tidy/src/style.rs | 21 +- src/tools/toolstate.toml | 35 - src/vendor/aho-corasick/.cargo-checksum.json | 2 +- src/vendor/aho-corasick/Cargo.toml | 83 +- src/vendor/aho-corasick/Cargo.toml.orig | 49 + src/vendor/aho-corasick/README.md | 2 +- src/vendor/ansi_term/.cargo-checksum.json | 2 +- src/vendor/ansi_term/Cargo.toml | 21 +- src/vendor/ansi_term/Cargo.toml.orig | 13 + src/vendor/ansi_term/README.md | 9 +- src/vendor/ansi_term/src/ansi.rs | 258 + src/vendor/ansi_term/src/debug.rs | 122 + src/vendor/ansi_term/src/difference.rs | 179 + src/vendor/ansi_term/src/display.rs | 279 + src/vendor/ansi_term/src/lib.rs | 919 +- src/vendor/ansi_term/src/style.rs | 258 + src/vendor/ansi_term/src/windows.rs | 35 + src/vendor/ansi_term/src/write.rs | 40 + src/vendor/byteorder/.cargo-checksum.json | 1 + src/vendor/byteorder/.cargo-ok | 0 src/vendor/byteorder/.gitignore | 6 + src/vendor/byteorder/.travis.yml | 22 + src/vendor/byteorder/CHANGELOG.md | 58 + .../{memchr-1.0.2 => byteorder}/COPYING | 0 src/vendor/byteorder/Cargo.toml | 43 + src/vendor/byteorder/Cargo.toml.orig | 32 + .../{memchr-1.0.2 => byteorder}/LICENSE-MIT | 0 src/vendor/byteorder/README.md | 56 + .../{memchr-1.0.2 => byteorder}/UNLICENSE | 0 src/vendor/byteorder/benches/bench.rs | 320 + src/vendor/byteorder/src/io.rs | 1264 +++ src/vendor/byteorder/src/lib.rs | 3098 ++++++ .../.cargo-checksum.json | 0 src/vendor/cargo_metadata-0.2.3/.cargo-ok | 0 .../.gitignore | 0 .../.travis.yml | 0 .../Cargo.toml | 0 .../src/lib.rs | 0 .../tests/selftest.rs | 0 src/vendor/clap/.cargo-checksum.json | 2 +- src/vendor/clap/.github/CONTRIBUTING.md | 85 +- src/vendor/clap/.travis.yml | 4 +- src/vendor/clap/CHANGELOG.md | 43 + src/vendor/clap/CONTRIBUTORS.md | 66 +- src/vendor/clap/Cargo.toml | 68 +- src/vendor/clap/Cargo.toml.orig | 12 +- src/vendor/clap/README.md | 270 +- src/vendor/clap/src/app/help.rs | 14 +- src/vendor/clap/src/app/macros.rs | 2 +- src/vendor/clap/src/app/meta.rs | 10 +- src/vendor/clap/src/app/mod.rs | 101 +- src/vendor/clap/src/app/parser.rs | 1019 +- src/vendor/clap/src/app/settings.rs | 331 +- src/vendor/clap/src/app/usage.rs | 262 +- src/vendor/clap/src/app/validator.rs | 359 +- src/vendor/clap/src/args/arg.rs | 232 +- src/vendor/clap/src/args/arg_builder/base.rs | 19 +- .../clap/src/args/arg_builder/switched.rs | 1 - src/vendor/clap/src/args/arg_matcher.rs | 16 +- src/vendor/clap/src/args/arg_matches.rs | 65 +- src/vendor/clap/src/args/group.rs | 97 +- src/vendor/clap/src/args/matched_arg.rs | 6 +- src/vendor/clap/src/args/mod.rs | 4 +- src/vendor/clap/src/args/settings.rs | 154 +- src/vendor/clap/src/args/subcommand.rs | 6 +- src/vendor/clap/src/completions/bash.rs | 132 +- src/vendor/clap/src/completions/fish.rs | 19 +- src/vendor/clap/src/completions/macros.rs | 3 +- src/vendor/clap/src/completions/mod.rs | 54 +- src/vendor/clap/src/completions/powershell.rs | 33 +- src/vendor/clap/src/completions/shell.rs | 4 +- src/vendor/clap/src/completions/zsh.rs | 113 +- src/vendor/clap/src/errors.rs | 497 +- src/vendor/clap/src/fmt.rs | 26 +- src/vendor/clap/src/lib.rs | 87 +- src/vendor/clap/src/macros.rs | 59 +- src/vendor/clap/src/map.rs | 40 +- src/vendor/clap/src/osstringext.rs | 22 +- src/vendor/clap/src/suggestions.rs | 79 +- src/vendor/clap/src/usage_parser.rs | 331 +- src/vendor/cmake/.cargo-checksum.json | 2 +- src/vendor/cmake/Cargo.toml | 2 +- src/vendor/cmake/Cargo.toml.orig | 2 +- src/vendor/cmake/README.md | 3 + src/vendor/cmake/src/lib.rs | 3 +- .../compiletest_rs/.cargo-checksum.json | 2 +- src/vendor/compiletest_rs/Cargo.toml | 28 +- src/vendor/compiletest_rs/Cargo.toml.orig | 10 +- src/vendor/compiletest_rs/README.md | 29 +- src/vendor/compiletest_rs/src/common.rs | 25 +- src/vendor/compiletest_rs/src/errors.rs | 2 +- src/vendor/compiletest_rs/src/header.rs | 35 +- src/vendor/compiletest_rs/src/json.rs | 19 +- src/vendor/compiletest_rs/src/lib.rs | 12 +- src/vendor/compiletest_rs/src/read2.rs | 208 + src/vendor/compiletest_rs/src/runtest.rs | 354 +- src/vendor/compiletest_rs/src/util.rs | 11 +- src/vendor/flate2/.cargo-checksum.json | 2 +- src/vendor/flate2/.travis.yml | 31 +- src/vendor/flate2/Cargo.toml | 23 +- src/vendor/flate2/Cargo.toml.orig | 4 +- src/vendor/flate2/README.md | 34 +- .../flate2/examples/deflatedecoder-bufread.rs | 2 +- .../flate2/examples/deflatedecoder-read.rs | 2 +- .../flate2/examples/deflatedecoder-write.rs | 2 +- .../flate2/examples/deflateencoder-bufread.rs | 2 +- .../flate2/examples/deflateencoder-read.rs | 2 +- .../flate2/examples/deflateencoder-write.rs | 2 +- src/vendor/flate2/examples/flatereadext.rs | 22 - src/vendor/flate2/examples/gzbuilder.rs | 2 +- .../flate2/examples/gzdecoder-bufread.rs | 4 +- src/vendor/flate2/examples/gzdecoder-read.rs | 4 +- .../flate2/examples/gzencoder-bufread.rs | 2 +- src/vendor/flate2/examples/gzencoder-read.rs | 2 +- src/vendor/flate2/examples/gzencoder-write.rs | 2 +- .../flate2/examples/gzmultidecoder-bufread.rs | 4 +- .../flate2/examples/gzmultidecoder-read.rs | 4 +- .../flate2/examples/zlibdecoder-bufread.rs | 2 +- .../flate2/examples/zlibdecoder-read.rs | 2 +- .../flate2/examples/zlibdecoder-write.rs | 2 +- .../flate2/examples/zlibencoder-bufread.rs | 2 +- .../flate2/examples/zlibencoder-read.rs | 2 +- .../flate2/examples/zlibencoder-write.rs | 2 +- src/vendor/flate2/src/crc.rs | 2 +- src/vendor/flate2/src/deflate/bufread.rs | 4 +- src/vendor/flate2/src/deflate/mod.rs | 28 +- src/vendor/flate2/src/deflate/read.rs | 4 +- src/vendor/flate2/src/deflate/write.rs | 4 +- src/vendor/flate2/src/ffi.rs | 37 +- src/vendor/flate2/src/gz/bufread.rs | 77 +- src/vendor/flate2/src/gz/mod.rs | 103 +- src/vendor/flate2/src/gz/read.rs | 46 +- src/vendor/flate2/src/gz/write.rs | 8 +- src/vendor/flate2/src/lib.rs | 214 +- src/vendor/flate2/src/mem.rs | 145 +- src/vendor/flate2/src/zio.rs | 82 +- src/vendor/flate2/src/zlib/bufread.rs | 4 +- src/vendor/flate2/src/zlib/mod.rs | 18 +- src/vendor/flate2/src/zlib/read.rs | 4 +- src/vendor/flate2/src/zlib/write.rs | 4 +- src/vendor/flate2/tests/early-flush.rs | 4 +- src/vendor/flate2/tests/gunzip.rs | 4 +- src/vendor/flate2/tests/tokio.rs | 8 +- src/vendor/flate2/tests/zero-write.rs | 2 +- .../fuchsia-zircon-sys/.cargo-checksum.json | 2 +- src/vendor/fuchsia-zircon-sys/BUILD.gn | 4 +- src/vendor/fuchsia-zircon-sys/Cargo.toml | 4 +- src/vendor/fuchsia-zircon-sys/Cargo.toml.orig | 5 +- .../fuchsia-zircon-sys/src/definitions.rs | 4 +- src/vendor/fuchsia-zircon-sys/src/lib.rs | 408 +- .../fuchsia-zircon/.cargo-checksum.json | 2 +- src/vendor/fuchsia-zircon/BUILD.gn | 1 + src/vendor/fuchsia-zircon/Cargo.toml | 7 +- src/vendor/fuchsia-zircon/Cargo.toml.orig | 5 +- src/vendor/fuchsia-zircon/examples/BUILD.gn | 12 +- src/vendor/fuchsia-zircon/src/channel.rs | 242 +- src/vendor/fuchsia-zircon/src/cprng.rs | 68 + src/vendor/fuchsia-zircon/src/event.rs | 26 +- src/vendor/fuchsia-zircon/src/eventpair.rs | 54 +- src/vendor/fuchsia-zircon/src/fifo.rs | 41 +- src/vendor/fuchsia-zircon/src/handle.rs | 243 + src/vendor/fuchsia-zircon/src/lib.rs | 812 +- src/vendor/fuchsia-zircon/src/port.rs | 152 +- src/vendor/fuchsia-zircon/src/rights.rs | 28 + src/vendor/fuchsia-zircon/src/signals.rs | 105 + src/vendor/fuchsia-zircon/src/socket.rs | 106 +- src/vendor/fuchsia-zircon/src/status.rs | 162 + src/vendor/fuchsia-zircon/src/time.rs | 340 + src/vendor/fuchsia-zircon/src/timer.rs | 92 - src/vendor/fuchsia-zircon/src/vmar.rs | 18 + src/vendor/fuchsia-zircon/src/vmo.rs | 139 +- src/vendor/fuchsia-zircon/tools/BUILD.gn | 51 - src/vendor/fuchsia-zircon/tools/README.md | 26 - .../fuchsia-zircon/tools/clang_wrapper.cc | 205 - src/vendor/html-diff/.cargo-checksum.json | 2 +- src/vendor/html-diff/Cargo.toml | 5 +- src/vendor/html-diff/Cargo.toml.orig | 5 +- src/vendor/html5ever/.cargo-checksum.json | 2 +- src/vendor/html5ever/Cargo.toml | 58 +- src/vendor/html5ever/Cargo.toml.orig | 47 + src/vendor/html5ever/benches/tokenizer.rs | 19 +- .../html5ever/examples/noop-tree-builder.rs | 5 + .../html5ever/examples/print-tree-actions.rs | 14 +- src/vendor/html5ever/src/driver.rs | 4 +- src/vendor/html5ever/src/serialize/mod.rs | 52 +- .../html5ever/src/tree_builder/actions.rs | 1164 --- src/vendor/html5ever/src/tree_builder/mod.rs | 1121 ++- .../html5ever/src/tree_builder/rules.rs | 19 +- .../html5ever/src/tree_builder/types.rs | 4 +- src/vendor/html5ever/tests/serializer.rs | 110 +- src/vendor/html5ever/tests/tokenizer.rs | 7 +- src/vendor/html5ever/tests/tree_builder.rs | 4 +- src/vendor/kuchiki/.cargo-checksum.json | 2 +- src/vendor/kuchiki/Cargo.toml | 14 +- src/vendor/kuchiki/Cargo.toml.orig | 4 +- src/vendor/kuchiki/src/iter.rs | 7 + src/vendor/kuchiki/src/parser.rs | 9 + src/vendor/kuchiki/src/serializer.rs | 8 +- src/vendor/kuchiki/src/tests.rs | 19 + .../lazy_static-0.2.11/.cargo-checksum.json | 1 + src/vendor/lazy_static-0.2.11/.cargo-ok | 0 src/vendor/lazy_static-0.2.11/.gitignore | 4 + src/vendor/lazy_static-0.2.11/.travis.yml | 31 + src/vendor/lazy_static-0.2.11/Cargo.toml | 43 + src/vendor/lazy_static-0.2.11/Cargo.toml.orig | 36 + .../lazy_static-0.2.11}/LICENSE-APACHE | 4 +- .../lazy_static-0.2.11}/LICENSE-MIT | 2 +- src/vendor/lazy_static-0.2.11/README.md | 69 + src/vendor/lazy_static-0.2.11/appveyor.yml | 59 + .../lazy_static-0.2.11/src/core_lazy.rs | 33 + src/vendor/lazy_static-0.2.11/src/lazy.rs | 39 + src/vendor/lazy_static-0.2.11/src/lib.rs | 212 + .../lazy_static-0.2.11/src/nightly_lazy.rs | 43 + .../tests/compile-fail/README.md | 22 + .../incorrect_visibility_restriction.rs | 10 + .../tests/compile-fail/static_is_private.rs | 14 + .../tests/compile-fail/static_is_sized.rs | 11 + .../tests/compile-fail/static_never_used.rs | 10 + .../lazy_static-0.2.11/tests/compile_tests.rs | 18 + src/vendor/lazy_static-0.2.11/tests/no_std.rs | 21 + src/vendor/lazy_static-0.2.11/tests/test.rs | 164 + src/vendor/lazy_static/.cargo-checksum.json | 2 +- src/vendor/lazy_static/Cargo.toml | 8 +- src/vendor/lazy_static/Cargo.toml.orig | 6 +- src/vendor/lazy_static/README.md | 2 +- src/vendor/lazy_static/src/core_lazy.rs | 1 + src/vendor/lazy_static/src/lazy.rs | 1 + src/vendor/lazy_static/src/lib.rs | 14 +- src/vendor/lazy_static/src/nightly_lazy.rs | 1 + src/vendor/libc/.cargo-checksum.json | 2 +- src/vendor/libc/.travis.yml | 3 +- src/vendor/libc/Cargo.toml | 4 +- src/vendor/libc/Cargo.toml.orig | 2 +- .../docker/s390x-unknown-linux-gnu/Dockerfile | 16 +- .../sparc64-unknown-linux-gnu/Dockerfile | 17 +- .../wasm32-unknown-emscripten/node-wrapper.sh | 4 + src/vendor/libc/ci/emscripten-entry.sh | 2 +- src/vendor/libc/ci/linux-s390x.sh | 18 + src/vendor/libc/ci/linux-sparc64.sh | 17 + src/vendor/libc/ci/run.sh | 6 +- src/vendor/libc/ci/test-runner-linux | 23 + src/vendor/libc/src/fuchsia/aarch64.rs | 336 + src/vendor/libc/src/fuchsia/mod.rs | 3920 ++++++++ src/vendor/libc/src/fuchsia/powerpc64.rs | 79 + src/vendor/libc/src/fuchsia/x86_64.rs | 447 + src/vendor/libc/src/lib.rs | 332 +- src/vendor/libc/src/unix/bsd/apple/mod.rs | 89 +- .../src/unix/bsd/freebsdlike/dragonfly/mod.rs | 30 + .../src/unix/bsd/freebsdlike/freebsd/mod.rs | 36 + .../libc/src/unix/bsd/freebsdlike/mod.rs | 5 - .../libc/src/unix/bsd/netbsdlike/mod.rs | 2 - .../src/unix/bsd/netbsdlike/netbsd/mod.rs | 18 + .../unix/bsd/netbsdlike/openbsdlike/mod.rs | 20 + src/vendor/libc/src/unix/haiku/mod.rs | 14 + .../libc/src/unix/newlib/aarch64/mod.rs | 5 + src/vendor/libc/src/unix/newlib/mod.rs | 23 + .../libc/src/unix/notbsd/android/mod.rs | 7 + .../libc/src/unix/notbsd/linux/mips/mod.rs | 1 + src/vendor/libc/src/unix/notbsd/linux/mod.rs | 89 +- .../libc/src/unix/notbsd/linux/musl/mod.rs | 1 + .../src/unix/notbsd/linux/other/b32/mod.rs | 1 + .../unix/notbsd/linux/other/b64/aarch64.rs | 1 + .../unix/notbsd/linux/other/b64/powerpc64.rs | 1 + .../unix/notbsd/linux/other/b64/sparc64.rs | 344 +- .../src/unix/notbsd/linux/other/b64/x86_64.rs | 1 + .../libc/src/unix/notbsd/linux/s390x.rs | 35 +- src/vendor/libc/src/unix/solaris/mod.rs | 72 +- src/vendor/libc/src/unix/uclibc/mod.rs | 33 +- src/vendor/log-0.3.9/.cargo-checksum.json | 1 + src/vendor/log-0.3.9/.cargo-ok | 0 src/vendor/log-0.3.9/.gitignore | 2 + src/vendor/log-0.3.9/.travis.yml | 30 + src/vendor/log-0.3.9/Cargo.toml | 45 + src/vendor/log-0.3.9/Cargo.toml.orig | 39 + src/vendor/log-0.3.9/LICENSE-APACHE | 201 + src/vendor/log-0.3.9/LICENSE-MIT | 25 + src/vendor/log-0.3.9/README.md | 160 + src/vendor/log-0.3.9/appveyor.yml | 18 + src/vendor/log-0.3.9/src/lib.rs | 1091 +++ src/vendor/log-0.3.9/src/macros.rs | 155 + src/vendor/log/.cargo-checksum.json | 2 +- src/vendor/log/.travis.yml | 19 +- src/vendor/log/CHANGELOG.md | 83 + src/vendor/log/Cargo.toml | 34 +- src/vendor/log/Cargo.toml.orig | 17 +- src/vendor/log/README.md | 141 +- src/vendor/log/appveyor.yml | 3 +- src/vendor/log/src/lib.rs | 1501 +-- src/vendor/log/src/macros.rs | 103 +- src/vendor/log/src/serde.rs | 258 + src/vendor/log/tests/filters.rs | 78 +- src/vendor/log_settings/.cargo-checksum.json | 1 + src/vendor/log_settings/.cargo-ok | 0 src/vendor/log_settings/.gitignore | 2 + src/vendor/log_settings/Cargo.toml | 11 + src/vendor/log_settings/src/lib.rs | 70 + src/vendor/log_settings/tests/smoke.rs | 20 + src/vendor/markup5ever/.cargo-checksum.json | 2 +- src/vendor/markup5ever/Cargo.toml | 22 +- src/vendor/markup5ever/Cargo.toml.orig | 6 +- .../markup5ever/interface/tree_builder.rs | 13 +- src/vendor/markup5ever/rcdom.rs | 28 +- src/vendor/markup5ever/serialize.rs | 4 +- .../.cargo-checksum.json | 2 +- src/vendor/memchr/.cargo-ok | 0 .../{memchr-1.0.2 => memchr}/.gitignore | 0 .../{memchr-1.0.2 => memchr}/.travis.yml | 0 src/vendor/memchr/COPYING | 3 + .../{memchr-1.0.2 => memchr}/Cargo.toml | 5 +- .../{memchr-1.0.2 => memchr}/Cargo.toml.orig | 4 +- src/vendor/memchr/LICENSE-MIT | 21 + src/vendor/{memchr-1.0.2 => memchr}/Makefile | 0 src/vendor/{memchr-1.0.2 => memchr}/README.md | 0 src/vendor/memchr/UNLICENSE | 24 + .../{memchr-1.0.2 => memchr}/appveyor.yml | 0 .../{memchr-1.0.2 => memchr}/benches/bench.rs | 0 .../{memchr-1.0.2 => memchr}/ctags.rust | 0 .../{memchr-1.0.2 => memchr}/session.vim | 0 .../{memchr-1.0.2 => memchr}/src/lib.rs | 339 +- src/vendor/num-traits/.cargo-checksum.json | 2 +- src/vendor/num-traits/Cargo.toml | 20 +- src/vendor/num-traits/Cargo.toml.orig | 13 + src/vendor/num-traits/src/bounds.rs | 18 +- src/vendor/num-traits/src/cast.rs | 42 +- src/vendor/num-traits/src/identities.rs | 22 +- src/vendor/num-traits/src/lib.rs | 22 +- src/vendor/parking_lot/.cargo-checksum.json | 1 + src/vendor/parking_lot/.cargo-ok | 0 src/vendor/parking_lot/.gitignore | 2 + src/vendor/parking_lot/.travis.yml | 40 + src/vendor/parking_lot/Cargo.toml | 35 + src/vendor/parking_lot/Cargo.toml.orig | 25 + src/vendor/parking_lot/LICENSE-APACHE | 201 + src/vendor/parking_lot/LICENSE-MIT | 25 + src/vendor/parking_lot/README.md | 132 + src/vendor/parking_lot/appveyor.yml | 29 + src/vendor/parking_lot/src/condvar.rs | 513 + src/vendor/parking_lot/src/deadlock.rs | 219 + src/vendor/parking_lot/src/elision.rs | 133 + src/vendor/parking_lot/src/lib.rs | 75 + src/vendor/parking_lot/src/mutex.rs | 535 ++ src/vendor/parking_lot/src/once.rs | 470 + src/vendor/parking_lot/src/raw_mutex.rs | 274 + src/vendor/parking_lot/src/raw_remutex.rs | 102 + src/vendor/parking_lot/src/raw_rwlock.rs | 1185 +++ src/vendor/parking_lot/src/remutex.rs | 338 + src/vendor/parking_lot/src/rwlock.rs | 1444 +++ src/vendor/parking_lot/src/stable.rs | 87 + src/vendor/parking_lot/src/util.rs | 32 + .../parking_lot_core/.cargo-checksum.json | 1 + src/vendor/parking_lot_core/.cargo-ok | 0 src/vendor/parking_lot_core/Cargo.toml | 49 + src/vendor/parking_lot_core/Cargo.toml.orig | 27 + src/vendor/parking_lot_core/src/lib.rs | 88 + .../parking_lot_core/src/parking_lot.rs | 1392 +++ src/vendor/parking_lot_core/src/spinwait.rs | 149 + src/vendor/parking_lot_core/src/stable.rs | 87 + .../src/thread_parker/generic.rs | 98 + .../src/thread_parker/linux.rs | 116 + .../src/thread_parker/unix.rs | 227 + .../src/thread_parker/windows/keyed_event.rs | 199 + .../src/thread_parker/windows/mod.rs | 139 + .../src/thread_parker/windows/waitaddress.rs | 138 + src/vendor/parking_lot_core/src/util.rs | 32 + src/vendor/parking_lot_core/src/word_lock.rs | 281 + src/vendor/rand/.cargo-checksum.json | 2 +- src/vendor/rand/.travis.yml | 15 +- src/vendor/rand/Cargo.toml | 8 +- src/vendor/rand/Cargo.toml.orig | 8 +- src/vendor/rand/src/lib.rs | 4 +- src/vendor/rand/src/os.rs | 4 +- src/vendor/redox_syscall/.cargo-checksum.json | 2 +- src/vendor/redox_syscall/Cargo.toml | 2 +- src/vendor/redox_syscall/Cargo.toml.orig | 2 +- src/vendor/redox_syscall/src/call.rs | 14 +- src/vendor/redox_syscall/src/number.rs | 2 + src/vendor/redox_syscall/src/scheme.rs | 24 + src/vendor/regex/.cargo-checksum.json | 2 +- src/vendor/regex/Cargo.toml | 176 +- src/vendor/regex/Cargo.toml.orig | 98 + src/vendor/regex/HACKING.md | 22 + src/vendor/regex/README.md | 11 +- src/vendor/regex/examples/bug347.rs | 9 - .../examples/shootout-regex-dna-bytes.rs | 2 +- .../examples/shootout-regex-dna-single.rs | 2 +- .../regex/examples/shootout-regex-dna.rs | 2 +- .../regex/examples/shootout-regex-redux-1.rs | 86 - .../examples/shootout-regex-redux-chunked.rs | 82 - .../regex/examples/shootout-regex-redux.rs | 103 - src/vendor/regex/src/backtrack.rs | 8 +- src/vendor/regex/src/compile.rs | 59 +- src/vendor/regex/src/dfa.rs | 75 +- src/vendor/regex/src/error.rs | 2 +- src/vendor/regex/src/exec.rs | 44 +- src/vendor/regex/src/expand.rs | 6 +- src/vendor/regex/src/input.rs | 20 +- src/vendor/regex/src/lib.rs | 25 +- src/vendor/regex/src/literals.rs | 8 +- src/vendor/regex/src/pikevm.rs | 4 +- src/vendor/regex/src/prog.rs | 7 +- src/vendor/regex/src/re_builder.rs | 26 +- src/vendor/regex/src/re_bytes.rs | 19 +- src/vendor/regex/src/re_trait.rs | 20 +- src/vendor/regex/src/re_unicode.rs | 35 +- src/vendor/regex/src/utf8.rs | 4 +- src/vendor/regex/tests/api_str.rs | 9 + src/vendor/regex/tests/bytes.rs | 2 +- src/vendor/regex/tests/crazy.rs | 14 + src/vendor/regex/tests/macros.rs | 2 +- src/vendor/regex/tests/macros_bytes.rs | 3 - src/vendor/regex/tests/macros_str.rs | 5 - src/vendor/regex/tests/replace.rs | 3 + src/vendor/regex/tests/test_default_bytes.rs | 2 +- src/vendor/rls-data/.cargo-checksum.json | 2 +- src/vendor/rls-data/Cargo.toml | 18 +- src/vendor/rls-data/Cargo.toml.orig | 2 +- src/vendor/rls-data/src/config.rs | 2 + src/vendor/rls-data/src/lib.rs | 1 + src/vendor/serde/.cargo-checksum.json | 2 +- src/vendor/serde/Cargo.toml | 2 +- src/vendor/serde/Cargo.toml.orig | 2 +- src/vendor/serde/src/de/ignored_any.rs | 2 +- src/vendor/serde/src/de/impls.rs | 379 +- src/vendor/serde/src/de/mod.rs | 33 +- src/vendor/serde/src/de/value.rs | 48 +- src/vendor/serde/src/export.rs | 2 +- src/vendor/serde/src/lib.rs | 32 +- src/vendor/serde/src/private/de.rs | 258 +- src/vendor/serde/src/private/ser.rs | 179 +- src/vendor/serde/src/ser/impls.rs | 28 +- src/vendor/serde/src/ser/impossible.rs | 4 +- src/vendor/serde/src/ser/mod.rs | 4 +- src/vendor/serde_derive/.cargo-checksum.json | 2 +- src/vendor/serde_derive/Cargo.toml | 8 +- src/vendor/serde_derive/Cargo.toml.orig | 8 +- src/vendor/serde_derive/src/bound.rs | 118 +- src/vendor/serde_derive/src/de.rs | 1169 ++- src/vendor/serde_derive/src/fragment.rs | 11 +- src/vendor/serde_derive/src/lib.rs | 6 +- src/vendor/serde_derive/src/ser.rs | 422 +- .../.cargo-checksum.json | 2 +- src/vendor/serde_derive_internals/Cargo.toml | 2 +- .../serde_derive_internals/Cargo.toml.orig | 2 +- src/vendor/serde_derive_internals/src/ast.rs | 100 +- src/vendor/serde_derive_internals/src/attr.rs | 249 +- src/vendor/serde_derive_internals/src/case.rs | 69 +- .../serde_derive_internals/src/check.rs | 61 +- src/vendor/serde_derive_internals/src/ctxt.rs | 4 +- src/vendor/serde_derive_internals/src/lib.rs | 2 +- src/vendor/serde_json/.cargo-checksum.json | 2 +- src/vendor/serde_json/Cargo.toml | 2 +- src/vendor/serde_json/Cargo.toml.orig | 2 +- src/vendor/serde_json/src/de.rs | 753 +- src/vendor/serde_json/src/error.rs | 6 +- src/vendor/serde_json/src/lib.rs | 15 +- src/vendor/serde_json/src/number.rs | 3 - .../smallvec-0.3.3/.cargo-checksum.json | 1 + src/vendor/smallvec-0.3.3/.cargo-ok | 0 src/vendor/smallvec-0.3.3/.gitignore | 2 + src/vendor/smallvec-0.3.3/.travis.yml | 13 + src/vendor/smallvec-0.3.3/Cargo.toml | 20 + src/vendor/smallvec-0.3.3/README.md | 6 + src/vendor/smallvec-0.3.3/benches/bench.rs | 111 + src/vendor/smallvec-0.3.3/lib.rs | 1424 +++ src/vendor/smallvec/.cargo-checksum.json | 2 +- src/vendor/smallvec/.travis.yml | 5 +- src/vendor/smallvec/Cargo.toml | 36 +- src/vendor/smallvec/Cargo.toml.orig | 25 + src/vendor/smallvec/LICENSE | 374 + src/vendor/smallvec/README.md | 4 +- src/vendor/smallvec/lib.rs | 552 +- src/vendor/tar/.cargo-checksum.json | 2 +- src/vendor/tar/Cargo.toml | 51 +- src/vendor/tar/Cargo.toml.orig | 34 + src/vendor/tar/README.md | 17 +- src/vendor/tar/src/builder.rs | 54 +- src/vendor/tar/src/entry.rs | 25 +- src/vendor/tar/src/header.rs | 309 +- src/vendor/tar/src/lib.rs | 3 + src/vendor/tar/tests/all.rs | 39 +- src/vendor/tar/tests/entry.rs | 66 +- src/vendor/tar/tests/header/mod.rs | 32 +- src/vendor/tendril/.cargo-checksum.json | 2 +- src/vendor/tendril/.travis.yml | 2 +- src/vendor/tendril/Cargo.toml | 16 +- src/vendor/tendril/Cargo.toml.orig | 4 +- src/vendor/tendril/examples/fuzz.rs | 15 +- src/vendor/tendril/src/buf32.rs | 1 - src/vendor/tendril/src/lib.rs | 6 +- src/vendor/tendril/src/tendril.rs | 15 +- src/vendor/thread_local/.cargo-checksum.json | 2 +- src/vendor/thread_local/Cargo.toml | 10 +- src/vendor/thread_local/Cargo.toml.orig | 7 +- src/vendor/time/.cargo-checksum.json | 1 + src/vendor/time/.cargo-ok | 0 src/vendor/time/.gitignore | 2 + src/vendor/time/.travis.yml | 31 + src/vendor/time/Cargo.toml | 43 + src/vendor/time/Cargo.toml.orig | 30 + src/vendor/time/LICENSE-APACHE | 201 + src/vendor/time/LICENSE-MIT | 25 + src/vendor/time/README.md | 30 + src/vendor/time/appveyor.yml | 17 + src/vendor/time/benches/precise_time_ns.rs | 11 + src/vendor/time/src/display.rs | 260 + src/vendor/time/src/duration.rs | 648 ++ src/vendor/time/src/lib.rs | 1275 +++ src/vendor/time/src/parse.rs | 394 + src/vendor/time/src/sys.rs | 891 ++ src/vendor/winapi-0.2.8/.cargo-checksum.json | 1 + src/vendor/winapi-0.2.8/.cargo-ok | 0 src/vendor/winapi-0.2.8/Cargo.toml | 61 + .../{winapi => winapi-0.2.8}/LICENSE.md | 0 .../src/activation.rs | 0 .../src/audioclient.rs | 0 .../src/audiosessiontypes.rs | 0 .../{winapi => winapi-0.2.8}/src/basetsd.rs | 0 .../{winapi => winapi-0.2.8}/src/bcrypt.rs | 0 .../{winapi => winapi-0.2.8}/src/cfg.rs | 0 .../{winapi => winapi-0.2.8}/src/cfgmgr32.rs | 0 .../src/combaseapi.rs | 0 .../{winapi => winapi-0.2.8}/src/commctrl.rs | 0 .../{winapi => winapi-0.2.8}/src/commdlg.rs | 0 .../{winapi => winapi-0.2.8}/src/corsym.rs | 0 .../{winapi => winapi-0.2.8}/src/d2d1.rs | 0 .../src/d2dbasetypes.rs | 0 .../src/d3d10shader.rs | 0 .../{winapi => winapi-0.2.8}/src/d3d11.rs | 0 .../src/d3d11shader.rs | 0 .../{winapi => winapi-0.2.8}/src/d3d12.rs | 0 .../src/d3d12sdklayers.rs | 0 .../src/d3d12shader.rs | 0 .../{winapi => winapi-0.2.8}/src/d3d9.rs | 0 .../{winapi => winapi-0.2.8}/src/d3d9caps.rs | 0 .../{winapi => winapi-0.2.8}/src/d3d9types.rs | 0 .../{winapi => winapi-0.2.8}/src/d3dcommon.rs | 0 .../src/d3dcompiler.rs | 0 .../{winapi => winapi-0.2.8}/src/dbghelp.rs | 0 .../{winapi => winapi-0.2.8}/src/dcommon.rs | 0 .../src/devpropdef.rs | 0 .../{winapi => winapi-0.2.8}/src/docobj.rs | 0 .../{winapi => winapi-0.2.8}/src/dpapi.rs | 0 .../{winapi => winapi-0.2.8}/src/dsgetdc.rs | 0 .../{winapi => winapi-0.2.8}/src/dsound.rs | 0 .../{winapi => winapi-0.2.8}/src/dsrole.rs | 0 .../{winapi => winapi-0.2.8}/src/dwmapi.rs | 0 .../{winapi => winapi-0.2.8}/src/dwrite.rs | 0 .../{winapi => winapi-0.2.8}/src/dxgi.rs | 0 .../{winapi => winapi-0.2.8}/src/dxgi1_2.rs | 0 .../{winapi => winapi-0.2.8}/src/dxgi1_3.rs | 0 .../{winapi => winapi-0.2.8}/src/dxgi1_4.rs | 0 .../src/dxgiformat.rs | 0 .../{winapi => winapi-0.2.8}/src/dxgitype.rs | 0 .../src/errhandlingapi.rs | 0 .../{winapi => winapi-0.2.8}/src/excpt.rs | 0 .../{winapi => winapi-0.2.8}/src/fileapi.rs | 0 src/vendor/{winapi => winapi-0.2.8}/src/gl.rs | 0 .../{winapi => winapi-0.2.8}/src/guiddef.rs | 0 .../{winapi => winapi-0.2.8}/src/heapapi.rs | 0 .../{winapi => winapi-0.2.8}/src/hidclass.rs | 0 .../{winapi => winapi-0.2.8}/src/hidpi.rs | 0 .../{winapi => winapi-0.2.8}/src/hidsdi.rs | 0 .../{winapi => winapi-0.2.8}/src/hidusage.rs | 0 .../{winapi => winapi-0.2.8}/src/hstring.rs | 0 .../{winapi => winapi-0.2.8}/src/http.rs | 0 .../{winapi => winapi-0.2.8}/src/imm.rs | 0 .../{winapi => winapi-0.2.8}/src/inaddr.rs | 0 .../src/inspectable.rs | 0 .../{winapi => winapi-0.2.8}/src/ksmedia.rs | 0 src/vendor/winapi-0.2.8/src/lib.rs | 368 + .../src/libloaderapi.rs | 0 .../{winapi => winapi-0.2.8}/src/lmaccess.rs | 0 .../{winapi => winapi-0.2.8}/src/lmcons.rs | 0 .../{winapi => winapi-0.2.8}/src/lmdfs.rs | 0 .../{winapi => winapi-0.2.8}/src/lmerrlog.rs | 0 .../{winapi => winapi-0.2.8}/src/lmjoin.rs | 0 .../{winapi => winapi-0.2.8}/src/lsalookup.rs | 0 src/vendor/winapi-0.2.8/src/macros.rs | 270 + .../{winapi => winapi-0.2.8}/src/memoryapi.rs | 0 .../src/minschannel.rs | 0 .../src/minwinbase.rs | 0 .../{winapi => winapi-0.2.8}/src/minwindef.rs | 0 .../src/mmdeviceapi.rs | 0 .../{winapi => winapi-0.2.8}/src/mmreg.rs | 0 .../{winapi => winapi-0.2.8}/src/mmsystem.rs | 0 .../{winapi => winapi-0.2.8}/src/mscat.rs | 0 .../{winapi => winapi-0.2.8}/src/mssip.rs | 0 .../{winapi => winapi-0.2.8}/src/nb30.rs | 0 .../{winapi => winapi-0.2.8}/src/ncrypt.rs | 0 .../{winapi => winapi-0.2.8}/src/ntdef.rs | 0 .../{winapi => winapi-0.2.8}/src/ntsecapi.rs | 0 .../{winapi => winapi-0.2.8}/src/ntstatus.rs | 0 .../{winapi => winapi-0.2.8}/src/oaidl.rs | 0 .../{winapi => winapi-0.2.8}/src/objbase.rs | 0 .../{winapi => winapi-0.2.8}/src/objidl.rs | 0 .../src/objidlbase.rs | 0 .../{winapi => winapi-0.2.8}/src/olectl.rs | 0 .../{winapi => winapi-0.2.8}/src/pdh.rs | 0 .../src/playsoundapi.rs | 0 .../src/processsnapshot.rs | 0 .../src/processthreadsapi.rs | 0 .../{winapi => winapi-0.2.8}/src/propidl.rs | 0 .../{winapi => winapi-0.2.8}/src/propsys.rs | 0 .../{winapi => winapi-0.2.8}/src/prsht.rs | 0 .../{winapi => winapi-0.2.8}/src/psapi.rs | 0 .../{winapi => winapi-0.2.8}/src/qos.rs | 0 .../{winapi => winapi-0.2.8}/src/reason.rs | 0 .../src/restrictederrorinfo.rs | 0 .../{winapi => winapi-0.2.8}/src/roapi.rs | 0 .../src/roerrorapi.rs | 0 .../{winapi => winapi-0.2.8}/src/rpc.rs | 0 .../{winapi => winapi-0.2.8}/src/rpcdce.rs | 0 .../{winapi => winapi-0.2.8}/src/sapi.rs | 0 .../{winapi => winapi-0.2.8}/src/schannel.rs | 0 .../{winapi => winapi-0.2.8}/src/servprov.rs | 0 .../{winapi => winapi-0.2.8}/src/setupapi.rs | 0 .../{winapi => winapi-0.2.8}/src/shellapi.rs | 0 .../src/shellscalingapi.rs | 0 .../{winapi => winapi-0.2.8}/src/shlguid.rs | 0 .../{winapi => winapi-0.2.8}/src/shlobj.rs | 0 .../{winapi => winapi-0.2.8}/src/shobjidl.rs | 0 .../{winapi => winapi-0.2.8}/src/shtypes.rs | 0 .../{winapi => winapi-0.2.8}/src/spapidef.rs | 0 .../{winapi => winapi-0.2.8}/src/sql.rs | 0 .../{winapi => winapi-0.2.8}/src/sqltypes.rs | 0 .../{winapi => winapi-0.2.8}/src/sspi.rs | 0 .../{winapi => winapi-0.2.8}/src/strmif.rs | 0 .../{winapi => winapi-0.2.8}/src/subauth.rs | 0 .../{winapi => winapi-0.2.8}/src/synchapi.rs | 0 .../src/sysinfoapi.rs | 0 .../src/threadpoolapi.rs | 0 .../src/timezoneapi.rs | 0 .../{winapi => winapi-0.2.8}/src/tlhelp32.rs | 0 .../src/unknwnbase.rs | 0 .../{winapi => winapi-0.2.8}/src/urlhist.rs | 0 .../{winapi => winapi-0.2.8}/src/urlmon.rs | 0 .../{winapi => winapi-0.2.8}/src/usb.rs | 0 .../{winapi => winapi-0.2.8}/src/usbspec.rs | 0 .../{winapi => winapi-0.2.8}/src/usp10.rs | 0 .../{winapi => winapi-0.2.8}/src/vadefs.rs | 0 .../{winapi => winapi-0.2.8}/src/vsbackup.rs | 0 .../{winapi => winapi-0.2.8}/src/vss.rs | 0 .../{winapi => winapi-0.2.8}/src/vsserror.rs | 0 .../{winapi => winapi-0.2.8}/src/vswriter.rs | 0 .../{winapi => winapi-0.2.8}/src/werapi.rs | 0 .../{winapi => winapi-0.2.8}/src/winbase.rs | 0 .../{winapi => winapi-0.2.8}/src/wincon.rs | 0 .../{winapi => winapi-0.2.8}/src/wincred.rs | 0 .../{winapi => winapi-0.2.8}/src/wincrypt.rs | 0 .../{winapi => winapi-0.2.8}/src/windef.rs | 0 .../src/windowscodecs.rs | 0 .../{winapi => winapi-0.2.8}/src/windowsx.rs | 0 .../{winapi => winapi-0.2.8}/src/winerror.rs | 0 .../{winapi => winapi-0.2.8}/src/winevt.rs | 0 .../{winapi => winapi-0.2.8}/src/wingdi.rs | 0 .../{winapi => winapi-0.2.8}/src/winhttp.rs | 0 .../{winapi => winapi-0.2.8}/src/winioctl.rs | 0 .../{winapi => winapi-0.2.8}/src/winnetwk.rs | 0 .../{winapi => winapi-0.2.8}/src/winnls.rs | 0 .../{winapi => winapi-0.2.8}/src/winnt.rs | 0 .../{winapi => winapi-0.2.8}/src/winreg.rs | 0 .../{winapi => winapi-0.2.8}/src/winscard.rs | 0 .../{winapi => winapi-0.2.8}/src/winsmcrd.rs | 0 .../{winapi => winapi-0.2.8}/src/winsock2.rs | 0 .../{winapi => winapi-0.2.8}/src/winspool.rs | 0 .../{winapi => winapi-0.2.8}/src/winstring.rs | 0 .../{winapi => winapi-0.2.8}/src/winsvc.rs | 0 .../{winapi => winapi-0.2.8}/src/winusb.rs | 0 .../{winapi => winapi-0.2.8}/src/winusbio.rs | 0 .../{winapi => winapi-0.2.8}/src/winuser.rs | 0 .../{winapi => winapi-0.2.8}/src/ws2def.rs | 0 .../{winapi => winapi-0.2.8}/src/ws2ipdef.rs | 0 .../{winapi => winapi-0.2.8}/src/ws2spi.rs | 0 .../{winapi => winapi-0.2.8}/src/ws2tcpip.rs | 0 .../{winapi => winapi-0.2.8}/src/wtypes.rs | 0 .../src/wtypesbase.rs | 0 .../{winapi => winapi-0.2.8}/src/xinput.rs | 0 .../.cargo-checksum.json | 1 + .../winapi-i686-pc-windows-gnu/.cargo-ok | 0 .../winapi-i686-pc-windows-gnu/Cargo.toml | 22 + .../Cargo.toml.orig | 10 + .../winapi-i686-pc-windows-gnu/build.rs | 18 + .../winapi-i686-pc-windows-gnu/src/lib.rs | 7 + .../.cargo-checksum.json | 1 + .../winapi-x86_64-pc-windows-gnu/.cargo-ok | 0 .../winapi-x86_64-pc-windows-gnu/Cargo.toml | 22 + .../Cargo.toml.orig | 10 + .../winapi-x86_64-pc-windows-gnu/build.rs | 18 + .../winapi-x86_64-pc-windows-gnu/src/lib.rs | 7 + src/vendor/winapi/.cargo-checksum.json | 2 +- src/vendor/winapi/Cargo.toml | 383 +- src/vendor/winapi/Cargo.toml.orig | 327 + src/vendor/winapi/LICENSE-APACHE | 201 + src/vendor/winapi/LICENSE-MIT | 19 + src/vendor/winapi/README.md | 65 + src/vendor/winapi/build.rs | 412 + src/vendor/winapi/src/lib.rs | 423 +- src/vendor/winapi/src/macros.rs | 410 +- src/vendor/winapi/src/shared/basetsd.rs | 71 + src/vendor/winapi/src/shared/bcrypt.rs | 1002 ++ src/vendor/winapi/src/shared/bugcodes.rs | 457 + src/vendor/winapi/src/shared/cderr.rs | 45 + src/vendor/winapi/src/shared/cfg.rs | 139 + src/vendor/winapi/src/shared/d3d9.rs | 1279 +++ src/vendor/winapi/src/shared/d3d9caps.rs | 367 + src/vendor/winapi/src/shared/d3d9types.rs | 1459 +++ src/vendor/winapi/src/shared/dcomptypes.rs | 51 + src/vendor/winapi/src/shared/devguid.rs | 179 + src/vendor/winapi/src/shared/devpkey.rs | 402 + src/vendor/winapi/src/shared/devpropdef.rs | 84 + src/vendor/winapi/src/shared/dinputd.rs | 22 + src/vendor/winapi/src/shared/dxgi.rs | 404 + src/vendor/winapi/src/shared/dxgi1_2.rs | 356 + src/vendor/winapi/src/shared/dxgi1_3.rs | 191 + src/vendor/winapi/src/shared/dxgi1_4.rs | 113 + src/vendor/winapi/src/shared/dxgi1_5.rs | 93 + src/vendor/winapi/src/shared/dxgiformat.rs | 128 + src/vendor/winapi/src/shared/dxgitype.rs | 110 + src/vendor/winapi/src/shared/guiddef.rs | 37 + src/vendor/winapi/src/shared/hidclass.rs | 69 + src/vendor/winapi/src/shared/hidpi.rs | 394 + src/vendor/winapi/src/shared/hidsdi.rs | 111 + src/vendor/winapi/src/shared/hidusage.rs | 275 + src/vendor/winapi/src/shared/in6addr.rs | 18 + src/vendor/winapi/src/shared/inaddr.rs | 30 + src/vendor/winapi/src/shared/intsafe.rs | 6 + src/vendor/winapi/src/shared/ksmedia.rs | 23 + src/vendor/winapi/src/shared/ktmtypes.rs | 139 + src/vendor/winapi/src/shared/lmcons.rs | 61 + src/vendor/winapi/src/shared/minwindef.rs | 103 + src/vendor/winapi/src/shared/mmreg.rs | 310 + src/vendor/winapi/src/shared/mod.rs | 63 + src/vendor/winapi/src/shared/mstcpip.rs | 496 + src/vendor/winapi/src/shared/ntddscsi.rs | 823 ++ src/vendor/winapi/src/shared/ntddser.rs | 18 + src/vendor/winapi/src/shared/ntdef.rs | 1074 +++ src/vendor/winapi/src/shared/ntstatus.rs | 2575 +++++ src/vendor/winapi/src/shared/qos.rs | 21 + src/vendor/winapi/src/shared/rpc.rs | 12 + src/vendor/winapi/src/shared/rpcdce.rs | 566 ++ src/vendor/winapi/src/shared/rpcndr.rs | 26 + src/vendor/winapi/src/shared/sspi.rs | 1076 +++ src/vendor/winapi/src/shared/stralign.rs | 41 + src/vendor/winapi/src/shared/usb.rs | 524 ++ src/vendor/winapi/src/shared/usbiodef.rs | 113 + src/vendor/winapi/src/shared/usbspec.rs | 861 ++ src/vendor/winapi/src/shared/windef.rs | 117 + src/vendor/winapi/src/shared/windowsx.rs | 18 + src/vendor/winapi/src/shared/winerror.rs | 6114 ++++++++++++ src/vendor/winapi/src/shared/winusbio.rs | 39 + src/vendor/winapi/src/shared/wnnc.rs | 80 + src/vendor/winapi/src/shared/ws2def.rs | 561 ++ src/vendor/winapi/src/shared/ws2ipdef.rs | 79 + src/vendor/winapi/src/shared/wtypes.rs | 100 + src/vendor/winapi/src/shared/wtypesbase.rs | 162 + src/vendor/winapi/src/um/audioclient.rs | 173 + src/vendor/winapi/src/um/audiosessiontypes.rs | 38 + src/vendor/winapi/src/um/avrt.rs | 83 + src/vendor/winapi/src/um/cfgmgr32.rs | 2043 ++++ src/vendor/winapi/src/um/cguid.rs | 135 + src/vendor/winapi/src/um/combaseapi.rs | 478 + src/vendor/winapi/src/um/coml2api.rs | 11 + src/vendor/winapi/src/um/commapi.rs | 88 + src/vendor/winapi/src/um/commctrl.rs | 4142 ++++++++ src/vendor/winapi/src/um/commdlg.rs | 715 ++ src/vendor/winapi/src/um/commoncontrols.rs | 233 + src/vendor/winapi/src/um/consoleapi.rs | 77 + src/vendor/winapi/src/um/corsym.rs | 92 + src/vendor/winapi/src/um/d2d1.rs | 984 ++ src/vendor/winapi/src/um/d2d1_1.rs | 848 ++ src/vendor/winapi/src/um/d2d1_2.rs | 68 + src/vendor/winapi/src/um/d2d1effectauthor.rs | 27 + src/vendor/winapi/src/um/d2d1effects.rs | 618 ++ src/vendor/winapi/src/um/d2d1effects_1.rs | 32 + src/vendor/winapi/src/um/d2d1effects_2.rs | 41 + src/vendor/winapi/src/um/d2dbasetypes.rs | 69 + src/vendor/winapi/src/um/d3d.rs | 62 + src/vendor/winapi/src/um/d3d10.rs | 58 + src/vendor/winapi/src/um/d3d10_1.rs | 12 + src/vendor/winapi/src/um/d3d10_1shader.rs | 8 + src/vendor/winapi/src/um/d3d10effect.rs | 46 + src/vendor/winapi/src/um/d3d10misc.rs | 8 + src/vendor/winapi/src/um/d3d10sdklayers.rs | 14 + src/vendor/winapi/src/um/d3d10shader.rs | 207 + src/vendor/winapi/src/um/d3d11.rs | 3418 +++++++ src/vendor/winapi/src/um/d3d11_1.rs | 24 + src/vendor/winapi/src/um/d3d11_2.rs | 10 + src/vendor/winapi/src/um/d3d11_3.rs | 24 + src/vendor/winapi/src/um/d3d11_4.rs | 8 + src/vendor/winapi/src/um/d3d11on12.rs | 68 + src/vendor/winapi/src/um/d3d11sdklayers.rs | 20 + src/vendor/winapi/src/um/d3d11shader.rs | 478 + src/vendor/winapi/src/um/d3d12.rs | 2721 ++++++ src/vendor/winapi/src/um/d3d12sdklayers.rs | 1364 +++ src/vendor/winapi/src/um/d3d12shader.rs | 348 + src/vendor/winapi/src/um/d3dcommon.rs | 746 ++ src/vendor/winapi/src/um/d3dcompiler.rs | 275 + src/vendor/winapi/src/um/d3dcsx.rs | 12 + src/vendor/winapi/src/um/d3dx10core.rs | 12 + src/vendor/winapi/src/um/d3dx10math.rs | 8 + src/vendor/winapi/src/um/d3dx10mesh.rs | 20 + src/vendor/winapi/src/um/datetimeapi.rs | 61 + src/vendor/winapi/src/um/davclnt.rs | 105 + src/vendor/winapi/src/um/dbghelp.rs | 633 ++ src/vendor/winapi/src/um/dcommon.rs | 23 + src/vendor/winapi/src/um/dcomp.rs | 1165 +++ src/vendor/winapi/src/um/dcompanimation.rs | 39 + src/vendor/winapi/src/um/dde.rs | 21 + src/vendor/winapi/src/um/ddraw.rs | 38 + src/vendor/winapi/src/um/ddrawi.rs | 14 + src/vendor/winapi/src/um/ddrawint.rs | 42 + src/vendor/winapi/src/um/debugapi.rs | 42 + src/vendor/winapi/src/um/dinput.rs | 108 + src/vendor/winapi/src/um/dmksctl.rs | 12 + src/vendor/winapi/src/um/dmusicc.rs | 72 + src/vendor/winapi/src/um/docobj.rs | 38 + src/vendor/winapi/src/um/documenttarget.rs | 25 + src/vendor/winapi/src/um/dpa_dsa.rs | 284 + src/vendor/winapi/src/um/dpapi.rs | 101 + src/vendor/winapi/src/um/dsgetdc.rs | 268 + src/vendor/winapi/src/um/dsound.rs | 345 + src/vendor/winapi/src/um/dsrole.rs | 67 + src/vendor/winapi/src/um/dvp.rs | 26 + src/vendor/winapi/src/um/dwmapi.rs | 72 + src/vendor/winapi/src/um/dwrite.rs | 1478 +++ src/vendor/winapi/src/um/dwrite_1.rs | 747 ++ src/vendor/winapi/src/um/dwrite_2.rs | 294 + src/vendor/winapi/src/um/dwrite_3.rs | 465 + src/vendor/winapi/src/um/dxdiag.rs | 12 + src/vendor/winapi/src/um/dxfile.rs | 24 + src/vendor/winapi/src/um/dxgidebug.rs | 20 + src/vendor/winapi/src/um/errhandlingapi.rs | 76 + src/vendor/winapi/src/um/fibersapi.rs | 25 + src/vendor/winapi/src/um/fileapi.rs | 640 ++ src/vendor/winapi/src/um/gl/gl.rs | 53 + src/vendor/winapi/src/um/gl/mod.rs | 8 + src/vendor/winapi/src/um/handleapi.rs | 37 + src/vendor/winapi/src/um/heapapi.rs | 93 + src/vendor/winapi/src/um/http.rs | 1073 +++ src/vendor/winapi/src/um/imm.rs | 8 + src/vendor/winapi/src/um/interlockedapi.rs | 32 + src/vendor/winapi/src/um/ioapiset.rs | 72 + src/vendor/winapi/src/um/jobapi.rs | 16 + src/vendor/winapi/src/um/jobapi2.rs | 64 + src/vendor/winapi/src/um/knownfolders.rs | 288 + src/vendor/winapi/src/um/ktmw32.rs | 64 + src/vendor/winapi/src/um/libloaderapi.rs | 237 + src/vendor/winapi/src/um/lmaccess.rs | 1215 +++ src/vendor/winapi/src/um/lmalert.rs | 76 + src/vendor/winapi/src/um/lmapibuf.rs | 31 + src/vendor/winapi/src/um/lmat.rs | 63 + src/vendor/winapi/src/um/lmdfs.rs | 484 + src/vendor/winapi/src/um/lmerrlog.rs | 269 + src/vendor/winapi/src/um/lmjoin.rs | 233 + src/vendor/winapi/src/um/lmmsg.rs | 57 + src/vendor/winapi/src/um/lmremutl.rs | 62 + src/vendor/winapi/src/um/lmrepl.rs | 201 + src/vendor/winapi/src/um/lmserver.rs | 1256 +++ src/vendor/winapi/src/um/lmshare.rs | 380 + src/vendor/winapi/src/um/lmstats.rs | 86 + src/vendor/winapi/src/um/lmsvc.rs | 181 + src/vendor/winapi/src/um/lmuse.rs | 102 + src/vendor/winapi/src/um/lmwksta.rs | 422 + src/vendor/winapi/src/um/lsalookup.rs | 76 + src/vendor/winapi/src/um/memoryapi.rs | 391 + src/vendor/winapi/src/um/minschannel.rs | 59 + src/vendor/winapi/src/um/minwinbase.rs | 334 + src/vendor/winapi/src/um/mmdeviceapi.rs | 227 + src/vendor/winapi/src/um/mmeapi.rs | 337 + src/vendor/winapi/src/um/mmsystem.rs | 267 + src/vendor/winapi/src/um/mod.rs | 229 + src/vendor/winapi/src/um/msaatext.rs | 60 + src/vendor/winapi/src/um/mscat.rs | 37 + src/vendor/winapi/src/um/mssip.rs | 256 + src/vendor/winapi/src/um/namedpipeapi.rs | 91 + src/vendor/winapi/src/um/namespaceapi.rs | 37 + src/vendor/winapi/src/um/nb30.rs | 215 + src/vendor/winapi/src/um/ncrypt.rs | 18 + src/vendor/winapi/src/um/ntsecapi.rs | 1658 ++++ src/vendor/winapi/src/um/oaidl.rs | 787 ++ src/vendor/winapi/src/um/objbase.rs | 65 + src/vendor/winapi/src/um/objidl.rs | 282 + src/vendor/winapi/src/um/objidlbase.rs | 957 ++ src/vendor/winapi/src/um/ocidl.rs | 62 + src/vendor/winapi/src/um/oleauto.rs | 812 ++ src/vendor/winapi/src/um/olectl.rs | 15 + src/vendor/winapi/src/um/pdh.rs | 807 ++ src/vendor/winapi/src/um/playsoundapi.rs | 47 + src/vendor/winapi/src/um/powerbase.rs | 36 + src/vendor/winapi/src/um/powersetting.rs | 61 + src/vendor/winapi/src/um/powrprof.rs | 551 ++ src/vendor/winapi/src/um/processenv.rs | 99 + src/vendor/winapi/src/um/processsnapshot.rs | 121 + src/vendor/winapi/src/um/processthreadsapi.rs | 424 + .../winapi/src/um/processtopologyapi.rs | 25 + src/vendor/winapi/src/um/profileapi.rs | 17 + src/vendor/winapi/src/um/propidl.rs | 16 + src/vendor/winapi/src/um/propkeydef.rs | 14 + src/vendor/winapi/src/um/propsys.rs | 48 + src/vendor/winapi/src/um/prsht.rs | 362 + src/vendor/winapi/src/um/psapi.rs | 353 + src/vendor/winapi/src/um/realtimeapiset.rs | 31 + src/vendor/winapi/src/um/reason.rs | 63 + .../winapi/src/um/restrictederrorinfo.rs | 25 + src/vendor/winapi/src/um/rmxfguid.rs | 68 + src/vendor/winapi/src/um/sapi.rs | 1389 +++ src/vendor/winapi/src/um/sapi51.rs | 3728 ++++++++ src/vendor/winapi/src/um/sapi53.rs | 1824 ++++ src/vendor/winapi/src/um/sapiddk.rs | 239 + src/vendor/winapi/src/um/sapiddk51.rs | 648 ++ src/vendor/winapi/src/um/schannel.rs | 340 + .../winapi/src/um/securityappcontainer.rs | 17 + src/vendor/winapi/src/um/securitybaseapi.rs | 172 + src/vendor/winapi/src/um/servprov.rs | 24 + src/vendor/winapi/src/um/setupapi.rs | 3573 +++++++ src/vendor/winapi/src/um/shellapi.rs | 924 ++ src/vendor/winapi/src/um/shellscalingapi.rs | 45 + src/vendor/winapi/src/um/shlobj.rs | 261 + src/vendor/winapi/src/um/shobjidl.rs | 384 + src/vendor/winapi/src/um/shobjidl_core.rs | 73 + src/vendor/winapi/src/um/shtypes.rs | 47 + src/vendor/winapi/src/um/spapidef.rs | 54 + src/vendor/winapi/src/um/sporder.rs | 42 + src/vendor/winapi/src/um/sql.rs | 109 + src/vendor/winapi/src/um/sqlext.rs | 96 + src/vendor/winapi/src/um/sqltypes.rs | 143 + src/vendor/winapi/src/um/sqlucode.rs | 107 + src/vendor/winapi/src/um/sspi.rs | 8 + src/vendor/winapi/src/um/stringapiset.rs | 76 + src/vendor/winapi/src/um/strmif.rs | 8 + src/vendor/winapi/src/um/subauth.rs | 207 + src/vendor/winapi/src/um/synchapi.rs | 350 + src/vendor/winapi/src/um/sysinfoapi.rs | 218 + src/vendor/winapi/src/um/systemtopologyapi.rs | 22 + src/vendor/winapi/src/um/textstor.rs | 12 + src/vendor/winapi/src/um/threadpoolapiset.rs | 172 + .../winapi/src/um/threadpoollegacyapiset.rs | 45 + src/vendor/winapi/src/um/timeapi.rs | 21 + src/vendor/winapi/src/um/timezoneapi.rs | 90 + src/vendor/winapi/src/um/tlhelp32.rs | 195 + src/vendor/winapi/src/um/unknwnbase.rs | 44 + src/vendor/winapi/src/um/urlhist.rs | 102 + src/vendor/winapi/src/um/urlmon.rs | 22 + src/vendor/winapi/src/um/userenv.rs | 135 + src/vendor/winapi/src/um/usp10.rs | 563 ++ src/vendor/winapi/src/um/utilapiset.rs | 26 + src/vendor/winapi/src/um/vsbackup.rs | 539 ++ src/vendor/winapi/src/um/vss.rs | 291 + src/vendor/winapi/src/um/vsserror.rs | 90 + src/vendor/winapi/src/um/vswriter.rs | 414 + src/vendor/winapi/src/um/werapi.rs | 46 + src/vendor/winapi/src/um/winbase.rs | 2678 ++++++ src/vendor/winapi/src/um/wincodec.rs | 1865 ++++ src/vendor/winapi/src/um/wincodecsdk.rs | 565 ++ src/vendor/winapi/src/um/wincon.rs | 540 ++ src/vendor/winapi/src/um/wincred.rs | 424 + src/vendor/winapi/src/um/wincrypt.rs | 7365 +++++++++++++++ src/vendor/winapi/src/um/windowsceip.rs | 10 + src/vendor/winapi/src/um/winevt.rs | 544 ++ src/vendor/winapi/src/um/wingdi.rs | 5585 +++++++++++ src/vendor/winapi/src/um/winhttp.rs | 659 ++ src/vendor/winapi/src/um/wininet.rs | 2365 +++++ src/vendor/winapi/src/um/winineti.rs | 143 + src/vendor/winapi/src/um/winioctl.rs | 846 ++ src/vendor/winapi/src/um/winnetwk.rs | 447 + src/vendor/winapi/src/um/winnls.rs | 818 ++ src/vendor/winapi/src/um/winnt.rs | 8380 +++++++++++++++++ src/vendor/winapi/src/um/winreg.rs | 471 + src/vendor/winapi/src/um/winscard.rs | 710 ++ src/vendor/winapi/src/um/winsmcrd.rs | 167 + src/vendor/winapi/src/um/winsock2.rs | 1451 +++ src/vendor/winapi/src/um/winspool.rs | 2434 +++++ src/vendor/winapi/src/um/winsvc.rs | 367 + src/vendor/winapi/src/um/winusb.rs | 226 + src/vendor/winapi/src/um/winuser.rs | 6784 +++++++++++++ src/vendor/winapi/src/um/winver.rs | 54 + src/vendor/winapi/src/um/wow64apiset.rs | 28 + src/vendor/winapi/src/um/ws2spi.rs | 910 ++ src/vendor/winapi/src/um/ws2tcpip.rs | 347 + src/vendor/winapi/src/um/xinput.rs | 166 + src/vendor/winapi/src/vc/excpt.rs | 19 + src/vendor/winapi/src/vc/limits.rs | 8 + src/vendor/winapi/src/vc/mod.rs | 11 + src/vendor/winapi/src/vc/vadefs.rs | 9 + src/vendor/winapi/src/vc/vcruntime.rs | 10 + src/vendor/winapi/src/winrt/activation.rs | 14 + src/vendor/winapi/src/winrt/hstring.rs | 26 + src/vendor/winapi/src/winrt/inspectable.rs | 30 + src/vendor/winapi/src/winrt/mod.rs | 13 + src/vendor/winapi/src/winrt/roapi.rs | 61 + src/vendor/winapi/src/winrt/robuffer.rs | 13 + src/vendor/winapi/src/winrt/roerrorapi.rs | 104 + src/vendor/winapi/src/winrt/winstring.rs | 151 + version | 2 +- 4680 files changed, 267906 insertions(+), 65481 deletions(-) delete mode 100755 src/ci/docker/dist-i686-freebsd/build-toolchain.sh rename src/ci/docker/{cross => dist-various-1}/Dockerfile (74%) rename src/ci/docker/{cross => dist-various-1}/build-arm-musl.sh (100%) rename src/ci/docker/{cross => dist-various-1}/build-rumprun.sh (100%) rename src/ci/docker/{cross => dist-various-1}/install-mips-musl.sh (100%) rename src/ci/docker/{cross => dist-various-1}/install-mipsel-musl.sh (100%) rename src/ci/docker/{cross => dist-various-1}/install-x86_64-redox.sh (100%) rename src/ci/docker/{cross2 => dist-various-2}/Dockerfile (91%) rename src/ci/docker/{cross2 => dist-various-2}/build-fuchsia-toolchain.sh (100%) rename src/ci/docker/{cross2 => dist-various-2}/build-solaris-toolchain.sh (100%) rename src/ci/docker/{cross2 => dist-various-2}/shared.sh (100%) delete mode 100755 src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh create mode 100755 src/ci/docker/scripts/freebsd-toolchain.sh create mode 100644 src/ci/docker/wasm32-unknown/Dockerfile delete mode 100644 src/ci/docker/x86_64-gnu-cargotest/Dockerfile create mode 100644 src/ci/docker/x86_64-gnu-tools/Dockerfile create mode 100755 src/ci/docker/x86_64-gnu-tools/checktools.sh create mode 100644 src/ci/docker/x86_64-gnu-tools/repo.sh create mode 100644 src/doc/book/second-edition/src/appendix-03-derivable-traits.md create mode 100644 src/doc/book/second-edition/src/appendix-04-macros.md rename src/doc/book/second-edition/src/{appendix-06-translation.md => appendix-05-translation.md} (90%) rename src/doc/book/second-edition/src/{appendix-07-newest-features.md => appendix-06-newest-features.md} (100%) delete mode 100644 src/doc/reference/src/special-traits.md create mode 100644 src/doc/reference/src/special-types-and-traits.md delete mode 100644 src/doc/reference/src/the-copy-trait.md delete mode 100644 src/doc/reference/src/the-deref-trait.md delete mode 100644 src/doc/reference/src/the-drop-trait.md delete mode 100644 src/doc/reference/src/the-send-trait.md delete mode 100644 src/doc/reference/src/the-sized-trait.md delete mode 100644 src/doc/reference/src/the-sync-trait.md create mode 100644 src/doc/reference/src/type-layout.md create mode 100644 src/doc/unstable-book/src/language-features/doc-spotlight.md create mode 100644 src/doc/unstable-book/src/language-features/external-doc.md create mode 100644 src/doc/unstable-book/src/language-features/macro-lifetime-matcher.md create mode 100644 src/doc/unstable-book/src/language-features/use-nested-groups.md delete mode 100644 src/doc/unstable-book/src/library-features/hint-core-should-pause.md create mode 100755 src/etc/cat-and-grep.sh create mode 100644 src/liballoc/tests/heap.rs create mode 100644 src/libcompiler_builtins/src/int/addsub.rs create mode 100644 src/libcompiler_builtins/tests/i128_add.rs create mode 100644 src/libcompiler_builtins/tests/i128_addo.rs create mode 100644 src/libcompiler_builtins/tests/i128_sub.rs create mode 100644 src/libcompiler_builtins/tests/i128_subo.rs create mode 100644 src/libcompiler_builtins/tests/u128_add.rs create mode 100644 src/libcompiler_builtins/tests/u128_addo.rs create mode 100644 src/libcompiler_builtins/tests/u128_sub.rs create mode 100644 src/libcompiler_builtins/tests/u128_subo.rs create mode 100644 src/libcore/slice/memchr.rs create mode 100644 src/libcore/tests/pattern.rs rename src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/{bitrig.rs => bitrig/mod.rs} (90%) rename src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/{other/b32/mod.rs => bitrig/x86.rs} (100%) rename src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/{other/b64/mod.rs => bitrig/x86_64.rs} (100%) create mode 100644 src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs rename src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/{openbsd.rs => openbsd/mod.rs} (78%) create mode 100644 src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs create mode 100644 src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs delete mode 100644 src/liblibc/src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs create mode 100644 src/librustc/infer/anon_types/mod.rs delete mode 100644 src/librustc/infer/error_reporting/different_lifetimes.rs delete mode 100644 src/librustc/infer/error_reporting/named_anon_conflict.rs create mode 100644 src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs create mode 100644 src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs create mode 100644 src/librustc/infer/error_reporting/nice_region_error/mod.rs create mode 100644 src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs rename src/librustc/infer/error_reporting/{ => nice_region_error}/util.rs (66%) create mode 100644 src/librustc/infer/outlives/bounds.rs create mode 100644 src/librustc/infer/outlives/free_region_map.rs rename src/{tools/miri/src/librustc_mir => librustc/mir}/interpret/error.rs (94%) create mode 100644 src/librustc/mir/interpret/mod.rs rename src/{tools/miri/src/librustc_mir => librustc/mir}/interpret/value.rs (71%) rename src/librustc/{middle/trans.rs => mir/mono.rs} (83%) create mode 100644 src/librustc_back/target/aarch64_unknown_cloudabi.rs create mode 100644 src/librustc_back/target/armv4t_unknown_linux_gnueabi.rs create mode 100644 src/librustc_back/target/armv7_unknown_cloudabi_eabihf.rs create mode 100644 src/librustc_back/target/cloudabi_base.rs create mode 100644 src/librustc_back/target/i686_unknown_cloudabi.rs create mode 100644 src/librustc_back/target/x86_64_unknown_cloudabi.rs delete mode 100644 src/librustc_back/tempdir.rs create mode 100644 src/librustc_data_structures/owning_ref/LICENSE create mode 100644 src/librustc_data_structures/owning_ref/mod.rs create mode 100644 src/librustc_data_structures/sync.rs rename src/{librustc_back => librustc_metadata}/dynamic_lib.rs (100%) delete mode 100644 src/librustc_mir/borrow_check.rs create mode 100644 src/librustc_mir/borrow_check/error_reporting.rs create mode 100644 src/librustc_mir/borrow_check/flows.rs create mode 100644 src/librustc_mir/borrow_check/mod.rs create mode 100644 src/librustc_mir/borrow_check/nll/constraint_generation.rs create mode 100644 src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs create mode 100644 src/librustc_mir/borrow_check/nll/mod.rs create mode 100644 src/librustc_mir/borrow_check/nll/region_infer/annotation.rs create mode 100644 src/librustc_mir/borrow_check/nll/region_infer/dfs.rs create mode 100644 src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs create mode 100644 src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs create mode 100644 src/librustc_mir/borrow_check/nll/region_infer/mod.rs create mode 100644 src/librustc_mir/borrow_check/nll/region_infer/values.rs create mode 100644 src/librustc_mir/borrow_check/nll/renumber.rs rename src/librustc_mir/{transform => borrow_check}/nll/subtype_constraint_generation.rs (61%) create mode 100644 src/librustc_mir/borrow_check/nll/type_check/input_output.rs create mode 100644 src/librustc_mir/borrow_check/nll/type_check/liveness.rs rename src/librustc_mir/{transform/type_check.rs => borrow_check/nll/type_check/mod.rs} (57%) create mode 100644 src/librustc_mir/borrow_check/nll/universal_regions.rs create mode 100644 src/librustc_mir/borrow_check/prefixes.rs rename src/librustc_mir/build/expr/{as_lvalue.rs => as_place.rs} (73%) create mode 100644 src/librustc_mir/dataflow/at_location.rs rename src/{tools/miri/src => }/librustc_mir/interpret/cast.rs (68%) create mode 100644 src/librustc_mir/interpret/const_eval.rs create mode 100644 src/librustc_mir/interpret/eval_context.rs rename src/{tools/miri/src => }/librustc_mir/interpret/machine.rs (65%) create mode 100644 src/librustc_mir/interpret/memory.rs create mode 100644 src/librustc_mir/interpret/mod.rs rename src/{tools/miri/src => }/librustc_mir/interpret/operator.rs (95%) create mode 100644 src/librustc_mir/interpret/place.rs create mode 100644 src/librustc_mir/interpret/step.rs rename src/{tools/miri/src => }/librustc_mir/interpret/terminator/drop.rs (72%) rename src/{tools/miri/src => }/librustc_mir/interpret/terminator/mod.rs (77%) create mode 100644 src/librustc_mir/interpret/traits.rs rename src/{librustc_trans_utils => librustc_mir/monomorphize}/collector.rs (77%) rename src/{librustc_trans_utils/trans_item.rs => librustc_mir/monomorphize/item.rs} (87%) rename src/{librustc_trans_utils/monomorphize.rs => librustc_mir/monomorphize/mod.rs} (90%) rename src/{librustc_trans => librustc_mir/monomorphize}/partitioning.rs (83%) create mode 100644 src/librustc_mir/transform/add_moves_for_packed_drops.rs create mode 100644 src/librustc_mir/transform/lower_128bit.rs delete mode 100644 src/librustc_mir/transform/nll/constraint_generation.rs delete mode 100644 src/librustc_mir/transform/nll/free_regions.rs delete mode 100644 src/librustc_mir/transform/nll/mod.rs delete mode 100644 src/librustc_mir/transform/nll/region_infer.rs delete mode 100644 src/librustc_mir/transform/nll/renumber.rs create mode 100644 src/librustc_mir/transform/remove_noop_landing_pads.rs create mode 100644 src/librustc_mir/util/alignment.rs delete mode 100644 src/librustc_trans/adt.rs delete mode 100644 src/librustc_trans/machine.rs delete mode 100644 src/librustc_trans/mir/lvalue.rs create mode 100644 src/librustc_trans/mir/place.rs delete mode 100644 src/librustc_trans/tvec.rs delete mode 100644 src/librustc_trans_utils/common.rs create mode 100644 src/libstd/sys_common/bytestring.rs delete mode 100644 src/libstd/sys_common/memchr.rs create mode 100644 src/libstd/sys_common/process.rs create mode 100644 src/libstd/termination.rs create mode 100644 src/test/codegen/issue-47278.rs create mode 100644 src/test/codegen/link-dead-code.rs create mode 100644 src/test/codegen/nontemporal.rs create mode 100644 src/test/codegen/x86_mmx.rs create mode 100644 src/test/compile-fail/E0532.rs create mode 100644 src/test/compile-fail/E0599.rs create mode 100644 src/test/compile-fail/E0657.rs create mode 100644 src/test/compile-fail/absolute-paths-in-nested-use-groups.rs create mode 100644 src/test/compile-fail/associated-const-in-trait.rs create mode 100644 src/test/compile-fail/borrowck/borrowck-asm.rs rename src/test/compile-fail/{directory_ownership/backcompat-warnings.rs => borrowck/borrowck-local-borrow-outlives-fn.rs} (67%) create mode 100644 src/test/compile-fail/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs rename src/{tools/miri/tests/run-pass/issue-35815.rs => test/compile-fail/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs} (62%) create mode 100644 src/test/compile-fail/borrowck/two-phase-activation-sharing-interference.rs create mode 100644 src/test/compile-fail/borrowck/two-phase-allow-access-during-reservation.rs create mode 100644 src/test/compile-fail/borrowck/two-phase-cannot-nest-mut-self-calls.rs create mode 100644 src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs create mode 100644 src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs create mode 100644 src/test/compile-fail/borrowck/two-phase-sneaky.rs create mode 100644 src/test/compile-fail/conservative_impl_trait.rs delete mode 100644 src/test/compile-fail/const-fn-feature-flags.rs create mode 100644 src/test/compile-fail/const-match-check.rs delete mode 100644 src/test/compile-fail/dep_graph_crosscontaminate_tables.rs create mode 100644 src/test/compile-fail/derive-on-trait-item-or-impl-item.rs rename src/{tools/miri/xargo/src/lib.rs => test/compile-fail/directory_ownership/foo/compiletest-ignore-dir} (100%) create mode 100644 src/test/compile-fail/directory_ownership/foo/mod_file_not_owning/aux2.rs create mode 100644 src/test/compile-fail/directory_ownership/foo/mod_file_not_owning_aux2.rs rename src/{vendor/cargo_metadata/.cargo-ok => test/compile-fail/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir} (100%) create mode 100644 src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs create mode 100644 src/test/compile-fail/extern-macro.rs create mode 100644 src/test/compile-fail/external-doc-error.rs create mode 100644 src/test/compile-fail/feature-gate-nested_impl_trait.rs create mode 100644 src/test/compile-fail/feature-gate-termination_trait.rs create mode 100644 src/test/compile-fail/generator-yielding-or-returning-itself.rs delete mode 100644 src/test/compile-fail/impl-trait/lifetimes.rs create mode 100644 src/test/compile-fail/impl-trait/must_outlive_least_region_or_bound.rs create mode 100644 src/test/compile-fail/impl-trait/needs_least_region_or_bound.rs create mode 100644 src/test/compile-fail/impl-trait/type_parameters_captured.rs rename src/test/{parse-fail => compile-fail}/issue-10412.rs (87%) delete mode 100644 src/test/compile-fail/issue-12511.rs delete mode 100644 src/test/compile-fail/issue-20692.rs delete mode 100644 src/test/compile-fail/issue-21950.rs delete mode 100644 src/test/compile-fail/issue-22560.rs delete mode 100644 src/test/compile-fail/issue-24036.rs rename src/test/{run-pass => compile-fail}/issue-25439.rs (87%) rename src/test/{ui => compile-fail}/issue-26548.rs (70%) create mode 100644 src/test/compile-fail/issue-27060-2.rs create mode 100644 src/test/compile-fail/issue-27060.rs create mode 100644 src/test/compile-fail/issue-27078.rs create mode 100644 src/test/compile-fail/issue-38857.rs create mode 100644 src/test/compile-fail/issue-39848.rs create mode 100644 src/test/compile-fail/issue-41880.rs create mode 100644 src/test/compile-fail/issue-43355.rs create mode 100644 src/test/compile-fail/issue-45199.rs create mode 100644 src/test/compile-fail/issue-45965.rs create mode 100644 src/test/compile-fail/issue-46023.rs create mode 100644 src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs create mode 100644 src/test/compile-fail/issue-46311.rs create mode 100644 src/test/compile-fail/issue-46771.rs create mode 100644 src/test/compile-fail/issue-46843.rs create mode 100644 src/test/compile-fail/issue-47412.rs rename src/test/{parse-fail => compile-fail}/lifetime-no-keyword.rs (68%) create mode 100644 src/test/compile-fail/liveness-assign-imm-local-with-drop.rs create mode 100644 src/test/compile-fail/mir_check_cast_closure.rs create mode 100644 src/test/compile-fail/mir_check_cast_reify.rs create mode 100644 src/test/compile-fail/mir_check_cast_unsafe_fn.rs create mode 100644 src/test/compile-fail/mir_check_cast_unsize.rs create mode 100644 src/test/compile-fail/nll/reference-carried-through-struct-field.rs create mode 100644 src/test/compile-fail/nll/where_clauses_in_functions.rs create mode 100644 src/test/compile-fail/nll/where_clauses_in_structs.rs create mode 100644 src/test/compile-fail/privacy/associated-item-privacy-inherent.rs create mode 100644 src/test/compile-fail/privacy/associated-item-privacy-trait.rs create mode 100644 src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs create mode 100644 src/test/compile-fail/private-in-public-assoc-ty.rs create mode 100644 src/test/compile-fail/private-in-public-ill-formed.rs create mode 100644 src/test/compile-fail/quote-with-interpolated.rs create mode 100644 src/test/compile-fail/regions-normalize-in-where-clause-list.rs create mode 100644 src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs create mode 100644 src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs rename src/{tools/miri/tests/run-pass/try-operator-custom.rs => test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs} (82%) create mode 100644 src/test/compile-fail/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs create mode 100644 src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs create mode 100644 src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs create mode 100644 src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs create mode 100644 src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs create mode 100644 src/test/compile-fail/termination-trait-not-satisfied.rs create mode 100644 src/test/compile-fail/trait-alias.rs delete mode 100644 src/test/compile-fail/trait-duplicate-methods.rs delete mode 100644 src/test/compile-fail/trait-suggest-where-clause.rs rename src/{tools/miri/tests/run-pass/issue-26709.rs => test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs} (50%) create mode 100644 src/test/incremental-fulldeps/incremental_proc_macro.rs create mode 100644 src/test/incremental/change_crate_dep_kind.rs delete mode 100644 src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs delete mode 100644 src/test/incremental/unchecked_dirty_clean_metadata.rs create mode 100644 src/test/mir-opt/combine_array_len.rs create mode 100644 src/test/mir-opt/inline-closure-borrows-arg.rs create mode 100644 src/test/mir-opt/lower_128bit_debug_test.rs create mode 100644 src/test/mir-opt/lower_128bit_test.rs delete mode 100644 src/test/mir-opt/nll/region-liveness-drop-no-may-dangle.rs create mode 100644 src/test/mir-opt/packed-struct-drop-aligned.rs rename src/{tools/miri/tests/run-pass/issue-33387.rs => test/run-fail/borrowck-local-borrow.rs} (77%) create mode 100644 src/test/run-make/cat-and-grep-sanity-check/Makefile create mode 100644 src/test/run-make/hir-tree/Makefile rename src/{tools/miri/tests/run-pass/issue-15063.rs => test/run-make/hir-tree/input.rs} (80%) create mode 100644 src/test/run-make/include_bytes_deps/input.md create mode 100644 src/test/run-make/long-linker-command-lines-cmd-exe/Makefile create mode 100644 src/test/run-make/long-linker-command-lines-cmd-exe/foo.bat create mode 100644 src/test/run-make/long-linker-command-lines-cmd-exe/foo.rs create mode 100644 src/test/run-make/output-filename-overwrites-input/Makefile rename src/test/{compile-fail/E0580.rs => run-make/output-filename-overwrites-input/foo.rs} (79%) rename src/test/run-pass-fulldeps/auxiliary/{issue_16723_multiple_items_syntax_ext.rs => issue-16723.rs} (100%) rename src/test/run-pass-fulldeps/auxiliary/{plugin_crate_outlive_expansion_phase.rs => outlive-expansion-phase.rs} (100%) rename src/test/{compile-fail-fulldeps => run-pass-fulldeps}/derive-no-std-not-supported.rs (80%) rename src/test/run-pass-fulldeps/{issue_16723_multiple_items_syntax_ext.rs => issue-16723.rs} (86%) rename src/test/run-pass-fulldeps/{macro-crate-outlive-expansion-phase.rs => outlive-expansion-phase.rs} (83%) create mode 100644 src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs create mode 100644 src/test/run-pass-fulldeps/proc-macro/issue-42708.rs create mode 100644 src/test/run-pass/abort-on-c-abi.rs create mode 100644 src/test/run-pass/align-offset-sign.rs create mode 100644 src/test/run-pass/align-with-extern-c-fn.rs create mode 100644 src/test/run-pass/arbitrary_self_types_raw_pointer_struct.rs create mode 100644 src/test/run-pass/arbitrary_self_types_raw_pointer_trait.rs create mode 100644 src/test/run-pass/asm-in-moved.rs delete mode 100644 src/test/run-pass/auxiliary/svh-a-comment.rs delete mode 100644 src/test/run-pass/auxiliary/svh-a-doc.rs delete mode 100644 src/test/run-pass/auxiliary/svh-a-macro.rs delete mode 100644 src/test/run-pass/auxiliary/svh-a-no-change.rs delete mode 100644 src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs delete mode 100644 src/test/run-pass/auxiliary/svh-a-whitespace.rs create mode 100644 src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs create mode 100644 src/test/run-pass/borrowck/two-phase-baseline.rs create mode 100644 src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs create mode 100644 src/test/run-pass/conservative_impl_trait.rs create mode 100644 src/test/run-pass/deriving-with-repr-packed.rs create mode 100644 src/test/run-pass/enum-non-c-like-repr-c-and-int.rs create mode 100644 src/test/run-pass/enum-non-c-like-repr-c.rs create mode 100644 src/test/run-pass/hygiene/auxiliary/xcrate.rs rename src/{tools/miri/tests/run-pass/issue-27901.rs => test/run-pass/hygiene/issue-44128.rs} (64%) create mode 100644 src/test/run-pass/hygiene/xcrate.rs create mode 100644 src/test/run-pass/impl-trait/issue-42479.rs create mode 100644 src/test/run-pass/impl-trait/lifetimes.rs create mode 100644 src/test/run-pass/in-band-lifetimes.rs create mode 100644 src/test/run-pass/issue-27060.rs create mode 100644 src/test/run-pass/issue-43355.rs rename src/test/{ui/union-sized-field.rs => run-pass/issue-43483.rs} (75%) create mode 100644 src/test/run-pass/issue-45152.rs create mode 100644 src/test/run-pass/issue-46069.rs create mode 100644 src/test/run-pass/issue-46553.rs create mode 100644 src/test/run-pass/issue-46845.rs create mode 100644 src/test/run-pass/issue-46855.rs create mode 100644 src/test/run-pass/issue-46920-byte-array-patterns.rs create mode 100644 src/test/run-pass/issue-47139-1.rs create mode 100644 src/test/run-pass/issue-47139-2.rs create mode 100644 src/test/run-pass/issue-47638.rs create mode 100644 src/test/run-pass/lto-still-runs-thread-dtors.rs rename src/{tools/miri/tests/run-pass/last-use-in-cap-clause.rs => test/run-pass/macro-lifetime-used-with-bound.rs} (63%) create mode 100644 src/test/run-pass/macro-lifetime-used-with-labels.rs create mode 100644 src/test/run-pass/macro-lifetime-used-with-static.rs rename src/{tools/miri/tests/run-pass-fullmir/move-arg-2-unique.rs => test/run-pass/macro-lifetime.rs} (67%) rename src/test/{compile-fail/partialeq_help.rs => run-pass/macro-nested_expr.rs} (61%) create mode 100644 src/test/run-pass/mir-typeck-normalize-fn-sig.rs create mode 100644 src/test/run-pass/nll/get_default.rs create mode 100644 src/test/run-pass/nll/process_or_insert_default.rs create mode 100644 src/test/run-pass/nll/rc-loop.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod.rs rename src/{vendor/memchr-1.0.2/.cargo-ok => test/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir} (100%) create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/non_modrs_mods.rs create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs create mode 100644 src/test/run-pass/packed-struct-drop-aligned.rs create mode 100644 src/test/run-pass/packed-struct-optimized-enum.rs create mode 100644 src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs create mode 100644 src/test/run-pass/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs create mode 100644 src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs rename src/test/run-pass/specialization/auxiliary/{specialization_cross_crate_defaults.rs => cross_crates_defaults.rs} (100%) rename src/test/run-pass/specialization/{specialization-cross-crate-defaults.rs => cross-crate-defaults.rs} (87%) delete mode 100644 src/test/run-pass/svh-add-comment.rs delete mode 100644 src/test/run-pass/svh-add-macro.rs delete mode 100644 src/test/run-pass/svh-add-redundant-cfg.rs delete mode 100644 src/test/run-pass/svh-add-whitespace.rs create mode 100644 src/test/run-pass/termination-trait-for-empty.rs create mode 100644 src/test/run-pass/termination-trait-for-i32.rs create mode 100644 src/test/run-pass/termination-trait-for-result.rs create mode 100644 src/test/run-pass/thinlto/weak-works.rs create mode 100644 src/test/run-pass/union/union-const-eval-field.rs create mode 100644 src/test/run-pass/use-nested-groups.rs create mode 100644 src/test/rustdoc/auxiliary/external-cross-doc.md create mode 100644 src/test/rustdoc/auxiliary/external-cross.rs create mode 100644 src/test/rustdoc/auxiliary/external-doc.md create mode 100644 src/test/rustdoc/auxiliary/issue-46727.rs create mode 100644 src/test/rustdoc/doc-spotlight.rs create mode 100644 src/test/rustdoc/double-quote-escape.rs create mode 100644 src/test/rustdoc/escape-deref-methods.rs create mode 100644 src/test/rustdoc/external-cross.rs create mode 100644 src/test/rustdoc/external-doc.rs create mode 100644 src/test/rustdoc/foreigntype-reexport.rs create mode 100644 src/test/rustdoc/hidden-trait-struct-impls.rs create mode 100644 src/test/rustdoc/inline_cross/assoc-items.rs create mode 100644 src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs create mode 100644 src/test/rustdoc/issue-42760.rs create mode 100644 src/test/rustdoc/issue-46271.rs create mode 100644 src/test/rustdoc/issue-46377.rs rename src/{tools/miri/tests/compile-fail/overflowing-unchecked-rsh.rs => test/rustdoc/issue-46380-2.rs} (64%) rename src/test/{compile-fail/no-core-gated.rs => rustdoc/issue-46380.rs} (80%) create mode 100644 src/test/rustdoc/issue-46727.rs create mode 100644 src/test/rustdoc/issue-46766.rs create mode 100644 src/test/rustdoc/issue-46767.rs create mode 100644 src/test/rustdoc/issue-47639.rs create mode 100644 src/test/rustdoc/negative-impl-sidebar.rs create mode 100644 src/test/rustdoc/sort-modules-by-appearance.rs create mode 100644 src/test/rustdoc/where-sized.rs rename src/test/{compile-fail-fulldeps => ui-fulldeps}/lint-plugin-forbid-attrs.rs (87%) create mode 100644 src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr rename src/test/{compile-fail-fulldeps => ui-fulldeps}/proc-macro/auxiliary/derive-panic.rs (100%) rename src/test/{compile-fail-fulldeps => ui-fulldeps}/proc-macro/load-panic.rs (95%) create mode 100644 src/test/ui-fulldeps/proc-macro/load-panic.stderr rename src/test/{compile-fail-fulldeps => ui-fulldeps}/proc-macro/signature.rs (82%) create mode 100644 src/test/ui-fulldeps/proc-macro/signature.stderr create mode 100644 src/test/ui-fulldeps/update-all-references.sh create mode 100644 src/test/ui-fulldeps/update-references.sh rename src/test/{compile-fail => ui}/arbitrary-self-types-not-object-safe.rs (77%) create mode 100644 src/test/ui/arbitrary-self-types-not-object-safe.stderr rename src/test/{compile-fail => ui}/asm-out-assign-imm.rs (92%) create mode 100644 src/test/ui/asm-out-assign-imm.stderr rename src/test/{compile-fail => ui}/associated-const-impl-wrong-lifetime.rs (77%) create mode 100644 src/test/ui/associated-const-impl-wrong-lifetime.stderr rename src/test/{compile-fail => ui}/associated-const-impl-wrong-type.rs (88%) create mode 100644 src/test/ui/associated-const-impl-wrong-type.stderr rename src/test/{compile-fail => ui}/associated-type-projection-from-multiple-supertraits.rs (71%) create mode 100644 src/test/ui/associated-type-projection-from-multiple-supertraits.stderr rename src/test/{compile-fail => ui}/associated-types-ICE-when-projecting-out-of-err.rs (93%) create mode 100644 src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr rename src/test/{compile-fail => ui}/associated-types-in-ambiguous-context.rs (71%) create mode 100644 src/test/ui/associated-types-in-ambiguous-context.stderr rename src/test/{compile-fail => ui}/augmented-assignments.rs (94%) create mode 100644 src/test/ui/augmented-assignments.stderr rename src/test/{compile-fail => ui}/auxiliary/cfg-target-thread-local.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/changing-crates-a1.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/changing-crates-a2.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/changing-crates-b.rs (100%) rename src/{tools/miri/tests/run-pass/unique-send.rs => test/ui/auxiliary/coherence_lib.rs} (69%) rename src/{tools/miri/tests/compile-fail/overflowing-lsh-neg.rs => test/ui/auxiliary/empty-struct.rs} (79%) rename src/test/{compile-fail => ui}/auxiliary/issue-36708.rs (100%) rename src/test/{run-pass/svh-add-doc.rs => ui/auxiliary/lint_output_format.rs} (51%) create mode 100644 src/test/ui/auxiliary/struct_field_privacy.rs rename src/test/{compile-fail => ui}/auxiliary/svh-a-base.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-a-change-lit.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-a-change-significant-cfg.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-a-change-trait-bound.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-a-change-type-arg.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-a-change-type-ret.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-a-change-type-static.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-b.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-uta-base.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-uta-change-use-trait.rs (100%) rename src/test/{compile-fail => ui}/auxiliary/svh-utb.rs (100%) rename src/test/{run-pass/issue-21410.rs => ui/auxiliary/two_macros.rs} (80%) rename src/test/{compile-fail => ui}/binary-op-on-double-ref.rs (80%) create mode 100644 src/test/ui/binary-op-on-double-ref.stderr rename src/test/{compile-fail => ui}/blind-item-item-shadow.rs (78%) create mode 100644 src/test/ui/blind-item-item-shadow.stderr rename src/test/{compile-fail => ui}/bogus-tag.rs (89%) create mode 100644 src/test/ui/bogus-tag.stderr rename src/test/{compile-fail => ui}/borrowck/borrowck-box-insensitivity.rs (85%) create mode 100644 src/test/ui/borrowck/borrowck-box-insensitivity.stderr rename src/test/{compile-fail => ui}/borrowck/borrowck-escaping-closure-error-1.rs (91%) create mode 100644 src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr rename src/test/{compile-fail => ui}/borrowck/borrowck-escaping-closure-error-2.rs (91%) create mode 100644 src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr rename src/test/{compile-fail => ui}/borrowck/borrowck-move-error-with-note.rs (82%) create mode 100644 src/test/ui/borrowck/borrowck-move-error-with-note.stderr rename src/test/{compile-fail => ui}/borrowck/borrowck-move-out-of-vec-tail.rs (97%) create mode 100644 src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr rename src/test/{compile-fail => ui}/borrowck/borrowck-report-with-custom-diagnostic.rs (92%) create mode 100644 src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr rename src/test/{compile-fail => ui}/borrowck/borrowck-vec-pattern-nesting.rs (94%) create mode 100644 src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr rename src/test/{compile-fail => ui}/cast-as-bool.rs (93%) create mode 100644 src/test/ui/cast-as-bool.stderr create mode 100644 src/test/ui/cast-errors-issue-43825.rs create mode 100644 src/test/ui/cast-errors-issue-43825.stderr rename src/test/{compile-fail => ui}/cast-rfc0401-2.rs (95%) create mode 100644 src/test/ui/cast-rfc0401-2.stderr create mode 100644 src/test/ui/casts-differing-anon.rs create mode 100644 src/test/ui/casts-differing-anon.stderr create mode 100644 src/test/ui/casts-issue-46365.rs create mode 100644 src/test/ui/casts-issue-46365.stderr rename src/test/{compile-fail => ui}/changing-crates.rs (87%) create mode 100644 src/test/ui/changing-crates.stderr rename src/test/{compile-fail => ui}/coherence-error-suppression.rs (100%) create mode 100644 src/test/ui/coherence-error-suppression.stderr rename src/test/{compile-fail => ui}/coherence-impls-copy.rs (66%) create mode 100644 src/test/ui/coherence-impls-copy.stderr rename src/test/{compile-fail => ui}/coherence-overlap-downstream-inherent.rs (79%) create mode 100644 src/test/ui/coherence-overlap-downstream-inherent.stderr rename src/test/{compile-fail => ui}/coherence-overlap-downstream.rs (78%) create mode 100644 src/test/ui/coherence-overlap-downstream.stderr rename src/test/{compile-fail => ui}/coherence-overlap-issue-23516-inherent.rs (83%) create mode 100644 src/test/ui/coherence-overlap-issue-23516-inherent.stderr rename src/test/{compile-fail => ui}/coherence-overlap-issue-23516.rs (82%) create mode 100644 src/test/ui/coherence-overlap-issue-23516.stderr rename src/test/{compile-fail => ui}/coherence-overlap-upstream-inherent.rs (82%) create mode 100644 src/test/ui/coherence-overlap-upstream-inherent.stderr rename src/test/{compile-fail => ui}/coherence-overlap-upstream.rs (81%) create mode 100644 src/test/ui/coherence-overlap-upstream.stderr create mode 100644 src/test/ui/command-line-diagnostics.rs create mode 100644 src/test/ui/command-line-diagnostics.stderr rename src/test/{compile-fail => ui}/const-deref-ptr.rs (90%) create mode 100644 src/test/ui/const-deref-ptr.stderr rename src/test/{compile-fail => ui}/const-eval-overflow-2.rs (93%) create mode 100644 src/test/ui/const-eval-overflow-2.stderr rename src/test/{compile-fail => ui}/const-eval-overflow-4.rs (95%) create mode 100644 src/test/ui/const-eval-overflow-4.stderr rename src/test/{compile-fail => ui}/const-eval-span.rs (95%) create mode 100644 src/test/ui/const-eval-span.stderr rename src/test/{compile-fail => ui}/const-fn-error.rs (71%) create mode 100644 src/test/ui/const-fn-error.stderr rename src/test/{compile-fail => ui}/const-fn-mismatch.rs (95%) create mode 100644 src/test/ui/const-fn-mismatch.stderr rename src/test/{compile-fail => ui}/const-fn-not-in-trait.rs (90%) create mode 100644 src/test/ui/const-fn-not-in-trait.stderr rename src/test/{compile-fail => ui}/const-len-underflow-separate-spans.rs (88%) create mode 100644 src/test/ui/const-len-underflow-separate-spans.stderr rename src/test/{compile-fail => ui}/const-pattern-not-const-evaluable.rs (94%) create mode 100644 src/test/ui/const-pattern-not-const-evaluable.stderr rename src/test/{compile-fail => ui}/const-unsized.rs (67%) create mode 100644 src/test/ui/const-unsized.stderr rename src/test/{compile-fail => ui}/cycle-trait-supertrait-indirect.rs (74%) create mode 100644 src/test/ui/cycle-trait-supertrait-indirect.stderr rename src/test/{compile-fail => ui}/derived-errors/issue-31997-1.rs (97%) create mode 100644 src/test/ui/derived-errors/issue-31997-1.stderr create mode 100644 src/test/ui/deriving-with-repr-packed.rs create mode 100644 src/test/ui/deriving-with-repr-packed.stderr create mode 100644 src/test/ui/did_you_mean/bad-assoc-expr.rs create mode 100644 src/test/ui/did_you_mean/bad-assoc-expr.stderr create mode 100644 src/test/ui/did_you_mean/bad-assoc-pat.rs create mode 100644 src/test/ui/did_you_mean/bad-assoc-pat.stderr create mode 100644 src/test/ui/did_you_mean/bad-assoc-ty.rs create mode 100644 src/test/ui/did_you_mean/bad-assoc-ty.stderr create mode 100644 src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs create mode 100644 src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr create mode 100644 src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs create mode 100644 src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr rename src/test/{compile-fail => ui}/discrim-overflow-2.rs (62%) create mode 100644 src/test/ui/discrim-overflow-2.stderr rename src/test/{compile-fail => ui}/discrim-overflow.rs (73%) create mode 100644 src/test/ui/discrim-overflow.stderr rename src/test/{compile-fail => ui}/double-import.rs (78%) create mode 100644 src/test/ui/double-import.stderr rename src/test/{compile-fail => ui}/duplicate-check-macro-exports.rs (87%) create mode 100644 src/test/ui/duplicate-check-macro-exports.stderr rename src/test/{compile-fail => ui}/empty-struct-unit-expr.rs (90%) create mode 100644 src/test/ui/empty-struct-unit-expr.stderr rename src/test/{compile-fail => ui}/enum-and-module-in-same-scope.rs (77%) create mode 100644 src/test/ui/enum-and-module-in-same-scope.stderr rename src/test/{compile-fail => ui}/fat-ptr-cast.rs (92%) create mode 100644 src/test/ui/fat-ptr-cast.stderr rename src/test/{compile-fail => ui}/feature-gate-abi-msp430-interrupt.rs (100%) create mode 100644 src/test/ui/feature-gate-abi-msp430-interrupt.stderr rename src/test/{compile-fail => ui}/feature-gate-abi.rs (100%) create mode 100644 src/test/ui/feature-gate-abi.stderr rename src/test/{compile-fail/unadjusted-unstable.rs => ui/feature-gate-abi_unadjusted.rs} (95%) create mode 100644 src/test/ui/feature-gate-abi_unadjusted.stderr rename src/test/{compile-fail => ui}/feature-gate-advanced-slice-features.rs (100%) create mode 100644 src/test/ui/feature-gate-advanced-slice-features.stderr rename src/test/{compile-fail => ui}/feature-gate-allocator_internals.rs (100%) create mode 100644 src/test/ui/feature-gate-allocator_internals.stderr rename src/test/{compile-fail => ui}/feature-gate-allow-internal-unsafe-nested-macro.rs (100%) create mode 100644 src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.stderr rename src/test/{compile-fail => ui}/feature-gate-allow-internal-unstable-nested-macro.rs (100%) create mode 100644 src/test/ui/feature-gate-allow-internal-unstable-nested-macro.stderr rename src/test/{compile-fail => ui}/feature-gate-allow-internal-unstable-struct.rs (100%) create mode 100644 src/test/ui/feature-gate-allow-internal-unstable-struct.stderr rename src/test/{compile-fail => ui}/feature-gate-allow-internal-unstable.rs (100%) create mode 100644 src/test/ui/feature-gate-allow-internal-unstable.stderr rename src/test/{compile-fail => ui}/feature-gate-allow_fail.rs (100%) create mode 100644 src/test/ui/feature-gate-allow_fail.stderr rename src/test/{compile-fail => ui}/feature-gate-arbitrary-self-types.rs (100%) create mode 100644 src/test/ui/feature-gate-arbitrary-self-types.stderr create mode 100644 src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs create mode 100644 src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr rename src/test/{compile-fail/asm-gated.rs => ui/feature-gate-asm.rs} (96%) create mode 100644 src/test/ui/feature-gate-asm.stderr rename src/test/{compile-fail/asm-gated2.rs => ui/feature-gate-asm2.rs} (100%) create mode 100644 src/test/ui/feature-gate-asm2.stderr rename src/test/{compile-fail => ui}/feature-gate-assoc-type-defaults.rs (100%) create mode 100644 src/test/ui/feature-gate-assoc-type-defaults.stderr rename src/test/{compile-fail => ui}/feature-gate-box-expr.rs (100%) create mode 100644 src/test/ui/feature-gate-box-expr.stderr rename src/test/{compile-fail/feature-gate-box-pat.rs => ui/feature-gate-box_patterns.rs} (95%) create mode 100644 src/test/ui/feature-gate-box_patterns.stderr rename src/test/{compile-fail/gated-box-syntax.rs => ui/feature-gate-box_syntax.rs} (96%) create mode 100644 src/test/ui/feature-gate-box_syntax.stderr rename src/test/{compile-fail => ui}/feature-gate-catch_expr.rs (100%) create mode 100644 src/test/ui/feature-gate-catch_expr.stderr rename src/test/{compile-fail => ui}/feature-gate-cfg-target-feature.rs (100%) create mode 100644 src/test/ui/feature-gate-cfg-target-feature.stderr rename src/test/{compile-fail => ui}/feature-gate-cfg-target-has-atomic.rs (100%) create mode 100644 src/test/ui/feature-gate-cfg-target-has-atomic.stderr rename src/test/{compile-fail => ui}/feature-gate-cfg-target-thread-local.rs (100%) create mode 100644 src/test/ui/feature-gate-cfg-target-thread-local.stderr rename src/test/{compile-fail => ui}/feature-gate-cfg-target-vendor.rs (100%) create mode 100644 src/test/ui/feature-gate-cfg-target-vendor.stderr rename src/test/{compile-fail => ui}/feature-gate-clone-closures.rs (100%) create mode 100644 src/test/ui/feature-gate-clone-closures.stderr rename src/test/{compile-fail => ui}/feature-gate-compiler-builtins.rs (100%) create mode 100644 src/test/ui/feature-gate-compiler-builtins.stderr rename src/test/{compile-fail/concat_idents-gate.rs => ui/feature-gate-concat_idents.rs} (96%) create mode 100644 src/test/ui/feature-gate-concat_idents.stderr rename src/test/{compile-fail/gated-concat_idents.rs => ui/feature-gate-concat_idents2.rs} (100%) create mode 100644 src/test/ui/feature-gate-concat_idents2.stderr rename src/test/{compile-fail/concat_idents-gate2.rs => ui/feature-gate-concat_idents3.rs} (100%) create mode 100644 src/test/ui/feature-gate-concat_idents3.stderr rename src/test/{compile-fail/impl-trait/feature-gate.rs => ui/feature-gate-conservative_impl_trait.rs} (93%) create mode 100644 src/test/ui/feature-gate-conservative_impl_trait.stderr rename src/test/{compile-fail => ui}/feature-gate-const-indexing.rs (100%) create mode 100644 src/test/ui/feature-gate-const-indexing.stderr rename src/test/{compile-fail/const-fn-stability.rs => ui/feature-gate-const_fn.rs} (98%) create mode 100644 src/test/ui/feature-gate-const_fn.stderr rename src/test/{compile-fail => ui}/feature-gate-copy-closures.rs (100%) create mode 100644 src/test/ui/feature-gate-copy-closures.stderr rename src/{tools/miri/tests/compile-fail/overflowing-rsh.rs => test/ui/feature-gate-crate_in_paths.rs} (74%) create mode 100644 src/test/ui/feature-gate-crate_in_paths.stderr rename src/test/{compile-fail => ui}/feature-gate-crate_visibility_modifier.rs (100%) create mode 100644 src/test/ui/feature-gate-crate_visibility_modifier.stderr rename src/test/{compile-fail/attr-literals.rs => ui/feature-gate-custom_attribute.rs} (98%) create mode 100644 src/test/ui/feature-gate-custom_attribute.stderr rename src/test/{compile-fail/attr-on-generic-formals-are-visited.rs => ui/feature-gate-custom_attribute2.rs} (100%) create mode 100644 src/test/ui/feature-gate-custom_attribute2.stderr rename src/test/{compile-fail/single-derive-attr.rs => ui/feature-gate-custom_derive.rs} (95%) create mode 100644 src/test/ui/feature-gate-custom_derive.stderr rename src/test/{compile-fail => ui}/feature-gate-decl_macro.rs (88%) create mode 100644 src/test/ui/feature-gate-decl_macro.stderr rename src/test/{compile-fail/type-parameter-invalid-lint.rs => ui/feature-gate-default_type_parameter_fallback.rs} (94%) create mode 100644 src/test/ui/feature-gate-default_type_parameter_fallback.stderr rename src/test/{compile-fail => ui}/feature-gate-doc_cfg.rs (100%) create mode 100644 src/test/ui/feature-gate-doc_cfg.stderr rename src/test/{compile-fail => ui}/feature-gate-doc_masked.rs (100%) create mode 100644 src/test/ui/feature-gate-doc_masked.stderr create mode 100644 src/test/ui/feature-gate-doc_spotlight.rs create mode 100644 src/test/ui/feature-gate-doc_spotlight.stderr rename src/test/{compile-fail => ui}/feature-gate-dotdoteq_in_patterns.rs (100%) create mode 100644 src/test/ui/feature-gate-dotdoteq_in_patterns.stderr rename src/test/{compile-fail => ui}/feature-gate-dropck-ugeh-2.rs (100%) create mode 100644 src/test/ui/feature-gate-dropck-ugeh-2.stderr rename src/test/{compile-fail => ui}/feature-gate-dropck-ugeh.rs (100%) create mode 100644 src/test/ui/feature-gate-dropck-ugeh.stderr rename src/test/{compile-fail => ui}/feature-gate-dyn-trait.rs (100%) create mode 100644 src/test/ui/feature-gate-dyn-trait.stderr rename src/test/{compile-fail => ui}/feature-gate-exclusive-range-pattern.rs (100%) create mode 100644 src/test/ui/feature-gate-exclusive-range-pattern.stderr create mode 100644 src/test/ui/feature-gate-extern_absolute_paths.rs create mode 100644 src/test/ui/feature-gate-extern_absolute_paths.stderr rename src/test/{compile-fail => ui}/feature-gate-extern_types.rs (100%) create mode 100644 src/test/ui/feature-gate-extern_types.stderr create mode 100644 src/test/ui/feature-gate-external_doc.rs create mode 100644 src/test/ui/feature-gate-external_doc.stderr rename src/test/{compile-fail => ui}/feature-gate-feature-gate.rs (100%) create mode 100644 src/test/ui/feature-gate-feature-gate.stderr rename src/test/{compile-fail => ui}/feature-gate-fn_must_use-cap-lints-allow.rs (100%) create mode 100644 src/test/ui/feature-gate-fn_must_use-cap-lints-allow.stderr rename src/test/{compile-fail => ui}/feature-gate-fn_must_use.rs (100%) create mode 100644 src/test/ui/feature-gate-fn_must_use.stderr rename src/test/{compile-fail => ui}/feature-gate-fundamental.rs (100%) create mode 100644 src/test/ui/feature-gate-fundamental.stderr rename src/test/{compile-fail => ui}/feature-gate-generators.rs (100%) create mode 100644 src/test/ui/feature-gate-generators.stderr rename src/{tools/miri/tests/run-pass-fullmir/foreign-fn-linkname.rs => test/ui/feature-gate-generic_associated_types.rs} (50%) create mode 100644 src/test/ui/feature-gate-generic_associated_types.stderr rename src/test/{compile-fail/attr-on-generic-formals-wo-feature-gate.rs => ui/feature-gate-generic_param_attrs.rs} (98%) create mode 100644 src/test/ui/feature-gate-generic_param_attrs.stderr rename src/test/{compile-fail => ui}/feature-gate-global_allocator.rs (100%) create mode 100644 src/test/ui/feature-gate-global_allocator.stderr rename src/test/{compile-fail => ui}/feature-gate-global_asm.rs (100%) create mode 100644 src/test/ui/feature-gate-global_asm.stderr rename src/test/{compile-fail/i128-feature.rs => ui/feature-gate-i128_type.rs} (96%) create mode 100644 src/test/ui/feature-gate-i128_type.stderr rename src/test/{compile-fail/i128-feature-2.rs => ui/feature-gate-i128_type2.rs} (100%) create mode 100644 src/test/ui/feature-gate-i128_type2.stderr create mode 100644 src/test/ui/feature-gate-in_band_lifetimes.rs create mode 100644 src/test/ui/feature-gate-in_band_lifetimes.stderr rename src/test/{compile-fail => ui}/feature-gate-intrinsics.rs (100%) create mode 100644 src/test/ui/feature-gate-intrinsics.stderr rename src/test/{compile-fail => ui}/feature-gate-lang-items.rs (100%) create mode 100644 src/test/ui/feature-gate-lang-items.stderr rename src/test/{compile-fail/gated-link-args.rs => ui/feature-gate-link_args.rs} (97%) create mode 100644 src/test/ui/feature-gate-link_args.stderr rename src/test/{compile-fail/link-cfg-gated.rs => ui/feature-gate-link_cfg.rs} (96%) create mode 100644 src/test/ui/feature-gate-link_cfg.stderr rename src/test/{compile-fail/gated-link-llvm-intrinsics.rs => ui/feature-gate-link_llvm_intrinsics.rs} (94%) create mode 100644 src/test/ui/feature-gate-link_llvm_intrinsics.stderr rename src/test/{compile-fail/linkage1.rs => ui/feature-gate-linkage.rs} (96%) create mode 100644 src/test/ui/feature-gate-linkage.stderr rename src/test/{compile-fail => ui}/feature-gate-linker-flavor.rs (100%) create mode 100644 src/test/ui/feature-gate-linker-flavor.stderr rename src/test/{compile-fail/log-syntax-gate.rs => ui/feature-gate-log_syntax.rs} (95%) create mode 100644 src/test/ui/feature-gate-log_syntax.stderr rename src/test/{compile-fail/log-syntax-gate2.rs => ui/feature-gate-log_syntax2.rs} (100%) create mode 100644 src/test/ui/feature-gate-log_syntax2.stderr create mode 100644 src/test/ui/feature-gate-macro-lifetime-matcher.rs create mode 100644 src/test/ui/feature-gate-macro-lifetime-matcher.stderr rename src/test/{compile-fail => ui}/feature-gate-macro-vis-matcher.rs (100%) create mode 100644 src/test/ui/feature-gate-macro-vis-matcher.stderr rename src/test/{compile-fail => ui}/feature-gate-main.rs (100%) create mode 100644 src/test/ui/feature-gate-main.stderr rename src/test/{compile-fail => ui}/feature-gate-match_beginning_vert.rs (100%) create mode 100644 src/test/ui/feature-gate-match_beginning_vert.stderr rename src/test/{compile-fail => ui}/feature-gate-match_default_bindings.rs (100%) create mode 100644 src/test/ui/feature-gate-match_default_bindings.stderr rename src/test/{compile-fail => ui}/feature-gate-may-dangle.rs (90%) create mode 100644 src/test/ui/feature-gate-may-dangle.stderr rename src/test/{compile-fail/gated-naked_functions.rs => ui/feature-gate-naked_functions.rs} (95%) create mode 100644 src/test/ui/feature-gate-naked_functions.stderr rename src/test/{compile-fail => ui}/feature-gate-needs-allocator.rs (100%) create mode 100644 src/test/ui/feature-gate-needs-allocator.stderr rename src/test/{compile-fail => ui}/feature-gate-negate-unsigned.rs (100%) create mode 100644 src/test/ui/feature-gate-negate-unsigned.stderr rename src/test/{compile-fail/never-disabled.rs => ui/feature-gate-never_type.rs} (97%) create mode 100644 src/test/ui/feature-gate-never_type.stderr rename src/{tools/miri/tests/run-pass/associated-const.rs => test/ui/feature-gate-nll.rs} (78%) create mode 100644 src/test/ui/feature-gate-nll.stderr rename src/test/{compile-fail => ui}/feature-gate-no-debug-2.rs (100%) create mode 100644 src/test/ui/feature-gate-no-debug-2.stderr rename src/test/{compile-fail => ui}/feature-gate-no-debug.rs (100%) create mode 100644 src/test/ui/feature-gate-no-debug.stderr rename src/test/{compile-fail/gated-no-core.rs => ui/feature-gate-no_core.rs} (95%) create mode 100644 src/test/ui/feature-gate-no_core.stderr rename src/test/{compile-fail/gated-non-ascii-idents.rs => ui/feature-gate-non_ascii_idents.rs} (97%) create mode 100644 src/test/ui/feature-gate-non_ascii_idents.stderr rename src/test/{compile-fail => ui}/feature-gate-non_exhaustive.rs (100%) create mode 100644 src/test/ui/feature-gate-non_exhaustive.stderr rename src/test/{compile-fail => ui}/feature-gate-omit-gdb-pretty-printer-section.rs (100%) create mode 100644 src/test/ui/feature-gate-omit-gdb-pretty-printer-section.stderr rename src/test/{compile-fail => ui}/feature-gate-on-unimplemented.rs (100%) create mode 100644 src/test/ui/feature-gate-on-unimplemented.stderr rename src/test/{compile-fail => ui}/feature-gate-optin-builtin-traits.rs (100%) create mode 100644 src/test/ui/feature-gate-optin-builtin-traits.stderr rename src/test/{compile-fail => ui}/feature-gate-overlapping_marker_traits.rs (100%) create mode 100644 src/test/ui/feature-gate-overlapping_marker_traits.stderr rename src/test/{compile-fail => ui}/feature-gate-placement-expr.rs (100%) create mode 100644 src/test/ui/feature-gate-placement-expr.stderr rename src/test/{compile-fail => ui}/feature-gate-plugin.rs (100%) create mode 100644 src/test/ui/feature-gate-plugin.stderr rename src/test/{compile-fail/gated-plugin_registrar.rs => ui/feature-gate-plugin_registrar.rs} (95%) create mode 100644 src/test/ui/feature-gate-plugin_registrar.stderr rename src/test/{compile-fail => ui}/feature-gate-prelude_import.rs (100%) create mode 100644 src/test/ui/feature-gate-prelude_import.stderr rename src/test/{compile-fail => ui}/feature-gate-profiler-runtime.rs (100%) create mode 100644 src/test/ui/feature-gate-profiler-runtime.stderr rename src/test/{compile-fail => ui}/feature-gate-repr-simd.rs (100%) create mode 100644 src/test/ui/feature-gate-repr-simd.stderr rename src/test/{compile-fail => ui}/feature-gate-repr128.rs (93%) create mode 100644 src/test/ui/feature-gate-repr128.stderr rename src/test/{compile-fail => ui}/feature-gate-repr_align.rs (100%) create mode 100644 src/test/ui/feature-gate-repr_align.stderr rename src/test/{compile-fail => ui}/feature-gate-rustc-attrs.rs (100%) create mode 100644 src/test/ui/feature-gate-rustc-attrs.stderr rename src/test/{compile-fail => ui}/feature-gate-rustc-diagnostic-macros.rs (100%) create mode 100644 src/test/ui/feature-gate-rustc-diagnostic-macros.stderr rename src/test/{compile-fail => ui}/feature-gate-rustc_const_unstable.rs (100%) create mode 100644 src/test/ui/feature-gate-rustc_const_unstable.stderr rename src/test/{compile-fail => ui}/feature-gate-sanitizer-runtime.rs (100%) create mode 100644 src/test/ui/feature-gate-sanitizer-runtime.stderr rename src/test/{compile-fail => ui}/feature-gate-simd-ffi.rs (100%) create mode 100644 src/test/ui/feature-gate-simd-ffi.stderr rename src/test/{compile-fail => ui}/feature-gate-simd.rs (100%) create mode 100644 src/test/ui/feature-gate-simd.stderr rename src/test/{compile-fail => ui}/feature-gate-slice-patterns.rs (100%) create mode 100644 src/test/ui/feature-gate-slice-patterns.stderr rename src/test/{compile-fail => ui}/feature-gate-staged_api.rs (100%) create mode 100644 src/test/ui/feature-gate-staged_api.stderr rename src/test/{compile-fail => ui}/feature-gate-start.rs (100%) create mode 100644 src/test/ui/feature-gate-start.stderr rename src/test/{compile-fail => ui}/feature-gate-static-nobundle.rs (100%) create mode 100644 src/test/ui/feature-gate-static-nobundle.stderr rename src/test/{compile-fail => ui}/feature-gate-stmt_expr_attributes.rs (100%) create mode 100644 src/test/ui/feature-gate-stmt_expr_attributes.stderr rename src/test/{compile-fail/gated-target_feature.rs => ui/feature-gate-target_feature.rs} (95%) create mode 100644 src/test/ui/feature-gate-target_feature.stderr rename src/test/{compile-fail/gated-thread-local.rs => ui/feature-gate-thread_local.rs} (97%) create mode 100644 src/test/ui/feature-gate-thread_local.stderr rename src/test/{compile-fail/gated-trace_macros.rs => ui/feature-gate-trace_macros.rs} (95%) create mode 100644 src/test/ui/feature-gate-trace_macros.stderr rename src/test/{compile-fail/type-ascription-feature-gate.rs => ui/feature-gate-type_ascription.rs} (95%) create mode 100644 src/test/ui/feature-gate-type_ascription.stderr rename src/test/{compile-fail => ui}/feature-gate-unboxed-closures-manual-impls.rs (100%) create mode 100644 src/test/ui/feature-gate-unboxed-closures-manual-impls.stderr rename src/test/{compile-fail => ui}/feature-gate-unboxed-closures-method-calls.rs (100%) create mode 100644 src/test/ui/feature-gate-unboxed-closures-method-calls.stderr rename src/test/{compile-fail => ui}/feature-gate-unboxed-closures-ufcs-calls.rs (100%) create mode 100644 src/test/ui/feature-gate-unboxed-closures-ufcs-calls.stderr rename src/test/{compile-fail => ui}/feature-gate-unboxed-closures.rs (100%) create mode 100644 src/test/ui/feature-gate-unboxed-closures.stderr rename src/test/{compile-fail => ui}/feature-gate-underscore-lifetimes.rs (100%) create mode 100644 src/test/ui/feature-gate-underscore-lifetimes.stderr rename src/test/{compile-fail/impl-trait => ui}/feature-gate-universal.rs (100%) create mode 100644 src/test/ui/feature-gate-universal.stderr rename src/test/{compile-fail => ui}/feature-gate-unsized_tuple_coercion.rs (100%) create mode 100644 src/test/ui/feature-gate-unsized_tuple_coercion.stderr rename src/test/{compile-fail/union/union-feature-gate.rs => ui/feature-gate-untagged_unions.rs} (96%) create mode 100644 src/test/ui/feature-gate-untagged_unions.stderr rename src/test/{compile-fail => ui}/feature-gate-unwind-attributes.rs (100%) create mode 100644 src/test/ui/feature-gate-unwind-attributes.stderr create mode 100644 src/test/ui/feature-gate-use_nested_groups.rs create mode 100644 src/test/ui/feature-gate-use_nested_groups.stderr rename src/test/{compile-fail => ui}/feature-gate-used.rs (100%) create mode 100644 src/test/ui/feature-gate-used.stderr rename src/test/{compile-fail => ui}/feature-gate-wasm_import_memory.rs (100%) create mode 100644 src/test/ui/feature-gate-wasm_import_memory.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-bench.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-builtin-attrs.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-deprecated.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-deprecated.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-derive-2.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-derive.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-inline.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-macro_escape.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-macro_use.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-proc_macro_derive.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-rustc_deprecated.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-stable.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-test.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-test.stderr rename src/test/{compile-fail => ui}/feature-gate/issue-43106-gating-of-unstable.rs (100%) create mode 100644 src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr create mode 100644 src/test/ui/fmt/send-sync.rs create mode 100644 src/test/ui/fmt/send-sync.stderr rename src/test/{compile-fail => ui}/generic-type-less-params-with-defaults.rs (93%) create mode 100644 src/test/ui/generic-type-less-params-with-defaults.stderr rename src/test/{compile-fail => ui}/generic-type-more-params-with-defaults.rs (93%) create mode 100644 src/test/ui/generic-type-more-params-with-defaults.stderr rename src/test/{compile-fail => ui}/if-let-arm-types.rs (90%) create mode 100644 src/test/ui/if-let-arm-types.stderr rename src/test/{compile-fail => ui}/impl-duplicate-methods.rs (84%) create mode 100644 src/test/ui/impl-duplicate-methods.stderr rename src/test/{compile-fail => ui}/impl-trait/auto-trait-leak.rs (64%) create mode 100644 src/test/ui/impl-trait/auto-trait-leak.stderr rename src/test/{compile-fail => ui}/impl-unused-rps-in-assoc-type.rs (92%) create mode 100644 src/test/ui/impl-unused-rps-in-assoc-type.stderr rename src/test/{compile-fail => ui}/imports/auxiliary/two_macros.rs (100%) rename src/test/{compile-fail => ui}/imports/duplicate.rs (55%) create mode 100644 src/test/ui/imports/duplicate.stderr rename src/test/{compile-fail => ui}/imports/macro-paths.rs (59%) create mode 100644 src/test/ui/imports/macro-paths.stderr rename src/test/{compile-fail => ui}/imports/macros.rs (65%) create mode 100644 src/test/ui/imports/macros.stderr rename src/test/{compile-fail => ui}/imports/rfc-1560-warning-cycle.rs (74%) create mode 100644 src/test/ui/imports/rfc-1560-warning-cycle.stderr rename src/test/{compile-fail => ui}/imports/shadow_builtin_macros.rs (60%) create mode 100644 src/test/ui/imports/shadow_builtin_macros.stderr rename src/test/{compile-fail => ui}/impossible_range.rs (98%) create mode 100644 src/test/ui/impossible_range.stderr create mode 100644 src/test/ui/in-band-lifetimes/E0687.rs create mode 100644 src/test/ui/in-band-lifetimes/E0687.stderr create mode 100644 src/test/ui/in-band-lifetimes/E0687_where.rs create mode 100644 src/test/ui/in-band-lifetimes/E0687_where.stderr create mode 100644 src/test/ui/in-band-lifetimes/E0688.rs create mode 100644 src/test/ui/in-band-lifetimes/E0688.stderr create mode 100644 src/test/ui/in-band-lifetimes/mismatched.rs create mode 100644 src/test/ui/in-band-lifetimes/mismatched.stderr create mode 100644 src/test/ui/in-band-lifetimes/mismatched_trait.rs create mode 100644 src/test/ui/in-band-lifetimes/mismatched_trait.stderr create mode 100644 src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs create mode 100644 src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr create mode 100644 src/test/ui/in-band-lifetimes/mut_while_borrow.rs create mode 100644 src/test/ui/in-band-lifetimes/mut_while_borrow.stderr create mode 100644 src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs create mode 100644 src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr create mode 100644 src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs create mode 100644 src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr create mode 100644 src/test/ui/in-band-lifetimes/shadow.rs create mode 100644 src/test/ui/in-band-lifetimes/shadow.stderr create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-2.rs create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-2.stderr create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-3.rs create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-3.stderr create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-4.rs create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-4.stderr create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-5.rs create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes-5.stderr create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes.rs create mode 100644 src/test/ui/in-band-lifetimes/single_use_lifetimes.stderr rename src/test/{compile-fail => ui}/index-help.rs (87%) create mode 100644 src/test/ui/index-help.stderr create mode 100644 src/test/ui/inference-variable-behind-raw-pointer.rs create mode 100644 src/test/ui/inference-variable-behind-raw-pointer.stderr rename src/test/{compile-fail => ui}/invalid-path-in-const.rs (100%) create mode 100644 src/test/ui/invalid-path-in-const.stderr rename src/test/{compile-fail => ui}/issue-10969.rs (88%) create mode 100644 src/test/ui/issue-10969.stderr rename src/test/{compile-fail => ui}/issue-11004.rs (83%) create mode 100644 src/test/ui/issue-11004.stderr rename src/test/{compile-fail => ui}/issue-11319.rs (91%) create mode 100644 src/test/ui/issue-11319.stderr rename src/test/{compile-fail => ui}/issue-12187-1.rs (87%) create mode 100644 src/test/ui/issue-12187-1.stderr rename src/test/{compile-fail => ui}/issue-12187-2.rs (87%) create mode 100644 src/test/ui/issue-12187-2.stderr rename src/{tools/miri/tests/compile-fail/div-by-zero-2.rs => test/ui/issue-12511.rs} (76%) create mode 100644 src/test/ui/issue-12511.stderr rename src/test/{compile-fail => ui}/issue-13058.rs (97%) create mode 100644 src/test/ui/issue-13058.stderr rename src/test/{compile-fail => ui}/issue-14092.rs (93%) create mode 100644 src/test/ui/issue-14092.stderr rename src/test/{compile-fail => ui}/issue-15260.rs (73%) create mode 100644 src/test/ui/issue-15260.stderr rename src/test/{compile-fail => ui}/issue-15524.rs (76%) create mode 100644 src/test/ui/issue-15524.stderr rename src/test/{compile-fail => ui}/issue-17263.rs (74%) create mode 100644 src/test/ui/issue-17263.stderr rename src/test/{compile-fail => ui}/issue-17441.rs (79%) create mode 100644 src/test/ui/issue-17441.stderr rename src/test/{compile-fail => ui}/issue-18183.rs (85%) create mode 100644 src/test/ui/issue-18183.stderr rename src/test/{compile-fail => ui}/issue-18819.rs (91%) create mode 100644 src/test/ui/issue-18819.stderr rename src/test/{compile-fail => ui}/issue-19498.rs (64%) create mode 100644 src/test/ui/issue-19498.stderr rename src/test/{compile-fail => ui}/issue-1962.rs (100%) create mode 100644 src/test/ui/issue-1962.stderr rename src/test/{compile-fail => ui}/issue-19707.rs (78%) create mode 100644 src/test/ui/issue-19707.stderr rename src/test/{compile-fail => ui}/issue-19922.rs (86%) create mode 100644 src/test/ui/issue-19922.stderr rename src/test/{compile-fail/issue-26194.rs => ui/issue-20692.rs} (70%) create mode 100644 src/test/ui/issue-20692.stderr rename src/test/{compile-fail => ui}/issue-21546.rs (56%) create mode 100644 src/test/ui/issue-21546.stderr rename src/test/{compile-fail => ui}/issue-21600.rs (82%) create mode 100644 src/test/ui/issue-21600.stderr create mode 100644 src/test/ui/issue-21950.rs create mode 100644 src/test/ui/issue-21950.stderr rename src/test/{compile-fail => ui}/issue-22370.rs (80%) create mode 100644 src/test/ui/issue-22370.stderr rename src/{tools/miri/tests/compile-fail/div-by-zero.rs => test/ui/issue-22560.rs} (68%) create mode 100644 src/test/ui/issue-22560.stderr rename src/test/{compile-fail => ui}/issue-22886.rs (92%) create mode 100644 src/test/ui/issue-22886.stderr rename src/test/{compile-fail => ui}/issue-22933-2.rs (89%) create mode 100644 src/test/ui/issue-22933-2.stderr rename src/test/{compile-fail => ui}/issue-23041.rs (90%) create mode 100644 src/test/ui/issue-23041.stderr create mode 100644 src/test/ui/issue-23173.rs create mode 100644 src/test/ui/issue-23173.stderr rename src/test/{compile-fail => ui}/issue-23217.rs (88%) create mode 100644 src/test/ui/issue-23217.stderr rename src/test/{compile-fail => ui}/issue-23302.rs (77%) create mode 100644 src/test/ui/issue-23302.stderr rename src/test/{compile-fail => ui}/issue-23543.rs (92%) create mode 100644 src/test/ui/issue-23543.stderr rename src/test/{compile-fail => ui}/issue-23544.rs (92%) create mode 100644 src/test/ui/issue-23544.stderr rename src/test/{compile-fail => ui}/issue-23716.rs (90%) create mode 100644 src/test/ui/issue-23716.stderr rename src/{librustc_back/slice.rs => test/ui/issue-24036.rs} (61%) create mode 100644 src/test/ui/issue-24036.stderr rename src/test/{compile-fail => ui}/issue-24081.rs (56%) create mode 100644 src/test/ui/issue-24081.stderr rename src/test/{compile-fail => ui}/issue-24424.rs (95%) create mode 100644 src/test/ui/issue-24424.stderr rename src/test/{compile-fail => ui}/issue-25385.rs (94%) create mode 100644 src/test/ui/issue-25385.stderr rename src/test/{compile-fail => ui}/issue-25793.rs (86%) create mode 100644 src/test/ui/issue-25793.stderr rename src/test/{compile-fail => ui}/issue-25826.rs (93%) create mode 100644 src/test/ui/issue-25826.stderr rename src/test/{compile-fail => ui}/issue-26056.rs (86%) create mode 100644 src/test/ui/issue-26056.stderr rename src/test/{compile-fail => ui}/issue-26093.rs (86%) create mode 100644 src/test/ui/issue-26093.stderr rename src/test/{compile-fail => ui}/issue-26472.rs (91%) create mode 100644 src/test/ui/issue-26472.stderr delete mode 100644 src/test/ui/issue-26548.stderr rename src/test/{compile-fail => ui}/issue-26638.rs (77%) create mode 100644 src/test/ui/issue-26638.stderr rename src/test/{compile-fail => ui}/issue-26886.rs (75%) create mode 100644 src/test/ui/issue-26886.stderr rename src/test/{compile-fail => ui}/issue-27842.rs (83%) create mode 100644 src/test/ui/issue-27842.stderr rename src/test/{compile-fail => ui}/issue-27942.rs (65%) create mode 100644 src/test/ui/issue-27942.stderr rename src/test/{compile-fail => ui}/issue-2848.rs (84%) create mode 100644 src/test/ui/issue-2848.stderr rename src/test/{compile-fail => ui}/issue-28568.rs (88%) create mode 100644 src/test/ui/issue-28568.stderr rename src/test/{compile-fail => ui}/issue-28776.rs (93%) create mode 100644 src/test/ui/issue-28776.stderr rename src/test/{compile-fail => ui}/issue-28837.rs (57%) create mode 100644 src/test/ui/issue-28837.stderr rename src/test/{compile-fail => ui}/issue-28971.rs (87%) create mode 100644 src/test/ui/issue-28971.stderr rename src/test/{compile-fail => ui}/issue-29124.rs (86%) create mode 100644 src/test/ui/issue-29124.stderr rename src/test/{compile-fail => ui}/issue-30007.rs (88%) create mode 100644 src/test/ui/issue-30007.stderr rename src/test/{compile-fail => ui}/issue-3008-1.rs (85%) create mode 100644 src/test/ui/issue-3008-1.stderr rename src/test/{compile-fail => ui}/issue-3008-2.rs (86%) create mode 100644 src/test/ui/issue-3008-2.stderr rename src/test/{compile-fail => ui}/issue-30255.rs (78%) create mode 100644 src/test/ui/issue-30255.stderr rename src/test/{compile-fail => ui}/issue-30302.rs (92%) create mode 100644 src/test/ui/issue-30302.stderr rename src/test/{compile-fail => ui}/issue-3044.rs (94%) create mode 100644 src/test/ui/issue-3044.stderr rename src/test/{compile-fail => ui}/issue-30730.rs (82%) create mode 100644 src/test/ui/issue-30730.stderr rename src/test/{compile-fail => ui}/issue-31221.rs (72%) create mode 100644 src/test/ui/issue-31221.stderr rename src/test/{compile-fail => ui}/issue-32326.rs (83%) create mode 100644 src/test/ui/issue-32326.stderr rename src/test/{compile-fail => ui}/issue-32950.rs (93%) create mode 100644 src/test/ui/issue-32950.stderr rename src/test/{compile-fail => ui}/issue-34047.rs (83%) create mode 100644 src/test/ui/issue-34047.stderr rename src/test/{compile-fail => ui}/issue-34209.rs (84%) create mode 100644 src/test/ui/issue-34209.stderr rename src/test/{compile-fail => ui}/issue-35139.rs (92%) create mode 100644 src/test/ui/issue-35139.stderr rename src/test/{compile-fail => ui}/issue-35869.rs (66%) create mode 100644 src/test/ui/issue-35869.stderr rename src/test/{compile-fail => ui}/issue-36163.rs (77%) create mode 100644 src/test/ui/issue-36163.stderr rename src/test/{compile-fail => ui}/issue-36708.rs (92%) create mode 100644 src/test/ui/issue-36708.stderr rename src/test/{compile-fail => ui}/issue-3779.rs (86%) create mode 100644 src/test/ui/issue-3779.stderr rename src/test/{compile-fail => ui}/issue-37884.rs (76%) create mode 100644 src/test/ui/issue-37884.stderr rename src/test/{compile-fail => ui}/issue-4335.rs (83%) create mode 100644 src/test/ui/issue-4335.stderr create mode 100644 src/test/ui/issue-46186.rs create mode 100644 src/test/ui/issue-46186.stderr rename src/{tools/miri/tests/run-pass/issue-31267-additional.rs => test/ui/issue-46332.rs} (65%) create mode 100644 src/test/ui/issue-46332.stderr create mode 100644 src/test/ui/issue-46471-1.rs create mode 100644 src/test/ui/issue-46471-1.stderr rename src/test/{compile-fail/feature-gate-abi-sysv64.rs => ui/issue-46471.rs} (66%) create mode 100644 src/test/ui/issue-46471.stderr create mode 100644 src/test/ui/issue-46472.rs create mode 100644 src/test/ui/issue-46472.stderr create mode 100644 src/test/ui/issue-46576.rs create mode 100644 src/test/ui/issue-46576.stderr create mode 100644 src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs create mode 100644 src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr rename src/test/{compile-fail => ui}/issue-4935.rs (95%) create mode 100644 src/test/ui/issue-4935.stderr rename src/test/{compile-fail => ui}/issue-5239-1.rs (92%) create mode 100644 src/test/ui/issue-5239-1.stderr rename src/test/{compile-fail => ui}/issue-6458-3.rs (93%) create mode 100644 src/test/ui/issue-6458-3.stderr rename src/test/{compile-fail => ui}/issue-6458-4.rs (89%) create mode 100644 src/test/ui/issue-6458-4.stderr rename src/test/{compile-fail => ui}/issue-6458.rs (94%) create mode 100644 src/test/ui/issue-6458.stderr rename src/test/{compile-fail => ui}/issue-7813.rs (87%) create mode 100644 src/test/ui/issue-7813.stderr rename src/test/{compile-fail => ui}/lifetime-elision-return-type-requires-explicit-lifetime.rs (71%) create mode 100644 src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr create mode 100644 src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.rs create mode 100644 src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr rename src/test/{compile-fail => ui}/lint-forbid-attr.rs (89%) create mode 100644 src/test/ui/lint-forbid-attr.stderr rename src/test/{compile-fail => ui}/lint-output-format-2.rs (91%) create mode 100644 src/test/ui/lint-output-format-2.stderr rename src/test/{compile-fail => ui}/lint-unconditional-recursion.rs (68%) create mode 100644 src/test/ui/lint-unconditional-recursion.stderr rename src/test/{compile-fail => ui}/liveness-return-last-stmt-semi.rs (85%) create mode 100644 src/test/ui/liveness-return-last-stmt-semi.stderr rename src/test/{compile-fail => ui}/loops-reject-duplicate-labels-2.rs (65%) create mode 100644 src/test/ui/loops-reject-duplicate-labels-2.stderr rename src/test/{compile-fail => ui}/loops-reject-duplicate-labels.rs (63%) create mode 100644 src/test/ui/loops-reject-duplicate-labels.stderr rename src/test/{compile-fail => ui}/loops-reject-labels-shadowing-lifetimes.rs (70%) create mode 100644 src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr rename src/test/{compile-fail => ui}/loops-reject-lifetime-shadowing-label.rs (93%) create mode 100644 src/test/ui/loops-reject-lifetime-shadowing-label.stderr rename src/test/{compile-fail => ui}/macro-context.rs (76%) create mode 100644 src/test/ui/macro-context.stderr rename src/test/{compile-fail => ui}/macro-invalid-fragment-spec.rs (92%) create mode 100644 src/test/ui/macro-invalid-fragment-spec.stderr rename src/test/{compile-fail => ui}/macro-shadowing.rs (77%) create mode 100644 src/test/ui/macro-shadowing.stderr create mode 100644 src/test/ui/macro_backtrace/auxiliary/ping.rs rename src/{tools/miri/tests/run-pass-fullmir/unsized-tuple-impls.rs => test/ui/macro_backtrace/main.rs} (58%) create mode 100644 src/test/ui/macro_backtrace/main.stderr rename src/test/{compile-fail => ui}/main-wrong-location.rs (90%) create mode 100644 src/test/ui/main-wrong-location.stderr rename src/test/{compile-fail => ui}/maybe-bounds.rs (92%) create mode 100644 src/test/ui/maybe-bounds.stderr rename src/test/{compile-fail => ui}/method-missing-call.rs (90%) create mode 100644 src/test/ui/method-missing-call.stderr create mode 100644 src/test/ui/mismatched_types/recovered-block.rs create mode 100644 src/test/ui/mismatched_types/recovered-block.stderr rename src/test/{compile-fail => ui}/missing-block-hint.rs (85%) create mode 100644 src/test/ui/missing-block-hint.stderr create mode 100644 src/test/ui/missing_non_modrs_mod/foo.rs create mode 100644 src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs create mode 100644 src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr rename src/test/{compile-fail => ui}/moves-based-on-type-block-bad.rs (96%) create mode 100644 src/test/ui/moves-based-on-type-block-bad.stderr rename src/test/{compile-fail => ui}/moves-based-on-type-match-bindings.rs (95%) create mode 100644 src/test/ui/moves-based-on-type-match-bindings.stderr rename src/test/{compile-fail => ui}/moves-based-on-type-tuple.rs (77%) create mode 100644 src/test/ui/moves-based-on-type-tuple.stderr create mode 100644 src/test/ui/nll/capture-ref-in-struct.rs create mode 100644 src/test/ui/nll/capture-ref-in-struct.stderr create mode 100644 src/test/ui/nll/closure-requirements/escape-argument-callee.rs create mode 100644 src/test/ui/nll/closure-requirements/escape-argument-callee.stderr create mode 100644 src/test/ui/nll/closure-requirements/escape-argument.rs create mode 100644 src/test/ui/nll/closure-requirements/escape-argument.stderr create mode 100644 src/test/ui/nll/closure-requirements/escape-upvar-nested.rs create mode 100644 src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr create mode 100644 src/test/ui/nll/closure-requirements/escape-upvar-ref.rs create mode 100644 src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-val.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr create mode 100644 src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs create mode 100644 src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr create mode 100644 src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs create mode 100644 src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr create mode 100644 src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs create mode 100644 src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr rename src/test/ui/nll/{named-region-basic.rs => closure-requirements/region-lbr1-does-not-outlive-ebr2.rs} (84%) create mode 100644 src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr create mode 100644 src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs create mode 100644 src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs create mode 100644 src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr create mode 100644 src/test/ui/nll/constant.rs rename src/test/{mir-opt/nll/region-liveness-drop-may-dangle.rs => ui/nll/drop-may-dangle.rs} (66%) create mode 100644 src/test/ui/nll/drop-may-dangle.stderr create mode 100644 src/test/ui/nll/drop-no-may-dangle.rs create mode 100644 src/test/ui/nll/drop-no-may-dangle.stderr create mode 100644 src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs create mode 100644 src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr create mode 100644 src/test/ui/nll/maybe-initialized-drop-uninitialized.rs create mode 100644 src/test/ui/nll/maybe-initialized-drop-uninitialized.stderr create mode 100644 src/test/ui/nll/maybe-initialized-drop-with-fragment.rs create mode 100644 src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr create mode 100644 src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs create mode 100644 src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr create mode 100644 src/test/ui/nll/maybe-initialized-drop.rs create mode 100644 src/test/ui/nll/maybe-initialized-drop.stderr delete mode 100644 src/test/ui/nll/named-region-basic.stderr rename src/test/{parse-fail/keyword-crate-as-identifier.rs => ui/nll/projection-return.rs} (68%) create mode 100644 src/test/ui/nll/ty-outlives/impl-trait-captures.rs create mode 100644 src/test/ui/nll/ty-outlives/impl-trait-captures.stderr create mode 100644 src/test/ui/nll/ty-outlives/impl-trait-outlives.rs create mode 100644 src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr create mode 100644 src/test/ui/nll/ty-outlives/projection-implied-bounds.rs create mode 100644 src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr create mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs create mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr create mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs create mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr create mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-closure.rs create mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr create mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs create mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr create mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs create mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr create mode 100644 src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs create mode 100644 src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr create mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs create mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr create mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs create mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr create mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs create mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr create mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs create mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr create mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn-body.rs create mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr create mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn.rs create mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn.stderr rename src/test/{incremental/spans_insignificant_w_o_debuginfo.rs => ui/nll/ty-outlives/ty-param-implied-bounds.rs} (50%) create mode 100644 src/test/ui/nll/ty-outlives/ty-param-implied-bounds.stderr rename src/test/{compile-fail => ui}/no-patterns-in-args.rs (83%) create mode 100644 src/test/ui/no-patterns-in-args.stderr rename src/test/{compile-fail => ui}/non-constant-expr-for-arr-len.rs (94%) create mode 100644 src/test/ui/non-constant-expr-for-arr-len.stderr rename src/test/{compile-fail => ui}/non-exhaustive-pattern-witness.rs (86%) create mode 100644 src/test/ui/non-exhaustive-pattern-witness.stderr create mode 100644 src/test/ui/non_modrs_mods/foors_mod.rs create mode 100644 src/test/ui/non_modrs_mods/foors_mod/compiletest-ignore-dir create mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs create mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs create mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs create mode 100644 src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs create mode 100644 src/test/ui/non_modrs_mods/modrs_mod/compiletest-ignore-dir create mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs create mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs create mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs create mode 100644 src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs create mode 100644 src/test/ui/non_modrs_mods/modrs_mod/mod.rs create mode 100644 src/test/ui/non_modrs_mods/non_modrs_mods.rs create mode 100644 src/test/ui/non_modrs_mods/non_modrs_mods.stderr create mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs create mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir create mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs create mode 100644 src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs rename src/test/{compile-fail => ui}/not-enough-arguments.rs (92%) create mode 100644 src/test/ui/not-enough-arguments.stderr rename src/test/{compile-fail => ui}/numeric-fields.rs (82%) create mode 100644 src/test/ui/numeric-fields.stderr rename src/test/{compile-fail => ui}/object-safety-associated-consts.rs (84%) create mode 100644 src/test/ui/object-safety-associated-consts.stderr rename src/test/{compile-fail => ui}/object-safety-generics.rs (80%) create mode 100644 src/test/ui/object-safety-generics.stderr rename src/test/{compile-fail => ui}/object-safety-mentions-Self.rs (77%) create mode 100644 src/test/ui/object-safety-mentions-Self.stderr rename src/test/{compile-fail => ui}/object-safety-sized.rs (84%) create mode 100644 src/test/ui/object-safety-sized.stderr rename src/test/{compile-fail => ui}/object-safety-supertrait-mentions-Self.rs (83%) create mode 100644 src/test/ui/object-safety-supertrait-mentions-Self.stderr create mode 100644 src/test/ui/owl-import-generates-unused-import-lint.rs create mode 100644 src/test/ui/owl-import-generates-unused-import-lint.stderr rename src/{tools/miri/tests/run-pass/issue-34571.rs => test/ui/partialeq_help.rs} (85%) create mode 100644 src/test/ui/partialeq_help.stderr rename src/test/{compile-fail => ui}/pat-slice-old-style.rs (86%) create mode 100644 src/test/ui/pat-slice-old-style.stderr create mode 100644 src/test/ui/print_type_sizes/anonymous.stderr create mode 100644 src/test/ui/print_type_sizes/anonymous.stdout create mode 100644 src/test/ui/print_type_sizes/multiple_types.stderr rename src/test/ui/print_type_sizes/{nullable.rs => niche-filling.rs} (72%) create mode 100644 src/test/ui/print_type_sizes/niche-filling.stdout delete mode 100644 src/test/ui/print_type_sizes/nullable.stdout create mode 100644 src/test/ui/print_type_sizes/packed.stderr create mode 100644 src/test/ui/print_type_sizes/repr-align.stderr create mode 100644 src/test/ui/print_type_sizes/uninhabited.rs create mode 100644 src/test/ui/print_type_sizes/uninhabited.stdout rename src/test/{compile-fail => ui}/qualified-path-params-2.rs (84%) create mode 100644 src/test/ui/qualified-path-params-2.stderr rename src/test/{compile-fail => ui}/region-borrow-params-issue-29793-small.rs (73%) create mode 100644 src/test/ui/region-borrow-params-issue-29793-small.stderr rename src/test/{compile-fail => ui}/regions-nested-fns-2.rs (87%) create mode 100644 src/test/ui/regions-nested-fns-2.stderr rename src/test/{compile-fail => ui}/resolve-conflict-item-vs-import.rs (92%) create mode 100644 src/test/ui/resolve-conflict-item-vs-import.stderr rename src/test/{compile-fail => ui}/resolve-inconsistent-names.rs (74%) create mode 100644 src/test/ui/resolve-inconsistent-names.stderr rename src/{tools/miri/tests/run-pass/sendable-class.rs => test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs} (55%) create mode 100644 src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr create mode 100644 src/test/ui/rfc1598-generic-associated-types/empty_generics.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr create mode 100644 src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr create mode 100644 src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr create mode 100644 src/test/ui/rfc1598-generic-associated-types/iterable.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/iterable.stderr rename src/{tools/miri/tests/run-pass/move-arg-3-unique.rs => test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs} (70%) create mode 100644 src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/pointer_family.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr create mode 100644 src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr rename src/test/{compile-fail => ui}/self-impl.rs (79%) create mode 100644 src/test/ui/self-impl.stderr rename src/test/{compile-fail => ui}/shadowed-lifetime.rs (87%) create mode 100644 src/test/ui/shadowed-lifetime.stderr delete mode 100644 src/test/ui/span/loan-extend.rs rename src/test/{compile-fail/specialization => ui}/specialization-feature-gate-default.rs (100%) create mode 100644 src/test/ui/specialization-feature-gate-default.stderr rename src/test/{compile-fail/specialization => ui}/specialization-feature-gate-overlap.rs (100%) create mode 100644 src/test/ui/specialization-feature-gate-overlap.stderr rename src/test/{compile-fail => ui}/str-concat-on-double-ref.rs (87%) create mode 100644 src/test/ui/str-concat-on-double-ref.stderr rename src/test/{compile-fail => ui}/struct-fields-decl-dupe.rs (86%) create mode 100644 src/test/ui/struct-fields-decl-dupe.stderr rename src/test/{compile-fail => ui}/struct-fields-hints-no-dupe.rs (91%) create mode 100644 src/test/ui/struct-fields-hints-no-dupe.stderr rename src/test/{compile-fail => ui}/struct-fields-hints.rs (91%) create mode 100644 src/test/ui/struct-fields-hints.stderr rename src/test/{compile-fail => ui}/struct-fields-too-many.rs (86%) create mode 100644 src/test/ui/struct-fields-too-many.stderr rename src/test/{compile-fail => ui}/struct-path-self-type-mismatch.rs (67%) create mode 100644 src/test/ui/struct-path-self-type-mismatch.stderr rename src/test/{compile-fail => ui}/suggest-private-fields.rs (78%) create mode 100644 src/test/ui/suggest-private-fields.stderr create mode 100644 src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs create mode 100644 src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr create mode 100644 src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs create mode 100644 src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr create mode 100644 src/test/ui/suggestions/pub-ident-fn-2.rs create mode 100644 src/test/ui/suggestions/pub-ident-fn-2.stderr create mode 100644 src/test/ui/suggestions/pub-ident-fn-or-struct-2.rs create mode 100644 src/test/ui/suggestions/pub-ident-fn-or-struct-2.stderr create mode 100644 src/test/ui/suggestions/pub-ident-fn-or-struct.rs create mode 100644 src/test/ui/suggestions/pub-ident-fn-or-struct.stderr create mode 100644 src/test/ui/suggestions/pub-ident-fn.rs create mode 100644 src/test/ui/suggestions/pub-ident-fn.stderr create mode 100644 src/test/ui/suggestions/pub-ident-struct.rs create mode 100644 src/test/ui/suggestions/pub-ident-struct.stderr create mode 100644 src/test/ui/suggestions/return-type.rs create mode 100644 src/test/ui/suggestions/return-type.stderr create mode 100644 src/test/ui/suggestions/str-array-assignment.rs create mode 100644 src/test/ui/suggestions/str-array-assignment.stderr create mode 100644 src/test/ui/suggestions/str-as-char.rs create mode 100644 src/test/ui/suggestions/str-as-char.stderr rename src/test/{compile-fail => ui}/svh-change-lit.rs (87%) create mode 100644 src/test/ui/svh-change-lit.stderr rename src/test/{compile-fail => ui}/svh-change-significant-cfg.rs (87%) create mode 100644 src/test/ui/svh-change-significant-cfg.stderr rename src/test/{compile-fail => ui}/svh-change-trait-bound.rs (87%) create mode 100644 src/test/ui/svh-change-trait-bound.stderr rename src/test/{compile-fail => ui}/svh-change-type-arg.rs (87%) create mode 100644 src/test/ui/svh-change-type-arg.stderr rename src/test/{compile-fail => ui}/svh-change-type-ret.rs (87%) create mode 100644 src/test/ui/svh-change-type-ret.stderr rename src/test/{compile-fail => ui}/svh-change-type-static.rs (87%) create mode 100644 src/test/ui/svh-change-type-static.stderr rename src/test/{compile-fail => ui}/svh-use-trait.rs (89%) create mode 100644 src/test/ui/svh-use-trait.stderr create mode 100644 src/test/ui/switched-expectations.rs create mode 100644 src/test/ui/switched-expectations.stderr create mode 100644 src/test/ui/trait-alias.rs create mode 100644 src/test/ui/trait-alias.stderr rename src/test/{run-pass/issue-30276.rs => ui/trait-duplicate-methods.rs} (79%) create mode 100644 src/test/ui/trait-duplicate-methods.stderr rename src/test/{compile-fail => ui}/trait-safety-fn-body.rs (94%) create mode 100644 src/test/ui/trait-safety-fn-body.stderr create mode 100644 src/test/ui/trait-suggest-where-clause.rs create mode 100644 src/test/ui/trait-suggest-where-clause.stderr rename src/test/{compile-fail => ui}/traits-multidispatch-convert-ambig-dest.rs (96%) create mode 100644 src/test/ui/traits-multidispatch-convert-ambig-dest.stderr create mode 100644 src/test/ui/type-check/missing_trait_impl.rs create mode 100644 src/test/ui/type-check/missing_trait_impl.stderr rename src/test/{compile-fail => ui}/type-recursive.rs (82%) create mode 100644 src/test/ui/type-recursive.stderr rename src/test/{compile-fail => ui}/typeck-builtin-bound-type-parameters.rs (82%) create mode 100644 src/test/ui/typeck-builtin-bound-type-parameters.stderr rename src/test/{compile-fail => ui}/typeck-default-trait-impl-outside-crate.rs (91%) create mode 100644 src/test/ui/typeck-default-trait-impl-outside-crate.stderr rename src/test/{compile-fail => ui}/typeck_type_placeholder_item.rs (75%) create mode 100644 src/test/ui/typeck_type_placeholder_item.stderr rename src/test/{compile-fail => ui}/typeck_type_placeholder_lifetime_1.rs (95%) create mode 100644 src/test/ui/typeck_type_placeholder_lifetime_1.stderr rename src/test/{compile-fail => ui}/typeck_type_placeholder_lifetime_2.rs (95%) create mode 100644 src/test/ui/typeck_type_placeholder_lifetime_2.stderr rename src/test/{compile-fail/issue-23173.rs => ui/unboxed-closure-no-cyclic-sig.rs} (68%) create mode 100644 src/test/ui/unboxed-closure-no-cyclic-sig.stderr rename src/test/{compile-fail => ui}/unboxed-closure-sugar-wrong-trait.rs (88%) create mode 100644 src/test/ui/unboxed-closure-sugar-wrong-trait.stderr rename src/test/{compile-fail => ui}/unconstrained-none.rs (92%) create mode 100644 src/test/ui/unconstrained-none.stderr rename src/test/{compile-fail => ui}/unconstrained-ref.rs (91%) create mode 100644 src/test/ui/unconstrained-ref.stderr delete mode 100644 src/test/ui/union-fields.stderr rename src/test/{compile-fail => ui}/union/union-const-eval.rs (91%) create mode 100644 src/test/ui/union/union-const-eval.stderr rename src/test/{compile-fail => ui}/union/union-derive-eq.rs (100%) create mode 100644 src/test/ui/union/union-derive-eq.stderr rename src/test/ui/{union-fields.rs => union/union-fields-1.rs} (84%) create mode 100644 src/test/ui/union/union-fields-1.stderr rename src/test/{compile-fail/union/union-fields.rs => ui/union/union-fields-2.rs} (87%) create mode 100644 src/test/ui/union/union-fields-2.stderr create mode 100644 src/test/ui/union/union-sized-field.rs rename src/test/ui/{ => union}/union-sized-field.stderr (82%) rename src/test/{compile-fail => ui}/union/union-suggest-field.rs (86%) create mode 100644 src/test/ui/union/union-suggest-field.stderr rename src/test/{compile-fail => ui}/unsafe-const-fn.rs (95%) create mode 100644 src/test/ui/unsafe-const-fn.stderr rename src/test/{compile-fail => ui}/unsized-enum2.rs (100%) create mode 100644 src/test/ui/unsized-enum2.stderr rename src/test/{compile-fail => ui}/use-mod.rs (69%) create mode 100644 src/test/ui/use-mod.stderr rename src/test/{compile-fail => ui}/variadic-ffi-3.rs (87%) create mode 100644 src/test/ui/variadic-ffi-3.stderr rename src/test/{compile-fail => ui}/variance-unused-type-param.rs (93%) create mode 100644 src/test/ui/variance-unused-type-param.stderr rename src/test/{compile-fail => ui}/vector-no-ann.rs (86%) create mode 100644 src/test/ui/vector-no-ann.stderr create mode 100644 src/tools/clippy/tests/ui/clone_on_copy_mut.rs create mode 100644 src/tools/clippy/tests/ui/float_cmp_const.rs create mode 100644 src/tools/clippy/tests/ui/float_cmp_const.stderr create mode 100644 src/tools/clippy/tests/ui/ty_fn_sig.rs delete mode 100644 src/tools/miri/.editorconfig delete mode 100644 src/tools/miri/.travis.yml delete mode 100644 src/tools/miri/Cargo.lock delete mode 100644 src/tools/miri/Cargo.toml delete mode 100644 src/tools/miri/README.md delete mode 100644 src/tools/miri/appveyor.yml delete mode 100644 src/tools/miri/benches/fibonacci.rs delete mode 100644 src/tools/miri/benches/helpers/fibonacci_helper.rs delete mode 100644 src/tools/miri/benches/helpers/fibonacci_helper_iterative.rs delete mode 100644 src/tools/miri/benches/helpers/miri_helper.rs delete mode 100644 src/tools/miri/benches/helpers/mod.rs delete mode 100644 src/tools/miri/benches/helpers/repeat.rs delete mode 100644 src/tools/miri/benches/helpers/repeat_manual.rs delete mode 100644 src/tools/miri/benches/helpers/smoke_helper.rs delete mode 100644 src/tools/miri/benches/repeat.rs delete mode 100644 src/tools/miri/benches/smoke.rs delete mode 100644 src/tools/miri/build.rs delete mode 100644 src/tools/miri/cargo-miri-test/Cargo.lock delete mode 100644 src/tools/miri/cargo-miri-test/Cargo.toml delete mode 100644 src/tools/miri/cargo-miri-test/src/main.rs delete mode 100644 src/tools/miri/cargo-miri-test/tests/foo.rs delete mode 100644 src/tools/miri/miri/bin/cargo-miri.rs delete mode 100644 src/tools/miri/miri/bin/miri.rs delete mode 100644 src/tools/miri/miri/fn_call.rs delete mode 100644 src/tools/miri/miri/helpers.rs delete mode 100644 src/tools/miri/miri/intrinsic.rs delete mode 100644 src/tools/miri/miri/lib.rs delete mode 100644 src/tools/miri/miri/memory.rs delete mode 100644 src/tools/miri/miri/operator.rs delete mode 100644 src/tools/miri/miri/tls.rs delete mode 100644 src/tools/miri/rustc_tests/Cargo.lock delete mode 100644 src/tools/miri/rustc_tests/Cargo.toml delete mode 100644 src/tools/miri/rustc_tests/src/main.rs delete mode 100644 src/tools/miri/src/librustc_mir/Cargo.toml delete mode 100644 src/tools/miri/src/librustc_mir/interpret/const_eval.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/eval_context.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/lvalue.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/memory.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/mod.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/range_map.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/step.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/traits.rs delete mode 100644 src/tools/miri/src/librustc_mir/interpret/validation.rs delete mode 100644 src/tools/miri/src/librustc_mir/lib.rs delete mode 100644 src/tools/miri/tests/compile-fail-fullmir/undefined_byte_read.rs delete mode 100644 src/tools/miri/tests/compile-fail/alignment.rs delete mode 100644 src/tools/miri/tests/compile-fail/assume.rs delete mode 100644 src/tools/miri/tests/compile-fail/bitop-beyond-alignment.rs delete mode 100644 src/tools/miri/tests/compile-fail/cast_box_int_to_fn_ptr.rs delete mode 100644 src/tools/miri/tests/compile-fail/cast_fn_ptr.rs delete mode 100644 src/tools/miri/tests/compile-fail/cast_fn_ptr2.rs delete mode 100644 src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe.rs delete mode 100644 src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe2.rs delete mode 100644 src/tools/miri/tests/compile-fail/cast_int_to_fn_ptr.rs delete mode 100644 src/tools/miri/tests/compile-fail/copy_nonoverlapping.rs delete mode 100644 src/tools/miri/tests/compile-fail/ctlz_nonzero.rs delete mode 100644 src/tools/miri/tests/compile-fail/cttz_nonzero.rs delete mode 100644 src/tools/miri/tests/compile-fail/dangling_pointer_deref.rs delete mode 100644 src/tools/miri/tests/compile-fail/deallocate-bad-alignment.rs delete mode 100644 src/tools/miri/tests/compile-fail/deallocate-bad-size.rs delete mode 100644 src/tools/miri/tests/compile-fail/deallocate-twice.rs delete mode 100644 src/tools/miri/tests/compile-fail/deref_fn_ptr.rs delete mode 100644 src/tools/miri/tests/compile-fail/execute_memory.rs delete mode 100644 src/tools/miri/tests/compile-fail/fn_ptr_offset.rs delete mode 100644 src/tools/miri/tests/compile-fail/invalid_bool.rs delete mode 100644 src/tools/miri/tests/compile-fail/invalid_enum_discriminant.rs delete mode 100644 src/tools/miri/tests/compile-fail/match_char.rs delete mode 100644 src/tools/miri/tests/compile-fail/memleak.rs delete mode 100644 src/tools/miri/tests/compile-fail/memleak_rc.rs delete mode 100644 src/tools/miri/tests/compile-fail/modifying_constants.rs delete mode 100644 src/tools/miri/tests/compile-fail/never_say_never.rs delete mode 100644 src/tools/miri/tests/compile-fail/never_transmute_humans.rs delete mode 100644 src/tools/miri/tests/compile-fail/never_transmute_void.rs delete mode 100644 src/tools/miri/tests/compile-fail/null_pointer_deref.rs delete mode 100644 src/tools/miri/tests/compile-fail/oom.rs delete mode 100644 src/tools/miri/tests/compile-fail/oom2.rs delete mode 100644 src/tools/miri/tests/compile-fail/out_of_bounds_ptr_1.rs delete mode 100644 src/tools/miri/tests/compile-fail/out_of_bounds_ptr_2.rs delete mode 100644 src/tools/miri/tests/compile-fail/out_of_bounds_read.rs delete mode 100644 src/tools/miri/tests/compile-fail/out_of_bounds_read2.rs delete mode 100644 src/tools/miri/tests/compile-fail/overflowing-rsh-2.rs delete mode 100644 src/tools/miri/tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_undefined.rs delete mode 100644 src/tools/miri/tests/compile-fail/panic.rs delete mode 100644 src/tools/miri/tests/compile-fail/pointer_byte_read_1.rs delete mode 100644 src/tools/miri/tests/compile-fail/pointer_byte_read_2.rs delete mode 100644 src/tools/miri/tests/compile-fail/pointers_to_different_allocations_are_unorderable.rs delete mode 100644 src/tools/miri/tests/compile-fail/ptr_bitops.rs delete mode 100644 src/tools/miri/tests/compile-fail/ptr_int_cast.rs delete mode 100644 src/tools/miri/tests/compile-fail/ptr_offset_overflow.rs delete mode 100644 src/tools/miri/tests/compile-fail/reading_half_a_pointer.rs delete mode 100644 src/tools/miri/tests/compile-fail/reallocate-bad-alignment-2.rs delete mode 100644 src/tools/miri/tests/compile-fail/reallocate-bad-alignment.rs delete mode 100644 src/tools/miri/tests/compile-fail/reallocate-bad-size.rs delete mode 100644 src/tools/miri/tests/compile-fail/reallocate-change-alloc.rs delete mode 100644 src/tools/miri/tests/compile-fail/reallocate-dangling.rs delete mode 100644 src/tools/miri/tests/compile-fail/reference_to_packed.rs delete mode 100644 src/tools/miri/tests/compile-fail/repeat.rs delete mode 100644 src/tools/miri/tests/compile-fail/repeat2.rs delete mode 100644 src/tools/miri/tests/compile-fail/stack_free.rs delete mode 100644 src/tools/miri/tests/compile-fail/stack_limit.rs delete mode 100644 src/tools/miri/tests/compile-fail/static_memory_modification.rs delete mode 100644 src/tools/miri/tests/compile-fail/static_memory_modification2.rs delete mode 100644 src/tools/miri/tests/compile-fail/static_memory_modification3.rs delete mode 100644 src/tools/miri/tests/compile-fail/timeout.rs delete mode 100644 src/tools/miri/tests/compile-fail/transmute-pair-undef.rs delete mode 100644 src/tools/miri/tests/compile-fail/transmute_fat.rs delete mode 100644 src/tools/miri/tests/compile-fail/transmute_fat2.rs delete mode 100644 src/tools/miri/tests/compile-fail/unaligned_ptr_cast.rs delete mode 100644 src/tools/miri/tests/compile-fail/unaligned_ptr_cast2.rs delete mode 100644 src/tools/miri/tests/compile-fail/unaligned_ptr_cast_zst.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_aliasing_mut1.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_aliasing_mut2.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_aliasing_mut3.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_aliasing_mut4.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_buggy_as_mut_slice.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_buggy_split_at_mut.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_illegal_write.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_lock_confusion.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_pointer_smuggling.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_recover1.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_recover2.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_recover3.rs delete mode 100644 src/tools/miri/tests/compile-fail/validation_undef.rs delete mode 100644 src/tools/miri/tests/compile-fail/wild_pointer_deref.rs delete mode 100644 src/tools/miri/tests/compile-fail/zst.rs delete mode 100644 src/tools/miri/tests/compiletest.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/catch.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/catch.stdout delete mode 100644 src/tools/miri/tests/run-pass-fullmir/format.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/format.stdout delete mode 100644 src/tools/miri/tests/run-pass-fullmir/from_utf8.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/hashmap.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/heap.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/hello.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/hello.stdout delete mode 100644 src/tools/miri/tests/run-pass-fullmir/integer-ops.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/issue-15080.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/issue-3794.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/issue-3794.stdout delete mode 100644 src/tools/miri/tests/run-pass-fullmir/loop-break-value.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/regions-mock-trans.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/u128.rs delete mode 100644 src/tools/miri/tests/run-pass-fullmir/vecs.rs delete mode 100644 src/tools/miri/tests/run-pass/arrays.rs delete mode 100644 src/tools/miri/tests/run-pass/assume_bug.rs delete mode 100644 src/tools/miri/tests/run-pass/atomic-access-bool.rs delete mode 100644 src/tools/miri/tests/run-pass/atomic-compare_exchange.rs delete mode 100644 src/tools/miri/tests/run-pass/aux_test.rs delete mode 100644 src/tools/miri/tests/run-pass/auxiliary/dep.rs delete mode 100644 src/tools/miri/tests/run-pass/bad_substs.rs delete mode 100644 src/tools/miri/tests/run-pass/binops.rs delete mode 100644 src/tools/miri/tests/run-pass/bools.rs delete mode 100644 src/tools/miri/tests/run-pass/box_box_trait.rs delete mode 100644 src/tools/miri/tests/run-pass/btreemap.rs delete mode 100644 src/tools/miri/tests/run-pass/c_enums.rs delete mode 100644 src/tools/miri/tests/run-pass/call_drop_on_array_elements.rs delete mode 100644 src/tools/miri/tests/run-pass/call_drop_on_fat_ptr_array_elements.rs delete mode 100644 src/tools/miri/tests/run-pass/call_drop_on_zst_array_elements.rs delete mode 100644 src/tools/miri/tests/run-pass/call_drop_through_owned_slice.rs delete mode 100644 src/tools/miri/tests/run-pass/call_drop_through_trait_object.rs delete mode 100644 src/tools/miri/tests/run-pass/call_drop_through_trait_object_rc.rs delete mode 100644 src/tools/miri/tests/run-pass/calls.rs delete mode 100644 src/tools/miri/tests/run-pass/cast-rfc0401-vtable-kinds.rs delete mode 100644 src/tools/miri/tests/run-pass/cast_fn_ptr.rs delete mode 100644 src/tools/miri/tests/run-pass/cast_fn_ptr_unsafe.rs delete mode 100644 src/tools/miri/tests/run-pass/char.rs delete mode 100644 src/tools/miri/tests/run-pass/closure-drop.rs delete mode 100644 src/tools/miri/tests/run-pass/closure-field-ty.rs delete mode 100644 src/tools/miri/tests/run-pass/closures.rs delete mode 100644 src/tools/miri/tests/run-pass/const-vec-of-fns.rs delete mode 100644 src/tools/miri/tests/run-pass/constants.rs delete mode 100644 src/tools/miri/tests/run-pass/deriving-associated-types.rs delete mode 100644 src/tools/miri/tests/run-pass/drop_empty_slice.rs delete mode 100644 src/tools/miri/tests/run-pass/dst-field-align.rs delete mode 100644 src/tools/miri/tests/run-pass/dst-irrefutable-bind.rs delete mode 100644 src/tools/miri/tests/run-pass/dst-raw.rs delete mode 100644 src/tools/miri/tests/run-pass/dst-struct-sole.rs delete mode 100644 src/tools/miri/tests/run-pass/dst-struct.rs delete mode 100644 src/tools/miri/tests/run-pass/enum-nullable-const-null-with-fields.rs delete mode 100644 src/tools/miri/tests/run-pass/enums.rs delete mode 100644 src/tools/miri/tests/run-pass/float_fast_math.rs delete mode 100644 src/tools/miri/tests/run-pass/floats.rs delete mode 100644 src/tools/miri/tests/run-pass/fn_item_as_closure_trait_object.rs delete mode 100644 src/tools/miri/tests/run-pass/fn_item_with_args_as_closure_trait_object.rs delete mode 100644 src/tools/miri/tests/run-pass/fn_item_with_multiple_args_as_closure_trait_object.rs delete mode 100644 src/tools/miri/tests/run-pass/fn_ptr_as_closure_trait_object.rs delete mode 100644 src/tools/miri/tests/run-pass/function_pointers.rs delete mode 100644 src/tools/miri/tests/run-pass/generator_control_flow.rs delete mode 100644 src/tools/miri/tests/run-pass/intrinsics-integer.rs delete mode 100644 src/tools/miri/tests/run-pass/intrinsics-math.rs delete mode 100755 src/tools/miri/tests/run-pass/intrinsics.rs delete mode 100644 src/tools/miri/tests/run-pass/ints.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-15523-big.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-17877.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-20575.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-23261.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-29746.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-30530.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-36278-prefix-nesting.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-5917.rs delete mode 100644 src/tools/miri/tests/run-pass/issue-miri-184.rs delete mode 100644 src/tools/miri/tests/run-pass/iter_slice.rs delete mode 100644 src/tools/miri/tests/run-pass/loops.rs delete mode 100644 src/tools/miri/tests/run-pass/main_fn.rs delete mode 100644 src/tools/miri/tests/run-pass/many_shr_bor.rs delete mode 100644 src/tools/miri/tests/run-pass/match_slice.rs delete mode 100644 src/tools/miri/tests/run-pass/mir_coercions.rs delete mode 100644 src/tools/miri/tests/run-pass/mir_fat_ptr.rs delete mode 100644 src/tools/miri/tests/run-pass/miri-issue-133.rs delete mode 100644 src/tools/miri/tests/run-pass/move-undef-primval.rs delete mode 100644 src/tools/miri/tests/run-pass/multi_arg_closure.rs delete mode 100644 src/tools/miri/tests/run-pass/negative_discriminant.rs delete mode 100644 src/tools/miri/tests/run-pass/non_capture_closure_to_fn_ptr.rs delete mode 100644 src/tools/miri/tests/run-pass/observed_local_mut.rs delete mode 100644 src/tools/miri/tests/run-pass/option_box_transmute_ptr.rs delete mode 100644 src/tools/miri/tests/run-pass/option_eq.rs delete mode 100644 src/tools/miri/tests/run-pass/overloaded-calls-simple.rs delete mode 100644 src/tools/miri/tests/run-pass/packed_static.rs delete mode 100644 src/tools/miri/tests/run-pass/packed_struct.rs delete mode 100644 src/tools/miri/tests/run-pass/pointers.rs delete mode 100644 src/tools/miri/tests/run-pass/products.rs delete mode 100644 src/tools/miri/tests/run-pass/ptr_arith_offset.rs delete mode 100644 src/tools/miri/tests/run-pass/ptr_arith_offset_overflow.rs delete mode 100644 src/tools/miri/tests/run-pass/ptr_int_casts.rs delete mode 100644 src/tools/miri/tests/run-pass/ptr_offset.rs delete mode 100644 src/tools/miri/tests/run-pass/rc.rs delete mode 100644 src/tools/miri/tests/run-pass/recursive_static.rs delete mode 100644 src/tools/miri/tests/run-pass/ref-invalid-ptr.rs delete mode 100644 src/tools/miri/tests/run-pass/regions-lifetime-nonfree-late-bound.rs delete mode 100644 src/tools/miri/tests/run-pass/rfc1623.rs delete mode 100644 src/tools/miri/tests/run-pass/rust-lang-org.rs delete mode 100644 src/tools/miri/tests/run-pass/send-is-not-static-par-for.rs delete mode 100644 src/tools/miri/tests/run-pass/simd-intrinsic-generic-elements.rs delete mode 100644 src/tools/miri/tests/run-pass/slice-of-zero-size-elements.rs delete mode 100644 src/tools/miri/tests/run-pass/small_enum_size_bug.rs delete mode 100644 src/tools/miri/tests/run-pass/specialization.rs delete mode 100644 src/tools/miri/tests/run-pass/static_memory_modification.rs delete mode 100644 src/tools/miri/tests/run-pass/static_mut.rs delete mode 100644 src/tools/miri/tests/run-pass/std.rs delete mode 100644 src/tools/miri/tests/run-pass/strings.rs delete mode 100644 src/tools/miri/tests/run-pass/subslice_array.rs delete mode 100644 src/tools/miri/tests/run-pass/sums.rs delete mode 100644 src/tools/miri/tests/run-pass/tag-align-dyn-u64.rs delete mode 100644 src/tools/miri/tests/run-pass/thread-local.rs delete mode 100644 src/tools/miri/tests/run-pass/too-large-primval-write-problem.rs delete mode 100644 src/tools/miri/tests/run-pass/traits.rs delete mode 100644 src/tools/miri/tests/run-pass/trivial.rs delete mode 100644 src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor.rs delete mode 100644 src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_pointer_opt.rs delete mode 100644 src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs delete mode 100644 src/tools/miri/tests/run-pass/tuple_like_struct_constructor.rs delete mode 100644 src/tools/miri/tests/run-pass/union-overwrite.rs delete mode 100644 src/tools/miri/tests/run-pass/union.rs delete mode 100644 src/tools/miri/tests/run-pass/validation_lifetime_resolution.rs delete mode 100644 src/tools/miri/tests/run-pass/vec-matching-fold.rs delete mode 100644 src/tools/miri/tests/run-pass/write-bytes.rs delete mode 100644 src/tools/miri/tests/run-pass/zero-sized-binary-heap-push.rs delete mode 100644 src/tools/miri/tests/run-pass/zst.rs delete mode 100644 src/tools/miri/tests/run-pass/zst2.rs delete mode 100644 src/tools/miri/tests/run-pass/zst_box.rs delete mode 100644 src/tools/miri/tests/run-pass/zst_variant_drop.rs delete mode 100644 src/tools/miri/tex/final-presentation/latexmkrc delete mode 100644 src/tools/miri/tex/final-presentation/rust-logo-512x512.png delete mode 100644 src/tools/miri/tex/final-presentation/slides.tex delete mode 100644 src/tools/miri/tex/report/latexmkrc delete mode 100644 src/tools/miri/tex/report/miri-report.tex delete mode 100644 src/tools/miri/xargo/Cargo.lock delete mode 100644 src/tools/miri/xargo/Cargo.toml delete mode 100644 src/tools/miri/xargo/Xargo.toml delete mode 100755 src/tools/miri/xargo/build.sh create mode 100755 src/tools/publish_toolstate.py delete mode 100644 src/tools/toolstate.toml create mode 100644 src/vendor/aho-corasick/Cargo.toml.orig create mode 100644 src/vendor/ansi_term/Cargo.toml.orig create mode 100644 src/vendor/ansi_term/src/ansi.rs create mode 100644 src/vendor/ansi_term/src/debug.rs create mode 100644 src/vendor/ansi_term/src/difference.rs create mode 100644 src/vendor/ansi_term/src/display.rs create mode 100644 src/vendor/ansi_term/src/style.rs create mode 100644 src/vendor/ansi_term/src/windows.rs create mode 100644 src/vendor/ansi_term/src/write.rs create mode 100644 src/vendor/byteorder/.cargo-checksum.json create mode 100644 src/vendor/byteorder/.cargo-ok create mode 100644 src/vendor/byteorder/.gitignore create mode 100644 src/vendor/byteorder/.travis.yml create mode 100644 src/vendor/byteorder/CHANGELOG.md rename src/vendor/{memchr-1.0.2 => byteorder}/COPYING (100%) create mode 100644 src/vendor/byteorder/Cargo.toml create mode 100644 src/vendor/byteorder/Cargo.toml.orig rename src/vendor/{memchr-1.0.2 => byteorder}/LICENSE-MIT (100%) create mode 100644 src/vendor/byteorder/README.md rename src/vendor/{memchr-1.0.2 => byteorder}/UNLICENSE (100%) create mode 100644 src/vendor/byteorder/benches/bench.rs create mode 100644 src/vendor/byteorder/src/io.rs create mode 100644 src/vendor/byteorder/src/lib.rs rename src/vendor/{cargo_metadata => cargo_metadata-0.2.3}/.cargo-checksum.json (100%) create mode 100644 src/vendor/cargo_metadata-0.2.3/.cargo-ok rename src/vendor/{cargo_metadata => cargo_metadata-0.2.3}/.gitignore (100%) rename src/vendor/{cargo_metadata => cargo_metadata-0.2.3}/.travis.yml (100%) rename src/vendor/{cargo_metadata => cargo_metadata-0.2.3}/Cargo.toml (100%) rename src/vendor/{cargo_metadata => cargo_metadata-0.2.3}/src/lib.rs (100%) rename src/vendor/{cargo_metadata => cargo_metadata-0.2.3}/tests/selftest.rs (100%) create mode 100644 src/vendor/compiletest_rs/src/read2.rs delete mode 100644 src/vendor/flate2/examples/flatereadext.rs create mode 100644 src/vendor/fuchsia-zircon/src/cprng.rs create mode 100644 src/vendor/fuchsia-zircon/src/handle.rs create mode 100644 src/vendor/fuchsia-zircon/src/rights.rs create mode 100644 src/vendor/fuchsia-zircon/src/signals.rs create mode 100644 src/vendor/fuchsia-zircon/src/status.rs create mode 100644 src/vendor/fuchsia-zircon/src/time.rs delete mode 100644 src/vendor/fuchsia-zircon/src/timer.rs create mode 100644 src/vendor/fuchsia-zircon/src/vmar.rs delete mode 100644 src/vendor/fuchsia-zircon/tools/BUILD.gn delete mode 100644 src/vendor/fuchsia-zircon/tools/README.md delete mode 100644 src/vendor/fuchsia-zircon/tools/clang_wrapper.cc create mode 100644 src/vendor/html5ever/Cargo.toml.orig delete mode 100644 src/vendor/html5ever/src/tree_builder/actions.rs create mode 100644 src/vendor/lazy_static-0.2.11/.cargo-checksum.json create mode 100644 src/vendor/lazy_static-0.2.11/.cargo-ok create mode 100644 src/vendor/lazy_static-0.2.11/.gitignore create mode 100644 src/vendor/lazy_static-0.2.11/.travis.yml create mode 100644 src/vendor/lazy_static-0.2.11/Cargo.toml create mode 100644 src/vendor/lazy_static-0.2.11/Cargo.toml.orig rename src/{tools/miri => vendor/lazy_static-0.2.11}/LICENSE-APACHE (99%) rename src/{tools/miri => vendor/lazy_static-0.2.11}/LICENSE-MIT (95%) create mode 100644 src/vendor/lazy_static-0.2.11/README.md create mode 100644 src/vendor/lazy_static-0.2.11/appveyor.yml create mode 100644 src/vendor/lazy_static-0.2.11/src/core_lazy.rs create mode 100644 src/vendor/lazy_static-0.2.11/src/lazy.rs create mode 100644 src/vendor/lazy_static-0.2.11/src/lib.rs create mode 100644 src/vendor/lazy_static-0.2.11/src/nightly_lazy.rs create mode 100644 src/vendor/lazy_static-0.2.11/tests/compile-fail/README.md create mode 100644 src/vendor/lazy_static-0.2.11/tests/compile-fail/incorrect_visibility_restriction.rs create mode 100644 src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_private.rs create mode 100644 src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_sized.rs create mode 100644 src/vendor/lazy_static-0.2.11/tests/compile-fail/static_never_used.rs create mode 100644 src/vendor/lazy_static-0.2.11/tests/compile_tests.rs create mode 100644 src/vendor/lazy_static-0.2.11/tests/no_std.rs create mode 100644 src/vendor/lazy_static-0.2.11/tests/test.rs create mode 100644 src/vendor/libc/ci/linux-s390x.sh create mode 100644 src/vendor/libc/ci/linux-sparc64.sh create mode 100755 src/vendor/libc/ci/test-runner-linux create mode 100644 src/vendor/libc/src/fuchsia/aarch64.rs create mode 100644 src/vendor/libc/src/fuchsia/mod.rs create mode 100644 src/vendor/libc/src/fuchsia/powerpc64.rs create mode 100644 src/vendor/libc/src/fuchsia/x86_64.rs create mode 100644 src/vendor/libc/src/unix/newlib/aarch64/mod.rs create mode 100644 src/vendor/log-0.3.9/.cargo-checksum.json create mode 100644 src/vendor/log-0.3.9/.cargo-ok create mode 100644 src/vendor/log-0.3.9/.gitignore create mode 100644 src/vendor/log-0.3.9/.travis.yml create mode 100644 src/vendor/log-0.3.9/Cargo.toml create mode 100644 src/vendor/log-0.3.9/Cargo.toml.orig create mode 100644 src/vendor/log-0.3.9/LICENSE-APACHE create mode 100644 src/vendor/log-0.3.9/LICENSE-MIT create mode 100644 src/vendor/log-0.3.9/README.md create mode 100644 src/vendor/log-0.3.9/appveyor.yml create mode 100644 src/vendor/log-0.3.9/src/lib.rs create mode 100644 src/vendor/log-0.3.9/src/macros.rs create mode 100644 src/vendor/log/CHANGELOG.md create mode 100644 src/vendor/log/src/serde.rs create mode 100644 src/vendor/log_settings/.cargo-checksum.json create mode 100644 src/vendor/log_settings/.cargo-ok create mode 100644 src/vendor/log_settings/.gitignore create mode 100644 src/vendor/log_settings/Cargo.toml create mode 100644 src/vendor/log_settings/src/lib.rs create mode 100644 src/vendor/log_settings/tests/smoke.rs rename src/vendor/{memchr-1.0.2 => memchr}/.cargo-checksum.json (74%) create mode 100644 src/vendor/memchr/.cargo-ok rename src/vendor/{memchr-1.0.2 => memchr}/.gitignore (100%) rename src/vendor/{memchr-1.0.2 => memchr}/.travis.yml (100%) create mode 100644 src/vendor/memchr/COPYING rename src/vendor/{memchr-1.0.2 => memchr}/Cargo.toml (95%) rename src/vendor/{memchr-1.0.2 => memchr}/Cargo.toml.orig (89%) create mode 100644 src/vendor/memchr/LICENSE-MIT rename src/vendor/{memchr-1.0.2 => memchr}/Makefile (100%) rename src/vendor/{memchr-1.0.2 => memchr}/README.md (100%) create mode 100644 src/vendor/memchr/UNLICENSE rename src/vendor/{memchr-1.0.2 => memchr}/appveyor.yml (100%) rename src/vendor/{memchr-1.0.2 => memchr}/benches/bench.rs (100%) rename src/vendor/{memchr-1.0.2 => memchr}/ctags.rust (100%) rename src/vendor/{memchr-1.0.2 => memchr}/session.vim (100%) rename src/vendor/{memchr-1.0.2 => memchr}/src/lib.rs (72%) create mode 100644 src/vendor/num-traits/Cargo.toml.orig create mode 100644 src/vendor/parking_lot/.cargo-checksum.json create mode 100644 src/vendor/parking_lot/.cargo-ok create mode 100644 src/vendor/parking_lot/.gitignore create mode 100644 src/vendor/parking_lot/.travis.yml create mode 100644 src/vendor/parking_lot/Cargo.toml create mode 100644 src/vendor/parking_lot/Cargo.toml.orig create mode 100644 src/vendor/parking_lot/LICENSE-APACHE create mode 100644 src/vendor/parking_lot/LICENSE-MIT create mode 100644 src/vendor/parking_lot/README.md create mode 100644 src/vendor/parking_lot/appveyor.yml create mode 100644 src/vendor/parking_lot/src/condvar.rs create mode 100644 src/vendor/parking_lot/src/deadlock.rs create mode 100644 src/vendor/parking_lot/src/elision.rs create mode 100644 src/vendor/parking_lot/src/lib.rs create mode 100644 src/vendor/parking_lot/src/mutex.rs create mode 100644 src/vendor/parking_lot/src/once.rs create mode 100644 src/vendor/parking_lot/src/raw_mutex.rs create mode 100644 src/vendor/parking_lot/src/raw_remutex.rs create mode 100644 src/vendor/parking_lot/src/raw_rwlock.rs create mode 100644 src/vendor/parking_lot/src/remutex.rs create mode 100644 src/vendor/parking_lot/src/rwlock.rs create mode 100644 src/vendor/parking_lot/src/stable.rs create mode 100644 src/vendor/parking_lot/src/util.rs create mode 100644 src/vendor/parking_lot_core/.cargo-checksum.json create mode 100644 src/vendor/parking_lot_core/.cargo-ok create mode 100644 src/vendor/parking_lot_core/Cargo.toml create mode 100644 src/vendor/parking_lot_core/Cargo.toml.orig create mode 100644 src/vendor/parking_lot_core/src/lib.rs create mode 100644 src/vendor/parking_lot_core/src/parking_lot.rs create mode 100644 src/vendor/parking_lot_core/src/spinwait.rs create mode 100644 src/vendor/parking_lot_core/src/stable.rs create mode 100644 src/vendor/parking_lot_core/src/thread_parker/generic.rs create mode 100644 src/vendor/parking_lot_core/src/thread_parker/linux.rs create mode 100644 src/vendor/parking_lot_core/src/thread_parker/unix.rs create mode 100644 src/vendor/parking_lot_core/src/thread_parker/windows/keyed_event.rs create mode 100644 src/vendor/parking_lot_core/src/thread_parker/windows/mod.rs create mode 100644 src/vendor/parking_lot_core/src/thread_parker/windows/waitaddress.rs create mode 100644 src/vendor/parking_lot_core/src/util.rs create mode 100644 src/vendor/parking_lot_core/src/word_lock.rs create mode 100644 src/vendor/regex/Cargo.toml.orig delete mode 100644 src/vendor/regex/examples/bug347.rs delete mode 100644 src/vendor/regex/examples/shootout-regex-redux-1.rs delete mode 100644 src/vendor/regex/examples/shootout-regex-redux-chunked.rs delete mode 100644 src/vendor/regex/examples/shootout-regex-redux.rs create mode 100644 src/vendor/smallvec-0.3.3/.cargo-checksum.json create mode 100644 src/vendor/smallvec-0.3.3/.cargo-ok create mode 100644 src/vendor/smallvec-0.3.3/.gitignore create mode 100644 src/vendor/smallvec-0.3.3/.travis.yml create mode 100644 src/vendor/smallvec-0.3.3/Cargo.toml create mode 100644 src/vendor/smallvec-0.3.3/README.md create mode 100644 src/vendor/smallvec-0.3.3/benches/bench.rs create mode 100644 src/vendor/smallvec-0.3.3/lib.rs create mode 100644 src/vendor/smallvec/Cargo.toml.orig create mode 100644 src/vendor/smallvec/LICENSE create mode 100644 src/vendor/tar/Cargo.toml.orig create mode 100644 src/vendor/time/.cargo-checksum.json create mode 100644 src/vendor/time/.cargo-ok create mode 100644 src/vendor/time/.gitignore create mode 100644 src/vendor/time/.travis.yml create mode 100644 src/vendor/time/Cargo.toml create mode 100644 src/vendor/time/Cargo.toml.orig create mode 100644 src/vendor/time/LICENSE-APACHE create mode 100644 src/vendor/time/LICENSE-MIT create mode 100644 src/vendor/time/README.md create mode 100644 src/vendor/time/appveyor.yml create mode 100644 src/vendor/time/benches/precise_time_ns.rs create mode 100644 src/vendor/time/src/display.rs create mode 100644 src/vendor/time/src/duration.rs create mode 100644 src/vendor/time/src/lib.rs create mode 100644 src/vendor/time/src/parse.rs create mode 100644 src/vendor/time/src/sys.rs create mode 100644 src/vendor/winapi-0.2.8/.cargo-checksum.json create mode 100644 src/vendor/winapi-0.2.8/.cargo-ok create mode 100644 src/vendor/winapi-0.2.8/Cargo.toml rename src/vendor/{winapi => winapi-0.2.8}/LICENSE.md (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/activation.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/audioclient.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/audiosessiontypes.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/basetsd.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/bcrypt.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/cfg.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/cfgmgr32.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/combaseapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/commctrl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/commdlg.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/corsym.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d2d1.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d2dbasetypes.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d10shader.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d11.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d11shader.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d12.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d12sdklayers.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d12shader.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d9.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d9caps.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3d9types.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3dcommon.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/d3dcompiler.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dbghelp.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dcommon.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/devpropdef.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/docobj.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dpapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dsgetdc.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dsound.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dsrole.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dwmapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dwrite.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dxgi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dxgi1_2.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dxgi1_3.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dxgi1_4.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dxgiformat.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/dxgitype.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/errhandlingapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/excpt.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/fileapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/gl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/guiddef.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/heapapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/hidclass.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/hidpi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/hidsdi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/hidusage.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/hstring.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/http.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/imm.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/inaddr.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/inspectable.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ksmedia.rs (100%) create mode 100644 src/vendor/winapi-0.2.8/src/lib.rs rename src/vendor/{winapi => winapi-0.2.8}/src/libloaderapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/lmaccess.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/lmcons.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/lmdfs.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/lmerrlog.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/lmjoin.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/lsalookup.rs (100%) create mode 100644 src/vendor/winapi-0.2.8/src/macros.rs rename src/vendor/{winapi => winapi-0.2.8}/src/memoryapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/minschannel.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/minwinbase.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/minwindef.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/mmdeviceapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/mmreg.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/mmsystem.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/mscat.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/mssip.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/nb30.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ncrypt.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ntdef.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ntsecapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ntstatus.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/oaidl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/objbase.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/objidl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/objidlbase.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/olectl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/pdh.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/playsoundapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/processsnapshot.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/processthreadsapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/propidl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/propsys.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/prsht.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/psapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/qos.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/reason.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/restrictederrorinfo.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/roapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/roerrorapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/rpc.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/rpcdce.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/sapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/schannel.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/servprov.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/setupapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/shellapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/shellscalingapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/shlguid.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/shlobj.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/shobjidl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/shtypes.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/spapidef.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/sql.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/sqltypes.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/sspi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/strmif.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/subauth.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/synchapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/sysinfoapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/threadpoolapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/timezoneapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/tlhelp32.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/unknwnbase.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/urlhist.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/urlmon.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/usb.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/usbspec.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/usp10.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/vadefs.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/vsbackup.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/vss.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/vsserror.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/vswriter.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/werapi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winbase.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/wincon.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/wincred.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/wincrypt.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/windef.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/windowscodecs.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/windowsx.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winerror.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winevt.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/wingdi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winhttp.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winioctl.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winnetwk.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winnls.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winnt.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winreg.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winscard.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winsmcrd.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winsock2.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winspool.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winstring.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winsvc.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winusb.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winusbio.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/winuser.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ws2def.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ws2ipdef.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ws2spi.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/ws2tcpip.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/wtypes.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/wtypesbase.rs (100%) rename src/vendor/{winapi => winapi-0.2.8}/src/xinput.rs (100%) create mode 100644 src/vendor/winapi-i686-pc-windows-gnu/.cargo-checksum.json create mode 100644 src/vendor/winapi-i686-pc-windows-gnu/.cargo-ok create mode 100644 src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml create mode 100644 src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml.orig create mode 100644 src/vendor/winapi-i686-pc-windows-gnu/build.rs create mode 100644 src/vendor/winapi-i686-pc-windows-gnu/src/lib.rs create mode 100644 src/vendor/winapi-x86_64-pc-windows-gnu/.cargo-checksum.json create mode 100644 src/vendor/winapi-x86_64-pc-windows-gnu/.cargo-ok create mode 100644 src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml create mode 100644 src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml.orig create mode 100644 src/vendor/winapi-x86_64-pc-windows-gnu/build.rs create mode 100644 src/vendor/winapi-x86_64-pc-windows-gnu/src/lib.rs create mode 100644 src/vendor/winapi/Cargo.toml.orig create mode 100644 src/vendor/winapi/LICENSE-APACHE create mode 100644 src/vendor/winapi/LICENSE-MIT create mode 100644 src/vendor/winapi/README.md create mode 100644 src/vendor/winapi/build.rs create mode 100644 src/vendor/winapi/src/shared/basetsd.rs create mode 100644 src/vendor/winapi/src/shared/bcrypt.rs create mode 100644 src/vendor/winapi/src/shared/bugcodes.rs create mode 100644 src/vendor/winapi/src/shared/cderr.rs create mode 100644 src/vendor/winapi/src/shared/cfg.rs create mode 100644 src/vendor/winapi/src/shared/d3d9.rs create mode 100644 src/vendor/winapi/src/shared/d3d9caps.rs create mode 100644 src/vendor/winapi/src/shared/d3d9types.rs create mode 100644 src/vendor/winapi/src/shared/dcomptypes.rs create mode 100644 src/vendor/winapi/src/shared/devguid.rs create mode 100644 src/vendor/winapi/src/shared/devpkey.rs create mode 100644 src/vendor/winapi/src/shared/devpropdef.rs create mode 100644 src/vendor/winapi/src/shared/dinputd.rs create mode 100644 src/vendor/winapi/src/shared/dxgi.rs create mode 100644 src/vendor/winapi/src/shared/dxgi1_2.rs create mode 100644 src/vendor/winapi/src/shared/dxgi1_3.rs create mode 100644 src/vendor/winapi/src/shared/dxgi1_4.rs create mode 100644 src/vendor/winapi/src/shared/dxgi1_5.rs create mode 100644 src/vendor/winapi/src/shared/dxgiformat.rs create mode 100644 src/vendor/winapi/src/shared/dxgitype.rs create mode 100644 src/vendor/winapi/src/shared/guiddef.rs create mode 100644 src/vendor/winapi/src/shared/hidclass.rs create mode 100644 src/vendor/winapi/src/shared/hidpi.rs create mode 100644 src/vendor/winapi/src/shared/hidsdi.rs create mode 100644 src/vendor/winapi/src/shared/hidusage.rs create mode 100644 src/vendor/winapi/src/shared/in6addr.rs create mode 100644 src/vendor/winapi/src/shared/inaddr.rs create mode 100644 src/vendor/winapi/src/shared/intsafe.rs create mode 100644 src/vendor/winapi/src/shared/ksmedia.rs create mode 100644 src/vendor/winapi/src/shared/ktmtypes.rs create mode 100644 src/vendor/winapi/src/shared/lmcons.rs create mode 100644 src/vendor/winapi/src/shared/minwindef.rs create mode 100644 src/vendor/winapi/src/shared/mmreg.rs create mode 100644 src/vendor/winapi/src/shared/mod.rs create mode 100644 src/vendor/winapi/src/shared/mstcpip.rs create mode 100644 src/vendor/winapi/src/shared/ntddscsi.rs create mode 100644 src/vendor/winapi/src/shared/ntddser.rs create mode 100644 src/vendor/winapi/src/shared/ntdef.rs create mode 100644 src/vendor/winapi/src/shared/ntstatus.rs create mode 100644 src/vendor/winapi/src/shared/qos.rs create mode 100644 src/vendor/winapi/src/shared/rpc.rs create mode 100644 src/vendor/winapi/src/shared/rpcdce.rs create mode 100644 src/vendor/winapi/src/shared/rpcndr.rs create mode 100644 src/vendor/winapi/src/shared/sspi.rs create mode 100644 src/vendor/winapi/src/shared/stralign.rs create mode 100644 src/vendor/winapi/src/shared/usb.rs create mode 100644 src/vendor/winapi/src/shared/usbiodef.rs create mode 100644 src/vendor/winapi/src/shared/usbspec.rs create mode 100644 src/vendor/winapi/src/shared/windef.rs create mode 100644 src/vendor/winapi/src/shared/windowsx.rs create mode 100644 src/vendor/winapi/src/shared/winerror.rs create mode 100644 src/vendor/winapi/src/shared/winusbio.rs create mode 100644 src/vendor/winapi/src/shared/wnnc.rs create mode 100644 src/vendor/winapi/src/shared/ws2def.rs create mode 100644 src/vendor/winapi/src/shared/ws2ipdef.rs create mode 100644 src/vendor/winapi/src/shared/wtypes.rs create mode 100644 src/vendor/winapi/src/shared/wtypesbase.rs create mode 100644 src/vendor/winapi/src/um/audioclient.rs create mode 100644 src/vendor/winapi/src/um/audiosessiontypes.rs create mode 100644 src/vendor/winapi/src/um/avrt.rs create mode 100644 src/vendor/winapi/src/um/cfgmgr32.rs create mode 100644 src/vendor/winapi/src/um/cguid.rs create mode 100644 src/vendor/winapi/src/um/combaseapi.rs create mode 100644 src/vendor/winapi/src/um/coml2api.rs create mode 100644 src/vendor/winapi/src/um/commapi.rs create mode 100644 src/vendor/winapi/src/um/commctrl.rs create mode 100644 src/vendor/winapi/src/um/commdlg.rs create mode 100644 src/vendor/winapi/src/um/commoncontrols.rs create mode 100644 src/vendor/winapi/src/um/consoleapi.rs create mode 100644 src/vendor/winapi/src/um/corsym.rs create mode 100644 src/vendor/winapi/src/um/d2d1.rs create mode 100644 src/vendor/winapi/src/um/d2d1_1.rs create mode 100644 src/vendor/winapi/src/um/d2d1_2.rs create mode 100644 src/vendor/winapi/src/um/d2d1effectauthor.rs create mode 100644 src/vendor/winapi/src/um/d2d1effects.rs create mode 100644 src/vendor/winapi/src/um/d2d1effects_1.rs create mode 100644 src/vendor/winapi/src/um/d2d1effects_2.rs create mode 100644 src/vendor/winapi/src/um/d2dbasetypes.rs create mode 100644 src/vendor/winapi/src/um/d3d.rs create mode 100644 src/vendor/winapi/src/um/d3d10.rs create mode 100644 src/vendor/winapi/src/um/d3d10_1.rs create mode 100644 src/vendor/winapi/src/um/d3d10_1shader.rs create mode 100644 src/vendor/winapi/src/um/d3d10effect.rs create mode 100644 src/vendor/winapi/src/um/d3d10misc.rs create mode 100644 src/vendor/winapi/src/um/d3d10sdklayers.rs create mode 100644 src/vendor/winapi/src/um/d3d10shader.rs create mode 100644 src/vendor/winapi/src/um/d3d11.rs create mode 100644 src/vendor/winapi/src/um/d3d11_1.rs create mode 100644 src/vendor/winapi/src/um/d3d11_2.rs create mode 100644 src/vendor/winapi/src/um/d3d11_3.rs create mode 100644 src/vendor/winapi/src/um/d3d11_4.rs create mode 100644 src/vendor/winapi/src/um/d3d11on12.rs create mode 100644 src/vendor/winapi/src/um/d3d11sdklayers.rs create mode 100644 src/vendor/winapi/src/um/d3d11shader.rs create mode 100644 src/vendor/winapi/src/um/d3d12.rs create mode 100644 src/vendor/winapi/src/um/d3d12sdklayers.rs create mode 100644 src/vendor/winapi/src/um/d3d12shader.rs create mode 100644 src/vendor/winapi/src/um/d3dcommon.rs create mode 100644 src/vendor/winapi/src/um/d3dcompiler.rs create mode 100644 src/vendor/winapi/src/um/d3dcsx.rs create mode 100644 src/vendor/winapi/src/um/d3dx10core.rs create mode 100644 src/vendor/winapi/src/um/d3dx10math.rs create mode 100644 src/vendor/winapi/src/um/d3dx10mesh.rs create mode 100644 src/vendor/winapi/src/um/datetimeapi.rs create mode 100644 src/vendor/winapi/src/um/davclnt.rs create mode 100644 src/vendor/winapi/src/um/dbghelp.rs create mode 100644 src/vendor/winapi/src/um/dcommon.rs create mode 100644 src/vendor/winapi/src/um/dcomp.rs create mode 100644 src/vendor/winapi/src/um/dcompanimation.rs create mode 100644 src/vendor/winapi/src/um/dde.rs create mode 100644 src/vendor/winapi/src/um/ddraw.rs create mode 100644 src/vendor/winapi/src/um/ddrawi.rs create mode 100644 src/vendor/winapi/src/um/ddrawint.rs create mode 100644 src/vendor/winapi/src/um/debugapi.rs create mode 100644 src/vendor/winapi/src/um/dinput.rs create mode 100644 src/vendor/winapi/src/um/dmksctl.rs create mode 100644 src/vendor/winapi/src/um/dmusicc.rs create mode 100644 src/vendor/winapi/src/um/docobj.rs create mode 100644 src/vendor/winapi/src/um/documenttarget.rs create mode 100644 src/vendor/winapi/src/um/dpa_dsa.rs create mode 100644 src/vendor/winapi/src/um/dpapi.rs create mode 100644 src/vendor/winapi/src/um/dsgetdc.rs create mode 100644 src/vendor/winapi/src/um/dsound.rs create mode 100644 src/vendor/winapi/src/um/dsrole.rs create mode 100644 src/vendor/winapi/src/um/dvp.rs create mode 100644 src/vendor/winapi/src/um/dwmapi.rs create mode 100644 src/vendor/winapi/src/um/dwrite.rs create mode 100644 src/vendor/winapi/src/um/dwrite_1.rs create mode 100644 src/vendor/winapi/src/um/dwrite_2.rs create mode 100644 src/vendor/winapi/src/um/dwrite_3.rs create mode 100644 src/vendor/winapi/src/um/dxdiag.rs create mode 100644 src/vendor/winapi/src/um/dxfile.rs create mode 100644 src/vendor/winapi/src/um/dxgidebug.rs create mode 100644 src/vendor/winapi/src/um/errhandlingapi.rs create mode 100644 src/vendor/winapi/src/um/fibersapi.rs create mode 100644 src/vendor/winapi/src/um/fileapi.rs create mode 100644 src/vendor/winapi/src/um/gl/gl.rs create mode 100644 src/vendor/winapi/src/um/gl/mod.rs create mode 100644 src/vendor/winapi/src/um/handleapi.rs create mode 100644 src/vendor/winapi/src/um/heapapi.rs create mode 100644 src/vendor/winapi/src/um/http.rs create mode 100644 src/vendor/winapi/src/um/imm.rs create mode 100644 src/vendor/winapi/src/um/interlockedapi.rs create mode 100644 src/vendor/winapi/src/um/ioapiset.rs create mode 100644 src/vendor/winapi/src/um/jobapi.rs create mode 100644 src/vendor/winapi/src/um/jobapi2.rs create mode 100644 src/vendor/winapi/src/um/knownfolders.rs create mode 100644 src/vendor/winapi/src/um/ktmw32.rs create mode 100644 src/vendor/winapi/src/um/libloaderapi.rs create mode 100644 src/vendor/winapi/src/um/lmaccess.rs create mode 100644 src/vendor/winapi/src/um/lmalert.rs create mode 100644 src/vendor/winapi/src/um/lmapibuf.rs create mode 100644 src/vendor/winapi/src/um/lmat.rs create mode 100644 src/vendor/winapi/src/um/lmdfs.rs create mode 100644 src/vendor/winapi/src/um/lmerrlog.rs create mode 100644 src/vendor/winapi/src/um/lmjoin.rs create mode 100644 src/vendor/winapi/src/um/lmmsg.rs create mode 100644 src/vendor/winapi/src/um/lmremutl.rs create mode 100644 src/vendor/winapi/src/um/lmrepl.rs create mode 100644 src/vendor/winapi/src/um/lmserver.rs create mode 100644 src/vendor/winapi/src/um/lmshare.rs create mode 100644 src/vendor/winapi/src/um/lmstats.rs create mode 100644 src/vendor/winapi/src/um/lmsvc.rs create mode 100644 src/vendor/winapi/src/um/lmuse.rs create mode 100644 src/vendor/winapi/src/um/lmwksta.rs create mode 100644 src/vendor/winapi/src/um/lsalookup.rs create mode 100644 src/vendor/winapi/src/um/memoryapi.rs create mode 100644 src/vendor/winapi/src/um/minschannel.rs create mode 100644 src/vendor/winapi/src/um/minwinbase.rs create mode 100644 src/vendor/winapi/src/um/mmdeviceapi.rs create mode 100644 src/vendor/winapi/src/um/mmeapi.rs create mode 100644 src/vendor/winapi/src/um/mmsystem.rs create mode 100644 src/vendor/winapi/src/um/mod.rs create mode 100644 src/vendor/winapi/src/um/msaatext.rs create mode 100644 src/vendor/winapi/src/um/mscat.rs create mode 100644 src/vendor/winapi/src/um/mssip.rs create mode 100644 src/vendor/winapi/src/um/namedpipeapi.rs create mode 100644 src/vendor/winapi/src/um/namespaceapi.rs create mode 100644 src/vendor/winapi/src/um/nb30.rs create mode 100644 src/vendor/winapi/src/um/ncrypt.rs create mode 100644 src/vendor/winapi/src/um/ntsecapi.rs create mode 100644 src/vendor/winapi/src/um/oaidl.rs create mode 100644 src/vendor/winapi/src/um/objbase.rs create mode 100644 src/vendor/winapi/src/um/objidl.rs create mode 100644 src/vendor/winapi/src/um/objidlbase.rs create mode 100644 src/vendor/winapi/src/um/ocidl.rs create mode 100644 src/vendor/winapi/src/um/oleauto.rs create mode 100644 src/vendor/winapi/src/um/olectl.rs create mode 100644 src/vendor/winapi/src/um/pdh.rs create mode 100644 src/vendor/winapi/src/um/playsoundapi.rs create mode 100644 src/vendor/winapi/src/um/powerbase.rs create mode 100644 src/vendor/winapi/src/um/powersetting.rs create mode 100644 src/vendor/winapi/src/um/powrprof.rs create mode 100644 src/vendor/winapi/src/um/processenv.rs create mode 100644 src/vendor/winapi/src/um/processsnapshot.rs create mode 100644 src/vendor/winapi/src/um/processthreadsapi.rs create mode 100644 src/vendor/winapi/src/um/processtopologyapi.rs create mode 100644 src/vendor/winapi/src/um/profileapi.rs create mode 100644 src/vendor/winapi/src/um/propidl.rs create mode 100644 src/vendor/winapi/src/um/propkeydef.rs create mode 100644 src/vendor/winapi/src/um/propsys.rs create mode 100644 src/vendor/winapi/src/um/prsht.rs create mode 100644 src/vendor/winapi/src/um/psapi.rs create mode 100644 src/vendor/winapi/src/um/realtimeapiset.rs create mode 100644 src/vendor/winapi/src/um/reason.rs create mode 100644 src/vendor/winapi/src/um/restrictederrorinfo.rs create mode 100644 src/vendor/winapi/src/um/rmxfguid.rs create mode 100644 src/vendor/winapi/src/um/sapi.rs create mode 100644 src/vendor/winapi/src/um/sapi51.rs create mode 100644 src/vendor/winapi/src/um/sapi53.rs create mode 100644 src/vendor/winapi/src/um/sapiddk.rs create mode 100644 src/vendor/winapi/src/um/sapiddk51.rs create mode 100644 src/vendor/winapi/src/um/schannel.rs create mode 100644 src/vendor/winapi/src/um/securityappcontainer.rs create mode 100644 src/vendor/winapi/src/um/securitybaseapi.rs create mode 100644 src/vendor/winapi/src/um/servprov.rs create mode 100644 src/vendor/winapi/src/um/setupapi.rs create mode 100644 src/vendor/winapi/src/um/shellapi.rs create mode 100644 src/vendor/winapi/src/um/shellscalingapi.rs create mode 100644 src/vendor/winapi/src/um/shlobj.rs create mode 100644 src/vendor/winapi/src/um/shobjidl.rs create mode 100644 src/vendor/winapi/src/um/shobjidl_core.rs create mode 100644 src/vendor/winapi/src/um/shtypes.rs create mode 100644 src/vendor/winapi/src/um/spapidef.rs create mode 100644 src/vendor/winapi/src/um/sporder.rs create mode 100644 src/vendor/winapi/src/um/sql.rs create mode 100644 src/vendor/winapi/src/um/sqlext.rs create mode 100644 src/vendor/winapi/src/um/sqltypes.rs create mode 100644 src/vendor/winapi/src/um/sqlucode.rs create mode 100644 src/vendor/winapi/src/um/sspi.rs create mode 100644 src/vendor/winapi/src/um/stringapiset.rs create mode 100644 src/vendor/winapi/src/um/strmif.rs create mode 100644 src/vendor/winapi/src/um/subauth.rs create mode 100644 src/vendor/winapi/src/um/synchapi.rs create mode 100644 src/vendor/winapi/src/um/sysinfoapi.rs create mode 100644 src/vendor/winapi/src/um/systemtopologyapi.rs create mode 100644 src/vendor/winapi/src/um/textstor.rs create mode 100644 src/vendor/winapi/src/um/threadpoolapiset.rs create mode 100644 src/vendor/winapi/src/um/threadpoollegacyapiset.rs create mode 100644 src/vendor/winapi/src/um/timeapi.rs create mode 100644 src/vendor/winapi/src/um/timezoneapi.rs create mode 100644 src/vendor/winapi/src/um/tlhelp32.rs create mode 100644 src/vendor/winapi/src/um/unknwnbase.rs create mode 100644 src/vendor/winapi/src/um/urlhist.rs create mode 100644 src/vendor/winapi/src/um/urlmon.rs create mode 100644 src/vendor/winapi/src/um/userenv.rs create mode 100644 src/vendor/winapi/src/um/usp10.rs create mode 100644 src/vendor/winapi/src/um/utilapiset.rs create mode 100644 src/vendor/winapi/src/um/vsbackup.rs create mode 100644 src/vendor/winapi/src/um/vss.rs create mode 100644 src/vendor/winapi/src/um/vsserror.rs create mode 100644 src/vendor/winapi/src/um/vswriter.rs create mode 100644 src/vendor/winapi/src/um/werapi.rs create mode 100644 src/vendor/winapi/src/um/winbase.rs create mode 100644 src/vendor/winapi/src/um/wincodec.rs create mode 100644 src/vendor/winapi/src/um/wincodecsdk.rs create mode 100644 src/vendor/winapi/src/um/wincon.rs create mode 100644 src/vendor/winapi/src/um/wincred.rs create mode 100644 src/vendor/winapi/src/um/wincrypt.rs create mode 100644 src/vendor/winapi/src/um/windowsceip.rs create mode 100644 src/vendor/winapi/src/um/winevt.rs create mode 100644 src/vendor/winapi/src/um/wingdi.rs create mode 100644 src/vendor/winapi/src/um/winhttp.rs create mode 100644 src/vendor/winapi/src/um/wininet.rs create mode 100644 src/vendor/winapi/src/um/winineti.rs create mode 100644 src/vendor/winapi/src/um/winioctl.rs create mode 100644 src/vendor/winapi/src/um/winnetwk.rs create mode 100644 src/vendor/winapi/src/um/winnls.rs create mode 100644 src/vendor/winapi/src/um/winnt.rs create mode 100644 src/vendor/winapi/src/um/winreg.rs create mode 100644 src/vendor/winapi/src/um/winscard.rs create mode 100644 src/vendor/winapi/src/um/winsmcrd.rs create mode 100644 src/vendor/winapi/src/um/winsock2.rs create mode 100644 src/vendor/winapi/src/um/winspool.rs create mode 100644 src/vendor/winapi/src/um/winsvc.rs create mode 100644 src/vendor/winapi/src/um/winusb.rs create mode 100644 src/vendor/winapi/src/um/winuser.rs create mode 100644 src/vendor/winapi/src/um/winver.rs create mode 100644 src/vendor/winapi/src/um/wow64apiset.rs create mode 100644 src/vendor/winapi/src/um/ws2spi.rs create mode 100644 src/vendor/winapi/src/um/ws2tcpip.rs create mode 100644 src/vendor/winapi/src/um/xinput.rs create mode 100644 src/vendor/winapi/src/vc/excpt.rs create mode 100644 src/vendor/winapi/src/vc/limits.rs create mode 100644 src/vendor/winapi/src/vc/mod.rs create mode 100644 src/vendor/winapi/src/vc/vadefs.rs create mode 100644 src/vendor/winapi/src/vc/vcruntime.rs create mode 100644 src/vendor/winapi/src/winrt/activation.rs create mode 100644 src/vendor/winapi/src/winrt/hstring.rs create mode 100644 src/vendor/winapi/src/winrt/inspectable.rs create mode 100644 src/vendor/winapi/src/winrt/mod.rs create mode 100644 src/vendor/winapi/src/winrt/roapi.rs create mode 100644 src/vendor/winapi/src/winrt/robuffer.rs create mode 100644 src/vendor/winapi/src/winrt/roerrorapi.rs create mode 100644 src/vendor/winapi/src/winrt/winstring.rs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c296a28e9..54c507304f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,14 +112,17 @@ There are large number of options provided in this config file that will alter t configuration used in the build process. Some options to note: #### `[llvm]`: +- `assertions = true` = This enables LLVM assertions, which makes LLVM misuse cause an assertion failure instead of weird misbehavior. This also slows down the compiler's runtime by ~20%. - `ccache = true` - Use ccache when building llvm #### `[build]`: - `compiler-docs = true` - Build compiler documentation #### `[rust]`: -- `debuginfo = true` - Build a compiler with debuginfo -- `optimize = false` - Disable optimizations to speed up compilation of stage1 rust +- `debuginfo = true` - Build a compiler with debuginfo. Makes building rustc slower, but then you can use a debugger to debug `rustc`. +- `debuginfo-lines = true` - An alternative to `debuginfo = true` that doesn't let you use a debugger, but doesn't make building rustc slower and still gives you line numbers in backtraces. +- `debug-assertions = true` - Makes the log output of `debug!` work. +- `optimize = false` - Disable optimizations to speed up compilation of stage1 rust, but makes the stage1 compiler x100 slower. For more options, the `config.toml` file contains commented out defaults, with descriptions of what each option will do. @@ -273,6 +276,27 @@ build, you'll need to build rustdoc specially, since it's not normally built in stage 1. `python x.py build --stage 1 src/libstd src/tools/rustdoc` will build rustdoc and libstd, which will allow rustdoc to be run with that toolchain.) +### Out-of-tree builds +[out-of-tree-builds]: #out-of-tree-builds + +Rust's `x.py` script fully supports out-of-tree builds - it looks for +the Rust source code from the directory `x.py` was found in, but it +reads the `config.toml` configuration file from the directory it's +run in, and places all build artifacts within a subdirectory named `build`. + +This means that if you want to do an out-of-tree build, you can just do it: +``` +$ cd my/build/dir +$ cp ~/my-config.toml config.toml # Or fill in config.toml otherwise +$ path/to/rust/x.py build +... +$ # This will use the Rust source code in `path/to/rust`, but build +$ # artifacts will now be in ./build +``` + +It's absolutely fine to have multiple build directories with different +`config.toml` configurations using the same code. + ## Pull Requests [pull-requests]: #pull-requests @@ -336,7 +360,7 @@ will run all the tests on every platform we support. If it all works out, Speaking of tests, Rust has a comprehensive test suite. More information about it can be found -[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md). +[here](https://github.com/rust-lang/rust/blob/master/src/test/COMPILER_TESTS.md). ### External Dependencies [external-dependencies]: #external-dependencies @@ -345,26 +369,29 @@ Currently building Rust will also build the following external projects: * [clippy](https://github.com/rust-lang-nursery/rust-clippy) * [miri](https://github.com/solson/miri) +* [rustfmt](https://github.com/rust-lang-nursery/rustfmt) +* [rls](https://github.com/rust-lang-nursery/rls/) -If your changes break one of these projects, you need to fix them by opening -a pull request against the broken project asking to put the fix on a branch. -Then you can disable the tool building via `src/tools/toolstate.toml`. -Once the branch containing your fix is likely to be merged, you can point -the affected submodule at this branch. +We allow breakage of these tools in the nightly channel. Maintainers of these +projects will be notified of the breakages and should fix them as soon as +possible. -Don't forget to also add your changes with +After the external is fixed, one could add the changes with -``` +```sh git add path/to/submodule ``` outside the submodule. -In order to prepare your PR, you can run the build locally by doing +In order to prepare your tool-fixing PR, you can run the build locally by doing `./x.py build src/tools/TOOL`. If you will be editing the sources there, you may wish to set `submodules = false` in the `config.toml` to prevent `x.py` from resetting to the original branch. +Breakage is not allowed in the beta and stable channels, and must be addressed +before the PR is merged. + #### Breaking Tools Built With The Compiler [breaking-tools-built-with-the-compiler]: #breaking-tools-built-with-the-compiler @@ -382,12 +409,12 @@ tests. That means that, in the default state, you can't update the compiler without first fixing rustfmt, rls and the other tools that the compiler builds. -Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/pull/45243) -to make all of this easy to handle. The idea is that you mark the tools as "broken", +Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/issues/45861) +to make all of this easy to handle. The idea is that we allow these tools to be "broken", so that the rust-lang/rust build passes without trying to build them, then land the change in the compiler, wait for a nightly, and go update the tools that you broke. Once you're done -and the tools are working again, you go back in the compiler and change the tools back -from "broken". +and the tools are working again, you go back in the compiler and update the tools +so they can be distributed again. This should avoid a bunch of synchronization dances and is also much easier on contributors as there's no need to block on rls/rustfmt/other tools changes going upstream. @@ -406,22 +433,17 @@ Here are those same steps in detail: 4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be merged because CI will be broken. You'll want to write a message on the PR referencing your change, and how the PR should be merged once your change makes it into a nightly. -5. Update `src/tools/toolstate.toml` to indicate that the tool in question is "broken", - that will disable building it on CI. See the documentation in that file for the exact - configuration values you can use. -6. Commit the changes to `src/tools/toolstate.toml`, **do not update submodules in your commit**, - and then update the PR you have for rust-lang/rust. -7. Wait for your PR to merge. -8. Wait for a nightly -9. (optional) Help land your PR on the upstream repository now that your changes are in nightly. -10. (optional) Send a PR to rust-lang/rust updating the submodule, reverting `src/tools/toolstate.toml` back to a "building" or "testing" state. +5. Wait for your PR to merge. +6. Wait for a nightly +7. (optional) Help land your PR on the upstream repository now that your changes are in nightly. +8. (optional) Send a PR to rust-lang/rust updating the submodule. #### Updating submodules [updating-submodules]: #updating-submodules These instructions are specific to updating `rustfmt`, however they may apply to the other submodules as well. Please help by improving these instructions -if you find any discrepencies or special cases that need to be addressed. +if you find any discrepancies or special cases that need to be addressed. To update the `rustfmt` submodule, start by running the appropriate [`git submodule` command](https://git-scm.com/book/en/v2/Git-Tools-Submodules). @@ -446,14 +468,14 @@ failed to run: ~/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --ma If you haven't used the `[patch]` section of `Cargo.toml` before, there is [some relevant documentation about it in the cargo docs](http://doc.crates.io/manifest.html#the-patch-section). In -addition to that, you should read the +addition to that, you should read the [Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#overriding-dependencies) section of the documentation as well. Specifically, the following [section in Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#testing-a-bugfix) reveals what the problem is: > Next up we need to ensure that our lock file is updated to use this new version of uuid so our project uses the locally checked out copy instead of one from crates.io. The way [patch] works is that it'll load the dependency at ../path/to/uuid and then whenever crates.io is queried for versions of uuid it'll also return the local version. -> +> > This means that the version number of the local checkout is significant and will affect whether the patch is used. Our manifest declared uuid = "1.0" which means we'll only resolve to >= 1.0.0, < 2.0.0, and Cargo's greedy resolution algorithm also means that we'll resolve to the maximum version within that range. Typically this doesn't matter as the version of the git repository will already be greater or match the maximum version published on crates.io, but it's important to keep this in mind! This says that when we updated the submodule, the version number in our diff --git a/README.md b/README.md index 4fc003036e..589aa1afe3 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,9 @@ CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64. python x.py build ``` +If you are seeing build failure when compiling `rustc_binaryen`, make sure the path +length of the rust folder is not longer than 22 characters. + #### Specifying an ABI [specifying-an-abi]: #specifying-an-abi diff --git a/RELEASES.md b/RELEASES.md index 7a3b097611..e1f4a56646 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,13 +1,237 @@ -Version 1.22.0 (2017-11-23) +Version 1.24.1 (2018-03-01) +========================== + + - [Do not abort when unwinding through FFI][48251] + - [Emit UTF-16 files for linker arguments on Windows][48318] + - [Make the error index generator work again][48308] + - [Cargo will warn on Windows 7 if an update is needed][cargo/5069]. + +[48251]: https://github.com/rust-lang/rust/issues/48251 +[48308]: https://github.com/rust-lang/rust/issues/48308 +[48318]: https://github.com/rust-lang/rust/issues/48318 +[cargo/5069]: https://github.com/rust-lang/cargo/pull/5069 + +Version 1.24.0 (2018-02-15) +========================== + +Language +-------- +- [External `sysv64` ffi is now available.][46528] + eg. `extern "sysv64" fn foo () {}` + +Compiler +-------- +- [rustc now uses 16 codegen units by default for release builds.][46910] + For the fastest builds, utilize `codegen-units=1`. +- [Added `armv4t-unknown-linux-gnueabi` target.][47018] +- [Add `aarch64-unknown-openbsd` support][46760] + +Libraries +--------- +- [`str::find::` now uses memchr.][46735] This should lead to a 10x + improvement in performance in the majority of cases. +- [`OsStr`'s `Debug` implementation is now lossless and consistent + with Windows.][46798] +- [`time::{SystemTime, Instant}` now implement `Hash`.][46828] +- [impl `From` for `AtomicBool`][46293] +- [impl `From<{CString, &CStr}>` for `{Arc, Rc}`][45990] +- [impl `From<{OsString, &OsStr}>` for `{Arc, Rc}`][45990] +- [impl `From<{PathBuf, &Path}>` for `{Arc, Rc}`][45990] +- [float::from_bits now just uses transmute.][46012] This provides + some optimisations from LLVM. +- [Copied `AsciiExt` methods onto `char`][46077] +- [Remove `T: Sized` requirement on `ptr::is_null()`][46094] +- [impl `From` for `{TryRecvError, RecvTimeoutError}`][45506] +- [Optimised `f32::{min, max}` to generate more efficent x86 assembly][47080] +- [`[u8]::contains` now uses memchr which provides a 3x speed improvement][46713] + +Stabilized APIs +--------------- +- [`RefCell::replace`] +- [`RefCell::swap`] +- [`atomic::spin_loop_hint`] + +The following functions can now be used in a constant expression. +eg. `let buffer: [u8; size_of::()];`, `static COUNTER: AtomicUsize = AtomicUsize::new(1);` + +- [`AtomicBool::new`][46287] +- [`AtomicUsize::new`][46287] +- [`AtomicIsize::new`][46287] +- [`AtomicPtr::new`][46287] +- [`Cell::new`][46287] +- [`{integer}::min_value`][46287] +- [`{integer}::max_value`][46287] +- [`mem::size_of`][46287] +- [`mem::align_of`][46287] +- [`ptr::null`][46287] +- [`ptr::null_mut`][46287] +- [`RefCell::new`][46287] +- [`UnsafeCell::new`][46287] + +Cargo +----- +- [Added a `workspace.default-members` config that + overrides implied `--all` in virtual workspaces.][cargo/4743] +- [Enable incremental by default on development builds.][cargo/4817] Also added + configuration keys to `Cargo.toml` and `.cargo/config` to disable on a + per-project or global basis respectively. + +Misc +---- + +Compatibility Notes +------------------- +- [Floating point types `Debug` impl now always prints a decimal point.][46831] +- [`Ipv6Addr` now rejects superfluous `::`'s in IPv6 addresses][46671] This is + in accordance with IETF RFC 4291 §2.2. +- [Unwinding will no longer go past FFI boundaries, and will instead abort.][46833] +- [`Formatter::flags` method is now deprecated.][46284] The `sign_plus`, + `sign_minus`, `alternate`, and `sign_aware_zero_pad` should be used instead. +- [Leading zeros in tuple struct members is now an error][47084] +- [`column!()` macro is one-based instead of zero-based][46977] +- [`fmt::Arguments` can no longer be shared across threads][45198] +- [Access to `#[repr(packed)]` struct fields is now unsafe][44884] + +[44884]: https://github.com/rust-lang/rust/pull/44884 +[45198]: https://github.com/rust-lang/rust/pull/45198 +[45506]: https://github.com/rust-lang/rust/pull/45506 +[45904]: https://github.com/rust-lang/rust/pull/45904 +[45990]: https://github.com/rust-lang/rust/pull/45990 +[46012]: https://github.com/rust-lang/rust/pull/46012 +[46077]: https://github.com/rust-lang/rust/pull/46077 +[46094]: https://github.com/rust-lang/rust/pull/46094 +[46284]: https://github.com/rust-lang/rust/pull/46284 +[46287]: https://github.com/rust-lang/rust/pull/46287 +[46293]: https://github.com/rust-lang/rust/pull/46293 +[46528]: https://github.com/rust-lang/rust/pull/46528 +[46671]: https://github.com/rust-lang/rust/pull/46671 +[46713]: https://github.com/rust-lang/rust/pull/46713 +[46735]: https://github.com/rust-lang/rust/pull/46735 +[46749]: https://github.com/rust-lang/rust/pull/46749 +[46760]: https://github.com/rust-lang/rust/pull/46760 +[46798]: https://github.com/rust-lang/rust/pull/46798 +[46828]: https://github.com/rust-lang/rust/pull/46828 +[46831]: https://github.com/rust-lang/rust/pull/46831 +[46833]: https://github.com/rust-lang/rust/pull/46833 +[46910]: https://github.com/rust-lang/rust/pull/46910 +[46977]: https://github.com/rust-lang/rust/pull/46977 +[47018]: https://github.com/rust-lang/rust/pull/47018 +[47080]: https://github.com/rust-lang/rust/pull/47080 +[47084]: https://github.com/rust-lang/rust/pull/47084 +[cargo/4743]: https://github.com/rust-lang/cargo/pull/4743 +[cargo/4817]: https://github.com/rust-lang/cargo/pull/4817 +[`RefCell::replace`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.replace +[`RefCell::swap`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.swap +[`atomic::spin_loop_hint`]: https://doc.rust-lang.org/std/sync/atomic/fn.spin_loop_hint.html + + +Version 1.23.0 (2018-01-04) +========================== + +Language +-------- +- [Arbitrary `auto` traits are now permitted in trait objects.][45772] +- [rustc now uses subtyping on the left hand side of binary operations.][45435] + Which should fix some confusing errors in some operations. + +Compiler +-------- +- [Enabled `TrapUnreachable` in LLVM which should mitigate the impact of + undefined behaviour.][45920] +- [rustc now suggests renaming import if names clash.][45660] +- [Display errors/warnings correctly when there are zero-width or + wide characters.][45711] +- [rustc now avoids unnecessary copies of arguments that are + simple bindings][45380] This should improve memory usage on average by 5-10%. +- [Updated musl used to build musl rustc to 1.1.17][45393] + +Libraries +--------- +- [Allow a trailing comma in `assert_eq/ne` macro][45887] +- [Implement Hash for raw pointers to unsized types][45483] +- [impl `From<*mut T>` for `AtomicPtr`][45610] +- [impl `From` for `AtomicUsize/AtomicIsize`.][45610] +- [Removed the `T: Sync` requirement for `RwLock: Send`][45267] +- [Removed `T: Sized` requirement for `{<*const T>, <*mut T>}::as_ref` + and `<*mut T>::as_mut`][44932] +- [Optimized `Thread::{park, unpark}` implementation][45524] +- [Improved `SliceExt::binary_search` performance.][45333] +- [impl `FromIterator<()>` for `()`][45379] +- [Copied `AsciiExt` trait methods to primitive types.][44042] Use of `AsciiExt` + is now deprecated. + +Stabilized APIs +--------------- + +Cargo +----- +- [Cargo now supports alternative registries][cargo/4506] +- [Cargo now supports uninstallation of multiple packages][cargo/4561] + eg. `cargo uninstall foo bar` uninstalls `foo` and `bar`. +- [Added unit test checking to `cargo check`][cargo/4592] +- [Cargo now lets you install a specific version + using `cargo install --version`][cargo/4637] + +Misc +---- +- [Releases now ship with the Cargo book documentation.][45692] +- [rustdoc now prints rendering warnings on every run.][45324] +- [Release tarballs now come with rustfmt][45903] + +Compatibility Notes +------------------- +- [Changes have been made to type equality to make it more correct, + in rare cases this could break some code.][45853] [Tracking issue for + further information][45852] +- [`char::escape_debug` now uses Unicode 10 over 9.][45571] +- [Upgraded Android SDK to 27, and NDK to r15c.][45580] This drops support for + Android 9, the minimum supported version is Android 14. +- [Bumped the minimum LLVM to 3.9][45326] + +[44042]: https://github.com/rust-lang/rust/pull/44042 +[44932]: https://github.com/rust-lang/rust/pull/44932 +[45267]: https://github.com/rust-lang/rust/pull/45267 +[45324]: https://github.com/rust-lang/rust/pull/45324 +[45326]: https://github.com/rust-lang/rust/pull/45326 +[45333]: https://github.com/rust-lang/rust/pull/45333 +[45379]: https://github.com/rust-lang/rust/pull/45379 +[45380]: https://github.com/rust-lang/rust/pull/45380 +[45393]: https://github.com/rust-lang/rust/pull/45393 +[45435]: https://github.com/rust-lang/rust/pull/45435 +[45483]: https://github.com/rust-lang/rust/pull/45483 +[45524]: https://github.com/rust-lang/rust/pull/45524 +[45571]: https://github.com/rust-lang/rust/pull/45571 +[45580]: https://github.com/rust-lang/rust/pull/45580 +[45610]: https://github.com/rust-lang/rust/pull/45610 +[45660]: https://github.com/rust-lang/rust/pull/45660 +[45692]: https://github.com/rust-lang/rust/pull/45692 +[45711]: https://github.com/rust-lang/rust/pull/45711 +[45772]: https://github.com/rust-lang/rust/pull/45772 +[45852]: https://github.com/rust-lang/rust/issues/45852 +[45853]: https://github.com/rust-lang/rust/pull/45853 +[45887]: https://github.com/rust-lang/rust/pull/45887 +[45903]: https://github.com/rust-lang/rust/pull/45903 +[45920]: https://github.com/rust-lang/rust/pull/45920 +[cargo/4506]: https://github.com/rust-lang/cargo/pull/4506 +[cargo/4561]: https://github.com/rust-lang/cargo/pull/4561 +[cargo/4592]: https://github.com/rust-lang/cargo/pull/4592 +[cargo/4637]: https://github.com/rust-lang/cargo/pull/4637 + + +Version 1.22.1 (2017-11-22) +========================== + +- [Update Cargo to fix an issue with macOS 10.13 "High Sierra"][46183] + +[46183]: https://github.com/rust-lang/rust/pull/46183 + +Version 1.22.0 (2017-11-22) ========================== Language -------- - [`non_snake_case` lint now allows extern no-mangle functions][44966] - [Now accepts underscores in unicode escapes][43716] -- [`#![feature(const_fn)]` is now no longer required for - calling const functions.][43017] It's still required for creating - constant functions. - [`T op= &T` now works for numeric types.][44287] eg. `let mut x = 2; x += &8;` - [types that impl `Drop` are now allowed in `const` and `static` types][44456] @@ -45,8 +269,8 @@ Cargo Misc ---- - [`libbacktrace` is now available on Apple platforms.][44251] -- [Stabilised the `compile_fail` attribute for code fences.][43949] This now - lets you specify that a given code example will fail to compile. +- [Stabilised the `compile_fail` attribute for code fences in doc-comments.][43949] + This now lets you specify that a given code example will fail to compile. Compatibility Notes ------------------- @@ -624,7 +848,7 @@ Misc ---- - [rustdoc can now use pulldown-cmark with the `--enable-commonmark` flag][40338] -- [Added rust-winbg script for better debugging on Windows][39983] +- [Added rust-windbg script for better debugging on Windows][39983] - [Rust now uses the official cross compiler for NetBSD][40612] - [rustdoc now accepts `#` at the start of files][40828] - [Fixed jemalloc support for musl][41168] @@ -1658,7 +1882,7 @@ Diagnostics ----------- * [Replace macro backtraces with labeled local uses][35702] -* [Improve error message for missplaced doc comments][33922] +* [Improve error message for misplaced doc comments][33922] * [Buffer unix and lock windows to prevent message interleaving][35975] * [Update lifetime errors to specifically note temporaries][36171] * [Special case a few colors for Windows][36178] @@ -1966,7 +2190,7 @@ Language useful](https://github.com/rust-lang/rust/pull/34908) * [`macro_rules!` `stmt` matchers correctly consume the entire contents when inside non-braces invocations](https://github.com/rust-lang/rust/pull/34886) -* [Semicolons are properly required as statement delimeters inside +* [Semicolons are properly required as statement delimiters inside `macro_rules!` invocations](https://github.com/rust-lang/rust/pull/34660) * [`cfg_attr` works on `path` attributes](https://github.com/rust-lang/rust/pull/34546) @@ -2191,7 +2415,7 @@ Compatibility Notes * [`const`s and `static`s may not have unsized types](https://github.com/rust-lang/rust/pull/34443) * [The new follow-set rules that place restrictions on `macro_rules!` in order to ensure syntax forward-compatibility have been enabled](https://github.com/rust-lang/rust/pull/33982) - This was an [ammendment to RFC 550](https://github.com/rust-lang/rfcs/pull/1384), + This was an [amendment to RFC 550](https://github.com/rust-lang/rfcs/pull/1384), and has been a warning since 1.10. * [`cfg` attribute process has been refactored to fix various bugs](https://github.com/rust-lang/rust/pull/33706). This causes breakage in some corner cases. @@ -3348,7 +3572,7 @@ Libraries * `FromStr` is [implemented for `SockAddrV4` and `SockAddrV6`][1.5s]. * There are now `From` conversions [between floating point types][1.5f] where the conversions are lossless. -* Thera are now `From` conversions [between integer types][1.5i] where +* There are now `From` conversions [between integer types][1.5i] where the conversions are lossless. * [`fs::Metadata` implements `Clone`][1.5fs]. * The `parse` method [accepts a leading "+" when parsing @@ -3548,7 +3772,7 @@ Libraries * [`IntoIterator` is implemented for references to `Option` and `Result`][into2]. * [`HashMap` and `HashSet` implement `Extend<&T>` where `T: - Copy`][ext] as part of [RFC 839]. This will cause type inferance + Copy`][ext] as part of [RFC 839]. This will cause type inference breakage in rare situations. * [`BinaryHeap` implements `Debug`][bh2]. * [`Borrow` and `BorrowMut` are implemented for fixed-size @@ -3559,7 +3783,7 @@ Libraries * `&mut T` where `T: std::fmt::Write` [also implements `std::fmt::Write`][mutw]. * [A stable regression in `VecDeque::push_back` and other - capicity-altering methods that caused panics for zero-sized types + capacity-altering methods that caused panics for zero-sized types was fixed][vd]. * [Function pointers implement traits for up to 12 parameters][fp2]. @@ -3746,7 +3970,7 @@ Libraries [better for long data][sh]. * [`AtomicPtr`] implements [`Send`]. * The [`read_to_end`] implementations for [`Stdin`] and [`File`] - are now [specialized to use uninitalized buffers for increased + are now [specialized to use uninitialized buffers for increased performance][rte]. * Lifetime parameters of foreign functions [are now resolved properly][f]. @@ -3875,7 +4099,7 @@ Highlights * This is the first release with [experimental support for linking with the MSVC linker and lib C on Windows (instead of using the GNU variants via MinGW)][win]. It is yet recommended only for the most - intrepid Rusticians. + intrepid Rustaceans. * Benchmark compilations are showing a 30% improvement in bootstrapping over 1.1. @@ -4741,7 +4965,7 @@ Version 0.11.0 (2014-07-02) * Libraries * The standard library is now a "facade" over a number of underlying libraries. This means that development on the standard library should - be speeder due to smaller crates, as well as a clearer line between + be speedier due to smaller crates, as well as a clearer line between all dependencies. * A new library, libcore, lives under the standard library's facade which is Rust's "0-assumption" library, suitable for embedded and diff --git a/config.toml.example b/config.toml.example index df0142b8d4..18c1f160c0 100644 --- a/config.toml.example +++ b/config.toml.example @@ -60,10 +60,9 @@ # LLVM experimental targets to build support for. These targets are specified in # the same format as above, but since these targets are experimental, they are # not built by default and the experimental Rust compilation targets that depend -# on them will not work unless the user opts in to building them. Possible -# experimental LLVM targets include WebAssembly for the -# wasm32-experimental-emscripten Rust target. -#experimental-targets = "" +# on them will not work unless the user opts in to building them. By default the +# `WebAssembly` target is enabled when compiling LLVM from scratch. +#experimental-targets = "WebAssembly" # Cap the number of parallel linker invocations when compiling LLVM. # This can be useful when building LLVM with debug info, which significantly @@ -302,6 +301,10 @@ # As a side-effect also generates MIR for all libraries. #test-miri = false +# After building or testing extended tools (e.g. clippy and rustfmt), append the +# result (broken, compiling, testing) into this JSON file. +#save-toolstates = "/path/to/toolstates.json" + # ============================================================================= # Options for specific targets # diff --git a/git-commit-hash b/git-commit-hash index 34a7e68880..52f9237c53 100644 --- a/git-commit-hash +++ b/git-commit-hash @@ -1 +1 @@ -766bd11c8a3c019ca53febdcd77b2215379dd67d \ No newline at end of file +d3ae9a9e08edf12de0ed82af57ba2a56c26496ea \ No newline at end of file diff --git a/src/Cargo.lock b/src/Cargo.lock index b9493a9998..56db3ad74a 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -17,10 +17,10 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -28,7 +28,7 @@ name = "alloc" version = "0.0.0" dependencies = [ "core 0.0.0", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "std_unicode 0.0.0", ] @@ -56,7 +56,7 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -74,7 +74,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -88,7 +88,7 @@ dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -99,7 +99,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -127,15 +127,16 @@ version = "0.0.0" dependencies = [ "build_helper 0.1.0", "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -152,8 +153,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "build-manifest" version = "0.1.0" dependencies = [ - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -164,25 +165,30 @@ dependencies = [ "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "byteorder" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cargo" -version = "0.24.0" +version = "0.25.0" dependencies = [ "atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "cargotest 0.1.0", - "core-foundation 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "crates-io 0.13.0", + "core-foundation 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crates-io 0.14.0", "crossbeam 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "fs2 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "git2-curl 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -191,21 +197,21 @@ dependencies = [ "ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "psapi-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "shell-escape 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -218,24 +224,36 @@ name = "cargo_metadata" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cargo_metadata" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cargotest" version = "0.1.0" dependencies = [ - "cargo 0.24.0", + "cargo 0.25.0", "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -255,12 +273,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "clap" -version = "2.27.1" +version = "2.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -270,17 +288,17 @@ dependencies = [ [[package]] name = "clippy" -version = "0.0.171" +version = "0.0.174" dependencies = [ "cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clippy-mini-macro-test 0.1.0", - "clippy_lints 0.0.171", - "compiletest_rs 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy_lints 0.0.174", + "compiletest_rs 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "duct 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -289,7 +307,7 @@ version = "0.1.0" [[package]] name = "clippy_lints" -version = "0.0.171" +version = "0.0.174" dependencies = [ "if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -299,8 +317,8 @@ dependencies = [ "quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -308,7 +326,7 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -336,7 +354,7 @@ name = "commoncrypto-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -355,24 +373,28 @@ dependencies = [ "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "compiletest_rs" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -385,30 +407,30 @@ version = "0.0.0" [[package]] name = "core-foundation" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "core-foundation-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core-foundation-sys" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crates-io" -version = "0.13.0" +version = "0.14.0" dependencies = [ "curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -430,7 +452,7 @@ dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -464,9 +486,9 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -477,9 +499,9 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -534,9 +556,9 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -561,12 +583,17 @@ name = "either" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "enum_primitive" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -574,7 +601,7 @@ name = "env_logger" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -583,8 +610,8 @@ name = "env_logger" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -610,6 +637,25 @@ dependencies = [ "rustdoc 0.0.0", ] +[[package]] +name = "failure" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "features" version = "0.1.0" @@ -620,8 +666,8 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -634,10 +680,10 @@ version = "0.1.0" [[package]] name = "flate2" -version = "0.2.20" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -652,7 +698,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "foreign-types" -version = "0.2.0" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -661,25 +715,23 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fuchsia-zircon" -version = "0.2.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fuchsia-zircon-sys" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "futf" @@ -702,14 +754,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "git2" -version = "0.6.8" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -719,8 +771,8 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -734,11 +786,11 @@ name = "globset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -750,7 +802,7 @@ name = "hamcrest" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -760,12 +812,12 @@ version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -787,20 +839,20 @@ dependencies = [ [[package]] name = "html-diff" -version = "0.0.4" +version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kuchiki 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kuchiki 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "html5ever" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "markup5ever 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "markup5ever 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -828,10 +880,10 @@ dependencies = [ "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -851,12 +903,12 @@ version = "0.1.0" name = "installer" version = "0.0.0" dependencies = [ - "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "xz2 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -880,20 +932,25 @@ name = "jobserver" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "json" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "jsonrpc-core" -version = "7.1.1" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -907,24 +964,24 @@ dependencies = [ [[package]] name = "kuchiki" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cssparser 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", - "html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "languageserver-types" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -934,6 +991,11 @@ name = "lazy_static" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazy_static" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lazycell" version = "0.5.1" @@ -948,21 +1010,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.33" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libgit2-sys" -version = "0.6.16" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "curl-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -971,10 +1033,10 @@ name = "libssh2-sys" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -984,7 +1046,7 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -995,8 +1057,27 @@ version = "0.1.0" [[package]] name = "log" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log_settings" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "lzma-sys" @@ -1005,7 +1086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1016,7 +1097,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "markup5ever" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1024,7 +1105,7 @@ dependencies = [ "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tendril 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1037,18 +1118,18 @@ name = "mdbook" version = "0.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "handlebars 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1058,7 +1139,7 @@ name = "memchr" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1066,15 +1147,15 @@ name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1083,7 +1164,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1097,6 +1178,17 @@ dependencies = [ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "miri" +version = "0.1.0" +dependencies = [ + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "compiletest_rs 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "multiple_bins" version = "0.1.0" @@ -1108,11 +1200,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nibble_vec" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "nix" version = "0.8.1" @@ -1120,40 +1217,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-bigint" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-complex" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1162,7 +1259,7 @@ name = "num-integer" version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1171,7 +1268,7 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1179,15 +1276,15 @@ name = "num-rational" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1195,7 +1292,7 @@ name = "num_cpus" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1205,28 +1302,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.9.21" +version = "0.9.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-probe" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.21" +version = "0.9.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1267,6 +1364,27 @@ dependencies = [ "unwind 0.0.0", ] +[[package]] +name = "parking_lot" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -1300,7 +1418,7 @@ version = "0.7.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1345,7 +1463,7 @@ dependencies = [ [[package]] name = "psapi-sys" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1390,22 +1508,31 @@ name = "racer" version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_errors 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand" -version = "0.3.18" +name = "radix_trie" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "endian-type 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "nibble_vec 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1424,14 +1551,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1439,7 +1566,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1464,13 +1591,13 @@ dependencies = [ [[package]] name = "regex" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1494,49 +1621,52 @@ version = "0.1.0" [[package]] name = "rls" -version = "0.123.1" +version = "0.124.0" dependencies = [ - "cargo 0.24.0", + "cargo 0.25.0", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 7.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "languageserver-types 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "json 0.11.12 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "languageserver-types 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "racer 2.0.12 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-analysis 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-analysis 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-rustc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-vfs 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfmt-nightly 0.2.16", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustfmt-nightly 0.3.4", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rls-analysis" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "derive-new 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "radix_trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rls-data" -version = "0.12.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1550,8 +1680,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1567,7 +1697,7 @@ dependencies = [ name = "rustbook" version = "0.1.0" dependencies = [ - "clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "mdbook 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1576,13 +1706,15 @@ name = "rustc" version = "0.0.0" dependencies = [ "arena 0.0.0", + "backtrace 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "fmt_macros 0.0.0", "graphviz 0.0.0", "jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_apfloat 0.0.0", "rustc_back 0.0.0", "rustc_const_math 0.0.0", "rustc_data_structures 0.0.0", @@ -1635,7 +1767,7 @@ dependencies = [ "alloc 0.0.0", "alloc_system 0.0.0", "build_helper 0.1.0", - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -1643,8 +1775,8 @@ dependencies = [ name = "rustc_back" version = "0.0.0" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "syntax 0.0.0", ] @@ -1654,8 +1786,8 @@ name = "rustc_binaryen" version = "0.0.0" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1663,9 +1795,8 @@ name = "rustc_borrowck" version = "0.0.0" dependencies = [ "graphviz 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc_back 0.0.0", "rustc_errors 0.0.0", "rustc_mir 0.0.0", "syntax 0.0.0", @@ -1677,9 +1808,8 @@ name = "rustc_const_eval" version = "0.0.0" dependencies = [ "arena 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc_back 0.0.0", "rustc_const_math 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", @@ -1707,8 +1837,12 @@ dependencies = [ name = "rustc_data_structures" version = "0.0.0" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", + "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1719,8 +1853,7 @@ dependencies = [ "arena 0.0.0", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "graphviz 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_allocator 0.0.0", "rustc_back 0.0.0", @@ -1753,6 +1886,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "serialize 0.0.0", "syntax_pos 0.0.0", + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1760,8 +1894,8 @@ name = "rustc_incremental" version = "0.0.0" dependencies = [ "graphviz 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_data_structures 0.0.0", "serialize 0.0.0", @@ -1773,7 +1907,7 @@ dependencies = [ name = "rustc_lint" version = "0.0.0" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_const_eval 0.0.0", "syntax 0.0.0", @@ -1797,7 +1931,7 @@ dependencies = [ "alloc 0.0.0", "alloc_system 0.0.0", "build_helper 0.1.0", - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -1805,9 +1939,8 @@ dependencies = [ name = "rustc_metadata" version = "0.0.0" dependencies = [ - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc_macro 0.0.0", "rustc 0.0.0", "rustc_back 0.0.0", @@ -1824,13 +1957,18 @@ name = "rustc_mir" version = "0.0.0" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "graphviz 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", + "rustc_apfloat 0.0.0", + "rustc_back 0.0.0", "rustc_const_eval 0.0.0", "rustc_const_math 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", + "rustc_trans_utils 0.0.0", "serialize 0.0.0", "syntax 0.0.0", "syntax_pos 0.0.0", @@ -1843,7 +1981,7 @@ dependencies = [ "alloc 0.0.0", "alloc_system 0.0.0", "build_helper 0.1.0", - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -1851,7 +1989,7 @@ dependencies = [ name = "rustc_passes" version = "0.0.0" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_const_eval 0.0.0", "rustc_const_math 0.0.0", @@ -1869,7 +2007,6 @@ name = "rustc_plugin" version = "0.0.0" dependencies = [ "rustc 0.0.0", - "rustc_back 0.0.0", "rustc_errors 0.0.0", "rustc_metadata 0.0.0", "syntax 0.0.0", @@ -1891,7 +2028,7 @@ name = "rustc_resolve" version = "0.0.0" dependencies = [ "arena 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", @@ -1903,8 +2040,8 @@ dependencies = [ name = "rustc_save_analysis" version = "0.0.0" dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1920,11 +2057,10 @@ version = "0.0.0" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", @@ -1936,11 +2072,13 @@ dependencies = [ "rustc_errors 0.0.0", "rustc_incremental 0.0.0", "rustc_llvm 0.0.0", + "rustc_mir 0.0.0", "rustc_platform_intrinsics 0.0.0", "rustc_trans_utils 0.0.0", "serialize 0.0.0", "syntax 0.0.0", "syntax_pos 0.0.0", + "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1948,9 +2086,8 @@ name = "rustc_trans_utils" version = "0.0.0" dependencies = [ "ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_back 0.0.0", "rustc_data_structures 0.0.0", @@ -1965,7 +2102,7 @@ dependencies = [ "alloc 0.0.0", "alloc_system 0.0.0", "build_helper 0.1.0", - "cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -1975,9 +2112,8 @@ version = "0.0.0" dependencies = [ "arena 0.0.0", "fmt_macros 0.0.0", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc_back 0.0.0", "rustc_const_math 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", @@ -1992,10 +2128,9 @@ version = "0.0.0" dependencies = [ "build_helper 0.1.0", "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "html-diff 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2007,20 +2142,20 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "0.2.16" +version = "0.3.4" dependencies = [ + "cargo_metadata 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2080,7 +2215,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2090,22 +2225,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.21" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.21" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive_internals 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive_internals" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2117,18 +2252,18 @@ name = "serde_ignored" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2141,7 +2276,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2160,6 +2295,11 @@ name = "smallvec" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "smallvec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "socket2" version = "0.2.4" @@ -2167,7 +2307,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2191,7 +2331,7 @@ dependencies = [ "panic_abort 0.0.0", "panic_unwind 0.0.0", "profiler_builtins 0.0.0", - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_asan 0.0.0", "rustc_lsan 0.0.0", "rustc_msan 0.0.0", @@ -2216,7 +2356,7 @@ dependencies = [ "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2237,14 +2377,6 @@ name = "string_cache_shared" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "strings" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "strsim" version = "0.6.0" @@ -2268,12 +2400,21 @@ dependencies = [ "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "synstructure" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syntax" version = "0.0.0" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_cratesio_shim 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", @@ -2306,8 +2447,8 @@ name = "syntex_errors" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2328,8 +2469,8 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_errors 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2339,11 +2480,12 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2352,12 +2494,12 @@ name = "tempdir" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tendril" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2391,8 +2533,8 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2418,7 +2560,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2431,10 +2573,10 @@ dependencies = [ [[package]] name = "thread_local" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2442,6 +2584,16 @@ dependencies = [ name = "tidy" version = "0.1.0" +[[package]] +name = "time" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "toml" version = "0.2.1" @@ -2455,7 +2607,7 @@ name = "toml" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2537,7 +2689,7 @@ name = "url_serde" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2598,11 +2750,30 @@ name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "wincolor" version = "0.1.4" @@ -2630,7 +2801,7 @@ name = "xattr" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2649,8 +2820,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" -"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" -"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" +"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" +"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455" "checksum ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35c7a5669cb64f085739387e1308b74e6d44022464b7f1b63bbd4ceb6379ec31" "checksum atty 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21e50800ec991574876040fff8ee46b136a53e985286fbe6a3bdfe6421b78860" "checksum backtrace 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8709cc7ec06f6f0ae6c2c7e12f6ed41540781f72b488d83734978295ceae182e" @@ -2659,17 +2830,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" "checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32" +"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" "checksum cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be1057b8462184f634c3a208ee35b0f935cfd94b694b26deadccd98732088d7b" +"checksum cargo_metadata 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "20d6fb2b5574726329c85cdba0df0347fddfec3cf9c8b588f9931708280f5643" "checksum cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b13a57efd6b30ecd6598ebdb302cca617930b5470647570468a65d12ef9719" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" -"checksum clap 2.27.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b8c532887f1a292d17de05ae858a8fe50a301e196f9ef0ddb7ccd0d1d00f180" -"checksum cmake 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "e14cd15a7cbc2c6a905677e54b831ee91af2ff43b352010f6133236463b65cac" +"checksum clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "110d43e343eb29f4f51c1db31beb879d546db27998577e5715270a54bcf41d3f" +"checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" "checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" -"checksum compiletest_rs 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86f4663adfd113e17109c35c2067194eca782a5baf9c90f4696ca13d04631adb" -"checksum core-foundation 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5909502e547762013619f4c4e01cc7393c20fe2d52d7fa471c1210adb2320dc7" -"checksum core-foundation-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bc9fb3d6cb663e6fd7cf1c63f9b144ee2b1e4a78595a0451dd34bff85b9a3387" +"checksum compiletest_rs 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "562bafeec9aef1e3e08f1c5b0c542220bb80ff2894e5373a1f9d17c346412c66" +"checksum core-foundation 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8047f547cd6856d45b1cdd75ef8d2f21f3d0e4bf1dab0a0041b0ae9a5dda9c0e" +"checksum core-foundation-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "152195421a2e6497a8179195672e9d4ee8e45ed8c465b626f1606d27a08ebcd5" "checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97" "checksum crossbeam 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8837ab96533202c5b610ed44bc7f4183e7957c1c8f56e8cc78bb098593c8ba0a" "checksum crypto-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34903878eec1694faf53cae8473a088df333181de421d4d3d48061d6559fe602" @@ -2685,22 +2858,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" "checksum duct 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e45aa15fe0a8a8f511e6d834626afd55e49b62e5c8802e18328a87e8a8f6065c" "checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3" +"checksum endian-type 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" "checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" "checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46" +"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" +"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" "checksum filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "aa75ec8f7927063335a9583e7fa87b0110bb888cf766dc01b54c0ff70d760c8e" -"checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423" +"checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e4056b9bd47f8ac5ba12be771f77a0dae796d1bbaaf5fd0b9c2d38b69b8a29d" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fs2 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab76cfd2aaa59b7bf6688ad9ba15bbae64bff97f04ea02144cfd3443e5c2866" -"checksum fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c0581a4e363262e52b87f59ee2afe3415361c6ec35e665924eb08afe8ff159" -"checksum fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43f3795b4bae048dc6123a6b972cadde2e676f9ded08aef6bb77f5f157684a82" +"checksum fuchsia-zircon 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bd510087c325af53ba24f3be8f1c081b0982319adcb8b03cad764512923ccc19" +"checksum fuchsia-zircon-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "08b3a6f13ad6b96572b53ce7af74543132f1a7055ccceb6d073dd36c54481859" "checksum futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "51f93f3de6ba1794dcd5810b3546d004600a59a98266487c8407bc4b24e398f3" "checksum futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "118b49cac82e04121117cbd3121ede3147e885627d82c4546b87c702debb90c1" "checksum getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "65922871abd2f101a2eb0eaebadc66668e54a87ad9c3dd82520b5f86ede5eff9" -"checksum git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0c1c0203d653f4140241da0c1375a404f0a397249ec818cd2076c6280c50f6fa" +"checksum git2 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "40a111aecd59985496012976beca164b4f6c930d507a099831e06b07f19d54f1" "checksum git2-curl 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "68676bc784bf0bef83278898929bf64a251e87c0340723d0b93fa096c9c5bf8e" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum globset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "464627f948c3190ae3d04b1bc6d7dca2f785bda0ac01278e6db129ad383dbeb6" @@ -2708,51 +2885,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum handlebars 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04af2006ea09d985fef82b81e0eb25337e51b691c76403332378a53d521edc" "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum home 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f25ae61099d8f3fee8b483df0bd4ecccf4b2731897aad40d50eca1b641fe6db" -"checksum html-diff 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5298d63081a642508fce965740ddb03a386c5d81bf1fef0579a815cf49cb8c68" -"checksum html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a49d5001dd1bddf042ea41ed4e0a671d50b1bf187e66b349d7ec613bdce4ad90" +"checksum html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9778743e3b3c3679f471f0ed1833c690f19f4a0919e33b281f12ef5f77ad64c6" +"checksum html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bfb46978eb757a603b7dfe2dafb1c62cb4dee3428d8ac1de734d83d6b022d06" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "61bb90bdd39e3af69b0172dfc6130f6cd6332bf040fbb9bdd4401d37adbd48b8" "checksum ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3fcaf2365eb14b28ec7603c98c06cc531f19de9eb283d89a3dff8417c8c99f5" "checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "931b04e5e57d88cc909528f0d701db36a870b72a052648ded8baf80f9f445e0f" -"checksum jsonrpc-core 7.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1acd0f9934da94466d2370f36832b9b19271b4abdfdb5e69f0bcd991ebcd515" +"checksum json 0.11.12 (registry+https://github.com/rust-lang/crates.io-index)" = "39ebf0fac977ee3a4a3242b6446004ff64514889e3e2730bbd4f764a67a2e483" +"checksum jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum kuchiki 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ef2ea4f2f7883cd7c6772b06c14abca01a2cc1f75c426cebffcf6b3b925ef9fc" -"checksum languageserver-types 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7878a264bff274f017fac3dff1fa17afb9e6320738f91331ebfde14ab2bc734" +"checksum kuchiki 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e03098e8e719c92b7794515dfd5c1724e2b12f5ce1788e61cfa4663f82eba8d8" +"checksum languageserver-types 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "773e175c945800aeea4c21c04090bcb9db987b1a566ad9c6f569972299950e3e" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" +"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" "checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b" -"checksum libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2" -"checksum libgit2-sys 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "6f74b4959cef96898f5123148724fc7dee043b9a6b99f219d948851bfbe53cb2" +"checksum libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0" +"checksum libgit2-sys 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "82fc20bd8beefe7c9f98aae2d3cff78e57f544cdd83d58fe181ec37a5fbe0c77" "checksum libssh2-sys 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0db4ec23611747ef772db1c4d650f8bd762f07b461727ec998f953c614024b75" "checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16" -"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" +"checksum log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3d382732ea0fbc09790c4899db3255bdea0fc78b54bf234bd18a63bb603915b6" "checksum lzma-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c1b93b78f89e8737dac81837fc8f5521ac162abcba902e1a3db949d55346d1da" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" -"checksum markup5ever 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff834ac7123c6a37826747e5ca09db41fd7a83126792021c2e636ad174bb77d3" +"checksum markup5ever 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "047150a0e03b57e638fc45af33a0b63a0362305d5b9f92ecef81df472a4cceb0" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" "checksum mdbook 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "8a1ac668292d1e5c7b1c6fd64f70d3a85105b8069a89558a0d67bdb2ff298ca1" "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e01e64d9017d18e7fc09d8e4fe0e28ff6931019e979fb8019319db7ca827f8a6" +"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" "checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09" +"checksum nibble_vec 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "62e678237a4c70c5f2b917cefd7d080dfbf800421f06e8a59d4e28ef5130fd9e" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" -"checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525" -"checksum num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd0f8dbb4c0960998958a796281d88c16fbe68d87b1baa6f31e2979e81fd0bd" -"checksum num-complex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "503e668405c5492d67cf662a81e05be40efe2e6bcf10f7794a07bd9865e704e6" +"checksum num 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4083e14b542ea3eb9b5f33ff48bd373a92d78687e74f4cc0a30caeb754f0ca" +"checksum num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "bdc1494b5912f088f260b775799468d9b9209ac60885d8186a547a0476289e23" +"checksum num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "58de7b4bf7cf5dbecb635a5797d489864eadd03b107930cbccf9e0fd7428b47c" "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba" "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01" "checksum num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "0c7cb72a95250d8a370105c828f388932373e0e94414919891a0f945222310fe" -"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" +"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070" "checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d" "checksum open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c281318d992e4432cfa799969467003d05921582a7489a8325e37f8a450d5113" -"checksum openssl 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)" = "2225c305d8f57001a0d34263e046794aa251695f20773102fbbfeb1e7b189955" -"checksum openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d98df0270d404ccd3c050a41d579c52d1db15375168bb3471e04ec0f5f378daf" -"checksum openssl-sys 0.9.21 (registry+https://github.com/rust-lang/crates.io-index)" = "92867746af30eea7a89feade385f7f5366776f1c52ec6f0de81360373fa88363" +"checksum openssl 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)" = "169a4b9160baf9b9b1ab975418c673686638995ba921683a7f1e01470dcb8854" +"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +"checksum openssl-sys 0.9.23 (registry+https://github.com/rust-lang/crates.io-index)" = "2200ffec628e3f14c39fc0131a301db214f1a7d584e36507ee8700b0c7fb7a46" "checksum os_pipe 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "998bfbb3042e715190fe2a41abfa047d7e8cb81374d2977d7f100eacd8619cb1" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3e7f7c9857874e54afeb950eebeae662b1e51a2493666d2ea4c0a5d91dcf0412" +"checksum parking_lot_core 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6bf05dc61189828dfd7a59fd6e66d538e88d6b30390da1124a291e09fd3098b3" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8" "checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc" @@ -2762,24 +2946,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum procedural-masquerade 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dc1bcafee1590f81acb329ae45ec627b318123f085153913620316ae9a144b2a" -"checksum psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "abcd5d1a07d360e29727f757a9decb3ce8bc6e0efa8969cfaad669a8317a2478" +"checksum psapi-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f71c7e142c25f297077a8ebc21f10847096b5d21ad7619d7bf0c1fcecb40bb0" "checksum pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "378e941dbd392c101f2cb88097fa4d7167bc421d4b88de3ff7dbee503bc3233b" "checksum pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a656fdb8b6848f896df5e478a0eb9083681663e37dcb77dd16981ff65329fe8b" "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" "checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum racer 2.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "034f1c4528581c40a60e96875467c03315868084e08ff4ceb46a00f7be3b16b4" -"checksum rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd" +"checksum radix_trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "211c49b6a9995cac0fd1dd9ca60b42cf3a51e151a12eb954b3a9e75513426ee8" +"checksum rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "9e7944d95d25ace8f377da3ac7068ce517e4c646754c43a1b1849177bbf72e59" "checksum rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed02d09394c94ffbdfdc755ad62a132e94c3224a8354e78a1200ced34df12edf" "checksum rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b609139d83da75902f88fd6c01820046840a18471e4dfcd5ac7c0f46bea53" -"checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509" +"checksum redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "ab105df655884ede59d45b7070c8a65002d921461ee813a024558ca16030eea0" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" -"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" +"checksum regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ac6ab4e9218ade5b423358bbd2567d1617418403c7a512603630181813316322" "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" "checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" -"checksum rls-analysis 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5b961e7270b2084839ede4d2788167086b24bc9cf09c9e955cc851afaf116054" -"checksum rls-data 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48257ceade23c2e01a3ca8d2fc4226101b107f6a3c868f829cf3fd2f204a1fe6" +"checksum rls-analysis 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "38841e3c5271715a574ac220d9b408b59ed9e2626909c3bc54b5853b4eaadb7b" +"checksum rls-data 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8024f1feaca72d0aa4ae1e2a8d454a31b9a33ed02f8d0e9c8559bf53c267ec3c" "checksum rls-rustc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b21ea952e9bf1569929abf1bb920262cde04b7b1b26d8e0260286302807299d2" "checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a" "checksum rls-vfs 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ffd34691a510938bb67fe0444fb363103c73ffb31c121d1e16bc92d8945ea8ff" @@ -2793,37 +2978,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" "checksum semver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bee2bc909ab2d8d60dab26e8cad85b25d795b14603a0dcb627b78b9d30b6454b" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6eda663e865517ee783b0891a3f6eb3a253e0b0dabb46418969ee9635beadd9e" -"checksum serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "652bc323d694dc925829725ec6c890156d8e70ae5202919869cb00fe2eff3788" -"checksum serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32f1926285523b2db55df263d2aa4eb69ddcfa7a7eade6430323637866b513ab" +"checksum serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "386122ba68c214599c44587e0c0b411e8d90894503a95425b4f9508e4317901f" +"checksum serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0bfa6c5784e7d110514448da0e1dbad41ea5514c3e68be755b23858b83a399" +"checksum serde_derive_internals 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "730fe9f29fe8db69a601837f416e46cba07792031ed6b27557a43e49d62d89ae" "checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" -"checksum serde_json 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e4586746d1974a030c48919731ecffd0ed28d0c40749d0d18d43b3a7d6c9b20e" +"checksum serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7cf5b0b5b4bd22eeecb7e01ac2e1225c7ef5e4272b79ee28a8392a8c8489c839" "checksum shared_child 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "099b38928dbe4a0a01fcd8c233183072f14a7d126a34bed05880869be66e14cc" "checksum shell-escape 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd5cc96481d54583947bfe88bf30c23d53f883c6cd0145368b69989d97b84ef8" "checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" "checksum smallvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f8266519bc1d17d0b5b16f6c21295625d562841c708f6376f49028a43e9c11e" +"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9" "checksum socket2 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b4896961171cd3317c7e9603d88f379f8c6e45342212235d356496680c68fd" "checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" "checksum string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "413fc7852aeeb5472f1986ef755f561ddf0c789d3d796e65f0b6fe293ecd4ef8" "checksum string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "479cde50c3539481f33906a387f2bd17c8e87cb848c35b6021d41fb81ff9b4d7" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" -"checksum strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa481ee1bc42fc3df8195f91f7cb43cf8f2b71b48bac40bf5381cfaf7e481f3c" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" +"checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum syntex_errors 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e52bffe6202cfb67587784cf23e0ec5bf26d331eef4922a16d5c42e12aa1e9b" "checksum syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "955ef4b16af4c468e4680d1497f873ff288f557d338180649e18f915af5e15ac" "checksum syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "76a302e717e348aa372ff577791c3832395650073b8d8432f8b3cb170b34afde" -"checksum tar 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "281285b717926caa919ad905ef89c63d75805c7d89437fb873100925a53f2b1b" +"checksum tar 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1605d3388ceb50252952ffebab4b5dc43017ead7e4481b175961c283bb951195" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" -"checksum tendril 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1b72f8e2f5b73b65c315b1a70c730f24b9d7a25f39e98de8acbe2bb795caea" +"checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termcolor 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9065bced9c3e43453aa3d56f1e98590b8455b341d2fa191a1090c0dd0b242c75" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" -"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" +"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" +"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" @@ -2845,7 +3032,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a39ee4464208f6430992ff20154216ab2357772ac871d994c51628d60e58b8b0" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xattr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "5f04de8a1346489a2f9e9bd8526b73d135ec554227b17568456e86aa35b6f3fc" diff --git a/src/Cargo.toml b/src/Cargo.toml index a99cd5b1a6..15594a54ef 100644 --- a/src/Cargo.toml +++ b/src/Cargo.toml @@ -20,21 +20,22 @@ members = [ "tools/rustdoc", "tools/rls", "tools/rustfmt", + "tools/miri", # FIXME(https://github.com/rust-lang/cargo/issues/4089): move these to exclude + "tools/rls/test_data/bin_lib", "tools/rls/test_data/borrow_error", "tools/rls/test_data/common", + "tools/rls/test_data/deglob", "tools/rls/test_data/features", "tools/rls/test_data/find_all_refs_no_cfg_test", - "tools/rls/test_data/reformat", - "tools/rls/test_data/multiple_bins", - "tools/rls/test_data/bin_lib", - "tools/rls/test_data/reformat_with_range", "tools/rls/test_data/find_impls", "tools/rls/test_data/infer_bin", "tools/rls/test_data/infer_custom_bin", "tools/rls/test_data/infer_lib", + "tools/rls/test_data/multiple_bins", + "tools/rls/test_data/reformat", + "tools/rls/test_data/reformat_with_range", "tools/rls/test_data/workspace_symbol", - "tools/rls/test_data/deglob", ] # Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index bbbbf0e191..2d47834131 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -41,3 +41,4 @@ serde_derive = "1.0.8" serde_json = "1.0.2" toml = "0.4" lazy_static = "0.2" +time = "0.1" diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 16a23eb364..37336a56d7 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -175,7 +175,7 @@ fn main() { if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") { cmd.arg("-C").arg(format!("codegen-units={}", s)); } - if stage != "0" && env::var("RUSTC_THINLTO").is_ok() { + if env::var("RUSTC_THINLTO").is_ok() { cmd.arg("-Ccodegen-units=16").arg("-Zthinlto"); } @@ -183,7 +183,8 @@ fn main() { if env::var("RUSTC_SAVE_ANALYSIS") == Ok("api".to_string()) { cmd.arg("-Zsave-analysis"); cmd.env("RUST_SAVE_ANALYSIS_CONFIG", - "{\"output_file\": null,\"full_docs\": false,\"pub_only\": true,\ + "{\"output_file\": null,\"full_docs\": false,\ + \"pub_only\": true,\"reachable_only\": false,\ \"distro_crate\": true,\"signatures\": false,\"borrow_data\": false}"); } @@ -245,6 +246,9 @@ fn main() { // When running miri tests, we need to generate MIR for all libraries if env::var("TEST_MIRI").ok().map_or(false, |val| val == "true") { cmd.arg("-Zalways-encode-mir"); + if stage != "0" { + cmd.arg("-Zmiri"); + } cmd.arg("-Zmir-emit-validate=1"); } @@ -261,6 +265,10 @@ fn main() { } } + if env::var_os("RUSTC_PARALLEL_QUERIES").is_some() { + cmd.arg("--cfg").arg("parallel_queries"); + } + let color = match env::var("RUSTC_COLOR") { Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"), Err(_) => 0, diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index 4e975adc97..6203759085 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -57,6 +57,10 @@ fn main() { // This "unstable-options" can be removed when `--crate-version` is stabilized cmd.arg("-Z").arg("unstable-options") .arg("--crate-version").arg(version); + + // While we can assume that `-Z unstable-options` is set, let's also force rustdoc to panic + // if pulldown rendering differences are found + cmd.arg("--deny-render-differences"); } std::process::exit(match cmd.status() { diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index c76900882b..ce30d1f4ce 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -484,8 +484,8 @@ impl<'a> Builder<'a> { } else { PathBuf::from("/path/to/nowhere/rustdoc/not/required") }) - .env("TEST_MIRI", self.config.test_miri.to_string()); - + .env("TEST_MIRI", self.config.test_miri.to_string()) + .env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir()); if let Some(n) = self.config.rust_codegen_units { cargo.env("RUSTC_CODEGEN_UNITS", n.to_string()); } @@ -500,9 +500,10 @@ impl<'a> Builder<'a> { if mode != Mode::Tool { // Tools don't get debuginfo right now, e.g. cargo and rls don't // get compiled with debuginfo. - cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()) - .env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()) - .env("RUSTC_FORCE_UNSTABLE", "1"); + // Adding debuginfo increases their sizes by a factor of 3-4. + cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()); + cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()); + cargo.env("RUSTC_FORCE_UNSTABLE", "1"); // Currently the compiler depends on crates from crates.io, and // then other crates can depend on the compiler (e.g. proc-macro @@ -625,9 +626,7 @@ impl<'a> Builder<'a> { cargo.arg("--release"); } - if mode != Mode::Libstd && // FIXME(#45320) - mode != Mode::Libtest && // FIXME(#45511) - self.config.rust_codegen_units.is_none() && + if self.config.rust_codegen_units.is_none() && self.build.is_rust_llvm(compiler.host) { cargo.env("RUSTC_THINLTO", "1"); diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 4f7dd8d5e6..d675834bd6 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -24,12 +24,7 @@ use Build; use config::Config; // The version number -pub const CFG_RELEASE_NUM: &str = "1.23.0"; - -// An optional number to put after the label, e.g. '.2' -> '-beta.2' -// Be sure to make this starts with a dot to conform to semver pre-release -// versions (section 9) -pub const CFG_PRERELEASE_VERSION: &str = ".2"; +pub const CFG_RELEASE_NUM: &str = "1.24.1"; pub struct GitInfo { inner: Option, diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 4d69b19c73..e4fbae3ff0 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -23,7 +23,7 @@ use std::path::{PathBuf, Path}; use std::process::Command; use std::io::Read; -use build_helper::{self, output, BuildExpectation}; +use build_helper::{self, output}; use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step}; use cache::{INTERNER, Interned}; @@ -65,19 +65,17 @@ impl fmt::Display for TestKind { } } -fn try_run_expecting(build: &Build, cmd: &mut Command, expect: BuildExpectation) { +fn try_run(build: &Build, cmd: &mut Command) -> bool { if !build.fail_fast { - if !build.try_run(cmd, expect) { + if !build.try_run(cmd) { let mut failures = build.delayed_failures.borrow_mut(); failures.push(format!("{:?}", cmd)); + return false; } } else { - build.run_expecting(cmd, expect); + build.run(cmd); } -} - -fn try_run(build: &Build, cmd: &mut Command) { - try_run_expecting(build, cmd, BuildExpectation::None) + true } fn try_run_quiet(build: &Build, cmd: &mut Command) { @@ -257,11 +255,9 @@ impl Step for Rls { builder.add_rustc_lib_path(compiler, &mut cargo); - try_run_expecting( - build, - &mut cargo, - builder.build.config.toolstate.rls.passes(ToolState::Testing), - ); + if try_run(build, &mut cargo) { + build.save_toolstate("rls", ToolState::TestPass); + } } } @@ -305,16 +301,15 @@ impl Step for Rustfmt { builder.add_rustc_lib_path(compiler, &mut cargo); - try_run_expecting( - build, - &mut cargo, - builder.build.config.toolstate.rustfmt.passes(ToolState::Testing), - ); + if try_run(build, &mut cargo) { + build.save_toolstate("rustfmt", ToolState::TestPass); + } } } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Miri { + stage: u32, host: Interned, } @@ -330,6 +325,7 @@ impl Step for Miri { fn make_run(run: RunConfig) { run.builder.ensure(Miri { + stage: run.builder.top_stage, host: run.target, }); } @@ -337,8 +333,9 @@ impl Step for Miri { /// Runs `cargo test` for miri. fn run(self, builder: &Builder) { let build = builder.build; + let stage = self.stage; let host = self.host; - let compiler = builder.compiler(1, host); + let compiler = builder.compiler(stage, host); if let Some(miri) = builder.ensure(tool::Miri { compiler, target: self.host }) { let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test"); @@ -354,11 +351,9 @@ impl Step for Miri { builder.add_rustc_lib_path(compiler, &mut cargo); - try_run_expecting( - build, - &mut cargo, - builder.build.config.toolstate.miri.passes(ToolState::Testing), - ); + if try_run(build, &mut cargo) { + build.save_toolstate("miri", ToolState::TestPass); + } } else { eprintln!("failed to test miri: could not build"); } @@ -411,11 +406,9 @@ impl Step for Clippy { builder.add_rustc_lib_path(compiler, &mut cargo); - try_run_expecting( - build, - &mut cargo, - builder.build.config.toolstate.clippy.passes(ToolState::Testing), - ); + if try_run(build, &mut cargo) { + build.save_toolstate("clippy-driver", ToolState::TestPass); + } } else { eprintln!("failed to test clippy: could not build"); } @@ -575,6 +568,11 @@ static HOST_COMPILETESTS: &[Test] = &[ mode: "compile-fail", suite: "compile-fail-fulldeps", }, + Test { + path: "src/test/incremental-fulldeps", + mode: "incremental", + suite: "incremental-fulldeps", + }, Test { path: "src/test/run-make", mode: "run-make", suite: "run-make" }, Test { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" }, @@ -756,6 +754,7 @@ impl Step for Compiletest { if build.config.rust_debuginfo_tests { flags.push("-g".to_string()); } + flags.push("-Zmiri -Zunstable-options".to_string()); if let Some(linker) = build.linker(target) { cmd.arg("--linker").arg(linker); @@ -981,7 +980,8 @@ impl Step for ErrorIndex { build.run(builder.tool_cmd(Tool::ErrorIndex) .arg("markdown") .arg(&output) - .env("CFG_BUILD", &build.build)); + .env("CFG_BUILD", &build.build) + .env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir())); markdown_test(builder, compiler, &output); } @@ -1245,6 +1245,17 @@ impl Step for Crate { if target.contains("emscripten") { cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), build.config.nodejs.as_ref().expect("nodejs not configured")); + } else if target.starts_with("wasm32") { + // On the wasm32-unknown-unknown target we're using LTO which is + // incompatible with `-C prefer-dynamic`, so disable that here + cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1"); + + let node = build.config.nodejs.as_ref() + .expect("nodejs not configured"); + let runner = format!("{} {}/src/etc/wasm32-shim.js", + node.display(), + build.src.display()); + cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), &runner); } else if build.remote_tested(target) { cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), format!("{} run", diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index db013691bb..c8e500a4f6 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -550,6 +550,7 @@ pub fn rustc_cargo(build: &Build, // Building with a static libstdc++ is only supported on linux right now, // not for MSVC or macOS if build.config.llvm_static_stdcpp && + !target.contains("freebsd") && !target.contains("windows") && !target.contains("apple") { cargo.env("LLVM_STATIC_STDCPP", @@ -561,6 +562,9 @@ pub fn rustc_cargo(build: &Build, if let Some(ref s) = build.config.rustc_default_linker { cargo.env("CFG_DEFAULT_LINKER", s); } + if build.config.rustc_parallel_queries { + cargo.env("RUSTC_PARALLEL_QUERIES", "1"); + } } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 35e62f17f2..f3ffe9a276 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -27,7 +27,6 @@ use util::exe; use cache::{INTERNER, Interned}; use flags::Flags; pub use flags::Subcommand; -use toolstate::ToolStates; /// Global configuration for the entire build and/or bootstrap. /// @@ -76,7 +75,7 @@ pub struct Config { pub llvm_static_stdcpp: bool, pub llvm_link_shared: bool, pub llvm_targets: Option, - pub llvm_experimental_targets: Option, + pub llvm_experimental_targets: String, pub llvm_link_jobs: Option, // rust codegen options @@ -87,6 +86,7 @@ pub struct Config { pub rust_debuginfo_lines: bool, pub rust_debuginfo_only_std: bool, pub rust_rpath: bool, + pub rustc_parallel_queries: bool, pub rustc_default_linker: Option, pub rust_optimize_tests: bool, pub rust_debuginfo_tests: bool, @@ -112,6 +112,8 @@ pub struct Config { pub channel: String, pub quiet_tests: bool, pub test_miri: bool, + pub save_toolstates: Option, + // Fallback musl-root for all targets pub musl_root: Option, pub prefix: Option, @@ -131,8 +133,6 @@ pub struct Config { // These are either the stage0 downloaded binaries or the locally installed ones. pub initial_cargo: PathBuf, pub initial_rustc: PathBuf, - - pub toolstate: ToolStates, } /// Per-target configuration stored in the global configuration structure. @@ -264,6 +264,7 @@ struct Rust { debuginfo: Option, debuginfo_lines: Option, debuginfo_only_std: Option, + experimental_parallel_queries: Option, debug_jemalloc: Option, use_jemalloc: Option, backtrace: Option, @@ -279,6 +280,7 @@ struct Rust { dist_src: Option, quiet_tests: Option, test_miri: Option, + save_toolstates: Option, } /// TOML representation of how each build target is configured. @@ -343,18 +345,6 @@ impl Config { } }).unwrap_or_else(|| TomlConfig::default()); - let toolstate_toml_path = config.src.join("src/tools/toolstate.toml"); - let parse_toolstate = || -> Result<_, Box<::std::error::Error>> { - let mut f = File::open(toolstate_toml_path)?; - let mut contents = String::new(); - f.read_to_string(&mut contents)?; - Ok(toml::from_str(&contents)?) - }; - config.toolstate = parse_toolstate().unwrap_or_else(|err| { - println!("failed to parse TOML configuration 'toolstate.toml': {}", err); - process::exit(2); - }); - let build = toml.build.clone().unwrap_or(Build::default()); set(&mut config.build, build.build.clone().map(|x| INTERNER.intern_string(x))); set(&mut config.build, flags.build); @@ -447,7 +437,8 @@ impl Config { set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp); set(&mut config.llvm_link_shared, llvm.link_shared); config.llvm_targets = llvm.targets.clone(); - config.llvm_experimental_targets = llvm.experimental_targets.clone(); + config.llvm_experimental_targets = llvm.experimental_targets.clone() + .unwrap_or("WebAssembly".to_string()); config.llvm_link_jobs = llvm.link_jobs; } @@ -470,8 +461,10 @@ impl Config { set(&mut config.rust_dist_src, rust.dist_src); set(&mut config.quiet_tests, rust.quiet_tests); set(&mut config.test_miri, rust.test_miri); + config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false); config.rustc_default_linker = rust.default_linker.clone(); config.musl_root = rust.musl_root.clone().map(PathBuf::from); + config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from); match rust.codegen_units { Some(0) => config.rust_codegen_units = Some(num_cpus::get() as u32), diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 579422c979..48ca2838e4 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -77,6 +77,7 @@ o("debuginfo", "rust.debuginfo", "build with debugger metadata") o("debuginfo-lines", "rust.debuginfo-lines", "build with line number debugger metadata") o("debuginfo-only-std", "rust.debuginfo-only-std", "build only libstd with debugging information") o("debug-jemalloc", "rust.debug-jemalloc", "build jemalloc with --enable-debug --enable-fill") +v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file") v("prefix", "install.prefix", "set installation prefix") v("localstatedir", "install.localstatedir", "local state directory") diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 9f7e3de9dc..f011069a70 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -28,11 +28,12 @@ use build_helper::output; use {Build, Compiler, Mode}; use channel; -use util::{cp_r, libdir, is_dylib, cp_filtered, copy}; +use util::{cp_r, libdir, is_dylib, cp_filtered, copy, replace_in_file}; use builder::{Builder, RunConfig, ShouldRun, Step}; use compile; use tool::{self, Tool}; use cache::{INTERNER, Interned}; +use time; pub fn pkgname(build: &Build, component: &str) -> String { if component == "cargo" { @@ -434,7 +435,21 @@ impl Step for Rustc { // Man pages t!(fs::create_dir_all(image.join("share/man/man1"))); - cp_r(&build.src.join("src/doc/man"), &image.join("share/man/man1")); + let man_src = build.src.join("src/doc/man"); + let man_dst = image.join("share/man/man1"); + let month_year = t!(time::strftime("%B %Y", &time::now())); + // don't use our `bootstrap::util::{copy, cp_r}`, because those try + // to hardlink, and we don't want to edit the source templates + for entry_result in t!(fs::read_dir(man_src)) { + let file_entry = t!(entry_result); + let page_src = file_entry.path(); + let page_dst = man_dst.join(file_entry.file_name()); + t!(fs::copy(&page_src, &page_dst)); + // template in month/year and version number + replace_in_file(&page_dst, + &[("", &month_year), + ("", channel::CFG_RELEASE_NUM)]); + } // Debugger scripts builder.ensure(DebuggerScripts { @@ -489,6 +504,7 @@ impl Step for DebuggerScripts { install(&build.src.join("src/etc/rust-windbg.cmd"), &sysroot.join("bin"), 0o755); + cp_debugger_script("natvis/intrinsic.natvis"); cp_debugger_script("natvis/liballoc.natvis"); cp_debugger_script("natvis/libcore.natvis"); } else { @@ -1061,11 +1077,6 @@ impl Step for Rls { let target = self.target; assert!(build.config.extended); - if !builder.config.toolstate.rls.testing() { - println!("skipping Dist RLS stage{} ({})", stage, target); - return None - } - println!("Dist RLS stage{} ({})", stage, target); let src = build.src.join("src/tools/rls"); let release_num = build.release_num("rls"); @@ -1083,7 +1094,8 @@ impl Step for Rls { let rls = builder.ensure(tool::Rls { compiler: builder.compiler(stage, build.build), target - }).expect("Rls to build: toolstate is testing"); + }).or_else(|| { println!("Unable to build RLS, skipping dist"); None })?; + install(&rls, &image.join("bin"), 0o755); let doc = image.join("share/doc/rls"); install(&src.join("README.md"), &doc, 0o644); @@ -1147,11 +1159,6 @@ impl Step for Rustfmt { let target = self.target; assert!(build.config.extended); - if !builder.config.toolstate.rustfmt.testing() { - println!("skipping Dist Rustfmt stage{} ({})", stage, target); - return None - } - println!("Dist Rustfmt stage{} ({})", stage, target); let src = build.src.join("src/tools/rustfmt"); let release_num = build.release_num("rustfmt"); @@ -1167,8 +1174,14 @@ impl Step for Rustfmt { let rustfmt = builder.ensure(tool::Rustfmt { compiler: builder.compiler(stage, build.build), target - }).expect("Rustfmt to build: toolstate is testing"); + }).or_else(|| { println!("Unable to build Rustfmt, skipping dist"); None })?; + let cargofmt = builder.ensure(tool::Cargofmt { + compiler: builder.compiler(stage, build.build), + target + }).or_else(|| { println!("Unable to build Cargofmt, skipping dist"); None })?; + install(&rustfmt, &image.join("bin"), 0o755); + install(&cargofmt, &image.join("bin"), 0o755); let doc = image.join("share/doc/rustfmt"); install(&src.join("README.md"), &doc, 0o644); install(&src.join("LICENSE-MIT"), &doc, 0o644); @@ -1637,7 +1650,6 @@ fn add_env(build: &Build, cmd: &mut Command, target: Interned) { cmd.env("CFG_RELEASE_INFO", build.rust_version()) .env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM) .env("CFG_RELEASE", build.rust_release()) - .env("CFG_PRERELEASE_VERSION", channel::CFG_PRERELEASE_VERSION) .env("CFG_VER_MAJOR", parts.next().unwrap()) .env("CFG_VER_MINOR", parts.next().unwrap()) .env("CFG_VER_PATCH", parts.next().unwrap()) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 3c12cfc4c7..832da24c99 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -671,7 +671,8 @@ impl Step for ErrorIndex { index.arg(out.join("error-index.html")); // FIXME: shouldn't have to pass this env var - index.env("CFG_BUILD", &build.build); + index.env("CFG_BUILD", &build.build) + .env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir()); build.run(&mut index); } diff --git a/src/bootstrap/job.rs b/src/bootstrap/job.rs index 72a5d1338b..fa3ba02482 100644 --- a/src/bootstrap/job.rs +++ b/src/bootstrap/job.rs @@ -185,7 +185,7 @@ pub unsafe fn setup(build: &mut Build) { 0, FALSE, DUPLICATE_SAME_ACCESS); // If this failed, well at least we tried! An example of DuplicateHandle - // failing in the past has been when the wrong python2 package spawed this + // failing in the past has been when the wrong python2 package spawned this // build system (e.g. the `python2` package in MSYS instead of // `mingw-w64-x86_64-python2`. Not sure why it failed, but the "failure // mode" here is that we only clean everything up when the build system diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 6832992259..52767b403e 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -130,11 +130,12 @@ extern crate cc; extern crate getopts; extern crate num_cpus; extern crate toml; +extern crate time; #[cfg(unix)] extern crate libc; -use std::cell::RefCell; +use std::cell::{RefCell, Cell}; use std::collections::{HashSet, HashMap}; use std::env; use std::fs::{self, File}; @@ -143,8 +144,7 @@ use std::path::{PathBuf, Path}; use std::process::{self, Command}; use std::slice; -use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime, - BuildExpectation}; +use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime}; use util::{exe, libdir, OutputFolder, CiEnv}; @@ -190,6 +190,7 @@ mod job { pub use config::Config; use flags::Subcommand; use cache::{Interned, INTERNER}; +use toolstate::ToolState; /// A structure representing a Rust compiler. /// @@ -250,6 +251,7 @@ pub struct Build { is_sudo: bool, ci_env: CiEnv, delayed_failures: RefCell>, + prerelease_version: Cell>, } #[derive(Debug)] @@ -335,6 +337,7 @@ impl Build { is_sudo, ci_env: CiEnv::current(), delayed_failures: RefCell::new(Vec::new()), + prerelease_version: Cell::new(None), } } @@ -568,31 +571,24 @@ impl Build { .join(libdir(&self.config.build)) } - /// Runs a command, printing out nice contextual information if its build - /// status is not the expected one - fn run_expecting(&self, cmd: &mut Command, expect: BuildExpectation) { - self.verbose(&format!("running: {:?}", cmd)); - run_silent(cmd, expect) - } - /// Runs a command, printing out nice contextual information if it fails. fn run(&self, cmd: &mut Command) { - self.run_expecting(cmd, BuildExpectation::None) + self.verbose(&format!("running: {:?}", cmd)); + run_silent(cmd) } /// Runs a command, printing out nice contextual information if it fails. fn run_quiet(&self, cmd: &mut Command) { self.verbose(&format!("running: {:?}", cmd)); - run_suppressed(cmd, BuildExpectation::None) + run_suppressed(cmd) } - /// Runs a command, printing out nice contextual information if its build - /// status is not the expected one. - /// Exits if the command failed to execute at all, otherwise returns whether - /// the expectation was met - fn try_run(&self, cmd: &mut Command, expect: BuildExpectation) -> bool { + /// Runs a command, printing out nice contextual information if it fails. + /// Exits if the command failed to execute at all, otherwise returns its + /// `status.success()`. + fn try_run(&self, cmd: &mut Command) -> bool { self.verbose(&format!("running: {:?}", cmd)); - try_run_silent(cmd, expect) + try_run_silent(cmd) } /// Runs a command, printing out nice contextual information if it fails. @@ -600,7 +596,7 @@ impl Build { /// `status.success()`. fn try_run_quiet(&self, cmd: &mut Command) -> bool { self.verbose(&format!("running: {:?}", cmd)); - try_run_suppressed(cmd, BuildExpectation::None) + try_run_suppressed(cmd) } pub fn is_verbose(&self) -> bool { @@ -725,6 +721,11 @@ impl Build { self.config.python.as_ref().unwrap() } + /// Temporary directory that extended error information is emitted to. + fn extended_error_dir(&self) -> PathBuf { + self.out.join("tmp/extended-error-metadata") + } + /// Tests whether the `compiler` compiling for `target` should be forced to /// use a stage1 compiler instead. /// @@ -776,12 +777,63 @@ impl Build { fn release(&self, num: &str) -> String { match &self.config.channel[..] { "stable" => num.to_string(), - "beta" => format!("{}-beta{}", num, channel::CFG_PRERELEASE_VERSION), + "beta" => if self.rust_info.is_git() { + format!("{}-beta.{}", num, self.beta_prerelease_version()) + } else { + format!("{}-beta", num) + }, "nightly" => format!("{}-nightly", num), _ => format!("{}-dev", num), } } + fn beta_prerelease_version(&self) -> u32 { + if let Some(s) = self.prerelease_version.get() { + return s + } + + let beta = output( + Command::new("git") + .arg("ls-remote") + .arg("origin") + .arg("beta") + .current_dir(&self.src) + ); + let beta = beta.trim().split_whitespace().next().unwrap(); + let master = output( + Command::new("git") + .arg("ls-remote") + .arg("origin") + .arg("master") + .current_dir(&self.src) + ); + let master = master.trim().split_whitespace().next().unwrap(); + + // Figure out where the current beta branch started. + let base = output( + Command::new("git") + .arg("merge-base") + .arg(beta) + .arg(master) + .current_dir(&self.src), + ); + let base = base.trim(); + + // Next figure out how many merge commits happened since we branched off + // beta. That's our beta number! + let count = output( + Command::new("git") + .arg("rev-list") + .arg("--count") + .arg("--merges") + .arg(format!("{}...HEAD", base)) + .current_dir(&self.src), + ); + let n = count.trim().parse().unwrap(); + self.prerelease_version.set(Some(n)); + return n + } + /// Returns the value of `release` above for Rust itself. fn rust_release(&self) -> String { self.release(channel::CFG_RELEASE_NUM) @@ -874,6 +926,30 @@ impl Build { } } + /// Updates the actual toolstate of a tool. + /// + /// The toolstates are saved to the file specified by the key + /// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be + /// done. The file is updated immediately after this function completes. + pub fn save_toolstate(&self, tool: &str, state: ToolState) { + use std::io::{Seek, SeekFrom}; + + if let Some(ref path) = self.config.save_toolstates { + let mut file = t!(fs::OpenOptions::new() + .create(true) + .read(true) + .write(true) + .open(path)); + + let mut current_toolstates: HashMap, ToolState> = + serde_json::from_reader(&mut file).unwrap_or_default(); + current_toolstates.insert(tool.into(), state); + t!(file.seek(SeekFrom::Start(0))); + t!(file.set_len(0)); + t!(serde_json::to_writer(file, ¤t_toolstates)); + } + } + /// Get a list of crates from a root crate. /// /// Returns Vec<(crate, path to crate, is_root_crate)> diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index eb92c8f143..925a361f0b 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -53,9 +53,7 @@ check: check-aux: $(Q)$(BOOTSTRAP) test \ src/tools/cargo \ - src/tools/rls \ - src/tools/rustfmt \ - src/tools/miri \ + src/tools/cargotest \ src/test/pretty \ src/test/run-pass/pretty \ src/test/run-fail/pretty \ diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index fce6755aea..a5408ee381 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -110,10 +110,7 @@ impl Step for Llvm { None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon", }; - let llvm_exp_targets = match build.config.llvm_experimental_targets { - Some(ref s) => s, - None => "", - }; + let llvm_exp_targets = &build.config.llvm_experimental_targets; let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"}; @@ -319,7 +316,7 @@ impl Step for TestHelpers { .warnings(false) .debug(false) .file(build.src.join("src/rt/rust_test_helpers.c")) - .compile("librust_test_helpers.a"); + .compile("rust_test_helpers"); } } diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 8b23be69a8..bc275b7fc7 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -78,7 +78,7 @@ pub fn check(build: &mut Build) { } let mut cmd_finder = Finder::new(); - // If we've got a git directory we're gona need git to update + // If we've got a git directory we're gonna need git to update // submodules and learn about various other aspects. if build.rust_info.is_git() { cmd_finder.must_have("git"); diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 7175fed541..ea055cb5d1 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -11,7 +11,7 @@ use std::fs; use std::env; use std::path::PathBuf; -use std::process::Command; +use std::process::{Command, exit}; use Mode; use Compiler; @@ -22,7 +22,6 @@ use native; use channel::GitInfo; use cache::Interned; use toolstate::ToolState; -use build_helper::BuildExpectation; #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct CleanTools { @@ -82,7 +81,7 @@ struct ToolBuild { tool: &'static str, path: &'static str, mode: Mode, - expectation: BuildExpectation, + is_ext_tool: bool, } impl Step for ToolBuild { @@ -102,7 +101,7 @@ impl Step for ToolBuild { let target = self.target; let tool = self.tool; let path = self.path; - let expectation = self.expectation; + let is_ext_tool = self.is_ext_tool; match self.mode { Mode::Libstd => builder.ensure(compile::Std { compiler, target }), @@ -115,15 +114,25 @@ impl Step for ToolBuild { println!("Building stage{} tool {} ({})", compiler.stage, tool, target); let mut cargo = prepare_tool_cargo(builder, compiler, target, "build", path); - build.run_expecting(&mut cargo, expectation); - if expectation == BuildExpectation::Succeeding || expectation == BuildExpectation::None { + let is_expected = build.try_run(&mut cargo); + build.save_toolstate(tool, if is_expected { + ToolState::TestFail + } else { + ToolState::BuildFail + }); + + if !is_expected { + if !is_ext_tool { + exit(1); + } else { + return None; + } + } else { let cargo_out = build.cargo_out(compiler, Mode::Tool, target) .join(exe(tool, &compiler.host)); let bin = build.tools_dir(compiler).join(exe(tool, &compiler.host)); copy(&cargo_out, &bin); Some(bin) - } else { - None } } } @@ -232,8 +241,8 @@ macro_rules! tool { tool: $tool_name, mode: $mode, path: $path, - expectation: BuildExpectation::None, - }).expect("expected to build -- BuildExpectation::None") + is_ext_tool: false, + }).expect("expected to build -- essential tool") } } )+ @@ -280,8 +289,8 @@ impl Step for RemoteTestServer { tool: "remote-test-server", mode: Mode::Libstd, path: "src/tools/remote-test-server", - expectation: BuildExpectation::None, - }).expect("expected to build -- BuildExpectation::None") + is_ext_tool: false, + }).expect("expected to build -- essential tool") } } @@ -398,76 +407,70 @@ impl Step for Cargo { tool: "cargo", mode: Mode::Librustc, path: "src/tools/cargo", - expectation: BuildExpectation::None, - }).expect("BuildExpectation::None - expected to build") + is_ext_tool: false, + }).expect("expected to build -- essential tool") } } -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Clippy { - pub compiler: Compiler, - pub target: Interned, +macro_rules! tool_extended { + (($sel:ident, $builder:ident), + $($name:ident, + $toolstate:ident, + $path:expr, + $tool_name:expr, + $extra_deps:block;)+) => { + $( + #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] + pub struct $name { + pub compiler: Compiler, + pub target: Interned, + } + + impl Step for $name { + type Output = Option; + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun) -> ShouldRun { + let builder = run.builder; + run.path($path).default_condition(builder.build.config.extended) + } + + fn make_run(run: RunConfig) { + run.builder.ensure($name { + compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build), + target: run.target, + }); + } + + fn run($sel, $builder: &Builder) -> Option { + $extra_deps + $builder.ensure(ToolBuild { + compiler: $sel.compiler, + target: $sel.target, + tool: $tool_name, + mode: Mode::Librustc, + path: $path, + is_ext_tool: true, + }) + } + } + )+ + } } -impl Step for Clippy { - type Output = Option; - const DEFAULT: bool = true; - const ONLY_HOSTS: bool = true; - - fn should_run(run: ShouldRun) -> ShouldRun { - let builder = run.builder; - run.path("src/tools/clippy").default_condition(builder.build.config.extended) - } - - fn make_run(run: RunConfig) { - run.builder.ensure(Clippy { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build), - target: run.target, - }); - } - - fn run(self, builder: &Builder) -> Option { +tool_extended!((self, builder), + Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {}; + Clippy, clippy, "src/tools/clippy", "clippy-driver", { // Clippy depends on procedural macros (serde), which requires a full host // compiler to be available, so we need to depend on that. builder.ensure(compile::Rustc { compiler: self.compiler, target: builder.build.build, }); - builder.ensure(ToolBuild { - compiler: self.compiler, - target: self.target, - tool: "clippy-driver", - mode: Mode::Librustc, - path: "src/tools/clippy", - expectation: builder.build.config.toolstate.clippy.passes(ToolState::Compiling), - }) - } -} - -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Rls { - pub compiler: Compiler, - pub target: Interned, -} - -impl Step for Rls { - type Output = Option; - const DEFAULT: bool = true; - const ONLY_HOSTS: bool = true; - - fn should_run(run: ShouldRun) -> ShouldRun { - let builder = run.builder; - run.path("src/tools/rls").default_condition(builder.build.config.extended) - } - - fn make_run(run: RunConfig) { - run.builder.ensure(Rls { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build), - target: run.target, - }); - } - - fn run(self, builder: &Builder) -> Option { + }; + Miri, miri, "src/tools/miri", "miri", {}; + Rls, rls, "src/tools/rls", "rls", { builder.ensure(native::Openssl { target: self.target, }); @@ -477,87 +480,9 @@ impl Step for Rls { compiler: self.compiler, target: builder.build.build, }); - builder.ensure(ToolBuild { - compiler: self.compiler, - target: self.target, - tool: "rls", - mode: Mode::Librustc, - path: "src/tools/rls", - expectation: builder.build.config.toolstate.rls.passes(ToolState::Compiling), - }) - } -} - -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Rustfmt { - pub compiler: Compiler, - pub target: Interned, -} - -impl Step for Rustfmt { - type Output = Option; - const DEFAULT: bool = true; - const ONLY_HOSTS: bool = true; - - fn should_run(run: ShouldRun) -> ShouldRun { - let builder = run.builder; - run.path("src/tools/rustfmt").default_condition(builder.build.config.extended) - } - - fn make_run(run: RunConfig) { - run.builder.ensure(Rustfmt { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build), - target: run.target, - }); - } - - fn run(self, builder: &Builder) -> Option { - builder.ensure(ToolBuild { - compiler: self.compiler, - target: self.target, - tool: "rustfmt", - mode: Mode::Librustc, - path: "src/tools/rustfmt", - expectation: builder.build.config.toolstate.rustfmt.passes(ToolState::Compiling), - }) - } -} - - -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Miri { - pub compiler: Compiler, - pub target: Interned, -} - -impl Step for Miri { - type Output = Option; - const DEFAULT: bool = true; - const ONLY_HOSTS: bool = true; - - fn should_run(run: ShouldRun) -> ShouldRun { - let build_miri = run.builder.build.config.test_miri; - run.path("src/tools/miri").default_condition(build_miri) - } - - fn make_run(run: RunConfig) { - run.builder.ensure(Miri { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build), - target: run.target, - }); - } - - fn run(self, builder: &Builder) -> Option { - builder.ensure(ToolBuild { - compiler: self.compiler, - target: self.target, - tool: "miri", - mode: Mode::Librustc, - path: "src/tools/miri", - expectation: builder.build.config.toolstate.miri.passes(ToolState::Compiling), - }) - } -} + }; + Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {}; +); impl<'a> Builder<'a> { /// Get a `Command` which is ready to run `tool` in `stage` built for diff --git a/src/bootstrap/toolstate.rs b/src/bootstrap/toolstate.rs index 328cbf0e5d..f63c198890 100644 --- a/src/bootstrap/toolstate.rs +++ b/src/bootstrap/toolstate.rs @@ -8,51 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use build_helper::BuildExpectation; - -#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq)] +#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] /// Whether a tool can be compiled, tested or neither pub enum ToolState { /// The tool compiles successfully, but the test suite fails - Compiling = 1, + TestFail = 1, /// The tool compiles successfully and its test suite passes - Testing = 2, + TestPass = 2, /// The tool can't even be compiled - Broken = 0, -} - -impl ToolState { - /// If a tool with the current toolstate should be working on - /// the given toolstate - pub fn passes(self, other: ToolState) -> BuildExpectation { - if self as usize >= other as usize { - BuildExpectation::Succeeding - } else { - BuildExpectation::Failing - } - } - - pub fn testing(&self) -> bool { - match *self { - ToolState::Testing => true, - _ => false, - } - } + BuildFail = 0, } impl Default for ToolState { fn default() -> Self { // err on the safe side - ToolState::Broken + ToolState::BuildFail } } - -#[derive(Copy, Clone, Debug, Deserialize, Default)] -/// Used to express which tools should (not) be compiled or tested. -/// This is created from `toolstate.toml`. -pub struct ToolStates { - pub miri: ToolState, - pub clippy: ToolState, - pub rls: ToolState, - pub rustfmt: ToolState, -} diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 2506048858..874065f21d 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -15,8 +15,8 @@ use std::env; use std::str; -use std::fs::{self, File}; -use std::io::{self, Read, Write}; +use std::fs::{self, File, OpenOptions}; +use std::io::{self, Read, Write, Seek, SeekFrom}; use std::path::{Path, PathBuf}; use std::process::Command; use std::time::{SystemTime, Instant}; @@ -51,6 +51,20 @@ pub fn copy(src: &Path, dst: &Path) { t!(filetime::set_file_times(dst, atime, mtime)); } +/// Search-and-replaces within a file. (Not maximally efficiently: allocates a +/// new string for each replacement.) +pub fn replace_in_file(path: &Path, replacements: &[(&str, &str)]) { + let mut contents = String::new(); + let mut file = t!(OpenOptions::new().read(true).write(true).open(path)); + t!(file.read_to_string(&mut contents)); + for &(target, replacement) in replacements { + contents = contents.replace(target, replacement); + } + t!(file.seek(SeekFrom::Start(0))); + t!(file.set_len(0)); + t!(file.write_all(contents.as_bytes())); +} + pub fn read_stamp_file(stamp: &Path) -> Vec { let mut paths = Vec::new(); let mut contents = Vec::new(); diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs index 97723e260f..363bbd7954 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -35,97 +35,55 @@ macro_rules! t { }) } -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum BuildExpectation { - Succeeding, - Failing, - None, -} - -pub fn run(cmd: &mut Command, expect: BuildExpectation) { +pub fn run(cmd: &mut Command) { println!("running: {:?}", cmd); - run_silent(cmd, expect); + run_silent(cmd); } -pub fn run_silent(cmd: &mut Command, expect: BuildExpectation) { - if !try_run_silent(cmd, expect) { +pub fn run_silent(cmd: &mut Command) { + if !try_run_silent(cmd) { std::process::exit(1); } } -pub fn try_run_silent(cmd: &mut Command, expect: BuildExpectation) -> bool { +pub fn try_run_silent(cmd: &mut Command) -> bool { let status = match cmd.status() { Ok(status) => status, Err(e) => fail(&format!("failed to execute command: {:?}\nerror: {}", cmd, e)), }; - process_status( - cmd, - status.success(), - expect, - || println!("\n\ncommand did not execute successfully: {:?}\n\ - expected success, got: {}\n\n", - cmd, - status)) -} - -fn process_status( - cmd: &Command, - success: bool, - expect: BuildExpectation, - f: F, -) -> bool { - use BuildExpectation::*; - match (expect, success) { - (None, false) => { f(); false }, - // Non-tool build succeeds, everything is good - (None, true) => true, - // Tool expected to work and is working - (Succeeding, true) => true, - // Tool expected to fail and is failing - (Failing, false) => { - println!("This failure is expected (see `src/tools/toolstate.toml`)"); - true - }, - // Tool expected to work, but is failing - (Succeeding, false) => { - f(); - println!("You can disable the tool in `src/tools/toolstate.toml`"); - false - }, - // Tool expected to fail, but is working - (Failing, true) => { - println!("Expected `{:?}` to fail, but it succeeded.\n\ - Please adjust `src/tools/toolstate.toml` accordingly", cmd); - false - } + if !status.success() { + println!("\n\ncommand did not execute successfully: {:?}\n\ + expected success, got: {}\n\n", + cmd, + status); } + status.success() } -pub fn run_suppressed(cmd: &mut Command, expect: BuildExpectation) { - if !try_run_suppressed(cmd, expect) { +pub fn run_suppressed(cmd: &mut Command) { + if !try_run_suppressed(cmd) { std::process::exit(1); } } -pub fn try_run_suppressed(cmd: &mut Command, expect: BuildExpectation) -> bool { +pub fn try_run_suppressed(cmd: &mut Command) -> bool { let output = match cmd.output() { Ok(status) => status, Err(e) => fail(&format!("failed to execute command: {:?}\nerror: {}", cmd, e)), }; - process_status( - cmd, - output.status.success(), - expect, - || println!("\n\ncommand did not execute successfully: {:?}\n\ + if !output.status.success() { + println!("\n\ncommand did not execute successfully: {:?}\n\ expected success, got: {}\n\n\ stdout ----\n{}\n\ stderr ----\n{}\n\n", cmd, output.status, String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr))) + String::from_utf8_lossy(&output.stderr)); + } + output.status.success() } pub fn gnu_target(target: &str) -> String { @@ -190,6 +148,9 @@ pub fn mtime(path: &Path) -> FileTime { /// /// Uses last-modified time checks to verify this. pub fn up_to_date(src: &Path, dst: &Path) -> bool { + if !dst.exists() { + return false; + } let threshold = mtime(dst); let meta = match fs::metadata(src) { Ok(meta) => meta, diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 922deba736..8d4dbc3999 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -36,14 +36,14 @@ a Docker image. 1. Select the "default" virtual machine inside VirtualBox, then click "Settings" - 2. Go to "Shared Folders", click "Add shared foldrer" (the folder icon with + 2. Go to "Shared Folders", click "Add shared folder" (the folder icon with a plus sign), fill in the following information, then click "OK": * Folder path: `E:\rust` * Folder name: `e/rust` * Read-only: ☐ *unchecked* * Auto-mount: ☑ *checked* - * Make Permanant: ☑ *checked* + * Make Permanent: ☑ *checked* 3. VirtualBox might not support creating symbolic links inside a shared folder by default. You can enable it manually by running these from `cmd.exe`: diff --git a/src/ci/docker/dist-i686-freebsd/Dockerfile b/src/ci/docker/dist-i686-freebsd/Dockerfile index b82d227b3e..686afc9728 100644 --- a/src/ci/docker/dist-i686-freebsd/Dockerfile +++ b/src/ci/docker/dist-i686-freebsd/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:16.04 RUN apt-get update && apt-get install -y --no-install-recommends \ - g++ \ + clang \ make \ file \ curl \ @@ -16,16 +16,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config -COPY dist-i686-freebsd/build-toolchain.sh /tmp/ -RUN /tmp/build-toolchain.sh i686 +COPY scripts/freebsd-toolchain.sh /tmp/ +RUN /tmp/freebsd-toolchain.sh i686 COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV \ AR_i686_unknown_freebsd=i686-unknown-freebsd10-ar \ - CC_i686_unknown_freebsd=i686-unknown-freebsd10-gcc \ - CXX_i686_unknown_freebsd=i686-unknown-freebsd10-g++ + CC_i686_unknown_freebsd=i686-unknown-freebsd10-clang \ + CXX_i686_unknown_freebsd=i686-unknown-freebsd10-clang++ ENV HOSTS=i686-unknown-freebsd diff --git a/src/ci/docker/dist-i686-freebsd/build-toolchain.sh b/src/ci/docker/dist-i686-freebsd/build-toolchain.sh deleted file mode 100755 index 3c86a8e381..0000000000 --- a/src/ci/docker/dist-i686-freebsd/build-toolchain.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -ARCH=$1 -BINUTILS=2.25.1 -GCC=6.4.0 - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - $@ &> /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir binutils -cd binutils - -# First up, build binutils -curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf - -mkdir binutils-build -cd binutils-build -hide_output ../binutils-$BINUTILS/configure \ - --target=$ARCH-unknown-freebsd10 -hide_output make -j10 -hide_output make install -cd ../.. -rm -rf binutils - -# Next, download the FreeBSD libc and relevant header files - -mkdir freebsd -case "$ARCH" in - x86_64) - URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.2-RELEASE/base.txz - ;; - i686) - URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/10.2-RELEASE/base.txz - ;; -esac -curl $URL | tar xJf - -C freebsd ./usr/include ./usr/lib ./lib - -dst=/usr/local/$ARCH-unknown-freebsd10 - -cp -r freebsd/usr/include $dst/ -cp freebsd/usr/lib/crt1.o $dst/lib -cp freebsd/usr/lib/Scrt1.o $dst/lib -cp freebsd/usr/lib/crti.o $dst/lib -cp freebsd/usr/lib/crtn.o $dst/lib -cp freebsd/usr/lib/libc.a $dst/lib -cp freebsd/usr/lib/libutil.a $dst/lib -cp freebsd/usr/lib/libutil_p.a $dst/lib -cp freebsd/usr/lib/libm.a $dst/lib -cp freebsd/usr/lib/librt.so.1 $dst/lib -cp freebsd/usr/lib/libexecinfo.so.1 $dst/lib -cp freebsd/lib/libc.so.7 $dst/lib -cp freebsd/lib/libm.so.5 $dst/lib -cp freebsd/lib/libutil.so.9 $dst/lib -cp freebsd/lib/libthr.so.3 $dst/lib/libpthread.so - -ln -s libc.so.7 $dst/lib/libc.so -ln -s libm.so.5 $dst/lib/libm.so -ln -s librt.so.1 $dst/lib/librt.so -ln -s libutil.so.9 $dst/lib/libutil.so -ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so -rm -rf freebsd - -# Finally, download and build gcc to target FreeBSD -mkdir gcc -cd gcc -curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf - -cd gcc-$GCC -./contrib/download_prerequisites - -mkdir ../gcc-build -cd ../gcc-build -hide_output ../gcc-$GCC/configure \ - --enable-languages=c,c++ \ - --target=$ARCH-unknown-freebsd10 \ - --disable-multilib \ - --disable-nls \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libssp \ - --disable-libvtv \ - --disable-libcilkrts \ - --disable-libada \ - --disable-libsanitizer \ - --disable-libquadmath-support \ - --disable-lto -hide_output make -j10 -hide_output make install -cd ../.. -rm -rf gcc diff --git a/src/ci/docker/cross/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile similarity index 74% rename from src/ci/docker/cross/Dockerfile rename to src/ci/docker/dist-various-1/Dockerfile index 05745709a0..b58ee7a719 100644 --- a/src/ci/docker/cross/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -24,19 +24,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /tmp -COPY cross/build-rumprun.sh /tmp/ +COPY dist-various-1/build-rumprun.sh /tmp/ RUN ./build-rumprun.sh -COPY cross/build-arm-musl.sh /tmp/ +COPY dist-various-1/build-arm-musl.sh /tmp/ RUN ./build-arm-musl.sh -COPY cross/install-mips-musl.sh /tmp/ +COPY dist-various-1/install-mips-musl.sh /tmp/ RUN ./install-mips-musl.sh -COPY cross/install-mipsel-musl.sh /tmp/ +COPY dist-various-1/install-mipsel-musl.sh /tmp/ RUN ./install-mipsel-musl.sh -COPY cross/install-x86_64-redox.sh /tmp/ +COPY dist-various-1/install-x86_64-redox.sh /tmp/ RUN ./install-x86_64-redox.sh ENV TARGETS=asmjs-unknown-emscripten @@ -46,15 +46,20 @@ ENV TARGETS=$TARGETS,mips-unknown-linux-musl ENV TARGETS=$TARGETS,mipsel-unknown-linux-musl ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf +ENV TARGETS=$TARGETS,armv5te-unknown-linux-gnueabi ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf ENV TARGETS=$TARGETS,aarch64-unknown-linux-musl ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu ENV TARGETS=$TARGETS,x86_64-unknown-redox +# FIXME: remove armv5te vars after https://github.com/alexcrichton/cc-rs/issues/271 +# get fixed and cc update ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \ CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ - CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc + CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \ + CC_armv5te_unknown_linux_gnueabi=arm-linux-gnueabi-gcc \ + CFLAGS_armv5te_unknown_linux_gnueabi="-march=armv5te -marm -mfloat-abi=soft" # Suppress some warnings in the openwrt toolchains we downloaded ENV STAGING_DIR=/tmp diff --git a/src/ci/docker/cross/build-arm-musl.sh b/src/ci/docker/dist-various-1/build-arm-musl.sh similarity index 100% rename from src/ci/docker/cross/build-arm-musl.sh rename to src/ci/docker/dist-various-1/build-arm-musl.sh diff --git a/src/ci/docker/cross/build-rumprun.sh b/src/ci/docker/dist-various-1/build-rumprun.sh similarity index 100% rename from src/ci/docker/cross/build-rumprun.sh rename to src/ci/docker/dist-various-1/build-rumprun.sh diff --git a/src/ci/docker/cross/install-mips-musl.sh b/src/ci/docker/dist-various-1/install-mips-musl.sh similarity index 100% rename from src/ci/docker/cross/install-mips-musl.sh rename to src/ci/docker/dist-various-1/install-mips-musl.sh diff --git a/src/ci/docker/cross/install-mipsel-musl.sh b/src/ci/docker/dist-various-1/install-mipsel-musl.sh similarity index 100% rename from src/ci/docker/cross/install-mipsel-musl.sh rename to src/ci/docker/dist-various-1/install-mipsel-musl.sh diff --git a/src/ci/docker/cross/install-x86_64-redox.sh b/src/ci/docker/dist-various-1/install-x86_64-redox.sh similarity index 100% rename from src/ci/docker/cross/install-x86_64-redox.sh rename to src/ci/docker/dist-various-1/install-x86_64-redox.sh diff --git a/src/ci/docker/cross2/Dockerfile b/src/ci/docker/dist-various-2/Dockerfile similarity index 91% rename from src/ci/docker/cross2/Dockerfile rename to src/ci/docker/dist-various-2/Dockerfile index cc260382f4..c7885db559 100644 --- a/src/ci/docker/cross2/Dockerfile +++ b/src/ci/docker/dist-various-2/Dockerfile @@ -21,8 +21,8 @@ RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7 RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2-testing main' WORKDIR /tmp -COPY cross2/shared.sh cross2/build-fuchsia-toolchain.sh /tmp/ -COPY cross2/build-solaris-toolchain.sh /tmp/ +COPY dist-various-2/shared.sh dist-various-2/build-fuchsia-toolchain.sh /tmp/ +COPY dist-various-2/build-solaris-toolchain.sh /tmp/ RUN /tmp/build-fuchsia-toolchain.sh RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc @@ -47,6 +47,7 @@ ENV \ ENV TARGETS=x86_64-unknown-fuchsia ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia ENV TARGETS=$TARGETS,sparcv9-sun-solaris +ENV TARGETS=$TARGETS,wasm32-unknown-unknown ENV TARGETS=$TARGETS,x86_64-sun-solaris ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32 diff --git a/src/ci/docker/cross2/build-fuchsia-toolchain.sh b/src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh similarity index 100% rename from src/ci/docker/cross2/build-fuchsia-toolchain.sh rename to src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh diff --git a/src/ci/docker/cross2/build-solaris-toolchain.sh b/src/ci/docker/dist-various-2/build-solaris-toolchain.sh similarity index 100% rename from src/ci/docker/cross2/build-solaris-toolchain.sh rename to src/ci/docker/dist-various-2/build-solaris-toolchain.sh diff --git a/src/ci/docker/cross2/shared.sh b/src/ci/docker/dist-various-2/shared.sh similarity index 100% rename from src/ci/docker/cross2/shared.sh rename to src/ci/docker/dist-various-2/shared.sh diff --git a/src/ci/docker/dist-x86_64-freebsd/Dockerfile b/src/ci/docker/dist-x86_64-freebsd/Dockerfile index b7c00df4db..7483d39562 100644 --- a/src/ci/docker/dist-x86_64-freebsd/Dockerfile +++ b/src/ci/docker/dist-x86_64-freebsd/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:16.04 RUN apt-get update && apt-get install -y --no-install-recommends \ - g++ \ + clang \ make \ file \ curl \ @@ -16,16 +16,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config -COPY dist-x86_64-freebsd/build-toolchain.sh /tmp/ -RUN /tmp/build-toolchain.sh x86_64 +COPY scripts/freebsd-toolchain.sh /tmp/ +RUN /tmp/freebsd-toolchain.sh x86_64 COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV \ AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-ar \ - CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-gcc \ - CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-g++ + CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-clang \ + CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-clang++ ENV HOSTS=x86_64-unknown-freebsd diff --git a/src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh b/src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh deleted file mode 100755 index 3c86a8e381..0000000000 --- a/src/ci/docker/dist-x86_64-freebsd/build-toolchain.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -ARCH=$1 -BINUTILS=2.25.1 -GCC=6.4.0 - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - $@ &> /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir binutils -cd binutils - -# First up, build binutils -curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf - -mkdir binutils-build -cd binutils-build -hide_output ../binutils-$BINUTILS/configure \ - --target=$ARCH-unknown-freebsd10 -hide_output make -j10 -hide_output make install -cd ../.. -rm -rf binutils - -# Next, download the FreeBSD libc and relevant header files - -mkdir freebsd -case "$ARCH" in - x86_64) - URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.2-RELEASE/base.txz - ;; - i686) - URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/10.2-RELEASE/base.txz - ;; -esac -curl $URL | tar xJf - -C freebsd ./usr/include ./usr/lib ./lib - -dst=/usr/local/$ARCH-unknown-freebsd10 - -cp -r freebsd/usr/include $dst/ -cp freebsd/usr/lib/crt1.o $dst/lib -cp freebsd/usr/lib/Scrt1.o $dst/lib -cp freebsd/usr/lib/crti.o $dst/lib -cp freebsd/usr/lib/crtn.o $dst/lib -cp freebsd/usr/lib/libc.a $dst/lib -cp freebsd/usr/lib/libutil.a $dst/lib -cp freebsd/usr/lib/libutil_p.a $dst/lib -cp freebsd/usr/lib/libm.a $dst/lib -cp freebsd/usr/lib/librt.so.1 $dst/lib -cp freebsd/usr/lib/libexecinfo.so.1 $dst/lib -cp freebsd/lib/libc.so.7 $dst/lib -cp freebsd/lib/libm.so.5 $dst/lib -cp freebsd/lib/libutil.so.9 $dst/lib -cp freebsd/lib/libthr.so.3 $dst/lib/libpthread.so - -ln -s libc.so.7 $dst/lib/libc.so -ln -s libm.so.5 $dst/lib/libm.so -ln -s librt.so.1 $dst/lib/librt.so -ln -s libutil.so.9 $dst/lib/libutil.so -ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so -rm -rf freebsd - -# Finally, download and build gcc to target FreeBSD -mkdir gcc -cd gcc -curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf - -cd gcc-$GCC -./contrib/download_prerequisites - -mkdir ../gcc-build -cd ../gcc-build -hide_output ../gcc-$GCC/configure \ - --enable-languages=c,c++ \ - --target=$ARCH-unknown-freebsd10 \ - --disable-multilib \ - --disable-nls \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libssp \ - --disable-libvtv \ - --disable-libcilkrts \ - --disable-libada \ - --disable-libsanitizer \ - --disable-libquadmath-support \ - --disable-lto -hide_output make -j10 -hide_output make install -cd ../.. -rm -rf gcc diff --git a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh index 9e1b769f6c..5b4314d57e 100755 --- a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh +++ b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh @@ -52,7 +52,7 @@ curl $URL/2017-03-17-netbsd-comp.tgz | \ cd usr/src # The options, in order, do the following -# * this is an unpriviledged build +# * this is an unprivileged build # * output to a predictable location # * disable various uneeded stuff MKUNPRIVED=yes TOOLDIR=/x-tools/x86_64-unknown-netbsd \ diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index a863e1a2d5..f743c976f9 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -99,6 +99,7 @@ exec docker \ --env LOCAL_USER_ID=`id -u` \ --env TRAVIS \ --env TRAVIS_BRANCH \ + --env TOOLSTATE_REPO_ACCESS_TOKEN \ --volume "$HOME/.cargo:/cargo" \ --volume "$HOME/rustsrc:$HOME/rustsrc" \ --init \ diff --git a/src/ci/docker/scripts/freebsd-toolchain.sh b/src/ci/docker/scripts/freebsd-toolchain.sh new file mode 100755 index 0000000000..15ed318f8c --- /dev/null +++ b/src/ci/docker/scripts/freebsd-toolchain.sh @@ -0,0 +1,103 @@ +#!/bin/bash +# Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -eux + +arch=$1 +binutils_version=2.25.1 +freebsd_version=10.3 +triple=$arch-unknown-freebsd10 +sysroot=/usr/local/$triple + +hide_output() { + set +x + local on_err=" +echo ERROR: An error was encountered with the build. +cat /tmp/build.log +exit 1 +" + trap "$on_err" ERR + bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & + local ping_loop_pid=$! + $@ &> /tmp/build.log + trap - ERR + kill $ping_loop_pid + set -x +} + +# First up, build binutils +mkdir binutils +cd binutils +curl https://ftp.gnu.org/gnu/binutils/binutils-${binutils_version}.tar.bz2 | tar xjf - +mkdir binutils-build +cd binutils-build +hide_output ../binutils-${binutils_version}/configure \ + --target="$triple" --with-sysroot="$sysroot" +hide_output make -j"$(getconf _NPROCESSORS_ONLN)" +hide_output make install +cd ../.. +rm -rf binutils + +# Next, download the FreeBSD libraries and header files +mkdir -p "$sysroot" +case $arch in + (x86_64) freebsd_arch=amd64 ;; + (i686) freebsd_arch=i386 ;; +esac + +files_to_extract=( +"./usr/include" +"./usr/lib/*crt*.o" +) +# Try to unpack only the libraries the build needs, to save space. +for lib in c cxxrt gcc_s m thr util; do + files_to_extract=("${files_to_extract[@]}" "./lib/lib${lib}.*" "./usr/lib/lib${lib}.*") +done +for lib in c++ c_nonshared compiler_rt execinfo gcc pthread rt ssp_nonshared; do + files_to_extract=("${files_to_extract[@]}" "./usr/lib/lib${lib}.*") +done + +URL=https://download.freebsd.org/ftp/releases/${freebsd_arch}/${freebsd_version}-RELEASE/base.txz +curl "$URL" | tar xJf - -C "$sysroot" --wildcards "${files_to_extract[@]}" + +# Fix up absolute symlinks from the system image. This can be removed +# for FreeBSD 11. (If there's an easy way to make them relative +# symlinks instead, feel free to change this.) +set +x +find "$sysroot" -type l | while read symlink_path; do + symlink_target=$(readlink "$symlink_path") + case $symlink_target in + (/*) + echo "Fixing symlink ${symlink_path} -> ${sysroot}${symlink_target}" >&2 + ln -nfs "${sysroot}${symlink_target}" "${symlink_path}" ;; + esac +done +set -x + +# Clang can do cross-builds out of the box, if we give it the right +# flags. (The local binutils seem to work, but they set the ELF +# header "OS/ABI" (EI_OSABI) field to SysV rather than FreeBSD, so +# there might be other problems.) +# +# The --target option is last because the cross-build of LLVM uses +# --target without an OS version ("-freebsd" vs. "-freebsd10"). This +# makes Clang default to libstdc++ (which no longer exists), and also +# controls other features, like GNU-style symbol table hashing and +# anything predicated on the version number in the __FreeBSD__ +# preprocessor macro. +for tool in clang clang++; do + tool_path=/usr/local/bin/${triple}-${tool} + cat > "$tool_path" < or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -eu + +X_PY="$1" +TOOLSTATE_FILE="$(realpath $2)" +OS="$3" +COMMIT="$(git rev-parse HEAD)" +CHANGED_FILES="$(git diff --name-status HEAD HEAD^)" + +touch "$TOOLSTATE_FILE" + +set +e +python2.7 "$X_PY" test --no-fail-fast \ + src/tools/rls \ + src/tools/rustfmt +set -e + +cat "$TOOLSTATE_FILE" + +# If this PR is intended to update one of these tools, do not let the build pass +# when they do not test-pass. +for TOOL in rls rustfmt; do + echo "Verifying status of $TOOL..." + if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]src/tools/$TOOL$"; then + echo "This PR updated 'src/tools/$TOOL', verifying if status is 'test-pass'..." + if grep -vq '"'"$TOOL"'[^"]*":"test-pass"' "$TOOLSTATE_FILE"; then + echo + echo "⚠️ We detected that this PR updated '$TOOL', but its tests failed." + echo + echo "If you do intend to update '$TOOL', please check the error messages above and" + echo "commit another update." + echo + echo "If you do NOT intend to update '$TOOL', please ensure you did not accidentally" + echo "change the submodule at 'src/tools/$TOOL'. You may ask your reviewer for the" + echo "proper steps." + exit 3 + fi + fi +done + +if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then + . "$(dirname $0)/repo.sh" + MESSAGE_FILE=$(mktemp -t msg.XXXXXX) + echo "($OS CI update)" > "$MESSAGE_FILE" + commit_toolstate_change "$MESSAGE_FILE" \ + sed -i "1 a\\ +$COMMIT\t$(cat "$TOOLSTATE_FILE") +" "history/$OS.tsv" + rm -f "$MESSAGE_FILE" + exit 0 +fi + +if grep -q fail "$TOOLSTATE_FILE"; then + exit 4 +fi diff --git a/src/ci/docker/x86_64-gnu-tools/repo.sh b/src/ci/docker/x86_64-gnu-tools/repo.sh new file mode 100644 index 0000000000..c10afef753 --- /dev/null +++ b/src/ci/docker/x86_64-gnu-tools/repo.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +# Copyright 2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# This file provides the function `commit_toolstate_change` for pushing a change +# to the `rust-toolstate` repository. +# +# The function relies on a GitHub bot user, which should have a Personal access +# token defined in the environment variable $TOOLSTATE_REPO_ACCESS_TOKEN. If for +# some reason you need to change the token, please update `.travis.yml` and +# `appveyor.yml`: +# +# 1. Generate a new Personal access token: +# +# * Login to the bot account, and go to Settings -> Developer settings -> +# Personal access tokens +# * Click "Generate new token" +# * Enable the "public_repo" permission, then click "Generate token" +# * Copy the generated token (should be a 40-digit hexadecimal number). +# Save it somewhere secure, as the token would be gone once you leave +# the page. +# +# 2. Encrypt the token for Travis CI +# +# * Install the `travis` tool locally (`gem install travis`). +# * Encrypt the token: +# ``` +# travis -r rust-lang/rust encrypt \ +# TOOLSTATE_REPO_ACCESS_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +# ``` +# * Copy output to replace the existing one in `.travis.yml`. +# * Details of this step can be found in +# +# +# 3. Encrypt the token for AppVeyor +# +# * Login to AppVeyor using your main account, and login as the rust-lang +# organization. +# * Open the ["Encrypt data" tool](https://ci.appveyor.com/tools/encrypt) +# * Paste the 40-digit token into the "Value to encrypt" box, then click +# "Encrypt" +# * Copy the output to replace the existing one in `appveyor.yml`. +# * Details of this step can be found in +# +# +# 4. Replace the email address below if the bot account identity is changed +# +# * See +# if a private email by GitHub is wanted. + +commit_toolstate_change() { + OLDFLAGS="$-" + set -eu + + git config --global user.email '34210020+rust-toolstate-update@users.noreply.github.com' + git config --global user.name 'Rust Toolstate Update' + git config --global credential.helper store + printf 'https://%s:x-oauth-basic@github.com\n' "$TOOLSTATE_REPO_ACCESS_TOKEN" \ + > "$HOME/.git-credentials" + git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git + + cd rust-toolstate + FAILURE=1 + MESSAGE_FILE="$1" + shift + for RETRY_COUNT in 1 2 3 4 5; do + "$@" + # `git commit` failing means nothing to commit. + FAILURE=0 + git commit -a -F "$MESSAGE_FILE" || break + # On failure randomly sleep for 0 to 3 seconds as a crude way to introduce jittering. + git push origin master && break || sleep $(LC_ALL=C tr -cd 0-3 < /dev/urandom | head -c 1) + FAILURE=1 + git fetch origin master + git reset --hard origin/master + done + cd .. + + set +eu + set "-$OLDFLAGS" + return $FAILURE +} diff --git a/src/ci/docker/x86_64-gnu/Dockerfile b/src/ci/docker/x86_64-gnu/Dockerfile index 7570bca590..444a8fe5da 100644 --- a/src/ci/docker/x86_64-gnu/Dockerfile +++ b/src/ci/docker/x86_64-gnu/Dockerfile @@ -16,5 +16,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --enable-sanitizers --enable-profiler +ENV RUST_CONFIGURE_ARGS \ + --build=x86_64-unknown-linux-gnu \ + --enable-sanitizers \ + --enable-profiler \ + --enable-compiler-docs ENV SCRIPT python2.7 ../x.py test diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh index e073a3d99c..14a1906ff4 100755 --- a/src/ci/init_repo.sh +++ b/src/ci/init_repo.sh @@ -36,6 +36,12 @@ fi rm -rf "$CACHE_DIR" mkdir "$CACHE_DIR" +# On the beta channel we'll be automatically calculating the prerelease version +# via the git history, so unshallow our shallow clone from CI. +if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then + git fetch origin --unshallow beta master +fi + travis_fold start update_cache travis_time_start diff --git a/src/ci/run.sh b/src/ci/run.sh index 3f3836d767..b314d5f81a 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -37,13 +37,14 @@ if [ "$DIST_SRC" = "" ]; then fi # If we're deploying artifacts then we set the release channel, otherwise if -# we're not deploying then we want to be sure to enable all assertions becauase +# we're not deploying then we want to be sure to enable all assertions because # we'll be running tests # # FIXME: need a scheme for changing this `nightly` value to `beta` and `stable` # either automatically or manually. +export RUST_RELEASE_CHANNEL=stable if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then - RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=stable" + RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp" if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then diff --git a/src/doc/book/README.md b/src/doc/book/README.md index b7d0aad6ab..ef1408c838 100644 --- a/src/doc/book/README.md +++ b/src/doc/book/README.md @@ -1,3 +1,13 @@ +# NOTICE ABOUT STATUS + +The second edition of The Rust Programming Language is getting ever closer to being printed! +This means we're not able to make large changes to chapters that are in any column to the +right of, and including, the "Frozen" column [on our Project board][proj]. Issues or pull +requests submitted for frozen chapters are welcome but will be closed until we start work +on a third edition. Thank you! + +[proj]: https://github.com/rust-lang/book/projects/1 + # The Rust Programming Language [![Build Status](https://travis-ci.org/rust-lang/book.svg?branch=master)](https://travis-ci.org/rust-lang/book) @@ -7,16 +17,27 @@ This repo contains two editions of “The Rust Programming Language”. The second edition is a rewrite that will be printed by NoStarch Press, available around October 2017. -[You can read it online][html]; the last few chapters aren't completed yet, but +[You can read the very latest online][html]; the last few chapters aren't completed yet, but the first half of the book is much improved from the first edition. We recommend starting with the second edition. [html]: http://rust-lang.github.io/book/ +Note that links to the standard library won't work in this version; this is intentional +so that links work with the book and API docs shipped with Rust installations for offline +reading. For a version of the book where these links do work, please see the book as shipped +with the latest [stable], [beta], or [nightly] Rust releases. Be aware that issues in those +versions may have been fixed in this repository already. + +[stable]: https://doc.rust-lang.org/stable/book/second-edition/ +[beta]: https://doc.rust-lang.org/beta/book/second-edition/ +[nightly]: https://doc.rust-lang.org/nightly/book/second-edition/ + [The first edition is still available to read online][first]. [first]: https://doc.rust-lang.org/book/ + ## Requirements Building the book requires [mdBook], ideally the same version that diff --git a/src/doc/book/first-edition/src/casting-between-types.md b/src/doc/book/first-edition/src/casting-between-types.md index 26cd718475..d565aa9dcb 100644 --- a/src/doc/book/first-edition/src/casting-between-types.md +++ b/src/doc/book/first-edition/src/casting-between-types.md @@ -60,7 +60,7 @@ A cast `e as U` is valid if `e` has type `T` and `T` *coerces* to `U`. A cast `e as U` is also valid in any of the following cases: * `e` has type `T` and `T` and `U` are any numeric types; *numeric-cast* -* `e` is a C-like enum (with no data attached to the variants), +* `e` is an enum with no data attached to the variants (a "field-less enumeration"), and `U` is an integer type; *enum-cast* * `e` has type `bool` or `char` and `U` is an integer type; *prim-int-cast* * `e` has type `u8` and `U` is `char`; *u8-char-cast* diff --git a/src/doc/book/first-edition/src/ffi.md b/src/doc/book/first-edition/src/ffi.md index 067d061a86..b902fea448 100644 --- a/src/doc/book/first-edition/src/ffi.md +++ b/src/doc/book/first-edition/src/ffi.md @@ -737,11 +737,11 @@ void foo(struct Foo *arg); void bar(struct Bar *arg); ``` -To do this in Rust, let’s create our own opaque types with `enum`: +To do this in Rust, let’s create our own opaque types: ```rust -pub enum Foo {} -pub enum Bar {} +#[repr(C)] pub struct Foo { private: [u8; 0] } +#[repr(C)] pub struct Bar { private: [u8; 0] } extern "C" { pub fn foo(arg: *mut Foo); @@ -750,7 +750,9 @@ extern "C" { # fn main() {} ``` -By using an `enum` with no variants, we create an opaque type that we can’t -instantiate, as it has no variants. But because our `Foo` and `Bar` types are +By including a private field and no constructor, +we create an opaque type that we can’t instantiate outside of this module. +An empty array is both zero-size and compatible with `#[repr(C)]`. +But because our `Foo` and `Bar` types are different, we’ll get type safety between the two of them, so we cannot accidentally pass a pointer to `Foo` to `bar()`. diff --git a/src/doc/book/second-edition/dictionary.txt b/src/doc/book/second-edition/dictionary.txt index 5652f97d47..f95332b009 100644 --- a/src/doc/book/second-edition/dictionary.txt +++ b/src/doc/book/second-edition/dictionary.txt @@ -4,11 +4,13 @@ abcd abcdefghijklmnopqrstuvwxyz adaptor adaptors +AddAssign Addr aggregator AGraph aliasability alignof +alloc allocator Amir anotherusername @@ -29,19 +31,23 @@ Baz’s benchmarking bitand BitAnd +BitAndAssign bitor BitOr +BitOrAssign bitwise Bitwise bitxor BitXor +BitXorAssign Bjarne Boehm bool -boolean -booleans +Boolean +Booleans Bors BorrowMutError +BTreeSet BuildHasher Cacher Cagain @@ -88,6 +94,7 @@ dereferenced dereferences dereferencing DerefMut +DeriveInput destructor destructure destructured @@ -102,6 +109,7 @@ doccratesio DOCTYPE doesn disambiguating +DivAssign DraftPost DSTs ebooks @@ -119,6 +127,7 @@ eprintln Erlang ErrorKind Executables +expr extern favicon FFFD @@ -135,6 +144,7 @@ FnBox FnMut FnOnce formatter +FrenchToast FromIterator frontend getter @@ -155,20 +165,26 @@ HashSet Haskell hasn helloworld +HelloWorld +HelloWorldName Hmmm Hoare Hola homogenous html +hyperoptimize Iceburgh +ident IEEE impl implementor implementors ImportantExcerpt incrementing +IndexMut indices init +initializer inline instantiation internet @@ -190,6 +206,7 @@ JoinHandle kinded lang latin +liballoc libc libcollections libcore @@ -213,6 +230,7 @@ Metadata metaprogramming mibbit Mibbit +millis minigrep mixup mkdir @@ -225,6 +243,7 @@ monomorphized MoveMessage Mozilla mpsc +MulAssign multibyte multithreaded mutex @@ -248,6 +267,7 @@ nitty nocapture nomicon Nomicon +nonequality NotFound null's OCaml @@ -261,6 +281,7 @@ OsStr OsString other's OutlinePrint +overloadable overread param parameterize @@ -288,6 +309,9 @@ pushups QuitMessage RAII randcrate +RangeFrom +RangeTo +RangeFull README READMEs rect @@ -302,6 +326,7 @@ RefCell RefMut refutability reimplement +RemAssign repr representable request's @@ -326,6 +351,9 @@ SecondaryColor SelectBox semver SemVer +serde +ShlAssign +ShrAssign shouldn Simula situps @@ -346,12 +374,15 @@ Stdin stdlib stdout steveklabnik's +stringify Stroustrup +Stroustrup's struct Struct structs struct's Structs +SubAssign subclasses subcommand subcommands @@ -369,6 +400,7 @@ supertrait supertraits TcpListener TcpStream +templating test's TextField That'd @@ -378,7 +410,9 @@ threadsafe timestamp Tiếng timeline +tlborm TODO +TokenStream toml TOML ToString @@ -389,7 +423,9 @@ trpl tuesday tuple tuples +turbofish typeof +TypeName UFCS unary Unary diff --git a/src/doc/book/second-edition/nostarch/appendix.md b/src/doc/book/second-edition/nostarch/appendix.md index 6f061d779b..c03ce8f966 100644 --- a/src/doc/book/second-edition/nostarch/appendix.md +++ b/src/doc/book/second-edition/nostarch/appendix.md @@ -1,63 +1,912 @@ -# Appendix - -The following sections contain reference material you may find useful in your -Rust journey. - -## Keywords +## Appendix A: Keywords The following keywords are reserved by the Rust language and may not be used as -names of functions, variables, macros, modules, crates, constants, static -values, attributes, struct fields, or arguments. +identifiers such as names of functions, variables, parameters, struct fields, +modules, crates, constants, macros, static values, attributes, types, traits, +or lifetimes. + +### Keywords Currently in Use + +* `as` - primitive casting, disambiguating the specific trait containing an + item, or renaming items in `use` and `extern crate` statements +* `break` - exit a loop immediately +* `const` - constant items and constant raw pointers +* `continue` - continue to the next loop iteration +* `crate` - external crate linkage or a macro variable representing the crate + in which the macro is defined +* `else` - fallback for `if` and `if let` control flow constructs +* `enum` - defining an enumeration +* `extern` - external crate, function, and variable linkage +* `false` - Boolean false literal +* `fn` - function definition and function pointer type +* `for` - iterator loop, part of trait impl syntax, and higher-ranked lifetime + syntax +* `if` - conditional branching +* `impl` - inherent and trait implementation block +* `in` - part of `for` loop syntax +* `let` - variable binding +* `loop` - unconditional, infinite loop +* `match` - pattern matching +* `mod` - module declaration +* `move` - makes a closure take ownership of all its captures +* `mut` - denotes mutability in references, raw pointers, and pattern bindings +* `pub` - denotes public visibility in struct fields, `impl` blocks, and modules +* `ref` - by-reference binding +* `return` - return from function +* `Self` - type alias for the type implementing a trait +* `self` - method subject or current module +* `static` - global variable or lifetime lasting the entire program execution +* `struct` - structure definition +* `super` - parent module of the current module +* `trait` - trait definition +* `true` - Boolean true literal +* `type` - type alias and associated type definition +* `unsafe` - denotes unsafe code, functions, traits, and implementations +* `use` - import symbols into scope +* `where` - type constraint clauses +* `while` - conditional loop + +### Keywords Reserved for Future Use + +These keywords do not have any functionality, but are reserved by Rust for +potential future use. * `abstract` * `alignof` -* `as` * `become` * `box` -* `break` -* `const` -* `continue` -* `crate` * `do` -* `else` -* `enum` -* `extern` -* `false` * `final` -* `fn` -* `for` -* `if` -* `impl` -* `in` -* `let` -* `loop` * `macro` -* `match` -* `mod` -* `move` -* `mut` * `offsetof` * `override` * `priv` * `proc` -* `pub` * `pure` -* `ref` -* `return` -* `Self` -* `self` * `sizeof` -* `static` -* `struct` -* `super` -* `trait` -* `true` -* `type` * `typeof` -* `unsafe` * `unsized` -* `use` * `virtual` -* `where` -* `while` * `yield` + +## Appendix B: Operators and Symbols + +### Operators + +The following lists the operators in Rust, an example of how the operator would +appear in context, a short explanation, and whether that operator is +overloadable. If an operator is overloadable, the relevant trait to use to +overload that operator is listed. + +* `!` (`ident!(…)`, `ident!{…}`, `ident![…]`): denotes macro expansion. +* `!` (`!expr`): bitwise or logical complement. Overloadable (`Not`). +* `!=` (`var != expr`): nonequality comparison. Overloadable (`PartialEq`). +* `%` (`expr % expr`): arithmetic remainder. Overloadable (`Rem`). +* `%=` (`var %= expr`): arithmetic remainder and assignment. Overloadable (`RemAssign`). +* `&` (`&expr`, `&mut expr`): borrow. +* `&` (`&type`, `&mut type`, `&'a type`, `&'a mut type`): borrowed pointer type. +* `&` (`expr & expr`): bitwise AND. Overloadable (`BitAnd`). +* `&=` (`var &= expr`): bitwise AND and assignment. Overloadable (`BitAndAssign`). +* `&&` (`expr && expr`): logical AND. +* `*` (`expr * expr`): arithmetic multiplication. Overloadable (`Mul`). +* `*` (`*expr`): dereference. +* `*` (`*const type`, `*mut type`): raw pointer. +* `*=` (`var *= expr`): arithmetic multiplication and assignment. Overloadable (`MulAssign`). +* `+` (`trait + trait`, `'a + trait`): compound type constraint. +* `+` (`expr + expr`): arithmetic addition. Overloadable (`Add`). +* `+=` (`var += expr`): arithmetic addition and assignment. Overloadable (`AddAssign`). +* `,`: argument and element separator. +* `-` (`- expr`): arithmetic negation. Overloadable (`Neg`). +* `-` (`expr - expr`): arithmetic subtraction. Overloadable (`Sub`). +* `-=` (`var -= expr`): arithmetic subtraction and assignment. Overloadable (`SubAssign`). +* `->` (`fn(…) -> type`, `|…| -> type`): function and closure return type. +* `.` (`expr.ident`): member access. +* `..` (`..`, `expr..`, `..expr`, `expr..expr`): right-exclusive range literal. +* `..` (`..expr`): struct literal update syntax. +* `..` (`variant(x, ..)`, `struct_type { x, .. }`): “and the rest” pattern binding. +* `...` (`...expr`, `expr...expr`) *in an expression*: inclusive range expression. +* `...` (`expr...expr`) *in a pattern*: inclusive range pattern. +* `/` (`expr / expr`): arithmetic division. Overloadable (`Div`). +* `/=` (`var /= expr`): arithmetic division and assignment. Overloadable (`DivAssign`). +* `:` (`pat: type`, `ident: type`): constraints. +* `:` (`ident: expr`): struct field initializer. +* `:` (`'a: loop {…}`): loop label. +* `;`: statement and item terminator. +* `;` (`[…; len]`): part of fixed-size array syntax +* `<<` (`expr << expr`): left-shift. Overloadable (`Shl`). +* `<<=` (`var <<= expr`): left-shift and assignment. Overloadable (`ShlAssign`). +* `<` (`expr < expr`): less-than comparison. Overloadable (`PartialOrd`). +* `<=` (`var <= expr`): less-than or equal-to comparison. Overloadable (`PartialOrd`). +* `=` (`var = expr`, `ident = type`): assignment/equivalence. +* `==` (`var == expr`): equality comparison. Overloadable (`PartialEq`). +* `=>` (`pat => expr`): part of match arm syntax. +* `>` (`expr > expr`): greater-than comparison. Overloadable (`PartialOrd`). +* `>=` (`var >= expr`): greater-than or equal-to comparison. Overloadable (`PartialOrd`). +* `>>` (`expr >> expr`): right-shift. Overloadable (`Shr`). +* `>>=` (`var >>= expr`): right-shift and assignment. Overloadable (`ShrAssign`). +* `@` (`ident @ pat`): pattern binding. +* `^` (`expr ^ expr`): bitwise exclusive OR. Overloadable (`BitXor`). +* `^=` (`var ^= expr`): bitwise exclusive OR and assignment. Overloadable (`BitXorAssign`). +* `|` (`pat | pat`): pattern alternatives. +* `|` (`|…| expr`): closures. +* `|` (`expr | expr`): bitwise OR. Overloadable (`BitOr`). +* `|=` (`var |= expr`): bitwise OR and assignment. Overloadable (`BitOrAssign`). +* `||` (`expr || expr`): logical OR. +* `_`: “ignored” pattern binding. Also used to make integer-literals readable. +* `?` (`expr?`): Error propagation. + +### Non-operator Symbols + +#### Standalone Syntax + +* `'ident`: named lifetime or loop label +* `…u8`, `…i32`, `…f64`, `…usize`, *etc.*: numeric literal of specific type. +* `"…"`: string literal. +* `r"…"`, `r#"…"#`, `r##"…"##`, *etc.*: raw string literal, escape characters are not processed. +* `b"…"`: byte string literal, constructs a `[u8]` instead of a string. +* `br"…"`, `br#"…"#`, `br##"…"##`, *etc.*: raw byte string literal, combination of raw and byte string literal. +* `'…'`: character literal. +* `b'…'`: ASCII byte literal. +* `|…| expr`: closure. +* `!`: always empty bottom type for diverging functions. + +#### Path-related Syntax + +* `ident::ident`: namespace path. +* `::path`: path relative to the crate root (*i.e.* an explicitly absolute path). +* `self::path`: path relative to the current module (*i.e.* an explicitly relative path). +* `super::path`: path relative to the parent of the current module. +* `type::ident`, `::ident`: associated constants, functions, and types. +* `::…`: associated item for a type which cannot be directly named (*e.g.* `<&T>::…`, `<[T]>::…`, *etc.*). +* `trait::method(…)`: disambiguating a method call by naming the trait which defines it. +* `type::method(…)`: disambiguating a method call by naming the type for which it’s defined. +* `::method(…)`: disambiguating a method call by naming the trait *and* type. + +#### Generics + +* `path<…>` (*e.g.* `Vec`): specifies parameters to generic type *in a type*. +* `path::<…>`, `method::<…>` (*e.g.* `"42".parse::()`): specifies parameters to generic type, function, or method *in an expression*. Often referred to as *turbofish*. +* `fn ident<…> …`: define generic function. +* `struct ident<…> …`: define generic structure. +* `enum ident<…> …`: define generic enumeration. +* `impl<…> …`: define generic implementation. +* `for<…> type`: higher-ranked lifetime bounds. +* `type` (*e.g.* `Iterator`): a generic type where one or more associated types have specific assignments. + +#### Trait Bound Constraints + +* `T: U`: generic parameter `T` constrained to types that implement `U`. +* `T: 'a`: generic type `T` must outlive lifetime `'a`. When we say that a type ‘outlives’ the lifetime, we mean that it cannot transitively contain any references with lifetimes shorter than `'a`. +* `T : 'static`: The generic type `T` contains no borrowed references other than `'static` ones. +* `'b: 'a`: generic lifetime `'b` must outlive lifetime `'a`. +* `T: ?Sized`: allow generic type parameter to be a dynamically-sized type. +* `'a + trait`, `trait + trait`: compound type constraint. + +#### Macros and Attributes + +* `#[meta]`: outer attribute. +* `#![meta]`: inner attribute. +* `$ident`: macro substitution. +* `$ident:kind`: macro capture. +* `$(…)…`: macro repetition. + +#### Comments + +* `//`: line comment. +* `//!`: inner line doc comment. +* `///`: outer line doc comment. +* `/*…*/`: block comment. +* `/*!…*/`: inner block doc comment. +* `/**…*/`: outer block doc comment. + +#### Tuples + +* `()`: empty tuple (*a.k.a.* unit), both literal and type. +* `(expr)`: parenthesized expression. +* `(expr,)`: single-element tuple expression. +* `(type,)`: single-element tuple type. +* `(expr, …)`: tuple expression. +* `(type, …)`: tuple type. +* `expr(expr, …)`: function call expression. Also used to initialize tuple `struct`s and tuple `enum` variants. +* `ident!(…)`, `ident!{…}`, `ident![…]`: macro invocation. +* `expr.0`, `expr.1`, …: tuple indexing. + +#### Curly Brackets + +* `{…}`: block expression. +* `Type {…}`: `struct` literal. + +#### Square Brackets + +* `[…]`: array literal. +* `[expr; len]`: array literal containing `len` copies of `expr`. +* `[type; len]`: array type containing `len` instances of `type`. +* `expr[expr]`: collection indexing. Overloadable (`Index`, `IndexMut`). +* `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]`: collection indexing pretending to be collection slicing, using `Range`, `RangeFrom`, `RangeTo`, `RangeFull` as the “index”. + +# C - Derivable Traits + +In various places in the book, we discussed the `derive` attribute that is +applied to a struct or enum. This attribute generates code that implements a +trait on the annotated type with a default implementation. In this example, the +`#[derive(Debug)]` attribute implements the `Debug` trait for the `Point` +struct: + +``` +#[derive(Debug)] +struct Point { + x: i32, + y: i32, +} +``` + +The code that the compiler generates for the implementation of `Debug` is +similar to this code: + +``` +impl ::std::fmt::Debug for Point { + fn fmt(&self, __arg_0: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match *self { + Point { x: ref __self_0_0, y: ref __self_0_1 } => { + let mut builder = __arg_0.debug_struct("Point"); + let _ = builder.field("x", &&(*__self_0_0)); + let _ = builder.field("y", &&(*__self_0_1)); + builder.finish() + } + } + } +} +``` + +The generated code implements sensible default behavior for the `Debug` trait’s +`fmt` function: a `match` expression destructures a `Point` instance into its +field values. Then it builds up a string containing the struct’s name and each +field’s name and value. This means we’re able to use debug formatting on a +`Point` instance to see what value each field has. + +The generated code isn’t particularly easy to read because it’s only for the +compiler to consume, rather than for programmers to read! The `derive` +attribute and the default implementation of `Debug` has saved us all of the +work of writing this code for every struct or enum that we want to be able to +print using debug formatting. + +The `derive` attribute has default implementations for the following traits +provided by the standard library. If you want different behavior than what the +`derive` attribute provides, consult the standard library documentation for +each trait for the details needed for manual implementation of the traits. + +## Standard Library Traits that Can Be Derived + +The following sections list all of the traits in the standard library that can +be used with `derive`. Each section covers: + +- What operators and methods deriving this trait will enable +- What the implementation of the trait provided by `derive` does +- What implementing the trait signifies about the type +- The conditions in which you’re allowed or not allowed to implement the trait +- Examples of operations that require the trait + +### `Debug` for Programmer Output + +The `Debug` trait enables debug formatting in format strings, indicated by +adding `:?` within `{}` placeholders. + +The `Debug` trait signifies that instances of a type may be printed by +programmers in order to debug their programs by inspecting an instance of a +type at a particular point in a program’s execution. + +An example of when `Debug` is required is the `assert_eq!` macro, which prints +the values of the instances given as arguments if the equality assertion fails +so that programmers can see why the two instances weren’t equal. + +### `PartialEq` and `Eq` for Equality Comparisons + +The `PartialEq` trait signifies that instances of a type can be compared to +each other for equality, and enables use of the `==` and `!=` operators. + +Deriving `PartialEq` implements the `eq` method. When derived on structs, two +instances are equal if all fields are equal, and not equal if any fields are +not equal. When derived on enums, each variant is equal to itself and not equal +to the other variants. + +An example of when `PartialEq` is required is the `assert_eq!` macro, which +needs to be able to compare two instances of a type for equality. + +The `Eq` trait doesn’t have any methods. It only signals that for every value +of the annotated type, the value is equal to itself. The `Eq` trait can only be +applied to types that also implement `PartialEq`. An example of types that +implements `PartialEq` but that cannot implement `Eq` are floating point number +types: the implementation of floating point numbers says that two instances of +the not-a-number value, `NaN`, are not equal to each other. + +An example of when `Eq` is required is for keys in a `HashMap` so that the +`HashMap` can tell whether two keys are the same. + +### `PartialOrd` and `Ord` for Ordering Comparisons + +The `PartialOrd` trait signifies that instances of a type can be compared to +each other to see which is larger than the other for sorting purposes. A type +that implements `PartialOrd` may be used with the `<`, `>`, `<=`, and `>=` +operators. The `PartialOrd` trait can only be applied to types that also +implement `PartialEq`. + +Deriving `PartialOrd` implements the `partial_cmp` method, which returns an +`Option` that may be `None` if comparing the given values does not +produce an ordering. When derived on structs, two instances of the struct are +compared by comparing the value in each field in the order in which the fields +appear in the struct definition. When derived on enums, variants of the enum +declared earlier in the enum definition are greater than the variants listed +later. + +An example of when `PartialOrd` is required is the `gen_range` method in the +`rand` crate that generates a random value in the range specified by a low +value and a high value. + +The `Ord` trait signifies that for any two value of the annotated type, a valid +ordering exists. The `Ord` trait implements the `cmp` method, which returns an +`Ordering` rather than an `Option` because a valid ordering will +always be possible. The `Ord` trait can only be applied to types that also +implement `PartialOrd` and `Eq` (and `Eq` requires `PartialEq`). When derived +on structs and enums, `cmp` behaves the same way as the derived implementation +for `partial_cmp` does with `PartialOrd`. + +An example of when `Ord` is required is when storing values in a `BTreeSet`, +a data structure that stores data based on the sort order of the values. + +### `Clone` and `Copy` for Duplicating Values + +The `Clone` trait signifies there is a way to explicitly create a duplicate of +a value, and the duplication process might involve running arbitrary code. +Deriving `Clone` implements the `clone` method. When derived, the +implementation of `clone` for the whole type calls `clone` on each of the parts +of the type, so all of the fields or values in the type must also implement +`Clone` to derive `Clone`. + +An example of when `Clone` is required is when calling the `to_vec` method on a +slice containing instances of some type. The slice doesn’t own the instances +but the vector returned from `to_vec` will need to own its instances, so the +implementation of `to_vec` calls `clone` on each item. Thus, the type stored in +the slice must implement `Clone`. + +The `Copy` trait signifies that a value can be duplicated by only copying bits; +no other code is necessary. The `Copy` trait does not define any methods to +prevent programmers from overloading those methods violating the assumption +that no arbitrary code is being run. You can derive `Copy` on any type whose +parts all implement `Copy`. The `Copy` trait can only be applied to types that +also implement `Clone`, as a type that implements `Copy` has a trivial +implementation of `Clone`, doing the same thing as `Copy`. + +`Copy` is rarely required; when types implement `Copy`, there are optimizations +that can be applied and the code becomes nicer because you don’t have to call +`clone`. Everything possible with `Copy` can also be accomplished with `Clone`, +but the code might be slower or have to use `clone` in places. + +### `Hash` for Mapping a Value to a Value of Fixed Size + +The `Hash` trait signifies there is a way to take an instance of a type that +takes up an arbitrary amount of size and map that instance to a value of fixed +size by using a hash function. Deriving `Hash` implements the `hash` method. +When derived, the implementation of `hash` for the whole type combines the +result of calling `hash` on each of the parts of the type, so all of the fields +or values in the type must also implement `Hash` to derive `Hash`. + +An example of when `Hash` is required is for keys in a `HashMap` so that the +`HashMap` can store data efficiently. + +### `Default` for Default Values + +The `Default` trait signifies there is a way to create a default value for a +type. Deriving `Default` implements the `default` method. When derived, the +implementation of `Default` for the whole type calls the `default` method on +each of the parts of the type, so all of the fields or values in the type must +also implement `Default` to derive `Default.` + +A common use of `Default::default` is in combination with the struct update +syntax discussed in the “Creating Instances From Other Instances With Struct +Update Syntax” section in Chapter 5. You can customize a few fields of a struct +and then use the default values for the rest by using `..Default::default()`. + +An example of when `Default` is required is the `unwrap_or_default` method on +`Option` instances. If the `Option` is `None`, the `unwrap_or_default` +method will return the result of `Default::default` for the type `T` stored in +the `Option`. + +## Standard Library Traits that Can’t Be Derived + +The rest of the traits defined in the standard library can’t be implemented on +your types using `derive`. These traits don’t have a sensible default behavior +they could have, so you are required to implement them in the way that makes +sense for what you are trying to accomplish with your code. + +An example of a trait that can’t be derived is `Display`, which handles +formatting of a type for end users of your programs. You should put thought +into the appropriate way to display a type to an end user: what parts of the +type should an end user be allowed to see? What parts would they find relevant? +What format of the data would be most relevant to them? The Rust compiler +doesn’t have this insight into your application, so you must provide it. + +## Making Custom Traits Derivable + +The above list is not comprehensive, however: libraries can implement `derive` +for their own types! In this way, the list of traits you can use `derive` with +is truly open-ended. Implementing `derive` involves using a procedural macro, +which is covered in the next appendix, “Macros.” + +# D - Macros + +We’ve used macros, such as `println!`, throughout this book. This appendix will +explain: + +- What macros are and how they differ from functions +- How to define a declarative macro to do metaprogramming +- How to define a procedural macro to create custom `derive` traits + +Macros are covered in an appendix because they’re still evolving. They have +changed and will change more than the rest of the language and standard library +since Rust 1.0, so this section will likely get out of date more than the rest +of this book. The code shown here will still continue to work due to Rust’s +stability guarantees, but there may be additional capabilities or easier ways +to write macros that aren’t available at the time of this publication. + +## Macros are More Flexible and Complex than Functions + +Fundamentally, macros are a way of writing code that writes other code, which +is known as *metaprogramming*. In the previous appendix, we discussed the +`derive` attribute, which generates an implementation of various traits for +you. We’ve also used the `println!` and `vec!` macros. All of these macros +*expand* to produce more code than what you’ve written in your source code. + +Metaprogramming is useful to reduce the amount of code you have to write and +maintain, which is also one of the roles of functions. However, macros have +some additional powers that functions don’t have, as we discussed in Chapter 1. +A function signature has to declare the number and type of parameters the +function has. Macros can take a variable number of parameters: we can call +`println!("hello")` with one argument, or `println!("hello {}", name)` with two +arguments. Also, macros are expanded before the compiler interprets the meaning +of the code, so a macro can, for example, implement a trait on a given type, +whereas a function can’t because a function gets called at runtime and a trait +needs to be implemented at compile time. + +The downside to implementing a macro rather than a function is that macro +definitions are more complex than function definitions. You’re writing Rust +code that writes Rust code, and macro definitions are generally more difficult +to read, understand, and maintain than function definitions. + +Another difference between macros and functions is that macro definitions +aren’t namespaced within modules like function definitions are. In order to +prevent unexpected name clashes when using a crate, when bringing an external +crate into the scope of your project, you have to explicitly bring the macros +into the scope of your project as well with the `#[macro_use]` annotation. This +example would bring all the macros defined in the `serde` crate into the scope +of the current crate: + +``` +#[macro_use] +extern crate serde; +``` + +If `extern crate` also brought macros into scope by default, you wouldn’t be +allowed to use two crates that happened to define macros with the same name. In +practice this conflict doesn’t come up much, but the more crates you use, the +more likely it is. + +One last important difference between macros and functions: macros must be +defined or brought into scope before they’re called in a file. Unlike +functions, where we can define a function at the bottom of a file yet call it +at the top, we always have to define macros before we’re able to call them. + +## Declarative Macros with `macro_rules!` for General Metaprogramming + +The first form of macros in Rust, and the one that’s most widely used, is +called *declarative macros*. These are also sometimes referred to as *macros by +example*, *`macro_rules!` macros*, or just plain *macros*. At their core, +declarative macros allow you to write something similar to a Rust `match` +expression. As discussed in Chapter 6, `match` expressions are control +structures that take an expression, compare the resulting value of the +expression to patterns, and then choose the code specified with the matching +pattern when the program runs. Macros also have a value that is compared to +patterns that have code associated with them, but the value is the literal Rust +code passed to the macro, the patterns match the structure of that source code, +and the code associated with each pattern is the code that is generated to +replace the code passed to the macro. This all happens during compilation. + +To define a macro, you use the `macro_rules!` construct. Let’s explore how to +use `macro_rules!` by taking a look at how the `vec!` macro is defined. Chapter +8 covered how we can use the `vec!` macro to create a new vector that holds +particular values. For example, this macro creates a new vector with three +integers inside: + +``` +let v: Vec = vec![1, 2, 3]; +``` + +We can also use `vec!` to make a vector of two integers or a vector of five +string slices. Because we don’t know the number or type of values, we can’t +define a function that is able to create a new vector with the given elements +like `vec!` can. + +Let’s take a look at a slightly simplified definition of the `vec!` macro: + +``` +#[macro_export] +macro_rules! vec { + ( $( $x:expr ),* ) => { + { + let mut temp_vec = Vec::new(); + $( + temp_vec.push($x); + )* + temp_vec + } + }; +} +``` + +> Note: the actual definition of the `vec!` macro in the standard library also +> has code to pre-allocate the correct amount of memory up-front. That code +> is an optimization that we’ve chosen not to include here for simplicity. + +The `#[macro_export]` annotation indicates that this macro should be made +available when other crates import the crate in which we’re defining this +macro. Without this annotation, even if someone depending on this crate uses +the `#[macro_use]` annotation, this macro would not be brought into scope. + +Macro definitions start with `macro_rules!` and the name of the macro we’re +defining without the exclamation mark, which in this case is `vec`. This is +followed by curly brackets denoting the body of the macro definition. + +Inside the body is a structure similar to the structure of a `match` +expression. This macro definition has one arm with the pattern `( $( $x:expr +),* )`, followed by `=>` and the block of code associated with this pattern. If +this pattern matches, then the block of code will be emitted. Given that this +is the only pattern in this macro, there’s only one valid way to match; any +other will be an error. More complex macros will have more than one arm. + +The pattern syntax valid in macro definitions is different than the pattern +syntax covered in Chapter 18 because the patterns are for matching against Rust +code structure rather than values. Let’s walk through what the pieces of the +pattern used here mean; for the full macro pattern syntax, see the reference at +*https://doc.rust-lang.org/stable/reference/macros.html*. + +The `$x:expr` part of the pattern matches any Rust expression and gives the +expression the name `$x`. The `*` specifies that the pattern matches zero or +more of whatever precedes the `*`. In this case, `*` is preceded by `$(),` so +this pattern matches zero or more of whatever is inside the parentheses, +delimited by a comma. When we call this macro with `vec![1, 2, 3];`, the +pattern matches the three expressions `1`, `2`, and `3`. + +In the body of the code associated with this arm, the `$()*` part is generated +for each part that matches `$()` in the pattern, zero or more times depending +on how many times the pattern matches. The `$x` in the code associated with the +arm is replaced with each expression matched. When we call this macro with +`vec![1, 2, 3];`, the code generated that replaces this macro call will be: + +``` +let mut temp_vec = Vec::new(); +temp_vec.push(1); +temp_vec.push(2); +temp_vec.push(3); +temp_vec +``` + +We’ve defined a macro that can take any number of arguments of any type and can +generate code to create a vector containing the specified elements. + +Given that most Rust programmers will *use* macros more than *write* macros, +that’s all we’ll discuss about `macro_rules!` in this book. To learn more about +how to write macros, consult the online documentation or other resources such +as The Little Book of Rust Macros at +*https://danielkeep.github.io/tlborm/book/index.html*. + +## Procedural Macros for Custom `derive` + +The second form of macros is called *procedural macros* because they’re more +like functions (which are a type of procedure). Procedural macros accept some +Rust code as an input, operate on that code, and produce some Rust code as an +output, rather than matching against patterns and replacing the code with other +code as declarative macros do. Today, the only thing you can define procedural +macros for is to allow your traits to be implemented on a type by specifying +the trait name in a `derive` annotation. + +Let’s create a crate named `hello-world` that defines a trait named +`HelloWorld` with one associated function named `hello_world`. Rather than +making users of our crate implement the `HelloWorld` trait for each of their +types, we’d like users to be able to annotate their type with +`#[derive(HelloWorld)]` to get a default implementation of the `hello_world` +function associated with their type. The default implementation will print +`Hello world, my name is TypeName!` where `TypeName` is the name of the type on +which this trait has been defined. + +In other words, we’re going to write a crate that enables another programmer to +write code that looks like Listing A4-1 using our crate: + +Filename: src/main.rs + +``` +extern crate hello_world; +#[macro_use] +extern crate hello_world_derive; + +use hello_world::HelloWorld; + +#[derive(HelloWorld)] +struct Pancakes; + +fn main() { + Pancakes::hello_world(); +} +``` + +Listing A4-1: The code a user of our crate will be able to write when we’ve +written the procedural macro + +This code will print `Hello world, my name is Pancakes!` when we’re done. Let’s +get started! + +Let’s make a new library crate: + +``` +$ cargo new hello-world +``` + +First, we’ll define the `HelloWorld` trait and associated function: + +Filename: src/lib.rs + +``` +pub trait HelloWorld { + fn hello_world(); +} +``` + +At this point, a user of our crate could implement the trait themselves to +achieve the functionality we wanted to enable, like so: + +``` +extern crate hello_world; + +use hello_world::HelloWorld; + +struct Pancakes; + +impl HelloWorld for Pancakes { + fn hello_world() { + println!("Hello world, my name is Pancakes!"); + } +} + +fn main() { + Pancakes::hello_world(); +} +``` + +However, they would need to write out the implementation block for each type +they wanted to be able to use with `hello_world`; we’d like to make using our +trait more convenient for other programmers by saving them this work. + +Additionally, we can’t provide a default implementation for the `hello_world` +function that has the behavior we want of printing out the name of the type the +trait is implemented on: Rust doesn’t have reflection capabilities, so we can’t +look up the type’s name at runtime. We need a macro to generate code at compile +time. + +### Defining Procedural Macros Requires a Separate Crate + +The next step is to define the procedural macro. At the moment, procedural +macros need to be in their own crate. Eventually, this restriction may be +lifted, but for now, it’s required. As such, there’s a convention: for a crate +named `foo`, a custom derive procedural macro crate is called `foo-derive`. +Let’s start a new crate called `hello-world-derive` inside our `hello-world` +project: + +``` +$ cargo new hello-world-derive +``` + +We’ve chosen to create the procedural macro crate within the directory of our +`hello-world` crate because the two crates are tightly related: if we change +the trait definition in `hello-world`, we’ll have to change the implementation +of the procedural macro in `hello-world-derive` as well. The two crates will +need to be published separately, and programmers using these crates will need +to add both as dependencies and bring them both into scope. It’s possible to +have the `hello-world` crate use `hello-world-derive` as a dependency and +re-export the procedural macro code, but structuring the project this way makes +it possible for programmers to easily decide they only want to use +`hello-world` if they don’t want the `derive` functionality. + +We need to declare that the `hello-world-derive` crate is a procedural macro +crate. We also need to add dependencies on the `syn` and `quote` crates to get +useful functionality for operating on Rust code. To do these two things, add +the following to the *Cargo.toml* for `hello-world-derive`: + +Filename: hello-world-derive/Cargo.toml + +``` +[lib] +proc-macro = true + +[dependencies] +syn = "0.11.11" +quote = "0.3.15" +``` + +To start defining the procedural macro, place the code from Listing A4-2 in +*src/lib.rs* for the `hello-world-derive` crate. Note that this won’t compile +until we add a definition for the `impl_hello_world` function. We’ve split the +code into functions in this way because the code in Listing A4-2 will be the +same for almost every procedural macro crate; it’s code that makes writing a +procedural macro more convenient. What you choose to do in the place where the +`impl_hello_world` function is called will be different and depend on the +purpose of your procedural macro. + +Filename: hello-world-derive/src/lib.rs + +``` +extern crate proc_macro; +extern crate syn; +#[macro_use] +extern crate quote; + +use proc_macro::TokenStream; + +#[proc_macro_derive(HelloWorld)] +pub fn hello_world_derive(input: TokenStream) -> TokenStream { + // Construct a string representation of the type definition + let s = input.to_string(); + + // Parse the string representation + let ast = syn::parse_derive_input(&s).unwrap(); + + // Build the impl + let gen = impl_hello_world(&ast); + + // Return the generated impl + gen.parse().unwrap() +} +``` + +Listing A4-2: Code that most procedural macro crates will need to have for +processing Rust code + +We have introduced three new crates: `proc_macro`, `syn` (available from +*https://crates.io/crates/syn*), and `quote` (available from +*https://crates.io/crates/quote*). The `proc_macro` crate comes with Rust, so +we didn’t need to add that to the dependencies in *Cargo.toml*. The +`proc_macro` crate allows us to convert Rust code into a string containing that +Rust code. The `syn` crate parses Rust code from a string into a data structure +that we can perform operations on. The `quote` crate takes `syn` data +structures and turns them back into Rust code. These crates make it much +simpler to parse any sort of Rust code we might want to handle: writing a full +parser for Rust code is no simple task. + +The `hello_world_derive` function is the code that will get called when a user +of our library specifies the `#[derive(HelloWorld)]` annotation on a type +because we’ve annotated the `hello_world_derive` function here with +`proc_macro_derive` and specified the same name, `HelloWorld`. This name +matches our trait named `HelloWorld`; that’s the convention most procedural +macros follow. + +The first thing this function does is convert the `input` from a `TokenStream` +to a `String` by calling `to_string`. This `String` is a string representation +of the Rust code for which we are deriving `HelloWorld`. In the example in +Listing A4-1, `s` will have the `String` value `struct Pancakes;` because +that’s the Rust code we added the `#[derive(HelloWorld)]` annotation to. + +At the moment, the only thing you can do with a `TokenStream` is convert it to +a string. A richer API will exist in the future. + +What we really need is to be able to parse the Rust code `String` into a data +structure that we can then interpret and perform operations on. This is where +`syn` comes to play. The `parse_derive_input` function in `syn` takes a +`String` and returns a `DeriveInput` struct representing the parsed Rust code. +Here’s the relevant parts of the `DeriveInput` struct we get from parsing the +string `struct Pancakes;`: + +``` +DeriveInput { + // --snip-- + + ident: Ident( + "Pancakes" + ), + body: Struct( + Unit + ) +} +``` + +The fields of this struct show that the Rust code we’ve parsed is a unit struct +with the `ident` (identifier, meaning the name) of `Pancakes`. There are more +fields on this struct for describing all sorts of Rust code; check the `syn` +API docs for `DeriveInput` at +*https://docs.rs/syn/0.11.11/syn/struct.DeriveInput.html* for more information. + +We haven’t defined the `impl_hello_world` function; that’s where we’ll build +the new Rust code we want to include. Before we get to that, the last part of +this `hello_world_derive` function is using the `quote` crate’s `parse` +function to turn the output of the `impl_hello_world` function back into a +`TokenStream`. The returned `TokenStream` is added to the code that users of +our crate write so that when they compile their crate, they get extra +functionality we provide. + +You may have noticed that we’re calling `unwrap` to panic if the calls to the +`parse_derive_input` or `parse` functions fail because they’re unable to parse +the `TokenStream` or generate a `TokenStream`. Panicking on errors is necessary +in procedural macro code because `proc_macro_derive` functions must return +`TokenStream` rather than `Result` in order to conform to the procedural macro +API. We’ve chosen to keep this example simple by using `unwrap`; in production +code you should provide more specific error messages about what went wrong by +using `expect` or `panic!`. + +Now that we have the code to turn the annotated Rust code from a `TokenStream` +into a `String` and into a `DeriveInput` instance, let’s write the code that +will generate the code implementing the `HelloWorld` trait on the annotated +type: + +Filename: hello-world-derive/src/lib.rs + +``` +fn impl_hello_world(ast: &syn::DeriveInput) -> quote::Tokens { + let name = &ast.ident; + quote! { + impl HelloWorld for #name { + fn hello_world() { + println!("Hello, World! My name is {}", stringify!(#name)); + } + } + } +} +``` + +We are able to get an `Ident` struct instance containing the name (identifier) +of the annotated type using `ast.ident`. With the code from Listing A4-1, +`name` will be `Ident("Pancakes")`. + +The `quote!` macro from the `quote` crate lets us write up the Rust code that +we wish to return and convert it into `quote::Tokens`. The `quote!` macro lets +us use some really cool templating mechanics; we can write `#name` and `quote!` +will replace it with the value in the variable named `name`. You can even do +some repetition similar to the way regular macros work. Check out the `quote` +crate’s docs at *https://docs.rs/quote* for a thorough introduction. + +What we want to do for our procedural macro is generate an implementation of +our `HelloWorld` trait for the type the user of our crate has annotated, which +we can get by using `#name`. The trait implementation has one function, +`hello_world`, and the function body contains the functionality we want to +provide: printing `Hello, World! My name is` and then the name of the type the +user of our crate has annotated. The `stringify!` macro used here is built into +Rust. It takes a Rust expression, such as `1 + 2`, and at compile time turns +the expression into a string literal, such as `"1 + 2"`. This is different than +`format!` or `println!`, which evaluate the expression and then turn the result +into a `String`. There’s a possibility that `#name` would be an expression that +we would want to print out literally, and `stringify!` also saves an allocation +by converting `#name` to a string literal at compile time. + +At this point, `cargo build` should complete successfully in both `hello-world` +and `hello-world-derive`. Let’s hook these crates up to the code in Listing +A4-1 to see it in action! Create a new binary project in your `projects` +directory with `cargo new --bin pancakes`. We need to add both `hello-world` +and `hello-world-derive` as dependencies in the `pancakes` crate’s +*Cargo.toml*. If you’ve chosen to publish your versions of `hello-world` and +`hello-world-derive` to *https://crates.io* they would be regular dependencies; +if not, you can specify them as `path` dependencies as follows: + +``` +[dependencies] +hello_world = { path = "../hello-world" } +hello_world_derive = { path = "../hello-world/hello-world-derive" } +``` + +Put the code from Listing A4-1 into *src/main.rs*, and executing `cargo run` +should print `Hello, World! My name is Pancakes`! The implementation of the +`HelloWorld` trait from the procedural macro was included without the +`pancakes` crate needing to implement it; the `#[derive(HelloWorld)]` took care +of adding the trait implementation. + +## The Future of Macros + +In the future, we’ll be expanding both declarative and procedural macros. A +better declarative macro system will be used with the `macro` keyword, and +we’ll add more types of procedural macros, for more powerful tasks than only +`derive`. These systems are still under development at the time of publication; +please consult the online Rust documentation for the latest information. diff --git a/src/doc/book/second-edition/nostarch/chapter04.md b/src/doc/book/second-edition/nostarch/chapter04.md index 73ae2a3d72..9610752714 100644 --- a/src/doc/book/second-edition/nostarch/chapter04.md +++ b/src/doc/book/second-edition/nostarch/chapter04.md @@ -331,7 +331,7 @@ To ensure memory safety, there’s one more detail to what happens in this situation in Rust. Instead of trying to copy the allocated memory, Rust considers `s1` to no longer be valid and therefore, Rust doesn’t need to free anything when `s1` goes out of scope. Check out what happens when you try to -use `s1` after `s2` is created, it won't work: +use `s1` after `s2` is created, it won’t work: ``` let s1 = String::from("hello"); diff --git a/src/doc/book/second-edition/nostarch/chapter05.md b/src/doc/book/second-edition/nostarch/chapter05.md index 64e2a0f10a..855ea36248 100644 --- a/src/doc/book/second-edition/nostarch/chapter05.md +++ b/src/doc/book/second-edition/nostarch/chapter05.md @@ -678,7 +678,7 @@ parameter will be by looking at the code that calls the method: read `rect2` (rather than write, which would mean we’d need a mutable borrow), and we want `main` to retain ownership of `rect2` so we can use it again after calling the `can_hold` method. The return value of `can_hold` will be a -boolean, and the implementation will check whether the width and height of +Boolean, and the implementation will check whether the width and height of `self` are both greater than the width and height of the other `Rectangle`, respectively. Let’s add the new `can_hold` method to the `impl` block from Listing 5-13, shown in Listing 5-15: diff --git a/src/doc/book/second-edition/nostarch/chapter06.md b/src/doc/book/second-edition/nostarch/chapter06.md index b3c4eb223e..ea649f014c 100644 --- a/src/doc/book/second-edition/nostarch/chapter06.md +++ b/src/doc/book/second-edition/nostarch/chapter06.md @@ -432,7 +432,7 @@ as its patterns. Let’s break down the `match` in the `value_in_cents` function. First, we list the `match` keyword followed by an expression, which in this case is the value `coin`. This seems very similar to an expression used with `if`, but there’s a -big difference: with `if`, the expression needs to return a boolean value. +big difference: with `if`, the expression needs to return a Boolean value. Here, it can be any type. The type of `coin` in this example is the `Coin` enum that we defined in Listing 6-3. diff --git a/src/doc/book/second-edition/nostarch/chapter07.md b/src/doc/book/second-edition/nostarch/chapter07.md index 3a41aec608..47e67b189a 100644 --- a/src/doc/book/second-edition/nostarch/chapter07.md +++ b/src/doc/book/second-edition/nostarch/chapter07.md @@ -231,7 +231,7 @@ These would be good reasons to separate the `client`, `network`, and `server` modules from *src/lib.rs* and place them into their own files. First, replace the `client` module code with only the declaration of the -`client` module, so that your *src/lib.rs* looks like the following: +`client` module, so that your *src/lib.rs* looks like code shown in Listing 7-4: Filename: src/lib.rs @@ -249,6 +249,9 @@ mod network { } ``` +Listing 7-4: Extracting the contents of the `client` module but leaving the +declaration in *src/lib.rs* + We’re still *declaring* the `client` module here, but by replacing the block with a semicolon, we’re telling Rust to look in another location for the code defined within the scope of the `client` module. In other words, the line `mod @@ -372,7 +375,7 @@ fn connect() { } ``` -When we try to `cargo build`, we’ll get the error shown in Listing 7-4: +When we try to `cargo build`, we’ll get the error shown in Listing 7-5: ``` $ cargo build @@ -395,14 +398,14 @@ note: ... or maybe `use` the module `server` instead of possibly redeclaring it | ^^^^^^ ``` -Listing 7-4: Error when trying to extract the `server` submodule into +Listing 7-5: Error when trying to extract the `server` submodule into *src/server.rs* The error says we `cannot declare a new module at this location` and is pointing to the `mod server;` line in *src/network.rs*. So *src/network.rs* is different than *src/lib.rs* somehow: keep reading to understand why. -The note in the middle of Listing 7-4 is actually very helpful because it +The note in the middle of Listing 7-5 is actually very helpful because it points out something we haven’t yet talked about doing: ``` @@ -509,7 +512,7 @@ Next, we’ll talk about the `pub` keyword and get rid of those warnings! ## Controlling Visibility with `pub` -We resolved the error messages shown in Listing 7-4 by moving the `network` and +We resolved the error messages shown in Listing 7-5 by moving the `network` and `network::server` code into the *src/network/mod.rs* and *src/network/server.rs* files, respectively. At that point, `cargo build` was able to build our project, but we still get warning messages about the @@ -750,7 +753,7 @@ Overall, these are the rules for item visibility: ### Privacy Examples Let’s look at a few more privacy examples to get some practice. Create a new -library project and enter the code in Listing 7-5 into your new project’s +library project and enter the code in Listing 7-6 into your new project’s *src/lib.rs*: Filename: src/lib.rs @@ -776,7 +779,7 @@ fn try_me() { } ``` -Listing 7-5: Examples of private and public functions, some of which are +Listing 7-6: Examples of private and public functions, some of which are incorrect Before you try to compile this code, make a guess about which lines in the @@ -826,7 +829,7 @@ Next, let’s talk about bringing items into scope with the `use` keyword. We’ve covered how to call functions defined within a module using the module name as part of the call, as in the call to the `nested_modules` function shown -here in Listing 7-6: +here in Listing 7-7: Filename: src/main.rs @@ -844,7 +847,7 @@ fn main() { } ``` -Listing 7-6: Calling a function by fully specifying its enclosing module’s path +Listing 7-7: Calling a function by fully specifying its enclosing module’s path As you can see, referring to the fully qualified name can get quite lengthy. Fortunately, Rust has a keyword to make these calls more concise. @@ -991,7 +994,7 @@ communicator Tests are for exercising the code within our library, so let’s try to call our `client::connect` function from this `it_works` function, even though we won’t -be checking any functionality right now. This won't work yet: +be checking any functionality right now. This won’t work yet: Filename: src/lib.rs @@ -1081,7 +1084,7 @@ $ cargo test running 1 test test tests::it_works ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` ## Summary diff --git a/src/doc/book/second-edition/nostarch/chapter08.md b/src/doc/book/second-edition/nostarch/chapter08.md index 24772717fd..5200ccc47a 100644 --- a/src/doc/book/second-edition/nostarch/chapter08.md +++ b/src/doc/book/second-edition/nostarch/chapter08.md @@ -141,7 +141,7 @@ argument, which gives us an `Option<&T>`. The reason Rust has two ways to reference an element is so you can choose how the program behaves when you try to use an index value that the vector doesn’t -have an element for. As an example, let's see what a program will do if it has +have an element for. As an example, let’s see what a program will do if it has a vector that holds five elements and then tries to access an element at index 100, as shown in Listing 8-6: @@ -177,7 +177,7 @@ ownership and borrowing rules (covered in Chapter 4) to ensure this reference and any other references to the contents of the vector remain valid. Recall the rule that states we can’t have mutable and immutable references in the same scope. That rule applies in Listing 8-7 where we hold an immutable reference to -the first element in a vector and try to add an element to the end, which won't +the first element in a vector and try to add an element to the end, which won’t work: ``` @@ -194,15 +194,16 @@ to an item Compiling this code will result in this error: ``` -error[E0502]: cannot borrow `v` as mutable because it is also borrowed as -immutable +error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable + --> | -4 | let first = &v[0]; - | - immutable borrow occurs here +4 | let first = &v[0]; + | - immutable borrow occurs here 5 | -6 | v.push(6); - | ^ mutable borrow occurs here -7 | } +6 | v.push(6); + | ^ mutable borrow occurs here +7 | +8 | } | - immutable borrow ends here ``` diff --git a/src/doc/book/second-edition/nostarch/chapter09.md b/src/doc/book/second-edition/nostarch/chapter09.md index 361970734d..0e9b90d000 100644 --- a/src/doc/book/second-edition/nostarch/chapter09.md +++ b/src/doc/book/second-edition/nostarch/chapter09.md @@ -102,17 +102,18 @@ Filename: src/main.rs fn main() { let v = vec![1, 2, 3]; - v[100]; + v[99]; } ``` Listing 9-1: Attempting to access an element beyond the end of a vector, which will cause a `panic!` -Here, we’re attempting to access the hundredth element of our vector, but it -has only three elements. In this situation, Rust will panic. Using `[]` is -supposed to return an element, but if you pass an invalid index, there’s no -element that Rust could return here that would be correct. +Here, we’re attempting to access the hundredth element of our vector (which is +at index 99 because indexing starts at zero), but it has only three elements. +In this situation, Rust will panic. Using `[]` is supposed to return an +element, but if you pass an invalid index, there’s no element that Rust could +return here that would be correct. Other languages, like C, will attempt to give you exactly what you asked for in this situation, even though it isn’t what you want: you’ll get whatever is at @@ -634,6 +635,7 @@ fn read_username_from_file() -> Result { let mut s = String::new(); File::open("hello.txt")?.read_to_string(&mut s)?; + Ok(s) } ``` diff --git a/src/doc/book/second-edition/nostarch/chapter11.md b/src/doc/book/second-edition/nostarch/chapter11.md index b1209cf0f9..799ec38056 100644 --- a/src/doc/book/second-edition/nostarch/chapter11.md +++ b/src/doc/book/second-edition/nostarch/chapter11.md @@ -3,67 +3,72 @@ # Writing Automated Tests -> Program testing can be a very effective way to show the presence of bugs, but -> it is hopelessly inadequate for showing their absence. -> Edsger W. Dijkstra, “The Humble Programmer” (1972) - -Correctness in our programs means that our code does what we intend for it to -do. Rust is a programming language that cares a lot about correctness, but -correctness is a complex topic and isn’t easy to prove. Rust’s type system +In his 1972 essay “The Humble Programmer,” Edsger W. Dijkstra said that +“Program testing can be a very effective way to show the presence of bugs, but +it is hopelessly inadequate for showing their absence.” That doesn’t mean we +shouldn’t try to test as much as we can! Correctness in our programs is the +extent to which our code does what we intend it to do. Rust is a programming +language designed with a high degree of concern about the correctness of +programs, but correctness is complex and not easy to prove. Rust’s type system shoulders a huge part of this burden, but the type system cannot catch every -kind of incorrectness. As such, Rust includes support for writing software -tests within the language itself. +kind of incorrectness. As such, Rust includes support for writing automated +software tests within the language. As an example, say we write a function called `add_two` that adds two to whatever number is passed to it. This function’s signature accepts an integer as a parameter and returns an integer as a result. When we implement and -compile that function, Rust will do all the type checking and borrow checking -that we’ve seen so far to make sure that, for instance, we aren’t passing a -`String` value or an invalid reference to this function. What Rust *can’t* -check is that this function will do precisely what we intend: return the -parameter plus two, rather than, say, the parameter plus 10 or the parameter +compile that function, Rust does all the type checking and borrow checking that +you’ve learned so far to ensure that, for instance, we aren’t passing a +`String` value or an invalid reference to this function. But Rust *can’t* check +that this function will do precisely what we intend, which is return the +parameter plus two rather than, say, the parameter plus 10 or the parameter minus 50! That’s where tests come in. We can write tests that assert, for example, that when we pass `3` to the -`add_two` function, we get `5` back. We can run these tests whenever we make -changes to our code to make sure any existing correct behavior has not changed. +`add_two` function, the returned value is `5`. We can run these tests whenever +we make changes to our code to make sure any existing correct behavior has not +changed. -Testing is a complex skill, and we cannot hope to cover everything about how to -write good tests in one chapter of a book, so here we’ll just discuss the -mechanics of Rust’s testing facilities. We’ll talk about the annotations and -macros available to you when writing your tests, the default behavior and -options provided for running your tests, and how to organize tests into unit -tests and integration tests. +Testing is a complex skill: although we can’t cover every detail about how to +write good tests in one chapter, we’ll discuss the mechanics of Rust’s testing +facilities. We’ll talk about the annotations and macros available to you when +writing your tests, the default behavior and options provided for running your +tests, and how to organize tests into unit tests and integration tests. ## How to Write Tests Tests are Rust functions that verify that the non-test code is functioning in -the expected manner. The bodies of test functions typically perform some setup, -run the code we want to test, then assert whether the results are what we -expect. Let’s look at the features Rust provides specifically for writing -tests: the `test` attribute, a few macros, and the `should_panic` attribute. +the expected manner. The bodies of test functions typically perform these three +actions: + +1. Set up any needed data or state +2. Run the code we want to test +3. Assert the results are what we expect + +Let’s look at the features Rust provides specifically for writing tests that +take these actions, which include the `test` attribute, a few macros, and the +`should_panic` attribute. ### The Anatomy of a Test Function At its simplest, a test in Rust is a function that’s annotated with the `test` -attribute. Attributes are metadata about pieces of Rust code: the `derive` -attribute that we used with structs in Chapter 5 is one example. To make a -function into a test function, we add `#[test]` on the line before `fn`. When -we run our tests with the `cargo test` command, Rust will build a test runner -binary that runs the functions annotated with the `test` attribute and reports -on whether each test function passes or fails. +attribute. Attributes are metadata about pieces of Rust code; one example is +the `derive` attribute we used with structs in Chapter 5. To change a function +into a test function, we add `#[test]` on the line before `fn`. When we run our +tests with the `cargo test` command, Rust builds a test runner binary that runs +the functions annotated with the `test` attribute and reports on whether each +test function passes or fails. -We saw in Chapter 7 that when you make a new library project with Cargo, a test -module with a test function in it is automatically generated for us. This is to -help us get started writing our tests so we don’t have to go look up the -exact structure and syntax of test functions every time we start a new project. -We can add as many additional test functions and as many test modules as we -want, though! +In Chapter 7, we saw that when we make a new library project with Cargo, a test +module with a test function in it is automatically generated for us. This +module helps us start writing our tests so we don’t have to look up the exact +structure and syntax of test functions every time we start a new project. We +can add as many additional test functions and as many test modules as we want! -We’re going to explore some aspects of how tests work by experimenting with the -template test generated for us, without actually testing any code. Then we’ll -write some real-world tests that call some code that we’ve written and assert -that its behavior is correct. +We’ll explore some aspects of how tests work by experimenting with the template +test generated for us without actually testing any code. Then we’ll write some +real-world tests that call some code that we’ve written and assert that its +behavior is correct. Let’s create a new library project called `adder`: @@ -73,8 +78,8 @@ $ cargo new adder $ cd adder ``` -The contents of the `src/lib.rs` file in your adder library should be as -follows: +The contents of the *src/lib.rs* file in your adder library should look like +Listing 11-1: Filename: src/lib.rs @@ -83,26 +88,27 @@ Filename: src/lib.rs mod tests { #[test] fn it_works() { + assert_eq!(2 + 2, 4); } } ``` -Listing 11-1: The test module and function generated automatically for us by -`cargo new` +Listing 11-1: The test module and function generated automatically by `cargo +new` For now, let’s ignore the top two lines and focus on the function to see how it works. Note the `#[test]` annotation before the `fn` line: this attribute -indicates this is a test function, so that the test runner knows to treat this +indicates this is a test function, so the test runner knows to treat this function as a test. We could also have non-test functions in the `tests` module to help set up common scenarios or perform common operations, so we need to -indicate which functions are tests with the `#[test]` attribute. +indicate which functions are tests by using the `#[test]` attribute. -The function currently has no body, which means there is no code to fail the -test; an empty test is a passing test! Let’s run it and see that this test -passes. +The function body uses the `assert_eq!` macro to assert that 2 + 2 equals 4. +This assertion serves as an example of the format for a typical test. Let’s run +it to see that this test passes. -The `cargo test` command runs all tests we have in our project, as shown in -Listing 11-2: +The `cargo test` command runs all tests in our project, as shown in Listing +11-2: ``` $ cargo test @@ -113,40 +119,43 @@ $ cargo test running 1 test test tests::it_works ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Doc-tests adder running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Listing 11-2: The output from running the one automatically generated test +Listing 11-2: The output from running the automatically generated test -Cargo compiled and ran our test. After the `Compiling`, `Finished`, and -`Running` lines, we see the line `running 1 test`. The next line shows the name +Cargo compiled and ran the test. After the `Compiling`, `Finished`, and +`Running` lines is the line `running 1 test`. The next line shows the name of the generated test function, called `it_works`, and the result of running -that test, `ok`. Then we see the overall summary of running the tests: `test -result: ok.` means all the tests passed. `1 passed; 0 failed` adds up the -number of tests that passed or failed. +that test, `ok`. The overall summary of running the tests appears next. The +text `test result: ok.` means that all the tests passed, and the portion that +reads `1 passed; 0 failed` totals the number of tests that passed or failed. -We don’t have any tests we’ve marked as ignored, so the summary says `0 -ignored`. We’re going to talk about ignoring tests in the next section on -different ways to run tests. The `0 measured` statistic is for benchmark tests -that measure performance. Benchmark tests are, as of this writing, only -available in nightly Rust. See Appendix D for more information about nightly -Rust. +Because we don’t have any tests we’ve marked as ignored, the summary shows `0 +ignored`. We also haven’t filtered the tests being run, so the end of the +summary shows `0 filtered out`. We’ll talk about ignoring and filtering out +tests in the next section, “Controlling How Tests Are Run.” -The next part of the test output that starts with `Doc-tests adder` is for the -results of any documentation tests. We don’t have any documentation tests yet, -but Rust can compile any code examples that appear in our API documentation. -This feature helps us keep our docs and our code in sync! We’ll be talking -about how to write documentation tests in the “Documentation Comments” section -of Chapter 14. We’re going to ignore the `Doc-tests` output for now. +The `0 measured` statistic is for benchmark tests that measure performance. +Benchmark tests are, as of this writing, only available in nightly Rust. See +Chapter 1 for more information about nightly Rust. -Let’s change the name of our test and see how that changes the test output. -Give the `it_works` function a different name, such as `exploration`, like so: +The next part of the test output, which starts with `Doc-tests adder`, is for +the results of any documentation tests. We don’t have any documentation tests +yet, but Rust can compile any code examples that appear in our API +documentation. This feature helps us keep our docs and our code in sync! We’ll +discuss how to write documentation tests in the “Documentation Comments” +section of Chapter 14. For now, we’ll ignore the `Doc-tests` output. + +Let’s change the name of our test to see how that changes the test output. +Change the `it_works` function to a different name, such as `exploration`, like +so: Filename: src/lib.rs @@ -155,26 +164,27 @@ Filename: src/lib.rs mod tests { #[test] fn exploration() { + assert_eq!(2 + 2, 4); } } ``` -And run `cargo test` again. In the output, we’ll now see `exploration` instead -of `it_works`: +Then run `cargo test` again. The output now shows `exploration` instead of +`it_works`: ``` running 1 test test tests::exploration ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` Let’s add another test, but this time we’ll make a test that fails! Tests fail when something in the test function panics. Each test is run in a new thread, and when the main thread sees that a test thread has died, the test is marked -as failed. We talked about the simplest way to cause a panic in Chapter 9: call -the `panic!` macro! Type in the new test so that your `src/lib.rs` now looks -like Listing 11-3: +as failed. We talked about the simplest way to cause a panic in Chapter 9, +which is to call the `panic!` macro. Enter the new test, `another`, so your +*src/lib.rs* file looks like Listing 11-3: Filename: src/lib.rs @@ -183,6 +193,7 @@ Filename: src/lib.rs mod tests { #[test] fn exploration() { + assert_eq!(2 + 2, 4); } #[test] @@ -192,10 +203,10 @@ mod tests { } ``` -Listing 11-3: Adding a second test; one that will fail since we call the -`panic!` macro +Listing 11-3: Adding a second test that will fail because we call the `panic!` +macro -And run the tests again with `cargo test`. The output should look like Listing +Run the tests again using `cargo test`. The output should look like Listing 11-4, which shows that our `exploration` test passed and `another` failed: ``` @@ -206,48 +217,48 @@ test tests::another ... FAILED failures: ---- tests::another stdout ---- - thread 'tests::another' panicked at 'Make this test fail', src/lib.rs:9 + thread 'tests::another' panicked at 'Make this test fail', src/lib.rs:10:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::another -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out error: test failed ``` Listing 11-4: Test results when one test passes and one test fails -Instead of `ok`, the line `test tests::another` says `FAILED`. We have two new -sections between the individual results and the summary: the first section -displays the detailed reason for the test failures. In this case, `another` -failed because it `panicked at 'Make this test fail'`, which happened on -*src/lib.rs* line 9. The next section lists just the names of all the failing -tests, which is useful when there are lots of tests and lots of detailed -failing test output. We can use the name of a failing test to run just that -test in order to more easily debug it; we’ll talk more about ways to run tests -in the next section. +Instead of `ok`, the line `test tests::another` shows `FAILED`. Two new +sections appear between the individual results and the summary: the first +section displays the detailed reason for each test failure. In this case, +`another` failed because it `panicked at 'Make this test fail'`, which happened +on line 10 in the *src/lib.rs* file. The next section lists just the names of +all the failing tests, which is useful when there are lots of tests and lots of +detailed failing test output. We can use the name of a failing test to run just +that test to more easily debug it; we’ll talk more about ways to run tests in +the “Controlling How Tests Are Run” section. -Finally, we have the summary line: overall, our test result is `FAILED`. We had -1 test pass and 1 test fail. +The summary line displays at the end: overall, our test result is `FAILED`. +We had one test pass and one test fail. -Now that we’ve seen what the test results look like in different scenarios, +Now that you’ve seen what the test results look like in different scenarios, let’s look at some macros other than `panic!` that are useful in tests. ### Checking Results with the `assert!` Macro The `assert!` macro, provided by the standard library, is useful when you want to ensure that some condition in a test evaluates to `true`. We give the -`assert!` macro an argument that evaluates to a boolean. If the value is `true`, -`assert!` does nothing and the test passes. If the value is `false`, `assert!` -calls the `panic!` macro, which causes the test to fail. This is one macro that -helps us check that our code is functioning in the way we intend. +`assert!` macro an argument that evaluates to a boolean. If the value is +`true`, `assert!` does nothing and the test passes. If the value is `false`, +the `assert!` macro calls the `panic!` macro, which causes the test to fail. +Using the `assert!` macro helps us check that our code is functioning in the +way we intend. -Remember all the way back in Chapter 5, Listing 5-9, where we had a `Rectangle` -struct and a `can_hold` method, repeated here in Listing 11-5. Let’s put this -code in *src/lib.rs* instead of *src/main.rs* and write some tests for it using -the `assert!` macro. +In Chapter 5, Listing 5-9, we used a `Rectangle` struct and a `can_hold` +method, which are repeated here in Listing 11-5. Let’s put this code in the +*src/lib.rs* file and write some tests for it using the `assert!` macro. Filename: src/lib.rs @@ -265,10 +276,11 @@ impl Rectangle { } ``` -Listing 11-5: The `Rectangle` struct and its `can_hold` method from Chapter 5 +Listing 11-5: Using the `Rectangle` struct and its `can_hold` method from +Chapter 5 The `can_hold` method returns a boolean, which means it’s a perfect use case -for the `assert!` macro. In Listing 11-6, let’s write a test that exercises the +for the `assert!` macro. In Listing 11-6, we write a test that exercises the `can_hold` method by creating a `Rectangle` instance that has a length of 8 and a width of 7, and asserting that it can hold another `Rectangle` instance that has a length of 5 and a width of 1: @@ -290,26 +302,26 @@ mod tests { } ``` -Listing 11-6: A test for `can_hold` that checks that a larger rectangle indeed -holds a smaller rectangle +Listing 11-6: A test for `can_hold` that checks that a larger rectangle can +indeed hold a smaller rectangle -Note that we’ve added a new line inside the `tests` module: `use super::*;`. -The `tests` module is a regular module that follows the usual visibility rules -we covered in Chapter 7. Because we’re in an inner module, we need to bring the -code under test in the outer module into the scope of the inner module. We’ve -chosen to use a glob here so that anything we define in the outer module is -available to this `tests` module. +Note that we’ve added a new line inside the `tests` module: the `use super::*;` +line. The `tests` module is a regular module that follows the usual visibility +rules we covered in Chapter 7 in the “Privacy Rules” section. Because the +`tests` module is an inner module, we need to bring the code under test in the +outer module into the scope of the inner module. We use a glob here so anything +we define in the outer module is available to this `tests` module. We’ve named our test `larger_can_hold_smaller`, and we’ve created the two `Rectangle` instances that we need. Then we called the `assert!` macro and -passed it the result of calling `larger.can_hold(&smaller)`. This expression is -supposed to return `true`, so our test should pass. Let’s find out! +passed it the result of calling `larger.can_hold(&smaller)`. This expression +is supposed to return `true`, so our test should pass. Let’s find out! ``` running 1 test test tests::larger_can_hold_smaller ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` It does pass! Let’s add another test, this time asserting that a smaller @@ -324,10 +336,7 @@ mod tests { #[test] fn larger_can_hold_smaller() { - let larger = Rectangle { length: 8, width: 7 }; - let smaller = Rectangle { length: 5, width: 1 }; - - assert!(larger.can_hold(&smaller)); + // --snip-- } #[test] @@ -341,28 +350,24 @@ mod tests { ``` Because the correct result of the `can_hold` function in this case is `false`, -we need to negate that result before we pass it to the `assert!` macro. This -way, our test will pass if `can_hold` returns `false`: +we need to negate that result before we pass it to the `assert!` macro. As a +result, our test will pass if `can_hold` returns `false`: ``` running 2 tests test tests::smaller_cannot_hold_larger ... ok test tests::larger_can_hold_smaller ... ok -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Two passing tests! Now let’s see what happens to our test results if we +Two tests that pass! Now let’s see what happens to our test results when we introduce a bug in our code. Let’s change the implementation of the `can_hold` -method to have a less-than sign when it compares the lengths where it’s -supposed to have a greater-than sign: +method by replacing the greater-than sign with a less-than sign when it +compares the lengths: ``` -#[derive(Debug)] -pub struct Rectangle { - length: u32, - width: u32, -} +// --snip-- impl Rectangle { pub fn can_hold(&self, other: &Rectangle) -> bool { @@ -371,7 +376,7 @@ impl Rectangle { } ``` -Running the tests now produces: +Running the tests now produces the following: ``` running 2 tests @@ -381,36 +386,36 @@ test tests::larger_can_hold_smaller ... FAILED failures: ---- tests::larger_can_hold_smaller stdout ---- - thread 'tests::larger_can_hold_smaller' panicked at 'assertion failed: - larger.can_hold(&smaller)', src/lib.rs:22 + thread 'tests::larger_can_hold_smaller' panicked at 'assertion failed: + larger.can_hold(&smaller)', src/lib.rs:22:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::larger_can_hold_smaller -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -Our tests caught the bug! Since `larger.length` is 8 and `smaller.length` is 5, -the comparison of the lengths in `can_hold` now returns `false` since 8 is not +Our tests caught the bug! Because `larger.length` is 8 and `smaller.length` is +5, the comparison of the lengths in `can_hold` now returns `false`: 8 is not less than 5. ### Testing Equality with the `assert_eq!` and `assert_ne!` Macros -A common way to test functionality is to take the result of the code under test -and the value we expect the code to return and check that they’re equal. We +A common way to test functionality is to compare the result of the code under +test to the value we expect the code to return to make sure they’re equal. We could do this using the `assert!` macro and passing it an expression using the `==` operator. However, this is such a common test that the standard library -provides a pair of macros to perform this test more conveniently: `assert_eq!` -and `assert_ne!`. These macros compare two arguments for equality or -inequality, respectively. They’ll also print out the two values if the -assertion fails, so that it’s easier to see *why* the test failed, while the -`assert!` macro only tells us that it got a `false` value for the `==` +provides a pair of macros—`assert_eq!` and `assert_ne!`—to perform this test +more conveniently. These macros compare two arguments for equality or +inequality, respectively. They’ll also print the two values if the assertion +fails, which makes it easier to see *why* the test failed; conversely, the +`assert!` macro only indicates that it got a `false` value for the `==` expression, not the values that lead to the `false` value. -In Listing 11-7, let’s write a function named `add_two` that adds two to its -parameter and returns the result. Then let’s test this function using the -`assert_eq!` macro: +In Listing 11-7, we write a function named `add_two` that adds `2` to its +parameter and returns the result. Then we test this function using the +`assert_eq!` macro. Filename: src/lib.rs @@ -438,16 +443,16 @@ Let’s check that it passes! running 1 test test tests::it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -The first argument we gave to the `assert_eq!` macro, 4, is equal to the result -of calling `add_two(2)`. We see a line for this test that says `test +The first argument we gave to the `assert_eq!` macro, `4`, is equal to the +result of calling `add_two(2)`. The line for this test is `test tests::it_adds_two ... ok`, and the `ok` text indicates that our test passed! Let’s introduce a bug into our code to see what it looks like when a test that uses `assert_eq!` fails. Change the implementation of the `add_two` function to -instead add 3: +instead add `3`: ``` pub fn add_two(a: i32) -> i32 { @@ -455,7 +460,7 @@ pub fn add_two(a: i32) -> i32 { } ``` -And run the tests again: +Run the tests again: ``` running 1 test @@ -464,62 +469,63 @@ test tests::it_adds_two ... FAILED failures: ---- tests::it_adds_two stdout ---- - thread 'tests::it_adds_two' panicked at 'assertion failed: `(left == - right)` (left: `4`, right: `5`)', src/lib.rs:11 -note: Run with `RUST_BACKTRACE=1` for a backtrace. + thread 'tests::it_adds_two' panicked at 'assertion failed: `(left == right)` + left: `4`, + right: `5`', src/lib.rs:11:8 failures: tests::it_adds_two -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -Our test caught the bug! The `it_adds_two` test failed with the message `` -assertion failed: `(left == right)` (left: `4`, right: `5`) ``. This message is -useful and helps us get started debugging: it says the `left` argument to -`assert_eq!` was 4, but the `right` argument, where we had `add_two(2)`, was 5. +Our test caught the bug! The `it_adds_two` test failed, displaying the message +`` assertion failed: `(left == right)` `` and showing that `left` was `4` and +`right` was `5`. This message is useful and helps us start debugging: it means +the `left` argument to `assert_eq!` was `4`, but the `right` argument, where we +had `add_two(2)`, was `5`. Note that in some languages and test frameworks, the parameters to the -functions that assert two values are equal are called `expected` and `actual` +functions that assert two values are equal are called `expected` and `actual`, and the order in which we specify the arguments matters. However, in Rust, -they’re called `left` and `right` instead, and the order in which we specify -the value we expect and the value that the code under test produces doesn’t -matter. We could write the assertion in this test as -`assert_eq!(add_two(2), 4)`, which would result in a failure message that says -`` assertion failed: `(left == right)` (left: `5`, right: `4`) ``. +they’re called `left` and `right`, and the order in which we specify the value +we expect and the value that the code under test produces doesn’t matter. We +could write the assertion in this test as `assert_eq!(add_two(2), 4)`, which +would result in a failure message that displays `` assertion failed: `(left == +right)` `` and that `left` was `5` and `right` was `4`. -The `assert_ne!` macro will pass if the two values we give to it are not equal -and fail if they are equal. This macro is most useful for cases when we’re not -sure exactly what a value *will* be, but we know what the value definitely -*won’t* be, if our code is functioning as we intend. For example, if we have a -function that is guaranteed to change its input in some way, but the way in -which the input is changed depends on the day of the week that we run our -tests, the best thing to assert might be that the output of the function is not -equal to the input. +The `assert_ne!` macro will pass if the two values we give it are not equal and +fail if they’re equal. This macro is most useful for cases when we’re not sure +what a value *will* be, but we know what the value definitely *won’t* be if our +code is functioning as we intend. For example, if we’re testing a function that +is guaranteed to change its input in some way, but the way in which the input +is changed depends on the day of the week that we run our tests, the best thing +to assert might be that the output of the function is not equal to the input. Under the surface, the `assert_eq!` and `assert_ne!` macros use the operators `==` and `!=`, respectively. When the assertions fail, these macros print their arguments using debug formatting, which means the values being compared must -implement the `PartialEq` and `Debug` traits. All of the primitive types and -most of the standard library types implement these traits. For structs and -enums that you define, you’ll need to implement `PartialEq` in order to be able -to assert that values of those types are equal or not equal. You’ll need to -implement `Debug` in order to be able to print out the values in the case that -the assertion fails. Because both of these traits are derivable traits, as we -mentioned in Chapter 5, this is usually as straightforward as adding the -`#[derive(PartialEq, Debug)]` annotation to your struct or enum definition. See -Appendix C for more details about these and other derivable traits. +implement the `PartialEq` and `Debug` traits. All the primitive types and most +of the standard library types implement these traits. For structs and enums +that you define, you’ll need to implement `PartialEq` to assert that values of +those types are equal or not equal. You’ll need to implement `Debug` to print +out the values when the assertion fails. Because both traits are derivable +traits, as mentioned in Listing 5-12 in Chapter 5, this is usually as +straightforward as adding the `#[derive(PartialEq, Debug)]` annotation to your +struct or enum definition. See Appendix C for more details about these and +other derivable traits. -### Custom Failure Messages +### Adding Custom Failure Messages We can also add a custom message to be printed with the failure message as -optional arguments to `assert!`, `assert_eq!`, and `assert_ne!`. Any arguments -specified after the one required argument to `assert!` or the two required -arguments to `assert_eq!` and `assert_ne!` are passed along to the `format!` -macro that we talked about in Chapter 8, so you can pass a format string that -contains `{}` placeholders and values to go in the placeholders. Custom -messages are useful in order to document what an assertion means, so that when -the test fails, we have a better idea of what the problem is with the code. +optional arguments to the `assert!`, `assert_eq!`, and `assert_ne!` macros. Any +arguments specified after the one required argument to `assert!` or the two +required arguments to `assert_eq!` and `assert_ne!` are passed along to the +`format!` macro (discussed in Chapter 8 in the “Concatenation with the `+` +Operator or the `format!` Macro” section), so you can pass a format string that +contains `{}` placeholders and values to go in those placeholders. Custom +messages are useful to document what an assertion means; when a test fails, +we’ll have a better idea of what the problem is with the code. For example, let’s say we have a function that greets people by name, and we want to test that the name we pass into the function appears in the output: @@ -547,11 +553,11 @@ The requirements for this program haven’t been agreed upon yet, and we’re pretty sure the `Hello` text at the beginning of the greeting will change. We decided we don’t want to have to update the test for the name when that happens, so instead of checking for exact equality to the value returned from -the `greeting` function, we’re just going to assert that the output contains -the text of the input parameter. +the `greeting` function, we’ll just assert that the output contains the text of +the input parameter. -Let’s introduce a bug into this code to see what this test failure looks like, -by changing `greeting` to not include `name`: +Let’s introduce a bug into this code by changing `greeting` to not include +`name` to see what this test failure looks like: ``` pub fn greeting(name: &str) -> String { @@ -559,7 +565,7 @@ pub fn greeting(name: &str) -> String { } ``` -Running this test produces: +Running this test produces the following: ``` running 1 test @@ -568,19 +574,19 @@ test tests::greeting_contains_name ... FAILED failures: ---- tests::greeting_contains_name stdout ---- - thread 'tests::greeting_contains_name' panicked at 'assertion failed: - result.contains("Carol")', src/lib.rs:12 + thread 'tests::greeting_contains_name' panicked at 'assertion failed: + result.contains("Carol")', src/lib.rs:12:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::greeting_contains_name ``` -This just tells us that the assertion failed and which line the assertion is -on. A more useful failure message in this case would print the value we did get -from the `greeting` function. Let’s change the test function to have a custom -failure message made from a format string with a placeholder filled in with the -actual value we got from the `greeting` function: +This result just indicates that the assertion failed and which line the +assertion is on. A more useful failure message in this case would print the +value we got from the `greeting` function. Let’s change the test function, +giving it a custom failure message made from a format string with a placeholder +filled in with the actual value we got from the `greeting` function: ``` #[test] @@ -593,12 +599,12 @@ fn greeting_contains_name() { } ``` -Now if we run the test again, we’ll get a much more informative error message: +Now when we run the test, we’ll get a more informative error message: ``` ---- tests::greeting_contains_name stdout ---- - thread 'tests::greeting_contains_name' panicked at 'Greeting did not contain - name, value was `Hello`', src/lib.rs:12 + thread 'tests::greeting_contains_name' panicked at 'Greeting did not contain + name, value was `Hello!`', src/lib.rs:12:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` @@ -609,23 +615,23 @@ debug what happened instead of what we were expecting to happen. In addition to checking that our code returns the correct values we expect, it’s also important to check that our code handles error conditions as we -expect. For example, consider the `Guess` type that we created in Chapter 9 in -Listing 9-8. Other code that uses `Guess` is depending on the guarantee that -`Guess` instances will only contain values between 1 and 100. We can write a -test that ensures that attempting to create a `Guess` instance with a value -outside that range panics. +expect. For example, consider the `Guess` type that we created in Chapter 9, +Listing 9-9. Other code that uses `Guess` depends on the guarantee that `Guess` +instances will only contain values between 1 and 100. We can write a test that +ensures that attempting to create a `Guess` instance with a value outside that +range panics. -We can do this by adding another attribute, `should_panic`, to our test -function. This attribute makes a test pass if the code inside the function -panics, and the test will fail if the code inside the function doesn’t panic. +We do this by adding another attribute, `should_panic`, to our test function. +This attribute makes a test pass if the code inside the function panics; the +test will fail if the code inside the function doesn’t panic. -Listing 11-8 shows how we’d write a test that checks the error conditions of -`Guess::new` happen when we expect: +Listing 11-8 shows a test that checks that the error conditions of `Guess::new` +happen when we expect: Filename: src/lib.rs ``` -struct Guess { +pub struct Guess { value: u32, } @@ -655,21 +661,23 @@ mod tests { Listing 11-8: Testing that a condition will cause a `panic!` -The `#[should_panic]` attribute goes after the `#[test]` attribute and before -the test function it applies to. Let’s see what it looks like when this test +We place the `#[should_panic]` attribute after the `#[test]` attribute and +before the test function it applies to. Let’s look at the result when this test passes: ``` running 1 test test tests::greater_than_100 ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Looks good! Now let’s introduce a bug in our code, by removing the condition +Looks good! Now let’s introduce a bug in our code by removing the condition that the `new` function will panic if the value is greater than 100: ``` +// --snip-- + impl Guess { pub fn new(value: u32) -> Guess { if value < 1 { @@ -683,7 +691,7 @@ impl Guess { } ``` -If we run the test from Listing 11-8, it will fail: +When we run the test in Listing 11-8, it will fail: ``` running 1 test @@ -694,15 +702,14 @@ failures: failures: tests::greater_than_100 -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -We don’t get a very helpful message in this case, but once we look at the test -function, we can see that it’s annotated with `#[should_panic]`. The failure we -got means that the code in the function, `Guess::new(200)`, did not cause a -panic. +We don’t get a very helpful message in this case, but when we look at the test +function, we see that it’s annotated with `#[should_panic]`. The failure we got +means that the code in the test function did not cause a panic. -`should_panic` tests can be imprecise, however, because they only tell us that +Tests that use `should_panic` can be imprecise because they only indicate that the code has caused some panic. A `should_panic` test would pass even if the test panics for a different reason than the one we were expecting to happen. To make `should_panic` tests more precise, we can add an optional `expected` @@ -714,9 +721,7 @@ different messages depending on whether the value was too small or too large: Filename: src/lib.rs ``` -struct Guess { - value: u32, -} +// --snip-- impl Guess { pub fn new(value: u32) -> Guess { @@ -749,14 +754,15 @@ mod tests { Listing 11-9: Testing that a condition will cause a `panic!` with a particular panic message -This test will pass, because the value we put in the `expected` parameter of -the `should_panic` attribute is a substring of the message that the -`Guess::new` function panics with. We could have specified the whole panic -message that we expect, which in this case would be `Guess value must be less -than or equal to 100, got 200.` It depends on how much of the panic message is -unique or dynamic and how precise you want your test to be. In this case, a -substring of the panic message is enough to ensure that the code in the -function that gets run is the `else if value > 100` case. +This test will pass because the value we put in the `should_panic` attribute’s +`expected` parameter is a substring of the message that the `Guess::new` +function panics with. We could have specified the entire panic message that we +expect, which in this case would be `Guess value must be less than or equal to +100, got 200.` What you choose to specify in the expected parameter for +`should_panic` depends on how much of the panic message is unique or dynamic +and how precise you want your test to be. In this case, a substring of the +panic message is enough to ensure that the code in the test function executes +the `else if value > 100` case. To see what happens when a `should_panic` test with an `expected` message fails, let’s again introduce a bug into our code by swapping the bodies of the @@ -779,8 +785,8 @@ test tests::greater_than_100 ... FAILED failures: ---- tests::greater_than_100 stdout ---- - thread 'tests::greater_than_100' panicked at 'Guess value must be greater - than or equal to 1, got 200.', src/lib.rs:10 + thread 'tests::greater_than_100' panicked at 'Guess value must be +greater than or equal to 1, got 200.', src/lib.rs:11:12 note: Run with `RUST_BACKTRACE=1` for a backtrace. note: Panic did not include expected string 'Guess value must be less than or equal to 100' @@ -788,81 +794,79 @@ equal to 100' failures: tests::greater_than_100 -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` The failure message indicates that this test did indeed panic as we expected, -but the panic message `did not include expected string 'Guess value must be -less than or equal to 100'`. We can see the panic message that we did get, -which in this case was `Guess value must be greater than or equal to 1, got -200.` We could then start figuring out where our bug was! +but the panic message did not include the expected string `'Guess value must be +less than or equal to 100'`. The panic message that we did get in this case was +`Guess value must be greater than or equal to 1, got 200.` Now we can start +figuring out where our bug is! -Now that we’ve gone over ways to write tests, let’s look at what is happening -when we run our tests and talk about the different options we can use with -`cargo test`. +Now that you know several ways to write tests, let’s look at what is happening +when we run our tests and explore the different options we can use with `cargo +test`. -## Controlling How Tests are Run +## Controlling How Tests Are Run Just as `cargo run` compiles your code and then runs the resulting binary, `cargo test` compiles your code in test mode and runs the resulting test -binary. There are options you can use to change the default behavior of `cargo -test`. For example, the default behavior of the binary produced by `cargo test` -is to run all the tests in parallel and capture output generated during test -runs, preventing it from being displayed to make it easier to read the output -related to the test results. You can change this default behavior by specifying -command line options. +binary. You can specify command line options to change the default behavior of +`cargo test`. For example, the default behavior of the binary produced by +`cargo test` is to run all the tests in parallel and capture output generated +during test runs, preventing the output from being displayed and making it +easier to read the output related to the test results. -Some command line options can be passed to `cargo test`, and some need to be -passed instead to the resulting test binary. To separate these two types of -arguments, you list the arguments that go to `cargo test`, then the separator -`--`, and then the arguments that go to the test binary. Running `cargo test ---help` will tell you about the options that go with `cargo test`, and running -`cargo test -- --help` will tell you about the options that go after the -separator `--`. +Some command line options go to `cargo test` and some go to the resulting test +binary. To separate these two types of arguments, you list the arguments that +go to `cargo test` followed by the separator `--` and then the arguments that +go to the test binary. Running `cargo test --help` displays the options you can +use with `cargo test`, and running `cargo test -- --help` displays the options +you can use after the separator `--`. ### Running Tests in Parallel or Consecutively -When multiple tests are run, by default they run in parallel using threads. -This means the tests will finish running faster, so that we can get faster -feedback on whether or not our code is working. Since the tests are running at -the same time, you should take care that your tests do not depend on each other -or on any shared state, including a shared environment such as the current -working directory or environment variables. +When you run multiple tests, by default they run in parallel using threads. +This means the tests will finish running faster so you can get feedback quicker +on whether or not your code is working. Because the tests are running at the +same time, make sure your tests don’t depend on each other or on any shared +state, including a shared environment, such as the current working directory or +environment variables. For example, say each of your tests runs some code that creates a file on disk -named `test-output.txt` and writes some data to that file. Then each test reads +named *test-output.txt* and writes some data to that file. Then each test reads the data in that file and asserts that the file contains a particular value, -which is different in each test. Because the tests are all run at the same -time, one test might overwrite the file between when another test writes and -reads the file. The second test will then fail, not because the code is -incorrect, but because the tests have interfered with each other while running -in parallel. One solution would be to make sure each test writes to a different -file; another solution is to run the tests one at a time. +which is different in each test. Because the tests run at the same time, one +test might overwrite the file between when another test writes and reads the +file. The second test will then fail, not because the code is incorrect, but +because the tests have interfered with each other while running in parallel. +One solution is to make sure each test writes to a different file; another +solution is to run the tests one at a time. -If you don’t want to run the tests in parallel, or if you want more -fine-grained control over the number of threads used, you can send the -`--test-threads` flag and the number of threads you want to use to the test -binary. For example: +If you don’t want to run the tests in parallel or if you want more fine-grained +control over the number of threads used, you can send the `--test-threads` flag +and the number of threads you want to use to the test binary. Take a look at +the following example: ``` $ cargo test -- --test-threads=1 ``` -We set the number of test threads to 1, telling the program not to use any -parallelism. This will take longer than running them in parallel, but the tests -won’t be potentially interfering with each other if they share state. +We set the number of test threads to `1`, telling the program not to use any +parallelism. Running the tests using one thread will take longer than running +them in parallel, but the tests won’t interfere with each other if they share +state. ### Showing Function Output By default, if a test passes, Rust’s test library captures anything printed to standard output. For example, if we call `println!` in a test and the test passes, we won’t see the `println!` output in the terminal: we’ll only see the -line that says the test passed. If a test fails, we’ll see whatever was printed -to standard output with the rest of the failure message. +line that indicates the test passed. If a test fails, we’ll see whatever was +printed to standard output with the rest of the failure message. -For example, Listing 11-10 has a silly function that prints out the value of -its parameter and then returns 10. We then have a test that passes and a test -that fails: +As an example, Listing 11-10 has a silly function that prints the value of its +parameter and returns 10, as well as a test that passes and a test that fails. Filename: src/lib.rs @@ -892,7 +896,7 @@ mod tests { Listing 11-10: Tests for a function that calls `println!` -The output we’ll see when we run these tests with `cargo test` is: +When we run these tests with `cargo test`, we’ll see the following output: ``` running 2 tests @@ -902,39 +906,41 @@ test tests::this_test_will_fail ... FAILED failures: ---- tests::this_test_will_fail stdout ---- - I got the value 8 -thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == -right)` (left: `5`, right: `10`)', src/lib.rs:19 + I got the value 8 +thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == right)` + left: `5`, + right: `10`', src/lib.rs:19:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::this_test_will_fail -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` Note that nowhere in this output do we see `I got the value 4`, which is what -gets printed when the test that passes runs. That output has been captured. The +is printed when the test that passes runs. That output has been captured. The output from the test that failed, `I got the value 8`, appears in the section -of the test summary output that also shows the cause of the test failure. +of the test summary output, which also shows the cause of the test failure. -If we want to be able to see printed values for passing tests as well, the -output capture behavior can be disabled by using the `--nocapture` flag: +If we want to see printed values for passing tests as well, we can disable the +output capture behavior by using the `--nocapture` flag: ``` $ cargo test -- --nocapture ``` -Running the tests from Listing 11-10 again with the `--nocapture` flag now -shows: +When we run the tests in Listing 11-10 again with the `--nocapture` flag, we +see the following output: ``` running 2 tests I got the value 4 I got the value 8 test tests::this_test_will_pass ... ok -thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == -right)` (left: `5`, right: `10`)', src/lib.rs:19 +thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == right)` + left: `5`, + right: `10`', src/lib.rs:19:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. test tests::this_test_will_fail ... FAILED @@ -943,13 +949,13 @@ failures: failures: tests::this_test_will_fail -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -Note that the output for the tests and the test results is interleaved; this is -because the tests are running in parallel as we talked about in the previous -section. Try using both the `--test-threads=1` option and the `--nocapture` -function and see what the output looks like then! +Note that the output for the tests and the test results are interleaved; the +reason is that the tests are running in parallel, as we talked about in the +previous section. Try using the `--test-threads=1` option and the `--nocapture` +flag, and see what the output looks like then! ### Running a Subset of Tests by Name @@ -959,7 +965,7 @@ that code. You can choose which tests to run by passing `cargo test` the name or names of the test(s) you want to run as an argument. To demonstrate how to run a subset of tests, we’ll create three tests for our -`add_two` function as shown in Listing 11-11 and choose which ones to run: +`add_two` function, as shown in Listing 11-11, and choose which ones to run: Filename: src/lib.rs @@ -989,10 +995,10 @@ mod tests { } ``` -Listing 11-11: Three tests with a variety of names +Listing 11-11: Three tests with three different names -If we run the tests without passing any arguments, as we’ve already seen, all -the tests will run in parallel: +If we run the tests without passing any arguments, as we saw earlier, all the +tests will run in parallel: ``` running 3 tests @@ -1000,7 +1006,7 @@ test tests::add_two_and_two ... ok test tests::add_three_and_two ... ok test tests::one_hundred ... ok -test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` #### Running Single Tests @@ -1015,17 +1021,21 @@ $ cargo test one_hundred running 1 test test tests::one_hundred ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out ``` -We can’t specify the names of multiple tests in this way, only the first value -given to `cargo test` will be used. +Only the test with the name `one_hundred` ran; the other two tests didn’t match +that name. The test output lets us know we had more tests than what this +command ran by displaying `2 filtered out` at the end of the summary line. + +We can’t specify the names of multiple tests in this way; only the first value +given to `cargo test` will be used. But there is a way to run multiple tests. #### Filtering to Run Multiple Tests -However, we can specify part of a test name, and any test whose name matches -that value will get run. For example, since two of our tests’ names contain -`add`, we can run those two by running `cargo test add`: +We can specify part of a test name, and any test whose name matches that value +will be run. For example, because two of our tests’ names contain `add`, we can +run those two by running `cargo test add`: ``` $ cargo test add @@ -1036,26 +1046,28 @@ running 2 tests test tests::add_two_and_two ... ok test tests::add_three_and_two ... ok -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out ``` -This ran all tests with `add` in the name. Also note that the module in which -tests appear becomes part of the test’s name, so we can run all the tests in a -module by filtering on the module’s name. +This command ran all tests with `add` in the name name and filtered out the +test named `one_hundred`. Also note that the module in which tests appear +becomes part of the test’s name, so we can run all the tests in a module by +filtering on the module’s name. -### Ignore Some Tests Unless Specifically Requested +### Ignoring Some Tests Unless Specifically Requested Sometimes a few specific tests can be very time-consuming to execute, so you might want to exclude them during most runs of `cargo test`. Rather than -listing as arguments all tests you do want to run, we can instead annotate the -time consuming tests with the `ignore` attribute to exclude them: +listing as arguments all tests you do want to run, you can instead annotate the +time-consuming tests using the `ignore` attribute to exclude them, as shown +here: Filename: src/lib.rs ``` #[test] fn it_works() { - assert!(true); + assert_eq!(2 + 2, 4); } #[test] @@ -1065,9 +1077,8 @@ fn expensive_test() { } ``` -We add the `#[ignore]` line to the test we want to exclude, after `#[test]`. -Now if we run our tests, we’ll see `it_works` runs, but `expensive_test` does -not: +After `#[test]` we add the `#[ignore]` line to the test we want to exclude. Now +when we run our tests, `it_works` runs, but `expensive_test` doesn’t: ``` $ cargo test @@ -1079,17 +1090,11 @@ running 2 tests test expensive_test ... ignored test it_works ... ok -test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured - - Doc-tests adder - -running 0 tests - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ``` -`expensive_test` is listed as `ignored`. If we want to run only the ignored -tests, we can ask for them to be run with `cargo test -- --ignored`: +The `expensive_test` function is listed as `ignored`. If we want to run only +the ignored tests, we can use `cargo test -- --ignored`: ``` $ cargo test -- --ignored @@ -1099,23 +1104,23 @@ $ cargo test -- --ignored running 1 test test expensive_test ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out ``` By controlling which tests run, you can make sure your `cargo test` results -will be fast. When you’re at a point that it makes sense to check the results -of the `ignored` tests and you have time to wait for the results, you can -choose to run `cargo test -- --ignored` instead. +will be fast. When you’re at a point where it makes sense to check the results +of the `ignored` tests and you have time to wait for the results, you can run +`cargo test -- --ignored` instead. ## Test Organization -As mentioned at the start of the chapter, testing is a large discipline, and +As mentioned at the start of the chapter, testing is a complex discipline, and different people use different terminology and organization. The Rust community -tends to think about tests in terms of two main categories: *unit tests* and -*integration tests*. Unit tests are smaller and more focused, testing one -module in isolation at a time, and can test private interfaces. Integration -tests are entirely external to your library, and use your code in the same way -any other external code would, using only the public interface and exercising +thinks about tests in terms of two main categories: *unit tests* and +*integration tests*. Unit tests are small and more focused, testing one module +in isolation at a time, and can test private interfaces. Integration tests are +entirely external to your library and use your code in the same way any other +external code would, using only the public interface and potentially exercising multiple modules per test. Writing both kinds of tests is important to ensure that the pieces of your @@ -1124,24 +1129,24 @@ library are doing what you expect them to separately and together. ### Unit Tests The purpose of unit tests is to test each unit of code in isolation from the -rest of the code, in order to be able to quickly pinpoint where code is and is -not working as expected. We put unit tests in the *src* directory, in each file -with the code that they’re testing. The convention is that we create a module -named `tests` in each file to contain the test functions, and we annotate the -module with `cfg(test)`. +rest of the code to quickly pinpoint where code is and isn’t working as +expected. We put unit tests in the *src* directory in each file with the code +that they’re testing. The convention is that we create a module named `tests` +in each file to contain the test functions, and we annotate the module with +`cfg(test)`. #### The Tests Module and `#[cfg(test)]` The `#[cfg(test)]` annotation on the tests module tells Rust to compile and run -the test code only when we run `cargo test`, and not when we run `cargo build`. -This saves compile time when we only want to build the library, and saves space -in the resulting compiled artifact since the tests are not included. We’ll see -that since integration tests go in a different directory, they don’t need the -`#[cfg(test)]` annotation. Because unit tests go in the same files as the code, -though, we use `#[cfg(test)]`to specify that they should not be included in the -compiled result. +the test code only when we run `cargo test`, but not when we run `cargo build`. +This saves compile time when we only want to build the library and saves space +in the resulting compiled artifact because the tests are not included. You’ll +see that because integration tests go in a different directory, they don’t need +the `#[cfg(test)]` annotation. However, because unit tests go in the same files +as the code, we use `#[cfg(test)]` to specify that they shouldn’t be included +in the compiled result. -Remember that when we generated the new `adder` project in the first section of +Recall that when we generated the new `adder` project in the first section of this chapter, Cargo generated this code for us: Filename: src/lib.rs @@ -1151,22 +1156,24 @@ Filename: src/lib.rs mod tests { #[test] fn it_works() { + assert_eq!(2 + 2, 4); } } ``` -This is the automatically generated test module. The attribute `cfg` stands for -*configuration*, and tells Rust that the following item should only be included -given a certain configuration option. In this case, the configuration option is -`test`, provided by Rust for compiling and running tests. By using this -attribute, Cargo only compiles our test code if we actively run the tests with -`cargo test`. This includes any helper functions that might be within this -module, in addition to the functions annotated with `#[test]`. +This code is the automatically generated test module. The attribute `cfg` +stands for *configuration* and tells Rust that the following item should only +be included given a certain configuration option. In this case, the +configuration option is `test`, which is provided by Rust for compiling and +running tests. By using the `cfg` attribute, Cargo compiles our test code only +if we actively run the tests with `cargo test`. This includes any helper +functions that might be within this module, in addition to the functions +annotated with `#[test]`. #### Testing Private Functions -There’s debate within the testing community about whether private functions -should be tested directly or not, and other languages make it difficult or +There’s debate within the testing community about whether or not private +functions should be tested directly, and other languages make it difficult or impossible to test private functions. Regardless of which testing ideology you adhere to, Rust’s privacy rules do allow you to test private functions. Consider the code in Listing 11-12 with the private function `internal_adder`: @@ -1206,22 +1213,21 @@ you to do so. In Rust, integration tests are entirely external to your library. They use your library in the same way any other code would, which means they can only call functions that are part of your library’s public API. Their purpose is to test -that many parts of your library work correctly together. Units of code that -work correctly by themselves could have problems when integrated, so test +that many parts of your library work together correctly. Units of code that +work correctly on their own could have problems when integrated, so test coverage of the integrated code is important as well. To create integration tests, you first need a *tests* directory. #### The *tests* Directory -To write integration tests for our code, we need to make a *tests* directory at -the top level of our project directory, next to *src*. Cargo knows to look for -integration test files in this directory. We can then make as many test files -as we’d like in this directory, and Cargo will compile each of the files as an -individual crate. +We create a *tests* directory at the top level of our project directory, next +to *src*. Cargo knows to look for integration test files in this directory. We +can then make as many test files as we want to in this directory, and Cargo +will compile each of the files as an individual crate. -Let’s give it a try! Keep the code from Listing 11-12 in *src/lib.rs*. Make a -*tests* directory, then make a new file named *tests/integration_test.rs*, and -enter the code in Listing 11-13. +Let’s create an integration test. With the code in Listing 11-12 still in the +*src/lib.rs* file, make a *tests* directory, create a new file named +*tests/integration_test.rs*, and enter the code in Listing 11-13: Filename: tests/integration_test.rs @@ -1236,19 +1242,16 @@ fn it_adds_two() { Listing 11-13: An integration test of a function in the `adder` crate -We’ve added `extern crate adder` at the top, which we didn’t need in the unit -tests. This is because each test in the `tests` directory is an entirely -separate crate, so we need to import our library into each of them. Integration -tests use the library like any other consumer of it would, by importing the -crate and using only the public API. +We’ve added `extern crate adder` at the top of the code, which we didn’t need +in the unit tests. The reason is that each test in the `tests` directory is a +separate crate, so we need to import our library into each of them. We don’t need to annotate any code in *tests/integration_test.rs* with -`#[cfg(test)]`. Cargo treats the `tests` directory specially and will only -compile files in this directory if we run `cargo test`. Let’s try running -`cargo test` now: +`#[cfg(test)]`. Cargo treats the `tests` directory specially and compiles files +in this directory only when we run `cargo test`. Run `cargo test` now: ``` -cargo test +$ cargo test Compiling adder v0.1.0 (file:///projects/adder) Finished dev [unoptimized + debuginfo] target(s) in 0.31 secs Running target/debug/deps/adder-abcabcabc @@ -1256,41 +1259,41 @@ cargo test running 1 test test tests::internal ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running target/debug/deps/integration_test-ce99bcc2479f4607 running 1 test test it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Doc-tests adder running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Now we have three sections of output: the unit tests, the integration test, and -the doc tests. The first section for the unit tests is the same as we have been -seeing: one line for each unit test (we have one named `internal` that we added -in Listing 11-12), then a summary line for the unit tests. +The three sections of output include the unit tests, the integration test, and +the doc tests. The first section for the unit tests is the same as we’ve been +seeing: one line for each unit test (one named `internal` that we added in +Listing 11-12) and then a summary line for the unit tests. -The integration tests section starts with the line that says `Running +The integration tests section starts with the line `Running target/debug/deps/integration-test-ce99bcc2479f4607` (the hash at the end of -your output will be different). Then there’s a line for each test function in -that integration test, and a summary line for the results of the integration +your output will be different). Next, there is a line for each test function in +that integration test and a summary line for the results of the integration test just before the `Doc-tests adder` section starts. -Note that adding more unit test functions in any *src* file will add more test +Recall that adding more unit test functions in any *src* file adds more test result lines to the unit tests section. Adding more test functions to the -integration test file we created will add more lines to the integration test -section. Each integration test file gets its own section, so if we add more -files in the *tests* directory, there will be more integration test sections. +integration test file we created adds more lines to that file’s section. Each +integration test file has its own section, so if we add more files in the +*tests* directory, there will be more integration test sections. We can still run a particular integration test function by specifying the test -function’s name as an argument to `cargo test`. To run all of the tests in a +function’s name as an argument to `cargo test`. To run all the tests in a particular integration test file, use the `--test` argument of `cargo test` followed by the name of the file: @@ -1302,31 +1305,31 @@ $ cargo test --test integration_test running 1 test test it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -This tests only the file that we specified from the *tests* directory. +This command runs only the tests in the *tests/integration_test.rs* file. #### Submodules in Integration Tests -As you add more integration tests, you may want to make more than one file in -the *tests* directory to help organize them; for example, to group the test -functions by the functionality they’re testing. As we mentioned, each file in -the *tests* directory is compiled as its own separate crate. +As you add more integration tests, you might want to make more than one file in +the *tests* directory to help organize them; for example, you can group the +test functions by the functionality they’re testing. As mentioned earlier, each +file in the *tests* directory is compiled as its own separate crate. Treating each integration test file as its own crate is useful to create separate scopes that are more like the way end users will be using your crate. However, this means files in the *tests* directory don’t share the same -behavior as files in *src* do that we learned about in Chapter 7 regarding how -to separate code into modules and files. +behavior as files in *src* do, which you learned in Chapter 7 regarding how to +separate code into modules and files. -The different behavior of files in the *tests* directory is usually most -noticeable if you have a set of helper functions that would be useful in -multiple integration test files, and you try to follow the steps from Chapter 7 -to extract them into a common module. For example, if we create -*tests/common.rs* and place this function named `setup` in it, where we could -put some code that we want to be able to call from multiple test functions in -multiple test files: +The different behavior of files in the *tests* directory is most noticeable +when you have a set of helper functions that would be useful in multiple +integration test files and you try to follow the steps in the “Moving Modules +to Other Files” section of Chapter 7 to extract them into a common module. For +example, if we create *tests/common.rs* and place a function named `setup` in +it, we can add some code to `setup` that we want to call from multiple test +functions in multiple test files: Filename: tests/common.rs @@ -1336,51 +1339,54 @@ pub fn setup() { } ``` -If we run the tests again, we’ll see a new section in the test output for the +When we run the tests again, we’ll see a new section in the test output for the *common.rs* file, even though this file doesn’t contain any test functions, nor -are we calling the `setup` function from anywhere: +did we call the `setup` function from anywhere: ``` running 1 test test tests::internal ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running target/debug/deps/common-b8b07b6f1be2db70 running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running target/debug/deps/integration_test-d993c68b431d39df running 1 test test it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Doc-tests adder running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Having `common` show up in the test results with `running 0 tests` displayed -for it is not what we wanted; we just wanted to be able to share some code with -the other integration test files. +Having `common` appear in the test results with `running 0 tests` displayed for +it is not what we wanted. We just wanted to share some code with the other +integration test files. -In order to not have `common` show up in the test output, we need to use the -other method of extracting code into a file that we learned about in Chapter 7: -instead of creating *tests/common.rs*, we’ll create *tests/common/mod.rs*. When -we move the `setup` function code into *tests/common/mod.rs* and get rid of the -*tests/common.rs* file, the section in the test output will no longer show up. -Files in subdirectories of the *tests* directory do not get compiled as -separate crates or have sections in the test output. +To avoid having `common` appear in the test output, instead of creating +*tests/common.rs*, we’ll create *tests/common/mod.rs*. In the “Rules of Module +Filesystems” section of Chapter 7, we used the naming convention +*module_name/mod.rs* for files of modules that have submodules, and we don’t +have submodules for `common` here, but naming the file this way tells Rust not +to treat the `common` module as an integration test file. When we move the +`setup` function code into *tests/common/mod.rs* and delete the +*tests/common.rs* file, the section in the test output will no longer appear. +Files in subdirectories of the *tests* directory don’t get compiled as separate +crates or have sections in the test output. -Once we have *tests/common/mod.rs*, we can use it from any of the integration -test files as a module. Here’s an example of calling the `setup` function from -the `it_adds_two` test in *tests/integration_test.rs*: +After we’ve created *tests/common/mod.rs*, we can use it from any of the +integration test files as a module. Here’s an example of calling the `setup` +function from the `it_adds_two` test in *tests/integration_test.rs*: Filename: tests/integration_test.rs @@ -1396,35 +1402,37 @@ fn it_adds_two() { } ``` -Note the `mod common;` declaration is the same as the module declarations we -did in Chapter 7. Then in the test function, we can call the `common::setup()` -function. +Note that the `mod common;` declaration is the same as the module declarations +we demonstrated in Listing 7-4. Then in the test function, we can call the +`common::setup()` function. #### Integration Tests for Binary Crates -If our project is a binary crate that only contains a *src/main.rs* and does -not have a *src/lib.rs*, we aren’t able to create integration tests in the -*tests* directory and use `extern crate` to import functions defined in -*src/main.rs*. Only library crates expose functions that other crates are able -to call and use; binary crates are meant to be run on their own. +If our project is a binary crate that only contains a *src/main.rs* file and +doesn’t have a *src/lib.rs* file, we can’t create integration tests in the +*tests* directory and use `extern crate` to import functions defined in the +*src/main.rs* file. Only library crates expose functions that other crates can +call and use; binary crates are meant to be run on their own. This is one of the reasons Rust projects that provide a binary have a -straightforward *src/main.rs* that calls logic that lives in *src/lib.rs*. With -that structure, integration tests *can* test the library crate by using `extern -crate` to cover the important functionality. If the important functionality -works, the small amount of code in *src/main.rs* will work as well, and that -small amount of code does not need to be tested. +straightforward *src/main.rs* file that calls logic that lives in the +*src/lib.rs* file. Using that structure, integration tests *can* test the +library crate by using `extern crate` to exercise the important functionality. +If the important functionality works, the small amount of code in the +*src/main.rs* file will work as well, and that small amount of code doesn’t +need to be tested. ## Summary Rust’s testing features provide a way to specify how code should function to ensure it continues to work as we expect even as we make changes. Unit tests exercise different parts of a library separately and can test private -implementation details. Integration tests cover the use of many parts of the -library working together, and they use the library’s public API to test the -code in the same way external code will use it. Even though Rust’s type system -and ownership rules help prevent some kinds of bugs, tests are still important -to help reduce logic bugs having to do with how your code is expected to behave. +implementation details. Integration tests check that many parts of the library +work together correctly, and they use the library’s public API to test the code +in the same way external code will use it. Even though Rust’s type system and +ownership rules help prevent some kinds of bugs, tests are still important to +help reduce logic bugs having to do with how your code is expected to behave. + +Let’s combine the knowledge you learned in this chapter and in previous +chapters and work on a project in the next chapter! -Let’s put together the knowledge from this chapter and other previous chapters -and work on a project in the next chapter! diff --git a/src/doc/book/second-edition/nostarch/chapter12.md b/src/doc/book/second-edition/nostarch/chapter12.md index 7c07ecb917..f1ce8c85de 100644 --- a/src/doc/book/second-edition/nostarch/chapter12.md +++ b/src/doc/book/second-edition/nostarch/chapter12.md @@ -3,37 +3,35 @@ # An I/O Project: Building a Command Line Program -This chapter is both a recap of the many skills you’ve learned so far and an -exploration of a few more standard library features. We’re going to build a -command line tool that interacts with file and command line input/output to -practice some of the Rust you now have under your belt. +This chapter is a recap of the many skills you’ve learned so far and an +exploration of a few more standard library features. We’ll build a command line +tool that interacts with file and command line input/output to practice some of +the Rust concepts you now have under your belt. Rust’s speed, safety, *single binary* output, and cross-platform support make -it a good language for creating command line tools, so for our project we’ll -make our own version of the classic command line tool `grep`. Grep is an -acronym for “**G**lobally search a **R**egular **E**xpression and **P**rint.” -In the simplest use case, `grep` searches a specified file for a specified -string. To do so, `grep` takes a filename and a string as its arguments, then -reads the file and finds lines in that file that contain the string argument. -It’ll then print out those lines. +it an ideal language for creating command line tools, so for our project, we’ll +make our own version of the classic command line tool `grep` (**g**lobally +search a **r**egular **e**xpression and **p**rint). In the simplest use case, +`grep` searches a specified file for a specified string. To do so, `grep` takes +as its arguments a filename and a string, and then reads the file and finds +lines in that file that contain the string argument. It then prints those lines. Along the way, we’ll show how to make our command line tool use features of the terminal that many command line tools use. We’ll read the value of an -environment variable in order to allow the user to configure the behavior of -our tool. We’ll print to the standard error console stream (`stderr`) instead -of standard output (`stdout`) so that, for example, the user can choose to -redirect successful output to a file while still seeing error messages on the -screen. +environment variable to allow the user to configure the behavior of our tool. +We’ll also print to the standard error console stream (`stderr`) instead of +standard output (`stdout`), so, for example, the user can redirect successful +output to a file while still seeing error messages onscreen. -One Rust community member, Andrew Gallant, has already created a -fully-featured, very fast version of `grep`, called `ripgrep`. By comparison, -our version of `grep` will be fairly simple, but this chapter will give you -some of the background knowledge to help you understand a real-world project -like `ripgrep`. +One Rust community member, Andrew Gallant, has already created a fully +featured, very fast version of `grep`, called `ripgrep`. By comparison, our +version of `grep` will be fairly simple, but this chapter will give you some of +the background knowledge you need to understand a real-world project like +`ripgrep`. -This project will bring together a number of concepts you’ve learned so far: +Our `grep` project will combine a number of concepts you’ve learned so far: -* Organizing code (using what we learned in modules, Chapter 7) +* Organizing code (using what you learned in modules, Chapter 7) * Using vectors and strings (collections, Chapter 8) * Handling errors (Chapter 9) * Using traits and lifetimes where appropriate (Chapter 10) @@ -44,9 +42,9 @@ Chapters 13 and 17 will cover in detail. ## Accepting Command Line Arguments -Let’s create a new project with, as always, `cargo new`. We’re calling our -project `minigrep` to distinguish from the `grep` tool that you may already -have on your system: +Let’s create a new project with, as always, `cargo new`. We’ll call our project +`minigrep` to distinguish it from the `grep` tool that you might already have +on your system. ``` $ cargo new --bin minigrep @@ -54,35 +52,33 @@ $ cargo new --bin minigrep $ cd minigrep ``` -Our first task is to make `minigrep` able to accept its two command line -arguments: the filename and a string to search for. That is, we want to be able -to run our program with `cargo run`, a string to search for, and a path to a -file to search in, like so: +The first task is to make `minigrep` accept its two command line arguments: the +filename and a string to search for. That is, we want to be able to run our +program with `cargo run`, a string to search for, and a path to a file to +search in, like so: ``` $ cargo run searchstring example-filename.txt ``` Right now, the program generated by `cargo new` cannot process arguments we -give it. There are some existing libraries on crates.io that can help us accept -command line arguments, but since you’re learning, let’s implement this -ourselves. +give it. However, some existing libraries on *https://crates.io/* can help +us with writing a program that accepts command line arguments, but because +you’re just learning this concept, let’s implement this capability ourselves. ### Reading the Argument Values -We first need to make sure our program is able to get the values of command -line arguments we pass to it, for which we’ll need a function provided in -Rust’s standard library: `std::env::args`. This function returns an *iterator* -of the command line arguments that were given to our program. We haven’t -discussed iterators yet, and we’ll cover them fully in Chapter 13, but for our -purposes now we only need to know two things about iterators: Iterators produce -a series of values, and we can call the `collect` function on an iterator to -turn it into a collection, such as a vector, containing all of the elements the -iterator produces. +To make sure `minigrep` is able to read the values of command line arguments we +pass to it, we’ll need a function provided in Rust’s standard library, which is +`std::env::args`. This function returns an *iterator* of the command line +arguments that were given to `minigrep`. We haven’t discussed iterators yet +(we’ll cover them fully in Chapter 13), but for now you only need to know two +details about iterators: iterators produce a series of values, and we can call +the `collect` function on an iterator to turn it into a collection, such as a +vector, containing all the elements the iterator produces. -Let’s give it a try: use the code in Listing 12-1 to allow your `minigrep` -program to read any command line arguments passed it and then collect the -values into a vector. +Use the code in Listing 12-1 to allow your `minigrep` program to read any +command line arguments passed to it and then collect the values into a vector: Filename: src/main.rs @@ -95,62 +91,64 @@ fn main() { } ``` -Listing 12-1: Collect the command line arguments into a vector and print them -out +Listing 12-1: Collecting the command line arguments into a vector and printing +them + +First, we bring the `std::env` module into scope with a `use` statement so we +can use its `args` function. Notice that the `std::env::args` function is +nested in two levels of modules. As we discussed in Chapter 7, in cases where +the desired function is nested in more than one module, it’s conventional to +bring the parent module into scope rather than the function. As a result, we +can easily use other functions from `std::env`. It’s also less ambiguous than +adding `use std::env::args` and then calling the function with just `args` +because `args` might easily be mistaken for a function that’s defined in the +current module. -First, we bring the `std::env` module into scope with a `use` statement so that -we can use its `args` function. Notice the `std::env::args` function is nested -in two levels of modules. As we talked about in Chapter 7, in cases where the -desired function is nested in more than one module, it’s conventional to bring -the parent module into scope, rather than the function itself. This lets us -easily use other functions from `std::env`. It’s also less ambiguous than -adding `use std::env::args;` then calling the function with just `args`; that -might easily be mistaken for a function that’s defined in the current module. > ### The `args` Function and Invalid Unicode > > Note that `std::env::args` will panic if any argument contains invalid -> Unicode. If you need to accept arguments containing invalid Unicode, use -> `std::env::args_os` instead. That function returns `OsString` values instead -> of `String` values. We’ve chosen to use `std::env::args` here for simplicity -> because `OsString` values differ per-platform and are more complex to work -> with than `String` values. +> Unicode. If your program needs to accept arguments containing invalid +> Unicode, use `std::env::args_os` instead. That function returns `OsString` +> values instead of `String` values. We’ve chosen to use `std::env::args` here +> for simplicity because `OsString` values differ per platform and are more +> complex to work with than `String` values. On the first line of `main`, we call `env::args`, and immediately use `collect` -to turn the iterator into a vector containing all of the values produced by the -iterator. The `collect` function can be used to create many kinds of +to turn the iterator into a vector containing all the values produced by the +iterator. We can use the `collect` function to create many kinds of collections, so we explicitly annotate the type of `args` to specify that we -want a vector of strings. Though we very rarely need to annotate types in Rust, -`collect` is one function you do often need to annotate because Rust isn’t able -to infer what kind of collection you want. +want a vector of strings. Although we very rarely need to annotate types in +Rust, `collect` is one function you do often need to annotate because Rust +isn’t able to infer the kind of collection you want. -Finally, we print out the vector with the debug formatter, `:?`. Let’s try -running our code with no arguments, and then with two arguments: +Finally, we print the vector using the debug formatter, `:?`. Let’s try running +the code with no arguments, and then with two arguments: ``` $ cargo run +--snip-- ["target/debug/minigrep"] $ cargo run needle haystack -...snip... +--snip-- ["target/debug/minigrep", "needle", "haystack"] ``` -You may notice that the first value in the vector is `"target/debug/minigrep"`, -which is the name of our binary. This matches the behavior of the arguments -list in C, and lets programs use the name by which they were invoked in their -execution. It’s convenient to have access to the program name in case we want -to print it in messages or change behavior of the program based on what command -line alias was used to invoke the program, but for the purposes of this chapter -we’re going to ignore it and only save the two arguments we need. +Notice that the first value in the vector is `"target/debug/minigrep"`, which +is the name of our binary. This matches the behavior of the arguments list in +C, letting programs use the name by which they were invoked in their execution. +It’s often convenient to have access to the program name in case we want to +print it in messages or change behavior of the program based on what command +line alias was used to invoke the program. But for the purposes of this +chapter, we’ll ignore it and save only the two arguments we need. ### Saving the Argument Values in Variables -Printing out the value of the vector of arguments has illustrated that the -program is able to access the values specified as command line arguments. Now -we need to save the values of the two arguments in variables so that we can use -the values throughout the rest of the program. Let’s do that as shown in -Listing 12-2: +Printing the value of the vector of arguments illustrated that the program is +able to access the values specified as command line arguments. Now we need to +save the values of the two arguments in variables so we can use the values +throughout the rest of the program. We do that in Listing 12-2: Filename: src/main.rs @@ -168,42 +166,44 @@ fn main() { } ``` -Listing 12-2: Create variables to hold the query argument and filename argument +Listing 12-2: Creating variables to hold the query argument and filename +argument -As we saw when we printed out the vector, the program’s name takes up the first -value in the vector at `args[0]`, so that we’re starting at index `1`. The -first argument `minigrep` takes is the string we’re searching for, so we put a +As we saw when we printed the vector, the program’s name takes up the first +value in the vector at `args[0]`, so we’re starting at index `1`. The first +argument `minigrep` takes is the string we’re searching for, so we put a reference to the first argument in the variable `query`. The second argument will be the filename, so we put a reference to the second argument in the variable `filename`. -We’re temporarily printing out the values of these variables, again to prove to -ourselves that our code is working as we intend. Let’s try running this program -again with the arguments `test` and `sample.txt`: +We temporarily print the values of these variables to prove that the code is +working as we intend. Let’s run this program again with the arguments `test` +and `sample.txt`: ``` $ cargo run test sample.txt + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep test sample.txt` Searching for test In file sample.txt ``` -Great, it’s working! The values of the arguments we need are being saved into -the right variables. Later we’ll add some error handling to deal with certain -potential erroneous situations, such as when the user provides no arguments, -but for now we’ll ignore that and work on adding file reading capabilities -instead. +Great, the program is working! The values of the arguments we need are being +saved into the right variables. Later we’ll add some error handling to deal +with certain potential erroneous situations, such as when the user provides no +arguments; for now, we’ll ignore that situation and work on adding file reading +capabilities instead. ## Reading a File -Next, we’re going to add functionality to read the file that specified in the -`filename` command line argument. First, we need a sample file to test it -with—the best kind of file to use to make sure that `minigrep` is working is -one with a small amount of text over multiple lines with some repeated words. -Listing 12-3 has an Emily Dickinson poem that will work well! Create a file -called `poem.txt` at the root level of your project, and enter the poem “I’m -nobody! Who are you?”: +Now we’ll add functionality to read the file that is specified in the +`filename` command line argument. First, we need a sample file to test it with: +the best kind of file to use to make sure `minigrep` is working is one with a +small amount of text over multiple lines with some repeated words. Listing 12-3 +has an Emily Dickinson poem that will work well! Create a file called +*poem.txt* at the root level of your project, and enter the poem “I’m Nobody! +Who are you?” Filename: poem.txt @@ -219,11 +219,10 @@ To tell your name the livelong day To an admiring bog! ``` -Listing 12-3: The poem “I’m nobody! Who are you?” by Emily Dickinson that will -make a good test case +Listing 12-3: A poem by Emily Dickinson will make a good test case. -With that in place, edit *src/main.rs* and add code to open the file as shown -in Listing 12-4: +With the text in place, edit *src/main.rs* and add code to open the file, as +shown in Listing 12-4: Filename: src/main.rs @@ -233,7 +232,7 @@ use std::fs::File; use std::io::prelude::*; fn main() { - // ...snip... + // --snip-- println!("In file {}", filename); let mut f = File::open(filename).expect("file not found"); @@ -249,30 +248,32 @@ fn main() { Listing 12-4: Reading the contents of the file specified by the second argument First, we add some more `use` statements to bring in relevant parts of the -standard library: we need `std::fs::File` for dealing with files, and -`std::io::prelude::*` contains various traits that are useful when doing I/O, -including file I/O. In the same way that Rust has a general prelude that brings -certain things into scope automatically, the `std::io` module has its own -prelude of common things you’ll need when working with I/O. Unlike the default -prelude, we must explicitly `use` the prelude from `std::io`. +standard library: we need `std::fs::File` to handle files, and +`std::io::prelude::*` contains various useful traits for doing I/O, including +file I/O. In the same way that Rust has a general prelude that brings certain +types and functions into scope automatically, the `std::io` module has its own +prelude of common types and functions you’ll need when working with I/O. Unlike +the default prelude, we must explicitly add a `use` statement for the prelude +from `std::io`. -In `main`, we’ve added three things: first, we get a mutable handle to the file -by calling the `File::open` function and passing it the value of the `filename` -variable. Second, we create a variable called `contents` and set it to a -mutable, empty `String`. This will hold the content of the file after we read -it in. Third, we call `read_to_string` on our file handle and pass a mutable -reference to `contents` as an argument. +In `main`, we’ve added three statements: first, we get a mutable handle to the +file by calling the `File::open` function and passing it the value of the +`filename` variable. Second, we create a variable called `contents` and set it +to a mutable, empty `String`. This will hold the content of the file after we +read it in. Third, we call `read_to_string` on our file handle and pass a +mutable reference to `contents` as an argument. After those lines, we’ve again added a temporary `println!` statement that -prints out the value of `contents` after the file is read, so that we can check -that our program is working so far. +prints the value of `contents` after the file is read, so we can check that the +program is working so far. -Let’s try running this code with any string as the first command line argument -(since we haven’t implemented the searching part yet) and our *poem.txt* file -as the second argument: +Let’s run this code with any string as the first command line argument (because +we haven’t implemented the searching part yet) and the *poem.txt* file as the +second argument: ``` $ cargo run the poem.txt + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep the poem.txt` Searching for the @@ -289,88 +290,86 @@ To tell your name the livelong day To an admiring bog! ``` -Great! Our code read in and printed out the content of the file. We’ve got a -few flaws though. The `main` function has multiple responsibilities; generally +Great! The code read and then printed the content of the file. But the code has +a few flaws. The `main` function has multiple responsibilities: generally, functions are clearer and easier to maintain if each function is responsible for only one idea. The other problem is that we’re not handling errors as well -as we could be. While our program is still small, these flaws aren’t a big -problem, but as our program grows, it will be harder to fix them cleanly. It’s -good practice to begin refactoring early on when developing a program, as it’s -much easier to refactor smaller amounts of code, so we’ll do that now. +as we could be. The program is still small so these flaws aren’t a big problem, +but as the program grows, it will be harder to fix them cleanly. It’s good +practice to begin refactoring early on when developing a program, because it’s +much easier to refactor smaller amounts of code. We’ll do that next. ## Refactoring to Improve Modularity and Error Handling -There are four problems that we’d like to fix to improve our program, and they -have to do with the way the program is structured and how it’s handling -potential errors. +To improve our program, we’ll fix four problems that have to do with the +program’s structure and how it’s handling potential errors. First, our `main` function now performs two tasks: it parses arguments and -opens up files. For such a small function, this isn’t a huge problem. However, -if we keep growing our program inside of `main`, the number of separate tasks -the `main` function handles will grow. As a function gains responsibilities, it -gets harder to reason about, harder to test, and harder to change without -breaking one of its parts. It’s better to separate out functionality so that -each function is responsible for one task. +opens files. For such a small function, this isn’t a major problem. However, if +we continue to grow our program inside `main`, the number of separate tasks the +`main` function handles will increase. As a function gains responsibilities, it +becomes more difficult to reason about, harder to test, and harder to change +without breaking one of its parts. It’s best to separate functionality so each +function is responsible for one task. -This also ties into our second problem: while `query` and `filename` are -configuration variables to our program, variables like `f` and `contents` are -used to perform our program’s logic. The longer `main` gets, the more variables -we’re going to need to bring into scope; the more variables we have in scope, -the harder it is to keep track of the purpose of each. It’s better to group the -configuration variables into one structure to make their purpose clear. +This issue also ties into the second problem: although `query` and `filename` +are configuration variables to our program, variables like `f` and `contents` +are used to perform the program’s logic. The longer `main` becomes, the more +variables we’ll need to bring into scope; the more variables we have in scope, +the harder it will be to keep track of the purpose of each. It’s best to group +the configuration variables into one structure to make their purpose clear. -The third problem is that we’ve used `expect` to print out an error message -when opening the file fails, but the error message only says `file not found`. -There are a number of ways that opening a file can fail besides the file being -missing: for example, the file might exist, but we might not have permission to -open it. Right now, if we’re in that situation, we’d print the `file not found` -error message that would give the user the wrong advice! +The third problem is that we’ve used `expect` to print an error message when +opening the file fails, but the error message just prints `file not found`. +Opening a file can fail in a number of ways besides the file being missing: for +example, the file might exist, but we might not have permission to open it. +Right now, if we’re in that situation, we’d print the `file not found` error +message that would give the user the wrong information! -Fourth, we use `expect` repeatedly to deal with different errors, and if the -user runs our programs without specifying enough arguments, they’ll get an -“index out of bounds” error from Rust that doesn’t clearly explain the problem. -It would be better if all our error handling code was in one place so that -future maintainers only have one place to consult in the code if the error -handling logic needs to change. Having all the error handling code in one place -will also help us to ensure that we’re printing messages that will be -meaningful to our end users. +Fourth, we use `expect` repeatedly to handle different errors, and if the user +runs our program without specifying enough arguments, they’ll get an `index out +of bounds` error from Rust that doesn’t clearly explain the problem. It would +be best if all the error handling code was in one place so future maintainers +have only one place to consult in the code if the error handling logic needs to +change. Having all the error handling code in one place will also ensure that +we’re printing messages that will be meaningful to our end users. -Let’s address these problems by refactoring our project. +Let’s address these four problems by refactoring our project. ### Separation of Concerns for Binary Projects The organizational problem of allocating responsibility for multiple tasks to -the `main` function responsible is common to many binary projects, so the Rust -community has developed a kind of guideline process for splitting up the -separate concerns of a binary program when `main` starts getting large. The -process has the following steps: +the `main` function is common to many binary projects. As a result, the Rust +community has developed a type of guideline process for splitting the separate +concerns of a binary program when `main` starts getting large. The process has +the following steps: -* Split your program into both a *main.rs* and a *lib.rs* and move your -program’s logic into *lib.rs*. +* Split your program into a *main.rs* and a *lib.rs*, and move your program’s +logic to *lib.rs*. * While your command line parsing logic is small, it can remain in *main.rs*. * When the command line parsing logic starts getting complicated, extract it -from *main.rs* into *lib.rs* as well. +from *main.rs* and move it to *lib.rs*. * The responsibilities that remain in the `main` function after this process should be limited to: + * Calling the command line parsing logic with the argument values * Setting up any other configuration * Calling a `run` function in *lib.rs* - * If `run` returns an error, handling that error + * Handling the error if `run` returns an error -This pattern is all about separating concerns: *main.rs* handles running the -program, and *lib.rs* handles all of the logic of the task at hand. Because we +This pattern is about separating concerns: *main.rs* handles running the +program, and *lib.rs* handles all the logic of the task at hand. Because we can’t test the `main` function directly, this structure lets us test all of our program’s logic by moving it into functions in *lib.rs*. The only code that remains in *main.rs* will be small enough to verify its correctness by reading -it. Let’s re-work our program by following this process. +it. Let’s rework our program by following this process. #### Extracting the Argument Parser -First, we’ll extract the functionality for parsing arguments into a function -that `main` will call to prepare for moving the command line parsing logic to +We’ll extract the functionality for parsing arguments into a function that +`main` will call to prepare for moving the command line parsing logic to *src/lib.rs*. Listing 12-5 shows the new start of `main` that calls a new -function `parse_config`, which we’re still going to define in *src/main.rs* for -the moment: +function `parse_config`, which we’ll define in *src/main.rs* for the moment. Filename: src/main.rs @@ -380,7 +379,7 @@ fn main() { let (query, filename) = parse_config(&args); - // ...snip... + // --snip-- } fn parse_config(args: &[String]) -> (&str, &str) { @@ -391,46 +390,47 @@ fn parse_config(args: &[String]) -> (&str, &str) { } ``` -Listing 12-5: Extract a `parse_config` function from `main` +Listing 12-5: Extracting a `parse_config` function from `main` We’re still collecting the command line arguments into a vector, but instead of assigning the argument value at index `1` to the variable `query` and the argument value at index `2` to the variable `filename` within the `main` function, we pass the whole vector to the `parse_config` function. The `parse_config` function then holds the logic that determines which argument -goes in which variable, and passes the values back to `main`. We still create +goes in which variable and passes the values back to `main`. We still create the `query` and `filename` variables in `main`, but `main` no longer has the responsibility of determining how the command line arguments and variables correspond. -This may seem like overkill for our small program, but we’re refactoring in -small, incremental steps. After making this change, run the program again to +This rework may seem like overkill for our small program, but we’re refactoring +in small, incremental steps. After making this change, run the program again to verify that the argument parsing still works. It’s good to check your progress -often, as that will help you identify the cause of problems when they occur. +often, because that will help you identify the cause of problems when they +occur. #### Grouping Configuration Values -We can take another small step to improve this function further. At the moment, -we’re returning a tuple, but then we immediately break that tuple up into -individual parts again. This is a sign that perhaps we don’t have the right -abstraction yet. +We can take another small step to improve the `parse_config` function further. +At the moment, we’re returning a tuple, but then we immediately break that +tuple into individual parts again. This is a sign that perhaps we don’t have +the right abstraction yet. -Another indicator that there’s room for improvement is the `config` part of -`parse_config`, which implies that the two values we return are related and are -both part of one configuration value. We’re not currently conveying this +Another indicator that shows there’s room for improvement is the `config` part +of `parse_config`, which implies that the two values we return are related and +are both part of one configuration value. We’re not currently conveying this meaning in the structure of the data other than grouping the two values into a tuple: we could put the two values into one struct and give each of the struct -fields a meaningful name. This will make it easier for future maintainers of -this code to understand how the different values relate to each other and what -their purpose is. +fields a meaningful name. Doing so will make it easier for future maintainers +of this code to understand how the different values relate to each other and +what their purpose is. -> Note: some people call this anti-pattern of using primitive values when a +> Note: Some people call this anti-pattern of using primitive values when a > complex type would be more appropriate *primitive obsession*. Listing 12-6 shows the addition of a struct named `Config` defined to have fields named `query` and `filename`. We’ve also changed the `parse_config` -function to return an instance of the `Config` struct, and updated `main` to -use the struct fields rather than having separate variables: +function to return an instance of the `Config` struct and updated `main` to use +the struct fields rather than having separate variables: Filename: src/main.rs @@ -445,7 +445,7 @@ fn main() { let mut f = File::open(config.filename).expect("file not found"); - // ...snip... + // --snip-- } struct Config { @@ -466,39 +466,39 @@ struct The signature of `parse_config` now indicates that it returns a `Config` value. In the body of `parse_config`, where we used to return string slices that -reference `String` values in `args`, we’ve now chosen to define `Config` to -contain owned `String` values. The `args` variable in `main` is the owner of -the argument values and is only letting the `parse_config` function borrow -them, though, which means we’d violate Rust’s borrowing rules if `Config` tried -to take ownership of the values in `args`. +reference `String` values in `args`, we now define `Config` to contain owned +`String` values. The `args` variable in `main` is the owner of the argument +values and is only letting the `parse_config` function borrow them, which means +we’d violate Rust’s borrowing rules if `Config` tried to take ownership of the +values in `args`. -There are a number of different ways we could manage the `String` data, and the +We could manage the `String` data in a number of different ways, but the easiest, though somewhat inefficient, route is to call the `clone` method on the values. This will make a full copy of the data for the `Config` instance to -own, which does take more time and memory than storing a reference to the -string data. However, cloning the data also makes our code very straightforward -since we don’t have to manage the lifetimes of the references, so in this -circumstance giving up a little performance to gain simplicity is a worthwhile +own, which takes more time and memory than storing a reference to the string +data. However, cloning the data also makes our code very straightforward +because we don’t have to manage the lifetimes of the references; in this +circumstance, giving up a little performance to gain simplicity is a worthwhile trade-off. -> ### The Tradeoffs of Using `clone` +> ### The Trade-Offs of Using `clone` > > There’s a tendency among many Rustaceans to avoid using `clone` to fix -> ownership problems because of its runtime cost. In Chapter 13 on iterators, -> you’ll learn how to use more efficient methods in this kind of situation, but -> for now, it’s okay to copy a few strings to keep making progress since we’ll -> only make these copies once, and our filename and query string are both very -> small. It’s better to have a working program that’s a bit inefficient than try -> to hyper-optimize code on your first pass. As you get more experienced with -> Rust, it’ll be easier to go straight to the desirable method, but for now it’s -> perfectly acceptable to call `clone`. +> ownership problems because of its runtime cost. In Chapter 13, you’ll learn +> how to use more efficient methods in this type of situation. But for now, +> it’s okay to copy a few strings to continue making progress because we’ll +> make these copies only once, and our filename and query string are very +> small. It’s better to have a working program that’s a bit inefficient than to +> try to hyperoptimize code on your first pass. As you become more experienced +> with Rust, it’ll be easier to start with the desirable solution, but for now, +> it’s perfectly acceptable to call `clone`. -We’ve updated `main` so that it places the instance of `Config` returned by -`parse_config` into a variable named `config`, and updated the code that -previously used the separate `query` and `filename` variables so that it now -uses the fields on the `Config` struct instead. +We’ve updated `main` so it places the instance of `Config` returned by +`parse_config` into a variable named `config`, and we updated the code that +previously used the separate `query` and `filename` variables so it now uses +the fields on the `Config` struct instead. -Our code now more clearly conveys that `query` and `filename` are related and +Now our code more clearly conveys that `query` and `filename` are related, and their purpose is to configure how the program will work. Any code that uses these values knows to find them in the `config` instance in the fields named for their purpose. @@ -506,20 +506,20 @@ for their purpose. #### Creating a Constructor for `Config` So far, we’ve extracted the logic responsible for parsing the command line -arguments from `main` into the `parse_config` function, which helped us to see -that the `query` and `filename` values were related and that relationship -should be conveyed in our code. We then added a `Config` struct to name the -related purpose of `query` and `filename`, and to be able to return the values’ -names as struct field names from the `parse_config` function. +arguments from `main` and placed it in the `parse_config` function, which +helped us to see that the `query` and `filename` values were related and that +relationship should be conveyed in our code. We then added a `Config` struct to +name the related purpose of `query` and `filename`, and to be able to return +the values’ names as struct field names from the `parse_config` function. So now that the purpose of the `parse_config` function is to create a `Config` -instance, we can change `parse_config` from being a plain function into a +instance, we can change `parse_config` from being a plain function to a function named `new` that is associated with the `Config` struct. Making this -change will make our code more idiomatic: we can create instances of types in -the standard library like `String` by calling `String::new`, and by changing -`parse_config` into a `new` function associated with `Config`, we’ll be able to -create instances of `Config` by calling `Config::new`. Listing 12-7 shows the -changes we’ll need to make: +change will make the code more idiomatic: we can create instances of types in +the standard library, such as `String`, by calling `String::new`, and by +changing `parse_config` into a `new` function associated with `Config`, we’ll +be able to create instances of `Config` by calling `Config::new`. Listing 12-7 +shows the changes we need to make: Filename: src/main.rs @@ -529,10 +529,10 @@ fn main() { let config = Config::new(&args); - // ...snip... + // --snip-- } -// ...snip... +// --snip-- impl Config { fn new(args: &[String]) -> Config { @@ -548,88 +548,91 @@ Listing 12-7: Changing `parse_config` into `Config::new` We’ve updated `main` where we were calling `parse_config` to instead call `Config::new`. We’ve changed the name of `parse_config` to `new` and moved it -within an `impl` block, which makes the `new` function associated with -`Config`. Try compiling this again to make sure it works. +within an `impl` block, which associates the `new` function with `Config`. Try +compiling this code again to make sure it works. ### Fixing the Error Handling -Now we’ll work on fixing our error handling. Recall that we mentioned that -attempting to access the values in the `args` vector at index `1` or index `2` -will cause the program to panic if the vector contains fewer than 3 items. Try -running the program without any arguments; it will look like this: +Now we’ll work on fixing our error handling. Recall that attempting to access +the values in the `args` vector at index `1` or index `2` will cause the +program to panic if the vector contains fewer than three items. Try running the +program without any arguments; it will look like this: ``` $ cargo run + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep` thread 'main' panicked at 'index out of bounds: the len is 1 -but the index is 1', /stable-dist-rustc/build/src/libcollections/vec.rs:1307 +but the index is 1', src/main.rs:29:21 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` -The line that states `index out of bounds: the len is 1 but the index is 1` is -an error message intended for programmers, and won’t really help our end users -understand what happened and what they should do instead. Let’s fix that now. +The line `index out of bounds: the len is 1 but the index is 1` is an error +message intended for programmers. It won’t help our end users understand what +happened and what they should do instead. Let’s fix that now. #### Improving the Error Message -In Listing 12-8, we’re adding a check in the `new` function that will check -that the slice is long enough before accessing index `1` and `2`. If the slice -isn’t long enough, the program panics, with a better error message than the +In Listing 12-8, we add a check in the `new` function that will verify that the +slice is long enough before accessing index `1` and `2`. If the slice isn’t +long enough, the program panics and displays a better error message than the `index out of bounds` message: Filename: src/main.rs ``` -// ...snip... +// --snip-- fn new(args: &[String]) -> Config { if args.len() < 3 { panic!("not enough arguments"); } - // ...snip... + // --snip-- ``` Listing 12-8: Adding a check for the number of arguments -This is similar to the `Guess::new` function we wrote in Listing 9-8, where -`panic!` was called when the `value` argument was out of the range of valid +This code is similar to the `Guess::new` function we wrote in Listing 9-9 where +we called `panic!` when the `value` argument was out of the range of valid values. Instead of checking for a range of values here, we’re checking that the -length of `args` is at least 3, and the rest of the function can operate under -the assumption that this condition has been met. If `args` has fewer than 3 +length of `args` is at least `3` and the rest of the function can operate under +the assumption that this condition has been met. If `args` has fewer than three items, this condition will be true, and we call the `panic!` macro to end the program immediately. -With these extra few lines of code in `new`, let’s try running our program -without any arguments again and see what the error looks like now: +With these extra few lines of code in `new`, let’s run the program without any +arguments again to see what the error looks like now: ``` $ cargo run + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep` -thread 'main' panicked at 'not enough arguments', src/main.rs:29 +thread 'main' panicked at 'not enough arguments', src/main.rs:30:12 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` -This output is better, we now have a reasonable error message. However, we also -have a bunch of extra information we don’t want to give to our users. So -perhaps using the technique we used in Listing 9-8 isn’t the best to use here; -a call to `panic!` is more appropriate for a programming problem rather than a -usage problem, as we discussed in Chapter 9. Instead, we can use the other -technique you also learned about in Chapter 9: returning a `Result` that can -indicate either success or an error. +This output is better: we now have a reasonable error message. However, we also +have extraneous information we don’t want to give to our users. Perhaps using +the technique we used in Listing 9-9 isn’t the best to use here: a call to +`panic!` is more appropriate for a programming problem rather than a usage +problem, as discussed in Chapter 9. Instead, we can use the other technique you +learned about in Chapter 9—returning a `Result` that indicates either success +or an error. #### Returning a `Result` from `new` Instead of Calling `panic!` -We can choose to instead return a `Result` value that will contain a `Config` -instance in the successful case, and will describe the problem in the error -case. When `Config::new` is communicating to `main`, we can use the `Result` -type to signal that there was a problem. Then we can change `main` to convert -an `Err` variant into a more practical error for our users, without the -surrounding text about `thread 'main'` and `RUST_BACKTRACE` that a call to -`panic!` causes. +We can instead return a `Result` value that will contain a `Config` instance in +the successful case and will describe the problem in the error case. When +`Config::new` is communicating to `main`, we can use the `Result` type to +signal there was a problem. Then we can change `main` to convert an `Err` +variant into a more practical error for our users without the surrounding text +about `thread 'main'` and `RUST_BACKTRACE` that a call to `panic!` causes. -Listing 12-9 shows the changes you need to make to the return value of -`Config::new` and the body of the function needed to return a `Result`: +Listing 12-9 shows the changes we need to make to the return value of +`Config::new` and the body of the function needed to return a `Result`. Note +that this won’t compile until we update `main` as well, which we’ll do in the +next listing: Filename: src/main.rs @@ -648,9 +651,9 @@ impl Config { } ``` -Listing 12-9: Return a `Result` from `Config::new` +Listing 12-9: Returning a `Result` from `Config::new` -Our `new` function now returns a `Result`, with a `Config` instance in the +Our `new` function now returns a `Result` with a `Config` instance in the success case and a `&'static str` in the error case. Recall from “The Static Lifetime” section in Chapter 10 that `&'static str` is the type of string literals, which is our error message type for now. @@ -666,12 +669,12 @@ more cleanly in the error case. #### Calling `Config::new` and Handling Errors -In order to handle the error case and print a user-friendly message, we need to -update `main` to handle the `Result` being returned by `Config::new`, as shown -in Listing 12-10. We’re also going to take the responsibility of exiting the -command line tool with a nonzero error code from `panic!` and implement it by -hand. A nonzero exit status is a convention to signal to the process that -called our program that our program exited with an error state. +To handle the error case and print a user-friendly message, we need to update +`main` to handle the `Result` being returned by `Config::new`, as shown in +Listing 12-10. We’ll also take the responsibility of exiting the command line +tool with a nonzero error code from `panic!` and implement it by hand. A +nonzero exit status is a convention to signal to the process that called our +program that the program exited with an error state. Filename: src/main.rs @@ -686,27 +689,27 @@ fn main() { process::exit(1); }); - // ...snip... + // --snip-- ``` Listing 12-10: Exiting with an error code if creating a new `Config` fails -In this listing, we’re using a method we haven’t covered before: +In this listing, we’ve used a method we haven’t covered before: `unwrap_or_else`, which is defined on `Result` by the standard library. Using `unwrap_or_else` allows us to define some custom, non-`panic!` error handling. If the `Result` is an `Ok` value, this method’s behavior is similar to `unwrap`: it returns the inner value `Ok` is wrapping. However, if the value is an `Err` value, this method calls the code in the *closure*, which is an anonymous function we define and pass as an argument to `unwrap_or_else`. We’ll -be covering closures in more detail in Chapter 13. What you need to know for -now is that `unwrap_or_else` will pass the inner value of the `Err`, which in -this case is the static string `not enough arguments` that we added in Listing -12-9, to our closure in the argument `err` that appears between the vertical -pipes. The code in the closure can then use the `err` value when it runs. +cover closures in more detail in Chapter 13. For now, you just need to know +that `unwrap_or_else` will pass the inner value of the `Err`, which in this +case is the static string `not enough arguments` that we added in Listing 12-9, +to our closure in the argument `err` that appears between the vertical pipes. +The code in the closure can then use the `err` value when it runs. We’ve added a new `use` line to import `process` from the standard library. The -code in the closure that will get run in the error case is only two lines: we -print out the `err` value, then call `process::exit`. The `process::exit` +code in the closure that will be run in the error case is only two lines: we +print the `err` value and then call `process::exit`. The `process::exit` function will stop the program immediately and return the number that was passed as the exit status code. This is similar to the `panic!`-based handling we used in Listing 12-8, but we no longer get all the extra output. Let’s try @@ -724,15 +727,15 @@ Great! This output is much friendlier for our users. ### Extracting Logic from `main` -Now we’re done refactoring our configuration parsing; let’s turn to our -program’s logic. As we laid out in the “Separation of Concerns for Binary -Projects” section, we’re going to extract a function named `run` that will hold -all of the logic currently in the `main` function not involved with setting up -configuration or handling errors. Once we’re done, `main` will be concise and -easy to verify by inspection, and we’ll be able to write tests for all of the +Now that we’ve finished refactoring the configuration parsing, let’s turn to +the program’s logic. As we stated in “Separation of Concerns for Binary +Projects” on page XX, we’ll extract a function named `run` that will hold all +the logic currently in the `main` function that isn’t involved with setting up +configuration or handling errors. When we’re done, `main` will be concise and +easy to verify by inspection, and we’ll be able to write tests for all the other logic. -Listing 12-11 shows the extracted `run` function. For now, we’re making only +Listing 12-11 shows the extracted `run` function. For now, we’re just making the small, incremental improvement of extracting the function. We’re still defining the function in *src/main.rs*: @@ -740,7 +743,7 @@ Filename: src/main.rs ``` fn main() { - // ...snip... + // --snip-- println!("Searching for {}", config.query); println!("In file {}", config.filename); @@ -758,24 +761,24 @@ fn run(config: Config) { println!("With text:\n{}", contents); } -// ...snip... +// --snip-- ``` Listing 12-11: Extracting a `run` function containing the rest of the program logic -The `run` function now contains all the remaining logic from `main` starting +The `run` function now contains all the remaining logic from `main`, starting from reading the file. The `run` function takes the `Config` instance as an argument. #### Returning Errors from the `run` Function With the remaining program logic separated into the `run` function, we can -improve the error handling like we did with `Config::new` in Listing 12-9. +improve the error handling, as we did with `Config::new` in Listing 12-9. Instead of allowing the program to panic by calling `expect`, the `run` function will return a `Result` when something goes wrong. This will let us further consolidate into `main` the logic around handling errors in a -user-friendly way. Listing 12-12 shows the changes you need to make to the +user-friendly way. Listing 12-12 shows the changes we need to make to the signature and body of `run`: Filename: src/main.rs @@ -783,7 +786,7 @@ Filename: src/main.rs ``` use std::error::Error; -// ...snip... +// --snip-- fn run(config: Config) -> Result<(), Box> { let mut f = File::open(config.filename)?; @@ -799,44 +802,45 @@ fn run(config: Config) -> Result<(), Box> { Listing 12-12: Changing the `run` function to return `Result` -We’ve made three big changes here. First, we’re changing the return type of the -`run` function to `Result<(), Box>`. This function previously returned -the unit type, `()`, and we keep that as the value returned in the `Ok` case. +We’ve made three significant changes here. First, we changed the return type of +the `run` function to `Result<(), Box>`. This function previously +returned the unit type, `()`, and we keep that as the value returned in the +`Ok` case. -For our error type, we’re using the *trait object* `Box` (and we’ve -brought `std::error::Error` into scope with a `use` statement at the top). -We’ll be covering trait objects in Chapter 17. For now, just know that -`Box` means the function will return a type that implements the `Error` -trait, but we don’t have to specify what particular type the return value will -be. This gives us flexibility to return error values that may be of different -types in different error cases. +For the error type, we used the *trait object* `Box` (and we’ve brought +`std::error::Error` into scope with a `use` statement at the top). We’ll cover +trait objects in Chapter 17. For now, just know that `Box` means the +function will return a type that implements the `Error` trait, but we don’t +have to specify what particular type the return value will be. This gives us +flexibility to return error values that may be of different types in different +error cases. -The second change we’re making is removing the calls to `expect` in favor of -`?`, like we talked about in Chapter 9. Rather than `panic!` on an error, this -will return the error value from the current function for the caller to handle. +Second, we’ve removed the calls to `expect` in favor of `?`, as we talked about +in Chapter 9. Rather than `panic!` on an error, `?` will return the error value +from the current function for the caller to handle. -Thirdly, this function now returns an `Ok` value in the success case. We’ve +Third, the `run` function now returns an `Ok` value in the success case. We’ve declared the `run` function’s success type as `()` in the signature, which means we need to wrap the unit type value in the `Ok` value. This `Ok(())` -syntax may look a bit strange at first, but using `()` like this is the +syntax might look a bit strange at first, but using `()` like this is the idiomatic way to indicate that we’re calling `run` for its side effects only; it doesn’t return a value we need. -When you run this, it will compile, but with a warning: +When you run this code, it will compile but will display a warning: ``` -warning: unused result which must be used, #[warn(unused_must_use)] on by -default - --> src/main.rs:39:5 +warning: unused `std::result::Result` which must be used + --> src/main.rs:18:5 | -39 | run(config); +18 | run(config); | ^^^^^^^^^^^^ += note: #[warn(unused_must_use)] on by default ``` -Rust is telling us that our code ignores the `Result` value, which might be -indicating that there was an error. We’re not checking to see if there was an -error or not, though, and the compiler is reminding us that we probably meant -to have some error handling code here! Let’s rectify that now. +Rust tells us that our code ignored the `Result` value, and the `Result` value +might indicate that an error occurred. But we’re not checking to see whether or +not there was an error, and the compiler reminds us that we probably meant to +have some error handling code here! Let’s rectify that problem now. #### Handling Errors Returned from `run` in `main` @@ -848,7 +852,7 @@ Filename: src/main.rs ``` fn main() { - // ...snip... + // --snip-- println!("Searching for {}", config.query); println!("In file {}", config.filename); @@ -861,24 +865,24 @@ fn main() { } ``` -We use `if let` to check whether `run` returns an `Err` value, rather than -`unwrap_or_else`, and call `process::exit(1)` if it does. `run` doesn’t return -a value that we want to `unwrap` like `Config::new` returns the `Config` -instance. Because `run` returns a `()` in the success case, we only care about -detecting an error, so we don’t need `unwrap_or_else` to return the unwrapped -value as it would only be `()`. +We use `if let` rather than `unwrap_or_else` to check whether `run` returns an +`Err` value and call `process::exit(1)` if it does. The `run` function doesn’t +return a value that we want to `unwrap` in the same way that `Config::new` +returns the `Config` instance. Because `run` returns a `()` in the success +case, we only care about detecting an error, so we don’t need `unwrap_or_else` +to return the unwrapped value because it would only be `()`. The bodies of the `if let` and the `unwrap_or_else` functions are the same in -both cases though: we print out the error and exit. +both cases: we print the error and exit. ### Splitting Code into a Library Crate -This is looking pretty good so far! Now we’re going to split the *src/main.rs* -file up and put some code into *src/lib.rs* so that we can test it and have a -*src/main.rs* file with fewer responsibilities. +Our `minigrep` project is looking good so far! Now we’ll split the +*src/main.rs* file and put some code into the *src/lib.rs* file so we can test +it and have a *src/main.rs* file with fewer responsibilities. -Let’s move everything that isn’t the `main` function from *src/main.rs* to a -new file, *src/lib.rs*: +Let’s move all the code that isn’t the `main` function from *src/main.rs* to +*src/lib.rs*: * The `run` function definition * The relevant `use` statements @@ -902,12 +906,12 @@ pub struct Config { impl Config { pub fn new(args: &[String]) -> Result { - // ...snip... + // --snip-- } } pub fn run(config: Config) -> Result<(), Box> { - // ...snip... + // --snip-- } ``` @@ -918,9 +922,7 @@ method, and on the `run` function. We now have a library crate that has a public API that we can test! Now we need to bring the code we moved to *src/lib.rs* into the scope of the -binary crate in *src/main.rs* by using `extern crate minigrep`. Then we’ll add -a `use minigrep::Config` line to bring the `Config` type into scope, and prefix -the `run` function with our crate name as shown in Listing 12-14: +binary crate in *src/main.rs*, as shown in Listing 12-14: Filename: src/main.rs @@ -933,9 +935,9 @@ use std::process; use minigrep::Config; fn main() { - // ...snip... + // --snip-- if let Err(e) = minigrep::run(config) { - // ...snip... + // --snip-- } } ``` @@ -943,57 +945,57 @@ fn main() { Listing 12-14: Bringing the `minigrep` crate into the scope of *src/main.rs* To bring the library crate into the binary crate, we use `extern crate -minigrep`. Then we’ll add a `use minigrep::Config` line to bring the -`Config` type into scope, and we’ll prefix the `run` function with our crate -name. With that, all the functionality should be connected and should work. -Give it a `cargo run` and make sure everything is wired up correctly. +minigrep`. Then we’ll add a `use minigrep::Config` line to bring the `Config` +type into scope, and we’ll prefix the `run` function with our crate name. Now +all the functionality should be connected and should work. Run the program with +`cargo run` and make sure everything works correctly. Whew! That was a lot of work, but we’ve set ourselves up for success in the -future. Now it’s much easier to handle errors, and we’ve made our code more +future. Now it’s much easier to handle errors, and we’ve made the code more modular. Almost all of our work will be done in *src/lib.rs* from here on out. Let’s take advantage of this newfound modularity by doing something that would -have been hard with our old code, but is easy with our new code: write some -tests! +have been difficult with the old code but is easy with the new code: we’ll +write some tests! ## Developing the Library’s Functionality with Test Driven Development Now that we’ve extracted the logic into *src/lib.rs* and left the argument -collecting and error handling in *src/main.rs*, it’s much easier for us to -write tests for the core functionality of our code. We can call our functions -directly with various arguments and check return values without having to call -our binary from the command line. Feel free to write some tests for the -functionality in the `Config::new` and `run` functions on your own if you’d -like. +collecting and error handling in *src/main.rs*, it’s much easier to write tests +for the core functionality of our code. We can call functions directly with +various arguments and check return values without having to call our binary +from the command line. Feel free to write some tests for the functionality in +the `Config::new` and `run` functions on your own. -In this section, we’re going to move on to adding the searching logic of -`minigrep` by following the Test Driven Development (TDD) process. This is a -software development technique that follows this set of steps: +In this section, we’ll add the searching logic to the `minigrep` program by +using the Test Driven Development (TDD) process. This software development +technique follows these steps: -* Write a test that fails, and run it to make sure it fails for the reason you - expected. -* Write or modify just enough code to make the new test pass. -* Refactor the code you just added or changed, and make sure the tests continue - to pass. -* Repeat! +1. Write a test that fails, and run it to make sure it fails for the reason you +expected. +2. Write or modify just enough code to make the new test pass. +3. Refactor the code you just added or changed, and make sure the tests +continue to pass. +4. Repeat from step 1! -This is just one of many ways to write software, but TDD can help drive the -design of code. Writing the test before you write the code that makes the test -pass helps to maintain high test coverage throughout the process. +This process is just one of many ways to write software, but TDD can help drive +code design as well. Writing the test before you write the code that makes the +test pass helps to maintain high test coverage throughout the process. -We’re going to test drive the implementation of the functionality that will -actually do the searching for the query string in the file contents and produce -a list of lines that match the query. We’re going to add this functionality in -a function called `search`. +We’ll test drive the implementation of the functionality that will actually do +the searching for the query string in the file contents and produce a list of +lines that match the query. We’ll add this functionality in a function called +`search`. ### Writing a Failing Test -First, since we don’t really need them any more, let’s remove the `println!` -statements from both *src/lib.rs* and *src/main.rs*. Then we’ll add a `test` -module with a test function like we did in Chapter 11. The test function -specifies the behavior we’d like the `search` function to have: it will take a -query and the text to search for the query in, and will return only the lines -from the text that contain the query. Listing 12-15 shows this test: +Because we don’t need them anymore, let’s remove the `println!` statements from +*src/lib.rs* and *src/main.rs* that we used to check the program’s behavior. +Then, in *src/lib.rs*, we’ll add a `test` module with a test function, as we +did in Chapter 11. The test function specifies the behavior we want the +`search` function to have: it will take a query and the text to search for the +query in, and will return only the lines from the text that contain the query. +Listing 12-15 shows this test: Filename: src/lib.rs @@ -1020,16 +1022,16 @@ Pick three."; Listing 12-15: Creating a failing test for the `search` function we wish we had -The string we are searching for is “duct” in this test. The text we’re -searching is three lines, only one of which contains “duct”. We assert that the -value returned from the `search` function contains only the line we expect. +This test searches for the string “duct.” The text we’re searching is three +lines, only one of which contains “duct.” We assert that the value returned +from the `search` function contains only the line we expect. -We aren’t able to run this test and watch it fail though, since this test -doesn’t even compile–the search function doesn’t exist yet! So now we’ll add -just enough code to get the tests to compile and run: a definition of the -`search` function that always returns an empty vector, as shown in Listing -12-16. Once we have this, the test should compile and fail because an empty -vector doesn’t match a vector containing the line `"safe, fast, productive."`. +We aren’t able to run this test and watch it fail because the test doesn’t even +compile: the `search` function doesn’t exist yet! So now we’ll add just enough +code to get the test to compile and run by adding a definition of the `search` +function that always returns an empty vector, as shown in Listing 12-16. Then +the test should compile and fail because an empty vector doesn’t match a vector +containing the line `"safe, fast, productive."`. Filename: src/lib.rs @@ -1039,31 +1041,33 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { } ``` -Listing 12-16: Defining just enough of the `search` function so that our test -will compile +Listing 12-16: Defining just enough of the `search` function so our test will +compile Notice that we need an explicit lifetime `'a` defined in the signature of -`search` and used with the `contents` argument and the return value. Remember -from Chapter 10 that the lifetime parameters specify which argument lifetime is -connected to the lifetime of the return value. In this case, we’re indicating -that the returned vector should contain string slices that reference slices of -the argument `contents` (rather than the argument `query`). +`search` and used with the `contents` argument and the return value. Recall in +Chapter 10 that the lifetime parameters specify which argument lifetime is +connected to the lifetime of the return value. In this case, we indicate that +the returned vector should contain string slices that reference slices of the +argument `contents` (rather than the argument `query`). -In other words, we’re telling Rust that the data returned by the `search` -function will live as long as the data passed into the `search` function in the +In other words, we tell Rust that the data returned by the `search` function +will live as long as the data passed into the `search` function in the `contents` argument. This is important! The data referenced *by* a slice needs -to be valid in order for the reference to be valid; if the compiler assumed we -were making string slices of `query` rather than `contents`, it would do its -safety checking incorrectly. +to be valid for the reference to be valid; if the compiler assumes we’re making +string slices of `query` rather than `contents`, it will do its safety checking +incorrectly. -If we tried to compile this function without lifetimes, we would get this error: +If we forget the lifetime annotations and try to compile this function, we’ll +get this error: ``` error[E0106]: missing lifetime specifier - --> src/lib.rs:5:47 + --> src/lib.rs:5:51 | -5 | fn search(query: &str, contents: &str) -> Vec<&str> { - | ^ expected lifetime parameter +5 | pub fn search(query: &str, contents: &str) -> Vec<&str> { + | ^ expected lifetime +parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `query` or `contents` @@ -1075,15 +1079,16 @@ want to return the parts of that text that match, we know `contents` is the argument that should be connected to the return value using the lifetime syntax. Other programming languages don’t require you to connect arguments to return -values in the signature, so this may still feel strange, but will get easier -over time. You may want to compare this example with the Lifetime Syntax -section in Chapter 10. +values in the signature, so although this might seem strange, it will get +easier over time. You might want to compare this example with “Validating +References with Lifetimes” in Chapter 10 on page XX. -Now let’s try running our test: +Now let’s run the test: ``` $ cargo test -...warnings... +--warnings-- + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.43 secs Running target/debug/deps/minigrep-abcabcabc @@ -1093,20 +1098,22 @@ test test::one_result ... FAILED failures: ---- test::one_result stdout ---- - thread 'test::one_result' panicked at 'assertion failed: `(left == right)` -(left: `["safe, fast, productive."]`, right: `[]`)', src/lib.rs:16 + thread 'test::one_result' panicked at 'assertion failed: `(left == +right)` +left: `["safe, fast, productive."]`, +right: `[]`)', src/lib.rs:48:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: test::one_result -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out -error: test failed +error: test failed, to rerun pass '--lib' ``` -Great, our test fails, exactly as we expected. Let’s get the test to pass! +Great, the test fails, exactly as we expected. Let’s get the test to pass! ### Writing Code to Pass the Test @@ -1114,17 +1121,18 @@ Currently, our test is failing because we always return an empty vector. To fix that and implement `search`, our program needs to follow these steps: * Iterate through each line of the contents. -* Check if the line contains our query string. +* Check whether the line contains our query string. * If it does, add it to the list of values we’re returning. * If it doesn’t, do nothing. * Return the list of results that match. -Let’s take each step at a time, starting with iterating through lines. +Let’s work through each step, starting with iterating through lines. #### Iterating Through Lines with the `lines` Method Rust has a helpful method to handle line-by-line iteration of strings, -conveniently named `lines`, that works as shown in Listing 12-17: +conveniently named `lines`, that works as shown in Listing 12-17. Note this +won’t compile yet: Filename: src/lib.rs @@ -1138,17 +1146,17 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { Listing 12-17: Iterating through each line in `contents` -The `lines` method returns an iterator. We’ll be talking about iterators in -depth in Chapter 13, but we’ve already seen this way of using an iterator in -Listing 3-6, where we used a `for` loop with an iterator to run some code on -each item in a collection. +The `lines` method returns an iterator. We’ll talk about iterators in depth in +Chapter 13, but recall that you saw this way of using an iterator in Listing +3-4, where we used a `for` loop with an iterator to run some code on each item +in a collection. #### Searching Each Line for the Query -Next, we’ll add functionality to check if the current line contains the query -string. Luckily, strings have another helpful method named `contains` that does -this for us! Add a call to the `contains` method in the `search` function as -shown in Listing 12-18: +Next, we’ll check whether the current line contains our query string. +Fortunately, strings have a helpful method named `contains` that does this for +us! Add a call to the `contains` method in the `search` function, as shown in +Listing 12-18. Note this still won’t compile yet: Filename: src/lib.rs @@ -1162,15 +1170,15 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { } ``` -Listing 12-18: Adding functionality to see if the line contains the string in -`query` +Listing 12-18: Adding functionality to see whether the line contains the string +in `query` #### Storing Matching Lines -Finally, we need a way to store the lines that contain our query string. For -that, we can make a mutable vector before the `for` loop and call the `push` -method to store a `line` in the vector. After the `for` loop, we return the -vector, as shown in Listing 12-19: +We also need a way to store the lines that contain our query string. For that, +we can make a mutable vector before the `for` loop and call the `push` method +to store a `line` in the vector. After the `for` loop, we return the vector, as +shown in Listing 12-19: Filename: src/lib.rs @@ -1188,34 +1196,35 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { } ``` -Listing 12-19: Storing the lines that match so that we can return them +Listing 12-19: Storing the lines that match so we can return them -Now the `search` function should be returning only the lines that contain -`query`, and our test should pass. Let’s run the tests: +Now the `search` function should return only the lines that contain `query`, +and our test should pass. Let’s run the test: ``` $ cargo test +--snip-- running 1 test test test::one_result ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Our test passed, great, it works! +Our test passed, so we know it works! -Now that our test is passing, we could consider opportunities for refactoring -the implementation of the `search` function while keeping the code that passes -the tests, in order to maintain the same functionality. The code in the -`search` function isn’t too bad, but it isn’t taking advantage of some useful -features of iterators. We’ll be coming back to this example in Chapter 13 where -we’ll explore iterators in detail and see how to improve it. +At this point, we could consider opportunities for refactoring the +implementation of the search function while keeping the tests passing to +maintain the same functionality. The code in the search function isn’t too bad, +but it doesn’t take advantage of some useful features of iterators. We’ll +return to this example in Chapter 13 where we’ll explore iterators in detail +and look at how to improve it. #### Using the `search` Function in the `run` Function -Now that we have the `search` function working and tested, we need to actually -call `search` from our `run` function. We need to pass the `config.query` value -and the `contents` that `run` read from the file to the `search` function. Then -`run` will print out each line returned from `search`: +Now that the `search` function is working and tested, we need to call `search` +from our `run` function. We need to pass the `config.query` value and the +`contents` that `run` reads from the file to the `search` function. Then `run` +will print each line returned from `search`: Filename: src/lib.rs @@ -1234,11 +1243,10 @@ pub fn run(config: Config) -> Result<(), Box> { } ``` -We’re still using a `for` loop to get each line returned from `search` and -print it out. +We’re still using a `for` loop to return each line from `search` and print it. -Now our whole program should be working! Let’s try it out, first with a word -that should return exactly one line from the Emily Dickinson poem, “frog”: +Now the entire program should work! Let’s try it out, first with a word that +should return exactly one line from the Emily Dickinson poem, “frog”: ``` $ cargo run frog poem.txt @@ -1248,18 +1256,19 @@ $ cargo run frog poem.txt How public, like a frog ``` -Cool! Next, how about a word that will match multiple lines, like “the”: +Cool! Now let’s try a word that will match multiple lines, like “body”: ``` -$ cargo run the poem.txt +$ cargo run body poem.txt Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs - Running `target/debug/minigrep the poem.txt` -Then there’s a pair of us — don’t tell! -To tell your name the livelong day + Running `target/debug/minigrep body poem.txt` +I’m nobody! Who are you? +Are you nobody, too? +How dreary to be somebody! ``` And finally, let’s make sure that we don’t get any lines when we search for a -word that isn’t anywhere in the poem, like “monomorphization”: +word that isn’t anywhere in the poem, such as “monomorphization”: ``` $ cargo run monomorphization poem.txt @@ -1267,34 +1276,31 @@ $ cargo run monomorphization poem.txt Running `target/debug/minigrep monomorphization poem.txt` ``` -Excellent! We’ve built our own mini version of a classic tool, and learned a -lot about how to structure applications. We’ve also learned a bit about file -input and output, lifetimes, testing, and command line parsing. +Excellent! We’ve built our own mini version of a classic tool and learned a lot +about how to structure applications. We’ve also learned a bit about file input +and output, lifetimes, testing, and command line parsing. -To round out this project chapter, we’re going to briefly demonstrate how to -work with environment variables and how to print to standard error, both of -which are useful when writing command line programs. Feel free to move on to -Chapter 13 if you’d like at this point. +To round out this project, we’ll briefly demonstrate how to work with +environment variables and how to print to standard error, both of which are +useful when you’re writing command line programs. ## Working with Environment Variables -We’re going to improve our tool with an extra feature: an option for case -insensitive searching that the user can turn on via an environment variable. We -could make this a command line option and require that users enter it each time -they want it to apply, but instead we’re going to use an environment variable. -This allows our users to set the environment variable once and have all their -searches be case insensitive in that terminal session. +We’ll improve `minigrep` by adding an extra feature: an option for +case-insensitive searching that the user can turn on via an environment +variable. We could make this feature a command line option and require that +users enter it each time they want it to apply, but instead we’ll use an +environment variable. Doing so allows our users to set the environment variable +once and have all their searches be case insensitive in that terminal session. ### Writing a Failing Test for the Case-Insensitive `search` Function -We want to add a new `search_case_insensitive` function that we will call when -the environment variable is on. - -We’re going to continue following the TDD process, so the first step is again -to write a failing test. We’ll add a new test for the new case-insensitive -search function, and rename our old test from `one_result` to `case_sensitive` -to be clearer about the differences between the two tests, as shown in Listing -12-20: +We want to add a new `search_case_insensitive` function that we’ll call when +the environment variable is on. We’ll continue to follow the TDD process, so +the first step is again to write a failing test. We’ll add a new test for the +new `search``_case_insensitive` function and rename our old test from +`one_result` to `case_sensitive` to clarify the differences between the two +tests, as shown in Listing 12-20: Filename: src/lib.rs @@ -1335,32 +1341,31 @@ Trust me."; } ``` -Listing 12-20: Adding a new failing test for the case insensitive function +Listing 12-20: Adding a new failing test for the case-insensitive function we’re about to add Note that we’ve edited the old test’s `contents` too. We’ve added a new line -with the text “Duct tape”, with a capital D, that shouldn’t match the query -“duct” when we’re searching in a case sensitive manner. Changing the old test -in this way helps ensure that we don’t accidentally break the case sensitive -search functionality that we’ve already implemented; this test should pass now -and should continue to pass as we work on the case insensitive search. +with the text `“Duct tape”` using a capital D that shouldn’t match the query +“duct” when we’re searching in a case-sensitive manner. Changing the old test +in this way helps ensure that we don’t accidentally break the case-sensitive +search functionality that we’ve already implemented. This test should pass now +and should continue to pass as we work on the case-insensitive search. -The new test for the case *insensitive* search uses “rUsT” as its query. In the -`search_case_insensitive` function we’re going to add, the query “rUsT” should -match both the line containing “Rust:” with a capital R and also the line -“Trust me.” even though both of those have different casing than the query. -This is our failing test, and it will fail to compile because we haven’t yet -defined the `search_case_insensitive` function. Feel free to add a skeleton -implementation that always returns an empty vector in the same way that we did -for the `search` function in Listing 12-16 in order to see the test compile and -fail. +The new test for the case-*insensitive* search uses “rUsT” as its query. In the +`search_case_insensitive` function we’re about to add, the query “rUsT” should +match the line containing “Rust:” with a capital R and also the line “Trust +me.” even though both have different casing than the query. This is our failing +test, and it will fail to compile because we haven’t yet defined the +`search_case_insensitive` function. Feel free to add a skeleton implementation +that always returns an empty vector, similar to the way we did for the `search` +function in Listing 12-16 to see the test compile and fail. ### Implementing the `search_case_insensitive` Function The `search_case_insensitive` function, shown in Listing 12-21, will be almost the same as the `search` function. The only difference is that we’ll lowercase -the `query` and each `line` so that whatever the case of the input arguments, -they will be the same case when we check whether the line contains the query. +the `query` and each `line` so whatever the case of the input arguments, +they’ll be the same case when we check whether the line contains the query: Filename: src/lib.rs @@ -1379,26 +1384,26 @@ fn search_case_insensitive<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { } ``` -Listing 12-21: Defining the `search_case_insensitive` function to lowercase -both the query and the line before comparing them +Listing 12-21: Defining the `search_case_insensitive` function to lowercase the +query and the line before comparing them -First, we lowercase the `query` string, and store it in a shadowed variable -with the same name. Calling `to_lowercase` on the query is necessary so that no -matter if the user’s query is “rust”, “RUST”, “Rust”, or “rUsT”, we’ll treat -the query as if it was “rust” and be insensitive to the case. +First, we lowercase the `query` string and store it in a shadowed variable with +the same name. Calling `to_lowercase` on the query is necessary so no matter +whether the user’s query is “rust”, “RUST”, “Rust”, or “rUsT”, we’ll treat the +query as if it was “rust” and be insensitive to the case. Note that `query` is now a `String` rather than a string slice, because calling `to_lowercase` creates new data rather than referencing existing data. Say the -query is “rUsT”, as an example: that string slice does not contain a lowercase +query is “rUsT”, as an example: that string slice doesn’t contain a lowercase “u” or “t” for us to use, so we have to allocate a new `String` containing “rust”. When we pass `query` as an argument to the `contains` method now, we need to add an ampersand because the signature of `contains` is defined to take a string slice. -Next, we add a call to `to_lowercase` on each `line` before we check if it -contains `query` to lowercase all characters. Now that we’ve converted both -`line` and `query` to lowercase, we’ll find matches no matter what the case of -the query. +Next, we add a call to `to_lowercase` on each `line` before we check whether it +contains `query` to lowercase all characters. Now that we’ve converted `line` +and `query` to lowercase, we’ll find matches no matter what the case of the +query is. Let’s see if this implementation passes the tests: @@ -1407,13 +1412,14 @@ running 2 tests test test::case_insensitive ... ok test test::case_sensitive ... ok -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Great! Now, let’s actually call the new `search_case_insensitive` function from -the `run` function. First, we’re going to add a configuration option for -switching between case sensitive and case insensitive search to the `Config` -struct: +Great! They passed. Now, let’s call the new `search_case_insensitive` function +from the `run` function. First, we’ll add a configuration option to the +`Config` struct to switch between case-sensitive and case-insensitive search. +Adding this field will cause compiler errors since we aren’t initializing this +field anywhere yet: Filename: src/lib.rs @@ -1425,10 +1431,11 @@ pub struct Config { } ``` -We add the `case_sensitive` field that holds a boolean. Then we need our `run` -function to check the `case_sensitive` field’s value and use that to decide -whether to call the `search` function or the `search_case_insensitive` function -as shown in Listing 12-22: +Note that we added the `case_sensitive` field that holds a Boolean. Next, we +need the `run` function to check the `case_sensitive` field’s value and use +that to decide whether to call the `search` function or the +`search_case_insensitive` function, as shown in Listing 12-22. Note this still +won’t compile yet: Filename: src/lib.rs @@ -1456,19 +1463,19 @@ pub fn run(config: Config) -> Result<(), Box>{ Listing 12-22: Calling either `search` or `search_case_insensitive` based on the value in `config.case_sensitive` -Finally, we need to actually check for the environment variable. The functions -for working with environment variables are in the `env` module in the standard +Finally, we need to check for the environment variable. The functions for +working with environment variables are in the `env` module in the standard library, so we want to bring that module into scope with a `use std::env;` line -at the top of *src/lib.rs*. Then we’re going to use the `var` method from the -`env` module to check for an environment variable named `CASE_INSENSITIVE`, as -shown in Listing 12-23: +at the top of *src/lib.rs*. Then we’ll use the `var` method from the `env` +module to check for an environment variable named `CASE_INSENSITIVE`, as shown +in Listing 12-23: Filename: src/lib.rs ``` use std::env; -// ...snip... +// --snip-- impl Config { pub fn new(args: &[String]) -> Result { @@ -1488,24 +1495,24 @@ impl Config { Listing 12-23: Checking for an environment variable named `CASE_INSENSITIVE` -Here, we create a new variable `case_sensitive`. In order to set its value, we -call the `env::var` function and pass it the name of the `CASE_INSENSITIVE` -environment variable. The `env::var` method returns a `Result` that will be the -successful `Ok` variant that contains the value of the environment variable if -the environment variable is set. It will return the `Err` variant if the +Here, we create a new variable `case_sensitive`. To set its value, we call the +`env::var` function and pass it the name of the `CASE_INSENSITIVE` environment +variable. The `env::var` method returns a `Result` that will be the successful +`Ok` variant that contains the value of the environment variable if the +environment variable is set. It will return the `Err` variant if the environment variable is not set. -We’re using the `is_err` method on the `Result` to check to see if it’s an -error, and therefore unset, which means it *should* do a case sensitive search. -If the `CASE_INSENSITIVE` environment variable is set to anything, `is_err` -will return false and it will perform a case insensitive search. We don’t care -about the *value* of the environment variable, just whether it’s set or unset, -so we’re checking `is_err` rather than `unwrap`, `expect`, or any of the other +We’re using the `is_err` method on the `Result` to check whether it’s an error +and therefore unset, which means it *should* do a case-sensitive search. If the +`CASE_INSENSITIVE` environment variable is set to anything, `is_err` will +return false and will perform a case-insensitive search. We don’t care about +the *value* of the environment variable, just whether it’s set or unset, so +we’re checking `is_err` rather than `unwrap`, `expect`, or any of the other methods we’ve seen on `Result`. We pass the value in the `case_sensitive` variable to the `Config` instance so -that the `run` function can read that value and decide whether to call `search` -or `search_case_insensitive` as we implemented in Listing 12-22. +the `run` function can read that value and decide whether to call `search` or +`search_case_insensitive` as we implemented in Listing 12-22. Let’s give it a try! First, we’ll run our program without the environment variable set and with the query “to”, which should match any line that contains @@ -1513,6 +1520,7 @@ the word “to” in all lowercase: ``` $ cargo run to poem.txt + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep to poem.txt` Are you nobody, too? @@ -1520,8 +1528,8 @@ How dreary to be somebody! ``` Looks like that still works! Now, let’s run the program with `CASE_INSENSITIVE` -set to 1 but with the same query “to”, and we should get lines that contain -“to” that might have uppercase letters: +set to `1` but with the same query “to”; we should get lines that contain “to” +that might have uppercase letters: ``` $ CASE_INSENSITIVE=1 cargo run to poem.txt @@ -1533,12 +1541,20 @@ To tell your name the livelong day To an admiring bog! ``` +If you’re using PowerShell, you will need to set the environment variable and +run the program in two commands rather than one: + +```text +$ $env.CASE_INSENSITIVE=1 +$ cargo run to poem.txt +``` + Excellent, we also got lines containing “To”! Our `minigrep` program can now do -case insensitive searching, controlled by an environment variable. Now you know +case-insensitive searching controlled by an environment variable. Now you know how to manage options set using either command line arguments or environment variables! -Some programs allow both arguments *and* environment variables for the same +Some programs allow arguments *and* environment variables for the same configuration. In those cases, the programs decide that one or the other takes precedence. For another exercise on your own, try controlling case insensitivity through either a command line argument or an environment @@ -1547,36 +1563,37 @@ should take precedence if the program is run with one set to case sensitive and one set to case insensitive. The `std::env` module contains many more useful features for dealing with -environment variables; check out its documentation to see what’s available. +environment variables: check out its documentation to see what is available. ## Writing Error Messages to Standard Error Instead of Standard Output -At the moment we’re writing all of our output to the terminal with the +At the moment we’re writing all of our output to the terminal using the `println!` function. Most terminals provide two kinds of output: *standard -output* for general information (sometimes abbreviated as `stdout` in code), -and *standard error* for error messages (`stderr`). This distinction enables -users to choose whether to direct a the successful output of a program to a -file but still print error messages to the screen. +out**put* (`stdout`) for general information and *standard error* (`stderr`) +for error messages. This distinction enables users to choose to direct the +successful output of a program to a file but still print error messages to the +screen. -The `println!` function is only capable of printing to standard output, though, -so we have to use something else in order to print to standard error. +The `println!` function is only capable of printing to standard output, so we +have to use something else to print to standard error. -### Checking Where Errors are Written to +### Checking Where Errors Are Written to -First, let’s observe how all content printed by `minigrep` is currently being -written to standard output, including error messages that we want to write to +First, let’s observe how the content printed by `minigrep` is currently being +written to standard output, including any error messages we want to write to standard error instead. We’ll do that by redirecting the standard output stream -to a file while we also intentionally cause an error. We won’t redirect the +to a file while also intentionally causing an error. We won’t redirect the standard error stream, so any content sent to standard error will continue to -display on the screen. Command line programs are expected to send error -messages to the standard error stream so that we can still see error messages -on the screen even if we choose to redirect the standard output stream to a -file. Our program is not currently well-behaved; we’re about to see that it -saves the error message output to the file instead! +display on the screen. + +Command line programs are expected to send error messages to the standard error +stream so we can still see error messages on the screen even if we redirect the +standard output stream to a file. Our program is not currently well-behaved: +we’re about to see that it saves the error message output to a file instead! The way to demonstrate this behavior is by running the program with `>` and the filename, *output.txt*, that we want to redirect the standard output stream to. -We’re not going to pass any arguments, which should cause an error: +We won’t pass any arguments, which should cause an error: ``` $ cargo run > output.txt @@ -1585,25 +1602,25 @@ $ cargo run > output.txt The `>` syntax tells the shell to write the contents of standard output to *output.txt* instead of the screen. We didn’t see the error message we were expecting printed on the screen, so that means it must have ended up in the -file. Let’s see what *output.txt* contains: +file. This is what *output.txt* contains: ``` Problem parsing arguments: not enough arguments ``` Yup, our error message is being printed to standard output. It’s much more -useful for error messages like this to be printed to standard error, and have +useful for error messages like this to be printed to standard error and have only data from a successful run end up in the file when we redirect standard -output in this way. We’ll change that. +output this way. We’ll change that. ### Printing Errors to Standard Error -Let’s change how error messages are printed using the code in Listing 12-24. +We’ll use the code in Listing 12-24 to change how error messages are printed. Because of the refactoring we did earlier in this chapter, all the code that -prints error messages is in one function, in `main`. The standard library -provides the `eprintln!` macro that prints to the standard error stream, so -let’s change the two places we were calling `println!` to print errors so that -these spots use `eprintln!` instead: +prints error messages is in one function, `main`. The standard library provides +the `eprintln!` macro that prints to the standard error stream, so let’s change +the two places we were calling `println!` to print errors to use `eprintln!` +instead: Filename: src/main.rs @@ -1627,25 +1644,25 @@ fn main() { Listing 12-24: Writing error messages to standard error instead of standard output using `eprintln!` -After changing `println!` to `eprintln!`, let’s try running the program again -in the same way, without any arguments and redirecting standard output with `>`: +After changing `println!` to `eprintln!`, let’s run the program again in the +same way, without any arguments and redirecting standard output with `>`: ``` $ cargo run > output.txt Problem parsing arguments: not enough arguments ``` -Now we see our error on the screen and `output.txt` contains nothing, which is -the behavior expected of command line programs. +Now we see the error onscreen and *output.txt* contains nothing, which is the +behavior we expect of command line programs. -If we run the program again with arguments that don’t cause an error, but still -redirect standard output to a file: +Let’s run the program again with arguments that don’t cause an error but still +redirect standard output to a file, like so: ``` $ cargo run to poem.txt > output.txt ``` -We won’t see any output to our terminal, and `output.txt` will contain our +We won’t see any output to the terminal, and *output.txt* will contain our results: Filename: output.txt @@ -1655,18 +1672,19 @@ Are you nobody, too? How dreary to be somebody! ``` -This demonstrates that we’re now using standard output for successful output and -standard error for error output as appropriate. +This demonstrates that we’re now using standard output for successful output +and standard error for error output as appropriate. ## Summary -In this chapter, we’ve recapped on some of the major concepts so far and -covered how to do common I/O operations in a Rust context. By using command -line arguments, files, environment variables, and the `eprintln!` macro for -printing errors, you’re now prepared to write command line applications. By -using the concepts from previous chapters, your code will be well-organized, be -able to store data effectively in the appropriate data structures, handle -errors nicely, and be well tested. +In this chapter, we’ve recapped some of the major concepts you’ve learned so +far and covered how to do common I/O operations in a Rust context. By using +command line arguments, files, environment variables, and the `eprintln!` macro +for printing errors, you’re now prepared to write command line applications. By +using the concepts in previous chapters, your code will be well organized, +store data effectively in the appropriate data structures, handle errors +nicely, and be well tested. + +Next, we’ll explore some Rust features that were influenced by functional +languages: closures and iterators. -Next, let’s explore some functional-language influenced Rust features: closures -and iterators. diff --git a/src/doc/book/second-edition/nostarch/chapter13.md b/src/doc/book/second-edition/nostarch/chapter13.md index e497d4cc47..329d459e9d 100644 --- a/src/doc/book/second-edition/nostarch/chapter13.md +++ b/src/doc/book/second-edition/nostarch/chapter13.md @@ -1,53 +1,53 @@ [TOC] -# Functional Language features in Rust: Iterators and Closures +# Functional Language Features: Iterators and Closures -Rust’s design has taken inspiration from a lot of existing languages and +Rust’s design has taken inspiration from many existing languages and techniques, and one significant influence is *functional programming*. -Programming in a functional style often includes using functions as values, by +Programming in a functional style often includes using functions as values by passing them in arguments, returning them from other functions, assigning them -to variables for later execution, and so forth. We won’t debate here the issue -of what, exactly, functional programming is or is not, but will instead show -off some features of Rust that are similar to features in many languages often -referred to as functional. +to variables for later execution, and so forth. In this chapter, we won’t +debate the issue of what functional programming is or isn’t but will instead +discuss some features of Rust that are similar to features in many languages +often referred to as functional. -More specifically, we’re going to cover: +More specifically, we’ll cover: -* *Closures*: a function-like construct you can store in a variable. -* *Iterators*: a way of processing a series of elements. -* How to use these features to improve on the I/O project from Chapter 12. -* The performance of these features. Spoiler alert: they’re faster than you - might think! +* *Closures*, a function-like construct you can store in a variable +* *Iterators*, a way of processing a series of elements +* How to use these two features to improve the I/O project in Chapter 12 +* The performance of these two features (Spoiler alert: they’re faster than you + might think!) -There are other Rust features influenced by the functional style, like pattern -matching and enums, that we’ve covered in other chapters as well. Mastering +Other Rust features are influenced by the functional style as well, such as +pattern matching and enums, which we’ve covered in other chapters. Mastering closures and iterators is an important part of writing idiomatic, fast Rust -code, so we’re devoting an entire chapter to them here. +code, so we’ll devote this entire chapter to them. -## Closures: Anonymous Functions that can Capture their Environment +## Closures: Anonymous Functions that Can Capture Their Environment Rust’s *closures* are anonymous functions you can save in a variable or pass as arguments to other functions. You can create the closure in one place, and then call the closure to evaluate it in a different context. Unlike functions, -closures are able to capture values from the scope in which they are called. -We’re going to demonstrate how these features of closures allow for code reuse -and customization of behavior. +closures can capture values from the scope in which they’re called. We’ll +demonstrate how these closure features allow for code reuse and behavior +customization. -### Creating an Abstraction of Behavior Using a Closure +### Creating an Abstraction of Behavior with Closures Let’s work on an example of a situation in which it’s useful to store a closure -to be executed at a later time. We’ll talk about the syntax of closures, type -inference, and traits along the way. +to be executed at a later time. Along the way, we’ll talk about the syntax of +closures, type inference, and traits. -The hypothetical situation is this: we work at a startup that’s making an app +Consider this hypothetical situation: we work at a startup that’s making an app to generate custom exercise workout plans. The backend is written in Rust, and the algorithm that generates the workout plan takes into account many different -factors, like the app user’s age, Body Mass Index, preferences, recent +factors, such as the app user’s age, body mass index, preferences, recent workouts, and an intensity number they specify. The actual algorithm used isn’t important in this example; what’s important is that this calculation takes a -few seconds. We only want to call this algorithm when we need to, and only call -it once, so we aren’t making the user wait more than necessary. +few seconds. We want to call this algorithm only when we need to and only call +it once, so we don’t make the user wait more than necessary. We’ll simulate calling this hypothetical algorithm with the `simulated_expensive_calculation` function shown in Listing 13-1, which will @@ -60,7 +60,7 @@ Filename: src/main.rs use std::thread; use std::time::Duration; -fn simulated_expensive_calculation(intensity: i32) -> i32 { +fn simulated_expensive_calculation(intensity: u32) -> u32 { println!("calculating slowly..."); thread::sleep(Duration::from_secs(2)); intensity @@ -70,22 +70,21 @@ fn simulated_expensive_calculation(intensity: i32) -> i32 { Listing 13-1: A function to stand in for a hypothetical calculation that takes about two seconds to run -Next, we have a `main` function that contains the parts of the workout app -important for this example. This represents the code that the app would call -when a user asks for a workout plan. Because the interaction with the app’s -frontend isn’t relevant to the use of closures, we’re going to hardcode values +Next is the `main` function that contains the parts of the workout app +important for this example. This function represents the code that the app will +call when a user asks for a workout plan. Because the interaction with the +app’s frontend isn’t relevant to the use of closures, we’ll hardcode values representing inputs to our program and print the outputs. The required inputs are: -* **An intensity number from the user**, specified when they request a - workout to indicate whether they’d like a low intensity workout or a high - intensity workout -* **A random number** that will generate some variety in the workout plans +* *An intensity number from the user*, which is specified when they request + a workout to indicate whether they want a low-intensity workout or a + high-intensity workout. +* *A random number* that will generate some variety in the workout plans. -The output will be the recommended workout plan. - -Listing 13-2 shows the `main` function we’re going to use. +The output will be the recommended workout plan. Listing 13-2 shows the `main` +function we’ll use: Filename: src/main.rs @@ -106,20 +105,20 @@ and random number generation We’ve hardcoded the variable `simulated_user_specified_value` to 10 and the variable `simulated_random_number` to 7 for simplicity’s sake; in an actual -program we’d get the intensity number from the app frontend and we’d use the -`rand` crate to generate a random number like we did in the Guessing Game +program, we’d get the intensity number from the app frontend and we’d use the +`rand` crate to generate a random number, as we did in the Guessing Game example in Chapter 2. The `main` function calls a `generate_workout` function with the simulated input values. -There’s the context, so let’s get to the algorithm. The `generate_workout` -function in Listing 13-3 contains the business logic of the app that we’re most -concerned with in this example. The rest of the code changes in this example -will be made to this function: +Now that we have the context, let’s get to the algorithm. The +`generate_workout` function in Listing 13-3 contains the business logic of the +app that we’re most concerned with in this example. The rest of the code +changes in this example will be made to this function: Filename: src/main.rs ``` -fn generate_workout(intensity: i32, random_number: i32) { +fn generate_workout(intensity: u32, random_number: u32) { if intensity < 25 { println!( "Today, do {} pushups!", @@ -150,36 +149,36 @@ The first `if` block calls `simulated_expensive_calculation` twice, the `if` inside the outer `else` doesn’t call it at all, and the code inside the second `else` case calls it once. -The desired behavior of the `generate_workout` function is to first check if -the user wants a low intensity workout (indicated by a number less than 25) or -a high intensity workout (25 or more). +The desired behavior of the `generate_workout` function is to first check +whether the user wants a low-intensity workout (indicated by a number less than +25) or a high-intensity workout (a number of 25 or greater). -Low intensity workout plans will recommend a number of pushups and situps based -on the complex algorithm we’re simulating. +Low-intensity workout plans will recommend a number of push-ups and sit-ups +based on the complex algorithm we’re simulating. -If the user wants a high intensity workout, there’s some additional logic: if +If the user wants a high-intensity workout, there’s some additional logic: if the value of the random number generated by the app happens to be 3, the app will recommend a break and hydration. If not, the user will get a number of minutes of running based on the complex algorithm. The data science team has let us know that we’ll have to make some changes to the way we call the algorithm in the future. To simplify the update when those -changes happen, we want to refactor this code so it only calls the -`simulated_expensive_calculation` function once. We also want to cut the place -where we’re currently calling the function twice unnecessarily without adding -any other calls to that function in the process. That is, we don’t want to call -it if the result isn’t needed, and we still want to call it only once. +changes happen, we want to refactor this code so it calls the +`simulated_expensive_calculation` function only once. We also want to cut the +place where we’re currently unnecessarily calling the function twice without +adding any other calls to that function in the process. That is, we don’t want +to call it if the result isn’t needed, and we still want to call it only once. #### Refactoring Using Functions -There are many ways we could restructure this program. First we’ll try -extracting the duplicated call to the expensive calculation function into a -variable, as shown in Listing 13-4: +We could restructure the workout program in many ways. First, we’ll try +extracting the duplicated call to the `expensive_calculation` function into +a variable, as shown in Listing 13-4: Filename: src/main.rs ``` -fn generate_workout(intensity: i32, random_number: i32) { +fn generate_workout(intensity: u32, random_number: u32) { let expensive_result = simulated_expensive_calculation(intensity); @@ -209,15 +208,15 @@ Listing 13-4: Extracting the calls to `simulated_expensive_calculation` to one place and storing the result in the `expensive_result` variable This change unifies all the calls to `simulated_expensive_calculation` and -solves the problem of the first `if` block calling the function twice -unnecessarily. Unfortunately, we’re now calling this function and waiting for -the result in all cases, which includes the inner `if` block that doesn’t use -the result value at all. +solves the problem of the first `if` block unnecessarily calling the function +twice. Unfortunately, we’re now calling this function and waiting for the +result in all cases, which includes the inner `if` block that doesn’t use the +result value at all. We want to define code in one place in our program, but only *execute* that code where we actually need the result. This is a use case for closures! -#### Refactoring with Closures to Store Code for Later Execution +#### Refactoring with Closures to Store Code Instead of always calling the `simulated_expensive_calculation` function before the `if` blocks, we can define a closure and store the *closure* in a variable @@ -242,32 +241,32 @@ The closure definition comes after the `=` to assign it to the variable `expensive_closure`. To define a closure, we start with a pair of vertical pipes (`|`), inside which we specify the parameters to the closure; this syntax was chosen because of its similarity to closure definitions in Smalltalk and -Ruby. This closure has one parameter named `num`; if we had more than one +Ruby. This closure has one parameter named `num`: if we had more than one parameter, we would separate them with commas, like `|param1, param2|`. -After the parameters, we place curly braces that hold the body of the +After the parameters, we place curly brackets that hold the body of the closure—these are optional if the closure body is a single expression. The end -of the closure, after the curly braces, needs a semicolon to complete the `let` -statement. The value returned from the last line in the closure body (`num`) -will be the value returned from the closure when it’s called, since that line -doesn’t end in a semicolon; just like in function bodies. +of the closure, after the curly brackets, needs a semicolon to complete the +`let` statement. The value returned from the last line in the closure body +(`num`) will be the value returned from the closure when it’s called, because +that line doesn’t end in a semicolon; just like in function bodies. Note that this `let` statement means `expensive_closure` contains the *definition* of an anonymous function, not the *resulting value* of calling the anonymous function. Recall that we’re using a closure because we want to define -the code to call at one point, store that code, and actually call it at a later -point; the code we want to call is now stored in `expensive_closure`. +the code to call at one point, store that code, and call it at a later point; +the code we want to call is now stored in `expensive_closure`. -Now that we have the closure defined, we can change the code in the `if` blocks -to call the closure, in order to execute the code and get the resulting value. -We call a closure like we do a function: we specify the variable name that -holds the closure definition and follow it with parentheses containing the -argument values we want to use, as shown in Listing 13-6: +With the closure defined, we can change the code in the `if` blocks to call the +closure to execute the code and get the resulting value. We call a closure like +we do a function: we specify the variable name that holds the closure +definition and follow it with parentheses containing the argument values we +want to use, as shown in Listing 13-6: Filename: src/main.rs ``` -fn generate_workout(intensity: i32, random_number: i32) { +fn generate_workout(intensity: u32, random_number: u32) { let expensive_closure = |num| { println!("calculating slowly..."); thread::sleep(Duration::from_secs(2)); @@ -301,27 +300,24 @@ Listing 13-6: Calling the `expensive_closure` we’ve defined Now the expensive calculation is called in only one place, and we’re only executing that code where we need the results. -We have, however, reintroduced one of the problems from Listing 13-3: we’re -still calling the closure twice in the first `if` block, which will call the +However, we’ve reintroduced one of the problems from Listing 13-3: we’re still +calling the closure twice in the first `if` block, which will call the expensive code twice and make the user wait twice as long as they need to. We could fix this problem by creating a variable local to that `if` block to hold the result of calling the closure, but closures provide us with another -solution. We’ll get back to that solution in a bit; let’s first talk about why -there aren’t type annotations in the closure definition and the traits involved -with closures. +solution. We’ll talk about that solution in a bit. But first let’s talk about +why there aren’t type annotations in the closure definition and the traits +involved with closures. ### Closure Type Inference and Annotation -Closures differ from functions defined with the `fn` keyword in a few ways. The -first is that closures don’t require you to annotate the types of the -parameters or the return value like `fn` functions do. - -Type annotations are required on functions because they are part of an explicit -interface exposed to your users. Defining this interface rigidly is important -for ensuring that everyone agrees on what types of values a function uses and -returns. Closures aren’t used in an exposed interface like this, though: -they’re stored in variables and used without naming them and exposing them to -users of our library. +Closures don’t require you to annotate the types of the parameters or the +return value like `fn` functions do. Type annotations are required on functions +because they’re part of an explicit interface exposed to your users. Defining +this interface rigidly is important for ensuring that everyone agrees on what +types of values a function uses and returns. But closures aren’t used in an +exposed interface like this: they’re stored in variables and used without +naming them and exposing them to users of our library. Additionally, closures are usually short and only relevant within a narrow context rather than in any arbitrary scenario. Within these limited contexts, @@ -332,15 +328,15 @@ Making programmers annotate the types in these small, anonymous functions would be annoying and largely redundant with the information the compiler already has available. -Like variables, we can choose to add type annotations if we want to increase -explicitness and clarity at the cost of being more verbose than is strictly -necessary; annotating the types for the closure we defined in Listing 13-4 -would look like the definition shown in Listing 13-7: +Like variables, we can add type annotations if we want to increase explicitness +and clarity at the cost of being more verbose than is strictly necessary; +annotating the types for the closure we defined in Listing 13-4 would look like +the definition shown in Listing 13-7: Filename: src/main.rs ``` -let expensive_closure = |num: i32| -> i32 { +let expensive_closure = |num: u32| -> u32 { println!("calculating slowly..."); thread::sleep(Duration::from_secs(2)); num @@ -351,34 +347,32 @@ Listing 13-7: Adding optional type annotations of the parameter and return value types in the closure The syntax of closures and functions looks more similar with type annotations. -Here’s a vertical comparison of the syntax for the definition of a function -that adds one to its parameter, and a closure that has the same behavior. We’ve -added some spaces here to line up the relevant parts). This illustrates how -closure syntax is similar to function syntax, except for the use of pipes and -the amount of syntax that is optional: +The following is a vertical comparison of the syntax for the definition of a +function that adds one to its parameter, and a closure that has the same +behavior. We’ve added some spaces to line up the relevant parts. This +illustrates how closure syntax is similar to function syntax except for the use +of pipes and the amount of syntax that is optional: ``` -fn add_one_v1 (x: i32) -> i32 { x + 1 } -let add_one_v2 = |x: i32| -> i32 { x + 1 }; +fn add_one_v1 (x: u32) -> u32 { x + 1 } +let add_one_v2 = |x: u32| -> u32 { x + 1 }; let add_one_v3 = |x| { x + 1 }; let add_one_v4 = |x| x + 1 ; ``` The first line shows a function definition, and the second line shows a fully annotated closure definition. The third line removes the type annotations from -the closure definition, and the fourth line removes the braces that are -optional, since the closure body only has one expression. These are all valid +the closure definition, and the fourth line removes the brackets that are +optional, because the closure body has only one expression. These are all valid definitions that will produce the same behavior when they’re called. Closure definitions will have one concrete type inferred for each of their parameters and for their return value. For instance, Listing 13-8 shows the definition of a short closure that just returns the value it receives as a -parameter. - -This closure isn’t very useful except for the purposes of this example. Note -that we haven’t added any type annotations to the definition: if we then try to -call the closure twice, using a `String` as an argument the first time and an -`i32` the second time, we’ll get an error: +parameter. This closure isn’t very useful except for the purposes of this +example. Note that we haven’t added any type annotations to the definition: if +we then try to call the closure twice, using a `String` as an argument the +first time and a `u32` the second time, we’ll get an error: Filename: src/main.rs @@ -413,37 +407,36 @@ error if we try to use a different type with the same closure. ### Storing Closures Using Generic Parameters and the `Fn` Traits -Returning to our workout generation app, in Listing 13-6 we left our code still -calling the expensive calculation closure more times than it needs to. One +Let’s return to our workout generation app. In Listing 13-6, our code was still +calling the expensive calculation closure more times than it needed to. One option to solve this issue is to save the result of the expensive closure in a variable for reuse and use the variable instead in each place we need the -result instead of calling the closure again. This method, though, could result +result instead of calling the closure again. However, this method could result in a lot of repeated code. -Fortunately, we have another solution available to us. We can create a struct -that will hold the closure and the resulting value of calling the closure. The +Fortunately, another solution is available to us. We can create a struct that +will hold the closure and the resulting value of calling the closure. The struct will only execute the closure if we need the resulting value, and it -will cache the resulting value so that the rest of our code doesn’t have to be +will cache the resulting value so the rest of our code doesn’t have to be responsible for saving and reusing the result. You may know this pattern as *memoization* or *lazy evaluation*. -In order to make a struct that holds a closure, we need to be able to specify -the type of the closure, because a struct definition needs to know the types of -each of its fields. Each closure instance has its own unique anonymous type: -that is, even if two closures have the same signature, their types are still -considered different. In order to define structs, enums, or function parameters -that use closures, we use generics and trait bounds like we discussed in -Chapter 10. +To make a struct that holds a closure, we need to specify the type of the +closure, because a struct definition needs to know the types of each of its +fields. Each closure instance has its own unique anonymous type: that is, even +if two closures have the same signature, their types are still considered +different. To define structs, enums, or function parameters that use closures, +we use generics and trait bounds, as we discussed in Chapter 10. The `Fn` traits are provided by the standard library. All closures implement -one of the traits `Fn`, `FnMut`, or `FnOnce`. We’ll discuss the difference +one of the traits: `Fn`, `FnMut`, or `FnOnce`. We’ll discuss the difference between these traits in the next section on capturing the environment; in this example, we can use the `Fn` trait. We add types to the `Fn` trait bound to represent the types of the parameters -and return values the closures must have in order to match this trait bound. In -this case, our closure has a parameter of type `i32` and returns an `i32`, so -the trait bound we specify is `Fn(i32) -> i32`. +and return values the closures must have to match this trait bound. In this +case, our closure has a parameter of type `u32` and returns a `u32`, so the +trait bound we specify is `Fn(u32) -> u32`. Listing 13-9 shows the definition of the `Cacher` struct that holds a closure and an optional result value: @@ -452,10 +445,10 @@ Filename: src/main.rs ``` struct Cacher - where T: Fn(i32) -> i32 + where T: Fn(u32) -> u32 { calculation: T, - value: Option, + value: Option, } ``` @@ -464,16 +457,16 @@ and an optional result in `value` The `Cacher` struct has a `calculation` field of the generic type `T`. The trait bounds on `T` specify that it’s a closure by using the `Fn` trait. Any -closure we want to store in the `calculation` field must have one `i32` -parameter (specified within the parentheses after `Fn`) and must return an -`i32` (specified after the `->`). +closure we want to store in the `calculation` field must have one `u32` +parameter (specified within the parentheses after `Fn`) and must return a +`u32` (specified after the `->`). -> Note: Functions implement all three of the `Fn` traits too. If what we want to -> do doesn’t require capturing a value from the environment, we can use a +> Note: Functions implement all three of the `Fn` traits too. If what we want +> to do doesn’t require capturing a value from the environment, we can use a > function rather than a closure where we need something that implements an `Fn` > trait. -The `value` field is of type `Option`. Before we execute the closure, +The `value` field is of type `Option`. Before we execute the closure, `value` will be `None`. When code using a `Cacher` asks for the *result* of the closure, the `Cacher` will execute the closure at that time and store the result within a `Some` variant in the `value` field. Then if the code asks for @@ -487,7 +480,7 @@ Filename: src/main.rs ``` impl Cacher - where T: Fn(i32) -> i32 + where T: Fn(u32) -> u32 { fn new(calculation: T) -> Cacher { Cacher { @@ -496,7 +489,7 @@ impl Cacher } } - fn value(&mut self, arg: i32) -> i32 { + fn value(&mut self, arg: u32) -> u32 { match self.value { Some(v) => v, None => { @@ -511,19 +504,19 @@ impl Cacher Listing 13-10: The caching logic of `Cacher` -We want `Cacher` to manage the struct fields’ values, rather than letting the +We want `Cacher` to manage the struct fields’ values rather than letting the calling code potentially change the values in these fields directly, so these fields are private. The `Cacher::new` function takes a generic parameter `T`, which we’ve defined as having the same trait bound as the `Cacher` struct. Then `Cacher::new` returns a `Cacher` instance that holds the closure specified in the -`calculation` field and a `None` value in the `value` field, since we haven’t +`calculation` field and a `None` value in the `value` field, because we haven’t executed the closure yet. When the calling code wants the result of evaluating the closure, instead of calling the closure directly, it will call the `value` method. This method -checks to see if we already have a resulting value in `self.value` in a `Some`; +checks whether we already have a resulting value in `self.value` in a `Some`; if we do, it returns the value within the `Some` without executing the closure again. @@ -536,7 +529,7 @@ Listing 13-11 shows how we can use this `Cacher` struct in the Filename: src/main.rs ``` -fn generate_workout(intensity: i32, random_number: i32) { +fn generate_workout(intensity: u32, random_number: u32) { let mut expensive_result = Cacher::new(|num| { println!("calculating slowly..."); thread::sleep(Duration::from_secs(2)); @@ -576,21 +569,21 @@ calculation will be run a maximum of once. Try running this program with the `main` function from Listing 13-2. Change the values in the `simulated_user_specified_value` and `simulated_random_number` -variables to verify that in all of the cases in the various `if` and `else` -blocks, `calculating slowly...` only shows up once and only when needed. The +variables to verify that in all the cases in the various `if` and `else` +blocks, `calculating slowly...` only appears once and only when needed. The `Cacher` takes care of the logic necessary to ensure we aren’t calling the -expensive calculation more than we need to, so that `generate_workout` can -focus on the business logic. +expensive calculation more than we need to, so `generate_workout` can focus on +the business logic. ### Limitations of the `Cacher` Implementation Caching values is a generally useful behavior that we might want to use in -other parts of our code with different closures. However, there are a few +other parts of our code with different closures. However, there are two problems with the current implementation of `Cacher` that would make reusing it in different contexts difficult. -The first problem is a `Cacher` instance assumes it will always get the same -value for the parameter `arg` to the `value` method. That is, this test of +The first problem is that a `Cacher` instance assumes it will always get the +same value for the parameter `arg` to the `value` method. That is, this test of `Cacher` will fail: ``` @@ -610,38 +603,39 @@ passed into it. We call the `value` method on this `Cacher` instance with an `arg` value of 1 and then an `arg` value of 2, and we expect that the call to `value` with the `arg` value of 2 should return 2. -Run this with the `Cacher` implementation from Listing 13-9 and Listing 13-10 -and the test will fail on the `assert_eq!` with this message: +Run this test with the `Cacher` implementation in Listing 13-9 and Listing +13-10, and the test will fail on the `assert_eq!` with this message: ``` -thread 'call_with_different_arg_values' panicked at 'assertion failed: -`(left == right)` (left: `1`, right: `2`)', src/main.rs +thread 'call_with_different_values' panicked at 'assertion failed: `(left == right)` + left: `1`, + right: `2`', src/main.rs ``` The problem is that the first time we called `c.value` with 1, the `Cacher` -instance saved `Some(1)` in `self.value`. After that, no matter what we pass in +instance saved `Some(1)` in `self.value`. Thereafter, no matter what we pass in to the `value` method, it will always return 1. Try modifying `Cacher` to hold a hash map rather than a single value. The keys of the hash map will be the `arg` values that are passed in, and the values of the hash map will be the result of calling the closure on that key. Instead of looking at whether `self.value` directly has a `Some` or a `None` value, the -`value` function will look up the `arg` in the hash map and return the value, -if it’s present. If it’s not present, the `Cacher` will call the closure and -save the resulting value in the hash map associated with its `arg` value. +`value` function will look up the `arg` in the hash map and return the value if +it’s present. If it’s not present, the `Cacher` will call the closure and save +the resulting value in the hash map associated with its `arg` value. -Another problem with the current `Cacher` implementation is that it only -accepts closures that take one parameter of type `i32` and return an `i32`. We +The second problem with the current `Cacher` implementation is that it only +accepts closures that take one parameter of type `u32` and return a `u32`. We might want to cache the results of closures that take a string slice and return `usize` values, for example. To fix this issue, try introducing more generic parameters to increase the flexibility of the `Cacher` functionality. -### Closures Can Capture Their Environment +### Capturing the Environment with Closures In the workout generator example, we only used closures as inline anonymous -functions. Closures have an additional ability that functions don’t have, -however: they can capture their environment and access variables from the scope -in which they’re defined. +functions. However, closures have an additional capability that functions don’t +have: they can capture their environment and access variables from the scope in +which they’re defined. Listing 13-12 has an example of a closure stored in the variable `equal_to_x` that uses the variable `x` from the closure’s surrounding environment: @@ -667,7 +661,8 @@ Here, even though `x` is not one of the parameters of `equal_to_x`, the `equal_to_x` closure is allowed to use the `x` variable that’s defined in the same scope that `equal_to_x` is defined in. -We can’t do the same with functions; let’s see what happens if we try: +We can’t do the same with functions; if we try with the following example, our +code won’t compile: Filename: src/main.rs @@ -686,9 +681,9 @@ fn main() { We get an error: ``` -error[E0434]: can't capture dynamic environment in a fn item; use the || { ... } -closure form instead - --> +error[E0434]: can't capture dynamic environment in a fn item; use the || { ... +} closure form instead + --> src/main.rs | 4 | fn equal_to_x(z: i32) -> bool { z == x } | ^ @@ -698,7 +693,7 @@ The compiler even reminds us that this only works with closures! When a closure captures a value from its environment, it uses memory to store the values for use in the closure body. This use of memory is overhead that we -don’t want to pay in more common cases, where we want to execute code that +don’t want to pay in more common cases where we want to execute code that doesn’t capture its environment. Because functions are never allowed to capture their environment, defining and using functions will never incur this overhead. @@ -708,28 +703,29 @@ ownership, borrowing immutably, and borrowing mutably. These are encoded in the three `Fn` traits as follows: * `FnOnce` consumes the variables it captures from its enclosing scope, known - as the closure’s *environment*. In order to consume the captured variables, - the closure must take ownership of these variables and move them into the - closure when it is defined. The `Once` part of the name is because the + as the closure’s *environment*. To consume the captured variables, the + closure must take ownership of these variables and move them into the closure + when it is defined. The `Once` part of the name represents the fact that the closure can’t take ownership of the same variables more than once, so it can only be called one time. * `Fn` borrows values from the environment immutably. -* `FnMut` can change the environment since it mutably borrows values. +* `FnMut` can change the environment because it mutably borrows values. -When we create a closure, Rust infers which to use based on how the closure -uses the values from the environment. In Listing 13-12, the `equal_to_x` -closure borrows `x` immutably (so `equal_to_x` has the `Fn` trait) since the -body of the closure only needs to read the value in `x`. +When we create a closure, Rust infers which trait to use based on how the +closure uses the values from the environment. In Listing 13-12, the +`equal_to_x` closure borrows `x` immutably (so `equal_to_x` has the `Fn` trait) +because the body of the closure only needs to read the value in `x`. If we want to force the closure to take ownership of the values it uses in the -environment, we can use the `move` keyword before the parameter list. This is -mostly useful when passing a closure to a new thread in order to move the data -so that it’s owned by the new thread. +environment, we can use the `move` keyword before the parameter list. This +technique is mostly useful when passing a closure to a new thread to move the +data so it’s owned by the new thread. We’ll have more examples of `move` closures in Chapter 16 when we talk about -concurrency, but for now here’s the code from Listing 13-12 with the `move` +concurrency. For now, here’s the code from Listing 13-12 with the `move` keyword added to the closure definition and using vectors instead of integers, -since integers can be copied rather than moved: +because integers can be copied rather than moved; note that this code will not +yet compile: Filename: src/main.rs @@ -747,7 +743,7 @@ fn main() { } ``` -This example doesn’t compile: +We receive the following error: ``` error[E0382]: use of moved value: `x` @@ -760,7 +756,7 @@ error[E0382]: use of moved value: `x` | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not - implement the `Copy` trait + implement the `Copy` trait ``` The `x` value is moved into the closure when the closure is defined, because we @@ -796,16 +792,15 @@ let v1_iter = v1.iter(); Listing 13-13: Creating an iterator -Once we’ve created an iterator, we can choose to use it in a variety of ways. -In Listing 3-6 from Chapter 3, we actually used iterators with `for` loops to -execute some code on each item, though we glossed over what the call to `iter` -did until now. +Once we’ve created an iterator, we can use it in a variety of ways. In Listing +3-4 in Chapter 3, we used iterators with `for` loops to execute some code on +each item, although we glossed over what the call to `iter` did until now. The example in Listing 13-14 separates the creation of the iterator from the use of the iterator in the `for` loop. The iterator is stored in the `v1_iter` -variable, and no iteration takes place at that time. Once the `for` loop is -called using the iterator in `v1_iter`, then each element in the iterator is -used in one iteration of the loop, which prints out each value: +variable, and no iteration takes place at that time. When the `for` loop is +called using the iterator in `v1_iter`, each element in the iterator is used in +one iteration of the loop, which prints out each value: ``` let v1 = vec![1, 2, 3]; @@ -817,7 +812,7 @@ for val in v1_iter { } ``` -Listing 13-14: Making use of an iterator in a `for` loop +Listing 13-14: Using an iterator in a `for` loop In languages that don’t have iterators provided by their standard libraries, we would likely write this same functionality by starting a variable at index 0, @@ -825,14 +820,14 @@ using that variable to index into the vector to get a value, and incrementing the variable value in a loop until it gets to the total number of items in the vector. -Iterators take care of all of that logic for us, cutting down on repetitive -code we could potentially mess up. Iterators give us more flexibility to use -the same logic with many different kinds of sequences, not just data structures -we can index into like vectors. Let’s see how iterators do that. +Iterators handle all that logic for us, cutting down on repetitive code we +could potentially mess up. Iterators give us more flexibility to use the same +logic with many different kinds of sequences, not just data structures we can +index into, like vectors. Let’s examine how iterators do that. -### The `Iterator` trait and the `next` method +### The `Iterator` Trait and the `next` Method -Iterators all implement a trait named `Iterator` that is defined in the +All iterators implement a trait named `Iterator` that is defined in the standard library. The definition of the trait looks like this: ``` @@ -845,12 +840,12 @@ trait Iterator { } ``` -You’ll notice some new syntax that we haven’t covered yet: `type Item` and +Notice some new syntax that we haven’t covered yet: `type Item` and `Self::Item`, which are defining an *associated type* with this trait. We’ll -talk about associated types in depth in Chapter 19, but for now, all you need -to know is that this code says implementing the `Iterator` trait requires that -you also define an `Item` type, and this `Item` type is used in the return type -of the `next` method. In other words, the `Item` type will be the type returned +talk about associated types in depth in Chapter 19. For now, all you need to +know is that this code says implementing the `Iterator` trait requires that you +also define an `Item` type, and this `Item` type is used in the return type of +the `next` method. In other words, the `Item` type will be the type returned from the iterator. The `Iterator` trait only requires implementors to define one method: the @@ -880,8 +875,8 @@ fn iterator_demonstration() { Listing 13-15: Calling the `next` method on an iterator Note that we needed to make `v1_iter` mutable: calling the `next` method on an -iterator changes state that keeps track of where it is in the sequence. Put -another way, this code *consumes*, or uses up, the iterator. Each call to +iterator changes state that keeps track of where it is in the sequence. In +other words, this code *consumes*, or uses up, the iterator. Each call to `next` eats up an item from the iterator. We didn’t need to make `v1_iter` mutable when we used a `for` loop because the loop took ownership of `v1_iter` and made it mutable behind the scenes. @@ -893,12 +888,12 @@ ownership of `v1` and returns owned values, we can call `into_iter` instead of `iter`. Similarly, if we want to iterate over mutable references, we can call `iter_mut` instead of `iter`. -### Methods in the `Iterator` Trait that Consume the Iterator +### Methods that Consume the Iterator The `Iterator` trait has a number of different methods with default -implementations provided for us by the standard library; you can find out all -about these methods by looking in the standard library API documentation for -the `Iterator` trait. Some of these methods call the `next` method in their +implementations provided for us by the standard library; you can find out about +these methods by looking in the standard library API documentation for the +`Iterator` trait. Some of these methods call the `next` method in their definition, which is why we’re required to implement the `next` method when implementing the `Iterator` trait. @@ -927,22 +922,21 @@ fn iterator_sum() { Listing 13-16: Calling the `sum` method to get the total of all items in the iterator -We aren’t allowed to use `v1_iter` after the call to `sum` since `sum` takes +We aren’t allowed to use `v1_iter` after the call to `sum` because `sum` takes ownership of the iterator we call it on. -### Methods in the `Iterator` Trait that Produce Other Iterators +### Methods that Produce Other Iterators Other methods defined on the `Iterator` trait, known as *iterator adaptors*, allow us to change iterators into different kind of iterators. We can chain multiple calls to iterator adaptors to perform complex actions in a readable -way. Because all iterators are lazy, however, we have to call one of the -consuming adaptor methods in order to get results from calls to iterator -adaptors. +way. But because all iterators are lazy, we have to call one of the consuming +adaptor methods to get results from calls to iterator adaptors. -Listing 13-17 shows an example of calling the iterator adaptor method `map` -which takes a closure to call on each item in order to produce a new iterator. -The closure here creates a new iterator in which each item from the vector has -been incremented by 1. This code produces a warning, though: +Listing 13-17 shows an example of calling the iterator adaptor method `map`, +which takes a closure to call on each item to produce a new iterator. The +closure here creates a new iterator in which each item from the vector has been +incremented by 1. However, this code produces a warning: Filename: src/main.rs @@ -952,28 +946,28 @@ let v1: Vec = vec![1, 2, 3]; v1.iter().map(|x| x + 1); ``` -Listing 13-17: Calling the iterator adapter `map` to create a new iterator +Listing 13-17: Calling the iterator adaptor `map` to create a new iterator The warning we get is: ``` -warning: unused result which must be used: iterator adaptors are lazy and do -nothing unless consumed - --> src/main.rs:4:1 +warning: unused `std::iter::Map` which must be used: iterator adaptors are lazy +and do nothing unless consumed + --> src/main.rs:4:5 | -4 | v1.iter().map(|x| x + 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +4 | v1.iter().map(|x| x + 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unused_must_use)] on by default ``` -The code in Listing 13-17 isn’t actually doing anything; the closure we’ve -specified never gets called. The warning reminds us why: iterator adaptors are -lazy, and we need to consume the iterator here. +The code in Listing 13-17 doesn’t do anything; the closure we’ve specified +never gets called. The warning reminds us why: iterator adaptors are lazy, and +we need to consume the iterator here. -To fix this and consume the iterator, we’re going to use the `collect` method, -which we saw briefly in Chapter 12. This method consumes the iterator and -collects the resulting values into a collection data type. +To fix this and consume the iterator, we’ll use the `collect` method, which you +saw briefly in Chapter 12. This method consumes the iterator and collects the +resulting values into a collection data type. In Listing 13-18, we collect the results of iterating over the iterator that’s returned from the call to `map` into a vector. This vector will end up @@ -989,37 +983,37 @@ let v2: Vec<_> = v1.iter().map(|x| x + 1).collect(); assert_eq!(v2, vec![2, 3, 4]); ``` -Listing 13-18: Calling the `map` method to create a new iterator, then calling -the `collect` method to consume the new iterator and create a vector +Listing 13-18: Calling the `map` method to create a new iterator, and then +calling the `collect` method to consume the new iterator and create a vector Because `map` takes a closure, we can specify any operation we want to perform on each item. This is a great example of how closures let us customize some behavior while reusing the iteration behavior that the `Iterator` trait provides. -### Using Closures that Capture their Environment with Iterators +### Using Closures that Capture Their Environment Now that we’ve introduced iterators, we can demonstrate a common use of -closures that capture their environment by using the `filter` iterator adapter. +closures that capture their environment by using the `filter` iterator adaptor. The `filter` method on an iterator takes a closure that takes each item from -the iterator and returns a boolean. If the closure returns `true`, the value +the iterator and returns a Boolean. If the closure returns `true`, the value will be included in the iterator produced by `filter`. If the closure returns `false`, the value won’t be included in the resulting iterator. In Listing 13-19 we use `filter` with a closure that captures the `shoe_size` -variable from its environment, in order to iterate over a collection of `Shoe` -struct instances. It will return only shoes that are the specified size: +variable from its environment to iterate over a collection of `Shoe` struct +instances. It will return only shoes that are the specified size: Filename: src/lib.rs ``` #[derive(PartialEq, Debug)] struct Shoe { - size: i32, + size: u32, style: String, } -fn shoes_in_my_size(shoes: Vec, shoe_size: i32) -> Vec { +fn shoes_in_my_size(shoes: Vec, shoe_size: u32) -> Vec { shoes.into_iter() .filter(|s| s.size == shoe_size) .collect() @@ -1065,7 +1059,7 @@ adapted iterator into a vector that’s returned by the function. The test shows that when we call `shoes_in_my_size`, we only get back shoes that have the same size as the value we specified. -### Implementing the `Iterator` Trait to Create Our Own Iterators +### Creating Our Own Iterators with `Iterator` We’ve shown that we can create an iterator by calling `iter`, `into_iter`, or `iter_mut` on a vector. We can create iterators from the other collection types @@ -1100,15 +1094,15 @@ impl Counter { Listing 13-20: Defining the `Counter` struct and a `new` function that creates instances of `Counter` with an initial value of 0 for `count` -The `Counter` struct has one field named `count`. This holds a `u32` value that -will keep track of where we are in the process of iterating from 1 to 5. The -`count` field is private since we want the implementation of `Counter` to -manage its value. The `new` function enforces the behavior of always starting -new instances with a value of 0 in the `count` field. +The `Counter` struct has one field named `count`. This field holds a `u32` +value that will keep track of where we are in the process of iterating from 1 +to 5. The `count` field is private because we want the implementation of +`Counter` to manage its value. The `new` function enforces the behavior of +always starting new instances with a value of 0 in the `count` field. -Next, we’re going to implement the `Iterator` trait for our `Counter` type by -defining the body of the `next` method, to specify what we want to happen when -this iterator is used, as shown in Listing 13-21: +Next, we’ll implement the `Iterator` trait for our `Counter` type by defining +the body of the `next` method to specify what we want to happen when this +iterator is used, as shown in Listing 13-21: Filename: src/lib.rs @@ -1132,12 +1126,12 @@ Listing 13-21: Implementing the `Iterator` trait on our `Counter` struct We set the associated `Item` type for our iterator to `u32`, meaning the iterator will return `u32` values. Again, don’t worry about associated types -yet, we’ll be covering them in Chapter 19. +yet, we’ll cover them in Chapter 19. We want our iterator to add one to the current state, so we initialized `count` -to 0 so it would return one first. If the value of `count` is less than six, -`next` will return the current value wrapped in `Some`, but if `count` is six -or higher, our iterator will return `None`. +to 0 so it would return 1 first. If the value of `count` is less than 6, `next` +will return the current value wrapped in `Some`, but if `count` is 6 or higher, +our iterator will return `None`. #### Using Our `Counter` Iterator’s `next` Method @@ -1168,17 +1162,17 @@ This test creates a new `Counter` instance in the `counter` variable and then calls `next` repeatedly, verifying that we have implemented the behavior we want this iterator to have: returning the values from 1 to 5. -#### Using Other `Iterator` Trait Methods on Our Iterator +#### Using Other `Iterator` Trait Methods Because we implemented the `Iterator` trait by defining the `next` method, we can now use any `Iterator` trait method’s default implementations as defined in -the standard library, since they all use the `next` method’s functionality. +the standard library, because they all use the `next` method’s functionality. For example, if for some reason we wanted to take the values produced by an instance of `Counter`, pair them with values produced by another `Counter` instance after skipping the first value, multiply each pair together, keep only those results that are divisible by three, and add all the resulting values -together, we could do so as shown in the test in Listing 13-23: +together, we could do so, as shown in the test in Listing 13-23: Filename: src/lib.rs @@ -1204,20 +1198,21 @@ All of these method calls are possible because we specified how the `next` method works, and the standard library provides default implementations for other methods that call `next`. -## Improving our I/O Project +## Improving Our I/O Project + +With this new knowledge about iterators, we can improve the I/O project in +Chapter 12 by using iterators to make places in the code clearer and more +concise. Let’s look at how iterators can improve our implementation of the +`Config::new` function and the `search` function. -With this new knowledge, we can improve the I/O project in Chapter 12 by using -iterators to make places in the code clearer and more concise. Let’s take a -look at how iterators can improve our implementation of both the `Config::new` -function and the `search` function. ### Removing a `clone` Using an Iterator In Listing 12-6, we added code that took a slice of `String` values and created an instance of the `Config` struct by indexing into the slice and cloning the -values, allowing the `Config` struct to own those values. We’ve reproduced the -implementation of the `Config::new` function as it was at the end of Chapter 12 -in Listing 13-24: +values, allowing the `Config` struct to own those values. In Listing 13-24, +we’ve reproduced the implementation of the `Config::new` function as it was in +Listing 12-23 at the end of Chapter 12: Filename: src/lib.rs @@ -1241,30 +1236,27 @@ impl Config { Listing 13-24: Reproduction of the `Config::new` function from the end of Chapter 12 -At the time, we said not to worry about the inefficient `clone` calls here -because we would remove them in the future. Well, that time is now! +At the time, we said not to worry about the inefficient `clone` calls because +we would remove them in the future. Well, that time is now! We needed `clone` here because we have a slice with `String` elements in the -parameter `args`, but the `new` function doesn’t own `args`. In order to be -able to return ownership of a `Config` instance, we had to clone the values -from the `query` and `filename` fields of `Config`, so that the `Config` -instance can own its values. +parameter `args`, but the `new` function doesn’t own `args`. To return +ownership of a `Config` instance, we had to clone the values from the `query` +and `filename` fields of `Config` so the `Config` instance can own its values. With our new knowledge about iterators, we can change the `new` function to take ownership of an iterator as its argument instead of borrowing a slice. We’ll use the iterator functionality instead of the code that checks the length -of the slice and indexes into specific locations. This will clear up what the -`Config::new` function is doing since the iterator will take care of accessing -the values. +of the slice and indexes into specific locations. This will clarify what the +`Config::new` function is doing because the iterator will access the values. Once `Config::new` takes ownership of the iterator and stops using indexing operations that borrow, we can move the `String` values from the iterator into `Config` rather than calling `clone` and making a new allocation. -#### Using the Iterator Returned by `env::args` Directly +#### Using the Returned Iterator Directly -Open your I/O project’s *src/main.rs*, and we’ll change the start of the `main` -function that we had at the end of Chapter 12: +Open your I/O project’s *src/main.rs* file, which should look like this: Filename: src/main.rs @@ -1277,11 +1269,13 @@ fn main() { process::exit(1); }); - // ...snip... + // --snip-- } ``` -To the code in Listing 13-25: +We’ll change the start of the `main` function that we had in Listing 12-24 at +the end of Chapter 12 to the code in Listing 13-25. This won’t compile yet +until we update `Config::new` as well: Filename: src/main.rs @@ -1292,7 +1286,7 @@ fn main() { process::exit(1); }); - // ...snip... + // --snip-- } ``` @@ -1304,32 +1298,32 @@ we’re passing ownership of the iterator returned from `env::args` to `Config::new` directly. Next, we need to update the definition of `Config::new`. In your I/O project’s -*src/lib.rs*, let’s change the signature of `Config::new` to look like Listing -13-26: +*src/lib.rs* file, let’s change the signature of `Config::new` to look like +Listing 13-26. This still won’t compile yet because we need to update the +function body: Filename: src/lib.rs ``` impl Config { pub fn new(mut args: std::env::Args) -> Result { - // ...snip... + // --snip-- ``` Listing 13-26: Updating the signature of `Config::new` to expect an iterator The standard library documentation for the `env::args` function shows that the type of the iterator it returns is `std::env::Args`. We’ve updated the -signature of the `Config::new` function so that the parameter `args` has the -type `std::env::Args` instead of `&[String]`. Because we’re taking ownership of -`args`, and we’re going to be mutating `args` by iterating over it, we can add -the `mut` keyword into the specification of the `args` parameter to make it -mutable. +signature of the `Config::new` function so the parameter `args` has the type +`std::env::Args` instead of `&[String]`. Because we’re taking ownership of +`args` and we’ll be mutating `args` by iterating over it, we can add the `mut` +keyword into the specification of the `args` parameter to make it mutable. #### Using `Iterator` Trait Methods Instead of Indexing Next, we’ll fix the body of `Config::new`. The standard library documentation also mentions that `std::env::Args` implements the `Iterator` trait, so we know -we can call the `next` method on it! Listing 13-27 has updated the code from +we can call the `next` method on it! Listing 13-27 updates the code from Listing 12-23 to use the `next` method: Filename: src/lib.rs @@ -1368,9 +1362,9 @@ the same thing for the `filename` value. ### Making Code Clearer with Iterator Adaptors -The other place in our I/O project we could take advantage of iterators is in -the `search` function, reproduced here in Listing 13-28 as it was at the end of -Chapter 12: +We can also take advantage of iterators in the `search` function in our I/O +project, which is reproduced here in Listing 13-28 as it was in Listing 12-19 +at the end of Chapter 12: Filename: src/lib.rs @@ -1390,13 +1384,13 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { Listing 13-28: The implementation of the `search` function from Chapter 12 -We can write this code in a much more concise way using iterator adaptor -methods. This also lets us avoid having a mutable intermediate `results` -vector. The functional programming style prefers to minimize the amount of -mutable state to make code clearer. Removing the mutable state might make it -easier for us to make a future enhancement to make searching happen in -parallel, since we wouldn’t have to manage concurrent access to the `results` -vector. Listing 13-29 shows this change: +We can write this code in a more concise way using iterator adaptor methods. +Doing so also lets us avoid having a mutable intermediate `results` vector. The +functional programming style prefers to minimize the amount of mutable state to +make code clearer. Removing the mutable state might make it easier for us to +make a future enhancement to make searching happen in parallel, because we +wouldn’t have to manage concurrent access to the `results` vector. Listing +13-29 shows this change: Filename: src/lib.rs @@ -1414,35 +1408,35 @@ Listing 13-29: Using iterator adaptor methods in the implementation of the Recall that the purpose of the `search` function is to return all lines in `contents` that contain the `query`. Similar to the `filter` example in Listing 13-19, we can use the `filter` adaptor to keep only the lines that -`line.contains(query)` returns true for. We then collect the matching lines up +`line.contains(query)` returns true for. We then collect the matching lines into another vector with `collect`. Much simpler! Feel free to make the same change to use iterator methods in the `search_case_insensitive` function as well. The next logical question is which style you should choose in your own code and -why: the original implementation in Listing 13-28, or the version using +why: the original implementation in Listing 13-28 or the version using iterators in Listing 13-29. Most Rust programmers prefer to use the iterator style. It’s a bit tougher to get the hang of at first, but once you get a feel for the various iterator adaptors and what they do, iterators can be easier to understand. Instead of fiddling with the various bits of looping and building new vectors, the code focuses on the high-level objective of the loop. This -abstracts away some of the commonplace code so that it’s easier to see the -concepts that are unique to this code, like the filtering condition each -element in the iterator must pass. +abstracts away some of the commonplace code so it’s easier to see the concepts +that are unique to this code, such as the filtering condition each element in +the iterator must pass. But are the two implementations truly equivalent? The intuitive assumption might be that the more low-level loop will be faster. Let’s talk about performance. -## Comparing Performance: Loops versus Iterators +## Comparing Performance: Loops vs. Iterators -To determine which to use, we need to know which version of our `search` -functions is faster: the version with an explicit `for` loop or the version -with iterators. +To determine whether to use loops or iterators, we need to know which version +of our `search` functions is faster: the version with an explicit `for` loop or +the version with iterators. -We ran a benchmark by loading the entire contents of “The Adventures of -Sherlock Holmes” by Sir Arthur Conan Doyle into a `String` and looking for the -word “the” in the contents. Here were the results of the benchmark on the +We ran a benchmark by loading the entire contents of *The Adventures of +Sherlock Holmes* by Sir Arthur Conan Doyle into a `String` and looking for the +word “the” in the contents. Here are the results of the benchmark on the version of `search` using the `for` loop and the version using iterators: ``` @@ -1450,17 +1444,17 @@ test bench_search_for ... bench: 19,620,300 ns/iter (+/- 915,700) test bench_search_iter ... bench: 19,234,900 ns/iter (+/- 657,200) ``` -The iterator version ended up slightly faster! We’re not going to go through -the benchmark code here, as the point is not to prove that they’re exactly -equivalent, but to get a general sense of how these two implementations compare +The iterator version was slightly faster! We won’t explain the benchmark code +here, because the point is not to prove that the two versions are equivalent +but to get a general sense of how these two implementations compare performance-wise. -For a more comprehensive benchmark, you’d want to check various texts of -various sizes, different words, words of different lengths, and all kinds of -other variations. The point is this: iterators, while a high-level abstraction, +For a more comprehensive benchmark, you should check various texts of various +sizes, different words, words of different lengths, and all kinds of other +variations. The point is this: iterators, although a high-level abstraction, get compiled down to roughly the same code as if you’d written the lower-level code yourself. Iterators are one of Rust’s *zero-cost* *abstractions*, by which -we mean using the abstraction imposes no additional runtime overhead, in the +we mean using the abstraction imposes no additional runtime overhead in the same way that Bjarne Stroustrup, the original designer and implementor of C++, defines *zero-overhead*: @@ -1468,16 +1462,15 @@ defines *zero-overhead*: > don’t use, you don’t pay for. And further: What you do use, you couldn’t hand > code any better. > -> - Bjarne Stroustrup “Foundations of C++” +> Bjarne Stroustrup’s “Foundations of C++” -As another example, here is some code taken from an audio decoder. The decoding -algorithm uses the linear prediction mathematical operation to estimate future -values based on a linear function of the previous samples. - -This code uses an iterator chain to do some math on three variables in scope: a +As another example, the following code is taken from an audio decoder. The +decoding algorithm uses the linear prediction mathematical operation to +estimate future values based on a linear function of the previous samples. This +code uses an iterator chain to do some math on three variables in scope: a `buffer` slice of data, an array of 12 `coefficients`, and an amount by which to shift data in `qlp_shift`. We’ve declared the variables within this example -but not given them any values; while this code doesn’t have much meaning +but not given them any values; although this code doesn’t have much meaning outside of its context, it’s still a concise, real-world example of how Rust translates high-level ideas to low-level code: @@ -1496,39 +1489,37 @@ for i in 12..buffer.len() { } ``` -In order to calculate the value of `prediction`, this code iterates through -each of the 12 values in `coefficients` and uses the `zip` method to pair the -coefficient values with the previous 12 values in `buffer`. Then, for each -pair, we multiply the values together, sum all the results, and shift the bits -in the sum `qlp_shift` bits to the right. +To calculate the value of `prediction`, this code iterates through each of the +12 values in `coefficients` and uses the `zip` method to pair the coefficient +values with the previous 12 values in `buffer`. Then, for each pair, we +multiply the values together, sum all the results, and shift the bits in the +sum `qlp_shift` bits to the right. Calculations in applications like audio decoders often prioritize performance -most highly. Here, we’re creating an iterator, using two adaptors, then +most highly. Here, we’re creating an iterator, using two adaptors, and then consuming the value. What assembly code would this Rust code compile to? Well, as of this writing, it compiles down to the same assembly you’d write by hand. There’s no loop at all corresponding to the iteration over the values in -`coefficients`: Rust knows that there are twelve iterations, so it “unrolls” -the loop. *Unrolling* is an optimization that removes the overhead of the loop +`coefficients`: Rust knows that there are 12 iterations, so it “unrolls” the +loop. *Unrolling* is an optimization that removes the overhead of the loop controlling code and instead generates repetitive code for each iteration of the loop. All of the coefficients get stored in registers, which means it’s very fast to access the values. There are no bounds checks on the array access at runtime. All these optimizations Rust is able to apply make the resulting code extremely -efficient. - -Now that you know this, go use iterators and closures without fear! They make -code feel higher-level, but don’t impose a runtime performance penalty for -doing so. +efficient. Now that you know this, you can use iterators and closures without +fear! They make code seem like it’s higher level but don’t impose a runtime +performance penalty for doing so. ## Summary Closures and iterators are Rust features inspired by functional programming -language ideas. They contribute to Rust’s ability to clearly express high-level -ideas, at low level performance. The implementations of closures and iterators -are such that runtime performance is not affected. This is part of Rust’s goal -to strive to provide zero-cost abstractions. +language ideas. They contribute to Rust’s capability to clearly express +high-level ideas at low-level performance. The implementations of closures and +iterators are such that runtime performance is not affected. This is part of +Rust’s goal to strive to provide zero-cost abstractions. Now that we’ve improved the expressiveness of our I/O project, let’s look at -some more features of `cargo` that would help us get ready to share the project -with the world. +some more features of `cargo` that will help us share the project with the +world. diff --git a/src/doc/book/second-edition/nostarch/chapter14.md b/src/doc/book/second-edition/nostarch/chapter14.md index a2e5006858..48e1c962c3 100644 --- a/src/doc/book/second-edition/nostarch/chapter14.md +++ b/src/doc/book/second-edition/nostarch/chapter14.md @@ -220,7 +220,7 @@ Filename: src/lib.rs //! calculations more convenient. /// Adds one to the number given. -// ...snip... +// --snip-- ``` Listing 14-3: Documentation for the `my_crate` crate as a whole @@ -303,7 +303,7 @@ pub mod utils { /// Combines two primary colors in equal amounts to create /// a secondary color. pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor { - // ...snip... + // --snip-- } } ``` @@ -372,11 +372,11 @@ pub use kinds::SecondaryColor; pub use utils::mix; pub mod kinds { - // ...snip... + // --snip-- } pub mod utils { - // ...snip... + // --snip-- } ``` @@ -404,7 +404,7 @@ use art::PrimaryColor; use art::mix; fn main() { - // ...snip... + // --snip-- } ``` @@ -469,7 +469,7 @@ $ cargo publish Updating registry `https://github.com/rust-lang/crates.io-index` warning: manifest has no description, license, license-file, documentation, homepage or repository. -...snip... +--snip-- error: api errors: missing or empty metadata fields: description, license. ``` @@ -766,7 +766,7 @@ and compile the `rand` crate: $ cargo build Updating registry `https://github.com/rust-lang/crates.io-index` Downloading rand v0.3.14 - ...snip... + --snip-- Compiling rand v0.3.14 Compiling add-one v0.1.0 (file:///projects/adder/add-one) Compiling adder v0.1.0 (file:///projects/adder) @@ -926,7 +926,7 @@ the `grep` tool for searching files called `ripgrep`. If we want to install $ cargo install ripgrep Updating registry `https://github.com/rust-lang/crates.io-index` Downloading ripgrep v0.3.2 - ...snip... + --snip-- Compiling ripgrep v0.3.2 Finished release [optimized + debuginfo] target(s) in 97.91 secs Installing ~/.cargo/bin/rg diff --git a/src/doc/book/second-edition/nostarch/chapter15.md b/src/doc/book/second-edition/nostarch/chapter15.md index cbc8c67f73..8ca50e2b8f 100644 --- a/src/doc/book/second-edition/nostarch/chapter15.md +++ b/src/doc/book/second-edition/nostarch/chapter15.md @@ -1690,7 +1690,7 @@ mod tests { #[test] fn it_sends_an_over_75_percent_warning_message() { - // ...snip... + // --snip-- # let mock_messenger = MockMessenger::new(); # let mut limit_tracker = LimitTracker::new(&mock_messenger, 100); # limit_tracker.set_value(75); diff --git a/src/doc/book/second-edition/nostarch/chapter16.md b/src/doc/book/second-edition/nostarch/chapter16.md index 86b3795049..a1c18f896f 100644 --- a/src/doc/book/second-edition/nostarch/chapter16.md +++ b/src/doc/book/second-edition/nostarch/chapter16.md @@ -817,7 +817,7 @@ shown in Listing 16-11: Filename: src/main.rs ``` -// ...snip... +// --snip-- let (tx, rx) = mpsc::channel(); let tx1 = mpsc::Sender::clone(&tx); @@ -848,7 +848,7 @@ thread::spawn(move || { thread::sleep(Duration::from_secs(1)); } }); -// ...snip... +// --snip-- ``` Listing 16-11: Sending multiple messages and pausing between each one diff --git a/src/doc/book/second-edition/nostarch/chapter17.md b/src/doc/book/second-edition/nostarch/chapter17.md index b7639b83d3..6a02126feb 100644 --- a/src/doc/book/second-edition/nostarch/chapter17.md +++ b/src/doc/book/second-edition/nostarch/chapter17.md @@ -795,7 +795,7 @@ Filename: src/lib.rs ``` impl Post { - // ...snip... + // --snip-- pub fn add_text(&mut self, text: &str) { self.content.push_str(text); } @@ -828,7 +828,7 @@ Filename: src/lib.rs ``` impl Post { - // ...snip... + // --snip-- pub fn content(&self) -> &str { "" } @@ -860,7 +860,7 @@ Filename: src/lib.rs ``` impl Post { - // ...snip... + // --snip-- pub fn request_review(&mut self) { if let Some(s) = self.state.take() { self.state = Some(s.request_review()) @@ -943,7 +943,7 @@ Filename: src/lib.rs ``` impl Post { - // ...snip... + // --snip-- pub fn approve(&mut self) { if let Some(s) = self.state.take() { self.state = Some(s.approve()) @@ -959,7 +959,7 @@ trait State { struct Draft {} impl State for Draft { - // ...snip... + // --snip-- fn approve(self: Box) -> Box { self } @@ -968,7 +968,7 @@ impl State for Draft { struct PendingReview {} impl State for PendingReview { - // ...snip... + // --snip-- fn approve(self: Box) -> Box { Box::new(Published {}) } @@ -1007,11 +1007,11 @@ Filename: src/lib.rs ``` impl Post { - // ...snip... + // --snip-- pub fn content(&self) -> &str { self.state.as_ref().unwrap().content(&self) } - // ...snip... + // --snip-- } ``` @@ -1047,17 +1047,17 @@ Filename: src/lib.rs ``` trait State { - // ...snip... + // --snip-- fn content<'a>(&self, post: &'a Post) -> &'a str { "" } } -// ...snip... +// --snip-- struct Published {} impl State for Published { - // ...snip... + // --snip-- fn content<'a>(&self, post: &'a Post) -> &'a str { &post.content } @@ -1237,7 +1237,7 @@ Filename: src/lib.rs ``` impl DraftPost { - // ...snip... + // --snip-- pub fn request_review(self) -> PendingReviewPost { PendingReviewPost { diff --git a/src/doc/book/second-edition/nostarch/chapter19.md b/src/doc/book/second-edition/nostarch/chapter19.md index 5bbc93c393..e7c3c5e71c 100644 --- a/src/doc/book/second-edition/nostarch/chapter19.md +++ b/src/doc/book/second-edition/nostarch/chapter19.md @@ -110,9 +110,9 @@ Raw pointers: - Are allowed to ignore the borrowing rules and have both immutable and a mutable pointer or multiple mutable pointers to the same location -- Aren't guaranteed to point to valid memory +- Aren’t guaranteed to point to valid memory - Are allowed to be null -- Don't implement any automatic clean-up +- Don’t implement any automatic clean-up Listing 19-1 shows how to create raw pointers from references: @@ -129,7 +129,7 @@ The `*const T` type is an immutable raw pointer, and `*mut T` is a mutable raw pointer. We’ve created raw pointers by using `as` to cast an immutable and a mutable reference into their corresponding raw pointer types. These particular raw pointers will be valid since we created them directly from references that -are guaranteed to be valid, but we can't make that assumption about any raw +are guaranteed to be valid, but we can’t make that assumption about any raw pointer. Listing 19-2 shows how to create a raw pointer to an arbitrary location in @@ -1032,7 +1032,7 @@ like Listing 19-23: ``` fn distance>(graph: &G, start: &N, end: &N) -> u32 { - // ...snip... + // --snip-- } ``` @@ -1051,7 +1051,7 @@ Contrast with the definition of `distance` in Listing 19-24 that uses the ``` fn distance(graph: &G, start: &G::Node, end: &G::Node) -> u32 { - // ...snip... + // --snip-- } ``` @@ -1072,7 +1072,7 @@ trait object: ``` fn distance(graph: &GGraph, start: &N, end: &N) -> u32 { - // ...snip... + // --snip-- } ``` @@ -1094,7 +1094,7 @@ for their `Edge` type: ``` fn traverse(graph: &AGraph) { - // ...snip... + // --snip-- } ``` @@ -1561,11 +1561,11 @@ like that in Listing 19-31: let f: Box = Box::new(|| println!("hi")); fn takes_long_type(f: Box) { - // ...snip... + // --snip-- } fn returns_long_type() -> Box { - // ...snip... + // --snip-- } ``` @@ -1582,11 +1582,11 @@ type Thunk = Box; let f: Thunk = Box::new(|| println!("hi")); fn takes_long_type(f: Thunk) { - // ...snip... + // --snip-- } fn returns_long_type() -> Thunk { - // ...snip... + // --snip-- } ``` @@ -1652,7 +1652,7 @@ function will never return. For example: ``` fn bar() -> ! { - // ...snip... + // --snip-- } ``` @@ -1795,7 +1795,7 @@ That is, a generic function definition like this: ``` fn generic(t: T) { - // ...snip... + // --snip-- } ``` @@ -1803,7 +1803,7 @@ is actually treated as if we had written this: ``` fn generic(t: T) { - // ...snip... + // --snip-- } ``` @@ -1813,7 +1813,7 @@ restriction: ``` fn generic(t: &T) { - // ...snip... + // --snip-- } ``` diff --git a/src/doc/book/second-edition/nostarch/chapter20.md b/src/doc/book/second-edition/nostarch/chapter20.md index 2aa7fbffdc..4def0c3de7 100644 --- a/src/doc/book/second-edition/nostarch/chapter20.md +++ b/src/doc/book/second-edition/nostarch/chapter20.md @@ -391,7 +391,7 @@ Filename: src/main.rs ``` use std::fs::File; -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { let mut buffer = [0; 512]; @@ -442,7 +442,7 @@ add code to treat requests differently: Filename: src/main.rs ``` -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { let mut buffer = [0; 512]; @@ -495,7 +495,7 @@ browser indicating as such to the end user: Filename: src/main.rs ``` -// ...snip... +// --snip-- } else { let status_line = "HTTP/1.1 404 NOT FOUND\r\n\r\n"; @@ -554,10 +554,10 @@ shown in Listing 20-9: Filename: src/main.rs ``` -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { - // ...snip... + // --snip-- let (status_line, filename) = if buffer.starts_with(get) { ("HTTP/1.1 200 OK\r\n\r\n", "hello.html") @@ -625,10 +625,10 @@ Filename: src/main.rs ``` use std::thread; use std::time::Duration; -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { - // ...snip... + // --snip-- let get = b"GET / HTTP/1.1\r\n"; let sleep = b"GET /sleep HTTP/1.1\r\n"; @@ -642,7 +642,7 @@ fn handle_connection(mut stream: TcpStream) { ("HTTP/1.1 404 NOT FOUND\r\n\r\n", "404.html") }; - // ...snip... + // --snip-- } ``` @@ -922,7 +922,7 @@ Filename: src/lib.rs ``` impl ThreadPool { - // ...snip... + // --snip-- pub fn execute(&self, f: F) where @@ -1003,7 +1003,7 @@ impl ThreadPool { ThreadPool } - // ...snip... + // --snip-- } ``` @@ -1063,7 +1063,7 @@ pub struct ThreadPool { } impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: u32) -> ThreadPool { assert!(size > 0); @@ -1078,7 +1078,7 @@ impl ThreadPool { } } - // ...snip... + // --snip-- } ``` @@ -1164,7 +1164,7 @@ pub struct ThreadPool { } impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -1178,7 +1178,7 @@ impl ThreadPool { workers } } - // ...snip... + // --snip-- } struct Worker { @@ -1250,7 +1250,7 @@ hold anything for now: Filename: src/lib.rs ``` -// ...snip... +// --snip-- use std::sync::mpsc; pub struct ThreadPool { @@ -1261,7 +1261,7 @@ pub struct ThreadPool { struct Job; impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -1278,7 +1278,7 @@ impl ThreadPool { sender, } } - // ...snip... + // --snip-- } ``` @@ -1298,7 +1298,7 @@ Filename: src/lib.rs ``` impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -1315,10 +1315,10 @@ impl ThreadPool { sender, } } - // ...snip... + // --snip-- } -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: mpsc::Receiver) -> Worker { @@ -1382,10 +1382,10 @@ Filename: src/lib.rs use std::sync::Arc; use std::sync::Mutex; -// ...snip... +// --snip-- impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -1405,12 +1405,12 @@ impl ThreadPool { } } - // ...snip... + // --snip-- } impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { - // ...snip... + // --snip-- } } ``` @@ -1433,12 +1433,12 @@ this is such a case! Take a look at Listing 20-19: Filename: src/lib.rs ``` -// ...snip... +// --snip-- type Job = Box; impl ThreadPool { - // ...snip... + // --snip-- pub fn execute(&self, f: F) where @@ -1450,7 +1450,7 @@ impl ThreadPool { } } -// ...snip... +// --snip-- ``` Listing 20-19: Creating a `Job` type alias for a `Box` that holds each closure, @@ -1474,7 +1474,7 @@ change shown in Listing 20-20 to `Worker::new`: Filename: src/lib.rs ``` -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { @@ -1575,7 +1575,7 @@ impl FnBox for F { type Job = Box; -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { @@ -1793,7 +1793,7 @@ Filename: src/lib.rs ``` impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { - // ...snip... + // --snip-- Worker { id, @@ -1865,16 +1865,16 @@ pub struct ThreadPool { sender: mpsc::Sender, } -// ...snip... +// --snip-- impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); let (sender, receiver) = mpsc::channel(); - // ...snip... + // --snip-- } pub fn execute(&self, f: F) @@ -1887,7 +1887,7 @@ impl ThreadPool { } } -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: Arc>>) -> diff --git a/src/doc/book/second-edition/src/SUMMARY.md b/src/doc/book/second-edition/src/SUMMARY.md index 6a173688c5..c7f8306748 100644 --- a/src/doc/book/second-edition/src/SUMMARY.md +++ b/src/doc/book/second-edition/src/SUMMARY.md @@ -67,11 +67,11 @@ ## Thinking in Rust -- [Functional Language Features in Rust](ch13-00-functional-features.md) - - [Closures](ch13-01-closures.md) - - [Iterators](ch13-02-iterators.md) - - [Improving our I/O Project](ch13-03-improving-our-io-project.md) - - [Performance](ch13-04-performance.md) +- [Functional Language Features: Iterators and Closures](ch13-00-functional-features.md) + - [Closures: Anonymous Functions that Can Capture Their Environment](ch13-01-closures.md) + - [Processing a Series of Items with Iterators](ch13-02-iterators.md) + - [Improving Our I/O Project](ch13-03-improving-our-io-project.md) + - [Comparing Performance: Loops vs. Iterators](ch13-04-performance.md) - [More about Cargo and Crates.io](ch14-00-more-about-cargo.md) - [Customizing Builds with Release Profiles](ch14-01-release-profiles.md) @@ -123,8 +123,8 @@ - [Appendix](appendix-00.md) - [A - Keywords](appendix-01-keywords.md) - - [B - Operators](appendix-02-operators.md) - - [C - Derivable Traits]() - - [D - Macros]() - - [E - Translations]() - - [F - Newest Features](appendix-07-newest-features.md) + - [B - Operators and Symbols](appendix-02-operators.md) + - [C - Derivable Traits](appendix-03-derivable-traits.md) + - [D - Macros](appendix-04-macros.md) + - [E - Translations](appendix-05-translation.md) + - [F - Newest Features](appendix-06-newest-features.md) diff --git a/src/doc/book/second-edition/src/appendix-01-keywords.md b/src/doc/book/second-edition/src/appendix-01-keywords.md index f578103c99..cc93c4c0fa 100644 --- a/src/doc/book/second-edition/src/appendix-01-keywords.md +++ b/src/doc/book/second-edition/src/appendix-01-keywords.md @@ -17,7 +17,7 @@ or lifetimes. * `else` - fallback for `if` and `if let` control flow constructs * `enum` - defining an enumeration * `extern` - external crate, function, and variable linkage -* `false` - boolean false literal +* `false` - Boolean false literal * `fn` - function definition and function pointer type * `for` - iterator loop, part of trait impl syntax, and higher-ranked lifetime syntax @@ -39,7 +39,7 @@ or lifetimes. * `struct` - structure definition * `super` - parent module of the current module * `trait` - trait definition -* `true` - boolean true literal +* `true` - Boolean true literal * `type` - type alias and associated type definition * `unsafe` - denotes unsafe code, functions, traits, and implementations * `use` - import symbols into scope diff --git a/src/doc/book/second-edition/src/appendix-02-operators.md b/src/doc/book/second-edition/src/appendix-02-operators.md index ac36623be0..a5a73d3634 100644 --- a/src/doc/book/second-edition/src/appendix-02-operators.md +++ b/src/doc/book/second-edition/src/appendix-02-operators.md @@ -1,195 +1,154 @@ -## Appendix B: Operators +## Appendix B: Operators and Symbols -### Unary operator expressions +### Operators -Rust defines the following unary operators. They are all written as prefix -operators, before the expression they apply to. +The following lists the operators in Rust, an example of how the operator would +appear in context, a short explanation, and whether that operator is +overloadable. If an operator is overloadable, the relevant trait to use to +overload that operator is listed. -* `-` - : Negation. Signed integer types and floating-point types support negation. It - is an error to apply negation to unsigned types; for example, the compiler - rejects `-1u32`. -* `*` - : Dereference. When applied to a pointer, it denotes the pointed-to location. - For pointers to mutable locations, the resulting value can be assigned to. - On non-pointer types, it calls the `deref` method of the `std::ops::Deref` - trait, or the `deref_mut` method of the `std::ops::DerefMut` trait (if - implemented by the type and required for an outer expression that will or - could mutate the dereference), and produces the result of dereferencing the - `&` or `&mut` borrowed pointer returned from the overload method. -* `!` - : Logical negation. On the boolean type, this flips between `true` and - `false`. On integer types, this inverts the individual bits in the - two’s complement representation of the value. -* `&` and `&mut` - : Borrowing. When applied to a value, these operators produce a - reference (pointer) to that value. The value is also placed into - a borrowed state for the duration of the reference. For a shared - borrow (`&`), this implies that the value may not be mutated, but - it may be read or shared again. For a mutable borrow (`&mut`), the - value may not be accessed in any way until the borrow expires. +* `!` (`ident!(…)`, `ident!{…}`, `ident![…]`): denotes macro expansion. +* `!` (`!expr`): bitwise or logical complement. Overloadable (`Not`). +* `!=` (`var != expr`): nonequality comparison. Overloadable (`PartialEq`). +* `%` (`expr % expr`): arithmetic remainder. Overloadable (`Rem`). +* `%=` (`var %= expr`): arithmetic remainder and assignment. Overloadable (`RemAssign`). +* `&` (`&expr`, `&mut expr`): borrow. +* `&` (`&type`, `&mut type`, `&'a type`, `&'a mut type`): borrowed pointer type. +* `&` (`expr & expr`): bitwise AND. Overloadable (`BitAnd`). +* `&=` (`var &= expr`): bitwise AND and assignment. Overloadable (`BitAndAssign`). +* `&&` (`expr && expr`): logical AND. +* `*` (`expr * expr`): arithmetic multiplication. Overloadable (`Mul`). +* `*` (`*expr`): dereference. +* `*` (`*const type`, `*mut type`): raw pointer. +* `*=` (`var *= expr`): arithmetic multiplication and assignment. Overloadable (`MulAssign`). +* `+` (`trait + trait`, `'a + trait`): compound type constraint. +* `+` (`expr + expr`): arithmetic addition. Overloadable (`Add`). +* `+=` (`var += expr`): arithmetic addition and assignment. Overloadable (`AddAssign`). +* `,`: argument and element separator. +* `-` (`- expr`): arithmetic negation. Overloadable (`Neg`). +* `-` (`expr - expr`): arithmetic subtraction. Overloadable (`Sub`). +* `-=` (`var -= expr`): arithmetic subtraction and assignment. Overloadable (`SubAssign`). +* `->` (`fn(…) -> type`, `|…| -> type`): function and closure return type. +* `.` (`expr.ident`): member access. +* `..` (`..`, `expr..`, `..expr`, `expr..expr`): right-exclusive range literal. +* `..` (`..expr`): struct literal update syntax. +* `..` (`variant(x, ..)`, `struct_type { x, .. }`): “and the rest” pattern binding. +* `...` (`...expr`, `expr...expr`) *in an expression*: inclusive range expression. +* `...` (`expr...expr`) *in a pattern*: inclusive range pattern. +* `/` (`expr / expr`): arithmetic division. Overloadable (`Div`). +* `/=` (`var /= expr`): arithmetic division and assignment. Overloadable (`DivAssign`). +* `:` (`pat: type`, `ident: type`): constraints. +* `:` (`ident: expr`): struct field initializer. +* `:` (`'a: loop {…}`): loop label. +* `;`: statement and item terminator. +* `;` (`[…; len]`): part of fixed-size array syntax +* `<<` (`expr << expr`): left-shift. Overloadable (`Shl`). +* `<<=` (`var <<= expr`): left-shift and assignment. Overloadable (`ShlAssign`). +* `<` (`expr < expr`): less-than comparison. Overloadable (`PartialOrd`). +* `<=` (`var <= expr`): less-than or equal-to comparison. Overloadable (`PartialOrd`). +* `=` (`var = expr`, `ident = type`): assignment/equivalence. +* `==` (`var == expr`): equality comparison. Overloadable (`PartialEq`). +* `=>` (`pat => expr`): part of match arm syntax. +* `>` (`expr > expr`): greater-than comparison. Overloadable (`PartialOrd`). +* `>=` (`var >= expr`): greater-than or equal-to comparison. Overloadable (`PartialOrd`). +* `>>` (`expr >> expr`): right-shift. Overloadable (`Shr`). +* `>>=` (`var >>= expr`): right-shift and assignment. Overloadable (`ShrAssign`). +* `@` (`ident @ pat`): pattern binding. +* `^` (`expr ^ expr`): bitwise exclusive OR. Overloadable (`BitXor`). +* `^=` (`var ^= expr`): bitwise exclusive OR and assignment. Overloadable (`BitXorAssign`). +* `|` (`pat | pat`): pattern alternatives. +* `|` (`|…| expr`): closures. +* `|` (`expr | expr`): bitwise OR. Overloadable (`BitOr`). +* `|=` (`var |= expr`): bitwise OR and assignment. Overloadable (`BitOrAssign`). +* `||` (`expr || expr`): logical OR. +* `_`: “ignored” pattern binding. Also used to make integer-literals readable. +* `?` (`expr?`): Error propagation. -### Binary operator expressions +### Non-operator Symbols -Binary operators expressions are given in order of operator precedence. +#### Standalone Syntax -#### Arithmetic operators +* `'ident`: named lifetime or loop label +* `…u8`, `…i32`, `…f64`, `…usize`, *etc.*: numeric literal of specific type. +* `"…"`: string literal. +* `r"…"`, `r#"…"#`, `r##"…"##`, *etc.*: raw string literal, escape characters are not processed. +* `b"…"`: byte string literal, constructs a `[u8]` instead of a string. +* `br"…"`, `br#"…"#`, `br##"…"##`, *etc.*: raw byte string literal, combination of raw and byte string literal. +* `'…'`: character literal. +* `b'…'`: ASCII byte literal. +* `|…| expr`: closure. +* `!`: always empty bottom type for diverging functions. -Binary arithmetic expressions are syntactic sugar for calls to built-in traits, -defined in the `std::ops` module of the `std` library. This means arithmetic -operators can be overridden for user-defined types. The default meaning of the -operators on standard types is given here. +#### Path-related Syntax -* `+` - : Addition and array/string concatenation. - Calls the `add` method on the `std::ops::Add` trait. -* `-` - : Subtraction. - Calls the `sub` method on the `std::ops::Sub` trait. -* `*` - : Multiplication. - Calls the `mul` method on the `std::ops::Mul` trait. -* `/` - : Quotient. - Calls the `div` method on the `std::ops::Div` trait. -* `%` - : Remainder. - Calls the `rem` method on the `std::ops::Rem` trait. +* `ident::ident`: namespace path. +* `::path`: path relative to the crate root (*i.e.* an explicitly absolute path). +* `self::path`: path relative to the current module (*i.e.* an explicitly relative path). +* `super::path`: path relative to the parent of the current module. +* `type::ident`, `::ident`: associated constants, functions, and types. +* `::…`: associated item for a type which cannot be directly named (*e.g.* `<&T>::…`, `<[T]>::…`, *etc.*). +* `trait::method(…)`: disambiguating a method call by naming the trait which defines it. +* `type::method(…)`: disambiguating a method call by naming the type for which it’s defined. +* `::method(…)`: disambiguating a method call by naming the trait *and* type. -Note that Rust does not have a built-in operator for exponential (power) -calculation; see the `pow` method on the numeric types. +#### Generics -#### Bitwise operators +* `path<…>` (*e.g.* `Vec`): specifies parameters to generic type *in a type*. +* `path::<…>`, `method::<…>` (*e.g.* `"42".parse::()`): specifies parameters to generic type, function, or method *in an expression*. Often referred to as *turbofish*. +* `fn ident<…> …`: define generic function. +* `struct ident<…> …`: define generic structure. +* `enum ident<…> …`: define generic enumeration. +* `impl<…> …`: define generic implementation. +* `for<…> type`: higher-ranked lifetime bounds. +* `type` (*e.g.* `Iterator`): a generic type where one or more associated types have specific assignments. -Like the arithmetic operators, bitwise operators are syntactic sugar for calls -to methods of built-in traits. This means bitwise operators can be overridden -for user-defined types. The default meaning of the operators on standard types -is given here. Bitwise `&`, `|` and `^` applied to boolean arguments are -equivalent to logical `&&`, `||` and `!=` evaluated in non-lazy fashion. +#### Trait Bound Constraints -* `&` - : Bitwise AND. - Calls the `bitand` method of the `std::ops::BitAnd` trait. -* `|` - : Bitwise inclusive OR. - Calls the `bitor` method of the `std::ops::BitOr` trait. -* `^` - : Bitwise exclusive OR. - Calls the `bitxor` method of the `std::ops::BitXor` trait. -* `<<` - : Left shift. - Calls the `shl` method of the `std::ops::Shl` trait. -* `>>` - : Right shift (arithmetic). - Calls the `shr` method of the `std::ops::Shr` trait. +* `T: U`: generic parameter `T` constrained to types that implement `U`. +* `T: 'a`: generic type `T` must outlive lifetime `'a`. When we say that a type ‘outlives’ the lifetime, we mean that it cannot transitively contain any references with lifetimes shorter than `'a`. +* `T : 'static`: The generic type `T` contains no borrowed references other than `'static` ones. +* `'b: 'a`: generic lifetime `'b` must outlive lifetime `'a`. +* `T: ?Sized`: allow generic type parameter to be a dynamically-sized type. +* `'a + trait`, `trait + trait`: compound type constraint. -#### Lazy boolean operators +#### Macros and Attributes -The operators `||` and `&&` may be applied to operands of boolean type. The -`||` operator denotes logical ‘or’, and the `&&` operator denotes logical -‘and’. They differ from `|` and `&` in that the right-hand operand is only -evaluated when the left-hand operand does not already determine the result of -the expression. That is, `||` only evaluates its right-hand operand when the -left-hand operand evaluates to `false`, and `&&` only when it evaluates to -`true`. +* `#[meta]`: outer attribute. +* `#![meta]`: inner attribute. +* `$ident`: macro substitution. +* `$ident:kind`: macro capture. +* `$(…)…`: macro repetition. -#### Comparison operators +#### Comments -Comparison operators are, like the arithmetic operators and bitwise operators, -syntactic sugar for calls to built-in traits. This means that comparison -operators can be overridden for user-defined types. The default meaning of the -operators on standard types is given here. +* `//`: line comment. +* `//!`: inner line doc comment. +* `///`: outer line doc comment. +* `/*…*/`: block comment. +* `/*!…*/`: inner block doc comment. +* `/**…*/`: outer block doc comment. -* `==` - : Equal to. - Calls the `eq` method on the `std::cmp::PartialEq` trait. -* `!=` - : Unequal to. - Calls the `ne` method on the `std::cmp::PartialEq` trait. -* `<` - : Less than. - Calls the `lt` method on the `std::cmp::PartialOrd` trait. -* `>` - : Greater than. - Calls the `gt` method on the `std::cmp::PartialOrd` trait. -* `<=` - : Less than or equal. - Calls the `le` method on the `std::cmp::PartialOrd` trait. -* `>=` - : Greater than or equal. - Calls the `ge` method on the `std::cmp::PartialOrd` trait. +#### Tuples -#### Type cast expressions +* `()`: empty tuple (*a.k.a.* unit), both literal and type. +* `(expr)`: parenthesized expression. +* `(expr,)`: single-element tuple expression. +* `(type,)`: single-element tuple type. +* `(expr, …)`: tuple expression. +* `(type, …)`: tuple type. +* `expr(expr, …)`: function call expression. Also used to initialize tuple `struct`s and tuple `enum` variants. +* `ident!(…)`, `ident!{…}`, `ident![…]`: macro invocation. +* `expr.0`, `expr.1`, …: tuple indexing. -A type cast expression is denoted with the binary operator `as`. +#### Curly Brackets -Executing an `as` expression casts the value on the left-hand side to the type -on the right-hand side. +* `{…}`: block expression. +* `Type {…}`: `struct` literal. -An example of an `as` expression: +#### Square Brackets -```rust -# fn sum(values: &[f64]) -> f64 { 0.0 } -# fn len(values: &[f64]) -> i32 { 0 } - -fn average(values: &[f64]) -> f64 { - let sum: f64 = sum(values); - let size: f64 = len(values) as f64; - sum / size -} -``` - -Some of the conversions which can be done through the `as` operator -can also be done implicitly at various points in the program, such as -argument passing and assignment to a `let` binding with an explicit -type. Implicit conversions are limited to “harmless” conversions that -do not lose information and which have minimal or no risk of -surprising side-effects on the dynamic execution semantics. - -#### Assignment expressions - -An *assignment expression* consists of a pattern followed by an equals -sign (`=`) and an expression. - -Evaluating an assignment expression either copies or -moves its right-hand operand to its left-hand -operand. - -``` -# let mut x = 0; -# let y = 0; -x = y; -``` - -#### Compound assignment expressions - -The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be -composed with the `=` operator. The expression `lval OP= val` is equivalent to -`lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`. - -Any such expression always has the `unit` type. - -#### Operator precedence - -The precedence of Rust operators is ordered as follows, going from strong to -weak. Binary Operators at the same precedence level are evaluated in the order -given by their associativity. - - -| Operator | Associativity | -|-----------------------------|---------------------| -| `?` | | -| Unary `-` `*` `!` `&` `&mut` | | -| `as` `:` | left to right | -| `*` `/` `%` | left to right | -| `+` `-` | left to right | -| `<<` `>>` | left to right | -| `&` | left to right | -| `^` | left to right | -| | | left to right | -| `==` `!=` `<` `>` `<=` `>=` | Require parentheses | -| `&&` | left to right | -| || | left to right | -| `..` `...` | Require parentheses | -| `<-` | right to left | -| `=` `+=` `-=` `*=` `/=` `%=`
`&=` |= `^=` `<<=` `>>=` | right to left | +* `[…]`: array literal. +* `[expr; len]`: array literal containing `len` copies of `expr`. +* `[type; len]`: array type containing `len` instances of `type`. +* `expr[expr]`: collection indexing. Overloadable (`Index`, `IndexMut`). +* `expr[..]`, `expr[a..]`, `expr[..b]`, `expr[a..b]`: collection indexing pretending to be collection slicing, using `Range`, `RangeFrom`, `RangeTo`, `RangeFull` as the “index”. diff --git a/src/doc/book/second-edition/src/appendix-03-derivable-traits.md b/src/doc/book/second-edition/src/appendix-03-derivable-traits.md new file mode 100644 index 0000000000..9edb6f4745 --- /dev/null +++ b/src/doc/book/second-edition/src/appendix-03-derivable-traits.md @@ -0,0 +1,212 @@ +# C - Derivable Traits + +In various places in the book, we discussed the `derive` attribute that is +applied to a struct or enum. This attribute generates code that implements a +trait on the annotated type with a default implementation. In this example, the +`#[derive(Debug)]` attribute implements the `Debug` trait for the `Point` +struct: + +```rust +#[derive(Debug)] +struct Point { + x: i32, + y: i32, +} +``` + +The code that the compiler generates for the implementation of `Debug` is +similar to this code: + +```rust +# struct Point { +# x: i32, +# y: i32, +# } +# +impl ::std::fmt::Debug for Point { + fn fmt(&self, __arg_0: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match *self { + Point { x: ref __self_0_0, y: ref __self_0_1 } => { + let mut builder = __arg_0.debug_struct("Point"); + let _ = builder.field("x", &&(*__self_0_0)); + let _ = builder.field("y", &&(*__self_0_1)); + builder.finish() + } + } + } +} +``` + +The generated code implements sensible default behavior for the `Debug` trait’s +`fmt` function: a `match` expression destructures a `Point` instance into its +field values. Then it builds up a string containing the struct’s name and each +field’s name and value. This means we’re able to use debug formatting on a +`Point` instance to see what value each field has. + +The generated code isn’t particularly easy to read because it’s only for the +compiler to consume, rather than for programmers to read! The `derive` +attribute and the default implementation of `Debug` has saved us all of the +work of writing this code for every struct or enum that we want to be able to +print using debug formatting. + +The `derive` attribute has default implementations for the following traits +provided by the standard library. If you want different behavior than what the +`derive` attribute provides, consult the standard library documentation for +each trait for the details needed for manual implementation of the traits. + +## Standard Library Traits that Can Be Derived + +The following sections list all of the traits in the standard library that can +be used with `derive`. Each section covers: + +- What operators and methods deriving this trait will enable +- What the implementation of the trait provided by `derive` does +- What implementing the trait signifies about the type +- The conditions in which you’re allowed or not allowed to implement the trait +- Examples of operations that require the trait + +### `Debug` for Programmer Output + +The `Debug` trait enables debug formatting in format strings, indicated by +adding `:?` within `{}` placeholders. + +The `Debug` trait signifies that instances of a type may be printed by +programmers in order to debug their programs by inspecting an instance of a +type at a particular point in a program’s execution. + +An example of when `Debug` is required is the `assert_eq!` macro, which prints +the values of the instances given as arguments if the equality assertion fails +so that programmers can see why the two instances weren’t equal. + +### `PartialEq` and `Eq` for Equality Comparisons + +The `PartialEq` trait signifies that instances of a type can be compared to +each other for equality, and enables use of the `==` and `!=` operators. + +Deriving `PartialEq` implements the `eq` method. When derived on structs, two +instances are equal if all fields are equal, and not equal if any fields are +not equal. When derived on enums, each variant is equal to itself and not equal +to the other variants. + +An example of when `PartialEq` is required is the `assert_eq!` macro, which +needs to be able to compare two instances of a type for equality. + +The `Eq` trait doesn’t have any methods. It only signals that for every value +of the annotated type, the value is equal to itself. The `Eq` trait can only be +applied to types that also implement `PartialEq`. An example of types that +implements `PartialEq` but that cannot implement `Eq` are floating point number +types: the implementation of floating point numbers says that two instances of +the not-a-number value, `NaN`, are not equal to each other. + +An example of when `Eq` is required is for keys in a `HashMap` so that the +`HashMap` can tell whether two keys are the same. + +### `PartialOrd` and `Ord` for Ordering Comparisons + +The `PartialOrd` trait signifies that instances of a type can be compared to +each other to see which is larger than the other for sorting purposes. A type +that implements `PartialOrd` may be used with the `<`, `>`, `<=`, and `>=` +operators. The `PartialOrd` trait can only be applied to types that also +implement `PartialEq`. + +Deriving `PartialOrd` implements the `partial_cmp` method, which returns an +`Option` that may be `None` if comparing the given values does not +produce an ordering. When derived on structs, two instances of the struct are +compared by comparing the value in each field in the order in which the fields +appear in the struct definition. When derived on enums, variants of the enum +declared earlier in the enum definition are greater than the variants listed +later. + +An example of when `PartialOrd` is required is the `gen_range` method in the +`rand` crate that generates a random value in the range specified by a low +value and a high value. + +The `Ord` trait signifies that for any two value of the annotated type, a valid +ordering exists. The `Ord` trait implements the `cmp` method, which returns an +`Ordering` rather than an `Option` because a valid ordering will +always be possible. The `Ord` trait can only be applied to types that also +implement `PartialOrd` and `Eq` (and `Eq` requires `PartialEq`). When derived +on structs and enums, `cmp` behaves the same way as the derived implementation +for `partial_cmp` does with `PartialOrd`. + +An example of when `Ord` is required is when storing values in a `BTreeSet`, +a data structure that stores data based on the sort order of the values. + +### `Clone` and `Copy` for Duplicating Values + +The `Clone` trait signifies there is a way to explicitly create a duplicate of +a value, and the duplication process might involve running arbitrary code. +Deriving `Clone` implements the `clone` method. When derived, the +implementation of `clone` for the whole type calls `clone` on each of the parts +of the type, so all of the fields or values in the type must also implement +`Clone` to derive `Clone`. + +An example of when `Clone` is required is when calling the `to_vec` method on a +slice containing instances of some type. The slice doesn’t own the instances +but the vector returned from `to_vec` will need to own its instances, so the +implementation of `to_vec` calls `clone` on each item. Thus, the type stored in +the slice must implement `Clone`. + +The `Copy` trait signifies that a value can be duplicated by only copying bits; +no other code is necessary. The `Copy` trait does not define any methods to +prevent programmers from overloading those methods violating the assumption +that no arbitrary code is being run. You can derive `Copy` on any type whose +parts all implement `Copy`. The `Copy` trait can only be applied to types that +also implement `Clone`, as a type that implements `Copy` has a trivial +implementation of `Clone`, doing the same thing as `Copy`. + +`Copy` is rarely required; when types implement `Copy`, there are optimizations +that can be applied and the code becomes nicer because you don’t have to call +`clone`. Everything possible with `Copy` can also be accomplished with `Clone`, +but the code might be slower or have to use `clone` in places. + +### `Hash` for Mapping a Value to a Value of Fixed Size + +The `Hash` trait signifies there is a way to take an instance of a type that +takes up an arbitrary amount of size and map that instance to a value of fixed +size by using a hash function. Deriving `Hash` implements the `hash` method. +When derived, the implementation of `hash` for the whole type combines the +result of calling `hash` on each of the parts of the type, so all of the fields +or values in the type must also implement `Hash` to derive `Hash`. + +An example of when `Hash` is required is for keys in a `HashMap` so that the +`HashMap` can store data efficiently. + +### `Default` for Default Values + +The `Default` trait signifies there is a way to create a default value for a +type. Deriving `Default` implements the `default` method. When derived, the +implementation of `Default` for the whole type calls the `default` method on +each of the parts of the type, so all of the fields or values in the type must +also implement `Default` to derive `Default.` + +A common use of `Default::default` is in combination with the struct update +syntax discussed in the “Creating Instances From Other Instances With Struct +Update Syntax” section in Chapter 5. You can customize a few fields of a struct +and then use the default values for the rest by using `..Default::default()`. + +An example of when `Default` is required is the `unwrap_or_default` method on +`Option` instances. If the `Option` is `None`, the `unwrap_or_default` +method will return the result of `Default::default` for the type `T` stored in +the `Option`. + +## Standard Library Traits that Can’t Be Derived + +The rest of the traits defined in the standard library can’t be implemented on +your types using `derive`. These traits don’t have a sensible default behavior +they could have, so you are required to implement them in the way that makes +sense for what you are trying to accomplish with your code. + +An example of a trait that can’t be derived is `Display`, which handles +formatting of a type for end users of your programs. You should put thought +into the appropriate way to display a type to an end user: what parts of the +type should an end user be allowed to see? What parts would they find relevant? +What format of the data would be most relevant to them? The Rust compiler +doesn’t have this insight into your application, so you must provide it. + +## Making Custom Traits Derivable + +The above list is not comprehensive, however: libraries can implement `derive` +for their own types! In this way, the list of traits you can use `derive` with +is truly open-ended. Implementing `derive` involves using a procedural macro, +which is covered in the next appendix, “Macros.” diff --git a/src/doc/book/second-edition/src/appendix-04-macros.md b/src/doc/book/second-edition/src/appendix-04-macros.md new file mode 100644 index 0000000000..d75ea71aff --- /dev/null +++ b/src/doc/book/second-edition/src/appendix-04-macros.md @@ -0,0 +1,484 @@ +# D - Macros + +We’ve used macros, such as `println!`, throughout this book. This appendix will +explain: + +- What macros are and how they differ from functions +- How to define a declarative macro to do metaprogramming +- How to define a procedural macro to create custom `derive` traits + +Macros are covered in an appendix because they’re still evolving. They have +changed and will change more than the rest of the language and standard library +since Rust 1.0, so this section will likely get out of date more than the rest +of this book. The code shown here will still continue to work due to Rust’s +stability guarantees, but there may be additional capabilities or easier ways +to write macros that aren’t available at the time of this publication. + +## Macros are More Flexible and Complex than Functions + +Fundamentally, macros are a way of writing code that writes other code, which +is known as *metaprogramming*. In the previous appendix, we discussed the +`derive` attribute, which generates an implementation of various traits for +you. We’ve also used the `println!` and `vec!` macros. All of these macros +*expand* to produce more code than what you’ve written in your source code. + +Metaprogramming is useful to reduce the amount of code you have to write and +maintain, which is also one of the roles of functions. However, macros have +some additional powers that functions don’t have, as we discussed in Chapter 1. +A function signature has to declare the number and type of parameters the +function has. Macros can take a variable number of parameters: we can call +`println!("hello")` with one argument, or `println!("hello {}", name)` with two +arguments. Also, macros are expanded before the compiler interprets the meaning +of the code, so a macro can, for example, implement a trait on a given type, +whereas a function can’t because a function gets called at runtime and a trait +needs to be implemented at compile time. + +The downside to implementing a macro rather than a function is that macro +definitions are more complex than function definitions. You’re writing Rust +code that writes Rust code, and macro definitions are generally more difficult +to read, understand, and maintain than function definitions. + +Another difference between macros and functions is that macro definitions +aren’t namespaced within modules like function definitions are. In order to +prevent unexpected name clashes when using a crate, when bringing an external +crate into the scope of your project, you have to explicitly bring the macros +into the scope of your project as well with the `#[macro_use]` annotation. This +example would bring all the macros defined in the `serde` crate into the scope +of the current crate: + +```rust,ignore +#[macro_use] +extern crate serde; +``` + +If `extern crate` also brought macros into scope by default, you wouldn’t be +allowed to use two crates that happened to define macros with the same name. In +practice this conflict doesn’t come up much, but the more crates you use, the +more likely it is. + +One last important difference between macros and functions: macros must be +defined or brought into scope before they’re called in a file. Unlike +functions, where we can define a function at the bottom of a file yet call it +at the top, we always have to define macros before we’re able to call them. + +## Declarative Macros with `macro_rules!` for General Metaprogramming + +The first form of macros in Rust, and the one that’s most widely used, is +called *declarative macros*. These are also sometimes referred to as *macros by +example*, *`macro_rules!` macros*, or just plain *macros*. At their core, +declarative macros allow you to write something similar to a Rust `match` +expression. As discussed in Chapter 6, `match` expressions are control +structures that take an expression, compare the resulting value of the +expression to patterns, and then choose the code specified with the matching +pattern when the program runs. Macros also have a value that is compared to +patterns that have code associated with them, but the value is the literal Rust +code passed to the macro, the patterns match the structure of that source code, +and the code associated with each pattern is the code that is generated to +replace the code passed to the macro. This all happens during compilation. + +To define a macro, you use the `macro_rules!` construct. Let’s explore how to +use `macro_rules!` by taking a look at how the `vec!` macro is defined. Chapter +8 covered how we can use the `vec!` macro to create a new vector that holds +particular values. For example, this macro creates a new vector with three +integers inside: + +```rust +let v: Vec = vec![1, 2, 3]; +``` + +We can also use `vec!` to make a vector of two integers or a vector of five +string slices. Because we don’t know the number or type of values, we can’t +define a function that is able to create a new vector with the given elements +like `vec!` can. + +Let’s take a look at a slightly simplified definition of the `vec!` macro: + +```rust +#[macro_export] +macro_rules! vec { + ( $( $x:expr ),* ) => { + { + let mut temp_vec = Vec::new(); + $( + temp_vec.push($x); + )* + temp_vec + } + }; +} +``` + +> Note: the actual definition of the `vec!` macro in the standard library also +> has code to pre-allocate the correct amount of memory up-front. That code +> is an optimization that we’ve chosen not to include here for simplicity. + +The `#[macro_export]` annotation indicates that this macro should be made +available when other crates import the crate in which we’re defining this +macro. Without this annotation, even if someone depending on this crate uses +the `#[macro_use]` annotation, this macro would not be brought into scope. + +Macro definitions start with `macro_rules!` and the name of the macro we’re +defining without the exclamation mark, which in this case is `vec`. This is +followed by curly brackets denoting the body of the macro definition. + +Inside the body is a structure similar to the structure of a `match` +expression. This macro definition has one arm with the pattern `( $( $x:expr +),* )`, followed by `=>` and the block of code associated with this pattern. If +this pattern matches, then the block of code will be emitted. Given that this +is the only pattern in this macro, there’s only one valid way to match; any +other will be an error. More complex macros will have more than one arm. + +The pattern syntax valid in macro definitions is different than the pattern +syntax covered in Chapter 18 because the patterns are for matching against Rust +code structure rather than values. Let’s walk through what the pieces of the +pattern used here mean; for the full macro pattern syntax, see [the reference]. + +[the reference]: ../../reference/macros.html + +The `$x:expr` part of the pattern matches any Rust expression and gives the +expression the name `$x`. The `*` specifies that the pattern matches zero or +more of whatever precedes the `*`. In this case, `*` is preceded by `$(),` so +this pattern matches zero or more of whatever is inside the parentheses, +delimited by a comma. When we call this macro with `vec![1, 2, 3];`, the +pattern matches the three expressions `1`, `2`, and `3`. + +In the body of the code associated with this arm, the `$()*` part is generated +for each part that matches `$()` in the pattern, zero or more times depending +on how many times the pattern matches. The `$x` in the code associated with the +arm is replaced with each expression matched. When we call this macro with +`vec![1, 2, 3];`, the code generated that replaces this macro call will be: + +```rust,ignore +let mut temp_vec = Vec::new(); +temp_vec.push(1); +temp_vec.push(2); +temp_vec.push(3); +temp_vec +``` + +We’ve defined a macro that can take any number of arguments of any type and can +generate code to create a vector containing the specified elements. + +Given that most Rust programmers will *use* macros more than *write* macros, +that’s all we’ll discuss about `macro_rules!` in this book. To learn more about +how to write macros, consult the online documentation or other resources such +as [The Little Book of Rust Macros][tlborm]. + +[tlborm]: https://danielkeep.github.io/tlborm/book/index.html + +## Procedural Macros for Custom `derive` + +The second form of macros is called *procedural macros* because they’re more +like functions (which are a type of procedure). Procedural macros accept some +Rust code as an input, operate on that code, and produce some Rust code as an +output, rather than matching against patterns and replacing the code with other +code as declarative macros do. Today, the only thing you can define procedural +macros for is to allow your traits to be implemented on a type by specifying +the trait name in a `derive` annotation. + +Let’s create a crate named `hello-world` that defines a trait named +`HelloWorld` with one associated function named `hello_world`. Rather than +making users of our crate implement the `HelloWorld` trait for each of their +types, we’d like users to be able to annotate their type with +`#[derive(HelloWorld)]` to get a default implementation of the `hello_world` +function associated with their type. The default implementation will print +`Hello world, my name is TypeName!` where `TypeName` is the name of the type on +which this trait has been defined. + +In other words, we’re going to write a crate that enables another programmer to +write code that looks like Listing A4-1 using our crate: + +Filename: src/main.rs + +```rust,ignore +extern crate hello_world; +#[macro_use] +extern crate hello_world_derive; + +use hello_world::HelloWorld; + +#[derive(HelloWorld)] +struct Pancakes; + +fn main() { + Pancakes::hello_world(); +} +``` + +Listing A4-1: The code a user of our crate will be able +to write when we’ve written the procedural macro + +This code will print `Hello world, my name is Pancakes!` when we’re done. Let’s +get started! + +Let’s make a new library crate: + +```text +$ cargo new hello-world +``` + +First, we’ll define the `HelloWorld` trait and associated function: + +Filename: src/lib.rs + +```rust +pub trait HelloWorld { + fn hello_world(); +} +``` + +At this point, a user of our crate could implement the trait themselves to +achieve the functionality we wanted to enable, like so: + +```rust,ignore +extern crate hello_world; + +use hello_world::HelloWorld; + +struct Pancakes; + +impl HelloWorld for Pancakes { + fn hello_world() { + println!("Hello world, my name is Pancakes!"); + } +} + +fn main() { + Pancakes::hello_world(); +} +``` + +However, they would need to write out the implementation block for each type +they wanted to be able to use with `hello_world`; we’d like to make using our +trait more convenient for other programmers by saving them this work. + +Additionally, we can’t provide a default implementation for the `hello_world` +function that has the behavior we want of printing out the name of the type the +trait is implemented on: Rust doesn’t have reflection capabilities, so we can’t +look up the type’s name at runtime. We need a macro to generate code at compile +time. + +### Defining Procedural Macros Requires a Separate Crate + +The next step is to define the procedural macro. At the moment, procedural +macros need to be in their own crate. Eventually, this restriction may be +lifted, but for now, it’s required. As such, there’s a convention: for a crate +named `foo`, a custom derive procedural macro crate is called `foo-derive`. +Let’s start a new crate called `hello-world-derive` inside our `hello-world` +project: + +```text +$ cargo new hello-world-derive +``` + +We’ve chosen to create the procedural macro crate within the directory of our +`hello-world` crate because the two crates are tightly related: if we change +the trait definition in `hello-world`, we’ll have to change the implementation +of the procedural macro in `hello-world-derive` as well. The two crates will +need to be published separately, and programmers using these crates will need +to add both as dependencies and bring them both into scope. It’s possible to +have the `hello-world` crate use `hello-world-derive` as a dependency and +re-export the procedural macro code, but structuring the project this way makes +it possible for programmers to easily decide they only want to use +`hello-world` if they don’t want the `derive` functionality. + +We need to declare that the `hello-world-derive` crate is a procedural macro +crate. We also need to add dependencies on the `syn` and `quote` crates to get +useful functionality for operating on Rust code. To do these two things, add +the following to the *Cargo.toml* for `hello-world-derive`: + +Filename: hello-world-derive/Cargo.toml + +```toml +[lib] +proc-macro = true + +[dependencies] +syn = "0.11.11" +quote = "0.3.15" +``` + +To start defining the procedural macro, place the code from Listing A4-2 in +*src/lib.rs* for the `hello-world-derive` crate. Note that this won’t compile +until we add a definition for the `impl_hello_world` function. We’ve split the +code into functions in this way because the code in Listing A4-2 will be the +same for almost every procedural macro crate; it’s code that makes writing a +procedural macro more convenient. What you choose to do in the place where the +`impl_hello_world` function is called will be different and depend on the +purpose of your procedural macro. + +Filename: hello-world-derive/src/lib.rs + +```rust,ignore +extern crate proc_macro; +extern crate syn; +#[macro_use] +extern crate quote; + +use proc_macro::TokenStream; + +#[proc_macro_derive(HelloWorld)] +pub fn hello_world_derive(input: TokenStream) -> TokenStream { + // Construct a string representation of the type definition + let s = input.to_string(); + + // Parse the string representation + let ast = syn::parse_derive_input(&s).unwrap(); + + // Build the impl + let gen = impl_hello_world(&ast); + + // Return the generated impl + gen.parse().unwrap() +} +``` + +Listing A4-2: Code that most procedural macro crates will +need to have for processing Rust code + +We have introduced three new crates: `proc_macro`, [`syn`], and [`quote`]. The +`proc_macro` crate comes with Rust, so we didn’t need to add that to the +dependencies in *Cargo.toml*. The `proc_macro` crate allows us to convert Rust +code into a string containing that Rust code. The `syn` crate parses Rust code +from a string into a data structure that we can perform operations on. The +`quote` crate takes `syn` data structures and turns them back into Rust code. +These crates make it much simpler to parse any sort of Rust code we might want +to handle: writing a full parser for Rust code is no simple task. + +[`syn`]: https://crates.io/crates/syn +[`quote`]: https://crates.io/crates/quote + +The `hello_world_derive` function is the code that will get called when a user +of our library specifies the `#[derive(HelloWorld)]` annotation on a type +because we’ve annotated the `hello_world_derive` function here with +`proc_macro_derive` and specified the same name, `HelloWorld`. This name +matches our trait named `HelloWorld`; that’s the convention most procedural +macros follow. + +The first thing this function does is convert the `input` from a `TokenStream` +to a `String` by calling `to_string`. This `String` is a string representation +of the Rust code for which we are deriving `HelloWorld`. In the example in +Listing A4-1, `s` will have the `String` value `struct Pancakes;` because +that’s the Rust code we added the `#[derive(HelloWorld)]` annotation to. + +At the moment, the only thing you can do with a `TokenStream` is convert it to +a string. A richer API will exist in the future. + +What we really need is to be able to parse the Rust code `String` into a data +structure that we can then interpret and perform operations on. This is where +`syn` comes to play. The `parse_derive_input` function in `syn` takes a +`String` and returns a `DeriveInput` struct representing the parsed Rust code. +Here’s the relevant parts of the `DeriveInput` struct we get from parsing the +string `struct Pancakes;`: + +```rust,ignore +DeriveInput { + // --snip-- + + ident: Ident( + "Pancakes" + ), + body: Struct( + Unit + ) +} +``` + +The fields of this struct show that the Rust code we’ve parsed is a unit struct +with the `ident` (identifier, meaning the name) of `Pancakes`. There are more +fields on this struct for describing all sorts of Rust code; check the [`syn` +API docs for `DeriveInput`][syn-docs] for more information. + +[syn-docs]: https://docs.rs/syn/0.11.11/syn/struct.DeriveInput.html + +We haven’t defined the `impl_hello_world` function; that’s where we’ll build +the new Rust code we want to include. Before we get to that, the last part of +this `hello_world_derive` function is using the `quote` crate’s `parse` +function to turn the output of the `impl_hello_world` function back into a +`TokenStream`. The returned `TokenStream` is added to the code that users of +our crate write so that when they compile their crate, they get extra +functionality we provide. + +You may have noticed that we’re calling `unwrap` to panic if the calls to the +`parse_derive_input` or `parse` functions fail because they’re unable to parse +the `TokenStream` or generate a `TokenStream`. Panicking on errors is necessary +in procedural macro code because `proc_macro_derive` functions must return +`TokenStream` rather than `Result` in order to conform to the procedural macro +API. We’ve chosen to keep this example simple by using `unwrap`; in production +code you should provide more specific error messages about what went wrong by +using `expect` or `panic!`. + +Now that we have the code to turn the annotated Rust code from a `TokenStream` +into a `String` and into a `DeriveInput` instance, let’s write the code that +will generate the code implementing the `HelloWorld` trait on the annotated +type: + +Filename: hello-world-derive/src/lib.rs + +```rust,ignore +fn impl_hello_world(ast: &syn::DeriveInput) -> quote::Tokens { + let name = &ast.ident; + quote! { + impl HelloWorld for #name { + fn hello_world() { + println!("Hello, World! My name is {}", stringify!(#name)); + } + } + } +} +``` + +We are able to get an `Ident` struct instance containing the name (identifier) +of the annotated type using `ast.ident`. With the code from Listing A4-1, +`name` will be `Ident("Pancakes")`. + +The `quote!` macro from the `quote` crate lets us write up the Rust code that +we wish to return and convert it into `quote::Tokens`. The `quote!` macro lets +us use some really cool templating mechanics; we can write `#name` and `quote!` +will replace it with the value in the variable named `name`. You can even do +some repetition similar to the way regular macros work. Check out [the `quote` +crate’s docs][quote-docs] for a thorough introduction. + +[quote-docs]: https://docs.rs/quote + +What we want to do for our procedural macro is generate an implementation of +our `HelloWorld` trait for the type the user of our crate has annotated, which +we can get by using `#name`. The trait implementation has one function, +`hello_world`, and the function body contains the functionality we want to +provide: printing `Hello, World! My name is` and then the name of the type the +user of our crate has annotated. The `stringify!` macro used here is built into +Rust. It takes a Rust expression, such as `1 + 2`, and at compile time turns +the expression into a string literal, such as `"1 + 2"`. This is different than +`format!` or `println!`, which evaluate the expression and then turn the result +into a `String`. There’s a possibility that `#name` would be an expression that +we would want to print out literally, and `stringify!` also saves an allocation +by converting `#name` to a string literal at compile time. + +At this point, `cargo build` should complete successfully in both `hello-world` +and `hello-world-derive`. Let’s hook these crates up to the code in Listing +A4-1 to see it in action! Create a new binary project in your `projects` +directory with `cargo new --bin pancakes`. We need to add both `hello-world` +and `hello-world-derive` as dependencies in the `pancakes` crate’s +*Cargo.toml*. If you’ve chosen to publish your versions of `hello-world` and +`hello-world-derive` to *https://crates.io* they would be regular dependencies; +if not, you can specify them as `path` dependencies as follows: + +```toml +[dependencies] +hello_world = { path = "../hello-world" } +hello_world_derive = { path = "../hello-world/hello-world-derive" } +``` + +Put the code from Listing A4-1 into *src/main.rs*, and executing `cargo run` +should print `Hello, World! My name is Pancakes`! The implementation of the +`HelloWorld` trait from the procedural macro was included without the +`pancakes` crate needing to implement it; the `#[derive(HelloWorld)]` took care +of adding the trait implementation. + +## The Future of Macros + +In the future, we’ll be expanding both declarative and procedural macros. A +better declarative macro system will be used with the `macro` keyword, and +we’ll add more types of procedural macros, for more powerful tasks than only +`derive`. These systems are still under development at the time of publication; +please consult the online Rust documentation for the latest information. diff --git a/src/doc/book/second-edition/src/appendix-06-translation.md b/src/doc/book/second-edition/src/appendix-05-translation.md similarity index 90% rename from src/doc/book/second-edition/src/appendix-06-translation.md rename to src/doc/book/second-edition/src/appendix-05-translation.md index 4fd7004b89..19db00dccc 100644 --- a/src/doc/book/second-edition/src/appendix-06-translation.md +++ b/src/doc/book/second-edition/src/appendix-05-translation.md @@ -15,3 +15,5 @@ For resources in languages other than English. Most are still in progress; see - [한국어](https://github.com/rinthel/rust-lang-book-ko) - [日本語](https://github.com/hazama-yuinyan/book) - [Français](https://github.com/quadrifoglio/rust-book-fr) +- [Polski](https://github.com/paytchoo/book-pl) +- [עברית](https://github.com/idanmel/rust-book-heb) diff --git a/src/doc/book/second-edition/src/appendix-07-newest-features.md b/src/doc/book/second-edition/src/appendix-06-newest-features.md similarity index 100% rename from src/doc/book/second-edition/src/appendix-07-newest-features.md rename to src/doc/book/second-edition/src/appendix-06-newest-features.md diff --git a/src/doc/book/second-edition/src/ch01-01-installation.md b/src/doc/book/second-edition/src/ch01-01-installation.md index 0e6893f07b..86a1e8c460 100644 --- a/src/doc/book/second-edition/src/ch01-01-installation.md +++ b/src/doc/book/second-edition/src/ch01-01-installation.md @@ -27,8 +27,8 @@ your password. If it all goes well, you’ll see this appear: Rust is installed now. Great! ``` -Of course, if you disapprove of the `curl | sh` pattern, you can download, inspect -and run the script however you like. +Of course, if you distrust using `curl URL | sh` to install software, you can download, +inspect, and run the script however you like. The installation script automatically adds Rust to your system PATH after your next login. If you want to start using Rust right away, run the following command in your shell: diff --git a/src/doc/book/second-edition/src/ch01-02-hello-world.md b/src/doc/book/second-edition/src/ch01-02-hello-world.md index 01ac9241d0..d262d94bd4 100644 --- a/src/doc/book/second-edition/src/ch01-02-hello-world.md +++ b/src/doc/book/second-edition/src/ch01-02-hello-world.md @@ -149,6 +149,7 @@ On Windows, you’d enter: ```cmd > dir /B %= the /B option says to only show the file names =% main.exe +main.pdb main.rs ``` @@ -316,6 +317,7 @@ program through Cargo! To do so, enter the following commands: ```text $ cargo build Compiling hello_cargo v0.1.0 (file:///projects/hello_cargo) + Finished dev [unoptimized + debuginfo] target(s) in 2.85 secs ``` This should have created an executable file in *target/debug/hello_cargo* (or @@ -350,6 +352,7 @@ and then run: ```text $ cargo run + Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/hello_cargo` Hello, world! ``` @@ -363,6 +366,7 @@ this: ```text $ cargo run Compiling hello_cargo v0.1.0 (file:///projects/hello_cargo) + Finished dev [unoptimized + debuginfo] target(s) in 0.33 secs Running `target/debug/hello_cargo` Hello, world! ``` diff --git a/src/doc/book/second-edition/src/ch03-02-data-types.md b/src/doc/book/second-edition/src/ch03-02-data-types.md index 2cb0d6cabb..c236bfe502 100644 --- a/src/doc/book/second-edition/src/ch03-02-data-types.md +++ b/src/doc/book/second-edition/src/ch03-02-data-types.md @@ -36,7 +36,7 @@ You’ll see different type annotations as we discuss the various data types. ### Scalar Types A *scalar* type represents a single value. Rust has four primary scalar types: -integers, floating-point numbers, booleans, and characters. You’ll likely +integers, floating-point numbers, Booleans, and characters. You’ll likely recognize these from other programming languages, but let’s jump into how they work in Rust. @@ -156,8 +156,8 @@ list of all operators that Rust provides. #### The Boolean Type -As in most other programming languages, a boolean type in Rust has two possible -values: `true` and `false`. The boolean type in Rust is specified using `bool`. +As in most other programming languages, a Boolean type in Rust has two possible +values: `true` and `false`. The Boolean type in Rust is specified using `bool`. For example: Filename: src/main.rs @@ -170,7 +170,7 @@ fn main() { } ``` -The main way to consume boolean values is through conditionals, such as an `if` +The main way to consume Boolean values is through conditionals, such as an `if` expression. We’ll cover how `if` expressions work in Rust in the “Control Flow” section. diff --git a/src/doc/book/second-edition/src/ch03-05-control-flow.md b/src/doc/book/second-edition/src/ch03-05-control-flow.md index 8f0a8de99a..27d324e5b9 100644 --- a/src/doc/book/second-edition/src/ch03-05-control-flow.md +++ b/src/doc/book/second-edition/src/ch03-05-control-flow.md @@ -102,9 +102,9 @@ error[E0308]: mismatched types ``` The error indicates that Rust expected a `bool` but got an integer. Rust will -not automatically try to convert non-boolean types to a boolean, unlike +not automatically try to convert non-Boolean types to a Boolean, unlike languages such as Ruby and JavaScript. You must be explicit and always provide -`if` with a `boolean` as its condition. If we want the `if` code block to run +`if` with a Boolean as its condition. If we want the `if` code block to run only when a number is not equal to `0`, for example, we can change the `if` expression to the following: diff --git a/src/doc/book/second-edition/src/ch04-01-what-is-ownership.md b/src/doc/book/second-edition/src/ch04-01-what-is-ownership.md index b1c40223c1..50f74ba2ac 100644 --- a/src/doc/book/second-edition/src/ch04-01-what-is-ownership.md +++ b/src/doc/book/second-edition/src/ch04-01-what-is-ownership.md @@ -428,7 +428,7 @@ be sure, but as a general rule, any group of simple scalar values can be `Copy`. Here are some of the types that are `Copy`: * All the integer types, like `u32`. -* The boolean type, `bool`, with values `true` and `false`. +* The Boolean type, `bool`, with values `true` and `false`. * The character type, `char`. * All the floating point types, like `f64`. * Tuples, but only if they contain types that are also `Copy`. `(i32, i32)` is diff --git a/src/doc/book/second-edition/src/ch05-03-method-syntax.md b/src/doc/book/second-edition/src/ch05-03-method-syntax.md index e4606dfd9b..4d9588d422 100644 --- a/src/doc/book/second-edition/src/ch05-03-method-syntax.md +++ b/src/doc/book/second-edition/src/ch05-03-method-syntax.md @@ -161,7 +161,7 @@ parameter will be by looking at the code that calls the method: read `rect2` (rather than write, which would mean we’d need a mutable borrow), and we want `main` to retain ownership of `rect2` so we can use it again after calling the `can_hold` method. The return value of `can_hold` will be a -boolean, and the implementation will check whether the width and height of +Boolean, and the implementation will check whether the width and height of `self` are both greater than the width and height of the other `Rectangle`, respectively. Let’s add the new `can_hold` method to the `impl` block from Listing 5-13, shown in Listing 5-15: diff --git a/src/doc/book/second-edition/src/ch06-02-match.md b/src/doc/book/second-edition/src/ch06-02-match.md index ec2afccba2..d5bbb44f49 100644 --- a/src/doc/book/second-edition/src/ch06-02-match.md +++ b/src/doc/book/second-edition/src/ch06-02-match.md @@ -5,7 +5,7 @@ us to compare a value against a series of patterns and then execute code based on which pattern matches. Patterns can be made up of literal values, variable names, wildcards, and many other things; Chapter 18 covers all the different kinds of patterns and what they do. The power of `match` comes from the -expressiveness of the patterns and the compiler checks that make sure all +expressiveness of the patterns and the compiler checks that all possible cases are handled. Think of a `match` expression kind of like a coin sorting machine: coins slide @@ -43,7 +43,7 @@ the variants of the enum as its patterns. Let’s break down the `match` in the `value_in_cents` function. First, we list the `match` keyword followed by an expression, which in this case is the value `coin`. This seems very similar to an expression used with `if`, but there’s a -big difference: with `if`, the expression needs to return a boolean value. +big difference: with `if`, the expression needs to return a Boolean value. Here, it can be any type. The type of `coin` in this example is the `Coin` enum that we defined in Listing 6-3. diff --git a/src/doc/book/second-edition/src/ch07-01-mod-and-the-filesystem.md b/src/doc/book/second-edition/src/ch07-01-mod-and-the-filesystem.md index 422971d37f..4528429c53 100644 --- a/src/doc/book/second-edition/src/ch07-01-mod-and-the-filesystem.md +++ b/src/doc/book/second-edition/src/ch07-01-mod-and-the-filesystem.md @@ -204,7 +204,7 @@ These would be good reasons to separate the `client`, `network`, and `server` modules from *src/lib.rs* and place them into their own files. First, replace the `client` module code with only the declaration of the -`client` module, so that your *src/lib.rs* looks like the following: +`client` module, so that your *src/lib.rs* looks like code shown in Listing 7-4: Filename: src/lib.rs @@ -222,6 +222,8 @@ mod network { } ``` +Listing 7-4: Extracting the contents of the `client` module but leaving the declaration in *src/lib.rs* + We’re still *declaring* the `client` module here, but by replacing the block with a semicolon, we’re telling Rust to look in another location for the code defined within the scope of the `client` module. In other words, the line `mod @@ -345,7 +347,7 @@ fn connect() { } ``` -When we try to `cargo build`, we’ll get the error shown in Listing 7-4: +When we try to `cargo build`, we’ll get the error shown in Listing 7-5: ```text $ cargo build @@ -368,14 +370,14 @@ note: ... or maybe `use` the module `server` instead of possibly redeclaring it | ^^^^^^ ``` -Listing 7-4: Error when trying to extract the `server` +Listing 7-5: Error when trying to extract the `server` submodule into *src/server.rs* The error says we `cannot declare a new module at this location` and is pointing to the `mod server;` line in *src/network.rs*. So *src/network.rs* is different than *src/lib.rs* somehow: keep reading to understand why. -The note in the middle of Listing 7-4 is actually very helpful because it +The note in the middle of Listing 7-5 is actually very helpful because it points out something we haven’t yet talked about doing: ```text diff --git a/src/doc/book/second-edition/src/ch07-02-controlling-visibility-with-pub.md b/src/doc/book/second-edition/src/ch07-02-controlling-visibility-with-pub.md index 45fe0a684e..4606de987c 100644 --- a/src/doc/book/second-edition/src/ch07-02-controlling-visibility-with-pub.md +++ b/src/doc/book/second-edition/src/ch07-02-controlling-visibility-with-pub.md @@ -1,6 +1,6 @@ ## Controlling Visibility with `pub` -We resolved the error messages shown in Listing 7-4 by moving the `network` and +We resolved the error messages shown in Listing 7-5 by moving the `network` and `network::server` code into the *src/network/mod.rs* and *src/network/server.rs* files, respectively. At that point, `cargo build` was able to build our project, but we still get warning messages about the @@ -241,7 +241,7 @@ Overall, these are the rules for item visibility: ### Privacy Examples Let’s look at a few more privacy examples to get some practice. Create a new -library project and enter the code in Listing 7-5 into your new project’s +library project and enter the code in Listing 7-6 into your new project’s *src/lib.rs*: Filename: src/lib.rs @@ -267,7 +267,7 @@ fn try_me() { } ``` -Listing 7-5: Examples of private and public functions, +Listing 7-6: Examples of private and public functions, some of which are incorrect Before you try to compile this code, make a guess about which lines in the diff --git a/src/doc/book/second-edition/src/ch07-03-importing-names-with-use.md b/src/doc/book/second-edition/src/ch07-03-importing-names-with-use.md index a42c70af30..6731412f2f 100644 --- a/src/doc/book/second-edition/src/ch07-03-importing-names-with-use.md +++ b/src/doc/book/second-edition/src/ch07-03-importing-names-with-use.md @@ -2,7 +2,7 @@ We’ve covered how to call functions defined within a module using the module name as part of the call, as in the call to the `nested_modules` function shown -here in Listing 7-6: +here in Listing 7-7: Filename: src/main.rs @@ -20,7 +20,7 @@ fn main() { } ``` -Listing 7-6: Calling a function by fully specifying its +Listing 7-7: Calling a function by fully specifying its enclosing module’s path As you can see, referring to the fully qualified name can get quite lengthy. @@ -166,7 +166,7 @@ communicator Tests are for exercising the code within our library, so let’s try to call our `client::connect` function from this `it_works` function, even though we won’t -be checking any functionality right now. This won't work yet: +be checking any functionality right now. This won’t work yet: Filename: src/lib.rs @@ -256,7 +256,7 @@ $ cargo test running 1 test test tests::it_works ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` ## Summary diff --git a/src/doc/book/second-edition/src/ch08-01-vectors.md b/src/doc/book/second-edition/src/ch08-01-vectors.md index e73e0ae1e4..905adeff4a 100644 --- a/src/doc/book/second-edition/src/ch08-01-vectors.md +++ b/src/doc/book/second-edition/src/ch08-01-vectors.md @@ -118,7 +118,7 @@ argument, which gives us an `Option<&T>`. The reason Rust has two ways to reference an element is so you can choose how the program behaves when you try to use an index value that the vector doesn’t -have an element for. As an example, let's see what a program will do if it has +have an element for. As an example, let’s see what a program will do if it has a vector that holds five elements and then tries to access an element at index 100, as shown in Listing 8-6: @@ -154,7 +154,7 @@ ownership and borrowing rules (covered in Chapter 4) to ensure this reference and any other references to the contents of the vector remain valid. Recall the rule that states we can’t have mutable and immutable references in the same scope. That rule applies in Listing 8-7 where we hold an immutable reference to -the first element in a vector and try to add an element to the end, which won't +the first element in a vector and try to add an element to the end, which won’t work: ```rust,ignore diff --git a/src/doc/book/second-edition/src/ch09-00-error-handling.md b/src/doc/book/second-edition/src/ch09-00-error-handling.md index d8ead01c58..4efd72956e 100644 --- a/src/doc/book/second-edition/src/ch09-00-error-handling.md +++ b/src/doc/book/second-edition/src/ch09-00-error-handling.md @@ -16,7 +16,7 @@ location beyond the end of an array. Most languages don’t distinguish between these two kinds of errors and handle both in the same way using mechanisms like exceptions. Rust doesn’t have -exceptions. Instead, it has the value `Result` for recoverable errors and +exceptions. Instead, it has the type `Result` for recoverable errors and the `panic!` macro that stops execution when it encounters unrecoverable errors. This chapter covers calling `panic!` first and then talks about returning `Result` values. Additionally, we’ll explore considerations to diff --git a/src/doc/book/second-edition/src/ch09-01-unrecoverable-errors-with-panic.md b/src/doc/book/second-edition/src/ch09-01-unrecoverable-errors-with-panic.md index 678a590e23..c0ba832726 100644 --- a/src/doc/book/second-edition/src/ch09-01-unrecoverable-errors-with-panic.md +++ b/src/doc/book/second-edition/src/ch09-01-unrecoverable-errors-with-panic.md @@ -42,15 +42,14 @@ $ cargo run Compiling panic v0.1.0 (file:///projects/panic) Finished dev [unoptimized + debuginfo] target(s) in 0.25 secs Running `target/debug/panic` -thread 'main' panicked at 'crash and burn', src/main.rs:2 +thread 'main' panicked at 'crash and burn', src/main.rs:2:4 note: Run with `RUST_BACKTRACE=1` for a backtrace. -error: Process didn't exit successfully: `target/debug/panic` (exit code: 101) ``` The call to `panic!` causes the error message contained in the last three lines. The first line shows our panic message and the place in our source code -where the panic occurred: *src/main.rs:2* indicates that it’s the second line -of our *src/main.rs* file. +where the panic occurred: *src/main.rs:2:4* indicates that it’s the second +line, fourth character of our *src/main.rs* file. In this case, the line indicated is part of our code, and if we go to that line, we see the `panic!` macro call. In other cases, the `panic!` call might @@ -74,17 +73,18 @@ element by index in a vector: fn main() { let v = vec![1, 2, 3]; - v[100]; + v[99]; } ``` Listing 9-1: Attempting to access an element beyond the end of a vector, which will cause a `panic!` -Here, we’re attempting to access the hundredth element of our vector, but it -has only three elements. In this situation, Rust will panic. Using `[]` is -supposed to return an element, but if you pass an invalid index, there’s no -element that Rust could return here that would be correct. +Here, we’re attempting to access the hundredth element of our vector (which is +at index 99 because indexing starts at zero), but it has only three elements. +In this situation, Rust will panic. Using `[]` is supposed to return an +element, but if you pass an invalid index, there’s no element that Rust could +return here that would be correct. Other languages, like C, will attempt to give you exactly what you asked for in this situation, even though it isn’t what you want: you’ll get whatever is at @@ -104,15 +104,15 @@ $ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.27 secs Running `target/debug/panic` thread 'main' panicked at 'index out of bounds: the len is 3 but the index is -100', /stable-dist-rustc/build/src/libcollections/vec.rs:1362 +99', /checkout/src/liballoc/vec.rs:1555:10 note: Run with `RUST_BACKTRACE=1` for a backtrace. error: Process didn't exit successfully: `target/debug/panic` (exit code: 101) ``` -This error points at a file we didn’t write, *libcollections/vec.rs*. That’s -the implementation of `Vec` in the standard library. The code that gets run -when we use `[]` on our vector `v` is in *libcollections/vec.rs*, and that is -where the `panic!` is actually happening. +This error points at a file we didn’t write, *vec.rs*. That’s the +implementation of `Vec` in the standard library. The code that gets run when +we use `[]` on our vector `v` is in *vec.rs*, and that is where the `panic!` is +actually happening. The next note line tells us that we can set the `RUST_BACKTRACE` environment variable to get a backtrace of exactly what happened to cause the error. A @@ -129,40 +129,42 @@ Listing 9-2 shows output similar to what you’ll see: $ RUST_BACKTRACE=1 cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/panic` -thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 100', /stable-dist-rustc/build/src/libcollections/vec.rs:1392 +thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 99', /checkout/src/liballoc/vec.rs:1555:10 stack backtrace: - 1: 0x560ed90ec04c - std::sys::imp::backtrace::tracing::imp::write::hf33ae72d0baa11ed - at /stable-dist-rustc/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42 - 2: 0x560ed90ee03e - std::panicking::default_hook::{{closure}}::h59672b733cc6a455 - at /stable-dist-rustc/build/src/libstd/panicking.rs:351 - 3: 0x560ed90edc44 - std::panicking::default_hook::h1670459d2f3f8843 - at /stable-dist-rustc/build/src/libstd/panicking.rs:367 - 4: 0x560ed90ee41b - std::panicking::rust_panic_with_hook::hcf0ddb069e7abcd7 - at /stable-dist-rustc/build/src/libstd/panicking.rs:555 - 5: 0x560ed90ee2b4 - std::panicking::begin_panic::hd6eb68e27bdf6140 - at /stable-dist-rustc/build/src/libstd/panicking.rs:517 - 6: 0x560ed90ee1d9 - std::panicking::begin_panic_fmt::abcd5965948b877f8 - at /stable-dist-rustc/build/src/libstd/panicking.rs:501 - 7: 0x560ed90ee167 - rust_begin_unwind - at /stable-dist-rustc/build/src/libstd/panicking.rs:477 - 8: 0x560ed911401d - core::panicking::panic_fmt::hc0f6d7b2c300cdd9 - at /stable-dist-rustc/build/src/libcore/panicking.rs:69 - 9: 0x560ed9113fc8 - core::panicking::panic_bounds_check::h02a4af86d01b3e96 - at /stable-dist-rustc/build/src/libcore/panicking.rs:56 - 10: 0x560ed90e71c5 - as core::ops::Index>::index::h98abcd4e2a74c41 - at /stable-dist-rustc/build/src/libcollections/vec.rs:1392 - 11: 0x560ed90e727a - panic::main::h5d6b77c20526bc35 - at /home/you/projects/panic/src/main.rs:4 - 12: 0x560ed90f5d6a - __rust_maybe_catch_panic - at /stable-dist-rustc/build/src/libpanic_unwind/lib.rs:98 - 13: 0x560ed90ee926 - std::rt::lang_start::hd7c880a37a646e81 - at /stable-dist-rustc/build/src/libstd/panicking.rs:436 - at /stable-dist-rustc/build/src/libstd/panic.rs:361 - at /stable-dist-rustc/build/src/libstd/rt.rs:57 - 14: 0x560ed90e7302 - main - 15: 0x7f0d53f16400 - __libc_start_main - 16: 0x560ed90e6659 - _start - 17: 0x0 - + 0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace + at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 + 1: std::sys_common::backtrace::_print + at /checkout/src/libstd/sys_common/backtrace.rs:71 + 2: std::panicking::default_hook::{{closure}} + at /checkout/src/libstd/sys_common/backtrace.rs:60 + at /checkout/src/libstd/panicking.rs:381 + 3: std::panicking::default_hook + at /checkout/src/libstd/panicking.rs:397 + 4: std::panicking::rust_panic_with_hook + at /checkout/src/libstd/panicking.rs:611 + 5: std::panicking::begin_panic + at /checkout/src/libstd/panicking.rs:572 + 6: std::panicking::begin_panic_fmt + at /checkout/src/libstd/panicking.rs:522 + 7: rust_begin_unwind + at /checkout/src/libstd/panicking.rs:498 + 8: core::panicking::panic_fmt + at /checkout/src/libcore/panicking.rs:71 + 9: core::panicking::panic_bounds_check + at /checkout/src/libcore/panicking.rs:58 + 10: as core::ops::index::Index>::index + at /checkout/src/liballoc/vec.rs:1555 + 11: panic::main + at src/main.rs:4 + 12: __rust_maybe_catch_panic + at /checkout/src/libpanic_unwind/lib.rs:99 + 13: std::rt::lang_start + at /checkout/src/libstd/panicking.rs:459 + at /checkout/src/libstd/panic.rs:361 + at /checkout/src/libstd/rt.rs:61 + 14: main + 15: __libc_start_main + 16: ``` Listing 9-2: The backtrace generated by a call to @@ -180,7 +182,7 @@ want our program to panic, the location pointed to by the first line mentioning a file we wrote is where we should start investigating to figure out how we got to this location with values that caused the panic. In Listing 9-1 where we deliberately wrote code that would panic in order to demonstrate how to use -backtraces, the way to fix the panic is to not request an element at index 100 +backtraces, the way to fix the panic is to not request an element at index 99 from a vector that only contains three items. When your code panics in the future, you’ll need to figure out what action the code is taking with what values that causes the panic and what the code should do instead. diff --git a/src/doc/book/second-edition/src/ch09-02-recoverable-errors-with-result.md b/src/doc/book/second-edition/src/ch09-02-recoverable-errors-with-result.md index 9be7c9baee..52e0a689f2 100644 --- a/src/doc/book/second-edition/src/ch09-02-recoverable-errors-with-result.md +++ b/src/doc/book/second-edition/src/ch09-02-recoverable-errors-with-result.md @@ -6,9 +6,9 @@ interpret and respond to. For example, if we try to open a file and that operation fails because the file doesn’t exist, we might want to create the file instead of terminating the process. -Recall in Chapter 2 in the on “[Handling Potential Failure with the `Result` -Type][handle_failure]” section that the `Result` enum is defined -as having two variants, `Ok` and `Err`, as follows: +Recall from “[Handling Potential Failure with the `Result` +Type][handle_failure]” in Chapter 2 that the `Result` enum is +defined as having two variants, `Ok` and `Err`, as follows: [handle_failure]: ch02-00-guessing-game-tutorial.html#handling-potential-failure-with-the-result-type @@ -66,7 +66,7 @@ error[E0308]: mismatched types `std::result::Result` | = note: expected type `u32` - = note: found type `std::result::Result` + found type `std::result::Result` ``` This tells us the return type of the `File::open` function is a `Result`. @@ -233,7 +233,7 @@ the `panic!` call that the `unwrap` method makes: ```text thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', -/stable-dist-rustc/build/src/libcore/result.rs:868 +src/libcore/result.rs:906:4 ``` Another method, `expect`, which is similar to `unwrap`, lets us also choose the @@ -258,8 +258,7 @@ will be the parameter that we pass to `expect`, rather than the default ```text thread 'main' panicked at 'Failed to open hello.txt: Error { repr: Os { code: -2, message: "No such file or directory" } }', -/stable-dist-rustc/build/src/libcore/result.rs:868 +2, message: "No such file or directory" } }', src/libcore/result.rs:906:4 ``` Because this error message starts with the text we specified, `Failed to open @@ -384,18 +383,16 @@ is an `Err`, the value inside the `Err` will be returned from the whole function as if we had used the `return` keyword so the error value gets propagated to the calling code. -The one difference between the `match` expression from Listing 9-6 and what the -question mark operator does is that when using the question mark operator, -error values go through the `from` function defined in the `From` trait in the -standard library. Many error types implement the `from` function to convert an -error of one type into an error of another type. When used by the question mark -operator, the call to the `from` function converts the error type that the -question mark operator gets into the error type defined in the return type of -the current function that we’re using `?` in. This is useful when parts of a -function might fail for many different reasons, but the function returns one -error type that represents all the ways the function might fail. As long as -each error type implements the `from` function to define how to convert itself -to the returned error type, the question mark operator takes care of the +There is a difference between what the `match` expression from Listing 9-6 and +the question mark operator do: error values used with `?` go through the `from` +function, defined in the `From` trait in the standard library, which is used to +convert errors from one type into another. When the question mark calls the +`from` function, the error type received is converted into the error type +defined in the return type of the current function. This is useful when a +function returns one error type to represent all the ways a function might +fail, even if parts might fail for many different reasons. As long as each +error type implements the `from` function to define how to convert itself to +the returned error type, the question mark operator takes care of the conversion automatically. In the context of Listing 9-7, the `?` at the end of the `File::open` call will @@ -458,14 +455,14 @@ fn main() { When we compile this code, we get the following error message: ```text -error[E0277]: the `?` operator can only be used in a function that returns -`Result` (or another type that implements `std::ops::Try`) +error[E0277]: the trait bound `(): std::ops::Try` is not satisfied --> src/main.rs:4:13 | 4 | let f = File::open("hello.txt")?; | ------------------------ | | - | cannot use the `?` operator in a function that returns `()` + | the `?` operator can only be used in a function that returns + `Result` (or another type that implements `std::ops::Try`) | in this macro invocation | = help: the trait `std::ops::Try` is not implemented for `()` diff --git a/src/doc/book/second-edition/src/ch09-03-to-panic-or-not-to-panic.md b/src/doc/book/second-edition/src/ch09-03-to-panic-or-not-to-panic.md index ef2df322f1..eecf0ef59d 100644 --- a/src/doc/book/second-edition/src/ch09-03-to-panic-or-not-to-panic.md +++ b/src/doc/book/second-edition/src/ch09-03-to-panic-or-not-to-panic.md @@ -138,7 +138,7 @@ number being in range, like so: ```rust,ignore loop { - // snip + // --snip-- let guess: i32 = match guess.trim().parse() { Ok(num) => num, @@ -151,7 +151,7 @@ loop { } match guess.cmp(&secret_number) { - // snip + // --snip-- } ``` diff --git a/src/doc/book/second-edition/src/ch10-02-traits.md b/src/doc/book/second-edition/src/ch10-02-traits.md index 7a3c391882..b90879af15 100644 --- a/src/doc/book/second-edition/src/ch10-02-traits.md +++ b/src/doc/book/second-edition/src/ch10-02-traits.md @@ -413,8 +413,6 @@ and `Copy` traits, like `i32` and `char`: Filename: src/main.rs ```rust -use std::cmp::PartialOrd; - fn largest(list: &[T]) -> T { let mut largest = list[0]; @@ -505,7 +503,7 @@ similar to this code: ```rust,ignore impl ToString for T { - // ...snip... + // --snip-- } ``` diff --git a/src/doc/book/second-edition/src/ch11-00-testing.md b/src/doc/book/second-edition/src/ch11-00-testing.md index e766f288ae..5d5971397d 100644 --- a/src/doc/book/second-edition/src/ch11-00-testing.md +++ b/src/doc/book/second-edition/src/ch11-00-testing.md @@ -1,33 +1,33 @@ # Writing Automated Tests -> Program testing can be a very effective way to show the presence of bugs, but -> it is hopelessly inadequate for showing their absence. -> Edsger W. Dijkstra, “The Humble Programmer” (1972) - -Correctness in our programs means that our code does what we intend for it to -do. Rust is a programming language that cares a lot about correctness, but -correctness is a complex topic and isn’t easy to prove. Rust’s type system +In his 1972 essay, “The Humble Programmer,” Edsger W. Dijkstra said that +“Program testing can be a very effective way to show the presence of bugs, but +it is hopelessly inadequate for showing their absence.” That doesn’t mean we +shouldn’t try to test as much as we can! Correctness in our programs is the +extent to which our code does what we intend it to do. Rust is a programming +language designed with a high degree of concern about the correctness of +programs, but correctness is complex and not easy to prove. Rust’s type system shoulders a huge part of this burden, but the type system cannot catch every -kind of incorrectness. As such, Rust includes support for writing software -tests within the language itself. +kind of incorrectness. As such, Rust includes support for writing automated +software tests within the language. As an example, say we write a function called `add_two` that adds two to whatever number is passed to it. This function’s signature accepts an integer as a parameter and returns an integer as a result. When we implement and -compile that function, Rust will do all the type checking and borrow checking -that we’ve seen so far to make sure that, for instance, we aren’t passing a -`String` value or an invalid reference to this function. What Rust *can’t* -check is that this function will do precisely what we intend: return the -parameter plus two, rather than, say, the parameter plus 10 or the parameter +compile that function, Rust does all the type checking and borrow checking that +you’ve learned so far to ensure that, for instance, we aren’t passing a +`String` value or an invalid reference to this function. But Rust *can’t* check +that this function will do precisely what we intend, which is return the +parameter plus two rather than, say, the parameter plus 10 or the parameter minus 50! That’s where tests come in. We can write tests that assert, for example, that when we pass `3` to the -`add_two` function, we get `5` back. We can run these tests whenever we make -changes to our code to make sure any existing correct behavior has not changed. +`add_two` function, the returned value is `5`. We can run these tests whenever +we make changes to our code to make sure any existing correct behavior has not +changed. -Testing is a complex skill, and we cannot hope to cover everything about how to -write good tests in one chapter of a book, so here we’ll just discuss the -mechanics of Rust’s testing facilities. We’ll talk about the annotations and -macros available to you when writing your tests, the default behavior and -options provided for running your tests, and how to organize tests into unit -tests and integration tests. +Testing is a complex skill: although we can’t cover every detail about how to +write good tests in one chapter, we’ll discuss the mechanics of Rust’s testing +facilities. We’ll talk about the annotations and macros available to you when +writing your tests, the default behavior and options provided for running your +tests, and how to organize tests into unit tests and integration tests. diff --git a/src/doc/book/second-edition/src/ch11-01-writing-tests.md b/src/doc/book/second-edition/src/ch11-01-writing-tests.md index 07e2a97189..319c07408c 100644 --- a/src/doc/book/second-edition/src/ch11-01-writing-tests.md +++ b/src/doc/book/second-edition/src/ch11-01-writing-tests.md @@ -1,32 +1,37 @@ ## How to Write Tests Tests are Rust functions that verify that the non-test code is functioning in -the expected manner. The bodies of test functions typically perform some setup, -run the code we want to test, then assert whether the results are what we -expect. Let’s look at the features Rust provides specifically for writing -tests: the `test` attribute, a few macros, and the `should_panic` attribute. +the expected manner. The bodies of test functions typically perform these three +actions: + +1. Set up any needed data or state +2. Run the code we want to test +3. Assert the results are what we expect + +Let’s look at the features Rust provides specifically for writing tests that +take these actions, which include the `test` attribute, a few macros, and the +`should_panic` attribute. ### The Anatomy of a Test Function At its simplest, a test in Rust is a function that’s annotated with the `test` -attribute. Attributes are metadata about pieces of Rust code: the `derive` -attribute that we used with structs in Chapter 5 is one example. To make a -function into a test function, we add `#[test]` on the line before `fn`. When -we run our tests with the `cargo test` command, Rust will build a test runner -binary that runs the functions annotated with the `test` attribute and reports -on whether each test function passes or fails. +attribute. Attributes are metadata about pieces of Rust code; one example is +the `derive` attribute we used with structs in Chapter 5. To change a function +into a test function, we add `#[test]` on the line before `fn`. When we run our +tests with the `cargo test` command, Rust builds a test runner binary that runs +the functions annotated with the `test` attribute and reports on whether each +test function passes or fails. -We saw in Chapter 7 that when you make a new library project with Cargo, a test -module with a test function in it is automatically generated for us. This is to -help us get started writing our tests so we don’t have to go look up the -exact structure and syntax of test functions every time we start a new project. -We can add as many additional test functions and as many test modules as we -want, though! +In Chapter 7, we saw that when we make a new library project with Cargo, a test +module with a test function in it is automatically generated for us. This +module helps us start writing our tests so we don’t have to look up the exact +structure and syntax of test functions every time we start a new project. We +can add as many additional test functions and as many test modules as we want! -We’re going to explore some aspects of how tests work by experimenting with the -template test generated for us, without actually testing any code. Then we’ll -write some real-world tests that call some code that we’ve written and assert -that its behavior is correct. +We’ll explore some aspects of how tests work by experimenting with the template +test generated for us without actually testing any code. Then we’ll write some +real-world tests that call some code that we’ve written and assert that its +behavior is correct. Let’s create a new library project called `adder`: @@ -36,8 +41,8 @@ $ cargo new adder $ cd adder ``` -The contents of the `src/lib.rs` file in your adder library should be as -follows: +The contents of the *src/lib.rs* file in your adder library should look like +Listing 11-1: Filename: src/lib.rs @@ -52,21 +57,21 @@ mod tests { ``` Listing 11-1: The test module and function generated -automatically for us by `cargo new` +automatically by `cargo new` For now, let’s ignore the top two lines and focus on the function to see how it works. Note the `#[test]` annotation before the `fn` line: this attribute -indicates this is a test function, so that the test runner knows to treat this +indicates this is a test function, so the test runner knows to treat this function as a test. We could also have non-test functions in the `tests` module to help set up common scenarios or perform common operations, so we need to -indicate which functions are tests with the `#[test]` attribute. +indicate which functions are tests by using the `#[test]` attribute. The function body uses the `assert_eq!` macro to assert that 2 + 2 equals 4. This assertion serves as an example of the format for a typical test. Let’s run -it and see that this test passes. +it to see that this test passes. -The `cargo test` command runs all tests we have in our project, as shown in -Listing 11-2: +The `cargo test` command runs all tests in our project, as shown in Listing +11-2: ```text $ cargo test @@ -77,41 +82,44 @@ $ cargo test running 1 test test tests::it_works ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Doc-tests adder running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Listing 11-2: The output from running the one -automatically generated test +Listing 11-2: The output from running the automatically +generated test -Cargo compiled and ran our test. After the `Compiling`, `Finished`, and -`Running` lines, we see the line `running 1 test`. The next line shows the name +Cargo compiled and ran the test. After the `Compiling`, `Finished`, and +`Running` lines is the line `running 1 test`. The next line shows the name of the generated test function, called `it_works`, and the result of running -that test, `ok`. Then we see the overall summary of running the tests: `test -result: ok.` means all the tests passed. `1 passed; 0 failed` adds up the -number of tests that passed or failed. +that test, `ok`. The overall summary of running the tests appears next. The +text `test result: ok.` means that all the tests passed, and the portion that +reads `1 passed; 0 failed` totals the number of tests that passed or failed. -We don’t have any tests we’ve marked as ignored, so the summary says `0 -ignored`. We’re going to talk about ignoring tests in the next section on -different ways to run tests. The `0 measured` statistic is for benchmark tests -that measure performance. Benchmark tests are, as of this writing, only -available in nightly Rust. See Chapter 1 for more information about nightly -Rust. +Because we don’t have any tests we’ve marked as ignored, the summary shows `0 +ignored`. We also haven’t filtered the tests being run, so the end of the +summary shows `0 filtered out`. We’ll talk about ignoring and filtering out +tests in the next section, “Controlling How Tests Are Run.” -The next part of the test output that starts with `Doc-tests adder` is for the -results of any documentation tests. We don’t have any documentation tests yet, -but Rust can compile any code examples that appear in our API documentation. -This feature helps us keep our docs and our code in sync! We’ll be talking -about how to write documentation tests in the “Documentation Comments” section -of Chapter 14. We’re going to ignore the `Doc-tests` output for now. +The `0 measured` statistic is for benchmark tests that measure performance. +Benchmark tests are, as of this writing, only available in nightly Rust. See +Chapter 1 for more information about nightly Rust. -Let’s change the name of our test and see how that changes the test output. -Give the `it_works` function a different name, such as `exploration`, like so: +The next part of the test output, which starts with `Doc-tests adder`, is for +the results of any documentation tests. We don’t have any documentation tests +yet, but Rust can compile any code examples that appear in our API +documentation. This feature helps us keep our docs and our code in sync! We’ll +discuss how to write documentation tests in the “Documentation Comments” +section of Chapter 14. For now, we’ll ignore the `Doc-tests` output. + +Let’s change the name of our test to see how that changes the test output. +Change the `it_works` function to a different name, such as `exploration`, like +so: Filename: src/lib.rs @@ -125,22 +133,22 @@ mod tests { } ``` -And run `cargo test` again. In the output, we’ll now see `exploration` instead -of `it_works`: +Then run `cargo test` again. The output now shows `exploration` instead of +`it_works`: ```text running 1 test test tests::exploration ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` Let’s add another test, but this time we’ll make a test that fails! Tests fail when something in the test function panics. Each test is run in a new thread, and when the main thread sees that a test thread has died, the test is marked -as failed. We talked about the simplest way to cause a panic in Chapter 9: call -the `panic!` macro! Type in the new test so that your `src/lib.rs` now looks -like Listing 11-3: +as failed. We talked about the simplest way to cause a panic in Chapter 9, +which is to call the `panic!` macro. Enter the new test, `another`, so your +*src/lib.rs* file looks like Listing 11-3: Filename: src/lib.rs @@ -159,10 +167,10 @@ mod tests { } ``` -Listing 11-3: Adding a second test; one that will fail -since we call the `panic!` macro +Listing 11-3: Adding a second test that will fail because +we call the `panic!` macro -And run the tests again with `cargo test`. The output should look like Listing +Run the tests again using `cargo test`. The output should look like Listing 11-4, which shows that our `exploration` test passed and `another` failed: ```text @@ -173,13 +181,13 @@ test tests::another ... FAILED failures: ---- tests::another stdout ---- - thread 'tests::another' panicked at 'Make this test fail', src/lib.rs:9 + thread 'tests::another' panicked at 'Make this test fail', src/lib.rs:10:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::another -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out error: test failed ``` @@ -187,34 +195,35 @@ error: test failed Listing 11-4: Test results when one test passes and one test fails -Instead of `ok`, the line `test tests::another` says `FAILED`. We have two new -sections between the individual results and the summary: the first section -displays the detailed reason for the test failures. In this case, `another` -failed because it `panicked at 'Make this test fail'`, which happened on -*src/lib.rs* line 9. The next section lists just the names of all the failing -tests, which is useful when there are lots of tests and lots of detailed -failing test output. We can use the name of a failing test to run just that -test in order to more easily debug it; we’ll talk more about ways to run tests -in the next section. +Instead of `ok`, the line `test tests::another` shows `FAILED`. Two new +sections appear between the individual results and the summary: the first +section displays the detailed reason for each test failure. In this case, +`another` failed because it `panicked at 'Make this test fail'`, which happened +on line 10 in the *src/lib.rs* file. The next section lists just the names of +all the failing tests, which is useful when there are lots of tests and lots of +detailed failing test output. We can use the name of a failing test to run just +that test to more easily debug it; we’ll talk more about ways to run tests in +the “Controlling How Tests Are Run” section. -Finally, we have the summary line: overall, our test result is `FAILED`. We had -1 test pass and 1 test fail. +The summary line displays at the end: overall, our test result is `FAILED`. +We had one test pass and one test fail. -Now that we’ve seen what the test results look like in different scenarios, +Now that you’ve seen what the test results look like in different scenarios, let’s look at some macros other than `panic!` that are useful in tests. ### Checking Results with the `assert!` Macro The `assert!` macro, provided by the standard library, is useful when you want to ensure that some condition in a test evaluates to `true`. We give the -`assert!` macro an argument that evaluates to a boolean. If the value is `true`, -`assert!` does nothing and the test passes. If the value is `false`, `assert!` -calls the `panic!` macro, which causes the test to fail. This is one macro that -helps us check that our code is functioning in the way we intend. +`assert!` macro an argument that evaluates to a Boolean. If the value is +`true`, `assert!` does nothing and the test passes. If the value is `false`, +the `assert!` macro calls the `panic!` macro, which causes the test to fail. +Using the `assert!` macro helps us check that our code is functioning in the +way we intend. -Remember all the way back in Chapter 5, Listing 5-9, where we had a `Rectangle` -struct and a `can_hold` method, repeated here in Listing 11-5. Let’s put this -code in *src/lib.rs* and write some tests for it using the `assert!` macro. +In Chapter 5, Listing 5-15, we used a `Rectangle` struct and a `can_hold` +method, which are repeated here in Listing 11-5. Let’s put this code in the +*src/lib.rs* file and write some tests for it using the `assert!` macro. Filename: src/lib.rs @@ -232,11 +241,11 @@ impl Rectangle { } ``` -Listing 11-5: The `Rectangle` struct and its `can_hold` -method from Chapter 5 +Listing 11-5: Using the `Rectangle` struct and its +`can_hold` method from Chapter 5 -The `can_hold` method returns a boolean, which means it’s a perfect use case -for the `assert!` macro. In Listing 11-6, let’s write a test that exercises the +The `can_hold` method returns a Boolean, which means it’s a perfect use case +for the `assert!` macro. In Listing 11-6, we write a test that exercises the `can_hold` method by creating a `Rectangle` instance that has a length of 8 and a width of 7, and asserting that it can hold another `Rectangle` instance that has a length of 5 and a width of 1: @@ -259,25 +268,25 @@ mod tests { ``` Listing 11-6: A test for `can_hold` that checks that a -larger rectangle indeed holds a smaller rectangle +larger rectangle can indeed hold a smaller rectangle -Note that we’ve added a new line inside the `tests` module: `use super::*;`. -The `tests` module is a regular module that follows the usual visibility rules -we covered in Chapter 7. Because we’re in an inner module, we need to bring the -code under test in the outer module into the scope of the inner module. We’ve -chosen to use a glob here so that anything we define in the outer module is -available to this `tests` module. +Note that we’ve added a new line inside the `tests` module: the `use super::*;` +line. The `tests` module is a regular module that follows the usual visibility +rules we covered in Chapter 7 in the “Privacy Rules” section. Because the +`tests` module is an inner module, we need to bring the code under test in the +outer module into the scope of the inner module. We use a glob here so anything +we define in the outer module is available to this `tests` module. We’ve named our test `larger_can_hold_smaller`, and we’ve created the two `Rectangle` instances that we need. Then we called the `assert!` macro and -passed it the result of calling `larger.can_hold(&smaller)`. This expression is -supposed to return `true`, so our test should pass. Let’s find out! +passed it the result of calling `larger.can_hold(&smaller)`. This expression +is supposed to return `true`, so our test should pass. Let’s find out! ```text running 1 test test tests::larger_can_hold_smaller ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` It does pass! Let’s add another test, this time asserting that a smaller @@ -292,10 +301,7 @@ mod tests { #[test] fn larger_can_hold_smaller() { - let larger = Rectangle { length: 8, width: 7 }; - let smaller = Rectangle { length: 5, width: 1 }; - - assert!(larger.can_hold(&smaller)); + // --snip-- } #[test] @@ -309,28 +315,29 @@ mod tests { ``` Because the correct result of the `can_hold` function in this case is `false`, -we need to negate that result before we pass it to the `assert!` macro. This -way, our test will pass if `can_hold` returns `false`: +we need to negate that result before we pass it to the `assert!` macro. As a +result, our test will pass if `can_hold` returns `false`: ```text running 2 tests test tests::smaller_cannot_hold_larger ... ok test tests::larger_can_hold_smaller ... ok -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Two passing tests! Now let’s see what happens to our test results if we +Two tests that pass! Now let’s see what happens to our test results when we introduce a bug in our code. Let’s change the implementation of the `can_hold` -method to have a less-than sign when it compares the lengths where it’s -supposed to have a greater-than sign: +method by replacing the greater-than sign with a less-than sign when it +compares the lengths: ```rust -#[derive(Debug)] -pub struct Rectangle { - length: u32, - width: u32, -} +# #[derive(Debug)] +# pub struct Rectangle { +# length: u32, +# width: u32, +# } +// --snip-- impl Rectangle { pub fn can_hold(&self, other: &Rectangle) -> bool { @@ -339,7 +346,7 @@ impl Rectangle { } ``` -Running the tests now produces: +Running the tests now produces the following: ```text running 2 tests @@ -349,36 +356,36 @@ test tests::larger_can_hold_smaller ... FAILED failures: ---- tests::larger_can_hold_smaller stdout ---- - thread 'tests::larger_can_hold_smaller' panicked at 'assertion failed: - larger.can_hold(&smaller)', src/lib.rs:22 + thread 'tests::larger_can_hold_smaller' panicked at 'assertion failed: + larger.can_hold(&smaller)', src/lib.rs:22:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::larger_can_hold_smaller -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -Our tests caught the bug! Since `larger.length` is 8 and `smaller.length` is 5, -the comparison of the lengths in `can_hold` now returns `false` since 8 is not +Our tests caught the bug! Because `larger.length` is 8 and `smaller.length` is +5, the comparison of the lengths in `can_hold` now returns `false`: 8 is not less than 5. ### Testing Equality with the `assert_eq!` and `assert_ne!` Macros -A common way to test functionality is to take the result of the code under test -and the value we expect the code to return and check that they’re equal. We +A common way to test functionality is to compare the result of the code under +test to the value we expect the code to return to make sure they’re equal. We could do this using the `assert!` macro and passing it an expression using the `==` operator. However, this is such a common test that the standard library -provides a pair of macros to perform this test more conveniently: `assert_eq!` -and `assert_ne!`. These macros compare two arguments for equality or -inequality, respectively. They’ll also print out the two values if the -assertion fails, so that it’s easier to see *why* the test failed, while the -`assert!` macro only tells us that it got a `false` value for the `==` +provides a pair of macros—`assert_eq!` and `assert_ne!`—to perform this test +more conveniently. These macros compare two arguments for equality or +inequality, respectively. They’ll also print the two values if the assertion +fails, which makes it easier to see *why* the test failed; conversely, the +`assert!` macro only indicates that it got a `false` value for the `==` expression, not the values that lead to the `false` value. -In Listing 11-7, let’s write a function named `add_two` that adds two to its -parameter and returns the result. Then let’s test this function using the -`assert_eq!` macro: +In Listing 11-7, we write a function named `add_two` that adds `2` to its +parameter and returns the result. Then we test this function using the +`assert_eq!` macro. Filename: src/lib.rs @@ -407,16 +414,16 @@ Let’s check that it passes! running 1 test test tests::it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -The first argument we gave to the `assert_eq!` macro, 4, is equal to the result -of calling `add_two(2)`. We see a line for this test that says `test +The first argument we gave to the `assert_eq!` macro, `4`, is equal to the +result of calling `add_two(2)`. The line for this test is `test tests::it_adds_two ... ok`, and the `ok` text indicates that our test passed! Let’s introduce a bug into our code to see what it looks like when a test that uses `assert_eq!` fails. Change the implementation of the `add_two` function to -instead add 3: +instead add `3`: ```rust pub fn add_two(a: i32) -> i32 { @@ -424,7 +431,7 @@ pub fn add_two(a: i32) -> i32 { } ``` -And run the tests again: +Run the tests again: ```text running 1 test @@ -433,62 +440,64 @@ test tests::it_adds_two ... FAILED failures: ---- tests::it_adds_two stdout ---- - thread 'tests::it_adds_two' panicked at 'assertion failed: `(left == - right)` (left: `4`, right: `5`)', src/lib.rs:11 + thread 'tests::it_adds_two' panicked at 'assertion failed: `(left == right)` + left: `4`, + right: `5`', src/lib.rs:11:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::it_adds_two -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -Our test caught the bug! The `it_adds_two` test failed with the message `` -assertion failed: `(left == right)` (left: `4`, right: `5`) ``. This message is -useful and helps us get started debugging: it says the `left` argument to -`assert_eq!` was 4, but the `right` argument, where we had `add_two(2)`, was 5. +Our test caught the bug! The `it_adds_two` test failed, displaying the message +`` assertion failed: `(left == right)` `` and showing that `left` was `4` and +`right` was `5`. This message is useful and helps us start debugging: it means +the `left` argument to `assert_eq!` was `4`, but the `right` argument, where we +had `add_two(2)`, was `5`. Note that in some languages and test frameworks, the parameters to the -functions that assert two values are equal are called `expected` and `actual` +functions that assert two values are equal are called `expected` and `actual`, and the order in which we specify the arguments matters. However, in Rust, -they’re called `left` and `right` instead, and the order in which we specify -the value we expect and the value that the code under test produces doesn’t -matter. We could write the assertion in this test as -`assert_eq!(add_two(2), 4)`, which would result in a failure message that says -`` assertion failed: `(left == right)` (left: `5`, right: `4`) ``. +they’re called `left` and `right`, and the order in which we specify the value +we expect and the value that the code under test produces doesn’t matter. We +could write the assertion in this test as `assert_eq!(add_two(2), 4)`, which +would result in a failure message that displays `` assertion failed: `(left == +right)` `` and that `left` was `5` and `right` was `4`. -The `assert_ne!` macro will pass if the two values we give to it are not equal -and fail if they are equal. This macro is most useful for cases when we’re not -sure exactly what a value *will* be, but we know what the value definitely -*won’t* be, if our code is functioning as we intend. For example, if we have a -function that is guaranteed to change its input in some way, but the way in -which the input is changed depends on the day of the week that we run our -tests, the best thing to assert might be that the output of the function is not -equal to the input. +The `assert_ne!` macro will pass if the two values we give it are not equal and +fail if they’re equal. This macro is most useful for cases when we’re not sure +what a value *will* be, but we know what the value definitely *won’t* be if our +code is functioning as we intend. For example, if we’re testing a function that +is guaranteed to change its input in some way, but the way in which the input +is changed depends on the day of the week that we run our tests, the best thing +to assert might be that the output of the function is not equal to the input. Under the surface, the `assert_eq!` and `assert_ne!` macros use the operators `==` and `!=`, respectively. When the assertions fail, these macros print their arguments using debug formatting, which means the values being compared must -implement the `PartialEq` and `Debug` traits. All of the primitive types and -most of the standard library types implement these traits. For structs and -enums that you define, you’ll need to implement `PartialEq` in order to be able -to assert that values of those types are equal or not equal. You’ll need to -implement `Debug` in order to be able to print out the values in the case that -the assertion fails. Because both of these traits are derivable traits, as we -mentioned in Chapter 5, this is usually as straightforward as adding the -`#[derive(PartialEq, Debug)]` annotation to your struct or enum definition. See -Appendix C for more details about these and other derivable traits. +implement the `PartialEq` and `Debug` traits. All the primitive types and most +of the standard library types implement these traits. For structs and enums +that you define, you’ll need to implement `PartialEq` to assert that values of +those types are equal or not equal. You’ll need to implement `Debug` to print +out the values when the assertion fails. Because both traits are derivable +traits, as mentioned in Listing 5-12 in Chapter 5, this is usually as +straightforward as adding the `#[derive(PartialEq, Debug)]` annotation to your +struct or enum definition. See Appendix C for more details about these and +other derivable traits. -### Custom Failure Messages +### Adding Custom Failure Messages We can also add a custom message to be printed with the failure message as -optional arguments to `assert!`, `assert_eq!`, and `assert_ne!`. Any arguments -specified after the one required argument to `assert!` or the two required -arguments to `assert_eq!` and `assert_ne!` are passed along to the `format!` -macro that we talked about in Chapter 8, so you can pass a format string that -contains `{}` placeholders and values to go in the placeholders. Custom -messages are useful in order to document what an assertion means, so that when -the test fails, we have a better idea of what the problem is with the code. +optional arguments to the `assert!`, `assert_eq!`, and `assert_ne!` macros. Any +arguments specified after the one required argument to `assert!` or the two +required arguments to `assert_eq!` and `assert_ne!` are passed along to the +`format!` macro (discussed in Chapter 8 in the “Concatenation with the `+` +Operator or the `format!` Macro” section), so you can pass a format string that +contains `{}` placeholders and values to go in those placeholders. Custom +messages are useful to document what an assertion means; when a test fails, +we’ll have a better idea of what the problem is with the code. For example, let’s say we have a function that greets people by name, and we want to test that the name we pass into the function appears in the output: @@ -516,11 +525,11 @@ The requirements for this program haven’t been agreed upon yet, and we’re pretty sure the `Hello` text at the beginning of the greeting will change. We decided we don’t want to have to update the test for the name when that happens, so instead of checking for exact equality to the value returned from -the `greeting` function, we’re just going to assert that the output contains -the text of the input parameter. +the `greeting` function, we’ll just assert that the output contains the text of +the input parameter. -Let’s introduce a bug into this code to see what this test failure looks like, -by changing `greeting` to not include `name`: +Let’s introduce a bug into this code by changing `greeting` to not include +`name` to see what this test failure looks like: ```rust pub fn greeting(name: &str) -> String { @@ -528,7 +537,7 @@ pub fn greeting(name: &str) -> String { } ``` -Running this test produces: +Running this test produces the following: ```text running 1 test @@ -537,19 +546,19 @@ test tests::greeting_contains_name ... FAILED failures: ---- tests::greeting_contains_name stdout ---- - thread 'tests::greeting_contains_name' panicked at 'assertion failed: - result.contains("Carol")', src/lib.rs:12 + thread 'tests::greeting_contains_name' panicked at 'assertion failed: +result.contains("Carol")', src/lib.rs:12:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::greeting_contains_name ``` -This just tells us that the assertion failed and which line the assertion is -on. A more useful failure message in this case would print the value we did get -from the `greeting` function. Let’s change the test function to have a custom -failure message made from a format string with a placeholder filled in with the -actual value we got from the `greeting` function: +This result just indicates that the assertion failed and which line the +assertion is on. A more useful failure message in this case would print the +value we got from the `greeting` function. Let’s change the test function, +giving it a custom failure message made from a format string with a placeholder +filled in with the actual value we got from the `greeting` function: ```rust,ignore #[test] @@ -562,12 +571,12 @@ fn greeting_contains_name() { } ``` -Now if we run the test again, we’ll get a much more informative error message: +Now when we run the test, we’ll get a more informative error message: ```text ---- tests::greeting_contains_name stdout ---- - thread 'tests::greeting_contains_name' panicked at 'Greeting did not contain - name, value was `Hello`', src/lib.rs:12 + thread 'tests::greeting_contains_name' panicked at 'Greeting did not +contain name, value was `Hello!`', src/lib.rs:12:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` @@ -578,18 +587,18 @@ debug what happened instead of what we were expecting to happen. In addition to checking that our code returns the correct values we expect, it’s also important to check that our code handles error conditions as we -expect. For example, consider the `Guess` type that we created in Chapter 9 in -Listing 9-8. Other code that uses `Guess` is depending on the guarantee that -`Guess` instances will only contain values between 1 and 100. We can write a -test that ensures that attempting to create a `Guess` instance with a value -outside that range panics. +expect. For example, consider the `Guess` type that we created in Chapter 9, +Listing 9-9. Other code that uses `Guess` depends on the guarantee that `Guess` +instances will only contain values between 1 and 100. We can write a test that +ensures that attempting to create a `Guess` instance with a value outside that +range panics. -We can do this by adding another attribute, `should_panic`, to our test -function. This attribute makes a test pass if the code inside the function -panics, and the test will fail if the code inside the function doesn’t panic. +We do this by adding another attribute, `should_panic`, to our test function. +This attribute makes a test pass if the code inside the function panics; the +test will fail if the code inside the function doesn’t panic. -Listing 11-8 shows how we’d write a test that checks the error conditions of -`Guess::new` happen when we expect: +Listing 11-8 shows a test that checks that the error conditions of `Guess::new` +happen when we expect: Filename: src/lib.rs @@ -625,18 +634,18 @@ mod tests { Listing 11-8: Testing that a condition will cause a `panic!` -The `#[should_panic]` attribute goes after the `#[test]` attribute and before -the test function it applies to. Let’s see what it looks like when this test +We place the `#[should_panic]` attribute after the `#[test]` attribute and +before the test function it applies to. Let’s look at the result when this test passes: ```text running 1 test test tests::greater_than_100 ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Looks good! Now let’s introduce a bug in our code, by removing the condition +Looks good! Now let’s introduce a bug in our code by removing the condition that the `new` function will panic if the value is greater than 100: ```rust @@ -644,6 +653,8 @@ that the `new` function will panic if the value is greater than 100: # value: u32, # } # +// --snip-- + impl Guess { pub fn new(value: u32) -> Guess { if value < 1 { @@ -657,7 +668,7 @@ impl Guess { } ``` -If we run the test from Listing 11-8, it will fail: +When we run the test in Listing 11-8, it will fail: ```text running 1 test @@ -668,15 +679,14 @@ failures: failures: tests::greater_than_100 -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -We don’t get a very helpful message in this case, but once we look at the test -function, we can see that it’s annotated with `#[should_panic]`. The failure we -got means that the code in the function, `Guess::new(200)`, did not cause a -panic. +We don’t get a very helpful message in this case, but when we look at the test +function, we see that it’s annotated with `#[should_panic]`. The failure we got +means that the code in the test function did not cause a panic. -`should_panic` tests can be imprecise, however, because they only tell us that +Tests that use `should_panic` can be imprecise because they only indicate that the code has caused some panic. A `should_panic` test would pass even if the test panics for a different reason than the one we were expecting to happen. To make `should_panic` tests more precise, we can add an optional `expected` @@ -688,9 +698,11 @@ different messages depending on whether the value was too small or too large: Filename: src/lib.rs ```rust -pub struct Guess { - value: u32, -} +# pub struct Guess { +# value: u32, +# } +# +// --snip-- impl Guess { pub fn new(value: u32) -> Guess { @@ -723,14 +735,15 @@ mod tests { Listing 11-9: Testing that a condition will cause a `panic!` with a particular panic message -This test will pass, because the value we put in the `expected` parameter of -the `should_panic` attribute is a substring of the message that the -`Guess::new` function panics with. We could have specified the whole panic -message that we expect, which in this case would be `Guess value must be less -than or equal to 100, got 200.` It depends on how much of the panic message is -unique or dynamic and how precise you want your test to be. In this case, a -substring of the panic message is enough to ensure that the code in the -function that gets run is the `else if value > 100` case. +This test will pass because the value we put in the `should_panic` attribute’s +`expected` parameter is a substring of the message that the `Guess::new` +function panics with. We could have specified the entire panic message that we +expect, which in this case would be `Guess value must be less than or equal to +100, got 200.` What you choose to specify in the expected parameter for +`should_panic` depends on how much of the panic message is unique or dynamic +and how precise you want your test to be. In this case, a substring of the +panic message is enough to ensure that the code in the test function executes +the `else if value > 100` case. To see what happens when a `should_panic` test with an `expected` message fails, let’s again introduce a bug into our code by swapping the bodies of the @@ -753,8 +766,8 @@ test tests::greater_than_100 ... FAILED failures: ---- tests::greater_than_100 stdout ---- - thread 'tests::greater_than_100' panicked at 'Guess value must be greater - than or equal to 1, got 200.', src/lib.rs:10 + thread 'tests::greater_than_100' panicked at 'Guess value must be +greater than or equal to 1, got 200.', src/lib.rs:11:12 note: Run with `RUST_BACKTRACE=1` for a backtrace. note: Panic did not include expected string 'Guess value must be less than or equal to 100' @@ -762,15 +775,15 @@ equal to 100' failures: tests::greater_than_100 -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` The failure message indicates that this test did indeed panic as we expected, -but the panic message did not include expected string `'Guess value must be -less than or equal to 100'`. We can see the panic message that we did get, -which in this case was `Guess value must be greater than or equal to 1, got -200.` We could then start figuring out where our bug was! +but the panic message did not include the expected string `'Guess value must be +less than or equal to 100'`. The panic message that we did get in this case was +`Guess value must be greater than or equal to 1, got 200.` Now we can start +figuring out where our bug is! -Now that we’ve gone over ways to write tests, let’s look at what is happening -when we run our tests and talk about the different options we can use with -`cargo test`. +Now that you know several ways to write tests, let’s look at what is happening +when we run our tests and explore the different options we can use with `cargo +test`. diff --git a/src/doc/book/second-edition/src/ch11-02-running-tests.md b/src/doc/book/second-edition/src/ch11-02-running-tests.md index 452c7fc661..74f8435fef 100644 --- a/src/doc/book/second-edition/src/ch11-02-running-tests.md +++ b/src/doc/book/second-edition/src/ch11-02-running-tests.md @@ -1,65 +1,63 @@ -## Controlling How Tests are Run +## Controlling How Tests Are Run Just as `cargo run` compiles your code and then runs the resulting binary, `cargo test` compiles your code in test mode and runs the resulting test -binary. There are options you can use to change the default behavior of `cargo -test`. For example, the default behavior of the binary produced by `cargo test` -is to run all the tests in parallel and capture output generated during test -runs, preventing it from being displayed to make it easier to read the output -related to the test results. You can change this default behavior by specifying -command line options. +binary. You can specify command line options to change the default behavior of +`cargo test`. For example, the default behavior of the binary produced by +`cargo test` is to run all the tests in parallel and capture output generated +during test runs, preventing the output from being displayed and making it +easier to read the output related to the test results. -Some command line options can be passed to `cargo test`, and some need to be -passed instead to the resulting test binary. To separate these two types of -arguments, you list the arguments that go to `cargo test`, then the separator -`--`, and then the arguments that go to the test binary. Running `cargo test ---help` will tell you about the options that go with `cargo test`, and running -`cargo test -- --help` will tell you about the options that go after the -separator `--`. +Some command line options go to `cargo test` and some go to the resulting test +binary. To separate these two types of arguments, you list the arguments that +go to `cargo test` followed by the separator `--` and then the arguments that +go to the test binary. Running `cargo test --help` displays the options you can +use with `cargo test`, and running `cargo test -- --help` displays the options +you can use after the separator `--`. ### Running Tests in Parallel or Consecutively -When multiple tests are run, by default they run in parallel using threads. -This means the tests will finish running faster, so that we can get faster -feedback on whether or not our code is working. Since the tests are running at -the same time, you should take care that your tests do not depend on each other -or on any shared state, including a shared environment such as the current -working directory or environment variables. +When you run multiple tests, by default they run in parallel using threads. +This means the tests will finish running faster so you can get feedback quicker +on whether or not your code is working. Because the tests are running at the +same time, make sure your tests don’t depend on each other or on any shared +state, including a shared environment, such as the current working directory or +environment variables. For example, say each of your tests runs some code that creates a file on disk -named `test-output.txt` and writes some data to that file. Then each test reads +named *test-output.txt* and writes some data to that file. Then each test reads the data in that file and asserts that the file contains a particular value, -which is different in each test. Because the tests are all run at the same -time, one test might overwrite the file between when another test writes and -reads the file. The second test will then fail, not because the code is -incorrect, but because the tests have interfered with each other while running -in parallel. One solution would be to make sure each test writes to a different -file; another solution is to run the tests one at a time. +which is different in each test. Because the tests run at the same time, one +test might overwrite the file between when another test writes and reads the +file. The second test will then fail, not because the code is incorrect, but +because the tests have interfered with each other while running in parallel. +One solution is to make sure each test writes to a different file; another +solution is to run the tests one at a time. -If you don’t want to run the tests in parallel, or if you want more -fine-grained control over the number of threads used, you can send the -`--test-threads` flag and the number of threads you want to use to the test -binary. For example: +If you don’t want to run the tests in parallel or if you want more fine-grained +control over the number of threads used, you can send the `--test-threads` flag +and the number of threads you want to use to the test binary. Take a look at +the following example: ```text $ cargo test -- --test-threads=1 ``` -We set the number of test threads to 1, telling the program not to use any -parallelism. This will take longer than running them in parallel, but the tests -won’t be potentially interfering with each other if they share state. +We set the number of test threads to `1`, telling the program not to use any +parallelism. Running the tests using one thread will take longer than running +them in parallel, but the tests won’t interfere with each other if they share +state. ### Showing Function Output By default, if a test passes, Rust’s test library captures anything printed to standard output. For example, if we call `println!` in a test and the test passes, we won’t see the `println!` output in the terminal: we’ll only see the -line that says the test passed. If a test fails, we’ll see whatever was printed -to standard output with the rest of the failure message. +line that indicates the test passed. If a test fails, we’ll see whatever was +printed to standard output with the rest of the failure message. -For example, Listing 11-10 has a silly function that prints out the value of -its parameter and then returns 10. We then have a test that passes and a test -that fails: +As an example, Listing 11-10 has a silly function that prints the value of its +parameter and returns 10, as well as a test that passes and a test that fails. Filename: src/lib.rs @@ -90,7 +88,7 @@ mod tests { Listing 11-10: Tests for a function that calls `println!` -The output we’ll see when we run these tests with `cargo test` is: +When we run these tests with `cargo test`, we’ll see the following output: ```text running 2 tests @@ -100,39 +98,41 @@ test tests::this_test_will_fail ... FAILED failures: ---- tests::this_test_will_fail stdout ---- - I got the value 8 -thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == -right)` (left: `5`, right: `10`)', src/lib.rs:19 + I got the value 8 +thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == right)` + left: `5`, + right: `10`', src/lib.rs:19:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: tests::this_test_will_fail -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` Note that nowhere in this output do we see `I got the value 4`, which is what -gets printed when the test that passes runs. That output has been captured. The +is printed when the test that passes runs. That output has been captured. The output from the test that failed, `I got the value 8`, appears in the section -of the test summary output that also shows the cause of the test failure. +of the test summary output, which also shows the cause of the test failure. -If we want to be able to see printed values for passing tests as well, the -output capture behavior can be disabled by using the `--nocapture` flag: +If we want to see printed values for passing tests as well, we can disable the +output capture behavior by using the `--nocapture` flag: ```text $ cargo test -- --nocapture ``` -Running the tests from Listing 11-10 again with the `--nocapture` flag now -shows: +When we run the tests in Listing 11-10 again with the `--nocapture` flag, we +see the following output: ```text running 2 tests I got the value 4 I got the value 8 test tests::this_test_will_pass ... ok -thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == -right)` (left: `5`, right: `10`)', src/lib.rs:19 +thread 'tests::this_test_will_fail' panicked at 'assertion failed: `(left == right)` + left: `5`, + right: `10`', src/lib.rs:19:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. test tests::this_test_will_fail ... FAILED @@ -141,13 +141,13 @@ failures: failures: tests::this_test_will_fail -test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ``` -Note that the output for the tests and the test results is interleaved; this is -because the tests are running in parallel as we talked about in the previous -section. Try using both the `--test-threads=1` option and the `--nocapture` -flag and see what the output looks like then! +Note that the output for the tests and the test results are interleaved; the +reason is that the tests are running in parallel, as we talked about in the +previous section. Try using the `--test-threads=1` option and the `--nocapture` +flag, and see what the output looks like then! ### Running a Subset of Tests by Name @@ -157,7 +157,7 @@ that code. You can choose which tests to run by passing `cargo test` the name or names of the test(s) you want to run as an argument. To demonstrate how to run a subset of tests, we’ll create three tests for our -`add_two` function as shown in Listing 11-11 and choose which ones to run: +`add_two` function, as shown in Listing 11-11, and choose which ones to run: Filename: src/lib.rs @@ -187,10 +187,11 @@ mod tests { } ``` -Listing 11-11: Three tests with a variety of names +Listing 11-11: Three tests with three different +names -If we run the tests without passing any arguments, as we’ve already seen, all -the tests will run in parallel: +If we run the tests without passing any arguments, as we saw earlier, all the +tests will run in parallel: ```text running 3 tests @@ -198,7 +199,7 @@ test tests::add_two_and_two ... ok test tests::add_three_and_two ... ok test tests::one_hundred ... ok -test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` #### Running Single Tests @@ -213,17 +214,21 @@ $ cargo test one_hundred running 1 test test tests::one_hundred ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out ``` -We can’t specify the names of multiple tests in this way, only the first value -given to `cargo test` will be used. +Only the test with the name `one_hundred` ran; the other two tests didn’t match +that name. The test output lets us know we had more tests than what this +command ran by displaying `2 filtered out` at the end of the summary line. + +We can’t specify the names of multiple tests in this way; only the first value +given to `cargo test` will be used. But there is a way to run multiple tests. #### Filtering to Run Multiple Tests -However, we can specify part of a test name, and any test whose name matches -that value will get run. For example, since two of our tests’ names contain -`add`, we can run those two by running `cargo test add`: +We can specify part of a test name, and any test whose name matches that value +will be run. For example, because two of our tests’ names contain `add`, we can +run those two by running `cargo test add`: ```text $ cargo test add @@ -234,19 +239,21 @@ running 2 tests test tests::add_two_and_two ... ok test tests::add_three_and_two ... ok -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out ``` -This ran all tests with `add` in the name. Also note that the module in which -tests appear becomes part of the test’s name, so we can run all the tests in a -module by filtering on the module’s name. +This command ran all tests with `add` in the name name and filtered out the +test named `one_hundred`. Also note that the module in which tests appear +becomes part of the test’s name, so we can run all the tests in a module by +filtering on the module’s name. -### Ignore Some Tests Unless Specifically Requested +### Ignoring Some Tests Unless Specifically Requested Sometimes a few specific tests can be very time-consuming to execute, so you might want to exclude them during most runs of `cargo test`. Rather than -listing as arguments all tests you do want to run, we can instead annotate the -time consuming tests with the `ignore` attribute to exclude them: +listing as arguments all tests you do want to run, you can instead annotate the +time-consuming tests using the `ignore` attribute to exclude them, as shown +here: Filename: src/lib.rs @@ -263,9 +270,8 @@ fn expensive_test() { } ``` -We add the `#[ignore]` line to the test we want to exclude, after `#[test]`. -Now if we run our tests, we’ll see `it_works` runs, but `expensive_test` does -not: +After `#[test]` we add the `#[ignore]` line to the test we want to exclude. Now +when we run our tests, `it_works` runs, but `expensive_test` doesn’t: ```text $ cargo test @@ -277,17 +283,11 @@ running 2 tests test expensive_test ... ignored test it_works ... ok -test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured - - Doc-tests adder - -running 0 tests - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ``` -`expensive_test` is listed as `ignored`. If we want to run only the ignored -tests, we can ask for them to be run with `cargo test -- --ignored`: +The `expensive_test` function is listed as `ignored`. If we want to run only +the ignored tests, we can use `cargo test -- --ignored`: ```text $ cargo test -- --ignored @@ -297,10 +297,10 @@ $ cargo test -- --ignored running 1 test test expensive_test ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out ``` By controlling which tests run, you can make sure your `cargo test` results -will be fast. When you’re at a point that it makes sense to check the results -of the `ignored` tests and you have time to wait for the results, you can -choose to run `cargo test -- --ignored` instead. +will be fast. When you’re at a point where it makes sense to check the results +of the `ignored` tests and you have time to wait for the results, you can run +`cargo test -- --ignored` instead. diff --git a/src/doc/book/second-edition/src/ch11-03-test-organization.md b/src/doc/book/second-edition/src/ch11-03-test-organization.md index 1f604bec71..f0617aaedf 100644 --- a/src/doc/book/second-edition/src/ch11-03-test-organization.md +++ b/src/doc/book/second-edition/src/ch11-03-test-organization.md @@ -1,12 +1,12 @@ ## Test Organization -As mentioned at the start of the chapter, testing is a large discipline, and +As mentioned at the start of the chapter, testing is a complex discipline, and different people use different terminology and organization. The Rust community -tends to think about tests in terms of two main categories: *unit tests* and -*integration tests*. Unit tests are smaller and more focused, testing one -module in isolation at a time, and can test private interfaces. Integration -tests are entirely external to your library, and use your code in the same way -any other external code would, using only the public interface and exercising +thinks about tests in terms of two main categories: *unit tests* and +*integration tests*. Unit tests are small and more focused, testing one module +in isolation at a time, and can test private interfaces. Integration tests are +entirely external to your library and use your code in the same way any other +external code would, using only the public interface and potentially exercising multiple modules per test. Writing both kinds of tests is important to ensure that the pieces of your @@ -15,24 +15,24 @@ library are doing what you expect them to separately and together. ### Unit Tests The purpose of unit tests is to test each unit of code in isolation from the -rest of the code, in order to be able to quickly pinpoint where code is and is -not working as expected. We put unit tests in the *src* directory, in each file -with the code that they’re testing. The convention is that we create a module -named `tests` in each file to contain the test functions, and we annotate the -module with `cfg(test)`. +rest of the code to quickly pinpoint where code is and isn’t working as +expected. We put unit tests in the *src* directory in each file with the code +that they’re testing. The convention is that we create a module named `tests` +in each file to contain the test functions, and we annotate the module with +`cfg(test)`. #### The Tests Module and `#[cfg(test)]` The `#[cfg(test)]` annotation on the tests module tells Rust to compile and run -the test code only when we run `cargo test`, and not when we run `cargo build`. -This saves compile time when we only want to build the library, and saves space -in the resulting compiled artifact since the tests are not included. We’ll see -that since integration tests go in a different directory, they don’t need the -`#[cfg(test)]` annotation. Because unit tests go in the same files as the code, -though, we use `#[cfg(test)]`to specify that they should not be included in the -compiled result. +the test code only when we run `cargo test`, but not when we run `cargo build`. +This saves compile time when we only want to build the library and saves space +in the resulting compiled artifact because the tests are not included. You’ll +see that because integration tests go in a different directory, they don’t need +the `#[cfg(test)]` annotation. However, because unit tests go in the same files +as the code, we use `#[cfg(test)]` to specify that they shouldn’t be included +in the compiled result. -Remember that when we generated the new `adder` project in the first section of +Recall that when we generated the new `adder` project in the first section of this chapter, Cargo generated this code for us: Filename: src/lib.rs @@ -47,18 +47,19 @@ mod tests { } ``` -This is the automatically generated test module. The attribute `cfg` stands for -*configuration*, and tells Rust that the following item should only be included -given a certain configuration option. In this case, the configuration option is -`test`, provided by Rust for compiling and running tests. By using this -attribute, Cargo only compiles our test code if we actively run the tests with -`cargo test`. This includes any helper functions that might be within this -module, in addition to the functions annotated with `#[test]`. +This code is the automatically generated test module. The attribute `cfg` +stands for *configuration* and tells Rust that the following item should only +be included given a certain configuration option. In this case, the +configuration option is `test`, which is provided by Rust for compiling and +running tests. By using the `cfg` attribute, Cargo compiles our test code only +if we actively run the tests with `cargo test`. This includes any helper +functions that might be within this module, in addition to the functions +annotated with `#[test]`. #### Testing Private Functions -There’s debate within the testing community about whether private functions -should be tested directly or not, and other languages make it difficult or +There’s debate within the testing community about whether or not private +functions should be tested directly, and other languages make it difficult or impossible to test private functions. Regardless of which testing ideology you adhere to, Rust’s privacy rules do allow you to test private functions. Consider the code in Listing 11-12 with the private function `internal_adder`: @@ -98,22 +99,21 @@ you to do so. In Rust, integration tests are entirely external to your library. They use your library in the same way any other code would, which means they can only call functions that are part of your library’s public API. Their purpose is to test -that many parts of your library work correctly together. Units of code that -work correctly by themselves could have problems when integrated, so test +that many parts of your library work together correctly. Units of code that +work correctly on their own could have problems when integrated, so test coverage of the integrated code is important as well. To create integration tests, you first need a *tests* directory. #### The *tests* Directory -To write integration tests for our code, we need to make a *tests* directory at -the top level of our project directory, next to *src*. Cargo knows to look for -integration test files in this directory. We can then make as many test files -as we’d like in this directory, and Cargo will compile each of the files as an -individual crate. +We create a *tests* directory at the top level of our project directory, next +to *src*. Cargo knows to look for integration test files in this directory. We +can then make as many test files as we want to in this directory, and Cargo +will compile each of the files as an individual crate. -Let’s give it a try! Keep the code from Listing 11-12 in *src/lib.rs*. Make a -*tests* directory, then make a new file named *tests/integration_test.rs*, and -enter the code in Listing 11-13. +Let’s create an integration test. With the code in Listing 11-12 still in the +*src/lib.rs* file, make a *tests* directory, create a new file named +*tests/integration_test.rs*, and enter the code in Listing 11-13: Filename: tests/integration_test.rs @@ -129,19 +129,16 @@ fn it_adds_two() { Listing 11-13: An integration test of a function in the `adder` crate -We’ve added `extern crate adder` at the top, which we didn’t need in the unit -tests. This is because each test in the `tests` directory is an entirely -separate crate, so we need to import our library into each of them. Integration -tests use the library like any other consumer of it would, by importing the -crate and using only the public API. +We’ve added `extern crate adder` at the top of the code, which we didn’t need +in the unit tests. The reason is that each test in the `tests` directory is a +separate crate, so we need to import our library into each of them. We don’t need to annotate any code in *tests/integration_test.rs* with -`#[cfg(test)]`. Cargo treats the `tests` directory specially and will only -compile files in this directory if we run `cargo test`. Let’s try running -`cargo test` now: +`#[cfg(test)]`. Cargo treats the `tests` directory specially and compiles files +in this directory only when we run `cargo test`. Run `cargo test` now: ```text -cargo test +$ cargo test Compiling adder v0.1.0 (file:///projects/adder) Finished dev [unoptimized + debuginfo] target(s) in 0.31 secs Running target/debug/deps/adder-abcabcabc @@ -149,41 +146,41 @@ cargo test running 1 test test tests::internal ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running target/debug/deps/integration_test-ce99bcc2479f4607 running 1 test test it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Doc-tests adder running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Now we have three sections of output: the unit tests, the integration test, and -the doc tests. The first section for the unit tests is the same as we have been -seeing: one line for each unit test (we have one named `internal` that we added -in Listing 11-12), then a summary line for the unit tests. +The three sections of output include the unit tests, the integration test, and +the doc tests. The first section for the unit tests is the same as we’ve been +seeing: one line for each unit test (one named `internal` that we added in +Listing 11-12) and then a summary line for the unit tests. -The integration tests section starts with the line that says `Running +The integration tests section starts with the line `Running target/debug/deps/integration-test-ce99bcc2479f4607` (the hash at the end of -your output will be different). Then there’s a line for each test function in -that integration test, and a summary line for the results of the integration +your output will be different). Next, there is a line for each test function in +that integration test and a summary line for the results of the integration test just before the `Doc-tests adder` section starts. -Note that adding more unit test functions in any *src* file will add more test +Recall that adding more unit test functions in any *src* file adds more test result lines to the unit tests section. Adding more test functions to the -integration test file we created will add more lines to the integration test -section. Each integration test file gets its own section, so if we add more -files in the *tests* directory, there will be more integration test sections. +integration test file we created adds more lines to that file’s section. Each +integration test file has its own section, so if we add more files in the +*tests* directory, there will be more integration test sections. We can still run a particular integration test function by specifying the test -function’s name as an argument to `cargo test`. To run all of the tests in a +function’s name as an argument to `cargo test`. To run all the tests in a particular integration test file, use the `--test` argument of `cargo test` followed by the name of the file: @@ -195,31 +192,31 @@ $ cargo test --test integration_test running 1 test test it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -This tests only the file that we specified from the *tests* directory. +This command runs only the tests in the *tests/integration_test.rs* file. #### Submodules in Integration Tests -As you add more integration tests, you may want to make more than one file in -the *tests* directory to help organize them; for example, to group the test -functions by the functionality they’re testing. As we mentioned, each file in -the *tests* directory is compiled as its own separate crate. +As you add more integration tests, you might want to make more than one file in +the *tests* directory to help organize them; for example, you can group the +test functions by the functionality they’re testing. As mentioned earlier, each +file in the *tests* directory is compiled as its own separate crate. Treating each integration test file as its own crate is useful to create separate scopes that are more like the way end users will be using your crate. However, this means files in the *tests* directory don’t share the same -behavior as files in *src* do that we learned about in Chapter 7 regarding how -to separate code into modules and files. +behavior as files in *src* do, which you learned in Chapter 7 regarding how to +separate code into modules and files. -The different behavior of files in the *tests* directory is usually most -noticeable if you have a set of helper functions that would be useful in -multiple integration test files, and you try to follow the steps from Chapter 7 -to extract them into a common module. For example, if we create -*tests/common.rs* and place this function named `setup` in it, where we could -put some code that we want to be able to call from multiple test functions in -multiple test files: +The different behavior of files in the *tests* directory is most noticeable +when you have a set of helper functions that would be useful in multiple +integration test files and you try to follow the steps in the “Moving Modules +to Other Files” section of Chapter 7 to extract them into a common module. For +example, if we create *tests/common.rs* and place a function named `setup` in +it, we can add some code to `setup` that we want to call from multiple test +functions in multiple test files: Filename: tests/common.rs @@ -229,51 +226,54 @@ pub fn setup() { } ``` -If we run the tests again, we’ll see a new section in the test output for the +When we run the tests again, we’ll see a new section in the test output for the *common.rs* file, even though this file doesn’t contain any test functions, nor -are we calling the `setup` function from anywhere: +did we call the `setup` function from anywhere: ```text running 1 test test tests::internal ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running target/debug/deps/common-b8b07b6f1be2db70 running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running target/debug/deps/integration_test-d993c68b431d39df running 1 test test it_adds_two ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Doc-tests adder running 0 tests -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Having `common` show up in the test results with `running 0 tests` displayed -for it is not what we wanted; we just wanted to be able to share some code with -the other integration test files. +Having `common` appear in the test results with `running 0 tests` displayed for +it is not what we wanted. We just wanted to share some code with the other +integration test files. -In order to not have `common` show up in the test output, we need to use the -other method of extracting code into a file that we learned about in Chapter 7: -instead of creating *tests/common.rs*, we’ll create *tests/common/mod.rs*. When -we move the `setup` function code into *tests/common/mod.rs* and get rid of the -*tests/common.rs* file, the section in the test output will no longer show up. -Files in subdirectories of the *tests* directory do not get compiled as -separate crates or have sections in the test output. +To avoid having `common` appear in the test output, instead of creating +*tests/common.rs*, we’ll create *tests/common/mod.rs*. In the “Rules of Module +Filesystems” section of Chapter 7, we used the naming convention +*module_name/mod.rs* for files of modules that have submodules, and we don’t +have submodules for `common` here, but naming the file this way tells Rust not +to treat the `common` module as an integration test file. When we move the +`setup` function code into *tests/common/mod.rs* and delete the +*tests/common.rs* file, the section in the test output will no longer appear. +Files in subdirectories of the *tests* directory don’t get compiled as separate +crates or have sections in the test output. -Once we have *tests/common/mod.rs*, we can use it from any of the integration -test files as a module. Here’s an example of calling the `setup` function from -the `it_adds_two` test in *tests/integration_test.rs*: +After we’ve created *tests/common/mod.rs*, we can use it from any of the +integration test files as a module. Here’s an example of calling the `setup` +function from the `it_adds_two` test in *tests/integration_test.rs*: Filename: tests/integration_test.rs @@ -289,35 +289,37 @@ fn it_adds_two() { } ``` -Note the `mod common;` declaration is the same as the module declarations we -did in Chapter 7. Then in the test function, we can call the `common::setup()` -function. +Note that the `mod common;` declaration is the same as the module declarations +we demonstrated in Listing 7-4. Then in the test function, we can call the +`common::setup()` function. #### Integration Tests for Binary Crates -If our project is a binary crate that only contains a *src/main.rs* and does -not have a *src/lib.rs*, we aren’t able to create integration tests in the -*tests* directory and use `extern crate` to import functions defined in -*src/main.rs*. Only library crates expose functions that other crates are able -to call and use; binary crates are meant to be run on their own. +If our project is a binary crate that only contains a *src/main.rs* file and +doesn’t have a *src/lib.rs* file, we can’t create integration tests in the +*tests* directory and use `extern crate` to import functions defined in the +*src/main.rs* file. Only library crates expose functions that other crates can +call and use; binary crates are meant to be run on their own. This is one of the reasons Rust projects that provide a binary have a -straightforward *src/main.rs* that calls logic that lives in *src/lib.rs*. With -that structure, integration tests *can* test the library crate by using `extern -crate` to cover the important functionality. If the important functionality -works, the small amount of code in *src/main.rs* will work as well, and that -small amount of code does not need to be tested. +straightforward *src/main.rs* file that calls logic that lives in the +*src/lib.rs* file. Using that structure, integration tests *can* test the +library crate by using `extern crate` to exercise the important functionality. +If the important functionality works, the small amount of code in the +*src/main.rs* file will work as well, and that small amount of code doesn’t +need to be tested. ## Summary Rust’s testing features provide a way to specify how code should function to ensure it continues to work as we expect even as we make changes. Unit tests exercise different parts of a library separately and can test private -implementation details. Integration tests cover the use of many parts of the -library working together, and they use the library’s public API to test the -code in the same way external code will use it. Even though Rust’s type system -and ownership rules help prevent some kinds of bugs, tests are still important -to help reduce logic bugs having to do with how your code is expected to behave. +implementation details. Integration tests check that many parts of the library +work together correctly, and they use the library’s public API to test the code +in the same way external code will use it. Even though Rust’s type system and +ownership rules help prevent some kinds of bugs, tests are still important to +help reduce logic bugs having to do with how your code is expected to behave. + +Let’s combine the knowledge you learned in this chapter and in previous +chapters and work on a project in the next chapter! -Let’s put together the knowledge from this chapter and other previous chapters -and work on a project in the next chapter! diff --git a/src/doc/book/second-edition/src/ch12-00-an-io-project.md b/src/doc/book/second-edition/src/ch12-00-an-io-project.md index dffdef8320..31c17c9f78 100644 --- a/src/doc/book/second-edition/src/ch12-00-an-io-project.md +++ b/src/doc/book/second-edition/src/ch12-00-an-io-project.md @@ -1,37 +1,34 @@ # An I/O Project: Building a Command Line Program -This chapter is both a recap of the many skills you’ve learned so far and an -exploration of a few more standard library features. We’re going to build a -command line tool that interacts with file and command line input/output to -practice some of the Rust you now have under your belt. +This chapter is a recap of the many skills you’ve learned so far and an +exploration of a few more standard library features. We’ll build a command line +tool that interacts with file and command line input/output to practice some of +the Rust concepts you now have under your belt. Rust’s speed, safety, *single binary* output, and cross-platform support make -it a good language for creating command line tools, so for our project we’ll -make our own version of the classic command line tool `grep`. Grep is an -acronym for “**G**lobally search a **R**egular **E**xpression and **P**rint.” -In the simplest use case, `grep` searches a specified file for a specified -string. To do so, `grep` takes a filename and a string as its arguments, then -reads the file and finds lines in that file that contain the string argument. -It’ll then print out those lines. +it an ideal language for creating command line tools, so for our project, we’ll +make our own version of the classic command line tool `grep` (**g**lobally +search a **r**egular **e**xpression and **p**rint). In the simplest use case, +`grep` searches a specified file for a specified string. To do so, `grep` takes +as its arguments a filename and a string, and then reads the file and finds +lines in that file that contain the string argument. It then prints those lines. Along the way, we’ll show how to make our command line tool use features of the terminal that many command line tools use. We’ll read the value of an -environment variable in order to allow the user to configure the behavior of -our tool. We’ll print to the standard error console stream (`stderr`) instead -of standard output (`stdout`) so that, for example, the user can choose to -redirect successful output to a file while still seeing error messages on the -screen. +environment variable to allow the user to configure the behavior of our tool. +We’ll also print to the standard error console stream (`stderr`) instead of +standard output (`stdout`), so, for example, the user can redirect successful +output to a file while still seeing error messages onscreen. -One Rust community member, Andrew Gallant, has already created a -fully-featured, very fast version of `grep`, called -[`ripgrep`](https://github.com/BurntSushi/ripgrep). By -comparison, our version of `grep` will be fairly simple, but this chapter will -give you some of the background knowledge to help you understand a real-world -project like `ripgrep`. +One Rust community member, Andrew Gallant, has already created a fully +featured, very fast version of `grep`, called `ripgrep`. By comparison, our +version of `grep` will be fairly simple, but this chapter will give you some of +the background knowledge you need to understand a real-world project like +`ripgrep`. -This project will bring together a number of concepts you’ve learned so far: +Our `grep` project will combine a number of concepts you’ve learned so far: -* Organizing code (using what we learned in modules, Chapter 7) +* Organizing code (using what you learned in modules, Chapter 7) * Using vectors and strings (collections, Chapter 8) * Handling errors (Chapter 9) * Using traits and lifetimes where appropriate (Chapter 10) diff --git a/src/doc/book/second-edition/src/ch12-01-accepting-command-line-arguments.md b/src/doc/book/second-edition/src/ch12-01-accepting-command-line-arguments.md index d06b42871c..b124f8ca3f 100644 --- a/src/doc/book/second-edition/src/ch12-01-accepting-command-line-arguments.md +++ b/src/doc/book/second-edition/src/ch12-01-accepting-command-line-arguments.md @@ -1,8 +1,8 @@ ## Accepting Command Line Arguments -Let’s create a new project with, as always, `cargo new`. We’re calling our -project `minigrep` to distinguish from the `grep` tool that you may already -have on your system: +Let’s create a new project with, as always, `cargo new`. We’ll call our project +`minigrep` to distinguish it from the `grep` tool that you might already have +on your system. ```text $ cargo new --bin minigrep @@ -10,35 +10,34 @@ $ cargo new --bin minigrep $ cd minigrep ``` -Our first task is to make `minigrep` able to accept its two command line -arguments: the filename and a string to search for. That is, we want to be able -to run our program with `cargo run`, a string to search for, and a path to a -file to search in, like so: +The first task is to make `minigrep` accept its two command line arguments: the +filename and a string to search for. That is, we want to be able to run our +program with `cargo run`, a string to search for, and a path to a file to +search in, like so: ```text $ cargo run searchstring example-filename.txt ``` Right now, the program generated by `cargo new` cannot process arguments we -give it. There are some existing libraries on crates.io that can help us accept -command line arguments, but since you’re learning, let’s implement this +give it. However, some existing libraries on [Crates.io](https://crates.io/) +can help us with writing a program that accepts command line arguments, but +because you’re just learning this concept, let’s implement this capability ourselves. ### Reading the Argument Values -We first need to make sure our program is able to get the values of command -line arguments we pass to it, for which we’ll need a function provided in -Rust’s standard library: `std::env::args`. This function returns an *iterator* -of the command line arguments that were given to our program. We haven’t -discussed iterators yet, and we’ll cover them fully in Chapter 13, but for our -purposes now we only need to know two things about iterators: Iterators produce -a series of values, and we can call the `collect` function on an iterator to -turn it into a collection, such as a vector, containing all of the elements the -iterator produces. +To make sure `minigrep` is able to read the values of command line arguments we +pass to it, we’ll need a function provided in Rust’s standard library, which is +`std::env::args`. This function returns an *iterator* of the command line +arguments that were given to `minigrep`. We haven’t discussed iterators yet +(we’ll cover them fully in Chapter 13), but for now you only need to know two +details about iterators: iterators produce a series of values, and we can call +the `collect` function on an iterator to turn it into a collection, such as a +vector, containing all the elements the iterator produces. -Let’s give it a try: use the code in Listing 12-1 to allow your `minigrep` -program to read any command line arguments passed it and then collect the -values into a vector. +Use the code in Listing 12-1 to allow your `minigrep` program to read any +command line arguments passed to it and then collect the values into a vector: Filename: src/main.rs @@ -51,62 +50,63 @@ fn main() { } ``` -Listing 12-1: Collect the command line arguments into a vector and print them -out +Listing 12-1: Collecting the command line arguments into +a vector and printing them -First, we bring the `std::env` module into scope with a `use` statement so that -we can use its `args` function. Notice the `std::env::args` function is nested -in two levels of modules. As we talked about in Chapter 7, in cases where the -desired function is nested in more than one module, it’s conventional to bring -the parent module into scope, rather than the function itself. This lets us -easily use other functions from `std::env`. It’s also less ambiguous than -adding `use std::env::args;` then calling the function with just `args`; that -might easily be mistaken for a function that’s defined in the current module. +First, we bring the `std::env` module into scope with a `use` statement so we +can use its `args` function. Notice that the `std::env::args` function is +nested in two levels of modules. As we discussed in Chapter 7, in cases where +the desired function is nested in more than one module, it’s conventional to +bring the parent module into scope rather than the function. As a result, we +can easily use other functions from `std::env`. It’s also less ambiguous than +adding `use std::env::args` and then calling the function with just `args` +because `args` might easily be mistaken for a function that’s defined in the +current module. > ### The `args` Function and Invalid Unicode > > Note that `std::env::args` will panic if any argument contains invalid -> Unicode. If you need to accept arguments containing invalid Unicode, use -> `std::env::args_os` instead. That function returns `OsString` values instead -> of `String` values. We’ve chosen to use `std::env::args` here for simplicity -> because `OsString` values differ per-platform and are more complex to work -> with than `String` values. +> Unicode. If your program needs to accept arguments containing invalid +> Unicode, use `std::env::args_os` instead. That function returns `OsString` +> values instead of `String` values. We’ve chosen to use `std::env::args` here +> for simplicity because `OsString` values differ per platform and are more +> complex to work with than `String` values. On the first line of `main`, we call `env::args`, and immediately use `collect` -to turn the iterator into a vector containing all of the values produced by the -iterator. The `collect` function can be used to create many kinds of +to turn the iterator into a vector containing all the values produced by the +iterator. We can use the `collect` function to create many kinds of collections, so we explicitly annotate the type of `args` to specify that we -want a vector of strings. Though we very rarely need to annotate types in Rust, -`collect` is one function you do often need to annotate because Rust isn’t able -to infer what kind of collection you want. +want a vector of strings. Although we very rarely need to annotate types in +Rust, `collect` is one function you do often need to annotate because Rust +isn’t able to infer the kind of collection you want. -Finally, we print out the vector with the debug formatter, `:?`. Let’s try -running our code with no arguments, and then with two arguments: +Finally, we print the vector using the debug formatter, `:?`. Let’s try running +the code with no arguments, and then with two arguments: ```text $ cargo run +--snip-- ["target/debug/minigrep"] $ cargo run needle haystack -...snip... +--snip-- ["target/debug/minigrep", "needle", "haystack"] ``` -You may notice that the first value in the vector is `"target/debug/minigrep"`, -which is the name of our binary. This matches the behavior of the arguments -list in C, and lets programs use the name by which they were invoked in their -execution. It’s convenient to have access to the program name in case we want -to print it in messages or change behavior of the program based on what command -line alias was used to invoke the program, but for the purposes of this chapter -we’re going to ignore it and only save the two arguments we need. +Notice that the first value in the vector is `"target/debug/minigrep"`, which +is the name of our binary. This matches the behavior of the arguments list in +C, letting programs use the name by which they were invoked in their execution. +It’s often convenient to have access to the program name in case we want to +print it in messages or change behavior of the program based on what command +line alias was used to invoke the program. But for the purposes of this +chapter, we’ll ignore it and save only the two arguments we need. ### Saving the Argument Values in Variables -Printing out the value of the vector of arguments has illustrated that the -program is able to access the values specified as command line arguments. Now -we need to save the values of the two arguments in variables so that we can use -the values throughout the rest of the program. Let’s do that as shown in -Listing 12-2: +Printing the value of the vector of arguments illustrated that the program is +able to access the values specified as command line arguments. Now we need to +save the values of the two arguments in variables so we can use the values +throughout the rest of the program. We do that in Listing 12-2: Filename: src/main.rs @@ -124,29 +124,31 @@ fn main() { } ``` -Listing 12-2: Create variables to hold the query argument and filename argument +Listing 12-2: Creating variables to hold the query +argument and filename argument -As we saw when we printed out the vector, the program’s name takes up the first -value in the vector at `args[0]`, so that we’re starting at index `1`. The -first argument `minigrep` takes is the string we’re searching for, so we put a +As we saw when we printed the vector, the program’s name takes up the first +value in the vector at `args[0]`, so we’re starting at index `1`. The first +argument `minigrep` takes is the string we’re searching for, so we put a reference to the first argument in the variable `query`. The second argument will be the filename, so we put a reference to the second argument in the variable `filename`. -We’re temporarily printing out the values of these variables, again to prove to -ourselves that our code is working as we intend. Let’s try running this program -again with the arguments `test` and `sample.txt`: +We temporarily print the values of these variables to prove that the code is +working as we intend. Let’s run this program again with the arguments `test` +and `sample.txt`: ```text $ cargo run test sample.txt + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep test sample.txt` Searching for test In file sample.txt ``` -Great, it’s working! The values of the arguments we need are being saved into -the right variables. Later we’ll add some error handling to deal with certain -potential erroneous situations, such as when the user provides no arguments, -but for now we’ll ignore that and work on adding file reading capabilities -instead. +Great, the program is working! The values of the arguments we need are being +saved into the right variables. Later we’ll add some error handling to deal +with certain potential erroneous situations, such as when the user provides no +arguments; for now, we’ll ignore that situation and work on adding file reading +capabilities instead. diff --git a/src/doc/book/second-edition/src/ch12-02-reading-a-file.md b/src/doc/book/second-edition/src/ch12-02-reading-a-file.md index 9fd014ef9c..671e0f9ed4 100644 --- a/src/doc/book/second-edition/src/ch12-02-reading-a-file.md +++ b/src/doc/book/second-edition/src/ch12-02-reading-a-file.md @@ -1,12 +1,12 @@ ## Reading a File -Next, we’re going to add functionality to read the file that is specified in -the `filename` command line argument. First, we need a sample file to test it -with—the best kind of file to use to make sure that `minigrep` is working is -one with a small amount of text over multiple lines with some repeated words. -Listing 12-3 has an Emily Dickinson poem that will work well! Create a file -called `poem.txt` at the root level of your project, and enter the poem “I’m -nobody! Who are you?”: +Now we’ll add functionality to read the file that is specified in the +`filename` command line argument. First, we need a sample file to test it with: +the best kind of file to use to make sure `minigrep` is working is one with a +small amount of text over multiple lines with some repeated words. Listing 12-3 +has an Emily Dickinson poem that will work well! Create a file called +*poem.txt* at the root level of your project, and enter the poem “I’m Nobody! +Who are you?” Filename: poem.txt @@ -22,11 +22,11 @@ To tell your name the livelong day To an admiring bog! ``` -Listing 12-3: The poem “I’m nobody! Who are you?” by -Emily Dickinson that will make a good test case +Listing 12-3: A poem by Emily Dickinson will make a good +test case. -With that in place, edit *src/main.rs* and add code to open the file as shown -in Listing 12-4: +With the text in place, edit *src/main.rs* and add code to open the file, as +shown in Listing 12-4: Filename: src/main.rs @@ -42,7 +42,7 @@ fn main() { # let filename = &args[2]; # # println!("Searching for {}", query); - // ...snip... + // --snip-- println!("In file {}", filename); let mut f = File::open(filename).expect("file not found"); @@ -59,30 +59,32 @@ fn main() { by the second argument First, we add some more `use` statements to bring in relevant parts of the -standard library: we need `std::fs::File` for dealing with files, and -`std::io::prelude::*` contains various traits that are useful when doing I/O, -including file I/O. In the same way that Rust has a general prelude that brings -certain things into scope automatically, the `std::io` module has its own -prelude of common things you’ll need when working with I/O. Unlike the default -prelude, we must explicitly `use` the prelude from `std::io`. +standard library: we need `std::fs::File` to handle files, and +`std::io::prelude::*` contains various useful traits for doing I/O, including +file I/O. In the same way that Rust has a general prelude that brings certain +types and functions into scope automatically, the `std::io` module has its own +prelude of common types and functions you’ll need when working with I/O. Unlike +the default prelude, we must explicitly add a `use` statement for the prelude +from `std::io`. -In `main`, we’ve added three things: first, we get a mutable handle to the file -by calling the `File::open` function and passing it the value of the `filename` -variable. Second, we create a variable called `contents` and set it to a -mutable, empty `String`. This will hold the content of the file after we read -it in. Third, we call `read_to_string` on our file handle and pass a mutable -reference to `contents` as an argument. +In `main`, we’ve added three statements: first, we get a mutable handle to the +file by calling the `File::open` function and passing it the value of the +`filename` variable. Second, we create a variable called `contents` and set it +to a mutable, empty `String`. This will hold the content of the file after we +read it in. Third, we call `read_to_string` on our file handle and pass a +mutable reference to `contents` as an argument. After those lines, we’ve again added a temporary `println!` statement that -prints out the value of `contents` after the file is read, so that we can check -that our program is working so far. +prints the value of `contents` after the file is read, so we can check that the +program is working so far. -Let’s try running this code with any string as the first command line argument -(since we haven’t implemented the searching part yet) and our *poem.txt* file -as the second argument: +Let’s run this code with any string as the first command line argument (because +we haven’t implemented the searching part yet) and the *poem.txt* file as the +second argument: ```text $ cargo run the poem.txt + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep the poem.txt` Searching for the @@ -99,11 +101,11 @@ To tell your name the livelong day To an admiring bog! ``` -Great! Our code read in and printed out the content of the file. We’ve got a -few flaws though. The `main` function has multiple responsibilities; generally +Great! The code read and then printed the content of the file. But the code has +a few flaws. The `main` function has multiple responsibilities: generally, functions are clearer and easier to maintain if each function is responsible for only one idea. The other problem is that we’re not handling errors as well -as we could be. While our program is still small, these flaws aren’t a big -problem, but as our program grows, it will be harder to fix them cleanly. It’s -good practice to begin refactoring early on when developing a program, as it’s -much easier to refactor smaller amounts of code, so we’ll do that now. +as we could be. The program is still small so these flaws aren’t a big problem, +but as the program grows, it will be harder to fix them cleanly. It’s good +practice to begin refactoring early on when developing a program, because it’s +much easier to refactor smaller amounts of code. We’ll do that next. diff --git a/src/doc/book/second-edition/src/ch12-03-improving-error-handling-and-modularity.md b/src/doc/book/second-edition/src/ch12-03-improving-error-handling-and-modularity.md index 947350c5e4..0561c13d51 100644 --- a/src/doc/book/second-edition/src/ch12-03-improving-error-handling-and-modularity.md +++ b/src/doc/book/second-edition/src/ch12-03-improving-error-handling-and-modularity.md @@ -1,76 +1,74 @@ ## Refactoring to Improve Modularity and Error Handling -There are four problems that we’d like to fix to improve our program, and they -have to do with the way the program is structured and how it’s handling -potential errors. +To improve our program, we’ll fix four problems that have to do with the +program’s structure and how it’s handling potential errors. First, our `main` function now performs two tasks: it parses arguments and -opens up files. For such a small function, this isn’t a huge problem. However, -if we keep growing our program inside of `main`, the number of separate tasks -the `main` function handles will grow. As a function gains responsibilities, it -gets harder to reason about, harder to test, and harder to change without -breaking one of its parts. It’s better to separate out functionality so that -each function is responsible for one task. +opens files. For such a small function, this isn’t a major problem. However, if +we continue to grow our program inside `main`, the number of separate tasks the +`main` function handles will increase. As a function gains responsibilities, it +becomes more difficult to reason about, harder to test, and harder to change +without breaking one of its parts. It’s best to separate functionality so each +function is responsible for one task. -This also ties into our second problem: while `query` and `filename` are -configuration variables to our program, variables like `f` and `contents` are -used to perform our program’s logic. The longer `main` gets, the more variables -we’re going to need to bring into scope; the more variables we have in scope, -the harder it is to keep track of the purpose of each. It’s better to group the -configuration variables into one structure to make their purpose clear. +This issue also ties into the second problem: although `query` and `filename` +are configuration variables to our program, variables like `f` and `contents` +are used to perform the program’s logic. The longer `main` becomes, the more +variables we’ll need to bring into scope; the more variables we have in scope, +the harder it will be to keep track of the purpose of each. It’s best to group +the configuration variables into one structure to make their purpose clear. -The third problem is that we’ve used `expect` to print out an error message -when opening the file fails, but the error message only says `file not found`. -There are a number of ways that opening a file can fail besides the file being -missing: for example, the file might exist, but we might not have permission to -open it. Right now, if we’re in that situation, we’d print the `file not found` -error message that would give the user the wrong advice! +The third problem is that we’ve used `expect` to print an error message when +opening the file fails, but the error message just prints `file not found`. +Opening a file can fail in a number of ways besides the file being missing: for +example, the file might exist, but we might not have permission to open it. +Right now, if we’re in that situation, we’d print the `file not found` error +message that would give the user the wrong information! -Fourth, we use `expect` repeatedly to deal with different errors, and if the -user runs our programs without specifying enough arguments, they’ll get an -“index out of bounds” error from Rust that doesn’t clearly explain the problem. -It would be better if all our error handling code was in one place so that -future maintainers only have one place to consult in the code if the error -handling logic needs to change. Having all the error handling code in one place -will also help us to ensure that we’re printing messages that will be -meaningful to our end users. +Fourth, we use `expect` repeatedly to handle different errors, and if the user +runs our program without specifying enough arguments, they’ll get an `index out +of bounds` error from Rust that doesn’t clearly explain the problem. It would +be best if all the error handling code was in one place so future maintainers +have only one place to consult in the code if the error handling logic needs to +change. Having all the error handling code in one place will also ensure that +we’re printing messages that will be meaningful to our end users. -Let’s address these problems by refactoring our project. +Let’s address these four problems by refactoring our project. ### Separation of Concerns for Binary Projects The organizational problem of allocating responsibility for multiple tasks to -the `main` function responsible is common to many binary projects, so the Rust -community has developed a kind of guideline process for splitting up the -separate concerns of a binary program when `main` starts getting large. The -process has the following steps: +the `main` function is common to many binary projects. As a result, the Rust +community has developed a type of guideline process for splitting the separate +concerns of a binary program when `main` starts getting large. The process has +the following steps: -* Split your program into both a *main.rs* and a *lib.rs* and move your -program’s logic into *lib.rs*. +* Split your program into a *main.rs* and a *lib.rs*, and move your program’s +logic to *lib.rs*. * While your command line parsing logic is small, it can remain in *main.rs*. * When the command line parsing logic starts getting complicated, extract it -from *main.rs* into *lib.rs* as well. +from *main.rs* and move it to *lib.rs*. * The responsibilities that remain in the `main` function after this process should be limited to: + * Calling the command line parsing logic with the argument values * Setting up any other configuration * Calling a `run` function in *lib.rs* - * If `run` returns an error, handling that error + * Handling the error if `run` returns an error -This pattern is all about separating concerns: *main.rs* handles running the -program, and *lib.rs* handles all of the logic of the task at hand. Because we +This pattern is about separating concerns: *main.rs* handles running the +program, and *lib.rs* handles all the logic of the task at hand. Because we can’t test the `main` function directly, this structure lets us test all of our program’s logic by moving it into functions in *lib.rs*. The only code that remains in *main.rs* will be small enough to verify its correctness by reading -it. Let’s re-work our program by following this process. +it. Let’s rework our program by following this process. #### Extracting the Argument Parser -First, we’ll extract the functionality for parsing arguments into a function -that `main` will call to prepare for moving the command line parsing logic to +We’ll extract the functionality for parsing arguments into a function that +`main` will call to prepare for moving the command line parsing logic to *src/lib.rs*. Listing 12-5 shows the new start of `main` that calls a new -function `parse_config`, which we’re still going to define in *src/main.rs* for -the moment: +function `parse_config`, which we’ll define in *src/main.rs* for the moment. Filename: src/main.rs @@ -80,7 +78,7 @@ fn main() { let (query, filename) = parse_config(&args); - // ...snip... + // --snip-- } fn parse_config(args: &[String]) -> (&str, &str) { @@ -91,7 +89,7 @@ fn parse_config(args: &[String]) -> (&str, &str) { } ``` -Listing 12-5: Extract a `parse_config` function from +Listing 12-5: Extracting a `parse_config` function from `main` We’re still collecting the command line arguments into a vector, but instead of @@ -99,39 +97,40 @@ assigning the argument value at index `1` to the variable `query` and the argument value at index `2` to the variable `filename` within the `main` function, we pass the whole vector to the `parse_config` function. The `parse_config` function then holds the logic that determines which argument -goes in which variable, and passes the values back to `main`. We still create +goes in which variable and passes the values back to `main`. We still create the `query` and `filename` variables in `main`, but `main` no longer has the responsibility of determining how the command line arguments and variables correspond. -This may seem like overkill for our small program, but we’re refactoring in -small, incremental steps. After making this change, run the program again to +This rework may seem like overkill for our small program, but we’re refactoring +in small, incremental steps. After making this change, run the program again to verify that the argument parsing still works. It’s good to check your progress -often, as that will help you identify the cause of problems when they occur. +often, because that will help you identify the cause of problems when they +occur. #### Grouping Configuration Values -We can take another small step to improve this function further. At the moment, -we’re returning a tuple, but then we immediately break that tuple up into -individual parts again. This is a sign that perhaps we don’t have the right -abstraction yet. +We can take another small step to improve the `parse_config` function further. +At the moment, we’re returning a tuple, but then we immediately break that +tuple into individual parts again. This is a sign that perhaps we don’t have +the right abstraction yet. -Another indicator that there’s room for improvement is the `config` part of -`parse_config`, which implies that the two values we return are related and are -both part of one configuration value. We’re not currently conveying this +Another indicator that shows there’s room for improvement is the `config` part +of `parse_config`, which implies that the two values we return are related and +are both part of one configuration value. We’re not currently conveying this meaning in the structure of the data other than grouping the two values into a tuple: we could put the two values into one struct and give each of the struct -fields a meaningful name. This will make it easier for future maintainers of -this code to understand how the different values relate to each other and what -their purpose is. +fields a meaningful name. Doing so will make it easier for future maintainers +of this code to understand how the different values relate to each other and +what their purpose is. -> Note: some people call this anti-pattern of using primitive values when a +> Note: Some people call this anti-pattern of using primitive values when a > complex type would be more appropriate *primitive obsession*. -Listing 12-6 shows the addition of a struct named `Config` defined to have +Listing12-6 shows the addition of a struct named `Config` defined to have fields named `query` and `filename`. We’ve also changed the `parse_config` -function to return an instance of the `Config` struct, and updated `main` to -use the struct fields rather than having separate variables: +function to return an instance of the `Config` struct and updated `main` to use +the struct fields rather than having separate variables: Filename: src/main.rs @@ -149,7 +148,7 @@ fn main() { let mut f = File::open(config.filename).expect("file not found"); - // ...snip... + // --snip-- } struct Config { @@ -170,39 +169,39 @@ instance of a `Config` struct The signature of `parse_config` now indicates that it returns a `Config` value. In the body of `parse_config`, where we used to return string slices that -reference `String` values in `args`, we’ve now chosen to define `Config` to -contain owned `String` values. The `args` variable in `main` is the owner of -the argument values and is only letting the `parse_config` function borrow -them, though, which means we’d violate Rust’s borrowing rules if `Config` tried -to take ownership of the values in `args`. +reference `String` values in `args`, we now define `Config` to contain owned +`String` values. The `args` variable in `main` is the owner of the argument +values and is only letting the `parse_config` function borrow them, which means +we’d violate Rust’s borrowing rules if `Config` tried to take ownership of the +values in `args`. -There are a number of different ways we could manage the `String` data, and the +We could manage the `String` data in a number of different ways, but the easiest, though somewhat inefficient, route is to call the `clone` method on the values. This will make a full copy of the data for the `Config` instance to -own, which does take more time and memory than storing a reference to the -string data. However, cloning the data also makes our code very straightforward -since we don’t have to manage the lifetimes of the references, so in this -circumstance giving up a little performance to gain simplicity is a worthwhile +own, which takes more time and memory than storing a reference to the string +data. However, cloning the data also makes our code very straightforward +because we don’t have to manage the lifetimes of the references; in this +circumstance, giving up a little performance to gain simplicity is a worthwhile trade-off. -> ### The Tradeoffs of Using `clone` +> ### The Trade-Offs of Using `clone` > > There’s a tendency among many Rustaceans to avoid using `clone` to fix -> ownership problems because of its runtime cost. In Chapter 13 on iterators, -> you’ll learn how to use more efficient methods in this kind of situation, but -> for now, it’s okay to copy a few strings to keep making progress since we’ll -> only make these copies once, and our filename and query string are both very -> small. It’s better to have a working program that’s a bit inefficient than try -> to hyper-optimize code on your first pass. As you get more experienced with -> Rust, it’ll be easier to go straight to the desirable method, but for now it’s -> perfectly acceptable to call `clone`. +> ownership problems because of its runtime cost. In Chapter 13, you’ll learn +> how to use more efficient methods in this type of situation. But for now, +> it’s okay to copy a few strings to continue making progress because we’ll +> make these copies only once, and our filename and query string are very +> small. It’s better to have a working program that’s a bit inefficient than to +> try to hyperoptimize code on your first pass. As you become more experienced +> with Rust, it’ll be easier to start with the desirable solution, but for now, +> it’s perfectly acceptable to call `clone`. -We’ve updated `main` so that it places the instance of `Config` returned by -`parse_config` into a variable named `config`, and updated the code that -previously used the separate `query` and `filename` variables so that it now -uses the fields on the `Config` struct instead. +We’ve updated `main` so it places the instance of `Config` returned by +`parse_config` into a variable named `config`, and we updated the code that +previously used the separate `query` and `filename` variables so it now uses +the fields on the `Config` struct instead. -Our code now more clearly conveys that `query` and `filename` are related and +Now our code more clearly conveys that `query` and `filename` are related, and their purpose is to configure how the program will work. Any code that uses these values knows to find them in the `config` instance in the fields named for their purpose. @@ -210,20 +209,20 @@ for their purpose. #### Creating a Constructor for `Config` So far, we’ve extracted the logic responsible for parsing the command line -arguments from `main` into the `parse_config` function, which helped us to see -that the `query` and `filename` values were related and that relationship -should be conveyed in our code. We then added a `Config` struct to name the -related purpose of `query` and `filename`, and to be able to return the values’ -names as struct field names from the `parse_config` function. +arguments from `main` and placed it in the `parse_config` function, which +helped us to see that the `query` and `filename` values were related and that +relationship should be conveyed in our code. We then added a `Config` struct to +name the related purpose of `query` and `filename`, and to be able to return +the values’ names as struct field names from the `parse_config` function. So now that the purpose of the `parse_config` function is to create a `Config` -instance, we can change `parse_config` from being a plain function into a +instance, we can change `parse_config` from being a plain function to a function named `new` that is associated with the `Config` struct. Making this -change will make our code more idiomatic: we can create instances of types in -the standard library like `String` by calling `String::new`, and by changing -`parse_config` into a `new` function associated with `Config`, we’ll be able to -create instances of `Config` by calling `Config::new`. Listing 12-7 shows the -changes we’ll need to make: +change will make the code more idiomatic: we can create instances of types in +the standard library, such as `String`, by calling `String::new`, and by +changing `parse_config` into a `new` function associated with `Config`, we’ll +be able to create instances of `Config` by calling `Config::new`. Listing 12-7 +shows the changes we need to make: Filename: src/main.rs @@ -235,7 +234,7 @@ fn main() { let config = Config::new(&args); - // ...snip... + // --snip-- } # struct Config { @@ -243,7 +242,7 @@ fn main() { # filename: String, # } # -// ...snip... +// --snip-- impl Config { fn new(args: &[String]) -> Config { @@ -260,89 +259,92 @@ impl Config { We’ve updated `main` where we were calling `parse_config` to instead call `Config::new`. We’ve changed the name of `parse_config` to `new` and moved it -within an `impl` block, which makes the `new` function associated with -`Config`. Try compiling this again to make sure it works. +within an `impl` block, which associates the `new` function with `Config`. Try +compiling this code again to make sure it works. ### Fixing the Error Handling -Now we’ll work on fixing our error handling. Recall that we mentioned that -attempting to access the values in the `args` vector at index `1` or index `2` -will cause the program to panic if the vector contains fewer than 3 items. Try -running the program without any arguments; it will look like this: +Now we’ll work on fixing our error handling. Recall that attempting to access +the values in the `args` vector at index `1` or index `2` will cause the +program to panic if the vector contains fewer than three items. Try running the +program without any arguments; it will look like this: ```text $ cargo run + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep` thread 'main' panicked at 'index out of bounds: the len is 1 -but the index is 1', /stable-dist-rustc/build/src/libcollections/vec.rs:1307 +but the index is 1', src/main.rs:29:21 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` -The line that states `index out of bounds: the len is 1 but the index is 1` is -an error message intended for programmers, and won’t really help our end users -understand what happened and what they should do instead. Let’s fix that now. +The line `index out of bounds: the len is 1 but the index is 1` is an error +message intended for programmers. It won’t help our end users understand what +happened and what they should do instead. Let’s fix that now. #### Improving the Error Message -In Listing 12-8, we’re adding a check in the `new` function that will check -that the slice is long enough before accessing index `1` and `2`. If the slice -isn’t long enough, the program panics, with a better error message than the +In Listing 12-8, we add a check in the `new` function that will verify that the +slice is long enough before accessing index `1` and `2`. If the slice isn’t +long enough, the program panics and displays a better error message than the `index out of bounds` message: Filename: src/main.rs ```rust,ignore -// ...snip... +// --snip-- fn new(args: &[String]) -> Config { if args.len() < 3 { panic!("not enough arguments"); } - // ...snip... + // --snip-- ``` Listing 12-8: Adding a check for the number of arguments -This is similar to the `Guess::new` function we wrote in Listing 9-8, where -`panic!` was called when the `value` argument was out of the range of valid +This code is similar to the `Guess::new` function we wrote in Listing 9-9 where +we called `panic!` when the `value` argument was out of the range of valid values. Instead of checking for a range of values here, we’re checking that the -length of `args` is at least 3, and the rest of the function can operate under -the assumption that this condition has been met. If `args` has fewer than 3 +length of `args` is at least `3` and the rest of the function can operate under +the assumption that this condition has been met. If `args` has fewer than three items, this condition will be true, and we call the `panic!` macro to end the program immediately. -With these extra few lines of code in `new`, let’s try running our program -without any arguments again and see what the error looks like now: +With these extra few lines of code in `new`, let’s run the program without any +arguments again to see what the error looks like now: -```bash +```text $ cargo run + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep` -thread 'main' panicked at 'not enough arguments', src/main.rs:29 +thread 'main' panicked at 'not enough arguments', src/main.rs:30:12 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` -This output is better, we now have a reasonable error message. However, we also -have a bunch of extra information we don’t want to give to our users. So -perhaps using the technique we used in Listing 9-8 isn’t the best to use here; -a call to `panic!` is more appropriate for a programming problem rather than a -usage problem, as we discussed in Chapter 9. Instead, we can use the other -technique you also learned about in Chapter 9: returning a `Result` that can -indicate either success or an error. +This output is better: we now have a reasonable error message. However, we also +have extraneous information we don’t want to give to our users. Perhaps using +the technique we used in Listing 9-9 isn’t the best to use here: a call to +`panic!` is more appropriate for a programming problem rather than a usage +problem, as discussed in Chapter 9. Instead, we can use the other technique you +learned about in Chapter 9—returning a `Result` that indicates either success +or an error. #### Returning a `Result` from `new` Instead of Calling `panic!` -We can choose to instead return a `Result` value that will contain a `Config` -instance in the successful case, and will describe the problem in the error -case. When `Config::new` is communicating to `main`, we can use the `Result` -type to signal that there was a problem. Then we can change `main` to convert -an `Err` variant into a more practical error for our users, without the -surrounding text about `thread 'main'` and `RUST_BACKTRACE` that a call to -`panic!` causes. +We can instead return a `Result` value that will contain a `Config` instance in +the successful case and will describe the problem in the error case. When +`Config::new` is communicating to `main`, we can use the `Result` type to +signal there was a problem. Then we can change `main` to convert an `Err` +variant into a more practical error for our users without the surrounding text +about `thread 'main'` and `RUST_BACKTRACE` that a call to `panic!` causes. -Listing 12-9 shows the changes you need to make to the return value of -`Config::new` and the body of the function needed to return a `Result`: +Listing 12-9 shows the changes we need to make to the return value of +`Config::new` and the body of the function needed to return a `Result`. Note +that this won’t compile until we update `main` as well, which we’ll do in the +next listing: Filename: src/main.rs @@ -361,9 +363,10 @@ impl Config { } ``` -Listing 12-9: Return a `Result` from `Config::new` +Listing 12-9: Returning a `Result` from +`Config::new` -Our `new` function now returns a `Result`, with a `Config` instance in the +Our `new` function now returns a `Result` with a `Config` instance in the success case and a `&'static str` in the error case. Recall from “The Static Lifetime” section in Chapter 10 that `&'static str` is the type of string literals, which is our error message type for now. @@ -379,12 +382,12 @@ more cleanly in the error case. #### Calling `Config::new` and Handling Errors -In order to handle the error case and print a user-friendly message, we need to -update `main` to handle the `Result` being returned by `Config::new`, as shown -in Listing 12-10. We’re also going to take the responsibility of exiting the -command line tool with a nonzero error code from `panic!` and implement it by -hand. A nonzero exit status is a convention to signal to the process that -called our program that our program exited with an error state. +To handle the error case and print a user-friendly message, we need to update +`main` to handle the `Result` being returned by `Config::new`, as shown in +Listing 12-10. We’ll also take the responsibility of exiting the command line +tool with a nonzero error code from `panic!` and implement it by hand. A +nonzero exit status is a convention to signal to the process that called our +program that the program exited with an error state. Filename: src/main.rs @@ -399,28 +402,28 @@ fn main() { process::exit(1); }); - // ...snip... + // --snip-- ``` Listing 12-10: Exiting with an error code if creating a new `Config` fails -In this listing, we’re using a method we haven’t covered before: +In this listing, we’ve used a method we haven’t covered before: `unwrap_or_else`, which is defined on `Result` by the standard library. Using `unwrap_or_else` allows us to define some custom, non-`panic!` error handling. If the `Result` is an `Ok` value, this method’s behavior is similar to `unwrap`: it returns the inner value `Ok` is wrapping. However, if the value is an `Err` value, this method calls the code in the *closure*, which is an anonymous function we define and pass as an argument to `unwrap_or_else`. We’ll -be covering closures in more detail in Chapter 13. What you need to know for -now is that `unwrap_or_else` will pass the inner value of the `Err`, which in -this case is the static string `not enough arguments` that we added in Listing -12-9, to our closure in the argument `err` that appears between the vertical -pipes. The code in the closure can then use the `err` value when it runs. +cover closures in more detail in Chapter 13. For now, you just need to know +that `unwrap_or_else` will pass the inner value of the `Err`, which in this +case is the static string `not enough arguments` that we added in Listing 12-9, +to our closure in the argument `err` that appears between the vertical pipes. +The code in the closure can then use the `err` value when it runs. We’ve added a new `use` line to import `process` from the standard library. The -code in the closure that will get run in the error case is only two lines: we -print out the `err` value, then call `process::exit`. The `process::exit` +code in the closure that will be run in the error case is only two lines: we +print the `err` value and then call `process::exit`. The `process::exit` function will stop the program immediately and return the number that was passed as the exit status code. This is similar to the `panic!`-based handling we used in Listing 12-8, but we no longer get all the extra output. Let’s try @@ -438,15 +441,15 @@ Great! This output is much friendlier for our users. ### Extracting Logic from `main` -Now we’re done refactoring our configuration parsing; let’s turn to our -program’s logic. As we laid out in the “Separation of Concerns for Binary -Projects” section, we’re going to extract a function named `run` that will hold -all of the logic currently in the `main` function not involved with setting up -configuration or handling errors. Once we’re done, `main` will be concise and -easy to verify by inspection, and we’ll be able to write tests for all of the +Now that we’ve finished refactoring the configuration parsing, let’s turn to +the program’s logic. As we stated in “Separation of Concerns for Binary +Projects” on page XX, we’ll extract a function named `run` that will hold all +the logic currently in the `main` function that isn’t involved with setting up +configuration or handling errors. When we’re done, `main` will be concise and +easy to verify by inspection, and we’ll be able to write tests for all the other logic. -Listing 12-11 shows the extracted `run` function. For now, we’re making only +Listing 12-11 shows the extracted `run` function. For now, we’re just making the small, incremental improvement of extracting the function. We’re still defining the function in *src/main.rs*: @@ -454,7 +457,7 @@ defining the function in *src/main.rs*: ```rust,ignore fn main() { - // ...snip... + // --snip-- println!("Searching for {}", config.query); println!("In file {}", config.filename); @@ -472,24 +475,24 @@ fn run(config: Config) { println!("With text:\n{}", contents); } -// ...snip... +// --snip-- ``` Listing 12-11: Extracting a `run` function containing the rest of the program logic -The `run` function now contains all the remaining logic from `main` starting +The `run` function now contains all the remaining logic from `main`, starting from reading the file. The `run` function takes the `Config` instance as an argument. #### Returning Errors from the `run` Function With the remaining program logic separated into the `run` function, we can -improve the error handling like we did with `Config::new` in Listing 12-9. +improve the error handling, as we did with `Config::new` in Listing 12-9. Instead of allowing the program to panic by calling `expect`, the `run` function will return a `Result` when something goes wrong. This will let us further consolidate into `main` the logic around handling errors in a -user-friendly way. Listing 12-12 shows the changes you need to make to the +user-friendly way. Listing 12-12 shows the changes we need to make to the signature and body of `run`: Filename: src/main.rs @@ -497,7 +500,7 @@ signature and body of `run`: ```rust,ignore use std::error::Error; -// ...snip... +// --snip-- fn run(config: Config) -> Result<(), Box> { let mut f = File::open(config.filename)?; @@ -514,44 +517,45 @@ fn run(config: Config) -> Result<(), Box> { Listing 12-12: Changing the `run` function to return `Result` -We’ve made three big changes here. First, we’re changing the return type of the -`run` function to `Result<(), Box>`. This function previously returned -the unit type, `()`, and we keep that as the value returned in the `Ok` case. +We’ve made three significant changes here. First, we changed the return type of +the `run` function to `Result<(), Box>`. This function previously +returned the unit type, `()`, and we keep that as the value returned in the +`Ok` case. -For our error type, we’re using the *trait object* `Box` (and we’ve -brought `std::error::Error` into scope with a `use` statement at the top). -We’ll be covering trait objects in Chapter 17. For now, just know that -`Box` means the function will return a type that implements the `Error` -trait, but we don’t have to specify what particular type the return value will -be. This gives us flexibility to return error values that may be of different -types in different error cases. +For the error type, we used the *trait object* `Box` (and we’ve brought +`std::error::Error` into scope with a `use` statement at the top). We’ll cover +trait objects in Chapter 17. For now, just know that `Box` means the +function will return a type that implements the `Error` trait, but we don’t +have to specify what particular type the return value will be. This gives us +flexibility to return error values that may be of different types in different +error cases. -The second change we’re making is removing the calls to `expect` in favor of -`?`, like we talked about in Chapter 9. Rather than `panic!` on an error, this -will return the error value from the current function for the caller to handle. +Second, we’ve removed the calls to `expect` in favor of `?`, as we talked about +in Chapter 9. Rather than `panic!` on an error, `?` will return the error value +from the current function for the caller to handle. -Thirdly, this function now returns an `Ok` value in the success case. We’ve +Third, the `run` function now returns an `Ok` value in the success case. We’ve declared the `run` function’s success type as `()` in the signature, which means we need to wrap the unit type value in the `Ok` value. This `Ok(())` -syntax may look a bit strange at first, but using `()` like this is the +syntax might look a bit strange at first, but using `()` like this is the idiomatic way to indicate that we’re calling `run` for its side effects only; it doesn’t return a value we need. -When you run this, it will compile, but with a warning: +When you run this code, it will compile but will display a warning: ```text -warning: unused result which must be used, #[warn(unused_must_use)] on by -default - --> src/main.rs:39:5 +warning: unused `std::result::Result` which must be used + --> src/main.rs:18:5 | -39 | run(config); +18 | run(config); | ^^^^^^^^^^^^ += note: #[warn(unused_must_use)] on by default ``` -Rust is telling us that our code ignores the `Result` value, which might be -indicating that there was an error. We’re not checking to see if there was an -error or not, though, and the compiler is reminding us that we probably meant -to have some error handling code here! Let’s rectify that now. +Rust tells us that our code ignored the `Result` value, and the `Result` value +might indicate that an error occurred. But we’re not checking to see whether or +not there was an error, and the compiler reminds us that we probably meant to +have some error handling code here! Let’s rectify that problem now. #### Handling Errors Returned from `run` in `main` @@ -563,7 +567,7 @@ difference: ```rust,ignore fn main() { - // ...snip... + // --snip-- println!("Searching for {}", config.query); println!("In file {}", config.filename); @@ -576,24 +580,24 @@ fn main() { } ``` -We use `if let` to check whether `run` returns an `Err` value, rather than -`unwrap_or_else`, and call `process::exit(1)` if it does. `run` doesn’t return -a value that we want to `unwrap` like `Config::new` returns the `Config` -instance. Because `run` returns a `()` in the success case, we only care about -detecting an error, so we don’t need `unwrap_or_else` to return the unwrapped -value as it would only be `()`. +We use `if let` rather than `unwrap_or_else` to check whether `run` returns an +`Err` value and call `process::exit(1)` if it does. The `run` function doesn’t +return a value that we want to `unwrap` in the same way that `Config::new` +returns the `Config` instance. Because `run` returns a `()` in the success +case, we only care about detecting an error, so we don’t need `unwrap_or_else` +to return the unwrapped value because it would only be `()`. The bodies of the `if let` and the `unwrap_or_else` functions are the same in -both cases though: we print out the error and exit. +both cases: we print the error and exit. ### Splitting Code into a Library Crate -This is looking pretty good so far! Now we’re going to split the *src/main.rs* -file up and put some code into *src/lib.rs* so that we can test it and have a -*src/main.rs* file with fewer responsibilities. +Our `minigrep` project is looking good so far! Now we’ll split the +*src/main.rs* file and put some code into the *src/lib.rs* file so we can test +it and have a *src/main.rs* file with fewer responsibilities. -Let’s move everything that isn’t the `main` function from *src/main.rs* to a -new file, *src/lib.rs*: +Let’s move all the code that isn’t the `main` function from *src/main.rs* to +*src/lib.rs*: * The `run` function definition * The relevant `use` statements @@ -617,12 +621,12 @@ pub struct Config { impl Config { pub fn new(args: &[String]) -> Result { - // ...snip... + // --snip-- } } pub fn run(config: Config) -> Result<(), Box> { - // ...snip... + // --snip-- } ``` @@ -634,9 +638,7 @@ method, and on the `run` function. We now have a library crate that has a public API that we can test! Now we need to bring the code we moved to *src/lib.rs* into the scope of the -binary crate in *src/main.rs* by using `extern crate minigrep`. Then we’ll add -a `use minigrep::Config` line to bring the `Config` type into scope, and prefix -the `run` function with our crate name as shown in Listing 12-14: +binary crate in *src/main.rs*, as shown in Listing 12-14: Filename: src/main.rs @@ -649,9 +651,9 @@ use std::process; use minigrep::Config; fn main() { - // ...snip... + // --snip-- if let Err(e) = minigrep::run(config) { - // ...snip... + // --snip-- } } ``` @@ -660,15 +662,15 @@ fn main() { scope of *src/main.rs* To bring the library crate into the binary crate, we use `extern crate -minigrep`. Then we’ll add a `use minigrep::Config` line to bring the -`Config` type into scope, and we’ll prefix the `run` function with our crate -name. With that, all the functionality should be connected and should work. -Give it a `cargo run` and make sure everything is wired up correctly. +minigrep`. Then we’ll add a `use minigrep::Config` line to bring the `Config` +type into scope, and we’ll prefix the `run` function with our crate name. Now +all the functionality should be connected and should work. Run the program with +`cargo run` and make sure everything works correctly. Whew! That was a lot of work, but we’ve set ourselves up for success in the -future. Now it’s much easier to handle errors, and we’ve made our code more +future. Now it’s much easier to handle errors, and we’ve made the code more modular. Almost all of our work will be done in *src/lib.rs* from here on out. Let’s take advantage of this newfound modularity by doing something that would -have been hard with our old code, but is easy with our new code: write some -tests! +have been difficult with the old code but is easy with the new code: we’ll +write some tests! diff --git a/src/doc/book/second-edition/src/ch12-04-testing-the-librarys-functionality.md b/src/doc/book/second-edition/src/ch12-04-testing-the-librarys-functionality.md index 24681414ec..4244f879c4 100644 --- a/src/doc/book/second-edition/src/ch12-04-testing-the-librarys-functionality.md +++ b/src/doc/book/second-edition/src/ch12-04-testing-the-librarys-functionality.md @@ -1,41 +1,41 @@ ## Developing the Library’s Functionality with Test Driven Development Now that we’ve extracted the logic into *src/lib.rs* and left the argument -collecting and error handling in *src/main.rs*, it’s much easier for us to -write tests for the core functionality of our code. We can call our functions -directly with various arguments and check return values without having to call -our binary from the command line. Feel free to write some tests for the -functionality in the `Config::new` and `run` functions on your own if you’d -like. +collecting and error handling in *src/main.rs*, it’s much easier to write tests +for the core functionality of our code. We can call functions directly with +various arguments and check return values without having to call our binary +from the command line. Feel free to write some tests for the functionality in +the `Config::new` and `run` functions on your own. -In this section, we’re going to move on to adding the searching logic of -`minigrep` by following the Test Driven Development (TDD) process. This is a -software development technique that follows this set of steps: +In this section, we’ll add the searching logic to the `minigrep` program by +using the Test Driven Development (TDD) process. This software development +technique follows these steps: -* Write a test that fails, and run it to make sure it fails for the reason you -expected. -* Write or modify just enough code to make the new test pass. -* Refactor the code you just added or changed, and make sure the tests continue -to pass. -* Repeat! +1. Write a test that fails, and run it to make sure it fails for the reason you + expected. +2. Write or modify just enough code to make the new test pass. +3. Refactor the code you just added or changed, and make sure the tests + continue to pass. +4. Repeat from step 1! -This is just one of many ways to write software, but TDD can help drive the -design of code. Writing the test before you write the code that makes the test -pass helps to maintain high test coverage throughout the process. +This process is just one of many ways to write software, but TDD can help drive +code design as well. Writing the test before you write the code that makes the +test pass helps to maintain high test coverage throughout the process. -We’re going to test drive the implementation of the functionality that will -actually do the searching for the query string in the file contents and produce -a list of lines that match the query. We’re going to add this functionality in -a function called `search`. +We’ll test drive the implementation of the functionality that will actually do +the searching for the query string in the file contents and produce a list of +lines that match the query. We’ll add this functionality in a function called +`search`. ### Writing a Failing Test -First, since we don’t really need them any more, let’s remove the `println!` -statements from both *src/lib.rs* and *src/main.rs*. Then we’ll add a `test` -module with a test function like we did in Chapter 11. The test function -specifies the behavior we’d like the `search` function to have: it will take a -query and the text to search for the query in, and will return only the lines -from the text that contain the query. Listing 12-15 shows this test: +Because we don’t need them anymore, let’s remove the `println!` statements from +*src/lib.rs* and *src/main.rs* that we used to check the program’s behavior. +Then, in *src/lib.rs*, we’ll add a `test` module with a test function, as we +did in Chapter 11. The test function specifies the behavior we want the +`search` function to have: it will take a query and the text to search for the +query in, and will return only the lines from the text that contain the query. +Listing 12-15 shows this test: Filename: src/lib.rs @@ -67,16 +67,16 @@ Pick three."; Listing 12-15: Creating a failing test for the `search` function we wish we had -The string we are searching for is “duct” in this test. The text we’re -searching is three lines, only one of which contains “duct”. We assert that the -value returned from the `search` function contains only the line we expect. +This test searches for the string “duct.” The text we’re searching is three +lines, only one of which contains “duct.” We assert that the value returned +from the `search` function contains only the line we expect. -We aren’t able to run this test and watch it fail though, since this test -doesn’t even compile–the search function doesn’t exist yet! So now we’ll add -just enough code to get the tests to compile and run: a definition of the -`search` function that always returns an empty vector, as shown in Listing -12-16. Once we have this, the test should compile and fail because an empty -vector doesn’t match a vector containing the line `"safe, fast, productive."`. +We aren’t able to run this test and watch it fail because the test doesn’t even +compile: the `search` function doesn’t exist yet! So now we’ll add just enough +code to get the test to compile and run by adding a definition of the `search` +function that always returns an empty vector, as shown in Listing 12-16. Then +the test should compile and fail because an empty vector doesn’t match a vector +containing the line `"safe, fast, productive."`. Filename: src/lib.rs @@ -87,30 +87,32 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { ``` Listing 12-16: Defining just enough of the `search` -function so that our test will compile +function so our test will compile Notice that we need an explicit lifetime `'a` defined in the signature of -`search` and used with the `contents` argument and the return value. Remember -from Chapter 10 that the lifetime parameters specify which argument lifetime is -connected to the lifetime of the return value. In this case, we’re indicating -that the returned vector should contain string slices that reference slices of -the argument `contents` (rather than the argument `query`). +`search` and used with the `contents` argument and the return value. Recall in +Chapter 10 that the lifetime parameters specify which argument lifetime is +connected to the lifetime of the return value. In this case, we indicate that +the returned vector should contain string slices that reference slices of the +argument `contents` (rather than the argument `query`). -In other words, we’re telling Rust that the data returned by the `search` -function will live as long as the data passed into the `search` function in the +In other words, we tell Rust that the data returned by the `search` function +will live as long as the data passed into the `search` function in the `contents` argument. This is important! The data referenced *by* a slice needs -to be valid in order for the reference to be valid; if the compiler assumed we -were making string slices of `query` rather than `contents`, it would do its -safety checking incorrectly. +to be valid for the reference to be valid; if the compiler assumes we’re making +string slices of `query` rather than `contents`, it will do its safety checking +incorrectly. -If we tried to compile this function without lifetimes, we would get this error: +If we forget the lifetime annotations and try to compile this function, we’ll +get this error: ```text error[E0106]: missing lifetime specifier - --> src/lib.rs:5:47 + --> src/lib.rs:5:51 | -5 | fn search(query: &str, contents: &str) -> Vec<&str> { - | ^ expected lifetime parameter +5 | pub fn search(query: &str, contents: &str) -> Vec<&str> { + | ^ expected lifetime +parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `query` or `contents` @@ -122,15 +124,16 @@ want to return the parts of that text that match, we know `contents` is the argument that should be connected to the return value using the lifetime syntax. Other programming languages don’t require you to connect arguments to return -values in the signature, so this may still feel strange, but will get easier -over time. You may want to compare this example with the Lifetime Syntax -section in Chapter 10. +values in the signature, so although this might seem strange, it will get +easier over time. You might want to compare this example with “Validating +References with Lifetimes” in Chapter 10 on page XX. -Now let’s try running our test: +Now let’s run the test: ```text $ cargo test -...warnings... +--warnings-- + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.43 secs Running target/debug/deps/minigrep-abcabcabc @@ -140,20 +143,22 @@ test test::one_result ... FAILED failures: ---- test::one_result stdout ---- - thread 'test::one_result' panicked at 'assertion failed: `(left == right)` -(left: `["safe, fast, productive."]`, right: `[]`)', src/lib.rs:16 + thread 'test::one_result' panicked at 'assertion failed: `(left == +right)` +left: `["safe, fast, productive."]`, +right: `[]`)', src/lib.rs:48:8 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: test::one_result -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out -error: test failed +error: test failed, to rerun pass '--lib' ``` -Great, our test fails, exactly as we expected. Let’s get the test to pass! +Great, the test fails, exactly as we expected. Let’s get the test to pass! ### Writing Code to Pass the Test @@ -161,17 +166,18 @@ Currently, our test is failing because we always return an empty vector. To fix that and implement `search`, our program needs to follow these steps: * Iterate through each line of the contents. -* Check if the line contains our query string. +* Check whether the line contains our query string. * If it does, add it to the list of values we’re returning. * If it doesn’t, do nothing. * Return the list of results that match. -Let’s take each step at a time, starting with iterating through lines. +Let’s work through each step, starting with iterating through lines. #### Iterating Through Lines with the `lines` Method Rust has a helpful method to handle line-by-line iteration of strings, -conveniently named `lines`, that works as shown in Listing 12-17: +conveniently named `lines`, that works as shown in Listing 12-17. Note this +won’t compile yet: Filename: src/lib.rs @@ -183,20 +189,20 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { } ``` -Listing 12-17: Iterating through each line in -`contents` +Listing 12-17: Iterating through each line in `contents` + -The `lines` method returns an iterator. We’ll be talking about iterators in -depth in Chapter 13, but we’ve already seen this way of using an iterator in -Listing 3-4, where we used a `for` loop with an iterator to run some code on -each item in a collection. +The `lines` method returns an iterator. We’ll talk about iterators in depth in +Chapter 13, but recall that you saw this way of using an iterator in Listing +3-4, where we used a `for` loop with an iterator to run some code on each item +in a collection. #### Searching Each Line for the Query -Next, we’ll add functionality to check if the current line contains the query -string. Luckily, strings have another helpful method named `contains` that does -this for us! Add a call to the `contains` method in the `search` function as -shown in Listing 12-18: +Next, we’ll check whether the current line contains our query string. +Fortunately, strings have a helpful method named `contains` that does this for +us! Add a call to the `contains` method in the `search` function, as shown in +Listing 12-18. Note this still won’t compile yet: Filename: src/lib.rs @@ -210,15 +216,15 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { } ``` -Listing 12-18: Adding functionality to see if the line -contains the string in `query` +Listing 12-18: Adding functionality to see whether the +line contains the string in `query` #### Storing Matching Lines -Finally, we need a way to store the lines that contain our query string. For -that, we can make a mutable vector before the `for` loop and call the `push` -method to store a `line` in the vector. After the `for` loop, we return the -vector, as shown in Listing 12-19: +We also need a way to store the lines that contain our query string. For that, +we can make a mutable vector before the `for` loop and call the `push` method +to store a `line` in the vector. After the `for` loop, we return the vector, as +shown in Listing 12-19: Filename: src/lib.rs @@ -236,35 +242,36 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { } ``` -Listing 12-19: Storing the lines that match so that we -can return them +Listing 12-19: Storing the lines that match so we can +return them -Now the `search` function should be returning only the lines that contain -`query`, and our test should pass. Let’s run the tests: +Now the `search` function should return only the lines that contain `query`, +and our test should pass. Let’s run the test: ```text $ cargo test +--snip-- running 1 test test test::one_result ... ok -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Our test passed, great, it works! +Our test passed, so we know it works! -Now that our test is passing, we could consider opportunities for refactoring -the implementation of the `search` function while keeping the code that passes -the tests, in order to maintain the same functionality. The code in the -`search` function isn’t too bad, but it isn’t taking advantage of some useful -features of iterators. We’ll be coming back to this example in Chapter 13 where -we’ll explore iterators in detail and see how to improve it. +At this point, we could consider opportunities for refactoring the +implementation of the search function while keeping the tests passing to +maintain the same functionality. The code in the search function isn’t too bad, +but it doesn’t take advantage of some useful features of iterators. We’ll +return to this example in Chapter 13 where we’ll explore iterators in detail +and look at how to improve it. #### Using the `search` Function in the `run` Function -Now that we have the `search` function working and tested, we need to actually -call `search` from our `run` function. We need to pass the `config.query` value -and the `contents` that `run` read from the file to the `search` function. Then -`run` will print out each line returned from `search`: +Now that the `search` function is working and tested, we need to call `search` +from our `run` function. We need to pass the `config.query` value and the +`contents` that `run` reads from the file to the `search` function. Then `run` +will print each line returned from `search`: Filename: src/lib.rs @@ -283,11 +290,10 @@ pub fn run(config: Config) -> Result<(), Box> { } ``` -We’re still using a `for` loop to get each line returned from `search` and -print it out. +We’re still using a `for` loop to return each line from `search` and print it. -Now our whole program should be working! Let’s try it out, first with a word -that should return exactly one line from the Emily Dickinson poem, “frog”: +Now the entire program should work! Let’s try it out, first with a word that +should return exactly one line from the Emily Dickinson poem, “frog”: ```text $ cargo run frog poem.txt @@ -297,18 +303,19 @@ $ cargo run frog poem.txt How public, like a frog ``` -Cool! Next, how about a word that will match multiple lines, like “the”: +Cool! Now let’s try a word that will match multiple lines, like “body”: ```text -$ cargo run the poem.txt +$ cargo run body poem.txt Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs - Running `target/debug/minigrep the poem.txt` -Then there’s a pair of us — don’t tell! -To tell your name the livelong day + Running `target/debug/minigrep body poem.txt` +I’m nobody! Who are you? +Are you nobody, too? +How dreary to be somebody! ``` And finally, let’s make sure that we don’t get any lines when we search for a -word that isn’t anywhere in the poem, like “monomorphization”: +word that isn’t anywhere in the poem, such as “monomorphization”: ```text $ cargo run monomorphization poem.txt @@ -316,11 +323,10 @@ $ cargo run monomorphization poem.txt Running `target/debug/minigrep monomorphization poem.txt` ``` -Excellent! We’ve built our own mini version of a classic tool, and learned a -lot about how to structure applications. We’ve also learned a bit about file -input and output, lifetimes, testing, and command line parsing. +Excellent! We’ve built our own mini version of a classic tool and learned a lot +about how to structure applications. We’ve also learned a bit about file input +and output, lifetimes, testing, and command line parsing. -To round out this project chapter, we’re going to briefly demonstrate how to -work with environment variables and how to print to standard error, both of -which are useful when writing command line programs. Feel free to move on to -Chapter 13 if you’d like at this point. +To round out this project, we’ll briefly demonstrate how to work with +environment variables and how to print to standard error, both of which are +useful when you’re writing command line programs. diff --git a/src/doc/book/second-edition/src/ch12-05-working-with-environment-variables.md b/src/doc/book/second-edition/src/ch12-05-working-with-environment-variables.md index dee9e60e2c..41fd2ae199 100644 --- a/src/doc/book/second-edition/src/ch12-05-working-with-environment-variables.md +++ b/src/doc/book/second-edition/src/ch12-05-working-with-environment-variables.md @@ -1,22 +1,20 @@ ## Working with Environment Variables -We’re going to improve our tool with an extra feature: an option for case -insensitive searching that the user can turn on via an environment variable. We -could make this a command line option and require that users enter it each time -they want it to apply, but instead we’re going to use an environment variable. -This allows our users to set the environment variable once and have all their -searches be case insensitive in that terminal session. +We’ll improve `minigrep` by adding an extra feature: an option for +case-insensitive searching that the user can turn on via an environment +variable. We could make this feature a command line option and require that +users enter it each time they want it to apply, but instead we’ll use an +environment variable. Doing so allows our users to set the environment variable +once and have all their searches be case insensitive in that terminal session. ### Writing a Failing Test for the Case-Insensitive `search` Function -We want to add a new `search_case_insensitive` function that we will call when -the environment variable is on. - -We’re going to continue following the TDD process, so the first step is again -to write a failing test. We’ll add a new test for the new case-insensitive -search function, and rename our old test from `one_result` to `case_sensitive` -to be clearer about the differences between the two tests, as shown in Listing -12-20: +We want to add a new `search_case_insensitive` function that we’ll call when +the environment variable is on. We’ll continue to follow the TDD process, so +the first step is again to write a failing test. We’ll add a new test for the +new `search``_case_insensitive` function and rename our old test from +`one_result` to `case_sensitive` to clarify the differences between the two +tests, as shown in Listing 12-20: Filename: src/lib.rs @@ -57,32 +55,31 @@ Trust me."; } ``` -Listing 12-20: Adding a new failing test for the case -insensitive function we’re about to add +Listing 12-20: Adding a new failing test for the +case-insensitive function we’re about to add Note that we’ve edited the old test’s `contents` too. We’ve added a new line -with the text “Duct tape”, with a capital D, that shouldn’t match the query -“duct” when we’re searching in a case sensitive manner. Changing the old test -in this way helps ensure that we don’t accidentally break the case sensitive -search functionality that we’ve already implemented; this test should pass now -and should continue to pass as we work on the case insensitive search. +with the text `“Duct tape”` using a capital D that shouldn’t match the query +“duct” when we’re searching in a case-sensitive manner. Changing the old test +in this way helps ensure that we don’t accidentally break the case-sensitive +search functionality that we’ve already implemented. This test should pass now +and should continue to pass as we work on the case-insensitive search. -The new test for the case *insensitive* search uses “rUsT” as its query. In the -`search_case_insensitive` function we’re going to add, the query “rUsT” should -match both the line containing “Rust:” with a capital R and also the line -“Trust me.” even though both of those have different casing than the query. -This is our failing test, and it will fail to compile because we haven’t yet -defined the `search_case_insensitive` function. Feel free to add a skeleton -implementation that always returns an empty vector in the same way that we did -for the `search` function in Listing 12-16 in order to see the test compile and -fail. +The new test for the case-*insensitive* search uses “rUsT” as its query. In the +`search_case_insensitive` function we’re about to add, the query “rUsT” should +match the line containing “Rust:” with a capital R and also the line “Trust +me.” even though both have different casing than the query. This is our failing +test, and it will fail to compile because we haven’t yet defined the +`search_case_insensitive` function. Feel free to add a skeleton implementation +that always returns an empty vector, similar to the way we did for the `search` +function in Listing 12-16 to see the test compile and fail. ### Implementing the `search_case_insensitive` Function The `search_case_insensitive` function, shown in Listing 12-21, will be almost the same as the `search` function. The only difference is that we’ll lowercase -the `query` and each `line` so that whatever the case of the input arguments, -they will be the same case when we check whether the line contains the query. +the `query` and each `line` so whatever the case of the input arguments, +they’ll be the same case when we check whether the line contains the query: Filename: src/lib.rs @@ -102,25 +99,25 @@ fn search_case_insensitive<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { ``` Listing 12-21: Defining the `search_case_insensitive` -function to lowercase both the query and the line before comparing them +function to lowercase the query and the line before comparing them -First, we lowercase the `query` string, and store it in a shadowed variable -with the same name. Calling `to_lowercase` on the query is necessary so that no -matter if the user’s query is “rust”, “RUST”, “Rust”, or “rUsT”, we’ll treat -the query as if it was “rust” and be insensitive to the case. +First, we lowercase the `query` string and store it in a shadowed variable with +the same name. Calling `to_lowercase` on the query is necessary so no matter +whether the user’s query is “rust”, “RUST”, “Rust”, or “rUsT”, we’ll treat the +query as if it was “rust” and be insensitive to the case. Note that `query` is now a `String` rather than a string slice, because calling `to_lowercase` creates new data rather than referencing existing data. Say the -query is “rUsT”, as an example: that string slice does not contain a lowercase +query is “rUsT”, as an example: that string slice doesn’t contain a lowercase “u” or “t” for us to use, so we have to allocate a new `String` containing “rust”. When we pass `query` as an argument to the `contains` method now, we need to add an ampersand because the signature of `contains` is defined to take a string slice. -Next, we add a call to `to_lowercase` on each `line` before we check if it -contains `query` to lowercase all characters. Now that we’ve converted both -`line` and `query` to lowercase, we’ll find matches no matter what the case of -the query. +Next, we add a call to `to_lowercase` on each `line` before we check whether it +contains `query` to lowercase all characters. Now that we’ve converted `line` +and `query` to lowercase, we’ll find matches no matter what the case of the +query is. Let’s see if this implementation passes the tests: @@ -129,13 +126,14 @@ running 2 tests test test::case_insensitive ... ok test test::case_sensitive ... ok -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` -Great! Now, let’s actually call the new `search_case_insensitive` function from -the `run` function. First, we’re going to add a configuration option for -switching between case sensitive and case insensitive search to the `Config` -struct: +Great! They passed. Now, let’s call the new `search_case_insensitive` function +from the `run` function. First, we’ll add a configuration option to the +`Config` struct to switch between case-sensitive and case-insensitive search. +Adding this field will cause compiler errors since we aren’t initializing this +field anywhere yet: Filename: src/lib.rs @@ -147,10 +145,11 @@ pub struct Config { } ``` -We add the `case_sensitive` field that holds a boolean. Then we need our `run` -function to check the `case_sensitive` field’s value and use that to decide -whether to call the `search` function or the `search_case_insensitive` function -as shown in Listing 12-22: +Note that we added the `case_sensitive` field that holds a Boolean. Next, we +need the `run` function to check the `case_sensitive` field’s value and use +that to decide whether to call the `search` function or the +`search_case_insensitive` function, as shown in Listing 12-22. Note this still +won’t compile yet: Filename: src/lib.rs @@ -196,12 +195,12 @@ pub fn run(config: Config) -> Result<(), Box>{ Listing 12-22: Calling either `search` or `search_case_insensitive` based on the value in `config.case_sensitive` -Finally, we need to actually check for the environment variable. The functions -for working with environment variables are in the `env` module in the standard +Finally, we need to check for the environment variable. The functions for +working with environment variables are in the `env` module in the standard library, so we want to bring that module into scope with a `use std::env;` line -at the top of *src/lib.rs*. Then we’re going to use the `var` method from the -`env` module to check for an environment variable named `CASE_INSENSITIVE`, as -shown in Listing 12-23: +at the top of *src/lib.rs*. Then we’ll use the `var` method from the `env` +module to check for an environment variable named `CASE_INSENSITIVE`, as shown +in Listing 12-23: Filename: src/lib.rs @@ -213,7 +212,7 @@ use std::env; # case_sensitive: bool, # } -// ...snip... +// --snip-- impl Config { pub fn new(args: &[String]) -> Result { @@ -234,24 +233,24 @@ impl Config { Listing 12-23: Checking for an environment variable named `CASE_INSENSITIVE` -Here, we create a new variable `case_sensitive`. In order to set its value, we -call the `env::var` function and pass it the name of the `CASE_INSENSITIVE` -environment variable. The `env::var` method returns a `Result` that will be the -successful `Ok` variant that contains the value of the environment variable if -the environment variable is set. It will return the `Err` variant if the +Here, we create a new variable `case_sensitive`. To set its value, we call the +`env::var` function and pass it the name of the `CASE_INSENSITIVE` environment +variable. The `env::var` method returns a `Result` that will be the successful +`Ok` variant that contains the value of the environment variable if the +environment variable is set. It will return the `Err` variant if the environment variable is not set. -We’re using the `is_err` method on the `Result` to check to see if it’s an -error, and therefore unset, which means it *should* do a case sensitive search. -If the `CASE_INSENSITIVE` environment variable is set to anything, `is_err` -will return false and it will perform a case insensitive search. We don’t care -about the *value* of the environment variable, just whether it’s set or unset, -so we’re checking `is_err` rather than `unwrap`, `expect`, or any of the other +We’re using the `is_err` method on the `Result` to check whether it’s an error +and therefore unset, which means it *should* do a case-sensitive search. If the +`CASE_INSENSITIVE` environment variable is set to anything, `is_err` will +return false and will perform a case-insensitive search. We don’t care about +the *value* of the environment variable, just whether it’s set or unset, so +we’re checking `is_err` rather than `unwrap`, `expect`, or any of the other methods we’ve seen on `Result`. We pass the value in the `case_sensitive` variable to the `Config` instance so -that the `run` function can read that value and decide whether to call `search` -or `search_case_insensitive` as we implemented in Listing 12-22. +the `run` function can read that value and decide whether to call `search` or +`search_case_insensitive` as we implemented in Listing 12-22. Let’s give it a try! First, we’ll run our program without the environment variable set and with the query “to”, which should match any line that contains @@ -259,6 +258,7 @@ the word “to” in all lowercase: ```text $ cargo run to poem.txt + Compiling minigrep v0.1.0 (file:///projects/minigrep) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/minigrep to poem.txt` Are you nobody, too? @@ -266,8 +266,8 @@ How dreary to be somebody! ``` Looks like that still works! Now, let’s run the program with `CASE_INSENSITIVE` -set to 1 but with the same query “to”, and we should get lines that contain -“to” that might have uppercase letters: +set to `1` but with the same query “to”; we should get lines that contain “to” +that might have uppercase letters: ```text $ CASE_INSENSITIVE=1 cargo run to poem.txt @@ -279,12 +279,20 @@ To tell your name the livelong day To an admiring bog! ``` +If you’re using PowerShell, you will need to set the environment variable and +run the program in two commands rather than one: + +```text +$ $env.CASE_INSENSITIVE=1 +$ cargo run to poem.txt +``` + Excellent, we also got lines containing “To”! Our `minigrep` program can now do -case insensitive searching, controlled by an environment variable. Now you know +case-insensitive searching controlled by an environment variable. Now you know how to manage options set using either command line arguments or environment variables! -Some programs allow both arguments *and* environment variables for the same +Some programs allow arguments *and* environment variables for the same configuration. In those cases, the programs decide that one or the other takes precedence. For another exercise on your own, try controlling case insensitivity through either a command line argument or an environment @@ -293,4 +301,4 @@ should take precedence if the program is run with one set to case sensitive and one set to case insensitive. The `std::env` module contains many more useful features for dealing with -environment variables; check out its documentation to see what’s available. +environment variables: check out its documentation to see what is available. diff --git a/src/doc/book/second-edition/src/ch12-06-writing-to-stderr-instead-of-stdout.md b/src/doc/book/second-edition/src/ch12-06-writing-to-stderr-instead-of-stdout.md index b7c8f89f96..342d865bf0 100644 --- a/src/doc/book/second-edition/src/ch12-06-writing-to-stderr-instead-of-stdout.md +++ b/src/doc/book/second-edition/src/ch12-06-writing-to-stderr-instead-of-stdout.md @@ -1,31 +1,32 @@ ## Writing Error Messages to Standard Error Instead of Standard Output -At the moment we’re writing all of our output to the terminal with the +At the moment we’re writing all of our output to the terminal using the `println!` function. Most terminals provide two kinds of output: *standard -output* for general information (sometimes abbreviated as `stdout` in code), -and *standard error* for error messages (`stderr`). This distinction enables -users to choose to direct the successful output of a program to a -file but still print error messages to the screen. +out**put* (`stdout`) for general information and *standard error* (`stderr`) +for error messages. This distinction enables users to choose to direct the +successful output of a program to a file but still print error messages to the +screen. -The `println!` function is only capable of printing to standard output, though, -so we have to use something else in order to print to standard error. +The `println!` function is only capable of printing to standard output, so we +have to use something else to print to standard error. -### Checking Where Errors are Written to +### Checking Where Errors Are Written to -First, let’s observe how all content printed by `minigrep` is currently being -written to standard output, including error messages that we want to write to +First, let’s observe how the content printed by `minigrep` is currently being +written to standard output, including any error messages we want to write to standard error instead. We’ll do that by redirecting the standard output stream -to a file while we also intentionally cause an error. We won’t redirect the +to a file while also intentionally causing an error. We won’t redirect the standard error stream, so any content sent to standard error will continue to -display on the screen. Command line programs are expected to send error -messages to the standard error stream so that we can still see error messages -on the screen even if we choose to redirect the standard output stream to a -file. Our program is not currently well-behaved; we’re about to see that it -saves the error message output to the file instead! +display on the screen. + +Command line programs are expected to send error messages to the standard error +stream so we can still see error messages on the screen even if we redirect the +standard output stream to a file. Our program is not currently well-behaved: +we’re about to see that it saves the error message output to a file instead! The way to demonstrate this behavior is by running the program with `>` and the filename, *output.txt*, that we want to redirect the standard output stream to. -We’re not going to pass any arguments, which should cause an error: +We won’t pass any arguments, which should cause an error: ```text $ cargo run > output.txt @@ -34,25 +35,25 @@ $ cargo run > output.txt The `>` syntax tells the shell to write the contents of standard output to *output.txt* instead of the screen. We didn’t see the error message we were expecting printed on the screen, so that means it must have ended up in the -file. Let’s see what *output.txt* contains: +file. This is what *output.txt* contains: ```text Problem parsing arguments: not enough arguments ``` Yup, our error message is being printed to standard output. It’s much more -useful for error messages like this to be printed to standard error, and have +useful for error messages like this to be printed to standard error and have only data from a successful run end up in the file when we redirect standard -output in this way. We’ll change that. +output this way. We’ll change that. ### Printing Errors to Standard Error -Let’s change how error messages are printed using the code in Listing 12-24. +We’ll use the code in Listing 12-24 to change how error messages are printed. Because of the refactoring we did earlier in this chapter, all the code that -prints error messages is in one function, in `main`. The standard library -provides the `eprintln!` macro that prints to the standard error stream, so -let’s change the two places we were calling `println!` to print errors so that -these spots use `eprintln!` instead: +prints error messages is in one function, `main`. The standard library provides +the `eprintln!` macro that prints to the standard error stream, so let’s change +the two places we were calling `println!` to print errors to use `eprintln!` +instead: Filename: src/main.rs @@ -76,25 +77,25 @@ fn main() { Listing 12-24: Writing error messages to standard error instead of standard output using `eprintln!` -After changing `println!` to `eprintln!`, let’s try running the program again -in the same way, without any arguments and redirecting standard output with `>`: +After changing `println!` to `eprintln!`, let’s run the program again in the +same way, without any arguments and redirecting standard output with `>`: ```text $ cargo run > output.txt Problem parsing arguments: not enough arguments ``` -Now we see our error on the screen and `output.txt` contains nothing, which is -the behavior expected of command line programs. +Now we see the error onscreen and *output.txt* contains nothing, which is the +behavior we expect of command line programs. -If we run the program again with arguments that don’t cause an error, but still -redirect standard output to a file: +Let’s run the program again with arguments that don’t cause an error but still +redirect standard output to a file, like so: ```text $ cargo run to poem.txt > output.txt ``` -We won’t see any output to our terminal, and `output.txt` will contain our +We won’t see any output to the terminal, and *output.txt* will contain our results: Filename: output.txt @@ -104,18 +105,19 @@ Are you nobody, too? How dreary to be somebody! ``` -This demonstrates that we’re now using standard output for successful output and -standard error for error output as appropriate. +This demonstrates that we’re now using standard output for successful output +and standard error for error output as appropriate. ## Summary -In this chapter, we’ve recapped on some of the major concepts so far and -covered how to do common I/O operations in a Rust context. By using command -line arguments, files, environment variables, and the `eprintln!` macro for -printing errors, you’re now prepared to write command line applications. By -using the concepts from previous chapters, your code will be well-organized, be -able to store data effectively in the appropriate data structures, handle -errors nicely, and be well tested. +In this chapter, we’ve recapped some of the major concepts you’ve learned so +far and covered how to do common I/O operations in a Rust context. By using +command line arguments, files, environment variables, and the `eprintln!` macro +for printing errors, you’re now prepared to write command line applications. By +using the concepts in previous chapters, your code will be well organized, +store data effectively in the appropriate data structures, handle errors +nicely, and be well tested. + +Next, we’ll explore some Rust features that were influenced by functional +languages: closures and iterators. -Next, let’s explore some functional-language influenced Rust features: closures -and iterators. diff --git a/src/doc/book/second-edition/src/ch13-00-functional-features.md b/src/doc/book/second-edition/src/ch13-00-functional-features.md index 77fd72a412..50eab0940a 100644 --- a/src/doc/book/second-edition/src/ch13-00-functional-features.md +++ b/src/doc/book/second-edition/src/ch13-00-functional-features.md @@ -1,23 +1,23 @@ -# Functional Language features in Rust: Iterators and Closures +# Functional Language Features: Iterators and Closures -Rust’s design has taken inspiration from a lot of existing languages and +Rust’s design has taken inspiration from many existing languages and techniques, and one significant influence is *functional programming*. -Programming in a functional style often includes using functions as values, by +Programming in a functional style often includes using functions as values by passing them in arguments, returning them from other functions, assigning them -to variables for later execution, and so forth. We won’t debate here the issue -of what, exactly, functional programming is or is not, but will instead show -off some features of Rust that are similar to features in many languages often -referred to as functional. +to variables for later execution, and so forth. In this chapter, we won’t +debate the issue of what functional programming is or isn’t but will instead +discuss some features of Rust that are similar to features in many languages +often referred to as functional. -More specifically, we’re going to cover: +More specifically, we’ll cover: -* *Closures*: a function-like construct you can store in a variable. -* *Iterators*: a way of processing a series of elements. -* How to use these features to improve on the I/O project from Chapter 12. -* The performance of these features. Spoiler alert: they’re faster than you - might think! +* *Closures*, a function-like construct you can store in a variable +* *Iterators*, a way of processing a series of elements +* How to use these two features to improve the I/O project in Chapter 12 +* The performance of these two features (Spoiler alert: they’re faster than you + might think!) -There are other Rust features influenced by the functional style, like pattern -matching and enums, that we’ve covered in other chapters as well. Mastering +Other Rust features are influenced by the functional style as well, such as +pattern matching and enums, which we’ve covered in other chapters. Mastering closures and iterators is an important part of writing idiomatic, fast Rust -code, so we’re devoting an entire chapter to them here. +code, so we’ll devote this entire chapter to them. diff --git a/src/doc/book/second-edition/src/ch13-01-closures.md b/src/doc/book/second-edition/src/ch13-01-closures.md index 2d057add29..10edac3304 100644 --- a/src/doc/book/second-edition/src/ch13-01-closures.md +++ b/src/doc/book/second-edition/src/ch13-01-closures.md @@ -1,26 +1,26 @@ -## Closures: Anonymous Functions that can Capture their Environment +## Closures: Anonymous Functions that Can Capture Their Environment Rust’s *closures* are anonymous functions you can save in a variable or pass as arguments to other functions. You can create the closure in one place, and then call the closure to evaluate it in a different context. Unlike functions, -closures are able to capture values from the scope in which they are called. -We’re going to demonstrate how these features of closures allow for code reuse -and customization of behavior. +closures can capture values from the scope in which they’re called. We’ll +demonstrate how these closure features allow for code reuse and behavior +customization. -### Creating an Abstraction of Behavior Using a Closure +### Creating an Abstraction of Behavior with Closures Let’s work on an example of a situation in which it’s useful to store a closure -to be executed at a later time. We’ll talk about the syntax of closures, type -inference, and traits along the way. +to be executed at a later time. Along the way, we’ll talk about the syntax of +closures, type inference, and traits. -The hypothetical situation is this: we work at a startup that’s making an app +Consider this hypothetical situation: we work at a startup that’s making an app to generate custom exercise workout plans. The backend is written in Rust, and the algorithm that generates the workout plan takes into account many different -factors, like the app user’s age, Body Mass Index, preferences, recent +factors, such as the app user’s age, body mass index, preferences, recent workouts, and an intensity number they specify. The actual algorithm used isn’t important in this example; what’s important is that this calculation takes a -few seconds. We only want to call this algorithm when we need to, and only call -it once, so we aren’t making the user wait more than necessary. +few seconds. We want to call this algorithm only when we need to and only call +it once, so we don’t make the user wait more than necessary. We’ll simulate calling this hypothetical algorithm with the `simulated_expensive_calculation` function shown in Listing 13-1, which will @@ -43,22 +43,21 @@ fn simulated_expensive_calculation(intensity: u32) -> u32 { Listing 13-1: A function to stand in for a hypothetical calculation that takes about two seconds to run -Next, we have a `main` function that contains the parts of the workout app -important for this example. This represents the code that the app would call -when a user asks for a workout plan. Because the interaction with the app’s -frontend isn’t relevant to the use of closures, we’re going to hardcode values +Next is the `main` function that contains the parts of the workout app +important for this example. This function represents the code that the app will +call when a user asks for a workout plan. Because the interaction with the +app’s frontend isn’t relevant to the use of closures, we’ll hardcode values representing inputs to our program and print the outputs. The required inputs are: -* **An intensity number from the user**, specified when they request a - workout to indicate whether they’d like a low intensity workout or a high - intensity workout -* **A random number** that will generate some variety in the workout plans +* *An intensity number from the user*, which is specified when they request + a workout to indicate whether they want a low-intensity workout or a + high-intensity workout. +* *A random number* that will generate some variety in the workout plans. -The output will be the recommended workout plan. - -Listing 13-2 shows the `main` function we’re going to use. +The output will be the recommended workout plan. Listing 13-2 shows the `main` +function we’ll use: Filename: src/main.rs @@ -80,15 +79,15 @@ simulate user input and random number generation We’ve hardcoded the variable `simulated_user_specified_value` to 10 and the variable `simulated_random_number` to 7 for simplicity’s sake; in an actual -program we’d get the intensity number from the app frontend and we’d use the -`rand` crate to generate a random number like we did in the Guessing Game +program, we’d get the intensity number from the app frontend and we’d use the +`rand` crate to generate a random number, as we did in the Guessing Game example in Chapter 2. The `main` function calls a `generate_workout` function with the simulated input values. -There’s the context, so let’s get to the algorithm. The `generate_workout` -function in Listing 13-3 contains the business logic of the app that we’re most -concerned with in this example. The rest of the code changes in this example -will be made to this function: +Now that we have the context, let’s get to the algorithm. The +`generate_workout` function in Listing 13-3 contains the business logic of the +app that we’re most concerned with in this example. The rest of the code +changes in this example will be made to this function: Filename: src/main.rs @@ -134,31 +133,33 @@ The first `if` block calls `simulated_expensive_calculation` twice, the `if` inside the outer `else` doesn’t call it at all, and the code inside the second `else` case calls it once. -The desired behavior of the `generate_workout` function is to first check if -the user wants a low intensity workout (indicated by a number less than 25) or -a high intensity workout (25 or more). + -Low intensity workout plans will recommend a number of pushups and situps based -on the complex algorithm we’re simulating. +The desired behavior of the `generate_workout` function is to first check +whether the user wants a low-intensity workout (indicated by a number less +than 25) or a high-intensity workout (a number of 25 or greater). -If the user wants a high intensity workout, there’s some additional logic: if +Low-intensity workout plans will recommend a number of push-ups and sit-ups +based on the complex algorithm we’re simulating. + +If the user wants a high-intensity workout, there’s some additional logic: if the value of the random number generated by the app happens to be 3, the app will recommend a break and hydration. If not, the user will get a number of minutes of running based on the complex algorithm. The data science team has let us know that we’ll have to make some changes to the way we call the algorithm in the future. To simplify the update when those -changes happen, we want to refactor this code so it only calls the -`simulated_expensive_calculation` function once. We also want to cut the place -where we’re currently calling the function twice unnecessarily without adding -any other calls to that function in the process. That is, we don’t want to call -it if the result isn’t needed, and we still want to call it only once. +changes happen, we want to refactor this code so it calls the +`simulated_expensive_calculation` function only once. We also want to cut the +place where we’re currently unnecessarily calling the function twice without +adding any other calls to that function in the process. That is, we don’t want +to call it if the result isn’t needed, and we still want to call it only once. #### Refactoring Using Functions -There are many ways we could restructure this program. First we’ll try -extracting the duplicated call to the expensive calculation function into a -variable, as shown in Listing 13-4: +We could restructure the workout program in many ways. First, we’ll try +extracting the duplicated call to the `expensive_calculation` function into +a variable, as shown in Listing 13-4: Filename: src/main.rs @@ -203,15 +204,15 @@ fn generate_workout(intensity: u32, random_number: u32) { `expensive_result` variable This change unifies all the calls to `simulated_expensive_calculation` and -solves the problem of the first `if` block calling the function twice -unnecessarily. Unfortunately, we’re now calling this function and waiting for -the result in all cases, which includes the inner `if` block that doesn’t use -the result value at all. +solves the problem of the first `if` block unnecessarily calling the function +twice. Unfortunately, we’re now calling this function and waiting for the +result in all cases, which includes the inner `if` block that doesn’t use the +result value at all. We want to define code in one place in our program, but only *execute* that code where we actually need the result. This is a use case for closures! -#### Refactoring with Closures to Store Code for Later Execution +#### Refactoring with Closures to Store Code Instead of always calling the `simulated_expensive_calculation` function before the `if` blocks, we can define a closure and store the *closure* in a variable @@ -240,27 +241,27 @@ The closure definition comes after the `=` to assign it to the variable `expensive_closure`. To define a closure, we start with a pair of vertical pipes (`|`), inside which we specify the parameters to the closure; this syntax was chosen because of its similarity to closure definitions in Smalltalk and -Ruby. This closure has one parameter named `num`; if we had more than one +Ruby. This closure has one parameter named `num`: if we had more than one parameter, we would separate them with commas, like `|param1, param2|`. After the parameters, we place curly brackets that hold the body of the closure—these are optional if the closure body is a single expression. The end of the closure, after the curly brackets, needs a semicolon to complete the `let` statement. The value returned from the last line in the closure body -(`num`) will be the value returned from the closure when it’s called, since +(`num`) will be the value returned from the closure when it’s called, because that line doesn’t end in a semicolon; just like in function bodies. Note that this `let` statement means `expensive_closure` contains the *definition* of an anonymous function, not the *resulting value* of calling the anonymous function. Recall that we’re using a closure because we want to define -the code to call at one point, store that code, and actually call it at a later -point; the code we want to call is now stored in `expensive_closure`. +the code to call at one point, store that code, and call it at a later point; +the code we want to call is now stored in `expensive_closure`. -Now that we have the closure defined, we can change the code in the `if` blocks -to call the closure, in order to execute the code and get the resulting value. -We call a closure like we do a function: we specify the variable name that -holds the closure definition and follow it with parentheses containing the -argument values we want to use, as shown in Listing 13-6: +With the closure defined, we can change the code in the `if` blocks to call the +closure to execute the code and get the resulting value. We call a closure like +we do a function: we specify the variable name that holds the closure +definition and follow it with parentheses containing the argument values we +want to use, as shown in Listing 13-6: Filename: src/main.rs @@ -303,27 +304,24 @@ defined Now the expensive calculation is called in only one place, and we’re only executing that code where we need the results. -We have, however, reintroduced one of the problems from Listing 13-3: we’re -still calling the closure twice in the first `if` block, which will call the +However, we’ve reintroduced one of the problems from Listing 13-3: we’re still +calling the closure twice in the first `if` block, which will call the expensive code twice and make the user wait twice as long as they need to. We could fix this problem by creating a variable local to that `if` block to hold the result of calling the closure, but closures provide us with another -solution. We’ll get back to that solution in a bit; let’s first talk about why -there aren’t type annotations in the closure definition and the traits involved -with closures. +solution. We’ll talk about that solution in a bit. But first let’s talk about +why there aren’t type annotations in the closure definition and the traits +involved with closures. ### Closure Type Inference and Annotation -Closures differ from functions defined with the `fn` keyword in a few ways. The -first is that closures don’t require you to annotate the types of the -parameters or the return value like `fn` functions do. - -Type annotations are required on functions because they are part of an explicit -interface exposed to your users. Defining this interface rigidly is important -for ensuring that everyone agrees on what types of values a function uses and -returns. Closures aren’t used in an exposed interface like this, though: -they’re stored in variables and used without naming them and exposing them to -users of our library. +Closures don’t require you to annotate the types of the parameters or the +return value like `fn` functions do. Type annotations are required on functions +because they’re part of an explicit interface exposed to your users. Defining +this interface rigidly is important for ensuring that everyone agrees on what +types of values a function uses and returns. But closures aren’t used in an +exposed interface like this: they’re stored in variables and used without +naming them and exposing them to users of our library. Additionally, closures are usually short and only relevant within a narrow context rather than in any arbitrary scenario. Within these limited contexts, @@ -334,10 +332,10 @@ Making programmers annotate the types in these small, anonymous functions would be annoying and largely redundant with the information the compiler already has available. -Like variables, we can choose to add type annotations if we want to increase -explicitness and clarity at the cost of being more verbose than is strictly -necessary; annotating the types for the closure we defined in Listing 13-4 -would look like the definition shown in Listing 13-7: +Like variables, we can add type annotations if we want to increase explicitness +and clarity at the cost of being more verbose than is strictly necessary; +annotating the types for the closure we defined in Listing 13-4 would look like +the definition shown in Listing 13-7: Filename: src/main.rs @@ -356,11 +354,11 @@ let expensive_closure = |num: u32| -> u32 { parameter and return value types in the closure The syntax of closures and functions looks more similar with type annotations. -Here’s a vertical comparison of the syntax for the definition of a function -that adds one to its parameter, and a closure that has the same behavior. We’ve -added some spaces here to line up the relevant parts). This illustrates how -closure syntax is similar to function syntax, except for the use of pipes and -the amount of syntax that is optional: +The following is a vertical comparison of the syntax for the definition of a +function that adds one to its parameter, and a closure that has the same +behavior. We’ve added some spaces to line up the relevant parts. This +illustrates how closure syntax is similar to function syntax except for the use +of pipes and the amount of syntax that is optional: ```rust,ignore fn add_one_v1 (x: u32) -> u32 { x + 1 } @@ -372,18 +370,16 @@ let add_one_v4 = |x| x + 1 ; The first line shows a function definition, and the second line shows a fully annotated closure definition. The third line removes the type annotations from the closure definition, and the fourth line removes the brackets that are -optional, since the closure body only has one expression. These are all valid +optional, because the closure body has only one expression. These are all valid definitions that will produce the same behavior when they’re called. Closure definitions will have one concrete type inferred for each of their parameters and for their return value. For instance, Listing 13-8 shows the definition of a short closure that just returns the value it receives as a -parameter. - -This closure isn’t very useful except for the purposes of this example. Note -that we haven’t added any type annotations to the definition: if we then try to -call the closure twice, using a `String` as an argument the first time and an -`u32` the second time, we’ll get an error: +parameter. This closure isn’t very useful except for the purposes of this +example. Note that we haven’t added any type annotations to the definition: if +we then try to call the closure twice, using a `String` as an argument the +first time and a `u32` the second time, we’ll get an error: Filename: src/main.rs @@ -418,37 +414,36 @@ error if we try to use a different type with the same closure. ### Storing Closures Using Generic Parameters and the `Fn` Traits -Returning to our workout generation app, in Listing 13-6 we left our code still -calling the expensive calculation closure more times than it needs to. One +Let’s return to our workout generation app. In Listing 13-6, our code was still +calling the expensive calculation closure more times than it needed to. One option to solve this issue is to save the result of the expensive closure in a variable for reuse and use the variable instead in each place we need the -result instead of calling the closure again. This method, though, could result +result instead of calling the closure again. However, this method could result in a lot of repeated code. -Fortunately, we have another solution available to us. We can create a struct -that will hold the closure and the resulting value of calling the closure. The +Fortunately, another solution is available to us. We can create a struct that +will hold the closure and the resulting value of calling the closure. The struct will only execute the closure if we need the resulting value, and it -will cache the resulting value so that the rest of our code doesn’t have to be +will cache the resulting value so the rest of our code doesn’t have to be responsible for saving and reusing the result. You may know this pattern as *memoization* or *lazy evaluation*. -In order to make a struct that holds a closure, we need to be able to specify -the type of the closure, because a struct definition needs to know the types of -each of its fields. Each closure instance has its own unique anonymous type: -that is, even if two closures have the same signature, their types are still -considered different. In order to define structs, enums, or function parameters -that use closures, we use generics and trait bounds like we discussed in -Chapter 10. +To make a struct that holds a closure, we need to specify the type of the +closure, because a struct definition needs to know the types of each of its +fields. Each closure instance has its own unique anonymous type: that is, even +if two closures have the same signature, their types are still considered +different. To define structs, enums, or function parameters that use closures, +we use generics and trait bounds, as we discussed in Chapter 10. The `Fn` traits are provided by the standard library. All closures implement -one of the traits `Fn`, `FnMut`, or `FnOnce`. We’ll discuss the difference +one of the traits: `Fn`, `FnMut`, or `FnOnce`. We’ll discuss the difference between these traits in the next section on capturing the environment; in this example, we can use the `Fn` trait. We add types to the `Fn` trait bound to represent the types of the parameters -and return values the closures must have in order to match this trait bound. In -this case, our closure has a parameter of type `u32` and returns an `u32`, so -the trait bound we specify is `Fn(u32) -> u32`. +and return values the closures must have to match this trait bound. In this +case, our closure has a parameter of type `u32` and returns a `u32`, so the +trait bound we specify is `Fn(u32) -> u32`. Listing 13-9 shows the definition of the `Cacher` struct that holds a closure and an optional result value: @@ -470,11 +465,11 @@ closure in `calculation` and an optional result in `value` The `Cacher` struct has a `calculation` field of the generic type `T`. The trait bounds on `T` specify that it’s a closure by using the `Fn` trait. Any closure we want to store in the `calculation` field must have one `u32` -parameter (specified within the parentheses after `Fn`) and must return an +parameter (specified within the parentheses after `Fn`) and must return a `u32` (specified after the `->`). -> Note: Functions implement all three of the `Fn` traits too. If what we want to -> do doesn’t require capturing a value from the environment, we can use a +> Note: Functions implement all three of the `Fn` traits too. If what we want +> to do doesn’t require capturing a value from the environment, we can use a > function rather than a closure where we need something that implements an `Fn` > trait. @@ -523,19 +518,19 @@ impl Cacher Listing 13-10: The caching logic of `Cacher` -We want `Cacher` to manage the struct fields’ values, rather than letting the +We want `Cacher` to manage the struct fields’ values rather than letting the calling code potentially change the values in these fields directly, so these fields are private. The `Cacher::new` function takes a generic parameter `T`, which we’ve defined as having the same trait bound as the `Cacher` struct. Then `Cacher::new` returns a `Cacher` instance that holds the closure specified in the -`calculation` field and a `None` value in the `value` field, since we haven’t +`calculation` field and a `None` value in the `value` field, because we haven’t executed the closure yet. When the calling code wants the result of evaluating the closure, instead of calling the closure directly, it will call the `value` method. This method -checks to see if we already have a resulting value in `self.value` in a `Some`; +checks whether we already have a resulting value in `self.value` in a `Some`; if we do, it returns the value within the `Some` without executing the closure again. @@ -620,21 +615,21 @@ calculation will be run a maximum of once. Try running this program with the `main` function from Listing 13-2. Change the values in the `simulated_user_specified_value` and `simulated_random_number` -variables to verify that in all of the cases in the various `if` and `else` -blocks, `calculating slowly...` only shows up once and only when needed. The +variables to verify that in all the cases in the various `if` and `else` +blocks, `calculating slowly...` only appears once and only when needed. The `Cacher` takes care of the logic necessary to ensure we aren’t calling the -expensive calculation more than we need to, so that `generate_workout` can -focus on the business logic. +expensive calculation more than we need to, so `generate_workout` can focus on +the business logic. ### Limitations of the `Cacher` Implementation Caching values is a generally useful behavior that we might want to use in -other parts of our code with different closures. However, there are a few +other parts of our code with different closures. However, there are two problems with the current implementation of `Cacher` that would make reusing it in different contexts difficult. -The first problem is a `Cacher` instance assumes it will always get the same -value for the parameter `arg` to the `value` method. That is, this test of +The first problem is that a `Cacher` instance assumes it will always get the +same value for the parameter `arg` to the `value` method. That is, this test of `Cacher` will fail: ```rust,ignore @@ -654,38 +649,39 @@ passed into it. We call the `value` method on this `Cacher` instance with an `arg` value of 1 and then an `arg` value of 2, and we expect that the call to `value` with the `arg` value of 2 should return 2. -Run this with the `Cacher` implementation from Listing 13-9 and Listing 13-10 -and the test will fail on the `assert_eq!` with this message: +Run this test with the `Cacher` implementation in Listing 13-9 and Listing +13-10, and the test will fail on the `assert_eq!` with this message: ```text -thread 'call_with_different_arg_values' panicked at 'assertion failed: -`(left == right)` (left: `1`, right: `2`)', src/main.rs +thread 'call_with_different_values' panicked at 'assertion failed: `(left == right)` + left: `1`, + right: `2`', src/main.rs ``` The problem is that the first time we called `c.value` with 1, the `Cacher` -instance saved `Some(1)` in `self.value`. After that, no matter what we pass in +instance saved `Some(1)` in `self.value`. Thereafter, no matter what we pass in to the `value` method, it will always return 1. Try modifying `Cacher` to hold a hash map rather than a single value. The keys of the hash map will be the `arg` values that are passed in, and the values of the hash map will be the result of calling the closure on that key. Instead of looking at whether `self.value` directly has a `Some` or a `None` value, the -`value` function will look up the `arg` in the hash map and return the value, -if it’s present. If it’s not present, the `Cacher` will call the closure and -save the resulting value in the hash map associated with its `arg` value. +`value` function will look up the `arg` in the hash map and return the value if +it’s present. If it’s not present, the `Cacher` will call the closure and save +the resulting value in the hash map associated with its `arg` value. -Another problem with the current `Cacher` implementation is that it only -accepts closures that take one parameter of type `u32` and return an `u32`. We +The second problem with the current `Cacher` implementation is that it only +accepts closures that take one parameter of type `u32` and return a `u32`. We might want to cache the results of closures that take a string slice and return `usize` values, for example. To fix this issue, try introducing more generic parameters to increase the flexibility of the `Cacher` functionality. -### Closures Can Capture Their Environment +### Capturing the Environment with Closures In the workout generator example, we only used closures as inline anonymous -functions. Closures have an additional ability that functions don’t have, -however: they can capture their environment and access variables from the scope -in which they’re defined. +functions. However, closures have an additional capability that functions don’t +have: they can capture their environment and access variables from the scope in +which they’re defined. Listing 13-12 has an example of a closure stored in the variable `equal_to_x` that uses the variable `x` from the closure’s surrounding environment: @@ -711,7 +707,8 @@ Here, even though `x` is not one of the parameters of `equal_to_x`, the `equal_to_x` closure is allowed to use the `x` variable that’s defined in the same scope that `equal_to_x` is defined in. -We can’t do the same with functions; let’s see what happens if we try: +We can’t do the same with functions; if we try with the following example, our +code won’t compile: Filename: src/main.rs @@ -730,9 +727,9 @@ fn main() { We get an error: ```text -error[E0434]: can't capture dynamic environment in a fn item; use the || { ... } -closure form instead - --> +error[E0434]: can't capture dynamic environment in a fn item; use the || { ... +} closure form instead + --> src/main.rs | 4 | fn equal_to_x(z: i32) -> bool { z == x } | ^ @@ -742,7 +739,7 @@ The compiler even reminds us that this only works with closures! When a closure captures a value from its environment, it uses memory to store the values for use in the closure body. This use of memory is overhead that we -don’t want to pay in more common cases, where we want to execute code that +don’t want to pay in more common cases where we want to execute code that doesn’t capture its environment. Because functions are never allowed to capture their environment, defining and using functions will never incur this overhead. @@ -752,28 +749,29 @@ ownership, borrowing immutably, and borrowing mutably. These are encoded in the three `Fn` traits as follows: * `FnOnce` consumes the variables it captures from its enclosing scope, known - as the closure’s *environment*. In order to consume the captured variables, - the closure must take ownership of these variables and move them into the - closure when it is defined. The `Once` part of the name is because the + as the closure’s *environment*. To consume the captured variables, the + closure must take ownership of these variables and move them into the closure + when it is defined. The `Once` part of the name represents the fact that the closure can’t take ownership of the same variables more than once, so it can only be called one time. * `Fn` borrows values from the environment immutably. -* `FnMut` can change the environment since it mutably borrows values. +* `FnMut` can change the environment because it mutably borrows values. -When we create a closure, Rust infers which to use based on how the closure -uses the values from the environment. In Listing 13-12, the `equal_to_x` -closure borrows `x` immutably (so `equal_to_x` has the `Fn` trait) since the -body of the closure only needs to read the value in `x`. +When we create a closure, Rust infers which trait to use based on how the +closure uses the values from the environment. In Listing 13-12, the +`equal_to_x` closure borrows `x` immutably (so `equal_to_x` has the `Fn` trait) +because the body of the closure only needs to read the value in `x`. If we want to force the closure to take ownership of the values it uses in the -environment, we can use the `move` keyword before the parameter list. This is -mostly useful when passing a closure to a new thread in order to move the data -so that it’s owned by the new thread. +environment, we can use the `move` keyword before the parameter list. This +technique is mostly useful when passing a closure to a new thread to move the +data so it’s owned by the new thread. We’ll have more examples of `move` closures in Chapter 16 when we talk about -concurrency, but for now here’s the code from Listing 13-12 with the `move` +concurrency. For now, here’s the code from Listing 13-12 with the `move` keyword added to the closure definition and using vectors instead of integers, -since integers can be copied rather than moved: +because integers can be copied rather than moved; note that this code will not +yet compile: Filename: src/main.rs @@ -791,7 +789,7 @@ fn main() { } ``` -This example doesn’t compile: +We receive the following error: ```text error[E0382]: use of moved value: `x` @@ -804,7 +802,7 @@ error[E0382]: use of moved value: `x` | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not - implement the `Copy` trait + implement the `Copy` trait ``` The `x` value is moved into the closure when the closure is defined, because we diff --git a/src/doc/book/second-edition/src/ch13-02-iterators.md b/src/doc/book/second-edition/src/ch13-02-iterators.md index 4546bb7edc..71d5604460 100644 --- a/src/doc/book/second-edition/src/ch13-02-iterators.md +++ b/src/doc/book/second-edition/src/ch13-02-iterators.md @@ -19,16 +19,15 @@ let v1_iter = v1.iter(); Listing 13-13: Creating an iterator -Once we’ve created an iterator, we can choose to use it in a variety of ways. -In Listing 3-4 from Chapter 3, we actually used iterators with `for` loops to -execute some code on each item, though we glossed over what the call to `iter` -did until now. +Once we’ve created an iterator, we can use it in a variety of ways. In Listing +3-4 in Chapter 3, we used iterators with `for` loops to execute some code on +each item, although we glossed over what the call to `iter` did until now. The example in Listing 13-14 separates the creation of the iterator from the use of the iterator in the `for` loop. The iterator is stored in the `v1_iter` -variable, and no iteration takes place at that time. Once the `for` loop is -called using the iterator in `v1_iter`, then each element in the iterator is -used in one iteration of the loop, which prints out each value: +variable, and no iteration takes place at that time. When the `for` loop is +called using the iterator in `v1_iter`, each element in the iterator is used in +one iteration of the loop, which prints out each value: ```rust let v1 = vec![1, 2, 3]; @@ -49,14 +48,14 @@ using that variable to index into the vector to get a value, and incrementing the variable value in a loop until it gets to the total number of items in the vector. -Iterators take care of all of that logic for us, cutting down on repetitive -code we could potentially mess up. Iterators give us more flexibility to use -the same logic with many different kinds of sequences, not just data structures -we can index into like vectors. Let’s see how iterators do that. +Iterators handle all that logic for us, cutting down on repetitive code we +could potentially mess up. Iterators give us more flexibility to use the same +logic with many different kinds of sequences, not just data structures we can +index into, like vectors. Let’s examine how iterators do that. -### The `Iterator` trait and the `next` method +### The `Iterator` Trait and the `next` Method -Iterators all implement a trait named `Iterator` that is defined in the +All iterators implement a trait named `Iterator` that is defined in the standard library. The definition of the trait looks like this: ```rust @@ -69,12 +68,12 @@ trait Iterator { } ``` -You’ll notice some new syntax that we haven’t covered yet: `type Item` and +Notice some new syntax that we haven’t covered yet: `type Item` and `Self::Item`, which are defining an *associated type* with this trait. We’ll -talk about associated types in depth in Chapter 19, but for now, all you need -to know is that this code says implementing the `Iterator` trait requires that -you also define an `Item` type, and this `Item` type is used in the return type -of the `next` method. In other words, the `Item` type will be the type returned +talk about associated types in depth in Chapter 19. For now, all you need to +know is that this code says implementing the `Iterator` trait requires that you +also define an `Item` type, and this `Item` type is used in the return type of +the `next` method. In other words, the `Item` type will be the type returned from the iterator. The `Iterator` trait only requires implementors to define one method: the @@ -105,8 +104,8 @@ fn iterator_demonstration() { iterator Note that we needed to make `v1_iter` mutable: calling the `next` method on an -iterator changes state that keeps track of where it is in the sequence. Put -another way, this code *consumes*, or uses up, the iterator. Each call to +iterator changes state that keeps track of where it is in the sequence. In +other words, this code *consumes*, or uses up, the iterator. Each call to `next` eats up an item from the iterator. We didn’t need to make `v1_iter` mutable when we used a `for` loop because the loop took ownership of `v1_iter` and made it mutable behind the scenes. @@ -118,12 +117,12 @@ ownership of `v1` and returns owned values, we can call `into_iter` instead of `iter`. Similarly, if we want to iterate over mutable references, we can call `iter_mut` instead of `iter`. -### Methods in the `Iterator` Trait that Consume the Iterator +### Methods that Consume the Iterator The `Iterator` trait has a number of different methods with default -implementations provided for us by the standard library; you can find out all -about these methods by looking in the standard library API documentation for -the `Iterator` trait. Some of these methods call the `next` method in their +implementations provided for us by the standard library; you can find out about +these methods by looking in the standard library API documentation for the +`Iterator` trait. Some of these methods call the `next` method in their definition, which is why we’re required to implement the `next` method when implementing the `Iterator` trait. @@ -152,22 +151,21 @@ fn iterator_sum() { Listing 13-16: Calling the `sum` method to get the total of all items in the iterator -We aren’t allowed to use `v1_iter` after the call to `sum` since `sum` takes +We aren’t allowed to use `v1_iter` after the call to `sum` because `sum` takes ownership of the iterator we call it on. -### Methods in the `Iterator` Trait that Produce Other Iterators +### Methods that Produce Other Iterators Other methods defined on the `Iterator` trait, known as *iterator adaptors*, allow us to change iterators into different kind of iterators. We can chain multiple calls to iterator adaptors to perform complex actions in a readable -way. Because all iterators are lazy, however, we have to call one of the -consuming adaptor methods in order to get results from calls to iterator -adaptors. +way. But because all iterators are lazy, we have to call one of the consuming +adaptor methods to get results from calls to iterator adaptors. -Listing 13-17 shows an example of calling the iterator adaptor method `map` -which takes a closure to call on each item in order to produce a new iterator. -The closure here creates a new iterator in which each item from the vector has -been incremented by 1. This code produces a warning, though: +Listing 13-17 shows an example of calling the iterator adaptor method `map`, +which takes a closure to call on each item to produce a new iterator. The +closure here creates a new iterator in which each item from the vector has been +incremented by 1. However, this code produces a warning: Filename: src/main.rs @@ -177,29 +175,29 @@ let v1: Vec = vec![1, 2, 3]; v1.iter().map(|x| x + 1); ``` -Listing 13-17: Calling the iterator adapter `map` to +Listing 13-17: Calling the iterator adaptor `map` to create a new iterator The warning we get is: ```text -warning: unused result which must be used: iterator adaptors are lazy and do -nothing unless consumed - --> src/main.rs:4:1 +warning: unused `std::iter::Map` which must be used: iterator adaptors are lazy +and do nothing unless consumed + --> src/main.rs:4:5 | -4 | v1.iter().map(|x| x + 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +4 | v1.iter().map(|x| x + 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unused_must_use)] on by default ``` -The code in Listing 13-17 isn’t actually doing anything; the closure we’ve -specified never gets called. The warning reminds us why: iterator adaptors are -lazy, and we need to consume the iterator here. +The code in Listing 13-17 doesn’t do anything; the closure we’ve specified +never gets called. The warning reminds us why: iterator adaptors are lazy, and +we need to consume the iterator here. -To fix this and consume the iterator, we’re going to use the `collect` method, -which we saw briefly in Chapter 12. This method consumes the iterator and -collects the resulting values into a collection data type. +To fix this and consume the iterator, we’ll use the `collect` method, which you +saw briefly in Chapter 12. This method consumes the iterator and collects the +resulting values into a collection data type. In Listing 13-18, we collect the results of iterating over the iterator that’s returned from the call to `map` into a vector. This vector will end up @@ -216,7 +214,7 @@ assert_eq!(v2, vec![2, 3, 4]); ``` Listing 13-18: Calling the `map` method to create a new -iterator, then calling the `collect` method to consume the new iterator and +iterator, and then calling the `collect` method to consume the new iterator and create a vector Because `map` takes a closure, we can specify any operation we want to perform @@ -224,18 +222,18 @@ on each item. This is a great example of how closures let us customize some behavior while reusing the iteration behavior that the `Iterator` trait provides. -### Using Closures that Capture their Environment with Iterators +### Using Closures that Capture Their Environment Now that we’ve introduced iterators, we can demonstrate a common use of -closures that capture their environment by using the `filter` iterator adapter. +closures that capture their environment by using the `filter` iterator adaptor. The `filter` method on an iterator takes a closure that takes each item from -the iterator and returns a boolean. If the closure returns `true`, the value +the iterator and returns a Boolean. If the closure returns `true`, the value will be included in the iterator produced by `filter`. If the closure returns `false`, the value won’t be included in the resulting iterator. In Listing 13-19 we use `filter` with a closure that captures the `shoe_size` -variable from its environment, in order to iterate over a collection of `Shoe` -struct instances. It will return only shoes that are the specified size: +variable from its environment to iterate over a collection of `Shoe` struct +instances. It will return only shoes that are the specified size: Filename: src/lib.rs @@ -292,7 +290,7 @@ adapted iterator into a vector that’s returned by the function. The test shows that when we call `shoes_in_my_size`, we only get back shoes that have the same size as the value we specified. -### Implementing the `Iterator` Trait to Create Our Own Iterators +### Creating Our Own Iterators with `Iterator` We’ve shown that we can create an iterator by calling `iter`, `into_iter`, or `iter_mut` on a vector. We can create iterators from the other collection types @@ -328,15 +326,15 @@ impl Counter { function that creates instances of `Counter` with an initial value of 0 for `count` -The `Counter` struct has one field named `count`. This holds a `u32` value that -will keep track of where we are in the process of iterating from 1 to 5. The -`count` field is private since we want the implementation of `Counter` to -manage its value. The `new` function enforces the behavior of always starting -new instances with a value of 0 in the `count` field. +The `Counter` struct has one field named `count`. This field holds a `u32` +value that will keep track of where we are in the process of iterating from 1 +to 5. The `count` field is private because we want the implementation of +`Counter` to manage its value. The `new` function enforces the behavior of +always starting new instances with a value of 0 in the `count` field. -Next, we’re going to implement the `Iterator` trait for our `Counter` type by -defining the body of the `next` method, to specify what we want to happen when -this iterator is used, as shown in Listing 13-21: +Next, we’ll implement the `Iterator` trait for our `Counter` type by defining +the body of the `next` method to specify what we want to happen when this +iterator is used, as shown in Listing 13-21: Filename: src/lib.rs @@ -365,12 +363,12 @@ impl Iterator for Counter { We set the associated `Item` type for our iterator to `u32`, meaning the iterator will return `u32` values. Again, don’t worry about associated types -yet, we’ll be covering them in Chapter 19. +yet, we’ll cover them in Chapter 19. We want our iterator to add one to the current state, so we initialized `count` -to 0 so it would return one first. If the value of `count` is less than six, -`next` will return the current value wrapped in `Some`, but if `count` is six -or higher, our iterator will return `None`. +to 0 so it would return 1 first. If the value of `count` is less than 6, `next` +will return the current value wrapped in `Some`, but if `count` is 6 or higher, +our iterator will return `None`. #### Using Our `Counter` Iterator’s `next` Method @@ -420,17 +418,17 @@ This test creates a new `Counter` instance in the `counter` variable and then calls `next` repeatedly, verifying that we have implemented the behavior we want this iterator to have: returning the values from 1 to 5. -#### Using Other `Iterator` Trait Methods on Our Iterator +#### Using Other `Iterator` Trait Methods Because we implemented the `Iterator` trait by defining the `next` method, we can now use any `Iterator` trait method’s default implementations as defined in -the standard library, since they all use the `next` method’s functionality. +the standard library, because they all use the `next` method’s functionality. For example, if for some reason we wanted to take the values produced by an instance of `Counter`, pair them with values produced by another `Counter` instance after skipping the first value, multiply each pair together, keep only those results that are divisible by three, and add all the resulting values -together, we could do so as shown in the test in Listing 13-23: +together, we could do so, as shown in the test in Listing 13-23: Filename: src/lib.rs diff --git a/src/doc/book/second-edition/src/ch13-03-improving-our-io-project.md b/src/doc/book/second-edition/src/ch13-03-improving-our-io-project.md index 91d42fdafd..3ce4660622 100644 --- a/src/doc/book/second-edition/src/ch13-03-improving-our-io-project.md +++ b/src/doc/book/second-edition/src/ch13-03-improving-our-io-project.md @@ -1,17 +1,18 @@ -## Improving our I/O Project +## Improving Our I/O Project + +With this new knowledge about iterators, we can improve the I/O project in +Chapter 12 by using iterators to make places in the code clearer and more +concise. Let’s look at how iterators can improve our implementation of the +`Config::new` function and the `search` function. -With this new knowledge, we can improve the I/O project in Chapter 12 by using -iterators to make places in the code clearer and more concise. Let’s take a -look at how iterators can improve our implementation of both the `Config::new` -function and the `search` function. ### Removing a `clone` Using an Iterator In Listing 12-6, we added code that took a slice of `String` values and created an instance of the `Config` struct by indexing into the slice and cloning the -values, allowing the `Config` struct to own those values. We’ve reproduced the -implementation of the `Config::new` function as it was at the end of Chapter 12 -in Listing 13-24: +values, allowing the `Config` struct to own those values. In Listing 13-24, +we’ve reproduced the implementation of the `Config::new` function as it was in +Listing 12-23 at the end of Chapter 12: Filename: src/lib.rs @@ -35,30 +36,27 @@ impl Config { Listing 13-24: Reproduction of the `Config::new` function from the end of Chapter 12 -At the time, we said not to worry about the inefficient `clone` calls here -because we would remove them in the future. Well, that time is now! +At the time, we said not to worry about the inefficient `clone` calls because +we would remove them in the future. Well, that time is now! We needed `clone` here because we have a slice with `String` elements in the -parameter `args`, but the `new` function doesn’t own `args`. In order to be -able to return ownership of a `Config` instance, we had to clone the values -from the `query` and `filename` fields of `Config`, so that the `Config` -instance can own its values. +parameter `args`, but the `new` function doesn’t own `args`. To return +ownership of a `Config` instance, we had to clone the values from the `query` +and `filename` fields of `Config` so the `Config` instance can own its values. With our new knowledge about iterators, we can change the `new` function to take ownership of an iterator as its argument instead of borrowing a slice. We’ll use the iterator functionality instead of the code that checks the length -of the slice and indexes into specific locations. This will clear up what the -`Config::new` function is doing since the iterator will take care of accessing -the values. +of the slice and indexes into specific locations. This will clarify what the +`Config::new` function is doing because the iterator will access the values. Once `Config::new` takes ownership of the iterator and stops using indexing operations that borrow, we can move the `String` values from the iterator into `Config` rather than calling `clone` and making a new allocation. -#### Using the Iterator Returned by `env::args` Directly +#### Using the Returned Iterator Directly -Open your I/O project’s *src/main.rs*, and we’ll change the start of the `main` -function that we had at the end of Chapter 12: +Open your I/O project’s *src/main.rs* file, which should look like this: Filename: src/main.rs @@ -71,11 +69,13 @@ fn main() { process::exit(1); }); - // ...snip... + // --snip-- } ``` -To the code in Listing 13-25: +We’ll change the start of the `main` function that we had in Listing 12-24 at +the end of Chapter 12 to the code in Listing 13-25. This won’t compile yet +until we update `Config::new` as well: Filename: src/main.rs @@ -86,7 +86,7 @@ fn main() { process::exit(1); }); - // ...snip... + // --snip-- } ``` @@ -99,15 +99,16 @@ we’re passing ownership of the iterator returned from `env::args` to `Config::new` directly. Next, we need to update the definition of `Config::new`. In your I/O project’s -*src/lib.rs*, let’s change the signature of `Config::new` to look like Listing -13-26: +*src/lib.rs* file, let’s change the signature of `Config::new` to look like +Listing 13-26. This still won’t compile yet because we need to update the +function body: Filename: src/lib.rs ```rust,ignore impl Config { pub fn new(mut args: std::env::Args) -> Result { - // ...snip... + // --snip-- ``` Listing 13-26: Updating the signature of `Config::new` to @@ -115,17 +116,16 @@ expect an iterator The standard library documentation for the `env::args` function shows that the type of the iterator it returns is `std::env::Args`. We’ve updated the -signature of the `Config::new` function so that the parameter `args` has the -type `std::env::Args` instead of `&[String]`. Because we’re taking ownership of -`args`, and we’re going to be mutating `args` by iterating over it, we can add -the `mut` keyword into the specification of the `args` parameter to make it -mutable. +signature of the `Config::new` function so the parameter `args` has the type +`std::env::Args` instead of `&[String]`. Because we’re taking ownership of +`args` and we’ll be mutating `args` by iterating over it, we can add the `mut` +keyword into the specification of the `args` parameter to make it mutable. #### Using `Iterator` Trait Methods Instead of Indexing Next, we’ll fix the body of `Config::new`. The standard library documentation also mentions that `std::env::Args` implements the `Iterator` trait, so we know -we can call the `next` method on it! Listing 13-27 has updated the code from +we can call the `next` method on it! Listing 13-27 updates the code from Listing 12-23 to use the `next` method: Filename: src/lib.rs @@ -173,9 +173,9 @@ the same thing for the `filename` value. ### Making Code Clearer with Iterator Adaptors -The other place in our I/O project we could take advantage of iterators is in -the `search` function, reproduced here in Listing 13-28 as it was at the end of -Chapter 12: +We can also take advantage of iterators in the `search` function in our I/O +project, which is reproduced here in Listing 13-28 as it was in Listing 12-19 +at the end of Chapter 12: Filename: src/lib.rs @@ -196,13 +196,13 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { Listing 13-28: The implementation of the `search` function from Chapter 12 -We can write this code in a much more concise way using iterator adaptor -methods. This also lets us avoid having a mutable intermediate `results` -vector. The functional programming style prefers to minimize the amount of -mutable state to make code clearer. Removing the mutable state might make it -easier for us to make a future enhancement to make searching happen in -parallel, since we wouldn’t have to manage concurrent access to the `results` -vector. Listing 13-29 shows this change: +We can write this code in a more concise way using iterator adaptor methods. +Doing so also lets us avoid having a mutable intermediate `results` vector. The +functional programming style prefers to minimize the amount of mutable state to +make code clearer. Removing the mutable state might make it easier for us to +make a future enhancement to make searching happen in parallel, because we +wouldn’t have to manage concurrent access to the `results` vector. Listing +13-29 shows this change: Filename: src/lib.rs @@ -220,21 +220,21 @@ implementation of the `search` function Recall that the purpose of the `search` function is to return all lines in `contents` that contain the `query`. Similar to the `filter` example in Listing 13-19, we can use the `filter` adaptor to keep only the lines that -`line.contains(query)` returns true for. We then collect the matching lines up +`line.contains(query)` returns true for. We then collect the matching lines into another vector with `collect`. Much simpler! Feel free to make the same change to use iterator methods in the `search_case_insensitive` function as well. The next logical question is which style you should choose in your own code and -why: the original implementation in Listing 13-28, or the version using +why: the original implementation in Listing 13-28 or the version using iterators in Listing 13-29. Most Rust programmers prefer to use the iterator style. It’s a bit tougher to get the hang of at first, but once you get a feel for the various iterator adaptors and what they do, iterators can be easier to understand. Instead of fiddling with the various bits of looping and building new vectors, the code focuses on the high-level objective of the loop. This -abstracts away some of the commonplace code so that it’s easier to see the -concepts that are unique to this code, like the filtering condition each -element in the iterator must pass. +abstracts away some of the commonplace code so it’s easier to see the concepts +that are unique to this code, such as the filtering condition each element in +the iterator must pass. But are the two implementations truly equivalent? The intuitive assumption might be that the more low-level loop will be faster. Let’s talk about diff --git a/src/doc/book/second-edition/src/ch13-04-performance.md b/src/doc/book/second-edition/src/ch13-04-performance.md index c7a1efe01e..5c9f6a192b 100644 --- a/src/doc/book/second-edition/src/ch13-04-performance.md +++ b/src/doc/book/second-edition/src/ch13-04-performance.md @@ -1,12 +1,12 @@ -## Comparing Performance: Loops versus Iterators +## Comparing Performance: Loops vs. Iterators -To determine which to use, we need to know which version of our `search` -functions is faster: the version with an explicit `for` loop or the version -with iterators. +To determine whether to use loops or iterators, we need to know which version +of our `search` functions is faster: the version with an explicit `for` loop or +the version with iterators. -We ran a benchmark by loading the entire contents of “The Adventures of -Sherlock Holmes” by Sir Arthur Conan Doyle into a `String` and looking for the -word “the” in the contents. Here were the results of the benchmark on the +We ran a benchmark by loading the entire contents of *The Adventures of +Sherlock Holmes* by Sir Arthur Conan Doyle into a `String` and looking for the +word “the” in the contents. Here are the results of the benchmark on the version of `search` using the `for` loop and the version using iterators: ```text @@ -14,17 +14,17 @@ test bench_search_for ... bench: 19,620,300 ns/iter (+/- 915,700) test bench_search_iter ... bench: 19,234,900 ns/iter (+/- 657,200) ``` -The iterator version ended up slightly faster! We’re not going to go through -the benchmark code here, as the point is not to prove that they’re exactly -equivalent, but to get a general sense of how these two implementations compare +The iterator version was slightly faster! We won’t explain the benchmark code +here, because the point is not to prove that the two versions are equivalent +but to get a general sense of how these two implementations compare performance-wise. -For a more comprehensive benchmark, you’d want to check various texts of -various sizes, different words, words of different lengths, and all kinds of -other variations. The point is this: iterators, while a high-level abstraction, +For a more comprehensive benchmark, you should check various texts of various +sizes, different words, words of different lengths, and all kinds of other +variations. The point is this: iterators, although a high-level abstraction, get compiled down to roughly the same code as if you’d written the lower-level code yourself. Iterators are one of Rust’s *zero-cost* *abstractions*, by which -we mean using the abstraction imposes no additional runtime overhead, in the +we mean using the abstraction imposes no additional runtime overhead in the same way that Bjarne Stroustrup, the original designer and implementor of C++, defines *zero-overhead*: @@ -32,16 +32,15 @@ defines *zero-overhead*: > don’t use, you don’t pay for. And further: What you do use, you couldn’t hand > code any better. > -> - Bjarne Stroustrup “Foundations of C++” +> Bjarne Stroustrup’s “Foundations of C++” -As another example, here is some code taken from an audio decoder. The decoding -algorithm uses the linear prediction mathematical operation to estimate future -values based on a linear function of the previous samples. - -This code uses an iterator chain to do some math on three variables in scope: a +As another example, the following code is taken from an audio decoder. The +decoding algorithm uses the linear prediction mathematical operation to +estimate future values based on a linear function of the previous samples. This +code uses an iterator chain to do some math on three variables in scope: a `buffer` slice of data, an array of 12 `coefficients`, and an amount by which to shift data in `qlp_shift`. We’ve declared the variables within this example -but not given them any values; while this code doesn’t have much meaning +but not given them any values; although this code doesn’t have much meaning outside of its context, it’s still a concise, real-world example of how Rust translates high-level ideas to low-level code: @@ -60,39 +59,37 @@ for i in 12..buffer.len() { } ``` -In order to calculate the value of `prediction`, this code iterates through -each of the 12 values in `coefficients` and uses the `zip` method to pair the -coefficient values with the previous 12 values in `buffer`. Then, for each -pair, we multiply the values together, sum all the results, and shift the bits -in the sum `qlp_shift` bits to the right. +To calculate the value of `prediction`, this code iterates through each of the +12 values in `coefficients` and uses the `zip` method to pair the coefficient +values with the previous 12 values in `buffer`. Then, for each pair, we +multiply the values together, sum all the results, and shift the bits in the +sum `qlp_shift` bits to the right. Calculations in applications like audio decoders often prioritize performance -most highly. Here, we’re creating an iterator, using two adaptors, then +most highly. Here, we’re creating an iterator, using two adaptors, and then consuming the value. What assembly code would this Rust code compile to? Well, as of this writing, it compiles down to the same assembly you’d write by hand. There’s no loop at all corresponding to the iteration over the values in -`coefficients`: Rust knows that there are twelve iterations, so it “unrolls” -the loop. *Unrolling* is an optimization that removes the overhead of the loop +`coefficients`: Rust knows that there are 12 iterations, so it “unrolls” the +loop. *Unrolling* is an optimization that removes the overhead of the loop controlling code and instead generates repetitive code for each iteration of the loop. All of the coefficients get stored in registers, which means it’s very fast to access the values. There are no bounds checks on the array access at runtime. All these optimizations Rust is able to apply make the resulting code extremely -efficient. - -Now that you know this, go use iterators and closures without fear! They make -code feel higher-level, but don’t impose a runtime performance penalty for -doing so. +efficient. Now that you know this, you can use iterators and closures without +fear! They make code seem like it’s higher level but don’t impose a runtime +performance penalty for doing so. ## Summary Closures and iterators are Rust features inspired by functional programming -language ideas. They contribute to Rust’s ability to clearly express high-level -ideas, at low level performance. The implementations of closures and iterators -are such that runtime performance is not affected. This is part of Rust’s goal -to strive to provide zero-cost abstractions. +language ideas. They contribute to Rust’s capability to clearly express +high-level ideas at low-level performance. The implementations of closures and +iterators are such that runtime performance is not affected. This is part of +Rust’s goal to strive to provide zero-cost abstractions. Now that we’ve improved the expressiveness of our I/O project, let’s look at -some more features of `cargo` that would help us get ready to share the project -with the world. +some more features of `cargo` that will help us share the project with the +world. diff --git a/src/doc/book/second-edition/src/ch14-02-publishing-to-crates-io.md b/src/doc/book/second-edition/src/ch14-02-publishing-to-crates-io.md index b67c086ebb..6d8490edb9 100644 --- a/src/doc/book/second-edition/src/ch14-02-publishing-to-crates-io.md +++ b/src/doc/book/second-edition/src/ch14-02-publishing-to-crates-io.md @@ -130,7 +130,7 @@ as shown in Listing 14-3: //! calculations more convenient. /// Adds one to the number given. -// ...snip... +// --snip-- ``` Listing 14-3: Documentation for the `my_crate` crate as a @@ -214,7 +214,7 @@ pub mod utils { /// Combines two primary colors in equal amounts to create /// a secondary color. pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor { - // ...snip... + // --snip-- } } ``` @@ -283,11 +283,11 @@ pub use kinds::SecondaryColor; pub use utils::mix; pub mod kinds { - // ...snip... + // --snip-- } pub mod utils { - // ...snip... + // --snip-- } ``` @@ -316,7 +316,7 @@ use art::PrimaryColor; use art::mix; fn main() { - // ...snip... + // --snip-- } ``` @@ -382,7 +382,7 @@ $ cargo publish Updating registry `https://github.com/rust-lang/crates.io-index` warning: manifest has no description, license, license-file, documentation, homepage or repository. -...snip... +--snip-- error: api errors: missing or empty metadata fields: description, license. ``` diff --git a/src/doc/book/second-edition/src/ch14-03-cargo-workspaces.md b/src/doc/book/second-edition/src/ch14-03-cargo-workspaces.md index 9fbe4283d6..d1f63f5a60 100644 --- a/src/doc/book/second-edition/src/ch14-03-cargo-workspaces.md +++ b/src/doc/book/second-edition/src/ch14-03-cargo-workspaces.md @@ -172,7 +172,7 @@ and compile the `rand` crate: $ cargo build Updating registry `https://github.com/rust-lang/crates.io-index` Downloading rand v0.3.14 - ...snip... + --snip-- Compiling rand v0.3.14 Compiling add-one v0.1.0 (file:///projects/adder/add-one) Compiling adder v0.1.0 (file:///projects/adder) diff --git a/src/doc/book/second-edition/src/ch14-04-installing-binaries.md b/src/doc/book/second-edition/src/ch14-04-installing-binaries.md index c6869f4537..292766b332 100644 --- a/src/doc/book/second-edition/src/ch14-04-installing-binaries.md +++ b/src/doc/book/second-edition/src/ch14-04-installing-binaries.md @@ -23,7 +23,7 @@ the `grep` tool for searching files called `ripgrep`. If we want to install $ cargo install ripgrep Updating registry `https://github.com/rust-lang/crates.io-index` Downloading ripgrep v0.3.2 - ...snip... + --snip-- Compiling ripgrep v0.3.2 Finished release [optimized + debuginfo] target(s) in 97.91 secs Installing ~/.cargo/bin/rg diff --git a/src/doc/book/second-edition/src/ch15-01-box.md b/src/doc/book/second-edition/src/ch15-01-box.md index f49e1602a1..4b374239d8 100644 --- a/src/doc/book/second-edition/src/ch15-01-box.md +++ b/src/doc/book/second-edition/src/ch15-01-box.md @@ -202,7 +202,7 @@ error[E0072]: recursive type `List` has infinite size 1 | enum List { | ^^^^^^^^^ recursive type has infinite size 2 | Cons(i32, List), - | --------------- recursive without indirection + | ----- recursive without indirection | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `List` representable @@ -340,7 +340,7 @@ The `Box` type is a smart pointer because it implements the `Deref` trait, which allows `Box` values to be treated like references. When a `Box` value goes out of scope, the heap data that the box is pointing to is cleaned up as well because of the `Box` type’s `Drop` trait implementation. Let’s -explore these two types in more detail; these traits are going to be even more +explore these two traits in more detail; these traits are going to be even more important to the functionality provided by the other smart pointer types we’ll be discussing in the rest of this chapter. diff --git a/src/doc/book/second-edition/src/ch15-02-deref.md b/src/doc/book/second-edition/src/ch15-02-deref.md index 1f1ff387c2..914cfa99d3 100644 --- a/src/doc/book/second-edition/src/ch15-02-deref.md +++ b/src/doc/book/second-edition/src/ch15-02-deref.md @@ -81,10 +81,10 @@ error: ```text error[E0277]: the trait bound `{integer}: std::cmp::PartialEq<&{integer}>` is not satisfied - --> :5:19 + --> src/main.rs:6:5 | -5 | if ! ( * left_val == * right_val ) { - | ^^ can't compare `{integer}` with `&{integer}` +6 | assert_eq!(5, y); + | ^^^^^^^^^^^^^^^^^ can't compare `{integer}` with `&{integer}` | = help: the trait `std::cmp::PartialEq<&{integer}>` is not implemented for `{integer}` diff --git a/src/doc/book/second-edition/src/ch15-03-drop.md b/src/doc/book/second-edition/src/ch15-03-drop.md index 6626e20ff8..556579c1c5 100644 --- a/src/doc/book/second-edition/src/ch15-03-drop.md +++ b/src/doc/book/second-edition/src/ch15-03-drop.md @@ -35,7 +35,7 @@ for clean up? --> this code gets run. It's hard to experience the cleaning up unless we print something. /Carol --> -Listing 15-8 shows a `CustomSmartPointer` struct whose only custom +Listing 15-16 shows a `CustomSmartPointer` struct whose only custom functionality is that it will print out `Dropping CustomSmartPointer!` when the instance goes out of scope. This will demonstrate when Rust runs the `drop` function: @@ -69,7 +69,7 @@ fn main() { } ``` -Listing 15-8: A `CustomSmartPointer` struct that +Listing 15-16: A `CustomSmartPointer` struct that implements the `Drop` trait, where we would put our clean up code. The `Drop` trait is included in the prelude, so we don’t need to import it. We @@ -122,7 +122,7 @@ up a value early. One example is when using smart pointers that manage locks; you may want to force the `drop` method that releases the lock to run so that other code in the same scope can acquire the lock. First, let’s see what happens if we try to call the `Drop` trait’s `drop` method ourselves by -modifying the `main` function from Listing 15-8 as shown in Listing 15-9: +modifying the `main` function from Listing 15-16 as shown in Listing 15-17: -The `Dropping CustomSmartPointer!` is printed between `CustomSmartPointer +The ```Dropping CustomSmartPointer with data `some data`!``` is printed between `CustomSmartPointer created.` and `CustomSmartPointer dropped before the end of main.`, showing that the `drop` method code is called to drop `c` at that point. diff --git a/src/doc/book/second-edition/src/ch15-04-rc.md b/src/doc/book/second-edition/src/ch15-04-rc.md index 774cb05d46..4fe4807e8d 100644 --- a/src/doc/book/second-edition/src/ch15-04-rc.md +++ b/src/doc/book/second-edition/src/ch15-04-rc.md @@ -36,11 +36,11 @@ concurrency will cover how to do reference counting in multithreaded programs. Let’s return to our cons list example from Listing 15-6, as we defined it using `Box`. This time, we want to create two lists that both share ownership of a -third list, which conceptually will look something like Figure 15-11: +third list, which conceptually will look something like Figure 15-19: Two lists that share ownership of a third list -Figure 15-11: Two lists, `b` and `c`, sharing ownership +Figure 15-19: Two lists, `b` and `c`, sharing ownership of a third list, `a` We’ll create list `a` that contains 5 and then 10, then make two more lists: @@ -49,7 +49,7 @@ then continue on to the first `a` list containing 5 and 10. In other words, both lists will try to share the first list containing 5 and 10. Trying to implement this using our definition of `List` with `Box` won’t -work, as shown in Listing 15-12: +work, as shown in Listing 15-20: Filename: src/main.rs @@ -70,7 +70,7 @@ fn main() { } ``` -Listing 15-12: Demonstrating we’re not allowed to have +Listing 15-20: Demonstrating we’re not allowed to have two lists using `Box` that try to share ownership of a third list If we compile this, we get this error: @@ -100,7 +100,7 @@ the list itself. The borrow checker wouldn’t let us compile `let a = Cons(10, `a` could take a reference to it. Instead, we’ll change our definition of `List` to use `Rc` in place of -`Box` as shown here in Listing 15-13. Each `Cons` variant now holds a value +`Box` as shown here in Listing 15-21. Each `Cons` variant now holds a value and an `Rc` pointing to a `List`. When we create `b`, instead of taking ownership of `a`, we clone the `Rc` that `a` is holding, which increases the number of references from 1 to 2 and lets `a` and `b` share ownership of the @@ -133,7 +133,7 @@ fn main() { } ``` -Listing 15-13: A definition of `List` that uses +Listing 15-21: A definition of `List` that uses `Rc` We need to add a `use` statement to bring `Rc` into scope because it’s not in @@ -154,7 +154,7 @@ memory. ### Cloning an `Rc` Increases the Reference Count -Let’s change our working example from Listing 15-13 so that we can see the +Let’s change our working example from Listing 15-21 so that we can see the reference counts changing as we create and drop references to the `Rc` in `a`. -In Listing 15-14, we’ll change `main` so that it has an inner scope around list +In Listing 15-22, we’ll change `main` so that it has an inner scope around list `c`, so that we can see how the reference count changes when `c` goes out of scope. At each point in the program where the reference count changes, we’ll print out the reference count, which we can get by calling the @@ -202,7 +202,7 @@ fn main() { } ``` -Listing 15-14: Printing out the reference count +Listing 15-22: Printing out the reference count This will print out: @@ -232,7 +232,7 @@ of the owners still exist. `Rc` allows us to share data between multiple parts of our program for reading only, via immutable references. If `Rc` allowed us to have multiple -mutable references too, we’d be able to violate one of the the borrowing rules +mutable references too, we’d be able to violate one of the borrowing rules that we discussed in Chapter 4: multiple mutable borrows to the same place can cause data races and inconsistencies. But being able to mutate data is very useful! In the next section, we’ll discuss the interior mutability pattern and diff --git a/src/doc/book/second-edition/src/ch15-05-interior-mutability.md b/src/doc/book/second-edition/src/ch15-05-interior-mutability.md index 6758ae12a1..053dc2ec07 100644 --- a/src/doc/book/second-edition/src/ch15-05-interior-mutability.md +++ b/src/doc/book/second-edition/src/ch15-05-interior-mutability.md @@ -156,7 +156,7 @@ mechanism for sending the messages: the application could choose to put a message in the application, send an email, send a text message, or something else. Our library doesn’t need to know about that detail; all it needs is something that implements a trait we’ll provide called `Messenger`. Listing -15-15 shows our library code: +15-23 shows our library code: Filename: src/lib.rs @@ -197,7 +197,7 @@ impl<'a, T> LimitTracker<'a, T> } ``` -Listing 15-15: A library to keep track of how close to a +Listing 15-23: A library to keep track of how close to a maximum value a value is, and warn when the value is at certain levels One important part of this code is that the `Messenger` trait has one method, @@ -216,7 +216,7 @@ text message when we call `send`, will only keep track of the messages it’s told to send. We can create a new instance of the mock object, create a `LimitTracker` that uses the mock object, call the `set_value` method on `LimitTracker`, then check that the mock object has the messages we expect. -Listing 15-16 shows an attempt of implementing a mock object to do just that, +Listing 15-24 shows an attempt of implementing a mock object to do just that, but that the borrow checker won’t allow: Filename: src/lib.rs @@ -254,7 +254,7 @@ mod tests { } ``` -Listing 15-16: An attempt to implement a `MockMessenger` +Listing 15-24: An attempt to implement a `MockMessenger` that isn’t allowed by the borrow checker This test code defines a `MockMessenger` struct that has a `sent_messages` @@ -295,7 +295,7 @@ definition (feel free to try and see what error message you get). This is where interior mutability can help! We’re going to store the `sent_messages` within a `RefCell`, and then the `send` message will be able to -modify `sent_messages` to store the messages we’ve seen. Listing 15-17 shows +modify `sent_messages` to store the messages we’ve seen. Listing 15-25 shows what that looks like: Filename: src/lib.rs @@ -324,7 +324,7 @@ mod tests { #[test] fn it_sends_an_over_75_percent_warning_message() { - // ...snip... + // --snip-- # let mock_messenger = MockMessenger::new(); # let mut limit_tracker = LimitTracker::new(&mock_messenger, 100); # limit_tracker.set_value(75); @@ -334,7 +334,7 @@ mod tests { } ``` -Listing 15-17: Using `RefCell` to be able to mutate an +Listing 15-25: Using `RefCell` to be able to mutate an inner value while the outer value is considered immutable The `sent_messages` field is now of type `RefCell>` instead of @@ -376,8 +376,8 @@ mutable borrow at any point in time. If we try to violate these rules, rather than getting a compiler error like we would with references, the implementation of `RefCell` will `panic!` at -runtime. Listing 15-18 shows a modification to the implementation of `send` -from Listing 15-17 where we’re deliberately trying to create two mutable +runtime. Listing 15-26 shows a modification to the implementation of `send` +from Listing 15-25 where we’re deliberately trying to create two mutable borrows active for the same scope in order to illustrate that `RefCell` prevents us from doing this at runtime: @@ -395,7 +395,7 @@ impl Messenger for MockMessenger { } ``` -Listing 15-18: Creating two mutable references in the +Listing 15-26: Creating two mutable references in the same scope to see that `RefCell` will panic We create a variable `one_borrow` for the `RefMut` smart pointer returned from @@ -439,7 +439,7 @@ For example, recall the cons list example from Listing 15-13 where we used `Rc` to let us have multiple lists share ownership of another list. Because `Rc` only holds immutable values, we aren’t able to change any of the values in the list once we’ve created them. Let’s add in `RefCell` to get the -ability to change the values in the lists. Listing 15-19 shows that by using a +ability to change the values in the lists. Listing 15-27 shows that by using a `RefCell` in the `Cons` definition, we’re allowed to modify the value stored in all the lists: @@ -472,7 +472,7 @@ fn main() { } ``` -Listing 15-19: Using `Rc>` to create a +Listing 15-27: Using `Rc>` to create a `List` that we can mutate We create a value that’s an instance of `Rc` and store it in a diff --git a/src/doc/book/second-edition/src/ch15-06-reference-cycles.md b/src/doc/book/second-edition/src/ch15-06-reference-cycles.md index de183aef0d..fc5b4f5365 100644 --- a/src/doc/book/second-edition/src/ch15-06-reference-cycles.md +++ b/src/doc/book/second-edition/src/ch15-06-reference-cycles.md @@ -13,7 +13,7 @@ never reach 0, and the values will never be dropped. Let’s take a look at how a reference cycle might happen and how to prevent it, starting with the definition of the `List` enum and a `tail` method in Listing -15-20: +15-28: Filename: src/main.rs @@ -38,7 +38,7 @@ impl List { } ``` -Listing 15-20: A cons list definition that holds a +Listing 15-28: A cons list definition that holds a `RefCell` so that we can modify what a `Cons` variant is referring to We’re using another variation of the `List` definition from Listing 15-6. The @@ -58,8 +58,8 @@ uses the definitions. We just broke these apart to avoid having a lot of code and then a lot of explanation, I'd be fine having this be one big listing if you think that would be better /Carol --> -In listing 15-21, we’re adding a `main` function that uses the definitions from -Listing 15-20. This code creates a list in `a`, a list in `b` that points to +In listing 15-29, we’re adding a `main` function that uses the definitions from +Listing 15-28. This code creates a list in `a`, a list in `b` that points to the list in `a`, and then modifies the list in `a` to point to `b`, which creates a reference cycle. There are `println!` statements along the way to show what the reference counts are at various points in this process. @@ -114,7 +114,7 @@ fn main() { } ``` -Listing 15-21: Creating a reference cycle of two `List` +Listing 15-29: Creating a reference cycle of two `List` values pointing to each other We create an `Rc` instance holding a `List` value in the variable `a` with an @@ -160,11 +160,11 @@ However, because `a` is still referencing the `Rc` that was in `b`, that `Rc` has a count of 1 rather than 0, so the memory the `Rc` has on the heap won’t be dropped. The memory will just sit there with a count of one, forever. -To visualize this, we’ve created a reference cycle that looks like Figure 15-22: +To visualize this, we’ve created a reference cycle that looks like Figure 15-30: Reference cycle of lists -Figure 15-22: A reference cycle of lists `a` and `b` +Figure 15-30: A reference cycle of lists `a` and `b` pointing to each other If you uncomment the last `println!` and run the program, Rust will try and @@ -208,7 +208,7 @@ Another solution is reorganizing your data structures so that some references express ownership and some references don’t. In this way, we can have cycles made up of some ownership relationships and some non-ownership relationships, and only the ownership relationships affect whether a value may be dropped or -not. In Listing 15-20, we always want `Cons` variants to own their list, so +not. In Listing 15-28, we always want `Cons` variants to own their list, so reorganizing the data structure isn’t possible. Let’s look at an example using graphs made up of parent nodes and child nodes to see when non-ownership relationships are an appropriate way to prevent reference cycles. @@ -284,7 +284,7 @@ a `RefCell` in `children` around the `Vec`. Next, let’s use our struct definition and create one `Node` instance named `leaf` with the value 3 and no children, and another instance named `branch` -with the value 5 and `leaf` as one of its children, as shown in Listing 15-23: +with the value 5 and `leaf` as one of its children, as shown in Listing 15-31: Filename: src/main.rs @@ -311,7 +311,7 @@ fn main() { } ``` -Listing 15-23: Creating a `leaf` node with no children +Listing 15-31: Creating a `leaf` node with no children and a `branch` node with `leaf` as one of its children We clone the `Rc` in `leaf` and store that in `branch`, meaning the `Node` in @@ -365,7 +365,7 @@ you think? It seems repetitive to explain this every time. /Carol --> This way, a node will be able to refer to its parent node, but does not own its -parent. In Listing 15-24, let’s update `main` to use this new definition so +parent. In Listing 15-32, let’s update `main` to use this new definition so that the `leaf` node will have a way to refer to its parent, `branch`: Creating the `leaf` node looks similar to how creating the `leaf` node looked -in Listing 15-23, with the exception of the `parent` field: `leaf` starts out +in Listing 15-31, with the exception of the `parent` field: `leaf` starts out without a parent, so we create a new, empty `Weak` reference instance. At this point, when we try to get a reference to the parent of `leaf` by using @@ -444,7 +444,7 @@ parent? --> When we print out the parent of `leaf` again, this time we’ll get a `Some` variant holding `branch`: `leaf` can now access its parent! When we print out `leaf`, we also avoid the cycle that eventually ended in a stack overflow like -we had in Listing 15-21: the `Weak` references are printed as `(Weak)`: +we had in Listing 15-29: the `Weak` references are printed as `(Weak)`: ```text leaf parent = Some(Node { value: 5, parent: RefCell { value: (Weak) }, @@ -462,7 +462,7 @@ Let’s look at how the `strong_count` and `weak_count` values of the `Rc` instances change by creating a new inner scope and moving the creation of `branch` into that scope. This will let us see what happens when `branch` is created and then dropped when it goes out of scope. The modifications are shown -in Listing 15-25: +in Listing 15-33: Filename: src/main.rs @@ -510,7 +510,7 @@ fn main() { } ``` -Listing 15-25: Creating `branch` in an inner scope and +Listing 15-33: Creating `branch` in an inner scope and examining strong and weak reference counts Once `leaf` is created, its `Rc` has a strong count of 1 and a weak count of 0. diff --git a/src/doc/book/second-edition/src/ch16-01-threads.md b/src/doc/book/second-edition/src/ch16-01-threads.md index 31a2c71e5a..56cf299a3e 100644 --- a/src/doc/book/second-edition/src/ch16-01-threads.md +++ b/src/doc/book/second-edition/src/ch16-01-threads.md @@ -85,16 +85,19 @@ thread and other text from a new thread: ```rust use std::thread; +use std::time::Duration; fn main() { thread::spawn(|| { for i in 1..10 { println!("hi number {} from the spawned thread!", i); + thread::sleep(Duration::from_millis(1)); } }); for i in 1..5 { println!("hi number {} from the main thread!", i); + thread::sleep(Duration::from_millis(1)); } } ``` @@ -123,11 +126,13 @@ hi number 5 from the spawned thread! always? --> -The threads will probably take turns, but that’s not guaranteed: it depends on -how your operating system schedules the threads. In this run, the main thread -printed first, even though the print statement from the spawned thread appears -first in the code. And even though we told the spawned thread to print until -`i` is 9, it only got to 5 before the main thread shut down. +The `thread::sleep` function will force a thread to stop its execution for a +short duration, allowing a different thread to run, so that they will probably +take turns, but that’s not guaranteed: it depends on how your operating system +schedules the threads. In this run, the main thread printed first, even though +the print statement from the spawned thread appears first in the code. And even +though we told the spawned thread to print until `i` is 9, it only got to 5 +before the main thread shut down. If you run this code and only see one thread, or don’t see any overlap, try increasing the numbers in the ranges to create more opportunities for a thread @@ -160,16 +165,19 @@ seems missing, so I'm not sure if this is sufficient /Carol --> ```rust use std::thread; +use std::time::Duration; fn main() { let handle = thread::spawn(|| { for i in 1..10 { println!("hi number {} from the spawned thread!", i); + thread::sleep(Duration::from_millis(1)); } }); for i in 1..5 { println!("hi number {} from the main thread!", i); + thread::sleep(Duration::from_millis(1)); } handle.join(); @@ -214,11 +222,13 @@ If we instead move `handle.join()` before the `for` loop in main, like this: ```rust use std::thread; +use std::time::Duration; fn main() { let handle = thread::spawn(|| { for i in 1..10 { println!("hi number {} from the spawned thread!", i); + thread::sleep(Duration::from_millis(1)); } }); @@ -226,6 +236,7 @@ fn main() { for i in 1..5 { println!("hi number {} from the main thread!", i); + thread::sleep(Duration::from_millis(1)); } } ``` diff --git a/src/doc/book/second-edition/src/ch16-02-message-passing.md b/src/doc/book/second-edition/src/ch16-02-message-passing.md index 144100f6a6..f13bf26a70 100644 --- a/src/doc/book/second-edition/src/ch16-02-message-passing.md +++ b/src/doc/book/second-edition/src/ch16-02-message-passing.md @@ -338,7 +338,7 @@ shown in Listing 16-11: # use std::time::Duration; # # fn main() { -// ...snip... +// --snip-- let (tx, rx) = mpsc::channel(); let tx1 = mpsc::Sender::clone(&tx); @@ -369,7 +369,7 @@ thread::spawn(move || { thread::sleep(Duration::from_secs(1)); } }); -// ...snip... +// --snip-- # # for received in rx { # println!("Got: {}", received); @@ -377,8 +377,8 @@ thread::spawn(move || { # } ``` -Listing 16-11: Sending multiple messages and pausing -between each one +Listing 16-11: Sending multiple messages from multiple +producers This time, before we create the first spawned thread, we call `clone` on the sending end of the channel. This will give us a new sending handle we can pass diff --git a/src/doc/book/second-edition/src/ch17-03-oo-design-patterns.md b/src/doc/book/second-edition/src/ch17-03-oo-design-patterns.md index 6d39b8b3bc..180f324efe 100644 --- a/src/doc/book/second-edition/src/ch17-03-oo-design-patterns.md +++ b/src/doc/book/second-edition/src/ch17-03-oo-design-patterns.md @@ -155,7 +155,7 @@ Post` block: # } # impl Post { - // ...snip... + // --snip-- pub fn add_text(&mut self, text: &str) { self.content.push_str(text); } @@ -192,7 +192,7 @@ implementation: # } # impl Post { - // ...snip... + // --snip-- pub fn content(&self) -> &str { "" } @@ -229,7 +229,7 @@ upon /Carol --> # } # impl Post { - // ...snip... + // --snip-- pub fn request_review(&mut self) { if let Some(s) = self.state.take() { self.state = Some(s.request_review()) @@ -317,7 +317,7 @@ state is approved, shown in Listing 17-16. # } # impl Post { - // ...snip... + // --snip-- pub fn approve(&mut self) { if let Some(s) = self.state.take() { self.state = Some(s.approve()) @@ -337,7 +337,7 @@ impl State for Draft { # Box::new(PendingReview {}) # } # - // ...snip... + // --snip-- fn approve(self: Box) -> Box { self } @@ -350,7 +350,7 @@ impl State for PendingReview { # self # } # - // ...snip... + // --snip-- fn approve(self: Box) -> Box { Box::new(Published {}) } @@ -398,11 +398,11 @@ return an empty string slice, as shown in Listing 17-17: # } # impl Post { - // ...snip... + // --snip-- pub fn content(&self) -> &str { self.state.as_ref().unwrap().content(&self) } - // ...snip... + // --snip-- } ``` @@ -431,7 +431,7 @@ coercion will take effect on the `&` and the `Box` so that the `content` method will ultimately be called on the type that implements the `State` trait. That means we need to add `content` to the `State` trait definition, and that’s -where We’ll put the logic for what content to return depending on which state +where we’ll put the logic for what content to return depending on which state we have, as shown in Listing 17-18: Filename: src/lib.rs @@ -441,17 +441,17 @@ we have, as shown in Listing 17-18: # content: String # } trait State { - // ...snip... + // --snip-- fn content<'a>(&self, post: &'a Post) -> &'a str { "" } } -// ...snip... +// --snip-- struct Published {} impl State for Published { - // ...snip... + // --snip-- fn content<'a>(&self, post: &'a Post) -> &'a str { &post.content } @@ -640,7 +640,7 @@ return a `Post` as shown in Listing 17-20: # } # impl DraftPost { - // ...snip... + // --snip-- pub fn request_review(self) -> PendingReviewPost { PendingReviewPost { diff --git a/src/doc/book/second-edition/src/ch18-02-refutability.md b/src/doc/book/second-edition/src/ch18-02-refutability.md index 807c28db54..18b636c4e0 100644 --- a/src/doc/book/second-edition/src/ch18-02-refutability.md +++ b/src/doc/book/second-edition/src/ch18-02-refutability.md @@ -9,7 +9,7 @@ let Some(x) = a_value`; if the value in the `a_value` variable is `None` rather than `Some`, then the `Some(x)` pattern would not match. `let` statements, function parameters, and `for` loops can only accept -irrefutable patterns, because the program cannot continue do anything +irrefutable patterns, because the program cannot do anything meaningful with values that don’t match. The `if let` and `while let` expressions are restricted to only accept refutable patterns, because by definition they’re intended to handle possible failure---the functionality of a diff --git a/src/doc/book/second-edition/src/ch19-03-advanced-traits.md b/src/doc/book/second-edition/src/ch19-03-advanced-traits.md index 0f783f2c9a..5eda79bc36 100644 --- a/src/doc/book/second-edition/src/ch19-03-advanced-traits.md +++ b/src/doc/book/second-edition/src/ch19-03-advanced-traits.md @@ -104,7 +104,7 @@ like Listing 19-23: # trait GGraph {} # fn distance>(graph: &G, start: &N, end: &N) -> u32 { - // ...snip... + // --snip-- # 0 } ``` @@ -130,7 +130,7 @@ Contrast with the definition of `distance` in Listing 19-24 that uses the # } # fn distance(graph: &G, start: &G::Node, end: &G::Node) -> u32 { - // ...snip... + // --snip-- # 0 } ``` @@ -154,7 +154,7 @@ trait object: # trait GGraph {} # fn distance(graph: &GGraph, start: &N, end: &N) -> u32 { - // ...snip... + // --snip-- # 0 } ``` @@ -182,7 +182,7 @@ for their `Edge` type: # } # fn traverse(graph: &AGraph) { - // ...snip... + // --snip-- } ``` diff --git a/src/doc/book/second-edition/src/ch19-04-advanced-types.md b/src/doc/book/second-edition/src/ch19-04-advanced-types.md index 8520a63806..ec43e78b4d 100644 --- a/src/doc/book/second-edition/src/ch19-04-advanced-types.md +++ b/src/doc/book/second-edition/src/ch19-04-advanced-types.md @@ -76,11 +76,11 @@ like that in Listing 19-35: let f: Box = Box::new(|| println!("hi")); fn takes_long_type(f: Box) { - // ...snip... + // --snip-- } fn returns_long_type() -> Box { - // ...snip... + // --snip-- # Box::new(|| ()) } ``` @@ -98,11 +98,11 @@ type Thunk = Box; let f: Thunk = Box::new(|| println!("hi")); fn takes_long_type(f: Thunk) { - // ...snip... + // --snip-- } fn returns_long_type() -> Thunk { - // ...snip... + // --snip-- # Box::new(|| ()) } ``` @@ -170,7 +170,7 @@ function will never return. For example: ```rust,ignore fn bar() -> ! { - // ...snip... + // --snip-- } ``` @@ -213,11 +213,11 @@ As you may have guessed, `continue` has a value of `!`. That is, when Rust goes to compute the type of `guess`, it looks at both of the match arms. The former has a value of `u32`, and the latter has a value of `!`. Since `!` can never have a value, Rust is okay with this, and decides that the type of `guess` is -`u32`. The formal way of describing this behavior of `!` is that the never type -unifies with all other types. We’re allowed to end this `match` arm with -`continue` because `continue` doesn’t actually return a value; it instead moves -control back to the top of the loop, so in the `Err` case, we never actually -assign a value to `guess`. +`u32`. The formal way of describing this behavior is that expressions of type +`!` can be coerced into any other type. We’re allowed to end this `match` arm +with `continue` because `continue` doesn’t actually return a value; it instead +moves control back to the top of the loop, so in the `Err` case, we never +actually assign a value to `guess`. Another use of the never type is `panic!`. Remember the `unwrap` function that we call on `Option` values to produce a value or panic? Here’s its @@ -318,7 +318,7 @@ That is, a generic function definition like this: ```rust,ignore fn generic(t: T) { - // ...snip... + // --snip-- } ``` @@ -326,7 +326,7 @@ is actually treated as if we had written this: ```rust,ignore fn generic(t: T) { - // ...snip... + // --snip-- } ``` @@ -336,7 +336,7 @@ restriction: ```rust,ignore fn generic(t: &T) { - // ...snip... + // --snip-- } ``` diff --git a/src/doc/book/second-edition/src/ch20-01-single-threaded.md b/src/doc/book/second-edition/src/ch20-01-single-threaded.md index df89351d3d..0df2022489 100644 --- a/src/doc/book/second-edition/src/ch20-01-single-threaded.md +++ b/src/doc/book/second-edition/src/ch20-01-single-threaded.md @@ -363,7 +363,7 @@ it to the response as a body, and send it: # use std::net::TcpStream; use std::fs::File; -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { let mut buffer = [0; 512]; @@ -418,7 +418,7 @@ add code to treat requests differently: # use std::io::prelude::*; # use std::net::TcpStream; # use std::fs::File; -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { let mut buffer = [0; 512]; @@ -438,7 +438,7 @@ fn handle_connection(mut stream: TcpStream) { stream.flush().unwrap(); } else { // some other request - }; + } } ``` @@ -476,7 +476,7 @@ browser indicating as such to the end user: # use std::fs::File; # fn handle_connection(mut stream: TcpStream) { # if true { -// ...snip... +// --snip-- } else { let status_line = "HTTP/1.1 404 NOT FOUND\r\n\r\n"; @@ -540,14 +540,14 @@ shown in Listing 20-9: # use std::io::prelude::*; # use std::net::TcpStream; # use std::fs::File; -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { # let mut buffer = [0; 512]; # stream.read(&mut buffer).unwrap(); # # let get = b"GET / HTTP/1.1\r\n"; - // ...snip... + // --snip-- let (status_line, filename) = if buffer.starts_with(get) { ("HTTP/1.1 200 OK\r\n\r\n", "hello.html") diff --git a/src/doc/book/second-edition/src/ch20-02-slow-requests.md b/src/doc/book/second-edition/src/ch20-02-slow-requests.md index 7a08013582..df0e150da9 100644 --- a/src/doc/book/second-edition/src/ch20-02-slow-requests.md +++ b/src/doc/book/second-edition/src/ch20-02-slow-requests.md @@ -26,12 +26,12 @@ use std::time::Duration; # use std::io::prelude::*; # use std::net::TcpStream; # use std::fs::File; -// ...snip... +// --snip-- fn handle_connection(mut stream: TcpStream) { # let mut buffer = [0; 512]; # stream.read(&mut buffer).unwrap(); - // ...snip... + // --snip-- let get = b"GET / HTTP/1.1\r\n"; let sleep = b"GET /sleep HTTP/1.1\r\n"; @@ -45,7 +45,7 @@ fn handle_connection(mut stream: TcpStream) { ("HTTP/1.1 404 NOT FOUND\r\n\r\n", "404.html") }; - // ...snip... + // --snip-- } ``` diff --git a/src/doc/book/second-edition/src/ch20-03-designing-the-interface.md b/src/doc/book/second-edition/src/ch20-03-designing-the-interface.md index 118e7718ad..e2ac58cb9c 100644 --- a/src/doc/book/second-edition/src/ch20-03-designing-the-interface.md +++ b/src/doc/book/second-edition/src/ch20-03-designing-the-interface.md @@ -234,7 +234,7 @@ generic parameter `F` with these bounds: ```rust # pub struct ThreadPool; impl ThreadPool { - // ...snip... + // --snip-- pub fn execute(&self, f: F) where diff --git a/src/doc/book/second-edition/src/ch20-04-storing-threads.md b/src/doc/book/second-edition/src/ch20-04-storing-threads.md index ca2d43cbd5..fe373053b4 100644 --- a/src/doc/book/second-edition/src/ch20-04-storing-threads.md +++ b/src/doc/book/second-edition/src/ch20-04-storing-threads.md @@ -31,7 +31,7 @@ impl ThreadPool { ThreadPool } - // ...snip... + // --snip-- } ``` @@ -92,7 +92,7 @@ pub struct ThreadPool { } impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: u32) -> ThreadPool { assert!(size > 0); @@ -107,7 +107,7 @@ impl ThreadPool { } } - // ...snip... + // --snip-- } ``` @@ -194,7 +194,7 @@ pub struct ThreadPool { } impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -208,7 +208,7 @@ impl ThreadPool { workers } } - // ...snip... + // --snip-- } struct Worker { diff --git a/src/doc/book/second-edition/src/ch20-05-sending-requests-via-channels.md b/src/doc/book/second-edition/src/ch20-05-sending-requests-via-channels.md index 798a48e351..a0cb983a52 100644 --- a/src/doc/book/second-edition/src/ch20-05-sending-requests-via-channels.md +++ b/src/doc/book/second-edition/src/ch20-05-sending-requests-via-channels.md @@ -32,7 +32,7 @@ hold anything for now: ```rust # use std::thread; -// ...snip... +// --snip-- use std::sync::mpsc; pub struct ThreadPool { @@ -43,7 +43,7 @@ pub struct ThreadPool { struct Job; impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -60,7 +60,7 @@ impl ThreadPool { sender, } } - // ...snip... + // --snip-- } # # struct Worker { @@ -96,7 +96,7 @@ won’t quite compile yet: ```rust,ignore impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -113,10 +113,10 @@ impl ThreadPool { sender, } } - // ...snip... + // --snip-- } -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: mpsc::Receiver) -> Worker { @@ -183,7 +183,7 @@ need to make: use std::sync::Arc; use std::sync::Mutex; -// ...snip... +// --snip-- # pub struct ThreadPool { # workers: Vec, @@ -192,7 +192,7 @@ use std::sync::Mutex; # struct Job; # impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); @@ -212,7 +212,7 @@ impl ThreadPool { } } - // ...snip... + // --snip-- } # struct Worker { # id: usize, @@ -221,7 +221,7 @@ impl ThreadPool { # impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { - // ...snip... + // --snip-- # let thread = thread::spawn(|| { # receiver; # }); @@ -252,7 +252,7 @@ this is such a case! Take a look at Listing 20-19: Filename: src/lib.rs ```rust -// ...snip... +// --snip-- # pub struct ThreadPool { # workers: Vec, # sender: mpsc::Sender, @@ -263,7 +263,7 @@ this is such a case! Take a look at Listing 20-19: type Job = Box; impl ThreadPool { - // ...snip... + // --snip-- pub fn execute(&self, f: F) where @@ -275,7 +275,7 @@ impl ThreadPool { } } -// ...snip... +// --snip-- ``` Listing 20-19: Creating a `Job` type alias for a `Box` @@ -299,7 +299,7 @@ change shown in Listing 20-20 to `Worker::new`: Filename: src/lib.rs ```rust,ignore -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { @@ -401,7 +401,7 @@ impl FnBox for F { type Job = Box; -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { diff --git a/src/doc/book/second-edition/src/ch20-06-graceful-shutdown-and-cleanup.md b/src/doc/book/second-edition/src/ch20-06-graceful-shutdown-and-cleanup.md index 9097dec1c4..e6d345db2e 100644 --- a/src/doc/book/second-edition/src/ch20-06-graceful-shutdown-and-cleanup.md +++ b/src/doc/book/second-edition/src/ch20-06-graceful-shutdown-and-cleanup.md @@ -104,7 +104,7 @@ to wrap the `thread` value in `Some` when we create a new `Worker`: ```rust,ignore impl Worker { fn new(id: usize, receiver: Arc>>) -> Worker { - // ...snip... + // --snip-- Worker { id, @@ -177,16 +177,16 @@ pub struct ThreadPool { sender: mpsc::Sender, } -// ...snip... +// --snip-- impl ThreadPool { - // ...snip... + // --snip-- pub fn new(size: usize) -> ThreadPool { assert!(size > 0); let (sender, receiver) = mpsc::channel(); - // ...snip... + // --snip-- } pub fn execute(&self, f: F) @@ -199,7 +199,7 @@ impl ThreadPool { } } -// ...snip... +// --snip-- impl Worker { fn new(id: usize, receiver: Arc>>) -> diff --git a/src/doc/book/second-edition/tools/docx-to-md.xsl b/src/doc/book/second-edition/tools/docx-to-md.xsl index 47ebc7dea0..3b60bc34e4 100644 --- a/src/doc/book/second-edition/tools/docx-to-md.xsl +++ b/src/doc/book/second-edition/tools/docx-to-md.xsl @@ -155,7 +155,7 @@ Unmatched: - + @@ -174,7 +174,26 @@ Unmatched: - + + + + + + + ** + + ** + + + + + + + + + + + diff --git a/src/doc/man/rustc.1 b/src/doc/man/rustc.1 index 0bb41cee2c..19f6cc9ac6 100644 --- a/src/doc/man/rustc.1 +++ b/src/doc/man/rustc.1 @@ -1,4 +1,4 @@ -.TH RUSTC "1" "September 2016" "rustc 1.13.0" "User Commands" +.TH RUSTC "1" "" "rustc " "User Commands" .SH NAME rustc \- The Rust compiler .SH SYNOPSIS diff --git a/src/doc/man/rustdoc.1 b/src/doc/man/rustdoc.1 index d34ab61354..a878380f55 100644 --- a/src/doc/man/rustdoc.1 +++ b/src/doc/man/rustdoc.1 @@ -1,4 +1,4 @@ -.TH RUSTDOC "1" "May 2017" "rustdoc 1.19.0" "User Commands" +.TH RUSTDOC "1" "" "rustdoc " "User Commands" .SH NAME rustdoc \- generate documentation from Rust source code .SH SYNOPSIS diff --git a/src/doc/nomicon/src/casts.md b/src/doc/nomicon/src/casts.md index 31b7858724..46c99756af 100644 --- a/src/doc/nomicon/src/casts.md +++ b/src/doc/nomicon/src/casts.md @@ -28,7 +28,7 @@ primitive: * `*T as integer` * `integer as *T` * `number as number` - * `C-like-enum as integer` + * `field-less enum as integer` * `bool as integer` * `char as integer` * `u8 as char` diff --git a/src/doc/nomicon/src/dropck.md b/src/doc/nomicon/src/dropck.md index f1fef35991..d75257c08e 100644 --- a/src/doc/nomicon/src/dropck.md +++ b/src/doc/nomicon/src/dropck.md @@ -94,7 +94,7 @@ error: `days` does not live long enough error: aborting due to previous error ``` -Implementing Drop lets the Inspector execute some arbitrary code during its +Implementing `Drop` lets the `Inspector` execute some arbitrary code during its death. This means it can potentially observe that types that are supposed to live as long as it does actually were destroyed first. @@ -168,7 +168,7 @@ checker during the analysis of `fn main`, saying that `days` does not live long enough. The reason is that the borrow checking analysis of `main` does not -know about the internals of each Inspector's Drop implementation. As +know about the internals of each `Inspector`'s `Drop` implementation. As far as the borrow checker knows while it is analyzing `main`, the body of an inspector's destructor might access that borrowed data. @@ -185,7 +185,7 @@ borrowed data in a value to outlive that value, which is certainly sound. Future versions of the language may make the analysis more precise, to reduce the number of cases where sound code is rejected as unsafe. -This would help address cases such as the two Inspectors above that +This would help address cases such as the two `Inspector`s above that know not to inspect during destruction. In the meantime, there is an unstable attribute that one can use to @@ -193,9 +193,8 @@ assert (unsafely) that a generic type's destructor is *guaranteed* to not access any expired data, even if its type gives it the capability to do so. -That attribute is called `may_dangle` and was introduced in [RFC 1327] -(https://github.com/rust-lang/rfcs/blob/master/text/1327-dropck-param-eyepatch.md). -To deploy it on the Inspector example from above, we would write: +That attribute is called `may_dangle` and was introduced in [RFC 1327][rfc1327]. +To deploy it on the `Inspector` example from above, we would write: ```rust,ignore struct Inspector<'a>(&'a u8, &'static str); @@ -287,3 +286,4 @@ worry at all about doing the right thing for the drop checker. However there is one special case that you need to worry about, which we will look at in the next section. +[rfc1327]: https://github.com/rust-lang/rfcs/blob/master/text/1327-dropck-param-eyepatch.md diff --git a/src/doc/nomicon/src/other-reprs.md b/src/doc/nomicon/src/other-reprs.md index a77ebf0d1f..a2ce43333d 100644 --- a/src/doc/nomicon/src/other-reprs.md +++ b/src/doc/nomicon/src/other-reprs.md @@ -23,8 +23,8 @@ passed through the FFI boundary. C, and is explicitly contrary to the behavior of an empty type in C++, which still consumes a byte of space. -* DST pointers (fat pointers), tuples, and enums with data (that is, non-C-like - enums) are not a concept in C, and as such are never FFI-safe. +* DST pointers (fat pointers), tuples, and enums with fields are not a concept + in C, and as such are never FFI-safe. * As an exception to the rule on enum with data, `Option<&T>` is FFI-safe if `*const T` is FFI-safe, and they have the same @@ -37,12 +37,12 @@ still consumes a byte of space. difference from a struct is that the fields aren’t named. * This is equivalent to one of `repr(u*)` (see the next section) for enums. The -chosen size is the default enum size for the target platform's C ABI. Note that -enum representation in C is implementation defined, so this is really a "best -guess". In particular, this may be incorrect when the C code of interest is -compiled with certain flags. +chosen size is the default enum size for the target platform's C application +binary interface (ABI). Note that enum representation in C is implementation +defined, so this is really a "best guess". In particular, this may be incorrect +when the C code of interest is compiled with certain flags. -* "C-like" enums with `repr(C)` or `repr(u*)` still may not be set to an +* Field-less enums with `repr(C)` or `repr(u*)` still may not be set to an integer value without a corresponding variant, even though this is permitted behavior in C or C++. It is undefined behavior to (unsafely) construct an instance of an enum that does not match one of its @@ -53,19 +53,19 @@ compiled as normal.) # repr(u*), repr(i*) -These specify the size to make a C-like enum. If the discriminant overflows the -integer it has to fit in, it will produce a compile-time error. You can manually -ask Rust to allow this by setting the overflowing element to explicitly be 0. -However Rust will not allow you to create an enum where two variants have the -same discriminant. +These specify the size to make a field-less enum. If the discriminant overflows +the integer it has to fit in, it will produce a compile-time error. You can +manually ask Rust to allow this by setting the overflowing element to explicitly +be 0. However Rust will not allow you to create an enum where two variants have +the same discriminant. -The term "C-like enum" only means that the enum doesn't have data in any -of its variants. A C-like enum without a `repr(u*)` or `repr(C)` is +The term "field-less enum" only means that the enum doesn't have data in any +of its variants. A field-less enum without a `repr(u*)` or `repr(C)` is still a Rust native type, and does not have a stable ABI representation. Adding a `repr` causes it to be treated exactly like the specified integer size for ABI purposes. -A non-C-like enum is a Rust type with no guaranteed ABI (even if the +Any enum with fields is a Rust type with no guaranteed ABI (even if the only data is `PhantomData` or something else with zero size). Adding an explicit `repr` to an enum suppresses the null-pointer diff --git a/src/doc/nomicon/src/repr-rust.md b/src/doc/nomicon/src/repr-rust.md index 7001d3221e..c975090220 100644 --- a/src/doc/nomicon/src/repr-rust.md +++ b/src/doc/nomicon/src/repr-rust.md @@ -21,7 +21,7 @@ Rust gives you the following ways to lay out composite data: * arrays (homogeneous product types) * enums (named sum types -- tagged unions) -An enum is said to be *C-like* if none of its variants have associated data. +An enum is said to be *field-less* if none of its variants have associated data. Composite structures will have an alignment equal to the maximum of their fields' alignment. Rust will consequently insert padding where @@ -110,9 +110,6 @@ struct Foo { The latter case quite simply wastes space. An optimal use of space therefore requires different monomorphizations to have *different field orderings*. -**Note: this is a hypothetical optimization that is not yet implemented in Rust -1.0** - Enums make this consideration even more complicated. Naively, an enum such as: ```rust diff --git a/src/doc/nomicon/src/safe-unsafe-meaning.md b/src/doc/nomicon/src/safe-unsafe-meaning.md index 662fbe352b..584f3974af 100644 --- a/src/doc/nomicon/src/safe-unsafe-meaning.md +++ b/src/doc/nomicon/src/safe-unsafe-meaning.md @@ -38,8 +38,8 @@ The standard library has a number of unsafe functions, including: type safety in arbitrary ways (see [conversions] for details). * Every raw pointer to a sized type has an `offset` method that invokes Undefined Behavior if the passed offset is not ["in bounds"][ptr_offset]. -* All FFI functions are `unsafe` to call because the other language can do - arbitrary operations that the Rust compiler can't check. +* All FFI (Foreign Function Interface) functions are `unsafe` to call because the + other language can do arbitrary operations that the Rust compiler can't check. As of Rust 1.0 there are exactly two unsafe traits: diff --git a/src/doc/nomicon/src/working-with-unsafe.md b/src/doc/nomicon/src/working-with-unsafe.md index 09056c5d58..1864dd10ca 100644 --- a/src/doc/nomicon/src/working-with-unsafe.md +++ b/src/doc/nomicon/src/working-with-unsafe.md @@ -92,7 +92,8 @@ capacity violates the invariants of Vec (that `cap` reflects the allocated space in the Vec). This is not something the rest of Vec can guard against. It *has* to trust the capacity field because there's no way to verify it. -`unsafe` does more than pollute a whole function: it pollutes a whole *module*. +Because it relies on invariants of a struct field, this `unsafe` code +does more than pollute a whole function: it pollutes a whole *module*. Generally, the only bullet-proof way to limit the scope of unsafe code is at the module boundary with privacy. diff --git a/src/doc/not_found.md b/src/doc/not_found.md index ebe7c59313..f404aa046c 100644 --- a/src/doc/not_found.md +++ b/src/doc/not_found.md @@ -13,20 +13,20 @@ Some things that might be helpful to you though: # Search -*
+ - -
-* Rust doc search: + + +Rust doc search: # Reference -* [The Rust official site](https://www.rust-lang.org) -* [The Rust reference](https://doc.rust-lang.org/reference/index.html) + * [The Rust official site](https://www.rust-lang.org) + * [The Rust reference](https://doc.rust-lang.org/reference/index.html) # Docs -* [The standard library](https://doc.rust-lang.org/std/) +[The standard library](https://doc.rust-lang.org/std/) ", path = relpath)?; } + if should_close { + // Closes sidebar-elems div. + write!(fmt, "")?; + } Ok(()) } @@ -3569,6 +3695,7 @@ fn small_url_encode(s: &str) -> String { .replace(";", "%3B") .replace("[", "%5B") .replace("]", "%5D") + .replace("\"", "%22") } fn sidebar_assoc_items(it: &clean::Item) -> String { @@ -3599,9 +3726,10 @@ fn sidebar_assoc_items(it: &clean::Item) -> String { })).and_then(|did| c.impls.get(&did)); if let Some(impls) = inner_impl { out.push_str(""); - out.push_str(&format!("Methods from {:#}<Target={:#}>", - impl_.inner_impl().trait_.as_ref().unwrap(), - target)); + out.push_str(&format!("Methods from {}<Target={}>", + Escape(&format!("{:#}", + impl_.inner_impl().trait_.as_ref().unwrap())), + Escape(&format!("{:#}", target)))); out.push_str(""); let ret = impls.iter() .filter(|i| i.inner_impl().trait_.is_none()) @@ -3613,18 +3741,24 @@ fn sidebar_assoc_items(it: &clean::Item) -> String { } let mut links = HashSet::new(); let ret = v.iter() - .filter_map(|i| if let Some(ref i) = i.inner_impl().trait_ { - let i_display = format!("{:#}", i); - let out = Escape(&i_display); - let encoded = small_url_encode(&format!("{:#}", i)); - let generated = format!("{}", encoded, out); - if !links.contains(&generated) && links.insert(generated.clone()) { - Some(generated) + .filter_map(|i| { + let is_negative_impl = is_negative_impl(i.inner_impl()); + if let Some(ref i) = i.inner_impl().trait_ { + let i_display = format!("{:#}", i); + let out = Escape(&i_display); + let encoded = small_url_encode(&format!("{:#}", i)); + let generated = format!("{}{}", + encoded, + if is_negative_impl { "!" } else { "" }, + out); + if !links.contains(&generated) && links.insert(generated.clone()) { + Some(generated) + } else { + None + } } else { None } - } else { - None }) .collect::(); if !ret.is_empty() { @@ -3671,6 +3805,10 @@ fn extract_for_impl_name(item: &clean::Item) -> Option<(String, String)> { } } +fn is_negative_impl(i: &clean::Impl) -> bool { + i.polarity == Some(clean::ImplPolarity::Negative) +} + fn sidebar_trait(fmt: &mut fmt::Formatter, it: &clean::Item, t: &clean::Trait) -> fmt::Result { let mut sidebar = String::new(); diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 1ec579232c..559f8494fc 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -42,9 +42,9 @@ // On the search screen, so you remain on the last tab you opened. // - // 0 for "Types/modules" - // 1 for "As parameters" - // 2 for "As return value" + // 0 for "In Names" + // 1 for "In Parameters" + // 2 for "In Return Types" var currentTab = 0; function hasClass(elem, className) { @@ -106,6 +106,38 @@ return (elem.offsetParent === null) } + function showSidebar() { + var elems = document.getElementsByClassName("sidebar-elems")[0]; + if (elems) { + addClass(elems, "show-it"); + } + var sidebar = document.getElementsByClassName('sidebar')[0]; + if (sidebar) { + addClass(sidebar, 'mobile'); + var filler = document.getElementById("sidebar-filler"); + if (!filler) { + var div = document.createElement("div"); + div.id = "sidebar-filler"; + sidebar.appendChild(div); + } + } + document.getElementsByTagName("body")[0].style.marginTop = '45px'; + } + + function hideSidebar() { + var elems = document.getElementsByClassName("sidebar-elems")[0]; + if (elems) { + removeClass(elems, "show-it"); + } + var sidebar = document.getElementsByClassName('sidebar')[0]; + removeClass(sidebar, 'mobile'); + var filler = document.getElementById("sidebar-filler"); + if (filler) { + filler.remove(); + } + document.getElementsByTagName("body")[0].style.marginTop = ''; + } + // used for special search precedence var TY_PRIMITIVE = itemTypes.indexOf("primitive"); @@ -119,8 +151,7 @@ map(function(s) { var pair = s.split("="); params[decodeURIComponent(pair[0])] = - typeof pair[1] === "undefined" ? - null : decodeURIComponent(pair[1]); + typeof pair[1] === "undefined" ? null : decodeURIComponent(pair[1]); }); return params; } @@ -131,6 +162,8 @@ } function highlightSourceLines(ev) { + // If we're in mobile mode, we should add the sidebar in any case. + hideSidebar(); var search = document.getElementById("search"); var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/); if (match) { @@ -216,6 +249,7 @@ var help = document.getElementById("help"); switch (getVirtualKey(ev)) { case "Escape": + hideModal(); var search = document.getElementById("search"); if (!hasClass(help, "hidden")) { displayHelp(false, ev); @@ -229,6 +263,7 @@ case "s": case "S": displayHelp(false, ev); + hideModal(); ev.preventDefault(); focusSearchBar(); break; @@ -241,6 +276,7 @@ case "?": if (ev.shiftKey) { + hideModal(); displayHelp(true, ev); } break; @@ -653,6 +689,9 @@ } function checkPath(startsWith, lastElem, ty) { + if (startsWith.length === 0) { + return 0; + } var ret_lev = MAX_LEV_DISTANCE + 1; var path = ty.path.split("::"); @@ -678,18 +717,7 @@ lev_total += lev; } if (aborted === false) { - var extra = MAX_LEV_DISTANCE + 1; - if (i + startsWith.length < path.length) { - extra = levenshtein(path[i + startsWith.length], lastElem); - } - if (extra > MAX_LEV_DISTANCE) { - extra = levenshtein(ty.name, lastElem); - } - if (extra < MAX_LEV_DISTANCE + 1) { - lev_total += extra; - ret_lev = Math.min(ret_lev, - Math.round(lev_total / (startsWith.length + 1))); - } + ret_lev = Math.min(ret_lev, Math.round(lev_total / startsWith.length)); } } return ret_lev; @@ -906,6 +934,13 @@ } lev += lev_add; + if (lev > 0 && val.length > 3 && searchWords[j].startsWith(val)) { + if (val.length < 6) { + lev -= 1; + } else { + lev = 0; + } + } if (in_args <= MAX_LEV_DISTANCE) { if (results_in_args[fullId] === undefined) { results_in_args[fullId] = { @@ -1193,9 +1228,9 @@ output = '

Results for ' + escape(query.query) + (query.type ? ' (type: ' + escape(query.type) + ')' : '') + '

' + '
' + - makeTabHeader(0, "Types/modules", results['others'].length) + - makeTabHeader(1, "As parameters", results['in_args'].length) + - makeTabHeader(2, "As return value", results['returned'].length) + + makeTabHeader(0, "In Names", results['others'].length) + + makeTabHeader(1, "In Parameters", results['in_args'].length) + + makeTabHeader(2, "In Return Types", results['returned'].length) + '
'; output += addTab(results['others'], query); @@ -1419,7 +1454,7 @@ // Draw a convenient sidebar of known crates if we have a listing if (rootPath === '../') { - var sidebar = document.getElementsByClassName('sidebar')[0]; + var sidebar = document.getElementsByClassName('sidebar-elems')[0]; var div = document.createElement('div'); div.className = 'block crate'; div.innerHTML = '

Crates

'; @@ -1457,7 +1492,7 @@ // delayed sidebar rendering. function initSidebarItems(items) { - var sidebar = document.getElementsByClassName('sidebar')[0]; + var sidebar = document.getElementsByClassName('sidebar-elems')[0]; var current = window.sidebarCurrent; function block(shortty, longty) { @@ -1779,6 +1814,31 @@ } }); + function showModal(content) { + var modal = document.createElement('div'); + modal.id = "important"; + addClass(modal, 'modal'); + modal.innerHTML = ''; + document.getElementsByTagName('body')[0].appendChild(modal); + document.getElementById('modal-close').onclick = hideModal; + modal.onclick = hideModal; + } + + function hideModal() { + var modal = document.getElementById("important"); + if (modal) { + modal.parentNode.removeChild(modal); + } + } + + onEach(document.getElementsByClassName('important-traits'), function(e) { + e.onclick = function() { + showModal(e.lastElementChild.innerHTML); + }; + }); + var search_input = document.getElementsByClassName("search-input")[0]; if (search_input) { @@ -1794,6 +1854,30 @@ } }; } + + var params = getQueryStringParams(); + if (params && params.search) { + addClass(document.getElementById("main"), "hidden"); + var search = document.getElementById("search"); + removeClass(search, "hidden"); + search.innerHTML = '

Loading search results...

'; + } + + var sidebar_menu = document.getElementsByClassName("sidebar-menu")[0]; + if (sidebar_menu) { + sidebar_menu.onclick = function() { + var sidebar = document.getElementsByClassName('sidebar')[0]; + if (hasClass(sidebar, "mobile") === true) { + hideSidebar(); + } else { + showSidebar(); + } + }; + } + + window.onresize = function() { + hideSidebar(); + }; }()); // Sets the focus on the search bar at the top of the page diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 55acc57515..b41874a56b 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -89,7 +89,7 @@ h2 { h3 { font-size: 1.3em; } -h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) { +h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod):not(.important), h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) { font-weight: 500; margin: 20px 0 15px 0; padding-bottom: 6px; @@ -141,9 +141,12 @@ code, pre { border-radius: 3px; padding: 0 0.2em; } -.docblock pre code, .docblock-short pre code { +.docblock pre code, .docblock-short pre code, .docblock code.spotlight { padding: 0; } +.docblock code.spotlight :last-child { + padding-bottom: 0.6em; +} pre { padding: 14px; } @@ -205,7 +208,7 @@ nav.sub { .sidebar .version { font-size: 15px; text-align: center; - border-bottom: #DDDDDD 1px solid; + border-bottom: 1px solid; overflow-wrap: break-word; word-wrap: break-word; /* deprecated */ word-break: break-word; /* Chrome, non-standard */ @@ -244,8 +247,8 @@ nav.sub { } .sidebar-title { - border-top: 1px solid #777; - border-bottom: 1px solid #777; + border-top: 1px solid; + border-bottom: 1px solid; text-align: center; font-size: 17px; margin-bottom: 5px; @@ -260,6 +263,10 @@ nav.sub { width: 100%; } +.sidebar-menu { + display: none; +} + .content { padding: 15px 0; } @@ -269,9 +276,19 @@ nav.sub { overflow: auto; padding-left: 0; } + #search { margin-left: 230px; + position: relative; } + +#results { + position: absolute; + right: 0; + left: 0; + overflow: auto; +} + .content pre.line-numbers { float: left; border: none; @@ -351,7 +368,6 @@ h4 > code, h3 > code, .invisible > code { } .invisible { - background: rgba(0, 0, 0, 0); width: 100%; display: inline-block; } @@ -431,14 +447,14 @@ h4 > code, h3 > code, .invisible > code { .content .fn .where, .content .where.fmt-newline { display: block; - color: #4E4C4C; font-size: 0.8em; } -.content .methods > div { margin-left: 40px; } +.content .methods > div:not(.important-traits) { margin-left: 40px; } .content .impl-items .docblock, .content .impl-items .stability { margin-left: 40px; + margin-bottom: .6em; } .content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant { margin-left: 20px; @@ -524,7 +540,6 @@ a { } .search-input:focus { - border-color: #66afe9; border-radius: 2px; border: 0; outline: 0; @@ -546,7 +561,8 @@ a { .content .search-results td:first-child a { padding-right: 10px; } tr.result span.primitive::after { - content: ' (primitive type)'; font-style: italic; color: black; + content: ' (primitive type)'; + font-style: italic; } body.blur > :not(#help) { @@ -683,7 +699,6 @@ a.test-arrow:hover{ font-weight: 300; position: absolute; left: -23px; - color: #999; top: 0; } @@ -807,9 +822,10 @@ span.since { margin-left: -15px; padding: 0 15px; position: static; + z-index: 1; } - .sidebar .location { + .sidebar > .location { float: right; margin: 0px; margin-top: 2px; @@ -829,16 +845,42 @@ span.since { margin-top: 5px; margin-bottom: 5px; float: left; + margin-left: 50px; + } + + .sidebar-menu { + position: fixed; + z-index: 10; + font-size: 2rem; + cursor: pointer; + width: 45px; + left: 0; + text-align: center; + display: block; + border-bottom: 1px solid; + border-right: 1px solid; + } + + .sidebar-elems { + position: fixed; + z-index: 1; + left: 0; + top: 45px; + bottom: 0; + overflow-y: auto; + border-right: 1px solid; + display: none; + } + + .sidebar > .block.version { + border-bottom: none; + margin-top: 12px; } nav.sub { margin: 0 auto; } - .sidebar .block { - display: none; - } - .content { margin-left: 0px; } @@ -890,8 +932,6 @@ span.since { .tooltip .tooltiptext { width: 120px; display: none; - background-color: black; - color: #fff; text-align: center; padding: 5px 3px; border-radius: 6px; @@ -913,7 +953,10 @@ span.since { margin-top: -5px; border-width: 5px; border-style: solid; - border-color: transparent black transparent transparent; +} + +.important-traits .tooltip .tooltiptext { + border: 1px solid; } pre.rust { @@ -933,21 +976,161 @@ pre.rust { float: left; width: 33.3%; text-align: center; - border-bottom: 1px solid #ccc; + border-bottom: 1px solid; font-size: 18px; cursor: pointer; } #titles > div.selected { - border-bottom: 3px solid #0078ee; + border-bottom: 3px solid; } #titles > div:hover { - border-bottom: 3px solid #0089ff; + border-bottom: 3px solid; } #titles > div > div.count { display: inline-block; - color: #888; font-size: 16px; } + +.important-traits { + cursor: pointer; + z-index: 2; +} + +h4 > .important-traits { + position: absolute; + left: -44px; + top: 2px; +} + +@media (max-width: 700px) { + h4 > .important-traits { + position: absolute; + left: -22px; + top: 24px; + } + + #titles > div > div.count { + float: left; + width: 100%; + } + + #titles { + height: 50px; + } + + .sidebar.mobile { + position: fixed; + width: 100%; + margin-left: 0; + background-color: rgba(0,0,0,0); + height: 100%; + } + + .show-it { + display: block; + } + + /* Because of ios, we need to actually have a full height sidebar title so the + * actual sidebar can show up. But then we need to make it transparent so we don't + * hide content. The filler just allows to create the background for the sidebar + * title. But because of the absolute position, I had to lower the z-index. + */ + #sidebar-filler { + position: fixed; + left: 45px; + width: calc(100% - 45px); + top: 0; + height: 45px; + z-index: -1; + border-bottom: 1px solid; + } +} + + +@media (max-width: 416px) { + #titles { + height: 73px; + } + + #titles > div { + height: 73px; + } +} + +.modal { + position: fixed; + width: 100vw; + height: 100vh; + z-index: 10000; + top: 0; + left: 0; +} + +.modal-content { + display: block; + max-width: 60%; + min-width: 200px; + padding: 8px; + top: 40%; + position: absolute; + left: 50%; + transform: translate(-50%, -40%); + border: 1px solid; + border-radius: 4px; + border-top-right-radius: 0; +} + +.modal-content > .docblock { + margin: 0; +} + +h3.important { + margin: 0; + margin-bottom: 13px; + font-size: 19px; +} + +.modal-content > .docblock > code.content { + margin: 0; + padding: 0; + font-size: 20px; +} + +.modal-content > .close { + position: absolute; + font-weight: 900; + right: -25px; + top: -1px; + font-size: 18px; + width: 25px; + padding-right: 2px; + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; + text-align: center; + border: 1px solid; + border-right: 0; + cursor: pointer; +} + +.modal-content > .whiter { + height: 25px; + position: absolute; + width: 3px; + right: -2px; + top: 0px; +} + +#main > div.important-traits { + position: absolute; + left: -24px; + margin-top: 16px; +} + +.content > .methods > div.important-traits { + position: absolute; + left: -42px; + margin-top: 2px; +} diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css index cb19034bf0..c79413c085 100644 --- a/src/librustdoc/html/static/styles/main.css +++ b/src/librustdoc/html/static/styles/main.css @@ -31,6 +31,10 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t background-color: white; } +.invisible { + background: rgba(0, 0, 0, 0); +} + .docblock code, .docblock-short code { background-color: #F5F5F5; } @@ -56,6 +60,15 @@ pre { color: #333; } +.sidebar .version { + border-bottom-color: #DDD; +} + +.sidebar-title { + border-top-color: #777; + border-bottom-color: #777; +} + .block a:hover { background: #F5F5F5; } @@ -89,6 +102,12 @@ pre { background: #FDFFD3; } +.content .method .where, +.content .fn .where, +.content .where.fmt-newline { + color: #4E4C4C; +} + .content .highlighted { color: #000 !important; background-color: #ccc; @@ -152,19 +171,27 @@ a.test-arrow { color: #f5f5f5; } +.collapse-toggle { + color: #999; +} + .search-input { color: #555; box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent; background-color: white; } +.search-input:focus { + border-color: #66afe9; +} + .stab.unstable { background: #FFF5D6; border-color: #FFC600; } .stab.deprecated { background: #F3DFFF; border-color: #7F0087; } .stab.portability { background: #C4ECFF; border-color: #7BA5DB; } #help > div { background: #e9e9e9; - border-color: #bfbfbf;; + border-color: #bfbfbf; } #help dt { @@ -176,6 +203,10 @@ a.test-arrow { color: grey; } +tr.result span.primitive::after { + color: black; +} + .line-numbers :target { background-color: transparent; } /* Code highlighting */ @@ -241,3 +272,79 @@ pre.ignore:hover, .information:hover + pre.ignore { .search-failed > a { color: #0089ff; } + +.tooltip .tooltiptext { + background-color: black; + color: #fff; +} + +.tooltip .tooltiptext::after { + border-color: transparent black transparent transparent; +} + +.important-traits .tooltip .tooltiptext { + background-color: white; + color: black; + border-color: black; +} + +#titles > div { + border-bottom-color: #ccc; +} + +#titles > div.selected { + border-bottom-color: #0078ee; +} + +#titles > div:hover { + border-bottom-color: #0089ff; +} + +#titles > div > div.count { + color: #888; +} + +.modal { + background-color: rgba(0,0,0,0.3); +} + +.modal-content { + background-color: #eee; + border-color: #999; +} + +.modal-content > .close { + background-color: #eee; + border-color: #999; +} + +.modal-content > .close:hover { + background-color: #ff1f1f; + color: white; +} + +.modal-content > .whiter { + background-color: #eee; +} + +.modal-content > .close:hover + .whiter { + background-color: #ff1f1f; +} + +@media (max-width: 700px) { + .sidebar-menu { + background-color: #F1F1F1; + border-bottom-color: #e0e0e0; + border-right-color: #e0e0e0; + } + + .sidebar-elems { + background-color: #F1F1F1; + border-right-color: #000; + } + + #sidebar-filler { + background-color: #F1F1F1; + border-bottom-color: #e0e0e0; + } +} diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index fcb25f7aef..1740816ef6 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -48,6 +48,7 @@ extern crate std_unicode; #[macro_use] extern crate log; extern crate rustc_errors as errors; extern crate pulldown_cmark; +extern crate tempdir; extern crate serialize as rustc_serialize; // used by deriving @@ -57,7 +58,7 @@ use std::env; use std::fmt::Display; use std::io; use std::io::Write; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::process; use std::sync::mpsc::channel; @@ -252,6 +253,14 @@ pub fn opts() -> Vec { unstable("linker", |o| { o.optopt("", "linker", "linker used for building executable test code", "PATH") }), + unstable("sort-modules-by-appearance", |o| { + o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \ + program, rather than alphabetically") + }), + unstable("deny-render-differences", |o| { + o.optflag("", "deny-render-differences", "abort doc runs when markdown rendering \ + differences are found") + }), ] } @@ -330,7 +339,8 @@ pub fn main_args(args: &[String]) -> isize { .collect(); let should_test = matches.opt_present("test"); - let markdown_input = input.ends_with(".md") || input.ends_with(".markdown"); + let markdown_input = Path::new(input).extension() + .map_or(false, |e| e == "md" || e == "markdown"); let output = matches.opt_str("o").map(|s| PathBuf::from(&s)); let css_file_extension = matches.opt_str("e").map(|s| PathBuf::from(&s)); @@ -366,18 +376,19 @@ pub fn main_args(args: &[String]) -> isize { let playground_url = matches.opt_str("playground-url"); let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from); let display_warnings = matches.opt_present("display-warnings"); - let linker = matches.opt_str("linker"); + let linker = matches.opt_str("linker").map(PathBuf::from); + let sort_modules_alphabetically = !matches.opt_present("sort-modules-by-appearance"); match (should_test, markdown_input) { (true, true) => { - return markdown::test(input, cfgs, libs, externs, test_args, maybe_sysroot, render_type, - display_warnings, linker) + return markdown::test(input, cfgs, libs, externs, test_args, maybe_sysroot, + render_type, display_warnings, linker) } (true, false) => { - return test::run(input, cfgs, libs, externs, test_args, crate_name, maybe_sysroot, - render_type, display_warnings, linker) + return test::run(Path::new(input), cfgs, libs, externs, test_args, crate_name, + maybe_sysroot, render_type, display_warnings, linker) } - (false, true) => return markdown::render(input, + (false, true) => return markdown::render(Path::new(input), output.unwrap_or(PathBuf::from("doc")), &matches, &external_html, !matches.opt_present("markdown-no-toc"), @@ -386,7 +397,8 @@ pub fn main_args(args: &[String]) -> isize { } let output_format = matches.opt_str("w"); - let res = acquire_input(input, externs, &matches, move |out| { + let deny_render_differences = matches.opt_present("deny-render-differences"); + let res = acquire_input(PathBuf::from(input), externs, &matches, move |out| { let Output { krate, passes, renderinfo } = out; info!("going to format"); match output_format.as_ref().map(|s| &**s) { @@ -396,7 +408,9 @@ pub fn main_args(args: &[String]) -> isize { passes.into_iter().collect(), css_file_extension, renderinfo, - render_type) + render_type, + sort_modules_alphabetically, + deny_render_differences) .expect("failed to generate documentation"); 0 } @@ -423,7 +437,7 @@ fn print_error(error_message: T) where T: Display { /// Looks inside the command line arguments to extract the relevant input format /// and files and then generates the necessary rustdoc output for formatting. -fn acquire_input(input: &str, +fn acquire_input(input: PathBuf, externs: Externs, matches: &getopts::Matches, f: F) @@ -458,7 +472,7 @@ fn parse_externs(matches: &getopts::Matches) -> Result { /// generated from the cleaned AST of the crate. /// /// This form of input will run all of the plug/cleaning passes -fn rust_input(cratefile: &str, externs: Externs, matches: &getopts::Matches, f: F) -> R +fn rust_input(cratefile: PathBuf, externs: Externs, matches: &getopts::Matches, f: F) -> R where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { let mut default_passes = !matches.opt_present("no-defaults"); let mut passes = matches.opt_strs("passes"); @@ -470,7 +484,6 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { default_passes = false; passes = vec![ - String::from("strip-hidden"), String::from("collapse-docs"), String::from("unindent-comments"), ]; @@ -488,7 +501,6 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { let crate_version = matches.opt_str("crate-version"); let plugin_path = matches.opt_str("plugin-path"); - let cr = PathBuf::from(cratefile); info!("starting to run rustc"); let display_warnings = matches.opt_present("display-warnings"); @@ -501,7 +513,7 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R { use rustc::session::config::Input; let (mut krate, renderinfo) = - core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot, + core::run_core(paths, cfgs, externs, Input::File(cratefile), triple, maybe_sysroot, display_warnings, force_unstable_if_unmarked); info!("finished with rustc"); diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index fe6bd985bb..af93505293 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -17,12 +17,17 @@ use getopts; use testing; use rustc::session::search_paths::SearchPaths; use rustc::session::config::Externs; -use syntax::codemap::DUMMY_SP; +use syntax::codemap::{DUMMY_SP, FileName}; + +use clean::Span; use externalfiles::{ExternalHtml, LoadStringError, load_string}; -use html::render::reset_ids; +use html_diff; + +use html::render::{render_text, reset_ids}; use html::escape::Escape; +use html::render::render_difference; use html::markdown; use html::markdown::{Markdown, MarkdownWithToc, find_testable_code, old_find_testable_code}; use html::markdown::RenderType; @@ -49,11 +54,14 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) { /// Render `input` (e.g. "foo.md") into an HTML file in `output` /// (e.g. output = "bar" => "bar/foo.html"). -pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches, +pub fn render(input: &Path, mut output: PathBuf, matches: &getopts::Matches, external_html: &ExternalHtml, include_toc: bool, render_type: RenderType) -> isize { - let input_p = Path::new(input); - output.push(input_p.file_stem().unwrap()); + // Span used for markdown hoedown/pulldown differences. + let mut span = Span::empty(); + span.filename = FileName::Real(input.to_owned()); + + output.push(input.file_stem().unwrap()); output.set_extension("html"); let mut css = String::new(); @@ -89,12 +97,36 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches, reset_ids(false); - let rendered = if include_toc { - format!("{}", MarkdownWithToc(text, render_type)) + let (hoedown_output, pulldown_output) = if include_toc { + // Save the state of USED_ID_MAP so it only gets updated once even + // though we're rendering twice. + render_text(|ty| format!("{}", MarkdownWithToc(text, ty))) } else { - format!("{}", Markdown(text, render_type)) + // Save the state of USED_ID_MAP so it only gets updated once even + // though we're rendering twice. + render_text(|ty| format!("{}", Markdown(text, ty))) }; + let mut differences = html_diff::get_differences(&pulldown_output, &hoedown_output); + differences.retain(|s| { + match *s { + html_diff::Difference::NodeText { ref elem_text, + ref opposite_elem_text, + .. } + if elem_text.split_whitespace().eq(opposite_elem_text.split_whitespace()) => { + false + } + _ => true, + } + }); + + if !differences.is_empty() { + let mut intro_msg = false; + for diff in differences { + render_difference(&diff, &mut intro_msg, &span, text); + } + } + let err = write!( &mut out, r#" @@ -126,23 +158,23 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches, css = css, in_header = external_html.in_header, before_content = external_html.before_content, - text = rendered, + text = if render_type == RenderType::Pulldown { pulldown_output } else { hoedown_output }, after_content = external_html.after_content, - ); + ); match err { Err(e) => { eprintln!("rustdoc: cannot write to `{}`: {}", output.display(), e); 6 } - Ok(_) => 0 + Ok(_) => 0, } } /// Run any tests/code examples in the markdown file `input`. pub fn test(input: &str, cfgs: Vec, libs: SearchPaths, externs: Externs, mut test_args: Vec, maybe_sysroot: Option, - render_type: RenderType, display_warnings: bool, linker: Option) -> isize { + render_type: RenderType, display_warnings: bool, linker: Option) -> isize { let input_str = match load_string(input) { Ok(s) => s, Err(LoadStringError::ReadFail) => return 1, @@ -151,9 +183,9 @@ pub fn test(input: &str, cfgs: Vec, libs: SearchPaths, externs: Externs, let mut opts = TestOptions::default(); opts.no_crate_inject = true; - let mut collector = Collector::new(input.to_string(), cfgs, libs, externs, + let mut collector = Collector::new(input.to_owned(), cfgs, libs, externs, true, opts, maybe_sysroot, None, - Some(input.to_owned()), + Some(PathBuf::from(input)), render_type, linker); if render_type == RenderType::Pulldown { old_find_testable_code(&input_str, &mut collector, DUMMY_SP); diff --git a/src/librustdoc/passes/collapse_docs.rs b/src/librustdoc/passes/collapse_docs.rs index 3c63302127..a2d651d29d 100644 --- a/src/librustdoc/passes/collapse_docs.rs +++ b/src/librustdoc/passes/collapse_docs.rs @@ -8,10 +8,28 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use clean::{self, Item}; +use clean::{self, DocFragment, Item}; use plugins; use fold; use fold::DocFolder; +use std::mem::replace; + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +enum DocFragmentKind { + Sugared, + Raw, + Include, +} + +impl DocFragment { + fn kind(&self) -> DocFragmentKind { + match *self { + DocFragment::SugaredDoc(..) => DocFragmentKind::Sugared, + DocFragment::RawDoc(..) => DocFragmentKind::Raw, + DocFragment::Include(..) => DocFragmentKind::Include, + } + } +} pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult { Collapser.fold_crate(krate) @@ -26,15 +44,51 @@ impl fold::DocFolder for Collapser { } } -impl clean::Attributes { - pub fn collapse_doc_comments(&mut self) { - let mut doc_string = self.doc_strings.join("\n"); - if doc_string.is_empty() { - self.doc_strings = vec![]; +fn collapse(doc_strings: &mut Vec) { + let mut docs = vec![]; + let mut last_frag: Option = None; + + for frag in replace(doc_strings, vec![]) { + if let Some(mut curr_frag) = last_frag.take() { + let curr_kind = curr_frag.kind(); + let new_kind = frag.kind(); + + if curr_kind == DocFragmentKind::Include || curr_kind != new_kind { + match curr_frag { + DocFragment::SugaredDoc(_, _, ref mut doc_string) + | DocFragment::RawDoc(_, _, ref mut doc_string) => { + // add a newline for extra padding between segments + doc_string.push('\n'); + } + _ => {} + } + docs.push(curr_frag); + last_frag = Some(frag); + } else { + match curr_frag { + DocFragment::SugaredDoc(_, ref mut span, ref mut doc_string) + | DocFragment::RawDoc(_, ref mut span, ref mut doc_string) => { + doc_string.push('\n'); + doc_string.push_str(frag.as_str()); + *span = span.to(frag.span()); + } + _ => unreachable!(), + } + last_frag = Some(curr_frag); + } } else { - // FIXME(eddyb) Is this still needed? - doc_string.push('\n'); - self.doc_strings = vec![doc_string]; + last_frag = Some(frag); } } + + if let Some(frag) = last_frag.take() { + docs.push(frag); + } + *doc_strings = docs; +} + +impl clean::Attributes { + pub fn collapse_doc_comments(&mut self) { + collapse(&mut self.doc_strings); + } } diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 77d97c84c9..3e15d3d300 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -184,6 +184,15 @@ impl<'a> fold::DocFolder for ImplStripper<'a> { return None; } } + if let Some(generics) = imp.trait_.as_ref().and_then(|t| t.generics()) { + for typaram in generics { + if let Some(did) = typaram.def_id() { + if did.is_local() && !self.retained.contains(&did) { + return None; + } + } + } + } } self.fold_item_recur(i) } diff --git a/src/librustdoc/passes/unindent_comments.rs b/src/librustdoc/passes/unindent_comments.rs index 59fef8d202..912c7646a0 100644 --- a/src/librustdoc/passes/unindent_comments.rs +++ b/src/librustdoc/passes/unindent_comments.rs @@ -12,7 +12,7 @@ use std::cmp; use std::string::String; use std::usize; -use clean::{self, Item}; +use clean::{self, DocFragment, Item}; use plugins; use fold::{self, DocFolder}; @@ -31,8 +31,17 @@ impl fold::DocFolder for CommentCleaner { impl clean::Attributes { pub fn unindent_doc_comments(&mut self) { - for doc_string in &mut self.doc_strings { - *doc_string = unindent(doc_string); + unindent_fragments(&mut self.doc_strings); + } +} + +fn unindent_fragments(docs: &mut Vec) { + for fragment in docs { + match *fragment { + DocFragment::SugaredDoc(_, _, ref mut doc_string) | + DocFragment::RawDoc(_, _, ref mut doc_string) | + DocFragment::Include(_, _, _, ref mut doc_string) => + *doc_string = unindent(doc_string), } } } diff --git a/src/librustdoc/plugins.rs b/src/librustdoc/plugins.rs index 4fc5159588..1a1e60a694 100644 --- a/src/librustdoc/plugins.rs +++ b/src/librustdoc/plugins.rs @@ -16,7 +16,7 @@ use std::mem; use std::string::String; use std::path::PathBuf; -use rustc_back::dynamic_lib as dl; +use rustc_metadata::dynamic_lib as dl; pub type PluginResult = clean::Crate; pub type PluginCallback = fn (clean::Crate) -> PluginResult; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 9bbd16355b..8e861f10dd 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -27,11 +27,10 @@ use rustc::hir::intravisit; use rustc::session::{self, CompileIncomplete, config}; use rustc::session::config::{OutputType, OutputTypes, Externs}; use rustc::session::search_paths::{SearchPaths, PathKind}; -use rustc_back::dynamic_lib::DynamicLibrary; -use rustc_back::tempdir::TempDir; +use rustc_metadata::dynamic_lib::DynamicLibrary; +use tempdir::TempDir; use rustc_driver::{self, driver, Compilation}; use rustc_driver::driver::phase_2_configure_and_expand; -use rustc_driver::pretty::ReplaceBodyWithLoop; use rustc_metadata::cstore::CStore; use rustc_resolve::MakeGlobMap; use rustc_trans; @@ -39,8 +38,7 @@ use rustc_trans::back::link; use syntax::ast; use syntax::codemap::CodeMap; use syntax::feature_gate::UnstableFeatures; -use syntax::fold::Folder; -use syntax_pos::{BytePos, DUMMY_SP, Pos, Span}; +use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName}; use errors; use errors::emitter::ColorConfig; @@ -53,7 +51,7 @@ pub struct TestOptions { pub attrs: Vec, } -pub fn run(input: &str, +pub fn run(input_path: &Path, cfgs: Vec, libs: SearchPaths, externs: Externs, @@ -62,10 +60,9 @@ pub fn run(input: &str, maybe_sysroot: Option, render_type: RenderType, display_warnings: bool, - linker: Option) + linker: Option) -> isize { - let input_path = PathBuf::from(input); - let input = config::Input::File(input_path.clone()); + let input = config::Input::File(input_path.to_owned()); let sessopts = config::Options { maybe_sysroot: maybe_sysroot.clone().or_else( @@ -81,11 +78,13 @@ pub fn run(input: &str, let codemap = Rc::new(CodeMap::new(sessopts.file_path_mapping())); let handler = - errors::Handler::with_tty_emitter(ColorConfig::Auto, true, false, Some(codemap.clone())); + errors::Handler::with_tty_emitter(ColorConfig::Auto, + true, false, + Some(codemap.clone())); let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader)); let mut sess = session::build_session_( - sessopts, Some(input_path.clone()), handler, codemap.clone(), + sessopts, Some(input_path.to_owned()), handler, codemap.clone(), ); rustc_trans::init(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); @@ -95,7 +94,6 @@ pub fn run(input: &str, let krate = panictry!(driver::phase_1_parse_input(&driver::CompileController::basic(), &sess, &input)); - let krate = ReplaceBodyWithLoop::new().fold_crate(krate); let driver::ExpansionResult { defs, mut hir_forest, .. } = { phase_2_configure_and_expand( &sess, @@ -178,12 +176,12 @@ fn scrape_test_config(krate: &::rustc::hir::Crate) -> TestOptions { opts } -fn run_test(test: &str, cratename: &str, filename: &str, cfgs: Vec, libs: SearchPaths, +fn run_test(test: &str, cratename: &str, filename: &FileName, cfgs: Vec, libs: SearchPaths, externs: Externs, should_panic: bool, no_run: bool, as_test_harness: bool, compile_fail: bool, mut error_codes: Vec, opts: &TestOptions, maybe_sysroot: Option, - linker: Option) { + linker: Option) { // the test harness wants its own `main` & top level functions, so // never wrap the test in `fn main() { ... }` let test = make_test(test, Some(cratename), as_test_harness, opts); @@ -265,7 +263,7 @@ fn run_test(test: &str, cratename: &str, filename: &str, cfgs: Vec, libs } let res = panic::catch_unwind(AssertUnwindSafe(|| { - driver::compile_input(&sess, &cstore, &input, &out, &None, None, &control) + driver::compile_input(&sess, &cstore, &None, &input, &out, &None, None, &control) })); let compile_result = match res { @@ -452,17 +450,17 @@ pub struct Collector { maybe_sysroot: Option, position: Span, codemap: Option>, - filename: Option, + filename: Option, // to be removed when hoedown will be removed as well pub render_type: RenderType, - linker: Option, + linker: Option, } impl Collector { pub fn new(cratename: String, cfgs: Vec, libs: SearchPaths, externs: Externs, use_headers: bool, opts: TestOptions, maybe_sysroot: Option, - codemap: Option>, filename: Option, - render_type: RenderType, linker: Option) -> Collector { + codemap: Option>, filename: Option, + render_type: RenderType, linker: Option) -> Collector { Collector { tests: Vec::new(), old_tests: HashMap::new(), @@ -482,16 +480,16 @@ impl Collector { } } - fn generate_name(&self, line: usize, filename: &str) -> String { + fn generate_name(&self, line: usize, filename: &FileName) -> String { format!("{} - {} (line {})", filename, self.names.join("::"), line) } // to be removed once hoedown is gone - fn generate_name_beginning(&self, filename: &str) -> String { + fn generate_name_beginning(&self, filename: &FileName) -> String { format!("{} - {} (line", filename, self.names.join("::")) } - pub fn add_old_test(&mut self, test: String, filename: String) { + pub fn add_old_test(&mut self, test: String, filename: FileName) { let name_beg = self.generate_name_beginning(&filename); let entry = self.old_tests.entry(name_beg) .or_insert(Vec::new()); @@ -501,7 +499,7 @@ impl Collector { pub fn add_test(&mut self, test: String, should_panic: bool, no_run: bool, should_ignore: bool, as_test_harness: bool, compile_fail: bool, error_codes: Vec, - line: usize, filename: String, allow_fail: bool) { + line: usize, filename: FileName, allow_fail: bool) { let name = self.generate_name(line, &filename); // to be removed when hoedown is removed if self.render_type == RenderType::Pulldown { @@ -535,7 +533,7 @@ impl Collector { should_panic: testing::ShouldPanic::No, allow_fail, }, - testfn: testing::DynTestFn(box move |()| { + testfn: testing::DynTestFn(box move || { let panic = io::set_panic(None); let print = io::set_print(None); match { @@ -579,21 +577,21 @@ impl Collector { self.position = position; } - pub fn get_filename(&self) -> String { + pub fn get_filename(&self) -> FileName { if let Some(ref codemap) = self.codemap { let filename = codemap.span_to_filename(self.position); - if let Ok(cur_dir) = env::current_dir() { - if let Ok(path) = Path::new(&filename).strip_prefix(&cur_dir) { - if let Some(path) = path.to_str() { - return path.to_owned(); + if let FileName::Real(ref filename) = filename { + if let Ok(cur_dir) = env::current_dir() { + if let Ok(path) = filename.strip_prefix(&cur_dir) { + return path.to_owned().into(); } } } filename } else if let Some(ref filename) = self.filename { - filename.clone() + filename.clone().into() } else { - "".to_owned() + FileName::Custom("input".to_owned()) } } @@ -661,14 +659,16 @@ impl<'a, 'hir> HirCollector<'a, 'hir> { attrs.collapse_doc_comments(); attrs.unindent_doc_comments(); - if let Some(doc) = attrs.doc_value() { + // the collapse-docs pass won't combine sugared/raw doc attributes, or included files with + // anything else, this will combine them for us + if let Some(doc) = attrs.collapsed_doc_value() { if self.collector.render_type == RenderType::Pulldown { - markdown::old_find_testable_code(doc, self.collector, + markdown::old_find_testable_code(&doc, self.collector, attrs.span.unwrap_or(DUMMY_SP)); - markdown::find_testable_code(doc, self.collector, + markdown::find_testable_code(&doc, self.collector, attrs.span.unwrap_or(DUMMY_SP)); } else { - markdown::old_find_testable_code(doc, self.collector, + markdown::old_find_testable_code(&doc, self.collector, attrs.span.unwrap_or(DUMMY_SP)); } } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index b55076a01a..be78935cad 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -306,6 +306,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { Def::Struct(did) | Def::Union(did) | Def::Enum(did) | + Def::TyForeign(did) | Def::TyAlias(did) if !self_is_hidden => { self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public); }, @@ -348,6 +349,17 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { self.inlining = prev; true } + hir_map::NodeForeignItem(it) if !glob => { + // generate a fresh `extern {}` block if we want to inline a foreign item. + om.foreigns.push(hir::ForeignMod { + abi: tcx.hir.get_foreign_abi(it.id), + items: vec![hir::ForeignItem { + name: renamed.unwrap_or(it.name), + .. it.clone() + }].into(), + }); + true + } _ => false, }; self.view_item_stack.remove(&def_node_id); @@ -500,6 +512,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { }; om.traits.push(t); }, + hir::ItemTraitAlias(..) => { + unimplemented!("trait objects are not yet implemented") + }, hir::ItemImpl(unsafety, polarity, diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index 9f75388238..2fd47fa0a6 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -68,7 +68,9 @@ impl<'a, 'b, 'tcx> LibEmbargoVisitor<'a, 'b, 'tcx> { } for item in self.cx.tcx.item_children(def_id).iter() { - self.visit_item(item.def); + if !item.is_import || item.vis == Visibility::Public { + self.visit_item(item.def); + } } } diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs index 1a99527693..3a05cb7187 100644 --- a/src/libserialize/collection_impls.rs +++ b/src/libserialize/collection_impls.rs @@ -14,6 +14,8 @@ use std::hash::{Hash, BuildHasher}; use {Decodable, Encodable, Decoder, Encoder}; use std::collections::{LinkedList, VecDeque, BTreeMap, BTreeSet, HashMap, HashSet}; +use std::rc::Rc; +use std::sync::Arc; impl< T: Encodable @@ -194,3 +196,49 @@ impl Decodable for HashSet }) } } + +impl Encodable for Rc<[T]> { + fn encode(&self, s: &mut E) -> Result<(), E::Error> { + s.emit_seq(self.len(), |s| { + for (index, e) in self.iter().enumerate() { + s.emit_seq_elt(index, |s| e.encode(s))?; + } + Ok(()) + }) + } +} + +impl Decodable for Rc<[T]> { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_seq(|d, len| { + let mut vec = Vec::with_capacity(len); + for index in 0..len { + vec.push(d.read_seq_elt(index, |d| Decodable::decode(d))?); + } + Ok(vec.into()) + }) + } +} + +impl Encodable for Arc<[T]> { + fn encode(&self, s: &mut E) -> Result<(), E::Error> { + s.emit_seq(self.len(), |s| { + for (index, e) in self.iter().enumerate() { + s.emit_seq_elt(index, |s| e.encode(s))?; + } + Ok(()) + }) + } +} + +impl Decodable for Arc<[T]> { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_seq(|d, len| { + let mut vec = Vec::with_capacity(len); + for index in 0..len { + vec.push(d.read_seq_elt(index, |d| Decodable::decode(d))?); + } + Ok(vec.into()) + }) + } +} diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 5e1c09641e..efdad7d801 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1052,10 +1052,7 @@ impl Json { pub fn find_path<'a>(&'a self, keys: &[&str]) -> Option<&'a Json>{ let mut target = self; for key in keys { - match target.find(*key) { - Some(t) => { target = t; }, - None => return None - } + target = target.find(*key)?; } Some(target) } diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index f3475bd18c..99557659b2 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -162,6 +162,10 @@ impl<'a> Decoder<'a> { self.position } + pub fn set_position(&mut self, pos: usize) { + self.position = pos + } + pub fn advance(&mut self, bytes: usize) { self.position += bytes; } diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index 6d67bbc06c..854ca4eb3b 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -618,6 +618,54 @@ impl Decodable for Option { } } +impl Encodable for Result { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + s.emit_enum("Result", |s| { + match *self { + Ok(ref v) => { + s.emit_enum_variant("Ok", 0, 1, |s| { + s.emit_enum_variant_arg(0, |s| { + v.encode(s) + }) + }) + } + Err(ref v) => { + s.emit_enum_variant("Err", 1, 1, |s| { + s.emit_enum_variant_arg(0, |s| { + v.encode(s) + }) + }) + } + } + }) + } +} + +impl Decodable for Result { + fn decode(d: &mut D) -> Result, D::Error> { + d.read_enum("Result", |d| { + d.read_enum_variant(&["Ok", "Err"], |d, disr| { + match disr { + 0 => { + Ok(Ok(d.read_enum_variant_arg(0, |d| { + T1::decode(d) + })?)) + } + 1 => { + Ok(Err(d.read_enum_variant_arg(0, |d| { + T2::decode(d) + })?)) + } + _ => { + panic!("Encountered invalid discriminant while \ + decoding `Result`."); + } + } + }) + }) + } +} + macro_rules! peel { ($name:ident, $($other:ident,)*) => (tuple! { $($other,)* }) } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 96d719c528..82e1a3447d 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -247,7 +247,7 @@ pub trait AsciiExt { /// Checks if the value is an ASCII graphic character: /// U+0021 '@' ... U+007E '~'. /// For strings, true if all characters in the string are - /// ASCII punctuation. + /// ASCII graphic characters. /// /// # Note /// @@ -298,146 +298,83 @@ pub trait AsciiExt { fn is_ascii_control(&self) -> bool { unimplemented!(); } } -// FIXME(LukasKalbertodt): this impl block can be removed in the future. This is -// possible once the stage0 compiler is new enough to contain the inherent -// ascii methods for `[str]`. See FIXME comment further down. -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -impl AsciiExt for str { - type Owned = String; +macro_rules! delegating_ascii_methods { + () => { + #[inline] + fn is_ascii(&self) -> bool { self.is_ascii() } - #[inline] - fn is_ascii(&self) -> bool { - self.bytes().all(|b| b.is_ascii()) - } + #[inline] + fn to_ascii_uppercase(&self) -> Self::Owned { self.to_ascii_uppercase() } - #[inline] - fn to_ascii_uppercase(&self) -> String { - let mut bytes = self.as_bytes().to_vec(); - bytes.make_ascii_uppercase(); - // make_ascii_uppercase() preserves the UTF-8 invariant. - unsafe { String::from_utf8_unchecked(bytes) } - } + #[inline] + fn to_ascii_lowercase(&self) -> Self::Owned { self.to_ascii_lowercase() } - #[inline] - fn to_ascii_lowercase(&self) -> String { - let mut bytes = self.as_bytes().to_vec(); - bytes.make_ascii_lowercase(); - // make_ascii_uppercase() preserves the UTF-8 invariant. - unsafe { String::from_utf8_unchecked(bytes) } - } + #[inline] + fn eq_ignore_ascii_case(&self, o: &Self) -> bool { self.eq_ignore_ascii_case(o) } - #[inline] - fn eq_ignore_ascii_case(&self, other: &str) -> bool { - self.as_bytes().eq_ignore_ascii_case(other.as_bytes()) - } + #[inline] + fn make_ascii_uppercase(&mut self) { self.make_ascii_uppercase(); } - fn make_ascii_uppercase(&mut self) { - let me = unsafe { self.as_bytes_mut() }; - me.make_ascii_uppercase() - } - - fn make_ascii_lowercase(&mut self) { - let me = unsafe { self.as_bytes_mut() }; - me.make_ascii_lowercase() - } - - #[inline] - fn is_ascii_alphabetic(&self) -> bool { - self.bytes().all(|b| b.is_ascii_alphabetic()) - } - - #[inline] - fn is_ascii_uppercase(&self) -> bool { - self.bytes().all(|b| b.is_ascii_uppercase()) - } - - #[inline] - fn is_ascii_lowercase(&self) -> bool { - self.bytes().all(|b| b.is_ascii_lowercase()) - } - - #[inline] - fn is_ascii_alphanumeric(&self) -> bool { - self.bytes().all(|b| b.is_ascii_alphanumeric()) - } - - #[inline] - fn is_ascii_digit(&self) -> bool { - self.bytes().all(|b| b.is_ascii_digit()) - } - - #[inline] - fn is_ascii_hexdigit(&self) -> bool { - self.bytes().all(|b| b.is_ascii_hexdigit()) - } - - #[inline] - fn is_ascii_punctuation(&self) -> bool { - self.bytes().all(|b| b.is_ascii_punctuation()) - } - - #[inline] - fn is_ascii_graphic(&self) -> bool { - self.bytes().all(|b| b.is_ascii_graphic()) - } - - #[inline] - fn is_ascii_whitespace(&self) -> bool { - self.bytes().all(|b| b.is_ascii_whitespace()) - } - - #[inline] - fn is_ascii_control(&self) -> bool { - self.bytes().all(|b| b.is_ascii_control()) + #[inline] + fn make_ascii_lowercase(&mut self) { self.make_ascii_lowercase(); } } } -// FIXME(LukasKalbertodt): this impl block can be removed in the future. This is -// possible once the stage0 compiler is new enough to contain the inherent -// ascii methods for `[u8]`. See FIXME comment further down. -#[cfg(stage0)] +macro_rules! delegating_ascii_ctype_methods { + () => { + #[inline] + fn is_ascii_alphabetic(&self) -> bool { self.is_ascii_alphabetic() } + + #[inline] + fn is_ascii_uppercase(&self) -> bool { self.is_ascii_uppercase() } + + #[inline] + fn is_ascii_lowercase(&self) -> bool { self.is_ascii_lowercase() } + + #[inline] + fn is_ascii_alphanumeric(&self) -> bool { self.is_ascii_alphanumeric() } + + #[inline] + fn is_ascii_digit(&self) -> bool { self.is_ascii_digit() } + + #[inline] + fn is_ascii_hexdigit(&self) -> bool { self.is_ascii_hexdigit() } + + #[inline] + fn is_ascii_punctuation(&self) -> bool { self.is_ascii_punctuation() } + + #[inline] + fn is_ascii_graphic(&self) -> bool { self.is_ascii_graphic() } + + #[inline] + fn is_ascii_whitespace(&self) -> bool { self.is_ascii_whitespace() } + + #[inline] + fn is_ascii_control(&self) -> bool { self.is_ascii_control() } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl AsciiExt for u8 { + type Owned = u8; + + delegating_ascii_methods!(); + delegating_ascii_ctype_methods!(); +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl AsciiExt for char { + type Owned = char; + + delegating_ascii_methods!(); + delegating_ascii_ctype_methods!(); +} + #[stable(feature = "rust1", since = "1.0.0")] impl AsciiExt for [u8] { type Owned = Vec; - #[inline] - fn is_ascii(&self) -> bool { - self.iter().all(|b| b.is_ascii()) - } - #[inline] - fn to_ascii_uppercase(&self) -> Vec { - let mut me = self.to_vec(); - me.make_ascii_uppercase(); - return me - } - - #[inline] - fn to_ascii_lowercase(&self) -> Vec { - let mut me = self.to_vec(); - me.make_ascii_lowercase(); - return me - } - - #[inline] - fn eq_ignore_ascii_case(&self, other: &[u8]) -> bool { - self.len() == other.len() && - self.iter().zip(other).all(|(a, b)| { - a.eq_ignore_ascii_case(b) - }) - } - - fn make_ascii_uppercase(&mut self) { - for byte in self { - byte.make_ascii_uppercase(); - } - } - - fn make_ascii_lowercase(&mut self) { - for byte in self { - byte.make_ascii_lowercase(); - } - } + delegating_ascii_methods!(); #[inline] fn is_ascii_alphabetic(&self) -> bool { @@ -490,78 +427,63 @@ impl AsciiExt for [u8] { } } -macro_rules! impl_by_delegating { - ($ty:ty, $owned:ty) => { - #[stable(feature = "rust1", since = "1.0.0")] - impl AsciiExt for $ty { - type Owned = $owned; +#[stable(feature = "rust1", since = "1.0.0")] +impl AsciiExt for str { + type Owned = String; - #[inline] - fn is_ascii(&self) -> bool { self.is_ascii() } + delegating_ascii_methods!(); - #[inline] - fn to_ascii_uppercase(&self) -> Self::Owned { self.to_ascii_uppercase() } + #[inline] + fn is_ascii_alphabetic(&self) -> bool { + self.bytes().all(|b| b.is_ascii_alphabetic()) + } - #[inline] - fn to_ascii_lowercase(&self) -> Self::Owned { self.to_ascii_lowercase() } + #[inline] + fn is_ascii_uppercase(&self) -> bool { + self.bytes().all(|b| b.is_ascii_uppercase()) + } - #[inline] - fn eq_ignore_ascii_case(&self, o: &Self) -> bool { self.eq_ignore_ascii_case(o) } + #[inline] + fn is_ascii_lowercase(&self) -> bool { + self.bytes().all(|b| b.is_ascii_lowercase()) + } - #[inline] - fn make_ascii_uppercase(&mut self) { self.make_ascii_uppercase(); } + #[inline] + fn is_ascii_alphanumeric(&self) -> bool { + self.bytes().all(|b| b.is_ascii_alphanumeric()) + } - #[inline] - fn make_ascii_lowercase(&mut self) { self.make_ascii_lowercase(); } + #[inline] + fn is_ascii_digit(&self) -> bool { + self.bytes().all(|b| b.is_ascii_digit()) + } - #[inline] - fn is_ascii_alphabetic(&self) -> bool { self.is_ascii_alphabetic() } + #[inline] + fn is_ascii_hexdigit(&self) -> bool { + self.bytes().all(|b| b.is_ascii_hexdigit()) + } - #[inline] - fn is_ascii_uppercase(&self) -> bool { self.is_ascii_uppercase() } + #[inline] + fn is_ascii_punctuation(&self) -> bool { + self.bytes().all(|b| b.is_ascii_punctuation()) + } - #[inline] - fn is_ascii_lowercase(&self) -> bool { self.is_ascii_lowercase() } + #[inline] + fn is_ascii_graphic(&self) -> bool { + self.bytes().all(|b| b.is_ascii_graphic()) + } - #[inline] - fn is_ascii_alphanumeric(&self) -> bool { self.is_ascii_alphanumeric() } + #[inline] + fn is_ascii_whitespace(&self) -> bool { + self.bytes().all(|b| b.is_ascii_whitespace()) + } - #[inline] - fn is_ascii_digit(&self) -> bool { self.is_ascii_digit() } - - #[inline] - fn is_ascii_hexdigit(&self) -> bool { self.is_ascii_hexdigit() } - - #[inline] - fn is_ascii_punctuation(&self) -> bool { self.is_ascii_punctuation() } - - #[inline] - fn is_ascii_graphic(&self) -> bool { self.is_ascii_graphic() } - - #[inline] - fn is_ascii_whitespace(&self) -> bool { self.is_ascii_whitespace() } - - #[inline] - fn is_ascii_control(&self) -> bool { self.is_ascii_control() } - } + #[inline] + fn is_ascii_control(&self) -> bool { + self.bytes().all(|b| b.is_ascii_control()) } } -impl_by_delegating!(u8, u8); -impl_by_delegating!(char, char); - -// FIXME(LukasKalbertodt): the macro invocation should replace the impl block -// for `[u8]` above. But this is not possible until the stage0 compiler is new -// enough to contain the inherent ascii methods for `[u8]`. -#[cfg(not(stage0))] -impl_by_delegating!([u8], Vec); - -// FIXME(LukasKalbertodt): the macro invocation should replace the impl block -// for `str` above. But this is not possible until the stage0 compiler is new -// enough to contain the inherent ascii methods for `str`. -#[cfg(not(stage0))] -impl_by_delegating!(str, String); - /// An iterator over the escaped version of a byte. /// /// This `struct` is created by the [`escape_default`] function. See its @@ -684,6 +606,7 @@ mod tests { //! Note that most of these tests are not testing `AsciiExt` methods, but //! test inherent ascii methods of char, u8, str and [u8]. `AsciiExt` is //! just using those methods, though. + use super::AsciiExt; use char::from_u32; #[test] diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 06f11c8deb..a41c155f3f 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -14,15 +14,16 @@ extern crate build_helper; use std::env; use std::process::Command; -use build_helper::{run, native_lib_boilerplate, BuildExpectation}; +use build_helper::{run, native_lib_boilerplate}; fn main() { let target = env::var("TARGET").expect("TARGET was not set"); let host = env::var("HOST").expect("HOST was not set"); if cfg!(feature = "backtrace") && - !target.contains("msvc") && + !target.contains("cloudabi") && !target.contains("emscripten") && !target.contains("fuchsia") && + !target.contains("msvc") && !target.contains("wasm32") { let _ = build_libbacktrace(&host, &target); @@ -74,6 +75,12 @@ fn main() { println!("cargo:rustc-link-lib=zircon"); println!("cargo:rustc-link-lib=fdio"); println!("cargo:rustc-link-lib=launchpad"); // for std::process + } else if target.contains("cloudabi") { + if cfg!(feature = "backtrace") { + println!("cargo:rustc-link-lib=unwind"); + } + println!("cargo:rustc-link-lib=c"); + println!("cargo:rustc-link-lib=compiler_rt"); } } @@ -91,14 +98,11 @@ fn build_libbacktrace(host: &str, target: &str) -> Result<(), ()> { .arg("--disable-host-shared") .arg(format!("--host={}", build_helper::gnu_target(target))) .arg(format!("--build={}", build_helper::gnu_target(host))) - .env("CFLAGS", env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden"), - BuildExpectation::None); + .env("CFLAGS", env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden")); run(Command::new(build_helper::make(host)) .current_dir(&native.out_dir) .arg(format!("INCDIR={}", native.src_dir.display())) - .arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")), - BuildExpectation::None); - + .arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set"))); Ok(()) } diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 51698ce7c1..7f0e5a8d2a 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1152,13 +1152,9 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S> fn next(&mut self) -> Option<&'a T> { loop { - match self.iter.next() { - None => return None, - Some(elt) => { - if self.other.contains(elt) { - return Some(elt); - } - } + let elt = self.iter.next()?; + if self.other.contains(elt) { + return Some(elt); } } } @@ -1202,13 +1198,9 @@ impl<'a, T, S> Iterator for Difference<'a, T, S> fn next(&mut self) -> Option<&'a T> { loop { - match self.iter.next() { - None => return None, - Some(elt) => { - if !self.other.contains(elt) { - return Some(elt); - } - } + let elt = self.iter.next()?; + if !self.other.contains(elt) { + return Some(elt); } } } diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 7e623a0af1..96f98efe4a 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -123,9 +123,6 @@ pub struct RawTable { marker: marker::PhantomData<(K, V)>, } -unsafe impl Send for RawTable {} -unsafe impl Sync for RawTable {} - // An unsafe view of a RawTable bucket // Valid indexes are within [0..table_capacity) pub struct RawBucket { diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 231b0be927..eb5022ad57 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -234,7 +234,7 @@ impl<'a> From> for Box { } } -#[unstable(feature = "never_type_impls", issue = "35121")] +#[unstable(feature = "never_type", issue = "35121")] impl Error for ! { fn description(&self) -> &str { *self } } diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 14f0edc369..6d76c7e722 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -9,10 +9,11 @@ // except according to those terms. //! This module provides constants which are specific to the implementation -//! of the `f32` floating point data type. Mathematically significant -//! numbers are provided in the `consts` sub-module. +//! of the `f32` floating point data type. //! -//! *[See also the `f32` primitive type](../primitive.f32.html).* +//! Mathematically significant numbers are provided in the `consts` sub-module. +//! +//! *[See also the `f32` primitive type](../../std/primitive.f32.html).* #![stable(feature = "rust1", since = "1.0.0")] #![allow(missing_docs)] @@ -997,10 +998,13 @@ impl f32 { /// Raw transmutation to `u32`. /// - /// Converts the `f32` into its raw memory representation, - /// similar to the `transmute` function. + /// This is currently identical to `transmute::(self)` on all platforms. /// - /// Note that this function is distinct from casting. + /// See `from_bits` for some discussion of the portability of this operation + /// (there are almost no issues). + /// + /// Note that this function is distinct from `as` casting, which attempts to + /// preserve the *numeric* value, and not the bitwise value. /// /// # Examples /// @@ -1017,17 +1021,33 @@ impl f32 { /// Raw transmutation from `u32`. /// - /// Converts the given `u32` containing the float's raw memory - /// representation into the `f32` type, similar to the - /// `transmute` function. + /// This is currently identical to `transmute::(v)` on all platforms. + /// It turns out this is incredibly portable, for two reasons: /// - /// There is only one difference to a bare `transmute`: - /// Due to the implications onto Rust's safety promises being - /// uncertain, if the representation of a signaling NaN "sNaN" float - /// is passed to the function, the implementation is allowed to - /// return a quiet NaN instead. + /// * Floats and Ints have the same endianess on all supported platforms. + /// * IEEE-754 very precisely specifies the bit layout of floats. /// - /// Note that this function is distinct from casting. + /// However there is one caveat: prior to the 2008 version of IEEE-754, how + /// to interpret the NaN signaling bit wasn't actually specified. Most platforms + /// (notably x86 and ARM) picked the interpretation that was ultimately + /// standardized in 2008, but some didn't (notably MIPS). As a result, all + /// signaling NaNs on MIPS are quiet NaNs on x86, and vice-versa. + /// + /// Rather than trying to preserve signaling-ness cross-platform, this + /// implementation favours preserving the exact bits. This means that + /// any payloads encoded in NaNs will be preserved even if the result of + /// this method is sent over the network from an x86 machine to a MIPS one. + /// + /// If the results of this method are only manipulated by the same + /// architecture that produced them, then there is no portability concern. + /// + /// If the input isn't NaN, then there is no portability concern. + /// + /// If you don't care about signalingness (very likely), then there is no + /// portability concern. + /// + /// Note that this function is distinct from `as` casting, which attempts to + /// preserve the *numeric* value, and not the bitwise value. /// /// # Examples /// @@ -1036,25 +1056,11 @@ impl f32 { /// let v = f32::from_bits(0x41480000); /// let difference = (v - 12.5).abs(); /// assert!(difference <= 1e-5); - /// // Example for a signaling NaN value: - /// let snan = 0x7F800001; - /// assert_ne!(f32::from_bits(snan).to_bits(), snan); /// ``` #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] - pub fn from_bits(mut v: u32) -> Self { - const EXP_MASK: u32 = 0x7F800000; - const FRACT_MASK: u32 = 0x007FFFFF; - if v & EXP_MASK == EXP_MASK && v & FRACT_MASK != 0 { - // While IEEE 754-2008 specifies encodings for quiet NaNs - // and signaling ones, certain MIPS and PA-RISC - // CPUs treat signaling NaNs differently. - // Therefore to be safe, we pass a known quiet NaN - // if v is any kind of NaN. - // The check above only assumes IEEE 754-1985 to be - // valid. - v = unsafe { ::mem::transmute(NAN) }; - } + pub fn from_bits(v: u32) -> Self { + // It turns out the safety issues with sNaN were overblown! Hooray! unsafe { ::mem::transmute(v) } } } @@ -1645,25 +1651,15 @@ mod tests { assert_approx_eq!(f32::from_bits(0x41480000), 12.5); assert_approx_eq!(f32::from_bits(0x44a72000), 1337.0); assert_approx_eq!(f32::from_bits(0xc1640000), -14.25); - } - #[test] - fn test_snan_masking() { - // NOTE: this test assumes that our current platform - // implements IEEE 754-2008 that specifies the difference - // in encoding of quiet and signaling NaNs. - // If you are porting Rust to a platform that does not - // implement IEEE 754-2008 (but e.g. IEEE 754-1985, which - // only says that "Signaling NaNs shall be reserved operands" - // but doesn't specify the actual setup), feel free to - // cfg out this test. - let snan: u32 = 0x7F801337; - const QNAN_MASK: u32 = 0x00400000; - let nan_masked_fl = f32::from_bits(snan); - let nan_masked = nan_masked_fl.to_bits(); - // Ensure that signaling NaNs don't stay the same - assert_ne!(nan_masked, snan); - // Ensure that we have a quiet NaN - assert_ne!(nan_masked & QNAN_MASK, 0); - assert!(nan_masked_fl.is_nan()); + + // Check that NaNs roundtrip their bits regardless of signalingness + // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits + let masked_nan1 = f32::NAN.to_bits() ^ 0x002A_AAAA; + let masked_nan2 = f32::NAN.to_bits() ^ 0x0055_5555; + assert!(f32::from_bits(masked_nan1).is_nan()); + assert!(f32::from_bits(masked_nan2).is_nan()); + + assert_eq!(f32::from_bits(masked_nan1).to_bits(), masked_nan1); + assert_eq!(f32::from_bits(masked_nan2).to_bits(), masked_nan2); } } diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index e0f0acc6ac..dee9566f1f 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -9,10 +9,11 @@ // except according to those terms. //! This module provides constants which are specific to the implementation -//! of the `f64` floating point data type. Mathematically significant -//! numbers are provided in the `consts` sub-module. +//! of the `f64` floating point data type. //! -//! *[See also the `f64` primitive type](../primitive.f64.html).* +//! Mathematically significant numbers are provided in the `consts` sub-module. +//! +//! *[See also the `f64` primitive type](../../std/primitive.f64.html).* #![stable(feature = "rust1", since = "1.0.0")] #![allow(missing_docs)] @@ -952,10 +953,13 @@ impl f64 { /// Raw transmutation to `u64`. /// - /// Converts the `f64` into its raw memory representation, - /// similar to the `transmute` function. + /// This is currently identical to `transmute::(self)` on all platforms. /// - /// Note that this function is distinct from casting. + /// See `from_bits` for some discussion of the portability of this operation + /// (there are almost no issues). + /// + /// Note that this function is distinct from `as` casting, which attempts to + /// preserve the *numeric* value, and not the bitwise value. /// /// # Examples /// @@ -972,17 +976,33 @@ impl f64 { /// Raw transmutation from `u64`. /// - /// Converts the given `u64` containing the float's raw memory - /// representation into the `f64` type, similar to the - /// `transmute` function. + /// This is currently identical to `transmute::(v)` on all platforms. + /// It turns out this is incredibly portable, for two reasons: /// - /// There is only one difference to a bare `transmute`: - /// Due to the implications onto Rust's safety promises being - /// uncertain, if the representation of a signaling NaN "sNaN" float - /// is passed to the function, the implementation is allowed to - /// return a quiet NaN instead. + /// * Floats and Ints have the same endianess on all supported platforms. + /// * IEEE-754 very precisely specifies the bit layout of floats. /// - /// Note that this function is distinct from casting. + /// However there is one caveat: prior to the 2008 version of IEEE-754, how + /// to interpret the NaN signaling bit wasn't actually specified. Most platforms + /// (notably x86 and ARM) picked the interpretation that was ultimately + /// standardized in 2008, but some didn't (notably MIPS). As a result, all + /// signaling NaNs on MIPS are quiet NaNs on x86, and vice-versa. + /// + /// Rather than trying to preserve signaling-ness cross-platform, this + /// implementation favours preserving the exact bits. This means that + /// any payloads encoded in NaNs will be preserved even if the result of + /// this method is sent over the network from an x86 machine to a MIPS one. + /// + /// If the results of this method are only manipulated by the same + /// architecture that produced them, then there is no portability concern. + /// + /// If the input isn't NaN, then there is no portability concern. + /// + /// If you don't care about signalingness (very likely), then there is no + /// portability concern. + /// + /// Note that this function is distinct from `as` casting, which attempts to + /// preserve the *numeric* value, and not the bitwise value. /// /// # Examples /// @@ -991,25 +1011,11 @@ impl f64 { /// let v = f64::from_bits(0x4029000000000000); /// let difference = (v - 12.5).abs(); /// assert!(difference <= 1e-5); - /// // Example for a signaling NaN value: - /// let snan = 0x7FF0000000000001; - /// assert_ne!(f64::from_bits(snan).to_bits(), snan); /// ``` #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] - pub fn from_bits(mut v: u64) -> Self { - const EXP_MASK: u64 = 0x7FF0000000000000; - const FRACT_MASK: u64 = 0x000FFFFFFFFFFFFF; - if v & EXP_MASK == EXP_MASK && v & FRACT_MASK != 0 { - // While IEEE 754-2008 specifies encodings for quiet NaNs - // and signaling ones, certain MIPS and PA-RISC - // CPUs treat signaling NaNs differently. - // Therefore to be safe, we pass a known quiet NaN - // if v is any kind of NaN. - // The check above only assumes IEEE 754-1985 to be - // valid. - v = unsafe { ::mem::transmute(NAN) }; - } + pub fn from_bits(v: u64) -> Self { + // It turns out the safety issues with sNaN were overblown! Hooray! unsafe { ::mem::transmute(v) } } } @@ -1596,5 +1602,15 @@ mod tests { assert_approx_eq!(f64::from_bits(0x4029000000000000), 12.5); assert_approx_eq!(f64::from_bits(0x4094e40000000000), 1337.0); assert_approx_eq!(f64::from_bits(0xc02c800000000000), -14.25); + + // Check that NaNs roundtrip their bits regardless of signalingness + // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits + let masked_nan1 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA; + let masked_nan2 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; + assert!(f64::from_bits(masked_nan1).is_nan()); + assert!(f64::from_bits(masked_nan2).is_nan()); + + assert_eq!(f64::from_bits(masked_nan1).to_bits(), masked_nan1); + assert_eq!(f64::from_bits(masked_nan2).to_bits(), masked_nan2); } } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 1aa47f066b..a2022a2eeb 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -19,8 +19,10 @@ use memchr; use ops; use os::raw::c_char; use ptr; +use rc::Rc; use slice; use str::{self, Utf8Error}; +use sync::Arc; use sys; /// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the @@ -704,6 +706,42 @@ impl From for Box { } } +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl From for Arc { + #[inline] + fn from(s: CString) -> Arc { + let arc: Arc<[u8]> = Arc::from(s.into_inner()); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const CStr) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl<'a> From<&'a CStr> for Arc { + #[inline] + fn from(s: &CStr) -> Arc { + let arc: Arc<[u8]> = Arc::from(s.to_bytes_with_nul()); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const CStr) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl From for Rc { + #[inline] + fn from(s: CString) -> Rc { + let rc: Rc<[u8]> = Rc::from(s.into_inner()); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const CStr) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl<'a> From<&'a CStr> for Rc { + #[inline] + fn from(s: &CStr) -> Rc { + let rc: Rc<[u8]> = Rc::from(s.to_bytes_with_nul()); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const CStr) } + } +} + #[stable(feature = "default_box_extra", since = "1.17.0")] impl Default for Box { fn default() -> Box { @@ -1201,6 +1239,8 @@ mod tests { use borrow::Cow::{Borrowed, Owned}; use hash::{Hash, Hasher}; use collections::hash_map::DefaultHasher; + use rc::Rc; + use sync::Arc; #[test] fn c_to_rust() { @@ -1337,4 +1377,21 @@ mod tests { let boxed = >::default(); assert_eq!(boxed.to_bytes_with_nul(), &[0]); } + + #[test] + fn into_rc() { + let orig: &[u8] = b"Hello, world!\0"; + let cstr = CStr::from_bytes_with_nul(orig).unwrap(); + let rc: Rc = Rc::from(cstr); + let arc: Arc = Arc::from(cstr); + + assert_eq!(&*rc, cstr); + assert_eq!(&*arc, cstr); + + let rc2: Rc = Rc::from(cstr.to_owned()); + let arc2: Arc = Arc::from(cstr.to_owned()); + + assert_eq!(&*rc2, cstr); + assert_eq!(&*arc2, cstr); + } } diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 8c34660f82..cb902461f3 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -13,6 +13,8 @@ use fmt; use ops; use cmp; use hash::{Hash, Hasher}; +use rc::Rc; +use sync::Arc; use sys::os_str::{Buf, Slice}; use sys_common::{AsInner, IntoInner, FromInner}; @@ -592,6 +594,42 @@ impl From for Box { } } +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl From for Arc { + #[inline] + fn from(s: OsString) -> Arc { + let arc = s.inner.into_arc(); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const OsStr) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl<'a> From<&'a OsStr> for Arc { + #[inline] + fn from(s: &OsStr) -> Arc { + let arc = s.inner.into_arc(); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const OsStr) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl From for Rc { + #[inline] + fn from(s: OsString) -> Rc { + let rc = s.inner.into_rc(); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const OsStr) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl<'a> From<&'a OsStr> for Rc { + #[inline] + fn from(s: &OsStr) -> Rc { + let rc = s.inner.into_rc(); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const OsStr) } + } +} + #[stable(feature = "box_default_extra", since = "1.17.0")] impl Default for Box { fn default() -> Box { @@ -793,6 +831,9 @@ mod tests { use super::*; use sys_common::{AsInner, IntoInner}; + use rc::Rc; + use sync::Arc; + #[test] fn test_os_string_with_capacity() { let os_string = OsString::with_capacity(0); @@ -935,4 +976,21 @@ mod tests { assert_eq!(os_str, os_string); assert!(os_string.capacity() >= 123); } + + #[test] + fn into_rc() { + let orig = "Hello, world!"; + let os_str = OsStr::new(orig); + let rc: Rc = Rc::from(os_str); + let arc: Arc = Arc::from(os_str); + + assert_eq!(&*rc, os_str); + assert_eq!(&*arc, os_str); + + let rc2: Rc = Rc::from(os_str.to_owned()); + let arc2: Arc = Arc::from(os_str.to_owned()); + + assert_eq!(&*rc2, os_str); + assert_eq!(&*arc2, os_str); + } } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index b07733d3c8..f40aed2478 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -211,6 +211,115 @@ pub struct DirBuilder { recursive: bool, } +/// Read the entire contents of a file into a bytes vector. +/// +/// This is a convenience function for using [`File::open`] and [`read_to_end`] +/// with fewer imports and without an intermediate variable. +/// +/// [`File::open`]: struct.File.html#method.open +/// [`read_to_end`]: ../io/trait.Read.html#method.read_to_end +/// +/// # Errors +/// +/// This function will return an error if `path` does not already exist. +/// Other errors may also be returned according to [`OpenOptions::open`]. +/// +/// [`OpenOptions::open`]: struct.OpenOptions.html#method.open +/// +/// It will also return an error if it encounters while reading an error +/// of a kind other than [`ErrorKind::Interrupted`]. +/// +/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted +/// +/// # Examples +/// +/// ```no_run +/// #![feature(fs_read_write)] +/// +/// use std::fs; +/// use std::net::SocketAddr; +/// +/// # fn foo() -> Result<(), Box> { +/// let foo: SocketAddr = String::from_utf8_lossy(&fs::read("address.txt")?).parse()?; +/// # Ok(()) +/// # } +/// ``` +#[unstable(feature = "fs_read_write", issue = "46588")] +pub fn read>(path: P) -> io::Result> { + let mut bytes = Vec::new(); + File::open(path)?.read_to_end(&mut bytes)?; + Ok(bytes) +} + +/// Read the entire contents of a file into a string. +/// +/// This is a convenience function for using [`File::open`] and [`read_to_string`] +/// with fewer imports and without an intermediate variable. +/// +/// [`File::open`]: struct.File.html#method.open +/// [`read_to_string`]: ../io/trait.Read.html#method.read_to_string +/// +/// # Errors +/// +/// This function will return an error if `path` does not already exist. +/// Other errors may also be returned according to [`OpenOptions::open`]. +/// +/// [`OpenOptions::open`]: struct.OpenOptions.html#method.open +/// +/// It will also return an error if it encounters while reading an error +/// of a kind other than [`ErrorKind::Interrupted`], +/// or if the contents of the file are not valid UTF-8. +/// +/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted +/// +/// # Examples +/// +/// ```no_run +/// #![feature(fs_read_write)] +/// +/// use std::fs; +/// use std::net::SocketAddr; +/// +/// # fn foo() -> Result<(), Box> { +/// let foo: SocketAddr = fs::read_string("address.txt")?.parse()?; +/// # Ok(()) +/// # } +/// ``` +#[unstable(feature = "fs_read_write", issue = "46588")] +pub fn read_string>(path: P) -> io::Result { + let mut string = String::new(); + File::open(path)?.read_to_string(&mut string)?; + Ok(string) +} + +/// Write a slice as the entire contents of a file. +/// +/// This function will create a file if it does not exist, +/// and will entirely replace its contents if it does. +/// +/// This is a convenience function for using [`File::create`] and [`write_all`] +/// with fewer imports. +/// +/// [`File::create`]: struct.File.html#method.create +/// [`write_all`]: ../io/trait.Write.html#method.write_all +/// +/// # Examples +/// +/// ```no_run +/// #![feature(fs_read_write)] +/// +/// use std::fs; +/// +/// # fn foo() -> std::io::Result<()> { +/// fs::write("foo.txt", b"Lorem ipsum")?; +/// # Ok(()) +/// # } +/// ``` +#[unstable(feature = "fs_read_write", issue = "46588")] +pub fn write, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> { + File::create(path)?.write_all(contents.as_ref()) +} + impl File { /// Attempts to open a file in read-only mode. /// @@ -1912,7 +2021,9 @@ mod tests { ) } #[cfg(unix)] - macro_rules! error { ($e:expr, $s:expr) => ( + macro_rules! error { ($e:expr, $s:expr) => ( error_contains!($e, $s) ) } + + macro_rules! error_contains { ($e:expr, $s:expr) => ( match $e { Ok(_) => panic!("Unexpected success. Should've been: {:?}", $s), Err(ref err) => assert!(err.to_string().contains($s), @@ -2921,6 +3032,27 @@ mod tests { assert!(v == &bytes[..]); } + #[test] + fn write_then_read() { + let mut bytes = [0; 1024]; + StdRng::new().unwrap().fill_bytes(&mut bytes); + + let tmpdir = tmpdir(); + + check!(fs::write(&tmpdir.join("test"), &bytes[..])); + let v = check!(fs::read(&tmpdir.join("test"))); + assert!(v == &bytes[..]); + + check!(fs::write(&tmpdir.join("not-utf8"), &[0xFF])); + error_contains!(fs::read_string(&tmpdir.join("not-utf8")), + "stream did not contain valid UTF-8"); + + let s = "𐁁𐀓𐀠𐀴𐀍"; + check!(fs::write(&tmpdir.join("utf8"), s.as_bytes())); + let string = check!(fs::read_string(&tmpdir.join("utf8"))); + assert_eq!(string, s); + } + #[test] fn file_try_clone() { let tmpdir = tmpdir(); diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 6d3fbc9d26..8308ab48d9 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -263,7 +263,7 @@ impl Seek for BufReader { /// See `std::io::Seek` for more details. /// /// Note: In the edge case where you're seeking with `SeekFrom::Current(n)` - /// where `n` minus the internal buffer length underflows an `i64`, two + /// where `n` minus the internal buffer length overflows an `i64`, two /// seeks will be performed instead of one. If the second seek returns /// `Err`, the underlying reader will be left at the same position it would /// have if you seeked to `SeekFrom::Current(0)`. diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 32a92145aa..b5ea5531b6 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -230,6 +230,13 @@ impl Read for Cursor where T: AsRef<[u8]> { Ok(n) } + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { + let n = buf.len(); + Read::read_exact(&mut self.fill_buf()?, buf)?; + self.pos += n as u64; + Ok(()) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -475,6 +482,24 @@ mod tests { assert_eq!(reader.read(&mut buf).unwrap(), 0); } + #[test] + fn test_read_exact() { + let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7]; + let reader = &mut &in_buf[..]; + let mut buf = []; + assert!(reader.read_exact(&mut buf).is_ok()); + let mut buf = [8]; + assert!(reader.read_exact(&mut buf).is_ok()); + assert_eq!(buf[0], 0); + assert_eq!(reader.len(), 7); + let mut buf = [0, 0, 0, 0, 0, 0, 0]; + assert!(reader.read_exact(&mut buf).is_ok()); + assert_eq!(buf, [1, 2, 3, 4, 5, 6, 7]); + assert_eq!(reader.len(), 0); + let mut buf = [0]; + assert!(reader.read_exact(&mut buf).is_err()); + } + #[test] fn test_buf_reader() { let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7]; diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 57f8c39756..e9b707c57e 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -366,16 +366,13 @@ fn append_to_string(buf: &mut String, f: F) -> Result fn read_to_end(r: &mut R, buf: &mut Vec) -> Result { let start_len = buf.len(); let mut g = Guard { len: buf.len(), buf: buf }; - let mut new_write_size = 16; let ret; loop { if g.len == g.buf.len() { - if new_write_size < DEFAULT_BUF_SIZE { - new_write_size *= 2; - } unsafe { - g.buf.reserve(new_write_size); - g.buf.set_len(g.len + new_write_size); + g.buf.reserve(32); + let capacity = g.buf.capacity(); + g.buf.set_len(capacity); r.initializer().initialize(&mut g.buf[g.len..]); } } @@ -419,14 +416,8 @@ fn read_to_end(r: &mut R, buf: &mut Vec) -> Result /// /// [`File`]s implement `Read`: /// -/// [`read()`]: trait.Read.html#tymethod.read -/// [`std::io`]: ../../std/io/index.html -/// [`File`]: ../fs/struct.File.html -/// [`BufRead`]: trait.BufRead.html -/// [`BufReader`]: struct.BufReader.html -/// /// ``` -/// use std::io; +/// # use std::io; /// use std::io::prelude::*; /// use std::fs::File; /// @@ -449,7 +440,34 @@ fn read_to_end(r: &mut R, buf: &mut Vec) -> Result /// # Ok(()) /// # } /// ``` +/// +/// Read from [`&str`] because [`&[u8]`][slice] implements `Read`: +/// +/// ``` +/// # use std::io; +/// use std::io::prelude::*; +/// +/// # fn foo() -> io::Result<()> { +/// let mut b = "This string will be read".as_bytes(); +/// let mut buffer = [0; 10]; +/// +/// // read up to 10 bytes +/// b.read(&mut buffer)?; +/// +/// // etc... it works exactly as a File does! +/// # Ok(()) +/// # } +/// ``` +/// +/// [`read()`]: trait.Read.html#tymethod.read +/// [`std::io`]: ../../std/io/index.html +/// [`File`]: ../fs/struct.File.html +/// [`BufRead`]: trait.BufRead.html +/// [`BufReader`]: struct.BufReader.html +/// [`&str`]: ../../std/primitive.str.html +/// [slice]: ../../std/primitive.slice.html #[stable(feature = "rust1", since = "1.0.0")] +#[doc(spotlight)] pub trait Read { /// Pull some bytes from this source into the specified buffer, returning /// how many bytes were read. @@ -968,6 +986,7 @@ impl Initializer { /// # } /// ``` #[stable(feature = "rust1", since = "1.0.0")] +#[doc(spotlight)] pub trait Write { /// Write a buffer into this object, returning how many bytes were written. /// @@ -2001,10 +2020,9 @@ impl Iterator for Chars { type Item = result::Result; fn next(&mut self) -> Option> { - let first_byte = match read_one_byte(&mut self.inner) { - None => return None, - Some(Ok(b)) => b, - Some(Err(e)) => return Some(Err(CharsError::Other(e))), + let first_byte = match read_one_byte(&mut self.inner)? { + Ok(b) => b, + Err(e) => return Some(Err(CharsError::Other(e))), }; let width = core_str::utf8_char_width(first_byte); if width == 1 { return Some(Ok(first_byte as char)) } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 37cc7a49b5..29ea87aaf7 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -256,19 +256,11 @@ #![feature(collections_range)] #![feature(compiler_builtins_lib)] #![feature(const_fn)] -#![feature(const_max_value)] -#![feature(const_atomic_bool_new)] -#![feature(const_atomic_isize_new)] -#![feature(const_atomic_usize_new)] -#![feature(const_unsafe_cell_new)] -#![feature(const_cell_new)] -#![feature(const_once_new)] -#![feature(const_ptr_null)] -#![feature(const_ptr_null_mut)] #![feature(core_float)] #![feature(core_intrinsics)] #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] +#![feature(fs_read_write)] #![feature(fixed_size_array)] #![feature(float_from_str_radix)] #![feature(fn_traits)] @@ -306,17 +298,18 @@ #![feature(repr_align)] #![feature(repr_simd)] #![feature(rustc_attrs)] -#![feature(rustc_const_unstable)] #![feature(shared)] #![feature(sip_hash_13)] #![feature(slice_bytes)] #![feature(slice_concat_ext)] +#![feature(slice_internals)] #![feature(slice_patterns)] #![feature(staged_api)] #![feature(stmt_expr_attributes)] #![feature(str_char)] #![feature(str_internals)] #![feature(str_utf16)] +#![feature(termination_trait)] #![feature(test, rustc_private)] #![feature(thread_local)] #![feature(toowned_clone_into)] @@ -329,8 +322,9 @@ #![feature(vec_push_all)] #![feature(doc_cfg)] #![feature(doc_masked)] +#![feature(doc_spotlight)] #![cfg_attr(test, feature(update_panic_count))] -#![cfg_attr(windows, feature(const_atomic_ptr_new))] +#![cfg_attr(windows, feature(used))] #![default_lib_allocator] @@ -507,6 +501,11 @@ mod memchr; // The runtime entry point and a few unstable public functions used by the // compiler pub mod rt; +// The trait to support returning arbitrary types in the main function +mod termination; + +#[unstable(feature = "termination_trait", issue = "43301")] +pub use self::termination::Termination; // Include a number of private modules that exist solely to provide // the rustdoc documentation for primitive types. Using `include!` diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 9d0373404a..9f3f0ea274 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -282,9 +282,34 @@ pub mod builtin { /// Unconditionally causes compilation to fail with the given error message when encountered. /// - /// For more information, see the [RFC]. + /// This macro should be used when a crate uses a conditional compilation strategy to provide + /// better error messages for errornous conditions. /// - /// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md + /// # Examples + /// + /// Two such examples are macros and `#[cfg]` environments. + /// + /// Emit better compiler error if a macro is passed invalid values. + /// + /// ```compile_fail + /// macro_rules! give_me_foo_or_bar { + /// (foo) => {}; + /// (bar) => {}; + /// ($x:ident) => { + /// compile_error!("This macro only accepts `foo` or `bar`"); + /// } + /// } + /// + /// give_me_foo_or_bar!(neither); + /// // ^ will fail at compile time with message "This macro only accepts `foo` or `bar`" + /// ``` + /// + /// Emit compiler error if one of a number of features isn't available. + /// + /// ```compile_fail + /// #[cfg(not(any(feature = "foo", feature = "bar")))] + /// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.") + /// ``` #[stable(feature = "compile_error_macro", since = "1.20.0")] #[macro_export] macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) } @@ -325,9 +350,10 @@ pub mod builtin { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[macro_export] - macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({ - /* compiler built-in */ - }) } + macro_rules! format_args { + ($fmt:expr) => ({ /* compiler built-in */ }); + ($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ }); + } /// Inspect an environment variable at compile time. /// @@ -348,7 +374,10 @@ pub mod builtin { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[macro_export] - macro_rules! env { ($name:expr) => ({ /* compiler built-in */ }) } + macro_rules! env { + ($name:expr) => ({ /* compiler built-in */ }); + ($name:expr,) => ({ /* compiler built-in */ }); + } /// Optionally inspect an environment variable at compile time. /// @@ -400,7 +429,8 @@ pub mod builtin { #[unstable(feature = "concat_idents_macro", issue = "29599")] #[macro_export] macro_rules! concat_idents { - ($($e:ident),*) => ({ /* compiler built-in */ }) + ($($e:ident),*) => ({ /* compiler built-in */ }); + ($($e:ident,)*) => ({ /* compiler built-in */ }); } /// Concatenates literals into a static string slice. @@ -420,16 +450,22 @@ pub mod builtin { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[macro_export] - macro_rules! concat { ($($e:expr),*) => ({ /* compiler built-in */ }) } + macro_rules! concat { + ($($e:expr),*) => ({ /* compiler built-in */ }); + ($($e:expr,)*) => ({ /* compiler built-in */ }); + } /// A macro which expands to the line number on which it was invoked. /// /// With [`column!`] and [`file!`], these macros provide debugging information for /// developers about the location within the source. /// - /// The expanded expression has type `u32`, and the returned line is not - /// the invocation of the `line!()` macro itself, but rather the first macro - /// invocation leading up to the invocation of the `line!()` macro. + /// The expanded expression has type `u32` and is 1-based, so the first line + /// in each file evaluates to 1, the second to 2, etc. This is consistent + /// with error messages by common compilers or popular editors. + /// The returned line is not the invocation of the `line!` macro itself, + /// but rather the first macro invocation leading up to the invocation + /// of the `line!` macro. /// /// [`column!`]: macro.column.html /// [`file!`]: macro.file.html @@ -449,9 +485,12 @@ pub mod builtin { /// With [`line!`] and [`file!`], these macros provide debugging information for /// developers about the location within the source. /// - /// The expanded expression has type `u32`, and the returned column is not - /// the invocation of the `column!` macro itself, but rather the first macro - /// invocation leading up to the invocation of the `column!` macro. + /// The expanded expression has type `u32` and is 1-based, so the first column + /// in each line evaluates to 1, the second to 2, etc. This is consistent + /// with error messages by common compilers or popular editors. + /// The returned column is not the invocation of the `column!` macro itself, + /// but rather the first macro invocation leading up to the invocation + /// of the `column!` macro. /// /// [`line!`]: macro.line.html /// [`file!`]: macro.file.html @@ -598,7 +637,7 @@ pub mod builtin { #[macro_export] macro_rules! module_path { () => ({ /* compiler built-in */ }) } - /// Boolean evaluation of configuration flags. + /// Boolean evaluation of configuration flags, at compile-time. /// /// In addition to the `#[cfg]` attribute, this macro is provided to allow /// boolean expression evaluation of configuration flags. This frequently diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index e1d7a2531b..1ca7e66ed9 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -759,7 +759,7 @@ impl hash::Hash for SocketAddrV6 { /// ``` /// /// [`TcpStream::connect`] is an example of an function that utilizes -/// `ToSocketsAddr` as a trait bound on its parameter in order to accept +/// `ToSocketAddrs` as a trait bound on its parameter in order to accept /// different types: /// /// ```no_run diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index eea604943a..0d73a6f4fd 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -719,7 +719,8 @@ impl Eq for Ipv4Addr {} #[stable(feature = "rust1", since = "1.0.0")] impl hash::Hash for Ipv4Addr { fn hash(&self, s: &mut H) { - self.inner.s_addr.hash(s) + // `inner` is #[repr(packed)], so we need to copy `s_addr`. + {self.inner.s_addr}.hash(s) } } @@ -1450,6 +1451,9 @@ mod tests { // two double colons let none: Option = "1:2::6::8".parse().ok(); assert_eq!(None, none); + // `::` indicating zero groups of zeros + let none: Option = "1:2:3:4::5:6:7:8".parse().ok(); + assert_eq!(None, none); } #[test] diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 7d7c67ff3f..261d44eeba 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -170,11 +170,7 @@ impl<'a> Parser<'a> { return None; } - let octet = self.read_number(10, 3, 0x100).map(|n| n as u8); - match octet { - Some(d) => bs[i] = d, - None => return None, - }; + bs[i] = self.read_number(10, 3, 0x100).map(|n| n as u8)?; i += 1; } Some(Ipv4Addr::new(bs[0], bs[1], bs[2], bs[3])) @@ -250,7 +246,9 @@ impl<'a> Parser<'a> { } let mut tail = [0; 8]; - let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size); + // `::` indicates one or more groups of 16 bits of zeros + let limit = 8 - (head_size + 1); + let (tail_size, _) = read_groups(self, &mut tail, limit); Some(ipv6_addr_from_head_tail(&head[..head_size], &tail[..tail_size])) } diff --git a/src/libstd/os/mod.rs b/src/libstd/os/mod.rs index 122f15d1d4..ac7809451d 100644 --- a/src/libstd/os/mod.rs +++ b/src/libstd/os/mod.rs @@ -13,35 +13,53 @@ #![stable(feature = "os", since = "1.0.0")] #![allow(missing_docs, bad_style, missing_debug_implementations)] -#[cfg(all(not(dox), any(target_os = "redox", unix)))] -#[stable(feature = "rust1", since = "1.0.0")] -pub use sys::ext as unix; -#[cfg(all(not(dox), windows))] -#[stable(feature = "rust1", since = "1.0.0")] -pub use sys::ext as windows; +cfg_if! { + if #[cfg(dox)] { -#[cfg(dox)] -#[stable(feature = "rust1", since = "1.0.0")] -pub use sys::unix_ext as unix; -#[cfg(dox)] -#[stable(feature = "rust1", since = "1.0.0")] -pub use sys::windows_ext as windows; + // When documenting libstd we want to show unix/windows/linux modules as + // these are the "main modules" that are used across platforms. This + // should help show platform-specific functionality in a hopefully + // cross-platform way in the documentation -#[cfg(any(dox, target_os = "linux", target_os = "l4re"))] -#[doc(cfg(target_os = "linux"))] -pub mod linux; + #[stable(feature = "rust1", since = "1.0.0")] + pub use sys::unix_ext as unix; -#[cfg(all(not(dox), target_os = "android"))] pub mod android; -#[cfg(all(not(dox), target_os = "bitrig"))] pub mod bitrig; -#[cfg(all(not(dox), target_os = "dragonfly"))] pub mod dragonfly; -#[cfg(all(not(dox), target_os = "freebsd"))] pub mod freebsd; -#[cfg(all(not(dox), target_os = "haiku"))] pub mod haiku; -#[cfg(all(not(dox), target_os = "ios"))] pub mod ios; -#[cfg(all(not(dox), target_os = "macos"))] pub mod macos; -#[cfg(all(not(dox), target_os = "netbsd"))] pub mod netbsd; -#[cfg(all(not(dox), target_os = "openbsd"))] pub mod openbsd; -#[cfg(all(not(dox), target_os = "solaris"))] pub mod solaris; -#[cfg(all(not(dox), target_os = "emscripten"))] pub mod emscripten; -#[cfg(all(not(dox), target_os = "fuchsia"))] pub mod fuchsia; + #[stable(feature = "rust1", since = "1.0.0")] + pub use sys::windows_ext as windows; + + #[doc(cfg(target_os = "linux"))] + pub mod linux; + + } else { + + // If we're not documenting libstd then we just expose everything as we + // otherwise would. + + #[cfg(target_os = "android")] pub mod android; + #[cfg(target_os = "bitrig")] pub mod bitrig; + #[cfg(target_os = "dragonfly")] pub mod dragonfly; + #[cfg(target_os = "freebsd")] pub mod freebsd; + #[cfg(target_os = "haiku")] pub mod haiku; + #[cfg(target_os = "ios")] pub mod ios; + #[cfg(target_os = "macos")] pub mod macos; + #[cfg(target_os = "netbsd")] pub mod netbsd; + #[cfg(target_os = "openbsd")] pub mod openbsd; + #[cfg(target_os = "solaris")] pub mod solaris; + #[cfg(target_os = "emscripten")] pub mod emscripten; + #[cfg(target_os = "fuchsia")] pub mod fuchsia; + + #[cfg(any(target_os = "redox", unix))] + #[stable(feature = "rust1", since = "1.0.0")] + pub use sys::ext as unix; + + #[cfg(windows)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use sys::ext as windows; + + #[cfg(any(target_os = "linux", target_os = "l4re"))] + pub mod linux; + + } +} pub mod raw; diff --git a/src/libstd/os/raw.rs b/src/libstd/os/raw.rs index 95439640f7..279caf8053 100644 --- a/src/libstd/os/raw.rs +++ b/src/libstd/os/raw.rs @@ -22,6 +22,7 @@ use fmt; all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")), all(target_os = "l4re", target_arch = "x86_64"), + all(target_os = "openbsd", target_arch = "aarch64"), all(target_os = "fuchsia", target_arch = "aarch64")))] #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8; #[cfg(not(any(all(target_os = "linux", any(target_arch = "aarch64", @@ -32,6 +33,7 @@ use fmt; all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")), all(target_os = "l4re", target_arch = "x86_64"), + all(target_os = "openbsd", target_arch = "aarch64"), all(target_os = "fuchsia", target_arch = "aarch64"))))] #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8; diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index 385076e50d..219e55d6c1 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Panic support in the standard library +//! Panic support in the standard library. #![stable(feature = "std_panic", since = "1.9.0")] diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 69922470cf..eb125a4737 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -86,6 +86,8 @@ use hash::{Hash, Hasher}; use io; use iter::{self, FusedIterator}; use ops::{self, Deref}; +use rc::Rc; +use sync::Arc; use ffi::{OsStr, OsString}; @@ -1452,6 +1454,42 @@ impl<'a> From for Cow<'a, Path> { } } +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl From for Arc { + #[inline] + fn from(s: PathBuf) -> Arc { + let arc: Arc = Arc::from(s.into_os_string()); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl<'a> From<&'a Path> for Arc { + #[inline] + fn from(s: &Path) -> Arc { + let arc: Arc = Arc::from(s.as_os_str()); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl From for Rc { + #[inline] + fn from(s: PathBuf) -> Rc { + let rc: Rc = Rc::from(s.into_os_string()); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) } + } +} + +#[stable(feature = "shared_from_slice2", since = "1.23.0")] +impl<'a> From<&'a Path> for Rc { + #[inline] + fn from(s: &Path) -> Rc { + let rc: Rc = Rc::from(s.as_os_str()); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) } + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl ToOwned for Path { type Owned = PathBuf; @@ -2568,6 +2606,9 @@ impl Error for StripPrefixError { mod tests { use super::*; + use rc::Rc; + use sync::Arc; + macro_rules! t( ($path:expr, iter: $iter:expr) => ( { @@ -3752,7 +3793,7 @@ mod tests { } #[test] - fn test_eq_recievers() { + fn test_eq_receivers() { use borrow::Cow; let borrowed: &Path = Path::new("foo/bar"); @@ -3970,4 +4011,21 @@ mod tests { assert_eq!(format!("a{:#<5}b", Path::new("").display()), "a#####b"); assert_eq!(format!("a{:#<5}b", Path::new("a").display()), "aa####b"); } + + #[test] + fn into_rc() { + let orig = "hello/world"; + let path = Path::new(orig); + let rc: Rc = Rc::from(path); + let arc: Arc = Arc::from(path); + + assert_eq!(&*rc, path); + assert_eq!(&*arc, path); + + let rc2: Rc = Rc::from(path.to_owned()); + let arc2: Arc = Arc::from(path.to_owned()); + + assert_eq!(&*rc2, path); + assert_eq!(&*arc2, path); + } } diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index 9e1da31824..a2caf47e8c 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -67,6 +67,134 @@ #[stable(feature = "rust1", since = "1.0.0")] mod prim_bool { } +#[doc(primitive = "never")] +// +/// The `!` type, also called "never". +/// +/// `!` represents the type of computations which never resolve to any value at all. For example, +/// the [`exit`] function `fn exit(code: i32) -> !` exits the process without ever returning, and +/// so returns `!`. +/// +/// `break`, `continue` and `return` expressions also have type `!`. For example we are allowed to +/// write: +/// +/// ``` +/// #![feature(never_type)] +/// # fn foo() -> u32 { +/// let x: ! = { +/// return 123 +/// }; +/// # } +/// ``` +/// +/// Although the `let` is pointless here, it illustrates the meaning of `!`. Since `x` is never +/// assigned a value (because `return` returns from the entire function), `x` can be given type +/// `!`. We could also replace `return 123` with a `panic!` or a never-ending `loop` and this code +/// would still be valid. +/// +/// A more realistic usage of `!` is in this code: +/// +/// ``` +/// # fn get_a_number() -> Option { None } +/// # loop { +/// let num: u32 = match get_a_number() { +/// Some(num) => num, +/// None => break, +/// }; +/// # } +/// ``` +/// +/// Both match arms must produce values of type [`u32`], but since `break` never produces a value +/// at all we know it can never produce a value which isn't a [`u32`]. This illustrates another +/// behaviour of the `!` type - expressions with type `!` will coerce into any other type. +/// +/// [`u32`]: primitive.str.html +/// [`exit`]: process/fn.exit.html +/// +/// # `!` and generics +/// +/// The main place you'll see `!` used explicitly is in generic code. Consider the [`FromStr`] +/// trait: +/// +/// ``` +/// trait FromStr: Sized { +/// type Err; +/// fn from_str(s: &str) -> Result; +/// } +/// ``` +/// +/// When implementing this trait for [`String`] we need to pick a type for [`Err`]. And since +/// converting a string into a string will never result in an error, the appropriate type is `!`. +/// (Currently the type actually used is an enum with no variants, though this is only because `!` +/// was added to Rust at a later date and it may change in the future). With an [`Err`] type of +/// `!`, if we have to call [`String::from_str`] for some reason the result will be a +/// [`Result`] which we can unpack like this: +/// +/// ```ignore (string-from-str-error-type-is-not-never-yet) +/// // NOTE: This does not work today! +/// let Ok(s) = String::from_str("hello"); +/// ``` +/// +/// Since the [`Err`] variant contains a `!`, it can never occur. So we can exhaustively match on +/// [`Result`] by just taking the [`Ok`] variant. This illustrates another behaviour of `!` - +/// it can be used to "delete" certain enum variants from generic types like `Result`. +/// +/// [`String::from_str`]: str/trait.FromStr.html#tymethod.from_str +/// [`Result`]: result/enum.Result.html +/// [`Result`]: result/enum.Result.html +/// [`Ok`]: result/enum.Result.html#variant.Ok +/// [`String`]: string/struct.String.html +/// [`Err`]: result/enum.Result.html#variant.Err +/// [`FromStr`]: str/trait.FromStr.html +/// +/// # `!` and traits +/// +/// When writing your own traits, `!` should have an `impl` whenever there is an obvious `impl` +/// which doesn't `panic!`. As is turns out, most traits can have an `impl` for `!`. Take [`Debug`] +/// for example: +/// +/// ``` +/// # #![feature(never_type)] +/// # use std::fmt; +/// # trait Debug { +/// # fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result; +/// # } +/// impl Debug for ! { +/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { +/// *self +/// } +/// } +/// ``` +/// +/// Once again we're using `!`'s ability to coerce into any other type, in this case +/// [`fmt::Result`]. Since this method takes a `&!` as an argument we know that it can never be +/// called (because there is no value of type `!` for it to be called with). Writing `*self` +/// essentially tells the compiler "We know that this code can never be run, so just treat the +/// entire function body has having type [`fmt::Result`]". This pattern can be used a lot when +/// implementing traits for `!`. Generally, any trait which only has methods which take a `self` +/// parameter should have such as impl. +/// +/// On the other hand, one trait which would not be appropriate to implement is [`Default`]: +/// +/// ``` +/// trait Default { +/// fn default() -> Self; +/// } +/// ``` +/// +/// Since `!` has no values, it has no default value either. It's true that we could write an +/// `impl` for this which simply panics, but the same is true for any type (we could `impl +/// Default` for (eg.) [`File`] by just making [`default()`] panic.) +/// +/// [`fmt::Result`]: fmt/type.Result.html +/// [`File`]: fs/struct.File.html +/// [`Debug`]: fmt/trait.Debug.html +/// [`Default`]: default/trait.Default.html +/// [`default()`]: default/trait.Default.html#tymethod.default +/// +#[unstable(feature = "never_type", issue = "35121")] +mod prim_never { } + #[doc(primitive = "char")] // /// A character type. diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 35c33f4025..c3d1e82bc3 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -513,7 +513,7 @@ impl Command { pub fn env(&mut self, key: K, val: V) -> &mut Command where K: AsRef, V: AsRef { - self.inner.env(key.as_ref(), val.as_ref()); + self.inner.env_mut().set(key.as_ref(), val.as_ref()); self } @@ -546,7 +546,7 @@ impl Command { where I: IntoIterator, K: AsRef, V: AsRef { for (ref key, ref val) in vars { - self.inner.env(key.as_ref(), val.as_ref()); + self.inner.env_mut().set(key.as_ref(), val.as_ref()); } self } @@ -567,7 +567,7 @@ impl Command { /// ``` #[stable(feature = "process", since = "1.0.0")] pub fn env_remove>(&mut self, key: K) -> &mut Command { - self.inner.env_remove(key.as_ref()); + self.inner.env_mut().remove(key.as_ref()); self } @@ -587,7 +587,7 @@ impl Command { /// ``` #[stable(feature = "process", since = "1.0.0")] pub fn env_clear(&mut self) -> &mut Command { - self.inner.env_clear(); + self.inner.env_mut().clear(); self } @@ -712,8 +712,10 @@ impl Command { /// Executes the command as a child process, waiting for it to finish and /// collecting all of its output. /// - /// By default, stdin, stdout and stderr are captured (and used to - /// provide the resulting output). + /// By default, stdout and stderr are captured (and used to provide the + /// resulting output). Stdin is not inherited from the parent and any + /// attempt by the child process to read from the stdin stream will result + /// in the stream immediately closing. /// /// # Examples /// @@ -1582,7 +1584,7 @@ mod tests { = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "mkdir ."]).output().unwrap() } else { - Command::new("mkdir").arg(".").output().unwrap() + Command::new("mkdir").arg("./").output().unwrap() }; assert!(status.code() == Some(1)); @@ -1713,6 +1715,27 @@ mod tests { "didn't find RUN_TEST_NEW_ENV inside of:\n\n{}", output); } + #[test] + fn test_capture_env_at_spawn() { + use env; + + let mut cmd = env_cmd(); + cmd.env("RUN_TEST_NEW_ENV1", "123"); + + // This variable will not be present if the environment has already + // been captured above. + env::set_var("RUN_TEST_NEW_ENV2", "456"); + let result = cmd.output().unwrap(); + env::remove_var("RUN_TEST_NEW_ENV2"); + + let output = String::from_utf8_lossy(&result.stdout).to_string(); + + assert!(output.contains("RUN_TEST_NEW_ENV1=123"), + "didn't find RUN_TEST_NEW_ENV1 inside of:\n\n{}", output); + assert!(output.contains("RUN_TEST_NEW_ENV2=456"), + "didn't find RUN_TEST_NEW_ENV2 inside of:\n\n{}", output); + } + // Regression tests for #30858. #[test] fn test_interior_nul_in_progname_is_error() { diff --git a/src/libstd/rt.rs b/src/libstd/rt.rs index 40b24cedcd..921fbec3da 100644 --- a/src/libstd/rt.rs +++ b/src/libstd/rt.rs @@ -26,7 +26,55 @@ // Reexport some of our utilities which are expected by other crates. pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count}; -#[cfg(not(test))] +// To reduce the generated code of the new `lang_start`, this function is doing +// the real work. +#[cfg(not(any(test, stage0)))] +fn lang_start_internal(main: &(Fn() -> i32 + Sync + ::panic::RefUnwindSafe), + argc: isize, argv: *const *const u8) -> isize { + use panic; + use sys; + use sys_common; + use sys_common::thread_info; + use thread::Thread; + + sys::init(); + + unsafe { + let main_guard = sys::thread::guard::init(); + sys::stack_overflow::init(); + + // Next, set up the current Thread with the guard information we just + // created. Note that this isn't necessary in general for new threads, + // but we just do this to name the main thread and to give it correct + // info about the stack bounds. + let thread = Thread::new(Some("main".to_owned())); + thread_info::set(main_guard, thread); + + // Store our args if necessary in a squirreled away location + sys::args::init(argc, argv); + + // Let's run some code! + #[cfg(feature = "backtrace")] + let exit_code = panic::catch_unwind(|| { + ::sys_common::backtrace::__rust_begin_short_backtrace(move || main()) + }); + #[cfg(not(feature = "backtrace"))] + let exit_code = panic::catch_unwind(move || main()); + + sys_common::cleanup(); + exit_code.unwrap_or(101) as isize + } +} + +#[cfg(not(any(test, stage0)))] +#[lang = "start"] +fn lang_start + (main: fn() -> T, argc: isize, argv: *const *const u8) -> isize +{ + lang_start_internal(&move || main().report(), argc, argv) +} + +#[cfg(all(not(test), stage0))] #[lang = "start"] fn lang_start(main: fn(), argc: isize, argv: *const *const u8) -> isize { use panic; diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 45a26e594b..2dd3aebe61 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1297,11 +1297,72 @@ impl Receiver { Err(TryRecvError::Disconnected) => Err(RecvTimeoutError::Disconnected), Err(TryRecvError::Empty) - => self.recv_max_until(Instant::now() + timeout) + => self.recv_deadline(Instant::now() + timeout) } } - fn recv_max_until(&self, deadline: Instant) -> Result { + /// Attempts to wait for a value on this receiver, returning an error if the + /// corresponding channel has hung up, or if `deadline` is reached. + /// + /// This function will always block the current thread if there is no data + /// available and it's possible for more data to be sent. Once a message is + /// sent to the corresponding [`Sender`][] (or [`SyncSender`]), then this + /// receiver will wake up and return that message. + /// + /// If the corresponding [`Sender`] has disconnected, or it disconnects while + /// this call is blocking, this call will wake up and return [`Err`] to + /// indicate that no more messages can ever be received on this channel. + /// However, since channels are buffered, messages sent before the disconnect + /// will still be properly received. + /// + /// [`Sender`]: struct.Sender.html + /// [`SyncSender`]: struct.SyncSender.html + /// [`Err`]: ../../../std/result/enum.Result.html#variant.Err + /// + /// # Examples + /// + /// Successfully receiving value before reaching deadline: + /// + /// ```no_run + /// #![feature(deadline_api)] + /// use std::thread; + /// use std::time::{Duration, Instant}; + /// use std::sync::mpsc; + /// + /// let (send, recv) = mpsc::channel(); + /// + /// thread::spawn(move || { + /// send.send('a').unwrap(); + /// }); + /// + /// assert_eq!( + /// recv.recv_deadline(Instant::now() + Duration::from_millis(400)), + /// Ok('a') + /// ); + /// ``` + /// + /// Receiving an error upon reaching deadline: + /// + /// ```no_run + /// #![feature(deadline_api)] + /// use std::thread; + /// use std::time::{Duration, Instant}; + /// use std::sync::mpsc; + /// + /// let (send, recv) = mpsc::channel(); + /// + /// thread::spawn(move || { + /// thread::sleep(Duration::from_millis(800)); + /// send.send('a').unwrap(); + /// }); + /// + /// assert_eq!( + /// recv.recv_deadline(Instant::now() + Duration::from_millis(400)), + /// Err(mpsc::RecvTimeoutError::Timeout) + /// ); + /// ``` + #[unstable(feature = "deadline_api", issue = "46316")] + pub fn recv_deadline(&self, deadline: Instant) -> Result { use self::RecvTimeoutError::*; loop { @@ -1625,6 +1686,15 @@ impl error::Error for TrySendError { } } +#[stable(feature = "mpsc_error_conversions", since = "1.24.0")] +impl From> for TrySendError { + fn from(err: SendError) -> TrySendError { + match err { + SendError(t) => TrySendError::Disconnected(t), + } + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for RecvError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1677,6 +1747,15 @@ impl error::Error for TryRecvError { } } +#[stable(feature = "mpsc_error_conversions", since = "1.24.0")] +impl From for TryRecvError { + fn from(err: RecvError) -> TryRecvError { + match err { + RecvError => TryRecvError::Disconnected, + } + } +} + #[stable(feature = "mpsc_recv_timeout_error", since = "1.15.0")] impl fmt::Display for RecvTimeoutError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1709,6 +1788,15 @@ impl error::Error for RecvTimeoutError { } } +#[stable(feature = "mpsc_error_conversions", since = "1.24.0")] +impl From for RecvTimeoutError { + fn from(err: RecvError) -> RecvTimeoutError { + match err { + RecvError => RecvTimeoutError::Disconnected, + } + } +} + #[cfg(all(test, not(target_os = "emscripten")))] mod tests { use env; diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index eb507858b9..81f5594bc5 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -382,6 +382,17 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Mutex { } } +#[stable(feature = "mutex_from", since = "1.22.0")] +impl From for Mutex { + /// Creates a new mutex in an unlocked state ready for use. + /// This is equivalent to [`Mutex::new`]. + /// + /// [`Mutex::new`]: #method.new + fn from(t: T) -> Self { + Mutex::new(t) + } +} + #[stable(feature = "mutex_default", since = "1.10.0")] impl Default for Mutex { /// Creates a `Mutex`, with the `Default` value for T. diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 2ef99525af..6fd8b6a5bb 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -156,7 +156,6 @@ struct Finish { impl Once { /// Creates a new `Once` value. #[stable(feature = "once_new", since = "1.2.0")] - #[rustc_const_unstable(feature = "const_once_new")] pub const fn new() -> Once { Once { state: AtomicUsize::new(INCOMPLETE), diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 6216d78528..fd6cff6b69 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -457,6 +457,17 @@ impl Default for RwLock { } } +#[stable(feature = "rw_lock_from", since = "1.22.0")] +impl From for RwLock { + /// Creates a new instance of an `RwLock` which is unlocked. + /// This is equivalent to [`RwLock::new`]. + /// + /// [`RwLock::new`]: #method.new + fn from(t: T) -> Self { + RwLock::new(t) + } +} + impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> { unsafe fn new(lock: &'rwlock RwLock) -> LockResult> { diff --git a/src/libstd/sys/mod.rs b/src/libstd/sys/mod.rs index 27d6433b32..be8cb88416 100644 --- a/src/libstd/sys/mod.rs +++ b/src/libstd/sys/mod.rs @@ -32,49 +32,66 @@ #![allow(missing_debug_implementations)] -pub use self::imp::*; +cfg_if! { + if #[cfg(unix)] { + mod unix; + pub use self::unix::*; + } else if #[cfg(windows)] { + mod windows; + pub use self::windows::*; + } else if #[cfg(target_os = "redox")] { + mod redox; + pub use self::redox::*; + } else if #[cfg(target_arch = "wasm32")] { + mod wasm; + pub use self::wasm::*; + } else { + compile_error!("libstd doesn't compile for this platform yet"); + } +} -#[cfg(unix)] -#[path = "unix/mod.rs"] -mod imp; +// Import essential modules from both platforms when documenting. These are +// then later used in the `std::os` module when documenting, for example, +// Windows when we're compiling for Linux. -#[cfg(windows)] -#[path = "windows/mod.rs"] -mod imp; +#[cfg(dox)] +cfg_if! { + if #[cfg(any(unix, target_os = "redox"))] { + // On unix we'll document what's already available + pub use self::ext as unix_ext; + } else if #[cfg(target_arch = "wasm32")] { + // On wasm right now the module below doesn't compile (missing things + // in `libc` which is empty) so just omit everything with an empty module + #[unstable(issue = "0", feature = "std_internals")] + pub mod unix_ext {} + } else { + // On other platforms like Windows document the bare bones of unix + use os::linux as platform; + #[path = "unix/ext/mod.rs"] + pub mod unix_ext; + } +} -#[cfg(target_os = "redox")] -#[path = "redox/mod.rs"] -mod imp; +#[cfg(dox)] +cfg_if! { + if #[cfg(windows)] { + // On windows we'll just be documenting what's already available + pub use self::ext as windows_ext; + } else if #[cfg(target_arch = "wasm32")] { + // On wasm right now the shim below doesn't compile, so just omit it + #[unstable(issue = "0", feature = "std_internals")] + pub mod windows_ext {} + } else { + // On all other platforms (aka linux/osx/etc) then pull in a "minimal" + // amount of windows goop which ends up compiling + #[macro_use] + #[path = "windows/compat.rs"] + mod compat; -#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] -#[path = "wasm/mod.rs"] -mod imp; + #[path = "windows/c.rs"] + mod c; -// Import essential modules from both platforms when documenting. - -#[cfg(all(dox, not(unix)))] -use os::linux as platform; - -#[cfg(all(dox, not(any(unix, target_os = "redox"))))] -#[path = "unix/ext/mod.rs"] -pub mod unix_ext; - -#[cfg(all(dox, any(unix, target_os = "redox")))] -pub use self::ext as unix_ext; - - -#[cfg(all(dox, not(windows)))] -#[macro_use] -#[path = "windows/compat.rs"] -mod compat; - -#[cfg(all(dox, not(windows)))] -#[path = "windows/c.rs"] -mod c; - -#[cfg(all(dox, not(windows)))] -#[path = "windows/ext/mod.rs"] -pub mod windows_ext; - -#[cfg(all(dox, windows))] -pub use self::ext as windows_ext; + #[path = "windows/ext/mod.rs"] + pub mod windows_ext; + } +} diff --git a/src/libstd/sys/redox/fast_thread_local.rs b/src/libstd/sys/redox/fast_thread_local.rs index 9f0eee024d..6a007e9882 100644 --- a/src/libstd/sys/redox/fast_thread_local.rs +++ b/src/libstd/sys/redox/fast_thread_local.rs @@ -81,7 +81,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { unsafe extern fn run_dtors(mut ptr: *mut u8) { while !ptr.is_null() { let list: Box = Box::from_raw(ptr as *mut List); - for &(ptr, dtor) in list.iter() { + for (ptr, dtor) in list.into_iter() { dtor(ptr); } ptr = DTORS.get(); diff --git a/src/libstd/sys/redox/memchr.rs b/src/libstd/sys/redox/memchr.rs index 4c314b7a47..873b335350 100644 --- a/src/libstd/sys/redox/memchr.rs +++ b/src/libstd/sys/redox/memchr.rs @@ -11,4 +11,4 @@ // Original implementation taken from rust-memchr // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch -pub use sys_common::memchr::fallback::{memchr, memrchr}; +pub use core::slice::memchr::{memchr, memrchr}; diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs index c27e2ee172..480765b77a 100644 --- a/src/libstd/sys/redox/os.rs +++ b/src/libstd/sys/redox/os.rs @@ -213,3 +213,7 @@ pub fn exit(code: i32) -> ! { pub fn getpid() -> u32 { syscall::getpid().unwrap() as u32 } + +pub fn getppid() -> u32 { + syscall::getppid().unwrap() as u32 +} diff --git a/src/libstd/sys/redox/os_str.rs b/src/libstd/sys/redox/os_str.rs index c54286353a..655bfdb916 100644 --- a/src/libstd/sys/redox/os_str.rs +++ b/src/libstd/sys/redox/os_str.rs @@ -15,7 +15,10 @@ use borrow::Cow; use fmt; use str; use mem; +use rc::Rc; +use sync::Arc; use sys_common::{AsInner, IntoInner}; +use sys_common::bytestring::debug_fmt_bytestring; use std_unicode::lossy::Utf8Lossy; #[derive(Clone, Hash)] @@ -29,7 +32,7 @@ pub struct Slice { impl fmt::Debug for Slice { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(&Utf8Lossy::from_bytes(&self.inner), formatter) + debug_fmt_bytestring(&self.inner, formatter) } } @@ -123,6 +126,16 @@ impl Buf { let inner: Box<[u8]> = unsafe { mem::transmute(boxed) }; Buf { inner: inner.into_vec() } } + + #[inline] + pub fn into_arc(&self) -> Arc { + self.as_slice().into_arc() + } + + #[inline] + pub fn into_rc(&self) -> Rc { + self.as_slice().into_rc() + } } impl Slice { @@ -156,4 +169,16 @@ impl Slice { let boxed: Box<[u8]> = Default::default(); unsafe { mem::transmute(boxed) } } + + #[inline] + pub fn into_arc(&self) -> Arc { + let arc: Arc<[u8]> = Arc::from(&self.inner); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Slice) } + } + + #[inline] + pub fn into_rc(&self) -> Rc { + let rc: Rc<[u8]> = Rc::from(&self.inner); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Slice) } + } } diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs index d87364b812..3fd5497389 100644 --- a/src/libstd/sys/redox/process.rs +++ b/src/libstd/sys/redox/process.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use collections::hash_map::HashMap; -use env::{self, split_paths}; +use env::{split_paths}; use ffi::OsStr; use os::unix::ffi::OsStrExt; use fmt; @@ -19,6 +18,7 @@ use sys::fd::FileDesc; use sys::fs::{File, OpenOptions}; use sys::pipe::{self, AnonPipe}; use sys::{cvt, syscall}; +use sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command @@ -44,7 +44,7 @@ pub struct Command { // other keys. program: String, args: Vec, - env: HashMap, + env: CommandEnv, cwd: Option, uid: Option, @@ -90,7 +90,7 @@ impl Command { Command { program: program.to_str().unwrap().to_owned(), args: Vec::new(), - env: HashMap::new(), + env: Default::default(), cwd: None, uid: None, gid: None, @@ -106,16 +106,8 @@ impl Command { self.args.push(arg.to_str().unwrap().to_owned()); } - pub fn env(&mut self, key: &OsStr, val: &OsStr) { - self.env.insert(key.to_str().unwrap().to_owned(), val.to_str().unwrap().to_owned()); - } - - pub fn env_remove(&mut self, key: &OsStr) { - self.env.remove(key.to_str().unwrap()); - } - - pub fn env_clear(&mut self) { - self.env.clear(); + pub fn env_mut(&mut self) -> &mut CommandEnv { + &mut self.env } pub fn cwd(&mut self, dir: &OsStr) { @@ -309,9 +301,7 @@ impl Command { args.push([arg.as_ptr() as usize, arg.len()]); } - for (key, val) in self.env.iter() { - env::set_var(key, val); - } + self.env.apply(); let program = if self.program.contains(':') || self.program.contains('/') { Some(PathBuf::from(&self.program)) diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs index 6c071afd42..cf798500b7 100644 --- a/src/libstd/sys/redox/time.rs +++ b/src/libstd/sys/redox/time.rs @@ -13,6 +13,7 @@ use fmt; use sys::{cvt, syscall}; use time::Duration; use convert::TryInto; +use core::hash::{Hash, Hasher}; const NSEC_PER_SEC: u64 = 1_000_000_000; @@ -110,12 +111,19 @@ impl Ord for Timespec { } } -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +impl Hash for Timespec { + fn hash(&self, state: &mut H) { + self.t.tv_sec.hash(state); + self.t.tv_nsec.hash(state); + } +} + +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Instant { t: Timespec, } -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct SystemTime { t: Timespec, } diff --git a/src/libstd/sys/unix/ext/process.rs b/src/libstd/sys/unix/ext/process.rs index cde21b089a..60309bec6d 100644 --- a/src/libstd/sys/unix/ext/process.rs +++ b/src/libstd/sys/unix/ext/process.rs @@ -191,3 +191,9 @@ impl IntoRawFd for process::ChildStderr { self.into_inner().into_fd().into_raw() } } + +/// Returns the OS-assigned process identifier associated with this process's parent. +#[unstable(feature = "unix_ppid", issue = "46104")] +pub fn parent_id() -> u32 { + ::sys::os::getppid() +} diff --git a/src/libstd/sys/unix/memchr.rs b/src/libstd/sys/unix/memchr.rs index aed04703ea..f49adc2416 100644 --- a/src/libstd/sys/unix/memchr.rs +++ b/src/libstd/sys/unix/memchr.rs @@ -50,7 +50,7 @@ pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { #[cfg(not(target_os = "linux"))] fn memrchr_specific(needle: u8, haystack: &[u8]) -> Option { - ::sys_common::memchr::fallback::memrchr(needle, haystack) + ::core::slice::memchr::memrchr(needle, haystack) } memrchr_specific(needle, haystack) diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 40b73f1b30..a46e855b4a 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -223,7 +223,34 @@ pub fn current_exe() -> io::Result { #[cfg(target_os = "netbsd")] pub fn current_exe() -> io::Result { - ::fs::read_link("/proc/curproc/exe") + fn sysctl() -> io::Result { + unsafe { + let mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, -1, libc::KERN_PROC_PATHNAME]; + let mut path_len: usize = 0; + cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint, + ptr::null_mut(), &mut path_len, + ptr::null(), 0))?; + if path_len <= 1 { + return Err(io::Error::new(io::ErrorKind::Other, + "KERN_PROC_PATHNAME sysctl returned zero-length string")) + } + let mut path: Vec = Vec::with_capacity(path_len); + cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint, + path.as_ptr() as *mut libc::c_void, &mut path_len, + ptr::null(), 0))?; + path.set_len(path_len - 1); // chop off NUL + Ok(PathBuf::from(OsString::from_vec(path))) + } + } + fn procfs() -> io::Result { + let curproc_exe = path::Path::new("/proc/curproc/exe"); + if curproc_exe.is_file() { + return ::fs::read_link(curproc_exe); + } + Err(io::Error::new(io::ErrorKind::Other, + "/proc/curproc/exe doesn't point to regular file.")) + } + sysctl().or_else(|_| procfs()) } #[cfg(any(target_os = "bitrig", target_os = "openbsd"))] @@ -426,7 +453,7 @@ pub fn getenv(k: &OsStr) -> io::Result> { let k = CString::new(k.as_bytes())?; unsafe { ENV_LOCK.lock(); - let s = libc::getenv(k.as_ptr()) as *const _; + let s = libc::getenv(k.as_ptr()) as *const libc::c_char; let ret = if s.is_null() { None } else { @@ -515,3 +542,7 @@ pub fn exit(code: i32) -> ! { pub fn getpid() -> u32 { unsafe { libc::getpid() as u32 } } + +pub fn getppid() -> u32 { + unsafe { libc::getppid() as u32 } +} diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index 777db17e3e..e034938799 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -15,7 +15,10 @@ use borrow::Cow; use fmt; use str; use mem; +use rc::Rc; +use sync::Arc; use sys_common::{AsInner, IntoInner}; +use sys_common::bytestring::debug_fmt_bytestring; use std_unicode::lossy::Utf8Lossy; #[derive(Clone, Hash)] @@ -29,7 +32,7 @@ pub struct Slice { impl fmt::Debug for Slice { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(&Utf8Lossy::from_bytes(&self.inner), formatter) + debug_fmt_bytestring(&self.inner, formatter) } } @@ -123,6 +126,16 @@ impl Buf { let inner: Box<[u8]> = unsafe { mem::transmute(boxed) }; Buf { inner: inner.into_vec() } } + + #[inline] + pub fn into_arc(&self) -> Arc { + self.as_slice().into_arc() + } + + #[inline] + pub fn into_rc(&self) -> Rc { + self.as_slice().into_rc() + } } impl Slice { @@ -156,4 +169,16 @@ impl Slice { let boxed: Box<[u8]> = Default::default(); unsafe { mem::transmute(boxed) } } + + #[inline] + pub fn into_arc(&self) -> Arc { + let arc: Arc<[u8]> = Arc::from(&self.inner); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Slice) } + } + + #[inline] + pub fn into_rc(&self) -> Rc { + let rc: Rc<[u8]> = Rc::from(&self.inner); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Slice) } + } } diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 383434b1cd..c53bcdbf8e 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -10,8 +10,6 @@ use os::unix::prelude::*; -use collections::hash_map::{HashMap, Entry}; -use env; use ffi::{OsString, OsStr, CString, CStr}; use fmt; use io; @@ -20,6 +18,8 @@ use ptr; use sys::fd::FileDesc; use sys::fs::{File, OpenOptions}; use sys::pipe::{self, AnonPipe}; +use sys_common::process::{CommandEnv, DefaultEnvKey}; +use collections::BTreeMap; //////////////////////////////////////////////////////////////////////////////// // Command @@ -45,9 +45,8 @@ pub struct Command { // other keys. program: CString, args: Vec, - env: Option>, argv: Vec<*const c_char>, - envp: Option>, + env: CommandEnv, cwd: Option, uid: Option, @@ -96,8 +95,7 @@ impl Command { argv: vec![program.as_ptr(), ptr::null()], program, args: Vec::new(), - env: None, - envp: None, + env: Default::default(), cwd: None, uid: None, gid: None, @@ -121,68 +119,6 @@ impl Command { self.args.push(arg); } - fn init_env_map(&mut self) -> (&mut HashMap, - &mut Vec<*const c_char>) { - if self.env.is_none() { - let mut map = HashMap::new(); - let mut envp = Vec::new(); - for (k, v) in env::vars_os() { - let s = pair_to_key(&k, &v, &mut self.saw_nul); - envp.push(s.as_ptr()); - map.insert(k, (envp.len() - 1, s)); - } - envp.push(ptr::null()); - self.env = Some(map); - self.envp = Some(envp); - } - (self.env.as_mut().unwrap(), self.envp.as_mut().unwrap()) - } - - pub fn env(&mut self, key: &OsStr, val: &OsStr) { - let new_key = pair_to_key(key, val, &mut self.saw_nul); - let (map, envp) = self.init_env_map(); - - // If `key` is already present then we just update `envp` in place - // (and store the owned value), but if it's not there we override the - // trailing NULL pointer, add a new NULL pointer, and store where we - // were located. - match map.entry(key.to_owned()) { - Entry::Occupied(mut e) => { - let (i, ref mut s) = *e.get_mut(); - envp[i] = new_key.as_ptr(); - *s = new_key; - } - Entry::Vacant(e) => { - let len = envp.len(); - envp[len - 1] = new_key.as_ptr(); - envp.push(ptr::null()); - e.insert((len - 1, new_key)); - } - } - } - - pub fn env_remove(&mut self, key: &OsStr) { - let (map, envp) = self.init_env_map(); - - // If we actually ended up removing a key, then we need to update the - // position of all keys that come after us in `envp` because they're all - // one element sooner now. - if let Some((i, _)) = map.remove(key) { - envp.remove(i); - - for (_, &mut (ref mut j, _)) in map.iter_mut() { - if *j >= i { - *j -= 1; - } - } - } - } - - pub fn env_clear(&mut self) { - self.env = Some(HashMap::new()); - self.envp = Some(vec![ptr::null()]); - } - pub fn cwd(&mut self, dir: &OsStr) { self.cwd = Some(os2c(dir, &mut self.saw_nul)); } @@ -196,9 +132,6 @@ impl Command { pub fn saw_nul(&self) -> bool { self.saw_nul } - pub fn get_envp(&self) -> &Option> { - &self.envp - } pub fn get_argv(&self) -> &Vec<*const c_char> { &self.argv } @@ -237,6 +170,15 @@ impl Command { self.stderr = Some(stderr); } + pub fn env_mut(&mut self) -> &mut CommandEnv { + &mut self.env + } + + pub fn capture_env(&mut self) -> Option { + let maybe_env = self.env.capture_if_changed(); + maybe_env.map(|env| construct_envp(env, &mut self.saw_nul)) + } + pub fn setup_io(&self, default: Stdio, needs_stdin: bool) -> io::Result<(StdioPipes, ChildPipes)> { let null = Stdio::Null; @@ -268,6 +210,53 @@ fn os2c(s: &OsStr, saw_nul: &mut bool) -> CString { }) } +// Helper type to manage ownership of the strings within a C-style array. +pub struct CStringArray { + items: Vec, + ptrs: Vec<*const c_char> +} + +impl CStringArray { + pub fn with_capacity(capacity: usize) -> Self { + let mut result = CStringArray { + items: Vec::with_capacity(capacity), + ptrs: Vec::with_capacity(capacity+1) + }; + result.ptrs.push(ptr::null()); + result + } + pub fn push(&mut self, item: CString) { + let l = self.ptrs.len(); + self.ptrs[l-1] = item.as_ptr(); + self.ptrs.push(ptr::null()); + self.items.push(item); + } + pub fn as_ptr(&self) -> *const *const c_char { + self.ptrs.as_ptr() + } +} + +fn construct_envp(env: BTreeMap, saw_nul: &mut bool) -> CStringArray { + let mut result = CStringArray::with_capacity(env.len()); + for (k, v) in env { + let mut k: OsString = k.into(); + + // Reserve additional space for '=' and null terminator + k.reserve_exact(v.len() + 2); + k.push("="); + k.push(&v); + + // Add the new entry into the array + if let Ok(item) = CString::new(k.into_vec()) { + result.push(item); + } else { + *saw_nul = true; + } + } + + result +} + impl Stdio { pub fn to_child_stdio(&self, readable: bool) -> io::Result<(ChildStdio, Option)> { @@ -337,18 +326,6 @@ impl ChildStdio { } } -fn pair_to_key(key: &OsStr, value: &OsStr, saw_nul: &mut bool) -> CString { - let (key, value) = (key.as_bytes(), value.as_bytes()); - let mut v = Vec::with_capacity(key.len() + value.len() + 1); - v.extend(key); - v.push(b'='); - v.extend(value); - CString::new(v).unwrap_or_else(|_e| { - *saw_nul = true; - CString::new("foo=bar").unwrap() - }) -} - impl fmt::Debug for Command { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.program)?; diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index a7a67ed36e..06c0540fec 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -23,6 +23,8 @@ use sys::process::process_common::*; impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) -> io::Result<(Process, StdioPipes)> { + let envp = self.capture_env(); + if self.saw_nul() { return Err(io::Error::new(io::ErrorKind::InvalidInput, "nul byte found in provided data")); @@ -30,7 +32,7 @@ impl Command { let (ours, theirs) = self.setup_io(default, needs_stdin)?; - let process_handle = unsafe { self.do_exec(theirs)? }; + let process_handle = unsafe { self.do_exec(theirs, envp.as_ref())? }; Ok((Process { handle: Handle::new(process_handle) }, ours)) } @@ -50,13 +52,13 @@ impl Command { } } - unsafe fn do_exec(&mut self, stdio: ChildPipes) + unsafe fn do_exec(&mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray>) -> io::Result { use sys::process::zircon::*; let job_handle = zx_job_default(); - let envp = match *self.get_envp() { - Some(ref envp) => envp.as_ptr(), + let envp = match maybe_envp { + Some(envp) => envp.as_ptr(), None => ptr::null(), }; diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index 743c458d58..189280a4ba 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -26,6 +26,8 @@ impl Command { const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX"; + let envp = self.capture_env(); + if self.saw_nul() { return Err(io::Error::new(ErrorKind::InvalidInput, "nul byte found in provided data")); @@ -38,7 +40,7 @@ impl Command { match cvt(libc::fork())? { 0 => { drop(input); - let err = self.do_exec(theirs); + let err = self.do_exec(theirs, envp.as_ref()); let errno = err.raw_os_error().unwrap_or(libc::EINVAL) as u32; let bytes = [ (errno >> 24) as u8, @@ -99,13 +101,15 @@ impl Command { } pub fn exec(&mut self, default: Stdio) -> io::Error { + let envp = self.capture_env(); + if self.saw_nul() { return io::Error::new(ErrorKind::InvalidInput, "nul byte found in provided data") } match self.setup_io(default, true) { - Ok((_, theirs)) => unsafe { self.do_exec(theirs) }, + Ok((_, theirs)) => unsafe { self.do_exec(theirs, envp.as_ref()) }, Err(e) => e, } } @@ -140,7 +144,11 @@ impl Command { // allocation). Instead we just close it manually. This will never // have the drop glue anyway because this code never returns (the // child will either exec() or invoke libc::exit) - unsafe fn do_exec(&mut self, stdio: ChildPipes) -> io::Error { + unsafe fn do_exec( + &mut self, + stdio: ChildPipes, + maybe_envp: Option<&CStringArray> + ) -> io::Error { use sys::{self, cvt_r}; macro_rules! t { @@ -180,7 +188,7 @@ impl Command { if let Some(ref cwd) = *self.get_cwd() { t!(cvt(libc::chdir(cwd.as_ptr()))); } - if let Some(ref envp) = *self.get_envp() { + if let Some(envp) = maybe_envp { *sys::os::environ() = envp.as_ptr(); } diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 9da33f5ada..cb249af425 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -255,10 +255,7 @@ pub mod guard { pub unsafe fn init() -> Option { let psize = os::page_size(); - let mut stackaddr = match get_stack_start() { - Some(addr) => addr, - None => return None, - }; + let mut stackaddr = get_stack_start()?; // Ensure stackaddr is page aligned! A parent process might // have reset RLIMIT_STACK to be non-page aligned. The diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 837cd7292e..8312793590 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -11,6 +11,7 @@ use cmp::Ordering; use libc; use time::Duration; +use core::hash::{Hash, Hasher}; pub use self::inner::{Instant, SystemTime, UNIX_EPOCH}; use convert::TryInto; @@ -111,6 +112,13 @@ impl Ord for Timespec { } } +impl Hash for Timespec { + fn hash(&self, state: &mut H) { + self.t.tv_sec.hash(state); + self.t.tv_nsec.hash(state); + } +} + #[cfg(any(target_os = "macos", target_os = "ios"))] mod inner { use fmt; @@ -123,12 +131,12 @@ mod inner { use super::NSEC_PER_SEC; use super::Timespec; - #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] + #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] pub struct Instant { t: u64 } - #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] + #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct SystemTime { t: Timespec, } @@ -255,12 +263,12 @@ mod inner { use super::Timespec; - #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] + #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Instant { t: Timespec, } - #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] + #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct SystemTime { t: Timespec, } diff --git a/src/libstd/sys/wasm/memchr.rs b/src/libstd/sys/wasm/memchr.rs index e611d94af3..964e359941 100644 --- a/src/libstd/sys/wasm/memchr.rs +++ b/src/libstd/sys/wasm/memchr.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub use sys_common::memchr::fallback::{memchr, memrchr}; +pub use core::slice::memchr::{memchr, memrchr}; diff --git a/src/libstd/sys/wasm/os_str.rs b/src/libstd/sys/wasm/os_str.rs index c5908a7a8d..543c22ebe1 100644 --- a/src/libstd/sys/wasm/os_str.rs +++ b/src/libstd/sys/wasm/os_str.rs @@ -15,7 +15,10 @@ use borrow::Cow; use fmt; use str; use mem; +use rc::Rc; +use sync::Arc; use sys_common::{AsInner, IntoInner}; +use sys_common::bytestring::debug_fmt_bytestring; use std_unicode::lossy::Utf8Lossy; #[derive(Clone, Hash)] @@ -29,7 +32,7 @@ pub struct Slice { impl fmt::Debug for Slice { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(&Utf8Lossy::from_bytes(&self.inner), formatter) + debug_fmt_bytestring(&self.inner, formatter) } } @@ -123,6 +126,16 @@ impl Buf { let inner: Box<[u8]> = unsafe { mem::transmute(boxed) }; Buf { inner: inner.into_vec() } } + + #[inline] + pub fn into_arc(&self) -> Arc { + self.as_slice().into_arc() + } + + #[inline] + pub fn into_rc(&self) -> Rc { + self.as_slice().into_rc() + } } impl Slice { @@ -156,4 +169,16 @@ impl Slice { let boxed: Box<[u8]> = Default::default(); unsafe { mem::transmute(boxed) } } + + #[inline] + pub fn into_arc(&self) -> Arc { + let arc: Arc<[u8]> = Arc::from(&self.inner); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Slice) } + } + + #[inline] + pub fn into_rc(&self) -> Rc { + let rc: Rc<[u8]> = Rc::from(&self.inner); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Slice) } + } } diff --git a/src/libstd/sys/wasm/process.rs b/src/libstd/sys/wasm/process.rs index 4febe8a146..f3f5de350f 100644 --- a/src/libstd/sys/wasm/process.rs +++ b/src/libstd/sys/wasm/process.rs @@ -14,12 +14,14 @@ use io; use sys::fs::File; use sys::pipe::AnonPipe; use sys::{unsupported, Void}; +use sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command //////////////////////////////////////////////////////////////////////////////// pub struct Command { + env: CommandEnv } // passed back to std::process with the pipes connected to the child, if any @@ -38,19 +40,16 @@ pub enum Stdio { impl Command { pub fn new(_program: &OsStr) -> Command { - Command {} + Command { + env: Default::default() + } } pub fn arg(&mut self, _arg: &OsStr) { } - pub fn env(&mut self, _key: &OsStr, _val: &OsStr) { - } - - pub fn env_remove(&mut self, _key: &OsStr) { - } - - pub fn env_clear(&mut self) { + pub fn env_mut(&mut self) -> &mut CommandEnv { + &mut self.env } pub fn cwd(&mut self, _dir: &OsStr) { diff --git a/src/libstd/sys/wasm/time.rs b/src/libstd/sys/wasm/time.rs index 7907720e4d..c269def98f 100644 --- a/src/libstd/sys/wasm/time.rs +++ b/src/libstd/sys/wasm/time.rs @@ -11,10 +11,10 @@ use fmt; use time::Duration; -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] pub struct Instant; -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct SystemTime; pub const UNIX_EPOCH: SystemTime = SystemTime; diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index ae9535139d..165e1b0609 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -770,7 +770,7 @@ fn symlink_junction_inner(target: &Path, junction: &Path) -> io::Result<()> { let mut data = [0u8; c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; let db = data.as_mut_ptr() as *mut c::REPARSE_MOUNTPOINT_DATA_BUFFER; - let buf = &mut (*db).ReparseTarget as *mut _; + let buf = &mut (*db).ReparseTarget as *mut c::WCHAR; let mut i = 0; // FIXME: this conversion is very hacky let v = br"\??\"; diff --git a/src/libstd/sys/windows/memchr.rs b/src/libstd/sys/windows/memchr.rs index 5a5386acaa..fa7c816fd0 100644 --- a/src/libstd/sys/windows/memchr.rs +++ b/src/libstd/sys/windows/memchr.rs @@ -12,4 +12,4 @@ // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch // Fallback memchr is fastest on windows -pub use sys_common::memchr::fallback::{memchr, memrchr}; +pub use core::slice::memchr::{memchr, memrchr}; diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index 3eb4582718..414c9c5418 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -15,7 +15,9 @@ use borrow::Cow; use fmt; use sys_common::wtf8::{Wtf8, Wtf8Buf}; use mem; -use sys_common::{AsInner, IntoInner}; +use rc::Rc; +use sync::Arc; +use sys_common::{AsInner, IntoInner, FromInner}; #[derive(Clone, Hash)] pub struct Buf { @@ -28,6 +30,12 @@ impl IntoInner for Buf { } } +impl FromInner for Buf { + fn from_inner(inner: Wtf8Buf) -> Self { + Buf { inner } + } +} + impl AsInner for Buf { fn as_inner(&self) -> &Wtf8 { &self.inner @@ -115,6 +123,16 @@ impl Buf { let inner: Box = unsafe { mem::transmute(boxed) }; Buf { inner: Wtf8Buf::from_box(inner) } } + + #[inline] + pub fn into_arc(&self) -> Arc { + self.as_slice().into_arc() + } + + #[inline] + pub fn into_rc(&self) -> Rc { + self.as_slice().into_rc() + } } impl Slice { @@ -144,4 +162,16 @@ impl Slice { pub fn empty_box() -> Box { unsafe { mem::transmute(Wtf8::empty_box()) } } + + #[inline] + pub fn into_arc(&self) -> Arc { + let arc = self.inner.into_arc(); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Slice) } + } + + #[inline] + pub fn into_rc(&self) -> Rc { + let rc = self.inner.into_rc(); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Slice) } + } } diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 631d69b05e..c93179869a 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![unstable(feature = "process_internals", issue = "0")] + use ascii::AsciiExt; -use collections::HashMap; -use collections; +use collections::BTreeMap; use env::split_paths; use env; use ffi::{OsString, OsStr}; @@ -28,19 +29,42 @@ use sys::fs::{OpenOptions, File}; use sys::handle::Handle; use sys::pipe::{self, AnonPipe}; use sys::stdio; -use sys::{self, cvt}; -use sys_common::{AsInner, FromInner}; +use sys::cvt; +use sys_common::{AsInner, FromInner, IntoInner}; +use sys_common::process::{CommandEnv, EnvKey}; +use alloc::borrow::Borrow; //////////////////////////////////////////////////////////////////////////////// // Command //////////////////////////////////////////////////////////////////////////////// -fn mk_key(s: &OsStr) -> OsString { - FromInner::from_inner(sys::os_str::Buf { - inner: s.as_inner().inner.to_ascii_uppercase() - }) +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] +#[doc(hidden)] +pub struct WindowsEnvKey(OsString); + +impl From for WindowsEnvKey { + fn from(k: OsString) -> Self { + let mut buf = k.into_inner().into_inner(); + buf.make_ascii_uppercase(); + WindowsEnvKey(FromInner::from_inner(FromInner::from_inner(buf))) + } } +impl From for OsString { + fn from(k: WindowsEnvKey) -> Self { k.0 } +} + +impl Borrow for WindowsEnvKey { + fn borrow(&self) -> &OsStr { &self.0 } +} + +impl AsRef for WindowsEnvKey { + fn as_ref(&self) -> &OsStr { &self.0 } +} + +impl EnvKey for WindowsEnvKey {} + + fn ensure_no_nuls>(str: T) -> io::Result { if str.as_ref().encode_wide().any(|b| b == 0) { Err(io::Error::new(ErrorKind::InvalidInput, "nul byte found in provided data")) @@ -52,7 +76,7 @@ fn ensure_no_nuls>(str: T) -> io::Result { pub struct Command { program: OsString, args: Vec, - env: Option>, + env: CommandEnv, cwd: Option, flags: u32, detach: bool, // not currently exposed in std::process @@ -83,7 +107,7 @@ impl Command { Command { program: program.to_os_string(), args: Vec::new(), - env: None, + env: Default::default(), cwd: None, flags: 0, detach: false, @@ -96,23 +120,8 @@ impl Command { pub fn arg(&mut self, arg: &OsStr) { self.args.push(arg.to_os_string()) } - fn init_env_map(&mut self){ - if self.env.is_none() { - self.env = Some(env::vars_os().map(|(key, val)| { - (mk_key(&key), val) - }).collect()); - } - } - pub fn env(&mut self, key: &OsStr, val: &OsStr) { - self.init_env_map(); - self.env.as_mut().unwrap().insert(mk_key(key), val.to_os_string()); - } - pub fn env_remove(&mut self, key: &OsStr) { - self.init_env_map(); - self.env.as_mut().unwrap().remove(&mk_key(key)); - } - pub fn env_clear(&mut self) { - self.env = Some(HashMap::new()) + pub fn env_mut(&mut self) -> &mut CommandEnv { + &mut self.env } pub fn cwd(&mut self, dir: &OsStr) { self.cwd = Some(dir.to_os_string()) @@ -132,13 +141,12 @@ impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) -> io::Result<(Process, StdioPipes)> { + let maybe_env = self.env.capture_if_changed(); // To have the spawning semantics of unix/windows stay the same, we need // to read the *child's* PATH if one is provided. See #15149 for more // details. - let program = self.env.as_ref().and_then(|env| { - for (key, v) in env { - if OsStr::new("PATH") != &**key { continue } - + let program = maybe_env.as_ref().and_then(|env| { + if let Some(v) = env.get(OsStr::new("PATH")) { // Split the value and test each path to see if the // program exists. for path in split_paths(&v) { @@ -148,7 +156,6 @@ impl Command { return Some(path.into_os_string()) } } - break } None }); @@ -167,7 +174,7 @@ impl Command { flags |= c::DETACHED_PROCESS | c::CREATE_NEW_PROCESS_GROUP; } - let (envp, _data) = make_envp(self.env.as_ref())?; + let (envp, _data) = make_envp(maybe_env)?; let (dirp, _data) = make_dirp(self.cwd.as_ref())?; let mut pi = zeroed_process_information(); @@ -488,25 +495,24 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result> { } } -fn make_envp(env: Option<&collections::HashMap>) +fn make_envp(maybe_env: Option>) -> io::Result<(*mut c_void, Vec)> { // On Windows we pass an "environment block" which is not a char**, but // rather a concatenation of null-terminated k=v\0 sequences, with a final // \0 to terminate. - match env { - Some(env) => { - let mut blk = Vec::new(); + if let Some(env) = maybe_env { + let mut blk = Vec::new(); - for pair in env { - blk.extend(ensure_no_nuls(pair.0)?.encode_wide()); - blk.push('=' as u16); - blk.extend(ensure_no_nuls(pair.1)?.encode_wide()); - blk.push(0); - } + for (k, v) in env { + blk.extend(ensure_no_nuls(k.0)?.encode_wide()); + blk.push('=' as u16); + blk.extend(ensure_no_nuls(v)?.encode_wide()); blk.push(0); - Ok((blk.as_mut_ptr() as *mut c_void, blk)) } - _ => Ok((ptr::null_mut(), Vec::new())) + blk.push(0); + Ok((blk.as_mut_ptr() as *mut c_void, blk)) + } else { + Ok((ptr::null_mut(), Vec::new())) } } diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 7ae9ed917b..cdad320e12 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -200,8 +200,9 @@ unsafe fn register_dtor(key: Key, dtor: Dtor) { // the address of the symbol to ensure it sticks around. #[link_section = ".CRT$XLB"] -#[linkage = "external"] #[allow(dead_code, unused_variables)] +#[used] // we don't want LLVM eliminating this symbol for any reason, and + // when the symbol makes it to the linker the linker will take over pub static p_thread_callback: unsafe extern "system" fn(c::LPVOID, c::DWORD, c::LPVOID) = on_tls_callback; diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 1be29b5139..07e64d386a 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -17,11 +17,12 @@ use sys::cvt; use sys_common::mul_div_u64; use time::Duration; use convert::TryInto; +use core::hash::{Hash, Hasher}; const NANOS_PER_SEC: u64 = 1_000_000_000; const INTERVALS_PER_SEC: u64 = NANOS_PER_SEC / 100; -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)] pub struct Instant { t: c::LARGE_INTEGER, } @@ -173,6 +174,12 @@ impl From for SystemTime { } } +impl Hash for SystemTime { + fn hash(&self, state: &mut H) { + self.intervals().hash(state) + } +} + fn dur2intervals(d: &Duration) -> i64 { d.as_secs() .checked_mul(INTERVALS_PER_SEC) diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 9f0214f5f0..36cbce2df7 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -128,7 +128,7 @@ fn filter_frames(frames: &[Frame], /// Fixed frame used to clean the backtrace with `RUST_BACKTRACE=1`. #[inline(never)] pub fn __rust_begin_short_backtrace(f: F) -> T - where F: FnOnce() -> T, F: Send + 'static, T: Send + 'static + where F: FnOnce() -> T, F: Send, T: Send { f() } @@ -252,8 +252,26 @@ fn output_fileline(w: &mut Write, // Note that this demangler isn't quite as fancy as it could be. We have lots // of other information in our symbols like hashes, version, type information, // etc. Additionally, this doesn't handle glue symbols at all. -pub fn demangle(writer: &mut Write, s: &str, format: PrintFormat) -> io::Result<()> { - // First validate the symbol. If it doesn't look like anything we're +pub fn demangle(writer: &mut Write, mut s: &str, format: PrintFormat) -> io::Result<()> { + // During ThinLTO LLVM may import and rename internal symbols, so strip out + // those endings first as they're one of the last manglings applied to + // symbol names. + let llvm = ".llvm."; + if let Some(i) = s.find(llvm) { + let candidate = &s[i + llvm.len()..]; + let all_hex = candidate.chars().all(|c| { + match c { + 'A' ... 'F' | '0' ... '9' => true, + _ => false, + } + }); + + if all_hex { + s = &s[..i]; + } + } + + // Validate the symbol. If it doesn't look like anything we're // expecting, we just print it literally. Note that we must handle non-rust // symbols because we could have any function in the backtrace. let mut valid = true; diff --git a/src/libstd/sys_common/bytestring.rs b/src/libstd/sys_common/bytestring.rs new file mode 100644 index 0000000000..eb9cad0991 --- /dev/null +++ b/src/libstd/sys_common/bytestring.rs @@ -0,0 +1,56 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +use fmt::{Formatter, Result, Write}; +use std_unicode::lossy::{Utf8Lossy, Utf8LossyChunk}; + +pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result { + // Writes out a valid unicode string with the correct escape sequences + fn write_str_escaped(f: &mut Formatter, s: &str) -> Result { + for c in s.chars().flat_map(|c| c.escape_debug()) { + f.write_char(c)? + } + Ok(()) + } + + f.write_str("\"")?; + for Utf8LossyChunk { valid, broken } in Utf8Lossy::from_bytes(slice).chunks() { + write_str_escaped(f, valid)?; + for b in broken { + write!(f, "\\x{:02X}", b)?; + } + } + f.write_str("\"") +} + +#[cfg(test)] +mod tests { + use super::*; + use fmt::{Formatter, Result, Debug}; + + #[test] + fn smoke() { + struct Helper<'a>(&'a [u8]); + + impl<'a> Debug for Helper<'a> { + fn fmt(&self, f: &mut Formatter) -> Result { + debug_fmt_bytestring(self.0, f) + } + } + + let input = b"\xF0hello,\tworld"; + let expected = r#""\xF0hello,\tworld""#; + let output = format!("{:?}", Helper(input)); + + assert!(output == expected); + } +} diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs index 75c6bd5d2a..6ad3af6aee 100644 --- a/src/libstd/sys_common/gnu/libbacktrace.rs +++ b/src/libstd/sys_common/gnu/libbacktrace.rs @@ -73,7 +73,7 @@ pub fn resolve_symname(frame: Frame, "failed to allocate libbacktrace state") ) } - let mut data = ptr::null(); + let mut data: *const libc::c_char = ptr::null(); let data_addr = &mut data as *mut *const libc::c_char; let ret = unsafe { backtrace_syminfo(state, diff --git a/src/libstd/sys_common/memchr.rs b/src/libstd/sys_common/memchr.rs deleted file mode 100644 index 50f998eb48..0000000000 --- a/src/libstd/sys_common/memchr.rs +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// Original implementation taken from rust-memchr -// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch - -#[allow(dead_code)] -pub mod fallback { - use cmp; - use mem; - - const LO_U64: u64 = 0x0101010101010101; - const HI_U64: u64 = 0x8080808080808080; - - // use truncation - const LO_USIZE: usize = LO_U64 as usize; - const HI_USIZE: usize = HI_U64 as usize; - - /// Return `true` if `x` contains any zero byte. - /// - /// From *Matters Computational*, J. Arndt - /// - /// "The idea is to subtract one from each of the bytes and then look for - /// bytes where the borrow propagated all the way to the most significant - /// bit." - #[inline] - fn contains_zero_byte(x: usize) -> bool { - x.wrapping_sub(LO_USIZE) & !x & HI_USIZE != 0 - } - - #[cfg(target_pointer_width = "32")] - #[inline] - fn repeat_byte(b: u8) -> usize { - let mut rep = (b as usize) << 8 | b as usize; - rep = rep << 16 | rep; - rep - } - - #[cfg(target_pointer_width = "64")] - #[inline] - fn repeat_byte(b: u8) -> usize { - let mut rep = (b as usize) << 8 | b as usize; - rep = rep << 16 | rep; - rep = rep << 32 | rep; - rep - } - - /// Return the first index matching the byte `a` in `text`. - pub fn memchr(x: u8, text: &[u8]) -> Option { - // Scan for a single byte value by reading two `usize` words at a time. - // - // Split `text` in three parts - // - unaligned initial part, before the first word aligned address in text - // - body, scan by 2 words at a time - // - the last remaining part, < 2 word size - let len = text.len(); - let ptr = text.as_ptr(); - let usize_bytes = mem::size_of::(); - - // search up to an aligned boundary - let mut offset = ptr.align_offset(usize_bytes); - if offset > 0 { - offset = cmp::min(offset, len); - if let Some(index) = text[..offset].iter().position(|elt| *elt == x) { - return Some(index); - } - } - - // search the body of the text - let repeated_x = repeat_byte(x); - - if len >= 2 * usize_bytes { - while offset <= len - 2 * usize_bytes { - unsafe { - let u = *(ptr.offset(offset as isize) as *const usize); - let v = *(ptr.offset((offset + usize_bytes) as isize) as *const usize); - - // break if there is a matching byte - let zu = contains_zero_byte(u ^ repeated_x); - let zv = contains_zero_byte(v ^ repeated_x); - if zu || zv { - break; - } - } - offset += usize_bytes * 2; - } - } - - // find the byte after the point the body loop stopped - text[offset..].iter().position(|elt| *elt == x).map(|i| offset + i) - } - - /// Return the last index matching the byte `a` in `text`. - pub fn memrchr(x: u8, text: &[u8]) -> Option { - // Scan for a single byte value by reading two `usize` words at a time. - // - // Split `text` in three parts - // - unaligned tail, after the last word aligned address in text - // - body, scan by 2 words at a time - // - the first remaining bytes, < 2 word size - let len = text.len(); - let ptr = text.as_ptr(); - let usize_bytes = mem::size_of::(); - - // search to an aligned boundary - let end_align = (ptr as usize + len) & (usize_bytes - 1); - let mut offset; - if end_align > 0 { - offset = if end_align >= len { 0 } else { len - end_align }; - if let Some(index) = text[offset..].iter().rposition(|elt| *elt == x) { - return Some(offset + index); - } - } else { - offset = len; - } - - // search the body of the text - let repeated_x = repeat_byte(x); - - while offset >= 2 * usize_bytes { - unsafe { - let u = *(ptr.offset(offset as isize - 2 * usize_bytes as isize) as *const usize); - let v = *(ptr.offset(offset as isize - usize_bytes as isize) as *const usize); - - // break if there is a matching byte - let zu = contains_zero_byte(u ^ repeated_x); - let zv = contains_zero_byte(v ^ repeated_x); - if zu || zv { - break; - } - } - offset -= 2 * usize_bytes; - } - - // find the byte before the point the body loop stopped - text[..offset].iter().rposition(|elt| *elt == x) - } - - // test fallback implementations on all platforms - #[test] - fn matches_one() { - assert_eq!(Some(0), memchr(b'a', b"a")); - } - - #[test] - fn matches_begin() { - assert_eq!(Some(0), memchr(b'a', b"aaaa")); - } - - #[test] - fn matches_end() { - assert_eq!(Some(4), memchr(b'z', b"aaaaz")); - } - - #[test] - fn matches_nul() { - assert_eq!(Some(4), memchr(b'\x00', b"aaaa\x00")); - } - - #[test] - fn matches_past_nul() { - assert_eq!(Some(5), memchr(b'z', b"aaaa\x00z")); - } - - #[test] - fn no_match_empty() { - assert_eq!(None, memchr(b'a', b"")); - } - - #[test] - fn no_match() { - assert_eq!(None, memchr(b'a', b"xyz")); - } - - #[test] - fn matches_one_reversed() { - assert_eq!(Some(0), memrchr(b'a', b"a")); - } - - #[test] - fn matches_begin_reversed() { - assert_eq!(Some(3), memrchr(b'a', b"aaaa")); - } - - #[test] - fn matches_end_reversed() { - assert_eq!(Some(0), memrchr(b'z', b"zaaaa")); - } - - #[test] - fn matches_nul_reversed() { - assert_eq!(Some(4), memrchr(b'\x00', b"aaaa\x00")); - } - - #[test] - fn matches_past_nul_reversed() { - assert_eq!(Some(0), memrchr(b'z', b"z\x00aaaa")); - } - - #[test] - fn no_match_empty_reversed() { - assert_eq!(None, memrchr(b'a', b"")); - } - - #[test] - fn no_match_reversed() { - assert_eq!(None, memrchr(b'a', b"xyz")); - } - - #[test] - fn each_alignment_reversed() { - let mut data = [1u8; 64]; - let needle = 2; - let pos = 40; - data[pos] = needle; - for start in 0..16 { - assert_eq!(Some(pos - start), memrchr(needle, &data[start..])); - } - } -} diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index 14e5697b94..938e865680 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -33,7 +33,6 @@ pub mod at_exit_imp; pub mod backtrace; pub mod condvar; pub mod io; -pub mod memchr; pub mod mutex; pub mod poison; pub mod remutex; @@ -43,6 +42,8 @@ pub mod thread_info; pub mod thread_local; pub mod util; pub mod wtf8; +pub mod bytestring; +pub mod process; cfg_if! { if #[cfg(any(target_os = "redox", target_os = "l4re"))] { diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index c76b0bcf1c..c70b39995e 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -136,10 +136,7 @@ impl Iterator for LookupHost { fn next(&mut self) -> Option { loop { unsafe { - let cur = match self.cur.as_ref() { - None => return None, - Some(c) => c, - }; + let cur = self.cur.as_ref()?; self.cur = cur.ai_next; match sockaddr_to_addr(mem::transmute(cur.ai_addr), cur.ai_addrlen as usize) diff --git a/src/libstd/sys_common/process.rs b/src/libstd/sys_common/process.rs new file mode 100644 index 0000000000..fd1a5fdb41 --- /dev/null +++ b/src/libstd/sys_common/process.rs @@ -0,0 +1,124 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] +#![unstable(feature = "process_internals", issue = "0")] + +use ffi::{OsStr, OsString}; +use env; +use collections::BTreeMap; +use alloc::borrow::Borrow; + +pub trait EnvKey: + From + Into + + Borrow + Borrow + AsRef + + Ord + Clone {} + +// Implement a case-sensitive environment variable key +#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] +pub struct DefaultEnvKey(OsString); + +impl From for DefaultEnvKey { + fn from(k: OsString) -> Self { DefaultEnvKey(k) } +} + +impl From for OsString { + fn from(k: DefaultEnvKey) -> Self { k.0 } +} + +impl Borrow for DefaultEnvKey { + fn borrow(&self) -> &OsStr { &self.0 } +} + +impl AsRef for DefaultEnvKey { + fn as_ref(&self) -> &OsStr { &self.0 } +} + +impl EnvKey for DefaultEnvKey {} + +// Stores a set of changes to an environment +#[derive(Clone, Debug)] +pub struct CommandEnv { + clear: bool, + vars: BTreeMap> +} + +impl Default for CommandEnv { + fn default() -> Self { + CommandEnv { + clear: false, + vars: Default::default() + } + } +} + +impl CommandEnv { + // Capture the current environment with these changes applied + pub fn capture(&self) -> BTreeMap { + let mut result = BTreeMap::::new(); + if !self.clear { + for (k, v) in env::vars_os() { + result.insert(k.into(), v); + } + } + for (k, maybe_v) in &self.vars { + if let &Some(ref v) = maybe_v { + result.insert(k.clone(), v.clone()); + } else { + result.remove(k); + } + } + result + } + + // Apply these changes directly to the current environment + pub fn apply(&self) { + if self.clear { + for (k, _) in env::vars_os() { + env::remove_var(k); + } + } + for (key, maybe_val) in self.vars.iter() { + if let &Some(ref val) = maybe_val { + env::set_var(key, val); + } else { + env::remove_var(key); + } + } + } + + pub fn is_unchanged(&self) -> bool { + !self.clear && self.vars.is_empty() + } + + pub fn capture_if_changed(&self) -> Option> { + if self.is_unchanged() { + None + } else { + Some(self.capture()) + } + } + + // The following functions build up changes + pub fn set(&mut self, key: &OsStr, value: &OsStr) { + self.vars.insert(key.to_owned().into(), Some(value.to_owned())); + } + pub fn remove(&mut self, key: &OsStr) { + if self.clear { + self.vars.remove(key); + } else { + self.vars.insert(key.to_owned().into(), None); + } + } + pub fn clear(&mut self) { + self.clear = true; + self.vars.clear(); + } +} diff --git a/src/libstd/sys_common/thread_local.rs b/src/libstd/sys_common/thread_local.rs index 87ffd304e1..a4aa3d96d2 100644 --- a/src/libstd/sys_common/thread_local.rs +++ b/src/libstd/sys_common/thread_local.rs @@ -262,7 +262,7 @@ pub unsafe fn register_dtor_fallback(t: *mut u8, unsafe extern fn run_dtors(mut ptr: *mut u8) { while !ptr.is_null() { let list: Box = Box::from_raw(ptr as *mut List); - for &(ptr, dtor) in list.iter() { + for (ptr, dtor) in list.into_iter() { dtor(ptr); } ptr = DTORS.get(); diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index b89a73cd28..46d554d641 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -35,8 +35,10 @@ use hash::{Hash, Hasher}; use iter::FromIterator; use mem; use ops; +use rc::Rc; use slice; use str; +use sync::Arc; use sys_common::AsInner; const UTF8_REPLACEMENT_CHARACTER: &'static str = "\u{FFFD}"; @@ -132,6 +134,12 @@ impl ops::Deref for Wtf8Buf { } } +impl ops::DerefMut for Wtf8Buf { + fn deref_mut(&mut self) -> &mut Wtf8 { + self.as_mut_slice() + } +} + /// Format the string with double quotes, /// and surrogates as `\u` followed by four hexadecimal digits. /// Example: `"a\u{D800}"` for a string with code points [U+0061, U+D800] @@ -219,6 +227,11 @@ impl Wtf8Buf { unsafe { Wtf8::from_bytes_unchecked(&self.bytes) } } + #[inline] + pub fn as_mut_slice(&mut self) -> &mut Wtf8 { + unsafe { Wtf8::from_mut_bytes_unchecked(&mut self.bytes) } + } + /// Reserves capacity for at least `additional` more bytes to be inserted /// in the given `Wtf8Buf`. /// The collection may reserve more space to avoid frequent reallocations. @@ -484,6 +497,15 @@ impl Wtf8 { mem::transmute(value) } + /// Creates a mutable WTF-8 slice from a mutable WTF-8 byte slice. + /// + /// Since the byte slice is not checked for valid WTF-8, this functions is + /// marked unsafe. + #[inline] + unsafe fn from_mut_bytes_unchecked(value: &mut [u8]) -> &mut Wtf8 { + mem::transmute(value) + } + /// Returns the length, in WTF-8 bytes. #[inline] pub fn len(&self) -> usize { @@ -576,10 +598,7 @@ impl Wtf8 { fn next_surrogate(&self, mut pos: usize) -> Option<(usize, u16)> { let mut iter = self.bytes[pos..].iter(); loop { - let b = match iter.next() { - None => return None, - Some(&b) => b, - }; + let b = *iter.next()?; if b < 0x80 { pos += 1; } else if b < 0xE0 { @@ -641,6 +660,18 @@ impl Wtf8 { let boxed: Box<[u8]> = Default::default(); unsafe { mem::transmute(boxed) } } + + #[inline] + pub fn into_arc(&self) -> Arc { + let arc: Arc<[u8]> = Arc::from(&self.bytes); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Wtf8) } + } + + #[inline] + pub fn into_rc(&self) -> Rc { + let rc: Rc<[u8]> = Rc::from(&self.bytes); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Wtf8) } + } } diff --git a/src/libstd/termination.rs b/src/libstd/termination.rs new file mode 100644 index 0000000000..61137ba492 --- /dev/null +++ b/src/libstd/termination.rs @@ -0,0 +1,86 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use error::Error; +#[cfg(target_arch = "wasm32")] +mod exit { + pub const SUCCESS: i32 = 0; + pub const FAILURE: i32 = 1; +} +#[cfg(not(target_arch = "wasm32"))] +mod exit { + use libc; + pub const SUCCESS: i32 = libc::EXIT_SUCCESS; + pub const FAILURE: i32 = libc::EXIT_FAILURE; +} + +/// A trait for implementing arbitrary return types in the `main` function. +/// +/// The c-main function only supports to return integers as return type. +/// So, every type implementing the `Termination` trait has to be converted +/// to an integer. +/// +/// The default implementations are returning `libc::EXIT_SUCCESS` to indicate +/// a successful execution. In case of a failure, `libc::EXIT_FAILURE` is returned. +#[cfg_attr(not(any(stage0, test)), lang = "termination")] +#[unstable(feature = "termination_trait", issue = "43301")] +#[rustc_on_unimplemented = + "`main` can only return types that implement {Termination}, not `{Self}`"] +pub trait Termination { + /// Is called to get the representation of the value as status code. + /// This status code is returned to the operating system. + fn report(self) -> i32; +} + +#[unstable(feature = "termination_trait", issue = "43301")] +impl Termination for () { + fn report(self) -> i32 { exit::SUCCESS } +} + +#[unstable(feature = "termination_trait", issue = "43301")] +impl Termination for Result { + fn report(self) -> i32 { + match self { + Ok(val) => val.report(), + Err(err) => { + print_error(err); + exit::FAILURE + } + } + } +} + +#[unstable(feature = "termination_trait", issue = "43301")] +fn print_error(err: E) { + eprintln!("Error: {}", err.description()); + + if let Some(ref err) = err.cause() { + eprintln!("Caused by: {}", err.description()); + } +} + +#[unstable(feature = "termination_trait", issue = "43301")] +impl Termination for ! { + fn report(self) -> i32 { unreachable!(); } +} + +#[unstable(feature = "termination_trait", issue = "43301")] +impl Termination for bool { + fn report(self) -> i32 { + if self { exit::SUCCESS } else { exit::FAILURE } + } +} + +#[unstable(feature = "termination_trait", issue = "43301")] +impl Termination for i32 { + fn report(self) -> i32 { + self + } +} diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 86927ce322..15ddb62bab 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -108,7 +108,7 @@ impl Duration { /// let duration = Duration::from_millis(2569); /// /// assert_eq!(2, duration.as_secs()); - /// assert_eq!(569000000, duration.subsec_nanos()); + /// assert_eq!(569_000_000, duration.subsec_nanos()); /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] @@ -139,6 +139,27 @@ impl Duration { Duration { secs: secs, nanos: nanos } } + /// Creates a new `Duration` from the specified number of nanoseconds. + /// + /// # Examples + /// + /// ``` + /// #![feature(duration_extras)] + /// use std::time::Duration; + /// + /// let duration = Duration::from_nanos(1_000_000_123); + /// + /// assert_eq!(1, duration.as_secs()); + /// assert_eq!(123, duration.subsec_nanos()); + /// ``` + #[unstable(feature = "duration_extras", issue = "46507")] + #[inline] + pub fn from_nanos(nanos: u64) -> Duration { + let secs = nanos / (NANOS_PER_SEC as u64); + let nanos = (nanos % (NANOS_PER_SEC as u64)) as u32; + Duration { secs: secs, nanos: nanos } + } + /// Returns the number of _whole_ seconds contained by this `Duration`. /// /// The returned value does not include the fractional (nanosecond) part of the @@ -171,6 +192,46 @@ impl Duration { #[inline] pub fn as_secs(&self) -> u64 { self.secs } + /// Returns the fractional part of this `Duration`, in milliseconds. + /// + /// This method does **not** return the length of the duration when + /// represented by milliseconds. The returned number always represents a + /// fractional portion of a second (i.e. it is less than one thousand). + /// + /// # Examples + /// + /// ``` + /// #![feature(duration_extras)] + /// use std::time::Duration; + /// + /// let duration = Duration::from_millis(5432); + /// assert_eq!(duration.as_secs(), 5); + /// assert_eq!(duration.subsec_nanos(), 432_000_000); + /// ``` + #[unstable(feature = "duration_extras", issue = "46507")] + #[inline] + pub fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI } + + /// Returns the fractional part of this `Duration`, in microseconds. + /// + /// This method does **not** return the length of the duration when + /// represented by microseconds. The returned number always represents a + /// fractional portion of a second (i.e. it is less than one million). + /// + /// # Examples + /// + /// ``` + /// #![feature(duration_extras, duration_from_micros)] + /// use std::time::Duration; + /// + /// let duration = Duration::from_micros(1_234_567); + /// assert_eq!(duration.as_secs(), 1); + /// assert_eq!(duration.subsec_nanos(), 234_567_000); + /// ``` + #[unstable(feature = "duration_extras", issue = "46507")] + #[inline] + pub fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO } + /// Returns the fractional part of this `Duration`, in nanoseconds. /// /// This method does **not** return the length of the duration when @@ -229,7 +290,7 @@ impl Duration { } /// Checked `Duration` subtraction. Computes `self - other`, returning [`None`] - /// if the result would be negative or if underflow occurred. + /// if the result would be negative or if overflow occurred. /// /// [`None`]: ../../std/option/enum.Option.html#variant.None /// diff --git a/src/libstd/time/mod.rs b/src/libstd/time/mod.rs index d4993ded84..6ce3b3e8a0 100644 --- a/src/libstd/time/mod.rs +++ b/src/libstd/time/mod.rs @@ -66,7 +66,7 @@ mod duration; /// println!("{}", now.elapsed().as_secs()); /// } /// ``` -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[stable(feature = "time2", since = "1.8.0")] pub struct Instant(time::Instant); @@ -118,7 +118,7 @@ pub struct Instant(time::Instant); /// } /// } /// ``` -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[stable(feature = "time2", since = "1.8.0")] pub struct SystemTime(time::SystemTime); diff --git a/src/libstd_unicode/char.rs b/src/libstd_unicode/char.rs index e20937c6c7..f9ad6f9fcc 100644 --- a/src/libstd_unicode/char.rs +++ b/src/libstd_unicode/char.rs @@ -57,6 +57,7 @@ pub use tables::{UnicodeVersion, UNICODE_VERSION}; /// [`to_lowercase`]: ../../std/primitive.char.html#method.to_lowercase /// [`char`]: ../../std/primitive.char.html #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct ToLowercase(CaseMappingIter); #[stable(feature = "rust1", since = "1.0.0")] @@ -78,6 +79,7 @@ impl FusedIterator for ToLowercase {} /// [`to_uppercase`]: ../../std/primitive.char.html#method.to_uppercase /// [`char`]: ../../std/primitive.char.html #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct ToUppercase(CaseMappingIter); #[stable(feature = "rust1", since = "1.0.0")] @@ -91,6 +93,7 @@ impl Iterator for ToUppercase { #[unstable(feature = "fused", issue = "35602")] impl FusedIterator for ToUppercase {} +#[derive(Debug)] enum CaseMappingIter { Three(char, char, char), Two(char, char), @@ -935,7 +938,7 @@ impl char { /// assert!(ascii.is_ascii()); /// assert!(!non_ascii.is_ascii()); /// ``` - #[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")] + #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] pub fn is_ascii(&self) -> bool { *self as u32 <= 0x7F @@ -963,7 +966,7 @@ impl char { /// /// [`make_ascii_uppercase`]: #method.make_ascii_uppercase /// [`to_uppercase`]: #method.to_uppercase - #[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")] + #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] pub fn to_ascii_uppercase(&self) -> char { if self.is_ascii() { @@ -995,7 +998,7 @@ impl char { /// /// [`make_ascii_lowercase`]: #method.make_ascii_lowercase /// [`to_lowercase`]: #method.to_lowercase - #[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")] + #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] pub fn to_ascii_lowercase(&self) -> char { if self.is_ascii() { @@ -1020,7 +1023,7 @@ impl char { /// assert!(upper_a.eq_ignore_ascii_case(&upper_a)); /// assert!(!upper_a.eq_ignore_ascii_case(&lower_z)); /// ``` - #[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")] + #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] pub fn eq_ignore_ascii_case(&self, other: &char) -> bool { self.to_ascii_lowercase() == other.to_ascii_lowercase() @@ -1045,7 +1048,7 @@ impl char { /// ``` /// /// [`to_ascii_uppercase`]: #method.to_ascii_uppercase - #[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")] + #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] pub fn make_ascii_uppercase(&mut self) { *self = self.to_ascii_uppercase(); @@ -1070,7 +1073,7 @@ impl char { /// ``` /// /// [`to_ascii_lowercase`]: #method.to_ascii_lowercase - #[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")] + #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] pub fn make_ascii_lowercase(&mut self) { *self = self.to_ascii_lowercase(); @@ -1106,7 +1109,7 @@ impl char { /// assert!(!lf.is_ascii_alphabetic()); /// assert!(!esc.is_ascii_alphabetic()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_alphabetic(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_alphabetic() @@ -1140,7 +1143,7 @@ impl char { /// assert!(!lf.is_ascii_uppercase()); /// assert!(!esc.is_ascii_uppercase()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_uppercase(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_uppercase() @@ -1174,7 +1177,7 @@ impl char { /// assert!(!lf.is_ascii_lowercase()); /// assert!(!esc.is_ascii_lowercase()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_lowercase(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_lowercase() @@ -1211,7 +1214,7 @@ impl char { /// assert!(!lf.is_ascii_alphanumeric()); /// assert!(!esc.is_ascii_alphanumeric()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_alphanumeric(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_alphanumeric() @@ -1245,7 +1248,7 @@ impl char { /// assert!(!lf.is_ascii_digit()); /// assert!(!esc.is_ascii_digit()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_digit(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_digit() @@ -1282,7 +1285,7 @@ impl char { /// assert!(!lf.is_ascii_hexdigit()); /// assert!(!esc.is_ascii_hexdigit()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_hexdigit(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_hexdigit() @@ -1320,7 +1323,7 @@ impl char { /// assert!(!lf.is_ascii_punctuation()); /// assert!(!esc.is_ascii_punctuation()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_punctuation(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_punctuation() @@ -1354,7 +1357,7 @@ impl char { /// assert!(!lf.is_ascii_graphic()); /// assert!(!esc.is_ascii_graphic()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_graphic(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_graphic() @@ -1405,7 +1408,7 @@ impl char { /// assert!(lf.is_ascii_whitespace()); /// assert!(!esc.is_ascii_whitespace()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_whitespace(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_whitespace() @@ -1441,7 +1444,7 @@ impl char { /// assert!(lf.is_ascii_control()); /// assert!(esc.is_ascii_control()); /// ``` - #[unstable(feature = "ascii_ctype", issue = "39658")] + #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")] #[inline] pub fn is_ascii_control(&self) -> bool { self.is_ascii() && (*self as u8).is_ascii_control() @@ -1450,7 +1453,7 @@ impl char { /// An iterator that decodes UTF-16 encoded code points from an iterator of `u16`s. #[stable(feature = "decode_utf16", since = "1.9.0")] -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct DecodeUtf16 where I: Iterator { @@ -1458,7 +1461,7 @@ pub struct DecodeUtf16 buf: Option, } -/// An iterator that decodes UTF-16 encoded code points from an iterator of `u16`s. +/// An error that can be returned when decoding UTF-16 code points. #[stable(feature = "decode_utf16", since = "1.9.0")] #[derive(Debug, Clone, Eq, PartialEq)] pub struct DecodeUtf16Error { @@ -1525,12 +1528,7 @@ impl> Iterator for DecodeUtf16 { fn next(&mut self) -> Option> { let u = match self.buf.take() { Some(buf) => buf, - None => { - match self.iter.next() { - Some(u) => u, - None => return None, - } - } + None => self.iter.next()? }; if u < 0xD800 || 0xDFFF < u { diff --git a/src/libstd_unicode/lib.rs b/src/libstd_unicode/lib.rs index 65058b6554..22f8bdab2f 100644 --- a/src/libstd_unicode/lib.rs +++ b/src/libstd_unicode/lib.rs @@ -28,6 +28,7 @@ issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))] #![deny(warnings)] +#![deny(missing_debug_implementations)] #![no_std] #![feature(ascii_ctype)] diff --git a/src/libstd_unicode/lossy.rs b/src/libstd_unicode/lossy.rs index 253dcb6a15..cc8e93308a 100644 --- a/src/libstd_unicode/lossy.rs +++ b/src/libstd_unicode/lossy.rs @@ -38,6 +38,7 @@ impl Utf8Lossy { /// Iterator over lossy UTF-8 string #[unstable(feature = "str_internals", issue = "0")] +#[allow(missing_debug_implementations)] pub struct Utf8LossyChunksIter<'a> { source: &'a [u8], } diff --git a/src/libstd_unicode/u_str.rs b/src/libstd_unicode/u_str.rs index 0046e3f7bd..5d1611acb7 100644 --- a/src/libstd_unicode/u_str.rs +++ b/src/libstd_unicode/u_str.rs @@ -76,6 +76,7 @@ impl UnicodeStr for str { /// Iterator adaptor for encoding `char`s to UTF-16. #[derive(Clone)] +#[allow(missing_debug_implementations)] pub struct Utf16Encoder { chars: I, extra: u16, diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index fb1f300f63..07631e0dcf 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["dylib"] [dependencies] bitflags = "1.0" serialize = { path = "../libserialize" } -log = "0.3" +log = "0.4" syntax_pos = { path = "../libsyntax_pos" } rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } rustc_errors = { path = "../librustc_errors" } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 99dff4edaa..15682b2d45 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -12,7 +12,6 @@ pub use self::TyParamBound::*; pub use self::UnsafeSource::*; -pub use self::ViewPath_::*; pub use self::PathParameters::*; pub use symbol::{Ident, Symbol as Name}; pub use util::ThinVec; @@ -96,10 +95,15 @@ impl Path { } } + // Add starting "crate root" segment to all paths except those that + // already have it or start with `self`, `super`, `Self` or `$crate`. pub fn default_to_global(mut self) -> Path { - if !self.is_global() && - !::parse::token::Ident(self.segments[0].identifier).is_path_segment_keyword() { - self.segments.insert(0, PathSegment::crate_root(self.span)); + if !self.is_global() { + let ident = self.segments[0].identifier; + if !::parse::token::Ident(ident).is_path_segment_keyword() || + ident.name == keywords::Crate.name() { + self.segments.insert(0, PathSegment::crate_root(self.span)); + } } self } @@ -297,30 +301,56 @@ pub struct TyParam { pub span: Span, } -/// Represents lifetimes and type parameters attached to a declaration -/// of a function, enum, trait, etc. +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum GenericParam { + Lifetime(LifetimeDef), + Type(TyParam), +} + +impl GenericParam { + pub fn is_lifetime_param(&self) -> bool { + match *self { + GenericParam::Lifetime(_) => true, + _ => false, + } + } + + pub fn is_type_param(&self) -> bool { + match *self { + GenericParam::Type(_) => true, + _ => false, + } + } +} + +/// Represents lifetime, type and const parameters attached to a declaration of +/// a function, enum, trait, etc. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Generics { - pub lifetimes: Vec, - pub ty_params: Vec, + pub params: Vec, pub where_clause: WhereClause, pub span: Span, } impl Generics { pub fn is_lt_parameterized(&self) -> bool { - !self.lifetimes.is_empty() + self.params.iter().any(|param| param.is_lifetime_param()) } + pub fn is_type_parameterized(&self) -> bool { - !self.ty_params.is_empty() + self.params.iter().any(|param| param.is_type_param()) } + pub fn is_parameterized(&self) -> bool { - self.is_lt_parameterized() || self.is_type_parameterized() + !self.params.is_empty() } + pub fn span_for_name(&self, name: &str) -> Option { - for t in &self.ty_params { - if t.ident.name == name { - return Some(t.span); + for param in &self.params { + if let GenericParam::Type(ref t) = *param { + if t.ident.name == name { + return Some(t.span); + } } } None @@ -331,8 +361,7 @@ impl Default for Generics { /// Creates an instance of `Generics`. fn default() -> Generics { Generics { - lifetimes: Vec::new(), - ty_params: Vec::new(), + params: Vec::new(), where_clause: WhereClause { id: DUMMY_NODE_ID, predicates: Vec::new(), @@ -368,8 +397,8 @@ pub enum WherePredicate { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereBoundPredicate { pub span: Span, - /// Any lifetimes from a `for` binding - pub bound_lifetimes: Vec, + /// Any generics from a `for` binding + pub bound_generic_params: Vec, /// The type being bounded pub bounded_ty: P, /// Trait and lifetime bounds (`Clone+Send+'static`) @@ -464,6 +493,7 @@ pub struct Block { /// Distinguishes between `unsafe { ... }` and `{ ... }` pub rules: BlockCheckMode, pub span: Span, + pub recovered: bool, } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] @@ -480,6 +510,30 @@ impl fmt::Debug for Pat { } impl Pat { + pub(super) fn to_ty(&self) -> Option> { + let node = match &self.node { + PatKind::Wild => TyKind::Infer, + PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None) => + TyKind::Path(None, Path::from_ident(ident.span, ident.node)), + PatKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()), + PatKind::Mac(mac) => TyKind::Mac(mac.clone()), + PatKind::Ref(pat, mutbl) => + pat.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?, + PatKind::Slice(pats, None, _) if pats.len() == 1 => + pats[0].to_ty().map(TyKind::Slice)?, + PatKind::Tuple(pats, None) => { + let mut tys = Vec::new(); + for pat in pats { + tys.push(pat.to_ty()?); + } + TyKind::Tup(tys) + } + _ => return None, + }; + + Some(P(Ty { node, id: self.id, span: self.span })) + } + pub fn walk(&self, it: &mut F) -> bool where F: FnMut(&Pat) -> bool { @@ -873,6 +927,45 @@ impl Expr { true } } + + fn to_bound(&self) -> Option { + match &self.node { + ExprKind::Path(None, path) => + Some(TraitTyParamBound(PolyTraitRef::new(Vec::new(), path.clone(), self.span), + TraitBoundModifier::None)), + _ => None, + } + } + + pub(super) fn to_ty(&self) -> Option> { + let node = match &self.node { + ExprKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()), + ExprKind::Mac(mac) => TyKind::Mac(mac.clone()), + ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?, + ExprKind::AddrOf(mutbl, expr) => + expr.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?, + ExprKind::Repeat(expr, expr_len) => + expr.to_ty().map(|ty| TyKind::Array(ty, expr_len.clone()))?, + ExprKind::Array(exprs) if exprs.len() == 1 => + exprs[0].to_ty().map(TyKind::Slice)?, + ExprKind::Tup(exprs) => { + let mut tys = Vec::new(); + for expr in exprs { + tys.push(expr.to_ty()?); + } + TyKind::Tup(tys) + } + ExprKind::Binary(binop, lhs, rhs) if binop.node == BinOpKind::Add => + if let (Some(lhs), Some(rhs)) = (lhs.to_bound(), rhs.to_bound()) { + TyKind::TraitObject(vec![lhs, rhs], TraitObjectSyntax::None) + } else { + return None; + } + _ => return None, + }; + + Some(P(Ty { node, id: self.id, span: self.span })) + } } impl fmt::Debug for Expr { @@ -1394,7 +1487,7 @@ impl fmt::Debug for Ty { pub struct BareFnTy { pub unsafety: Unsafety, pub abi: Abi, - pub lifetimes: Vec, + pub generic_params: Vec, pub decl: P } @@ -1450,7 +1543,7 @@ pub enum TraitObjectSyntax { /// Inline assembly dialect. /// -/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`` +/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")` #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum AsmDialect { Att, @@ -1459,7 +1552,7 @@ pub enum AsmDialect { /// Inline assembly. /// -/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`` +/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")` #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct InlineAsmOutput { pub constraint: Symbol, @@ -1700,46 +1793,20 @@ pub struct Variant_ { pub type Variant = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] -pub struct PathListItem_ { - pub name: Ident, - /// renamed in list, e.g. `use foo::{bar as baz};` - pub rename: Option, - pub id: NodeId, +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum UseTreeKind { + Simple(Ident), + Glob, + Nested(Vec<(UseTree, NodeId)>), } -pub type PathListItem = Spanned; - -pub type ViewPath = Spanned; - #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] -pub enum ViewPath_ { - - /// `foo::bar::baz as quux` - /// - /// or just - /// - /// `foo::bar::baz` (with `as baz` implicitly on the right) - ViewPathSimple(Ident, Path), - - /// `foo::bar::*` - ViewPathGlob(Path), - - /// `foo::bar::{a,b,c}` - ViewPathList(Path, Vec) +pub struct UseTree { + pub kind: UseTreeKind, + pub prefix: Path, + pub span: Span, } -impl ViewPath_ { - pub fn path(&self) -> &Path { - match *self { - ViewPathSimple(_, ref path) | - ViewPathGlob (ref path) | - ViewPathList(ref path, _) => path - } - } -} - - /// Distinguishes between Attributes that decorate items and Attributes that /// are contained as statements within items. These two cases need to be /// distinguished for pretty-printing. @@ -1779,7 +1846,7 @@ pub struct TraitRef { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct PolyTraitRef { /// The `'a` in `<'a> Foo<&'a T>` - pub bound_lifetimes: Vec, + pub bound_generic_params: Vec, /// The `Foo<&'a T>` in `<'a> Foo<&'a T>` pub trait_ref: TraitRef, @@ -1788,9 +1855,9 @@ pub struct PolyTraitRef { } impl PolyTraitRef { - pub fn new(lifetimes: Vec, path: Path, span: Span) -> Self { + pub fn new(generic_params: Vec, path: Path, span: Span) -> Self { PolyTraitRef { - bound_lifetimes: lifetimes, + bound_generic_params: generic_params, trait_ref: TraitRef { path: path, ref_id: DUMMY_NODE_ID }, span, } @@ -1908,7 +1975,7 @@ pub enum ItemKind { /// A use declaration (`use` or `pub use`) item. /// /// E.g. `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;` - Use(P), + Use(P), /// A static item (`static` or `pub static`). /// /// E.g. `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";` @@ -1951,6 +2018,10 @@ pub enum ItemKind { /// /// E.g. `trait Foo { .. }`, `trait Foo { .. }` or `auto trait Foo {}` Trait(IsAuto, Unsafety, Generics, TyParamBounds, Vec), + /// Trait alias + /// + /// E.g. `trait Foo = Bar + Quux;` + TraitAlias(Generics, TyParamBounds), /// Auto trait implementation. /// /// E.g. `impl Trait for .. {}` or `impl Trait for .. {}` @@ -1990,6 +2061,7 @@ impl ItemKind { ItemKind::Struct(..) => "struct", ItemKind::Union(..) => "union", ItemKind::Trait(..) => "trait", + ItemKind::TraitAlias(..) => "trait alias", ItemKind::Mac(..) | ItemKind::MacroDef(..) | ItemKind::Impl(..) | diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index b1f796084d..cc72ff7d15 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -31,7 +31,7 @@ use symbol::Symbol; use tokenstream::{TokenStream, TokenTree, Delimited}; use util::ThinVec; -use std::cell::{RefCell, Cell}; +use std::cell::RefCell; use std::iter; thread_local! { @@ -371,11 +371,13 @@ impl Attribute { let meta = mk_name_value_item_str( Symbol::intern("doc"), Symbol::intern(&strip_doc_comment_decoration(&comment.as_str()))); - if self.style == ast::AttrStyle::Outer { - f(&mk_attr_outer(self.span, self.id, meta)) + let mut attr = if self.style == ast::AttrStyle::Outer { + mk_attr_outer(self.span, self.id, meta) } else { - f(&mk_attr_inner(self.span, self.id, meta)) - } + mk_attr_inner(self.span, self.id, meta) + }; + attr.is_sugared_doc = true; + f(&attr) } else { f(self) } @@ -417,16 +419,14 @@ pub fn mk_spanned_word_item(sp: Span, name: Name) -> MetaItem { MetaItem { span: sp, name: name, node: MetaItemKind::Word } } - - -thread_local! { static NEXT_ATTR_ID: Cell = Cell::new(0) } - pub fn mk_attr_id() -> AttrId { - let id = NEXT_ATTR_ID.with(|slot| { - let r = slot.get(); - slot.set(r + 1); - r - }); + use std::sync::atomic::AtomicUsize; + use std::sync::atomic::Ordering; + + static NEXT_ATTR_ID: AtomicUsize = AtomicUsize::new(0); + + let id = NEXT_ATTR_ID.fetch_add(1, Ordering::SeqCst); + assert!(id != ::std::usize::MAX); AttrId(id) } @@ -1121,10 +1121,7 @@ impl MetaItem { _ => return None, }; let list_closing_paren_pos = tokens.peek().map(|tt| tt.span().hi()); - let node = match MetaItemKind::from_tokens(tokens) { - Some(node) => node, - _ => return None, - }; + let node = MetaItemKind::from_tokens(tokens)?; let hi = match node { MetaItemKind::NameValue(ref lit) => lit.span.hi(), MetaItemKind::List(..) => list_closing_paren_pos.unwrap_or(span.hi()), @@ -1180,10 +1177,8 @@ impl MetaItemKind { let mut tokens = delimited.into_trees().peekable(); let mut result = Vec::new(); while let Some(..) = tokens.peek() { - match NestedMetaItemKind::from_tokens(&mut tokens) { - Some(item) => result.push(respan(item.span(), item)), - None => return None, - } + let item = NestedMetaItemKind::from_tokens(&mut tokens)?; + result.push(respan(item.span(), item)); match tokens.next() { None | Some(TokenTree::Token(_, Token::Comma)) => {} _ => return None, diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 3464db2a81..129defd209 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -105,7 +105,7 @@ impl FileLoader for RealFileLoader { // This is a FileMap identifier that is used to correlate FileMaps between // subsequent compilation sessions (which is something we need to do during // incremental compilation). -#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)] pub struct StableFilemapId(u128); impl StableFilemapId { @@ -164,7 +164,7 @@ impl CodeMap { pub fn load_file(&self, path: &Path) -> io::Result> { let src = self.file_loader.read_file(path)?; - Ok(self.new_filemap(path.to_str().unwrap().to_string(), src)) + Ok(self.new_filemap(path.to_owned().into(), src)) } pub fn files(&self) -> Ref>> { @@ -196,9 +196,15 @@ impl CodeMap { // Note that filename may not be a valid path, eg it may be `` etc, // but this is okay because the directory determined by `path.pop()` will // be empty, so the working directory will be used. - let unmapped_path = PathBuf::from(filename.clone()); + let unmapped_path = filename.clone(); - let (filename, was_remapped) = self.path_mapping.map_prefix(filename); + let (filename, was_remapped) = match filename { + FileName::Real(filename) => { + let (filename, was_remapped) = self.path_mapping.map_prefix(filename); + (FileName::Real(filename), was_remapped) + }, + other => (other, false), + }; let filemap = Rc::new(FileMap::new( filename, was_remapped, @@ -217,8 +223,8 @@ impl CodeMap { } /// Creates a new filemap and sets its line information. - pub fn new_filemap_and_lines(&self, filename: &str, src: &str) -> Rc { - let fm = self.new_filemap(filename.to_string(), src.to_owned()); + pub fn new_filemap_and_lines(&self, filename: &Path, src: &str) -> Rc { + let fm = self.new_filemap(filename.to_owned().into(), src.to_owned()); let mut byte_pos: u32 = fm.start_pos.0; for line in src.lines() { // register the start of this line @@ -240,6 +246,7 @@ impl CodeMap { name_was_remapped: bool, crate_of_origin: u32, src_hash: u128, + name_hash: u128, source_len: usize, mut file_local_lines: Vec, mut file_local_multibyte_chars: Vec, @@ -276,6 +283,7 @@ impl CodeMap { lines: RefCell::new(file_local_lines), multibyte_chars: RefCell::new(file_local_multibyte_chars), non_narrow_chars: RefCell::new(file_local_non_narrow_chars), + name_hash, }); files.push(filemap.clone()); @@ -358,7 +366,7 @@ impl CodeMap { } // If the relevant filemap is empty, we don't return a line number. - fn lookup_line(&self, pos: BytePos) -> Result> { + pub fn lookup_line(&self, pos: BytePos) -> Result> { let idx = self.lookup_filemap_idx(pos); let files = self.files.borrow(); @@ -373,7 +381,7 @@ impl CodeMap { pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt { let loc = self.lookup_char_pos(pos); LocWithOpt { - filename: loc.file.name.to_string(), + filename: loc.file.name.clone(), line: loc.line, col: loc.col, file: Some(loc.file) @@ -383,6 +391,7 @@ impl CodeMap { /// Returns `Some(span)`, a union of the lhs and rhs span. The lhs must precede the rhs. If /// there are gaps between lhs and rhs, the resulting union will cross these gaps. /// For this to work, the spans have to be: + /// /// * the ctxt of both spans much match /// * the lhs span needs to end on the same line the rhs span begins /// * the lhs span must start at or before the rhs span @@ -433,11 +442,17 @@ impl CodeMap { self.lookup_char_pos(sp.lo()).file.name.clone() } - pub fn span_to_unmapped_path(&self, sp: Span) -> PathBuf { + pub fn span_to_unmapped_path(&self, sp: Span) -> FileName { self.lookup_char_pos(sp.lo()).file.unmapped_path.clone() .expect("CodeMap::span_to_unmapped_path called for imported FileMap?") } + pub fn is_multiline(&self, sp: Span) -> bool { + let lo = self.lookup_char_pos(sp.lo()); + let hi = self.lookup_char_pos(sp.hi()); + lo.line != hi.line + } + pub fn span_to_lines(&self, sp: Span) -> FileLinesResult { debug!("span_to_lines(sp={:?})", sp); @@ -561,9 +576,9 @@ impl CodeMap { self.span_until_char(sp, '{') } - pub fn get_filemap(&self, filename: &str) -> Option> { + pub fn get_filemap(&self, filename: &FileName) -> Option> { for fm in self.files.borrow().iter() { - if filename == fm.name { + if *filename == fm.name { return Some(fm.clone()); } } @@ -650,7 +665,7 @@ impl CodeMapper for CodeMap { self.merge_spans(sp_lhs, sp_rhs) } fn call_span_if_macro(&self, sp: Span) -> Span { - if self.span_to_filename(sp.clone()).contains("macros>") { + if self.span_to_filename(sp.clone()).is_macros() { let v = sp.macro_backtrace(); if let Some(use_site) = v.last() { return use_site.call_site; @@ -660,14 +675,17 @@ impl CodeMapper for CodeMap { } fn ensure_filemap_source_present(&self, file_map: Rc) -> bool { file_map.add_external_src( - || self.file_loader.read_file(Path::new(&file_map.name)).ok() + || match file_map.name { + FileName::Real(ref name) => self.file_loader.read_file(name).ok(), + _ => None, + } ) } } #[derive(Clone)] pub struct FilePathMapping { - mapping: Vec<(String, String)>, + mapping: Vec<(PathBuf, PathBuf)>, } impl FilePathMapping { @@ -677,7 +695,7 @@ impl FilePathMapping { } } - pub fn new(mapping: Vec<(String, String)>) -> FilePathMapping { + pub fn new(mapping: Vec<(PathBuf, PathBuf)>) -> FilePathMapping { FilePathMapping { mapping, } @@ -686,14 +704,13 @@ impl FilePathMapping { /// Applies any path prefix substitution as defined by the mapping. /// The return value is the remapped path and a boolean indicating whether /// the path was affected by the mapping. - pub fn map_prefix(&self, path: String) -> (String, bool) { + pub fn map_prefix(&self, path: PathBuf) -> (PathBuf, bool) { // NOTE: We are iterating over the mapping entries from last to first // because entries specified later on the command line should // take precedence. for &(ref from, ref to) in self.mapping.iter().rev() { - if path.starts_with(from) { - let mapped = path.replacen(from, to, 1); - return (mapped, true); + if let Ok(rest) = path.strip_prefix(from) { + return (to.join(rest), true); } } @@ -714,7 +731,7 @@ mod tests { #[test] fn t1 () { let cm = CodeMap::new(FilePathMapping::empty()); - let fm = cm.new_filemap("blork.rs".to_string(), + let fm = cm.new_filemap(PathBuf::from("blork.rs").into(), "first line.\nsecond line".to_string()); fm.next_line(BytePos(0)); // Test we can get lines with partial line info. @@ -730,7 +747,7 @@ mod tests { #[should_panic] fn t2 () { let cm = CodeMap::new(FilePathMapping::empty()); - let fm = cm.new_filemap("blork.rs".to_string(), + let fm = cm.new_filemap(PathBuf::from("blork.rs").into(), "first line.\nsecond line".to_string()); // TESTING *REALLY* BROKEN BEHAVIOR: fm.next_line(BytePos(0)); @@ -740,11 +757,11 @@ mod tests { fn init_code_map() -> CodeMap { let cm = CodeMap::new(FilePathMapping::empty()); - let fm1 = cm.new_filemap("blork.rs".to_string(), + let fm1 = cm.new_filemap(PathBuf::from("blork.rs").into(), "first line.\nsecond line".to_string()); - let fm2 = cm.new_filemap("empty.rs".to_string(), + let fm2 = cm.new_filemap(PathBuf::from("empty.rs").into(), "".to_string()); - let fm3 = cm.new_filemap("blork2.rs".to_string(), + let fm3 = cm.new_filemap(PathBuf::from("blork2.rs").into(), "first line.\nsecond line".to_string()); fm1.next_line(BytePos(0)); @@ -762,15 +779,15 @@ mod tests { let cm = init_code_map(); let fmabp1 = cm.lookup_byte_offset(BytePos(23)); - assert_eq!(fmabp1.fm.name, "blork.rs"); + assert_eq!(fmabp1.fm.name, PathBuf::from("blork.rs").into()); assert_eq!(fmabp1.pos, BytePos(23)); let fmabp1 = cm.lookup_byte_offset(BytePos(24)); - assert_eq!(fmabp1.fm.name, "empty.rs"); + assert_eq!(fmabp1.fm.name, PathBuf::from("empty.rs").into()); assert_eq!(fmabp1.pos, BytePos(0)); let fmabp2 = cm.lookup_byte_offset(BytePos(25)); - assert_eq!(fmabp2.fm.name, "blork2.rs"); + assert_eq!(fmabp2.fm.name, PathBuf::from("blork2.rs").into()); assert_eq!(fmabp2.pos, BytePos(0)); } @@ -792,12 +809,12 @@ mod tests { let cm = init_code_map(); let loc1 = cm.lookup_char_pos(BytePos(22)); - assert_eq!(loc1.file.name, "blork.rs"); + assert_eq!(loc1.file.name, PathBuf::from("blork.rs").into()); assert_eq!(loc1.line, 2); assert_eq!(loc1.col, CharPos(10)); let loc2 = cm.lookup_char_pos(BytePos(25)); - assert_eq!(loc2.file.name, "blork2.rs"); + assert_eq!(loc2.file.name, PathBuf::from("blork2.rs").into()); assert_eq!(loc2.line, 1); assert_eq!(loc2.col, CharPos(0)); } @@ -806,9 +823,9 @@ mod tests { let cm = CodeMap::new(FilePathMapping::empty()); // € is a three byte utf8 char. let fm1 = - cm.new_filemap("blork.rs".to_string(), + cm.new_filemap(PathBuf::from("blork.rs").into(), "fir€st €€€€ line.\nsecond line".to_string()); - let fm2 = cm.new_filemap("blork2.rs".to_string(), + let fm2 = cm.new_filemap(PathBuf::from("blork2.rs").into(), "first line€€.\n€ second line".to_string()); fm1.next_line(BytePos(0)); @@ -853,7 +870,7 @@ mod tests { let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION); let file_lines = cm.span_to_lines(span).unwrap(); - assert_eq!(file_lines.file.name, "blork.rs"); + assert_eq!(file_lines.file.name, PathBuf::from("blork.rs").into()); assert_eq!(file_lines.lines.len(), 1); assert_eq!(file_lines.lines[0].line_index, 1); } @@ -876,7 +893,7 @@ mod tests { let cm = CodeMap::new(FilePathMapping::empty()); let inputtext = "aaaaa\nbbbbBB\nCCC\nDDDDDddddd\neee\n"; let selection = " \n ~~\n~~~\n~~~~~ \n \n"; - cm.new_filemap_and_lines("blork.rs", inputtext); + cm.new_filemap_and_lines(Path::new("blork.rs"), inputtext); let span = span_from_selection(inputtext, selection); // check that we are extracting the text we thought we were extracting @@ -919,7 +936,7 @@ mod tests { let inputtext = "bbbb BB\ncc CCC\n"; let selection1 = " ~~\n \n"; let selection2 = " \n ~~~\n"; - cm.new_filemap_and_lines("blork.rs", inputtext); + cm.new_filemap_and_lines(Path::new("blork.rs"), inputtext); let span1 = span_from_selection(inputtext, selection1); let span2 = span_from_selection(inputtext, selection2); diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 0909eec626..fc82357455 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -284,13 +284,13 @@ impl<'a> fold::Folder for StripUnconfigured<'a> { } fn fold_expr(&mut self, expr: P) -> P { - let mut expr = self.configure_expr(expr).unwrap(); + let mut expr = self.configure_expr(expr).into_inner(); expr.node = self.configure_expr_kind(expr.node); P(fold::noop_fold_expr(expr, self)) } fn fold_opt_expr(&mut self, expr: P) -> Option> { - let mut expr = configure!(self, expr).unwrap(); + let mut expr = configure!(self, expr).into_inner(); expr.node = self.configure_expr_kind(expr.node); Some(P(fold::noop_fold_expr(expr, self))) } diff --git a/src/libsyntax/diagnostics/metadata.rs b/src/libsyntax/diagnostics/metadata.rs index daa7112235..dc01a79190 100644 --- a/src/libsyntax/diagnostics/metadata.rs +++ b/src/libsyntax/diagnostics/metadata.rs @@ -14,19 +14,17 @@ //! currently always a crate name. use std::collections::BTreeMap; -use std::path::PathBuf; +use std::env; use std::fs::{remove_file, create_dir_all, File}; use std::io::Write; +use std::path::PathBuf; use std::error::Error; use rustc_serialize::json::as_json; -use syntax_pos::Span; +use syntax_pos::{Span, FileName}; use ext::base::ExtCtxt; use diagnostics::plugin::{ErrorMap, ErrorInfo}; -// Default metadata directory to use for extended error JSON. -const ERROR_METADATA_PREFIX: &'static str = "tmp/extended-errors"; - /// JSON encodable/decodable version of `ErrorInfo`. #[derive(PartialEq, RustcDecodable, RustcEncodable)] pub struct ErrorMetadata { @@ -40,7 +38,7 @@ pub type ErrorMetadataMap = BTreeMap; /// JSON encodable error location type with filename and line number. #[derive(PartialEq, RustcDecodable, RustcEncodable)] pub struct ErrorLocation { - pub filename: String, + pub filename: FileName, pub line: usize } @@ -59,7 +57,10 @@ impl ErrorLocation { /// /// See `output_metadata`. pub fn get_metadata_dir(prefix: &str) -> PathBuf { - PathBuf::from(ERROR_METADATA_PREFIX).join(prefix) + env::var_os("RUSTC_ERROR_METADATA_DST") + .map(PathBuf::from) + .expect("env var `RUSTC_ERROR_METADATA_DST` isn't set") + .join(prefix) } /// Map `name` to a path in the given directory: /.json diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 0e05cce35e..0d3be28ffe 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -21,10 +21,11 @@ use fold::{self, Folder}; use parse::{self, parser, DirectoryOwnership}; use parse::token; use ptr::P; -use symbol::Symbol; +use symbol::{keywords, Ident, Symbol}; use util::small_vector::SmallVector; use std::collections::HashMap; +use std::iter; use std::path::PathBuf; use std::rc::Rc; use std::default::Default; @@ -84,17 +85,29 @@ impl Annotatable { pub fn expect_trait_item(self) -> ast::TraitItem { match self { - Annotatable::TraitItem(i) => i.unwrap(), + Annotatable::TraitItem(i) => i.into_inner(), _ => panic!("expected Item") } } pub fn expect_impl_item(self) -> ast::ImplItem { match self { - Annotatable::ImplItem(i) => i.unwrap(), + Annotatable::ImplItem(i) => i.into_inner(), _ => panic!("expected Item") } } + + pub fn derive_allowed(&self) -> bool { + match *self { + Annotatable::Item(ref item) => match item.node { + ast::ItemKind::Struct(..) | + ast::ItemKind::Enum(..) | + ast::ItemKind::Union(..) => true, + _ => false, + }, + _ => false, + } + } } // A more flexible ItemDecorator. @@ -664,7 +677,7 @@ pub struct ExpansionData { pub struct ExtCtxt<'a> { pub parse_sess: &'a parse::ParseSess, pub ecfg: expand::ExpansionConfig<'a>, - pub crate_root: Option<&'static str>, + pub root_path: PathBuf, pub resolver: &'a mut Resolver, pub resolve_err_count: usize, pub current_expansion: ExpansionData, @@ -679,14 +692,14 @@ impl<'a> ExtCtxt<'a> { ExtCtxt { parse_sess, ecfg, - crate_root: None, + root_path: PathBuf::new(), resolver, resolve_err_count: 0, current_expansion: ExpansionData { mark: Mark::root(), depth: 0, module: Rc::new(ModuleData { mod_path: Vec::new(), directory: PathBuf::new() }), - directory_ownership: DirectoryOwnership::Owned, + directory_ownership: DirectoryOwnership::Owned { relative: None }, }, expansions: HashMap::new(), } @@ -763,7 +776,8 @@ impl<'a> ExtCtxt<'a> { /// Emit `msg` attached to `sp`, and stop compilation immediately. /// /// `span_err` should be strongly preferred where-ever possible: - /// this should *only* be used when + /// this should *only* be used when: + /// /// - continuing has a high risk of flow-on errors (e.g. errors in /// declaring a macro would cause all uses of that macro to /// complain about "undefined macro"), or @@ -820,12 +834,10 @@ impl<'a> ExtCtxt<'a> { ast::Ident::from_str(st) } pub fn std_path(&self, components: &[&str]) -> Vec { - let mut v = Vec::new(); - if let Some(s) = self.crate_root { - v.push(self.ident_of(s)); - } - v.extend(components.iter().map(|s| self.ident_of(s))); - v + let def_site = SyntaxContext::empty().apply_mark(self.current_expansion.mark); + iter::once(Ident { ctxt: def_site, ..keywords::DollarCrate.ident() }) + .chain(components.iter().map(|s| self.ident_of(s))) + .collect() } pub fn name_of(&self, st: &str) -> ast::Name { Symbol::intern(st) diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 48d789372a..34e5610901 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -291,7 +291,7 @@ pub trait AstBuilder { -> ast::MetaItem; fn item_use(&self, sp: Span, - vis: ast::Visibility, vp: P) -> P; + vis: ast::Visibility, vp: P) -> P; fn item_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> P; fn item_use_simple_(&self, sp: Span, vis: ast::Visibility, ident: ast::Ident, path: ast::Path) -> P; @@ -319,9 +319,12 @@ impl<'a> AstBuilder for ExtCtxt<'a> { types: Vec>, bindings: Vec ) -> ast::Path { + use syntax::parse::token; + let last_identifier = idents.pop().unwrap(); let mut segments: Vec = Vec::new(); - if global { + if global && + !idents.first().map_or(false, |&ident| token::Ident(ident).is_path_segment_keyword()) { segments.push(ast::PathSegment::crate_root(span)); } @@ -459,7 +462,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef { ast::PolyTraitRef { - bound_lifetimes: Vec::new(), + bound_generic_params: Vec::new(), trait_ref: self.trait_ref(path), span, } @@ -591,6 +594,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { id: ast::DUMMY_NODE_ID, rules: BlockCheckMode::Default, span, + recovered: false, }) } @@ -756,7 +760,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn expr_fail(&self, span: Span, msg: Symbol) -> P { let loc = self.codemap().lookup_char_pos(span.lo()); - let expr_file = self.expr_str(span, Symbol::intern(&loc.file.name)); + let expr_file = self.expr_str(span, Symbol::intern(&loc.file.name.to_string())); let expr_line = self.expr_u32(span, loc.line as u32); let expr_col = self.expr_u32(span, loc.col.to_usize() as u32 + 1); let expr_loc_tuple = self.expr_tuple(span, vec![expr_file, expr_line, expr_col]); @@ -1142,7 +1146,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn item_use(&self, sp: Span, - vis: ast::Visibility, vp: P) -> P { + vis: ast::Visibility, vp: P) -> P { P(ast::Item { id: ast::DUMMY_NODE_ID, ident: keywords::Invalid.ident(), @@ -1161,33 +1165,36 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn item_use_simple_(&self, sp: Span, vis: ast::Visibility, ident: ast::Ident, path: ast::Path) -> P { - self.item_use(sp, vis, - P(respan(sp, - ast::ViewPathSimple(ident, - path)))) + self.item_use(sp, vis, P(ast::UseTree { + span: sp, + prefix: path, + kind: ast::UseTreeKind::Simple(ident), + })) } fn item_use_list(&self, sp: Span, vis: ast::Visibility, path: Vec, imports: &[ast::Ident]) -> P { let imports = imports.iter().map(|id| { - let item = ast::PathListItem_ { - name: *id, - rename: None, - id: ast::DUMMY_NODE_ID, - }; - respan(sp, item) + (ast::UseTree { + span: sp, + prefix: self.path(sp, vec![*id]), + kind: ast::UseTreeKind::Simple(*id), + }, ast::DUMMY_NODE_ID) }).collect(); - self.item_use(sp, vis, - P(respan(sp, - ast::ViewPathList(self.path(sp, path), - imports)))) + self.item_use(sp, vis, P(ast::UseTree { + span: sp, + prefix: self.path(sp, path), + kind: ast::UseTreeKind::Nested(imports), + })) } fn item_use_glob(&self, sp: Span, vis: ast::Visibility, path: Vec) -> P { - self.item_use(sp, vis, - P(respan(sp, - ast::ViewPathGlob(self.path(sp, path))))) + self.item_use(sp, vis, P(ast::UseTree { + span: sp, + prefix: self.path(sp, path), + kind: ast::UseTreeKind::Glob, + })) } } diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs index 2e70962cad..c7fa0331c1 100644 --- a/src/libsyntax/ext/derive.rs +++ b/src/libsyntax/ext/derive.rs @@ -74,7 +74,7 @@ pub fn add_derived_markers(cx: &mut ExtCtxt, span: Span, traits: &[ast::Path] let meta = cx.meta_word(span, Symbol::intern("structural_match")); attrs.push(cx.attribute(span, meta)); } - if names.contains(&Symbol::intern("Copy")) && names.contains(&Symbol::intern("Clone")) { + if names.contains(&Symbol::intern("Copy")) { let meta = cx.meta_word(span, Symbol::intern("rustc_copy_clone_marker")); attrs.push(cx.attribute(span, meta)); } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 491dbed01f..11988a8f89 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -11,7 +11,7 @@ use ast::{self, Block, Ident, NodeId, PatKind, Path}; use ast::{MacStmtStyle, StmtKind, ItemKind}; use attr::{self, HasAttrs}; -use codemap::{ExpnInfo, NameAndSpan, MacroBang, MacroAttribute}; +use codemap::{ExpnInfo, NameAndSpan, MacroBang, MacroAttribute, dummy_spanned}; use config::{is_test_or_bench, StripUnconfigured}; use errors::FatalError; use ext::base::*; @@ -25,18 +25,20 @@ use parse::{DirectoryOwnership, PResult}; use parse::token::{self, Token}; use parse::parser::Parser; use ptr::P; -use std_inject; use symbol::Symbol; use symbol::keywords; -use syntax_pos::{Span, DUMMY_SP}; +use syntax_pos::{Span, DUMMY_SP, FileName}; use syntax_pos::hygiene::ExpnFormat; use tokenstream::{TokenStream, TokenTree}; use util::small_vector::SmallVector; use visit::Visitor; use std::collections::HashMap; +use std::fs::File; +use std::io::Read; use std::mem; use std::rc::Rc; +use std::path::PathBuf; macro_rules! expansions { ($($kind:ident: $ty:ty [$($vec:ident, $ty_elt:ty)*], $kind_name:expr, .$make:ident, @@ -134,8 +136,8 @@ expansions! { } impl ExpansionKind { - fn dummy(self, span: Span) -> Expansion { - self.make_from(DummyResult::any(span)).unwrap() + fn dummy(self, span: Span) -> Option { + self.make_from(DummyResult::any(span)) } fn expect_from_annotatables>(self, items: I) -> Expansion { @@ -217,12 +219,15 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } pub fn expand_crate(&mut self, mut krate: ast::Crate) -> ast::Crate { - self.cx.crate_root = std_inject::injected_crate_name(&krate); let mut module = ModuleData { mod_path: vec![Ident::from_str(&self.cx.ecfg.crate_name)], - directory: self.cx.codemap().span_to_unmapped_path(krate.span), + directory: match self.cx.codemap().span_to_unmapped_path(krate.span) { + FileName::Real(path) => path, + other => PathBuf::from(other.to_string()), + }, }; module.directory.pop(); + self.cx.root_path = module.directory.clone(); self.cx.current_expansion.module = Rc::new(module); let orig_mod_span = krate.module.inner; @@ -237,7 +242,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { tokens: None, }))); - match self.expand(krate_item).make_items().pop().map(P::unwrap) { + match self.expand(krate_item).make_items().pop().map(P::into_inner) { Some(ast::Item { attrs, node: ast::ItemKind::Mod(module), .. }) => { krate.attrs = attrs; krate.module = module; @@ -299,21 +304,12 @@ impl<'a, 'b> MacroExpander<'a, 'b> { // FIXME(jseyfried): Refactor out the following logic let (expansion, new_invocations) = if let Some(ext) = ext { if let Some(ext) = ext { - let expansion = self.expand_invoc(invoc, ext); + let dummy = invoc.expansion_kind.dummy(invoc.span()).unwrap(); + let expansion = self.expand_invoc(invoc, ext).unwrap_or(dummy); self.collect_invocations(expansion, &[]) } else if let InvocationKind::Attr { attr: None, traits, item } = invoc.kind { - let derive_allowed = match item { - Annotatable::Item(ref item) => match item.node { - ast::ItemKind::Struct(..) | - ast::ItemKind::Enum(..) | - ast::ItemKind::Union(..) => true, - _ => false, - }, - _ => false, - }; - if !derive_allowed { - let attr = item.attrs().iter() - .find(|attr| attr.check_name("derive")) + if !item.derive_allowed() { + let attr = attr::find_by_name(item.attrs(), "derive") .expect("`derive` attribute should exist"); let span = attr.span; let mut err = self.cx.mut_span_err(span, @@ -361,7 +357,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { unreachable!() } } else { - self.collect_invocations(invoc.expansion_kind.dummy(invoc.span()), &[]) + self.collect_invocations(invoc.expansion_kind.dummy(invoc.span()).unwrap(), &[]) }; if expansions.len() < depth { @@ -441,11 +437,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } } - fn expand_invoc(&mut self, invoc: Invocation, ext: Rc) -> Expansion { + fn expand_invoc(&mut self, invoc: Invocation, ext: Rc) -> Option { let result = match invoc.kind { - InvocationKind::Bang { .. } => self.expand_bang_invoc(invoc, ext), - InvocationKind::Attr { .. } => self.expand_attr_invoc(invoc, ext), - InvocationKind::Derive { .. } => self.expand_derive_invoc(invoc, ext), + InvocationKind::Bang { .. } => self.expand_bang_invoc(invoc, ext)?, + InvocationKind::Attr { .. } => self.expand_attr_invoc(invoc, ext)?, + InvocationKind::Derive { .. } => self.expand_derive_invoc(invoc, ext)?, }; if self.cx.current_expansion.depth > self.cx.ecfg.recursion_limit { @@ -462,13 +458,16 @@ impl<'a, 'b> MacroExpander<'a, 'b> { panic!(FatalError); } - result + Some(result) } - fn expand_attr_invoc(&mut self, invoc: Invocation, ext: Rc) -> Expansion { + fn expand_attr_invoc(&mut self, + invoc: Invocation, + ext: Rc) + -> Option { let Invocation { expansion_kind: kind, .. } = invoc; let (attr, item) = match invoc.kind { - InvocationKind::Attr { attr, item, .. } => (attr.unwrap(), item), + InvocationKind::Attr { attr, item, .. } => (attr?, item), _ => unreachable!(), }; @@ -485,22 +484,22 @@ impl<'a, 'b> MacroExpander<'a, 'b> { match *ext { MultiModifier(ref mac) => { - let meta = panictry!(attr.parse_meta(self.cx.parse_sess)); + let meta = attr.parse_meta(self.cx.parse_sess).ok()?; let item = mac.expand(self.cx, attr.span, &meta, item); - kind.expect_from_annotatables(item) + Some(kind.expect_from_annotatables(item)) } MultiDecorator(ref mac) => { let mut items = Vec::new(); - let meta = panictry!(attr.parse_meta(self.cx.parse_sess)); + let meta = attr.parse_meta(self.cx.parse_sess).ok()?; mac.expand(self.cx, attr.span, &meta, &item, &mut |item| items.push(item)); items.push(item); - kind.expect_from_annotatables(items) + Some(kind.expect_from_annotatables(items)) } AttrProcMacro(ref mac) => { let item_tok = TokenTree::Token(DUMMY_SP, Token::interpolated(match item { Annotatable::Item(item) => token::NtItem(item), - Annotatable::TraitItem(item) => token::NtTraitItem(item.unwrap()), - Annotatable::ImplItem(item) => token::NtImplItem(item.unwrap()), + Annotatable::TraitItem(item) => token::NtTraitItem(item.into_inner()), + Annotatable::ImplItem(item) => token::NtImplItem(item.into_inner()), })).into(); let tok_result = mac.expand(self.cx, attr.span, attr.tokens, item_tok); self.parse_expansion(tok_result, kind, &attr.path, attr.span) @@ -520,7 +519,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } /// Expand a macro invocation. Returns the result of expansion. - fn expand_bang_invoc(&mut self, invoc: Invocation, ext: Rc) -> Expansion { + fn expand_bang_invoc(&mut self, + invoc: Invocation, + ext: Rc) + -> Option { let (mark, kind) = (invoc.expansion_data.mark, invoc.expansion_kind); let (mac, ident, span) = match invoc.kind { InvocationKind::Bang { mac, ident, span } => (mac, ident, span), @@ -553,9 +555,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> { false, false) { self.cx.span_err(path.span, &msg); self.cx.trace_macros_diag(); - return kind.dummy(span); + kind.dummy(span) + } else { + kind.make_from(expand.expand(self.cx, span, mac.node.stream())) } - kind.make_from(expand.expand(self.cx, span, mac.node.stream())) } NormalTT { @@ -569,9 +572,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> { allow_internal_unsafe) { self.cx.span_err(path.span, &msg); self.cx.trace_macros_diag(); - return kind.dummy(span); + kind.dummy(span) + } else { + kind.make_from(expander.expand(self.cx, span, mac.node.stream())) } - kind.make_from(expander.expand(self.cx, span, mac.node.stream())) } IdentTT(ref expander, tt_span, allow_internal_unstable) => { @@ -579,34 +583,34 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.cx.span_err(path.span, &format!("macro {}! expects an ident argument", path)); self.cx.trace_macros_diag(); - return kind.dummy(span); - }; + kind.dummy(span) + } else { + invoc.expansion_data.mark.set_expn_info(ExpnInfo { + call_site: span, + callee: NameAndSpan { + format: macro_bang_format(path), + span: tt_span, + allow_internal_unstable, + allow_internal_unsafe: false, + } + }); - invoc.expansion_data.mark.set_expn_info(ExpnInfo { - call_site: span, - callee: NameAndSpan { - format: macro_bang_format(path), - span: tt_span, - allow_internal_unstable, - allow_internal_unsafe: false, - } - }); - - let input: Vec<_> = mac.node.stream().into_trees().collect(); - kind.make_from(expander.expand(self.cx, span, ident, input)) + let input: Vec<_> = mac.node.stream().into_trees().collect(); + kind.make_from(expander.expand(self.cx, span, ident, input)) + } } MultiDecorator(..) | MultiModifier(..) | AttrProcMacro(..) => { self.cx.span_err(path.span, &format!("`{}` can only be used in attributes", path)); self.cx.trace_macros_diag(); - return kind.dummy(span); + kind.dummy(span) } ProcMacroDerive(..) | BuiltinDerive(..) => { self.cx.span_err(path.span, &format!("`{}` is a derive mode", path)); self.cx.trace_macros_diag(); - return kind.dummy(span); + kind.dummy(span) } ProcMacro(ref expandfun) => { @@ -615,43 +619,51 @@ impl<'a, 'b> MacroExpander<'a, 'b> { format!("macro {}! expects no ident argument, given '{}'", path, ident); self.cx.span_err(path.span, &msg); self.cx.trace_macros_diag(); - return kind.dummy(span); + kind.dummy(span) + } else { + invoc.expansion_data.mark.set_expn_info(ExpnInfo { + call_site: span, + callee: NameAndSpan { + format: macro_bang_format(path), + // FIXME procedural macros do not have proper span info + // yet, when they do, we should use it here. + span: None, + // FIXME probably want to follow macro_rules macros here. + allow_internal_unstable: false, + allow_internal_unsafe: false, + }, + }); + + let tok_result = expandfun.expand(self.cx, span, mac.node.stream()); + self.parse_expansion(tok_result, kind, path, span) } - - invoc.expansion_data.mark.set_expn_info(ExpnInfo { - call_site: span, - callee: NameAndSpan { - format: macro_bang_format(path), - // FIXME procedural macros do not have proper span info - // yet, when they do, we should use it here. - span: None, - // FIXME probably want to follow macro_rules macros here. - allow_internal_unstable: false, - allow_internal_unsafe: false, - }, - }); - - let tok_result = expandfun.expand(self.cx, span, mac.node.stream()); - Some(self.parse_expansion(tok_result, kind, path, span)) } }; - unwrap_or!(opt_expanded, { + if opt_expanded.is_some() { + opt_expanded + } else { let msg = format!("non-{kind} macro in {kind} position: {name}", name = path.segments[0].identifier.name, kind = kind.name()); self.cx.span_err(path.span, &msg); self.cx.trace_macros_diag(); kind.dummy(span) - }) + } } /// Expand a derive invocation. Returns the result of expansion. - fn expand_derive_invoc(&mut self, invoc: Invocation, ext: Rc) -> Expansion { + fn expand_derive_invoc(&mut self, + invoc: Invocation, + ext: Rc) + -> Option { let Invocation { expansion_kind: kind, .. } = invoc; let (path, item) = match invoc.kind { InvocationKind::Derive { path, item } => (path, item), _ => unreachable!(), }; + if !item.derive_allowed() { + return None; + } let pretty_name = Symbol::intern(&format!("derive({})", path)); let span = path.span; @@ -681,15 +693,15 @@ impl<'a, 'b> MacroExpander<'a, 'b> { span: DUMMY_SP, node: ast::MetaItemKind::Word, }; - kind.expect_from_annotatables(ext.expand(self.cx, span, &dummy, item)) + Some(kind.expect_from_annotatables(ext.expand(self.cx, span, &dummy, item))) } BuiltinDerive(func) => { expn_info.callee.allow_internal_unstable = true; invoc.expansion_data.mark.set_expn_info(expn_info); let span = span.with_ctxt(self.cx.backtrace()); let mut items = Vec::new(); - func(self.cx, span, &attr.meta().unwrap(), &item, &mut |a| items.push(a)); - kind.expect_from_annotatables(items) + func(self.cx, span, &attr.meta()?, &item, &mut |a| items.push(a)); + Some(kind.expect_from_annotatables(items)) } _ => { let msg = &format!("macro `{}` may not be used for derive attributes", attr.path); @@ -700,19 +712,24 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } } - fn parse_expansion(&mut self, toks: TokenStream, kind: ExpansionKind, path: &Path, span: Span) - -> Expansion { + fn parse_expansion(&mut self, + toks: TokenStream, + kind: ExpansionKind, + path: &Path, + span: Span) + -> Option { let mut parser = self.cx.new_parser_from_tts(&toks.into_trees().collect::>()); - let expansion = match parser.parse_expansion(kind, false) { - Ok(expansion) => expansion, + match parser.parse_expansion(kind, false) { + Ok(expansion) => { + parser.ensure_complete_parse(path, kind.name(), span); + Some(expansion) + } Err(mut err) => { err.emit(); self.cx.trace_macros_diag(); - return kind.dummy(span); + kind.dummy(span) } - }; - parser.ensure_complete_parse(path, kind.name(), span); - expansion + } } } @@ -843,6 +860,11 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { feature_gate::check_attribute(attr, self.cx.parse_sess, features); } } + + fn check_attribute(&mut self, at: &ast::Attribute) { + let features = self.cx.ecfg.features.unwrap(); + feature_gate::check_attribute(at, self.cx.parse_sess, features); + } } pub fn find_attr_invoc(attrs: &mut Vec) -> Option { @@ -853,7 +875,7 @@ pub fn find_attr_invoc(attrs: &mut Vec) -> Option Folder for InvocationCollector<'a, 'b> { fn fold_expr(&mut self, expr: P) -> P { - let mut expr = self.cfg.configure_expr(expr).unwrap(); + let mut expr = self.cfg.configure_expr(expr).into_inner(); expr.node = self.cfg.configure_expr_kind(expr.node); if let ast::ExprKind::Mac(mac) = expr.node { @@ -865,7 +887,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { } fn fold_opt_expr(&mut self, expr: P) -> Option> { - let mut expr = configure!(self, expr).unwrap(); + let mut expr = configure!(self, expr).into_inner(); expr.node = self.cfg.configure_expr_kind(expr.node); if let ast::ExprKind::Mac(mac) = expr.node { @@ -896,7 +918,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { }; let (mac, style, attrs) = if let StmtKind::Mac(mac) = stmt.node { - mac.unwrap() + mac.into_inner() } else { // The placeholder expander gives ids to statements, so we avoid folding the id here. let ast::Stmt { id, node, span } = stmt; @@ -966,16 +988,24 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { if inline_module { if let Some(path) = attr::first_attr_value_str_by_name(&item.attrs, "path") { - self.cx.current_expansion.directory_ownership = DirectoryOwnership::Owned; + self.cx.current_expansion.directory_ownership = + DirectoryOwnership::Owned { relative: None }; module.directory.push(&*path.as_str()); } else { module.directory.push(&*item.ident.name.as_str()); } } else { - let mut path = self.cx.parse_sess.codemap().span_to_unmapped_path(inner); + let path = self.cx.parse_sess.codemap().span_to_unmapped_path(inner); + let mut path = match path { + FileName::Real(path) => path, + other => PathBuf::from(other.to_string()), + }; let directory_ownership = match path.file_name().unwrap().to_str() { - Some("mod.rs") => DirectoryOwnership::Owned, - _ => DirectoryOwnership::UnownedViaMod(false), + Some("mod.rs") => DirectoryOwnership::Owned { relative: None }, + Some(_) => DirectoryOwnership::Owned { + relative: Some(item.ident), + }, + None => DirectoryOwnership::UnownedViaMod(false), }; path.pop(); module.directory = path; @@ -1042,7 +1072,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { fn fold_ty(&mut self, ty: P) -> P { let ty = match ty.node { - ast::TyKind::Mac(_) => ty.unwrap(), + ast::TyKind::Mac(_) => ty.into_inner(), _ => return fold::noop_fold_ty(ty, self), }; @@ -1063,6 +1093,88 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { } } + fn fold_attribute(&mut self, at: ast::Attribute) -> Option { + // turn `#[doc(include="filename")]` attributes into `#[doc(include(file="filename", + // contents="file contents")]` attributes + if !at.check_name("doc") { + return noop_fold_attribute(at, self); + } + + if let Some(list) = at.meta_item_list() { + if !list.iter().any(|it| it.check_name("include")) { + return noop_fold_attribute(at, self); + } + + let mut items = vec![]; + + for it in list { + if !it.check_name("include") { + items.push(noop_fold_meta_list_item(it, self)); + continue; + } + + if let Some(file) = it.value_str() { + let err_count = self.cx.parse_sess.span_diagnostic.err_count(); + self.check_attribute(&at); + if self.cx.parse_sess.span_diagnostic.err_count() > err_count { + // avoid loading the file if they haven't enabled the feature + return noop_fold_attribute(at, self); + } + + let mut buf = vec![]; + let filename = self.cx.root_path.join(file.to_string()); + + match File::open(&filename).and_then(|mut f| f.read_to_end(&mut buf)) { + Ok(..) => {} + Err(e) => { + self.cx.span_err(at.span, + &format!("couldn't read {}: {}", + filename.display(), + e)); + } + } + + match String::from_utf8(buf) { + Ok(src) => { + // Add this input file to the code map to make it available as + // dependency information + self.cx.codemap().new_filemap_and_lines(&filename, &src); + + let include_info = vec![ + dummy_spanned(ast::NestedMetaItemKind::MetaItem( + attr::mk_name_value_item_str("file".into(), + file))), + dummy_spanned(ast::NestedMetaItemKind::MetaItem( + attr::mk_name_value_item_str("contents".into(), + (&*src).into()))), + ]; + + items.push(dummy_spanned(ast::NestedMetaItemKind::MetaItem( + attr::mk_list_item("include".into(), include_info)))); + } + Err(_) => { + self.cx.span_err(at.span, + &format!("{} wasn't a utf-8 file", + filename.display())); + } + } + } else { + items.push(noop_fold_meta_list_item(it, self)); + } + } + + let meta = attr::mk_list_item("doc".into(), items); + match at.style { + ast::AttrStyle::Inner => + Some(attr::mk_spanned_attr_inner(at.span, at.id, meta)), + ast::AttrStyle::Outer => + Some(attr::mk_spanned_attr_outer(at.span, at.id, meta)), + } + } else { + noop_fold_attribute(at, self) + } + } + fn new_id(&mut self, id: ast::NodeId) -> ast::NodeId { if self.monotonic { assert_eq!(id, ast::DUMMY_NODE_ID); diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index bd8c9a0ed4..59996d1e4a 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -18,7 +18,6 @@ use parse::token; use ptr::P; use tokenstream::{TokenStream, TokenTree}; - /// Quasiquoting works via token trees. /// /// This is registered as a set of expression syntax extension called quote! @@ -38,7 +37,7 @@ pub mod rt { use tokenstream::{self, TokenTree, TokenStream}; pub use parse::new_parser_from_tts; - pub use syntax_pos::{BytePos, Span, DUMMY_SP}; + pub use syntax_pos::{BytePos, Span, DUMMY_SP, FileName}; pub use codemap::{dummy_spanned}; pub trait ToTokens { @@ -191,6 +190,12 @@ pub mod rt { } } + impl ToTokens for ast::Lifetime { + fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { + vec![TokenTree::Token(DUMMY_SP, token::Lifetime(self.ident))] + } + } + macro_rules! impl_to_tokens_slice { ($t: ty, $sep: expr) => { impl ToTokens for [$t] { @@ -343,27 +348,27 @@ pub mod rt { impl<'a> ExtParseUtils for ExtCtxt<'a> { fn parse_item(&self, s: String) -> P { panictry!(parse::parse_item_from_source_str( - "".to_string(), + FileName::QuoteExpansion, s, self.parse_sess())).expect("parse error") } fn parse_stmt(&self, s: String) -> ast::Stmt { panictry!(parse::parse_stmt_from_source_str( - "".to_string(), + FileName::QuoteExpansion, s, self.parse_sess())).expect("parse error") } fn parse_expr(&self, s: String) -> P { panictry!(parse::parse_expr_from_source_str( - "".to_string(), + FileName::QuoteExpansion, s, self.parse_sess())) } fn parse_tts(&self, s: String) -> Vec { - let source_name = "".to_owned(); + let source_name = FileName::QuoteExpansion; parse::parse_stream_from_source_str(source_name, s, self.parse_sess(), None) .into_trees().collect() } @@ -670,7 +675,11 @@ fn expr_mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P { vec![mk_name(cx, sp, ast::Ident::with_empty_ctxt(ident))]); } - token::Interpolated(_) => panic!("quote! with interpolated token"), + token::Interpolated(_) => { + cx.span_err(sp, "quote! with interpolated token"); + // Use dummy name. + "Interpolated" + } token::Eq => "Eq", token::Lt => "Lt", diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 86657e675b..6b08448107 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use syntax_pos::{self, Pos, Span}; +use syntax_pos::{self, Pos, Span, FileName}; use ext::base::*; use ext::base; use ext::build::AstBuilder; @@ -23,7 +23,7 @@ use util::small_vector::SmallVector; use std::fs::File; use std::io::prelude::*; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use std::rc::Rc; // These macros all relate to the file system; they either return @@ -49,7 +49,7 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) let topmost = cx.expansion_cause().unwrap_or(sp); let loc = cx.codemap().lookup_char_pos(topmost.lo()); - base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32)) + base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32 + 1)) } /* __rust_unstable_column!(): expands to the current column number */ @@ -71,7 +71,7 @@ pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) let topmost = cx.expansion_cause().unwrap_or(sp); let loc = cx.codemap().lookup_char_pos(topmost.lo()); - base::MacEager::expr(cx.expr_str(topmost, Symbol::intern(&loc.file.name))) + base::MacEager::expr(cx.expr_str(topmost, Symbol::intern(&loc.file.name.to_string()))) } pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) @@ -99,8 +99,8 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T None => return DummyResult::expr(sp), }; // The file will be added to the code map by the parser - let path = res_rel_file(cx, sp, Path::new(&file)); - let directory_ownership = DirectoryOwnership::Owned; + let path = res_rel_file(cx, sp, file); + let directory_ownership = DirectoryOwnership::Owned { relative: None }; let p = parse::new_sub_parser_from_file(cx.parse_sess(), &path, directory_ownership, None, sp); struct ExpandResult<'a> { @@ -135,7 +135,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenT Some(f) => f, None => return DummyResult::expr(sp) }; - let file = res_rel_file(cx, sp, Path::new(&file)); + let file = res_rel_file(cx, sp, file); let mut bytes = Vec::new(); match File::open(&file).and_then(|mut f| f.read_to_end(&mut bytes)) { Ok(..) => {} @@ -151,8 +151,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenT Ok(src) => { // Add this input file to the code map to make it available as // dependency information - let filename = format!("{}", file.display()); - cx.codemap().new_filemap_and_lines(&filename, &src); + cx.codemap().new_filemap_and_lines(&file, &src); base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&src))) } @@ -171,7 +170,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke Some(f) => f, None => return DummyResult::expr(sp) }; - let file = res_rel_file(cx, sp, Path::new(&file)); + let file = res_rel_file(cx, sp, file); let mut bytes = Vec::new(); match File::open(&file).and_then(|mut f| f.read_to_end(&mut bytes)) { Err(e) => { @@ -182,8 +181,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke Ok(..) => { // Add this input file to the code map to make it available as // dependency information, but don't enter it's contents - let filename = format!("{}", file.display()); - cx.codemap().new_filemap_and_lines(&filename, ""); + cx.codemap().new_filemap_and_lines(&file, ""); base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Rc::new(bytes)))) } @@ -192,16 +190,20 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke // resolve a file-system path to an absolute file-system path (if it // isn't already) -fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: &Path) -> PathBuf { +fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: String) -> PathBuf { + let arg = PathBuf::from(arg); // Relative paths are resolved relative to the file in which they are found // after macro expansion (that is, they are unhygienic). if !arg.is_absolute() { let callsite = sp.source_callsite(); - let mut path = cx.codemap().span_to_unmapped_path(callsite); + let mut path = match cx.codemap().span_to_unmapped_path(callsite) { + FileName::Real(path) => path, + other => panic!("cannot resolve relative path in non-file source `{}`", other), + }; path.pop(); path.push(arg); path } else { - arg.to_path_buf() + arg } } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 2167b64e61..124477620c 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -603,6 +603,7 @@ fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal { "path" => token::NtPath(panictry!(p.parse_path_common(PathStyle::Type, false))), "meta" => token::NtMeta(panictry!(p.parse_meta_item())), "vis" => token::NtVis(panictry!(p.parse_visibility(true))), + "lifetime" => token::NtLifetime(p.expect_lifetime()), // this is not supposed to happen, since it has been checked // when compiling the macro. _ => p.span_bug(sp, "invalid fragment specifier") diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 5e58f003c2..d86603e94e 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -768,10 +768,11 @@ fn token_can_be_followed_by_any(tok: "ed::TokenTree) -> bool { /// ANYTHING without fear of future compatibility hazards). fn frag_can_be_followed_by_any(frag: &str) -> bool { match frag { - "item" | // always terminated by `}` or `;` - "block" | // exactly one token tree - "ident" | // exactly one token tree - "meta" | // exactly one token tree + "item" | // always terminated by `}` or `;` + "block" | // exactly one token tree + "ident" | // exactly one token tree + "meta" | // exactly one token tree + "lifetime" | // exactly one token tree "tt" => // exactly one token tree true, @@ -832,8 +833,8 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> Result Ok(true), _ => Ok(false), }, - "ident" => { - // being a single token, idents are harmless + "ident" | "lifetime" => { + // being a single token, idents and lifetimes are harmless Ok(true) }, "meta" | "tt" => { @@ -887,9 +888,21 @@ fn is_legal_fragment_specifier(sess: &ParseSess, match frag_name { "item" | "block" | "stmt" | "expr" | "pat" | "path" | "ty" | "ident" | "meta" | "tt" | "" => true, + "lifetime" => { + if !features.borrow().macro_lifetime_matcher && + !attr::contains_name(attrs, "allow_internal_unstable") { + let explain = feature_gate::EXPLAIN_LIFETIME_MATCHER; + emit_feature_err(sess, + "macro_lifetime_matcher", + frag_span, + GateIssue::Language, + explain); + } + true + }, "vis" => { - if !features.borrow().macro_vis_matcher - && !attr::contains_name(attrs, "allow_internal_unstable") { + if !features.borrow().macro_vis_matcher && + !attr::contains_name(attrs, "allow_internal_unstable") { let explain = feature_gate::EXPLAIN_VIS_MATCHER; emit_feature_err(sess, "macro_vis_matcher", diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index ebe7853b8a..e5ef9393e7 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -33,9 +33,9 @@ use syntax_pos::Span; use errors::{DiagnosticBuilder, Handler, FatalError}; use visit::{self, FnKind, Visitor}; use parse::ParseSess; -use symbol::Symbol; +use symbol::{keywords, Symbol}; -use std::env; +use std::{env, path}; macro_rules! set { (proc_macro) => {{ @@ -63,9 +63,9 @@ macro_rules! declare_features { /// A set of features to be used by later passes. pub struct Features { - /// #![feature] attrs for stable language features, for error reporting + /// `#![feature]` attrs for stable language features, for error reporting pub declared_stable_lang_features: Vec<(Symbol, Span)>, - /// #![feature] attrs for non-language (library) features + /// `#![feature]` attrs for non-language (library) features pub declared_lib_features: Vec<(Symbol, Span)>, $(pub $feature: bool),+ } @@ -186,6 +186,9 @@ declare_features! ( // Allows the use of rustc_* attributes; RFC 572 (active, rustc_attrs, "1.0.0", Some(29642)), + // Allows the use of non lexical lifetimes; RFC 2094 + (active, nll, "1.0.0", Some(44928)), + // Allows the use of #[allow_internal_unstable]. This is an // attribute on macro_rules! and can't use the attribute handling // below (it has to be checked before expansion possibly makes @@ -284,10 +287,6 @@ declare_features! ( // Allows all literals in attribute lists and values of key-value pairs. (active, attr_literals, "1.13.0", Some(34981)), - // Allows the sysV64 ABI to be specified on all platforms - // instead of just the platforms on which it is the C ABI - (active, abi_sysv64, "1.13.0", Some(36167)), - // Allows untagged unions `union U { ... }` (active, untagged_unions, "1.13.0", Some(32836)), @@ -372,6 +371,8 @@ declare_features! ( // Generators (active, generators, "1.21.0", None), + // Trait aliases + (active, trait_alias, "1.24.0", Some(41517)), // global allocators and their internals (active, global_allocator, "1.20.0", None), @@ -381,6 +382,10 @@ declare_features! ( (active, doc_cfg, "1.21.0", Some(43781)), // #[doc(masked)] (active, doc_masked, "1.21.0", Some(44027)), + // #[doc(spotlight)] + (active, doc_spotlight, "1.22.0", Some(45040)), + // #[doc(include="some-file")] + (active, external_doc, "1.22.0", Some(44732)), // allow `#[must_use]` on functions and comparison operators (RFC 1940) (active, fn_must_use, "1.21.0", Some(43302)), @@ -418,6 +423,33 @@ declare_features! ( // #![wasm_import_memory] attribute (active, wasm_import_memory, "1.22.0", None), + + // `crate` in paths + (active, crate_in_paths, "1.23.0", Some(45477)), + + // In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`) + (active, in_band_lifetimes, "1.23.0", Some(44524)), + + // Nested groups in `use` (RFC 2128) + (active, use_nested_groups, "1.23.0", Some(44494)), + + // generic associated types (RFC 1598) + (active, generic_associated_types, "1.23.0", Some(44265)), + + // Resolve absolute paths as paths from other crates + (active, extern_absolute_paths, "1.24.0", Some(44660)), + + // `foo.rs` as an alternative to `foo/mod.rs` + (active, non_modrs_mods, "1.24.0", Some(44660)), + + // Nested `impl Trait` + (active, nested_impl_trait, "1.24.0", Some(34511)), + + // Termination trait in main (RFC 1937) + (active, termination_trait, "1.24.0", Some(43301)), + + // Allows use of the :lifetime macro fragment specifier + (active, macro_lifetime_matcher, "1.24.0", Some(46895)), ); declare_features! ( @@ -504,6 +536,9 @@ declare_features! ( (accepted, rvalue_static_promotion, "1.21.0", Some(38865)), // Allow Drop types in constants (RFC 1440) (accepted, drop_types_in_const, "1.22.0", Some(33156)), + // Allows the sysV64 ABI to be specified on all platforms + // instead of just the platforms on which it is the C ABI + (accepted, abi_sysv64, "1.24.0", Some(36167)), ); // If you change this, please modify src/doc/unstable-book as well. You must @@ -702,6 +737,12 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), + ("rustc_regions", Normal, Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_regions]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), ("rustc_error", Whitelisted, Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_error]` attribute \ @@ -732,18 +773,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_metadata_dirty", Whitelisted, Gated(Stability::Unstable, - "rustc_attrs", - "the `#[rustc_metadata_dirty]` attribute \ - is just used for rustc unit tests \ - and will never be stable", - cfg_fn!(rustc_attrs))), - ("rustc_metadata_clean", Whitelisted, Gated(Stability::Unstable, - "rustc_attrs", - "the `#[rustc_metadata_clean]` attribute \ - is just used for rustc unit tests \ - and will never be stable", - cfg_fn!(rustc_attrs))), ("rustc_partition_reused", Whitelisted, Gated(Stability::Unstable, "rustc_attrs", "this attribute \ @@ -784,6 +813,12 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG libcore functions that are inlined \ across crates and will never be stable", cfg_fn!(rustc_attrs))), + + // RFC #2094 + ("nll", Whitelisted, Gated(Stability::Unstable, + "nll", + "Non lexical lifetimes", + cfg_fn!(nll))), ("compiler_builtins", Whitelisted, Gated(Stability::Unstable, "compiler_builtins", "the `#[compiler_builtins]` attribute is used to \ @@ -1023,6 +1058,14 @@ impl<'a> Context<'a> { if name == n { if let Gated(_, name, desc, ref has_feature) = *gateage { gate_feature_fn!(self, has_feature, attr.span, name, desc, GateStrength::Hard); + } else if name == "doc" { + if let Some(content) = attr.meta_item_list() { + if content.iter().any(|c| c.check_name("include")) { + gate_feature!(self, external_doc, attr.span, + "#[doc(include = \"...\")] is experimental" + ); + } + } } debug!("check_attribute: {:?} is builtin, {:?}, {:?}", attr.path, ty, gateage); return; @@ -1186,6 +1229,9 @@ pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str = pub const EXPLAIN_VIS_MATCHER: &'static str = ":vis fragment specifier is experimental and subject to change"; +pub const EXPLAIN_LIFETIME_MATCHER: &'static str = + ":lifetime fragment specifier is experimental and subject to change"; + pub const EXPLAIN_PLACEMENT_IN: &'static str = "placement-in expression syntax is experimental and subject to change."; @@ -1234,10 +1280,6 @@ impl<'a> PostExpansionVisitor<'a> { gate_feature_post!(&self, unboxed_closures, span, "rust-call ABI is subject to change"); }, - Abi::SysV64 => { - gate_feature_post!(&self, abi_sysv64, span, - "sysv64 ABI is experimental and subject to change"); - }, Abi::PtxKernel => { gate_feature_post!(&self, abi_ptx, span, "PTX ABIs are experimental and subject to change"); @@ -1260,6 +1302,7 @@ impl<'a> PostExpansionVisitor<'a> { Abi::Fastcall | Abi::Aapcs | Abi::Win64 | + Abi::SysV64 | Abi::Rust | Abi::C | Abi::System => {} @@ -1283,6 +1326,96 @@ fn contains_novel_literal(item: &ast::MetaItem) -> bool { } } +// Bans nested `impl Trait`, e.g. `impl Into`. +// Nested `impl Trait` _is_ allowed in associated type position, +// e.g `impl Iterator` +struct NestedImplTraitVisitor<'a> { + context: &'a Context<'a>, + is_in_impl_trait: bool, +} + +impl<'a> NestedImplTraitVisitor<'a> { + fn with_impl_trait(&mut self, is_in_impl_trait: bool, f: F) + where F: FnOnce(&mut NestedImplTraitVisitor<'a>) + { + let old_is_in_impl_trait = self.is_in_impl_trait; + self.is_in_impl_trait = is_in_impl_trait; + f(self); + self.is_in_impl_trait = old_is_in_impl_trait; + } +} + + +impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> { + fn visit_ty(&mut self, t: &'a ast::Ty) { + if let ast::TyKind::ImplTrait(_) = t.node { + if self.is_in_impl_trait { + gate_feature_post!(&self, nested_impl_trait, t.span, + "nested `impl Trait` is experimental" + ); + } + self.with_impl_trait(true, |this| visit::walk_ty(this, t)); + } else { + visit::walk_ty(self, t); + } + } + fn visit_path_parameters(&mut self, _: Span, path_parameters: &'a ast::PathParameters) { + match *path_parameters { + ast::PathParameters::AngleBracketed(ref params) => { + for type_ in ¶ms.types { + self.visit_ty(type_); + } + for type_binding in ¶ms.bindings { + // Type bindings such as `Item=impl Debug` in `Iterator` + // are allowed to contain nested `impl Trait`. + self.with_impl_trait(false, |this| visit::walk_ty(this, &type_binding.ty)); + } + } + ast::PathParameters::Parenthesized(ref params) => { + for type_ in ¶ms.inputs { + self.visit_ty(type_); + } + if let Some(ref type_) = params.output { + // `-> Foo` syntax is essentially an associated type binding, + // so it is also allowed to contain nested `impl Trait`. + self.with_impl_trait(false, |this| visit::walk_ty(this, type_)); + } + } + } + } +} + +impl<'a> PostExpansionVisitor<'a> { + fn whole_crate_feature_gates(&mut self, krate: &ast::Crate) { + visit::walk_crate( + &mut NestedImplTraitVisitor { + context: self.context, + is_in_impl_trait: false, + }, krate); + + for &(ident, span) in &*self.context.parse_sess.non_modrs_mods.borrow() { + if !span.allows_unstable() { + let cx = &self.context; + let level = GateStrength::Hard; + let has_feature = cx.features.non_modrs_mods; + let name = "non_modrs_mods"; + debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", + name, span, has_feature); + + if !has_feature && !span.allows_unstable() { + leveled_feature_err( + cx.parse_sess, name, span, GateIssue::Language, + "mod statements in non-mod.rs files are unstable", level + ) + .help(&format!("on stable builds, rename this file to {}{}mod.rs", + ident, path::MAIN_SEPARATOR)) + .emit(); + } + } + } + } +} + impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { fn visit_attribute(&mut self, attr: &ast::Attribute) { if !attr.span.allows_unstable() { @@ -1300,6 +1433,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { gate_feature_post!(&self, doc_masked, attr.span, "#[doc(masked)] is experimental" ); + } else if content.iter().any(|c| c.check_name("spotlight")) { + gate_feature_post!(&self, doc_spotlight, attr.span, + "#[doc(spotlight)] is experimental" + ); } } } @@ -1318,7 +1455,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { fn visit_name(&mut self, sp: Span, name: ast::Name) { if !name.as_str().is_ascii() { - gate_feature_post!(&self, non_ascii_idents, sp, + gate_feature_post!(&self, + non_ascii_idents, + self.context.parse_sess.codemap().def_span(sp), "non-ascii idents are not fully supported."); } } @@ -1385,6 +1524,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } + ast::ItemKind::TraitAlias(..) => { + gate_feature_post!(&self, trait_alias, + i.span, + "trait aliases are not yet fully implemented"); + } + ast::ItemKind::AutoImpl(..) => { gate_feature_post!(&self, optin_builtin_traits, i.span, @@ -1601,9 +1746,17 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { gate_feature_post!(&self, const_fn, ti.span, "const fn is unstable"); } } - ast::TraitItemKind::Type(_, Some(_)) => { - gate_feature_post!(&self, associated_type_defaults, ti.span, - "associated type defaults are unstable"); + ast::TraitItemKind::Type(_, ref default) => { + // We use two if statements instead of something like match guards so that both + // of these errors can be emitted if both cases apply. + if default.is_some() { + gate_feature_post!(&self, associated_type_defaults, ti.span, + "associated type defaults are unstable"); + } + if ti.generics.is_parameterized() { + gate_feature_post!(&self, generic_associated_types, ti.span, + "generic associated types are unstable"); + } } _ => {} } @@ -1623,11 +1776,49 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { gate_feature_post!(&self, const_fn, ii.span, "const fn is unstable"); } } + ast::ImplItemKind::Type(_) if ii.generics.is_parameterized() => { + gate_feature_post!(&self, generic_associated_types, ii.span, + "generic associated types are unstable"); + } _ => {} } visit::walk_impl_item(self, ii); } + fn visit_path(&mut self, path: &'a ast::Path, _id: NodeId) { + for segment in &path.segments { + if segment.identifier.name == keywords::Crate.name() { + gate_feature_post!(&self, crate_in_paths, segment.span, + "`crate` in paths is experimental"); + } + } + + visit::walk_path(self, path); + } + + fn visit_use_tree(&mut self, use_tree: &'a ast::UseTree, id: NodeId, nested: bool) { + if nested { + match use_tree.kind { + ast::UseTreeKind::Simple(_) => { + if use_tree.prefix.segments.len() != 1 { + gate_feature_post!(&self, use_nested_groups, use_tree.span, + "paths in `use` groups are experimental"); + } + } + ast::UseTreeKind::Glob => { + gate_feature_post!(&self, use_nested_groups, use_tree.span, + "glob imports in `use` groups are experimental"); + } + ast::UseTreeKind::Nested(_) => { + gate_feature_post!(&self, use_nested_groups, use_tree.span, + "nested groups in `use` are experimental"); + } + } + } + + visit::walk_use_tree(self, use_tree, id); + } + fn visit_vis(&mut self, vis: &'a ast::Visibility) { if let ast::Visibility::Crate(span, ast::CrateSugar::JustCrate) = *vis { gate_feature_post!(&self, crate_visibility_modifier, span, @@ -1636,22 +1827,19 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_vis(self, vis); } - fn visit_generics(&mut self, g: &'a ast::Generics) { - for t in &g.ty_params { - if !t.attrs.is_empty() { - gate_feature_post!(&self, generic_param_attrs, t.attrs[0].span, - "attributes on type parameter bindings are experimental"); - } - } - visit::walk_generics(self, g) - } + fn visit_generic_param(&mut self, param: &'a ast::GenericParam) { + let (attrs, explain) = match *param { + ast::GenericParam::Lifetime(ref ld) => + (&ld.attrs, "attributes on lifetime bindings are experimental"), + ast::GenericParam::Type(ref t) => + (&t.attrs, "attributes on type parameter bindings are experimental"), + }; - fn visit_lifetime_def(&mut self, lifetime_def: &'a ast::LifetimeDef) { - if !lifetime_def.attrs.is_empty() { - gate_feature_post!(&self, generic_param_attrs, lifetime_def.attrs[0].span, - "attributes on lifetime bindings are experimental"); + if !attrs.is_empty() { + gate_feature_post!(&self, generic_param_attrs, attrs[0].span, explain); } - visit::walk_lifetime_def(self, lifetime_def) + + visit::walk_generic_param(self, param) } fn visit_lifetime(&mut self, lt: &'a ast::Lifetime) { @@ -1779,7 +1967,9 @@ pub fn check_crate(krate: &ast::Crate, parse_sess: sess, plugin_attributes, }; - visit::walk_crate(&mut PostExpansionVisitor { context: &ctx }, krate); + let visitor = &mut PostExpansionVisitor { context: &ctx }; + visitor.whole_crate_feature_gates(krate); + visit::walk_crate(visitor, krate); } #[derive(Clone, Copy, PartialEq, Eq, Hash)] diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index cc63bffec4..6682a3439f 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -56,8 +56,8 @@ pub trait Folder : Sized { noop_fold_meta_item(meta_item, self) } - fn fold_view_path(&mut self, view_path: P) -> P { - noop_fold_view_path(view_path, self) + fn fold_use_tree(&mut self, use_tree: UseTree) -> UseTree { + noop_fold_use_tree(use_tree, self) } fn fold_foreign_item(&mut self, ni: ForeignItem) -> ForeignItem { @@ -237,8 +237,12 @@ pub trait Folder : Sized { noop_fold_ty_param(tp, self) } - fn fold_ty_params(&mut self, tps: Vec) -> Vec { - noop_fold_ty_params(tps, self) + fn fold_generic_param(&mut self, param: GenericParam) -> GenericParam { + noop_fold_generic_param(param, self) + } + + fn fold_generic_params(&mut self, params: Vec) -> Vec { + noop_fold_generic_params(params, self) } fn fold_tt(&mut self, tt: TokenTree) -> TokenTree { @@ -310,30 +314,18 @@ pub fn noop_fold_meta_items(meta_items: Vec, fld: &mut T) - meta_items.move_map(|x| fld.fold_meta_item(x)) } -pub fn noop_fold_view_path(view_path: P, fld: &mut T) -> P { - view_path.map(|Spanned {node, span}| Spanned { - node: match node { - ViewPathSimple(ident, path) => { - ViewPathSimple(fld.fold_ident(ident), fld.fold_path(path)) - } - ViewPathGlob(path) => { - ViewPathGlob(fld.fold_path(path)) - } - ViewPathList(path, path_list_idents) => { - let path = fld.fold_path(path); - let path_list_idents = path_list_idents.move_map(|path_list_ident| Spanned { - node: PathListItem_ { - id: fld.new_id(path_list_ident.node.id), - rename: path_list_ident.node.rename.map(|ident| fld.fold_ident(ident)), - name: fld.fold_ident(path_list_ident.node.name), - }, - span: fld.new_span(path_list_ident.span) - }); - ViewPathList(path, path_list_idents) - } +pub fn noop_fold_use_tree(use_tree: UseTree, fld: &mut T) -> UseTree { + UseTree { + span: fld.new_span(use_tree.span), + prefix: fld.fold_path(use_tree.prefix), + kind: match use_tree.kind { + UseTreeKind::Simple(ident) => UseTreeKind::Simple(fld.fold_ident(ident)), + UseTreeKind::Glob => UseTreeKind::Glob, + UseTreeKind::Nested(items) => UseTreeKind::Nested(items.move_map(|(tree, id)| { + (fld.fold_use_tree(tree), fld.new_id(id)) + })), }, - span: fld.new_span(span) - }) + } } pub fn fold_attrs(attrs: Vec, fld: &mut T) -> Vec { @@ -375,8 +367,8 @@ pub fn noop_fold_ty(t: P, fld: &mut T) -> P { TyKind::Rptr(fld.fold_opt_lifetime(region), fld.fold_mt(mt)) } TyKind::BareFn(f) => { - TyKind::BareFn(f.map(|BareFnTy {lifetimes, unsafety, abi, decl}| BareFnTy { - lifetimes: fld.fold_lifetime_defs(lifetimes), + TyKind::BareFn(f.map(|BareFnTy {generic_params, unsafety, abi, decl}| BareFnTy { + generic_params: fld.fold_generic_params(generic_params), unsafety, abi, decl: fld.fold_fn_decl(decl) @@ -650,6 +642,7 @@ pub fn noop_fold_interpolated(nt: token::Nonterminal, fld: &mut T) token::NtWhereClause(fld.fold_where_clause(where_clause)), token::NtArg(arg) => token::NtArg(fld.fold_arg(arg)), token::NtVis(vis) => token::NtVis(fld.fold_vis(vis)), + token::NtLifetime(lifetime) => token::NtLifetime(fld.fold_lifetime(lifetime)), } } @@ -689,8 +682,18 @@ pub fn noop_fold_ty_param(tp: TyParam, fld: &mut T) -> TyParam { } } -pub fn noop_fold_ty_params(tps: Vec, fld: &mut T) -> Vec { - tps.move_map(|tp| fld.fold_ty_param(tp)) +pub fn noop_fold_generic_param(param: GenericParam, fld: &mut T) -> GenericParam { + match param { + GenericParam::Lifetime(l) => GenericParam::Lifetime(fld.fold_lifetime_def(l)), + GenericParam::Type(t) => GenericParam::Type(fld.fold_ty_param(t)), + } +} + +pub fn noop_fold_generic_params( + params: Vec, + fld: &mut T +) -> Vec { + params.move_map(|p| fld.fold_generic_param(p)) } pub fn noop_fold_lifetime(l: Lifetime, fld: &mut T) -> Lifetime { @@ -728,11 +731,10 @@ pub fn noop_fold_opt_lifetime(o_lt: Option, fld: &mut T) o_lt.map(|lt| fld.fold_lifetime(lt)) } -pub fn noop_fold_generics(Generics {ty_params, lifetimes, where_clause, span}: Generics, +pub fn noop_fold_generics(Generics { params, where_clause, span }: Generics, fld: &mut T) -> Generics { Generics { - ty_params: fld.fold_ty_params(ty_params), - lifetimes: fld.fold_lifetime_defs(lifetimes), + params: fld.fold_generic_params(params), where_clause: fld.fold_where_clause(where_clause), span: fld.new_span(span), } @@ -756,12 +758,12 @@ pub fn noop_fold_where_predicate( fld: &mut T) -> WherePredicate { match pred { - ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{bound_lifetimes, + ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{bound_generic_params, bounded_ty, bounds, span}) => { ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate { - bound_lifetimes: fld.fold_lifetime_defs(bound_lifetimes), + bound_generic_params: fld.fold_generic_params(bound_generic_params), bounded_ty: fld.fold_ty(bounded_ty), bounds: bounds.move_map(|x| fld.fold_ty_param_bound(x)), span: fld.new_span(span) @@ -818,7 +820,7 @@ pub fn noop_fold_trait_ref(p: TraitRef, fld: &mut T) -> TraitRef { pub fn noop_fold_poly_trait_ref(p: PolyTraitRef, fld: &mut T) -> PolyTraitRef { ast::PolyTraitRef { - bound_lifetimes: fld.fold_lifetime_defs(p.bound_lifetimes), + bound_generic_params: fld.fold_generic_params(p.bound_generic_params), trait_ref: fld.fold_trait_ref(p.trait_ref), span: fld.new_span(p.span), } @@ -863,19 +865,20 @@ fn noop_fold_bounds(bounds: TyParamBounds, folder: &mut T) } pub fn noop_fold_block(b: P, folder: &mut T) -> P { - b.map(|Block {id, stmts, rules, span}| Block { + b.map(|Block {id, stmts, rules, span, recovered}| Block { id: folder.new_id(id), stmts: stmts.move_flat_map(|s| folder.fold_stmt(s).into_iter()), rules, span: folder.new_span(span), + recovered, }) } pub fn noop_fold_item_kind(i: ItemKind, folder: &mut T) -> ItemKind { match i { ItemKind::ExternCrate(string) => ItemKind::ExternCrate(string), - ItemKind::Use(view_path) => { - ItemKind::Use(folder.fold_view_path(view_path)) + ItemKind::Use(use_tree) => { + ItemKind::Use(use_tree.map(|tree| folder.fold_use_tree(tree))) } ItemKind::Static(t, m, e) => { ItemKind::Static(folder.fold_ty(t), m, folder.fold_expr(e)) @@ -933,6 +936,9 @@ pub fn noop_fold_item_kind(i: ItemKind, folder: &mut T) -> ItemKind { folder.fold_bounds(bounds), items.move_flat_map(|item| folder.fold_trait_item(item)), ), + ItemKind::TraitAlias(generics, bounds) => ItemKind::TraitAlias( + folder.fold_generics(generics), + folder.fold_bounds(bounds)), ItemKind::Mac(m) => ItemKind::Mac(folder.fold_mac(m)), ItemKind::MacroDef(def) => ItemKind::MacroDef(folder.fold_macro_def(def)), } diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index e739c6d04e..54c726d846 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -24,11 +24,12 @@ use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan}; use errors::registry::Registry; use errors::{DiagnosticBuilder, SubDiagnostic, CodeSuggestion, CodeMapper}; use errors::DiagnosticId; -use errors::emitter::Emitter; +use errors::emitter::{Emitter, EmitterWriter}; use std::rc::Rc; use std::io::{self, Write}; use std::vec; +use std::sync::{Arc, Mutex}; use rustc_serialize::json::{as_json, as_pretty_json}; @@ -95,7 +96,7 @@ struct Diagnostic { spans: Vec, /// Associated diagnostic messages. children: Vec, - /// The message as rustc would render it. Currently this is always `None` + /// The message as rustc would render it. rendered: Option, } @@ -170,6 +171,27 @@ impl Diagnostic { rendered: None, } }); + + // generate regular command line output and store it in the json + + // A threadsafe buffer for writing. + #[derive(Default, Clone)] + struct BufWriter(Arc>>); + + impl Write for BufWriter { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.0.lock().unwrap().write(buf) + } + fn flush(&mut self) -> io::Result<()> { + self.0.lock().unwrap().flush() + } + } + let buf = BufWriter::default(); + let output = buf.clone(); + EmitterWriter::new(Box::new(buf), Some(je.cm.clone()), false).emit(db); + let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap(); + let output = String::from_utf8(output).unwrap(); + Diagnostic { message: db.message(), code: DiagnosticCode::map_opt_string(db.code.clone(), je), @@ -178,7 +200,7 @@ impl Diagnostic { children: db.children.iter().map(|c| { Diagnostic::from_sub_diagnostic(c, je) }).chain(sugg).collect(), - rendered: None, + rendered: Some(output), } } @@ -260,7 +282,7 @@ impl DiagnosticSpan { }) }); DiagnosticSpan { - file_name: start.file.name.clone(), + file_name: start.file.name.to_string(), byte_start: span.lo().0 - start.file.start_pos.0, byte_end: span.hi().0 - start.file.start_pos.0, line_start: start.line, diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 9e4f134e2b..0b51f2e981 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -22,7 +22,9 @@ #![feature(unicode)] #![feature(rustc_diagnostic_macros)] +#![feature(match_default_bindings)] #![feature(i128_type)] +#![feature(const_atomic_usize_new)] // See librustc_cratesio_shim/Cargo.toml for a comment explaining this. #[allow(unused_extern_crates)] diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index fb558d1a58..23449ee69a 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -12,7 +12,7 @@ pub use self::CommentStyle::*; use ast; use codemap::CodeMap; -use syntax_pos::{BytePos, CharPos, Pos}; +use syntax_pos::{BytePos, CharPos, Pos, FileName}; use parse::lexer::{is_block_doc_comment, is_pattern_whitespace}; use parse::lexer::{self, ParseSess, StringReader, TokenAndSpan}; use print::pprust; @@ -343,7 +343,7 @@ pub struct Literal { // it appears this function is called only from pprust... that's // probably not a good thing. -pub fn gather_comments_and_literals(sess: &ParseSess, path: String, srdr: &mut Read) +pub fn gather_comments_and_literals(sess: &ParseSess, path: FileName, srdr: &mut Read) -> (Vec, Vec) { let mut src = Vec::new(); srdr.read_to_end(&mut src).unwrap(); diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 951163d35f..9828995362 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -14,7 +14,7 @@ use codemap::{CodeMap, FilePathMapping}; use errors::{FatalError, DiagnosticBuilder}; use parse::{token, ParseSess}; use str::char_at; -use symbol::{Symbol, keywords}; +use symbol::Symbol; use std_unicode::property::Pattern_White_Space; use std::borrow::Cow; @@ -73,6 +73,13 @@ impl<'a> StringReader<'a> { fn mk_sp(&self, lo: BytePos, hi: BytePos) -> Span { unwrap_or!(self.override_span, Span::new(lo, hi, NO_EXPANSION)) } + fn mk_ident(&self, string: &str) -> Ident { + let mut ident = Ident::from_str(string); + if let Some(span) = self.override_span { + ident.ctxt = span.ctxt(); + } + ident + } fn next_token(&mut self) -> TokenAndSpan where Self: Sized { let res = self.try_next_token(); @@ -1103,7 +1110,7 @@ impl<'a> StringReader<'a> { token::Underscore } else { // FIXME: perform NFKC normalization here. (Issue #2253) - token::Ident(Ident::from_str(string)) + token::Ident(self.mk_ident(string)) } })); } @@ -1286,21 +1293,9 @@ impl<'a> StringReader<'a> { // expansion purposes. See #12512 for the gory details of why // this is necessary. let ident = self.with_str_from(start, |lifetime_name| { - Ident::from_str(&format!("'{}", lifetime_name)) + self.mk_ident(&format!("'{}", lifetime_name)) }); - // Conjure up a "keyword checking ident" to make sure that - // the lifetime name is not a keyword. - let keyword_checking_ident = self.with_str_from(start, |lifetime_name| { - Ident::from_str(lifetime_name) - }); - let keyword_checking_token = &token::Ident(keyword_checking_ident); - let last_bpos = self.pos; - if keyword_checking_token.is_reserved_ident() && - !keyword_checking_token.is_keyword(keywords::Static) { - self.err_span_(start, last_bpos, "lifetimes cannot use keyword names"); - } - return Ok(token::Lifetime(ident)); } @@ -1311,8 +1306,34 @@ impl<'a> StringReader<'a> { '\''); if !self.ch_is('\'') { + let pos = self.pos; + loop { + self.bump(); + if self.ch_is('\'') { + let start = self.byte_offset(start).to_usize(); + let end = self.byte_offset(self.pos).to_usize(); + self.bump(); + let span = self.mk_sp(start_with_quote, self.pos); + self.sess.span_diagnostic + .struct_span_err(span, + "character literal may only contain one codepoint") + .span_suggestion(span, + "if you meant to write a `str` literal, \ + use double quotes", + format!("\"{}\"", + &self.source_text[start..end])) + .emit(); + return Ok(token::Literal(token::Str_(Symbol::intern("??")), None)) + } + if self.ch_is('\n') || self.is_eof() || self.ch_is('/') { + // Only attempt to infer single line string literals. If we encounter + // a slash, bail out in order to avoid nonsensical suggestion when + // involving comments. + break; + } + } panic!(self.fatal_span_verbose( - start_with_quote, self.pos, + start_with_quote, pos, String::from("character literal may only contain one codepoint"))); } @@ -1719,6 +1740,7 @@ mod tests { use std::cell::RefCell; use std::collections::HashSet; use std::io; + use std::path::PathBuf; use std::rc::Rc; fn mk_sess(cm: Rc) -> ParseSess { @@ -1732,6 +1754,7 @@ mod tests { included_mod_stack: RefCell::new(Vec::new()), code_map: cm, missing_fragment_specifiers: RefCell::new(HashSet::new()), + non_modrs_mods: RefCell::new(vec![]), } } @@ -1740,7 +1763,7 @@ mod tests { sess: &'a ParseSess, teststr: String) -> StringReader<'a> { - let fm = cm.new_filemap("zebra.rs".to_string(), teststr); + let fm = cm.new_filemap(PathBuf::from("zebra.rs").into(), teststr); StringReader::new(sess, fm) } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index c679efd41e..a38ceba2f4 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -12,7 +12,7 @@ use ast::{self, CrateConfig}; use codemap::{CodeMap, FilePathMapping}; -use syntax_pos::{self, Span, FileMap, NO_EXPANSION}; +use syntax_pos::{self, Span, FileMap, NO_EXPANSION, FileName}; use errors::{Handler, ColorConfig, DiagnosticBuilder}; use feature_gate::UnstableFeatures; use parse::parser::Parser; @@ -47,6 +47,9 @@ pub struct ParseSess { pub unstable_features: UnstableFeatures, pub config: CrateConfig, pub missing_fragment_specifiers: RefCell>, + // Spans where a `mod foo;` statement was included in a non-mod.rs file. + // These are used to issue errors if the non_modrs_mods feature is not enabled. + pub non_modrs_mods: RefCell>, /// Used to determine and report recursive mod inclusions included_mod_stack: RefCell>, code_map: Rc, @@ -70,6 +73,7 @@ impl ParseSess { missing_fragment_specifiers: RefCell::new(HashSet::new()), included_mod_stack: RefCell::new(vec![]), code_map, + non_modrs_mods: RefCell::new(vec![]), } } @@ -86,7 +90,10 @@ pub struct Directory { #[derive(Copy, Clone)] pub enum DirectoryOwnership { - Owned, + Owned { + // None if `mod.rs`, `Some("foo")` if we're in `foo.rs` + relative: Option, + }, UnownedViaBlock, UnownedViaMod(bool /* legacy warnings? */), } @@ -107,17 +114,17 @@ pub fn parse_crate_attrs_from_file<'a>(input: &Path, sess: &'a ParseSess) parser.parse_inner_attributes() } -pub fn parse_crate_from_source_str(name: String, source: String, sess: &ParseSess) +pub fn parse_crate_from_source_str(name: FileName, source: String, sess: &ParseSess) -> PResult { new_parser_from_source_str(sess, name, source).parse_crate_mod() } -pub fn parse_crate_attrs_from_source_str(name: String, source: String, sess: &ParseSess) +pub fn parse_crate_attrs_from_source_str(name: FileName, source: String, sess: &ParseSess) -> PResult> { new_parser_from_source_str(sess, name, source).parse_inner_attributes() } -pub fn parse_expr_from_source_str(name: String, source: String, sess: &ParseSess) +pub fn parse_expr_from_source_str(name: FileName, source: String, sess: &ParseSess) -> PResult> { new_parser_from_source_str(sess, name, source).parse_expr() } @@ -126,29 +133,29 @@ pub fn parse_expr_from_source_str(name: String, source: String, sess: &ParseSess /// /// Returns `Ok(Some(item))` when successful, `Ok(None)` when no item was found, and `Err` /// when a syntax error occurred. -pub fn parse_item_from_source_str(name: String, source: String, sess: &ParseSess) +pub fn parse_item_from_source_str(name: FileName, source: String, sess: &ParseSess) -> PResult>> { new_parser_from_source_str(sess, name, source).parse_item() } -pub fn parse_meta_from_source_str(name: String, source: String, sess: &ParseSess) +pub fn parse_meta_from_source_str(name: FileName, source: String, sess: &ParseSess) -> PResult { new_parser_from_source_str(sess, name, source).parse_meta_item() } -pub fn parse_stmt_from_source_str(name: String, source: String, sess: &ParseSess) +pub fn parse_stmt_from_source_str(name: FileName, source: String, sess: &ParseSess) -> PResult> { new_parser_from_source_str(sess, name, source).parse_stmt() } -pub fn parse_stream_from_source_str(name: String, source: String, sess: &ParseSess, +pub fn parse_stream_from_source_str(name: FileName, source: String, sess: &ParseSess, override_span: Option) -> TokenStream { filemap_to_stream(sess, sess.codemap().new_filemap(name, source), override_span) } // Create a new parser from a source string -pub fn new_parser_from_source_str(sess: &ParseSess, name: String, source: String) +pub fn new_parser_from_source_str(sess: &ParseSess, name: FileName, source: String) -> Parser { let mut parser = filemap_to_parser(sess, sess.codemap().new_filemap(name, source)); parser.recurse_into_file_modules = false; @@ -898,9 +905,8 @@ mod tests { node: ast::Constness::NotConst, }, Abi::Rust, - ast::Generics{ // no idea on either of these: - lifetimes: Vec::new(), - ty_params: Vec::new(), + ast::Generics{ + params: Vec::new(), where_clause: ast::WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), @@ -924,6 +930,7 @@ mod tests { id: ast::DUMMY_NODE_ID, rules: ast::BlockCheckMode::Default, // no idea span: sp(15,21), + recovered: false, })), vis: ast::Visibility::Inherited, span: sp(0,21)}))); @@ -1018,7 +1025,7 @@ mod tests { #[test] fn crlf_doc_comments() { let sess = ParseSess::new(FilePathMapping::empty()); - let name = "".to_string(); + let name = FileName::Custom("source".to_string()); let source = "/// doc comment\r\nfn foo() {}".to_string(); let item = parse_item_from_source_str(name.clone(), source, &sess) .unwrap().unwrap(); @@ -1042,7 +1049,7 @@ mod tests { #[test] fn ttdelim_span() { let sess = ParseSess::new(FilePathMapping::empty()); - let expr = parse::parse_expr_from_source_str("foo".to_string(), + let expr = parse::parse_expr_from_source_str(PathBuf::from("foo").into(), "foo!( fn main() { body } )".to_string(), &sess).unwrap(); let tts: Vec<_> = match expr.node { @@ -1065,7 +1072,7 @@ mod tests { fn out_of_line_mod() { let sess = ParseSess::new(FilePathMapping::empty()); let item = parse_item_from_source_str( - "foo".to_owned(), + PathBuf::from("foo").into(), "mod foo { struct S; mod this_does_not_exist; }".to_owned(), &sess, ).unwrap().unwrap(); diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 078e86aa29..49a697edf4 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -58,7 +58,7 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> { }; if !self.obsolete_set.contains(&kind) && - (error || self.sess.span_diagnostic.can_emit_warnings) { + (error || self.sess.span_diagnostic.flags.can_emit_warnings) { err.note(desc); self.obsolete_set.insert(kind); } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c181930792..0d517a221d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -21,6 +21,7 @@ use ast::EnumDef; use ast::{Expr, ExprKind, RangeLimits}; use ast::{Field, FnDecl}; use ast::{ForeignItem, ForeignItemKind, FunctionRetTy}; +use ast::GenericParam; use ast::{Ident, ImplItem, IsAuto, Item, ItemKind}; use ast::{Lifetime, LifetimeDef, Lit, LitKind, UintTy}; use ast::Local; @@ -35,13 +36,13 @@ use ast::StrStyle; use ast::SelfKind; use ast::{TraitItem, TraitRef, TraitObjectSyntax}; use ast::{Ty, TyKind, TypeBinding, TyParam, TyParamBounds}; -use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple}; use ast::{Visibility, WhereClause, CrateSugar}; +use ast::{UseTree, UseTreeKind}; use ast::{BinOpKind, UnOp}; use ast::{RangeEnd, RangeSyntax}; use {ast, attr}; use codemap::{self, CodeMap, Spanned, respan}; -use syntax_pos::{self, Span, BytePos}; +use syntax_pos::{self, Span, BytePos, FileName, DUMMY_SP}; use errors::{self, DiagnosticBuilder}; use parse::{self, classify, token}; use parse::common::SeqSep; @@ -169,6 +170,51 @@ enum PrevTokenKind { Other, } +trait RecoverQPath: Sized { + const PATH_STYLE: PathStyle = PathStyle::Expr; + fn to_ty(&self) -> Option>; + fn to_recovered(&self, qself: Option, path: ast::Path) -> Self; + fn to_string(&self) -> String; +} + +impl RecoverQPath for Ty { + const PATH_STYLE: PathStyle = PathStyle::Type; + fn to_ty(&self) -> Option> { + Some(P(self.clone())) + } + fn to_recovered(&self, qself: Option, path: ast::Path) -> Self { + Self { span: path.span, node: TyKind::Path(qself, path), id: self.id } + } + fn to_string(&self) -> String { + pprust::ty_to_string(self) + } +} + +impl RecoverQPath for Pat { + fn to_ty(&self) -> Option> { + self.to_ty() + } + fn to_recovered(&self, qself: Option, path: ast::Path) -> Self { + Self { span: path.span, node: PatKind::Path(qself, path), id: self.id } + } + fn to_string(&self) -> String { + pprust::pat_to_string(self) + } +} + +impl RecoverQPath for Expr { + fn to_ty(&self) -> Option> { + self.to_ty() + } + fn to_recovered(&self, qself: Option, path: ast::Path) -> Self { + Self { span: path.span, node: ExprKind::Path(qself, path), + id: self.id, attrs: self.attrs.clone() } + } + fn to_string(&self) -> String { + pprust::expr_to_string(self) + } +} + /* ident is handled by common.rs */ #[derive(Clone)] @@ -507,7 +553,10 @@ impl<'a> Parser<'a> { restrictions: Restrictions::empty(), obsolete_set: HashSet::new(), recurse_into_file_modules, - directory: Directory { path: PathBuf::new(), ownership: DirectoryOwnership::Owned }, + directory: Directory { + path: PathBuf::new(), + ownership: DirectoryOwnership::Owned { relative: None } + }, root_module_name: None, expected_tokens: Vec::new(), token_cursor: TokenCursor { @@ -527,9 +576,11 @@ impl<'a> Parser<'a> { if let Some(directory) = directory { parser.directory = directory; - } else if parser.span != syntax_pos::DUMMY_SP { - parser.directory.path = sess.codemap().span_to_unmapped_path(parser.span); - parser.directory.path.pop(); + } else if !parser.span.source_equal(&DUMMY_SP) { + if let FileName::Real(path) = sess.codemap().span_to_unmapped_path(parser.span) { + parser.directory.path = path; + parser.directory.path.pop(); + } } parser.process_potential_macro_variable(); @@ -660,11 +711,28 @@ impl<'a> Parser<'a> { } else { label_sp }; - if self.span.contains(sp) { - err.span_label(self.span, label_exp); - } else { - err.span_label(sp, label_exp); - err.span_label(self.span, "unexpected token"); + + let cm = self.sess.codemap(); + match (cm.lookup_line(self.span.lo()), cm.lookup_line(sp.lo())) { + (Ok(ref a), Ok(ref b)) if a.line == b.line => { + // When the spans are in the same line, it means that the only content between + // them is whitespace, point at the found token in that case: + // + // X | () => { syntax error }; + // | ^^^^^ expected one of 8 possible tokens here + // + // instead of having: + // + // X | () => { syntax error }; + // | -^^^^^ unexpected token + // | | + // | expected one of 8 possible tokens here + err.span_label(self.span, label_exp); + } + _ => { + err.span_label(sp, label_exp); + err.span_label(self.span, "unexpected token"); + } } Err(err) } @@ -1156,6 +1224,7 @@ impl<'a> Parser<'a> { None => token::CloseDelim(self.token_cursor.frame.delim), }) } + fn look_ahead_span(&self, dist: usize) -> Span { if dist == 0 { return self.span @@ -1192,6 +1261,9 @@ impl<'a> Parser<'a> { pub fn span_err(&self, sp: Span, m: &str) { self.sess.span_diagnostic.span_err(sp, m) } + pub fn struct_span_err(&self, sp: Span, m: &str) -> DiagnosticBuilder<'a> { + self.sess.span_diagnostic.struct_span_err(sp, m) + } pub fn span_err_help(&self, sp: Span, m: &str, h: &str) { let mut err = self.sess.span_diagnostic.mut_span_err(sp, m); err.help(h); @@ -1223,12 +1295,16 @@ impl<'a> Parser<'a> { fn get_label(&mut self) -> ast::Ident { match self.token { token::Lifetime(ref ident) => *ident, + token::Interpolated(ref nt) => match nt.0 { + token::NtLifetime(lifetime) => lifetime.ident, + _ => self.bug("not a lifetime"), + }, _ => self.bug("not a lifetime"), } } /// parse a TyKind::BareFn type: - pub fn parse_ty_bare_fn(&mut self, lifetime_defs: Vec) + pub fn parse_ty_bare_fn(&mut self, generic_params: Vec) -> PResult<'a, TyKind> { /* @@ -1260,7 +1336,7 @@ impl<'a> Parser<'a> { Ok(TyKind::BareFn(P(BareFnTy { abi, unsafety, - lifetimes: lifetime_defs, + generic_params, decl, }))) } @@ -1293,9 +1369,9 @@ impl<'a> Parser<'a> { let lo = self.span; let (name, node, generics) = if self.eat_keyword(keywords::Type) { - let TyParam {ident, bounds, default, ..} = self.parse_ty_param(vec![])?; - self.expect(&token::Semi)?; - (ident, TraitItemKind::Type(bounds, default), ast::Generics::default()) + let (generics, TyParam {ident, bounds, default, ..}) = + self.parse_trait_item_assoc_ty(vec![])?; + (ident, TraitItemKind::Type(bounds, default), generics) } else if self.is_const_item() { self.expect_keyword(keywords::Const)?; let ident = self.parse_ident()?; @@ -1399,7 +1475,7 @@ impl<'a> Parser<'a> { // Parse a type pub fn parse_ty(&mut self) -> PResult<'a, P> { - self.parse_ty_common(true) + self.parse_ty_common(true, true) } /// Parse a type in restricted contexts where `+` is not permitted. @@ -1408,10 +1484,11 @@ impl<'a> Parser<'a> { /// Example 2: `value1 as TYPE + value2` /// `+` is prohibited to avoid interactions with expression grammar. fn parse_ty_no_plus(&mut self) -> PResult<'a, P> { - self.parse_ty_common(false) + self.parse_ty_common(false, true) } - fn parse_ty_common(&mut self, allow_plus: bool) -> PResult<'a, P> { + fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool) + -> PResult<'a, P> { maybe_whole!(self, NtTy, |x| x); let lo = self.span; @@ -1433,7 +1510,7 @@ impl<'a> Parser<'a> { self.expect(&token::CloseDelim(token::Paren))?; if ts.len() == 1 && !last_comma { - let ty = ts.into_iter().nth(0).unwrap().unwrap(); + let ty = ts.into_iter().nth(0).unwrap().into_inner(); let maybe_bounds = allow_plus && self.token == token::BinOp(token::Plus); match ty.node { // `(TY_BOUND_NOPAREN) + BOUND + ...`. @@ -1523,7 +1600,7 @@ impl<'a> Parser<'a> { if self.eat(&token::Not) { // Macro invocation in type position let (_, tts) = self.expect_delimited_token_tree()?; - TyKind::Mac(respan(lo.to(self.span), Mac_ { path: path, tts: tts })) + TyKind::Mac(respan(lo.to(self.prev_span), Mac_ { path: path, tts: tts })) } else { // Just a type path or bound list (trait object type) starting with a trait. // `Type` @@ -1544,13 +1621,14 @@ impl<'a> Parser<'a> { // Try to recover from use of `+` with incorrect priority. self.maybe_recover_from_bad_type_plus(allow_plus, &ty)?; + let ty = self.maybe_recover_from_bad_qpath(ty, allow_qpath_recovery)?; Ok(P(ty)) } - fn parse_remaining_bounds(&mut self, lifetime_defs: Vec, path: ast::Path, + fn parse_remaining_bounds(&mut self, generic_params: Vec, path: ast::Path, lo: Span, parse_plus: bool) -> PResult<'a, TyKind> { - let poly_trait_ref = PolyTraitRef::new(lifetime_defs, path, lo.to(self.prev_span)); + let poly_trait_ref = PolyTraitRef::new(generic_params, path, lo.to(self.prev_span)); let mut bounds = vec![TraitTyParamBound(poly_trait_ref, TraitBoundModifier::None)]; if parse_plus { self.bump(); // `+` @@ -1598,6 +1676,33 @@ impl<'a> Parser<'a> { Ok(()) } + // Try to recover from associated item paths like `[T]::AssocItem`/`(T, U)::AssocItem`. + fn maybe_recover_from_bad_qpath(&mut self, base: T, allow_recovery: bool) + -> PResult<'a, T> { + // Do not add `::` to expected tokens. + if !allow_recovery || self.token != token::ModSep { + return Ok(base); + } + let ty = match base.to_ty() { + Some(ty) => ty, + None => return Ok(base), + }; + + self.bump(); // `::` + let mut segments = Vec::new(); + self.parse_path_segments(&mut segments, T::PATH_STYLE, true)?; + + let span = ty.span.to(self.prev_span); + let recovered = + base.to_recovered(Some(QSelf { ty, position: 0 }), ast::Path { segments, span }); + + self.diagnostic() + .struct_span_err(span, "missing angle brackets in associated item path") + .span_suggestion(span, "try", recovered.to_string()).emit(); + + Ok(recovered) + } + fn parse_borrowed_pointee(&mut self) -> PResult<'a, TyKind> { let opt_lifetime = if self.check_lifetime() { Some(self.expect_lifetime()) } else { None }; let mutbl = self.parse_mutability(); @@ -1861,7 +1966,7 @@ impl<'a> Parser<'a> { loop { segments.push(self.parse_path_segment(style, enable_warning)?); - if self.is_import_coupler() || !self.eat(&token::ModSep) { + if self.is_import_coupler(false) || !self.eat(&token::ModSep) { return Ok(()); } } @@ -1909,7 +2014,7 @@ impl<'a> Parser<'a> { |p| p.parse_ty())?; self.bump(); // `)` let output = if self.eat(&token::RArrow) { - Some(self.parse_ty_no_plus()?) + Some(self.parse_ty_common(false, false)?) } else { None }; @@ -1930,14 +2035,12 @@ impl<'a> Parser<'a> { } /// Parse single lifetime 'a or panic. - fn expect_lifetime(&mut self) -> Lifetime { - match self.token { - token::Lifetime(ident) => { - let ident_span = self.span; - self.bump(); - Lifetime { ident: ident, span: ident_span, id: ast::DUMMY_NODE_ID } - } - _ => self.span_bug(self.span, "not a lifetime") + pub fn expect_lifetime(&mut self) -> Lifetime { + if let Some(lifetime) = self.token.lifetime(self.span) { + self.bump(); + lifetime + } else { + self.span_bug(self.span, "not a lifetime") } } @@ -1989,12 +2092,7 @@ impl<'a> Parser<'a> { } pub fn mk_expr(&mut self, span: Span, node: ExprKind, attrs: ThinVec) -> P { - P(Expr { - id: ast::DUMMY_NODE_ID, - node, - span, - attrs: attrs.into(), - }) + P(Expr { node, span, attrs, id: ast::DUMMY_NODE_ID }) } pub fn mk_unary(&mut self, unop: ast::UnOp, expr: P) -> ast::ExprKind { @@ -2116,12 +2214,11 @@ impl<'a> Parser<'a> { self.bump(); hi = self.prev_span; - let span = lo.to(hi); - return if es.len() == 1 && !trailing_comma { - Ok(self.mk_expr(span, ExprKind::Paren(es.into_iter().nth(0).unwrap()), attrs)) + ex = if es.len() == 1 && !trailing_comma { + ExprKind::Paren(es.into_iter().nth(0).unwrap()) } else { - Ok(self.mk_expr(span, ExprKind::Tup(es), attrs)) - } + ExprKind::Tup(es) + }; } token::OpenDelim(token::Brace) => { return self.parse_block_expr(lo, BlockCheckMode::Default, attrs); @@ -2321,7 +2418,10 @@ impl<'a> Parser<'a> { } } - return Ok(self.mk_expr(lo.to(hi), ex, attrs)); + let expr = Expr { node: ex, span: lo.to(hi), id: ast::DUMMY_NODE_ID, attrs }; + let expr = self.maybe_recover_from_bad_qpath(expr, true)?; + + return Ok(P(expr)); } fn parse_struct_expr(&mut self, lo: Span, pth: ast::Path, mut attrs: ThinVec) @@ -2494,7 +2594,7 @@ impl<'a> Parser<'a> { token::Ident(..) => { e = self.parse_dot_suffix(e, lo)?; } - token::Literal(token::Integer(n), suf) => { + token::Literal(token::Integer(index_ident), suf) => { let sp = self.span; // A tuple index may not have a suffix @@ -2504,16 +2604,25 @@ impl<'a> Parser<'a> { hi = self.span; self.bump(); - let index = n.as_str().parse::().ok(); + let invalid_msg = "invalid tuple or struct index"; + + let index = index_ident.as_str().parse::().ok(); match index { Some(n) => { + if n.to_string() != index_ident.as_str() { + let mut err = self.struct_span_err(self.prev_span, invalid_msg); + err.span_suggestion(self.prev_span, + "try simplifying the index", + n.to_string()); + err.emit(); + } let id = respan(dot_span.to(hi), n); let field = self.mk_tup_field(e, id); e = self.mk_expr(lo.to(hi), field, ThinVec::new()); } None => { let prev_span = self.prev_span; - self.span_err(prev_span, "invalid tuple or tuple struct index"); + self.span_err(prev_span, invalid_msg); } } } @@ -3382,7 +3491,7 @@ impl<'a> Parser<'a> { if self.check(&token::Comma) || self.check(&token::CloseDelim(token::Bracket)) { - slice = Some(P(ast::Pat { + slice = Some(P(Pat { id: ast::DUMMY_NODE_ID, node: PatKind::Wild, span: self.span, @@ -3425,7 +3534,16 @@ impl<'a> Parser<'a> { let lo = self.span; let hi; - if self.check(&token::DotDot) { + if self.check(&token::DotDot) || self.token == token::DotDotDot { + if self.token == token::DotDotDot { // Issue #46718 + let mut err = self.struct_span_err(self.span, + "expected field pattern, found `...`"); + err.span_suggestion(self.span, + "to omit remaining fields, use one fewer `.`", + "..".to_owned()); + err.emit(); + } + self.bump(); if self.token != token::CloseDelim(token::Brace) { let token_str = self.this_token_to_string(); @@ -3460,14 +3578,14 @@ impl<'a> Parser<'a> { (false, false) => BindingMode::ByValue(Mutability::Immutable), }; let fieldpath = codemap::Spanned{span:self.prev_span, node:fieldname}; - let fieldpat = P(ast::Pat{ + let fieldpat = P(Pat { id: ast::DUMMY_NODE_ID, node: PatKind::Ident(bind_type, fieldpath, None), span: boxed_span.to(hi), }); let subpat = if is_box { - P(ast::Pat{ + P(Pat { id: ast::DUMMY_NODE_ID, node: PatKind::Box(fieldpat), span: lo.to(hi), @@ -3676,11 +3794,10 @@ impl<'a> Parser<'a> { } } - Ok(P(ast::Pat { - id: ast::DUMMY_NODE_ID, - node: pat, - span: lo.to(self.prev_span), - })) + let pat = Pat { node: pat, span: lo.to(self.prev_span), id: ast::DUMMY_NODE_ID }; + let pat = self.maybe_recover_from_bad_qpath(pat, true)?; + + Ok(P(pat)) } /// Parse ident or ident @ pat @@ -3916,6 +4033,10 @@ impl<'a> Parser<'a> { self.look_ahead(1, |t| t.is_ident() && !t.is_reserved_ident()) } + fn is_crate_vis(&self) -> bool { + self.token.is_keyword(keywords::Crate) && self.look_ahead(1, |t| t != &token::ModSep) + } + fn eat_auto_trait(&mut self) -> bool { if self.token.is_keyword(keywords::Auto) && self.look_ahead(1, |t| t.is_keyword(keywords::Trait)) @@ -4026,10 +4147,15 @@ impl<'a> Parser<'a> { node: StmtKind::Item(macro_def), span: lo.to(self.prev_span), } - // Starts like a simple path, but not a union item. + // Starts like a simple path, but not a union item or item with `crate` visibility. + // Our goal here is to parse an arbitrary path `a::b::c` but not something that starts + // like a path (1 token), but it fact not a path. + // `union::b::c` - path, `union U { ... }` - not a path. + // `crate::b::c` - path, `crate struct S;` - not a path. } else if self.token.is_path_start() && !self.token.is_qpath_start() && - !self.is_union_item() { + !self.is_union_item() && + !self.is_crate_vis() { let pth = self.parse_path(PathStyle::Expr)?; if !self.eat(&token::Not) { @@ -4257,9 +4383,20 @@ impl<'a> Parser<'a> { /// Precondition: already parsed the '{'. fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P> { let mut stmts = vec![]; + let mut recovered = false; while !self.eat(&token::CloseDelim(token::Brace)) { - if let Some(stmt) = self.parse_full_stmt(false)? { + let stmt = match self.parse_full_stmt(false) { + Err(mut err) => { + err.emit(); + self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore); + self.eat(&token::CloseDelim(token::Brace)); + recovered = true; + break; + } + Ok(stmt) => stmt, + }; + if let Some(stmt) = stmt { stmts.push(stmt); } else if self.token == token::Eof { break; @@ -4268,18 +4405,18 @@ impl<'a> Parser<'a> { continue; }; } - Ok(P(ast::Block { stmts, id: ast::DUMMY_NODE_ID, rules: s, span: lo.to(self.prev_span), + recovered, })) } /// Parse a statement, including the trailing semicolon. pub fn parse_full_stmt(&mut self, macro_legacy_warnings: bool) -> PResult<'a, Option> { - let mut stmt = match self.parse_stmt_(macro_legacy_warnings) { + let mut stmt = match self.parse_stmt_without_recovery(macro_legacy_warnings)? { Some(stmt) => stmt, None => return Ok(None), }; @@ -4433,11 +4570,43 @@ impl<'a> Parser<'a> { }) } + /// Parses the following grammar: + /// TraitItemAssocTy = Ident ["<"...">"] [":" [TyParamBounds]] ["where" ...] ["=" Ty] + fn parse_trait_item_assoc_ty(&mut self, preceding_attrs: Vec) + -> PResult<'a, (ast::Generics, TyParam)> { + let span = self.span; + let ident = self.parse_ident()?; + let mut generics = self.parse_generics()?; + + // Parse optional colon and param bounds. + let bounds = if self.eat(&token::Colon) { + self.parse_ty_param_bounds()? + } else { + Vec::new() + }; + generics.where_clause = self.parse_where_clause()?; + + let default = if self.eat(&token::Eq) { + Some(self.parse_ty()?) + } else { + None + }; + self.expect(&token::Semi)?; + + Ok((generics, TyParam { + attrs: preceding_attrs.into(), + ident, + id: ast::DUMMY_NODE_ID, + bounds, + default, + span, + })) + } + /// Parses (possibly empty) list of lifetime and type parameters, possibly including /// trailing comma and erroneous trailing attributes. - pub fn parse_generic_params(&mut self) -> PResult<'a, (Vec, Vec)> { - let mut lifetime_defs = Vec::new(); - let mut ty_params = Vec::new(); + pub fn parse_generic_params(&mut self) -> PResult<'a, Vec> { + let mut params = Vec::new(); let mut seen_ty_param = false; loop { let attrs = self.parse_outer_attributes()?; @@ -4449,18 +4618,18 @@ impl<'a> Parser<'a> { } else { Vec::new() }; - lifetime_defs.push(LifetimeDef { + params.push(ast::GenericParam::Lifetime(LifetimeDef { attrs: attrs.into(), lifetime, bounds, - }); + })); if seen_ty_param { self.span_err(self.prev_span, "lifetime parameters must be declared prior to type parameters"); } } else if self.check_ident() { // Parse type parameter. - ty_params.push(self.parse_ty_param(attrs)?); + params.push(ast::GenericParam::Type(self.parse_ty_param(attrs)?)); seen_ty_param = true; } else { // Check for trailing attributes and stop parsing. @@ -4476,7 +4645,7 @@ impl<'a> Parser<'a> { break } } - Ok((lifetime_defs, ty_params)) + Ok(params) } /// Parse a set of optional generic type parameter declarations. Where @@ -4491,11 +4660,10 @@ impl<'a> Parser<'a> { let span_lo = self.span; if self.eat_lt() { - let (lifetime_defs, ty_params) = self.parse_generic_params()?; + let params = self.parse_generic_params()?; self.expect_gt()?; Ok(ast::Generics { - lifetimes: lifetime_defs, - ty_params, + params, where_clause: WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), @@ -4623,7 +4791,7 @@ impl<'a> Parser<'a> { where_clause.predicates.push(ast::WherePredicate::BoundPredicate( ast::WhereBoundPredicate { span: lo.to(self.prev_span), - bound_lifetimes: lifetime_defs, + bound_generic_params: lifetime_defs, bounded_ty: ty, bounds, } @@ -4974,12 +5142,18 @@ impl<'a> Parser<'a> { let vis = self.parse_visibility(false)?; let defaultness = self.parse_defaultness()?; let (name, node, generics) = if self.eat_keyword(keywords::Type) { + // This parses the grammar: + // ImplItemAssocTy = Ident ["<"...">"] ["where" ...] "=" Ty ";" let name = self.parse_ident()?; + let mut generics = self.parse_generics()?; + generics.where_clause = self.parse_where_clause()?; self.expect(&token::Eq)?; let typ = self.parse_ty()?; self.expect(&token::Semi)?; - (name, ast::ImplItemKind::Type(typ), ast::Generics::default()) + (name, ast::ImplItemKind::Type(typ), generics) } else if self.is_const_item() { + // This parses the grammar: + // ImplItemConst = "const" Ident ":" Ty "=" Expr ";" self.expect_keyword(keywords::Const)?; let name = self.parse_ident()?; self.expect(&token::Colon)?; @@ -5106,7 +5280,7 @@ impl<'a> Parser<'a> { } } - /// Parse trait Foo { ... } + /// Parse `trait Foo { ... }` or `trait Foo = Bar;` fn parse_item_trait(&mut self, is_auto: IsAuto, unsafety: Unsafety) -> PResult<'a, ItemInfo> { let ident = self.parse_ident()?; let mut tps = self.parse_generics()?; @@ -5118,23 +5292,34 @@ impl<'a> Parser<'a> { Vec::new() }; - tps.where_clause = self.parse_where_clause()?; - - self.expect(&token::OpenDelim(token::Brace))?; - let mut trait_items = vec![]; - while !self.eat(&token::CloseDelim(token::Brace)) { - let mut at_end = false; - match self.parse_trait_item(&mut at_end) { - Ok(item) => trait_items.push(item), - Err(mut e) => { - e.emit(); - if !at_end { - self.recover_stmt_(SemiColonMode::Break, BlockMode::Break); + if self.eat(&token::Eq) { + // it's a trait alias + let bounds = self.parse_ty_param_bounds()?; + tps.where_clause = self.parse_where_clause()?; + self.expect(&token::Semi)?; + if unsafety != Unsafety::Normal { + self.span_err(self.prev_span, "trait aliases cannot be unsafe"); + } + Ok((ident, ItemKind::TraitAlias(tps, bounds), None)) + } else { + // it's a normal trait + tps.where_clause = self.parse_where_clause()?; + self.expect(&token::OpenDelim(token::Brace))?; + let mut trait_items = vec![]; + while !self.eat(&token::CloseDelim(token::Brace)) { + let mut at_end = false; + match self.parse_trait_item(&mut at_end) { + Ok(item) => trait_items.push(item), + Err(mut e) => { + e.emit(); + if !at_end { + self.recover_stmt_(SemiColonMode::Break, BlockMode::Break); + } } } } + Ok((ident, ItemKind::Trait(is_auto, unsafety, tps, bounds, trait_items), None)) } - Ok((ident, ItemKind::Trait(is_auto, unsafety, tps, bounds, trait_items), None)) } /// Parses items implementations variants @@ -5231,16 +5416,24 @@ impl<'a> Parser<'a> { } } - fn parse_late_bound_lifetime_defs(&mut self) -> PResult<'a, Vec> { + fn parse_late_bound_lifetime_defs(&mut self) -> PResult<'a, Vec> { if self.eat_keyword(keywords::For) { self.expect_lt()?; - let (lifetime_defs, ty_params) = self.parse_generic_params()?; + let params = self.parse_generic_params()?; self.expect_gt()?; - if !ty_params.is_empty() { - self.span_err(ty_params[0].span, - "only lifetime parameters can be used in this context"); + + let first_non_lifetime_param_span = params.iter() + .filter_map(|param| match *param { + ast::GenericParam::Lifetime(_) => None, + ast::GenericParam::Type(ref t) => Some(t.span), + }) + .next(); + + if let Some(span) = first_non_lifetime_param_span { + self.span_err(span, "only lifetime parameters can be used in this context"); } - Ok(lifetime_defs) + + Ok(params) } else { Ok(Vec::new()) } @@ -5316,18 +5509,45 @@ impl<'a> Parser<'a> { Ok((class_name, ItemKind::Union(vdata, generics), None)) } + fn consume_block(&mut self, delim: token::DelimToken) { + let mut brace_depth = 0; + if !self.eat(&token::OpenDelim(delim)) { + return; + } + loop { + if self.eat(&token::OpenDelim(delim)) { + brace_depth += 1; + } else if self.eat(&token::CloseDelim(delim)) { + if brace_depth == 0 { + return; + } else { + brace_depth -= 1; + continue; + } + } else if self.eat(&token::Eof) || self.eat(&token::CloseDelim(token::NoDelim)) { + return; + } else { + self.bump(); + } + } + } + pub fn parse_record_struct_body(&mut self) -> PResult<'a, Vec> { let mut fields = Vec::new(); if self.eat(&token::OpenDelim(token::Brace)) { while self.token != token::CloseDelim(token::Brace) { - fields.push(self.parse_struct_decl_field().map_err(|e| { + let field = self.parse_struct_decl_field().map_err(|e| { self.recover_stmt(); - self.eat(&token::CloseDelim(token::Brace)); e - })?); + }); + match field { + Ok(field) => fields.push(field), + Err(mut err) => { + err.emit(); + } + } } - - self.bump(); + self.eat(&token::CloseDelim(token::Brace)); } else { let token_str = self.this_token_to_string(); return Err(self.fatal(&format!("expected `where`, or `{{` after struct \ @@ -5375,8 +5595,15 @@ impl<'a> Parser<'a> { self.bump(); } token::CloseDelim(token::Brace) => {} - token::DocComment(_) => return Err(self.span_fatal_err(self.span, - Error::UselessDocComment)), + token::DocComment(_) => { + let mut err = self.span_fatal_err(self.span, Error::UselessDocComment); + self.bump(); // consume the doc comment + if self.eat(&token::Comma) || self.token == token::CloseDelim(token::Brace) { + err.emit(); + } else { + return Err(err); + } + } _ => return Err(self.span_fatal_help(self.span, &format!("expected `,`, or `}}`, found `{}`", self.this_token_to_string()), "struct fields should be separated by commas")), @@ -5399,7 +5626,9 @@ impl<'a> Parser<'a> { pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibility> { maybe_whole!(self, NtVis, |x| x); - if self.eat_keyword(keywords::Crate) { + self.expected_tokens.push(TokenType::Keyword(keywords::Crate)); + if self.is_crate_vis() { + self.bump(); // `crate` return Ok(Visibility::Crate(self.prev_span, CrateSugar::JustCrate)); } @@ -5475,7 +5704,12 @@ impl<'a> Parser<'a> { if !self.eat(term) { let token_str = self.this_token_to_string(); - return Err(self.fatal(&format!("expected item, found `{}`", token_str))); + let mut err = self.fatal(&format!("expected item, found `{}`", token_str)); + let msg = "consider removing this semicolon"; + if token_str == ";" { + err.span_suggestion_short(self.span, msg, "".to_string()); + } + return Err(err); } let hi = if self.span == syntax_pos::DUMMY_SP { @@ -5561,7 +5795,7 @@ impl<'a> Parser<'a> { fn push_directory(&mut self, id: Ident, attrs: &[Attribute]) { if let Some(path) = attr::first_attr_value_str_by_name(attrs, "path") { self.directory.path.push(&path.as_str()); - self.directory.ownership = DirectoryOwnership::Owned; + self.directory.ownership = DirectoryOwnership::Owned { relative: None }; } else { self.directory.path.push(&id.name.as_str()); } @@ -5572,10 +5806,28 @@ impl<'a> Parser<'a> { } /// Returns either a path to a module, or . - pub fn default_submod_path(id: ast::Ident, dir_path: &Path, codemap: &CodeMap) -> ModulePath { + pub fn default_submod_path( + id: ast::Ident, + relative: Option, + dir_path: &Path, + codemap: &CodeMap) -> ModulePath + { + // If we're in a foo.rs file instead of a mod.rs file, + // we need to look for submodules in + // `./foo/.rs` and `./foo//mod.rs` rather than + // `./.rs` and `.//mod.rs`. + let relative_prefix_string; + let relative_prefix = if let Some(ident) = relative { + relative_prefix_string = format!("{}{}", ident.name.as_str(), path::MAIN_SEPARATOR); + &relative_prefix_string + } else { + "" + }; + let mod_name = id.to_string(); - let default_path_str = format!("{}.rs", mod_name); - let secondary_path_str = format!("{}{}mod.rs", mod_name, path::MAIN_SEPARATOR); + let default_path_str = format!("{}{}.rs", relative_prefix, mod_name); + let secondary_path_str = format!("{}{}{}mod.rs", + relative_prefix, mod_name, path::MAIN_SEPARATOR); let default_path = dir_path.join(&default_path_str); let secondary_path = dir_path.join(&secondary_path_str); let default_exists = codemap.file_exists(&default_path); @@ -5584,12 +5836,16 @@ impl<'a> Parser<'a> { let result = match (default_exists, secondary_exists) { (true, false) => Ok(ModulePathSuccess { path: default_path, - directory_ownership: DirectoryOwnership::UnownedViaMod(false), + directory_ownership: DirectoryOwnership::Owned { + relative: Some(id), + }, warn: false, }), (false, true) => Ok(ModulePathSuccess { path: secondary_path, - directory_ownership: DirectoryOwnership::Owned, + directory_ownership: DirectoryOwnership::Owned { + relative: None, + }, warn: false, }), (false, false) => Err(Error::FileNotFoundForModule { @@ -5620,7 +5876,14 @@ impl<'a> Parser<'a> { if let Some(path) = Parser::submod_path_from_attr(outer_attrs, &self.directory.path) { return Ok(ModulePathSuccess { directory_ownership: match path.file_name().and_then(|s| s.to_str()) { - Some("mod.rs") => DirectoryOwnership::Owned, + // All `#[path]` files are treated as though they are a `mod.rs` file. + // This means that `mod foo;` declarations inside `#[path]`-included + // files are siblings, + // + // Note that this will produce weirdness when a file named `foo.rs` is + // `#[path]` included and contains a `mod foo;` declaration. + // If you encounter this, it's your own darn fault :P + Some(_) => DirectoryOwnership::Owned { relative: None }, _ => DirectoryOwnership::UnownedViaMod(true), }, path, @@ -5628,47 +5891,69 @@ impl<'a> Parser<'a> { }); } - let paths = Parser::default_submod_path(id, &self.directory.path, self.sess.codemap()); + let relative = match self.directory.ownership { + DirectoryOwnership::Owned { relative } => { + // Push the usage onto the list of non-mod.rs mod uses. + // This is used later for feature-gate error reporting. + if let Some(cur_file_ident) = relative { + self.sess + .non_modrs_mods.borrow_mut() + .push((cur_file_ident, id_sp)); + } + relative + }, + DirectoryOwnership::UnownedViaBlock | + DirectoryOwnership::UnownedViaMod(_) => None, + }; + let paths = Parser::default_submod_path( + id, relative, &self.directory.path, self.sess.codemap()); - if let DirectoryOwnership::UnownedViaBlock = self.directory.ownership { - let msg = - "Cannot declare a non-inline module inside a block unless it has a path attribute"; - let mut err = self.diagnostic().struct_span_err(id_sp, msg); - if paths.path_exists { - let msg = format!("Maybe `use` the module `{}` instead of redeclaring it", - paths.name); - err.span_note(id_sp, &msg); - } - Err(err) - } else if let DirectoryOwnership::UnownedViaMod(warn) = self.directory.ownership { - if warn { - if let Ok(result) = paths.result { - return Ok(ModulePathSuccess { warn: true, ..result }); + match self.directory.ownership { + DirectoryOwnership::Owned { .. } => { + paths.result.map_err(|err| self.span_fatal_err(id_sp, err)) + }, + DirectoryOwnership::UnownedViaBlock => { + let msg = + "Cannot declare a non-inline module inside a block \ + unless it has a path attribute"; + let mut err = self.diagnostic().struct_span_err(id_sp, msg); + if paths.path_exists { + let msg = format!("Maybe `use` the module `{}` instead of redeclaring it", + paths.name); + err.span_note(id_sp, &msg); } + Err(err) } - let mut err = self.diagnostic().struct_span_err(id_sp, - "cannot declare a new module at this location"); - if id_sp != syntax_pos::DUMMY_SP { - let src_path = PathBuf::from(self.sess.codemap().span_to_filename(id_sp)); - if let Some(stem) = src_path.file_stem() { - let mut dest_path = src_path.clone(); - dest_path.set_file_name(stem); - dest_path.push("mod.rs"); + DirectoryOwnership::UnownedViaMod(warn) => { + if warn { + if let Ok(result) = paths.result { + return Ok(ModulePathSuccess { warn: true, ..result }); + } + } + let mut err = self.diagnostic().struct_span_err(id_sp, + "cannot declare a new module at this location"); + if id_sp != syntax_pos::DUMMY_SP { + let src_path = self.sess.codemap().span_to_filename(id_sp); + if let FileName::Real(src_path) = src_path { + if let Some(stem) = src_path.file_stem() { + let mut dest_path = src_path.clone(); + dest_path.set_file_name(stem); + dest_path.push("mod.rs"); + err.span_note(id_sp, + &format!("maybe move this module `{}` to its own \ + directory via `{}`", src_path.display(), + dest_path.display())); + } + } + } + if paths.path_exists { err.span_note(id_sp, - &format!("maybe move this module `{}` to its own \ - directory via `{}`", src_path.to_string_lossy(), - dest_path.to_string_lossy())); + &format!("... or maybe `use` the module `{}` instead \ + of possibly redeclaring it", + paths.name)); } + Err(err) } - if paths.path_exists { - err.span_note(id_sp, - &format!("... or maybe `use` the module `{}` instead \ - of possibly redeclaring it", - paths.name)); - } - Err(err) - } else { - paths.result.map_err(|err| self.span_fatal_err(id_sp, err)) } } @@ -5880,7 +6165,7 @@ impl<'a> Parser<'a> { match any_disr { Some(disr_span) if !all_nullary => self.span_err(disr_span, - "discriminator values can only be used with a c-like enum"), + "discriminator values can only be used with a field-less enum"), _ => () } @@ -5935,7 +6220,7 @@ impl<'a> Parser<'a> { fn parse_item_(&mut self, attrs: Vec, macros_allowed: bool, attributes_allowed: bool) -> PResult<'a, Option>> { maybe_whole!(self, NtItem, |item| { - let mut item = item.unwrap(); + let mut item = item.into_inner(); let mut attrs = attrs; mem::swap(&mut item.attrs, &mut attrs); item.attrs.extend(attrs); @@ -5948,7 +6233,7 @@ impl<'a> Parser<'a> { if self.eat_keyword(keywords::Use) { // USE ITEM - let item_ = ItemKind::Use(self.parse_view_path()?); + let item_ = ItemKind::Use(P(self.parse_use_tree(false)?)); self.expect(&token::Semi)?; let prev_span = self.prev_span; @@ -6225,7 +6510,65 @@ impl<'a> Parser<'a> { return Ok(Some(macro_def)); } - self.parse_macro_use_or_failure(attrs,macros_allowed,attributes_allowed,lo,visibility) + // Verify wether we have encountered a struct or method definition where the user forgot to + // add the `struct` or `fn` keyword after writing `pub`: `pub S {}` + if visibility == Visibility::Public && + self.check_ident() && + self.look_ahead(1, |t| *t != token::Not) + { + // Space between `pub` keyword and the identifier + // + // pub S {} + // ^^^ `sp` points here + let sp = self.prev_span.between(self.span); + let full_sp = self.prev_span.to(self.span); + let ident_sp = self.span; + if self.look_ahead(1, |t| *t == token::OpenDelim(token::Brace)) { + // possible public struct definition where `struct` was forgotten + let ident = self.parse_ident().unwrap(); + let msg = format!("add `struct` here to parse `{}` as a public struct", + ident); + let mut err = self.diagnostic() + .struct_span_err(sp, "missing `struct` for struct definition"); + err.span_suggestion_short(sp, &msg, " struct ".into()); + return Err(err); + } else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) { + let ident = self.parse_ident().unwrap(); + self.consume_block(token::Paren); + let (kw, kw_name, ambiguous) = if self.check(&token::RArrow) || + self.check(&token::OpenDelim(token::Brace)) + { + ("fn", "method", false) + } else if self.check(&token::Colon) { + let kw = "struct"; + (kw, kw, false) + } else { + ("fn` or `struct", "method or struct", true) + }; + + let msg = format!("missing `{}` for {} definition", kw, kw_name); + let mut err = self.diagnostic().struct_span_err(sp, &msg); + if !ambiguous { + let suggestion = format!("add `{}` here to parse `{}` as a public {}", + kw, + ident, + kw_name); + err.span_suggestion_short(sp, &suggestion, format!(" {} ", kw)); + } else { + if let Ok(snippet) = self.sess.codemap().span_to_snippet(ident_sp) { + err.span_suggestion( + full_sp, + "if you meant to call a macro, write instead", + format!("{}!", snippet)); + } else { + err.help("if you meant to call a macro, remove the `pub` \ + and add a trailing `!` after the identifier"); + } + } + return Err(err); + } + } + self.parse_macro_use_or_failure(attrs, macros_allowed, attributes_allowed, lo, visibility) } /// Parse a foreign item. @@ -6391,74 +6734,101 @@ impl<'a> Parser<'a> { })) } - fn parse_path_list_items(&mut self) -> PResult<'a, Vec> { - self.parse_unspanned_seq(&token::OpenDelim(token::Brace), - &token::CloseDelim(token::Brace), - SeqSep::trailing_allowed(token::Comma), |this| { - let lo = this.span; - let ident = if this.eat_keyword(keywords::SelfValue) { - keywords::SelfValue.ident() + /// `{` or `::{` or `*` or `::*` + /// `::{` or `::*` (also `{` or `*` if unprefixed is true) + fn is_import_coupler(&mut self, unprefixed: bool) -> bool { + self.is_import_coupler_inner(&token::OpenDelim(token::Brace), unprefixed) || + self.is_import_coupler_inner(&token::BinOp(token::Star), unprefixed) + } + + fn is_import_coupler_inner(&mut self, token: &token::Token, unprefixed: bool) -> bool { + if self.check(&token::ModSep) { + self.look_ahead(1, |t| t == token) + } else if unprefixed { + self.check(token) + } else { + false + } + } + + /// Parse UseTree + /// + /// USE_TREE = `*` | + /// `{` USE_TREE_LIST `}` | + /// PATH `::` `*` | + /// PATH `::` `{` USE_TREE_LIST `}` | + /// PATH [`as` IDENT] + fn parse_use_tree(&mut self, nested: bool) -> PResult<'a, UseTree> { + let lo = self.span; + + let mut prefix = ast::Path { + segments: vec![], + span: lo.to(self.span), + }; + + let kind = if self.is_import_coupler(true) { + // `use *;` or `use ::*;` or `use {...};` `use ::{...};` + + // Remove the first `::` + if self.eat(&token::ModSep) { + prefix.segments.push(PathSegment::crate_root(self.prev_span)); + } else if !nested { + prefix.segments.push(PathSegment::crate_root(self.span)); + } + + if self.eat(&token::BinOp(token::Star)) { + // `use *;` + UseTreeKind::Glob + } else if self.check(&token::OpenDelim(token::Brace)) { + // `use {...};` + UseTreeKind::Nested(self.parse_use_tree_list()?) } else { - this.parse_ident()? - }; - let rename = this.parse_rename()?; - let node = ast::PathListItem_ { - name: ident, - rename, - id: ast::DUMMY_NODE_ID - }; - Ok(respan(lo.to(this.prev_span), node)) + return self.unexpected(); + } + } else { + // `use path::...;` + let mut parsed = self.parse_path(PathStyle::Mod)?; + if !nested { + parsed = parsed.default_to_global(); + } + + prefix.segments.append(&mut parsed.segments); + prefix.span = prefix.span.to(parsed.span); + + if self.eat(&token::ModSep) { + if self.eat(&token::BinOp(token::Star)) { + // `use path::*;` + UseTreeKind::Glob + } else if self.check(&token::OpenDelim(token::Brace)) { + // `use path::{...};` + UseTreeKind::Nested(self.parse_use_tree_list()?) + } else { + return self.unexpected(); + } + } else { + // `use path::foo;` or `use path::foo as bar;` + let rename = self.parse_rename()?. + unwrap_or(prefix.segments.last().unwrap().identifier); + UseTreeKind::Simple(rename) + } + }; + + Ok(UseTree { + span: lo.to(self.prev_span), + kind, + prefix, }) } - /// `::{` or `::*` - fn is_import_coupler(&mut self) -> bool { - self.check(&token::ModSep) && - self.look_ahead(1, |t| *t == token::OpenDelim(token::Brace) || - *t == token::BinOp(token::Star)) - } - - /// Matches ViewPath: - /// MOD_SEP? non_global_path - /// MOD_SEP? non_global_path as IDENT - /// MOD_SEP? non_global_path MOD_SEP STAR - /// MOD_SEP? non_global_path MOD_SEP LBRACE item_seq RBRACE - /// MOD_SEP? LBRACE item_seq RBRACE - fn parse_view_path(&mut self) -> PResult<'a, P> { - let lo = self.span; - if self.check(&token::OpenDelim(token::Brace)) || self.check(&token::BinOp(token::Star)) || - self.is_import_coupler() { - // `{foo, bar}`, `::{foo, bar}`, `*`, or `::*`. - self.eat(&token::ModSep); - let prefix = ast::Path { - segments: vec![PathSegment::crate_root(lo)], - span: lo.to(self.span), - }; - let view_path_kind = if self.eat(&token::BinOp(token::Star)) { - ViewPathGlob(prefix) - } else { - ViewPathList(prefix, self.parse_path_list_items()?) - }; - Ok(P(respan(lo.to(self.span), view_path_kind))) - } else { - let prefix = self.parse_path(PathStyle::Mod)?.default_to_global(); - if self.is_import_coupler() { - // `foo::bar::{a, b}` or `foo::bar::*` - self.bump(); - if self.check(&token::BinOp(token::Star)) { - self.bump(); - Ok(P(respan(lo.to(self.span), ViewPathGlob(prefix)))) - } else { - let items = self.parse_path_list_items()?; - Ok(P(respan(lo.to(self.span), ViewPathList(prefix, items)))) - } - } else { - // `foo::bar` or `foo::bar as baz` - let rename = self.parse_rename()?. - unwrap_or(prefix.segments.last().unwrap().identifier); - Ok(P(respan(lo.to(self.prev_span), ViewPathSimple(rename, prefix)))) - } - } + /// Parse UseTreeKind::Nested(list) + /// + /// USE_TREE_LIST = Ø | (USE_TREE `,`)* USE_TREE [`,`] + fn parse_use_tree_list(&mut self) -> PResult<'a, Vec<(UseTree, ast::NodeId)>> { + self.parse_unspanned_seq(&token::OpenDelim(token::Brace), + &token::CloseDelim(token::Brace), + SeqSep::trailing_allowed(token::Comma), |this| { + Ok((this.parse_use_tree(true)?, ast::DUMMY_NODE_ID)) + }) } fn parse_rename(&mut self) -> PResult<'a, Option> { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index f83343bf9a..bd4f7f9853 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -21,7 +21,7 @@ use ptr::P; use serialize::{Decodable, Decoder, Encodable, Encoder}; use symbol::keywords; use syntax::parse::parse_stream_from_source_str; -use syntax_pos::{self, Span}; +use syntax_pos::{self, Span, FileName}; use tokenstream::{TokenStream, TokenTree}; use tokenstream; @@ -251,7 +251,7 @@ impl Token { Lt | BinOp(Shl) | // associated path ModSep => true, // global path Interpolated(ref nt) => match nt.0 { - NtIdent(..) | NtTy(..) | NtPath(..) => true, + NtIdent(..) | NtTy(..) | NtPath(..) | NtLifetime(..) => true, _ => false, }, _ => false, @@ -314,12 +314,24 @@ impl Token { false } + /// Returns a lifetime with the span and a dummy id if it is a lifetime, + /// or the original lifetime if it is an interpolated lifetime, ignoring + /// the span. + pub fn lifetime(&self, span: Span) -> Option { + match *self { + Lifetime(ident) => + Some(ast::Lifetime { ident: ident, span: span, id: ast::DUMMY_NODE_ID }), + Interpolated(ref nt) => match nt.0 { + NtLifetime(lifetime) => Some(lifetime), + _ => None, + }, + _ => None, + } + } + /// Returns `true` if the token is a lifetime. pub fn is_lifetime(&self) -> bool { - match *self { - Lifetime(..) => true, - _ => false, - } + self.lifetime(syntax_pos::DUMMY_SP).is_some() } /// Returns `true` if the token is either the `mut` or `const` keyword. @@ -347,6 +359,7 @@ impl Token { Some(id) => id.name == keywords::Super.name() || id.name == keywords::SelfValue.name() || id.name == keywords::SelfType.name() || + id.name == keywords::Crate.name() || id.name == keywords::DollarCrate.name(), None => false, } @@ -485,6 +498,10 @@ impl Token { let token = Token::Ident(ident.node); tokens = Some(TokenTree::Token(ident.span, token).into()); } + Nonterminal::NtLifetime(lifetime) => { + let token = Token::Lifetime(lifetime.ident); + tokens = Some(TokenTree::Token(lifetime.span, token).into()); + } Nonterminal::NtTT(ref tt) => { tokens = Some(tt.clone().into()); } @@ -494,9 +511,8 @@ impl Token { tokens.unwrap_or_else(|| { nt.1.force(|| { // FIXME(jseyfried): Avoid this pretty-print + reparse hack - let name = "".to_owned(); let source = pprust::token_to_string(self); - parse_stream_from_source_str(name, source, sess, Some(span)) + parse_stream_from_source_str(FileName::MacroExpansion, source, sess, Some(span)) }) }) } @@ -524,6 +540,7 @@ pub enum Nonterminal { NtGenerics(ast::Generics), NtWhereClause(ast::WhereClause), NtArg(ast::Arg), + NtLifetime(ast::Lifetime), } impl fmt::Debug for Nonterminal { @@ -546,6 +563,7 @@ impl fmt::Debug for Nonterminal { NtWhereClause(..) => f.pad("NtWhereClause(..)"), NtArg(..) => f.pad("NtArg(..)"), NtVis(..) => f.pad("NtVis(..)"), + NtLifetime(..) => f.pad("NtLifetime(..)"), } } } @@ -619,10 +637,7 @@ fn prepend_attrs(sess: &ParseSess, span: syntax_pos::Span) -> Option { - let tokens = match tokens { - Some(tokens) => tokens, - None => return None, - }; + let tokens = tokens?; if attrs.len() == 0 { return Some(tokens.clone()) } @@ -631,7 +646,7 @@ fn prepend_attrs(sess: &ParseSess, assert_eq!(attr.style, ast::AttrStyle::Outer, "inner attributes should prevent cached tokens from existing"); // FIXME: Avoid this pretty-print + reparse hack as bove - let name = "".to_owned(); + let name = FileName::MacroExpansion; let source = pprust::attr_to_string(attr); let stream = parse_stream_from_source_str(name, source, sess, Some(span)); builder.push(stream); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 38627b4054..dd343a2384 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -18,6 +18,7 @@ use util::parser::{self, AssocOp, Fixity}; use attr; use codemap::{self, CodeMap}; use syntax_pos::{self, BytePos}; +use syntax_pos::hygiene::{Mark, MarkKind, SyntaxContext}; use parse::token::{self, BinOpToken, Token}; use parse::lexer::comments; use parse::{self, ParseSess}; @@ -26,7 +27,7 @@ use print::pp::Breaks::{Consistent, Inconsistent}; use ptr::P; use std_inject; use symbol::{Symbol, keywords}; -use syntax_pos::DUMMY_SP; +use syntax_pos::{DUMMY_SP, FileName}; use tokenstream::{self, TokenStream, TokenTree}; use std::ascii; @@ -86,14 +87,14 @@ pub const DEFAULT_COLUMNS: usize = 78; pub fn print_crate<'a>(cm: &'a CodeMap, sess: &ParseSess, krate: &ast::Crate, - filename: String, + filename: FileName, input: &mut Read, out: Box, ann: &'a PpAnn, is_expanded: bool) -> io::Result<()> { let mut s = State::new_from_input(cm, sess, filename, input, out, ann, is_expanded); - if is_expanded && !std_inject::injected_crate_name(krate).is_none() { + if is_expanded && !std_inject::injected_crate_name().is_none() { // We need to print `#![no_std]` (and its feature gate) so that // compiling pretty-printed source won't inject libstd again. // However we don't want these attributes in the AST because @@ -119,7 +120,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap, impl<'a> State<'a> { pub fn new_from_input(cm: &'a CodeMap, sess: &ParseSess, - filename: String, + filename: FileName, input: &mut Read, out: Box, ann: &'a PpAnn, @@ -274,10 +275,11 @@ pub fn token_to_string(tok: &Token) -> String { token::NtArm(ref e) => arm_to_string(e), token::NtImplItem(ref e) => impl_item_to_string(e), token::NtTraitItem(ref e) => trait_item_to_string(e), - token::NtGenerics(ref e) => generics_to_string(e), + token::NtGenerics(ref e) => generic_params_to_string(&e.params), token::NtWhereClause(ref e) => where_clause_to_string(e), token::NtArg(ref e) => arg_to_string(e), token::NtVis(ref e) => vis_to_string(e), + token::NtLifetime(ref e) => lifetime_to_string(e), } } } @@ -338,8 +340,8 @@ pub fn trait_item_to_string(i: &ast::TraitItem) -> String { to_string(|s| s.print_trait_item(i)) } -pub fn generics_to_string(generics: &ast::Generics) -> String { - to_string(|s| s.print_generics(generics)) +pub fn generic_params_to_string(generic_params: &[ast::GenericParam]) -> String { + to_string(|s| s.print_generic_params(generic_params)) } pub fn where_clause_to_string(i: &ast::WhereClause) -> String { @@ -734,6 +736,8 @@ pub trait PrintState<'a> { if segment.identifier.name != keywords::CrateRoot.name() && segment.identifier.name != keywords::DollarCrate.name() { self.writer().word(&segment.identifier.name.as_str())?; + } else if segment.identifier.name == keywords::DollarCrate.name() { + self.print_dollar_crate(segment.identifier.ctxt)?; } } self.writer().space()?; @@ -822,6 +826,19 @@ pub trait PrintState<'a> { } fn nbsp(&mut self) -> io::Result<()> { self.writer().word(" ") } + + fn print_dollar_crate(&mut self, mut ctxt: SyntaxContext) -> io::Result<()> { + if let Some(mark) = ctxt.adjust(Mark::root()) { + // Make a best effort to print something that complies + if mark.kind() == MarkKind::Builtin { + if let Some(name) = std_inject::injected_crate_name() { + self.writer().word("::")?; + self.writer().word(name)?; + } + } + } + Ok(()) + } } impl<'a> PrintState<'a> for State<'a> { @@ -1027,21 +1044,11 @@ impl<'a> State<'a> { self.pclose()?; } ast::TyKind::BareFn(ref f) => { - let generics = ast::Generics { - lifetimes: f.lifetimes.clone(), - ty_params: Vec::new(), - where_clause: ast::WhereClause { - id: ast::DUMMY_NODE_ID, - predicates: Vec::new(), - span: syntax_pos::DUMMY_SP, - }, - span: syntax_pos::DUMMY_SP, - }; self.print_ty_fn(f.abi, f.unsafety, &f.decl, None, - &generics)?; + &f.generic_params)?; } ast::TyKind::Path(None, ref path) => { self.print_path(path, false, 0, false)?; @@ -1050,11 +1057,11 @@ impl<'a> State<'a> { self.print_qpath(path, qself, false)? } ast::TyKind::TraitObject(ref bounds, syntax) => { - let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn " } else { "" }; + let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn" } else { "" }; self.print_bounds(prefix, &bounds[..])?; } ast::TyKind::ImplTrait(ref bounds) => { - self.print_bounds("impl ", &bounds[..])?; + self.print_bounds("impl", &bounds[..])?; } ast::TyKind::Array(ref ty, ref v) => { self.s.word("[")?; @@ -1185,9 +1192,9 @@ impl<'a> State<'a> { self.end()?; // end inner head-block self.end()?; // end outer head-block } - ast::ItemKind::Use(ref vp) => { + ast::ItemKind::Use(ref tree) => { self.head(&visibility_qualified(&item.vis, "use"))?; - self.print_view_path(vp)?; + self.print_use_tree(tree)?; self.s.word(";")?; self.end()?; // end inner head-block self.end()?; // end outer head-block @@ -1255,15 +1262,15 @@ impl<'a> State<'a> { self.s.word(&ga.asm.as_str())?; self.end()?; } - ast::ItemKind::Ty(ref ty, ref params) => { + ast::ItemKind::Ty(ref ty, ref generics) => { self.ibox(INDENT_UNIT)?; self.ibox(0)?; self.word_nbsp(&visibility_qualified(&item.vis, "type"))?; self.print_ident(item.ident)?; - self.print_generics(params)?; + self.print_generic_params(&generics.params)?; self.end()?; // end the inner ibox - self.print_where_clause(¶ms.where_clause)?; + self.print_where_clause(&generics.where_clause)?; self.s.space()?; self.word_space("=")?; self.print_type(ty)?; @@ -1313,7 +1320,7 @@ impl<'a> State<'a> { self.word_nbsp("impl")?; if generics.is_parameterized() { - self.print_generics(generics)?; + self.print_generic_params(&generics.params)?; self.s.space()?; } @@ -1345,7 +1352,7 @@ impl<'a> State<'a> { self.print_is_auto(is_auto)?; self.word_nbsp("trait")?; self.print_ident(item.ident)?; - self.print_generics(generics)?; + self.print_generic_params(&generics.params)?; let mut real_bounds = Vec::with_capacity(bounds.len()); for b in bounds.iter() { if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = *b { @@ -1365,6 +1372,28 @@ impl<'a> State<'a> { } self.bclose(item.span)?; } + ast::ItemKind::TraitAlias(ref generics, ref bounds) => { + self.head("")?; + self.print_visibility(&item.vis)?; + self.word_nbsp("trait")?; + self.print_ident(item.ident)?; + self.print_generic_params(&generics.params)?; + let mut real_bounds = Vec::with_capacity(bounds.len()); + // FIXME(durka) this seems to be some quite outdated syntax + for b in bounds.iter() { + if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = *b { + self.s.space()?; + self.word_space("for ?")?; + self.print_trait_ref(&ptr.trait_ref)?; + } else { + real_bounds.push(b.clone()); + } + } + self.nbsp()?; + self.print_bounds("=", &real_bounds[..])?; + self.print_where_clause(&generics.where_clause)?; + self.s.word(";")?; + } ast::ItemKind::Mac(codemap::Spanned { ref node, .. }) => { self.print_path(&node.path, false, 0, false)?; self.s.word("! ")?; @@ -1394,25 +1423,20 @@ impl<'a> State<'a> { self.print_path(&t.path, false, 0, false) } - fn print_formal_lifetime_list(&mut self, lifetimes: &[ast::LifetimeDef]) -> io::Result<()> { - if !lifetimes.is_empty() { - self.s.word("for<")?; - let mut comma = false; - for lifetime_def in lifetimes { - if comma { - self.word_space(",")? - } - self.print_outer_attributes_inline(&lifetime_def.attrs)?; - self.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds)?; - comma = true; - } - self.s.word(">")?; + fn print_formal_generic_params( + &mut self, + generic_params: &[ast::GenericParam] + ) -> io::Result<()> { + if !generic_params.is_empty() { + self.s.word("for")?; + self.print_generic_params(generic_params)?; + self.nbsp()?; } Ok(()) } fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) -> io::Result<()> { - self.print_formal_lifetime_list(&t.bound_lifetimes)?; + self.print_formal_generic_params(&t.bound_generic_params)?; self.print_trait_ref(&t.trait_ref) } @@ -1422,7 +1446,7 @@ impl<'a> State<'a> { visibility: &ast::Visibility) -> io::Result<()> { self.head(&visibility_qualified(visibility, "enum"))?; self.print_ident(ident)?; - self.print_generics(generics)?; + self.print_generic_params(&generics.params)?; self.print_where_clause(&generics.where_clause)?; self.s.space()?; self.print_variants(&enum_definition.variants, span) @@ -1478,7 +1502,7 @@ impl<'a> State<'a> { span: syntax_pos::Span, print_finalizer: bool) -> io::Result<()> { self.print_ident(ident)?; - self.print_generics(generics)?; + self.print_generic_params(&generics.params)?; if !struct_def.is_struct() { if struct_def.is_tuple() { self.popen()?; @@ -2411,6 +2435,8 @@ impl<'a> State<'a> { if let Some(ref parameters) = segment.parameters { self.print_path_parameters(parameters, colons_before_params)?; } + } else if segment.identifier.name == keywords::DollarCrate.name() { + self.print_dollar_crate(segment.identifier.ctxt)?; } Ok(()) } @@ -2723,7 +2749,7 @@ impl<'a> State<'a> { self.nbsp()?; self.print_ident(name)?; } - self.print_generics(generics)?; + self.print_generic_params(&generics.params)?; self.print_fn_args_and_ret(decl)?; self.print_where_clause(&generics.where_clause) } @@ -2779,30 +2805,29 @@ impl<'a> State<'a> { self.s.word(prefix)?; let mut first = true; for bound in bounds { - self.nbsp()?; + if !(first && prefix.is_empty()) { + self.nbsp()?; + } if first { first = false; } else { self.word_space("+")?; } - (match *bound { - TraitTyParamBound(ref tref, TraitBoundModifier::None) => { - self.print_poly_trait_ref(tref) + match bound { + TraitTyParamBound(tref, modifier) => { + if modifier == &TraitBoundModifier::Maybe { + self.s.word("?")?; + } + self.print_poly_trait_ref(tref)?; } - TraitTyParamBound(ref tref, TraitBoundModifier::Maybe) => { - self.s.word("?")?; - self.print_poly_trait_ref(tref) + RegionTyParamBound(lt) => { + self.print_lifetime(lt)?; } - RegionTyParamBound(ref lt) => { - self.print_lifetime(lt) - } - })? + } } - Ok(()) - } else { - Ok(()) } + Ok(()) } pub fn print_lifetime(&mut self, @@ -2830,31 +2855,23 @@ impl<'a> State<'a> { Ok(()) } - pub fn print_generics(&mut self, - generics: &ast::Generics) - -> io::Result<()> - { - let total = generics.lifetimes.len() + generics.ty_params.len(); - if total == 0 { + pub fn print_generic_params( + &mut self, + generic_params: &[ast::GenericParam] + ) -> io::Result<()> { + if generic_params.is_empty() { return Ok(()); } self.s.word("<")?; - let mut ints = Vec::new(); - for i in 0..total { - ints.push(i); - } - - self.commasep(Inconsistent, &ints[..], |s, &idx| { - if idx < generics.lifetimes.len() { - let lifetime_def = &generics.lifetimes[idx]; - s.print_outer_attributes_inline(&lifetime_def.attrs)?; - s.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds) - } else { - let idx = idx - generics.lifetimes.len(); - let param = &generics.ty_params[idx]; - s.print_ty_param(param) + self.commasep(Inconsistent, &generic_params, |s, param| { + match *param { + ast::GenericParam::Lifetime(ref lifetime_def) => { + s.print_outer_attributes_inline(&lifetime_def.attrs)?; + s.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds) + }, + ast::GenericParam::Type(ref ty_param) => s.print_ty_param(ty_param), } })?; @@ -2891,11 +2908,13 @@ impl<'a> State<'a> { } match *predicate { - ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{ref bound_lifetimes, - ref bounded_ty, - ref bounds, - ..}) => { - self.print_formal_lifetime_list(bound_lifetimes)?; + ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate { + ref bound_generic_params, + ref bounded_ty, + ref bounds, + .. + }) => { + self.print_formal_generic_params(bound_generic_params)?; self.print_type(bounded_ty)?; self.print_bounds(":", bounds)?; } @@ -2918,45 +2937,39 @@ impl<'a> State<'a> { Ok(()) } - pub fn print_view_path(&mut self, vp: &ast::ViewPath) -> io::Result<()> { - match vp.node { - ast::ViewPathSimple(ident, ref path) => { - self.print_path(path, false, 0, true)?; + pub fn print_use_tree(&mut self, tree: &ast::UseTree) -> io::Result<()> { + match tree.kind { + ast::UseTreeKind::Simple(ref ident) => { + self.print_path(&tree.prefix, false, 0, true)?; - if path.segments.last().unwrap().identifier.name != - ident.name { + if tree.prefix.segments.last().unwrap().identifier.name != ident.name { self.s.space()?; self.word_space("as")?; - self.print_ident(ident)?; + self.print_ident(*ident)?; } - - Ok(()) } - - ast::ViewPathGlob(ref path) => { - self.print_path(path, false, 0, true)?; - self.s.word("::*") + ast::UseTreeKind::Glob => { + if !tree.prefix.segments.is_empty() { + self.print_path(&tree.prefix, false, 0, true)?; + self.s.word("::")?; + } + self.s.word("*")?; } - - ast::ViewPathList(ref path, ref idents) => { - if path.segments.is_empty() { + ast::UseTreeKind::Nested(ref items) => { + if tree.prefix.segments.is_empty() { self.s.word("{")?; } else { - self.print_path(path, false, 0, true)?; + self.print_path(&tree.prefix, false, 0, true)?; self.s.word("::{")?; } - self.commasep(Inconsistent, &idents[..], |s, w| { - s.print_ident(w.node.name)?; - if let Some(ident) = w.node.rename { - s.s.space()?; - s.word_space("as")?; - s.print_ident(ident)?; - } - Ok(()) + self.commasep(Inconsistent, &items[..], |this, &(ref tree, _)| { + this.print_use_tree(tree) })?; - self.s.word("}") + self.s.word("}")?; } } + + Ok(()) } pub fn print_mutability(&mut self, @@ -3023,16 +3036,15 @@ impl<'a> State<'a> { unsafety: ast::Unsafety, decl: &ast::FnDecl, name: Option, - generics: &ast::Generics) + generic_params: &Vec) -> io::Result<()> { self.ibox(INDENT_UNIT)?; - if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() { + if !generic_params.is_empty() { self.s.word("for")?; - self.print_generics(generics)?; + self.print_generic_params(generic_params)?; } let generics = ast::Generics { - lifetimes: Vec::new(), - ty_params: Vec::new(), + params: Vec::new(), where_clause: ast::WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs index d51ff9860a..25d916af77 100644 --- a/src/libsyntax/ptr.rs +++ b/src/libsyntax/ptr.rs @@ -68,7 +68,7 @@ impl P { f(*self.ptr) } /// Equivalent to and_then(|x| x) - pub fn unwrap(self) -> T { + pub fn into_inner(self) -> T { *self.ptr } diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index 7aa94de9d3..00546400bb 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -10,10 +10,11 @@ use ast; use attr; +use std::cell::Cell; use ext::hygiene::{Mark, SyntaxContext}; use symbol::{Symbol, keywords}; use syntax_pos::{DUMMY_SP, Span}; -use codemap::{self, ExpnInfo, NameAndSpan, MacroAttribute}; +use codemap::{ExpnInfo, NameAndSpan, MacroAttribute}; use ptr::P; use tokenstream::TokenStream; @@ -34,22 +35,25 @@ fn ignored_span(sp: Span) -> Span { sp.with_ctxt(SyntaxContext::empty().apply_mark(mark)) } -pub fn injected_crate_name(krate: &ast::Crate) -> Option<&'static str> { - if attr::contains_name(&krate.attrs, "no_core") { - None - } else if attr::contains_name(&krate.attrs, "no_std") { - Some("core") - } else { - Some("std") - } +pub fn injected_crate_name() -> Option<&'static str> { + INJECTED_CRATE_NAME.with(|name| name.get()) +} + +thread_local! { + static INJECTED_CRATE_NAME: Cell> = Cell::new(None); } pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option) -> ast::Crate { - let name = match injected_crate_name(&krate) { - Some(name) => name, - None => return krate, + let name = if attr::contains_name(&krate.attrs, "no_core") { + return krate; + } else if attr::contains_name(&krate.attrs, "no_std") { + "core" + } else { + "std" }; + INJECTED_CRATE_NAME.with(|opt_name| opt_name.set(Some(name))); + let crate_name = Symbol::intern(&alt_std_name.unwrap_or_else(|| name.to_string())); krate.module.items.insert(0, P(ast::Item { @@ -75,12 +79,16 @@ pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option fold::Folder for TestHarnessGenerator<'a> { } } - let mut item = i.unwrap(); + let mut item = i.into_inner(); // We don't want to recurse into anything other than mods, since // mods or tests inside of functions will break things if let ast::ItemKind::Mod(module) = item.node { @@ -272,7 +272,7 @@ fn generate_test_harness(sess: &ParseSess, let mark = Mark::fresh(Mark::root()); - let mut cx: TestCtxt = TestCtxt { + let cx = TestCtxt { span_diagnostic: sd, ext_cx: ExtCtxt::new(sess, ExpansionConfig::default("test".to_string()), resolver), path: Vec::new(), @@ -283,7 +283,6 @@ fn generate_test_harness(sess: &ParseSess, toplevel_reexport: None, ctxt: SyntaxContext::empty().apply_mark(mark), }; - cx.ext_cx.crate_root = Some("std"); mark.set_expn_info(ExpnInfo { call_site: DUMMY_SP, @@ -364,7 +363,10 @@ fn is_bench_fn(cx: &TestCtxt, i: &ast::Item) -> bool { ast::FunctionRetTy::Ty(ref t) if t.node == ast::TyKind::Tup(vec![]) => true, _ => false }; - let tparm_cnt = generics.ty_params.len(); + let tparm_cnt = generics.params.iter() + .filter(|param| param.is_type_param()) + .count(); + // NB: inadequate check, but we're running // well before resolve, can't get too deep. input_cnt == 1 @@ -384,15 +386,15 @@ fn is_bench_fn(cx: &TestCtxt, i: &ast::Item) -> bool { } fn is_ignored(i: &ast::Item) -> bool { - i.attrs.iter().any(|attr| attr.check_name("ignore")) + attr::contains_name(&i.attrs, "ignore") } fn is_allowed_fail(i: &ast::Item) -> bool { - i.attrs.iter().any(|attr| attr.check_name("allow_fail")) + attr::contains_name(&i.attrs, "allow_fail") } fn should_panic(i: &ast::Item, cx: &TestCtxt) -> ShouldPanic { - match i.attrs.iter().find(|attr| attr.check_name("should_panic")) { + match attr::find_by_name(&i.attrs, "should_panic") { Some(attr) => { let sd = cx.span_diagnostic; if attr.is_value_str() { @@ -455,9 +457,11 @@ fn mk_std(cx: &TestCtxt) -> P { let id_test = Ident::from_str("test"); let sp = ignored_span(cx, DUMMY_SP); let (vi, vis, ident) = if cx.is_libtest { - (ast::ItemKind::Use( - P(nospan(ast::ViewPathSimple(id_test, - path_node(vec![id_test]))))), + (ast::ItemKind::Use(P(ast::UseTree { + span: DUMMY_SP, + prefix: path_node(vec![id_test]), + kind: ast::UseTreeKind::Simple(id_test), + })), ast::Visibility::Public, keywords::Invalid.ident()) } else { (ast::ItemKind::ExternCrate(None), ast::Visibility::Inherited, id_test) @@ -547,9 +551,11 @@ fn mk_test_module(cx: &mut TestCtxt) -> (P, Option>) { // building `use = __test::main` let reexport_ident = Ident::with_empty_ctxt(s); - let use_path = - nospan(ast::ViewPathSimple(reexport_ident, - path_node(vec![mod_ident, Ident::from_str("main")]))); + let use_path = ast::UseTree { + span: DUMMY_SP, + prefix: path_node(vec![mod_ident, Ident::from_str("main")]), + kind: ast::UseTreeKind::Simple(reexport_ident), + }; expander.fold_item(P(ast::Item { id: ast::DUMMY_NODE_ID, diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs index a29250ea5f..5072f2e279 100644 --- a/src/libsyntax/test_snippet.rs +++ b/src/libsyntax/test_snippet.rs @@ -16,6 +16,7 @@ use std::io::prelude::*; use std::rc::Rc; use std::str; use std::sync::{Arc, Mutex}; +use std::path::Path; use syntax_pos::{BytePos, NO_EXPANSION, Span, MultiSpan}; /// Identify a position in the text by the Nth occurrence of a string. @@ -48,7 +49,7 @@ fn test_harness(file_text: &str, span_labels: Vec, expected_output: & let output = Arc::new(Mutex::new(Vec::new())); let code_map = Rc::new(CodeMap::new(FilePathMapping::empty())); - code_map.new_filemap_and_lines("test.rs", &file_text); + code_map.new_filemap_and_lines(Path::new("test.rs"), &file_text); let primary_span = make_span(&file_text, &span_labels[0].start, &span_labels[0].end); let mut msp = MultiSpan::from_span(primary_span); diff --git a/src/libsyntax/util/lev_distance.rs b/src/libsyntax/util/lev_distance.rs index 9307f3c58d..e429791f2b 100644 --- a/src/libsyntax/util/lev_distance.rs +++ b/src/libsyntax/util/lev_distance.rs @@ -44,23 +44,45 @@ pub fn lev_distance(a: &str, b: &str) -> usize { /// To find the best match for a given string from an iterator of names /// As a loose rule to avoid the obviously incorrect suggestions, it takes /// an optional limit for the maximum allowable edit distance, which defaults -/// to one-third of the given word +/// to one-third of the given word. +/// Besides Levenshtein, we use case insensitive comparison to improve accuracy on an edge case with +/// a lower(upper)case letters mismatch. pub fn find_best_match_for_name<'a, T>(iter_names: T, lookup: &str, dist: Option) -> Option where T: Iterator { let max_dist = dist.map_or_else(|| cmp::max(lookup.len(), 3) / 3, |d| d); - iter_names + + let (case_insensitive_match, levenstein_match) = iter_names .filter_map(|&name| { let dist = lev_distance(lookup, &name.as_str()); - if dist <= max_dist { // filter the unwanted cases + if dist <= max_dist { Some((name, dist)) } else { None } }) - .min_by_key(|&(_, val)| val) // extract the tuple containing the minimum edit distance - .map(|(s, _)| s) // and return only the string + // Here we are collecting the next structure: + // (case_insensitive_match, (levenstein_match, levenstein_distance)) + .fold((None, None), |result, (candidate, dist)| { + ( + if candidate.as_str().to_uppercase() == lookup.to_uppercase() { + Some(candidate) + } else { + result.0 + }, + match result.1 { + None => Some((candidate, dist)), + Some((c, d)) => Some(if dist < d { (candidate, dist) } else { (c, d) }) + } + ) + }); + + if let Some(candidate) = case_insensitive_match { + Some(candidate) // exact case insensitive match has a higher priority + } else { + if let Some((candidate, _)) = levenstein_match { Some(candidate) } else { None } + } } #[test] diff --git a/src/libsyntax/util/node_count.rs b/src/libsyntax/util/node_count.rs index 0a5d0c2e7f..da238be85e 100644 --- a/src/libsyntax/util/node_count.rs +++ b/src/libsyntax/util/node_count.rs @@ -71,6 +71,10 @@ impl<'ast> Visitor<'ast> for NodeCounter { self.count += 1; walk_ty(self, t) } + fn visit_generic_param(&mut self, param: &GenericParam) { + self.count += 1; + walk_generic_param(self, param) + } fn visit_generics(&mut self, g: &Generics) { self.count += 1; walk_generics(self, g) @@ -121,10 +125,6 @@ impl<'ast> Visitor<'ast> for NodeCounter { self.count += 1; walk_lifetime(self, lifetime) } - fn visit_lifetime_def(&mut self, lifetime: &LifetimeDef) { - self.count += 1; - walk_lifetime_def(self, lifetime) - } fn visit_mac(&mut self, _mac: &Mac) { self.count += 1; walk_mac(self, _mac) @@ -133,9 +133,9 @@ impl<'ast> Visitor<'ast> for NodeCounter { self.count += 1; walk_path(self, path) } - fn visit_path_list_item(&mut self, prefix: &Path, item: &PathListItem) { + fn visit_use_tree(&mut self, use_tree: &UseTree, id: NodeId, _nested: bool) { self.count += 1; - walk_path_list_item(self, prefix, item) + walk_use_tree(self, use_tree, id) } fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &PathParameters) { self.count += 1; diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index d993ba14a4..42cd7c8faa 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -16,16 +16,18 @@ use parse::parser::Parser; use ptr::P; use tokenstream::TokenStream; use std::iter::Peekable; +use std::path::PathBuf; /// Map a string to tts, using a made-up filename: pub fn string_to_stream(source_str: String) -> TokenStream { let ps = ParseSess::new(FilePathMapping::empty()); - filemap_to_stream(&ps, ps.codemap().new_filemap("bogofile".to_string(), source_str), None) + filemap_to_stream(&ps, ps.codemap() + .new_filemap(PathBuf::from("bogofile").into(), source_str), None) } /// Map string to parser (via tts) pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { - new_parser_from_source_str(ps, "bogofile".to_string(), source_str) + new_parser_from_source_str(ps, PathBuf::from("bogofile").into(), source_str) } fn with_error_checking_parse<'a, T, F>(s: String, ps: &'a ParseSess, f: F) -> T where diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index c2e90f0bb1..bd68d7cf8f 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -72,6 +72,7 @@ pub trait Visitor<'ast>: Sized { fn visit_expr(&mut self, ex: &'ast Expr) { walk_expr(self, ex) } fn visit_expr_post(&mut self, _ex: &'ast Expr) { } fn visit_ty(&mut self, t: &'ast Ty) { walk_ty(self, t) } + fn visit_generic_param(&mut self, param: &'ast GenericParam) { walk_generic_param(self, param) } fn visit_generics(&mut self, g: &'ast Generics) { walk_generics(self, g) } fn visit_where_predicate(&mut self, p: &'ast WherePredicate) { walk_where_predicate(self, p) @@ -103,9 +104,6 @@ pub trait Visitor<'ast>: Sized { fn visit_lifetime(&mut self, lifetime: &'ast Lifetime) { walk_lifetime(self, lifetime) } - fn visit_lifetime_def(&mut self, lifetime: &'ast LifetimeDef) { - walk_lifetime_def(self, lifetime) - } fn visit_mac(&mut self, _mac: &'ast Mac) { panic!("visit_mac disabled by default"); // NB: see note about macros above. @@ -120,8 +118,8 @@ pub trait Visitor<'ast>: Sized { fn visit_path(&mut self, path: &'ast Path, _id: NodeId) { walk_path(self, path) } - fn visit_path_list_item(&mut self, prefix: &'ast Path, item: &'ast PathListItem) { - walk_path_list_item(self, prefix, item) + fn visit_use_tree(&mut self, use_tree: &'ast UseTree, id: NodeId, _nested: bool) { + walk_use_tree(self, use_tree, id) } fn visit_path_segment(&mut self, path_span: Span, path_segment: &'ast PathSegment) { walk_path_segment(self, path_span, path_segment) @@ -210,18 +208,12 @@ pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime visitor.visit_ident(lifetime.span, lifetime.ident); } -pub fn walk_lifetime_def<'a, V: Visitor<'a>>(visitor: &mut V, lifetime_def: &'a LifetimeDef) { - visitor.visit_lifetime(&lifetime_def.lifetime); - walk_list!(visitor, visit_lifetime, &lifetime_def.bounds); - walk_list!(visitor, visit_attribute, &*lifetime_def.attrs); -} - pub fn walk_poly_trait_ref<'a, V>(visitor: &mut V, trait_ref: &'a PolyTraitRef, _: &TraitBoundModifier) where V: Visitor<'a>, { - walk_list!(visitor, visit_lifetime_def, &trait_ref.bound_lifetimes); + walk_list!(visitor, visit_generic_param, &trait_ref.bound_generic_params); visitor.visit_trait_ref(&trait_ref.trait_ref); } @@ -236,22 +228,8 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { ItemKind::ExternCrate(opt_name) => { walk_opt_name(visitor, item.span, opt_name) } - ItemKind::Use(ref vp) => { - match vp.node { - ViewPathSimple(ident, ref path) => { - visitor.visit_ident(vp.span, ident); - visitor.visit_path(path, item.id); - } - ViewPathGlob(ref path) => { - visitor.visit_path(path, item.id); - } - ViewPathList(ref prefix, ref list) => { - visitor.visit_path(prefix, item.id); - for item in list { - visitor.visit_path_list_item(prefix, item) - } - } - } + ItemKind::Use(ref use_tree) => { + visitor.visit_use_tree(use_tree, item.id, false) } ItemKind::Static(ref typ, _, ref expr) | ItemKind::Const(ref typ, ref expr) => { @@ -305,6 +283,10 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { walk_list!(visitor, visit_ty_param_bound, bounds); walk_list!(visitor, visit_trait_item, methods); } + ItemKind::TraitAlias(ref generics, ref bounds) => { + visitor.visit_generics(generics); + walk_list!(visitor, visit_ty_param_bound, bounds); + } ItemKind::Mac(ref mac) => visitor.visit_mac(mac), ItemKind::MacroDef(ref ts) => visitor.visit_mac_def(ts, item.id), } @@ -349,7 +331,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) { } TyKind::BareFn(ref function_declaration) => { walk_fn_decl(visitor, &function_declaration.decl); - walk_list!(visitor, visit_lifetime_def, &function_declaration.lifetimes); + walk_list!(visitor, visit_generic_param, &function_declaration.generic_params); } TyKind::Path(ref maybe_qself, ref path) => { if let Some(ref qself) = *maybe_qself { @@ -381,11 +363,22 @@ pub fn walk_path<'a, V: Visitor<'a>>(visitor: &mut V, path: &'a Path) { } } -pub fn walk_path_list_item<'a, V: Visitor<'a>>(visitor: &mut V, - _prefix: &Path, - item: &'a PathListItem) { - visitor.visit_ident(item.span, item.node.name); - walk_opt_ident(visitor, item.span, item.node.rename); +pub fn walk_use_tree<'a, V: Visitor<'a>>( + visitor: &mut V, use_tree: &'a UseTree, id: NodeId, +) { + visitor.visit_path(&use_tree.prefix, id); + + match use_tree.kind { + UseTreeKind::Simple(ident) => { + visitor.visit_ident(use_tree.span, ident); + } + UseTreeKind::Glob => {}, + UseTreeKind::Nested(ref use_trees) => { + for &(ref nested_tree, nested_id) in use_trees { + visitor.visit_use_tree(nested_tree, nested_id, true); + } + } + } } pub fn walk_path_segment<'a, V: Visitor<'a>>(visitor: &mut V, @@ -498,14 +491,24 @@ pub fn walk_ty_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a TyPar } } -pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics) { - for param in &generics.ty_params { - visitor.visit_ident(param.span, param.ident); - walk_list!(visitor, visit_ty_param_bound, ¶m.bounds); - walk_list!(visitor, visit_ty, ¶m.default); - walk_list!(visitor, visit_attribute, &*param.attrs); +pub fn walk_generic_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a GenericParam) { + match *param { + GenericParam::Lifetime(ref l) => { + visitor.visit_lifetime(&l.lifetime); + walk_list!(visitor, visit_lifetime, &l.bounds); + walk_list!(visitor, visit_attribute, &*l.attrs); + } + GenericParam::Type(ref t) => { + visitor.visit_ident(t.span, t.ident); + walk_list!(visitor, visit_ty_param_bound, &t.bounds); + walk_list!(visitor, visit_ty, &t.default); + walk_list!(visitor, visit_attribute, &*t.attrs); + } } - walk_list!(visitor, visit_lifetime_def, &generics.lifetimes); +} + +pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics) { + walk_list!(visitor, visit_generic_param, &generics.params); walk_list!(visitor, visit_where_predicate, &generics.where_clause.predicates); } @@ -513,11 +516,11 @@ pub fn walk_where_predicate<'a, V: Visitor<'a>>(visitor: &mut V, predicate: &'a match *predicate { WherePredicate::BoundPredicate(WhereBoundPredicate{ref bounded_ty, ref bounds, - ref bound_lifetimes, + ref bound_generic_params, ..}) => { visitor.visit_ty(bounded_ty); walk_list!(visitor, visit_ty_param_bound, bounds); - walk_list!(visitor, visit_lifetime_def, bound_lifetimes); + walk_list!(visitor, visit_generic_param, bound_generic_params); } WherePredicate::RegionPredicate(WhereRegionPredicate{ref lifetime, ref bounds, diff --git a/src/libsyntax_ext/deriving/bounds.rs b/src/libsyntax_ext/deriving/bounds.rs index 0bc802283f..7f03001d9c 100644 --- a/src/libsyntax_ext/deriving/bounds.rs +++ b/src/libsyntax_ext/deriving/bounds.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; - use syntax::ast::MetaItem; use syntax::ext::base::{Annotatable, ExtCtxt}; use syntax_pos::Span; @@ -28,15 +28,10 @@ pub fn expand_deriving_copy(cx: &mut ExtCtxt, mitem: &MetaItem, item: &Annotatable, push: &mut FnMut(Annotatable)) { - let mut v = cx.crate_root.map(|s| vec![s]).unwrap_or(Vec::new()); - v.push("marker"); - v.push("Copy"); - let path = Path::new(v); - let trait_def = TraitDef { span, attributes: Vec::new(), - path, + path: path_std!(cx, marker::Copy), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs index 5d93c2a5f7..f23d22b0c3 100644 --- a/src/libsyntax_ext/deriving/clone.rs +++ b/src/libsyntax_ext/deriving/clone.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; @@ -44,18 +45,26 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt, match *item { Annotatable::Item(ref annitem) => { match annitem.node { - ItemKind::Struct(_, Generics { ref ty_params, .. }) | - ItemKind::Enum(_, Generics { ref ty_params, .. }) - if attr::contains_name(&annitem.attrs, "rustc_copy_clone_marker") && - ty_params.is_empty() => { - bounds = vec![]; - is_shallow = true; - substructure = combine_substructure(Box::new(|c, s, sub| { - cs_clone_shallow("Clone", c, s, sub, false) - })); + ItemKind::Struct(_, Generics { ref params, .. }) | + ItemKind::Enum(_, Generics { ref params, .. }) => { + if attr::contains_name(&annitem.attrs, "rustc_copy_clone_marker") && + !params.iter().any(|param| param.is_type_param()) + { + bounds = vec![]; + is_shallow = true; + substructure = combine_substructure(Box::new(|c, s, sub| { + cs_clone_shallow("Clone", c, s, sub, false) + })); + } else { + bounds = vec![]; + is_shallow = false; + substructure = combine_substructure(Box::new(|c, s, sub| { + cs_clone("Clone", c, s, sub) + })); + } } ItemKind::Union(..) => { - bounds = vec![Literal(path_std!(cx, core::marker::Copy))]; + bounds = vec![Literal(path_std!(cx, marker::Copy))]; is_shallow = true; substructure = combine_substructure(Box::new(|c, s, sub| { cs_clone_shallow("Clone", c, s, sub, true) @@ -79,7 +88,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt, let trait_def = TraitDef { span, attributes: Vec::new(), - path: path_std!(cx, core::clone::Clone), + path: path_std!(cx, clone::Clone), additional_bounds: bounds, generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/libsyntax_ext/deriving/cmp/eq.rs index a282ff5bd0..237c8654ed 100644 --- a/src/libsyntax_ext/deriving/cmp/eq.rs +++ b/src/libsyntax_ext/deriving/cmp/eq.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; @@ -30,7 +31,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt, let trait_def = TraitDef { span, attributes: Vec::new(), - path: path_std!(cx, core::cmp::Eq), + path: path_std!(cx, cmp::Eq), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs index 9b057aacec..1a392ac376 100644 --- a/src/libsyntax_ext/deriving/cmp/ord.rs +++ b/src/libsyntax_ext/deriving/cmp/ord.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; @@ -28,7 +29,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt, let trait_def = TraitDef { span, attributes: Vec::new(), - path: path_std!(cx, core::cmp::Ord), + path: path_std!(cx, cmp::Ord), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, @@ -38,7 +39,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt, generics: LifetimeBounds::empty(), explicit_self: borrowed_explicit_self(), args: vec![borrowed_self()], - ret_ty: Literal(path_std!(cx, core::cmp::Ordering)), + ret_ty: Literal(path_std!(cx, cmp::Ordering)), attributes: attrs, is_unsafe: false, unify_fieldless_variants: true, diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs index e635c6bebc..75db7cc1e4 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use deriving::{path_local, path_std}; use deriving::generic::*; use deriving::generic::ty::*; @@ -93,7 +94,7 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt, let trait_def = TraitDef { span, attributes: Vec::new(), - path: path_std!(cx, core::cmp::PartialEq), + path: path_std!(cx, cmp::PartialEq), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs index e7e1c10876..92183c58eb 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs @@ -10,6 +10,7 @@ pub use self::OrderingOp::*; +use deriving::{path_local, pathvec_std, path_std}; use deriving::generic::*; use deriving::generic::ty::*; @@ -45,11 +46,11 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt, } } } - let ordering_ty = Literal(path_std!(cx, core::cmp::Ordering)); - let ret_ty = Literal(Path::new_(pathvec_std!(cx, core::option::Option), + let ordering_ty = Literal(path_std!(cx, cmp::Ordering)); + let ret_ty = Literal(Path::new_(pathvec_std!(cx, option::Option), None, vec![Box::new(ordering_ty)], - true)); + PathKind::Std)); let inline = cx.meta_word(span, Symbol::intern("inline")); let attrs = vec![cx.attribute(span, inline)]; @@ -84,7 +85,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt, let trait_def = TraitDef { span, attributes: vec![], - path: path_std!(cx, core::cmp::PartialOrd), + path: path_std!(cx, cmp::PartialOrd), additional_bounds: vec![], generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs index fa5537b5d8..f375847e70 100644 --- a/src/libsyntax_ext/deriving/custom.rs +++ b/src/libsyntax_ext/deriving/custom.rs @@ -96,12 +96,18 @@ impl MultiItemModifier for ProcMacroDerive { } }; + let error_count_before = ecx.parse_sess.span_diagnostic.err_count(); __internal::set_sess(ecx, || { + let msg = "proc-macro derive produced unparseable tokens"; match __internal::token_stream_parse_items(stream) { + // fail if there have been errors emitted + Ok(_) if ecx.parse_sess.span_diagnostic.err_count() > error_count_before => { + ecx.struct_span_fatal(span, msg).emit(); + panic!(FatalError); + } Ok(new_items) => new_items.into_iter().map(Annotatable::Item).collect(), Err(_) => { // FIXME: handle this better - let msg = "proc-macro derive produced unparseable tokens"; ecx.struct_span_fatal(span, msg).emit(); panic!(FatalError); } diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs index ab6dd04520..82fc09fca6 100644 --- a/src/libsyntax_ext/deriving/debug.rs +++ b/src/libsyntax_ext/deriving/debug.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; @@ -24,13 +25,13 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt, item: &Annotatable, push: &mut FnMut(Annotatable)) { // &mut ::std::fmt::Formatter - let fmtr = Ptr(Box::new(Literal(path_std!(cx, core::fmt::Formatter))), + let fmtr = Ptr(Box::new(Literal(path_std!(cx, fmt::Formatter))), Borrowed(None, ast::Mutability::Mutable)); let trait_def = TraitDef { span, attributes: Vec::new(), - path: path_std!(cx, core::fmt::Debug), + path: path_std!(cx, fmt::Debug), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, @@ -40,7 +41,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt, generics: LifetimeBounds::empty(), explicit_self: borrowed_explicit_self(), args: vec![fmtr], - ret_ty: Literal(path_std!(cx, core::fmt::Result)), + ret_ty: Literal(path_std!(cx, fmt::Result)), attributes: Vec::new(), is_unsafe: false, unify_fieldless_variants: false, diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/libsyntax_ext/deriving/decodable.rs index 517221af1d..46dada256b 100644 --- a/src/libsyntax_ext/deriving/decodable.rs +++ b/src/libsyntax_ext/deriving/decodable.rs @@ -10,7 +10,7 @@ //! The compiler code necessary for `#[derive(Decodable)]`. See encodable.rs for more. -use deriving; +use deriving::{self, pathvec_std}; use deriving::generic::*; use deriving::generic::ty::*; use deriving::warn_if_deprecated; @@ -46,20 +46,12 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt, item: &Annotatable, push: &mut FnMut(Annotatable), krate: &'static str) { - if cx.crate_root != Some("std") { - // FIXME(#21880): lift this requirement. - cx.span_err(span, - "this trait cannot be derived with #![no_std] \ - or #![no_core]"); - return; - } - let typaram = &*deriving::hygienic_type_parameter(item, "__D"); let trait_def = TraitDef { span, attributes: Vec::new(), - path: Path::new_(vec![krate, "Decodable"], None, vec![], true), + path: Path::new_(vec![krate, "Decodable"], None, vec![], PathKind::Global), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, @@ -72,18 +64,18 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt, vec![Path::new_(vec![krate, "Decoder"], None, vec![], - true)])], + PathKind::Global)])], }, explicit_self: None, args: vec![Ptr(Box::new(Literal(Path::new_local(typaram))), Borrowed(None, Mutability::Mutable))], ret_ty: - Literal(Path::new_(pathvec_std!(cx, core::result::Result), + Literal(Path::new_(pathvec_std!(cx, result::Result), None, vec![Box::new(Self_), Box::new(Literal(Path::new_( - vec![typaram, "Error"], None, vec![], false + vec![typaram, "Error"], None, vec![], PathKind::Local )))], - true)), + PathKind::Std)), attributes: Vec::new(), is_unsafe: false, unify_fieldless_variants: false, diff --git a/src/libsyntax_ext/deriving/default.rs b/src/libsyntax_ext/deriving/default.rs index 0c8e3c3939..99e7bb4bae 100644 --- a/src/libsyntax_ext/deriving/default.rs +++ b/src/libsyntax_ext/deriving/default.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; @@ -28,7 +29,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt, let trait_def = TraitDef { span, attributes: Vec::new(), - path: path_std!(cx, core::default::Default), + path: path_std!(cx, default::Default), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs index c2c862f043..0e6e96438d 100644 --- a/src/libsyntax_ext/deriving/encodable.rs +++ b/src/libsyntax_ext/deriving/encodable.rs @@ -92,7 +92,7 @@ //! } //! ``` -use deriving; +use deriving::{self, pathvec_std}; use deriving::generic::*; use deriving::generic::ty::*; use deriving::warn_if_deprecated; @@ -127,20 +127,12 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt, item: &Annotatable, push: &mut FnMut(Annotatable), krate: &'static str) { - if cx.crate_root != Some("std") { - // FIXME(#21880): lift this requirement. - cx.span_err(span, - "this trait cannot be derived with #![no_std] \ - or #![no_core]"); - return; - } - let typaram = &*deriving::hygienic_type_parameter(item, "__S"); let trait_def = TraitDef { span, attributes: Vec::new(), - path: Path::new_(vec![krate, "Encodable"], None, vec![], true), + path: Path::new_(vec![krate, "Encodable"], None, vec![], PathKind::Global), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, @@ -150,19 +142,21 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt, name: "encode", generics: LifetimeBounds { lifetimes: Vec::new(), - bounds: vec![(typaram, - vec![Path::new_(vec![krate, "Encoder"], None, vec![], true)])] + bounds: vec![ + (typaram, + vec![Path::new_(vec![krate, "Encoder"], None, vec![], PathKind::Global)]) + ], }, explicit_self: borrowed_explicit_self(), args: vec![Ptr(Box::new(Literal(Path::new_local(typaram))), Borrowed(None, Mutability::Mutable))], ret_ty: Literal(Path::new_( - pathvec_std!(cx, core::result::Result), + pathvec_std!(cx, result::Result), None, vec![Box::new(Tuple(Vec::new())), Box::new(Literal(Path::new_( - vec![typaram, "Error"], None, vec![], false + vec![typaram, "Error"], None, vec![], PathKind::Local )))], - true + PathKind::Std )), attributes: Vec::new(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 1889704753..29f5196c9b 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -192,7 +192,9 @@ use std::collections::HashSet; use std::vec; use syntax::abi::Abi; -use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind, VariantData}; +use syntax::ast::{ + self, BinOpKind, EnumDef, Expr, GenericParam, Generics, Ident, PatKind, VariantData +}; use syntax::attr; use syntax::ext::base::{Annotatable, ExtCtxt}; use syntax::ext::build::AstBuilder; @@ -393,7 +395,7 @@ fn find_type_parameters(ty: &ast::Ty, } impl<'a> TraitDef<'a> { - pub fn expand(&self, + pub fn expand(self, cx: &mut ExtCtxt, mitem: &ast::MetaItem, item: &'a Annotatable, @@ -401,7 +403,7 @@ impl<'a> TraitDef<'a> { self.expand_ext(cx, mitem, item, push, false); } - pub fn expand_ext(&self, + pub fn expand_ext(self, cx: &mut ExtCtxt, mitem: &ast::MetaItem, item: &'a Annotatable, @@ -409,23 +411,15 @@ impl<'a> TraitDef<'a> { from_scratch: bool) { match *item { Annotatable::Item(ref item) => { - let newitem = match item.node { - ast::ItemKind::Struct(ref struct_def, ref generics) => { - self.expand_struct_def(cx, &struct_def, item.ident, generics, from_scratch) - } - ast::ItemKind::Enum(ref enum_def, ref generics) => { - self.expand_enum_def(cx, enum_def, &item.attrs, - item.ident, generics, from_scratch) - } - ast::ItemKind::Union(ref struct_def, ref generics) => { - if self.supports_unions { - self.expand_struct_def(cx, &struct_def, item.ident, - generics, from_scratch) - } else { - cx.span_err(mitem.span, - "this trait cannot be derived for unions"); - return; - } + let is_packed = item.attrs.iter().any(|attr| { + attr::find_repr_attrs(&cx.parse_sess.span_diagnostic, attr) + .contains(&attr::ReprPacked) + }); + let has_no_type_params = match item.node { + ast::ItemKind::Struct(_, ref generics) | + ast::ItemKind::Enum(_, ref generics) | + ast::ItemKind::Union(_, ref generics) => { + !generics.params.iter().any(|p| p.is_type_param()) } _ => { // Non-ADT derive is an error, but it should have been @@ -434,6 +428,39 @@ impl<'a> TraitDef<'a> { return; } }; + let is_always_copy = + attr::contains_name(&item.attrs, "rustc_copy_clone_marker") && + has_no_type_params; + let use_temporaries = is_packed && is_always_copy; + + let newitem = match item.node { + ast::ItemKind::Struct(ref struct_def, ref generics) => { + self.expand_struct_def(cx, &struct_def, item.ident, generics, from_scratch, + use_temporaries) + } + ast::ItemKind::Enum(ref enum_def, ref generics) => { + // We ignore `use_temporaries` here, because + // `repr(packed)` enums cause an error later on. + // + // This can only cause further compilation errors + // downstream in blatantly illegal code, so it + // is fine. + self.expand_enum_def(cx, enum_def, &item.attrs, + item.ident, generics, from_scratch) + } + ast::ItemKind::Union(ref struct_def, ref generics) => { + if self.supports_unions { + self.expand_struct_def(cx, &struct_def, item.ident, + generics, from_scratch, + use_temporaries) + } else { + cx.span_err(mitem.span, + "this trait cannot be derived for unions"); + return; + } + } + _ => unreachable!(), + }; // Keep the lint attributes of the previous item to control how the // generated implementations are linted let mut attrs = newitem.attrs.clone(); @@ -512,32 +539,35 @@ impl<'a> TraitDef<'a> { } }); - let Generics { mut lifetimes, mut ty_params, mut where_clause, span } = self.generics + let Generics { mut params, mut where_clause, span } = self.generics .to_generics(cx, self.span, type_ident, generics); - // Copy the lifetimes - lifetimes.extend(generics.lifetimes.iter().cloned()); + // Create the generic parameters + params.extend(generics.params.iter().map(|param| { + match *param { + ref l @ GenericParam::Lifetime(_) => l.clone(), + GenericParam::Type(ref ty_param) => { + // I don't think this can be moved out of the loop, since + // a TyParamBound requires an ast id + let mut bounds: Vec<_> = + // extra restrictions on the generics parameters to the + // type being derived upon + self.additional_bounds.iter().map(|p| { + cx.typarambound(p.to_path(cx, self.span, + type_ident, generics)) + }).collect(); - // Create the type parameters. - ty_params.extend(generics.ty_params.iter().map(|ty_param| { - // I don't think this can be moved out of the loop, since - // a TyParamBound requires an ast id - let mut bounds: Vec<_> = - // extra restrictions on the generics parameters to the type being derived upon - self.additional_bounds.iter().map(|p| { - cx.typarambound(p.to_path(cx, self.span, - type_ident, generics)) - }).collect(); + // require the current trait + bounds.push(cx.typarambound(trait_path.clone())); - // require the current trait - bounds.push(cx.typarambound(trait_path.clone())); + // also add in any bounds from the declaration + for declared_bound in ty_param.bounds.iter() { + bounds.push((*declared_bound).clone()); + } - // also add in any bounds from the declaration - for declared_bound in ty_param.bounds.iter() { - bounds.push((*declared_bound).clone()); + GenericParam::Type(cx.typaram(self.span, ty_param.ident, vec![], bounds, None)) + } } - - cx.typaram(self.span, ty_param.ident, vec![], bounds, None) })); // and similarly for where clauses @@ -546,7 +576,7 @@ impl<'a> TraitDef<'a> { ast::WherePredicate::BoundPredicate(ref wb) => { ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate { span: self.span, - bound_lifetimes: wb.bound_lifetimes.clone(), + bound_generic_params: wb.bound_generic_params.clone(), bounded_ty: wb.bounded_ty.clone(), bounds: wb.bounds.iter().cloned().collect(), }) @@ -569,49 +599,61 @@ impl<'a> TraitDef<'a> { } })); - if !ty_params.is_empty() { - let ty_param_names: Vec = ty_params.iter() - .map(|ty_param| ty_param.ident.name) - .collect(); + { + // Extra scope required here so ty_params goes out of scope before params is moved - let mut processed_field_types = HashSet::new(); - for field_ty in field_tys { - let tys = find_type_parameters(&field_ty, &ty_param_names, self.span, cx); + let mut ty_params = params.iter() + .filter_map(|param| match *param { + ast::GenericParam::Type(ref t) => Some(t), + _ => None, + }) + .peekable(); - for ty in tys { - // if we have already handled this type, skip it - if let ast::TyKind::Path(_, ref p) = ty.node { - if p.segments.len() == 1 && - ty_param_names.contains(&p.segments[0].identifier.name) || - processed_field_types.contains(&p.segments) { - continue; + if ty_params.peek().is_some() { + let ty_param_names: Vec = ty_params + .map(|ty_param| ty_param.ident.name) + .collect(); + + let mut processed_field_types = HashSet::new(); + for field_ty in field_tys { + let tys = find_type_parameters(&field_ty, &ty_param_names, self.span, cx); + + for ty in tys { + // if we have already handled this type, skip it + if let ast::TyKind::Path(_, ref p) = ty.node { + if p.segments.len() == 1 && + ty_param_names.contains(&p.segments[0].identifier.name) || + processed_field_types.contains(&p.segments) { + continue; + }; + processed_field_types.insert(p.segments.clone()); + } + let mut bounds: Vec<_> = self.additional_bounds + .iter() + .map(|p| { + cx.typarambound(p.to_path(cx, self.span, type_ident, generics)) + }) + .collect(); + + // require the current trait + bounds.push(cx.typarambound(trait_path.clone())); + + let predicate = ast::WhereBoundPredicate { + span: self.span, + bound_generic_params: Vec::new(), + bounded_ty: ty, + bounds, }; - processed_field_types.insert(p.segments.clone()); + + let predicate = ast::WherePredicate::BoundPredicate(predicate); + where_clause.predicates.push(predicate); } - let mut bounds: Vec<_> = self.additional_bounds - .iter() - .map(|p| cx.typarambound(p.to_path(cx, self.span, type_ident, generics))) - .collect(); - - // require the current trait - bounds.push(cx.typarambound(trait_path.clone())); - - let predicate = ast::WhereBoundPredicate { - span: self.span, - bound_lifetimes: vec![], - bounded_ty: ty, - bounds, - }; - - let predicate = ast::WherePredicate::BoundPredicate(predicate); - where_clause.predicates.push(predicate); } } } let trait_generics = Generics { - lifetimes, - ty_params, + params, where_clause, span, }; @@ -620,14 +662,21 @@ impl<'a> TraitDef<'a> { let trait_ref = cx.trait_ref(trait_path); // Create the type parameters on the `self` path. - let self_ty_params = generics.ty_params + let self_ty_params = generics.params .iter() - .map(|ty_param| cx.ty_ident(self.span, ty_param.ident)) + .filter_map(|param| match *param { + GenericParam::Type(ref ty_param) + => Some(cx.ty_ident(self.span, ty_param.ident)), + _ => None, + }) .collect(); - let self_lifetimes: Vec = generics.lifetimes + let self_lifetimes: Vec = generics.params .iter() - .map(|ld| ld.lifetime) + .filter_map(|param| match *param { + GenericParam::Lifetime(ref ld) => Some(ld.lifetime), + _ => None, + }) .collect(); // Create the type of `self`. @@ -675,7 +724,8 @@ impl<'a> TraitDef<'a> { struct_def: &'a VariantData, type_ident: Ident, generics: &Generics, - from_scratch: bool) + from_scratch: bool, + use_temporaries: bool) -> P { let field_tys: Vec> = struct_def.fields() .iter() @@ -701,7 +751,8 @@ impl<'a> TraitDef<'a> { struct_def, type_ident, &self_args[..], - &nonself_args[..]) + &nonself_args[..], + use_temporaries) }; method_def.create_method(cx, @@ -958,6 +1009,22 @@ impl<'a> MethodDef<'a> { /// } /// } /// } + /// + /// // or if A is repr(packed) - note fields are matched by-value + /// // instead of by-reference. + /// impl PartialEq for A { + /// fn eq(&self, __arg_1: &A) -> bool { + /// match *self { + /// A {x: __self_0_0, y: __self_0_1} => { + /// match __arg_1 { + /// A {x: __self_1_0, y: __self_1_1} => { + /// __self_0_0.eq(&__self_1_0) && __self_0_1.eq(&__self_1_1) + /// } + /// } + /// } + /// } + /// } + /// } /// ``` fn expand_struct_method_body<'b>(&self, cx: &mut ExtCtxt, @@ -965,7 +1032,8 @@ impl<'a> MethodDef<'a> { struct_def: &'b VariantData, type_ident: Ident, self_args: &[P], - nonself_args: &[P]) + nonself_args: &[P], + use_temporaries: bool) -> P { let mut raw_fields = Vec::new(); // Vec<[fields of self], @@ -977,7 +1045,8 @@ impl<'a> MethodDef<'a> { struct_path, struct_def, &format!("__self_{}", i), - ast::Mutability::Immutable); + ast::Mutability::Immutable, + use_temporaries); patterns.push(pat); raw_fields.push(ident_expr); } @@ -1140,7 +1209,6 @@ impl<'a> MethodDef<'a> { self_args: Vec>, nonself_args: &[P]) -> P { - let sp = trait_.span; let variants = &enum_def.variants; @@ -1512,12 +1580,18 @@ impl<'a> TraitDef<'a> { fn create_subpatterns(&self, cx: &mut ExtCtxt, field_paths: Vec, - mutbl: ast::Mutability) + mutbl: ast::Mutability, + use_temporaries: bool) -> Vec> { field_paths.iter() .map(|path| { + let binding_mode = if use_temporaries { + ast::BindingMode::ByValue(ast::Mutability::Immutable) + } else { + ast::BindingMode::ByRef(mutbl) + }; cx.pat(path.span, - PatKind::Ident(ast::BindingMode::ByRef(mutbl), (*path).clone(), None)) + PatKind::Ident(binding_mode, (*path).clone(), None)) }) .collect() } @@ -1528,8 +1602,10 @@ impl<'a> TraitDef<'a> { struct_path: ast::Path, struct_def: &'a VariantData, prefix: &str, - mutbl: ast::Mutability) - -> (P, Vec<(Span, Option, P, &'a [ast::Attribute])>) { + mutbl: ast::Mutability, + use_temporaries: bool) + -> (P, Vec<(Span, Option, P, &'a [ast::Attribute])>) + { let mut paths = Vec::new(); let mut ident_exprs = Vec::new(); for (i, struct_field) in struct_def.fields().iter().enumerate() { @@ -1539,12 +1615,18 @@ impl<'a> TraitDef<'a> { span: sp, node: ident, }); - let val = cx.expr_deref(sp, cx.expr_path(cx.path_ident(sp, ident))); + let val = cx.expr_path(cx.path_ident(sp, ident)); + let val = if use_temporaries { + val + } else { + cx.expr_deref(sp, val) + }; let val = cx.expr(sp, ast::ExprKind::Paren(val)); + ident_exprs.push((sp, struct_field.ident, val, &struct_field.attrs[..])); } - let subpats = self.create_subpatterns(cx, paths, mutbl); + let subpats = self.create_subpatterns(cx, paths, mutbl, use_temporaries); let pattern = match *struct_def { VariantData::Struct(..) => { let field_pats = subpats.into_iter() @@ -1588,7 +1670,9 @@ impl<'a> TraitDef<'a> { let variant_ident = variant.node.name; let sp = variant.span.with_ctxt(self.span.ctxt()); let variant_path = cx.path(sp, vec![enum_ident, variant_ident]); - self.create_struct_pattern(cx, variant_path, &variant.node.data, prefix, mutbl) + let use_temporaries = false; // enums can't be repr(packed) + self.create_struct_pattern(cx, variant_path, &variant.node.data, prefix, mutbl, + use_temporaries) } } diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/libsyntax_ext/deriving/generic/ty.rs index 47b5f40832..cc3e8b6e6b 100644 --- a/src/libsyntax_ext/deriving/generic/ty.rs +++ b/src/libsyntax_ext/deriving/generic/ty.rs @@ -15,12 +15,14 @@ pub use self::PtrTy::*; pub use self::Ty::*; use syntax::ast; -use syntax::ast::{Expr, Generics, Ident, SelfKind}; +use syntax::ast::{Expr, GenericParam, Generics, Ident, SelfKind}; use syntax::ext::base::ExtCtxt; use syntax::ext::build::AstBuilder; use syntax::codemap::respan; use syntax::ptr::P; use syntax_pos::Span; +use syntax_pos::hygiene::SyntaxContext; +use syntax_pos::symbol::keywords; /// The types of pointers #[derive(Clone, Eq, PartialEq)] @@ -36,29 +38,36 @@ pub enum PtrTy<'a> { /// for type parameters and a lifetime. #[derive(Clone, Eq, PartialEq)] pub struct Path<'a> { - pub path: Vec<&'a str>, - pub lifetime: Option<&'a str>, - pub params: Vec>>, - pub global: bool, + path: Vec<&'a str>, + lifetime: Option<&'a str>, + params: Vec>>, + kind: PathKind, +} + +#[derive(Clone, Eq, PartialEq)] +pub enum PathKind { + Local, + Global, + Std, } impl<'a> Path<'a> { pub fn new<'r>(path: Vec<&'r str>) -> Path<'r> { - Path::new_(path, None, Vec::new(), true) + Path::new_(path, None, Vec::new(), PathKind::Std) } pub fn new_local<'r>(path: &'r str) -> Path<'r> { - Path::new_(vec![path], None, Vec::new(), false) + Path::new_(vec![path], None, Vec::new(), PathKind::Local) } pub fn new_<'r>(path: Vec<&'r str>, lifetime: Option<&'r str>, params: Vec>>, - global: bool) + kind: PathKind) -> Path<'r> { Path { path, lifetime, params, - global, + kind, } } @@ -76,11 +85,20 @@ impl<'a> Path<'a> { self_ty: Ident, self_generics: &Generics) -> ast::Path { - let idents = self.path.iter().map(|s| cx.ident_of(*s)).collect(); + let mut idents = self.path.iter().map(|s| cx.ident_of(*s)).collect(); let lt = mk_lifetimes(cx, span, &self.lifetime); let tys = self.params.iter().map(|t| t.to_ty(cx, span, self_ty, self_generics)).collect(); - cx.path_all(span, self.global, idents, lt, tys, Vec::new()) + match self.kind { + PathKind::Global => cx.path_all(span, true, idents, lt, tys, Vec::new()), + PathKind::Local => cx.path_all(span, false, idents, lt, tys, Vec::new()), + PathKind::Std => { + let def_site = SyntaxContext::empty().apply_mark(cx.current_expansion.mark); + idents.insert(0, Ident { ctxt: def_site, ..keywords::DollarCrate.ident() }); + cx.path_all(span, false, idents, lt, tys, Vec::new()) + } + } + } } @@ -167,13 +185,20 @@ impl<'a> Ty<'a> { -> ast::Path { match *self { Self_ => { - let self_params = self_generics.ty_params + let self_params = self_generics.params .iter() - .map(|ty_param| cx.ty_ident(span, ty_param.ident)) + .filter_map(|param| match *param { + GenericParam::Type(ref ty_param) => Some(cx.ty_ident(span, ty_param.ident)), + _ => None, + }) .collect(); - let lifetimes = self_generics.lifetimes + + let lifetimes: Vec = self_generics.params .iter() - .map(|d| d.lifetime) + .filter_map(|param| match *param { + GenericParam::Lifetime(ref ld) => Some(ld.lifetime), + _ => None, + }) .collect(); cx.path_all(span, @@ -208,11 +233,9 @@ fn mk_ty_param(cx: &ExtCtxt, cx.typaram(span, cx.ident_of(name), attrs.to_owned(), bounds, None) } -fn mk_generics(lifetimes: Vec, ty_params: Vec, span: Span) - -> Generics { +fn mk_generics(params: Vec, span: Span) -> Generics { Generics { - lifetimes, - ty_params, + params, where_clause: ast::WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), @@ -242,26 +265,26 @@ impl<'a> LifetimeBounds<'a> { self_ty: Ident, self_generics: &Generics) -> Generics { - let lifetimes = self.lifetimes + let generic_params = self.lifetimes .iter() .map(|&(lt, ref bounds)| { let bounds = bounds.iter() .map(|b| cx.lifetime(span, Ident::from_str(b))) .collect(); - cx.lifetime_def(span, Ident::from_str(lt), vec![], bounds) + GenericParam::Lifetime(cx.lifetime_def(span, Ident::from_str(lt), vec![], bounds)) }) + .chain(self.bounds + .iter() + .map(|t| { + let (name, ref bounds) = *t; + GenericParam::Type(mk_ty_param( + cx, span, name, &[], &bounds, self_ty, self_generics + )) + }) + ) .collect(); - let ty_params = self.bounds - .iter() - .map(|t| { - match *t { - (ref name, ref bounds) => { - mk_ty_param(cx, span, *name, &[], bounds, self_ty, self_generics) - } - } - }) - .collect(); - mk_generics(lifetimes, ty_params, span) + + mk_generics(generic_params, span) } } diff --git a/src/libsyntax_ext/deriving/hash.rs b/src/libsyntax_ext/deriving/hash.rs index 6c78eea186..b192ab2527 100644 --- a/src/libsyntax_ext/deriving/hash.rs +++ b/src/libsyntax_ext/deriving/hash.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use deriving; +use deriving::{self, pathvec_std, path_std}; use deriving::generic::*; use deriving::generic::ty::*; @@ -24,7 +24,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt, item: &Annotatable, push: &mut FnMut(Annotatable)) { - let path = Path::new_(pathvec_std!(cx, core::hash::Hash), None, vec![], true); + let path = Path::new_(pathvec_std!(cx, hash::Hash), None, vec![], PathKind::Std); let typaram = &*deriving::hygienic_type_parameter(item, "__H"); @@ -41,7 +41,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt, name: "hash", generics: LifetimeBounds { lifetimes: Vec::new(), - bounds: vec![(typaram, vec![path_std!(cx, core::hash::Hasher)])], + bounds: vec![(typaram, vec![path_std!(cx, hash::Hasher)])], }, explicit_self: borrowed_explicit_self(), args: vec![Ptr(Box::new(Literal(arg)), diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs index ccf3d55023..8159893e78 100644 --- a/src/libsyntax_ext/deriving/mod.rs +++ b/src/libsyntax_ext/deriving/mod.rs @@ -19,32 +19,16 @@ use syntax::ptr::P; use syntax::symbol::Symbol; use syntax_pos::Span; -macro_rules! pathvec { - ($($x:ident)::+) => ( - vec![ $( stringify!($x) ),+ ] - ) +macro path_local($x:ident) { + generic::ty::Path::new_local(stringify!($x)) } -macro_rules! path_local { - ($x:ident) => ( - ::deriving::generic::ty::Path::new_local(stringify!($x)) - ) -} +macro pathvec_std($cx:expr, $($rest:ident)::+) {{ + vec![ $( stringify!($rest) ),+ ] +}} -macro_rules! pathvec_std { - ($cx:expr, $first:ident :: $($rest:ident)::+) => ({ - let mut v = pathvec![$($rest)::+]; - if let Some(s) = $cx.crate_root { - v.insert(0, s); - } - v - }) -} - -macro_rules! path_std { - ($($x:tt)*) => ( - ::deriving::generic::ty::Path::new( pathvec_std!( $($x)* ) ) - ) +macro path_std($($x:tt)*) { + generic::ty::Path::new( pathvec_std!( $($x)* ) ) } pub mod bounds; @@ -137,10 +121,12 @@ fn hygienic_type_parameter(item: &Annotatable, base: &str) -> String { let mut typaram = String::from(base); if let Annotatable::Item(ref item) = *item { match item.node { - ast::ItemKind::Struct(_, ast::Generics { ref ty_params, .. }) | - ast::ItemKind::Enum(_, ast::Generics { ref ty_params, .. }) => { - for ty in ty_params.iter() { - typaram.push_str(&ty.ident.name.as_str()); + ast::ItemKind::Struct(_, ast::Generics { ref params, .. }) | + ast::ItemKind::Enum(_, ast::Generics { ref params, .. }) => { + for param in params.iter() { + if let ast::GenericParam::Type(ref ty) = *param{ + typaram.push_str(&ty.ident.name.as_str()); + } } } @@ -174,5 +160,6 @@ fn call_intrinsic(cx: &ExtCtxt, id: ast::DUMMY_NODE_ID, rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated), span, + recovered: false, })) } diff --git a/src/libsyntax_ext/format_foreign.rs b/src/libsyntax_ext/format_foreign.rs index 99dae29d60..0476d7d4fc 100644 --- a/src/libsyntax_ext/format_foreign.rs +++ b/src/libsyntax_ext/format_foreign.rs @@ -8,15 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -macro_rules! try_opt { - ($e:expr) => { - match $e { - Some(v) => v, - None => return None, - } - }; -} - pub mod printf { use super::strcursor::StrCursor as Cur; @@ -173,7 +164,7 @@ pub mod printf { s.push_str("{"); if let Some(arg) = self.parameter { - try_opt!(write!(s, "{}", try_opt!(arg.checked_sub(1))).ok()); + write!(s, "{}", arg.checked_sub(1)?).ok()?; } if has_options { @@ -203,12 +194,12 @@ pub mod printf { } if let Some(width) = width { - try_opt!(width.translate(&mut s).ok()); + width.translate(&mut s).ok()?; } if let Some(precision) = precision { s.push_str("."); - try_opt!(precision.translate(&mut s).ok()); + precision.translate(&mut s).ok()?; } if let Some(type_) = type_ { @@ -277,13 +268,9 @@ pub mod printf { impl<'a> Iterator for Substitutions<'a> { type Item = Substitution<'a>; fn next(&mut self) -> Option { - match parse_next_substitution(self.s) { - Some((sub, tail)) => { - self.s = tail; - Some(sub) - }, - None => None, - } + let (sub, tail) = parse_next_substitution(self.s)?; + self.s = tail; + Some(sub) } } @@ -303,11 +290,10 @@ pub mod printf { use self::State::*; let at = { - let start = try_opt!(s.find('%')); - match s[start+1..].chars().next() { - Some('%') => return Some((Substitution::Escape, &s[start+2..])), - Some(_) => {/* fall-through */}, - None => return None, + let start = s.find('%')?; + match s[start+1..].chars().next()? { + '%' => return Some((Substitution::Escape, &s[start+2..])), + _ => {/* fall-through */}, } Cur::new_at_start(&s[start..]) @@ -335,16 +321,16 @@ pub mod printf { // Used to establish the full span at the end. let start = at; // The current position within the string. - let mut at = try_opt!(at.at_next_cp()); + let mut at = at.at_next_cp()?; // `c` is the next codepoint, `next` is a cursor after it. - let (mut c, mut next) = try_opt!(at.next_cp()); + let (mut c, mut next) = at.next_cp()?; // Update `at`, `c`, and `next`, exiting if we're out of input. macro_rules! move_to { ($cur:expr) => { { at = $cur; - let (c_, next_) = try_opt!(at.next_cp()); + let (c_, next_) = at.next_cp()?; c = c_; next = next_; } @@ -801,31 +787,27 @@ pub mod shell { /// Parse the next substitution from the input string. pub fn parse_next_substitution(s: &str) -> Option<(Substitution, &str)> { let at = { - let start = try_opt!(s.find('$')); - match s[start+1..].chars().next() { - Some('$') => return Some((Substitution::Escape, &s[start+2..])), - Some(c @ '0' ... '9') => { + let start = s.find('$')?; + match s[start+1..].chars().next()? { + '$' => return Some((Substitution::Escape, &s[start+2..])), + c @ '0' ... '9' => { let n = (c as u8) - b'0'; return Some((Substitution::Ordinal(n), &s[start+2..])); }, - Some(_) => {/* fall-through */}, - None => return None, + _ => {/* fall-through */}, } Cur::new_at_start(&s[start..]) }; - let at = try_opt!(at.at_next_cp()); - match at.next_cp() { - Some((c, inner)) => { - if !is_ident_head(c) { - None - } else { - let end = at_next_cp_while(inner, is_ident_tail); - Some((Substitution::Name(at.slice_between(end).unwrap()), end.slice_after())) - } - }, - _ => None + let at = at.at_next_cp()?; + let (c, inner) = at.next_cp()?; + + if !is_ident_head(c) { + None + } else { + let end = at_next_cp_while(inner, is_ident_tail); + Some((Substitution::Name(at.slice_between(end).unwrap()), end.slice_after())) } } @@ -946,10 +928,7 @@ mod strcursor { } pub fn next_cp(mut self) -> Option<(char, StrCursor<'a>)> { - let cp = match self.cp_after() { - Some(cp) => cp, - None => return None, - }; + let cp = self.cp_after()?; self.seek_right(cp.len_utf8()); Some((cp, self)) } diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 42bbb4ae0c..82d6ee5afa 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -16,6 +16,7 @@ #![deny(warnings)] #![feature(proc_macro_internals)] +#![feature(decl_macro)] extern crate fmt_macros; #[macro_use] diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs index a58d2c9638..8c5276e1d7 100644 --- a/src/libsyntax_ext/proc_macro_registrar.rs +++ b/src/libsyntax_ext/proc_macro_registrar.rs @@ -13,6 +13,7 @@ use std::mem; use errors; use syntax::ast::{self, Ident, NodeId}; +use syntax::attr; use syntax::codemap::{ExpnInfo, NameAndSpan, MacroAttribute}; use syntax::ext::base::ExtCtxt; use syntax::ext::build::AstBuilder; @@ -248,8 +249,7 @@ impl<'a> CollectProcMacros<'a> { impl<'a> Visitor<'a> for CollectProcMacros<'a> { fn visit_item(&mut self, item: &'a ast::Item) { if let ast::ItemKind::MacroDef(..) = item.node { - if self.is_proc_macro_crate && - item.attrs.iter().any(|attr| attr.path == "macro_export") { + if self.is_proc_macro_crate && attr::contains_name(&item.attrs, "macro_export") { let msg = "cannot export macro_rules! macros from a `proc-macro` crate type currently"; self.handler.span_err(item.span, msg); diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index 4790fa0a7e..06a9306501 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -10,10 +10,10 @@ //! Machinery for hygienic macros, inspired by the MTWT[1] paper. //! -//! [1] Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. -//! 2012. *Macros that work together: Compile-time bindings, partial expansion, +//! [1] Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. 2012. +//! *Macros that work together: Compile-time bindings, partial expansion, //! and definition contexts*. J. Funct. Program. 22, 2 (March 2012), 181-216. -//! DOI=10.1017/S0956796812000093 http://dx.doi.org/10.1017/S0956796812000093 +//! DOI=10.1017/S0956796812000093 use Span; use symbol::{Ident, Symbol}; @@ -27,7 +27,7 @@ use std::fmt; #[derive(Clone, Copy, PartialEq, Eq, Default, PartialOrd, Ord, Hash)] pub struct SyntaxContext(pub(super) u32); -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone)] pub struct SyntaxContextData { pub outer_mark: Mark, pub prev_ctxt: SyntaxContext, @@ -35,41 +35,52 @@ pub struct SyntaxContextData { } /// A mark is a unique id associated with a macro expansion. -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Default, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct Mark(u32); -#[derive(Default)] struct MarkData { parent: Mark, - modern: bool, + kind: MarkKind, expn_info: Option, } +#[derive(Copy, Clone, PartialEq, Eq)] +pub enum MarkKind { + Modern, + Builtin, + Legacy, +} + impl Mark { pub fn fresh(parent: Mark) -> Self { HygieneData::with(|data| { - data.marks.push(MarkData { parent: parent, modern: false, expn_info: None }); + data.marks.push(MarkData { parent: parent, kind: MarkKind::Legacy, expn_info: None }); Mark(data.marks.len() as u32 - 1) }) } /// The mark of the theoretical expansion that generates freshly parsed, unexpanded AST. + #[inline] pub fn root() -> Self { Mark(0) } + #[inline] pub fn as_u32(self) -> u32 { self.0 } + #[inline] pub fn from_u32(raw: u32) -> Mark { Mark(raw) } + #[inline] pub fn expn_info(self) -> Option { HygieneData::with(|data| data.marks[self.0 as usize].expn_info.clone()) } + #[inline] pub fn set_expn_info(self, info: ExpnInfo) { HygieneData::with(|data| data.marks[self.0 as usize].expn_info = Some(info)) } @@ -77,7 +88,7 @@ impl Mark { pub fn modern(mut self) -> Mark { HygieneData::with(|data| { loop { - if self == Mark::root() || data.marks[self.0 as usize].modern { + if self == Mark::root() || data.marks[self.0 as usize].kind == MarkKind::Modern { return self; } self = data.marks[self.0 as usize].parent; @@ -85,12 +96,14 @@ impl Mark { }) } - pub fn is_modern(self) -> bool { - HygieneData::with(|data| data.marks[self.0 as usize].modern) + #[inline] + pub fn kind(self) -> MarkKind { + HygieneData::with(|data| data.marks[self.0 as usize].kind) } - pub fn set_modern(self) { - HygieneData::with(|data| data.marks[self.0 as usize].modern = true) + #[inline] + pub fn set_kind(self, kind: MarkKind) { + HygieneData::with(|data| data.marks[self.0 as usize].kind = kind) } pub fn is_descendant_of(mut self, ancestor: Mark) -> bool { @@ -116,8 +129,16 @@ struct HygieneData { impl HygieneData { fn new() -> Self { HygieneData { - marks: vec![MarkData::default()], - syntax_contexts: vec![SyntaxContextData::default()], + marks: vec![MarkData { + parent: Mark::root(), + kind: MarkKind::Builtin, + expn_info: None, + }], + syntax_contexts: vec![SyntaxContextData { + outer_mark: Mark::root(), + prev_ctxt: SyntaxContext(0), + modern: SyntaxContext(0), + }], markings: HashMap::new(), gensym_to_ctxt: HashMap::new(), } @@ -140,12 +161,37 @@ impl SyntaxContext { SyntaxContext(0) } + // Allocate a new SyntaxContext with the given ExpnInfo. This is used when + // deserializing Spans from the incr. comp. cache. + // FIXME(mw): This method does not restore MarkData::parent or + // SyntaxContextData::prev_ctxt or SyntaxContextData::modern. These things + // don't seem to be used after HIR lowering, so everything should be fine + // as long as incremental compilation does not kick in before that. + pub fn allocate_directly(expansion_info: ExpnInfo) -> Self { + HygieneData::with(|data| { + data.marks.push(MarkData { + parent: Mark::root(), + kind: MarkKind::Legacy, + expn_info: Some(expansion_info) + }); + + let mark = Mark(data.marks.len() as u32 - 1); + + data.syntax_contexts.push(SyntaxContextData { + outer_mark: mark, + prev_ctxt: SyntaxContext::empty(), + modern: SyntaxContext::empty(), + }); + SyntaxContext(data.syntax_contexts.len() as u32 - 1) + }) + } + /// Extend a syntax context with a given mark pub fn apply_mark(self, mark: Mark) -> SyntaxContext { HygieneData::with(|data| { let syntax_contexts = &mut data.syntax_contexts; let mut modern = syntax_contexts[self.0 as usize].modern; - if data.marks[mark.0 as usize].modern { + if data.marks[mark.0 as usize].kind == MarkKind::Modern { modern = *data.markings.entry((modern, mark)).or_insert_with(|| { let len = syntax_contexts.len() as u32; syntax_contexts.push(SyntaxContextData { @@ -178,6 +224,7 @@ impl SyntaxContext { /// Adjust this context for resolution in a scope created by the given expansion. /// For example, consider the following three resolutions of `f`: + /// /// ```rust /// mod foo { pub fn f() {} } // `f`'s `SyntaxContext` is empty. /// m!(f); @@ -209,7 +256,8 @@ impl SyntaxContext { /// Adjust this context for resolution in a scope created by the given expansion /// via a glob import with the given `SyntaxContext`. - /// For example, + /// For example: + /// /// ```rust /// m!(f); /// macro m($i:ident) { @@ -247,6 +295,7 @@ impl SyntaxContext { } /// Undo `glob_adjust` if possible: + /// /// ```rust /// if let Some(privacy_checking_scope) = self.reverse_glob_adjust(expansion, glob_ctxt) { /// assert!(self.glob_adjust(expansion, glob_ctxt) == Some(privacy_checking_scope)); @@ -270,10 +319,12 @@ impl SyntaxContext { Some(scope) } + #[inline] pub fn modern(self) -> SyntaxContext { HygieneData::with(|data| data.syntax_contexts[self.0 as usize].modern) } + #[inline] pub fn outer(self) -> Mark { HygieneData::with(|data| data.syntax_contexts[self.0 as usize].outer_mark) } @@ -286,7 +337,7 @@ impl fmt::Debug for SyntaxContext { } /// Extra information for tracking spans of macro and syntax sugar expansion -#[derive(Clone, Hash, Debug)] +#[derive(Clone, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct ExpnInfo { /// The location of the actual macro invocation or syntax sugar , e.g. /// `let x = foo!();` or `if let Some(y) = x {}` @@ -302,7 +353,7 @@ pub struct ExpnInfo { pub callee: NameAndSpan } -#[derive(Clone, Hash, Debug)] +#[derive(Clone, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct NameAndSpan { /// The format with which the macro was invoked. pub format: ExpnFormat, @@ -330,7 +381,7 @@ impl NameAndSpan { } /// The source of expansion. -#[derive(Clone, Hash, Debug, PartialEq, Eq)] +#[derive(Clone, Hash, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub enum ExpnFormat { /// e.g. #[derive(...)] MacroAttribute(Symbol), @@ -341,7 +392,7 @@ pub enum ExpnFormat { } /// The kind of compiler desugaring. -#[derive(Clone, Hash, Debug, PartialEq, Eq)] +#[derive(Clone, Hash, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub enum CompilerDesugaringKind { BackArrow, DotFill, diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 47755dc1d5..85f0925b98 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -30,7 +30,7 @@ use std::borrow::Cow; use std::cell::{Cell, RefCell}; use std::cmp::{self, Ordering}; use std::fmt; -use std::hash::Hasher; +use std::hash::{Hasher, Hash}; use std::ops::{Add, Sub}; use std::path::PathBuf; use std::rc::Rc; @@ -54,7 +54,78 @@ pub use span_encoding::{Span, DUMMY_SP}; pub mod symbol; -pub type FileName = String; +/// Differentiates between real files and common virtual files +#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)] +pub enum FileName { + Real(PathBuf), + /// e.g. "std" macros + Macros(String), + /// call to `quote!` + QuoteExpansion, + /// Command line + Anon, + /// Hack in src/libsyntax/parse.rs + /// FIXME(jseyfried) + MacroExpansion, + ProcMacroSourceCode, + /// Strings provided as --cfg [cfgspec] stored in a crate_cfg + CfgSpec, + /// Custom sources for explicit parser calls from plugins and drivers + Custom(String), +} + +impl std::fmt::Display for FileName { + fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { + use self::FileName::*; + match *self { + Real(ref path) => write!(fmt, "{}", path.display()), + Macros(ref name) => write!(fmt, "<{} macros>", name), + QuoteExpansion => write!(fmt, ""), + MacroExpansion => write!(fmt, ""), + Anon => write!(fmt, ""), + ProcMacroSourceCode => write!(fmt, ""), + CfgSpec => write!(fmt, "cfgspec"), + Custom(ref s) => write!(fmt, "<{}>", s), + } + } +} + +impl From for FileName { + fn from(p: PathBuf) -> Self { + assert!(!p.to_string_lossy().ends_with('>')); + FileName::Real(p) + } +} + +impl FileName { + pub fn is_real(&self) -> bool { + use self::FileName::*; + match *self { + Real(_) => true, + Macros(_) | + Anon | + MacroExpansion | + ProcMacroSourceCode | + CfgSpec | + Custom(_) | + QuoteExpansion => false, + } + } + + pub fn is_macros(&self) -> bool { + use self::FileName::*; + match *self { + Real(_) | + Anon | + MacroExpansion | + ProcMacroSourceCode | + CfgSpec | + Custom(_) | + QuoteExpansion => false, + Macros(_) => true, + } + } +} /// Spans represent a region of code, used for error reporting. Positions in spans /// are *absolute* positions from the beginning of the codemap, not positions @@ -503,6 +574,8 @@ pub enum NonNarrowChar { ZeroWidth(BytePos), /// Represents a wide (fullwidth) character Wide(BytePos), + /// Represents a tab character, represented visually with a width of 4 characters + Tab(BytePos), } impl NonNarrowChar { @@ -510,6 +583,7 @@ impl NonNarrowChar { match width { 0 => NonNarrowChar::ZeroWidth(pos), 2 => NonNarrowChar::Wide(pos), + 4 => NonNarrowChar::Tab(pos), _ => panic!("width {} given for non-narrow character", width), } } @@ -518,7 +592,8 @@ impl NonNarrowChar { pub fn pos(&self) -> BytePos { match *self { NonNarrowChar::ZeroWidth(p) | - NonNarrowChar::Wide(p) => p, + NonNarrowChar::Wide(p) | + NonNarrowChar::Tab(p) => p, } } @@ -527,6 +602,7 @@ impl NonNarrowChar { match *self { NonNarrowChar::ZeroWidth(_) => 0, NonNarrowChar::Wide(_) => 2, + NonNarrowChar::Tab(_) => 4, } } } @@ -538,6 +614,7 @@ impl Add for NonNarrowChar { match self { NonNarrowChar::ZeroWidth(pos) => NonNarrowChar::ZeroWidth(pos + rhs), NonNarrowChar::Wide(pos) => NonNarrowChar::Wide(pos + rhs), + NonNarrowChar::Tab(pos) => NonNarrowChar::Tab(pos + rhs), } } } @@ -549,6 +626,7 @@ impl Sub for NonNarrowChar { match self { NonNarrowChar::ZeroWidth(pos) => NonNarrowChar::ZeroWidth(pos - rhs), NonNarrowChar::Wide(pos) => NonNarrowChar::Wide(pos - rhs), + NonNarrowChar::Tab(pos) => NonNarrowChar::Tab(pos - rhs), } } } @@ -593,7 +671,7 @@ pub struct FileMap { pub name_was_remapped: bool, /// The unmapped path of the file that the source came from. /// Set to `None` if the FileMap was imported from an external crate. - pub unmapped_path: Option, + pub unmapped_path: Option, /// Indicates which crate this FileMap was imported from. pub crate_of_origin: u32, /// The complete source code @@ -613,6 +691,8 @@ pub struct FileMap { pub multibyte_chars: RefCell>, /// Width of characters that are not narrow in the source code pub non_narrow_chars: RefCell>, + /// A hash of the filename, used for speeding up the incr. comp. hashing. + pub name_hash: u128, } impl Encodable for FileMap { @@ -620,10 +700,10 @@ impl Encodable for FileMap { s.emit_struct("FileMap", 8, |s| { s.emit_struct_field("name", 0, |s| self.name.encode(s))?; s.emit_struct_field("name_was_remapped", 1, |s| self.name_was_remapped.encode(s))?; - s.emit_struct_field("src_hash", 6, |s| self.src_hash.encode(s))?; - s.emit_struct_field("start_pos", 2, |s| self.start_pos.encode(s))?; - s.emit_struct_field("end_pos", 3, |s| self.end_pos.encode(s))?; - s.emit_struct_field("lines", 4, |s| { + s.emit_struct_field("src_hash", 2, |s| self.src_hash.encode(s))?; + s.emit_struct_field("start_pos", 4, |s| self.start_pos.encode(s))?; + s.emit_struct_field("end_pos", 5, |s| self.end_pos.encode(s))?; + s.emit_struct_field("lines", 6, |s| { let lines = self.lines.borrow(); // store the length s.emit_u32(lines.len() as u32)?; @@ -669,11 +749,14 @@ impl Encodable for FileMap { Ok(()) })?; - s.emit_struct_field("multibyte_chars", 5, |s| { + s.emit_struct_field("multibyte_chars", 7, |s| { (*self.multibyte_chars.borrow()).encode(s) })?; - s.emit_struct_field("non_narrow_chars", 7, |s| { + s.emit_struct_field("non_narrow_chars", 8, |s| { (*self.non_narrow_chars.borrow()).encode(s) + })?; + s.emit_struct_field("name_hash", 9, |s| { + self.name_hash.encode(s) }) }) } @@ -683,15 +766,15 @@ impl Decodable for FileMap { fn decode(d: &mut D) -> Result { d.read_struct("FileMap", 8, |d| { - let name: String = d.read_struct_field("name", 0, |d| Decodable::decode(d))?; + let name: FileName = d.read_struct_field("name", 0, |d| Decodable::decode(d))?; let name_was_remapped: bool = d.read_struct_field("name_was_remapped", 1, |d| Decodable::decode(d))?; let src_hash: u128 = - d.read_struct_field("src_hash", 6, |d| Decodable::decode(d))?; + d.read_struct_field("src_hash", 2, |d| Decodable::decode(d))?; let start_pos: BytePos = - d.read_struct_field("start_pos", 2, |d| Decodable::decode(d))?; - let end_pos: BytePos = d.read_struct_field("end_pos", 3, |d| Decodable::decode(d))?; - let lines: Vec = d.read_struct_field("lines", 4, |d| { + d.read_struct_field("start_pos", 4, |d| Decodable::decode(d))?; + let end_pos: BytePos = d.read_struct_field("end_pos", 5, |d| Decodable::decode(d))?; + let lines: Vec = d.read_struct_field("lines", 6, |d| { let num_lines: u32 = Decodable::decode(d)?; let mut lines = Vec::with_capacity(num_lines as usize); @@ -720,9 +803,11 @@ impl Decodable for FileMap { Ok(lines) })?; let multibyte_chars: Vec = - d.read_struct_field("multibyte_chars", 5, |d| Decodable::decode(d))?; + d.read_struct_field("multibyte_chars", 7, |d| Decodable::decode(d))?; let non_narrow_chars: Vec = - d.read_struct_field("non_narrow_chars", 7, |d| Decodable::decode(d))?; + d.read_struct_field("non_narrow_chars", 8, |d| Decodable::decode(d))?; + let name_hash: u128 = + d.read_struct_field("name_hash", 9, |d| Decodable::decode(d))?; Ok(FileMap { name, name_was_remapped, @@ -738,7 +823,8 @@ impl Decodable for FileMap { external_src: RefCell::new(ExternalSource::AbsentOk), lines: RefCell::new(lines), multibyte_chars: RefCell::new(multibyte_chars), - non_narrow_chars: RefCell::new(non_narrow_chars) + non_narrow_chars: RefCell::new(non_narrow_chars), + name_hash, }) }) } @@ -753,15 +839,21 @@ impl fmt::Debug for FileMap { impl FileMap { pub fn new(name: FileName, name_was_remapped: bool, - unmapped_path: PathBuf, + unmapped_path: FileName, mut src: String, start_pos: BytePos) -> FileMap { remove_bom(&mut src); - let mut hasher: StableHasher = StableHasher::new(); - hasher.write(src.as_bytes()); - let src_hash = hasher.finish(); - + let src_hash = { + let mut hasher: StableHasher = StableHasher::new(); + hasher.write(src.as_bytes()); + hasher.finish() + }; + let name_hash = { + let mut hasher: StableHasher = StableHasher::new(); + name.hash(&mut hasher); + hasher.finish() + }; let end_pos = start_pos.to_usize() + src.len(); FileMap { @@ -777,6 +869,7 @@ impl FileMap { lines: RefCell::new(Vec::new()), multibyte_chars: RefCell::new(Vec::new()), non_narrow_chars: RefCell::new(Vec::new()), + name_hash, } } @@ -868,8 +961,10 @@ impl FileMap { pub fn record_width(&self, pos: BytePos, ch: char) { let width = match ch { - '\t' | '\n' => - // Tabs will consume one column. + '\t' => + // Tabs will consume 4 columns. + 4, + '\n' => // Make newlines take one column so that displayed spans can point them. 1, ch => @@ -884,8 +979,7 @@ impl FileMap { } pub fn is_real_file(&self) -> bool { - !(self.name.starts_with("<") && - self.name.ends_with(">")) + self.name.is_real() } pub fn is_imported(&self) -> bool { @@ -931,6 +1025,11 @@ impl FileMap { (lines[line_index], lines[line_index + 1]) } } + + #[inline] + pub fn contains(&self, byte_pos: BytePos) -> bool { + byte_pos >= self.start_pos && byte_pos <= self.end_pos + } } /// Remove utf-8 BOM if any. @@ -1100,18 +1199,18 @@ pub enum SpanSnippetError { IllFormedSpan(Span), DistinctSources(DistinctSources), MalformedForCodemap(MalformedCodemapPositions), - SourceNotAvailable { filename: String } + SourceNotAvailable { filename: FileName } } #[derive(Clone, PartialEq, Eq, Debug)] pub struct DistinctSources { - pub begin: (String, BytePos), - pub end: (String, BytePos) + pub begin: (FileName, BytePos), + pub end: (FileName, BytePos) } #[derive(Clone, PartialEq, Eq, Debug)] pub struct MalformedCodemapPositions { - pub name: String, + pub name: FileName, pub source_len: usize, pub begin_pos: BytePos, pub end_pos: BytePos diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 69ddd56021..aafdd696b7 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -35,6 +35,10 @@ impl Ident { Ident::with_empty_ctxt(Symbol::intern(string)) } + pub fn without_first_quote(&self) -> Ident { + Ident { name: Symbol::from(self.name.as_str().trim_left_matches('\'')), ctxt: self.ctxt } + } + pub fn modern(self) -> Ident { Ident { name: self.name, ctxt: self.ctxt.modern() } } @@ -123,7 +127,12 @@ impl<'a> From<&'a str> for Symbol { impl fmt::Debug for Symbol { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}({})", self, self.0) + let is_gensymed = with_interner(|interner| interner.is_gensymed(*self)); + if is_gensymed { + write!(f, "{}({})", self, self.0) + } else { + write!(f, "{}", self) + } } } @@ -201,6 +210,10 @@ impl Interner { Symbol(!0 - self.gensyms.len() as u32 + 1) } + fn is_gensymed(&mut self, symbol: Symbol) -> bool { + symbol.0 as usize >= self.strings.len() + } + pub fn get(&self, symbol: Symbol) -> &str { match self.strings.get(symbol.0 as usize) { Some(ref string) => string, @@ -428,4 +441,10 @@ mod tests { // gensym of *existing* string gets new number: assert_eq!(i.gensym("dog"), Symbol(4294967293)); } + + #[test] + fn without_first_quote_test() { + let i = Ident::from_str("'break"); + assert_eq!(i.without_first_quote().name, keywords::Break.name()); + } } diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index c9bde8b7b3..492d26e625 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -20,10 +20,7 @@ use std::path::PathBuf; #[allow(deprecated)] pub fn get_dbpath_for_term(term: &str) -> Option { let mut dirs_to_search = Vec::new(); - let first_char = match term.chars().next() { - Some(c) => c, - None => return None, - }; + let first_char = term.chars().next()?; // Find search directory if let Some(dir) = env::var_os("TERMINFO") { diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index ef08b87726..0d837c470a 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -35,6 +35,7 @@ #![deny(warnings)] #![feature(asm)] +#![feature(fnbox)] #![cfg_attr(unix, feature(libc))] #![feature(set_stdio)] #![feature(panic_unwind)] @@ -56,6 +57,7 @@ use self::OutputLocation::*; use std::panic::{catch_unwind, AssertUnwindSafe}; use std::any::Any; +use std::boxed::FnBox; use std::cmp; use std::collections::BTreeMap; use std::env; @@ -133,16 +135,6 @@ pub trait TDynBenchFn: Send { fn run(&self, harness: &mut Bencher); } -pub trait FnBox: Send + 'static { - fn call_box(self: Box, t: T); -} - -impl FnBox for F { - fn call_box(self: Box, t: T) { - (*self)(t) - } -} - // A function that runs a test. If the function returns successfully, // the test succeeds; if the function panics then the test fails. We // may need to come up with a more clever definition of test in order @@ -150,9 +142,7 @@ impl FnBox for F { pub enum TestFn { StaticTestFn(fn()), StaticBenchFn(fn(&mut Bencher)), - StaticMetricFn(fn(&mut MetricMap)), - DynTestFn(Box>), - DynMetricFn(Box FnBox<&'a mut MetricMap>>), + DynTestFn(Box), DynBenchFn(Box), } @@ -161,9 +151,7 @@ impl TestFn { match *self { StaticTestFn(..) => PadNone, StaticBenchFn(..) => PadOnRight, - StaticMetricFn(..) => PadOnRight, DynTestFn(..) => PadNone, - DynMetricFn(..) => PadOnRight, DynBenchFn(..) => PadOnRight, } } @@ -174,9 +162,7 @@ impl fmt::Debug for TestFn { f.write_str(match *self { StaticTestFn(..) => "StaticTestFn(..)", StaticBenchFn(..) => "StaticBenchFn(..)", - StaticMetricFn(..) => "StaticMetricFn(..)", DynTestFn(..) => "DynTestFn(..)", - DynMetricFn(..) => "DynMetricFn(..)", DynBenchFn(..) => "DynBenchFn(..)", }) } @@ -245,16 +231,6 @@ impl Metric { } } -#[derive(PartialEq)] -pub struct MetricMap(BTreeMap); - -impl Clone for MetricMap { - fn clone(&self) -> MetricMap { - let MetricMap(ref map) = *self; - MetricMap(map.clone()) - } -} - /// In case we want to add other options as well, just add them in this struct. #[derive(Copy, Clone, Debug)] pub struct Options { @@ -528,7 +504,6 @@ pub enum TestResult { TrFailedMsg(String), TrIgnored, TrAllowedFail, - TrMetrics(MetricMap), TrBench(BenchSamples), } @@ -605,10 +580,6 @@ impl ConsoleTestState { self.write_short_result("FAILED (allowed)", "a", term::color::YELLOW) } - pub fn write_metric(&mut self) -> io::Result<()> { - self.write_pretty("metric", term::color::CYAN) - } - pub fn write_bench(&mut self) -> io::Result<()> { self.write_pretty("bench", term::color::CYAN) } @@ -688,10 +659,6 @@ impl ConsoleTestState { TrFailed | TrFailedMsg(_) => self.write_failed(), TrIgnored => self.write_ignored(), TrAllowedFail => self.write_allowed_fail(), - TrMetrics(ref mm) => { - self.write_metric()?; - self.write_plain(&format!(": {}\n", mm.fmt_metrics())) - } TrBench(ref bs) => { self.write_bench()?; self.write_plain(&format!(": {}\n", fmt_bench_samples(bs))) @@ -722,7 +689,6 @@ impl ConsoleTestState { TrFailedMsg(ref msg) => format!("failed: {}", msg), TrIgnored => "ignored".to_owned(), TrAllowedFail => "failed (allowed)".to_owned(), - TrMetrics(ref mm) => mm.fmt_metrics(), TrBench(ref bs) => fmt_bench_samples(bs), }, test.name)) @@ -872,7 +838,6 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec) -> io::Res let mut ntest = 0; let mut nbench = 0; - let mut nmetric = 0; for test in filter_tests(&opts, tests) { use TestFn::*; @@ -882,7 +847,6 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec) -> io::Res let fntype = match testfn { StaticTestFn(..) | DynTestFn(..) => { ntest += 1; "test" }, StaticBenchFn(..) | DynBenchFn(..) => { nbench += 1; "benchmark" }, - StaticMetricFn(..) | DynMetricFn(..) => { nmetric += 1; "metric" }, }; st.write_plain(format!("{}: {}\n", name, fntype))?; @@ -897,13 +861,12 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec) -> io::Res } if !opts.quiet { - if ntest != 0 || nbench != 0 || nmetric != 0 { + if ntest != 0 || nbench != 0 { st.write_plain("\n")?; } - st.write_plain(format!("{}, {}, {}\n", + st.write_plain(format!("{}, {}\n", plural(ntest, "test"), - plural(nbench, "benchmark"), - plural(nmetric, "metric")))?; + plural(nbench, "benchmark")))?; } Ok(()) @@ -928,15 +891,6 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec) -> io::Resu } TrIgnored => st.ignored += 1, TrAllowedFail => st.allowed_fail += 1, - TrMetrics(mm) => { - let tname = test.name; - let MetricMap(mm) = mm; - for (k, v) in &mm { - st.metrics - .insert_metric(&format!("{}.{}", tname, k), v.value, v.noise); - } - st.measured += 1 - } TrBench(bs) => { st.metrics.insert_metric(test.name.as_slice(), bs.ns_iter_summ.median, @@ -1095,7 +1049,7 @@ pub fn run_tests(opts: &TestOpts, tests: Vec, mut callback: F) callback(TeFiltered(filtered_descs))?; - let (filtered_tests, filtered_benchs_and_metrics): (Vec<_>, _) = + let (filtered_tests, filtered_benchs): (Vec<_>, _) = filtered_tests.into_iter().partition(|e| { match e.testfn { StaticTestFn(_) | DynTestFn(_) => true, @@ -1182,8 +1136,7 @@ pub fn run_tests(opts: &TestOpts, tests: Vec, mut callback: F) if opts.bench_benchmarks { // All benchmarks run at the end, in serial. - // (this includes metric fns) - for b in filtered_benchs_and_metrics { + for b in filtered_benchs { callback(TeWait(b.desc.clone(), b.testfn.padding()))?; run_test(opts, false, b, tx.clone()); let (test, result, stdout) = rx.recv().unwrap(); @@ -1376,14 +1329,14 @@ pub fn convert_benchmarks_to_tests(tests: Vec) -> Vec { - DynTestFn(Box::new(move |()| { + DynTestFn(Box::new(move || { bench::run_once(|b| { __rust_begin_short_backtrace(|| bench.run(b)) }) })) } StaticBenchFn(benchfn) => { - DynTestFn(Box::new(move |()| { + DynTestFn(Box::new(move || { bench::run_once(|b| { __rust_begin_short_backtrace(|| benchfn(b)) }) @@ -1418,7 +1371,7 @@ pub fn run_test(opts: &TestOpts, fn run_test_inner(desc: TestDesc, monitor_ch: Sender, nocapture: bool, - testfn: Box>) { + testfn: Box) { struct Sink(Arc>>); impl Write for Sink { fn write(&mut self, data: &[u8]) -> io::Result { @@ -1444,9 +1397,7 @@ pub fn run_test(opts: &TestOpts, None }; - let result = catch_unwind(AssertUnwindSafe(|| { - testfn.call_box(()) - })); + let result = catch_unwind(AssertUnwindSafe(testfn)); if let Some((printio, panicio)) = oldio { io::set_print(printio); @@ -1487,27 +1438,15 @@ pub fn run_test(opts: &TestOpts, monitor_ch.send((desc, TrBench(bs), Vec::new())).unwrap(); return; } - DynMetricFn(f) => { - let mut mm = MetricMap::new(); - f.call_box(&mut mm); - monitor_ch.send((desc, TrMetrics(mm), Vec::new())).unwrap(); - return; - } - StaticMetricFn(f) => { - let mut mm = MetricMap::new(); - f(&mut mm); - monitor_ch.send((desc, TrMetrics(mm), Vec::new())).unwrap(); - return; - } DynTestFn(f) => { - let cb = move |()| { - __rust_begin_short_backtrace(|| f.call_box(())) + let cb = move || { + __rust_begin_short_backtrace(f) }; run_test_inner(desc, monitor_ch, opts.nocapture, Box::new(cb)) } StaticTestFn(f) => run_test_inner(desc, monitor_ch, opts.nocapture, - Box::new(move |()| __rust_begin_short_backtrace(f))), + Box::new(move || __rust_begin_short_backtrace(f))), } } @@ -1540,6 +1479,9 @@ fn calc_result(desc: &TestDesc, task_result: Result<(), Box>) -> Tes } } +#[derive(Clone, PartialEq)] +pub struct MetricMap(BTreeMap); + impl MetricMap { pub fn new() -> MetricMap { MetricMap(BTreeMap::new()) @@ -1563,15 +1505,14 @@ impl MetricMap { value, noise, }; - let MetricMap(ref mut map) = *self; - map.insert(name.to_owned(), m); + self.0.insert(name.to_owned(), m); } pub fn fmt_metrics(&self) -> String { - let MetricMap(ref mm) = *self; - let v: Vec = mm.iter() - .map(|(k, v)| format!("{}: {} (+/- {})", *k, v.value, v.noise)) - .collect(); + let v = self.0 + .iter() + .map(|(k, v)| format!("{}: {} (+/- {})", *k, v.value, v.noise)) + .collect::>(); v.join(", ") } } @@ -1769,7 +1710,7 @@ mod tests { should_panic: ShouldPanic::No, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| f())), + testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1787,7 +1728,7 @@ mod tests { should_panic: ShouldPanic::No, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| f())), + testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1807,7 +1748,7 @@ mod tests { should_panic: ShouldPanic::Yes, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| f())), + testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1827,7 +1768,7 @@ mod tests { should_panic: ShouldPanic::YesWithMessage("error message"), allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| f())), + testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1849,7 +1790,7 @@ mod tests { should_panic: ShouldPanic::YesWithMessage(expected), allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| f())), + testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1867,7 +1808,7 @@ mod tests { should_panic: ShouldPanic::Yes, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| f())), + testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); @@ -1901,7 +1842,7 @@ mod tests { should_panic: ShouldPanic::No, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| {})), + testfn: DynTestFn(Box::new(move || {})), }, TestDescAndFn { desc: TestDesc { @@ -1910,7 +1851,7 @@ mod tests { should_panic: ShouldPanic::No, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| {})), + testfn: DynTestFn(Box::new(move || {})), }]; let filtered = filter_tests(&opts, tests); @@ -1934,7 +1875,7 @@ mod tests { should_panic: ShouldPanic::No, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| {})) + testfn: DynTestFn(Box::new(move || {})) }) .collect() } @@ -2016,7 +1957,7 @@ mod tests { should_panic: ShouldPanic::No, allow_fail: false, }, - testfn: DynTestFn(Box::new(move |()| testfn())), + testfn: DynTestFn(Box::new(testfn)), }; tests.push(test); } diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index f04394f716..9f8b4a73d0 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -53,13 +53,13 @@ pub trait Stats { /// Arithmetic mean (average) of the samples: sum divided by sample-count. /// - /// See: https://en.wikipedia.org/wiki/Arithmetic_mean + /// See: fn mean(&self) -> f64; /// Median of the samples: value separating the lower half of the samples from the higher half. /// Equal to `self.percentile(50.0)`. /// - /// See: https://en.wikipedia.org/wiki/Median + /// See: fn median(&self) -> f64; /// Variance of the samples: bias-corrected mean of the squares of the differences of each @@ -68,7 +68,7 @@ pub trait Stats { /// bias that would appear if we calculated a population variance, by dividing by `(n-1)` rather /// than `n`. /// - /// See: https://en.wikipedia.org/wiki/Variance + /// See: fn var(&self) -> f64; /// Standard deviation: the square root of the sample variance. @@ -76,7 +76,7 @@ pub trait Stats { /// Note: this is not a robust statistic for non-normal distributions. Prefer the /// `median_abs_dev` for unknown distributions. /// - /// See: https://en.wikipedia.org/wiki/Standard_deviation + /// See: fn std_dev(&self) -> f64; /// Standard deviation as a percent of the mean value. See `std_dev` and `mean`. @@ -91,7 +91,7 @@ pub trait Stats { /// by the constant `1.4826` to allow its use as a consistent estimator for the standard /// deviation. /// - /// See: http://en.wikipedia.org/wiki/Median_absolute_deviation + /// See: fn median_abs_dev(&self) -> f64; /// Median absolute deviation as a percent of the median. See `median_abs_dev` and `median`. @@ -103,7 +103,7 @@ pub trait Stats { /// /// Calculated by linear interpolation between closest ranks. /// - /// See: http://en.wikipedia.org/wiki/Percentile + /// See: fn percentile(&self, pct: f64) -> f64; /// Quartiles of the sample: three values that divide the sample into four equal groups, each @@ -111,13 +111,13 @@ pub trait Stats { /// function may calculate the 3 quartiles more efficiently than 3 calls to `percentile`, but /// is otherwise equivalent. /// - /// See also: https://en.wikipedia.org/wiki/Quartile + /// See also: fn quartiles(&self) -> (f64, f64, f64); /// Inter-quartile range: the difference between the 25th percentile (1st quartile) and the 75th /// percentile (3rd quartile). See `quartiles`. /// - /// See also: https://en.wikipedia.org/wiki/Interquartile_range + /// See also: fn iqr(&self) -> f64; } @@ -311,7 +311,7 @@ fn percentile_of_sorted(sorted_samples: &[f64], pct: f64) -> f64 { /// It differs from trimming in that it does not change the number of samples, /// just changes the values of those that are outliers. /// -/// See: http://en.wikipedia.org/wiki/Winsorising +/// See: pub fn winsorize(samples: &mut [f64], pct: f64) { let mut tmp = samples.to_vec(); local_sort(&mut tmp); diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index dc1464b905..afd1e5e1c5 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -27,7 +27,7 @@ fn main() { } else if target.contains("netbsd") { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("openbsd") { - println!("cargo:rustc-link-lib=gcc"); + println!("cargo:rustc-link-lib=c++abi"); } else if target.contains("solaris") { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("bitrig") { @@ -43,5 +43,7 @@ fn main() { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("redox") { println!("cargo:rustc-link-lib=gcc"); + } else if target.contains("cloudabi") { + println!("cargo:rustc-link-lib=unwind"); } } diff --git a/src/rustllvm/ArchiveWrapper.cpp b/src/rustllvm/ArchiveWrapper.cpp index 7f76861c07..b110013cea 100644 --- a/src/rustllvm/ArchiveWrapper.cpp +++ b/src/rustllvm/ArchiveWrapper.cpp @@ -24,11 +24,7 @@ struct RustArchiveMember { RustArchiveMember() : Filename(nullptr), Name(nullptr), -#if LLVM_VERSION_GE(3, 8) Child(nullptr, nullptr, nullptr) -#else - Child(nullptr, nullptr) -#endif { } ~RustArchiveMember() {} @@ -38,13 +34,9 @@ struct RustArchiveIterator { bool First; Archive::child_iterator Cur; Archive::child_iterator End; -#if LLVM_VERSION_GE(3, 9) Error Err; RustArchiveIterator() : First(true), Err(Error::success()) {} -#else - RustArchiveIterator() : First(true) {} -#endif }; enum class LLVMRustArchiveKind { @@ -66,7 +58,7 @@ static Archive::Kind fromRust(LLVMRustArchiveKind Kind) { case LLVMRustArchiveKind::COFF: return Archive::K_COFF; default: - llvm_unreachable("Bad ArchiveKind."); + report_fatal_error("Bad ArchiveKind."); } } @@ -84,19 +76,11 @@ extern "C" LLVMRustArchiveRef LLVMRustOpenArchive(char *Path) { return nullptr; } -#if LLVM_VERSION_LE(3, 8) - ErrorOr> ArchiveOr = -#else Expected> ArchiveOr = -#endif Archive::create(BufOr.get()->getMemBufferRef()); if (!ArchiveOr) { -#if LLVM_VERSION_LE(3, 8) - LLVMRustSetLastError(ArchiveOr.getError().message().c_str()); -#else LLVMRustSetLastError(toString(ArchiveOr.takeError()).c_str()); -#endif return nullptr; } @@ -114,16 +98,12 @@ extern "C" LLVMRustArchiveIteratorRef LLVMRustArchiveIteratorNew(LLVMRustArchiveRef RustArchive) { Archive *Archive = RustArchive->getBinary(); RustArchiveIterator *RAI = new RustArchiveIterator(); -#if LLVM_VERSION_LE(3, 8) - RAI->Cur = Archive->child_begin(); -#else RAI->Cur = Archive->child_begin(RAI->Err); if (RAI->Err) { LLVMRustSetLastError(toString(std::move(RAI->Err)).c_str()); delete RAI; return nullptr; } -#endif RAI->End = Archive->child_end(); return RAI; } @@ -141,12 +121,10 @@ LLVMRustArchiveIteratorNext(LLVMRustArchiveIteratorRef RAI) { // but instead advance it *before* fetching the child in all later calls. if (!RAI->First) { ++RAI->Cur; -#if LLVM_VERSION_GE(3, 9) if (RAI->Err) { LLVMRustSetLastError(toString(std::move(RAI->Err)).c_str()); return nullptr; } -#endif } else { RAI->First = false; } @@ -154,16 +132,7 @@ LLVMRustArchiveIteratorNext(LLVMRustArchiveIteratorRef RAI) { if (RAI->Cur == RAI->End) return nullptr; -#if LLVM_VERSION_EQ(3, 8) - const ErrorOr *Cur = RAI->Cur.operator->(); - if (!*Cur) { - LLVMRustSetLastError(Cur->getError().message().c_str()); - return nullptr; - } - const Archive::Child &Child = Cur->get(); -#else const Archive::Child &Child = *RAI->Cur.operator->(); -#endif Archive::Child *Ret = new Archive::Child(Child); return Ret; @@ -239,18 +208,13 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers, const LLVMRustArchiveMemberRef *NewMembers, bool WriteSymbtab, LLVMRustArchiveKind RustKind) { -#if LLVM_VERSION_LE(3, 8) - std::vector Members; -#else std::vector Members; -#endif auto Kind = fromRust(RustKind); for (size_t I = 0; I < NumMembers; I++) { auto Member = NewMembers[I]; assert(Member->Name); if (Member->Filename) { -#if LLVM_VERSION_GE(3, 9) Expected MOrErr = NewArchiveMember::getFile(Member->Filename, true); if (!MOrErr) { @@ -261,15 +225,7 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers, MOrErr->MemberName = sys::path::filename(MOrErr->MemberName); #endif Members.push_back(std::move(*MOrErr)); -#elif LLVM_VERSION_EQ(3, 8) - Members.push_back(NewArchiveIterator(Member->Filename)); -#else - Members.push_back(NewArchiveIterator(Member->Filename, Member->Name)); -#endif } else { -#if LLVM_VERSION_LE(3, 8) - Members.push_back(NewArchiveIterator(Member->Child, Member->Name)); -#else Expected MOrErr = NewArchiveMember::getOldMember(Member->Child, true); if (!MOrErr) { @@ -277,14 +233,9 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers, return LLVMRustResult::Failure; } Members.push_back(std::move(*MOrErr)); -#endif } } -#if LLVM_VERSION_GE(3, 8) auto Pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false); -#else - auto Pair = writeArchive(Dst, Members, WriteSymbtab, Kind, true); -#endif if (!Pair.second) return LLVMRustResult::Success; LLVMRustSetLastError(Pair.second.message().c_str()); diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index d0c042e645..4e326c9e19 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -11,6 +11,7 @@ #include #include +#include #include "rustllvm.h" @@ -58,9 +59,6 @@ extern "C" void LLVMInitializePasses() { initializeVectorization(Registry); initializeIPO(Registry); initializeAnalysis(Registry); -#if LLVM_VERSION_EQ(3, 7) - initializeIPA(Registry); -#endif initializeTransformUtils(Registry); initializeInstCombine(Registry); initializeInstrumentation(Registry); @@ -235,7 +233,7 @@ static CodeModel::Model fromRust(LLVMRustCodeModel Model) { case LLVMRustCodeModel::Large: return CodeModel::Large; default: - llvm_unreachable("Bad CodeModel."); + report_fatal_error("Bad CodeModel."); } } @@ -258,7 +256,7 @@ static CodeGenOpt::Level fromRust(LLVMRustCodeGenOptLevel Level) { case LLVMRustCodeGenOptLevel::Aggressive: return CodeGenOpt::Aggressive; default: - llvm_unreachable("Bad CodeGenOptLevel."); + report_fatal_error("Bad CodeGenOptLevel."); } } @@ -272,18 +270,10 @@ enum class LLVMRustRelocMode { ROPIRWPI, }; -#if LLVM_VERSION_LE(3, 8) -static Reloc::Model fromRust(LLVMRustRelocMode RustReloc) { -#else static Optional fromRust(LLVMRustRelocMode RustReloc) { -#endif switch (RustReloc) { case LLVMRustRelocMode::Default: -#if LLVM_VERSION_LE(3, 8) - return Reloc::Default; -#else return None; -#endif case LLVMRustRelocMode::Static: return Reloc::Static; case LLVMRustRelocMode::PIC: @@ -302,7 +292,7 @@ static Optional fromRust(LLVMRustRelocMode RustReloc) { break; #endif } - llvm_unreachable("Bad RelocModel."); + report_fatal_error("Bad RelocModel."); } #if LLVM_RUSTLLVM @@ -389,9 +379,6 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( } TargetOptions Options; -#if LLVM_VERSION_LE(3, 8) - Options.PositionIndependentExecutable = PositionIndependentExecutable; -#endif Options.FloatABIType = FloatABI::Default; if (UseSoftFloat) { @@ -511,7 +498,7 @@ static TargetMachine::CodeGenFileType fromRust(LLVMRustFileType Type) { case LLVMRustFileType::ObjectFile: return TargetMachine::CGFT_ObjectFile; default: - llvm_unreachable("Bad FileType."); + report_fatal_error("Bad FileType."); } } @@ -719,10 +706,6 @@ extern "C" void LLVMRustRunRestrictionPass(LLVMModuleRef M, char **Symbols, size_t Len) { llvm::legacy::PassManager passes; -#if LLVM_VERSION_LE(3, 8) - ArrayRef Ref(Symbols, Len); - passes.add(llvm::createInternalizePass(Ref)); -#else auto PreserveFunctions = [=](const GlobalValue &GV) { for (size_t I = 0; I < Len; I++) { if (GV.getName() == Symbols[I]) { @@ -733,7 +716,6 @@ extern "C" void LLVMRustRunRestrictionPass(LLVMModuleRef M, char **Symbols, }; passes.add(llvm::createInternalizePass(PreserveFunctions)); -#endif passes.run(*unwrap(M)); } @@ -769,9 +751,7 @@ extern "C" LLVMTargetDataRef LLVMRustGetModuleDataLayout(LLVMModuleRef M) { } extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) { -#if LLVM_VERSION_GE(3, 9) unwrap(M)->setPIELevel(PIELevel::Level::Large); -#endif } extern "C" bool @@ -885,86 +865,6 @@ getFirstDefinitionForLinker(const GlobalValueSummaryList &GVSummaryList) { return FirstDefForLinker->get(); } -// This is a helper function we added that isn't present in LLVM's source. -// -// The way LTO works in Rust is that we typically have a number of symbols that -// we know ahead of time need to be preserved. We want to ensure that ThinLTO -// doesn't accidentally internalize any of these and otherwise is always -// ready to keep them linking correctly. -// -// This function will recursively walk the `GUID` provided and all of its -// references, as specified in the `Index`. In other words, we're taking a -// `GUID` as input, adding it to `Preserved`, and then taking all `GUID` -// items that the input references and recursing. -static void -addPreservedGUID(const ModuleSummaryIndex &Index, - DenseSet &Preserved, - GlobalValue::GUID GUID) { - if (Preserved.count(GUID)) - return; - Preserved.insert(GUID); - -#if LLVM_VERSION_GE(5, 0) - auto Info = Index.getValueInfo(GUID); - if (!Info) { - return; - } - for (auto &Summary : Info.getSummaryList()) { - for (auto &Ref : Summary->refs()) { - addPreservedGUID(Index, Preserved, Ref.getGUID()); - } - - GlobalValueSummary *GVSummary = Summary.get(); - if (isa(GVSummary)) { - auto *FS = cast(GVSummary); - for (auto &Call: FS->calls()) { - addPreservedGUID(Index, Preserved, Call.first.getGUID()); - } - for (auto &GUID: FS->type_tests()) { - addPreservedGUID(Index, Preserved, GUID); - } - } - if (isa(GVSummary)) { - auto *AS = cast(GVSummary); - auto GUID = AS->getAliasee().getOriginalName(); - addPreservedGUID(Index, Preserved, GUID); - } - } -#else - auto SummaryList = Index.findGlobalValueSummaryList(GUID); - if (SummaryList == Index.end()) - return; - for (auto &Summary : SummaryList->second) { - for (auto &Ref : Summary->refs()) { - if (Ref.isGUID()) { - addPreservedGUID(Index, Preserved, Ref.getGUID()); - } else { - auto Value = Ref.getValue(); - addPreservedGUID(Index, Preserved, Value->getGUID()); - } - } - - if (auto *FS = dyn_cast(Summary.get())) { - for (auto &Call: FS->calls()) { - if (Call.first.isGUID()) { - addPreservedGUID(Index, Preserved, Call.first.getGUID()); - } else { - auto Value = Call.first.getValue(); - addPreservedGUID(Index, Preserved, Value->getGUID()); - } - } - for (auto &GUID: FS->type_tests()) { - addPreservedGUID(Index, Preserved, GUID); - } - } - if (auto *AS = dyn_cast(Summary.get())) { - auto GUID = AS->getAliasee().getOriginalName(); - addPreservedGUID(Index, Preserved, GUID); - } - } -#endif -} - // The main entry point for creating the global ThinLTO analysis. The structure // here is basically the same as before threads are spawned in the `run` // function of `lib/LTO/ThinLTOCodeGenerator.cpp`. @@ -1004,12 +904,10 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, Ret->Index.collectDefinedGVSummariesPerModule(Ret->ModuleToDefinedGVSummaries); // Convert the preserved symbols set from string to GUID, this is then needed - // for internalization. We use `addPreservedGUID` to include any transitively - // used symbol as well. + // for internalization. for (int i = 0; i < num_symbols; i++) { - addPreservedGUID(Ret->Index, - Ret->GUIDPreservedSymbols, - GlobalValue::getGUID(preserved_symbols[i])); + auto GUID = GlobalValue::getGUID(preserved_symbols[i]); + Ret->GUIDPreservedSymbols.insert(GUID); } // Collect the import/export lists for all modules from the call-graph in the @@ -1038,7 +936,8 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, // Resolve LinkOnce/Weak symbols, this has to be computed early be cause it // impacts the caching. // - // This is copied from `lib/LTO/ThinLTOCodeGenerator.cpp` + // This is copied from `lib/LTO/ThinLTOCodeGenerator.cpp` with some of this + // being lifted from `lib/LTO/LTO.cpp` as well StringMap> ResolvedODR; DenseMap PrevailingCopy; for (auto &I : Ret->Index) { @@ -1062,11 +961,35 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, ResolvedODR[ModuleIdentifier][GUID] = NewLinkage; }; thinLTOResolveWeakForLinkerInIndex(Ret->Index, isPrevailing, recordNewLinkage); + + // Here we calculate an `ExportedGUIDs` set for use in the `isExported` + // callback below. This callback below will dictate the linkage for all + // summaries in the index, and we basically just only want to ensure that dead + // symbols are internalized. Otherwise everything that's already external + // linkage will stay as external, and internal will stay as internal. + std::set ExportedGUIDs; + for (auto &List : Ret->Index) { +#if LLVM_VERSION_GE(5, 0) + for (auto &GVS: List.second.SummaryList) { +#else + for (auto &GVS: List.second) { +#endif + if (GlobalValue::isLocalLinkage(GVS->linkage())) + continue; + auto GUID = GVS->getOriginalName(); +#if LLVM_VERSION_GE(5, 0) + if (GVS->flags().Live) +#else + if (!DeadSymbols.count(GUID)) +#endif + ExportedGUIDs.insert(GUID); + } + } auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) { const auto &ExportList = Ret->ExportLists.find(ModuleIdentifier); return (ExportList != Ret->ExportLists.end() && ExportList->second.count(GUID)) || - Ret->GUIDPreservedSymbols.count(GUID); + ExportedGUIDs.count(GUID); }; thinLTOInternalizeAndPromoteInIndex(Ret->Index, isExported); @@ -1191,13 +1114,90 @@ LLVMRustParseBitcodeForThinLTO(LLVMContextRef Context, return wrap(std::move(*SrcOrError).release()); } +// Rewrite all `DICompileUnit` pointers to the `DICompileUnit` specified. See +// the comment in `back/lto.rs` for why this exists. +extern "C" void +LLVMRustThinLTOGetDICompileUnit(LLVMModuleRef Mod, + DICompileUnit **A, + DICompileUnit **B) { + Module *M = unwrap(Mod); + DICompileUnit **Cur = A; + DICompileUnit **Next = B; + for (DICompileUnit *CU : M->debug_compile_units()) { + *Cur = CU; + Cur = Next; + Next = nullptr; + if (Cur == nullptr) + break; + } +} + +// Rewrite all `DICompileUnit` pointers to the `DICompileUnit` specified. See +// the comment in `back/lto.rs` for why this exists. +extern "C" void +LLVMRustThinLTOPatchDICompileUnit(LLVMModuleRef Mod, DICompileUnit *Unit) { + Module *M = unwrap(Mod); + + // If the original source module didn't have a `DICompileUnit` then try to + // merge all the existing compile units. If there aren't actually any though + // then there's not much for us to do so return. + if (Unit == nullptr) { + for (DICompileUnit *CU : M->debug_compile_units()) { + Unit = CU; + break; + } + if (Unit == nullptr) + return; + } + + // Use LLVM's built-in `DebugInfoFinder` to find a bunch of debuginfo and + // process it recursively. Note that we specifically iterate over instructions + // to ensure we feed everything into it. + DebugInfoFinder Finder; + Finder.processModule(*M); + for (Function &F : M->functions()) { + for (auto &FI : F) { + for (Instruction &BI : FI) { + if (auto Loc = BI.getDebugLoc()) + Finder.processLocation(*M, Loc); + if (auto DVI = dyn_cast(&BI)) + Finder.processValue(*M, DVI); + if (auto DDI = dyn_cast(&BI)) + Finder.processDeclare(*M, DDI); + } + } + } + + // After we've found all our debuginfo, rewrite all subprograms to point to + // the same `DICompileUnit`. + for (auto &F : Finder.subprograms()) { + F->replaceUnit(Unit); + } + + // Erase any other references to other `DICompileUnit` instances, the verifier + // will later ensure that we don't actually have any other stale references to + // worry about. + auto *MD = M->getNamedMetadata("llvm.dbg.cu"); + MD->clearOperands(); + MD->addOperand(Unit); +} + +extern "C" void +LLVMRustThinLTORemoveAvailableExternally(LLVMModuleRef Mod) { + Module *M = unwrap(Mod); + for (Function &F : M->functions()) { + if (F.hasAvailableExternallyLinkage()) + F.deleteBody(); + } +} + #else extern "C" bool LLVMRustWriteThinBitcodeToFile(LLVMPassManagerRef PMR, LLVMModuleRef M, const char *BcFile) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } struct LLVMRustThinLTOData { @@ -1211,32 +1211,32 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, int num_modules, const char **preserved_symbols, int num_symbols) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" bool LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data, LLVMModuleRef M) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" bool LLVMRustPrepareThinLTOResolveWeak(const LLVMRustThinLTOData *Data, LLVMModuleRef M) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" bool LLVMRustPrepareThinLTOInternalize(const LLVMRustThinLTOData *Data, LLVMModuleRef M) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" bool LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" void LLVMRustFreeThinLTOData(LLVMRustThinLTOData *Data) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } struct LLVMRustThinLTOBuffer { @@ -1244,22 +1244,22 @@ struct LLVMRustThinLTOBuffer { extern "C" LLVMRustThinLTOBuffer* LLVMRustThinLTOBufferCreate(LLVMModuleRef M) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" void LLVMRustThinLTOBufferFree(LLVMRustThinLTOBuffer *Buffer) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" const void* LLVMRustThinLTOBufferPtr(const LLVMRustThinLTOBuffer *Buffer) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" size_t LLVMRustThinLTOBufferLen(const LLVMRustThinLTOBuffer *Buffer) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } extern "C" LLVMModuleRef @@ -1267,6 +1267,24 @@ LLVMRustParseBitcodeForThinLTO(LLVMContextRef Context, const char *data, size_t len, const char *identifier) { - llvm_unreachable("ThinLTO not available"); + report_fatal_error("ThinLTO not available"); } + +extern "C" void +LLVMRustThinLTOGetDICompileUnit(LLVMModuleRef Mod, + DICompileUnit **A, + DICompileUnit **B) { + report_fatal_error("ThinLTO not available"); +} + +extern "C" void +LLVMRustThinLTOPatchDICompileUnit(LLVMModuleRef Mod) { + report_fatal_error("ThinLTO not available"); +} + +extern "C" void +LLVMRustThinLTORemoveAvailableExternally(LLVMModuleRef Mod) { + report_fatal_error("ThinLTO not available"); +} + #endif // LLVM_VERSION_GE(4, 0) diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 20ea8d7030..1ebbd73e6f 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -54,7 +54,7 @@ static AtomicOrdering fromRust(LLVMAtomicOrdering Ordering) { return AtomicOrdering::SequentiallyConsistent; } - llvm_unreachable("Invalid LLVMAtomicOrdering value!"); + report_fatal_error("Invalid LLVMAtomicOrdering value!"); } static LLVM_THREAD_LOCAL char *LastError; @@ -76,11 +76,17 @@ extern "C" char *LLVMRustGetLastError(void) { return Ret; } -void LLVMRustSetLastError(const char *Err) { +extern "C" void LLVMRustSetLastError(const char *Err) { free((void *)LastError); LastError = strdup(Err); } +extern "C" LLVMContextRef LLVMRustContextCreate(bool shouldDiscardNames) { + auto ctx = new LLVMContext(); + ctx->setDiscardValueNames(shouldDiscardNames); + return wrap(ctx); +} + extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M, const char *Triple) { unwrap(M)->setTargetTriple(Triple::normalize(Triple)); @@ -161,7 +167,7 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) { case SanitizeMemory: return Attribute::SanitizeMemory; } - llvm_unreachable("bad AttributeKind"); + report_fatal_error("bad AttributeKind"); } extern "C" void LLVMRustAddCallSiteAttribute(LLVMValueRef Instr, unsigned Index, @@ -178,6 +184,22 @@ extern "C" void LLVMRustAddCallSiteAttribute(LLVMValueRef Instr, unsigned Index, #endif } +extern "C" void LLVMRustAddAlignmentCallSiteAttr(LLVMValueRef Instr, + unsigned Index, + uint32_t Bytes) { + CallSite Call = CallSite(unwrap(Instr)); + AttrBuilder B; + B.addAlignmentAttr(Bytes); +#if LLVM_VERSION_GE(5, 0) + Call.setAttributes(Call.getAttributes().addAttributes( + Call->getContext(), Index, B)); +#else + Call.setAttributes(Call.getAttributes().addAttributes( + Call->getContext(), Index, + AttributeSet::get(Call->getContext(), Index, B))); +#endif +} + extern "C" void LLVMRustAddDereferenceableCallSiteAttr(LLVMValueRef Instr, unsigned Index, uint64_t Bytes) { @@ -194,6 +216,22 @@ extern "C" void LLVMRustAddDereferenceableCallSiteAttr(LLVMValueRef Instr, #endif } +extern "C" void LLVMRustAddDereferenceableOrNullCallSiteAttr(LLVMValueRef Instr, + unsigned Index, + uint64_t Bytes) { + CallSite Call = CallSite(unwrap(Instr)); + AttrBuilder B; + B.addDereferenceableOrNullAttr(Bytes); +#if LLVM_VERSION_GE(5, 0) + Call.setAttributes(Call.getAttributes().addAttributes( + Call->getContext(), Index, B)); +#else + Call.setAttributes(Call.getAttributes().addAttributes( + Call->getContext(), Index, + AttributeSet::get(Call->getContext(), Index, B))); +#endif +} + extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index, LLVMRustAttribute RustAttr) { Function *A = unwrap(Fn); @@ -206,6 +244,19 @@ extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index, #endif } +extern "C" void LLVMRustAddAlignmentAttr(LLVMValueRef Fn, + unsigned Index, + uint32_t Bytes) { + Function *A = unwrap(Fn); + AttrBuilder B; + B.addAlignmentAttr(Bytes); +#if LLVM_VERSION_GE(5, 0) + A->addAttributes(Index, B); +#else + A->addAttributes(Index, AttributeSet::get(A->getContext(), Index, B)); +#endif +} + extern "C" void LLVMRustAddDereferenceableAttr(LLVMValueRef Fn, unsigned Index, uint64_t Bytes) { Function *A = unwrap(Fn); @@ -218,6 +269,19 @@ extern "C" void LLVMRustAddDereferenceableAttr(LLVMValueRef Fn, unsigned Index, #endif } +extern "C" void LLVMRustAddDereferenceableOrNullAttr(LLVMValueRef Fn, + unsigned Index, + uint64_t Bytes) { + Function *A = unwrap(Fn); + AttrBuilder B; + B.addDereferenceableOrNullAttr(Bytes); +#if LLVM_VERSION_GE(5, 0) + A->addAttributes(Index, B); +#else + A->addAttributes(Index, AttributeSet::get(A->getContext(), Index, B)); +#endif +} + extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn, unsigned Index, const char *Name, @@ -257,21 +321,18 @@ extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) { extern "C" LLVMValueRef LLVMRustBuildAtomicLoad(LLVMBuilderRef B, LLVMValueRef Source, const char *Name, - LLVMAtomicOrdering Order, unsigned Alignment) { + LLVMAtomicOrdering Order) { LoadInst *LI = new LoadInst(unwrap(Source), 0); LI->setAtomic(fromRust(Order)); - LI->setAlignment(Alignment); return wrap(unwrap(B)->Insert(LI, Name)); } extern "C" LLVMValueRef LLVMRustBuildAtomicStore(LLVMBuilderRef B, LLVMValueRef V, LLVMValueRef Target, - LLVMAtomicOrdering Order, - unsigned Alignment) { + LLVMAtomicOrdering Order) { StoreInst *SI = new StoreInst(unwrap(V), unwrap(Target)); SI->setAtomic(fromRust(Order)); - SI->setAlignment(Alignment); return wrap(unwrap(B)->Insert(SI)); } @@ -301,7 +362,7 @@ static SyncScope::ID fromRust(LLVMRustSynchronizationScope Scope) { case LLVMRustSynchronizationScope::CrossThread: return SyncScope::System; default: - llvm_unreachable("bad SynchronizationScope."); + report_fatal_error("bad SynchronizationScope."); } } #else @@ -312,7 +373,7 @@ static SynchronizationScope fromRust(LLVMRustSynchronizationScope Scope) { case LLVMRustSynchronizationScope::CrossThread: return CrossThread; default: - llvm_unreachable("bad SynchronizationScope."); + report_fatal_error("bad SynchronizationScope."); } } #endif @@ -342,7 +403,7 @@ static InlineAsm::AsmDialect fromRust(LLVMRustAsmDialect Dialect) { case LLVMRustAsmDialect::Intel: return InlineAsm::AD_Intel; default: - llvm_unreachable("bad AsmDialect."); + report_fatal_error("bad AsmDialect."); } } @@ -511,8 +572,8 @@ extern "C" void LLVMRustAddModuleFlag(LLVMModuleRef M, const char *Name, unwrap(M)->addModuleFlag(Module::Warning, Name, Value); } -extern "C" void LLVMRustMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD) { - wrap(MetadataAsValue::get(*unwrap(C), unwrap(MD))); +extern "C" LLVMValueRef LLVMRustMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD) { + return wrap(MetadataAsValue::get(*unwrap(C), unwrap(MD))); } extern "C" LLVMRustDIBuilderRef LLVMRustDIBuilderCreate(LLVMModuleRef M) { @@ -554,9 +615,6 @@ LLVMRustDIBuilderCreateSubroutineType(LLVMRustDIBuilderRef Builder, LLVMMetadataRef File, LLVMMetadataRef ParameterTypes) { return wrap(Builder->createSubroutineType( -#if LLVM_VERSION_EQ(3, 7) - unwrapDI(File), -#endif DITypeRefArray(unwrap(ParameterTypes)))); } @@ -566,7 +624,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( LLVMMetadataRef Ty, bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine, LLVMRustDIFlags Flags, bool IsOptimized, LLVMValueRef Fn, LLVMMetadataRef TParam, LLVMMetadataRef Decl) { -#if LLVM_VERSION_GE(3, 8) DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); DISubprogram *Sub = Builder->createFunction( @@ -576,13 +633,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( unwrapDIPtr(Decl)); unwrap(Fn)->setSubprogram(Sub); return wrap(Sub); -#else - return wrap(Builder->createFunction( - unwrapDI(Scope), Name, LinkageName, unwrapDI(File), - LineNo, unwrapDI(Ty), IsLocalToUnit, IsDefinition, - ScopeLine, fromRust(Flags), IsOptimized, unwrap(Fn), - unwrapDIPtr(TParam), unwrapDIPtr(Decl))); -#endif } extern "C" LLVMMetadataRef @@ -686,14 +736,13 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable( const char *Name, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, bool AlwaysPreserve, LLVMRustDIFlags Flags, unsigned ArgNo, uint32_t AlignInBits) { -#if LLVM_VERSION_GE(3, 8) if (Tag == 0x100) { // DW_TAG_auto_variable return wrap(Builder->createAutoVariable( unwrapDI(Scope), Name, unwrapDI(File), LineNo, unwrapDI(Ty), AlwaysPreserve, fromRust(Flags) #if LLVM_VERSION_GE(4, 0) , - AlignInBits + AlignInBits #endif )); } else { @@ -701,11 +750,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable( unwrapDI(Scope), Name, ArgNo, unwrapDI(File), LineNo, unwrapDI(Ty), AlwaysPreserve, fromRust(Flags))); } -#else - return wrap(Builder->createLocalVariable( - Tag, unwrapDI(Scope), Name, unwrapDI(File), LineNo, - unwrapDI(Ty), AlwaysPreserve, fromRust(Flags), ArgNo)); -#endif } extern "C" LLVMMetadataRef @@ -880,11 +924,8 @@ extern "C" bool LLVMRustLinkInExternalBitcode(LLVMModuleRef DstRef, char *BC, DiagnosticPrinterRawOStream DP(Stream); #if LLVM_VERSION_GE(4, 0) if (Linker::linkModules(*Dst, std::move(Src))) { -#elif LLVM_VERSION_GE(3, 8) - if (Linker::linkModules(*Dst, std::move(Src.get()))) { #else - if (Linker::LinkModules(Dst, Src->get(), - [&](const DiagnosticInfo &DI) { DI.print(DP); })) { + if (Linker::linkModules(*Dst, std::move(Src.get()))) { #endif LLVMRustSetLastError(Err.c_str()); return false; @@ -1031,20 +1072,14 @@ static LLVMRustDiagnosticKind toRust(DiagnosticKind Kind) { return LLVMRustDiagnosticKind::OptimizationRemarkMissed; case DK_OptimizationRemarkAnalysis: return LLVMRustDiagnosticKind::OptimizationRemarkAnalysis; -#if LLVM_VERSION_GE(3, 8) case DK_OptimizationRemarkAnalysisFPCommute: return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisFPCommute; case DK_OptimizationRemarkAnalysisAliasing: return LLVMRustDiagnosticKind::OptimizationRemarkAnalysisAliasing; -#endif default: -#if LLVM_VERSION_GE(3, 9) return (Kind >= DK_FirstRemark && Kind <= DK_LastRemark) ? LLVMRustDiagnosticKind::OptimizationRemarkOther : LLVMRustDiagnosticKind::Other; -#else - return LLVMRustDiagnosticKind::Other; -#endif } } @@ -1089,12 +1124,10 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) { return LLVMVectorTypeKind; case Type::X86_MMXTyID: return LLVMX86_MMXTypeKind; -#if LLVM_VERSION_GE(3, 8) case Type::TokenTyID: return LLVMTokenTypeKind; -#endif } - llvm_unreachable("Unhandled TypeID."); + report_fatal_error("Unhandled TypeID."); } extern "C" void LLVMRustWriteDebugLocToString(LLVMContextRef C, @@ -1129,7 +1162,6 @@ extern "C" LLVMValueRef LLVMRustBuildCleanupPad(LLVMBuilderRef B, unsigned ArgCount, LLVMValueRef *LLArgs, const char *Name) { -#if LLVM_VERSION_GE(3, 8) Value **Args = unwrap(LLArgs); if (ParentPad == nullptr) { Type *Ty = Type::getTokenTy(unwrap(B)->getContext()); @@ -1137,43 +1169,28 @@ extern "C" LLVMValueRef LLVMRustBuildCleanupPad(LLVMBuilderRef B, } return wrap(unwrap(B)->CreateCleanupPad( unwrap(ParentPad), ArrayRef(Args, ArgCount), Name)); -#else - return nullptr; -#endif } extern "C" LLVMValueRef LLVMRustBuildCleanupRet(LLVMBuilderRef B, LLVMValueRef CleanupPad, LLVMBasicBlockRef UnwindBB) { -#if LLVM_VERSION_GE(3, 8) CleanupPadInst *Inst = cast(unwrap(CleanupPad)); return wrap(unwrap(B)->CreateCleanupRet(Inst, unwrap(UnwindBB))); -#else - return nullptr; -#endif } extern "C" LLVMValueRef LLVMRustBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad, unsigned ArgCount, LLVMValueRef *LLArgs, const char *Name) { -#if LLVM_VERSION_GE(3, 8) Value **Args = unwrap(LLArgs); return wrap(unwrap(B)->CreateCatchPad( unwrap(ParentPad), ArrayRef(Args, ArgCount), Name)); -#else - return nullptr; -#endif } extern "C" LLVMValueRef LLVMRustBuildCatchRet(LLVMBuilderRef B, LLVMValueRef Pad, LLVMBasicBlockRef BB) { -#if LLVM_VERSION_GE(3, 8) return wrap(unwrap(B)->CreateCatchRet(cast(unwrap(Pad)), unwrap(BB))); -#else - return nullptr; -#endif } extern "C" LLVMValueRef LLVMRustBuildCatchSwitch(LLVMBuilderRef B, @@ -1181,27 +1198,20 @@ extern "C" LLVMValueRef LLVMRustBuildCatchSwitch(LLVMBuilderRef B, LLVMBasicBlockRef BB, unsigned NumHandlers, const char *Name) { -#if LLVM_VERSION_GE(3, 8) if (ParentPad == nullptr) { Type *Ty = Type::getTokenTy(unwrap(B)->getContext()); ParentPad = wrap(Constant::getNullValue(Ty)); } return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(BB), NumHandlers, Name)); -#else - return nullptr; -#endif } extern "C" void LLVMRustAddHandler(LLVMValueRef CatchSwitchRef, LLVMBasicBlockRef Handler) { -#if LLVM_VERSION_GE(3, 8) Value *CatchSwitch = unwrap(CatchSwitchRef); cast(CatchSwitch)->addHandler(unwrap(Handler)); -#endif } -#if LLVM_VERSION_GE(3, 8) extern "C" OperandBundleDef *LLVMRustBuildOperandBundleDef(const char *Name, LLVMValueRef *Inputs, unsigned NumInputs) { @@ -1233,28 +1243,6 @@ LLVMRustBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, makeArrayRef(unwrap(Args), NumArgs), Bundles, Name)); } -#else -extern "C" void *LLVMRustBuildOperandBundleDef(const char *Name, - LLVMValueRef *Inputs, - unsigned NumInputs) { - return nullptr; -} - -extern "C" void LLVMRustFreeOperandBundleDef(void *Bundle) {} - -extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, - LLVMValueRef *Args, unsigned NumArgs, - void *Bundle, const char *Name) { - return LLVMBuildCall(B, Fn, Args, NumArgs, Name); -} - -extern "C" LLVMValueRef -LLVMRustBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args, - unsigned NumArgs, LLVMBasicBlockRef Then, - LLVMBasicBlockRef Catch, void *Bundle, const char *Name) { - return LLVMBuildInvoke(B, Fn, Args, NumArgs, Then, Catch, Name); -} -#endif extern "C" void LLVMRustPositionBuilderAtStart(LLVMBuilderRef B, LLVMBasicBlockRef BB) { @@ -1315,7 +1303,7 @@ static LLVMRustLinkage toRust(LLVMLinkage Linkage) { case LLVMCommonLinkage: return LLVMRustLinkage::CommonLinkage; default: - llvm_unreachable("Invalid LLVMRustLinkage value!"); + report_fatal_error("Invalid LLVMRustLinkage value!"); } } @@ -1344,7 +1332,7 @@ static LLVMLinkage fromRust(LLVMRustLinkage Linkage) { case LLVMRustLinkage::CommonLinkage: return LLVMCommonLinkage; } - llvm_unreachable("Invalid LLVMRustLinkage value!"); + report_fatal_error("Invalid LLVMRustLinkage value!"); } extern "C" LLVMRustLinkage LLVMRustGetLinkage(LLVMValueRef V) { @@ -1392,7 +1380,7 @@ static LLVMRustVisibility toRust(LLVMVisibility Vis) { case LLVMProtectedVisibility: return LLVMRustVisibility::Protected; } - llvm_unreachable("Invalid LLVMRustVisibility value!"); + report_fatal_error("Invalid LLVMRustVisibility value!"); } static LLVMVisibility fromRust(LLVMRustVisibility Vis) { @@ -1404,7 +1392,7 @@ static LLVMVisibility fromRust(LLVMRustVisibility Vis) { case LLVMRustVisibility::Protected: return LLVMProtectedVisibility; } - llvm_unreachable("Invalid LLVMRustVisibility value!"); + report_fatal_error("Invalid LLVMRustVisibility value!"); } extern "C" LLVMRustVisibility LLVMRustGetVisibility(LLVMValueRef V) { diff --git a/src/rustllvm/rustllvm.h b/src/rustllvm/rustllvm.h index 20816af2f1..714173f860 100644 --- a/src/rustllvm/rustllvm.h +++ b/src/rustllvm/rustllvm.h @@ -57,11 +57,7 @@ #define LLVM_VERSION_LT(major, minor) (!LLVM_VERSION_GE((major), (minor))) -#if LLVM_VERSION_GE(3, 7) #include "llvm/IR/LegacyPassManager.h" -#else -#include "llvm/PassManager.h" -#endif #if LLVM_VERSION_GE(4, 0) #include "llvm/Bitcode/BitcodeReader.h" @@ -75,7 +71,7 @@ #include "llvm/IR/IRPrintingPasses.h" #include "llvm/Linker/Linker.h" -void LLVMRustSetLastError(const char *); +extern "C" void LLVMRustSetLastError(const char *); enum class LLVMRustResult { Success, Failure }; diff --git a/src/stage0.txt b/src/stage0.txt index bcef242057..bebd1f1443 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,9 +12,9 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.x.0` for Cargo where they were released on `date`. -date: 2017-11-20 -rustc: 1.22.0 -cargo: 0.23.0 +date: 2018-01-04 +rustc: 1.23.0 +cargo: 0.24.0 # When making a stable release the process currently looks like: # @@ -34,4 +34,4 @@ cargo: 0.23.0 # looking at a beta source tarball and it's uncommented we'll shortly comment it # out. -dev: 1 +#dev: 1 diff --git a/src/test/COMPILER_TESTS.md b/src/test/COMPILER_TESTS.md index 0380454b82..c255294e79 100644 --- a/src/test/COMPILER_TESTS.md +++ b/src/test/COMPILER_TESTS.md @@ -35,20 +35,24 @@ The error levels that you can have are: ## Summary of Header Commands Header commands specify something about the entire test file as a -whole, instead of just a few lines inside the test. +whole. They are normally put right after the copyright comment, e.g.: + +```Rust +// Copyright blah blah blah +// except according to those terms. + +// ignore-test This doesn't actually work +``` + +### Ignoring tests + +These are used to ignore the test in some situations, which means the test won't +be compiled or run. * `ignore-X` where `X` is a target detail or stage will ignore the test accordingly (see below) * `ignore-pretty` will not compile the pretty-printed test (this is done to test the pretty-printer, but might not always work) * `ignore-test` always ignores the test -* `ignore-lldb` and `ignore-gdb` will skip the debuginfo tests -* `min-{gdb,lldb}-version` -* `should-fail` indicates that the test should fail; used for "meta testing", - where we test the compiletest program itself to check that it will generate - errors in appropriate scenarios. This header is ignored for pretty-printer tests. -* `gate-test-X` where `X` is a feature marks the test as "gate test" for feature X. - Such tests are supposed to ensure that the compiler errors when usage of a gated - feature is attempted without the proper `#![feature(X)]` tag. - Each unstable lang feature is required to have a gate test. +* `ignore-lldb` and `ignore-gdb` will skip a debuginfo test on that debugger. Some examples of `X` in `ignore-X`: @@ -58,6 +62,22 @@ Some examples of `X` in `ignore-X`: * Pointer width: `32bit`, `64bit`. * Stage: `stage0`, `stage1`, `stage2`. +### Other Header Commands + +* `min-{gdb,lldb}-version` +* `min-llvm-version` +* `must-compile-successfully` for UI tests, indicates that the test is supposed + to compile, as opposed to the default where the test is supposed to error out. +* `compile-flags` passes extra command-line args to the compiler, + e.g. `compile-flags -g` which forces debuginfo to be enabled. +* `should-fail` indicates that the test should fail; used for "meta testing", + where we test the compiletest program itself to check that it will generate + errors in appropriate scenarios. This header is ignored for pretty-printer tests. +* `gate-test-X` where `X` is a feature marks the test as "gate test" for feature X. + Such tests are supposed to ensure that the compiler errors when usage of a gated + feature is attempted without the proper `#![feature(X)]` tag. + Each unstable lang feature is required to have a gate test. + ## Revisions Certain classes of tests support "revisions" (as of the time of this @@ -106,9 +126,15 @@ result is then compared against reference files named those files doesn't exist, the output must be empty. If the test run fails, we will print out the current output, but it is also saved in `build//test/ui/hello_world/main.stdout` (this path is -printed as part of the test failure mesage), so you can run `diff` and +printed as part of the test failure message), so you can run `diff` and so forth. +Normally, the test-runner checks that UI tests fail compilation. If you want +to do a UI test for code that *compiles* (e.g. to test warnings, or if you +have a collection of tests, only some of which error out), you can use the +`// must-compile-successfully` header command to have the test runner instead +check that the test compiles successfully. + ### Editing and updating the reference files If you have changed the compiler's output intentionally, or you are @@ -133,13 +159,15 @@ Sometimes these built-in normalizations are not enough. In such cases, you may provide custom normalization rules using the header commands, e.g. ``` -// normalize-stderr-32bit: "fn() (32 bits)" -> "fn() ($PTR bits)" -// normalize-stderr-64bit: "fn() (64 bits)" -> "fn() ($PTR bits)" +// normalize-stdout-test: "foo" -> "bar" +// normalize-stderr-32bit: "fn\(\) \(32 bits\)" -> "fn\(\) \($$PTR bits\)" +// normalize-stderr-64bit: "fn\(\) \(64 bits\)" -> "fn\(\) \($$PTR bits\)" ``` This tells the test, on 32-bit platforms, whenever the compiler writes `fn() (32 bits)` to stderr, it should be normalized to read `fn() ($PTR bits)` -instead. Similar for 64-bit. +instead. Similar for 64-bit. The replacement is performed by regexes using +default regex flavor provided by `regex` crate. The corresponding reference file will use the normalized output to test both 32-bit and 64-bit platforms: @@ -156,4 +184,5 @@ Please see `ui/transmute/main.rs` and `.stderr` for a concrete usage example. Besides `normalize-stderr-32bit` and `-64bit`, one may use any target information or stage supported by `ignore-X` here as well (e.g. -`normalize-stderr-windows`). +`normalize-stderr-windows` or simply `normalize-stderr-test` for unconditional +replacement). diff --git a/src/test/codegen-units/item-collection/cross-crate-closures.rs b/src/test/codegen-units/item-collection/cross-crate-closures.rs index 2b5ac7e8d8..320be27819 100644 --- a/src/test/codegen-units/item-collection/cross-crate-closures.rs +++ b/src/test/codegen-units/item-collection/cross-crate-closures.rs @@ -17,12 +17,14 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] // aux-build:cgu_extern_closures.rs extern crate cgu_extern_closures; -//~ TRANS_ITEM fn cross_crate_closures::main[0] -fn main() { +//~ TRANS_ITEM fn cross_crate_closures::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn cgu_extern_closures::inlined_fn[0] //~ TRANS_ITEM fn cgu_extern_closures::inlined_fn[0]::{{closure}}[0] @@ -35,6 +37,8 @@ fn main() { // Nothing should be generated for this call, we just link to the instance // in the extern crate. let _ = cgu_extern_closures::non_inlined_fn(6, 7); + + 0 } //~ TRANS_ITEM drop-glue i8 diff --git a/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs b/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs index eb4f9e8e28..bcb3b7b1da 100644 --- a/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs +++ b/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs @@ -12,13 +12,14 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] // aux-build:cgu_generic_function.rs extern crate cgu_generic_function; -//~ TRANS_ITEM fn cross_crate_generic_functions::main[0] -fn main() -{ +//~ TRANS_ITEM fn cross_crate_generic_functions::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn cgu_generic_function::bar[0] //~ TRANS_ITEM fn cgu_generic_function::foo[0] let _ = cgu_generic_function::foo(1u32); @@ -29,4 +30,6 @@ fn main() // This should not introduce a codegen item let _ = cgu_generic_function::exported_but_not_generic(3); + + 0 } diff --git a/src/test/codegen-units/item-collection/cross-crate-trait-method.rs b/src/test/codegen-units/item-collection/cross-crate-trait-method.rs index 195125793b..910ae00084 100644 --- a/src/test/codegen-units/item-collection/cross-crate-trait-method.rs +++ b/src/test/codegen-units/item-collection/cross-crate-trait-method.rs @@ -12,15 +12,16 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] // aux-build:cgu_export_trait_method.rs extern crate cgu_export_trait_method; use cgu_export_trait_method::Trait; -//~ TRANS_ITEM fn cross_crate_trait_method::main[0] -fn main() -{ +//~ TRANS_ITEM fn cross_crate_trait_method::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { // The object code of these methods is contained in the external crate, so // calling them should *not* introduce codegen items in the current crate. let _: (u32, u32) = Trait::without_default_impl(0); @@ -55,4 +56,6 @@ fn main() let _: (char, char) = Trait::without_default_impl_generic('c'); //~ TRANS_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0] let _: (char, bool) = Trait::without_default_impl_generic(false); + + 0 } diff --git a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs index b8033b88fb..52af816503 100644 --- a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs +++ b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs @@ -12,6 +12,8 @@ // compile-flags:-Zprint-trans-items=eager // compile-flags:-Zinline-in-all-cgus +#![feature(start)] + //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ drop_in_place_intrinsic0[Internal] struct StructWithDtor(u32); @@ -20,13 +22,16 @@ impl Drop for StructWithDtor { fn drop(&mut self) {} } -//~ TRANS_ITEM fn drop_in_place_intrinsic::main[0] -fn main() { +//~ TRANS_ITEM fn drop_in_place_intrinsic::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic0[Internal] let x = [StructWithDtor(0), StructWithDtor(1)]; drop_slice_in_place(&x); + + 0 } //~ TRANS_ITEM fn drop_in_place_intrinsic::drop_slice_in_place[0] diff --git a/src/test/codegen-units/item-collection/function-as-argument.rs b/src/test/codegen-units/item-collection/function-as-argument.rs index c3d46ff531..65707c1aa4 100644 --- a/src/test/codegen-units/item-collection/function-as-argument.rs +++ b/src/test/codegen-units/item-collection/function-as-argument.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] fn take_fn_once(f: F, x: T1, y: T2) { (f)(x, y) @@ -23,8 +24,9 @@ fn take_fn_pointer(f: fn(T1, T2), x: T1, y: T2) { (f)(x, y) } -//~ TRANS_ITEM fn function_as_argument::main[0] -fn main() { +//~ TRANS_ITEM fn function_as_argument::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn function_as_argument::take_fn_once[0] //~ TRANS_ITEM fn function_as_argument::function[0] @@ -43,4 +45,6 @@ fn main() { //~ TRANS_ITEM fn function_as_argument::take_fn_pointer[0] //~ TRANS_ITEM fn function_as_argument::function[0] take_fn_pointer(function, 0f32, 0i64); + + 0 } diff --git a/src/test/codegen-units/item-collection/generic-drop-glue.rs b/src/test/codegen-units/item-collection/generic-drop-glue.rs index 65936d12e3..d3d9aa3aef 100644 --- a/src/test/codegen-units/item-collection/generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/generic-drop-glue.rs @@ -13,6 +13,7 @@ // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] +#![feature(start)] struct StructWithDrop { x: T1, @@ -53,8 +54,9 @@ impl Drop for NonGenericWithDrop { fn drop(&mut self) {} } -//~ TRANS_ITEM fn generic_drop_glue::main[0] -fn main() { +//~ TRANS_ITEM fn generic_drop_glue::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue0[Internal] //~ TRANS_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0] let _ = StructWithDrop { x: 0i8, y: 'a' }.x; @@ -94,4 +96,6 @@ fn main() { EnumNoDrop::A(x) => x, EnumNoDrop::B(x) => x as f64 }; + + 0 } diff --git a/src/test/codegen-units/item-collection/generic-functions.rs b/src/test/codegen-units/item-collection/generic-functions.rs index afe6ffc8bf..8efe4b2762 100644 --- a/src/test/codegen-units/item-collection/generic-functions.rs +++ b/src/test/codegen-units/item-collection/generic-functions.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] fn foo1(a: T1) -> (T1, u32) { (a, 1) @@ -31,8 +32,9 @@ pub fn lifetime_only<'a>(a: &'a u32) -> &'a u32 { a } -//~ TRANS_ITEM fn generic_functions::main[0] -fn main() { +//~ TRANS_ITEM fn generic_functions::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn generic_functions::foo1[0] let _ = foo1(2i32); //~ TRANS_ITEM fn generic_functions::foo1[0] @@ -59,4 +61,6 @@ fn main() { let _ = foo3(0i16, "a", 2usize); //~ TRANS_ITEM fn generic_functions::foo3[0] let _ = foo3('v', (), ()); + + 0 } diff --git a/src/test/codegen-units/item-collection/generic-impl.rs b/src/test/codegen-units/item-collection/generic-impl.rs index 14316a5573..d1ee8ee624 100644 --- a/src/test/codegen-units/item-collection/generic-impl.rs +++ b/src/test/codegen-units/item-collection/generic-impl.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] struct Struct { x: T, @@ -50,9 +51,9 @@ impl<'a> LifeTimeOnly<'a> { pub fn non_instantiated(&self) {} } - -//~ TRANS_ITEM fn generic_impl::main[0] -fn main() { +//~ TRANS_ITEM fn generic_impl::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0] //~ TRANS_ITEM fn generic_impl::id[0] //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::get[0] @@ -76,4 +77,6 @@ fn main() { //~ TRANS_ITEM fn generic_impl::{{impl}}[0]::new[0]> //~ TRANS_ITEM fn generic_impl::id[0]> let _ = (Struct::new(Struct::new("str")).f)(Struct::new("str")); + + 0 } diff --git a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs index c43c254f33..c07d26c3f8 100644 --- a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs +++ b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] trait SomeTrait { fn foo(&self); @@ -28,7 +29,10 @@ pub fn generic_function(x: T) -> (T, i32) { (x, 0) } -//~ TRANS_ITEM fn impl_in_non_instantiated_generic::main[0] -fn main() { +//~ TRANS_ITEM fn impl_in_non_instantiated_generic::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { 0i64.foo(); + + 0 } diff --git a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs index e32366d15c..2e1138ef12 100644 --- a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs +++ b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs @@ -13,6 +13,7 @@ // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] +#![feature(start)] trait Trait { fn foo(&self) -> u32; @@ -28,8 +29,9 @@ impl Trait for Struct { fn bar(&self) {} } -//~ TRANS_ITEM fn instantiation_through_vtable::main[0] -fn main() { +//~ TRANS_ITEM fn instantiation_through_vtable::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let s1 = Struct { _a: 0u32 }; //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable0[Internal] @@ -42,4 +44,6 @@ fn main() { //~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] //~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] let _ = &s1 as &Trait; + + 0 } diff --git a/src/test/codegen-units/item-collection/items-within-generic-items.rs b/src/test/codegen-units/item-collection/items-within-generic-items.rs index 75d842d3c0..04b54de3ce 100644 --- a/src/test/codegen-units/item-collection/items-within-generic-items.rs +++ b/src/test/codegen-units/item-collection/items-within-generic-items.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] fn generic_fn(a: T) -> (T, i32) { //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0]::nested_fn[0] @@ -31,12 +32,15 @@ fn generic_fn(a: T) -> (T, i32) { return (a, x + nested_fn(0)); } -//~ TRANS_ITEM fn items_within_generic_items::main[0] -fn main() { +//~ TRANS_ITEM fn items_within_generic_items::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0] let _ = generic_fn(0i64); //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0] let _ = generic_fn(0u16); //~ TRANS_ITEM fn items_within_generic_items::generic_fn[0] let _ = generic_fn(0i8); + + 0 } diff --git a/src/test/codegen-units/item-collection/non-generic-closures.rs b/src/test/codegen-units/item-collection/non-generic-closures.rs index 278e9189dd..f0121d56ce 100644 --- a/src/test/codegen-units/item-collection/non-generic-closures.rs +++ b/src/test/codegen-units/item-collection/non-generic-closures.rs @@ -17,6 +17,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] //~ TRANS_ITEM fn non_generic_closures::temporary[0] fn temporary() { @@ -52,12 +53,15 @@ fn assigned_to_variable_executed_directly() { f(4); } -//~ TRANS_ITEM fn non_generic_closures::main[0] -fn main() { +//~ TRANS_ITEM fn non_generic_closures::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { temporary(); assigned_to_variable_but_not_executed(); assigned_to_variable_executed_directly(); assigned_to_variable_executed_indirectly(); + + 0 } //~ TRANS_ITEM fn non_generic_closures::run_closure[0] diff --git a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs index 5765f230e8..bf084aa96e 100644 --- a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs @@ -13,6 +13,7 @@ // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] +#![feature(start)] //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue0[Internal] struct StructWithDrop { @@ -42,8 +43,9 @@ enum EnumNoDrop { A(i32) } -//~ TRANS_ITEM fn non_generic_drop_glue::main[0] -fn main() { +//~ TRANS_ITEM fn non_generic_drop_glue::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _ = StructWithDrop { x: 0 }.x; let _ = StructNoDrop { x: 0 }.x; let _ = match EnumWithDrop::A(0) { @@ -52,4 +54,6 @@ fn main() { let _ = match EnumNoDrop::A(0) { EnumNoDrop::A(x) => x }; + + 0 } diff --git a/src/test/codegen-units/item-collection/non-generic-functions.rs b/src/test/codegen-units/item-collection/non-generic-functions.rs index 26f9eb1187..8c487db5c9 100644 --- a/src/test/codegen-units/item-collection/non-generic-functions.rs +++ b/src/test/codegen-units/item-collection/non-generic-functions.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] //~ TRANS_ITEM fn non_generic_functions::foo[0] fn foo() { @@ -69,11 +70,14 @@ impl Struct { } } -//~ TRANS_ITEM fn non_generic_functions::main[0] -fn main() { +//~ TRANS_ITEM fn non_generic_functions::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { foo(); bar(); Struct::foo(); let x = Struct { _x: 0 }; x.bar(); + + 0 } diff --git a/src/test/codegen-units/item-collection/static-init.rs b/src/test/codegen-units/item-collection/static-init.rs index 3c9dcf32e0..5ff7c3480b 100644 --- a/src/test/codegen-units/item-collection/static-init.rs +++ b/src/test/codegen-units/item-collection/static-init.rs @@ -9,6 +9,9 @@ // except according to those terms. // compile-flags:-Zprint-trans-items=eager +// ignore-tidy-linelength + +#![feature(start)] pub static FN : fn() = foo::; @@ -17,6 +20,9 @@ pub fn foo() { } //~ TRANS_ITEM fn static_init::foo[0] //~ TRANS_ITEM static static_init::FN[0] -fn main() { } +//~ TRANS_ITEM fn static_init::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { + 0 +} -//~ TRANS_ITEM fn static_init::main[0] diff --git a/src/test/codegen-units/item-collection/statics-and-consts.rs b/src/test/codegen-units/item-collection/statics-and-consts.rs index 89bc620b7c..11df1da3a7 100644 --- a/src/test/codegen-units/item-collection/statics-and-consts.rs +++ b/src/test/codegen-units/item-collection/statics-and-consts.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] static STATIC1: i64 = { const STATIC1_CONST1: i64 = 2; @@ -47,9 +48,13 @@ fn foo() { }; } -fn main() { +//~ TRANS_ITEM fn statics_and_consts::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { foo(); let _ = STATIC1; + + 0 } //~ TRANS_ITEM static statics_and_consts::STATIC1[0] @@ -58,5 +63,3 @@ fn main() { //~ TRANS_ITEM static statics_and_consts::foo[0]::STATIC2[0] //~ TRANS_ITEM static statics_and_consts::foo[0]::STATIC2[1] //~ TRANS_ITEM static statics_and_consts::foo[0]::STATIC2[2] - -//~ TRANS_ITEM fn statics_and_consts::main[0] diff --git a/src/test/codegen-units/item-collection/trait-implementations.rs b/src/test/codegen-units/item-collection/trait-implementations.rs index e8a7d8f25b..8eb33dd647 100644 --- a/src/test/codegen-units/item-collection/trait-implementations.rs +++ b/src/test/codegen-units/item-collection/trait-implementations.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] pub trait SomeTrait { fn foo(&self); @@ -55,8 +56,9 @@ impl SomeGenericTrait for f32 { fn bar(&self, _: T, _: T2) {} } -//~ TRANS_ITEM fn trait_implementations::main[0] -fn main() { +//~ TRANS_ITEM fn trait_implementations::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn trait_implementations::{{impl}}[1]::bar[0] 0i32.bar('x'); @@ -77,4 +79,6 @@ fn main() { //~ TRANS_ITEM fn trait_implementations::{{impl}}[3]::bar[0]<&str, &str> 0f32.bar("&str", "&str"); + + 0 } diff --git a/src/test/codegen-units/item-collection/trait-method-as-argument.rs b/src/test/codegen-units/item-collection/trait-method-as-argument.rs index 21c9c254e5..10b2163030 100644 --- a/src/test/codegen-units/item-collection/trait-method-as-argument.rs +++ b/src/test/codegen-units/item-collection/trait-method-as-argument.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] trait Trait : Sized { fn foo(self) -> Self { self } @@ -36,8 +37,9 @@ fn take_foo_mut T>(mut f: F, arg: T) -> T { (f)(arg) } -//~ TRANS_ITEM fn trait_method_as_argument::main[0] -fn main() { +//~ TRANS_ITEM fn trait_method_as_argument::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn trait_method_as_argument::take_foo_once[0] u32> //~ TRANS_ITEM fn trait_method_as_argument::{{impl}}[0]::foo[0] //~ TRANS_ITEM fn core::ops[0]::function[0]::FnOnce[0]::call_once[0] u32, (u32)> @@ -63,4 +65,6 @@ fn main() { //~ TRANS_ITEM fn trait_method_as_argument::take_foo_mut[0] char> //~ TRANS_ITEM fn core::ops[0]::function[0]::FnMut[0]::call_mut[0] u32, (u32)> take_foo_mut(Trait::foo, 'c'); + + 0 } diff --git a/src/test/codegen-units/item-collection/trait-method-default-impl.rs b/src/test/codegen-units/item-collection/trait-method-default-impl.rs index 5b24a219f3..a6ae3765b2 100644 --- a/src/test/codegen-units/item-collection/trait-method-default-impl.rs +++ b/src/test/codegen-units/item-collection/trait-method-default-impl.rs @@ -12,6 +12,7 @@ // compile-flags:-Zprint-trans-items=eager #![deny(dead_code)] +#![feature(start)] trait SomeTrait { fn foo(&self) { } @@ -46,8 +47,9 @@ impl SomeGenericTrait for u32 { // since nothing is monomorphic here, nothing should be generated unless used somewhere. } -//~ TRANS_ITEM fn trait_method_default_impl::main[0] -fn main() { +//~ TRANS_ITEM fn trait_method_default_impl::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn trait_method_default_impl::SomeTrait[0]::bar[0] let _ = 1i8.bar('c'); @@ -65,4 +67,6 @@ fn main() { //~ TRANS_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0] 0u32.bar(0i16, ()); + + 0 } diff --git a/src/test/codegen-units/item-collection/transitive-drop-glue.rs b/src/test/codegen-units/item-collection/transitive-drop-glue.rs index be560690e5..57cd10187a 100644 --- a/src/test/codegen-units/item-collection/transitive-drop-glue.rs +++ b/src/test/codegen-units/item-collection/transitive-drop-glue.rs @@ -13,6 +13,7 @@ // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] +#![feature(start)] //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue0[Internal] struct Root(Intermediate); @@ -34,9 +35,9 @@ impl Drop for LeafGen { fn drop(&mut self) {} } -//~ TRANS_ITEM fn transitive_drop_glue::main[0] -fn main() { - +//~ TRANS_ITEM fn transitive_drop_glue::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _ = Root(Intermediate(Leaf)); //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] @@ -50,4 +51,6 @@ fn main() { //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue0[Internal] //~ TRANS_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] let _ = RootGen(IntermediateGen(LeafGen(0i16))); + + 0 } diff --git a/src/test/codegen-units/item-collection/tuple-drop-glue.rs b/src/test/codegen-units/item-collection/tuple-drop-glue.rs index ad1475a73f..a5f2409b8a 100644 --- a/src/test/codegen-units/item-collection/tuple-drop-glue.rs +++ b/src/test/codegen-units/item-collection/tuple-drop-glue.rs @@ -13,6 +13,7 @@ // compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] +#![feature(start)] //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ tuple_drop_glue0[Internal] struct Dropped; @@ -22,12 +23,15 @@ impl Drop for Dropped { fn drop(&mut self) {} } -//~ TRANS_ITEM fn tuple_drop_glue::main[0] -fn main() { +//~ TRANS_ITEM fn tuple_drop_glue::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue0[Internal] let x = (0u32, Dropped); //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue0[Internal] //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue0[Internal] let x = (0i16, (Dropped, true)); + + 0 } diff --git a/src/test/codegen-units/item-collection/unsizing.rs b/src/test/codegen-units/item-collection/unsizing.rs index d7e457cde8..87d2581e1f 100644 --- a/src/test/codegen-units/item-collection/unsizing.rs +++ b/src/test/codegen-units/item-collection/unsizing.rs @@ -15,6 +15,7 @@ #![deny(dead_code)] #![feature(coerce_unsized)] #![feature(unsize)] +#![feature(start)] use std::marker::Unsize; use std::ops::CoerceUnsized; @@ -53,9 +54,9 @@ struct Wrapper(*const T); impl, U: ?Sized> CoerceUnsized> for Wrapper {} -//~ TRANS_ITEM fn unsizing::main[0] -fn main() -{ +//~ TRANS_ITEM fn unsizing::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { // simple case let bool_sized = &true; //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] @@ -83,4 +84,6 @@ fn main() //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing0[Internal] //~ TRANS_ITEM fn unsizing::{{impl}}[3]::foo[0] let _wrapper_sized = wrapper_sized as Wrapper; + + 0 } diff --git a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs index 1ea5aafd40..aa01289de5 100644 --- a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs +++ b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs @@ -19,6 +19,7 @@ // compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/methods-are-with-self-type #![allow(dead_code)] +#![feature(start)] struct SomeType; @@ -63,9 +64,9 @@ mod type2 { pub struct Struct; } -//~ TRANS_ITEM fn methods_are_with_self_type::main[0] -fn main() -{ +//~ TRANS_ITEM fn methods_are_with_self_type::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::method[0] @@ methods_are_with_self_type.volatile[WeakODR] SomeGenericType(0u32, 0u64).method(); //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::associated_fn[0] @@ methods_are_with_self_type.volatile[WeakODR] @@ -80,6 +81,8 @@ fn main() type1::Struct.default(); //~ TRANS_ITEM fn methods_are_with_self_type::Trait[0]::default[0] @@ methods_are_with_self_type-type2.volatile[WeakODR] type2::Struct.default(); + + 0 } //~ TRANS_ITEM drop-glue i8 diff --git a/src/test/codegen-units/partitioning/vtable-through-const.rs b/src/test/codegen-units/partitioning/vtable-through-const.rs index 302f9312b5..d0acddda63 100644 --- a/src/test/codegen-units/partitioning/vtable-through-const.rs +++ b/src/test/codegen-units/partitioning/vtable-through-const.rs @@ -18,6 +18,8 @@ // This test case makes sure, that references made through constants are // recorded properly in the InliningMap. +#![feature(start)] + mod mod1 { pub trait Trait1 { fn do_something(&self) {} @@ -38,7 +40,7 @@ mod mod1 { fn id(x: T) -> T { x } - // These are referenced, so they produce trans-items (see main()) + // These are referenced, so they produce trans-items (see start()) pub const TRAIT1_REF: &'static Trait1 = &0u32 as &Trait1; pub const TRAIT1_GEN_REF: &'static Trait1Gen = &0u32 as &Trait1Gen; pub const ID_CHAR: fn(char) -> char = id::; @@ -68,8 +70,9 @@ mod mod1 { pub const ID_I64: fn(i64) -> i64 = id::; } -//~ TRANS_ITEM fn vtable_through_const::main[0] @@ vtable_through_const[Internal] -fn main() { +//~ TRANS_ITEM fn vtable_through_const::start[0] +#[start] +fn start(_: isize, _: *const *const u8) -> isize { //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0] @@ vtable_through_const[Internal] // Since Trait1::do_something() is instantiated via its default implementation, @@ -90,4 +93,6 @@ fn main() { //~ TRANS_ITEM fn vtable_through_const::mod1[0]::id[0] @@ vtable_through_const-mod1.volatile[External] mod1::ID_CHAR('x'); + + 0 } diff --git a/src/test/codegen/abi-sysv64.rs b/src/test/codegen/abi-sysv64.rs index 4f6a50eab4..920f5cbcca 100644 --- a/src/test/codegen/abi-sysv64.rs +++ b/src/test/codegen/abi-sysv64.rs @@ -18,7 +18,6 @@ // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] -#![feature(abi_sysv64)] // CHECK: define x86_64_sysvcc i64 @has_sysv64_abi #[no_mangle] diff --git a/src/test/codegen/adjustments.rs b/src/test/codegen/adjustments.rs index 342a4f0d08..2b35d45473 100644 --- a/src/test/codegen/adjustments.rs +++ b/src/test/codegen/adjustments.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -C no-prepopulate-passes +// ignore-tidy-linelength #![crate_type = "lib"] @@ -23,9 +24,9 @@ pub fn helper(_: usize) { pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] { // We used to generate an extra alloca and memcpy for the block's trailing expression value, so // check that we copy directly to the return value slot -// CHECK: %0 = insertvalue { i8*, [[USIZE]] } undef, i8* %x.ptr, 0 -// CHECK: %1 = insertvalue { i8*, [[USIZE]] } %0, [[USIZE]] %x.meta, 1 -// CHECK: ret { i8*, [[USIZE]] } %1 +// CHECK: %0 = insertvalue { [0 x i8]*, [[USIZE]] } undef, [0 x i8]* %x.0, 0 +// CHECK: %1 = insertvalue { [0 x i8]*, [[USIZE]] } %0, [[USIZE]] %x.1, 1 +// CHECK: ret { [0 x i8]*, [[USIZE]] } %1 { x } } diff --git a/src/test/codegen/align-struct.rs b/src/test/codegen/align-struct.rs index ba81e2d604..ab9f5dda3a 100644 --- a/src/test/codegen/align-struct.rs +++ b/src/test/codegen/align-struct.rs @@ -9,6 +9,8 @@ // except according to those terms. // compile-flags: -C no-prepopulate-passes +// ignore-tidy-linelength + #![crate_type = "lib"] #![feature(attr_literals)] @@ -16,6 +18,7 @@ #[repr(align(64))] pub struct Align64(i32); +// CHECK: %Align64 = type { [0 x i32], i32, [15 x i32] } pub struct Nested64 { a: Align64, @@ -23,11 +26,21 @@ pub struct Nested64 { c: i32, d: i8, } +// CHECK: %Nested64 = type { [0 x i64], %Align64, [0 x i32], i32, [0 x i32], i32, [0 x i8], i8, [55 x i8] } + +pub enum Enum4 { + A(i32), + B(i32), +} +// CHECK: %Enum4 = type { [0 x i32], i32, [1 x i32] } +// CHECK: %"Enum4::A" = type { [1 x i32], i32, [0 x i32] } pub enum Enum64 { A(Align64), B(i32), } +// CHECK: %Enum64 = type { [0 x i32], i32, [31 x i32] } +// CHECK: %"Enum64::A" = type { [8 x i64], %Align64, [0 x i64] } // CHECK-LABEL: @align64 #[no_mangle] @@ -46,6 +59,14 @@ pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 { n64 } +// CHECK-LABEL: @enum4 +#[no_mangle] +pub fn enum4(a: i32) -> Enum4 { +// CHECK: %e4 = alloca %Enum4, align 4 + let e4 = Enum4::A(a); + e4 +} + // CHECK-LABEL: @enum64 #[no_mangle] pub fn enum64(a: Align64) -> Enum64 { diff --git a/src/test/codegen/consts.rs b/src/test/codegen/consts.rs index 33b4221b73..a75b8f3992 100644 --- a/src/test/codegen/consts.rs +++ b/src/test/codegen/consts.rs @@ -54,7 +54,7 @@ pub fn inline_enum_const() -> E { #[no_mangle] pub fn low_align_const() -> E { // Check that low_align_const and high_align_const use the same constant -// CHECK: load {{.*}} bitcast ({ i16, i16, [4 x i8] }** [[LOW_HIGH_REF]] +// CHECK: load {{.*}} bitcast ({ i16, [0 x i8], i16, [4 x i8] }** [[LOW_HIGH_REF]] *&E::A(0) } @@ -62,6 +62,6 @@ pub fn low_align_const() -> E { #[no_mangle] pub fn high_align_const() -> E { // Check that low_align_const and high_align_const use the same constant -// CHECK: load {{.*}} bitcast ({ i16, i16, [4 x i8] }** [[LOW_HIGH_REF]] +// CHECK: load {{.*}} bitcast ({ i16, [0 x i8], i16, [4 x i8] }** [[LOW_HIGH_REF]] *&E::A(0) } diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index 29e2840c88..0e98d3f905 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -9,12 +9,13 @@ // except according to those terms. // compile-flags: -C no-prepopulate-passes +// ignore-tidy-linelength #![crate_type = "lib"] #![feature(custom_attribute)] pub struct S { - _field: [i64; 4], + _field: [i32; 8], } pub struct UnsafeInner { @@ -45,13 +46,13 @@ pub fn static_borrow(_: &'static i32) { pub fn named_borrow<'r>(_: &'r i32) { } -// CHECK: @unsafe_borrow(%UnsafeInner* dereferenceable(2) %arg0) +// CHECK: @unsafe_borrow(i16* dereferenceable(2) %arg0) // unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] pub fn unsafe_borrow(_: &UnsafeInner) { } -// CHECK: @mutable_unsafe_borrow(%UnsafeInner* dereferenceable(2) %arg0) +// CHECK: @mutable_unsafe_borrow(i16* dereferenceable(2) %arg0) // ... unless this is a mutable borrow, those never alias // ... except that there's this LLVM bug that forces us to not use noalias, see #29485 #[no_mangle] @@ -76,7 +77,7 @@ pub fn indirect_struct(_: S) { pub fn borrowed_struct(_: &S) { } -// CHECK: noalias dereferenceable(4) i32* @_box(i32* noalias dereferenceable(4) %x) +// CHECK: noalias align 4 dereferenceable(4) i32* @_box(i32* noalias dereferenceable(4) %x) #[no_mangle] pub fn _box(x: Box) -> Box { x @@ -86,7 +87,7 @@ pub fn _box(x: Box) -> Box { #[no_mangle] pub fn struct_return() -> S { S { - _field: [0, 0, 0, 0] + _field: [0, 0, 0, 0, 0, 0, 0, 0] } } @@ -96,32 +97,32 @@ pub fn struct_return() -> S { pub fn helper(_: usize) { } -// CHECK: @slice(i8* noalias nonnull readonly %arg0.ptr, [[USIZE]] %arg0.meta) +// CHECK: @slice([0 x i8]* noalias nonnull readonly %arg0.0, [[USIZE]] %arg0.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn slice(_: &[u8]) { } -// CHECK: @mutable_slice(i8* nonnull %arg0.ptr, [[USIZE]] %arg0.meta) +// CHECK: @mutable_slice([0 x i8]* nonnull %arg0.0, [[USIZE]] %arg0.1) // FIXME #25759 This should also have `nocapture` // ... there's this LLVM bug that forces us to not use noalias, see #29485 #[no_mangle] pub fn mutable_slice(_: &mut [u8]) { } -// CHECK: @unsafe_slice(%UnsafeInner* nonnull %arg0.ptr, [[USIZE]] %arg0.meta) +// CHECK: @unsafe_slice([0 x i16]* nonnull %arg0.0, [[USIZE]] %arg0.1) // unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] pub fn unsafe_slice(_: &[UnsafeInner]) { } -// CHECK: @str(i8* noalias nonnull readonly %arg0.ptr, [[USIZE]] %arg0.meta) +// CHECK: @str([0 x i8]* noalias nonnull readonly %arg0.0, [[USIZE]] %arg0.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn str(_: &[u8]) { } -// CHECK: @trait_borrow({}* nonnull, {}* noalias nonnull readonly) +// CHECK: @trait_borrow({}* nonnull %arg0.0, {}* noalias nonnull readonly %arg0.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn trait_borrow(_: &Drop) { @@ -132,7 +133,7 @@ pub fn trait_borrow(_: &Drop) { pub fn trait_box(_: Box) { } -// CHECK: { i16*, [[USIZE]] } @return_slice(i16* noalias nonnull readonly %x.ptr, [[USIZE]] %x.meta) +// CHECK: { [0 x i16]*, [[USIZE]] } @return_slice([0 x i16]* noalias nonnull readonly %x.0, [[USIZE]] %x.1) #[no_mangle] pub fn return_slice(x: &[u16]) -> &[u16] { x diff --git a/src/test/codegen/issue-32031.rs b/src/test/codegen/issue-32031.rs index 5d3ccbfa4c..e5ec173854 100644 --- a/src/test/codegen/issue-32031.rs +++ b/src/test/codegen/issue-32031.rs @@ -15,7 +15,7 @@ #[no_mangle] pub struct F32(f32); -// CHECK: define float @add_newtype_f32(float, float) +// CHECK: define float @add_newtype_f32(float %a, float %b) #[inline(never)] #[no_mangle] pub fn add_newtype_f32(a: F32, b: F32) -> F32 { @@ -25,7 +25,7 @@ pub fn add_newtype_f32(a: F32, b: F32) -> F32 { #[no_mangle] pub struct F64(f64); -// CHECK: define double @add_newtype_f64(double, double) +// CHECK: define double @add_newtype_f64(double %a, double %b) #[inline(never)] #[no_mangle] pub fn add_newtype_f64(a: F64, b: F64) -> F64 { diff --git a/src/test/codegen/issue-47278.rs b/src/test/codegen/issue-47278.rs new file mode 100644 index 0000000000..21858b434b --- /dev/null +++ b/src/test/codegen/issue-47278.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// -C no-prepopulate-passes +#![crate_type="staticlib"] + +#[repr(C)] +pub struct Foo(u64); + +// CHECK: define {{.*}} @foo( +#[no_mangle] +pub extern fn foo(_: Foo) -> Foo { loop {} } diff --git a/src/test/codegen/link-dead-code.rs b/src/test/codegen/link-dead-code.rs new file mode 100644 index 0000000000..9cabcd9157 --- /dev/null +++ b/src/test/codegen/link-dead-code.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Clink-dead-code + +#![feature(const_fn)] +#![crate_type = "rlib"] + +// This test makes sure that, when -Clink-dead-code is specified, we generate +// code for functions that would otherwise be skipped. + +// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code8const_fn +const fn const_fn() -> i32 { 1 } + +// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code9inline_fn +#[inline] +fn inline_fn() -> i32 { 2 } + +// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code10private_fn +fn private_fn() -> i32 { 3 } diff --git a/src/test/codegen/link_section.rs b/src/test/codegen/link_section.rs index 98214dc5c6..1879002e7f 100644 --- a/src/test/codegen/link_section.rs +++ b/src/test/codegen/link_section.rs @@ -22,12 +22,12 @@ pub enum E { B(f32) } -// CHECK: @VAR2 = constant {{.*}} { i32 0, i32 666 }, section ".test_two" +// CHECK: @VAR2 = constant {{.*}}, section ".test_two" #[no_mangle] #[link_section = ".test_two"] pub static VAR2: E = E::A(666); -// CHECK: @VAR3 = constant {{.*}} { i32 1, float 1.000000e+00 }, section ".test_three" +// CHECK: @VAR3 = constant {{.*}}, section ".test_three" #[no_mangle] #[link_section = ".test_three"] pub static VAR3: E = E::B(1.); diff --git a/src/test/codegen/match-optimizes-away.rs b/src/test/codegen/match-optimizes-away.rs index c0f2f64f82..d7b7793743 100644 --- a/src/test/codegen/match-optimizes-away.rs +++ b/src/test/codegen/match-optimizes-away.rs @@ -12,11 +12,9 @@ // compile-flags: -O #![crate_type="lib"] -pub enum Three { First, Second, Third } -use Three::*; +pub enum Three { A, B, C } -pub enum Four { First, Second, Third, Fourth } -use Four::*; +pub enum Four { A, B, C, D } #[no_mangle] pub fn three_valued(x: Three) -> Three { @@ -24,9 +22,9 @@ pub fn three_valued(x: Three) -> Three { // CHECK-NEXT: {{^.*:$}} // CHECK-NEXT: ret i8 %0 match x { - First => First, - Second => Second, - Third => Third, + Three::A => Three::A, + Three::B => Three::B, + Three::C => Three::C, } } @@ -36,9 +34,9 @@ pub fn four_valued(x: Four) -> Four { // CHECK-NEXT: {{^.*:$}} // CHECK-NEXT: ret i8 %0 match x { - First => First, - Second => Second, - Third => Third, - Fourth => Fourth, + Four::A => Four::A, + Four::B => Four::B, + Four::C => Four::C, + Four::D => Four::D, } } diff --git a/src/test/codegen/nontemporal.rs b/src/test/codegen/nontemporal.rs new file mode 100644 index 0000000000..28ec534b97 --- /dev/null +++ b/src/test/codegen/nontemporal.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -O + +#![feature(core_intrinsics)] +#![crate_type = "lib"] + +#[no_mangle] +pub fn a(a: &mut u32, b: u32) { + // CHECK-LABEL: define void @a + // CHECK: store i32 %b, i32* %a, align 4, !nontemporal + unsafe { + std::intrinsics::nontemporal_store(a, b); + } +} diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index 189b4230ec..022f581278 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -54,10 +54,7 @@ pub struct PackedPair(u8, u32); // CHECK-LABEL: @pkd_pair #[no_mangle] pub fn pkd_pair(pair1: &mut PackedPair, pair2: &mut PackedPair) { - // CHECK: [[V1:%[a-z0-9]+]] = load i8, i8* %{{.*}}, align 1 - // CHECK: [[V2:%[a-z0-9]+]] = load i32, i32* %{{.*}}, align 1 - // CHECK: store i8 [[V1]], i8* {{.*}}, align 1 - // CHECK: store i32 [[V2]], i32* {{.*}}, align 1 +// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 5, i32 1, i1 false) *pair2 = *pair1; } diff --git a/src/test/codegen/prefetch.rs b/src/test/codegen/prefetch.rs index 9ca2f01f80..3a23c16d52 100644 --- a/src/test/codegen/prefetch.rs +++ b/src/test/codegen/prefetch.rs @@ -71,5 +71,3 @@ pub fn check_prefetch_write_instruction(data: &[i8]) { prefetch_write_instruction(data.as_ptr(), 3); } } - - diff --git a/src/test/codegen/refs.rs b/src/test/codegen/refs.rs index 4b713e28b0..6c00ffa754 100644 --- a/src/test/codegen/refs.rs +++ b/src/test/codegen/refs.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -C no-prepopulate-passes +// ignore-tidy-linelength #![crate_type = "lib"] @@ -23,10 +24,10 @@ pub fn helper(_: usize) { pub fn ref_dst(s: &[u8]) { // We used to generate an extra alloca and memcpy to ref the dst, so check that we copy // directly to the alloca for "x" -// CHECK: [[X0:%[0-9]+]] = getelementptr {{.*}} { i8*, [[USIZE]] }* %x, i32 0, i32 0 -// CHECK: store i8* %s.ptr, i8** [[X0]] -// CHECK: [[X1:%[0-9]+]] = getelementptr {{.*}} { i8*, [[USIZE]] }* %x, i32 0, i32 1 -// CHECK: store [[USIZE]] %s.meta, [[USIZE]]* [[X1]] +// CHECK: [[X0:%[0-9]+]] = getelementptr {{.*}} { [0 x i8]*, [[USIZE]] }* %x, i32 0, i32 0 +// CHECK: store [0 x i8]* %s.0, [0 x i8]** [[X0]] +// CHECK: [[X1:%[0-9]+]] = getelementptr {{.*}} { [0 x i8]*, [[USIZE]] }* %x, i32 0, i32 1 +// CHECK: store [[USIZE]] %s.1, [[USIZE]]* [[X1]] let x = &*s; &x; // keep variable in an alloca diff --git a/src/test/codegen/remap_path_prefix/main.rs b/src/test/codegen/remap_path_prefix/main.rs index c73739bb76..ea0c9ad2b8 100644 --- a/src/test/codegen/remap_path_prefix/main.rs +++ b/src/test/codegen/remap_path_prefix/main.rs @@ -32,7 +32,7 @@ fn main() { } // Here we check that local debuginfo is mapped correctly. -// CHECK: !DIFile(filename: "/the/src/remap_path_prefix/main.rs", directory: "/the/cwd") +// CHECK: !DIFile(filename: "/the/src/remap_path_prefix/main.rs", directory: "/the/cwd/") // And here that debuginfo from other crates are expanded to absolute paths. // CHECK: !DIFile(filename: "/the/aux-src/remap_path_prefix_aux.rs", directory: "") diff --git a/src/test/codegen/slice-init.rs b/src/test/codegen/slice-init.rs index 569d937c81..915db493fc 100644 --- a/src/test/codegen/slice-init.rs +++ b/src/test/codegen/slice-init.rs @@ -15,7 +15,7 @@ // CHECK-LABEL: @zero_sized_elem #[no_mangle] pub fn zero_sized_elem() { - // CHECK-NOT: br label %slice_loop_header{{.*}} + // CHECK-NOT: br label %repeat_loop_header{{.*}} // CHECK-NOT: call void @llvm.memset.p0i8 let x = [(); 4]; drop(&x); @@ -24,7 +24,7 @@ pub fn zero_sized_elem() { // CHECK-LABEL: @zero_len_array #[no_mangle] pub fn zero_len_array() { - // CHECK-NOT: br label %slice_loop_header{{.*}} + // CHECK-NOT: br label %repeat_loop_header{{.*}} // CHECK-NOT: call void @llvm.memset.p0i8 let x = [4; 0]; drop(&x); @@ -34,7 +34,7 @@ pub fn zero_len_array() { #[no_mangle] pub fn byte_array() { // CHECK: call void @llvm.memset.p0i8.i[[WIDTH:[0-9]+]](i8* {{.*}}, i8 7, i[[WIDTH]] 4 - // CHECK-NOT: br label %slice_loop_header{{.*}} + // CHECK-NOT: br label %repeat_loop_header{{.*}} let x = [7u8; 4]; drop(&x); } @@ -50,7 +50,7 @@ enum Init { #[no_mangle] pub fn byte_enum_array() { // CHECK: call void @llvm.memset.p0i8.i[[WIDTH:[0-9]+]](i8* {{.*}}, i8 {{.*}}, i[[WIDTH]] 4 - // CHECK-NOT: br label %slice_loop_header{{.*}} + // CHECK-NOT: br label %repeat_loop_header{{.*}} let x = [Init::Memset; 4]; drop(&x); } @@ -59,7 +59,7 @@ pub fn byte_enum_array() { #[no_mangle] pub fn zeroed_integer_array() { // CHECK: call void @llvm.memset.p0i8.i[[WIDTH:[0-9]+]](i8* {{.*}}, i8 0, i[[WIDTH]] 16 - // CHECK-NOT: br label %slice_loop_header{{.*}} + // CHECK-NOT: br label %repeat_loop_header{{.*}} let x = [0u32; 4]; drop(&x); } @@ -67,7 +67,7 @@ pub fn zeroed_integer_array() { // CHECK-LABEL: @nonzero_integer_array #[no_mangle] pub fn nonzero_integer_array() { - // CHECK: br label %slice_loop_header{{.*}} + // CHECK: br label %repeat_loop_header{{.*}} // CHECK-NOT: call void @llvm.memset.p0i8 let x = [0x1a_2b_3c_4d_u32; 4]; drop(&x); diff --git a/src/test/codegen/x86_mmx.rs b/src/test/codegen/x86_mmx.rs new file mode 100644 index 0000000000..bedda63bbf --- /dev/null +++ b/src/test/codegen/x86_mmx.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-arm +// ignore-aarch64 +// ignore-emscripten +// compile-flags: -O + +#![feature(repr_simd)] +#![crate_type="lib"] + +#[repr(simd)] +#[derive(Clone, Copy)] +pub struct i8x8(u64); + +#[no_mangle] +pub fn a(a: &mut i8x8, b: i8x8) -> i8x8 { + // CHECK-LABEL: define x86_mmx @a(x86_mmx*{{.*}}, x86_mmx{{.*}}) + // CHECK: store x86_mmx %b, x86_mmx* %a + // CHECK: ret x86_mmx %b + *a = b; + return b +} diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs index fa85432fb8..f368788af5 100644 --- a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs +++ b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs @@ -17,7 +17,6 @@ // for the error message we see here.) #![feature(rustc_private)] -#![feature(const_atomic_usize_new)] extern crate arena; @@ -125,4 +124,4 @@ fn f<'a>(arena: &'a TypedArena>) { fn main() { let arena = TypedArena::new(); f(&arena); -} //~ ERROR `arena` does not live long enough +} //~^ ERROR `arena` does not live long enough diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs index 30829847a3..531e1ada44 100644 --- a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs +++ b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs @@ -49,5 +49,5 @@ fn f<'a>(_arena: &'a TypedArena>) {} fn main() { let arena: TypedArena = TypedArena::new(); f(&arena); -} //~ ERROR `arena` does not live long enough +} //~^ ERROR `arena` does not live long enough diff --git a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs b/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs index b03409c9c2..93790f5937 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs @@ -17,7 +17,8 @@ extern crate derive_bad; #[derive( A )] -//~^^ ERROR: proc-macro derive produced unparseable tokens +//~^^ ERROR proc-macro derive produced unparseable tokens +//~| ERROR expected `:`, found `}` struct A; fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs index b1fb7d42d8..773b16b945 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs @@ -23,5 +23,5 @@ fn main() { bang_proc_macro2!(); //~^ ERROR cannot find value `foobar2` in this scope //~^^ did you mean `foobar`? - println!("{}", x); + println!("{}", x); //~ ERROR cannot find value `x` in this scope } diff --git a/src/test/compile-fail/E0004.rs b/src/test/compile-fail/E0004.rs index 79e53c7a29..8df07a0c1c 100644 --- a/src/test/compile-fail/E0004.rs +++ b/src/test/compile-fail/E0004.rs @@ -19,4 +19,4 @@ fn main() { match x { //~ ERROR E0004 Terminator::TalkToMyHand => {} } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/E0005.rs b/src/test/compile-fail/E0005.rs index 809b3af3be..0405bba81b 100644 --- a/src/test/compile-fail/E0005.rs +++ b/src/test/compile-fail/E0005.rs @@ -11,5 +11,4 @@ fn main() { let x = Some(1); let Some(y) = x; //~ ERROR E0005 - //~| NOTE pattern `None` not covered } diff --git a/src/test/compile-fail/E0007.rs b/src/test/compile-fail/E0007.rs index b72b5e3b28..d5acbdebbe 100644 --- a/src/test/compile-fail/E0007.rs +++ b/src/test/compile-fail/E0007.rs @@ -13,9 +13,7 @@ fn main() { match x { op_string @ Some(s) => {}, //~^ ERROR E0007 - //~| NOTE binds an already bound by-move value by moving it //~| ERROR E0303 - //~| NOTE not allowed after `@` None => {}, } } diff --git a/src/test/compile-fail/E0008.rs b/src/test/compile-fail/E0008.rs index 20cc1cbd22..ba5720e6f0 100644 --- a/src/test/compile-fail/E0008.rs +++ b/src/test/compile-fail/E0008.rs @@ -12,7 +12,6 @@ fn main() { match Some("hi".to_string()) { Some(s) if s.len() == 0 => {}, //~^ ERROR E0008 - //~| NOTE moves value into pattern guard _ => {}, } } diff --git a/src/test/compile-fail/E0009.rs b/src/test/compile-fail/E0009.rs index 767fc0cc5d..02e2e80e7e 100644 --- a/src/test/compile-fail/E0009.rs +++ b/src/test/compile-fail/E0009.rs @@ -14,8 +14,6 @@ fn main() { match x { Some((y, ref z)) => {}, //~^ ERROR E0009 - //~| NOTE by-move pattern here - //~| NOTE both by-ref and by-move used None => panic!() } } diff --git a/src/test/compile-fail/E0010.rs b/src/test/compile-fail/E0010.rs index ccaf01932d..66a9319a7d 100644 --- a/src/test/compile-fail/E0010.rs +++ b/src/test/compile-fail/E0010.rs @@ -12,6 +12,5 @@ #![allow(warnings)] const CON : Box = box 0; //~ ERROR E0010 - //~| NOTE allocation not allowed in fn main() {} diff --git a/src/test/compile-fail/E0017.rs b/src/test/compile-fail/E0017.rs index 726a6f8c6f..c98c35a144 100644 --- a/src/test/compile-fail/E0017.rs +++ b/src/test/compile-fail/E0017.rs @@ -12,10 +12,7 @@ static X: i32 = 1; const C: i32 = 2; const CR: &'static mut i32 = &mut C; //~ ERROR E0017 - //~| NOTE constants require immutable values static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 - //~| NOTE statics require immutable values //~| ERROR cannot borrow static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 - //~| NOTE statics require immutable values fn main() {} diff --git a/src/test/compile-fail/E0023.rs b/src/test/compile-fail/E0023.rs index c3623e3177..24032c5984 100644 --- a/src/test/compile-fail/E0023.rs +++ b/src/test/compile-fail/E0023.rs @@ -18,10 +18,7 @@ fn main() { let x = Fruit::Apple(String::new(), String::new()); match x { Fruit::Apple(a) => {}, //~ ERROR E0023 - //~| NOTE expected 2 fields, found 1 Fruit::Apple(a, b, c) => {}, //~ ERROR E0023 - //~| NOTE expected 2 fields, found 3 Fruit::Pear(1, 2) => {}, //~ ERROR E0023 - //~| NOTE expected 1 field, found 2 } } diff --git a/src/test/compile-fail/E0025.rs b/src/test/compile-fail/E0025.rs index 1d15cef8bc..81d0ea8a5e 100644 --- a/src/test/compile-fail/E0025.rs +++ b/src/test/compile-fail/E0025.rs @@ -17,6 +17,4 @@ fn main() { let x = Foo { a:1, b:2 }; let Foo { a: x, a: y, b: 0 } = x; //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern - //~| NOTE first use of `a` } diff --git a/src/test/compile-fail/E0026.rs b/src/test/compile-fail/E0026.rs index ac609da4cb..f8ad7b5a30 100644 --- a/src/test/compile-fail/E0026.rs +++ b/src/test/compile-fail/E0026.rs @@ -18,6 +18,5 @@ fn main() { match thing { Thing { x, y, z } => {} //~^ ERROR struct `Thing` does not have a field named `z` [E0026] - //~| NOTE struct `Thing` does not have field `z` } } diff --git a/src/test/compile-fail/E0027.rs b/src/test/compile-fail/E0027.rs index ca496a2470..b63b0ab5df 100644 --- a/src/test/compile-fail/E0027.rs +++ b/src/test/compile-fail/E0027.rs @@ -19,6 +19,5 @@ fn main() { match d { Dog { age: x } => {} //~^ ERROR pattern does not mention field `name` - //~| NOTE missing field `name` } } diff --git a/src/test/compile-fail/E0029.rs b/src/test/compile-fail/E0029.rs index e43290bb15..80d215bd32 100644 --- a/src/test/compile-fail/E0029.rs +++ b/src/test/compile-fail/E0029.rs @@ -14,9 +14,6 @@ fn main() { match s { "hello" ... "world" => {} //~^ ERROR only char and numeric types are allowed in range patterns - //~| NOTE ranges require char or numeric types - //~| NOTE start type: &'static str - //~| NOTE end type: &'static str //~| ERROR non-reference pattern used to match a reference _ => {} } diff --git a/src/test/compile-fail/E0030.rs b/src/test/compile-fail/E0030.rs index 74e827b337..ef3bded4be 100644 --- a/src/test/compile-fail/E0030.rs +++ b/src/test/compile-fail/E0030.rs @@ -13,6 +13,5 @@ fn main() { match 5u32 { 1000 ... 5 => {} //~^ ERROR lower range bound must be less than or equal to upper - //~| NOTE lower bound larger than upper bound } } diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs index 03d4747209..3cdbb55f6d 100644 --- a/src/test/compile-fail/E0033.rs +++ b/src/test/compile-fail/E0033.rs @@ -15,12 +15,9 @@ trait SomeTrait { fn main() { let trait_obj: &SomeTrait = SomeTrait; //~^ ERROR expected value, found trait `SomeTrait` - //~| NOTE not a value //~| ERROR E0038 //~| method `foo` has no receiver - //~| NOTE the trait `SomeTrait` cannot be made into an object let &invalid = trait_obj; //~^ ERROR E0033 - //~| NOTE type `&SomeTrait` cannot be dereferenced } diff --git a/src/test/compile-fail/E0034.rs b/src/test/compile-fail/E0034.rs index 136a74f7a8..6eebd4d4d5 100644 --- a/src/test/compile-fail/E0034.rs +++ b/src/test/compile-fail/E0034.rs @@ -20,15 +20,12 @@ trait Trait2 { impl Trait1 for Test { fn foo() {} - //~^ NOTE candidate #1 is defined in an impl of the trait `Trait1` for the type `Test` } impl Trait2 for Test { fn foo() {} - //~^ NOTE candidate #2 is defined in an impl of the trait `Trait2` for the type `Test` } fn main() { Test::foo() //~ ERROR multiple applicable items in scope - //~| NOTE multiple `foo` found } diff --git a/src/test/compile-fail/E0038.rs b/src/test/compile-fail/E0038.rs index 6cf3f1ebf1..8087928c05 100644 --- a/src/test/compile-fail/E0038.rs +++ b/src/test/compile-fail/E0038.rs @@ -14,8 +14,6 @@ trait Trait { fn call_foo(x: Box) { //~^ ERROR E0038 - //~| NOTE the trait `Trait` cannot be made into an object - //~| NOTE method `foo` references the `Self` type in its arguments or return type let y = x.foo(); } diff --git a/src/test/compile-fail/E0040.rs b/src/test/compile-fail/E0040.rs index edfe22186e..8385d68c54 100644 --- a/src/test/compile-fail/E0040.rs +++ b/src/test/compile-fail/E0040.rs @@ -22,5 +22,4 @@ fn main() { let mut x = Foo { x: -7 }; x.drop(); //~^ ERROR E0040 - //~| NOTE explicit destructor calls not allowed } diff --git a/src/test/compile-fail/E0045.rs b/src/test/compile-fail/E0045.rs index 3f098861eb..57c639dd14 100644 --- a/src/test/compile-fail/E0045.rs +++ b/src/test/compile-fail/E0045.rs @@ -9,7 +9,6 @@ // except according to those terms. extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 - //~| NOTE variadics require C or cdecl calling convention fn main() { } diff --git a/src/test/compile-fail/E0049.rs b/src/test/compile-fail/E0049.rs index 33ebd3f7ac..5867e11e9a 100644 --- a/src/test/compile-fail/E0049.rs +++ b/src/test/compile-fail/E0049.rs @@ -9,14 +9,13 @@ // except according to those terms. trait Foo { - fn foo(x: T) -> Self; //~ NOTE expected 1 type parameter + fn foo(x: T) -> Self; } struct Bar; impl Foo for Bar { fn foo(x: bool) -> Self { Bar } //~ ERROR E0049 - //~| NOTE found 0 type parameters } fn main() { diff --git a/src/test/compile-fail/E0050.rs b/src/test/compile-fail/E0050.rs index 5c53d62709..2ccc380c54 100644 --- a/src/test/compile-fail/E0050.rs +++ b/src/test/compile-fail/E0050.rs @@ -9,20 +9,17 @@ // except according to those terms. trait Foo { - fn foo(&self, x: u8) -> bool; //~ NOTE trait requires 2 parameters - fn bar(&self, x: u8, y: u8, z: u8); //~ NOTE trait requires 4 parameters - fn less(&self); //~ NOTE trait requires 1 parameter + fn foo(&self, x: u8) -> bool; + fn bar(&self, x: u8, y: u8, z: u8); + fn less(&self); } struct Bar; impl Foo for Bar { fn foo(&self) -> bool { true } //~ ERROR E0050 - //~| NOTE expected 2 parameters, found 1 fn bar(&self) { } //~ ERROR E0050 - //~| NOTE expected 4 parameters, found 1 fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050 - //~| NOTE expected 1 parameter, found 4 } fn main() { diff --git a/src/test/compile-fail/E0055.rs b/src/test/compile-fail/E0055.rs index 2b2d278ad4..6e186b81ca 100644 --- a/src/test/compile-fail/E0055.rs +++ b/src/test/compile-fail/E0055.rs @@ -20,5 +20,4 @@ fn main() { let ref_foo = &&Foo; ref_foo.foo(); //~^ ERROR E0055 - //~| NOTE deref recursion limit reached } diff --git a/src/test/compile-fail/E0060.rs b/src/test/compile-fail/E0060.rs index 8246c42a4d..f4505209b6 100644 --- a/src/test/compile-fail/E0060.rs +++ b/src/test/compile-fail/E0060.rs @@ -10,7 +10,6 @@ extern "C" { fn printf(_: *const u8, ...) -> u32; - //~^ NOTE defined here } fn main() { diff --git a/src/test/compile-fail/E0061.rs b/src/test/compile-fail/E0061.rs index ebd4ad2e29..221e18cf89 100644 --- a/src/test/compile-fail/E0061.rs +++ b/src/test/compile-fail/E0061.rs @@ -9,10 +9,8 @@ // except according to those terms. fn f(a: u16, b: &str) {} -//~^ NOTE defined here fn f2(a: u16) {} -//~^ NOTE defined here fn main() { f(0); diff --git a/src/test/compile-fail/E0062.rs b/src/test/compile-fail/E0062.rs index 822d93e52d..684c9464ff 100644 --- a/src/test/compile-fail/E0062.rs +++ b/src/test/compile-fail/E0062.rs @@ -14,9 +14,8 @@ struct Foo { fn main() { let x = Foo { - x: 0, //~ NOTE first use of `x` + x: 0, x: 0, //~^ ERROR E0062 - //~| NOTE used more than once }; } diff --git a/src/test/compile-fail/E0063.rs b/src/test/compile-fail/E0063.rs index e7044102ab..0208aff066 100644 --- a/src/test/compile-fail/E0063.rs +++ b/src/test/compile-fail/E0063.rs @@ -41,14 +41,10 @@ struct TruncatedPluralFoo { fn main() { let w = SingleFoo { }; //~^ ERROR missing field `x` in initializer of `SingleFoo` - //~| NOTE missing `x` let x = PluralFoo {x: 1}; //~^ ERROR missing fields `y`, `z` in initializer of `PluralFoo` - //~| NOTE missing `y`, `z` let y = TruncatedFoo{x:1}; //~^ missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo` - //~| NOTE `a`, `b`, `y` and 1 other field let z = TruncatedPluralFoo{x:1}; //~^ ERROR missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo` - //~| NOTE missing `a`, `b`, `c` and 2 other fields } diff --git a/src/test/compile-fail/E0067.rs b/src/test/compile-fail/E0067.rs index 56d2e82806..a3fc30ee1c 100644 --- a/src/test/compile-fail/E0067.rs +++ b/src/test/compile-fail/E0067.rs @@ -13,6 +13,4 @@ use std::collections::LinkedList; fn main() { LinkedList::new() += 1; //~ ERROR E0368 //~^ ERROR E0067 - //~^^ NOTE invalid expression for left-hand side - //~| NOTE cannot use `+=` on type `std::collections::LinkedList<_>` } diff --git a/src/test/compile-fail/E0069.rs b/src/test/compile-fail/E0069.rs index 00facc9172..a6a7898ed4 100644 --- a/src/test/compile-fail/E0069.rs +++ b/src/test/compile-fail/E0069.rs @@ -11,7 +11,6 @@ fn foo() -> u8 { return; //~^ ERROR `return;` in a function whose return type is not `()` - //~| NOTE return type is not () } fn main() { diff --git a/src/test/compile-fail/E0071.rs b/src/test/compile-fail/E0071.rs index 95653ae83e..d71dc7966f 100644 --- a/src/test/compile-fail/E0071.rs +++ b/src/test/compile-fail/E0071.rs @@ -14,5 +14,4 @@ type FooAlias = Foo; fn main() { let u = FooAlias { value: 0 }; //~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071] - //~| NOTE not a struct } diff --git a/src/test/compile-fail/E0076.rs b/src/test/compile-fail/E0076.rs index c31dc62eb6..b159cf107c 100644 --- a/src/test/compile-fail/E0076.rs +++ b/src/test/compile-fail/E0076.rs @@ -13,7 +13,6 @@ #[repr(simd)] struct Bad(u16, u32, u32); //~^ ERROR E0076 -//~| NOTE SIMD elements must have the same type fn main() { } diff --git a/src/test/compile-fail/E0080.rs b/src/test/compile-fail/E0080.rs index 0329209d44..2f199c48e4 100644 --- a/src/test/compile-fail/E0080.rs +++ b/src/test/compile-fail/E0080.rs @@ -10,7 +10,9 @@ enum Enum { X = (1 << 500), //~ ERROR E0080 + //~| WARNING shift left with overflow Y = (1 / 0) //~ ERROR E0080 + //~| WARNING divide by zero } fn main() { diff --git a/src/test/compile-fail/E0081.rs b/src/test/compile-fail/E0081.rs index 9911e093a8..3b57166733 100644 --- a/src/test/compile-fail/E0081.rs +++ b/src/test/compile-fail/E0081.rs @@ -9,10 +9,9 @@ // except according to those terms. enum Enum { - P = 3, //~ NOTE first use of `3isize` + P = 3, X = 3, //~^ ERROR discriminant value `3isize` already exists - //~| NOTE enum already has `3isize` Y = 5 } diff --git a/src/test/compile-fail/E0084.rs b/src/test/compile-fail/E0084.rs index d19eed7124..2be206c970 100644 --- a/src/test/compile-fail/E0084.rs +++ b/src/test/compile-fail/E0084.rs @@ -9,7 +9,7 @@ // except according to those terms. #[repr(i32)] //~ ERROR: E0084 -enum Foo {} //~ NOTE: zero-variant enum +enum Foo {} fn main() { } diff --git a/src/test/compile-fail/E0087.rs b/src/test/compile-fail/E0087.rs index 0b8150affc..6dc0886061 100644 --- a/src/test/compile-fail/E0087.rs +++ b/src/test/compile-fail/E0087.rs @@ -13,8 +13,6 @@ fn bar() {} fn main() { foo::(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087] - //~^ NOTE expected 0 type parameters bar::(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087] - //~^ NOTE expected 1 type parameter } diff --git a/src/test/compile-fail/E0089.rs b/src/test/compile-fail/E0089.rs index 986630d818..21df9abd09 100644 --- a/src/test/compile-fail/E0089.rs +++ b/src/test/compile-fail/E0089.rs @@ -12,5 +12,4 @@ fn foo() {} fn main() { foo::(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089] - //~| NOTE expected 2 type parameters } diff --git a/src/test/compile-fail/E0090.rs b/src/test/compile-fail/E0090.rs index c37f37031a..13b2131cc8 100644 --- a/src/test/compile-fail/E0090.rs +++ b/src/test/compile-fail/E0090.rs @@ -12,5 +12,4 @@ fn foo<'a: 'b, 'b: 'a>() {} fn main() { foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090] - //~^ NOTE expected 2 lifetime parameters } diff --git a/src/test/compile-fail/E0091.rs b/src/test/compile-fail/E0091.rs index 0d6c246de2..da988dbf81 100644 --- a/src/test/compile-fail/E0091.rs +++ b/src/test/compile-fail/E0091.rs @@ -9,9 +9,7 @@ // except according to those terms. type Foo = u32; //~ ERROR E0091 - //~| NOTE unused type parameter type Foo2 = Box; //~ ERROR E0091 - //~| NOTE unused type parameter fn main() { } diff --git a/src/test/compile-fail/E0092.rs b/src/test/compile-fail/E0092.rs index c8bb31a785..b08164ac06 100644 --- a/src/test/compile-fail/E0092.rs +++ b/src/test/compile-fail/E0092.rs @@ -11,7 +11,7 @@ #![feature(intrinsics)] extern "rust-intrinsic" { fn atomic_foo(); //~ ERROR E0092 -} //~| NOTE unrecognized atomic operation +} fn main() { } diff --git a/src/test/compile-fail/E0093.rs b/src/test/compile-fail/E0093.rs index fdc48455a6..d84f9f6491 100644 --- a/src/test/compile-fail/E0093.rs +++ b/src/test/compile-fail/E0093.rs @@ -12,7 +12,6 @@ extern "rust-intrinsic" { fn foo(); //~^ ERROR E0093 - //~| NOTE unrecognized intrinsic } fn main() { diff --git a/src/test/compile-fail/E0094.rs b/src/test/compile-fail/E0094.rs index d09353a203..3a31874b24 100644 --- a/src/test/compile-fail/E0094.rs +++ b/src/test/compile-fail/E0094.rs @@ -11,7 +11,6 @@ #![feature(intrinsics)] extern "rust-intrinsic" { fn size_of() -> usize; //~ ERROR E0094 - //~| NOTE expected 1 type parameter } fn main() { diff --git a/src/test/compile-fail/E0106.rs b/src/test/compile-fail/E0106.rs index d5644ab060..0674930a11 100644 --- a/src/test/compile-fail/E0106.rs +++ b/src/test/compile-fail/E0106.rs @@ -11,17 +11,14 @@ struct Foo { x: &bool, //~^ ERROR E0106 - //~| NOTE expected lifetime parameter } enum Bar { A(u8), B(&bool), //~^ ERROR E0106 - //~| NOTE expected lifetime parameter } type MyStr = &str; //~^ ERROR E0106 - //~| NOTE expected lifetime parameter struct Baz<'a>(&'a str); struct Buzz<'a, 'b>(&'a str, &'b str); diff --git a/src/test/compile-fail/E0109.rs b/src/test/compile-fail/E0109.rs index 2e4cbf8692..9fc4784225 100644 --- a/src/test/compile-fail/E0109.rs +++ b/src/test/compile-fail/E0109.rs @@ -9,7 +9,6 @@ // except according to those terms. type X = u32; //~ ERROR E0109 - //~| NOTE type parameter not allowed fn main() { } diff --git a/src/test/compile-fail/E0110.rs b/src/test/compile-fail/E0110.rs index 5a9e7a43de..fd169f4acc 100644 --- a/src/test/compile-fail/E0110.rs +++ b/src/test/compile-fail/E0110.rs @@ -9,7 +9,6 @@ // except according to those terms. type X = u32<'static>; //~ ERROR E0110 - //~| NOTE lifetime parameter not allowed on this type fn main() { } diff --git a/src/test/compile-fail/E0116.rs b/src/test/compile-fail/E0116.rs index f885241eec..cd7d8dc3ef 100644 --- a/src/test/compile-fail/E0116.rs +++ b/src/test/compile-fail/E0116.rs @@ -10,8 +10,6 @@ impl Vec {} //~^ ERROR E0116 -//~| NOTE impl for type defined outside of crate. -//~| NOTE define and implement a trait or new type instead fn main() { } diff --git a/src/test/compile-fail/E0117.rs b/src/test/compile-fail/E0117.rs index 3da00da205..982f875c7b 100644 --- a/src/test/compile-fail/E0117.rs +++ b/src/test/compile-fail/E0117.rs @@ -9,9 +9,6 @@ // except according to those terms. impl Drop for u32 {} //~ ERROR E0117 -//~^ NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead //~| ERROR the Drop trait may only be implemented on structures //~| implementing Drop requires a struct diff --git a/src/test/compile-fail/E0118.rs b/src/test/compile-fail/E0118.rs index 3fc478f1e4..d37ff34b86 100644 --- a/src/test/compile-fail/E0118.rs +++ b/src/test/compile-fail/E0118.rs @@ -9,8 +9,6 @@ // except according to those terms. impl (u8, u8) { //~ ERROR E0118 -//~^ NOTE impl requires a base type -//~| NOTE either implement a trait on it or create a newtype to wrap it instead fn get_state(&self) -> String { String::new() } diff --git a/src/test/compile-fail/E0119.rs b/src/test/compile-fail/E0119.rs index 56820bcd18..9528631b30 100644 --- a/src/test/compile-fail/E0119.rs +++ b/src/test/compile-fail/E0119.rs @@ -12,7 +12,7 @@ trait MyTrait { fn get(&self) -> usize; } -impl MyTrait for T { //~ NOTE first implementation here +impl MyTrait for T { fn get(&self) -> usize { 0 } } @@ -21,7 +21,6 @@ struct Foo { } impl MyTrait for Foo { //~ ERROR E0119 - //~| NOTE conflicting implementation for `Foo` fn get(&self) -> usize { self.value } } diff --git a/src/test/compile-fail/E0120.rs b/src/test/compile-fail/E0120.rs index 80cc0d2680..8d09b877f0 100644 --- a/src/test/compile-fail/E0120.rs +++ b/src/test/compile-fail/E0120.rs @@ -12,7 +12,6 @@ trait MyTrait { fn foo() {} } impl Drop for MyTrait { //~^ ERROR E0120 - //~| NOTE implementing Drop requires a struct fn drop(&mut self) {} } diff --git a/src/test/compile-fail/E0124.rs b/src/test/compile-fail/E0124.rs index 18c5074610..3ef20c6dd4 100644 --- a/src/test/compile-fail/E0124.rs +++ b/src/test/compile-fail/E0124.rs @@ -9,10 +9,9 @@ // except according to those terms. struct Foo { - field1: i32, //~ NOTE `field1` first declared here + field1: i32, field1: i32, //~^ ERROR field `field1` is already declared [E0124] - //~| NOTE field already declared } fn main() { diff --git a/src/test/compile-fail/E0128.rs b/src/test/compile-fail/E0128.rs index f5829b9385..3707101282 100644 --- a/src/test/compile-fail/E0128.rs +++ b/src/test/compile-fail/E0128.rs @@ -9,7 +9,6 @@ // except according to those terms. struct Foo { //~ ERROR E0128 - //~| NOTE defaulted type parameters cannot be forward declared field1: T, field2: U, } diff --git a/src/test/compile-fail/E0130.rs b/src/test/compile-fail/E0130.rs index e9e027fd1d..d11b59cdf3 100644 --- a/src/test/compile-fail/E0130.rs +++ b/src/test/compile-fail/E0130.rs @@ -11,7 +11,6 @@ extern { fn foo((a, b): (u32, u32)); //~^ ERROR E0130 - //~| NOTE pattern not allowed in foreign function } fn main() { diff --git a/src/test/compile-fail/E0131.rs b/src/test/compile-fail/E0131.rs index e6e924e2d9..c7e31edd30 100644 --- a/src/test/compile-fail/E0131.rs +++ b/src/test/compile-fail/E0131.rs @@ -10,5 +10,4 @@ fn main() { //~^ ERROR E0131 - //~| NOTE main cannot have type parameters } diff --git a/src/test/compile-fail/E0132.rs b/src/test/compile-fail/E0132.rs index 91ff6b85a4..25ccb344ab 100644 --- a/src/test/compile-fail/E0132.rs +++ b/src/test/compile-fail/E0132.rs @@ -12,7 +12,6 @@ #[start] fn f< T >() {} //~ ERROR E0132 - //~| NOTE start function cannot have type parameters fn main() { } diff --git a/src/test/compile-fail/E0133.rs b/src/test/compile-fail/E0133.rs index f60d9a5083..2e54f65e7b 100644 --- a/src/test/compile-fail/E0133.rs +++ b/src/test/compile-fail/E0133.rs @@ -13,5 +13,4 @@ unsafe fn f() { return; } fn main() { f(); //~^ ERROR E0133 - //~| NOTE call to unsafe function } diff --git a/src/test/compile-fail/E0137.rs b/src/test/compile-fail/E0137.rs index f45afc9f37..067ebcc727 100644 --- a/src/test/compile-fail/E0137.rs +++ b/src/test/compile-fail/E0137.rs @@ -11,9 +11,8 @@ #![feature(main)] #[main] -fn foo() {} //~ NOTE first #[main] function +fn foo() {} #[main] fn f() {} //~^ ERROR E0137 -//~| NOTE additional #[main] function diff --git a/src/test/compile-fail/E0138.rs b/src/test/compile-fail/E0138.rs index 11d90658ab..856616c857 100644 --- a/src/test/compile-fail/E0138.rs +++ b/src/test/compile-fail/E0138.rs @@ -12,9 +12,7 @@ #[start] fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } -//~^ NOTE previous `start` function here #[start] fn f(argc: isize, argv: *const *const u8) -> isize { 0 } //~^ ERROR E0138 -//~| NOTE multiple `start` functions diff --git a/src/test/compile-fail/E0162.rs b/src/test/compile-fail/E0162.rs index 0b63d7c3f8..e13b0af6f7 100644 --- a/src/test/compile-fail/E0162.rs +++ b/src/test/compile-fail/E0162.rs @@ -13,7 +13,6 @@ struct Irrefutable(i32); fn main() { let irr = Irrefutable(0); if let Irrefutable(x) = irr { //~ ERROR E0162 - //~| NOTE irrefutable pattern println!("{}", x); } } diff --git a/src/test/compile-fail/E0164.rs b/src/test/compile-fail/E0164.rs index cf6cf15115..a7f10ddb5a 100644 --- a/src/test/compile-fail/E0164.rs +++ b/src/test/compile-fail/E0164.rs @@ -18,7 +18,6 @@ impl Foo { fn bar(foo: Foo) -> u32 { match foo { Foo::B(i) => i, //~ ERROR E0164 - //~| NOTE not a tuple variant or struct } } diff --git a/src/test/compile-fail/E0184.rs b/src/test/compile-fail/E0184.rs index 9ec2eeba5c..5d72d00ffe 100644 --- a/src/test/compile-fail/E0184.rs +++ b/src/test/compile-fail/E0184.rs @@ -9,8 +9,6 @@ // except according to those terms. #[derive(Copy)] //~ ERROR E0184 - //~| NOTE Copy not allowed on types with destructors - //~| NOTE in this expansion of #[derive(Copy)] struct Foo; impl Drop for Foo { diff --git a/src/test/compile-fail/E0191.rs b/src/test/compile-fail/E0191.rs index dcfe441ab0..489ebb033f 100644 --- a/src/test/compile-fail/E0191.rs +++ b/src/test/compile-fail/E0191.rs @@ -13,7 +13,6 @@ trait Trait { } type Foo = Trait; //~ ERROR E0191 - //~| NOTE missing associated type `Bar` value fn main() { } diff --git a/src/test/compile-fail/E0194.rs b/src/test/compile-fail/E0194.rs index 6b1f718dd7..17e0751859 100644 --- a/src/test/compile-fail/E0194.rs +++ b/src/test/compile-fail/E0194.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo { //~ NOTE first `T` declared here +trait Foo { fn do_something(&self) -> T; fn do_something_else(&self, bar: T); //~^ ERROR E0194 - //~| NOTE shadows another type parameter } fn main() { diff --git a/src/test/compile-fail/E0206.rs b/src/test/compile-fail/E0206.rs index 1131e8e1b0..da0370b301 100644 --- a/src/test/compile-fail/E0206.rs +++ b/src/test/compile-fail/E0206.rs @@ -12,18 +12,13 @@ type Foo = i32; impl Copy for Foo { } //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead #[derive(Copy, Clone)] struct Bar; impl Copy for &'static Bar { } //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration fn main() { } diff --git a/src/test/compile-fail/E0207.rs b/src/test/compile-fail/E0207.rs index fbddb81d7c..bd87dbaf78 100644 --- a/src/test/compile-fail/E0207.rs +++ b/src/test/compile-fail/E0207.rs @@ -11,7 +11,6 @@ struct Foo; impl Foo { //~ ERROR E0207 - //~| NOTE unconstrained type parameter fn get(&self) -> T { ::default() } diff --git a/src/test/compile-fail/E0214.rs b/src/test/compile-fail/E0214.rs index e9c3cb72c1..2b090391c7 100644 --- a/src/test/compile-fail/E0214.rs +++ b/src/test/compile-fail/E0214.rs @@ -11,5 +11,4 @@ fn main() { let v: Vec(&str) = vec!["foo"]; //~^ ERROR E0214 - //~| NOTE only traits may use parentheses } diff --git a/src/test/compile-fail/E0220.rs b/src/test/compile-fail/E0220.rs index c5a1824514..2866ffcd63 100644 --- a/src/test/compile-fail/E0220.rs +++ b/src/test/compile-fail/E0220.rs @@ -13,8 +13,6 @@ trait Trait { } type Foo = Trait; //~ ERROR E0220 - //~| NOTE associated type `F` not found //~| ERROR E0191 - //~| NOTE missing associated type `Bar` value fn main() { } diff --git a/src/test/compile-fail/E0221.rs b/src/test/compile-fail/E0221.rs index aed2b4084e..99092465b0 100644 --- a/src/test/compile-fail/E0221.rs +++ b/src/test/compile-fail/E0221.rs @@ -12,27 +12,24 @@ trait T1 {} trait T2 {} trait Foo { - type A: T1; //~ NOTE: ambiguous `A` from `Foo` + type A: T1; } trait Bar : Foo { - type A: T2; //~ NOTE: ambiguous `A` from `Bar` + type A: T2; fn do_something() { let _: Self::A; //~^ ERROR E0221 - //~| NOTE ambiguous associated type `A` } } trait T3 {} trait My : std::str::FromStr { - type Err: T3; //~ NOTE: ambiguous `Err` from `My` + type Err: T3; fn test() { let _: Self::Err; //~^ ERROR E0221 - //~| NOTE ambiguous associated type `Err` - //~| NOTE associated type `Self` could derive from `std::str::FromStr` } } diff --git a/src/test/compile-fail/E0223.rs b/src/test/compile-fail/E0223.rs index 56057b3725..0683197b2b 100644 --- a/src/test/compile-fail/E0223.rs +++ b/src/test/compile-fail/E0223.rs @@ -13,6 +13,4 @@ trait MyTrait { type X; } fn main() { let foo: MyTrait::X; //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `::X` } diff --git a/src/test/compile-fail/E0225.rs b/src/test/compile-fail/E0225.rs index c2f610ecd2..6c77443c5e 100644 --- a/src/test/compile-fail/E0225.rs +++ b/src/test/compile-fail/E0225.rs @@ -11,5 +11,4 @@ fn main() { let _: Box; //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - //~| NOTE non-auto additional trait } diff --git a/src/test/compile-fail/E0229.rs b/src/test/compile-fail/E0229.rs index d15f9937f1..b70fb092a5 100644 --- a/src/test/compile-fail/E0229.rs +++ b/src/test/compile-fail/E0229.rs @@ -22,7 +22,6 @@ impl Foo for isize { fn baz(x: &>::A) {} //~^ ERROR associated type bindings are not allowed here [E0229] -//~| NOTE associated type not allowed here fn main() { } diff --git a/src/test/compile-fail/E0232.rs b/src/test/compile-fail/E0232.rs index a33120bbeb..04657c65c8 100644 --- a/src/test/compile-fail/E0232.rs +++ b/src/test/compile-fail/E0232.rs @@ -12,8 +12,6 @@ #[rustc_on_unimplemented] //~^ ERROR E0232 -//~| NOTE value required here -//~| NOTE eg `#[rustc_on_unimplemented = "foo"]` trait Bar {} fn main() { diff --git a/src/test/compile-fail/E0243.rs b/src/test/compile-fail/E0243.rs index d20435a37f..615ce0b5d4 100644 --- a/src/test/compile-fail/E0243.rs +++ b/src/test/compile-fail/E0243.rs @@ -11,7 +11,6 @@ struct Foo { x: T } struct Bar { x: Foo } //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0243] - //~| NOTE expected 1 type argument fn main() { } diff --git a/src/test/compile-fail/E0244.rs b/src/test/compile-fail/E0244.rs index 02d4b33789..9a78b3139d 100644 --- a/src/test/compile-fail/E0244.rs +++ b/src/test/compile-fail/E0244.rs @@ -11,7 +11,6 @@ struct Foo { x: bool } struct Bar { x: Foo } //~^ ERROR wrong number of type arguments: expected 0, found 2 [E0244] - //~| NOTE expected no type arguments fn main() { diff --git a/src/test/compile-fail/E0253.rs b/src/test/compile-fail/E0253.rs index 5a06c01241..186d9019aa 100644 --- a/src/test/compile-fail/E0253.rs +++ b/src/test/compile-fail/E0253.rs @@ -16,6 +16,5 @@ mod foo { use foo::MyTrait::do_something; //~^ ERROR E0253 - //~|NOTE cannot be imported directly fn main() {} diff --git a/src/test/compile-fail/E0254.rs b/src/test/compile-fail/E0254.rs index 996a6b97cd..46c74fe373 100644 --- a/src/test/compile-fail/E0254.rs +++ b/src/test/compile-fail/E0254.rs @@ -12,7 +12,6 @@ #![allow(unused_extern_crates)] extern crate alloc; -//~^ NOTE previous import of the extern crate `alloc` here mod foo { pub trait alloc { @@ -22,7 +21,5 @@ mod foo { use foo::alloc; //~^ ERROR E0254 -//~| NOTE `alloc` reimported here -//~| NOTE `alloc` must be defined only once in the type namespace of this module fn main() {} diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs index e125cc0c19..5a47541c70 100644 --- a/src/test/compile-fail/E0259.rs +++ b/src/test/compile-fail/E0259.rs @@ -12,12 +12,8 @@ #![allow(unused_extern_crates)] extern crate alloc; -//~^ NOTE previous import of the extern crate `alloc` here extern crate libc as alloc; //~^ ERROR E0259 -//~| NOTE `alloc` reimported here -//~| NOTE `alloc` must be defined only once in the type namespace of this module -//~| NOTE You can use `as` to change the binding name of the import fn main() {} diff --git a/src/test/compile-fail/E0260.rs b/src/test/compile-fail/E0260.rs index ad8888e58f..1b01bb1220 100644 --- a/src/test/compile-fail/E0260.rs +++ b/src/test/compile-fail/E0260.rs @@ -12,12 +12,9 @@ #![allow(unused_extern_crates)] extern crate alloc; -//~^ NOTE previous import of the extern crate `alloc` here mod alloc { //~^ ERROR the name `alloc` is defined multiple times [E0260] -//~| NOTE `alloc` redefined here -//~| NOTE `alloc` must be defined only once in the type namespace of this module pub trait MyTrait { fn do_something(); } diff --git a/src/test/compile-fail/E0263.rs b/src/test/compile-fail/E0263.rs index 11a8ff443a..722f1c25e0 100644 --- a/src/test/compile-fail/E0263.rs +++ b/src/test/compile-fail/E0263.rs @@ -10,8 +10,6 @@ fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { //~^ ERROR E0263 - //~| NOTE declared twice - //~| NOTE previous declaration here } fn main() {} diff --git a/src/test/compile-fail/E0267.rs b/src/test/compile-fail/E0267.rs index b58fbce8bc..6287256e86 100644 --- a/src/test/compile-fail/E0267.rs +++ b/src/test/compile-fail/E0267.rs @@ -10,5 +10,4 @@ fn main() { let w = || { break; }; //~ ERROR E0267 - //~| NOTE cannot break inside of a closure } diff --git a/src/test/compile-fail/E0268.rs b/src/test/compile-fail/E0268.rs index 3313e07667..41e88e2f49 100644 --- a/src/test/compile-fail/E0268.rs +++ b/src/test/compile-fail/E0268.rs @@ -10,5 +10,4 @@ fn main() { break; //~ ERROR E0268 - //~| NOTE cannot break outside of a loop } diff --git a/src/test/compile-fail/E0277-2.rs b/src/test/compile-fail/E0277-2.rs index 816d352955..4d1c50002a 100644 --- a/src/test/compile-fail/E0277-2.rs +++ b/src/test/compile-fail/E0277-2.rs @@ -25,9 +25,4 @@ fn is_send() { } fn main() { is_send::(); //~^ ERROR the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo` - //~| NOTE: `*const u8` cannot be sent between threads safely - //~| NOTE: required because it appears within the type `Baz` - //~| NOTE: required because it appears within the type `Bar` - //~| NOTE: required because it appears within the type `Foo` - //~| NOTE: required by `is_send` } diff --git a/src/test/compile-fail/E0277.rs b/src/test/compile-fail/E0277.rs index 8b34936419..784f7465d4 100644 --- a/src/test/compile-fail/E0277.rs +++ b/src/test/compile-fail/E0277.rs @@ -20,13 +20,8 @@ fn some_func(foo: T) { fn f(p: Path) { } //~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path` -//~| NOTE `[u8]` does not have a constant size known at compile-time -//~| NOTE required because it appears within the type `std::path::Path` -//~| NOTE all local variables must have a statically known size fn main() { some_func(5i32); //~^ ERROR the trait bound `i32: Foo` is not satisfied - //~| NOTE the trait `Foo` is not implemented for `i32` - //~| NOTE required by `some_func` } diff --git a/src/test/compile-fail/E0297.rs b/src/test/compile-fail/E0297.rs index 436e4c1f9d..afe4444c7a 100644 --- a/src/test/compile-fail/E0297.rs +++ b/src/test/compile-fail/E0297.rs @@ -13,5 +13,4 @@ fn main() { for Some(x) in xs {} //~^ ERROR E0005 - //~| NOTE pattern `None` not covered } diff --git a/src/test/compile-fail/E0301.rs b/src/test/compile-fail/E0301.rs index b7872509f5..06e98289b0 100644 --- a/src/test/compile-fail/E0301.rs +++ b/src/test/compile-fail/E0301.rs @@ -12,7 +12,6 @@ fn main() { match Some(()) { None => { }, option if option.take().is_none() => {}, //~ ERROR E0301 - //~| NOTE borrowed mutably in pattern guard Some(_) => { } } } diff --git a/src/test/compile-fail/E0302.rs b/src/test/compile-fail/E0302.rs index 5ad74fd6ca..6a5ad40b10 100644 --- a/src/test/compile-fail/E0302.rs +++ b/src/test/compile-fail/E0302.rs @@ -12,7 +12,6 @@ fn main() { match Some(()) { None => { }, option if { option = None; false } => { }, //~ ERROR E0302 - //~| NOTE assignment in pattern guard Some(_) => { } } } diff --git a/src/test/compile-fail/E0303.rs b/src/test/compile-fail/E0303.rs index e631fe2a8a..6027414fdb 100644 --- a/src/test/compile-fail/E0303.rs +++ b/src/test/compile-fail/E0303.rs @@ -12,10 +12,7 @@ fn main() { match Some("hi".to_string()) { ref op_string_ref @ Some(s) => {}, //~^ ERROR pattern bindings are not allowed after an `@` [E0303] - //~| NOTE not allowed after `@` //~| ERROR E0009 - //~| NOTE by-move pattern here - //~| NOTE both by-ref and by-move used None => {}, } } diff --git a/src/test/compile-fail/E0365.rs b/src/test/compile-fail/E0365.rs index ea5fd6ed47..a1efcde42b 100644 --- a/src/test/compile-fail/E0365.rs +++ b/src/test/compile-fail/E0365.rs @@ -14,7 +14,5 @@ mod foo { pub use foo as foo2; //~^ ERROR `foo` is private, and cannot be reexported [E0365] -//~| NOTE reexport of private `foo` -//~| NOTE consider declaring type or module `foo` with `pub` fn main() {} diff --git a/src/test/compile-fail/E0375.rs b/src/test/compile-fail/E0375.rs index 29d8e920c4..094ed35cc2 100644 --- a/src/test/compile-fail/E0375.rs +++ b/src/test/compile-fail/E0375.rs @@ -21,8 +21,5 @@ struct Foo { impl CoerceUnsized> for Foo {} //~^ ERROR E0375 -//~| NOTE requires multiple coercions -//~| NOTE `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced -//~| NOTE currently, 2 fields need coercions: b (T to U), c (U to T) fn main() {} diff --git a/src/test/compile-fail/E0389.rs b/src/test/compile-fail/E0389.rs index 584dfd5fa4..445831bf8d 100644 --- a/src/test/compile-fail/E0389.rs +++ b/src/test/compile-fail/E0389.rs @@ -16,6 +16,5 @@ fn main() { let mut fancy = FancyNum{ num: 5 }; let fancy_ref = &(&mut fancy); fancy_ref.num = 6; //~ ERROR E0389 - //~^ NOTE assignment into an immutable reference println!("{}", fancy_ref.num); } diff --git a/src/test/compile-fail/E0392.rs b/src/test/compile-fail/E0392.rs index a21e500e51..4c3efcf4e8 100644 --- a/src/test/compile-fail/E0392.rs +++ b/src/test/compile-fail/E0392.rs @@ -9,7 +9,6 @@ // except according to those terms. enum Foo { Bar } //~ ERROR E0392 - //~| NOTE unused type parameter fn main() { } diff --git a/src/test/compile-fail/E0393.rs b/src/test/compile-fail/E0393.rs index f045e87351..9165bc2837 100644 --- a/src/test/compile-fail/E0393.rs +++ b/src/test/compile-fail/E0393.rs @@ -12,8 +12,6 @@ trait A {} fn together_we_will_rule_the_galaxy(son: &A) {} //~^ ERROR E0393 -//~| NOTE missing reference to `T` -//~| NOTE because of the default `Self` reference, type parameters must be specified on object types fn main() { } diff --git a/src/test/compile-fail/E0394.rs b/src/test/compile-fail/E0394.rs index c7d5665cd2..dae8e14c5e 100644 --- a/src/test/compile-fail/E0394.rs +++ b/src/test/compile-fail/E0394.rs @@ -13,8 +13,6 @@ static A: u32 = 0; static B: u32 = A; //~^ ERROR E0394 -//~| NOTE referring to another static by value -//~| NOTE use the address-of operator or a constant instead fn main() { } diff --git a/src/test/compile-fail/E0395.rs b/src/test/compile-fail/E0395.rs index 98f08cd68c..00008ea6b6 100644 --- a/src/test/compile-fail/E0395.rs +++ b/src/test/compile-fail/E0395.rs @@ -12,6 +12,5 @@ static FOO: i32 = 42; static BAR: i32 = 42; static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395 - //~| NOTE comparing raw pointers in static fn main() { } diff --git a/src/test/compile-fail/E0396.rs b/src/test/compile-fail/E0396.rs index 47080fb6e9..7f34acdfb9 100644 --- a/src/test/compile-fail/E0396.rs +++ b/src/test/compile-fail/E0396.rs @@ -11,7 +11,6 @@ const REG_ADDR: *const u8 = 0x5f3759df as *const u8; const VALUE: u8 = unsafe { *REG_ADDR }; //~ ERROR E0396 - //~| NOTE dereference of raw pointer in constant fn main() { } diff --git a/src/test/compile-fail/E0403.rs b/src/test/compile-fail/E0403.rs index cd8532fc4c..6a68013dc6 100644 --- a/src/test/compile-fail/E0403.rs +++ b/src/test/compile-fail/E0403.rs @@ -9,8 +9,6 @@ // except according to those terms. fn foo(s: T, u: T) {} //~ ERROR E0403 - //~| NOTE already used - //~| NOTE first use of `T` fn main() { } diff --git a/src/test/compile-fail/E0407.rs b/src/test/compile-fail/E0407.rs index c207dbfca5..41d8b4513c 100644 --- a/src/test/compile-fail/E0407.rs +++ b/src/test/compile-fail/E0407.rs @@ -18,7 +18,6 @@ impl Foo for Bar { fn a() {} fn b() {} //~^ ERROR E0407 - //~| NOTE not a member of trait `Foo` } fn main() { diff --git a/src/test/compile-fail/E0408.rs b/src/test/compile-fail/E0408.rs index ce77a537e2..8ddeb20afd 100644 --- a/src/test/compile-fail/E0408.rs +++ b/src/test/compile-fail/E0408.rs @@ -13,7 +13,6 @@ fn main() { match x { Some(y) | None => {} //~ ERROR variable `y` is not bound in all patterns - _ => () //~| NOTE pattern doesn't bind `y` - //~| NOTE variable not in all patterns + _ => () } } diff --git a/src/test/compile-fail/E0426.rs b/src/test/compile-fail/E0426.rs index be21421cb0..d6261d3a74 100644 --- a/src/test/compile-fail/E0426.rs +++ b/src/test/compile-fail/E0426.rs @@ -12,6 +12,5 @@ fn main () { loop { break 'a; //~^ ERROR E0426 - //~| NOTE undeclared label `'a` } } diff --git a/src/test/compile-fail/E0428.rs b/src/test/compile-fail/E0428.rs index 4042219b5c..3c709f3a39 100644 --- a/src/test/compile-fail/E0428.rs +++ b/src/test/compile-fail/E0428.rs @@ -10,8 +10,6 @@ struct Bar; //~ previous definition of the type `Bar` here struct Bar; //~ ERROR E0428 - //~| NOTE `Bar` redefined here - //~| NOTE `Bar` must be defined only once in the type namespace of this module fn main () { } diff --git a/src/test/compile-fail/E0435.rs b/src/test/compile-fail/E0435.rs index 50a6d174e2..5246fda6aa 100644 --- a/src/test/compile-fail/E0435.rs +++ b/src/test/compile-fail/E0435.rs @@ -11,5 +11,4 @@ fn main () { let foo = 42u32; let _: [u8; foo]; //~ ERROR E0435 - //~| NOTE non-constant value } diff --git a/src/test/compile-fail/E0437.rs b/src/test/compile-fail/E0437.rs index 62ee8dc346..7440a82773 100644 --- a/src/test/compile-fail/E0437.rs +++ b/src/test/compile-fail/E0437.rs @@ -12,7 +12,6 @@ trait Foo {} impl Foo for i32 { type Bar = bool; //~ ERROR E0437 - //~| NOTE not a member of trait `Foo` } fn main () { diff --git a/src/test/compile-fail/E0438.rs b/src/test/compile-fail/E0438.rs index 99e0dbbcea..61d2513499 100644 --- a/src/test/compile-fail/E0438.rs +++ b/src/test/compile-fail/E0438.rs @@ -13,7 +13,6 @@ trait Bar {} impl Bar for i32 { const BAR: bool = true; //~ ERROR E0438 - //~| NOTE not a member of trait `Bar` } fn main () { diff --git a/src/test/compile-fail/E0445.rs b/src/test/compile-fail/E0445.rs index efef8305e5..bca1b52d17 100644 --- a/src/test/compile-fail/E0445.rs +++ b/src/test/compile-fail/E0445.rs @@ -14,12 +14,12 @@ trait Foo { pub trait Bar : Foo {} //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE private trait can't be public +//~| NOTE can't leak private trait pub struct Bar2(pub T); //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE private trait can't be public +//~| NOTE can't leak private trait pub fn foo (t: T) {} //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE private trait can't be public +//~| NOTE can't leak private trait fn main() {} diff --git a/src/test/compile-fail/E0446.rs b/src/test/compile-fail/E0446.rs index 493a272261..c576661828 100644 --- a/src/test/compile-fail/E0446.rs +++ b/src/test/compile-fail/E0446.rs @@ -12,7 +12,6 @@ mod Foo { struct Bar(u32); pub fn bar() -> Bar { //~ ERROR E0446 - //~| NOTE can't leak private type Bar(0) } } diff --git a/src/test/compile-fail/E0449.rs b/src/test/compile-fail/E0449.rs index 0b3fdb9e6a..ac365db33e 100644 --- a/src/test/compile-fail/E0449.rs +++ b/src/test/compile-fail/E0449.rs @@ -15,13 +15,9 @@ trait Foo { } pub impl Bar {} //~ ERROR E0449 - //~| NOTE `pub` not needed here - //~| NOTE place qualifiers on individual impl items instead pub impl Foo for Bar { //~ ERROR E0449 - //~| NOTE `pub` not needed here pub fn foo() {} //~ ERROR E0449 - //~| NOTE `pub` not needed here } fn main() { diff --git a/src/test/compile-fail/E0451.rs b/src/test/compile-fail/E0451.rs index ace96c9983..af4e7d628b 100644 --- a/src/test/compile-fail/E0451.rs +++ b/src/test/compile-fail/E0451.rs @@ -22,10 +22,8 @@ mod Bar { fn pat_match(foo: Bar::Foo) { let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451 - //~^ NOTE field `b` is private } fn main() { let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 - //~^ NOTE field `b` is private } diff --git a/src/test/compile-fail/E0453.rs b/src/test/compile-fail/E0453.rs index 6fed3dca94..8e51b84bab 100644 --- a/src/test/compile-fail/E0453.rs +++ b/src/test/compile-fail/E0453.rs @@ -9,10 +9,8 @@ // except according to those terms. #![forbid(non_snake_case)] -//~^ NOTE `forbid` level set here #[allow(non_snake_case)] //~^ ERROR allow(non_snake_case) overruled by outer forbid(non_snake_case) -//~| NOTE overruled by previous forbid fn main() { } diff --git a/src/test/compile-fail/E0454.rs b/src/test/compile-fail/E0454.rs index 39887927c8..afd0f5f5e4 100644 --- a/src/test/compile-fail/E0454.rs +++ b/src/test/compile-fail/E0454.rs @@ -10,7 +10,6 @@ #[link(name = "")] extern {} //~^ ERROR E0454 -//~| NOTE empty name given fn main() { } diff --git a/src/test/compile-fail/E0458.rs b/src/test/compile-fail/E0458.rs index e87158ae3b..fea27ef811 100644 --- a/src/test/compile-fail/E0458.rs +++ b/src/test/compile-fail/E0458.rs @@ -9,9 +9,7 @@ // except according to those terms. #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 - //~| NOTE unknown kind //~| ERROR E0459 - //~| NOTE missing `name` argument fn main() { } diff --git a/src/test/compile-fail/E0459.rs b/src/test/compile-fail/E0459.rs index 41376bd9ef..dc7ac714f2 100644 --- a/src/test/compile-fail/E0459.rs +++ b/src/test/compile-fail/E0459.rs @@ -9,7 +9,6 @@ // except according to those terms. #[link(kind = "dylib")] extern {} //~ ERROR E0459 - //~| NOTE missing `name` argument fn main() { } diff --git a/src/test/compile-fail/E0463.rs b/src/test/compile-fail/E0463.rs index 3ce5b83e89..aae83975b2 100644 --- a/src/test/compile-fail/E0463.rs +++ b/src/test/compile-fail/E0463.rs @@ -11,7 +11,6 @@ #![feature(plugin)] #![plugin(cookie_monster)] //~^ ERROR E0463 -//~| NOTE can't find crate extern crate cake_is_a_lie; fn main() { diff --git a/src/test/compile-fail/E0496.rs b/src/test/compile-fail/E0496.rs index 8aeeeebcb5..4ca3cd9c13 100644 --- a/src/test/compile-fail/E0496.rs +++ b/src/test/compile-fail/E0496.rs @@ -13,9 +13,7 @@ struct Foo<'a> { } impl<'a> Foo<'a> { - //~^ NOTE first declared here fn f<'a>(x: &'a i32) { //~ ERROR E0496 - //~^ NOTE lifetime 'a already in scope } } diff --git a/src/test/compile-fail/E0501.rs b/src/test/compile-fail/E0501.rs index 04678b96c8..f7e246e8f0 100644 --- a/src/test/compile-fail/E0501.rs +++ b/src/test/compile-fail/E0501.rs @@ -8,17 +8,28 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-tidy-linelength +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + fn inside_closure(x: &mut i32) { } -fn outside_closure(x: &mut i32) { +fn outside_closure_1(x: &mut i32) { +} + +fn outside_closure_2(x: &i32) { } fn foo(a: &mut i32) { let bar = || { inside_closure(a) }; - outside_closure(a); //~ ERROR E0501 + outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access + //[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access + + outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access + //[mir]~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access } fn main() { diff --git a/src/test/compile-fail/E0506.rs b/src/test/compile-fail/E0506.rs index b2cf66849c..c4a7f25739 100644 --- a/src/test/compile-fail/E0506.rs +++ b/src/test/compile-fail/E0506.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir struct FancyNum { num: u8, @@ -19,8 +19,7 @@ fn main() { let mut fancy_num = FancyNum { num: 5 }; let fancy_ref = &fancy_num; fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506 - //[mir]~^ ERROR (Mir) [E0506] - //[mir]~| ERROR (Ast) [E0506] + //[mir]~^ ERROR [E0506] println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num); } diff --git a/src/test/compile-fail/E0508.rs b/src/test/compile-fail/E0508.rs index d75f92580c..0c3dce6b03 100644 --- a/src/test/compile-fail/E0508.rs +++ b/src/test/compile-fail/E0508.rs @@ -9,13 +9,12 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Zborrowck-mir +//[mir]compile-flags: -Z borrowck=mir struct NonCopy; fn main() { let array = [NonCopy; 1]; - let _value = array[0]; //[ast]~ ERROR E0508 - //[mir]~^ ERROR (Ast) [E0508] - //[mir]~| ERROR (Mir) [E0508] + let _value = array[0]; //[ast]~ ERROR [E0508] + //[mir]~^ ERROR [E0508] } diff --git a/src/test/compile-fail/E0517.rs b/src/test/compile-fail/E0517.rs index 7feda670f5..561223ccdf 100644 --- a/src/test/compile-fail/E0517.rs +++ b/src/test/compile-fail/E0517.rs @@ -9,16 +9,16 @@ // except according to those terms. #[repr(C)] //~ ERROR: E0517 -type Foo = u8; //~ NOTE: not a struct, enum or union +type Foo = u8; #[repr(packed)] //~ ERROR: E0517 -enum Foo2 {Bar, Baz} //~ NOTE: not a struct +enum Foo2 {Bar, Baz} #[repr(u8)] //~ ERROR: E0517 -struct Foo3 {bar: bool, baz: bool} //~ NOTE: not an enum +struct Foo3 {bar: bool, baz: bool} #[repr(C)] //~ ERROR: E0517 -impl Foo3 { //~ NOTE: not a struct, enum or union +impl Foo3 { } fn main() { diff --git a/src/test/compile-fail/E0518.rs b/src/test/compile-fail/E0518.rs index 63d40db004..6d5b6e48e0 100644 --- a/src/test/compile-fail/E0518.rs +++ b/src/test/compile-fail/E0518.rs @@ -9,10 +9,10 @@ // except according to those terms. #[inline(always)] //~ ERROR: E0518 -struct Foo; //~ NOTE: not a function +struct Foo; #[inline(never)] //~ ERROR: E0518 -impl Foo { //~ NOTE: not a function +impl Foo { } fn main() { diff --git a/src/test/compile-fail/E0520.rs b/src/test/compile-fail/E0520.rs index ff6152d377..eae5b11a81 100644 --- a/src/test/compile-fail/E0520.rs +++ b/src/test/compile-fail/E0520.rs @@ -19,15 +19,12 @@ impl SpaceLlama for T { } impl SpaceLlama for T { -//~^ NOTE parent `impl` is here fn fly(&self) {} } impl SpaceLlama for i32 { default fn fly(&self) {} //~^ ERROR E0520 - //~| NOTE cannot specialize default item `fly` - //~| NOTE `fly` in the parent `impl` must be marked `default` } fn main() { diff --git a/src/test/compile-fail/E0527.rs b/src/test/compile-fail/E0527.rs index 0b664094a4..67d222e867 100644 --- a/src/test/compile-fail/E0527.rs +++ b/src/test/compile-fail/E0527.rs @@ -15,7 +15,6 @@ fn main() { match r { &[a, b] => { //~^ ERROR E0527 - //~| NOTE expected 4 elements println!("a={}, b={}", a, b); } } diff --git a/src/test/compile-fail/E0528.rs b/src/test/compile-fail/E0528.rs index e912650f11..e2aa2c067c 100644 --- a/src/test/compile-fail/E0528.rs +++ b/src/test/compile-fail/E0528.rs @@ -15,7 +15,6 @@ fn main() { match r { &[a, b, c, rest..] => { //~^ ERROR E0528 - //~| NOTE pattern cannot match array of 2 elements } } } diff --git a/src/test/compile-fail/E0529.rs b/src/test/compile-fail/E0529.rs index 18d3e68816..5262ad7b71 100644 --- a/src/test/compile-fail/E0529.rs +++ b/src/test/compile-fail/E0529.rs @@ -15,7 +15,6 @@ fn main() { match r { [a, b] => { //~^ ERROR E0529 - //~| NOTE pattern cannot match with input type `f32` } } } diff --git a/src/test/compile-fail/E0532.rs b/src/test/compile-fail/E0532.rs new file mode 100644 index 0000000000..5dc3b5f94f --- /dev/null +++ b/src/test/compile-fail/E0532.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let value = 1; + + match SomeStruct(value) { + StructConst1(_) => { }, + //~^ ERROR expected tuple struct/variant, found constant `StructConst1` + _ => { }, + } + + struct SomeStruct(u8); + + const StructConst1 : SomeStruct = SomeStruct(1); + const StructConst2 : SomeStruct = SomeStruct(2); +} diff --git a/src/test/compile-fail/E0558.rs b/src/test/compile-fail/E0558.rs index 0c2ca69849..64a6ee4cf5 100644 --- a/src/test/compile-fail/E0558.rs +++ b/src/test/compile-fail/E0558.rs @@ -10,7 +10,6 @@ #[export_name] //~^ ERROR E0558 -//~| NOTE did you mean #[export_name="*"]? pub fn something() {} diff --git a/src/test/compile-fail/E0559.rs b/src/test/compile-fail/E0559.rs index e8b0915d2b..da0f692cc2 100644 --- a/src/test/compile-fail/E0559.rs +++ b/src/test/compile-fail/E0559.rs @@ -15,6 +15,4 @@ enum Field { fn main() { let s = Field::Fool { joke: 0 }; //~^ ERROR E0559 - //~| NOTE `Field::Fool` does not have this field - //~| NOTE available fields are: `x` } diff --git a/src/test/compile-fail/E0560.rs b/src/test/compile-fail/E0560.rs index 955ef7ca99..bbb7f08d62 100644 --- a/src/test/compile-fail/E0560.rs +++ b/src/test/compile-fail/E0560.rs @@ -15,6 +15,4 @@ struct Simba { fn main() { let s = Simba { mother: 1, father: 0 }; //~^ ERROR E0560 - //~| NOTE `Simba` does not have this field - //~| NOTE available fields are: `mother` } diff --git a/src/test/compile-fail/E0594.rs b/src/test/compile-fail/E0594.rs index 8d33d658de..f3fbc3b8b5 100644 --- a/src/test/compile-fail/E0594.rs +++ b/src/test/compile-fail/E0594.rs @@ -9,12 +9,11 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir static NUM: i32 = 18; fn main() { NUM = 20; //[ast]~ ERROR E0594 - //[mir]~^ ERROR cannot assign to immutable static item (Ast) - //[mir]~| ERROR cannot assign to immutable static item `NUM` (Mir) + //[mir]~^ ERROR cannot assign to immutable item `NUM` } diff --git a/src/test/compile-fail/E0596.rs b/src/test/compile-fail/E0596.rs index 0366d4d134..52bdff55d8 100644 --- a/src/test/compile-fail/E0596.rs +++ b/src/test/compile-fail/E0596.rs @@ -9,11 +9,10 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn main() { let x = 1; let y = &mut x; //[ast]~ ERROR [E0596] - //[mir]~^ ERROR (Ast) [E0596] - //[mir]~| ERROR (Mir) [E0596] + //[mir]~^ ERROR [E0596] } diff --git a/src/test/compile-fail/E0597.rs b/src/test/compile-fail/E0597.rs index 00ef14a8e2..2f4a1da91d 100644 --- a/src/test/compile-fail/E0597.rs +++ b/src/test/compile-fail/E0597.rs @@ -16,4 +16,5 @@ fn main() { let mut x = Foo { x: None }; let y = 0; x.x = Some(&y); -} //~ `y` does not live long enough [E0597] + //~^ `y` does not live long enough [E0597] +} diff --git a/src/test/compile-fail/E0599.rs b/src/test/compile-fail/E0599.rs new file mode 100644 index 0000000000..30fca2bac0 --- /dev/null +++ b/src/test/compile-fail/E0599.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo; + +fn main() { + || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 +} diff --git a/src/test/compile-fail/E0605.rs b/src/test/compile-fail/E0605.rs index add3fd8fd8..4b5b8beb36 100644 --- a/src/test/compile-fail/E0605.rs +++ b/src/test/compile-fail/E0605.rs @@ -11,9 +11,7 @@ fn main() { let x = 0u8; x as Vec; //~ ERROR E0605 - //~| NOTE an `as` expression can only be used to convert between primitive types let v = 0 as *const u8; v as &u8; //~ ERROR E0605 - //~| NOTE an `as` expression can only be used to convert between primitive types } diff --git a/src/test/compile-fail/E0618.rs b/src/test/compile-fail/E0618.rs index 1ba2e8e2e5..f28ac200de 100644 --- a/src/test/compile-fail/E0618.rs +++ b/src/test/compile-fail/E0618.rs @@ -14,7 +14,6 @@ enum X { fn main() { X::Entry(); //~ ERROR expected function, found `X::Entry` [E0618] - //~| HELP did you mean to write `X::Entry`? let x = 0i32; x(); //~ ERROR expected function, found `i32` [E0618] } diff --git a/src/test/compile-fail/E0657.rs b/src/test/compile-fail/E0657.rs new file mode 100644 index 0000000000..4595e41308 --- /dev/null +++ b/src/test/compile-fail/E0657.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![allow(warnings)] +#![feature(conservative_impl_trait, nested_impl_trait)] + +trait Id {} +trait Lt<'a> {} + +impl<'a> Lt<'a> for () {} +impl Id for T {} + +fn free_fn_capture_hrtb_in_impl_trait() + -> impl for<'a> Id> + //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657] +{ + () +} + +struct Foo; +impl Foo { + fn impl_fn_capture_hrtb_in_impl_trait() + -> impl for<'a> Id> + //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level + { + () + } +} + +fn main() {} diff --git a/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs b/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs new file mode 100644 index 0000000000..8e5ba489c5 --- /dev/null +++ b/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(use_nested_groups)] +#![allow(unused_imports)] + +mod foo {} + +use foo::{ + ::bar, //~ ERROR crate root in paths can only be used in start position + super::bar, //~ ERROR `super` in paths can only be used in start position + self::bar, //~ ERROR `self` in paths can only be used in start position +}; + +fn main() {} diff --git a/src/test/compile-fail/asm-out-read-uninit.rs b/src/test/compile-fail/asm-out-read-uninit.rs index c85a097b96..02462bf1be 100644 --- a/src/test/compile-fail/asm-out-read-uninit.rs +++ b/src/test/compile-fail/asm-out-read-uninit.rs @@ -13,6 +13,9 @@ // ignore-powerpc // ignore-sparc +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![feature(asm)] fn foo(x: isize) { println!("{}", x); } @@ -24,7 +27,9 @@ fn foo(x: isize) { println!("{}", x); } pub fn main() { let x: isize; unsafe { - asm!("mov $1, $0" : "=r"(x) : "r"(x)); //~ ERROR use of possibly uninitialized variable: `x` + asm!("mov $1, $0" : "=r"(x) : "r"(x)); + //[ast]~^ ERROR use of possibly uninitialized variable: `x` + //[mir]~^^ ERROR use of possibly uninitialized variable: `x` } foo(x); } diff --git a/src/test/compile-fail/assign-imm-local-twice.rs b/src/test/compile-fail/assign-imm-local-twice.rs index 5b3b7d44bd..d5e412c374 100644 --- a/src/test/compile-fail/assign-imm-local-twice.rs +++ b/src/test/compile-fail/assign-imm-local-twice.rs @@ -8,12 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Zborrowck=mir + fn test() { let v: isize; - v = 1; //~ NOTE first assignment + v = 1; //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment println!("v={}", v); - v = 2; //~ ERROR cannot assign twice to immutable variable - //~| NOTE cannot assign twice to immutable + v = 2; //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `v` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable println!("v={}", v); } diff --git a/src/test/compile-fail/associated-const-in-trait.rs b/src/test/compile-fail/associated-const-in-trait.rs new file mode 100644 index 0000000000..f837d9ab8e --- /dev/null +++ b/src/test/compile-fail/associated-const-in-trait.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// #29924 + +#![feature(const_fn, associated_consts)] + +trait Trait { + const N: usize; +} + +impl Trait { + //~^ ERROR the trait `Trait` cannot be made into an object [E0038] + const fn n() -> usize { Self::N } +} + +fn main() {} diff --git a/src/test/compile-fail/auxiliary/issue_5844_aux.rs b/src/test/compile-fail/auxiliary/issue_5844_aux.rs index 5c878b1e66..7fa937e93b 100644 --- a/src/test/compile-fail/auxiliary/issue_5844_aux.rs +++ b/src/test/compile-fail/auxiliary/issue_5844_aux.rs @@ -8,10 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc)] - -extern crate libc; - extern "C" { - pub fn rand() -> libc::c_int; + pub fn rand() -> u32; } diff --git a/src/test/compile-fail/auxiliary/private-inferred-type.rs b/src/test/compile-fail/auxiliary/private-inferred-type.rs index 7627f5dc0c..fc43765f63 100644 --- a/src/test/compile-fail/auxiliary/private-inferred-type.rs +++ b/src/test/compile-fail/auxiliary/private-inferred-type.rs @@ -11,6 +11,7 @@ #![feature(decl_macro)] fn priv_fn() {} +static PRIV_STATIC: u8 = 0; enum PrivEnum { Variant } pub enum PubEnum { Variant } trait PrivTrait { fn method() {} } @@ -34,6 +35,7 @@ impl Pub { pub macro m() { priv_fn; + PRIV_STATIC; PrivEnum::Variant; PubEnum::Variant; ::method; diff --git a/src/test/compile-fail/bad-env-capture.rs b/src/test/compile-fail/bad-env-capture.rs index 9386648873..6a5e4cfef8 100644 --- a/src/test/compile-fail/bad-env-capture.rs +++ b/src/test/compile-fail/bad-env-capture.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: can't capture dynamic environment in a fn item; +// error-pattern: can't capture dynamic environment in a fn item fn foo() { let x: isize; fn bar() { log(debug, x); } diff --git a/src/test/compile-fail/bad-env-capture2.rs b/src/test/compile-fail/bad-env-capture2.rs index 39a6922cfd..cf67c73c53 100644 --- a/src/test/compile-fail/bad-env-capture2.rs +++ b/src/test/compile-fail/bad-env-capture2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: can't capture dynamic environment in a fn item; +// error-pattern: can't capture dynamic environment in a fn item fn foo(x: isize) { fn bar() { log(debug, x); } } diff --git a/src/test/compile-fail/bad-env-capture3.rs b/src/test/compile-fail/bad-env-capture3.rs index 8857b94ddc..a30c6770b8 100644 --- a/src/test/compile-fail/bad-env-capture3.rs +++ b/src/test/compile-fail/bad-env-capture3.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: can't capture dynamic environment in a fn item; +// error-pattern: can't capture dynamic environment in a fn item fn foo(x: isize) { fn mth() { fn bar() { log(debug, x); } diff --git a/src/test/compile-fail/borrowck/borrowck-access-permissions.rs b/src/test/compile-fail/borrowck/borrowck-access-permissions.rs index fbe219102e..00a3da8607 100644 --- a/src/test/compile-fail/borrowck/borrowck-access-permissions.rs +++ b/src/test/compile-fail/borrowck/borrowck-access-permissions.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir static static_x : i32 = 1; static mut static_x_mut : i32 = 1; @@ -20,15 +20,13 @@ fn main() { { // borrow of local let _y1 = &mut x; //[ast]~ ERROR [E0596] - //[mir]~^ ERROR (Ast) [E0596] - //[mir]~| ERROR (Mir) [E0596] + //[mir]~^ ERROR [E0596] let _y2 = &mut x_mut; // No error } { // borrow of static let _y1 = &mut static_x; //[ast]~ ERROR [E0596] - //[mir]~^ ERROR (Ast) [E0596] - //[mir]~| ERROR (Mir) [E0596] + //[mir]~^ ERROR [E0596] unsafe { let _y2 = &mut static_x_mut; } // No error } @@ -37,8 +35,7 @@ fn main() { let mut box_x_mut = Box::new(1); let _y1 = &mut *box_x; //[ast]~ ERROR [E0596] - //[mir]~^ ERROR (Ast) [E0596] - //[mir]~| ERROR (Mir) [E0596] + //[mir]~^ ERROR [E0596] let _y2 = &mut *box_x_mut; // No error } @@ -47,8 +44,7 @@ fn main() { let ref_x_mut = &mut x_mut; let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596] - //[mir]~^ ERROR (Ast) [E0596] - //[mir]~| ERROR (Mir) [E0596] + //[mir]~^ ERROR [E0596] let _y2 = &mut *ref_x_mut; // No error } @@ -58,8 +54,7 @@ fn main() { unsafe { let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596] - //[mir]~^ ERROR (Ast) [E0596] - //[mir]~| ERROR (Mir) [E0596] + //[mir]~^ ERROR [E0596] let _y2 = &mut *ptr_mut_x; // No error } } @@ -69,8 +64,7 @@ fn main() { let mut foo = Foo { f: &mut x_mut, g: &x }; let foo_ref = &foo; let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389] - //[mir]~^ ERROR (Ast) [E0389] - //[mir]~| ERROR (Mir) [E0596] - // FIXME: Wrong error in MIR + //[mir]~^ ERROR [E0596] + // FIXME: Wrong error in MIR } } diff --git a/src/test/compile-fail/borrowck/borrowck-asm.rs b/src/test/compile-fail/borrowck/borrowck-asm.rs new file mode 100644 index 0000000000..6bccc83868 --- /dev/null +++ b/src/test/compile-fail/borrowck/borrowck-asm.rs @@ -0,0 +1,97 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-s390x +// ignore-emscripten +// ignore-powerpc +// ignore-sparc + +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir -Z nll + +#![feature(asm)] + +#[cfg(any(target_arch = "x86", + target_arch = "x86_64", + target_arch = "arm", + target_arch = "aarch64"))] +mod test_cases { + fn is_move() { + let y: &mut isize; + let x = &mut 0isize; + unsafe { + asm!("nop" : : "r"(x)); + } + let z = x; //[ast]~ ERROR use of moved value: `x` + //[mir]~^ ERROR use of moved value: `x` + } + + fn in_is_read() { + let mut x = 3; + let y = &mut x; + unsafe { + asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use + //[mir]~^ ERROR cannot use + } + let z = y; + } + + fn out_is_assign() { + let x = 3; + unsafe { + asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice + //[mir]~^ ERROR cannot assign twice + } + let mut a = &mut 3; + let b = &*a; + unsafe { + asm!("nop" : "=r"(a)); //[ast]~ ERROR cannot assign to `a` because it is borrowed + // No MIR error, this is a shallow write. + } + let c = b; + let d = *a; + } + + fn rw_is_assign() { + let x = 3; + unsafe { + asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice + //[mir]~^ ERROR cannot assign twice + } + } + + fn indirect_is_not_init() { + let x: i32; + unsafe { + asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable + //[mir]~^ ERROR use of possibly uninitialized variable + } + } + + fn rw_is_read() { + let mut x = &mut 3; + let y = &*x; + unsafe { + asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed + //[mir]~^ ERROR cannot assign to `x` because it is borrowed + } + let z = y; + } + + fn two_moves() { + let x = &mut 2; + unsafe { + asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value + //[mir]~^ ERROR use of moved value + } + } +} + +fn main() {} diff --git a/src/test/compile-fail/borrowck/borrowck-assign-comp.rs b/src/test/compile-fail/borrowck/borrowck-assign-comp.rs index 548436c3ed..d68420eb20 100644 --- a/src/test/compile-fail/borrowck/borrowck-assign-comp.rs +++ b/src/test/compile-fail/borrowck/borrowck-assign-comp.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir struct point { x: isize, y: isize } @@ -21,8 +21,7 @@ fn a() { // inherently mutable; since `p` was made immutable, `p.x` is now // immutable. Otherwise the type of &_q.x (&isize) would be wrong. p.x = 5; //[ast]~ ERROR cannot assign to `p.x` - //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `p.x` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed q.x; } @@ -33,8 +32,7 @@ fn c() { let mut p = point {x: 3, y: 4}; let q = &p.y; p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` - //[mir]~^ ERROR cannot assign to `p` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `p` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `p` because it is borrowed p.x; // silence warning *q; // stretch loan } @@ -46,8 +44,7 @@ fn d() { let mut p = point {x: 3, y: 4}; let q = &p.y; p.y = 5; //[ast]~ ERROR cannot assign to `p.y` - //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `p.y` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed *q; } diff --git a/src/test/compile-fail/borrowck/borrowck-assign-to-constants.rs b/src/test/compile-fail/borrowck/borrowck-assign-to-constants.rs index 3c93a391a6..76a670af35 100644 --- a/src/test/compile-fail/borrowck/borrowck-assign-to-constants.rs +++ b/src/test/compile-fail/borrowck/borrowck-assign-to-constants.rs @@ -9,13 +9,12 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir static foo: isize = 5; fn main() { // assigning to various global constants foo = 6; //[ast]~ ERROR cannot assign to immutable static item - //[mir]~^ ERROR cannot assign to immutable static item (Ast) - //[mir]~| ERROR cannot assign to immutable static item `foo` (Mir) + //[mir]~^ ERROR cannot assign to immutable item `foo` } diff --git a/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs index 0b6b9bf7d4..f498d8d500 100644 --- a/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs @@ -13,7 +13,7 @@ // ignore-tidy-linelength // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir #![feature(box_syntax)] @@ -29,48 +29,42 @@ fn a() { let mut x = 3; let c1 = || x = 4; let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x` - //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable } fn b() { let mut x = 3; let c1 = || set(&mut x); let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x` - //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable } fn c() { let mut x = 3; let c1 = || set(&mut x); let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x` - //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable } fn d() { let mut x = 3; let c2 = || x * 5; x = 5; //[ast]~ ERROR cannot assign - //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `x` because it is borrowed } fn e() { let mut x = 3; let c1 = || get(&x); x = 5; //[ast]~ ERROR cannot assign - //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `x` because it is borrowed } fn f() { let mut x: Box<_> = box 3; let c1 = || get(&*x); - *x = 5; //[ast]~ ERROR cannot assign - //[mir]~^ ERROR cannot assign to `*x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `(*x)` because it is borrowed (Mir) + *x = 5; //[ast]~ ERROR cannot assign to `*x` + //[mir]~^ ERROR cannot assign to `*x` because it is borrowed } fn g() { @@ -81,8 +75,7 @@ fn g() { let mut x: Box<_> = box Foo { f: box 3 }; let c1 = || get(&*x.f); *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f` - //[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `(*x.f)` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed } fn h() { @@ -93,8 +86,7 @@ fn h() { let mut x: Box<_> = box Foo { f: box 3 }; let c1 = || get(&*x.f); let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable - //[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable (Ast) - //[mir]~| ERROR cannot borrow `x` as mutable because it is also borrowed as immutable (Mir) + //[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable } fn main() { diff --git a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs index d1cf08ac75..1d08b80746 100644 --- a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs +++ b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs @@ -10,7 +10,7 @@ // ignore-tidy-linelength // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir #![feature(slice_patterns)] #![feature(advanced_slice_patterns)] @@ -52,34 +52,30 @@ fn main() { let mut f = Foo { x: 22 }; let _x = f.x(); f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed - //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `f.x` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed } // Local and field from tuple-struct { let mut g = Bar(22); let _0 = g.x(); g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed - //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `g.0` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed } // Local and field from tuple { let mut h = (22, 23); let _0 = &mut h.0; h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed - //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `h.0` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed } // Local and field from enum { let mut e = Baz::X(2); let _e0 = e.x(); - match e { + match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed Baz::X(value) => value //[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `e.0` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed }; } // Local and field from union @@ -87,42 +83,37 @@ fn main() { let mut u = U { b: 0 }; let _ra = &mut u.a; u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed - //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `u.a` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed } // Deref and field from struct { let mut f = Box::new(Foo { x: 22 }); let _x = f.x(); f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed - //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `f.x` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed } // Deref and field from tuple-struct { let mut g = Box::new(Bar(22)); let _0 = g.x(); g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed - //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `g.0` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed } // Deref and field from tuple { let mut h = Box::new((22, 23)); let _0 = &mut h.0; h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed - //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `h.0` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed } // Deref and field from enum { let mut e = Box::new(Baz::X(3)); let _e0 = e.x(); - match *e { + match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed Baz::X(value) => value //[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `e.0` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed }; } // Deref and field from union @@ -130,39 +121,34 @@ fn main() { let mut u = Box::new(U { b: 0 }); let _ra = &mut u.a; u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed - //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `u.a` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed } // Constant index { let mut v = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let _v = &mut v; - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[x, _, .., _, _] => println!("{}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[_, x, .., _, _] => println!("{}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[_, _, .., x, _] => println!("{}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[_, _, .., _, x] => println!("{}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } } @@ -170,32 +156,28 @@ fn main() { { let mut v = &[1, 2, 3, 4, 5]; let _v = &mut v; - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[x..] => println!("{:?}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[_, x..] => println!("{:?}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[x.., _] => println!("{:?}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[_, x.., _] => println!("{:?}", x), //[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..]` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed _ => panic!("other case"), } } @@ -205,17 +187,15 @@ fn main() { let mut e = E::A(3); let _e = &mut e; - match e { + match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed E::A(ref ax) => //[ast]~^ ERROR cannot borrow `e.0` as immutable because `e` is also borrowed as mutable - //[mir]~^^ ERROR cannot borrow `e.0` as immutable because `e` is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `e.0` as immutable because it is also borrowed as mutable (Mir) - //[mir]~| ERROR cannot use `e` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot borrow `e.0` as immutable because it is also borrowed as mutable + //[mir]~| ERROR cannot use `e` because it was mutably borrowed println!("e.ax: {:?}", ax), E::B { x: ref bx } => //[ast]~^ ERROR cannot borrow `e.x` as immutable because `e` is also borrowed as mutable - //[mir]~^^ ERROR cannot borrow `e.x` as immutable because `e` is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `e.x` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^^ ERROR cannot borrow `e.x` as immutable because it is also borrowed as mutable println!("e.bx: {:?}", bx), } } @@ -225,19 +205,17 @@ fn main() { struct S { x: F, y: (u32, u32), }; let mut s = S { x: F { x: 1, y: 2}, y: (999, 998) }; let _s = &mut s; - match s { + match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed S { y: (ref y0, _), .. } => //[ast]~^ ERROR cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable - //[mir]~^^ ERROR cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `s.y.0` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^^ ERROR cannot borrow `s.y.0` as immutable because it is also borrowed as mutable println!("y0: {:?}", y0), _ => panic!("other case"), } - match s { + match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed S { x: F { y: ref x0, .. }, .. } => //[ast]~^ ERROR cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable - //[mir]~^^ ERROR cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `s.x.y` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^^ ERROR cannot borrow `s.x.y` as immutable because it is also borrowed as mutable println!("x0: {:?}", x0), _ => panic!("other case"), } @@ -252,7 +230,7 @@ fn main() { fn bump<'a>(mut block: &mut Block<'a>) { let x = &mut block; let p: &'a u8 = &*block.current; - //[mir]~^ ERROR cannot borrow `(*block.current)` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable // No errors in AST because of issue rust#38899 } } @@ -266,7 +244,7 @@ fn main() { unsafe fn bump2(mut block: *mut Block2) { let x = &mut block; let p : *const u8 = &*(*block).current; - //[mir]~^ ERROR cannot borrow `(*block.current)` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable // No errors in AST because of issue rust#38899 } } @@ -277,18 +255,17 @@ fn main() { let _v = &mut v; v[0].y; //[ast]~^ ERROR cannot use `v[..].y` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..].y` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `v[..].y` because it was mutably borrowed (Mir) - //[mir]~| ERROR cannot use `(*v)` because it was mutably borrowed (Mir) + //[mir]~^^ ERROR cannot use `v[..].y` because it was mutably borrowed + //[mir]~| ERROR cannot use `*v` because it was mutably borrowed } // Field of constant index { struct F {x: u32, y: u32}; let mut v = &[F{x: 1, y: 2}, F{x: 3, y: 4}]; let _v = &mut v; - match v { + match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed &[_, F {x: ref xf, ..}] => println!("{}", xf), - //[mir]~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable // No errors in AST _ => panic!("other case") } @@ -299,8 +276,7 @@ fn main() { || { let y = &mut x; &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time - //[mir]~^ ERROR cannot borrow `**x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time *y = 1; }; } @@ -311,10 +287,19 @@ fn main() { || { let y = &mut x; &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time - //[mir]~^ ERROR cannot borrow `**x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time *y = 1; } }; } + { + fn foo(x: Vec) { + let c = || { + drop(x); + drop(x); //[ast]~ ERROR use of moved value: `x` + //[mir]~^ ERROR use of moved value: `x` + }; + c(); + } + } } diff --git a/src/test/compile-fail/borrowck/borrowck-drop-from-guard.rs b/src/test/compile-fail/borrowck/borrowck-drop-from-guard.rs index 087ced01d8..496aa84b59 100644 --- a/src/test/compile-fail/borrowck/borrowck-drop-from-guard.rs +++ b/src/test/compile-fail/borrowck/borrowck-drop-from-guard.rs @@ -9,7 +9,7 @@ // except according to those terms. -//compile-flags: -Z emit-end-regions -Z borrowck-mir +//compile-flags: -Z borrowck=mir fn foo(_:String) {} @@ -19,6 +19,6 @@ fn main() match Some(42) { Some(_) if { drop(my_str); false } => {} Some(_) => {} - None => { foo(my_str); } //~ ERROR (Mir) [E0382] + None => { foo(my_str); } //~ ERROR [E0382] } } diff --git a/src/test/compile-fail/borrowck/borrowck-fn-in-const-a.rs b/src/test/compile-fail/borrowck/borrowck-fn-in-const-a.rs index fcdcf198c2..33b78cb26d 100644 --- a/src/test/compile-fail/borrowck/borrowck-fn-in-const-a.rs +++ b/src/test/compile-fail/borrowck/borrowck-fn-in-const-a.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Check that we check fns appearing in constant declarations. // Issue #22382. @@ -17,8 +17,7 @@ const MOVE: fn(&String) -> String = { fn broken(x: &String) -> String { return *x //[ast]~ ERROR cannot move out of borrowed content [E0507] - //[mir]~^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^ ERROR [E0507] } broken }; diff --git a/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs index 03b6b1d732..f09a0c7414 100644 --- a/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs +++ b/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn main() { let mut _a = 3; @@ -17,7 +17,6 @@ fn main() { { let _c = &*_b; _a = 4; //[ast]~ ERROR cannot assign to `_a` - //[mir]~^ ERROR cannot assign to `_a` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `_a` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `_a` because it is borrowed } } diff --git a/src/test/compile-fail/borrowck/borrowck-init-in-fru.rs b/src/test/compile-fail/borrowck/borrowck-init-in-fru.rs index 017318b6b2..1ec0f98077 100644 --- a/src/test/compile-fail/borrowck/borrowck-init-in-fru.rs +++ b/src/test/compile-fail/borrowck/borrowck-init-in-fru.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir #[derive(Clone)] struct point { @@ -21,7 +21,6 @@ fn main() { let mut origin: point; origin = point {x: 10,.. origin}; //[ast]~^ ERROR use of possibly uninitialized variable: `origin.y` [E0381] - //[mir]~^^ ERROR (Ast) [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^^ ERROR [E0381] origin.clone(); } diff --git a/src/test/compile-fail/borrowck/borrowck-issue-14498.rs b/src/test/compile-fail/borrowck/borrowck-issue-14498.rs index 8b7ccedd69..8a09ab3fd0 100644 --- a/src/test/compile-fail/borrowck/borrowck-issue-14498.rs +++ b/src/test/compile-fail/borrowck/borrowck-issue-14498.rs @@ -14,6 +14,9 @@ // Also includes tests of the errors reported when the Box in question // is immutable (#14270). +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![feature(box_syntax)] struct A { a: isize } @@ -23,7 +26,8 @@ fn indirect_write_to_imm_box() { let mut x: isize = 1; let y: Box<_> = box &mut x; let p = &y; - ***p = 2; //~ ERROR cannot assign to data in a `&` reference + ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference + //[mir]~^ ERROR cannot assign to immutable item `***p` drop(p); } @@ -32,7 +36,8 @@ fn borrow_in_var_from_var() { let mut y: Box<_> = box &mut x; let p = &y; let q = &***p; - **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed + **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y` because it is borrowed drop(p); drop(q); } @@ -42,7 +47,8 @@ fn borrow_in_var_from_var_via_imm_box() { let y: Box<_> = box &mut x; let p = &y; let q = &***p; - **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed + **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y` because it is borrowed drop(p); drop(q); } @@ -52,7 +58,8 @@ fn borrow_in_var_from_field() { let mut y: Box<_> = box &mut x.a; let p = &y; let q = &***p; - **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed + **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y` because it is borrowed drop(p); drop(q); } @@ -62,7 +69,8 @@ fn borrow_in_var_from_field_via_imm_box() { let y: Box<_> = box &mut x.a; let p = &y; let q = &***p; - **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed + **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y` because it is borrowed drop(p); drop(q); } @@ -72,7 +80,8 @@ fn borrow_in_field_from_var() { let mut y = B { a: box &mut x }; let p = &y.a; let q = &***p; - **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed + **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed drop(p); drop(q); } @@ -82,7 +91,8 @@ fn borrow_in_field_from_var_via_imm_box() { let y = B { a: box &mut x }; let p = &y.a; let q = &***p; - **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed + **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed drop(p); drop(q); } @@ -92,7 +102,8 @@ fn borrow_in_field_from_field() { let mut y = B { a: box &mut x.a }; let p = &y.a; let q = &***p; - **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed + **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed drop(p); drop(q); } @@ -102,7 +113,8 @@ fn borrow_in_field_from_field_via_imm_box() { let y = B { a: box &mut x.a }; let p = &y.a; let q = &***p; - **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed + **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed + //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed drop(p); drop(q); } diff --git a/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs index 0e8c003e40..2fe764568b 100644 --- a/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs +++ b/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir #![allow(unused_variables)] #![allow(unused_assignments)] @@ -26,8 +26,7 @@ fn separate_arms() { } Some(ref __isize) => { x = Some(1); //[ast]~ ERROR cannot assign - //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `x` because it is borrowed } } x.clone(); // just to prevent liveness warnings diff --git a/src/test/compile-fail/directory_ownership/backcompat-warnings.rs b/src/test/compile-fail/borrowck/borrowck-local-borrow-outlives-fn.rs similarity index 67% rename from src/test/compile-fail/directory_ownership/backcompat-warnings.rs rename to src/test/compile-fail/borrowck/borrowck-local-borrow-outlives-fn.rs index 519792dfa3..0d5feb6b9c 100644 --- a/src/test/compile-fail/directory_ownership/backcompat-warnings.rs +++ b/src/test/compile-fail/borrowck/borrowck-local-borrow-outlives-fn.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: cannot declare a new module at this location -// error-pattern: will become a hard error +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir -#[path="mod_file_not_owning_aux3.rs"] -mod foo; +fn cplusplus_mode(x: isize) -> &'static isize { + &x + //[ast]~^ ERROR `x` does not live long enough [E0597] + //[mir]~^^ ERROR `x` does not live long enough [E0597] +} fn main() {} diff --git a/src/test/compile-fail/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs b/src/test/compile-fail/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs new file mode 100644 index 0000000000..2c9ace4825 --- /dev/null +++ b/src/test/compile-fail/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + +fn cplusplus_mode_exceptionally_unsafe(x: &mut Option<&'static mut isize>) { + let mut z = (0, 0); + *x = Some(&mut z.1); + //[ast]~^ ERROR `z.1` does not live long enough [E0597] + //[mir]~^^ ERROR `z.1` does not live long enough [E0597] + panic!("catch me for a dangling pointer!") +} + +fn main() { + cplusplus_mode_exceptionally_unsafe(&mut None); +} diff --git a/src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs b/src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs index 5f23601445..3e57ac0ca1 100644 --- a/src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs +++ b/src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir enum Foo { A(i32), @@ -19,12 +19,11 @@ enum Foo { fn match_enum() { let mut foo = Foo::B; let p = &mut foo; - let _ = match foo { - Foo::B => 1, //[mir]~ ERROR (Mir) [E0503] + let _ = match foo { //[mir]~ ERROR [E0503] + Foo::B => 1, //[mir]~ ERROR [E0503] _ => 2, Foo::A(x) => x //[ast]~ ERROR [E0503] - //[mir]~^ ERROR (Ast) [E0503] - //[mir]~| ERROR (Mir) [E0503] + //[mir]~^ ERROR [E0503] }; } @@ -32,12 +31,10 @@ fn match_enum() { fn main() { let mut x = 1; let _x = &mut x; - let _ = match x { - x => x + 1, //[ast]~ ERROR E0503 - //[mir]~^ ERROR (Mir) [E0503] - //[mir]~| ERROR (Ast) [E0503] + let _ = match x { //[mir]~ ERROR [E0503] + x => x + 1, //[ast]~ ERROR [E0503] + //[mir]~^ ERROR [E0503] y => y + 2, //[ast]~ ERROR [E0503] - //[mir]~^ ERROR (Mir) [E0503] - //[mir]~| ERROR (Ast) [E0503] + //[mir]~^ ERROR [E0503] }; } diff --git a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs index ea30911b3c..32a573911e 100644 --- a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs +++ b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Zemit-end-regions -Zborrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Test that immutable pattern bindings cannot be reassigned. @@ -27,40 +27,35 @@ pub fn main() { match 1 { x => { x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x` - //[mir]~^ ERROR (Mir) [E0384] - //[mir]~| ERROR (Ast) [E0384] + //[mir]~^ ERROR [E0384] } } match E::Foo(1) { E::Foo(x) => { x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x` - //[mir]~^ ERROR (Mir) [E0384] - //[mir]~| ERROR (Ast) [E0384] + //[mir]~^ ERROR [E0384] } } match (S { bar: 1 }) { S { bar: x } => { x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x` - //[mir]~^ ERROR (Mir) [E0384] - //[mir]~| ERROR (Ast) [E0384] + //[mir]~^ ERROR [E0384] } } match (1,) { (x,) => { x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x` - //[mir]~^ ERROR (Mir) [E0384] - //[mir]~| ERROR (Ast) [E0384] + //[mir]~^ ERROR [E0384] } } match [1,2,3] { [x,_,_] => { x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x` - //[mir]~^ ERROR (Mir) [E0384] - //[mir]~| ERROR (Ast) [E0384] + //[mir]~^ ERROR [E0384] } } } diff --git a/src/test/compile-fail/borrowck/borrowck-move-in-irrefut-pat.rs b/src/test/compile-fail/borrowck/borrowck-move-in-irrefut-pat.rs index 99b5ef794c..5fdde484f8 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-in-irrefut-pat.rs +++ b/src/test/compile-fail/borrowck/borrowck-move-in-irrefut-pat.rs @@ -9,27 +9,24 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn with(f: F) where F: FnOnce(&String) {} fn arg_item(&_x: &String) {} //[ast]~^ ERROR cannot move out of borrowed content [E0507] - //[mir]~^^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^^ ERROR [E0507] fn arg_closure() { with(|&_x| ()) //[ast]~^ ERROR cannot move out of borrowed content [E0507] - //[mir]~^^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^^ ERROR [E0507] } fn let_pat() { let &_x = &"hi".to_string(); //[ast]~^ ERROR cannot move out of borrowed content [E0507] - //[mir]~^^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^^ ERROR [E0507] } pub fn main() {} diff --git a/src/test/compile-fail/borrowck/borrowck-move-moved-value-into-closure.rs b/src/test/compile-fail/borrowck/borrowck-move-moved-value-into-closure.rs index c46bcbb32b..2bd6f75df1 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-moved-value-into-closure.rs +++ b/src/test/compile-fail/borrowck/borrowck-move-moved-value-into-closure.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![feature(box_syntax)] fn call_f isize>(f: F) -> isize { @@ -18,5 +21,6 @@ fn main() { let t: Box<_> = box 3; call_f(move|| { *t + 1 }); - call_f(move|| { *t + 1 }); //~ ERROR capture of moved value + call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value + //[mir]~^ ERROR use of moved value } diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs b/src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs index c7e1ea1b75..af9202d8d7 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs +++ b/src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs @@ -9,13 +9,12 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir use std::rc::Rc; pub fn main() { let _x = Rc::new(vec![1, 2]).into_iter(); //[ast]~^ ERROR cannot move out of borrowed content [E0507] - //[mir]~^^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^^ ERROR [E0507] } diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-static-item.rs b/src/test/compile-fail/borrowck/borrowck-move-out-of-static-item.rs index 9e8021fd10..79eb68c95a 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-out-of-static-item.rs +++ b/src/test/compile-fail/borrowck/borrowck-move-out-of-static-item.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Ensure that moves out of static items is forbidden @@ -26,6 +26,5 @@ fn test(f: Foo) { fn main() { test(BAR); //[ast]~ ERROR cannot move out of static item [E0507] - //[mir]~^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^ ERROR [E0507] } diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs b/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs index 982f31b134..8e1f7c7291 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir struct S {f:String} impl Drop for S { @@ -20,22 +20,19 @@ fn move_in_match() { match (S {f:"foo".to_string()}) { S {f:_s} => {} //[ast]~^ ERROR cannot move out of type `S`, which implements the `Drop` trait [E0509] - //[mir]~^^ ERROR (Ast) [E0509] - //[mir]~| ERROR (Mir) [E0509] + //[mir]~^^ ERROR [E0509] } } fn move_in_let() { let S {f:_s} = S {f:"foo".to_string()}; //[ast]~^ ERROR cannot move out of type `S`, which implements the `Drop` trait [E0509] - //[mir]~^^ ERROR (Ast) [E0509] - //[mir]~| ERROR (Mir) [E0509] + //[mir]~^^ ERROR [E0509] } fn move_in_fn_arg(S {f:_s}: S) { //[ast]~^ ERROR cannot move out of type `S`, which implements the `Drop` trait [E0509] - //[mir]~^^ ERROR (Ast) [E0509] - //[mir]~| ERROR (Mir) [E0509] + //[mir]~^^ ERROR [E0509] } fn main() {} diff --git a/src/test/compile-fail/borrowck/borrowck-mut-borrow-linear-errors.rs b/src/test/compile-fail/borrowck/borrowck-mut-borrow-linear-errors.rs index d4e9ab99ed..63bb04a0e4 100644 --- a/src/test/compile-fail/borrowck/borrowck-mut-borrow-linear-errors.rs +++ b/src/test/compile-fail/borrowck/borrowck-mut-borrow-linear-errors.rs @@ -13,7 +13,7 @@ // down to O(n) errors (for n problem lines), instead of O(n^2) errors. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn main() { let mut x = 1; @@ -21,20 +21,11 @@ fn main() { loop { match 1 { 1 => { addr = &mut x; } //[ast]~ ERROR [E0499] - //[mir]~^ ERROR (Ast) [E0499] - //[mir]~| ERROR (Mir) [E0499] + //[mir]~^ ERROR [E0499] 2 => { addr = &mut x; } //[ast]~ ERROR [E0499] - //[mir]~^ ERROR (Ast) [E0499] - //[mir]~| ERROR (Mir) [E0506] - //[mir]~| ERROR (Mir) [E0499] - //[mir]~| ERROR (Mir) [E0499] + //[mir]~^ ERROR [E0499] _ => { addr = &mut x; } //[ast]~ ERROR [E0499] - //[mir]~^ ERROR (Ast) [E0499] - //[mir]~| ERROR (Mir) [E0506] - //[mir]~| ERROR (Mir) [E0499] - //[mir]~| ERROR (Mir) [E0499] + //[mir]~^ ERROR [E0499] } } } - - diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs b/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs index 9b20cd470f..931d053ae7 100644 --- a/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs +++ b/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs @@ -14,7 +14,7 @@ // here is rather subtle. Issue #20232. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir use std::ops::{Deref, Index}; @@ -43,8 +43,7 @@ fn main() { let i = &v[0].f; v = MyVec { x: MyPtr { x: Foo { f: 23 } } }; //[ast]~^ ERROR cannot assign to `v` - //[mir]~^^ ERROR cannot assign to `v` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `v` because it is borrowed (Mir) + //[mir]~^^ ERROR cannot assign to `v` because it is borrowed read(*i); } diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs b/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs index 7f165e00ed..3a4c22eb13 100644 --- a/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs +++ b/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir use std::ops::{Index, IndexMut}; @@ -61,17 +61,14 @@ fn main() { let rs = &mut s; println!("{}", f[&s]); //[ast]~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable - //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `s` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable f[&s] = 10; //[ast]~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable - //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `s` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable let s = Bar { x: 1, }; s[2] = 20; //[ast]~^ ERROR cannot assign to immutable indexed content - //[mir]~^^ ERROR cannot assign to immutable indexed content - // FIXME Error for MIR + //[mir]~^^ ERROR cannot assign to immutable item } diff --git a/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs b/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs index 06bb98fa0e..0f3a841821 100644 --- a/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs +++ b/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn main() { let mut x: Option = None; @@ -21,8 +21,7 @@ fn main() { Some(ref i) => { // But on this branch, `i` is an outstanding borrow x = Some(*i+1); //[ast]~ ERROR cannot assign to `x` - //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `x` because it is borrowed } } x.clone(); // just to prevent liveness warnings diff --git a/src/test/compile-fail/borrowck/borrowck-storage-dead.rs b/src/test/compile-fail/borrowck/borrowck-storage-dead.rs index 5ef502acd8..bc01088696 100644 --- a/src/test/compile-fail/borrowck/borrowck-storage-dead.rs +++ b/src/test/compile-fail/borrowck/borrowck-storage-dead.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z emit-end-regions -Z borrowck-mir +// compile-flags: -Z borrowck=compare fn ok() { loop { @@ -16,6 +16,12 @@ fn ok() { } } +fn also_ok() { + loop { + let _x = String::new(); + } +} + fn fail() { loop { let x: i32; @@ -26,5 +32,6 @@ fn fail() { fn main() { ok(); + also_ok(); fail(); } diff --git a/src/test/compile-fail/borrowck/borrowck-struct-update-with-dtor.rs b/src/test/compile-fail/borrowck/borrowck-struct-update-with-dtor.rs index 4a1828c695..f90651687a 100644 --- a/src/test/compile-fail/borrowck/borrowck-struct-update-with-dtor.rs +++ b/src/test/compile-fail/borrowck/borrowck-struct-update-with-dtor.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Issue 4691: Ensure that functional-struct-update can only copy, not // move, when the struct implements Drop. @@ -24,15 +24,13 @@ impl Drop for T { fn drop(&mut self) { } } fn f(s0:S) { let _s2 = S{a: 2, ..s0}; //[ast]~^ error: cannot move out of type `S`, which implements the `Drop` trait - //[mir]~^^ ERROR (Ast) [E0509] - //[mir]~| ERROR (Mir) [E0509] + //[mir]~^^ ERROR [E0509] } fn g(s0:T) { let _s2 = T{a: 2, ..s0}; //[ast]~^ error: cannot move out of type `T`, which implements the `Drop` trait - //[mir]~^^ ERROR (Ast) [E0509] - //[mir]~| ERROR (Mir) [E0509] + //[mir]~^^ ERROR [E0509] } fn main() { } diff --git a/src/tools/miri/tests/run-pass/issue-35815.rs b/src/test/compile-fail/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs similarity index 62% rename from src/tools/miri/tests/run-pass/issue-35815.rs rename to src/test/compile-fail/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs index 216e06c073..df0a05dfae 100644 --- a/src/tools/miri/tests/run-pass/issue-35815.rs +++ b/src/test/compile-fail/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs @@ -8,18 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(dead_code)] +// ignore-test will be fixed later +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir -use std::mem; +#![feature(thread_local)] -struct Foo { - a: i64, - b: bool, - c: T, -} +#[thread_local] +static FOO: u8 = 3; +fn assert_static(_t: &'static u8) {} fn main() { - let foo: &Foo = &Foo { a: 1, b: false, c: 2i32 }; - let foo_unsized: &Foo = foo; - assert_eq!(mem::size_of_val(foo), mem::size_of_val(foo_unsized)); + assert_static(&FOO); //[ast]~ ERROR [E0597] + //[mir]~^ ERROR [E0597] } diff --git a/src/test/compile-fail/borrowck/borrowck-unary-move.rs b/src/test/compile-fail/borrowck/borrowck-unary-move.rs index 6cab5a8bf6..8163ce2993 100644 --- a/src/test/compile-fail/borrowck/borrowck-unary-move.rs +++ b/src/test/compile-fail/borrowck/borrowck-unary-move.rs @@ -10,13 +10,12 @@ // ignore-tidy-linelength // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn foo(x: Box) -> isize { let y = &*x; free(x); //[ast]~ ERROR cannot move out of `x` because it is borrowed - //[mir]~^ ERROR cannot move out of `x` because it is borrowed (Ast) - //[mir]~| ERROR cannot move out of `x` because it is borrowed (Mir) + //[mir]~^ ERROR cannot move out of `x` because it is borrowed *y } diff --git a/src/test/compile-fail/borrowck/borrowck-uninit-field-access.rs b/src/test/compile-fail/borrowck/borrowck-uninit-field-access.rs index 8f39ae6c04..a214e3c126 100644 --- a/src/test/compile-fail/borrowck/borrowck-uninit-field-access.rs +++ b/src/test/compile-fail/borrowck/borrowck-uninit-field-access.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Check that do not allow access to fields of uninitialized or moved // structs. @@ -32,18 +32,15 @@ impl Line { fn consume(self) { } } fn main() { let mut a: Point; let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` - //[mir]~^ ERROR [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^ ERROR [E0381] let mut line1 = Line::default(); let _moved = line1.origin; let _ = line1.origin.x + 1; //[ast]~ ERROR use of collaterally moved value: `line1.origin.x` - //[mir]~^ [E0382] - //[mir]~| (Mir) [E0382] + //[mir]~^ [E0382] let mut line2 = Line::default(); let _moved = (line2.origin, line2.middle); line2.consume(); //[ast]~ ERROR use of partially moved value: `line2` [E0382] - //[mir]~^ [E0382] - //[mir]~| (Mir) [E0382] + //[mir]~^ [E0382] } diff --git a/src/test/compile-fail/borrowck/borrowck-uninit-ref-chain.rs b/src/test/compile-fail/borrowck/borrowck-uninit-ref-chain.rs index 71f8693b21..c52b1f0bf6 100644 --- a/src/test/compile-fail/borrowck/borrowck-uninit-ref-chain.rs +++ b/src/test/compile-fail/borrowck/borrowck-uninit-ref-chain.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir struct S { x: X, @@ -19,42 +19,35 @@ struct S { fn main() { let x: &&Box; let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] - //[mir]~^ (Ast) [E0381] - //[mir]~| (Mir) [E0381] + //[mir]~^ [E0381] let x: &&S; let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] - //[mir]~^ (Ast) [E0381] - //[mir]~| (Mir) [E0381] + //[mir]~^ [E0381] let x: &&i32; let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] - //[mir]~^ (Ast) [E0381] - //[mir]~| (Mir) [E0381] + //[mir]~^ [E0381] let mut a: S; a.x = 0; let _b = &a.x; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` [E0381] - //[mir]~^ ERROR (Ast) [E0381] // (deliberately *not* an error under MIR-borrowck) let mut a: S<&&i32, &&i32>; a.x = &&0; let _b = &**a.x; //[ast]~ ERROR use of possibly uninitialized variable: `**a.x` [E0381] - //[mir]~^ ERROR (Ast) [E0381] // (deliberately *not* an error under MIR-borrowck) let mut a: S; a.x = 0; let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381] - //[mir]~^ ERROR (Ast) [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^ ERROR [E0381] let mut a: S<&&i32, &&i32>; a.x = &&0; let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381] - //[mir]~^ ERROR (Ast) [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^ ERROR [E0381] } diff --git a/src/test/compile-fail/borrowck/borrowck-union-borrow.rs b/src/test/compile-fail/borrowck/borrowck-union-borrow.rs index 0655d2914e..0241b3870c 100644 --- a/src/test/compile-fail/borrowck/borrowck-union-borrow.rs +++ b/src/test/compile-fail/borrowck/borrowck-union-borrow.rs @@ -10,7 +10,7 @@ // ignore-tidy-linelength // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir #[derive(Clone, Copy)] union U { @@ -33,14 +33,12 @@ fn main() { { let ra = &u.a; let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable - //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable (Ast) - //[mir]~| ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable (Mir) + //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable } { let ra = &u.a; u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `u.a` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed } // Imm borrow, other field { @@ -54,64 +52,55 @@ fn main() { { let ra = &u.a; let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) - //[mir]~^ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) (Ast) - // FIXME Error for MIR (needs support for union) + //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable } { let ra = &u.a; u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed (Ast) - // FIXME Error for MIR (needs support for union) + //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed } // Mut borrow, same field { let rma = &mut u.a; let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable - //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable } { let ra = &mut u.a; let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed - //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed (Ast) - //[mir]~| ERROR cannot use `u.a` because it was mutably borrowed (Mir) + //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed } { let rma = &mut u.a; let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time - //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `u.a` as mutable more than once at a time (Mir) + //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time } { let rma = &mut u.a; u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `u.a` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed } // Mut borrow, other field { let rma = &mut u.a; let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) - //[mir]~^ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) (Ast) - // FIXME Error for MIR (needs support for union) + //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable } { let ra = &mut u.a; let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed - //[mir]~^ ERROR cannot use `u.b` because it was mutably borrowed (Ast) - // FIXME Error for MIR (needs support for union) + //[mir]~^ ERROR cannot use `u.b` because it was mutably borrowed + } { let rma = &mut u.a; let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time - //[mir]~^ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time (Ast) - // FIXME Error for MIR (needs support for union) + //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time } { let rma = &mut u.a; u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed (Ast) - // FIXME Error for MIR (needs support for union) + //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed } } } diff --git a/src/test/compile-fail/borrowck/borrowck-use-in-index-lvalue.rs b/src/test/compile-fail/borrowck/borrowck-use-in-index-lvalue.rs index 2b567ebd2d..eb99f78f46 100644 --- a/src/test/compile-fail/borrowck/borrowck-use-in-index-lvalue.rs +++ b/src/test/compile-fail/borrowck/borrowck-use-in-index-lvalue.rs @@ -9,18 +9,16 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn test() { let w: &mut [isize]; w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] - //[mir]~^ ERROR (Ast) [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^ ERROR [E0381] let mut w: &mut [isize]; w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] - //[mir]~^ ERROR (Ast) [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^ ERROR [E0381] } fn main() { test(); } diff --git a/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast-trait.rs b/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast-trait.rs index a48d09b195..57c2d50835 100644 --- a/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast-trait.rs +++ b/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast-trait.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Variation on `borrowck-use-uninitialized-in-cast` in which we do a // trait cast from an uninitialized source. Issue #20791. @@ -20,6 +20,5 @@ impl Foo for i32 { } fn main() { let x: &i32; let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x` - //[mir]~^ ERROR (Ast) [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^ ERROR [E0381] } diff --git a/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast.rs b/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast.rs index bdd90a3ce1..dbc20d0205 100644 --- a/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast.rs +++ b/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Check that we detect unused values that are cast to other things. // The problem was specified to casting to `*`, as creating unsafe @@ -18,6 +18,5 @@ fn main() { let x: &i32; let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381] - //[mir]~^ ERROR (Ast) [E0381] - //[mir]~| ERROR (Mir) [E0381] + //[mir]~^ ERROR [E0381] } diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs b/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs index b591658493..94877b27d5 100644 --- a/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs +++ b/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs @@ -1,3 +1,4 @@ + // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -8,8 +9,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +// revisions: ast cmp +//[cmp]compile-flags: -Z borrowck=compare #![feature(slice_patterns)] @@ -21,8 +22,8 @@ fn main() { }; println!("t[0]: {}", t[0]); a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed - //[mir]~^ ERROR cannot assign to `a[..]` because it is borrowed (Ast) - // FIXME Error for MIR (error missed) + //[cmp]~^ ERROR cannot assign to `a[..]` because it is borrowed (Ast) + //[cmp]~| ERROR cannot assign to `a[..]` because it is borrowed (Mir) println!("t[0]: {}", t[0]); t[0]; } diff --git a/src/test/compile-fail/borrowck/move-in-static-initializer-issue-38520.rs b/src/test/compile-fail/borrowck/move-in-static-initializer-issue-38520.rs index 7f3120cc83..508e09318a 100644 --- a/src/test/compile-fail/borrowck/move-in-static-initializer-issue-38520.rs +++ b/src/test/compile-fail/borrowck/move-in-static-initializer-issue-38520.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Regression test for #38520. Check that moves of `Foo` are not // permitted as `Foo` is not copy (even in a static/const @@ -25,11 +25,9 @@ const fn get(x: Foo) -> usize { const X: Foo = Foo(22); static Y: usize = get(*&X); //[ast]~ ERROR E0507 - //[mir]~^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^ ERROR [E0507] const Z: usize = get(*&X); //[ast]~ ERROR E0507 - //[mir]~^ ERROR (Ast) [E0507] - //[mir]~| ERROR (Mir) [E0507] + //[mir]~^ ERROR [E0507] fn main() { } diff --git a/src/test/compile-fail/borrowck/two-phase-activation-sharing-interference.rs b/src/test/compile-fail/borrowck/two-phase-activation-sharing-interference.rs new file mode 100644 index 0000000000..b6f5e17f1f --- /dev/null +++ b/src/test/compile-fail/borrowck/two-phase-activation-sharing-interference.rs @@ -0,0 +1,62 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll + +// This is an important corner case pointed out by Niko: one is +// allowed to initiate a shared borrow during a reservation, but it +// *must end* before the activation occurs. +// +// FIXME: for clarity, diagnostics for these cases might be better off +// if they specifically said "cannot activate mutable borrow of `x`" + +#![allow(dead_code)] + +fn read(_: &i32) { } + +fn ok() { + let mut x = 3; + let y = &mut x; + { let z = &x; read(z); } + *y += 1; +} + +fn not_ok() { + let mut x = 3; + let y = &mut x; + let z = &x; + *y += 1; + //[lxl]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable + //[nll]~^^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable + read(z); +} + +fn should_be_ok_with_nll() { + let mut x = 3; + let y = &mut x; + let z = &x; + read(z); + *y += 1; + //[lxl]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable + // (okay with nll today) +} + +fn should_also_eventually_be_ok_with_nll() { + let mut x = 3; + let y = &mut x; + let _z = &x; + *y += 1; + //[lxl]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable + //[nll]~^^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable +} + +fn main() { } diff --git a/src/test/compile-fail/borrowck/two-phase-allow-access-during-reservation.rs b/src/test/compile-fail/borrowck/two-phase-allow-access-during-reservation.rs new file mode 100644 index 0000000000..7695bd3e46 --- /dev/null +++ b/src/test/compile-fail/borrowck/two-phase-allow-access-during-reservation.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll + +// This is the second counter-example from Niko's blog post +// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/ +// +// It is "artificial". It is meant to illustrate directly that we +// should allow an aliasing access during reservation, but *not* while +// the mutable borrow is active. + +fn main() { + /*0*/ let mut i = 0; + + /*1*/ let p = &mut i; // (reservation of `i` starts here) + + /*2*/ let j = i; // OK: `i` is only reserved here + + /*3*/ *p += 1; // (mutable borrow of `i` starts here, since `p` is used) + + /*4*/ let k = i; //[lxl]~ ERROR cannot use `i` because it was mutably borrowed [E0503] + //[nll]~^ ERROR cannot use `i` because it was mutably borrowed [E0503] + + /*5*/ *p += 1; + + let _ = (j, k, p); +} diff --git a/src/test/compile-fail/borrowck/two-phase-cannot-nest-mut-self-calls.rs b/src/test/compile-fail/borrowck/two-phase-cannot-nest-mut-self-calls.rs new file mode 100644 index 0000000000..01b0470859 --- /dev/null +++ b/src/test/compile-fail/borrowck/two-phase-cannot-nest-mut-self-calls.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll + +// This is the third counter-example from Niko's blog post +// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/ +// +// It shows that not all nested method calls on `self` are magically +// allowed by this change. In particular, a nested `&mut` borrow is +// still disallowed. + +fn main() { + + + let mut vec = vec![0, 1]; + vec.get({ + + vec.push(2); + //[lxl]~^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable + //[nll]~^^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable + + 0 + }); +} diff --git a/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs b/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs new file mode 100644 index 0000000000..fc9100c8a9 --- /dev/null +++ b/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll + +// This is similar to two-phase-reservation-sharing-interference.rs +// in that it shows a reservation that overlaps with a shared borrow. +// +// Currently, this test fails with lexical lifetimes, but succeeds +// with non-lexical lifetimes. (The reason is because the activation +// of the mutable borrow ends up overlapping with a lexically-scoped +// shared borrow; but a non-lexical shared borrow can end before the +// activation occurs.) +// +// So this test is just making a note of the current behavior. + +#![feature(rustc_attrs)] + +#[rustc_error] +fn main() { //[nll]~ ERROR compilation successful + let mut v = vec![0, 1, 2]; + let shared = &v; + + v.push(shared.len()); + //[lxl]~^ ERROR cannot borrow `v` as mutable because it is also borrowed as immutable [E0502] + + assert_eq!(v, [0, 1, 2, 3]); +} diff --git a/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs b/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs new file mode 100644 index 0000000000..cc85315263 --- /dev/null +++ b/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs @@ -0,0 +1,46 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll + +// This is a corner case that the current implementation is (probably) +// treating more conservatively than is necessary. But it also does +// not seem like a terribly important use case to cover. +// +// So this test is just making a note of the current behavior, with +// the caveat that in the future, the rules may be loosened, at which +// point this test might be thrown out. + +fn main() { + let mut vec = vec![0, 1]; + let delay: &mut Vec<_>; + { + let shared = &vec; + + // we reserve here, which could (on its own) be compatible + // with the shared borrow. But in the current implementation, + // its an error. + delay = &mut vec; + //[lxl]~^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable + //[nll]~^^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable + + shared[0]; + } + + // the &mut-borrow only becomes active way down here. + // + // (At least in theory; part of the reason this test fails is that + // the constructed MIR throws in extra &mut reborrows which + // flummoxes our attmpt to delay the activation point here.) + delay.push(2); +} + diff --git a/src/test/compile-fail/borrowck/two-phase-sneaky.rs b/src/test/compile-fail/borrowck/two-phase-sneaky.rs new file mode 100644 index 0000000000..32747407c6 --- /dev/null +++ b/src/test/compile-fail/borrowck/two-phase-sneaky.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll + +// This is the first counter-example from Niko's blog post +// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/ +// of a danger for code to crash if we just turned off the check for whether +// a mutable-borrow aliases another borrow. + +fn main() { + let mut v: Vec = vec![format!("Hello, ")]; + v[0].push_str({ + + v.push(format!("foo")); + //[lxl]~^ ERROR cannot borrow `v` as mutable more than once at a time [E0499] + //[nll]~^^ ERROR cannot borrow `v` as mutable more than once at a time [E0499] + + "World!" + }); +} diff --git a/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs b/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs index 5ddde6460b..8eed61ec8d 100644 --- a/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs +++ b/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-tidy-linelength +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![feature(unboxed_closures)] use std::io::Read; @@ -17,9 +21,11 @@ fn to_fn_once>(f: F) -> F { f } fn main() { let x = 1; to_fn_once(move|| { x = 2; }); - //~^ ERROR: cannot assign to immutable captured outer variable + //[ast]~^ ERROR: cannot assign to immutable captured outer variable + //[mir]~^^ ERROR: cannot assign to immutable item `x` let s = std::io::stdin(); to_fn_once(move|| { s.read_to_end(&mut Vec::new()); }); - //~^ ERROR: cannot borrow immutable captured outer variable + //[ast]~^ ERROR: cannot borrow immutable captured outer variable + //[mir]~^^ ERROR: cannot borrow immutable item `s` as mutable } diff --git a/src/test/compile-fail/capture1.rs b/src/test/compile-fail/capture1.rs index fd50918a31..984385f4cc 100644 --- a/src/test/compile-fail/capture1.rs +++ b/src/test/compile-fail/capture1.rs @@ -9,7 +9,7 @@ // except according to those terms. -// error-pattern: can't capture dynamic environment in a fn item; +// error-pattern: can't capture dynamic environment in a fn item fn main() { let bar: isize = 5; diff --git a/src/test/compile-fail/catch-bad-lifetime.rs b/src/test/compile-fail/catch-bad-lifetime.rs index 57242dad6e..f24561b888 100644 --- a/src/test/compile-fail/catch-bad-lifetime.rs +++ b/src/test/compile-fail/catch-bad-lifetime.rs @@ -18,10 +18,11 @@ pub fn main() { let _result: Result<(), &str> = do catch { let my_string = String::from(""); let my_str: & str = & my_string; + //~^ ERROR `my_string` does not live long enough Err(my_str) ?; Err("") ?; Ok(()) - }; //~ ERROR `my_string` does not live long enough + }; } { diff --git a/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs b/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs index 16ed73e909..513a17e2ef 100644 --- a/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs +++ b/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs @@ -13,8 +13,7 @@ fn bar(blk: F) where F: FnOnce() + 'static { fn foo(x: &()) { bar(|| { - //~^ ERROR cannot infer - //~| ERROR does not fulfill + //~^ ERROR does not fulfill let _ = x; }) } diff --git a/src/test/compile-fail/coerce-overloaded-autoderef.rs b/src/test/compile-fail/coerce-overloaded-autoderef.rs index 43b771ce5d..0487b03171 100644 --- a/src/test/compile-fail/coerce-overloaded-autoderef.rs +++ b/src/test/compile-fail/coerce-overloaded-autoderef.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn borrow_mut(x: &mut T) -> &mut T { x } fn borrow(x: &T) -> &T { x } @@ -21,8 +21,7 @@ fn double_mut_borrow(x: &mut Box) { let y = borrow_mut(x); let z = borrow_mut(x); //[ast]~^ ERROR cannot borrow `*x` as mutable more than once at a time - //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time } fn double_imm_borrow(x: &mut Box) { @@ -30,22 +29,19 @@ fn double_imm_borrow(x: &mut Box) { let z = borrow(x); **x += 1; //[ast]~^ ERROR cannot assign to `**x` because it is borrowed - //[mir]~^^ ERROR cannot assign to `**x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `(*(*x))` because it is borrowed (Mir) + //[mir]~^^ ERROR cannot assign to `**x` because it is borrowed } fn double_mut_borrow2(x: &mut Box) { borrow_mut2(x, x); //[ast]~^ ERROR cannot borrow `*x` as mutable more than once at a time - //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time } fn double_borrow2(x: &mut Box) { borrow2(x, x); //[ast]~^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable - //[mir]~^^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable } pub fn main() {} diff --git a/src/test/compile-fail/coerce-to-bang-cast.rs b/src/test/compile-fail/coerce-to-bang-cast.rs index 0479f5cce6..0d5bf6cd68 100644 --- a/src/test/compile-fail/coerce-to-bang-cast.rs +++ b/src/test/compile-fail/coerce-to-bang-cast.rs @@ -12,8 +12,11 @@ fn foo(x: usize, y: !, z: usize) { } +#[deny(coerce_never)] fn cast_a() { let y = {return; 22} as !; + //~^ ERROR cannot coerce `i32` to ! + //~| hard error } fn cast_b() { diff --git a/src/test/compile-fail/coerce-to-bang.rs b/src/test/compile-fail/coerce-to-bang.rs index 870665bb49..2cf568777d 100644 --- a/src/test/compile-fail/coerce-to-bang.rs +++ b/src/test/compile-fail/coerce-to-bang.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(never_type)] +#![deny(coerce_never)] fn foo(x: usize, y: !, z: usize) { } @@ -17,6 +18,8 @@ fn call_foo_a() { // the coercion to `!`, but within same expression. Not clear that // these are the rules we want. foo(return, 22, 44); + //~^ ERROR cannot coerce `{integer}` to ! + //~| hard error } fn call_foo_b() { @@ -36,6 +39,8 @@ fn call_foo_d() { let b = 22; let c = 44; foo(a, b, c); // ... and hence a reference to `a` is expected to diverge. + //~^ ERROR cannot coerce `{integer}` to ! + //~| hard error } fn call_foo_e() { @@ -75,6 +80,8 @@ fn tuple_a() { fn tuple_b() { // Divergence happens before coercion: OK let x: (usize, !, usize) = (return, 44, 66); + //~^ ERROR cannot coerce `{integer}` to ! + //~| hard error } fn tuple_c() { diff --git a/src/test/compile-fail/conservative_impl_trait.rs b/src/test/compile-fail/conservative_impl_trait.rs new file mode 100644 index 0000000000..7fb0ec52f2 --- /dev/null +++ b/src/test/compile-fail/conservative_impl_trait.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// #39872, #39553 + +#![feature(conservative_impl_trait)] +fn will_ice(something: &u32) -> impl Iterator { + //~^ ERROR the trait bound `(): std::iter::Iterator` is not satisfied [E0277] +} + +fn main() {} diff --git a/src/test/compile-fail/const-fn-feature-flags.rs b/src/test/compile-fail/const-fn-feature-flags.rs deleted file mode 100644 index 823cb89b36..0000000000 --- a/src/test/compile-fail/const-fn-feature-flags.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test use of const fns in std using individual feature gates. - -use std::cell::Cell; - -const CELL: Cell = Cell::new(42); //~ERROR not yet stable as a const fn - //~^HELP #![feature(const_cell_new)] - -fn main() { - let v = CELL.get(); - CELL.set(v+1); - - assert_eq!(CELL.get(), v); -} - diff --git a/src/test/compile-fail/const-match-check.rs b/src/test/compile-fail/const-match-check.rs new file mode 100644 index 0000000000..36a6600b62 --- /dev/null +++ b/src/test/compile-fail/const-match-check.rs @@ -0,0 +1,44 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: matchck eval1 eval2 + +#[cfg(matchck)] +const X: i32 = { let 0 = 0; 0 }; +//[matchck]~^ ERROR refutable pattern in local binding + +#[cfg(matchck)] +static Y: i32 = { let 0 = 0; 0 }; +//[matchck]~^ ERROR refutable pattern in local binding + +#[cfg(matchck)] +trait Bar { + const X: i32 = { let 0 = 0; 0 }; + //[matchck]~^ ERROR refutable pattern in local binding +} + +#[cfg(matchck)] +impl Bar for () { + const X: i32 = { let 0 = 0; 0 }; + //[matchck]~^ ERROR refutable pattern in local binding +} + +#[cfg(eval1)] +enum Foo { + A = { let 0 = 0; 0 }, + //[eval1]~^ ERROR refutable pattern in local binding +} + +fn main() { + #[cfg(eval2)] + let x: [i32; { let 0 = 0; 0 }] = []; + //[eval2]~^ ERROR refutable pattern in local binding + //[eval2]~| ERROR constant evaluation error +} diff --git a/src/test/compile-fail/dep_graph_crosscontaminate_tables.rs b/src/test/compile-fail/dep_graph_crosscontaminate_tables.rs deleted file mode 100644 index 2520e3a095..0000000000 --- a/src/test/compile-fail/dep_graph_crosscontaminate_tables.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that the `TypeckTables` nodes for impl items are independent from -// one another. - -// compile-flags: -Z query-dep-graph - -#![feature(rustc_attrs)] - -struct Foo { - x: u8 -} - -impl Foo { - // Changing the item `new`... - #[rustc_if_this_changed(HirBody)] - fn new() -> Foo { - Foo { x: 0 } - } - - // ...should not cause us to recompute the tables for `with`! - #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path - fn with(x: u8) -> Foo { - Foo { x: x } - } -} - -fn main() { - let f = Foo::new(); - let g = Foo::with(22); - assert_eq!(f.x, g.x - 22); -} diff --git a/src/test/compile-fail/derive-on-trait-item-or-impl-item.rs b/src/test/compile-fail/derive-on-trait-item-or-impl-item.rs new file mode 100644 index 0000000000..9ff1c14f54 --- /dev/null +++ b/src/test/compile-fail/derive-on-trait-item-or-impl-item.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Foo { + #[derive(Clone)] + //~^ ERROR `derive` may only be applied to structs, enums and unions + type Bar; +} + +impl Bar { + #[derive(Clone)] + //~^ ERROR `derive` may only be applied to structs, enums and unions + fn bar(&self) {} +} + +fn main() {} diff --git a/src/tools/miri/xargo/src/lib.rs b/src/test/compile-fail/directory_ownership/foo/compiletest-ignore-dir similarity index 100% rename from src/tools/miri/xargo/src/lib.rs rename to src/test/compile-fail/directory_ownership/foo/compiletest-ignore-dir diff --git a/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning/aux2.rs b/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning/aux2.rs new file mode 100644 index 0000000000..fc4bca865c --- /dev/null +++ b/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning/aux2.rs @@ -0,0 +1,9 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. diff --git a/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning_aux2.rs b/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning_aux2.rs new file mode 100644 index 0000000000..fc4bca865c --- /dev/null +++ b/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning_aux2.rs @@ -0,0 +1,9 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning.rs b/src/test/compile-fail/directory_ownership/mod_file_not_owning.rs index adbcedd91f..ff93fddf9b 100644 --- a/src/test/compile-fail/directory_ownership/mod_file_not_owning.rs +++ b/src/test/compile-fail/directory_ownership/mod_file_not_owning.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: cannot declare a new module at this location +// error-pattern: mod statements in non-mod.rs files are unstable mod mod_file_not_owning_aux1; diff --git a/src/vendor/cargo_metadata/.cargo-ok b/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir similarity index 100% rename from src/vendor/cargo_metadata/.cargo-ok rename to src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs b/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs new file mode 100644 index 0000000000..fc4bca865c --- /dev/null +++ b/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs @@ -0,0 +1,9 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. diff --git a/src/test/compile-fail/directory_ownership/unowned_mod_with_path.rs b/src/test/compile-fail/directory_ownership/unowned_mod_with_path.rs index 854f790bef..0cffb7cc9e 100644 --- a/src/test/compile-fail/directory_ownership/unowned_mod_with_path.rs +++ b/src/test/compile-fail/directory_ownership/unowned_mod_with_path.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: cannot declare a new module at this location +// error-pattern: mod statements in non-mod.rs files are unstable // This is not a directory owner since the file name is not "mod.rs". #[path = "mod_file_not_owning_aux1.rs"] diff --git a/src/test/compile-fail/diverging-fn-tail-35849.rs b/src/test/compile-fail/diverging-fn-tail-35849.rs index 3a27c08413..a91c000bbf 100644 --- a/src/test/compile-fail/diverging-fn-tail-35849.rs +++ b/src/test/compile-fail/diverging-fn-tail-35849.rs @@ -8,9 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn _converge() -> ! { - 42 //~ ERROR mismatched types +#[deny(coerce_never)] +fn assert_sizeof() -> ! { + unsafe { + ::std::mem::transmute::(panic!()) + //~^ ERROR cannot coerce `[u8; 8]` to ! + //~| hard error + } } fn main() { } - diff --git a/src/test/compile-fail/dollar-crate-is-keyword-2.rs b/src/test/compile-fail/dollar-crate-is-keyword-2.rs index ac96279d61..87a2903803 100644 --- a/src/test/compile-fail/dollar-crate-is-keyword-2.rs +++ b/src/test/compile-fail/dollar-crate-is-keyword-2.rs @@ -13,8 +13,8 @@ mod a {} macro_rules! m { () => { use a::$crate; //~ ERROR unresolved import `a::$crate` - use a::$crate::b; //~ ERROR unresolved import `a::$crate` - type A = a::$crate; //~ ERROR cannot find type `$crate` in module `a` + use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position + type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position } } diff --git a/src/test/compile-fail/dropck_trait_cycle_checked.rs b/src/test/compile-fail/dropck_trait_cycle_checked.rs index c0f0e3650d..b6b7fa1a23 100644 --- a/src/test/compile-fail/dropck_trait_cycle_checked.rs +++ b/src/test/compile-fail/dropck_trait_cycle_checked.rs @@ -13,8 +13,6 @@ // // (Compare against compile-fail/dropck_vec_cycle_checked.rs) -#![feature(const_atomic_usize_new)] - use std::cell::Cell; use id::Id; diff --git a/src/test/compile-fail/duplicate_entry_error.rs b/src/test/compile-fail/duplicate_entry_error.rs index ad5ea29159..485519e8c3 100644 --- a/src/test/compile-fail/duplicate_entry_error.rs +++ b/src/test/compile-fail/duplicate_entry_error.rs @@ -20,4 +20,4 @@ fn panic_fmt() -> ! { loop {} } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/empty-struct-braces-expr.rs b/src/test/compile-fail/empty-struct-braces-expr.rs index d4e85e9744..3096e8f831 100644 --- a/src/test/compile-fail/empty-struct-braces-expr.rs +++ b/src/test/compile-fail/empty-struct-braces-expr.rs @@ -29,6 +29,6 @@ fn main() { let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1` - let xe3 = XE::Empty3; //~ ERROR no associated item named `Empty3` found for type - let xe3 = XE::Empty3(); //~ ERROR no associated item named `Empty3` found for type + let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type + let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type } diff --git a/src/test/compile-fail/extern-macro.rs b/src/test/compile-fail/extern-macro.rs new file mode 100644 index 0000000000..4267103ab9 --- /dev/null +++ b/src/test/compile-fail/extern-macro.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// #41719 + +#![feature(use_extern_macros)] + +fn main() { + enum Foo {} + let _ = Foo::bar!(); //~ ERROR fail to resolve non-ident macro path +} diff --git a/src/test/compile-fail/external-doc-error.rs b/src/test/compile-fail/external-doc-error.rs new file mode 100644 index 0000000000..1ae0d0bd27 --- /dev/null +++ b/src/test/compile-fail/external-doc-error.rs @@ -0,0 +1,16 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(external_doc)] + +#[doc(include = "not-a-file.md")] //~ ERROR: couldn't read +pub struct SomeStruct; + +fn main() {} diff --git a/src/test/compile-fail/feature-gate-nested_impl_trait.rs b/src/test/compile-fail/feature-gate-nested_impl_trait.rs new file mode 100644 index 0000000000..7c35263d05 --- /dev/null +++ b/src/test/compile-fail/feature-gate-nested_impl_trait.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![feature(conservative_impl_trait, universal_impl_trait)] + +use std::fmt::Debug; + +fn fine(x: impl Into) -> impl Into { x } + +fn bad_in_ret_position(x: impl Into) -> impl Into { x } +//~^ ERROR nested `impl Trait` is experimental + +fn bad_in_fn_syntax(x: fn() -> impl Into) {} +//~^ ERROR nested `impl Trait` is experimental + +fn bad_in_arg_position(_: impl Into) { } +//~^ ERROR nested `impl Trait` is experimental + +struct X; +impl X { + fn bad(x: impl Into) -> impl Into { x } + //~^ ERROR nested `impl Trait` is experimental +} + +fn allowed_in_assoc_type() -> impl Iterator { + vec![|| println!("woot")].into_iter() +} + +fn allowed_in_ret_type() -> impl Fn() -> impl Into { + || 5 +} + +fn main() {} diff --git a/src/test/compile-fail/feature-gate-termination_trait.rs b/src/test/compile-fail/feature-gate-termination_trait.rs new file mode 100644 index 0000000000..5a56445b64 --- /dev/null +++ b/src/test/compile-fail/feature-gate-termination_trait.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() -> i32 { //~ ERROR main function has wrong type [E0580] + 0 +} diff --git a/src/test/compile-fail/float-int-invalid-const-cast.rs b/src/test/compile-fail/float-int-invalid-const-cast.rs index 2efefd9269..1f07422e21 100644 --- a/src/test/compile-fail/float-int-invalid-const-cast.rs +++ b/src/test/compile-fail/float-int-invalid-const-cast.rs @@ -58,4 +58,4 @@ fn main() { { const X: u32 = 4294967296. as u32; force(X); } //~ ERROR constant evaluation error { const X: u128 = 1e40 as u128; force(X); } //~ ERROR constant evaluation error { const X: i128 = 1e40 as i128; force(X); } //~ ERROR constant evaluation error -} \ No newline at end of file +} diff --git a/src/test/compile-fail/generator-yielding-or-returning-itself.rs b/src/test/compile-fail/generator-yielding-or-returning-itself.rs new file mode 100644 index 0000000000..13abdf616b --- /dev/null +++ b/src/test/compile-fail/generator-yielding-or-returning-itself.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generator_trait)] +#![feature(generators)] + +// Test that we cannot create a generator that returns a value of its +// own type. + +use std::ops::Generator; + +pub fn want_cyclic_generator_return(_: T) + where T: Generator +{ +} + +fn supply_cyclic_generator_return() { + want_cyclic_generator_return(|| { + //~^ ERROR type mismatch + if false { yield None.unwrap(); } + None.unwrap() + }) +} + +pub fn want_cyclic_generator_yield(_: T) + where T: Generator +{ +} + +fn supply_cyclic_generator_yield() { + want_cyclic_generator_yield(|| { + //~^ ERROR type mismatch + if false { yield None.unwrap(); } + None.unwrap() + }) +} + +fn main() { } diff --git a/src/test/compile-fail/hrtb-identity-fn-borrows.rs b/src/test/compile-fail/hrtb-identity-fn-borrows.rs index b6216ce058..5f5b70dda5 100644 --- a/src/test/compile-fail/hrtb-identity-fn-borrows.rs +++ b/src/test/compile-fail/hrtb-identity-fn-borrows.rs @@ -12,7 +12,7 @@ // of the output to the region of the input. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir trait FnLike { fn call(&self, arg: A) -> R; @@ -25,8 +25,7 @@ fn call_repeatedly(f: F) let mut x = 3; let y = f.call(&x); x = 5; //[ast]~ ERROR cannot assign - //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `x` because it is borrowed // Result is not stored: can re-assign `x` let mut x = 3; diff --git a/src/test/compile-fail/immut-function-arguments.rs b/src/test/compile-fail/immut-function-arguments.rs index 949c1c0d9c..b32056fcb9 100644 --- a/src/test/compile-fail/immut-function-arguments.rs +++ b/src/test/compile-fail/immut-function-arguments.rs @@ -8,14 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir fn f(y: Box) { - *y = 5; //~ ERROR cannot assign + *y = 5; //[ast]~ ERROR cannot assign + //[mir]~^ ERROR cannot assign twice } fn g() { - let _frob = |q: Box| { *q = 2; }; //~ ERROR cannot assign - + let _frob = |q: Box| { *q = 2; }; //[ast]~ ERROR cannot assign + //[mir]~^ ERROR cannot assign twice } fn main() {} diff --git a/src/test/compile-fail/impl-trait/lifetimes.rs b/src/test/compile-fail/impl-trait/lifetimes.rs deleted file mode 100644 index 9d9f6bf729..0000000000 --- a/src/test/compile-fail/impl-trait/lifetimes.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(conservative_impl_trait)] - -// Helper creating a fake borrow, captured by the impl Trait. -fn borrow<'a, T>(_: &'a mut T) -> impl Copy { () } - -fn stack() -> impl Copy { - //~^ ERROR only named lifetimes are allowed in `impl Trait` - let x = 0; - &x -} - -fn late_bound(x: &i32) -> impl Copy { - //~^ ERROR only named lifetimes are allowed in `impl Trait` - x -} - -// FIXME(#34511) Should work but doesn't at the moment, -// region-checking needs an overhault to support this. -fn early_bound<'a>(x: &'a i32) -> impl Copy { - //~^ ERROR only named lifetimes are allowed in `impl Trait` - x -} - -fn ambiguous<'a, 'b>(x: &'a [u32], y: &'b [u32]) -> impl Iterator { - //~^ ERROR only named lifetimes are allowed in `impl Trait` - if x.len() < y.len() { - x.iter().cloned() - } else { - y.iter().cloned() - } -} - -fn main() {} diff --git a/src/test/compile-fail/impl-trait/must_outlive_least_region_or_bound.rs b/src/test/compile-fail/impl-trait/must_outlive_least_region_or_bound.rs new file mode 100644 index 0000000000..837160bc2f --- /dev/null +++ b/src/test/compile-fail/impl-trait/must_outlive_least_region_or_bound.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait)] + +use std::fmt::Debug; + +fn elided(x: &i32) -> impl Copy { x } +//~^ ERROR cannot infer an appropriate lifetime + +fn explicit<'a>(x: &'a i32) -> impl Copy { x } +//~^ ERROR cannot infer an appropriate lifetime + +trait LifetimeTrait<'a> {} +impl<'a> LifetimeTrait<'a> for &'a i32 {} + +fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } +//~^ ERROR cannot infer an appropriate lifetime + +// Tests that a closure type contianing 'b cannot be returned from a type where +// only 'a was expected. +fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { + //~^ ERROR lifetime mismatch + move |_| println!("{}", y) +} + +fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { + //~^ ERROR the parameter type `T` may not live long enough + x +} + +fn main() {} diff --git a/src/test/compile-fail/impl-trait/needs_least_region_or_bound.rs b/src/test/compile-fail/impl-trait/needs_least_region_or_bound.rs new file mode 100644 index 0000000000..2a06580fe6 --- /dev/null +++ b/src/test/compile-fail/impl-trait/needs_least_region_or_bound.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait)] + +use std::fmt::Debug; + +trait MultiRegionTrait<'a, 'b> {} +impl<'a, 'b> MultiRegionTrait<'a, 'b> for (&'a u32, &'b u32) {} + +fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> { +//~^ ERROR ambiguous lifetime bound + (x, y) +} + +fn main() {} diff --git a/src/test/compile-fail/impl-trait/type_parameters_captured.rs b/src/test/compile-fail/impl-trait/type_parameters_captured.rs new file mode 100644 index 0000000000..c6ff762b90 --- /dev/null +++ b/src/test/compile-fail/impl-trait/type_parameters_captured.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait)] + +use std::fmt::Debug; + +trait Any {} +impl Any for T {} + +// Check that type parameters are captured and not considered 'static +fn foo(x: T) -> impl Any + 'static { + //~^ ERROR the parameter type `T` may not live long enough + x +} + +fn main() {} diff --git a/src/test/compile-fail/impl-trait/where-allowed.rs b/src/test/compile-fail/impl-trait/where-allowed.rs index af83a2d0a2..a9fe1e0466 100644 --- a/src/test/compile-fail/impl-trait/where-allowed.rs +++ b/src/test/compile-fail/impl-trait/where-allowed.rs @@ -10,7 +10,7 @@ //! A simple test for testing many permutations of allowedness of //! impl Trait -#![feature(conservative_impl_trait, universal_impl_trait, dyn_trait)] +#![feature(conservative_impl_trait, nested_impl_trait, universal_impl_trait, dyn_trait)] use std::fmt::Debug; // Allowed diff --git a/src/test/parse-fail/issue-10412.rs b/src/test/compile-fail/issue-10412.rs similarity index 87% rename from src/test/parse-fail/issue-10412.rs rename to src/test/compile-fail/issue-10412.rs index d723d94c02..ee553730a3 100644 --- a/src/test/parse-fail/issue-10412.rs +++ b/src/test/compile-fail/issue-10412.rs @@ -8,16 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z parse-only -Z continue-parse-after-error - - trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names - fn serialize(val : &'self T) -> Vec ; //~ ERROR lifetimes cannot use keyword names + fn serialize(val : &'self T) -> Vec; //~ ERROR lifetimes cannot use keyword names fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names } impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names //~^ ERROR lifetimes cannot use keyword names + //~| ERROR missing lifetime specifier fn serialize(val : &'self str) -> Vec { //~ ERROR lifetimes cannot use keyword names vec![1] } diff --git a/src/test/compile-fail/issue-10755.rs b/src/test/compile-fail/issue-10755.rs index 1d8db84ab1..57915bce45 100644 --- a/src/test/compile-fail/issue-10755.rs +++ b/src/test/compile-fail/issue-10755.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -C linker=llllll -// error-pattern: the linker `llllll` +// compile-flags: -C linker=llllll -Z linker-flavor=ld +// error-pattern: linker `llllll` not found fn main() { } diff --git a/src/test/compile-fail/issue-12511.rs b/src/test/compile-fail/issue-12511.rs deleted file mode 100644 index 0c3073a770..0000000000 --- a/src/test/compile-fail/issue-12511.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait t1 : t2 { -//~^ NOTE the cycle begins when computing the supertraits of `t1`... -//~| NOTE ...which then requires computing the supertraits of `t2`... -} - -trait t2 : t1 { -//~^ ERROR unsupported cyclic reference between types/traits detected -//~| cyclic reference -//~| NOTE ...which then again requires computing the supertraits of `t1`, completing the cycle -} - -fn main() { } diff --git a/src/test/compile-fail/issue-17718-const-borrow.rs b/src/test/compile-fail/issue-17718-const-borrow.rs index 1464fcd9a1..07123c6949 100644 --- a/src/test/compile-fail/issue-17718-const-borrow.rs +++ b/src/test/compile-fail/issue-17718-const-borrow.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(const_unsafe_cell_new)] - use std::cell::UnsafeCell; const A: UnsafeCell = UnsafeCell::new(1); diff --git a/src/test/compile-fail/issue-17954.rs b/src/test/compile-fail/issue-17954.rs index 4befe3ebc8..4211057610 100644 --- a/src/test/compile-fail/issue-17954.rs +++ b/src/test/compile-fail/issue-17954.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![feature(thread_local)] #[thread_local] @@ -15,11 +18,16 @@ static FOO: u8 = 3; fn main() { let a = &FOO; - //~^ ERROR borrowed value does not live long enough - //~| does not live long enough - //~| NOTE borrowed value must be valid for the static lifetime + //[mir]~^ ERROR `FOO` does not live long enough [E0597] + //[mir]~| does not live long enough + //[mir]~| NOTE borrowed value must be valid for the static lifetime + //[ast]~^^^^ ERROR borrowed value does not live long enough + //[ast]~| does not live long enough + //[ast]~| NOTE borrowed value must be valid for the static lifetime std::thread::spawn(move || { println!("{}", a); }); -} //~ temporary value only lives until here +} +//[mir]~^ borrowed value only lives until here +//[ast]~^^ temporary value only lives until here diff --git a/src/test/compile-fail/issue-17959.rs b/src/test/compile-fail/issue-17959.rs index 23be4d3536..37c8173c4f 100644 --- a/src/test/compile-fail/issue-17959.rs +++ b/src/test/compile-fail/issue-17959.rs @@ -19,7 +19,7 @@ struct G { } impl Drop for G { -//~^ ERROR: The requirement `T: core::marker::Sized` is added only by the Drop impl. [E0367] +//~^ ERROR: The requirement `T: std::marker::Sized` is added only by the Drop impl. [E0367] fn drop(&mut self) { if !self._ptr.is_null() { } diff --git a/src/test/compile-fail/issue-20692.rs b/src/test/compile-fail/issue-20692.rs deleted file mode 100644 index 3e44053875..0000000000 --- a/src/test/compile-fail/issue-20692.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait Array: Sized {} - -fn f(x: &T) { - let _ = x - //~^ ERROR `Array` cannot be made into an object - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE requirements on the impl of `std::ops::CoerceUnsized<&Array>` - //~| NOTE the trait `Array` cannot be made into an object - as - &Array; - //~^ ERROR `Array` cannot be made into an object - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE the trait `Array` cannot be made into an object -} - -fn main() {} diff --git a/src/test/compile-fail/issue-21950.rs b/src/test/compile-fail/issue-21950.rs deleted file mode 100644 index 935f3480db..0000000000 --- a/src/test/compile-fail/issue-21950.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-tidy-linelength - -use std::ops::Add; - -fn main() { - let x = &10 as - &Add; - //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types - //~| ERROR E0191 - //~| NOTE missing associated type `Output` value -} diff --git a/src/test/compile-fail/issue-22560.rs b/src/test/compile-fail/issue-22560.rs deleted file mode 100644 index 914a3bd79d..0000000000 --- a/src/test/compile-fail/issue-22560.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-tidy-linelength - -use std::ops::{Add, Sub}; - -type Test = Add + - //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types - //~| ERROR E0191 - //~| NOTE missing associated type `Output` value - Sub; - //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types - //~| ERROR E0225 - //~| NOTE non-auto additional trait - -fn main() { } diff --git a/src/test/compile-fail/issue-22638.rs b/src/test/compile-fail/issue-22638.rs index 53b0d9f4e9..1c534ebbd4 100644 --- a/src/test/compile-fail/issue-22638.rs +++ b/src/test/compile-fail/issue-22638.rs @@ -19,7 +19,6 @@ struct A (B); impl A { pub fn matches(&self, f: &F) { - //~^ ERROR reached the recursion limit while instantiating `A::matches::<[closure let &A(ref term) = self; term.matches(f); } @@ -59,6 +58,7 @@ struct D (Box); impl D { pub fn matches(&self, f: &F) { + //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure let &D(ref a) = self; a.matches(f) } diff --git a/src/test/compile-fail/issue-24036.rs b/src/test/compile-fail/issue-24036.rs deleted file mode 100644 index ac7e0f2e9a..0000000000 --- a/src/test/compile-fail/issue-24036.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn closure_to_loc() { - let mut x = |c| c + 1; - x = |c| c + 1; - //~^ ERROR mismatched types - //~| NOTE no two closures, even if identical, have the same type - //~| HELP consider boxing your closure and/or using it as a trait object - //~| expected closure, found a different closure - //~| expected type `[closure - //~| found type `[closure -} - -fn closure_from_match() { - let x = match 1usize { - 1 => |c| c + 1, - 2 => |c| c - 1, - //~^ NOTE match arm with an incompatible type - _ => |c| c - 1 - }; - //~^^^^^^ ERROR match arms have incompatible types - //~| NOTE no two closures, even if identical, have the same type - //~| HELP consider boxing your closure and/or using it as a trait object - //~| expected closure, found a different closure - //~| expected type `[closure - //~| found type `[closure -} - -fn main() { } diff --git a/src/test/run-pass/issue-25439.rs b/src/test/compile-fail/issue-25439.rs similarity index 87% rename from src/test/run-pass/issue-25439.rs rename to src/test/compile-fail/issue-25439.rs index 88c48f42c5..6e33fd5ae7 100644 --- a/src/test/run-pass/issue-25439.rs +++ b/src/test/compile-fail/issue-25439.rs @@ -15,5 +15,5 @@ fn fix(f: F) -> i32 where F: Fn(Helper, i32) -> i32 { } fn main() { - fix(|_, x| x); + fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644] } diff --git a/src/test/compile-fail/issue-25579.rs b/src/test/compile-fail/issue-25579.rs index 4437e20fc4..71c1d63cf5 100644 --- a/src/test/compile-fail/issue-25579.rs +++ b/src/test/compile-fail/issue-25579.rs @@ -9,29 +9,24 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir + +#![feature(rustc_attrs)] enum Sexpression { Num(()), Cons(&'static mut Sexpression) } -fn causes_ice(mut l: &mut Sexpression) { +fn causes_error_in_ast(mut l: &mut Sexpression) { loop { match l { &mut Sexpression::Num(ref mut n) => {}, &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499] - //[mir]~^ ERROR (Ast) [E0499] - //[mir]~| ERROR (Mir) [E0506] - //[mir]~| ERROR (Mir) [E0499] l = &mut **expr; //[ast]~ ERROR [E0506] - //[mir]~^ ERROR (Ast) [E0506] - //[mir]~| ERROR (Mir) [E0506] - //[mir]~| ERROR (Mir) [E0506] - //[mir]~| ERROR (Mir) [E0499] - //[mir]~| ERROR (Mir) [E0499] } }} } -fn main() { +#[rustc_error] +fn main() { //[mir]~ ERROR compilation successful } diff --git a/src/test/ui/issue-26548.rs b/src/test/compile-fail/issue-26548.rs similarity index 70% rename from src/test/ui/issue-26548.rs rename to src/test/compile-fail/issue-26548.rs index 2591d7bcba..39c6e97268 100644 --- a/src/test/ui/issue-26548.rs +++ b/src/test/compile-fail/issue-26548.rs @@ -8,7 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: overflow representing the type +// error-pattern: unsupported cyclic reference between types/traits detected +// note-pattern: the cycle begins when computing layout of +// note-pattern: ...which then requires computing layout of +// note-pattern: ...which then again requires computing layout of trait Mirror { type It: ?Sized; } diff --git a/src/test/compile-fail/issue-27060-2.rs b/src/test/compile-fail/issue-27060-2.rs new file mode 100644 index 0000000000..28180b05c8 --- /dev/null +++ b/src/test/compile-fail/issue-27060-2.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(packed)] +pub struct Bad { + data: T, //~ ERROR `T: std::marker::Sized` is not satisfied +} + +fn main() {} diff --git a/src/test/compile-fail/issue-27060.rs b/src/test/compile-fail/issue-27060.rs new file mode 100644 index 0000000000..37369d551f --- /dev/null +++ b/src/test/compile-fail/issue-27060.rs @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(packed)] +pub struct Good { + data: &'static u32, + data2: [&'static u32; 2], + aligned: [u8; 32], +} + +#[repr(packed)] +pub struct JustArray { + array: [u32] +} + +#[deny(safe_packed_borrows)] +fn main() { + let good = Good { + data: &0, + data2: [&0, &0], + aligned: [0; 32] + }; + + unsafe { + let _ = &good.data; // ok + let _ = &good.data2[0]; // ok + } + + let _ = &good.data; //~ ERROR borrow of packed field requires unsafe + //~| hard error + let _ = &good.data2[0]; //~ ERROR borrow of packed field requires unsafe + //~| hard error + let _ = &*good.data; // ok, behind a pointer + let _ = &good.aligned; // ok, has align 1 + let _ = &good.aligned[2]; // ok, has align 1 +} diff --git a/src/test/compile-fail/issue-27078.rs b/src/test/compile-fail/issue-27078.rs new file mode 100644 index 0000000000..f34bef6224 --- /dev/null +++ b/src/test/compile-fail/issue-27078.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(associated_consts)] + +trait Foo { + const BAR: i32; + fn foo(self) -> &'static i32 { + //~^ ERROR the trait bound `Self: std::marker::Sized` is not satisfied + &::BAR + } +} + +fn main() {} diff --git a/src/test/compile-fail/issue-28848.rs b/src/test/compile-fail/issue-28848.rs index 3d23ce0ee4..1a06d59f0b 100644 --- a/src/test/compile-fail/issue-28848.rs +++ b/src/test/compile-fail/issue-28848.rs @@ -20,4 +20,4 @@ pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/issue-30079.rs b/src/test/compile-fail/issue-30079.rs index 15b7edb32d..04ae8f6d25 100644 --- a/src/test/compile-fail/issue-30079.rs +++ b/src/test/compile-fail/issue-30079.rs @@ -8,15 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![deny(private_in_public)] -#![allow(unused)] - struct SemiPriv; mod m1 { struct Priv; impl ::SemiPriv { - pub fn f(_: Priv) {} //~ ERROR private type `m1::Priv` in public interface + pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface //~^ WARNING hard error } @@ -29,7 +26,6 @@ mod m2 { struct Priv; impl ::std::ops::Deref for ::SemiPriv { type Target = Priv; //~ ERROR private type `m2::Priv` in public interface - //~^ WARNING hard error fn deref(&self) -> &Self::Target { unimplemented!() } } @@ -47,7 +43,6 @@ mod m3 { struct Priv; impl ::SemiPrivTrait for () { type Assoc = Priv; //~ ERROR private type `m3::Priv` in public interface - //~^ WARNING hard error } } diff --git a/src/test/compile-fail/issue-34334.rs b/src/test/compile-fail/issue-34334.rs index 95b5fabc81..a752a36ade 100644 --- a/src/test/compile-fail/issue-34334.rs +++ b/src/test/compile-fail/issue-34334.rs @@ -11,5 +11,4 @@ fn main () { let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=` let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); - //~^ ERROR cannot find value `sr` in this scope } diff --git a/src/test/compile-fail/issue-36082.rs b/src/test/compile-fail/issue-36082.rs index 1596d9cc84..fc3e063375 100644 --- a/src/test/compile-fail/issue-36082.rs +++ b/src/test/compile-fail/issue-36082.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir use std::cell::RefCell; @@ -21,18 +21,13 @@ fn main() { let val: &_ = x.borrow().0; //[ast]~^ ERROR borrowed value does not live long enough [E0597] //[ast]~| NOTE temporary value dropped here while still borrowed - //[ast]~| NOTE temporary value created here + //[ast]~| NOTE temporary value does not live long enough //[ast]~| NOTE consider using a `let` binding to increase its lifetime - //[mir]~^^^^^ ERROR borrowed value does not live long enough (Ast) [E0597] + //[mir]~^^^^^ ERROR borrowed value does not live long enough [E0597] //[mir]~| NOTE temporary value dropped here while still borrowed - //[mir]~| NOTE temporary value created here - //[mir]~| NOTE consider using a `let` binding to increase its lifetime - //[mir]~| ERROR borrowed value does not live long enough (Mir) [E0597] - //[mir]~| NOTE temporary value dropped here while still borrowed - //[mir]~| NOTE temporary value created here + //[mir]~| NOTE temporary value does not live long enough //[mir]~| NOTE consider using a `let` binding to increase its lifetime println!("{}", val); } //[ast]~^ NOTE temporary value needs to live until here //[mir]~^^ NOTE temporary value needs to live until here -//[mir]~| NOTE temporary value needs to live until here diff --git a/src/test/compile-fail/issue-38857.rs b/src/test/compile-fail/issue-38857.rs new file mode 100644 index 0000000000..b38b1b9fdc --- /dev/null +++ b/src/test/compile-fail/issue-38857.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; + //~^ ERROR failed to resolve. Could not find `imp` in `sys` [E0433] + //~^^ ERROR module `sys` is private [E0603] +} diff --git a/src/test/compile-fail/issue-39848.rs b/src/test/compile-fail/issue-39848.rs new file mode 100644 index 0000000000..d5ca009d31 --- /dev/null +++ b/src/test/compile-fail/issue-39848.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! get_opt { + ($tgt:expr, $field:ident) => { + if $tgt.has_$field() {} + } +} + +fn main() { + get_opt!(bar, foo); + //~^ ERROR expected `{`, found `foo` +} diff --git a/src/test/compile-fail/issue-41880.rs b/src/test/compile-fail/issue-41880.rs new file mode 100644 index 0000000000..23a2b78a76 --- /dev/null +++ b/src/test/compile-fail/issue-41880.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn iterate(initial: T, f: F) -> Iterate { + Iterate { + state: initial, + f: f, + } +} + +pub struct Iterate { + state: T, + f: F +} + +impl Iterator for Iterate where F: Fn(&T) -> T { + type Item = T; + + #[inline] + fn next(&mut self) -> Option { + self.state = (self.f)(&self.state); + Some(self.state.clone()) + } + #[inline] + fn size_hint(&self) -> (usize, Option) { (std::usize::MAX, None) } +} + +fn main() { + let a = iterate(0, |x| x+1); + println!("{:?}", a.iter().take(10).collect::>()); + //~^ ERROR no method named `iter` found for type `Iterate<{integer} +} diff --git a/src/test/compile-fail/issue-43355.rs b/src/test/compile-fail/issue-43355.rs new file mode 100644 index 0000000000..4db5c84df9 --- /dev/null +++ b/src/test/compile-fail/issue-43355.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(incoherent_fundamental_impls)] + +pub trait Trait1 { + type Output; +} + +pub trait Trait2 {} + +pub struct A; + +impl Trait1 for T where T: Trait2 { + type Output = (); +} + +impl Trait1> for A { +//~^ ERROR conflicting implementations of trait +//~| hard error +//~| downstream crates may implement trait `Trait2>` for type `A` + type Output = i32; +} + +fn main() {} diff --git a/src/test/compile-fail/issue-43733-2.rs b/src/test/compile-fail/issue-43733-2.rs index 1bf165c89d..0fd3145459 100644 --- a/src/test/compile-fail/issue-43733-2.rs +++ b/src/test/compile-fail/issue-43733-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(const_fn, const_cell_new, const_unsafe_cell_new)] +#![feature(const_fn)] #![feature(cfg_target_thread_local, thread_local_internals)] // On platforms *without* `#[thread_local]`, use diff --git a/src/test/compile-fail/issue-45199.rs b/src/test/compile-fail/issue-45199.rs new file mode 100644 index 0000000000..af8f7dce60 --- /dev/null +++ b/src/test/compile-fail/issue-45199.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: ast mir +//[mir]compile-flags: -Zborrowck=mir + +fn test_drop_replace() { + let b: Box; + b = Box::new(1); //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment + b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `b` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable +} + +fn test_call() { + let b = Box::new(1); //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment + b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `b` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable +} + +fn test_args(b: Box) { //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment + b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `b` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable +} + +fn main() {} diff --git a/src/test/compile-fail/issue-45965.rs b/src/test/compile-fail/issue-45965.rs new file mode 100644 index 0000000000..0b82f2b32f --- /dev/null +++ b/src/test/compile-fail/issue-45965.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 }; + //~^ ERROR expected function, found `{float}` +} diff --git a/src/test/compile-fail/issue-46023.rs b/src/test/compile-fail/issue-46023.rs new file mode 100644 index 0000000000..d51d92570f --- /dev/null +++ b/src/test/compile-fail/issue-46023.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: ast mir +//[mir]compile-flags: -Z emit-end-regions -Z borrowck=mir + +fn main() { + let x = 0; + + (move || { + x = 1; + //[mir]~^ ERROR cannot assign to immutable item `x` [E0594] + //[ast]~^^ ERROR cannot assign to captured outer variable in an `FnMut` closure [E0594] + })() +} diff --git a/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs b/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs new file mode 100644 index 0000000000..5b23e5e815 --- /dev/null +++ b/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs @@ -0,0 +1,51 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(crate_visibility_modifier)] + +mod rank { + pub use self::Professor::*; + //~^ ERROR enum is private and its variants cannot be reexported + pub use self::Lieutenant::{JuniorGrade, Full}; + //~^ ERROR variant `JuniorGrade` is private and cannot be reexported + //~| ERROR variant `Full` is private and cannot be reexported + pub use self::PettyOfficer::*; + //~^ ERROR enum is private and its variants cannot be reexported + pub use self::Crewman::*; + //~^ ERROR enum is private and its variants cannot be reexported + + enum Professor { + Adjunct, + Assistant, + Associate, + Full + } + + enum Lieutenant { + JuniorGrade, + Full, + } + + pub(in rank) enum PettyOfficer { + SecondClass, + FirstClass, + Chief, + MasterChief + } + + crate enum Crewman { + Recruit, + Apprentice, + Full + } + +} + +fn main() {} diff --git a/src/test/compile-fail/issue-46311.rs b/src/test/compile-fail/issue-46311.rs new file mode 100644 index 0000000000..82f55f2c14 --- /dev/null +++ b/src/test/compile-fail/issue-46311.rs @@ -0,0 +1,14 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + 'break: loop { //~ ERROR invalid label name `'break` + } +} diff --git a/src/test/compile-fail/issue-46771.rs b/src/test/compile-fail/issue-46771.rs new file mode 100644 index 0000000000..f8bcd8861f --- /dev/null +++ b/src/test/compile-fail/issue-46771.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + struct Foo; + (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo` +} diff --git a/src/test/compile-fail/issue-46843.rs b/src/test/compile-fail/issue-46843.rs new file mode 100644 index 0000000000..d88b4e568b --- /dev/null +++ b/src/test/compile-fail/issue-46843.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum Thing { This, That } + +fn non_const() -> Thing { + Thing::This +} + +pub const Q: i32 = match non_const() { //~ ERROR E0015 + Thing::This => 1, //~ ERROR unimplemented expression type + Thing::That => 0 +}; + +fn main() {} diff --git a/src/test/compile-fail/issue-47412.rs b/src/test/compile-fail/issue-47412.rs new file mode 100644 index 0000000000..7481befcb7 --- /dev/null +++ b/src/test/compile-fail/issue-47412.rs @@ -0,0 +1,31 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[derive(Copy, Clone)] +enum Void {} + +// Tests that we detect unsafe places (specifically, union fields and +// raw pointer dereferences), even when they're matched on while having +// an uninhabited type (equivalent to `std::intrinsics::unreachable()`). + +fn union_field() { + union Union { unit: (), void: Void } + let u = Union { unit: () }; + match u.void {} + //~^ ERROR access to union field requires unsafe function or block +} + +fn raw_ptr_deref() { + let ptr = std::ptr::null::(); + match *ptr {} + //~^ ERROR dereference of raw pointer requires unsafe function or block +} + +fn main() {} diff --git a/src/test/compile-fail/issue-5500-1.rs b/src/test/compile-fail/issue-5500-1.rs index 2c2c32c0e8..4bd147a5e1 100644 --- a/src/test/compile-fail/issue-5500-1.rs +++ b/src/test/compile-fail/issue-5500-1.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=compare struct TrieMapIterator<'a> { node: &'a usize @@ -18,8 +18,9 @@ struct TrieMapIterator<'a> { fn main() { let a = 5; let _iter = TrieMapIterator{node: &a}; - _iter.node = & //[ast]~ ERROR cannot assign to immutable field - //[mir]~^ ERROR cannot assign to immutable field `_iter.node` (Ast) - // FIXME Error for MIR + _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding + //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast) + // MIR doesn't generate an error because the code isn't reachable. This is OK + // because the test is here to check that the compiler doesn't ICE (cf. #5500). panic!() } diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs index ef53be7578..16138c992f 100644 --- a/src/test/compile-fail/issue-7364.rs +++ b/src/test/compile-fail/issue-7364.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax, const_refcell_new)] +#![feature(box_syntax)] use std::cell::RefCell; @@ -16,6 +16,5 @@ use std::cell::RefCell; static boxed: Box> = box RefCell::new(0); //~^ ERROR allocations are not allowed in statics //~| ERROR `std::cell::RefCell: std::marker::Sync` is not satisfied -//~| WARN unsupported constant expr fn main() { } diff --git a/src/test/compile-fail/kindck-send-unsafe.rs b/src/test/compile-fail/kindck-send-unsafe.rs index ecee2e0a4c..c717d1a72e 100644 --- a/src/test/compile-fail/kindck-send-unsafe.rs +++ b/src/test/compile-fail/kindck-send-unsafe.rs @@ -14,7 +14,7 @@ fn assert_send() { } fn test71<'a>() { assert_send::<*mut &'a isize>(); - //~^ ERROR `*mut &'a isize: core::marker::Send` is not satisfied + //~^ ERROR `*mut &'a isize: std::marker::Send` is not satisfied } fn main() { diff --git a/src/test/parse-fail/lifetime-no-keyword.rs b/src/test/compile-fail/lifetime-no-keyword.rs similarity index 68% rename from src/test/parse-fail/lifetime-no-keyword.rs rename to src/test/compile-fail/lifetime-no-keyword.rs index a8771ae93a..d583c4fc6c 100644 --- a/src/test/parse-fail/lifetime-no-keyword.rs +++ b/src/test/compile-fail/lifetime-no-keyword.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z parse-only -Z continue-parse-after-error - fn foo<'a>(a: &'a isize) { } fn bar(a: &'static isize) { } -fn baz(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names -fn zab(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names - +fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names +//~^ ERROR lifetimes cannot use keyword names +fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names +//~^ ERROR lifetimes cannot use keyword names fn main() { } diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs index 1d9b179c05..fd825563eb 100644 --- a/src/test/compile-fail/lint-ctypes.rs +++ b/src/test/compile-fail/lint-ctypes.rs @@ -52,8 +52,6 @@ extern { pub fn fn_type2(p: fn()); //~ ERROR found function pointer with Rust pub fn fn_contained(p: RustBadRet); //~ ERROR: found struct without - pub fn good1(size: *const libc::c_int); - pub fn good2(size: *const libc::c_uint); pub fn good3(fptr: Option); pub fn good4(aptr: &[u8; 4 as usize]); pub fn good5(s: StructWithProjection); @@ -66,5 +64,11 @@ extern { pub fn good12(size: usize); } +#[cfg(not(target_arch = "wasm32"))] +extern { + pub fn good1(size: *const libc::c_int); + pub fn good2(size: *const libc::c_uint); +} + fn main() { } diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs index f45e80f525..d6ca5e6b1d 100644 --- a/src/test/compile-fail/lint-dead-code-1.rs +++ b/src/test/compile-fail/lint-dead-code-1.rs @@ -74,7 +74,7 @@ pub enum pub_enum3 { enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used enum used_enum { foo3, - bar3 //~ ERROR variant is never used + bar3 //~ ERROR variant is never constructed } fn f() {} diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs index 28475b1ef8..f680e39544 100644 --- a/src/test/compile-fail/lint-dead-code-3.rs +++ b/src/test/compile-fail/lint-dead-code-3.rs @@ -11,11 +11,9 @@ #![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] -#![feature(libc)] #![crate_type="lib"] -extern crate libc; pub use extern_foo as x; extern { @@ -54,14 +52,13 @@ pub fn pub_fn() { } mod blah { - use libc::size_t; // not warned because it's used in the parameter of `free` and return of // `malloc` below, which are also used. enum c_void {} extern { fn free(p: *const c_void); - fn malloc(size: size_t) -> *const c_void; + fn malloc(size: usize) -> *const c_void; } pub fn baz() { diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index 3df089fc20..1296cf46e6 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -22,8 +22,8 @@ fn field_read(f: Foo) -> usize { } enum XYZ { - X, //~ ERROR variant is never used - Y { //~ ERROR variant is never used + X, //~ ERROR variant is never constructed + Y { //~ ERROR variant is never constructed a: String, b: i32, c: i32, @@ -43,13 +43,13 @@ enum ABC { //~ ERROR enum is never used // ensure struct variants get warning for their fields enum IJK { - I, //~ ERROR variant is never used + I, //~ ERROR variant is never constructed J { a: String, b: i32, //~ ERROR field is never used c: i32, //~ ERROR field is never used }, - K //~ ERROR variant is never used + K //~ ERROR variant is never constructed } diff --git a/src/test/compile-fail/lint-dead-code-5.rs b/src/test/compile-fail/lint-dead-code-5.rs index 04d6547d93..ee5cf24823 100644 --- a/src/test/compile-fail/lint-dead-code-5.rs +++ b/src/test/compile-fail/lint-dead-code-5.rs @@ -13,15 +13,15 @@ enum Enum1 { Variant1(isize), - Variant2 //~ ERROR: variant is never used + Variant2 //~ ERROR: variant is never constructed } enum Enum2 { Variant3(bool), #[allow(dead_code)] Variant4(isize), - Variant5 { _x: isize }, //~ ERROR: variant is never used: `Variant5` - Variant6(isize), //~ ERROR: variant is never used: `Variant6` + Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5` + Variant6(isize), //~ ERROR: variant is never constructed: `Variant6` _Variant7, } diff --git a/src/test/compile-fail/lint-dead-code-variant.rs b/src/test/compile-fail/lint-dead-code-variant.rs index 0116d63caf..3301560c31 100644 --- a/src/test/compile-fail/lint-dead-code-variant.rs +++ b/src/test/compile-fail/lint-dead-code-variant.rs @@ -12,7 +12,7 @@ #[derive(Clone)] enum Enum { - Variant1, //~ ERROR: variant is never used + Variant1, //~ ERROR: variant is never constructed Variant2, } diff --git a/src/test/compile-fail/lint-stability-deprecated.rs b/src/test/compile-fail/lint-stability-deprecated.rs index df5c3dddcd..f2defc1d42 100644 --- a/src/test/compile-fail/lint-stability-deprecated.rs +++ b/src/test/compile-fail/lint-stability-deprecated.rs @@ -108,6 +108,11 @@ mod cross_crate { struct S1(T::TypeUnstable); struct S2(T::TypeDeprecated); //~^ WARN use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text + type A = TraitWithAssociatedTypes< + TypeUnstable = u8, + TypeDeprecated = u16, + //~^ WARN use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated' + >; let _ = DeprecatedStruct { //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct' i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct::i' diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs index 1ece7a0b8e..49a5220429 100644 --- a/src/test/compile-fail/lint-stability.rs +++ b/src/test/compile-fail/lint-stability.rs @@ -96,6 +96,10 @@ mod cross_crate { struct S1(T::TypeUnstable); //~^ ERROR use of unstable library feature struct S2(T::TypeDeprecated); + type A = TraitWithAssociatedTypes< + TypeUnstable = u8, //~ ERROR use of unstable library feature + TypeDeprecated = u16, + >; let _ = DeprecatedStruct { i: 0 diff --git a/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs b/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs index fa8f264eb5..f28906ddb9 100644 --- a/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs +++ b/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs @@ -8,11 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Zborrowck=mir + fn test() { let v: isize; loop { - v = 1; //~ ERROR cannot assign twice to immutable variable - //~^ NOTE cannot assign twice to immutable variable + v = 1; //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `v` + //[ast]~| NOTE cannot assign twice to immutable variable + //[mir]~| NOTE cannot assign twice to immutable variable v.clone(); // just to prevent liveness warnings } } diff --git a/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs b/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs index bfdd4347de..594cc07612 100644 --- a/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs +++ b/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs @@ -8,11 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Zborrowck=mir + fn test() { let v: isize; - v = 2; //~ NOTE first assignment - v += 1; //~ ERROR cannot assign twice to immutable variable - //~| NOTE cannot assign twice to immutable + v = 2; //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment + v += 1; //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `v` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable v.clone(); } diff --git a/src/test/compile-fail/liveness-assign-imm-local-with-drop.rs b/src/test/compile-fail/liveness-assign-imm-local-with-drop.rs new file mode 100644 index 0000000000..b4fb33ca15 --- /dev/null +++ b/src/test/compile-fail/liveness-assign-imm-local-with-drop.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: ast mir +//[mir]compile-flags: -Zborrowck=mir + +fn test() { + let b = Box::new(1); //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment + drop(b); + b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `b` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable + drop(b); +} + +fn main() { +} diff --git a/src/test/compile-fail/liveness-assign-imm-local-with-init.rs b/src/test/compile-fail/liveness-assign-imm-local-with-init.rs index f35c1c69ac..7204b5d5f2 100644 --- a/src/test/compile-fail/liveness-assign-imm-local-with-init.rs +++ b/src/test/compile-fail/liveness-assign-imm-local-with-init.rs @@ -8,11 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Zborrowck=mir + fn test() { - let v: isize = 1; //~ NOTE first assignment + let v: isize = 1; //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment v.clone(); - v = 2; //~ ERROR cannot assign twice to immutable variable - //~| NOTE cannot assign twice to immutable + v = 2; //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `v` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable v.clone(); } diff --git a/src/test/compile-fail/main-wrong-type-2.rs b/src/test/compile-fail/main-wrong-type-2.rs index 9d74d1a904..a63162cf73 100644 --- a/src/test/compile-fail/main-wrong-type-2.rs +++ b/src/test/compile-fail/main-wrong-type-2.rs @@ -7,8 +7,9 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(termination_trait)] fn main() -> char { -//~^ ERROR: main function has wrong type [E0580] +//~^ ERROR: the trait bound `char: std::Termination` is not satisfied ' ' } diff --git a/src/test/compile-fail/mir_check_cast_closure.rs b/src/test/compile-fail/mir_check_cast_closure.rs new file mode 100644 index 0000000000..6562efeb6d --- /dev/null +++ b/src/test/compile-fail/mir_check_cast_closure.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z borrowck=mir -Z nll + +#![allow(dead_code)] + +fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 { + let g: fn(_, _) -> _ = |_x, y| y; + //~^ ERROR free region `'b` does not outlive free region `'a` + g + //~^ WARNING not reporting region error due to -Znll +} + +fn main() {} diff --git a/src/test/compile-fail/mir_check_cast_reify.rs b/src/test/compile-fail/mir_check_cast_reify.rs new file mode 100644 index 0000000000..f6ad2820d1 --- /dev/null +++ b/src/test/compile-fail/mir_check_cast_reify.rs @@ -0,0 +1,52 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z borrowck=mir -Z nll + +#![allow(dead_code)] + +// Test that we relate the type of the fn type to the type of the fn +// ptr when doing a `ReifyFnPointer` cast. +// +// This test is a bit tortured, let me explain: +// + +// The `where 'a: 'a` clause here ensures that `'a` is early bound, +// which is needed below to ensure that this test hits the path we are +// concerned with. +fn foo<'a>(x: &'a u32) -> &'a u32 +where + 'a: 'a, +{ + panic!() +} + +fn bar<'a>(x: &'a u32) -> &'static u32 { + // Here, the type of `foo` is `typeof(foo::<'x>)` for some fresh variable `'x`. + // During NLL region analysis, this will get renumbered to `typeof(foo::<'?0>)` + // where `'?0` is a new region variable. + // + // (Note that if `'a` on `foo` were late-bound, the type would be + // `typeof(foo)`, which would interact differently with because + // the renumbering later.) + // + // This type is then coerced to a fn type `fn(&'?1 u32) -> &'?2 + // u32`. Here, the `'?1` and `'?2` will have been created during + // the NLL region renumbering. + // + // The MIR type checker must therefore relate `'?0` to `'?1` and `'?2` + // as part of checking the `ReifyFnPointer`. + let f: fn(_) -> _ = foo; + //~^ WARNING not reporting region error due to -Znll + //~| ERROR free region `'a` does not outlive free region `'static` + f(x) +} + +fn main() {} diff --git a/src/test/compile-fail/mir_check_cast_unsafe_fn.rs b/src/test/compile-fail/mir_check_cast_unsafe_fn.rs new file mode 100644 index 0000000000..c9b378dacd --- /dev/null +++ b/src/test/compile-fail/mir_check_cast_unsafe_fn.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z borrowck=mir -Z nll + +#![allow(dead_code)] + +fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 { + // Here the NLL checker must relate the types in `f` to the types + // in `g`. These are related via the `UnsafeFnPointer` cast. + let g: unsafe fn(_) -> _ = f; + //~^ WARNING not reporting region error due to -Znll + //~| ERROR free region `'a` does not outlive free region `'static` + unsafe { g(input) } +} + +fn main() {} diff --git a/src/test/compile-fail/mir_check_cast_unsize.rs b/src/test/compile-fail/mir_check_cast_unsize.rs new file mode 100644 index 0000000000..1df56793f7 --- /dev/null +++ b/src/test/compile-fail/mir_check_cast_unsize.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z borrowck=mir -Z nll + +#![allow(dead_code)] +#![feature(dyn_trait)] + +use std::fmt::Debug; + +fn bar<'a>(x: &'a u32) -> &'static dyn Debug { + //~^ ERROR free region `'a` does not outlive free region `'static` + x + //~^ WARNING not reporting region error due to -Znll +} + +fn main() {} diff --git a/src/test/compile-fail/mut-pattern-internal-mutability.rs b/src/test/compile-fail/mut-pattern-internal-mutability.rs index 1c7bc9d730..72727cdfe5 100644 --- a/src/test/compile-fail/mut-pattern-internal-mutability.rs +++ b/src/test/compile-fail/mut-pattern-internal-mutability.rs @@ -9,15 +9,14 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn main() { let foo = &mut 1; let &mut x = foo; x += 1; //[ast]~ ERROR cannot assign twice to immutable variable - //[mir]~^ ERROR cannot assign twice to immutable variable `x` (Ast) - //[mir]~| ERROR cannot assign twice to immutable variable `x` (Mir) + //[mir]~^ ERROR cannot assign twice to immutable variable `x` // explicitly mut-ify internals let &mut mut x = foo; @@ -26,6 +25,5 @@ fn main() { // check borrowing is detected successfully let &mut ref x = foo; *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed - //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `(*foo)` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed } diff --git a/src/test/compile-fail/mutable-class-fields.rs b/src/test/compile-fail/mutable-class-fields.rs index c163dc2b4d..f138ae93f7 100644 --- a/src/test/compile-fail/mutable-class-fields.rs +++ b/src/test/compile-fail/mutable-class-fields.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + struct cat { meows : usize, how_hungry : isize, @@ -22,5 +25,6 @@ fn cat(in_x : usize, in_y : isize) -> cat { fn main() { let nyan : cat = cat(52, 99); - nyan.how_hungry = 0; //~ ERROR cannot assign + nyan.how_hungry = 0; //[ast]~ ERROR cannot assign + //[mir]~^ ERROR cannot assign } diff --git a/src/test/compile-fail/never-assign-wrong-type.rs b/src/test/compile-fail/never-assign-wrong-type.rs index d854e6eb20..c0dd2cab74 100644 --- a/src/test/compile-fail/never-assign-wrong-type.rs +++ b/src/test/compile-fail/never-assign-wrong-type.rs @@ -16,5 +16,3 @@ fn main() { let x: ! = "hello"; //~ ERROR mismatched types } - - diff --git a/src/test/compile-fail/nll/loan_ends_mid_block_pair.rs b/src/test/compile-fail/nll/loan_ends_mid_block_pair.rs index c02977f22e..fdc650a072 100644 --- a/src/test/compile-fail/nll/loan_ends_mid_block_pair.rs +++ b/src/test/compile-fail/nll/loan_ends_mid_block_pair.rs @@ -9,7 +9,7 @@ // except according to those terms. -// compile-flags:-Zborrowck-mir -Znll +// compile-flags:-Zborrowck=compare -Znll #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/src/test/compile-fail/nll/loan_ends_mid_block_vec.rs b/src/test/compile-fail/nll/loan_ends_mid_block_vec.rs index 5e3a003b54..f22d2fc23e 100644 --- a/src/test/compile-fail/nll/loan_ends_mid_block_vec.rs +++ b/src/test/compile-fail/nll/loan_ends_mid_block_vec.rs @@ -9,7 +9,7 @@ // except according to those terms. -// compile-flags:-Zborrowck-mir -Znll +// compile-flags:-Zborrowck=compare -Znll #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/src/test/compile-fail/nll/reference-carried-through-struct-field.rs b/src/test/compile-fail/nll/reference-carried-through-struct-field.rs new file mode 100644 index 0000000000..1c1fc4799c --- /dev/null +++ b/src/test/compile-fail/nll/reference-carried-through-struct-field.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//revisions: ast mir +//[mir] compile-flags: -Z borrowck=mir -Z nll + +#![allow(unused_assignments)] + +struct Wrap<'a> { w: &'a mut u32 } + +fn foo() { + let mut x = 22; + let wrapper = Wrap { w: &mut x }; + x += 1; //[ast]~ ERROR cannot assign to `x` because it is borrowed [E0506] + //[mir]~^ ERROR cannot assign to `x` because it is borrowed [E0506] + //[mir]~^^ ERROR cannot use `x` because it was mutably borrowed [E0503] + *wrapper.w += 1; +} + +fn main() { } diff --git a/src/test/compile-fail/nll/region-ends-after-if-condition.rs b/src/test/compile-fail/nll/region-ends-after-if-condition.rs index bec56982c5..1128d65af9 100644 --- a/src/test/compile-fail/nll/region-ends-after-if-condition.rs +++ b/src/test/compile-fail/nll/region-ends-after-if-condition.rs @@ -12,7 +12,7 @@ // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. -// compile-flags:-Zborrowck-mir -Znll +// compile-flags:-Zborrowck=compare -Znll #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/src/test/compile-fail/nll/return_from_loop.rs b/src/test/compile-fail/nll/return_from_loop.rs index 6b287fd227..7ed59ef2a8 100644 --- a/src/test/compile-fail/nll/return_from_loop.rs +++ b/src/test/compile-fail/nll/return_from_loop.rs @@ -12,7 +12,7 @@ // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. -// compile-flags:-Zborrowck-mir -Znll +// compile-flags:-Zborrowck=compare -Znll #![allow(warnings)] #![feature(rustc_attrs)] diff --git a/src/test/compile-fail/nll/where_clauses_in_functions.rs b/src/test/compile-fail/nll/where_clauses_in_functions.rs new file mode 100644 index 0000000000..ecea875690 --- /dev/null +++ b/src/test/compile-fail/nll/where_clauses_in_functions.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z borrowck=mir -Z nll + +#![allow(dead_code)] + +fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) +where + 'a: 'b, +{ + (x, y) +} + +fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { + foo(x, y) + //~^ ERROR lifetime mismatch [E0623] + //~| WARNING not reporting region error due to -Znll +} + +fn main() {} diff --git a/src/test/compile-fail/nll/where_clauses_in_structs.rs b/src/test/compile-fail/nll/where_clauses_in_structs.rs new file mode 100644 index 0000000000..f1a6dc48e1 --- /dev/null +++ b/src/test/compile-fail/nll/where_clauses_in_structs.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z borrowck=mir -Z nll + +#![allow(dead_code)] + +use std::cell::Cell; + +struct Foo<'a: 'b, 'b> { + x: Cell<&'a u32>, + y: Cell<&'b u32>, +} + +fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) { + Foo { x, y }; + //~^ ERROR lifetime mismatch [E0623] + //~| WARNING not reporting region error due to -Znll +} + +fn main() {} diff --git a/src/test/compile-fail/nolink-with-link-args.rs b/src/test/compile-fail/nolink-with-link-args.rs index c4c75bc760..6dfd74f541 100644 --- a/src/test/compile-fail/nolink-with-link-args.rs +++ b/src/test/compile-fail/nolink-with-link-args.rs @@ -9,6 +9,7 @@ // except according to those terms. // error-pattern:aFdEfSeVEE +// compile-flags: -Z linker-flavor=ld /* We're testing that link_args are indeed passed when nolink is specified. So we try to compile with junk link_args and make sure they are visible in diff --git a/src/test/compile-fail/non-copyable-void.rs b/src/test/compile-fail/non-copyable-void.rs index 4383f3ede0..63e5f96375 100644 --- a/src/test/compile-fail/non-copyable-void.rs +++ b/src/test/compile-fail/non-copyable-void.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-wasm32-bare no libc to test ffi with + #![feature(libc)] extern crate libc; diff --git a/src/test/compile-fail/occurs-check-2.rs b/src/test/compile-fail/occurs-check-2.rs index a276af83de..5d162fe944 100644 --- a/src/test/compile-fail/occurs-check-2.rs +++ b/src/test/compile-fail/occurs-check-2.rs @@ -16,7 +16,5 @@ fn main() { g = f; f = box g; //~^ ERROR mismatched types - //~| expected type `_` - //~| found type `std::boxed::Box<_>` //~| cyclic type of infinite size } diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/compile-fail/occurs-check.rs index 5b6a11e58c..2c784365ea 100644 --- a/src/test/compile-fail/occurs-check.rs +++ b/src/test/compile-fail/occurs-check.rs @@ -14,7 +14,5 @@ fn main() { let f; f = box f; //~^ ERROR mismatched types - //~| expected type `_` - //~| found type `std::boxed::Box<_>` //~| cyclic type of infinite size } diff --git a/src/test/compile-fail/panic-runtime/libtest-unwinds.rs b/src/test/compile-fail/panic-runtime/libtest-unwinds.rs index 5f6f4ecbd6..71751034c3 100644 --- a/src/test/compile-fail/panic-runtime/libtest-unwinds.rs +++ b/src/test/compile-fail/panic-runtime/libtest-unwinds.rs @@ -10,6 +10,7 @@ // error-pattern:is not compiled with this crate's panic strategy `abort` // compile-flags:-C panic=abort +// ignore-wasm32-bare compiled with panic=abort by default #![feature(test)] diff --git a/src/test/compile-fail/panic-runtime/transitive-link-a-bunch.rs b/src/test/compile-fail/panic-runtime/transitive-link-a-bunch.rs index 885b3e6dbb..f886aac9a1 100644 --- a/src/test/compile-fail/panic-runtime/transitive-link-a-bunch.rs +++ b/src/test/compile-fail/panic-runtime/transitive-link-a-bunch.rs @@ -14,6 +14,7 @@ // aux-build:wants-panic-runtime-abort.rs // aux-build:panic-runtime-lang-items.rs // error-pattern: is not compiled with this crate's panic strategy `unwind` +// ignore-wasm32-bare compiled with panic=abort by default #![no_std] diff --git a/src/test/compile-fail/panic-runtime/want-unwind-got-abort.rs b/src/test/compile-fail/panic-runtime/want-unwind-got-abort.rs index 88ad36f310..dda92d9a56 100644 --- a/src/test/compile-fail/panic-runtime/want-unwind-got-abort.rs +++ b/src/test/compile-fail/panic-runtime/want-unwind-got-abort.rs @@ -11,6 +11,7 @@ // error-pattern:is incompatible with this crate's strategy of `unwind` // aux-build:panic-runtime-abort.rs // aux-build:panic-runtime-lang-items.rs +// ignore-wasm32-bare compiled with panic=abort by default #![no_std] diff --git a/src/test/compile-fail/panic-runtime/want-unwind-got-abort2.rs b/src/test/compile-fail/panic-runtime/want-unwind-got-abort2.rs index c42a25a553..49f719057d 100644 --- a/src/test/compile-fail/panic-runtime/want-unwind-got-abort2.rs +++ b/src/test/compile-fail/panic-runtime/want-unwind-got-abort2.rs @@ -12,6 +12,7 @@ // aux-build:panic-runtime-abort.rs // aux-build:wants-panic-runtime-abort.rs // aux-build:panic-runtime-lang-items.rs +// ignore-wasm32-bare compiled with panic=abort by default #![no_std] diff --git a/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs b/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs new file mode 100644 index 0000000000..63cb6e82c2 --- /dev/null +++ b/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs @@ -0,0 +1,122 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(decl_macro, associated_type_defaults)] +#![allow(unused, private_in_public)] + +mod priv_nominal { + pub struct Pub; + impl Pub { + fn method(&self) {} + const CONST: u8 = 0; + // type AssocTy = u8; + } + + pub macro mac() { + let value = Pub::method; + //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private + value; + //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private + Pub.method(); + //~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private + Pub::CONST; + //~^ ERROR associated constant `CONST` is private + // let _: Pub::AssocTy; + // pub type InSignatureTy = Pub::AssocTy; + } +} +fn priv_nominal() { + priv_nominal::mac!(); +} + +mod priv_signature { + struct Priv; + pub struct Pub; + impl Pub { + pub fn method(&self, arg: Priv) {} + } + + pub macro mac() { + let value = Pub::method; + //~^ ERROR type `priv_signature::Priv` is private + value; + //~^ ERROR type `priv_signature::Priv` is private + Pub.method(loop {}); + //~^ ERROR type `priv_signature::Priv` is private + } +} +fn priv_signature() { + priv_signature::mac!(); +} + +mod priv_substs { + struct Priv; + pub struct Pub; + impl Pub { + pub fn method(&self) {} + } + + pub macro mac() { + let value = Pub::method::; + //~^ ERROR type `priv_substs::Priv` is private + value; + //~^ ERROR type `priv_substs::Priv` is private + Pub.method::(); + //~^ ERROR type `priv_substs::Priv` is private + } +} +fn priv_substs() { + priv_substs::mac!(); +} + +mod priv_parent_substs { + struct Priv; + pub struct Pub(T); + impl Pub { + pub fn method(&self) {} + pub fn static_method() {} + pub const CONST: u8 = 0; + // pub type AssocTy = u8; + } + + pub macro mac() { + let value = ::method; + //~^ ERROR type `priv_parent_substs::Priv` is private + value; + //~^ ERROR type `priv_parent_substs::Priv` is private + let value = Pub::method; + //~^ ERROR type `priv_parent_substs::Priv` is private + value; + //~^ ERROR type `priv_parent_substs::Priv` is private + let value = ::static_method; + //~^ ERROR type `priv_parent_substs::Priv` is private + value; + //~^ ERROR type `priv_parent_substs::Priv` is private + let value = Pub::static_method; + //~^ ERROR type `priv_parent_substs::Priv` is private + value; + //~^ ERROR type `priv_parent_substs::Priv` is private + Pub(Priv).method(); + //~^ ERROR type `priv_parent_substs::Priv` is private + + ::CONST; + //~^ ERROR type `priv_parent_substs::Priv` is private + Pub::CONST; + //~^ ERROR type `priv_parent_substs::Priv` is private + + // let _: Pub::AssocTy; + // pub type InSignatureTy = Pub::AssocTy; + } +} +fn priv_parent_substs() { + priv_parent_substs::mac!(); +} + +fn main() {} diff --git a/src/test/compile-fail/privacy/associated-item-privacy-trait.rs b/src/test/compile-fail/privacy/associated-item-privacy-trait.rs new file mode 100644 index 0000000000..bdc0c680a9 --- /dev/null +++ b/src/test/compile-fail/privacy/associated-item-privacy-trait.rs @@ -0,0 +1,151 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-tidy-linelength + +#![feature(decl_macro, associated_type_defaults)] +#![allow(unused, private_in_public)] + +mod priv_trait { + trait PrivTr { + fn method(&self) {} + const CONST: u8 = 0; + type AssocTy = u8; + } + pub struct Pub; + impl PrivTr for Pub {} + pub trait PubTr: PrivTr {} + + pub macro mac() { + let value = ::method; + //~^ ERROR type `for<'r> fn(&'r priv_trait::Pub) {::method}` is private + value; + //~^ ERROR type `for<'r> fn(&'r priv_trait::Pub) {::method}` is private + Pub.method(); + //~^ ERROR type `for<'r> fn(&'r Self) {::method}` is private + ::CONST; + //~^ ERROR associated constant `PrivTr::CONST` is private + let _: ::AssocTy; + //~^ ERROR trait `priv_trait::PrivTr` is private + //~| ERROR trait `priv_trait::PrivTr` is private + pub type InSignatureTy = ::AssocTy; + //~^ ERROR trait `priv_trait::PrivTr` is private + pub trait InSignatureTr: PrivTr {} + //~^ ERROR trait `priv_trait::PrivTr` is private + impl PrivTr for u8 {} + //~^ ERROR trait `priv_trait::PrivTr` is private + } +} +fn priv_trait() { + priv_trait::mac!(); +} + +mod priv_signature { + pub trait PubTr { + fn method(&self, arg: Priv) {} + } + struct Priv; + pub struct Pub; + impl PubTr for Pub {} + + pub macro mac() { + let value = ::method; + //~^ ERROR type `priv_signature::Priv` is private + value; + //~^ ERROR type `priv_signature::Priv` is private + Pub.method(loop {}); + //~^ ERROR type `priv_signature::Priv` is private + } +} +fn priv_signature() { + priv_signature::mac!(); +} + +mod priv_substs { + pub trait PubTr { + fn method(&self) {} + } + struct Priv; + pub struct Pub; + impl PubTr for Pub {} + + pub macro mac() { + let value = ::method::; + //~^ ERROR type `priv_substs::Priv` is private + value; + //~^ ERROR type `priv_substs::Priv` is private + Pub.method::(); + //~^ ERROR type `priv_substs::Priv` is private + } +} +fn priv_substs() { + priv_substs::mac!(); +} + +mod priv_parent_substs { + pub trait PubTr { + fn method(&self) {} + const CONST: u8 = 0; + type AssocTy = u8; + } + struct Priv; + pub struct Pub; + impl PubTr for Pub {} + impl PubTr for Priv {} + + pub macro mac() { + let value = ::method; + //~^ ERROR type `priv_parent_substs::Priv` is private + value; + //~^ ERROR type `priv_parent_substs::Priv` is private + let value = >::method; + //~^ ERROR type `priv_parent_substs::Priv` is private + value; + //~^ ERROR type `priv_parent_substs::Priv` is private + Pub.method(); + //~^ ERROR type `priv_parent_substs::Priv` is private + + let value = >::method; + //~^ ERROR type `priv_parent_substs::Priv` is private + value; + //~^ ERROR type `priv_parent_substs::Priv` is private + Priv.method(); + //~^ ERROR type `priv_parent_substs::Priv` is private + + ::CONST; + //~^ ERROR type `priv_parent_substs::Priv` is private + >::CONST; + //~^ ERROR type `priv_parent_substs::Priv` is private + >::CONST; + //~^ ERROR type `priv_parent_substs::Priv` is private + + let _: ::AssocTy; + //~^ ERROR type `priv_parent_substs::Priv` is private + //~| ERROR type `priv_parent_substs::Priv` is private + let _: >::AssocTy; + //~^ ERROR type `priv_parent_substs::Priv` is private + //~| ERROR type `priv_parent_substs::Priv` is private + let _: >::AssocTy; + //~^ ERROR type `priv_parent_substs::Priv` is private + //~| ERROR type `priv_parent_substs::Priv` is private + + pub type InSignatureTy1 = ::AssocTy; + //~^ ERROR type `priv_parent_substs::Priv` is private + pub type InSignatureTy2 = >::AssocTy; + //~^ ERROR type `priv_parent_substs::Priv` is private + impl PubTr for u8 {} + //~^ ERROR type `priv_parent_substs::Priv` is private + } +} +fn priv_parent_substs() { + priv_parent_substs::mac!(); +} + +fn main() {} diff --git a/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs b/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs new file mode 100644 index 0000000000..c25616c543 --- /dev/null +++ b/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs @@ -0,0 +1,74 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(decl_macro, associated_type_defaults)] +#![allow(unused, private_in_public)] + +mod priv_trait { + trait PrivTr { + type AssocTy = u8; + } + pub trait PubTr: PrivTr {} + + pub macro mac1() { + let _: Box>; + //~^ ERROR type `priv_trait::PubTr + '` is private + //~| ERROR type `priv_trait::PubTr + '` is private + type InSignatureTy2 = Box>; + //~^ ERROR type `priv_trait::PubTr + 'static` is private + trait InSignatureTr2: PubTr {} + //~^ ERROR trait `priv_trait::PrivTr` is private + } + pub macro mac2() { + let _: Box>; + //~^ ERROR type `priv_trait::PrivTr + '` is private + //~| ERROR type `priv_trait::PrivTr + '` is private + type InSignatureTy1 = Box>; + //~^ ERROR type `priv_trait::PrivTr + 'static` is private + trait InSignatureTr1: PrivTr {} + //~^ ERROR trait `priv_trait::PrivTr` is private + } +} +fn priv_trait1() { + priv_trait::mac1!(); +} +fn priv_trait2() { + priv_trait::mac2!(); +} + +mod priv_parent_substs { + pub trait PubTrWithParam { + type AssocTy = u8; + } + struct Priv; + pub trait PubTr: PubTrWithParam {} + + pub macro mac() { + let _: Box>; + //~^ ERROR type `priv_parent_substs::Priv` is private + //~| ERROR type `priv_parent_substs::Priv` is private + let _: Box>; + //~^ ERROR type `priv_parent_substs::Priv` is private + //~| ERROR type `priv_parent_substs::Priv` is private + pub type InSignatureTy1 = Box>; + //~^ ERROR type `priv_parent_substs::Priv` is private + pub type InSignatureTy2 = Box>; + //~^ ERROR type `priv_parent_substs::Priv` is private + trait InSignatureTr1: PubTrWithParam {} + //~^ ERROR type `priv_parent_substs::Priv` is private + trait InSignatureTr2: PubTr {} + //~^ ERROR type `priv_parent_substs::Priv` is private + } +} +fn priv_parent_substs() { + priv_parent_substs::mac!(); +} + +fn main() {} diff --git a/src/test/compile-fail/private-in-public-assoc-ty.rs b/src/test/compile-fail/private-in-public-assoc-ty.rs new file mode 100644 index 0000000000..59dee25664 --- /dev/null +++ b/src/test/compile-fail/private-in-public-assoc-ty.rs @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Private types and traits are not allowed in interfaces of associated types. +// This test also ensures that the checks are performed even inside private modules. + +#![feature(associated_type_defaults)] + +mod m { + struct Priv; + trait PrivTr {} + impl PrivTr for Priv {} + pub trait PubTrAux1 {} + pub trait PubTrAux2 { type A; } + + // "Private-in-public in associated types is hard error" in RFC 2145 + // applies only to the aliased types, not bounds. + pub trait PubTr { + //~^ WARN private trait `m::PrivTr` in public interface + //~| WARN this was previously accepted + //~| WARN private type `m::Priv` in public interface + //~| WARN this was previously accepted + type Alias1: PrivTr; + type Alias2: PubTrAux1 = u8; + type Alias3: PubTrAux2 = u8; + + type Alias4 = Priv; + //~^ ERROR private type `m::Priv` in public interface + } + impl PubTr for u8 { + type Alias1 = Priv; + //~^ ERROR private type `m::Priv` in public interface + } +} + +fn main() {} diff --git a/src/test/compile-fail/private-in-public-ill-formed.rs b/src/test/compile-fail/private-in-public-ill-formed.rs new file mode 100644 index 0000000000..4e10614bf6 --- /dev/null +++ b/src/test/compile-fail/private-in-public-ill-formed.rs @@ -0,0 +1,45 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod aliases_pub { + struct Priv; + mod m { + pub struct Pub3; + } + + trait PrivTr { + type AssocAlias; + } + impl PrivTr for Priv { + type AssocAlias = m::Pub3; + } + + impl (::AssocAlias) { //~ ERROR no base type found for inherent implementation + pub fn f(arg: Priv) {} // private type `aliases_pub::Priv` in public interface + } +} + +mod aliases_priv { + struct Priv; + struct Priv3; + + trait PrivTr { + type AssocAlias; + } + impl PrivTr for Priv { + type AssocAlias = Priv3; + } + + impl (::AssocAlias) { //~ ERROR no base type found for inherent implementation + pub fn f(arg: Priv) {} // OK + } +} + +fn main() {} diff --git a/src/test/compile-fail/private-in-public-warn.rs b/src/test/compile-fail/private-in-public-warn.rs index f030012b17..dfcf4dc01b 100644 --- a/src/test/compile-fail/private-in-public-warn.rs +++ b/src/test/compile-fail/private-in-public-warn.rs @@ -13,7 +13,6 @@ #![feature(associated_type_defaults)] #![deny(private_in_public)] -#![allow(unused)] #![allow(improper_ctypes)] mod types { @@ -35,7 +34,6 @@ mod types { const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface //~^ WARNING hard error type Alias = Priv; //~ ERROR private type `types::Priv` in public interface - //~^ WARNING hard error fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface //~^ WARNING hard error fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface @@ -51,7 +49,6 @@ mod types { } impl PubTr for Pub { type Alias = Priv; //~ ERROR private type `types::Priv` in public interface - //~^ WARNING hard error } } @@ -146,7 +143,6 @@ mod impls { } impl PubTr for Pub { type Alias = Priv; //~ ERROR private type `impls::Priv` in public interface - //~^ WARNING hard error } } @@ -220,21 +216,14 @@ mod aliases_pub { pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface //~^ WARNING hard error } - // This doesn't even parse - // impl ::AssocAlias { - // pub fn f(arg: Priv) {} // ERROR private type `aliases_pub::Priv` in public interface - // } impl PrivUseAliasTr for PrivUseAlias { type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface - //~^ WARNING hard error } impl PrivUseAliasTr for PrivAlias { type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface - //~^ WARNING hard error } impl PrivUseAliasTr for ::AssocAlias { type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface - //~^ WARNING hard error } } @@ -273,10 +262,6 @@ mod aliases_priv { impl PrivAlias { pub fn f(arg: Priv) {} // OK } - // This doesn't even parse - // impl ::AssocAlias { - // pub fn f(arg: Priv) {} // OK - // } impl PrivUseAliasTr for PrivUseAlias { type Check = Priv; // OK } diff --git a/src/test/compile-fail/private-inferred-type-3.rs b/src/test/compile-fail/private-inferred-type-3.rs index c0ba38b240..0c393f0232 100644 --- a/src/test/compile-fail/private-inferred-type-3.rs +++ b/src/test/compile-fail/private-inferred-type-3.rs @@ -11,6 +11,7 @@ // aux-build:private-inferred-type.rs // error-pattern:type `fn() {ext::priv_fn}` is private +// error-pattern:static `PRIV_STATIC` is private // error-pattern:type `ext::PrivEnum` is private // error-pattern:type `fn() {::method}` is private // error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct::{{constructor}}}` is pr diff --git a/src/test/compile-fail/private-inferred-type.rs b/src/test/compile-fail/private-inferred-type.rs index 95e3732d61..351dc6b776 100644 --- a/src/test/compile-fail/private-inferred-type.rs +++ b/src/test/compile-fail/private-inferred-type.rs @@ -11,10 +11,11 @@ #![feature(associated_consts)] #![feature(conservative_impl_trait)] #![feature(decl_macro)] -#![allow(warnings)] +#![allow(private_in_public)] mod m { fn priv_fn() {} + static PRIV_STATIC: u8 = 0; enum PrivEnum { Variant } pub enum PubEnum { Variant } trait PrivTrait { fn method() {} } @@ -47,6 +48,7 @@ mod m { pub macro m() { priv_fn; //~ ERROR type `fn() {m::priv_fn}` is private + PRIV_STATIC; // OK, not cross-crate PrivEnum::Variant; //~ ERROR type `m::PrivEnum` is private PubEnum::Variant; // OK ::method; //~ ERROR type `fn() {::method}` is private @@ -68,6 +70,7 @@ mod m { impl TraitWithTyParam for u8 {} impl TraitWithTyParam2 for u8 {} impl TraitWithAssocTy for u8 { type AssocTy = Priv; } + //~^ ERROR private type `m::Priv` in public interface pub fn leak_anon1() -> impl Trait + 'static { 0 } pub fn leak_anon2() -> impl TraitWithTyParam { 0 } @@ -88,7 +91,7 @@ mod adjust { pub struct S3; impl Deref for S1 { - type Target = S2Alias; + type Target = S2Alias; //~ ERROR private type `adjust::S2` in public interface fn deref(&self) -> &Self::Target { loop {} } } impl Deref for S2 { diff --git a/src/test/compile-fail/private-variant-reexport.rs b/src/test/compile-fail/private-variant-reexport.rs index c77a7532e3..1280aba307 100644 --- a/src/test/compile-fail/private-variant-reexport.rs +++ b/src/test/compile-fail/private-variant-reexport.rs @@ -9,19 +9,19 @@ // except according to those terms. mod m1 { - pub use ::E::V; //~ ERROR variant `V` is private, and cannot be reexported + pub use ::E::V; //~ ERROR variant `V` is private and cannot be reexported } mod m2 { - pub use ::E::{V}; //~ ERROR variant `V` is private, and cannot be reexported + pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be reexported } mod m3 { - pub use ::E::V::{self}; //~ ERROR variant `V` is private, and cannot be reexported + pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be reexported } mod m4 { - pub use ::E::*; //~ ERROR variant `V` is private, and cannot be reexported + pub use ::E::*; //~ ERROR enum is private and its variants cannot be reexported } enum E { V } diff --git a/src/test/compile-fail/quote-with-interpolated.rs b/src/test/compile-fail/quote-with-interpolated.rs new file mode 100644 index 0000000000..1fafb1c7a1 --- /dev/null +++ b/src/test/compile-fail/quote-with-interpolated.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(quote)] +fn main() { + macro_rules! foo { + ($bar:expr) => { + quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token + } + } + foo!(bar); +} diff --git a/src/test/compile-fail/range_inclusive_gate.rs b/src/test/compile-fail/range_inclusive_gate.rs index 69b9a4c67a..5b063dc113 100644 --- a/src/test/compile-fail/range_inclusive_gate.rs +++ b/src/test/compile-fail/range_inclusive_gate.rs @@ -19,5 +19,3 @@ pub fn main() { //~| ERROR core_intrinsics //~| ERROR core_intrinsics } - - diff --git a/src/test/compile-fail/region-borrow-params-issue-29793-big.rs b/src/test/compile-fail/region-borrow-params-issue-29793-big.rs index 887f7836ee..642e90f6de 100644 --- a/src/test/compile-fail/region-borrow-params-issue-29793-big.rs +++ b/src/test/compile-fail/region-borrow-params-issue-29793-big.rs @@ -16,6 +16,10 @@ // behavior (because the improperly accepted closure was actually // able to be invoked). +// ignore-tidy-linelength +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + struct WrapA(Option); impl WrapA { @@ -75,8 +79,10 @@ impl WrapA fn main() { let mut w = WrapA::new().set(|x: usize, y: usize| { WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) - //~^ ERROR `x` does not live long enough - //~| ERROR `y` does not live long enough + //[ast]~^ ERROR `x` does not live long enough + //[ast]~| ERROR `y` does not live long enough + //[mir]~^^^ ERROR `x` does not live long enough + //[mir]~| ERROR `y` does not live long enough }); w.handle(); // This works diff --git a/src/test/compile-fail/regions-normalize-in-where-clause-list.rs b/src/test/compile-fail/regions-normalize-in-where-clause-list.rs new file mode 100644 index 0000000000..68642598ed --- /dev/null +++ b/src/test/compile-fail/regions-normalize-in-where-clause-list.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we are able to normalize in the list of where-clauses, +// even if `'a: 'b` is required. + +trait Project<'a, 'b> { + type Item; +} + +impl<'a, 'b> Project<'a, 'b> for () + where 'a: 'b +{ + type Item = (); +} + +// No error here, we have 'a: 'b. We used to report an error here +// though, see https://github.com/rust-lang/rust/issues/45937. +fn foo<'a: 'b, 'b>() + where <() as Project<'a, 'b>>::Item : Eq +{ +} + +// Here we get an error: we need `'a: 'b`. +fn bar<'a, 'b>() //~ ERROR cannot infer + where <() as Project<'a, 'b>>::Item : Eq +{ +} + +fn main() { } diff --git a/src/test/compile-fail/regions-pattern-typing-issue-19997.rs b/src/test/compile-fail/regions-pattern-typing-issue-19997.rs index 91f5f048bc..6fbc65ce6a 100644 --- a/src/test/compile-fail/regions-pattern-typing-issue-19997.rs +++ b/src/test/compile-fail/regions-pattern-typing-issue-19997.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir fn main() { let a0 = 0; @@ -18,8 +18,7 @@ fn main() { match (&a1,) { (&ref b0,) => { a1 = &f; //[ast]~ ERROR cannot assign - //[mir]~^ ERROR cannot assign to `a1` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `a1` because it is borrowed (Mir) + //[mir]~^ ERROR cannot assign to `a1` because it is borrowed } } } diff --git a/src/test/compile-fail/regions-static-bound.rs b/src/test/compile-fail/regions-static-bound.rs index de695e72d0..a217cc9ebf 100644 --- a/src/test/compile-fail/regions-static-bound.rs +++ b/src/test/compile-fail/regions-static-bound.rs @@ -8,17 +8,26 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ll nll +//[nll] compile-flags: -Znll -Zborrowck=mir + fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () where 'a: 'b, 'b: 'static { t } fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { - t //~ ERROR E0312 + t //[ll]~ ERROR E0312 + //[nll]~^ WARNING not reporting region error due to -Znll + //[nll]~| ERROR free region `'a` does not outlive free region `'static` } fn error(u: &(), v: &()) { - static_id(&u); //~ ERROR cannot infer an appropriate lifetime - static_id_indirect(&v); //~ ERROR cannot infer an appropriate lifetime + static_id(&u); //[ll]~ ERROR cannot infer an appropriate lifetime + //[nll]~^ WARNING not reporting region error due to -Znll + //[nll]~| ERROR free region `` does not outlive free region `'static` + static_id_indirect(&v); //[ll]~ ERROR cannot infer an appropriate lifetime + //[nll]~^ WARNING not reporting region error due to -Znll + //[nll]~| ERROR free region `` does not outlive free region `'static` } fn main() {} diff --git a/src/test/compile-fail/regions-struct-not-wf.rs b/src/test/compile-fail/regions-struct-not-wf.rs index a7f1828970..9106f1f0ba 100644 --- a/src/test/compile-fail/regions-struct-not-wf.rs +++ b/src/test/compile-fail/regions-struct-not-wf.rs @@ -10,11 +10,15 @@ // Various examples of structs whose fields are not well-formed. +// revisions:lexical nll + #![allow(dead_code)] +#![cfg_attr(nll, feature(nll))] struct Ref<'a, T> { field: &'a T - //~^ ERROR the parameter type `T` may not live long enough + //[lexical]~^ ERROR the parameter type `T` may not live long enough + //[nll]~^^ ERROR the parameter type `T` may not live long enough } struct RefOk<'a, T:'a> { @@ -23,12 +27,14 @@ struct RefOk<'a, T:'a> { struct RefIndirect<'a, T> { field: RefOk<'a, T> - //~^ ERROR the parameter type `T` may not live long enough + //[lexical]~^ ERROR the parameter type `T` may not live long enough + //[nll]~^^ ERROR the parameter type `T` may not live long enough } struct DoubleRef<'a, 'b, T> { field: &'a &'b T - //~^ ERROR reference has a longer lifetime than the data it references + //[lexical]~^ ERROR reference has a longer lifetime than the data it references + //[nll]~^^ ERROR reference has a longer lifetime than the data it references } fn main() { } diff --git a/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs b/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs new file mode 100644 index 0000000000..75c2a5f5bc --- /dev/null +++ b/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(crate_in_paths)] + +struct S; + +mod m { + fn f() { + let s = crate::S; //~ ERROR `crate` can only be used in absolute paths + } +} + +fn main() {} diff --git a/src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs b/src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs new file mode 100644 index 0000000000..8c5a971c2f --- /dev/null +++ b/src/test/compile-fail/rfc-2126-crate-paths/crate-visibility-ambiguity.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(crate_in_paths)] +#![feature(crate_visibility_modifier)] + +mod m { + pub struct Z; + pub struct S1(crate (::m::Z)); // OK + pub struct S2(::crate ::m::Z); // OK + pub struct S3(crate ::m::Z); //~ ERROR `crate` can only be used in absolute paths +} + +fn main() { + crate struct S; // OK (item in statement position) +} diff --git a/src/tools/miri/tests/run-pass/try-operator-custom.rs b/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs similarity index 82% rename from src/tools/miri/tests/run-pass/try-operator-custom.rs rename to src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs index 3b447f36ec..2c94f7b0f5 100644 --- a/src/tools/miri/tests/run-pass/try-operator-custom.rs +++ b/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(crate_in_paths)] + fn main() { - assert!(Ok::(42) == Ok(42)); + let crate = 0; //~ ERROR `crate` can only be used in absolute paths } diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs new file mode 100644 index 0000000000..c3da4a5187 --- /dev/null +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[derive(Debug)] +pub struct S; + +#[derive(Debug)] +pub struct Z; diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs new file mode 100644 index 0000000000..14d5d9caa3 --- /dev/null +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(extern_absolute_paths)] + +use xcrate::S; //~ ERROR can't find crate for `xcrate` + +fn main() {} diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs new file mode 100644 index 0000000000..defd103f9e --- /dev/null +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(extern_absolute_paths)] + +fn main() { + let s = ::xcrate::S; //~ ERROR can't find crate for `xcrate` +} diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs new file mode 100644 index 0000000000..be1708e2b5 --- /dev/null +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(extern_absolute_paths)] + +use ycrate; //~ ERROR can't find crate for `ycrate` + +fn main() {} diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs new file mode 100644 index 0000000000..e44465750d --- /dev/null +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:xcrate.rs + +#![feature(crate_in_paths)] +#![feature(extern_absolute_paths)] + +use crate; //~ ERROR unresolved import `crate` + //~^ NOTE crate root imports need to be explicitly named: `use crate as name;` +use *; //~ ERROR unresolved import `*` + //~^ NOTE cannot glob-import all possible crates + +fn main() { + let s = ::xcrate; //~ ERROR expected value, found module `xcrate` + //~^ NOTE not a value +} diff --git a/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs b/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs index f52b128e7e..c6d744fa64 100644 --- a/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs +++ b/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs @@ -8,12 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc)] - -extern crate libc; - extern { - static mut a: libc::c_int; + static mut a: i32; } fn main() { diff --git a/src/test/compile-fail/static-mut-not-constant.rs b/src/test/compile-fail/static-mut-not-constant.rs index 5cc3384f55..7e6ced12fe 100644 --- a/src/test/compile-fail/static-mut-not-constant.rs +++ b/src/test/compile-fail/static-mut-not-constant.rs @@ -12,6 +12,5 @@ static mut a: Box = box 3; //~^ ERROR allocations are not allowed in statics -//~| WARN: constant evaluation error fn main() {} diff --git a/src/test/compile-fail/super-at-top-level.rs b/src/test/compile-fail/super-at-top-level.rs index 4db673e200..c607711c44 100644 --- a/src/test/compile-fail/super-at-top-level.rs +++ b/src/test/compile-fail/super-at-top-level.rs @@ -8,8 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use super::f; //~ ERROR unresolved import `super` [E0432] - //~^ There are too many initial `super`s. +use super::f; //~ ERROR There are too many initial `super`s fn main() { } diff --git a/src/test/compile-fail/termination-trait-not-satisfied.rs b/src/test/compile-fail/termination-trait-not-satisfied.rs new file mode 100644 index 0000000000..788c38c55b --- /dev/null +++ b/src/test/compile-fail/termination-trait-not-satisfied.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +struct ReturnType {} + +fn main() -> ReturnType { //~ ERROR `ReturnType: std::Termination` is not satisfied + ReturnType {} +} diff --git a/src/test/compile-fail/trait-alias.rs b/src/test/compile-fail/trait-alias.rs new file mode 100644 index 0000000000..7aca227a76 --- /dev/null +++ b/src/test/compile-fail/trait-alias.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// gate-test-trait_alias + +trait Alias1 = Default where T: Clone; // ok + //~^ERROR trait aliases are not yet fully implemented +trait Alias2 = Default; + //~^ERROR type parameters on the left side of a trait alias cannot be bounded + //~^^ERROR type parameters on the left side of a trait alias cannot have defaults + //~^^^ERROR trait aliases are not yet fully implemented + +impl Alias1 { //~ERROR expected type, found trait alias +} + +impl Alias1 for () { //~ERROR expected trait, found trait alias +} + +fn main() {} + diff --git a/src/test/compile-fail/trait-duplicate-methods.rs b/src/test/compile-fail/trait-duplicate-methods.rs deleted file mode 100644 index b8e628dd47..0000000000 --- a/src/test/compile-fail/trait-duplicate-methods.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait Foo { - fn orange(&self); //~ NOTE previous definition of the value `orange` here - fn orange(&self); //~ ERROR the name `orange` is defined multiple times - //~| NOTE `orange` redefined here -//~| NOTE `orange` must be defined only once in the value namespace of this trait -} - -fn main() {} diff --git a/src/test/compile-fail/trait-item-privacy.rs b/src/test/compile-fail/trait-item-privacy.rs index b8d83e5adf..be0f7dd4e1 100644 --- a/src/test/compile-fail/trait-item-privacy.rs +++ b/src/test/compile-fail/trait-item-privacy.rs @@ -131,6 +131,16 @@ fn check_assoc_ty() { let _: T::A; //~ ERROR associated type `A` is private let _: T::B; // OK let _: T::C; // OK + + // Associated types, bindings + let _: assoc_ty::B< + B = u8, // OK + >; + let _: C< + A = u8, //~ ERROR associated type `A` is private + B = u8, // OK + C = u8, // OK + >; } fn main() {} diff --git a/src/test/compile-fail/trait-suggest-where-clause.rs b/src/test/compile-fail/trait-suggest-where-clause.rs deleted file mode 100644 index 2c38d8d2e2..0000000000 --- a/src/test/compile-fail/trait-suggest-where-clause.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::mem; - -struct Misc(T); - -fn check() { - // suggest a where-clause, if needed - mem::size_of::(); - //~^ ERROR `U: std::marker::Sized` is not satisfied - //~| HELP consider adding a `where U: std::marker::Sized` bound - //~| NOTE required by `std::mem::size_of` - //~| NOTE `U` does not have a constant size known at compile-time - //~| HELP the trait `std::marker::Sized` is not implemented for `U` - - mem::size_of::>(); - //~^ ERROR `U: std::marker::Sized` is not satisfied - //~| HELP consider adding a `where U: std::marker::Sized` bound - //~| NOTE required because it appears within the type `Misc` - //~| NOTE required by `std::mem::size_of` - //~| NOTE `U` does not have a constant size known at compile-time - //~| HELP within `Misc`, the trait `std::marker::Sized` is not implemented for `U` - - // ... even if T occurs as a type parameter - - >::from; - //~^ ERROR `u64: std::convert::From` is not satisfied - //~| HELP consider adding a `where u64: std::convert::From` bound - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From` is not implemented for `u64` - - ::Item>>::from; - //~^ ERROR `u64: std::convert::From<::Item>` is not satisfied - //~| HELP consider adding a `where u64: - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From<::Item>` is not implemented - - // ... but not if there are inference variables - - as From>::from; - //~^ ERROR `Misc<_>: std::convert::From` is not satisfied - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From` is not implemented for `Misc<_>` - - // ... and also not if the error is not related to the type - - mem::size_of::<[T]>(); - //~^ ERROR `[T]: std::marker::Sized` is not satisfied - //~| NOTE `[T]` does not have a constant size - //~| NOTE required by `std::mem::size_of` - //~| HELP the trait `std::marker::Sized` is not implemented for `[T]` - - mem::size_of::<[&U]>(); - //~^ ERROR `[&U]: std::marker::Sized` is not satisfied - //~| NOTE `[&U]` does not have a constant size - //~| NOTE required by `std::mem::size_of` - //~| HELP the trait `std::marker::Sized` is not implemented for `[&U]` -} - -fn main() { -} diff --git a/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs b/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs index 432c7fa5d1..0dbd61413e 100644 --- a/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs +++ b/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + // Test that a by-ref `FnMut` closure gets an error when it tries to // mutate a value. @@ -19,6 +22,7 @@ fn main() { let mut counter = 0; call(|| { counter += 1; - //~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure + //[ast]~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure + //[mir]~^^ ERROR cannot assign to immutable item `counter` }); } diff --git a/src/test/compile-fail/unsupported-cast.rs b/src/test/compile-fail/unsupported-cast.rs index 8b63dd5172..5137663a26 100644 --- a/src/test/compile-fail/unsupported-cast.rs +++ b/src/test/compile-fail/unsupported-cast.rs @@ -10,10 +10,8 @@ // error-pattern:casting -#![feature(libc)] - -extern crate libc; +struct A; fn main() { - println!("{:?}", 1.0 as *const libc::FILE); // Can't cast float to foreign. + println!("{:?}", 1.0 as *const A); // Can't cast float to foreign. } diff --git a/src/test/compile-fail/use-super-global-path.rs b/src/test/compile-fail/use-super-global-path.rs index 4162e037cf..fc1a72f6f2 100644 --- a/src/test/compile-fail/use-super-global-path.rs +++ b/src/test/compile-fail/use-super-global-path.rs @@ -18,7 +18,7 @@ mod foo { pub fn g() { use ::super::main; //~ ERROR global paths cannot start with `super` - main(); + main(); //~ ERROR cannot find function `main` in this scope } } diff --git a/src/test/compile-fail/useless_comment.rs b/src/test/compile-fail/useless_comment.rs index a1172bb214..90eb66728f 100644 --- a/src/test/compile-fail/useless_comment.rs +++ b/src/test/compile-fail/useless_comment.rs @@ -27,4 +27,4 @@ fn foo() { fn main() { foo(); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/weak-lang-item.rs b/src/test/compile-fail/weak-lang-item.rs index 8eac959fc1..8579611b93 100644 --- a/src/test/compile-fail/weak-lang-item.rs +++ b/src/test/compile-fail/weak-lang-item.rs @@ -11,6 +11,7 @@ // aux-build:weak-lang-items.rs // error-pattern: language item required, but not found: `panic_fmt` // error-pattern: language item required, but not found: `eh_personality` +// ignore-wasm32-bare compiled with panic=abort, personality not required #![no_std] diff --git a/src/test/compile-fail/where-lifetime-resolution.rs b/src/test/compile-fail/where-lifetime-resolution.rs index f4c6842206..1204cc0df4 100644 --- a/src/test/compile-fail/where-lifetime-resolution.rs +++ b/src/test/compile-fail/where-lifetime-resolution.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Trait1 {} -trait Trait2 {} +trait Trait1<'a> {} +trait Trait2<'a, 'b> {} fn f() where for<'a> Trait1<'a>: Trait1<'a>, // OK diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs index 7a24510b7d..8fc910d8a6 100644 --- a/src/test/debuginfo/constant-debug-locs.rs +++ b/src/test/debuginfo/constant-debug-locs.rs @@ -15,7 +15,6 @@ #![allow(dead_code, unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] -#![feature(const_unsafe_cell_new)] #![feature(static_mutex)] // This test makes sure that the compiler doesn't crash when trying to assign diff --git a/src/test/debuginfo/shadowed-variable.rs b/src/test/debuginfo/shadowed-variable.rs index 4883853f72..bf47ebe5aa 100644 --- a/src/test/debuginfo/shadowed-variable.rs +++ b/src/test/debuginfo/shadowed-variable.rs @@ -34,6 +34,17 @@ // gdb-check:$6 = 20 // gdb-command:continue +// gdb-command:print x +// gdb-check:$5 = 10.5 +// gdb-command:print y +// gdb-check:$6 = 20 +// gdb-command:continue + +// gdb-command:print x +// gdb-check:$5 = 11.5 +// gdb-command:print y +// gdb-check:$6 = 20 +// gdb-command:continue // === LLDB TESTS ================================================================================== @@ -57,6 +68,18 @@ // lldb-check:[...]$5 = 20 // lldb-command:continue +// lldb-command:print x +// lldb-check:[...]$4 = 10.5 +// lldb-command:print y +// lldb-check:[...]$5 = 20 +// lldb-command:continue + +// lldb-command:print x +// lldb-check:[...]$4 = 11.5 +// lldb-command:print y +// lldb-check:[...]$5 = 20 +// lldb-command:continue + #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -77,6 +100,15 @@ fn main() { zzz(); // #break sentinel(); + + let x = { + zzz(); // #break + sentinel(); + 11.5 + }; + + zzz(); // #break + sentinel() } fn zzz() {()} diff --git a/src/tools/miri/tests/run-pass/issue-26709.rs b/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs similarity index 50% rename from src/tools/miri/tests/run-pass/issue-26709.rs rename to src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs index 62626d7586..e9f9ba86f2 100644 --- a/src/tools/miri/tests/run-pass/issue-26709.rs +++ b/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs @@ -1,4 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,19 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Wrapper<'a, T: ?Sized>(&'a mut i32, T); +// no-prefer-dynamic -impl<'a, T: ?Sized> Drop for Wrapper<'a, T> { - fn drop(&mut self) { - *self.0 = 432; - } -} +#![crate_type = "proc-macro"] -fn main() { - let mut x = 0; +extern crate proc_macro; + +use proc_macro::TokenStream; + +// Add a function to shift DefIndex of registrar function +#[cfg(cfail2)] +fn foo() {} + +#[proc_macro_derive(IncrementalMacro)] +pub fn derive(input: TokenStream) -> TokenStream { + #[cfg(cfail2)] { - let wrapper = Box::new(Wrapper(&mut x, 123)); - let _: Box> = wrapper; + foo(); } - assert_eq!(432, x) + + "".parse().unwrap() } diff --git a/src/test/incremental-fulldeps/incremental_proc_macro.rs b/src/test/incremental-fulldeps/incremental_proc_macro.rs new file mode 100644 index 0000000000..e434507085 --- /dev/null +++ b/src/test/incremental-fulldeps/incremental_proc_macro.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:incremental_proc_macro_aux.rs +// ignore-stage1 +// revisions: cfail1 cfail2 +// must-compile-successfully + +// This test makes sure that we still find the proc-macro registrar function +// when we compile proc-macros incrementally (see #47292). + +#![crate_type = "rlib"] + +#[macro_use] +extern crate incremental_proc_macro_aux; + +#[derive(IncrementalMacro)] +pub struct Foo { + x: u32 +} diff --git a/src/test/incremental/change_crate_dep_kind.rs b/src/test/incremental/change_crate_dep_kind.rs new file mode 100644 index 0000000000..0dc5dbd38f --- /dev/null +++ b/src/test/incremental/change_crate_dep_kind.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we detect changes to the `dep_kind` query. If the change is not +// detected then -Zincremental-verify-ich will trigger an assertion. + +// revisions:cfail1 cfail2 +// compile-flags: -Z query-dep-graph -Cpanic=unwind +// must-compile-successfully + +#![feature(panic_unwind)] + +// Turn the panic_unwind crate from an explicit into an implicit query: +#[cfg(cfail1)] +extern crate panic_unwind; + +fn main() {} diff --git a/src/test/incremental/hashes/call_expressions.rs b/src/test/incremental/hashes/call_expressions.rs index b49609cbd1..da8a62a976 100644 --- a/src/test/incremental/hashes/call_expressions.rs +++ b/src/test/incremental/hashes/call_expressions.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -38,8 +38,6 @@ pub fn change_callee_function() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_callee_function() { callee2(1, 2) } @@ -55,8 +53,6 @@ pub fn change_argument_function() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_argument_function() { callee1(1, 3) } @@ -74,8 +70,8 @@ mod change_callee_indirectly_function { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] + + pub fn change_callee_indirectly_function() { callee(1, 2) } @@ -98,8 +94,6 @@ pub fn change_callee_method() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_callee_method() { let s = Struct; s.method2('x', true); @@ -117,8 +111,6 @@ pub fn change_argument_method() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_argument_method() { let s = Struct; s.method1('y', true); @@ -136,8 +128,6 @@ pub fn change_ufcs_callee_method() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_ufcs_callee_method() { let s = Struct; Struct::method2(&s, 'x', true); @@ -155,8 +145,6 @@ pub fn change_argument_method_ufcs() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_argument_method_ufcs() { let s = Struct; Struct::method1(&s, 'x', false); @@ -174,8 +162,6 @@ pub fn change_to_ufcs() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] // One might think this would be expanded in the HirBody/Mir, but it actually // results in slightly different Hir/Mir. pub fn change_to_ufcs() { @@ -198,8 +184,8 @@ pub mod change_ufcs_callee_indirectly { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] + + pub fn change_ufcs_callee_indirectly() { let s = Struct; Struct::method1(&s, 'q', false) diff --git a/src/test/incremental/hashes/closure_expressions.rs b/src/test/incremental/hashes/closure_expressions.rs index 38fe5cdffe..d8a87da591 100644 --- a/src/test/incremental/hashes/closure_expressions.rs +++ b/src/test/incremental/hashes/closure_expressions.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -27,18 +27,14 @@ // Change closure body --------------------------------------------------------- #[cfg(cfail1)] -fn change_closure_body() { +pub fn change_closure_body() { let _ = || 1u32; } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_closure_body() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn change_closure_body() { let _ = || 3u32; } @@ -46,19 +42,15 @@ fn change_closure_body() { // Add parameter --------------------------------------------------------------- #[cfg(cfail1)] -fn add_parameter() { +pub fn add_parameter() { let x = 0u32; let _ = || x + 1; } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_parameter() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn add_parameter() { let x = 0u32; let _ = |x: u32| x + 1; } @@ -67,18 +59,14 @@ fn add_parameter() { // Change parameter pattern ---------------------------------------------------- #[cfg(cfail1)] -fn change_parameter_pattern() { +pub fn change_parameter_pattern() { let _ = |x: &u32| x; } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_parameter_pattern() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_parameter_pattern() { let _ = |&x: &u32| x; } @@ -86,18 +74,14 @@ fn change_parameter_pattern() { // Add `move` to closure ------------------------------------------------------- #[cfg(cfail1)] -fn add_move() { +pub fn add_move() { let _ = || 1; } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_move() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_move() { let _ = move || 1; } @@ -105,19 +89,15 @@ fn add_move() { // Add type ascription to parameter -------------------------------------------- #[cfg(cfail1)] -fn add_type_ascription_to_parameter() { +pub fn add_type_ascription_to_parameter() { let closure = |x| x + 1u32; let _: u32 = closure(1); } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_type_ascription_to_parameter() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_type_ascription_to_parameter() { let closure = |x: u32| x + 1u32; let _: u32 = closure(1); } @@ -126,19 +106,15 @@ fn add_type_ascription_to_parameter() { // Change parameter type ------------------------------------------------------- #[cfg(cfail1)] -fn change_parameter_type() { +pub fn change_parameter_type() { let closure = |x: u32| (x as u64) + 1; let _ = closure(1); } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_parameter_type() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_parameter_type() { let closure = |x: u16| (x as u64) + 1; let _ = closure(1); } diff --git a/src/test/incremental/hashes/consts.rs b/src/test/incremental/hashes/consts.rs index 65acfb82da..47f5a2d2bb 100644 --- a/src/test/incremental/hashes/consts.rs +++ b/src/test/incremental/hashes/consts.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -32,8 +32,6 @@ const CONST_VISIBILITY: u8 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub const CONST_VISIBILITY: u8 = 0; @@ -44,8 +42,6 @@ const CONST_CHANGE_TYPE_1: i32 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_TYPE_1: u32 = 0; @@ -56,15 +52,12 @@ const CONST_CHANGE_TYPE_2: Option = None; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_TYPE_2: Option = None; // Change value between simple literals --------------------------------------- #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_VALUE_1: i16 = { #[cfg(cfail1)] { 1 } @@ -77,8 +70,6 @@ const CONST_CHANGE_VALUE_1: i16 = { // Change value between expressions ------------------------------------------- #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_VALUE_2: i16 = { #[cfg(cfail1)] { 1 + 1 } @@ -89,8 +80,6 @@ const CONST_CHANGE_VALUE_2: i16 = { #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_VALUE_3: i16 = { #[cfg(cfail1)] { 2 + 3 } @@ -101,8 +90,6 @@ const CONST_CHANGE_VALUE_3: i16 = { #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_VALUE_4: i16 = { #[cfg(cfail1)] { 1 + 2 * 3 } @@ -125,13 +112,9 @@ mod const_change_type_indirectly { #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_TYPE_INDIRECTLY_1: Type = Type; #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] const CONST_CHANGE_TYPE_INDIRECTLY_2: Option = None; } diff --git a/src/test/incremental/hashes/enum_constructors.rs b/src/test/incremental/hashes/enum_constructors.rs index e38fd58d7d..541261f1d8 100644 --- a/src/test/incremental/hashes/enum_constructors.rs +++ b/src/test/incremental/hashes/enum_constructors.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -47,8 +47,6 @@ pub fn change_field_value_struct_like() -> Enum { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_field_value_struct_like() -> Enum { Enum::Struct { x: 0, @@ -72,8 +70,6 @@ pub fn change_field_order_struct_like() -> Enum { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it // would if it were not all constants pub fn change_field_order_struct_like() -> Enum { @@ -113,8 +109,6 @@ pub fn change_constructor_path_struct_like() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_path_struct_like() { let _ = Enum2::Struct { x: 0, @@ -138,8 +132,6 @@ pub fn change_constructor_variant_struct_like() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_variant_struct_like() { let _ = Enum2::Struct2 { x: 0, @@ -162,8 +154,6 @@ pub mod change_constructor_path_indirectly_struct_like { TypeckTables" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> TheEnum { TheEnum::Struct { x: 0, @@ -184,8 +174,6 @@ pub mod change_constructor_variant_indirectly_struct_like { #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> Enum2 { Variant { x: 0, @@ -205,8 +193,6 @@ pub fn change_field_value_tuple_like() -> Enum { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_field_value_tuple_like() -> Enum { Enum::Tuple(0, 1, 3) } @@ -225,8 +211,6 @@ pub fn change_constructor_path_tuple_like() { except="HirBody,MirOptimized,MirValidated,TypeckTables" )] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_path_tuple_like() { let _ = Enum2::Tuple(0, 1, 2); } @@ -245,8 +229,6 @@ pub fn change_constructor_variant_tuple_like() { except="HirBody,MirOptimized,MirValidated,TypeckTables" )] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_variant_tuple_like() { let _ = Enum2::Tuple2(0, 1, 2); } @@ -265,8 +247,6 @@ pub mod change_constructor_path_indirectly_tuple_like { TypeckTables" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> TheEnum { TheEnum::Tuple(0, 1, 2) } @@ -284,8 +264,6 @@ pub mod change_constructor_variant_indirectly_tuple_like { #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> Enum2 { Variant(0, 1, 2) } @@ -313,7 +291,6 @@ pub fn change_constructor_path_c_like() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_path_c_like() { let _ = Clike2::B; } @@ -329,8 +306,6 @@ pub fn change_constructor_variant_c_like() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_variant_c_like() { let _ = Clike::C; } @@ -349,8 +324,6 @@ pub mod change_constructor_path_indirectly_c_like { TypeckTables" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> TheEnum { TheEnum::B } @@ -368,8 +341,6 @@ pub mod change_constructor_variant_indirectly_c_like { #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> Clike { Variant } diff --git a/src/test/incremental/hashes/enum_defs.rs b/src/test/incremental/hashes/enum_defs.rs index 22393fad3d..36cbd2239a 100644 --- a/src/test/incremental/hashes/enum_defs.rs +++ b/src/test/incremental/hashes/enum_defs.rs @@ -23,7 +23,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -39,11 +39,7 @@ enum EnumVisibility { A } #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub enum EnumVisibility { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] A } @@ -59,13 +55,8 @@ enum EnumChangeNameCStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeNameCStyleVariant { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant1, - #[rustc_metadata_clean(cfg="cfail3")] Variant2Changed, } @@ -81,8 +72,6 @@ enum EnumChangeNameTupleStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeNameTupleStyleVariant { Variant1, Variant2Changed(u32, f32), @@ -100,8 +89,6 @@ enum EnumChangeNameStructStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeNameStructStyleVariant { Variant1, Variant2Changed { a: u32, b: f32 }, @@ -119,16 +106,10 @@ enum EnumChangeValueCStyleVariant0 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeValueCStyleVariant0 { Variant1, - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant2 = - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] 22, } @@ -141,8 +122,6 @@ enum EnumChangeValueCStyleVariant1 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeValueCStyleVariant1 { Variant1, Variant2 = 11, @@ -159,8 +138,6 @@ enum EnumAddCStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddCStyleVariant { Variant1, Variant2, @@ -178,8 +155,6 @@ enum EnumRemoveCStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumRemoveCStyleVariant { Variant1, } @@ -195,8 +170,6 @@ enum EnumAddTupleStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddTupleStyleVariant { Variant1, Variant2(u32, f32), @@ -214,8 +187,6 @@ enum EnumRemoveTupleStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumRemoveTupleStyleVariant { Variant1, } @@ -231,8 +202,6 @@ enum EnumAddStructStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddStructStyleVariant { Variant1, Variant2 { a: u32, b: f32 }, @@ -250,8 +219,6 @@ enum EnumRemoveStructStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumRemoveStructStyleVariant { Variant1, } @@ -267,12 +234,8 @@ enum EnumChangeFieldTypeTupleStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeFieldTypeTupleStyleVariant { Variant1(u32, - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] u64), } @@ -288,14 +251,10 @@ enum EnumChangeFieldTypeStructStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeFieldTypeStructStyleVariant { Variant1, Variant2 { a: u32, - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] b: u64 }, } @@ -311,8 +270,6 @@ enum EnumChangeFieldNameStructStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeFieldNameStructStyleVariant { Variant1 { a: u32, c: u32 }, } @@ -328,15 +285,9 @@ enum EnumChangeOrderTupleStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeOrderTupleStyleVariant { Variant1( - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] u64, - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] u32), } @@ -351,8 +302,6 @@ enum EnumChangeFieldOrderStructStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeFieldOrderStructStyleVariant { Variant1 { b: f32, a: u32 }, } @@ -368,8 +317,6 @@ enum EnumAddFieldTupleStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddFieldTupleStyleVariant { Variant1(u32, u32, u32), } @@ -385,8 +332,6 @@ enum EnumAddFieldStructStyleVariant { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddFieldStructStyleVariant { Variant1 { a: u32, b: u32, c: u32 }, } @@ -403,8 +348,6 @@ enum EnumAddMustUse { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[must_use] enum EnumAddMustUse { Variant1, @@ -423,8 +366,6 @@ enum EnumAddReprC { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[repr(C)] enum EnumAddReprC { Variant1, @@ -442,8 +383,6 @@ enum EnumChangeNameOfTypeParameter { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeNameOfTypeParameter { Variant1(T), } @@ -460,8 +399,6 @@ enum EnumAddTypeParameter { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddTypeParameter { Variant1(S), Variant2(T), @@ -478,8 +415,6 @@ enum EnumChangeNameOfLifetimeParameter<'a> { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2", except="PredicatesOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumChangeNameOfLifetimeParameter<'b> { Variant1(&'b u32), } @@ -496,8 +431,6 @@ enum EnumAddLifetimeParameter<'a> { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2", except="PredicatesOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddLifetimeParameter<'a, 'b> { Variant1(&'a u32), Variant2(&'b u32), @@ -515,8 +448,6 @@ enum EnumAddLifetimeParameterBound<'a, 'b> { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2", except="GenericsOfItem,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddLifetimeParameterBound<'a, 'b: 'a> { Variant1(&'a u32), Variant2(&'b u32), @@ -532,8 +463,6 @@ enum EnumAddLifetimeBoundToParameter<'a, T> { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2", except="TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddLifetimeBoundToParameter<'a, T: 'a> { Variant1(T), Variant2(&'a u32), @@ -550,8 +479,6 @@ enum EnumAddTraitBound { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddTraitBound { Variant1(T), } @@ -568,8 +495,6 @@ enum EnumAddLifetimeParameterBoundWhere<'a, 'b> { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2", except="GenericsOfItem,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a { Variant1(&'a u32), Variant2(&'b u32), @@ -587,8 +512,6 @@ enum EnumAddLifetimeBoundToParameterWhere<'a, T> { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2", except="TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a { Variant1(T), Variant2(&'a u32), @@ -605,8 +528,6 @@ enum EnumAddTraitBoundWhere { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumAddTraitBoundWhere where T: Sync { Variant1(T), } @@ -623,21 +544,11 @@ enum EnumSwapUsageTypeParameters { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumSwapUsageTypeParameters { - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant1 { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] a: B }, - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant2 { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] a: A }, } @@ -654,21 +565,11 @@ enum EnumSwapUsageLifetimeParameters<'a, 'b> { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] enum EnumSwapUsageLifetimeParameters<'a, 'b> { - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant1 { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] a: &'b u32 }, - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant2 { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] b: &'a u32 }, } @@ -689,14 +590,8 @@ mod change_field_type_indirectly_tuple_style { #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] enum TupleStyle { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant1( - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] FieldType ) } @@ -713,14 +608,8 @@ mod change_field_type_indirectly_struct_style { #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] enum StructStyle { - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] Variant1 { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] a: FieldType } } @@ -742,8 +631,6 @@ mod change_trait_bound_indirectly { #[rustc_clean(cfg="cfail2", except="Hir,HirBody,PredicatesOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] enum Enum { Variant1(T) } @@ -760,11 +647,7 @@ mod change_trait_bound_indirectly_where { #[rustc_clean(cfg="cfail2", except="Hir,HirBody,PredicatesOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] enum Enum where T: Trait { Variant1(T) } } - - diff --git a/src/test/incremental/hashes/exported_vs_not.rs b/src/test/incremental/hashes/exported_vs_not.rs index d7aba563ed..a796c87f19 100644 --- a/src/test/incremental/hashes/exported_vs_not.rs +++ b/src/test/incremental/hashes/exported_vs_not.rs @@ -10,7 +10,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -28,8 +28,6 @@ pub fn body_not_exported_to_metadata() -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn body_not_exported_to_metadata() -> u32 { 2 } @@ -49,8 +47,6 @@ pub fn body_exported_to_metadata_because_of_inline() -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[inline] pub fn body_exported_to_metadata_because_of_inline() -> u32 { 2 @@ -71,8 +67,6 @@ pub fn body_exported_to_metadata_because_of_generic() -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[inline] pub fn body_exported_to_metadata_because_of_generic() -> u32 { 2 diff --git a/src/test/incremental/hashes/extern_mods.rs b/src/test/incremental/hashes/extern_mods.rs index ec5e088088..bcdd5661e7 100644 --- a/src/test/incremental/hashes/extern_mods.rs +++ b/src/test/incremental/hashes/extern_mods.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -36,8 +36,6 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { pub fn change_function_name2(c: i64) -> i32; } @@ -53,11 +51,7 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_parameter_name(d: i64) -> i32; } @@ -72,11 +66,7 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_parameter_type(c: i32) -> i32; } @@ -91,11 +81,7 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_return_type(c: i32) -> i8; } @@ -110,11 +96,7 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_parameter(c: i32, d: i32) -> i32; } @@ -129,11 +111,7 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_return_type(c: i32) -> i32; } @@ -148,11 +126,7 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn make_function_variadic(c: i32, ...); } @@ -167,11 +141,7 @@ extern "C" { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern "rust-call" { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_calling_convention(c: i32); } @@ -186,11 +156,7 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn make_function_public(c: i32); } @@ -205,8 +171,6 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] extern { pub fn add_function1(c: i32); pub fn add_function2(); @@ -224,8 +188,6 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[link_args = "-foo -bar -baz"] extern { pub fn change_link_args(c: i32); @@ -243,8 +205,6 @@ extern { #[cfg(not(cfail1))] #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[link(name = "bar")] extern { pub fn change_link_name(c: i32); @@ -262,11 +222,7 @@ mod indirectly_change_parameter_type { #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn indirectly_change_parameter_type(c: c_int); } } @@ -282,11 +238,7 @@ mod indirectly_change_return_type { #[rustc_dirty(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] extern { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn indirectly_change_return_type() -> c_int; } } diff --git a/src/test/incremental/hashes/for_loops.rs b/src/test/incremental/hashes/for_loops.rs index bae3c9bf59..105afd30d2 100644 --- a/src/test/incremental/hashes/for_loops.rs +++ b/src/test/incremental/hashes/for_loops.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -27,7 +27,7 @@ // Change loop body ------------------------------------------------------------ #[cfg(cfail1)] -fn change_loop_body() { +pub fn change_loop_body() { let mut _x = 0; for _ in 0..1 { _x = 1; @@ -36,13 +36,9 @@ fn change_loop_body() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_loop_body() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_loop_body() { let mut _x = 0; for _ in 0..1 { _x = 2; @@ -54,7 +50,7 @@ fn change_loop_body() { // Change iteration variable name ---------------------------------------------- #[cfg(cfail1)] -fn change_iteration_variable_name() { +pub fn change_iteration_variable_name() { let mut _x = 0; for _i in 0..1 { _x = 1; @@ -63,13 +59,9 @@ fn change_iteration_variable_name() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_iteration_variable_name() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_iteration_variable_name() { let mut _x = 0; for _a in 0..1 { _x = 1; @@ -81,7 +73,7 @@ fn change_iteration_variable_name() { // Change iteration variable pattern ------------------------------------------- #[cfg(cfail1)] -fn change_iteration_variable_pattern() { +pub fn change_iteration_variable_pattern() { let mut _x = 0; for _i in &[0, 1, 2] { _x = 1; @@ -90,13 +82,9 @@ fn change_iteration_variable_pattern() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_iteration_variable_pattern() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_iteration_variable_pattern() { let mut _x = 0; for &_i in &[0, 1, 2] { _x = 1; @@ -108,7 +96,7 @@ fn change_iteration_variable_pattern() { // Change iterable ------------------------------------------------------------- #[cfg(cfail1)] -fn change_iterable() { +pub fn change_iterable() { let mut _x = 0; for _ in &[0, 1, 2] { _x = 1; @@ -117,13 +105,9 @@ fn change_iterable() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_iterable() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_iterable() { let mut _x = 0; for _ in &[0, 1, 3] { _x = 1; @@ -135,7 +119,7 @@ fn change_iterable() { // Add break ------------------------------------------------------------------- #[cfg(cfail1)] -fn add_break() { +pub fn add_break() { let mut _x = 0; for _ in 0..1 { _x = 1; @@ -143,13 +127,9 @@ fn add_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn add_break() { let mut _x = 0; for _ in 0..1 { _x = 1; @@ -161,7 +141,7 @@ fn add_break() { // Add loop label -------------------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label() { +pub fn add_loop_label() { let mut _x = 0; for _ in 0..1 { _x = 1; @@ -170,13 +150,9 @@ fn add_loop_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label() { let mut _x = 0; 'label: for _ in 0..1 { _x = 1; @@ -188,7 +164,7 @@ fn add_loop_label() { // Add loop label to break ----------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_break() { +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: for _ in 0..1 { _x = 1; @@ -197,13 +173,9 @@ fn add_loop_label_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: for _ in 0..1 { _x = 1; @@ -215,7 +187,7 @@ fn add_loop_label_to_break() { // Change break label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_break_label() { +pub fn change_break_label() { let mut _x = 0; 'outer: for _ in 0..1 { 'inner: for _ in 0..1 { @@ -226,13 +198,9 @@ fn change_break_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_break_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_break_label() { let mut _x = 0; 'outer: for _ in 0..1 { 'inner: for _ in 0..1 { @@ -246,7 +214,7 @@ fn change_break_label() { // Add loop label to continue -------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_continue() { +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: for _ in 0..1 { _x = 1; @@ -255,13 +223,9 @@ fn add_loop_label_to_continue() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_continue() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: for _ in 0..1 { _x = 1; @@ -273,7 +237,7 @@ fn add_loop_label_to_continue() { // Change continue label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_continue_label() { +pub fn change_continue_label() { let mut _x = 0; 'outer: for _ in 0..1 { 'inner: for _ in 0..1 { @@ -284,13 +248,9 @@ fn change_continue_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_label() { let mut _x = 0; 'outer: for _ in 0..1 { 'inner: for _ in 0..1 { @@ -304,7 +264,7 @@ fn change_continue_label() { // Change continue to break ---------------------------------------------------- #[cfg(cfail1)] -fn change_continue_to_break() { +pub fn change_continue_to_break() { let mut _x = 0; for _ in 0..1 { _x = 1; @@ -313,13 +273,9 @@ fn change_continue_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_to_break() { let mut _x = 0; for _ in 0..1 { _x = 1; diff --git a/src/test/incremental/hashes/function_interfaces.rs b/src/test/incremental/hashes/function_interfaces.rs index 2fe3f0d5d1..abe0586efc 100644 --- a/src/test/incremental/hashes/function_interfaces.rs +++ b/src/test/incremental/hashes/function_interfaces.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -26,287 +26,253 @@ #![feature(intrinsics)] #![feature(linkage)] #![feature(rustc_attrs)] -#![crate_type="rlib"] +#![crate_type = "rlib"] // Add Parameter --------------------------------------------------------------- #[cfg(cfail1)] -fn add_parameter() {} +pub fn add_parameter() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_parameter(p: i32) {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, MirValidated, MirOptimized, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub fn add_parameter(p: i32) {} // Add Return Type ------------------------------------------------------------- #[cfg(cfail1)] -fn add_return_type() {} +pub fn add_return_type() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] // The type doesn't change, so metadata is the same -#[rustc_metadata_clean(cfg="cfail3")] -fn add_return_type() -> () {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")] +#[rustc_clean(cfg = "cfail3")] +pub fn add_return_type() -> () {} // Change Parameter Type ------------------------------------------------------- #[cfg(cfail1)] -fn type_of_parameter(p: i32) {} +pub fn type_of_parameter(p: i32) {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn type_of_parameter(p: i64) {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, MirValidated, MirOptimized, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub fn type_of_parameter(p: i64) {} // Change Parameter Type Reference --------------------------------------------- #[cfg(cfail1)] -fn type_of_parameter_ref(p: &i32) {} +pub fn type_of_parameter_ref(p: &i32) {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn type_of_parameter_ref(p: &mut i32) {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, MirValidated, MirOptimized, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub fn type_of_parameter_ref(p: &mut i32) {} // Change Parameter Order ------------------------------------------------------ #[cfg(cfail1)] -fn order_of_parameters(p1: i32, p2: i64) {} +pub fn order_of_parameters(p1: i32, p2: i64) {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn order_of_parameters(p2: i64, p1: i32) {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, MirValidated, MirOptimized, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub fn order_of_parameters(p2: i64, p1: i32) {} // Unsafe ---------------------------------------------------------------------- #[cfg(cfail1)] -fn make_unsafe() {} +pub fn make_unsafe() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -unsafe fn make_unsafe() {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, MirValidated, MirOptimized, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub unsafe fn make_unsafe() {} // Extern ---------------------------------------------------------------------- #[cfg(cfail1)] -fn make_extern() {} +pub fn make_extern() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -extern fn make_extern() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub extern "C" fn make_extern() {} // Extern C Extern Rust-Intrinsic ---------------------------------------------- #[cfg(cfail1)] -extern "C" fn make_intrinsic() {} +pub extern "C" fn make_intrinsic() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -extern "rust-intrinsic" fn make_intrinsic() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub extern "rust-intrinsic" fn make_intrinsic() {} // Type Parameter -------------------------------------------------------------- #[cfg(cfail1)] -fn type_parameter() {} +pub fn type_parameter() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn type_parameter() {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, GenericsOfItem, TypeOfItem, PredicatesOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn type_parameter() {} // Lifetime Parameter ---------------------------------------------------------- #[cfg(cfail1)] -fn lifetime_parameter() {} +pub fn lifetime_parameter() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -// #[rustc_metadata_dirty(cfg="cfail2")] -- Unused lifetime params don't show up in the type? -#[rustc_metadata_clean(cfg="cfail3")] -fn lifetime_parameter<'a>() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, GenericsOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn lifetime_parameter<'a>() {} // Trait Bound ----------------------------------------------------------------- #[cfg(cfail1)] -fn trait_bound() {} +pub fn trait_bound() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn trait_bound() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, PredicatesOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn trait_bound() {} // Builtin Bound --------------------------------------------------------------- #[cfg(cfail1)] -fn builtin_bound() {} +pub fn builtin_bound() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn builtin_bound() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, PredicatesOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn builtin_bound() {} // Lifetime Bound -------------------------------------------------------------- #[cfg(cfail1)] -fn lifetime_bound<'a, T>() {} +pub fn lifetime_bound<'a, T>() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn lifetime_bound<'a, T: 'a>() {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, GenericsOfItem, TypeOfItem, PredicatesOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn lifetime_bound<'a, T: 'a>() {} // Second Trait Bound ---------------------------------------------------------- #[cfg(cfail1)] -fn second_trait_bound() {} +pub fn second_trait_bound() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn second_trait_bound() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, PredicatesOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn second_trait_bound() {} // Second Builtin Bound -------------------------------------------------------- #[cfg(cfail1)] -fn second_builtin_bound() {} +pub fn second_builtin_bound() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn second_builtin_bound() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, PredicatesOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn second_builtin_bound() {} // Second Lifetime Bound ------------------------------------------------------- #[cfg(cfail1)] -fn second_lifetime_bound<'a, 'b, T: 'a>() {} +pub fn second_lifetime_bound<'a, 'b, T: 'a>() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {} +#[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, GenericsOfItem, TypeOfItem, PredicatesOfItem")] +#[rustc_clean(cfg = "cfail3")] +pub fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {} // Inline ---------------------------------------------------------------------- #[cfg(cfail1)] -fn inline() {} +pub fn inline() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")] +#[rustc_clean(cfg = "cfail3")] #[inline] -fn inline() {} +pub fn inline() {} // Inline Never ---------------------------------------------------------------- #[cfg(cfail1)] #[inline(always)] -fn inline_never() {} +pub fn inline_never() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")] +#[rustc_clean(cfg = "cfail3")] #[inline(never)] -fn inline_never() {} +pub fn inline_never() {} // No Mangle ------------------------------------------------------------------- #[cfg(cfail1)] -fn no_mangle() {} +pub fn no_mangle() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")] +#[rustc_clean(cfg = "cfail3")] #[no_mangle] -fn no_mangle() {} +pub fn no_mangle() {} // Linkage --------------------------------------------------------------------- #[cfg(cfail1)] -fn linkage() {} +pub fn linkage() {} #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[linkage="weak_odr"] -fn linkage() {} +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")] +#[rustc_clean(cfg = "cfail3")] +#[linkage = "weak_odr"] +pub fn linkage() {} // Return Impl Trait ----------------------------------------------------------- #[cfg(cfail1)] -fn return_impl_trait() -> i32 { +pub fn return_impl_trait() -> i32 { 0 } #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn return_impl_trait() -> impl Clone { +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, TypeckTables, FnSignature")] +#[rustc_clean(cfg = "cfail3")] +pub fn return_impl_trait() -> impl Clone { 0 } @@ -314,36 +280,33 @@ fn return_impl_trait() -> impl Clone { // Change Return Impl Trait ---------------------------------------------------- #[cfg(cfail1)] -fn change_return_impl_trait() -> impl Clone { +pub fn change_return_impl_trait() -> impl Clone { 0u32 } #[cfg(not(cfail1))] -#[rustc_dirty(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] // The actual type is the same, so: clean -#[rustc_metadata_clean(cfg="cfail3")] -fn change_return_impl_trait() -> impl Copy { +#[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")] +#[rustc_clean(cfg = "cfail3")] +pub fn change_return_impl_trait() -> impl Copy { 0u32 } // Change Return Type Indirectly ----------------------------------------------- -struct ReferencedType1; -struct ReferencedType2; +pub struct ReferencedType1; +pub struct ReferencedType2; -mod change_return_type_indirectly { +pub mod change_return_type_indirectly { #[cfg(cfail1)] use super::ReferencedType1 as ReturnType; #[cfg(not(cfail1))] use super::ReferencedType2 as ReturnType; - #[rustc_dirty(label="Hir", cfg="cfail2")] - #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] - fn indirect_return_type() -> ReturnType { + #[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, MirValidated, MirOptimized, TypeckTables, FnSignature")] + #[rustc_clean(cfg = "cfail3")] + pub fn indirect_return_type() -> ReturnType { ReturnType {} } } @@ -351,50 +314,49 @@ mod change_return_type_indirectly { // Change Parameter Type Indirectly -------------------------------------------- -mod change_parameter_type_indirectly { +pub mod change_parameter_type_indirectly { #[cfg(cfail1)] use super::ReferencedType1 as ParameterType; #[cfg(not(cfail1))] use super::ReferencedType2 as ParameterType; - #[rustc_dirty(label="Hir", cfg="cfail2")] - #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] - fn indirect_parameter_type(p: ParameterType) {} + #[rustc_clean(cfg = "cfail2", + except = "Hir, HirBody, MirValidated, MirOptimized, TypeckTables, FnSignature")] + #[rustc_clean(cfg = "cfail3")] + pub fn indirect_parameter_type(p: ParameterType) {} } // Change Trait Bound Indirectly ----------------------------------------------- -trait ReferencedTrait1 {} -trait ReferencedTrait2 {} +pub trait ReferencedTrait1 {} +pub trait ReferencedTrait2 {} -mod change_trait_bound_indirectly { +pub mod change_trait_bound_indirectly { #[cfg(cfail1)] use super::ReferencedTrait1 as Trait; #[cfg(not(cfail1))] use super::ReferencedTrait2 as Trait; - #[rustc_dirty(label="Hir", cfg="cfail2")] - #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] - fn indirect_trait_bound(p: T) {} + #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, PredicatesOfItem")] + #[rustc_clean(cfg = "cfail3")] + pub fn indirect_trait_bound(p: T) {} } // Change Trait Bound Indirectly In Where Clause ------------------------------- -mod change_trait_bound_indirectly_in_where_clause { +pub mod change_trait_bound_indirectly_in_where_clause { #[cfg(cfail1)] use super::ReferencedTrait1 as Trait; #[cfg(not(cfail1))] use super::ReferencedTrait2 as Trait; - #[rustc_dirty(label="Hir", cfg="cfail2")] - #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] - fn indirect_trait_bound_where(p: T) where T: Trait {} + #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, PredicatesOfItem")] + #[rustc_clean(cfg = "cfail3")] + pub fn indirect_trait_bound_where(p: T) + where + T: Trait, + { + } } diff --git a/src/test/incremental/hashes/if_expressions.rs b/src/test/incremental/hashes/if_expressions.rs index 3cd8308c30..426c58c834 100644 --- a/src/test/incremental/hashes/if_expressions.rs +++ b/src/test/incremental/hashes/if_expressions.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -38,8 +38,6 @@ pub fn change_condition(x: bool) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_condition(x: bool) -> u32 { if !x { return 1 @@ -61,8 +59,6 @@ pub fn change_then_branch(x: bool) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_then_branch(x: bool) -> u32 { if x { return 2 @@ -86,8 +82,6 @@ pub fn change_else_branch(x: bool) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_else_branch(x: bool) -> u32 { if x { 1 @@ -113,8 +107,6 @@ pub fn add_else_branch(x: bool) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_else_branch(x: bool) -> u32 { let mut ret = 1; @@ -141,8 +133,6 @@ pub fn change_condition_if_let(x: Option) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_condition_if_let(x: Option) -> u32 { if let Some(_) = x { return 1 @@ -166,8 +156,6 @@ pub fn change_then_branch_if_let(x: Option) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_then_branch_if_let(x: Option) -> u32 { if let Some(x) = x { return x + 1 @@ -191,8 +179,6 @@ pub fn change_else_branch_if_let(x: Option) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_else_branch_if_let(x: Option) -> u32 { if let Some(x) = x { x @@ -218,8 +204,6 @@ pub fn add_else_branch_if_let(x: Option) -> u32 { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_else_branch_if_let(x: Option) -> u32 { let mut ret = 1; diff --git a/src/test/incremental/hashes/indexing_expressions.rs b/src/test/incremental/hashes/indexing_expressions.rs index 5a81d3a9ed..e66e239b33 100644 --- a/src/test/incremental/hashes/indexing_expressions.rs +++ b/src/test/incremental/hashes/indexing_expressions.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -36,8 +36,6 @@ fn change_simple_index(slice: &[u32]) -> u32 { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] fn change_simple_index(slice: &[u32]) -> u32 { slice[4] } @@ -55,8 +53,6 @@ fn change_lower_bound(slice: &[u32]) -> &[u32] { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] fn change_lower_bound(slice: &[u32]) -> &[u32] { &slice[2..5] } @@ -74,8 +70,6 @@ fn change_upper_bound(slice: &[u32]) -> &[u32] { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] fn change_upper_bound(slice: &[u32]) -> &[u32] { &slice[3..7] } @@ -93,8 +87,6 @@ fn add_lower_bound(slice: &[u32]) -> &[u32] { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] fn add_lower_bound(slice: &[u32]) -> &[u32] { &slice[3..4] } @@ -112,8 +104,6 @@ fn add_upper_bound(slice: &[u32]) -> &[u32] { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] fn add_upper_bound(slice: &[u32]) -> &[u32] { &slice[3..7] } @@ -131,8 +121,6 @@ fn change_mutability(slice: &mut [u32]) -> u32 { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] fn change_mutability(slice: &mut [u32]) -> u32 { (&slice[3..5])[0] } @@ -150,8 +138,6 @@ fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { &slice[3..=7] } diff --git a/src/test/incremental/hashes/inherent_impls.rs b/src/test/incremental/hashes/inherent_impls.rs index f9e8fb026c..93aba4a3ee 100644 --- a/src/test/incremental/hashes/inherent_impls.rs +++ b/src/test/incremental/hashes/inherent_impls.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -36,11 +36,8 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,AssociatedItemDefIds")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn method_name2() { } } @@ -55,13 +52,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn method_body() { println!("Hello, world!"); } @@ -80,13 +73,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] #[inline] pub fn method_body_inlined() { println!("Hello, world!"); @@ -103,13 +92,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="AssociatedItems,Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_privacy() { } } @@ -122,13 +107,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_dirty(cfg="cfail2", except="TypeOfItem,PredicatesOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn method_selfness(&self) { } } @@ -141,16 +122,12 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean( cfg="cfail2", except="Hir,HirBody,FnSignature,TypeckTables,MirOptimized,MirValidated" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn method_selfmutness(&mut self) { } } @@ -165,17 +142,12 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,AssociatedItemDefIds")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_method_to_impl1(&self) { } #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_method_to_impl2(&self) { } } @@ -190,16 +162,12 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean( cfg="cfail2", except="Hir,HirBody,FnSignature,TypeckTables,MirOptimized,MirValidated" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_method_parameter(&self, _: i32) { } } @@ -214,13 +182,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_method_parameter_name(&self, b: i64) { } } @@ -235,15 +199,11 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean( cfg="cfail2", except="Hir,HirBody,FnSignature,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_method_return_type(&self) -> u8 { 0 } } @@ -258,13 +218,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] #[inline] pub fn make_method_inline(&self) -> u8 { 0 } } @@ -280,13 +236,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_method_parameter_order(&self, b: i64, a: i64) { } } @@ -301,16 +253,12 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean( cfg="cfail2", except="Hir,HirBody,FnSignature,TypeckTables,MirOptimized,MirValidated" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub unsafe fn make_method_unsafe(&self) { } } @@ -325,13 +273,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="Hir,HirBody,FnSignature,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub extern fn make_method_extern(&self) { } } @@ -346,13 +290,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="Hir,HirBody,FnSignature,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub extern "system" fn change_method_calling_convention(&self) { } } @@ -367,13 +307,18 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { - #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeckTables")] + // Warning: Note that `TypeckTables` are coming up clean here. + // The addition or removal of lifetime parameters that don't + // appear in the arguments or fn body in any way does not, in + // fact, affect the `TypeckTables` in any semantic way (at least + // as of this writing). **However,** altering the order of + // lowering **can** cause it appear to affect the `TypeckTables`: + // if we lower generics before the body, then the `HirId` for + // things in the body will be affected. So if you start to see + // `TypeckTables` appear dirty, that might be the cause. -nmatsakis + #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_lifetime_parameter_to_method<'a>(&self) { } } @@ -388,16 +333,21 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { + // Warning: Note that `TypeckTables` are coming up clean here. + // The addition or removal of type parameters that don't appear in + // the arguments or fn body in any way does not, in fact, affect + // the `TypeckTables` in any semantic way (at least as of this + // writing). **However,** altering the order of lowering **can** + // cause it appear to affect the `TypeckTables`: if we lower + // generics before the body, then the `HirId` for things in the + // body will be affected. So if you start to see `TypeckTables` + // appear dirty, that might be the cause. -nmatsakis #[rustc_clean( cfg="cfail2", - except="Hir,HirBody,GenericsOfItem,PredicatesOfItem,TypeOfItem,TypeckTables", + except="Hir,HirBody,GenericsOfItem,PredicatesOfItem,TypeOfItem", )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_type_parameter_to_method(&self) { } } @@ -412,16 +362,12 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean( cfg="cfail2", except="Hir,HirBody,GenericsOfItem,PredicatesOfItem,TypeOfItem,TypeckTables" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b: 'a>(&self) { } } @@ -436,14 +382,19 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { + // Warning: Note that `TypeckTables` are coming up clean here. + // The addition or removal of bounds that don't appear in the + // arguments or fn body in any way does not, in fact, affect the + // `TypeckTables` in any semantic way (at least as of this + // writing). **However,** altering the order of lowering **can** + // cause it appear to affect the `TypeckTables`: if we lower + // generics before the body, then the `HirId` for things in the + // body will be affected. So if you start to see `TypeckTables` + // appear dirty, that might be the cause. -nmatsakis #[rustc_clean(cfg="cfail2", except="Hir,HirBody,GenericsOfItem,PredicatesOfItem,\ - TypeOfItem,TypeckTables")] + TypeOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_lifetime_bound_to_type_param_of_method<'a, T: 'a>(&self) { } } @@ -458,13 +409,18 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { - #[rustc_clean(cfg="cfail2", except="Hir,HirBody,PredicatesOfItem,TypeckTables")] + // Warning: Note that `TypeckTables` are coming up clean here. + // The addition or removal of bounds that don't appear in the + // arguments or fn body in any way does not, in fact, affect the + // `TypeckTables` in any semantic way (at least as of this + // writing). **However,** altering the order of lowering **can** + // cause it appear to affect the `TypeckTables`: if we lower + // generics before the body, then the `HirId` for things in the + // body will be affected. So if you start to see `TypeckTables` + // appear dirty, that might be the cause. -nmatsakis + #[rustc_clean(cfg="cfail2", except="Hir,HirBody,PredicatesOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_trait_bound_to_type_param_of_method(&self) { } } @@ -479,13 +435,9 @@ impl Foo { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Foo { #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] #[no_mangle] pub fn add_no_mangle_to_method(&self) { } } @@ -503,16 +455,12 @@ impl Bar { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,GenericsOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Bar { #[rustc_clean( cfg="cfail2", except="GenericsOfItem,FnSignature,TypeckTables,TypeOfItem,MirOptimized,MirValidated" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_type_parameter_to_impl(&self) { } } @@ -527,13 +475,9 @@ impl Bar { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Bar { #[rustc_clean(cfg="cfail2", except="FnSignature,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn change_impl_self_type(&self) { } } @@ -548,13 +492,9 @@ impl Bar { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Bar { #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_lifetime_bound_to_impl_parameter(&self) { } } @@ -569,13 +509,9 @@ impl Bar { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl Bar { #[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn add_trait_bound_to_impl_parameter(&self) { } } diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs index a1057c036d..3996e92e05 100644 --- a/src/test/incremental/hashes/inline_asm.rs +++ b/src/test/incremental/hashes/inline_asm.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -30,7 +30,7 @@ // Change template ------------------------------------------------------------- #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_template(a: i32) -> i32 { +pub fn change_template(a: i32) -> i32 { let c: i32; unsafe { asm!("add 1, $0" @@ -44,14 +44,10 @@ fn change_template(a: i32) -> i32 { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_template(a: i32) -> i32 { +pub fn change_template(a: i32) -> i32 { let c: i32; unsafe { asm!("add 2, $0" @@ -69,7 +65,7 @@ fn change_template(a: i32) -> i32 { // Change output ------------------------------------------------------------- #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_output(a: i32) -> i32 { +pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; let mut _out2: i32 = 0; unsafe { @@ -84,14 +80,10 @@ fn change_output(a: i32) -> i32 { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_output(a: i32) -> i32 { +pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; let mut _out2: i32 = 0; unsafe { @@ -110,7 +102,7 @@ fn change_output(a: i32) -> i32 { // Change input ------------------------------------------------------------- #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_input(_a: i32, _b: i32) -> i32 { +pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -124,14 +116,10 @@ fn change_input(_a: i32, _b: i32) -> i32 { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_input(_a: i32, _b: i32) -> i32 { +pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -149,7 +137,7 @@ fn change_input(_a: i32, _b: i32) -> i32 { // Change input constraint ----------------------------------------------------- #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_input_constraint(_a: i32, _b: i32) -> i32 { +pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -163,14 +151,10 @@ fn change_input_constraint(_a: i32, _b: i32) -> i32 { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_input_constraint(_a: i32, _b: i32) -> i32 { +pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -188,7 +172,7 @@ fn change_input_constraint(_a: i32, _b: i32) -> i32 { // Change clobber -------------------------------------------------------------- #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_clobber(_a: i32) -> i32 { +pub fn change_clobber(_a: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -202,14 +186,10 @@ fn change_clobber(_a: i32) -> i32 { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_clobber(_a: i32) -> i32 { +pub fn change_clobber(_a: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -227,7 +207,7 @@ fn change_clobber(_a: i32) -> i32 { // Change options -------------------------------------------------------------- #[cfg(cfail1)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_options(_a: i32) -> i32 { +pub fn change_options(_a: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -241,14 +221,10 @@ fn change_options(_a: i32) -> i32 { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn change_options(_a: i32) -> i32 { +pub fn change_options(_a: i32) -> i32 { let _out; unsafe { asm!("add 1, $0" @@ -260,6 +236,3 @@ fn change_options(_a: i32) -> i32 { } _out } - - - diff --git a/src/test/incremental/hashes/let_expressions.rs b/src/test/incremental/hashes/let_expressions.rs index d46fbd3676..851b13c705 100644 --- a/src/test/incremental/hashes/let_expressions.rs +++ b/src/test/incremental/hashes/let_expressions.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -32,26 +32,9 @@ pub fn change_name() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_clean(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn change_name() { let _y = 2u64; } @@ -65,26 +48,9 @@ pub fn add_type() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_clean(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_clean(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables")] +#[rustc_clean(cfg="cfail3")] pub fn add_type() { let _x: u32 = 2u32; } @@ -98,26 +64,9 @@ pub fn change_type() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn change_type() { let _x: u8 = 2; } @@ -131,26 +80,9 @@ pub fn change_mutability_of_reference_type() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_clean(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated")] +#[rustc_clean(cfg="cfail3")] pub fn change_mutability_of_reference_type() { let _x: &mut u64; } @@ -164,26 +96,9 @@ pub fn change_mutability_of_slot() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn change_mutability_of_slot() { let _x: u64 = 0; } @@ -197,26 +112,9 @@ pub fn change_simple_binding_to_pattern() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn change_simple_binding_to_pattern() { let (_a, _b) = (0u8, 'x'); } @@ -230,26 +128,9 @@ pub fn change_name_in_pattern() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_clean(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn change_name_in_pattern() { let (_a, _c) = (1u8, 'y'); } @@ -263,26 +144,9 @@ pub fn add_ref_in_pattern() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn add_ref_in_pattern() { let (ref _a, _b) = (1u8, 'y'); } @@ -296,18 +160,9 @@ pub fn add_amp_in_pattern() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn add_amp_in_pattern() { let (&_a, _b) = (&1u8, 'y'); } @@ -321,26 +176,9 @@ pub fn change_mutability_of_binding_in_pattern() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn change_mutability_of_binding_in_pattern() { let (mut _a, _b) = (99u8, 'q'); } @@ -354,26 +192,9 @@ pub fn add_initializer() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_dirty(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,TypeckTables,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn add_initializer() { let _x: i16 = 3i16; } @@ -387,26 +208,9 @@ pub fn change_initializer() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_dirty(label="MirValidated", cfg="cfail2")] -#[rustc_clean(label="MirValidated", cfg="cfail3")] -#[rustc_dirty(label="MirOptimized", cfg="cfail2")] -#[rustc_clean(label="MirOptimized", cfg="cfail3")] -#[rustc_clean(label="TypeckTables", cfg="cfail2")] -#[rustc_clean(label="TypeckTables", cfg="cfail3")] -#[rustc_clean(label="TypeOfItem", cfg="cfail2")] -#[rustc_clean(label="TypeOfItem", cfg="cfail3")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail2")] -#[rustc_clean(label="GenericsOfItem", cfg="cfail3")] -#[rustc_clean(label="FnSignature", cfg="cfail2")] -#[rustc_clean(label="FnSignature", cfg="cfail3")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail2")] -#[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] +#[rustc_clean(cfg="cfail2", + except="HirBody,MirValidated,MirOptimized")] +#[rustc_clean(cfg="cfail3")] pub fn change_initializer() { let _x = 5u16; } diff --git a/src/test/incremental/hashes/loop_expressions.rs b/src/test/incremental/hashes/loop_expressions.rs index da43ef3c46..dcb937fd86 100644 --- a/src/test/incremental/hashes/loop_expressions.rs +++ b/src/test/incremental/hashes/loop_expressions.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -27,7 +27,7 @@ // Change loop body ------------------------------------------------------------ #[cfg(cfail1)] -fn change_loop_body() { +pub fn change_loop_body() { let mut _x = 0; loop { _x = 1; @@ -36,13 +36,9 @@ fn change_loop_body() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_loop_body() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_loop_body() { let mut _x = 0; loop { _x = 2; @@ -54,7 +50,7 @@ fn change_loop_body() { // Add break ------------------------------------------------------------------- #[cfg(cfail1)] -fn add_break() { +pub fn add_break() { let mut _x = 0; loop { _x = 1; @@ -62,13 +58,9 @@ fn add_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn add_break() { let mut _x = 0; loop { _x = 1; @@ -80,7 +72,7 @@ fn add_break() { // Add loop label -------------------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label() { +pub fn add_loop_label() { let mut _x = 0; loop { _x = 1; @@ -89,13 +81,9 @@ fn add_loop_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label() { let mut _x = 0; 'label: loop { _x = 1; @@ -107,7 +95,7 @@ fn add_loop_label() { // Add loop label to break ----------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_break() { +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: loop { _x = 1; @@ -116,13 +104,9 @@ fn add_loop_label_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: loop { _x = 1; @@ -134,7 +118,7 @@ fn add_loop_label_to_break() { // Change break label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_break_label() { +pub fn change_break_label() { let mut _x = 0; 'outer: loop { 'inner: loop { @@ -145,13 +129,9 @@ fn change_break_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_break_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_break_label() { let mut _x = 0; 'outer: loop { 'inner: loop { @@ -165,7 +145,7 @@ fn change_break_label() { // Add loop label to continue -------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_continue() { +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: loop { _x = 1; @@ -174,13 +154,9 @@ fn add_loop_label_to_continue() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_continue() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: loop { _x = 1; @@ -192,7 +168,7 @@ fn add_loop_label_to_continue() { // Change continue label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_continue_label() { +pub fn change_continue_label() { let mut _x = 0; 'outer: loop { 'inner: loop { @@ -203,13 +179,9 @@ fn change_continue_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_label() { let mut _x = 0; 'outer: loop { 'inner: loop { @@ -223,7 +195,7 @@ fn change_continue_label() { // Change continue to break ---------------------------------------------------- #[cfg(cfail1)] -fn change_continue_to_break() { +pub fn change_continue_to_break() { let mut _x = 0; loop { _x = 1; @@ -232,13 +204,9 @@ fn change_continue_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_to_break() { let mut _x = 0; loop { _x = 1; diff --git a/src/test/incremental/hashes/match_expressions.rs b/src/test/incremental/hashes/match_expressions.rs index 0d1444b376..263901f402 100644 --- a/src/test/incremental/hashes/match_expressions.rs +++ b/src/test/incremental/hashes/match_expressions.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -39,8 +39,6 @@ pub fn add_arm(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_arm(x: u32) -> u32 { match x { 0 => 0, @@ -66,8 +64,6 @@ pub fn change_order_of_arms(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_order_of_arms(x: u32) -> u32 { match x { 1 => 1, @@ -92,8 +88,6 @@ pub fn add_guard_clause(x: u32, y: bool) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_guard_clause(x: u32, y: bool) -> u32 { match x { 0 => 0, @@ -118,8 +112,6 @@ pub fn change_guard_clause(x: u32, y: bool) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_guard_clause(x: u32, y: bool) -> u32 { match x { 0 => 0, @@ -144,8 +136,6 @@ pub fn add_at_binding(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_at_binding(x: u32) -> u32 { match x { 0 => 0, @@ -170,8 +160,6 @@ pub fn change_name_of_at_binding(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_name_of_at_binding(x: u32) -> u32 { match x { 0 => 0, @@ -195,8 +183,6 @@ pub fn change_simple_name_to_pattern(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_simple_name_to_pattern(x: u32) -> u32 { match (x, x & 1) { (0, 0) => 0, @@ -220,8 +206,6 @@ pub fn change_name_in_pattern(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_name_in_pattern(x: u32) -> u32 { match (x, x & 1) { (b, 0) => 0, @@ -245,8 +229,6 @@ pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { match (x, x & 1) { (mut a, 0) => 0, @@ -269,8 +251,6 @@ pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { match (x, x & 1) { (ref a, 0) => 0, @@ -293,8 +273,6 @@ pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { match (&x, x & 1) { (&a, 0) => 0, @@ -318,8 +296,6 @@ pub fn change_rhs_of_arm(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_rhs_of_arm(x: u32) -> u32 { match x { 0 => 0, @@ -344,8 +320,6 @@ pub fn add_alternative_to_arm(x: u32) -> u32 { #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_alternative_to_arm(x: u32) -> u32 { match x { 0 | 7 => 0, diff --git a/src/test/incremental/hashes/panic_exprs.rs b/src/test/incremental/hashes/panic_exprs.rs index cddd4ae286..2b6a140be3 100644 --- a/src/test/incremental/hashes/panic_exprs.rs +++ b/src/test/incremental/hashes/panic_exprs.rs @@ -28,177 +28,134 @@ // Indexing expression --------------------------------------------------------- -#[cfg(cfail1)] -pub fn indexing(slice: &[u8]) -> u8 { - slice[100] -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn indexing(slice: &[u8]) -> u8 { - slice[100] + #[cfg(cfail1)] + { + slice[100] + } + #[cfg(not(cfail1))] + { + slice[100] + } } // Arithmetic overflow plus ---------------------------------------------------- -#[cfg(cfail1)] -pub fn arithmetic_overflow_plus(val: i32) -> i32 { - val + 1 -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn arithmetic_overflow_plus(val: i32) -> i32 { - val + 1 + #[cfg(cfail1)] + { + val + 1 + } + #[cfg(not(cfail1))] + { + val + 1 + } } // Arithmetic overflow minus ---------------------------------------------------- -#[cfg(cfail1)] -pub fn arithmetic_overflow_minus(val: i32) -> i32 { - val - 1 -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn arithmetic_overflow_minus(val: i32) -> i32 { - val - 1 + #[cfg(cfail1)] + { + val - 1 + } + #[cfg(not(cfail1))] + { + val - 1 + } } // Arithmetic overflow mult ---------------------------------------------------- -#[cfg(cfail1)] -pub fn arithmetic_overflow_mult(val: i32) -> i32 { - val * 2 -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn arithmetic_overflow_mult(val: i32) -> i32 { - val * 2 + #[cfg(cfail1)] + { + val * 2 + } + #[cfg(not(cfail1))] + { + val * 2 + } } // Arithmetic overflow negation ------------------------------------------------ -#[cfg(cfail1)] -pub fn arithmetic_overflow_negation(val: i32) -> i32 { - -val -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn arithmetic_overflow_negation(val: i32) -> i32 { - -val + #[cfg(cfail1)] + { + -val + } + #[cfg(not(cfail1))] + { + -val + } } // Division by zero ------------------------------------------------------------ -#[cfg(cfail1)] -pub fn division_by_zero(val: i32) -> i32 { - 2 / val -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn division_by_zero(val: i32) -> i32 { - 2 / val + #[cfg(cfail1)] + { + 2 / val + } + #[cfg(not(cfail1))] + { + 2 / val + } } // Division by zero ------------------------------------------------------------ -#[cfg(cfail1)] -pub fn mod_by_zero(val: i32) -> i32 { - 2 % val -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn mod_by_zero(val: i32) -> i32 { - 2 % val + #[cfg(cfail1)] + { + 2 % val + } + #[cfg(not(cfail1))] + { + 2 % val + } } // shift left ------------------------------------------------------------------ -#[cfg(cfail1)] -pub fn shift_left(val: i32, shift: usize) -> i32 { - val << shift -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn shift_left(val: i32, shift: usize) -> i32 { - val << shift + #[cfg(cfail1)] + { + val << shift + } + #[cfg(not(cfail1))] + { + val << shift + } } // shift right ------------------------------------------------------------------ -#[cfg(cfail1)] -pub fn shift_right(val: i32, shift: usize) -> i32 { - val >> shift -} - -#[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn shift_right(val: i32, shift: usize) -> i32 { - val >> shift -} - - -// THE FOLLOWING ITEMS SHOULD NOT BE INFLUENCED BY THEIR SOURCE LOCATION - -// bitwise --------------------------------------------------------------------- -#[cfg(cfail1)] -pub fn bitwise(val: i32) -> i32 { - !val & 0x101010101 | 0x45689 ^ 0x2372382 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn bitwise(val: i32) -> i32 { - !val & 0x101010101 | 0x45689 ^ 0x2372382 -} - - -// logical --------------------------------------------------------------------- -#[cfg(cfail1)] -pub fn logical(val1: bool, val2: bool, val3: bool) -> bool { - val1 && val2 || val3 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn logical(val1: bool, val2: bool, val3: bool) -> bool { - val1 && val2 || val3 + #[cfg(cfail1)] + { + val >> shift + } + #[cfg(not(cfail1))] + { + val >> shift + } } diff --git a/src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs b/src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs deleted file mode 100644 index 01fb9e9c1e..0000000000 --- a/src/test/incremental/hashes/panic_exprs_no_overflow_checks.rs +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This test case tests the incremental compilation hash (ICH) implementation -// for exprs that can panic at runtime (e.g. because of bounds checking). For -// these expressions an error message containing their source location is -// generated, so their hash must always depend on their location in the source -// code, not just when debuginfo is enabled. - -// As opposed to the panic_exprs.rs test case, this test case checks that things -// behave as expected when overflow checks are off: -// -// - Addition, subtraction, and multiplication do not change the ICH, unless -// the function containing them is marked with rustc_inherit_overflow_checks. -// - Division by zero and bounds checks always influence the ICH - -// The general pattern followed here is: Change one thing between rev1 and rev2 -// and make sure that the hash has changed, then change nothing between rev2 and -// rev3 and make sure that the hash has not changed. - -// must-compile-successfully -// revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -Z force-overflow-checks=off - -#![allow(warnings)] -#![feature(rustc_attrs)] -#![crate_type="rlib"] - - -// Indexing expression --------------------------------------------------------- -#[cfg(cfail1)] -pub fn indexing(slice: &[u8]) -> u8 { - slice[100] -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn indexing(slice: &[u8]) -> u8 { - slice[100] -} - - -// Arithmetic overflow plus ---------------------------------------------------- -#[cfg(cfail1)] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_plus_inherit(val: i32) -> i32 { - val + 1 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_plus_inherit(val: i32) -> i32 { - val + 1 -} - - -// Arithmetic overflow minus ---------------------------------------------------- -#[cfg(cfail1)] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_minus_inherit(val: i32) -> i32 { - val - 1 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_minus_inherit(val: i32) -> i32 { - val - 1 -} - - -// Arithmetic overflow mult ---------------------------------------------------- -#[cfg(cfail1)] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_mult_inherit(val: i32) -> i32 { - val * 2 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_mult_inherit(val: i32) -> i32 { - val * 2 -} - - -// Arithmetic overflow negation ------------------------------------------------ -#[cfg(cfail1)] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_negation_inherit(val: i32) -> i32 { - -val -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -#[rustc_inherit_overflow_checks] -pub fn arithmetic_overflow_negation_inherit(val: i32) -> i32 { - -val -} - - -// Division by zero ------------------------------------------------------------ -#[cfg(cfail1)] -pub fn division_by_zero(val: i32) -> i32 { - 2 / val -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn division_by_zero(val: i32) -> i32 { - 2 / val -} - -// Division by zero ------------------------------------------------------------ -#[cfg(cfail1)] -pub fn mod_by_zero(val: i32) -> i32 { - 2 % val -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn mod_by_zero(val: i32) -> i32 { - 2 % val -} - - - -// THE FOLLOWING ITEMS SHOULD NOT BE INFLUENCED BY THEIR SOURCE LOCATION - -// bitwise --------------------------------------------------------------------- -#[cfg(cfail1)] -pub fn bitwise(val: i32) -> i32 { - !val & 0x101010101 | 0x45689 ^ 0x2372382 << 1 >> 1 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn bitwise(val: i32) -> i32 { - !val & 0x101010101 | 0x45689 ^ 0x2372382 << 1 >> 1 -} - - -// logical --------------------------------------------------------------------- -#[cfg(cfail1)] -pub fn logical(val1: bool, val2: bool, val3: bool) -> bool { - val1 && val2 || val3 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn logical(val1: bool, val2: bool, val3: bool) -> bool { - val1 && val2 || val3 -} - -// Arithmetic overflow plus ---------------------------------------------------- -#[cfg(cfail1)] -pub fn arithmetic_overflow_plus(val: i32) -> i32 { - val + 1 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn arithmetic_overflow_plus(val: i32) -> i32 { - val + 1 -} - - -// Arithmetic overflow minus ---------------------------------------------------- -#[cfg(cfail1)] -pub fn arithmetic_overflow_minus(val: i32) -> i32 { - val - 1 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn arithmetic_overflow_minus(val: i32) -> i32 { - val - 1 -} - - -// Arithmetic overflow mult ---------------------------------------------------- -#[cfg(cfail1)] -pub fn arithmetic_overflow_mult(val: i32) -> i32 { - val * 2 -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn arithmetic_overflow_mult(val: i32) -> i32 { - val * 2 -} - - -// Arithmetic overflow negation ------------------------------------------------ -#[cfg(cfail1)] -pub fn arithmetic_overflow_negation(val: i32) -> i32 { - -val -} - -#[cfg(not(cfail1))] -#[rustc_clean(cfg="cfail2")] -#[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -pub fn arithmetic_overflow_negation(val: i32) -> i32 { - -val -} diff --git a/src/test/incremental/hashes/statics.rs b/src/test/incremental/hashes/statics.rs index 7a4123190d..b9616d8c6b 100644 --- a/src/test/incremental/hashes/statics.rs +++ b/src/test/incremental/hashes/statics.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -34,8 +34,6 @@ static STATIC_VISIBILITY: u8 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub static STATIC_VISIBILITY: u8 = 0; @@ -46,8 +44,6 @@ static STATIC_MUTABILITY: u8 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] static mut STATIC_MUTABILITY: u8 = 0; @@ -58,8 +54,6 @@ static STATIC_LINKAGE: u8 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[linkage="weak_odr"] static STATIC_LINKAGE: u8 = 0; @@ -71,8 +65,6 @@ static STATIC_NO_MANGLE: u8 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[no_mangle] static STATIC_NO_MANGLE: u8 = 0; @@ -84,8 +76,6 @@ static STATIC_THREAD_LOCAL: u8 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[thread_local] static STATIC_THREAD_LOCAL: u8 = 0; @@ -97,8 +87,6 @@ static STATIC_CHANGE_TYPE_1: i16 = 0; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_TYPE_1: u64 = 0; @@ -109,16 +97,12 @@ static STATIC_CHANGE_TYPE_2: Option = None; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_TYPE_2: Option = None; // Change value between simple literals --------------------------------------- #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_VALUE_1: i16 = { #[cfg(cfail1)] { 1 } @@ -131,8 +115,6 @@ static STATIC_CHANGE_VALUE_1: i16 = { // Change value between expressions ------------------------------------------- #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_VALUE_2: i16 = { #[cfg(cfail1)] { 1 + 1 } @@ -143,8 +125,6 @@ static STATIC_CHANGE_VALUE_2: i16 = { #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_VALUE_3: i16 = { #[cfg(cfail1)] { 2 + 3 } @@ -155,8 +135,6 @@ static STATIC_CHANGE_VALUE_3: i16 = { #[rustc_clean(cfg="cfail2", except="HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_VALUE_4: i16 = { #[cfg(cfail1)] { 1 + 2 * 3 } @@ -179,13 +157,9 @@ mod static_change_type_indirectly { #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_TYPE_INDIRECTLY_1: Type = Type; #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] static STATIC_CHANGE_TYPE_INDIRECTLY_2: Option = None; } diff --git a/src/test/incremental/hashes/struct_constructors.rs b/src/test/incremental/hashes/struct_constructors.rs index 67362e31b2..3cdaf0e468 100644 --- a/src/test/incremental/hashes/struct_constructors.rs +++ b/src/test/incremental/hashes/struct_constructors.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -44,8 +44,6 @@ pub fn change_field_value_regular_struct() -> RegularStruct { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_field_value_regular_struct() -> RegularStruct { RegularStruct { x: 0, @@ -69,8 +67,6 @@ pub fn change_field_order_regular_struct() -> RegularStruct { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_field_order_regular_struct() -> RegularStruct { RegularStruct { y: 4, @@ -99,8 +95,6 @@ pub fn add_field_regular_struct() -> RegularStruct { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn add_field_regular_struct() -> RegularStruct { let struct1 = RegularStruct { x: 3, @@ -136,8 +130,6 @@ pub fn change_field_label_regular_struct() -> RegularStruct { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_field_label_regular_struct() -> RegularStruct { let struct1 = RegularStruct { x: 3, @@ -173,8 +165,6 @@ pub fn change_constructor_path_regular_struct() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_path_regular_struct() { let _ = RegularStruct2 { x: 0, @@ -197,8 +187,6 @@ pub mod change_constructor_path_indirectly_regular_struct { except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,TypeckTables" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> Struct { Struct { x: 0, @@ -221,8 +209,6 @@ pub fn change_field_value_tuple_struct() -> TupleStruct { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_field_value_tuple_struct() -> TupleStruct { TupleStruct(0, 1, 3) } @@ -240,8 +226,6 @@ pub fn change_constructor_path_tuple_struct() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="HirBody,MirOptimized,MirValidated,TypeckTables")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn change_constructor_path_tuple_struct() { let _ = TupleStruct2(0, 1, 2); } @@ -260,8 +244,6 @@ pub mod change_constructor_path_indirectly_tuple_struct { except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,TypeckTables" )] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub fn function() -> Struct { Struct(0, 1, 2) } diff --git a/src/test/incremental/hashes/struct_defs.rs b/src/test/incremental/hashes/struct_defs.rs index 16ca71b6cd..d7b7072041 100644 --- a/src/test/incremental/hashes/struct_defs.rs +++ b/src/test/incremental/hashes/struct_defs.rs @@ -23,7 +23,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -45,8 +45,6 @@ pub struct LayoutPacked; #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[repr(packed)] pub struct LayoutPacked; @@ -64,8 +62,6 @@ struct LayoutC; #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] #[repr(C)] struct LayoutC; @@ -86,13 +82,9 @@ struct TupleStructFieldType(i32); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] // Note that changing the type of a field does not change the type of the struct or enum, but // adding/removing fields or changing a fields name or visibility does. struct TupleStructFieldType( - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] u32 ); @@ -113,13 +105,8 @@ struct TupleStructAddField(i32); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct TupleStructAddField( - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] i32, - #[rustc_metadata_clean(cfg="cfail3")] u32 ); @@ -140,8 +127,6 @@ struct TupleStructFieldVisibility(char); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct TupleStructFieldVisibility(pub char); @@ -161,13 +146,9 @@ struct RecordStructFieldType { x: f32 } #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] // Note that changing the type of a field does not change the type of the struct or enum, but // adding/removing fields or changing a fields name or visibility does. struct RecordStructFieldType { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] x: u64 } @@ -188,8 +169,6 @@ struct RecordStructFieldName { x: f32 } #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct RecordStructFieldName { y: f32 } @@ -209,13 +188,8 @@ struct RecordStructAddField { x: f32 } #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct RecordStructAddField { - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] x: f32, - #[rustc_metadata_clean(cfg="cfail3")] y: () } @@ -235,11 +209,7 @@ struct RecordStructFieldVisibility { x: f32 } #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct RecordStructFieldVisibility { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] pub x: f32 } @@ -260,8 +230,6 @@ struct AddLifetimeParameter<'a>(&'a f32, &'a f64); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct AddLifetimeParameter<'a, 'b>(&'a f32, &'b f64); @@ -281,14 +249,8 @@ struct AddLifetimeParameterBound<'a, 'b>(&'a f32, &'b f64); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct AddLifetimeParameterBound<'a, 'b: 'a>( - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] &'a f32, - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] &'b f64 ); @@ -306,14 +268,8 @@ struct AddLifetimeParameterBoundWhereClause<'a, 'b>(&'a f32, &'b f64); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct AddLifetimeParameterBoundWhereClause<'a, 'b>( - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] &'a f32, - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] &'b f64) where 'b: 'a; @@ -334,16 +290,10 @@ struct AddTypeParameter(T1, T1); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct AddTypeParameter( // The field contains the parent's Generics, so it's dirty even though its // type hasn't changed. - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] T1, - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] T2 ); @@ -364,11 +314,7 @@ struct AddTypeParameterBound(T); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct AddTypeParameterBound( - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] T ); @@ -387,11 +333,7 @@ struct AddTypeParameterBoundWhereClause(T); #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] struct AddTypeParameterBoundWhereClause( - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] T ) where T: Sync; @@ -411,7 +353,6 @@ struct AddTypeParameterBoundWhereClause( #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] pub struct EmptyStruct; @@ -431,8 +372,6 @@ struct Visibility; #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub struct Visibility; struct ReferencedType1; @@ -455,11 +394,7 @@ mod tuple_struct_change_field_type_indirectly { #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] struct TupleStruct( - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] FieldType ); } @@ -482,11 +417,7 @@ mod record_struct_change_field_type_indirectly { #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] struct RecordStruct { - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] _x: FieldType } } @@ -514,8 +445,6 @@ mod change_trait_bound_indirectly { #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] struct Struct(T); } @@ -536,7 +465,5 @@ mod change_trait_bound_indirectly_in_where_clause { #[rustc_clean(label="TypeOfItem", cfg="cfail3")] #[rustc_clean(label="GenericsOfItem", cfg="cfail3")] #[rustc_clean(label="PredicatesOfItem", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] struct Struct(T) where T : Trait; } diff --git a/src/test/incremental/hashes/trait_defs.rs b/src/test/incremental/hashes/trait_defs.rs index 108363a464..0816d6e5f4 100644 --- a/src/test/incremental/hashes/trait_defs.rs +++ b/src/test/incremental/hashes/trait_defs.rs @@ -23,7 +23,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -39,7 +39,6 @@ trait TraitVisibility { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] pub trait TraitVisibility { } @@ -51,8 +50,6 @@ trait TraitUnsafety { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] unsafe trait TraitUnsafety { } @@ -65,8 +62,6 @@ trait TraitAddMethod { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub trait TraitAddMethod { fn method(); } @@ -82,8 +77,6 @@ trait TraitChangeMethodName { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeMethodName { fn methodChanged(); } @@ -99,13 +92,9 @@ trait TraitAddReturnType { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddReturnType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method() -> u32; } @@ -120,13 +109,9 @@ trait TraitChangeReturnType { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeReturnType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method() -> u64; } @@ -141,13 +126,9 @@ trait TraitAddParameterToMethod { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddParameterToMethod { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(a: u32); } @@ -163,22 +144,16 @@ trait TraitChangeMethodParameterName { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeMethodParameterName { // FIXME(#38501) This should preferably always be clean. #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(b: u32); #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn with_default(y: i32) {} } @@ -193,13 +168,9 @@ trait TraitChangeMethodParameterType { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeMethodParameterType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(a: i64); } @@ -214,13 +185,9 @@ trait TraitChangeMethodParameterTypeRef { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeMethodParameterTypeRef { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(a: &mut i32); } @@ -235,13 +202,9 @@ trait TraitChangeMethodParametersOrder { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeMethodParametersOrder { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(b: i64, a: i32); } @@ -256,13 +219,9 @@ trait TraitAddMethodAutoImplementation { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddMethodAutoImplementation { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method() { } } @@ -278,8 +237,6 @@ trait TraitChangeOrderOfMethods { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeOrderOfMethods { fn method1(); fn method0(); @@ -296,13 +253,9 @@ trait TraitChangeModeSelfRefToMut { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeModeSelfRefToMut { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(&mut self); } @@ -316,15 +269,11 @@ trait TraitChangeModeSelfOwnToMut: Sized { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeModeSelfOwnToMut: Sized { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(mut self) {} } @@ -338,13 +287,9 @@ trait TraitChangeModeSelfOwnToRef { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeModeSelfOwnToRef { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(&self); } @@ -359,13 +304,9 @@ trait TraitAddUnsafeModifier { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddUnsafeModifier { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] unsafe fn method(); } @@ -380,13 +321,9 @@ trait TraitAddExternModifier { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddExternModifier { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] extern fn method(); } @@ -401,13 +338,9 @@ trait TraitChangeExternCToRustIntrinsic { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeExternCToRustIntrinsic { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] extern "rust-intrinsic" fn method(); } @@ -422,13 +355,9 @@ trait TraitAddTypeParameterToMethod { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTypeParameterToMethod { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } @@ -443,13 +372,9 @@ trait TraitAddLifetimeParameterToMethod { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeParameterToMethod { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method<'a>(); } @@ -468,13 +393,9 @@ trait TraitAddTraitBoundToMethodTypeParameter { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTraitBoundToMethodTypeParameter { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } @@ -489,13 +410,9 @@ trait TraitAddBuiltinBoundToMethodTypeParameter { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddBuiltinBoundToMethodTypeParameter { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } @@ -510,13 +427,9 @@ trait TraitAddLifetimeBoundToMethodLifetimeParameter { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeBoundToMethodLifetimeParameter { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method<'a, 'b: 'a>(a: &'a u32, b: &'b u32); } @@ -531,13 +444,9 @@ trait TraitAddSecondTraitBoundToMethodTypeParameter { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondTraitBoundToMethodTypeParameter { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } @@ -552,13 +461,9 @@ trait TraitAddSecondBuiltinBoundToMethodTypeParameter { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondBuiltinBoundToMethodTypeParameter { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } @@ -573,13 +478,9 @@ trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method<'a, 'b, 'c: 'a + 'b>(a: &'a u32, b: &'b u32, c: &'c u32); } @@ -591,16 +492,12 @@ trait TraitAddAssociatedType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddAssociatedType { type Associated; @@ -623,13 +520,9 @@ trait TraitAddTraitBoundToAssociatedType { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTraitBoundToAssociatedType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] type Associated: ReferencedTrait0; fn method(); @@ -648,13 +541,9 @@ trait TraitAddLifetimeBoundToAssociatedType<'a> { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeBoundToAssociatedType<'a> { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] type Associated: 'a; fn method(); @@ -673,13 +562,9 @@ trait TraitAddDefaultToAssociatedType { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddDefaultToAssociatedType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] type Associated = ReferenceType0; fn method(); @@ -696,8 +581,6 @@ trait TraitAddAssociatedConstant { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddAssociatedConstant { const Value: u32; @@ -717,19 +600,13 @@ trait TraitAddInitializerToAssociatedConstant { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddInitializerToAssociatedConstant { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] const Value: u32 = 1; #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } @@ -746,19 +623,13 @@ trait TraitChangeTypeOfAssociatedConstant { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeTypeOfAssociatedConstant { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] const Value: f64; #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(); } @@ -771,8 +642,6 @@ trait TraitAddSuperTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSuperTrait : ReferencedTrait0 { } @@ -784,8 +653,6 @@ trait TraitAddBuiltiBound { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddBuiltiBound : Send { } @@ -797,8 +664,6 @@ trait TraitAddStaticLifetimeBound { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddStaticLifetimeBound : 'static { } @@ -810,8 +675,6 @@ trait TraitAddTraitAsSecondBound : ReferencedTrait0 { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTraitAsSecondBound : ReferencedTrait0 + ReferencedTrait1 { } #[cfg(cfail1)] @@ -820,8 +683,6 @@ trait TraitAddTraitAsSecondBoundFromBuiltin : Send { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { } @@ -833,8 +694,6 @@ trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 + Send { } #[cfg(cfail1)] @@ -843,8 +702,6 @@ trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin : Send { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { } @@ -856,8 +713,6 @@ trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 + 'static { } #[cfg(cfail1)] @@ -866,8 +721,6 @@ trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { } @@ -879,8 +732,6 @@ trait TraitAddTypeParameterToTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTypeParameterToTrait { } @@ -892,8 +743,6 @@ trait TraitAddLifetimeParameterToTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeParameterToTrait<'a> { } @@ -905,8 +754,6 @@ trait TraitAddTraitBoundToTypeParameterOfTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTraitBoundToTypeParameterOfTrait { } @@ -918,8 +765,6 @@ trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { } @@ -931,8 +776,6 @@ trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { } @@ -944,8 +787,6 @@ trait TraitAddBuiltinBoundToTypeParameterOfTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddBuiltinBoundToTypeParameterOfTrait { } @@ -957,8 +798,6 @@ trait TraitAddSecondTypeParameterToTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondTypeParameterToTrait { } @@ -970,8 +809,6 @@ trait TraitAddSecondLifetimeParameterToTrait<'a> { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { } @@ -983,8 +820,6 @@ trait TraitAddSecondTraitBoundToTypeParameterOfTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondTraitBoundToTypeParameterOfTrait { } @@ -996,8 +831,6 @@ trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a> { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { } @@ -1009,8 +842,6 @@ trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> { } @@ -1022,8 +853,6 @@ trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait { } @@ -1041,8 +870,6 @@ trait TraitAddTraitBoundToTypeParameterOfTraitWhere { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddTraitBoundToTypeParameterOfTraitWhere where T: ReferencedTrait0 { } @@ -1054,8 +881,6 @@ trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { } @@ -1067,8 +892,6 @@ trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b { } @@ -1080,8 +903,6 @@ trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere where T: Send { } @@ -1093,8 +914,6 @@ trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere where T: Referenced #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere where T: ReferencedTrait0 + ReferencedTrait1 { } @@ -1107,8 +926,6 @@ trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a + 'b { } @@ -1120,8 +937,6 @@ trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> whe #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b + 'c { } @@ -1133,8 +948,6 @@ trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere where T: Send { } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere where T: Send + Sync { } @@ -1147,13 +960,9 @@ mod change_return_type_of_method_indirectly_use { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeReturnType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method() -> ReturnType; } } @@ -1169,13 +978,9 @@ mod change_method_parameter_type_indirectly_by_use { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeArgType { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(a: ArgType); } } @@ -1191,13 +996,9 @@ mod change_method_parameter_type_bound_indirectly_by_use { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeBoundOfMethodTypeParameter { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(a: T); } } @@ -1214,13 +1015,9 @@ mod change_method_parameter_type_bound_indirectly_by_use_where { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeBoundOfMethodTypeParameterWhere { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method(a: T) where T: Bound; } } @@ -1236,8 +1033,6 @@ mod change_method_type_parameter_bound_indirectly { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeTraitBound { fn method(a: T); } @@ -1255,8 +1050,6 @@ mod change_method_type_parameter_bound_indirectly_where { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] trait TraitChangeTraitBoundWhere where T: Bound { fn method(a: T); } diff --git a/src/test/incremental/hashes/trait_impls.rs b/src/test/incremental/hashes/trait_impls.rs index 06c8eb6a87..a232883f7a 100644 --- a/src/test/incremental/hashes/trait_impls.rs +++ b/src/test/incremental/hashes/trait_impls.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] @@ -43,22 +43,16 @@ impl ChangeMethodNameTrait for Foo { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub trait ChangeMethodNameTrait { #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name2(); } #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeMethodNameTrait for Foo { #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name2() { } } @@ -78,15 +72,11 @@ impl ChangeMethodBodyTrait for Foo { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeMethodBodyTrait for Foo { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name() { () } @@ -109,15 +99,11 @@ impl ChangeMethodBodyTraitInlined for Foo { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeMethodBodyTraitInlined for Foo { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] #[rustc_dirty(label="HirBody", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] #[inline] fn method_name() { panic!() @@ -144,13 +130,9 @@ pub trait ChangeMethodSelfnessTrait { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeMethodSelfnessTrait for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name(&self) { () } @@ -176,13 +158,9 @@ pub trait RemoveMethodSelfnessTrait { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl RemoveMethodSelfnessTrait for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name() {} } @@ -206,13 +184,9 @@ pub trait ChangeMethodSelfmutnessTrait { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeMethodSelfmutnessTrait for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name(&mut self) {} } @@ -236,8 +210,6 @@ pub trait ChangeItemKindTrait { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeItemKindTrait for Foo { type name = (); } @@ -264,8 +236,6 @@ pub trait RemoveItemTrait { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl RemoveItemTrait for Foo { type TypeName = (); } @@ -291,8 +261,6 @@ pub trait AddItemTrait { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl AddItemTrait for Foo { type TypeName = (); fn method_name() { } @@ -313,21 +281,15 @@ impl ChangeHasValueTrait for Foo { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub trait ChangeHasValueTrait { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name() { } } #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeHasValueTrait for Foo { fn method_name() { } } @@ -346,13 +308,9 @@ impl AddDefaultTrait for Foo { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl AddDefaultTrait for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] default fn method_name() { } } @@ -376,13 +334,9 @@ pub trait AddArgumentTrait { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl AddArgumentTrait for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name(&self, _x: u32) { } } @@ -406,13 +360,9 @@ pub trait ChangeArgumentTypeTrait { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeArgumentTypeTrait for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn method_name(&self, _x: char) { } } @@ -433,13 +383,9 @@ impl AddTypeParameterToImpl for Bar { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl AddTypeParameterToImpl for Bar { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn id(t: T) -> T { t } } @@ -458,13 +404,9 @@ impl ChangeSelfTypeOfImpl for u32 { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl ChangeSelfTypeOfImpl for u64 { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn id(self) -> Self { self } } @@ -483,13 +425,9 @@ impl AddLifetimeBoundToImplParameter for T { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl AddLifetimeBoundToImplParameter for T { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn id(self) -> Self { self } } @@ -508,13 +446,9 @@ impl AddTraitBoundToImplParameter for T { #[cfg(not(cfail1))] #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_dirty(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl AddTraitBoundToImplParameter for T { #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_clean(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] fn id(self) -> Self { self } } @@ -533,13 +467,9 @@ impl AddNoMangleToMethod for Foo { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl AddNoMangleToMethod for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] #[no_mangle] fn add_no_mangle_to_method(&self) { } } @@ -558,13 +488,9 @@ impl MakeMethodInline for Foo { #[cfg(not(cfail1))] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] impl MakeMethodInline for Foo { #[rustc_dirty(label="Hir", cfg="cfail2")] #[rustc_clean(label="Hir", cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] #[inline] fn make_method_inline(&self) -> u8 { 0 } } diff --git a/src/test/incremental/hashes/type_defs.rs b/src/test/incremental/hashes/type_defs.rs index b0a93eea52..c5521d2fae 100644 --- a/src/test/incremental/hashes/type_defs.rs +++ b/src/test/incremental/hashes/type_defs.rs @@ -23,7 +23,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -37,7 +37,6 @@ type ChangePrimitiveType = i32; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type ChangePrimitiveType = i64; @@ -49,7 +48,6 @@ type ChangeMutability = &'static i32; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type ChangeMutability = &'static mut i32; @@ -61,7 +59,6 @@ type ChangeLifetime<'a> = (&'static i32, &'a i32); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type ChangeLifetime<'a> = (&'a i32, &'a i32); @@ -76,7 +73,6 @@ type ChangeTypeStruct = Struct1; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type ChangeTypeStruct = Struct2; @@ -88,7 +84,6 @@ type ChangeTypeTuple = (u32, u64); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type ChangeTypeTuple = (u32, i64); @@ -109,7 +104,6 @@ type ChangeTypeEnum = Enum1; #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type ChangeTypeEnum = Enum2; @@ -121,7 +115,6 @@ type AddTupleField = (i32, i64); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type AddTupleField = (i32, i64, i16); @@ -133,7 +126,6 @@ type ChangeNestedTupleField = (i32, (i64, i16)); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type ChangeNestedTupleField = (i32, (i64, i8)); @@ -145,7 +137,6 @@ type AddTypeParam = (T1, T1); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type AddTypeParam = (T1, T2); @@ -157,7 +148,6 @@ type AddTypeParamBound = (T1, u32); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type AddTypeParamBound = (T1, u32); @@ -169,7 +159,6 @@ type AddTypeParamBoundWhereClause where T1: Clone = (T1, u32); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type AddTypeParamBoundWhereClause where T1: Clone+Copy = (T1, u32); @@ -181,7 +170,6 @@ type AddLifetimeParam<'a> = (&'a u32, &'a u32); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type AddLifetimeParam<'a, 'b> = (&'a u32, &'b u32); @@ -193,7 +181,6 @@ type AddLifetimeParamBound<'a, 'b> = (&'a u32, &'b u32); #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type AddLifetimeParamBound<'a, 'b: 'a> = (&'a u32, &'b u32); @@ -207,7 +194,6 @@ where 'b: 'a #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail3")] type AddLifetimeParamBoundWhereClause<'a, 'b, 'c> where 'b: 'a, 'c: 'a @@ -227,8 +213,6 @@ mod change_trait_bound_indirectly { #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] type ChangeTraitBoundIndirectly = (T, u32); } @@ -243,7 +227,5 @@ mod change_trait_bound_indirectly_in_where_clause { #[rustc_clean(cfg="cfail2", except="Hir,HirBody")] #[rustc_clean(cfg="cfail3")] - #[rustc_metadata_dirty(cfg="cfail2")] - #[rustc_metadata_clean(cfg="cfail3")] type ChangeTraitBoundIndirectly where T : Trait = (T, u32); } diff --git a/src/test/incremental/hashes/unary_and_binary_exprs.rs b/src/test/incremental/hashes/unary_and_binary_exprs.rs index 351039c678..85f6ef60c5 100644 --- a/src/test/incremental/hashes/unary_and_binary_exprs.rs +++ b/src/test/incremental/hashes/unary_and_binary_exprs.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph -Z force-overflow-checks=off +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -34,8 +34,6 @@ pub fn const_negation() -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn const_negation() -> i32 { -1 } @@ -51,8 +49,6 @@ pub fn const_bitwise_not() -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn const_bitwise_not() -> i32 { !99 } @@ -68,8 +64,6 @@ pub fn var_negation(x: i32, y: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn var_negation(x: i32, y: i32) -> i32 { -y } @@ -85,8 +79,6 @@ pub fn var_bitwise_not(x: i32, y: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn var_bitwise_not(x: i32, y: i32) -> i32 { !y } @@ -102,8 +94,6 @@ pub fn var_deref(x: &i32, y: &i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated,TypeckTables", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn var_deref(x: &i32, y: &i32) -> i32 { *y } @@ -119,8 +109,6 @@ pub fn first_const_add() -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn first_const_add() -> i32 { 2 + 3 } @@ -136,8 +124,6 @@ pub fn second_const_add() -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn second_const_add() -> i32 { 1 + 3 } @@ -153,8 +139,6 @@ pub fn first_var_add(a: i32, b: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn first_var_add(a: i32, b: i32) -> i32 { b + 2 } @@ -170,8 +154,6 @@ pub fn second_var_add(a: i32, b: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn second_var_add(a: i32, b: i32) -> i32 { 1 + b } @@ -187,8 +169,6 @@ pub fn plus_to_minus(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn plus_to_minus(a: i32) -> i32 { 1 - a } @@ -204,8 +184,6 @@ pub fn plus_to_mult(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn plus_to_mult(a: i32) -> i32 { 1 * a } @@ -221,8 +199,6 @@ pub fn plus_to_div(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn plus_to_div(a: i32) -> i32 { 1 / a } @@ -238,8 +214,6 @@ pub fn plus_to_mod(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn plus_to_mod(a: i32) -> i32 { 1 % a } @@ -255,8 +229,6 @@ pub fn and_to_or(a: bool, b: bool) -> bool { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn and_to_or(a: bool, b: bool) -> bool { a || b } @@ -272,8 +244,6 @@ pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 { 1 | a } @@ -289,8 +259,6 @@ pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 { 1 ^ a } @@ -306,8 +274,6 @@ pub fn bitwise_and_to_lshift(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn bitwise_and_to_lshift(a: i32) -> i32 { a << 1 } @@ -323,8 +289,6 @@ pub fn bitwise_and_to_rshift(a: i32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn bitwise_and_to_rshift(a: i32) -> i32 { a >> 1 } @@ -340,8 +304,6 @@ pub fn eq_to_uneq(a: i32) -> bool { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn eq_to_uneq(a: i32) -> bool { a != 1 } @@ -357,8 +319,6 @@ pub fn eq_to_lt(a: i32) -> bool { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn eq_to_lt(a: i32) -> bool { a < 1 } @@ -374,8 +334,6 @@ pub fn eq_to_gt(a: i32) -> bool { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn eq_to_gt(a: i32) -> bool { a > 1 } @@ -391,8 +349,6 @@ pub fn eq_to_le(a: i32) -> bool { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn eq_to_le(a: i32) -> bool { a <= 1 } @@ -408,8 +364,6 @@ pub fn eq_to_ge(a: i32) -> bool { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn eq_to_ge(a: i32) -> bool { a >= 1 } @@ -427,8 +381,6 @@ pub fn type_cast(a: u8) -> u64 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated,TypeckTables", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn type_cast(a: u8) -> u64 { let b = a as u32; let c = b as u64; @@ -446,8 +398,6 @@ pub fn value_cast(a: u32) -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn value_cast(a: u32) -> i32 { 2 as i32 } @@ -466,8 +416,6 @@ pub fn lvalue() -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn lvalue() -> i32 { let mut x = 10; let mut y = 11; @@ -488,8 +436,6 @@ pub fn rvalue() -> i32 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn rvalue() -> i32 { let mut x = 10; x = 8; @@ -507,8 +453,6 @@ pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 { #[cfg(not(cfail1))] #[rustc_clean(except="HirBody,MirOptimized,MirValidated", cfg="cfail2")] #[rustc_clean(cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 { s[j] } diff --git a/src/test/incremental/hashes/while_let_loops.rs b/src/test/incremental/hashes/while_let_loops.rs index f4fd7e709b..d04ed03eb6 100644 --- a/src/test/incremental/hashes/while_let_loops.rs +++ b/src/test/incremental/hashes/while_let_loops.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -27,7 +27,7 @@ // Change loop body ------------------------------------------------------------ #[cfg(cfail1)] -fn change_loop_body() { +pub fn change_loop_body() { let mut _x = 0; while let Some(0u32) = None { _x = 1; @@ -36,13 +36,9 @@ fn change_loop_body() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_loop_body() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_loop_body() { let mut _x = 0; while let Some(0u32) = None { _x = 2; @@ -54,7 +50,7 @@ fn change_loop_body() { // Change loop body ------------------------------------------------------------ #[cfg(cfail1)] -fn change_loop_condition() { +pub fn change_loop_condition() { let mut _x = 0; while let Some(0u32) = None { _x = 1; @@ -63,13 +59,9 @@ fn change_loop_condition() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_loop_condition() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_loop_condition() { let mut _x = 0; while let Some(1u32) = None { _x = 1; @@ -81,7 +73,7 @@ fn change_loop_condition() { // Add break ------------------------------------------------------------------- #[cfg(cfail1)] -fn add_break() { +pub fn add_break() { let mut _x = 0; while let Some(0u32) = None { _x = 1; @@ -89,13 +81,9 @@ fn add_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn add_break() { let mut _x = 0; while let Some(0u32) = None { _x = 1; @@ -107,7 +95,7 @@ fn add_break() { // Add loop label -------------------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label() { +pub fn add_loop_label() { let mut _x = 0; while let Some(0u32) = None { _x = 1; @@ -116,13 +104,9 @@ fn add_loop_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label() { let mut _x = 0; 'label: while let Some(0u32) = None { _x = 1; @@ -134,7 +118,7 @@ fn add_loop_label() { // Add loop label to break ----------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_break() { +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while let Some(0u32) = None { _x = 1; @@ -143,13 +127,9 @@ fn add_loop_label_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while let Some(0u32) = None { _x = 1; @@ -161,7 +141,7 @@ fn add_loop_label_to_break() { // Change break label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_break_label() { +pub fn change_break_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { 'inner: while let Some(0u32) = None { @@ -172,13 +152,9 @@ fn change_break_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_break_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_break_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { 'inner: while let Some(0u32) = None { @@ -192,7 +168,7 @@ fn change_break_label() { // Add loop label to continue -------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_continue() { +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while let Some(0u32) = None { _x = 1; @@ -201,13 +177,9 @@ fn add_loop_label_to_continue() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_continue() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while let Some(0u32) = None { _x = 1; @@ -219,7 +191,7 @@ fn add_loop_label_to_continue() { // Change continue label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_continue_label() { +pub fn change_continue_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { 'inner: while let Some(0u32) = None { @@ -230,13 +202,9 @@ fn change_continue_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { 'inner: while let Some(0u32) = None { @@ -250,7 +218,7 @@ fn change_continue_label() { // Change continue to break ---------------------------------------------------- #[cfg(cfail1)] -fn change_continue_to_break() { +pub fn change_continue_to_break() { let mut _x = 0; while let Some(0u32) = None { _x = 1; @@ -259,13 +227,9 @@ fn change_continue_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_to_break() { let mut _x = 0; while let Some(0u32) = None { _x = 1; diff --git a/src/test/incremental/hashes/while_loops.rs b/src/test/incremental/hashes/while_loops.rs index aa70d7e9fc..7f2bbebde8 100644 --- a/src/test/incremental/hashes/while_loops.rs +++ b/src/test/incremental/hashes/while_loops.rs @@ -18,7 +18,7 @@ // must-compile-successfully // revisions: cfail1 cfail2 cfail3 -// compile-flags: -Z query-dep-graph +// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans #![allow(warnings)] #![feature(rustc_attrs)] @@ -27,7 +27,7 @@ // Change loop body ------------------------------------------------------------ #[cfg(cfail1)] -fn change_loop_body() { +pub fn change_loop_body() { let mut _x = 0; while true { _x = 1; @@ -36,13 +36,9 @@ fn change_loop_body() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_loop_body() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_loop_body() { let mut _x = 0; while true { _x = 2; @@ -54,7 +50,7 @@ fn change_loop_body() { // Change loop body ------------------------------------------------------------ #[cfg(cfail1)] -fn change_loop_condition() { +pub fn change_loop_condition() { let mut _x = 0; while true { _x = 1; @@ -63,13 +59,9 @@ fn change_loop_condition() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_loop_condition() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_loop_condition() { let mut _x = 0; while false { _x = 1; @@ -81,7 +73,7 @@ fn change_loop_condition() { // Add break ------------------------------------------------------------------- #[cfg(cfail1)] -fn add_break() { +pub fn add_break() { let mut _x = 0; while true { _x = 1; @@ -89,13 +81,9 @@ fn add_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")] +#[rustc_clean(cfg="cfail3")] +pub fn add_break() { let mut _x = 0; while true { _x = 1; @@ -107,7 +95,7 @@ fn add_break() { // Add loop label -------------------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label() { +pub fn add_loop_label() { let mut _x = 0; while true { _x = 1; @@ -116,13 +104,9 @@ fn add_loop_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label() { let mut _x = 0; 'label: while true { _x = 1; @@ -134,7 +118,7 @@ fn add_loop_label() { // Add loop label to break ----------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_break() { +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while true { _x = 1; @@ -143,13 +127,9 @@ fn add_loop_label_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while true { _x = 1; @@ -161,7 +141,7 @@ fn add_loop_label_to_break() { // Change break label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_break_label() { +pub fn change_break_label() { let mut _x = 0; 'outer: while true { 'inner: while true { @@ -172,13 +152,9 @@ fn change_break_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_break_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_break_label() { let mut _x = 0; 'outer: while true { 'inner: while true { @@ -192,7 +168,7 @@ fn change_break_label() { // Add loop label to continue -------------------------------------------------- #[cfg(cfail1)] -fn add_loop_label_to_continue() { +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while true { _x = 1; @@ -201,13 +177,9 @@ fn add_loop_label_to_continue() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn add_loop_label_to_continue() { +#[rustc_clean(cfg="cfail2", except="HirBody")] +#[rustc_clean(cfg="cfail3")] +pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while true { _x = 1; @@ -219,7 +191,7 @@ fn add_loop_label_to_continue() { // Change continue label ---------------------------------------------------------- #[cfg(cfail1)] -fn change_continue_label() { +pub fn change_continue_label() { let mut _x = 0; 'outer: while true { 'inner: while true { @@ -230,13 +202,9 @@ fn change_continue_label() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_label() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_label() { let mut _x = 0; 'outer: while true { 'inner: while true { @@ -250,7 +218,7 @@ fn change_continue_label() { // Change continue to break ---------------------------------------------------- #[cfg(cfail1)] -fn change_continue_to_break() { +pub fn change_continue_to_break() { let mut _x = 0; while true { _x = 1; @@ -259,13 +227,9 @@ fn change_continue_to_break() { } #[cfg(not(cfail1))] -#[rustc_clean(label="Hir", cfg="cfail2")] -#[rustc_clean(label="Hir", cfg="cfail3")] -#[rustc_dirty(label="HirBody", cfg="cfail2")] -#[rustc_clean(label="HirBody", cfg="cfail3")] -#[rustc_metadata_clean(cfg="cfail2")] -#[rustc_metadata_clean(cfg="cfail3")] -fn change_continue_to_break() { +#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")] +#[rustc_clean(cfg="cfail3")] +pub fn change_continue_to_break() { let mut _x = 0; while true { _x = 1; diff --git a/src/test/incremental/ich_method_call_trait_scope.rs b/src/test/incremental/ich_method_call_trait_scope.rs index 7f4e2b0f17..996c9ed21c 100644 --- a/src/test/incremental/ich_method_call_trait_scope.rs +++ b/src/test/incremental/ich_method_call_trait_scope.rs @@ -30,21 +30,10 @@ trait Trait2 { impl Trait2 for () { } -#[cfg(rpass1)] mod mod3 { + #[cfg(rpass1)] use Trait1; - - fn bar() { - ().method(); - } - - fn baz() { - 22; // no method call, traits in scope don't matter - } -} - -#[cfg(rpass2)] -mod mod3 { + #[cfg(rpass2)] use Trait2; #[rustc_clean(label="Hir", cfg="rpass2")] diff --git a/src/test/incremental/ich_nested_items.rs b/src/test/incremental/ich_nested_items.rs index 2e0f0ba083..8566a24c84 100644 --- a/src/test/incremental/ich_nested_items.rs +++ b/src/test/incremental/ich_nested_items.rs @@ -17,23 +17,18 @@ #![crate_type = "rlib"] #![feature(rustc_attrs)] -#[cfg(cfail1)] -pub fn foo() { - pub fn bar() { } - pub fn baz() { } -} - -#[cfg(cfail2)] #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_dirty(label="HirBody", cfg="cfail2")] pub fn foo() { - #[rustc_clean(label="Hir", cfg="cfail2")] - #[rustc_clean(label="HirBody", cfg="cfail2")] + #[cfg(cfail1)] pub fn baz() { } // order is different... #[rustc_clean(label="Hir", cfg="cfail2")] #[rustc_clean(label="HirBody", cfg="cfail2")] pub fn bar() { } // but that doesn't matter. + #[cfg(cfail2)] + pub fn baz() { } // order is different... + pub fn bap() { } // neither does adding a new item } diff --git a/src/test/incremental/ich_resolve_results.rs b/src/test/incremental/ich_resolve_results.rs index 49a88c530f..9e5b51f3e7 100644 --- a/src/test/incremental/ich_resolve_results.rs +++ b/src/test/incremental/ich_resolve_results.rs @@ -25,49 +25,29 @@ mod mod2 { pub struct Foo(pub i64); } -#[cfg(rpass1)] mod mod3 { + #[cfg(rpass1)] + use mod1::Foo; use test; + + // In rpass2 we move the use declaration. + #[cfg(rpass2)] use mod1::Foo; - fn in_expr() { - Foo(0); - } - - fn in_type() { - test::(); - } -} - -#[cfg(rpass2)] -mod mod3 { - use mod1::Foo; // <-- Nothing changed, but reordered! - use test; + // In rpass3 we let the declaration point to something else. + #[cfg(rpass3)] + use mod2::Foo; #[rustc_clean(label="Hir", cfg="rpass2")] #[rustc_clean(label="HirBody", cfg="rpass2")] - fn in_expr() { - Foo(0); - } - - #[rustc_clean(label="Hir", cfg="rpass2")] - #[rustc_clean(label="HirBody", cfg="rpass2")] - fn in_type() { - test::(); - } -} - -#[cfg(rpass3)] -mod mod3 { - use test; - use mod2::Foo; // <-- This changed! - #[rustc_clean(label="Hir", cfg="rpass3")] #[rustc_dirty(label="HirBody", cfg="rpass3")] fn in_expr() { Foo(0); } + #[rustc_clean(label="Hir", cfg="rpass2")] + #[rustc_clean(label="HirBody", cfg="rpass2")] #[rustc_clean(label="Hir", cfg="rpass3")] #[rustc_dirty(label="HirBody", cfg="rpass3")] fn in_type() { diff --git a/src/test/incremental/issue-42602.rs b/src/test/incremental/issue-42602.rs index cb2236d375..6afd794de8 100644 --- a/src/test/incremental/issue-42602.rs +++ b/src/test/incremental/issue-42602.rs @@ -16,8 +16,9 @@ // This was fixed by improving the resolution of the `FnOnce` trait // selection node. -// revisions:cfail1 +// revisions:cfail1 cfail2 cfail3 // compile-flags:-Zquery-dep-graph +// must-compile-successfully #![feature(rustc_attrs)] @@ -27,16 +28,24 @@ fn main() { } mod a { - #[rustc_if_this_changed(HirBody)] + #[cfg(cfail1)] pub fn foo() { let x = vec![1, 2, 3]; let v = || ::std::mem::drop(x); v(); } + + #[cfg(not(cfail1))] + pub fn foo() { + let x = vec![1, 2, 3, 4]; + let v = || ::std::mem::drop(x); + v(); + } } mod b { - #[rustc_then_this_would_need(TypeckTables)] //[cfail1]~ ERROR no path + #[rustc_clean(cfg="cfail2")] + #[rustc_clean(cfg="cfail3")] pub fn bar() { let x = vec![1, 2, 3]; let v = || ::std::mem::drop(x); diff --git a/src/test/incremental/remapped_paths_cc/main.rs b/src/test/incremental/remapped_paths_cc/main.rs index 432d8a1b44..ce7f5792ce 100644 --- a/src/test/incremental/remapped_paths_cc/main.rs +++ b/src/test/incremental/remapped_paths_cc/main.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions:rpass1 rpass2 rpass3 -// compile-flags: -Z query-dep-graph -g -Zincremental-cc +// compile-flags: -Z query-dep-graph -g // aux-build:extern_crate.rs // This test case makes sure that we detect if paths emitted into debuginfo diff --git a/src/test/incremental/source_loc_macros.rs b/src/test/incremental/source_loc_macros.rs index 36d1b3ecbc..3f669ae3fc 100644 --- a/src/test/incremental/source_loc_macros.rs +++ b/src/test/incremental/source_loc_macros.rs @@ -35,28 +35,30 @@ fn file_same() { let _ = file!(); } -#[cfg(rpass1)] -fn line_different() { - let _ = line!(); -} - -#[cfg(rpass2)] #[rustc_clean(label="Hir", cfg="rpass2")] #[rustc_dirty(label="HirBody", cfg="rpass2")] fn line_different() { - let _ = line!(); + #[cfg(rpass1)] + { + let _ = line!(); + } + #[cfg(rpass2)] + { + let _ = line!(); + } } -#[cfg(rpass1)] -fn col_different() { - let _ = column!(); -} - -#[cfg(rpass2)] #[rustc_clean(label="Hir", cfg="rpass2")] #[rustc_dirty(label="HirBody", cfg="rpass2")] fn col_different() { - let _ = column!(); + #[cfg(rpass1)] + { + let _ = column!(); + } + #[cfg(rpass2)] + { + let _ = column!(); + } } fn main() { diff --git a/src/test/incremental/spans_significant_w_panic.rs b/src/test/incremental/spans_significant_w_panic.rs index c0bf35e781..1fefec7a0a 100644 --- a/src/test/incremental/spans_significant_w_panic.rs +++ b/src/test/incremental/spans_significant_w_panic.rs @@ -23,8 +23,7 @@ pub fn main() { } #[cfg(rpass2)] -#[rustc_clean(label="Hir", cfg="rpass2")] -#[rustc_dirty(label="HirBody", cfg="rpass2")] +#[rustc_dirty(label="MirOptimized", cfg="rpass2")] pub fn main() { let _ = 0u8 + 1; } diff --git a/src/test/incremental/unchecked_dirty_clean_metadata.rs b/src/test/incremental/unchecked_dirty_clean_metadata.rs deleted file mode 100644 index 917c2c9dbc..0000000000 --- a/src/test/incremental/unchecked_dirty_clean_metadata.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// revisions: rpass1 cfail2 -// compile-flags: -Z query-dep-graph - -#![allow(warnings)] -#![feature(rustc_attrs)] - -// Sanity check for the dirty-clean system. We add -// #[rustc_metadata_dirty]/#[rustc_metadata_clean] attributes in places that -// are not checked and make sure that this causes an error. - -fn main() { - - #[rustc_metadata_dirty(cfg="cfail2")] - //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute - { - // empty block - } - - #[rustc_metadata_clean(cfg="cfail2")] - //[cfail2]~^ ERROR found unchecked #[rustc_dirty]/#[rustc_clean] attribute - { - // empty block - } -} - diff --git a/src/test/mir-opt/basic_assignment.rs b/src/test/mir-opt/basic_assignment.rs index e7263b4739..321c05c490 100644 --- a/src/test/mir-opt/basic_assignment.rs +++ b/src/test/mir-opt/basic_assignment.rs @@ -43,23 +43,23 @@ fn main() { // StorageLive(_2); // StorageLive(_3); // _3 = _1; -// _2 = _3; +// _2 = move _3; // StorageDead(_3); // StorageLive(_4); // _4 = std::option::Option>::None; // StorageLive(_5); // StorageLive(_6); -// _6 = _4; -// replace(_5 <- _6) -> [return: bb1, unwind: bb5]; +// _6 = move _4; +// replace(_5 <-move _6) -> [return: bb2, unwind: bb5]; // } // bb1: { -// drop(_6) -> [return: bb6, unwind: bb4]; -// } -// bb2: { // resume; // } +// bb2: { +// drop(_6) -> [return: bb6, unwind: bb4]; +// } // bb3: { -// drop(_4) -> bb2; +// drop(_4) -> bb1; // } // bb4: { // drop(_5) -> bb3; @@ -74,7 +74,7 @@ fn main() { // } // bb7: { // StorageDead(_5); -// drop(_4) -> bb8; +// drop(_4) -> [return: bb8, unwind: bb1]; // } // bb8: { // StorageDead(_4); diff --git a/src/test/mir-opt/box_expr.rs b/src/test/mir-opt/box_expr.rs index c782859b12..ed9c303a16 100644 --- a/src/test/mir-opt/box_expr.rs +++ b/src/test/mir-opt/box_expr.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-wasm32-bare compiled with panic=abort by default + #![feature(box_syntax)] fn main() { @@ -42,27 +44,27 @@ impl Drop for S { // StorageLive(_1); // StorageLive(_2); // _2 = Box(S); -// (*_2) = const S::new() -> [return: bb1, unwind: bb3]; +// (*_2) = const S::new() -> [return: bb2, unwind: bb3]; // } // // bb1: { -// _1 = _2; -// drop(_2) -> bb4; -// } -// -// bb2: { // resume; // } // +// bb2: { +// _1 = move _2; +// drop(_2) -> bb4; +// } +// // bb3: { -// drop(_2) -> bb2; +// drop(_2) -> bb1; // } // // bb4: { // StorageDead(_2); // StorageLive(_4); -// _4 = _1; -// _3 = const std::mem::drop(_4) -> [return: bb5, unwind: bb7]; +// _4 = move _1; +// _3 = const std::mem::drop(move _4) -> [return: bb5, unwind: bb7]; // } // // bb5: { @@ -70,7 +72,7 @@ impl Drop for S { // } // // bb6: { -// drop(_1) -> bb2; +// drop(_1) -> bb1; // } // // bb7: { diff --git a/src/test/mir-opt/combine_array_len.rs b/src/test/mir-opt/combine_array_len.rs new file mode 100644 index 0000000000..136c3493fa --- /dev/null +++ b/src/test/mir-opt/combine_array_len.rs @@ -0,0 +1,33 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn norm2(x: [f32; 2]) -> f32 { + let a = x[0]; + let b = x[1]; + a*a + b*b +} + +fn main() { + assert_eq!(norm2([3.0, 4.0]), 5.0*5.0); +} + +// END RUST SOURCE + +// START rustc.norm2.InstCombine.before.mir +// _5 = Len(_1); +// ... +// _10 = Len(_1); +// END rustc.norm2.InstCombine.before.mir + +// START rustc.norm2.InstCombine.after.mir +// _5 = const 2usize; +// ... +// _10 = const 2usize; +// END rustc.norm2.InstCombine.after.mir diff --git a/src/test/mir-opt/copy_propagation.rs b/src/test/mir-opt/copy_propagation.rs index 223c65737a..50d8a5154c 100644 --- a/src/test/mir-opt/copy_propagation.rs +++ b/src/test/mir-opt/copy_propagation.rs @@ -24,10 +24,10 @@ fn main() { // ... // _3 = _1; // ... -// _2 = _3; +// _2 = move _3; // ... // _4 = _2; -// _0 = _4; +// _0 = move _4; // ... // return; // } @@ -35,7 +35,7 @@ fn main() { // START rustc.test.CopyPropagation.after.mir // bb0: { // ... -// _0 = _1; +// _0 = move _1; // ... // return; // } diff --git a/src/test/mir-opt/copy_propagation_arg.rs b/src/test/mir-opt/copy_propagation_arg.rs index ae30b5fae8..35bb231df5 100644 --- a/src/test/mir-opt/copy_propagation_arg.rs +++ b/src/test/mir-opt/copy_propagation_arg.rs @@ -30,49 +30,50 @@ fn baz(mut x: i32) { x = x; } +fn arg_src(mut x: i32) -> i32 { + let y = x; + x = 123; // Don't propagate this assignment to `y` + y +} + fn main() { // Make sure the function actually gets instantiated. foo(0); bar(0); baz(0); + arg_src(0); } // END RUST SOURCE // START rustc.foo.CopyPropagation.before.mir // bb0: { -// StorageLive(_2); -// StorageLive(_3); +// ... // _3 = _1; -// _2 = const dummy(_3) -> bb1; +// _2 = const dummy(move _3) -> bb1; // } // bb1: { -// StorageDead(_3); -// _1 = _2; -// StorageDead(_2); -// _0 = (); -// return; +// ... +// _1 = move _2; +// ... // } // END rustc.foo.CopyPropagation.before.mir // START rustc.foo.CopyPropagation.after.mir // bb0: { -// StorageLive(_2); -// nop; -// nop; -// _2 = const dummy(_1) -> bb1; +// ... +// _3 = _1; +// _2 = const dummy(move _3) -> bb1; // } // bb1: { -// nop; -// _1 = _2; -// StorageDead(_2); -// _0 = (); -// return; +// ... +// _1 = move _2; +// ... // } // END rustc.foo.CopyPropagation.after.mir // START rustc.bar.CopyPropagation.before.mir // bb0: { // StorageLive(_3); // _3 = _1; -// _2 = const dummy(_3) -> bb1; +// _2 = const dummy(move _3) -> bb1; // } // bb1: { // StorageDead(_3); @@ -83,22 +84,21 @@ fn main() { // END rustc.bar.CopyPropagation.before.mir // START rustc.bar.CopyPropagation.after.mir // bb0: { -// nop; -// nop; -// _2 = const dummy(_1) -> bb1; +// ... +// _3 = _1; +// _2 = const dummy(move _3) -> bb1; // } // bb1: { -// nop; +// ... // _1 = const 5u8; -// _0 = (); -// return; +// ... // } // END rustc.bar.CopyPropagation.after.mir // START rustc.baz.CopyPropagation.before.mir // bb0: { // StorageLive(_2); // _2 = _1; -// _1 = _2; +// _1 = move _2; // StorageDead(_2); // _0 = (); // return; @@ -106,11 +106,35 @@ fn main() { // END rustc.baz.CopyPropagation.before.mir // START rustc.baz.CopyPropagation.after.mir // bb0: { -// nop; -// nop; -// nop; -// nop; -// _0 = (); -// return; +// ... +// _2 = _1; +// _1 = move _2; +// ... // } // END rustc.baz.CopyPropagation.after.mir +// START rustc.arg_src.CopyPropagation.before.mir +// bb0: { +// ... +// _3 = _1; +// _2 = move _3; +// ... +// _1 = const 123i32; +// ... +// _4 = _2; +// _0 = move _4; +// ... +// return; +// } +// END rustc.arg_src.CopyPropagation.before.mir +// START rustc.arg_src.CopyPropagation.after.mir +// bb0: { +// ... +// _3 = _1; +// ... +// _1 = const 123i32; +// ... +// _0 = move _3; +// ... +// return; +// } +// END rustc.arg_src.CopyPropagation.after.mir diff --git a/src/test/mir-opt/deaggregator_test.rs b/src/test/mir-opt/deaggregator_test.rs index d0f4e3bb60..c918bef129 100644 --- a/src/test/mir-opt/deaggregator_test.rs +++ b/src/test/mir-opt/deaggregator_test.rs @@ -29,7 +29,7 @@ fn main() { // ... // _2 = _1; // ... -// _0 = Baz { x: _2, y: const 0f32, z: const false }; +// _0 = Baz { x: move _2, y: const 0f32, z: const false }; // ... // return; // } @@ -39,7 +39,7 @@ fn main() { // ... // _2 = _1; // ... -// (_0.0: usize) = _2; +// (_0.0: usize) = move _2; // (_0.1: f32) = const 0f32; // (_0.2: bool) = const false; // ... diff --git a/src/test/mir-opt/deaggregator_test_enum.rs b/src/test/mir-opt/deaggregator_test_enum.rs index 9400ae5050..8af56b7c01 100644 --- a/src/test/mir-opt/deaggregator_test_enum.rs +++ b/src/test/mir-opt/deaggregator_test_enum.rs @@ -30,7 +30,7 @@ fn main() { // bb0: { // StorageLive(_2); // _2 = _1; -// _0 = Baz::Foo { x: _2 }; +// _0 = Baz::Foo { x: move _2 }; // StorageDead(_2); // return; // } @@ -39,7 +39,7 @@ fn main() { // bb0: { // StorageLive(_2); // _2 = _1; -// ((_0 as Foo).0: usize) = _2; +// ((_0 as Foo).0: usize) = move _2; // discriminant(_0) = 1; // StorageDead(_2); // return; diff --git a/src/test/mir-opt/deaggregator_test_enum_2.rs b/src/test/mir-opt/deaggregator_test_enum_2.rs index ab62164e80..b6505de22f 100644 --- a/src/test/mir-opt/deaggregator_test_enum_2.rs +++ b/src/test/mir-opt/deaggregator_test_enum_2.rs @@ -33,14 +33,14 @@ fn main() { // bb1: { // StorageLive(_4); // _4 = _2; -// _0 = Foo::A(_4,); +// _0 = Foo::A(move _4,); // StorageDead(_4); // goto -> bb3; // } // bb2: { // StorageLive(_5); // _5 = _2; -// _0 = Foo::B(_5,); +// _0 = Foo::B(move _5,); // StorageDead(_5); // goto -> bb3; // } @@ -49,7 +49,7 @@ fn main() { // bb1: { // StorageLive(_4); // _4 = _2; -// ((_0 as A).0: i32) = _4; +// ((_0 as A).0: i32) = move _4; // discriminant(_0) = 0; // StorageDead(_4); // goto -> bb3; @@ -57,7 +57,7 @@ fn main() { // bb2: { // StorageLive(_5); // _5 = _2; -// ((_0 as B).0: i32) = _5; +// ((_0 as B).0: i32) = move _5; // discriminant(_0) = 1; // StorageDead(_5); // goto -> bb3; diff --git a/src/test/mir-opt/deaggregator_test_multiple.rs b/src/test/mir-opt/deaggregator_test_multiple.rs index 91643e07ed..3a9a458fd4 100644 --- a/src/test/mir-opt/deaggregator_test_multiple.rs +++ b/src/test/mir-opt/deaggregator_test_multiple.rs @@ -30,12 +30,12 @@ fn main() { // ... // _3 = _1; // ... -// _2 = Foo::A(_3,); +// _2 = Foo::A(move _3,); // ... // _5 = _1; -// _4 = Foo::A(_5,); +// _4 = Foo::A(move _5,); // ... -// _0 = [_2, _4]; +// _0 = [move _2, move _4]; // ... // return; // } @@ -45,14 +45,14 @@ fn main() { // ... // _3 = _1; // ... -// ((_2 as A).0: i32) = _3; +// ((_2 as A).0: i32) = move _3; // discriminant(_2) = 0; // ... // _5 = _1; -// ((_4 as A).0: i32) = _5; +// ((_4 as A).0: i32) = move _5; // discriminant(_4) = 0; // ... -// _0 = [_2, _4]; +// _0 = [move _2, move _4]; // ... // return; // } diff --git a/src/test/mir-opt/end_region_2.rs b/src/test/mir-opt/end_region_2.rs index 5ee377569d..56c3e2a38a 100644 --- a/src/test/mir-opt/end_region_2.rs +++ b/src/test/mir-opt/end_region_2.rs @@ -46,7 +46,7 @@ fn main() { // _3 = &'23_1rs _2; // StorageLive(_5); // _5 = _2; -// switchInt(_5) -> [0u8: bb3, otherwise: bb2]; +// switchInt(move _5) -> [0u8: bb3, otherwise: bb2]; // } // bb2: { // _0 = (); diff --git a/src/test/mir-opt/end_region_3.rs b/src/test/mir-opt/end_region_3.rs index 1dbbd74cdf..8c0d56eba7 100644 --- a/src/test/mir-opt/end_region_3.rs +++ b/src/test/mir-opt/end_region_3.rs @@ -48,7 +48,7 @@ fn main() { // _3 = &'26_1rs _1; // StorageLive(_5); // _5 = _1; -// switchInt(_5) -> [0u8: bb3, otherwise: bb2]; +// switchInt(move _5) -> [0u8: bb3, otherwise: bb2]; // } // bb2: { // _0 = (); diff --git a/src/test/mir-opt/end_region_4.rs b/src/test/mir-opt/end_region_4.rs index 6b8018e4b2..ded818688d 100644 --- a/src/test/mir-opt/end_region_4.rs +++ b/src/test/mir-opt/end_region_4.rs @@ -51,9 +51,12 @@ fn foo(i: i32) { // _3 = &'26_2rs _2; // StorageLive(_5); // _5 = (*_3); -// _4 = const foo(_5) -> [return: bb1, unwind: bb3]; +// _4 = const foo(move _5) -> [return: bb2, unwind: bb3]; // } // bb1: { +// resume; +// } +// bb2: { // StorageDead(_5); // StorageLive(_6); // _6 = &'26_4rs _2; @@ -63,14 +66,11 @@ fn foo(i: i32) { // EndRegion('26_2rs); // StorageDead(_3); // StorageDead(_2); -// drop(_1) -> bb4; -// } -// bb2: { -// resume; +// drop(_1) -> [return: bb4, unwind: bb1]; // } // bb3: { // EndRegion('26_2rs); -// drop(_1) -> bb2; +// drop(_1) -> bb1; // } // bb4: { // StorageDead(_1); diff --git a/src/test/mir-opt/end_region_5.rs b/src/test/mir-opt/end_region_5.rs index 9a3cca54ae..1da97a997a 100644 --- a/src/test/mir-opt/end_region_5.rs +++ b/src/test/mir-opt/end_region_5.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength // Unwinding should EndRegion for in-scope borrows: Borrowing via by-ref closure. @@ -42,22 +41,22 @@ fn foo(f: F) where F: FnOnce() -> i32 { // StorageLive(_3); // StorageLive(_4); // _4 = &'14s _1; -// _3 = [closure@NodeId(18)] { d: _4 }; +// _3 = [closure@NodeId(18)] { d: move _4 }; // StorageDead(_4); -// _2 = const foo(_3) -> [return: bb1, unwind: bb3]; +// _2 = const foo(move _3) -> [return: bb2, unwind: bb3]; // } // bb1: { +// resume; +// } +// bb2: { // EndRegion('14s); // StorageDead(_3); // _0 = (); -// drop(_1) -> bb4; -// } -// bb2: { -// resume; +// drop(_1) -> [return: bb4, unwind: bb1]; // } // bb3: { // EndRegion('14s); -// drop(_1) -> bb2; +// drop(_1) -> bb1; // } // bb4: { // StorageDead(_1); @@ -74,7 +73,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // bb0: { // StorageLive(_2); // _2 = ((*(_1.0: &'14s D)).0: i32); -// _0 = _2; +// _0 = move _2; // StorageDead(_2); // return; // } diff --git a/src/test/mir-opt/end_region_6.rs b/src/test/mir-opt/end_region_6.rs index 7f0e16eaa0..dadc755eb8 100644 --- a/src/test/mir-opt/end_region_6.rs +++ b/src/test/mir-opt/end_region_6.rs @@ -41,22 +41,22 @@ fn foo(f: F) where F: FnOnce() -> i32 { // StorageLive(_3); // StorageLive(_4); // _4 = &'19s _1; -// _3 = [closure@NodeId(22)] { d: _4 }; +// _3 = [closure@NodeId(22)] { d: move _4 }; // StorageDead(_4); -// _2 = const foo(_3) -> [return: bb1, unwind: bb3]; +// _2 = const foo(move _3) -> [return: bb2, unwind: bb3]; // } // bb1: { +// resume; +// } +// bb2: { // EndRegion('19s); // StorageDead(_3); // _0 = (); -// drop(_1) -> bb4; -// } -// bb2: { -// resume; +// drop(_1) -> [return: bb4, unwind: bb1]; // } // bb3: { // EndRegion('19s); -// drop(_1) -> bb2; +// drop(_1) -> bb1; // } // bb4: { // StorageDead(_1); @@ -76,7 +76,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // _2 = &'15_0rs (*(_1.0: &'19s D)); // StorageLive(_3); // _3 = ((*_2).0: i32); -// _0 = _3; +// _0 = move _3; // StorageDead(_3); // EndRegion('15_0rs); // StorageDead(_2); diff --git a/src/test/mir-opt/end_region_7.rs b/src/test/mir-opt/end_region_7.rs index 7a17afee3e..1426174b48 100644 --- a/src/test/mir-opt/end_region_7.rs +++ b/src/test/mir-opt/end_region_7.rs @@ -40,8 +40,8 @@ fn foo(f: F) where F: FnOnce() -> i32 { // _1 = D::{{constructor}}(const 0i32,); // StorageLive(_3); // StorageLive(_4); -// _4 = _1; -// _3 = [closure@NodeId(22)] { d: _4 }; +// _4 = move _1; +// _3 = [closure@NodeId(22)] { d: move _4 }; // drop(_4) -> [return: bb4, unwind: bb3]; // } // bb1: { @@ -55,7 +55,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // } // bb4: { // StorageDead(_4); -// _2 = const foo(_3) -> [return: bb5, unwind: bb3]; +// _2 = const foo(move _3) -> [return: bb5, unwind: bb3]; // } // bb5: { // drop(_3) -> [return: bb6, unwind: bb2]; @@ -63,7 +63,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // bb6: { // StorageDead(_3); // _0 = (); -// drop(_1) -> bb7; +// drop(_1) -> [return: bb7, unwind: bb1]; // } // bb7: { // StorageDead(_1); @@ -84,13 +84,16 @@ fn foo(f: F) where F: FnOnce() -> i32 { // _2 = &'15_0rs (_1.0: D); // StorageLive(_3); // _3 = ((*_2).0: i32); -// _0 = _3; +// _0 = move _3; // StorageDead(_3); // EndRegion('15_0rs); // StorageDead(_2); -// drop(_1) -> bb1; +// drop(_1) -> [return: bb2, unwind: bb1]; // } // bb1: { +// resume; +// } +// bb2: { // return; // } // } diff --git a/src/test/mir-opt/end_region_8.rs b/src/test/mir-opt/end_region_8.rs index 1df3099510..405864aba9 100644 --- a/src/test/mir-opt/end_region_8.rs +++ b/src/test/mir-opt/end_region_8.rs @@ -46,23 +46,23 @@ fn foo(f: F) where F: FnOnce() -> i32 { // StorageLive(_4); // StorageLive(_5); // _5 = _2; -// _4 = [closure@NodeId(22)] { r: _5 }; +// _4 = [closure@NodeId(22)] { r: move _5 }; // StorageDead(_5); -// _3 = const foo(_4) -> [return: bb1, unwind: bb3]; +// _3 = const foo(move _4) -> [return: bb2, unwind: bb3]; // } // bb1: { +// resume; +// } +// bb2: { // StorageDead(_4); // _0 = (); // EndRegion('21_1rs); // StorageDead(_2); -// drop(_1) -> bb4; -// } -// bb2: { -// resume; +// drop(_1) -> [return: bb4, unwind: bb1]; // } // bb3: { // EndRegion('21_1rs); -// drop(_1) -> bb2; +// drop(_1) -> bb1; // } // bb4: { // StorageDead(_1); @@ -79,7 +79,7 @@ fn foo(f: F) where F: FnOnce() -> i32 { // bb0: { // StorageLive(_2); // _2 = ((*(_1.0: &'21_1rs D)).0: i32); -// _0 = _2; +// _0 = move _2; // StorageDead(_2); // return; // } diff --git a/src/test/mir-opt/end_region_9.rs b/src/test/mir-opt/end_region_9.rs index d348207730..b313e296ac 100644 --- a/src/test/mir-opt/end_region_9.rs +++ b/src/test/mir-opt/end_region_9.rs @@ -64,7 +64,7 @@ fn main() { // bb1: { // StorageLive(_7); // _7 = _1; -// switchInt(_7) -> [0u8: bb3, otherwise: bb2]; +// switchInt(move _7) -> [0u8: bb3, otherwise: bb2]; // } // bb2: { // _0 = (); diff --git a/src/test/mir-opt/end_region_cyclic.rs b/src/test/mir-opt/end_region_cyclic.rs index 5eada97ed2..37a6229feb 100644 --- a/src/test/mir-opt/end_region_cyclic.rs +++ b/src/test/mir-opt/end_region_cyclic.rs @@ -62,6 +62,7 @@ fn query() -> bool { true } // let mut _15: std::option::Option<&'35_0rs S<'35_0rs>>; // let mut _16: &'35_0rs S<'35_0rs>; // let mut _17: &'35_0rs S<'35_0rs>; +// // bb0: { // goto -> bb1; // } @@ -70,11 +71,14 @@ fn query() -> bool { true } // StorageLive(_3); // StorageLive(_4); // _4 = std::option::Option<&'35_0rs S<'35_0rs>>::None; -// _3 = const >::new(_4) -> bb2; +// _3 = const >::new(move _4) -> [return: bb3, unwind: bb2]; // } // bb2: { +// resume; +// } +// bb3: { // StorageDead(_4); -// _2 = S<'35_0rs> { r: _3 }; +// _2 = S<'35_0rs> { r: move _3 }; // StorageDead(_3); // StorageLive(_6); // _6 = &'16s (_2.0: std::cell::Cell>>); @@ -83,29 +87,29 @@ fn query() -> bool { true } // StorageLive(_9); // _9 = &'35_0rs _2; // _8 = &'35_0rs (*_9); -// _7 = std::option::Option<&'35_0rs S<'35_0rs>>::Some(_8,); +// _7 = std::option::Option<&'35_0rs S<'35_0rs>>::Some(move _8,); // StorageDead(_8); -// _5 = const >::set(_6, _7) -> bb3; +// _5 = const >::set(move _6, move _7) -> [return: bb4, unwind: bb2]; // } -// bb3: { +// bb4: { // EndRegion('16s); // StorageDead(_7); // StorageDead(_6); // StorageDead(_9); // StorageLive(_11); -// _11 = const query() -> bb4; -// } -// bb4: { -// switchInt(_11) -> [0u8: bb6, otherwise: bb5]; +// _11 = const query() -> [return: bb5, unwind: bb2]; // } // bb5: { +// switchInt(move _11) -> [0u8: bb7, otherwise: bb6]; +// } +// bb6: { // _0 = (); // StorageDead(_11); // EndRegion('35_0rs); // StorageDead(_2); // return; // } -// bb6: { +// bb7: { // _10 = (); // StorageDead(_11); // StorageLive(_14); @@ -115,11 +119,11 @@ fn query() -> bool { true } // StorageLive(_17); // _17 = &'35_0rs _2; // _16 = &'35_0rs (*_17); -// _15 = std::option::Option<&'35_0rs S<'35_0rs>>::Some(_16,); +// _15 = std::option::Option<&'35_0rs S<'35_0rs>>::Some(move _16,); // StorageDead(_16); -// _13 = const >::set(_14, _15) -> bb7; +// _13 = const >::set(move _14, move _15) -> [return: bb8, unwind: bb2]; // } -// bb7: { +// bb8: { // EndRegion('33s); // StorageDead(_15); // StorageDead(_14); diff --git a/src/test/mir-opt/end_region_destruction_extents_1.rs b/src/test/mir-opt/end_region_destruction_extents_1.rs index 12d14df47d..69c5cdccf4 100644 --- a/src/test/mir-opt/end_region_destruction_extents_1.rs +++ b/src/test/mir-opt/end_region_destruction_extents_1.rs @@ -92,17 +92,21 @@ unsafe impl<'a, #[may_dangle] 'b> Drop for D1<'a, 'b> { // _9 = S1::{{constructor}}(const "dang1",); // _8 = &'10s _9; // _7 = &'10s (*_8); -// _3 = D1<'12ds, '10s>::{{constructor}}(_4, _7); +// _3 = D1<'12ds, '10s>::{{constructor}}(move _4, move _7); // EndRegion('10s); // StorageDead(_7); // StorageDead(_4); // _2 = (_3.0: &'12ds S1); -// _1 = _2; +// _1 = move _2; // StorageDead(_2); -// drop(_3) -> bb1; +// drop(_3) -> [return: bb2, unwind: bb1]; // } // // bb1: { +// resume; +// } +// +// bb2: { // StorageDead(_3); // StorageDead(_8); // StorageDead(_9); @@ -139,17 +143,21 @@ unsafe impl<'a, #[may_dangle] 'b> Drop for D1<'a, 'b> { // StorageLive(_8); // _8 = promoted[0]; // _7 = &'10s (*_8); -// _3 = D1<'12ds, '10s>::{{constructor}}(_4, _7); +// _3 = D1<'12ds, '10s>::{{constructor}}(move _4, move _7); // EndRegion('10s); // StorageDead(_7); // StorageDead(_4); // _2 = (_3.0: &'12ds S1); -// _1 = _2; +// _1 = move _2; // StorageDead(_2); -// drop(_3) -> bb1; +// drop(_3) -> [return: bb2, unwind: bb1]; // } // // bb1: { +// resume; +// } +// +// bb2: { // StorageDead(_3); // StorageDead(_8); // StorageDead(_5); diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline-closure-borrows-arg.rs new file mode 100644 index 0000000000..3fb54f9098 --- /dev/null +++ b/src/test/mir-opt/inline-closure-borrows-arg.rs @@ -0,0 +1,50 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z span_free_formats + +// Tests that MIR inliner can handle closure arguments, +// even when (#45894) + +fn main() { + println!("{}", foo(0, &14)); +} + +fn foo(_t: T, q: &i32) -> i32 { + let x = |r: &i32, _s: &i32| { + let variable = &*r; + *variable + }; + x(q, q) +} + +// END RUST SOURCE +// START rustc.foo.Inline.after.mir +// ... +// bb0: { +// ... +// _3 = [closure@NodeId(39)]; +// ... +// _4 = &_3; +// ... +// _6 = &(*_2); +// ... +// _7 = &(*_2); +// _5 = (move _6, move _7); +// _9 = move (_5.0: &i32); +// _10 = move (_5.1: &i32); +// StorageLive(_8); +// _8 = (*_9); +// _0 = move _8; +// ... +// return; +// } +// ... +// END rustc.foo.Inline.after.mir diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline-closure.rs index 3f3428714d..dc8ff13c03 100644 --- a/src/test/mir-opt/inline-closure.rs +++ b/src/test/mir-opt/inline-closure.rs @@ -33,10 +33,12 @@ fn foo(_t: T, q: i32) -> i32 { // _6 = _2; // ... // _7 = _2; -// _5 = (_6, _7); -// _0 = (_5.0: i32); +// _5 = (move _6, move _7); +// _8 = move (_5.0: i32); +// _9 = move (_5.1: i32); +// _0 = move _8; // ... // return; // } // ... -// END rustc.foo.Inline.after.mir \ No newline at end of file +// END rustc.foo.Inline.after.mir diff --git a/src/test/mir-opt/issue-38669.rs b/src/test/mir-opt/issue-38669.rs index 9415e140d8..b5c188cf83 100644 --- a/src/test/mir-opt/issue-38669.rs +++ b/src/test/mir-opt/issue-38669.rs @@ -31,7 +31,7 @@ fn main() { // bb1: { // StorageLive(_4); // _4 = _1; -// switchInt(_4) -> [0u8: bb3, otherwise: bb2]; +// switchInt(move _4) -> [0u8: bb3, otherwise: bb2]; // } // // bb2: { diff --git a/src/test/mir-opt/issue-41110.rs b/src/test/mir-opt/issue-41110.rs index b409d1fb66..f7f447cc6b 100644 --- a/src/test/mir-opt/issue-41110.rs +++ b/src/test/mir-opt/issue-41110.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-wasm32-bare compiled with panic=abort by default + // check that we don't emit multiple drop flags when they are not needed. fn main() { diff --git a/src/test/mir-opt/issue-41697.rs b/src/test/mir-opt/issue-41697.rs index 47eeffe35a..4d2ba5e2b1 100644 --- a/src/test/mir-opt/issue-41697.rs +++ b/src/test/mir-opt/issue-41697.rs @@ -12,7 +12,7 @@ // artificial cycles: during type-checking, we had to get the MIR for // the constant expressions in `[u8; 2]`, which in turn would trigger // an attempt to get the item-path, which in turn would request the -// types of the impl, which would trigger a cycle. We supressed this +// types of the impl, which would trigger a cycle. We suppressed this // cycle now by forcing mir-dump to avoid asking for types of an impl. #![feature(rustc_attrs)] diff --git a/src/test/mir-opt/lower_128bit_debug_test.rs b/src/test/mir-opt/lower_128bit_debug_test.rs new file mode 100644 index 0000000000..1752445a14 --- /dev/null +++ b/src/test/mir-opt/lower_128bit_debug_test.rs @@ -0,0 +1,239 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// asmjs can't even pass i128 as arguments or return values, so ignore it. +// this will hopefully be fixed by the LLVM 5 upgrade (#43370) +// ignore-asmjs +// ignore-emscripten + +// compile-flags: -Z lower_128bit_ops=yes -C debug_assertions=yes + +#![feature(i128_type)] +#![feature(const_fn)] + +static TEST_SIGNED: i128 = const_signed(-222); +static TEST_UNSIGNED: u128 = const_unsigned(200); + +const fn const_signed(mut x: i128) -> i128 { + ((((((x + 1) - 2) * 3) / 4) % 5) << 6) >> 7 +} + +const fn const_unsigned(mut x: u128) -> u128 { + ((((((x + 1) - 2) * 3) / 4) % 5) << 6) >> 7 +} + +fn test_signed(mut x: i128) -> i128 { + x += 1; + x -= 2; + x *= 3; + x /= 4; + x %= 5; + x <<= 6; + x >>= 7; + x +} + +fn test_unsigned(mut x: u128) -> u128 { + x += 1; + x -= 2; + x *= 3; + x /= 4; + x %= 5; + x <<= 6; + x >>= 7; + x +} + +fn check(x: i128, y: u128) { + assert_eq!(test_signed(x), -1); + assert_eq!(const_signed(x), -1); + assert_eq!(TEST_SIGNED, -1); + assert_eq!(test_unsigned(y), 2); + assert_eq!(const_unsigned(y), 2); + assert_eq!(TEST_UNSIGNED, 2); +} + +fn main() { + check(-222, 200); +} + +// END RUST SOURCE + +// START rustc.const_signed.Lower128Bit.after.mir +// _8 = _1; +// _9 = const compiler_builtins::int::addsub::rust_i128_addo(move _8, const 1i128) -> bb10; +// ... +// _7 = move (_9.0: i128); +// ... +// _10 = const compiler_builtins::int::addsub::rust_i128_subo(move _7, const 2i128) -> bb11; +// ... +// _6 = move (_10.0: i128); +// ... +// _11 = const compiler_builtins::int::mul::rust_i128_mulo(move _6, const 3i128) -> bb12; +// ... +// _5 = move (_11.0: i128); +// ... +// _12 = Eq(const 4i128, const 0i128); +// assert(!move _12, "attempt to divide by zero") -> bb4; +// ... +// _13 = Eq(const 4i128, const -1i128); +// _14 = Eq(_5, const -170141183460469231731687303715884105728i128); +// _15 = BitAnd(move _13, move _14); +// assert(!move _15, "attempt to divide with overflow") -> bb5; +// ... +// _4 = const compiler_builtins::int::sdiv::rust_i128_div(move _5, const 4i128) -> bb13; +// ... +// _17 = Eq(const 5i128, const -1i128); +// _18 = Eq(_4, const -170141183460469231731687303715884105728i128); +// _19 = BitAnd(move _17, move _18); +// assert(!move _19, "attempt to calculate the remainder with overflow") -> bb7; +// ... +// _3 = const compiler_builtins::int::sdiv::rust_i128_rem(move _4, const 5i128) -> bb15; +// ... +// _2 = move (_20.0: i128); +// ... +// _23 = const 7i32 as u128 (Misc); +// _21 = const compiler_builtins::int::shift::rust_i128_shro(move _2, move _23) -> bb16; +// ... +// _0 = move (_21.0: i128); +// ... +// assert(!move (_9.1: bool), "attempt to add with overflow") -> bb1; +// ... +// assert(!move (_10.1: bool), "attempt to subtract with overflow") -> bb2; +// ... +// assert(!move (_11.1: bool), "attempt to multiply with overflow") -> bb3; +// ... +// _16 = Eq(const 5i128, const 0i128); +// assert(!move _16, "attempt to calculate the remainder with a divisor of zero") -> bb6; +// ... +// assert(!move (_20.1: bool), "attempt to shift left with overflow") -> bb8; +// ... +// _22 = const 6i32 as u128 (Misc); +// _20 = const compiler_builtins::int::shift::rust_i128_shlo(move _3, move _22) -> bb14; +// ... +// assert(!move (_21.1: bool), "attempt to shift right with overflow") -> bb9; +// END rustc.const_signed.Lower128Bit.after.mir + +// START rustc.const_unsigned.Lower128Bit.after.mir +// _8 = _1; +// _9 = const compiler_builtins::int::addsub::rust_u128_addo(move _8, const 1u128) -> bb8; +// ... +// _7 = move (_9.0: u128); +// ... +// _10 = const compiler_builtins::int::addsub::rust_u128_subo(move _7, const 2u128) -> bb9; +// ... +// _6 = move (_10.0: u128); +// ... +// _11 = const compiler_builtins::int::mul::rust_u128_mulo(move _6, const 3u128) -> bb10; +// ... +// _5 = move (_11.0: u128); +// ... +// _12 = Eq(const 4u128, const 0u128); +// assert(!move _12, "attempt to divide by zero") -> bb4; +// ... +// _4 = const compiler_builtins::int::udiv::rust_u128_div(move _5, const 4u128) -> bb11; +// ... +// _3 = const compiler_builtins::int::udiv::rust_u128_rem(move _4, const 5u128) -> bb13; +// ... +// _2 = move (_14.0: u128); +// ... +// _17 = const 7i32 as u128 (Misc); +// _15 = const compiler_builtins::int::shift::rust_u128_shro(move _2, move _17) -> bb14; +// ... +// _0 = move (_15.0: u128); +// ... +// assert(!move (_9.1: bool), "attempt to add with overflow") -> bb1; +// ... +// assert(!move (_10.1: bool), "attempt to subtract with overflow") -> bb2; +// ... +// assert(!move (_11.1: bool), "attempt to multiply with overflow") -> bb3; +// ... +// _13 = Eq(const 5u128, const 0u128); +// assert(!move _13, "attempt to calculate the remainder with a divisor of zero") -> bb5; +// ... +// assert(!move (_14.1: bool), "attempt to shift left with overflow") -> bb6; +// ... +// _16 = const 6i32 as u128 (Misc); +// _14 = const compiler_builtins::int::shift::rust_u128_shlo(move _3, move _16) -> bb12; +// ... +// assert(!move (_15.1: bool), "attempt to shift right with overflow") -> bb7; +// END rustc.const_unsigned.Lower128Bit.after.mir + +// START rustc.test_signed.Lower128Bit.after.mir +// _2 = const compiler_builtins::int::addsub::rust_i128_addo(_1, const 1i128) -> bb10; +// ... +// _1 = move (_2.0: i128); +// _3 = const compiler_builtins::int::addsub::rust_i128_subo(_1, const 2i128) -> bb11; +// ... +// _1 = move (_3.0: i128); +// _4 = const compiler_builtins::int::mul::rust_i128_mulo(_1, const 3i128) -> bb12; +// ... +// _1 = move (_4.0: i128); +// ... +// _1 = const compiler_builtins::int::sdiv::rust_i128_div(_1, const 4i128) -> bb13; +// ... +// _1 = const compiler_builtins::int::sdiv::rust_i128_rem(_1, const 5i128) -> bb15; +// ... +// _1 = move (_13.0: i128); +// ... +// _17 = const 7i32 as u128 (Misc); +// _14 = const compiler_builtins::int::shift::rust_i128_shro(_1, move _17) -> bb16; +// ... +// _1 = move (_14.0: i128); +// ... +// assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; +// ... +// assert(!move (_3.1: bool), "attempt to subtract with overflow") -> bb2; +// ... +// assert(!move (_4.1: bool), "attempt to multiply with overflow") -> bb3; +// ... +// assert(!move (_13.1: bool), "attempt to shift left with overflow") -> bb8; +// ... +// _16 = const 6i32 as u128 (Misc); +// _13 = const compiler_builtins::int::shift::rust_i128_shlo(_1, move _16) -> bb14; +// ... +// assert(!move (_14.1: bool), "attempt to shift right with overflow") -> bb9; +// END rustc.test_signed.Lower128Bit.after.mir + +// START rustc.test_unsigned.Lower128Bit.after.mir +// _2 = const compiler_builtins::int::addsub::rust_u128_addo(_1, const 1u128) -> bb8; +// ... +// _1 = move (_2.0: u128); +// _3 = const compiler_builtins::int::addsub::rust_u128_subo(_1, const 2u128) -> bb9; +// ... +// _1 = move (_3.0: u128); +// _4 = const compiler_builtins::int::mul::rust_u128_mulo(_1, const 3u128) -> bb10; +// ... +// _1 = move (_4.0: u128); +// ... +// _1 = const compiler_builtins::int::udiv::rust_u128_div(_1, const 4u128) -> bb11; +// ... +// _1 = const compiler_builtins::int::udiv::rust_u128_rem(_1, const 5u128) -> bb13; +// ... +// _1 = move (_7.0: u128); +// ... +// _11 = const 7i32 as u128 (Misc); +// _8 = const compiler_builtins::int::shift::rust_u128_shro(_1, move _11) -> bb14; +// ... +// _1 = move (_8.0: u128); +// ... +// assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; +// ... +// assert(!move (_3.1: bool), "attempt to subtract with overflow") -> bb2; +// ... +// assert(!move (_4.1: bool), "attempt to multiply with overflow") -> bb3; +// ... +// assert(!move (_7.1: bool), "attempt to shift left with overflow") -> bb6; +// ... +// _10 = const 6i32 as u128 (Misc); +// _7 = const compiler_builtins::int::shift::rust_u128_shlo(_1, move _10) -> bb12; +// ... +// assert(!move (_8.1: bool), "attempt to shift right with overflow") -> bb7; +// END rustc.test_unsigned.Lower128Bit.after.mir diff --git a/src/test/mir-opt/lower_128bit_test.rs b/src/test/mir-opt/lower_128bit_test.rs new file mode 100644 index 0000000000..4058eaef9b --- /dev/null +++ b/src/test/mir-opt/lower_128bit_test.rs @@ -0,0 +1,203 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// asmjs can't even pass i128 as arguments or return values, so ignore it. +// this will hopefully be fixed by the LLVM 5 upgrade (#43370) +// ignore-asmjs +// ignore-emscripten + +// compile-flags: -Z lower_128bit_ops=yes -C debug_assertions=no + +#![feature(i128_type)] +#![feature(const_fn)] + +static TEST_SIGNED: i128 = const_signed(-222); +static TEST_UNSIGNED: u128 = const_unsigned(200); + +const fn const_signed(mut x: i128) -> i128 { + ((((((x + 1) - 2) * 3) / 4) % 5) << 6) >> 7 +} + +const fn const_unsigned(mut x: u128) -> u128 { + ((((((x + 1) - 2) * 3) / 4) % 5) << 6) >> 7 +} + +fn test_signed(mut x: i128) -> i128 { + x += 1; + x -= 2; + x *= 3; + x /= 4; + x %= 5; + x <<= 6; + x >>= 7; + x +} + +fn test_unsigned(mut x: u128) -> u128 { + x += 1; + x -= 2; + x *= 3; + x /= 4; + x %= 5; + x <<= 6; + x >>= 7; + x +} + +fn check(x: i128, y: u128) { + assert_eq!(test_signed(x), -1); + assert_eq!(const_signed(x), -1); + assert_eq!(TEST_SIGNED, -1); + assert_eq!(test_unsigned(y), 2); + assert_eq!(const_unsigned(y), 2); + assert_eq!(TEST_UNSIGNED, 2); +} + +fn main() { + check(-222, 200); +} + +// END RUST SOURCE + +// START rustc.const_signed.Lower128Bit.after.mir +// _8 = _1; +// _9 = const compiler_builtins::int::addsub::rust_i128_addo(move _8, const 1i128) -> bb10; +// ... +// _7 = move (_9.0: i128); +// ... +// _10 = const compiler_builtins::int::addsub::rust_i128_subo(move _7, const 2i128) -> bb11; +// ... +// _6 = move (_10.0: i128); +// ... +// _11 = const compiler_builtins::int::mul::rust_i128_mulo(move _6, const 3i128) -> bb12; +// ... +// _5 = move (_11.0: i128); +// ... +// _12 = Eq(const 4i128, const 0i128); +// assert(!move _12, "attempt to divide by zero") -> bb4; +// ... +// _13 = Eq(const 4i128, const -1i128); +// _14 = Eq(_5, const -170141183460469231731687303715884105728i128); +// _15 = BitAnd(move _13, move _14); +// assert(!move _15, "attempt to divide with overflow") -> bb5; +// ... +// _4 = const compiler_builtins::int::sdiv::rust_i128_div(move _5, const 4i128) -> bb13; +// ... +// _17 = Eq(const 5i128, const -1i128); +// _18 = Eq(_4, const -170141183460469231731687303715884105728i128); +// _19 = BitAnd(move _17, move _18); +// assert(!move _19, "attempt to calculate the remainder with overflow") -> bb7; +// ... +// _3 = const compiler_builtins::int::sdiv::rust_i128_rem(move _4, const 5i128) -> bb15; +// ... +// _2 = move (_20.0: i128); +// ... +// _23 = const 7i32 as u128 (Misc); +// _21 = const compiler_builtins::int::shift::rust_i128_shro(move _2, move _23) -> bb16; +// ... +// _0 = move (_21.0: i128); +// ... +// assert(!move (_9.1: bool), "attempt to add with overflow") -> bb1; +// ... +// assert(!move (_10.1: bool), "attempt to subtract with overflow") -> bb2; +// ... +// assert(!move (_11.1: bool), "attempt to multiply with overflow") -> bb3; +// ... +// _16 = Eq(const 5i128, const 0i128); +// assert(!move _16, "attempt to calculate the remainder with a divisor of zero") -> bb6; +// ... +// assert(!move (_20.1: bool), "attempt to shift left with overflow") -> bb8; +// ... +// _22 = const 6i32 as u128 (Misc); +// _20 = const compiler_builtins::int::shift::rust_i128_shlo(move _3, move _22) -> bb14; +// ... +// assert(!move (_21.1: bool), "attempt to shift right with overflow") -> bb9; +// END rustc.const_signed.Lower128Bit.after.mir + +// START rustc.const_unsigned.Lower128Bit.after.mir +// _8 = _1; +// _9 = const compiler_builtins::int::addsub::rust_u128_addo(move _8, const 1u128) -> bb8; +// ... +// _7 = move (_9.0: u128); +// ... +// _10 = const compiler_builtins::int::addsub::rust_u128_subo(move _7, const 2u128) -> bb9; +// ... +// _6 = move (_10.0: u128); +// ... +// _11 = const compiler_builtins::int::mul::rust_u128_mulo(move _6, const 3u128) -> bb10; +// ... +// _5 = move (_11.0: u128); +// ... +// _12 = Eq(const 4u128, const 0u128); +// assert(!move _12, "attempt to divide by zero") -> bb4; +// ... +// _4 = const compiler_builtins::int::udiv::rust_u128_div(move _5, const 4u128) -> bb11; +// ... +// _3 = const compiler_builtins::int::udiv::rust_u128_rem(move _4, const 5u128) -> bb13; +// ... +// _2 = move (_14.0: u128); +// ... +// _17 = const 7i32 as u128 (Misc); +// _15 = const compiler_builtins::int::shift::rust_u128_shro(move _2, move _17) -> bb14; +// ... +// _0 = move (_15.0: u128); +// ... +// assert(!move (_9.1: bool), "attempt to add with overflow") -> bb1; +// ... +// assert(!move (_10.1: bool), "attempt to subtract with overflow") -> bb2; +// ... +// assert(!move (_11.1: bool), "attempt to multiply with overflow") -> bb3; +// ... +// _13 = Eq(const 5u128, const 0u128); +// assert(!move _13, "attempt to calculate the remainder with a divisor of zero") -> bb5; +// ... +// assert(!move (_14.1: bool), "attempt to shift left with overflow") -> bb6; +// ... +// _16 = const 6i32 as u128 (Misc); +// _14 = const compiler_builtins::int::shift::rust_u128_shlo(move _3, move _16) -> bb12; +// ... +// assert(!move (_15.1: bool), "attempt to shift right with overflow") -> bb7; +// END rustc.const_unsigned.Lower128Bit.after.mir + +// START rustc.test_signed.Lower128Bit.after.mir +// _1 = const compiler_builtins::int::addsub::rust_i128_add(_1, const 1i128) -> bb7; +// ... +// _1 = const compiler_builtins::int::sdiv::rust_i128_div(_1, const 4i128) -> bb8; +// ... +// _1 = const compiler_builtins::int::sdiv::rust_i128_rem(_1, const 5i128) -> bb11; +// ... +// _1 = const compiler_builtins::int::mul::rust_i128_mul(_1, const 3i128) -> bb5; +// ... +// _1 = const compiler_builtins::int::addsub::rust_i128_sub(_1, const 2i128) -> bb6; +// ... +// _11 = const 7i32 as u32 (Misc); +// _1 = const compiler_builtins::int::shift::rust_i128_shr(_1, move _11) -> bb9; +// ... +// _12 = const 6i32 as u32 (Misc); +// _1 = const compiler_builtins::int::shift::rust_i128_shl(_1, move _12) -> bb10; +// END rustc.test_signed.Lower128Bit.after.mir + +// START rustc.test_unsigned.Lower128Bit.after.mir +// _1 = const compiler_builtins::int::addsub::rust_u128_add(_1, const 1u128) -> bb5; +// ... +// _1 = const compiler_builtins::int::udiv::rust_u128_div(_1, const 4u128) -> bb6; +// ... +// _1 = const compiler_builtins::int::udiv::rust_u128_rem(_1, const 5u128) -> bb9; +// ... +// _1 = const compiler_builtins::int::mul::rust_u128_mul(_1, const 3u128) -> bb3; +// ... +// _1 = const compiler_builtins::int::addsub::rust_u128_sub(_1, const 2u128) -> bb4; +// ... +// _5 = const 7i32 as u32 (Misc); +// _1 = const compiler_builtins::int::shift::rust_u128_shr(_1, move _5) -> bb7; +// ... +// _6 = const 6i32 as u32 (Misc); +// _1 = const compiler_builtins::int::shift::rust_u128_shl(_1, move _6) -> bb8; +// END rustc.test_unsigned.Lower128Bit.after.mir diff --git a/src/test/mir-opt/match_false_edges.rs b/src/test/mir-opt/match_false_edges.rs index 318db7a9e3..ba1b54d59f 100644 --- a/src/test/mir-opt/match_false_edges.rs +++ b/src/test/mir-opt/match_false_edges.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z emit-end-regions -Z borrowck-mir +// compile-flags: -Z borrowck=mir fn guard() -> bool { false @@ -49,198 +49,210 @@ fn main() { // END RUST SOURCE // -// START rustc.full_tested_match.SimplifyBranches-initial.before.mir +// START rustc.full_tested_match.QualifyAndPromoteConstants.after.mir // bb0: { // ... // _2 = std::option::Option::Some(const 42i32,); -// _5 = discriminant(_2); -// switchInt(_5) -> [0isize: bb5, 1isize: bb3, otherwise: bb7]; +// _3 = discriminant(_2); +// _6 = discriminant(_2); +// switchInt(move _6) -> [0isize: bb6, 1isize: bb4, otherwise: bb8]; // } -// bb1: { // arm1 -// StorageLive(_7); -// _7 = _3; -// _1 = (const 1i32, _7); -// StorageDead(_7); -// goto -> bb12; +// bb1: { +// resume; // } -// bb2: { // binding3(empty) and arm3 +// bb2: { // arm1 +// StorageLive(_8); +// _8 = _4; +// _1 = (const 1i32, move _8); +// StorageDead(_8); +// goto -> bb13; +// } +// bb3: { // binding3(empty) and arm3 // _1 = (const 3i32, const 3i32); -// goto -> bb12; -// } -// bb3: { -// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1 +// goto -> bb13; // } // bb4: { -// falseEdges -> [real: bb11, imaginary: bb5]; //pre_binding2 +// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 // } // bb5: { -// falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3 +// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2 // } // bb6: { -// unreachable; +// falseEdges -> [real: bb3, imaginary: bb7]; //pre_binding3 // } // bb7: { // unreachable; // } -// bb8: { // binding1 and guard -// StorageLive(_3); -// _3 = ((_2 as Some).0: i32); -// StorageLive(_6); -// _6 = const guard() -> bb9; +// bb8: { +// unreachable; // } -// bb9: { // end of guard -// switchInt(_6) -> [0u8: bb10, otherwise: bb1]; -// } -// bb10: { // to pre_binding2 -// falseEdges -> [real: bb4, imaginary: bb4]; -// } -// bb11: { // bindingNoLandingPads.before.mir2 and arm2 +// bb9: { // binding1 and guard // StorageLive(_4); // _4 = ((_2 as Some).0: i32); -// StorageLive(_8); -// _8 = _4; -// _1 = (const 2i32, _8); -// StorageDead(_8); -// goto -> bb12; +// StorageLive(_7); +// _7 = const guard() -> [return: bb10, unwind: bb1]; // } -// bb12: { +// bb10: { // end of guard +// switchInt(move _7) -> [0u8: bb11, otherwise: bb2]; +// } +// bb11: { // to pre_binding2 +// falseEdges -> [real: bb5, imaginary: bb5]; +// } +// bb12: { // bindingNoLandingPads.before.mir2 and arm2 +// StorageLive(_5); +// _5 = ((_2 as Some).0: i32); +// StorageLive(_9); +// _9 = _5; +// _1 = (const 2i32, move _9); +// StorageDead(_9); +// goto -> bb13; +// } +// bb13: { // ... // return; // } -// END rustc.full_tested_match.SimplifyBranches-initial.before.mir +// END rustc.full_tested_match.QualifyAndPromoteConstants.after.mir // -// START rustc.full_tested_match2.SimplifyBranches-initial.before.mir +// START rustc.full_tested_match2.QualifyAndPromoteConstants.before.mir // bb0: { // ... // _2 = std::option::Option::Some(const 42i32,); -// _5 = discriminant(_2); -// switchInt(_5) -> [0isize: bb4, 1isize: bb3, otherwise: bb7]; +// _3 = discriminant(_2); +// _6 = discriminant(_2); +// switchInt(move _6) -> [0isize: bb5, 1isize: bb4, otherwise: bb8]; // } -// bb1: { // arm1 -// StorageLive(_7); -// _7 = _3; -// _1 = (const 1i32, _7); -// StorageDead(_7); -// goto -> bb12; +// bb1: { +// resume; // } -// bb2: { // binding3(empty) and arm3 +// bb2: { // arm1 +// StorageLive(_8); +// _8 = _4; +// _1 = (const 1i32, move _8); +// StorageDead(_8); +// goto -> bb13; +// } +// bb3: { // binding3(empty) and arm3 // _1 = (const 3i32, const 3i32); -// goto -> bb12; -// } -// bb3: { -// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1 +// goto -> bb13; // } // bb4: { -// falseEdges -> [real: bb2, imaginary: bb5]; //pre_binding2 +// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 // } // bb5: { -// falseEdges -> [real: bb11, imaginary: bb6]; //pre_binding3 +// falseEdges -> [real: bb3, imaginary: bb6]; //pre_binding2 // } // bb6: { -// unreachable; +// falseEdges -> [real: bb12, imaginary: bb7]; //pre_binding3 // } // bb7: { // unreachable; // } -// bb8: { // binding1 and guard -// StorageLive(_3); -// _3 = ((_2 as Some).0: i32); -// StorageLive(_6); -// _6 = const guard() -> bb9; +// bb8: { +// unreachable; // } -// bb9: { // end of guard -// switchInt(_6) -> [0u8: bb10, otherwise: bb1]; -// } -// bb10: { // to pre_binding2 -// falseEdges -> [real: bb5, imaginary: bb4]; -// } -// bb11: { // binding2 and arm2 +// bb9: { // binding1 and guard // StorageLive(_4); // _4 = ((_2 as Some).0: i32); -// StorageLive(_8); -// _8 = _4; -// _1 = (const 2i32, _8); -// StorageDead(_8); -// goto -> bb12; +// StorageLive(_7); +// _7 = const guard() -> [return: bb10, unwind: bb1]; // } -// bb12: { +// bb10: { // end of guard +// switchInt(move _7) -> [0u8: bb11, otherwise: bb2]; +// } +// bb11: { // to pre_binding2 +// falseEdges -> [real: bb6, imaginary: bb5]; +// } +// bb12: { // binding2 and arm2 +// StorageLive(_5); +// _5 = ((_2 as Some).0: i32); +// StorageLive(_9); +// _9 = _5; +// _1 = (const 2i32, move _9); +// StorageDead(_9); +// goto -> bb13; +// } +// bb13: { // ... // return; // } -// END rustc.full_tested_match2.SimplifyBranches-initial.before.mir +// END rustc.full_tested_match2.QualifyAndPromoteConstants.before.mir // -// START rustc.main.SimplifyBranches-initial.before.mir +// START rustc.main.QualifyAndPromoteConstants.before.mir // bb0: { // ... // _2 = std::option::Option::Some(const 1i32,); -// _7 = discriminant(_2); -// switchInt(_7) -> [1isize: bb3, otherwise: bb4]; +// _3 = discriminant(_2); +// _8 = discriminant(_2); +// switchInt(move _8) -> [1isize: bb4, otherwise: bb5]; // } -// bb1: { // arm1 -// _1 = const 1i32; -// goto -> bb16; +// bb1: { +// resume; // } -// bb2: { // arm3 +// bb2: { // arm1 +// _1 = const 1i32; +// goto -> bb17; +// } +// bb3: { // arm3 // _1 = const 3i32; -// goto -> bb16; +// goto -> bb17; // } // -// bb3: { -// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1 -// } -// bb4: { -// falseEdges -> [real: bb11, imaginary: bb5]; //pre_binding2 -// } -// bb5: { -// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding3 -// } -// bb6: { -// falseEdges -> [real: bb15, imaginary: bb7]; //pre_binding4 -// } -// bb7: { -// unreachable; -// } -// bb8: { // binding1: Some(w) if guard() -// StorageLive(_3); -// _3 = ((_2 as Some).0: i32); -// StorageLive(_8); -// _8 = const guard() -> bb9; -// } -// bb9: { //end of guard -// switchInt(_8) -> [0u8: bb10, otherwise: bb1]; -// } -// bb10: { // to pre_binding2 -// falseEdges -> [real: bb4, imaginary: bb4]; -// } -// bb11: { // binding2 & arm2 -// StorageLive(_4); -// _4 = _2; -// _1 = const 2i32; -// goto -> bb16; -// } -// bb12: { // binding3: Some(y) if guard2(y) -// StorageLive(_5); -// _5 = ((_2 as Some).0: i32); -// StorageLive(_10); -// StorageLive(_11); -// _11 = _5; -// _10 = const guard2(_11) -> bb13; -// } -// bb13: { // end of guard2 -// StorageDead(_11); -// switchInt(_10) -> [0u8: bb14, otherwise: bb2]; -// } -// bb14: { // to pre_binding4 -// falseEdges -> [real: bb6, imaginary: bb6]; -// } -// bb15: { // binding4 & arm4 -// StorageLive(_6); -// _6 = _2; -// _1 = const 4i32; -// goto -> bb16; -// } -// bb16: { +// bb4: { +// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 +// } +// bb5: { +// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2 +// } +// bb6: { +// falseEdges -> [real: bb13, imaginary: bb7]; //pre_binding3 +// } +// bb7: { +// falseEdges -> [real: bb16, imaginary: bb8]; //pre_binding4 +// } +// bb8: { +// unreachable; +// } +// bb9: { // binding1: Some(w) if guard() +// StorageLive(_4); +// _4 = ((_2 as Some).0: i32); +// StorageLive(_9); +// _9 = const guard() -> [return: bb10, unwind: bb1]; +// } +// bb10: { //end of guard +// switchInt(move _9) -> [0u8: bb11, otherwise: bb2]; +// } +// bb11: { // to pre_binding2 +// falseEdges -> [real: bb5, imaginary: bb5]; +// } +// bb12: { // binding2 & arm2 +// StorageLive(_5); +// _5 = _2; +// _1 = const 2i32; +// goto -> bb17; +// } +// bb13: { // binding3: Some(y) if guard2(y) +// StorageLive(_6); +// _6 = ((_2 as Some).0: i32); +// StorageLive(_11); +// StorageLive(_12); +// _12 = _6; +// _11 = const guard2(move _12) -> [return: bb14, unwind: bb1]; +// } +// bb14: { // end of guard2 +// StorageDead(_12); +// switchInt(move _11) -> [0u8: bb15, otherwise: bb3]; +// } +// bb15: { // to pre_binding4 +// falseEdges -> [real: bb7, imaginary: bb7]; +// } +// bb16: { // binding4 & arm4 +// StorageLive(_7); +// _7 = _2; +// _1 = const 4i32; +// goto -> bb17; +// } +// bb17: { // ... // return; // } -// END rustc.main.SimplifyBranches-initial.before.mir +// END rustc.main.QualifyAndPromoteConstants.before.mir diff --git a/src/test/mir-opt/nll/liveness-call-subtlety.rs b/src/test/mir-opt/nll/liveness-call-subtlety.rs index 59a1d4891f..09288cf69f 100644 --- a/src/test/mir-opt/nll/liveness-call-subtlety.rs +++ b/src/test/mir-opt/nll/liveness-call-subtlety.rs @@ -28,18 +28,18 @@ fn main() { // START rustc.main.nll.0.mir // | Live variables on entry to bb0: [] // bb0: { -// | Live variables at bb0[0]: [] +// | Live variables on entry to bb0[0]: [] // StorageLive(_1); -// | Live variables at bb0[1]: [] -// _1 = const >::new(const 22usize) -> bb1; +// | Live variables on entry to bb0[1]: [] +// _1 = const >::new(const 22usize) -> [return: bb2, unwind: bb1]; // } // END rustc.main.nll.0.mir // START rustc.main.nll.0.mir -// | Live variables on entry to bb1: [_1 (drop)] -// bb1: { -// | Live variables at bb1[0]: [_1 (drop)] +// | Live variables on entry to bb2: [_1 (drop)] +// bb2: { +// | Live variables on entry to bb2[0]: [_1 (drop)] // StorageLive(_2); -// | Live variables at bb1[1]: [_1 (drop)] -// _2 = const can_panic() -> [return: bb2, unwind: bb4]; +// | Live variables on entry to bb2[1]: [_1 (drop)] +// _2 = const can_panic() -> [return: bb3, unwind: bb4]; // } // END rustc.main.nll.0.mir diff --git a/src/test/mir-opt/nll/liveness-drop-intra-block.rs b/src/test/mir-opt/nll/liveness-drop-intra-block.rs index 5c34479d25..b060222a95 100644 --- a/src/test/mir-opt/nll/liveness-drop-intra-block.rs +++ b/src/test/mir-opt/nll/liveness-drop-intra-block.rs @@ -25,17 +25,17 @@ fn main() { // END RUST SOURCE // START rustc.main.nll.0.mir -// | Live variables on entry to bb1: [] -// bb1: { -// | Live variables at bb1[0]: [] +// | Live variables on entry to bb2: [] +// bb2: { +// | Live variables on entry to bb2[0]: [] // _1 = const 55usize; -// | Live variables at bb1[1]: [_1] +// | Live variables on entry to bb2[1]: [_1] // StorageLive(_3); -// | Live variables at bb1[2]: [_1] +// | Live variables on entry to bb2[2]: [_1] // StorageLive(_4); -// | Live variables at bb1[3]: [_1] +// | Live variables on entry to bb2[3]: [_1] // _4 = _1; -// | Live variables at bb1[4]: [_4] -// _3 = const use_x(_4) -> bb2; +// | Live variables on entry to bb2[4]: [_4] +// _3 = const use_x(move _4) -> [return: bb3, unwind: bb1]; // } // END rustc.main.nll.0.mir diff --git a/src/test/mir-opt/nll/liveness-interblock.rs b/src/test/mir-opt/nll/liveness-interblock.rs index 8217befca6..671f5e5292 100644 --- a/src/test/mir-opt/nll/liveness-interblock.rs +++ b/src/test/mir-opt/nll/liveness-interblock.rs @@ -29,22 +29,20 @@ fn main() { // END RUST SOURCE // START rustc.main.nll.0.mir -// | Live variables on entry to bb2: [_1] -// bb2: { -// | Live variables at bb2[0]: [_1] +// | Live variables on entry to bb3: [_1] +// bb3: { +// | Live variables on entry to bb3[0]: [_1] // StorageLive(_4); -// | Live variables at bb2[1]: [_1] +// | Live variables on entry to bb3[1]: [_1] // _4 = _1; -// | Live variables at bb2[2]: [_4] -// _3 = const make_live(_4) -> bb4; +// | Live variables on entry to bb3[2]: [_4] +// _3 = const make_live(move _4) -> [return: bb5, unwind: bb1]; // } // END rustc.main.nll.0.mir // START rustc.main.nll.0.mir -// | Live variables on entry to bb3: [] -// bb3: { -// | Live variables at bb3[0]: [] -// _5 = const make_dead() -> bb5; +// | Live variables on entry to bb4: [] +// bb4: { +// | Live variables on entry to bb4[0]: [] +// _5 = const make_dead() -> [return: bb6, unwind: bb1]; // } // END rustc.main.nll.0.mir - - diff --git a/src/test/mir-opt/nll/named-lifetimes-basic.rs b/src/test/mir-opt/nll/named-lifetimes-basic.rs index 34d0482a62..8feac15d69 100644 --- a/src/test/mir-opt/nll/named-lifetimes-basic.rs +++ b/src/test/mir-opt/nll/named-lifetimes-basic.rs @@ -26,9 +26,24 @@ fn main() { // END RUST SOURCE // START rustc.use_x.nll.0.mir -// | '_#0r: {bb0[0], bb0[1], '_#0r, '_#1r, '_#2r, '_#3r} -// | '_#1r: {bb0[0], bb0[1], '_#1r} -// | '_#2r: {bb0[0], bb0[1], '_#1r, '_#2r} -// | '_#3r: {bb0[0], bb0[1], '_#3r} -// fn use_x(_1: &'_#1r mut i32, _2: &'_#2r u32, _3: &'_#1r u32, _4: &'_#3r u32) -> bool { +// | Free Region Mapping +// | '_#0r | Global | ['_#2r, '_#1r, '_#0r, '_#4r, '_#3r] +// | '_#1r | External | ['_#1r, '_#4r] +// | '_#2r | External | ['_#2r, '_#1r, '_#4r] +// | '_#3r | Local | ['_#4r, '_#3r] +// | '_#4r | Local | ['_#4r] +// | +// | Inferred Region Values +// | '_#0r | {'_#0r, bb0[0..=1]} +// | '_#1r | {'_#1r, bb0[0..=1]} +// | '_#2r | {'_#2r, bb0[0..=1]} +// | '_#3r | {'_#3r, bb0[0..=1]} +// | '_#4r | {'_#4r, bb0[0..=1]} +// | '_#5r | {'_#1r, bb0[0..=1]} +// | '_#6r | {'_#2r, bb0[0..=1]} +// | '_#7r | {'_#1r, bb0[0..=1]} +// | '_#8r | {'_#3r, bb0[0..=1]} +// | +// ... +// fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool { // END rustc.use_x.nll.0.mir diff --git a/src/test/mir-opt/nll/reborrow-basic.rs b/src/test/mir-opt/nll/reborrow-basic.rs index f51e839e4f..f69c51c356 100644 --- a/src/test/mir-opt/nll/reborrow-basic.rs +++ b/src/test/mir-opt/nll/reborrow-basic.rs @@ -28,12 +28,11 @@ fn main() { // END RUST SOURCE // START rustc.main.nll.0.mir -// | '_#6r: {bb0[6], bb0[7], bb0[8], bb0[9], bb0[10], bb0[11], bb0[12], bb0[13], bb0[14]} +// | '_#7r | {bb0[6..=14]} // ... -// | '_#8r: {bb0[11], bb0[12], bb0[13], bb0[14]} -// END rustc.main.nll.0.mir -// START rustc.main.nll.0.mir -// let _2: &'_#6r mut i32; +// | '_#9r | {bb0[11..=14]} // ... -// let _4: &'_#8r mut i32; +// let _2: &'_#7r mut i32; +// ... +// let _4: &'_#9r mut i32; // END rustc.main.nll.0.mir diff --git a/src/test/mir-opt/nll/region-liveness-basic.rs b/src/test/mir-opt/nll/region-liveness-basic.rs index ae059febc7..e983430555 100644 --- a/src/test/mir-opt/nll/region-liveness-basic.rs +++ b/src/test/mir-opt/nll/region-liveness-basic.rs @@ -31,26 +31,26 @@ fn main() { // END RUST SOURCE // START rustc.main.nll.0.mir -// | '_#1r: {bb1[1], bb2[0], bb2[1]} -// | '_#2r: {bb1[1], bb2[0], bb2[1]} +// | '_#2r | {bb2[0..=1], bb3[0..=1]} +// | '_#3r | {bb2[1], bb3[0..=1]} // ... -// let _2: &'_#2r usize; -// END rustc.main.nll.0.mir -// START rustc.main.nll.0.mir -// bb1: { -// | Live variables at bb1[0]: [_1, _3] -// _2 = &'_#1r _1[_3]; -// | Live variables at bb1[1]: [_2] -// switchInt(const true) -> [0u8: bb3, otherwise: bb2]; -// } +// let _2: &'_#3r usize; // END rustc.main.nll.0.mir // START rustc.main.nll.0.mir // bb2: { -// | Live variables at bb2[0]: [_2] -// StorageLive(_7); -// | Live variables at bb2[1]: [_2] -// _7 = (*_2); -// | Live variables at bb2[2]: [_7] -// _6 = const use_x(_7) -> bb4; +// | Live variables on entry to bb2[0]: [_1, _3] +// _2 = &'_#2r _1[_3]; +// | Live variables on entry to bb2[1]: [_2] +// switchInt(const true) -> [0u8: bb4, otherwise: bb3]; +// } +// END rustc.main.nll.0.mir +// START rustc.main.nll.0.mir +// bb3: { +// | Live variables on entry to bb3[0]: [_2] +// StorageLive(_7); +// | Live variables on entry to bb3[1]: [_2] +// _7 = (*_2); +// | Live variables on entry to bb3[2]: [_7] +// _6 = const use_x(move _7) -> [return: bb5, unwind: bb1]; // } // END rustc.main.nll.0.mir diff --git a/src/test/mir-opt/nll/region-liveness-drop-no-may-dangle.rs b/src/test/mir-opt/nll/region-liveness-drop-no-may-dangle.rs deleted file mode 100644 index aaeebe7495..0000000000 --- a/src/test/mir-opt/nll/region-liveness-drop-no-may-dangle.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Basic test for liveness constraints: the region (`R1`) that appears -// in the type of `p` includes the points after `&v[0]` up to (but not -// including) the call to `use_x`. The `else` branch is not included. - -// ignore-tidy-linelength -// compile-flags:-Znll -Zverbose -// ^^^^^^^^^ force compiler to dump more region information - -#![allow(warnings)] - -fn use_x(_: usize) -> bool { true } - -fn main() { - let mut v = [1, 2, 3]; - let p: Wrap<& /* R1 */ usize> = Wrap { value: &v[0] }; - if true { - use_x(*p.value); - } else { - use_x(22); - } - - // `p` will get dropped here. Because the `#[may_dangle]` - // attribute is not present on `Wrap`, we must conservatively - // assume that the dtor may access the `value` field, and hence we - // must consider R1 to be live. -} - -struct Wrap { - value: T -} - -// Look ma, no `#[may_dangle]` attribute here. -impl Drop for Wrap { - fn drop(&mut self) { } -} - -// END RUST SOURCE -// START rustc.main.nll.0.mir -// | '_#5r: {bb1[3], bb1[4], bb1[5], bb2[0], bb2[1], bb2[2], bb3[0], bb4[0], bb4[1], bb4[2], bb6[0], bb7[0], bb7[1], bb8[0]} -// END rustc.main.nll.0.mir diff --git a/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs b/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs index 5c28746126..821cd73667 100644 --- a/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs +++ b/src/test/mir-opt/nll/region-liveness-two-disjoint-uses.rs @@ -36,14 +36,14 @@ fn main() { // END RUST SOURCE // START rustc.main.nll.0.mir -// | '_#1r: {bb1[1], bb2[0], bb2[1]} +// | '_#2r | {bb2[0..=1], bb3[0..=1]} // ... -// | '_#3r: {bb7[2], bb7[3], bb7[4]} -// | '_#4r: {bb1[1], bb2[0], bb2[1], bb7[2], bb7[3], bb7[4]} +// | '_#4r | {bb8[1..=4]} +// | '_#5r | {bb2[1], bb3[0..=1], bb8[2..=4]} // ... -// let mut _2: &'_#4r usize; +// let mut _2: &'_#5r usize; // ... -// _2 = &'_#1r _1[_3]; +// _2 = &'_#2r _1[_3]; // ... -// _2 = &'_#3r (*_10); +// _2 = &'_#4r (*_10); // END rustc.main.nll.0.mir diff --git a/src/test/mir-opt/nll/region-subtyping-basic.rs b/src/test/mir-opt/nll/region-subtyping-basic.rs index fb178b46b4..a3f68ed5eb 100644 --- a/src/test/mir-opt/nll/region-subtyping-basic.rs +++ b/src/test/mir-opt/nll/region-subtyping-basic.rs @@ -32,18 +32,18 @@ fn main() { // END RUST SOURCE // START rustc.main.nll.0.mir -// | '_#1r: {bb1[1], bb1[2], bb1[3], bb1[4], bb1[5], bb1[6], bb2[0], bb2[1]} -// | '_#2r: {bb1[1], bb1[2], bb1[3], bb1[4], bb1[5], bb1[6], bb2[0], bb2[1]} -// | '_#3r: {bb1[5], bb1[6], bb2[0], bb2[1]} +// | '_#2r | {bb2[0..=6], bb3[0..=1]} +// | '_#3r | {bb2[1..=6], bb3[0..=1]} +// | '_#4r | {bb2[5..=6], bb3[0..=1]} // END rustc.main.nll.0.mir // START rustc.main.nll.0.mir -// let _2: &'_#2r usize; +// let _2: &'_#3r usize; // ... -// let _6: &'_#3r usize; +// let _6: &'_#4r usize; // ... -// _2 = &'_#1r _1[_3]; +// _2 = &'_#2r _1[_3]; // ... // _7 = _2; // ... -// _6 = _7; +// _6 = move _7; // END rustc.main.nll.0.mir diff --git a/src/test/mir-opt/packed-struct-drop-aligned.rs b/src/test/mir-opt/packed-struct-drop-aligned.rs new file mode 100644 index 0000000000..1b11441944 --- /dev/null +++ b/src/test/mir-opt/packed-struct-drop-aligned.rs @@ -0,0 +1,70 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-wasm32-bare compiled with panic=abort by default + +fn main() { + let mut x = Packed(Aligned(Droppy(0))); + x.0 = Aligned(Droppy(0)); +} + +struct Aligned(Droppy); +#[repr(packed)] +struct Packed(Aligned); + +struct Droppy(usize); +impl Drop for Droppy { + fn drop(&mut self) {} +} + +// END RUST SOURCE +// START rustc.main.EraseRegions.before.mir +// fn main() -> () { +// let mut _0: (); +// scope 1 { +// let mut _1: Packed; +// } +// scope 2 { +// } +// let mut _2: Aligned; +// let mut _3: Droppy; +// let mut _4: Aligned; +// let mut _5: Droppy; +// let mut _6: Aligned; +// +// bb0: { +// StorageLive(_1); +// ... +// _1 = Packed::{{constructor}}(move _2,); +// ... +// StorageLive(_6); +// _6 = move (_1.0: Aligned); +// drop(_6) -> [return: bb4, unwind: bb3]; +// } +// bb1: { +// resume; +// } +// bb2: { +// StorageDead(_1); +// return; +// } +// bb3: { +// (_1.0: Aligned) = move _4; +// drop(_1) -> bb1; +// } +// bb4: { +// StorageDead(_6); +// (_1.0: Aligned) = move _4; +// StorageDead(_4); +// _0 = (); +// drop(_1) -> [return: bb2, unwind: bb1]; +// } +// } +// END rustc.main.EraseRegions.before.mir diff --git a/src/test/mir-opt/return_an_array.rs b/src/test/mir-opt/return_an_array.rs index 4409f16b3f..bfae5b9438 100644 --- a/src/test/mir-opt/return_an_array.rs +++ b/src/test/mir-opt/return_an_array.rs @@ -15,4 +15,4 @@ fn foo() -> [u8; 1024] { return x; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/mir-opt/simplify_if.rs b/src/test/mir-opt/simplify_if.rs index ad3bbba8d0..3578664364 100644 --- a/src/test/mir-opt/simplify_if.rs +++ b/src/test/mir-opt/simplify_if.rs @@ -17,11 +17,11 @@ fn main() { // END RUST SOURCE // START rustc.main.SimplifyBranches-initial.before.mir // bb0: { -// switchInt(const false) -> [0u8: bb2, otherwise: bb1]; +// switchInt(const false) -> [0u8: bb3, otherwise: bb2]; // } // END rustc.main.SimplifyBranches-initial.before.mir // START rustc.main.SimplifyBranches-initial.after.mir // bb0: { -// goto -> bb2; +// goto -> bb3; // } // END rustc.main.SimplifyBranches-initial.after.mir diff --git a/src/test/mir-opt/storage_live_dead_in_statics.rs b/src/test/mir-opt/storage_live_dead_in_statics.rs index 995639e20d..730ef655b1 100644 --- a/src/test/mir-opt/storage_live_dead_in_statics.rs +++ b/src/test/mir-opt/storage_live_dead_in_statics.rs @@ -185,11 +185,11 @@ fn main() { // _47 = (const 0u32, const 2u32); // StorageLive(_48); // _48 = (const 0u32, const 3u32); -// _6 = [_7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48]; +// _6 = [move _7, move _8, move _9, move _10, move _11, move _12, move _13, move _14, move _15, move _16, move _17, move _18, move _19, move _20, move _21, move _22, move _23, move _24, move _25, move _26, move _27, move _28, move _29, move _30, move _31, move _32, move _33, move _34, move _35, move _36, move _37, move _38, move _39, move _40, move _41, move _42, move _43, move _44, move _45, move _46, move _47, move _48]; // _5 = &_6; // _4 = &(*_5); -// _3 = _4 as &'static [(u32, u32)] (Unsize); -// _2 = Foo { tup: const "hi", data: _3 }; +// _3 = move _4 as &'static [(u32, u32)] (Unsize); +// _2 = Foo { tup: const "hi", data: move _3 }; // _1 = &_2; // _0 = &(*_1); // StorageDead(_1); diff --git a/src/test/mir-opt/storage_ranges.rs b/src/test/mir-opt/storage_ranges.rs index 53cb82bb0f..41eaf67d29 100644 --- a/src/test/mir-opt/storage_ranges.rs +++ b/src/test/mir-opt/storage_ranges.rs @@ -27,7 +27,7 @@ fn main() { // StorageLive(_4); // StorageLive(_5); // _5 = _1; -// _4 = std::option::Option::Some(_5,); +// _4 = std::option::Option::Some(move _5,); // StorageDead(_5); // _3 = &_4; // _2 = (); diff --git a/src/test/mir-opt/validate_1.rs b/src/test/mir-opt/validate_1.rs index f4d1caa6a9..e6cd535500 100644 --- a/src/test/mir-opt/validate_1.rs +++ b/src/test/mir-opt/validate_1.rs @@ -30,7 +30,7 @@ fn main() { // END RUST SOURCE // START rustc.{{impl}}-foo.EraseRegions.after.mir // bb0: { -// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:5) => validate_1[317d]::{{impl}}[0]::foo[0] }, BrAnon(0)) Test, _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:5) => validate_1[317d]::{{impl}}[0]::foo[0] }, BrAnon(1)) mut i32]); +// Validate(Acquire, [_1: &ReFree(DefId(0/0:5 ~ validate_1[317d]::{{impl}}[0]::foo[0]), BrAnon(0)) Test, _2: &ReFree(DefId(0/0:5 ~ validate_1[317d]::{{impl}}[0]::foo[0]), BrAnon(1)) mut i32]); // ... // return; // } @@ -47,7 +47,7 @@ fn main() { // _5 = &ReErased mut (*_6); // Validate(Acquire, [(*_5): i32/ReScope(Node(ItemLocalId(10)))]); // Validate(Release, [_2: (), _3: &ReScope(Node(ItemLocalId(10))) Test, _5: &ReScope(Node(ItemLocalId(10))) mut i32]); -// _2 = const Test::foo(_3, _5) -> bb1; +// _2 = const Test::foo(move _3, move _5) -> bb1; // } // // bb1: { @@ -62,14 +62,14 @@ fn main() { // fn main::{{closure}}(_1: &ReErased [closure@NodeId(50)], _2: &ReErased mut i32) -> i32 { // ... // bb0: { -// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:11) => validate_1[317d]::main[0]::{{closure}}[0] }, BrEnv) [closure@NodeId(50)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:11) => validate_1[317d]::main[0]::{{closure}}[0] }, BrAnon(0)) mut i32]); +// Validate(Acquire, [_1: &ReFree(DefId(0/1:11 ~ validate_1[317d]::main[0]::{{closure}}[0]), BrEnv) [closure@NodeId(50)], _2: &ReFree(DefId(0/1:11 ~ validate_1[317d]::main[0]::{{closure}}[0]), BrAnon(0)) mut i32]); // StorageLive(_3); // Validate(Suspend(ReScope(Remainder(BlockRemainder { block: ItemLocalId(22), first_statement_index: 0 }))), [(*_2): i32]); // _3 = &ReErased (*_2); // Validate(Acquire, [(*_3): i32/ReScope(Remainder(BlockRemainder { block: ItemLocalId(22), first_statement_index: 0 })) (imm)]); // StorageLive(_4); // _4 = (*_3); -// _0 = _4; +// _0 = move _4; // StorageDead(_4); // EndRegion(ReScope(Remainder(BlockRemainder { block: ItemLocalId(22), first_statement_index: 0 }))); // StorageDead(_3); diff --git a/src/test/mir-opt/validate_2.rs b/src/test/mir-opt/validate_2.rs index 5f3dad5efd..3776a11b3a 100644 --- a/src/test/mir-opt/validate_2.rs +++ b/src/test/mir-opt/validate_2.rs @@ -9,6 +9,8 @@ // except according to those terms. // ignore-tidy-linelength +// ignore-wasm32-bare unwinding being disabled causes differences in output +// ignore-wasm64-bare unwinding being disabled causes differences in output // compile-flags: -Z verbose -Z mir-emit-validate=1 fn main() { @@ -22,13 +24,13 @@ fn main() { // bb1: { // Validate(Acquire, [_2: std::boxed::Box<[i32; 3]>]); // Validate(Release, [_2: std::boxed::Box<[i32; 3]>]); -// _1 = _2 as std::boxed::Box<[i32]> (Unsize); +// _1 = move _2 as std::boxed::Box<[i32]> (Unsize); // Validate(Acquire, [_1: std::boxed::Box<[i32]>]); // StorageDead(_2); // StorageDead(_3); // _0 = (); // Validate(Release, [_1: std::boxed::Box<[i32]>]); -// drop(_1) -> bb2; +// drop(_1) -> [return: bb2, unwind: bb3]; // } // ... // } diff --git a/src/test/mir-opt/validate_3.rs b/src/test/mir-opt/validate_3.rs index 50c410039e..80e75fcee8 100644 --- a/src/test/mir-opt/validate_3.rs +++ b/src/test/mir-opt/validate_3.rs @@ -48,7 +48,7 @@ fn main() { // _4 = &ReErased (*_5); // Validate(Acquire, [(*_4): i32/ReScope(Node(ItemLocalId(17))) (imm)]); // Validate(Release, [_3: (), _4: &ReScope(Node(ItemLocalId(17))) i32]); -// _3 = const foo(_4) -> bb1; +// _3 = const foo(move _4) -> bb1; // } // bb1: { // Validate(Acquire, [_3: ()]); diff --git a/src/test/mir-opt/validate_4.rs b/src/test/mir-opt/validate_4.rs index 80224ddc58..24a4ebd842 100644 --- a/src/test/mir-opt/validate_4.rs +++ b/src/test/mir-opt/validate_4.rs @@ -51,9 +51,10 @@ fn main() { // fn write_42::{{closure}}(_1: &ReErased [closure@NodeId(22)], _2: *mut i32) -> () { // ... // bb0: { -// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_4[317d]::write_42[0]::{{closure}}[0] }, BrEnv) [closure@NodeId(22)], _2: *mut i32]); -// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_4[317d]::write_42[0]::{{closure}}[0] }, BrEnv) [closure@NodeId(22)], _2: *mut i32]); +// Validate(Acquire, [_1: &ReFree(DefId(0/1:9 ~ validate_4[317d]::write_42[0]::{{closure}}[0]), BrEnv) [closure@NodeId(22)], _2: *mut i32]); +// Validate(Release, [_1: &ReFree(DefId(0/1:9 ~ validate_4[317d]::write_42[0]::{{closure}}[0]), BrEnv) [closure@NodeId(22)], _2: *mut i32]); // (*_2) = const 23i32; +// _0 = (); // return; // } // } @@ -62,10 +63,10 @@ fn main() { // fn test(_1: &ReErased mut i32) -> () { // ... // bb0: { -// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:4) => validate_4[317d]::test[0] }, BrAnon(0)) mut i32]); -// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:4) => validate_4[317d]::test[0] }, BrAnon(0)) mut i32]); +// Validate(Acquire, [_1: &ReFree(DefId(0/0:4 ~ validate_4[317d]::test[0]), BrAnon(0)) mut i32]); +// Validate(Release, [_1: &ReFree(DefId(0/0:4 ~ validate_4[317d]::test[0]), BrAnon(0)) mut i32]); // ... -// _2 = const write_42(_3) -> bb1; +// _2 = const write_42(move _3) -> bb1; // } // bb1: { // Validate(Acquire, [_2: bool]); @@ -78,11 +79,11 @@ fn main() { // fn main::{{closure}}(_1: &ReErased [closure@NodeId(60)], _2: &ReErased mut i32) -> bool { // ... // bb0: { -// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[317d]::main[0]::{{closure}}[0] }, BrEnv) [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[317d]::main[0]::{{closure}}[0] }, BrAnon(0)) mut i32]); -// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[317d]::main[0]::{{closure}}[0] }, BrEnv) [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[317d]::main[0]::{{closure}}[0] }, BrAnon(0)) mut i32]); +// Validate(Acquire, [_1: &ReFree(DefId(0/1:10 ~ validate_4[317d]::main[0]::{{closure}}[0]), BrEnv) [closure@NodeId(60)], _2: &ReFree(DefId(0/1:10 ~ validate_4[317d]::main[0]::{{closure}}[0]), BrAnon(0)) mut i32]); +// Validate(Release, [_1: &ReFree(DefId(0/1:10 ~ validate_4[317d]::main[0]::{{closure}}[0]), BrEnv) [closure@NodeId(60)], _2: &ReFree(DefId(0/1:10 ~ validate_4[317d]::main[0]::{{closure}}[0]), BrAnon(0)) mut i32]); // StorageLive(_3); // ... -// _0 = const write_42(_3) -> bb1; +// _0 = const write_42(move _3) -> bb1; // } // ... // } diff --git a/src/test/mir-opt/validate_5.rs b/src/test/mir-opt/validate_5.rs index a945b7dbc5..c9408c1f2f 100644 --- a/src/test/mir-opt/validate_5.rs +++ b/src/test/mir-opt/validate_5.rs @@ -37,10 +37,10 @@ fn main() { // fn test(_1: &ReErased mut i32) -> () { // ... // bb0: { -// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:4) => validate_5[317d]::test[0] }, BrAnon(0)) mut i32]); +// Validate(Acquire, [_1: &ReFree(DefId(0/0:4 ~ validate_5[317d]::test[0]), BrAnon(0)) mut i32]); // ... // Validate(Release, [_2: bool, _3: *mut i32]); -// _2 = const write_42(_3) -> bb1; +// _2 = const write_42(move _3) -> bb1; // } // ... // } @@ -49,17 +49,17 @@ fn main() { // fn main::{{closure}}(_1: &ReErased [closure@NodeId(46)], _2: &ReErased mut i32) -> bool { // ... // bb0: { -// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_5[317d]::main[0]::{{closure}}[0] }, BrEnv) [closure@NodeId(46)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_5[317d]::main[0]::{{closure}}[0] }, BrAnon(0)) mut i32]); +// Validate(Acquire, [_1: &ReFree(DefId(0/1:9 ~ validate_5[317d]::main[0]::{{closure}}[0]), BrEnv) [closure@NodeId(46)], _2: &ReFree(DefId(0/1:9 ~ validate_5[317d]::main[0]::{{closure}}[0]), BrAnon(0)) mut i32]); // StorageLive(_3); // StorageLive(_4); // Validate(Suspend(ReScope(Node(ItemLocalId(9)))), [(*_2): i32]); // _4 = &ReErased mut (*_2); // Validate(Acquire, [(*_4): i32/ReScope(Node(ItemLocalId(9)))]); -// _3 = _4 as *mut i32 (Misc); +// _3 = move _4 as *mut i32 (Misc); // EndRegion(ReScope(Node(ItemLocalId(9)))); // StorageDead(_4); // Validate(Release, [_0: bool, _3: *mut i32]); -// _0 = const write_42(_3) -> bb1; +// _0 = const write_42(move _3) -> bb1; // } // ... // } diff --git a/src/test/parse-fail/doc-after-struct-field.rs b/src/test/parse-fail/doc-after-struct-field.rs index 1aa6af5b78..a2c60151ac 100644 --- a/src/test/parse-fail/doc-after-struct-field.rs +++ b/src/test/parse-fail/doc-after-struct-field.rs @@ -9,12 +9,20 @@ // except according to those terms. // compile-flags: -Z continue-parse-after-error + struct X { a: u8 /** document a */, //~^ ERROR found a documentation comment that doesn't document anything //~| HELP maybe a comment was intended } -fn main() { - let y = X {a = 1}; +struct Y { + a: u8 /// document a + //~^ ERROR found a documentation comment that doesn't document anything + //~| HELP maybe a comment was intended +} + +fn main() { + let x = X { a: 1 }; + let y = Y { a: 1 }; } diff --git a/src/test/parse-fail/doc-before-struct-rbrace-1.rs b/src/test/parse-fail/doc-before-struct-rbrace-1.rs index 5ba83190c8..6d9b4b05ad 100644 --- a/src/test/parse-fail/doc-before-struct-rbrace-1.rs +++ b/src/test/parse-fail/doc-before-struct-rbrace-1.rs @@ -17,5 +17,5 @@ struct X { } fn main() { - let y = X {a = 1}; + let y = X {a: 1}; } diff --git a/src/test/parse-fail/doc-before-struct-rbrace-2.rs b/src/test/parse-fail/doc-before-struct-rbrace-2.rs index 643e4aa17a..63b2f96379 100644 --- a/src/test/parse-fail/doc-before-struct-rbrace-2.rs +++ b/src/test/parse-fail/doc-before-struct-rbrace-2.rs @@ -16,5 +16,5 @@ struct X { } fn main() { - let y = X {a = 1}; + let y = X {a: 1}; } diff --git a/src/test/parse-fail/issue-17383.rs b/src/test/parse-fail/issue-17383.rs index 1b33cb3885..48f629fd82 100644 --- a/src/test/parse-fail/issue-17383.rs +++ b/src/test/parse-fail/issue-17383.rs @@ -12,7 +12,7 @@ enum X { A = - b'a' //~ ERROR discriminator values can only be used with a c-like enum + b'a' //~ ERROR discriminator values can only be used with a field-less enum , B(isize) } diff --git a/src/test/parse-fail/issue-37113.rs b/src/test/parse-fail/issue-37113.rs index caf451099d..14c6f3944b 100644 --- a/src/test/parse-fail/issue-37113.rs +++ b/src/test/parse-fail/issue-37113.rs @@ -18,4 +18,4 @@ macro_rules! test_macro { fn main() { test_macro!(String,); -} \ No newline at end of file +} diff --git a/src/test/parse-fail/issue-37234.rs b/src/test/parse-fail/issue-37234.rs index 651e11d9d2..93a1468bf7 100644 --- a/src/test/parse-fail/issue-37234.rs +++ b/src/test/parse-fail/issue-37234.rs @@ -11,7 +11,7 @@ macro_rules! failed { () => {{ let x = 5 ""; //~ ERROR found `""` - }} //~ ERROR macro expansion ignores token `}` + }} } fn main() { diff --git a/src/test/parse-fail/keywords-followed-by-double-colon.rs b/src/test/parse-fail/keywords-followed-by-double-colon.rs index bb8a1dfdb1..7a5b48c5f0 100644 --- a/src/test/parse-fail/keywords-followed-by-double-colon.rs +++ b/src/test/parse-fail/keywords-followed-by-double-colon.rs @@ -11,6 +11,10 @@ // compile-flags: -Z parse-only fn main() { - struct::foo(); //~ ERROR expected identifier - mut::baz(); //~ ERROR expected expression, found keyword `mut` + struct::foo(); + //~^ ERROR expected identifier +} +fn bar() { + mut::baz(); + //~^ ERROR expected expression, found keyword `mut` } diff --git a/src/test/parse-fail/lex-bad-char-literals-3.rs b/src/test/parse-fail/lex-bad-char-literals-3.rs index 92432dc8b6..464e75ec58 100644 --- a/src/test/parse-fail/lex-bad-char-literals-3.rs +++ b/src/test/parse-fail/lex-bad-char-literals-3.rs @@ -12,5 +12,5 @@ // This test needs to the last one appearing in this file as it kills the parser static c: char = - '●●' //~ ERROR: character literal may only contain one codepoint: '● + '●●' //~ ERROR: character literal may only contain one codepoint ; diff --git a/src/test/parse-fail/lex-bad-char-literals-5.rs b/src/test/parse-fail/lex-bad-char-literals-5.rs index 5259175b18..aa166881d8 100644 --- a/src/test/parse-fail/lex-bad-char-literals-5.rs +++ b/src/test/parse-fail/lex-bad-char-literals-5.rs @@ -12,5 +12,5 @@ // // This test needs to the last one appearing in this file as it kills the parser static c: char = - '\x10\x10' //~ ERROR: character literal may only contain one codepoint: '\x10 + '\x10\x10' //~ ERROR: character literal may only contain one codepoint ; diff --git a/src/test/parse-fail/pat-lt-bracket-5.rs b/src/test/parse-fail/pat-lt-bracket-5.rs index 3345845eee..421d7a05be 100644 --- a/src/test/parse-fail/pat-lt-bracket-5.rs +++ b/src/test/parse-fail/pat-lt-bracket-5.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let v[0] = v[1]; //~ error: expected one of `:`, `;`, `=`, or `@`, found `[` + let v[0] = v[1]; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` } diff --git a/src/test/parse-fail/range_inclusive_gate.rs b/src/test/parse-fail/range_inclusive_gate.rs index de690c3fea..6b6afc504e 100644 --- a/src/test/parse-fail/range_inclusive_gate.rs +++ b/src/test/parse-fail/range_inclusive_gate.rs @@ -72,5 +72,3 @@ pub fn main() { o!(); // not allowed in macros that output cfgs p!(); // not allowed in cfg'ed macros that output cfgs } - - diff --git a/src/test/parse-fail/tag-variant-disr-non-nullary.rs b/src/test/parse-fail/tag-variant-disr-non-nullary.rs index f90b1cc94b..2d86589285 100644 --- a/src/test/parse-fail/tag-variant-disr-non-nullary.rs +++ b/src/test/parse-fail/tag-variant-disr-non-nullary.rs @@ -10,7 +10,7 @@ // compile-flags: -Z parse-only -//error-pattern: discriminator values can only be used with a c-like enum +//error-pattern: discriminator values can only be used with a field-less enum enum color { red = 0xff0000, diff --git a/src/test/parse-fail/trait-object-bad-parens.rs b/src/test/parse-fail/trait-object-bad-parens.rs index 3e8c140eb1..25e9c3071d 100644 --- a/src/test/parse-fail/trait-object-bad-parens.rs +++ b/src/test/parse-fail/trait-object-bad-parens.rs @@ -14,9 +14,9 @@ fn main() { let _: Box<((Copy)) + Copy>; //~^ ERROR expected a path on the left-hand side of `+`, not `((Copy))` let _: Box<(Copy + Copy) + Copy>; - //~^ ERROR expected a path on the left-hand side of `+`, not `( Copy + Copy)` + //~^ ERROR expected a path on the left-hand side of `+`, not `(Copy + Copy)` let _: Box<(Copy +) + Copy>; - //~^ ERROR expected a path on the left-hand side of `+`, not `( Copy)` + //~^ ERROR expected a path on the left-hand side of `+`, not `(Copy)` let _: Box<(dyn Copy) + Copy>; - //~^ ERROR expected a path on the left-hand side of `+`, not `(dyn Copy)` + //~^ ERROR expected a path on the left-hand side of `+`, not `(dyn Copy)` } diff --git a/src/test/parse-fail/trait-object-polytrait-priority.rs b/src/test/parse-fail/trait-object-polytrait-priority.rs index 9df4be4595..b5fc06ddaa 100644 --- a/src/test/parse-fail/trait-object-polytrait-priority.rs +++ b/src/test/parse-fail/trait-object-polytrait-priority.rs @@ -12,7 +12,7 @@ trait Trait<'a> {} fn main() { let _: &for<'a> Trait<'a> + 'static; - //~^ ERROR expected a path on the left-hand side of `+`, not `& for<'a>Trait<'a>` + //~^ ERROR expected a path on the left-hand side of `+`, not `&for<'a> Trait<'a>` //~| HELP try adding parentheses - //~| SUGGESTION &( for<'a>Trait<'a> + 'static) + //~| SUGGESTION &(for<'a> Trait<'a> + 'static) } diff --git a/src/test/pretty/closure-reform-pretty.rs b/src/test/pretty/closure-reform-pretty.rs index 63568dbcd5..a1fdebf6fa 100644 --- a/src/test/pretty/closure-reform-pretty.rs +++ b/src/test/pretty/closure-reform-pretty.rs @@ -17,7 +17,7 @@ fn call_it(f: Box String>) { } fn call_this(f: F) where F: Fn(&str) + Send { } -fn call_that(f: F) where F: for<'a>Fn(&'a isize, &'a isize) -> isize { } +fn call_that(f: F) where F: for<'a> Fn(&'a isize, &'a isize) -> isize { } fn call_extern(f: fn() -> isize) { } diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index 02b8425d88..81518b0b87 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -40,7 +40,7 @@ pub fn bar() ({ ((::fmt::format as - for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::std::fmt::Arguments>::new_v1 + for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::fmt::Arguments>::new_v1 as fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments<'_>::new_v1})((&([("test" as diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs index 651d2b6794..ae6a0fc314 100644 --- a/src/test/pretty/path-type-bounds.rs +++ b/src/test/pretty/path-type-bounds.rs @@ -16,10 +16,10 @@ trait Tr { } impl Tr for isize { } -fn foo<'a>(x: Box< Tr + Sync + 'a>) -> Box< Tr + Sync + 'a> { x } +fn foo<'a>(x: Box) -> Box { x } fn main() { - let x: Box< Tr + Sync>; + let x: Box; - Box::new(1isize) as Box< Tr + Sync>; + Box::new(1isize) as Box; } diff --git a/src/tools/miri/tests/run-pass/issue-33387.rs b/src/test/run-fail/borrowck-local-borrow.rs similarity index 77% rename from src/tools/miri/tests/run-pass/issue-33387.rs rename to src/test/run-fail/borrowck-local-borrow.rs index edbf2b81ce..daee3903d7 100644 --- a/src/tools/miri/tests/run-pass/issue-33387.rs +++ b/src/test/run-fail/borrowck-local-borrow.rs @@ -7,13 +7,13 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +// error-pattern:panic 1 -use std::sync::Arc; - -trait Foo {} - -impl Foo for [u8; 2] {} +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir fn main() { - let _: Arc = Arc::new([3, 4]); + let x = 2; + let y = &x; + panic!("panic 1"); } diff --git a/src/test/run-fail/mir_trans_no_landing_pads.rs b/src/test/run-fail/mir_trans_no_landing_pads.rs index dacb039d89..bafb78fc21 100644 --- a/src/test/run-fail/mir_trans_no_landing_pads.rs +++ b/src/test/run-fail/mir_trans_no_landing_pads.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z no-landing-pads +// compile-flags: -Z no-landing-pads -C codegen-units=1 // error-pattern:converging_fn called use std::io::{self, Write}; diff --git a/src/test/run-fail/mir_trans_no_landing_pads_diverging.rs b/src/test/run-fail/mir_trans_no_landing_pads_diverging.rs index 87037c1efe..998ee7470b 100644 --- a/src/test/run-fail/mir_trans_no_landing_pads_diverging.rs +++ b/src/test/run-fail/mir_trans_no_landing_pads_diverging.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z no-landing-pads +// compile-flags: -Z no-landing-pads -C codegen-units=1 // error-pattern:diverging_fn called use std::io::{self, Write}; diff --git a/src/test/run-fail/return-never-coerce.rs b/src/test/run-fail/return-never-coerce.rs index 4cd93ac7e1..ddcecd97ba 100644 --- a/src/test/run-fail/return-never-coerce.rs +++ b/src/test/run-fail/return-never-coerce.rs @@ -24,5 +24,3 @@ fn main() { let x: i32 = call_another_fn(wub); let y: u32 = wub(); } - - diff --git a/src/test/run-make/a-b-a-linker-guard/a.rs b/src/test/run-make/a-b-a-linker-guard/a.rs index e6cbe2e64d..c6680a7881 100644 --- a/src/test/run-make/a-b-a-linker-guard/a.rs +++ b/src/test/run-make/a-b-a-linker-guard/a.rs @@ -16,5 +16,3 @@ pub fn foo(x: u32) { } #[cfg(y)] pub fn foo(x: i32) { } - - diff --git a/src/test/run-make/atomic-lock-free/Makefile b/src/test/run-make/atomic-lock-free/Makefile index 7c92adddba..4849b03074 100644 --- a/src/test/run-make/atomic-lock-free/Makefile +++ b/src/test/run-make/atomic-lock-free/Makefile @@ -7,36 +7,36 @@ all: ifeq ($(UNAME),Linux) ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) $(RUSTC) --target=i686-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=x86_64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add endif ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) $(RUSTC) --target=arm-unknown-linux-gnueabi atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=arm-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add endif ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64) $(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add endif ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) $(RUSTC) --target=mips-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=mipsel-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add endif ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc) $(RUSTC) --target=powerpc-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=s390x-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add endif endif diff --git a/src/test/run-make/cat-and-grep-sanity-check/Makefile b/src/test/run-make/cat-and-grep-sanity-check/Makefile new file mode 100644 index 0000000000..fead197ce3 --- /dev/null +++ b/src/test/run-make/cat-and-grep-sanity-check/Makefile @@ -0,0 +1,46 @@ +-include ../tools.mk + +all: + echo a | $(CGREP) a + ! echo b | $(CGREP) a + echo xyz | $(CGREP) x y z + ! echo abc | $(CGREP) b c d + printf "x\ny\nz" | $(CGREP) x y z + + echo AbCd | $(CGREP) -i a b C D + ! echo AbCd | $(CGREP) a b C D + + true | $(CGREP) -v nothing + ! echo nothing | $(CGREP) -v nothing + ! echo xyz | $(CGREP) -v w x y + ! echo xyz | $(CGREP) -v x y z + echo xyz | $(CGREP) -v a b c + + ! echo 'foo bar baz' | $(CGREP) 'foo baz' + echo 'foo bar baz' | $(CGREP) foo baz + echo 'x a `b` c y z' | $(CGREP) 'a `b` c' + + echo baaac | $(CGREP) -e 'ba*c' + echo bc | $(CGREP) -e 'ba*c' + ! echo aaac | $(CGREP) -e 'ba*c' + + echo aaa | $(CGREP) -e 'a+' + ! echo bbb | $(CGREP) -e 'a+' + + echo abc | $(CGREP) -e 'a|e|i|o|u' + ! echo fgh | $(CGREP) -e 'a|e|i|o|u' + echo abc | $(CGREP) -e '[aeiou]' + ! echo fgh | $(CGREP) -e '[aeiou]' + ! echo abc | $(CGREP) -e '[^aeiou]{3}' + echo fgh | $(CGREP) -e '[^aeiou]{3}' + echo ab cd ef gh | $(CGREP) -e '\bcd\b' + ! echo abcdefgh | $(CGREP) -e '\bcd\b' + echo xyz | $(CGREP) -e '...' + ! echo xy | $(CGREP) -e '...' + ! echo xyz | $(CGREP) -e '\.\.\.' + echo ... | $(CGREP) -e '\.\.\.' + + echo foo bar baz | $(CGREP) -e 'foo.*baz' + ! echo foo bar baz | $(CGREP) -ve 'foo.*baz' + ! echo foo bar baz | $(CGREP) -e 'baz.*foo' + echo foo bar baz | $(CGREP) -ve 'baz.*foo' diff --git a/src/test/run-make/cdylib-fewer-symbols/Makefile b/src/test/run-make/cdylib-fewer-symbols/Makefile index 954ee79246..1a0664dfaf 100644 --- a/src/test/run-make/cdylib-fewer-symbols/Makefile +++ b/src/test/run-make/cdylib-fewer-symbols/Makefile @@ -3,15 +3,13 @@ -include ../tools.mk -ifdef IS_MSVC +# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU +# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 +ifdef IS_WINDOWS all: true else all: $(RUSTC) foo.rs - nm -g "$(call DYLIB,foo)" - nm -g "$(call DYLIB,foo)" | grep -vq __rdl_ - nm -g "$(call DYLIB,foo)" | grep -vq __rde_ - nm -g "$(call DYLIB,foo)" | grep -vq __rg_ - nm -g "$(call DYLIB,foo)" | grep -vq __rust_ + nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_ endif diff --git a/src/test/run-make/codegen-options-parsing/Makefile b/src/test/run-make/codegen-options-parsing/Makefile index 755e211a34..81e06043c8 100644 --- a/src/test/run-make/codegen-options-parsing/Makefile +++ b/src/test/run-make/codegen-options-parsing/Makefile @@ -1,33 +1,31 @@ -include ../tools.mk -LOG = $(TMPDIR)/log.txt - all: #Option taking a number - $(RUSTC) -C codegen-units dummy.rs 2>&1 | tee $(LOG) - grep 'codegen option `codegen-units` requires a number' $(LOG) - $(RUSTC) -C codegen-units= dummy.rs 2>&1 | tee $(LOG) - grep 'incorrect value `` for codegen option `codegen-units` - a number was expected' $(LOG) - $(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | tee $(LOG) - grep 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' $(LOG) + $(RUSTC) -C codegen-units dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `codegen-units` requires a number' + $(RUSTC) -C codegen-units= dummy.rs 2>&1 | \ + $(CGREP) 'incorrect value `` for codegen option `codegen-units` - a number was expected' + $(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | \ + $(CGREP) 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' $(RUSTC) -C codegen-units=1 dummy.rs #Option taking a string - $(RUSTC) -C extra-filename dummy.rs 2>&1 | tee $(LOG) - grep 'codegen option `extra-filename` requires a string' $(LOG) + $(RUSTC) -C extra-filename dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `extra-filename` requires a string' $(RUSTC) -C extra-filename= dummy.rs 2>&1 $(RUSTC) -C extra-filename=foo dummy.rs 2>&1 #Option taking no argument - $(RUSTC) -C lto= dummy.rs 2>&1 | tee $(LOG) - grep 'codegen option `lto` takes no value' $(LOG) - $(RUSTC) -C lto=1 dummy.rs 2>&1 | tee $(LOG) - grep 'codegen option `lto` takes no value' $(LOG) - $(RUSTC) -C lto=foo dummy.rs 2>&1 | tee $(LOG) - grep 'codegen option `lto` takes no value' $(LOG) + $(RUSTC) -C lto= dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` takes no value' + $(RUSTC) -C lto=1 dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` takes no value' + $(RUSTC) -C lto=foo dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` takes no value' $(RUSTC) -C lto dummy.rs # Should not link dead code... $(RUSTC) -Z print-link-args dummy.rs 2>&1 | \ - grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\' -e '-dead_strip' -e '/OPT:REF' + $(CGREP) -e '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' # ... unless you specifically ask to keep it $(RUSTC) -Z print-link-args -C link-dead-code dummy.rs 2>&1 | \ - (! grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\' -e '-dead_strip' -e '/OPT:REF') + $(CGREP) -ve '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' diff --git a/src/test/run-make/error-found-staticlib-instead-crate/Makefile b/src/test/run-make/error-found-staticlib-instead-crate/Makefile index 24ff20ea89..fef12c4da6 100644 --- a/src/test/run-make/error-found-staticlib-instead-crate/Makefile +++ b/src/test/run-make/error-found-staticlib-instead-crate/Makefile @@ -2,4 +2,4 @@ all: $(RUSTC) foo.rs --crate-type staticlib - $(RUSTC) bar.rs 2>&1 | grep "found staticlib" + $(RUSTC) bar.rs 2>&1 | $(CGREP) "found staticlib" diff --git a/src/test/run-make/error-writing-dependencies/Makefile b/src/test/run-make/error-writing-dependencies/Makefile index 89fbfa0a1b..cbc96901a3 100644 --- a/src/test/run-make/error-writing-dependencies/Makefile +++ b/src/test/run-make/error-writing-dependencies/Makefile @@ -3,6 +3,6 @@ all: # Let's get a nice error message $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ - grep "error writing dependencies" + $(CGREP) "error writing dependencies" # Make sure the filename shows up - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | grep "baz" + $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz" diff --git a/src/test/run-make/extern-fn-reachable/main.rs b/src/test/run-make/extern-fn-reachable/main.rs index a1bd1041d1..27387332c1 100644 --- a/src/test/run-make/extern-fn-reachable/main.rs +++ b/src/test/run-make/extern-fn-reachable/main.rs @@ -10,9 +10,9 @@ #![feature(rustc_private)] -extern crate rustc_back; +extern crate rustc_metadata; -use rustc_back::dynamic_lib::DynamicLibrary; +use rustc_metadata::dynamic_lib::DynamicLibrary; use std::path::Path; pub fn main() { diff --git a/src/test/run-make/hir-tree/Makefile b/src/test/run-make/hir-tree/Makefile new file mode 100644 index 0000000000..bedb2b7d6a --- /dev/null +++ b/src/test/run-make/hir-tree/Makefile @@ -0,0 +1,9 @@ +-include ../tools.mk + +# Test that hir-tree output doens't crash and includes +# the string constant we would expect to see. + +all: + $(RUSTC) -o $(TMPDIR)/input.hir -Z unstable-options \ + --unpretty=hir-tree input.rs + $(CGREP) '"Hello, Rustaceans!\n"' < $(TMPDIR)/input.hir diff --git a/src/tools/miri/tests/run-pass/issue-15063.rs b/src/test/run-make/hir-tree/input.rs similarity index 80% rename from src/tools/miri/tests/run-pass/issue-15063.rs rename to src/test/run-make/hir-tree/input.rs index 726aee283e..12adc083bc 100644 --- a/src/tools/miri/tests/run-pass/issue-15063.rs +++ b/src/test/run-make/hir-tree/input.rs @@ -8,13 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(dead_code)] - -enum Two { A, B } -impl Drop for Two { - fn drop(&mut self) { - } -} fn main() { - let _k = Two::A; + println!("Hello, Rustaceans!"); } diff --git a/src/test/run-make/include_bytes_deps/Makefile b/src/test/run-make/include_bytes_deps/Makefile index 0400db412d..1293695b79 100644 --- a/src/test/run-make/include_bytes_deps/Makefile +++ b/src/test/run-make/include_bytes_deps/Makefile @@ -8,8 +8,7 @@ ifneq ($(shell uname),FreeBSD) ifndef IS_WINDOWS all: $(RUSTC) --emit dep-info main.rs - grep "input.txt" $(TMPDIR)/main.d - grep "input.bin" $(TMPDIR)/main.d + $(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d else all: diff --git a/src/test/run-make/include_bytes_deps/input.md b/src/test/run-make/include_bytes_deps/input.md new file mode 100644 index 0000000000..2a19b7405f --- /dev/null +++ b/src/test/run-make/include_bytes_deps/input.md @@ -0,0 +1 @@ +# Hello, world! diff --git a/src/test/run-make/include_bytes_deps/main.rs b/src/test/run-make/include_bytes_deps/main.rs index 579b2a452a..27ca1a46a5 100644 --- a/src/test/run-make/include_bytes_deps/main.rs +++ b/src/test/run-make/include_bytes_deps/main.rs @@ -8,6 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(external_doc)] + +#[doc(include="input.md")] +pub struct SomeStruct; + pub fn main() { const INPUT_TXT: &'static str = include_str!("input.txt"); const INPUT_BIN: &'static [u8] = include_bytes!("input.bin"); diff --git a/src/test/run-make/inline-always-many-cgu/Makefile b/src/test/run-make/inline-always-many-cgu/Makefile index edf88a6327..0cab955f64 100644 --- a/src/test/run-make/inline-always-many-cgu/Makefile +++ b/src/test/run-make/inline-always-many-cgu/Makefile @@ -2,7 +2,7 @@ all: $(RUSTC) foo.rs --emit llvm-ir -C codegen-units=2 - if grep -w call $(TMPDIR)/*.ll; then \ + if cat $(TMPDIR)/*.ll | $(CGREP) -e '\bcall\b'; then \ echo "found call instruction when one wasn't expected"; \ exit 1; \ fi diff --git a/src/test/run-make/invalid-library/Makefile b/src/test/run-make/invalid-library/Makefile index 5c9cc99350..b6fb122d98 100644 --- a/src/test/run-make/invalid-library/Makefile +++ b/src/test/run-make/invalid-library/Makefile @@ -3,4 +3,4 @@ all: touch $(TMPDIR)/rust.metadata.bin $(AR) crus $(TMPDIR)/libfoo-ffffffff-1.0.rlib $(TMPDIR)/rust.metadata.bin - $(RUSTC) foo.rs 2>&1 | grep "can't find crate for" + $(RUSTC) foo.rs 2>&1 | $(CGREP) "can't find crate for" diff --git a/src/test/run-make/invalid-staticlib/Makefile b/src/test/run-make/invalid-staticlib/Makefile index d4aa6d5e72..3a91902ccc 100644 --- a/src/test/run-make/invalid-staticlib/Makefile +++ b/src/test/run-make/invalid-staticlib/Makefile @@ -2,4 +2,4 @@ all: touch $(TMPDIR)/libfoo.a - echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | grep "failed to add native library" + echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | $(CGREP) "failed to add native library" diff --git a/src/test/run-make/issue-14698/Makefile b/src/test/run-make/issue-14698/Makefile index 28502f67e0..dbe8317dbc 100644 --- a/src/test/run-make/issue-14698/Makefile +++ b/src/test/run-make/issue-14698/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk all: - TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | grep "couldn't create a temp dir:" + TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | $(CGREP) "couldn't create a temp dir:" diff --git a/src/test/run-make/issue-19371/foo.rs b/src/test/run-make/issue-19371/foo.rs index 4db027aaee..f0ab1d5dc0 100644 --- a/src/test/run-make/issue-19371/foo.rs +++ b/src/test/run-make/issue-19371/foo.rs @@ -19,13 +19,13 @@ extern crate rustc_trans; extern crate syntax; use rustc::session::{build_session, Session}; -use rustc::session::config::{basic_options, build_configuration, Input, +use rustc::session::config::{basic_options, Input, OutputType, OutputTypes}; -use rustc_driver::driver::{compile_input, CompileController, anon_src}; +use rustc_driver::driver::{compile_input, CompileController}; use rustc_metadata::cstore::CStore; use rustc_errors::registry::Registry; +use syntax::codemap::FileName; -use std::collections::HashSet; use std::path::PathBuf; use std::rc::Rc; @@ -56,7 +56,7 @@ fn basic_sess(sysroot: PathBuf) -> (Session, Rc) { opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]); opts.maybe_sysroot = Some(sysroot); if let Ok(linker) = std::env::var("RUSTC_LINKER") { - opts.cg.linker = Some(linker); + opts.cg.linker = Some(linker.into()); } let descriptions = Registry::new(&rustc::DIAGNOSTICS); @@ -70,6 +70,6 @@ fn basic_sess(sysroot: PathBuf) -> (Session, Rc) { fn compile(code: String, output: PathBuf, sysroot: PathBuf) { let (sess, cstore) = basic_sess(sysroot); let control = CompileController::basic(); - let input = Input::Str { name: anon_src(), input: code }; - let _ = compile_input(&sess, &cstore, &input, &None, &Some(output), None, &control); + let input = Input::Str { name: FileName::Anon, input: code }; + let _ = compile_input(&sess, &cstore, &None, &input, &None, &Some(output), None, &control); } diff --git a/src/test/run-make/issue-22131/Makefile b/src/test/run-make/issue-22131/Makefile index cb4f146273..6db737a9e7 100644 --- a/src/test/run-make/issue-22131/Makefile +++ b/src/test/run-make/issue-22131/Makefile @@ -4,4 +4,4 @@ all: foo.rs $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs $(RUSTDOC) --test --cfg 'feature="bar"' \ -L $(TMPDIR) foo.rs |\ - grep -q 'foo.rs - foo (line 11) ... ok' + $(CGREP) 'foo.rs - foo (line 11) ... ok' diff --git a/src/test/run-make/issue-25581/test.c b/src/test/run-make/issue-25581/test.c index ab85d2bb13..5736b17302 100644 --- a/src/test/run-make/issue-25581/test.c +++ b/src/test/run-make/issue-25581/test.c @@ -2,10 +2,15 @@ #include #include -size_t slice_len(uint8_t *data, size_t len) { - return len; +struct ByteSlice { + uint8_t *data; + size_t len; +}; + +size_t slice_len(struct ByteSlice bs) { + return bs.len; } -uint8_t slice_elem(uint8_t *data, size_t len, size_t idx) { - return data[idx]; +uint8_t slice_elem(struct ByteSlice bs, size_t idx) { + return bs.data[idx]; } diff --git a/src/test/run-make/issue-26092/Makefile b/src/test/run-make/issue-26092/Makefile index 0d94c99a39..27631c31c4 100644 --- a/src/test/run-make/issue-26092/Makefile +++ b/src/test/run-make/issue-26092/Makefile @@ -1,5 +1,4 @@ -include ../tools.mk all: - $(RUSTC) -o "" blank.rs 2>&1 | \ - grep -i 'No such file or directory' + $(RUSTC) -o "" blank.rs 2>&1 | $(CGREP) -i 'No such file or directory' diff --git a/src/test/run-make/issue-33329/Makefile b/src/test/run-make/issue-33329/Makefile index c53f51d5bf..591e4e3dda 100644 --- a/src/test/run-make/issue-33329/Makefile +++ b/src/test/run-make/issue-33329/Makefile @@ -1,5 +1,5 @@ -include ../tools.mk all: - $(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | \ - grep "error: Error loading target specification: Could not find specification for target" + $(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | $(CGREP) \ + "error: Error loading target specification: Could not find specification for target" diff --git a/src/test/run-make/issue-35164/Makefile b/src/test/run-make/issue-35164/Makefile index c7bc26e3f5..6a451656dc 100644 --- a/src/test/run-make/issue-35164/Makefile +++ b/src/test/run-make/issue-35164/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk all: - $(RUSTC) main.rs --error-format json 2>&1 | grep -q '"byte_start":490.*"byte_end":496' + $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":490\b' '"byte_end":496\b' diff --git a/src/test/run-make/issue-40535/Makefile b/src/test/run-make/issue-40535/Makefile index 7d513a86a7..49db1d43e4 100644 --- a/src/test/run-make/issue-40535/Makefile +++ b/src/test/run-make/issue-40535/Makefile @@ -1,11 +1,13 @@ +-include ../tools.mk + # The ICE occurred in the following situation: # * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`) # * `bar` declares and depends on `extern crate baz` # * All crates built in metadata-only mode (`cargo check`) all: # cc https://github.com/rust-lang/rust/issues/40623 - $(RUSTC) baz.rs --emit=metadata --out-dir=$(TMPDIR) - $(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta --out-dir=$(TMPDIR) - $(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta --out-dir=$(TMPDIR) 2>&1 | \ - grep -vq "unexpectedly panicked" + $(RUSTC) baz.rs --emit=metadata + $(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta + $(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta 2>&1 | \ + $(CGREP) -v "unexpectedly panicked" # ^ Succeeds if it doesn't find the ICE message diff --git a/src/test/run-make/link-arg/Makefile b/src/test/run-make/link-arg/Makefile index 0ee239af0f..d7c9fd2711 100644 --- a/src/test/run-make/link-arg/Makefile +++ b/src/test/run-make/link-arg/Makefile @@ -2,4 +2,4 @@ RUSTC_FLAGS = -C link-arg="-lfoo" -C link-arg="-lbar" -Z print-link-args all: - $(RUSTC) $(RUSTC_FLAGS) empty.rs | grep lfoo | grep lbar + $(RUSTC) $(RUSTC_FLAGS) empty.rs | $(CGREP) lfoo lbar diff --git a/src/test/run-make/link-cfg/Makefile b/src/test/run-make/link-cfg/Makefile index 4abc0caa69..188cba5fe4 100644 --- a/src/test/run-make/link-cfg/Makefile +++ b/src/test/run-make/link-cfg/Makefile @@ -2,7 +2,7 @@ all: $(call DYLIB,return1) $(call DYLIB,return2) $(call NATIVE_STATICLIB,return3) ls $(TMPDIR) - $(RUSTC) --print cfg --target x86_64-unknown-linux-musl | grep crt-static + $(RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static $(RUSTC) no-deps.rs --cfg foo $(call RUN,no-deps) diff --git a/src/test/run-make/linker-output-non-utf8/Makefile b/src/test/run-make/linker-output-non-utf8/Makefile index 98fe83f45e..76d4b133de 100644 --- a/src/test/run-make/linker-output-non-utf8/Makefile +++ b/src/test/run-make/linker-output-non-utf8/Makefile @@ -19,6 +19,6 @@ all: $(RUSTC) library.rs mkdir $(bad_dir) mv $(TMPDIR)/liblibrary.a $(bad_dir) - LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | grep this_symbol_not_defined + LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | $(CGREP) this_symbol_not_defined endif diff --git a/src/test/run-make/long-linker-command-lines-cmd-exe/Makefile b/src/test/run-make/long-linker-command-lines-cmd-exe/Makefile new file mode 100644 index 0000000000..debe9e9382 --- /dev/null +++ b/src/test/run-make/long-linker-command-lines-cmd-exe/Makefile @@ -0,0 +1,6 @@ +-include ../tools.mk + +all: + $(RUSTC) foo.rs -g + cp foo.bat $(TMPDIR)/ + OUT_DIR="$(TMPDIR)" RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/src/test/run-make/long-linker-command-lines-cmd-exe/foo.bat b/src/test/run-make/long-linker-command-lines-cmd-exe/foo.bat new file mode 100644 index 0000000000..a9350f12bb --- /dev/null +++ b/src/test/run-make/long-linker-command-lines-cmd-exe/foo.bat @@ -0,0 +1 @@ +%MY_LINKER% %* diff --git a/src/test/run-make/long-linker-command-lines-cmd-exe/foo.rs b/src/test/run-make/long-linker-command-lines-cmd-exe/foo.rs new file mode 100644 index 0000000000..67d8ad0b67 --- /dev/null +++ b/src/test/run-make/long-linker-command-lines-cmd-exe/foo.rs @@ -0,0 +1,111 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Like the `long-linker-command-lines` test this test attempts to blow +// a command line limit for running the linker. Unlike that test, however, +// this test is testing `cmd.exe` specifically rather than the OS. +// +// Unfortunately `cmd.exe` has a 8192 limit which is relatively small +// in the grand scheme of things and anyone sripting rustc's linker +// is probably using a `*.bat` script and is likely to hit this limit. +// +// This test uses a `foo.bat` script as the linker which just simply +// delegates back to this program. The compiler should use a lower +// limit for arguments before passing everything via `@`, which +// means that everything should still succeed here. + +use std::env; +use std::fs::{self, File}; +use std::io::{BufWriter, Write, Read}; +use std::path::PathBuf; +use std::process::Command; + +fn main() { + if !cfg!(windows) { + return + } + + let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + let ok = tmpdir.join("ok"); + let not_ok = tmpdir.join("not_ok"); + if env::var("YOU_ARE_A_LINKER").is_ok() { + match env::args_os().find(|a| a.to_string_lossy().contains("@")) { + Some(file) => { + let file = file.to_str().unwrap(); + fs::copy(&file[1..], &ok).unwrap(); + } + None => { File::create(¬_ok).unwrap(); } + } + return + } + + let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); + let me = env::current_exe().unwrap(); + let bat = me.parent() + .unwrap() + .join("foo.bat"); + let bat_linker = format!("linker={}", bat.display()); + for i in (1..).map(|i| i * 10) { + println!("attempt: {}", i); + + let file = tmpdir.join("bar.rs"); + let mut f = BufWriter::new(File::create(&file).unwrap()); + let mut lib_name = String::new(); + for _ in 0..i { + lib_name.push_str("foo"); + } + for j in 0..i { + writeln!(f, "#[link(name = \"{}{}\")]", lib_name, j).unwrap(); + } + writeln!(f, "extern {{}}\nfn main() {{}}").unwrap(); + f.into_inner().unwrap(); + + drop(fs::remove_file(&ok)); + drop(fs::remove_file(¬_ok)); + let status = Command::new(&rustc) + .arg(&file) + .arg("-C").arg(&bat_linker) + .arg("--out-dir").arg(&tmpdir) + .env("YOU_ARE_A_LINKER", "1") + .env("MY_LINKER", &me) + .status() + .unwrap(); + + if !status.success() { + panic!("rustc didn't succeed: {}", status); + } + + if !ok.exists() { + assert!(not_ok.exists()); + continue + } + + let mut contents = Vec::new(); + File::open(&ok).unwrap().read_to_end(&mut contents).unwrap(); + + for j in 0..i { + let exp = format!("{}{}", lib_name, j); + let exp = if cfg!(target_env = "msvc") { + let mut out = Vec::with_capacity(exp.len() * 2); + for c in exp.encode_utf16() { + // encode in little endian + out.push(c as u8); + out.push((c >> 8) as u8); + } + out + } else { + exp.into_bytes() + }; + assert!(contents.windows(exp.len()).any(|w| w == &exp[..])); + } + + break + } +} diff --git a/src/test/run-make/long-linker-command-lines/foo.rs b/src/test/run-make/long-linker-command-lines/foo.rs index e6fd6b6536..2ac240982a 100644 --- a/src/test/run-make/long-linker-command-lines/foo.rs +++ b/src/test/run-make/long-linker-command-lines/foo.rs @@ -27,7 +27,8 @@ fn main() { let tmpdir = PathBuf::from(env::var_os("TMPDIR").unwrap()); let ok = tmpdir.join("ok"); if env::var("YOU_ARE_A_LINKER").is_ok() { - if let Some(file) = env::args().find(|a| a.contains("@")) { + if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) { + let file = file.to_str().expect("non-utf8 file argument"); fs::copy(&file[1..], &ok).unwrap(); } return @@ -76,11 +77,23 @@ fn main() { continue } - let mut contents = String::new(); - File::open(&ok).unwrap().read_to_string(&mut contents).unwrap(); + let mut contents = Vec::new(); + File::open(&ok).unwrap().read_to_end(&mut contents).unwrap(); for j in 0..i { - assert!(contents.contains(&format!("{}{}", lib_name, j))); + let exp = format!("{}{}", lib_name, j); + let exp = if cfg!(target_env = "msvc") { + let mut out = Vec::with_capacity(exp.len() * 2); + for c in exp.encode_utf16() { + // encode in little endian + out.push(c as u8); + out.push((c >> 8) as u8); + } + out + } else { + exp.into_bytes() + }; + assert!(contents.windows(exp.len()).any(|w| w == &exp[..])); } break diff --git a/src/test/run-make/many-crates-but-no-match/Makefile b/src/test/run-make/many-crates-but-no-match/Makefile index 239b689b52..03a797d95f 100644 --- a/src/test/run-make/many-crates-but-no-match/Makefile +++ b/src/test/run-make/many-crates-but-no-match/Makefile @@ -27,8 +27,10 @@ all: mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3) # Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match $(RUSTC) -L $(A2) -L $(A3) crateC.rs >$(LOG) 2>&1 || true - grep "found possibly newer version of crate \`crateA\` which \`crateB\` depends on" $(LOG) - grep "note: perhaps that crate needs to be recompiled?" $(LOG) - grep "note: crate \`crateA\` path #1:" $(LOG) - grep "note: crate \`crateA\` path #2:" $(LOG) - grep "note: crate \`crateB\` path #1:" $(LOG) + $(CGREP) \ + 'found possibly newer version of crate `crateA` which `crateB` depends on' \ + 'note: perhaps that crate needs to be recompiled?' \ + 'crate `crateA`:' \ + 'crate `crateB`:' \ + < $(LOG) + # the 'crate `crateA`' will match two entries. \ No newline at end of file diff --git a/src/test/run-make/mismatching-target-triples/Makefile b/src/test/run-make/mismatching-target-triples/Makefile index e79abf8223..1636e41b05 100644 --- a/src/test/run-make/mismatching-target-triples/Makefile +++ b/src/test/run-make/mismatching-target-triples/Makefile @@ -8,4 +8,4 @@ all: $(RUSTC) foo.rs --target=i686-unknown-linux-gnu $(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \ - | grep "couldn't find crate .foo. with expected target triple x86_64-unknown-linux-gnu" + | $(CGREP) 'couldn'"'"'t find crate `foo` with expected target triple x86_64-unknown-linux-gnu' diff --git a/src/test/run-make/missing-crate-dependency/Makefile b/src/test/run-make/missing-crate-dependency/Makefile index 4275c9b3f9..b5a5bf492a 100644 --- a/src/test/run-make/missing-crate-dependency/Makefile +++ b/src/test/run-make/missing-crate-dependency/Makefile @@ -6,4 +6,4 @@ all: $(call REMOVE_RLIBS,crateA) # Ensure crateC fails to compile since dependency crateA is missing $(RUSTC) crateC.rs 2>&1 | \ - grep "can't find crate for \`crateA\` which \`crateB\` depends on" + $(CGREP) 'can'"'"'t find crate for `crateA` which `crateB` depends on' diff --git a/src/test/run-make/no-builtins-lto/Makefile b/src/test/run-make/no-builtins-lto/Makefile index 3f70de5f76..b9688f16c6 100644 --- a/src/test/run-make/no-builtins-lto/Makefile +++ b/src/test/run-make/no-builtins-lto/Makefile @@ -6,4 +6,4 @@ all: # Build an executable that depends on that crate using LTO. The no_builtins crate doesn't # participate in LTO, so its rlib must be explicitly linked into the final binary. Verify this by # grepping the linker arguments. - $(RUSTC) main.rs -C lto -Z print-link-args | grep 'libno_builtins.rlib' + $(RUSTC) main.rs -C lto -Z print-link-args | $(CGREP) 'libno_builtins.rlib' diff --git a/src/test/run-make/output-filename-overwrites-input/Makefile b/src/test/run-make/output-filename-overwrites-input/Makefile new file mode 100644 index 0000000000..0554627d67 --- /dev/null +++ b/src/test/run-make/output-filename-overwrites-input/Makefile @@ -0,0 +1,10 @@ +-include ../tools.mk + +all: + cp foo.rs $(TMPDIR)/foo + $(RUSTC) $(TMPDIR)/foo 2>&1 \ + | $(CGREP) -e "the input file \".*foo\" would be overwritten by the generated executable" + $(RUSTC) foo.rs 2>&1 && $(RUSTC) -Z ls $(TMPDIR)/foo 2>&1 + cp foo.rs $(TMPDIR)/foo.rs + $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo.rs 2>&1 \ + | $(CGREP) -e "the input file \".*foo.rs\" would be overwritten by the generated executable" diff --git a/src/test/compile-fail/E0580.rs b/src/test/run-make/output-filename-overwrites-input/foo.rs similarity index 79% rename from src/test/compile-fail/E0580.rs rename to src/test/run-make/output-filename-overwrites-input/foo.rs index a2ef7da78a..046d27a9f0 100644 --- a/src/test/compile-fail/E0580.rs +++ b/src/test/run-make/output-filename-overwrites-input/foo.rs @@ -1,4 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() -> i32 { 0 } //~ ERROR E0580 +fn main() {} diff --git a/src/test/run-make/print-cfg/Makefile b/src/test/run-make/print-cfg/Makefile index 82fa3f6a3c..08303a46d1 100644 --- a/src/test/run-make/print-cfg/Makefile +++ b/src/test/run-make/print-cfg/Makefile @@ -1,16 +1,16 @@ -include ../tools.mk all: default - $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | grep windows - $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | grep x86_64 - $(RUSTC) --target i686-pc-windows-msvc --print cfg | grep msvc - $(RUSTC) --target i686-apple-darwin --print cfg | grep macos - $(RUSTC) --target i686-unknown-linux-gnu --print cfg | grep gnu + $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) windows + $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) x86_64 + $(RUSTC) --target i686-pc-windows-msvc --print cfg | $(CGREP) msvc + $(RUSTC) --target i686-apple-darwin --print cfg | $(CGREP) macos + $(RUSTC) --target i686-unknown-linux-gnu --print cfg | $(CGREP) gnu ifdef IS_WINDOWS default: - $(RUSTC) --print cfg | grep windows + $(RUSTC) --print cfg | $(CGREP) windows else default: - $(RUSTC) --print cfg | grep unix + $(RUSTC) --print cfg | $(CGREP) unix endif diff --git a/src/test/run-make/reproducible-build/reproducible-build.rs b/src/test/run-make/reproducible-build/reproducible-build.rs index dc7c702e5c..b47d780e52 100644 --- a/src/test/run-make/reproducible-build/reproducible-build.rs +++ b/src/test/run-make/reproducible-build/reproducible-build.rs @@ -124,5 +124,3 @@ fn main() { TupleStruct(1, 2, 3, 4).bar(); } - - diff --git a/src/test/run-make/rustc-macro-dep-files/Makefile b/src/test/run-make/rustc-macro-dep-files/Makefile index 1ab27397e3..d2c8e7fd04 100644 --- a/src/test/run-make/rustc-macro-dep-files/Makefile +++ b/src/test/run-make/rustc-macro-dep-files/Makefile @@ -8,5 +8,5 @@ else all: $(RUSTC) foo.rs $(RUSTC) bar.rs --emit dep-info - grep "proc-macro source" $(TMPDIR)/bar.d && exit 1 || exit 0 + $(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d endif diff --git a/src/test/run-make/sanitizer-address/Makefile b/src/test/run-make/sanitizer-address/Makefile index d0ac8903f1..207615bfbd 100644 --- a/src/test/run-make/sanitizer-address/Makefile +++ b/src/test/run-make/sanitizer-address/Makefile @@ -24,7 +24,6 @@ endif all: ifeq ($(ASAN_SUPPORT),1) - $(RUSTC) -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG) overflow.rs | grep -q librustc_asan - $(TMPDIR)/overflow 2>&1 | tee $(LOG) - grep -q stack-buffer-overflow $(LOG) + $(RUSTC) -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG) overflow.rs | $(CGREP) librustc_asan + $(TMPDIR)/overflow 2>&1 | $(CGREP) stack-buffer-overflow endif diff --git a/src/test/run-make/sanitizer-cdylib-link/Makefile b/src/test/run-make/sanitizer-cdylib-link/Makefile index 0cc4334f17..bea5519ec5 100644 --- a/src/test/run-make/sanitizer-cdylib-link/Makefile +++ b/src/test/run-make/sanitizer-cdylib-link/Makefile @@ -18,6 +18,5 @@ all: ifeq ($(ASAN_SUPPORT),1) $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) $(EXTRA_RUSTFLAG) library.rs $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) $(EXTRA_RUSTFLAG) -llibrary program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | tee $(LOG) - grep -q stack-buffer-overflow $(LOG) + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow endif diff --git a/src/test/run-make/sanitizer-dylib-link/Makefile b/src/test/run-make/sanitizer-dylib-link/Makefile index cdf0b91c1e..0cc8f73da8 100644 --- a/src/test/run-make/sanitizer-dylib-link/Makefile +++ b/src/test/run-make/sanitizer-dylib-link/Makefile @@ -18,6 +18,5 @@ all: ifeq ($(ASAN_SUPPORT),1) $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) $(EXTRA_RUSTFLAG) library.rs $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) $(EXTRA_RUSTFLAG) -llibrary program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | tee $(LOG) - grep -q stack-buffer-overflow $(LOG) + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow endif diff --git a/src/test/run-make/sanitizer-invalid-cratetype/Makefile b/src/test/run-make/sanitizer-invalid-cratetype/Makefile index d03bbf84c1..dc37c0d0bc 100644 --- a/src/test/run-make/sanitizer-invalid-cratetype/Makefile +++ b/src/test/run-make/sanitizer-invalid-cratetype/Makefile @@ -14,5 +14,5 @@ endif all: ifeq ($(ASAN_SUPPORT),1) - $(RUSTC) -Z sanitizer=address --crate-type proc-macro --target $(TARGET) hello.rs 2>&1 | grep -q -- '-Z sanitizer' + $(RUSTC) -Z sanitizer=address --crate-type proc-macro --target $(TARGET) hello.rs 2>&1 | $(CGREP) '-Z sanitizer' endif diff --git a/src/test/run-make/sanitizer-invalid-target/Makefile b/src/test/run-make/sanitizer-invalid-target/Makefile index 82e32f0995..df8afee15c 100644 --- a/src/test/run-make/sanitizer-invalid-target/Makefile +++ b/src/test/run-make/sanitizer-invalid-target/Makefile @@ -1,4 +1,5 @@ -include ../tools.mk all: - $(RUSTC) -Z sanitizer=leak --target i686-unknown-linux-gnu hello.rs 2>&1 | grep -q 'LeakSanitizer only works with the `x86_64-unknown-linux-gnu` target' + $(RUSTC) -Z sanitizer=leak --target i686-unknown-linux-gnu hello.rs 2>&1 | \ + $(CGREP) 'LeakSanitizer only works with the `x86_64-unknown-linux-gnu` target' diff --git a/src/test/run-make/sanitizer-leak/Makefile b/src/test/run-make/sanitizer-leak/Makefile index b18dd1d45e..ab43fac2e9 100644 --- a/src/test/run-make/sanitizer-leak/Makefile +++ b/src/test/run-make/sanitizer-leak/Makefile @@ -1,10 +1,16 @@ -include ../tools.mk +# FIXME(#46126) ThinLTO for libstd broke this test +ifeq (1,0) all: ifeq ($(TARGET),x86_64-unknown-linux-gnu) ifdef SANITIZER_SUPPORT - $(RUSTC) -C opt-level=1 -g -Z sanitizer=leak -Z print-link-args leak.rs | grep -q librustc_lsan - $(TMPDIR)/leak 2>&1 | grep -q 'detected memory leaks' + $(RUSTC) -C opt-level=1 -g -Z sanitizer=leak -Z print-link-args leak.rs | $(CGREP) librustc_lsan + $(TMPDIR)/leak 2>&1 | $(CGREP) 'detected memory leaks' endif endif +else +all: +endif + diff --git a/src/test/run-make/sanitizer-memory/Makefile b/src/test/run-make/sanitizer-memory/Makefile index f3a896cd4a..3507ca2bef 100644 --- a/src/test/run-make/sanitizer-memory/Makefile +++ b/src/test/run-make/sanitizer-memory/Makefile @@ -3,10 +3,8 @@ all: ifeq ($(TARGET),x86_64-unknown-linux-gnu) ifdef SANITIZER_SUPPORT - $(RUSTC) -g -Z sanitizer=memory -Z print-link-args uninit.rs | tee $(TMPDIR)/out - grep -q librustc_msan $(TMPDIR)/out - $(TMPDIR)/uninit 2>&1 | tee $(TMPDIR)/out - grep -q use-of-uninitialized-value $(TMPDIR)/out + $(RUSTC) -g -Z sanitizer=memory -Z print-link-args uninit.rs | $(CGREP) librustc_msan + $(TMPDIR)/uninit 2>&1 | $(CGREP) use-of-uninitialized-value endif endif diff --git a/src/test/run-make/sanitizer-staticlib-link/Makefile b/src/test/run-make/sanitizer-staticlib-link/Makefile index f92dc52b44..2b444d667b 100644 --- a/src/test/run-make/sanitizer-staticlib-link/Makefile +++ b/src/test/run-make/sanitizer-staticlib-link/Makefile @@ -13,6 +13,6 @@ all: ifeq ($(ASAN_SUPPORT),1) $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS) - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | grep -q stack-buffer-overflow + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow endif diff --git a/src/test/run-make/sepcomp-inlining/foo.rs b/src/test/run-make/sepcomp-inlining/foo.rs index 20fd18b829..5b62c1b062 100644 --- a/src/test/run-make/sepcomp-inlining/foo.rs +++ b/src/test/run-make/sepcomp-inlining/foo.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(start)] + #[inline] fn inlined() -> u32 { 1234 @@ -29,7 +31,10 @@ mod b { } } -fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { a::f(); b::f(); + + 0 } diff --git a/src/test/run-make/static-nobundle/Makefile b/src/test/run-make/static-nobundle/Makefile index 3eac12f5cc..abc32d4423 100644 --- a/src/test/run-make/static-nobundle/Makefile +++ b/src/test/run-make/static-nobundle/Makefile @@ -9,13 +9,13 @@ all: $(call NATIVE_STATICLIB,aaa) $(RUSTC) bbb.rs --crate-type=rlib # Check that bbb does NOT contain the definition of `native_func` - nm $(TMPDIR)/libbbb.rlib | (! grep "T _*native_func") - nm $(TMPDIR)/libbbb.rlib | grep "U _*native_func" + nm $(TMPDIR)/libbbb.rlib | $(CGREP) -ve "T _*native_func" + nm $(TMPDIR)/libbbb.rlib | $(CGREP) -e "U _*native_func" # Check that aaa gets linked (either as `-l aaa` or `aaa.lib`) when building ccc. - $(RUSTC) ccc.rs -C prefer-dynamic --crate-type=dylib -Z print-link-args | grep -e "-l[\" ]*aaa" -e "aaa.lib" + $(RUSTC) ccc.rs -C prefer-dynamic --crate-type=dylib -Z print-link-args | $(CGREP) -e '-l[" ]*aaa|aaa\.lib' # Check that aaa does NOT get linked when building ddd. - $(RUSTC) ddd.rs -Z print-link-args | (! grep -e "-l[\" ]*aaa" -e "aaa.lib") + $(RUSTC) ddd.rs -Z print-link-args | $(CGREP) -ve '-l[" ]*aaa|aaa\.lib' $(call RUN,ddd) diff --git a/src/test/run-make/symbols-are-reasonable/Makefile b/src/test/run-make/symbols-are-reasonable/Makefile index 1c117cf0c9..a6d294d2a1 100644 --- a/src/test/run-make/symbols-are-reasonable/Makefile +++ b/src/test/run-make/symbols-are-reasonable/Makefile @@ -10,6 +10,4 @@ OUT=$(TMPDIR)/lib.s all: $(RUSTC) lib.rs --emit=asm --crate-type=staticlib # just check for symbol declarations with the names we're expecting. - grep 'str.[0-9][0-9]*:' $(OUT) - grep 'byte_str.[0-9][0-9]*:' $(OUT) - grep 'vtable.[0-9][0-9]*' $(OUT) + $(CGREP) -e 'str\.[0-9]+:' 'byte_str\.[0-9]+:' 'vtable\.[0-9]+' < $(OUT) diff --git a/src/test/run-make/symbols-include-type-name/Makefile b/src/test/run-make/symbols-include-type-name/Makefile index 1add39e0cc..0850a2633e 100644 --- a/src/test/run-make/symbols-include-type-name/Makefile +++ b/src/test/run-make/symbols-include-type-name/Makefile @@ -6,4 +6,4 @@ OUT=$(TMPDIR)/lib.s all: $(RUSTC) --crate-type staticlib --emit asm lib.rs - grep Def $(OUT) + $(CGREP) Def < $(OUT) diff --git a/src/test/run-make/target-specs/Makefile b/src/test/run-make/target-specs/Makefile index 5ea96daa3e..aff15ce38b 100644 --- a/src/test/run-make/target-specs/Makefile +++ b/src/test/run-make/target-specs/Makefile @@ -1,9 +1,9 @@ -include ../tools.mk all: $(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm - grep -q -v morestack < $(TMPDIR)/foo.s - $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | grep -q "Error loading target specification" - $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | grep 'Field llvm-target' + $(CGREP) -v morestack < $(TMPDIR)/foo.s + $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | $(CGREP) "Error loading target specification" + $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | $(CGREP) 'Field llvm-target' RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm $(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json - diff --git a/src/test/run-make/target-without-atomics/Makefile b/src/test/run-make/target-without-atomics/Makefile index 48c53a5651..c5f575ddf8 100644 --- a/src/test/run-make/target-without-atomics/Makefile +++ b/src/test/run-make/target-without-atomics/Makefile @@ -2,4 +2,4 @@ # The target used below doesn't support atomic operations. Verify that's the case all: - $(RUSTC) --print cfg --target thumbv6m-none-eabi | grep -qv target_has_atomic + $(RUSTC) --print cfg --target thumbv6m-none-eabi | $(CGREP) -v target_has_atomic diff --git a/src/test/run-make/test-harness/Makefile b/src/test/run-make/test-harness/Makefile index aad8b1b3fb..39477c07ce 100644 --- a/src/test/run-make/test-harness/Makefile +++ b/src/test/run-make/test-harness/Makefile @@ -3,7 +3,6 @@ all: # check that #[cfg_attr(..., ignore)] does the right thing. $(RUSTC) --test test-ignore-cfg.rs --cfg ignorecfg - $(call RUN,test-ignore-cfg) | grep 'shouldnotignore ... ok' - $(call RUN,test-ignore-cfg) | grep 'shouldignore ... ignored' - $(call RUN,test-ignore-cfg --quiet) | grep "^i\.$$" - $(call RUN,test-ignore-cfg --quiet) | grep -v 'should' + $(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore ... ok' 'shouldignore ... ignored' + $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -e "^i\.$$" + $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -v 'should' diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk index c5d5626bf7..d9103e1992 100644 --- a/src/test/run-make/tools.mk +++ b/src/test/run-make/tools.mk @@ -16,6 +16,7 @@ RUSTDOC := $(RUSTDOC) --linker $(RUSTC_LINKER) -Z unstable-options endif #CC := $(CC) -L $(TMPDIR) HTMLDOCCK := $(PYTHON) $(S)/src/etc/htmldocck.py +CGREP := "$(S)/src/etc/cat-and-grep.sh" # This is the name of the binary we will generate and run; use this # e.g. for `$(CC) -o $(RUN_BINFILE)`. @@ -92,7 +93,7 @@ ifeq ($(UNAME),SunOS) EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv else ifeq ($(UNAME),OpenBSD) - EXTRACFLAGS := -lm -lpthread + EXTRACFLAGS := -lm -lpthread -lc++abi RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))" else EXTRACFLAGS := -lm -lrt -ldl -lpthread diff --git a/src/test/run-make/treat-err-as-bug/Makefile b/src/test/run-make/treat-err-as-bug/Makefile index a8fa2d4e0f..f99e461117 100644 --- a/src/test/run-make/treat-err-as-bug/Makefile +++ b/src/test/run-make/treat-err-as-bug/Makefile @@ -2,4 +2,4 @@ all: $(RUSTC) err.rs -Z treat-err-as-bug 2>&1 \ - | grep -q "panicked at 'encountered error with .-Z treat_err_as_bug'" + | $(CGREP) "panicked at 'encountered error with \`-Z treat_err_as_bug'" diff --git a/src/test/run-make/type-mismatch-same-crate-name/Makefile b/src/test/run-make/type-mismatch-same-crate-name/Makefile index 1044d73fd1..9fd1377322 100644 --- a/src/test/run-make/type-mismatch-same-crate-name/Makefile +++ b/src/test/run-make/type-mismatch-same-crate-name/Makefile @@ -8,12 +8,12 @@ all: $(RUSTC) --crate-type=rlib crateB.rs --extern crateA=$(TMPDIR)/libcrateA-1.rlib # make crateC depend on version 2 of crateA $(RUSTC) crateC.rs --extern crateA=$(TMPDIR)/libcrateA-2.rlib 2>&1 | \ - tr -d '\r\n' | grep \ + tr -d '\r\n' | $(CGREP) -e \ "mismatched types.*\ - crateB::try_foo(foo2);.*\ + crateB::try_foo\(foo2\);.*\ expected struct \`crateA::foo::Foo\`, found struct \`crateA::Foo\`.*\ different versions of crate \`crateA\`.*\ mismatched types.*\ - crateB::try_bar(bar2);.*\ + crateB::try_bar\(bar2\);.*\ expected trait \`crateA::bar::Bar\`, found trait \`crateA::Bar\`.*\ different versions of crate \`crateA\`" diff --git a/src/test/run-make/used/Makefile b/src/test/run-make/used/Makefile index 9d7aa30f87..47edcbb5d0 100644 --- a/src/test/run-make/used/Makefile +++ b/src/test/run-make/used/Makefile @@ -7,5 +7,5 @@ all: else all: $(RUSTC) -C opt-level=3 --emit=obj used.rs - nm $(TMPDIR)/used.o | grep FOO + nm $(TMPDIR)/used.o | $(CGREP) FOO endif diff --git a/src/test/run-make/volatile-intrinsics/Makefile b/src/test/run-make/volatile-intrinsics/Makefile index 34fa56efee..acbadbef9f 100644 --- a/src/test/run-make/volatile-intrinsics/Makefile +++ b/src/test/run-make/volatile-intrinsics/Makefile @@ -6,5 +6,4 @@ all: $(call RUN,main) # ... and the loads/stores must not be optimized out. $(RUSTC) main.rs --emit=llvm-ir - grep "load volatile" $(TMPDIR)/main.ll - grep "store volatile" $(TMPDIR)/main.ll + $(CGREP) "load volatile" "store volatile" < $(TMPDIR)/main.ll diff --git a/src/test/run-make/weird-output-filenames/Makefile b/src/test/run-make/weird-output-filenames/Makefile index 8b69c68279..f161fe9f8e 100644 --- a/src/test/run-make/weird-output-filenames/Makefile +++ b/src/test/run-make/weird-output-filenames/Makefile @@ -3,13 +3,13 @@ all: cp foo.rs $(TMPDIR)/.foo.rs $(RUSTC) $(TMPDIR)/.foo.rs 2>&1 \ - | grep "invalid character.*in crate name:" + | $(CGREP) -e "invalid character.*in crate name:" cp foo.rs $(TMPDIR)/.foo.bar $(RUSTC) $(TMPDIR)/.foo.bar 2>&1 \ - | grep "invalid character.*in crate name:" - cp foo.rs $(TMPDIR)/+foo+bar - $(RUSTC) $(TMPDIR)/+foo+bar 2>&1 \ - | grep "invalid character.*in crate name:" + | $(CGREP) -e "invalid character.*in crate name:" + cp foo.rs $(TMPDIR)/+foo+bar.rs + $(RUSTC) $(TMPDIR)/+foo+bar.rs 2>&1 \ + | $(CGREP) -e "invalid character.*in crate name:" cp foo.rs $(TMPDIR)/-foo.rs $(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \ - | grep 'crate names cannot start with a `-`' + | $(CGREP) 'crate names cannot start with a `-`' diff --git a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs index fc031f4a31..9f9ef47722 100644 --- a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs +++ b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs @@ -17,7 +17,7 @@ extern crate syntax; use syntax::ast::*; use syntax::attr::*; use syntax::ast; -use syntax::codemap::FilePathMapping; +use syntax::codemap::{FilePathMapping, FileName}; use syntax::parse; use syntax::parse::{ParseSess, PResult}; use syntax::parse::new_parser_from_source_str; @@ -32,7 +32,7 @@ use std::fmt; // Copied out of syntax::util::parser_testing pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { - new_parser_from_source_str(ps, "bogofile".to_string(), source_str) + new_parser_from_source_str(ps, FileName::Custom("bogofile".to_owned()), source_str) } fn with_error_checking_parse<'a, T, F>(s: String, ps: &'a ParseSess, f: F) -> PResult<'a, T> where diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs index 63dbd4d5be..f485982e2d 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs @@ -69,7 +69,7 @@ fn expand_deriving_partial_eq(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, it let trait_def = TraitDef { span: span, attributes: Vec::new(), - path: deriving::generic::ty::Path::new(vec!["std", "cmp", "PartialEq"]), + path: deriving::generic::ty::Path::new(vec!["cmp", "PartialEq"]), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs index 16856d3041..449cd29ada 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs @@ -50,7 +50,7 @@ fn expand(cx: &mut ExtCtxt, let trait_def = TraitDef { span: span, attributes: vec![], - path: Path::new(vec!["TotalSum"]), + path: Path::new_local("TotalSum"), additional_bounds: vec![], generics: LifetimeBounds::empty(), associated_types: vec![], diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs index 50b16a0e26..0f90cb3752 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs @@ -21,6 +21,7 @@ extern crate rustc; extern crate rustc_plugin; use syntax::ast; +use syntax::attr; use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable}; use syntax::ext::build::AstBuilder; use syntax::symbol::Symbol; @@ -46,7 +47,7 @@ fn expand(cx: &mut ExtCtxt, let trait_def = TraitDef { span: span, attributes: vec![], - path: Path::new(vec!["TotalSum"]), + path: Path::new_local("TotalSum"), additional_bounds: vec![], generics: LifetimeBounds::empty(), associated_types: vec![], @@ -80,7 +81,7 @@ fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span, }; fields.iter().fold(cx.expr_isize(trait_span, 0), |acc, ref item| { - if item.attrs.iter().find(|a| a.check_name("ignore")).is_some() { + if attr::contains_name(&item.attrs, "ignore") { acc } else { cx.expr_binary(item.span, ast::BinOpKind::Add, acc, diff --git a/src/test/run-pass-fulldeps/auxiliary/issue_16723_multiple_items_syntax_ext.rs b/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs similarity index 100% rename from src/test/run-pass-fulldeps/auxiliary/issue_16723_multiple_items_syntax_ext.rs rename to src/test/run-pass-fulldeps/auxiliary/issue-16723.rs diff --git a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs index 09a2e8ecd8..7a15a4cb3a 100644 --- a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs +++ b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs @@ -14,9 +14,9 @@ // do the runtime check that these functions aren't exported. #![allow(private_no_mangle_fns)] -extern crate rustc_back; +extern crate rustc_metadata; -use rustc_back::dynamic_lib::DynamicLibrary; +use rustc_metadata::dynamic_lib::DynamicLibrary; #[no_mangle] pub fn foo() { bar(); } diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin_crate_outlive_expansion_phase.rs b/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs similarity index 100% rename from src/test/run-pass-fulldeps/auxiliary/plugin_crate_outlive_expansion_phase.rs rename to src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs diff --git a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs b/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs index 0c8af013fd..26419a5151 100644 --- a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs +++ b/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs @@ -29,8 +29,8 @@ use rustc_plugin::Registry; // WARNING WARNING WARNING WARNING WARNING // ======================================= // -// This code also appears in src/doc/guide-plugin.md. Please keep -// the two copies in sync! FIXME: have rustdoc read this file +// This code also appears in src/doc/unstable-book/src/language-features/plugin.md. +// Please keep the two copies in sync! FIXME: have rustdoc read this file fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) -> Box { diff --git a/src/test/run-pass-fulldeps/create-dir-all-bare.rs b/src/test/run-pass-fulldeps/create-dir-all-bare.rs index e22736d778..ba42cb870c 100644 --- a/src/test/run-pass-fulldeps/create-dir-all-bare.rs +++ b/src/test/run-pass-fulldeps/create-dir-all-bare.rs @@ -12,11 +12,11 @@ #![feature(rustc_private)] -extern crate rustc_back; +extern crate tempdir; use std::env; use std::fs; -use rustc_back::tempdir::TempDir; +use tempdir::TempDir; fn main() { let td = TempDir::new("create-dir-all-bare").unwrap(); diff --git a/src/test/compile-fail-fulldeps/derive-no-std-not-supported.rs b/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs similarity index 80% rename from src/test/compile-fail-fulldeps/derive-no-std-not-supported.rs rename to src/test/run-pass-fulldeps/derive-no-std-not-supported.rs index 1e97cb07f8..a0747e0fbf 100644 --- a/src/test/compile-fail-fulldeps/derive-no-std-not-supported.rs +++ b/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs @@ -8,22 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(rustc_private)] #![no_std] extern crate serialize as rustc_serialize; -#[derive(RustcEncodable)] //~ ERROR this trait cannot be derived +#[derive(RustcEncodable)] struct Bar { x: u32, } -#[derive(RustcDecodable)] //~ ERROR this trait cannot be derived +#[derive(RustcDecodable)] struct Baz { x: u32, } fn main() { - Foo { x: 0 }; Bar { x: 0 }; Baz { x: 0 }; } diff --git a/src/test/run-pass-fulldeps/issue-15149.rs b/src/test/run-pass-fulldeps/issue-15149.rs index c0ed7165af..121fd4a982 100644 --- a/src/test/run-pass-fulldeps/issue-15149.rs +++ b/src/test/run-pass-fulldeps/issue-15149.rs @@ -13,13 +13,13 @@ #![feature(rustc_private)] -extern crate rustc_back; +extern crate tempdir; use std::env; use std::fs; use std::process; use std::str; -use rustc_back::tempdir::TempDir; +use tempdir::TempDir; fn main() { // If we're the child, make sure we were invoked correctly diff --git a/src/test/run-pass-fulldeps/issue_16723_multiple_items_syntax_ext.rs b/src/test/run-pass-fulldeps/issue-16723.rs similarity index 86% rename from src/test/run-pass-fulldeps/issue_16723_multiple_items_syntax_ext.rs rename to src/test/run-pass-fulldeps/issue-16723.rs index c1ffeb7c8e..bacfa8d1ea 100644 --- a/src/test/run-pass-fulldeps/issue_16723_multiple_items_syntax_ext.rs +++ b/src/test/run-pass-fulldeps/issue-16723.rs @@ -9,9 +9,9 @@ // except according to those terms. // ignore-stage1 -// aux-build:issue_16723_multiple_items_syntax_ext.rs +// aux-build:issue-16723.rs #![feature(plugin)] -#![plugin(issue_16723_multiple_items_syntax_ext)] +#![plugin(issue_16723)] multiple_items!(); diff --git a/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs b/src/test/run-pass-fulldeps/outlive-expansion-phase.rs similarity index 83% rename from src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs rename to src/test/run-pass-fulldeps/outlive-expansion-phase.rs index 9573d0c8c4..6eb3e51072 100644 --- a/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs +++ b/src/test/run-pass-fulldeps/outlive-expansion-phase.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:plugin_crate_outlive_expansion_phase.rs +// aux-build:outlive-expansion-phase.rs // ignore-stage1 #![feature(plugin)] -#![plugin(plugin_crate_outlive_expansion_phase)] +#![plugin(outlive_expansion_phase)] pub fn main() {} diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs index 456088b2c5..5afa9a217e 100644 --- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs @@ -33,7 +33,7 @@ extern crate syntax; use syntax::ast::*; -use syntax::codemap::{Spanned, DUMMY_SP}; +use syntax::codemap::{Spanned, DUMMY_SP, FileName}; use syntax::codemap::FilePathMapping; use syntax::fold::{self, Folder}; use syntax::parse::{self, ParseSess}; @@ -44,7 +44,7 @@ use syntax::util::ThinVec; fn parse_expr(ps: &ParseSess, src: &str) -> P { let mut p = parse::new_parser_from_source_str(ps, - "".to_owned(), + FileName::Custom("expr".to_owned()), src.to_owned()); p.parse_expr().unwrap() } @@ -131,6 +131,7 @@ fn iter_exprs(depth: usize, f: &mut FnMut(P)) { id: DUMMY_NODE_ID, rules: BlockCheckMode::Default, span: DUMMY_SP, + recovered: false, }); iter_exprs(depth - 1, &mut |e| g(ExprKind::If(e, block.clone(), None))); }, diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs index 29b6cc012b..0433b11f7c 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs @@ -17,6 +17,7 @@ extern crate rustc_plugin; extern crate syntax; use rustc_plugin::Registry; +use syntax::attr; use syntax::ext::base::*; use syntax::feature_gate::AttributeType::Whitelisted; use syntax::symbol::Symbol; @@ -59,9 +60,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass { _ => cx.tcx.hir.expect_item(cx.tcx.hir.get_parent(id)), }; - if !item.attrs.iter().any(|a| a.check_name("whitelisted_attr")) { + if !attr::contains_name(&item.attrs, "whitelisted_attr") { cx.span_lint(MISSING_WHITELISTED_ATTR, span, - "Missing 'whitelited_attr' attribute"); + "Missing 'whitelisted_attr' attribute"); } } } diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs new file mode 100644 index 0000000000..58b4b2a529 --- /dev/null +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro)] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Test)] +pub fn derive(_input: TokenStream) -> TokenStream { + "fn f(s: S) { s.x }".parse().unwrap() +} + +#[proc_macro_attribute] +pub fn attr_test(_attr: TokenStream, input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs b/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs new file mode 100644 index 0000000000..e53e94ae47 --- /dev/null +++ b/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue-42708.rs +// ignore-stage1 + +#![feature(decl_macro, proc_macro)] +#![allow(unused)] + +extern crate issue_42708; + +macro m() { + #[derive(issue_42708::Test)] + struct S { x: () } + + #[issue_42708::attr_test] + struct S2 { x: () } + + #[derive(Clone)] + struct S3 { x: () } + + fn g(s: S, s2: S2, s3: S3) { + (s.x, s2.x, s3.x); + } +} + +m!(); + +fn main() {} diff --git a/src/test/run-pass-fulldeps/rename-directory.rs b/src/test/run-pass-fulldeps/rename-directory.rs index f107e10428..7a2a434352 100644 --- a/src/test/run-pass-fulldeps/rename-directory.rs +++ b/src/test/run-pass-fulldeps/rename-directory.rs @@ -15,11 +15,11 @@ #![feature(rustc_private)] -extern crate rustc_back; +extern crate tempdir; use std::ffi::CString; use std::fs::{self, File}; -use rustc_back::tempdir::TempDir; +use tempdir::TempDir; fn rename_directory() { let tmpdir = TempDir::new("rename_directory").ok().expect("rename_directory failed"); diff --git a/src/test/run-pass-fulldeps/stdio-from.rs b/src/test/run-pass-fulldeps/stdio-from.rs index f64bbf9312..535ab711f5 100644 --- a/src/test/run-pass-fulldeps/stdio-from.rs +++ b/src/test/run-pass-fulldeps/stdio-from.rs @@ -12,7 +12,7 @@ #![feature(rustc_private)] -extern crate rustc_back; +extern crate tempdir; use std::env; use std::fs::File; @@ -20,7 +20,7 @@ use std::io; use std::io::{Read, Write}; use std::process::{Command, Stdio}; -use rustc_back::tempdir::TempDir; +use tempdir::TempDir; fn main() { if env::args().len() > 1 { diff --git a/src/test/run-pass-fulldeps/switch-stdout.rs b/src/test/run-pass-fulldeps/switch-stdout.rs index 4542e27545..16f7e28328 100644 --- a/src/test/run-pass-fulldeps/switch-stdout.rs +++ b/src/test/run-pass-fulldeps/switch-stdout.rs @@ -10,12 +10,12 @@ #![feature(rustc_private)] -extern crate rustc_back; +extern crate tempdir; use std::fs::File; use std::io::{Read, Write}; -use rustc_back::tempdir::TempDir; +use tempdir::TempDir; #[cfg(unix)] fn switch_stdout_to(file: File) { diff --git a/src/test/run-pass-fulldeps/vector-sort-panic-safe.rs b/src/test/run-pass-fulldeps/vector-sort-panic-safe.rs index 82305045f8..adc72aa0ea 100644 --- a/src/test/run-pass-fulldeps/vector-sort-panic-safe.rs +++ b/src/test/run-pass-fulldeps/vector-sort-panic-safe.rs @@ -12,7 +12,6 @@ #![feature(rustc_private)] #![feature(sort_unstable)] -#![feature(const_atomic_usize_new)] extern crate rand; diff --git a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs index 439c1080f4..4466a95cb3 100644 --- a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs +++ b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs @@ -11,7 +11,6 @@ // no-prefer-dynamic #![allow(dead_code)] -#![feature(const_atomic_usize_new)] // check dtor calling order when casting enums. diff --git a/src/test/run-pass/abi-sysv64-arg-passing.rs b/src/test/run-pass/abi-sysv64-arg-passing.rs index 23dd060318..4ec3f16f7a 100644 --- a/src/test/run-pass/abi-sysv64-arg-passing.rs +++ b/src/test/run-pass/abi-sysv64-arg-passing.rs @@ -39,7 +39,6 @@ // note: windows is ignored as rust_test_helpers does not have the sysv64 abi on windows -#![feature(abi_sysv64)] #[allow(dead_code)] #[allow(improper_ctypes)] diff --git a/src/test/run-pass/abi-sysv64-register-usage.rs b/src/test/run-pass/abi-sysv64-register-usage.rs index 7e3b32122a..e701329127 100644 --- a/src/test/run-pass/abi-sysv64-register-usage.rs +++ b/src/test/run-pass/abi-sysv64-register-usage.rs @@ -15,7 +15,6 @@ // ignore-arm // ignore-aarch64 -#![feature(abi_sysv64)] #![feature(asm)] #[cfg(target_arch = "x86_64")] @@ -103,4 +102,4 @@ pub fn main() { } #[cfg(not(target_arch = "x86_64"))] -pub fn main() {} \ No newline at end of file +pub fn main() {} diff --git a/src/test/run-pass/abort-on-c-abi.rs b/src/test/run-pass/abort-on-c-abi.rs new file mode 100644 index 0000000000..40c4ec2015 --- /dev/null +++ b/src/test/run-pass/abort-on-c-abi.rs @@ -0,0 +1,44 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Since we mark some ABIs as "nounwind" to LLVM, we must make sure that +// we never unwind through them. + +// ignore-emscripten no processes +// ignore-test FIXME rust-lang/rust#48251 -- temporarily disabled + +use std::{env, panic}; +use std::io::prelude::*; +use std::io; +use std::process::{Command, Stdio}; + +extern "C" fn panic_in_ffi() { + panic!("Test"); +} + +fn test() { + let _ = panic::catch_unwind(|| { panic_in_ffi(); }); + // The process should have aborted by now. + io::stdout().write(b"This should never be printed.\n"); + let _ = io::stdout().flush(); +} + +fn main() { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "test" { + return test(); + } + + let mut p = Command::new(&args[0]) + .stdout(Stdio::piped()) + .stdin(Stdio::piped()) + .arg("test").spawn().unwrap(); + assert!(!p.wait().unwrap().success()); +} diff --git a/src/test/run-pass/align-offset-sign.rs b/src/test/run-pass/align-offset-sign.rs new file mode 100644 index 0000000000..aaa0419d06 --- /dev/null +++ b/src/test/run-pass/align-offset-sign.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(align_offset)] + +fn main() { + let x = 1 as *const u8; + assert_eq!(x.align_offset(8), 7); +} diff --git a/src/test/run-pass/align-with-extern-c-fn.rs b/src/test/run-pass/align-with-extern-c-fn.rs new file mode 100644 index 0000000000..db25960df4 --- /dev/null +++ b/src/test/run-pass/align-with-extern-c-fn.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// #45662 + +#![feature(repr_align)] +#![feature(attr_literals)] + +#[repr(align(16))] +pub struct A { + y: i64, +} + +pub extern "C" fn foo(x: A) {} + +fn main() {} diff --git a/src/test/run-pass/arbitrary_self_types_raw_pointer_struct.rs b/src/test/run-pass/arbitrary_self_types_raw_pointer_struct.rs new file mode 100644 index 0000000000..8b6941e1c6 --- /dev/null +++ b/src/test/run-pass/arbitrary_self_types_raw_pointer_struct.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(arbitrary_self_types)] + +use std::rc::Rc; + +struct Foo(String); + +impl Foo { + unsafe fn foo(self: *const Self) -> *const str { + (*self).0.as_ref() + } + + fn complicated_1(self: *const Rc) -> &'static str { + "Foo::complicated_1" + } + + unsafe fn complicated_2(self: Rc<*const Self>) -> *const str { + (**self).0.as_ref() + } +} + +fn main() { + let foo = Foo("abc123".into()); + assert_eq!("abc123", unsafe { &*(&foo as *const Foo).foo() }); + assert_eq!("Foo::complicated_1", std::ptr::null::>().complicated_1()); + let rc = Rc::new(&foo as *const Foo); + assert_eq!("abc123", unsafe { &*rc.complicated_2()}); +} diff --git a/src/test/run-pass/arbitrary_self_types_raw_pointer_trait.rs b/src/test/run-pass/arbitrary_self_types_raw_pointer_trait.rs new file mode 100644 index 0000000000..f70e38a14e --- /dev/null +++ b/src/test/run-pass/arbitrary_self_types_raw_pointer_trait.rs @@ -0,0 +1,70 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(arbitrary_self_types)] + +use std::ptr; + +trait Foo { + fn foo(self: *const Self) -> &'static str; + + unsafe fn bar(self: *const Self) -> i64; + + unsafe fn complicated(self: *const *const Self) -> i64 where Self: Sized { + (*self).bar() + } +} + +impl Foo for i32 { + fn foo(self: *const Self) -> &'static str { + "I'm an i32!" + } + + unsafe fn bar(self: *const Self) -> i64 { + *self as i64 + } +} + +impl Foo for u32 { + fn foo(self: *const Self) -> &'static str { + "I'm a u32!" + } + + unsafe fn bar(self: *const Self) -> i64 { + *self as i64 + } +} + +fn main() { + let null_i32 = ptr::null::() as *const Foo; + let null_u32 = ptr::null::() as *const Foo; + + assert_eq!("I'm an i32!", null_i32.foo()); + assert_eq!("I'm a u32!", null_u32.foo()); + + let valid_i32 = 5i32; + let valid_i32_thin = &valid_i32 as *const i32; + assert_eq!("I'm an i32!", valid_i32_thin.foo()); + assert_eq!(5, unsafe { valid_i32_thin.bar() }); + assert_eq!(5, unsafe { (&valid_i32_thin as *const *const i32).complicated() }); + let valid_i32_fat = valid_i32_thin as *const Foo; + assert_eq!("I'm an i32!", valid_i32_fat.foo()); + assert_eq!(5, unsafe { valid_i32_fat.bar() }); + + let valid_u32 = 18u32; + let valid_u32_thin = &valid_u32 as *const u32; + assert_eq!("I'm a u32!", valid_u32_thin.foo()); + assert_eq!(18, unsafe { valid_u32_thin.bar() }); + assert_eq!(18, unsafe { (&valid_u32_thin as *const *const u32).complicated() }); + let valid_u32_fat = valid_u32_thin as *const Foo; + assert_eq!("I'm a u32!", valid_u32_fat.foo()); + assert_eq!(18, unsafe { valid_u32_fat.bar() }); + +} diff --git a/src/test/run-pass/asm-in-moved.rs b/src/test/run-pass/asm-in-moved.rs new file mode 100644 index 0000000000..246dd83fbe --- /dev/null +++ b/src/test/run-pass/asm-in-moved.rs @@ -0,0 +1,41 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + +#![feature(asm)] + +use std::cell::Cell; + +#[repr(C)] +struct NoisyDrop<'a>(&'a Cell<&'static str>); +impl<'a> Drop for NoisyDrop<'a> { + fn drop(&mut self) { + self.0.set("destroyed"); + } +} + +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +fn main() { + let status = Cell::new("alive"); + { + let _y: Box; + let x = Box::new(NoisyDrop(&status)); + unsafe { + asm!("mov $1, $0" : "=r"(_y) : "r"(x)); + } + assert_eq!(status.get(), "alive"); + } + assert_eq!(status.get(), "destroyed"); +} + +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +fn main() {} diff --git a/src/test/run-pass/asm-out-assign.rs b/src/test/run-pass/asm-out-assign.rs index d7913b473f..6acb9054af 100644 --- a/src/test/run-pass/asm-out-assign.rs +++ b/src/test/run-pass/asm-out-assign.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions ast mir +//[mir]compile-flags: -Z borrowck=mir #![feature(asm)] diff --git a/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where.rs b/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where.rs index 7cde780cc5..5ceb1013ad 100644 --- a/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where.rs +++ b/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where.rs @@ -12,8 +12,6 @@ // `Item` originates in a where-clause, not the declaration of // `T`. Issue #20300. -#![feature(const_atomic_usize_new)] - use std::marker::{PhantomData}; use std::sync::atomic::{AtomicUsize}; use std::sync::atomic::Ordering::SeqCst; diff --git a/src/test/run-pass/auxiliary/issue-17718-aux.rs b/src/test/run-pass/auxiliary/issue-17718-aux.rs index 36891a1eca..2bc8b4b7ba 100644 --- a/src/test/run-pass/auxiliary/issue-17718-aux.rs +++ b/src/test/run-pass/auxiliary/issue-17718-aux.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(const_atomic_usize_new)] - use std::sync::atomic; pub const C1: usize = 1; diff --git a/src/test/run-pass/auxiliary/issue_42007_s.rs b/src/test/run-pass/auxiliary/issue_42007_s.rs index b965e916f9..91ad9869ed 100644 --- a/src/test/run-pass/auxiliary/issue_42007_s.rs +++ b/src/test/run-pass/auxiliary/issue_42007_s.rs @@ -11,4 +11,4 @@ #[repr(u8)] pub enum E { B = 1 as u8, -} \ No newline at end of file +} diff --git a/src/test/run-pass/auxiliary/svh-a-comment.rs b/src/test/run-pass/auxiliary/svh-a-comment.rs deleted file mode 100644 index 22e40822ee..0000000000 --- a/src/test/run-pass/auxiliary/svh-a-comment.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo(_: isize) -> isize { - // a comment does not affect the svh - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/run-pass/auxiliary/svh-a-doc.rs b/src/test/run-pass/auxiliary/svh-a-doc.rs deleted file mode 100644 index 3d8a728967..0000000000 --- a/src/test/run-pass/auxiliary/svh-a-doc.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -// Adding some documentation does not affect the svh. - -/// foo always returns three. -pub fn foo(_: isize) -> isize { - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/run-pass/auxiliary/svh-a-macro.rs b/src/test/run-pass/auxiliary/svh-a-macro.rs deleted file mode 100644 index 41d7eb7b18..0000000000 --- a/src/test/run-pass/auxiliary/svh-a-macro.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo(_: isize) -> isize { - // a macro invocation in a function body does not affect the svh, - // as long as it yields the same code. - three!() -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/run-pass/auxiliary/svh-a-no-change.rs b/src/test/run-pass/auxiliary/svh-a-no-change.rs deleted file mode 100644 index 31a97f695f..0000000000 --- a/src/test/run-pass/auxiliary/svh-a-no-change.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo(_: isize) -> isize { - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs b/src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs deleted file mode 100644 index e405c337ab..0000000000 --- a/src/test/run-pass/auxiliary/svh-a-redundant-cfg.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -// cfg attribute does not affect the svh, as long as it yields the same code. -#[cfg(not(an_unused_name))] -pub fn foo(_: isize) -> isize { - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/run-pass/auxiliary/svh-a-whitespace.rs b/src/test/run-pass/auxiliary/svh-a-whitespace.rs deleted file mode 100644 index 9ef788c984..0000000000 --- a/src/test/run-pass/auxiliary/svh-a-whitespace.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo(_: isize) -> isize { - - 3 - -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/run-pass/auxiliary/thread-local-extern-static.rs b/src/test/run-pass/auxiliary/thread-local-extern-static.rs index bce87ef5a2..e9457886be 100644 --- a/src/test/run-pass/auxiliary/thread-local-extern-static.rs +++ b/src/test/run-pass/auxiliary/thread-local-extern-static.rs @@ -9,7 +9,6 @@ // except according to those terms. #![feature(cfg_target_thread_local, const_fn, thread_local)] -#![feature(const_cell_new)] #![crate_type = "lib"] #[cfg(target_thread_local)] diff --git a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs index b241cb4928..302a7b96bc 100644 --- a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs +++ b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs @@ -10,9 +10,8 @@ // Test taken from #45641 (https://github.com/rust-lang/rust/issues/45641) -// ignore-tidy-linelength // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir static mut Y: u32 = 0; @@ -20,4 +19,4 @@ unsafe fn should_ok() { Y = 1; } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs b/src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs new file mode 100644 index 0000000000..043f1215ea --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z borrowck=mir -Z nll + +// This example comes from the NLL RFC. + +struct List { + value: T, + next: Option>>, +} + +fn to_refs(list: &mut List) -> Vec<&mut T> { + let mut list = list; + let mut result = vec![]; + loop { + result.push(&mut list.value); + if let Some(n) = list.next.as_mut() { + list = n; + } else { + return result; + } + } +} + +fn main() { +} diff --git a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs index a4dd7b9b12..de411d3096 100644 --- a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs +++ b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs @@ -9,7 +9,7 @@ // except according to those terms. // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir +//[mir]compile-flags: -Z borrowck=mir // Test file taken from issue 45129 (https://github.com/rust-lang/rust/issues/45129) diff --git a/src/test/run-pass/borrowck/two-phase-baseline.rs b/src/test/run-pass/borrowck/two-phase-baseline.rs new file mode 100644 index 0000000000..6623444926 --- /dev/null +++ b/src/test/run-pass/borrowck/two-phase-baseline.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll + +// This is the "goto example" for why we want two phase borrows. + +fn main() { + let mut v = vec![0, 1, 2]; + v.push(v.len()); + assert_eq!(v, [0, 1, 2, 3]); +} diff --git a/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs new file mode 100644 index 0000000000..35a5422040 --- /dev/null +++ b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows + +#![cfg_attr(nll, feature(nll))] + +fn main() { + let mut a = 0; + let mut b = 0; + let p = if maybe() { + &mut a + } else { + &mut b + }; + use_(p); +} + +fn maybe() -> bool { false } +fn use_(_: T) { } diff --git a/src/test/run-pass/box-of-array-of-drop-1.rs b/src/test/run-pass/box-of-array-of-drop-1.rs index 47b44863a7..db055e6886 100644 --- a/src/test/run-pass/box-of-array-of-drop-1.rs +++ b/src/test/run-pass/box-of-array-of-drop-1.rs @@ -13,8 +13,6 @@ // ignore-emscripten no threads support -#![feature(const_atomic_usize_new)] - use std::thread; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/test/run-pass/box-of-array-of-drop-2.rs b/src/test/run-pass/box-of-array-of-drop-2.rs index 54be4955ba..9dde53bb31 100644 --- a/src/test/run-pass/box-of-array-of-drop-2.rs +++ b/src/test/run-pass/box-of-array-of-drop-2.rs @@ -13,8 +13,6 @@ // ignore-emscripten no threads support -#![feature(const_atomic_usize_new)] - use std::thread; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/test/run-pass/cast-rfc0401-vtable-kinds.rs b/src/test/run-pass/cast-rfc0401-vtable-kinds.rs index 3a9f24ad4c..32a155c13e 100644 --- a/src/test/run-pass/cast-rfc0401-vtable-kinds.rs +++ b/src/test/run-pass/cast-rfc0401-vtable-kinds.rs @@ -11,6 +11,8 @@ // Check that you can cast between different pointers to trait objects // whose vtable have the same kind (both lengths, or both trait pointers). +#![feature(unsized_tuple_coercion)] + trait Foo { fn foo(&self, _: T) -> u32 { 42 } } @@ -39,6 +41,11 @@ fn foo_to_bar(u: *const FooS) -> *const BarS { u as *const BarS } +fn tuple_i32_to_u32(u: *const (i32, T)) -> *const (u32, T) { + u as *const (u32, T) +} + + fn main() { let x = 4u32; let y : &Foo = &x; @@ -51,4 +58,14 @@ fn main() { let bar_ref : *const BarS<[u32]> = foo_to_bar(u); let z : &BarS<[u32]> = unsafe{&*bar_ref}; assert_eq!(&z.0, &[0,1,2]); + + // this assumes that tuple reprs for (i32, _) and (u32, _) are + // the same. + let s = (0i32, [0, 1, 2]); + let u: &(i32, [u8]) = &s; + let u: *const (i32, [u8]) = u; + let u_u32 : *const (u32, [u8]) = tuple_i32_to_u32(u); + unsafe { + assert_eq!(&(*u_u32).1, &[0, 1, 2]); + } } diff --git a/src/test/run-pass/conservative_impl_trait.rs b/src/test/run-pass/conservative_impl_trait.rs new file mode 100644 index 0000000000..30090018e2 --- /dev/null +++ b/src/test/run-pass/conservative_impl_trait.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// #39665 + +#![feature(conservative_impl_trait)] + +fn batches(n: &u32) -> impl Iterator { + std::iter::once(n) +} + +fn main() {} diff --git a/src/test/run-pass/const-fn-feature-flags.rs b/src/test/run-pass/const-fn-feature-flags.rs index 1e27a3edac..a7736a2eb3 100644 --- a/src/test/run-pass/const-fn-feature-flags.rs +++ b/src/test/run-pass/const-fn-feature-flags.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test use of const fns in std using individual feature gates. - -#![feature(const_cell_new)] +// Test use of stabilized const fns in std formerly using individual feature gates. use std::cell::Cell; diff --git a/src/test/run-pass/const-size_of-align_of.rs b/src/test/run-pass/const-size_of-align_of.rs index d5547ea5ad..06fbe9bf4f 100644 --- a/src/test/run-pass/const-size_of-align_of.rs +++ b/src/test/run-pass/const-size_of-align_of.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(const_fn, const_size_of, const_align_of)] +#![feature(const_fn)] use std::mem; diff --git a/src/test/run-pass/deriving-with-repr-packed.rs b/src/test/run-pass/deriving-with-repr-packed.rs new file mode 100644 index 0000000000..f5130908c0 --- /dev/null +++ b/src/test/run-pass/deriving-with-repr-packed.rs @@ -0,0 +1,45 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// check that derive on a packed struct does not call field +// methods with a misaligned field. + +use std::mem; + +#[derive(Copy, Clone)] +struct Aligned(usize); + +#[inline(never)] +fn check_align(ptr: *const Aligned) { + assert_eq!(ptr as usize % mem::align_of::(), + 0); +} + +impl PartialEq for Aligned { + fn eq(&self, other: &Self) -> bool { + check_align(self); + check_align(other); + self.0 == other.0 + } +} + +#[repr(packed)] +#[derive(Copy, Clone, PartialEq)] +struct Packed(Aligned, Aligned); + +#[derive(PartialEq)] +#[repr(C)] +struct Dealigned(u8, T); + +fn main() { + let d1 = Dealigned(0, Packed(Aligned(1), Aligned(2))); + let ck = d1 == d1; + assert!(ck); +} diff --git a/src/test/run-pass/diverging-fn-tail-35849.rs b/src/test/run-pass/diverging-fn-tail-35849.rs index 6c05a02e71..dfd99bcc9f 100644 --- a/src/test/run-pass/diverging-fn-tail-35849.rs +++ b/src/test/run-pass/diverging-fn-tail-35849.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[allow(coerce_never)] fn assert_sizeof() -> ! { unsafe { ::std::mem::transmute::(panic!()) @@ -15,4 +16,3 @@ fn assert_sizeof() -> ! { } fn main() { } - diff --git a/src/test/run-pass/dynamic-drop.rs b/src/test/run-pass/dynamic-drop.rs index 3310d3a89b..09318e7256 100644 --- a/src/test/run-pass/dynamic-drop.rs +++ b/src/test/run-pass/dynamic-drop.rs @@ -10,7 +10,7 @@ // ignore-wasm32-bare compiled with panic=abort by default -#![feature(generators, generator_trait, untagged_unions)] +#![feature(generators, generator_trait, untagged_unions, slice_patterns, advanced_slice_patterns)] use std::cell::{Cell, RefCell}; use std::ops::Generator; @@ -195,6 +195,33 @@ fn vec_unreachable(a: &Allocator) { let _x = vec![a.alloc(), a.alloc(), a.alloc(), return]; } +fn slice_pattern_first(a: &Allocator) { + let[_x, ..] = [a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_middle(a: &Allocator) { + let[_, _x, _] = [a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_two(a: &Allocator) { + let[_x, _, _y, _] = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_last(a: &Allocator) { + let[.., _y] = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_one_of(a: &Allocator, i: usize) { + let array = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; + let _x = match i { + 0 => { let [a, ..] = array; a } + 1 => { let [_, a, ..] = array; a } + 2 => { let [_, _, a, _] = array; a } + 3 => { let [_, _, _, a] = array; a } + _ => panic!("unmatched"), + }; +} + fn run_test(mut f: F) where F: FnMut(&Allocator) { @@ -264,5 +291,14 @@ fn main() { run_test(|a| mixed_drop_and_nondrop(a)); + run_test(|a| slice_pattern_first(a)); + run_test(|a| slice_pattern_middle(a)); + run_test(|a| slice_pattern_two(a)); + run_test(|a| slice_pattern_last(a)); + run_test(|a| slice_pattern_one_of(a, 0)); + run_test(|a| slice_pattern_one_of(a, 1)); + run_test(|a| slice_pattern_one_of(a, 2)); + run_test(|a| slice_pattern_one_of(a, 3)); + run_test_nopanic(|a| union1(a)); } diff --git a/src/test/run-pass/enum-discrim-manual-sizing.rs b/src/test/run-pass/enum-discrim-manual-sizing.rs index 3bbc107e0b..8557c065dc 100644 --- a/src/test/run-pass/enum-discrim-manual-sizing.rs +++ b/src/test/run-pass/enum-discrim-manual-sizing.rs @@ -108,6 +108,9 @@ pub fn main() { let array_expected_size = round_up(28, align_of::>()); assert_eq!(size_of::>(), array_expected_size); assert_eq!(size_of::>(), 32); + + assert_eq!(align_of::(), align_of::()); + assert_eq!(align_of::>(), align_of::()); } // Rounds x up to the next multiple of a diff --git a/src/test/run-pass/enum-non-c-like-repr-c-and-int.rs b/src/test/run-pass/enum-non-c-like-repr-c-and-int.rs new file mode 100644 index 0000000000..86453fdf6f --- /dev/null +++ b/src/test/run-pass/enum-non-c-like-repr-c-and-int.rs @@ -0,0 +1,177 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This test deserializes an enum in-place by transmuting to a union that +// should have the same layout, and manipulating the tag and payloads +// independently. This verifies that `repr(some_int)` has a stable representation, +// and that we don't miscompile these kinds of manipulations. + +use std::time::Duration; +use std::mem; + +#[repr(C, u8)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +enum MyEnum { + A(u32), // Single primitive value + B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct +} + +#[repr(C)] +struct MyEnumRepr { + tag: MyEnumTag, + payload: MyEnumPayload, +} + +#[repr(C)] +#[allow(non_snake_case)] +union MyEnumPayload { + A: MyEnumVariantA, + B: MyEnumVariantB, + D: MyEnumVariantD, + E: MyEnumVariantE, +} + +#[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); + +fn main() { + let result: Vec> = vec![ + Ok(MyEnum::A(17)), + Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::C), + Err(()), + Ok(MyEnum::D(Some(407))), + Ok(MyEnum::D(None)), + Ok(MyEnum::E(Duration::from_secs(100))), + Err(()), + ]; + + // Binary serialized version of the above (little-endian) + let input: Vec = vec![ + 0, 17, 0, 0, 0, + 1, 206, 121, 4, + 2, + 8, /* invalid tag value */ + 3, 0, 151, 1, 0, 0, + 3, 1, + 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, /* incomplete value */ + ]; + + let mut output = vec![]; + let mut buf = &input[..]; + + unsafe { + // This should be safe, because we don't match on it unless it's fully formed, + // and it doesn't have a destructor. + let mut dest: MyEnum = mem::uninitialized(); + while buf.len() > 0 { + match parse_my_enum(&mut dest, &mut buf) { + Ok(()) => output.push(Ok(dest)), + Err(()) => output.push(Err(())), + } + } + } + + assert_eq!(output, result); +} + +fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { + unsafe { + // Should be correct to do this transmute. + let dest: &'a mut MyEnumRepr = mem::transmute(dest); + let tag = read_u8(buf)?; + + dest.tag = match tag { + 0 => MyEnumTag::A, + 1 => MyEnumTag::B, + 2 => MyEnumTag::C, + 3 => MyEnumTag::D, + 4 => MyEnumTag::E, + _ => return Err(()), + }; + + match dest.tag { + MyEnumTag::A => { + dest.payload.A.0 = read_u32_le(buf)?; + } + MyEnumTag::B => { + dest.payload.B.x = read_u8(buf)?; + dest.payload.B.y = read_u16_le(buf)? as i16; + } + MyEnumTag::C => { + /* do nothing */ + } + MyEnumTag::D => { + let is_some = read_u8(buf)? == 0; + if is_some { + dest.payload.D.0 = Some(read_u32_le(buf)?); + } else { + dest.payload.D.0 = None; + } + } + MyEnumTag::E => { + let secs = read_u64_le(buf)?; + let nanos = read_u32_le(buf)?; + dest.payload.E.0 = Duration::new(secs, nanos); + } + } + Ok(()) + } +} + + + +// reader helpers + +fn read_u64_le(buf: &mut &[u8]) -> Result { + if buf.len() < 8 { return Err(()) } + let val = (buf[0] as u64) << 0 + | (buf[1] as u64) << 8 + | (buf[2] as u64) << 16 + | (buf[3] as u64) << 24 + | (buf[4] as u64) << 32 + | (buf[5] as u64) << 40 + | (buf[6] as u64) << 48 + | (buf[7] as u64) << 56; + *buf = &buf[8..]; + Ok(val) +} + +fn read_u32_le(buf: &mut &[u8]) -> Result { + if buf.len() < 4 { return Err(()) } + let val = (buf[0] as u32) << 0 + | (buf[1] as u32) << 8 + | (buf[2] as u32) << 16 + | (buf[3] as u32) << 24; + *buf = &buf[4..]; + Ok(val) +} + +fn read_u16_le(buf: &mut &[u8]) -> Result { + if buf.len() < 2 { return Err(()) } + let val = (buf[0] as u16) << 0 + | (buf[1] as u16) << 8; + *buf = &buf[2..]; + Ok(val) +} + +fn read_u8(buf: &mut &[u8]) -> Result { + if buf.len() < 1 { return Err(()) } + let val = buf[0]; + *buf = &buf[1..]; + Ok(val) +} diff --git a/src/test/run-pass/enum-non-c-like-repr-c.rs b/src/test/run-pass/enum-non-c-like-repr-c.rs new file mode 100644 index 0000000000..b4e0fe8d45 --- /dev/null +++ b/src/test/run-pass/enum-non-c-like-repr-c.rs @@ -0,0 +1,177 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This test deserializes an enum in-place by transmuting to a union that +// should have the same layout, and manipulating the tag and payloads +// independently. This verifies that `repr(some_int)` has a stable representation, +// and that we don't miscompile these kinds of manipulations. + +use std::time::Duration; +use std::mem; + +#[repr(C)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +enum MyEnum { + A(u32), // Single primitive value + B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct +} + +#[repr(C)] +struct MyEnumRepr { + tag: MyEnumTag, + payload: MyEnumPayload, +} + +#[repr(C)] +#[allow(non_snake_case)] +union MyEnumPayload { + A: MyEnumVariantA, + B: MyEnumVariantB, + D: MyEnumVariantD, + E: MyEnumVariantE, +} + +#[repr(C)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); + +fn main() { + let result: Vec> = vec![ + Ok(MyEnum::A(17)), + Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::C), + Err(()), + Ok(MyEnum::D(Some(407))), + Ok(MyEnum::D(None)), + Ok(MyEnum::E(Duration::from_secs(100))), + Err(()), + ]; + + // Binary serialized version of the above (little-endian) + let input: Vec = vec![ + 0, 17, 0, 0, 0, + 1, 206, 121, 4, + 2, + 8, /* invalid tag value */ + 3, 0, 151, 1, 0, 0, + 3, 1, + 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, /* incomplete value */ + ]; + + let mut output = vec![]; + let mut buf = &input[..]; + + unsafe { + // This should be safe, because we don't match on it unless it's fully formed, + // and it doesn't have a destructor. + let mut dest: MyEnum = mem::uninitialized(); + while buf.len() > 0 { + match parse_my_enum(&mut dest, &mut buf) { + Ok(()) => output.push(Ok(dest)), + Err(()) => output.push(Err(())), + } + } + } + + assert_eq!(output, result); +} + +fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { + unsafe { + // Should be correct to do this transmute. + let dest: &'a mut MyEnumRepr = mem::transmute(dest); + let tag = read_u8(buf)?; + + dest.tag = match tag { + 0 => MyEnumTag::A, + 1 => MyEnumTag::B, + 2 => MyEnumTag::C, + 3 => MyEnumTag::D, + 4 => MyEnumTag::E, + _ => return Err(()), + }; + + match dest.tag { + MyEnumTag::A => { + dest.payload.A.0 = read_u32_le(buf)?; + } + MyEnumTag::B => { + dest.payload.B.x = read_u8(buf)?; + dest.payload.B.y = read_u16_le(buf)? as i16; + } + MyEnumTag::C => { + /* do nothing */ + } + MyEnumTag::D => { + let is_some = read_u8(buf)? == 0; + if is_some { + dest.payload.D.0 = Some(read_u32_le(buf)?); + } else { + dest.payload.D.0 = None; + } + } + MyEnumTag::E => { + let secs = read_u64_le(buf)?; + let nanos = read_u32_le(buf)?; + dest.payload.E.0 = Duration::new(secs, nanos); + } + } + Ok(()) + } +} + + + +// reader helpers + +fn read_u64_le(buf: &mut &[u8]) -> Result { + if buf.len() < 8 { return Err(()) } + let val = (buf[0] as u64) << 0 + | (buf[1] as u64) << 8 + | (buf[2] as u64) << 16 + | (buf[3] as u64) << 24 + | (buf[4] as u64) << 32 + | (buf[5] as u64) << 40 + | (buf[6] as u64) << 48 + | (buf[7] as u64) << 56; + *buf = &buf[8..]; + Ok(val) +} + +fn read_u32_le(buf: &mut &[u8]) -> Result { + if buf.len() < 4 { return Err(()) } + let val = (buf[0] as u32) << 0 + | (buf[1] as u32) << 8 + | (buf[2] as u32) << 16 + | (buf[3] as u32) << 24; + *buf = &buf[4..]; + Ok(val) +} + +fn read_u16_le(buf: &mut &[u8]) -> Result { + if buf.len() < 2 { return Err(()) } + let val = (buf[0] as u16) << 0 + | (buf[1] as u16) << 8; + *buf = &buf[2..]; + Ok(val) +} + +fn read_u8(buf: &mut &[u8]) -> Result { + if buf.len() < 1 { return Err(()) } + let val = buf[0]; + *buf = &buf[1..]; + Ok(val) +} diff --git a/src/test/run-pass/enum-univariant-repr.rs b/src/test/run-pass/enum-univariant-repr.rs index ef4cc60bf0..17d614b549 100644 --- a/src/test/run-pass/enum-univariant-repr.rs +++ b/src/test/run-pass/enum-univariant-repr.rs @@ -22,6 +22,11 @@ enum UnivariantWithoutDescr { Y } +#[repr(u8)] +enum UnivariantWithData { + Z(u8), +} + pub fn main() { { assert_eq!(4, mem::size_of::()); @@ -44,4 +49,12 @@ pub fn main() { // check it has the same memory layout as u16 assert_eq!(&[descr, descr, descr], ints); } + + { + assert_eq!(2, mem::size_of::()); + + match UnivariantWithData::Z(4) { + UnivariantWithData::Z(x) => assert_eq!(x, 4), + } + } } diff --git a/src/test/run-pass/for-loop-mut-ref-element.rs b/src/test/run-pass/for-loop-mut-ref-element.rs index 14ce23b072..556c846b0b 100644 --- a/src/test/run-pass/for-loop-mut-ref-element.rs +++ b/src/test/run-pass/for-loop-mut-ref-element.rs @@ -12,4 +12,4 @@ fn main() { for ref mut _a in std::iter::once(true) {} -} \ No newline at end of file +} diff --git a/src/test/run-pass/generator/borrow-in-tail-expr.rs b/src/test/run-pass/generator/borrow-in-tail-expr.rs index df1a1dcebe..486fe3c900 100644 --- a/src/test/run-pass/generator/borrow-in-tail-expr.rs +++ b/src/test/run-pass/generator/borrow-in-tail-expr.rs @@ -16,4 +16,4 @@ fn main() { let a = String::new(); a.len() }; -} \ No newline at end of file +} diff --git a/src/test/run-pass/generator/match-bindings.rs b/src/test/run-pass/generator/match-bindings.rs index 9c6b0571e5..231aa1b42f 100644 --- a/src/test/run-pass/generator/match-bindings.rs +++ b/src/test/run-pass/generator/match-bindings.rs @@ -27,4 +27,4 @@ fn main() { yield; } }; -} \ No newline at end of file +} diff --git a/src/test/run-pass/generator/yield-subtype.rs b/src/test/run-pass/generator/yield-subtype.rs index 5ff070f311..5ea4b1fe93 100644 --- a/src/test/run-pass/generator/yield-subtype.rs +++ b/src/test/run-pass/generator/yield-subtype.rs @@ -20,4 +20,4 @@ fn bar<'a>() { }; } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/run-pass/hygiene/auxiliary/xcrate.rs b/src/test/run-pass/hygiene/auxiliary/xcrate.rs new file mode 100644 index 0000000000..2ccd043097 --- /dev/null +++ b/src/test/run-pass/hygiene/auxiliary/xcrate.rs @@ -0,0 +1,38 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(decl_macro)] +#![allow(unused)] + +pub use bar::test; + +extern crate std as foo; + +pub fn f() {} +use f as f2; + +mod bar { + pub fn g() {} + use baz::h; + + pub macro test() { + use std::mem; + use foo::cell; + ::f(); + ::f2(); + g(); + h(); + ::bar::h(); + } +} + +mod baz { + pub fn h() {} +} diff --git a/src/tools/miri/tests/run-pass/issue-27901.rs b/src/test/run-pass/hygiene/issue-44128.rs similarity index 64% rename from src/tools/miri/tests/run-pass/issue-27901.rs rename to src/test/run-pass/hygiene/issue-44128.rs index b7a9daaf8a..213ee1edff 100644 --- a/src/tools/miri/tests/run-pass/issue-27901.rs +++ b/src/test/run-pass/hygiene/issue-44128.rs @@ -8,13 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Stream { type Item; } -impl<'a> Stream for &'a str { type Item = u8; } -fn f<'s>(s: &'s str) -> (&'s str, <&'s str as Stream>::Item) { - (s, 42) +#![feature(decl_macro)] + +pub macro create_struct($a:ident) { + struct $a; + impl Clone for $a { + fn clone(&self) -> Self { + $a + } + } } fn main() { - let fx = f as for<'t> fn(&'t str) -> (&'t str, <&'t str as Stream>::Item); - assert_eq!(fx("hi"), ("hi", 42)); + create_struct!(Test); + Test.clone(); } diff --git a/src/test/run-pass/hygiene/xcrate.rs b/src/test/run-pass/hygiene/xcrate.rs new file mode 100644 index 0000000000..6df3a34d3c --- /dev/null +++ b/src/test/run-pass/hygiene/xcrate.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-pretty pretty-printing is unhygienic + +// aux-build:xcrate.rs + +#![feature(decl_macro)] + +extern crate xcrate; + +fn main() { + xcrate::test!(); +} diff --git a/src/test/run-pass/i128.rs b/src/test/run-pass/i128.rs index 5369b138b0..c3e43c9259 100644 --- a/src/test/run-pass/i128.rs +++ b/src/test/run-pass/i128.rs @@ -10,6 +10,8 @@ // ignore-emscripten i128 doesn't work +// compile-flags: -Z borrowck=compare + #![feature(i128_type, test)] extern crate test; diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 08e9990511..d09376acc8 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -158,8 +158,8 @@ pub fn main() { // Float edge cases t!(format!("{}", -0.0), "0"); - t!(format!("{:?}", -0.0), "-0"); - t!(format!("{:?}", 0.0), "0"); + t!(format!("{:?}", -0.0), "-0.0"); + t!(format!("{:?}", 0.0), "0.0"); // sign aware zero padding t!(format!("{:<3}", 1), "1 "); diff --git a/src/test/run-pass/impl-trait/example-calendar.rs b/src/test/run-pass/impl-trait/example-calendar.rs index 0b612c2d3f..8d035bafab 100644 --- a/src/test/run-pass/impl-trait/example-calendar.rs +++ b/src/test/run-pass/impl-trait/example-calendar.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: normal nll +//[nll] compile-flags: -Znll -Zborrowck=mir + #![feature(conservative_impl_trait, universal_impl_trait, fn_traits, diff --git a/src/test/run-pass/impl-trait/issue-42479.rs b/src/test/run-pass/impl-trait/issue-42479.rs new file mode 100644 index 0000000000..629948a5dc --- /dev/null +++ b/src/test/run-pass/impl-trait/issue-42479.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait)] + +use std::iter::once; + +struct Foo { + x: i32, +} + +impl Foo { + fn inside(&self) -> impl Iterator { + once(&self.x) + } +} + +fn main() { + println!("hi"); +} diff --git a/src/test/run-pass/impl-trait/lifetimes.rs b/src/test/run-pass/impl-trait/lifetimes.rs new file mode 100644 index 0000000000..1f2d76f289 --- /dev/null +++ b/src/test/run-pass/impl-trait/lifetimes.rs @@ -0,0 +1,120 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait, underscore_lifetimes, universal_impl_trait, nested_impl_trait)] +#![allow(warnings)] + +use std::fmt::Debug; + +fn any_lifetime<'a>() -> &'a u32 { &5 } + +fn static_lifetime() -> &'static u32 { &5 } + +fn any_lifetime_as_static_impl_trait() -> impl Debug { + any_lifetime() +} + +fn lifetimes_as_static_impl_trait() -> impl Debug { + static_lifetime() +} + +fn no_params_or_lifetimes_is_static() -> impl Debug + 'static { + lifetimes_as_static_impl_trait() +} + +fn static_input_type_is_static(x: T) -> impl Debug + 'static { x } + +fn type_outlives_reference_lifetime<'a, T: Debug>(x: &'a T) -> impl Debug + 'a { x } +fn type_outlives_reference_lifetime_elided(x: &T) -> impl Debug + '_ { x } + +trait SingleRegionTrait<'a> {} +impl<'a> SingleRegionTrait<'a> for u32 {} +impl<'a> SingleRegionTrait<'a> for &'a u32 {} +struct SingleRegionStruct<'a>(&'a u32); + +fn simple_type_hrtb<'b>() -> impl for<'a> SingleRegionTrait<'a> { 5 } +// FIXME(cramertj) add test after #45992 lands to ensure lint is triggered +fn elision_single_region_trait(x: &u32) -> impl SingleRegionTrait { x } +fn elision_single_region_struct(x: SingleRegionStruct) -> impl Into { x } + +fn closure_hrtb() -> impl for<'a> Fn(&'a u32) { |_| () } +fn closure_hr_elided() -> impl Fn(&u32) { |_| () } +fn closure_hr_elided_return() -> impl Fn(&u32) -> &u32 { |x| x } +fn closure_pass_through_elided_return(x: impl Fn(&u32) -> &u32) -> impl Fn(&u32) -> &u32 { x } +fn closure_pass_through_reference_elided(x: &impl Fn(&u32) -> &u32) -> &impl Fn(&u32) -> &u32 { x } + +fn pass_through_elision(x: &u32) -> impl Into<&u32> { x } +fn pass_through_elision_with_fn_ptr(x: &fn(&u32) -> &u32) -> impl Into<&fn(&u32) -> &u32> { x } + +fn pass_through_elision_with_fn_path &u32>( + x: &T +) -> impl Into<&impl Fn(&u32) -> &u32> { x } + +fn foo(x: &impl Debug) -> impl Into<&impl Debug> { x } +fn foo_explicit_lifetime<'a>(x: &'a impl Debug) -> impl Into<&'a impl Debug> { x } +fn foo_no_outer_impl(x: &impl Debug) -> &impl Debug { x } +fn foo_explicit_arg(x: &T) -> impl Into<&impl Debug> { x } + +fn mixed_lifetimes<'a>() -> impl for<'b: 'a> Fn(&'b u32) { |_| () } +fn mixed_as_static() -> impl Fn(&'static u32) { mixed_lifetimes() } + +trait MultiRegionTrait<'a, 'b>: Debug {} + +#[derive(Debug)] +struct MultiRegionStruct<'a, 'b>(&'a u32, &'b u32); +impl<'a, 'b> MultiRegionTrait<'a, 'b> for MultiRegionStruct<'a, 'b> {} + +#[derive(Debug)] +struct NoRegionStruct; +impl<'a, 'b> MultiRegionTrait<'a, 'b> for NoRegionStruct {} + +fn finds_least_region<'a: 'b, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> { + MultiRegionStruct(x, y) +} + +fn finds_explicit_bound<'a: 'b, 'b> + (x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> + 'b +{ + MultiRegionStruct(x, y) +} + +fn finds_explicit_bound_even_without_least_region<'a, 'b> + (x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> + 'b +{ + NoRegionStruct +} + +/* FIXME: `impl Trait<'a> + 'b` should live as long as 'b, even if 'b outlives 'a +fn outlives_bounds_even_with_contained_regions<'a, 'b> + (x: &'a u32, y: &'b u32) -> impl Debug + 'b +{ + finds_explicit_bound_even_without_least_region(x, y) +} +*/ + +fn unnamed_lifetimes_arent_contained_in_impl_trait_and_will_unify<'a, 'b> + (x: &'a u32, y: &'b u32) -> impl Debug +{ + fn deref<'lt>(x: &'lt u32) -> impl Debug { *x } + + if true { deref(x) } else { deref(y) } +} + +fn can_add_region_bound_to_static_type<'a, 'b>(_: &'a u32) -> impl Debug + 'a { 5 } + +struct MyVec(Vec>); + +impl<'unnecessary_lifetime> MyVec { + fn iter_doesnt_capture_unnecessary_lifetime<'s>(&'s self) -> impl Iterator { + self.0.iter().flat_map(|inner_vec| inner_vec.iter()) + } +} + +fn main() {} diff --git a/src/test/run-pass/in-band-lifetimes.rs b/src/test/run-pass/in-band-lifetimes.rs new file mode 100644 index 0000000000..95cc3c3759 --- /dev/null +++ b/src/test/run-pass/in-band-lifetimes.rs @@ -0,0 +1,104 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes, universal_impl_trait, conservative_impl_trait)] + +fn foo(x: &'x u8) -> &'x u8 { x } +fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x } + +fn check_in_band_can_be_late_bound() { + let _: for<'x> fn(&'x u8, &u8) -> &'x u8 = foo2; +} + +struct ForInherentNoParams; + +impl ForInherentNoParams { + fn foo(x: &'a u32, y: &u32) -> &'a u32 { x } +} + +struct X<'a>(&'a u8); + +impl<'a> X<'a> { + fn inner(&self) -> &'a u8 { + self.0 + } + + fn same_lifetime_as_parameter(&mut self, x: &'a u8) { + self.0 = x; + } +} + +impl X<'b> { + fn inner_2(&self) -> &'b u8 { + self.0 + } + + fn reference_already_introduced_in_band_from_method_with_explicit_binders<'a>( + &'b self, x: &'a u32 + ) {} +} + +struct Y(T); + +impl Y<&'a u8> { + fn inner(&self) -> &'a u8 { + self.0 + } +} + +trait MyTrait<'a> { + fn my_lifetime(&self) -> &'a u8; + fn any_lifetime() -> &'b u8; + fn borrowed_lifetime(&'b self) -> &'b u8; + fn default_impl(&self, x: &'b u32, y: &u32) -> &'b u32 { x } + fn in_band_def_explicit_impl(&self, x: &'b u8); +} + +impl MyTrait<'a> for Y<&'a u8> { + fn my_lifetime(&self) -> &'a u8 { self.0 } + fn any_lifetime() -> &'b u8 { &0 } + fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } + fn in_band_def_explicit_impl<'b>(&self, x: &'b u8) {} +} + +fn test_hrtb_defined_lifetime_where(_: F) where for<'a> F: Fn(&'a u8) {} +fn test_hrtb_defined_lifetime_polytraitref(_: F) where F: for<'a> Fn(&'a u8) {} + +fn reference_in_band_from_locals(x: &'test u32) -> &'test u32 { + let y: &'test u32 = x; + y +} + +fn in_generics_in_band>(x: &T) {} +fn where_clause_in_band(x: &T) where T: MyTrait<'a> {} +fn impl_trait_in_band(x: &impl MyTrait<'a>) {} + +// Tests around using in-band lifetimes within existential traits. + +trait FunkyTrait<'a> { } +impl<'a, T> FunkyTrait<'a> for T { } +fn existential_impl_trait_in_band_outlives(x: &'a u32) -> impl ::std::fmt::Debug + 'a { + x +} +fn existential_impl_trait_in_band_param(x: &'a u32) -> impl FunkyTrait<'a> { + x +} +fn existential_impl_trait_in_band_param_static(x: &'a u32) -> impl FunkyTrait<'static> + 'a { + x +} +fn existential_impl_trait_in_band_param_outlives(x: &'a u32) -> impl FunkyTrait<'a> + 'a { + x +} +fn existential_impl_trait_in_band_higher_ranked(x: &'a u32) -> impl for<'b> FunkyTrait<'b> + 'a { + x +} + +fn main() {} diff --git a/src/test/run-pass/issue-16671.rs b/src/test/run-pass/issue-16671.rs index 49dc970ba3..9f34ad6726 100644 --- a/src/test/run-pass/issue-16671.rs +++ b/src/test/run-pass/issue-16671.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//compile-flags: -Z borrowck=compare -Z emit-end-regions + #![deny(warnings)] fn foo(_f: F) { } diff --git a/src/test/run-pass/issue-17718-static-unsafe-interior.rs b/src/test/run-pass/issue-17718-static-unsafe-interior.rs index 66f70cdaeb..5f7629fa26 100644 --- a/src/test/run-pass/issue-17718-static-unsafe-interior.rs +++ b/src/test/run-pass/issue-17718-static-unsafe-interior.rs @@ -10,9 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] -#![feature(const_unsafe_cell_new)] - use std::marker; use std::cell::UnsafeCell; diff --git a/src/test/run-pass/issue-17718.rs b/src/test/run-pass/issue-17718.rs index 1b8fbc1ad2..502e4a8166 100644 --- a/src/test/run-pass/issue-17718.rs +++ b/src/test/run-pass/issue-17718.rs @@ -10,10 +10,6 @@ // aux-build:issue-17718-aux.rs - -#![feature(core)] -#![feature(const_atomic_usize_new)] - extern crate issue_17718_aux as other; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/test/run-pass/issue-21486.rs b/src/test/run-pass/issue-21486.rs index 23d06c4324..a61f294465 100644 --- a/src/test/run-pass/issue-21486.rs +++ b/src/test/run-pass/issue-21486.rs @@ -12,8 +12,6 @@ // created via FRU and control-flow breaks in the middle of // construction. -#![feature(const_atomic_usize_new)] - use std::sync::atomic::{Ordering, AtomicUsize}; #[derive(Debug)] diff --git a/src/test/run-pass/issue-22066.rs b/src/test/run-pass/issue-22066.rs index 2817ef7710..c2486f0dcb 100644 --- a/src/test/run-pass/issue-22066.rs +++ b/src/test/run-pass/issue-22066.rs @@ -18,4 +18,4 @@ pub trait LineFormatter<'a> { } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/run-pass/issue-26322.rs b/src/test/run-pass/issue-26322.rs index 766d1ce25d..7f8c7f5521 100644 --- a/src/test/run-pass/issue-26322.rs +++ b/src/test/run-pass/issue-26322.rs @@ -28,9 +28,9 @@ fn main() { columnline!() } else { (0, 0) }; let cl = columnline!(); - assert_eq!(closure(), (8, 25)); - assert_eq!(iflet, (8, 28)); - assert_eq!(cl, (13, 30)); + assert_eq!(closure(), (9, 25)); + assert_eq!(iflet, (9, 28)); + assert_eq!(cl, (14, 30)); let indirect = indirectcolumnline!(); - assert_eq!(indirect, (19, 34)); + assert_eq!(indirect, (20, 34)); } diff --git a/src/test/run-pass/issue-26655.rs b/src/test/run-pass/issue-26655.rs index 3e252b8629..6d43451af6 100644 --- a/src/test/run-pass/issue-26655.rs +++ b/src/test/run-pass/issue-26655.rs @@ -12,8 +12,6 @@ // Check that the destructors of simple enums are run on unwinding -#![feature(const_atomic_usize_new)] - use std::sync::atomic::{Ordering, AtomicUsize}; use std::thread; diff --git a/src/test/run-pass/issue-27060.rs b/src/test/run-pass/issue-27060.rs new file mode 100644 index 0000000000..809c45466f --- /dev/null +++ b/src/test/run-pass/issue-27060.rs @@ -0,0 +1,42 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(packed)] +pub struct Good { + data: &'static u32, + data2: [&'static u32; 2], + aligned: [u8; 32], +} + +#[repr(packed)] +pub struct JustArray { + array: [u32] +} + +// kill this test when that turns to a hard error +#[allow(safe_packed_borrows)] +fn main() { + let good = Good { + data: &0, + data2: [&0, &0], + aligned: [0; 32] + }; + + unsafe { + let _ = &good.data; // ok + let _ = &good.data2[0]; // ok + } + + let _ = &good.data; + let _ = &good.data2[0]; + let _ = &*good.data; // ok, behind a pointer + let _ = &good.aligned; // ok, has align 1 + let _ = &good.aligned[2]; // ok, has align 1 +} diff --git a/src/test/run-pass/issue-27997.rs b/src/test/run-pass/issue-27997.rs index dab42e48e1..9dba477a7e 100644 --- a/src/test/run-pass/issue-27997.rs +++ b/src/test/run-pass/issue-27997.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(const_atomic_usize_new)] - use std::sync::atomic::{Ordering, AtomicUsize}; use std::mem; diff --git a/src/test/run-pass/issue-32292.rs b/src/test/run-pass/issue-32292.rs index 3995caa32b..ed319b1391 100644 --- a/src/test/run-pass/issue-32292.rs +++ b/src/test/run-pass/issue-32292.rs @@ -15,4 +15,4 @@ struct Foo; fn main() { let _ = Foo; -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-33992.rs b/src/test/run-pass/issue-33992.rs index 5729469f69..98da7d46b1 100644 --- a/src/test/run-pass/issue-33992.rs +++ b/src/test/run-pass/issue-33992.rs @@ -37,4 +37,4 @@ pub static TEST7: bool = true; #[linkage = "weak_odr"] pub static TEST8: bool = true; -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/run-pass/issue-35376.rs b/src/test/run-pass/issue-35376.rs index 25895cd075..9e4eb84edc 100644 --- a/src/test/run-pass/issue-35376.rs +++ b/src/test/run-pass/issue-35376.rs @@ -48,4 +48,4 @@ pub struct Handle; impl Beta for Handle { type Event = (); -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-43355.rs b/src/test/run-pass/issue-43355.rs new file mode 100644 index 0000000000..19431a6a42 --- /dev/null +++ b/src/test/run-pass/issue-43355.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that the code for issue #43355 can run without an ICE, please remove +// this test when it becomes an hard error. + +pub trait Trait1 { + type Output; +} +pub trait Trait2 {} + +impl Trait1 for T where T: Trait2 { + type Output = (); +} +impl Trait1> for A { + type Output = i32; +} + +pub struct A; + +fn f>>() { + println!("k: {}", ::std::mem::size_of::<>>::Output>()); +} + +pub fn g>>() { + f::(); +} + +fn main() {} diff --git a/src/test/ui/union-sized-field.rs b/src/test/run-pass/issue-43483.rs similarity index 75% rename from src/test/ui/union-sized-field.rs rename to src/test/run-pass/issue-43483.rs index eeca5ab740..48482af76d 100644 --- a/src/test/ui/union-sized-field.rs +++ b/src/test/run-pass/issue-43483.rs @@ -8,19 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(untagged_unions)] - -union Foo { - value: T, +trait VecN { + const DIM: usize; } -struct Foo2 { - value: T, - t: u32, +trait Mat { + type Row: VecN; } -enum Foo3 { - Value(T), +fn m() { + let x = M::Row::DIM; } fn main() {} diff --git a/src/test/run-pass/issue-44373.rs b/src/test/run-pass/issue-44373.rs index 06627e2ad9..d0f8ed96f4 100644 --- a/src/test/run-pass/issue-44373.rs +++ b/src/test/run-pass/issue-44373.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// compile-flags: -Z borrowck=compare + struct Foo(bool); struct Container(&'static [&'static Foo]); diff --git a/src/test/run-pass/issue-45152.rs b/src/test/run-pass/issue-45152.rs new file mode 100644 index 0000000000..a5c349adb8 --- /dev/null +++ b/src/test/run-pass/issue-45152.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unsize, coerce_unsized)] + +#[repr(packed)] +struct UnalignedPtr<'a, T: ?Sized> + where T: 'a, +{ + data: &'a T, +} + +fn main() { + + impl<'a, T, U> std::ops::CoerceUnsized> for UnalignedPtr<'a, T> + where + T: std::marker::Unsize + ?Sized, + U: ?Sized, + { } + + let arr = [1, 2, 3]; + let arr_unaligned: UnalignedPtr<[i32; 3]> = UnalignedPtr { data: &arr }; + let arr_unaligned: UnalignedPtr<[i32]> = arr_unaligned; +} diff --git a/src/test/run-pass/issue-46069.rs b/src/test/run-pass/issue-46069.rs new file mode 100644 index 0000000000..70db20e4a6 --- /dev/null +++ b/src/test/run-pass/issue-46069.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::iter::{Fuse, Cloned}; +use std::slice::Iter; + +struct Foo<'a, T: 'a>(&'a T); +impl<'a, T: 'a> Copy for Foo<'a, T> {} +impl<'a, T: 'a> Clone for Foo<'a, T> { + fn clone(&self) -> Self { *self } +} + +fn copy_ex() { + let s = 2; + let k1 = || s; + let upvar = Foo(&k1); + let k = || upvar; + k(); +} + +fn main() { + let _f = 0 as *mut >> as Iterator>::Item; + + copy_ex(); +} diff --git a/src/test/run-pass/issue-46553.rs b/src/test/run-pass/issue-46553.rs new file mode 100644 index 0000000000..cf00ae4c46 --- /dev/null +++ b/src/test/run-pass/issue-46553.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_fn)] +#![deny(const_err)] + +pub struct Data { + function: fn() -> T, +} + +impl Data { + pub const fn new(function: fn() -> T) -> Data { + Data { + function: function, + } + } +} + +pub static DATA: Data = Data::new(|| { + 413i32 +}); + +fn main() { + print!("{:?}", (DATA.function)()); +} diff --git a/src/test/run-pass/issue-46845.rs b/src/test/run-pass/issue-46845.rs new file mode 100644 index 0000000000..235d3982a9 --- /dev/null +++ b/src/test/run-pass/issue-46845.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// To work around #46855 +// compile-flags: -Z mir-opt-level=0 +// Regression test for the inhabitedness of unions with uninhabited variants, issue #46845 + +use std::mem; + +#[derive(Copy, Clone)] +enum Never { } + +// A single uninhabited variant shouldn't make the whole union uninhabited. +union Foo { + a: u64, + _b: Never +} + +// If all the variants are uninhabited, however, the union should be uninhabited. +union Bar { + _a: (Never, u64), + _b: (u64, Never) +} + +fn main() { + assert_eq!(mem::size_of::(), 8); + assert_eq!(mem::size_of::(), 0); + + let f = [Foo { a: 42 }, Foo { a: 10 }]; + println!("{}", unsafe { f[0].a }); + assert_eq!(unsafe { f[1].a }, 10); +} diff --git a/src/test/run-pass/issue-46855.rs b/src/test/run-pass/issue-46855.rs new file mode 100644 index 0000000000..d864d55c93 --- /dev/null +++ b/src/test/run-pass/issue-46855.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Zmir-opt-level=1 + +#![feature(slice_patterns)] + +use std::mem; + +#[derive(Copy, Clone)] +enum Never {} + +union Foo { + a: u64, + b: Never +} + +fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 } + +fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x } + +fn main() { + println!("{}", mem::size_of::()); + + let f = [Foo { a: 42 }, Foo { a: 10 }]; + println!("{:?}", unsafe { f[0].a }); +} diff --git a/src/test/run-pass/issue-46920-byte-array-patterns.rs b/src/test/run-pass/issue-46920-byte-array-patterns.rs new file mode 100644 index 0000000000..236f6995c5 --- /dev/null +++ b/src/test/run-pass/issue-46920-byte-array-patterns.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +const CURSOR_PARTITION_LABEL: &'static [u8] = b"partition"; +const CURSOR_EVENT_TYPE_LABEL: &'static [u8] = b"event_type"; +const BYTE_PATTERN: &'static [u8; 5] = b"hello"; + +fn match_slice(x: &[u8]) -> u32 { + match x { + CURSOR_PARTITION_LABEL => 0, + CURSOR_EVENT_TYPE_LABEL => 1, + _ => 2, + } +} + +fn match_array(x: &[u8; 5]) -> bool { + match x { + BYTE_PATTERN => true, + _ => false + } +} + +fn main() { + assert_eq!(match_slice(b"abcde"), 2); + assert_eq!(match_slice(b"event_type"), 1); + assert_eq!(match_slice(b"partition"), 0); + + assert_eq!(match_array(b"hello"), true); + assert_eq!(match_array(b"hella"), false); +} diff --git a/src/test/run-pass/issue-47139-1.rs b/src/test/run-pass/issue-47139-1.rs new file mode 100644 index 0000000000..cb87991a49 --- /dev/null +++ b/src/test/run-pass/issue-47139-1.rs @@ -0,0 +1,87 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #47139: +// +// Coherence was encountering an (unnecessary) overflow trying to +// decide if the two impls of dummy overlap. +// +// The overflow went something like: +// +// - `&'a ?T: Insertable` ? +// - let ?T = Option ? +// - `Option: Insertable` ? +// - `Option<&'a ?U>: Insertable` ? +// - `&'a ?U: Insertable` ? +// +// While somewhere in the middle, a projection would occur, which +// broke cycle detection. +// +// It turned out that this cycle was being kicked off due to some +// extended diagnostic attempts in coherence, so removing those +// sidestepped the issue for now. + +#![allow(dead_code)] + +pub trait Insertable { + type Values; + + fn values(self) -> Self::Values; +} + +impl Insertable for Option + where + T: Insertable, + T::Values: Default, +{ + type Values = T::Values; + + fn values(self) -> Self::Values { + self.map(Insertable::values).unwrap_or_default() + } +} + +impl<'a, T> Insertable for &'a Option + where + Option<&'a T>: Insertable, +{ + type Values = as Insertable>::Values; + + fn values(self) -> Self::Values { + self.as_ref().values() + } +} + +impl<'a, T> Insertable for &'a [T] +{ + type Values = Self; + + fn values(self) -> Self::Values { + self + } +} + +trait Unimplemented { } + +trait Dummy { } + +struct Foo { t: T } + +impl<'a, U> Dummy for Foo<&'a U> + where &'a U: Insertable +{ +} + +impl Dummy for T + where T: Unimplemented +{ } + +fn main() { +} diff --git a/src/test/run-pass/issue-47139-2.rs b/src/test/run-pass/issue-47139-2.rs new file mode 100644 index 0000000000..08eaee5acd --- /dev/null +++ b/src/test/run-pass/issue-47139-2.rs @@ -0,0 +1,75 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #47139: +// +// Same as issue-47139-1.rs, but the impls of dummy are in the +// opposite order. This influenced the way that coherence ran and in +// some cases caused the overflow to occur when it wouldn't otherwise. +// In an effort to make the regr test more robust, I am including both +// orderings. + +#![allow(dead_code)] + +pub trait Insertable { + type Values; + + fn values(self) -> Self::Values; +} + +impl Insertable for Option + where + T: Insertable, + T::Values: Default, +{ + type Values = T::Values; + + fn values(self) -> Self::Values { + self.map(Insertable::values).unwrap_or_default() + } +} + +impl<'a, T> Insertable for &'a Option + where + Option<&'a T>: Insertable, +{ + type Values = as Insertable>::Values; + + fn values(self) -> Self::Values { + self.as_ref().values() + } +} + +impl<'a, T> Insertable for &'a [T] +{ + type Values = Self; + + fn values(self) -> Self::Values { + self + } +} + +trait Unimplemented { } + +trait Dummy { } + +struct Foo { t: T } + +impl Dummy for T + where T: Unimplemented +{ } + +impl<'a, U> Dummy for Foo<&'a U> + where &'a U: Insertable +{ +} + +fn main() { +} diff --git a/src/test/run-pass/issue-47638.rs b/src/test/run-pass/issue-47638.rs new file mode 100644 index 0000000000..6f627b2a3c --- /dev/null +++ b/src/test/run-pass/issue-47638.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn id<'c, 'b>(f: &'c &'b Fn(&i32)) -> &'c &'b Fn(&'static i32) { + f +} + +fn main() { + let f: &Fn(&i32) = &|x| {}; + id(&f); +} diff --git a/src/test/run-pass/issue-8860.rs b/src/test/run-pass/issue-8860.rs index ff562aac16..127f9e355c 100644 --- a/src/test/run-pass/issue-8860.rs +++ b/src/test/run-pass/issue-8860.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// compile-flags: -Z borrowck=compare static mut DROP: isize = 0; static mut DROP_S: isize = 0; diff --git a/src/test/run-pass/lto-still-runs-thread-dtors.rs b/src/test/run-pass/lto-still-runs-thread-dtors.rs new file mode 100644 index 0000000000..91fb7aa51d --- /dev/null +++ b/src/test/run-pass/lto-still-runs-thread-dtors.rs @@ -0,0 +1,41 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -C lto +// no-prefer-dynamic +// ignore-emscripten no threads support + +use std::thread; + +static mut HIT: usize = 0; + +thread_local!(static A: Foo = Foo); + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) { + unsafe { + HIT += 1; + } + } +} + +fn main() { + unsafe { + assert_eq!(HIT, 0); + thread::spawn(|| { + assert_eq!(HIT, 0); + A.with(|_| ()); + assert_eq!(HIT, 0); + }).join().unwrap(); + assert_eq!(HIT, 1); + } +} diff --git a/src/tools/miri/tests/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/macro-lifetime-used-with-bound.rs similarity index 63% rename from src/tools/miri/tests/run-pass/last-use-in-cap-clause.rs rename to src/test/run-pass/macro-lifetime-used-with-bound.rs index de2d815ca5..b0c9280b6c 100644 --- a/src/tools/miri/tests/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/macro-lifetime-used-with-bound.rs @@ -8,18 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Make sure #1399 stays fixed +#![feature(macro_lifetime_matcher)] -#[allow(dead_code)] -struct A { a: Box } - -fn foo() -> Box isize + 'static> { - let k: Box<_> = Box::new(22); - let _u = A {a: k.clone()}; - let result = || 22; - Box::new(result) +macro_rules! foo { + ($l:lifetime, $l2:lifetime) => { + fn f<$l: $l2, $l2>(arg: &$l str, arg2: &$l2 str) -> &$l str { + arg + } + } } pub fn main() { - assert_eq!(foo()(), 22); + foo!('a, 'b); + let x: &'static str = f("hi", "there"); + assert_eq!("hi", x); } diff --git a/src/test/run-pass/macro-lifetime-used-with-labels.rs b/src/test/run-pass/macro-lifetime-used-with-labels.rs new file mode 100644 index 0000000000..8a2d76e17d --- /dev/null +++ b/src/test/run-pass/macro-lifetime-used-with-labels.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unreachable_code)] +#![feature(macro_lifetime_matcher)] + +macro_rules! x { + ($a:lifetime) => { + $a: loop { + break $a; + panic!("failed"); + } + } +} +macro_rules! br { + ($a:lifetime) => { + break $a; + } +} +macro_rules! br2 { + ($b:lifetime) => { + 'b: loop { + break $b; // this $b should refer to the outer loop. + } + } +} +fn main() { + x!('a); + 'c: loop { + br!('c); + panic!("failed"); + } + 'b: loop { + br2!('b); + panic!("failed"); + } +} diff --git a/src/test/run-pass/macro-lifetime-used-with-static.rs b/src/test/run-pass/macro-lifetime-used-with-static.rs new file mode 100644 index 0000000000..468ee2e943 --- /dev/null +++ b/src/test/run-pass/macro-lifetime-used-with-static.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(macro_lifetime_matcher)] + +macro_rules! foo { + ($l:lifetime) => { + fn f(arg: &$l str) -> &$l str { + arg + } + } +} + +pub fn main() { + foo!('static); + let x: &'static str = f("hi"); + assert_eq!("hi", x); +} diff --git a/src/tools/miri/tests/run-pass-fullmir/move-arg-2-unique.rs b/src/test/run-pass/macro-lifetime.rs similarity index 67% rename from src/tools/miri/tests/run-pass-fullmir/move-arg-2-unique.rs rename to src/test/run-pass/macro-lifetime.rs index f3c6566237..db521ca7f1 100644 --- a/src/tools/miri/tests/run-pass-fullmir/move-arg-2-unique.rs +++ b/src/test/run-pass/macro-lifetime.rs @@ -8,15 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//ignore-msvc +#![feature(macro_lifetime_matcher)] -#![allow(unused_features, unused_variables)] -#![feature(box_syntax)] - -fn test(foo: Box> ) { assert_eq!((*foo)[0], 10); } +macro_rules! foo { + ($l:lifetime) => { + fn f<$l>(arg: &$l str) -> &$l str { + arg + } + } +} pub fn main() { - let x = box vec![10]; - // Test forgetting a local by move-in - test(x); + foo!('a); + let x: &'static str = f("hi"); + assert_eq!("hi", x); } diff --git a/src/test/compile-fail/partialeq_help.rs b/src/test/run-pass/macro-nested_expr.rs similarity index 61% rename from src/test/compile-fail/partialeq_help.rs rename to src/test/run-pass/macro-nested_expr.rs index 52c24473bd..993ded60c3 100644 --- a/src/test/compile-fail/partialeq_help.rs +++ b/src/test/run-pass/macro-nested_expr.rs @@ -8,13 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(a: &T, b: T) { - a == b; //~ ERROR E0277 - //~| NOTE can't compare `&T` with `T` - //~| HELP the trait `std::cmp::PartialEq` is not implemented for `&T` - //~| HELP consider adding a `where &T: std::cmp::PartialEq` bound +// #42164 + +#![feature(decl_macro)] +#![allow(dead_code)] + +pub macro m($inner_str:expr) { + #[doc = $inner_str] + struct S; +} + +macro_rules! define_f { + ($name:expr) => { + #[export_name = $name] + fn f() {} + } } fn main() { - foo(&1, 1); + define_f!(concat!("exported_", "f")); + m!(stringify!(foo)); } + diff --git a/src/test/run-pass/match-pipe-binding.rs b/src/test/run-pass/match-pipe-binding.rs index bda90d3aae..9592da77a1 100644 --- a/src/test/run-pass/match-pipe-binding.rs +++ b/src/test/run-pass/match-pipe-binding.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// compile-flags: -Z borrowck=compare fn test1() { // from issue 6338 diff --git a/src/test/run-pass/mir-typeck-normalize-fn-sig.rs b/src/test/run-pass/mir-typeck-normalize-fn-sig.rs new file mode 100644 index 0000000000..11918d3739 --- /dev/null +++ b/src/test/run-pass/mir-typeck-normalize-fn-sig.rs @@ -0,0 +1,38 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This code was creating an ICE in the MIR type checker. The reason +// is that we are reifying a reference to a function (`foo::<'x>`), +// which involves extracting its signature, but we were not +// normalizing the signature afterwards. As a result, we sometimes got +// errors around the `>::Value`, which can be +// normalized to `f64`. + +#![allow(dead_code)] + +trait Foo<'x> { + type Value; +} + +impl<'x> Foo<'x> for u32 { + type Value = f64; +} + +struct Providers<'x> { + foo: for<'y> fn(x: &'x u32, y: &'y u32) -> >::Value, +} + +fn foo<'y, 'x: 'x>(x: &'x u32, y: &'y u32) -> >::Value { + *x as f64 +} + +fn main() { + Providers { foo }; +} diff --git a/src/test/run-pass/multiple-reprs.rs b/src/test/run-pass/multiple-reprs.rs index c2fe943eed..d8eafb806f 100644 --- a/src/test/run-pass/multiple-reprs.rs +++ b/src/test/run-pass/multiple-reprs.rs @@ -9,7 +9,8 @@ // except according to those terms. -use std::mem::size_of; +use std::mem::{size_of, align_of}; +use std::os::raw::c_int; // The two enums that follow are designed so that bugs trigger layout optimization. // Specifically, if either of the following reprs used here is not detected by the compiler, @@ -27,6 +28,38 @@ enum E2 { B(u8, u16, u8) } +// Check that repr(int) and repr(C) are in fact different from the above + +#[repr(u8)] +enum E3 { + A(u8, u16, u8), + B(u8, u16, u8) +} + +#[repr(u16)] +enum E4 { + A(u8, u16, u8), + B(u8, u16, u8) +} + +#[repr(u32)] +enum E5 { + A(u8, u16, u8), + B(u8, u16, u8) +} + +#[repr(u64)] +enum E6 { + A(u8, u16, u8), + B(u8, u16, u8) +} + +#[repr(C)] +enum E7 { + A(u8, u16, u8), + B(u8, u16, u8) +} + // From pr 37429 #[repr(C,packed)] @@ -37,7 +70,20 @@ pub struct p0f_api_query { } pub fn main() { - assert_eq!(size_of::(), 6); - assert_eq!(size_of::(), 6); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 6); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), align_size(10, align_of::())); + assert_eq!(size_of::(), align_size(14, align_of::())); + assert_eq!(size_of::(), align_size(6 + size_of::(), align_of::())); assert_eq!(size_of::(), 21); } + +fn align_size(size: usize, align: usize) -> usize { + if size % align != 0 { + size + (align - (size % align)) + } else { + size + } +} diff --git a/src/test/run-pass/nested-vec-3.rs b/src/test/run-pass/nested-vec-3.rs index 9141b5f29c..d1a63b4439 100644 --- a/src/test/run-pass/nested-vec-3.rs +++ b/src/test/run-pass/nested-vec-3.rs @@ -14,8 +14,6 @@ // the contents implement Drop and we hit a panic in the middle of // construction. -#![feature(const_atomic_usize_new)] - use std::thread; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/test/run-pass/next-power-of-two-overflow-debug.rs b/src/test/run-pass/next-power-of-two-overflow-debug.rs index a3e7ffd4e4..2782f8c2a5 100644 --- a/src/test/run-pass/next-power-of-two-overflow-debug.rs +++ b/src/test/run-pass/next-power-of-two-overflow-debug.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -C debug_assertions=yes +// ignore-wasm32-bare compiled with panic=abort by default #![feature(i128_type)] diff --git a/src/test/run-pass/nll/get_default.rs b/src/test/run-pass/nll/get_default.rs new file mode 100644 index 0000000000..13ef907d8d --- /dev/null +++ b/src/test/run-pass/nll/get_default.rs @@ -0,0 +1,31 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(nll)] + +use std::collections::HashMap; + +fn get_default(map: &mut HashMap, key: usize) -> &mut String { + match map.get_mut(&key) { + Some(value) => value, + None => { + map.insert(key, "".to_string()); + map.get_mut(&key).unwrap() + } + } +} + +fn main() { + let map = &mut HashMap::new(); + map.insert(22, format!("Hello, world")); + map.insert(44, format!("Goodbye, world")); + assert_eq!(&*get_default(map, 22), "Hello, world"); + assert_eq!(&*get_default(map, 66), ""); +} diff --git a/src/test/run-pass/nll/process_or_insert_default.rs b/src/test/run-pass/nll/process_or_insert_default.rs new file mode 100644 index 0000000000..a3a484402c --- /dev/null +++ b/src/test/run-pass/nll/process_or_insert_default.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(nll)] + +use std::collections::HashMap; + +fn process_or_insert_default(map: &mut HashMap, key: usize) { + match map.get_mut(&key) { + Some(value) => { + process(value); + } + None => { + map.insert(key, "".to_string()); + } + } +} + +fn process(x: &str) { + assert_eq!(x, "Hello, world"); +} + +fn main() { + let map = &mut HashMap::new(); + map.insert(22, format!("Hello, world")); + map.insert(44, format!("Goodbye, world")); + process_or_insert_default(map, 22); + process_or_insert_default(map, 66); + assert_eq!(map[&66], ""); +} diff --git a/src/test/run-pass/nll/rc-loop.rs b/src/test/run-pass/nll/rc-loop.rs new file mode 100644 index 0000000000..2b746fac4d --- /dev/null +++ b/src/test/run-pass/nll/rc-loop.rs @@ -0,0 +1,40 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// A test for something that NLL enables. It sometimes happens that +// the `while let` pattern makes some borrows from a variable (in this +// case, `x`) that you need in order to compute the next value for +// `x`. The lexical checker makes this very painful. The NLL checker +// does not. + +#![feature(match_default_bindings)] +#![feature(nll)] + +use std::rc::Rc; + +#[derive(Debug, PartialEq, Eq)] +enum Foo { + Base(usize), + Next(Rc), +} + +fn find_base(mut x: Rc) -> Rc { + while let Foo::Next(n) = &*x { + x = n.clone(); + } + x +} + +fn main() { + let chain = Rc::new(Foo::Next(Rc::new(Foo::Base(44)))); + let base = find_base(chain); + assert_eq!(&*base, &Foo::Base(44)); +} + diff --git a/src/test/run-pass/no-landing-pads.rs b/src/test/run-pass/no-landing-pads.rs index e718046ebb..73f123045d 100644 --- a/src/test/run-pass/no-landing-pads.rs +++ b/src/test/run-pass/no-landing-pads.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z no-landing-pads +// compile-flags: -Z no-landing-pads -C codegen-units=1 // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/non_modrs_mods/foors_mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod.rs new file mode 100644 index 0000000000..7d37c6d939 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// ignore-test: not a test, used by non_modrs_mods.rs + +pub mod inner_modrs_mod; +pub mod inner_foors_mod; diff --git a/src/vendor/memchr-1.0.2/.cargo-ok b/src/test/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir similarity index 100% rename from src/vendor/memchr-1.0.2/.cargo-ok rename to src/test/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir b/src/test/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs new file mode 100644 index 0000000000..9e3f10f12e --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs @@ -0,0 +1,12 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod inner_modrs_mod; +pub mod inner_foors_mod; diff --git a/src/test/run-pass/non_modrs_mods/non_modrs_mods.rs b/src/test/run-pass/non_modrs_mods/non_modrs_mods.rs new file mode 100644 index 0000000000..eab8112b85 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/non_modrs_mods.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// ignore-pretty issue #37195 +#![feature(non_modrs_mods)] + +pub mod modrs_mod; +pub mod foors_mod; + +#[path = "some_crazy_attr_mod_dir/arbitrary_name.rs"] +pub mod attr_mod; + +pub fn main() { + modrs_mod::inner_modrs_mod::innest::foo(); + modrs_mod::inner_foors_mod::innest::foo(); + foors_mod::inner_modrs_mod::innest::foo(); + foors_mod::inner_foors_mod::innest::foo(); + attr_mod::inner_modrs_mod::innest::foo(); +} diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs new file mode 100644 index 0000000000..226e6fda0a --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod inner_modrs_mod; diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/optimization-fuel-1.rs b/src/test/run-pass/optimization-fuel-1.rs index 5f294e26aa..e3529ebfb0 100644 --- a/src/test/run-pass/optimization-fuel-1.rs +++ b/src/test/run-pass/optimization-fuel-1.rs @@ -22,5 +22,3 @@ fn main() { +(size_of::() == 4) as usize; assert_eq!(optimized, 1); } - - diff --git a/src/test/run-pass/packed-struct-borrow-element.rs b/src/test/run-pass/packed-struct-borrow-element.rs index 4886874062..3041c73afb 100644 --- a/src/test/run-pass/packed-struct-borrow-element.rs +++ b/src/test/run-pass/packed-struct-borrow-element.rs @@ -17,7 +17,7 @@ struct Foo { pub fn main() { let foo = Foo { bar: 1, baz: 2 }; - let brw = &foo.baz; + let brw = unsafe { &foo.baz }; assert_eq!(*brw, 2); } diff --git a/src/test/run-pass/packed-struct-drop-aligned.rs b/src/test/run-pass/packed-struct-drop-aligned.rs new file mode 100644 index 0000000000..bbe31a65e8 --- /dev/null +++ b/src/test/run-pass/packed-struct-drop-aligned.rs @@ -0,0 +1,42 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cell::Cell; +use std::mem; + +struct Aligned<'a> { + drop_count: &'a Cell +} + +#[inline(never)] +fn check_align(ptr: *const Aligned) { + assert_eq!(ptr as usize % mem::align_of::(), + 0); +} + +impl<'a> Drop for Aligned<'a> { + fn drop(&mut self) { + check_align(self); + self.drop_count.set(self.drop_count.get() + 1); + } +} + +#[repr(packed)] +struct Packed<'a>(u8, Aligned<'a>); + +fn main() { + let drop_count = &Cell::new(0); + { + let mut p = Packed(0, Aligned { drop_count }); + p.1 = Aligned { drop_count }; + assert_eq!(drop_count.get(), 1); + } + assert_eq!(drop_count.get(), 2); +} diff --git a/src/test/run-pass/packed-struct-optimized-enum.rs b/src/test/run-pass/packed-struct-optimized-enum.rs new file mode 100644 index 0000000000..7968ae2278 --- /dev/null +++ b/src/test/run-pass/packed-struct-optimized-enum.rs @@ -0,0 +1,45 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(packed)] +struct Packed(T); + +impl Copy for Packed {} +impl Clone for Packed { + fn clone(&self) -> Self { *self } +} + +fn sanity_check_size(one: T) { + let two = [one, one]; + let stride = (&two[1] as *const _ as usize) - (&two[0] as *const _ as usize); + let (size, align) = (std::mem::size_of::(), std::mem::align_of::()); + assert_eq!(stride, size); + assert_eq!(size % align, 0); +} + +fn main() { + // This can fail if rustc and LLVM disagree on the size of a type. + // In this case, `Option>` was erronously not + // marked as packed despite needing alignment `1` and containing + // its `&()` discriminant, which has alignment larger than `1`. + sanity_check_size((Some(Packed((&(), 0))), true)); + + // In #46769, `Option<(Packed<&()>, bool)>` was found to have + // pointer alignment, without actually being aligned in size. + // E.g. on 64-bit platforms, it had alignment `8` but size `9`. + type PackedRefAndBool<'a> = (Packed<&'a ()>, bool); + sanity_check_size::>(Some((Packed(&()), true))); + + // Make sure we don't pay for the enum optimization in size, + // e.g. we shouldn't need extra padding after the packed data. + assert_eq!(std::mem::align_of::>(), 1); + assert_eq!(std::mem::size_of::>(), + std::mem::size_of::()); +} diff --git a/src/test/run-pass/panic-handler-chain.rs b/src/test/run-pass/panic-handler-chain.rs index c5dc8ccd2e..8d692f2241 100644 --- a/src/test/run-pass/panic-handler-chain.rs +++ b/src/test/run-pass/panic-handler-chain.rs @@ -11,7 +11,6 @@ // ignore-emscripten no threads support #![feature(panic_handler, std_panic)] -#![feature(const_atomic_usize_new)] use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/src/test/run-pass/panic-handler-set-twice.rs b/src/test/run-pass/panic-handler-set-twice.rs index 8bf2683cd9..81da13afaa 100644 --- a/src/test/run-pass/panic-handler-set-twice.rs +++ b/src/test/run-pass/panic-handler-set-twice.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(panic_handler, std_panic)] -#![feature(const_atomic_usize_new)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs b/src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs new file mode 100644 index 0000000000..7003541e86 --- /dev/null +++ b/src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs @@ -0,0 +1,41 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(crate_in_paths)] + +use crate::m::f; +use crate as root; + +mod m { + pub fn f() -> u8 { 1 } + pub fn g() -> u8 { 2 } + pub fn h() -> u8 { 3 } + + // OK, visibilities are implicitly absolute like imports + pub(in crate::m) struct S; +} + +mod n +{ + use crate::m::f; + use crate as root; + pub fn check() { + assert_eq!(f(), 1); + assert_eq!(::crate::m::g(), 2); + assert_eq!(root::m::h(), 3); + } +} + +fn main() { + assert_eq!(f(), 1); + assert_eq!(::crate::m::g(), 2); + assert_eq!(root::m::h(), 3); + n::check(); +} diff --git a/src/test/run-pass/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs b/src/test/run-pass/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs new file mode 100644 index 0000000000..c3da4a5187 --- /dev/null +++ b/src/test/run-pass/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[derive(Debug)] +pub struct S; + +#[derive(Debug)] +pub struct Z; diff --git a/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs b/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs new file mode 100644 index 0000000000..0fa125a3e5 --- /dev/null +++ b/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:xcrate.rs + +#![feature(extern_absolute_paths)] + +use xcrate::Z; + +fn f() { + use xcrate; + use xcrate as ycrate; + let s = xcrate::S; + assert_eq!(format!("{:?}", s), "S"); + let z = ycrate::Z; + assert_eq!(format!("{:?}", z), "Z"); +} + +fn main() { + let s = ::xcrate::S; + assert_eq!(format!("{:?}", s), "S"); + let z = Z; + assert_eq!(format!("{:?}", z), "Z"); +} diff --git a/src/test/run-pass/specialization/auxiliary/specialization_cross_crate_defaults.rs b/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs similarity index 100% rename from src/test/run-pass/specialization/auxiliary/specialization_cross_crate_defaults.rs rename to src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs diff --git a/src/test/run-pass/specialization/specialization-cross-crate-defaults.rs b/src/test/run-pass/specialization/cross-crate-defaults.rs similarity index 87% rename from src/test/run-pass/specialization/specialization-cross-crate-defaults.rs rename to src/test/run-pass/specialization/cross-crate-defaults.rs index 62c7e3e2e4..132520dcb7 100644 --- a/src/test/run-pass/specialization/specialization-cross-crate-defaults.rs +++ b/src/test/run-pass/specialization/cross-crate-defaults.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:specialization_cross_crate_defaults.rs +// aux-build:cross_crates_defaults.rs #![feature(specialization)] -extern crate specialization_cross_crate_defaults; +extern crate cross_crates_defaults; -use specialization_cross_crate_defaults::*; +use cross_crates_defaults::*; struct LocalDefault; struct LocalOverride; diff --git a/src/test/run-pass/struct-order-of-eval-3.rs b/src/test/run-pass/struct-order-of-eval-3.rs index cf93133d20..3059c8e9e8 100644 --- a/src/test/run-pass/struct-order-of-eval-3.rs +++ b/src/test/run-pass/struct-order-of-eval-3.rs @@ -11,8 +11,6 @@ // Checks that functional-record-update order-of-eval is as expected // even when no Drop-implementations are involved. -#![feature(const_atomic_usize_new)] - use std::sync::atomic::{Ordering, AtomicUsize}; struct W { wrapped: u32 } diff --git a/src/test/run-pass/struct-order-of-eval-4.rs b/src/test/run-pass/struct-order-of-eval-4.rs index d442923478..2ae9ebc34e 100644 --- a/src/test/run-pass/struct-order-of-eval-4.rs +++ b/src/test/run-pass/struct-order-of-eval-4.rs @@ -11,8 +11,6 @@ // Checks that struct-literal expression order-of-eval is as expected // even when no Drop-implementations are involved. -#![feature(const_atomic_usize_new)] - use std::sync::atomic::{Ordering, AtomicUsize}; struct W { wrapped: u32 } diff --git a/src/test/run-pass/svh-add-comment.rs b/src/test/run-pass/svh-add-comment.rs deleted file mode 100644 index 4d7b61e08f..0000000000 --- a/src/test/run-pass/svh-add-comment.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-comment.rs - -// pretty-expanded FIXME #23616 - -extern crate a; -extern crate b; - -fn main() { - b::foo() -} diff --git a/src/test/run-pass/svh-add-macro.rs b/src/test/run-pass/svh-add-macro.rs deleted file mode 100644 index 4e0192c40c..0000000000 --- a/src/test/run-pass/svh-add-macro.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-macro.rs - -// pretty-expanded FIXME #23616 - -extern crate a; -extern crate b; - -fn main() { - b::foo() -} diff --git a/src/test/run-pass/svh-add-nothing.rs b/src/test/run-pass/svh-add-nothing.rs index 9aa56ed2a7..aca50859b6 100644 --- a/src/test/run-pass/svh-add-nothing.rs +++ b/src/test/run-pass/svh-add-nothing.rs @@ -11,7 +11,7 @@ // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs -// aux-build:svh-a-no-change.rs +// aux-build:svh-a-base.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/svh-add-redundant-cfg.rs b/src/test/run-pass/svh-add-redundant-cfg.rs deleted file mode 100644 index 2da3004aaf..0000000000 --- a/src/test/run-pass/svh-add-redundant-cfg.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-redundant-cfg.rs - -// pretty-expanded FIXME #23616 - -extern crate a; -extern crate b; - -fn main() { - b::foo() -} diff --git a/src/test/run-pass/svh-add-whitespace.rs b/src/test/run-pass/svh-add-whitespace.rs deleted file mode 100644 index bfc676bde2..0000000000 --- a/src/test/run-pass/svh-add-whitespace.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-whitespace.rs - -// pretty-expanded FIXME #23616 - -extern crate a; -extern crate b; - -fn main() { - b::foo() -} diff --git a/src/test/run-pass/syntax-extension-source-utils.rs b/src/test/run-pass/syntax-extension-source-utils.rs index 25c7417f7e..1b2741f14b 100644 --- a/src/test/run-pass/syntax-extension-source-utils.rs +++ b/src/test/run-pass/syntax-extension-source-utils.rs @@ -22,7 +22,7 @@ macro_rules! indirect_line { () => ( line!() ) } pub fn main() { assert_eq!(line!(), 24); - assert_eq!(column!(), 15); + assert_eq!(column!(), 16); assert_eq!(indirect_line!(), 26); assert!((file!().ends_with("syntax-extension-source-utils.rs"))); assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string()); diff --git a/src/test/run-pass/termination-trait-for-empty.rs b/src/test/run-pass/termination-trait-for-empty.rs new file mode 100644 index 0000000000..5e534da012 --- /dev/null +++ b/src/test/run-pass/termination-trait-for-empty.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +fn main() {} diff --git a/src/test/run-pass/termination-trait-for-i32.rs b/src/test/run-pass/termination-trait-for-i32.rs new file mode 100644 index 0000000000..fa7cb023b4 --- /dev/null +++ b/src/test/run-pass/termination-trait-for-i32.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +fn main() -> i32 { + 0 +} diff --git a/src/test/run-pass/termination-trait-for-result.rs b/src/test/run-pass/termination-trait-for-result.rs new file mode 100644 index 0000000000..751db0fb50 --- /dev/null +++ b/src/test/run-pass/termination-trait-for-result.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(termination_trait)] + +use std::io::Error; + +fn main() -> Result<(), Error> { + Ok(()) +} diff --git a/src/test/run-pass/thinlto/weak-works.rs b/src/test/run-pass/thinlto/weak-works.rs new file mode 100644 index 0000000000..b9719e04f3 --- /dev/null +++ b/src/test/run-pass/thinlto/weak-works.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -C codegen-units=8 -Z thinlto +// ignore-windows +// min-llvm-version 4.0 + +#![feature(linkage)] + +pub mod foo { + #[linkage = "weak"] + #[no_mangle] + pub extern "C" fn FOO() -> i32 { + 0 + } +} + +mod bar { + extern "C" { + fn FOO() -> i32; + } + + pub fn bar() -> i32 { + unsafe { FOO() } + } +} + +fn main() { + bar::bar(); +} diff --git a/src/test/run-pass/u128.rs b/src/test/run-pass/u128.rs index bf506a7125..ebd43a8603 100644 --- a/src/test/run-pass/u128.rs +++ b/src/test/run-pass/u128.rs @@ -10,6 +10,8 @@ // ignore-emscripten u128 not supported +// compile-flags: -Z borrowck=compare + #![feature(i128_type, test)] extern crate test; diff --git a/src/test/run-pass/union/union-const-eval-field.rs b/src/test/run-pass/union/union-const-eval-field.rs new file mode 100644 index 0000000000..f83f49f298 --- /dev/null +++ b/src/test/run-pass/union/union-const-eval-field.rs @@ -0,0 +1,45 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_fn)] + +type Field1 = i32; +type Field2 = f32; +type Field3 = i64; + +union DummyUnion { + field1: Field1, + field2: Field2, + field3: Field3, +} + +const FLOAT1_AS_I32: i32 = 1065353216; +const UNION: DummyUnion = DummyUnion { field1: FLOAT1_AS_I32 }; + +const fn read_field1() -> Field1 { + const FIELD1: Field1 = unsafe { UNION.field1 }; + FIELD1 +} + +const fn read_field2() -> Field2 { + const FIELD2: Field2 = unsafe { UNION.field2 }; + FIELD2 +} + +const fn read_field3() -> Field3 { + const FIELD3: Field3 = unsafe { UNION.field3 }; + FIELD3 +} + +fn main() { + assert_eq!(read_field1(), FLOAT1_AS_I32); + assert_eq!(read_field2(), 1.0); + assert_eq!(read_field3(), unsafe { UNION.field3 }); +} diff --git a/src/test/run-pass/use-nested-groups.rs b/src/test/run-pass/use-nested-groups.rs new file mode 100644 index 0000000000..74a82afd46 --- /dev/null +++ b/src/test/run-pass/use-nested-groups.rs @@ -0,0 +1,35 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(use_nested_groups)] + +mod a { + pub enum B {} + + pub mod d { + pub enum E {} + pub enum F {} + + pub mod g { + pub enum H {} + pub enum I {} + } + } +} + +use a::{B, d::{self, *, g::H}}; + +fn main() { + let _: B; + let _: E; + let _: F; + let _: H; + let _: d::g::I; +} diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 64fd9e0a77..ecb62b1888 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// compile-flags: -Z borrowck=compare use std::cell::Cell; use std::mem::swap; diff --git a/src/test/rustdoc/auxiliary/external-cross-doc.md b/src/test/rustdoc/auxiliary/external-cross-doc.md new file mode 100644 index 0000000000..8b4e6edc69 --- /dev/null +++ b/src/test/rustdoc/auxiliary/external-cross-doc.md @@ -0,0 +1,4 @@ +# Cross-crate imported docs + +This file is to make sure `#[doc(include="file.md")]` works when you re-export an item with included +docs. diff --git a/src/test/rustdoc/auxiliary/external-cross.rs b/src/test/rustdoc/auxiliary/external-cross.rs new file mode 100644 index 0000000000..767fb05313 --- /dev/null +++ b/src/test/rustdoc/auxiliary/external-cross.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(external_doc)] +#![deny(missing_doc)] + +#[doc(include="external-cross-doc.md")] +pub struct NeedMoreDocs; diff --git a/src/test/rustdoc/auxiliary/external-doc.md b/src/test/rustdoc/auxiliary/external-doc.md new file mode 100644 index 0000000000..38478c1635 --- /dev/null +++ b/src/test/rustdoc/auxiliary/external-doc.md @@ -0,0 +1,3 @@ +# External Docs + +This file is here to test the `#[doc(include="file")]` attribute. diff --git a/src/test/rustdoc/auxiliary/issue-46727.rs b/src/test/rustdoc/auxiliary/issue-46727.rs new file mode 100644 index 0000000000..f0869f016e --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-46727.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Cmetadata=aux + +pub trait Foo {} + +pub struct Bar { x: T } + +impl Foo for Bar<[T; 1 + 1 + 1]> {} diff --git a/src/test/rustdoc/doc-cfg.rs b/src/test/rustdoc/doc-cfg.rs index cfb37912fe..8499e5c741 100644 --- a/src/test/rustdoc/doc-cfg.rs +++ b/src/test/rustdoc/doc-cfg.rs @@ -44,4 +44,4 @@ pub mod unix_only { impl ArmOnly for super::Portable { fn unix_and_arm_only_function() {} } -} \ No newline at end of file +} diff --git a/src/test/rustdoc/doc-spotlight.rs b/src/test/rustdoc/doc-spotlight.rs new file mode 100644 index 0000000000..a570aa2d39 --- /dev/null +++ b/src/test/rustdoc/doc-spotlight.rs @@ -0,0 +1,46 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(doc_spotlight)] + +pub struct Wrapper { + inner: T, +} + +impl SomeTrait for Wrapper {} + +#[doc(spotlight)] +pub trait SomeTrait { + // @has doc_spotlight/trait.SomeTrait.html + // @has - '//code[@class="content"]' 'impl SomeTrait for Wrapper' + fn wrap_me(self) -> Wrapper where Self: Sized { + Wrapper { + inner: self, + } + } +} + +pub struct SomeStruct; +impl SomeTrait for SomeStruct {} + +impl SomeStruct { + // @has doc_spotlight/struct.SomeStruct.html + // @has - '//code[@class="content"]' 'impl SomeTrait for SomeStruct' + // @has - '//code[@class="content"]' 'impl SomeTrait for Wrapper' + pub fn new() -> SomeStruct { + SomeStruct + } +} + +// @has doc_spotlight/fn.bare_fn.html +// @has - '//code[@class="content"]' 'impl SomeTrait for SomeStruct' +pub fn bare_fn() -> SomeStruct { + SomeStruct +} diff --git a/src/test/rustdoc/double-quote-escape.rs b/src/test/rustdoc/double-quote-escape.rs new file mode 100644 index 0000000000..46e2ca8c76 --- /dev/null +++ b/src/test/rustdoc/double-quote-escape.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +// ignore-tidy-linelength + +pub trait Foo { + fn foo() {} +} + +pub struct Bar; + +// @has foo/struct.Bar.html +// @has - '//*[@class="sidebar-links"]/a[@href="#impl-Foo%3Cunsafe%20extern%20%22C%22%20fn()%3E"]' 'Foo' +impl Foo for Bar {} diff --git a/src/test/rustdoc/escape-deref-methods.rs b/src/test/rustdoc/escape-deref-methods.rs new file mode 100644 index 0000000000..f31b0ddca9 --- /dev/null +++ b/src/test/rustdoc/escape-deref-methods.rs @@ -0,0 +1,45 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +use std::ops::{Deref, DerefMut}; + +#[derive(Debug, Clone)] +pub struct Title { + name: String, +} + +#[derive(Debug, Clone)] +pub struct TitleList { + pub members: Vec, +} + +impl TitleList { + pub fn new() -> Self { + TitleList { members: Vec::new() } + } +} + +impl Deref for TitleList { + type Target = Vec<Title>; + + fn deref(&self) -> &Self::Target { + &self.members + } +} + +// @has foo/struct.TitleList.html +// @has - '//*[@class="sidebar-title"]' 'Methods from Deref<Target=Vec<Title>>' +impl DerefMut for TitleList { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.members + } +} diff --git a/src/test/rustdoc/external-cross.rs b/src/test/rustdoc/external-cross.rs new file mode 100644 index 0000000000..f4a59cee32 --- /dev/null +++ b/src/test/rustdoc/external-cross.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:external-cross.rs +// ignore-cross-compile + +#![crate_name="host"] + +extern crate external_cross; + +// @has host/struct.NeedMoreDocs.html +// @has - '//h1' 'Cross-crate imported docs' +pub use external_cross::NeedMoreDocs; diff --git a/src/test/rustdoc/external-doc.rs b/src/test/rustdoc/external-doc.rs new file mode 100644 index 0000000000..07e784a6cc --- /dev/null +++ b/src/test/rustdoc/external-doc.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(external_doc)] + +// @has external_doc/struct.CanHasDocs.html +// @has - '//h1' 'External Docs' +// @has - '//h2' 'Inline Docs' +#[doc(include = "auxiliary/external-doc.md")] +/// ## Inline Docs +pub struct CanHasDocs; diff --git a/src/test/rustdoc/foreigntype-reexport.rs b/src/test/rustdoc/foreigntype-reexport.rs new file mode 100644 index 0000000000..714222de52 --- /dev/null +++ b/src/test/rustdoc/foreigntype-reexport.rs @@ -0,0 +1,66 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(extern_types)] + +mod sub { + extern { + /// Another extern type. + pub type C2; + pub fn f2(); + pub static K: usize; + } +} + +pub mod sub2 { + extern { + // @has foreigntype_reexport/sub2/foreigntype.C.html + pub type C; + // @has foreigntype_reexport/sub2/fn.f.html + pub fn f(); + // @has foreigntype_reexport/sub2/static.K3.html + pub static K3: usize; + } +} + +mod sub3 { + extern { + pub type C4; + pub fn f4(); + pub static K4: usize; + type X4; + } +} + +// @has foreigntype_reexport/foreigntype.C2.html +// @has foreigntype_reexport/fn.f2.html +// @has foreigntype_reexport/static.K2.html +// @has foreigntype_reexport/index.html '//a[@class="foreigntype"]' 'C2' +// @has foreigntype_reexport/index.html '//a[@class="fn"]' 'f2' +// @has foreigntype_reexport/index.html '//a[@class="static"]' 'K2' +pub use self::sub::{C2, f2, K as K2}; + +// @has foreigntype_reexport/index.html '//a[@class="foreigntype"]' 'C' +// @has foreigntype_reexport/index.html '//a[@class="fn"]' 'f' +// @has foreigntype_reexport/index.html '//a[@class="static"]' 'K3' +// @has foreigntype_reexport/index.html '//code' 'pub use self::sub2::C as C3;' +// @has foreigntype_reexport/index.html '//code' 'pub use self::sub2::f as f3;' +// @has foreigntype_reexport/index.html '//code' 'pub use self::sub2::K3;' +pub use self::sub2::{C as C3, f as f3, K3}; + +// @has foreigntype_reexport/foreigntype.C4.html +// @has foreigntype_reexport/fn.f4.html +// @has foreigntype_reexport/static.K4.html +// @!has foreigntype_reexport/foreigntype.X4.html +// @has foreigntype_reexport/index.html '//a[@class="foreigntype"]' 'C4' +// @has foreigntype_reexport/index.html '//a[@class="fn"]' 'f4' +// @has foreigntype_reexport/index.html '//a[@class="static"]' 'K4' +// @!has foreigntype_reexport/index.html '//a[@class="foreigntype"]' 'X4' +pub use self::sub3::*; diff --git a/src/test/rustdoc/hidden-trait-struct-impls.rs b/src/test/rustdoc/hidden-trait-struct-impls.rs new file mode 100644 index 0000000000..d16932828d --- /dev/null +++ b/src/test/rustdoc/hidden-trait-struct-impls.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +#[doc(hidden)] +pub trait Foo {} + +trait Dark {} + +pub trait Bam {} + +pub struct Bar; + +struct Hidden; + +// @!has foo/struct.Bar.html '//*[@id="impl-Foo"]' 'impl Foo for Bar' +impl Foo for Bar {} +// @!has foo/struct.Bar.html '//*[@id="impl-Dark"]' 'impl Dark for Bar' +impl Dark for Bar {} +// @has foo/struct.Bar.html '//*[@id="impl-Bam"]' 'impl Bam for Bar' +// @has foo/trait.Bam.html '//*[@id="implementors-list"]' 'impl Bam for Bar' +impl Bam for Bar {} +// @!has foo/trait.Bam.html '//*[@id="implementors-list"]' 'impl Bam for Hidden' +impl Bam for Hidden {} diff --git a/src/test/rustdoc/inline_cross/assoc-items.rs b/src/test/rustdoc/inline_cross/assoc-items.rs new file mode 100644 index 0000000000..95d936883f --- /dev/null +++ b/src/test/rustdoc/inline_cross/assoc-items.rs @@ -0,0 +1,57 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:assoc-items.rs +// build-aux-docs +// ignore-cross-compile + +#![crate_name = "foo"] + +extern crate assoc_items; + +// @has foo/struct.MyStruct.html +// @!has - 'PrivateConst' +// @has - '//*[@id="associatedconstant.PublicConst"]' 'pub const PublicConst: u8' +// @has - '//*[@class="docblock"]' 'PublicConst: u8 = 123' +// @has - '//*[@class="docblock"]' 'docs for PublicConst' +// @!has - 'private_method' +// @has - '//*[@id="method.public_method"]' 'pub fn public_method()' +// @has - '//*[@class="docblock"]' 'docs for public_method' +// @has - '//*[@id="associatedconstant.ConstNoDefault"]' 'const ConstNoDefault: i16' +// @has - '//*[@class="docblock"]' 'ConstNoDefault: i16 = -123' +// @has - '//*[@class="docblock"]' 'dox for ConstNoDefault' +// @has - '//*[@id="associatedconstant.ConstWithDefault"]' 'const ConstWithDefault: u16' +// @has - '//*[@class="docblock"]' 'ConstWithDefault: u16 = 12345' +// @has - '//*[@class="docblock"]' 'docs for ConstWithDefault' +// @has - '//*[@id="associatedtype.TypeNoDefault"]' 'type TypeNoDefault = i32' +// @has - '//*[@class="docblock"]' 'dox for TypeNoDefault' +// @has - '//*[@id="associatedtype.TypeWithDefault"]' 'type TypeWithDefault = u32' +// @has - '//*[@class="docblock"]' 'docs for TypeWithDefault' +// @has - '//*[@id="method.method_no_default"]' 'fn method_no_default()' +// @has - '//*[@class="docblock"]' 'dox for method_no_default' +// @has - '//*[@id="method.method_with_default"]' 'fn method_with_default()' +// @has - '//*[@class="docblock"]' 'docs for method_with_default' +pub use assoc_items::MyStruct; + +// @has foo/trait.MyTrait.html +// @has - '//*[@id="associatedconstant.ConstNoDefault"]' 'const ConstNoDefault: i16' +// @has - '//*[@class="docblock"]' 'docs for ConstNoDefault' +// @has - '//*[@id="associatedconstant.ConstWithDefault"]' 'const ConstWithDefault: u16' +// @has - '//*[@class="docblock"]' 'ConstWithDefault: u16 = 12345' +// @has - '//*[@class="docblock"]' 'docs for ConstWithDefault' +// @has - '//*[@id="associatedtype.TypeNoDefault"]' 'type TypeNoDefault' +// @has - '//*[@class="docblock"]' 'docs for TypeNoDefault' +// @has - '//*[@id="associatedtype.TypeWithDefault"]' 'type TypeWithDefault = u32' +// @has - '//*[@class="docblock"]' 'docs for TypeWithDefault' +// @has - '//*[@id="tymethod.method_no_default"]' 'fn method_no_default()' +// @has - '//*[@class="docblock"]' 'docs for method_no_default' +// @has - '//*[@id="method.method_with_default"]' 'fn method_with_default()' +// @has - '//*[@class="docblock"]' 'docs for method_with_default' +pub use assoc_items::MyTrait; diff --git a/src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs b/src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs new file mode 100644 index 0000000000..e955526900 --- /dev/null +++ b/src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs @@ -0,0 +1,48 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(associated_type_defaults)] + +pub struct MyStruct; + +impl MyStruct { + /// docs for PrivateConst + const PrivateConst: i8 = -123; + /// docs for PublicConst + pub const PublicConst: u8 = 123; + /// docs for private_method + fn private_method() {} + /// docs for public_method + pub fn public_method() {} +} + +pub trait MyTrait { + /// docs for ConstNoDefault + const ConstNoDefault: i16; + /// docs for ConstWithDefault + const ConstWithDefault: u16 = 12345; + /// docs for TypeNoDefault + type TypeNoDefault; + /// docs for TypeWithDefault + type TypeWithDefault = u32; + /// docs for method_no_default + fn method_no_default(); + /// docs for method_with_default + fn method_with_default() {} +} + +impl MyTrait for MyStruct { + /// dox for ConstNoDefault + const ConstNoDefault: i16 = -12345; + /// dox for TypeNoDefault + type TypeNoDefault = i32; + /// dox for method_no_default + fn method_no_default() {} +} diff --git a/src/test/rustdoc/issue-42760.rs b/src/test/rustdoc/issue-42760.rs new file mode 100644 index 0000000000..f5f5c4f97f --- /dev/null +++ b/src/test/rustdoc/issue-42760.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// @has issue_42760/struct.NonGen.html +// @has - '//h1' 'Example' + +/// Item docs. +/// +#[doc="Hello there!"] +/// +/// # Example +/// +/// ```rust +/// // some code here +/// ``` +pub struct NonGen; diff --git a/src/test/rustdoc/issue-46271.rs b/src/test/rustdoc/issue-46271.rs new file mode 100644 index 0000000000..cc3be08c56 --- /dev/null +++ b/src/test/rustdoc/issue-46271.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// hopefully this doesn't cause an ICE + +pub fn foo() { + extern crate std; +} diff --git a/src/test/rustdoc/issue-46377.rs b/src/test/rustdoc/issue-46377.rs new file mode 100644 index 0000000000..db8c7660df --- /dev/null +++ b/src/test/rustdoc/issue-46377.rs @@ -0,0 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// @has 'issue_46377/index.html' '//*[@class="docblock-short"]' 'Check out this struct!' +/// # Check out this struct! +pub struct SomeStruct; diff --git a/src/tools/miri/tests/compile-fail/overflowing-unchecked-rsh.rs b/src/test/rustdoc/issue-46380-2.rs similarity index 64% rename from src/tools/miri/tests/compile-fail/overflowing-unchecked-rsh.rs rename to src/test/rustdoc/issue-46380-2.rs index b8291e1300..22408d3522 100644 --- a/src/tools/miri/tests/compile-fail/overflowing-unchecked-rsh.rs +++ b/src/test/rustdoc/issue-46380-2.rs @@ -8,14 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core_intrinsics)] +pub trait PublicTrait<T> {} -use std::intrinsics::*; +// @has issue_46380_2/struct.PublicStruct.html +pub struct PublicStruct; -//error-pattern: Overflowing shift by 64 in unchecked_shr +// @!has - '//*[@class="impl"]' 'impl PublicTrait<PrivateStruct> for PublicStruct' +impl PublicTrait<PrivateStruct> for PublicStruct {} -fn main() { - unsafe { - let _n = unchecked_shr(1i64, 64); - } -} +struct PrivateStruct; diff --git a/src/test/compile-fail/no-core-gated.rs b/src/test/rustdoc/issue-46380.rs similarity index 80% rename from src/test/compile-fail/no-core-gated.rs rename to src/test/rustdoc/issue-46380.rs index 27f8fda98a..85f29ec4b0 100644 --- a/src/test/compile-fail/no-core-gated.rs +++ b/src/test/rustdoc/issue-46380.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-no_core +// compile-flags: --document-private-items -#![no_core] //~ ERROR no_core is experimental - -fn main() {} +// @has issue_46380/struct.Hidden.html +#[doc(hidden)] +pub struct Hidden; diff --git a/src/test/rustdoc/issue-46727.rs b/src/test/rustdoc/issue-46727.rs new file mode 100644 index 0000000000..5b202d8c4f --- /dev/null +++ b/src/test/rustdoc/issue-46727.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue-46727.rs + +extern crate issue_46727; + +// @has issue_46727/trait.Foo.html +// @has - '//code' 'impl<T> Foo for Bar<[T; 3]>' +pub use issue_46727::{Foo, Bar}; diff --git a/src/test/rustdoc/issue-46766.rs b/src/test/rustdoc/issue-46766.rs new file mode 100644 index 0000000000..cf2dd58f45 --- /dev/null +++ b/src/test/rustdoc/issue-46766.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +pub enum Enum{Variant} +pub use self::Enum::Variant; + +// @!has foo/index.html '//a/@href' './Enum/index.html' diff --git a/src/test/rustdoc/issue-46767.rs b/src/test/rustdoc/issue-46767.rs new file mode 100644 index 0000000000..855de150b0 --- /dev/null +++ b/src/test/rustdoc/issue-46767.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +mod private { + pub enum Enum{Variant} +} +pub use self::private::Enum::*; + +// @!has foo/index.html '//a/@href' './private/index.html' diff --git a/src/test/rustdoc/issue-47639.rs b/src/test/rustdoc/issue-47639.rs new file mode 100644 index 0000000000..167c3aaec4 --- /dev/null +++ b/src/test/rustdoc/issue-47639.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This should not ICE +pub fn test() { + macro_rules! foo { + () => () + } +} diff --git a/src/test/rustdoc/negative-impl-sidebar.rs b/src/test/rustdoc/negative-impl-sidebar.rs new file mode 100644 index 0000000000..dc27b26241 --- /dev/null +++ b/src/test/rustdoc/negative-impl-sidebar.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(optin_builtin_traits)] +#![crate_name = "foo"] + +pub struct Foo; + +// @has foo/struct.Foo.html +// @has - '//*[@class="sidebar-title"][@href="#implementations"]' 'Trait Implementations' +// @has - '//*[@class="sidebar-links"]/a' '!Sync' +impl !Sync for Foo {} diff --git a/src/test/rustdoc/sort-modules-by-appearance.rs b/src/test/rustdoc/sort-modules-by-appearance.rs new file mode 100644 index 0000000000..abffe6fb95 --- /dev/null +++ b/src/test/rustdoc/sort-modules-by-appearance.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Tests the rustdoc --sort-modules-by-appearance option, that allows module declarations to appear +// in the order they are declared in the source code, rather than only alphabetically. + +// compile-flags: -Z unstable-options --sort-modules-by-appearance + +pub mod module_b {} + +pub mod module_c {} + +pub mod module_a {} + +// @matches 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a' +// @matches 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"' diff --git a/src/test/rustdoc/where-sized.rs b/src/test/rustdoc/where-sized.rs new file mode 100644 index 0000000000..c175c839c0 --- /dev/null +++ b/src/test/rustdoc/where-sized.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +// @has foo/fn.foo.html +// @has - '//*[@class="rust fn"]' 'pub fn foo<X, Y: ?Sized>(_: &X)' +// @has - '//*[@class="rust fn"]' 'where X: ?Sized,' +pub fn foo<X, Y: ?Sized>(_: &X) where X: ?Sized {} diff --git a/src/test/ui-fulldeps/custom-derive/issue-36935.rs b/src/test/ui-fulldeps/custom-derive/issue-36935.rs index 2231c3c242..4fd8763206 100644 --- a/src/test/ui-fulldeps/custom-derive/issue-36935.rs +++ b/src/test/ui-fulldeps/custom-derive/issue-36935.rs @@ -15,7 +15,7 @@ #[macro_use] extern crate plugin; -#[derive(Foo, Bar)] +#[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked struct Baz { a: i32, b: i32, diff --git a/src/test/ui-fulldeps/custom-derive/issue-36935.stderr b/src/test/ui-fulldeps/custom-derive/issue-36935.stderr index 46cc7a42b0..55848c6553 100644 --- a/src/test/ui-fulldeps/custom-derive/issue-36935.stderr +++ b/src/test/ui-fulldeps/custom-derive/issue-36935.stderr @@ -1,7 +1,7 @@ error: proc-macro derive panicked --> $DIR/issue-36935.rs:18:15 | -18 | #[derive(Foo, Bar)] +18 | #[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked | ^^^ | = help: message: lolnope diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs similarity index 87% rename from src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs rename to src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs index 75a025f064..21b8057431 100644 --- a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs @@ -14,14 +14,11 @@ #![feature(plugin)] #![plugin(lint_plugin_test)] #![forbid(test_lint)] -//~^ NOTE lint level defined here -//~| NOTE `forbid` level set here fn lintme() { } //~ ERROR item is named 'lintme' #[allow(test_lint)] //~^ ERROR allow(test_lint) overruled by outer forbid(test_lint) -//~| NOTE overruled by previous forbid pub fn main() { lintme(); } diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr new file mode 100644 index 0000000000..459be9db57 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -0,0 +1,23 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-attrs.rs:18:1 + | +18 | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-plugin-forbid-attrs.rs:16:11 + | +16 | #![forbid(test_lint)] + | ^^^^^^^^^ + +error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) + --> $DIR/lint-plugin-forbid-attrs.rs:20:9 + | +16 | #![forbid(test_lint)] + | --------- `forbid` level set here +... +20 | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-panic.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs similarity index 100% rename from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-panic.rs rename to src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs diff --git a/src/test/compile-fail-fulldeps/proc-macro/load-panic.rs b/src/test/ui-fulldeps/proc-macro/load-panic.rs similarity index 95% rename from src/test/compile-fail-fulldeps/proc-macro/load-panic.rs rename to src/test/ui-fulldeps/proc-macro/load-panic.rs index c483c048b4..328f398efd 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/load-panic.rs +++ b/src/test/ui-fulldeps/proc-macro/load-panic.rs @@ -15,7 +15,6 @@ extern crate derive_panic; #[derive(A)] //~^ ERROR: proc-macro derive panicked -//~| HELP: message: nope! struct Foo; fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/load-panic.stderr b/src/test/ui-fulldeps/proc-macro/load-panic.stderr new file mode 100644 index 0000000000..1be1609d45 --- /dev/null +++ b/src/test/ui-fulldeps/proc-macro/load-panic.stderr @@ -0,0 +1,8 @@ +error: proc-macro derive panicked + --> $DIR/load-panic.rs:16:10 + | +16 | #[derive(A)] + | ^ + | + = help: message: nope! + diff --git a/src/test/compile-fail-fulldeps/proc-macro/signature.rs b/src/test/ui-fulldeps/proc-macro/signature.rs similarity index 82% rename from src/test/compile-fail-fulldeps/proc-macro/signature.rs rename to src/test/ui-fulldeps/proc-macro/signature.rs index e249c9e9aa..f2ea6f778c 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/signature.rs +++ b/src/test/ui-fulldeps/proc-macro/signature.rs @@ -16,7 +16,5 @@ extern crate proc_macro; #[proc_macro_derive(A)] pub unsafe extern fn foo(a: i32, b: u32) -> u32 { //~^ ERROR: mismatched types - //~| NOTE: expected normal fn, found unsafe fn - //~| NOTE: expected type `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` loop {} } diff --git a/src/test/ui-fulldeps/proc-macro/signature.stderr b/src/test/ui-fulldeps/proc-macro/signature.stderr new file mode 100644 index 0000000000..2beb0aac86 --- /dev/null +++ b/src/test/ui-fulldeps/proc-macro/signature.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/signature.rs:17:1 + | +17 | / pub unsafe extern fn foo(a: i32, b: u32) -> u32 { +18 | | //~^ ERROR: mismatched types +19 | | loop {} +20 | | } + | |_^ expected normal fn, found unsafe fn + | + = note: expected type `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found type `unsafe extern "C" fn(i32, u32) -> u32 {foo}` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.rs b/src/test/ui-fulldeps/proc-macro/three-equals.rs index 016e05c51f..ef2d160529 100644 --- a/src/test/ui-fulldeps/proc-macro/three-equals.rs +++ b/src/test/ui-fulldeps/proc-macro/three-equals.rs @@ -22,17 +22,17 @@ fn main() { three_equals!(===); // Need exactly three equals. - three_equals!(==); + three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 // Need exactly three equals. - three_equals!(=====); + three_equals!(=====); //~ ERROR expected EOF // Only equals accepted. - three_equals!(abc); + three_equals!(abc); //~ ERROR expected `=` // Only equals accepted. - three_equals!(!!); + three_equals!(!!); //~ ERROR expected `=` // Only three characters expected. - three_equals!(===a); + three_equals!(===a); //~ ERROR expected EOF } diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.stderr b/src/test/ui-fulldeps/proc-macro/three-equals.stderr index 1afe0be280..0ffaf16107 100644 --- a/src/test/ui-fulldeps/proc-macro/three-equals.stderr +++ b/src/test/ui-fulldeps/proc-macro/three-equals.stderr @@ -1,7 +1,7 @@ error: found 2 equal signs, need exactly 3 --> $DIR/three-equals.rs:25:5 | -25 | three_equals!(==); +25 | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 | ^^^^^^^^^^^^^^^^^^ | = help: input must be: `===` @@ -9,38 +9,38 @@ error: found 2 equal signs, need exactly 3 error: expected EOF, found `=`. --> $DIR/three-equals.rs:28:21 | -28 | three_equals!(=====); +28 | three_equals!(=====); //~ ERROR expected EOF | ^^ | note: last good input was here --> $DIR/three-equals.rs:28:21 | -28 | three_equals!(=====); +28 | three_equals!(=====); //~ ERROR expected EOF | ^^ = help: input must be: `===` error: expected `=`, found `abc`. --> $DIR/three-equals.rs:31:19 | -31 | three_equals!(abc); +31 | three_equals!(abc); //~ ERROR expected `=` | ^^^ error: expected `=`, found `!`. --> $DIR/three-equals.rs:34:19 | -34 | three_equals!(!!); +34 | three_equals!(!!); //~ ERROR expected `=` | ^ error: expected EOF, found `a`. --> $DIR/three-equals.rs:37:22 | -37 | three_equals!(===a); +37 | three_equals!(===a); //~ ERROR expected EOF | ^ | note: last good input was here --> $DIR/three-equals.rs:37:21 | -37 | three_equals!(===a); +37 | three_equals!(===a); //~ ERROR expected EOF | ^ = help: input must be: `===` diff --git a/src/test/ui-fulldeps/resolve-error.rs b/src/test/ui-fulldeps/resolve-error.rs index dfaa1d7a32..ae94a7f13e 100644 --- a/src/test/ui-fulldeps/resolve-error.rs +++ b/src/test/ui-fulldeps/resolve-error.rs @@ -35,29 +35,39 @@ macro_rules! attr_proc_mac { } #[derive(FooWithLongNan)] +//~^ ERROR cannot find struct Foo; #[attr_proc_macra] +//~^ ERROR cannot find struct Bar; #[FooWithLongNan] +//~^ ERROR cannot find struct Asdf; #[derive(Dlone)] +//~^ ERROR cannot find struct A; #[derive(Dlona)] +//~^ ERROR cannot find struct B; #[derive(attr_proc_macra)] +//~^ ERROR cannot find struct C; fn main() { FooWithLongNama!(); + //~^ ERROR cannot find attr_proc_macra!(); + //~^ ERROR cannot find Dlona!(); + //~^ ERROR cannot find bang_proc_macrp!(); + //~^ ERROR cannot find } diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui-fulldeps/resolve-error.stderr index 754f6bc4f1..be7ebae70a 100644 --- a/src/test/ui-fulldeps/resolve-error.stderr +++ b/src/test/ui-fulldeps/resolve-error.stderr @@ -5,57 +5,57 @@ error: cannot find derive macro `FooWithLongNan` in this scope | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` error: cannot find attribute macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:40:3 + --> $DIR/resolve-error.rs:41:3 | -40 | #[attr_proc_macra] +41 | #[attr_proc_macra] | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro` error: cannot find attribute macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:43:3 + --> $DIR/resolve-error.rs:45:3 | -43 | #[FooWithLongNan] +45 | #[FooWithLongNan] | ^^^^^^^^^^^^^^ error: cannot find derive macro `Dlone` in this scope - --> $DIR/resolve-error.rs:46:10 + --> $DIR/resolve-error.rs:49:10 | -46 | #[derive(Dlone)] +49 | #[derive(Dlone)] | ^^^^^ help: try: `Clone` error: cannot find derive macro `Dlona` in this scope - --> $DIR/resolve-error.rs:49:10 + --> $DIR/resolve-error.rs:53:10 | -49 | #[derive(Dlona)] +53 | #[derive(Dlona)] | ^^^^^ help: try: `Clona` error: cannot find derive macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:52:10 + --> $DIR/resolve-error.rs:57:10 | -52 | #[derive(attr_proc_macra)] +57 | #[derive(attr_proc_macra)] | ^^^^^^^^^^^^^^^ error: cannot find macro `FooWithLongNama!` in this scope - --> $DIR/resolve-error.rs:56:5 + --> $DIR/resolve-error.rs:62:5 | -56 | FooWithLongNama!(); +62 | FooWithLongNama!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!` error: cannot find macro `attr_proc_macra!` in this scope - --> $DIR/resolve-error.rs:58:5 + --> $DIR/resolve-error.rs:65:5 | -58 | attr_proc_macra!(); +65 | attr_proc_macra!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!` error: cannot find macro `Dlona!` in this scope - --> $DIR/resolve-error.rs:60:5 + --> $DIR/resolve-error.rs:68:5 | -60 | Dlona!(); +68 | Dlona!(); | ^^^^^ error: cannot find macro `bang_proc_macrp!` in this scope - --> $DIR/resolve-error.rs:62:5 + --> $DIR/resolve-error.rs:71:5 | -62 | bang_proc_macrp!(); +71 | bang_proc_macrp!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!` error: aborting due to 10 previous errors diff --git a/src/test/ui-fulldeps/update-all-references.sh b/src/test/ui-fulldeps/update-all-references.sh new file mode 100644 index 0000000000..bfc6f923f9 --- /dev/null +++ b/src/test/ui-fulldeps/update-all-references.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# Copyright 2015 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# A script to update the references for all tests. The idea is that +# you do a run, which will generate files in the build directory +# containing the (normalized) actual output of the compiler. You then +# run this script, which will copy those files over. If you find +# yourself manually editing a foo.stderr file, you're doing it wrong. +# +# See all `update-references.sh`, if you just want to update a single test. + +if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" != "" ]]; then + echo "usage: $0 <build-directory>" + echo "" + echo "For example:" + echo " $0 ../../../build/x86_64-apple-darwin/test/ui" +fi + +BUILD_DIR=$PWD/$1 +MY_DIR=$(dirname $0) +cd $MY_DIR +find . -name '*.rs' | xargs ./update-references.sh $BUILD_DIR diff --git a/src/test/ui-fulldeps/update-references.sh b/src/test/ui-fulldeps/update-references.sh new file mode 100644 index 0000000000..c2c842fcc4 --- /dev/null +++ b/src/test/ui-fulldeps/update-references.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# Copyright 2015 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# A script to update the references for particular tests. The idea is +# that you do a run, which will generate files in the build directory +# containing the (normalized) actual output of the compiler. This +# script will then copy that output and replace the "expected output" +# files. You can then commit the changes. +# +# If you find yourself manually editing a foo.stderr file, you're +# doing it wrong. + +if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then + echo "usage: $0 <build-directory> <relative-path-to-rs-files>" + echo "" + echo "For example:" + echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs" +fi + +MYDIR=$(dirname $0) + +BUILD_DIR="$1" +shift + +while [[ "$1" != "" ]]; do + STDERR_NAME="${1/%.rs/.stderr}" + STDOUT_NAME="${1/%.rs/.stdout}" + shift + if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ + ! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then + echo updating $MYDIR/$STDOUT_NAME + cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME + fi + if [ -f $BUILD_DIR/$STDERR_NAME ] && \ + ! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then + echo updating $MYDIR/$STDERR_NAME + cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME + fi +done diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.rs b/src/test/ui/anonymous-higher-ranked-lifetime.rs index f2d04c16d9..295e3d1a73 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.rs +++ b/src/test/ui/anonymous-higher-ranked-lifetime.rs @@ -9,17 +9,17 @@ // except according to those terms. fn main() { - f1(|_: (), _: ()| {}); - f2(|_: (), _: ()| {}); - f3(|_: (), _: ()| {}); - f4(|_: (), _: ()| {}); - f5(|_: (), _: ()| {}); - g1(|_: (), _: ()| {}); - g2(|_: (), _: ()| {}); - g3(|_: (), _: ()| {}); - g4(|_: (), _: ()| {}); - h1(|_: (), _: (), _: (), _: ()| {}); - h2(|_: (), _: (), _: (), _: ()| {}); + f1(|_: (), _: ()| {}); //~ ERROR type mismatch + f2(|_: (), _: ()| {}); //~ ERROR type mismatch + f3(|_: (), _: ()| {}); //~ ERROR type mismatch + f4(|_: (), _: ()| {}); //~ ERROR type mismatch + f5(|_: (), _: ()| {}); //~ ERROR type mismatch + g1(|_: (), _: ()| {}); //~ ERROR type mismatch + g2(|_: (), _: ()| {}); //~ ERROR type mismatch + g3(|_: (), _: ()| {}); //~ ERROR type mismatch + g4(|_: (), _: ()| {}); //~ ERROR type mismatch + h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch + h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch } // Basic diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index f962b77220..e364a4d8b1 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -1,8 +1,8 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | -12 | f1(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +12 | f1(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _` | @@ -11,8 +11,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:13:5 | -13 | f2(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +13 | f2(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _` | @@ -21,8 +21,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 | -14 | f3(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +14 | f3(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&(), &'r ()) -> _` | @@ -31,8 +31,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:15:5 | -15 | f4(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +15 | f4(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _` | @@ -41,8 +41,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 | -16 | f5(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +16 | f5(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), &'r ()) -> _` | @@ -51,8 +51,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:17:5 | -17 | g1(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +17 | g1(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _` | @@ -61,8 +61,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 | -18 | g2(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +18 | g2(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _` | @@ -71,8 +71,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:19:5 | -19 | g3(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +19 | g3(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _` | @@ -81,8 +81,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 | -20 | g4(|_: (), _: ()| {}); - | ^^ ----------------- found signature of `fn((), ()) -> _` +20 | g4(|_: (), _: ()| {}); //~ ERROR type mismatch + | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` | @@ -91,8 +91,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:21:5 | -21 | h1(|_: (), _: (), _: (), _: ()| {}); - | ^^ ------------------------------- found signature of `fn((), (), (), ()) -> _` +21 | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch + | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _` | @@ -101,8 +101,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 | -22 | h2(|_: (), _: (), _: (), _: ()| {}); - | ^^ ------------------------------- found signature of `fn((), (), (), ()) -> _` +22 | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch + | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _` | diff --git a/src/test/compile-fail/arbitrary-self-types-not-object-safe.rs b/src/test/ui/arbitrary-self-types-not-object-safe.rs similarity index 77% rename from src/test/compile-fail/arbitrary-self-types-not-object-safe.rs rename to src/test/ui/arbitrary-self-types-not-object-safe.rs index 6b10739bd8..48918b996e 100644 --- a/src/test/compile-fail/arbitrary-self-types-not-object-safe.rs +++ b/src/test/ui/arbitrary-self-types-not-object-safe.rs @@ -39,12 +39,7 @@ impl Bar for usize { fn make_foo() { let x = Box::new(5usize) as Box<Foo>; //~^ ERROR E0038 - //~| NOTE method `foo` has a non-standard `self` type - //~| NOTE the trait `Foo` cannot be made into an object //~| ERROR E0038 - //~| NOTE method `foo` has a non-standard `self` type - //~| NOTE the trait `Foo` cannot be made into an object - //~| NOTE requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` } fn make_bar() { diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/arbitrary-self-types-not-object-safe.stderr new file mode 100644 index 0000000000..f258488ee2 --- /dev/null +++ b/src/test/ui/arbitrary-self-types-not-object-safe.stderr @@ -0,0 +1,19 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/arbitrary-self-types-not-object-safe.rs:40:33 + | +40 | let x = Box::new(5usize) as Box<Foo>; + | ^^^^^^^^ the trait `Foo` cannot be made into an object + | + = note: method `foo` has a non-standard `self` type + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/arbitrary-self-types-not-object-safe.rs:40:13 + | +40 | let x = Box::new(5usize) as Box<Foo>; + | ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object + | + = note: method `foo` has a non-standard `self` type + = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/ui/asm-out-assign-imm.rs similarity index 92% rename from src/test/compile-fail/asm-out-assign-imm.rs rename to src/test/ui/asm-out-assign-imm.rs index f2629fa52f..49084e01a1 100644 --- a/src/test/compile-fail/asm-out-assign-imm.rs +++ b/src/test/ui/asm-out-assign-imm.rs @@ -23,12 +23,11 @@ fn foo(x: isize) { println!("{}", x); } target_arch = "aarch64"))] pub fn main() { let x: isize; - x = 1; //~ NOTE first assignment + x = 1; foo(x); unsafe { asm!("mov $1, $0" : "=r"(x) : "r"(5)); //~^ ERROR cannot assign twice to immutable variable `x` - //~| NOTE cannot assign twice to immutable } foo(x); } diff --git a/src/test/ui/asm-out-assign-imm.stderr b/src/test/ui/asm-out-assign-imm.stderr new file mode 100644 index 0000000000..cf5486fec5 --- /dev/null +++ b/src/test/ui/asm-out-assign-imm.stderr @@ -0,0 +1,11 @@ +error[E0384]: cannot assign twice to immutable variable `x` + --> $DIR/asm-out-assign-imm.rs:29:9 + | +26 | x = 1; + | ----- first assignment to `x` +... +29 | asm!("mov $1, $0" : "=r"(x) : "r"(5)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs b/src/test/ui/associated-const-impl-wrong-lifetime.rs similarity index 77% rename from src/test/compile-fail/associated-const-impl-wrong-lifetime.rs rename to src/test/ui/associated-const-impl-wrong-lifetime.rs index 51681a4bb8..77653b27fb 100644 --- a/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs +++ b/src/test/ui/associated-const-impl-wrong-lifetime.rs @@ -15,12 +15,8 @@ trait Foo { impl<'a> Foo for &'a () { -//~^ NOTE the lifetime 'a as defined const NAME: &'a str = "unit"; //~^ ERROR mismatched types [E0308] - //~| NOTE lifetime mismatch - //~| NOTE expected type `&'static str` - //~| NOTE ...does not necessarily outlive the static lifetime } fn main() {} diff --git a/src/test/ui/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-const-impl-wrong-lifetime.stderr new file mode 100644 index 0000000000..a7aee9b19f --- /dev/null +++ b/src/test/ui/associated-const-impl-wrong-lifetime.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/associated-const-impl-wrong-lifetime.rs:18:5 + | +18 | const NAME: &'a str = "unit"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `&'static str` + found type `&'a str` +note: the lifetime 'a as defined on the impl at 17:1... + --> $DIR/associated-const-impl-wrong-lifetime.rs:17:1 + | +17 | / impl<'a> Foo for &'a () { +18 | | const NAME: &'a str = "unit"; +19 | | //~^ ERROR mismatched types [E0308] +20 | | } + | |_^ + = note: ...does not necessarily outlive the static lifetime + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-const-impl-wrong-type.rs b/src/test/ui/associated-const-impl-wrong-type.rs similarity index 88% rename from src/test/compile-fail/associated-const-impl-wrong-type.rs rename to src/test/ui/associated-const-impl-wrong-type.rs index e38851ccd6..240dfd1609 100644 --- a/src/test/compile-fail/associated-const-impl-wrong-type.rs +++ b/src/test/ui/associated-const-impl-wrong-type.rs @@ -10,7 +10,7 @@ trait Foo { - const BAR: u32; //~ NOTE type in trait + const BAR: u32; } struct SignedBar; @@ -18,7 +18,6 @@ struct SignedBar; impl Foo for SignedBar { const BAR: i32 = -1; //~^ ERROR implemented const `BAR` has an incompatible type for trait [E0326] - //~| NOTE expected u32, found i32 } fn main() {} diff --git a/src/test/ui/associated-const-impl-wrong-type.stderr b/src/test/ui/associated-const-impl-wrong-type.stderr new file mode 100644 index 0000000000..a2afe905cb --- /dev/null +++ b/src/test/ui/associated-const-impl-wrong-type.stderr @@ -0,0 +1,11 @@ +error[E0326]: implemented const `BAR` has an incompatible type for trait + --> $DIR/associated-const-impl-wrong-type.rs:19:16 + | +13 | const BAR: u32; + | --- type in trait +... +19 | const BAR: i32 = -1; + | ^^^ expected u32, found i32 + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type-projection-from-multiple-supertraits.rs similarity index 71% rename from src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs rename to src/test/ui/associated-type-projection-from-multiple-supertraits.rs index b33bbfd842..5536566c61 100644 --- a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/ui/associated-type-projection-from-multiple-supertraits.rs @@ -13,18 +13,12 @@ pub trait Vehicle { type Color; - //~^ NOTE ambiguous `Color` from `Vehicle` - //~| NOTE ambiguous `Color` from `Vehicle` - //~| NOTE ambiguous `Color` from `Vehicle` fn go(&self) { } } pub trait Box { type Color; - //~^ NOTE ambiguous `Color` from `Box` - //~| NOTE ambiguous `Color` from `Box` - //~| NOTE ambiguous `Color` from `Box` // fn mail(&self) { } } @@ -34,19 +28,15 @@ pub trait BoxCar : Box + Vehicle { fn dent<C:BoxCar>(c: C, color: C::Color) { //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE ambiguous associated type `Color` } fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) { //~^ ERROR ambiguous associated type //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified - //~| NOTE ambiguous associated type `Color` - //~| NOTE missing associated type `Color` value } fn paint<C:BoxCar>(c: C, d: C::Color) { //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE ambiguous associated type `Color` } pub fn main() { } diff --git a/src/test/ui/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type-projection-from-multiple-supertraits.stderr new file mode 100644 index 0000000000..6215c1dc08 --- /dev/null +++ b/src/test/ui/associated-type-projection-from-multiple-supertraits.stderr @@ -0,0 +1,44 @@ +error[E0221]: ambiguous associated type `Color` in bounds of `C` + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:29:32 + | +15 | type Color; + | ----------- ambiguous `Color` from `Vehicle` +... +21 | type Color; + | ----------- ambiguous `Color` from `Box` +... +29 | fn dent<C:BoxCar>(c: C, color: C::Color) { + | ^^^^^^^^ ambiguous associated type `Color` + +error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar` + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:33 + | +15 | type Color; + | ----------- ambiguous `Color` from `Vehicle` +... +21 | type Color; + | ----------- ambiguous `Color` from `Box` +... +33 | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) { + | ^^^^^^^^^^^ ambiguous associated type `Color` + +error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:26 + | +33 | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) { + | ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value + +error[E0221]: ambiguous associated type `Color` in bounds of `C` + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:38:29 + | +15 | type Color; + | ----------- ambiguous `Color` from `Vehicle` +... +21 | type Color; + | ----------- ambiguous `Color` from `Box` +... +38 | fn paint<C:BoxCar>(c: C, d: C::Color) { + | ^^^^^^^^ ambiguous associated type `Color` + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs similarity index 93% rename from src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs rename to src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs index 74a388e726..75b60aa8d1 100644 --- a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs +++ b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs @@ -32,5 +32,4 @@ fn ice<A>(a: A) { let r = loop {}; r = r + a; //~^ ERROR the trait bound `(): Add<A>` is not satisfied - //~| NOTE the trait `Add<A>` is not implemented for `()` } diff --git a/src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr new file mode 100644 index 0000000000..1a49cc7a28 --- /dev/null +++ b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr @@ -0,0 +1,8 @@ +error[E0277]: the trait bound `(): Add<A>` is not satisfied + --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:33:11 + | +33 | r = r + a; + | ^ the trait `Add<A>` is not implemented for `()` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-types-in-ambiguous-context.rs b/src/test/ui/associated-types-in-ambiguous-context.rs similarity index 71% rename from src/test/compile-fail/associated-types-in-ambiguous-context.rs rename to src/test/ui/associated-types-in-ambiguous-context.rs index ff886e63dc..becbc27138 100644 --- a/src/test/compile-fail/associated-types-in-ambiguous-context.rs +++ b/src/test/ui/associated-types-in-ambiguous-context.rs @@ -15,21 +15,15 @@ trait Get { fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {} //~^ ERROR ambiguous associated type -//~| NOTE ambiguous associated type -//~| NOTE specify the type using the syntax `<Type as Get>::Value` trait Grab { type Value; fn grab(&self) -> Grab::Value; //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<Type as Grab>::Value` } type X = std::ops::Deref::Target; //~^ ERROR ambiguous associated type -//~| NOTE ambiguous associated type -//~| NOTE specify the type using the syntax `<Type as std::ops::Deref>::Target` fn main() { } diff --git a/src/test/ui/associated-types-in-ambiguous-context.stderr b/src/test/ui/associated-types-in-ambiguous-context.stderr new file mode 100644 index 0000000000..b0196234bd --- /dev/null +++ b/src/test/ui/associated-types-in-ambiguous-context.stderr @@ -0,0 +1,26 @@ +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:16:36 + | +16 | fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {} + | ^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<Type as Get>::Value` + +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:25:10 + | +25 | type X = std::ops::Deref::Target; + | ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<Type as std::ops::Deref>::Target` + +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:21:23 + | +21 | fn grab(&self) -> Grab::Value; + | ^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<Type as Grab>::Value` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/augmented-assignments.rs b/src/test/ui/augmented-assignments.rs similarity index 94% rename from src/test/compile-fail/augmented-assignments.rs rename to src/test/ui/augmented-assignments.rs index 736aa465aa..82f5c49eeb 100644 --- a/src/test/compile-fail/augmented-assignments.rs +++ b/src/test/ui/augmented-assignments.rs @@ -22,7 +22,6 @@ fn main() { let mut x = Int(1); x //~ error: use of moved value: `x` //~^ value used here after move - //~| note: move occurs because `x` has type `Int` += x; //~ value moved here diff --git a/src/test/ui/augmented-assignments.stderr b/src/test/ui/augmented-assignments.stderr new file mode 100644 index 0000000000..0367270d16 --- /dev/null +++ b/src/test/ui/augmented-assignments.stderr @@ -0,0 +1,22 @@ +error[E0596]: cannot borrow immutable local variable `y` as mutable + --> $DIR/augmented-assignments.rs:30:5 + | +28 | let y = Int(2); + | - consider changing this to `mut y` +29 | //~^ consider changing this to `mut y` +30 | y //~ error: cannot borrow immutable local variable `y` as mutable + | ^ cannot borrow mutably + +error[E0382]: use of moved value: `x` + --> $DIR/augmented-assignments.rs:23:5 + | +23 | x //~ error: use of moved value: `x` + | ^ value used here after move +... +26 | x; //~ value moved here + | - value moved here + | + = note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/auxiliary/cfg-target-thread-local.rs b/src/test/ui/auxiliary/cfg-target-thread-local.rs similarity index 100% rename from src/test/compile-fail/auxiliary/cfg-target-thread-local.rs rename to src/test/ui/auxiliary/cfg-target-thread-local.rs diff --git a/src/test/compile-fail/auxiliary/changing-crates-a1.rs b/src/test/ui/auxiliary/changing-crates-a1.rs similarity index 100% rename from src/test/compile-fail/auxiliary/changing-crates-a1.rs rename to src/test/ui/auxiliary/changing-crates-a1.rs diff --git a/src/test/compile-fail/auxiliary/changing-crates-a2.rs b/src/test/ui/auxiliary/changing-crates-a2.rs similarity index 100% rename from src/test/compile-fail/auxiliary/changing-crates-a2.rs rename to src/test/ui/auxiliary/changing-crates-a2.rs diff --git a/src/test/compile-fail/auxiliary/changing-crates-b.rs b/src/test/ui/auxiliary/changing-crates-b.rs similarity index 100% rename from src/test/compile-fail/auxiliary/changing-crates-b.rs rename to src/test/ui/auxiliary/changing-crates-b.rs diff --git a/src/tools/miri/tests/run-pass/unique-send.rs b/src/test/ui/auxiliary/coherence_lib.rs similarity index 69% rename from src/tools/miri/tests/run-pass/unique-send.rs rename to src/test/ui/auxiliary/coherence_lib.rs index 7644da08e4..daa123849e 100644 --- a/src/tools/miri/tests/run-pass/unique-send.rs +++ b/src/test/ui/auxiliary/coherence_lib.rs @@ -8,13 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax)] +#![crate_type="lib"] -use std::sync::mpsc::channel; - -pub fn main() { - let (tx, rx) = channel::<Box<_>>(); - tx.send(box 100).unwrap(); - let v = rx.recv().unwrap(); - assert_eq!(v, box 100); +pub trait Remote { + fn foo(&self) { } } + +pub trait Remote1<T> { + fn foo(&self, t: T) { } +} + +pub trait Remote2<T, U> { + fn foo(&self, t: T, u: U) { } +} + +pub struct Pair<T,U>(T,U); diff --git a/src/tools/miri/tests/compile-fail/overflowing-lsh-neg.rs b/src/test/ui/auxiliary/empty-struct.rs similarity index 79% rename from src/tools/miri/tests/compile-fail/overflowing-lsh-neg.rs rename to src/test/ui/auxiliary/empty-struct.rs index 3a889be741..4a30286563 100644 --- a/src/tools/miri/tests/compile-fail/overflowing-lsh-neg.rs +++ b/src/test/ui/auxiliary/empty-struct.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(exceeding_bitshifts)] -#![allow(const_err)] +pub struct XEmpty1 {} +pub struct XEmpty2; +pub struct XEmpty6(); -fn main() { - let _n = 2i64 << -1; //~ Overflow(Shl) +pub enum XE { + XEmpty3 {}, + XEmpty4, + XEmpty5(), } diff --git a/src/test/compile-fail/auxiliary/issue-36708.rs b/src/test/ui/auxiliary/issue-36708.rs similarity index 100% rename from src/test/compile-fail/auxiliary/issue-36708.rs rename to src/test/ui/auxiliary/issue-36708.rs diff --git a/src/test/run-pass/svh-add-doc.rs b/src/test/ui/auxiliary/lint_output_format.rs similarity index 51% rename from src/test/run-pass/svh-add-doc.rs rename to src/test/ui/auxiliary/lint_output_format.rs index ea07ebe364..0553b4a49b 100644 --- a/src/test/run-pass/svh-add-doc.rs +++ b/src/test/ui/auxiliary/lint_output_format.rs @@ -8,16 +8,23 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-doc.rs +#![crate_name="lint_output_format"] +#![crate_type = "lib"] +#![feature(staged_api)] +#![unstable(feature = "test_feature", issue = "0")] -// pretty-expanded FIXME #23616 - -extern crate a; -extern crate b; - -fn main() { - b::foo() +#[stable(feature = "test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn foo() -> usize { + 20 +} + +#[unstable(feature = "test_feature", issue = "0")] +pub fn bar() -> usize { + 40 +} + +#[unstable(feature = "test_feature", issue = "0")] +pub fn baz() -> usize { + 30 } diff --git a/src/test/ui/auxiliary/struct_field_privacy.rs b/src/test/ui/auxiliary/struct_field_privacy.rs new file mode 100644 index 0000000000..5fea97da03 --- /dev/null +++ b/src/test/ui/auxiliary/struct_field_privacy.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct A { + a: isize, + pub b: isize, +} + +pub struct B { + pub a: isize, + b: isize, +} diff --git a/src/test/compile-fail/auxiliary/svh-a-base.rs b/src/test/ui/auxiliary/svh-a-base.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-base.rs rename to src/test/ui/auxiliary/svh-a-base.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-lit.rs b/src/test/ui/auxiliary/svh-a-change-lit.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-lit.rs rename to src/test/ui/auxiliary/svh-a-change-lit.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-significant-cfg.rs b/src/test/ui/auxiliary/svh-a-change-significant-cfg.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-significant-cfg.rs rename to src/test/ui/auxiliary/svh-a-change-significant-cfg.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-trait-bound.rs b/src/test/ui/auxiliary/svh-a-change-trait-bound.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-trait-bound.rs rename to src/test/ui/auxiliary/svh-a-change-trait-bound.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-arg.rs b/src/test/ui/auxiliary/svh-a-change-type-arg.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-type-arg.rs rename to src/test/ui/auxiliary/svh-a-change-type-arg.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-ret.rs b/src/test/ui/auxiliary/svh-a-change-type-ret.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-type-ret.rs rename to src/test/ui/auxiliary/svh-a-change-type-ret.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-static.rs b/src/test/ui/auxiliary/svh-a-change-type-static.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-type-static.rs rename to src/test/ui/auxiliary/svh-a-change-type-static.rs diff --git a/src/test/compile-fail/auxiliary/svh-b.rs b/src/test/ui/auxiliary/svh-b.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-b.rs rename to src/test/ui/auxiliary/svh-b.rs diff --git a/src/test/compile-fail/auxiliary/svh-uta-base.rs b/src/test/ui/auxiliary/svh-uta-base.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-uta-base.rs rename to src/test/ui/auxiliary/svh-uta-base.rs diff --git a/src/test/compile-fail/auxiliary/svh-uta-change-use-trait.rs b/src/test/ui/auxiliary/svh-uta-change-use-trait.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-uta-change-use-trait.rs rename to src/test/ui/auxiliary/svh-uta-change-use-trait.rs diff --git a/src/test/compile-fail/auxiliary/svh-utb.rs b/src/test/ui/auxiliary/svh-utb.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-utb.rs rename to src/test/ui/auxiliary/svh-utb.rs diff --git a/src/test/run-pass/issue-21410.rs b/src/test/ui/auxiliary/two_macros.rs similarity index 80% rename from src/test/run-pass/issue-21410.rs rename to src/test/ui/auxiliary/two_macros.rs index bc525ba54c..060960f0db 100644 --- a/src/test/run-pass/issue-21410.rs +++ b/src/test/ui/auxiliary/two_macros.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn g<F>(_: F) where F: FnOnce(Option<F>) {} +#[macro_export] +macro_rules! macro_one { () => ("one") } -fn main() { - g(|_| { }); -} +#[macro_export] +macro_rules! macro_two { () => ("two") } diff --git a/src/test/compile-fail/binary-op-on-double-ref.rs b/src/test/ui/binary-op-on-double-ref.rs similarity index 80% rename from src/test/compile-fail/binary-op-on-double-ref.rs rename to src/test/ui/binary-op-on-double-ref.rs index 23ca026f54..8b31be911b 100644 --- a/src/test/compile-fail/binary-op-on-double-ref.rs +++ b/src/test/ui/binary-op-on-double-ref.rs @@ -13,8 +13,6 @@ fn main() { let vr = v.iter().filter(|x| { x % 2 == 0 //~^ ERROR binary operation `%` cannot be applied to type `&&{integer}` - //~| NOTE this is a reference to a type that `%` can be applied to - //~| NOTE an implementation of `std::ops::Rem` might be missing for `&&{integer}` }); println!("{:?}", vr); } diff --git a/src/test/ui/binary-op-on-double-ref.stderr b/src/test/ui/binary-op-on-double-ref.stderr new file mode 100644 index 0000000000..4a2490bac9 --- /dev/null +++ b/src/test/ui/binary-op-on-double-ref.stderr @@ -0,0 +1,11 @@ +error[E0369]: binary operation `%` cannot be applied to type `&&{integer}` + --> $DIR/binary-op-on-double-ref.rs:14:9 + | +14 | x % 2 == 0 + | ^^^^^ + | + = note: this is a reference to a type that `%` can be applied to; you need to dereference this variable once for this operation to work + = note: an implementation of `std::ops::Rem` might be missing for `&&{integer}` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/blind-item-item-shadow.rs b/src/test/ui/blind-item-item-shadow.rs similarity index 78% rename from src/test/compile-fail/blind-item-item-shadow.rs rename to src/test/ui/blind-item-item-shadow.rs index af3abe5e05..38f9a552e1 100644 --- a/src/test/compile-fail/blind-item-item-shadow.rs +++ b/src/test/ui/blind-item-item-shadow.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -mod foo { pub mod foo { } } //~ NOTE previous definition of the module `foo` here +mod foo { pub mod foo { } } use foo::foo; //~^ ERROR the name `foo` is defined multiple times //~| `foo` reimported here -//~| NOTE `foo` must be defined only once in the type namespace of this module fn main() {} diff --git a/src/test/ui/blind-item-item-shadow.stderr b/src/test/ui/blind-item-item-shadow.stderr new file mode 100644 index 0000000000..855b3799eb --- /dev/null +++ b/src/test/ui/blind-item-item-shadow.stderr @@ -0,0 +1,17 @@ +error[E0255]: the name `foo` is defined multiple times + --> $DIR/blind-item-item-shadow.rs:13:5 + | +11 | mod foo { pub mod foo { } } + | ------- previous definition of the module `foo` here +12 | +13 | use foo::foo; + | ^^^^^^^^ `foo` reimported here + | + = note: `foo` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +13 | use foo::foo as Otherfoo; + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/block-result/consider-removing-last-semi.rs b/src/test/ui/block-result/consider-removing-last-semi.rs index 530a0e4156..0d4deb3c80 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.rs +++ b/src/test/ui/block-result/consider-removing-last-semi.rs @@ -10,12 +10,12 @@ fn f() -> String { //~ ERROR mismatched types 0u8; - "bla".to_string(); //~ HELP consider removing this semicolon + "bla".to_string(); } fn g() -> String { //~ ERROR mismatched types "this won't work".to_string(); - "removeme".to_string(); //~ HELP consider removing this semicolon + "removeme".to_string(); } fn main() {} diff --git a/src/test/ui/block-result/consider-removing-last-semi.stderr b/src/test/ui/block-result/consider-removing-last-semi.stderr index 5905cfa932..453f3879f4 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.stderr +++ b/src/test/ui/block-result/consider-removing-last-semi.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types 11 | fn f() -> String { //~ ERROR mismatched types | __________________^ 12 | | 0u8; -13 | | "bla".to_string(); //~ HELP consider removing this semicolon +13 | | "bla".to_string(); | | - help: consider removing this semicolon 14 | | } | |_^ expected struct `std::string::String`, found () @@ -18,7 +18,7 @@ error[E0308]: mismatched types 16 | fn g() -> String { //~ ERROR mismatched types | __________________^ 17 | | "this won't work".to_string(); -18 | | "removeme".to_string(); //~ HELP consider removing this semicolon +18 | | "removeme".to_string(); | | - help: consider removing this semicolon 19 | | } | |_^ expected struct `std::string::String`, found () diff --git a/src/test/ui/block-result/issue-11714.rs b/src/test/ui/block-result/issue-11714.rs index 192f78e41c..bc3936582a 100644 --- a/src/test/ui/block-result/issue-11714.rs +++ b/src/test/ui/block-result/issue-11714.rs @@ -11,7 +11,7 @@ fn blah() -> i32 { //~ ERROR mismatched types 1 - ; //~ HELP consider removing this semicolon: + ; } fn main() { } diff --git a/src/test/ui/block-result/issue-11714.stderr b/src/test/ui/block-result/issue-11714.stderr index 376834beab..946d180489 100644 --- a/src/test/ui/block-result/issue-11714.stderr +++ b/src/test/ui/block-result/issue-11714.stderr @@ -5,7 +5,7 @@ error[E0308]: mismatched types | __________________^ 12 | | 1 13 | | -14 | | ; //~ HELP consider removing this semicolon: +14 | | ; | | - help: consider removing this semicolon 15 | | } | |_^ expected i32, found () diff --git a/src/test/ui/block-result/issue-13428.rs b/src/test/ui/block-result/issue-13428.rs index 9406199afc..36520301f5 100644 --- a/src/test/ui/block-result/issue-13428.rs +++ b/src/test/ui/block-result/issue-13428.rs @@ -15,12 +15,12 @@ fn foo() -> String { //~ ERROR mismatched types "world") // Put the trailing semicolon on its own line to test that the // note message gets the offending semicolon exactly - ; //~ HELP consider removing this semicolon + ; } fn bar() -> String { //~ ERROR mismatched types "foobar".to_string() - ; //~ HELP consider removing this semicolon + ; } pub fn main() {} diff --git a/src/test/ui/block-result/issue-13428.stderr b/src/test/ui/block-result/issue-13428.stderr index 7bd4529c46..22bbb2aadf 100644 --- a/src/test/ui/block-result/issue-13428.stderr +++ b/src/test/ui/block-result/issue-13428.stderr @@ -7,7 +7,7 @@ error[E0308]: mismatched types 15 | | "world") 16 | | // Put the trailing semicolon on its own line to test that the 17 | | // note message gets the offending semicolon exactly -18 | | ; //~ HELP consider removing this semicolon +18 | | ; | | - help: consider removing this semicolon 19 | | } | |_^ expected struct `std::string::String`, found () @@ -21,7 +21,7 @@ error[E0308]: mismatched types 21 | fn bar() -> String { //~ ERROR mismatched types | ____________________^ 22 | | "foobar".to_string() -23 | | ; //~ HELP consider removing this semicolon +23 | | ; | | - help: consider removing this semicolon 24 | | } | |_^ expected struct `std::string::String`, found () diff --git a/src/test/ui/block-result/issue-3563.rs b/src/test/ui/block-result/issue-3563.rs index 7928c04b9d..31a363a6b8 100644 --- a/src/test/ui/block-result/issue-3563.rs +++ b/src/test/ui/block-result/issue-3563.rs @@ -12,7 +12,6 @@ trait A { fn a(&self) { || self.b() //~^ ERROR no method named `b` found for type `&Self` in the current scope - //~| ERROR mismatched types } } fn main() {} diff --git a/src/test/ui/block-result/issue-3563.stderr b/src/test/ui/block-result/issue-3563.stderr index e3f0df6fb5..c3d5f21b0a 100644 --- a/src/test/ui/block-result/issue-3563.stderr +++ b/src/test/ui/block-result/issue-3563.stderr @@ -6,16 +6,5 @@ error[E0599]: no method named `b` found for type `&Self` in the current scope | = help: did you mean `a`? -error[E0308]: mismatched types - --> $DIR/issue-3563.rs:13:9 - | -12 | fn a(&self) { - | - possibly return type missing here? -13 | || self.b() - | ^^^^^^^^^^^ expected (), found closure - | - = note: expected type `()` - found type `[closure@$DIR/issue-3563.rs:13:9: 13:20 self:_]` - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/ui/block-result/unexpected-return-on-unit.rs b/src/test/ui/block-result/unexpected-return-on-unit.rs index 291b7a16f1..3cf76365c7 100644 --- a/src/test/ui/block-result/unexpected-return-on-unit.rs +++ b/src/test/ui/block-result/unexpected-return-on-unit.rs @@ -16,7 +16,7 @@ fn foo() -> usize { } fn bar() { - foo() + foo() //~ ERROR mismatched types } fn main() { diff --git a/src/test/ui/block-result/unexpected-return-on-unit.stderr b/src/test/ui/block-result/unexpected-return-on-unit.stderr index f052883815..3881bb4625 100644 --- a/src/test/ui/block-result/unexpected-return-on-unit.stderr +++ b/src/test/ui/block-result/unexpected-return-on-unit.stderr @@ -1,14 +1,14 @@ error[E0308]: mismatched types --> $DIR/unexpected-return-on-unit.rs:19:5 | -19 | foo() +19 | foo() //~ ERROR mismatched types | ^^^^^ expected (), found usize | = note: expected type `()` found type `usize` help: try adding a semicolon | -19 | foo(); +19 | foo(); //~ ERROR mismatched types | ^ help: try adding a return type | diff --git a/src/test/compile-fail/bogus-tag.rs b/src/test/ui/bogus-tag.rs similarity index 89% rename from src/test/compile-fail/bogus-tag.rs rename to src/test/ui/bogus-tag.rs index c388d47da6..46536cc857 100644 --- a/src/test/compile-fail/bogus-tag.rs +++ b/src/test/ui/bogus-tag.rs @@ -15,6 +15,7 @@ fn main() { let red: color = color::rgb(255, 0, 0); match red { color::rgb(r, g, b) => { println!("rgb"); } - color::hsl(h, s, l) => { println!("hsl"); } //~ ERROR no function + color::hsl(h, s, l) => { println!("hsl"); } + //~^ ERROR no variant } } diff --git a/src/test/ui/bogus-tag.stderr b/src/test/ui/bogus-tag.stderr new file mode 100644 index 0000000000..49dedcd074 --- /dev/null +++ b/src/test/ui/bogus-tag.stderr @@ -0,0 +1,11 @@ +error[E0599]: no variant named `hsl` found for type `color` in the current scope + --> $DIR/bogus-tag.rs:18:7 + | +12 | enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), } + | ---------- variant `hsl` not found here +... +18 | color::hsl(h, s, l) => { println!("hsl"); } + | ^^^^^^^^^^^^^^^^^^^ variant not found in `color` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs b/src/test/ui/borrowck/borrowck-box-insensitivity.rs similarity index 85% rename from src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs rename to src/test/ui/borrowck/borrowck-box-insensitivity.rs index d09cb73d67..75bf6bce04 100644 --- a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs +++ b/src/test/ui/borrowck/borrowck-box-insensitivity.rs @@ -60,7 +60,6 @@ fn borrow_after_move() { fn move_after_borrow() { let a: Box<_> = box B { x: box 0, y: box 1 }; let _x = &a.x; - //~^ NOTE borrow of `a.x` occurs here let _y = a.y; //~^ ERROR cannot move //~| move out of @@ -69,15 +68,12 @@ fn move_after_borrow() { fn copy_after_mut_borrow() { let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &mut a.x; - //~^ NOTE borrow of `a.x` occurs here let _y = a.y; //~ ERROR cannot use - //~^ NOTE use of borrowed `a.x` } fn move_after_mut_borrow() { let mut a: Box<_> = box B { x: box 0, y: box 1 }; let _x = &mut a.x; - //~^ NOTE borrow of `a.x` occurs here let _y = a.y; //~^ ERROR cannot move //~| move out of @@ -86,27 +82,22 @@ fn move_after_mut_borrow() { fn borrow_after_mut_borrow() { let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &mut a.x; - //~^ NOTE mutable borrow occurs here (via `a.x`) let _y = &a.y; //~ ERROR cannot borrow //~^ immutable borrow occurs here (via `a.y`) } -//~^ NOTE mutable borrow ends here fn mut_borrow_after_borrow() { let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &a.x; - //~^ NOTE immutable borrow occurs here (via `a.x`) let _y = &mut a.y; //~ ERROR cannot borrow //~^ mutable borrow occurs here (via `a.y`) } -//~^ NOTE immutable borrow ends here fn copy_after_move_nested() { let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; let _x = a.x.x; //~^ value moved here let _y = a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>` //~| value used here after move } @@ -115,7 +106,6 @@ fn move_after_move_nested() { let _x = a.x.x; //~^ value moved here let _y = a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>` //~| value used here after move } @@ -124,7 +114,6 @@ fn borrow_after_move_nested() { let _x = a.x.x; //~^ value moved here let _y = &a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>` //~| value used here after move } @@ -140,15 +129,12 @@ fn move_after_borrow_nested() { fn copy_after_mut_borrow_nested() { let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; let _x = &mut a.x.x; - //~^ NOTE borrow of `a.x.x` occurs here let _y = a.y; //~ ERROR cannot use - //~^ NOTE use of borrowed `a.x.x` } fn move_after_mut_borrow_nested() { let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; let _x = &mut a.x.x; - //~^ NOTE borrow of `a.x.x` occurs here let _y = a.y; //~^ ERROR cannot move //~| move out of @@ -161,7 +147,6 @@ fn borrow_after_mut_borrow_nested() { let _y = &a.y; //~ ERROR cannot borrow //~^ immutable borrow occurs here } -//~^ NOTE mutable borrow ends here fn mut_borrow_after_borrow_nested() { let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; @@ -170,7 +155,6 @@ fn mut_borrow_after_borrow_nested() { let _y = &mut a.y; //~ ERROR cannot borrow //~^ mutable borrow occurs here } -//~^ NOTE immutable borrow ends here fn main() { copy_after_move(); diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.stderr b/src/test/ui/borrowck/borrowck-box-insensitivity.stderr new file mode 100644 index 0000000000..88e8490843 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-box-insensitivity.stderr @@ -0,0 +1,163 @@ +error[E0382]: use of moved value: `a` + --> $DIR/borrowck-box-insensitivity.rs:37:9 + | +35 | let _x = a.x; + | -- value moved here +36 | //~^ value moved here +37 | let _y = a.y; //~ ERROR use of moved + | ^^ value used here after move + | + = note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error[E0382]: use of moved value: `a` + --> $DIR/borrowck-box-insensitivity.rs:46:9 + | +44 | let _x = a.x; + | -- value moved here +45 | //~^ value moved here +46 | let _y = a.y; //~ ERROR use of moved + | ^^ value used here after move + | + = note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error[E0382]: use of moved value: `a` + --> $DIR/borrowck-box-insensitivity.rs:55:15 + | +53 | let _x = a.x; + | -- value moved here +54 | //~^ value moved here +55 | let _y = &a.y; //~ ERROR use of moved + | ^^^ value used here after move + | + = note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:63:9 + | +62 | let _x = &a.x; + | --- borrow of `a.x` occurs here +63 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0503]: cannot use `a.y` because it was mutably borrowed + --> $DIR/borrowck-box-insensitivity.rs:71:9 + | +70 | let _x = &mut a.x; + | --- borrow of `a.x` occurs here +71 | let _y = a.y; //~ ERROR cannot use + | ^^ use of borrowed `a.x` + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:77:9 + | +76 | let _x = &mut a.x; + | --- borrow of `a.x` occurs here +77 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0502]: cannot borrow `a` (via `a.y`) as immutable because `a` is also borrowed as mutable (via `a.x`) + --> $DIR/borrowck-box-insensitivity.rs:85:15 + | +84 | let _x = &mut a.x; + | --- mutable borrow occurs here (via `a.x`) +85 | let _y = &a.y; //~ ERROR cannot borrow + | ^^^ immutable borrow occurs here (via `a.y`) +86 | //~^ immutable borrow occurs here (via `a.y`) +87 | } + | - mutable borrow ends here + +error[E0502]: cannot borrow `a` (via `a.y`) as mutable because `a` is also borrowed as immutable (via `a.x`) + --> $DIR/borrowck-box-insensitivity.rs:92:19 + | +91 | let _x = &a.x; + | --- immutable borrow occurs here (via `a.x`) +92 | let _y = &mut a.y; //~ ERROR cannot borrow + | ^^^ mutable borrow occurs here (via `a.y`) +93 | //~^ mutable borrow occurs here (via `a.y`) +94 | } + | - immutable borrow ends here + +error[E0382]: use of collaterally moved value: `a.y` + --> $DIR/borrowck-box-insensitivity.rs:100:9 + | +98 | let _x = a.x.x; + | -- value moved here +99 | //~^ value moved here +100 | let _y = a.y; //~ ERROR use of collaterally moved + | ^^ value used here after move + | + = note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error[E0382]: use of collaterally moved value: `a.y` + --> $DIR/borrowck-box-insensitivity.rs:108:9 + | +106 | let _x = a.x.x; + | -- value moved here +107 | //~^ value moved here +108 | let _y = a.y; //~ ERROR use of collaterally moved + | ^^ value used here after move + | + = note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error[E0382]: use of collaterally moved value: `a.y` + --> $DIR/borrowck-box-insensitivity.rs:116:15 + | +114 | let _x = a.x.x; + | -- value moved here +115 | //~^ value moved here +116 | let _y = &a.y; //~ ERROR use of collaterally moved + | ^^^ value used here after move + | + = note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:124:9 + | +122 | let _x = &a.x.x; + | ----- borrow of `a.x.x` occurs here +123 | //~^ borrow of `a.x.x` occurs here +124 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0503]: cannot use `a.y` because it was mutably borrowed + --> $DIR/borrowck-box-insensitivity.rs:132:9 + | +131 | let _x = &mut a.x.x; + | ----- borrow of `a.x.x` occurs here +132 | let _y = a.y; //~ ERROR cannot use + | ^^ use of borrowed `a.x.x` + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:138:9 + | +137 | let _x = &mut a.x.x; + | ----- borrow of `a.x.x` occurs here +138 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0502]: cannot borrow `a.y` as immutable because `a.x.x` is also borrowed as mutable + --> $DIR/borrowck-box-insensitivity.rs:147:15 + | +145 | let _x = &mut a.x.x; + | ----- mutable borrow occurs here +146 | //~^ mutable borrow occurs here +147 | let _y = &a.y; //~ ERROR cannot borrow + | ^^^ immutable borrow occurs here +148 | //~^ immutable borrow occurs here +149 | } + | - mutable borrow ends here + +error[E0502]: cannot borrow `a.y` as mutable because `a.x.x` is also borrowed as immutable + --> $DIR/borrowck-box-insensitivity.rs:155:19 + | +153 | let _x = &a.x.x; + | ----- immutable borrow occurs here +154 | //~^ immutable borrow occurs here +155 | let _y = &mut a.y; //~ ERROR cannot borrow + | ^^^ mutable borrow occurs here +156 | //~^ mutable borrow occurs here +157 | } + | - immutable borrow ends here + +error: aborting due to 16 previous errors + diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.rs b/src/test/ui/borrowck/borrowck-closures-two-mut.rs index 182b3d7544..b6946154fa 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.rs +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.rs @@ -12,7 +12,7 @@ // access to the variable, whether that mutable access be used // for direct assignment or for taking mutable ref. Issue #6801. -// compile-flags: -Z emit-end-regions -Z borrowck-mir +// compile-flags: -Z borrowck=compare #![feature(box_syntax)] @@ -22,6 +22,7 @@ fn a() { let mut x = 3; let c1 = to_fn_mut(|| x = 4); let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once + //~| ERROR cannot borrow `x` as mutable more than once } fn set(x: &mut isize) { @@ -32,12 +33,14 @@ fn b() { let mut x = 3; let c1 = to_fn_mut(|| set(&mut x)); let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once + //~| ERROR cannot borrow `x` as mutable more than once } fn c() { let mut x = 3; let c1 = to_fn_mut(|| x = 5); let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once + //~| ERROR cannot borrow `x` as mutable more than once } fn d() { @@ -45,6 +48,7 @@ fn d() { let c1 = to_fn_mut(|| x = 5); let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) //~^ ERROR cannot borrow `x` as mutable more than once + //~| ERROR cannot borrow `x` as mutable more than once } fn g() { @@ -56,6 +60,7 @@ fn g() { let c1 = to_fn_mut(|| set(&mut *x.f)); let c2 = to_fn_mut(|| set(&mut *x.f)); //~^ ERROR cannot borrow `x` as mutable more than once + //~| ERROR cannot borrow `x` as mutable more than once } fn main() { diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr index fc8a7f2ab6..0ec744f4a0 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr @@ -9,65 +9,68 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -25 | } +25 | //~| ERROR cannot borrow `x` as mutable more than once +26 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:34:24 + --> $DIR/borrowck-closures-two-mut.rs:35:24 | -33 | let c1 = to_fn_mut(|| set(&mut x)); +34 | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -34 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +35 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -35 | } +36 | //~| ERROR cannot borrow `x` as mutable more than once +37 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:40:24 + --> $DIR/borrowck-closures-two-mut.rs:42:24 | -39 | let c1 = to_fn_mut(|| x = 5); +41 | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -40 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +42 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -41 | } +43 | //~| ERROR cannot borrow `x` as mutable more than once +44 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:46:24 + --> $DIR/borrowck-closures-two-mut.rs:49:24 | -45 | let c1 = to_fn_mut(|| x = 5); +48 | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -46 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) +49 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -47 | //~^ ERROR cannot borrow `x` as mutable more than once -48 | } +... +52 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:57:24 + --> $DIR/borrowck-closures-two-mut.rs:61:24 | -56 | let c1 = to_fn_mut(|| set(&mut *x.f)); +60 | let c1 = to_fn_mut(|| set(&mut *x.f)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -57 | let c2 = to_fn_mut(|| set(&mut *x.f)); +61 | let c2 = to_fn_mut(|| set(&mut *x.f)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -58 | //~^ ERROR cannot borrow `x` as mutable more than once -59 | } +... +64 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) @@ -81,65 +84,68 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -25 | } +25 | //~| ERROR cannot borrow `x` as mutable more than once +26 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:34:24 + --> $DIR/borrowck-closures-two-mut.rs:35:24 | -33 | let c1 = to_fn_mut(|| set(&mut x)); +34 | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -34 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +35 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -35 | } +36 | //~| ERROR cannot borrow `x` as mutable more than once +37 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:40:24 + --> $DIR/borrowck-closures-two-mut.rs:42:24 | -39 | let c1 = to_fn_mut(|| x = 5); +41 | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -40 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +42 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -41 | } +43 | //~| ERROR cannot borrow `x` as mutable more than once +44 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:46:24 + --> $DIR/borrowck-closures-two-mut.rs:49:24 | -45 | let c1 = to_fn_mut(|| x = 5); +48 | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -46 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) +49 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -47 | //~^ ERROR cannot borrow `x` as mutable more than once -48 | } +... +52 | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:57:24 + --> $DIR/borrowck-closures-two-mut.rs:61:24 | -56 | let c1 = to_fn_mut(|| set(&mut *x.f)); +60 | let c1 = to_fn_mut(|| set(&mut *x.f)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -57 | let c2 = to_fn_mut(|| set(&mut *x.f)); +61 | let c2 = to_fn_mut(|| set(&mut *x.f)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -58 | //~^ ERROR cannot borrow `x` as mutable more than once -59 | } +... +64 | } | - first borrow ends here error: aborting due to 10 previous errors diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs similarity index 91% rename from src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs rename to src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs index ec330247f2..87e40df766 100644 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs @@ -22,6 +22,4 @@ fn main() { let mut books = vec![1,2,3]; spawn(|| books.push(4)); //~^ ERROR E0373 - //~| NOTE `books` is borrowed here - //~| NOTE may outlive borrowed value `books` } diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr new file mode 100644 index 0000000000..cc0bd15c48 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr @@ -0,0 +1,14 @@ +error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function + --> $DIR/borrowck-escaping-closure-error-1.rs:23:11 + | +23 | spawn(|| books.push(4)); + | ^^ ----- `books` is borrowed here + | | + | may outlive borrowed value `books` +help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword + | +23 | spawn(move || books.push(4)); + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs similarity index 91% rename from src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs rename to src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs index 81685c32f2..67700be890 100644 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs @@ -20,8 +20,6 @@ fn foo<'a>(x: &'a i32) -> Box<FnMut()+'a> { let mut books = vec![1,2,3]; Box::new(|| books.push(4)) //~^ ERROR E0373 - //~| NOTE `books` is borrowed here - //~| NOTE may outlive borrowed value `books` } fn main() { } diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr new file mode 100644 index 0000000000..f8963c175c --- /dev/null +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr @@ -0,0 +1,14 @@ +error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function + --> $DIR/borrowck-escaping-closure-error-2.rs:21:14 + | +21 | Box::new(|| books.push(4)) + | ^^ ----- `books` is borrowed here + | | + | may outlive borrowed value `books` +help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword + | +21 | Box::new(move || books.push(4)) + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/borrowck-in-static.rs b/src/test/ui/borrowck/borrowck-in-static.rs index 9244c12347..16b0e8638d 100644 --- a/src/test/ui/borrowck/borrowck-in-static.rs +++ b/src/test/ui/borrowck/borrowck-in-static.rs @@ -11,7 +11,7 @@ // check that borrowck looks inside consts/statics static FN : &'static (Fn() -> (Box<Fn()->Box<i32>>) + Sync) = &|| { - let x = Box::new(0); //~ NOTE moved + let x = Box::new(0); Box::new(|| x) //~ ERROR cannot move out of captured outer variable }; diff --git a/src/test/ui/borrowck/borrowck-in-static.stderr b/src/test/ui/borrowck/borrowck-in-static.stderr index 6083a82b1b..6e47c46cde 100644 --- a/src/test/ui/borrowck/borrowck-in-static.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure --> $DIR/borrowck-in-static.rs:15:17 | -14 | let x = Box::new(0); //~ NOTE moved +14 | let x = Box::new(0); | - captured outer variable 15 | Box::new(|| x) //~ ERROR cannot move out of captured outer variable | ^ cannot move out of captured outer variable in an `Fn` closure diff --git a/src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs b/src/test/ui/borrowck/borrowck-move-error-with-note.rs similarity index 82% rename from src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs rename to src/test/ui/borrowck/borrowck-move-error-with-note.rs index 5d9c9d0bd4..e0491159a6 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.rs @@ -20,9 +20,9 @@ fn blah() { let f = &Foo::Foo1(box 1, box 2); match *f { //~ ERROR cannot move out of //~| cannot move out - Foo::Foo1(num1, //~ NOTE to prevent move - num2) => (), //~ NOTE and here - Foo::Foo2(num) => (), //~ NOTE and here + Foo::Foo1(num1, + num2) => (), + Foo::Foo2(num) => (), Foo::Foo3 => () } } @@ -39,8 +39,8 @@ fn move_in_match() { match (S {f: "foo".to_string(), g: "bar".to_string()}) { S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait //~| cannot move out of here - f: _s, //~ NOTE to prevent move - g: _t //~ NOTE and here + f: _s, + g: _t } => {} } } @@ -56,7 +56,7 @@ fn blah2() { let a = &A { a: box 1 }; match a.a { //~ ERROR cannot move out of //~| cannot move out - n => { //~ NOTE to prevent move + n => { free(n) } } diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr new file mode 100644 index 0000000000..c16c80345d --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr @@ -0,0 +1,36 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/borrowck-move-error-with-note.rs:21:11 + | +21 | match *f { //~ ERROR cannot move out of + | ^^ cannot move out of borrowed content +22 | //~| cannot move out +23 | Foo::Foo1(num1, + | ---- hint: to prevent move, use `ref num1` or `ref mut num1` +24 | num2) => (), + | ---- ...and here (use `ref num2` or `ref mut num2`) +25 | Foo::Foo2(num) => (), + | --- ...and here (use `ref num` or `ref mut num`) + +error[E0509]: cannot move out of type `S`, which implements the `Drop` trait + --> $DIR/borrowck-move-error-with-note.rs:40:9 + | +40 | / S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait +41 | | //~| cannot move out of here +42 | | f: _s, + | | -- hint: to prevent move, use `ref _s` or `ref mut _s` +43 | | g: _t + | | -- ...and here (use `ref _t` or `ref mut _t`) +44 | | } => {} + | |_________^ cannot move out of here + +error[E0507]: cannot move out of borrowed content + --> $DIR/borrowck-move-error-with-note.rs:57:11 + | +57 | match a.a { //~ ERROR cannot move out of + | ^ cannot move out of borrowed content +58 | //~| cannot move out +59 | n => { + | - hint: to prevent move, use `ref n` or `ref mut n` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs similarity index 97% rename from src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs rename to src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs index 311208f07b..938ce3f2cb 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs @@ -32,7 +32,6 @@ pub fn main() { //~| cannot move out //~| to prevent move Foo { string: b }] => { - //~^ NOTE and here } _ => { unreachable!(); diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr new file mode 100644 index 0000000000..f99bbb20cc --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -0,0 +1,17 @@ +error[E0508]: cannot move out of type `[Foo]`, a non-copy slice + --> $DIR/borrowck-move-out-of-vec-tail.rs:30:18 + | +30 | &[Foo { string: a }, + | ^ - hint: to prevent move, use `ref a` or `ref mut a` + | __________________| + | | +31 | | //~^ ERROR cannot move out of type `[Foo]` +32 | | //~| cannot move out +33 | | //~| to prevent move +34 | | Foo { string: b }] => { + | |_________________________________-__^ cannot move out of here + | | + | ...and here (use `ref b` or `ref mut b`) + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/borrowck-reinit.rs b/src/test/ui/borrowck/borrowck-reinit.rs index 5547cb3ae5..2e07577c5e 100644 --- a/src/test/ui/borrowck/borrowck-reinit.rs +++ b/src/test/ui/borrowck/borrowck-reinit.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z borrowck-mir -Z emit-end-regions +// compile-flags: -Z borrowck=compare fn main() { let mut x = Box::new(0); let _u = x; // error shouldn't note this move x = Box::new(1); drop(x); - let _ = (1,x); + let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) + //~^ ERROR use of moved value: `x` (Mir) } diff --git a/src/test/ui/borrowck/borrowck-reinit.stderr b/src/test/ui/borrowck/borrowck-reinit.stderr index 767d65c1e6..f36ed05051 100644 --- a/src/test/ui/borrowck/borrowck-reinit.stderr +++ b/src/test/ui/borrowck/borrowck-reinit.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` (Ast) | 17 | drop(x); | - value moved here -18 | let _ = (1,x); +18 | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait @@ -13,8 +13,10 @@ error[E0382]: use of moved value: `x` (Mir) | 17 | drop(x); | - value moved here -18 | let _ = (1,x); - | ^ value use here after move +18 | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) + | ^ value used here after move + | + = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs similarity index 92% rename from src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs rename to src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs index 3ca8cc431e..a655316055 100644 --- a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs @@ -17,7 +17,6 @@ fn main() { let z = &x; //~ ERROR cannot borrow //~^ immutable borrow occurs here } -//~^ NOTE mutable borrow ends here fn foo() { match true { @@ -29,7 +28,6 @@ fn foo() { let z = &mut x; //~ ERROR cannot borrow //~^ mutable borrow occurs here } - //~^ NOTE immutable borrow ends here false => () } } @@ -43,5 +41,4 @@ fn bar() { let z = &mut x; //~ ERROR cannot borrow //~^ second mutable borrow occurs here }; - //~^ NOTE first borrow ends here } diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr new file mode 100644 index 0000000000..fb6917141f --- /dev/null +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr @@ -0,0 +1,38 @@ +error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-report-with-custom-diagnostic.rs:17:14 + | +15 | let y = &mut x; + | - mutable borrow occurs here +16 | //~^ mutable borrow occurs here +17 | let z = &x; //~ ERROR cannot borrow + | ^ immutable borrow occurs here +18 | //~^ immutable borrow occurs here +19 | } + | - mutable borrow ends here + +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-report-with-custom-diagnostic.rs:28:26 + | +26 | let y = &x; + | - immutable borrow occurs here +27 | //~^ immutable borrow occurs here +28 | let z = &mut x; //~ ERROR cannot borrow + | ^ mutable borrow occurs here +29 | //~^ mutable borrow occurs here +30 | } + | - immutable borrow ends here + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-report-with-custom-diagnostic.rs:41:22 + | +39 | let y = &mut x; + | - first mutable borrow occurs here +40 | //~^ first mutable borrow occurs here +41 | let z = &mut x; //~ ERROR cannot borrow + | ^ second mutable borrow occurs here +42 | //~^ second mutable borrow occurs here +43 | }; + | - first borrow ends here + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs similarity index 94% rename from src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs rename to src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs index 98bb6b14b9..07b268f1a4 100644 --- a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -63,7 +63,7 @@ fn d() { match vec { &mut [ //~ ERROR cannot move out //~^ cannot move out - _b] => {} //~ NOTE to prevent move + _b] => {} _ => {} } let a = vec[0]; //~ ERROR cannot move out @@ -76,9 +76,6 @@ fn e() { match vec { &mut [_a, _b, _c] => {} //~ ERROR cannot move out //~| cannot move out - //~| NOTE to prevent move - //~| NOTE and here - //~| NOTE and here _ => {} } let a = vec[0]; //~ ERROR cannot move out diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr new file mode 100644 index 0000000000..899ffb446b --- /dev/null +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -0,0 +1,82 @@ +error[E0506]: cannot assign to `vec[..]` because it is borrowed + --> $DIR/borrowck-vec-pattern-nesting.rs:21:13 + | +19 | [box ref _a, _, _] => { + | ------ borrow of `vec[..]` occurs here +20 | //~^ borrow of `vec[..]` occurs here +21 | vec[0] = box 4; //~ ERROR cannot assign + | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here + +error[E0506]: cannot assign to `vec[..]` because it is borrowed + --> $DIR/borrowck-vec-pattern-nesting.rs:33:13 + | +31 | &mut [ref _b..] => { + | ------ borrow of `vec[..]` occurs here +32 | //~^ borrow of `vec[..]` occurs here +33 | vec[0] = box 4; //~ ERROR cannot assign + | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here + +error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:43:14 + | +43 | &mut [_a, //~ ERROR cannot move out + | ^-- hint: to prevent move, use `ref _a` or `ref mut _a` + | ______________| + | | +44 | | //~| cannot move out +45 | | //~| to prevent move +46 | | .. +47 | | ] => { + | |_________^ cannot move out of here + +error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:56:13 + | +56 | let a = vec[0]; //~ ERROR cannot move out + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` + +error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:64:14 + | +64 | &mut [ //~ ERROR cannot move out + | ______________^ +65 | | //~^ cannot move out +66 | | _b] => {} + | |__________--^ cannot move out of here + | | + | hint: to prevent move, use `ref _b` or `ref mut _b` + +error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:69:13 + | +69 | let a = vec[0]; //~ ERROR cannot move out + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` + +error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:77:14 + | +77 | &mut [_a, _b, _c] => {} //~ ERROR cannot move out + | ^--^^--^^--^ + | || | | + | || | ...and here (use `ref _c` or `ref mut _c`) + | || ...and here (use `ref _b` or `ref mut _b`) + | |hint: to prevent move, use `ref _a` or `ref mut _a` + | cannot move out of here + +error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:81:13 + | +81 | let a = vec[0]; //~ ERROR cannot move out + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.rs b/src/test/ui/borrowck/mut-borrow-in-loop.rs index addda42775..31b50d8e53 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.rs +++ b/src/test/ui/borrowck/mut-borrow-in-loop.rs @@ -17,20 +17,20 @@ struct FuncWrapper<'a, T : 'a> { impl<'a, T : 'a> FuncWrapper<'a, T> { fn in_loop(self, arg : &'a mut T) { loop { - (self.func)(arg) + (self.func)(arg) //~ ERROR cannot borrow } } fn in_while(self, arg : &'a mut T) { while true { - (self.func)(arg) + (self.func)(arg) //~ ERROR cannot borrow } } fn in_for(self, arg : &'a mut T) { let v : Vec<()> = vec![]; for _ in v.iter() { - (self.func)(arg) + (self.func)(arg) //~ ERROR cannot borrow } } } diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.stderr index a34d524d28..2b614561d8 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:20:25 | -20 | (self.func)(arg) +20 | (self.func)(arg) //~ ERROR cannot borrow | ^^^ mutable borrow starts here in previous iteration of loop 21 | } 22 | } @@ -10,7 +10,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:26:25 | -26 | (self.func)(arg) +26 | (self.func)(arg) //~ ERROR cannot borrow | ^^^ mutable borrow starts here in previous iteration of loop 27 | } 28 | } @@ -19,7 +19,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:33:25 | -33 | (self.func)(arg) +33 | (self.func)(arg) //~ ERROR cannot borrow | ^^^ mutable borrow starts here in previous iteration of loop 34 | } 35 | } diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.rs b/src/test/ui/borrowck/mut-borrow-outside-loop.rs index 97092b7f9d..a1ab41bab3 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.rs +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.rs @@ -14,13 +14,13 @@ fn main() { let mut void = (); let first = &mut void; - let second = &mut void; + let second = &mut void; //~ ERROR cannot borrow loop { let mut inner_void = (); let inner_first = &mut inner_void; - let inner_second = &mut inner_void; + let inner_second = &mut inner_void; //~ ERROR cannot borrow } } diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr index 02b32dc363..716edd2198 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time | 16 | let first = &mut void; | ---- first mutable borrow occurs here -17 | let second = &mut void; +17 | let second = &mut void; //~ ERROR cannot borrow | ^^^^ second mutable borrow occurs here ... 25 | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `inner_void` as mutable more than once at a time | 22 | let inner_first = &mut inner_void; | ---------- first mutable borrow occurs here -23 | let inner_second = &mut inner_void; +23 | let inner_second = &mut inner_void; //~ ERROR cannot borrow | ^^^^^^^^^^ second mutable borrow occurs here 24 | } | - first borrow ends here diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs index 9c89c26de0..cd9f1636c3 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs @@ -16,7 +16,7 @@ fn call<F>(f: F) where F : Fn() { } fn main() { - let y = vec![format!("World")]; //~ NOTE moved + let y = vec![format!("World")]; call(|| { y.into_iter(); //~^ ERROR cannot move out of captured outer variable in an `Fn` closure diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index dbfcb2e0c2..6aa0846f53 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9 | -19 | let y = vec![format!("World")]; //~ NOTE moved +19 | let y = vec![format!("World")]; | - captured outer variable 20 | call(|| { 21 | y.into_iter(); diff --git a/src/test/compile-fail/cast-as-bool.rs b/src/test/ui/cast-as-bool.rs similarity index 93% rename from src/test/compile-fail/cast-as-bool.rs rename to src/test/ui/cast-as-bool.rs index af42d5c275..68e26c23e4 100644 --- a/src/test/compile-fail/cast-as-bool.rs +++ b/src/test/ui/cast-as-bool.rs @@ -11,5 +11,4 @@ fn main() { let u = 5 as bool; //~^ ERROR cannot cast as `bool` - //~| HELP compare with zero instead } diff --git a/src/test/ui/cast-as-bool.stderr b/src/test/ui/cast-as-bool.stderr new file mode 100644 index 0000000000..346ebf07fc --- /dev/null +++ b/src/test/ui/cast-as-bool.stderr @@ -0,0 +1,10 @@ +error[E0054]: cannot cast as `bool` + --> $DIR/cast-as-bool.rs:12:13 + | +12 | let u = 5 as bool; + | ^^^^^^^^^ unsupported cast + | + = help: compare with zero instead + +error: aborting due to previous error + diff --git a/src/test/ui/cast-errors-issue-43825.rs b/src/test/ui/cast-errors-issue-43825.rs new file mode 100644 index 0000000000..65b391205e --- /dev/null +++ b/src/test/ui/cast-errors-issue-43825.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let error = error; //~ ERROR cannot find value `error` + + // These used to cause errors. + 0 as f32; + 0.0 as u32; +} diff --git a/src/test/ui/cast-errors-issue-43825.stderr b/src/test/ui/cast-errors-issue-43825.stderr new file mode 100644 index 0000000000..db0a33e927 --- /dev/null +++ b/src/test/ui/cast-errors-issue-43825.stderr @@ -0,0 +1,8 @@ +error[E0425]: cannot find value `error` in this scope + --> $DIR/cast-errors-issue-43825.rs:12:17 + | +12 | let error = error; //~ ERROR cannot find value `error` + | ^^^^^ not found in this scope + +error: aborting due to previous error + diff --git a/src/test/compile-fail/cast-rfc0401-2.rs b/src/test/ui/cast-rfc0401-2.rs similarity index 95% rename from src/test/compile-fail/cast-rfc0401-2.rs rename to src/test/ui/cast-rfc0401-2.rs index 1598a9aa1f..0dac707688 100644 --- a/src/test/compile-fail/cast-rfc0401-2.rs +++ b/src/test/ui/cast-rfc0401-2.rs @@ -15,5 +15,4 @@ fn main() { let _ = 3 as bool; //~^ ERROR cannot cast as `bool` - //~| HELP compare with zero } diff --git a/src/test/ui/cast-rfc0401-2.stderr b/src/test/ui/cast-rfc0401-2.stderr new file mode 100644 index 0000000000..1febe6a618 --- /dev/null +++ b/src/test/ui/cast-rfc0401-2.stderr @@ -0,0 +1,10 @@ +error[E0054]: cannot cast as `bool` + --> $DIR/cast-rfc0401-2.rs:16:13 + | +16 | let _ = 3 as bool; + | ^^^^^^^^^ unsupported cast + | + = help: compare with zero instead + +error: aborting due to previous error + diff --git a/src/test/ui/cast-to-unsized-trait-object-suggestion.rs b/src/test/ui/cast-to-unsized-trait-object-suggestion.rs index c793454798..010b5a1b10 100644 --- a/src/test/ui/cast-to-unsized-trait-object-suggestion.rs +++ b/src/test/ui/cast-to-unsized-trait-object-suggestion.rs @@ -9,6 +9,6 @@ // except according to those terms. fn main() { - &1 as Send; - Box::new(1) as Send; + &1 as Send; //~ ERROR cast to unsized + Box::new(1) as Send; //~ ERROR cast to unsized } diff --git a/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr index 4d4eb7b4ec..55d41848b1 100644 --- a/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr +++ b/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr @@ -1,7 +1,7 @@ error[E0620]: cast to unsized type: `&{integer}` as `std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5 | -12 | &1 as Send; +12 | &1 as Send; //~ ERROR cast to unsized | ^^^^^^---- | | | help: try casting to a reference instead: `&Send` @@ -9,7 +9,7 @@ error[E0620]: cast to unsized type: `&{integer}` as `std::marker::Send` error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5 | -13 | Box::new(1) as Send; +13 | Box::new(1) as Send; //~ ERROR cast to unsized | ^^^^^^^^^^^^^^^---- | | | help: try casting to a `Box` instead: `Box<Send>` diff --git a/src/test/ui/casts-differing-anon.rs b/src/test/ui/casts-differing-anon.rs new file mode 100644 index 0000000000..74c8ff370f --- /dev/null +++ b/src/test/ui/casts-differing-anon.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait)] + +use std::fmt; + +fn foo() -> Box<impl fmt::Debug+?Sized> { + let x : Box<[u8]> = Box::new([0]); + x +} +fn bar() -> Box<impl fmt::Debug+?Sized> { + let y: Box<fmt::Debug> = Box::new([0]); + y +} + +fn main() { + let f = foo(); + let b = bar(); + + // this is an `*mut [u8]` in practice + let f_raw : *mut _ = Box::into_raw(f); + // this is an `*mut fmt::Debug` in practice + let mut b_raw = Box::into_raw(b); + // ... and they should not be mixable + b_raw = f_raw as *mut _; //~ ERROR is invalid +} diff --git a/src/test/ui/casts-differing-anon.stderr b/src/test/ui/casts-differing-anon.stderr new file mode 100644 index 0000000000..8db6854dba --- /dev/null +++ b/src/test/ui/casts-differing-anon.stderr @@ -0,0 +1,10 @@ +error[E0606]: casting `*mut impl std::fmt::Debug+?Sized` as `*mut impl std::fmt::Debug+?Sized` is invalid + --> $DIR/casts-differing-anon.rs:33:13 + | +33 | b_raw = f_raw as *mut _; //~ ERROR is invalid + | ^^^^^^^^^^^^^^^ + | + = note: vtable kinds may not match + +error: aborting due to previous error + diff --git a/src/test/ui/casts-issue-46365.rs b/src/test/ui/casts-issue-46365.rs new file mode 100644 index 0000000000..79f636e413 --- /dev/null +++ b/src/test/ui/casts-issue-46365.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Lorem { + ipsum: Ipsum //~ ERROR cannot find type `Ipsum` +} + +fn main() { + let _foo: *mut Lorem = 0 as *mut _; // no error here +} diff --git a/src/test/ui/casts-issue-46365.stderr b/src/test/ui/casts-issue-46365.stderr new file mode 100644 index 0000000000..ce3c8593a9 --- /dev/null +++ b/src/test/ui/casts-issue-46365.stderr @@ -0,0 +1,8 @@ +error[E0412]: cannot find type `Ipsum` in this scope + --> $DIR/casts-issue-46365.rs:12:12 + | +12 | ipsum: Ipsum //~ ERROR cannot find type `Ipsum` + | ^^^^^ not found in this scope + +error: aborting due to previous error + diff --git a/src/test/compile-fail/changing-crates.rs b/src/test/ui/changing-crates.rs similarity index 87% rename from src/test/compile-fail/changing-crates.rs rename to src/test/ui/changing-crates.rs index f74855a084..5963a58a2d 100644 --- a/src/test/compile-fail/changing-crates.rs +++ b/src/test/ui/changing-crates.rs @@ -14,11 +14,9 @@ // aux-build:changing-crates-a1.rs // aux-build:changing-crates-b.rs // aux-build:changing-crates-a2.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: crate `a` path #1: -//~| NOTE: crate `b` path #1: fn main() {} diff --git a/src/test/ui/changing-crates.stderr b/src/test/ui/changing-crates.stderr new file mode 100644 index 0000000000..50287fa3fd --- /dev/null +++ b/src/test/ui/changing-crates.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/changing-crates.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/ui/check_match/issue-35609.rs b/src/test/ui/check_match/issue-35609.rs index 6497f69035..d52718b7bf 100644 --- a/src/test/ui/check_match/issue-35609.rs +++ b/src/test/ui/check_match/issue-35609.rs @@ -17,36 +17,36 @@ struct S(Enum, ()); struct Sd { x: Enum, y: () } fn main() { - match (A, ()) { + match (A, ()) { //~ ERROR non-exhaustive (A, _) => {} } - match (A, A) { + match (A, A) { //~ ERROR non-exhaustive (_, A) => {} } - match ((A, ()), ()) { + match ((A, ()), ()) { //~ ERROR non-exhaustive ((A, ()), _) => {} } - match ((A, ()), A) { + match ((A, ()), A) { //~ ERROR non-exhaustive ((A, ()), _) => {} } - match ((A, ()), ()) { + match ((A, ()), ()) { //~ ERROR non-exhaustive ((A, _), _) => {} } - match S(A, ()) { + match S(A, ()) { //~ ERROR non-exhaustive S(A, _) => {} } - match (Sd { x: A, y: () }) { + match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive Sd { x: A, y: _ } => {} } - match Some(A) { + match Some(A) { //~ ERROR non-exhaustive Some(A) => (), None => () } diff --git a/src/test/ui/check_match/issue-35609.stderr b/src/test/ui/check_match/issue-35609.stderr index 0aafe3f17b..1fc1d05636 100644 --- a/src/test/ui/check_match/issue-35609.stderr +++ b/src/test/ui/check_match/issue-35609.stderr @@ -1,49 +1,49 @@ error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:20:11 | -20 | match (A, ()) { +20 | match (A, ()) { //~ ERROR non-exhaustive | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered --> $DIR/issue-35609.rs:24:11 | -24 | match (A, A) { +24 | match (A, A) { //~ ERROR non-exhaustive | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:28:11 | -28 | match ((A, ()), ()) { +28 | match ((A, ()), ()) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:32:11 | -32 | match ((A, ()), A) { +32 | match ((A, ()), A) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:36:11 | -36 | match ((A, ()), ()) { +36 | match ((A, ()), ()) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:41:11 | -41 | match S(A, ()) { +41 | match S(A, ()) { //~ ERROR non-exhaustive | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered --> $DIR/issue-35609.rs:45:11 | -45 | match (Sd { x: A, y: () }) { +45 | match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered --> $DIR/issue-35609.rs:49:11 | -49 | match Some(A) { +49 | match Some(A) { //~ ERROR non-exhaustive | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered error: aborting due to 8 previous errors diff --git a/src/test/ui/check_match/issue-43253.rs b/src/test/ui/check_match/issue-43253.rs index 108d7e1ea2..12ccba0ebf 100644 --- a/src/test/ui/check_match/issue-43253.rs +++ b/src/test/ui/check_match/issue-43253.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![feature(exclusive_range_pattern)] #![warn(unreachable_patterns)] diff --git a/src/test/ui/check_match/issue-43253.stderr b/src/test/ui/check_match/issue-43253.stderr index a1cb396391..91bd6b39c8 100644 --- a/src/test/ui/check_match/issue-43253.stderr +++ b/src/test/ui/check_match/issue-43253.stderr @@ -1,24 +1,24 @@ warning: unreachable pattern - --> $DIR/issue-43253.rs:37:9 + --> $DIR/issue-43253.rs:39:9 | -37 | 9 => {}, +39 | 9 => {}, | ^ | note: lint level defined here - --> $DIR/issue-43253.rs:12:9 + --> $DIR/issue-43253.rs:14:9 | -12 | #![warn(unreachable_patterns)] +14 | #![warn(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ warning: unreachable pattern - --> $DIR/issue-43253.rs:43:9 + --> $DIR/issue-43253.rs:45:9 | -43 | 8...9 => {}, +45 | 8...9 => {}, | ^^^^^ warning: unreachable pattern - --> $DIR/issue-43253.rs:49:9 + --> $DIR/issue-43253.rs:51:9 | -49 | 9...9 => {}, +51 | 9...9 => {}, | ^^^^^ diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.rs b/src/test/ui/closure_context/issue-26046-fn-mut.rs index 5ed7ace543..3b179a475e 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.rs +++ b/src/test/ui/closure_context/issue-26046-fn-mut.rs @@ -11,7 +11,7 @@ fn foo() -> Box<Fn()> { let num = 5; - let closure = || { + let closure = || { //~ ERROR expected a closure that num += 1; }; diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.stderr b/src/test/ui/closure_context/issue-26046-fn-mut.stderr index 42fc2909df..77ce1176b5 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-mut.stderr @@ -1,20 +1,13 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` --> $DIR/issue-26046-fn-mut.rs:14:19 | -14 | let closure = || { - | ___________________^ -15 | | num += 1; -16 | | }; - | |_____^ -17 | -18 | Box::new(closure) - | ----------------- the requirement to implement `Fn` derives from here - | -note: closure is `FnMut` because it mutates the variable `num` here - --> $DIR/issue-26046-fn-mut.rs:15:9 - | +14 | let closure = || { //~ ERROR expected a closure that + | ^^ this closure implements `FnMut`, not `Fn` 15 | num += 1; - | ^^^ + | --- closure is `FnMut` because it mutates the variable `num` here +... +18 | Box::new(closure) + | ----------------- the requirement to implement `Fn` derives from here error: aborting due to previous error diff --git a/src/test/ui/closure_context/issue-26046-fn-once.rs b/src/test/ui/closure_context/issue-26046-fn-once.rs index de06de530c..cf15985ee8 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.rs +++ b/src/test/ui/closure_context/issue-26046-fn-once.rs @@ -11,7 +11,7 @@ fn get_closure() -> Box<Fn() -> Vec<u8>> { let vec = vec![1u8, 2u8]; - let closure = move || { + let closure = move || { //~ ERROR expected a closure vec }; diff --git a/src/test/ui/closure_context/issue-26046-fn-once.stderr b/src/test/ui/closure_context/issue-26046-fn-once.stderr index 7bfe72d3d6..4eed4461eb 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-once.stderr @@ -1,20 +1,13 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/issue-26046-fn-once.rs:14:19 | -14 | let closure = move || { - | ___________________^ -15 | | vec -16 | | }; - | |_____^ -17 | -18 | Box::new(closure) - | ----------------- the requirement to implement `Fn` derives from here - | -note: closure is `FnOnce` because it moves the variable `vec` out of its environment - --> $DIR/issue-26046-fn-once.rs:15:9 - | +14 | let closure = move || { //~ ERROR expected a closure + | ^^^^^^^ this closure implements `FnOnce`, not `Fn` 15 | vec - | ^^^ + | --- closure is `FnOnce` because it moves the variable `vec` out of its environment +... +18 | Box::new(closure) + | ----------------- the requirement to implement `Fn` derives from here error: aborting due to previous error diff --git a/src/test/ui/closure_context/issue-42065.rs b/src/test/ui/closure_context/issue-42065.rs index 409964082f..9daa76d858 100644 --- a/src/test/ui/closure_context/issue-42065.rs +++ b/src/test/ui/closure_context/issue-42065.rs @@ -20,6 +20,4 @@ fn main() { debug_dump_dict(); debug_dump_dict(); //~^ ERROR use of moved value: `debug_dump_dict` - //~| NOTE closure cannot be invoked more than once because it moves the - //~| variable `dict` out of its environment } diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr index 87255dfe77..9d6ef54cb9 100644 --- a/src/test/ui/codemap_tests/bad-format-args.stderr +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -4,7 +4,7 @@ error: requires at least a format string argument 12 | format!(); | ^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: expected token: `,` --> $DIR/bad-format-args.rs:13:5 @@ -12,7 +12,7 @@ error: expected token: `,` 13 | format!("" 1); | ^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: expected token: `,` --> $DIR/bad-format-args.rs:14:5 @@ -20,7 +20,7 @@ error: expected token: `,` 14 | format!("", 1 1); | ^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs index a72ad0351e..532d173011 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs @@ -11,6 +11,6 @@ #![allow(dead_code)] trait C {} -impl C { fn f() {} } +impl C { fn f() {} } //~ ERROR duplicate impl C { fn f() {} } fn main() { } diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr index 7f1ab929c6..a7d5230147 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `f` --> $DIR/coherence-overlapping-inherent-impl-trait.rs:14:10 | -14 | impl C { fn f() {} } +14 | impl C { fn f() {} } //~ ERROR duplicate | ^^^^^^^^^ duplicate definitions for `f` 15 | impl C { fn f() {} } | --------- other definition for `f` diff --git a/src/test/ui/codemap_tests/empty_span.rs b/src/test/ui/codemap_tests/empty_span.rs index 2cf3b66dd7..8e0395e3c5 100644 --- a/src/test/ui/codemap_tests/empty_span.rs +++ b/src/test/ui/codemap_tests/empty_span.rs @@ -14,5 +14,5 @@ fn main() { impl !Sync for Foo {} - unsafe impl Send for &'static Foo { } + unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl } diff --git a/src/test/ui/codemap_tests/empty_span.stderr b/src/test/ui/codemap_tests/empty_span.stderr index b33dee6b4a..3474803b00 100644 --- a/src/test/ui/codemap_tests/empty_span.stderr +++ b/src/test/ui/codemap_tests/empty_span.stderr @@ -1,7 +1,7 @@ error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static main::Foo` --> $DIR/empty_span.rs:17:5 | -17 | unsafe impl Send for &'static Foo { } +17 | unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.rs b/src/test/ui/codemap_tests/huge_multispan_highlight.rs index 5a058d4839..cf593eab85 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.rs +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.rs @@ -97,5 +97,5 @@ fn main() { - let y = &mut x; + let y = &mut x; //~ ERROR cannot borrow } diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr index 914db98c78..bc333bde93 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable 12 | let x = "foo"; | - consider changing this to `mut x` ... -100 | let y = &mut x; +100 | let y = &mut x; //~ ERROR cannot borrow | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/issue-11715.rs b/src/test/ui/codemap_tests/issue-11715.rs index ba1ce6abcd..75581d3892 100644 --- a/src/test/ui/codemap_tests/issue-11715.rs +++ b/src/test/ui/codemap_tests/issue-11715.rs @@ -97,5 +97,5 @@ fn main() { let mut x = "foo"; let y = &mut x; - let z = &mut x; + let z = &mut x; //~ ERROR cannot borrow } diff --git a/src/test/ui/codemap_tests/issue-11715.stderr b/src/test/ui/codemap_tests/issue-11715.stderr index 4947cbedd2..bd8ffba00d 100644 --- a/src/test/ui/codemap_tests/issue-11715.stderr +++ b/src/test/ui/codemap_tests/issue-11715.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | 99 | let y = &mut x; | - first mutable borrow occurs here -100 | let z = &mut x; +100 | let z = &mut x; //~ ERROR cannot borrow | ^ second mutable borrow occurs here 101 | } | - first borrow ends here diff --git a/src/test/ui/codemap_tests/issue-28308.stderr b/src/test/ui/codemap_tests/issue-28308.stderr index 7a1478104f..c5afa5ec1a 100644 --- a/src/test/ui/codemap_tests/issue-28308.stderr +++ b/src/test/ui/codemap_tests/issue-28308.stderr @@ -4,7 +4,7 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str` 12 | assert!("foo"); | ^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/one_line.rs b/src/test/ui/codemap_tests/one_line.rs index e50091d560..3fb35dd26a 100644 --- a/src/test/ui/codemap_tests/one_line.rs +++ b/src/test/ui/codemap_tests/one_line.rs @@ -10,5 +10,5 @@ fn main() { let mut v = vec![Some("foo"), Some("bar")]; - v.push(v.pop().unwrap()); + v.push(v.pop().unwrap()); //~ ERROR cannot borrow } diff --git a/src/test/ui/codemap_tests/one_line.stderr b/src/test/ui/codemap_tests/one_line.stderr index a73575a8d5..cfe3d52713 100644 --- a/src/test/ui/codemap_tests/one_line.stderr +++ b/src/test/ui/codemap_tests/one_line.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/one_line.rs:13:12 | -13 | v.push(v.pop().unwrap()); +13 | v.push(v.pop().unwrap()); //~ ERROR cannot borrow | - ^ - first borrow ends here | | | | | second mutable borrow occurs here diff --git a/src/test/ui/codemap_tests/overlapping_inherent_impls.rs b/src/test/ui/codemap_tests/overlapping_inherent_impls.rs index a626b63b31..18e77ddfd2 100644 --- a/src/test/ui/codemap_tests/overlapping_inherent_impls.rs +++ b/src/test/ui/codemap_tests/overlapping_inherent_impls.rs @@ -16,7 +16,7 @@ struct Foo; impl Foo { - fn id() {} + fn id() {} //~ ERROR duplicate definitions } impl Foo { @@ -26,7 +26,7 @@ impl Foo { struct Bar<T>(T); impl<T> Bar<T> { - fn bar(&self) {} + fn bar(&self) {} //~ ERROR duplicate definitions } impl Bar<u32> { @@ -36,7 +36,7 @@ impl Bar<u32> { struct Baz<T>(T); impl<T: Copy> Baz<T> { - fn baz(&self) {} + fn baz(&self) {} //~ ERROR duplicate definitions } impl<T> Baz<Vec<T>> { diff --git a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr index eaf42cde22..0ccdd20765 100644 --- a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr +++ b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `id` --> $DIR/overlapping_inherent_impls.rs:19:5 | -19 | fn id() {} +19 | fn id() {} //~ ERROR duplicate definitions | ^^^^^^^^^^ duplicate definitions for `id` ... 23 | fn id() {} @@ -10,7 +10,7 @@ error[E0592]: duplicate definitions with name `id` error[E0592]: duplicate definitions with name `bar` --> $DIR/overlapping_inherent_impls.rs:29:5 | -29 | fn bar(&self) {} +29 | fn bar(&self) {} //~ ERROR duplicate definitions | ^^^^^^^^^^^^^^^^ duplicate definitions for `bar` ... 33 | fn bar(&self) {} @@ -19,7 +19,7 @@ error[E0592]: duplicate definitions with name `bar` error[E0592]: duplicate definitions with name `baz` --> $DIR/overlapping_inherent_impls.rs:39:5 | -39 | fn baz(&self) {} +39 | fn baz(&self) {} //~ ERROR duplicate definitions | ^^^^^^^^^^^^^^^^ duplicate definitions for `baz` ... 43 | fn baz(&self) {} diff --git a/src/test/ui/codemap_tests/overlapping_spans.rs b/src/test/ui/codemap_tests/overlapping_spans.rs index 7c1f0db16d..467e90bd5a 100644 --- a/src/test/ui/codemap_tests/overlapping_spans.rs +++ b/src/test/ui/codemap_tests/overlapping_spans.rs @@ -18,6 +18,6 @@ impl Drop for S { fn main() { match (S {f:"foo".to_string()}) { - S {f:_s} => {} + S {f:_s} => {} //~ ERROR cannot move out } } diff --git a/src/test/ui/codemap_tests/overlapping_spans.stderr b/src/test/ui/codemap_tests/overlapping_spans.stderr index d32b18d670..dc801b20df 100644 --- a/src/test/ui/codemap_tests/overlapping_spans.stderr +++ b/src/test/ui/codemap_tests/overlapping_spans.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait --> $DIR/overlapping_spans.rs:21:9 | -21 | S {f:_s} => {} +21 | S {f:_s} => {} //~ ERROR cannot move out | ^^^^^--^ | | | | | hint: to prevent move, use `ref _s` or `ref mut _s` diff --git a/src/test/ui/codemap_tests/tab.rs b/src/test/ui/codemap_tests/tab.rs index 146ad2283c..b8dedb0daf 100644 --- a/src/test/ui/codemap_tests/tab.rs +++ b/src/test/ui/codemap_tests/tab.rs @@ -11,9 +11,9 @@ // ignore-tidy-tab fn main() { - bar; + bar; //~ ERROR cannot find value `bar` } fn foo() { - "bar boo" + "bar boo" //~ ERROR mismatched types } diff --git a/src/test/ui/codemap_tests/tab.stderr b/src/test/ui/codemap_tests/tab.stderr index b3fa9b128c..c887821c6d 100644 --- a/src/test/ui/codemap_tests/tab.stderr +++ b/src/test/ui/codemap_tests/tab.stderr @@ -1,16 +1,16 @@ error[E0425]: cannot find value `bar` in this scope --> $DIR/tab.rs:14:2 | -14 | bar; - | ^^^ not found in this scope +14 | bar; //~ ERROR cannot find value `bar` + | ^^^ not found in this scope error[E0308]: mismatched types --> $DIR/tab.rs:18:2 | 17 | fn foo() { - | - help: try adding a return type: `-> &'static str ` -18 | "bar boo" - | ^^^^^^^^^^^ expected (), found reference + | - help: try adding a return type: `-> &'static str` +18 | "bar boo" //~ ERROR mismatched types + | ^^^^^^^^^^^^^^^^^^^^ expected (), found reference | = note: expected type `()` found type `&'static str` diff --git a/src/test/ui/codemap_tests/tab_2.rs b/src/test/ui/codemap_tests/tab_2.rs index d26d7974d8..b759a4abca 100644 --- a/src/test/ui/codemap_tests/tab_2.rs +++ b/src/test/ui/codemap_tests/tab_2.rs @@ -11,5 +11,5 @@ // ignore-tidy-tab fn main() { - """; + """; //~ ERROR unterminated double quote } diff --git a/src/test/ui/codemap_tests/tab_2.stderr b/src/test/ui/codemap_tests/tab_2.stderr index a2b3ca7e4d..34c49d9756 100644 --- a/src/test/ui/codemap_tests/tab_2.stderr +++ b/src/test/ui/codemap_tests/tab_2.stderr @@ -1,8 +1,8 @@ error: unterminated double quote string --> $DIR/tab_2.rs:14:7 | -14 | """; - | _______^ +14 | """; //~ ERROR unterminated double quote + | ___________________^ 15 | | } | |__^ diff --git a/src/test/ui/codemap_tests/tab_3.rs b/src/test/ui/codemap_tests/tab_3.rs index 9b3513d511..ea235ed71a 100644 --- a/src/test/ui/codemap_tests/tab_3.rs +++ b/src/test/ui/codemap_tests/tab_3.rs @@ -14,6 +14,6 @@ fn main() { let some_vec = vec!["hi"]; some_vec.into_iter(); { - println!("{:?}", some_vec); + println!("{:?}", some_vec); //~ ERROR use of moved } } diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr index f19f5f20d2..3220206266 100644 --- a/src/test/ui/codemap_tests/tab_3.stderr +++ b/src/test/ui/codemap_tests/tab_3.stderr @@ -1,11 +1,11 @@ error[E0382]: use of moved value: `some_vec` --> $DIR/tab_3.rs:17:20 | -15 | some_vec.into_iter(); - | -------- value moved here -16 | { -17 | println!("{:?}", some_vec); - | ^^^^^^^^ value used here after move +15 | some_vec.into_iter(); + | -------- value moved here +16 | { +17 | println!("{:?}", some_vec); //~ ERROR use of moved + | ^^^^^^^^ value used here after move | = note: move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait diff --git a/src/test/ui/codemap_tests/two_files.rs b/src/test/ui/codemap_tests/two_files.rs index fe5eba93b2..4c99ee6759 100644 --- a/src/test/ui/codemap_tests/two_files.rs +++ b/src/test/ui/codemap_tests/two_files.rs @@ -12,6 +12,6 @@ include!("two_files_data.rs"); struct Baz { } -impl Bar for Baz { } +impl Bar for Baz { } //~ ERROR expected trait, found type alias fn main() { } diff --git a/src/test/ui/codemap_tests/two_files.stderr b/src/test/ui/codemap_tests/two_files.stderr index 9db43dde1a..c0cfeef194 100644 --- a/src/test/ui/codemap_tests/two_files.stderr +++ b/src/test/ui/codemap_tests/two_files.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found type alias `Bar` --> $DIR/two_files.rs:15:6 | -15 | impl Bar for Baz { } +15 | impl Bar for Baz { } //~ ERROR expected trait, found type alias | ^^^ type aliases cannot be used for traits error: cannot continue compilation due to previous error diff --git a/src/test/ui/codemap_tests/unicode.rs b/src/test/ui/codemap_tests/unicode.rs index b206722d4f..ac22906a62 100644 --- a/src/test/ui/codemap_tests/unicode.rs +++ b/src/test/ui/codemap_tests/unicode.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern "路濫狼á́́" fn foo() {} +extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI fn main() { } diff --git a/src/test/ui/codemap_tests/unicode.stderr b/src/test/ui/codemap_tests/unicode.stderr index 02a9d7ee0e..4f3c79410d 100644 --- a/src/test/ui/codemap_tests/unicode.stderr +++ b/src/test/ui/codemap_tests/unicode.stderr @@ -1,7 +1,7 @@ error: invalid ABI: expected one of [cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted], found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | -11 | extern "路濫狼á́́" fn foo() {} +11 | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/unicode_2.rs b/src/test/ui/codemap_tests/unicode_2.rs index cc3eae90f9..c01b0b286a 100644 --- a/src/test/ui/codemap_tests/unicode_2.rs +++ b/src/test/ui/codemap_tests/unicode_2.rs @@ -11,7 +11,7 @@ #![feature(non_ascii_idents)] fn main() { - let _ = ("a̐éö̲", 0u7); - let _ = ("아あ", 1i42); - let _ = a̐é; + let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width + let _ = ("아あ", 1i42); //~ ERROR invalid width + let _ = a̐é; //~ ERROR cannot find } diff --git a/src/test/ui/codemap_tests/unicode_2.stderr b/src/test/ui/codemap_tests/unicode_2.stderr index 6cfa66730a..9ffd08ca06 100644 --- a/src/test/ui/codemap_tests/unicode_2.stderr +++ b/src/test/ui/codemap_tests/unicode_2.stderr @@ -1,7 +1,7 @@ error: invalid width `7` for integer literal --> $DIR/unicode_2.rs:14:25 | -14 | let _ = ("a̐éö̲", 0u7); +14 | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -9,7 +9,7 @@ error: invalid width `7` for integer literal error: invalid width `42` for integer literal --> $DIR/unicode_2.rs:15:20 | -15 | let _ = ("아あ", 1i42); +15 | let _ = ("아あ", 1i42); //~ ERROR invalid width | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -17,7 +17,7 @@ error: invalid width `42` for integer literal error[E0425]: cannot find value `a̐é` in this scope --> $DIR/unicode_2.rs:16:13 | -16 | let _ = a̐é; +16 | let _ = a̐é; //~ ERROR cannot find | ^^ not found in this scope error: aborting due to 3 previous errors diff --git a/src/test/ui/codemap_tests/unicode_3.rs b/src/test/ui/codemap_tests/unicode_3.rs index 5294eedb84..81c3b5dde6 100644 --- a/src/test/ui/codemap_tests/unicode_3.rs +++ b/src/test/ui/codemap_tests/unicode_3.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + fn main() { let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } println!("{}", s); diff --git a/src/test/ui/codemap_tests/unicode_3.stderr b/src/test/ui/codemap_tests/unicode_3.stderr index a7514a6b79..3547accd2e 100644 --- a/src/test/ui/codemap_tests/unicode_3.stderr +++ b/src/test/ui/codemap_tests/unicode_3.stderr @@ -1,10 +1,8 @@ warning: denote infinite loops with `loop { ... }` - --> $DIR/unicode_3.rs:12:45 + --> $DIR/unicode_3.rs:14:45 | -12 | let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } - | ----------^^^^^^^^^^^ - | | - | help: use `loop` +14 | let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } + | ^^^^^^^^^^ help: use `loop` | = note: #[warn(while_true)] on by default diff --git a/src/test/ui/coercion-missing-tail-expected-type.rs b/src/test/ui/coercion-missing-tail-expected-type.rs index 15ce79a054..b235a0f213 100644 --- a/src/test/ui/coercion-missing-tail-expected-type.rs +++ b/src/test/ui/coercion-missing-tail-expected-type.rs @@ -10,11 +10,11 @@ // #41425 -- error message "mismatched types" has wrong types -fn plus_one(x: i32) -> i32 { +fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types x + 1; } -fn foo() -> Result<u8, u64> { +fn foo() -> Result<u8, u64> { //~ ERROR mismatched types Ok(1); } diff --git a/src/test/ui/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion-missing-tail-expected-type.stderr index 0de0a25e68..93f57216ca 100644 --- a/src/test/ui/coercion-missing-tail-expected-type.stderr +++ b/src/test/ui/coercion-missing-tail-expected-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:13:28 | -13 | fn plus_one(x: i32) -> i32 { +13 | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types | ____________________________^ 14 | | x + 1; | | - help: consider removing this semicolon @@ -14,7 +14,7 @@ error[E0308]: mismatched types error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:17:29 | -17 | fn foo() -> Result<u8, u64> { +17 | fn foo() -> Result<u8, u64> { //~ ERROR mismatched types | _____________________________^ 18 | | Ok(1); | | - help: consider removing this semicolon diff --git a/src/test/compile-fail/coherence-error-suppression.rs b/src/test/ui/coherence-error-suppression.rs similarity index 100% rename from src/test/compile-fail/coherence-error-suppression.rs rename to src/test/ui/coherence-error-suppression.rs diff --git a/src/test/ui/coherence-error-suppression.stderr b/src/test/ui/coherence-error-suppression.stderr new file mode 100644 index 0000000000..57b746f19e --- /dev/null +++ b/src/test/ui/coherence-error-suppression.stderr @@ -0,0 +1,8 @@ +error[E0412]: cannot find type `DoesNotExist` in this scope + --> $DIR/coherence-error-suppression.rs:19:14 + | +19 | impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope + | ^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-impls-copy.rs b/src/test/ui/coherence-impls-copy.rs similarity index 66% rename from src/test/compile-fail/coherence-impls-copy.rs rename to src/test/ui/coherence-impls-copy.rs index fe121a3bc4..51f43d27c3 100644 --- a/src/test/compile-fail/coherence-impls-copy.rs +++ b/src/test/ui/coherence-impls-copy.rs @@ -28,36 +28,22 @@ impl Copy for MyType {} impl Copy for &'static mut MyType {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration impl Clone for MyType { fn clone(&self) -> Self { *self } } impl Copy for (MyType, MyType) {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead impl Copy for &'static NotSync {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration impl Copy for [MyType] {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead -//~| NOTE impl doesn't use types inside crate impl Copy for &'static [NotSync] {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead fn main() { } diff --git a/src/test/ui/coherence-impls-copy.stderr b/src/test/ui/coherence-impls-copy.stderr new file mode 100644 index 0000000000..e5e91df771 --- /dev/null +++ b/src/test/ui/coherence-impls-copy.stderr @@ -0,0 +1,59 @@ +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:29:15 + | +29 | impl Copy for &'static mut MyType {} + | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:33:15 + | +33 | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:37:15 + | +37 | impl Copy for &'static NotSync {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:40:15 + | +40 | impl Copy for [MyType] {} + | ^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:44:15 + | +44 | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:33:1 + | +33 | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:40:1 + | +40 | impl Copy for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:44:1 + | +44 | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/coherence-overlap-downstream-inherent.rs b/src/test/ui/coherence-overlap-downstream-inherent.rs similarity index 79% rename from src/test/compile-fail/coherence-overlap-downstream-inherent.rs rename to src/test/ui/coherence-overlap-downstream-inherent.rs index 66068b5355..fd6e1d339f 100644 --- a/src/test/compile-fail/coherence-overlap-downstream-inherent.rs +++ b/src/test/ui/coherence-overlap-downstream-inherent.rs @@ -16,17 +16,12 @@ pub trait Sugar {} pub trait Fruit {} impl<T:Sugar> Sweet<T> { fn dummy(&self) { } } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` impl<T:Fruit> Sweet<T> { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` trait Bar<X> {} struct A<T, X>(T, X); impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `f` -//~| NOTE downstream crates may implement trait `Bar<_>` for type `i32` impl<X> A<i32, X> { fn f(&self) {} } -//~^ NOTE other definition for `f` fn main() {} diff --git a/src/test/ui/coherence-overlap-downstream-inherent.stderr b/src/test/ui/coherence-overlap-downstream-inherent.stderr new file mode 100644 index 0000000000..aca6800deb --- /dev/null +++ b/src/test/ui/coherence-overlap-downstream-inherent.stderr @@ -0,0 +1,22 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-downstream-inherent.rs:17:26 + | +17 | impl<T:Sugar> Sweet<T> { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +18 | //~^ ERROR E0592 +19 | impl<T:Fruit> Sweet<T> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + +error[E0592]: duplicate definitions with name `f` + --> $DIR/coherence-overlap-downstream-inherent.rs:23:38 + | +23 | impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} } + | ^^^^^^^^^^^^^^ duplicate definitions for `f` +24 | //~^ ERROR E0592 +25 | impl<X> A<i32, X> { fn f(&self) {} } + | -------------- other definition for `f` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/coherence-overlap-downstream.rs b/src/test/ui/coherence-overlap-downstream.rs similarity index 78% rename from src/test/compile-fail/coherence-overlap-downstream.rs rename to src/test/ui/coherence-overlap-downstream.rs index 1df02737de..63898ef9a2 100644 --- a/src/test/compile-fail/coherence-overlap-downstream.rs +++ b/src/test/ui/coherence-overlap-downstream.rs @@ -15,18 +15,13 @@ pub trait Sugar {} pub trait Fruit {} pub trait Sweet {} impl<T:Sugar> Sweet for T { } -//~^ NOTE first implementation here impl<T:Fruit> Sweet for T { } //~^ ERROR E0119 -//~| NOTE conflicting implementation pub trait Foo<X> {} pub trait Bar<X> {} impl<X, T> Foo<X> for T where T: Bar<X> {} -//~^ NOTE first implementation here impl<X> Foo<X> for i32 {} //~^ ERROR E0119 -//~| NOTE conflicting implementation for `i32` -//~| NOTE downstream crates may implement trait `Bar<_>` for type `i32` fn main() { } diff --git a/src/test/ui/coherence-overlap-downstream.stderr b/src/test/ui/coherence-overlap-downstream.stderr new file mode 100644 index 0000000000..c94ffd60d2 --- /dev/null +++ b/src/test/ui/coherence-overlap-downstream.stderr @@ -0,0 +1,20 @@ +error[E0119]: conflicting implementations of trait `Sweet`: + --> $DIR/coherence-overlap-downstream.rs:18:1 + | +17 | impl<T:Sugar> Sweet for T { } + | ------------------------- first implementation here +18 | impl<T:Fruit> Sweet for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: + --> $DIR/coherence-overlap-downstream.rs:24:1 + | +23 | impl<X, T> Foo<X> for T where T: Bar<X> {} + | --------------------------------------- first implementation here +24 | impl<X> Foo<X> for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs b/src/test/ui/coherence-overlap-issue-23516-inherent.rs similarity index 83% rename from src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs rename to src/test/ui/coherence-overlap-issue-23516-inherent.rs index 355af60710..94a7bdbc69 100644 --- a/src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs +++ b/src/test/ui/coherence-overlap-issue-23516-inherent.rs @@ -18,9 +18,6 @@ struct Cake<X>(X); impl<T:Sugar> Cake<T> { fn dummy(&self) { } } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` -//~| NOTE downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` fn main() { } diff --git a/src/test/ui/coherence-overlap-issue-23516-inherent.stderr b/src/test/ui/coherence-overlap-issue-23516-inherent.stderr new file mode 100644 index 0000000000..24d9b26fe9 --- /dev/null +++ b/src/test/ui/coherence-overlap-issue-23516-inherent.stderr @@ -0,0 +1,13 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-issue-23516-inherent.rs:19:25 + | +19 | impl<T:Sugar> Cake<T> { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +20 | //~^ ERROR E0592 +21 | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-overlap-issue-23516.rs b/src/test/ui/coherence-overlap-issue-23516.rs similarity index 82% rename from src/test/compile-fail/coherence-overlap-issue-23516.rs rename to src/test/ui/coherence-overlap-issue-23516.rs index ffef5bf108..3cd184b9be 100644 --- a/src/test/compile-fail/coherence-overlap-issue-23516.rs +++ b/src/test/ui/coherence-overlap-issue-23516.rs @@ -15,10 +15,7 @@ pub trait Sugar { fn dummy(&self) { } } pub trait Sweet { fn dummy(&self) { } } impl<T:Sugar> Sweet for T { } -//~^ NOTE first implementation here impl<U:Sugar> Sweet for Box<U> { } //~^ ERROR E0119 -//~| NOTE conflicting implementation for `std::boxed::Box<_>` -//~| NOTE downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` fn main() { } diff --git a/src/test/ui/coherence-overlap-issue-23516.stderr b/src/test/ui/coherence-overlap-issue-23516.stderr new file mode 100644 index 0000000000..c27e1ad762 --- /dev/null +++ b/src/test/ui/coherence-overlap-issue-23516.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: + --> $DIR/coherence-overlap-issue-23516.rs:18:1 + | +17 | impl<T:Sugar> Sweet for T { } + | ------------------------- first implementation here +18 | impl<U:Sugar> Sweet for Box<U> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-overlap-upstream-inherent.rs b/src/test/ui/coherence-overlap-upstream-inherent.rs similarity index 82% rename from src/test/compile-fail/coherence-overlap-upstream-inherent.rs rename to src/test/ui/coherence-overlap-upstream-inherent.rs index 1d0c63110c..a5a6a88a12 100644 --- a/src/test/compile-fail/coherence-overlap-upstream-inherent.rs +++ b/src/test/ui/coherence-overlap-upstream-inherent.rs @@ -20,9 +20,6 @@ use coherence_lib::Remote; struct A<X>(X); impl<T> A<T> where T: Remote { fn dummy(&self) { } } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` -//~| NOTE upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` impl A<i16> { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` fn main() {} diff --git a/src/test/ui/coherence-overlap-upstream-inherent.stderr b/src/test/ui/coherence-overlap-upstream-inherent.stderr new file mode 100644 index 0000000000..db32bcb81c --- /dev/null +++ b/src/test/ui/coherence-overlap-upstream-inherent.stderr @@ -0,0 +1,13 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-upstream-inherent.rs:21:32 + | +21 | impl<T> A<T> where T: Remote { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +22 | //~^ ERROR E0592 +23 | impl A<i16> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-overlap-upstream.rs b/src/test/ui/coherence-overlap-upstream.rs similarity index 81% rename from src/test/compile-fail/coherence-overlap-upstream.rs rename to src/test/ui/coherence-overlap-upstream.rs index e978143a06..f772848cb5 100644 --- a/src/test/compile-fail/coherence-overlap-upstream.rs +++ b/src/test/ui/coherence-overlap-upstream.rs @@ -19,10 +19,7 @@ use coherence_lib::Remote; trait Foo {} impl<T> Foo for T where T: Remote {} -//~^ NOTE first implementation here impl Foo for i16 {} //~^ ERROR E0119 -//~| NOTE conflicting implementation for `i16` -//~| NOTE upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` fn main() {} diff --git a/src/test/ui/coherence-overlap-upstream.stderr b/src/test/ui/coherence-overlap-upstream.stderr new file mode 100644 index 0000000000..9b5b67fe9c --- /dev/null +++ b/src/test/ui/coherence-overlap-upstream.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i16`: + --> $DIR/coherence-overlap-upstream.rs:22:1 + | +21 | impl<T> Foo for T where T: Remote {} + | --------------------------------- first implementation here +22 | impl Foo for i16 {} + | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + diff --git a/src/test/ui/command-line-diagnostics.rs b/src/test/ui/command-line-diagnostics.rs new file mode 100644 index 0000000000..ac631c2e45 --- /dev/null +++ b/src/test/ui/command-line-diagnostics.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This test checks the output format without the intermediate json representation +// compile-flags: --error-format=human + +pub fn main() { + let x = 42; + x = 43; +} diff --git a/src/test/ui/command-line-diagnostics.stderr b/src/test/ui/command-line-diagnostics.stderr new file mode 100644 index 0000000000..48ca45914c --- /dev/null +++ b/src/test/ui/command-line-diagnostics.stderr @@ -0,0 +1,10 @@ +error[E0384]: cannot assign twice to immutable variable `x` + --> $DIR/command-line-diagnostics.rs:16:5 + | +15 | let x = 42; + | - first assignment to `x` +16 | x = 43; + | ^^^^^^ cannot assign twice to immutable variable + +error: aborting due to previous error + diff --git a/src/test/ui/compare-method/proj-outlives-region.stderr b/src/test/ui/compare-method/proj-outlives-region.stderr index f871f034a9..e6e93d14b3 100644 --- a/src/test/ui/compare-method/proj-outlives-region.stderr +++ b/src/test/ui/compare-method/proj-outlives-region.stderr @@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait | --------------------- definition of `foo` from trait ... 19 | fn foo() where U: 'a { } //~ ERROR E0276 - | ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a` + | ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-extra-2.stderr b/src/test/ui/compare-method/region-extra-2.stderr index af974d5018..2b8a268fdc 100644 --- a/src/test/ui/compare-method/region-extra-2.stderr +++ b/src/test/ui/compare-method/region-extra-2.stderr @@ -1,14 +1,11 @@ error[E0276]: impl has stricter requirements than trait --> $DIR/region-extra-2.rs:19:5 | -15 | fn renew<'b: 'a>(self) -> &'b mut [T]; - | -------------------------------------- definition of `renew` from trait +15 | fn renew<'b: 'a>(self) -> &'b mut [T]; + | -------------------------------------- definition of `renew` from trait ... -19 | / fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { -20 | | //~^ ERROR E0276 -21 | | &mut self[..] -22 | | } - | |_____^ impl has extra requirement `'a: 'b` +19 | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-extra.rs b/src/test/ui/compare-method/region-extra.rs index e359f08096..9befa1ba60 100644 --- a/src/test/ui/compare-method/region-extra.rs +++ b/src/test/ui/compare-method/region-extra.rs @@ -16,7 +16,7 @@ trait Master<'a, 'b> { } impl<'a, 'b> Master<'a, 'b> for () { - fn foo() where 'a: 'b { } + fn foo() where 'a: 'b { } //~ ERROR impl has stricter } fn main() { diff --git a/src/test/ui/compare-method/region-extra.stderr b/src/test/ui/compare-method/region-extra.stderr index bc42b50581..d89b3a921b 100644 --- a/src/test/ui/compare-method/region-extra.stderr +++ b/src/test/ui/compare-method/region-extra.stderr @@ -4,8 +4,8 @@ error[E0276]: impl has stricter requirements than trait 15 | fn foo(); | --------- definition of `foo` from trait ... -19 | fn foo() where 'a: 'b { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` +19 | fn foo() where 'a: 'b { } //~ ERROR impl has stricter + | ^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-unrelated.rs b/src/test/ui/compare-method/region-unrelated.rs index 719e15fdb6..31ab6cb7fc 100644 --- a/src/test/ui/compare-method/region-unrelated.rs +++ b/src/test/ui/compare-method/region-unrelated.rs @@ -17,7 +17,7 @@ trait Master<'a, T: ?Sized, U> { // `U: 'a` does not imply `V: 'a` impl<'a, U, V> Master<'a, U, V> for () { fn foo() where V: 'a { } - //~^ ERROR parameter type `V` may not live long enough + //~^ ERROR impl has stricter requirements than trait } fn main() { diff --git a/src/test/ui/compare-method/region-unrelated.stderr b/src/test/ui/compare-method/region-unrelated.stderr index 1df83c7fb0..156143cd54 100644 --- a/src/test/ui/compare-method/region-unrelated.stderr +++ b/src/test/ui/compare-method/region-unrelated.stderr @@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait | --------------------- definition of `foo` from trait ... 19 | fn foo() where V: 'a { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a` + | ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a` error: aborting due to previous error diff --git a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr index 7112a00c7b..e3a1eb9ee6 100644 --- a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr +++ b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr @@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait | ---------------------------- definition of `b` from trait ... 25 | fn b<F: Sync, G>(&self, _x: F) -> F { panic!() } //~ ERROR E0276 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: std::marker::Sync` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: std::marker::Sync` error: aborting due to previous error diff --git a/src/test/ui/compare-method/traits-misc-mismatch-1.stderr b/src/test/ui/compare-method/traits-misc-mismatch-1.stderr index f221ebe330..ba5284eb65 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-1.stderr +++ b/src/test/ui/compare-method/traits-misc-mismatch-1.stderr @@ -5,7 +5,7 @@ error[E0276]: impl has stricter requirements than trait | -------------------------------- definition of `test_error1_fn` from trait ... 36 | fn test_error1_fn<T: Ord>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Ord` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Ord` error[E0276]: impl has stricter requirements than trait --> $DIR/traits-misc-mismatch-1.rs:40:5 @@ -14,7 +14,7 @@ error[E0276]: impl has stricter requirements than trait | -------------------------------------- definition of `test_error2_fn` from trait ... 40 | fn test_error2_fn<T: Eq + B>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait --> $DIR/traits-misc-mismatch-1.rs:44:5 @@ -23,7 +23,7 @@ error[E0276]: impl has stricter requirements than trait | -------------------------------------- definition of `test_error3_fn` from trait ... 44 | fn test_error3_fn<T: B + Eq>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait --> $DIR/traits-misc-mismatch-1.rs:54:5 @@ -32,7 +32,7 @@ error[E0276]: impl has stricter requirements than trait | ------------------------------- definition of `test_error5_fn` from trait ... 54 | fn test_error5_fn<T: B>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait --> $DIR/traits-misc-mismatch-1.rs:60:5 @@ -41,7 +41,7 @@ error[E0276]: impl has stricter requirements than trait | ------------------------------- definition of `test_error7_fn` from trait ... 60 | fn test_error7_fn<T: A + Eq>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Eq` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Eq` error[E0276]: impl has stricter requirements than trait --> $DIR/traits-misc-mismatch-1.rs:63:5 @@ -50,7 +50,7 @@ error[E0276]: impl has stricter requirements than trait | ------------------------------- definition of `test_error8_fn` from trait ... 63 | fn test_error8_fn<T: C>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: C` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: C` error[E0276]: impl has stricter requirements than trait --> $DIR/traits-misc-mismatch-1.rs:76:5 @@ -59,7 +59,7 @@ error[E0276]: impl has stricter requirements than trait | ---------------------------------- definition of `method` from trait ... 76 | fn method<G: Getter<usize>>(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `G: Getter<usize>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `G: Getter<usize>` error: aborting due to 7 previous errors diff --git a/src/test/ui/compare-method/traits-misc-mismatch-2.stderr b/src/test/ui/compare-method/traits-misc-mismatch-2.stderr index 622e144c53..983d87d5b8 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-2.stderr +++ b/src/test/ui/compare-method/traits-misc-mismatch-2.stderr @@ -1,14 +1,11 @@ error[E0276]: impl has stricter requirements than trait --> $DIR/traits-misc-mismatch-2.rs:23:5 | -19 | fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>; - | ------------------------------------------------------------------ definition of `zip` from trait +19 | fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>; + | ------------------------------------------------------------------ definition of `zip` from trait ... -23 | / fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> { -24 | | //~^ ERROR E0276 -25 | | ZipIterator{a: self, b: other} -26 | | } - | |_____^ impl has extra requirement `U: Iterator<B>` +23 | fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: Iterator<B>` error: aborting due to previous error diff --git a/src/test/compile-fail/const-deref-ptr.rs b/src/test/ui/const-deref-ptr.rs similarity index 90% rename from src/test/compile-fail/const-deref-ptr.rs rename to src/test/ui/const-deref-ptr.rs index c626801d48..fa15f3e87c 100644 --- a/src/test/compile-fail/const-deref-ptr.rs +++ b/src/test/ui/const-deref-ptr.rs @@ -12,6 +12,5 @@ fn main() { static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~ ERROR E0396 - //~| NOTE dereference of raw pointer in constant println!("{}", C); } diff --git a/src/test/ui/const-deref-ptr.stderr b/src/test/ui/const-deref-ptr.stderr new file mode 100644 index 0000000000..60f9a3a37b --- /dev/null +++ b/src/test/ui/const-deref-ptr.stderr @@ -0,0 +1,8 @@ +error[E0396]: raw pointers cannot be dereferenced in statics + --> $DIR/const-deref-ptr.rs:14:29 + | +14 | static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~ ERROR E0396 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer in constant + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-eval-overflow-2.rs b/src/test/ui/const-eval-overflow-2.rs similarity index 93% rename from src/test/compile-fail/const-eval-overflow-2.rs rename to src/test/ui/const-eval-overflow-2.rs index 0fd41a17b2..6b7f631ff4 100644 --- a/src/test/compile-fail/const-eval-overflow-2.rs +++ b/src/test/ui/const-eval-overflow-2.rs @@ -24,7 +24,7 @@ const NEG_NEG_128: i8 = -NEG_128; fn main() { match -128i8 { - NEG_NEG_128 => println!("A"), //~ NOTE for pattern here + NEG_NEG_128 => println!("A"), _ => println!("B"), } } diff --git a/src/test/ui/const-eval-overflow-2.stderr b/src/test/ui/const-eval-overflow-2.stderr new file mode 100644 index 0000000000..a9d29d0107 --- /dev/null +++ b/src/test/ui/const-eval-overflow-2.stderr @@ -0,0 +1,14 @@ +error[E0080]: constant evaluation error + --> $DIR/const-eval-overflow-2.rs:21:25 + | +21 | const NEG_NEG_128: i8 = -NEG_128; + | ^^^^^^^^ attempt to negate with overflow + | +note: for pattern here + --> $DIR/const-eval-overflow-2.rs:27:9 + | +27 | NEG_NEG_128 => println!("A"), + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-eval-overflow-4.rs b/src/test/ui/const-eval-overflow-4.rs similarity index 95% rename from src/test/compile-fail/const-eval-overflow-4.rs rename to src/test/ui/const-eval-overflow-4.rs index 06b7d0206b..4423fdec33 100644 --- a/src/test/compile-fail/const-eval-overflow-4.rs +++ b/src/test/ui/const-eval-overflow-4.rs @@ -22,7 +22,7 @@ use std::{u8, u16, u32, u64, usize}; const A_I8_T : [u32; (i8::MAX as i8 + 1i8) as usize] //~^ ERROR constant evaluation error - //~^^ NOTE attempt to add with overflow + //~| WARNING constant evaluation error = [0; (i8::MAX as usize) + 1]; fn main() { @@ -32,4 +32,3 @@ fn main() { fn foo<T:fmt::Debug>(x: T) { println!("{:?}", x); } - diff --git a/src/test/ui/const-eval-overflow-4.stderr b/src/test/ui/const-eval-overflow-4.stderr new file mode 100644 index 0000000000..98c6ae1b9b --- /dev/null +++ b/src/test/ui/const-eval-overflow-4.stderr @@ -0,0 +1,16 @@ +warning: constant evaluation error: attempt to add with overflow + --> $DIR/const-eval-overflow-4.rs:23:13 + | +23 | : [u32; (i8::MAX as i8 + 1i8) as usize] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(const_err)] on by default + +error[E0080]: constant evaluation error + --> $DIR/const-eval-overflow-4.rs:23:13 + | +23 | : [u32; (i8::MAX as i8 + 1i8) as usize] + | ^^^^^^^^^^^^^^^^^^^^^ attempt to add with overflow + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-eval-span.rs b/src/test/ui/const-eval-span.rs similarity index 95% rename from src/test/compile-fail/const-eval-span.rs rename to src/test/ui/const-eval-span.rs index 16f89606b0..f0fa1c0b9b 100644 --- a/src/test/compile-fail/const-eval-span.rs +++ b/src/test/ui/const-eval-span.rs @@ -19,7 +19,6 @@ enum E { V = CONSTANT, //~^ ERROR mismatched types //~| expected isize, found struct `S` - //~| NOTE expected type `isize` //~| found type `S` } diff --git a/src/test/ui/const-eval-span.stderr b/src/test/ui/const-eval-span.stderr new file mode 100644 index 0000000000..e64af57a18 --- /dev/null +++ b/src/test/ui/const-eval-span.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/const-eval-span.rs:19:9 + | +19 | V = CONSTANT, + | ^^^^^^^^ expected isize, found struct `S` + | + = note: expected type `isize` + found type `S` + +error: aborting due to previous error + diff --git a/src/test/ui/const-eval/issue-43197.rs b/src/test/ui/const-eval/issue-43197.rs index 1d4ded6e71..85ab2a0052 100644 --- a/src/test/ui/const-eval/issue-43197.rs +++ b/src/test/ui/const-eval/issue-43197.rs @@ -15,7 +15,9 @@ const fn foo(x: u32) -> u32 { } fn main() { - const X: u32 = 0-1; - const Y: u32 = foo(0-1); + const X: u32 = 0-1; //~ ERROR constant evaluation error + //~^ WARN constant evaluation error + const Y: u32 = foo(0-1); //~ ERROR constant evaluation error + //~^ WARN constant evaluation error println!("{} {}", X, Y); } diff --git a/src/test/ui/const-eval/issue-43197.stderr b/src/test/ui/const-eval/issue-43197.stderr index 58dedcfd9b..82baab620f 100644 --- a/src/test/ui/const-eval/issue-43197.stderr +++ b/src/test/ui/const-eval/issue-43197.stderr @@ -1,27 +1,27 @@ warning: constant evaluation error: attempt to subtract with overflow --> $DIR/issue-43197.rs:18:20 | -18 | const X: u32 = 0-1; +18 | const X: u32 = 0-1; //~ ERROR constant evaluation error | ^^^ | = note: #[warn(const_err)] on by default warning: constant evaluation error: attempt to subtract with overflow - --> $DIR/issue-43197.rs:19:20 + --> $DIR/issue-43197.rs:20:20 | -19 | const Y: u32 = foo(0-1); +20 | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error | ^^^^^^^^ error[E0080]: constant evaluation error --> $DIR/issue-43197.rs:18:20 | -18 | const X: u32 = 0-1; +18 | const X: u32 = 0-1; //~ ERROR constant evaluation error | ^^^ attempt to subtract with overflow error[E0080]: constant evaluation error - --> $DIR/issue-43197.rs:19:24 + --> $DIR/issue-43197.rs:20:24 | -19 | const Y: u32 = foo(0-1); +20 | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error | ^^^ attempt to subtract with overflow error: aborting due to 2 previous errors diff --git a/src/test/ui/const-expr-addr-operator.rs b/src/test/ui/const-expr-addr-operator.rs index 282b0d4e45..24d4457f01 100644 --- a/src/test/ui/const-expr-addr-operator.rs +++ b/src/test/ui/const-expr-addr-operator.rs @@ -12,9 +12,9 @@ pub fn main() { // Constant of generic type (int) - const X: &'static u32 = &22; + const X: &'static u32 = &22; //~ ERROR constant evaluation error assert_eq!(0, match &22 { X => 0, _ => 1, }); -} \ No newline at end of file +} diff --git a/src/test/ui/const-expr-addr-operator.stderr b/src/test/ui/const-expr-addr-operator.stderr index 5bda81451d..f6587c703b 100644 --- a/src/test/ui/const-expr-addr-operator.stderr +++ b/src/test/ui/const-expr-addr-operator.stderr @@ -1,7 +1,7 @@ error[E0080]: constant evaluation error --> $DIR/const-expr-addr-operator.rs:15:29 | -15 | const X: &'static u32 = &22; +15 | const X: &'static u32 = &22; //~ ERROR constant evaluation error | ^^^ unimplemented constant expression: address operator | note: for pattern here diff --git a/src/test/compile-fail/const-fn-error.rs b/src/test/ui/const-fn-error.rs similarity index 71% rename from src/test/compile-fail/const-fn-error.rs rename to src/test/ui/const-fn-error.rs index 385daef44d..ac1c2fe543 100644 --- a/src/test/compile-fail/const-fn-error.rs +++ b/src/test/ui/const-fn-error.rs @@ -13,8 +13,9 @@ const X : usize = 2; const fn f(x: usize) -> usize { - let mut sum = 0; - for i in 0..x { + let mut sum = 0; //~ ERROR blocks in constant functions are limited + for i in 0..x { //~ ERROR calls in constant functions + //~| ERROR constant function contains unimplemented sum += i; } sum //~ ERROR E0080 @@ -23,5 +24,6 @@ const fn f(x: usize) -> usize { #[allow(unused_variables)] fn main() { - let a : [i32; f(X)]; //~ NOTE for constant expression here + let a : [i32; f(X)]; + //~^ WARNING constant evaluation error: non-constant path } diff --git a/src/test/ui/const-fn-error.stderr b/src/test/ui/const-fn-error.stderr new file mode 100644 index 0000000000..0e275e78fc --- /dev/null +++ b/src/test/ui/const-fn-error.stderr @@ -0,0 +1,46 @@ +warning: constant evaluation error: non-constant path in constant expression + --> $DIR/const-fn-error.rs:27:19 + | +27 | let a : [i32; f(X)]; + | ^^^^ + | + = note: #[warn(const_err)] on by default + +error[E0016]: blocks in constant functions are limited to items and tail expressions + --> $DIR/const-fn-error.rs:16:19 + | +16 | let mut sum = 0; //~ ERROR blocks in constant functions are limited + | ^ + +error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors + --> $DIR/const-fn-error.rs:17:5 + | +17 | / for i in 0..x { //~ ERROR calls in constant functions +18 | | //~| ERROR constant function contains unimplemented +19 | | sum += i; +20 | | } + | |_____^ + +error[E0019]: constant function contains unimplemented expression type + --> $DIR/const-fn-error.rs:17:5 + | +17 | / for i in 0..x { //~ ERROR calls in constant functions +18 | | //~| ERROR constant function contains unimplemented +19 | | sum += i; +20 | | } + | |_____^ + +error[E0080]: constant evaluation error + --> $DIR/const-fn-error.rs:21:5 + | +21 | sum //~ ERROR E0080 + | ^^^ non-constant path in constant expression + | +note: for constant expression here + --> $DIR/const-fn-error.rs:27:13 + | +27 | let a : [i32; f(X)]; + | ^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/const-fn-mismatch.rs b/src/test/ui/const-fn-mismatch.rs similarity index 95% rename from src/test/compile-fail/const-fn-mismatch.rs rename to src/test/ui/const-fn-mismatch.rs index 7ea72e2377..4e1fa6bd18 100644 --- a/src/test/compile-fail/const-fn-mismatch.rs +++ b/src/test/ui/const-fn-mismatch.rs @@ -22,7 +22,6 @@ trait Foo { impl Foo for u32 { const fn f() -> u32 { 22 } //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const } fn main() { } diff --git a/src/test/ui/const-fn-mismatch.stderr b/src/test/ui/const-fn-mismatch.stderr new file mode 100644 index 0000000000..4f6a98fb8e --- /dev/null +++ b/src/test/ui/const-fn-mismatch.stderr @@ -0,0 +1,8 @@ +error[E0379]: trait fns cannot be declared const + --> $DIR/const-fn-mismatch.rs:23:5 + | +23 | const fn f() -> u32 { 22 } + | ^^^^^ trait fns cannot be const + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-fn-not-in-trait.rs b/src/test/ui/const-fn-not-in-trait.rs similarity index 90% rename from src/test/compile-fail/const-fn-not-in-trait.rs rename to src/test/ui/const-fn-not-in-trait.rs index 257d4d5ee9..1877929173 100644 --- a/src/test/compile-fail/const-fn-not-in-trait.rs +++ b/src/test/ui/const-fn-not-in-trait.rs @@ -16,10 +16,8 @@ trait Foo { const fn f() -> u32; //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const const fn g() -> u32 { 0 } //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const } fn main() { } diff --git a/src/test/ui/const-fn-not-in-trait.stderr b/src/test/ui/const-fn-not-in-trait.stderr new file mode 100644 index 0000000000..d23bf3b411 --- /dev/null +++ b/src/test/ui/const-fn-not-in-trait.stderr @@ -0,0 +1,14 @@ +error[E0379]: trait fns cannot be declared const + --> $DIR/const-fn-not-in-trait.rs:17:5 + | +17 | const fn f() -> u32; + | ^^^^^ trait fns cannot be const + +error[E0379]: trait fns cannot be declared const + --> $DIR/const-fn-not-in-trait.rs:19:5 + | +19 | const fn g() -> u32 { 0 } + | ^^^^^ trait fns cannot be const + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/const-len-underflow-separate-spans.rs b/src/test/ui/const-len-underflow-separate-spans.rs similarity index 88% rename from src/test/compile-fail/const-len-underflow-separate-spans.rs rename to src/test/ui/const-len-underflow-separate-spans.rs index 3c84810554..823cc98894 100644 --- a/src/test/compile-fail/const-len-underflow-separate-spans.rs +++ b/src/test/ui/const-len-underflow-separate-spans.rs @@ -15,10 +15,9 @@ const ONE: usize = 1; const TWO: usize = 2; const LEN: usize = ONE - TWO; -//~^ ERROR E0080 -//~| attempt to subtract with overflow +//~^ ERROR constant evaluation error [E0080] +//~| WARN attempt to subtract with overflow fn main() { let a: [i8; LEN] = unimplemented!(); - //~^ NOTE for constant expression here } diff --git a/src/test/ui/const-len-underflow-separate-spans.stderr b/src/test/ui/const-len-underflow-separate-spans.stderr new file mode 100644 index 0000000000..6e6c2130e1 --- /dev/null +++ b/src/test/ui/const-len-underflow-separate-spans.stderr @@ -0,0 +1,22 @@ +warning: constant evaluation error: attempt to subtract with overflow + --> $DIR/const-len-underflow-separate-spans.rs:17:20 + | +17 | const LEN: usize = ONE - TWO; + | ^^^^^^^^^ + | + = note: #[warn(const_err)] on by default + +error[E0080]: constant evaluation error + --> $DIR/const-len-underflow-separate-spans.rs:17:20 + | +17 | const LEN: usize = ONE - TWO; + | ^^^^^^^^^ attempt to subtract with overflow + | +note: for constant expression here + --> $DIR/const-len-underflow-separate-spans.rs:22:12 + | +22 | let a: [i8; LEN] = unimplemented!(); + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-pattern-not-const-evaluable.rs b/src/test/ui/const-pattern-not-const-evaluable.rs similarity index 94% rename from src/test/compile-fail/const-pattern-not-const-evaluable.rs rename to src/test/ui/const-pattern-not-const-evaluable.rs index 71cac3edbc..263c0bdc64 100644 --- a/src/test/compile-fail/const-pattern-not-const-evaluable.rs +++ b/src/test/ui/const-pattern-not-const-evaluable.rs @@ -34,7 +34,7 @@ const GOO: Cake = foo(); fn main() { match BlackForest { - FOO => println!("hi"), //~ NOTE: for pattern here + FOO => println!("hi"), GOO => println!("meh"), WORKS => println!("möp"), _ => println!("bye"), diff --git a/src/test/ui/const-pattern-not-const-evaluable.stderr b/src/test/ui/const-pattern-not-const-evaluable.stderr new file mode 100644 index 0000000000..5441937e4d --- /dev/null +++ b/src/test/ui/const-pattern-not-const-evaluable.stderr @@ -0,0 +1,14 @@ +error[E0080]: constant evaluation error + --> $DIR/const-pattern-not-const-evaluable.rs:22:31 + | +22 | const BOO: Pair<Cake, Cake> = Pair(Marmor, BlackForest); + | ^^^^ unimplemented constant expression: tuple struct constructors + | +note: for pattern here + --> $DIR/const-pattern-not-const-evaluable.rs:37:9 + | +37 | FOO => println!("hi"), + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-unsized.rs b/src/test/ui/const-unsized.rs similarity index 67% rename from src/test/compile-fail/const-unsized.rs rename to src/test/ui/const-unsized.rs index 4b212814de..c6ce34b60c 100644 --- a/src/test/compile-fail/const-unsized.rs +++ b/src/test/ui/const-unsized.rs @@ -12,23 +12,15 @@ use std::fmt::Debug; const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); //~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size const CONST_FOO: str = *"foo"; //~^ ERROR `str: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); //~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size static STATIC_BAR: str = *"bar"; //~^ ERROR `str: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size fn main() { println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); diff --git a/src/test/ui/const-unsized.stderr b/src/test/ui/const-unsized.stderr new file mode 100644 index 0000000000..ba948643a3 --- /dev/null +++ b/src/test/ui/const-unsized.stderr @@ -0,0 +1,38 @@ +error[E0277]: the trait bound `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:13:29 + | +13 | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); + | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: constant expressions must have a statically known size + +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:16:24 + | +16 | const CONST_FOO: str = *"foo"; + | ^^^^^^ `str` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: constant expressions must have a statically known size + +error[E0277]: the trait bound `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:19:31 + | +19 | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); + | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: constant expressions must have a statically known size + +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:22:26 + | +22 | static STATIC_BAR: str = *"bar"; + | ^^^^^^ `str` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: constant expressions must have a statically known size + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/cross-crate-macro-backtrace/main.rs b/src/test/ui/cross-crate-macro-backtrace/main.rs index f8bb84abcd..85640087a9 100644 --- a/src/test/ui/cross-crate-macro-backtrace/main.rs +++ b/src/test/ui/cross-crate-macro-backtrace/main.rs @@ -8,10 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// error-pattern: in format string + // aux-build:extern_macro_crate.rs #[macro_use(myprintln, myprint)] extern crate extern_macro_crate; fn main() { - myprintln!("{}"); //~ ERROR in this macro + myprintln!("{}"); } diff --git a/src/test/ui/cross-crate-macro-backtrace/main.stderr b/src/test/ui/cross-crate-macro-backtrace/main.stderr index 4dad6d60b4..fc2343bdb1 100644 --- a/src/test/ui/cross-crate-macro-backtrace/main.stderr +++ b/src/test/ui/cross-crate-macro-backtrace/main.stderr @@ -1,10 +1,10 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/main.rs:16:5 + --> $DIR/main.rs:18:5 | -16 | myprintln!("{}"); //~ ERROR in this macro +18 | myprintln!("{}"); | ^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/compile-fail/cycle-trait-supertrait-indirect.rs b/src/test/ui/cycle-trait-supertrait-indirect.rs similarity index 74% rename from src/test/compile-fail/cycle-trait-supertrait-indirect.rs rename to src/test/ui/cycle-trait-supertrait-indirect.rs index 905d546e99..c3b0276bcf 100644 --- a/src/test/compile-fail/cycle-trait-supertrait-indirect.rs +++ b/src/test/ui/cycle-trait-supertrait-indirect.rs @@ -12,16 +12,13 @@ // a direct participant in the cycle. trait A: B { - //~^ NOTE the cycle begins when computing the supertraits of `B`... } trait B: C { - //~^ NOTE ...which then requires computing the supertraits of `C`... } trait C: B { } //~^ ERROR unsupported cyclic reference //~| cyclic reference - //~| NOTE ...which then again requires computing the supertraits of `B`, completing the cycle fn main() { } diff --git a/src/test/ui/cycle-trait-supertrait-indirect.stderr b/src/test/ui/cycle-trait-supertrait-indirect.stderr new file mode 100644 index 0000000000..107644037a --- /dev/null +++ b/src/test/ui/cycle-trait-supertrait-indirect.stderr @@ -0,0 +1,20 @@ +error[E0391]: unsupported cyclic reference between types/traits detected + --> $DIR/cycle-trait-supertrait-indirect.rs:20:1 + | +20 | trait C: B { } + | ^^^^^^^^^^ cyclic reference + | +note: the cycle begins when computing the supertraits of `B`... + --> $DIR/cycle-trait-supertrait-indirect.rs:14:1 + | +14 | trait A: B { + | ^^^^^^^^^^ +note: ...which then requires computing the supertraits of `C`... + --> $DIR/cycle-trait-supertrait-indirect.rs:17:1 + | +17 | trait B: C { + | ^^^^^^^^^^ + = note: ...which then again requires computing the supertraits of `B`, completing the cycle. + +error: aborting due to previous error + diff --git a/src/test/ui/deprecated-macro_escape-inner.rs b/src/test/ui/deprecated-macro_escape-inner.rs index 3d253ba49d..dce80698de 100644 --- a/src/test/ui/deprecated-macro_escape-inner.rs +++ b/src/test/ui/deprecated-macro_escape-inner.rs @@ -12,7 +12,6 @@ mod foo { #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use - //~^ HELP consider an outer attribute } fn main() { diff --git a/src/test/ui/deref-suggestion.rs b/src/test/ui/deref-suggestion.rs index 16d8226bfe..04ba4ab905 100644 --- a/src/test/ui/deref-suggestion.rs +++ b/src/test/ui/deref-suggestion.rs @@ -9,26 +9,26 @@ // except according to those terms. macro_rules! borrow { - ($x:expr) => { &$x } + ($x:expr) => { &$x } //~ ERROR mismatched types } fn foo(_: String) {} fn foo2(s: &String) { - foo(s); + foo(s); //~ ERROR mismatched types } fn foo3(_: u32) {} fn foo4(u: &u32) { - foo3(u); + foo3(u); //~ ERROR mismatched types } fn main() { let s = String::new(); let r_s = &s; foo2(r_s); - foo(&"aaa".to_owned()); - foo(&mut "aaa".to_owned()); + foo(&"aaa".to_owned()); //~ ERROR mismatched types + foo(&mut "aaa".to_owned()); //~ ERROR mismatched types foo3(borrow!(0)); foo4(&0); } diff --git a/src/test/ui/deref-suggestion.stderr b/src/test/ui/deref-suggestion.stderr index 3ed3297e05..98ec3d9693 100644 --- a/src/test/ui/deref-suggestion.stderr +++ b/src/test/ui/deref-suggestion.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:18:9 | -18 | foo(s); +18 | foo(s); //~ ERROR mismatched types | ^ expected struct `std::string::String`, found reference | = note: expected type `std::string::String` @@ -16,37 +16,43 @@ error[E0308]: mismatched types error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:23:10 | -23 | foo3(u); - | ^ expected u32, found &u32 +23 | foo3(u); //~ ERROR mismatched types + | ^ + | | + | expected u32, found &u32 + | help: consider dereferencing the borrow: `*u` | = note: expected type `u32` found type `&u32` - = help: try with `*u` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:30:9 | -30 | foo(&"aaa".to_owned()); - | ^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found reference +30 | foo(&"aaa".to_owned()); //~ ERROR mismatched types + | ^^^^^^^^^^^^^^^^^ + | | + | expected struct `std::string::String`, found reference + | help: consider removing the borrow: `"aaa".to_owned()` | = note: expected type `std::string::String` found type `&std::string::String` - = help: try with `"aaa".to_owned()` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:31:9 | -31 | foo(&mut "aaa".to_owned()); - | ^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found mutable reference +31 | foo(&mut "aaa".to_owned()); //~ ERROR mismatched types + | ^^^^^^^^^^^^^^^^^^^^^ + | | + | expected struct `std::string::String`, found mutable reference + | help: consider removing the borrow: `"aaa".to_owned()` | = note: expected type `std::string::String` found type `&mut std::string::String` - = help: try with `"aaa".to_owned()` error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:12:20 | -12 | ($x:expr) => { &$x } +12 | ($x:expr) => { &$x } //~ ERROR mismatched types | ^^^ expected u32, found &{integer} ... 32 | foo3(borrow!(0)); diff --git a/src/test/compile-fail/derived-errors/issue-31997-1.rs b/src/test/ui/derived-errors/issue-31997-1.rs similarity index 97% rename from src/test/compile-fail/derived-errors/issue-31997-1.rs rename to src/test/ui/derived-errors/issue-31997-1.rs index 6a9d8db965..7d79c48c06 100644 --- a/src/test/compile-fail/derived-errors/issue-31997-1.rs +++ b/src/test/ui/derived-errors/issue-31997-1.rs @@ -29,7 +29,6 @@ fn main() { let mut map = HashMap::new(); //~^ ERROR E0433 - //~| NOTE Use of undeclared type or module `HashMap` for line in input.lines() { let line = line.unwrap(); diff --git a/src/test/ui/derived-errors/issue-31997-1.stderr b/src/test/ui/derived-errors/issue-31997-1.stderr new file mode 100644 index 0000000000..732cf9bacb --- /dev/null +++ b/src/test/ui/derived-errors/issue-31997-1.stderr @@ -0,0 +1,8 @@ +error[E0433]: failed to resolve. Use of undeclared type or module `HashMap` + --> $DIR/issue-31997-1.rs:30:19 + | +30 | let mut map = HashMap::new(); + | ^^^^^^^ Use of undeclared type or module `HashMap` + +error: aborting due to previous error + diff --git a/src/test/ui/deriving-with-repr-packed.rs b/src/test/ui/deriving-with-repr-packed.rs new file mode 100644 index 0000000000..0c52829799 --- /dev/null +++ b/src/test/ui/deriving-with-repr-packed.rs @@ -0,0 +1,41 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(safe_packed_borrows)] + +// check that derive on a packed struct with non-Copy fields +// correctly. This can't be made to work perfectly because +// we can't just use the field from the struct as it might +// not be aligned. + +#[derive(Copy, Clone, PartialEq, Eq)] +//~^ ERROR #[derive] can't be used +//~| hard error +//~^^^ ERROR #[derive] can't be used +//~| hard error +#[repr(packed)] +pub struct Foo<T>(T, T, T); + +#[derive(PartialEq, Eq)] +//~^ ERROR #[derive] can't be used +//~| hard error +#[repr(packed)] +pub struct Bar(u32, u32, u32); + +#[derive(PartialEq)] +struct Y(usize); + +#[derive(PartialEq)] +//~^ ERROR #[derive] can't be used on a non-Copy #[repr(packed)] +//~| hard error +#[repr(packed)] +struct X(Y); + +fn main() {} diff --git a/src/test/ui/deriving-with-repr-packed.stderr b/src/test/ui/deriving-with-repr-packed.stderr new file mode 100644 index 0000000000..48208faa6b --- /dev/null +++ b/src/test/ui/deriving-with-repr-packed.stderr @@ -0,0 +1,43 @@ +error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) + --> $DIR/deriving-with-repr-packed.rs:18:16 + | +18 | #[derive(Copy, Clone, PartialEq, Eq)] + | ^^^^^ + | +note: lint level defined here + --> $DIR/deriving-with-repr-packed.rs:11:9 + | +11 | #![deny(safe_packed_borrows)] + | ^^^^^^^^^^^^^^^^^^^ + = 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 #46043 <https://github.com/rust-lang/rust/issues/46043> + +error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) + --> $DIR/deriving-with-repr-packed.rs:18:23 + | +18 | #[derive(Copy, Clone, PartialEq, Eq)] + | ^^^^^^^^^ + | + = 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 #46043 <https://github.com/rust-lang/rust/issues/46043> + +error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133) + --> $DIR/deriving-with-repr-packed.rs:26:10 + | +26 | #[derive(PartialEq, Eq)] + | ^^^^^^^^^ + | + = 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 #46043 <https://github.com/rust-lang/rust/issues/46043> + +error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133) + --> $DIR/deriving-with-repr-packed.rs:35:10 + | +35 | #[derive(PartialEq)] + | ^^^^^^^^^ + | + = 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 #46043 <https://github.com/rust-lang/rust/issues/46043> + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/did_you_mean/E0178.rs b/src/test/ui/did_you_mean/E0178.rs index 8fb6c9815c..21cdb38fdb 100644 --- a/src/test/ui/did_you_mean/E0178.rs +++ b/src/test/ui/did_you_mean/E0178.rs @@ -11,10 +11,10 @@ trait Foo {} struct Bar<'a> { - w: &'a Foo + Copy, - x: &'a Foo + 'a, - y: &'a mut Foo + 'a, - z: fn() -> Foo + 'a, + w: &'a Foo + Copy, //~ ERROR expected a path + x: &'a Foo + 'a, //~ ERROR expected a path + y: &'a mut Foo + 'a, //~ ERROR expected a path + z: fn() -> Foo + 'a, //~ ERROR expected a path } fn main() { diff --git a/src/test/ui/did_you_mean/E0178.stderr b/src/test/ui/did_you_mean/E0178.stderr index 15e7131cfd..4fe8849fee 100644 --- a/src/test/ui/did_you_mean/E0178.stderr +++ b/src/test/ui/did_you_mean/E0178.stderr @@ -1,25 +1,25 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:14:8 | -14 | w: &'a Foo + Copy, +14 | w: &'a Foo + Copy, //~ ERROR expected a path | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:15:8 | -15 | x: &'a Foo + 'a, +15 | x: &'a Foo + 'a, //~ ERROR expected a path | ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo` --> $DIR/E0178.rs:16:8 | -16 | y: &'a mut Foo + 'a, +16 | y: &'a mut Foo + 'a, //~ ERROR expected a path | ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo` --> $DIR/E0178.rs:17:8 | -17 | z: fn() -> Foo + 'a, +17 | z: fn() -> Foo + 'a, //~ ERROR expected a path | ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses? error: aborting due to 4 previous errors diff --git a/src/test/ui/did_you_mean/bad-assoc-expr.rs b/src/test/ui/did_you_mean/bad-assoc-expr.rs new file mode 100644 index 0000000000..779aa952c8 --- /dev/null +++ b/src/test/ui/did_you_mean/bad-assoc-expr.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let a = [1, 2, 3, 4]; + [i32; 4]::clone(&a); + //~^ ERROR missing angle brackets in associated item path + + [i32]::as_ref(&a); + //~^ ERROR missing angle brackets in associated item path + + (u8)::clone(&0); + //~^ ERROR missing angle brackets in associated item path + + (u8, u8)::clone(&(0, 0)); + //~^ ERROR missing angle brackets in associated item path + + &(u8)::clone(&0); + //~^ ERROR missing angle brackets in associated item path + + 10 + (u8)::clone(&0); + //~^ ERROR missing angle brackets in associated item path +} diff --git a/src/test/ui/did_you_mean/bad-assoc-expr.stderr b/src/test/ui/did_you_mean/bad-assoc-expr.stderr new file mode 100644 index 0000000000..1affdc5fda --- /dev/null +++ b/src/test/ui/did_you_mean/bad-assoc-expr.stderr @@ -0,0 +1,38 @@ +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-expr.rs:13:5 + | +13 | [i32; 4]::clone(&a); + | ^^^^^^^^^^^^^^^ help: try: `<[i32; 4]>::clone` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-expr.rs:16:5 + | +16 | [i32]::as_ref(&a); + | ^^^^^^^^^^^^^ help: try: `<[i32]>::as_ref` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-expr.rs:19:5 + | +19 | (u8)::clone(&0); + | ^^^^^^^^^^^ help: try: `<(u8)>::clone` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-expr.rs:22:5 + | +22 | (u8, u8)::clone(&(0, 0)); + | ^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::clone` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-expr.rs:25:6 + | +25 | &(u8)::clone(&0); + | ^^^^^^^^^^^ help: try: `<(u8)>::clone` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-expr.rs:28:10 + | +28 | 10 + (u8)::clone(&0); + | ^^^^^^^^^^^ help: try: `<(u8)>::clone` + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.rs b/src/test/ui/did_you_mean/bad-assoc-pat.rs new file mode 100644 index 0000000000..bf6be0ee98 --- /dev/null +++ b/src/test/ui/did_you_mean/bad-assoc-pat.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + match 0u8 { + [u8]::AssocItem => {} + //~^ ERROR missing angle brackets in associated item path + //~| ERROR no associated item named `AssocItem` found for type `[u8]` in the current scope + (u8, u8)::AssocItem => {} + //~^ ERROR missing angle brackets in associated item path + //~| ERROR no associated item named `AssocItem` found for type `(u8, u8)` in the current sco + _::AssocItem => {} + //~^ ERROR missing angle brackets in associated item path + //~| ERROR no associated item named `AssocItem` found for type `_` in the current scope + } + match &0u8 { + &(u8,)::AssocItem => {} + //~^ ERROR missing angle brackets in associated item path + //~| ERROR no associated item named `AssocItem` found for type `(u8,)` in the current scope + } +} diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.stderr b/src/test/ui/did_you_mean/bad-assoc-pat.stderr new file mode 100644 index 0000000000..1ca4576d88 --- /dev/null +++ b/src/test/ui/did_you_mean/bad-assoc-pat.stderr @@ -0,0 +1,50 @@ +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-pat.rs:13:9 + | +13 | [u8]::AssocItem => {} + | ^^^^^^^^^^^^^^^ help: try: `<[u8]>::AssocItem` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-pat.rs:16:9 + | +16 | (u8, u8)::AssocItem => {} + | ^^^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocItem` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-pat.rs:19:9 + | +19 | _::AssocItem => {} + | ^^^^^^^^^^^^ help: try: `<_>::AssocItem` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-pat.rs:24:10 + | +24 | &(u8,)::AssocItem => {} + | ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem` + +error[E0599]: no associated item named `AssocItem` found for type `[u8]` in the current scope + --> $DIR/bad-assoc-pat.rs:13:9 + | +13 | [u8]::AssocItem => {} + | ^^^^^^^^^^^^^^^ associated item not found in `[u8]` + +error[E0599]: no associated item named `AssocItem` found for type `(u8, u8)` in the current scope + --> $DIR/bad-assoc-pat.rs:16:9 + | +16 | (u8, u8)::AssocItem => {} + | ^^^^^^^^^^^^^^^^^^^ associated item not found in `(u8, u8)` + +error[E0599]: no associated item named `AssocItem` found for type `_` in the current scope + --> $DIR/bad-assoc-pat.rs:19:9 + | +19 | _::AssocItem => {} + | ^^^^^^^^^^^^ associated item not found in `_` + +error[E0599]: no associated item named `AssocItem` found for type `(u8,)` in the current scope + --> $DIR/bad-assoc-pat.rs:24:10 + | +24 | &(u8,)::AssocItem => {} + | ^^^^^^^^^^^^^^^^ associated item not found in `(u8,)` + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.rs b/src/test/ui/did_you_mean/bad-assoc-ty.rs new file mode 100644 index 0000000000..b4a59904ee --- /dev/null +++ b/src/test/ui/did_you_mean/bad-assoc-ty.rs @@ -0,0 +1,46 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +type A = [u8; 4]::AssocTy; +//~^ ERROR missing angle brackets in associated item path +//~| ERROR ambiguous associated type + +type B = [u8]::AssocTy; +//~^ ERROR missing angle brackets in associated item path +//~| ERROR ambiguous associated type + +type C = (u8)::AssocTy; +//~^ ERROR missing angle brackets in associated item path +//~| ERROR ambiguous associated type + +type D = (u8, u8)::AssocTy; +//~^ ERROR missing angle brackets in associated item path +//~| ERROR ambiguous associated type + +type E = _::AssocTy; +//~^ ERROR missing angle brackets in associated item path +//~| ERROR the type placeholder `_` is not allowed within types on item signatures + +type F = &'static (u8)::AssocTy; +//~^ ERROR missing angle brackets in associated item path +//~| ERROR ambiguous associated type + +// Qualified paths cannot appear in bounds, so the recovery +// should apply to the whole sum and not `(Send)`. +type G = 'static + (Send)::AssocTy; +//~^ ERROR missing angle brackets in associated item path +//~| ERROR ambiguous associated type + +// This is actually a legal path with fn-like generic arguments in the middle! +// Recovery should not apply in this context. +type H = Fn(u8) -> (u8)::Output; +//~^ ERROR ambiguous associated type + +fn main() {} diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr new file mode 100644 index 0000000000..c44dc5a046 --- /dev/null +++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr @@ -0,0 +1,106 @@ +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-ty.rs:11:10 + | +11 | type A = [u8; 4]::AssocTy; + | ^^^^^^^^^^^^^^^^ help: try: `<[u8; 4]>::AssocTy` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-ty.rs:15:10 + | +15 | type B = [u8]::AssocTy; + | ^^^^^^^^^^^^^ help: try: `<[u8]>::AssocTy` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-ty.rs:19:10 + | +19 | type C = (u8)::AssocTy; + | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-ty.rs:23:10 + | +23 | type D = (u8, u8)::AssocTy; + | ^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocTy` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-ty.rs:27:10 + | +27 | type E = _::AssocTy; + | ^^^^^^^^^^ help: try: `<_>::AssocTy` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-ty.rs:31:19 + | +31 | type F = &'static (u8)::AssocTy; + | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy` + +error: missing angle brackets in associated item path + --> $DIR/bad-assoc-ty.rs:37:10 + | +37 | type G = 'static + (Send)::AssocTy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<'static + Send>::AssocTy` + +error[E0223]: ambiguous associated type + --> $DIR/bad-assoc-ty.rs:11:10 + | +11 | type A = [u8; 4]::AssocTy; + | ^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<[u8; <unevaluated[]>] as Trait>::AssocTy` + +error[E0223]: ambiguous associated type + --> $DIR/bad-assoc-ty.rs:15:10 + | +15 | type B = [u8]::AssocTy; + | ^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<[u8] as Trait>::AssocTy` + +error[E0223]: ambiguous associated type + --> $DIR/bad-assoc-ty.rs:19:10 + | +19 | type C = (u8)::AssocTy; + | ^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<u8 as Trait>::AssocTy` + +error[E0223]: ambiguous associated type + --> $DIR/bad-assoc-ty.rs:23:10 + | +23 | type D = (u8, u8)::AssocTy; + | ^^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<(u8, u8) as Trait>::AssocTy` + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/bad-assoc-ty.rs:27:10 + | +27 | type E = _::AssocTy; + | ^ not allowed in type signatures + +error[E0223]: ambiguous associated type + --> $DIR/bad-assoc-ty.rs:31:19 + | +31 | type F = &'static (u8)::AssocTy; + | ^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<u8 as Trait>::AssocTy` + +error[E0223]: ambiguous associated type + --> $DIR/bad-assoc-ty.rs:37:10 + | +37 | type G = 'static + (Send)::AssocTy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<std::marker::Send + 'static as Trait>::AssocTy` + +error[E0223]: ambiguous associated type + --> $DIR/bad-assoc-ty.rs:43:10 + | +43 | type H = Fn(u8) -> (u8)::Output; + | ^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<std::ops::Fn(u8) -> u8 + 'static as Trait>::Output` + +error: aborting due to 15 previous errors + diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs index 99035209e1..076b61b179 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs @@ -33,7 +33,4 @@ fn main() { f1.foo(1usize); //~^ error: the trait bound `Bar: Foo<usize>` is not satisfied - //~| help: the following implementations were found: - //~| help: <Bar as Foo<i32>> - //~| help: <Bar as Foo<u8>> } diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs index 2009c32c85..6beff6ba2a 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs @@ -37,10 +37,4 @@ fn main() { f1.foo(1usize); //~^ error: the trait bound `Bar: Foo<usize>` is not satisfied - //~| help: the following implementations were found: - //~| help: <Bar as Foo<i8>> - //~| help: <Bar as Foo<i16>> - //~| help: <Bar as Foo<i32>> - //~| help: <Bar as Foo<u8>> - //~| help: and 2 others } diff --git a/src/test/ui/did_you_mean/issue-31424.rs b/src/test/ui/did_you_mean/issue-31424.rs index 374d06bb71..1b31e06433 100644 --- a/src/test/ui/did_you_mean/issue-31424.rs +++ b/src/test/ui/did_you_mean/issue-31424.rs @@ -14,13 +14,13 @@ struct Struct; impl Struct { fn foo(&mut self) { - (&mut self).bar(); + (&mut self).bar(); //~ ERROR cannot borrow } // In this case we could keep the suggestion, but to distinguish the // two cases is pretty hard. It's an obscure case anyway. fn bar(self: &mut Self) { - (&mut self).bar(); + (&mut self).bar(); //~ ERROR cannot borrow } } diff --git a/src/test/ui/did_you_mean/issue-31424.stderr b/src/test/ui/did_you_mean/issue-31424.stderr index 47dc7c9757..cd96d28ac9 100644 --- a/src/test/ui/did_you_mean/issue-31424.stderr +++ b/src/test/ui/did_you_mean/issue-31424.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-31424.rs:17:15 | -17 | (&mut self).bar(); +17 | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^ | | | cannot reborrow mutably @@ -12,7 +12,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable | 22 | fn bar(self: &mut Self) { | --------------- consider changing this to `mut self: &mut Self` -23 | (&mut self).bar(); +23 | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^ cannot borrow mutably error: aborting due to 2 previous errors diff --git a/src/test/ui/did_you_mean/issue-34126.rs b/src/test/ui/did_you_mean/issue-34126.rs index 9523e6bbf3..9dfb38abd0 100644 --- a/src/test/ui/did_you_mean/issue-34126.rs +++ b/src/test/ui/did_you_mean/issue-34126.rs @@ -13,7 +13,7 @@ struct Z { } impl Z { fn run(&self, z: &mut Z) { } fn start(&mut self) { - self.run(&mut self); + self.run(&mut self); //~ ERROR cannot borrow } } diff --git a/src/test/ui/did_you_mean/issue-34126.stderr b/src/test/ui/did_you_mean/issue-34126.stderr index d9ef0c4541..a4921046c7 100644 --- a/src/test/ui/did_you_mean/issue-34126.stderr +++ b/src/test/ui/did_you_mean/issue-34126.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-34126.rs:16:23 | -16 | self.run(&mut self); +16 | self.run(&mut self); //~ ERROR cannot borrow | ^^^^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-34337.rs b/src/test/ui/did_you_mean/issue-34337.rs index 42853a5d83..a426c0f48c 100644 --- a/src/test/ui/did_you_mean/issue-34337.rs +++ b/src/test/ui/did_you_mean/issue-34337.rs @@ -13,5 +13,5 @@ fn get(key: &mut String) { } fn main() { let mut v: Vec<String> = Vec::new(); let ref mut key = v[0]; - get(&mut key); + get(&mut key); //~ ERROR cannot borrow } diff --git a/src/test/ui/did_you_mean/issue-34337.stderr b/src/test/ui/did_you_mean/issue-34337.stderr index 20478165c7..a53d3d7277 100644 --- a/src/test/ui/did_you_mean/issue-34337.stderr +++ b/src/test/ui/did_you_mean/issue-34337.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable local variable `key` as mutable --> $DIR/issue-34337.rs:16:14 | -16 | get(&mut key); +16 | get(&mut key); //~ ERROR cannot borrow | ^^^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-35937.rs b/src/test/ui/did_you_mean/issue-35937.rs index 9ec8728fd3..867b47cf99 100644 --- a/src/test/ui/did_you_mean/issue-35937.rs +++ b/src/test/ui/did_you_mean/issue-35937.rs @@ -14,7 +14,7 @@ struct Foo { fn main() { let f = Foo { v: Vec::new() }; - f.v.push("cat".to_string()); + f.v.push("cat".to_string()); //~ ERROR cannot borrow } @@ -23,9 +23,9 @@ struct S { } fn foo() { let s = S { x: 42 }; - s.x += 1; + s.x += 1; //~ ERROR cannot assign } fn bar(s: S) { - s.x += 1; + s.x += 1; //~ ERROR cannot assign } diff --git a/src/test/ui/did_you_mean/issue-35937.stderr b/src/test/ui/did_you_mean/issue-35937.stderr index 1cd1fb76aa..cfaff97317 100644 --- a/src/test/ui/did_you_mean/issue-35937.stderr +++ b/src/test/ui/did_you_mean/issue-35937.stderr @@ -1,26 +1,26 @@ -error[E0596]: cannot borrow immutable field `f.v` as mutable +error[E0596]: cannot borrow field `f.v` of immutable binding as mutable --> $DIR/issue-35937.rs:17:5 | 16 | let f = Foo { v: Vec::new() }; | - consider changing this to `mut f` -17 | f.v.push("cat".to_string()); - | ^^^ cannot mutably borrow immutable field +17 | f.v.push("cat".to_string()); //~ ERROR cannot borrow + | ^^^ cannot mutably borrow field of immutable binding -error[E0594]: cannot assign to immutable field `s.x` +error[E0594]: cannot assign to field `s.x` of immutable binding --> $DIR/issue-35937.rs:26:5 | 25 | let s = S { x: 42 }; | - consider changing this to `mut s` -26 | s.x += 1; - | ^^^^^^^^ cannot mutably borrow immutable field +26 | s.x += 1; //~ ERROR cannot assign + | ^^^^^^^^ cannot mutably borrow field of immutable binding -error[E0594]: cannot assign to immutable field `s.x` +error[E0594]: cannot assign to field `s.x` of immutable binding --> $DIR/issue-35937.rs:30:5 | 29 | fn bar(s: S) { | - consider changing this to `mut s` -30 | s.x += 1; - | ^^^^^^^^ cannot mutably borrow immutable field +30 | s.x += 1; //~ ERROR cannot assign + | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-36798.rs b/src/test/ui/did_you_mean/issue-36798.rs index cd0d0951ab..6e641ff025 100644 --- a/src/test/ui/did_you_mean/issue-36798.rs +++ b/src/test/ui/did_you_mean/issue-36798.rs @@ -14,5 +14,5 @@ struct Foo { fn main() { let f = Foo { bar: 22 }; - f.baz; + f.baz; //~ ERROR no field } diff --git a/src/test/ui/did_you_mean/issue-36798.stderr b/src/test/ui/did_you_mean/issue-36798.stderr index 72fd09c035..73319d567b 100644 --- a/src/test/ui/did_you_mean/issue-36798.stderr +++ b/src/test/ui/did_you_mean/issue-36798.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `baz` on type `Foo` --> $DIR/issue-36798.rs:17:7 | -17 | f.baz; +17 | f.baz; //~ ERROR no field | ^^^ did you mean `bar`? error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-36798_unknown_field.rs b/src/test/ui/did_you_mean/issue-36798_unknown_field.rs index 2970a325a6..ec54a8d2b4 100644 --- a/src/test/ui/did_you_mean/issue-36798_unknown_field.rs +++ b/src/test/ui/did_you_mean/issue-36798_unknown_field.rs @@ -14,5 +14,5 @@ struct Foo { fn main() { let f = Foo { bar: 22 }; - f.zz; + f.zz; //~ ERROR no field } diff --git a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr index 20bb7d4c91..f17672b234 100644 --- a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr +++ b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `zz` on type `Foo` --> $DIR/issue-36798_unknown_field.rs:17:7 | -17 | f.zz; +17 | f.zz; //~ ERROR no field | ^^ unknown field | = note: available fields are: `bar` diff --git a/src/test/ui/did_you_mean/issue-37139.rs b/src/test/ui/did_you_mean/issue-37139.rs index 6518176805..8a1a7ce0c3 100644 --- a/src/test/ui/did_you_mean/issue-37139.rs +++ b/src/test/ui/did_you_mean/issue-37139.rs @@ -19,7 +19,7 @@ fn main() { let mut x = TestEnum::Item(10); match x { TestEnum::Item(ref mut x) => { - test(&mut x); + test(&mut x); //~ ERROR cannot borrow immutable } } } diff --git a/src/test/ui/did_you_mean/issue-37139.stderr b/src/test/ui/did_you_mean/issue-37139.stderr index 9fc364f861..65de724616 100644 --- a/src/test/ui/did_you_mean/issue-37139.stderr +++ b/src/test/ui/did_you_mean/issue-37139.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable --> $DIR/issue-37139.rs:22:23 | -22 | test(&mut x); +22 | test(&mut x); //~ ERROR cannot borrow immutable | ^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs index 1938d33e53..c9c1c5d141 100644 --- a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs +++ b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use Foo; +use Foo; //~ ERROR unresolved -use Foo1; +use Foo1; //~ ERROR unresolved fn main() {} diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr index 325f55e686..c58958c7f5 100644 --- a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr +++ b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `Foo` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:11:5 | -11 | use Foo; +11 | use Foo; //~ ERROR unresolved | ^^^ no `Foo` in the root error[E0432]: unresolved import `Foo1` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:13:5 | -13 | use Foo1; +13 | use Foo1; //~ ERROR unresolved | ^^^^ no `Foo1` in the root error: aborting due to 2 previous errors diff --git a/src/test/ui/did_you_mean/issue-38147-1.rs b/src/test/ui/did_you_mean/issue-38147-1.rs index 136921dd0a..a7ce740656 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.rs +++ b/src/test/ui/did_you_mean/issue-38147-1.rs @@ -24,7 +24,7 @@ struct Foo<'a> { impl<'a> Foo<'a> { fn f(&self) { - self.s.push('x'); + self.s.push('x'); //~ ERROR cannot borrow data mutably } } diff --git a/src/test/ui/did_you_mean/issue-38147-1.stderr b/src/test/ui/did_you_mean/issue-38147-1.stderr index e9f2b1dad8..6a262b3102 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | 26 | fn f(&self) { | ----- use `&mut self` here to make mutable -27 | self.s.push('x'); +27 | self.s.push('x'); //~ ERROR cannot borrow data mutably | ^^^^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-2.rs b/src/test/ui/did_you_mean/issue-38147-2.rs index a5d533edf7..1a24f471f0 100644 --- a/src/test/ui/did_you_mean/issue-38147-2.rs +++ b/src/test/ui/did_you_mean/issue-38147-2.rs @@ -15,6 +15,7 @@ struct Bar<'a> { impl<'a> Bar<'a> { fn f(&mut self) { self.s.push('x'); + //~^ ERROR cannot borrow borrowed content `*self.s` of immutable binding as mutable } } diff --git a/src/test/ui/did_you_mean/issue-38147-2.stderr b/src/test/ui/did_you_mean/issue-38147-2.stderr index e81bc722fa..569bfa1180 100644 --- a/src/test/ui/did_you_mean/issue-38147-2.stderr +++ b/src/test/ui/did_you_mean/issue-38147-2.stderr @@ -1,4 +1,4 @@ -error[E0596]: cannot borrow immutable borrowed content `*self.s` as mutable +error[E0596]: cannot borrow borrowed content `*self.s` of immutable binding as mutable --> $DIR/issue-38147-2.rs:17:9 | 12 | s: &'a String diff --git a/src/test/ui/did_you_mean/issue-38147-3.rs b/src/test/ui/did_you_mean/issue-38147-3.rs index 5e8f2d3eae..5e2bf06e5d 100644 --- a/src/test/ui/did_you_mean/issue-38147-3.rs +++ b/src/test/ui/did_you_mean/issue-38147-3.rs @@ -15,6 +15,7 @@ struct Qux<'a> { impl<'a> Qux<'a> { fn f(&self) { self.s.push('x'); + //~^ ERROR cannot borrow borrowed content `*self.s` of immutable binding as mutable } } diff --git a/src/test/ui/did_you_mean/issue-38147-3.stderr b/src/test/ui/did_you_mean/issue-38147-3.stderr index 749795f4d8..75d904d394 100644 --- a/src/test/ui/did_you_mean/issue-38147-3.stderr +++ b/src/test/ui/did_you_mean/issue-38147-3.stderr @@ -1,4 +1,4 @@ -error[E0596]: cannot borrow immutable borrowed content `*self.s` as mutable +error[E0596]: cannot borrow borrowed content `*self.s` of immutable binding as mutable --> $DIR/issue-38147-3.rs:17:9 | 12 | s: &'a String diff --git a/src/test/ui/did_you_mean/issue-38147-4.rs b/src/test/ui/did_you_mean/issue-38147-4.rs index 4eb20ceeed..49a8f2b6ff 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.rs +++ b/src/test/ui/did_you_mean/issue-38147-4.rs @@ -13,7 +13,7 @@ struct Foo<'a> { } fn f(x: usize, f: &Foo) { - f.s.push('x'); + f.s.push('x'); //~ ERROR cannot borrow data mutably } fn main() {} diff --git a/src/test/ui/did_you_mean/issue-38147-4.stderr b/src/test/ui/did_you_mean/issue-38147-4.stderr index 9a8853f4fb..33bf2e1160 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | 15 | fn f(x: usize, f: &Foo) { | ---- use `&mut Foo` here to make mutable -16 | f.s.push('x'); +16 | f.s.push('x'); //~ ERROR cannot borrow data mutably | ^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-39544.rs b/src/test/ui/did_you_mean/issue-39544.rs index d7c8935560..205cbce709 100644 --- a/src/test/ui/did_you_mean/issue-39544.rs +++ b/src/test/ui/did_you_mean/issue-39544.rs @@ -18,42 +18,43 @@ pub struct Z { fn main() { let z = Z { x: X::Y }; - let _ = &mut z.x; + let _ = &mut z.x; //~ ERROR cannot borrow } impl Z { fn foo<'z>(&'z self) { - let _ = &mut self.x; + let _ = &mut self.x; //~ ERROR cannot borrow } fn foo1(&self, other: &Z) { - let _ = &mut self.x; - let _ = &mut other.x; + let _ = &mut self.x; //~ ERROR cannot borrow + let _ = &mut other.x; //~ ERROR cannot borrow } fn foo2<'a>(&'a self, other: &Z) { - let _ = &mut self.x; - let _ = &mut other.x; + let _ = &mut self.x; //~ ERROR cannot borrow + let _ = &mut other.x; //~ ERROR cannot borrow } fn foo3<'a>(self: &'a Self, other: &Z) { - let _ = &mut self.x; - let _ = &mut other.x; + let _ = &mut self.x; //~ ERROR cannot borrow + let _ = &mut other.x; //~ ERROR cannot borrow } fn foo4(other: &Z) { - let _ = &mut other.x; + let _ = &mut other.x; //~ ERROR cannot borrow } } pub fn with_arg(z: Z, w: &Z) { - let _ = &mut z.x; - let _ = &mut w.x; + let _ = &mut z.x; //~ ERROR cannot borrow + let _ = &mut w.x; //~ ERROR cannot borrow } pub fn with_tuple() { let mut y = 0; let x = (&y,); *x.0 = 1; + //~^ ERROR cannot assign to borrowed content `*x.0` of immutable binding } diff --git a/src/test/ui/did_you_mean/issue-39544.stderr b/src/test/ui/did_you_mean/issue-39544.stderr index 28aaab97bd..d8c089806c 100644 --- a/src/test/ui/did_you_mean/issue-39544.stderr +++ b/src/test/ui/did_you_mean/issue-39544.stderr @@ -1,96 +1,96 @@ -error[E0596]: cannot borrow immutable field `z.x` as mutable +error[E0596]: cannot borrow field `z.x` of immutable binding as mutable --> $DIR/issue-39544.rs:21:18 | 20 | let z = Z { x: X::Y }; | - consider changing this to `mut z` -21 | let _ = &mut z.x; - | ^^^ cannot mutably borrow immutable field +21 | let _ = &mut z.x; //~ ERROR cannot borrow + | ^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `self.x` as mutable +error[E0596]: cannot borrow field `self.x` of immutable binding as mutable --> $DIR/issue-39544.rs:26:22 | 25 | fn foo<'z>(&'z self) { | -------- use `&'z mut self` here to make mutable -26 | let _ = &mut self.x; - | ^^^^^^ cannot mutably borrow immutable field +26 | let _ = &mut self.x; //~ ERROR cannot borrow + | ^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `self.x` as mutable +error[E0596]: cannot borrow field `self.x` of immutable binding as mutable --> $DIR/issue-39544.rs:30:22 | 29 | fn foo1(&self, other: &Z) { | ----- use `&mut self` here to make mutable -30 | let _ = &mut self.x; - | ^^^^^^ cannot mutably borrow immutable field +30 | let _ = &mut self.x; //~ ERROR cannot borrow + | ^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `other.x` as mutable +error[E0596]: cannot borrow field `other.x` of immutable binding as mutable --> $DIR/issue-39544.rs:31:22 | 29 | fn foo1(&self, other: &Z) { | -- use `&mut Z` here to make mutable -30 | let _ = &mut self.x; -31 | let _ = &mut other.x; - | ^^^^^^^ cannot mutably borrow immutable field +30 | let _ = &mut self.x; //~ ERROR cannot borrow +31 | let _ = &mut other.x; //~ ERROR cannot borrow + | ^^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `self.x` as mutable +error[E0596]: cannot borrow field `self.x` of immutable binding as mutable --> $DIR/issue-39544.rs:35:22 | 34 | fn foo2<'a>(&'a self, other: &Z) { | -------- use `&'a mut self` here to make mutable -35 | let _ = &mut self.x; - | ^^^^^^ cannot mutably borrow immutable field +35 | let _ = &mut self.x; //~ ERROR cannot borrow + | ^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `other.x` as mutable +error[E0596]: cannot borrow field `other.x` of immutable binding as mutable --> $DIR/issue-39544.rs:36:22 | 34 | fn foo2<'a>(&'a self, other: &Z) { | -- use `&mut Z` here to make mutable -35 | let _ = &mut self.x; -36 | let _ = &mut other.x; - | ^^^^^^^ cannot mutably borrow immutable field +35 | let _ = &mut self.x; //~ ERROR cannot borrow +36 | let _ = &mut other.x; //~ ERROR cannot borrow + | ^^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `self.x` as mutable +error[E0596]: cannot borrow field `self.x` of immutable binding as mutable --> $DIR/issue-39544.rs:40:22 | 39 | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- use `&'a mut Self` here to make mutable -40 | let _ = &mut self.x; - | ^^^^^^ cannot mutably borrow immutable field +40 | let _ = &mut self.x; //~ ERROR cannot borrow + | ^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `other.x` as mutable +error[E0596]: cannot borrow field `other.x` of immutable binding as mutable --> $DIR/issue-39544.rs:41:22 | 39 | fn foo3<'a>(self: &'a Self, other: &Z) { | -- use `&mut Z` here to make mutable -40 | let _ = &mut self.x; -41 | let _ = &mut other.x; - | ^^^^^^^ cannot mutably borrow immutable field +40 | let _ = &mut self.x; //~ ERROR cannot borrow +41 | let _ = &mut other.x; //~ ERROR cannot borrow + | ^^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `other.x` as mutable +error[E0596]: cannot borrow field `other.x` of immutable binding as mutable --> $DIR/issue-39544.rs:45:22 | 44 | fn foo4(other: &Z) { | -- use `&mut Z` here to make mutable -45 | let _ = &mut other.x; - | ^^^^^^^ cannot mutably borrow immutable field +45 | let _ = &mut other.x; //~ ERROR cannot borrow + | ^^^^^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `z.x` as mutable +error[E0596]: cannot borrow field `z.x` of immutable binding as mutable --> $DIR/issue-39544.rs:51:18 | 50 | pub fn with_arg(z: Z, w: &Z) { | - consider changing this to `mut z` -51 | let _ = &mut z.x; - | ^^^ cannot mutably borrow immutable field +51 | let _ = &mut z.x; //~ ERROR cannot borrow + | ^^^ cannot mutably borrow field of immutable binding -error[E0596]: cannot borrow immutable field `w.x` as mutable +error[E0596]: cannot borrow field `w.x` of immutable binding as mutable --> $DIR/issue-39544.rs:52:18 | 50 | pub fn with_arg(z: Z, w: &Z) { | -- use `&mut Z` here to make mutable -51 | let _ = &mut z.x; -52 | let _ = &mut w.x; - | ^^^ cannot mutably borrow immutable field +51 | let _ = &mut z.x; //~ ERROR cannot borrow +52 | let _ = &mut w.x; //~ ERROR cannot borrow + | ^^^ cannot mutably borrow field of immutable binding -error[E0594]: cannot assign to immutable borrowed content `*x.0` +error[E0594]: cannot assign to borrowed content `*x.0` of immutable binding --> $DIR/issue-39544.rs:58:5 | 58 | *x.0 = 1; diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs index 68b1f79c89..660aedc359 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs @@ -31,7 +31,7 @@ impl Foo<bool> for bool {} impl Foo<i8> for bool {} fn main() { - Foo::<i32>::bar(&1i8); - Foo::<i32>::bar(&1u8); - Foo::<i32>::bar(&true); + Foo::<i32>::bar(&1i8); //~ ERROR is not satisfied + Foo::<i32>::bar(&1u8); //~ ERROR is not satisfied + Foo::<i32>::bar(&true); //~ ERROR is not satisfied } diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index 4ea4adfcfe..d5c4add34b 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i8: Foo<i32>` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:34:5 | -34 | Foo::<i32>::bar(&1i8); +34 | Foo::<i32>::bar(&1i8); //~ ERROR is not satisfied | ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `i8` | = help: the following implementations were found: @@ -15,7 +15,7 @@ error[E0277]: the trait bound `i8: Foo<i32>` is not satisfied error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:35:5 | -35 | Foo::<i32>::bar(&1u8); +35 | Foo::<i32>::bar(&1u8); //~ ERROR is not satisfied | ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `u8` | = help: the following implementations were found: @@ -28,7 +28,7 @@ error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:36:5 | -36 | Foo::<i32>::bar(&true); +36 | Foo::<i32>::bar(&true); //~ ERROR is not satisfied | ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `bool` | = help: the following implementations were found: diff --git a/src/test/ui/did_you_mean/issue-40006.rs b/src/test/ui/did_you_mean/issue-40006.rs index d68c25faa8..62316b96db 100644 --- a/src/test/ui/did_you_mean/issue-40006.rs +++ b/src/test/ui/did_you_mean/issue-40006.rs @@ -8,22 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -impl X { +impl X { //~ ERROR cannot be made into an object +//~^ ERROR missing Y } struct S; -trait X { +trait X { //~ ERROR missing X() {} - fn xxx() { ### } - L = M; - Z = { 2 + 3 }; - ::Y (); + fn xxx() { ### } //~ ERROR missing + //~^ ERROR expected + L = M; //~ ERROR missing + Z = { 2 + 3 }; //~ ERROR expected one of + ::Y (); //~ ERROR expected one of } impl S { - pub hello_method(&self) { + pub hello_method(&self) { //~ ERROR missing println!("Hello"); } } diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr index 3b7f32cf89..88d63cdbb5 100644 --- a/src/test/ui/did_you_mean/issue-40006.stderr +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -1,65 +1,65 @@ error: missing `fn`, `type`, or `const` for impl-item declaration --> $DIR/issue-40006.rs:11:9 | -11 | impl X { +11 | impl X { //~ ERROR cannot be made into an object | _________^ -12 | | Y +12 | | //~^ ERROR missing +13 | | Y | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration - --> $DIR/issue-40006.rs:17:10 + --> $DIR/issue-40006.rs:18:10 | -17 | trait X { +18 | trait X { //~ ERROR missing | __________^ -18 | | X() {} +19 | | X() {} | |____^ missing `fn`, `type`, or `const` error: expected `[`, found `#` - --> $DIR/issue-40006.rs:19:17 + --> $DIR/issue-40006.rs:20:17 | -19 | fn xxx() { ### } +20 | fn xxx() { ### } //~ ERROR missing | ^ error: missing `fn`, `type`, or `const` for trait-item declaration - --> $DIR/issue-40006.rs:19:21 + --> $DIR/issue-40006.rs:20:21 | -19 | fn xxx() { ### } +20 | fn xxx() { ### } //~ ERROR missing | _____________________^ -20 | | L = M; +21 | | //~^ ERROR expected +22 | | L = M; //~ ERROR missing | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration - --> $DIR/issue-40006.rs:20:11 + --> $DIR/issue-40006.rs:22:11 | -20 | L = M; +22 | L = M; //~ ERROR missing | ___________^ -21 | | Z = { 2 + 3 }; +23 | | Z = { 2 + 3 }; //~ ERROR expected one of | |____^ missing `fn`, `type`, or `const` error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` - --> $DIR/issue-40006.rs:21:18 + --> $DIR/issue-40006.rs:23:18 | -21 | Z = { 2 + 3 }; +23 | Z = { 2 + 3 }; //~ ERROR expected one of | ^ expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here error: expected one of `!` or `::`, found `(` - --> $DIR/issue-40006.rs:22:9 + --> $DIR/issue-40006.rs:24:9 | -22 | ::Y (); - | -^ unexpected token - | | - | expected one of `!` or `::` here +24 | ::Y (); //~ ERROR expected one of + | ^ expected one of `!` or `::` here error: missing `fn`, `type`, or `const` for impl-item declaration - --> $DIR/issue-40006.rs:26:8 + --> $DIR/issue-40006.rs:28:8 | -26 | pub hello_method(&self) { +28 | pub hello_method(&self) { //~ ERROR missing | ^ missing `fn`, `type`, or `const` error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-40006.rs:11:6 | -11 | impl X { +11 | impl X { //~ ERROR cannot be made into an object | ^ the trait `X` cannot be made into an object | = note: method `xxx` has no receiver diff --git a/src/test/ui/did_you_mean/issue-40396.rs b/src/test/ui/did_you_mean/issue-40396.rs index 1eae180976..eb62dc5408 100644 --- a/src/test/ui/did_you_mean/issue-40396.rs +++ b/src/test/ui/did_you_mean/issue-40396.rs @@ -9,15 +9,16 @@ // except according to those terms. fn foo() { - println!("{:?}", (0..13).collect<Vec<i32>>()); + println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison } fn bar() { - println!("{:?}", Vec<i32>::new()); + println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison } fn qux() { - println!("{:?}", (0..13).collect<Vec<i32>()); + println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison + //~^ ERROR chained comparison } fn main() {} diff --git a/src/test/ui/did_you_mean/issue-40396.stderr b/src/test/ui/did_you_mean/issue-40396.stderr index 11279f5c61..8f4118b3ff 100644 --- a/src/test/ui/did_you_mean/issue-40396.stderr +++ b/src/test/ui/did_you_mean/issue-40396.stderr @@ -1,7 +1,7 @@ error: chained comparison operators require parentheses --> $DIR/issue-40396.rs:12:37 | -12 | println!("{:?}", (0..13).collect<Vec<i32>>()); +12 | println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison | ^^^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments @@ -10,7 +10,7 @@ error: chained comparison operators require parentheses error: chained comparison operators require parentheses --> $DIR/issue-40396.rs:16:25 | -16 | println!("{:?}", Vec<i32>::new()); +16 | println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison | ^^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments @@ -19,7 +19,7 @@ error: chained comparison operators require parentheses error: chained comparison operators require parentheses --> $DIR/issue-40396.rs:20:37 | -20 | println!("{:?}", (0..13).collect<Vec<i32>()); +20 | println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison | ^^^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments @@ -28,7 +28,7 @@ error: chained comparison operators require parentheses error: chained comparison operators require parentheses --> $DIR/issue-40396.rs:20:41 | -20 | println!("{:?}", (0..13).collect<Vec<i32>()); +20 | println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison | ^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments diff --git a/src/test/ui/did_you_mean/issue-40823.rs b/src/test/ui/did_you_mean/issue-40823.rs index f4ae325727..3b48cef190 100644 --- a/src/test/ui/did_you_mean/issue-40823.rs +++ b/src/test/ui/did_you_mean/issue-40823.rs @@ -10,5 +10,5 @@ fn main() { let mut buf = &[1, 2, 3, 4]; - buf.iter_mut(); + buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content } diff --git a/src/test/ui/did_you_mean/issue-40823.stderr b/src/test/ui/did_you_mean/issue-40823.stderr index 7daab09c09..0b71fc1d30 100644 --- a/src/test/ui/did_you_mean/issue-40823.stderr +++ b/src/test/ui/did_you_mean/issue-40823.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable --> $DIR/issue-40823.rs:13:5 | -13 | buf.iter_mut(); +13 | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content | ^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-41679.rs b/src/test/ui/did_you_mean/issue-41679.rs index 5091b9efc3..98c909e212 100644 --- a/src/test/ui/did_you_mean/issue-41679.rs +++ b/src/test/ui/did_you_mean/issue-41679.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x = ~1; + let x = ~1; //~ ERROR can not be used as a unary operator } diff --git a/src/test/ui/did_you_mean/issue-41679.stderr b/src/test/ui/did_you_mean/issue-41679.stderr index 2abbbf65ba..f1ccb3e6e1 100644 --- a/src/test/ui/did_you_mean/issue-41679.stderr +++ b/src/test/ui/did_you_mean/issue-41679.stderr @@ -1,7 +1,7 @@ error: `~` can not be used as a unary operator --> $DIR/issue-41679.rs:12:13 | -12 | let x = ~1; +12 | let x = ~1; //~ ERROR can not be used as a unary operator | ^ did you mean `!`? | = help: use `!` instead of `~` if you meant to perform bitwise negation diff --git a/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs b/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs index 7fe9950801..ad5bedcefc 100644 --- a/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs +++ b/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs @@ -24,10 +24,12 @@ mod submodule { impl Demo { fn new_with_secret_two() -> Self { Self { secret_integer: 2, inocently_mispellable: () } + //~^ ERROR no field } fn new_with_secret_three() -> Self { Self { secret_integer: 3, egregiously_nonexistent_field: () } + //~^ ERROR no field } } @@ -38,6 +40,8 @@ fn main() { let demo = Demo::default(); let innocent_field_misaccess = demo.inocently_mispellable; + //~^ ERROR no field // note shouldn't suggest private fields let egregious_field_misaccess = demo.egregiously_nonexistent_field; + //~^ ERROR no field } diff --git a/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr b/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr index e2bb7fbd9a..d5dcef6384 100644 --- a/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr +++ b/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr @@ -5,23 +5,23 @@ error[E0560]: struct `submodule::Demo` has no field named `inocently_mispellable | ^^^^^^^^^^^^^^^^^^^^^^ field does not exist - did you mean `innocently_misspellable`? error[E0560]: struct `submodule::Demo` has no field named `egregiously_nonexistent_field` - --> $DIR/issue-42599_available_fields_note.rs:30:39 + --> $DIR/issue-42599_available_fields_note.rs:31:39 | -30 | Self { secret_integer: 3, egregiously_nonexistent_field: () } +31 | Self { secret_integer: 3, egregiously_nonexistent_field: () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `submodule::Demo` does not have this field | = note: available fields are: `favorite_integer`, `secret_integer`, `innocently_misspellable`, `another_field`, `yet_another_field` ... and 2 others error[E0609]: no field `inocently_mispellable` on type `submodule::Demo` - --> $DIR/issue-42599_available_fields_note.rs:40:41 + --> $DIR/issue-42599_available_fields_note.rs:42:41 | -40 | let innocent_field_misaccess = demo.inocently_mispellable; +42 | let innocent_field_misaccess = demo.inocently_mispellable; | ^^^^^^^^^^^^^^^^^^^^^ did you mean `innocently_misspellable`? error[E0609]: no field `egregiously_nonexistent_field` on type `submodule::Demo` - --> $DIR/issue-42599_available_fields_note.rs:42:42 + --> $DIR/issue-42599_available_fields_note.rs:45:42 | -42 | let egregious_field_misaccess = demo.egregiously_nonexistent_field; +45 | let egregious_field_misaccess = demo.egregiously_nonexistent_field; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field | = note: available fields are: `favorite_integer`, `innocently_misspellable` diff --git a/src/test/ui/did_you_mean/issue-42764.rs b/src/test/ui/did_you_mean/issue-42764.rs index ecaeb7b116..ff4bb428d5 100644 --- a/src/test/ui/did_you_mean/issue-42764.rs +++ b/src/test/ui/did_you_mean/issue-42764.rs @@ -19,4 +19,5 @@ fn this_function_expects_a_double_option<T>(d: DoubleOption<T>) {} fn main() { let n: usize = 42; this_function_expects_a_double_option(n); + //~^ ERROR mismatched types } diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs new file mode 100644 index 0000000000..7b877523e3 --- /dev/null +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum Example { Ex(String), NotEx } + +fn result_test() { + let x = Option(1); //~ ERROR expected function, found enum + + if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum + println!("It is OK."); + } + + let y = Example::Ex(String::from("test")); + + if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum + println!("It is OK."); + } +} + +fn main() {} diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr new file mode 100644 index 0000000000..5390e541fb --- /dev/null +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr @@ -0,0 +1,32 @@ +error[E0423]: expected function, found enum `Option` + --> $DIR/issue-43871-enum-instead-of-variant.rs:14:13 + | +14 | let x = Option(1); //~ ERROR expected function, found enum + | ^^^^^^ + | + = note: did you mean to use one of the following variants? + - `std::prelude::v1::Option::None` + - `std::prelude::v1::Option::Some` + +error[E0532]: expected tuple struct/variant, found enum `Option` + --> $DIR/issue-43871-enum-instead-of-variant.rs:16:12 + | +16 | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum + | ^^^^^^ + | + = note: did you mean to use one of the following variants? + - `std::prelude::v1::Option::None` + - `std::prelude::v1::Option::Some` + +error[E0532]: expected tuple struct/variant, found enum `Example` + --> $DIR/issue-43871-enum-instead-of-variant.rs:22:12 + | +22 | if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum + | ^^^^^^^ + | + = note: did you mean to use one of the following variants? + - `Example::Ex` + - `Example::NotEx` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs new file mode 100644 index 0000000000..0d3ac8740e --- /dev/null +++ b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused)] + +struct PersonalityInventory { + expressivity: f32, + instrumentality: f32 +} + +impl PersonalityInventory { + fn expressivity(&self) -> f32 { + match *self { + PersonalityInventory { expressivity: exp, ... } => exp + //~^ ERROR expected field pattern, found `...` + } + } +} + +fn main() {} diff --git a/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr new file mode 100644 index 0000000000..69a76b923b --- /dev/null +++ b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr @@ -0,0 +1,8 @@ +error: expected field pattern, found `...` + --> $DIR/issue-46718-struct-pattern-dotdotdot.rs:21:55 + | +21 | PersonalityInventory { expressivity: exp, ... } => exp + | ^^^ help: to omit remaining fields, use one fewer `.`: `..` + +error: aborting due to previous error + diff --git a/src/test/ui/did_you_mean/recursion_limit.rs b/src/test/ui/did_you_mean/recursion_limit.rs index becb81b1ff..2d27f167a0 100644 --- a/src/test/ui/did_you_mean/recursion_limit.rs +++ b/src/test/ui/did_you_mean/recursion_limit.rs @@ -41,5 +41,5 @@ enum N { N(usize) } fn is_send<T:Send>() { } fn main() { - is_send::<A>(); + is_send::<A>(); //~ ERROR overflow evaluating the requirement } diff --git a/src/test/ui/did_you_mean/recursion_limit.stderr b/src/test/ui/did_you_mean/recursion_limit.stderr index d157c5de6c..7fac604ba4 100644 --- a/src/test/ui/did_you_mean/recursion_limit.stderr +++ b/src/test/ui/did_you_mean/recursion_limit.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `K: std::marker::Send` --> $DIR/recursion_limit.rs:44:5 | -44 | is_send::<A>(); +44 | is_send::<A>(); //~ ERROR overflow evaluating the requirement | ^^^^^^^^^^^^ | = help: consider adding a `#![recursion_limit="20"]` attribute to your crate diff --git a/src/test/ui/did_you_mean/recursion_limit_deref.rs b/src/test/ui/did_you_mean/recursion_limit_deref.rs index ebc56c94ad..3e261ec636 100644 --- a/src/test/ui/did_you_mean/recursion_limit_deref.rs +++ b/src/test/ui/did_you_mean/recursion_limit_deref.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//~^^^^^^^^^^ ERROR reached the recursion limit + // Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have a long chain of Deref impls // which will cause an overflow during the autoderef loop. @@ -57,6 +59,7 @@ link!(K, Bottom); fn main() { let t = Top::new(); - let x: &Bottom = &t; + let x: &Bottom = &t; //~ ERROR mismatched types + //~^ error recursion limit } diff --git a/src/test/ui/did_you_mean/recursion_limit_deref.stderr b/src/test/ui/did_you_mean/recursion_limit_deref.stderr index 57b28d0373..951b0b1058 100644 --- a/src/test/ui/did_you_mean/recursion_limit_deref.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_deref.stderr @@ -1,7 +1,7 @@ error[E0055]: reached the recursion limit while auto-dereferencing I - --> $DIR/recursion_limit_deref.rs:60:22 + --> $DIR/recursion_limit_deref.rs:62:22 | -60 | let x: &Bottom = &t; +62 | let x: &Bottom = &t; //~ ERROR mismatched types | ^^ deref recursion limit reached | = help: consider adding a `#[recursion_limit="20"]` attribute to your crate @@ -11,9 +11,9 @@ error[E0055]: reached the recursion limit while auto-dereferencing I = help: consider adding a `#[recursion_limit="20"]` attribute to your crate error[E0308]: mismatched types - --> $DIR/recursion_limit_deref.rs:60:22 + --> $DIR/recursion_limit_deref.rs:62:22 | -60 | let x: &Bottom = &t; +62 | let x: &Bottom = &t; //~ ERROR mismatched types | ^^ expected struct `Bottom`, found struct `Top` | = note: expected type `&Bottom` diff --git a/src/test/ui/did_you_mean/recursion_limit_macro.rs b/src/test/ui/did_you_mean/recursion_limit_macro.rs index 9fb82b730c..16d07f3699 100644 --- a/src/test/ui/did_you_mean/recursion_limit_macro.rs +++ b/src/test/ui/did_you_mean/recursion_limit_macro.rs @@ -17,7 +17,7 @@ macro_rules! recurse { () => { }; - ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; + ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; //~ ERROR recursion limit } fn main() { diff --git a/src/test/ui/did_you_mean/recursion_limit_macro.stderr b/src/test/ui/did_you_mean/recursion_limit_macro.stderr index 19aac1f77e..24e223c797 100644 --- a/src/test/ui/did_you_mean/recursion_limit_macro.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_macro.stderr @@ -1,7 +1,7 @@ error: recursion limit reached while expanding the macro `recurse` --> $DIR/recursion_limit_macro.rs:20:31 | -20 | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; +20 | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; //~ ERROR recursion limit | ^^^^^^^^^^^^^^^^^^^ ... 24 | recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9); diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs index 11757abae9..76bc971e11 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs @@ -9,6 +9,7 @@ // except according to those terms. fn main() { - let _: &Copy + 'static; - let _: &'static Copy + 'static; + let _: &Copy + 'static; //~ ERROR expected a path + //~^ ERROR cannot be made into an object + let _: &'static Copy + 'static; //~ ERROR expected a path } diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index 498255cb9e..325a19eee1 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -1,19 +1,19 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy` --> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12 | -12 | let _: &Copy + 'static; +12 | let _: &Copy + 'static; //~ ERROR expected a path | ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)` error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy` - --> $DIR/trait-object-reference-without-parens-suggestion.rs:13:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:14:12 | -13 | let _: &'static Copy + 'static; +14 | let _: &'static Copy + 'static; //~ ERROR expected a path | ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)` error[E0038]: the trait `std::marker::Copy` cannot be made into an object --> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12 | -12 | let _: &Copy + 'static; +12 | let _: &Copy + 'static; //~ ERROR expected a path | ^^^^^ the trait `std::marker::Copy` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/compile-fail/discrim-overflow-2.rs b/src/test/ui/discrim-overflow-2.rs similarity index 62% rename from src/test/compile-fail/discrim-overflow-2.rs rename to src/test/ui/discrim-overflow-2.rs index 213683b580..9f77e77d15 100644 --- a/src/test/compile-fail/discrim-overflow-2.rs +++ b/src/test/ui/discrim-overflow-2.rs @@ -25,8 +25,6 @@ fn f_i8() { Ok = i8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 127i8 - //~| NOTE explicitly set `OhNo = -128i8` if that is desired outcome } } @@ -36,8 +34,6 @@ fn f_u8() { Ok = u8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 255u8 - //~| NOTE explicitly set `OhNo = 0u8` if that is desired outcome } } @@ -47,8 +43,6 @@ fn f_i16() { Ok = i16::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 32767i16 - //~| NOTE explicitly set `OhNo = -32768i16` if that is desired outcome } } @@ -58,8 +52,6 @@ fn f_u16() { Ok = u16::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 65535u16 - //~| NOTE explicitly set `OhNo = 0u16` if that is desired outcome } } @@ -69,8 +61,6 @@ fn f_i32() { Ok = i32::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 2147483647i32 - //~| NOTE explicitly set `OhNo = -2147483648i32` if that is desired outcome } } @@ -80,8 +70,6 @@ fn f_u32() { Ok = u32::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 4294967295u32 - //~| NOTE explicitly set `OhNo = 0u32` if that is desired outcome } } @@ -91,8 +79,6 @@ fn f_i64() { Ok = i64::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 9223372036854775807i64 - //~| NOTE explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome } } @@ -102,8 +88,6 @@ fn f_u64() { Ok = u64::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 18446744073709551615u64 - //~| NOTE explicitly set `OhNo = 0u64` if that is desired outcome } } diff --git a/src/test/ui/discrim-overflow-2.stderr b/src/test/ui/discrim-overflow-2.stderr new file mode 100644 index 0000000000..660110cd73 --- /dev/null +++ b/src/test/ui/discrim-overflow-2.stderr @@ -0,0 +1,66 @@ +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:27:9 + | +27 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 127i8 + | + = note: explicitly set `OhNo = -128i8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:36:9 + | +36 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 255u8 + | + = note: explicitly set `OhNo = 0u8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:45:9 + | +45 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 32767i16 + | + = note: explicitly set `OhNo = -32768i16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:54:9 + | +54 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 65535u16 + | + = note: explicitly set `OhNo = 0u16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:63:9 + | +63 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 2147483647i32 + | + = note: explicitly set `OhNo = -2147483648i32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:72:9 + | +72 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 4294967295u32 + | + = note: explicitly set `OhNo = 0u32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:81:9 + | +81 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 9223372036854775807i64 + | + = note: explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:90:9 + | +90 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 18446744073709551615u64 + | + = note: explicitly set `OhNo = 0u64` if that is desired outcome + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/discrim-overflow.rs b/src/test/ui/discrim-overflow.rs similarity index 73% rename from src/test/compile-fail/discrim-overflow.rs rename to src/test/ui/discrim-overflow.rs index a3039b8d95..0b31d9f97f 100644 --- a/src/test/compile-fail/discrim-overflow.rs +++ b/src/test/ui/discrim-overflow.rs @@ -23,8 +23,6 @@ fn f_i8() { Ok = i8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 127i8 - //~| NOTE explicitly set `OhNo = -128i8` if that is desired outcome } let x = A::Ok; @@ -36,8 +34,6 @@ fn f_u8() { Ok = u8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 255u8 - //~| NOTE explicitly set `OhNo = 0u8` if that is desired outcome } let x = A::Ok; @@ -49,8 +45,6 @@ fn f_i16() { Ok = i16::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 32767i16 - //~| NOTE explicitly set `OhNo = -32768i16` if that is desired outcome } let x = A::Ok; @@ -63,7 +57,6 @@ fn f_u16() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 65535u16 - //~| NOTE explicitly set `OhNo = 0u16` if that is desired outcome } let x = A::Ok; @@ -76,7 +69,6 @@ fn f_i32() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 2147483647i32 - //~| NOTE explicitly set `OhNo = -2147483648i32` if that is desired outcome } let x = A::Ok; @@ -89,7 +81,6 @@ fn f_u32() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 4294967295u32 - //~| NOTE explicitly set `OhNo = 0u32` if that is desired outcome } let x = A::Ok; @@ -102,7 +93,6 @@ fn f_i64() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 9223372036854775807i64 - //~| NOTE explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome } let x = A::Ok; @@ -115,7 +105,6 @@ fn f_u64() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 18446744073709551615u64 - //~| NOTE explicitly set `OhNo = 0u64` if that is desired outcome } let x = A::Ok; diff --git a/src/test/ui/discrim-overflow.stderr b/src/test/ui/discrim-overflow.stderr new file mode 100644 index 0000000000..733810006d --- /dev/null +++ b/src/test/ui/discrim-overflow.stderr @@ -0,0 +1,66 @@ +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:25:9 + | +25 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 127i8 + | + = note: explicitly set `OhNo = -128i8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:36:9 + | +36 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 255u8 + | + = note: explicitly set `OhNo = 0u8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:47:9 + | +47 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 32767i16 + | + = note: explicitly set `OhNo = -32768i16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:58:9 + | +58 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 65535u16 + | + = note: explicitly set `OhNo = 0u16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:70:9 + | +70 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 2147483647i32 + | + = note: explicitly set `OhNo = -2147483648i32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:82:9 + | +82 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 4294967295u32 + | + = note: explicitly set `OhNo = 0u32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:94:9 + | +94 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 9223372036854775807i64 + | + = note: explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:106:9 + | +106 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 18446744073709551615u64 + | + = note: explicitly set `OhNo = 0u64` if that is desired outcome + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/double-import.rs b/src/test/ui/double-import.rs similarity index 78% rename from src/test/compile-fail/double-import.rs rename to src/test/ui/double-import.rs index 21b8ded6d9..154c9bebb0 100644 --- a/src/test/compile-fail/double-import.rs +++ b/src/test/ui/double-import.rs @@ -19,9 +19,7 @@ mod sub2 { pub fn foo() {} // implementation 2 } -use sub1::foo; //~ NOTE previous import of the value `foo` here +use sub1::foo; use sub2::foo; //~ ERROR the name `foo` is defined multiple times - //~| NOTE `foo` reimported here - //~| NOTE `foo` must be defined only once in the value namespace of this module fn main() {} diff --git a/src/test/ui/double-import.stderr b/src/test/ui/double-import.stderr new file mode 100644 index 0000000000..fcd3f2696f --- /dev/null +++ b/src/test/ui/double-import.stderr @@ -0,0 +1,16 @@ +error[E0252]: the name `foo` is defined multiple times + --> $DIR/double-import.rs:23:5 + | +22 | use sub1::foo; + | --------- previous import of the value `foo` here +23 | use sub2::foo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^^^^ `foo` reimported here + | + = note: `foo` must be defined only once in the value namespace of this module +help: You can use `as` to change the binding name of the import + | +23 | use sub2::foo as Otherfoo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs index 5e200dbdbf..4f88b0e6fc 100644 --- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs +++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs @@ -36,16 +36,20 @@ fn main() { dt = Dt("dt", &c_long); dr = Dr("dr", &c_long); // Error: destructor order imprecisely modelled - dt = Dt("dt", &c); //~ ERROR `c` does not live long enough - dr = Dr("dr", &c); //~ ERROR `c` does not live long enough + dt = Dt("dt", &c); + //~^ ERROR `c` does not live long enough + dr = Dr("dr", &c); + //~^ ERROR `c` does not live long enough // No error: Drop impl asserts .1 (A and &'a _) are not accessed pt = Pt("pt", &c, &c_long); pr = Pr("pr", &c, &c_long); // Error: Drop impl's assertion does not apply to `B` nor `&'b _` - pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough - pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough + pt = Pt("pt", &c_long, &c); + //~^ ERROR `c` does not live long enough + pr = Pr("pr", &c_long, &c); + //~^ ERROR `c` does not live long enough // No error: St and Sr have no destructor. st = St("st", &c); diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr index 62ce3209c9..8aa4fba708 100644 --- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr +++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr @@ -1,44 +1,44 @@ error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-extern-crate.rs:55:1 + --> $DIR/dropck-eyepatch-extern-crate.rs:39:20 | -39 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +39 | dt = Dt("dt", &c); + | ^ borrowed value does not live long enough ... -55 | } - | ^ `c` dropped here while still borrowed +59 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-extern-crate.rs:55:1 + --> $DIR/dropck-eyepatch-extern-crate.rs:41:20 | -40 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +41 | dr = Dr("dr", &c); + | ^ borrowed value does not live long enough ... -55 | } - | ^ `c` dropped here while still borrowed +59 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-extern-crate.rs:55:1 + --> $DIR/dropck-eyepatch-extern-crate.rs:49:29 | -47 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +49 | pt = Pt("pt", &c_long, &c); + | ^ borrowed value does not live long enough ... -55 | } - | ^ `c` dropped here while still borrowed +59 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-extern-crate.rs:55:1 + --> $DIR/dropck-eyepatch-extern-crate.rs:51:29 | -48 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +51 | pr = Pr("pr", &c_long, &c); + | ^ borrowed value does not live long enough ... -55 | } - | ^ `c` dropped here while still borrowed +59 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.rs b/src/test/ui/dropck/dropck-eyepatch-reorder.rs index 68b0ff3b5f..3bd9efb32b 100644 --- a/src/test/ui/dropck/dropck-eyepatch-reorder.rs +++ b/src/test/ui/dropck/dropck-eyepatch-reorder.rs @@ -54,16 +54,20 @@ fn main() { dt = Dt("dt", &c_long); dr = Dr("dr", &c_long); // Error: destructor order imprecisely modelled - dt = Dt("dt", &c); //~ ERROR `c` does not live long enough - dr = Dr("dr", &c); //~ ERROR `c` does not live long enough + dt = Dt("dt", &c); + //~^ ERROR `c` does not live long enough + dr = Dr("dr", &c); + //~^ ERROR `c` does not live long enough // No error: Drop impl asserts .1 (A and &'a _) are not accessed pt = Pt("pt", &c, &c_long); pr = Pr("pr", &c, &c_long); // Error: Drop impl's assertion does not apply to `B` nor `&'b _` - pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough - pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough + pt = Pt("pt", &c_long, &c); + //~^ ERROR `c` does not live long enough + pr = Pr("pr", &c_long, &c); + //~^ ERROR `c` does not live long enough // No error: St and Sr have no destructor. st = St("st", &c); diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.stderr index d94808bbcb..4fa188908f 100644 --- a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr +++ b/src/test/ui/dropck/dropck-eyepatch-reorder.stderr @@ -1,44 +1,44 @@ error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-reorder.rs:73:1 + --> $DIR/dropck-eyepatch-reorder.rs:57:20 | -57 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +57 | dt = Dt("dt", &c); + | ^ borrowed value does not live long enough ... -73 | } - | ^ `c` dropped here while still borrowed +77 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-reorder.rs:73:1 + --> $DIR/dropck-eyepatch-reorder.rs:59:20 | -58 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +59 | dr = Dr("dr", &c); + | ^ borrowed value does not live long enough ... -73 | } - | ^ `c` dropped here while still borrowed +77 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-reorder.rs:73:1 + --> $DIR/dropck-eyepatch-reorder.rs:67:29 | -65 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +67 | pt = Pt("pt", &c_long, &c); + | ^ borrowed value does not live long enough ... -73 | } - | ^ `c` dropped here while still borrowed +77 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch-reorder.rs:73:1 + --> $DIR/dropck-eyepatch-reorder.rs:69:29 | -66 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough - | - borrow occurs here +69 | pr = Pr("pr", &c_long, &c); + | ^ borrowed value does not live long enough ... -73 | } - | ^ `c` dropped here while still borrowed +77 | } + | - `c` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/dropck/dropck-eyepatch.rs b/src/test/ui/dropck/dropck-eyepatch.rs index e442fade19..abaae47189 100644 --- a/src/test/ui/dropck/dropck-eyepatch.rs +++ b/src/test/ui/dropck/dropck-eyepatch.rs @@ -77,16 +77,20 @@ fn main() { dt = Dt("dt", &c_long); dr = Dr("dr", &c_long); // Error: destructor order imprecisely modelled - dt = Dt("dt", &c); //~ ERROR `c` does not live long enough - dr = Dr("dr", &c); //~ ERROR `c` does not live long enough + dt = Dt("dt", &c); + //~^ ERROR `c` does not live long enough + dr = Dr("dr", &c); + //~^ ERROR `c` does not live long enough // No error: Drop impl asserts .1 (A and &'a _) are not accessed pt = Pt("pt", &c, &c_long); pr = Pr("pr", &c, &c_long); // Error: Drop impl's assertion does not apply to `B` nor `&'b _` - pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough - pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough + pt = Pt("pt", &c_long, &c); + //~^ ERROR `c` does not live long enough + pr = Pr("pr", &c_long, &c); + //~^ ERROR `c` does not live long enough // No error: St and Sr have no destructor. st = St("st", &c); diff --git a/src/test/ui/dropck/dropck-eyepatch.stderr b/src/test/ui/dropck/dropck-eyepatch.stderr index 811eee0e85..79fb9222d5 100644 --- a/src/test/ui/dropck/dropck-eyepatch.stderr +++ b/src/test/ui/dropck/dropck-eyepatch.stderr @@ -1,46 +1,46 @@ error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch.rs:96:1 - | -80 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough - | - borrow occurs here + --> $DIR/dropck-eyepatch.rs:80:20 + | +80 | dt = Dt("dt", &c); + | ^ borrowed value does not live long enough ... -96 | } - | ^ `c` dropped here while still borrowed - | - = note: values in a scope are dropped in the opposite order they are created +100 | } + | - `c` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch.rs:96:1 - | -81 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough - | - borrow occurs here + --> $DIR/dropck-eyepatch.rs:82:20 + | +82 | dr = Dr("dr", &c); + | ^ borrowed value does not live long enough ... -96 | } - | ^ `c` dropped here while still borrowed - | - = note: values in a scope are dropped in the opposite order they are created +100 | } + | - `c` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch.rs:96:1 - | -88 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough - | - borrow occurs here + --> $DIR/dropck-eyepatch.rs:90:29 + | +90 | pt = Pt("pt", &c_long, &c); + | ^ borrowed value does not live long enough ... -96 | } - | ^ `c` dropped here while still borrowed - | - = note: values in a scope are dropped in the opposite order they are created +100 | } + | - `c` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c` does not live long enough - --> $DIR/dropck-eyepatch.rs:96:1 - | -89 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough - | - borrow occurs here + --> $DIR/dropck-eyepatch.rs:92:29 + | +92 | pr = Pr("pr", &c_long, &c); + | ^ borrowed value does not live long enough ... -96 | } - | ^ `c` dropped here while still borrowed - | - = note: values in a scope are dropped in the opposite order they are created +100 | } + | - `c` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created error: aborting due to 4 previous errors diff --git a/src/test/compile-fail/duplicate-check-macro-exports.rs b/src/test/ui/duplicate-check-macro-exports.rs similarity index 87% rename from src/test/compile-fail/duplicate-check-macro-exports.rs rename to src/test/ui/duplicate-check-macro-exports.rs index 53d7e54ee5..d874a43d53 100644 --- a/src/test/compile-fail/duplicate-check-macro-exports.rs +++ b/src/test/ui/duplicate-check-macro-exports.rs @@ -10,10 +10,9 @@ #![feature(use_extern_macros)] -pub use std::panic; //~ NOTE previous macro export here +pub use std::panic; #[macro_export] macro_rules! panic { () => {} } //~ ERROR a macro named `panic` has already been exported -//~| NOTE `panic` already exported fn main() {} diff --git a/src/test/ui/duplicate-check-macro-exports.stderr b/src/test/ui/duplicate-check-macro-exports.stderr new file mode 100644 index 0000000000..4e7176f351 --- /dev/null +++ b/src/test/ui/duplicate-check-macro-exports.stderr @@ -0,0 +1,14 @@ +error: a macro named `panic` has already been exported + --> $DIR/duplicate-check-macro-exports.rs:16:1 + | +16 | macro_rules! panic { () => {} } //~ ERROR a macro named `panic` has already been exported + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `panic` already exported + | +note: previous macro export here + --> $DIR/duplicate-check-macro-exports.rs:13:9 + | +13 | pub use std::panic; + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/e0119/complex-impl.rs b/src/test/ui/e0119/complex-impl.rs index f0d2630b9d..b8b30a2841 100644 --- a/src/test/ui/e0119/complex-impl.rs +++ b/src/test/ui/e0119/complex-impl.rs @@ -16,6 +16,7 @@ use complex_impl_support::{External, M}; struct Q; -impl<R> External for (Q, R) {} +impl<R> External for (Q, R) {} //~ ERROR must be used +//~^ ERROR conflicting implementations of trait -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/e0119/complex-impl.stderr b/src/test/ui/e0119/complex-impl.stderr index ff7c8a160a..926dac3f9b 100644 --- a/src/test/ui/e0119/complex-impl.stderr +++ b/src/test/ui/e0119/complex-impl.stderr @@ -1,8 +1,8 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::External` for type `(Q, complex_impl_support::M<'_, '_, '_, std::boxed::Box<_>, _, _>)`: --> $DIR/complex-impl.rs:19:1 | -19 | impl<R> External for (Q, R) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +19 | impl<R> External for (Q, R) {} //~ ERROR must be used + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `complex_impl_support`: - impl<'a, 'b, 'c, T, U, V, W> complex_impl_support::External for (T, complex_impl_support::M<'a, 'b, 'c, std::boxed::Box<U>, V, W>) @@ -11,7 +11,7 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::Extern error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter --> $DIR/complex-impl.rs:19:1 | -19 | impl<R> External for (Q, R) {} +19 | impl<R> External for (Q, R) {} //~ ERROR must be used | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/e0119/conflict-with-std.rs b/src/test/ui/e0119/conflict-with-std.rs index ead62256a5..ed9033ad53 100644 --- a/src/test/ui/e0119/conflict-with-std.rs +++ b/src/test/ui/e0119/conflict-with-std.rs @@ -14,25 +14,25 @@ use std::marker::PhantomData; use std::convert::{TryFrom, AsRef}; struct Q; -impl AsRef<Q> for Box<Q> { +impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations fn as_ref(&self) -> &Q { &**self } } struct S; -impl From<S> for S { +impl From<S> for S { //~ ERROR conflicting implementations fn from(s: S) -> S { s } } struct X; -impl TryFrom<X> for X { +impl TryFrom<X> for X { //~ ERROR conflicting implementations type Error = (); fn try_from(u: X) -> Result<X, ()> { Ok(u) } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/e0119/conflict-with-std.stderr b/src/test/ui/e0119/conflict-with-std.stderr index f3e33291ef..4c1f9405fb 100644 --- a/src/test/ui/e0119/conflict-with-std.stderr +++ b/src/test/ui/e0119/conflict-with-std.stderr @@ -1,12 +1,8 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`: --> $DIR/conflict-with-std.rs:17:1 | -17 | / impl AsRef<Q> for Box<Q> { -18 | | fn as_ref(&self) -> &Q { -19 | | &**self -20 | | } -21 | | } - | |_^ +17 | impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: - impl<T> std::convert::AsRef<T> for std::boxed::Box<T> @@ -15,12 +11,8 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`: --> $DIR/conflict-with-std.rs:24:1 | -24 | / impl From<S> for S { -25 | | fn from(s: S) -> S { -26 | | s -27 | | } -28 | | } - | |_^ +24 | impl From<S> for S { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl<T> std::convert::From<T> for T; @@ -28,13 +20,8 @@ error[E0119]: conflicting implementations of trait `std::convert::From<S>` for t error[E0119]: conflicting implementations of trait `std::convert::TryFrom<X>` for type `X`: --> $DIR/conflict-with-std.rs:31:1 | -31 | / impl TryFrom<X> for X { -32 | | type Error = (); -33 | | fn try_from(u: X) -> Result<X, ()> { -34 | | Ok(u) -35 | | } -36 | | } - | |_^ +31 | impl TryFrom<X> for X { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl<T, U> std::convert::TryFrom<U> for T diff --git a/src/test/ui/e0119/issue-23563.rs b/src/test/ui/e0119/issue-23563.rs index 67710af936..c6d03a4cfc 100644 --- a/src/test/ui/e0119/issue-23563.rs +++ b/src/test/ui/e0119/issue-23563.rs @@ -20,7 +20,7 @@ use a::LolTo; struct LocalType<T>(Option<T>); -impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { +impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) } } @@ -36,4 +36,4 @@ impl LolTo<LocalType<u8>> for [u8] { } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/e0119/issue-23563.stderr b/src/test/ui/e0119/issue-23563.stderr index dcb76d71b3..8bbae56d84 100644 --- a/src/test/ui/e0119/issue-23563.stderr +++ b/src/test/ui/e0119/issue-23563.stderr @@ -1,10 +1,8 @@ error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`: --> $DIR/issue-23563.rs:23:1 | -23 | / impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { -24 | | fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) } -25 | | } - | |_^ +23 | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `issue_23563_a`: - impl<T, U> a::LolFrom<T> for U diff --git a/src/test/ui/e0119/issue-27403.rs b/src/test/ui/e0119/issue-27403.rs index c880921b65..98953153fa 100644 --- a/src/test/ui/e0119/issue-27403.rs +++ b/src/test/ui/e0119/issue-27403.rs @@ -12,10 +12,10 @@ pub struct GenX<S> { inner: S, } -impl<S> Into<S> for GenX<S> { +impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations fn into(self) -> S { self.inner } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/e0119/issue-27403.stderr b/src/test/ui/e0119/issue-27403.stderr index d03171fc10..4417ea9099 100644 --- a/src/test/ui/e0119/issue-27403.stderr +++ b/src/test/ui/e0119/issue-27403.stderr @@ -1,12 +1,8 @@ error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`: --> $DIR/issue-27403.rs:15:1 | -15 | / impl<S> Into<S> for GenX<S> { -16 | | fn into(self) -> S { -17 | | self.inner -18 | | } -19 | | } - | |_^ +15 | impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl<T, U> std::convert::Into<U> for T diff --git a/src/test/ui/e0119/issue-28981.rs b/src/test/ui/e0119/issue-28981.rs index 06018286b3..8a52464ff5 100644 --- a/src/test/ui/e0119/issue-28981.rs +++ b/src/test/ui/e0119/issue-28981.rs @@ -12,6 +12,7 @@ use std::ops::Deref; struct Foo; -impl<Foo> Deref for Foo { } +impl<Foo> Deref for Foo { } //~ ERROR must be used +//~^ ERROR conflicting implementations -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/e0119/issue-28981.stderr b/src/test/ui/e0119/issue-28981.stderr index c6c7c117a4..3ea1c9adc9 100644 --- a/src/test/ui/e0119/issue-28981.stderr +++ b/src/test/ui/e0119/issue-28981.stderr @@ -1,8 +1,8 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&_`: --> $DIR/issue-28981.rs:15:1 | -15 | impl<Foo> Deref for Foo { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +15 | impl<Foo> Deref for Foo { } //~ ERROR must be used + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl<'a, T> std::ops::Deref for &'a T @@ -11,7 +11,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `& error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter --> $DIR/issue-28981.rs:15:1 | -15 | impl<Foo> Deref for Foo { } +15 | impl<Foo> Deref for Foo { } //~ ERROR must be used | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/e0119/so-37347311.rs b/src/test/ui/e0119/so-37347311.rs index 0d21120eac..933cdb3cd5 100644 --- a/src/test/ui/e0119/so-37347311.rs +++ b/src/test/ui/e0119/so-37347311.rs @@ -18,10 +18,10 @@ enum MyError<S: Storage> { StorageProblem(S::Error), } -impl<S: Storage> From<S::Error> for MyError<S> { +impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations fn from(error: S::Error) -> MyError<S> { MyError::StorageProblem(error) } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/e0119/so-37347311.stderr b/src/test/ui/e0119/so-37347311.stderr index 8a26597a1c..84fb049df3 100644 --- a/src/test/ui/e0119/so-37347311.stderr +++ b/src/test/ui/e0119/so-37347311.stderr @@ -1,12 +1,8 @@ error[E0119]: conflicting implementations of trait `std::convert::From<MyError<_>>` for type `MyError<_>`: --> $DIR/so-37347311.rs:21:1 | -21 | / impl<S: Storage> From<S::Error> for MyError<S> { -22 | | fn from(error: S::Error) -> MyError<S> { -23 | | MyError::StorageProblem(error) -24 | | } -25 | | } - | |_^ +21 | impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl<T> std::convert::From<T> for T; diff --git a/src/test/compile-fail/empty-struct-unit-expr.rs b/src/test/ui/empty-struct-unit-expr.rs similarity index 90% rename from src/test/compile-fail/empty-struct-unit-expr.rs rename to src/test/ui/empty-struct-unit-expr.rs index 9655007604..c33960193b 100644 --- a/src/test/compile-fail/empty-struct-unit-expr.rs +++ b/src/test/ui/empty-struct-unit-expr.rs @@ -25,9 +25,7 @@ fn main() { let e2 = Empty2(); //~ ERROR expected function, found `Empty2` let e4 = E::Empty4(); //~^ ERROR expected function, found `E::Empty4` [E0618] - //~| HELP did you mean to write `E::Empty4`? let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` let xe4 = XE::XEmpty4(); //~^ ERROR expected function, found `XE::XEmpty4` [E0618] - //~| HELP did you mean to write `XE::XEmpty4`? } diff --git a/src/test/ui/empty-struct-unit-expr.stderr b/src/test/ui/empty-struct-unit-expr.stderr new file mode 100644 index 0000000000..3ce63ed9f4 --- /dev/null +++ b/src/test/ui/empty-struct-unit-expr.stderr @@ -0,0 +1,41 @@ +error[E0618]: expected function, found `Empty2` + --> $DIR/empty-struct-unit-expr.rs:25:14 + | +25 | let e2 = Empty2(); //~ ERROR expected function, found `Empty2` + | ^^^^^^^^ + | +note: defined here + --> $DIR/empty-struct-unit-expr.rs:18:1 + | +18 | struct Empty2; + | ^^^^^^^^^^^^^^ + +error[E0618]: expected function, found `E::Empty4` + --> $DIR/empty-struct-unit-expr.rs:26:14 + | +26 | let e4 = E::Empty4(); + | ^^^^^^^^^^^ + | + = help: did you mean to write `E::Empty4`? +note: defined here + --> $DIR/empty-struct-unit-expr.rs:21:5 + | +21 | Empty4 + | ^^^^^^ + +error[E0618]: expected function, found `empty_struct::XEmpty2` + --> $DIR/empty-struct-unit-expr.rs:28:15 + | +28 | let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` + | ^^^^^^^^^ + +error[E0618]: expected function, found `XE::XEmpty4` + --> $DIR/empty-struct-unit-expr.rs:29:15 + | +29 | let xe4 = XE::XEmpty4(); + | ^^^^^^^^^^^^^ + | + = help: did you mean to write `XE::XEmpty4`? + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/enum-and-module-in-same-scope.rs b/src/test/ui/enum-and-module-in-same-scope.rs similarity index 77% rename from src/test/compile-fail/enum-and-module-in-same-scope.rs rename to src/test/ui/enum-and-module-in-same-scope.rs index 59b4d715c2..9b6c8712f6 100644 --- a/src/test/compile-fail/enum-and-module-in-same-scope.rs +++ b/src/test/ui/enum-and-module-in-same-scope.rs @@ -8,13 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum Foo { //~ NOTE previous definition of the type `Foo` here +enum Foo { X } mod Foo { //~ ERROR the name `Foo` is defined multiple times - //~| NOTE `Foo` redefined here - //~| NOTE `Foo` must be defined only once in the type namespace of this module pub static X: isize = 42; fn f() { f() } // Check that this does not result in a resolution error } diff --git a/src/test/ui/enum-and-module-in-same-scope.stderr b/src/test/ui/enum-and-module-in-same-scope.stderr new file mode 100644 index 0000000000..ddbee0655e --- /dev/null +++ b/src/test/ui/enum-and-module-in-same-scope.stderr @@ -0,0 +1,13 @@ +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/enum-and-module-in-same-scope.rs:15:1 + | +11 | enum Foo { + | -------- previous definition of the type `Foo` here +... +15 | mod Foo { //~ ERROR the name `Foo` is defined multiple times + | ^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error: aborting due to previous error + diff --git a/src/test/ui/explain.rs b/src/test/ui/explain.rs index 17fb59935d..6305fbcffc 100644 --- a/src/test/ui/explain.rs +++ b/src/test/ui/explain.rs @@ -9,3 +9,4 @@ // except according to those terms. // compile-flags: --explain E0591 +// must-compile-successfully diff --git a/src/test/compile-fail/fat-ptr-cast.rs b/src/test/ui/fat-ptr-cast.rs similarity index 92% rename from src/test/compile-fail/fat-ptr-cast.rs rename to src/test/ui/fat-ptr-cast.rs index bc2dc1cc5d..0802963ad2 100644 --- a/src/test/compile-fail/fat-ptr-cast.rs +++ b/src/test/ui/fat-ptr-cast.rs @@ -18,14 +18,12 @@ fn main() { let q = a.as_ptr(); a as usize; //~ ERROR casting - //~^ HELP cast through a raw pointer first a as isize; //~ ERROR casting a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid b as usize; //~ ERROR non-primitive cast p as usize; //~^ ERROR casting - //~^^ HELP cast through a thin pointer // #22955 q as *const [i32]; //~ ERROR cannot cast diff --git a/src/test/ui/fat-ptr-cast.stderr b/src/test/ui/fat-ptr-cast.stderr new file mode 100644 index 0000000000..35a97749e0 --- /dev/null +++ b/src/test/ui/fat-ptr-cast.stderr @@ -0,0 +1,62 @@ +error[E0606]: casting `&[i32]` as `usize` is invalid + --> $DIR/fat-ptr-cast.rs:20:5 + | +20 | a as usize; //~ ERROR casting + | ^^^^^^^^^^ + | + = help: cast through a raw pointer first + +error[E0606]: casting `&[i32]` as `isize` is invalid + --> $DIR/fat-ptr-cast.rs:21:5 + | +21 | a as isize; //~ ERROR casting + | ^^^^^^^^^^ + +error[E0606]: casting `&[i32]` as `i16` is invalid + --> $DIR/fat-ptr-cast.rs:22:5 + | +22 | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid + | ^^^^^^^^ + +error[E0606]: casting `&[i32]` as `u32` is invalid + --> $DIR/fat-ptr-cast.rs:23:5 + | +23 | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid + | ^^^^^^^^ + +error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize` + --> $DIR/fat-ptr-cast.rs:24:5 + | +24 | b as usize; //~ ERROR non-primitive cast + | ^^^^^^^^^^ + | + = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait + +error[E0606]: casting `*const [i32]` as `usize` is invalid + --> $DIR/fat-ptr-cast.rs:25:5 + | +25 | p as usize; + | ^^^^^^^^^^ + | + = help: cast through a thin pointer first + +error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]` + --> $DIR/fat-ptr-cast.rs:29:5 + | +29 | q as *const [i32]; //~ ERROR cannot cast + | ^^^^^^^^^^^^^^^^^ + +error[E0606]: casting `usize` as `*mut Trait + 'static` is invalid + --> $DIR/fat-ptr-cast.rs:32:37 + | +32 | let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting + | ^^^^^^^^^^^ + +error[E0606]: casting `usize` as `*const str` is invalid + --> $DIR/fat-ptr-cast.rs:33:32 + | +33 | let mut fail: *const str = 0 as *const str; //~ ERROR casting + | ^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors + diff --git a/src/test/compile-fail/feature-gate-abi-msp430-interrupt.rs b/src/test/ui/feature-gate-abi-msp430-interrupt.rs similarity index 100% rename from src/test/compile-fail/feature-gate-abi-msp430-interrupt.rs rename to src/test/ui/feature-gate-abi-msp430-interrupt.rs diff --git a/src/test/ui/feature-gate-abi-msp430-interrupt.stderr b/src/test/ui/feature-gate-abi-msp430-interrupt.stderr new file mode 100644 index 0000000000..b05be6e439 --- /dev/null +++ b/src/test/ui/feature-gate-abi-msp430-interrupt.stderr @@ -0,0 +1,10 @@ +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi-msp430-interrupt.rs:14:1 + | +14 | extern "msp430-interrupt" fn foo() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-abi.rs b/src/test/ui/feature-gate-abi.rs similarity index 100% rename from src/test/compile-fail/feature-gate-abi.rs rename to src/test/ui/feature-gate-abi.rs diff --git a/src/test/ui/feature-gate-abi.stderr b/src/test/ui/feature-gate-abi.stderr new file mode 100644 index 0000000000..7d2ad0be39 --- /dev/null +++ b/src/test/ui/feature-gate-abi.stderr @@ -0,0 +1,450 @@ +error: intrinsics are subject to change + --> $DIR/feature-gate-abi.rs:19:1 + | +19 | extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: platform intrinsics are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-abi.rs:20:1 + | +20 | extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(platform_intrinsics)] to the crate attributes to enable + +error: vectorcall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:21:1 + | +21 | extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_vectorcall)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-abi.rs:22:1 + | +22 | extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi.rs:23:1 + | +23 | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: PTX ABIs are experimental and subject to change + --> $DIR/feature-gate-abi.rs:24:1 + | +24 | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_ptx)] to the crate attributes to enable + +error: x86-interrupt ABI is experimental and subject to change (see issue #40180) + --> $DIR/feature-gate-abi.rs:25:1 + | +25 | extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable + +error: thiscall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:26:1 + | +26 | extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_thiscall)] to the crate attributes to enable + +error: intrinsics are subject to change + --> $DIR/feature-gate-abi.rs:30:5 + | +30 | extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: platform intrinsics are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-abi.rs:31:5 + | +31 | extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(platform_intrinsics)] to the crate attributes to enable + +error: vectorcall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:32:5 + | +32 | extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_vectorcall)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-abi.rs:33:5 + | +33 | extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi.rs:34:5 + | +34 | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: PTX ABIs are experimental and subject to change + --> $DIR/feature-gate-abi.rs:35:5 + | +35 | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_ptx)] to the crate attributes to enable + +error: x86-interrupt ABI is experimental and subject to change (see issue #40180) + --> $DIR/feature-gate-abi.rs:36:5 + | +36 | extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable + +error: thiscall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:37:5 + | +37 | extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_thiscall)] to the crate attributes to enable + +error: intrinsics are subject to change + --> $DIR/feature-gate-abi.rs:39:5 + | +39 | extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: platform intrinsics are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-abi.rs:40:5 + | +40 | extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(platform_intrinsics)] to the crate attributes to enable + +error: vectorcall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:41:5 + | +41 | extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_vectorcall)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-abi.rs:42:5 + | +42 | extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi.rs:43:5 + | +43 | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: PTX ABIs are experimental and subject to change + --> $DIR/feature-gate-abi.rs:44:5 + | +44 | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_ptx)] to the crate attributes to enable + +error: x86-interrupt ABI is experimental and subject to change (see issue #40180) + --> $DIR/feature-gate-abi.rs:45:5 + | +45 | extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable + +error: thiscall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:46:5 + | +46 | extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_thiscall)] to the crate attributes to enable + +error: intrinsics are subject to change + --> $DIR/feature-gate-abi.rs:53:5 + | +53 | extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: platform intrinsics are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-abi.rs:54:5 + | +54 | extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics are experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(platform_intrinsics)] to the crate attributes to enable + +error: vectorcall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:55:5 + | +55 | extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_vectorcall)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-abi.rs:56:5 + | +56 | extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi.rs:57:5 + | +57 | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: PTX ABIs are experimental and subject to change + --> $DIR/feature-gate-abi.rs:58:5 + | +58 | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_ptx)] to the crate attributes to enable + +error: x86-interrupt ABI is experimental and subject to change (see issue #40180) + --> $DIR/feature-gate-abi.rs:59:5 + | +59 | extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable + +error: thiscall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:60:5 + | +60 | extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_thiscall)] to the crate attributes to enable + +error: intrinsics are subject to change + --> $DIR/feature-gate-abi.rs:65:5 + | +65 | extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: platform intrinsics are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-abi.rs:66:5 + | +66 | extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics are experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(platform_intrinsics)] to the crate attributes to enable + +error: vectorcall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:67:5 + | +67 | extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_vectorcall)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-abi.rs:68:5 + | +68 | extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi.rs:69:5 + | +69 | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: PTX ABIs are experimental and subject to change + --> $DIR/feature-gate-abi.rs:70:5 + | +70 | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_ptx)] to the crate attributes to enable + +error: x86-interrupt ABI is experimental and subject to change (see issue #40180) + --> $DIR/feature-gate-abi.rs:71:5 + | +71 | extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable + +error: thiscall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:72:5 + | +72 | extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_thiscall)] to the crate attributes to enable + +error: intrinsics are subject to change + --> $DIR/feature-gate-abi.rs:76:11 + | +76 | type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: platform intrinsics are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-abi.rs:77:11 + | +77 | type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics are experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(platform_intrinsics)] to the crate attributes to enable + +error: vectorcall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:78:11 + | +78 | type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_vectorcall)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-abi.rs:79:11 + | +79 | type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi.rs:80:11 + | +80 | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: PTX ABIs are experimental and subject to change + --> $DIR/feature-gate-abi.rs:81:11 + | +81 | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_ptx)] to the crate attributes to enable + +error: x86-interrupt ABI is experimental and subject to change (see issue #40180) + --> $DIR/feature-gate-abi.rs:82:11 + | +82 | type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable + +error: thiscall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:83:11 + | +83 | type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_thiscall)] to the crate attributes to enable + +error: intrinsics are subject to change + --> $DIR/feature-gate-abi.rs:86:1 + | +86 | extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: platform intrinsics are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-abi.rs:87:1 + | +87 | extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(platform_intrinsics)] to the crate attributes to enable + +error: vectorcall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:88:1 + | +88 | extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_vectorcall)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-abi.rs:89:1 + | +89 | extern "rust-call" {} //~ ERROR rust-call ABI is subject to change + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: msp430-interrupt ABI is experimental and subject to change (see issue #38487) + --> $DIR/feature-gate-abi.rs:90:1 + | +90 | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable + +error: PTX ABIs are experimental and subject to change + --> $DIR/feature-gate-abi.rs:91:1 + | +91 | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_ptx)] to the crate attributes to enable + +error: x86-interrupt ABI is experimental and subject to change (see issue #40180) + --> $DIR/feature-gate-abi.rs:92:1 + | +92 | extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable + +error: thiscall is experimental and subject to change + --> $DIR/feature-gate-abi.rs:93:1 + | +93 | extern "thiscall" {} //~ ERROR thiscall is experimental and subject to change + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(abi_thiscall)] to the crate attributes to enable + +error: aborting due to 56 previous errors + diff --git a/src/test/compile-fail/unadjusted-unstable.rs b/src/test/ui/feature-gate-abi_unadjusted.rs similarity index 95% rename from src/test/compile-fail/unadjusted-unstable.rs rename to src/test/ui/feature-gate-abi_unadjusted.rs index 2c23050085..501f4451ed 100644 --- a/src/test/compile-fail/unadjusted-unstable.rs +++ b/src/test/ui/feature-gate-abi_unadjusted.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-abi_unadjusted - extern "unadjusted" fn foo() { //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable } diff --git a/src/test/ui/feature-gate-abi_unadjusted.stderr b/src/test/ui/feature-gate-abi_unadjusted.stderr new file mode 100644 index 0000000000..3cc4384715 --- /dev/null +++ b/src/test/ui/feature-gate-abi_unadjusted.stderr @@ -0,0 +1,12 @@ +error: unadjusted ABI is an implementation detail and perma-unstable + --> $DIR/feature-gate-abi_unadjusted.rs:11:1 + | +11 | / extern "unadjusted" fn foo() { +12 | | //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable +13 | | } + | |_^ + | + = help: add #![feature(abi_unadjusted)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-advanced-slice-features.rs b/src/test/ui/feature-gate-advanced-slice-features.rs similarity index 100% rename from src/test/compile-fail/feature-gate-advanced-slice-features.rs rename to src/test/ui/feature-gate-advanced-slice-features.rs diff --git a/src/test/ui/feature-gate-advanced-slice-features.stderr b/src/test/ui/feature-gate-advanced-slice-features.stderr new file mode 100644 index 0000000000..815593d07a --- /dev/null +++ b/src/test/ui/feature-gate-advanced-slice-features.stderr @@ -0,0 +1,18 @@ +error: multiple-element slice matches anywhere but at the end of a slice (e.g. `[0, ..xs, 0]`) are experimental (see issue #23121) + --> $DIR/feature-gate-advanced-slice-features.rs:18:9 + | +18 | [ xs.., 4, 5 ] => {} //~ ERROR multiple-element slice matches + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(advanced_slice_patterns)] to the crate attributes to enable + +error: multiple-element slice matches anywhere but at the end of a slice (e.g. `[0, ..xs, 0]`) are experimental (see issue #23121) + --> $DIR/feature-gate-advanced-slice-features.rs:19:9 + | +19 | [ 1, xs.., 5 ] => {} //~ ERROR multiple-element slice matches + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(advanced_slice_patterns)] to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-allocator_internals.rs b/src/test/ui/feature-gate-allocator_internals.rs similarity index 100% rename from src/test/compile-fail/feature-gate-allocator_internals.rs rename to src/test/ui/feature-gate-allocator_internals.rs diff --git a/src/test/ui/feature-gate-allocator_internals.stderr b/src/test/ui/feature-gate-allocator_internals.stderr new file mode 100644 index 0000000000..f1f4705b3b --- /dev/null +++ b/src/test/ui/feature-gate-allocator_internals.stderr @@ -0,0 +1,10 @@ +error: the `#[default_lib_allocator]` attribute is an experimental feature + --> $DIR/feature-gate-allocator_internals.rs:11:1 + | +11 | #![default_lib_allocator] //~ ERROR: attribute is an experimental feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(allocator_internals)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-allow-internal-unsafe-nested-macro.rs b/src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.rs similarity index 100% rename from src/test/compile-fail/feature-gate-allow-internal-unsafe-nested-macro.rs rename to src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.rs diff --git a/src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.stderr b/src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.stderr new file mode 100644 index 0000000000..40bdde37ee --- /dev/null +++ b/src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.stderr @@ -0,0 +1,13 @@ +error: allow_internal_unsafe side-steps the unsafe_code lint + --> $DIR/feature-gate-allow-internal-unsafe-nested-macro.rs:18:9 + | +18 | #[allow_internal_unsafe] //~ ERROR allow_internal_unsafe side-steps + | ^^^^^^^^^^^^^^^^^^^^^^^^ +... +25 | bar!(); + | ------- in this macro invocation + | + = help: add #![feature(allow_internal_unsafe)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-allow-internal-unstable-nested-macro.rs b/src/test/ui/feature-gate-allow-internal-unstable-nested-macro.rs similarity index 100% rename from src/test/compile-fail/feature-gate-allow-internal-unstable-nested-macro.rs rename to src/test/ui/feature-gate-allow-internal-unstable-nested-macro.rs diff --git a/src/test/ui/feature-gate-allow-internal-unstable-nested-macro.stderr b/src/test/ui/feature-gate-allow-internal-unstable-nested-macro.stderr new file mode 100644 index 0000000000..60d72fbc3b --- /dev/null +++ b/src/test/ui/feature-gate-allow-internal-unstable-nested-macro.stderr @@ -0,0 +1,13 @@ +error: allow_internal_unstable side-steps feature gating and stability checks + --> $DIR/feature-gate-allow-internal-unstable-nested-macro.rs:18:9 + | +18 | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +25 | bar!(); + | ------- in this macro invocation + | + = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-allow-internal-unstable-struct.rs b/src/test/ui/feature-gate-allow-internal-unstable-struct.rs similarity index 100% rename from src/test/compile-fail/feature-gate-allow-internal-unstable-struct.rs rename to src/test/ui/feature-gate-allow-internal-unstable-struct.rs diff --git a/src/test/ui/feature-gate-allow-internal-unstable-struct.stderr b/src/test/ui/feature-gate-allow-internal-unstable-struct.stderr new file mode 100644 index 0000000000..2fb86ce8f4 --- /dev/null +++ b/src/test/ui/feature-gate-allow-internal-unstable-struct.stderr @@ -0,0 +1,10 @@ +error: allow_internal_unstable side-steps feature gating and stability checks + --> $DIR/feature-gate-allow-internal-unstable-struct.rs:14:1 + | +14 | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-allow-internal-unstable.rs b/src/test/ui/feature-gate-allow-internal-unstable.rs similarity index 100% rename from src/test/compile-fail/feature-gate-allow-internal-unstable.rs rename to src/test/ui/feature-gate-allow-internal-unstable.rs diff --git a/src/test/ui/feature-gate-allow-internal-unstable.stderr b/src/test/ui/feature-gate-allow-internal-unstable.stderr new file mode 100644 index 0000000000..a5740a1a78 --- /dev/null +++ b/src/test/ui/feature-gate-allow-internal-unstable.stderr @@ -0,0 +1,10 @@ +error: allow_internal_unstable side-steps feature gating and stability checks + --> $DIR/feature-gate-allow-internal-unstable.rs:13:1 + | +13 | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-allow_fail.rs b/src/test/ui/feature-gate-allow_fail.rs similarity index 100% rename from src/test/compile-fail/feature-gate-allow_fail.rs rename to src/test/ui/feature-gate-allow_fail.rs diff --git a/src/test/ui/feature-gate-allow_fail.stderr b/src/test/ui/feature-gate-allow_fail.stderr new file mode 100644 index 0000000000..65cd137459 --- /dev/null +++ b/src/test/ui/feature-gate-allow_fail.stderr @@ -0,0 +1,10 @@ +error: allow_fail attribute is currently unstable (see issue #42219) + --> $DIR/feature-gate-allow_fail.rs:13:1 + | +13 | #[allow_fail] //~ ERROR allow_fail attribute is currently unstable + | ^^^^^^^^^^^^^ + | + = help: add #![feature(allow_fail)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-arbitrary-self-types.rs b/src/test/ui/feature-gate-arbitrary-self-types.rs similarity index 100% rename from src/test/compile-fail/feature-gate-arbitrary-self-types.rs rename to src/test/ui/feature-gate-arbitrary-self-types.rs diff --git a/src/test/ui/feature-gate-arbitrary-self-types.stderr b/src/test/ui/feature-gate-arbitrary-self-types.stderr new file mode 100644 index 0000000000..2ef517cc9e --- /dev/null +++ b/src/test/ui/feature-gate-arbitrary-self-types.stderr @@ -0,0 +1,29 @@ +error: arbitrary `self` types are unstable (see issue #44874) + --> $DIR/feature-gate-arbitrary-self-types.rs:14:18 + | +14 | fn foo(self: Rc<Box<Self>>); //~ ERROR arbitrary `self` types are unstable + | ^^^^^^^^^^^^^ + | + = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable + = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>` + +error: arbitrary `self` types are unstable (see issue #44874) + --> $DIR/feature-gate-arbitrary-self-types.rs:20:18 + | +20 | fn foo(self: Rc<Box<Self>>) {} //~ ERROR arbitrary `self` types are unstable + | ^^^^^^^^^^^^^ + | + = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable + = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>` + +error: arbitrary `self` types are unstable (see issue #44874) + --> $DIR/feature-gate-arbitrary-self-types.rs:24:18 + | +24 | fn bar(self: Box<Rc<Self>>) {} //~ ERROR arbitrary `self` types are unstable + | ^^^^^^^^^^^^^ + | + = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable + = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs new file mode 100644 index 0000000000..29e51727ed --- /dev/null +++ b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo; + +impl Foo { + fn foo(self: *const Self) {} + //~^ ERROR raw pointer `self` is unstable +} + +trait Bar { + fn bar(self: *const Self); + //~^ ERROR raw pointer `self` is unstable +} + +impl Bar for () { + fn bar(self: *const Self) {} + //~^ ERROR raw pointer `self` is unstable +} + +fn main() {} diff --git a/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr new file mode 100644 index 0000000000..d629ac4c60 --- /dev/null +++ b/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr @@ -0,0 +1,29 @@ +error: raw pointer `self` is unstable (see issue #44874) + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:19:18 + | +19 | fn bar(self: *const Self); + | ^^^^^^^^^^^ + | + = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable + = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>` + +error: raw pointer `self` is unstable (see issue #44874) + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18 + | +14 | fn foo(self: *const Self) {} + | ^^^^^^^^^^^ + | + = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable + = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>` + +error: raw pointer `self` is unstable (see issue #44874) + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:24:18 + | +24 | fn bar(self: *const Self) {} + | ^^^^^^^^^^^ + | + = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable + = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/asm-gated.rs b/src/test/ui/feature-gate-asm.rs similarity index 96% rename from src/test/compile-fail/asm-gated.rs rename to src/test/ui/feature-gate-asm.rs index cd9cc22370..8d053bdae7 100644 --- a/src/test/compile-fail/asm-gated.rs +++ b/src/test/ui/feature-gate-asm.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-asm - fn main() { unsafe { asm!(""); //~ ERROR inline assembly is not stable enough diff --git a/src/test/ui/feature-gate-asm.stderr b/src/test/ui/feature-gate-asm.stderr new file mode 100644 index 0000000000..ff68a4fb23 --- /dev/null +++ b/src/test/ui/feature-gate-asm.stderr @@ -0,0 +1,10 @@ +error: inline assembly is not stable enough for use and is subject to change (see issue #29722) + --> $DIR/feature-gate-asm.rs:13:9 + | +13 | asm!(""); //~ ERROR inline assembly is not stable enough + | ^^^^^^^^^ + | + = help: add #![feature(asm)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/asm-gated2.rs b/src/test/ui/feature-gate-asm2.rs similarity index 100% rename from src/test/compile-fail/asm-gated2.rs rename to src/test/ui/feature-gate-asm2.rs diff --git a/src/test/ui/feature-gate-asm2.stderr b/src/test/ui/feature-gate-asm2.stderr new file mode 100644 index 0000000000..1e02cede61 --- /dev/null +++ b/src/test/ui/feature-gate-asm2.stderr @@ -0,0 +1,10 @@ +error: inline assembly is not stable enough for use and is subject to change (see issue #29722) + --> $DIR/feature-gate-asm2.rs:15:24 + | +15 | println!("{}", asm!("")); //~ ERROR inline assembly is not stable + | ^^^^^^^^ + | + = help: add #![feature(asm)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-assoc-type-defaults.rs b/src/test/ui/feature-gate-assoc-type-defaults.rs similarity index 100% rename from src/test/compile-fail/feature-gate-assoc-type-defaults.rs rename to src/test/ui/feature-gate-assoc-type-defaults.rs diff --git a/src/test/ui/feature-gate-assoc-type-defaults.stderr b/src/test/ui/feature-gate-assoc-type-defaults.stderr new file mode 100644 index 0000000000..5e28846916 --- /dev/null +++ b/src/test/ui/feature-gate-assoc-type-defaults.stderr @@ -0,0 +1,10 @@ +error: associated type defaults are unstable (see issue #29661) + --> $DIR/feature-gate-assoc-type-defaults.rs:14:5 + | +14 | type Bar = u8; //~ ERROR associated type defaults are unstable + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(associated_type_defaults)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-box-expr.rs b/src/test/ui/feature-gate-box-expr.rs similarity index 100% rename from src/test/compile-fail/feature-gate-box-expr.rs rename to src/test/ui/feature-gate-box-expr.rs diff --git a/src/test/ui/feature-gate-box-expr.stderr b/src/test/ui/feature-gate-box-expr.stderr new file mode 100644 index 0000000000..cef5adbd15 --- /dev/null +++ b/src/test/ui/feature-gate-box-expr.stderr @@ -0,0 +1,10 @@ +error: box expression syntax is experimental; you can call `Box::new` instead. (see issue #27779) + --> $DIR/feature-gate-box-expr.rs:22:13 + | +22 | let x = box 'c'; //~ ERROR box expression syntax is experimental + | ^^^^^^^ + | + = help: add #![feature(box_syntax)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-box-pat.rs b/src/test/ui/feature-gate-box_patterns.rs similarity index 95% rename from src/test/compile-fail/feature-gate-box-pat.rs rename to src/test/ui/feature-gate-box_patterns.rs index c30f3952db..e64081823e 100644 --- a/src/test/compile-fail/feature-gate-box-pat.rs +++ b/src/test/ui/feature-gate-box_patterns.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-box_patterns - fn main() { let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental println!("x: {}", x); diff --git a/src/test/ui/feature-gate-box_patterns.stderr b/src/test/ui/feature-gate-box_patterns.stderr new file mode 100644 index 0000000000..0a30de58a1 --- /dev/null +++ b/src/test/ui/feature-gate-box_patterns.stderr @@ -0,0 +1,10 @@ +error: box pattern syntax is experimental (see issue #29641) + --> $DIR/feature-gate-box_patterns.rs:12:9 + | +12 | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental + | ^^^^^ + | + = help: add #![feature(box_patterns)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-box-syntax.rs b/src/test/ui/feature-gate-box_syntax.rs similarity index 96% rename from src/test/compile-fail/gated-box-syntax.rs rename to src/test/ui/feature-gate-box_syntax.rs index 9a68ddb305..a2643fe02b 100644 --- a/src/test/compile-fail/gated-box-syntax.rs +++ b/src/test/ui/feature-gate-box_syntax.rs @@ -10,8 +10,6 @@ // Test that the use of the box syntax is gated by `box_syntax` feature gate. -// gate-test-box_syntax - fn main() { let x = box 3; //~^ ERROR box expression syntax is experimental; you can call `Box::new` instead. diff --git a/src/test/ui/feature-gate-box_syntax.stderr b/src/test/ui/feature-gate-box_syntax.stderr new file mode 100644 index 0000000000..9b21dd0305 --- /dev/null +++ b/src/test/ui/feature-gate-box_syntax.stderr @@ -0,0 +1,10 @@ +error: box expression syntax is experimental; you can call `Box::new` instead. (see issue #27779) + --> $DIR/feature-gate-box_syntax.rs:14:13 + | +14 | let x = box 3; + | ^^^^^ + | + = help: add #![feature(box_syntax)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-catch_expr.rs b/src/test/ui/feature-gate-catch_expr.rs similarity index 100% rename from src/test/compile-fail/feature-gate-catch_expr.rs rename to src/test/ui/feature-gate-catch_expr.rs diff --git a/src/test/ui/feature-gate-catch_expr.stderr b/src/test/ui/feature-gate-catch_expr.stderr new file mode 100644 index 0000000000..f486373d22 --- /dev/null +++ b/src/test/ui/feature-gate-catch_expr.stderr @@ -0,0 +1,14 @@ +error: `catch` expression is experimental (see issue #31436) + --> $DIR/feature-gate-catch_expr.rs:12:24 + | +12 | let catch_result = do catch { //~ ERROR `catch` expression is experimental + | ________________________^ +13 | | let x = 5; +14 | | x +15 | | }; + | |_____^ + | + = help: add #![feature(catch_expr)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-cfg-target-feature.rs b/src/test/ui/feature-gate-cfg-target-feature.rs similarity index 100% rename from src/test/compile-fail/feature-gate-cfg-target-feature.rs rename to src/test/ui/feature-gate-cfg-target-feature.rs diff --git a/src/test/ui/feature-gate-cfg-target-feature.stderr b/src/test/ui/feature-gate-cfg-target-feature.stderr new file mode 100644 index 0000000000..60dc6fbb57 --- /dev/null +++ b/src/test/ui/feature-gate-cfg-target-feature.stderr @@ -0,0 +1,34 @@ +error: `cfg(target_feature)` is experimental and subject to change (see issue #29717) + --> $DIR/feature-gate-cfg-target-feature.rs:12:12 + | +12 | #[cfg_attr(target_feature = "x", x)] //~ ERROR `cfg(target_feature)` is experimental + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_feature)] to the crate attributes to enable + +error: `cfg(target_feature)` is experimental and subject to change (see issue #29717) + --> $DIR/feature-gate-cfg-target-feature.rs:11:7 + | +11 | #[cfg(target_feature = "x")] //~ ERROR `cfg(target_feature)` is experimental + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_feature)] to the crate attributes to enable + +error: `cfg(target_feature)` is experimental and subject to change (see issue #29717) + --> $DIR/feature-gate-cfg-target-feature.rs:15:19 + | +15 | #[cfg(not(any(all(target_feature = "x"))))] //~ ERROR `cfg(target_feature)` is experimental + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_feature)] to the crate attributes to enable + +error: `cfg(target_feature)` is experimental and subject to change (see issue #29717) + --> $DIR/feature-gate-cfg-target-feature.rs:19:10 + | +19 | cfg!(target_feature = "x"); + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_feature)] to the crate attributes to enable + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/feature-gate-cfg-target-has-atomic.rs b/src/test/ui/feature-gate-cfg-target-has-atomic.rs similarity index 100% rename from src/test/compile-fail/feature-gate-cfg-target-has-atomic.rs rename to src/test/ui/feature-gate-cfg-target-has-atomic.rs diff --git a/src/test/ui/feature-gate-cfg-target-has-atomic.stderr b/src/test/ui/feature-gate-cfg-target-has-atomic.stderr new file mode 100644 index 0000000000..5daf5de712 --- /dev/null +++ b/src/test/ui/feature-gate-cfg-target-has-atomic.stderr @@ -0,0 +1,122 @@ +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:23:7 + | +23 | #[cfg(target_has_atomic = "8")] + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:29:7 + | +29 | #[cfg(target_has_atomic = "8")] + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:34:7 + | +34 | #[cfg(target_has_atomic = "16")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:39:7 + | +39 | #[cfg(target_has_atomic = "16")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:44:7 + | +44 | #[cfg(target_has_atomic = "32")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:49:7 + | +49 | #[cfg(target_has_atomic = "32")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:54:7 + | +54 | #[cfg(target_has_atomic = "64")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:59:7 + | +59 | #[cfg(target_has_atomic = "64")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:64:7 + | +64 | #[cfg(target_has_atomic = "ptr")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:69:7 + | +69 | #[cfg(target_has_atomic = "ptr")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:76:10 + | +76 | cfg!(target_has_atomic = "8"); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:78:10 + | +78 | cfg!(target_has_atomic = "16"); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:80:10 + | +80 | cfg!(target_has_atomic = "32"); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:82:10 + | +82 | cfg!(target_has_atomic = "64"); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) + --> $DIR/feature-gate-cfg-target-has-atomic.rs:84:10 + | +84 | cfg!(target_has_atomic = "ptr"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable + +error: aborting due to 15 previous errors + diff --git a/src/test/compile-fail/feature-gate-cfg-target-thread-local.rs b/src/test/ui/feature-gate-cfg-target-thread-local.rs similarity index 100% rename from src/test/compile-fail/feature-gate-cfg-target-thread-local.rs rename to src/test/ui/feature-gate-cfg-target-thread-local.rs diff --git a/src/test/ui/feature-gate-cfg-target-thread-local.stderr b/src/test/ui/feature-gate-cfg-target-thread-local.stderr new file mode 100644 index 0000000000..9e2eea6e0a --- /dev/null +++ b/src/test/ui/feature-gate-cfg-target-thread-local.stderr @@ -0,0 +1,10 @@ +error: `cfg(target_thread_local)` is experimental and subject to change (see issue #29594) + --> $DIR/feature-gate-cfg-target-thread-local.rs:19:16 + | +19 | #[cfg_attr(target_thread_local, thread_local)] + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_thread_local)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-cfg-target-vendor.rs b/src/test/ui/feature-gate-cfg-target-vendor.rs similarity index 100% rename from src/test/compile-fail/feature-gate-cfg-target-vendor.rs rename to src/test/ui/feature-gate-cfg-target-vendor.rs diff --git a/src/test/ui/feature-gate-cfg-target-vendor.stderr b/src/test/ui/feature-gate-cfg-target-vendor.stderr new file mode 100644 index 0000000000..c5709600db --- /dev/null +++ b/src/test/ui/feature-gate-cfg-target-vendor.stderr @@ -0,0 +1,34 @@ +error: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) + --> $DIR/feature-gate-cfg-target-vendor.rs:12:12 + | +12 | #[cfg_attr(target_vendor = "x", x)] //~ ERROR `cfg(target_vendor)` is experimental + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable + +error: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) + --> $DIR/feature-gate-cfg-target-vendor.rs:11:7 + | +11 | #[cfg(target_vendor = "x")] //~ ERROR `cfg(target_vendor)` is experimental + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable + +error: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) + --> $DIR/feature-gate-cfg-target-vendor.rs:15:19 + | +15 | #[cfg(not(any(all(target_vendor = "x"))))] //~ ERROR `cfg(target_vendor)` is experimental + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable + +error: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) + --> $DIR/feature-gate-cfg-target-vendor.rs:19:10 + | +19 | cfg!(target_vendor = "x"); + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/feature-gate-clone-closures.rs b/src/test/ui/feature-gate-clone-closures.rs similarity index 100% rename from src/test/compile-fail/feature-gate-clone-closures.rs rename to src/test/ui/feature-gate-clone-closures.rs diff --git a/src/test/ui/feature-gate-clone-closures.stderr b/src/test/ui/feature-gate-clone-closures.stderr new file mode 100644 index 0000000000..3e07aa1744 --- /dev/null +++ b/src/test/ui/feature-gate-clone-closures.stderr @@ -0,0 +1,10 @@ +error[E0599]: no method named `clone` found for type `[closure@$DIR/feature-gate-clone-closures.rs:16:17: 18:6 a:_]` in the current scope + --> $DIR/feature-gate-clone-closures.rs:20:23 + | +20 | let hello = hello.clone(); //~ ERROR no method named `clone` found for type + | ^^^^^ + | + = note: hello is a function, perhaps you wish to call it + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-compiler-builtins.rs b/src/test/ui/feature-gate-compiler-builtins.rs similarity index 100% rename from src/test/compile-fail/feature-gate-compiler-builtins.rs rename to src/test/ui/feature-gate-compiler-builtins.rs diff --git a/src/test/ui/feature-gate-compiler-builtins.stderr b/src/test/ui/feature-gate-compiler-builtins.stderr new file mode 100644 index 0000000000..ebf42b2bdd --- /dev/null +++ b/src/test/ui/feature-gate-compiler-builtins.stderr @@ -0,0 +1,10 @@ +error: the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate which contains compiler-rt intrinsics and will never be stable + --> $DIR/feature-gate-compiler-builtins.rs:11:1 + | +11 | #![compiler_builtins] //~ ERROR the `#[compiler_builtins]` attribute is + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(compiler_builtins)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/concat_idents-gate.rs b/src/test/ui/feature-gate-concat_idents.rs similarity index 96% rename from src/test/compile-fail/concat_idents-gate.rs rename to src/test/ui/feature-gate-concat_idents.rs index 5b125d0e51..f4d9744572 100644 --- a/src/test/compile-fail/concat_idents-gate.rs +++ b/src/test/ui/feature-gate-concat_idents.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-concat_idents - const XY_1: i32 = 10; fn main() { diff --git a/src/test/ui/feature-gate-concat_idents.stderr b/src/test/ui/feature-gate-concat_idents.stderr new file mode 100644 index 0000000000..c980668c29 --- /dev/null +++ b/src/test/ui/feature-gate-concat_idents.stderr @@ -0,0 +1,18 @@ +error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) + --> $DIR/feature-gate-concat_idents.rs:15:13 + | +15 | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(concat_idents)] to the crate attributes to enable + +error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) + --> $DIR/feature-gate-concat_idents.rs:16:13 + | +16 | let b = concat_idents!(X, Y_2); //~ ERROR `concat_idents` is not stable + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(concat_idents)] to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/gated-concat_idents.rs b/src/test/ui/feature-gate-concat_idents2.rs similarity index 100% rename from src/test/compile-fail/gated-concat_idents.rs rename to src/test/ui/feature-gate-concat_idents2.rs diff --git a/src/test/ui/feature-gate-concat_idents2.stderr b/src/test/ui/feature-gate-concat_idents2.stderr new file mode 100644 index 0000000000..9cfd954eec --- /dev/null +++ b/src/test/ui/feature-gate-concat_idents2.stderr @@ -0,0 +1,10 @@ +error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) + --> $DIR/feature-gate-concat_idents2.rs:14:5 + | +14 | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(concat_idents)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/concat_idents-gate2.rs b/src/test/ui/feature-gate-concat_idents3.rs similarity index 100% rename from src/test/compile-fail/concat_idents-gate2.rs rename to src/test/ui/feature-gate-concat_idents3.rs diff --git a/src/test/ui/feature-gate-concat_idents3.stderr b/src/test/ui/feature-gate-concat_idents3.stderr new file mode 100644 index 0000000000..8399ca3c50 --- /dev/null +++ b/src/test/ui/feature-gate-concat_idents3.stderr @@ -0,0 +1,18 @@ +error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) + --> $DIR/feature-gate-concat_idents3.rs:17:20 + | +17 | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is not stable + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(concat_idents)] to the crate attributes to enable + +error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) + --> $DIR/feature-gate-concat_idents3.rs:18:20 + | +18 | assert_eq!(20, concat_idents!(X, Y_2)); //~ ERROR `concat_idents` is not stable + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(concat_idents)] to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/impl-trait/feature-gate.rs b/src/test/ui/feature-gate-conservative_impl_trait.rs similarity index 93% rename from src/test/compile-fail/impl-trait/feature-gate.rs rename to src/test/ui/feature-gate-conservative_impl_trait.rs index d46a16450d..7a3ae639bf 100644 --- a/src/test/compile-fail/impl-trait/feature-gate.rs +++ b/src/test/ui/feature-gate-conservative_impl_trait.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-conservative_impl_trait - fn foo() -> impl Fn() { || {} } //~^ ERROR `impl Trait` in return position is experimental diff --git a/src/test/ui/feature-gate-conservative_impl_trait.stderr b/src/test/ui/feature-gate-conservative_impl_trait.stderr new file mode 100644 index 0000000000..72a4f52926 --- /dev/null +++ b/src/test/ui/feature-gate-conservative_impl_trait.stderr @@ -0,0 +1,10 @@ +error: `impl Trait` in return position is experimental (see issue #34511) + --> $DIR/feature-gate-conservative_impl_trait.rs:11:13 + | +11 | fn foo() -> impl Fn() { || {} } + | ^^^^^^^^^ + | + = help: add #![feature(conservative_impl_trait)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-const-indexing.rs b/src/test/ui/feature-gate-const-indexing.rs similarity index 100% rename from src/test/compile-fail/feature-gate-const-indexing.rs rename to src/test/ui/feature-gate-const-indexing.rs diff --git a/src/test/ui/feature-gate-const-indexing.stderr b/src/test/ui/feature-gate-const-indexing.stderr new file mode 100644 index 0000000000..bc4b687800 --- /dev/null +++ b/src/test/ui/feature-gate-const-indexing.stderr @@ -0,0 +1,8 @@ +error[E0080]: constant evaluation error + --> $DIR/feature-gate-const-indexing.rs:16:24 + | +16 | const BLUB: [i32; (ARR[0] - 41) as usize] = [5]; //~ ERROR constant evaluation error + | ^^^^^^ the index operation on const values is unstable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-fn-stability.rs b/src/test/ui/feature-gate-const_fn.rs similarity index 98% rename from src/test/compile-fail/const-fn-stability.rs rename to src/test/ui/feature-gate-const_fn.rs index d093364497..1d1dedddaa 100644 --- a/src/test/compile-fail/const-fn-stability.rs +++ b/src/test/ui/feature-gate-const_fn.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-const_fn - // Test use of const fn without feature gate. const fn foo() -> usize { 0 } //~ ERROR const fn is unstable diff --git a/src/test/ui/feature-gate-const_fn.stderr b/src/test/ui/feature-gate-const_fn.stderr new file mode 100644 index 0000000000..c62229ac71 --- /dev/null +++ b/src/test/ui/feature-gate-const_fn.stderr @@ -0,0 +1,60 @@ +error[E0379]: trait fns cannot be declared const + --> $DIR/feature-gate-const_fn.rs:16:5 + | +16 | const fn foo() -> u32; //~ ERROR const fn is unstable + | ^^^^^ trait fns cannot be const + +error[E0379]: trait fns cannot be declared const + --> $DIR/feature-gate-const_fn.rs:18:5 + | +18 | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable + | ^^^^^ trait fns cannot be const + +error[E0379]: trait fns cannot be declared const + --> $DIR/feature-gate-const_fn.rs:27:5 + | +27 | const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable + | ^^^^^ trait fns cannot be const + +error: const fn is unstable (see issue #24111) + --> $DIR/feature-gate-const_fn.rs:13:1 + | +13 | const fn foo() -> usize { 0 } //~ ERROR const fn is unstable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_fn)] to the crate attributes to enable + +error: const fn is unstable (see issue #24111) + --> $DIR/feature-gate-const_fn.rs:16:5 + | +16 | const fn foo() -> u32; //~ ERROR const fn is unstable + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_fn)] to the crate attributes to enable + +error: const fn is unstable (see issue #24111) + --> $DIR/feature-gate-const_fn.rs:18:5 + | +18 | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_fn)] to the crate attributes to enable + +error: const fn is unstable (see issue #24111) + --> $DIR/feature-gate-const_fn.rs:23:5 + | +23 | const fn baz() -> u32 { 0 } //~ ERROR const fn is unstable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_fn)] to the crate attributes to enable + +error: const fn is unstable (see issue #24111) + --> $DIR/feature-gate-const_fn.rs:27:5 + | +27 | const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_fn)] to the crate attributes to enable + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/feature-gate-copy-closures.rs b/src/test/ui/feature-gate-copy-closures.rs similarity index 100% rename from src/test/compile-fail/feature-gate-copy-closures.rs rename to src/test/ui/feature-gate-copy-closures.rs diff --git a/src/test/ui/feature-gate-copy-closures.stderr b/src/test/ui/feature-gate-copy-closures.stderr new file mode 100644 index 0000000000..9b324672f2 --- /dev/null +++ b/src/test/ui/feature-gate-copy-closures.stderr @@ -0,0 +1,12 @@ +error[E0382]: use of moved value: `hello` + --> $DIR/feature-gate-copy-closures.rs:18:9 + | +17 | let b = hello; + | - value moved here +18 | let c = hello; //~ ERROR use of moved value: `hello` [E0382] + | ^ value used here after move + | + = note: move occurs because `hello` has type `[closure@$DIR/feature-gate-copy-closures.rs:13:17: 15:6 a:&i32]`, which does not implement the `Copy` trait + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/compile-fail/overflowing-rsh.rs b/src/test/ui/feature-gate-crate_in_paths.rs similarity index 74% rename from src/tools/miri/tests/compile-fail/overflowing-rsh.rs rename to src/test/ui/feature-gate-crate_in_paths.rs index a7ac9d1d50..830ec5959b 100644 --- a/src/tools/miri/tests/compile-fail/overflowing-rsh.rs +++ b/src/test/ui/feature-gate-crate_in_paths.rs @@ -1,4 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(exceeding_bitshifts)] +struct S; fn main() { - let _n = 1i64 >> 64; //~ Overflow(Shr) + let _ = ::crate::S; //~ ERROR `crate` in paths is experimental } diff --git a/src/test/ui/feature-gate-crate_in_paths.stderr b/src/test/ui/feature-gate-crate_in_paths.stderr new file mode 100644 index 0000000000..b13c82ecfc --- /dev/null +++ b/src/test/ui/feature-gate-crate_in_paths.stderr @@ -0,0 +1,10 @@ +error: `crate` in paths is experimental (see issue #45477) + --> $DIR/feature-gate-crate_in_paths.rs:14:15 + | +14 | let _ = ::crate::S; //~ ERROR `crate` in paths is experimental + | ^^^^^ + | + = help: add #![feature(crate_in_paths)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-crate_visibility_modifier.rs b/src/test/ui/feature-gate-crate_visibility_modifier.rs similarity index 100% rename from src/test/compile-fail/feature-gate-crate_visibility_modifier.rs rename to src/test/ui/feature-gate-crate_visibility_modifier.rs diff --git a/src/test/ui/feature-gate-crate_visibility_modifier.stderr b/src/test/ui/feature-gate-crate_visibility_modifier.stderr new file mode 100644 index 0000000000..0862744b87 --- /dev/null +++ b/src/test/ui/feature-gate-crate_visibility_modifier.stderr @@ -0,0 +1,10 @@ +error: `crate` visibility modifier is experimental (see issue #45388) + --> $DIR/feature-gate-crate_visibility_modifier.rs:11:1 + | +11 | crate struct Bender { //~ ERROR `crate` visibility modifier is experimental + | ^^^^^ + | + = help: add #![feature(crate_visibility_modifier)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/attr-literals.rs b/src/test/ui/feature-gate-custom_attribute.rs similarity index 98% rename from src/test/compile-fail/attr-literals.rs rename to src/test/ui/feature-gate-custom_attribute.rs index e77fde845a..b542880351 100644 --- a/src/test/compile-fail/attr-literals.rs +++ b/src/test/ui/feature-gate-custom_attribute.rs @@ -10,8 +10,6 @@ // Check that literals in attributes parse just fine. -// gate-test-custom_attribute - #![feature(rustc_attrs, attr_literals)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/feature-gate-custom_attribute.stderr b/src/test/ui/feature-gate-custom_attribute.stderr new file mode 100644 index 0000000000..866ebfe8f2 --- /dev/null +++ b/src/test/ui/feature-gate-custom_attribute.stderr @@ -0,0 +1,106 @@ +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:17:1 + | +17 | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:18:1 + | +18 | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:19:1 + | +19 | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:20:1 + | +20 | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:21:1 + | +21 | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:22:1 + | +22 | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:23:1 + | +23 | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:24:1 + | +24 | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:25:1 + | +25 | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:26:1 + | +26 | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:27:1 + | +27 | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:28:1 + | +28 | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute.rs:29:1 + | +29 | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 13 previous errors + diff --git a/src/test/compile-fail/attr-on-generic-formals-are-visited.rs b/src/test/ui/feature-gate-custom_attribute2.rs similarity index 100% rename from src/test/compile-fail/attr-on-generic-formals-are-visited.rs rename to src/test/ui/feature-gate-custom_attribute2.rs diff --git a/src/test/ui/feature-gate-custom_attribute2.stderr b/src/test/ui/feature-gate-custom_attribute2.stderr new file mode 100644 index 0000000000..3e4ea58a7a --- /dev/null +++ b/src/test/ui/feature-gate-custom_attribute2.stderr @@ -0,0 +1,138 @@ +error: The attribute `lt_struct` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:23:13 + | +23 | struct StLt<#[lt_struct] 'a>(&'a u32); + | ^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_struct` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:25:13 + | +25 | struct StTy<#[ty_struct] I>(I); + | ^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_enum` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:28:11 + | +28 | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B } + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_enum` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:30:11 + | +30 | enum EnTy<#[ty_enum] J> { A(J), B } + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_trait` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:33:12 + | +33 | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; } + | ^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_trait` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:35:12 + | +35 | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); } + | ^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_type` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:38:11 + | +38 | type TyLt<#[lt_type] 'd> = &'d u32; + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_type` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:40:11 + | +40 | type TyTy<#[ty_type] L> = (L, ); + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_inherent` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:43:6 + | +43 | impl<#[lt_inherent] 'e> StLt<'e> { } + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_inherent` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:45:6 + | +45 | impl<#[ty_inherent] M> StTy<M> { } + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_impl_for` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:48:6 + | +48 | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> { + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_impl_for` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:52:6 + | +52 | impl<#[ty_impl_for] N> TrTy<N> for StTy<N> { + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_fn` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:57:9 + | +57 | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } } + | ^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_fn` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:59:9 + | +59 | fn f_ty<#[ty_fn] O>(_: O) { } + | ^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_meth` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:63:13 + | +63 | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } } + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `ty_meth` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:65:13 + | +65 | fn m_ty<#[ty_meth] P>(_: P) { } + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: The attribute `lt_hof` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/feature-gate-custom_attribute2.rs:70:19 + | +70 | where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32 + | ^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 17 previous errors + diff --git a/src/test/compile-fail/single-derive-attr.rs b/src/test/ui/feature-gate-custom_derive.rs similarity index 95% rename from src/test/compile-fail/single-derive-attr.rs rename to src/test/ui/feature-gate-custom_derive.rs index cd37611ace..0b1b3141f5 100644 --- a/src/test/compile-fail/single-derive-attr.rs +++ b/src/test/ui/feature-gate-custom_derive.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-custom_derive - #[derive_Clone] //~^ ERROR attributes of the form `#[derive_*]` are reserved struct Test; diff --git a/src/test/ui/feature-gate-custom_derive.stderr b/src/test/ui/feature-gate-custom_derive.stderr new file mode 100644 index 0000000000..e806c80863 --- /dev/null +++ b/src/test/ui/feature-gate-custom_derive.stderr @@ -0,0 +1,10 @@ +error: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) + --> $DIR/feature-gate-custom_derive.rs:11:1 + | +11 | #[derive_Clone] + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_derive)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-decl_macro.rs b/src/test/ui/feature-gate-decl_macro.rs similarity index 88% rename from src/test/compile-fail/feature-gate-decl_macro.rs rename to src/test/ui/feature-gate-decl_macro.rs index c5c83977c7..4cb34c8274 100644 --- a/src/test/compile-fail/feature-gate-decl_macro.rs +++ b/src/test/ui/feature-gate-decl_macro.rs @@ -11,6 +11,5 @@ #![allow(unused_macros)] macro m() {} //~ ERROR `macro` is experimental (see issue #39412) -//~| HELP add #![feature(decl_macro)] to the crate attributes to enable fn main() {} diff --git a/src/test/ui/feature-gate-decl_macro.stderr b/src/test/ui/feature-gate-decl_macro.stderr new file mode 100644 index 0000000000..49ce4eb10b --- /dev/null +++ b/src/test/ui/feature-gate-decl_macro.stderr @@ -0,0 +1,10 @@ +error: `macro` is experimental (see issue #39412) + --> $DIR/feature-gate-decl_macro.rs:13:1 + | +13 | macro m() {} //~ ERROR `macro` is experimental (see issue #39412) + | ^^^^^^^^^^^^ + | + = help: add #![feature(decl_macro)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/type-parameter-invalid-lint.rs b/src/test/ui/feature-gate-default_type_parameter_fallback.rs similarity index 94% rename from src/test/compile-fail/type-parameter-invalid-lint.rs rename to src/test/ui/feature-gate-default_type_parameter_fallback.rs index f424cbf0c3..ccc5ec49f1 100644 --- a/src/test/compile-fail/type-parameter-invalid-lint.rs +++ b/src/test/ui/feature-gate-default_type_parameter_fallback.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-default_type_parameter_fallback - #![allow(unused)] fn avg<T=i32>(_: T) {} diff --git a/src/test/ui/feature-gate-default_type_parameter_fallback.stderr b/src/test/ui/feature-gate-default_type_parameter_fallback.stderr new file mode 100644 index 0000000000..d756a69e8c --- /dev/null +++ b/src/test/ui/feature-gate-default_type_parameter_fallback.stderr @@ -0,0 +1,21 @@ +error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions. + --> $DIR/feature-gate-default_type_parameter_fallback.rs:13:8 + | +13 | fn avg<T=i32>(_: T) {} + | ^ + | + = note: #[deny(invalid_type_param_default)] on by default + = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> + +error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions. + --> $DIR/feature-gate-default_type_parameter_fallback.rs:18:6 + | +18 | impl<T=i32> S<T> {} + | ^ + | + = 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 #36887 <https://github.com/rust-lang/rust/issues/36887> + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-doc_cfg.rs b/src/test/ui/feature-gate-doc_cfg.rs similarity index 100% rename from src/test/compile-fail/feature-gate-doc_cfg.rs rename to src/test/ui/feature-gate-doc_cfg.rs diff --git a/src/test/ui/feature-gate-doc_cfg.stderr b/src/test/ui/feature-gate-doc_cfg.stderr new file mode 100644 index 0000000000..c2d8a934ab --- /dev/null +++ b/src/test/ui/feature-gate-doc_cfg.stderr @@ -0,0 +1,10 @@ +error: #[doc(cfg(...))] is experimental (see issue #43781) + --> $DIR/feature-gate-doc_cfg.rs:11:1 + | +11 | #[doc(cfg(unix))] //~ ERROR: #[doc(cfg(...))] is experimental + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(doc_cfg)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-doc_masked.rs b/src/test/ui/feature-gate-doc_masked.rs similarity index 100% rename from src/test/compile-fail/feature-gate-doc_masked.rs rename to src/test/ui/feature-gate-doc_masked.rs diff --git a/src/test/ui/feature-gate-doc_masked.stderr b/src/test/ui/feature-gate-doc_masked.stderr new file mode 100644 index 0000000000..1102076530 --- /dev/null +++ b/src/test/ui/feature-gate-doc_masked.stderr @@ -0,0 +1,10 @@ +error: #[doc(masked)] is experimental (see issue #44027) + --> $DIR/feature-gate-doc_masked.rs:11:1 + | +11 | #[doc(masked)] //~ ERROR: #[doc(masked)] is experimental + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(doc_masked)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/ui/feature-gate-doc_spotlight.rs b/src/test/ui/feature-gate-doc_spotlight.rs new file mode 100644 index 0000000000..6369358538 --- /dev/null +++ b/src/test/ui/feature-gate-doc_spotlight.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[doc(spotlight)] //~ ERROR: #[doc(spotlight)] is experimental +trait SomeTrait {} + +fn main() {} diff --git a/src/test/ui/feature-gate-doc_spotlight.stderr b/src/test/ui/feature-gate-doc_spotlight.stderr new file mode 100644 index 0000000000..b743a1e94b --- /dev/null +++ b/src/test/ui/feature-gate-doc_spotlight.stderr @@ -0,0 +1,10 @@ +error: #[doc(spotlight)] is experimental (see issue #45040) + --> $DIR/feature-gate-doc_spotlight.rs:11:1 + | +11 | #[doc(spotlight)] //~ ERROR: #[doc(spotlight)] is experimental + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(doc_spotlight)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-dotdoteq_in_patterns.rs b/src/test/ui/feature-gate-dotdoteq_in_patterns.rs similarity index 100% rename from src/test/compile-fail/feature-gate-dotdoteq_in_patterns.rs rename to src/test/ui/feature-gate-dotdoteq_in_patterns.rs diff --git a/src/test/ui/feature-gate-dotdoteq_in_patterns.stderr b/src/test/ui/feature-gate-dotdoteq_in_patterns.stderr new file mode 100644 index 0000000000..5319dcef2d --- /dev/null +++ b/src/test/ui/feature-gate-dotdoteq_in_patterns.stderr @@ -0,0 +1,10 @@ +error: `..=` syntax in patterns is experimental (see issue #28237) + --> $DIR/feature-gate-dotdoteq_in_patterns.rs:13:9 + | +13 | 0 ..= 3 => {} //~ ERROR `..=` syntax in patterns is experimental + | ^^^^^^^ + | + = help: add #![feature(dotdoteq_in_patterns)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-dropck-ugeh-2.rs b/src/test/ui/feature-gate-dropck-ugeh-2.rs similarity index 100% rename from src/test/compile-fail/feature-gate-dropck-ugeh-2.rs rename to src/test/ui/feature-gate-dropck-ugeh-2.rs diff --git a/src/test/ui/feature-gate-dropck-ugeh-2.stderr b/src/test/ui/feature-gate-dropck-ugeh-2.stderr new file mode 100644 index 0000000000..0555b485d4 --- /dev/null +++ b/src/test/ui/feature-gate-dropck-ugeh-2.stderr @@ -0,0 +1,14 @@ +error: use of deprecated attribute `dropck_parametricity`: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future. See https://github.com/rust-lang/rust/issues/34761 + --> $DIR/feature-gate-dropck-ugeh-2.rs:17:5 + | +17 | #[unsafe_destructor_blind_to_params] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: lint level defined here + --> $DIR/feature-gate-dropck-ugeh-2.rs:11:9 + | +11 | #![deny(deprecated)] + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-dropck-ugeh.rs b/src/test/ui/feature-gate-dropck-ugeh.rs similarity index 100% rename from src/test/compile-fail/feature-gate-dropck-ugeh.rs rename to src/test/ui/feature-gate-dropck-ugeh.rs diff --git a/src/test/ui/feature-gate-dropck-ugeh.stderr b/src/test/ui/feature-gate-dropck-ugeh.stderr new file mode 100644 index 0000000000..b030ebcd88 --- /dev/null +++ b/src/test/ui/feature-gate-dropck-ugeh.stderr @@ -0,0 +1,10 @@ +error: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future (see issue #28498) + --> $DIR/feature-gate-dropck-ugeh.rs:29:5 + | +29 | #[unsafe_destructor_blind_to_params] // This is the UGEH attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(dropck_parametricity)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-dyn-trait.rs b/src/test/ui/feature-gate-dyn-trait.rs similarity index 100% rename from src/test/compile-fail/feature-gate-dyn-trait.rs rename to src/test/ui/feature-gate-dyn-trait.rs diff --git a/src/test/ui/feature-gate-dyn-trait.stderr b/src/test/ui/feature-gate-dyn-trait.stderr new file mode 100644 index 0000000000..28ecfdf113 --- /dev/null +++ b/src/test/ui/feature-gate-dyn-trait.stderr @@ -0,0 +1,10 @@ +error: `dyn Trait` syntax is unstable (see issue #44662) + --> $DIR/feature-gate-dyn-trait.rs:12:14 + | +12 | type A = Box<dyn Trait>; //~ ERROR `dyn Trait` syntax is unstable + | ^^^^^^^^^ + | + = help: add #![feature(dyn_trait)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-exclusive-range-pattern.rs b/src/test/ui/feature-gate-exclusive-range-pattern.rs similarity index 100% rename from src/test/compile-fail/feature-gate-exclusive-range-pattern.rs rename to src/test/ui/feature-gate-exclusive-range-pattern.rs diff --git a/src/test/ui/feature-gate-exclusive-range-pattern.stderr b/src/test/ui/feature-gate-exclusive-range-pattern.stderr new file mode 100644 index 0000000000..c6785d6f29 --- /dev/null +++ b/src/test/ui/feature-gate-exclusive-range-pattern.stderr @@ -0,0 +1,10 @@ +error: exclusive range pattern syntax is experimental (see issue #37854) + --> $DIR/feature-gate-exclusive-range-pattern.rs:13:9 + | +13 | 0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental + | ^^^^^^ + | + = help: add #![feature(exclusive_range_pattern)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/ui/feature-gate-extern_absolute_paths.rs b/src/test/ui/feature-gate-extern_absolute_paths.rs new file mode 100644 index 0000000000..40fdbf0bbd --- /dev/null +++ b/src/test/ui/feature-gate-extern_absolute_paths.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use core::default; //~ ERROR unresolved import `core` + +fn main() { + let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve +} diff --git a/src/test/ui/feature-gate-extern_absolute_paths.stderr b/src/test/ui/feature-gate-extern_absolute_paths.stderr new file mode 100644 index 0000000000..111cd06cb3 --- /dev/null +++ b/src/test/ui/feature-gate-extern_absolute_paths.stderr @@ -0,0 +1,14 @@ +error[E0432]: unresolved import `core` + --> $DIR/feature-gate-extern_absolute_paths.rs:11:5 + | +11 | use core::default; //~ ERROR unresolved import `core` + | ^^^^ Maybe a missing `extern crate core;`? + +error[E0433]: failed to resolve. Maybe a missing `extern crate core;`? + --> $DIR/feature-gate-extern_absolute_paths.rs:14:19 + | +14 | let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve + | ^^^^ Maybe a missing `extern crate core;`? + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-extern_types.rs b/src/test/ui/feature-gate-extern_types.rs similarity index 100% rename from src/test/compile-fail/feature-gate-extern_types.rs rename to src/test/ui/feature-gate-extern_types.rs diff --git a/src/test/ui/feature-gate-extern_types.stderr b/src/test/ui/feature-gate-extern_types.stderr new file mode 100644 index 0000000000..3815862e89 --- /dev/null +++ b/src/test/ui/feature-gate-extern_types.stderr @@ -0,0 +1,10 @@ +error: extern types are experimental (see issue #43467) + --> $DIR/feature-gate-extern_types.rs:12:5 + | +12 | type T; //~ ERROR extern types are experimental + | ^^^^^^^ + | + = help: add #![feature(extern_types)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/ui/feature-gate-external_doc.rs b/src/test/ui/feature-gate-external_doc.rs new file mode 100644 index 0000000000..fa0a2a2907 --- /dev/null +++ b/src/test/ui/feature-gate-external_doc.rs @@ -0,0 +1,12 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[doc(include="asdf.md")] //~ ERROR: #[doc(include = "...")] is experimental +fn main() {} diff --git a/src/test/ui/feature-gate-external_doc.stderr b/src/test/ui/feature-gate-external_doc.stderr new file mode 100644 index 0000000000..5479ab8bc9 --- /dev/null +++ b/src/test/ui/feature-gate-external_doc.stderr @@ -0,0 +1,10 @@ +error: #[doc(include = "...")] is experimental (see issue #44732) + --> $DIR/feature-gate-external_doc.rs:11:1 + | +11 | #[doc(include="asdf.md")] //~ ERROR: #[doc(include = "...")] is experimental + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(external_doc)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-feature-gate.rs b/src/test/ui/feature-gate-feature-gate.rs similarity index 100% rename from src/test/compile-fail/feature-gate-feature-gate.rs rename to src/test/ui/feature-gate-feature-gate.rs diff --git a/src/test/ui/feature-gate-feature-gate.stderr b/src/test/ui/feature-gate-feature-gate.stderr new file mode 100644 index 0000000000..3d5f0d70bb --- /dev/null +++ b/src/test/ui/feature-gate-feature-gate.stderr @@ -0,0 +1,14 @@ +error: unstable feature + --> $DIR/feature-gate-feature-gate.rs:12:12 + | +12 | #![feature(intrinsics)] //~ ERROR unstable feature + | ^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/feature-gate-feature-gate.rs:11:11 + | +11 | #![forbid(unstable_features)] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-fn_must_use-cap-lints-allow.rs b/src/test/ui/feature-gate-fn_must_use-cap-lints-allow.rs similarity index 100% rename from src/test/compile-fail/feature-gate-fn_must_use-cap-lints-allow.rs rename to src/test/ui/feature-gate-fn_must_use-cap-lints-allow.rs diff --git a/src/test/ui/feature-gate-fn_must_use-cap-lints-allow.stderr b/src/test/ui/feature-gate-fn_must_use-cap-lints-allow.stderr new file mode 100644 index 0000000000..9b16e9be68 --- /dev/null +++ b/src/test/ui/feature-gate-fn_must_use-cap-lints-allow.stderr @@ -0,0 +1,6 @@ +error: compilation successful + --> $DIR/feature-gate-fn_must_use-cap-lints-allow.rs:22:1 + | +22 | fn main() {} //~ ERROR compilation successful + | ^^^^^^^^^^^^ + diff --git a/src/test/compile-fail/feature-gate-fn_must_use.rs b/src/test/ui/feature-gate-fn_must_use.rs similarity index 100% rename from src/test/compile-fail/feature-gate-fn_must_use.rs rename to src/test/ui/feature-gate-fn_must_use.rs diff --git a/src/test/ui/feature-gate-fn_must_use.stderr b/src/test/ui/feature-gate-fn_must_use.stderr new file mode 100644 index 0000000000..ed4953d27b --- /dev/null +++ b/src/test/ui/feature-gate-fn_must_use.stderr @@ -0,0 +1,22 @@ +warning: `#[must_use]` on methods is experimental (see issue #43302) + --> $DIR/feature-gate-fn_must_use.rs:16:5 + | +16 | #[must_use] //~ WARN `#[must_use]` on methods is experimental + | ^^^^^^^^^^^ + | + = help: add #![feature(fn_must_use)] to the crate attributes to enable + +warning: `#[must_use]` on functions is experimental (see issue #43302) + --> $DIR/feature-gate-fn_must_use.rs:20:1 + | +20 | #[must_use] //~ WARN `#[must_use]` on functions is experimental + | ^^^^^^^^^^^ + | + = help: add #![feature(fn_must_use)] to the crate attributes to enable + +error: compilation successful + --> $DIR/feature-gate-fn_must_use.rs:31:1 + | +31 | fn main() {} //~ ERROR compilation successful + | ^^^^^^^^^^^^ + diff --git a/src/test/compile-fail/feature-gate-fundamental.rs b/src/test/ui/feature-gate-fundamental.rs similarity index 100% rename from src/test/compile-fail/feature-gate-fundamental.rs rename to src/test/ui/feature-gate-fundamental.rs diff --git a/src/test/ui/feature-gate-fundamental.stderr b/src/test/ui/feature-gate-fundamental.stderr new file mode 100644 index 0000000000..0fc75ee30b --- /dev/null +++ b/src/test/ui/feature-gate-fundamental.stderr @@ -0,0 +1,10 @@ +error: the `#[fundamental]` attribute is an experimental feature (see issue #29635) + --> $DIR/feature-gate-fundamental.rs:11:1 + | +11 | #[fundamental] //~ ERROR the `#[fundamental]` attribute is an experimental feature + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(fundamental)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-generators.rs b/src/test/ui/feature-gate-generators.rs similarity index 100% rename from src/test/compile-fail/feature-gate-generators.rs rename to src/test/ui/feature-gate-generators.rs diff --git a/src/test/ui/feature-gate-generators.stderr b/src/test/ui/feature-gate-generators.stderr new file mode 100644 index 0000000000..82acb40133 --- /dev/null +++ b/src/test/ui/feature-gate-generators.stderr @@ -0,0 +1,10 @@ +error: yield syntax is experimental + --> $DIR/feature-gate-generators.rs:12:5 + | +12 | yield true; //~ ERROR yield syntax is experimental + | ^^^^^^^^^^ + | + = help: add #![feature(generators)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/run-pass-fullmir/foreign-fn-linkname.rs b/src/test/ui/feature-gate-generic_associated_types.rs similarity index 50% rename from src/tools/miri/tests/run-pass-fullmir/foreign-fn-linkname.rs rename to src/test/ui/feature-gate-generic_associated_types.rs index 20cb713590..724ec2496f 100644 --- a/src/tools/miri/tests/run-pass-fullmir/foreign-fn-linkname.rs +++ b/src/test/ui/feature-gate-generic_associated_types.rs @@ -8,30 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//ignore-msvc -#![feature(libc)] +use std::ops::Deref; -extern crate libc; -use std::ffi::CString; - -mod mlibc { - use libc::{c_char, size_t}; - - extern { - #[link_name = "strlen"] - pub fn my_strlen(str: *const c_char) -> size_t; - } +trait PointerFamily<U> { + type Pointer<T>: Deref<Target = T>; + //~^ ERROR generic associated types are unstable + type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; + //~^ ERROR generic associated types are unstable } -fn strlen(str: String) -> usize { - // C string is terminated with a zero - let s = CString::new(str).unwrap(); - unsafe { - mlibc::my_strlen(s.as_ptr()) as usize - } +struct Foo; +impl PointerFamily<u32> for Foo { + type Pointer<usize> = Box<usize>; + //~^ ERROR generic associated types are unstable + type Pointer2<u32> = Box<u32>; + //~^ ERROR generic associated types are unstable } -pub fn main() { - let len = strlen("Rust".to_string()); - assert_eq!(len, 4); -} +fn main() {} diff --git a/src/test/ui/feature-gate-generic_associated_types.stderr b/src/test/ui/feature-gate-generic_associated_types.stderr new file mode 100644 index 0000000000..7b2507e1fb --- /dev/null +++ b/src/test/ui/feature-gate-generic_associated_types.stderr @@ -0,0 +1,34 @@ +error: generic associated types are unstable (see issue #44265) + --> $DIR/feature-gate-generic_associated_types.rs:14:5 + | +14 | type Pointer<T>: Deref<Target = T>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_associated_types)] to the crate attributes to enable + +error: generic associated types are unstable (see issue #44265) + --> $DIR/feature-gate-generic_associated_types.rs:16:5 + | +16 | type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_associated_types)] to the crate attributes to enable + +error: generic associated types are unstable (see issue #44265) + --> $DIR/feature-gate-generic_associated_types.rs:22:5 + | +22 | type Pointer<usize> = Box<usize>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_associated_types)] to the crate attributes to enable + +error: generic associated types are unstable (see issue #44265) + --> $DIR/feature-gate-generic_associated_types.rs:24:5 + | +24 | type Pointer2<u32> = Box<u32>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_associated_types)] to the crate attributes to enable + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/attr-on-generic-formals-wo-feature-gate.rs b/src/test/ui/feature-gate-generic_param_attrs.rs similarity index 98% rename from src/test/compile-fail/attr-on-generic-formals-wo-feature-gate.rs rename to src/test/ui/feature-gate-generic_param_attrs.rs index b341f7c782..944802f450 100644 --- a/src/test/compile-fail/attr-on-generic-formals-wo-feature-gate.rs +++ b/src/test/ui/feature-gate-generic_param_attrs.rs @@ -16,8 +16,6 @@ // using `rustc_attrs` feature. There is a separate compile-fail/ test // ensuring that the attribute feature-gating works in this context.) -// gate-test-generic_param_attrs - #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/src/test/ui/feature-gate-generic_param_attrs.stderr b/src/test/ui/feature-gate-generic_param_attrs.stderr new file mode 100644 index 0000000000..da2e640302 --- /dev/null +++ b/src/test/ui/feature-gate-generic_param_attrs.stderr @@ -0,0 +1,138 @@ +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:22:13 + | +22 | struct StLt<#[rustc_lt_struct] 'a>(&'a u32); + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:24:13 + | +24 | struct StTy<#[rustc_ty_struct] I>(I); + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:27:11 + | +27 | enum EnLt<#[rustc_lt_enum] 'b> { A(&'b u32), B } + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:29:11 + | +29 | enum EnTy<#[rustc_ty_enum] J> { A(J), B } + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:32:12 + | +32 | trait TrLt<#[rustc_lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; } + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:34:12 + | +34 | trait TrTy<#[rustc_ty_trait] K> { fn foo(&self, _: K); } + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:37:11 + | +37 | type TyLt<#[rustc_lt_type] 'd> = &'d u32; + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:39:11 + | +39 | type TyTy<#[rustc_ty_type] L> = (L, ); + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:42:6 + | +42 | impl<#[rustc_lt_inherent] 'e> StLt<'e> { } + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:44:6 + | +44 | impl<#[rustc_ty_inherent] M> StTy<M> { } + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:47:6 + | +47 | impl<#[rustc_lt_impl_for] 'f> TrLt<'f> for StLt<'f> { + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:51:6 + | +51 | impl<#[rustc_ty_impl_for] N> TrTy<N> for StTy<N> { + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:56:9 + | +56 | fn f_lt<#[rustc_lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } } + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:58:9 + | +58 | fn f_ty<#[rustc_ty_fn] O>(_: O) { } + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:62:13 + | +62 | fn m_lt<#[rustc_lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } } + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on type parameter bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:64:13 + | +64 | fn m_ty<#[rustc_ty_meth] P>(_: P) { } + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: attributes on lifetime bindings are experimental (see issue #34761) + --> $DIR/feature-gate-generic_param_attrs.rs:69:19 + | +69 | where Q: for <#[rustc_lt_hof] 'i> Fn(&'i [u32]) -> &'i u32 + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(generic_param_attrs)] to the crate attributes to enable + +error: aborting due to 17 previous errors + diff --git a/src/test/compile-fail/feature-gate-global_allocator.rs b/src/test/ui/feature-gate-global_allocator.rs similarity index 100% rename from src/test/compile-fail/feature-gate-global_allocator.rs rename to src/test/ui/feature-gate-global_allocator.rs diff --git a/src/test/ui/feature-gate-global_allocator.stderr b/src/test/ui/feature-gate-global_allocator.stderr new file mode 100644 index 0000000000..7e6c4288ff --- /dev/null +++ b/src/test/ui/feature-gate-global_allocator.stderr @@ -0,0 +1,10 @@ +error: the `#[global_allocator]` attribute is an experimental feature + --> $DIR/feature-gate-global_allocator.rs:11:1 + | +11 | #[global_allocator] //~ ERROR: attribute is an experimental feature + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(global_allocator)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-global_asm.rs b/src/test/ui/feature-gate-global_asm.rs similarity index 100% rename from src/test/compile-fail/feature-gate-global_asm.rs rename to src/test/ui/feature-gate-global_asm.rs diff --git a/src/test/ui/feature-gate-global_asm.stderr b/src/test/ui/feature-gate-global_asm.stderr new file mode 100644 index 0000000000..de0ba1a7b3 --- /dev/null +++ b/src/test/ui/feature-gate-global_asm.stderr @@ -0,0 +1,10 @@ +error: `global_asm!` is not stable enough for use and is subject to change (see issue #35119) + --> $DIR/feature-gate-global_asm.rs:11:1 + | +11 | global_asm!(""); //~ ERROR `global_asm!` is not stable + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(global_asm)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/i128-feature.rs b/src/test/ui/feature-gate-i128_type.rs similarity index 96% rename from src/test/compile-fail/i128-feature.rs rename to src/test/ui/feature-gate-i128_type.rs index e94fd14a42..ddb49a3e5d 100644 --- a/src/test/compile-fail/i128-feature.rs +++ b/src/test/ui/feature-gate-i128_type.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-i128_type - fn test2() { 0i128; //~ ERROR 128-bit integers are not stable } diff --git a/src/test/ui/feature-gate-i128_type.stderr b/src/test/ui/feature-gate-i128_type.stderr new file mode 100644 index 0000000000..df623cac49 --- /dev/null +++ b/src/test/ui/feature-gate-i128_type.stderr @@ -0,0 +1,18 @@ +error: 128-bit integers are not stable (see issue #35118) + --> $DIR/feature-gate-i128_type.rs:12:5 + | +12 | 0i128; //~ ERROR 128-bit integers are not stable + | ^^^^^ + | + = help: add #![feature(i128_type)] to the crate attributes to enable + +error: 128-bit integers are not stable (see issue #35118) + --> $DIR/feature-gate-i128_type.rs:16:5 + | +16 | 0u128; //~ ERROR 128-bit integers are not stable + | ^^^^^ + | + = help: add #![feature(i128_type)] to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/i128-feature-2.rs b/src/test/ui/feature-gate-i128_type2.rs similarity index 100% rename from src/test/compile-fail/i128-feature-2.rs rename to src/test/ui/feature-gate-i128_type2.rs diff --git a/src/test/ui/feature-gate-i128_type2.stderr b/src/test/ui/feature-gate-i128_type2.stderr new file mode 100644 index 0000000000..26653a5739 --- /dev/null +++ b/src/test/ui/feature-gate-i128_type2.stderr @@ -0,0 +1,46 @@ +error: 128-bit type is unstable (see issue #35118) + --> $DIR/feature-gate-i128_type2.rs:13:15 + | +13 | fn test1() -> i128 { //~ ERROR 128-bit type is unstable + | ^^^^ + | + = help: add #![feature(i128_type)] to the crate attributes to enable + +error: 128-bit type is unstable (see issue #35118) + --> $DIR/feature-gate-i128_type2.rs:17:17 + | +17 | fn test1_2() -> u128 { //~ ERROR 128-bit type is unstable + | ^^^^ + | + = help: add #![feature(i128_type)] to the crate attributes to enable + +error: 128-bit type is unstable (see issue #35118) + --> $DIR/feature-gate-i128_type2.rs:22:12 + | +22 | let x: i128 = 0; //~ ERROR 128-bit type is unstable + | ^^^^ + | + = help: add #![feature(i128_type)] to the crate attributes to enable + +error: 128-bit type is unstable (see issue #35118) + --> $DIR/feature-gate-i128_type2.rs:26:12 + | +26 | let x: u128 = 0; //~ ERROR 128-bit type is unstable + | ^^^^ + | + = help: add #![feature(i128_type)] to the crate attributes to enable + +error[E0601]: main function not found + +error: repr with 128-bit type is unstable (see issue #35118) + --> $DIR/feature-gate-i128_type2.rs:30:1 + | +30 | / enum A { //~ ERROR 128-bit type is unstable +31 | | A(u64) +32 | | } + | |_^ + | + = help: add #![feature(repr128)] to the crate attributes to enable + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/feature-gate-in_band_lifetimes.rs b/src/test/ui/feature-gate-in_band_lifetimes.rs new file mode 100644 index 0000000000..ae1f81c2f5 --- /dev/null +++ b/src/test/ui/feature-gate-in_band_lifetimes.rs @@ -0,0 +1,72 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] + +fn foo(x: &'x u8) -> &'x u8 { x } +//~^ ERROR use of undeclared lifetime name +//~^^ ERROR use of undeclared lifetime name + +struct X<'a>(&'a u8); + +impl<'a> X<'a> { + fn inner(&self) -> &'a u8 { + self.0 + } +} + +impl<'a> X<'b> { +//~^ ERROR use of undeclared lifetime name + fn inner_2(&self) -> &'b u8 { + //~^ ERROR use of undeclared lifetime name + self.0 + } +} + +impl X<'b> { +//~^ ERROR use of undeclared lifetime name + fn inner_3(&self) -> &'b u8 { + //~^ ERROR use of undeclared lifetime name + self.0 + } +} + +struct Y<T>(T); + +impl Y<&'a u8> { + //~^ ERROR use of undeclared lifetime name + fn inner(&self) -> &'a u8 { + //~^ ERROR use of undeclared lifetime name + self.0 + } +} + +trait MyTrait<'a> { + fn my_lifetime(&self) -> &'a u8; + fn any_lifetime() -> &'b u8; + //~^ ERROR use of undeclared lifetime name + fn borrowed_lifetime(&'b self) -> &'b u8; + //~^ ERROR use of undeclared lifetime name + //~^^ ERROR use of undeclared lifetime name +} + +impl MyTrait<'a> for Y<&'a u8> { +//~^ ERROR use of undeclared lifetime name +//~^^ ERROR use of undeclared lifetime name + fn my_lifetime(&self) -> &'a u8 { self.0 } + //~^ ERROR use of undeclared lifetime name + fn any_lifetime() -> &'b u8 { &0 } + //~^ ERROR use of undeclared lifetime name + fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } + //~^ ERROR use of undeclared lifetime name + //~^^ ERROR use of undeclared lifetime name +} + +fn main() {} diff --git a/src/test/ui/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gate-in_band_lifetimes.stderr new file mode 100644 index 0000000000..3b03ef2dd3 --- /dev/null +++ b/src/test/ui/feature-gate-in_band_lifetimes.stderr @@ -0,0 +1,104 @@ +error[E0261]: use of undeclared lifetime name `'x` + --> $DIR/feature-gate-in_band_lifetimes.rs:13:12 + | +13 | fn foo(x: &'x u8) -> &'x u8 { x } + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'x` + --> $DIR/feature-gate-in_band_lifetimes.rs:13:23 + | +13 | fn foo(x: &'x u8) -> &'x u8 { x } + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:25:12 + | +25 | impl<'a> X<'b> { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:27:27 + | +27 | fn inner_2(&self) -> &'b u8 { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:33:8 + | +33 | impl X<'b> { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:35:27 + | +35 | fn inner_3(&self) -> &'b u8 { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:43:9 + | +43 | impl Y<&'a u8> { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:45:25 + | +45 | fn inner(&self) -> &'a u8 { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:53:27 + | +53 | fn any_lifetime() -> &'b u8; + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 + | +55 | fn borrowed_lifetime(&'b self) -> &'b u8; + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:55:40 + | +55 | fn borrowed_lifetime(&'b self) -> &'b u8; + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:60:14 + | +60 | impl MyTrait<'a> for Y<&'a u8> { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:60:25 + | +60 | impl MyTrait<'a> for Y<&'a u8> { + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:63:31 + | +63 | fn my_lifetime(&self) -> &'a u8 { self.0 } + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:65:27 + | +65 | fn any_lifetime() -> &'b u8 { &0 } + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:67:27 + | +67 | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:67:40 + | +67 | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } + | ^^ undeclared lifetime + +error: aborting due to 17 previous errors + diff --git a/src/test/compile-fail/feature-gate-intrinsics.rs b/src/test/ui/feature-gate-intrinsics.rs similarity index 100% rename from src/test/compile-fail/feature-gate-intrinsics.rs rename to src/test/ui/feature-gate-intrinsics.rs diff --git a/src/test/ui/feature-gate-intrinsics.stderr b/src/test/ui/feature-gate-intrinsics.stderr new file mode 100644 index 0000000000..5382122e30 --- /dev/null +++ b/src/test/ui/feature-gate-intrinsics.stderr @@ -0,0 +1,21 @@ +error: intrinsics are subject to change + --> $DIR/feature-gate-intrinsics.rs:11:1 + | +11 | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change +12 | | fn bar(); +13 | | } + | |_^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: intrinsics are subject to change + --> $DIR/feature-gate-intrinsics.rs:15:1 + | +15 | / extern "rust-intrinsic" fn baz() { //~ ERROR intrinsics are subject to change +16 | | } + | |_^ + | + = help: add #![feature(intrinsics)] to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-lang-items.rs b/src/test/ui/feature-gate-lang-items.rs similarity index 100% rename from src/test/compile-fail/feature-gate-lang-items.rs rename to src/test/ui/feature-gate-lang-items.rs diff --git a/src/test/ui/feature-gate-lang-items.stderr b/src/test/ui/feature-gate-lang-items.stderr new file mode 100644 index 0000000000..dab8ce2319 --- /dev/null +++ b/src/test/ui/feature-gate-lang-items.stderr @@ -0,0 +1,10 @@ +error: language items are subject to change + --> $DIR/feature-gate-lang-items.rs:11:1 + | +11 | #[lang="foo"] //~ ERROR language items are subject to change + | ^^^^^^^^^^^^^ + | + = help: add #![feature(lang_items)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-link-args.rs b/src/test/ui/feature-gate-link_args.rs similarity index 97% rename from src/test/compile-fail/gated-link-args.rs rename to src/test/ui/feature-gate-link_args.rs index 82f5db3042..bd48ac673d 100644 --- a/src/test/compile-fail/gated-link-args.rs +++ b/src/test/ui/feature-gate-link_args.rs @@ -12,8 +12,6 @@ // feature gate, both when it occurs where expected (atop // `extern { }` blocks) and where unexpected. -// gate-test-link_args - // sidestep warning (which is correct, but misleading for // purposes of this test) #![allow(unused_attributes)] diff --git a/src/test/ui/feature-gate-link_args.stderr b/src/test/ui/feature-gate-link_args.stderr new file mode 100644 index 0000000000..d6d059007d --- /dev/null +++ b/src/test/ui/feature-gate-link_args.stderr @@ -0,0 +1,26 @@ +error: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead (see issue #29596) + --> $DIR/feature-gate-link_args.rs:22:1 + | +22 | #[link_args = "-l expected_use_case"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(link_args)] to the crate attributes to enable + +error: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead (see issue #29596) + --> $DIR/feature-gate-link_args.rs:26:1 + | +26 | #[link_args = "-l unexected_use_on_non_extern_item"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(link_args)] to the crate attributes to enable + +error: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead (see issue #29596) + --> $DIR/feature-gate-link_args.rs:19:1 + | +19 | #![link_args = "-l unexpected_use_as_inner_attr_on_mod"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(link_args)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/link-cfg-gated.rs b/src/test/ui/feature-gate-link_cfg.rs similarity index 96% rename from src/test/compile-fail/link-cfg-gated.rs rename to src/test/ui/feature-gate-link_cfg.rs index bb6fb9e356..27918a27ca 100644 --- a/src/test/compile-fail/link-cfg-gated.rs +++ b/src/test/ui/feature-gate-link_cfg.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-link_cfg - #[link(name = "foo", cfg(foo))] //~^ ERROR: is feature gated extern {} diff --git a/src/test/ui/feature-gate-link_cfg.stderr b/src/test/ui/feature-gate-link_cfg.stderr new file mode 100644 index 0000000000..bbc52bd9d2 --- /dev/null +++ b/src/test/ui/feature-gate-link_cfg.stderr @@ -0,0 +1,10 @@ +error: is feature gated (see issue #37406) + --> $DIR/feature-gate-link_cfg.rs:11:1 + | +11 | #[link(name = "foo", cfg(foo))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(link_cfg)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-link-llvm-intrinsics.rs b/src/test/ui/feature-gate-link_llvm_intrinsics.rs similarity index 94% rename from src/test/compile-fail/gated-link-llvm-intrinsics.rs rename to src/test/ui/feature-gate-link_llvm_intrinsics.rs index 681824ae71..92a1b07143 100644 --- a/src/test/compile-fail/gated-link-llvm-intrinsics.rs +++ b/src/test/ui/feature-gate-link_llvm_intrinsics.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-link_llvm_intrinsics - extern { #[link_name = "llvm.sqrt.f32"] fn sqrt(x: f32) -> f32; diff --git a/src/test/ui/feature-gate-link_llvm_intrinsics.stderr b/src/test/ui/feature-gate-link_llvm_intrinsics.stderr new file mode 100644 index 0000000000..b2e2caaa51 --- /dev/null +++ b/src/test/ui/feature-gate-link_llvm_intrinsics.stderr @@ -0,0 +1,10 @@ +error: linking to LLVM intrinsics is experimental (see issue #29602) + --> $DIR/feature-gate-link_llvm_intrinsics.rs:13:5 + | +13 | fn sqrt(x: f32) -> f32; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(link_llvm_intrinsics)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/linkage1.rs b/src/test/ui/feature-gate-linkage.rs similarity index 96% rename from src/test/compile-fail/linkage1.rs rename to src/test/ui/feature-gate-linkage.rs index 1cf208f021..555cc2b9a7 100644 --- a/src/test/compile-fail/linkage1.rs +++ b/src/test/ui/feature-gate-linkage.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-linkage - extern { #[linkage = "extern_weak"] static foo: isize; //~^ ERROR: the `linkage` attribute is experimental and not portable diff --git a/src/test/ui/feature-gate-linkage.stderr b/src/test/ui/feature-gate-linkage.stderr new file mode 100644 index 0000000000..62d857ddf2 --- /dev/null +++ b/src/test/ui/feature-gate-linkage.stderr @@ -0,0 +1,10 @@ +error: the `linkage` attribute is experimental and not portable across platforms (see issue #29603) + --> $DIR/feature-gate-linkage.rs:12:5 + | +12 | #[linkage = "extern_weak"] static foo: isize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(linkage)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-linker-flavor.rs b/src/test/ui/feature-gate-linker-flavor.rs similarity index 100% rename from src/test/compile-fail/feature-gate-linker-flavor.rs rename to src/test/ui/feature-gate-linker-flavor.rs diff --git a/src/test/ui/feature-gate-linker-flavor.stderr b/src/test/ui/feature-gate-linker-flavor.stderr new file mode 100644 index 0000000000..383e75e3d1 --- /dev/null +++ b/src/test/ui/feature-gate-linker-flavor.stderr @@ -0,0 +1,10 @@ +error: the `#[used]` attribute is an experimental feature (see issue #40289) + --> $DIR/feature-gate-linker-flavor.rs:16:1 + | +16 | #[used] + | ^^^^^^^ + | + = help: add #![feature(used)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/log-syntax-gate.rs b/src/test/ui/feature-gate-log_syntax.rs similarity index 95% rename from src/test/compile-fail/log-syntax-gate.rs rename to src/test/ui/feature-gate-log_syntax.rs index b9688af35d..63c66e53c5 100644 --- a/src/test/compile-fail/log-syntax-gate.rs +++ b/src/test/ui/feature-gate-log_syntax.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-log_syntax - fn main() { log_syntax!() //~ ERROR `log_syntax!` is not stable enough } diff --git a/src/test/ui/feature-gate-log_syntax.stderr b/src/test/ui/feature-gate-log_syntax.stderr new file mode 100644 index 0000000000..f1c0d305f6 --- /dev/null +++ b/src/test/ui/feature-gate-log_syntax.stderr @@ -0,0 +1,10 @@ +error: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) + --> $DIR/feature-gate-log_syntax.rs:12:5 + | +12 | log_syntax!() //~ ERROR `log_syntax!` is not stable enough + | ^^^^^^^^^^^^^ + | + = help: add #![feature(log_syntax)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/log-syntax-gate2.rs b/src/test/ui/feature-gate-log_syntax2.rs similarity index 100% rename from src/test/compile-fail/log-syntax-gate2.rs rename to src/test/ui/feature-gate-log_syntax2.rs diff --git a/src/test/ui/feature-gate-log_syntax2.stderr b/src/test/ui/feature-gate-log_syntax2.stderr new file mode 100644 index 0000000000..b1bb5557ee --- /dev/null +++ b/src/test/ui/feature-gate-log_syntax2.stderr @@ -0,0 +1,10 @@ +error: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) + --> $DIR/feature-gate-log_syntax2.rs:14:20 + | +14 | println!("{}", log_syntax!()); //~ ERROR `log_syntax!` is not stable + | ^^^^^^^^^^^^^ + | + = help: add #![feature(log_syntax)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/ui/feature-gate-macro-lifetime-matcher.rs b/src/test/ui/feature-gate-macro-lifetime-matcher.rs new file mode 100644 index 0000000000..0d107d283c --- /dev/null +++ b/src/test/ui/feature-gate-macro-lifetime-matcher.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the :lifetime macro fragment cannot be used when macro_lifetime_matcher +// feature gate is not used. + +macro_rules! m { ($lt:lifetime) => {} } +//~^ ERROR :lifetime fragment specifier is experimental and subject to change + +fn main() { + m!('a); +} diff --git a/src/test/ui/feature-gate-macro-lifetime-matcher.stderr b/src/test/ui/feature-gate-macro-lifetime-matcher.stderr new file mode 100644 index 0000000000..e78f7684cf --- /dev/null +++ b/src/test/ui/feature-gate-macro-lifetime-matcher.stderr @@ -0,0 +1,10 @@ +error: :lifetime fragment specifier is experimental and subject to change (see issue #46895) + --> $DIR/feature-gate-macro-lifetime-matcher.rs:14:19 + | +14 | macro_rules! m { ($lt:lifetime) => {} } + | ^^^^^^^^^^^^ + | + = help: add #![feature(macro_lifetime_matcher)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-macro-vis-matcher.rs b/src/test/ui/feature-gate-macro-vis-matcher.rs similarity index 100% rename from src/test/compile-fail/feature-gate-macro-vis-matcher.rs rename to src/test/ui/feature-gate-macro-vis-matcher.rs diff --git a/src/test/ui/feature-gate-macro-vis-matcher.stderr b/src/test/ui/feature-gate-macro-vis-matcher.stderr new file mode 100644 index 0000000000..09db500916 --- /dev/null +++ b/src/test/ui/feature-gate-macro-vis-matcher.stderr @@ -0,0 +1,10 @@ +error: :vis fragment specifier is experimental and subject to change (see issue #41022) + --> $DIR/feature-gate-macro-vis-matcher.rs:14:19 + | +14 | macro_rules! m { ($v:vis) => {} } + | ^^^^^^ + | + = help: add #![feature(macro_vis_matcher)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-main.rs b/src/test/ui/feature-gate-main.rs similarity index 100% rename from src/test/compile-fail/feature-gate-main.rs rename to src/test/ui/feature-gate-main.rs diff --git a/src/test/ui/feature-gate-main.stderr b/src/test/ui/feature-gate-main.stderr new file mode 100644 index 0000000000..90cf12822c --- /dev/null +++ b/src/test/ui/feature-gate-main.stderr @@ -0,0 +1,10 @@ +error: declaration of a nonstandard #[main] function may change over time, for now a top-level `fn main()` is required (see issue #29634) + --> $DIR/feature-gate-main.rs:12:1 + | +12 | fn foo() {} //~ ERROR: declaration of a nonstandard #[main] function may change over time + | ^^^^^^^^^^^ + | + = help: add #![feature(main)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-match_beginning_vert.rs b/src/test/ui/feature-gate-match_beginning_vert.rs similarity index 100% rename from src/test/compile-fail/feature-gate-match_beginning_vert.rs rename to src/test/ui/feature-gate-match_beginning_vert.rs diff --git a/src/test/ui/feature-gate-match_beginning_vert.stderr b/src/test/ui/feature-gate-match_beginning_vert.stderr new file mode 100644 index 0000000000..88053adfaf --- /dev/null +++ b/src/test/ui/feature-gate-match_beginning_vert.stderr @@ -0,0 +1,26 @@ +error: Use of a '|' at the beginning of a match arm is experimental (see issue #44101) + --> $DIR/feature-gate-match_beginning_vert.rs:24:9 + | +24 | | A => println!("A"), + | ^ + | + = help: add #![feature(match_beginning_vert)] to the crate attributes to enable + +error: Use of a '|' at the beginning of a match arm is experimental (see issue #44101) + --> $DIR/feature-gate-match_beginning_vert.rs:26:9 + | +26 | | B | C => println!("BC!"), + | ^ + | + = help: add #![feature(match_beginning_vert)] to the crate attributes to enable + +error: Use of a '|' at the beginning of a match arm is experimental (see issue #44101) + --> $DIR/feature-gate-match_beginning_vert.rs:28:9 + | +28 | | _ => {}, + | ^ + | + = help: add #![feature(match_beginning_vert)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-match_default_bindings.rs b/src/test/ui/feature-gate-match_default_bindings.rs similarity index 100% rename from src/test/compile-fail/feature-gate-match_default_bindings.rs rename to src/test/ui/feature-gate-match_default_bindings.rs diff --git a/src/test/ui/feature-gate-match_default_bindings.stderr b/src/test/ui/feature-gate-match_default_bindings.stderr new file mode 100644 index 0000000000..d86e8248f0 --- /dev/null +++ b/src/test/ui/feature-gate-match_default_bindings.stderr @@ -0,0 +1,10 @@ +error: non-reference pattern used to match a reference (see issue #42640) + --> $DIR/feature-gate-match_default_bindings.rs:13:9 + | +13 | Some(n) => {}, + | ^^^^^^^ help: consider using a reference: `&Some(n)` + | + = help: add #![feature(match_default_bindings)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-may-dangle.rs b/src/test/ui/feature-gate-may-dangle.rs similarity index 90% rename from src/test/compile-fail/feature-gate-may-dangle.rs rename to src/test/ui/feature-gate-may-dangle.rs index 0bf1e93d9a..ace9fe9ab2 100644 --- a/src/test/compile-fail/feature-gate-may-dangle.rs +++ b/src/test/ui/feature-gate-may-dangle.rs @@ -17,6 +17,5 @@ struct Pt<A>(A); impl<#[may_dangle] A> Drop for Pt<A> { //~^ ERROR may_dangle has unstable semantics and may be removed in the future - //~| HELP add #![feature(dropck_eyepatch)] to the crate attributes to enable fn drop(&mut self) { } } diff --git a/src/test/ui/feature-gate-may-dangle.stderr b/src/test/ui/feature-gate-may-dangle.stderr new file mode 100644 index 0000000000..e51723d058 --- /dev/null +++ b/src/test/ui/feature-gate-may-dangle.stderr @@ -0,0 +1,10 @@ +error: may_dangle has unstable semantics and may be removed in the future (see issue #34761) + --> $DIR/feature-gate-may-dangle.rs:18:6 + | +18 | impl<#[may_dangle] A> Drop for Pt<A> { + | ^^^^^^^^^^^^^ + | + = help: add #![feature(dropck_eyepatch)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-naked_functions.rs b/src/test/ui/feature-gate-naked_functions.rs similarity index 95% rename from src/test/compile-fail/gated-naked_functions.rs rename to src/test/ui/feature-gate-naked_functions.rs index 5eb4118102..ceb475e119 100644 --- a/src/test/compile-fail/gated-naked_functions.rs +++ b/src/test/ui/feature-gate-naked_functions.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-naked_functions - #[naked] //~^ the `#[naked]` attribute is an experimental feature fn naked() {} diff --git a/src/test/ui/feature-gate-naked_functions.stderr b/src/test/ui/feature-gate-naked_functions.stderr new file mode 100644 index 0000000000..9655982574 --- /dev/null +++ b/src/test/ui/feature-gate-naked_functions.stderr @@ -0,0 +1,18 @@ +error: the `#[naked]` attribute is an experimental feature (see issue #32408) + --> $DIR/feature-gate-naked_functions.rs:11:1 + | +11 | #[naked] + | ^^^^^^^^ + | + = help: add #![feature(naked_functions)] to the crate attributes to enable + +error: the `#[naked]` attribute is an experimental feature (see issue #32408) + --> $DIR/feature-gate-naked_functions.rs:15:1 + | +15 | #[naked] + | ^^^^^^^^ + | + = help: add #![feature(naked_functions)] to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-needs-allocator.rs b/src/test/ui/feature-gate-needs-allocator.rs similarity index 100% rename from src/test/compile-fail/feature-gate-needs-allocator.rs rename to src/test/ui/feature-gate-needs-allocator.rs diff --git a/src/test/ui/feature-gate-needs-allocator.stderr b/src/test/ui/feature-gate-needs-allocator.stderr new file mode 100644 index 0000000000..5124c10cb4 --- /dev/null +++ b/src/test/ui/feature-gate-needs-allocator.stderr @@ -0,0 +1,10 @@ +error: the `#[needs_allocator]` attribute is an experimental feature + --> $DIR/feature-gate-needs-allocator.rs:11:1 + | +11 | #![needs_allocator] //~ ERROR the `#[needs_allocator]` attribute is + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(allocator_internals)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-negate-unsigned.rs b/src/test/ui/feature-gate-negate-unsigned.rs similarity index 100% rename from src/test/compile-fail/feature-gate-negate-unsigned.rs rename to src/test/ui/feature-gate-negate-unsigned.rs diff --git a/src/test/ui/feature-gate-negate-unsigned.stderr b/src/test/ui/feature-gate-negate-unsigned.stderr new file mode 100644 index 0000000000..d431159451 --- /dev/null +++ b/src/test/ui/feature-gate-negate-unsigned.stderr @@ -0,0 +1,14 @@ +error[E0600]: cannot apply unary operator `-` to type `usize` + --> $DIR/feature-gate-negate-unsigned.rs:20:23 + | +20 | let _max: usize = -1; + | ^^ + +error[E0600]: cannot apply unary operator `-` to type `u8` + --> $DIR/feature-gate-negate-unsigned.rs:24:14 + | +24 | let _y = -x; + | ^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/never-disabled.rs b/src/test/ui/feature-gate-never_type.rs similarity index 97% rename from src/test/compile-fail/never-disabled.rs rename to src/test/ui/feature-gate-never_type.rs index fb6b34fcbb..11b9f41295 100644 --- a/src/test/compile-fail/never-disabled.rs +++ b/src/test/ui/feature-gate-never_type.rs @@ -10,8 +10,6 @@ // Test that ! errors when used in illegal positions with feature(never_type) disabled -// gate-test-never_type - trait Foo { type Wub; } diff --git a/src/test/ui/feature-gate-never_type.stderr b/src/test/ui/feature-gate-never_type.stderr new file mode 100644 index 0000000000..c242e613ea --- /dev/null +++ b/src/test/ui/feature-gate-never_type.stderr @@ -0,0 +1,42 @@ +error: The `!` type is experimental (see issue #35121) + --> $DIR/feature-gate-never_type.rs:17:17 + | +17 | type Ma = (u32, !, i32); //~ ERROR type is experimental + | ^ + | + = help: add #![feature(never_type)] to the crate attributes to enable + +error: The `!` type is experimental (see issue #35121) + --> $DIR/feature-gate-never_type.rs:18:20 + | +18 | type Meeshka = Vec<!>; //~ ERROR type is experimental + | ^ + | + = help: add #![feature(never_type)] to the crate attributes to enable + +error: The `!` type is experimental (see issue #35121) + --> $DIR/feature-gate-never_type.rs:19:16 + | +19 | type Mow = &fn(!) -> !; //~ ERROR type is experimental + | ^ + | + = help: add #![feature(never_type)] to the crate attributes to enable + +error: The `!` type is experimental (see issue #35121) + --> $DIR/feature-gate-never_type.rs:20:19 + | +20 | type Skwoz = &mut !; //~ ERROR type is experimental + | ^ + | + = help: add #![feature(never_type)] to the crate attributes to enable + +error: The `!` type is experimental (see issue #35121) + --> $DIR/feature-gate-never_type.rs:23:16 + | +23 | type Wub = !; //~ ERROR type is experimental + | ^ + | + = help: add #![feature(never_type)] to the crate attributes to enable + +error: aborting due to 5 previous errors + diff --git a/src/tools/miri/tests/run-pass/associated-const.rs b/src/test/ui/feature-gate-nll.rs similarity index 78% rename from src/tools/miri/tests/run-pass/associated-const.rs rename to src/test/ui/feature-gate-nll.rs index fe5da49f80..f34a9cddf9 100644 --- a/src/tools/miri/tests/run-pass/associated-const.rs +++ b/src/test/ui/feature-gate-nll.rs @@ -8,14 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo { - const ID: i32; -} - -impl Foo for i32 { - const ID: i32 = 1; -} +#![allow(dead_code)] fn main() { - assert_eq!(1, <i32 as Foo>::ID); + let mut x = 33; + + let p = &x; + x = 22; //~ ERROR cannot assign to `x` because it is borrowed [E0506] } diff --git a/src/test/ui/feature-gate-nll.stderr b/src/test/ui/feature-gate-nll.stderr new file mode 100644 index 0000000000..4135462305 --- /dev/null +++ b/src/test/ui/feature-gate-nll.stderr @@ -0,0 +1,10 @@ +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/feature-gate-nll.rs:17:5 + | +16 | let p = &x; + | - borrow of `x` occurs here +17 | x = 22; //~ ERROR cannot assign to `x` because it is borrowed [E0506] + | ^^^^^^ assignment to borrowed `x` occurs here + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-no-debug-2.rs b/src/test/ui/feature-gate-no-debug-2.rs similarity index 100% rename from src/test/compile-fail/feature-gate-no-debug-2.rs rename to src/test/ui/feature-gate-no-debug-2.rs diff --git a/src/test/ui/feature-gate-no-debug-2.stderr b/src/test/ui/feature-gate-no-debug-2.stderr new file mode 100644 index 0000000000..231fc40011 --- /dev/null +++ b/src/test/ui/feature-gate-no-debug-2.stderr @@ -0,0 +1,14 @@ +error: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 + --> $DIR/feature-gate-no-debug-2.rs:14:1 + | +14 | #[no_debug] //~ ERROR use of deprecated attribute `no_debug` + | ^^^^^^^^^^^ help: remove this attribute + | +note: lint level defined here + --> $DIR/feature-gate-no-debug-2.rs:11:9 + | +11 | #![deny(deprecated)] + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-no-debug.rs b/src/test/ui/feature-gate-no-debug.rs similarity index 100% rename from src/test/compile-fail/feature-gate-no-debug.rs rename to src/test/ui/feature-gate-no-debug.rs diff --git a/src/test/ui/feature-gate-no-debug.stderr b/src/test/ui/feature-gate-no-debug.stderr new file mode 100644 index 0000000000..83a8189c09 --- /dev/null +++ b/src/test/ui/feature-gate-no-debug.stderr @@ -0,0 +1,10 @@ +error: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand (see issue #29721) + --> $DIR/feature-gate-no-debug.rs:13:1 + | +13 | #[no_debug] //~ ERROR the `#[no_debug]` attribute was + | ^^^^^^^^^^^ + | + = help: add #![feature(no_debug)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-no-core.rs b/src/test/ui/feature-gate-no_core.rs similarity index 95% rename from src/test/compile-fail/gated-no-core.rs rename to src/test/ui/feature-gate-no_core.rs index 66b9c2e567..0a55a8a78c 100644 --- a/src/test/compile-fail/gated-no-core.rs +++ b/src/test/ui/feature-gate-no_core.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-no_core - #![no_core] //~ ERROR no_core is experimental fn main() {} diff --git a/src/test/ui/feature-gate-no_core.stderr b/src/test/ui/feature-gate-no_core.stderr new file mode 100644 index 0000000000..02e0b17624 --- /dev/null +++ b/src/test/ui/feature-gate-no_core.stderr @@ -0,0 +1,10 @@ +error: no_core is experimental (see issue #29639) + --> $DIR/feature-gate-no_core.rs:11:1 + | +11 | #![no_core] //~ ERROR no_core is experimental + | ^^^^^^^^^^^ + | + = help: add #![feature(no_core)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-non-ascii-idents.rs b/src/test/ui/feature-gate-non_ascii_idents.rs similarity index 97% rename from src/test/compile-fail/gated-non-ascii-idents.rs rename to src/test/ui/feature-gate-non_ascii_idents.rs index 1dff22839a..9e042c3a7d 100644 --- a/src/test/compile-fail/gated-non-ascii-idents.rs +++ b/src/test/ui/feature-gate-non_ascii_idents.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-non_ascii_idents - extern crate core as bäz; //~ ERROR non-ascii idents use föö::bar; //~ ERROR non-ascii idents diff --git a/src/test/ui/feature-gate-non_ascii_idents.stderr b/src/test/ui/feature-gate-non_ascii_idents.stderr new file mode 100644 index 0000000000..90d0b8daee --- /dev/null +++ b/src/test/ui/feature-gate-non_ascii_idents.stderr @@ -0,0 +1,112 @@ +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:11:1 + | +11 | extern crate core as bäz; //~ ERROR non-ascii idents + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:13:5 + | +13 | use föö::bar; //~ ERROR non-ascii idents + | ^^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:15:1 + | +15 | mod föö { //~ ERROR non-ascii idents + | ^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:19:1 + | +19 | / fn bär( //~ ERROR non-ascii idents +20 | | bäz: isize //~ ERROR non-ascii idents +21 | | ) { +22 | | let _ö: isize; //~ ERROR non-ascii idents +... | +26 | | } +27 | | } + | |_^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:20:5 + | +20 | bäz: isize //~ ERROR non-ascii idents + | ^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:22:9 + | +22 | let _ö: isize; //~ ERROR non-ascii idents + | ^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:25:10 + | +25 | (_ä, _) => {} //~ ERROR non-ascii idents + | ^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:29:1 + | +29 | struct Föö { //~ ERROR non-ascii idents + | ^^^^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:30:5 + | +30 | föö: isize //~ ERROR non-ascii idents + | ^^^^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:33:1 + | +33 | enum Bär { //~ ERROR non-ascii idents + | ^^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:34:5 + | +34 | Bäz { //~ ERROR non-ascii idents + | ^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:35:9 + | +35 | qüx: isize //~ ERROR non-ascii idents + | ^^^^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: non-ascii idents are not fully supported. (see issue #28979) + --> $DIR/feature-gate-non_ascii_idents.rs:40:5 + | +40 | fn qüx(); //~ ERROR non-ascii idents + | ^^^^^^^^^ + | + = help: add #![feature(non_ascii_idents)] to the crate attributes to enable + +error: aborting due to 13 previous errors + diff --git a/src/test/compile-fail/feature-gate-non_exhaustive.rs b/src/test/ui/feature-gate-non_exhaustive.rs similarity index 100% rename from src/test/compile-fail/feature-gate-non_exhaustive.rs rename to src/test/ui/feature-gate-non_exhaustive.rs diff --git a/src/test/ui/feature-gate-non_exhaustive.stderr b/src/test/ui/feature-gate-non_exhaustive.stderr new file mode 100644 index 0000000000..775e65b90f --- /dev/null +++ b/src/test/ui/feature-gate-non_exhaustive.stderr @@ -0,0 +1,10 @@ +error: non exhaustive is an experimental feature (see issue #44109) + --> $DIR/feature-gate-non_exhaustive.rs:13:1 + | +13 | #[non_exhaustive] //~ERROR non exhaustive is an experimental feature (see issue #44109) + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(non_exhaustive)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-omit-gdb-pretty-printer-section.rs b/src/test/ui/feature-gate-omit-gdb-pretty-printer-section.rs similarity index 100% rename from src/test/compile-fail/feature-gate-omit-gdb-pretty-printer-section.rs rename to src/test/ui/feature-gate-omit-gdb-pretty-printer-section.rs diff --git a/src/test/ui/feature-gate-omit-gdb-pretty-printer-section.stderr b/src/test/ui/feature-gate-omit-gdb-pretty-printer-section.stderr new file mode 100644 index 0000000000..e50e1b4c0b --- /dev/null +++ b/src/test/ui/feature-gate-omit-gdb-pretty-printer-section.stderr @@ -0,0 +1,10 @@ +error: the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite + --> $DIR/feature-gate-omit-gdb-pretty-printer-section.rs:11:1 + | +11 | #[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(omit_gdb_pretty_printer_section)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-on-unimplemented.rs b/src/test/ui/feature-gate-on-unimplemented.rs similarity index 100% rename from src/test/compile-fail/feature-gate-on-unimplemented.rs rename to src/test/ui/feature-gate-on-unimplemented.rs diff --git a/src/test/ui/feature-gate-on-unimplemented.stderr b/src/test/ui/feature-gate-on-unimplemented.stderr new file mode 100644 index 0000000000..06944a1473 --- /dev/null +++ b/src/test/ui/feature-gate-on-unimplemented.stderr @@ -0,0 +1,10 @@ +error: the `#[rustc_on_unimplemented]` attribute is an experimental feature (see issue #29628) + --> $DIR/feature-gate-on-unimplemented.rs:14:1 + | +14 | #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}`"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(on_unimplemented)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-optin-builtin-traits.rs b/src/test/ui/feature-gate-optin-builtin-traits.rs similarity index 100% rename from src/test/compile-fail/feature-gate-optin-builtin-traits.rs rename to src/test/ui/feature-gate-optin-builtin-traits.rs diff --git a/src/test/ui/feature-gate-optin-builtin-traits.stderr b/src/test/ui/feature-gate-optin-builtin-traits.stderr new file mode 100644 index 0000000000..c5e9614c29 --- /dev/null +++ b/src/test/ui/feature-gate-optin-builtin-traits.stderr @@ -0,0 +1,26 @@ +error: auto traits are experimental and possibly buggy (see issue #13231) + --> $DIR/feature-gate-optin-builtin-traits.rs:20:1 + | +20 | auto trait AutoDummyTrait {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optin_builtin_traits)] to the crate attributes to enable + +error: auto trait implementations are experimental and possibly buggy (see issue #13231) + --> $DIR/feature-gate-optin-builtin-traits.rs:24:1 + | +24 | impl DummyTrait for .. {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optin_builtin_traits)] to the crate attributes to enable + +error: negative trait bounds are not yet fully implemented; use marker types for now (see issue #13231) + --> $DIR/feature-gate-optin-builtin-traits.rs:27:1 + | +27 | impl !DummyTrait for DummyStruct {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optin_builtin_traits)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-overlapping_marker_traits.rs b/src/test/ui/feature-gate-overlapping_marker_traits.rs similarity index 100% rename from src/test/compile-fail/feature-gate-overlapping_marker_traits.rs rename to src/test/ui/feature-gate-overlapping_marker_traits.rs diff --git a/src/test/ui/feature-gate-overlapping_marker_traits.stderr b/src/test/ui/feature-gate-overlapping_marker_traits.stderr new file mode 100644 index 0000000000..c1725a62ad --- /dev/null +++ b/src/test/ui/feature-gate-overlapping_marker_traits.stderr @@ -0,0 +1,10 @@ +error[E0119]: conflicting implementations of trait `MyMarker`: + --> $DIR/feature-gate-overlapping_marker_traits.rs:16:1 + | +15 | impl<T: Display> MyMarker for T {} + | ------------------------------- first implementation here +16 | impl<T: Debug> MyMarker for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-placement-expr.rs b/src/test/ui/feature-gate-placement-expr.rs similarity index 100% rename from src/test/compile-fail/feature-gate-placement-expr.rs rename to src/test/ui/feature-gate-placement-expr.rs diff --git a/src/test/ui/feature-gate-placement-expr.stderr b/src/test/ui/feature-gate-placement-expr.stderr new file mode 100644 index 0000000000..fdb7b50671 --- /dev/null +++ b/src/test/ui/feature-gate-placement-expr.stderr @@ -0,0 +1,10 @@ +error: placement-in expression syntax is experimental and subject to change. (see issue #27779) + --> $DIR/feature-gate-placement-expr.rs:24:13 + | +24 | let x = HEAP <- 'c'; //~ ERROR placement-in expression syntax is experimental + | ^^^^^^^^^^^ + | + = help: add #![feature(placement_in_syntax)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-plugin.rs b/src/test/ui/feature-gate-plugin.rs similarity index 100% rename from src/test/compile-fail/feature-gate-plugin.rs rename to src/test/ui/feature-gate-plugin.rs diff --git a/src/test/ui/feature-gate-plugin.stderr b/src/test/ui/feature-gate-plugin.stderr new file mode 100644 index 0000000000..b94d3299ab --- /dev/null +++ b/src/test/ui/feature-gate-plugin.stderr @@ -0,0 +1,10 @@ +error: compiler plugins are experimental and possibly buggy (see issue #29597) + --> $DIR/feature-gate-plugin.rs:13:1 + | +13 | #![plugin(foo)] + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(plugin)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-plugin_registrar.rs b/src/test/ui/feature-gate-plugin_registrar.rs similarity index 95% rename from src/test/compile-fail/gated-plugin_registrar.rs rename to src/test/ui/feature-gate-plugin_registrar.rs index 8d185d183b..9cdebde7b7 100644 --- a/src/test/compile-fail/gated-plugin_registrar.rs +++ b/src/test/ui/feature-gate-plugin_registrar.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-plugin_registrar - // Test that `#[plugin_registrar]` attribute is gated by `plugin_registrar` // feature gate. diff --git a/src/test/ui/feature-gate-plugin_registrar.stderr b/src/test/ui/feature-gate-plugin_registrar.stderr new file mode 100644 index 0000000000..3710239142 --- /dev/null +++ b/src/test/ui/feature-gate-plugin_registrar.stderr @@ -0,0 +1,10 @@ +error: compiler plugins are experimental and possibly buggy (see issue #29597) + --> $DIR/feature-gate-plugin_registrar.rs:16:1 + | +16 | pub fn registrar() {} + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(plugin_registrar)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-prelude_import.rs b/src/test/ui/feature-gate-prelude_import.rs similarity index 100% rename from src/test/compile-fail/feature-gate-prelude_import.rs rename to src/test/ui/feature-gate-prelude_import.rs diff --git a/src/test/ui/feature-gate-prelude_import.stderr b/src/test/ui/feature-gate-prelude_import.stderr new file mode 100644 index 0000000000..df44dfff40 --- /dev/null +++ b/src/test/ui/feature-gate-prelude_import.stderr @@ -0,0 +1,10 @@ +error: `#[prelude_import]` is for use by rustc only + --> $DIR/feature-gate-prelude_import.rs:11:1 + | +11 | #[prelude_import] //~ ERROR `#[prelude_import]` is for use by rustc only + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(prelude_import)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-profiler-runtime.rs b/src/test/ui/feature-gate-profiler-runtime.rs similarity index 100% rename from src/test/compile-fail/feature-gate-profiler-runtime.rs rename to src/test/ui/feature-gate-profiler-runtime.rs diff --git a/src/test/ui/feature-gate-profiler-runtime.stderr b/src/test/ui/feature-gate-profiler-runtime.stderr new file mode 100644 index 0000000000..c3165438cd --- /dev/null +++ b/src/test/ui/feature-gate-profiler-runtime.stderr @@ -0,0 +1,10 @@ +error: the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate which contains the profiler runtime and will never be stable + --> $DIR/feature-gate-profiler-runtime.rs:11:1 + | +11 | #![profiler_runtime] //~ ERROR the `#[profiler_runtime]` attribute is + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(profiler_runtime)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-repr-simd.rs b/src/test/ui/feature-gate-repr-simd.rs similarity index 100% rename from src/test/compile-fail/feature-gate-repr-simd.rs rename to src/test/ui/feature-gate-repr-simd.rs diff --git a/src/test/ui/feature-gate-repr-simd.stderr b/src/test/ui/feature-gate-repr-simd.stderr new file mode 100644 index 0000000000..a2ff06dd59 --- /dev/null +++ b/src/test/ui/feature-gate-repr-simd.stderr @@ -0,0 +1,10 @@ +error: SIMD types are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-repr-simd.rs:11:1 + | +11 | #[repr(simd)] //~ error: SIMD types are experimental + | ^^^^^^^^^^^^^ + | + = help: add #![feature(repr_simd)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-repr128.rs b/src/test/ui/feature-gate-repr128.rs similarity index 93% rename from src/test/compile-fail/feature-gate-repr128.rs rename to src/test/ui/feature-gate-repr128.rs index 96fffa6cdd..f5753f1c7f 100644 --- a/src/test/compile-fail/feature-gate-repr128.rs +++ b/src/test/ui/feature-gate-repr128.rs @@ -10,7 +10,6 @@ #[repr(u128)] enum A { //~ ERROR repr with 128-bit type is unstable - //~| HELP: add #![feature(repr128)] A(u64) } diff --git a/src/test/ui/feature-gate-repr128.stderr b/src/test/ui/feature-gate-repr128.stderr new file mode 100644 index 0000000000..c59964887b --- /dev/null +++ b/src/test/ui/feature-gate-repr128.stderr @@ -0,0 +1,12 @@ +error: repr with 128-bit type is unstable (see issue #35118) + --> $DIR/feature-gate-repr128.rs:12:1 + | +12 | / enum A { //~ ERROR repr with 128-bit type is unstable +13 | | A(u64) +14 | | } + | |_^ + | + = help: add #![feature(repr128)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-repr_align.rs b/src/test/ui/feature-gate-repr_align.rs similarity index 100% rename from src/test/compile-fail/feature-gate-repr_align.rs rename to src/test/ui/feature-gate-repr_align.rs diff --git a/src/test/ui/feature-gate-repr_align.stderr b/src/test/ui/feature-gate-repr_align.stderr new file mode 100644 index 0000000000..16fdc135a5 --- /dev/null +++ b/src/test/ui/feature-gate-repr_align.stderr @@ -0,0 +1,10 @@ +error: the struct `#[repr(align(u16))]` attribute is experimental (see issue #33626) + --> $DIR/feature-gate-repr_align.rs:12:1 + | +12 | #[repr(align(64))] //~ error: the struct `#[repr(align(u16))]` attribute is experimental + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(repr_align)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gate-rustc-attrs.rs similarity index 100% rename from src/test/compile-fail/feature-gate-rustc-attrs.rs rename to src/test/ui/feature-gate-rustc-attrs.rs diff --git a/src/test/ui/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gate-rustc-attrs.stderr new file mode 100644 index 0000000000..c818b57ef1 --- /dev/null +++ b/src/test/ui/feature-gate-rustc-attrs.stderr @@ -0,0 +1,26 @@ +error: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) + --> $DIR/feature-gate-rustc-attrs.rs:15:1 + | +15 | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_attrs)] to the crate attributes to enable + +error: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) + --> $DIR/feature-gate-rustc-attrs.rs:16:1 + | +16 | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_attrs)] to the crate attributes to enable + +error: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) + --> $DIR/feature-gate-rustc-attrs.rs:17:1 + | +17 | #[rustc_foo] + | ^^^^^^^^^^^^ + | + = help: add #![feature(rustc_attrs)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-rustc-diagnostic-macros.rs b/src/test/ui/feature-gate-rustc-diagnostic-macros.rs similarity index 100% rename from src/test/compile-fail/feature-gate-rustc-diagnostic-macros.rs rename to src/test/ui/feature-gate-rustc-diagnostic-macros.rs diff --git a/src/test/ui/feature-gate-rustc-diagnostic-macros.stderr b/src/test/ui/feature-gate-rustc-diagnostic-macros.stderr new file mode 100644 index 0000000000..843879036e --- /dev/null +++ b/src/test/ui/feature-gate-rustc-diagnostic-macros.stderr @@ -0,0 +1,20 @@ +error: cannot find macro `__build_diagnostic_array!` in this scope + --> $DIR/feature-gate-rustc-diagnostic-macros.rs:22:1 + | +22 | __build_diagnostic_array!(DIAGNOSTICS); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot find macro `__register_diagnostic!` in this scope + --> $DIR/feature-gate-rustc-diagnostic-macros.rs:14:1 + | +14 | __register_diagnostic!(E0001); + | ^^^^^^^^^^^^^^^^^^^^^ + +error: cannot find macro `__diagnostic_used!` in this scope + --> $DIR/feature-gate-rustc-diagnostic-macros.rs:18:5 + | +18 | __diagnostic_used!(E0001); + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-rustc_const_unstable.rs b/src/test/ui/feature-gate-rustc_const_unstable.rs similarity index 100% rename from src/test/compile-fail/feature-gate-rustc_const_unstable.rs rename to src/test/ui/feature-gate-rustc_const_unstable.rs diff --git a/src/test/ui/feature-gate-rustc_const_unstable.stderr b/src/test/ui/feature-gate-rustc_const_unstable.stderr new file mode 100644 index 0000000000..c32abb8b85 --- /dev/null +++ b/src/test/ui/feature-gate-rustc_const_unstable.stderr @@ -0,0 +1,10 @@ +error: the `#[rustc_const_unstable]` attribute is an internal feature + --> $DIR/feature-gate-rustc_const_unstable.rs:18:1 + | +18 | #[rustc_const_unstable(feature="fzzzzzt")] //~ERROR internal feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_const_unstable)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-sanitizer-runtime.rs b/src/test/ui/feature-gate-sanitizer-runtime.rs similarity index 100% rename from src/test/compile-fail/feature-gate-sanitizer-runtime.rs rename to src/test/ui/feature-gate-sanitizer-runtime.rs diff --git a/src/test/ui/feature-gate-sanitizer-runtime.stderr b/src/test/ui/feature-gate-sanitizer-runtime.stderr new file mode 100644 index 0000000000..b9a43f8098 --- /dev/null +++ b/src/test/ui/feature-gate-sanitizer-runtime.stderr @@ -0,0 +1,10 @@ +error: the `#[sanitizer_runtime]` attribute is used to identify crates that contain the runtime of a sanitizer and will never be stable + --> $DIR/feature-gate-sanitizer-runtime.rs:11:1 + | +11 | #![sanitizer_runtime] //~ ERROR the `#[sanitizer_runtime]` attribute is + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(sanitizer_runtime)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-simd-ffi.rs b/src/test/ui/feature-gate-simd-ffi.rs similarity index 100% rename from src/test/compile-fail/feature-gate-simd-ffi.rs rename to src/test/ui/feature-gate-simd-ffi.rs diff --git a/src/test/ui/feature-gate-simd-ffi.stderr b/src/test/ui/feature-gate-simd-ffi.stderr new file mode 100644 index 0000000000..fa47e1a290 --- /dev/null +++ b/src/test/ui/feature-gate-simd-ffi.stderr @@ -0,0 +1,18 @@ +error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code + --> $DIR/feature-gate-simd-ffi.rs:20:17 + | +20 | fn baz() -> LocalSimd; //~ ERROR use of SIMD type + | ^^^^^^^^^ + | + = help: add #![feature(simd_ffi)] to the crate attributes to enable + +error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code + --> $DIR/feature-gate-simd-ffi.rs:21:15 + | +21 | fn qux(x: LocalSimd); //~ ERROR use of SIMD type + | ^^^^^^^^^ + | + = help: add #![feature(simd_ffi)] to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-simd.rs b/src/test/ui/feature-gate-simd.rs similarity index 100% rename from src/test/compile-fail/feature-gate-simd.rs rename to src/test/ui/feature-gate-simd.rs diff --git a/src/test/ui/feature-gate-simd.stderr b/src/test/ui/feature-gate-simd.stderr new file mode 100644 index 0000000000..b3225d580b --- /dev/null +++ b/src/test/ui/feature-gate-simd.stderr @@ -0,0 +1,10 @@ +error: SIMD types are experimental and possibly buggy (see issue #27731) + --> $DIR/feature-gate-simd.rs:14:1 + | +14 | #[repr(simd)] //~ ERROR SIMD types are experimental + | ^^^^^^^^^^^^^ + | + = help: add #![feature(repr_simd)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-slice-patterns.rs b/src/test/ui/feature-gate-slice-patterns.rs similarity index 100% rename from src/test/compile-fail/feature-gate-slice-patterns.rs rename to src/test/ui/feature-gate-slice-patterns.rs diff --git a/src/test/ui/feature-gate-slice-patterns.stderr b/src/test/ui/feature-gate-slice-patterns.stderr new file mode 100644 index 0000000000..e5ba318b33 --- /dev/null +++ b/src/test/ui/feature-gate-slice-patterns.stderr @@ -0,0 +1,10 @@ +error: slice pattern syntax is experimental (see issue #23121) + --> $DIR/feature-gate-slice-patterns.rs:16:9 + | +16 | [1, 2, xs..] => {} //~ ERROR slice pattern syntax is experimental + | ^^^^^^^^^^^^ + | + = help: add #![feature(slice_patterns)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-staged_api.rs b/src/test/ui/feature-gate-staged_api.rs similarity index 100% rename from src/test/compile-fail/feature-gate-staged_api.rs rename to src/test/ui/feature-gate-staged_api.rs diff --git a/src/test/ui/feature-gate-staged_api.stderr b/src/test/ui/feature-gate-staged_api.stderr new file mode 100644 index 0000000000..30593d4576 --- /dev/null +++ b/src/test/ui/feature-gate-staged_api.stderr @@ -0,0 +1,14 @@ +error: stability attributes may not be used outside of the standard library + --> $DIR/feature-gate-staged_api.rs:11:1 + | +11 | #![stable(feature = "a", since = "b")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/feature-gate-staged_api.rs:18:1 + | +18 | #[stable(feature = "a", since = "b")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-start.rs b/src/test/ui/feature-gate-start.rs similarity index 100% rename from src/test/compile-fail/feature-gate-start.rs rename to src/test/ui/feature-gate-start.rs diff --git a/src/test/ui/feature-gate-start.stderr b/src/test/ui/feature-gate-start.stderr new file mode 100644 index 0000000000..b36fae2aac --- /dev/null +++ b/src/test/ui/feature-gate-start.stderr @@ -0,0 +1,10 @@ +error: a #[start] function is an experimental feature whose signature may change over time (see issue #29633) + --> $DIR/feature-gate-start.rs:12:1 + | +12 | fn foo() {} //~ ERROR: a #[start] function is an experimental feature + | ^^^^^^^^^^^ + | + = help: add #![feature(start)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-static-nobundle.rs b/src/test/ui/feature-gate-static-nobundle.rs similarity index 100% rename from src/test/compile-fail/feature-gate-static-nobundle.rs rename to src/test/ui/feature-gate-static-nobundle.rs diff --git a/src/test/ui/feature-gate-static-nobundle.stderr b/src/test/ui/feature-gate-static-nobundle.stderr new file mode 100644 index 0000000000..052516fad7 --- /dev/null +++ b/src/test/ui/feature-gate-static-nobundle.stderr @@ -0,0 +1,10 @@ +error: kind="static-nobundle" is feature gated (see issue #37403) + --> $DIR/feature-gate-static-nobundle.rs:11:1 + | +11 | #[link(name="foo", kind="static-nobundle")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(static_nobundle)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-stmt_expr_attributes.rs b/src/test/ui/feature-gate-stmt_expr_attributes.rs similarity index 100% rename from src/test/compile-fail/feature-gate-stmt_expr_attributes.rs rename to src/test/ui/feature-gate-stmt_expr_attributes.rs diff --git a/src/test/ui/feature-gate-stmt_expr_attributes.stderr b/src/test/ui/feature-gate-stmt_expr_attributes.stderr new file mode 100644 index 0000000000..80910594d1 --- /dev/null +++ b/src/test/ui/feature-gate-stmt_expr_attributes.stderr @@ -0,0 +1,10 @@ +error: attributes on non-item statements and expressions are experimental. (see issue #15701) + --> $DIR/feature-gate-stmt_expr_attributes.rs:11:16 + | +11 | const X: i32 = #[allow(dead_code)] 8; + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-target_feature.rs b/src/test/ui/feature-gate-target_feature.rs similarity index 95% rename from src/test/compile-fail/gated-target_feature.rs rename to src/test/ui/feature-gate-target_feature.rs index 02db8a71d5..da2e41a0f5 100644 --- a/src/test/compile-fail/gated-target_feature.rs +++ b/src/test/ui/feature-gate-target_feature.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-target_feature - #[target_feature = "+sse2"] //~^ the `#[target_feature]` attribute is an experimental feature fn foo() {} diff --git a/src/test/ui/feature-gate-target_feature.stderr b/src/test/ui/feature-gate-target_feature.stderr new file mode 100644 index 0000000000..8c89eabf75 --- /dev/null +++ b/src/test/ui/feature-gate-target_feature.stderr @@ -0,0 +1,10 @@ +error: the `#[target_feature]` attribute is an experimental feature + --> $DIR/feature-gate-target_feature.rs:11:1 + | +11 | #[target_feature = "+sse2"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(target_feature)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-thread-local.rs b/src/test/ui/feature-gate-thread_local.rs similarity index 97% rename from src/test/compile-fail/gated-thread-local.rs rename to src/test/ui/feature-gate-thread_local.rs index b02ce9b7ec..f355c6562c 100644 --- a/src/test/compile-fail/gated-thread-local.rs +++ b/src/test/ui/feature-gate-thread_local.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-thread_local - // Test that `#[thread_local]` attribute is gated by `thread_local` // feature gate. // diff --git a/src/test/ui/feature-gate-thread_local.stderr b/src/test/ui/feature-gate-thread_local.stderr new file mode 100644 index 0000000000..2608018528 --- /dev/null +++ b/src/test/ui/feature-gate-thread_local.stderr @@ -0,0 +1,10 @@ +error: `#[thread_local]` is an experimental feature, and does not currently handle destructors. There is no corresponding `#[task_local]` mapping to the task model (see issue #29594) + --> $DIR/feature-gate-thread_local.rs:18:1 + | +18 | #[thread_local] //~ ERROR `#[thread_local]` is an experimental feature + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(thread_local)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/gated-trace_macros.rs b/src/test/ui/feature-gate-trace_macros.rs similarity index 95% rename from src/test/compile-fail/gated-trace_macros.rs rename to src/test/ui/feature-gate-trace_macros.rs index 0b85b19f17..367ee6df50 100644 --- a/src/test/compile-fail/gated-trace_macros.rs +++ b/src/test/ui/feature-gate-trace_macros.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-trace_macros - fn main() { trace_macros!(true); //~ ERROR: `trace_macros` is not stable } diff --git a/src/test/ui/feature-gate-trace_macros.stderr b/src/test/ui/feature-gate-trace_macros.stderr new file mode 100644 index 0000000000..aca74099b7 --- /dev/null +++ b/src/test/ui/feature-gate-trace_macros.stderr @@ -0,0 +1,10 @@ +error: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) + --> $DIR/feature-gate-trace_macros.rs:12:5 + | +12 | trace_macros!(true); //~ ERROR: `trace_macros` is not stable + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(trace_macros)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/type-ascription-feature-gate.rs b/src/test/ui/feature-gate-type_ascription.rs similarity index 95% rename from src/test/compile-fail/type-ascription-feature-gate.rs rename to src/test/ui/feature-gate-type_ascription.rs index bf4ca03069..d3c07d653f 100644 --- a/src/test/compile-fail/type-ascription-feature-gate.rs +++ b/src/test/ui/feature-gate-type_ascription.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-type_ascription - // Type ascription is feature gated fn main() { diff --git a/src/test/ui/feature-gate-type_ascription.stderr b/src/test/ui/feature-gate-type_ascription.stderr new file mode 100644 index 0000000000..d2a3ee2cf8 --- /dev/null +++ b/src/test/ui/feature-gate-type_ascription.stderr @@ -0,0 +1,10 @@ +error: type ascription is experimental (see issue #23416) + --> $DIR/feature-gate-type_ascription.rs:14:13 + | +14 | let a = 10: u8; //~ ERROR type ascription is experimental + | ^^^^^^ + | + = help: add #![feature(type_ascription)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs b/src/test/ui/feature-gate-unboxed-closures-manual-impls.rs similarity index 100% rename from src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs rename to src/test/ui/feature-gate-unboxed-closures-manual-impls.rs diff --git a/src/test/ui/feature-gate-unboxed-closures-manual-impls.stderr b/src/test/ui/feature-gate-unboxed-closures-manual-impls.stderr new file mode 100644 index 0000000000..280fc12f1a --- /dev/null +++ b/src/test/ui/feature-gate-unboxed-closures-manual-impls.stderr @@ -0,0 +1,34 @@ +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:20:5 + | +20 | extern "rust-call" fn call(self, args: ()) -> () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:25:5 + | +25 | extern "rust-call" fn call_once(self, args: ()) -> () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:5 + | +30 | extern "rust-call" fn call_mut(&self, args: ()) -> () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:5 + | +35 | extern "rust-call" fn call_once(&self, args: ()) -> () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/feature-gate-unboxed-closures-method-calls.rs b/src/test/ui/feature-gate-unboxed-closures-method-calls.rs similarity index 100% rename from src/test/compile-fail/feature-gate-unboxed-closures-method-calls.rs rename to src/test/ui/feature-gate-unboxed-closures-method-calls.rs diff --git a/src/test/ui/feature-gate-unboxed-closures-method-calls.stderr b/src/test/ui/feature-gate-unboxed-closures-method-calls.stderr new file mode 100644 index 0000000000..1167bf0a69 --- /dev/null +++ b/src/test/ui/feature-gate-unboxed-closures-method-calls.stderr @@ -0,0 +1,26 @@ +error: use of unstable library feature 'fn_traits' (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-method-calls.rs:14:7 + | +14 | f.call(()); //~ ERROR use of unstable library feature 'fn_traits' + | ^^^^ + | + = help: add #![feature(fn_traits)] to the crate attributes to enable + +error: use of unstable library feature 'fn_traits' (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-method-calls.rs:15:7 + | +15 | f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' + | ^^^^^^^^ + | + = help: add #![feature(fn_traits)] to the crate attributes to enable + +error: use of unstable library feature 'fn_traits' (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-method-calls.rs:16:7 + | +16 | f.call_once(()); //~ ERROR use of unstable library feature 'fn_traits' + | ^^^^^^^^^ + | + = help: add #![feature(fn_traits)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-unboxed-closures-ufcs-calls.rs b/src/test/ui/feature-gate-unboxed-closures-ufcs-calls.rs similarity index 100% rename from src/test/compile-fail/feature-gate-unboxed-closures-ufcs-calls.rs rename to src/test/ui/feature-gate-unboxed-closures-ufcs-calls.rs diff --git a/src/test/ui/feature-gate-unboxed-closures-ufcs-calls.stderr b/src/test/ui/feature-gate-unboxed-closures-ufcs-calls.stderr new file mode 100644 index 0000000000..7eb491cebf --- /dev/null +++ b/src/test/ui/feature-gate-unboxed-closures-ufcs-calls.stderr @@ -0,0 +1,26 @@ +error: use of unstable library feature 'fn_traits' (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:14:5 + | +14 | Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' + | ^^^^^^^^ + | + = help: add #![feature(fn_traits)] to the crate attributes to enable + +error: use of unstable library feature 'fn_traits' (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:15:5 + | +15 | FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature 'fn_traits' + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(fn_traits)] to the crate attributes to enable + +error: use of unstable library feature 'fn_traits' (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:16:5 + | +16 | FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature 'fn_traits' + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(fn_traits)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-unboxed-closures.rs b/src/test/ui/feature-gate-unboxed-closures.rs similarity index 100% rename from src/test/compile-fail/feature-gate-unboxed-closures.rs rename to src/test/ui/feature-gate-unboxed-closures.rs diff --git a/src/test/ui/feature-gate-unboxed-closures.stderr b/src/test/ui/feature-gate-unboxed-closures.stderr new file mode 100644 index 0000000000..b79165147e --- /dev/null +++ b/src/test/ui/feature-gate-unboxed-closures.stderr @@ -0,0 +1,12 @@ +error: rust-call ABI is subject to change (see issue #29625) + --> $DIR/feature-gate-unboxed-closures.rs:16:5 + | +16 | / extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { +17 | | a + b +18 | | } + | |_____^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-underscore-lifetimes.rs b/src/test/ui/feature-gate-underscore-lifetimes.rs similarity index 100% rename from src/test/compile-fail/feature-gate-underscore-lifetimes.rs rename to src/test/ui/feature-gate-underscore-lifetimes.rs diff --git a/src/test/ui/feature-gate-underscore-lifetimes.stderr b/src/test/ui/feature-gate-underscore-lifetimes.stderr new file mode 100644 index 0000000000..875b958aa8 --- /dev/null +++ b/src/test/ui/feature-gate-underscore-lifetimes.stderr @@ -0,0 +1,10 @@ +error: underscore lifetimes are unstable (see issue #44524) + --> $DIR/feature-gate-underscore-lifetimes.rs:13:23 + | +13 | fn foo(x: &u8) -> Foo<'_> { //~ ERROR underscore lifetimes are unstable + | ^^ + | + = help: add #![feature(underscore_lifetimes)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/impl-trait/feature-gate-universal.rs b/src/test/ui/feature-gate-universal.rs similarity index 100% rename from src/test/compile-fail/impl-trait/feature-gate-universal.rs rename to src/test/ui/feature-gate-universal.rs diff --git a/src/test/ui/feature-gate-universal.stderr b/src/test/ui/feature-gate-universal.stderr new file mode 100644 index 0000000000..7f889f9622 --- /dev/null +++ b/src/test/ui/feature-gate-universal.stderr @@ -0,0 +1,10 @@ +error: `impl Trait` in argument position is experimental (see issue #34511) + --> $DIR/feature-gate-universal.rs:13:11 + | +13 | fn foo(x: impl std::fmt::Debug) { print!("{:?}", x); } + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(universal_impl_trait)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-unsized_tuple_coercion.rs b/src/test/ui/feature-gate-unsized_tuple_coercion.rs similarity index 100% rename from src/test/compile-fail/feature-gate-unsized_tuple_coercion.rs rename to src/test/ui/feature-gate-unsized_tuple_coercion.rs diff --git a/src/test/ui/feature-gate-unsized_tuple_coercion.stderr b/src/test/ui/feature-gate-unsized_tuple_coercion.stderr new file mode 100644 index 0000000000..f166b10613 --- /dev/null +++ b/src/test/ui/feature-gate-unsized_tuple_coercion.stderr @@ -0,0 +1,10 @@ +error: Unsized tuple coercion is not stable enough for use and is subject to change (see issue #42877) + --> $DIR/feature-gate-unsized_tuple_coercion.rs:12:24 + | +12 | let _ : &(Send,) = &((),); + | ^^^^^^ + | + = help: add #![feature(unsized_tuple_coercion)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/union/union-feature-gate.rs b/src/test/ui/feature-gate-untagged_unions.rs similarity index 96% rename from src/test/compile-fail/union/union-feature-gate.rs rename to src/test/ui/feature-gate-untagged_unions.rs index 8a0490cdc6..6533fddd94 100644 --- a/src/test/compile-fail/union/union-feature-gate.rs +++ b/src/test/ui/feature-gate-untagged_unions.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// gate-test-untagged_unions - union U1 { // OK a: u8, } diff --git a/src/test/ui/feature-gate-untagged_unions.stderr b/src/test/ui/feature-gate-untagged_unions.stderr new file mode 100644 index 0000000000..26b698912b --- /dev/null +++ b/src/test/ui/feature-gate-untagged_unions.stderr @@ -0,0 +1,32 @@ +error: unions with non-`Copy` fields are unstable (see issue #32836) + --> $DIR/feature-gate-untagged_unions.rs:19:1 + | +19 | / union U3 { //~ ERROR unions with non-`Copy` fields are unstable +20 | | a: String, +21 | | } + | |_^ + | + = help: add #![feature(untagged_unions)] to the crate attributes to enable + +error: unions with non-`Copy` fields are unstable (see issue #32836) + --> $DIR/feature-gate-untagged_unions.rs:23:1 + | +23 | / union U4<T> { //~ ERROR unions with non-`Copy` fields are unstable +24 | | a: T, +25 | | } + | |_^ + | + = help: add #![feature(untagged_unions)] to the crate attributes to enable + +error: unions with `Drop` implementations are unstable (see issue #32836) + --> $DIR/feature-gate-untagged_unions.rs:27:1 + | +27 | / union U5 { //~ ERROR unions with `Drop` implementations are unstable +28 | | a: u8, +29 | | } + | |_^ + | + = help: add #![feature(untagged_unions)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-unwind-attributes.rs b/src/test/ui/feature-gate-unwind-attributes.rs similarity index 100% rename from src/test/compile-fail/feature-gate-unwind-attributes.rs rename to src/test/ui/feature-gate-unwind-attributes.rs diff --git a/src/test/ui/feature-gate-unwind-attributes.stderr b/src/test/ui/feature-gate-unwind-attributes.stderr new file mode 100644 index 0000000000..02d8bf914e --- /dev/null +++ b/src/test/ui/feature-gate-unwind-attributes.stderr @@ -0,0 +1,10 @@ +error: #[unwind] is experimental + --> $DIR/feature-gate-unwind-attributes.rs:21:5 + | +21 | #[unwind] //~ ERROR #[unwind] is experimental + | ^^^^^^^^^ + | + = help: add #![feature(unwind_attributes)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/ui/feature-gate-use_nested_groups.rs b/src/test/ui/feature-gate-use_nested_groups.rs new file mode 100644 index 0000000000..56413a999d --- /dev/null +++ b/src/test/ui/feature-gate-use_nested_groups.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused_imports, dead_code)] + +mod a { + pub enum B {} + pub enum C {} + + pub mod d { + pub enum E {} + pub enum F {} + + pub mod g { + pub enum H {} + } + } +} + +use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental + //~^ ERROR nested groups in `use` are experimental + //~^^ ERROR paths in `use` groups are experimental + +fn main() {} diff --git a/src/test/ui/feature-gate-use_nested_groups.stderr b/src/test/ui/feature-gate-use_nested_groups.stderr new file mode 100644 index 0000000000..79f1d1a168 --- /dev/null +++ b/src/test/ui/feature-gate-use_nested_groups.stderr @@ -0,0 +1,26 @@ +error: nested groups in `use` are experimental (see issue #44494) + --> $DIR/feature-gate-use_nested_groups.rs:27:12 + | +27 | use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental + | ^^^^^^^^^^^^ + | + = help: add #![feature(use_nested_groups)] to the crate attributes to enable + +error: glob imports in `use` groups are experimental (see issue #44494) + --> $DIR/feature-gate-use_nested_groups.rs:27:16 + | +27 | use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental + | ^ + | + = help: add #![feature(use_nested_groups)] to the crate attributes to enable + +error: paths in `use` groups are experimental (see issue #44494) + --> $DIR/feature-gate-use_nested_groups.rs:27:19 + | +27 | use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental + | ^^^^ + | + = help: add #![feature(use_nested_groups)] to the crate attributes to enable + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate-used.rs b/src/test/ui/feature-gate-used.rs similarity index 100% rename from src/test/compile-fail/feature-gate-used.rs rename to src/test/ui/feature-gate-used.rs diff --git a/src/test/ui/feature-gate-used.stderr b/src/test/ui/feature-gate-used.stderr new file mode 100644 index 0000000000..228cf12a08 --- /dev/null +++ b/src/test/ui/feature-gate-used.stderr @@ -0,0 +1,10 @@ +error: the `#[used]` attribute is an experimental feature (see issue #40289) + --> $DIR/feature-gate-used.rs:11:1 + | +11 | #[used] + | ^^^^^^^ + | + = help: add #![feature(used)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate-wasm_import_memory.rs b/src/test/ui/feature-gate-wasm_import_memory.rs similarity index 100% rename from src/test/compile-fail/feature-gate-wasm_import_memory.rs rename to src/test/ui/feature-gate-wasm_import_memory.rs diff --git a/src/test/ui/feature-gate-wasm_import_memory.stderr b/src/test/ui/feature-gate-wasm_import_memory.stderr new file mode 100644 index 0000000000..c0486d0d5f --- /dev/null +++ b/src/test/ui/feature-gate-wasm_import_memory.stderr @@ -0,0 +1,10 @@ +error: wasm_import_memory attribute is currently unstable + --> $DIR/feature-gate-wasm_import_memory.rs:11:1 + | +11 | #![wasm_import_memory] //~ ERROR: currently unstable + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(wasm_import_memory)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-bench.rs b/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-bench.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-bench.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr new file mode 100644 index 0000000000..f7d5473f44 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr @@ -0,0 +1,4 @@ +error[E0601]: main function not found + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr new file mode 100644 index 0000000000..be340b1ab9 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -0,0 +1,1354 @@ +warning: macro_escape is a deprecated synonym for macro_use + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:532:1 + | +532 | #[macro_escape] + | ^^^^^^^^^^^^^^^ + +warning: macro_escape is a deprecated synonym for macro_use + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:17 + | +535 | mod inner { #![macro_escape] } + | ^^^^^^^^^^^^^^^^ + | + = help: consider an outer attribute, #[macro_use] mod ... + +warning: `#[must_use]` on functions is experimental (see issue #43302) + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 + | +682 | #[must_use = "1400"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(fn_must_use)] to the crate attributes to enable + +warning: unknown lint: `x5400` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:49:33 + | +49 | #![warn (x5400)] //~ WARN unknown lint: `x5400` + | ^^^^^ + | +note: lint level defined here + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:28 + | +44 | #![warn(unused_attributes, unknown_lints)] + | ^^^^^^^^^^^^^ + +warning: unknown lint: `x5300` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:33 + | +50 | #![allow (x5300)] //~ WARN unknown lint: `x5300` + | ^^^^^ + +warning: unknown lint: `x5200` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:33 + | +51 | #![forbid (x5200)] //~ WARN unknown lint: `x5200` + | ^^^^^ + +warning: unknown lint: `x5100` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:33 + | +52 | #![deny (x5100)] //~ WARN unknown lint: `x5100` + | ^^^^^ + +warning: unknown lint: `x5400` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:114:8 + | +114 | #[warn(x5400)] + | ^^^^^ + +warning: unknown lint: `x5400` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:117:25 + | +117 | mod inner { #![warn(x5400)] } + | ^^^^^ + +warning: unknown lint: `x5400` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:12 + | +120 | #[warn(x5400)] fn f() { } + | ^^^^^ + +warning: unknown lint: `x5400` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:12 + | +123 | #[warn(x5400)] struct S; + | ^^^^^ + +warning: unknown lint: `x5400` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:12 + | +126 | #[warn(x5400)] type T = S; + | ^^^^^ + +warning: unknown lint: `x5400` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:129:12 + | +129 | #[warn(x5400)] impl S { } + | ^^^^^ + +warning: unknown lint: `x5300` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:133:9 + | +133 | #[allow(x5300)] + | ^^^^^ + +warning: unknown lint: `x5300` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:136:26 + | +136 | mod inner { #![allow(x5300)] } + | ^^^^^ + +warning: unknown lint: `x5300` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:13 + | +139 | #[allow(x5300)] fn f() { } + | ^^^^^ + +warning: unknown lint: `x5300` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:13 + | +142 | #[allow(x5300)] struct S; + | ^^^^^ + +warning: unknown lint: `x5300` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:13 + | +145 | #[allow(x5300)] type T = S; + | ^^^^^ + +warning: unknown lint: `x5300` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:148:13 + | +148 | #[allow(x5300)] impl S { } + | ^^^^^ + +warning: unknown lint: `x5200` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:152:10 + | +152 | #[forbid(x5200)] + | ^^^^^ + +warning: unknown lint: `x5200` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:155:27 + | +155 | mod inner { #![forbid(x5200)] } + | ^^^^^ + +warning: unknown lint: `x5200` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:14 + | +158 | #[forbid(x5200)] fn f() { } + | ^^^^^ + +warning: unknown lint: `x5200` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:14 + | +161 | #[forbid(x5200)] struct S; + | ^^^^^ + +warning: unknown lint: `x5200` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:14 + | +164 | #[forbid(x5200)] type T = S; + | ^^^^^ + +warning: unknown lint: `x5200` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:14 + | +167 | #[forbid(x5200)] impl S { } + | ^^^^^ + +warning: unknown lint: `x5100` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:171:8 + | +171 | #[deny(x5100)] + | ^^^^^ + +warning: unknown lint: `x5100` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:174:25 + | +174 | mod inner { #![deny(x5100)] } + | ^^^^^ + +warning: unknown lint: `x5100` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:177:12 + | +177 | #[deny(x5100)] fn f() { } + | ^^^^^ + +warning: unknown lint: `x5100` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:180:12 + | +180 | #[deny(x5100)] struct S; + | ^^^^^ + +warning: unknown lint: `x5100` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:183:12 + | +183 | #[deny(x5100)] type T = S; + | ^^^^^ + +warning: unknown lint: `x5100` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:186:12 + | +186 | #[deny(x5100)] impl S { } + | ^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:17 + | +193 | mod inner { #![macro_reexport="5000"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:9 + | +44 | #![warn(unused_attributes, unknown_lints)] + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:196:5 + | +196 | #[macro_reexport = "5000"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:199:5 + | +199 | #[macro_reexport = "5000"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:202:5 + | +202 | #[macro_reexport = "5000"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:205:5 + | +205 | #[macro_reexport = "5000"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:190:1 + | +190 | #[macro_reexport = "5000"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:5 + | +213 | #[macro_use] fn f() { } + | ^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:5 + | +216 | #[macro_use] struct S; + | ^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:5 + | +219 | #[macro_use] type T = S; + | ^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:222:5 + | +222 | #[macro_use] impl S { } + | ^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:229:17 + | +229 | mod inner { #![macro_export="4800"] } + | ^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:232:5 + | +232 | #[macro_export = "4800"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:235:5 + | +235 | #[macro_export = "4800"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:238:5 + | +238 | #[macro_export = "4800"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:241:5 + | +241 | #[macro_export = "4800"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:226:1 + | +226 | #[macro_export = "4800"] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:248:17 + | +248 | mod inner { #![plugin_registrar="4700"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:253:5 + | +253 | #[plugin_registrar = "4700"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:256:5 + | +256 | #[plugin_registrar = "4700"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5 + | +259 | #[plugin_registrar = "4700"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:1 + | +245 | #[plugin_registrar = "4700"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:266:17 + | +266 | mod inner { #![main="4300"] } + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 + | +271 | #[main = "4400"] struct S; + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5 + | +274 | #[main = "4400"] type T = S; + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5 + | +277 | #[main = "4400"] impl S { } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:1 + | +263 | #[main = "4400"] + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:284:17 + | +284 | mod inner { #![start="4300"] } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:289:5 + | +289 | #[start = "4300"] struct S; + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:292:5 + | +292 | #[start = "4300"] type T = S; + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:295:5 + | +295 | #[start = "4300"] impl S { } + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:281:1 + | +281 | #[start = "4300"] + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:334:17 + | +334 | mod inner { #![simd="4000"] } + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:337:5 + | +337 | #[simd = "4000"] fn f() { } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:342:5 + | +342 | #[simd = "4000"] type T = S; + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:345:5 + | +345 | #[simd = "4000"] impl S { } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:1 + | +331 | #[simd = "4000"] + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:352:17 + | +352 | mod inner { #![repr="3900"] } + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5 + | +355 | #[repr = "3900"] fn f() { } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:360:5 + | +360 | #[repr = "3900"] type T = S; + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:363:5 + | +363 | #[repr = "3900"] impl S { } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:1 + | +349 | #[repr = "3900"] + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:371:5 + | +371 | #[path = "3800"] fn f() { } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:374:5 + | +374 | #[path = "3800"] struct S; + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:377:5 + | +377 | #[path = "3800"] type T = S; + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:5 + | +380 | #[path = "3800"] impl S { } + | ^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:387:17 + | +387 | mod inner { #![abi="3700"] } + | ^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:390:5 + | +390 | #[abi = "3700"] fn f() { } + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:393:5 + | +393 | #[abi = "3700"] struct S; + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:396:5 + | +396 | #[abi = "3700"] type T = S; + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:399:5 + | +399 | #[abi = "3700"] impl S { } + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:384:1 + | +384 | #[abi = "3700"] + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:17 + | +406 | mod inner { #![automatically_derived="3600"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:5 + | +409 | #[automatically_derived = "3600"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:5 + | +412 | #[automatically_derived = "3600"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:415:5 + | +415 | #[automatically_derived = "3600"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:418:5 + | +418 | #[automatically_derived = "3600"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:1 + | +403 | #[automatically_derived = "3600"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function is marked #[no_mangle], but not exported + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:426:27 + | +426 | #[no_mangle = "3500"] fn f() { } + | -^^^^^^^^^ + | | + | help: try making it public: `pub` + | + = note: #[warn(private_no_mangle_fns)] on by default + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:17 + | +439 | mod inner { #![no_link="3400"] } + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:5 + | +442 | #[no_link = "3400"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:5 + | +445 | #[no_link = "3400"] struct S; + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:5 + | +448 | #[no_link = "3400"]type T = S; + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 + | +451 | #[no_link = "3400"] impl S { } + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:436:1 + | +436 | #[no_link = "3400"] + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:17 + | +458 | mod inner { #![should_panic="3200"] } + | ^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:461:5 + | +461 | #[should_panic = "3200"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:5 + | +464 | #[should_panic = "3200"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:467:5 + | +467 | #[should_panic = "3200"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 + | +470 | #[should_panic = "3200"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:455:1 + | +455 | #[should_panic = "3200"] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:477:17 + | +477 | mod inner { #![ignore="3100"] } + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:5 + | +480 | #[ignore = "3100"] fn f() { } + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:5 + | +483 | #[ignore = "3100"] struct S; + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5 + | +486 | #[ignore = "3100"] type T = S; + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:5 + | +489 | #[ignore = "3100"] impl S { } + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:1 + | +474 | #[ignore = "3100"] + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:17 + | +496 | mod inner { #![no_implicit_prelude="3000"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5 + | +499 | #[no_implicit_prelude = "3000"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:502:5 + | +502 | #[no_implicit_prelude = "3000"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:5 + | +505 | #[no_implicit_prelude = "3000"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:508:5 + | +508 | #[no_implicit_prelude = "3000"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:1 + | +493 | #[no_implicit_prelude = "3000"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:17 + | +515 | mod inner { #![reexport_test_harness_main="2900"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:518:5 + | +518 | #[reexport_test_harness_main = "2900"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:521:5 + | +521 | #[reexport_test_harness_main = "2900"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:524:5 + | +524 | #[reexport_test_harness_main = "2900"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 + | +527 | #[reexport_test_harness_main = "2900"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:1 + | +512 | #[reexport_test_harness_main = "2900"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:538:5 + | +538 | #[macro_escape] fn f() { } + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:541:5 + | +541 | #[macro_escape] struct S; + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:5 + | +544 | #[macro_escape] type T = S; + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:547:5 + | +547 | #[macro_escape] impl S { } + | ^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:555:17 + | +555 | mod inner { #![no_std="2600"] } + | ^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be in the root module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:555:17 + | +555 | mod inner { #![no_std="2600"] } + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:559:5 + | +559 | #[no_std = "2600"] fn f() { } + | ^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:559:5 + | +559 | #[no_std = "2600"] fn f() { } + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:563:5 + | +563 | #[no_std = "2600"] struct S; + | ^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:563:5 + | +563 | #[no_std = "2600"] struct S; + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:567:5 + | +567 | #[no_std = "2600"] type T = S; + | ^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:567:5 + | +567 | #[no_std = "2600"] type T = S; + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:571:5 + | +571 | #[no_std = "2600"] impl S { } + | ^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:571:5 + | +571 | #[no_std = "2600"] impl S { } + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:551:1 + | +551 | #[no_std = "2600"] + | ^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:551:1 + | +551 | #[no_std = "2600"] + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 + | +711 | mod inner { #![crate_name="0900"] } + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be in the root module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 + | +711 | mod inner { #![crate_name="0900"] } + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + | +715 | #[crate_name = "0900"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + | +715 | #[crate_name = "0900"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + | +719 | #[crate_name = "0900"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + | +719 | #[crate_name = "0900"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 + | +723 | #[crate_name = "0900"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 + | +723 | #[crate_name = "0900"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 + | +727 | #[crate_name = "0900"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 + | +727 | #[crate_name = "0900"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 + | +707 | #[crate_name = "0900"] + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 + | +707 | #[crate_name = "0900"] + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:17 + | +736 | mod inner { #![crate_type="0800"] } + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be in the root module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:17 + | +736 | mod inner { #![crate_type="0800"] } + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 + | +740 | #[crate_type = "0800"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 + | +740 | #[crate_type = "0800"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 + | +744 | #[crate_type = "0800"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 + | +744 | #[crate_type = "0800"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:5 + | +748 | #[crate_type = "0800"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:5 + | +748 | #[crate_type = "0800"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:5 + | +752 | #[crate_type = "0800"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:5 + | +752 | #[crate_type = "0800"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:1 + | +732 | #[crate_type = "0800"] + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:1 + | +732 | #[crate_type = "0800"] + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:17 + | +761 | mod inner { #![feature(x0600)] } + | ^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be in the root module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:17 + | +761 | mod inner { #![feature(x0600)] } + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 + | +765 | #[feature(x0600)] fn f() { } + | ^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 + | +765 | #[feature(x0600)] fn f() { } + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769:5 + | +769 | #[feature(x0600)] struct S; + | ^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769:5 + | +769 | #[feature(x0600)] struct S; + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:5 + | +773 | #[feature(x0600)] type T = S; + | ^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:5 + | +773 | #[feature(x0600)] type T = S; + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:5 + | +777 | #[feature(x0600)] impl S { } + | ^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:5 + | +777 | #[feature(x0600)] impl S { } + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:1 + | +757 | #[feature(x0600)] + | ^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:1 + | +757 | #[feature(x0600)] + | ^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:787:17 + | +787 | mod inner { #![no_main="0400"] } + | ^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be in the root module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:787:17 + | +787 | mod inner { #![no_main="0400"] } + | ^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:791:5 + | +791 | #[no_main = "0400"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:791:5 + | +791 | #[no_main = "0400"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:5 + | +795 | #[no_main = "0400"] struct S; + | ^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:5 + | +795 | #[no_main = "0400"] struct S; + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:799:5 + | +799 | #[no_main = "0400"] type T = S; + | ^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:799:5 + | +799 | #[no_main = "0400"] type T = S; + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:5 + | +803 | #[no_main = "0400"] impl S { } + | ^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:5 + | +803 | #[no_main = "0400"] impl S { } + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:783:1 + | +783 | #[no_main = "0400"] + | ^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:783:1 + | +783 | #[no_main = "0400"] + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:17 + | +825 | mod inner { #![recursion_limit="0200"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be in the root module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:17 + | +825 | mod inner { #![recursion_limit="0200"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 + | +829 | #[recursion_limit="0200"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 + | +829 | #[recursion_limit="0200"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 + | +833 | #[recursion_limit="0200"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 + | +833 | #[recursion_limit="0200"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:837:5 + | +837 | #[recursion_limit="0200"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:837:5 + | +837 | #[recursion_limit="0200"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:841:5 + | +841 | #[recursion_limit="0200"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:841:5 + | +841 | #[recursion_limit="0200"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:1 + | +821 | #[recursion_limit="0200"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:1 + | +821 | #[recursion_limit="0200"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:850:17 + | +850 | mod inner { #![type_length_limit="0100"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be in the root module + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:850:17 + | +850 | mod inner { #![type_length_limit="0100"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:854:5 + | +854 | #[type_length_limit="0100"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:854:5 + | +854 | #[type_length_limit="0100"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:858:5 + | +858 | #[type_length_limit="0100"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:858:5 + | +858 | #[type_length_limit="0100"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:862:5 + | +862 | #[type_length_limit="0100"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:862:5 + | +862 | #[type_length_limit="0100"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:866:5 + | +866 | #[type_length_limit="0100"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:866:5 + | +866 | #[type_length_limit="0100"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:846:1 + | +846 | #[type_length_limit="0100"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:846:1 + | +846 | #[type_length_limit="0100"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 + | +53 | #![macro_reexport = "5000"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1 + | +55 | #![macro_export = "4800"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 + | +56 | #![plugin_registrar = "4700"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 + | +59 | #![main = "x4400"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1 + | +60 | #![start = "x4300"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 + | +63 | #![simd = "4000"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:64:1 + | +64 | #![repr = "3900"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 + | +65 | #![path = "3800"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1 + | +66 | #![abi = "3700"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:67:1 + | +67 | #![automatically_derived = "3600"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:69:1 + | +69 | #![no_link = "3400"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:71:1 + | +71 | #![should_panic = "3200"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 + | +72 | #![ignore = "3100"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused attribute + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:78:1 + | +78 | #![proc_macro_derive = "2500"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: compilation successful + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:877:1 + | +877 | / fn main() { //~ ERROR compilation successful +878 | | println!("Hello World"); +879 | | } + | |_^ + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-deprecated.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.stderr new file mode 100644 index 0000000000..a413fcc56a --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.stderr @@ -0,0 +1,8 @@ +error: compilation successful + --> $DIR/issue-43106-gating-of-deprecated.rs:29:1 + | +29 | / fn main() { //~ ERROR compilation successful +30 | | println!("Hello World"); +31 | | } + | |_^ + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-derive-2.rs b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-derive-2.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr new file mode 100644 index 0000000000..c5b33384b9 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr @@ -0,0 +1,20 @@ +error: cannot find derive macro `x3300` in this scope + --> $DIR/issue-43106-gating-of-derive-2.rs:14:14 + | +14 | #[derive(x3300)] + | ^^^^^ + +error: cannot find derive macro `x3300` in this scope + --> $DIR/issue-43106-gating-of-derive-2.rs:18:14 + | +18 | #[derive(x3300)] + | ^^^^^ + +error: cannot find derive macro `x3300` in this scope + --> $DIR/issue-43106-gating-of-derive-2.rs:22:14 + | +22 | #[derive(x3300)] + | ^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-derive.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-derive.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr new file mode 100644 index 0000000000..a0b12585f3 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr @@ -0,0 +1,38 @@ +error: `derive` may only be applied to structs, enums and unions + --> $DIR/issue-43106-gating-of-derive.rs:14:1 + | +14 | #![derive(Debug)] + | ^^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Debug)]` + +error: `derive` may only be applied to structs, enums and unions + --> $DIR/issue-43106-gating-of-derive.rs:17:1 + | +17 | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ + +error: `derive` may only be applied to structs, enums and unions + --> $DIR/issue-43106-gating-of-derive.rs:20:17 + | +20 | mod inner { #![derive(Debug)] } + | ^^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Debug)]` + +error: `derive` may only be applied to structs, enums and unions + --> $DIR/issue-43106-gating-of-derive.rs:23:5 + | +23 | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ + +error: `derive` may only be applied to structs, enums and unions + --> $DIR/issue-43106-gating-of-derive.rs:36:5 + | +36 | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ + +error: `derive` may only be applied to structs, enums and unions + --> $DIR/issue-43106-gating-of-derive.rs:40:5 + | +40 | #[derive(Debug)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-inline.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr new file mode 100644 index 0000000000..92bda4d044 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -0,0 +1,43 @@ +error[E0518]: attribute should be applied to function + --> $DIR/issue-43106-gating-of-inline.rs:21:1 + | +21 | #[inline = "2100"] + | ^^^^^^^^^^^^^^^^^^ +22 | //~^ ERROR attribute should be applied to function +23 | / mod inline { +24 | | mod inner { #![inline="2100"] } +25 | | //~^ ERROR attribute should be applied to function +26 | | +... | +36 | | //~^ ERROR attribute should be applied to function +37 | | } + | |_- not a function + +error[E0518]: attribute should be applied to function + --> $DIR/issue-43106-gating-of-inline.rs:24:17 + | +24 | mod inner { #![inline="2100"] } + | ------------^^^^^^^^^^^^^^^^^-- not a function + +error[E0518]: attribute should be applied to function + --> $DIR/issue-43106-gating-of-inline.rs:29:5 + | +29 | #[inline = "2100"] struct S; + | ^^^^^^^^^^^^^^^^^^ --------- not a function + +error[E0518]: attribute should be applied to function + --> $DIR/issue-43106-gating-of-inline.rs:32:5 + | +32 | #[inline = "2100"] type T = S; + | ^^^^^^^^^^^^^^^^^^ ----------- not a function + +error[E0518]: attribute should be applied to function + --> $DIR/issue-43106-gating-of-inline.rs:35:5 + | +35 | #[inline = "2100"] impl S { } + | ^^^^^^^^^^^^^^^^^^ ---------- not a function + +error[E0601]: main function not found + +error: aborting due to 6 previous errors + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_escape.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_escape.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr new file mode 100644 index 0000000000..60a9382bdb --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr @@ -0,0 +1,12 @@ +warning: macro_escape is a deprecated synonym for macro_use + --> $DIR/issue-43106-gating-of-macro_escape.rs:16:1 + | +16 | #![macro_escape] + | ^^^^^^^^^^^^^^^^ + | + = help: consider an outer attribute, #[macro_use] mod ... + +error[E0601]: main function not found + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_use.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_use.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr new file mode 100644 index 0000000000..2977384f62 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr @@ -0,0 +1,20 @@ +error: arguments to macro_use are not allowed here + --> $DIR/issue-43106-gating-of-macro_use.rs:16:1 + | +16 | #![macro_use = "4900"] //~ ERROR arguments to macro_use are not allowed here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: arguments to macro_use are not allowed here + --> $DIR/issue-43106-gating-of-macro_use.rs:18:1 + | +18 | #[macro_use = "2700"] + | ^^^^^^^^^^^^^^^^^^^^^ + +error: arguments to macro_use are not allowed here + --> $DIR/issue-43106-gating-of-macro_use.rs:21:17 + | +21 | mod inner { #![macro_use="2700"] } + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-proc_macro_derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-proc_macro_derive.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr new file mode 100644 index 0000000000..a76f0219f7 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr @@ -0,0 +1,40 @@ +error: the `#[proc_macro_derive]` attribute may only be used on bare functions + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:20:1 + | +20 | #[proc_macro_derive = "2500"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the `#[proc_macro_derive]` attribute may only be used on bare functions + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:28:17 + | +28 | mod inner { #![proc_macro_derive="2500"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:31:5 + | +31 | #[proc_macro_derive = "2500"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the `#[proc_macro_derive]` attribute may only be used on bare functions + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:34:5 + | +34 | #[proc_macro_derive = "2500"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the `#[proc_macro_derive]` attribute may only be used on bare functions + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:37:5 + | +37 | #[proc_macro_derive = "2500"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the `#[proc_macro_derive]` attribute may only be used on bare functions + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:40:5 + | +40 | #[proc_macro_derive = "2500"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0601]: main function not found + +error: aborting due to 7 previous errors + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr new file mode 100644 index 0000000000..6f6f587cb5 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr @@ -0,0 +1,46 @@ +error[E0601]: main function not found + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:17:1 + | +17 | #![rustc_deprecated = "1500"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:20:1 + | +20 | #[rustc_deprecated = "1500"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:23:17 + | +23 | mod inner { #![rustc_deprecated="1500"] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5 + | +26 | #[rustc_deprecated = "1500"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:29:5 + | +29 | #[rustc_deprecated = "1500"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:32:5 + | +32 | #[rustc_deprecated = "1500"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:35:5 + | +35 | #[rustc_deprecated = "1500"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-stable.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr new file mode 100644 index 0000000000..59f0431c70 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr @@ -0,0 +1,46 @@ +error[E0601]: main function not found + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:17:1 + | +17 | #![stable = "1300"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:20:1 + | +20 | #[stable = "1300"] + | ^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:23:17 + | +23 | mod inner { #![stable="1300"] } + | ^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:26:5 + | +26 | #[stable = "1300"] fn f() { } + | ^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:29:5 + | +29 | #[stable = "1300"] struct S; + | ^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:32:5 + | +32 | #[stable = "1300"] type T = S; + | ^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:35:5 + | +35 | #[stable = "1300"] impl S { } + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-test.rs b/src/test/ui/feature-gate/issue-43106-gating-of-test.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-test.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-test.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr new file mode 100644 index 0000000000..f7d5473f44 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr @@ -0,0 +1,4 @@ +error[E0601]: main function not found + +error: aborting due to previous error + diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs similarity index 100% rename from src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs rename to src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr new file mode 100644 index 0000000000..00cbc62ab4 --- /dev/null +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr @@ -0,0 +1,46 @@ +error[E0601]: main function not found + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:17:1 + | +17 | #![unstable = "1200"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:20:1 + | +20 | #[unstable = "1200"] + | ^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:23:17 + | +23 | mod inner { #![unstable="1200"] } + | ^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:26:5 + | +26 | #[unstable = "1200"] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:29:5 + | +29 | #[unstable = "1200"] struct S; + | ^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:32:5 + | +32 | #[unstable = "1200"] type T = S; + | ^^^^^^^^^^^^^^^^^^^^ + +error: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:35:5 + | +35 | #[unstable = "1200"] impl S { } + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors + diff --git a/src/test/ui/fmt/format-string-error.stderr b/src/test/ui/fmt/format-string-error.stderr index 58b392f0b8..1c775929cf 100644 --- a/src/test/ui/fmt/format-string-error.stderr +++ b/src/test/ui/fmt/format-string-error.stderr @@ -5,7 +5,7 @@ error: invalid format string: expected `'}'` but string was terminated | ^^^^^^^^^^^^^^ | = note: if you intended to print `{`, you can escape it using `{{` - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: invalid format string: unmatched `}` found --> $DIR/format-string-error.rs:14:5 @@ -14,7 +14,7 @@ error: invalid format string: unmatched `}` found | ^^^^^^^^^^^^^^ | = note: if you intended to print `}`, you can escape it using `}}` - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/fmt/send-sync.rs b/src/test/ui/fmt/send-sync.rs new file mode 100644 index 0000000000..3f13fd2e49 --- /dev/null +++ b/src/test/ui/fmt/send-sync.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn send<T: Send>(_: T) {} +fn sync<T: Sync>(_: T) {} + +fn main() { + // `Cell` is not `Sync`, so `&Cell` is neither `Sync` nor `Send`, + // `std::fmt::Arguments` used to forget this... + let c = std::cell::Cell::new(42); + send(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied + sync(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied +} diff --git a/src/test/ui/fmt/send-sync.stderr b/src/test/ui/fmt/send-sync.stderr new file mode 100644 index 0000000000..9e0e563c35 --- /dev/null +++ b/src/test/ui/fmt/send-sync.stderr @@ -0,0 +1,34 @@ +error[E0277]: the trait bound `*mut std::ops::Fn() + 'static: std::marker::Sync` is not satisfied in `[std::fmt::ArgumentV1<'_>]` + --> $DIR/send-sync.rs:18:5 + | +18 | send(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied + | ^^^^ `*mut std::ops::Fn() + 'static` cannot be shared between threads safely + | + = help: within `[std::fmt::ArgumentV1<'_>]`, the trait `std::marker::Sync` is not implemented for `*mut std::ops::Fn() + 'static` + = note: required because it appears within the type `std::marker::PhantomData<*mut std::ops::Fn() + 'static>` + = note: required because it appears within the type `core::fmt::Void` + = note: required because it appears within the type `&core::fmt::Void` + = note: required because it appears within the type `std::fmt::ArgumentV1<'_>` + = note: required because it appears within the type `[std::fmt::ArgumentV1<'_>]` + = note: required because of the requirements on the impl of `std::marker::Send` for `&[std::fmt::ArgumentV1<'_>]` + = note: required because it appears within the type `std::fmt::Arguments<'_>` + = note: required by `send` + +error[E0277]: the trait bound `*mut std::ops::Fn() + 'static: std::marker::Sync` is not satisfied in `std::fmt::Arguments<'_>` + --> $DIR/send-sync.rs:19:5 + | +19 | sync(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied + | ^^^^ `*mut std::ops::Fn() + 'static` cannot be shared between threads safely + | + = help: within `std::fmt::Arguments<'_>`, the trait `std::marker::Sync` is not implemented for `*mut std::ops::Fn() + 'static` + = note: required because it appears within the type `std::marker::PhantomData<*mut std::ops::Fn() + 'static>` + = note: required because it appears within the type `core::fmt::Void` + = note: required because it appears within the type `&core::fmt::Void` + = note: required because it appears within the type `std::fmt::ArgumentV1<'_>` + = note: required because it appears within the type `[std::fmt::ArgumentV1<'_>]` + = note: required because it appears within the type `&[std::fmt::ArgumentV1<'_>]` + = note: required because it appears within the type `std::fmt::Arguments<'_>` + = note: required by `sync` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/generator/borrowing.stderr b/src/test/ui/generator/borrowing.stderr index 0ed7e1f990..cb84eaedb3 100644 --- a/src/test/ui/generator/borrowing.stderr +++ b/src/test/ui/generator/borrowing.stderr @@ -2,7 +2,7 @@ error[E0597]: `a` does not live long enough --> $DIR/borrowing.rs:18:20 | 18 | (|| yield &a).resume() - | -- ^ does not live long enough + | -- ^ borrowed value does not live long enough | | | capture occurs here 19 | //~^ ERROR: `a` does not live long enough @@ -18,7 +18,7 @@ error[E0597]: `a` does not live long enough 24 | || { | -- capture occurs here 25 | yield &a - | ^ does not live long enough + | ^ borrowed value does not live long enough ... 28 | }; | - borrowed value only lives until here diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.rs b/src/test/ui/generator/ref-escapes-but-not-over-yield.rs index 87edbb22ba..989949cd9d 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.rs +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.rs @@ -21,7 +21,8 @@ fn foo(x: &i32) { let mut b = move || { yield(); let b = 5; - a = &b; //~ ERROR + a = &b; + //~^ ERROR `b` does not live long enough }; } diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr index e30d28c2db..fbb7288415 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr @@ -1,11 +1,12 @@ error[E0597]: `b` does not live long enough - --> $DIR/ref-escapes-but-not-over-yield.rs:25:5 + --> $DIR/ref-escapes-but-not-over-yield.rs:24:14 | -24 | a = &b; //~ ERROR - | - borrow occurs here -25 | }; - | ^ `b` dropped here while still borrowed -26 | } +24 | a = &b; + | ^ borrowed value does not live long enough +25 | //~^ ERROR `b` does not live long enough +26 | }; + | - `b` dropped here while still borrowed +27 | } | - borrowed value needs to live until here error: aborting due to previous error diff --git a/src/test/ui/generator/yield-while-local-borrowed.rs b/src/test/ui/generator/yield-while-local-borrowed.rs index d21c86e886..504f3e8739 100644 --- a/src/test/ui/generator/yield-while-local-borrowed.rs +++ b/src/test/ui/generator/yield-while-local-borrowed.rs @@ -19,7 +19,7 @@ fn borrow_local_inline() { // (This error occurs because the region shows up in the type of // `b` and gets extended by region inference.) let mut b = move || { - let a = &3; //~ ERROR + let a = &3; yield(); println!("{}", a); }; diff --git a/src/test/compile-fail/generic-type-less-params-with-defaults.rs b/src/test/ui/generic-type-less-params-with-defaults.rs similarity index 93% rename from src/test/compile-fail/generic-type-less-params-with-defaults.rs rename to src/test/ui/generic-type-less-params-with-defaults.rs index 9b19e09eea..c873fa6760 100644 --- a/src/test/compile-fail/generic-type-less-params-with-defaults.rs +++ b/src/test/ui/generic-type-less-params-with-defaults.rs @@ -18,5 +18,4 @@ struct Vec<T, A = Heap>( fn main() { let _: Vec; //~^ ERROR wrong number of type arguments: expected at least 1, found 0 [E0243] - //~| NOTE expected at least 1 type argument } diff --git a/src/test/ui/generic-type-less-params-with-defaults.stderr b/src/test/ui/generic-type-less-params-with-defaults.stderr new file mode 100644 index 0000000000..0351923eff --- /dev/null +++ b/src/test/ui/generic-type-less-params-with-defaults.stderr @@ -0,0 +1,8 @@ +error[E0243]: wrong number of type arguments: expected at least 1, found 0 + --> $DIR/generic-type-less-params-with-defaults.rs:19:12 + | +19 | let _: Vec; + | ^^^ expected at least 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/generic-type-more-params-with-defaults.rs b/src/test/ui/generic-type-more-params-with-defaults.rs similarity index 93% rename from src/test/compile-fail/generic-type-more-params-with-defaults.rs rename to src/test/ui/generic-type-more-params-with-defaults.rs index b5764ef89a..0d1b1943ca 100644 --- a/src/test/compile-fail/generic-type-more-params-with-defaults.rs +++ b/src/test/ui/generic-type-more-params-with-defaults.rs @@ -18,5 +18,4 @@ struct Vec<T, A = Heap>( fn main() { let _: Vec<isize, Heap, bool>; //~^ ERROR wrong number of type arguments: expected at most 2, found 3 [E0244] - //~| NOTE expected at most 2 type arguments } diff --git a/src/test/ui/generic-type-more-params-with-defaults.stderr b/src/test/ui/generic-type-more-params-with-defaults.stderr new file mode 100644 index 0000000000..11ce6b1656 --- /dev/null +++ b/src/test/ui/generic-type-more-params-with-defaults.stderr @@ -0,0 +1,8 @@ +error[E0244]: wrong number of type arguments: expected at most 2, found 3 + --> $DIR/generic-type-more-params-with-defaults.rs:19:12 + | +19 | let _: Vec<isize, Heap, bool>; + | ^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments + +error: aborting due to previous error + diff --git a/src/test/ui/hello_world/main.rs b/src/test/ui/hello_world/main.rs index 6118397557..4c53d19f71 100644 --- a/src/test/ui/hello_world/main.rs +++ b/src/test/ui/hello_world/main.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + // Test that compiling hello world succeeds with no output of any kind. fn main() { diff --git a/src/test/compile-fail/if-let-arm-types.rs b/src/test/ui/if-let-arm-types.rs similarity index 90% rename from src/test/compile-fail/if-let-arm-types.rs rename to src/test/ui/if-let-arm-types.rs index 40013a7ee4..331fdc444c 100644 --- a/src/test/compile-fail/if-let-arm-types.rs +++ b/src/test/ui/if-let-arm-types.rs @@ -14,7 +14,7 @@ fn main() { //~| expected type `()` //~| found type `{integer}` () - } else { //~ NOTE: `if let` arm with an incompatible type + } else { 1 }; } diff --git a/src/test/ui/if-let-arm-types.stderr b/src/test/ui/if-let-arm-types.stderr new file mode 100644 index 0000000000..fb8e00bfa9 --- /dev/null +++ b/src/test/ui/if-let-arm-types.stderr @@ -0,0 +1,25 @@ +error[E0308]: `if let` arms have incompatible types + --> $DIR/if-let-arm-types.rs:12:5 + | +12 | / if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types +13 | | //~^ expected (), found integral variable +14 | | //~| expected type `()` +15 | | //~| found type `{integer}` +... | +18 | | 1 +19 | | }; + | |_____^ expected (), found integral variable + | + = note: expected type `()` + found type `{integer}` +note: `if let` arm with an incompatible type + --> $DIR/if-let-arm-types.rs:17:12 + | +17 | } else { + | ____________^ +18 | | 1 +19 | | }; + | |_____^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/impl-duplicate-methods.rs b/src/test/ui/impl-duplicate-methods.rs similarity index 84% rename from src/test/compile-fail/impl-duplicate-methods.rs rename to src/test/ui/impl-duplicate-methods.rs index f6e9ab2d61..8849914075 100644 --- a/src/test/compile-fail/impl-duplicate-methods.rs +++ b/src/test/ui/impl-duplicate-methods.rs @@ -11,10 +11,9 @@ struct Foo; impl Foo { - fn orange(&self) {} //~ NOTE previous definition of `orange` here + fn orange(&self) {} fn orange(&self) {} //~^ ERROR duplicate definition - //~| NOTE duplicate definition } fn main() {} diff --git a/src/test/ui/impl-duplicate-methods.stderr b/src/test/ui/impl-duplicate-methods.stderr new file mode 100644 index 0000000000..73d470cc29 --- /dev/null +++ b/src/test/ui/impl-duplicate-methods.stderr @@ -0,0 +1,10 @@ +error[E0201]: duplicate definitions with name `orange`: + --> $DIR/impl-duplicate-methods.rs:15:5 + | +14 | fn orange(&self) {} + | ------------------- previous definition of `orange` here +15 | fn orange(&self) {} + | ^^^^^^^^^^^^^^^^^^^ duplicate definition + +error: aborting due to previous error + diff --git a/src/test/compile-fail/impl-trait/auto-trait-leak.rs b/src/test/ui/impl-trait/auto-trait-leak.rs similarity index 64% rename from src/test/compile-fail/impl-trait/auto-trait-leak.rs rename to src/test/ui/impl-trait/auto-trait-leak.rs index 8a5033e764..705390e3b9 100644 --- a/src/test/compile-fail/impl-trait/auto-trait-leak.rs +++ b/src/test/ui/impl-trait/auto-trait-leak.rs @@ -26,17 +26,9 @@ fn send<T: Send>(_: T) {} fn main() { send(before()); //~^ ERROR the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied - //~| NOTE `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely - //~| NOTE required because it appears within the type `[closure - //~| NOTE required because it appears within the type `impl std::ops::Fn<(i32,)>` - //~| NOTE required by `send` send(after()); //~^ ERROR the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied - //~| NOTE `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely - //~| NOTE required because it appears within the type `[closure - //~| NOTE required because it appears within the type `impl std::ops::Fn<(i32,)>` - //~| NOTE required by `send` } // Deferred path, main has to wait until typeck finishes, @@ -52,17 +44,12 @@ fn after() -> impl Fn(i32) { fn cycle1() -> impl Clone { //~^ ERROR unsupported cyclic reference between types/traits detected //~| cyclic reference - //~| NOTE the cycle begins when processing `cycle1`... - //~| NOTE ...which then requires processing `cycle1::{{impl-Trait}}`... - //~| NOTE ...which then again requires processing `cycle1`, completing the cycle. send(cycle2().clone()); Rc::new(Cell::new(5)) } fn cycle2() -> impl Clone { - //~^ NOTE ...which then requires processing `cycle2::{{impl-Trait}}`... - //~| NOTE ...which then requires processing `cycle2`... send(cycle1().clone()); Rc::new(String::from("foo")) diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr new file mode 100644 index 0000000000..ffd6a3fe4f --- /dev/null +++ b/src/test/ui/impl-trait/auto-trait-leak.stderr @@ -0,0 +1,52 @@ +error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>` + --> $DIR/auto-trait-leak.rs:27:5 + | +27 | send(before()); + | ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely + | + = help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::Cell<i32>>` + = note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:21:5: 21:22 p:std::rc::Rc<std::cell::Cell<i32>>]` + = note: required because it appears within the type `impl std::ops::Fn<(i32,)>` + = note: required by `send` + +error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>` + --> $DIR/auto-trait-leak.rs:30:5 + | +30 | send(after()); + | ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely + | + = help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::Cell<i32>>` + = note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:38:5: 38:22 p:std::rc::Rc<std::cell::Cell<i32>>]` + = note: required because it appears within the type `impl std::ops::Fn<(i32,)>` + = note: required by `send` + +error[E0391]: unsupported cyclic reference between types/traits detected + --> $DIR/auto-trait-leak.rs:44:1 + | +44 | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic reference + | +note: the cycle begins when processing `cycle1`... + --> $DIR/auto-trait-leak.rs:44:1 + | +44 | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which then requires processing `cycle2::{{impl-Trait}}`... + --> $DIR/auto-trait-leak.rs:52:16 + | +52 | fn cycle2() -> impl Clone { + | ^^^^^^^^^^ +note: ...which then requires processing `cycle2`... + --> $DIR/auto-trait-leak.rs:52:1 + | +52 | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which then requires processing `cycle1::{{impl-Trait}}`... + --> $DIR/auto-trait-leak.rs:44:16 + | +44 | fn cycle1() -> impl Clone { + | ^^^^^^^^^^ + = note: ...which then again requires processing `cycle1`, completing the cycle. + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/impl-trait/equality.rs b/src/test/ui/impl-trait/equality.rs index 96db53ad2e..36df4f0eb4 100644 --- a/src/test/ui/impl-trait/equality.rs +++ b/src/test/ui/impl-trait/equality.rs @@ -32,7 +32,7 @@ fn sum_to(n: u32) -> impl Foo { 0 } else { n + sum_to(n - 1) - //~^ ERROR no implementation for `u32 + impl Foo` + //~^ ERROR the trait bound `u32: std::ops::Add<impl Foo>` is not satisfied } } diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs index 0bb944edb9..79d487493e 100644 --- a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs +++ b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs @@ -29,6 +29,4 @@ fn main() { f1.foo(1usize); //~^ error: method named `foo` found for type `Bar` in the current scope - //~| help: items from traits can only be used if the trait is implemented and in scope - //~| help: candidate #1: `Foo` } diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr index 3bc281726e..2976945684 100644 --- a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr +++ b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr @@ -1,6 +1,9 @@ error[E0599]: no method named `foo` found for type `Bar` in the current scope --> $DIR/issue-21659-show-relevant-trait-impls-3.rs:30:8 | +23 | struct Bar; + | ----------- method `foo` not found for this +... 30 | f1.foo(1usize); | ^^^ | diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.rs b/src/test/ui/impl-trait/method-suggestion-no-duplication.rs index 390b8f07b2..28028922e3 100644 --- a/src/test/ui/impl-trait/method-suggestion-no-duplication.rs +++ b/src/test/ui/impl-trait/method-suggestion-no-duplication.rs @@ -18,8 +18,4 @@ fn foo<F>(f: F) where F: FnMut(Foo) {} fn main() { foo(|s| s.is_empty()); //~^ ERROR no method named `is_empty` found - //~^^ HELP #1: `std::iter::ExactSizeIterator` - //~^^^ HELP #2: `core::slice::SliceExt` - //~^^^^ HELP #3: `core::str::StrExt` - //~^^^^^ HELP items from traits can only be used if the trait is implemented and in scope; the following traits define an item `is_empty`, perhaps you need to implement one of them: } diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr b/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr index d3dbb77490..52d3931011 100644 --- a/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr +++ b/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr @@ -1,6 +1,9 @@ error[E0599]: no method named `is_empty` found for type `Foo` in the current scope --> $DIR/method-suggestion-no-duplication.rs:19:15 | +14 | struct Foo; + | ----------- method `is_empty` not found for this +... 19 | foo(|s| s.is_empty()); | ^^^^^^^^ | diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.rs b/src/test/ui/impl-trait/no-method-suggested-traits.rs index 15891b0002..07c0e6f529 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.rs +++ b/src/test/ui/impl-trait/no-method-suggested-traits.rs @@ -31,95 +31,49 @@ fn main() { 1u32.method(); - //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them - //~| ERROR no method named - //~| HELP `use foo::Bar;` - //~| HELP `use no_method_suggested_traits::foo::PubPub;` + //~^ ERROR no method named + //~|items from traits can only be used if the trait is in scope std::rc::Rc::new(&mut Box::new(&1u32)).method(); - //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them - //~| ERROR no method named - //~| HELP `use foo::Bar;` - //~| HELP `use no_method_suggested_traits::foo::PubPub;` + //~^items from traits can only be used if the trait is in scope + //~| ERROR no method named `method` found for type 'a'.method(); //~^ ERROR no method named - //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it: - //~| HELP `use foo::Bar;` std::rc::Rc::new(&mut Box::new(&'a')).method(); //~^ ERROR no method named - //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it: - //~| HELP `use foo::Bar;` 1i32.method(); //~^ ERROR no method named - //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it: - //~| HELP `use no_method_suggested_traits::foo::PubPub;` std::rc::Rc::new(&mut Box::new(&1i32)).method(); //~^ ERROR no method named - //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it: - //~| HELP `use no_method_suggested_traits::foo::PubPub;` Foo.method(); //~^ ERROR no method named - //~| HELP following traits define an item `method`, perhaps you need to implement one of them - //~| HELP `foo::Bar` - //~| HELP `no_method_suggested_traits::foo::PubPub` - //~| HELP `no_method_suggested_traits::Reexported` - //~| HELP `no_method_suggested_traits::bar::PubPriv` - //~| HELP `no_method_suggested_traits::qux::PrivPub` - //~| HELP `no_method_suggested_traits::quz::PrivPriv` std::rc::Rc::new(&mut Box::new(&Foo)).method(); //~^ ERROR no method named - //~| HELP following traits define an item `method`, perhaps you need to implement one of them - //~| HELP `foo::Bar` - //~| HELP `no_method_suggested_traits::foo::PubPub` - //~| HELP `no_method_suggested_traits::Reexported` - //~| HELP `no_method_suggested_traits::bar::PubPriv` - //~| HELP `no_method_suggested_traits::qux::PrivPub` - //~| HELP `no_method_suggested_traits::quz::PrivPriv` 1u64.method2(); //~^ ERROR no method named - //~| HELP the following trait defines an item `method2`, perhaps you need to implement it - //~| HELP `foo::Bar` std::rc::Rc::new(&mut Box::new(&1u64)).method2(); //~^ ERROR no method named - //~| HELP the following trait defines an item `method2`, perhaps you need to implement it - //~| HELP `foo::Bar` no_method_suggested_traits::Foo.method2(); //~^ ERROR no method named - //~| HELP following trait defines an item `method2`, perhaps you need to implement it - //~| HELP `foo::Bar` std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); //~^ ERROR no method named - //~| HELP following trait defines an item `method2`, perhaps you need to implement it - //~| HELP `foo::Bar` no_method_suggested_traits::Bar::X.method2(); //~^ ERROR no method named - //~| HELP following trait defines an item `method2`, perhaps you need to implement it - //~| HELP `foo::Bar` std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); //~^ ERROR no method named - //~| HELP following trait defines an item `method2`, perhaps you need to implement it - //~| HELP `foo::Bar` Foo.method3(); //~^ ERROR no method named - //~| HELP following trait defines an item `method3`, perhaps you need to implement it - //~| HELP `no_method_suggested_traits::foo::PubPub` std::rc::Rc::new(&mut Box::new(&Foo)).method3(); //~^ ERROR no method named - //~| HELP following trait defines an item `method3`, perhaps you need to implement it - //~| HELP `no_method_suggested_traits::foo::PubPub` Bar::X.method3(); //~^ ERROR no method named - //~| HELP following trait defines an item `method3`, perhaps you need to implement it - //~| HELP `no_method_suggested_traits::foo::PubPub` std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); //~^ ERROR no method named - //~| HELP following trait defines an item `method3`, perhaps you need to implement it - //~| HELP `no_method_suggested_traits::foo::PubPub` // should have no help: 1_usize.method3(); //~ ERROR no method named diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr index 23f115858c..4517f09d07 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr +++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr @@ -5,69 +5,90 @@ error[E0599]: no method named `method` found for type `u32` in the current scope | ^^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: the following traits are implemented but not in scope, perhaps add a `use` for one of them: - candidate #1: `use foo::Bar;` - candidate #2: `use no_method_suggested_traits::foo::PubPub;` - candidate #3: `use no_method_suggested_traits::qux::PrivPub;` - candidate #4: `use no_method_suggested_traits::Reexported;` +help: the following traits are implemented but not in scope, perhaps add a `use` for one of them: + | +14 | use foo::Bar; + | +14 | use no_method_suggested_traits::foo::PubPub; + | +14 | use no_method_suggested_traits::qux::PrivPub; + | +14 | use no_method_suggested_traits::Reexported; + | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&u32>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:38:44 + --> $DIR/no-method-suggested-traits.rs:36:44 | -38 | std::rc::Rc::new(&mut Box::new(&1u32)).method(); +36 | std::rc::Rc::new(&mut Box::new(&1u32)).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: the following traits are implemented but not in scope, perhaps add a `use` for one of them: - candidate #1: `use foo::Bar;` - candidate #2: `use no_method_suggested_traits::foo::PubPub;` - candidate #3: `use no_method_suggested_traits::qux::PrivPub;` - candidate #4: `use no_method_suggested_traits::Reexported;` +help: the following traits are implemented but not in scope, perhaps add a `use` for one of them: + | +14 | use foo::Bar; + | +14 | use no_method_suggested_traits::foo::PubPub; + | +14 | use no_method_suggested_traits::qux::PrivPub; + | +14 | use no_method_suggested_traits::Reexported; + | error[E0599]: no method named `method` found for type `char` in the current scope - --> $DIR/no-method-suggested-traits.rs:44:9 + --> $DIR/no-method-suggested-traits.rs:40:9 | -44 | 'a'.method(); +40 | 'a'.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - candidate #1: `use foo::Bar;` +help: the following trait is implemented but not in scope, perhaps add a `use` for it: + | +14 | use foo::Bar; + | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&char>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:48:43 + --> $DIR/no-method-suggested-traits.rs:42:43 | -48 | std::rc::Rc::new(&mut Box::new(&'a')).method(); +42 | std::rc::Rc::new(&mut Box::new(&'a')).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - candidate #1: `use foo::Bar;` +help: the following trait is implemented but not in scope, perhaps add a `use` for it: + | +14 | use foo::Bar; + | error[E0599]: no method named `method` found for type `i32` in the current scope - --> $DIR/no-method-suggested-traits.rs:53:10 + --> $DIR/no-method-suggested-traits.rs:45:10 | -53 | 1i32.method(); +45 | 1i32.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - candidate #1: `use no_method_suggested_traits::foo::PubPub;` +help: the following trait is implemented but not in scope, perhaps add a `use` for it: + | +14 | use no_method_suggested_traits::foo::PubPub; + | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&i32>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:57:44 + --> $DIR/no-method-suggested-traits.rs:47:44 | -57 | std::rc::Rc::new(&mut Box::new(&1i32)).method(); +47 | std::rc::Rc::new(&mut Box::new(&1i32)).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - candidate #1: `use no_method_suggested_traits::foo::PubPub;` +help: the following trait is implemented but not in scope, perhaps add a `use` for it: + | +14 | use no_method_suggested_traits::foo::PubPub; + | error[E0599]: no method named `method` found for type `Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:62:9 + --> $DIR/no-method-suggested-traits.rs:50:9 | -62 | Foo.method(); +14 | struct Foo; + | ----------- method `method` not found for this +... +50 | Foo.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -80,9 +101,9 @@ error[E0599]: no method named `method` found for type `Foo` in the current scope candidate #6: `no_method_suggested_traits::Reexported` error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:71:43 + --> $DIR/no-method-suggested-traits.rs:52:43 | -71 | std::rc::Rc::new(&mut Box::new(&Foo)).method(); +52 | std::rc::Rc::new(&mut Box::new(&Foo)).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -95,9 +116,9 @@ error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::box candidate #6: `no_method_suggested_traits::Reexported` error[E0599]: no method named `method2` found for type `u64` in the current scope - --> $DIR/no-method-suggested-traits.rs:81:10 + --> $DIR/no-method-suggested-traits.rs:55:10 | -81 | 1u64.method2(); +55 | 1u64.method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -105,9 +126,9 @@ error[E0599]: no method named `method2` found for type `u64` in the current scop candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&u64>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:85:44 + --> $DIR/no-method-suggested-traits.rs:57:44 | -85 | std::rc::Rc::new(&mut Box::new(&1u64)).method2(); +57 | std::rc::Rc::new(&mut Box::new(&1u64)).method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -115,9 +136,9 @@ error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::bo candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:90:37 + --> $DIR/no-method-suggested-traits.rs:60:37 | -90 | no_method_suggested_traits::Foo.method2(); +60 | no_method_suggested_traits::Foo.method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -125,9 +146,9 @@ error[E0599]: no method named `method2` found for type `no_method_suggested_trai candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:94:71 + --> $DIR/no-method-suggested-traits.rs:62:71 | -94 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); +62 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -135,9 +156,9 @@ error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::bo candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:98:40 + --> $DIR/no-method-suggested-traits.rs:64:40 | -98 | no_method_suggested_traits::Bar::X.method2(); +64 | no_method_suggested_traits::Bar::X.method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -145,90 +166,96 @@ error[E0599]: no method named `method2` found for type `no_method_suggested_trai candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:102:74 - | -102 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); - | ^^^^^^^ - | - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `method2`, perhaps you need to implement it: - candidate #1: `foo::Bar` + --> $DIR/no-method-suggested-traits.rs:66:74 + | +66 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); + | ^^^^^^^ + | + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `method2`, perhaps you need to implement it: + candidate #1: `foo::Bar` error[E0599]: no method named `method3` found for type `Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:107:9 - | -107 | Foo.method3(); - | ^^^^^^^ - | - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `method3`, perhaps you need to implement it: - candidate #1: `no_method_suggested_traits::foo::PubPub` + --> $DIR/no-method-suggested-traits.rs:69:9 + | +14 | struct Foo; + | ----------- method `method3` not found for this +... +69 | Foo.method3(); + | ^^^^^^^ + | + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `method3`, perhaps you need to implement it: + candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:111:43 - | -111 | std::rc::Rc::new(&mut Box::new(&Foo)).method3(); - | ^^^^^^^ - | - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `method3`, perhaps you need to implement it: - candidate #1: `no_method_suggested_traits::foo::PubPub` + --> $DIR/no-method-suggested-traits.rs:71:43 + | +71 | std::rc::Rc::new(&mut Box::new(&Foo)).method3(); + | ^^^^^^^ + | + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `method3`, perhaps you need to implement it: + candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:115:12 - | -115 | Bar::X.method3(); - | ^^^^^^^ - | - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `method3`, perhaps you need to implement it: - candidate #1: `no_method_suggested_traits::foo::PubPub` + --> $DIR/no-method-suggested-traits.rs:73:12 + | +15 | enum Bar { X } + | -------- method `method3` not found for this +... +73 | Bar::X.method3(); + | ^^^^^^^ + | + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `method3`, perhaps you need to implement it: + candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:119:46 - | -119 | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); - | ^^^^^^^ - | - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `method3`, perhaps you need to implement it: - candidate #1: `no_method_suggested_traits::foo::PubPub` + --> $DIR/no-method-suggested-traits.rs:75:46 + | +75 | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); + | ^^^^^^^ + | + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `method3`, perhaps you need to implement it: + candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `usize` in the current scope - --> $DIR/no-method-suggested-traits.rs:125:13 - | -125 | 1_usize.method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:79:13 + | +79 | 1_usize.method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&usize>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:126:47 - | -126 | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:80:47 + | +80 | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:127:37 - | -127 | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:81:37 + | +81 | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:128:71 - | -128 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3(); - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:82:71 + | +82 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3(); + | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:130:40 - | -130 | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:84:40 + | +84 | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:131:74 - | -131 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3(); - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:85:74 + | +85 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3(); + | ^^^^^^^ error: aborting due to 24 previous errors diff --git a/src/test/ui/impl-trait/trait_type.rs b/src/test/ui/impl-trait/trait_type.rs index 3507dcfbe1..7eefa5c600 100644 --- a/src/test/ui/impl-trait/trait_type.rs +++ b/src/test/ui/impl-trait/trait_type.rs @@ -15,16 +15,20 @@ struct MyType4; impl std::fmt::Display for MyType { fn fmt(&self, x: &str) -> () { } + //~^ ERROR method `fmt` has an incompatible type } impl std::fmt::Display for MyType2 { fn fmt(&self) -> () { } + //~^ ERROR method `fmt` has 1 parameter } impl std::fmt::Display for MyType3 { fn fmt() -> () { } + //~^ ERROR method `fmt` has a `&self` declaration in the trait } impl std::fmt::Display for MyType4 {} +//~^ ERROR not all trait items fn main() {} diff --git a/src/test/ui/impl-trait/trait_type.stderr b/src/test/ui/impl-trait/trait_type.stderr index 9216c6e290..7a0d01a8ec 100644 --- a/src/test/ui/impl-trait/trait_type.stderr +++ b/src/test/ui/impl-trait/trait_type.stderr @@ -8,26 +8,26 @@ error[E0053]: method `fmt` has an incompatible type for trait found type `fn(&MyType, &str)` error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 - --> $DIR/trait_type.rs:21:11 + --> $DIR/trait_type.rs:22:11 | -21 | fn fmt(&self) -> () { } +22 | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl - --> $DIR/trait_type.rs:25:4 + --> $DIR/trait_type.rs:27:4 | -25 | fn fmt() -> () { } +27 | fn fmt() -> () { } | ^^^^^^^^^^^^^^^^^^ expected `&self` in impl | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0046]: not all trait items implemented, missing: `fmt` - --> $DIR/trait_type.rs:28:1 + --> $DIR/trait_type.rs:31:1 | -28 | impl std::fmt::Display for MyType4 {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation +31 | impl std::fmt::Display for MyType4 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` diff --git a/src/test/ui/impl-trait/universal-mismatched-type.rs b/src/test/ui/impl-trait/universal-mismatched-type.rs index af7adc4c65..00fc22ff0d 100644 --- a/src/test/ui/impl-trait/universal-mismatched-type.rs +++ b/src/test/ui/impl-trait/universal-mismatched-type.rs @@ -13,7 +13,7 @@ use std::fmt::Debug; fn foo(x: impl Debug) -> String { - x + x //~ ERROR mismatched types } fn main() { } diff --git a/src/test/ui/impl-trait/universal-mismatched-type.stderr b/src/test/ui/impl-trait/universal-mismatched-type.stderr index 2be2458449..b4dd6c8446 100644 --- a/src/test/ui/impl-trait/universal-mismatched-type.stderr +++ b/src/test/ui/impl-trait/universal-mismatched-type.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | 15 | fn foo(x: impl Debug) -> String { | ------ expected `std::string::String` because of return type -16 | x +16 | x //~ ERROR mismatched types | ^ expected struct `std::string::String`, found type parameter | = note: expected type `std::string::String` diff --git a/src/test/ui/impl-trait/universal-two-impl-traits.rs b/src/test/ui/impl-trait/universal-two-impl-traits.rs index f8855a7975..9a4847b560 100644 --- a/src/test/ui/impl-trait/universal-two-impl-traits.rs +++ b/src/test/ui/impl-trait/universal-two-impl-traits.rs @@ -14,7 +14,7 @@ use std::fmt::Debug; fn foo(x: impl Debug, y: impl Debug) -> String { let mut a = x; - a = y; + a = y; //~ ERROR mismatched format!("{:?}", a) } diff --git a/src/test/ui/impl-trait/universal-two-impl-traits.stderr b/src/test/ui/impl-trait/universal-two-impl-traits.stderr index c663d38ca8..9903e26bbb 100644 --- a/src/test/ui/impl-trait/universal-two-impl-traits.stderr +++ b/src/test/ui/impl-trait/universal-two-impl-traits.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/universal-two-impl-traits.rs:17:9 | -17 | a = y; +17 | a = y; //~ ERROR mismatched | ^ expected type parameter, found a different type parameter | = note: expected type `impl Debug` (type parameter) diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.rs b/src/test/ui/impl-trait/universal_wrong_bounds.rs index fd35d04b25..36d9f615c5 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.rs +++ b/src/test/ui/impl-trait/universal_wrong_bounds.rs @@ -15,11 +15,11 @@ use std::fmt::Display; fn foo(f: impl Display + Clone) -> String { wants_debug(f); wants_display(f); - wants_clone(f); + wants_clone(f); //~ ERROR cannot find } -fn wants_debug(g: impl Debug) { } -fn wants_display(g: impl Debug) { } +fn wants_debug(g: impl Debug) { } //~ ERROR cannot find +fn wants_display(g: impl Debug) { } //~ ERROR cannot find fn wants_cone(g: impl Clone) { } fn main() { diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.stderr b/src/test/ui/impl-trait/universal_wrong_bounds.stderr index 600064c71d..b457e025c2 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.stderr +++ b/src/test/ui/impl-trait/universal_wrong_bounds.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find function `wants_clone` in this scope --> $DIR/universal_wrong_bounds.rs:18:5 | -18 | wants_clone(f); +18 | wants_clone(f); //~ ERROR cannot find | ^^^^^^^^^^^ did you mean `wants_cone`? error[E0405]: cannot find trait `Debug` in this scope --> $DIR/universal_wrong_bounds.rs:21:24 | -21 | fn wants_debug(g: impl Debug) { } +21 | fn wants_debug(g: impl Debug) { } //~ ERROR cannot find | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -17,7 +17,7 @@ help: possible candidate is found in another module, you can import it into scop error[E0405]: cannot find trait `Debug` in this scope --> $DIR/universal_wrong_bounds.rs:22:26 | -22 | fn wants_display(g: impl Debug) { } +22 | fn wants_display(g: impl Debug) { } //~ ERROR cannot find | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs b/src/test/ui/impl-unused-rps-in-assoc-type.rs similarity index 92% rename from src/test/compile-fail/impl-unused-rps-in-assoc-type.rs rename to src/test/ui/impl-unused-rps-in-assoc-type.rs index d48433ee92..23401db21d 100644 --- a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs +++ b/src/test/ui/impl-unused-rps-in-assoc-type.rs @@ -19,7 +19,6 @@ trait Fun { struct Holder { x: String } impl<'a> Fun for Holder { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter type Output = &'a str; fn call<'b>(&'b self) -> &'b str { &self.x[..] diff --git a/src/test/ui/impl-unused-rps-in-assoc-type.stderr b/src/test/ui/impl-unused-rps-in-assoc-type.stderr new file mode 100644 index 0000000000..ec261ed63b --- /dev/null +++ b/src/test/ui/impl-unused-rps-in-assoc-type.stderr @@ -0,0 +1,8 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/impl-unused-rps-in-assoc-type.rs:21:6 + | +21 | impl<'a> Fun for Holder { //~ ERROR E0207 + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + diff --git a/src/test/compile-fail/imports/auxiliary/two_macros.rs b/src/test/ui/imports/auxiliary/two_macros.rs similarity index 100% rename from src/test/compile-fail/imports/auxiliary/two_macros.rs rename to src/test/ui/imports/auxiliary/two_macros.rs diff --git a/src/test/compile-fail/imports/duplicate.rs b/src/test/ui/imports/duplicate.rs similarity index 55% rename from src/test/compile-fail/imports/duplicate.rs rename to src/test/ui/imports/duplicate.rs index 4b2a64155e..dd2dcbe2e6 100644 --- a/src/test/compile-fail/imports/duplicate.rs +++ b/src/test/ui/imports/duplicate.rs @@ -21,10 +21,8 @@ mod c { } mod d { - use a::foo; //~ NOTE previous import of the value `foo` here + use a::foo; use a::foo; //~ ERROR the name `foo` is defined multiple times - //~| NOTE `foo` reimported here - //~| NOTE `foo` must be defined only once in the value namespace of this module } mod e { @@ -33,37 +31,31 @@ mod e { } mod f { - pub use a::*; //~ NOTE `foo` could refer to the name imported here - pub use b::*; //~ NOTE `foo` could also refer to the name imported here + pub use a::*; + pub use b::*; } mod g { - pub use a::*; //~ NOTE `foo` could refer to the name imported here - pub use f::*; //~ NOTE `foo` could also refer to the name imported here + pub use a::*; + pub use f::*; } fn main() { e::foo(); f::foo(); //~ ERROR `foo` is ambiguous - //~| NOTE consider adding an explicit import of `foo` to disambiguate g::foo(); //~ ERROR `foo` is ambiguous - //~| NOTE consider adding an explicit import of `foo` to disambiguate } mod ambiguous_module_errors { pub mod m1 { pub use super::m1 as foo; } pub mod m2 { pub use super::m2 as foo; } - use self::m1::*; //~ NOTE - //~| NOTE - use self::m2::*; //~ NOTE - //~| NOTE + use self::m1::*; + use self::m2::*; use self::foo::bar; //~ ERROR `foo` is ambiguous - //~| NOTE fn f() { foo::bar(); //~ ERROR `foo` is ambiguous - //~| NOTE } } diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr new file mode 100644 index 0000000000..30f2f51711 --- /dev/null +++ b/src/test/ui/imports/duplicate.stderr @@ -0,0 +1,88 @@ +error[E0252]: the name `foo` is defined multiple times + --> $DIR/duplicate.rs:25:9 + | +24 | use a::foo; + | ------ previous import of the value `foo` here +25 | use a::foo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^ `foo` reimported here + | + = note: `foo` must be defined only once in the value namespace of this module +help: You can use `as` to change the binding name of the import + | +25 | use a::foo as Otherfoo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^^^^^^^^^^^^^ + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:56:9 + | +56 | use self::foo::bar; //~ ERROR `foo` is ambiguous + | ^^^^^^^^^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:53:9 + | +53 | use self::m1::*; + | ^^^^^^^^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:54:9 + | +54 | use self::m2::*; + | ^^^^^^^^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:45:5 + | +45 | f::foo(); //~ ERROR `foo` is ambiguous + | ^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:34:13 + | +34 | pub use a::*; + | ^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:35:13 + | +35 | pub use b::*; + | ^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:46:5 + | +46 | g::foo(); //~ ERROR `foo` is ambiguous + | ^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:39:13 + | +39 | pub use a::*; + | ^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:40:13 + | +40 | pub use f::*; + | ^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:59:9 + | +59 | foo::bar(); //~ ERROR `foo` is ambiguous + | ^^^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:53:9 + | +53 | use self::m1::*; + | ^^^^^^^^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:54:9 + | +54 | use self::m2::*; + | ^^^^^^^^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: aborting due to 5 previous errors + diff --git a/src/test/compile-fail/imports/macro-paths.rs b/src/test/ui/imports/macro-paths.rs similarity index 59% rename from src/test/compile-fail/imports/macro-paths.rs rename to src/test/ui/imports/macro-paths.rs index 7c19917acc..88a6e1c0d9 100644 --- a/src/test/compile-fail/imports/macro-paths.rs +++ b/src/test/ui/imports/macro-paths.rs @@ -21,20 +21,18 @@ mod foo { } fn f() { - use foo::*; //~ NOTE could also refer to the name imported here + use foo::*; bar::m! { //~ ERROR ambiguous - //~| NOTE macro-expanded items do not shadow when used in a macro invocation path - mod bar { pub use two_macros::m; } //~ NOTE could refer to the name defined here + mod bar { pub use two_macros::m; } } } -pub mod baz { //~ NOTE could also refer to the name defined here +pub mod baz { pub use two_macros::m; } fn g() { baz::m! { //~ ERROR ambiguous - //~| NOTE macro-expanded items do not shadow when used in a macro invocation path - mod baz { pub use two_macros::m; } //~ NOTE could refer to the name defined here + mod baz { pub use two_macros::m; } } } diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr new file mode 100644 index 0000000000..91b0b9756d --- /dev/null +++ b/src/test/ui/imports/macro-paths.stderr @@ -0,0 +1,42 @@ +error: `bar` is ambiguous + --> $DIR/macro-paths.rs:25:5 + | +25 | bar::m! { //~ ERROR ambiguous + | ^^^^^^ + | +note: `bar` could refer to the name defined here + --> $DIR/macro-paths.rs:26:9 + | +26 | mod bar { pub use two_macros::m; } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `bar` could also refer to the name imported here + --> $DIR/macro-paths.rs:24:9 + | +24 | use foo::*; + | ^^^^^^ + = note: macro-expanded items do not shadow when used in a macro invocation path + +error: `baz` is ambiguous + --> $DIR/macro-paths.rs:35:5 + | +35 | baz::m! { //~ ERROR ambiguous + | ^^^^^^ + | +note: `baz` could refer to the name defined here + --> $DIR/macro-paths.rs:36:9 + | +36 | mod baz { pub use two_macros::m; } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `baz` could also refer to the name defined here + --> $DIR/macro-paths.rs:30:1 + | +30 | / pub mod baz { +31 | | pub use two_macros::m; +32 | | } + | |_^ + = note: macro-expanded items do not shadow when used in a macro invocation path + +error[E0601]: main function not found + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/imports/macros.rs b/src/test/ui/imports/macros.rs similarity index 65% rename from src/test/compile-fail/imports/macros.rs rename to src/test/ui/imports/macros.rs index 06b0964a3b..98577d73ee 100644 --- a/src/test/compile-fail/imports/macros.rs +++ b/src/test/ui/imports/macros.rs @@ -24,15 +24,14 @@ mod m1 { } mod m2 { - use two_macros::*; //~ NOTE could also refer + use two_macros::*; m! { //~ ERROR ambiguous - //~| NOTE macro-expanded macro imports do not shadow - use foo::m; //~ NOTE could refer to the name imported here + use foo::m; } } mod m3 { - use two_macros::m; //~ NOTE could also refer + use two_macros::m; fn f() { use two_macros::n as m; // This shadows the above import m!(); @@ -40,14 +39,13 @@ mod m3 { fn g() { m! { //~ ERROR ambiguous - //~| NOTE macro-expanded macro imports do not shadow - use two_macros::n as m; //~ NOTE could refer to the name imported here + use two_macros::n as m; } } } mod m4 { - macro_rules! m { () => {} } //~ NOTE could refer to the macro defined here - use two_macros::m; //~ NOTE could also refer to the macro imported here + macro_rules! m { () => {} } + use two_macros::m; m!(); //~ ERROR ambiguous } diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr new file mode 100644 index 0000000000..0b67613eb1 --- /dev/null +++ b/src/test/ui/imports/macros.stderr @@ -0,0 +1,57 @@ +error: `m` is ambiguous + --> $DIR/macros.rs:50:5 + | +50 | m!(); //~ ERROR ambiguous + | ^ + | +note: `m` could refer to the macro defined here + --> $DIR/macros.rs:48:5 + | +48 | macro_rules! m { () => {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `m` could also refer to the macro imported here + --> $DIR/macros.rs:49:9 + | +49 | use two_macros::m; + | ^^^^^^^^^^^^^ + +error: `m` is ambiguous + --> $DIR/macros.rs:28:5 + | +28 | m! { //~ ERROR ambiguous + | ^ + | +note: `m` could refer to the name imported here + --> $DIR/macros.rs:29:13 + | +29 | use foo::m; + | ^^^^^^ +note: `m` could also refer to the name imported here + --> $DIR/macros.rs:27:9 + | +27 | use two_macros::*; + | ^^^^^^^^^^^^^ + = note: macro-expanded macro imports do not shadow + +error: `m` is ambiguous + --> $DIR/macros.rs:41:9 + | +41 | m! { //~ ERROR ambiguous + | ^ + | +note: `m` could refer to the name imported here + --> $DIR/macros.rs:42:17 + | +42 | use two_macros::n as m; + | ^^^^^^^^^^^^^^^^^^ +note: `m` could also refer to the name imported here + --> $DIR/macros.rs:34:9 + | +34 | use two_macros::m; + | ^^^^^^^^^^^^^ + = note: macro-expanded macro imports do not shadow + +error[E0601]: main function not found + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs b/src/test/ui/imports/rfc-1560-warning-cycle.rs similarity index 74% rename from src/test/compile-fail/imports/rfc-1560-warning-cycle.rs rename to src/test/ui/imports/rfc-1560-warning-cycle.rs index 95bdf5e9b1..f94fc3633e 100644 --- a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs +++ b/src/test/ui/imports/rfc-1560-warning-cycle.rs @@ -16,13 +16,11 @@ mod bar { struct Foo; mod baz { - use *; //~ NOTE `Foo` could refer to the name imported here - use bar::*; //~ NOTE `Foo` could also refer to the name imported here + use *; + use bar::*; fn f(_: Foo) {} //~^ ERROR `Foo` is ambiguous //~| WARN hard error in a future release - //~| NOTE see issue #38260 - //~| NOTE #[deny(legacy_imports)] on by default } } diff --git a/src/test/ui/imports/rfc-1560-warning-cycle.stderr b/src/test/ui/imports/rfc-1560-warning-cycle.stderr new file mode 100644 index 0000000000..1fec731127 --- /dev/null +++ b/src/test/ui/imports/rfc-1560-warning-cycle.stderr @@ -0,0 +1,16 @@ +error: `Foo` is ambiguous + --> $DIR/rfc-1560-warning-cycle.rs:21:17 + | +19 | use *; + | - `Foo` could refer to the name imported here +20 | use bar::*; + | ------ `Foo` could also refer to the name imported here +21 | fn f(_: Foo) {} + | ^^^ + | + = note: #[deny(legacy_imports)] on by default + = 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 #38260 <https://github.com/rust-lang/rust/issues/38260> + +error: aborting due to previous error + diff --git a/src/test/compile-fail/imports/shadow_builtin_macros.rs b/src/test/ui/imports/shadow_builtin_macros.rs similarity index 60% rename from src/test/compile-fail/imports/shadow_builtin_macros.rs rename to src/test/ui/imports/shadow_builtin_macros.rs index a7f1cf3c9d..93de136c40 100644 --- a/src/test/compile-fail/imports/shadow_builtin_macros.rs +++ b/src/test/ui/imports/shadow_builtin_macros.rs @@ -23,17 +23,13 @@ mod m1 { } mod m2 { - use foo::*; //~ NOTE `panic` could refer to the name imported here + use foo::*; fn f() { panic!(); } //~ ERROR ambiguous - //~| NOTE `panic` is also a builtin macro - //~| NOTE consider adding an explicit import of `panic` to disambiguate } mod m3 { - ::two_macros::m!(use foo::panic;); //~ NOTE `panic` could refer to the name imported here + ::two_macros::m!(use foo::panic;); fn f() { panic!(); } //~ ERROR ambiguous - //~| NOTE `panic` is also a builtin macro - //~| NOTE macro-expanded macro imports do not shadow } mod m4 { @@ -44,14 +40,12 @@ mod m4 { mod m5 { macro_rules! m { () => { macro_rules! panic { () => {} } //~ ERROR `panic` is already in scope - //~| NOTE macro-expanded `macro_rules!`s may not shadow existing macros } } - m!(); //~ NOTE in this expansion - //~| NOTE in this expansion + m!(); panic!(); } -#[macro_use(n)] //~ NOTE `n` could also refer to the name imported here +#[macro_use(n)] extern crate two_macros; mod bar { pub use two_macros::m as n; @@ -63,9 +57,8 @@ mod m6 { } mod m7 { - use bar::*; //~ NOTE `n` could refer to the name imported here + use bar::*; n!(); //~ ERROR ambiguous - //~| NOTE consider adding an explicit import of `n` to disambiguate } fn main() {} diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr new file mode 100644 index 0000000000..853ed98c30 --- /dev/null +++ b/src/test/ui/imports/shadow_builtin_macros.stderr @@ -0,0 +1,59 @@ +error: `panic` is already in scope + --> $DIR/shadow_builtin_macros.rs:42:9 + | +42 | macro_rules! panic { () => {} } //~ ERROR `panic` is already in scope + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +43 | } } +44 | m!(); + | ----- in this macro invocation + | + = note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560) + +error: `panic` is ambiguous + --> $DIR/shadow_builtin_macros.rs:27:14 + | +27 | fn f() { panic!(); } //~ ERROR ambiguous + | ^^^^^ + | +note: `panic` could refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:26:9 + | +26 | use foo::*; + | ^^^^^^ + = note: `panic` is also a builtin macro + = note: consider adding an explicit import of `panic` to disambiguate + +error: `panic` is ambiguous + --> $DIR/shadow_builtin_macros.rs:32:14 + | +32 | fn f() { panic!(); } //~ ERROR ambiguous + | ^^^^^ + | +note: `panic` could refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:31:26 + | +31 | ::two_macros::m!(use foo::panic;); + | ^^^^^^^^^^ + = note: `panic` is also a builtin macro + = note: macro-expanded macro imports do not shadow + +error: `n` is ambiguous + --> $DIR/shadow_builtin_macros.rs:61:5 + | +61 | n!(); //~ ERROR ambiguous + | ^ + | +note: `n` could refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:60:9 + | +60 | use bar::*; + | ^^^^^^ +note: `n` could also refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:48:13 + | +48 | #[macro_use(n)] + | ^ + = note: consider adding an explicit import of `n` to disambiguate + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/impossible_range.rs b/src/test/ui/impossible_range.rs similarity index 98% rename from src/test/compile-fail/impossible_range.rs rename to src/test/ui/impossible_range.rs index e4465e9f6b..5c72c506e6 100644 --- a/src/test/compile-fail/impossible_range.rs +++ b/src/test/ui/impossible_range.rs @@ -17,13 +17,13 @@ pub fn main() { 0..; ..1; 0..1; - ..=; //~ERROR inclusive range with no end //~^HELP bounded at the end - 0..=; //~ERROR inclusive range with no end - //~^HELP bounded at the end - ..=1; - 0..=1; } - +fn _foo1() { + ..=1; + 0..=1; + 0..=; //~ERROR inclusive range with no end + //~^HELP bounded at the end +} diff --git a/src/test/ui/impossible_range.stderr b/src/test/ui/impossible_range.stderr new file mode 100644 index 0000000000..e0e26bc4db --- /dev/null +++ b/src/test/ui/impossible_range.stderr @@ -0,0 +1,18 @@ +error[E0586]: inclusive range with no end + --> $DIR/impossible_range.rs:20:8 + | +20 | ..=; //~ERROR inclusive range with no end + | ^ + | + = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) + +error[E0586]: inclusive range with no end + --> $DIR/impossible_range.rs:27:9 + | +27 | 0..=; //~ERROR inclusive range with no end + | ^ + | + = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/E0687.rs b/src/test/ui/in-band-lifetimes/E0687.rs new file mode 100644 index 0000000000..4eddebb15e --- /dev/null +++ b/src/test/ui/in-band-lifetimes/E0687.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly + +fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly + +fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly + +struct Foo<'a> { x: &'a u32 } + +impl Foo<'a> { + fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/E0687.stderr b/src/test/ui/in-band-lifetimes/E0687.stderr new file mode 100644 index 0000000000..42714f2168 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/E0687.stderr @@ -0,0 +1,26 @@ +error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders + --> $DIR/E0687.rs:14:15 + | +14 | fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly + | ^^ in-band lifetime definition + +error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders + --> $DIR/E0687.rs:16:16 + | +16 | fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly + | ^^ in-band lifetime definition + +error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders + --> $DIR/E0687.rs:18:15 + | +18 | fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly + | ^^ in-band lifetime definition + +error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders + --> $DIR/E0687.rs:23:26 + | +23 | fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly + | ^^ in-band lifetime definition + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/in-band-lifetimes/E0687_where.rs b/src/test/ui/in-band-lifetimes/E0687_where.rs new file mode 100644 index 0000000000..ac67558772 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/E0687_where.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes, universal_impl_trait)] + +fn bar<F>(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly + +fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/E0687_where.stderr b/src/test/ui/in-band-lifetimes/E0687_where.stderr new file mode 100644 index 0000000000..a9913f6b64 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/E0687_where.stderr @@ -0,0 +1,14 @@ +error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders + --> $DIR/E0687_where.rs:14:31 + | +14 | fn bar<F>(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly + | ^^ in-band lifetime definition + +error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders + --> $DIR/E0687_where.rs:16:21 + | +16 | fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly + | ^^ in-band lifetime definition + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/E0688.rs b/src/test/ui/in-band-lifetimes/E0688.rs new file mode 100644 index 0000000000..29b954e9a8 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/E0688.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix + +struct Foo<'a> { x: &'a u32 } + +impl Foo<'a> { + fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix +} + +impl<'b> Foo<'a> { //~ ERROR cannot mix + fn baz() {} +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/E0688.stderr b/src/test/ui/in-band-lifetimes/E0688.stderr new file mode 100644 index 0000000000..c33b088f0f --- /dev/null +++ b/src/test/ui/in-band-lifetimes/E0688.stderr @@ -0,0 +1,26 @@ +error[E0688]: cannot mix in-band and explicit lifetime definitions + --> $DIR/E0688.rs:14:28 + | +14 | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix + | -- ^^ in-band lifetime definition here + | | + | explicit lifetime definition here + +error[E0688]: cannot mix in-band and explicit lifetime definitions + --> $DIR/E0688.rs:19:44 + | +19 | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix + | -- ^^ in-band lifetime definition here + | | + | explicit lifetime definition here + +error[E0688]: cannot mix in-band and explicit lifetime definitions + --> $DIR/E0688.rs:22:14 + | +22 | impl<'b> Foo<'a> { //~ ERROR cannot mix + | -- ^^ in-band lifetime definition here + | | + | explicit lifetime definition here + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/in-band-lifetimes/mismatched.rs b/src/test/ui/in-band-lifetimes/mismatched.rs new file mode 100644 index 0000000000..80bc56c0f4 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required + +fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched.stderr b/src/test/ui/in-band-lifetimes/mismatched.stderr new file mode 100644 index 0000000000..0c1231e01d --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched.stderr @@ -0,0 +1,18 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $DIR/mismatched.rs:14:42 + | +14 | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required + | - ^ lifetime `'a` required + | | + | consider changing the type of `y` to `&'a u32` + +error[E0623]: lifetime mismatch + --> $DIR/mismatched.rs:16:46 + | +16 | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch + | ------- ------- ^ ...but data from `y` is returned here + | | + | this parameter and the return type are declared with different lifetimes... + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.rs b/src/test/ui/in-band-lifetimes/mismatched_trait.rs new file mode 100644 index 0000000000..bc175803eb --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +trait Get { + fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { + y //~ ERROR explicit lifetime required + } +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr new file mode 100644 index 0000000000..58ff1694fb --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr @@ -0,0 +1,10 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $DIR/mismatched_trait.rs:16:9 + | +15 | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { + | - consider changing the type of `y` to `&'a u32` +16 | y //~ ERROR explicit lifetime required + | ^ lifetime `'a` required + +error: aborting due to previous error + diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs new file mode 100644 index 0000000000..52641059b1 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +trait Get { + fn foo(&self, x: &'a u32, y: &u32) -> &'a u32; +} + +impl Get for i32 { + fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer + x + } +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr new file mode 100644 index 0000000000..e96f7181a6 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr @@ -0,0 +1,39 @@ +error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements + --> $DIR/mismatched_trait_impl.rs:19:5 + | +19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +20 | | x +21 | | } + | |_____^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 19:5... + --> $DIR/mismatched_trait_impl.rs:19:5 + | +19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +20 | | x +21 | | } + | |_____^ +note: ...so that method type is compatible with trait (expected fn(&i32, &'a u32, &u32) -> &'a u32, found fn(&i32, &u32, &u32) -> &u32) + --> $DIR/mismatched_trait_impl.rs:19:5 + | +19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +20 | | x +21 | | } + | |_____^ +note: but, the lifetime must be valid for the lifetime 'a as defined on the method body at 19:5... + --> $DIR/mismatched_trait_impl.rs:19:5 + | +19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +20 | | x +21 | | } + | |_____^ +note: ...so that method type is compatible with trait (expected fn(&i32, &'a u32, &u32) -> &'a u32, found fn(&i32, &u32, &u32) -> &u32) + --> $DIR/mismatched_trait_impl.rs:19:5 + | +19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +20 | | x +21 | | } + | |_____^ + +error: aborting due to previous error + diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.rs b/src/test/ui/in-band-lifetimes/mut_while_borrow.rs new file mode 100644 index 0000000000..08ce13d0bc --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +fn foo(x: &'a u32) -> &'a u32 { x } + +fn main() { + let mut p = 3; + let r = foo(&p); + p += 1; //~ ERROR cannot assign to `p` because it is borrowed + println!("{}", r); +} diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr new file mode 100644 index 0000000000..14f9098c6c --- /dev/null +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr @@ -0,0 +1,10 @@ +error[E0506]: cannot assign to `p` because it is borrowed + --> $DIR/mut_while_borrow.rs:19:5 + | +18 | let r = foo(&p); + | - borrow of `p` occurs here +19 | p += 1; //~ ERROR cannot assign to `p` because it is borrowed + | ^^^^^^ assignment to borrowed `p` occurs here + +error: aborting due to previous error + diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs new file mode 100644 index 0000000000..0d3e6ba644 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +struct Foo { + x: &'test u32, //~ ERROR undeclared lifetime +} + +enum Bar { + Baz(&'test u32), //~ ERROR undeclared lifetime +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr new file mode 100644 index 0000000000..a8df6dbca0 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr @@ -0,0 +1,14 @@ +error[E0261]: use of undeclared lifetime name `'test` + --> $DIR/no_in_band_in_struct.rs:15:9 + | +15 | x: &'test u32, //~ ERROR undeclared lifetime + | ^^^^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'test` + --> $DIR/no_in_band_in_struct.rs:19:10 + | +19 | Baz(&'test u32), //~ ERROR undeclared lifetime + | ^^^^^ undeclared lifetime + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs new file mode 100644 index 0000000000..eaa082a35d --- /dev/null +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +fn foo(x: &u32) { + let y: &'test u32 = x; //~ ERROR use of undeclared lifetime +} + +fn foo2(x: &u32) {} +fn bar() { + let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr new file mode 100644 index 0000000000..e2340dbba2 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr @@ -0,0 +1,14 @@ +error[E0261]: use of undeclared lifetime name `'test` + --> $DIR/no_introducing_in_band_in_locals.rs:15:13 + | +15 | let y: &'test u32 = x; //~ ERROR use of undeclared lifetime + | ^^^^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'test` + --> $DIR/no_introducing_in_band_in_locals.rs:20:16 + | +20 | let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime + | ^^^^^ undeclared lifetime + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/shadow.rs b/src/test/ui/in-band-lifetimes/shadow.rs new file mode 100644 index 0000000000..b6438f01af --- /dev/null +++ b/src/test/ui/in-band-lifetimes/shadow.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] +#![feature(in_band_lifetimes)] + +struct Foo<T>(T); + +impl Foo<&'s u8> { + fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name + fn baz(x: for<'s> fn(&'s u32)) {} //~ ERROR shadows a lifetime name +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/shadow.stderr b/src/test/ui/in-band-lifetimes/shadow.stderr new file mode 100644 index 0000000000..49b82fa495 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/shadow.stderr @@ -0,0 +1,19 @@ +error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope + --> $DIR/shadow.rs:17:12 + | +16 | impl Foo<&'s u8> { + | -- first declared here +17 | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name + | ^^ lifetime 's already in scope + +error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope + --> $DIR/shadow.rs:18:19 + | +16 | impl Foo<&'s u8> { + | -- first declared here +17 | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name +18 | fn baz(x: for<'s> fn(&'s u32)) {} //~ ERROR shadows a lifetime name + | ^^ lifetime 's already in scope + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-2.rs b/src/test/ui/in-band-lifetimes/single_use_lifetimes-2.rs new file mode 100644 index 0000000000..005f1f033b --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-2.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![deny(single_use_lifetime)] +// FIXME(#44752) -- this scenario should not be warned +fn deref<'x>() -> &'x u32 { //~ ERROR lifetime name `'x` only used once + 22 +} + +fn main() { } diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-2.stderr b/src/test/ui/in-band-lifetimes/single_use_lifetimes-2.stderr new file mode 100644 index 0000000000..a90add79b7 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-2.stderr @@ -0,0 +1,14 @@ +error: lifetime name `'x` only used once + --> $DIR/single_use_lifetimes-2.rs:12:10 + | +12 | fn deref<'x>() -> &'x u32 { //~ ERROR lifetime name `'x` only used once + | ^^ + | +note: lint level defined here + --> $DIR/single_use_lifetimes-2.rs:10:9 + | +10 | #![deny(single_use_lifetime)] + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-3.rs b/src/test/ui/in-band-lifetimes/single_use_lifetimes-3.rs new file mode 100644 index 0000000000..263548ca7f --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-3.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![deny(single_use_lifetime)] +struct Foo<'x> { //~ ERROR lifetime name `'x` only used once + x: &'x u32 // no warning! +} + +// Once #44524 is fixed, this should issue a warning. +impl<'y> Foo<'y> { //~ ERROR lifetime name `'y` only used once + fn method() { } +} + +fn main() { } diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-3.stderr b/src/test/ui/in-band-lifetimes/single_use_lifetimes-3.stderr new file mode 100644 index 0000000000..8595ce5eff --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-3.stderr @@ -0,0 +1,20 @@ +error: lifetime name `'x` only used once + --> $DIR/single_use_lifetimes-3.rs:11:12 + | +11 | struct Foo<'x> { //~ ERROR lifetime name `'x` only used once + | ^^ + | +note: lint level defined here + --> $DIR/single_use_lifetimes-3.rs:10:9 + | +10 | #![deny(single_use_lifetime)] + | ^^^^^^^^^^^^^^^^^^^ + +error: lifetime name `'y` only used once + --> $DIR/single_use_lifetimes-3.rs:16:6 + | +16 | impl<'y> Foo<'y> { //~ ERROR lifetime name `'y` only used once + | ^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-4.rs b/src/test/ui/in-band-lifetimes/single_use_lifetimes-4.rs new file mode 100644 index 0000000000..4ac8f8c0d4 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-4.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![deny(single_use_lifetime)] + // Neither should issue a warning, as explicit lifetimes are mandatory in this case +struct Foo<'x> { //~ ERROR lifetime name `'x` only used once + x: &'x u32 +} + +enum Bar<'x> { //~ ERROR lifetime name `'x` only used once + Variant(&'x u32) +} + +fn main() { } diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-4.stderr b/src/test/ui/in-band-lifetimes/single_use_lifetimes-4.stderr new file mode 100644 index 0000000000..1b952c8db0 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-4.stderr @@ -0,0 +1,20 @@ +error: lifetime name `'x` only used once + --> $DIR/single_use_lifetimes-4.rs:12:12 + | +12 | struct Foo<'x> { //~ ERROR lifetime name `'x` only used once + | ^^ + | +note: lint level defined here + --> $DIR/single_use_lifetimes-4.rs:10:9 + | +10 | #![deny(single_use_lifetime)] + | ^^^^^^^^^^^^^^^^^^^ + +error: lifetime name `'x` only used once + --> $DIR/single_use_lifetimes-4.rs:16:10 + | +16 | enum Bar<'x> { //~ ERROR lifetime name `'x` only used once + | ^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-5.rs b/src/test/ui/in-band-lifetimes/single_use_lifetimes-5.rs new file mode 100644 index 0000000000..cef904c489 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-5.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![deny(single_use_lifetime)] +// Should not issue a warning, as explicit lifetimes are mandatory in this case: +trait Foo<'x> { //~ ERROR lifetime name `'x` only used once + fn foo(&self, arg: &'x u32); +} + +fn main() { } diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes-5.stderr b/src/test/ui/in-band-lifetimes/single_use_lifetimes-5.stderr new file mode 100644 index 0000000000..59e1254836 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes-5.stderr @@ -0,0 +1,14 @@ +error: lifetime name `'x` only used once + --> $DIR/single_use_lifetimes-5.rs:12:11 + | +12 | trait Foo<'x> { //~ ERROR lifetime name `'x` only used once + | ^^ + | +note: lint level defined here + --> $DIR/single_use_lifetimes-5.rs:10:9 + | +10 | #![deny(single_use_lifetime)] + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes.rs b/src/test/ui/in-band-lifetimes/single_use_lifetimes.rs new file mode 100644 index 0000000000..a97056b624 --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![deny(single_use_lifetime)] + +fn deref<'x>(v: &'x u32) -> u32 { //~ ERROR lifetime name `'x` only used once + *v +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/single_use_lifetimes.stderr b/src/test/ui/in-band-lifetimes/single_use_lifetimes.stderr new file mode 100644 index 0000000000..bdcce1f22e --- /dev/null +++ b/src/test/ui/in-band-lifetimes/single_use_lifetimes.stderr @@ -0,0 +1,14 @@ +error: lifetime name `'x` only used once + --> $DIR/single_use_lifetimes.rs:12:10 + | +12 | fn deref<'x>(v: &'x u32) -> u32 { //~ ERROR lifetime name `'x` only used once + | ^^ + | +note: lint level defined here + --> $DIR/single_use_lifetimes.rs:10:9 + | +10 | #![deny(single_use_lifetime)] + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/index-help.rs b/src/test/ui/index-help.rs similarity index 87% rename from src/test/compile-fail/index-help.rs rename to src/test/ui/index-help.rs index 2d37fc7925..4a64d6c4cc 100644 --- a/src/test/compile-fail/index-help.rs +++ b/src/test/ui/index-help.rs @@ -11,5 +11,4 @@ fn main() { let x = vec![1]; x[0i32]; //~ ERROR E0277 - //~| NOTE vector indices are of type `usize` or ranges of `usize` } diff --git a/src/test/ui/index-help.stderr b/src/test/ui/index-help.stderr new file mode 100644 index 0000000000..e1652b6c26 --- /dev/null +++ b/src/test/ui/index-help.stderr @@ -0,0 +1,10 @@ +error[E0277]: the trait bound `std::vec::Vec<{integer}>: std::ops::Index<i32>` is not satisfied + --> $DIR/index-help.rs:13:5 + | +13 | x[0i32]; //~ ERROR E0277 + | ^^^^^^^ vector indices are of type `usize` or ranges of `usize` + | + = help: the trait `std::ops::Index<i32>` is not implemented for `std::vec::Vec<{integer}>` + +error: aborting due to previous error + diff --git a/src/test/ui/inference-variable-behind-raw-pointer.rs b/src/test/ui/inference-variable-behind-raw-pointer.rs new file mode 100644 index 0000000000..0ae027679f --- /dev/null +++ b/src/test/ui/inference-variable-behind-raw-pointer.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// must-compile-successfully + +// tests that the following code compiles, but produces a future-compatibility warning + +fn main() { + let data = std::ptr::null(); + let _ = &data as *const *const (); + if data.is_null() {} +} diff --git a/src/test/ui/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference-variable-behind-raw-pointer.stderr new file mode 100644 index 0000000000..d0ee55c092 --- /dev/null +++ b/src/test/ui/inference-variable-behind-raw-pointer.stderr @@ -0,0 +1,10 @@ +warning: the type of this value must be known in this context + --> $DIR/inference-variable-behind-raw-pointer.rs:18:13 + | +18 | if data.is_null() {} + | ^^^^^^^ + | + = note: #[warn(tyvar_behind_raw_pointer)] on by default + = 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 #46906 <https://github.com/rust-lang/rust/issues/46906> + diff --git a/src/test/ui/interior-mutability/interior-mutability.rs b/src/test/ui/interior-mutability/interior-mutability.rs index 60d85d1b3b..a772d1f90c 100644 --- a/src/test/ui/interior-mutability/interior-mutability.rs +++ b/src/test/ui/interior-mutability/interior-mutability.rs @@ -12,5 +12,5 @@ use std::cell::Cell; use std::panic::catch_unwind; fn main() { let mut x = Cell::new(22); - catch_unwind(|| { x.set(23); }); + catch_unwind(|| { x.set(23); }); //~ ERROR the trait bound } diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index 76362f1f49..f4beb44b82 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `std::cell::UnsafeCell<i32>: std::panic::RefUnwindSafe` is not satisfied in `std::cell::Cell<i32>` --> $DIR/interior-mutability.rs:15:5 | -15 | catch_unwind(|| { x.set(23); }); +15 | catch_unwind(|| { x.set(23); }); //~ ERROR the trait bound | ^^^^^^^^^^^^ the type std::cell::UnsafeCell<i32> may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `std::cell::Cell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<i32>` diff --git a/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs index c15cfb8cc8..18ca5d0979 100644 --- a/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs +++ b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs @@ -9,6 +9,7 @@ // except according to those terms. // ignore-tidy-linelength +// ignore-windows // error-pattern: cannot declare a new module at this location // error-pattern: maybe move this module diff --git a/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr b/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr index 3e9b21cdb7..58df416030 100644 --- a/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr +++ b/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr @@ -1,14 +1,10 @@ -error: cannot declare a new module at this location +error[E0583]: file not found for module `baz` --> $DIR/auxiliary/foo/bar.rs:11:9 | 11 | pub mod baz; | ^^^ | -note: maybe move this module `$DIR/auxiliary/foo/bar.rs` to its own directory via `$DIR/auxiliary/foo/bar/mod.rs` - --> $DIR/auxiliary/foo/bar.rs:11:9 - | -11 | pub mod baz; - | ^^^ + = help: name the file either bar/baz.rs or bar/baz/mod.rs inside the directory "$DIR/auxiliary/foo" error: aborting due to previous error diff --git a/src/test/compile-fail/invalid-path-in-const.rs b/src/test/ui/invalid-path-in-const.rs similarity index 100% rename from src/test/compile-fail/invalid-path-in-const.rs rename to src/test/ui/invalid-path-in-const.rs diff --git a/src/test/ui/invalid-path-in-const.stderr b/src/test/ui/invalid-path-in-const.stderr new file mode 100644 index 0000000000..be1de60bca --- /dev/null +++ b/src/test/ui/invalid-path-in-const.stderr @@ -0,0 +1,8 @@ +error[E0599]: no associated item named `DOESNOTEXIST` found for type `u32` in the current scope + --> $DIR/invalid-path-in-const.rs:12:18 + | +12 | fn f(a: [u8; u32::DOESNOTEXIST]) {} + | ^^^^^^^^^^^^^^^^^ associated item not found in `u32` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-10969.rs b/src/test/ui/issue-10969.rs similarity index 88% rename from src/test/compile-fail/issue-10969.rs rename to src/test/ui/issue-10969.rs index 0851020b1f..4ab4a8b579 100644 --- a/src/test/compile-fail/issue-10969.rs +++ b/src/test/ui/issue-10969.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn func(i: i32) { //~NOTE defined here +fn func(i: i32) { i(); //~ERROR expected function, found `i32` } fn main() { - let i = 0i32; //~NOTE defined here + let i = 0i32; i(); //~ERROR expected function, found `i32` } diff --git a/src/test/ui/issue-10969.stderr b/src/test/ui/issue-10969.stderr new file mode 100644 index 0000000000..8aea63e0bb --- /dev/null +++ b/src/test/ui/issue-10969.stderr @@ -0,0 +1,26 @@ +error[E0618]: expected function, found `i32` + --> $DIR/issue-10969.rs:12:5 + | +12 | i(); //~ERROR expected function, found `i32` + | ^^^ + | +note: defined here + --> $DIR/issue-10969.rs:11:9 + | +11 | fn func(i: i32) { + | ^ + +error[E0618]: expected function, found `i32` + --> $DIR/issue-10969.rs:16:5 + | +16 | i(); //~ERROR expected function, found `i32` + | ^^^ + | +note: defined here + --> $DIR/issue-10969.rs:15:9 + | +15 | let i = 0i32; + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-11004.rs b/src/test/ui/issue-11004.rs similarity index 83% rename from src/test/compile-fail/issue-11004.rs rename to src/test/ui/issue-11004.rs index 0698834242..503fa64751 100644 --- a/src/test/compile-fail/issue-11004.rs +++ b/src/test/ui/issue-11004.rs @@ -15,9 +15,7 @@ struct A { x: i32, y: f64 } #[cfg(not(works))] unsafe fn access(n:*mut A) -> (i32, f64) { let x : i32 = n.x; //~ no field `x` on type `*mut A` - //~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).x` let y : f64 = n.y; //~ no field `y` on type `*mut A` - //~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).y` (x, y) } diff --git a/src/test/ui/issue-11004.stderr b/src/test/ui/issue-11004.stderr new file mode 100644 index 0000000000..9b8c3df7d5 --- /dev/null +++ b/src/test/ui/issue-11004.stderr @@ -0,0 +1,18 @@ +error[E0609]: no field `x` on type `*mut A` + --> $DIR/issue-11004.rs:17:21 + | +17 | let x : i32 = n.x; //~ no field `x` on type `*mut A` + | ^ + | + = note: `n` is a native pointer; perhaps you need to deref with `(*n).x` + +error[E0609]: no field `y` on type `*mut A` + --> $DIR/issue-11004.rs:18:21 + | +18 | let y : f64 = n.y; //~ no field `y` on type `*mut A` + | ^ + | + = note: `n` is a native pointer; perhaps you need to deref with `(*n).y` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-11319.rs b/src/test/ui/issue-11319.rs similarity index 91% rename from src/test/compile-fail/issue-11319.rs rename to src/test/ui/issue-11319.rs index 8242fa1c2e..20636ed1ea 100644 --- a/src/test/compile-fail/issue-11319.rs +++ b/src/test/ui/issue-11319.rs @@ -16,7 +16,7 @@ fn main() { //~| expected bool, found () Some(5) => false, Some(2) => true, - None => (), //~ NOTE match arm with an incompatible type + None => (), _ => true } } diff --git a/src/test/ui/issue-11319.stderr b/src/test/ui/issue-11319.stderr new file mode 100644 index 0000000000..20103d389f --- /dev/null +++ b/src/test/ui/issue-11319.stderr @@ -0,0 +1,19 @@ +error[E0308]: match arms have incompatible types + --> $DIR/issue-11319.rs:12:5 + | +12 | / match Some(10) { +13 | | //~^ ERROR match arms have incompatible types +14 | | //~| expected type `bool` +15 | | //~| found type `()` +... | +19 | | None => (), + | | -- match arm with an incompatible type +20 | | _ => true +21 | | } + | |_____^ expected bool, found () + | + = note: expected type `bool` + found type `()` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-12187-1.rs b/src/test/ui/issue-12187-1.rs similarity index 87% rename from src/test/compile-fail/issue-12187-1.rs rename to src/test/ui/issue-12187-1.rs index a79021d3cd..c429b73bc9 100644 --- a/src/test/compile-fail/issue-12187-1.rs +++ b/src/test/ui/issue-12187-1.rs @@ -15,6 +15,4 @@ fn new<T>() -> &'static T { fn main() { let &v = new(); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `_` - //~| NOTE consider giving the pattern a type } diff --git a/src/test/ui/issue-12187-1.stderr b/src/test/ui/issue-12187-1.stderr new file mode 100644 index 0000000000..e36c278df6 --- /dev/null +++ b/src/test/ui/issue-12187-1.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-12187-1.rs:16:10 + | +16 | let &v = new(); + | -^ + | || + | |cannot infer type for `_` + | consider giving the pattern a type + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-12187-2.rs b/src/test/ui/issue-12187-2.rs similarity index 87% rename from src/test/compile-fail/issue-12187-2.rs rename to src/test/ui/issue-12187-2.rs index 38b3c5d4e9..733f597e7a 100644 --- a/src/test/compile-fail/issue-12187-2.rs +++ b/src/test/ui/issue-12187-2.rs @@ -15,6 +15,4 @@ fn new<'r, T>() -> &'r T { fn main() { let &v = new(); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `_` - //~| NOTE consider giving the pattern a type } diff --git a/src/test/ui/issue-12187-2.stderr b/src/test/ui/issue-12187-2.stderr new file mode 100644 index 0000000000..b72c23987e --- /dev/null +++ b/src/test/ui/issue-12187-2.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-12187-2.rs:16:10 + | +16 | let &v = new(); + | -^ + | || + | |cannot infer type for `_` + | consider giving the pattern a type + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/compile-fail/div-by-zero-2.rs b/src/test/ui/issue-12511.rs similarity index 76% rename from src/tools/miri/tests/compile-fail/div-by-zero-2.rs rename to src/test/ui/issue-12511.rs index 3e869ad4a5..e1335c7d55 100644 --- a/src/tools/miri/tests/compile-fail/div-by-zero-2.rs +++ b/src/test/ui/issue-12511.rs @@ -8,8 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(const_err)] - -fn main() { - let _n = 1 / 0; //~ ERROR: DivisionByZero +trait t1 : t2 { } + +trait t2 : t1 { +//~^ ERROR unsupported cyclic reference between types/traits detected +//~| cyclic reference +} + +fn main() { } diff --git a/src/test/ui/issue-12511.stderr b/src/test/ui/issue-12511.stderr new file mode 100644 index 0000000000..cbf005a70b --- /dev/null +++ b/src/test/ui/issue-12511.stderr @@ -0,0 +1,20 @@ +error[E0391]: unsupported cyclic reference between types/traits detected + --> $DIR/issue-12511.rs:14:1 + | +14 | trait t2 : t1 { + | ^^^^^^^^^^^^^ cyclic reference + | +note: the cycle begins when computing the supertraits of `t1`... + --> $DIR/issue-12511.rs:11:1 + | +11 | trait t1 : t2 { + | ^^^^^^^^^^^^^ +note: ...which then requires computing the supertraits of `t2`... + --> $DIR/issue-12511.rs:11:1 + | +11 | trait t1 : t2 { + | ^^^^^^^^^^^^^ + = note: ...which then again requires computing the supertraits of `t1`, completing the cycle. + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-13058.rs b/src/test/ui/issue-13058.rs similarity index 97% rename from src/test/compile-fail/issue-13058.rs rename to src/test/ui/issue-13058.rs index 590f8073a1..dbcf9998ad 100644 --- a/src/test/compile-fail/issue-13058.rs +++ b/src/test/ui/issue-13058.rs @@ -35,5 +35,4 @@ fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool fn main() { check((3, 5)); //~^ ERROR mismatched types -//~| HELP try with `&(3, 5)` } diff --git a/src/test/ui/issue-13058.stderr b/src/test/ui/issue-13058.stderr new file mode 100644 index 0000000000..fb8fb058da --- /dev/null +++ b/src/test/ui/issue-13058.stderr @@ -0,0 +1,23 @@ +error[E0621]: explicit lifetime required in the type of `cont` + --> $DIR/issue-13058.rs:24:26 + | +22 | fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool + | ---- consider changing the type of `cont` to `&'r T` +23 | { +24 | let cont_iter = cont.iter(); + | ^^^^ lifetime `'r` required + +error[E0308]: mismatched types + --> $DIR/issue-13058.rs:36:11 + | +36 | check((3, 5)); + | ^^^^^^ + | | + | expected reference, found tuple + | help: consider borrowing here: `&(3, 5)` + | + = note: expected type `&_` + found type `({integer}, {integer})` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issue-13483.rs b/src/test/ui/issue-13483.rs index 8637804391..c44465b221 100644 --- a/src/test/ui/issue-13483.rs +++ b/src/test/ui/issue-13483.rs @@ -10,14 +10,14 @@ fn main() { if true { - } else if { + } else if { //~ ERROR missing condition } else { } } fn foo() { if true { - } else if { + } else if { //~ ERROR missing condition } bar(); } diff --git a/src/test/ui/issue-13483.stderr b/src/test/ui/issue-13483.stderr index 3446969dfd..344e179695 100644 --- a/src/test/ui/issue-13483.stderr +++ b/src/test/ui/issue-13483.stderr @@ -1,13 +1,13 @@ error: missing condition for `if` statemement --> $DIR/issue-13483.rs:13:14 | -13 | } else if { +13 | } else if { //~ ERROR missing condition | ^ expected if condition here error: missing condition for `if` statemement --> $DIR/issue-13483.rs:20:14 | -20 | } else if { +20 | } else if { //~ ERROR missing condition | ^ expected if condition here error: aborting due to 2 previous errors diff --git a/src/test/compile-fail/issue-14092.rs b/src/test/ui/issue-14092.rs similarity index 93% rename from src/test/compile-fail/issue-14092.rs rename to src/test/ui/issue-14092.rs index 85dd88e614..449de26769 100644 --- a/src/test/compile-fail/issue-14092.rs +++ b/src/test/ui/issue-14092.rs @@ -10,6 +10,5 @@ fn fn1(0: Box) {} //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0243] - //~| NOTE expected 1 type argument fn main() {} diff --git a/src/test/ui/issue-14092.stderr b/src/test/ui/issue-14092.stderr new file mode 100644 index 0000000000..e0b5bdb93d --- /dev/null +++ b/src/test/ui/issue-14092.stderr @@ -0,0 +1,8 @@ +error[E0243]: wrong number of type arguments: expected 1, found 0 + --> $DIR/issue-14092.rs:11:11 + | +11 | fn fn1(0: Box) {} + | ^^^ expected 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-15260.rs b/src/test/ui/issue-15260.rs similarity index 73% rename from src/test/compile-fail/issue-15260.rs rename to src/test/ui/issue-15260.rs index 5f816d34c8..6356ea8166 100644 --- a/src/test/compile-fail/issue-15260.rs +++ b/src/test/ui/issue-15260.rs @@ -14,28 +14,22 @@ struct Foo { fn main() { let Foo { - a: _, //~ NOTE first use of `a` + a: _, + a: _ + //~^ ERROR field `a` bound multiple times in the pattern + } = Foo { a: 29 }; + + let Foo { + a, a: _ //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern - } = Foo { a: 29 }; - - let Foo { - a, //~ NOTE first use of `a` - a: _ - //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern } = Foo { a: 29 }; let Foo { a, - //~^ NOTE first use of `a` - //~| NOTE first use of `a` a: _, //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern a: x //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern } = Foo { a: 29 }; } diff --git a/src/test/ui/issue-15260.stderr b/src/test/ui/issue-15260.stderr new file mode 100644 index 0000000000..aca2fa5ed0 --- /dev/null +++ b/src/test/ui/issue-15260.stderr @@ -0,0 +1,35 @@ +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:18:9 + | +17 | a: _, + | ---- first use of `a` +18 | a: _ + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:24:9 + | +23 | a, + | - first use of `a` +24 | a: _ + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:30:9 + | +29 | a, + | - first use of `a` +30 | a: _, + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:32:9 + | +29 | a, + | - first use of `a` +... +32 | a: x + | ^^^^ multiple uses of `a` in pattern + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-15524.rs b/src/test/ui/issue-15524.rs similarity index 76% rename from src/test/compile-fail/issue-15524.rs rename to src/test/ui/issue-15524.rs index 658a0c1546..85214bd863 100644 --- a/src/test/compile-fail/issue-15524.rs +++ b/src/test/ui/issue-15524.rs @@ -12,20 +12,14 @@ const N: isize = 1; enum Foo { A = 1, - //~^ NOTE first use of `1isize` - //~| NOTE first use of `1isize` - //~| NOTE first use of `1isize` B = 1, //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` C = 0, D, //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` E = N, //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` } diff --git a/src/test/ui/issue-15524.stderr b/src/test/ui/issue-15524.stderr new file mode 100644 index 0000000000..9c77752be2 --- /dev/null +++ b/src/test/ui/issue-15524.stderr @@ -0,0 +1,28 @@ +error[E0081]: discriminant value `1isize` already exists + --> $DIR/issue-15524.rs:15:9 + | +14 | A = 1, + | - first use of `1isize` +15 | B = 1, + | ^ enum already has `1isize` + +error[E0081]: discriminant value `1isize` already exists + --> $DIR/issue-15524.rs:18:5 + | +14 | A = 1, + | - first use of `1isize` +... +18 | D, + | ^ enum already has `1isize` + +error[E0081]: discriminant value `1isize` already exists + --> $DIR/issue-15524.rs:21:9 + | +14 | A = 1, + | - first use of `1isize` +... +21 | E = N, + | ^ enum already has `1isize` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-17263.rs b/src/test/ui/issue-17263.rs similarity index 74% rename from src/test/compile-fail/issue-17263.rs rename to src/test/ui/issue-17263.rs index 063afe285f..242327e93c 100644 --- a/src/test/compile-fail/issue-17263.rs +++ b/src/test/ui/issue-17263.rs @@ -16,14 +16,8 @@ fn main() { let mut x: Box<_> = box Foo { a: 1, b: 2 }; let (a, b) = (&mut x.a, &mut x.b); //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time - //~| NOTE first mutable borrow occurs here (via `x.a`) - //~| NOTE second mutable borrow occurs here (via `x.b`) let mut foo: Box<_> = box Foo { a: 1, b: 2 }; let (c, d) = (&mut foo.a, &foo.b); //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable - //~| NOTE mutable borrow occurs here (via `foo.a`) - //~| NOTE immutable borrow occurs here (via `foo.b`) } -//~^ NOTE first borrow ends here -//~^^ NOTE mutable borrow ends here diff --git a/src/test/ui/issue-17263.stderr b/src/test/ui/issue-17263.stderr new file mode 100644 index 0000000000..a762c0876b --- /dev/null +++ b/src/test/ui/issue-17263.stderr @@ -0,0 +1,24 @@ +error[E0499]: cannot borrow `x` (via `x.b`) as mutable more than once at a time + --> $DIR/issue-17263.rs:17:34 + | +17 | let (a, b) = (&mut x.a, &mut x.b); + | --- ^^^ second mutable borrow occurs here (via `x.b`) + | | + | first mutable borrow occurs here (via `x.a`) +... +23 | } + | - first borrow ends here + +error[E0502]: cannot borrow `foo` (via `foo.b`) as immutable because `foo` is also borrowed as mutable (via `foo.a`) + --> $DIR/issue-17263.rs:21:32 + | +21 | let (c, d) = (&mut foo.a, &foo.b); + | ----- ^^^^^ immutable borrow occurs here (via `foo.b`) + | | + | mutable borrow occurs here (via `foo.a`) +22 | //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable +23 | } + | - mutable borrow ends here + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-17441.rs b/src/test/ui/issue-17441.rs similarity index 79% rename from src/test/compile-fail/issue-17441.rs rename to src/test/ui/issue-17441.rs index bddc9c1381..c7b0770146 100644 --- a/src/test/compile-fail/issue-17441.rs +++ b/src/test/ui/issue-17441.rs @@ -11,17 +11,13 @@ fn main() { let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` - //~^^ HELP consider using an implicit coercion to `&[usize]` instead let _bar = Box::new(1_usize) as std::fmt::Debug; //~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug` - //~^^ HELP try casting to a `Box` instead let _baz = 1_usize as std::fmt::Debug; //~^ ERROR cast to unsized type: `usize` as `std::fmt::Debug` - //~^^ HELP consider using a box or reference as appropriate let _quux = [1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]` - //~^^ HELP consider using a box or reference as appropriate } diff --git a/src/test/ui/issue-17441.stderr b/src/test/ui/issue-17441.stderr new file mode 100644 index 0000000000..593507a5d4 --- /dev/null +++ b/src/test/ui/issue-17441.stderr @@ -0,0 +1,46 @@ +error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` + --> $DIR/issue-17441.rs:12:16 + | +12 | let _foo = &[1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an implicit coercion to `&[usize]` instead + --> $DIR/issue-17441.rs:12:16 + | +12 | let _foo = &[1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0620]: cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug` + --> $DIR/issue-17441.rs:15:16 + | +15 | let _bar = Box::new(1_usize) as std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^--------------- + | | + | help: try casting to a `Box` instead: `Box<std::fmt::Debug>` + +error[E0620]: cast to unsized type: `usize` as `std::fmt::Debug` + --> $DIR/issue-17441.rs:18:16 + | +18 | let _baz = 1_usize as std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a box or reference as appropriate + --> $DIR/issue-17441.rs:18:16 + | +18 | let _baz = 1_usize as std::fmt::Debug; + | ^^^^^^^ + +error[E0620]: cast to unsized type: `[usize; 2]` as `[usize]` + --> $DIR/issue-17441.rs:21:17 + | +21 | let _quux = [1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a box or reference as appropriate + --> $DIR/issue-17441.rs:21:17 + | +21 | let _quux = [1_usize, 2] as [usize]; + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-18183.rs b/src/test/ui/issue-18183.rs similarity index 85% rename from src/test/compile-fail/issue-18183.rs rename to src/test/ui/issue-18183.rs index feab04531b..2cad4a3175 100644 --- a/src/test/compile-fail/issue-18183.rs +++ b/src/test/ui/issue-18183.rs @@ -9,6 +9,5 @@ // except according to those terms. pub struct Foo<Bar=Bar>(Bar); //~ ERROR E0128 - //~| NOTE defaulted type parameters cannot be forward declared pub struct Baz(Foo); fn main() {} diff --git a/src/test/ui/issue-18183.stderr b/src/test/ui/issue-18183.stderr new file mode 100644 index 0000000000..3105080226 --- /dev/null +++ b/src/test/ui/issue-18183.stderr @@ -0,0 +1,8 @@ +error[E0128]: type parameters with a default cannot use forward declared identifiers + --> $DIR/issue-18183.rs:11:20 + | +11 | pub struct Foo<Bar=Bar>(Bar); //~ ERROR E0128 + | ^^^ defaulted type parameters cannot be forward declared + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-18819.rs b/src/test/ui/issue-18819.rs similarity index 91% rename from src/test/compile-fail/issue-18819.rs rename to src/test/ui/issue-18819.rs index 148eea31ec..c6f60f1cbb 100644 --- a/src/test/compile-fail/issue-18819.rs +++ b/src/test/ui/issue-18819.rs @@ -19,12 +19,10 @@ impl Foo for X { } fn print_x(_: &Foo<Item=bool>, extra: &str) { - //~^ NOTE defined here println!("{}", extra); } fn main() { print_x(X); //~^ ERROR E0061 - //~| NOTE expected 2 parameters } diff --git a/src/test/ui/issue-18819.stderr b/src/test/ui/issue-18819.stderr new file mode 100644 index 0000000000..1cd899925c --- /dev/null +++ b/src/test/ui/issue-18819.stderr @@ -0,0 +1,11 @@ +error[E0061]: this function takes 2 parameters but 1 parameter was supplied + --> $DIR/issue-18819.rs:26:5 + | +21 | fn print_x(_: &Foo<Item=bool>, extra: &str) { + | ------------------------------------------- defined here +... +26 | print_x(X); + | ^^^^^^^^^^ expected 2 parameters + +error: aborting due to previous error + diff --git a/src/test/ui/issue-19100.rs b/src/test/ui/issue-19100.rs index bcadd94eb6..2032f23e6a 100644 --- a/src/test/ui/issue-19100.rs +++ b/src/test/ui/issue-19100.rs @@ -26,12 +26,10 @@ impl Foo { & Bar if true //~^ WARN pattern binding `Bar` is named the same as one of the variants of the type `Foo` -//~^^ HELP to match on a variant, consider making the path in the pattern qualified: `Foo::Bar` => println!("bar"), & Baz if false //~^ WARN pattern binding `Baz` is named the same as one of the variants of the type `Foo` -//~^^ HELP to match on a variant, consider making the path in the pattern qualified: `Foo::Baz` => println!("baz"), _ => () } diff --git a/src/test/ui/issue-19100.stderr b/src/test/ui/issue-19100.stderr index 45e2ef652d..a567e86cfd 100644 --- a/src/test/ui/issue-19100.stderr +++ b/src/test/ui/issue-19100.stderr @@ -7,9 +7,9 @@ warning[E0170]: pattern binding `Bar` is named the same as one of the variants o = help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Bar` warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` - --> $DIR/issue-19100.rs:32:1 + --> $DIR/issue-19100.rs:31:1 | -32 | Baz if false +31 | Baz if false | ^^^ | = help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Baz` diff --git a/src/test/compile-fail/issue-19498.rs b/src/test/ui/issue-19498.rs similarity index 64% rename from src/test/compile-fail/issue-19498.rs rename to src/test/ui/issue-19498.rs index 7de16e5ecf..30eea2efd1 100644 --- a/src/test/compile-fail/issue-19498.rs +++ b/src/test/ui/issue-19498.rs @@ -8,19 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use self::A; //~ NOTE previous import of the module `A` here -use self::B; //~ NOTE previous import of the module `B` here +use self::A; +use self::B; mod A {} //~ ERROR the name `A` is defined multiple times //~| `A` redefined here -//~| NOTE `A` must be defined only once in the type namespace of this module pub mod B {} //~ ERROR the name `B` is defined multiple times //~| `B` redefined here -//~| NOTE `B` must be defined only once in the type namespace of this module mod C { - use C::D; //~ NOTE previous import of the module `D` here + use C::D; mod D {} //~ ERROR the name `D` is defined multiple times //~| `D` redefined here - //~| NOTE `D` must be defined only once in the type namespace of this module } fn main() {} diff --git a/src/test/ui/issue-19498.stderr b/src/test/ui/issue-19498.stderr new file mode 100644 index 0000000000..489abf715d --- /dev/null +++ b/src/test/ui/issue-19498.stderr @@ -0,0 +1,46 @@ +error[E0255]: the name `A` is defined multiple times + --> $DIR/issue-19498.rs:13:1 + | +11 | use self::A; + | ------- previous import of the module `A` here +12 | use self::B; +13 | mod A {} //~ ERROR the name `A` is defined multiple times + | ^^^^^ `A` redefined here + | + = note: `A` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +11 | use self::A as OtherA; + | ^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `B` is defined multiple times + --> $DIR/issue-19498.rs:15:1 + | +12 | use self::B; + | ------- previous import of the module `B` here +... +15 | pub mod B {} //~ ERROR the name `B` is defined multiple times + | ^^^^^^^^^ `B` redefined here + | + = note: `B` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +12 | use self::B as OtherB; + | ^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `D` is defined multiple times + --> $DIR/issue-19498.rs:19:5 + | +18 | use C::D; + | ---- previous import of the module `D` here +19 | mod D {} //~ ERROR the name `D` is defined multiple times + | ^^^^^ `D` redefined here + | + = note: `D` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +18 | use C::D as OtherD; + | ^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-1962.rs b/src/test/ui/issue-1962.rs similarity index 100% rename from src/test/compile-fail/issue-1962.rs rename to src/test/ui/issue-1962.rs diff --git a/src/test/ui/issue-1962.stderr b/src/test/ui/issue-1962.stderr new file mode 100644 index 0000000000..5f920316b5 --- /dev/null +++ b/src/test/ui/issue-1962.stderr @@ -0,0 +1,10 @@ +error: denote infinite loops with `loop { ... }` + --> $DIR/issue-1962.rs:14:3 + | +14 | while true { //~ ERROR denote infinite loops with `loop + | ^^^^^^^^^^ help: use `loop` + | + = note: requested on the command line with `-D while-true` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-19707.rs b/src/test/ui/issue-19707.rs similarity index 78% rename from src/test/compile-fail/issue-19707.rs rename to src/test/ui/issue-19707.rs index beeb7da6d3..377aef2f7d 100644 --- a/src/test/compile-fail/issue-19707.rs +++ b/src/test/ui/issue-19707.rs @@ -11,9 +11,7 @@ #![allow(dead_code)] type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say whether it is borrowed from argument 1 or argument 2 fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say whether it is borrowed from argument 1 or argument 2 fn main() {} diff --git a/src/test/ui/issue-19707.stderr b/src/test/ui/issue-19707.stderr new file mode 100644 index 0000000000..b4d4f6f1bb --- /dev/null +++ b/src/test/ui/issue-19707.stderr @@ -0,0 +1,18 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-19707.rs:13:28 + | +13 | type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 + +error[E0106]: missing lifetime specifier + --> $DIR/issue-19707.rs:15:27 + | +15 | fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-19922.rs b/src/test/ui/issue-19922.rs similarity index 86% rename from src/test/compile-fail/issue-19922.rs rename to src/test/ui/issue-19922.rs index 938ccb343d..a8350fe098 100644 --- a/src/test/compile-fail/issue-19922.rs +++ b/src/test/ui/issue-19922.rs @@ -15,6 +15,4 @@ enum Homura { fn main() { let homura = Homura::Akemi { kaname: () }; //~^ ERROR variant `Homura::Akemi` has no field named `kaname` - //~| NOTE `Homura::Akemi` does not have this field - //~| NOTE available fields are: `madoka` } diff --git a/src/test/ui/issue-19922.stderr b/src/test/ui/issue-19922.stderr new file mode 100644 index 0000000000..f963924419 --- /dev/null +++ b/src/test/ui/issue-19922.stderr @@ -0,0 +1,10 @@ +error[E0559]: variant `Homura::Akemi` has no field named `kaname` + --> $DIR/issue-19922.rs:16:34 + | +16 | let homura = Homura::Akemi { kaname: () }; + | ^^^^^^^ `Homura::Akemi` does not have this field + | + = note: available fields are: `madoka` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26194.rs b/src/test/ui/issue-20692.rs similarity index 70% rename from src/test/compile-fail/issue-26194.rs rename to src/test/ui/issue-20692.rs index 7ddd56229c..0a4e7c8ee6 100644 --- a/src/test/compile-fail/issue-26194.rs +++ b/src/test/ui/issue-20692.rs @@ -8,11 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct S(String); +trait Array: Sized {} -impl S { - fn f(self: *mut S) -> String { self.0 } - //~^ ERROR invalid `self` type +fn f<T: Array>(x: &T) { + let _ = x + //~^ ERROR `Array` cannot be made into an object + as + &Array; + //~^ ERROR `Array` cannot be made into an object } -fn main() { S("".to_owned()).f(); } +fn main() {} diff --git a/src/test/ui/issue-20692.stderr b/src/test/ui/issue-20692.stderr new file mode 100644 index 0000000000..2a5ddd1b61 --- /dev/null +++ b/src/test/ui/issue-20692.stderr @@ -0,0 +1,19 @@ +error[E0038]: the trait `Array` cannot be made into an object + --> $DIR/issue-20692.rs:17:5 + | +17 | &Array; + | ^^^^^^ the trait `Array` cannot be made into an object + | + = note: the trait cannot require that `Self : Sized` + +error[E0038]: the trait `Array` cannot be made into an object + --> $DIR/issue-20692.rs:14:13 + | +14 | let _ = x + | ^ the trait `Array` cannot be made into an object + | + = note: the trait cannot require that `Self : Sized` + = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&Array>` for `&T` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-21546.rs b/src/test/ui/issue-21546.rs similarity index 56% rename from src/test/compile-fail/issue-21546.rs rename to src/test/ui/issue-21546.rs index b7dbc7c721..da1669bc91 100644 --- a/src/test/compile-fail/issue-21546.rs +++ b/src/test/ui/issue-21546.rs @@ -12,66 +12,48 @@ #[allow(non_snake_case)] mod Foo { } -//~^ NOTE previous definition of the module `Foo` here #[allow(dead_code)] struct Foo; //~^ ERROR the name `Foo` is defined multiple times -//~| NOTE `Foo` redefined here -//~| NOTE `Foo` must be defined only once in the type namespace of this module #[allow(non_snake_case)] mod Bar { } -//~^ NOTE previous definition of the module `Bar` here #[allow(dead_code)] struct Bar(i32); //~^ ERROR the name `Bar` is defined multiple times -//~| NOTE `Bar` redefined here -//~| NOTE `Bar` must be defined only once in the type namespace of this module #[allow(dead_code)] struct Baz(i32); -//~^ NOTE previous definition of the type `Baz` here #[allow(non_snake_case)] mod Baz { } //~^ ERROR the name `Baz` is defined multiple times -//~| NOTE `Baz` redefined here -//~| NOTE `Baz` must be defined only once in the type namespace of this module #[allow(dead_code)] struct Qux { x: bool } -//~^ NOTE previous definition of the type `Qux` here #[allow(non_snake_case)] mod Qux { } //~^ ERROR the name `Qux` is defined multiple times -//~| NOTE `Qux` redefined here -//~| NOTE `Qux` must be defined only once in the type namespace of this module #[allow(dead_code)] struct Quux; -//~^ NOTE previous definition of the type `Quux` here #[allow(non_snake_case)] mod Quux { } //~^ ERROR the name `Quux` is defined multiple times -//~| NOTE `Quux` redefined here -//~| NOTE `Quux` must be defined only once in the type namespace of this module #[allow(dead_code)] enum Corge { A, B } -//~^ NOTE previous definition of the type `Corge` here #[allow(non_snake_case)] mod Corge { } //~^ ERROR the name `Corge` is defined multiple times -//~| NOTE `Corge` redefined here -//~| NOTE `Corge` must be defined only once in the type namespace of this module fn main() { } diff --git a/src/test/ui/issue-21546.stderr b/src/test/ui/issue-21546.stderr new file mode 100644 index 0000000000..ec953103a1 --- /dev/null +++ b/src/test/ui/issue-21546.stderr @@ -0,0 +1,68 @@ +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/issue-21546.rs:17:1 + | +14 | mod Foo { } + | ------- previous definition of the module `Foo` here +... +17 | struct Foo; + | ^^^^^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Bar` is defined multiple times + --> $DIR/issue-21546.rs:24:1 + | +21 | mod Bar { } + | ------- previous definition of the module `Bar` here +... +24 | struct Bar(i32); + | ^^^^^^^^^^^^^^^^ `Bar` redefined here + | + = note: `Bar` must be defined only once in the type namespace of this module + +error[E0428]: the name `Baz` is defined multiple times + --> $DIR/issue-21546.rs:32:1 + | +29 | struct Baz(i32); + | ---------------- previous definition of the type `Baz` here +... +32 | mod Baz { } + | ^^^^^^^ `Baz` redefined here + | + = note: `Baz` must be defined only once in the type namespace of this module + +error[E0428]: the name `Qux` is defined multiple times + --> $DIR/issue-21546.rs:40:1 + | +37 | struct Qux { x: bool } + | ---------- previous definition of the type `Qux` here +... +40 | mod Qux { } + | ^^^^^^^ `Qux` redefined here + | + = note: `Qux` must be defined only once in the type namespace of this module + +error[E0428]: the name `Quux` is defined multiple times + --> $DIR/issue-21546.rs:48:1 + | +45 | struct Quux; + | ------------ previous definition of the type `Quux` here +... +48 | mod Quux { } + | ^^^^^^^^ `Quux` redefined here + | + = note: `Quux` must be defined only once in the type namespace of this module + +error[E0428]: the name `Corge` is defined multiple times + --> $DIR/issue-21546.rs:56:1 + | +53 | enum Corge { A, B } + | ---------- previous definition of the type `Corge` here +... +56 | mod Corge { } + | ^^^^^^^^^ `Corge` redefined here + | + = note: `Corge` must be defined only once in the type namespace of this module + +error: aborting due to 6 previous errors + diff --git a/src/test/compile-fail/issue-21600.rs b/src/test/ui/issue-21600.rs similarity index 82% rename from src/test/compile-fail/issue-21600.rs rename to src/test/ui/issue-21600.rs index 1d0473ec4b..e4dfad2433 100644 --- a/src/test/compile-fail/issue-21600.rs +++ b/src/test/ui/issue-21600.rs @@ -19,10 +19,9 @@ impl A { fn main() { let mut x = A; - call_it(|| { //~ HELP consider changing this to accept closures that implement `FnMut` + call_it(|| { call_it(|| x.gen()); call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer //~^ ERROR cannot borrow data mutably in a captured outer - //~| HELP consider changing this closure to take self by mutable reference }); } diff --git a/src/test/ui/issue-21600.stderr b/src/test/ui/issue-21600.stderr new file mode 100644 index 0000000000..e177e8ede6 --- /dev/null +++ b/src/test/ui/issue-21600.stderr @@ -0,0 +1,31 @@ +error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure + --> $DIR/issue-21600.rs:24:17 + | +24 | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer + | ^^ + | +help: consider changing this to accept closures that implement `FnMut` + --> $DIR/issue-21600.rs:22:13 + | +22 | call_it(|| { + | _____________^ +23 | | call_it(|| x.gen()); +24 | | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +25 | | //~^ ERROR cannot borrow data mutably in a captured outer +26 | | }); + | |_____^ + +error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure + --> $DIR/issue-21600.rs:24:20 + | +24 | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer + | ^ + | +help: consider changing this closure to take self by mutable reference + --> $DIR/issue-21600.rs:24:17 + | +24 | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer + | ^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issue-21950.rs b/src/test/ui/issue-21950.rs new file mode 100644 index 0000000000..f9328a58d0 --- /dev/null +++ b/src/test/ui/issue-21950.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-tidy-linelength + +use std::ops::Add; + +fn main() { + let x = &10 as + &Add; + //~^ ERROR E0393 + //~| ERROR E0191 +} diff --git a/src/test/ui/issue-21950.stderr b/src/test/ui/issue-21950.stderr new file mode 100644 index 0000000000..123d61a261 --- /dev/null +++ b/src/test/ui/issue-21950.stderr @@ -0,0 +1,16 @@ +error[E0393]: the type parameter `RHS` must be explicitly specified + --> $DIR/issue-21950.rs:17:14 + | +17 | &Add; + | ^^^ missing reference to `RHS` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified + --> $DIR/issue-21950.rs:17:14 + | +17 | &Add; + | ^^^ missing associated type `Output` value + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-22370.rs b/src/test/ui/issue-22370.rs similarity index 80% rename from src/test/compile-fail/issue-22370.rs rename to src/test/ui/issue-22370.rs index 51f342e3f0..4613c5977f 100644 --- a/src/test/compile-fail/issue-22370.rs +++ b/src/test/ui/issue-22370.rs @@ -14,7 +14,5 @@ trait A<T=Self> {} fn f(a: &A) {} //~^ ERROR E0393 -//~| NOTE missing reference to `T` -//~| NOTE because of the default `Self` reference, type parameters must be specified on object types fn main() {} diff --git a/src/test/ui/issue-22370.stderr b/src/test/ui/issue-22370.stderr new file mode 100644 index 0000000000..9498000ca5 --- /dev/null +++ b/src/test/ui/issue-22370.stderr @@ -0,0 +1,10 @@ +error[E0393]: the type parameter `T` must be explicitly specified + --> $DIR/issue-22370.rs:15:10 + | +15 | fn f(a: &A) {} + | ^ missing reference to `T` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/compile-fail/div-by-zero.rs b/src/test/ui/issue-22560.rs similarity index 68% rename from src/tools/miri/tests/compile-fail/div-by-zero.rs rename to src/test/ui/issue-22560.rs index 4ac6214d88..b1c636f2ef 100644 --- a/src/tools/miri/tests/compile-fail/div-by-zero.rs +++ b/src/test/ui/issue-22560.rs @@ -8,14 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core_intrinsics)] +// ignore-tidy-linelength -use std::intrinsics::*; +use std::ops::{Add, Sub}; -//error-pattern: Division by 0 in unchecked_div +type Test = Add + + //~^ ERROR E0393 + //~| ERROR E0191 + Sub; + //~^ ERROR E0393 + //~| ERROR E0225 -fn main() { - unsafe { - let _n = unchecked_div(1i64, 0); - } -} +fn main() { } diff --git a/src/test/ui/issue-22560.stderr b/src/test/ui/issue-22560.stderr new file mode 100644 index 0000000000..1c594cb6cb --- /dev/null +++ b/src/test/ui/issue-22560.stderr @@ -0,0 +1,34 @@ +error[E0393]: the type parameter `RHS` must be explicitly specified + --> $DIR/issue-22560.rs:15:13 + | +15 | type Test = Add + + | ^^^ missing reference to `RHS` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0393]: the type parameter `RHS` must be explicitly specified + --> $DIR/issue-22560.rs:18:13 + | +18 | Sub; + | ^^^ missing reference to `RHS` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0225]: only auto traits can be used as additional traits in a trait object + --> $DIR/issue-22560.rs:18:13 + | +18 | Sub; + | ^^^ non-auto additional trait + +error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified + --> $DIR/issue-22560.rs:15:13 + | +15 | type Test = Add + + | _____________^ +16 | | //~^ ERROR E0393 +17 | | //~| ERROR E0191 +18 | | Sub; + | |_______________^ missing associated type `Output` value + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/issue-22644.rs b/src/test/ui/issue-22644.rs index c8e0cd1763..f787e43dbd 100644 --- a/src/test/ui/issue-22644.rs +++ b/src/test/ui/issue-22644.rs @@ -13,17 +13,19 @@ fn main() { let long_name : usize = 0; println!("{}", a as usize > long_name); - println!("{}", a as usize < long_name); + println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic println!("{}{}", a as usize < long_name, long_name); - println!("{}", a as usize < 4); + //~^ ERROR `<` is interpreted as a start of generic + println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic println!("{}", a: usize > long_name); println!("{}{}", a: usize < long_name, long_name); - println!("{}", a: usize < 4); + //~^ ERROR `<` is interpreted as a start of generic + println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic println!("{}", a as usize - < + < //~ ERROR `<` is interpreted as a start of generic 4); println!("{}", a @@ -32,10 +34,10 @@ fn main() { usize - < + < //~ ERROR `<` is interpreted as a start of generic 5); - println!("{}", a as usize << long_name); + println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic - println!("{}", a: &mut 4); + println!("{}", a: &mut 4); //~ ERROR expected type, found `4` } diff --git a/src/test/ui/issue-22644.stderr b/src/test/ui/issue-22644.stderr index 5777c24ae8..91107fbe35 100644 --- a/src/test/ui/issue-22644.stderr +++ b/src/test/ui/issue-22644.stderr @@ -1,7 +1,7 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:16:31 | -16 | println!("{}", a as usize < long_name); +16 | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic | ---------- ^ --------- interpreted as generic arguments | | | | | not interpreted as comparison @@ -17,75 +17,75 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a com | help: try comparing the casted value: `(a as usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:18:31 + --> $DIR/issue-22644.rs:19:31 | -18 | println!("{}", a as usize < 4); +19 | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic | ---------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison | help: try comparing the casted value: `(a as usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:20:31 + --> $DIR/issue-22644.rs:21:31 | -20 | println!("{}{}", a: usize < long_name, long_name); +21 | println!("{}{}", a: usize < long_name, long_name); | -------- ^ -------------------- interpreted as generic arguments | | | | | not interpreted as comparison | help: try comparing the casted value: `(a: usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:21:29 + --> $DIR/issue-22644.rs:23:29 | -21 | println!("{}", a: usize < 4); +23 | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic | -------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison | help: try comparing the casted value: `(a: usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:26:20 + --> $DIR/issue-22644.rs:28:20 | -26 | < +28 | < //~ ERROR `<` is interpreted as a start of generic | ^ not interpreted as comparison -27 | 4); +29 | 4); | - interpreted as generic arguments help: try comparing the casted value | -23 | println!("{}", (a -24 | as -25 | usize) +25 | println!("{}", (a +26 | as +27 | usize) | error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:35:20 + --> $DIR/issue-22644.rs:37:20 | -35 | < +37 | < //~ ERROR `<` is interpreted as a start of generic | ^ not interpreted as comparison -36 | 5); +38 | 5); | - interpreted as generic arguments help: try comparing the casted value | -28 | println!("{}", (a -29 | -30 | -31 | as +30 | println!("{}", (a +31 | 32 | -33 | +33 | as +34 | +35 | ... error: `<` is interpreted as a start of generic arguments for `usize`, not a shift - --> $DIR/issue-22644.rs:38:31 + --> $DIR/issue-22644.rs:40:31 | -38 | println!("{}", a as usize << long_name); +40 | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic | ---------- ^^ --------- interpreted as generic arguments | | | | | not interpreted as shift | help: try shifting the casted value: `(a as usize)` error: expected type, found `4` - --> $DIR/issue-22644.rs:40:28 + --> $DIR/issue-22644.rs:42:28 | -40 | println!("{}", a: &mut 4); +42 | println!("{}", a: &mut 4); //~ ERROR expected type, found `4` | ^ expecting a type here because of type ascription diff --git a/src/test/compile-fail/issue-22886.rs b/src/test/ui/issue-22886.rs similarity index 92% rename from src/test/compile-fail/issue-22886.rs rename to src/test/ui/issue-22886.rs index d258a4a8b3..4aa2571cad 100644 --- a/src/test/compile-fail/issue-22886.rs +++ b/src/test/ui/issue-22886.rs @@ -21,7 +21,6 @@ fn crash_please() { struct Newtype(Option<Box<usize>>); impl<'a> Iterator for Newtype { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter type Item = &'a Box<usize>; fn next(&mut self) -> Option<&Box<usize>> { diff --git a/src/test/ui/issue-22886.stderr b/src/test/ui/issue-22886.stderr new file mode 100644 index 0000000000..23d05edc91 --- /dev/null +++ b/src/test/ui/issue-22886.stderr @@ -0,0 +1,8 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-22886.rs:23:6 + | +23 | impl<'a> Iterator for Newtype { //~ ERROR E0207 + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-22933-2.rs b/src/test/ui/issue-22933-2.rs similarity index 89% rename from src/test/compile-fail/issue-22933-2.rs rename to src/test/ui/issue-22933-2.rs index 97456c2da8..e887c7760d 100644 --- a/src/test/compile-fail/issue-22933-2.rs +++ b/src/test/ui/issue-22933-2.rs @@ -12,7 +12,7 @@ enum Delicious { Pie = 0x1, Apple = 0x2, ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - //~^ ERROR no associated item named `PIE` found for type `Delicious` + //~^ ERROR no variant named `PIE` found for type `Delicious` } fn main() {} diff --git a/src/test/ui/issue-22933-2.stderr b/src/test/ui/issue-22933-2.stderr new file mode 100644 index 0000000000..8853d43408 --- /dev/null +++ b/src/test/ui/issue-22933-2.stderr @@ -0,0 +1,11 @@ +error[E0599]: no variant named `PIE` found for type `Delicious` in the current scope + --> $DIR/issue-22933-2.rs:14:44 + | +11 | enum Delicious { + | -------------- variant `PIE` not found here +... +14 | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, + | ^^^^^^^^^^^^^^ variant not found in `Delicious` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23041.rs b/src/test/ui/issue-23041.rs similarity index 90% rename from src/test/compile-fail/issue-23041.rs rename to src/test/ui/issue-23041.rs index 4dfad4ee3c..1a9bb4c29f 100644 --- a/src/test/compile-fail/issue-23041.rs +++ b/src/test/ui/issue-23041.rs @@ -14,5 +14,4 @@ fn main() fn bar(x:i32) ->i32 { 3*x }; let b:Box<Any> = Box::new(bar as fn(_)->_); b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282 - //~| NOTE cannot infer type for `_` } diff --git a/src/test/ui/issue-23041.stderr b/src/test/ui/issue-23041.stderr new file mode 100644 index 0000000000..048ae5834e --- /dev/null +++ b/src/test/ui/issue-23041.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/issue-23041.rs:16:22 + | +16 | b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282 + | ^^^^^^^^ cannot infer type for `_` + +error: aborting due to previous error + diff --git a/src/test/ui/issue-23173.rs b/src/test/ui/issue-23173.rs new file mode 100644 index 0000000000..17e5317b9f --- /dev/null +++ b/src/test/ui/issue-23173.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } +struct Struct { + a: usize, +} + +fn use_token(token: &Token) { unimplemented!() } + +fn main() { + use_token(&Token::Homura); + //~^ ERROR no variant named `Homura` + Struct::method(); + //~^ ERROR no function or associated item named `method` found for type + Struct::method; + //~^ ERROR no function or associated item named `method` found for type + Struct::Assoc; + //~^ ERROR no associated item named `Assoc` found for type `Struct` in +} diff --git a/src/test/ui/issue-23173.stderr b/src/test/ui/issue-23173.stderr new file mode 100644 index 0000000000..38a22257ff --- /dev/null +++ b/src/test/ui/issue-23173.stderr @@ -0,0 +1,38 @@ +error[E0599]: no variant named `Homura` found for type `Token` in the current scope + --> $DIR/issue-23173.rs:19:16 + | +11 | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } + | ---------- variant `Homura` not found here +... +19 | use_token(&Token::Homura); + | ^^^^^^^^^^^^^ variant not found in `Token` + +error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope + --> $DIR/issue-23173.rs:21:5 + | +12 | struct Struct { + | ------------- function or associated item `method` not found for this +... +21 | Struct::method(); + | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + +error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope + --> $DIR/issue-23173.rs:23:5 + | +12 | struct Struct { + | ------------- function or associated item `method` not found for this +... +23 | Struct::method; + | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + +error[E0599]: no associated item named `Assoc` found for type `Struct` in the current scope + --> $DIR/issue-23173.rs:25:5 + | +12 | struct Struct { + | ------------- associated item `Assoc` not found for this +... +25 | Struct::Assoc; + | ^^^^^^^^^^^^^ associated item not found in `Struct` + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-23217.rs b/src/test/ui/issue-23217.rs similarity index 88% rename from src/test/compile-fail/issue-23217.rs rename to src/test/ui/issue-23217.rs index 95f6526f11..dc51adf42a 100644 --- a/src/test/compile-fail/issue-23217.rs +++ b/src/test/ui/issue-23217.rs @@ -10,7 +10,7 @@ pub enum SomeEnum { B = SomeEnum::A, - //~^ ERROR no associated item named `A` found for type `SomeEnum` + //~^ ERROR no variant named `A` found for type `SomeEnum` } fn main() {} diff --git a/src/test/ui/issue-23217.stderr b/src/test/ui/issue-23217.stderr new file mode 100644 index 0000000000..eae6c2de9c --- /dev/null +++ b/src/test/ui/issue-23217.stderr @@ -0,0 +1,10 @@ +error[E0599]: no variant named `A` found for type `SomeEnum` in the current scope + --> $DIR/issue-23217.rs:12:9 + | +11 | pub enum SomeEnum { + | ----------------- variant `A` not found here +12 | B = SomeEnum::A, + | ^^^^^^^^^^^ variant not found in `SomeEnum` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23302.rs b/src/test/ui/issue-23302.rs similarity index 77% rename from src/test/compile-fail/issue-23302.rs rename to src/test/ui/issue-23302.rs index 35f32d16a9..2d93ab0c30 100644 --- a/src/test/compile-fail/issue-23302.rs +++ b/src/test/ui/issue-23302.rs @@ -12,21 +12,17 @@ // the appropriate error (rather than, say, blowing the stack). enum X { A = X::A as isize, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant } // Since `Y::B` here defaults to `Y::A+1`, this is also a // recursive definition. enum Y { A = Y::B as isize, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant B, } const A: i32 = B; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant const B: i32 = A; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant fn main() { } diff --git a/src/test/ui/issue-23302.stderr b/src/test/ui/issue-23302.stderr new file mode 100644 index 0000000000..4e93809fac --- /dev/null +++ b/src/test/ui/issue-23302.stderr @@ -0,0 +1,26 @@ +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:14:9 + | +14 | A = X::A as isize, //~ ERROR E0265 + | ^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:20:9 + | +20 | A = Y::B as isize, //~ ERROR E0265 + | ^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:24:1 + | +24 | const A: i32 = B; //~ ERROR E0265 + | ^^^^^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:26:1 + | +26 | const B: i32 = A; //~ ERROR E0265 + | ^^^^^^^^^^^^^^^^^ recursion not allowed in constant + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-23543.rs b/src/test/ui/issue-23543.rs similarity index 92% rename from src/test/compile-fail/issue-23543.rs rename to src/test/ui/issue-23543.rs index e1acc8eb47..4ed44154c4 100644 --- a/src/test/compile-fail/issue-23543.rs +++ b/src/test/ui/issue-23543.rs @@ -16,7 +16,6 @@ pub trait D { fn f<T>(self) where T<Bogus = Foo>: A; //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associated type not allowed here } fn main() {} diff --git a/src/test/ui/issue-23543.stderr b/src/test/ui/issue-23543.stderr new file mode 100644 index 0000000000..e518196075 --- /dev/null +++ b/src/test/ui/issue-23543.stderr @@ -0,0 +1,8 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-23543.rs:17:17 + | +17 | where T<Bogus = Foo>: A; + | ^^^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23544.rs b/src/test/ui/issue-23544.rs similarity index 92% rename from src/test/compile-fail/issue-23544.rs rename to src/test/ui/issue-23544.rs index 3cd6f9ebc7..1d7c218704 100644 --- a/src/test/compile-fail/issue-23544.rs +++ b/src/test/ui/issue-23544.rs @@ -14,7 +14,6 @@ pub trait D { fn f<T>(self) where T<Bogus = Self::AlsoBogus>: A; //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associated type not allowed here } fn main() {} diff --git a/src/test/ui/issue-23544.stderr b/src/test/ui/issue-23544.stderr new file mode 100644 index 0000000000..496a7aff7b --- /dev/null +++ b/src/test/ui/issue-23544.stderr @@ -0,0 +1,8 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-23544.rs:15:17 + | +15 | where T<Bogus = Self::AlsoBogus>: A; + | ^^^^^^^^^^^^^^^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23716.rs b/src/test/ui/issue-23716.rs similarity index 90% rename from src/test/compile-fail/issue-23716.rs rename to src/test/ui/issue-23716.rs index 5cf80dd172..7b72e5689b 100644 --- a/src/test/compile-fail/issue-23716.rs +++ b/src/test/ui/issue-23716.rs @@ -9,7 +9,6 @@ // except according to those terms. static foo: i32 = 0; -//~^ NOTE a static `foo` is defined here fn bar(foo: i32) {} //~^ ERROR function parameters cannot shadow statics @@ -20,7 +19,6 @@ mod submod { } use self::submod::answer; -//~^ NOTE a static `answer` is imported here fn question(answer: i32) {} //~^ ERROR function parameters cannot shadow statics diff --git a/src/test/ui/issue-23716.stderr b/src/test/ui/issue-23716.stderr new file mode 100644 index 0000000000..2db67c7ec0 --- /dev/null +++ b/src/test/ui/issue-23716.stderr @@ -0,0 +1,20 @@ +error[E0530]: function parameters cannot shadow statics + --> $DIR/issue-23716.rs:13:8 + | +11 | static foo: i32 = 0; + | -------------------- a static `foo` is defined here +12 | +13 | fn bar(foo: i32) {} + | ^^^ cannot be named the same as a static + +error[E0530]: function parameters cannot shadow statics + --> $DIR/issue-23716.rs:23:13 + | +21 | use self::submod::answer; + | -------------------- a static `answer` is imported here +22 | +23 | fn question(answer: i32) {} + | ^^^^^^ cannot be named the same as a static + +error: aborting due to 2 previous errors + diff --git a/src/librustc_back/slice.rs b/src/test/ui/issue-24036.rs similarity index 61% rename from src/librustc_back/slice.rs rename to src/test/ui/issue-24036.rs index 5d8fc3acef..94ac17de4c 100644 --- a/src/librustc_back/slice.rs +++ b/src/test/ui/issue-24036.rs @@ -8,12 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::mem; - -pub fn ref_slice<T>(ptr: &T) -> &[T; 1] { - unsafe { mem::transmute(ptr) } +fn closure_to_loc() { + let mut x = |c| c + 1; + x = |c| c + 1; + //~^ ERROR mismatched types } -pub fn mut_ref_slice<T>(ptr: &mut T) -> &mut [T; 1] { - unsafe { mem::transmute(ptr) } +fn closure_from_match() { + let x = match 1usize { + //~^ ERROR match arms have incompatible types + 1 => |c| c + 1, + 2 => |c| c - 1, + _ => |c| c - 1 + }; } + +fn main() { } diff --git a/src/test/ui/issue-24036.stderr b/src/test/ui/issue-24036.stderr new file mode 100644 index 0000000000..c89f7241f5 --- /dev/null +++ b/src/test/ui/issue-24036.stderr @@ -0,0 +1,31 @@ +error[E0308]: mismatched types + --> $DIR/issue-24036.rs:13:9 + | +13 | x = |c| c + 1; + | ^^^^^^^^^ expected closure, found a different closure + | + = note: expected type `[closure@$DIR/issue-24036.rs:12:17: 12:26]` + found type `[closure@$DIR/issue-24036.rs:13:9: 13:18]` + = note: no two closures, even if identical, have the same type + = help: consider boxing your closure and/or using it as a trait object + +error[E0308]: match arms have incompatible types + --> $DIR/issue-24036.rs:18:13 + | +18 | let x = match 1usize { + | _____________^ +19 | | //~^ ERROR match arms have incompatible types +20 | | 1 => |c| c + 1, +21 | | 2 => |c| c - 1, + | | --------- match arm with an incompatible type +22 | | _ => |c| c - 1 +23 | | }; + | |_____^ expected closure, found a different closure + | + = note: expected type `[closure@$DIR/issue-24036.rs:20:14: 20:23]` + found type `[closure@$DIR/issue-24036.rs:21:14: 21:23]` + = note: no two closures, even if identical, have the same type + = help: consider boxing your closure and/or using it as a trait object + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-24081.rs b/src/test/ui/issue-24081.rs similarity index 56% rename from src/test/compile-fail/issue-24081.rs rename to src/test/ui/issue-24081.rs index dc8fc01bbf..16530c509f 100644 --- a/src/test/compile-fail/issue-24081.rs +++ b/src/test/ui/issue-24081.rs @@ -8,26 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::ops::Add; //~ NOTE previous import of the trait `Add` here -use std::ops::Sub; //~ NOTE previous import of the trait `Sub` here -use std::ops::Mul; //~ NOTE previous import of the trait `Mul` here -use std::ops::Div; //~ NOTE previous import of the trait `Div` here -use std::ops::Rem; //~ NOTE previous import of the trait `Rem` here +use std::ops::Add; +use std::ops::Sub; +use std::ops::Mul; +use std::ops::Div; +use std::ops::Rem; type Add = bool; //~ ERROR the name `Add` is defined multiple times //~| `Add` redefined here -//~| NOTE `Add` must be defined only once in the type namespace of this module struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times //~| `Sub` redefined here -//~| NOTE `Sub` must be defined only once in the type namespace of this module enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times //~| `Mul` redefined here -//~| NOTE `Mul` must be defined only once in the type namespace of this module mod Div { } //~ ERROR the name `Div` is defined multiple times //~| `Div` redefined here -//~| NOTE `Div` must be defined only once in the type namespace of this module trait Rem { } //~ ERROR the name `Rem` is defined multiple times //~| `Rem` redefined here -//~| NOTE `Rem` must be defined only once in the type namespace of this module fn main() {} diff --git a/src/test/ui/issue-24081.stderr b/src/test/ui/issue-24081.stderr new file mode 100644 index 0000000000..969cf3577f --- /dev/null +++ b/src/test/ui/issue-24081.stderr @@ -0,0 +1,77 @@ +error[E0255]: the name `Add` is defined multiple times + --> $DIR/issue-24081.rs:17:1 + | +11 | use std::ops::Add; + | ------------- previous import of the trait `Add` here +... +17 | type Add = bool; //~ ERROR the name `Add` is defined multiple times + | ^^^^^^^^^^^^^^^^ `Add` redefined here + | + = note: `Add` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +11 | use std::ops::Add as OtherAdd; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Sub` is defined multiple times + --> $DIR/issue-24081.rs:19:1 + | +12 | use std::ops::Sub; + | ------------- previous import of the trait `Sub` here +... +19 | struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times + | ^^^^^^^^^^ `Sub` redefined here + | + = note: `Sub` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +12 | use std::ops::Sub as OtherSub; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Mul` is defined multiple times + --> $DIR/issue-24081.rs:21:1 + | +13 | use std::ops::Mul; + | ------------- previous import of the trait `Mul` here +... +21 | enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times + | ^^^^^^^^ `Mul` redefined here + | + = note: `Mul` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +13 | use std::ops::Mul as OtherMul; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Div` is defined multiple times + --> $DIR/issue-24081.rs:23:1 + | +14 | use std::ops::Div; + | ------------- previous import of the trait `Div` here +... +23 | mod Div { } //~ ERROR the name `Div` is defined multiple times + | ^^^^^^^ `Div` redefined here + | + = note: `Div` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +14 | use std::ops::Div as OtherDiv; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Rem` is defined multiple times + --> $DIR/issue-24081.rs:25:1 + | +15 | use std::ops::Rem; + | ------------- previous import of the trait `Rem` here +... +25 | trait Rem { } //~ ERROR the name `Rem` is defined multiple times + | ^^^^^^^^^ `Rem` redefined here + | + = note: `Rem` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +15 | use std::ops::Rem as OtherRem; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors + diff --git a/src/test/compile-fail/issue-24424.rs b/src/test/ui/issue-24424.rs similarity index 95% rename from src/test/compile-fail/issue-24424.rs rename to src/test/ui/issue-24424.rs index 8d4ea66f08..8e9f675b57 100644 --- a/src/test/compile-fail/issue-24424.rs +++ b/src/test/ui/issue-24424.rs @@ -13,6 +13,5 @@ trait Trait0<'l0> {} impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} //~^ ERROR type annotations required: cannot resolve `T0: Trait0<'l0>` -//~^^ NOTE required by `Trait0` fn main() {} diff --git a/src/test/ui/issue-24424.stderr b/src/test/ui/issue-24424.stderr new file mode 100644 index 0000000000..acdf348791 --- /dev/null +++ b/src/test/ui/issue-24424.stderr @@ -0,0 +1,10 @@ +error[E0283]: type annotations required: cannot resolve `T0: Trait0<'l0>` + --> $DIR/issue-24424.rs:14:1 + | +14 | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: required by `Trait0` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-25385.rs b/src/test/ui/issue-25385.rs similarity index 94% rename from src/test/compile-fail/issue-25385.rs rename to src/test/ui/issue-25385.rs index 4aacb6840e..aa941bc569 100644 --- a/src/test/compile-fail/issue-25385.rs +++ b/src/test/ui/issue-25385.rs @@ -17,7 +17,6 @@ macro_rules! foo { fn main() { let a = 1i32; foo!(a); - //~^ NOTE in this expansion of foo! foo!(1i32.foo()); //~^ ERROR no method named `foo` found for type `i32` in the current scope diff --git a/src/test/ui/issue-25385.stderr b/src/test/ui/issue-25385.stderr new file mode 100644 index 0000000000..467cfc5338 --- /dev/null +++ b/src/test/ui/issue-25385.stderr @@ -0,0 +1,17 @@ +error[E0599]: no method named `foo` found for type `i32` in the current scope + --> $DIR/issue-25385.rs:13:23 + | +13 | ($e:expr) => { $e.foo() } + | ^^^ +... +19 | foo!(a); + | -------- in this macro invocation + +error[E0599]: no method named `foo` found for type `i32` in the current scope + --> $DIR/issue-25385.rs:21:15 + | +21 | foo!(1i32.foo()); + | ^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-25793.rs b/src/test/ui/issue-25793.rs similarity index 86% rename from src/test/compile-fail/issue-25793.rs rename to src/test/ui/issue-25793.rs index ceefd583a5..4f3d29216e 100644 --- a/src/test/compile-fail/issue-25793.rs +++ b/src/test/ui/issue-25793.rs @@ -12,7 +12,6 @@ macro_rules! width( ($this:expr) => { $this.width.unwrap() //~^ ERROR cannot use `self.width` because it was mutably borrowed - //~| NOTE use of borrowed `*self` } ); @@ -27,8 +26,6 @@ impl HasInfo { fn get_other(&mut self) -> usize { self.get_size(width!(self)) - //~^ NOTE in this expansion of width! - //~| NOTE borrow of `*self` occurs here } } diff --git a/src/test/ui/issue-25793.stderr b/src/test/ui/issue-25793.stderr new file mode 100644 index 0000000000..914cc6fc42 --- /dev/null +++ b/src/test/ui/issue-25793.stderr @@ -0,0 +1,13 @@ +error[E0503]: cannot use `self.width` because it was mutably borrowed + --> $DIR/issue-25793.rs:13:9 + | +13 | $this.width.unwrap() + | ^^^^^^^^^^^ use of borrowed `*self` +... +28 | self.get_size(width!(self)) + | ---- ------------ in this macro invocation + | | + | borrow of `*self` occurs here + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-25826.rs b/src/test/ui/issue-25826.rs similarity index 93% rename from src/test/compile-fail/issue-25826.rs rename to src/test/ui/issue-25826.rs index 468282fa7c..00e1279d58 100644 --- a/src/test/compile-fail/issue-25826.rs +++ b/src/test/ui/issue-25826.rs @@ -12,6 +12,5 @@ fn id<T>(t: T) -> T { t } fn main() { const A: bool = id::<u8> as *const () < id::<u16> as *const (); //~^ ERROR raw pointers cannot be compared in constants [E0395] - //~^^ NOTE comparing raw pointers in static println!("{}", A); } diff --git a/src/test/ui/issue-25826.stderr b/src/test/ui/issue-25826.stderr new file mode 100644 index 0000000000..3b6599ccbd --- /dev/null +++ b/src/test/ui/issue-25826.stderr @@ -0,0 +1,8 @@ +error[E0395]: raw pointers cannot be compared in constants + --> $DIR/issue-25826.rs:13:21 + | +13 | const A: bool = id::<u8> as *const () < id::<u16> as *const (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comparing raw pointers in static + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26056.rs b/src/test/ui/issue-26056.rs similarity index 86% rename from src/test/compile-fail/issue-26056.rs rename to src/test/ui/issue-26056.rs index ded685152d..2dad235144 100644 --- a/src/test/compile-fail/issue-26056.rs +++ b/src/test/ui/issue-26056.rs @@ -29,6 +29,4 @@ fn main() { let _ = &() as &Map<Key=u32,MapValue=u32>; //~^ ERROR E0038 - //~| NOTE the trait cannot use `Self` as a type parameter - //~| NOTE the trait `Map` cannot be made into an object } diff --git a/src/test/ui/issue-26056.stderr b/src/test/ui/issue-26056.stderr new file mode 100644 index 0000000000..b95438314c --- /dev/null +++ b/src/test/ui/issue-26056.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Map` cannot be made into an object + --> $DIR/issue-26056.rs:30:13 + | +30 | as &Map<Key=u32,MapValue=u32>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object + | + = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26093.rs b/src/test/ui/issue-26093.rs similarity index 86% rename from src/test/compile-fail/issue-26093.rs rename to src/test/ui/issue-26093.rs index 39a53648cc..3489a2ca9b 100644 --- a/src/test/compile-fail/issue-26093.rs +++ b/src/test/ui/issue-26093.rs @@ -12,11 +12,9 @@ macro_rules! not_an_lvalue { ($thing:expr) => { $thing = 42; //~^ ERROR invalid left-hand side expression - //~^^ NOTE left-hand of expression not valid } } fn main() { not_an_lvalue!(99); - //~^ NOTE in this expansion of not_an_lvalue! } diff --git a/src/test/ui/issue-26093.stderr b/src/test/ui/issue-26093.stderr new file mode 100644 index 0000000000..c2b81b2ce4 --- /dev/null +++ b/src/test/ui/issue-26093.stderr @@ -0,0 +1,11 @@ +error[E0070]: invalid left-hand side expression + --> $DIR/issue-26093.rs:13:9 + | +13 | $thing = 42; + | ^^^^^^^^^^^ left-hand of expression not valid +... +19 | not_an_lvalue!(99); + | ------------------- in this macro invocation + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26472.rs b/src/test/ui/issue-26472.rs similarity index 91% rename from src/test/compile-fail/issue-26472.rs rename to src/test/ui/issue-26472.rs index 0d59a897ef..9b25eb72f3 100644 --- a/src/test/compile-fail/issue-26472.rs +++ b/src/test/ui/issue-26472.rs @@ -20,5 +20,4 @@ fn main() { let s = sub::S::new(); let v = s.len; //~^ ERROR field `len` of struct `sub::S` is private - //~| NOTE a method `len` also exists, perhaps you wish to call it } diff --git a/src/test/ui/issue-26472.stderr b/src/test/ui/issue-26472.stderr new file mode 100644 index 0000000000..5b61aa98c3 --- /dev/null +++ b/src/test/ui/issue-26472.stderr @@ -0,0 +1,10 @@ +error[E0616]: field `len` of struct `sub::S` is private + --> $DIR/issue-26472.rs:21:13 + | +21 | let v = s.len; + | ^^^^^ + | + = note: a method `len` also exists, perhaps you wish to call it + +error: aborting due to previous error + diff --git a/src/test/ui/issue-26548.stderr b/src/test/ui/issue-26548.stderr deleted file mode 100644 index 8bfe4ac733..0000000000 --- a/src/test/ui/issue-26548.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0391]: unsupported cyclic reference between types/traits detected - | -note: the cycle begins when computing layout of `S`... -note: ...which then requires computing layout of `std::option::Option<<S as Mirror>::It>`... -note: ...which then requires computing layout of `<S as Mirror>::It`... - = note: ...which then again requires computing layout of `S`, completing the cycle. - -error: aborting due to previous error - diff --git a/src/test/compile-fail/issue-26638.rs b/src/test/ui/issue-26638.rs similarity index 77% rename from src/test/compile-fail/issue-26638.rs rename to src/test/ui/issue-26638.rs index 9b8c7b2507..85a1058897 100644 --- a/src/test/compile-fail/issue-26638.rs +++ b/src/test/ui/issue-26638.rs @@ -10,16 +10,11 @@ fn parse_type(iter: Box<Iterator<Item=&str>+'static>) -> &str { iter.next() } //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP 2 lifetimes fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP lifetime cannot be derived -//~^^^ HELP consider giving it an explicit bounded or 'static lifetime fn parse_type_3() -> &str { unimplemented!() } //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP no value for it to be borrowed from -//~^^^ HELP consider giving it a 'static lifetime fn main() {} diff --git a/src/test/ui/issue-26638.stderr b/src/test/ui/issue-26638.stderr new file mode 100644 index 0000000000..3b124ff406 --- /dev/null +++ b/src/test/ui/issue-26638.stderr @@ -0,0 +1,28 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:11:58 + | +11 | fn parse_type(iter: Box<Iterator<Item=&str>+'static>) -> &str { iter.next() } + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from + +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:14:40 + | +14 | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:17:22 + | +17 | fn parse_type_3() -> &str { unimplemented!() } + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from + = help: consider giving it a 'static lifetime + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-26886.rs b/src/test/ui/issue-26886.rs similarity index 75% rename from src/test/compile-fail/issue-26886.rs rename to src/test/ui/issue-26886.rs index 9b19506019..24ef7cb74c 100644 --- a/src/test/compile-fail/issue-26886.rs +++ b/src/test/ui/issue-26886.rs @@ -8,13 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::sync::{self, Arc}; //~ NOTE previous import of the type `Arc` here - //~^ NOTE previous import of the module `sync` here +use std::sync::{self, Arc}; use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times - //~| NOTE `Arc` reimported here //~| `Arc` must be defined only once in the type namespace of this module use std::sync; //~ ERROR the name `sync` is defined multiple times - //~| NOTE `sync` reimported here //~| `sync` must be defined only once in the type namespace of this module fn main() { diff --git a/src/test/ui/issue-26886.stderr b/src/test/ui/issue-26886.stderr new file mode 100644 index 0000000000..cb2eca8706 --- /dev/null +++ b/src/test/ui/issue-26886.stderr @@ -0,0 +1,31 @@ +error[E0252]: the name `Arc` is defined multiple times + --> $DIR/issue-26886.rs:12:5 + | +11 | use std::sync::{self, Arc}; + | --- previous import of the type `Arc` here +12 | use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times + | ^^^^^^^^^^^^^^ `Arc` reimported here + | + = note: `Arc` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +12 | use std::sync::Arc as OtherArc; //~ ERROR the name `Arc` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0252]: the name `sync` is defined multiple times + --> $DIR/issue-26886.rs:14:5 + | +11 | use std::sync::{self, Arc}; + | ---- previous import of the module `sync` here +... +14 | use std::sync; //~ ERROR the name `sync` is defined multiple times + | ^^^^^^^^^ `sync` reimported here + | + = note: `sync` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +14 | use std::sync as Othersync; //~ ERROR the name `sync` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-27842.rs b/src/test/ui/issue-27842.rs similarity index 83% rename from src/test/compile-fail/issue-27842.rs rename to src/test/ui/issue-27842.rs index eb28e36dc0..d9dc3458a4 100644 --- a/src/test/compile-fail/issue-27842.rs +++ b/src/test/ui/issue-27842.rs @@ -13,12 +13,9 @@ fn main() { // the case where we show a suggestion let _ = tup[0]; //~^ ERROR cannot index into a value of type - //~| HELP to access tuple elements, use - //~| SUGGESTION tup.0 // the case where we show just a general hint let i = 0_usize; let _ = tup[i]; //~^ ERROR cannot index into a value of type - //~| HELP to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) } diff --git a/src/test/ui/issue-27842.stderr b/src/test/ui/issue-27842.stderr new file mode 100644 index 0000000000..2e3b20e43f --- /dev/null +++ b/src/test/ui/issue-27842.stderr @@ -0,0 +1,16 @@ +error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` + --> $DIR/issue-27842.rs:14:13 + | +14 | let _ = tup[0]; + | ^^^^^^ help: to access tuple elements, use: `tup.0` + +error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` + --> $DIR/issue-27842.rs:19:13 + | +19 | let _ = tup[i]; + | ^^^^^^ + | + = help: to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-27942.rs b/src/test/ui/issue-27942.rs similarity index 65% rename from src/test/compile-fail/issue-27942.rs rename to src/test/ui/issue-27942.rs index 0fa4184606..2234aede00 100644 --- a/src/test/compile-fail/issue-27942.rs +++ b/src/test/ui/issue-27942.rs @@ -11,18 +11,12 @@ pub trait Resources<'a> {} pub trait Buffer<'a, R: Resources<'a>> { - //~^ NOTE the lifetime 'a as defined on the trait at 13:1... - //~| NOTE ...does not necessarily outlive the lifetime 'a as defined on the trait fn select(&self) -> BufferViewHandle<R>; //~^ ERROR mismatched types //~| lifetime mismatch - //~| NOTE expected type `Resources<'_>` - //~| NOTE ...does not necessarily outlive the anonymous lifetime #1 defined on the method body //~| ERROR mismatched types //~| lifetime mismatch - //~| NOTE expected type `Resources<'_>` - //~| NOTE the anonymous lifetime #1 defined on the method body at 17:5... } pub struct BufferViewHandle<'a, R: 'a+Resources<'a>>(&'a R); diff --git a/src/test/ui/issue-27942.stderr b/src/test/ui/issue-27942.stderr new file mode 100644 index 0000000000..b580b8e731 --- /dev/null +++ b/src/test/ui/issue-27942.stderr @@ -0,0 +1,52 @@ +error[E0308]: mismatched types + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `Resources<'_>` + found type `Resources<'a>` +note: the anonymous lifetime #1 defined on the method body at 15:5... + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 13:1 + --> $DIR/issue-27942.rs:13:1 + | +13 | / pub trait Buffer<'a, R: Resources<'a>> { +14 | | +15 | | fn select(&self) -> BufferViewHandle<R>; +16 | | //~^ ERROR mismatched types +... | +19 | | //~| lifetime mismatch +20 | | } + | |_^ + +error[E0308]: mismatched types + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `Resources<'_>` + found type `Resources<'a>` +note: the lifetime 'a as defined on the trait at 13:1... + --> $DIR/issue-27942.rs:13:1 + | +13 | / pub trait Buffer<'a, R: Resources<'a>> { +14 | | +15 | | fn select(&self) -> BufferViewHandle<R>; +16 | | //~^ ERROR mismatched types +... | +19 | | //~| lifetime mismatch +20 | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 15:5 + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle<R>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-2848.rs b/src/test/ui/issue-2848.rs similarity index 84% rename from src/test/compile-fail/issue-2848.rs rename to src/test/ui/issue-2848.rs index 38bd7adefd..f3fc94434d 100644 --- a/src/test/compile-fail/issue-2848.rs +++ b/src/test/ui/issue-2848.rs @@ -20,7 +20,6 @@ fn main() { use bar::foo::{alpha, charlie}; match alpha { alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns - charlie => {} //~| NOTE pattern doesn't bind `beta` - //~| NOTE variable not in all patterns + charlie => {} } } diff --git a/src/test/ui/issue-2848.stderr b/src/test/ui/issue-2848.stderr new file mode 100644 index 0000000000..6d4ed9c011 --- /dev/null +++ b/src/test/ui/issue-2848.stderr @@ -0,0 +1,10 @@ +error[E0408]: variable `beta` is not bound in all patterns + --> $DIR/issue-2848.rs:22:7 + | +22 | alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns + | ^^^^^ ---- variable not in all patterns + | | + | pattern doesn't bind `beta` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-28568.rs b/src/test/ui/issue-28568.rs similarity index 88% rename from src/test/compile-fail/issue-28568.rs rename to src/test/ui/issue-28568.rs index f03daafc63..e8c3419885 100644 --- a/src/test/compile-fail/issue-28568.rs +++ b/src/test/ui/issue-28568.rs @@ -11,13 +11,11 @@ struct MyStruct; impl Drop for MyStruct { -//~^ NOTE first implementation here fn drop(&mut self) { } } impl Drop for MyStruct { //~^ ERROR conflicting implementations of trait -//~| NOTE conflicting implementation for `MyStruct` fn drop(&mut self) { } } diff --git a/src/test/ui/issue-28568.stderr b/src/test/ui/issue-28568.stderr new file mode 100644 index 0000000000..61717ee60f --- /dev/null +++ b/src/test/ui/issue-28568.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `MyStruct`: + --> $DIR/issue-28568.rs:17:1 + | +13 | impl Drop for MyStruct { + | ---------------------- first implementation here +... +17 | impl Drop for MyStruct { + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyStruct` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-28776.rs b/src/test/ui/issue-28776.rs similarity index 93% rename from src/test/compile-fail/issue-28776.rs rename to src/test/ui/issue-28776.rs index 4a36bc88fa..196c4bd272 100644 --- a/src/test/compile-fail/issue-28776.rs +++ b/src/test/ui/issue-28776.rs @@ -13,5 +13,4 @@ use std::ptr; fn main() { (&ptr::write)(1 as *mut _, 42); //~^ ERROR E0133 - //~| NOTE call to unsafe function } diff --git a/src/test/ui/issue-28776.stderr b/src/test/ui/issue-28776.stderr new file mode 100644 index 0000000000..cf24a8312a --- /dev/null +++ b/src/test/ui/issue-28776.stderr @@ -0,0 +1,8 @@ +error[E0133]: call to unsafe function requires unsafe function or block + --> $DIR/issue-28776.rs:14:5 + | +14 | (&ptr::write)(1 as *mut _, 42); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-28837.rs b/src/test/ui/issue-28837.rs similarity index 57% rename from src/test/compile-fail/issue-28837.rs rename to src/test/ui/issue-28837.rs index c7cf63bf2c..91ea18a8c6 100644 --- a/src/test/compile-fail/issue-28837.rs +++ b/src/test/ui/issue-28837.rs @@ -14,47 +14,32 @@ fn main() { let a = A; a + a; //~ ERROR binary operation `+` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Add` might be missing for `A` a - a; //~ ERROR binary operation `-` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Sub` might be missing for `A` a * a; //~ ERROR binary operation `*` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Mul` might be missing for `A` a / a; //~ ERROR binary operation `/` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Div` might be missing for `A` a % a; //~ ERROR binary operation `%` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Rem` might be missing for `A` a & a; //~ ERROR binary operation `&` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::BitAnd` might be missing for `A` a | a; //~ ERROR binary operation `|` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::BitOr` might be missing for `A` a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Shl` might be missing for `A` a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Shr` might be missing for `A` a == a; //~ ERROR binary operation `==` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialEq` might be missing for `A` a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialEq` might be missing for `A` a < a; //~ ERROR binary operation `<` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` a > a; //~ ERROR binary operation `>` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` } diff --git a/src/test/ui/issue-28837.stderr b/src/test/ui/issue-28837.stderr new file mode 100644 index 0000000000..8d9afb5be7 --- /dev/null +++ b/src/test/ui/issue-28837.stderr @@ -0,0 +1,122 @@ +error[E0369]: binary operation `+` cannot be applied to type `A` + --> $DIR/issue-28837.rs:16:5 + | +16 | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Add` might be missing for `A` + +error[E0369]: binary operation `-` cannot be applied to type `A` + --> $DIR/issue-28837.rs:18:5 + | +18 | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Sub` might be missing for `A` + +error[E0369]: binary operation `*` cannot be applied to type `A` + --> $DIR/issue-28837.rs:20:5 + | +20 | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Mul` might be missing for `A` + +error[E0369]: binary operation `/` cannot be applied to type `A` + --> $DIR/issue-28837.rs:22:5 + | +22 | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Div` might be missing for `A` + +error[E0369]: binary operation `%` cannot be applied to type `A` + --> $DIR/issue-28837.rs:24:5 + | +24 | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Rem` might be missing for `A` + +error[E0369]: binary operation `&` cannot be applied to type `A` + --> $DIR/issue-28837.rs:26:5 + | +26 | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::BitAnd` might be missing for `A` + +error[E0369]: binary operation `|` cannot be applied to type `A` + --> $DIR/issue-28837.rs:28:5 + | +28 | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::BitOr` might be missing for `A` + +error[E0369]: binary operation `<<` cannot be applied to type `A` + --> $DIR/issue-28837.rs:30:5 + | +30 | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::ops::Shl` might be missing for `A` + +error[E0369]: binary operation `>>` cannot be applied to type `A` + --> $DIR/issue-28837.rs:32:5 + | +32 | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::ops::Shr` might be missing for `A` + +error[E0369]: binary operation `==` cannot be applied to type `A` + --> $DIR/issue-28837.rs:34:5 + | +34 | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialEq` might be missing for `A` + +error[E0369]: binary operation `!=` cannot be applied to type `A` + --> $DIR/issue-28837.rs:36:5 + | +36 | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialEq` might be missing for `A` + +error[E0369]: binary operation `<` cannot be applied to type `A` + --> $DIR/issue-28837.rs:38:5 + | +38 | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error[E0369]: binary operation `<=` cannot be applied to type `A` + --> $DIR/issue-28837.rs:40:5 + | +40 | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error[E0369]: binary operation `>` cannot be applied to type `A` + --> $DIR/issue-28837.rs:42:5 + | +42 | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error[E0369]: binary operation `>=` cannot be applied to type `A` + --> $DIR/issue-28837.rs:44:5 + | +44 | a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error: aborting due to 15 previous errors + diff --git a/src/test/compile-fail/issue-28971.rs b/src/test/ui/issue-28971.rs similarity index 87% rename from src/test/compile-fail/issue-28971.rs rename to src/test/ui/issue-28971.rs index 1d14b71a40..e553fee5a6 100644 --- a/src/test/compile-fail/issue-28971.rs +++ b/src/test/ui/issue-28971.rs @@ -16,7 +16,8 @@ enum Foo { fn main(){ foo(|| { match Foo::Bar(1) { - Foo::Baz(..) => (), //~ ERROR no associated + Foo::Baz(..) => (), + //~^ ERROR no variant named `Baz` found for type `Foo` _ => (), } }); diff --git a/src/test/ui/issue-28971.stderr b/src/test/ui/issue-28971.stderr new file mode 100644 index 0000000000..6237aae67b --- /dev/null +++ b/src/test/ui/issue-28971.stderr @@ -0,0 +1,11 @@ +error[E0599]: no variant named `Baz` found for type `Foo` in the current scope + --> $DIR/issue-28971.rs:19:13 + | +13 | enum Foo { + | -------- variant `Baz` not found here +... +19 | Foo::Baz(..) => (), + | ^^^^^^^^^^^^ variant not found in `Foo` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-29124.rs b/src/test/ui/issue-29124.rs similarity index 86% rename from src/test/compile-fail/issue-29124.rs rename to src/test/ui/issue-29124.rs index a72dac0d5d..77fa8192b9 100644 --- a/src/test/compile-fail/issue-29124.rs +++ b/src/test/ui/issue-29124.rs @@ -24,8 +24,6 @@ fn func() -> ret { fn main() { obj::func.x(); //~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope - //~^^ NOTE obj::func is a function, perhaps you wish to call it func.x(); //~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope - //~^^ NOTE func is a function, perhaps you wish to call it } diff --git a/src/test/ui/issue-29124.stderr b/src/test/ui/issue-29124.stderr new file mode 100644 index 0000000000..0b81526d65 --- /dev/null +++ b/src/test/ui/issue-29124.stderr @@ -0,0 +1,18 @@ +error[E0599]: no method named `x` found for type `fn() -> ret {obj::func}` in the current scope + --> $DIR/issue-29124.rs:25:15 + | +25 | obj::func.x(); + | ^ + | + = note: obj::func is a function, perhaps you wish to call it + +error[E0599]: no method named `x` found for type `fn() -> ret {func}` in the current scope + --> $DIR/issue-29124.rs:27:10 + | +27 | func.x(); + | ^ + | + = note: func is a function, perhaps you wish to call it + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-30007.rs b/src/test/ui/issue-30007.rs similarity index 88% rename from src/test/compile-fail/issue-30007.rs rename to src/test/ui/issue-30007.rs index fa0b75da99..c17833ee83 100644 --- a/src/test/compile-fail/issue-30007.rs +++ b/src/test/ui/issue-30007.rs @@ -13,5 +13,5 @@ macro_rules! t { } fn main() { - let i: Vec<t!()>; //~ NOTE caused by the macro expansion here + let i: Vec<t!()>; } diff --git a/src/test/ui/issue-30007.stderr b/src/test/ui/issue-30007.stderr new file mode 100644 index 0000000000..24458ef44c --- /dev/null +++ b/src/test/ui/issue-30007.stderr @@ -0,0 +1,14 @@ +error: macro expansion ignores token `;` and any following + --> $DIR/issue-30007.rs:12:20 + | +12 | () => ( String ; ); //~ ERROR macro expansion ignores token `;` + | ^ + | +note: caused by the macro expansion here; the usage of `t!` is likely invalid in type context + --> $DIR/issue-30007.rs:16:16 + | +16 | let i: Vec<t!()>; + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-3008-1.rs b/src/test/ui/issue-3008-1.rs similarity index 85% rename from src/test/compile-fail/issue-3008-1.rs rename to src/test/ui/issue-3008-1.rs index 7ca6d9301a..89de27326b 100644 --- a/src/test/compile-fail/issue-3008-1.rs +++ b/src/test/ui/issue-3008-1.rs @@ -14,9 +14,8 @@ enum Foo { enum Bar { //~^ ERROR recursive type `Bar` has infinite size - //~| NOTE recursive type has infinite size BarNone, - BarSome(Bar) //~ NOTE recursive without indirection + BarSome(Bar) } fn main() { diff --git a/src/test/ui/issue-3008-1.stderr b/src/test/ui/issue-3008-1.stderr new file mode 100644 index 0000000000..7d8e10a760 --- /dev/null +++ b/src/test/ui/issue-3008-1.stderr @@ -0,0 +1,13 @@ +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-3008-1.rs:15:1 + | +15 | enum Bar { + | ^^^^^^^^ recursive type has infinite size +... +18 | BarSome(Bar) + | ---- recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-3008-2.rs b/src/test/ui/issue-3008-2.rs similarity index 86% rename from src/test/compile-fail/issue-3008-2.rs rename to src/test/ui/issue-3008-2.rs index 061d1facda..b627656c91 100644 --- a/src/test/compile-fail/issue-3008-2.rs +++ b/src/test/ui/issue-3008-2.rs @@ -11,8 +11,6 @@ enum foo { foo_(bar) } struct bar { x: bar } //~^ ERROR E0072 -//~| NOTE recursive type has infinite size -//~| NOTE recursive without indirection fn main() { } diff --git a/src/test/ui/issue-3008-2.stderr b/src/test/ui/issue-3008-2.stderr new file mode 100644 index 0000000000..2d5e2966df --- /dev/null +++ b/src/test/ui/issue-3008-2.stderr @@ -0,0 +1,12 @@ +error[E0072]: recursive type `bar` has infinite size + --> $DIR/issue-3008-2.rs:12:1 + | +12 | struct bar { x: bar } + | ^^^^^^^^^^ ------ recursive without indirection + | | + | recursive type has infinite size + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `bar` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-30255.rs b/src/test/ui/issue-30255.rs similarity index 78% rename from src/test/compile-fail/issue-30255.rs rename to src/test/ui/issue-30255.rs index e3f55ae51e..64f70ef2b6 100644 --- a/src/test/compile-fail/issue-30255.rs +++ b/src/test/ui/issue-30255.rs @@ -17,19 +17,17 @@ struct S<'a> { fn f(a: &S, b: i32) -> &i32 { //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say which one of `a`'s 2 lifetimes it is borrowed from panic!(); } fn g(a: &S, b: bool, c: &i32) -> &i32 { //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` panic!(); } fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d` panic!(); } +fn main() {} diff --git a/src/test/ui/issue-30255.stderr b/src/test/ui/issue-30255.stderr new file mode 100644 index 0000000000..b0c314912c --- /dev/null +++ b/src/test/ui/issue-30255.stderr @@ -0,0 +1,26 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:18:24 + | +18 | fn f(a: &S, b: i32) -> &i32 { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `a`'s 2 lifetimes it is borrowed from + +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:23:34 + | +23 | fn g(a: &S, b: bool, c: &i32) -> &i32 { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` + +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:28:44 + | +28 | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-30302.rs b/src/test/ui/issue-30302.rs similarity index 92% rename from src/test/compile-fail/issue-30302.rs rename to src/test/ui/issue-30302.rs index 01150ff137..51c76713a7 100644 --- a/src/test/compile-fail/issue-30302.rs +++ b/src/test/ui/issue-30302.rs @@ -22,7 +22,6 @@ fn is_empty<T>(s: Stack<T>) -> bool { match s { Nil => true, //~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack` -//~| HELP consider making the path in the pattern qualified: `Stack::Nil` _ => false //~^ ERROR unreachable pattern } diff --git a/src/test/ui/issue-30302.stderr b/src/test/ui/issue-30302.stderr new file mode 100644 index 0000000000..66e43d0859 --- /dev/null +++ b/src/test/ui/issue-30302.stderr @@ -0,0 +1,25 @@ +warning[E0170]: pattern binding `Nil` is named the same as one of the variants of the type `Stack` + --> $DIR/issue-30302.rs:23:9 + | +23 | Nil => true, + | ^^^ + | + = help: if you meant to match on a variant, consider making the path in the pattern qualified: `Stack::Nil` + +error: unreachable pattern + --> $DIR/issue-30302.rs:25:9 + | +23 | Nil => true, + | --- matches any value +24 | //~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack` +25 | _ => false + | ^ unreachable pattern + | +note: lint level defined here + --> $DIR/issue-30302.rs:14:9 + | +14 | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/ui/issue-3044.rs similarity index 94% rename from src/test/compile-fail/issue-3044.rs rename to src/test/ui/issue-3044.rs index 4c63f7761a..5708f160a4 100644 --- a/src/test/compile-fail/issue-3044.rs +++ b/src/test/ui/issue-3044.rs @@ -14,5 +14,4 @@ fn main() { needlesArr.iter().fold(|x, y| { }); //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied - //~| NOTE expected 2 parameters } diff --git a/src/test/ui/issue-3044.stderr b/src/test/ui/issue-3044.stderr new file mode 100644 index 0000000000..14f2d5195d --- /dev/null +++ b/src/test/ui/issue-3044.stderr @@ -0,0 +1,8 @@ +error[E0061]: this function takes 2 parameters but 1 parameter was supplied + --> $DIR/issue-3044.rs:14:23 + | +14 | needlesArr.iter().fold(|x, y| { + | ^^^^ expected 2 parameters + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-30730.rs b/src/test/ui/issue-30730.rs similarity index 82% rename from src/test/compile-fail/issue-30730.rs rename to src/test/ui/issue-30730.rs index d1af39a6c1..c57a34a90d 100644 --- a/src/test/compile-fail/issue-30730.rs +++ b/src/test/ui/issue-30730.rs @@ -9,8 +9,7 @@ // except according to those terms. #![warn(unused)] -#![deny(warnings)] //~ NOTE: lint level defined here +#![deny(warnings)] use std::thread; //~^ ERROR: unused import -//~| NOTE: #[deny(unused_imports)] implied by #[deny(warnings)] fn main() {} diff --git a/src/test/ui/issue-30730.stderr b/src/test/ui/issue-30730.stderr new file mode 100644 index 0000000000..192c1f542d --- /dev/null +++ b/src/test/ui/issue-30730.stderr @@ -0,0 +1,15 @@ +error: unused import: `std::thread` + --> $DIR/issue-30730.rs:13:5 + | +13 | use std::thread; + | ^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-30730.rs:12:9 + | +12 | #![deny(warnings)] + | ^^^^^^^^ + = note: #[deny(unused_imports)] implied by #[deny(warnings)] + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-31221.rs b/src/test/ui/issue-31221.rs similarity index 72% rename from src/test/compile-fail/issue-31221.rs rename to src/test/ui/issue-31221.rs index e2b80215ca..ca15a869a9 100644 --- a/src/test/compile-fail/issue-31221.rs +++ b/src/test/ui/issue-31221.rs @@ -12,9 +12,6 @@ #![allow(unused_variables)] #![allow(non_snake_case)] #![deny(unreachable_patterns)] -//~^ NOTE lint level defined here -//~^^ NOTE lint level defined here -//~^^^ NOTE lint level defined here #[derive(Clone, Copy)] enum Enum { @@ -28,26 +25,20 @@ fn main() { match s { Var1 => (), Var3 => (), - //~^ NOTE this pattern matches any value Var2 => (), //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern }; match &s { &Var1 => (), &Var3 => (), - //~^ NOTE this pattern matches any value &Var2 => (), //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern }; let t = (Var1, Var1); match t { (Var1, b) => (), (c, d) => (), - //~^ NOTE this pattern matches any value anything => () //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern }; } diff --git a/src/test/ui/issue-31221.stderr b/src/test/ui/issue-31221.stderr new file mode 100644 index 0000000000..1db48346c6 --- /dev/null +++ b/src/test/ui/issue-31221.stderr @@ -0,0 +1,32 @@ +error: unreachable pattern + --> $DIR/issue-31221.rs:28:9 + | +27 | Var3 => (), + | ---- matches any value +28 | Var2 => (), + | ^^^^ unreachable pattern + | +note: lint level defined here + --> $DIR/issue-31221.rs:14:9 + | +14 | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/issue-31221.rs:34:9 + | +33 | &Var3 => (), + | ----- matches any value +34 | &Var2 => (), + | ^^^^^ unreachable pattern + +error: unreachable pattern + --> $DIR/issue-31221.rs:41:9 + | +40 | (c, d) => (), + | ------ matches any value +41 | anything => () + | ^^^^^^^^ unreachable pattern + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-32326.rs b/src/test/ui/issue-32326.rs similarity index 83% rename from src/test/compile-fail/issue-32326.rs rename to src/test/ui/issue-32326.rs index 70a7cd8b97..8af243afc2 100644 --- a/src/test/compile-fail/issue-32326.rs +++ b/src/test/ui/issue-32326.rs @@ -13,10 +13,7 @@ // too big. enum Expr { //~ ERROR E0072 - //~| NOTE recursive type has infinite size Plus(Expr, Expr), - //~^ NOTE recursive without indirection - //~| NOTE recursive without indirection Literal(i64), } diff --git a/src/test/ui/issue-32326.stderr b/src/test/ui/issue-32326.stderr new file mode 100644 index 0000000000..f907e3adaf --- /dev/null +++ b/src/test/ui/issue-32326.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Expr` has infinite size + --> $DIR/issue-32326.rs:15:1 + | +15 | enum Expr { //~ ERROR E0072 + | ^^^^^^^^^ recursive type has infinite size +16 | Plus(Expr, Expr), + | ----- ----- recursive without indirection + | | + | recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Expr` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-32950.rs b/src/test/ui/issue-32950.rs similarity index 93% rename from src/test/compile-fail/issue-32950.rs rename to src/test/ui/issue-32950.rs index 20e5b1d72d..4e5cdd50b2 100644 --- a/src/test/compile-fail/issue-32950.rs +++ b/src/test/ui/issue-32950.rs @@ -10,7 +10,7 @@ #![feature(concat_idents)] -#[derive(Debug)] //~ NOTE in this expansion +#[derive(Debug)] struct Baz<T>( concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros ); diff --git a/src/test/ui/issue-32950.stderr b/src/test/ui/issue-32950.stderr new file mode 100644 index 0000000000..abfa03f4d5 --- /dev/null +++ b/src/test/ui/issue-32950.stderr @@ -0,0 +1,8 @@ +error: `derive` cannot be used on items with type macros + --> $DIR/issue-32950.rs:15:5 + | +15 | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/issue-33525.rs b/src/test/ui/issue-33525.rs index 0e777fe8a9..0589618a82 100644 --- a/src/test/ui/issue-33525.rs +++ b/src/test/ui/issue-33525.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - a; - "".lorem; - "".ipsum; + a; //~ ERROR cannot find value `a` + "".lorem; //~ ERROR no field + "".ipsum; //~ ERROR no field } diff --git a/src/test/ui/issue-33525.stderr b/src/test/ui/issue-33525.stderr index 5de2d98f86..4909340fa4 100644 --- a/src/test/ui/issue-33525.stderr +++ b/src/test/ui/issue-33525.stderr @@ -1,19 +1,19 @@ error[E0425]: cannot find value `a` in this scope --> $DIR/issue-33525.rs:12:5 | -12 | a; +12 | a; //~ ERROR cannot find value `a` | ^ not found in this scope error[E0609]: no field `lorem` on type `&'static str` --> $DIR/issue-33525.rs:13:8 | -13 | "".lorem; +13 | "".lorem; //~ ERROR no field | ^^^^^ error[E0609]: no field `ipsum` on type `&'static str` --> $DIR/issue-33525.rs:14:8 | -14 | "".ipsum; +14 | "".ipsum; //~ ERROR no field | ^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issue-33941.rs b/src/test/ui/issue-33941.rs index eb111d33b9..21c169c663 100644 --- a/src/test/ui/issue-33941.rs +++ b/src/test/ui/issue-33941.rs @@ -11,5 +11,6 @@ use std::collections::HashMap; fn main() { - for _ in HashMap::new().iter().cloned() {} + for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch + //~^ ERROR type mismatch } diff --git a/src/test/ui/issue-33941.stderr b/src/test/ui/issue-33941.stderr index 5a8d1fab3f..953e6fe77d 100644 --- a/src/test/ui/issue-33941.stderr +++ b/src/test/ui/issue-33941.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as std::iter::Iterator>::Item == &_` --> $DIR/issue-33941.rs:14:36 | -14 | for _ in HashMap::new().iter().cloned() {} +14 | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch | ^^^^^^ expected tuple, found reference | = note: expected type `(&_, &_)` @@ -10,7 +10,7 @@ error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as std::iter::Iterator>::Item == &_` --> $DIR/issue-33941.rs:14:5 | -14 | for _ in HashMap::new().iter().cloned() {} +14 | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference | = note: expected type `(&_, &_)` diff --git a/src/test/compile-fail/issue-34047.rs b/src/test/ui/issue-34047.rs similarity index 83% rename from src/test/compile-fail/issue-34047.rs rename to src/test/ui/issue-34047.rs index 630694d915..db28410250 100644 --- a/src/test/compile-fail/issue-34047.rs +++ b/src/test/ui/issue-34047.rs @@ -8,12 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const C: u8 = 0; //~ NOTE a constant `C` is defined here +const C: u8 = 0; fn main() { match 1u8 { mut C => {} //~ ERROR match bindings cannot shadow constants - //~^ NOTE cannot be named the same as a constant _ => {} } } diff --git a/src/test/ui/issue-34047.stderr b/src/test/ui/issue-34047.stderr new file mode 100644 index 0000000000..0c109bffb2 --- /dev/null +++ b/src/test/ui/issue-34047.stderr @@ -0,0 +1,11 @@ +error[E0530]: match bindings cannot shadow constants + --> $DIR/issue-34047.rs:15:13 + | +11 | const C: u8 = 0; + | ---------------- a constant `C` is defined here +... +15 | mut C => {} //~ ERROR match bindings cannot shadow constants + | ^ cannot be named the same as a constant + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-34209.rs b/src/test/ui/issue-34209.rs similarity index 84% rename from src/test/compile-fail/issue-34209.rs rename to src/test/ui/issue-34209.rs index 5e3b777cc0..b3cb7d4cc3 100644 --- a/src/test/compile-fail/issue-34209.rs +++ b/src/test/ui/issue-34209.rs @@ -16,8 +16,6 @@ fn bug(l: S) { match l { S::B{ } => { }, //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<S as Trait>::B` } } diff --git a/src/test/ui/issue-34209.stderr b/src/test/ui/issue-34209.stderr new file mode 100644 index 0000000000..a832aab4c2 --- /dev/null +++ b/src/test/ui/issue-34209.stderr @@ -0,0 +1,10 @@ +error[E0223]: ambiguous associated type + --> $DIR/issue-34209.rs:17:9 + | +17 | S::B{ } => { }, + | ^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<S as Trait>::B` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-35139.rs b/src/test/ui/issue-35139.rs similarity index 92% rename from src/test/compile-fail/issue-35139.rs rename to src/test/ui/issue-35139.rs index 5c4f161a50..67f0e7aaf9 100644 --- a/src/test/compile-fail/issue-35139.rs +++ b/src/test/ui/issue-35139.rs @@ -17,7 +17,6 @@ pub trait MethodType { pub struct MTFn; impl<'a> MethodType for MTFn { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter type GetProp = fmt::Debug + 'a; } diff --git a/src/test/ui/issue-35139.stderr b/src/test/ui/issue-35139.stderr new file mode 100644 index 0000000000..19356cad31 --- /dev/null +++ b/src/test/ui/issue-35139.stderr @@ -0,0 +1,8 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-35139.rs:19:6 + | +19 | impl<'a> MethodType for MTFn { //~ ERROR E0207 + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + diff --git a/src/test/ui/issue-35241.rs b/src/test/ui/issue-35241.rs index 7ec3974854..4616f25bdf 100644 --- a/src/test/ui/issue-35241.rs +++ b/src/test/ui/issue-35241.rs @@ -10,6 +10,6 @@ struct Foo(u32); -fn test() -> Foo { Foo } +fn test() -> Foo { Foo } //~ ERROR mismatched types fn main() {} diff --git a/src/test/ui/issue-35241.stderr b/src/test/ui/issue-35241.stderr index bb1bba152b..25cef73889 100644 --- a/src/test/ui/issue-35241.stderr +++ b/src/test/ui/issue-35241.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-35241.rs:13:20 | -13 | fn test() -> Foo { Foo } +13 | fn test() -> Foo { Foo } //~ ERROR mismatched types | --- ^^^ | | | | | expected struct `Foo`, found fn item diff --git a/src/test/ui/issue-35675.rs b/src/test/ui/issue-35675.rs index 001c1f2edd..f349546815 100644 --- a/src/test/ui/issue-35675.rs +++ b/src/test/ui/issue-35675.rs @@ -9,48 +9,34 @@ // except according to those terms. // these two HELPs are actually in a new line between this line and the `enum Fruit` line -enum Fruit { //~ HELP possible candidate is found in another module, you can import it into scope - //~^ HELP possible candidate is found in another module, you can import it into scope +enum Fruit { Apple(i64), - //~^ HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`? - //~| HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`? Orange(i64), } fn should_return_fruit() -> Apple { //~^ ERROR cannot find type `Apple` in this scope - //~| NOTE not found in this scope Apple(5) //~^ ERROR cannot find function `Apple` in this scope - //~| NOTE not found in this scope } fn should_return_fruit_too() -> Fruit::Apple { //~^ ERROR expected type, found variant `Fruit::Apple` - //~| NOTE not a type Apple(5) //~^ ERROR cannot find function `Apple` in this scope - //~| NOTE not found in this scope } fn foo() -> Ok { //~^ ERROR expected type, found variant `Ok` - //~| NOTE not a type - //~| HELP there is an enum variant - //~| HELP there is an enum variant Ok(()) } fn bar() -> Variant3 { //~^ ERROR cannot find type `Variant3` in this scope - //~| NOTE not found in this scope } fn qux() -> Some { //~^ ERROR expected type, found variant `Some` - //~| NOTE not a type - //~| HELP there is an enum variant - //~| HELP there is an enum variant Some(1) } @@ -61,7 +47,6 @@ mod x { Variant1, Variant2(), Variant3(usize), - //~^ HELP there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`? Variant4 {}, } } diff --git a/src/test/ui/issue-35675.stderr b/src/test/ui/issue-35675.stderr index e125d74e28..c4d0e51c07 100644 --- a/src/test/ui/issue-35675.stderr +++ b/src/test/ui/issue-35675.stderr @@ -1,16 +1,16 @@ error[E0412]: cannot find type `Apple` in this scope - --> $DIR/issue-35675.rs:20:29 + --> $DIR/issue-35675.rs:17:29 | -20 | fn should_return_fruit() -> Apple { +17 | fn should_return_fruit() -> Apple { | ^^^^^ | | | not found in this scope | help: you can try using the variant's enum: `Fruit` error[E0425]: cannot find function `Apple` in this scope - --> $DIR/issue-35675.rs:23:5 + --> $DIR/issue-35675.rs:19:5 | -23 | Apple(5) +19 | Apple(5) | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -18,18 +18,18 @@ help: possible candidate is found in another module, you can import it into scop | error[E0573]: expected type, found variant `Fruit::Apple` - --> $DIR/issue-35675.rs:28:33 + --> $DIR/issue-35675.rs:23:33 | -28 | fn should_return_fruit_too() -> Fruit::Apple { +23 | fn should_return_fruit_too() -> Fruit::Apple { | ^^^^^^^^^^^^ | | | not a type | help: you can try using the variant's enum: `Fruit` error[E0425]: cannot find function `Apple` in this scope - --> $DIR/issue-35675.rs:31:5 + --> $DIR/issue-35675.rs:25:5 | -31 | Apple(5) +25 | Apple(5) | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -37,27 +37,27 @@ help: possible candidate is found in another module, you can import it into scop | error[E0573]: expected type, found variant `Ok` - --> $DIR/issue-35675.rs:36:13 + --> $DIR/issue-35675.rs:29:13 | -36 | fn foo() -> Ok { +29 | fn foo() -> Ok { | ^^ not a type | = help: there is an enum variant `std::prelude::v1::Ok`, try using `std::prelude::v1`? = help: there is an enum variant `std::result::Result::Ok`, try using `std::result::Result`? error[E0412]: cannot find type `Variant3` in this scope - --> $DIR/issue-35675.rs:44:13 + --> $DIR/issue-35675.rs:34:13 | -44 | fn bar() -> Variant3 { +34 | fn bar() -> Variant3 { | ^^^^^^^^ | | | not found in this scope | help: you can try using the variant's enum: `x::Enum` error[E0573]: expected type, found variant `Some` - --> $DIR/issue-35675.rs:49:13 + --> $DIR/issue-35675.rs:38:13 | -49 | fn qux() -> Some { +38 | fn qux() -> Some { | ^^^^ not a type | = help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`? diff --git a/src/test/compile-fail/issue-35869.rs b/src/test/ui/issue-35869.rs similarity index 66% rename from src/test/compile-fail/issue-35869.rs rename to src/test/ui/issue-35869.rs index 1942fd38d1..17ee62aed1 100644 --- a/src/test/compile-fail/issue-35869.rs +++ b/src/test/ui/issue-35869.rs @@ -11,10 +11,10 @@ #![feature(conservative_impl_trait)] trait Foo { - fn foo(_: fn(u8) -> ()); //~ NOTE type in trait - fn bar(_: Option<u8>); //~ NOTE type in trait - fn baz(_: (u8, u16)); //~ NOTE type in trait - fn qux() -> u8; //~ NOTE type in trait + fn foo(_: fn(u8) -> ()); + fn bar(_: Option<u8>); + fn baz(_: (u8, u16)); + fn qux() -> u8; } struct Bar; @@ -22,20 +22,12 @@ struct Bar; impl Foo for Bar { fn foo(_: fn(u16) -> ()) {} //~^ ERROR method `foo` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn(fn(u8))` fn bar(_: Option<u16>) {} //~^ ERROR method `bar` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn(std::option::Option<u8>)` fn baz(_: (u16, u16)) {} //~^ ERROR method `baz` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn((u8, u16))` fn qux() -> u16 { 5u16 } //~^ ERROR method `qux` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn() -> u8` } fn main() {} diff --git a/src/test/ui/issue-35869.stderr b/src/test/ui/issue-35869.stderr new file mode 100644 index 0000000000..5d2772b06a --- /dev/null +++ b/src/test/ui/issue-35869.stderr @@ -0,0 +1,50 @@ +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/issue-35869.rs:23:15 + | +14 | fn foo(_: fn(u8) -> ()); + | ------------ type in trait +... +23 | fn foo(_: fn(u16) -> ()) {} + | ^^^^^^^^^^^^^ expected u8, found u16 + | + = note: expected type `fn(fn(u8))` + found type `fn(fn(u16))` + +error[E0053]: method `bar` has an incompatible type for trait + --> $DIR/issue-35869.rs:25:15 + | +15 | fn bar(_: Option<u8>); + | ---------- type in trait +... +25 | fn bar(_: Option<u16>) {} + | ^^^^^^^^^^^ expected u8, found u16 + | + = note: expected type `fn(std::option::Option<u8>)` + found type `fn(std::option::Option<u16>)` + +error[E0053]: method `baz` has an incompatible type for trait + --> $DIR/issue-35869.rs:27:15 + | +16 | fn baz(_: (u8, u16)); + | --------- type in trait +... +27 | fn baz(_: (u16, u16)) {} + | ^^^^^^^^^^ expected u8, found u16 + | + = note: expected type `fn((u8, u16))` + found type `fn((u16, u16))` + +error[E0053]: method `qux` has an incompatible type for trait + --> $DIR/issue-35869.rs:29:17 + | +17 | fn qux() -> u8; + | -- type in trait +... +29 | fn qux() -> u16 { 5u16 } + | ^^^ expected u8, found u16 + | + = note: expected type `fn() -> u8` + found type `fn() -> u16` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/issue-35976.rs b/src/test/ui/issue-35976.rs index 169d7b5591..d45b0c5a04 100644 --- a/src/test/ui/issue-35976.rs +++ b/src/test/ui/issue-35976.rs @@ -23,7 +23,6 @@ mod private { fn bar(arg: Box<private::Future>) { arg.wait(); //~^ ERROR the `wait` method cannot be invoked on a trait object - //~| another candidate was found in the following trait, perhaps add a `use` for it: } fn main() { diff --git a/src/test/ui/issue-35976.stderr b/src/test/ui/issue-35976.stderr index 9fb6744973..146d0ff72d 100644 --- a/src/test/ui/issue-35976.stderr +++ b/src/test/ui/issue-35976.stderr @@ -3,9 +3,10 @@ error: the `wait` method cannot be invoked on a trait object | 24 | arg.wait(); | ^^^^ +help: another candidate was found in the following trait, perhaps add a `use` for it: + | +11 | use private::Future; | - = note: another candidate was found in the following trait, perhaps add a `use` for it: - candidate #1: `use private::Future;` error: aborting due to previous error diff --git a/src/test/compile-fail/issue-36163.rs b/src/test/ui/issue-36163.rs similarity index 77% rename from src/test/compile-fail/issue-36163.rs rename to src/test/ui/issue-36163.rs index 9dad6ede77..2337f82afa 100644 --- a/src/test/compile-fail/issue-36163.rs +++ b/src/test/ui/issue-36163.rs @@ -9,16 +9,13 @@ // except according to those terms. const A: i32 = Foo::B; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant enum Foo { B = A, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant } enum Bar { C = Bar::C, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant } const D: i32 = A; diff --git a/src/test/ui/issue-36163.stderr b/src/test/ui/issue-36163.stderr new file mode 100644 index 0000000000..5a107d88f2 --- /dev/null +++ b/src/test/ui/issue-36163.stderr @@ -0,0 +1,20 @@ +error[E0265]: recursive constant + --> $DIR/issue-36163.rs:11:1 + | +11 | const A: i32 = Foo::B; //~ ERROR E0265 + | ^^^^^^^^^^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-36163.rs:14:9 + | +14 | B = A, //~ ERROR E0265 + | ^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-36163.rs:18:9 + | +18 | C = Bar::C, //~ ERROR E0265 + | ^^^^^^ recursion not allowed in constant + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/issue-36400.rs b/src/test/ui/issue-36400.rs index c0aec5b429..fa4361e42a 100644 --- a/src/test/ui/issue-36400.rs +++ b/src/test/ui/issue-36400.rs @@ -12,5 +12,5 @@ fn f(x: &mut u32) {} fn main() { let x = Box::new(3); - f(&mut *x); + f(&mut *x); //~ ERROR cannot borrow immutable } diff --git a/src/test/ui/issue-36400.stderr b/src/test/ui/issue-36400.stderr index 69e9c455f3..84e6855e23 100644 --- a/src/test/ui/issue-36400.stderr +++ b/src/test/ui/issue-36400.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable | 14 | let x = Box::new(3); | - consider changing this to `mut x` -15 | f(&mut *x); +15 | f(&mut *x); //~ ERROR cannot borrow immutable | ^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/compile-fail/issue-36708.rs b/src/test/ui/issue-36708.rs similarity index 92% rename from src/test/compile-fail/issue-36708.rs rename to src/test/ui/issue-36708.rs index 6146258fa8..92a724a7e9 100644 --- a/src/test/compile-fail/issue-36708.rs +++ b/src/test/ui/issue-36708.rs @@ -17,7 +17,6 @@ struct Bar; impl lib::Foo for Bar { fn foo<T>() {} //~^ ERROR E0049 - //~| NOTE found 1 type parameter, expected 0 } fn main() {} diff --git a/src/test/ui/issue-36708.stderr b/src/test/ui/issue-36708.stderr new file mode 100644 index 0000000000..016841de16 --- /dev/null +++ b/src/test/ui/issue-36708.stderr @@ -0,0 +1,8 @@ +error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/issue-36708.rs:18:11 + | +18 | fn foo<T>() {} + | ^^^ found 1 type parameter, expected 0 + +error: aborting due to previous error + diff --git a/src/test/ui/issue-37311-type-length-limit/issue-37311.rs b/src/test/ui/issue-37311-type-length-limit/issue-37311.rs index add96461f1..1e05bdb0c6 100644 --- a/src/test/ui/issue-37311-type-length-limit/issue-37311.rs +++ b/src/test/ui/issue-37311-type-length-limit/issue-37311.rs @@ -20,7 +20,7 @@ trait Foo { impl<T> Foo for T { #[allow(unconditional_recursion)] - fn recurse(&self) { + fn recurse(&self) { //~ ERROR reached the type-length limit (self, self).recurse(); } } diff --git a/src/test/ui/issue-37311-type-length-limit/issue-37311.stderr b/src/test/ui/issue-37311-type-length-limit/issue-37311.stderr index b51b683a1a..fe173867da 100644 --- a/src/test/ui/issue-37311-type-length-limit/issue-37311.stderr +++ b/src/test/ui/issue-37311-type-length-limit/issue-37311.stderr @@ -1,7 +1,7 @@ error: reached the type-length limit while instantiating `<T as Foo><(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...` --> $DIR/issue-37311.rs:23:5 | -23 | / fn recurse(&self) { +23 | / fn recurse(&self) { //~ ERROR reached the type-length limit 24 | | (self, self).recurse(); 25 | | } | |_____^ diff --git a/src/test/compile-fail/issue-3779.rs b/src/test/ui/issue-3779.rs similarity index 86% rename from src/test/compile-fail/issue-3779.rs rename to src/test/ui/issue-3779.rs index 10f73dc086..7490960da3 100644 --- a/src/test/compile-fail/issue-3779.rs +++ b/src/test/ui/issue-3779.rs @@ -10,9 +10,7 @@ struct S { //~^ ERROR E0072 - //~| NOTE recursive type has infinite size element: Option<S> - //~^ NOTE recursive without indirection } fn main() { diff --git a/src/test/ui/issue-3779.stderr b/src/test/ui/issue-3779.stderr new file mode 100644 index 0000000000..538304803b --- /dev/null +++ b/src/test/ui/issue-3779.stderr @@ -0,0 +1,13 @@ +error[E0072]: recursive type `S` has infinite size + --> $DIR/issue-3779.rs:11:1 + | +11 | struct S { + | ^^^^^^^^ recursive type has infinite size +12 | //~^ ERROR E0072 +13 | element: Option<S> + | ------------------ recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `S` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-37884.rs b/src/test/ui/issue-37884.rs similarity index 76% rename from src/test/compile-fail/issue-37884.rs rename to src/test/ui/issue-37884.rs index 6313293bf2..ea6403a3ee 100644 --- a/src/test/compile-fail/issue-37884.rs +++ b/src/test/ui/issue-37884.rs @@ -11,14 +11,11 @@ struct RepeatMut<'a, T>(T, &'a ()); impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { - //~^ NOTE ...does not necessarily outlive the lifetime 'a as defined on the impl type Item = &'a mut T; fn next(&'a mut self) -> Option<Self::Item> //~^ ERROR method not compatible with trait //~| lifetime mismatch - //~| NOTE expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` - //~| NOTE the anonymous lifetime #1 defined on the method body { Some(&mut self.0) } diff --git a/src/test/ui/issue-37884.stderr b/src/test/ui/issue-37884.stderr new file mode 100644 index 0000000000..439b123975 --- /dev/null +++ b/src/test/ui/issue-37884.stderr @@ -0,0 +1,37 @@ +error[E0308]: method not compatible with trait + --> $DIR/issue-37884.rs:16:5 + | +16 | / fn next(&'a mut self) -> Option<Self::Item> +17 | | //~^ ERROR method not compatible with trait +18 | | //~| lifetime mismatch +19 | | { +20 | | Some(&mut self.0) +21 | | } + | |_____^ lifetime mismatch + | + = note: expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` + found type `fn(&'a mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` +note: the anonymous lifetime #1 defined on the method body at 16:5... + --> $DIR/issue-37884.rs:16:5 + | +16 | / fn next(&'a mut self) -> Option<Self::Item> +17 | | //~^ ERROR method not compatible with trait +18 | | //~| lifetime mismatch +19 | | { +20 | | Some(&mut self.0) +21 | | } + | |_____^ +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:1 + --> $DIR/issue-37884.rs:13:1 + | +13 | / impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { +14 | | +15 | | type Item = &'a mut T; +16 | | fn next(&'a mut self) -> Option<Self::Item> +... | +21 | | } +22 | | } + | |_^ + +error: aborting due to previous error + diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-1.rs b/src/test/ui/issue-40402-ref-hints/issue-40402-1.rs index 7efa3bd9d5..f2de2030bd 100644 --- a/src/test/ui/issue-40402-ref-hints/issue-40402-1.rs +++ b/src/test/ui/issue-40402-ref-hints/issue-40402-1.rs @@ -16,5 +16,5 @@ struct Foo { fn main() { let mut f = Foo { v: Vec::new() }; f.v.push("hello".to_string()); - let e = f.v[0]; + let e = f.v[0]; //~ ERROR cannot move out of indexed content } diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-1.stderr b/src/test/ui/issue-40402-ref-hints/issue-40402-1.stderr index 56d0a5351c..173a60b0f0 100644 --- a/src/test/ui/issue-40402-ref-hints/issue-40402-1.stderr +++ b/src/test/ui/issue-40402-ref-hints/issue-40402-1.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of indexed content --> $DIR/issue-40402-1.rs:19:13 | -19 | let e = f.v[0]; +19 | let e = f.v[0]; //~ ERROR cannot move out of indexed content | ^^^^^^ | | | cannot move out of indexed content diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-2.rs b/src/test/ui/issue-40402-ref-hints/issue-40402-2.rs index 76e038b696..894923605c 100644 --- a/src/test/ui/issue-40402-ref-hints/issue-40402-2.rs +++ b/src/test/ui/issue-40402-ref-hints/issue-40402-2.rs @@ -12,5 +12,5 @@ // are nested within a pattern fn main() { let x = vec![(String::new(), String::new())]; - let (a, b) = x[0]; + let (a, b) = x[0]; //~ ERROR cannot move out of indexed content } diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-2.stderr b/src/test/ui/issue-40402-ref-hints/issue-40402-2.stderr index 0060b683bb..7b992e376d 100644 --- a/src/test/ui/issue-40402-ref-hints/issue-40402-2.stderr +++ b/src/test/ui/issue-40402-ref-hints/issue-40402-2.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of indexed content --> $DIR/issue-40402-2.rs:15:18 | -15 | let (a, b) = x[0]; +15 | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | - - ^^^^ cannot move out of indexed content | | | | | ...and here (use `ref b` or `ref mut b`) diff --git a/src/test/ui/issue-40782.rs b/src/test/ui/issue-40782.rs index 56ee225105..10dc177c7e 100644 --- a/src/test/ui/issue-40782.rs +++ b/src/test/ui/issue-40782.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - for i 0..2 { + for i 0..2 { //~ ERROR missing `in` } } diff --git a/src/test/ui/issue-40782.stderr b/src/test/ui/issue-40782.stderr index 0d49eebbdb..543233e0cc 100644 --- a/src/test/ui/issue-40782.stderr +++ b/src/test/ui/issue-40782.stderr @@ -1,7 +1,7 @@ error: missing `in` in `for` loop --> $DIR/issue-40782.rs:12:10 | -12 | for i 0..2 { +12 | for i 0..2 { //~ ERROR missing `in` | ^ help: try adding `in` here error: aborting due to previous error diff --git a/src/test/ui/issue-41652/issue_41652.rs b/src/test/ui/issue-41652/issue_41652.rs index 1874ee6cd3..f38c682d31 100644 --- a/src/test/ui/issue-41652/issue_41652.rs +++ b/src/test/ui/issue-41652/issue_41652.rs @@ -18,8 +18,6 @@ impl issue_41652_b::Tr for S { fn f() { 3.f() //~^ ERROR no method named `f` found for type `{integer}` in the current scope - //~| NOTE found the following associated functions - //~| NOTE candidate #1 is defined in the trait `issue_41652_b::Tr` } } diff --git a/src/test/ui/issue-42106.rs b/src/test/ui/issue-42106.rs index f13f1dd114..f35eee186a 100644 --- a/src/test/ui/issue-42106.rs +++ b/src/test/ui/issue-42106.rs @@ -10,7 +10,7 @@ fn do_something<T>(collection: &mut Vec<T>) { let _a = &collection; - collection.swap(1, 2); + collection.swap(1, 2); //~ ERROR also borrowed as immutable } fn main() {} diff --git a/src/test/ui/issue-42106.stderr b/src/test/ui/issue-42106.stderr index 481cdb5f5b..0f96377c06 100644 --- a/src/test/ui/issue-42106.stderr +++ b/src/test/ui/issue-42106.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*collection` as mutable because `collection` is als | 12 | let _a = &collection; | ---------- immutable borrow occurs here -13 | collection.swap(1, 2); +13 | collection.swap(1, 2); //~ ERROR also borrowed as immutable | ^^^^^^^^^^ mutable borrow occurs here 14 | } | - immutable borrow ends here diff --git a/src/test/ui/issue-42954.rs b/src/test/ui/issue-42954.rs index bdfdf44c0e..6fa2c69bf6 100644 --- a/src/test/ui/issue-42954.rs +++ b/src/test/ui/issue-42954.rs @@ -10,7 +10,7 @@ macro_rules! is_plainly_printable { ($i: ident) => { - $i as u32 < 0 + $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments }; } diff --git a/src/test/ui/issue-42954.stderr b/src/test/ui/issue-42954.stderr index 7287c8f37e..d0fc410c47 100644 --- a/src/test/ui/issue-42954.stderr +++ b/src/test/ui/issue-42954.stderr @@ -1,7 +1,7 @@ error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison --> $DIR/issue-42954.rs:13:19 | -13 | $i as u32 < 0 +13 | $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments | --------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/ui/issue-4335.rs similarity index 83% rename from src/test/compile-fail/issue-4335.rs rename to src/test/ui/issue-4335.rs index c5aae894c3..540504eb07 100644 --- a/src/test/compile-fail/issue-4335.rs +++ b/src/test/ui/issue-4335.rs @@ -15,10 +15,7 @@ fn id<T>(t: T) -> T { t } fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> { id(Box::new(|| *v)) //~^ ERROR E0373 - //~| NOTE `v` is borrowed here - //~| NOTE may outlive borrowed value `v` //~| ERROR E0507 - //~| NOTE cannot move out of borrowed content } fn main() { diff --git a/src/test/ui/issue-4335.stderr b/src/test/ui/issue-4335.stderr new file mode 100644 index 0000000000..5840838b82 --- /dev/null +++ b/src/test/ui/issue-4335.stderr @@ -0,0 +1,20 @@ +error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function + --> $DIR/issue-4335.rs:16:17 + | +16 | id(Box::new(|| *v)) + | ^^ - `v` is borrowed here + | | + | may outlive borrowed value `v` +help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword + | +16 | id(Box::new(move || *v)) + | ^^^^^^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/issue-4335.rs:16:20 + | +16 | id(Box::new(|| *v)) + | ^^ cannot move out of borrowed content + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issue-44023.rs b/src/test/ui/issue-44023.rs index 295d480828..97b82dc58d 100644 --- a/src/test/ui/issue-44023.rs +++ b/src/test/ui/issue-44023.rs @@ -12,5 +12,5 @@ pub fn main () {} -fn საჭმელად_გემრიელი_სადილი ( ) -> isize { +fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types } diff --git a/src/test/ui/issue-44023.stderr b/src/test/ui/issue-44023.stderr index a17512ba4a..fc6363dc92 100644 --- a/src/test/ui/issue-44023.stderr +++ b/src/test/ui/issue-44023.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-44023.rs:15:42 | -15 | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { +15 | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types | __________________________________________^ 16 | | } | |_^ expected isize, found () diff --git a/src/test/ui/issue-44078.rs b/src/test/ui/issue-44078.rs index ef47214f2b..356a7be0b4 100644 --- a/src/test/ui/issue-44078.rs +++ b/src/test/ui/issue-44078.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - "😊""; + "😊""; //~ ERROR unterminated double quote } diff --git a/src/test/ui/issue-44078.stderr b/src/test/ui/issue-44078.stderr index 2ed4578d53..49e461bd18 100644 --- a/src/test/ui/issue-44078.stderr +++ b/src/test/ui/issue-44078.stderr @@ -1,7 +1,7 @@ error: unterminated double quote string --> $DIR/issue-44078.rs:12:8 | -12 | "😊""; +12 | "😊""; //~ ERROR unterminated double quote | _________^ 13 | | } | |__^ diff --git a/src/test/ui/issue-44406.rs b/src/test/ui/issue-44406.rs index abf572118f..8e99caff4e 100644 --- a/src/test/ui/issue-44406.rs +++ b/src/test/ui/issue-44406.rs @@ -15,5 +15,6 @@ macro_rules! foo { } fn main() { - foo!(true); + foo!(true); //~ ERROR expected type, found keyword + //~^ ERROR expected identifier, found keyword } diff --git a/src/test/ui/issue-44406.stderr b/src/test/ui/issue-44406.stderr index e7afbb574e..dd6435a954 100644 --- a/src/test/ui/issue-44406.stderr +++ b/src/test/ui/issue-44406.stderr @@ -1,7 +1,7 @@ error: expected identifier, found keyword `true` --> $DIR/issue-44406.rs:18:10 | -18 | foo!(true); +18 | foo!(true); //~ ERROR expected type, found keyword | ^^^^ error: expected type, found keyword `true` @@ -10,8 +10,6 @@ error: expected type, found keyword `true` 13 | bar(baz: $rest) | - help: did you mean to use `;` here? ... -18 | foo!(true); +18 | foo!(true); //~ ERROR expected type, found keyword | ^^^^ expecting a type here because of type ascription -error: aborting due to 2 previous errors - diff --git a/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.rs b/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.rs index 833fc2802a..2fce8d723d 100644 --- a/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.rs +++ b/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.rs @@ -14,13 +14,13 @@ fn main() { unsafe { let f = |v: &mut Vec<_>| { - unsafe { + unsafe { //~ ERROR unnecessary `unsafe` v.set_len(24); - |w: &mut Vec<u32>| { unsafe { + |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe` w.set_len(32); } }; } - |x: &mut Vec<u32>| { unsafe { + |x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe` x.set_len(40); } }; }; diff --git a/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.stderr b/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.stderr index be6b1e30a5..8c34cc4b73 100644 --- a/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.stderr +++ b/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -1,72 +1,35 @@ error: unnecessary `unsafe` block --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:17:13 | -17 | / unsafe { -18 | | v.set_len(24); -19 | | |w: &mut Vec<u32>| { unsafe { -20 | | w.set_len(32); -21 | | } }; -22 | | } - | |_____________^ unnecessary `unsafe` block +15 | unsafe { + | ------ because it's nested under this `unsafe` block +16 | let f = |v: &mut Vec<_>| { +17 | unsafe { //~ ERROR unnecessary `unsafe` + | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:11:8 | 11 | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ -note: because it's nested under this `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:15:5 - | -15 | / unsafe { -16 | | let f = |v: &mut Vec<_>| { -17 | | unsafe { -18 | | v.set_len(24); -... | -29 | | f(&mut v); -30 | | } - | |_____^ error: unnecessary `unsafe` block --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:19:38 | -19 | |w: &mut Vec<u32>| { unsafe { - | ______________________________________^ -20 | | w.set_len(32); -21 | | } }; - | |_________________^ unnecessary `unsafe` block - | -note: because it's nested under this `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:15:5 - | -15 | / unsafe { -16 | | let f = |v: &mut Vec<_>| { -17 | | unsafe { -18 | | v.set_len(24); -... | -29 | | f(&mut v); -30 | | } - | |_____^ +15 | unsafe { + | ------ because it's nested under this `unsafe` block +... +19 | |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe` + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:23:34 | -23 | |x: &mut Vec<u32>| { unsafe { - | __________________________________^ -24 | | x.set_len(40); -25 | | } }; - | |_____________^ unnecessary `unsafe` block - | -note: because it's nested under this `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:15:5 - | -15 | / unsafe { -16 | | let f = |v: &mut Vec<_>| { -17 | | unsafe { -18 | | v.set_len(24); -... | -29 | | f(&mut v); -30 | | } - | |_____^ +15 | unsafe { + | ------ because it's nested under this `unsafe` block +... +23 | |x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe` + | ^^^^^^ unnecessary `unsafe` block error: aborting due to 3 previous errors diff --git a/src/test/ui/issue-45296.rs b/src/test/ui/issue-45296.rs index 7a2b4e56d6..965747cfa0 100644 --- a/src/test/ui/issue-45296.rs +++ b/src/test/ui/issue-45296.rs @@ -11,5 +11,5 @@ fn main() { let unused = (); - #![allow(unused_variables)] + #![allow(unused_variables)] //~ ERROR not permitted in this context } diff --git a/src/test/ui/issue-45296.stderr b/src/test/ui/issue-45296.stderr index 1a660e4c67..45a80750de 100644 --- a/src/test/ui/issue-45296.stderr +++ b/src/test/ui/issue-45296.stderr @@ -1,7 +1,7 @@ error: an inner attribute is not permitted in this context --> $DIR/issue-45296.rs:14:7 | -14 | #![allow(unused_variables)] +14 | #![allow(unused_variables)] //~ ERROR not permitted in this context | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. diff --git a/src/test/ui/issue-45730.rs b/src/test/ui/issue-45730.rs index f725d69ca6..d733c8e6de 100644 --- a/src/test/ui/issue-45730.rs +++ b/src/test/ui/issue-45730.rs @@ -10,10 +10,10 @@ use std::fmt; fn main() { - let x: *const _ = 0 as _; + let x: *const _ = 0 as _; //~ ERROR cannot cast - let x: *const _ = 0 as *const _; + let x: *const _ = 0 as *const _; //~ ERROR cannot cast let y: Option<*const fmt::Debug> = Some(x) as _; - let x = 0 as *const i32 as *const _ as *mut _; + let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast } diff --git a/src/test/ui/issue-45730.stderr b/src/test/ui/issue-45730.stderr index c4f2e856b7..94d3923911 100644 --- a/src/test/ui/issue-45730.stderr +++ b/src/test/ui/issue-45730.stderr @@ -1,7 +1,7 @@ error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:13:23 | -13 | let x: *const _ = 0 as _; +13 | let x: *const _ = 0 as _; //~ ERROR cannot cast | ^^^^^- | | | help: consider giving more type information @@ -11,7 +11,7 @@ error[E0641]: cannot cast to a pointer of an unknown kind error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:15:23 | -15 | let x: *const _ = 0 as *const _; +15 | let x: *const _ = 0 as *const _; //~ ERROR cannot cast | ^^^^^-------- | | | help: consider giving more type information @@ -21,7 +21,7 @@ error[E0641]: cannot cast to a pointer of an unknown kind error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:18:13 | -18 | let x = 0 as *const i32 as *const _ as *mut _; +18 | let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------ | | | help: consider giving more type information diff --git a/src/test/ui/issue-46186.rs b/src/test/ui/issue-46186.rs new file mode 100644 index 0000000000..1440b9e8cd --- /dev/null +++ b/src/test/ui/issue-46186.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Struct { + a: usize, +}; //~ ERROR expected item, found `;` + +fn main() {} diff --git a/src/test/ui/issue-46186.stderr b/src/test/ui/issue-46186.stderr new file mode 100644 index 0000000000..3cc9531bb5 --- /dev/null +++ b/src/test/ui/issue-46186.stderr @@ -0,0 +1,8 @@ +error: expected item, found `;` + --> $DIR/issue-46186.rs:13:2 + | +13 | }; //~ ERROR expected item, found `;` + | ^ help: consider removing this semicolon + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/run-pass/issue-31267-additional.rs b/src/test/ui/issue-46332.rs similarity index 65% rename from src/tools/miri/tests/run-pass/issue-31267-additional.rs rename to src/test/ui/issue-46332.rs index 14e38f43c5..d094497e24 100644 --- a/src/tools/miri/tests/run-pass/issue-31267-additional.rs +++ b/src/test/ui/issue-46332.rs @@ -8,22 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_variables)] +// Original Levenshtein distance for both of this is 1. We improved accuracy with +// additional case insensitive comparison. -#[derive(Clone, Copy, Debug)] -struct Bar; +struct TyUint {} -const BAZ: Bar = Bar; - -#[derive(Debug)] -struct Foo([Bar; 1]); - -struct Biz; - -impl Biz { - const BAZ: Foo = Foo([BAZ; 1]); -} +struct TyInt {} fn main() { - let foo = Biz::BAZ; + TyUInt {}; + //~^ ERROR cannot find struct, variant or union type `TyUInt` in this scope } diff --git a/src/test/ui/issue-46332.stderr b/src/test/ui/issue-46332.stderr new file mode 100644 index 0000000000..6aef845683 --- /dev/null +++ b/src/test/ui/issue-46332.stderr @@ -0,0 +1,8 @@ +error[E0422]: cannot find struct, variant or union type `TyUInt` in this scope + --> $DIR/issue-46332.rs:19:5 + | +19 | TyUInt {}; + | ^^^^^^ did you mean `TyUint`? + +error: aborting due to previous error + diff --git a/src/test/ui/issue-46471-1.rs b/src/test/ui/issue-46471-1.rs new file mode 100644 index 0000000000..0dbcdea89f --- /dev/null +++ b/src/test/ui/issue-46471-1.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z emit-end-regions -Z borrowck=compare + +fn main() { + let y = { + let mut z = 0; + &mut z + }; + //~^^ ERROR `z` does not live long enough (Ast) [E0597] + //~| ERROR `z` does not live long enough (Mir) [E0597] + println!("{}", y); +} diff --git a/src/test/ui/issue-46471-1.stderr b/src/test/ui/issue-46471-1.stderr new file mode 100644 index 0000000000..9f12092f99 --- /dev/null +++ b/src/test/ui/issue-46471-1.stderr @@ -0,0 +1,24 @@ +error[E0597]: `z` does not live long enough (Ast) + --> $DIR/issue-46471-1.rs:16:14 + | +16 | &mut z + | ^ borrowed value does not live long enough +17 | }; + | - `z` dropped here while still borrowed +... +21 | } + | - borrowed value needs to live until here + +error[E0597]: `z` does not live long enough (Mir) + --> $DIR/issue-46471-1.rs:16:9 + | +16 | &mut z + | ^^^^^^ borrowed value does not live long enough +17 | }; + | - `z` dropped here while still borrowed +... +21 | } + | - borrowed value needs to live until here + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/feature-gate-abi-sysv64.rs b/src/test/ui/issue-46471.rs similarity index 66% rename from src/test/compile-fail/feature-gate-abi-sysv64.rs rename to src/test/ui/issue-46471.rs index 2a4aae8c06..8faedb7384 100644 --- a/src/test/compile-fail/feature-gate-abi-sysv64.rs +++ b/src/test/ui/issue-46471.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test that the sysv64 ABI cannot be used when abi-sysv64 feature -// gate is not used. +// compile-flags: -Z emit-end-regions -Z borrowck=compare -extern "sysv64" fn foo() {} -//~^ ERROR sysv64 ABI is experimental and subject to change - -fn main() { - foo(); +fn foo() -> &'static u32 { + let x = 0; + &x + //~^ ERROR `x` does not live long enough (Ast) [E0597] + //~| ERROR `x` does not live long enough (Mir) [E0597] } + +fn main() { } diff --git a/src/test/ui/issue-46471.stderr b/src/test/ui/issue-46471.stderr new file mode 100644 index 0000000000..19fc579d19 --- /dev/null +++ b/src/test/ui/issue-46471.stderr @@ -0,0 +1,24 @@ +error[E0597]: `x` does not live long enough (Ast) + --> $DIR/issue-46471.rs:15:6 + | +15 | &x + | ^ borrowed value does not live long enough +... +18 | } + | - borrowed value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error[E0597]: `x` does not live long enough (Mir) + --> $DIR/issue-46471.rs:15:5 + | +15 | &x + | ^^ borrowed value does not live long enough +... +18 | } + | - borrowed value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issue-46472.rs b/src/test/ui/issue-46472.rs new file mode 100644 index 0000000000..02c4dd7cb2 --- /dev/null +++ b/src/test/ui/issue-46472.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z emit-end-regions -Z borrowck=compare + +fn bar<'a>() -> &'a mut u32 { + &mut 4 + //~^ ERROR borrowed value does not live long enough (Ast) [E0597] + //~| ERROR borrowed value does not live long enough (Mir) [E0597] +} + +fn main() { } diff --git a/src/test/ui/issue-46472.stderr b/src/test/ui/issue-46472.stderr new file mode 100644 index 0000000000..50df72fc2a --- /dev/null +++ b/src/test/ui/issue-46472.stderr @@ -0,0 +1,40 @@ +error[E0597]: borrowed value does not live long enough (Ast) + --> $DIR/issue-46472.rs:14:10 + | +14 | &mut 4 + | ^ temporary value does not live long enough +... +17 | } + | - temporary value only lives until here + | +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:1... + --> $DIR/issue-46472.rs:13:1 + | +13 | / fn bar<'a>() -> &'a mut u32 { +14 | | &mut 4 +15 | | //~^ ERROR borrowed value does not live long enough (Ast) [E0597] +16 | | //~| ERROR borrowed value does not live long enough (Mir) [E0597] +17 | | } + | |_^ + +error[E0597]: borrowed value does not live long enough (Mir) + --> $DIR/issue-46472.rs:14:10 + | +14 | &mut 4 + | ^ temporary value does not live long enough +... +17 | } + | - temporary value only lives until here + | +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:1... + --> $DIR/issue-46472.rs:13:1 + | +13 | / fn bar<'a>() -> &'a mut u32 { +14 | | &mut 4 +15 | | //~^ ERROR borrowed value does not live long enough (Ast) [E0597] +16 | | //~| ERROR borrowed value does not live long enough (Mir) [E0597] +17 | | } + | |_^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issue-46576.rs b/src/test/ui/issue-46576.rs new file mode 100644 index 0000000000..80f15eb4ca --- /dev/null +++ b/src/test/ui/issue-46576.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] +#![deny(unused_imports)] + +use std::fs::File; +use std::io::{BufRead, BufReader, Read}; +//~^ ERROR unused import: `BufRead` + +pub fn read_from_file(path: &str) { + let file = File::open(&path).unwrap(); + let mut reader = BufReader::new(file); + let mut s = String::new(); + reader.read_to_string(&mut s).unwrap(); +} + +pub fn read_lines(s: &str) { + for _line in s.lines() { + + } +} + +fn main() {} diff --git a/src/test/ui/issue-46576.stderr b/src/test/ui/issue-46576.stderr new file mode 100644 index 0000000000..d73da19ebd --- /dev/null +++ b/src/test/ui/issue-46576.stderr @@ -0,0 +1,14 @@ +error: unused import: `BufRead` + --> $DIR/issue-46576.rs:15:15 + | +15 | use std::io::{BufRead, BufReader, Read}; + | ^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-46576.rs:12:9 + | +12 | #![deny(unused_imports)] + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs new file mode 100644 index 0000000000..e339716289 --- /dev/null +++ b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +type Guilty = bool; +type FineDollars = u32; + +struct Verdict(Guilty, Option<FineDollars>); + +fn main() { + let justice = Verdict(true, Some(2718)); + let _condemned = justice.00; + //~^ ERROR invalid tuple or struct index + let _punishment = justice.001; + //~^ ERROR invalid tuple or struct index +} diff --git a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr new file mode 100644 index 0000000000..24b3c263b6 --- /dev/null +++ b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr @@ -0,0 +1,14 @@ +error: invalid tuple or struct index + --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:18:30 + | +18 | let _condemned = justice.00; + | ^^ help: try simplifying the index: `0` + +error: invalid tuple or struct index + --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:20:31 + | +20 | let _punishment = justice.001; + | ^^^ help: try simplifying the index: `1` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-4935.rs b/src/test/ui/issue-4935.rs similarity index 95% rename from src/test/compile-fail/issue-4935.rs rename to src/test/ui/issue-4935.rs index e9f8367378..5b6e2c75a1 100644 --- a/src/test/compile-fail/issue-4935.rs +++ b/src/test/ui/issue-4935.rs @@ -14,4 +14,3 @@ fn foo(a: usize) {} //~^ defined here fn main() { foo(5, 6) } //~^ ERROR this function takes 1 parameter but 2 parameters were supplied -//~| NOTE expected 1 parameter diff --git a/src/test/ui/issue-4935.stderr b/src/test/ui/issue-4935.stderr new file mode 100644 index 0000000000..654fe53c07 --- /dev/null +++ b/src/test/ui/issue-4935.stderr @@ -0,0 +1,11 @@ +error[E0061]: this function takes 1 parameter but 2 parameters were supplied + --> $DIR/issue-4935.rs:15:13 + | +13 | fn foo(a: usize) {} + | ---------------- defined here +14 | //~^ defined here +15 | fn main() { foo(5, 6) } + | ^^^^^^^^^ expected 1 parameter + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-5239-1.rs b/src/test/ui/issue-5239-1.rs similarity index 92% rename from src/test/compile-fail/issue-5239-1.rs rename to src/test/ui/issue-5239-1.rs index a77b27150d..f88b693134 100644 --- a/src/test/compile-fail/issue-5239-1.rs +++ b/src/test/ui/issue-5239-1.rs @@ -13,5 +13,4 @@ fn main() { let x = |ref x: isize| { x += 1; }; //~^ ERROR E0368 - //~| NOTE cannot use `+=` on type `&isize` } diff --git a/src/test/ui/issue-5239-1.stderr b/src/test/ui/issue-5239-1.stderr new file mode 100644 index 0000000000..b97b58981d --- /dev/null +++ b/src/test/ui/issue-5239-1.stderr @@ -0,0 +1,10 @@ +error[E0368]: binary assignment operation `+=` cannot be applied to type `&isize` + --> $DIR/issue-5239-1.rs:14:30 + | +14 | let x = |ref x: isize| { x += 1; }; + | -^^^^^ + | | + | cannot use `+=` on type `&isize` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-6458-3.rs b/src/test/ui/issue-6458-3.rs similarity index 93% rename from src/test/compile-fail/issue-6458-3.rs rename to src/test/ui/issue-6458-3.rs index 1503da2baa..038f6043fa 100644 --- a/src/test/compile-fail/issue-6458-3.rs +++ b/src/test/ui/issue-6458-3.rs @@ -13,5 +13,4 @@ use std::mem; fn main() { mem::transmute(0); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `U` } diff --git a/src/test/ui/issue-6458-3.stderr b/src/test/ui/issue-6458-3.stderr new file mode 100644 index 0000000000..761a9b38f6 --- /dev/null +++ b/src/test/ui/issue-6458-3.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/issue-6458-3.rs:14:5 + | +14 | mem::transmute(0); + | ^^^^^^^^^^^^^^ cannot infer type for `U` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-6458-4.rs b/src/test/ui/issue-6458-4.rs similarity index 89% rename from src/test/compile-fail/issue-6458-4.rs rename to src/test/ui/issue-6458-4.rs index a078cdea4a..45934d03ed 100644 --- a/src/test/compile-fail/issue-6458-4.rs +++ b/src/test/ui/issue-6458-4.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo(b: bool) -> Result<bool,String> { //~ ERROR mismatched types - Err("bar".to_string()); //~ HELP consider removing this semicolon + Err("bar".to_string()); } fn main() { diff --git a/src/test/ui/issue-6458-4.stderr b/src/test/ui/issue-6458-4.stderr new file mode 100644 index 0000000000..6cc1edcd9f --- /dev/null +++ b/src/test/ui/issue-6458-4.stderr @@ -0,0 +1,15 @@ +error[E0308]: mismatched types + --> $DIR/issue-6458-4.rs:11:40 + | +11 | fn foo(b: bool) -> Result<bool,String> { //~ ERROR mismatched types + | ________________________________________^ +12 | | Err("bar".to_string()); + | | - help: consider removing this semicolon +13 | | } + | |_^ expected enum `std::result::Result`, found () + | + = note: expected type `std::result::Result<bool, std::string::String>` + found type `()` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-6458.rs b/src/test/ui/issue-6458.rs similarity index 94% rename from src/test/compile-fail/issue-6458.rs rename to src/test/ui/issue-6458.rs index db4d4e76c1..b4e7c0c40c 100644 --- a/src/test/compile-fail/issue-6458.rs +++ b/src/test/ui/issue-6458.rs @@ -18,7 +18,6 @@ pub fn foo<State>(_: TypeWithState<State>) {} pub fn bar() { foo(TypeWithState(marker::PhantomData)); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `State` } fn main() { diff --git a/src/test/ui/issue-6458.stderr b/src/test/ui/issue-6458.stderr new file mode 100644 index 0000000000..b5d4ac8313 --- /dev/null +++ b/src/test/ui/issue-6458.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/issue-6458.rs:19:4 + | +19 | foo(TypeWithState(marker::PhantomData)); + | ^^^ cannot infer type for `State` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-7813.rs b/src/test/ui/issue-7813.rs similarity index 87% rename from src/test/compile-fail/issue-7813.rs rename to src/test/ui/issue-7813.rs index a5f001b785..39a87bfaf7 100644 --- a/src/test/compile-fail/issue-7813.rs +++ b/src/test/ui/issue-7813.rs @@ -10,7 +10,5 @@ fn main() { let v = &[]; //~ ERROR type annotations needed - //~| NOTE consider giving `v` a type - //~| NOTE cannot infer type for `_` let it = v.iter(); } diff --git a/src/test/ui/issue-7813.stderr b/src/test/ui/issue-7813.stderr new file mode 100644 index 0000000000..11f8e4d00f --- /dev/null +++ b/src/test/ui/issue-7813.stderr @@ -0,0 +1,10 @@ +error[E0282]: type annotations needed + --> $DIR/issue-7813.rs:12:13 + | +12 | let v = &[]; //~ ERROR type annotations needed + | - ^^^ cannot infer type for `_` + | | + | consider giving `v` a type + +error: aborting due to previous error + diff --git a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs similarity index 71% rename from src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs rename to src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs index 2d9de57a26..a5fada7869 100644 --- a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs @@ -10,14 +10,11 @@ // Lifetime annotation needed because we have no arguments. fn f() -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP there is no value for it to be borrowed from -//~| HELP consider giving it a 'static lifetime panic!() } // Lifetime annotation needed because we have two by-reference parameters. fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say whether it is borrowed from `_x` or `_y` panic!() } @@ -28,13 +25,10 @@ struct Foo<'a> { // Lifetime annotation needed because we have two lifetimes: one as a parameter // and one on the reference. fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from panic!() } fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime panic!() } @@ -48,8 +42,6 @@ trait WithLifetime<'a> { // This worked because the type of the first argument contains // 'static, although StaticStr doesn't even have parameters. fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime panic!() } @@ -57,8 +49,6 @@ fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier // to <T as WithLifetime<'a>>::Output which has the hidden 'a. fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { //~^ ERROR missing lifetime specifier -//~| HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime panic!() } diff --git a/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr new file mode 100644 index 0000000000..f91b286bc4 --- /dev/null +++ b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -0,0 +1,54 @@ +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:12:11 + | +12 | fn f() -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from + = help: consider giving it a 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:33 + | +17 | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_x` or `_y` + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:27:19 + | +27 | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:31:20 + | +31 | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:44:24 + | +44 | fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:50:49 + | +50 | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.rs b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.rs index 04112c303b..5ded42e7c9 100644 --- a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.rs +++ b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.rs @@ -17,7 +17,7 @@ fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 { let p: &i32 = &a.field; &*p } else { - &*x + &*x //~ ERROR explicit lifetime } } diff --git a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr index 613c903853..9bfa72c2f3 100644 --- a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr +++ b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` 15 | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 { | - consider changing the type of `x` to `&'a i32` ... -20 | &*x +20 | &*x //~ ERROR explicit lifetime | ^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs index 55752f753e..1705767834 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs @@ -18,7 +18,7 @@ impl<'a> Foo<'a> { match *self { Foo::Bar(s) => { if s == "test" { - other + other //~ ERROR explicit lifetime } else { self.clone() } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr index d1660a620b..4c5e37b8f1 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `other` 17 | fn bar(&self, other: Foo) -> Foo<'a> { | ----- consider changing the type of `other` to `Foo<'a>` ... -21 | other +21 | other //~ ERROR explicit lifetime | ^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs index a1716c4e79..964f2f1c00 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - if x > y { x } else { y } + if x > y { x } else { y } //~ ERROR explicit lifetime } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr index 83716b7791..457e347faa 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | 11 | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | - consider changing the type of `x` to `&'a i32` -12 | if x > y { x } else { y } +12 | if x > y { x } else { y } //~ ERROR explicit lifetime | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs index 7bd32d8761..96d5c5bb16 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 { - if x > y { x } else { y } + if x > y { x } else { y } //~ ERROR explicit lifetime } fn main () { } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr index 6d5e94a5e7..8c3592379e 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in parameter type | 11 | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 { | ------ consider changing type to `(&'a i32, &'a i32)` -12 | if x > y { x } else { y } +12 | if x > y { x } else { y } //~ ERROR explicit lifetime | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs index 8849f7084b..5cf52fe79f 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs @@ -11,7 +11,7 @@ trait Foo { fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - if x > y { x } else { y } + if x > y { x } else { y } //~ ERROR explicit lifetime } } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr index 4288fdf89a..d5d1d16a42 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | 13 | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | - consider changing the type of `x` to `&'a i32` -14 | if x > y { x } else { y } +14 | if x > y { x } else { y } //~ ERROR explicit lifetime | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs index 362290ff3f..3727ddf912 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs @@ -15,7 +15,7 @@ struct Foo { impl Foo { fn foo<'a>(&'a self, x: &i32) -> &i32 { - if true { &self.field } else { x } + if true { &self.field } else { x } //~ ERROR explicit lifetime } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 95076bfbdc..23b9c0cf25 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` 16 | fn foo<'a>(&'a self, x: &i32) -> &i32 { | - consider changing the type of `x` to `&'a i32` 17 | -18 | if true { &self.field } else { x } +18 | if true { &self.field } else { x } //~ ERROR explicit lifetime | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs index 36d956a399..cec73d79ec 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs @@ -18,7 +18,7 @@ impl Foo for () { fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - if x > y { x } else { y } + if x > y { x } else { y } //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr index cb9a1edf1d..f418e1c01f 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr @@ -6,7 +6,7 @@ error[E0623]: lifetime mismatch | | | this parameter and the return type are declared with different lifetimes... 20 | -21 | if x > y { x } else { y } +21 | if x > y { x } else { y } //~ ERROR lifetime mismatch | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.rs index 30239f4c09..5ee2663317 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { - if x > y { x } else { y } + if x > y { x } else { y } //~ ERROR explicit lifetime } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr index 5d1336c7c3..b28f102cd5 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | 11 | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { | - consider changing the type of `y` to `&'a i32` -12 | if x > y { x } else { y } +12 | if x > y { x } else { y } //~ ERROR explicit lifetime | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs index 96b733be9b..4d57c61ba9 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs @@ -15,7 +15,7 @@ struct Foo { impl Foo { fn foo<'a>(&self, x: &'a i32) -> &i32 { - x + x //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index 8af6acc62c..d26cb6be70 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -6,7 +6,7 @@ error[E0623]: lifetime mismatch | | | this parameter and the return type are declared with different lifetimes... 17 | -18 | x +18 | x //~ ERROR lifetime mismatch | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs index a8ce60c47b..a6ccf4a53d 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs @@ -15,7 +15,7 @@ struct Foo { impl Foo { fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { - if true { x } else { self } + if true { x } else { self } //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index c09de0c33a..0430e4c271 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -6,7 +6,7 @@ error[E0623]: lifetime mismatch | | | this parameter and the return type are declared with different lifetimes... 17 | -18 | if true { x } else { self } +18 | if true { x } else { self } //~ ERROR lifetime mismatch | ^^^^ ...but data from `self` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.rs b/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.rs index 098950e13b..7f5b23728f 100644 --- a/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.rs +++ b/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(x: &i32, y: &i32) -> &i32 { +fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime if x > y { x } else { y } } diff --git a/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.stderr b/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.stderr index fccc44caac..7cd5ca6598 100644 --- a/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.stderr +++ b/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/ex1b-return-no-names-if-else.rs:11:29 | -11 | fn foo(x: &i32, y: &i32) -> &i32 { +11 | fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.rs b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.rs index dd34e1aa6d..f35a7555d7 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.rs +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.rs @@ -13,7 +13,7 @@ struct Ref<'a, T: 'a> { } fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) { - y.push(x); + y.push(x); //~ ERROR explicit lifetime } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr index 8dba0c33f2..7abc093512 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | 15 | fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) { | - consider changing the type of `x` to `Ref<'a, i32>` -16 | y.push(x); +16 | y.push(x); //~ ERROR explicit lifetime | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs index 5d18200820..18a720f345 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs @@ -14,7 +14,7 @@ fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) where i32: Foo<'a>, u32: Foo<'b> { - x.push(y); + x.push(y); //~ ERROR explicit lifetime required } fn main() { let x = baz; diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr index 980f14a51d..ca522596fb 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `y` 13 | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) | - consider changing the type of `y` to `&'a T` ... -17 | x.push(y); +17 | x.push(y); //~ ERROR explicit lifetime required | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.rs b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.rs index 71a1c865e0..1834395bd3 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.rs +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.rs @@ -13,7 +13,7 @@ struct Ref<'a, T: 'a> { } fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) { - x.push(y); + x.push(y); //~ ERROR explicit lifetime } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr index e529d6ffe4..5d8f2c1dec 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | 15 | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) { | - consider changing the type of `y` to `Ref<'a, i32>` -16 | x.push(y); +16 | x.push(y); //~ ERROR explicit lifetime | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.rs b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.rs index 09038d8ce9..6cf626adf8 100644 --- a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.rs +++ b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.rs @@ -13,7 +13,7 @@ struct Ref<'a, T: 'a> { } fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) { - x.push(y); + x.push(y); //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr index 1ee0099799..69ff29db35 100644 --- a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr +++ b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 15 | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) { | -------- -------- these two types are declared with different lifetimes... -16 | x.push(y); +16 | x.push(y); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.rs b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.rs index cb083f778d..36bd1c3228 100644 --- a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.rs +++ b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.rs @@ -14,7 +14,7 @@ struct Ref<'a, T: 'a> { fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) { let z = Ref { data: y.data }; - x.push(z); + x.push(z); //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.stderr b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.stderr index 495af8ae20..dacb0708b0 100644 --- a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.stderr +++ b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch 15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... 16 | let z = Ref { data: y.data }; -17 | x.push(z); +17 | x.push(z); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.rs b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.rs index bcb7583bee..96316819e9 100644 --- a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.rs +++ b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.rs @@ -13,7 +13,7 @@ struct Ref<'a, T: 'a> { } fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) { - let a: &mut Vec<Ref<i32>> = x; + let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch let b = Ref { data: y.data }; a.push(b); } diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr index 1f250a8884..e30355891e 100644 --- a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr +++ b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... -16 | let a: &mut Vec<Ref<i32>> = x; +16 | let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs index 2d05adb7ec..9352ebc77f 100644 --- a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs +++ b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs @@ -13,7 +13,7 @@ struct Ref<'a, T: 'a> { } fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) { - let a: &mut Vec<Ref<i32>> = x; + let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch let b = Ref { data: y.data }; Vec::push(a, b); } diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.stderr b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.stderr index 343c35b871..841555c1fc 100644 --- a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.stderr +++ b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... -16 | let a: &mut Vec<Ref<i32>> = x; +16 | let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.rs index 905eae18d1..5d490824d0 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo((v, w): (&u8, &u8), x: &u8) { - v = x; + v = x; //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr index 74a40c87c2..5e1a4593ae 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 11 | fn foo((v, w): (&u8, &u8), x: &u8) { | --- --- these two types are declared with different lifetimes... -12 | v = x; +12 | v = x; //~ ERROR lifetime mismatch | ^ ...but data from `x` flows here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs index 51271243bd..fe6b40c05a 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs @@ -9,7 +9,8 @@ // except according to those terms. fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - z.push((x,y)); + z.push((x,y)); //~ ERROR lifetime mismatch + //~^ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr index 898866c75f..b5b90c077d 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... -12 | z.push((x,y)); +12 | z.push((x,y)); //~ ERROR lifetime mismatch | ^ ...but data flows into `z` here error[E0623]: lifetime mismatch @@ -11,7 +11,7 @@ error[E0623]: lifetime mismatch | 11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... -12 | z.push((x,y)); +12 | z.push((x,y)); //~ ERROR lifetime mismatch | ^ ...but data flows into `z` here error: aborting due to 2 previous errors diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs index 2fbf31aead..f16120ddc2 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs @@ -13,7 +13,7 @@ struct Ref<'a, 'b> { } fn foo(mut x: Ref, y: Ref) { - x.b = y.b; + x.b = y.b; //~ ERROR lifetime mismatch } fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr index 26f31defc9..e7317e63ab 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 15 | fn foo(mut x: Ref, y: Ref) { | --- --- these two types are declared with different lifetimes... -16 | x.b = y.b; +16 | x.b = y.b; //~ ERROR lifetime mismatch | ^^^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs index 120a7ca74a..78e6dc2d3e 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs @@ -13,7 +13,7 @@ struct Ref<'a, 'b> { } fn foo(mut x: Ref) { - x.a = x.b; + x.a = x.b; //~ ERROR lifetime mismatch } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr index 73460277de..71eef13a67 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr @@ -5,7 +5,7 @@ error[E0623]: lifetime mismatch | --- | | | this type is declared with multiple lifetimes... -16 | x.a = x.b; +16 | x.a = x.b; //~ ERROR lifetime mismatch | ^^^ ...but data with one lifetime flows into the other here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs index 606e611865..78e6dc2d3e 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs @@ -13,7 +13,7 @@ struct Ref<'a, 'b> { } fn foo(mut x: Ref) { - x.a = x.b; + x.a = x.b; //~ ERROR lifetime mismatch } fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr index fb524ae62c..61b59b8f12 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr @@ -5,7 +5,7 @@ error[E0623]: lifetime mismatch | --- | | | this type is declared with multiple lifetimes... -16 | x.a = x.b; +16 | x.a = x.b; //~ ERROR lifetime mismatch | ^^^ ...but data with one lifetime flows into the other here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs index 0fef709ae5..ffec0e8d5b 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs @@ -15,7 +15,7 @@ fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) where &'a (): Sized, &'b u32: Sized { - x.push(y); + x.push(y); //~ ERROR lifetime mismatch } fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr index 59bf5d1722..0b1b01d86b 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch 14 | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) | ------- ------- these two types are declared with different lifetimes... ... -18 | x.push(y); +18 | x.push(y); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs index a91d0b55dc..16d18f3095 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs @@ -12,7 +12,7 @@ struct Ref<'a> { } fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) { - x.push(y); + x.push(y); //~ ERROR lifetime mismatch } fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr index 8783512106..36885b7e07 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 14 | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) { | ------- ------- these two types are declared with different lifetimes... -15 | x.push(y); +15 | x.push(y); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs index 67ba8ee532..3b90b3474a 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs @@ -12,7 +12,7 @@ struct Ref<'a> { } fn foo(mut x: Vec<Ref>, y: Ref) { - x.push(y); + x.push(y); //~ ERROR lifetime mismatch } fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr index 6ad795400b..961b8e310f 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 14 | fn foo(mut x: Vec<Ref>, y: Ref) { | --- --- these two types are declared with different lifetimes... -15 | x.push(y); +15 | x.push(y); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs index 5abfc983f8..966b4f0b6c 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { - x.push(y); + x.push(y); //~ ERROR lifetime mismatch } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr index be628f226d..b70d26a99d 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 11 | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | ------ ------ these two types are declared with different lifetimes... -12 | x.push(y); +12 | x.push(y); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs index a8b1f53fc9..055c3f8046 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs @@ -11,7 +11,7 @@ struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut x: Ref, y: &u32) { - y = x.b; + y = x.b; //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr index 31c7ebf650..7a50371306 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr @@ -5,7 +5,7 @@ error[E0623]: lifetime mismatch | --- ---- | | | these two types are declared with different lifetimes... -14 | y = x.b; +14 | y = x.b; //~ ERROR lifetime mismatch | ^^^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs index 4933dbb7e7..474da4a7d1 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs @@ -11,7 +11,7 @@ struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { - y.b = x; + y.b = x; //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr index d54b526aef..66155bec0b 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 13 | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... -14 | y.b = x; +14 | y.b = x; //~ ERROR lifetime mismatch | ^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs index 4933dbb7e7..474da4a7d1 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs @@ -11,7 +11,7 @@ struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { - y.b = x; + y.b = x; //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr index 40f026bcb1..d47cffbc62 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 13 | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... -14 | y.b = x; +14 | y.b = x; //~ ERROR lifetime mismatch | ^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs index e1594b1a27..1ffaec7ba0 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs @@ -14,7 +14,7 @@ struct Ref<'a, 'b> { } fn foo(mut x: Ref, y: &u32) { - x.b = y; + x.b = y; //~ ERROR lifetime mismatch } fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr index bb7b9ea684..43c85e43e7 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 16 | fn foo(mut x: Ref, y: &u32) { | --- ---- these two types are declared with different lifetimes... -17 | x.b = y; +17 | x.b = y; //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs index 0dc257ac09..97af359801 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs @@ -14,7 +14,7 @@ struct Foo { impl Foo { fn foo<'a>(&self, x: &i32) -> &i32 { - x + x //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr index 1409b21613..73927f0c1d 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -5,7 +5,7 @@ error[E0623]: lifetime mismatch | ---- ---- | | | this parameter and the return type are declared with different lifetimes... -17 | x +17 | x //~ ERROR lifetime mismatch | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs index 0940ce15d1..e6f4f0966c 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs @@ -14,7 +14,7 @@ struct Foo { impl Foo { fn foo<'a>(&self, x: &Foo) -> &Foo { - if true { x } else { self } + if true { x } else { self } //~ ERROR lifetime mismatch } } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr index cae45023e2..edb7ce2d6e 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -5,7 +5,7 @@ error[E0623]: lifetime mismatch | ---- ---- | | | this parameter and the return type are declared with different lifetimes... -17 | if true { x } else { self } +17 | if true { x } else { self } //~ ERROR lifetime mismatch | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs index 9220c34489..db53acf5af 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { - y.push(z); + y.push(z); //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr index adfc4dc0c2..065b669e69 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 10 | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... -11 | y.push(z); +11 | y.push(z); //~ ERROR lifetime mismatch | ^ ...but data from `z` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs index 3a7ba415c0..b3ef06f189 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs @@ -12,7 +12,7 @@ trait Foo { } impl Foo for () { fn foo(x: &mut Vec<&u8>, y: &u8) { - x.push(y); + x.push(y); //~ ERROR lifetime mismatch } } fn main() {} diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr index 9591df8e8a..20badfccd8 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 14 | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... -15 | x.push(y); +15 | x.push(y); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs index 78a6ad54ea..ebde6a3b53 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) { - y.push(z); + y.push(z); //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index ce766b2e40..b8a4d9ed24 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 10 | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... -11 | y.push(z); +11 | y.push(z); //~ ERROR lifetime mismatch | ^ ...but data from `z` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs b/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs index be48d07b94..f88eca494e 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo(x: &mut Vec<&u8>, y: &u8) { - x.push(y); + x.push(y); //~ ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr index d329106385..2a30172c43 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | 11 | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... -12 | x.push(y); +12 | x.push(y); //~ ERROR lifetime mismatch | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.rs b/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.rs new file mode 100644 index 0000000000..d4ef87cdd7 --- /dev/null +++ b/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.rs @@ -0,0 +1,54 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// FIXME: Change to UI Test +// Check notes are placed on an assignment that can actually preceed the current assigmnent +// Don't emmit a first assignment for assignment in a loop. + +// compile-flags: -Zborrowck=compare + +fn test() { + let x; + if true { + x = 1; + } else { + x = 2; + x = 3; //~ ERROR (Ast) [E0384] + //~^ ERROR (Mir) [E0384] + } +} + +fn test_in_loop() { + loop { + let x; + if true { + x = 1; + } else { + x = 2; + x = 3; //~ ERROR (Ast) [E0384] + //~^ ERROR (Mir) [E0384] + } + } +} + +fn test_using_loop() { + let x; + loop { + if true { + x = 1; //~ ERROR (Ast) [E0384] + //~^ ERROR (Mir) [E0384] + } else { + x = 2; //~ ERROR (Ast) [E0384] + //~^ ERROR (Mir) [E0384] + } + } +} + +fn main() {} diff --git a/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr new file mode 100644 index 0000000000..b8f738e445 --- /dev/null +++ b/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr @@ -0,0 +1,64 @@ +error[E0384]: cannot assign twice to immutable variable `x` (Ast) + --> $DIR/liveness-assign-imm-local-notes.rs:23:9 + | +22 | x = 2; + | ----- first assignment to `x` +23 | x = 3; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error[E0384]: cannot assign twice to immutable variable `x` (Ast) + --> $DIR/liveness-assign-imm-local-notes.rs:35:13 + | +34 | x = 2; + | ----- first assignment to `x` +35 | x = 3; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error[E0384]: cannot assign twice to immutable variable `x` (Ast) + --> $DIR/liveness-assign-imm-local-notes.rs:45:13 + | +45 | x = 1; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error[E0384]: cannot assign twice to immutable variable `x` (Ast) + --> $DIR/liveness-assign-imm-local-notes.rs:48:13 + | +45 | x = 1; //~ ERROR (Ast) [E0384] + | ----- first assignment to `x` +... +48 | x = 2; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error[E0384]: cannot assign twice to immutable variable `x` (Mir) + --> $DIR/liveness-assign-imm-local-notes.rs:23:9 + | +22 | x = 2; + | ----- first assignment to `x` +23 | x = 3; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error[E0384]: cannot assign twice to immutable variable `x` (Mir) + --> $DIR/liveness-assign-imm-local-notes.rs:35:13 + | +34 | x = 2; + | ----- first assignment to `x` +35 | x = 3; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error[E0384]: cannot assign twice to immutable variable `x` (Mir) + --> $DIR/liveness-assign-imm-local-notes.rs:45:13 + | +45 | x = 1; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error[E0384]: cannot assign twice to immutable variable `x` (Mir) + --> $DIR/liveness-assign-imm-local-notes.rs:48:13 + | +45 | x = 1; //~ ERROR (Ast) [E0384] + | ----- first assignment to `x` +... +48 | x = 2; //~ ERROR (Ast) [E0384] + | ^^^^^ cannot assign twice to immutable variable + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr index 6316c06666..66be3f964e 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr @@ -1,15 +1,15 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion.rs:12:27 + --> $DIR/borrowck-let-suggestion.rs:12:13 | 12 | let x = vec![1].iter(); - | ------- ^ temporary value dropped here while still borrowed + | ^^^^^^^ - temporary value dropped here while still borrowed | | - | temporary value created here + | temporary value does not live long enough 13 | } | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs index 242520cdb3..0099a8bc10 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs @@ -16,6 +16,7 @@ trait Collection { fn len(&self) -> usize; } struct List<'a, T: ListItem<'a>> { slice: &'a [T] + //~^ ERROR may not live long enough } impl<'a, T: ListItem<'a>> Collection for List<'a, T> { @@ -26,19 +27,32 @@ impl<'a, T: ListItem<'a>> Collection for List<'a, T> { struct Foo<T> { foo: &'static T + //~^ ERROR may not live long enough } trait X<K>: Sized { fn foo<'a, L: X<&'a Nested<K>>>(); + //~^ ERROR may not live long enough + // check that we give a sane error for `Self` fn bar<'a, L: X<&'a Nested<Self>>>(); + //~^ ERROR may not live long enough + + // check that we give a sane error for nested generics + fn baz<'a, L, M: X<&'a Nested<L>>>() { + //~^ ERROR may not live long enough + } } +trait TraitB {} + struct Nested<K>(K); impl<K> Nested<K> { fn generic_in_parent<'a, L: X<&'a Nested<K>>>() { + //~^ ERROR may not live long enough } fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() { + //~^ ERROR may not live long enough } } diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index 42e4f28260..05908606da 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -13,78 +13,101 @@ note: ...so that the reference type `&'a [T]` does not outlive the data it point | ^^^^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:29:5 | -27 | struct Foo<T> { +28 | struct Foo<T> { | - help: consider adding an explicit lifetime bound `T: 'static`... -28 | foo: &'static T +29 | foo: &'static T | ^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:29:5 | -28 | foo: &'static T +29 | foo: &'static T | ^^^^^^^^^^^^^^^ error[E0309]: the parameter type `K` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5 | -31 | trait X<K>: Sized { +33 | trait X<K>: Sized { | - help: consider adding an explicit lifetime bound `K: 'a`... -32 | fn foo<'a, L: X<&'a Nested<K>>>(); +34 | fn foo<'a, L: X<&'a Nested<K>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a Nested<K>` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5 | -32 | fn foo<'a, L: X<&'a Nested<K>>>(); +34 | fn foo<'a, L: X<&'a Nested<K>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:38:5 | -34 | fn bar<'a, L: X<&'a Nested<Self>>>(); +38 | fn bar<'a, L: X<&'a Nested<Self>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `Self: 'a`... note: ...so that the reference type `&'a Nested<Self>` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:38:5 | -34 | fn bar<'a, L: X<&'a Nested<Self>>>(); +38 | fn bar<'a, L: X<&'a Nested<Self>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0309]: the parameter type `K` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:39:5 +error[E0309]: the parameter type `L` may not live long enough + --> $DIR/lifetime-doesnt-live-long-enough.rs:42:5 | -38 | impl<K> Nested<K> { +42 | fn baz<'a, L, M: X<&'a Nested<L>>>() { + | ^ - help: consider adding an explicit lifetime bound `L: 'a`... + | _____| + | | +43 | | //~^ ERROR may not live long enough +44 | | } + | |_____^ + | +note: ...so that the reference type `&'a Nested<L>` does not outlive the data it points at + --> $DIR/lifetime-doesnt-live-long-enough.rs:42:5 + | +42 | / fn baz<'a, L, M: X<&'a Nested<L>>>() { +43 | | //~^ ERROR may not live long enough +44 | | } + | |_____^ + +error[E0309]: the parameter type `K` may not live long enough + --> $DIR/lifetime-doesnt-live-long-enough.rs:51:5 + | +50 | impl<K> Nested<K> { | - help: consider adding an explicit lifetime bound `K: 'a`... -39 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() { -40 | | } +51 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() { +52 | | //~^ ERROR may not live long enough +53 | | } | |_____^ | note: ...so that the reference type `&'a Nested<K>` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:39:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:51:5 | -39 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() { -40 | | } +51 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() { +52 | | //~^ ERROR may not live long enough +53 | | } | |_____^ error[E0309]: the parameter type `M` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:54:5 | -41 | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() { +54 | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() { | ^ -- help: consider adding an explicit lifetime bound `M: 'a`... | _____| | | -42 | | } +55 | | //~^ ERROR may not live long enough +56 | | } | |_____^ | note: ...so that the reference type `&'a Nested<M>` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:54:5 | -41 | / fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() { -42 | | } +54 | / fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() { +55 | | //~^ ERROR may not live long enough +56 | | } | |_____^ -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors diff --git a/src/test/compile-fail/lint-forbid-attr.rs b/src/test/ui/lint-forbid-attr.rs similarity index 89% rename from src/test/compile-fail/lint-forbid-attr.rs rename to src/test/ui/lint-forbid-attr.rs index a23083b5c8..65e01600c1 100644 --- a/src/test/compile-fail/lint-forbid-attr.rs +++ b/src/test/ui/lint-forbid-attr.rs @@ -9,10 +9,8 @@ // except according to those terms. #![forbid(deprecated)] -//~^ NOTE `forbid` level set here #[allow(deprecated)] //~^ ERROR allow(deprecated) overruled by outer forbid(deprecated) -//~| NOTE overruled by previous forbid fn main() { } diff --git a/src/test/ui/lint-forbid-attr.stderr b/src/test/ui/lint-forbid-attr.stderr new file mode 100644 index 0000000000..dcef7fb9ac --- /dev/null +++ b/src/test/ui/lint-forbid-attr.stderr @@ -0,0 +1,11 @@ +error[E0453]: allow(deprecated) overruled by outer forbid(deprecated) + --> $DIR/lint-forbid-attr.rs:13:9 + | +11 | #![forbid(deprecated)] + | ---------- `forbid` level set here +12 | +13 | #[allow(deprecated)] + | ^^^^^^^^^^ overruled by previous forbid + +error: aborting due to previous error + diff --git a/src/test/compile-fail/lint-output-format-2.rs b/src/test/ui/lint-output-format-2.rs similarity index 91% rename from src/test/compile-fail/lint-output-format-2.rs rename to src/test/ui/lint-output-format-2.rs index 8dc46558cb..5cd0084901 100644 --- a/src/test/compile-fail/lint-output-format-2.rs +++ b/src/test/ui/lint-output-format-2.rs @@ -19,12 +19,10 @@ extern crate lint_output_format; use lint_output_format::{foo, bar}; //~^ WARNING use of deprecated item 'lint_output_format::foo': text -//~| NOTE #[warn(deprecated)] on by default #[rustc_error] fn main() { //~ ERROR: compilation successful let _x = foo(); //~^ WARNING use of deprecated item 'lint_output_format::foo': text - //~| NOTE #[warn(deprecated)] on by default let _y = bar(); } diff --git a/src/test/ui/lint-output-format-2.stderr b/src/test/ui/lint-output-format-2.stderr new file mode 100644 index 0000000000..75e7e1f42f --- /dev/null +++ b/src/test/ui/lint-output-format-2.stderr @@ -0,0 +1,24 @@ +warning: use of deprecated item 'lint_output_format::foo': text + --> $DIR/lint-output-format-2.rs:20:26 + | +20 | use lint_output_format::{foo, bar}; + | ^^^ + | + = note: #[warn(deprecated)] on by default + +warning: use of deprecated item 'lint_output_format::foo': text + --> $DIR/lint-output-format-2.rs:25:14 + | +25 | let _x = foo(); + | ^^^ + +error: compilation successful + --> $DIR/lint-output-format-2.rs:24:1 + | +24 | / fn main() { //~ ERROR: compilation successful +25 | | let _x = foo(); +26 | | //~^ WARNING use of deprecated item 'lint_output_format::foo': text +27 | | let _y = bar(); +28 | | } + | |_^ + diff --git a/src/test/compile-fail/lint-unconditional-recursion.rs b/src/test/ui/lint-unconditional-recursion.rs similarity index 68% rename from src/test/compile-fail/lint-unconditional-recursion.rs rename to src/test/ui/lint-unconditional-recursion.rs index 94e189aa47..bfc144615a 100644 --- a/src/test/compile-fail/lint-unconditional-recursion.rs +++ b/src/test/ui/lint-unconditional-recursion.rs @@ -9,23 +9,10 @@ // except according to those terms. #![deny(unconditional_recursion)] -//~^ NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here -//~| NOTE lint level defined here + #![allow(dead_code)] fn foo() { //~ ERROR function cannot return without recurring - foo(); //~ NOTE recursive call site + foo(); } fn bar() { @@ -36,9 +23,9 @@ fn bar() { fn baz() { //~ ERROR function cannot return without recurring if true { - baz() //~ NOTE recursive call site + baz() } else { - baz() //~ NOTE recursive call site + baz() } } @@ -48,24 +35,24 @@ fn qux() { fn quz() -> bool { //~ ERROR function cannot return without recurring if true { - while quz() {} //~ NOTE recursive call site + while quz() {} true } else { - loop { quz(); } //~ NOTE recursive call site + loop { quz(); } } } // Trait method calls. trait Foo { fn bar(&self) { //~ ERROR function cannot return without recurring - self.bar() //~ NOTE recursive call site + self.bar() } } impl Foo for Box<Foo+'static> { fn bar(&self) { //~ ERROR function cannot return without recurring loop { - self.bar() //~ NOTE recursive call site + self.bar() } } } @@ -73,7 +60,7 @@ impl Foo for Box<Foo+'static> { // Trait method call with integer fallback after method resolution. impl Foo for i32 { fn bar(&self) { //~ ERROR function cannot return without recurring - 0.bar() //~ NOTE recursive call site + 0.bar() } } @@ -86,14 +73,14 @@ impl Foo for u32 { // Trait method calls via paths. trait Foo2 { fn bar(&self) { //~ ERROR function cannot return without recurring - Foo2::bar(self) //~ NOTE recursive call site + Foo2::bar(self) } } impl Foo2 for Box<Foo2+'static> { fn bar(&self) { //~ ERROR function cannot return without recurring loop { - Foo2::bar(self) //~ NOTE recursive call site + Foo2::bar(self) } } } @@ -102,19 +89,19 @@ struct Baz; impl Baz { // Inherent method call. fn qux(&self) { //~ ERROR function cannot return without recurring - self.qux(); //~ NOTE recursive call site + self.qux(); } // Inherent method call via path. fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring - Baz::as_ref(self) //~ NOTE recursive call site + Baz::as_ref(self) } } // Trait method calls to impls via paths. impl Default for Baz { fn default() -> Baz { //~ ERROR function cannot return without recurring - let x = Default::default(); //~ NOTE recursive call site + let x = Default::default(); x } } @@ -123,14 +110,14 @@ impl Default for Baz { impl std::ops::Deref for Baz { type Target = (); fn deref(&self) -> &() { //~ ERROR function cannot return without recurring - &**self //~ NOTE recursive call site + &**self } } impl std::ops::Index<usize> for Baz { type Output = Baz; fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring - &self[x] //~ NOTE recursive call site + &self[x] } } @@ -139,7 +126,7 @@ struct Quux; impl std::ops::Deref for Quux { type Target = Baz; fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring - self.as_ref() //~ NOTE recursive call site + self.as_ref() } } diff --git a/src/test/ui/lint-unconditional-recursion.stderr b/src/test/ui/lint-unconditional-recursion.stderr new file mode 100644 index 0000000000..f6f97654b5 --- /dev/null +++ b/src/test/ui/lint-unconditional-recursion.stderr @@ -0,0 +1,157 @@ +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:14:1 + | +14 | fn foo() { //~ ERROR function cannot return without recurring + | ^^^^^^^^ cannot return without recurring +15 | foo(); + | ----- recursive call site + | +note: lint level defined here + --> $DIR/lint-unconditional-recursion.rs:11:9 + | +11 | #![deny(unconditional_recursion)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:24:1 + | +24 | fn baz() { //~ ERROR function cannot return without recurring + | ^^^^^^^^ cannot return without recurring +25 | if true { +26 | baz() + | ----- recursive call site +27 | } else { +28 | baz() + | ----- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:36:1 + | +36 | fn quz() -> bool { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^ cannot return without recurring +37 | if true { +38 | while quz() {} + | ----- recursive call site +... +41 | loop { quz(); } + | ----- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:47:5 + | +47 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +48 | self.bar() + | ---------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:53:5 + | +53 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +54 | loop { +55 | self.bar() + | ---------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:62:5 + | +62 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +63 | 0.bar() + | ------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:75:5 + | +75 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +76 | Foo2::bar(self) + | --------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:81:5 + | +81 | fn bar(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +82 | loop { +83 | Foo2::bar(self) + | --------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:91:5 + | +91 | fn qux(&self) { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^ cannot return without recurring +92 | self.qux(); + | ---------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:96:5 + | +96 | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring +97 | Baz::as_ref(self) + | ----------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:103:5 + | +103 | fn default() -> Baz { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^ cannot return without recurring +104 | let x = Default::default(); + | ------------------ recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:112:5 + | +112 | fn deref(&self) -> &() { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring +113 | &**self + | ------ recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:119:5 + | +119 | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring +120 | &self[x] + | ------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:128:5 + | +128 | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring +129 | self.as_ref() + | ---- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: aborting due to 14 previous errors + diff --git a/src/test/ui/lint/command-line-lint-group-allow.rs b/src/test/ui/lint/command-line-lint-group-allow.rs index cdb9684933..c1840f3d44 100644 --- a/src/test/ui/lint/command-line-lint-group-allow.rs +++ b/src/test/ui/lint/command-line-lint-group-allow.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -A bad-style +// must-compile-successfully fn main() { let _InappropriateCamelCasing = true; diff --git a/src/test/ui/lint/command-line-lint-group-deny.rs b/src/test/ui/lint/command-line-lint-group-deny.rs index 1248601c1e..6ffc9b5aa1 100644 --- a/src/test/ui/lint/command-line-lint-group-deny.rs +++ b/src/test/ui/lint/command-line-lint-group-deny.rs @@ -11,5 +11,5 @@ // compile-flags: -D bad-style fn main() { - let _InappropriateCamelCasing = true; + let _InappropriateCamelCasing = true; //~ ERROR should have a snake } diff --git a/src/test/ui/lint/command-line-lint-group-deny.stderr b/src/test/ui/lint/command-line-lint-group-deny.stderr index 23fac66cc6..a6182de0a7 100644 --- a/src/test/ui/lint/command-line-lint-group-deny.stderr +++ b/src/test/ui/lint/command-line-lint-group-deny.stderr @@ -1,7 +1,7 @@ error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing` --> $DIR/command-line-lint-group-deny.rs:14:9 | -14 | let _InappropriateCamelCasing = true; +14 | let _InappropriateCamelCasing = true; //~ ERROR should have a snake | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D non-snake-case` implied by `-D bad-style` diff --git a/src/test/ui/lint/command-line-lint-group-forbid.rs b/src/test/ui/lint/command-line-lint-group-forbid.rs index ae16db4486..eb4645a4fc 100644 --- a/src/test/ui/lint/command-line-lint-group-forbid.rs +++ b/src/test/ui/lint/command-line-lint-group-forbid.rs @@ -11,5 +11,5 @@ // compile-flags: -F bad-style fn main() { - let _InappropriateCamelCasing = true; + let _InappropriateCamelCasing = true; //~ ERROR should have a snake } diff --git a/src/test/ui/lint/command-line-lint-group-forbid.stderr b/src/test/ui/lint/command-line-lint-group-forbid.stderr index 0babd7f6fe..7ae6734c8a 100644 --- a/src/test/ui/lint/command-line-lint-group-forbid.stderr +++ b/src/test/ui/lint/command-line-lint-group-forbid.stderr @@ -1,7 +1,7 @@ error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing` --> $DIR/command-line-lint-group-forbid.rs:14:9 | -14 | let _InappropriateCamelCasing = true; +14 | let _InappropriateCamelCasing = true; //~ ERROR should have a snake | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-F non-snake-case` implied by `-F bad-style` diff --git a/src/test/ui/lint/command-line-lint-group-warn.rs b/src/test/ui/lint/command-line-lint-group-warn.rs index 7d65c80278..048c15b123 100644 --- a/src/test/ui/lint/command-line-lint-group-warn.rs +++ b/src/test/ui/lint/command-line-lint-group-warn.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -W bad-style +// must-compile-successfully fn main() { let _InappropriateCamelCasing = true; diff --git a/src/test/ui/lint/command-line-lint-group-warn.stderr b/src/test/ui/lint/command-line-lint-group-warn.stderr index 998c892c7e..6562e16a45 100644 --- a/src/test/ui/lint/command-line-lint-group-warn.stderr +++ b/src/test/ui/lint/command-line-lint-group-warn.stderr @@ -1,7 +1,7 @@ warning: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing` - --> $DIR/command-line-lint-group-warn.rs:14:9 + --> $DIR/command-line-lint-group-warn.rs:15:9 | -14 | let _InappropriateCamelCasing = true; +15 | let _InappropriateCamelCasing = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-W non-snake-case` implied by `-W bad-style` diff --git a/src/test/ui/lint/lint-group-style.rs b/src/test/ui/lint/lint-group-style.rs index 2bd760e417..9f33f57f48 100644 --- a/src/test/ui/lint/lint-group-style.rs +++ b/src/test/ui/lint/lint-group-style.rs @@ -11,7 +11,7 @@ #![deny(bad_style)] #![allow(dead_code)] -fn CamelCase() {} +fn CamelCase() {} //~ ERROR should have a snake #[allow(bad_style)] mod test { @@ -19,17 +19,17 @@ mod test { #[forbid(bad_style)] mod bad { - fn CamelCase() {} + fn CamelCase() {} //~ ERROR should have a snake - static bad: isize = 1; + static bad: isize = 1; //~ ERROR should have an upper } mod warn { #![warn(bad_style)] - fn CamelCase() {} + fn CamelCase() {} //~ WARN should have a snake - struct snake_case; + struct snake_case; //~ WARN should have a camel } } diff --git a/src/test/ui/lint/lint-group-style.stderr b/src/test/ui/lint/lint-group-style.stderr index 862e94b873..3dfe2cee99 100644 --- a/src/test/ui/lint/lint-group-style.stderr +++ b/src/test/ui/lint/lint-group-style.stderr @@ -1,7 +1,7 @@ error: function `CamelCase` should have a snake case name such as `camel_case` --> $DIR/lint-group-style.rs:14:1 | -14 | fn CamelCase() {} +14 | fn CamelCase() {} //~ ERROR should have a snake | ^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -14,7 +14,7 @@ note: lint level defined here error: function `CamelCase` should have a snake case name such as `camel_case` --> $DIR/lint-group-style.rs:22:9 | -22 | fn CamelCase() {} +22 | fn CamelCase() {} //~ ERROR should have a snake | ^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -27,7 +27,7 @@ note: lint level defined here error: static variable `bad` should have an upper case name such as `BAD` --> $DIR/lint-group-style.rs:24:9 | -24 | static bad: isize = 1; +24 | static bad: isize = 1; //~ ERROR should have an upper | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -40,7 +40,7 @@ note: lint level defined here warning: function `CamelCase` should have a snake case name such as `camel_case` --> $DIR/lint-group-style.rs:30:9 | -30 | fn CamelCase() {} +30 | fn CamelCase() {} //~ WARN should have a snake | ^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -53,7 +53,7 @@ note: lint level defined here warning: type `snake_case` should have a camel case name such as `SnakeCase` --> $DIR/lint-group-style.rs:32:9 | -32 | struct snake_case; +32 | struct snake_case; //~ WARN should have a camel | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/not_found.rs b/src/test/ui/lint/not_found.rs index 5cdc19823c..3de2cc0bfa 100644 --- a/src/test/ui/lint/not_found.rs +++ b/src/test/ui/lint/not_found.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + // this tests the `unknown_lint` lint, especially the suggestions // the suggestion only appears if a lint with the lowercase name exists diff --git a/src/test/ui/lint/not_found.stderr b/src/test/ui/lint/not_found.stderr index 7326584549..16daceecb9 100644 --- a/src/test/ui/lint/not_found.stderr +++ b/src/test/ui/lint/not_found.stderr @@ -1,20 +1,20 @@ warning: unknown lint: `FOO_BAR` - --> $DIR/not_found.rs:14:9 + --> $DIR/not_found.rs:16:9 | -14 | #[allow(FOO_BAR)] +16 | #[allow(FOO_BAR)] | ^^^^^^^ | = note: #[warn(unknown_lints)] on by default warning: unknown lint: `DEAD_CODE` - --> $DIR/not_found.rs:16:8 + --> $DIR/not_found.rs:18:8 | -16 | #[warn(DEAD_CODE)] +18 | #[warn(DEAD_CODE)] | ^^^^^^^^^ help: lowercase the lint name: `dead_code` warning: unknown lint: `Warnings` - --> $DIR/not_found.rs:18:8 + --> $DIR/not_found.rs:20:8 | -18 | #[deny(Warnings)] +20 | #[deny(Warnings)] | ^^^^^^^^ help: lowercase the lint name: `warnings` diff --git a/src/test/ui/lint/outer-forbid.rs b/src/test/ui/lint/outer-forbid.rs index a79dacbc1c..d72f307b46 100644 --- a/src/test/ui/lint/outer-forbid.rs +++ b/src/test/ui/lint/outer-forbid.rs @@ -16,13 +16,13 @@ #![forbid(unused, non_snake_case)] -#[allow(unused_variables)] +#[allow(unused_variables)] //~ ERROR overruled fn foo() {} -#[allow(unused)] +#[allow(unused)] //~ ERROR overruled fn bar() {} -#[allow(bad_style)] +#[allow(bad_style)] //~ ERROR overruled fn main() { println!("hello forbidden world") } diff --git a/src/test/ui/lint/outer-forbid.stderr b/src/test/ui/lint/outer-forbid.stderr index 67a1f4f88a..0bc4e4dcf5 100644 --- a/src/test/ui/lint/outer-forbid.stderr +++ b/src/test/ui/lint/outer-forbid.stderr @@ -4,7 +4,7 @@ error[E0453]: allow(unused_variables) overruled by outer forbid(unused) 17 | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here 18 | -19 | #[allow(unused_variables)] +19 | #[allow(unused_variables)] //~ ERROR overruled | ^^^^^^^^^^^^^^^^ overruled by previous forbid error[E0453]: allow(unused) overruled by outer forbid(unused) @@ -13,7 +13,7 @@ error[E0453]: allow(unused) overruled by outer forbid(unused) 17 | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here ... -22 | #[allow(unused)] +22 | #[allow(unused)] //~ ERROR overruled | ^^^^^^ overruled by previous forbid error[E0453]: allow(bad_style) overruled by outer forbid(non_snake_case) @@ -22,7 +22,7 @@ error[E0453]: allow(bad_style) overruled by outer forbid(non_snake_case) 17 | #![forbid(unused, non_snake_case)] | -------------- `forbid` level set here ... -25 | #[allow(bad_style)] +25 | #[allow(bad_style)] //~ ERROR overruled | ^^^^^^^^^ overruled by previous forbid error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/suggestions.rs b/src/test/ui/lint/suggestions.rs index bf2b5769bf..3789b6dfc8 100644 --- a/src/test/ui/lint/suggestions.rs +++ b/src/test/ui/lint/suggestions.rs @@ -12,25 +12,34 @@ #![feature(no_debug)] #[no_mangle] static SHENZHOU: usize = 1; // should suggest `pub` +//~^ WARN static is marked #[no_mangle] #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const` +//~^ ERROR const items should never be #[no_mangle] #[no_mangle] // should suggest removal (generics can't be no-mangle) pub fn defiant<T>(_t: T) {} +//~^ WARN functions generic over types must be mangled #[no_mangle] fn rio_grande() {} // should suggest `pub` +//~^ WARN function is marked struct Equinox { warp_factor: f32, } #[no_debug] // should suggest removal of deprecated attribute +//~^ WARN deprecated fn main() { while true { // should suggest `loop` + //~^ WARN denote infinite loops let mut a = (1); // should suggest no `mut`, no parens + //~^ WARN does not need to be mutable + //~| WARN unnecessary parentheses let d = Equinox { warp_factor: 9.975 }; match d { Equinox { warp_factor: warp_factor } => {} // should suggest shorthand + //~^ WARN this pattern is redundant } println!("{}", a); } diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index a001466683..701a952221 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -1,7 +1,7 @@ warning: unnecessary parentheses around assigned value - --> $DIR/suggestions.rs:30:21 + --> $DIR/suggestions.rs:36:21 | -30 | let mut a = (1); // should suggest no `mut`, no parens +36 | let mut a = (1); // should suggest no `mut`, no parens | ^^^ help: remove these parentheses | note: lint level defined here @@ -11,17 +11,17 @@ note: lint level defined here | ^^^^^^^^^^^^^ warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 - --> $DIR/suggestions.rs:27:1 + --> $DIR/suggestions.rs:31:1 | -27 | #[no_debug] // should suggest removal of deprecated attribute +31 | #[no_debug] // should suggest removal of deprecated attribute | ^^^^^^^^^^^ help: remove this attribute | = note: #[warn(deprecated)] on by default warning: variable does not need to be mutable - --> $DIR/suggestions.rs:30:13 + --> $DIR/suggestions.rs:36:13 | -30 | let mut a = (1); // should suggest no `mut`, no parens +36 | let mut a = (1); // should suggest no `mut`, no parens | ---^^ | | | help: remove this `mut` @@ -38,14 +38,14 @@ warning: static is marked #[no_mangle], but not exported 14 | #[no_mangle] static SHENZHOU: usize = 1; // should suggest `pub` | -^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | help: try making it public: `pub ` + | help: try making it public: `pub` | = note: #[warn(private_no_mangle_statics)] on by default error: const items should never be #[no_mangle] - --> $DIR/suggestions.rs:15:14 + --> $DIR/suggestions.rs:16:14 | -15 | #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const` +16 | #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const` | -----^^^^^^^^^^^^^^^^^^^^^^ | | | help: try a static value: `pub static` @@ -53,47 +53,37 @@ error: const items should never be #[no_mangle] = note: #[deny(no_mangle_const_items)] on by default warning: functions generic over types must be mangled - --> $DIR/suggestions.rs:18:1 + --> $DIR/suggestions.rs:20:1 | -17 | #[no_mangle] // should suggest removal (generics can't be no-mangle) +19 | #[no_mangle] // should suggest removal (generics can't be no-mangle) | ------------ help: remove this attribute -18 | pub fn defiant<T>(_t: T) {} +20 | pub fn defiant<T>(_t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(no_mangle_generic_items)] on by default warning: function is marked #[no_mangle], but not exported - --> $DIR/suggestions.rs:21:1 + --> $DIR/suggestions.rs:24:1 | -21 | fn rio_grande() {} // should suggest `pub` +24 | fn rio_grande() {} // should suggest `pub` | -^^^^^^^^^^^^^^^^^ | | - | help: try making it public: `pub ` + | help: try making it public: `pub` | = note: #[warn(private_no_mangle_fns)] on by default warning: denote infinite loops with `loop { ... }` - --> $DIR/suggestions.rs:29:5 + --> $DIR/suggestions.rs:34:5 | -29 | while true { // should suggest `loop` - | ^--------- - | | - | _____help: use `loop` - | | -30 | | let mut a = (1); // should suggest no `mut`, no parens -31 | | let d = Equinox { warp_factor: 9.975 }; -32 | | match d { -... | -35 | | println!("{}", a); -36 | | } - | |_____^ +34 | while true { // should suggest `loop` + | ^^^^^^^^^^ help: use `loop` | = note: #[warn(while_true)] on by default warning: the `warp_factor:` in this pattern is redundant - --> $DIR/suggestions.rs:33:23 + --> $DIR/suggestions.rs:41:23 | -33 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand +41 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand | ------------^^^^^^^^^^^^ | | | help: remove this diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.rs b/src/test/ui/lint/unreachable_pub-pub_crate.rs index b794f6c951..4192b7dcee 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.rs +++ b/src/test/ui/lint/unreachable_pub-pub_crate.rs @@ -14,6 +14,8 @@ // suggestions to use `crate` given when it is on). When that feature becomes // stable, this test can be deleted. +// must-compile-successfully + #![feature(macro_vis_matcher)] #![allow(unused)] diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.stderr b/src/test/ui/lint/unreachable_pub-pub_crate.stderr index 84cbf87c1a..0c2841a9e1 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.stderr +++ b/src/test/ui/lint/unreachable_pub-pub_crate.stderr @@ -1,22 +1,22 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:24:5 + --> $DIR/unreachable_pub-pub_crate.rs:26:5 | -24 | pub use std::fmt; +26 | pub use std::fmt; | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | note: lint level defined here - --> $DIR/unreachable_pub-pub_crate.rs:20:9 + --> $DIR/unreachable_pub-pub_crate.rs:22:9 | -20 | #![warn(unreachable_pub)] +22 | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:26:5 + --> $DIR/unreachable_pub-pub_crate.rs:28:5 | -26 | pub struct Hydrogen { +28 | pub struct Hydrogen { | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` @@ -24,46 +24,26 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` field - --> $DIR/unreachable_pub-pub_crate.rs:28:9 + --> $DIR/unreachable_pub-pub_crate.rs:30:9 | -28 | pub neutrons: usize, +30 | pub neutrons: usize, | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:34:9 + --> $DIR/unreachable_pub-pub_crate.rs:36:9 | -34 | pub fn count_neutrons(&self) -> usize { self.neutrons } +36 | pub fn count_neutrons(&self) -> usize { self.neutrons } | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` -warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:38:5 - | -38 | pub enum Helium {} - | ---^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` - | - = help: or consider exporting it for use by other crates - -warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:39:5 - | -39 | pub union Lithium { c1: usize, c2: u8 } - | ---^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` - | - = help: or consider exporting it for use by other crates - warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:40:5 | -40 | pub fn beryllium() {} - | ---^^^^^^^^^^^^^^^ +40 | pub enum Helium {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -72,8 +52,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:41:5 | -41 | pub trait Boron {} - | ---^^^^^^^^^^^^ +41 | pub union Lithium { c1: usize, c2: u8 } + | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -82,8 +62,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:42:5 | -42 | pub const CARBON: usize = 1; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^ +42 | pub fn beryllium() {} + | ---^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -92,8 +72,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:43:5 | -43 | pub static NITROGEN: usize = 2; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +43 | pub trait Boron {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -102,7 +82,27 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:44:5 | -44 | pub type Oxygen = bool; +44 | pub const CARBON: usize = 1; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `pub(crate)` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub-pub_crate.rs:45:5 + | +45 | pub static NITROGEN: usize = 2; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `pub(crate)` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub-pub_crate.rs:46:5 + | +46 | pub type Oxygen = bool; | ---^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` @@ -110,22 +110,22 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:47:47 + --> $DIR/unreachable_pub-pub_crate.rs:49:47 | -47 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } +49 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | -----------^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` -48 | } -49 | define_empty_struct_with_visibility!(pub, Fluorine); +50 | } +51 | define_empty_struct_with_visibility!(pub, Fluorine); | ---------------------------------------------------- in this macro invocation | = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:52:9 + --> $DIR/unreachable_pub-pub_crate.rs:54:9 | -52 | pub fn catalyze() -> bool; +54 | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` diff --git a/src/test/ui/lint/unreachable_pub.rs b/src/test/ui/lint/unreachable_pub.rs index 5812061dfd..393bccf03a 100644 --- a/src/test/ui/lint/unreachable_pub.rs +++ b/src/test/ui/lint/unreachable_pub.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![feature(crate_visibility_modifier)] #![feature(macro_vis_matcher)] diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr index bdd016ff2d..093870866c 100644 --- a/src/test/ui/lint/unreachable_pub.stderr +++ b/src/test/ui/lint/unreachable_pub.stderr @@ -1,22 +1,22 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:19:5 + --> $DIR/unreachable_pub.rs:21:5 | -19 | pub use std::fmt; +21 | pub use std::fmt; | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | note: lint level defined here - --> $DIR/unreachable_pub.rs:15:9 + --> $DIR/unreachable_pub.rs:17:9 | -15 | #![warn(unreachable_pub)] +17 | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:21:5 + --> $DIR/unreachable_pub.rs:23:5 | -21 | pub struct Hydrogen { +23 | pub struct Hydrogen { | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` @@ -24,46 +24,26 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` field - --> $DIR/unreachable_pub.rs:23:9 + --> $DIR/unreachable_pub.rs:25:9 | -23 | pub neutrons: usize, +25 | pub neutrons: usize, | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:29:9 + --> $DIR/unreachable_pub.rs:31:9 | -29 | pub fn count_neutrons(&self) -> usize { self.neutrons } +31 | pub fn count_neutrons(&self) -> usize { self.neutrons } | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` -warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:33:5 - | -33 | pub enum Helium {} - | ---^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `crate` - | - = help: or consider exporting it for use by other crates - -warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:34:5 - | -34 | pub union Lithium { c1: usize, c2: u8 } - | ---^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `crate` - | - = help: or consider exporting it for use by other crates - warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:35:5 | -35 | pub fn beryllium() {} - | ---^^^^^^^^^^^^^^^ +35 | pub enum Helium {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -72,8 +52,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:36:5 | -36 | pub trait Boron {} - | ---^^^^^^^^^^^^ +36 | pub union Lithium { c1: usize, c2: u8 } + | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -82,8 +62,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:37:5 | -37 | pub const CARBON: usize = 1; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^ +37 | pub fn beryllium() {} + | ---^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -92,8 +72,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:38:5 | -38 | pub static NITROGEN: usize = 2; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +38 | pub trait Boron {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -102,7 +82,27 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:39:5 | -39 | pub type Oxygen = bool; +39 | pub const CARBON: usize = 1; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `crate` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub.rs:40:5 + | +40 | pub static NITROGEN: usize = 2; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `crate` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub.rs:41:5 + | +41 | pub type Oxygen = bool; | ---^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` @@ -110,22 +110,22 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:42:47 + --> $DIR/unreachable_pub.rs:44:47 | -42 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } +44 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | -----------^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` -43 | } -44 | define_empty_struct_with_visibility!(pub, Fluorine); +45 | } +46 | define_empty_struct_with_visibility!(pub, Fluorine); | ---------------------------------------------------- in this macro invocation | = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:47:9 + --> $DIR/unreachable_pub.rs:49:9 | -47 | pub fn catalyze() -> bool; +49 | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index ad501e6680..fdcd45c831 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: --error-format pretty-json -Zunstable-options +// must-compile-successfully // The output for humans should just highlight the whole span without showing // the suggested replacement, but we also want to test that suggested diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index e166f7011b..37eb9a98f7 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -8,10 +8,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 1027, - "byte_end": 1040, - "line_start": 24, - "line_end": 24, + "byte_start": 1056, + "byte_end": 1069, + "line_start": 25, + "line_end": 25, "column_start": 14, "column_end": 27, "is_primary": true, @@ -35,10 +35,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 873, - "byte_end": 886, - "line_start": 19, - "line_end": 19, + "byte_start": 902, + "byte_end": 915, + "line_start": 20, + "line_end": 20, "column_start": 9, "column_end": 22, "is_primary": true, @@ -64,10 +64,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 1027, - "byte_end": 1040, - "line_start": 24, - "line_end": 24, + "byte_start": 1056, + "byte_end": 1069, + "line_start": 25, + "line_end": 25, "column_start": 14, "column_end": 27, "is_primary": true, @@ -87,5 +87,17 @@ "rendered": null } ], - "rendered": null + "rendered": "warning: unnecessary parentheses around assigned value + --> $DIR/unused_parens_json_suggestion.rs:25:14 + | +25 | let _a = (1 / (2 + 3)); + | ^^^^^^^^^^^^^ help: remove these parentheses + | +note: lint level defined here + --> $DIR/unused_parens_json_suggestion.rs:20:9 + | +20 | #![warn(unused_parens)] + | ^^^^^^^^^^^^^ + +" } diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index fd3b5fe1ad..846d7df445 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -2,7 +2,72 @@ "message": "cannot find type `Iter` in this scope", "code": { "code": "E0412", - "explanation": "/nThe type name used is not in scope./n/nErroneous code examples:/n/n```compile_fail,E0412/nimpl Something {} // error: type name `Something` is not in scope/n/n// or:/n/ntrait Foo {/n fn bar(N); // error: type name `N` is not in scope/n}/n/n// or:/n/nfn foo(x: T) {} // type name `T` is not in scope/n```/n/nTo fix this error, please verify you didn't misspell the type name, you did/ndeclare it or imported it into the scope. Examples:/n/n```/nstruct Something;/n/nimpl Something {} // ok!/n/n// or:/n/ntrait Foo {/n type N;/n/n fn bar(_: Self::N); // ok!/n}/n/n// or:/n/nfn foo<T>(x: T) {} // ok!/n```/n/nAnother case that causes this error is when a type is imported into a parent/nmodule. To fix this, you can follow the suggestion and use File directly or/n`use super::File;` which will import the types from the parent namespace. An/nexample that causes this error is below:/n/n```compile_fail,E0412/nuse std::fs::File;/n/nmod foo {/n fn some_function(f: File) {}/n}/n```/n/n```/nuse std::fs::File;/n/nmod foo {/n // either/n use super::File;/n // or/n // use std::fs::File;/n fn foo(f: File) {}/n}/n# fn main() {} // don't insert it for us; that'll break imports/n```/n" + "explanation": " +The type name used is not in scope. + +Erroneous code examples: + +```compile_fail,E0412 +impl Something {} // error: type name `Something` is not in scope + +// or: + +trait Foo { + fn bar(N); // error: type name `N` is not in scope +} + +// or: + +fn foo(x: T) {} // type name `T` is not in scope +``` + +To fix this error, please verify you didn't misspell the type name, you did +declare it or imported it into the scope. Examples: + +``` +struct Something; + +impl Something {} // ok! + +// or: + +trait Foo { + type N; + + fn bar(_: Self::N); // ok! +} + +// or: + +fn foo<T>(x: T) {} // ok! +``` + +Another case that causes this error is when a type is imported into a parent +module. To fix this, you can follow the suggestion and use File directly or +`use super::File;` which will import the types from the parent namespace. An +example that causes this error is below: + +```compile_fail,E0412 +use std::fs::File; + +mod foo { + fn some_function(f: File) {} +} +``` + +``` +use std::fs::File; + +mod foo { + // either + use super::File; + // or + // use std::fs::File; + fn foo(f: File) {} +} +# fn main() {} // don't insert it for us; that'll break imports +``` +" }, "level": "error", "spans": [ @@ -50,7 +115,9 @@ } ], "label": null, - "suggested_replacement": "use std::collections::binary_heap::Iter;/n/n", + "suggested_replacement": "use std::collections::binary_heap::Iter; + +", "expansion": null }, { @@ -70,7 +137,9 @@ } ], "label": null, - "suggested_replacement": "use std::collections::btree_map::Iter;/n/n", + "suggested_replacement": "use std::collections::btree_map::Iter; + +", "expansion": null }, { @@ -90,7 +159,9 @@ } ], "label": null, - "suggested_replacement": "use std::collections::btree_set::Iter;/n/n", + "suggested_replacement": "use std::collections::btree_set::Iter; + +", "expansion": null }, { @@ -110,7 +181,9 @@ } ], "label": null, - "suggested_replacement": "use std::collections::hash_map::Iter;/n/n", + "suggested_replacement": "use std::collections::hash_map::Iter; + +", "expansion": null }, { @@ -130,7 +203,9 @@ } ], "label": null, - "suggested_replacement": "use std::collections::hash_set::Iter;/n/n", + "suggested_replacement": "use std::collections::hash_set::Iter; + +", "expansion": null }, { @@ -150,7 +225,9 @@ } ], "label": null, - "suggested_replacement": "use std::collections::linked_list::Iter;/n/n", + "suggested_replacement": "use std::collections::linked_list::Iter; + +", "expansion": null }, { @@ -170,7 +247,9 @@ } ], "label": null, - "suggested_replacement": "use std::collections::vec_deque::Iter;/n/n", + "suggested_replacement": "use std::collections::vec_deque::Iter; + +", "expansion": null }, { @@ -190,7 +269,9 @@ } ], "label": null, - "suggested_replacement": "use std::option::Iter;/n/n", + "suggested_replacement": "use std::option::Iter; + +", "expansion": null }, { @@ -210,7 +291,9 @@ } ], "label": null, - "suggested_replacement": "use std::path::Iter;/n/n", + "suggested_replacement": "use std::path::Iter; + +", "expansion": null }, { @@ -230,7 +313,9 @@ } ], "label": null, - "suggested_replacement": "use std::result::Iter;/n/n", + "suggested_replacement": "use std::result::Iter; + +", "expansion": null }, { @@ -250,7 +335,9 @@ } ], "label": null, - "suggested_replacement": "use std::slice::Iter;/n/n", + "suggested_replacement": "use std::slice::Iter; + +", "expansion": null }, { @@ -270,7 +357,9 @@ } ], "label": null, - "suggested_replacement": "use std::sync::mpsc::Iter;/n/n", + "suggested_replacement": "use std::sync::mpsc::Iter; + +", "expansion": null } ], @@ -278,7 +367,24 @@ "rendered": null } ], - "rendered": null + "rendered": "error[E0412]: cannot find type `Iter` in this scope + --> $DIR/use_suggestion_json.rs:20:12 + | +20 | let x: Iter; + | ^^^^ not found in this scope +help: possible candidates are found in other modules, you can import them into scope + | +19 | use std::collections::binary_heap::Iter; + | +19 | use std::collections::btree_map::Iter; + | +19 | use std::collections::btree_set::Iter; + | +19 | use std::collections::hash_map::Iter; + | +and 8 other candidates + +" } { "message": "aborting due to previous error", @@ -286,5 +392,7 @@ "level": "error", "spans": [], "children": [], - "rendered": null + "rendered": "error: aborting due to previous error + +" } diff --git a/src/test/compile-fail/liveness-return-last-stmt-semi.rs b/src/test/ui/liveness-return-last-stmt-semi.rs similarity index 85% rename from src/test/compile-fail/liveness-return-last-stmt-semi.rs rename to src/test/ui/liveness-return-last-stmt-semi.rs index ada91c38d4..663c0275b8 100644 --- a/src/test/compile-fail/liveness-return-last-stmt-semi.rs +++ b/src/test/ui/liveness-return-last-stmt-semi.rs @@ -12,12 +12,11 @@ macro_rules! test { () => { fn foo() -> i32 { 1; } } } //~^ ERROR mismatched types - //~| HELP consider removing this semicolon fn no_return() -> i32 {} //~ ERROR mismatched types fn bar(x: u32) -> u32 { //~ ERROR mismatched types - x * 2; //~ HELP consider removing this semicolon + x * 2; } fn baz(x: u64) -> u32 { //~ ERROR mismatched types diff --git a/src/test/ui/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness-return-last-stmt-semi.stderr new file mode 100644 index 0000000000..2057e14d55 --- /dev/null +++ b/src/test/ui/liveness-return-last-stmt-semi.stderr @@ -0,0 +1,51 @@ +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:13:45 + | +13 | macro_rules! test { () => { fn foo() -> i32 { 1; } } } + | ^^^-^^ + | | | + | | help: consider removing this semicolon + | expected i32, found () +... +27 | test!(); + | -------- in this macro invocation + | + = note: expected type `i32` + found type `()` + +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:16:23 + | +16 | fn no_return() -> i32 {} //~ ERROR mismatched types + | ^^ expected i32, found () + | + = note: expected type `i32` + found type `()` + +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:18:23 + | +18 | fn bar(x: u32) -> u32 { //~ ERROR mismatched types + | _______________________^ +19 | | x * 2; + | | - help: consider removing this semicolon +20 | | } + | |_^ expected u32, found () + | + = note: expected type `u32` + found type `()` + +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:22:23 + | +22 | fn baz(x: u64) -> u32 { //~ ERROR mismatched types + | _______________________^ +23 | | x * 2; +24 | | } + | |_^ expected u32, found () + | + = note: expected type `u32` + found type `()` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/loop-break-value-no-repeat.rs b/src/test/ui/loop-break-value-no-repeat.rs index b52d540fd7..f24840eca5 100644 --- a/src/test/ui/loop-break-value-no-repeat.rs +++ b/src/test/ui/loop-break-value-no-repeat.rs @@ -19,6 +19,6 @@ use std::ptr; fn main() { for _ in &[1,2,3] { - break 22 + break 22 //~ ERROR `break` with value from a `for` loop } } diff --git a/src/test/ui/loop-break-value-no-repeat.stderr b/src/test/ui/loop-break-value-no-repeat.stderr index c154ea6f8c..296b3b191e 100644 --- a/src/test/ui/loop-break-value-no-repeat.stderr +++ b/src/test/ui/loop-break-value-no-repeat.stderr @@ -1,7 +1,7 @@ error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value-no-repeat.rs:22:9 | -22 | break 22 +22 | break 22 //~ ERROR `break` with value from a `for` loop | ^^^^^^^^ can only break with a value inside `loop` error: aborting due to previous error diff --git a/src/test/compile-fail/loops-reject-duplicate-labels-2.rs b/src/test/ui/loops-reject-duplicate-labels-2.rs similarity index 65% rename from src/test/compile-fail/loops-reject-duplicate-labels-2.rs rename to src/test/ui/loops-reject-duplicate-labels-2.rs index ca18ca3796..598c7370b8 100644 --- a/src/test/compile-fail/loops-reject-duplicate-labels-2.rs +++ b/src/test/ui/loops-reject-duplicate-labels-2.rs @@ -19,31 +19,23 @@ // https://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833 pub fn foo() { - { 'fl: for _ in 0..10 { break; } } //~ NOTE first declared here + { 'fl: for _ in 0..10 { break; } } { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope - //~^ NOTE lifetime 'fl already in scope - { 'lf: loop { break; } } //~ NOTE first declared here + { 'lf: loop { break; } } { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope - //~^ NOTE lifetime 'lf already in scope - { 'wl: while 2 > 1 { break; } } //~ NOTE first declared here + { 'wl: while 2 > 1 { break; } } { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope - //~^ NOTE lifetime 'wl already in scope - { 'lw: loop { break; } } //~ NOTE first declared here + { 'lw: loop { break; } } { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope - //~^ NOTE lifetime 'lw already in scope - { 'fw: for _ in 0..10 { break; } } //~ NOTE first declared here + { 'fw: for _ in 0..10 { break; } } { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope - //~^ NOTE lifetime 'fw already in scope - { 'wf: while 2 > 1 { break; } } //~ NOTE first declared here + { 'wf: while 2 > 1 { break; } } { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope - //~^ NOTE lifetime 'wf already in scope - { 'tl: while let Some(_) = None::<i32> { break; } } //~ NOTE first declared here + { 'tl: while let Some(_) = None::<i32> { break; } } { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope - //~^ NOTE lifetime 'tl already in scope - { 'lt: loop { break; } } //~ NOTE first declared here + { 'lt: loop { break; } } { 'lt: while let Some(_) = None::<i32> { break; } } //~^ WARN label name `'lt` shadows a label name that is already in scope - //~| NOTE lifetime 'lt already in scope } #[rustc_error] diff --git a/src/test/ui/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops-reject-duplicate-labels-2.stderr new file mode 100644 index 0000000000..488046b71b --- /dev/null +++ b/src/test/ui/loops-reject-duplicate-labels-2.stderr @@ -0,0 +1,72 @@ +warning: label name `'fl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:23:7 + | +22 | { 'fl: for _ in 0..10 { break; } } + | --- first declared here +23 | { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope + | ^^^ lifetime 'fl already in scope + +warning: label name `'lf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:25:7 + | +24 | { 'lf: loop { break; } } + | --- first declared here +25 | { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope + | ^^^ lifetime 'lf already in scope + +warning: label name `'wl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:27:7 + | +26 | { 'wl: while 2 > 1 { break; } } + | --- first declared here +27 | { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope + | ^^^ lifetime 'wl already in scope + +warning: label name `'lw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:29:7 + | +28 | { 'lw: loop { break; } } + | --- first declared here +29 | { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope + | ^^^ lifetime 'lw already in scope + +warning: label name `'fw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:31:7 + | +30 | { 'fw: for _ in 0..10 { break; } } + | --- first declared here +31 | { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope + | ^^^ lifetime 'fw already in scope + +warning: label name `'wf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:33:7 + | +32 | { 'wf: while 2 > 1 { break; } } + | --- first declared here +33 | { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope + | ^^^ lifetime 'wf already in scope + +warning: label name `'tl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:35:7 + | +34 | { 'tl: while let Some(_) = None::<i32> { break; } } + | --- first declared here +35 | { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope + | ^^^ lifetime 'tl already in scope + +warning: label name `'lt` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:37:7 + | +36 | { 'lt: loop { break; } } + | --- first declared here +37 | { 'lt: while let Some(_) = None::<i32> { break; } } + | ^^^ lifetime 'lt already in scope + +error: compilation successful + --> $DIR/loops-reject-duplicate-labels-2.rs:42:1 + | +42 | / pub fn main() { //~ ERROR compilation successful +43 | | foo(); +44 | | } + | |_^ + diff --git a/src/test/compile-fail/loops-reject-duplicate-labels.rs b/src/test/ui/loops-reject-duplicate-labels.rs similarity index 63% rename from src/test/compile-fail/loops-reject-duplicate-labels.rs rename to src/test/ui/loops-reject-duplicate-labels.rs index 31f8949389..d768b002ab 100644 --- a/src/test/compile-fail/loops-reject-duplicate-labels.rs +++ b/src/test/ui/loops-reject-duplicate-labels.rs @@ -16,32 +16,24 @@ // This is testing the exact cases that are in the issue description. fn foo() { - 'fl: for _ in 0..10 { break; } //~ NOTE first declared here + 'fl: for _ in 0..10 { break; } 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope - //~^ NOTE lifetime 'fl already in scope - 'lf: loop { break; } //~ NOTE first declared here + 'lf: loop { break; } 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope - //~^ NOTE lifetime 'lf already in scope - 'wl: while 2 > 1 { break; } //~ NOTE first declared here + 'wl: while 2 > 1 { break; } 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope - //~^ NOTE lifetime 'wl already in scope - 'lw: loop { break; } //~ NOTE first declared here + 'lw: loop { break; } 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope - //~^ NOTE lifetime 'lw already in scope - 'fw: for _ in 0..10 { break; } //~ NOTE first declared here + 'fw: for _ in 0..10 { break; } 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope - //~^ NOTE lifetime 'fw already in scope - 'wf: while 2 > 1 { break; } //~ NOTE first declared here + 'wf: while 2 > 1 { break; } 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope - //~^ NOTE lifetime 'wf already in scope - 'tl: while let Some(_) = None::<i32> { break; } //~ NOTE first declared here + 'tl: while let Some(_) = None::<i32> { break; } 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope - //~^ NOTE lifetime 'tl already in scope - 'lt: loop { break; } //~ NOTE first declared here + 'lt: loop { break; } 'lt: while let Some(_) = None::<i32> { break; } //~^ WARN label name `'lt` shadows a label name that is already in scope - //~| NOTE lifetime 'lt already in scope } // Note however that it is okay for the same label to be reused in diff --git a/src/test/ui/loops-reject-duplicate-labels.stderr b/src/test/ui/loops-reject-duplicate-labels.stderr new file mode 100644 index 0000000000..3c287138c9 --- /dev/null +++ b/src/test/ui/loops-reject-duplicate-labels.stderr @@ -0,0 +1,75 @@ +warning: label name `'fl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:20:5 + | +19 | 'fl: for _ in 0..10 { break; } + | --- first declared here +20 | 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope + | ^^^ lifetime 'fl already in scope + +warning: label name `'lf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:23:5 + | +22 | 'lf: loop { break; } + | --- first declared here +23 | 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope + | ^^^ lifetime 'lf already in scope + +warning: label name `'wl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:25:5 + | +24 | 'wl: while 2 > 1 { break; } + | --- first declared here +25 | 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope + | ^^^ lifetime 'wl already in scope + +warning: label name `'lw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:27:5 + | +26 | 'lw: loop { break; } + | --- first declared here +27 | 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope + | ^^^ lifetime 'lw already in scope + +warning: label name `'fw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:29:5 + | +28 | 'fw: for _ in 0..10 { break; } + | --- first declared here +29 | 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope + | ^^^ lifetime 'fw already in scope + +warning: label name `'wf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:31:5 + | +30 | 'wf: while 2 > 1 { break; } + | --- first declared here +31 | 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope + | ^^^ lifetime 'wf already in scope + +warning: label name `'tl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:33:5 + | +32 | 'tl: while let Some(_) = None::<i32> { break; } + | --- first declared here +33 | 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope + | ^^^ lifetime 'tl already in scope + +warning: label name `'lt` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:35:5 + | +34 | 'lt: loop { break; } + | --- first declared here +35 | 'lt: while let Some(_) = None::<i32> { break; } + | ^^^ lifetime 'lt already in scope + +error: compilation successful + --> $DIR/loops-reject-duplicate-labels.rs:49:1 + | +49 | / pub fn main() { //~ ERROR compilation successful +50 | | let s = S; +51 | | s.m1(); +52 | | s.m2(); +53 | | foo(); +54 | | } + | |_^ + diff --git a/src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs b/src/test/ui/loops-reject-labels-shadowing-lifetimes.rs similarity index 70% rename from src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs rename to src/test/ui/loops-reject-labels-shadowing-lifetimes.rs index 9a735f9c97..74da125d57 100644 --- a/src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs +++ b/src/test/ui/loops-reject-labels-shadowing-lifetimes.rs @@ -16,10 +16,9 @@ #![allow(dead_code, unused_variables)] fn foo() { - fn foo<'a>() { //~ NOTE first declared here + fn foo<'a>() { 'a: loop { break 'a; } //~^ WARN label name `'a` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'a already in scope } struct Struct<'b, 'c> { _f: &'b i8, _g: &'c i8 } @@ -41,87 +40,75 @@ fn foo() { } } - impl<'bad, 'c> Struct<'bad, 'c> { //~ NOTE first declared here + impl<'bad, 'c> Struct<'bad, 'c> { fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - impl<'b, 'bad> Struct<'b, 'bad> { //~ NOTE first declared here + impl<'b, 'bad> Struct<'b, 'bad> { fn meth_bad2(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } impl<'b, 'c> Struct<'b, 'c> { - fn meth_bad3<'bad>(x: &'bad i8) { //~ NOTE first declared here + fn meth_bad3<'bad>(x: &'bad i8) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { - //~^ NOTE first declared here 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - impl <'bad, 'e> Enum<'bad, 'e> { //~ NOTE first declared here + impl <'bad, 'e> Enum<'bad, 'e> { fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - impl <'d, 'bad> Enum<'d, 'bad> { //~ NOTE first declared here + impl <'d, 'bad> Enum<'d, 'bad> { fn meth_bad2(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } impl <'d, 'e> Enum<'d, 'e> { - fn meth_bad3<'bad>(x: &'bad i8) { //~ NOTE first declared here + fn meth_bad3<'bad>(x: &'bad i8) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } - fn meth_bad4<'a,'bad>(x: &'bad i8) { //~ NOTE first declared here + fn meth_bad4<'a,'bad>(x: &'bad i8) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - trait HasDefaultMethod1<'bad> { //~ NOTE first declared here + trait HasDefaultMethod1<'bad> { fn meth_okay() { 'c: loop { break 'c; } } fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - trait HasDefaultMethod2<'a,'bad> { //~ NOTE first declared here + trait HasDefaultMethod2<'a,'bad> { fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } trait HasDefaultMethod3<'a,'b> { - fn meth_bad<'bad>(&self) { //~ NOTE first declared here + fn meth_bad<'bad>(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } } diff --git a/src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr b/src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr new file mode 100644 index 0000000000..07dbb68725 --- /dev/null +++ b/src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr @@ -0,0 +1,110 @@ +warning: label name `'a` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:20:9 + | +19 | fn foo<'a>() { + | -- first declared here +20 | 'a: loop { break 'a; } + | ^^ lifetime 'a already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:45:13 + | +43 | impl<'bad, 'c> Struct<'bad, 'c> { + | ---- first declared here +44 | fn meth_bad(&self) { +45 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:52:13 + | +50 | impl<'b, 'bad> Struct<'b, 'bad> { + | ---- first declared here +51 | fn meth_bad2(&self) { +52 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:59:13 + | +58 | fn meth_bad3<'bad>(x: &'bad i8) { + | ---- first declared here +59 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:64:13 + | +63 | fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { + | ---- first declared here +64 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:71:13 + | +69 | impl <'bad, 'e> Enum<'bad, 'e> { + | ---- first declared here +70 | fn meth_bad(&self) { +71 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:77:13 + | +75 | impl <'d, 'bad> Enum<'d, 'bad> { + | ---- first declared here +76 | fn meth_bad2(&self) { +77 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:83:13 + | +82 | fn meth_bad3<'bad>(x: &'bad i8) { + | ---- first declared here +83 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:88:13 + | +87 | fn meth_bad4<'a,'bad>(x: &'bad i8) { + | ---- first declared here +88 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:98:13 + | +93 | trait HasDefaultMethod1<'bad> { + | ---- first declared here +... +98 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:104:13 + | +102 | trait HasDefaultMethod2<'a,'bad> { + | ---- first declared here +103 | fn meth_bad(&self) { +104 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:110:13 + | +109 | fn meth_bad<'bad>(&self) { + | ---- first declared here +110 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +error: compilation successful + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:117:1 + | +117 | / pub fn main() { //~ ERROR compilation successful +118 | | foo(); +119 | | } + | |_^ + diff --git a/src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops-reject-lifetime-shadowing-label.rs similarity index 93% rename from src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs rename to src/test/ui/loops-reject-lifetime-shadowing-label.rs index 0a90917d97..077e57c957 100644 --- a/src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs +++ b/src/test/ui/loops-reject-lifetime-shadowing-label.rs @@ -27,10 +27,9 @@ fn foo() { let z = 3_i8; - 'a: loop { //~ NOTE first declared here + 'a: loop { let b = Box::new(|x: &i8| *x) as Box<for <'a> Fn(&'a i8) -> i8>; //~^ WARN lifetime name `'a` shadows a label name that is already in scope - //~| NOTE lifetime 'a already in scope assert_eq!((*b)(&z), z); break 'a; } diff --git a/src/test/ui/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops-reject-lifetime-shadowing-label.stderr new file mode 100644 index 0000000000..d44b1b7b62 --- /dev/null +++ b/src/test/ui/loops-reject-lifetime-shadowing-label.stderr @@ -0,0 +1,16 @@ +warning: lifetime name `'a` shadows a label name that is already in scope + --> $DIR/loops-reject-lifetime-shadowing-label.rs:31:51 + | +30 | 'a: loop { + | -- first declared here +31 | let b = Box::new(|x: &i8| *x) as Box<for <'a> Fn(&'a i8) -> i8>; + | ^^ lifetime 'a already in scope + +error: compilation successful + --> $DIR/loops-reject-lifetime-shadowing-label.rs:39:1 + | +39 | / pub fn main() { //~ ERROR compilation successful +40 | | foo(); +41 | | } + | |_^ + diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.rs b/src/test/ui/lub-glb/old-lub-glb-hr.rs index 85c90bb375..7526b2f946 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr.rs +++ b/src/test/ui/lub-glb/old-lub-glb-hr.rs @@ -15,7 +15,7 @@ fn foo( x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8), ) { - let z = match 22 { + let z = match 22 { //~ ERROR incompatible types 0 => x, _ => y, }; diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.stderr b/src/test/ui/lub-glb/old-lub-glb-hr.stderr index 4a310a5e6b..105de33fac 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr.stderr @@ -1,10 +1,11 @@ error[E0308]: match arms have incompatible types --> $DIR/old-lub-glb-hr.rs:18:13 | -18 | let z = match 22 { +18 | let z = match 22 { //~ ERROR incompatible types | _____________^ 19 | | 0 => x, 20 | | _ => y, + | | - match arm with an incompatible type 21 | | }; | |_____^ expected bound lifetime parameter, found concrete lifetime | @@ -12,11 +13,6 @@ error[E0308]: match arms have incompatible types found type `for<'a> fn(&'a u8, &'a u8)` = note: this was previously accepted by the compiler but has been phased out = note: for more information, see https://github.com/rust-lang/rust/issues/45852 -note: match arm with an incompatible type - --> $DIR/old-lub-glb-hr.rs:20:14 - | -20 | _ => y, - | ^ error: aborting due to previous error diff --git a/src/test/ui/lub-glb/old-lub-glb-object.rs b/src/test/ui/lub-glb/old-lub-glb-object.rs index 7cf89b68be..63dcfa3fc1 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.rs +++ b/src/test/ui/lub-glb/old-lub-glb-object.rs @@ -17,7 +17,7 @@ fn foo( x: &for<'a, 'b> Foo<&'a u8, &'b u8>, y: &for<'a> Foo<&'a u8, &'a u8>, ) { - let z = match 22 { + let z = match 22 { //~ ERROR incompatible types 0 => x, _ => y, }; diff --git a/src/test/ui/lub-glb/old-lub-glb-object.stderr b/src/test/ui/lub-glb/old-lub-glb-object.stderr index a1077f40bf..3550314d44 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-object.stderr @@ -1,10 +1,11 @@ error[E0308]: match arms have incompatible types --> $DIR/old-lub-glb-object.rs:20:13 | -20 | let z = match 22 { +20 | let z = match 22 { //~ ERROR incompatible types | _____________^ 21 | | 0 => x, 22 | | _ => y, + | | - match arm with an incompatible type 23 | | }; | |_____^ expected bound lifetime parameter 'a, found concrete lifetime | @@ -12,11 +13,6 @@ error[E0308]: match arms have incompatible types found type `&for<'a> Foo<&'a u8, &'a u8>` = note: this was previously accepted by the compiler but has been phased out = note: for more information, see https://github.com/rust-lang/rust/issues/45852 -note: match arm with an incompatible type - --> $DIR/old-lub-glb-object.rs:22:14 - | -22 | _ => y, - | ^ error: aborting due to previous error diff --git a/src/test/compile-fail/macro-context.rs b/src/test/ui/macro-context.rs similarity index 76% rename from src/test/compile-fail/macro-context.rs rename to src/test/ui/macro-context.rs index cc714a6e43..56b3d5d0de 100644 --- a/src/test/compile-fail/macro-context.rs +++ b/src/test/ui/macro-context.rs @@ -17,11 +17,11 @@ macro_rules! m { } fn main() { - let a: m!(); //~ NOTE the usage of `m!` is likely invalid in type context - let i = m!(); //~ NOTE the usage of `m!` is likely invalid in expression context + let a: m!(); + let i = m!(); match 0 { - m!() => {} //~ NOTE the usage of `m!` is likely invalid in pattern context + m!() => {} } - m!(); //~ NOTE in this expansion + m!(); } diff --git a/src/test/ui/macro-context.stderr b/src/test/ui/macro-context.stderr new file mode 100644 index 0000000000..2be89b67d1 --- /dev/null +++ b/src/test/ui/macro-context.stderr @@ -0,0 +1,45 @@ +error: macro expansion ignores token `;` and any following + --> $DIR/macro-context.rs:13:15 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^ + | +note: caused by the macro expansion here; the usage of `m!` is likely invalid in type context + --> $DIR/macro-context.rs:20:12 + | +20 | let a: m!(); + | ^^^^ + +error: macro expansion ignores token `typeof` and any following + --> $DIR/macro-context.rs:13:17 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^^^^^^ + | +note: caused by the macro expansion here; the usage of `m!` is likely invalid in expression context + --> $DIR/macro-context.rs:21:13 + | +21 | let i = m!(); + | ^^^^ + +error: macro expansion ignores token `;` and any following + --> $DIR/macro-context.rs:13:15 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^ + | +note: caused by the macro expansion here; the usage of `m!` is likely invalid in pattern context + --> $DIR/macro-context.rs:23:9 + | +23 | m!() => {} + | ^^^^ + +error: expected expression, found reserved keyword `typeof` + --> $DIR/macro-context.rs:13:17 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^^^^^^ +... +26 | m!(); + | ----- in this macro invocation + diff --git a/src/test/compile-fail/macro-invalid-fragment-spec.rs b/src/test/ui/macro-invalid-fragment-spec.rs similarity index 92% rename from src/test/compile-fail/macro-invalid-fragment-spec.rs rename to src/test/ui/macro-invalid-fragment-spec.rs index ca6cd664e7..630e481f75 100644 --- a/src/test/compile-fail/macro-invalid-fragment-spec.rs +++ b/src/test/ui/macro-invalid-fragment-spec.rs @@ -11,7 +11,6 @@ macro_rules! foo( ($x:foo) => () //~^ ERROR invalid fragment specifier - //~| HELP valid fragment specifiers are ); fn main() { diff --git a/src/test/ui/macro-invalid-fragment-spec.stderr b/src/test/ui/macro-invalid-fragment-spec.stderr new file mode 100644 index 0000000000..b279933bd0 --- /dev/null +++ b/src/test/ui/macro-invalid-fragment-spec.stderr @@ -0,0 +1,10 @@ +error: invalid fragment specifier `foo` + --> $DIR/macro-invalid-fragment-spec.rs:12:6 + | +12 | ($x:foo) => () + | ^^^^^^ + | + = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt`, `item` and `vis` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/macro-shadowing.rs b/src/test/ui/macro-shadowing.rs similarity index 77% rename from src/test/compile-fail/macro-shadowing.rs rename to src/test/ui/macro-shadowing.rs index f5e7305e4e..61abaf8a2d 100644 --- a/src/test/compile-fail/macro-shadowing.rs +++ b/src/test/ui/macro-shadowing.rs @@ -18,16 +18,11 @@ macro_rules! macro_one { () => {} } macro_rules! m1 { () => { macro_rules! foo { () => {} } //~ ERROR `foo` is already in scope - //~^ NOTE macro-expanded `macro_rules!`s may not shadow existing macros #[macro_use] //~ ERROR `macro_two` is already in scope - //~^ NOTE macro-expanded `#[macro_use]`s may not shadow existing macros extern crate two_macros as __; }} -m1!(); //~ NOTE in this expansion - //~| NOTE in this expansion - //~| NOTE in this expansion - //~| NOTE in this expansion +m1!(); foo!(); diff --git a/src/test/ui/macro-shadowing.stderr b/src/test/ui/macro-shadowing.stderr new file mode 100644 index 0000000000..9ed372f275 --- /dev/null +++ b/src/test/ui/macro-shadowing.stderr @@ -0,0 +1,24 @@ +error: `macro_two` is already in scope + --> $DIR/macro-shadowing.rs:22:5 + | +22 | #[macro_use] //~ ERROR `macro_two` is already in scope + | ^^^^^^^^^^^^ +... +25 | m1!(); + | ------ in this macro invocation + | + = note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560) + +error: `foo` is already in scope + --> $DIR/macro-shadowing.rs:20:5 + | +20 | macro_rules! foo { () => {} } //~ ERROR `foo` is already in scope + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +25 | m1!(); + | ------ in this macro invocation + | + = note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560) + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/macro_backtrace/auxiliary/ping.rs b/src/test/ui/macro_backtrace/auxiliary/ping.rs new file mode 100644 index 0000000000..e4131dde8f --- /dev/null +++ b/src/test/ui/macro_backtrace/auxiliary/ping.rs @@ -0,0 +1,41 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the macro backtrace facility works (supporting file) + +// a non-local macro +#[macro_export] +macro_rules! ping { + () => { + pong!(); + } +} + +#[macro_export] +macro_rules! deep { + () => { + foo!(); + } +} + +#[macro_export] +macro_rules! foo { + () => { + bar!(); + } +} + +#[macro_export] +macro_rules! bar { + () => { + ping!(); + } +} + diff --git a/src/tools/miri/tests/run-pass-fullmir/unsized-tuple-impls.rs b/src/test/ui/macro_backtrace/main.rs similarity index 58% rename from src/tools/miri/tests/run-pass-fullmir/unsized-tuple-impls.rs rename to src/test/ui/macro_backtrace/main.rs index 828e5c2692..72a5c0d5e3 100644 --- a/src/tools/miri/tests/run-pass-fullmir/unsized-tuple-impls.rs +++ b/src/test/ui/macro_backtrace/main.rs @@ -8,18 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//ignore-msvc +// Test that the macro backtrace facility works +// aux-build:ping.rs +// compile-flags: -Z external-macro-backtrace -#![feature(unsized_tuple_coercion)] -use std::mem; +#[macro_use] extern crate ping; + +// a local macro +macro_rules! pong { + () => { syntax error }; +} +//~^^ ERROR expected one of +//~| ERROR expected one of +//~| ERROR expected one of fn main() { - let x : &(i32, i32, [i32]) = &(0, 1, [2, 3]); - let y : &(i32, i32, [i32]) = &(0, 1, [2, 3, 4]); - let mut a = [y, x]; - a.sort(); - assert_eq!(a, [x, y]); - - assert_eq!(&format!("{:?}", a), "[(0, 1, [2, 3]), (0, 1, [2, 3, 4])]"); - assert_eq!(mem::size_of_val(x), 16); + pong!(); + ping!(); + deep!(); } diff --git a/src/test/ui/macro_backtrace/main.stderr b/src/test/ui/macro_backtrace/main.stderr new file mode 100644 index 0000000000..5990f71b3c --- /dev/null +++ b/src/test/ui/macro_backtrace/main.stderr @@ -0,0 +1,78 @@ +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` + --> $DIR/main.rs:19:20 + | +18 | / macro_rules! pong { +19 | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens here +20 | | } + | |_- in this expansion of `pong!` +... +26 | pong!(); + | -------- in this macro invocation + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` + --> $DIR/main.rs:19:20 + | +18 | / macro_rules! pong { +19 | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens here +20 | | } + | |_- in this expansion of `pong!` +... +27 | ping!(); + | -------- in this macro invocation + | + ::: <ping macros> + | +1 | ( ) => { pong ! ( ) ; } + | ------------------------- + | | | + | | in this macro invocation + | in this expansion of `ping!` + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` + --> $DIR/main.rs:19:20 + | +18 | / macro_rules! pong { +19 | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens here +20 | | } + | |_- in this expansion of `pong!` (#5) +... +28 | deep!(); + | -------- in this macro invocation (#1) + | + ::: <deep macros> + | +1 | ( ) => { foo ! ( ) ; } + | ------------------------ + | | | + | | in this macro invocation (#2) + | in this expansion of `deep!` (#1) + | + ::: <foo macros> + | +1 | ( ) => { bar ! ( ) ; } + | ------------------------ + | | | + | | in this macro invocation (#3) + | in this expansion of `foo!` (#2) + | + ::: <bar macros> + | +1 | ( ) => { ping ! ( ) ; } + | ------------------------- + | | | + | | in this macro invocation (#4) + | in this expansion of `bar!` (#3) + | + ::: <ping macros> + | +1 | ( ) => { pong ! ( ) ; } + | ------------------------- + | | | + | | in this macro invocation (#5) + | in this expansion of `ping!` (#4) + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/macros/bad_hello.rs b/src/test/ui/macros/bad_hello.rs index a18771deac..174dcc9b6c 100644 --- a/src/test/ui/macros/bad_hello.rs +++ b/src/test/ui/macros/bad_hello.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - println!(3 + 4); + println!(3 + 4); //~ ERROR expected a literal } diff --git a/src/test/ui/macros/bad_hello.stderr b/src/test/ui/macros/bad_hello.stderr index bffb33f468..825aa64e40 100644 --- a/src/test/ui/macros/bad_hello.stderr +++ b/src/test/ui/macros/bad_hello.stderr @@ -1,7 +1,7 @@ error: expected a literal --> $DIR/bad_hello.rs:12:14 | -12 | println!(3 + 4); +12 | println!(3 + 4); //~ ERROR expected a literal | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/format-foreign.rs b/src/test/ui/macros/format-foreign.rs index cca45ca9ec..91ca8f5ff7 100644 --- a/src/test/ui/macros/format-foreign.rs +++ b/src/test/ui/macros/format-foreign.rs @@ -10,11 +10,11 @@ fn main() { println!("%.*3$s %s!\n", "Hello,", "World", 4); - println!("%1$*2$.*3$f", 123.456); + println!("%1$*2$.*3$f", 123.456); //~ ERROR never used // This should *not* produce hints, on the basis that there's equally as // many "correct" format specifiers. It's *probably* just an actual typo. - println!("{} %f", "one", 2.0); + println!("{} %f", "one", 2.0); //~ ERROR never used - println!("Hi there, $NAME.", NAME="Tim"); + println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used } diff --git a/src/test/ui/macros/format-foreign.stderr b/src/test/ui/macros/format-foreign.stderr index 00469b5f79..d0229957b6 100644 --- a/src/test/ui/macros/format-foreign.stderr +++ b/src/test/ui/macros/format-foreign.stderr @@ -11,12 +11,12 @@ error: multiple unused formatting arguments = help: `%.*3$s` should be written as `{:.2$}` = help: `%s` should be written as `{}` = note: printf formatting not supported; see the documentation for `std::fmt` - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: argument never used --> $DIR/format-foreign.rs:13:29 | -13 | println!("%1$*2$.*3$f", 123.456); +13 | println!("%1$*2$.*3$f", 123.456); //~ ERROR never used | ^^^^^^^ | = help: `%1$*2$.*3$f` should be written as `{0:1$.2$}` @@ -25,13 +25,13 @@ error: argument never used error: argument never used --> $DIR/format-foreign.rs:17:30 | -17 | println!("{} %f", "one", 2.0); +17 | println!("{} %f", "one", 2.0); //~ ERROR never used | ^^^ error: named argument never used --> $DIR/format-foreign.rs:19:39 | -19 | println!("Hi there, $NAME.", NAME="Tim"); +19 | println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used | ^^^^^ | = help: `$NAME` should be written as `{NAME}` diff --git a/src/test/ui/macros/format-unused-lables.rs b/src/test/ui/macros/format-unused-lables.rs index f1e349ea9f..7a32d932ba 100644 --- a/src/test/ui/macros/format-unused-lables.rs +++ b/src/test/ui/macros/format-unused-lables.rs @@ -17,7 +17,7 @@ fn main() { 789 ); - println!("Some stuff", UNUSED="args"); + println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used println!("Some more $STUFF", "woo!", diff --git a/src/test/ui/macros/format-unused-lables.stderr b/src/test/ui/macros/format-unused-lables.stderr index bd6d38ccb0..9efdca12de 100644 --- a/src/test/ui/macros/format-unused-lables.stderr +++ b/src/test/ui/macros/format-unused-lables.stderr @@ -8,7 +8,7 @@ error: multiple unused formatting arguments | | unused | unused | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: multiple unused formatting arguments --> $DIR/format-unused-lables.rs:14:5 @@ -23,12 +23,12 @@ error: multiple unused formatting arguments 18 | | ); | |______^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: named argument never used --> $DIR/format-unused-lables.rs:20:35 | -20 | println!("Some stuff", UNUSED="args"); +20 | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used | ^^^^^^ error: multiple unused formatting arguments @@ -47,7 +47,7 @@ error: multiple unused formatting arguments | = help: `$STUFF` should be written as `{STUFF}` = note: shell formatting not supported; see the documentation for `std::fmt` - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.rs b/src/test/ui/macros/macro-backtrace-invalid-internals.rs index 546e06b6c7..037f0d839e 100644 --- a/src/test/ui/macros/macro-backtrace-invalid-internals.rs +++ b/src/test/ui/macros/macro-backtrace-invalid-internals.rs @@ -12,37 +12,37 @@ macro_rules! fake_method_stmt { () => { - 1.fake() + 1.fake() //~ ERROR no method } } macro_rules! fake_field_stmt { () => { - 1.fake + 1.fake //~ ERROR doesn't have fields } } macro_rules! fake_anon_field_stmt { () => { - (1).0 + (1).0 //~ ERROR no field } } macro_rules! fake_method_expr { () => { - 1.fake() + 1.fake() //~ ERROR no method } } macro_rules! fake_field_expr { () => { - 1.fake + 1.fake //~ ERROR doesn't have fields } } macro_rules! fake_anon_field_expr { () => { - (1).0 + (1).0 //~ ERROR no field } } diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr index c80c0fce35..42144f63c3 100644 --- a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:15:13 | -15 | 1.fake() +15 | 1.fake() //~ ERROR no method | ^^^^ ... 50 | fake_method_stmt!(); @@ -10,7 +10,7 @@ error[E0599]: no method named `fake` found for type `{integer}` in the current s error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:21:13 | -21 | 1.fake +21 | 1.fake //~ ERROR doesn't have fields | ^^^^ ... 51 | fake_field_stmt!(); @@ -19,7 +19,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields error[E0609]: no field `0` on type `{integer}` --> $DIR/macro-backtrace-invalid-internals.rs:27:11 | -27 | (1).0 +27 | (1).0 //~ ERROR no field | ^^^^^ ... 52 | fake_anon_field_stmt!(); @@ -28,7 +28,7 @@ error[E0609]: no field `0` on type `{integer}` error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:33:13 | -33 | 1.fake() +33 | 1.fake() //~ ERROR no method | ^^^^ ... 54 | let _ = fake_method_expr!(); @@ -37,7 +37,7 @@ error[E0599]: no method named `fake` found for type `{integer}` in the current s error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:39:13 | -39 | 1.fake +39 | 1.fake //~ ERROR doesn't have fields | ^^^^ ... 55 | let _ = fake_field_expr!(); @@ -46,7 +46,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields error[E0609]: no field `0` on type `{integer}` --> $DIR/macro-backtrace-invalid-internals.rs:45:11 | -45 | (1).0 +45 | (1).0 //~ ERROR no field | ^^^^^ ... 56 | let _ = fake_anon_field_expr!(); diff --git a/src/test/ui/macros/macro-backtrace-nested.rs b/src/test/ui/macros/macro-backtrace-nested.rs index d8bf6222c1..d261633c60 100644 --- a/src/test/ui/macros/macro-backtrace-nested.rs +++ b/src/test/ui/macros/macro-backtrace-nested.rs @@ -12,7 +12,8 @@ // we replace the span of the expanded expression with that of the call site. macro_rules! nested_expr { - () => (fake) + () => (fake) //~ ERROR cannot find + //~^ ERROR cannot find } macro_rules! call_nested_expr { diff --git a/src/test/ui/macros/macro-backtrace-nested.stderr b/src/test/ui/macros/macro-backtrace-nested.stderr index 8b69d112d4..ee4a38312e 100644 --- a/src/test/ui/macros/macro-backtrace-nested.stderr +++ b/src/test/ui/macros/macro-backtrace-nested.stderr @@ -1,19 +1,19 @@ error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:15:12 | -15 | () => (fake) +15 | () => (fake) //~ ERROR cannot find | ^^^^ not found in this scope ... -27 | 1 + call_nested_expr!(); +28 | 1 + call_nested_expr!(); | ------------------- in this macro invocation error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:15:12 | -15 | () => (fake) +15 | () => (fake) //~ ERROR cannot find | ^^^^ not found in this scope ... -28 | call_nested_expr_sum!(); +29 | call_nested_expr_sum!(); | ------------------------ in this macro invocation error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-backtrace-println.rs b/src/test/ui/macros/macro-backtrace-println.rs index baf276919a..6f035bc9d2 100644 --- a/src/test/ui/macros/macro-backtrace-println.rs +++ b/src/test/ui/macros/macro-backtrace-println.rs @@ -21,7 +21,7 @@ macro_rules! myprint { } macro_rules! myprintln { - ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); + ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); //~ ERROR no arguments were given } fn main() { diff --git a/src/test/ui/macros/macro-backtrace-println.stderr b/src/test/ui/macros/macro-backtrace-println.stderr index 3e78229448..c587654d88 100644 --- a/src/test/ui/macros/macro-backtrace-println.stderr +++ b/src/test/ui/macros/macro-backtrace-println.stderr @@ -1,7 +1,7 @@ error: 1 positional argument in format string, but no arguments were given --> $DIR/macro-backtrace-println.rs:24:30 | -24 | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); +24 | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); //~ ERROR no arguments were given | ^^^^^^^^^^^^^^^^^^^ ... 28 | myprintln!("{}"); diff --git a/src/test/ui/macros/macro-name-typo.rs b/src/test/ui/macros/macro-name-typo.rs index ec8d27f913..7fadbf2a90 100644 --- a/src/test/ui/macros/macro-name-typo.rs +++ b/src/test/ui/macros/macro-name-typo.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - printlx!("oh noes!"); + printlx!("oh noes!"); //~ ERROR cannot find } diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr index 7c83250fe8..84851749c7 100644 --- a/src/test/ui/macros/macro-name-typo.stderr +++ b/src/test/ui/macros/macro-name-typo.stderr @@ -1,7 +1,7 @@ error: cannot find macro `printlx!` in this scope --> $DIR/macro-name-typo.rs:12:5 | -12 | printlx!("oh noes!"); +12 | printlx!("oh noes!"); //~ ERROR cannot find | ^^^^^^^ help: you could try the macro: `println!` error: aborting due to previous error diff --git a/src/test/ui/macros/macro_path_as_generic_bound.rs b/src/test/ui/macros/macro_path_as_generic_bound.rs index 781ea30ed8..85cf597489 100644 --- a/src/test/ui/macros/macro_path_as_generic_bound.rs +++ b/src/test/ui/macros/macro_path_as_generic_bound.rs @@ -14,6 +14,6 @@ macro_rules! foo(($t:path) => { impl<T: $t> Foo for T {} }); -foo!(m::m2::A); +foo!(m::m2::A); //~ ERROR failed to resolve fn main() {} diff --git a/src/test/ui/macros/macro_path_as_generic_bound.stderr b/src/test/ui/macros/macro_path_as_generic_bound.stderr index 5c3bb66d83..d59bcaa316 100644 --- a/src/test/ui/macros/macro_path_as_generic_bound.stderr +++ b/src/test/ui/macros/macro_path_as_generic_bound.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve. Use of undeclared type or module `m` --> $DIR/macro_path_as_generic_bound.rs:17:6 | -17 | foo!(m::m2::A); +17 | foo!(m::m2::A); //~ ERROR failed to resolve | ^ Use of undeclared type or module `m` error: cannot continue compilation due to previous error diff --git a/src/test/ui/macros/macro_undefined.rs b/src/test/ui/macros/macro_undefined.rs index db93ba5e2c..c0acbc979a 100644 --- a/src/test/ui/macros/macro_undefined.rs +++ b/src/test/ui/macros/macro_undefined.rs @@ -18,6 +18,6 @@ mod m { } fn main() { - k!(); - kl!(); + k!(); //~ ERROR cannot find + kl!(); //~ ERROR cannot find } diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr index 5c33ae9973..6cfb05e786 100644 --- a/src/test/ui/macros/macro_undefined.stderr +++ b/src/test/ui/macros/macro_undefined.stderr @@ -1,7 +1,7 @@ error: cannot find macro `kl!` in this scope --> $DIR/macro_undefined.rs:22:5 | -22 | kl!(); +22 | kl!(); //~ ERROR cannot find | ^^ | = help: have you added the `#[macro_use]` on the module/import? @@ -9,7 +9,7 @@ error: cannot find macro `kl!` in this scope error: cannot find macro `k!` in this scope --> $DIR/macro_undefined.rs:21:5 | -21 | k!(); +21 | k!(); //~ ERROR cannot find | ^ help: you could try the macro: `kl!` error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/trace-macro.rs b/src/test/ui/macros/trace-macro.rs index 34f674ae01..7e6da84090 100644 --- a/src/test/ui/macros/trace-macro.rs +++ b/src/test/ui/macros/trace-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z trace-macros +// must-compile-successfully fn main() { println!("Hello, World!"); diff --git a/src/test/ui/macros/trace-macro.stderr b/src/test/ui/macros/trace-macro.stderr index 6cf3b0bd35..842799648b 100644 --- a/src/test/ui/macros/trace-macro.stderr +++ b/src/test/ui/macros/trace-macro.stderr @@ -1,7 +1,7 @@ note: trace_macro - --> $DIR/trace-macro.rs:14:5 + --> $DIR/trace-macro.rs:15:5 | -14 | println!("Hello, World!"); +15 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expanding `println! { "Hello, World!" }` diff --git a/src/test/ui/macros/trace_faulty_macros.rs b/src/test/ui/macros/trace_faulty_macros.rs index eb7292b0a6..ced1a7f68f 100644 --- a/src/test/ui/macros/trace_faulty_macros.rs +++ b/src/test/ui/macros/trace_faulty_macros.rs @@ -14,7 +14,7 @@ macro_rules! my_faulty_macro { () => { - my_faulty_macro!(bcd); + my_faulty_macro!(bcd); //~ ERROR no rules }; } @@ -29,7 +29,7 @@ macro_rules! pat_macro { macro_rules! my_recursive_macro { () => { - my_recursive_macro!(); + my_recursive_macro!(); //~ ERROR recursion limit }; } diff --git a/src/test/ui/macros/trace_faulty_macros.stderr b/src/test/ui/macros/trace_faulty_macros.stderr index f4aeb8332f..b0e4a56a3d 100644 --- a/src/test/ui/macros/trace_faulty_macros.stderr +++ b/src/test/ui/macros/trace_faulty_macros.stderr @@ -1,7 +1,7 @@ error: no rules expected the token `bcd` --> $DIR/trace_faulty_macros.rs:17:26 | -17 | my_faulty_macro!(bcd); +17 | my_faulty_macro!(bcd); //~ ERROR no rules | ^^^ ... 43 | my_faulty_macro!(); @@ -20,7 +20,7 @@ note: trace_macro error: recursion limit reached while expanding the macro `my_recursive_macro` --> $DIR/trace_faulty_macros.rs:32:9 | -32 | my_recursive_macro!(); +32 | my_recursive_macro!(); //~ ERROR recursion limit | ^^^^^^^^^^^^^^^^^^^^^^ ... 44 | my_recursive_macro!(); diff --git a/src/test/compile-fail/main-wrong-location.rs b/src/test/ui/main-wrong-location.rs similarity index 90% rename from src/test/compile-fail/main-wrong-location.rs rename to src/test/ui/main-wrong-location.rs index ef3f8140c6..45be5f1478 100644 --- a/src/test/compile-fail/main-wrong-location.rs +++ b/src/test/ui/main-wrong-location.rs @@ -11,5 +11,5 @@ mod m { // An inferred main entry point (that doesn't use #[main]) // must appear at the top of the crate - fn main() { } //~ NOTE here is a function named 'main' + fn main() { } } diff --git a/src/test/ui/main-wrong-location.stderr b/src/test/ui/main-wrong-location.stderr new file mode 100644 index 0000000000..cb9740b877 --- /dev/null +++ b/src/test/ui/main-wrong-location.stderr @@ -0,0 +1,11 @@ +error[E0601]: main function not found + | + = note: the main function must be defined at the crate level but you have one or more functions named 'main' that are not defined at the crate level. Either move the definition or attach the `#[main]` attribute to override this behavior. +note: here is a function named 'main' + --> $DIR/main-wrong-location.rs:14:5 + | +14| fn main() { } + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/maybe-bounds.rs b/src/test/ui/maybe-bounds.rs similarity index 92% rename from src/test/compile-fail/maybe-bounds.rs rename to src/test/ui/maybe-bounds.rs index b0b412bbf8..1dc198dee8 100644 --- a/src/test/compile-fail/maybe-bounds.rs +++ b/src/test/ui/maybe-bounds.rs @@ -9,7 +9,6 @@ // except according to those terms. trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits - //~^ NOTE traits are `?Sized` by default type A1 = Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types type A2 = for<'a> Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types diff --git a/src/test/ui/maybe-bounds.stderr b/src/test/ui/maybe-bounds.stderr new file mode 100644 index 0000000000..df9c3bca36 --- /dev/null +++ b/src/test/ui/maybe-bounds.stderr @@ -0,0 +1,22 @@ +error: `?Trait` is not permitted in supertraits + --> $DIR/maybe-bounds.rs:11:12 + | +11 | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits + | ^^^^^ + | + = note: traits are `?Sized` by default + +error: `?Trait` is not permitted in trait object types + --> $DIR/maybe-bounds.rs:13:17 + | +13 | type A1 = Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types + | ^^^^^ + +error: `?Trait` is not permitted in trait object types + --> $DIR/maybe-bounds.rs:14:25 + | +14 | type A2 = for<'a> Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types + | ^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/method-call-err-msg.rs b/src/test/ui/method-call-err-msg.rs index 14fa74d1f3..3434cf96fc 100644 --- a/src/test/ui/method-call-err-msg.rs +++ b/src/test/ui/method-call-err-msg.rs @@ -13,26 +13,18 @@ pub struct Foo; impl Foo { fn zero(self) -> Foo { self } - //~^ NOTE defined here fn one(self, _: isize) -> Foo { self } - //~^ NOTE defined here fn two(self, _: isize, _: isize) -> Foo { self } - //~^ NOTE defined here } fn main() { let x = Foo; x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied - //~^ NOTE expected 0 parameters .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied - //~^ NOTE expected 1 parameter .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied - //~^ NOTE expected 2 parameters let y = Foo; y.zero() .take() //~ ERROR no method named `take` found for type `Foo` in the current scope - //~^ NOTE the method `take` exists but the following trait bounds were not satisfied - //~| NOTE the following traits define an item `take`, perhaps you need to implement one of them .one(0); } diff --git a/src/test/ui/method-call-err-msg.stderr b/src/test/ui/method-call-err-msg.stderr index c39c62daf9..8685d0fc9c 100644 --- a/src/test/ui/method-call-err-msg.stderr +++ b/src/test/ui/method-call-err-msg.stderr @@ -1,34 +1,37 @@ error[E0061]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:25:12 + --> $DIR/method-call-err-msg.rs:22:7 | 15 | fn zero(self) -> Foo { self } - | ----------------------------- defined here + | -------------------- defined here ... -25 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied - | ^ expected 0 parameters +22 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied + | ^^^^ expected 0 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/method-call-err-msg.rs:27:7 + --> $DIR/method-call-err-msg.rs:23:7 | -17 | fn one(self, _: isize) -> Foo { self } - | -------------------------------------- defined here +16 | fn one(self, _: isize) -> Foo { self } + | ----------------------------- defined here ... -27 | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied +23 | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied | ^^^ expected 1 parameter error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:29:11 + --> $DIR/method-call-err-msg.rs:24:7 | -19 | fn two(self, _: isize, _: isize) -> Foo { self } - | ------------------------------------------------ defined here +17 | fn two(self, _: isize, _: isize) -> Foo { self } + | --------------------------------------- defined here ... -29 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied - | ^ expected 2 parameters +24 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied + | ^^^ expected 2 parameters error[E0599]: no method named `take` found for type `Foo` in the current scope - --> $DIR/method-call-err-msg.rs:34:7 + --> $DIR/method-call-err-msg.rs:28:7 | -34 | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope +13 | pub struct Foo; + | --------------- method `take` not found for this +... +28 | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope | ^^^^ | = note: the method `take` exists but the following trait bounds were not satisfied: diff --git a/src/test/compile-fail/method-missing-call.rs b/src/test/ui/method-missing-call.rs similarity index 90% rename from src/test/compile-fail/method-missing-call.rs rename to src/test/ui/method-missing-call.rs index b13d4250ee..7a6ea94d97 100644 --- a/src/test/compile-fail/method-missing-call.rs +++ b/src/test/ui/method-missing-call.rs @@ -30,7 +30,6 @@ fn main() { let point: Point = Point::new(); let px: isize = point .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` - //~^ HELP maybe a `()` to call it is missing // Ensure the span is useful let ys = &[1,2,3,4,5,6,7]; @@ -38,5 +37,4 @@ fn main() { .map(|x| x) .filter(|&&x| x == 1) .filter_map; //~ ERROR attempted to take value of method `filter_map` on type - //~^ HELP maybe a `()` to call it is missing } diff --git a/src/test/ui/method-missing-call.stderr b/src/test/ui/method-missing-call.stderr new file mode 100644 index 0000000000..d4cffbff4e --- /dev/null +++ b/src/test/ui/method-missing-call.stderr @@ -0,0 +1,18 @@ +error[E0615]: attempted to take value of method `get_x` on type `Point` + --> $DIR/method-missing-call.rs:32:26 + | +32 | .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` + | ^^^^^ + | + = help: maybe a `()` to call it is missing? + +error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter<std::iter::Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:37:20: 37:25]>, [closure@$DIR/method-missing-call.rs:38:23: 38:35]>` + --> $DIR/method-missing-call.rs:39:16 + | +39 | .filter_map; //~ ERROR attempted to take value of method `filter_map` on type + | ^^^^^^^^^^ + | + = help: maybe a `()` to call it is missing? + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/mismatched_types/E0053.rs b/src/test/ui/mismatched_types/E0053.rs index 933462e553..c09d6673ae 100644 --- a/src/test/ui/mismatched_types/E0053.rs +++ b/src/test/ui/mismatched_types/E0053.rs @@ -9,8 +9,8 @@ // except according to those terms. trait Foo { - fn foo(x: u16); //~ NOTE type in trait - fn bar(&self); //~ NOTE type in trait + fn foo(x: u16); + fn bar(&self); } struct Bar; @@ -18,12 +18,8 @@ struct Bar; impl Foo for Bar { fn foo(x: i16) { } //~^ ERROR method `foo` has an incompatible type for trait - //~| NOTE expected u16 fn bar(&mut self) { } //~^ ERROR method `bar` has an incompatible type for trait - //~| NOTE types differ in mutability - //~| NOTE expected type `fn(&Bar)` - //~| NOTE found type `fn(&mut Bar)` } fn main() { diff --git a/src/test/ui/mismatched_types/E0053.stderr b/src/test/ui/mismatched_types/E0053.stderr index d9871b8970..226cb473e7 100644 --- a/src/test/ui/mismatched_types/E0053.stderr +++ b/src/test/ui/mismatched_types/E0053.stderr @@ -1,7 +1,7 @@ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/E0053.rs:19:15 | -12 | fn foo(x: u16); //~ NOTE type in trait +12 | fn foo(x: u16); | --- type in trait ... 19 | fn foo(x: i16) { } @@ -11,12 +11,12 @@ error[E0053]: method `foo` has an incompatible type for trait found type `fn(i16)` error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/E0053.rs:22:12 + --> $DIR/E0053.rs:21:12 | -13 | fn bar(&self); //~ NOTE type in trait +13 | fn bar(&self); | ----- type in trait ... -22 | fn bar(&mut self) { } +21 | fn bar(&mut self) { } | ^^^^^^^^^ types differ in mutability | = note: expected type `fn(&Bar)` diff --git a/src/test/ui/mismatched_types/E0409.rs b/src/test/ui/mismatched_types/E0409.rs index e89cc9ea5c..345020f2ea 100644 --- a/src/test/ui/mismatched_types/E0409.rs +++ b/src/test/ui/mismatched_types/E0409.rs @@ -13,12 +13,7 @@ fn main() { match x { (0, ref y) | (y, 0) => {} //~ ERROR E0409 - //~^ NOTE bound in different ways - //~| NOTE first binding //~| ERROR E0308 - //~| NOTE expected &{integer}, found integral variable - //~| NOTE expected type `&{integer}` - //~| NOTE found type `{integer}` _ => () } } diff --git a/src/test/ui/mismatched_types/E0631.rs b/src/test/ui/mismatched_types/E0631.rs index e28f15ab0b..7e5490b37c 100644 --- a/src/test/ui/mismatched_types/E0631.rs +++ b/src/test/ui/mismatched_types/E0631.rs @@ -14,8 +14,8 @@ fn foo<F: Fn(usize)>(_: F) {} fn bar<F: Fn<usize>>(_: F) {} fn main() { fn f(_: u64) {} - foo(|_: isize| {}); - bar(|_: isize| {}); - foo(f); - bar(f); + foo(|_: isize| {}); //~ ERROR type mismatch + bar(|_: isize| {}); //~ ERROR type mismatch + foo(f); //~ ERROR type mismatch + bar(f); //~ ERROR type mismatch } diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 235e7a1006..442900e0a8 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -1,8 +1,8 @@ error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:17:5 | -17 | foo(|_: isize| {}); - | ^^^ ------------- found signature of `fn(isize) -> _` +17 | foo(|_: isize| {}); //~ ERROR type mismatch + | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` | @@ -11,8 +11,8 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:18:5 | -18 | bar(|_: isize| {}); - | ^^^ ------------- found signature of `fn(isize) -> _` +18 | bar(|_: isize| {}); //~ ERROR type mismatch + | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` | @@ -21,22 +21,22 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:19:5 | -19 | foo(f); - | ^^^ - | | - | expected signature of `fn(usize) -> _` - | found signature of `fn(u64) -> _` +16 | fn f(_: u64) {} + | ------------ found signature of `fn(u64) -> _` +... +19 | foo(f); //~ ERROR type mismatch + | ^^^ expected signature of `fn(usize) -> _` | = note: required by `foo` error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:20:5 | -20 | bar(f); - | ^^^ - | | - | expected signature of `fn(usize) -> _` - | found signature of `fn(u64) -> _` +16 | fn f(_: u64) {} + | ------------ found signature of `fn(u64) -> _` +... +20 | bar(f); //~ ERROR type mismatch + | ^^^ expected signature of `fn(usize) -> _` | = note: required by `bar` diff --git a/src/test/ui/mismatched_types/abridged.rs b/src/test/ui/mismatched_types/abridged.rs index 03f889224b..f496df58f7 100644 --- a/src/test/ui/mismatched_types/abridged.rs +++ b/src/test/ui/mismatched_types/abridged.rs @@ -23,19 +23,19 @@ struct X<T1, T2> { } fn a() -> Foo { - Some(Foo { bar: 1 }) + Some(Foo { bar: 1 }) //~ ERROR mismatched types } fn a2() -> Foo { - Ok(Foo { bar: 1}) + Ok(Foo { bar: 1}) //~ ERROR mismatched types } fn b() -> Option<Foo> { - Foo { bar: 1 } + Foo { bar: 1 } //~ ERROR mismatched types } fn c() -> Result<Foo, Bar> { - Foo { bar: 1 } + Foo { bar: 1 } //~ ERROR mismatched types } fn d() -> X<X<String, String>, String> { @@ -46,7 +46,7 @@ fn d() -> X<X<String, String>, String> { }, y: 3, }; - x + x //~ ERROR mismatched types } fn e() -> X<X<String, String>, String> { @@ -57,7 +57,7 @@ fn e() -> X<X<String, String>, String> { }, y: "".to_string(), }; - x + x //~ ERROR mismatched types } fn main() {} diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr index 8c63d7d6f9..2e1e5afad3 100644 --- a/src/test/ui/mismatched_types/abridged.stderr +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | 25 | fn a() -> Foo { | --- expected `Foo` because of return type -26 | Some(Foo { bar: 1 }) +26 | Some(Foo { bar: 1 }) //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::option::Option` | = note: expected type `Foo` @@ -14,7 +14,7 @@ error[E0308]: mismatched types | 29 | fn a2() -> Foo { | --- expected `Foo` because of return type -30 | Ok(Foo { bar: 1}) +30 | Ok(Foo { bar: 1}) //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result` | = note: expected type `Foo` @@ -25,7 +25,7 @@ error[E0308]: mismatched types | 33 | fn b() -> Option<Foo> { | ----------- expected `std::option::Option<Foo>` because of return type -34 | Foo { bar: 1 } +34 | Foo { bar: 1 } //~ ERROR mismatched types | ^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `Foo` | = note: expected type `std::option::Option<Foo>` @@ -36,7 +36,7 @@ error[E0308]: mismatched types | 37 | fn c() -> Result<Foo, Bar> { | ---------------- expected `std::result::Result<Foo, Bar>` because of return type -38 | Foo { bar: 1 } +38 | Foo { bar: 1 } //~ ERROR mismatched types | ^^^^^^^^^^^^^^ expected enum `std::result::Result`, found struct `Foo` | = note: expected type `std::result::Result<Foo, Bar>` @@ -48,7 +48,7 @@ error[E0308]: mismatched types 41 | fn d() -> X<X<String, String>, String> { | ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type ... -49 | x +49 | x //~ ERROR mismatched types | ^ expected struct `std::string::String`, found integral variable | = note: expected type `X<X<_, std::string::String>, std::string::String>` @@ -60,7 +60,7 @@ error[E0308]: mismatched types 52 | fn e() -> X<X<String, String>, String> { | ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type ... -60 | x +60 | x //~ ERROR mismatched types | ^ expected struct `std::string::String`, found integral variable | = note: expected type `X<X<_, std::string::String>, _>` diff --git a/src/test/ui/mismatched_types/binops.rs b/src/test/ui/mismatched_types/binops.rs index 98449e5966..e45616cd67 100644 --- a/src/test/ui/mismatched_types/binops.rs +++ b/src/test/ui/mismatched_types/binops.rs @@ -9,10 +9,10 @@ // except according to those terms. fn main() { - 1 + Some(1); - 2 as usize - Some(1); - 3 * (); - 4 / ""; - 5 < String::new(); - 6 == Ok(1); + 1 + Some(1); //~ ERROR is not satisfied + 2 as usize - Some(1); //~ ERROR is not satisfied + 3 * (); //~ ERROR is not satisfied + 4 / ""; //~ ERROR is not satisfied + 5 < String::new(); //~ ERROR is not satisfied + 6 == Ok(1); //~ ERROR is not satisfied } diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 6d1a39e0d9..8541ad52e0 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `{integer}: std::ops::Add<std::option::Option<{integer}>>` is not satisfied --> $DIR/binops.rs:12:7 | -12 | 1 + Some(1); +12 | 1 + Some(1); //~ ERROR is not satisfied | ^ no implementation for `{integer} + std::option::Option<{integer}>` | = help: the trait `std::ops::Add<std::option::Option<{integer}>>` is not implemented for `{integer}` @@ -9,7 +9,7 @@ error[E0277]: the trait bound `{integer}: std::ops::Add<std::option::Option<{int error[E0277]: the trait bound `usize: std::ops::Sub<std::option::Option<{integer}>>` is not satisfied --> $DIR/binops.rs:13:16 | -13 | 2 as usize - Some(1); +13 | 2 as usize - Some(1); //~ ERROR is not satisfied | ^ no implementation for `usize - std::option::Option<{integer}>` | = help: the trait `std::ops::Sub<std::option::Option<{integer}>>` is not implemented for `usize` @@ -17,7 +17,7 @@ error[E0277]: the trait bound `usize: std::ops::Sub<std::option::Option<{integer error[E0277]: the trait bound `{integer}: std::ops::Mul<()>` is not satisfied --> $DIR/binops.rs:14:7 | -14 | 3 * (); +14 | 3 * (); //~ ERROR is not satisfied | ^ no implementation for `{integer} * ()` | = help: the trait `std::ops::Mul<()>` is not implemented for `{integer}` @@ -25,7 +25,7 @@ error[E0277]: the trait bound `{integer}: std::ops::Mul<()>` is not satisfied error[E0277]: the trait bound `{integer}: std::ops::Div<&str>` is not satisfied --> $DIR/binops.rs:15:7 | -15 | 4 / ""; +15 | 4 / ""; //~ ERROR is not satisfied | ^ no implementation for `{integer} / &str` | = help: the trait `std::ops::Div<&str>` is not implemented for `{integer}` @@ -33,7 +33,7 @@ error[E0277]: the trait bound `{integer}: std::ops::Div<&str>` is not satisfied error[E0277]: the trait bound `{integer}: std::cmp::PartialOrd<std::string::String>` is not satisfied --> $DIR/binops.rs:16:7 | -16 | 5 < String::new(); +16 | 5 < String::new(); //~ ERROR is not satisfied | ^ can't compare `{integer}` with `std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` @@ -41,7 +41,7 @@ error[E0277]: the trait bound `{integer}: std::cmp::PartialOrd<std::string::Stri error[E0277]: the trait bound `{integer}: std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not satisfied --> $DIR/binops.rs:17:7 | -17 | 6 == Ok(1); +17 | 6 == Ok(1); //~ ERROR is not satisfied | ^^ can't compare `{integer}` with `std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` diff --git a/src/test/ui/mismatched_types/cast-rfc0401.rs b/src/test/ui/mismatched_types/cast-rfc0401.rs index f72be0d705..15388b3a76 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.rs +++ b/src/test/ui/mismatched_types/cast-rfc0401.rs @@ -10,12 +10,12 @@ fn illegal_cast<U:?Sized,V:?Sized>(u: *const U) -> *const V { - u as *const V + u as *const V //~ ERROR is invalid } fn illegal_cast_2<U:?Sized>(u: *const U) -> *const str { - u as *const str + u as *const str //~ ERROR is invalid } trait Foo { fn foo(&self) {} } @@ -36,47 +36,47 @@ fn main() let fat_sv : *const [i8] = unsafe { &*(0 as *const [i8; 1])}; let foo: &Foo = &f; - let _ = v as &u8; - let _ = v as E; - let _ = v as fn(); - let _ = v as (u32,); - let _ = Some(&v) as *const u8; + let _ = v as &u8; //~ ERROR non-primitive cast + let _ = v as E; //~ ERROR non-primitive cast + let _ = v as fn(); //~ ERROR non-primitive cast + let _ = v as (u32,); //~ ERROR non-primitive cast + let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast - let _ = v as f32; - let _ = main as f64; - let _ = &v as usize; - let _ = f as *const u8; - let _ = 3_i32 as bool; - let _ = E::A as bool; - let _ = 0x61u32 as char; + let _ = v as f32; //~ ERROR is invalid + let _ = main as f64; //~ ERROR is invalid + let _ = &v as usize; //~ ERROR is invalid + let _ = f as *const u8; //~ ERROR is invalid + let _ = 3_i32 as bool; //~ ERROR cannot cast + let _ = E::A as bool; //~ ERROR cannot cast + let _ = 0x61u32 as char; //~ ERROR can be cast as - let _ = false as f32; - let _ = E::A as f32; - let _ = 'a' as f32; + let _ = false as f32; //~ ERROR is invalid + let _ = E::A as f32; //~ ERROR is invalid + let _ = 'a' as f32; //~ ERROR is invalid - let _ = false as *const u8; - let _ = E::A as *const u8; - let _ = 'a' as *const u8; + let _ = false as *const u8; //~ ERROR is invalid + let _ = E::A as *const u8; //~ ERROR is invalid + let _ = 'a' as *const u8; //~ ERROR is invalid - let _ = 42usize as *const [u8]; - let _ = v as *const [u8]; - let _ = fat_v as *const Foo; - let _ = foo as *const str; - let _ = foo as *mut str; - let _ = main as *mut str; - let _ = &f as *mut f32; - let _ = &f as *const f64; - let _ = fat_sv as usize; + let _ = 42usize as *const [u8]; //~ ERROR is invalid + let _ = v as *const [u8]; //~ ERROR cannot cast + let _ = fat_v as *const Foo; //~ ERROR is not satisfied + let _ = foo as *const str; //~ ERROR is invalid + let _ = foo as *mut str; //~ ERROR is invalid + let _ = main as *mut str; //~ ERROR is invalid + let _ = &f as *mut f32; //~ ERROR is invalid + let _ = &f as *const f64; //~ ERROR is invalid + let _ = fat_sv as usize; //~ ERROR is invalid let a : *const str = "hello"; - let _ = a as *const Foo; + let _ = a as *const Foo; //~ ERROR is not satisfied // check no error cascade - let _ = main.f as *const u32; + let _ = main.f as *const u32; //~ ERROR no field let cf: *const Foo = &0; - let _ = cf as *const [u16]; - let _ = cf as *const Bar; + let _ = cf as *const [u16]; //~ ERROR is invalid + let _ = cf as *const Bar; //~ ERROR is invalid - vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); + vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); //~ ERROR is invalid } diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index fb363c388b..fa4f590362 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `*const U` as `*const V` is invalid --> $DIR/cast-rfc0401.rs:13:5 | -13 | u as *const V +13 | u as *const V //~ ERROR is invalid | ^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -9,7 +9,7 @@ error[E0606]: casting `*const U` as `*const V` is invalid error[E0606]: casting `*const U` as `*const str` is invalid --> $DIR/cast-rfc0401.rs:18:5 | -18 | u as *const str +18 | u as *const str //~ ERROR is invalid | ^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -17,13 +17,13 @@ error[E0606]: casting `*const U` as `*const str` is invalid error[E0609]: no field `f` on type `fn() {main}` --> $DIR/cast-rfc0401.rs:75:18 | -75 | let _ = main.f as *const u32; +75 | let _ = main.f as *const u32; //~ ERROR no field | ^ error[E0605]: non-primitive cast: `*const u8` as `&u8` --> $DIR/cast-rfc0401.rs:39:13 | -39 | let _ = v as &u8; +39 | let _ = v as &u8; //~ ERROR non-primitive cast | ^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -31,7 +31,7 @@ error[E0605]: non-primitive cast: `*const u8` as `&u8` error[E0605]: non-primitive cast: `*const u8` as `E` --> $DIR/cast-rfc0401.rs:40:13 | -40 | let _ = v as E; +40 | let _ = v as E; //~ ERROR non-primitive cast | ^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -39,7 +39,7 @@ error[E0605]: non-primitive cast: `*const u8` as `E` error[E0605]: non-primitive cast: `*const u8` as `fn()` --> $DIR/cast-rfc0401.rs:41:13 | -41 | let _ = v as fn(); +41 | let _ = v as fn(); //~ ERROR non-primitive cast | ^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -47,7 +47,7 @@ error[E0605]: non-primitive cast: `*const u8` as `fn()` error[E0605]: non-primitive cast: `*const u8` as `(u32,)` --> $DIR/cast-rfc0401.rs:42:13 | -42 | let _ = v as (u32,); +42 | let _ = v as (u32,); //~ ERROR non-primitive cast | ^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -55,7 +55,7 @@ error[E0605]: non-primitive cast: `*const u8` as `(u32,)` error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u8` --> $DIR/cast-rfc0401.rs:43:13 | -43 | let _ = Some(&v) as *const u8; +43 | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast | ^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -63,19 +63,19 @@ error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u error[E0606]: casting `*const u8` as `f32` is invalid --> $DIR/cast-rfc0401.rs:45:13 | -45 | let _ = v as f32; +45 | let _ = v as f32; //~ ERROR is invalid | ^^^^^^^^ error[E0606]: casting `fn() {main}` as `f64` is invalid --> $DIR/cast-rfc0401.rs:46:13 | -46 | let _ = main as f64; +46 | let _ = main as f64; //~ ERROR is invalid | ^^^^^^^^^^^ error[E0606]: casting `&*const u8` as `usize` is invalid --> $DIR/cast-rfc0401.rs:47:13 | -47 | let _ = &v as usize; +47 | let _ = &v as usize; //~ ERROR is invalid | ^^^^^^^^^^^ | = help: cast through a raw pointer first @@ -83,13 +83,13 @@ error[E0606]: casting `&*const u8` as `usize` is invalid error[E0606]: casting `f32` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:48:13 | -48 | let _ = f as *const u8; +48 | let _ = f as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^ error[E0054]: cannot cast as `bool` --> $DIR/cast-rfc0401.rs:49:13 | -49 | let _ = 3_i32 as bool; +49 | let _ = 3_i32 as bool; //~ ERROR cannot cast | ^^^^^^^^^^^^^ unsupported cast | = help: compare with zero instead @@ -97,7 +97,7 @@ error[E0054]: cannot cast as `bool` error[E0054]: cannot cast as `bool` --> $DIR/cast-rfc0401.rs:50:13 | -50 | let _ = E::A as bool; +50 | let _ = E::A as bool; //~ ERROR cannot cast | ^^^^^^^^^^^^ unsupported cast | = help: compare with zero instead @@ -105,13 +105,13 @@ error[E0054]: cannot cast as `bool` error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/cast-rfc0401.rs:51:13 | -51 | let _ = 0x61u32 as char; +51 | let _ = 0x61u32 as char; //~ ERROR can be cast as | ^^^^^^^^^^^^^^^ error[E0606]: casting `bool` as `f32` is invalid --> $DIR/cast-rfc0401.rs:53:13 | -53 | let _ = false as f32; +53 | let _ = false as f32; //~ ERROR is invalid | ^^^^^^^^^^^^ | = help: cast through an integer first @@ -119,7 +119,7 @@ error[E0606]: casting `bool` as `f32` is invalid error[E0606]: casting `E` as `f32` is invalid --> $DIR/cast-rfc0401.rs:54:13 | -54 | let _ = E::A as f32; +54 | let _ = E::A as f32; //~ ERROR is invalid | ^^^^^^^^^^^ | = help: cast through an integer first @@ -127,7 +127,7 @@ error[E0606]: casting `E` as `f32` is invalid error[E0606]: casting `char` as `f32` is invalid --> $DIR/cast-rfc0401.rs:55:13 | -55 | let _ = 'a' as f32; +55 | let _ = 'a' as f32; //~ ERROR is invalid | ^^^^^^^^^^ | = help: cast through an integer first @@ -135,67 +135,67 @@ error[E0606]: casting `char` as `f32` is invalid error[E0606]: casting `bool` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:57:13 | -57 | let _ = false as *const u8; +57 | let _ = false as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^^ error[E0606]: casting `E` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:58:13 | -58 | let _ = E::A as *const u8; +58 | let _ = E::A as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `char` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:59:13 | -59 | let _ = 'a' as *const u8; +59 | let _ = 'a' as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*const [u8]` is invalid --> $DIR/cast-rfc0401.rs:61:13 | -61 | let _ = 42usize as *const [u8]; +61 | let _ = 42usize as *const [u8]; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^^^^^^ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` --> $DIR/cast-rfc0401.rs:62:13 | -62 | let _ = v as *const [u8]; +62 | let _ = v as *const [u8]; //~ ERROR cannot cast | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&Foo` as `*const str` is invalid --> $DIR/cast-rfc0401.rs:64:13 | -64 | let _ = foo as *const str; +64 | let _ = foo as *const str; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `&Foo` as `*mut str` is invalid --> $DIR/cast-rfc0401.rs:65:13 | -65 | let _ = foo as *mut str; +65 | let _ = foo as *mut str; //~ ERROR is invalid | ^^^^^^^^^^^^^^^ error[E0606]: casting `fn() {main}` as `*mut str` is invalid --> $DIR/cast-rfc0401.rs:66:13 | -66 | let _ = main as *mut str; +66 | let _ = main as *mut str; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*mut f32` is invalid --> $DIR/cast-rfc0401.rs:67:13 | -67 | let _ = &f as *mut f32; +67 | let _ = &f as *mut f32; //~ ERROR is invalid | ^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*const f64` is invalid --> $DIR/cast-rfc0401.rs:68:13 | -68 | let _ = &f as *const f64; +68 | let _ = &f as *const f64; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ error[E0606]: casting `*const [i8]` as `usize` is invalid --> $DIR/cast-rfc0401.rs:69:13 | -69 | let _ = fat_sv as usize; +69 | let _ = fat_sv as usize; //~ ERROR is invalid | ^^^^^^^^^^^^^^^ | = help: cast through a thin pointer first @@ -203,7 +203,7 @@ error[E0606]: casting `*const [i8]` as `usize` is invalid error[E0606]: casting `*const Foo` as `*const [u16]` is invalid --> $DIR/cast-rfc0401.rs:78:13 | -78 | let _ = cf as *const [u16]; +78 | let _ = cf as *const [u16]; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -211,7 +211,7 @@ error[E0606]: casting `*const Foo` as `*const [u16]` is invalid error[E0606]: casting `*const Foo` as `*const Bar` is invalid --> $DIR/cast-rfc0401.rs:79:13 | -79 | let _ = cf as *const Bar; +79 | let _ = cf as *const Bar; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -219,7 +219,7 @@ error[E0606]: casting `*const Foo` as `*const Bar` is invalid error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied --> $DIR/cast-rfc0401.rs:63:13 | -63 | let _ = fat_v as *const Foo; +63 | let _ = fat_v as *const Foo; //~ ERROR is not satisfied | ^^^^^ `[u8]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` @@ -228,7 +228,7 @@ error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied --> $DIR/cast-rfc0401.rs:72:13 | -72 | let _ = a as *const Foo; +72 | let _ = a as *const Foo; //~ ERROR is not satisfied | ^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` @@ -237,13 +237,13 @@ error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied error[E0606]: casting `&{float}` as `f32` is invalid --> $DIR/cast-rfc0401.rs:81:30 | -81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); +81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); //~ ERROR is invalid | ^^^^^^^^ cannot cast `&{float}` as `f32` | help: did you mean `*s`? --> $DIR/cast-rfc0401.rs:81:30 | -81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); +81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); //~ ERROR is invalid | ^ error: aborting due to 34 previous errors diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs index 5d2d1d2b04..1ee24e3985 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.rs +++ b/src/test/ui/mismatched_types/closure-arg-count.rs @@ -13,11 +13,25 @@ fn f<F: Fn<usize>>(_: F) {} fn main() { [1, 2, 3].sort_by(|| panic!()); + //~^ ERROR closure is expected to take [1, 2, 3].sort_by(|tuple| panic!()); + //~^ ERROR closure is expected to take [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); + //~^ ERROR closure is expected to take f(|| panic!()); + //~^ ERROR closure is expected to take let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); + //~^ ERROR closure is expected to take let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); + //~^ ERROR closure is expected to take let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i); + //~^ ERROR closure is expected to take + let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); + //~^ ERROR function is expected to take + let bar = |i, x, y| i; + let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); + //~^ ERROR closure is expected to take } + +fn foo() {} diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index 9de5e8fea0..216f39bac5 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -7,25 +7,25 @@ error[E0593]: closure is expected to take 2 arguments, but it takes 0 arguments | expected closure that takes 2 arguments error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument - --> $DIR/closure-arg-count.rs:16:15 + --> $DIR/closure-arg-count.rs:17:15 | -16 | [1, 2, 3].sort_by(|tuple| panic!()); +17 | [1, 2, 3].sort_by(|tuple| panic!()); | ^^^^^^^ ------- takes 1 argument | | | expected closure that takes 2 arguments error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument - --> $DIR/closure-arg-count.rs:17:15 + --> $DIR/closure-arg-count.rs:19:15 | -17 | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); +19 | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); | ^^^^^^^ ----------------- takes 1 argument | | | expected closure that takes 2 arguments error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:18:5 + --> $DIR/closure-arg-count.rs:21:5 | -18 | f(|| panic!()); +21 | f(|| panic!()); | ^ -- takes 0 arguments | | | expected closure that takes 1 argument @@ -33,28 +33,45 @@ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments = note: required by `f` error[E0593]: closure is expected to take a single tuple as argument, but it takes 2 distinct arguments - --> $DIR/closure-arg-count.rs:20:53 + --> $DIR/closure-arg-count.rs:24:53 | -20 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); +24 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); | ^^^ ------ help: consider changing the closure to accept a tuple: `|(i, x)|` | | | expected closure that takes a single tuple as argument error[E0593]: closure is expected to take a single tuple as argument, but it takes 2 distinct arguments - --> $DIR/closure-arg-count.rs:21:53 + --> $DIR/closure-arg-count.rs:26:53 | -21 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); +26 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); | ^^^ ------------- help: consider changing the closure to accept a tuple: `|(i, x): (usize, _)|` | | | expected closure that takes a single tuple as argument error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments - --> $DIR/closure-arg-count.rs:22:53 + --> $DIR/closure-arg-count.rs:28:53 | -22 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i); +28 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i); | ^^^ --------- takes 3 distinct arguments | | | expected closure that takes a single 2-tuple as argument -error: aborting due to 7 previous errors +error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments + --> $DIR/closure-arg-count.rs:30:53 + | +30 | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); + | ^^^ expected function that takes a single 2-tuple as argument +... +37 | fn foo() {} + | -------- takes 0 arguments + +error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments + --> $DIR/closure-arg-count.rs:33:53 + | +32 | let bar = |i, x, y| i; + | --------- takes 3 distinct arguments +33 | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); + | ^^^ expected closure that takes a single 2-tuple as argument + +error: aborting due to 9 previous errors diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs b/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs index aa9dba4c3f..566998c374 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs @@ -10,12 +10,13 @@ fn main() { let a = [(1u32, 2u32)]; - a.iter().map(|_: (u32, u32)| 45); - a.iter().map(|_: &(u16, u16)| 45); - a.iter().map(|_: (u16, u16)| 45); + a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch + a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch + a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch } fn baz<F: Fn(*mut &u32)>(_: F) {} fn _test<'a>(f: fn(*mut &'a u32)) { - baz(f); + baz(f); //~ ERROR type mismatch + //~^ ERROR type mismatch } diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 866a024ab0..77d3a33276 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:13:14 | -13 | a.iter().map(|_: (u32, u32)| 45); +13 | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch | ^^^ ------------------ found signature of `fn((u32, u32)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -9,7 +9,7 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:14:14 | -14 | a.iter().map(|_: &(u16, u16)| 45); +14 | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch | ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -17,7 +17,7 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:15:14 | -15 | a.iter().map(|_: (u16, u16)| 45); +15 | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch | ^^^ ------------------ found signature of `fn((u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -25,7 +25,7 @@ error[E0631]: type mismatch in closure arguments error[E0631]: type mismatch in function arguments --> $DIR/closure-arg-type-mismatch.rs:20:5 | -20 | baz(f); +20 | baz(f); //~ ERROR type mismatch | ^^^ | | | expected signature of `for<'r> fn(*mut &'r u32) -> _` @@ -36,7 +36,7 @@ error[E0631]: type mismatch in function arguments error[E0271]: type mismatch resolving `for<'r> <fn(*mut &'a u32) as std::ops::FnOnce<(*mut &'r u32,)>>::Output == ()` --> $DIR/closure-arg-type-mismatch.rs:20:5 | -20 | baz(f); +20 | baz(f); //~ ERROR type mismatch | ^^^ expected bound lifetime parameter, found concrete lifetime | = note: required by `baz` diff --git a/src/test/ui/mismatched_types/closure-mismatch.rs b/src/test/ui/mismatched_types/closure-mismatch.rs index 91298cb2bb..5a74e8f933 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.rs +++ b/src/test/ui/mismatched_types/closure-mismatch.rs @@ -15,5 +15,6 @@ impl<T: Fn(&())> Foo for T {} fn baz<T: Foo>(_: T) {} fn main() { - baz(|_| ()); + baz(|_| ()); //~ ERROR type mismatch + //~^ ERROR type mismatch } diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr index a54fd118cc..99767ba1af 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-mismatch.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.rs:18:9: 18:15] as std::ops::FnOnce<(&'r (),)>>::Output == ()` --> $DIR/closure-mismatch.rs:18:5 | -18 | baz(|_| ()); +18 | baz(|_| ()); //~ ERROR type mismatch | ^^^ expected bound lifetime parameter, found concrete lifetime | = note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:18:9: 18:15]` @@ -10,7 +10,7 @@ error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.r error[E0631]: type mismatch in closure arguments --> $DIR/closure-mismatch.rs:18:5 | -18 | baz(|_| ()); +18 | baz(|_| ()); //~ ERROR type mismatch | ^^^ ------ found signature of `fn(_) -> _` | | | expected signature of `for<'r> fn(&'r ()) -> _` diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.rs b/src/test/ui/mismatched_types/const-fn-in-trait.rs index 5e44030eab..e0d5c19f12 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.rs +++ b/src/test/ui/mismatched_types/const-fn-in-trait.rs @@ -14,11 +14,11 @@ trait Foo { fn f() -> u32; - const fn g(); + const fn g(); //~ ERROR cannot be declared const } impl Foo for u32 { - const fn f() -> u32 { 22 } + const fn f() -> u32 { 22 } //~ ERROR cannot be declared const fn g() {} } diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.stderr b/src/test/ui/mismatched_types/const-fn-in-trait.stderr index f7b7635e41..4911db6b2e 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.stderr +++ b/src/test/ui/mismatched_types/const-fn-in-trait.stderr @@ -1,13 +1,13 @@ error[E0379]: trait fns cannot be declared const --> $DIR/const-fn-in-trait.rs:17:5 | -17 | const fn g(); +17 | const fn g(); //~ ERROR cannot be declared const | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/const-fn-in-trait.rs:21:5 | -21 | const fn f() -> u32 { 22 } +21 | const fn f() -> u32 { 22 } //~ ERROR cannot be declared const | ^^^^^ trait fns cannot be const error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/fn-variance-1.rs b/src/test/ui/mismatched_types/fn-variance-1.rs index 4bea8177b7..2b797ef768 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.rs +++ b/src/test/ui/mismatched_types/fn-variance-1.rs @@ -20,12 +20,8 @@ fn main() { apply(&3, takes_imm); apply(&3, takes_mut); //~^ ERROR type mismatch - //~| NOTE types differ in mutability - //~| NOTE required by `apply` apply(&mut 3, takes_mut); apply(&mut 3, takes_imm); //~^ ERROR type mismatch - //~| NOTE types differ in mutability - //~| NOTE required by `apply` } diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index 09a90ef3d6..2a27ffd106 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -1,22 +1,22 @@ error[E0631]: type mismatch in function arguments --> $DIR/fn-variance-1.rs:21:5 | +13 | fn takes_mut(x: &mut isize) { } + | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` +... 21 | apply(&3, takes_mut); - | ^^^^^ - | | - | expected signature of `fn(&{integer}) -> _` - | found signature of `for<'r> fn(&'r mut isize) -> _` + | ^^^^^ expected signature of `fn(&{integer}) -> _` | = note: required by `apply` error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:27:5 + --> $DIR/fn-variance-1.rs:25:5 | -27 | apply(&mut 3, takes_imm); - | ^^^^^ - | | - | expected signature of `fn(&mut {integer}) -> _` - | found signature of `for<'r> fn(&'r isize) -> _` +11 | fn takes_imm(x: &isize) { } + | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` +... +25 | apply(&mut 3, takes_imm); + | ^^^^^ expected signature of `fn(&mut {integer}) -> _` | = note: required by `apply` diff --git a/src/test/ui/mismatched_types/for-loop-has-unit-body.rs b/src/test/ui/mismatched_types/for-loop-has-unit-body.rs index 8c61fc602e..4ffee75348 100644 --- a/src/test/ui/mismatched_types/for-loop-has-unit-body.rs +++ b/src/test/ui/mismatched_types/for-loop-has-unit-body.rs @@ -11,7 +11,5 @@ fn main() { for x in 0..3 { x //~ ERROR mismatched types - //~| NOTE expected () - //~| NOTE expected type `()` } } diff --git a/src/test/ui/mismatched_types/issue-19109.rs b/src/test/ui/mismatched_types/issue-19109.rs index 580684e2e1..0f85218fcb 100644 --- a/src/test/ui/mismatched_types/issue-19109.rs +++ b/src/test/ui/mismatched_types/issue-19109.rs @@ -13,9 +13,6 @@ trait Trait { } fn function(t: &mut Trait) { t as *mut Trait //~^ ERROR: mismatched types - //~| NOTE: expected type `()` - //~| NOTE: found type `*mut Trait` - //~| NOTE: expected (), found *-ptr } fn main() { } diff --git a/src/test/ui/mismatched_types/issue-19109.stderr b/src/test/ui/mismatched_types/issue-19109.stderr index 714d1b3973..2942619f64 100644 --- a/src/test/ui/mismatched_types/issue-19109.stderr +++ b/src/test/ui/mismatched_types/issue-19109.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-19109.rs:14:5 | 13 | fn function(t: &mut Trait) { - | - help: try adding a return type: `-> *mut Trait ` + | - help: try adding a return type: `-> *mut Trait` 14 | t as *mut Trait | ^^^^^^^^^^^^^^^ expected (), found *-ptr | diff --git a/src/test/ui/mismatched_types/issue-26480.rs b/src/test/ui/mismatched_types/issue-26480.rs index f842627e76..33c5e74faf 100644 --- a/src/test/ui/mismatched_types/issue-26480.rs +++ b/src/test/ui/mismatched_types/issue-26480.rs @@ -23,13 +23,13 @@ macro_rules! write { const stdout: i32 = 1; unsafe { write(stdout, $arr.as_ptr() as *const i8, - $arr.len() * size_of($arr[0])); + $arr.len() * size_of($arr[0])); //~ ERROR mismatched types } }} } macro_rules! cast { - ($x:expr) => ($x as ()) + ($x:expr) => ($x as ()) //~ ERROR non-primitive cast } fn main() { diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr index fae831ffb8..5d25cb2f93 100644 --- a/src/test/ui/mismatched_types/issue-26480.stderr +++ b/src/test/ui/mismatched_types/issue-26480.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-26480.rs:26:19 | -26 | $arr.len() * size_of($arr[0])); +26 | $arr.len() * size_of($arr[0])); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize ... 37 | write!(hello); @@ -10,7 +10,7 @@ error[E0308]: mismatched types error[E0605]: non-primitive cast: `{integer}` as `()` --> $DIR/issue-26480.rs:32:19 | -32 | ($x:expr) => ($x as ()) +32 | ($x:expr) => ($x as ()) //~ ERROR non-primitive cast | ^^^^^^^^ ... 38 | cast!(2); diff --git a/src/test/ui/mismatched_types/issue-35030.rs b/src/test/ui/mismatched_types/issue-35030.rs index 006074ead1..503b2e08c3 100644 --- a/src/test/ui/mismatched_types/issue-35030.rs +++ b/src/test/ui/mismatched_types/issue-35030.rs @@ -16,7 +16,7 @@ trait Parser<T> { impl<bool> Parser<bool> for bool { fn parse(text: &str) -> Option<bool> { - Some(true) + Some(true) //~ ERROR mismatched types } } diff --git a/src/test/ui/mismatched_types/issue-35030.stderr b/src/test/ui/mismatched_types/issue-35030.stderr index 46d690c5f0..3ec5d1b7b4 100644 --- a/src/test/ui/mismatched_types/issue-35030.stderr +++ b/src/test/ui/mismatched_types/issue-35030.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-35030.rs:19:14 | -19 | Some(true) +19 | Some(true) //~ ERROR mismatched types | ^^^^ expected type parameter, found bool | = note: expected type `bool` (type parameter) diff --git a/src/test/ui/mismatched_types/issue-36053-2.rs b/src/test/ui/mismatched_types/issue-36053-2.rs index 7e489621e2..bf72e584b5 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.rs +++ b/src/test/ui/mismatched_types/issue-36053-2.rs @@ -16,13 +16,5 @@ use std::iter::once; fn main() { once::<&str>("str").fuse().filter(|a: &str| true).count(); //~^ ERROR no method named `count` - //~| ERROR E0281 - //~| ERROR E0281 - //~| NOTE expected &str, found str - //~| NOTE expected &str, found str - //~| NOTE implements - //~| NOTE implements - //~| NOTE requires - //~| NOTE requires - //~| NOTE the method `count` exists but the following trait bounds + //~| ERROR type mismatch in closure arguments } diff --git a/src/test/ui/mismatched_types/issue-38371.rs b/src/test/ui/mismatched_types/issue-38371.rs index 6b49079c47..b9b6b05996 100644 --- a/src/test/ui/mismatched_types/issue-38371.rs +++ b/src/test/ui/mismatched_types/issue-38371.rs @@ -13,7 +13,7 @@ struct Foo { } -fn foo(&foo: Foo) { +fn foo(&foo: Foo) { //~ ERROR mismatched types } fn bar(foo: Foo) { @@ -27,13 +27,13 @@ fn zar(&foo: &Foo) { // The somewhat unexpected help message in this case is courtesy of // match_default_bindings. -fn agh(&&bar: &u32) { +fn agh(&&bar: &u32) { //~ ERROR mismatched types } -fn bgh(&&bar: u32) { +fn bgh(&&bar: u32) { //~ ERROR mismatched types } -fn ugh(&[bar]: &u32) { +fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice } fn main() {} diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index c80f075021..d34f05e054 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-38371.rs:16:8 | -16 | fn foo(&foo: Foo) { +16 | fn foo(&foo: Foo) { //~ ERROR mismatched types | ^^^^ expected struct `Foo`, found reference | = note: expected type `Foo` @@ -11,7 +11,7 @@ error[E0308]: mismatched types error[E0308]: mismatched types --> $DIR/issue-38371.rs:30:9 | -30 | fn agh(&&bar: &u32) { +30 | fn agh(&&bar: &u32) { //~ ERROR mismatched types | ^^^^ expected u32, found reference | = note: expected type `u32` @@ -21,7 +21,7 @@ error[E0308]: mismatched types error[E0308]: mismatched types --> $DIR/issue-38371.rs:33:8 | -33 | fn bgh(&&bar: u32) { +33 | fn bgh(&&bar: u32) { //~ ERROR mismatched types | ^^^^^ expected u32, found reference | = note: expected type `u32` @@ -30,7 +30,7 @@ error[E0308]: mismatched types error[E0529]: expected an array or slice, found `u32` --> $DIR/issue-38371.rs:36:9 | -36 | fn ugh(&[bar]: &u32) { +36 | fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice | ^^^^^ pattern cannot match with input type `u32` error: aborting due to 4 previous errors diff --git a/src/test/ui/mismatched_types/main.rs b/src/test/ui/mismatched_types/main.rs index f7f1c78c3b..7cf1de7cfe 100644 --- a/src/test/ui/mismatched_types/main.rs +++ b/src/test/ui/mismatched_types/main.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let x: u32 = ( + let x: u32 = ( //~ ERROR mismatched types ); } diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index c8941fbf95..41e4c51239 100644 --- a/src/test/ui/mismatched_types/main.stderr +++ b/src/test/ui/mismatched_types/main.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/main.rs:12:18 | -12 | let x: u32 = ( +12 | let x: u32 = ( //~ ERROR mismatched types | __________________^ 13 | | ); | |_____^ expected u32, found () diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs index a4eb445555..2c7b8218de 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs @@ -14,5 +14,4 @@ fn main() { let a: Result<(), Foo> = Ok(()); a.unwrap(); //~^ ERROR no method named `unwrap` found for type `std::result::Result<(), Foo>` - //~| NOTE the method `unwrap` exists but the following trait bounds were not satisfied } diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.rs b/src/test/ui/mismatched_types/overloaded-calls-bad.rs index 3295e2bebd..00edc07db8 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.rs +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.rs @@ -36,13 +36,8 @@ fn main() { y: 3, }; let ans = s("what"); //~ ERROR mismatched types - //~^ NOTE expected isize, found reference - //~| NOTE expected type - //~| NOTE found type let ans = s(); //~^ ERROR this function takes 1 parameter but 0 parameters were supplied - //~| NOTE expected 1 parameter let ans = s("burma", "shave"); //~^ ERROR this function takes 1 parameter but 2 parameters were supplied - //~| NOTE expected 1 parameter } diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index cd05684f15..1d4adc7d6d 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -8,16 +8,16 @@ error[E0308]: mismatched types found type `&'static str` error[E0057]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/overloaded-calls-bad.rs:42:15 + --> $DIR/overloaded-calls-bad.rs:39:15 | -42 | let ans = s(); +39 | let ans = s(); | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/overloaded-calls-bad.rs:45:17 + --> $DIR/overloaded-calls-bad.rs:41:15 | -45 | let ans = s("burma", "shave"); - | ^^^^^^^^^^^^^^^^ expected 1 parameter +41 | let ans = s("burma", "shave"); + | ^^^^^^^^^^^^^^^^^^^ expected 1 parameter error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/recovered-block.rs b/src/test/ui/mismatched_types/recovered-block.rs new file mode 100644 index 0000000000..f3e3579f2b --- /dev/null +++ b/src/test/ui/mismatched_types/recovered-block.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::env; + +pub struct Foo { + text: String +} + +pub fn foo() -> Foo { + let args: Vec<String> = env::args().collect(); + let text = args[1].clone(); + + pub Foo { text } +} +//~^^ ERROR missing `struct` for struct definition + +pub fn bar() -> Foo { + fn + Foo { text: "".to_string() } +} +//~^^ ERROR expected one of `(` or `<`, found `{` + +fn main() {} diff --git a/src/test/ui/mismatched_types/recovered-block.stderr b/src/test/ui/mismatched_types/recovered-block.stderr new file mode 100644 index 0000000000..dcaf2812f5 --- /dev/null +++ b/src/test/ui/mismatched_types/recovered-block.stderr @@ -0,0 +1,18 @@ +error: missing `struct` for struct definition + --> $DIR/recovered-block.rs:21:8 + | +21 | pub Foo { text } + | ^ +help: add `struct` here to parse `Foo` as a public struct + | +21 | pub struct Foo { text } + | ^^^^^^ + +error: expected one of `(` or `<`, found `{` + --> $DIR/recovered-block.rs:27:9 + | +27 | Foo { text: "".to_string() } + | ^ expected one of `(` or `<` here + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs index 9f832c7b6e..b2aeabdc1e 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs @@ -22,9 +22,6 @@ fn c(x: Box<Foo+Sync+Send>) { fn d(x: Box<Foo>) { a(x); //~ ERROR mismatched types [E0308] - //~| NOTE expected type `Box<Foo + std::marker::Send + 'static>` - //~| NOTE found type `Box<Foo + 'static>` - //~| NOTE expected trait `Foo + std::marker::Send`, found trait `Foo` } fn main() { } diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs index 099c8699e4..420b59a4df 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs @@ -18,8 +18,8 @@ trait Foo { struct Bar; impl Foo for Bar { - fn foo(x: i16) { } - fn bar(&mut self, bar: &Bar) { } + fn foo(x: i16) { } //~ ERROR incompatible type + fn bar(&mut self, bar: &Bar) { } //~ ERROR incompatible type } fn main() { diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 349432f64b..f3cf1d5661 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -4,7 +4,7 @@ error[E0053]: method `foo` has an incompatible type for trait 14 | fn foo(x: u16); | --- type in trait ... -21 | fn foo(x: i16) { } +21 | fn foo(x: i16) { } //~ ERROR incompatible type | ^^^ expected u16, found i16 | = note: expected type `fn(u16)` @@ -16,7 +16,7 @@ error[E0053]: method `bar` has an incompatible type for trait 15 | fn bar(&mut self, bar: &mut Bar); | -------- type in trait ... -22 | fn bar(&mut self, bar: &Bar) { } +22 | fn bar(&mut self, bar: &Bar) { } //~ ERROR incompatible type | ^^^^ types differ in mutability | = note: expected type `fn(&mut Bar, &mut Bar)` diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs index 693a158532..10f4b3229f 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs @@ -20,15 +20,8 @@ fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize { pub fn main() { let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); - //~^ NOTE implements - //~| NOTE implements let z = call_it(3, f); //~^ ERROR type mismatch - //~| NOTE expected isize, found usize - //~| NOTE expected isize, found usize - //~| NOTE requires - //~| NOTE requires - //~| NOTE required by `call_it` - //~| NOTE required by `call_it` + //~| required by `call_it` println!("{}", z); } diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 5988364928..8539c8818c 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -1,10 +1,9 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/unboxed-closures-vtable-mismatch.rs:25:13 + --> $DIR/unboxed-closures-vtable-mismatch.rs:23:13 | 22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); - | -------------------------------------------------- found signature of `fn(usize, isize) -> _` -... -25 | let z = call_it(3, f); + | ----------------------------- found signature of `fn(usize, isize) -> _` +23 | let z = call_it(3, f); | ^^^^^^^ expected signature of `fn(isize, isize) -> _` | = note: required by `call_it` diff --git a/src/test/compile-fail/missing-block-hint.rs b/src/test/ui/missing-block-hint.rs similarity index 85% rename from src/test/compile-fail/missing-block-hint.rs rename to src/test/ui/missing-block-hint.rs index 6a140e6f21..777ff5b9b2 100644 --- a/src/test/compile-fail/missing-block-hint.rs +++ b/src/test/ui/missing-block-hint.rs @@ -15,7 +15,5 @@ fn main() { { if (foo) bar; //~ ERROR expected `{`, found `bar` - //~^ HELP try placing this code inside a block - //~| SUGGESTION { bar; } } } diff --git a/src/test/ui/missing-block-hint.stderr b/src/test/ui/missing-block-hint.stderr new file mode 100644 index 0000000000..3f50fdd461 --- /dev/null +++ b/src/test/ui/missing-block-hint.stderr @@ -0,0 +1,16 @@ +error: expected `{`, found `=>` + --> $DIR/missing-block-hint.rs:13:18 + | +13 | if (foo) => {} //~ ERROR expected `{`, found `=>` + | ^^ + +error: expected `{`, found `bar` + --> $DIR/missing-block-hint.rs:17:13 + | +17 | bar; //~ ERROR expected `{`, found `bar` + | ^^^- + | | + | help: try placing this code inside a block: `{ bar; }` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/missing-items/issue-40221.rs b/src/test/ui/missing-items/issue-40221.rs index 9cf1c7d6de..526fc3a865 100644 --- a/src/test/ui/missing-items/issue-40221.rs +++ b/src/test/ui/missing-items/issue-40221.rs @@ -18,7 +18,7 @@ enum PC { } fn test(proto: P) { - match proto { + match proto { //~ ERROR non-exhaustive patterns P::C(PC::Q) => (), } } diff --git a/src/test/ui/missing-items/issue-40221.stderr b/src/test/ui/missing-items/issue-40221.stderr index fc90c8a2b2..883c4329f4 100644 --- a/src/test/ui/missing-items/issue-40221.stderr +++ b/src/test/ui/missing-items/issue-40221.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `C(QA)` not covered --> $DIR/issue-40221.rs:21:11 | -21 | match proto { +21 | match proto { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `C(QA)` not covered error: aborting due to previous error diff --git a/src/test/ui/missing-items/m2.rs b/src/test/ui/missing-items/m2.rs index ffd7ff7f43..9f19545269 100644 --- a/src/test/ui/missing-items/m2.rs +++ b/src/test/ui/missing-items/m2.rs @@ -16,5 +16,5 @@ extern crate m1; struct X { } -impl m1::X for X { +impl m1::X for X { //~ ERROR not all trait items implemented } diff --git a/src/test/ui/missing-items/m2.stderr b/src/test/ui/missing-items/m2.stderr index ce061bd167..8c57214ec7 100644 --- a/src/test/ui/missing-items/m2.stderr +++ b/src/test/ui/missing-items/m2.stderr @@ -3,9 +3,8 @@ error[E0601]: main function not found error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method` --> $DIR/m2.rs:19:1 | -19 | / impl m1::X for X { -20 | | } - | |_^ missing `CONSTANT`, `Type`, `method` in implementation +19 | impl m1::X for X { //~ ERROR not all trait items implemented + | ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method` in implementation | = note: `CONSTANT` from trait: `const CONSTANT: u32;` = note: `Type` from trait: `type Type;` diff --git a/src/test/ui/missing-items/missing-type-parameter.rs b/src/test/ui/missing-items/missing-type-parameter.rs index 7936858706..f2d5359fb1 100644 --- a/src/test/ui/missing-items/missing-type-parameter.rs +++ b/src/test/ui/missing-items/missing-type-parameter.rs @@ -11,5 +11,5 @@ fn foo<X>() { } fn main() { - foo(); + foo(); //~ ERROR type annotations needed } diff --git a/src/test/ui/missing-items/missing-type-parameter.stderr b/src/test/ui/missing-items/missing-type-parameter.stderr index a16ae5538b..1cb9e5f56d 100644 --- a/src/test/ui/missing-items/missing-type-parameter.stderr +++ b/src/test/ui/missing-items/missing-type-parameter.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/missing-type-parameter.rs:14:5 | -14 | foo(); +14 | foo(); //~ ERROR type annotations needed | ^^^ cannot infer type for `X` error: aborting due to previous error diff --git a/src/test/ui/missing_non_modrs_mod/foo.rs b/src/test/ui/missing_non_modrs_mod/foo.rs new file mode 100644 index 0000000000..7262a26397 --- /dev/null +++ b/src/test/ui/missing_non_modrs_mod/foo.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// ignore-test this is just a helper for the real test in this dir + +mod missing; diff --git a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs new file mode 100644 index 0000000000..9c95f45939 --- /dev/null +++ b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-windows + +mod foo; +fn main() {} diff --git a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr new file mode 100644 index 0000000000..3ba71d32a3 --- /dev/null +++ b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr @@ -0,0 +1,10 @@ +error[E0583]: file not found for module `missing` + --> $DIR/foo.rs:13:5 + | +13 | mod missing; + | ^^^^^^^ + | + = help: name the file either foo/missing.rs or foo/missing/mod.rs inside the directory "$DIR" + +error: aborting due to previous error + diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/ui/moves-based-on-type-block-bad.rs similarity index 96% rename from src/test/compile-fail/moves-based-on-type-block-bad.rs rename to src/test/ui/moves-based-on-type-block-bad.rs index deaff3c352..dd4c4c843a 100644 --- a/src/test/compile-fail/moves-based-on-type-block-bad.rs +++ b/src/test/ui/moves-based-on-type-block-bad.rs @@ -35,7 +35,6 @@ fn main() { //~| cannot move out of borrowed content box E::Foo(_) => {} box E::Bar(x) => println!("{}", x.to_string()), - //~^ NOTE to prevent move box E::Baz => {} } }) diff --git a/src/test/ui/moves-based-on-type-block-bad.stderr b/src/test/ui/moves-based-on-type-block-bad.stderr new file mode 100644 index 0000000000..5fc26a8ad6 --- /dev/null +++ b/src/test/ui/moves-based-on-type-block-bad.stderr @@ -0,0 +1,11 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/moves-based-on-type-block-bad.rs:34:19 + | +34 | match hellothere.x { //~ ERROR cannot move out + | ^^^^^^^^^^ cannot move out of borrowed content +... +37 | box E::Bar(x) => println!("{}", x.to_string()), + | - hint: to prevent move, use `ref x` or `ref mut x` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/moves-based-on-type-match-bindings.rs b/src/test/ui/moves-based-on-type-match-bindings.rs similarity index 95% rename from src/test/compile-fail/moves-based-on-type-match-bindings.rs rename to src/test/ui/moves-based-on-type-match-bindings.rs index bcbb8dbfad..1fd3d03570 100644 --- a/src/test/compile-fail/moves-based-on-type-match-bindings.rs +++ b/src/test/ui/moves-based-on-type-match-bindings.rs @@ -20,7 +20,7 @@ fn f10() { let x = Foo {f: "hi".to_string()}; let y = match x { - Foo {f} => {} //~ NOTE moved here + Foo {f} => {} }; touch(&x); //~ ERROR use of partially moved value: `x` diff --git a/src/test/ui/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves-based-on-type-match-bindings.stderr new file mode 100644 index 0000000000..5256b55f01 --- /dev/null +++ b/src/test/ui/moves-based-on-type-match-bindings.stderr @@ -0,0 +1,13 @@ +error[E0382]: use of partially moved value: `x` + --> $DIR/moves-based-on-type-match-bindings.rs:26:12 + | +23 | Foo {f} => {} + | - value moved here +... +26 | touch(&x); //~ ERROR use of partially moved value: `x` + | ^ value used here after move + | + = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait + +error: aborting due to previous error + diff --git a/src/test/compile-fail/moves-based-on-type-tuple.rs b/src/test/ui/moves-based-on-type-tuple.rs similarity index 77% rename from src/test/compile-fail/moves-based-on-type-tuple.rs rename to src/test/ui/moves-based-on-type-tuple.rs index a4d3e3ee02..27903fee11 100644 --- a/src/test/compile-fail/moves-based-on-type-tuple.rs +++ b/src/test/ui/moves-based-on-type-tuple.rs @@ -10,9 +10,14 @@ #![feature(box_syntax)] +// compile-flags: -Z emit-end-regions -Z borrowck=compare + fn dup(x: Box<isize>) -> Box<(Box<isize>,Box<isize>)> { - box (x, x) //~ ERROR use of moved value + box (x, x) + //~^ use of moved value: `x` (Ast) [E0382] + //~| use of moved value: `x` (Mir) [E0382] } + fn main() { dup(box 3); } diff --git a/src/test/ui/moves-based-on-type-tuple.stderr b/src/test/ui/moves-based-on-type-tuple.stderr new file mode 100644 index 0000000000..e1667107c9 --- /dev/null +++ b/src/test/ui/moves-based-on-type-tuple.stderr @@ -0,0 +1,22 @@ +error[E0382]: use of moved value: `x` (Ast) + --> $DIR/moves-based-on-type-tuple.rs:16:13 + | +16 | box (x, x) + | - ^ value used here after move + | | + | value moved here + | + = note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error[E0382]: use of moved value: `x` (Mir) + --> $DIR/moves-based-on-type-tuple.rs:16:13 + | +16 | box (x, x) + | - ^ value used here after move + | | + | value moved here + | + = note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/mut-ref.rs b/src/test/ui/mut-ref.rs index f888369968..715c4adf2e 100644 --- a/src/test/ui/mut-ref.rs +++ b/src/test/ui/mut-ref.rs @@ -11,6 +11,6 @@ // compile-flags: -Z parse-only fn main() { - let mut ref x = 10; + let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect let ref mut y = 11; } diff --git a/src/test/ui/mut-ref.stderr b/src/test/ui/mut-ref.stderr index ce6a42f1e5..aaab243e22 100644 --- a/src/test/ui/mut-ref.stderr +++ b/src/test/ui/mut-ref.stderr @@ -1,7 +1,7 @@ error: the order of `mut` and `ref` is incorrect --> $DIR/mut-ref.rs:14:9 | -14 | let mut ref x = 10; +14 | let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect | ^^^^^^^ help: try switching the order: `ref mut` error: aborting due to previous error diff --git a/src/test/ui/nll/capture-ref-in-struct.rs b/src/test/ui/nll/capture-ref-in-struct.rs new file mode 100644 index 0000000000..74b086ab18 --- /dev/null +++ b/src/test/ui/nll/capture-ref-in-struct.rs @@ -0,0 +1,51 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll-dump-cause + +// Test that a structure which tries to store a pointer to `y` into +// `p` (indirectly) fails to compile. + +#![feature(rustc_attrs)] +#![feature(nll)] + +struct SomeStruct<'a, 'b: 'a> { + p: &'a mut &'b i32, + y: &'b i32, +} + +fn test() { + let x = 44; + let mut p = &x; + + { + let y = 22; + + let closure = SomeStruct { + p: &mut p, + y: &y, + //~^ ERROR `y` does not live long enough [E0597] + }; + + closure.invoke(); + } + + deref(p); +} + +impl<'a, 'b> SomeStruct<'a, 'b> { + fn invoke(self) { + *self.p = self.y; + } +} + +fn deref(_: &i32) { } + +fn main() { } diff --git a/src/test/ui/nll/capture-ref-in-struct.stderr b/src/test/ui/nll/capture-ref-in-struct.stderr new file mode 100644 index 0000000000..7e7487daa6 --- /dev/null +++ b/src/test/ui/nll/capture-ref-in-struct.stderr @@ -0,0 +1,16 @@ +error[E0597]: `y` does not live long enough + --> $DIR/capture-ref-in-struct.rs:33:16 + | +33 | y: &y, + | ^^ borrowed value does not live long enough +... +38 | } + | - borrowed value only lives until here +39 | +40 | deref(p); + | - borrow later used here + | + = note: borrowed value must be valid for lifetime '_#5r... + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.rs b/src/test/ui/nll/closure-requirements/escape-argument-callee.rs new file mode 100644 index 0000000000..41c744fec6 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.rs @@ -0,0 +1,53 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test closure that: +// +// - takes an argument `y` with lifetime `'a` (in the code, it's anonymous) +// - stores `y` into another, longer-lived spot with lifetime `'b` +// +// Because `'a` and `'b` are two different, unrelated higher-ranked +// regions with no relationship to one another, this is an error. This +// error is reported by the closure itself and is not propagated to +// its creator: this is because `'a` and `'b` are higher-ranked +// (late-bound) regions and the closure is not allowed to propagate +// additional where clauses between higher-ranked regions, only those +// that appear free in its type (hence, we see it before the closure's +// "external requirements" report). + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +#[rustc_regions] +fn test() { + let x = 44; + let mut p = &x; + + { + let y = 22; + let mut closure = expect_sig(|p, y| *p = y); + //~^ ERROR does not outlive free region + //~| WARNING not reporting region error due to -Znll + closure(&mut p, &y); + } + + deref(p); +} + +fn expect_sig<F>(f: F) -> F + where F: FnMut(&mut &i32, &i32) +{ + f +} + +fn deref(_p: &i32) { } + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr new file mode 100644 index 0000000000..3bd02f308c --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -0,0 +1,39 @@ +warning: not reporting region error due to -Znll + --> $DIR/escape-argument-callee.rs:36:50 + | +36 | let mut closure = expect_sig(|p, y| *p = y); + | ^ + +error: free region `ReFree(DefId(0/1:9 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]), BrAnon(3))` does not outlive free region `ReFree(DefId(0/1:9 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]), BrAnon(2))` + --> $DIR/escape-argument-callee.rs:36:45 + | +36 | let mut closure = expect_sig(|p, y| *p = y); + | ^^^^^^ + +note: No external requirements + --> $DIR/escape-argument-callee.rs:36:38 + | +36 | let mut closure = expect_sig(|p, y| *p = y); + | ^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:9 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) mut &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) i32, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) i32)) + ] + +note: No external requirements + --> $DIR/escape-argument-callee.rs:30:1 + | +30 | / fn test() { +31 | | let x = 44; +32 | | let mut p = &x; +33 | | +... | +42 | | deref(p); +43 | | } + | |_^ + | + = note: defining type: DefId(0/0:3 ~ escape_argument_callee[317d]::test[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/escape-argument.rs b/src/test/ui/nll/closure-requirements/escape-argument.rs new file mode 100644 index 0000000000..17fadf0a29 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-argument.rs @@ -0,0 +1,52 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test closure that: +// +// - takes an argument `y` +// - stores `y` into another, longer-lived spot +// +// but is invoked with a spot that doesn't live long +// enough to store `y`. +// +// The error is reported in the caller: invoking the closure links the +// lifetime of the variable that is given as `y` (via subtyping) and +// thus forces the corresponding borrow to live too long. This is +// basically checking that the MIR type checker correctly enforces the +// closure signature. + +// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose + +#![feature(rustc_attrs)] + +#[rustc_regions] +fn test() { + let x = 44; + let mut p = &x; + + { + let y = 22; + let mut closure = expect_sig(|p, y| *p = y); + closure(&mut p, &y); + //~^ ERROR `y` does not live long enough [E0597] + } + + deref(p); +} + +fn expect_sig<F>(f: F) -> F + where F: for<'a, 'b> FnMut(&'a mut &'b i32, &'b i32) +{ + f +} + +fn deref(_p: &i32) { } + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr new file mode 100644 index 0000000000..09d5617b08 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -0,0 +1,41 @@ +note: No external requirements + --> $DIR/escape-argument.rs:36:38 + | +36 | let mut closure = expect_sig(|p, y| *p = y); + | ^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:9 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) mut &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) i32, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) i32)) + ] + +note: No external requirements + --> $DIR/escape-argument.rs:30:1 + | +30 | / fn test() { +31 | | let x = 44; +32 | | let mut p = &x; +33 | | +... | +41 | | deref(p); +42 | | } + | |_^ + | + = note: defining type: DefId(0/0:3 ~ escape_argument[317d]::test[0]) with substs [] + +error[E0597]: `y` does not live long enough + --> $DIR/escape-argument.rs:37:25 + | +37 | closure(&mut p, &y); + | ^^ borrowed value does not live long enough +38 | //~^ ERROR `y` does not live long enough [E0597] +39 | } + | - borrowed value only lives until here +40 | +41 | deref(p); + | - borrow later used here + | + = note: borrowed value must be valid for lifetime '_#6r... + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs b/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs new file mode 100644 index 0000000000..984c9fe7c3 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs @@ -0,0 +1,43 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// As in `escape-upvar-ref.rs`, test closure that: +// +// - captures a variable `y` +// - stores reference to `y` into another, longer-lived spot +// +// except that the closure does so via a second closure. + +// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose + +#![feature(rustc_attrs)] + +#[rustc_regions] +fn test() { + let x = 44; + let mut p = &x; + + { + let y = 22; + + let mut closure = || { //~ ERROR `y` does not live long enough [E0597] + let mut closure1 = || p = &y; + closure1(); + }; + + closure(); + } + + deref(p); +} + +fn deref(_p: &i32) { } + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr new file mode 100644 index 0000000000..430fb711c6 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -0,0 +1,68 @@ +note: External requirements + --> $DIR/escape-upvar-nested.rs:31:32 + | +31 | let mut closure1 = || p = &y; + | ^^^^^^^^^ + | + = note: defining type: DefId(0/1:10 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [ + i16, + extern "rust-call" fn(()), + &'_#1r mut &'_#2r i32, + &'_#3r i32 + ] + = note: number of external vids: 4 + = note: where '_#3r: '_#2r + +note: External requirements + --> $DIR/escape-upvar-nested.rs:30:27 + | +30 | let mut closure = || { //~ ERROR `y` does not live long enough [E0597] + | ___________________________^ +31 | | let mut closure1 = || p = &y; +32 | | closure1(); +33 | | }; + | |_________^ + | + = note: defining type: DefId(0/1:9 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [ + i16, + extern "rust-call" fn(()), + &'_#1r mut &'_#2r i32, + &'_#3r i32 + ] + = note: number of external vids: 4 + = note: where '_#3r: '_#2r + +note: No external requirements + --> $DIR/escape-upvar-nested.rs:23:1 + | +23 | / fn test() { +24 | | let x = 44; +25 | | let mut p = &x; +26 | | +... | +38 | | deref(p); +39 | | } + | |_^ + | + = note: defining type: DefId(0/0:3 ~ escape_upvar_nested[317d]::test[0]) with substs [] + +error[E0597]: `y` does not live long enough + --> $DIR/escape-upvar-nested.rs:30:27 + | +30 | let mut closure = || { //~ ERROR `y` does not live long enough [E0597] + | ___________________________^ +31 | | let mut closure1 = || p = &y; +32 | | closure1(); +33 | | }; + | |_________^ borrowed value does not live long enough +... +36 | } + | - borrowed value only lives until here +37 | +38 | deref(p); + | - borrow later used here + | + = note: borrowed value must be valid for lifetime '_#4r... + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs new file mode 100644 index 0000000000..499ebd6595 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs @@ -0,0 +1,43 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test closure that: +// +// - captures a variable `y` by reference +// - stores that reference to `y` into another, longer-lived place (`p`) +// +// Both of these are upvars of reference type (the capture of `y` is +// of type `&'a i32`, the capture of `p` is of type `&mut &'b +// i32`). The closure thus computes a relationship between `'a` and +// `'b`. This relationship is propagated to the closure creator, +// which reports an error. + +// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose + +#![feature(rustc_attrs)] + +#[rustc_regions] +fn test() { + let x = 44; + let mut p = &x; + + { + let y = 22; + let mut closure = || p = &y; + //~^ ERROR `y` does not live long enough [E0597] + closure(); + } + + deref(p); +} + +fn deref(_p: &i32) { } + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr new file mode 100644 index 0000000000..090bacbc17 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -0,0 +1,45 @@ +note: External requirements + --> $DIR/escape-upvar-ref.rs:33:27 + | +33 | let mut closure = || p = &y; + | ^^^^^^^^^ + | + = note: defining type: DefId(0/1:9 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [ + i16, + extern "rust-call" fn(()), + &'_#1r mut &'_#2r i32, + &'_#3r i32 + ] + = note: number of external vids: 4 + = note: where '_#3r: '_#2r + +note: No external requirements + --> $DIR/escape-upvar-ref.rs:27:1 + | +27 | / fn test() { +28 | | let x = 44; +29 | | let mut p = &x; +30 | | +... | +38 | | deref(p); +39 | | } + | |_^ + | + = note: defining type: DefId(0/0:3 ~ escape_upvar_ref[317d]::test[0]) with substs [] + +error[E0597]: `y` does not live long enough + --> $DIR/escape-upvar-ref.rs:33:27 + | +33 | let mut closure = || p = &y; + | ^^^^^^^^^ borrowed value does not live long enough +... +36 | } + | - borrowed value only lives until here +37 | +38 | deref(p); + | - borrow later used here + | + = note: borrowed value must be valid for lifetime '_#4r... + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs new file mode 100644 index 0000000000..30a6dfc5b3 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs @@ -0,0 +1,63 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test where we fail to approximate due to demanding a postdom +// relationship between our upper bounds. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Callee knows that: +// +// 'x: 'a +// 'x: 'b +// 'c: 'y +// +// we have to prove that `'x: 'y`. We currently can only approximate +// via a postdominator -- hence we fail to choose between `'a` and +// `'b` here and report the error in the closure. +fn establish_relationships<'a, 'b, 'c, F>( + _cell_a: Cell<&'a u32>, + _cell_b: Cell<&'b u32>, + _cell_c: Cell<&'c u32>, + _closure: F, +) where + F: for<'x, 'y> FnMut( + Cell<&'a &'x u32>, // shows that 'x: 'a + Cell<&'b &'x u32>, // shows that 'x: 'b + Cell<&'y &'c u32>, // shows that 'c: 'y + Cell<&'x u32>, + Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_cell_x: Cell<&'x u32>, _cell_y: Cell<&'y u32>, _y: &'y u32) {} + +#[rustc_regions] +fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell<&'c u32>) { + establish_relationships( + cell_a, + cell_b, + cell_c, + |_outlives1, _outlives2, _outlives3, x, y| { + // Only works if 'x: 'y: + let p = x.get(); + //~^ WARN not reporting region error due to -Znll + //~| ERROR does not outlive free region + demand_y(x, y, p) + }, + ); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr new file mode 100644 index 0000000000..7e48c0fc58 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -0,0 +1,45 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-approximated-fail-no-postdom.rs:55:21 + | +55 | let p = x.get(); + | ^^^^^^^ + +error: free region `ReFree(DefId(0/1:20 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]), BrAnon(1))` does not outlive free region `ReFree(DefId(0/1:20 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]), BrAnon(2))` + --> $DIR/propagate-approximated-fail-no-postdom.rs:55:17 + | +55 | let p = x.get(); + | ^ + +note: No external requirements + --> $DIR/propagate-approximated-fail-no-postdom.rs:53:9 + | +53 | / |_outlives1, _outlives2, _outlives3, x, y| { +54 | | // Only works if 'x: 'y: +55 | | let p = x.get(); +56 | | //~^ WARN not reporting region error due to -Znll +57 | | //~| ERROR does not outlive free region +58 | | demand_y(x, y, p) +59 | | }, + | |_________^ + | + = note: defining type: DefId(0/1:20 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>)) + ] + +note: No external requirements + --> $DIR/propagate-approximated-fail-no-postdom.rs:48:1 + | +48 | / fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell<&'c u32>) { +49 | | establish_relationships( +50 | | cell_a, +51 | | cell_b, +... | +60 | | ); +61 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs new file mode 100644 index 0000000000..91128035f3 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs @@ -0,0 +1,61 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Rather convoluted setup where we infer a relationship between two +// free regions in the closure signature (`'a` and `'b`) on the basis +// of a relationship between two bound regions (`'x` and `'y`). +// +// The idea is that, thanks to invoking `demand_y`, `'x: 'y` must +// hold, where `'x` and `'y` are bound regions. The closure can't +// prove that directly, and because `'x` and `'y` are bound it cannot +// ask the caller to prove it either. But it has bounds on `'x` and +// `'y` in terms of `'a` and `'b`, and it can propagate a relationship +// between `'a` and `'b` to the caller. +// +// Note: the use of `Cell` here is to introduce invariance. One less +// variable. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Callee knows that: +// +// 'x: 'a +// 'b: 'y +// +// so if we are going to ensure that `'x: 'y`, then `'a: 'b` must +// hold. +fn establish_relationships<'a, 'b, F>(_cell_a: &Cell<&'a u32>, _cell_b: &Cell<&'b u32>, _closure: F) +where + F: for<'x, 'y> FnMut( + &Cell<&'a &'x u32>, // shows that 'x: 'a + &Cell<&'y &'b u32>, // shows that 'b: 'y + &Cell<&'x u32>, + &Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u32) {} + +#[rustc_regions] +fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + //~^ ERROR lifetime mismatch + + // Only works if 'x: 'y: + demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll + }); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr new file mode 100644 index 0000000000..f9a6999243 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -0,0 +1,51 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-approximated-ref.rs:57:9 + | +57 | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll + | ^^^^^^^^^^^^^^^^^^^^^^^ + +note: External requirements + --> $DIR/propagate-approximated-ref.rs:53:47 + | +53 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + | _______________________________________________^ +54 | | //~^ ERROR lifetime mismatch +55 | | +56 | | // Only works if 'x: 'y: +57 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll +58 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:18 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>)) + ] + = note: number of external vids: 3 + = note: where '_#1r: '_#2r + +error[E0623]: lifetime mismatch + --> $DIR/propagate-approximated-ref.rs:53:29 + | +52 | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ------- ------- + | | + | these two types are declared with different lifetimes... +53 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + | ^^^^^^^ ...but data from `cell_a` flows into `cell_b` here + +note: No external requirements + --> $DIR/propagate-approximated-ref.rs:52:1 + | +52 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +53 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +54 | | //~^ ERROR lifetime mismatch +55 | | +... | +58 | | }); +59 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs new file mode 100644 index 0000000000..f210346a82 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs @@ -0,0 +1,51 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a case where we setup relationships like `'x: 'a` or `'a: 'x`, +// where `'x` is bound in closure type but `'a` is free. This forces +// us to approximate `'x` one way or the other. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +fn foo<'a, F>(_cell: Cell<&'a u32>, _f: F) +where + F: for<'x> FnOnce(Cell<&'a u32>, Cell<&'x u32>), +{ +} + +#[rustc_regions] +fn case1() { + let a = 0; + let cell = Cell::new(&a); + foo(cell, |cell_a, cell_x| { + //~^ WARNING not reporting region error due to -Znll + cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure + //~^ ERROR does not outlive free region + }) +} + +#[rustc_regions] +fn case2() { + let a = 0; + let cell = Cell::new(&a); + //~^ ERROR `a` does not live long enough + + // As you can see in the stderr output, this closure propoagates a + // requirement that `'a: 'static'. + foo(cell, |cell_a, cell_x| { + cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error + }) +} + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr new file mode 100644 index 0000000000..290377996c --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -0,0 +1,85 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:5 + | +31 | foo(cell, |cell_a, cell_x| { + | ^^^ + +error: free region `ReFree(DefId(0/1:12 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]), BrAnon(1))` does not outlive free region `'_#1r` + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:33:9 + | +33 | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure + | ^^^^^^ + +note: No external requirements + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:15 + | +31 | foo(cell, |cell_a, cell_x| { + | _______________^ +32 | | //~^ WARNING not reporting region error due to -Znll +33 | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure +34 | | //~^ ERROR does not outlive free region +35 | | }) + | |_____^ + | + = note: defining type: DefId(0/1:12 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [ + i32, + for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>)) + ] + +note: No external requirements + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1 + | +28 | / fn case1() { +29 | | let a = 0; +30 | | let cell = Cell::new(&a); +31 | | foo(cell, |cell_a, cell_x| { +... | +35 | | }) +36 | | } + | |_^ + | + = note: defining type: DefId(0/0:5 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs [] + +note: External requirements + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:46:15 + | +46 | foo(cell, |cell_a, cell_x| { + | _______________^ +47 | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error +48 | | }) + | |_____^ + | + = note: defining type: DefId(0/1:13 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [ + i32, + for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>)) + ] + = note: number of external vids: 2 + = note: where '_#1r: '_#0r + +note: No external requirements + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:39:1 + | +39 | / fn case2() { +40 | | let a = 0; +41 | | let cell = Cell::new(&a); +42 | | //~^ ERROR `a` does not live long enough +... | +48 | | }) +49 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs [] + +error[E0597]: `a` does not live long enough + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:41:26 + | +41 | let cell = Cell::new(&a); + | ^^ borrowed value does not live long enough +... +49 | } + | - borrowed value only lives until here + | + = note: borrowed value must be valid for lifetime '_#2r... + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs new file mode 100644 index 0000000000..c66472d5ce --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs @@ -0,0 +1,53 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a case where we are trying to prove `'x: 'y` and are forced to +// approximate the shorter end-point (`'y`) to with `'static`. This is +// because `'y` is higher-ranked but we know of no relations to other +// regions. Note that `'static` shows up in the stderr output as `'0`. +// +// FIXME(#45827) Because of shortcomings in the MIR type checker, +// these errors are not (yet) reported. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Callee knows that: +// +// 'x: 'a +// +// so the only way we can ensure that `'x: 'y` is to show that +// `'a: 'static`. +fn establish_relationships<'a, 'b, F>(_cell_a: &Cell<&'a u32>, _cell_b: &Cell<&'b u32>, _closure: F) +where + F: for<'x, 'y> FnMut( + &Cell<&'a &'x u32>, // shows that 'x: 'a + &Cell<&'x u32>, + &Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u32) {} + +#[rustc_regions] +fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { + //~^ ERROR does not outlive free region + + // Only works if 'x: 'y: + demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll + }); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr new file mode 100644 index 0000000000..13aedc408c --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -0,0 +1,53 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:49:9 + | +49 | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll + | ^^^^^^^^^^^^^^^^^^^^^^^ + +note: External requirements + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:47 + | +45 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { + | _______________________________________________^ +46 | | //~^ ERROR does not outlive free region +47 | | +48 | | // Only works if 'x: 'y: +49 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll +50 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:18 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) u32>)) + ] + = note: number of external vids: 2 + = note: where '_#1r: '_#0r + +error: free region `ReFree(DefId(0/0:6 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]), BrNamed(crate0:DefIndex(1:16), 'a))` does not outlive free region `ReStatic` + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:47 + | +45 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { + | _______________________________________________^ +46 | | //~^ ERROR does not outlive free region +47 | | +48 | | // Only works if 'x: 'y: +49 | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll +50 | | }); + | |_____^ + +note: No external requirements + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:44:1 + | +44 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +45 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { +46 | | //~^ ERROR does not outlive free region +47 | | +... | +50 | | }); +51 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs new file mode 100644 index 0000000000..f4011a0e53 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs @@ -0,0 +1,56 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test a case where we are trying to prove `'x: 'y` and are forced to +// approximate the shorter end-point (`'y`) to with `'static`. This is +// because `'y` is higher-ranked but we know of only irrelevant +// relations to other regions. Note that `'static` shows up in the +// stderr output as `'0`. +// +// FIXME(#45827) Because of shortcomings in the MIR type checker, +// these errors are not (yet) reported. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Callee knows that: +// +// 'x: 'a +// 'y: 'b +// +// so the only way we can ensure that `'x: 'y` is to show that +// `'a: 'static`. +fn establish_relationships<'a, 'b, F>(_cell_a: &Cell<&'a u32>, _cell_b: &Cell<&'b u32>, _closure: F) +where + F: for<'x, 'y> FnMut( + &Cell<&'a &'x u32>, // shows that 'x: 'a + &Cell<&'b &'y u32>, // shows that 'y: 'b + &Cell<&'x u32>, + &Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u32) {} + +#[rustc_regions] +fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + //~^ ERROR does not outlive free region + // Only works if 'x: 'y: + demand_y(x, y, x.get()) + //~^ WARNING not reporting region error due to -Znll + }); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr new file mode 100644 index 0000000000..947ed650e6 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -0,0 +1,53 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:51:9 + | +51 | demand_y(x, y, x.get()) + | ^^^^^^^^^^^^^^^^^^^^^^^ + +note: External requirements + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:47 + | +48 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + | _______________________________________________^ +49 | | //~^ ERROR does not outlive free region +50 | | // Only works if 'x: 'y: +51 | | demand_y(x, y, x.get()) +52 | | //~^ WARNING not reporting region error due to -Znll +53 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:18 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>)) + ] + = note: number of external vids: 3 + = note: where '_#1r: '_#0r + +error: free region `ReFree(DefId(0/0:6 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]), BrNamed(crate0:DefIndex(1:16), 'a))` does not outlive free region `ReStatic` + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:47 + | +48 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + | _______________________________________________^ +49 | | //~^ ERROR does not outlive free region +50 | | // Only works if 'x: 'y: +51 | | demand_y(x, y, x.get()) +52 | | //~^ WARNING not reporting region error due to -Znll +53 | | }); + | |_____^ + +note: No external requirements + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:47:1 + | +47 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +48 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +49 | | //~^ ERROR does not outlive free region +50 | | // Only works if 'x: 'y: +... | +53 | | }); +54 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr new file mode 100644 index 0000000000..502b344c89 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr @@ -0,0 +1,45 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-approximated-to-empty.rs:41:9 + | +41 | demand_y(x, y, x.get()) + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: free region `'_#6r` does not outlive free region `'_#4r` + --> $DIR/propagate-approximated-to-empty.rs:41:18 + | +41 | demand_y(x, y, x.get()) + | ^ + +note: No external requirements + --> $DIR/propagate-approximated-to-empty.rs:39:47 + | +39 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { + | _______________________________________________^ +40 | | // Only works if 'x: 'y: +41 | | demand_y(x, y, x.get()) +42 | | //~^ WARN not reporting region error due to -Znll +43 | | //~| ERROR free region `'_#6r` does not outlive free region `'_#4r` +44 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:18 ~ propagate_approximated_to_empty[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>)) + ] + +note: No external requirements + --> $DIR/propagate-approximated-to-empty.rs:38:1 + | +38 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +39 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { +40 | | // Only works if 'x: 'y: +41 | | demand_y(x, y, x.get()) +... | +44 | | }); +45 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_approximated_to_empty[317d]::supply[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs new file mode 100644 index 0000000000..d163f304ae --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs @@ -0,0 +1,54 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// A simpler variant of `outlives-from-argument` where cells are +// passed by value. +// +// This is simpler because there are no "extraneous" region +// relationships. In the 'main' variant, there are a number of +// anonymous regions as well. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Callee knows that: +// +// 'x: 'a +// 'b: 'y +// +// so if we are going to ensure that `'x: 'y`, then `'a: 'b` must +// hold. +fn establish_relationships<'a, 'b, F>(_cell_a: Cell<&'a u32>, _cell_b: Cell<&'b u32>, _closure: F) +where + F: for<'x, 'y> FnMut( + Cell<&'a &'x u32>, // shows that 'x: 'a + Cell<&'y &'b u32>, // shows that 'b: 'y + Cell<&'x u32>, + Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_outlives1: Cell<&&'x u32>, _outlives2: Cell<&'y &u32>, _y: &'y u32) {} + +#[rustc_regions] +fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { + //~^ ERROR lifetime mismatch + + // Only works if 'x: 'y: + demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll + }); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr new file mode 100644 index 0000000000..64766296e6 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -0,0 +1,51 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-approximated-val.rs:50:9 + | +50 | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +note: External requirements + --> $DIR/propagate-approximated-val.rs:46:45 + | +46 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { + | _____________________________________________^ +47 | | //~^ ERROR lifetime mismatch +48 | | +49 | | // Only works if 'x: 'y: +50 | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll +51 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:18 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>)) + ] + = note: number of external vids: 3 + = note: where '_#1r: '_#2r + +error[E0623]: lifetime mismatch + --> $DIR/propagate-approximated-val.rs:46:29 + | +45 | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ------- ------- + | | + | these two types are declared with different lifetimes... +46 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { + | ^^^^^^ ...but data from `cell_a` flows into `cell_b` here + +note: No external requirements + --> $DIR/propagate-approximated-val.rs:45:1 + | +45 | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +46 | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { +47 | | //~^ ERROR lifetime mismatch +48 | | +... | +51 | | }); +52 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs new file mode 100644 index 0000000000..ba4c287592 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs @@ -0,0 +1,60 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test where we might in theory be able to see that the relationship +// between two bound regions is true within closure and hence have no +// need to propagate; but in fact we do because identity of free +// regions is erased. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// In theory, callee knows that: +// +// 'x: 'a +// 'a: 'y +// +// and hence could satisfy that `'x: 'y` locally. However, in our +// checking, we ignore the precise free regions that come into the +// region and just assign each position a distinct universally bound +// region. Hence, we propagate a constraint to our caller that will +// wind up being solvable. +fn establish_relationships<'a, F>( + _cell_a: Cell<&'a u32>, + _closure: F, +) where + F: for<'x, 'y> FnMut( + Cell<&'a &'x u32>, // shows that 'x: 'a + Cell<&'y &'a u32>, // shows that 'a: 'y + Cell<&'x u32>, + Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_cell_x: Cell<&'x u32>, _cell_y: Cell<&'y u32>, _y: &'y u32) {} + +#[rustc_regions] +fn supply<'a>(cell_a: Cell<&'a u32>) { + establish_relationships( + cell_a, + |_outlives1, _outlives2, x, y| { + // Only works if 'x: 'y: + let p = x.get(); + demand_y(x, y, p) + }, + ); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr new file mode 100644 index 0000000000..d93124963e --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -0,0 +1,37 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-despite-same-free-region.rs:54:21 + | +54 | let p = x.get(); + | ^^^^^^^ + +note: External requirements + --> $DIR/propagate-despite-same-free-region.rs:52:9 + | +52 | / |_outlives1, _outlives2, x, y| { +53 | | // Only works if 'x: 'y: +54 | | let p = x.get(); +55 | | demand_y(x, y, p) +56 | | }, + | |_________^ + | + = note: defining type: DefId(0/1:16 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>)) + ] + = note: number of external vids: 3 + = note: where '_#1r: '_#2r + +note: No external requirements + --> $DIR/propagate-despite-same-free-region.rs:49:1 + | +49 | / fn supply<'a>(cell_a: Cell<&'a u32>) { +50 | | establish_relationships( +51 | | cell_a, +52 | | |_outlives1, _outlives2, x, y| { +... | +57 | | ); +58 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs [] + diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs new file mode 100644 index 0000000000..eb512a3b9b --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs @@ -0,0 +1,53 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Similarly to escape-argument-callee, a test case where the closure +// requires a relationship between 2 unrelated higher-ranked regions, +// with no helpful relations between the HRRs and free regions. +// +// In this case, the error is reported by the closure itself. This is +// because it is unable to approximate the higher-ranked region `'x`, +// as it knows of no relationships between `'x` and any +// non-higher-ranked regions. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Callee knows that: +// +// 'b: 'y +// +// but this doesn't really help us in proving that `'x: 'y`, so closure gets an error. +fn establish_relationships<'a, 'b, F>(_cell_a: &Cell<&'a u32>, _cell_b: &Cell<&'b u32>, _closure: F) +where + F: for<'x, 'y> FnMut( + &Cell<&'y &'b u32>, // shows that 'b: 'y + &Cell<&'x u32>, + &Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u32) {} + +#[rustc_regions] +fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { + // Only works if 'x: 'y: + demand_y(x, y, x.get()) + //~^ WARN not reporting region error due to -Znll + //~| ERROR does not outlive free region + }); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr new file mode 100644 index 0000000000..08dcfb042b --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -0,0 +1,45 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:9 + | +47 | demand_y(x, y, x.get()) + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(4))` does not outlive free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(2))` + --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:18 + | +47 | demand_y(x, y, x.get()) + | ^ + +note: No external requirements + --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:45:47 + | +45 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { + | _______________________________________________^ +46 | | // Only works if 'x: 'y: +47 | | demand_y(x, y, x.get()) +48 | | //~^ WARN not reporting region error due to -Znll +49 | | //~| ERROR does not outlive free region +50 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:18 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>)) + ] + +note: No external requirements + --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:44:1 + | +44 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +45 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { +46 | | // Only works if 'x: 'y: +47 | | demand_y(x, y, x.get()) +... | +50 | | }); +51 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs new file mode 100644 index 0000000000..9307424642 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs @@ -0,0 +1,57 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Similarly to escape-argument-callee, a test case where the closure +// requires a relationship between 2 unrelated higher-ranked regions, +// with no helpful relations between the HRRs and free regions. +// +// In this case, the error is reported by the closure itself. This is +// because it is unable to approximate the higher-ranked region `'x`, +// as it only knows of regions that `'x` is outlived by, and none that +// `'x` outlives. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Callee knows that: +// +// 'a: 'x +// 'b: 'y +// +// but this doesn't really help us in proving that `'x: 'y`, so +// closure gets an error. In particular, we would need to know that +// `'x: 'a`, so that we could approximate `'x` "downwards" to `'a`. +fn establish_relationships<'a, 'b, F>(_cell_a: &Cell<&'a u32>, _cell_b: &Cell<&'b u32>, _closure: F) +where + F: for<'x, 'y> FnMut( + &Cell<&'x &'a u32>, // shows that 'a: 'x + &Cell<&'y &'b u32>, // shows that 'b: 'y + &Cell<&'x u32>, + &Cell<&'y u32>, + ), +{ +} + +fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u32) {} + +#[rustc_regions] +fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + // Only works if 'x: 'y: + demand_y(x, y, x.get()) + //~^ WARN not reporting region error due to -Znll + //~| ERROR does not outlive free region + }); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr new file mode 100644 index 0000000000..502f565024 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -0,0 +1,45 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:9 + | +51 | demand_y(x, y, x.get()) + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(2))` does not outlive free region `ReFree(DefId(0/1:18 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]), BrAnon(4))` + --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:18 + | +51 | demand_y(x, y, x.get()) + | ^ + +note: No external requirements + --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:49:47 + | +49 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { + | _______________________________________________^ +50 | | // Only works if 'x: 'y: +51 | | demand_y(x, y, x.get()) +52 | | //~^ WARN not reporting region error due to -Znll +53 | | //~| ERROR does not outlive free region +54 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:18 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>)) + ] + +note: No external requirements + --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:48:1 + | +48 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +49 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +50 | | // Only works if 'x: 'y: +51 | | demand_y(x, y, x.get()) +... | +54 | | }); +55 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs new file mode 100644 index 0000000000..9179635575 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs @@ -0,0 +1,60 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that regions which appear only in the closure's generics (in +// this case, `'a`) are properly mapped to the creator's generics. In +// this case, the closure constrains its type parameter `T` to outlive +// the same `'a` for which it implements `Trait`, which can only be the `'a` +// from the function definition. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] +#![allow(dead_code)] + +trait Trait<'a> {} + +fn establish_relationships<T, F>(value: T, closure: F) +where + F: FnOnce(T), +{ + closure(value) +} + +fn require<'a, T>(t: T) +where + T: Trait<'a> + 'a, +{ +} + +#[rustc_regions] +fn supply<'a, T>(value: T) +where + T: Trait<'a>, +{ + establish_relationships(value, |value| { + //~^ ERROR the parameter type `T` may not live long enough + + // This function call requires that + // + // (a) T: Trait<'a> + // + // and + // + // (b) T: 'a + // + // The latter does not hold. + + require(value); + //~^ WARNING not reporting region error due to -Znll + }); +} + +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr new file mode 100644 index 0000000000..aefa160fcb --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -0,0 +1,62 @@ +warning: not reporting region error due to -Znll + --> $DIR/propagate-from-trait-match.rs:55:9 + | +55 | require(value); + | ^^^^^^^ + +note: External requirements + --> $DIR/propagate-from-trait-match.rs:42:36 + | +42 | establish_relationships(value, |value| { + | ____________________________________^ +43 | | //~^ ERROR the parameter type `T` may not live long enough +44 | | +45 | | // This function call requires that +... | +56 | | //~^ WARNING not reporting region error due to -Znll +57 | | }); + | |_____^ + | + = note: defining type: DefId(0/1:16 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((T,)) + ] + = note: number of external vids: 2 + = note: where T: '_#1r + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/propagate-from-trait-match.rs:42:36 + | +42 | establish_relationships(value, |value| { + | ____________________________________^ +43 | | //~^ ERROR the parameter type `T` may not live long enough +44 | | +45 | | // This function call requires that +... | +56 | | //~^ WARNING not reporting region error due to -Znll +57 | | }); + | |_____^ + | + = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + +note: No external requirements + --> $DIR/propagate-from-trait-match.rs:38:1 + | +38 | / fn supply<'a, T>(value: T) +39 | | where +40 | | T: Trait<'a>, +41 | | { +... | +57 | | }); +58 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ propagate_from_trait_match[317d]::supply[0]) with substs [ + '_#1r, + T + ] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs new file mode 100644 index 0000000000..3f56dfe5af --- /dev/null +++ b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Basic test for free regions in the NLL code. This test ought to +// report an error due to a reborrowing constraint. Right now, we get +// a variety of errors from the older, AST-based machinery (notably +// borrowck), and then we get the NLL error at the end. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +fn foo(x: &u32) -> &'static u32 { + &*x + //~^ WARN not reporting region error due to -Znll + //~| ERROR does not outlive free region +} + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr new file mode 100644 index 0000000000..6648e38e7d --- /dev/null +++ b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr @@ -0,0 +1,14 @@ +warning: not reporting region error due to -Znll + --> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5 + | +19 | &*x + | ^^^ + +error: free region `ReFree(DefId(0/0:3 ~ region_lbr_anon_does_not_outlive_static[317d]::foo[0]), BrAnon(0))` does not outlive free region `ReStatic` + --> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5 + | +19 | &*x + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs new file mode 100644 index 0000000000..a1be8e8518 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Basic test for free regions in the NLL code. This test ought to +// report an error due to a reborrowing constraint. Right now, we get +// a variety of errors from the older, AST-based machinery (notably +// borrowck), and then we get the NLL error at the end. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +fn foo<'a>(x: &'a u32) -> &'static u32 { + &*x + //~^ WARN not reporting region error due to -Znll + //~| ERROR does not outlive free region +} + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr new file mode 100644 index 0000000000..1edceba7b0 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr @@ -0,0 +1,14 @@ +warning: not reporting region error due to -Znll + --> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5 + | +19 | &*x + | ^^^ + +error: free region `ReFree(DefId(0/0:3 ~ region_lbr_named_does_not_outlive_static[317d]::foo[0]), BrNamed(crate0:DefIndex(1:9), 'a))` does not outlive free region `ReStatic` + --> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5 + | +19 | &*x + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/nll/named-region-basic.rs b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs similarity index 84% rename from src/test/ui/nll/named-region-basic.rs rename to src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs index 539c2017ea..00b09e2ab2 100644 --- a/src/test/ui/nll/named-region-basic.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs @@ -13,10 +13,12 @@ // a variety of errors from the older, AST-based machinery (notably // borrowck), and then we get the NLL error at the end. -// compile-flags:-Znll +// compile-flags:-Znll -Zborrowck=mir -Zverbose fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { &*x + //~^ WARN not reporting region error due to -Znll + //~| ERROR lifetime mismatch } fn main() { } diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr new file mode 100644 index 0000000000..efe0b73f19 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr @@ -0,0 +1,18 @@ +warning: not reporting region error due to -Znll + --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5 + | +19 | &*x + | ^^^ + +error[E0623]: lifetime mismatch + --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5 + | +18 | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { + | ------- ------- + | | + | this parameter and the return type are declared with different lifetimes... +19 | &*x + | ^^^ ...but data from `x` is returned here + +error: aborting due to previous error + diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs b/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs new file mode 100644 index 0000000000..ffb1935e75 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Basic test for free regions in the NLL code. This test does not +// report an error because of the (implied) bound that `'b: 'a`. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully + +#![allow(warnings)] + +fn foo<'a, 'b>(x: &'a &'b u32) -> &'a u32 { + &**x +} + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs new file mode 100644 index 0000000000..754df4f2c5 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs @@ -0,0 +1,34 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test closure that takes two references and is supposed to return +// the first, but actually returns the second. This should fail within +// the closure. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![feature(rustc_attrs)] + +#[rustc_regions] +fn test() { + expect_sig(|a, b| b); // ought to return `a` + //~^ WARN not reporting region error due to -Znll + //~| ERROR does not outlive free region +} + +fn expect_sig<F>(f: F) -> F + where F: for<'a> FnMut(&'a i32, &i32) -> &'a i32 +{ + f +} + +fn deref(_p: &i32) { } + +fn main() { } diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr new file mode 100644 index 0000000000..58a26e61e5 --- /dev/null +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -0,0 +1,37 @@ +warning: not reporting region error due to -Znll + --> $DIR/return-wrong-bound-region.rs:21:23 + | +21 | expect_sig(|a, b| b); // ought to return `a` + | ^ + +error: free region `ReFree(DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]), BrAnon(2))` does not outlive free region `ReFree(DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]), BrAnon(1))` + --> $DIR/return-wrong-bound-region.rs:21:23 + | +21 | expect_sig(|a, b| b); // ought to return `a` + | ^ + +note: No external requirements + --> $DIR/return-wrong-bound-region.rs:21:16 + | +21 | expect_sig(|a, b| b); // ought to return `a` + | ^^^^^^^^ + | + = note: defining type: DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [ + i16, + for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) i32, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) i32)) -> &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) i32 + ] + +note: No external requirements + --> $DIR/return-wrong-bound-region.rs:20:1 + | +20 | / fn test() { +21 | | expect_sig(|a, b| b); // ought to return `a` +22 | | //~^ WARN not reporting region error due to -Znll +23 | | //~| ERROR does not outlive free region +24 | | } + | |_^ + | + = note: defining type: DefId(0/0:3 ~ return_wrong_bound_region[317d]::test[0]) with substs [] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/constant.rs b/src/test/ui/nll/constant.rs new file mode 100644 index 0000000000..ced06e5ea0 --- /dev/null +++ b/src/test/ui/nll/constant.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that MIR borrowck and NLL analysis can handle constants of +// arbitrary types without ICEs. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully + +const HI: &str = "hi"; + +fn main() { + assert_eq!(HI, "hi"); +} diff --git a/src/test/mir-opt/nll/region-liveness-drop-may-dangle.rs b/src/test/ui/nll/drop-may-dangle.rs similarity index 66% rename from src/test/mir-opt/nll/region-liveness-drop-may-dangle.rs rename to src/test/ui/nll/drop-may-dangle.rs index 6d7aa0a26c..2780b34746 100644 --- a/src/test/mir-opt/nll/region-liveness-drop-may-dangle.rs +++ b/src/test/ui/nll/drop-may-dangle.rs @@ -12,8 +12,8 @@ // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. -// compile-flags:-Znll -Zverbose -// ^^^^^^^^^ force compiler to dump more region information +// compile-flags:-Znll -Zborrowck=mir +// must-compile-successfully #![allow(warnings)] #![feature(dropck_eyepatch)] @@ -23,26 +23,24 @@ fn use_x(_: usize) -> bool { true } fn main() { let mut v = [1, 2, 3]; - let p: Wrap<& /* R4 */ usize> = Wrap { value: &v[0] }; + let p: WrapMayDangle<& /* R4 */ usize> = WrapMayDangle { value: &v[0] }; if true { + // `p` will get dropped at end of this block. However, because of + // the `#[may_dangle]` attribute, we do not need to consider R4 + // live after this point. use_x(*p.value); } else { + v[0] += 1; use_x(22); } - // `p` will get dropped here. However, because of the - // `#[may_dangle]` attribute, we do not need to consider R4 live. + v[0] += 1; } -struct Wrap<T> { +struct WrapMayDangle<T> { value: T } -unsafe impl<#[may_dangle] T> Drop for Wrap<T> { +unsafe impl<#[may_dangle] T> Drop for WrapMayDangle<T> { fn drop(&mut self) { } } - -// END RUST SOURCE -// START rustc.main.nll.0.mir -// | '_#5r: {bb1[3], bb1[4], bb1[5], bb2[0], bb2[1]} -// END rustc.main.nll.0.mir diff --git a/src/test/ui/nll/drop-may-dangle.stderr b/src/test/ui/nll/drop-may-dangle.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/nll/drop-no-may-dangle.rs b/src/test/ui/nll/drop-no-may-dangle.rs new file mode 100644 index 0000000000..0220858a0d --- /dev/null +++ b/src/test/ui/nll/drop-no-may-dangle.rs @@ -0,0 +1,43 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Basic test for liveness constraints: the region (`R1`) that appears +// in the type of `p` must include everything until `p` is dropped +// because of destructor. (Note that the stderr also identifies this +// destructor in the error message.) + +// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause + +#![allow(warnings)] +#![feature(dropck_eyepatch)] +#![feature(generic_param_attrs)] + +fn use_x(_: usize) -> bool { true } + +fn main() { + let mut v = [1, 2, 3]; + let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; + if true { + use_x(*p.value); + } else { + use_x(22); + v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed + } + + v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed +} + +struct WrapMayNotDangle<T> { + value: T +} + +impl<T> Drop for WrapMayNotDangle<T> { + fn drop(&mut self) { } +} diff --git a/src/test/ui/nll/drop-no-may-dangle.stderr b/src/test/ui/nll/drop-no-may-dangle.stderr new file mode 100644 index 0000000000..ef850f3a56 --- /dev/null +++ b/src/test/ui/nll/drop-no-may-dangle.stderr @@ -0,0 +1,25 @@ +error[E0506]: cannot assign to `v[..]` because it is borrowed + --> $DIR/drop-no-may-dangle.rs:31:9 + | +26 | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; + | ----- borrow of `v[..]` occurs here +... +31 | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed + | ^^^^^^^^^ assignment to borrowed `v[..]` occurs here +... +35 | } + | - borrow later used here, when `p` is dropped + +error[E0506]: cannot assign to `v[..]` because it is borrowed + --> $DIR/drop-no-may-dangle.rs:34:5 + | +26 | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; + | ----- borrow of `v[..]` occurs here +... +34 | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed + | ^^^^^^^^^ assignment to borrowed `v[..]` occurs here +35 | } + | - borrow later used here, when `p` is dropped + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/get_default.rs b/src/test/ui/nll/get_default.rs index 5605206221..7c52a0c87a 100644 --- a/src/test/ui/nll/get_default.rs +++ b/src/test/ui/nll/get_default.rs @@ -13,7 +13,7 @@ // a variety of errors from the older, AST-based machinery (notably // borrowck), and then we get the NLL error at the end. -// compile-flags:-Znll -Zborrowck-mir +// compile-flags:-Znll -Zborrowck=compare -Znll-dump-cause struct Map { } @@ -31,6 +31,7 @@ fn ok(map: &mut Map) -> &String { } None => { map.set(String::new()); // Just AST errors here + //~^ ERROR borrowed as immutable (Ast) } } } @@ -41,10 +42,13 @@ fn err(map: &mut Map) -> &String { match map.get() { Some(v) => { map.set(String::new()); // Both AST and MIR error here + //~^ ERROR borrowed as immutable (Mir) + //~| ERROR borrowed as immutable (Ast) return v; } None => { map.set(String::new()); // Just AST errors here + //~^ ERROR borrowed as immutable (Ast) } } } diff --git a/src/test/ui/nll/get_default.stderr b/src/test/ui/nll/get_default.stderr index 9586f42672..ed2c305090 100644 --- a/src/test/ui/nll/get_default.stderr +++ b/src/test/ui/nll/get_default.stderr @@ -7,41 +7,44 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as imm 33 | map.set(String::new()); // Just AST errors here | ^^^ mutable borrow occurs here ... -37 | } +38 | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:43:17 + --> $DIR/get_default.rs:44:17 | -41 | match map.get() { +42 | match map.get() { | --- immutable borrow occurs here -42 | Some(v) => { -43 | map.set(String::new()); // Both AST and MIR error here +43 | Some(v) => { +44 | map.set(String::new()); // Both AST and MIR error here | ^^^ mutable borrow occurs here ... -51 | } +55 | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:47:17 + --> $DIR/get_default.rs:50:17 | -41 | match map.get() { +42 | match map.get() { | --- immutable borrow occurs here ... -47 | map.set(String::new()); // Just AST errors here +50 | map.set(String::new()); // Just AST errors here | ^^^ mutable borrow occurs here ... -51 | } +55 | } | - immutable borrow ends here -error[E0502]: cannot borrow `(*map)` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/get_default.rs:43:17 +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) + --> $DIR/get_default.rs:44:17 | -41 | match map.get() { +42 | match map.get() { | --- immutable borrow occurs here -42 | Some(v) => { -43 | map.set(String::new()); // Both AST and MIR error here +43 | Some(v) => { +44 | map.set(String::new()); // Both AST and MIR error here | ^^^ mutable borrow occurs here +... +47 | return v; + | - borrow later used here error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs new file mode 100644 index 0000000000..184dfe320d --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll -Znll-dump-cause + + +#![allow(warnings)] + +struct Wrap<'p> { p: &'p mut i32 } + +impl<'p> Drop for Wrap<'p> { + fn drop(&mut self) { + *self.p += 1; + } +} + +struct Foo<'p> { a: String, b: Wrap<'p> } + +fn main() { + let mut x = 0; + let wrap = Wrap { p: &mut x }; + let s = String::from("str"); + let foo = Foo { a: s, b: wrap }; + std::mem::drop(foo.b); + x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] + // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones +} diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr new file mode 100644 index 0000000000..3c685ce111 --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -0,0 +1,14 @@ +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:32:5 + | +28 | let wrap = Wrap { p: &mut x }; + | ------ borrow of `x` occurs here +... +32 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] + | ^^^^^ assignment to borrowed `x` occurs here +33 | // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones +34 | } + | - borrow later used here, when `foo` is dropped + +error: aborting due to previous error + diff --git a/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs b/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs new file mode 100644 index 0000000000..92b29a98c1 --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs @@ -0,0 +1,29 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll +// must-compile-successfully + +#![allow(warnings)] + +struct Wrap<'p> { p: &'p mut i32 } + +impl<'p> Drop for Wrap<'p> { + fn drop(&mut self) { + *self.p += 1; + } +} + +fn main() { + let mut x = 0; + let wrap = Wrap { p: &mut x }; + std::mem::drop(wrap); + x = 1; // OK, drop is inert +} diff --git a/src/test/ui/nll/maybe-initialized-drop-uninitialized.stderr b/src/test/ui/nll/maybe-initialized-drop-uninitialized.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs new file mode 100644 index 0000000000..beb2c87f8f --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause + +#![allow(warnings)] + +struct Wrap<'p> { p: &'p mut i32 } + +impl<'p> Drop for Wrap<'p> { + fn drop(&mut self) { + *self.p += 1; + } +} + +struct Foo<'p> { a: String, b: Wrap<'p> } + +fn main() { + let mut x = 0; + let wrap = Wrap { p: &mut x }; + let s = String::from("str"); + let foo = Foo { a: s, b: wrap }; + std::mem::drop(foo.a); + x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +} diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr new file mode 100644 index 0000000000..072818c7ce --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr @@ -0,0 +1,13 @@ +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/maybe-initialized-drop-with-fragment.rs:31:5 + | +27 | let wrap = Wrap { p: &mut x }; + | ------ borrow of `x` occurs here +... +31 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] + | ^^^^^ assignment to borrowed `x` occurs here +32 | } + | - borrow later used here, when `foo` is dropped + +error: aborting due to previous error + diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs new file mode 100644 index 0000000000..39cad8acee --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause + +#![allow(warnings)] + +struct Wrap<'p> { p: &'p mut i32 } + +impl<'p> Drop for Wrap<'p> { + fn drop(&mut self) { + *self.p += 1; + } +} + +struct Foo<'p> { a: String, b: Wrap<'p> } + +fn main() { + let mut x = 0; + let wrap = Wrap { p: &mut x }; + let s = String::from("str"); + let foo = Foo { a: s, b: wrap }; + std::mem::drop(foo.a); + std::mem::drop(foo.b); + x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] + // FIXME ^ This currently errors and it should not. +} diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr new file mode 100644 index 0000000000..89117c2bfe --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr @@ -0,0 +1,14 @@ +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:32:5 + | +27 | let wrap = Wrap { p: &mut x }; + | ------ borrow of `x` occurs here +... +32 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] + | ^^^^^ assignment to borrowed `x` occurs here +33 | // FIXME ^ This currently errors and it should not. +34 | } + | - borrow later used here, when `foo` is dropped + +error: aborting due to previous error + diff --git a/src/test/ui/nll/maybe-initialized-drop.rs b/src/test/ui/nll/maybe-initialized-drop.rs new file mode 100644 index 0000000000..767c5b9b8b --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause + +#![allow(warnings)] + +struct Wrap<'p> { p: &'p mut i32 } + +impl<'p> Drop for Wrap<'p> { + fn drop(&mut self) { + *self.p += 1; + } +} + +fn main() { + let mut x = 0; + let wrap = Wrap { p: &mut x }; + x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +} diff --git a/src/test/ui/nll/maybe-initialized-drop.stderr b/src/test/ui/nll/maybe-initialized-drop.stderr new file mode 100644 index 0000000000..626307a80e --- /dev/null +++ b/src/test/ui/nll/maybe-initialized-drop.stderr @@ -0,0 +1,12 @@ +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/maybe-initialized-drop.rs:26:5 + | +25 | let wrap = Wrap { p: &mut x }; + | ------ borrow of `x` occurs here +26 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] + | ^^^^^ assignment to borrowed `x` occurs here +27 | } + | - borrow later used here, when `wrap` is dropped + +error: aborting due to previous error + diff --git a/src/test/ui/nll/named-region-basic.stderr b/src/test/ui/nll/named-region-basic.stderr deleted file mode 100644 index 42b2aea01f..0000000000 --- a/src/test/ui/nll/named-region-basic.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: not reporting region error due to -Znll - --> $DIR/named-region-basic.rs:19:5 - | -19 | &*x - | ^^^ - -error[E0597]: `*x` does not live long enough - --> $DIR/named-region-basic.rs:19:6 - | -19 | &*x - | ^^ does not live long enough - | - = note: borrowed value must be valid for the static lifetime... -note: ...but borrowed value is only valid for the lifetime 'a as defined on the function body at 18:1 - --> $DIR/named-region-basic.rs:18:1 - | -18 | / fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { -19 | | &*x -20 | | } - | |_^ - -error: free region `'a` does not outlive `'b` - --> $DIR/named-region-basic.rs:19:5 - | -19 | &*x - | ^^^ - -error: aborting due to 2 previous errors - diff --git a/src/test/parse-fail/keyword-crate-as-identifier.rs b/src/test/ui/nll/projection-return.rs similarity index 68% rename from src/test/parse-fail/keyword-crate-as-identifier.rs rename to src/test/ui/nll/projection-return.rs index 8a914ca7b1..31388cf50c 100644 --- a/src/test/parse-fail/keyword-crate-as-identifier.rs +++ b/src/test/ui/nll/projection-return.rs @@ -8,10 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z parse-only +// compile-flags:-Znll -Zborrowck=mir +// must-compile-successfully -// This file was auto-generated using 'src/etc/generate-keyword-tests.py crate' +#![feature(rustc_attrs)] -fn main() { - let crate = "foo"; //~ error: expected pattern, found keyword `crate` +trait Foo { + type Bar; } + +impl Foo for () { + type Bar = u32; +} + +fn foo() -> <() as Foo>::Bar { + 22 +} + +fn main() { } + diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.rs b/src/test/ui/nll/ty-outlives/impl-trait-captures.rs new file mode 100644 index 0000000000..850cd1e733 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(conservative_impl_trait)] + +trait Foo<'a> { +} + +impl<'a, T> Foo<'a> for T { } + +fn foo<'a, T>(x: &T) -> impl Foo<'a> { + x + //~^ WARNING not reporting region error due to -Znll + //~| ERROR explicit lifetime required in the type of `x` [E0621] +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr new file mode 100644 index 0000000000..4cfd12002e --- /dev/null +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -0,0 +1,16 @@ +warning: not reporting region error due to -Znll + --> $DIR/impl-trait-captures.rs:22:5 + | +22 | x + | ^ + +error[E0621]: explicit lifetime required in the type of `x` + --> $DIR/impl-trait-captures.rs:22:5 + | +21 | fn foo<'a, T>(x: &T) -> impl Foo<'a> { + | - consider changing the type of `x` to `&ReEarlyBound(0, 'a) T` +22 | x + | ^ lifetime `ReEarlyBound(0, 'a)` required + +error: aborting due to previous error + diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs b/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs new file mode 100644 index 0000000000..135805a733 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs @@ -0,0 +1,51 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(conservative_impl_trait)] + +use std::fmt::Debug; + +fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a + //~^ WARNING not reporting region error due to -Znll +where + T: Debug, +{ + x + //~^ ERROR the parameter type `T` may not live long enough [E0309] +} + +fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a +where + T: 'a + Debug, +{ + x +} + +fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a + //~^ WARNING not reporting region error due to -Znll +where + T: 'b + Debug, +{ + x + //~^ ERROR the parameter type `T` may not live long enough [E0309] +} + +fn outlives_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a +where + T: 'b + Debug, + 'b: 'a, +{ + x +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr b/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr new file mode 100644 index 0000000000..5916d0060a --- /dev/null +++ b/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr @@ -0,0 +1,30 @@ +warning: not reporting region error due to -Znll + --> $DIR/impl-trait-outlives.rs:18:35 + | +18 | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a + | ^^^^^^^^^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/impl-trait-outlives.rs:34:42 + | +34 | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a + | ^^^^^^^^^^^^^^^ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/impl-trait-outlives.rs:23:5 + | +23 | x + | ^ + | + = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/impl-trait-outlives.rs:39:5 + | +39 | x + | ^ + | + = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs b/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs new file mode 100644 index 0000000000..0ec6d7b74a --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs @@ -0,0 +1,56 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +// Test that we can deduce when projections like `T::Item` outlive the +// function body. Test that this does not imply that `T: 'a` holds. + +#![allow(warnings)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +fn twice<F, T>(mut value: T, mut f: F) +where + F: FnMut(&T, Cell<&Option<T::Item>>), + T: Iterator, +{ + let mut n = value.next(); + f(&value, Cell::new(&n)); + f(&value, Cell::new(&n)); +} + +#[rustc_errors] +fn generic1<T: Iterator>(value: T) { + // No error here: + twice(value, |value_ref, item| invoke1(item)); +} + +fn invoke1<'a, T>(x: Cell<&'a Option<T>>) +where + T: 'a, +{ +} + +#[rustc_errors] +fn generic2<T: Iterator>(value: T) { + twice(value, |value_ref, item| invoke2(value_ref, item)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the parameter type `T` may not live long enough +} + +fn invoke2<'a, T, U>(a: &T, b: Cell<&'a Option<U>>) +where + T: 'a, +{ +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr b/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr new file mode 100644 index 0000000000..a49bdbbf09 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr @@ -0,0 +1,16 @@ +warning: not reporting region error due to -Znll + --> $DIR/projection-implied-bounds.rs:45:36 + | +45 | twice(value, |value_ref, item| invoke2(value_ref, item)); + | ^^^^^^^ + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/projection-implied-bounds.rs:45:18 + | +45 | twice(value, |value_ref, item| invoke2(value_ref, item)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error: aborting due to previous error + diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs new file mode 100644 index 0000000000..0493bd1ea0 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs @@ -0,0 +1,68 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +// Tests closures that propagate an outlives relationship to their +// creator where the subject is a projection with no regions (`<T as +// Iterator>::Item`, to be exact). + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +trait Anything { } + +impl<T> Anything for T { } + +fn with_signature<'a, T, F>(x: Box<T>, op: F) -> Box<dyn Anything + 'a> + where F: FnOnce(Box<T>) -> Box<dyn Anything + 'a> +{ + op(x) +} + +#[rustc_regions] +fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a> +where + T: Iterator, +{ + with_signature(x, |mut y| Box::new(y.next())) + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough +} + +#[rustc_regions] +fn correct_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a> +where + T: 'a + Iterator, +{ + with_signature(x, |mut y| Box::new(y.next())) +} + +#[rustc_regions] +fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a> +where + T: 'b + Iterator, +{ + with_signature(x, |mut y| Box::new(y.next())) + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough +} + +#[rustc_regions] +fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a> +where + T: 'b + Iterator, + 'b: 'a, +{ + with_signature(x, |mut y| Box::new(y.next())) +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr new file mode 100644 index 0000000000..b2e98b7c2f --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -0,0 +1,161 @@ +warning: not reporting region error due to -Znll + --> $DIR/projection-no-regions-closure.rs:36:31 + | +36 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-no-regions-closure.rs:54:31 + | +54 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^ + +note: External requirements + --> $DIR/projection-no-regions-closure.rs:36:23 + | +36 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:15 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#2r> + ] + = note: number of external vids: 3 + = note: where <T as std::iter::Iterator>::Item: '_#2r + +note: External requirements + --> $DIR/projection-no-regions-closure.rs:46:23 + | +46 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:18 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#2r> + ] + = note: number of external vids: 3 + = note: where <T as std::iter::Iterator>::Item: '_#2r + +note: External requirements + --> $DIR/projection-no-regions-closure.rs:54:23 + | +54 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:22 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r> + ] + = note: number of external vids: 4 + = note: where <T as std::iter::Iterator>::Item: '_#3r + +note: External requirements + --> $DIR/projection-no-regions-closure.rs:65:23 + | +65 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:26 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<Anything + '_#3r> + ] + = note: number of external vids: 4 + = note: where <T as std::iter::Iterator>::Item: '_#3r + +error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough + --> $DIR/projection-no-regions-closure.rs:36:23 + | +36 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`... + +note: No external requirements + --> $DIR/projection-no-regions-closure.rs:32:1 + | +32 | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a> +33 | | where +34 | | T: Iterator, +35 | | { +... | +38 | | //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough +39 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [ + '_#1r, + T + ] + +note: No external requirements + --> $DIR/projection-no-regions-closure.rs:42:1 + | +42 | / fn correct_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a> +43 | | where +44 | | T: 'a + Iterator, +45 | | { +46 | | with_signature(x, |mut y| Box::new(y.next())) +47 | | } + | |_^ + | + = note: defining type: DefId(0/0:7 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [ + '_#1r, + T + ] + +error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough + --> $DIR/projection-no-regions-closure.rs:54:23 + | +54 | with_signature(x, |mut y| Box::new(y.next())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`... + +note: No external requirements + --> $DIR/projection-no-regions-closure.rs:50:1 + | +50 | / fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a> +51 | | where +52 | | T: 'b + Iterator, +53 | | { +... | +56 | | //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough +57 | | } + | |_^ + | + = note: defining type: DefId(0/0:8 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-no-regions-closure.rs:60:1 + | +60 | / fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a> +61 | | where +62 | | T: 'b + Iterator, +63 | | 'b: 'a, +64 | | { +65 | | with_signature(x, |mut y| Box::new(y.next())) +66 | | } + | |_^ + | + = note: defining type: DefId(0/0:9 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs new file mode 100644 index 0000000000..5f2e84e247 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs @@ -0,0 +1,53 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(dyn_trait)] + +trait Anything { } + +impl<T> Anything for T { } + +fn no_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a> +where + T: Iterator, +{ + Box::new(x.next()) + //~^ WARNING not reporting region error due to -Znll + //~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough +} + +fn correct_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a> +where + T: 'a + Iterator, +{ + Box::new(x.next()) +} + +fn wrong_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a> +where + T: 'b + Iterator, +{ + Box::new(x.next()) + //~^ WARNING not reporting region error due to -Znll + //~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough +} + +fn outlives_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a> +where + T: 'b + Iterator, + 'b: 'a, +{ + Box::new(x.next()) +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr new file mode 100644 index 0000000000..d309bf2ce6 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -0,0 +1,30 @@ +warning: not reporting region error due to -Znll + --> $DIR/projection-no-regions-fn.rs:24:5 + | +24 | Box::new(x.next()) + | ^^^^^^^^^^^^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-no-regions-fn.rs:40:5 + | +40 | Box::new(x.next()) + | ^^^^^^^^^^^^^^^^^^ + +error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough + --> $DIR/projection-no-regions-fn.rs:24:5 + | +24 | Box::new(x.next()) + | ^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`... + +error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough + --> $DIR/projection-no-regions-fn.rs:40:5 + | +40 | Box::new(x.next()) + | ^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`... + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs new file mode 100644 index 0000000000..9a5e04dedd --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs @@ -0,0 +1,106 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test cases where we constrain `<T as Anything<'b>>::AssocType` to +// outlive `'a` and there are no bounds in the trait definition of +// `Anything`. This means that the constraint can only be satisfied in two +// ways: +// +// - by ensuring that `T: 'a` and `'b: 'a`, or +// - by something in the where clauses. +// +// As of this writing, the where clause option does not work because +// of limitations in our region inferencing system (this is true both +// with and without NLL). See `projection_outlives`. +// +// Ensuring that both `T: 'a` and `'b: 'a` holds does work (`elements_outlive`). + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +trait Anything<'a> { + type AssocType; +} + +fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) +where + F: FnOnce(Cell<&'a ()>, T), +{ + op(cell, t) +} + +fn require<'a, 'b, T>(_cell: Cell<&'a ()>, _t: T) +where + T: Anything<'b>, + T::AssocType: 'a, +{ +} + +#[rustc_regions] +fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, +{ + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the parameter type `T` may not live long enough + //~| ERROR does not outlive free region +} + +#[rustc_regions] +fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + 'a: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the parameter type `T` may not live long enough + //~| ERROR does not outlive free region +} + +#[rustc_regions] +fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + T::AssocType: 'a, +{ + // This error is unfortunate. This code ought to type-check: we + // are projecting `<T as Anything<'b>>::AssocType`, and we know + // that this outlives `'a` because of the where-clause. However, + // the way the region checker works, we don't register this + // outlives obligation, and hence we get an error: this is because + // what we see is a projection like `<T as + // Anything<'?0>>::AssocType`, and we don't yet know if `?0` will + // equal `'b` or not, so we ignore the where-clause. Obviously we + // can do better here with a more involved verification step. + + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the parameter type `T` may not live long enough + //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` +} + +#[rustc_regions] +fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + T: 'a, + 'b: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr new file mode 100644 index 0000000000..bfe408342a --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -0,0 +1,200 @@ +warning: not reporting region error due to -Znll + --> $DIR/projection-one-region-closure.rs:56:39 + | +56 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-one-region-closure.rs:68:39 + | +68 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-one-region-closure.rs:90:39 + | +90 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +note: External requirements + --> $DIR/projection-one-region-closure.rs:56:29 + | +56 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:19 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + = note: number of external vids: 3 + = note: where T: '_#2r + = note: where '_#1r: '_#2r + +note: External requirements + --> $DIR/projection-one-region-closure.rs:68:29 + | +68 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:23 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where T: '_#3r + = note: where '_#2r: '_#3r + +note: External requirements + --> $DIR/projection-one-region-closure.rs:90:29 + | +90 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:27 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where T: '_#3r + = note: where '_#2r: '_#3r + +note: External requirements + --> $DIR/projection-one-region-closure.rs:103:29 + | +103 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:31 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where T: '_#3r + = note: where '_#2r: '_#3r + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/projection-one-region-closure.rs:56:29 + | +56 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))`... + +error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))` + --> $DIR/projection-one-region-closure.rs:56:20 + | +56 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^ + +note: No external requirements + --> $DIR/projection-one-region-closure.rs:52:1 + | +52 | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +53 | | where +54 | | T: Anything<'b>, +55 | | { +... | +59 | | //~| ERROR does not outlive free region +60 | | } + | |_^ + | + = note: defining type: DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [ + '_#1r, + T + ] + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/projection-one-region-closure.rs:68:29 + | +68 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + +error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` + --> $DIR/projection-one-region-closure.rs:68:20 + | +68 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^ + +note: No external requirements + --> $DIR/projection-one-region-closure.rs:63:1 + | +63 | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +64 | | where +65 | | T: Anything<'b>, +66 | | 'a: 'a, +... | +71 | | //~| ERROR does not outlive free region +72 | | } + | |_^ + | + = note: defining type: DefId(0/0:9 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/projection-one-region-closure.rs:90:29 + | +90 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + +error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` + --> $DIR/projection-one-region-closure.rs:90:20 + | +90 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^ + +note: No external requirements + --> $DIR/projection-one-region-closure.rs:75:1 + | +75 | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +76 | | where +77 | | T: Anything<'b>, +78 | | T::AssocType: 'a, +... | +93 | | //~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` +94 | | } + | |_^ + | + = note: defining type: DefId(0/0:10 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-one-region-closure.rs:97:1 + | +97 | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +98 | | where +99 | | T: Anything<'b>, +100 | | T: 'a, +... | +103 | | with_signature(cell, t, |cell, t| require(cell, t)); +104 | | } + | |_^ + | + = note: defining type: DefId(0/0:11 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs new file mode 100644 index 0000000000..232025b573 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs @@ -0,0 +1,106 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test cases where we constrain `<T as Anything<'b>>::AssocType` to +// outlive `'a` and there is a unique bound in the trait definition of +// `Anything` -- i.e., we know that `AssocType` outlives `'b`. In this +// case, the best way to satisfy the trait bound is to show that `'b: +// 'a`, which can be done in various ways. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +trait Anything<'a> { + type AssocType: 'a; +} + +fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) +where + F: FnOnce(Cell<&'a ()>, T), +{ + op(cell, t) +} + +fn require<'a, 'b, T>(_cell: Cell<&'a ()>, _t: T) +where + T: Anything<'b>, + T::AssocType: 'a, +{ +} + +#[rustc_regions] +fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, +{ + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR does not outlive free region +} + +#[rustc_regions] +fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + 'a: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR does not outlive free region +} + +#[rustc_regions] +fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + T::AssocType: 'a, +{ + // This error is unfortunate. This code ought to type-check: we + // are projecting `<T as Anything<'b>>::AssocType`, and we know + // that this outlives `'a` because of the where-clause. However, + // the way the region checker works, we don't register this + // outlives obligation, and hence we get an error: this is because + // what we see is a projection like `<T as + // Anything<'?0>>::AssocType`, and we don't yet know if `?0` will + // equal `'b` or not, so we ignore the where-clause. Obviously we + // can do better here with a more involved verification step. + + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR does not outlive free region +} + +#[rustc_regions] +fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + 'b: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'a>, +{ + // Note that in this case the closure still propagates an external + // requirement between two variables in its signature, but the + // creator maps both those two region variables to `'a` on its + // side. + with_signature(cell, t, |cell, t| require(cell, t)); +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr new file mode 100644 index 0000000000..6cb54170d7 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -0,0 +1,204 @@ +warning: not reporting region error due to -Znll + --> $DIR/projection-one-region-trait-bound-closure.rs:48:39 + | +48 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-one-region-trait-bound-closure.rs:59:39 + | +59 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-one-region-trait-bound-closure.rs:80:39 + | +80 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +note: External requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:48:29 + | +48 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:19 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + = note: number of external vids: 3 + = note: where '_#1r: '_#2r + +note: External requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:59:29 + | +59 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:23 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where '_#2r: '_#3r + +note: External requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:80:29 + | +80 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:27 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where '_#2r: '_#3r + +note: External requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:91:29 + | +91 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:31 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where '_#2r: '_#3r + +note: External requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:103:29 + | +103 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:34 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + = note: number of external vids: 3 + = note: where '_#1r: '_#2r + +error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:8 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))` + --> $DIR/projection-one-region-trait-bound-closure.rs:48:20 + | +48 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^ + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:44:1 + | +44 | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +45 | | where +46 | | T: Anything<'b>, +47 | | { +... | +50 | | //~| ERROR does not outlive free region +51 | | } + | |_^ + | + = note: defining type: DefId(0/0:8 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ + '_#1r, + T + ] + +error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` + --> $DIR/projection-one-region-trait-bound-closure.rs:59:20 + | +59 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^ + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:54:1 + | +54 | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +55 | | where +56 | | T: Anything<'b>, +57 | | 'a: 'a, +... | +61 | | //~| ERROR does not outlive free region +62 | | } + | |_^ + | + = note: defining type: DefId(0/0:9 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)` + --> $DIR/projection-one-region-trait-bound-closure.rs:80:20 + | +80 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^ + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:65:1 + | +65 | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +66 | | where +67 | | T: Anything<'b>, +68 | | T::AssocType: 'a, +... | +82 | | //~| ERROR does not outlive free region +83 | | } + | |_^ + | + = note: defining type: DefId(0/0:10 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:86:1 + | +86 | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +87 | | where +88 | | T: Anything<'b>, +89 | | 'b: 'a, +90 | | { +91 | | with_signature(cell, t, |cell, t| require(cell, t)); +92 | | } + | |_^ + | + = note: defining type: DefId(0/0:11 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-closure.rs:95:1 + | +95 | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) +96 | | where +97 | | T: Anything<'a>, +98 | | { +... | +103 | | with_signature(cell, t, |cell, t| require(cell, t)); +104 | | } + | |_^ + | + = note: defining type: DefId(0/0:12 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [ + '_#1r, + T + ] + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs new file mode 100644 index 0000000000..67e28af114 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs @@ -0,0 +1,99 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test cases where we constrain `<T as Anything<'b>>::AssocType` to +// outlive `'static`. In this case, we don't get any errors, and in fact +// we don't even propagate constraints from the closures to the callers. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +trait Anything<'a> { + type AssocType: 'static; +} + +fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) +where + F: FnOnce(Cell<&'a ()>, T), +{ + op(cell, t) +} + +fn require<'a, 'b, T>(_cell: Cell<&'a ()>, _t: T) +where + T: Anything<'b>, + T::AssocType: 'a, +{ +} + +#[rustc_regions] +fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + 'a: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + T::AssocType: 'a, +{ + // This error is unfortunate. This code ought to type-check: we + // are projecting `<T as Anything<'b>>::AssocType`, and we know + // that this outlives `'a` because of the where-clause. However, + // the way the region checker works, we don't register this + // outlives obligation, and hence we get an error: this is because + // what we see is a projection like `<T as + // Anything<'?0>>::AssocType`, and we don't yet know if `?0` will + // equal `'b` or not, so we ignore the where-clause. Obviously we + // can do better here with a more involved verification step. + + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b>, + 'b: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'a>, +{ + // Note that in this case the closure still propagates an external + // requirement between two variables in its signature, but the + // creator maps both those two region variables to `'a` on its + // side. + with_signature(cell, t, |cell, t| require(cell, t)); +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr new file mode 100644 index 0000000000..986676d28d --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -0,0 +1,155 @@ +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:47:29 + | +47 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:19 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:56:29 + | +56 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:23 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:75:29 + | +75 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:27 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:84:29 + | +84 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:31 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:96:29 + | +96 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:34 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:43:1 + | +43 | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +44 | | where +45 | | T: Anything<'b>, +46 | | { +47 | | with_signature(cell, t, |cell, t| require(cell, t)); +48 | | } + | |_^ + | + = note: defining type: DefId(0/0:8 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [ + '_#1r, + T + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:51:1 + | +51 | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +52 | | where +53 | | T: Anything<'b>, +54 | | 'a: 'a, +55 | | { +56 | | with_signature(cell, t, |cell, t| require(cell, t)); +57 | | } + | |_^ + | + = note: defining type: DefId(0/0:9 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:60:1 + | +60 | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +61 | | where +62 | | T: Anything<'b>, +63 | | T::AssocType: 'a, +... | +75 | | with_signature(cell, t, |cell, t| require(cell, t)); +76 | | } + | |_^ + | + = note: defining type: DefId(0/0:10 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:79:1 + | +79 | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +80 | | where +81 | | T: Anything<'b>, +82 | | 'b: 'a, +83 | | { +84 | | with_signature(cell, t, |cell, t| require(cell, t)); +85 | | } + | |_^ + | + = note: defining type: DefId(0/0:11 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-one-region-trait-bound-static-closure.rs:88:1 + | +88 | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) +89 | | where +90 | | T: Anything<'a>, +91 | | { +... | +96 | | with_signature(cell, t, |cell, t| require(cell, t)); +97 | | } + | |_^ + | + = note: defining type: DefId(0/0:12 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [ + '_#1r, + T + ] + diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs new file mode 100644 index 0000000000..e3cee00ed4 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs @@ -0,0 +1,135 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test cases where we constrain `<T as Anything<'a, 'b>>::AssocType` +// to outlive `'a` and there are two bounds in the trait definition of +// `Anything` -- i.e., we know that `AssocType` outlives `'a` and +// `'b`. In this case, it's not clear what is the best way to satisfy +// the trait bound, and hence we propagate it to the caller as a type +// test. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +trait Anything<'a, 'b> { + type AssocType: 'a + 'b; +} + +fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) +where + F: FnOnce(Cell<&'a ()>, T), +{ + op(cell, t) +} + +fn require<'a, 'b, 'c, T>(_cell: Cell<&'a ()>, _t: T) +where + T: Anything<'b, 'c>, + T::AssocType: 'a, +{ +} + +#[rustc_regions] +fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b, 'c>, +{ + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough +} + +#[rustc_regions] +fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b, 'c>, + 'a: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough +} + +#[rustc_regions] +fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b, 'c>, + T::AssocType: 'a, +{ + // This error is unfortunate. This code ought to type-check: we + // are projecting `<T as Anything<'b>>::AssocType`, and we know + // that this outlives `'a` because of the where-clause. However, + // the way the region checker works, we don't register this + // outlives obligation, and hence we get an error: this is because + // what we see is a projection like `<T as + // Anything<'?0>>::AssocType`, and we don't yet know if `?0` will + // equal `'b` or not, so we ignore the where-clause. Obviously we + // can do better here with a more involved verification step. + + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough +} + +#[rustc_regions] +fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b, 'c>, + 'b: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b, 'c>, + 'c: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b, 'b>, +{ + with_signature(cell, t, |cell, t| require(cell, t)); + //~^ WARNING not reporting region error due to -Znll + //~| ERROR does not outlive free region +} + +#[rustc_regions] +fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'b, 'b>, + 'b: 'a, +{ + with_signature(cell, t, |cell, t| require(cell, t)); +} + +#[rustc_regions] +fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) +where + T: Anything<'a, 'a>, +{ + // Note that in this case the closure still propagates an external + // requirement between two variables in its signature, but the + // creator maps both those two region variables to `'a` on its + // side. + with_signature(cell, t, |cell, t| require(cell, t)); +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr new file mode 100644 index 0000000000..21487899d3 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -0,0 +1,332 @@ +warning: not reporting region error due to -Znll + --> $DIR/projection-two-region-trait-bound-closure.rs:49:39 + | +49 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-two-region-trait-bound-closure.rs:60:39 + | +60 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-two-region-trait-bound-closure.rs:81:39 + | +81 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/projection-two-region-trait-bound-closure.rs:109:39 + | +109 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^ + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:49:29 + | +49 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:22 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#2r)>>::AssocType: '_#3r + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:60:29 + | +60 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:27 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + '_#3r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)) + ] + = note: number of external vids: 5 + = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:81:29 + | +81 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:32 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + '_#3r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)) + ] + = note: number of external vids: 5 + = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:92:29 + | +92 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:37 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + '_#3r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)) + ] + = note: number of external vids: 5 + = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:101:29 + | +101 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:42 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + '_#3r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)) + ] + = note: number of external vids: 5 + = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#3r)>>::AssocType: '_#4r + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:109:29 + | +109 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:46 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + = note: number of external vids: 3 + = note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#1r)>>::AssocType: '_#2r + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:120:29 + | +120 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:50 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where <T as Anything<ReClosureBound('_#2r), ReClosureBound('_#2r)>>::AssocType: '_#3r + +note: External requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:132:29 + | +132 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:53 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + = note: number of external vids: 3 + = note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#1r)>>::AssocType: '_#2r + +error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough + --> $DIR/projection-two-region-trait-bound-closure.rs:49:29 + | +49 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0/0:8 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:18), 'a))`... + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:45:1 + | +45 | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +46 | | where +47 | | T: Anything<'b, 'c>, +48 | | { +... | +51 | | //~| ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough +52 | | } + | |_^ + | + = note: defining type: DefId(0/0:8 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough + --> $DIR/projection-two-region-trait-bound-closure.rs:60:29 + | +60 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: ReEarlyBound(0, 'a)`... + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:55:1 + | +55 | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +56 | | where +57 | | T: Anything<'b, 'c>, +58 | | 'a: 'a, +... | +62 | | //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough +63 | | } + | |_^ + | + = note: defining type: DefId(0/0:9 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ + '_#1r, + '_#2r, + '_#3r, + T + ] + +error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough + --> $DIR/projection-two-region-trait-bound-closure.rs:81:29 + | +81 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: ReEarlyBound(0, 'a)`... + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:66:1 + | +66 | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +67 | | where +68 | | T: Anything<'b, 'c>, +69 | | T::AssocType: 'a, +... | +83 | | //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough +84 | | } + | |_^ + | + = note: defining type: DefId(0/0:10 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ + '_#1r, + '_#2r, + '_#3r, + T + ] + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:87:1 + | +87 | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +88 | | where +89 | | T: Anything<'b, 'c>, +90 | | 'b: 'a, +91 | | { +92 | | with_signature(cell, t, |cell, t| require(cell, t)); +93 | | } + | |_^ + | + = note: defining type: DefId(0/0:11 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [ + '_#1r, + '_#2r, + '_#3r, + T + ] + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:96:1 + | +96 | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) +97 | | where +98 | | T: Anything<'b, 'c>, +99 | | 'c: 'a, +100 | | { +101 | | with_signature(cell, t, |cell, t| require(cell, t)); +102 | | } + | |_^ + | + = note: defining type: DefId(0/0:12 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [ + '_#1r, + '_#2r, + '_#3r, + T + ] + +error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:13 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]), BrNamed(crate0:DefIndex(1:43), 'a))` + --> $DIR/projection-two-region-trait-bound-closure.rs:109:20 + | +109 | with_signature(cell, t, |cell, t| require(cell, t)); + | ^^^^ + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:105:1 + | +105 | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +106 | | where +107 | | T: Anything<'b, 'b>, +108 | | { +... | +111 | | //~| ERROR does not outlive free region +112 | | } + | |_^ + | + = note: defining type: DefId(0/0:13 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [ + '_#1r, + T + ] + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:115:1 + | +115 | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) +116 | | where +117 | | T: Anything<'b, 'b>, +118 | | 'b: 'a, +119 | | { +120 | | with_signature(cell, t, |cell, t| require(cell, t)); +121 | | } + | |_^ + | + = note: defining type: DefId(0/0:14 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +note: No external requirements + --> $DIR/projection-two-region-trait-bound-closure.rs:124:1 + | +124 | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) +125 | | where +126 | | T: Anything<'a, 'a>, +127 | | { +... | +132 | | with_signature(cell, t, |cell, t| require(cell, t)); +133 | | } + | |_^ + | + = note: defining type: DefId(0/0:15 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [ + '_#1r, + T + ] + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs new file mode 100644 index 0000000000..423747a6bd --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs @@ -0,0 +1,55 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +// Invoke in such a way that the callee knows: +// +// - 'a: 'x +// +// and it must prove that `T: 'x`. Callee passes along `T: 'a`. +fn twice<'a, F, T>(v: Cell<&'a ()>, value: T, mut f: F) +where + F: for<'x> FnMut(Option<Cell<&'a &'x ()>>, &T), +{ + f(None, &value); + f(None, &value); +} + +#[rustc_regions] +fn generic<T>(value: T) { + let cell = Cell::new(&()); + twice(cell, value, |a, b| invoke(a, b)); + //~^ WARNING not reporting region error + // + // This error from the old region solver looks bogus. +} + +#[rustc_regions] +fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { + twice(cell, value, |a, b| invoke(a, b)); + //~^ WARNING not reporting region error + //~| WARNING not reporting region error + //~| ERROR the parameter type `T` may not live long enough +} + +fn invoke<'a, 'x, T>(x: Option<Cell<&'x &'a ()>>, y: &T) +where + T: 'x, +{ +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr new file mode 100644 index 0000000000..023b58c927 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -0,0 +1,87 @@ +warning: not reporting region error due to -Znll + --> $DIR/ty-param-closure-approximate-lower-bound.rs:35:31 + | +35 | twice(cell, value, |a, b| invoke(a, b)); + | ^^^^^^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31 + | +43 | twice(cell, value, |a, b| invoke(a, b)); + | ^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31 + | +43 | twice(cell, value, |a, b| invoke(a, b)); + | ^^^^^^^^^^^^ + +note: External requirements + --> $DIR/ty-param-closure-approximate-lower-bound.rs:35:24 + | +35 | twice(cell, value, |a, b| invoke(a, b)); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:14 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [ + T, + i16, + for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) ()>>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) T)) + ] + = note: number of external vids: 2 + = note: where T: '_#1r + +note: External requirements + --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:24 + | +43 | twice(cell, value, |a, b| invoke(a, b)); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: defining type: DefId(0/1:17 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [ + T, + i16, + for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) ()>>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) T)) + ] + = note: number of external vids: 2 + = note: where T: '_#1r + +note: No external requirements + --> $DIR/ty-param-closure-approximate-lower-bound.rs:33:1 + | +33 | / fn generic<T>(value: T) { +34 | | let cell = Cell::new(&()); +35 | | twice(cell, value, |a, b| invoke(a, b)); +36 | | //~^ WARNING not reporting region error +37 | | // +38 | | // This error from the old region solver looks bogus. +39 | | } + | |_^ + | + = note: defining type: DefId(0/0:5 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [ + T + ] + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-closure-approximate-lower-bound.rs:43:24 + | +43 | twice(cell, value, |a, b| invoke(a, b)); + | ^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(1:15), 'a))`... + +note: No external requirements + --> $DIR/ty-param-closure-approximate-lower-bound.rs:42:1 + | +42 | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { +43 | | twice(cell, value, |a, b| invoke(a, b)); +44 | | //~^ WARNING not reporting region error +45 | | //~| WARNING not reporting region error +46 | | //~| ERROR the parameter type `T` may not live long enough +47 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [ + T + ] + +error: aborting due to previous error + diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs new file mode 100644 index 0000000000..95a483b3c3 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs @@ -0,0 +1,66 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +use std::fmt::Debug; + +fn with_signature<'a, T, F>(x: Box<T>, op: F) -> Box<dyn Debug + 'a> + where F: FnOnce(Box<T>) -> Box<dyn Debug + 'a> +{ + op(x) +} + +#[rustc_regions] +fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a> +where + T: Debug, +{ + // Here, the closure winds up being required to prove that `T: + // 'a`. In principle, it could know that, except that it is + // type-checked in a fully generic way, and hence it winds up with + // a propagated requirement that `T: '_#2`, where `'_#2` appears + // in the return type. The caller makes the mapping from `'_#2` to + // `'a` (and subsequently reports an error). + + with_signature(x, |y| y) + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the parameter type `T` may not live long enough +} + +fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a> +where + T: 'a + Debug, +{ + x +} + +fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a> +where + T: 'b + Debug, +{ + x + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the parameter type `T` may not live long enough +} + +fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a> +where + T: 'b + Debug, + 'b: 'a, +{ + x +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr new file mode 100644 index 0000000000..b7120017a2 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -0,0 +1,62 @@ +warning: not reporting region error due to -Znll + --> $DIR/ty-param-closure-outlives-from-return-type.rs:37:27 + | +37 | with_signature(x, |y| y) + | ^ + +warning: not reporting region error due to -Znll + --> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5 + | +53 | x + | ^ + +note: External requirements + --> $DIR/ty-param-closure-outlives-from-return-type.rs:37:23 + | +37 | with_signature(x, |y| y) + | ^^^^^ + | + = note: defining type: DefId(0/1:14 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<std::fmt::Debug + '_#2r> + ] + = note: number of external vids: 3 + = note: where T: '_#2r + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-closure-outlives-from-return-type.rs:37:23 + | +37 | with_signature(x, |y| y) + | ^^^^^ + | + = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + +note: No external requirements + --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:1 + | +26 | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a> +27 | | where +28 | | T: Debug, +29 | | { +... | +39 | | //~| ERROR the parameter type `T` may not live long enough +40 | | } + | |_^ + | + = note: defining type: DefId(0/0:5 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [ + '_#1r, + T + ] + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5 + | +53 | x + | ^ + | + = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs new file mode 100644 index 0000000000..1149f250a4 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs @@ -0,0 +1,96 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we can propagate `T: 'a` obligations to our caller. See +// `correct_region` for an explanation of how this test is setup; it's +// somewhat intricate. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose + +#![allow(warnings)] +#![feature(dyn_trait)] +#![feature(rustc_attrs)] + +use std::cell::Cell; + +fn with_signature<'a, T, F>(a: Cell<&'a ()>, b: T, op: F) +where + F: FnOnce(Cell<&'a ()>, T), +{ + op(a, b) +} + +fn require<'a, T>(_a: &Cell<&'a ()>, _b: &T) +where + T: 'a, +{ +} + +#[rustc_regions] +fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { + with_signature(a, b, |x, y| { + //~^ ERROR the parameter type `T` may not live long enough + // + // See `correct_region`, which explains the point of this + // test. The only difference is that, in the case of this + // function, there is no where clause *anywhere*, and hence we + // get an error (but reported by the closure creator). + require(&x, &y) + //~^ WARNING not reporting region error due to -Znll + }) +} + +#[rustc_regions] +fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) +where + T: 'a, +{ + with_signature(a, b, |x, y| { + // Key point of this test: + // + // The *closure* is being type-checked with all of its free + // regions "universalized". In particular, it does not know + // that `x` has the type `Cell<&'a ()>`, but rather treats it + // as if the type of `x` is `Cell<&'A ()>`, where `'A` is some + // fresh, independent region distinct from the `'a` which + // appears in the environment. The call to `require` here + // forces us then to prove that `T: 'A`, but the closure + // cannot do it on its own. It has to surface this requirement + // to its creator (which knows that `'a == 'A`). + require(&x, &y) + }) +} + +#[rustc_regions] +fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) +where + T: 'b, +{ + with_signature(a, b, |x, y| { + //~^ ERROR the parameter type `T` may not live long enough + // See `correct_region` + require(&x, &y) + //~^ WARNING not reporting region error due to -Znll + }) +} + +#[rustc_regions] +fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) +where + T: 'b, + 'b: 'a, +{ + with_signature(a, b, |x, y| { + // See `correct_region` + require(&x, &y) + }) +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr new file mode 100644 index 0000000000..2dd13810ae --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -0,0 +1,195 @@ +warning: not reporting region error due to -Znll + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:45:9 + | +45 | require(&x, &y) + | ^^^^^^^ + +warning: not reporting region error due to -Znll + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:79:9 + | +79 | require(&x, &y) + | ^^^^^^^ + +note: External requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:26 + | +38 | with_signature(a, b, |x, y| { + | __________________________^ +39 | | //~^ ERROR the parameter type `T` may not live long enough +40 | | // +41 | | // See `correct_region`, which explains the point of this +... | +46 | | //~^ WARNING not reporting region error due to -Znll +47 | | }) + | |_____^ + | + = note: defining type: DefId(0/1:16 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [ + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#1r ()>, T)) + ] + = note: number of external vids: 2 + = note: where T: '_#1r + +note: External requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:55:26 + | +55 | with_signature(a, b, |x, y| { + | __________________________^ +56 | | // Key point of this test: +57 | | // +58 | | // The *closure* is being type-checked with all of its free +... | +67 | | require(&x, &y) +68 | | }) + | |_____^ + | + = note: defining type: DefId(0/1:19 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + = note: number of external vids: 3 + = note: where T: '_#2r + +note: External requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26 + | +76 | with_signature(a, b, |x, y| { + | __________________________^ +77 | | //~^ ERROR the parameter type `T` may not live long enough +78 | | // See `correct_region` +79 | | require(&x, &y) +80 | | //~^ WARNING not reporting region error due to -Znll +81 | | }) + | |_____^ + | + = note: defining type: DefId(0/1:23 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)) + ] + = note: number of external vids: 3 + = note: where T: '_#2r + +note: External requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:90:26 + | +90 | with_signature(a, b, |x, y| { + | __________________________^ +91 | | // See `correct_region` +92 | | require(&x, &y) +93 | | }) + | |_____^ + | + = note: defining type: DefId(0/1:27 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ + '_#1r, + '_#2r, + T, + i32, + extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)) + ] + = note: number of external vids: 4 + = note: where T: '_#3r + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:26 + | +38 | with_signature(a, b, |x, y| { + | __________________________^ +39 | | //~^ ERROR the parameter type `T` may not live long enough +40 | | // +41 | | // See `correct_region`, which explains the point of this +... | +46 | | //~^ WARNING not reporting region error due to -Znll +47 | | }) + | |_____^ + | + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(1:14), 'a))`... + +note: No external requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:37:1 + | +37 | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { +38 | | with_signature(a, b, |x, y| { +39 | | //~^ ERROR the parameter type `T` may not live long enough +40 | | // +... | +47 | | }) +48 | | } + | |_^ + | + = note: defining type: DefId(0/0:6 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [ + T + ] + +note: No external requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:51:1 + | +51 | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) +52 | | where +53 | | T: 'a, +54 | | { +... | +68 | | }) +69 | | } + | |_^ + | + = note: defining type: DefId(0/0:7 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [ + '_#1r, + T + ] + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26 + | +76 | with_signature(a, b, |x, y| { + | __________________________^ +77 | | //~^ ERROR the parameter type `T` may not live long enough +78 | | // See `correct_region` +79 | | require(&x, &y) +80 | | //~^ WARNING not reporting region error due to -Znll +81 | | }) + | |_____^ + | + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(1:20), 'a))`... + +note: No external requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:72:1 + | +72 | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) +73 | | where +74 | | T: 'b, +75 | | { +... | +81 | | }) +82 | | } + | |_^ + | + = note: defining type: DefId(0/0:8 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [ + '_#1r, + T + ] + +note: No external requirements + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:85:1 + | +85 | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) +86 | | where +87 | | T: 'b, +88 | | 'b: 'a, +... | +93 | | }) +94 | | } + | |_^ + | + = note: defining type: DefId(0/0:9 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [ + '_#1r, + '_#2r, + T + ] + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs new file mode 100644 index 0000000000..babe608354 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs @@ -0,0 +1,41 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we assume that universal types like `T` outlive the +// function body. Same as ty-param-fn-body, but uses `feature(nll)`, +// which affects error reporting. + +#![feature(nll)] + +#![allow(warnings)] +#![feature(dyn_trait)] + +use std::cell::Cell; + +// No errors here, because `'a` is local to the body. +fn region_within_body<T>(t: T) { + let some_int = 22; + let cell = Cell::new(&some_int); + outlives(cell, t) +} + +// Error here, because T: 'a is not satisfied. +fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) { + outlives(cell, t) + //~^ ERROR the parameter type `T` may not live long enough +} + +fn outlives<'a, T>(x: Cell<&'a usize>, y: T) +where + T: 'a, +{ +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr new file mode 100644 index 0000000000..fa9105df07 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr @@ -0,0 +1,10 @@ +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-fn-body-nll-feature.rs:31:5 + | +31 | outlives(cell, t) + | ^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'a`... + +error: aborting due to previous error + diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs new file mode 100644 index 0000000000..e66c1853b6 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs @@ -0,0 +1,41 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir + +// Test that we assume that universal types like `T` outlive the +// function body. + +#![allow(warnings)] +#![feature(dyn_trait)] + +use std::cell::Cell; + +// No errors here, because `'a` is local to the body. +fn region_within_body<T>(t: T) { + let some_int = 22; + let cell = Cell::new(&some_int); + outlives(cell, t) +} + +// Error here, because T: 'a is not satisfied. +fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) { + outlives(cell, t) + //~^ WARNING not reporting region error due to -Znll + //~| ERROR the parameter type `T` may not live long enough +} + +fn outlives<'a, T>(x: Cell<&'a usize>, y: T) +where + T: 'a, +{ +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr new file mode 100644 index 0000000000..3334f4ecc7 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr @@ -0,0 +1,16 @@ +warning: not reporting region error due to -Znll + --> $DIR/ty-param-fn-body.rs:30:5 + | +30 | outlives(cell, t) + | ^^^^^^^^ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-fn-body.rs:30:5 + | +30 | outlives(cell, t) + | ^^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'a`... + +error: aborting due to previous error + diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.rs b/src/test/ui/nll/ty-outlives/ty-param-fn.rs new file mode 100644 index 0000000000..aa3a03afa3 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-fn.rs @@ -0,0 +1,51 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Znll -Zborrowck=mir + +#![allow(warnings)] +#![feature(dyn_trait)] + +use std::fmt::Debug; + +fn no_region<'a, T>(x: Box<T>) -> Box<Debug + 'a> +where + T: Debug, +{ + x + //~^ WARNING not reporting region error due to -Znll + //~| the parameter type `T` may not live long enough +} + +fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a> +where + T: 'a + Debug, +{ + x +} + +fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a> +where + T: 'b + Debug, +{ + x + //~^ WARNING not reporting region error due to -Znll + //~| the parameter type `T` may not live long enough +} + +fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a> +where + T: 'b + Debug, + 'b: 'a, +{ + x +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn.stderr new file mode 100644 index 0000000000..1e659e2e9f --- /dev/null +++ b/src/test/ui/nll/ty-outlives/ty-param-fn.stderr @@ -0,0 +1,30 @@ +warning: not reporting region error due to -Znll + --> $DIR/ty-param-fn.rs:22:5 + | +22 | x + | ^ + +warning: not reporting region error due to -Znll + --> $DIR/ty-param-fn.rs:38:5 + | +38 | x + | ^ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-fn.rs:22:5 + | +22 | x + | ^ + | + = help: consider adding an explicit lifetime bound `T: 'a`... + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/ty-param-fn.rs:38:5 + | +38 | x + | ^ + | + = help: consider adding an explicit lifetime bound `T: 'a`... + +error: aborting due to 2 previous errors + diff --git a/src/test/incremental/spans_insignificant_w_o_debuginfo.rs b/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs similarity index 50% rename from src/test/incremental/spans_insignificant_w_o_debuginfo.rs rename to src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs index 90ec4a9d55..cab7ba7a50 100644 --- a/src/test/incremental/spans_insignificant_w_o_debuginfo.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs @@ -8,19 +8,35 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This test makes sure that just changing a definition's location in the -// source file does *not* change its incr. comp. hash, if debuginfo is disabled. +// compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully -// revisions:rpass1 rpass2 - -// compile-flags: -Z query-dep-graph +// Test that we assume that universal types like `T` outlive the +// function body. +#![allow(warnings)] #![feature(rustc_attrs)] -#[cfg(rpass1)] -pub fn main() {} +use std::cell::Cell; -#[cfg(rpass2)] -#[rustc_clean(label="Hir", cfg="rpass2")] -#[rustc_clean(label="HirBody", cfg="rpass2")] -pub fn main() {} +fn twice<F, T>(value: T, mut f: F) +where + F: FnMut(Cell<&T>), +{ + f(Cell::new(&value)); + f(Cell::new(&value)); +} + +#[rustc_errors] +fn generic<T>(value: T) { + // No error here: + twice(value, |r| invoke(r)); +} + +fn invoke<'a, T>(x: Cell<&'a T>) +where + T: 'a, +{ +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.stderr b/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/compile-fail/no-patterns-in-args.rs b/src/test/ui/no-patterns-in-args.rs similarity index 83% rename from src/test/compile-fail/no-patterns-in-args.rs rename to src/test/ui/no-patterns-in-args.rs index 081d6caaa1..757bd2cb52 100644 --- a/src/test/compile-fail/no-patterns-in-args.rs +++ b/src/test/ui/no-patterns-in-args.rs @@ -10,11 +10,8 @@ extern { fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function fn g1(arg: u8); // OK fn g2(_: u8); // OK // fn g3(u8); // Not yet diff --git a/src/test/ui/no-patterns-in-args.stderr b/src/test/ui/no-patterns-in-args.stderr new file mode 100644 index 0000000000..0db9eb9ded --- /dev/null +++ b/src/test/ui/no-patterns-in-args.stderr @@ -0,0 +1,32 @@ +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/no-patterns-in-args.rs:12:11 + | +12 | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations + | ^^^^^^^ pattern not allowed in foreign function + +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/no-patterns-in-args.rs:13:11 + | +13 | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations + | ^^^^ pattern not allowed in foreign function + +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/no-patterns-in-args.rs:14:11 + | +14 | fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations + | ^^^^^^^ pattern not allowed in foreign function + +error[E0561]: patterns aren't allowed in function pointer types + --> $DIR/no-patterns-in-args.rs:20:14 + | +20 | type A1 = fn(mut arg: u8); //~ ERROR patterns aren't allowed in function pointer types + | ^^^^^^^ + +error[E0561]: patterns aren't allowed in function pointer types + --> $DIR/no-patterns-in-args.rs:21:14 + | +21 | type A2 = fn(&arg: u8); //~ ERROR patterns aren't allowed in function pointer types + | ^^^^ + +error: aborting due to 5 previous errors + diff --git a/src/test/compile-fail/non-constant-expr-for-arr-len.rs b/src/test/ui/non-constant-expr-for-arr-len.rs similarity index 94% rename from src/test/compile-fail/non-constant-expr-for-arr-len.rs rename to src/test/ui/non-constant-expr-for-arr-len.rs index 17df7ae234..f8f46f30f8 100644 --- a/src/test/compile-fail/non-constant-expr-for-arr-len.rs +++ b/src/test/ui/non-constant-expr-for-arr-len.rs @@ -14,6 +14,5 @@ fn main() { fn bar(n: usize) { let _x = [0; n]; //~^ ERROR attempt to use a non-constant value in a constant [E0435] - //~| NOTE non-constant value } } diff --git a/src/test/ui/non-constant-expr-for-arr-len.stderr b/src/test/ui/non-constant-expr-for-arr-len.stderr new file mode 100644 index 0000000000..be7e858382 --- /dev/null +++ b/src/test/ui/non-constant-expr-for-arr-len.stderr @@ -0,0 +1,8 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/non-constant-expr-for-arr-len.rs:15:22 + | +15 | let _x = [0; n]; + | ^ non-constant value + +error: aborting due to previous error + diff --git a/src/test/compile-fail/non-exhaustive-pattern-witness.rs b/src/test/ui/non-exhaustive-pattern-witness.rs similarity index 86% rename from src/test/compile-fail/non-exhaustive-pattern-witness.rs rename to src/test/ui/non-exhaustive-pattern-witness.rs index eba61ede8c..0b12a9acbc 100644 --- a/src/test/compile-fail/non-exhaustive-pattern-witness.rs +++ b/src/test/ui/non-exhaustive-pattern-witness.rs @@ -19,7 +19,6 @@ struct Foo { fn struct_with_a_nested_enum_and_vector() { match (Foo { first: true, second: None }) { //~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered -//~| NOTE pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered Foo { first: true, second: None } => (), Foo { first: true, second: Some(_) } => (), Foo { first: false, second: None } => (), @@ -36,7 +35,6 @@ enum Color { fn enum_with_single_missing_variant() { match Color::Red { //~^ ERROR non-exhaustive patterns: `Red` not covered - //~| NOTE pattern `Red` not covered Color::CustomRGBA { .. } => (), Color::Green => () } @@ -49,7 +47,6 @@ enum Direction { fn enum_with_multiple_missing_variants() { match Direction::North { //~^ ERROR non-exhaustive patterns: `East`, `South` and `West` not covered - //~| NOTE patterns `East`, `South` and `West` not covered Direction::North => () } } @@ -61,7 +58,6 @@ enum ExcessiveEnum { fn enum_with_excessive_missing_variants() { match ExcessiveEnum::First { //~^ ERROR `Second`, `Third`, `Fourth` and 8 more not covered - //~| NOTE patterns `Second`, `Third`, `Fourth` and 8 more not covered ExcessiveEnum::First => () } @@ -70,7 +66,6 @@ fn enum_with_excessive_missing_variants() { fn enum_struct_variant() { match Color::Red { //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered - //~| NOTE pattern `CustomRGBA { a: true, .. }` not covered Color::Red => (), Color::Green => (), Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (), @@ -87,7 +82,6 @@ fn vectors_with_nested_enums() { let x: &'static [Enum] = &[Enum::First, Enum::Second(false)]; match *x { //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered - //~| NOTE pattern `[Second(true), Second(false)]` not covered [] => (), [_] => (), [Enum::First, _] => (), @@ -101,7 +95,6 @@ fn vectors_with_nested_enums() { fn missing_nil() { match ((), false) { //~^ ERROR non-exhaustive patterns: `((), false)` not covered - //~| NOTE pattern `((), false)` not covered ((), true) => () } } diff --git a/src/test/ui/non-exhaustive-pattern-witness.stderr b/src/test/ui/non-exhaustive-pattern-witness.stderr new file mode 100644 index 0000000000..f012dfed0b --- /dev/null +++ b/src/test/ui/non-exhaustive-pattern-witness.stderr @@ -0,0 +1,44 @@ +error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:20:11 + | +20 | match (Foo { first: true, second: None }) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered + +error[E0004]: non-exhaustive patterns: `Red` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:36:11 + | +36 | match Color::Red { + | ^^^^^^^^^^ pattern `Red` not covered + +error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:48:11 + | +48 | match Direction::North { + | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered + +error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered + --> $DIR/non-exhaustive-pattern-witness.rs:59:11 + | +59 | match ExcessiveEnum::First { + | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered + +error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:67:11 + | +67 | match Color::Red { + | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered + +error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:83:11 + | +83 | match *x { + | ^^ pattern `[Second(true), Second(false)]` not covered + +error[E0004]: non-exhaustive patterns: `((), false)` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:96:11 + | +96 | match ((), false) { + | ^^^^^^^^^^^ pattern `((), false)` not covered + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/non_modrs_mods/foors_mod.rs b/src/test/ui/non_modrs_mods/foors_mod.rs new file mode 100644 index 0000000000..7d37c6d939 --- /dev/null +++ b/src/test/ui/non_modrs_mods/foors_mod.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// ignore-test: not a test, used by non_modrs_mods.rs + +pub mod inner_modrs_mod; +pub mod inner_foors_mod; diff --git a/src/test/ui/non_modrs_mods/foors_mod/compiletest-ignore-dir b/src/test/ui/non_modrs_mods/foors_mod/compiletest-ignore-dir new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/ui/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/ui/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/ui/non_modrs_mods/modrs_mod/compiletest-ignore-dir b/src/test/ui/non_modrs_mods/modrs_mod/compiletest-ignore-dir new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/ui/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/ui/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/ui/non_modrs_mods/modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/modrs_mod/mod.rs new file mode 100644 index 0000000000..9e3f10f12e --- /dev/null +++ b/src/test/ui/non_modrs_mods/modrs_mod/mod.rs @@ -0,0 +1,12 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod inner_modrs_mod; +pub mod inner_foors_mod; diff --git a/src/test/ui/non_modrs_mods/non_modrs_mods.rs b/src/test/ui/non_modrs_mods/non_modrs_mods.rs new file mode 100644 index 0000000000..9dc85f4d3f --- /dev/null +++ b/src/test/ui/non_modrs_mods/non_modrs_mods.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// Tests the formatting of the feature-gate errors for non_modrs_mods +// +// gate-test-non_modrs_mods +// ignore-windows +// ignore-pretty issue #37195 +pub mod modrs_mod; +pub mod foors_mod; + +#[path = "some_crazy_attr_mod_dir/arbitrary_name.rs"] +pub mod attr_mod; + +pub fn main() { + modrs_mod::inner_modrs_mod::innest::foo(); + modrs_mod::inner_foors_mod::innest::foo(); + foors_mod::inner_modrs_mod::innest::foo(); + foors_mod::inner_foors_mod::innest::foo(); + attr_mod::inner_modrs_mod::innest::foo(); +} diff --git a/src/test/ui/non_modrs_mods/non_modrs_mods.stderr b/src/test/ui/non_modrs_mods/non_modrs_mods.stderr new file mode 100644 index 0000000000..95a2539ed6 --- /dev/null +++ b/src/test/ui/non_modrs_mods/non_modrs_mods.stderr @@ -0,0 +1,38 @@ +error: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/modrs_mod/inner_foors_mod.rs:11:9 + | +11 | pub mod innest; + | ^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to inner_foors_mod/mod.rs + +error: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/foors_mod.rs:13:9 + | +13 | pub mod inner_modrs_mod; + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to foors_mod/mod.rs + +error: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/foors_mod.rs:14:9 + | +14 | pub mod inner_foors_mod; + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to foors_mod/mod.rs + +error: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/foors_mod/inner_foors_mod.rs:11:9 + | +11 | pub mod innest; + | ^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to inner_foors_mod/mod.rs + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs new file mode 100644 index 0000000000..226e6fda0a --- /dev/null +++ b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod inner_modrs_mod; diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs new file mode 100644 index 0000000000..b61667cfd8 --- /dev/null +++ b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs new file mode 100644 index 0000000000..77cab97235 --- /dev/null +++ b/src/test/ui/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/compile-fail/not-enough-arguments.rs b/src/test/ui/not-enough-arguments.rs similarity index 92% rename from src/test/compile-fail/not-enough-arguments.rs rename to src/test/ui/not-enough-arguments.rs index e13008df0d..c952906e5e 100644 --- a/src/test/compile-fail/not-enough-arguments.rs +++ b/src/test/ui/not-enough-arguments.rs @@ -13,12 +13,10 @@ // unrelated errors. fn foo(a: isize, b: isize, c: isize, d:isize) { - //~^ NOTE defined here panic!(); } fn main() { foo(1, 2, 3); //~^ ERROR this function takes 4 parameters but 3 - //~| NOTE expected 4 parameters } diff --git a/src/test/ui/not-enough-arguments.stderr b/src/test/ui/not-enough-arguments.stderr new file mode 100644 index 0000000000..291aa6ec4c --- /dev/null +++ b/src/test/ui/not-enough-arguments.stderr @@ -0,0 +1,11 @@ +error[E0061]: this function takes 4 parameters but 3 parameters were supplied + --> $DIR/not-enough-arguments.rs:20:3 + | +15 | fn foo(a: isize, b: isize, c: isize, d:isize) { + | --------------------------------------------- defined here +... +20 | foo(1, 2, 3); + | ^^^^^^^^^^^^ expected 4 parameters + +error: aborting due to previous error + diff --git a/src/test/compile-fail/numeric-fields.rs b/src/test/ui/numeric-fields.rs similarity index 82% rename from src/test/compile-fail/numeric-fields.rs rename to src/test/ui/numeric-fields.rs index d6e091a147..89d0956036 100644 --- a/src/test/compile-fail/numeric-fields.rs +++ b/src/test/ui/numeric-fields.rs @@ -13,11 +13,8 @@ struct S(u8, u16); fn main() { let s = S{0b1: 10, 0: 11}; //~^ ERROR struct `S` has no field named `0b1` - //~| NOTE `S` does not have this field - //~| NOTE available fields are: `0`, `1` match s { S{0: a, 0x1: b, ..} => {} //~^ ERROR does not have a field named `0x1` - //~| NOTE struct `S` does not have field `0x1` } } diff --git a/src/test/ui/numeric-fields.stderr b/src/test/ui/numeric-fields.stderr new file mode 100644 index 0000000000..cdf85d4f97 --- /dev/null +++ b/src/test/ui/numeric-fields.stderr @@ -0,0 +1,16 @@ +error[E0560]: struct `S` has no field named `0b1` + --> $DIR/numeric-fields.rs:14:15 + | +14 | let s = S{0b1: 10, 0: 11}; + | ^^^^ `S` does not have this field + | + = note: available fields are: `0`, `1` + +error[E0026]: struct `S` does not have a field named `0x1` + --> $DIR/numeric-fields.rs:17:17 + | +17 | S{0: a, 0x1: b, ..} => {} + | ^^^^^^ struct `S` does not have field `0x1` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/object-safety-associated-consts.rs b/src/test/ui/object-safety-associated-consts.rs similarity index 84% rename from src/test/compile-fail/object-safety-associated-consts.rs rename to src/test/ui/object-safety-associated-consts.rs index ebb52face0..4bce2c5982 100644 --- a/src/test/compile-fail/object-safety-associated-consts.rs +++ b/src/test/ui/object-safety-associated-consts.rs @@ -18,8 +18,6 @@ trait Bar { fn make_bar<T:Bar>(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE the trait cannot contain associated consts like `X` - //~| NOTE the trait `Bar` cannot be made into an object t } diff --git a/src/test/ui/object-safety-associated-consts.stderr b/src/test/ui/object-safety-associated-consts.stderr new file mode 100644 index 0000000000..f63ded9a8b --- /dev/null +++ b/src/test/ui/object-safety-associated-consts.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-associated-consts.rs:19:1 + | +19 | fn make_bar<T:Bar>(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: the trait cannot contain associated consts like `X` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/object-safety-generics.rs b/src/test/ui/object-safety-generics.rs similarity index 80% rename from src/test/compile-fail/object-safety-generics.rs rename to src/test/ui/object-safety-generics.rs index 6174d45b89..969ceeec27 100644 --- a/src/test/compile-fail/object-safety-generics.rs +++ b/src/test/ui/object-safety-generics.rs @@ -23,15 +23,11 @@ trait Quux { fn make_bar<T:Bar>(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE method `bar` has generic type parameters - //~| NOTE the trait `Bar` cannot be made into an object t } fn make_bar_explicit<T:Bar>(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE method `bar` has generic type parameters - //~| NOTE the trait `Bar` cannot be made into an object t as &Bar } diff --git a/src/test/ui/object-safety-generics.stderr b/src/test/ui/object-safety-generics.stderr new file mode 100644 index 0000000000..7bc714163c --- /dev/null +++ b/src/test/ui/object-safety-generics.stderr @@ -0,0 +1,18 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-generics.rs:24:1 + | +24 | fn make_bar<T:Bar>(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: method `bar` has generic type parameters + +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-generics.rs:29:1 + | +29 | fn make_bar_explicit<T:Bar>(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: method `bar` has generic type parameters + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/object-safety-mentions-Self.rs b/src/test/ui/object-safety-mentions-Self.rs similarity index 77% rename from src/test/compile-fail/object-safety-mentions-Self.rs rename to src/test/ui/object-safety-mentions-Self.rs index d85614fa5b..0f59a928fe 100644 --- a/src/test/compile-fail/object-safety-mentions-Self.rs +++ b/src/test/ui/object-safety-mentions-Self.rs @@ -26,15 +26,11 @@ trait Quux { fn make_bar<T:Bar>(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE method `bar` references the `Self` type in its arguments or return type - //~| NOTE the trait `Bar` cannot be made into an object loop { } } fn make_baz<T:Baz>(t: &T) -> &Baz { //~^ ERROR E0038 - //~| NOTE method `bar` references the `Self` type in its arguments or return type - //~| NOTE the trait `Baz` cannot be made into an object t } diff --git a/src/test/ui/object-safety-mentions-Self.stderr b/src/test/ui/object-safety-mentions-Self.stderr new file mode 100644 index 0000000000..8ed8dcc803 --- /dev/null +++ b/src/test/ui/object-safety-mentions-Self.stderr @@ -0,0 +1,18 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-mentions-Self.rs:27:1 + | +27 | fn make_bar<T:Bar>(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: method `bar` references the `Self` type in its arguments or return type + +error[E0038]: the trait `Baz` cannot be made into an object + --> $DIR/object-safety-mentions-Self.rs:32:1 + | +32 | fn make_baz<T:Baz>(t: &T) -> &Baz { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object + | + = note: method `bar` references the `Self` type in its arguments or return type + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/object-safety-sized.rs b/src/test/ui/object-safety-sized.rs similarity index 84% rename from src/test/compile-fail/object-safety-sized.rs rename to src/test/ui/object-safety-sized.rs index accd7fa87a..7c58609c7e 100644 --- a/src/test/compile-fail/object-safety-sized.rs +++ b/src/test/ui/object-safety-sized.rs @@ -17,8 +17,6 @@ trait Bar : Sized { fn make_bar<T:Bar>(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE the trait `Bar` cannot be made into an object t } diff --git a/src/test/ui/object-safety-sized.stderr b/src/test/ui/object-safety-sized.stderr new file mode 100644 index 0000000000..a733416ef6 --- /dev/null +++ b/src/test/ui/object-safety-sized.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-sized.rs:18:1 + | +18 | fn make_bar<T:Bar>(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: the trait cannot require that `Self : Sized` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs b/src/test/ui/object-safety-supertrait-mentions-Self.rs similarity index 83% rename from src/test/compile-fail/object-safety-supertrait-mentions-Self.rs rename to src/test/ui/object-safety-supertrait-mentions-Self.rs index a93c056c41..53b4fc2de9 100644 --- a/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs +++ b/src/test/ui/object-safety-supertrait-mentions-Self.rs @@ -24,8 +24,6 @@ fn make_bar<T:Bar<u32>>(t: &T) -> &Bar<u32> { fn make_baz<T:Baz>(t: &T) -> &Baz { //~^ ERROR E0038 - //~| NOTE the trait cannot use `Self` as a type parameter in the supertraits or where-clauses - //~| NOTE the trait `Baz` cannot be made into an object t } diff --git a/src/test/ui/object-safety-supertrait-mentions-Self.stderr b/src/test/ui/object-safety-supertrait-mentions-Self.stderr new file mode 100644 index 0000000000..a5a67553c6 --- /dev/null +++ b/src/test/ui/object-safety-supertrait-mentions-Self.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Baz` cannot be made into an object + --> $DIR/object-safety-supertrait-mentions-Self.rs:25:31 + | +25 | fn make_baz<T:Baz>(t: &T) -> &Baz { + | ^^^ the trait `Baz` cannot be made into an object + | + = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses + +error: aborting due to previous error + diff --git a/src/test/ui/on-unimplemented/bad-annotation.rs b/src/test/ui/on-unimplemented/bad-annotation.rs index 54d3b3e087..e7483dbd3b 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.rs +++ b/src/test/ui/on-unimplemented/bad-annotation.rs @@ -23,7 +23,7 @@ trait MyFromIterator<A> { fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self; } -#[rustc_on_unimplemented] //~ ERROR this attribute must have a value +#[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value trait BadAnnotation1 {} @@ -38,27 +38,34 @@ trait BadAnnotation3<A,B> {} #[rustc_on_unimplemented(lorem="")] +//~^ this attribute must have a valid trait BadAnnotation4 {} #[rustc_on_unimplemented(lorem(ipsum(dolor)))] +//~^ this attribute must have a valid trait BadAnnotation5 {} #[rustc_on_unimplemented(message="x", message="y")] +//~^ this attribute must have a valid trait BadAnnotation6 {} #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] +//~^ this attribute must have a valid trait BadAnnotation7 {} #[rustc_on_unimplemented(on(), message="y")] +//~^ empty `on`-clause trait BadAnnotation8 {} #[rustc_on_unimplemented(on="x", message="y")] +//~^ this attribute must have a valid trait BadAnnotation9 {} #[rustc_on_unimplemented(on(x="y"), message="y")] trait BadAnnotation10 {} #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")] +//~^ this attribute must have a valid trait BadAnnotation11 {} pub fn main() { diff --git a/src/test/ui/on-unimplemented/bad-annotation.stderr b/src/test/ui/on-unimplemented/bad-annotation.stderr index 73834f4422..7126cc76eb 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.stderr +++ b/src/test/ui/on-unimplemented/bad-annotation.stderr @@ -1,7 +1,7 @@ error[E0232]: `#[rustc_on_unimplemented]` requires a value --> $DIR/bad-annotation.rs:26:1 | -26 | #[rustc_on_unimplemented] //~ ERROR this attribute must have a value +26 | #[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value | ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here | = note: eg `#[rustc_on_unimplemented = "foo"]` @@ -27,47 +27,47 @@ error[E0232]: this attribute must have a valid value = note: eg `#[rustc_on_unimplemented = "foo"]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:43:26 + --> $DIR/bad-annotation.rs:44:26 | -43 | #[rustc_on_unimplemented(lorem(ipsum(dolor)))] +44 | #[rustc_on_unimplemented(lorem(ipsum(dolor)))] | ^^^^^^^^^^^^^^^^^^^ expected value here | = note: eg `#[rustc_on_unimplemented = "foo"]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:46:39 + --> $DIR/bad-annotation.rs:48:39 | -46 | #[rustc_on_unimplemented(message="x", message="y")] +48 | #[rustc_on_unimplemented(message="x", message="y")] | ^^^^^^^^^^^ expected value here | = note: eg `#[rustc_on_unimplemented = "foo"]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:49:39 + --> $DIR/bad-annotation.rs:52:39 | -49 | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] +52 | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here | = note: eg `#[rustc_on_unimplemented = "foo"]` error[E0232]: empty `on`-clause in `#[rustc_on_unimplemented]` - --> $DIR/bad-annotation.rs:52:26 + --> $DIR/bad-annotation.rs:56:26 | -52 | #[rustc_on_unimplemented(on(), message="y")] +56 | #[rustc_on_unimplemented(on(), message="y")] | ^^^^ empty on-clause here error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:55:26 + --> $DIR/bad-annotation.rs:60:26 | -55 | #[rustc_on_unimplemented(on="x", message="y")] +60 | #[rustc_on_unimplemented(on="x", message="y")] | ^^^^^^ expected value here | = note: eg `#[rustc_on_unimplemented = "foo"]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:61:40 + --> $DIR/bad-annotation.rs:67:40 | -61 | #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")] +67 | #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here | = note: eg `#[rustc_on_unimplemented = "foo"]` diff --git a/src/test/ui/on-unimplemented/multiple-impls.rs b/src/test/ui/on-unimplemented/multiple-impls.rs index 15375936b8..539f5d63c0 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.rs +++ b/src/test/ui/on-unimplemented/multiple-impls.rs @@ -42,20 +42,11 @@ impl Index<Bar<usize>> for [i32] { fn main() { Index::index(&[] as &[i32], 2u32); //~^ ERROR E0277 - //~| NOTE trait message - //~| NOTE required by //~| ERROR E0277 - //~| NOTE trait message Index::index(&[] as &[i32], Foo(2u32)); //~^ ERROR E0277 - //~| NOTE on impl for Foo - //~| NOTE required by //~| ERROR E0277 - //~| NOTE on impl for Foo Index::index(&[] as &[i32], Bar(2u32)); //~^ ERROR E0277 - //~| NOTE on impl for Bar - //~| NOTE required by //~| ERROR E0277 - //~| NOTE on impl for Bar } diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index a1fa8b720a..1f71be446e 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -16,35 +16,35 @@ error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied = help: the trait `Index<u32>` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied - --> $DIR/multiple-impls.rs:49:5 + --> $DIR/multiple-impls.rs:46:5 | -49 | Index::index(&[] as &[i32], Foo(2u32)); +46 | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index<Foo<u32>>` is not implemented for `[i32]` = note: required by `Index::index` error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied - --> $DIR/multiple-impls.rs:49:5 + --> $DIR/multiple-impls.rs:46:5 | -49 | Index::index(&[] as &[i32], Foo(2u32)); +46 | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index<Foo<u32>>` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied - --> $DIR/multiple-impls.rs:55:5 + --> $DIR/multiple-impls.rs:49:5 | -55 | Index::index(&[] as &[i32], Bar(2u32)); +49 | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index<Bar<u32>>` is not implemented for `[i32]` = note: required by `Index::index` error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied - --> $DIR/multiple-impls.rs:55:5 + --> $DIR/multiple-impls.rs:49:5 | -55 | Index::index(&[] as &[i32], Bar(2u32)); +49 | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index<Bar<u32>>` is not implemented for `[i32]` diff --git a/src/test/ui/on-unimplemented/on-impl.rs b/src/test/ui/on-unimplemented/on-impl.rs index 66d612baab..da56ae6499 100644 --- a/src/test/ui/on-unimplemented/on-impl.rs +++ b/src/test/ui/on-unimplemented/on-impl.rs @@ -31,8 +31,5 @@ impl Index<usize> for [i32] { fn main() { Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32); //~^ ERROR E0277 - //~| NOTE a usize is required - //~| NOTE required by //~| ERROR E0277 - //~| NOTE a usize is required } diff --git a/src/test/ui/on-unimplemented/on-trait.rs b/src/test/ui/on-unimplemented/on-trait.rs index ed7ec9b143..a5eea55eeb 100644 --- a/src/test/ui/on-unimplemented/on-trait.rs +++ b/src/test/ui/on-unimplemented/on-trait.rs @@ -36,10 +36,6 @@ pub fn main() { let x = vec![1u8, 2, 3, 4]; let y: Option<Vec<u8>> = collect(x.iter()); // this should give approximately the same error for x.iter().collect() //~^ ERROR - //~^^ NOTE a collection of type `std::option::Option<std::vec::Vec<u8>>` cannot be built from an iterator over elements of type `&u8` - //~^^^ NOTE required by `collect` let x: String = foobar(); //~ ERROR - //~^ NOTE test error `std::string::String` with `u8` `_` `u32` - //~^^ NOTE required by `foobar` } diff --git a/src/test/ui/on-unimplemented/on-trait.stderr b/src/test/ui/on-unimplemented/on-trait.stderr index 84986c1ecf..cde56022fa 100644 --- a/src/test/ui/on-unimplemented/on-trait.stderr +++ b/src/test/ui/on-unimplemented/on-trait.stderr @@ -8,9 +8,9 @@ error[E0277]: the trait bound `std::option::Option<std::vec::Vec<u8>>: MyFromIte = note: required by `collect` error[E0277]: the trait bound `std::string::String: Bar::Foo<u8, _, u32>` is not satisfied - --> $DIR/on-trait.rs:42:21 + --> $DIR/on-trait.rs:40:21 | -42 | let x: String = foobar(); //~ ERROR +40 | let x: String = foobar(); //~ ERROR | ^^^^^^ test error `std::string::String` with `u8` `_` `u32` in `Bar::Foo` | = help: the trait `Bar::Foo<u8, _, u32>` is not implemented for `std::string::String` diff --git a/src/test/ui/on-unimplemented/slice-index.rs b/src/test/ui/on-unimplemented/slice-index.rs index 5d30c2e982..7d67e89a78 100644 --- a/src/test/ui/on-unimplemented/slice-index.rs +++ b/src/test/ui/on-unimplemented/slice-index.rs @@ -19,9 +19,5 @@ use std::ops::Index; fn main() { let x = &[1, 2, 3] as &[i32]; x[1i32]; //~ ERROR E0277 - //~| NOTE slice indices are of type `usize` or ranges of `usize` - //~| NOTE required because of the requirements on the impl of `std::ops::Index<i32>` x[..1i32]; //~ ERROR E0277 - //~| NOTE slice indices are of type `usize` or ranges of `usize` - //~| NOTE requirements on the impl of `std::ops::Index<std::ops::RangeTo<i32>>` } diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index 68789f77f7..a1ecbce770 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -8,9 +8,9 @@ error[E0277]: the trait bound `i32: std::slice::SliceIndex<[i32]>` is not satisf = note: required because of the requirements on the impl of `std::ops::Index<i32>` for `[i32]` error[E0277]: the trait bound `std::ops::RangeTo<i32>: std::slice::SliceIndex<[i32]>` is not satisfied - --> $DIR/slice-index.rs:24:5 + --> $DIR/slice-index.rs:22:5 | -24 | x[..1i32]; //~ ERROR E0277 +22 | x[..1i32]; //~ ERROR E0277 | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[i32]>` is not implemented for `std::ops::RangeTo<i32>` diff --git a/src/test/ui/owl-import-generates-unused-import-lint.rs b/src/test/ui/owl-import-generates-unused-import-lint.rs new file mode 100644 index 0000000000..dc30c31835 --- /dev/null +++ b/src/test/ui/owl-import-generates-unused-import-lint.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(use_nested_groups)] +#![deny(unused_imports)] + +mod foo { + pub enum Bar {} +} + +use foo::{*, *}; //~ ERROR unused import: `*` + +fn main() { + let _: Bar; +} diff --git a/src/test/ui/owl-import-generates-unused-import-lint.stderr b/src/test/ui/owl-import-generates-unused-import-lint.stderr new file mode 100644 index 0000000000..79089b2a93 --- /dev/null +++ b/src/test/ui/owl-import-generates-unused-import-lint.stderr @@ -0,0 +1,14 @@ +error: unused import: `*` + --> $DIR/owl-import-generates-unused-import-lint.rs:18:14 + | +18 | use foo::{*, *}; //~ ERROR unused import: `*` + | ^ + | +note: lint level defined here + --> $DIR/owl-import-generates-unused-import-lint.rs:12:9 + | +12 | #![deny(unused_imports)] + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/run-pass/issue-34571.rs b/src/test/ui/partialeq_help.rs similarity index 85% rename from src/tools/miri/tests/run-pass/issue-34571.rs rename to src/test/ui/partialeq_help.rs index 7d80415657..ee6d632d1a 100644 --- a/src/tools/miri/tests/run-pass/issue-34571.rs +++ b/src/test/ui/partialeq_help.rs @@ -8,13 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[repr(u8)] -enum Foo { - Foo(u8), +fn foo<T: PartialEq>(a: &T, b: T) { + a == b; //~ ERROR E0277 } fn main() { - match Foo::Foo(1) { - _ => () - } + foo(&1, 1); } diff --git a/src/test/ui/partialeq_help.stderr b/src/test/ui/partialeq_help.stderr new file mode 100644 index 0000000000..25ae8b1276 --- /dev/null +++ b/src/test/ui/partialeq_help.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `&T: std::cmp::PartialEq<T>` is not satisfied + --> $DIR/partialeq_help.rs:12:7 + | +12 | a == b; //~ ERROR E0277 + | ^^ can't compare `&T` with `T` + | + = help: the trait `std::cmp::PartialEq<T>` is not implemented for `&T` + = help: consider adding a `where &T: std::cmp::PartialEq<T>` bound + +error: aborting due to previous error + diff --git a/src/test/compile-fail/pat-slice-old-style.rs b/src/test/ui/pat-slice-old-style.rs similarity index 86% rename from src/test/compile-fail/pat-slice-old-style.rs rename to src/test/ui/pat-slice-old-style.rs index d49ce56ccf..4ff1e94b08 100644 --- a/src/test/compile-fail/pat-slice-old-style.rs +++ b/src/test/ui/pat-slice-old-style.rs @@ -18,8 +18,6 @@ fn slice_pat(x: &[u8]) { match x { [a, b..] => {}, //~^ ERROR non-reference pattern used to match a reference - //~| HELP add #![feature(match_default_bindings)] to the crate attributes to enable - //~| HELP consider using _ => panic!(), } } diff --git a/src/test/ui/pat-slice-old-style.stderr b/src/test/ui/pat-slice-old-style.stderr new file mode 100644 index 0000000000..5e7cd10235 --- /dev/null +++ b/src/test/ui/pat-slice-old-style.stderr @@ -0,0 +1,10 @@ +error: non-reference pattern used to match a reference (see issue #42640) + --> $DIR/pat-slice-old-style.rs:19:9 + | +19 | [a, b..] => {}, + | ^^^^^^^^ help: consider using a reference: `&[a, b..]` + | + = help: add #![feature(match_default_bindings)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/ui/print-fuel/print-fuel.rs b/src/test/ui/print-fuel/print-fuel.rs index 0d9e243763..2012a7d02e 100644 --- a/src/test/ui/print-fuel/print-fuel.rs +++ b/src/test/ui/print-fuel/print-fuel.rs @@ -12,6 +12,7 @@ #![allow(dead_code)] // compile-flags: -Z print-fuel=foo +// must-compile-successfully struct S1(u8, u16, u8); struct S2(u8, u16, u8); diff --git a/src/test/ui/print_type_sizes/anonymous.rs b/src/test/ui/print_type_sizes/anonymous.rs index dc93bddbad..56c05f566c 100644 --- a/src/test/ui/print_type_sizes/anonymous.rs +++ b/src/test/ui/print_type_sizes/anonymous.rs @@ -9,12 +9,16 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // All of the types that occur in this function are uninteresting, in // that one cannot control the sizes of these types with the same sort // of enum-variant manipulation tricks. -pub fn main() { +#![feature(start)] + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _byte: u8 = 0; let _word: usize = 0; let _tuple: (u8, usize)= (0, 0); @@ -24,4 +28,6 @@ pub fn main() { fn id(x: u8) -> u8 { x }; fn bye(_: u8) -> ! { loop { } } + + 0 } diff --git a/src/test/ui/print_type_sizes/anonymous.stderr b/src/test/ui/print_type_sizes/anonymous.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/print_type_sizes/anonymous.stdout b/src/test/ui/print_type_sizes/anonymous.stdout new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/print_type_sizes/generics.rs b/src/test/ui/print_type_sizes/generics.rs index 93bcd1c36e..d0e5bd1d92 100644 --- a/src/test/ui/print_type_sizes/generics.rs +++ b/src/test/ui/print_type_sizes/generics.rs @@ -9,11 +9,14 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how generics are handled: types have to be // monomorphized, in the MIR of the original function in which they // occur, to have their size reported. +#![feature(start)] + // In an ad-hoc attempt to avoid the injection of unwinding code // (which clutters the output of `-Z print-type-sizes` with types from // `unwind::libunwind`): @@ -65,9 +68,11 @@ pub fn f1<T:Copy>(x: T) { Pair::new(FiftyBytes::new(), FiftyBytes::new()); } -pub fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _b: Pair<u8> = Pair::new(0, 0); let _s: Pair<SevenBytes> = Pair::new(SevenBytes::new(), SevenBytes::new()); let _z: ZeroSized = ZeroSized; f1::<SevenBytes>(SevenBytes::new()); + 0 } diff --git a/src/test/ui/print_type_sizes/multiple_types.rs b/src/test/ui/print_type_sizes/multiple_types.rs index 2b5010767f..a50b28f3c4 100644 --- a/src/test/ui/print_type_sizes/multiple_types.rs +++ b/src/test/ui/print_type_sizes/multiple_types.rs @@ -9,10 +9,13 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates that when multiple structural types occur in // a function, every one of them is included in the output. +#![feature(start)] + pub struct SevenBytes([u8; 7]); pub struct FiftyBytes([u8; 50]); @@ -21,8 +24,10 @@ pub enum Enum { Large(FiftyBytes), } -pub fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _e: Enum; let _f: FiftyBytes; let _s: SevenBytes; + 0 } diff --git a/src/test/ui/print_type_sizes/multiple_types.stderr b/src/test/ui/print_type_sizes/multiple_types.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/print_type_sizes/nullable.rs b/src/test/ui/print_type_sizes/niche-filling.rs similarity index 72% rename from src/test/ui/print_type_sizes/nullable.rs rename to src/test/ui/print_type_sizes/niche-filling.rs index 5052c59a39..7f234e243e 100644 --- a/src/test/ui/print_type_sizes/nullable.rs +++ b/src/test/ui/print_type_sizes/niche-filling.rs @@ -9,9 +9,10 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully -// This file illustrates how enums with a non-null field are handled, -// modelled after cases like `Option<&u32>` and such. +// This file illustrates how niche-filling enums are handled, +// modelled after cases like `Option<&u32>`, `Option<bool>` and such. // // It uses NonZero directly, rather than `&_` or `Unique<_>`, because // the test is not set up to deal with target-dependent pointer width. @@ -20,6 +21,7 @@ // aligned (while on most it is 8-byte aligned) and so the resulting // padding and overall computed sizes can be quite different. +#![feature(start)] #![feature(nonzero)] #![allow(dead_code)] @@ -68,8 +70,24 @@ impl One for u32 { fn one() -> Self { 1 } } -pub fn main() { +pub enum Enum4<A, B, C, D> { + One(A), + Two(B), + Three(C), + Four(D) +} + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _x: MyOption<NonZero<u32>> = Default::default(); let _y: EmbeddedDiscr = Default::default(); let _z: MyOption<IndirectNonZero<u32>> = Default::default(); + let _a: MyOption<bool> = Default::default(); + let _b: MyOption<char> = Default::default(); + let _c: MyOption<std::cmp::Ordering> = Default::default(); + let _b: MyOption<MyOption<u8>> = Default::default(); + let _e: Enum4<(), char, (), ()> = Enum4::One(()); + let _f: Enum4<(), (), bool, ()> = Enum4::One(()); + let _g: Enum4<(), (), (), MyOption<u8>> = Enum4::One(()); + 0 } diff --git a/src/test/ui/print_type_sizes/niche-filling.stdout b/src/test/ui/print_type_sizes/niche-filling.stdout new file mode 100644 index 0000000000..0f53e7722d --- /dev/null +++ b/src/test/ui/print_type_sizes/niche-filling.stdout @@ -0,0 +1,80 @@ +print-type-size type: `IndirectNonZero<u32>`: 12 bytes, alignment: 4 bytes +print-type-size field `.nested`: 8 bytes +print-type-size field `.post`: 2 bytes +print-type-size field `.pre`: 1 bytes +print-type-size end padding: 1 bytes +print-type-size type: `MyOption<IndirectNonZero<u32>>`: 12 bytes, alignment: 4 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Some`: 12 bytes +print-type-size field `.0`: 12 bytes +print-type-size type: `EmbeddedDiscr`: 8 bytes, alignment: 4 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Record`: 7 bytes +print-type-size field `.val`: 4 bytes +print-type-size field `.post`: 2 bytes +print-type-size field `.pre`: 1 bytes +print-type-size end padding: 1 bytes +print-type-size type: `NestedNonZero<u32>`: 8 bytes, alignment: 4 bytes +print-type-size field `.val`: 4 bytes +print-type-size field `.post`: 2 bytes +print-type-size field `.pre`: 1 bytes +print-type-size end padding: 1 bytes +print-type-size type: `Enum4<(), char, (), ()>`: 4 bytes, alignment: 4 bytes +print-type-size variant `One`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Two`: 4 bytes +print-type-size field `.0`: 4 bytes +print-type-size variant `Three`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Four`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size type: `MyOption<char>`: 4 bytes, alignment: 4 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Some`: 4 bytes +print-type-size field `.0`: 4 bytes +print-type-size type: `MyOption<core::nonzero::NonZero<u32>>`: 4 bytes, alignment: 4 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Some`: 4 bytes +print-type-size field `.0`: 4 bytes +print-type-size type: `core::nonzero::NonZero<u32>`: 4 bytes, alignment: 4 bytes +print-type-size field `.0`: 4 bytes +print-type-size type: `Enum4<(), (), (), MyOption<u8>>`: 2 bytes, alignment: 1 bytes +print-type-size variant `One`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Two`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Three`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Four`: 2 bytes +print-type-size field `.0`: 2 bytes +print-type-size type: `MyOption<MyOption<u8>>`: 2 bytes, alignment: 1 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Some`: 2 bytes +print-type-size field `.0`: 2 bytes +print-type-size type: `MyOption<u8>`: 2 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Some`: 1 bytes +print-type-size field `.0`: 1 bytes +print-type-size type: `Enum4<(), (), bool, ()>`: 1 bytes, alignment: 1 bytes +print-type-size variant `One`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Two`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Three`: 1 bytes +print-type-size field `.0`: 1 bytes +print-type-size variant `Four`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size type: `MyOption<bool>`: 1 bytes, alignment: 1 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Some`: 1 bytes +print-type-size field `.0`: 1 bytes +print-type-size type: `MyOption<std::cmp::Ordering>`: 1 bytes, alignment: 1 bytes +print-type-size variant `None`: 0 bytes +print-type-size variant `Some`: 1 bytes +print-type-size field `.0`: 1 bytes +print-type-size type: `std::cmp::Ordering`: 1 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Less`: 0 bytes +print-type-size variant `Equal`: 0 bytes +print-type-size variant `Greater`: 0 bytes diff --git a/src/test/ui/print_type_sizes/no_duplicates.rs b/src/test/ui/print_type_sizes/no_duplicates.rs index 6008a346c0..d9b9026036 100644 --- a/src/test/ui/print_type_sizes/no_duplicates.rs +++ b/src/test/ui/print_type_sizes/no_duplicates.rs @@ -9,17 +9,22 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates that when the same type occurs repeatedly // (even if multiple functions), it is only printed once in the // print-type-sizes output. +#![feature(start)] + pub struct SevenBytes([u8; 7]); pub fn f1() { let _s: SevenBytes = SevenBytes([0; 7]); } -pub fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _s: SevenBytes = SevenBytes([0; 7]); + 0 } diff --git a/src/test/ui/print_type_sizes/nullable.stdout b/src/test/ui/print_type_sizes/nullable.stdout deleted file mode 100644 index 830678f174..0000000000 --- a/src/test/ui/print_type_sizes/nullable.stdout +++ /dev/null @@ -1,24 +0,0 @@ -print-type-size type: `IndirectNonZero<u32>`: 12 bytes, alignment: 4 bytes -print-type-size field `.nested`: 8 bytes -print-type-size field `.post`: 2 bytes -print-type-size field `.pre`: 1 bytes -print-type-size end padding: 1 bytes -print-type-size type: `MyOption<IndirectNonZero<u32>>`: 12 bytes, alignment: 4 bytes -print-type-size variant `Some`: 12 bytes -print-type-size field `.0`: 12 bytes -print-type-size type: `EmbeddedDiscr`: 8 bytes, alignment: 4 bytes -print-type-size variant `Record`: 7 bytes -print-type-size field `.val`: 4 bytes -print-type-size field `.post`: 2 bytes -print-type-size field `.pre`: 1 bytes -print-type-size end padding: 1 bytes -print-type-size type: `NestedNonZero<u32>`: 8 bytes, alignment: 4 bytes -print-type-size field `.val`: 4 bytes -print-type-size field `.post`: 2 bytes -print-type-size field `.pre`: 1 bytes -print-type-size end padding: 1 bytes -print-type-size type: `MyOption<core::nonzero::NonZero<u32>>`: 4 bytes, alignment: 4 bytes -print-type-size variant `Some`: 4 bytes -print-type-size field `.0`: 4 bytes -print-type-size type: `core::nonzero::NonZero<u32>`: 4 bytes, alignment: 4 bytes -print-type-size field `.0`: 4 bytes diff --git a/src/test/ui/print_type_sizes/packed.rs b/src/test/ui/print_type_sizes/packed.rs index 7f278e71b2..a4288f6789 100644 --- a/src/test/ui/print_type_sizes/packed.rs +++ b/src/test/ui/print_type_sizes/packed.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how packing is handled; it should cause // the elimination of padding that would normally be introduced @@ -19,6 +20,7 @@ // padding and overall computed sizes can be quite different. #![allow(dead_code)] +#![feature(start)] #[derive(Default)] #[repr(packed)] @@ -41,7 +43,9 @@ struct Padded { d: u8, } -pub fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _c: Packed = Default::default(); let _d: Padded = Default::default(); + 0 } diff --git a/src/test/ui/print_type_sizes/packed.stderr b/src/test/ui/print_type_sizes/packed.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/print_type_sizes/padding.rs b/src/test/ui/print_type_sizes/padding.rs index af34a908ce..b4661efdd2 100644 --- a/src/test/ui/print_type_sizes/padding.rs +++ b/src/test/ui/print_type_sizes/padding.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how padding is handled: alignment // requirements can lead to the introduction of padding, either before @@ -18,6 +19,7 @@ // aligned (while on most it is 8-byte aligned) and so the resulting // padding and overall computed sizes can be quite different. +#![feature(start)] #![allow(dead_code)] struct S { @@ -36,4 +38,7 @@ enum E2 { B(S), } -fn main() { } +#[start] +fn start(_: isize, _: *const *const u8) -> isize { + 0 +} diff --git a/src/test/ui/print_type_sizes/repr-align.rs b/src/test/ui/print_type_sizes/repr-align.rs index e9b43145de..108b8dbba0 100644 --- a/src/test/ui/print_type_sizes/repr-align.rs +++ b/src/test/ui/print_type_sizes/repr-align.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how padding is handled: alignment // requirements can lead to the introduction of padding, either before @@ -19,6 +20,7 @@ // padding and overall computed sizes can be quite different. #![feature(attr_literals)] #![feature(repr_align)] +#![feature(start)] #![allow(dead_code)] #[repr(align(16))] @@ -38,6 +40,8 @@ struct S { d: i8, } -fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _s: S = Default::default(); + 0 } diff --git a/src/test/ui/print_type_sizes/repr-align.stderr b/src/test/ui/print_type_sizes/repr-align.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/test/ui/print_type_sizes/uninhabited.rs b/src/test/ui/print_type_sizes/uninhabited.rs new file mode 100644 index 0000000000..4d0396903e --- /dev/null +++ b/src/test/ui/print_type_sizes/uninhabited.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z print-type-sizes +// must-compile-successfully + +#![feature(never_type)] +#![feature(start)] + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { + let _x: Option<!> = None; + let _y: Result<u32, !> = Ok(42); + 0 +} diff --git a/src/test/ui/print_type_sizes/uninhabited.stdout b/src/test/ui/print_type_sizes/uninhabited.stdout new file mode 100644 index 0000000000..2a8706f7ac --- /dev/null +++ b/src/test/ui/print_type_sizes/uninhabited.stdout @@ -0,0 +1,5 @@ +print-type-size type: `std::result::Result<u32, !>`: 4 bytes, alignment: 4 bytes +print-type-size variant `Ok`: 4 bytes +print-type-size field `.0`: 4 bytes +print-type-size type: `std::option::Option<!>`: 0 bytes, alignment: 1 bytes +print-type-size variant `None`: 0 bytes diff --git a/src/test/ui/print_type_sizes/variants.rs b/src/test/ui/print_type_sizes/variants.rs index 875edb4515..e4d54162e7 100644 --- a/src/test/ui/print_type_sizes/variants.rs +++ b/src/test/ui/print_type_sizes/variants.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates two things: // @@ -18,6 +19,8 @@ // 2. For an enum, the print-type-sizes output will also include the // size of each variant. +#![feature(start)] + pub struct SevenBytes([u8; 7]); pub struct FiftyBytes([u8; 50]); @@ -26,6 +29,8 @@ pub enum Enum { Large(FiftyBytes), } -pub fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _e: Enum; + 0 } diff --git a/src/test/ui/pub/pub-restricted-error-fn.rs b/src/test/ui/pub/pub-restricted-error-fn.rs index 1351431037..58f3d379ed 100644 --- a/src/test/ui/pub/pub-restricted-error-fn.rs +++ b/src/test/ui/pub/pub-restricted-error-fn.rs @@ -10,4 +10,4 @@ #![feature(pub_restricted)] -pub(crate) () fn foo() {} +pub(crate) () fn foo() {} //~ unmatched visibility diff --git a/src/test/ui/pub/pub-restricted-error-fn.stderr b/src/test/ui/pub/pub-restricted-error-fn.stderr index 470e833124..9cfc3968ab 100644 --- a/src/test/ui/pub/pub-restricted-error-fn.stderr +++ b/src/test/ui/pub/pub-restricted-error-fn.stderr @@ -1,7 +1,7 @@ error: unmatched visibility `pub` --> $DIR/pub-restricted-error-fn.rs:13:10 | -13 | pub(crate) () fn foo() {} +13 | pub(crate) () fn foo() {} //~ unmatched visibility | ^ error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted-error.rs b/src/test/ui/pub/pub-restricted-error.rs index 99af031899..4822d01a59 100644 --- a/src/test/ui/pub/pub-restricted-error.rs +++ b/src/test/ui/pub/pub-restricted-error.rs @@ -13,7 +13,7 @@ struct Bar(pub(())); struct Foo { - pub(crate) () foo: usize, + pub(crate) () foo: usize, //~ ERROR expected identifier } - +fn main() {} diff --git a/src/test/ui/pub/pub-restricted-error.stderr b/src/test/ui/pub/pub-restricted-error.stderr index b8b4c80778..cbf206e6ae 100644 --- a/src/test/ui/pub/pub-restricted-error.stderr +++ b/src/test/ui/pub/pub-restricted-error.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `(` --> $DIR/pub-restricted-error.rs:16:16 | -16 | pub(crate) () foo: usize, +16 | pub(crate) () foo: usize, //~ ERROR expected identifier | ^ error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted-non-path.rs b/src/test/ui/pub/pub-restricted-non-path.rs index 3f74285717..11428b778e 100644 --- a/src/test/ui/pub/pub-restricted-non-path.rs +++ b/src/test/ui/pub/pub-restricted-non-path.rs @@ -10,6 +10,6 @@ #![feature(pub_restricted)] -pub (.) fn afn() {} +pub (.) fn afn() {} //~ ERROR expected identifier fn main() {} diff --git a/src/test/ui/pub/pub-restricted-non-path.stderr b/src/test/ui/pub/pub-restricted-non-path.stderr index ebfccc4d72..b76e87840c 100644 --- a/src/test/ui/pub/pub-restricted-non-path.stderr +++ b/src/test/ui/pub/pub-restricted-non-path.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `.` --> $DIR/pub-restricted-non-path.rs:13:6 | -13 | pub (.) fn afn() {} +13 | pub (.) fn afn() {} //~ ERROR expected identifier | ^ error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted.rs b/src/test/ui/pub/pub-restricted.rs index 934ad24c16..07184d935b 100644 --- a/src/test/ui/pub/pub-restricted.rs +++ b/src/test/ui/pub/pub-restricted.rs @@ -12,8 +12,8 @@ mod a {} -pub (a) fn afn() {} -pub (b) fn bfn() {} +pub (a) fn afn() {} //~ incorrect visibility restriction +pub (b) fn bfn() {} //~ incorrect visibility restriction pub fn privfn() {} mod x { mod y { @@ -29,8 +29,8 @@ mod y { pub (super) s: usize, valid_private: usize, pub (in y) valid_in_x: usize, - pub (a) invalid: usize, - pub (in x) non_parent_invalid: usize, + pub (a) invalid: usize, //~ incorrect visibility restriction + pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted } } @@ -38,4 +38,4 @@ fn main() {} // test multichar names mod xyz {} -pub (xyz) fn xyz() {} +pub (xyz) fn xyz() {} //~ incorrect visibility restriction diff --git a/src/test/ui/pub/pub-restricted.stderr b/src/test/ui/pub/pub-restricted.stderr index ae283f1fb6..0bedcddc0b 100644 --- a/src/test/ui/pub/pub-restricted.stderr +++ b/src/test/ui/pub/pub-restricted.stderr @@ -1,7 +1,7 @@ error: incorrect visibility restriction --> $DIR/pub-restricted.rs:15:6 | -15 | pub (a) fn afn() {} +15 | pub (a) fn afn() {} //~ incorrect visibility restriction | ^ help: make this visible only to module `a` with `in`: `in a` | = help: some possible visibility restrictions are: @@ -12,7 +12,7 @@ error: incorrect visibility restriction error: incorrect visibility restriction --> $DIR/pub-restricted.rs:16:6 | -16 | pub (b) fn bfn() {} +16 | pub (b) fn bfn() {} //~ incorrect visibility restriction | ^ help: make this visible only to module `b` with `in`: `in b` | = help: some possible visibility restrictions are: @@ -23,7 +23,7 @@ error: incorrect visibility restriction error: incorrect visibility restriction --> $DIR/pub-restricted.rs:32:14 | -32 | pub (a) invalid: usize, +32 | pub (a) invalid: usize, //~ incorrect visibility restriction | ^ help: make this visible only to module `a` with `in`: `in a` | = help: some possible visibility restrictions are: @@ -34,7 +34,7 @@ error: incorrect visibility restriction error: incorrect visibility restriction --> $DIR/pub-restricted.rs:41:6 | -41 | pub (xyz) fn xyz() {} +41 | pub (xyz) fn xyz() {} //~ incorrect visibility restriction | ^^^ help: make this visible only to module `xyz` with `in`: `in xyz` | = help: some possible visibility restrictions are: @@ -45,7 +45,7 @@ error: incorrect visibility restriction error: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:33:17 | -33 | pub (in x) non_parent_invalid: usize, +33 | pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted | ^ error: aborting due to 5 previous errors diff --git a/src/test/compile-fail/qualified-path-params-2.rs b/src/test/ui/qualified-path-params-2.rs similarity index 84% rename from src/test/compile-fail/qualified-path-params-2.rs rename to src/test/ui/qualified-path-params-2.rs index e685ebc272..b0dd1f2518 100644 --- a/src/test/compile-fail/qualified-path-params-2.rs +++ b/src/test/ui/qualified-path-params-2.rs @@ -27,9 +27,6 @@ impl S { type A = <S as Tr>::A::f<u8>; //~^ ERROR type parameters are not allowed on this type -//~| NOTE type parameter not allowed //~| ERROR ambiguous associated type -//~| NOTE ambiguous associated type -//~| NOTE specify the type using the syntax `<<S as Tr>::A as Trait>::f` fn main() {} diff --git a/src/test/ui/qualified-path-params-2.stderr b/src/test/ui/qualified-path-params-2.stderr new file mode 100644 index 0000000000..35a9698451 --- /dev/null +++ b/src/test/ui/qualified-path-params-2.stderr @@ -0,0 +1,16 @@ +error[E0109]: type parameters are not allowed on this type + --> $DIR/qualified-path-params-2.rs:28:26 + | +28 | type A = <S as Tr>::A::f<u8>; + | ^^ type parameter not allowed + +error[E0223]: ambiguous associated type + --> $DIR/qualified-path-params-2.rs:28:10 + | +28 | type A = <S as Tr>::A::f<u8>; + | ^^^^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<<S as Tr>::A as Trait>::f` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/reachable/expr_add.rs b/src/test/ui/reachable/expr_add.rs index 87d017adf6..dd43c58de6 100644 --- a/src/test/ui/reachable/expr_add.rs +++ b/src/test/ui/reachable/expr_add.rs @@ -24,5 +24,5 @@ impl ops::Add<!> for Foo { } fn main() { - let x = Foo + return; + let x = Foo + return; //~ ERROR unreachable } diff --git a/src/test/ui/reachable/expr_add.stderr b/src/test/ui/reachable/expr_add.stderr index 1a2cc25205..4ae286d2ff 100644 --- a/src/test/ui/reachable/expr_add.stderr +++ b/src/test/ui/reachable/expr_add.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_add.rs:27:13 | -27 | let x = Foo + return; +27 | let x = Foo + return; //~ ERROR unreachable | ^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_again.stderr b/src/test/ui/reachable/expr_again.stderr index bf4e4dc471..152c96e52b 100644 --- a/src/test/ui/reachable/expr_again.stderr +++ b/src/test/ui/reachable/expr_again.stderr @@ -9,7 +9,7 @@ note: lint level defined here | 13 | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/reachable/expr_andand.rs b/src/test/ui/reachable/expr_andand.rs index af404d0309..7d74daaa6e 100644 --- a/src/test/ui/reachable/expr_andand.rs +++ b/src/test/ui/reachable/expr_andand.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![allow(unused_variables)] #![allow(dead_code)] #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_array.rs b/src/test/ui/reachable/expr_array.rs index 00e8be0772..3122966879 100644 --- a/src/test/ui/reachable/expr_array.rs +++ b/src/test/ui/reachable/expr_array.rs @@ -17,12 +17,12 @@ fn a() { // the `22` is unreachable: - let x: [usize; 2] = [return, 22]; + let x: [usize; 2] = [return, 22]; //~ ERROR unreachable } fn b() { // the `array is unreachable: - let x: [usize; 2] = [22, return]; + let x: [usize; 2] = [22, return]; //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_array.stderr b/src/test/ui/reachable/expr_array.stderr index f8dbdb5f8b..0f64d15850 100644 --- a/src/test/ui/reachable/expr_array.stderr +++ b/src/test/ui/reachable/expr_array.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_array.rs:20:34 | -20 | let x: [usize; 2] = [return, 22]; +20 | let x: [usize; 2] = [return, 22]; //~ ERROR unreachable | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ note: lint level defined here error: unreachable expression --> $DIR/expr_array.rs:25:25 | -25 | let x: [usize; 2] = [22, return]; +25 | let x: [usize; 2] = [22, return]; //~ ERROR unreachable | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_assign.rs b/src/test/ui/reachable/expr_assign.rs index 1b9357013d..e6fb46a5ba 100644 --- a/src/test/ui/reachable/expr_assign.rs +++ b/src/test/ui/reachable/expr_assign.rs @@ -17,7 +17,7 @@ fn foo() { // No error here. let x; - x = return; + x = return; //~ ERROR unreachable } fn bar() { @@ -27,13 +27,13 @@ fn bar() { // Here we consider the `return` unreachable because // "evaluating" the `*p` has type `!`. This is somewhat // dubious, I suppose. - *p = return; + *p = return; //~ ERROR unreachable } } fn baz() { let mut i = 0; - *{return; &mut i} = 22; + *{return; &mut i} = 22; //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_assign.stderr b/src/test/ui/reachable/expr_assign.stderr index 807f6a1c1d..42c00d5a8b 100644 --- a/src/test/ui/reachable/expr_assign.stderr +++ b/src/test/ui/reachable/expr_assign.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_assign.rs:20:5 | -20 | x = return; +20 | x = return; //~ ERROR unreachable | ^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ note: lint level defined here error: unreachable expression --> $DIR/expr_assign.rs:30:14 | -30 | *p = return; +30 | *p = return; //~ ERROR unreachable | ^^^^^^ error: unreachable expression --> $DIR/expr_assign.rs:36:15 | -36 | *{return; &mut i} = 22; +36 | *{return; &mut i} = 22; //~ ERROR unreachable | ^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/reachable/expr_block.rs b/src/test/ui/reachable/expr_block.rs index 093589b4dc..57b5d3cabc 100644 --- a/src/test/ui/reachable/expr_block.rs +++ b/src/test/ui/reachable/expr_block.rs @@ -18,7 +18,7 @@ fn a() { // Here the tail expression is considered unreachable: let x = { return; - 22 + 22 //~ ERROR unreachable }; } diff --git a/src/test/ui/reachable/expr_block.stderr b/src/test/ui/reachable/expr_block.stderr index 542ce1c3fd..4c08be524f 100644 --- a/src/test/ui/reachable/expr_block.stderr +++ b/src/test/ui/reachable/expr_block.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_block.rs:21:9 | -21 | 22 +21 | 22 //~ ERROR unreachable | ^^ | note: lint level defined here @@ -16,7 +16,7 @@ error: unreachable statement 36 | println!("foo"); | ^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_box.rs b/src/test/ui/reachable/expr_box.rs index 6509b60833..ab62cbdf83 100644 --- a/src/test/ui/reachable/expr_box.rs +++ b/src/test/ui/reachable/expr_box.rs @@ -13,6 +13,6 @@ #![deny(unreachable_code)] fn main() { - let x = box return; + let x = box return; //~ ERROR unreachable println!("hi"); } diff --git a/src/test/ui/reachable/expr_box.stderr b/src/test/ui/reachable/expr_box.stderr index 78ba231cef..d8b5d9f8d7 100644 --- a/src/test/ui/reachable/expr_box.stderr +++ b/src/test/ui/reachable/expr_box.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_box.rs:16:13 | -16 | let x = box return; +16 | let x = box return; //~ ERROR unreachable | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_call.rs b/src/test/ui/reachable/expr_call.rs index 8d9f303df7..86b95aad9c 100644 --- a/src/test/ui/reachable/expr_call.rs +++ b/src/test/ui/reachable/expr_call.rs @@ -20,12 +20,12 @@ fn bar(x: !) { } fn a() { // the `22` is unreachable: - foo(return, 22); + foo(return, 22); //~ ERROR unreachable } fn b() { // the call is unreachable: - bar(return); + bar(return); //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_call.stderr b/src/test/ui/reachable/expr_call.stderr index 5526827f59..eaafe8dc5d 100644 --- a/src/test/ui/reachable/expr_call.stderr +++ b/src/test/ui/reachable/expr_call.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_call.rs:23:17 | -23 | foo(return, 22); +23 | foo(return, 22); //~ ERROR unreachable | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ note: lint level defined here error: unreachable expression --> $DIR/expr_call.rs:28:5 | -28 | bar(return); +28 | bar(return); //~ ERROR unreachable | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_cast.rs b/src/test/ui/reachable/expr_cast.rs index 926ef864eb..76b00c00ad 100644 --- a/src/test/ui/reachable/expr_cast.rs +++ b/src/test/ui/reachable/expr_cast.rs @@ -17,7 +17,7 @@ fn a() { // the cast is unreachable: - let x = {return} as !; + let x = {return} as !; //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_cast.stderr b/src/test/ui/reachable/expr_cast.stderr index a22300dcc1..d6fb37768c 100644 --- a/src/test/ui/reachable/expr_cast.stderr +++ b/src/test/ui/reachable/expr_cast.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_cast.rs:20:13 | -20 | let x = {return} as !; +20 | let x = {return} as !; //~ ERROR unreachable | ^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_if.stderr b/src/test/ui/reachable/expr_if.stderr index 2cf17474f6..b8f3f494c5 100644 --- a/src/test/ui/reachable/expr_if.stderr +++ b/src/test/ui/reachable/expr_if.stderr @@ -9,7 +9,7 @@ note: lint level defined here | 14 | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/reachable/expr_loop.stderr b/src/test/ui/reachable/expr_loop.stderr index 6e98e754c5..ce4b30c798 100644 --- a/src/test/ui/reachable/expr_loop.stderr +++ b/src/test/ui/reachable/expr_loop.stderr @@ -9,7 +9,7 @@ note: lint level defined here | 14 | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement --> $DIR/expr_loop.rs:31:5 @@ -17,7 +17,7 @@ error: unreachable statement 31 | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement --> $DIR/expr_loop.rs:41:5 @@ -25,7 +25,7 @@ error: unreachable statement 41 | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/reachable/expr_match.rs b/src/test/ui/reachable/expr_match.rs index 23bdcc035b..d2b96e51a9 100644 --- a/src/test/ui/reachable/expr_match.rs +++ b/src/test/ui/reachable/expr_match.rs @@ -17,7 +17,7 @@ fn a() { // The match is considered unreachable here, because the `return` // diverges: - match {return} { } + match {return} { } //~ ERROR unreachable } fn b() { diff --git a/src/test/ui/reachable/expr_match.stderr b/src/test/ui/reachable/expr_match.stderr index f5857a5b34..499beac644 100644 --- a/src/test/ui/reachable/expr_match.stderr +++ b/src/test/ui/reachable/expr_match.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_match.rs:20:5 | -20 | match {return} { } +20 | match {return} { } //~ ERROR unreachable | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -16,7 +16,7 @@ error: unreachable statement 25 | println!("I am dead"); | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement --> $DIR/expr_match.rs:35:5 @@ -24,7 +24,7 @@ error: unreachable statement 35 | println!("I am dead"); | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/reachable/expr_method.rs b/src/test/ui/reachable/expr_method.rs index f1d979d7df..8be71e464b 100644 --- a/src/test/ui/reachable/expr_method.rs +++ b/src/test/ui/reachable/expr_method.rs @@ -23,12 +23,12 @@ impl Foo { fn a() { // the `22` is unreachable: - Foo.foo(return, 22); + Foo.foo(return, 22); //~ ERROR unreachable } fn b() { // the call is unreachable: - Foo.bar(return); + Foo.bar(return); //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_method.stderr b/src/test/ui/reachable/expr_method.stderr index 177d4352a3..db9d5c3d22 100644 --- a/src/test/ui/reachable/expr_method.stderr +++ b/src/test/ui/reachable/expr_method.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_method.rs:26:21 | -26 | Foo.foo(return, 22); +26 | Foo.foo(return, 22); //~ ERROR unreachable | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ note: lint level defined here error: unreachable expression --> $DIR/expr_method.rs:31:5 | -31 | Foo.bar(return); +31 | Foo.bar(return); //~ ERROR unreachable | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_oror.rs b/src/test/ui/reachable/expr_oror.rs index d01304d403..ab0b71f078 100644 --- a/src/test/ui/reachable/expr_oror.rs +++ b/src/test/ui/reachable/expr_oror.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![allow(unused_variables)] #![allow(dead_code)] #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_repeat.rs b/src/test/ui/reachable/expr_repeat.rs index 6078d6d5bd..47ee2ba62b 100644 --- a/src/test/ui/reachable/expr_repeat.rs +++ b/src/test/ui/reachable/expr_repeat.rs @@ -17,7 +17,7 @@ fn a() { // the repeat is unreachable: - let x: [usize; 2] = [return; 2]; + let x: [usize; 2] = [return; 2]; //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_repeat.stderr b/src/test/ui/reachable/expr_repeat.stderr index 19afc5dd7b..54b29b616f 100644 --- a/src/test/ui/reachable/expr_repeat.stderr +++ b/src/test/ui/reachable/expr_repeat.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_repeat.rs:20:25 | -20 | let x: [usize; 2] = [return; 2]; +20 | let x: [usize; 2] = [return; 2]; //~ ERROR unreachable | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_return.rs b/src/test/ui/reachable/expr_return.rs index c640ca0663..fac1116dc6 100644 --- a/src/test/ui/reachable/expr_return.rs +++ b/src/test/ui/reachable/expr_return.rs @@ -18,7 +18,7 @@ fn a() { // Here we issue that the "2nd-innermost" return is unreachable, // but we stop there. - let x = {return {return {return;}}}; + let x = {return {return {return;}}}; //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_return.stderr b/src/test/ui/reachable/expr_return.stderr index 3eb70a4dd7..a96def6011 100644 --- a/src/test/ui/reachable/expr_return.stderr +++ b/src/test/ui/reachable/expr_return.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_return.rs:21:22 | -21 | let x = {return {return {return;}}}; +21 | let x = {return {return {return;}}}; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_struct.rs b/src/test/ui/reachable/expr_struct.rs index 09e3181927..b5acd395be 100644 --- a/src/test/ui/reachable/expr_struct.rs +++ b/src/test/ui/reachable/expr_struct.rs @@ -22,22 +22,22 @@ struct Foo { fn a() { // struct expr is unreachable: - let x = Foo { a: 22, b: 33, ..return }; + let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable } fn b() { // the `33` is unreachable: - let x = Foo { a: return, b: 33, ..return }; + let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable } fn c() { // the `..return` is unreachable: - let x = Foo { a: 22, b: return, ..return }; + let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable } fn d() { // the struct expr is unreachable: - let x = Foo { a: 22, b: return }; + let x = Foo { a: 22, b: return }; //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_struct.stderr b/src/test/ui/reachable/expr_struct.stderr index 4b7ac66041..b2cb1ef19c 100644 --- a/src/test/ui/reachable/expr_struct.stderr +++ b/src/test/ui/reachable/expr_struct.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_struct.rs:25:13 | -25 | let x = Foo { a: 22, b: 33, ..return }; +25 | let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ note: lint level defined here error: unreachable expression --> $DIR/expr_struct.rs:30:33 | -30 | let x = Foo { a: return, b: 33, ..return }; +30 | let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable | ^^ error: unreachable expression --> $DIR/expr_struct.rs:35:39 | -35 | let x = Foo { a: 22, b: return, ..return }; +35 | let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable | ^^^^^^ error: unreachable expression --> $DIR/expr_struct.rs:40:13 | -40 | let x = Foo { a: 22, b: return }; +40 | let x = Foo { a: 22, b: return }; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/reachable/expr_tup.rs b/src/test/ui/reachable/expr_tup.rs index 7c75296de6..089020bf38 100644 --- a/src/test/ui/reachable/expr_tup.rs +++ b/src/test/ui/reachable/expr_tup.rs @@ -17,12 +17,12 @@ fn a() { // the `2` is unreachable: - let x: (usize, usize) = (return, 2); + let x: (usize, usize) = (return, 2); //~ ERROR unreachable } fn b() { // the tuple is unreachable: - let x: (usize, usize) = (2, return); + let x: (usize, usize) = (2, return); //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_tup.stderr b/src/test/ui/reachable/expr_tup.stderr index 63f477fd0c..af43162a98 100644 --- a/src/test/ui/reachable/expr_tup.stderr +++ b/src/test/ui/reachable/expr_tup.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_tup.rs:20:38 | -20 | let x: (usize, usize) = (return, 2); +20 | let x: (usize, usize) = (return, 2); //~ ERROR unreachable | ^ | note: lint level defined here @@ -13,7 +13,7 @@ note: lint level defined here error: unreachable expression --> $DIR/expr_tup.rs:25:29 | -25 | let x: (usize, usize) = (2, return); +25 | let x: (usize, usize) = (2, return); //~ ERROR unreachable | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_type.rs b/src/test/ui/reachable/expr_type.rs index 2fa277c382..29c59d5304 100644 --- a/src/test/ui/reachable/expr_type.rs +++ b/src/test/ui/reachable/expr_type.rs @@ -17,7 +17,7 @@ fn a() { // the cast is unreachable: - let x = {return}: !; + let x = {return}: !; //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_type.stderr b/src/test/ui/reachable/expr_type.stderr index 6ed79974cc..d6bcb4ec80 100644 --- a/src/test/ui/reachable/expr_type.stderr +++ b/src/test/ui/reachable/expr_type.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_type.rs:20:13 | -20 | let x = {return}: !; +20 | let x = {return}: !; //~ ERROR unreachable | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_unary.rs b/src/test/ui/reachable/expr_unary.rs index 57901fbaa7..ad12cb876f 100644 --- a/src/test/ui/reachable/expr_unary.rs +++ b/src/test/ui/reachable/expr_unary.rs @@ -12,10 +12,14 @@ #![allow(unused_assignments)] #![allow(dead_code)] #![deny(unreachable_code)] +#![deny(coerce_never)] #![feature(never_type)] fn foo() { - let x: ! = ! { return; 22 }; + let x: ! = ! { return; 22 }; //~ ERROR unreachable + //~^ ERROR cannot coerce + //~| hard error + //~| ERROR cannot apply unary operator `!` to type `!` } fn main() { } diff --git a/src/test/ui/reachable/expr_unary.stderr b/src/test/ui/reachable/expr_unary.stderr index 9f4562fe29..39120f0bdf 100644 --- a/src/test/ui/reachable/expr_unary.stderr +++ b/src/test/ui/reachable/expr_unary.stderr @@ -1,7 +1,7 @@ error: unreachable expression - --> $DIR/expr_unary.rs:18:28 + --> $DIR/expr_unary.rs:19:28 | -18 | let x: ! = ! { return; 22 }; +19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable | ^^ | note: lint level defined here @@ -10,11 +10,25 @@ note: lint level defined here 14 | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ -error[E0600]: cannot apply unary operator `!` to type `!` - --> $DIR/expr_unary.rs:18:16 +error: cannot coerce `{integer}` to ! + --> $DIR/expr_unary.rs:19:28 | -18 | let x: ! = ! { return; 22 }; +19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable + | ^^ + | +note: lint level defined here + --> $DIR/expr_unary.rs:15:9 + | +15 | #![deny(coerce_never)] + | ^^^^^^^^^^^^ + = 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 #46325 <https://github.com/rust-lang/rust/issues/46325> + +error[E0600]: cannot apply unary operator `!` to type `!` + --> $DIR/expr_unary.rs:19:16 + | +19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/reachable/expr_while.stderr b/src/test/ui/reachable/expr_while.stderr index 066cfc86c6..3610982698 100644 --- a/src/test/ui/reachable/expr_while.stderr +++ b/src/test/ui/reachable/expr_while.stderr @@ -9,7 +9,7 @@ note: lint level defined here | 14 | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement --> $DIR/expr_while.rs:33:9 @@ -17,7 +17,7 @@ error: unreachable statement 33 | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement --> $DIR/expr_while.rs:35:5 @@ -25,7 +25,7 @@ error: unreachable statement 35 | println!("I am, too."); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs b/src/test/ui/region-borrow-params-issue-29793-small.rs similarity index 73% rename from src/test/compile-fail/region-borrow-params-issue-29793-small.rs rename to src/test/ui/region-borrow-params-issue-29793-small.rs index 18206a6851..4fda8ec3f3 100644 --- a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs +++ b/src/test/ui/region-borrow-params-issue-29793-small.rs @@ -19,16 +19,8 @@ fn escaping_borrow_of_closure_params_1() { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR `x` does not live long enough //~| ERROR `y` does not live long enough - //~| NOTE capture occurs here - //~| NOTE capture occurs here - //~| NOTE does not live long enough - //~| NOTE does not live long enough - //~| NOTE values in a scope are dropped in the opposite order they are created - //~| NOTE values in a scope are dropped in the opposite order they are created return f; }; - //~^ NOTE borrowed value dropped before borrower - //~| NOTE borrowed value dropped before borrower // We delberately do not call `g`; this small version of the test, // after adding such a call, was (properly) rejected even when the @@ -42,16 +34,8 @@ fn escaping_borrow_of_closure_params_2() { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR `x` does not live long enough //~| ERROR `y` does not live long enough - //~| NOTE capture occurs here - //~| NOTE capture occurs here - //~| NOTE does not live long enough - //~| NOTE does not live long enough - //~| NOTE values in a scope are dropped in the opposite order they are created - //~| NOTE values in a scope are dropped in the opposite order they are created f }; - //~^ NOTE borrowed value dropped before borrower - //~| NOTE borrowed value dropped before borrower // (we don't call `g`; see above) } @@ -80,11 +64,7 @@ fn escaping_borrow_of_fn_params_1() { fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); }; @@ -95,11 +75,7 @@ fn escaping_borrow_of_fn_params_2() { fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) }; @@ -123,11 +99,7 @@ fn escaping_borrow_of_method_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -141,11 +113,7 @@ fn escaping_borrow_of_method_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) } } @@ -173,11 +141,7 @@ fn escaping_borrow_of_trait_impl_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -192,11 +156,7 @@ fn escaping_borrow_of_trait_impl_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) } } @@ -224,11 +184,7 @@ fn escaping_borrow_of_trait_default_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -242,11 +198,7 @@ fn escaping_borrow_of_trait_default_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) } } diff --git a/src/test/ui/region-borrow-params-issue-29793-small.stderr b/src/test/ui/region-borrow-params-issue-29793-small.stderr new file mode 100644 index 0000000000..7cdea5b0bd --- /dev/null +++ b/src/test/ui/region-borrow-params-issue-29793-small.stderr @@ -0,0 +1,246 @@ +error[E0597]: `x` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:19:34 + | +19 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ borrowed value does not live long enough + | | + | capture occurs here +... +23 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0597]: `y` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:19:45 + | +19 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ borrowed value does not live long enough + | | + | capture occurs here +... +23 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0597]: `x` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:34:34 + | +34 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ borrowed value does not live long enough + | | + | capture occurs here +... +38 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0597]: `y` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:34:45 + | +34 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ borrowed value does not live long enough + | | + | capture occurs here +... +38 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + | +65 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +65 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + | +65 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +65 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + | +76 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +76 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + | +76 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +76 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + | +100 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +100 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + | +100 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +100 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + | +114 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +114 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + | +114 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +114 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + | +142 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +142 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + | +142 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +142 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + | +157 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +157 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + | +157 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +157 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + | +185 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +185 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + | +185 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +185 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + | +199 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +199 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + | +199 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +199 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error: aborting due to 20 previous errors + diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/ui/regions-nested-fns-2.rs similarity index 87% rename from src/test/compile-fail/regions-nested-fns-2.rs rename to src/test/ui/regions-nested-fns-2.rs index 40ba34b26e..e66b62b6fb 100644 --- a/src/test/compile-fail/regions-nested-fns-2.rs +++ b/src/test/ui/regions-nested-fns-2.rs @@ -15,9 +15,7 @@ fn nested() { ignore( |z| { //~^ ERROR E0373 - //~| NOTE may outlive borrowed value `y` if false { &y } else { z } - //~^ NOTE `y` is borrowed here }); } diff --git a/src/test/ui/regions-nested-fns-2.stderr b/src/test/ui/regions-nested-fns-2.stderr new file mode 100644 index 0000000000..5f0bbf6d12 --- /dev/null +++ b/src/test/ui/regions-nested-fns-2.stderr @@ -0,0 +1,15 @@ +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/regions-nested-fns-2.rs:16:9 + | +16 | |z| { + | ^^^ may outlive borrowed value `y` +17 | //~^ ERROR E0373 +18 | if false { &y } else { z } + | - `y` is borrowed here +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +16 | move |z| { + | ^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/resolve-conflict-item-vs-import.rs b/src/test/ui/resolve-conflict-item-vs-import.rs similarity index 92% rename from src/test/compile-fail/resolve-conflict-item-vs-import.rs rename to src/test/ui/resolve-conflict-item-vs-import.rs index c91657bb46..4e74ab95d6 100644 --- a/src/test/compile-fail/resolve-conflict-item-vs-import.rs +++ b/src/test/ui/resolve-conflict-item-vs-import.rs @@ -9,7 +9,6 @@ // except according to those terms. use std::mem::transmute; -//~^ NOTE previous import of the value `transmute` here fn transmute() {} //~^ ERROR the name `transmute` is defined multiple times diff --git a/src/test/ui/resolve-conflict-item-vs-import.stderr b/src/test/ui/resolve-conflict-item-vs-import.stderr new file mode 100644 index 0000000000..03ef66681e --- /dev/null +++ b/src/test/ui/resolve-conflict-item-vs-import.stderr @@ -0,0 +1,17 @@ +error[E0255]: the name `transmute` is defined multiple times + --> $DIR/resolve-conflict-item-vs-import.rs:13:1 + | +11 | use std::mem::transmute; + | ------------------- previous import of the value `transmute` here +12 | +13 | fn transmute() {} + | ^^^^^^^^^^^^^^ `transmute` redefined here + | + = note: `transmute` must be defined only once in the value namespace of this module +help: You can use `as` to change the binding name of the import + | +11 | use std::mem::transmute as Othertransmute; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/resolve-inconsistent-names.rs b/src/test/ui/resolve-inconsistent-names.rs similarity index 74% rename from src/test/compile-fail/resolve-inconsistent-names.rs rename to src/test/ui/resolve-inconsistent-names.rs index 7fee5aedb0..79d78b4ca5 100644 --- a/src/test/compile-fail/resolve-inconsistent-names.rs +++ b/src/test/ui/resolve-inconsistent-names.rs @@ -13,9 +13,5 @@ fn main() { match y { a | b => {} //~ ERROR variable `a` is not bound in all patterns //~^ ERROR variable `b` is not bound in all patterns - //~| NOTE pattern doesn't bind `a` - //~| NOTE pattern doesn't bind `b` - //~| NOTE variable not in all patterns - //~| NOTE variable not in all patterns } } diff --git a/src/test/ui/resolve-inconsistent-names.stderr b/src/test/ui/resolve-inconsistent-names.stderr new file mode 100644 index 0000000000..8ae5a6b8a8 --- /dev/null +++ b/src/test/ui/resolve-inconsistent-names.stderr @@ -0,0 +1,18 @@ +error[E0408]: variable `a` is not bound in all patterns + --> $DIR/resolve-inconsistent-names.rs:14:12 + | +14 | a | b => {} //~ ERROR variable `a` is not bound in all patterns + | - ^ pattern doesn't bind `a` + | | + | variable not in all patterns + +error[E0408]: variable `b` is not bound in all patterns + --> $DIR/resolve-inconsistent-names.rs:14:8 + | +14 | a | b => {} //~ ERROR variable `a` is not bound in all patterns + | ^ - variable not in all patterns + | | + | pattern doesn't bind `b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.rs b/src/test/ui/resolve/enums-are-namespaced-xc.rs index 4f55f33d7f..4059aa5527 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.rs +++ b/src/test/ui/resolve/enums-are-namespaced-xc.rs @@ -13,12 +13,9 @@ extern crate namespaced_enums; fn main() { let _ = namespaced_enums::A; - //~^ ERROR unresolved value `namespaced_enums::A` - //~| HELP you can import it into scope: `use namespaced_enums::Foo::A;` + //~^ ERROR cannot find value `A` let _ = namespaced_enums::B(10); - //~^ ERROR unresolved function `namespaced_enums::B` - //~| HELP you can import it into scope: `use namespaced_enums::Foo::B;` + //~^ ERROR cannot find function `B` let _ = namespaced_enums::C { a: 10 }; - //~^ ERROR unresolved struct, variant or union type `namespaced_enums::C` - //~| HELP you can import it into scope: `use namespaced_enums::Foo::C;` + //~^ ERROR cannot find struct, variant or union type `C` } diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index 52d798a2ca..5acc678df9 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -9,9 +9,9 @@ help: possible candidate is found in another module, you can import it into scop | error[E0425]: cannot find function `B` in module `namespaced_enums` - --> $DIR/enums-are-namespaced-xc.rs:18:31 + --> $DIR/enums-are-namespaced-xc.rs:17:31 | -18 | let _ = namespaced_enums::B(10); +17 | let _ = namespaced_enums::B(10); | ^ not found in `namespaced_enums` help: possible candidate is found in another module, you can import it into scope | @@ -19,9 +19,9 @@ help: possible candidate is found in another module, you can import it into scop | error[E0422]: cannot find struct, variant or union type `C` in module `namespaced_enums` - --> $DIR/enums-are-namespaced-xc.rs:21:31 + --> $DIR/enums-are-namespaced-xc.rs:19:31 | -21 | let _ = namespaced_enums::C { a: 10 }; +19 | let _ = namespaced_enums::C { a: 10 }; | ^ not found in `namespaced_enums` help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-14254.rs b/src/test/ui/resolve/issue-14254.rs index b1fc6c4772..896085329a 100644 --- a/src/test/ui/resolve/issue-14254.rs +++ b/src/test/ui/resolve/issue-14254.rs @@ -27,111 +27,87 @@ impl BarTy { impl Foo for *const BarTy { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` a; - //~^ ERROR unresolved value `a` - //~| NOTE no resolution found + //~^ ERROR cannot find value `a` } } impl<'a> Foo for &'a BarTy { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` x; - //~^ ERROR unresolved value `x` - //~| NOTE did you mean `self.x`? + //~^ ERROR cannot find value `x` y; - //~^ ERROR unresolved value `y` - //~| NOTE did you mean `self.y`? + //~^ ERROR cannot find value `y` a; - //~^ ERROR unresolved value `a` - //~| NOTE no resolution found + //~^ ERROR cannot find value `a` bah; - //~^ ERROR unresolved value `bah` - //~| NOTE did you mean `Self::bah`? + //~^ ERROR cannot find value `bah` b; - //~^ ERROR unresolved value `b` - //~| NOTE no resolution found + //~^ ERROR cannot find value `b` } } impl<'a> Foo for &'a mut BarTy { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` x; - //~^ ERROR unresolved value `x` - //~| NOTE did you mean `self.x`? + //~^ ERROR cannot find value `x` y; - //~^ ERROR unresolved value `y` - //~| NOTE did you mean `self.y`? + //~^ ERROR cannot find value `y` a; - //~^ ERROR unresolved value `a` - //~| NOTE no resolution found + //~^ ERROR cannot find value `a` bah; - //~^ ERROR unresolved value `bah` - //~| NOTE did you mean `Self::bah`? + //~^ ERROR cannot find value `bah` b; - //~^ ERROR unresolved value `b` - //~| NOTE no resolution found + //~^ ERROR cannot find value `b` } } impl Foo for Box<BarTy> { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` bah; - //~^ ERROR unresolved value `bah` - //~| NOTE did you mean `Self::bah`? + //~^ ERROR cannot find value `bah` } } impl Foo for *const isize { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` bah; - //~^ ERROR unresolved value `bah` - //~| NOTE did you mean `Self::bah`? + //~^ ERROR cannot find value `bah` } } impl<'a> Foo for &'a isize { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` bah; - //~^ ERROR unresolved value `bah` - //~| NOTE did you mean `Self::bah`? + //~^ ERROR cannot find value `bah` } } impl<'a> Foo for &'a mut isize { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` bah; - //~^ ERROR unresolved value `bah` - //~| NOTE did you mean `Self::bah`? + //~^ ERROR cannot find value `bah` } } impl Foo for Box<isize> { fn bar(&self) { baz(); - //~^ ERROR unresolved function `baz` - //~| NOTE did you mean `self.baz(...)`? + //~^ ERROR cannot find function `baz` bah; - //~^ ERROR unresolved value `bah` - //~| NOTE did you mean `Self::bah`? + //~^ ERROR cannot find value `bah` } } diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr index 7aa0c2707b..1bb5a4cab4 100644 --- a/src/test/ui/resolve/issue-14254.stderr +++ b/src/test/ui/resolve/issue-14254.stderr @@ -5,105 +5,129 @@ error[E0425]: cannot find function `baz` in this scope | ^^^ help: try: `self.baz` error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:32:9 + --> $DIR/issue-14254.rs:31:9 | -32 | a; +31 | a; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope + --> $DIR/issue-14254.rs:38:9 + | +38 | baz(); + | ^^^ help: try: `self.baz` + +error[E0425]: cannot find value `x` in this scope --> $DIR/issue-14254.rs:40:9 | -40 | baz(); - | ^^^ help: try: `self.baz` - -error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-14254.rs:43:9 - | -43 | x; +40 | x; | ^ help: try: `self.x` error[E0425]: cannot find value `y` in this scope + --> $DIR/issue-14254.rs:42:9 + | +42 | y; + | ^ help: try: `self.y` + +error[E0425]: cannot find value `a` in this scope + --> $DIR/issue-14254.rs:44:9 + | +44 | a; + | ^ not found in this scope + +error[E0425]: cannot find value `bah` in this scope --> $DIR/issue-14254.rs:46:9 | -46 | y; - | ^ help: try: `self.y` - -error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:49:9 - | -49 | a; - | ^ not found in this scope - -error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:52:9 - | -52 | bah; +46 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find value `b` in this scope - --> $DIR/issue-14254.rs:55:9 + --> $DIR/issue-14254.rs:48:9 | -55 | b; +48 | b; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:63:9 + --> $DIR/issue-14254.rs:55:9 | -63 | baz(); +55 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-14254.rs:66:9 + --> $DIR/issue-14254.rs:57:9 | -66 | x; +57 | x; | ^ help: try: `self.x` error[E0425]: cannot find value `y` in this scope - --> $DIR/issue-14254.rs:69:9 + --> $DIR/issue-14254.rs:59:9 | -69 | y; +59 | y; | ^ help: try: `self.y` error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:72:9 + --> $DIR/issue-14254.rs:61:9 | -72 | a; +61 | a; | ^ not found in this scope error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:75:9 + --> $DIR/issue-14254.rs:63:9 | -75 | bah; +63 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find value `b` in this scope - --> $DIR/issue-14254.rs:78:9 + --> $DIR/issue-14254.rs:65:9 | -78 | b; +65 | b; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:86:9 + --> $DIR/issue-14254.rs:72:9 | -86 | baz(); +72 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:89:9 + --> $DIR/issue-14254.rs:74:9 | -89 | bah; +74 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:97:9 + --> $DIR/issue-14254.rs:81:9 | -97 | baz(); +81 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:100:9 + --> $DIR/issue-14254.rs:83:9 + | +83 | bah; + | ^^^ help: try: `Self::bah` + +error[E0425]: cannot find function `baz` in this scope + --> $DIR/issue-14254.rs:90:9 + | +90 | baz(); + | ^^^ help: try: `self.baz` + +error[E0425]: cannot find value `bah` in this scope + --> $DIR/issue-14254.rs:92:9 + | +92 | bah; + | ^^^ help: try: `Self::bah` + +error[E0425]: cannot find function `baz` in this scope + --> $DIR/issue-14254.rs:99:9 + | +99 | baz(); + | ^^^ help: try: `self.baz` + +error[E0425]: cannot find value `bah` in this scope + --> $DIR/issue-14254.rs:101:9 | -100 | bah; +101 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope @@ -113,33 +137,9 @@ error[E0425]: cannot find function `baz` in this scope | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:111:9 + --> $DIR/issue-14254.rs:110:9 | -111 | bah; - | ^^^ help: try: `Self::bah` - -error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:119:9 - | -119 | baz(); - | ^^^ help: try: `self.baz` - -error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:122:9 - | -122 | bah; - | ^^^ help: try: `Self::bah` - -error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:130:9 - | -130 | baz(); - | ^^^ help: try: `self.baz` - -error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:133:9 - | -133 | bah; +110 | bah; | ^^^ help: try: `Self::bah` error[E0601]: main function not found diff --git a/src/test/ui/resolve/issue-16058.rs b/src/test/ui/resolve/issue-16058.rs index 1f777e5363..6d9df46eed 100644 --- a/src/test/ui/resolve/issue-16058.rs +++ b/src/test/ui/resolve/issue-16058.rs @@ -18,10 +18,6 @@ impl GslResult { pub fn new() -> GslResult { Result { //~^ ERROR expected struct, variant or union type, found enum `Result` -//~| HELP possible better candidates are found in other modules, you can import them into scope -//~| HELP std::fmt::Result -//~| HELP std::io::Result -//~| HELP std::thread::Result val: 0f64, err: 0f64 } diff --git a/src/test/ui/resolve/issue-17518.rs b/src/test/ui/resolve/issue-17518.rs index 3ac9b379d1..1efbd1a004 100644 --- a/src/test/ui/resolve/issue-17518.rs +++ b/src/test/ui/resolve/issue-17518.rs @@ -13,6 +13,5 @@ enum SomeEnum { } fn main() { - E { name: "foobar" }; //~ ERROR unresolved struct, variant or union type `E` - //~^ HELP you can import it into scope: `use SomeEnum::E;` + E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E` } diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index bdc4fb0d34..ffb110d5c3 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -1,7 +1,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope --> $DIR/issue-17518.rs:16:5 | -16 | E { name: "foobar" }; //~ ERROR unresolved struct, variant or union type `E` +16 | E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E` | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-21221-1.rs b/src/test/ui/resolve/issue-21221-1.rs index b1266a5af3..d3c18d4c80 100644 --- a/src/test/ui/resolve/issue-21221-1.rs +++ b/src/test/ui/resolve/issue-21221-1.rs @@ -51,11 +51,7 @@ struct Foo; // help: `std::ops::Mul` impl Mul for Foo { -//~^ ERROR unresolved trait `Mul` -//~| HELP possible candidates are found in other modules, you can import them into scope -//~| HELP `mul1::Mul` -//~| HELP `mul2::Mul` -//~| HELP `std::ops::Mul` +//~^ ERROR cannot find trait `Mul` } // BEFORE, we got: @@ -70,24 +66,17 @@ impl Mul for Foo { // help: `mul4::Mul` // help: and 2 other candidates fn getMul() -> Mul { -//~^ ERROR unresolved type `Mul` -//~| HELP possible candidates are found in other modules, you can import them into scope -//~| HELP `mul1::Mul` -//~| HELP `mul2::Mul` -//~| HELP `mul3::Mul` -//~| HELP `mul4::Mul` -//~| HELP and 2 other candidates +//~^ ERROR cannot find type `Mul` } // Let's also test what happens if the trait doesn't exist: impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo { -//~^ ERROR unresolved trait `ThisTraitReallyDoesntExistInAnyModuleReally` +//~^ ERROR cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` } // Let's also test what happens if there's just one alternative: impl Div for Foo { -//~^ ERROR unresolved trait `Div` -//~| HELP `use std::ops::Div;` +//~^ ERROR cannot find trait `Div` } fn main() { diff --git a/src/test/ui/resolve/issue-21221-1.stderr b/src/test/ui/resolve/issue-21221-1.stderr index 6038c683e4..88405fd841 100644 --- a/src/test/ui/resolve/issue-21221-1.stderr +++ b/src/test/ui/resolve/issue-21221-1.stderr @@ -13,9 +13,9 @@ help: possible candidates are found in other modules, you can import them into s | error[E0412]: cannot find type `Mul` in this scope - --> $DIR/issue-21221-1.rs:72:16 + --> $DIR/issue-21221-1.rs:68:16 | -72 | fn getMul() -> Mul { +68 | fn getMul() -> Mul { | ^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -30,15 +30,15 @@ help: possible candidates are found in other modules, you can import them into s and 2 other candidates error[E0405]: cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` in this scope - --> $DIR/issue-21221-1.rs:83:6 + --> $DIR/issue-21221-1.rs:73:6 | -83 | impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo { +73 | impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0405]: cannot find trait `Div` in this scope - --> $DIR/issue-21221-1.rs:88:6 + --> $DIR/issue-21221-1.rs:78:6 | -88 | impl Div for Foo { +78 | impl Div for Foo { | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-21221-2.rs b/src/test/ui/resolve/issue-21221-2.rs index 15e859329c..4ddb4d669f 100644 --- a/src/test/ui/resolve/issue-21221-2.rs +++ b/src/test/ui/resolve/issue-21221-2.rs @@ -26,5 +26,4 @@ pub mod baz { struct Foo; impl T for Foo { } -//~^ ERROR unresolved trait `T` -//~| HELP you can import it into scope: `use foo::bar::T;` +//~^ ERROR cannot find trait `T` diff --git a/src/test/ui/resolve/issue-21221-3.rs b/src/test/ui/resolve/issue-21221-3.rs index 5d62cb8591..a93330b286 100644 --- a/src/test/ui/resolve/issue-21221-3.rs +++ b/src/test/ui/resolve/issue-21221-3.rs @@ -23,8 +23,7 @@ struct Foo; // `issue_21221_3::outer::public_module::OuterTrait` // are hidden from the view. impl OuterTrait for Foo {} -//~^ ERROR unresolved trait `OuterTrait` -//~| HELP you can import it into scope: `use issue_21221_3::outer::OuterTrait;` +//~^ ERROR cannot find trait `OuterTrait` fn main() { println!("Hello, world!"); } diff --git a/src/test/ui/resolve/issue-21221-4.rs b/src/test/ui/resolve/issue-21221-4.rs index ff6698f871..ec6ad2a482 100644 --- a/src/test/ui/resolve/issue-21221-4.rs +++ b/src/test/ui/resolve/issue-21221-4.rs @@ -18,8 +18,7 @@ extern crate issue_21221_4; struct Foo; impl T for Foo {} -//~^ ERROR unresolved trait `T` -//~| HELP you can import it into scope: `use issue_21221_4::T;` +//~^ ERROR cannot find trait `T` fn main() { println!("Hello, world!"); diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs index 19069f4916..f249e0e112 100644 --- a/src/test/ui/resolve/issue-23305.rs +++ b/src/test/ui/resolve/issue-23305.rs @@ -13,10 +13,6 @@ pub trait ToNbt<T> { } impl ToNbt<Self> {} -//~^ ERROR unresolved type `Self` -//~| NOTE `Self` is only available in traits and impls -//~| ERROR the trait `ToNbt` cannot be made into an object -//~| NOTE the trait `ToNbt` cannot be made into an object -//~| NOTE method `new` has no receiver +//~^ ERROR unsupported cyclic reference fn main() {} diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index fda87de9b9..5bba9fc41e 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -8,7 +8,7 @@ note: the cycle begins when processing `<impl at $DIR/issue-23305.rs:15:1: 15:20 --> $DIR/issue-23305.rs:15:1 | 15 | impl ToNbt<Self> {} - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ = note: ...which then again requires processing `<impl at $DIR/issue-23305.rs:15:1: 15:20>`, completing the cycle. error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-2356.rs b/src/test/ui/resolve/issue-2356.rs index 6deb598b63..9505e49019 100644 --- a/src/test/ui/resolve/issue-2356.rs +++ b/src/test/ui/resolve/issue-2356.rs @@ -25,24 +25,21 @@ impl MaybeDog { fn bark() { // If this provides a suggestion, it's a bug as MaybeDog doesn't impl Groom shave(); - //~^ ERROR unresolved function `shave` - //~| NOTE no resolution found + //~^ ERROR cannot find function `shave` } } impl Clone for cat { fn clone(&self) -> Self { clone(); - //~^ ERROR unresolved function `clone` - //~| NOTE did you mean `self.clone(...)`? + //~^ ERROR cannot find function `clone` loop {} } } impl Default for cat { fn default() -> Self { default(); - //~^ ERROR unresolved function `default` - //~| NOTE did you mean `Self::default`? + //~^ ERROR cannot find function `default` loop {} } } @@ -50,16 +47,11 @@ impl Default for cat { impl Groom for cat { fn shave(other: usize) { whiskers -= other; - //~^ ERROR unresolved value `whiskers` - //~| ERROR unresolved value `whiskers` - //~| NOTE did you mean `self.whiskers`? - //~| NOTE `self` value is only available in methods with `self` parameter + //~^ ERROR cannot find value `whiskers` shave(4); - //~^ ERROR unresolved function `shave` - //~| NOTE did you mean `Self::shave`? + //~^ ERROR cannot find function `shave` purr(); - //~^ ERROR unresolved function `purr` - //~| NOTE no resolution found + //~^ ERROR cannot find function `purr` } } @@ -68,17 +60,13 @@ impl cat { fn purr_louder() { static_method(); - //~^ ERROR unresolved function `static_method` - //~| NOTE no resolution found + //~^ ERROR cannot find function `static_method` purr(); - //~^ ERROR unresolved function `purr` - //~| NOTE no resolution found + //~^ ERROR cannot find function `purr` purr(); - //~^ ERROR unresolved function `purr` - //~| NOTE no resolution found + //~^ ERROR cannot find function `purr` purr(); - //~^ ERROR unresolved function `purr` - //~| NOTE no resolution found + //~^ ERROR cannot find function `purr` } } @@ -86,40 +74,31 @@ impl cat { fn meow() { if self.whiskers > 3 { //~^ ERROR expected value, found module `self` - //~| NOTE `self` value is only available in methods with `self` parameter println!("MEOW"); } } fn purr(&self) { grow_older(); - //~^ ERROR unresolved function `grow_older` - //~| NOTE no resolution found + //~^ ERROR cannot find function `grow_older` shave(); - //~^ ERROR unresolved function `shave` - //~| NOTE no resolution found + //~^ ERROR cannot find function `shave` } fn burn_whiskers(&mut self) { whiskers = 0; - //~^ ERROR unresolved value `whiskers` - //~| NOTE did you mean `self.whiskers`? + //~^ ERROR cannot find value `whiskers` } pub fn grow_older(other:usize) { whiskers = 4; - //~^ ERROR unresolved value `whiskers` - //~| ERROR unresolved value `whiskers` - //~| NOTE did you mean `self.whiskers`? - //~| NOTE `self` value is only available in methods with `self` parameter + //~^ ERROR cannot find value `whiskers` purr_louder(); - //~^ ERROR unresolved function `purr_louder` - //~| NOTE no resolution found + //~^ ERROR cannot find function `purr_louder` } } fn main() { self += 1; //~^ ERROR expected value, found module `self` - //~| NOTE `self` value is only available in methods with `self` parameter } diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr index ed0edd5258..db68167a57 100644 --- a/src/test/ui/resolve/issue-2356.stderr +++ b/src/test/ui/resolve/issue-2356.stderr @@ -5,105 +5,105 @@ error[E0425]: cannot find function `shave` in this scope | ^^^^^ not found in this scope error[E0425]: cannot find function `clone` in this scope - --> $DIR/issue-2356.rs:35:5 + --> $DIR/issue-2356.rs:34:5 | -35 | clone(); +34 | clone(); | ^^^^^ help: try: `self.clone` error[E0425]: cannot find function `default` in this scope - --> $DIR/issue-2356.rs:43:5 + --> $DIR/issue-2356.rs:41:5 | -43 | default(); +41 | default(); | ^^^^^^^ help: try: `Self::default` error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:52:5 + --> $DIR/issue-2356.rs:49:5 | -52 | whiskers -= other; +49 | whiskers -= other; | ^^^^^^^^ | | | `self` value is only available in methods with `self` parameter | help: try: `self.whiskers` error[E0425]: cannot find function `shave` in this scope - --> $DIR/issue-2356.rs:57:5 + --> $DIR/issue-2356.rs:51:5 | -57 | shave(4); +51 | shave(4); | ^^^^^ help: try: `Self::shave` error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:60:5 + --> $DIR/issue-2356.rs:53:5 | -60 | purr(); +53 | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `static_method` in this scope - --> $DIR/issue-2356.rs:70:9 + --> $DIR/issue-2356.rs:62:9 | -70 | static_method(); +62 | static_method(); | ^^^^^^^^^^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:73:9 + --> $DIR/issue-2356.rs:64:9 | -73 | purr(); +64 | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:76:9 + --> $DIR/issue-2356.rs:66:9 | -76 | purr(); +66 | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:79:9 + --> $DIR/issue-2356.rs:68:9 | -79 | purr(); +68 | purr(); | ^^^^ not found in this scope error[E0424]: expected value, found module `self` - --> $DIR/issue-2356.rs:87:8 + --> $DIR/issue-2356.rs:75:8 | -87 | if self.whiskers > 3 { +75 | if self.whiskers > 3 { | ^^^^ `self` value is only available in methods with `self` parameter error[E0425]: cannot find function `grow_older` in this scope - --> $DIR/issue-2356.rs:95:5 + --> $DIR/issue-2356.rs:82:5 | -95 | grow_older(); +82 | grow_older(); | ^^^^^^^^^^ not found in this scope error[E0425]: cannot find function `shave` in this scope - --> $DIR/issue-2356.rs:98:5 + --> $DIR/issue-2356.rs:84:5 | -98 | shave(); +84 | shave(); | ^^^^^ not found in this scope error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:104:5 - | -104 | whiskers = 0; - | ^^^^^^^^ help: try: `self.whiskers` + --> $DIR/issue-2356.rs:89:5 + | +89 | whiskers = 0; + | ^^^^^^^^ help: try: `self.whiskers` error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:110:5 - | -110 | whiskers = 4; - | ^^^^^^^^ - | | - | `self` value is only available in methods with `self` parameter - | help: try: `self.whiskers` + --> $DIR/issue-2356.rs:94:5 + | +94 | whiskers = 4; + | ^^^^^^^^ + | | + | `self` value is only available in methods with `self` parameter + | help: try: `self.whiskers` error[E0425]: cannot find function `purr_louder` in this scope - --> $DIR/issue-2356.rs:115:5 - | -115 | purr_louder(); - | ^^^^^^^^^^^ not found in this scope + --> $DIR/issue-2356.rs:96:5 + | +96 | purr_louder(); + | ^^^^^^^^^^^ not found in this scope error[E0424]: expected value, found module `self` - --> $DIR/issue-2356.rs:122:5 + --> $DIR/issue-2356.rs:102:5 | -122 | self += 1; +102 | self += 1; | ^^^^ `self` value is only available in methods with `self` parameter error: aborting due to 17 previous errors diff --git a/src/test/ui/resolve/issue-24968.rs b/src/test/ui/resolve/issue-24968.rs index 0d562cab6b..0bd08f8976 100644 --- a/src/test/ui/resolve/issue-24968.rs +++ b/src/test/ui/resolve/issue-24968.rs @@ -9,8 +9,7 @@ // except according to those terms. fn foo(_: Self) { -//~^ ERROR unresolved type `Self` -//~| NOTE `Self` is only available in traits and impls +//~^ ERROR cannot find type `Self` } fn main() {} diff --git a/src/test/ui/resolve/issue-39226.rs b/src/test/ui/resolve/issue-39226.rs index f290a74861..9d7291c405 100644 --- a/src/test/ui/resolve/issue-39226.rs +++ b/src/test/ui/resolve/issue-39226.rs @@ -18,7 +18,6 @@ fn main() { let s: Something = Something { handle: Handle - //~^ ERROR cannot find value `Handle` in this scope - //~| NOTE did you mean `handle`? + //~^ ERROR expected value, found struct `Handle` }; } diff --git a/src/test/ui/resolve/issue-5035.rs b/src/test/ui/resolve/issue-5035.rs index 6263e6f6db..e9b50dddd3 100644 --- a/src/test/ui/resolve/issue-5035.rs +++ b/src/test/ui/resolve/issue-5035.rs @@ -11,7 +11,6 @@ trait I {} type K = I; impl K for isize {} //~ ERROR expected trait, found type alias `K` - //~| NOTE type aliases cannot be used for traits use ImportError; //~ ERROR unresolved import `ImportError` [E0432] //~^ no `ImportError` in the root diff --git a/src/test/ui/resolve/issue-5035.stderr b/src/test/ui/resolve/issue-5035.stderr index 3c093e068c..3b37f5d4c8 100644 --- a/src/test/ui/resolve/issue-5035.stderr +++ b/src/test/ui/resolve/issue-5035.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `ImportError` - --> $DIR/issue-5035.rs:16:5 + --> $DIR/issue-5035.rs:15:5 | -16 | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] +15 | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] | ^^^^^^^^^^^ no `ImportError` in the root error[E0404]: expected trait, found type alias `K` diff --git a/src/test/ui/resolve/issue-6702.rs b/src/test/ui/resolve/issue-6702.rs index b391ddf346..8c5897d1d5 100644 --- a/src/test/ui/resolve/issue-6702.rs +++ b/src/test/ui/resolve/issue-6702.rs @@ -15,5 +15,4 @@ struct Monster { fn main() { let _m = Monster(); //~ ERROR expected function, found struct `Monster` - //~^ NOTE did you mean `Monster { /* fields */ }`? } diff --git a/src/test/ui/resolve/levenshtein.rs b/src/test/ui/resolve/levenshtein.rs index 53b6372d8e..af27629385 100644 --- a/src/test/ui/resolve/levenshtein.rs +++ b/src/test/ui/resolve/levenshtein.rs @@ -13,14 +13,18 @@ const MAX_ITEM: usize = 10; fn foo_bar() {} fn foo(c: esize) {} // Misspelled primitive type name. +//~^ ERROR cannot find enum Bar { } type A = Baz; // Misspelled type name. +//~^ ERROR cannot find type B = Opiton<u8>; // Misspelled type name from the prelude. +//~^ ERROR cannot find mod m { type A = Baz; // No suggestion here, Bar is not visible + //~^ ERROR cannot find pub struct First; pub struct Second; @@ -28,6 +32,10 @@ mod m { fn main() { let v = [0u32; MAXITEM]; // Misspelled constant name. + //~^ ERROR cannot find foobar(); // Misspelled function name. + //~^ ERROR cannot find let b: m::first = m::second; // Misspelled item in module. + //~^ ERROR cannot find + //~| ERROR cannot find } diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr index 4dff262031..68d46ccf68 100644 --- a/src/test/ui/resolve/levenshtein.stderr +++ b/src/test/ui/resolve/levenshtein.stderr @@ -5,45 +5,45 @@ error[E0412]: cannot find type `esize` in this scope | ^^^^^ did you mean `isize`? error[E0412]: cannot find type `Baz` in this scope - --> $DIR/levenshtein.rs:19:10 + --> $DIR/levenshtein.rs:20:10 | -19 | type A = Baz; // Misspelled type name. +20 | type A = Baz; // Misspelled type name. | ^^^ did you mean `Bar`? error[E0412]: cannot find type `Opiton` in this scope - --> $DIR/levenshtein.rs:20:10 + --> $DIR/levenshtein.rs:22:10 | -20 | type B = Opiton<u8>; // Misspelled type name from the prelude. +22 | type B = Opiton<u8>; // Misspelled type name from the prelude. | ^^^^^^ did you mean `Option`? error[E0412]: cannot find type `Baz` in this scope - --> $DIR/levenshtein.rs:23:14 + --> $DIR/levenshtein.rs:26:14 | -23 | type A = Baz; // No suggestion here, Bar is not visible +26 | type A = Baz; // No suggestion here, Bar is not visible | ^^^ not found in this scope error[E0425]: cannot find value `MAXITEM` in this scope - --> $DIR/levenshtein.rs:30:20 + --> $DIR/levenshtein.rs:34:20 | -30 | let v = [0u32; MAXITEM]; // Misspelled constant name. +34 | let v = [0u32; MAXITEM]; // Misspelled constant name. | ^^^^^^^ did you mean `MAX_ITEM`? error[E0425]: cannot find function `foobar` in this scope - --> $DIR/levenshtein.rs:31:5 + --> $DIR/levenshtein.rs:36:5 | -31 | foobar(); // Misspelled function name. +36 | foobar(); // Misspelled function name. | ^^^^^^ did you mean `foo_bar`? error[E0412]: cannot find type `first` in module `m` - --> $DIR/levenshtein.rs:32:15 + --> $DIR/levenshtein.rs:38:15 | -32 | let b: m::first = m::second; // Misspelled item in module. +38 | let b: m::first = m::second; // Misspelled item in module. | ^^^^^ did you mean `First`? error[E0425]: cannot find value `second` in module `m` - --> $DIR/levenshtein.rs:32:26 + --> $DIR/levenshtein.rs:38:26 | -32 | let b: m::first = m::second; // Misspelled item in module. +38 | let b: m::first = m::second; // Misspelled item in module. | ^^^^^^ did you mean `Second`? error: aborting due to 8 previous errors diff --git a/src/test/ui/resolve/privacy-struct-ctor.rs b/src/test/ui/resolve/privacy-struct-ctor.rs index 87e7b4f42a..eb6edae738 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.rs +++ b/src/test/ui/resolve/privacy-struct-ctor.rs @@ -25,7 +25,6 @@ mod m { n::Z; //~ ERROR tuple struct `Z` is private Z; //~^ ERROR expected value, found struct `Z` - //~| NOTE tuple struct constructors with private fields are invisible outside of their mod } } @@ -35,12 +34,10 @@ fn main() { m::S; //~ ERROR tuple struct `S` is private S; //~^ ERROR expected value, found struct `S` - //~| NOTE constructor is not visible here due to private fields m::n::Z; //~ ERROR tuple struct `Z` is private xcrate::m::S; //~ ERROR tuple struct `S` is private xcrate::S; //~^ ERROR expected value, found struct `xcrate::S` - //~| NOTE constructor is not visible here due to private fields xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private } diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index cb459ae474..39bedf5964 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -13,29 +13,29 @@ help: possible better candidate is found in another module, you can import it in | error[E0423]: expected value, found struct `S` - --> $DIR/privacy-struct-ctor.rs:36:5 + --> $DIR/privacy-struct-ctor.rs:35:5 | -36 | S; +35 | S; | ^ | | | constructor is not visible here due to private fields | did you mean `S { /* fields */ }`? help: possible better candidate is found in another module, you can import it into scope | -32 | use m::S; +31 | use m::S; | error[E0423]: expected value, found struct `xcrate::S` - --> $DIR/privacy-struct-ctor.rs:42:5 + --> $DIR/privacy-struct-ctor.rs:40:5 | -42 | xcrate::S; +40 | xcrate::S; | ^^^^^^^^^ | | | constructor is not visible here due to private fields | did you mean `xcrate::S { /* fields */ }`? help: possible better candidate is found in another module, you can import it into scope | -32 | use m::S; +31 | use m::S; | error[E0603]: tuple struct `Z` is private @@ -45,27 +45,27 @@ error[E0603]: tuple struct `Z` is private | ^^^^ error[E0603]: tuple struct `S` is private - --> $DIR/privacy-struct-ctor.rs:35:5 + --> $DIR/privacy-struct-ctor.rs:34:5 | -35 | m::S; //~ ERROR tuple struct `S` is private +34 | m::S; //~ ERROR tuple struct `S` is private | ^^^^ error[E0603]: tuple struct `Z` is private - --> $DIR/privacy-struct-ctor.rs:39:5 + --> $DIR/privacy-struct-ctor.rs:37:5 | -39 | m::n::Z; //~ ERROR tuple struct `Z` is private +37 | m::n::Z; //~ ERROR tuple struct `Z` is private | ^^^^^^^ error[E0603]: tuple struct `S` is private - --> $DIR/privacy-struct-ctor.rs:41:5 + --> $DIR/privacy-struct-ctor.rs:39:5 | -41 | xcrate::m::S; //~ ERROR tuple struct `S` is private +39 | xcrate::m::S; //~ ERROR tuple struct `S` is private | ^^^^^^^^^^^^ error[E0603]: tuple struct `Z` is private - --> $DIR/privacy-struct-ctor.rs:45:5 + --> $DIR/privacy-struct-ctor.rs:42:5 | -45 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private +42 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private | ^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.rs b/src/test/ui/resolve/resolve-assoc-suggestions.rs index 53e26ddafe..f3bc810736 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.rs +++ b/src/test/ui/resolve/resolve-assoc-suggestions.rs @@ -24,34 +24,25 @@ impl Tr for S { fn method(&self) { let _: field; - //~^ ERROR unresolved type `field` - //~| NOTE no resolution found + //~^ ERROR cannot find type `field` let field(..); - //~^ ERROR unresolved tuple struct/variant `field` - //~| NOTE no resolution found + //~^ ERROR cannot find tuple struct/variant `field` field; - //~^ ERROR unresolved value `field` - //~| NOTE did you mean `self.field`? + //~^ ERROR cannot find value `field` let _: Type; - //~^ ERROR unresolved type `Type` - //~| NOTE did you mean `Self::Type`? + //~^ ERROR cannot find type `Type` let Type(..); - //~^ ERROR unresolved tuple struct/variant `Type` - //~| NOTE no resolution found + //~^ ERROR cannot find tuple struct/variant `Type` Type; - //~^ ERROR unresolved value `Type` - //~| NOTE no resolution found + //~^ ERROR cannot find value `Type` let _: method; - //~^ ERROR unresolved type `method` - //~| NOTE no resolution found + //~^ ERROR cannot find type `method` let method(..); - //~^ ERROR unresolved tuple struct/variant `method` - //~| NOTE no resolution found + //~^ ERROR cannot find tuple struct/variant `method` method; - //~^ ERROR unresolved value `method` - //~| NOTE did you mean `self.method(...)`? + //~^ ERROR cannot find value `method` } } diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr index 77aa545e2a..3a6eeda833 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr +++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr @@ -5,51 +5,51 @@ error[E0412]: cannot find type `field` in this scope | ^^^^^ not found in this scope error[E0531]: cannot find tuple struct/variant `field` in this scope - --> $DIR/resolve-assoc-suggestions.rs:29:13 + --> $DIR/resolve-assoc-suggestions.rs:28:13 | -29 | let field(..); +28 | let field(..); | ^^^^^ not found in this scope error[E0425]: cannot find value `field` in this scope - --> $DIR/resolve-assoc-suggestions.rs:32:9 + --> $DIR/resolve-assoc-suggestions.rs:30:9 | -32 | field; +30 | field; | ^^^^^ help: try: `self.field` error[E0412]: cannot find type `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:36:16 + --> $DIR/resolve-assoc-suggestions.rs:33:16 | -36 | let _: Type; +33 | let _: Type; | ^^^^ help: try: `Self::Type` error[E0531]: cannot find tuple struct/variant `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:39:13 + --> $DIR/resolve-assoc-suggestions.rs:35:13 | -39 | let Type(..); +35 | let Type(..); | ^^^^ not found in this scope error[E0425]: cannot find value `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:42:9 + --> $DIR/resolve-assoc-suggestions.rs:37:9 | -42 | Type; +37 | Type; | ^^^^ not found in this scope error[E0412]: cannot find type `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:46:16 + --> $DIR/resolve-assoc-suggestions.rs:40:16 | -46 | let _: method; +40 | let _: method; | ^^^^^^ not found in this scope error[E0531]: cannot find tuple struct/variant `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:49:13 + --> $DIR/resolve-assoc-suggestions.rs:42:13 | -49 | let method(..); +42 | let method(..); | ^^^^^^ not found in this scope error[E0425]: cannot find value `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:52:9 + --> $DIR/resolve-assoc-suggestions.rs:44:9 | -52 | method; +44 | method; | ^^^^^^ help: try: `self.method` error: aborting due to 9 previous errors diff --git a/src/test/ui/resolve/resolve-hint-macro.rs b/src/test/ui/resolve/resolve-hint-macro.rs index 72fd9a7937..cc9f73b871 100644 --- a/src/test/ui/resolve/resolve-hint-macro.rs +++ b/src/test/ui/resolve/resolve-hint-macro.rs @@ -11,5 +11,4 @@ fn main() { assert(true); //~^ ERROR expected function, found macro `assert` - //~| NOTE did you mean `assert!(...)`? } diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.rs b/src/test/ui/resolve/resolve-speculative-adjustment.rs index 95289e23f9..fb5ed150bf 100644 --- a/src/test/ui/resolve/resolve-speculative-adjustment.rs +++ b/src/test/ui/resolve/resolve-speculative-adjustment.rs @@ -25,19 +25,15 @@ impl Tr for S { // Speculative resolution of `Self` and `self` silently fails, // "did you mean" messages are not printed. field; - //~^ ERROR unresolved value `field` - //~| NOTE no resolution found + //~^ ERROR cannot find value `field` method(); - //~^ ERROR unresolved function `method` - //~| NOTE no resolution found + //~^ ERROR cannot find function `method` } field; - //~^ ERROR unresolved value `field` - //~| NOTE did you mean `self.field`? + //~^ ERROR cannot find value `field` method(); - //~^ ERROR unresolved function `method` - //~| NOTE did you mean `self.method(...)`? + //~^ ERROR cannot find function `method` } } diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.stderr b/src/test/ui/resolve/resolve-speculative-adjustment.stderr index 3e1b075679..45512b2670 100644 --- a/src/test/ui/resolve/resolve-speculative-adjustment.stderr +++ b/src/test/ui/resolve/resolve-speculative-adjustment.stderr @@ -5,21 +5,21 @@ error[E0425]: cannot find value `field` in this scope | ^^^^^ not found in this scope error[E0425]: cannot find function `method` in this scope - --> $DIR/resolve-speculative-adjustment.rs:30:13 + --> $DIR/resolve-speculative-adjustment.rs:29:13 | -30 | method(); +29 | method(); | ^^^^^^ not found in this scope error[E0425]: cannot find value `field` in this scope - --> $DIR/resolve-speculative-adjustment.rs:35:9 + --> $DIR/resolve-speculative-adjustment.rs:33:9 | -35 | field; +33 | field; | ^^^^^ help: try: `self.field` error[E0425]: cannot find function `method` in this scope - --> $DIR/resolve-speculative-adjustment.rs:38:9 + --> $DIR/resolve-speculative-adjustment.rs:35:9 | -38 | method(); +35 | method(); | ^^^^^^ help: try: `self.method` error: aborting due to 4 previous errors diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs index 789bdfb414..981a853a04 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs @@ -26,51 +26,42 @@ pub mod a { fn h1() -> i32 { a.I //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::I`? } fn h2() -> i32 { a.g() //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::g(...)`? } fn h3() -> i32 { a.b.J //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::b`? } fn h4() -> i32 { a::b.J //~^ ERROR expected value, found module `a::b` - //~| NOTE did you mean `a::b::J`? } fn h5() { a.b.f(); //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::b`? let v = Vec::new(); v.push(a::b); //~^ ERROR expected value, found module `a::b` - //~| NOTE not a value } fn h6() -> i32 { a::b.f() //~^ ERROR expected value, found module `a::b` - //~| NOTE did you mean `a::b::f(...)`? } fn h7() { a::b //~^ ERROR expected value, found module `a::b` - //~| NOTE not a value } fn h8() -> i32 { a::b() //~^ ERROR expected function, found module `a::b` - //~| NOTE not a function } diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index d1794d19f6..861026ade1 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -7,67 +7,67 @@ error[E0423]: expected value, found module `a` | did you mean `a::I`? error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:33:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:32:5 | -33 | a.g() +32 | a.g() | ^---- | | | did you mean `a::g(...)`? error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:39:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:37:5 | -39 | a.b.J +37 | a.b.J | ^-- | | | did you mean `a::b`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 | -45 | a::b.J +42 | a::b.J | ^^^--- | | | | | did you mean `I`? | did you mean `a::b::J`? error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:51:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:47:5 | -51 | a.b.f(); +47 | a.b.f(); | ^-- | | | did you mean `a::b`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:12 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:50:12 | -55 | v.push(a::b); +50 | v.push(a::b); | ^^^- | | | did you mean `I`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:61:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5 | -61 | a::b.f() +55 | a::b.f() | ^^^----- | | | | | did you mean `I`? | did you mean `a::b::f(...)`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:67:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:60:5 | -67 | a::b +60 | a::b | ^^^- | | | did you mean `I`? error[E0423]: expected function, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:73:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:65:5 | -73 | a::b() +65 | a::b() | ^^^- | | | did you mean `I`? diff --git a/src/test/ui/resolve/token-error-correct-2.rs b/src/test/ui/resolve/token-error-correct-2.rs index 6fa1260d18..e49374f9ce 100644 --- a/src/test/ui/resolve/token-error-correct-2.rs +++ b/src/test/ui/resolve/token-error-correct-2.rs @@ -12,8 +12,6 @@ fn main() { if foo { - //~^ NOTE: unclosed delimiter - //~| ERROR: unresolved value `foo` - //~| NOTE: no resolution found + //~^ ERROR: cannot find value `foo` ) //~ ERROR: incorrect close delimiter: `)` } diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr index feb12612e6..00bd5dba8d 100644 --- a/src/test/ui/resolve/token-error-correct-2.stderr +++ b/src/test/ui/resolve/token-error-correct-2.stderr @@ -1,7 +1,7 @@ error: incorrect close delimiter: `)` - --> $DIR/token-error-correct-2.rs:18:5 + --> $DIR/token-error-correct-2.rs:16:5 | -18 | ) //~ ERROR: incorrect close delimiter: `)` +16 | ) //~ ERROR: incorrect close delimiter: `)` | ^ | note: unclosed delimiter diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs index f72b7adf59..6d216178a7 100644 --- a/src/test/ui/resolve/token-error-correct-3.rs +++ b/src/test/ui/resolve/token-error-correct-3.rs @@ -18,16 +18,16 @@ pub mod raw { pub fn ensure_dir_exists<P: AsRef<Path>, F: FnOnce(&Path)>(path: P, callback: F) -> io::Result<bool> { - if !is_directory(path.as_ref()) { //~ ERROR: unresolved function `is_directory` - //~^ NOTE: no resolution found - callback(path.as_ref(); //~ NOTE: unclosed delimiter - //~^ ERROR: expected one of + if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` + callback(path.as_ref(); //~ ERROR expected one of fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types //~^ expected (), found enum `std::result::Result` //~| expected type `()` //~| found type `std::result::Result<bool, std::io::Error>` + //~| expected one of } else { //~ ERROR: incorrect close delimiter: `}` //~^ ERROR: expected one of + //~| unexpected token Ok(false); } diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index c8e19db370..f2281a24e2 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,40 +1,40 @@ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct-3.rs:29:9 + --> $DIR/token-error-correct-3.rs:28:9 | -29 | } else { //~ ERROR: incorrect close delimiter: `}` +28 | } else { //~ ERROR: incorrect close delimiter: `}` | ^ | note: unclosed delimiter - --> $DIR/token-error-correct-3.rs:23:21 + --> $DIR/token-error-correct-3.rs:22:21 | -23 | callback(path.as_ref(); //~ NOTE: unclosed delimiter +22 | callback(path.as_ref(); //~ ERROR expected one of | ^ error: expected one of `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-3.rs:23:35 + --> $DIR/token-error-correct-3.rs:22:35 | -23 | callback(path.as_ref(); //~ NOTE: unclosed delimiter +22 | callback(path.as_ref(); //~ ERROR expected one of | ^ expected one of `,`, `.`, `?`, or an operator here error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` - --> $DIR/token-error-correct-3.rs:29:9 + --> $DIR/token-error-correct-3.rs:28:9 | -25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types +23 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types | - expected one of `.`, `;`, `?`, `}`, or an operator here ... -29 | } else { //~ ERROR: incorrect close delimiter: `}` +28 | } else { //~ ERROR: incorrect close delimiter: `}` | ^ unexpected token error[E0425]: cannot find function `is_directory` in this scope --> $DIR/token-error-correct-3.rs:21:13 | -21 | if !is_directory(path.as_ref()) { //~ ERROR: unresolved function `is_directory` +21 | if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` | ^^^^^^^^^^^^ not found in this scope error[E0308]: mismatched types - --> $DIR/token-error-correct-3.rs:25:13 + --> $DIR/token-error-correct-3.rs:23:13 | -25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types +23 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` | | | expected (), found enum `std::result::Result` diff --git a/src/test/ui/resolve/token-error-correct.rs b/src/test/ui/resolve/token-error-correct.rs index 5fd35e5133..c88f823839 100644 --- a/src/test/ui/resolve/token-error-correct.rs +++ b/src/test/ui/resolve/token-error-correct.rs @@ -12,15 +12,7 @@ fn main() { foo(bar(; - //~^ NOTE: unclosed delimiter - //~| NOTE: unclosed delimiter - //~| ERROR: expected expression, found `;` - //~| ERROR: unresolved function `foo` - //~| NOTE: no resolution found - //~| ERROR: unresolved function `bar` - //~| NOTE: no resolution found - //~| ERROR: expected one of `)`, `,`, `.`, `<`, `?` + //~^ ERROR: expected expression, found `;` } //~^ ERROR: incorrect close delimiter: `}` //~| ERROR: incorrect close delimiter: `}` -//~| ERROR: expected expression, found `)` diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index 6bd63f4fbb..e26f0e85aa 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -1,7 +1,7 @@ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct.rs:23:1 + --> $DIR/token-error-correct.rs:16:1 | -23 | } +16 | } | ^ | note: unclosed delimiter @@ -11,9 +11,9 @@ note: unclosed delimiter | ^ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct.rs:23:1 + --> $DIR/token-error-correct.rs:16:1 | -23 | } +16 | } | ^ | note: unclosed delimiter @@ -28,11 +28,5 @@ error: expected expression, found `;` 14 | foo(bar(; | ^ -error: expected expression, found `)` - --> $DIR/token-error-correct.rs:23:1 - | -23 | } - | ^ - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/tuple-struct-alias.rs b/src/test/ui/resolve/tuple-struct-alias.rs index c9c05202fe..0dbca07b77 100644 --- a/src/test/ui/resolve/tuple-struct-alias.rs +++ b/src/test/ui/resolve/tuple-struct-alias.rs @@ -13,16 +13,16 @@ type A = S; impl S { fn f() { - let s = Self(0, 1); + let s = Self(0, 1); //~ ERROR expected function match s { - Self(..) => {} + Self(..) => {} //~ ERROR expected tuple struct/variant } } } fn main() { - let s = A(0, 1); + let s = A(0, 1); //~ ERROR expected function match s { - A(..) => {} + A(..) => {} //~ ERROR expected tuple struct/variant } } diff --git a/src/test/ui/resolve/tuple-struct-alias.stderr b/src/test/ui/resolve/tuple-struct-alias.stderr index e2ef8f0e56..aea9fc356b 100644 --- a/src/test/ui/resolve/tuple-struct-alias.stderr +++ b/src/test/ui/resolve/tuple-struct-alias.stderr @@ -1,19 +1,19 @@ error[E0423]: expected function, found self type `Self` --> $DIR/tuple-struct-alias.rs:16:17 | -16 | let s = Self(0, 1); +16 | let s = Self(0, 1); //~ ERROR expected function | ^^^^ did you mean `Self { /* fields */ }`? error[E0532]: expected tuple struct/variant, found self type `Self` --> $DIR/tuple-struct-alias.rs:18:13 | -18 | Self(..) => {} +18 | Self(..) => {} //~ ERROR expected tuple struct/variant | ^^^^ did you mean `Self { /* fields */ }`? error[E0423]: expected function, found type alias `A` --> $DIR/tuple-struct-alias.rs:24:13 | -24 | let s = A(0, 1); +24 | let s = A(0, 1); //~ ERROR expected function | ^ | | | did you mean `S`? @@ -22,7 +22,7 @@ error[E0423]: expected function, found type alias `A` error[E0532]: expected tuple struct/variant, found type alias `A` --> $DIR/tuple-struct-alias.rs:26:9 | -26 | A(..) => {} +26 | A(..) => {} //~ ERROR expected tuple struct/variant | ^ | | | did you mean `S`? diff --git a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs index 57f6ddd2d3..9d5e2e8966 100644 --- a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs +++ b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs @@ -9,13 +9,11 @@ // except according to those terms. fn f<F:Nonexist(isize) -> isize>(x: F) {} -//~^ ERROR unresolved trait `Nonexist` -//~| NOTE no resolution found +//~^ ERROR cannot find trait `Nonexist` type Typedef = isize; fn g<F:Typedef(isize) -> isize>(x: F) {} //~^ ERROR expected trait, found type alias `Typedef` -//~| NOTE type aliases cannot be used for traits fn main() {} diff --git a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr index 015dbfc3dc..eaee35451e 100644 --- a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr +++ b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr @@ -5,9 +5,9 @@ error[E0405]: cannot find trait `Nonexist` in this scope | ^^^^^^^^ not found in this scope error[E0404]: expected trait, found type alias `Typedef` - --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:17:8 + --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:16:8 | -17 | fn g<F:Typedef(isize) -> isize>(x: F) {} +16 | fn g<F:Typedef(isize) -> isize>(x: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^ type aliases cannot be used for traits error: cannot continue compilation due to previous error diff --git a/src/test/ui/resolve/unresolved_static_type_field.rs b/src/test/ui/resolve/unresolved_static_type_field.rs index 19beabd882..9ba39ce08c 100644 --- a/src/test/ui/resolve/unresolved_static_type_field.rs +++ b/src/test/ui/resolve/unresolved_static_type_field.rs @@ -17,10 +17,7 @@ struct Foo { impl Foo { fn bar() { f(cx); - //~^ ERROR unresolved value `cx` - //~| ERROR unresolved value `cx` - //~| NOTE did you mean `self.cx`? - //~| NOTE `self` value is only available in methods with `self` parameter + //~^ ERROR cannot find value `cx` in this scope } } diff --git a/src/test/ui/resolve/use_suggestion_placement.rs b/src/test/ui/resolve/use_suggestion_placement.rs index a43b8fc99d..87f38df044 100644 --- a/src/test/ui/resolve/use_suggestion_placement.rs +++ b/src/test/ui/resolve/use_suggestion_placement.rs @@ -22,15 +22,15 @@ mod foo { // test whether the use suggestion isn't // placed into the expansion of `#[derive(Debug)] - type Bar = Path; + type Bar = Path; //~ ERROR cannot find } fn main() { y!(); - let _ = A; + let _ = A; //~ ERROR cannot find foo(); } fn foo() { - type Dict<K, V> = HashMap<K, V>; + type Dict<K, V> = HashMap<K, V>; //~ ERROR cannot find } diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index 401825367d..1cc2d06ab6 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Path` in this scope --> $DIR/use_suggestion_placement.rs:25:16 | -25 | type Bar = Path; +25 | type Bar = Path; //~ ERROR cannot find | ^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ help: possible candidate is found in another module, you can import it into scop error[E0425]: cannot find value `A` in this scope --> $DIR/use_suggestion_placement.rs:30:13 | -30 | let _ = A; +30 | let _ = A; //~ ERROR cannot find | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -21,7 +21,7 @@ help: possible candidate is found in another module, you can import it into scop error[E0412]: cannot find type `HashMap` in this scope --> $DIR/use_suggestion_placement.rs:35:23 | -35 | type Dict<K, V> = HashMap<K, V>; +35 | type Dict<K, V> = HashMap<K, V>; //~ ERROR cannot find | ^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.rs b/src/test/ui/rfc-2005-default-binding-mode/const.rs index 31923343b6..fca99f064a 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/const.rs @@ -23,7 +23,7 @@ fn main() { let f = Foo{bar:6}; match &f { - FOO => {}, + FOO => {}, //~ ERROR mismatched types _ => panic!(), } } diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.stderr b/src/test/ui/rfc-2005-default-binding-mode/const.stderr index 0dfd79f356..afcbf76c1a 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/const.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/const.rs:26:9 | -26 | FOO => {}, +26 | FOO => {}, //~ ERROR mismatched types | ^^^ expected &Foo, found struct `Foo` | = note: expected type `&Foo` diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.rs b/src/test/ui/rfc-2005-default-binding-mode/enum.rs index 58902bf06b..76ea64e248 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.rs @@ -18,17 +18,17 @@ use Wrapper::Wrap; pub fn main() { let Wrap(x) = &Wrap(3); - *x += 1; + *x += 1; //~ ERROR cannot assign to immutable if let Some(x) = &Some(3) { - *x += 1; + *x += 1; //~ ERROR cannot assign to immutable } else { panic!(); } while let Some(x) = &Some(3) { - *x += 1; + *x += 1; //~ ERROR cannot assign to immutable break; } } diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr index ad08ae83a4..052ab5892d 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to immutable borrowed content `*x` | 20 | let Wrap(x) = &Wrap(3); | - consider changing this to `x` -21 | *x += 1; +21 | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` @@ -11,7 +11,7 @@ error[E0594]: cannot assign to immutable borrowed content `*x` | 24 | if let Some(x) = &Some(3) { | - consider changing this to `x` -25 | *x += 1; +25 | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` @@ -19,7 +19,7 @@ error[E0594]: cannot assign to immutable borrowed content `*x` | 30 | while let Some(x) = &Some(3) { | - consider changing this to `x` -31 | *x += 1; +31 | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs index b5287b7ccc..2e43d9722a 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs @@ -16,7 +16,7 @@ fn main() { match &&Some(5i32) { Some(n) => { - *n += 1; + *n += 1; //~ ERROR cannot assign to immutable let _ = n; } None => {}, @@ -24,7 +24,7 @@ fn main() { match &mut &Some(5i32) { Some(n) => { - *n += 1; + *n += 1; //~ ERROR cannot assign to immutable let _ = n; } None => {}, @@ -32,7 +32,7 @@ fn main() { match &&mut Some(5i32) { Some(n) => { - *n += 1; + *n += 1; //~ ERROR cannot assign to immutable let _ = n; } None => {}, diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr index 1dbd769373..c1c59fe678 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to immutable borrowed content `*n` | 18 | Some(n) => { | - consider changing this to `n` -19 | *n += 1; +19 | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` @@ -11,7 +11,7 @@ error[E0594]: cannot assign to immutable borrowed content `*n` | 26 | Some(n) => { | - consider changing this to `n` -27 | *n += 1; +27 | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` @@ -19,7 +19,7 @@ error[E0594]: cannot assign to immutable borrowed content `*n` | 34 | Some(n) => { | - consider changing this to `n` -35 | *n += 1; +35 | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.rs b/src/test/ui/rfc-2005-default-binding-mode/for.rs index 35f8fbb9b7..e9004c13a0 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/for.rs @@ -16,5 +16,6 @@ pub fn main() { let mut tups = vec![(Foo{}, Foo{})]; // The below desugars to &(ref n, mut m). for (n, mut m) in &tups { + //~^ ERROR cannot bind by-move and by-ref in the same pattern } } diff --git a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs index 294d6b8859..9fbcf5d68b 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs @@ -16,6 +16,7 @@ pub fn main() { let x = &Some((3, 3)); let _: &i32 = match x { Some((x, 3)) | &Some((ref x, 5)) => x, + //~^ ERROR is bound in inconsistent ways _ => &5i32, }; } diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.rs b/src/test/ui/rfc-2005-default-binding-mode/lit.rs index 54cee39209..783287fd45 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.rs @@ -16,7 +16,7 @@ fn with_str() { let s: &'static str = "abc"; match &s { - "abc" => true, + "abc" => true, //~ ERROR mismatched types _ => panic!(), }; } @@ -25,7 +25,7 @@ fn with_bytes() { let s: &'static [u8] = b"abc"; match &s { - b"abc" => true, + b"abc" => true, //~ ERROR mismatched types _ => panic!(), }; } diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr index 811d3b8074..f5ed7ee718 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/lit.rs:19:13 | -19 | "abc" => true, +19 | "abc" => true, //~ ERROR mismatched types | ^^^^^ expected &str, found str | = note: expected type `&&str` @@ -10,7 +10,7 @@ error[E0308]: mismatched types error[E0308]: mismatched types --> $DIR/lit.rs:28:9 | -28 | b"abc" => true, +28 | b"abc" => true, //~ ERROR mismatched types | ^^^^^^ expected &[u8], found array of 3 elements | = note: expected type `&&[u8]` diff --git a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs index a0134c499b..0b2318d762 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs @@ -15,7 +15,7 @@ fn main() { let foo = 22; match foo { - u32::XXX => { } + u32::XXX => { } //~ ERROR no associated item named _ => { } } } diff --git a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr index da065eea89..8304228758 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr @@ -1,8 +1,8 @@ error[E0599]: no associated item named `XXX` found for type `u32` in the current scope --> $DIR/no-double-error.rs:18:9 | -18 | u32::XXX => { } - | ^^^^^^^^ +18 | u32::XXX => { } //~ ERROR no associated item named + | ^^^^^^^^ associated item not found in `u32` error: aborting due to previous error diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.rs b/src/test/ui/rfc-2005-default-binding-mode/slice.rs index fb87ed72ab..40aa957242 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.rs @@ -14,7 +14,7 @@ pub fn main() { let sl: &[u8] = b"foo"; - match sl { + match sl { //~ ERROR non-exhaustive patterns [first, remainder..] => {}, }; } diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index 90a2f75c07..ec2225c9f9 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `&[]` not covered --> $DIR/slice.rs:17:11 | -17 | match sl { +17 | match sl { //~ ERROR non-exhaustive patterns | ^^ pattern `&[]` not covered error: aborting due to previous error diff --git a/src/test/ui/rfc-2005-default-binding-mode/suggestion.rs b/src/test/ui/rfc-2005-default-binding-mode/suggestion.rs index 52ff817dff..b9b974ff3c 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/suggestion.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/suggestion.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - if let Some(y) = &Some(22) { + if let Some(y) = &Some(22) { //~ ERROR non-reference pattern println!("{}", y); } } diff --git a/src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr b/src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr index 0594f865f3..ebf9e498ff 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/suggestion.stderr @@ -1,8 +1,8 @@ error: non-reference pattern used to match a reference (see issue #42640) --> $DIR/suggestion.rs:12:12 | -12 | if let Some(y) = &Some(22) { - | ^^^^^^^ help: consider using: `&Some(y)` +12 | if let Some(y) = &Some(22) { //~ ERROR non-reference pattern + | ^^^^^^^ help: consider using a reference: `&Some(y)` | = help: add #![feature(match_default_bindings)] to the crate attributes to enable diff --git a/src/tools/miri/tests/run-pass/sendable-class.rs b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs similarity index 55% rename from src/tools/miri/tests/run-pass/sendable-class.rs rename to src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs index b3e07d00f0..0d9b487876 100644 --- a/src/tools/miri/tests/run-pass/sendable-class.rs +++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs @@ -8,27 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test that a class with only sendable fields can be sent +#![feature(generic_associated_types)] -// pretty-expanded FIXME #23616 +//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +//follow-up PR -use std::sync::mpsc::channel; - -#[allow(dead_code)] -struct Foo { - i: isize, - j: char, +trait Foo { + type Bar<'a, 'b>; } -fn foo(i:isize, j: char) -> Foo { - Foo { - i: i, - j: j - } +trait Baz { + type Quux<'a>; } -pub fn main() { - let (tx, rx) = channel(); - let _ = tx.send(foo(42, 'c')); - let _ = rx; +impl<T> Baz for T where T: Foo { + type Quux<'a> = <T as Foo>::Bar<'a, 'static>; + //~^ ERROR lifetime parameters are not allowed on this type [E0110] } + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr new file mode 100644 index 0000000000..e74592fa9f --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr @@ -0,0 +1,8 @@ +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/construct_with_other_type.rs:25:37 + | +25 | type Quux<'a> = <T as Foo>::Bar<'a, 'static>; + | ^^ lifetime parameter not allowed on this type + +error: aborting due to previous error + diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs new file mode 100644 index 0000000000..b12c075d13 --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generic_associated_types)] + +trait Foo { + type Bar<,>; + //~^ ERROR expected one of `>`, identifier, or lifetime, found `,` +} + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr new file mode 100644 index 0000000000..de0c1e310b --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr @@ -0,0 +1,8 @@ +error: expected one of `>`, identifier, or lifetime, found `,` + --> $DIR/empty_generics.rs:14:14 + | +14 | type Bar<,>; + | ^ expected one of `>`, identifier, or lifetime here + +error: aborting due to previous error + diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs new file mode 100644 index 0000000000..9b59b24b10 --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generic_associated_types)] + +// Checking the interaction with this other feature +#![feature(associated_type_defaults)] + +use std::fmt::{Display, Debug}; + +trait Foo { + type Assoc where Self: Sized; + type Assoc2<T> where T: Display; + type Assoc3<T>; + type WithDefault<T> where T: Debug = Iterator<Item=T>; + type NoGenerics; +} + +struct Bar; + +impl Foo for Bar { + type Assoc = usize; + type Assoc2<T> = Vec<T>; + type Assoc3<T> where T: Iterator = Vec<T>; + type WithDefault<'a, T> = &'a Iterator<T>; + type NoGenerics = ::std::cell::Cell<i32>; +} + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr new file mode 100644 index 0000000000..bb55d86f62 --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr @@ -0,0 +1,2 @@ +error: cannot continue compilation due to previous error + diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs new file mode 100644 index 0000000000..263b3cb42e --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generic_associated_types)] + +use std::ops::Deref; + +//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +//follow-up PR + +trait Iterable { + type Item<'a>; + type Iter<'a>: Iterator<Item = Self::Item<'a>> + //~^ ERROR lifetime parameters are not allowed on this type [E0110] + + Deref<Target = Self::Item<'b>>; + //~^ ERROR undeclared lifetime + //~| ERROR lifetime parameters are not allowed on this type [E0110] + + fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; + //~^ ERROR undeclared lifetime + //~| ERROR lifetime parameters are not allowed on this type [E0110] +} + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr new file mode 100644 index 0000000000..587be7113c --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr @@ -0,0 +1,32 @@ +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:22:37 + | +22 | + Deref<Target = Self::Item<'b>>; + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'undeclared` + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:26:41 + | +26 | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; + | ^^^^^^^^^^^ undeclared lifetime + +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:20:47 + | +20 | type Iter<'a>: Iterator<Item = Self::Item<'a>> + | ^^ lifetime parameter not allowed on this type + +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:22:37 + | +22 | + Deref<Target = Self::Item<'b>>; + | ^^ lifetime parameter not allowed on this type + +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:26:41 + | +26 | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; + | ^^^^^^^^^^^ lifetime parameter not allowed on this type + +error: aborting due to 5 previous errors + diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.rs b/src/test/ui/rfc1598-generic-associated-types/iterable.rs new file mode 100644 index 0000000000..1287ddaf7f --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/iterable.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generic_associated_types)] + +use std::ops::Deref; + +//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +//follow-up PR + +trait Iterable { + type Item<'a>; + type Iter<'a>: Iterator<Item = Self::Item<'a>>; + //~^ ERROR lifetime parameters are not allowed on this type [E0110] + + // This weird type tests that we can use universal function call syntax to access the Item on + // Self::Iter which we have declared to be an Iterator + type Iter2<'a>: Deref<Target = <Self::Iter<'a> as Iterator>::Item>; + //~^ ERROR lifetime parameters are not allowed on this type [E0110] + + fn iter<'a>(&'a self) -> Self::Iter<'a>; + //~^ ERROR lifetime parameters are not allowed on this type [E0110] +} + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr new file mode 100644 index 0000000000..d12ca5e5d4 --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr @@ -0,0 +1,20 @@ +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/iterable.rs:20:47 + | +20 | type Iter<'a>: Iterator<Item = Self::Item<'a>>; + | ^^ lifetime parameter not allowed on this type + +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/iterable.rs:25:48 + | +25 | type Iter2<'a>: Deref<Target = <Self::Iter<'a> as Iterator>::Item>; + | ^^ lifetime parameter not allowed on this type + +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/iterable.rs:28:41 + | +28 | fn iter<'a>(&'a self) -> Self::Iter<'a>; + | ^^ lifetime parameter not allowed on this type + +error: aborting due to 3 previous errors + diff --git a/src/tools/miri/tests/run-pass/move-arg-3-unique.rs b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs similarity index 70% rename from src/tools/miri/tests/run-pass/move-arg-3-unique.rs rename to src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs index 2e6320eb80..0e598fa14b 100644 --- a/src/tools/miri/tests/run-pass/move-arg-3-unique.rs +++ b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs @@ -8,11 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_features, unused_variables)] -#![feature(box_syntax)] +// compile-flags: -Z parse-only +// must-compile-successfully -pub fn main() { - let x = box 10; - let y = x; - assert_eq!(*y, 10); +#![feature(generic_associated_types)] + +impl<T> Baz for T where T: Foo { + type Quux<'a> = <T as Foo>::Bar<'a, 'static>; } + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs new file mode 100644 index 0000000000..8ab519be63 --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z parse-only +// must-compile-successfully + +#![feature(generic_associated_types)] + +use std::ops::Deref; + +trait Foo { + type Bar<'a>; + type Bar<'a, 'b>; + type Bar<'a, 'b,>; + type Bar<'a, 'b, T>; + type Bar<'a, 'b, T, U>; + type Bar<'a, 'b, T, U,>; + type Bar<'a, 'b, T: Debug, U,>; + type Bar<'a, 'b, T: Debug, U,>: Debug; + type Bar<'a, 'b, T: Debug, U,>: Deref<Target = T> + Into<U>; + type Bar<'a, 'b, T: Debug, U,> where T: Deref<Target = U>, U: Into<T>; + type Bar<'a, 'b, T: Debug, U,>: Deref<Target = T> + Into<U> + where T: Deref<Target = U>, U: Into<T>; +} + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs new file mode 100644 index 0000000000..cbeeb1d6ca --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs @@ -0,0 +1,50 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generic_associated_types)] + +//FIXME(#44265): "type parameter not allowed" errors will be addressed in a follow-up PR + +use std::rc::Rc; +use std::sync::Arc; +use std::ops::Deref; + +trait PointerFamily { + type Pointer<T>: Deref<Target = T>; + fn new<T>(value: T) -> Self::Pointer<T>; + //~^ ERROR type parameters are not allowed on this type [E0109] +} + +struct ArcFamily; + +impl PointerFamily for ArcFamily { + type Pointer<T> = Arc<T>; + fn new<T>(value: T) -> Self::Pointer<T> { + //~^ ERROR type parameters are not allowed on this type [E0109] + Arc::new(value) + } +} + +struct RcFamily; + +impl PointerFamily for RcFamily { + type Pointer<T> = Rc<T>; + fn new<T>(value: T) -> Self::Pointer<T> { + //~^ ERROR type parameters are not allowed on this type [E0109] + Rc::new(value) + } +} + +struct Foo<P: PointerFamily> { + bar: P::Pointer<String>, + //~^ ERROR type parameters are not allowed on this type [E0109] +} + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr new file mode 100644 index 0000000000..cc7f06f3b8 --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr @@ -0,0 +1,26 @@ +error[E0109]: type parameters are not allowed on this type + --> $DIR/pointer_family.rs:46:21 + | +46 | bar: P::Pointer<String>, + | ^^^^^^ type parameter not allowed + +error[E0109]: type parameters are not allowed on this type + --> $DIR/pointer_family.rs:21:42 + | +21 | fn new<T>(value: T) -> Self::Pointer<T>; + | ^ type parameter not allowed + +error[E0109]: type parameters are not allowed on this type + --> $DIR/pointer_family.rs:29:42 + | +29 | fn new<T>(value: T) -> Self::Pointer<T> { + | ^ type parameter not allowed + +error[E0109]: type parameters are not allowed on this type + --> $DIR/pointer_family.rs:39:42 + | +39 | fn new<T>(value: T) -> Self::Pointer<T> { + | ^ type parameter not allowed + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs new file mode 100644 index 0000000000..f9e270ee92 --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generic_associated_types)] + +//FIXME(#44265): "lifetime parameter not allowed on this type" errors will be addressed in a +// follow-up PR + +use std::fmt::Display; + +trait StreamingIterator { + type Item<'a>; + // Applying the lifetime parameter `'a` to `Self::Item` inside the trait. + fn next<'a>(&'a self) -> Option<Self::Item<'a>>; + //~^ ERROR lifetime parameters are not allowed on this type [E0110] +} + +struct Foo<T: StreamingIterator> { + // Applying a concrete lifetime to the constructor outside the trait. + bar: <T as StreamingIterator>::Item<'static>, + //~^ ERROR lifetime parameters are not allowed on this type [E0110] +} + +// Users can bound parameters by the type constructed by that trait's associated type constructor +// of a trait using HRTB. Both type equality bounds and trait bounds of this kind are valid: +//FIXME(sunjay): This next line should parse and be valid +//fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ } +fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } +//~^ ERROR lifetime parameters are not allowed on this type [E0110] + +fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr new file mode 100644 index 0000000000..b1908d022e --- /dev/null +++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr @@ -0,0 +1,20 @@ +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/streaming_iterator.rs:27:41 + | +27 | bar: <T as StreamingIterator>::Item<'static>, + | ^^^^^^^ lifetime parameter not allowed on this type + +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/streaming_iterator.rs:35:64 + | +35 | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } + | ^^ lifetime parameter not allowed on this type + +error[E0110]: lifetime parameters are not allowed on this type + --> $DIR/streaming_iterator.rs:21:48 + | +21 | fn next<'a>(&'a self) -> Option<Self::Item<'a>>; + | ^^ lifetime parameter not allowed on this type + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs index 3741ba4f3a..eb4753122f 100644 --- a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs +++ b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![feature(fn_must_use)] #![warn(unused_must_use)] @@ -56,21 +58,22 @@ fn need_to_use_this_value() -> bool { } fn main() { - need_to_use_this_value(); + need_to_use_this_value(); //~ WARN unused return value let mut m = MyStruct { n: 2 }; let n = MyStruct { n: 3 }; - m.need_to_use_this_method_value(); + m.need_to_use_this_method_value(); //~ WARN unused return value m.is_even(); // trait method! + //~^ WARN unused return value m.replace(3); // won't warn (annotation needs to be in trait definition) // comparison methods are `must_use` - 2.eq(&3); - m.eq(&n); + 2.eq(&3); //~ WARN unused return value + m.eq(&n); //~ WARN unused return value // lint includes comparison operators - 2 == 3; - m == n; + 2 == 3; //~ WARN unused comparison + m == n; //~ WARN unused comparison } diff --git a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr index fdd0a591bc..92d1eeaf15 100644 --- a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr +++ b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr @@ -1,48 +1,48 @@ warning: unused return value of `need_to_use_this_value` which must be used: it's important - --> $DIR/fn_must_use.rs:59:5 + --> $DIR/fn_must_use.rs:61:5 | -59 | need_to_use_this_value(); +61 | need_to_use_this_value(); //~ WARN unused return value | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/fn_must_use.rs:12:9 + --> $DIR/fn_must_use.rs:14:9 | -12 | #![warn(unused_must_use)] +14 | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used - --> $DIR/fn_must_use.rs:64:5 + --> $DIR/fn_must_use.rs:66:5 | -64 | m.need_to_use_this_method_value(); +66 | m.need_to_use_this_method_value(); //~ WARN unused return value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused return value of `EvenNature::is_even` which must be used: no side effects - --> $DIR/fn_must_use.rs:65:5 + --> $DIR/fn_must_use.rs:67:5 | -65 | m.is_even(); // trait method! +67 | m.is_even(); // trait method! | ^^^^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` which must be used - --> $DIR/fn_must_use.rs:70:5 + --> $DIR/fn_must_use.rs:73:5 | -70 | 2.eq(&3); +73 | 2.eq(&3); //~ WARN unused return value | ^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` which must be used - --> $DIR/fn_must_use.rs:71:5 + --> $DIR/fn_must_use.rs:74:5 | -71 | m.eq(&n); +74 | m.eq(&n); //~ WARN unused return value | ^^^^^^^^^ warning: unused comparison which must be used - --> $DIR/fn_must_use.rs:74:5 + --> $DIR/fn_must_use.rs:77:5 | -74 | 2 == 3; +77 | 2 == 3; //~ WARN unused comparison | ^^^^^^ warning: unused comparison which must be used - --> $DIR/fn_must_use.rs:75:5 + --> $DIR/fn_must_use.rs:78:5 | -75 | m == n; +78 | m == n; //~ WARN unused comparison | ^^^^^^ diff --git a/src/test/compile-fail/self-impl.rs b/src/test/ui/self-impl.rs similarity index 79% rename from src/test/compile-fail/self-impl.rs rename to src/test/ui/self-impl.rs index 860e69fcae..1494d9ca57 100644 --- a/src/test/compile-fail/self-impl.rs +++ b/src/test/ui/self-impl.rs @@ -32,12 +32,8 @@ impl Bar { fn f() { let _: <Self>::Baz = true; //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<Bar as Trait>::Baz` let _: Self::Baz = true; //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<Bar as Trait>::Baz` } } diff --git a/src/test/ui/self-impl.stderr b/src/test/ui/self-impl.stderr new file mode 100644 index 0000000000..e1be5c18a6 --- /dev/null +++ b/src/test/ui/self-impl.stderr @@ -0,0 +1,18 @@ +error[E0223]: ambiguous associated type + --> $DIR/self-impl.rs:33:16 + | +33 | let _: <Self>::Baz = true; + | ^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<Bar as Trait>::Baz` + +error[E0223]: ambiguous associated type + --> $DIR/self-impl.rs:35:16 + | +35 | let _: Self::Baz = true; + | ^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<Bar as Trait>::Baz` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/shadowed-lifetime.rs b/src/test/ui/shadowed-lifetime.rs similarity index 87% rename from src/test/compile-fail/shadowed-lifetime.rs rename to src/test/ui/shadowed-lifetime.rs index 31283623a3..63e4038398 100644 --- a/src/test/compile-fail/shadowed-lifetime.rs +++ b/src/test/ui/shadowed-lifetime.rs @@ -13,18 +13,14 @@ struct Foo<'a>(&'a isize); impl<'a> Foo<'a> { - //~^ NOTE first declared here fn shadow_in_method<'a>(&'a self) -> &'a isize { //~^ ERROR lifetime name `'a` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'a already in scope self.0 } fn shadow_in_type<'b>(&'b self) -> &'b isize { - //~^ NOTE first declared here let x: for<'b> fn(&'b isize) = panic!(); //~^ ERROR lifetime name `'b` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'b already in scope self.0 } diff --git a/src/test/ui/shadowed-lifetime.stderr b/src/test/ui/shadowed-lifetime.stderr new file mode 100644 index 0000000000..8eaa3e5956 --- /dev/null +++ b/src/test/ui/shadowed-lifetime.stderr @@ -0,0 +1,18 @@ +error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope + --> $DIR/shadowed-lifetime.rs:16:25 + | +15 | impl<'a> Foo<'a> { + | -- first declared here +16 | fn shadow_in_method<'a>(&'a self) -> &'a isize { + | ^^ lifetime 'a already in scope + +error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scope + --> $DIR/shadowed-lifetime.rs:22:20 + | +21 | fn shadow_in_type<'b>(&'b self) -> &'b isize { + | -- first declared here +22 | let x: for<'b> fn(&'b isize) = panic!(); + | ^^ lifetime 'b already in scope + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/similar-tokens.rs b/src/test/ui/similar-tokens.rs index 986382bc8e..eb7eab9e42 100644 --- a/src/test/ui/similar-tokens.rs +++ b/src/test/ui/similar-tokens.rs @@ -14,6 +14,6 @@ mod x { } // `.` is similar to `,` so list parsing should continue to closing `}` -use x::{A. B}; +use x::{A. B}; //~ ERROR expected one of `,`, `::`, or `as`, found `.` fn main() {} diff --git a/src/test/ui/similar-tokens.stderr b/src/test/ui/similar-tokens.stderr index cf0ed646db..b4968b1018 100644 --- a/src/test/ui/similar-tokens.stderr +++ b/src/test/ui/similar-tokens.stderr @@ -1,8 +1,8 @@ -error: expected one of `,` or `as`, found `.` +error: expected one of `,`, `::`, or `as`, found `.` --> $DIR/similar-tokens.rs:17:10 | -17 | use x::{A. B}; - | ^ expected one of `,` or `as` here +17 | use x::{A. B}; //~ ERROR expected one of `,`, `::`, or `as`, found `.` + | ^ expected one of `,`, `::`, or `as` here error: aborting due to previous error diff --git a/src/test/ui/span/E0046.rs b/src/test/ui/span/E0046.rs index 9e757860a8..53813a4f58 100644 --- a/src/test/ui/span/E0046.rs +++ b/src/test/ui/span/E0046.rs @@ -10,14 +10,12 @@ trait Foo { fn foo(); - //~^ NOTE `foo` from trait } struct Bar; impl Foo for Bar {} //~^ ERROR E0046 -//~| NOTE missing `foo` in implementation fn main() { } diff --git a/src/test/ui/span/E0046.stderr b/src/test/ui/span/E0046.stderr index 729a515612..fb13f21fe0 100644 --- a/src/test/ui/span/E0046.stderr +++ b/src/test/ui/span/E0046.stderr @@ -1,11 +1,11 @@ error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/E0046.rs:18:1 + --> $DIR/E0046.rs:17:1 | 12 | fn foo(); | --------- `foo` from trait ... -18 | impl Foo for Bar {} - | ^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation +17 | impl Foo for Bar {} + | ^^^^^^^^^^^^^^^^ missing `foo` in implementation error: aborting due to previous error diff --git a/src/test/ui/span/E0057.stderr b/src/test/ui/span/E0057.stderr index 0d6b0a552e..450c87ca03 100644 --- a/src/test/ui/span/E0057.stderr +++ b/src/test/ui/span/E0057.stderr @@ -5,10 +5,10 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/E0057.rs:15:15 + --> $DIR/E0057.rs:15:13 | 15 | let c = f(2, 3); //~ ERROR E0057 - | ^^^^ expected 1 parameter + | ^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/span/E0072.rs b/src/test/ui/span/E0072.rs index 18ade4f1ab..554dfc619d 100644 --- a/src/test/ui/span/E0072.rs +++ b/src/test/ui/span/E0072.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct ListNode { +struct ListNode { //~ ERROR has infinite size head: u8, tail: Option<ListNode>, } diff --git a/src/test/ui/span/E0072.stderr b/src/test/ui/span/E0072.stderr index 1f6dd6b1d1..82b8579d5a 100644 --- a/src/test/ui/span/E0072.stderr +++ b/src/test/ui/span/E0072.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `ListNode` has infinite size --> $DIR/E0072.rs:11:1 | -11 | struct ListNode { +11 | struct ListNode { //~ ERROR has infinite size | ^^^^^^^^^^^^^^^ recursive type has infinite size 12 | head: u8, 13 | tail: Option<ListNode>, diff --git a/src/test/ui/span/E0204.rs b/src/test/ui/span/E0204.rs index 9fb37607c7..0ad6b67330 100644 --- a/src/test/ui/span/E0204.rs +++ b/src/test/ui/span/E0204.rs @@ -12,9 +12,9 @@ struct Foo { foo: Vec<u32>, } -impl Copy for Foo { } +impl Copy for Foo { } //~ ERROR may not be implemented for this type -#[derive(Copy)] +#[derive(Copy)] //~ ERROR may not be implemented for this type struct Foo2<'a> { ty: &'a mut bool, } @@ -24,9 +24,9 @@ enum EFoo { Baz, } -impl Copy for EFoo { } +impl Copy for EFoo { } //~ ERROR may not be implemented for this type -#[derive(Copy)] +#[derive(Copy)] //~ ERROR may not be implemented for this type enum EFoo2<'a> { Bar(&'a mut bool), Baz, diff --git a/src/test/ui/span/E0204.stderr b/src/test/ui/span/E0204.stderr index 4fe6afaca8..0d9617c4c7 100644 --- a/src/test/ui/span/E0204.stderr +++ b/src/test/ui/span/E0204.stderr @@ -4,13 +4,13 @@ error[E0204]: the trait `Copy` may not be implemented for this type 12 | foo: Vec<u32>, | ------------- this field does not implement `Copy` ... -15 | impl Copy for Foo { } +15 | impl Copy for Foo { } //~ ERROR may not be implemented for this type | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/E0204.rs:17:10 | -17 | #[derive(Copy)] +17 | #[derive(Copy)] //~ ERROR may not be implemented for this type | ^^^^ 18 | struct Foo2<'a> { 19 | ty: &'a mut bool, @@ -22,13 +22,13 @@ error[E0204]: the trait `Copy` may not be implemented for this type 23 | Bar { x: Vec<u32> }, | ----------- this field does not implement `Copy` ... -27 | impl Copy for EFoo { } +27 | impl Copy for EFoo { } //~ ERROR may not be implemented for this type | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/E0204.rs:29:10 | -29 | #[derive(Copy)] +29 | #[derive(Copy)] //~ ERROR may not be implemented for this type | ^^^^ 30 | enum EFoo2<'a> { 31 | Bar(&'a mut bool), diff --git a/src/test/ui/span/E0493.rs b/src/test/ui/span/E0493.rs index 7915564caf..de81068e26 100644 --- a/src/test/ui/span/E0493.rs +++ b/src/test/ui/span/E0493.rs @@ -25,6 +25,7 @@ impl Drop for Bar { } const F : Foo = (Foo { a : 0 }, Foo { a : 1 }).1; +//~^ destructors cannot be evaluated at compile-time fn main() { } diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs index 29fea052b0..8e03c303e5 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs @@ -21,11 +21,8 @@ struct Test<'a> { fn call<F>(mut f: F) where F: FnMut(Fn) { f(Box::new(|| { //~^ ERROR: cannot borrow `f` as mutable more than once - //~| NOTE first mutable borrow occurs here - //~| NOTE second mutable borrow occurs here f((Box::new(|| {}))) })); - //~^ NOTE first borrow ends here } fn test1() { @@ -35,10 +32,8 @@ fn test1() { } fn test2<F>(f: &F) where F: FnMut() { - //~^ NOTE use `&mut F` here to make mutable (*f)(); //~^ ERROR cannot borrow immutable borrowed content `*f` as mutable - //~| NOTE cannot borrow as mutable } fn test3<F>(f: &mut F) where F: FnMut() { @@ -46,10 +41,8 @@ fn test3<F>(f: &mut F) where F: FnMut() { } fn test4(f: &Test) { - //~^ NOTE use `&mut Test` here to make mutable f.f.call_mut(()) - //~^ ERROR: cannot borrow immutable `Box` content `*f.f` as mutable - //~| NOTE cannot borrow as mutable + //~^ ERROR: cannot borrow `Box` content `*f.f` of immutable binding as mutable } fn test5(f: &mut Test) { @@ -66,14 +59,10 @@ fn test6() { fn test7() { fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {} let mut f = |g: Box<FnMut(isize)>, b: isize| {}; - //~^ NOTE moved f(Box::new(|a| { - //~^ NOTE borrow of `f` occurs here foo(f); //~^ ERROR cannot move `f` into closure because it is borrowed //~| ERROR cannot move out of captured outer variable in an `FnMut` closure - //~| NOTE move into closure occurs here - //~| NOTE cannot move out of captured outer variable in an `FnMut` closure }), 3); } diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 6e7d0c17f1..581b366af1 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -5,46 +5,43 @@ error[E0499]: cannot borrow `f` as mutable more than once at a time | - ^^ second mutable borrow occurs here | | | first mutable borrow occurs here -... -26 | f((Box::new(|| {}))) +23 | //~^ ERROR: cannot borrow `f` as mutable more than once +24 | f((Box::new(|| {}))) | - borrow occurs due to use of `f` in closure -27 | })); +25 | })); | - first borrow ends here error[E0596]: cannot borrow immutable borrowed content `*f` as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:39:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:35:5 | -37 | fn test2<F>(f: &F) where F: FnMut() { +34 | fn test2<F>(f: &F) where F: FnMut() { | -- use `&mut F` here to make mutable -38 | //~^ NOTE use `&mut F` here to make mutable -39 | (*f)(); +35 | (*f)(); | ^^^^ cannot borrow as mutable -error[E0596]: cannot borrow immutable `Box` content `*f.f` as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:50:5 +error[E0596]: cannot borrow `Box` content `*f.f` of immutable binding as mutable + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:44:5 | -48 | fn test4(f: &Test) { +43 | fn test4(f: &Test) { | ----- use `&mut Test` here to make mutable -49 | //~^ NOTE use `&mut Test` here to make mutable -50 | f.f.call_mut(()) +44 | f.f.call_mut(()) | ^^^ cannot borrow as mutable error[E0504]: cannot move `f` into closure because it is borrowed - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:72:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13 | -70 | f(Box::new(|a| { +62 | f(Box::new(|a| { | - borrow of `f` occurs here -71 | //~^ NOTE borrow of `f` occurs here -72 | foo(f); +63 | foo(f); | ^ move into closure occurs here error[E0507]: cannot move out of captured outer variable in an `FnMut` closure - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:72:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13 | -68 | let mut f = |g: Box<FnMut(isize)>, b: isize| {}; +61 | let mut f = |g: Box<FnMut(isize)>, b: isize| {}; | ----- captured outer variable -... -72 | foo(f); +62 | f(Box::new(|a| { +63 | foo(f); | ^ cannot move out of captured outer variable in an `FnMut` closure error: aborting due to 5 previous errors diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs index 9e316b989a..8a27af0119 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs @@ -19,14 +19,16 @@ fn f() { let young = ['y']; // statement 3 v2.push(&young[0]); // statement 4 - //~^ NOTE borrow occurs here + //~^ ERROR `young[..]` does not live long enough + //~| NOTE borrowed value does not live long enough + //~| NOTE values in a scope are dropped in the opposite order they are created let mut v3 = Vec::new(); // statement 5 v3.push(&id('x')); // statement 6 //~^ ERROR borrowed value does not live long enough - //~| NOTE temporary value created here - //~| NOTE temporary value only lives until here + //~| NOTE temporary value does not live long enough + //~| NOTE temporary value dropped here while still borrowed //~| NOTE consider using a `let` binding to increase its lifetime { @@ -35,8 +37,8 @@ fn f() { v4.push(&id('y')); //~^ ERROR borrowed value does not live long enough - //~| NOTE temporary value created here - //~| NOTE temporary value only lives until here + //~| NOTE temporary value does not live long enough + //~| NOTE temporary value dropped here while still borrowed //~| NOTE consider using a `let` binding to increase its lifetime } // (statement 7) @@ -46,15 +48,13 @@ fn f() { v5.push(&id('z')); //~^ ERROR borrowed value does not live long enough - //~| NOTE temporary value created here - //~| NOTE temporary value only lives until here + //~| NOTE temporary value does not live long enough + //~| NOTE temporary value dropped here while still borrowed //~| NOTE consider using a `let` binding to increase its lifetime v1.push(&old[0]); } -//~^ ERROR `young[..]` does not live long enough -//~| NOTE `young[..]` dropped here while still borrowed -//~| NOTE values in a scope are dropped in the opposite order they are created +//~^ NOTE `young[..]` dropped here while still borrowed //~| NOTE temporary value needs to live until here //~| NOTE temporary value needs to live until here diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr index 86c6f28ef1..e65fd723e5 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr @@ -1,49 +1,49 @@ error[E0597]: `young[..]` does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:54:1 + --> $DIR/borrowck-let-suggestion-suffixes.rs:21:14 | 21 | v2.push(&young[0]); // statement 4 - | -------- borrow occurs here + | ^^^^^^^^ borrowed value does not live long enough ... -54 | } - | ^ `young[..]` dropped here while still borrowed +56 | } + | - `young[..]` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:26:22 + --> $DIR/borrowck-let-suggestion-suffixes.rs:28:14 | -26 | v3.push(&id('x')); // statement 6 - | ------- ^ temporary value dropped here while still borrowed +28 | v3.push(&id('x')); // statement 6 + | ^^^^^^^ - temporary value dropped here while still borrowed | | - | temporary value created here + | temporary value does not live long enough ... -54 | } +56 | } | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:36:26 + --> $DIR/borrowck-let-suggestion-suffixes.rs:38:18 | -36 | v4.push(&id('y')); - | ------- ^ temporary value dropped here while still borrowed +38 | v4.push(&id('y')); + | ^^^^^^^ - temporary value dropped here while still borrowed | | - | temporary value created here + | temporary value does not live long enough ... -42 | } // (statement 7) +44 | } // (statement 7) | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:47:22 + --> $DIR/borrowck-let-suggestion-suffixes.rs:49:14 | -47 | v5.push(&id('z')); - | ------- ^ temporary value dropped here while still borrowed +49 | v5.push(&id('z')); + | ^^^^^^^ - temporary value dropped here while still borrowed | | - | temporary value created here + | temporary value does not live long enough ... -54 | } +56 | } | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.rs b/src/test/ui/span/borrowck-ref-into-rvalue.rs index 726d4bcdf1..7f07a09358 100644 --- a/src/test/ui/span/borrowck-ref-into-rvalue.rs +++ b/src/test/ui/span/borrowck-ref-into-rvalue.rs @@ -11,7 +11,8 @@ fn main() { let msg; match Some("Hello".to_string()) { - Some(ref m) => { //~ ERROR borrowed value does not live long enough + Some(ref m) => { + //~^ ERROR borrowed value does not live long enough msg = m; }, None => { panic!() } diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.stderr index ced1f762af..80ddd15075 100644 --- a/src/test/ui/span/borrowck-ref-into-rvalue.stderr +++ b/src/test/ui/span/borrowck-ref-into-rvalue.stderr @@ -1,13 +1,13 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-ref-into-rvalue.rs:18:5 + --> $DIR/borrowck-ref-into-rvalue.rs:14:14 | -14 | Some(ref m) => { //~ ERROR borrowed value does not live long enough - | ----- borrow occurs here +14 | Some(ref m) => { + | ^^^^^ borrowed value does not live long enough ... -18 | } - | ^ borrowed value dropped here while still borrowed -19 | println!("{}", *msg); -20 | } +19 | } + | - borrowed value dropped here while still borrowed +20 | println!("{}", *msg); +21 | } | - borrowed value needs to live until here | = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/span/coerce-suggestions.rs b/src/test/ui/span/coerce-suggestions.rs index 32d80069f0..95461ee809 100644 --- a/src/test/ui/span/coerce-suggestions.rs +++ b/src/test/ui/span/coerce-suggestions.rs @@ -16,39 +16,17 @@ fn test2(_x: &mut i32) {} fn main() { let x: usize = String::new(); //~^ ERROR E0308 - //~| NOTE expected usize, found struct `std::string::String` - //~| NOTE expected type `usize` - //~| NOTE found type `std::string::String` - //~| HELP here are some functions which might fulfill your needs: let x: &str = String::new(); //~^ ERROR E0308 - //~| NOTE expected &str, found struct `std::string::String` - //~| NOTE expected type `&str` - //~| NOTE found type `std::string::String` - //~| HELP try with `&String::new()` let y = String::new(); test(&y); //~^ ERROR E0308 - //~| NOTE types differ in mutability - //~| NOTE expected type `&mut std::string::String` - //~| NOTE found type `&std::string::String` test2(&y); //~^ ERROR E0308 - //~| NOTE types differ in mutability - //~| NOTE expected type `&mut i32` - //~| NOTE found type `&std::string::String` let f; f = box f; //~^ ERROR E0308 - //~| NOTE cyclic type of infinite size - //~| NOTE expected type `_` - //~| NOTE found type `Box<_>` let s = &mut String::new(); s = format!("foo"); - //~^ ERROR E0308 - //~| NOTE expected mutable reference, found struct `std::string::String` - //~| NOTE expected type `&mut std::string::String` - //~| HELP try with `&mut format!("foo")` - //~| NOTE this error originates in a macro outside of the current crate } diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index b703632bf9..0785261976 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -11,52 +11,53 @@ error[E0308]: mismatched types - .len() error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:23:19 + --> $DIR/coerce-suggestions.rs:19:19 | -23 | let x: &str = String::new(); - | ^^^^^^^^^^^^^ expected &str, found struct `std::string::String` +19 | let x: &str = String::new(); + | ^^^^^^^^^^^^^ + | | + | expected &str, found struct `std::string::String` + | help: consider borrowing here: `&String::new()` | = note: expected type `&str` found type `std::string::String` - = help: try with `&String::new()` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:30:10 + --> $DIR/coerce-suggestions.rs:22:10 | -30 | test(&y); +22 | test(&y); | ^^ types differ in mutability | = note: expected type `&mut std::string::String` found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:35:11 + --> $DIR/coerce-suggestions.rs:24:11 | -35 | test2(&y); +24 | test2(&y); | ^^ types differ in mutability | = note: expected type `&mut i32` found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:41:9 + --> $DIR/coerce-suggestions.rs:27:9 | -41 | f = box f; +27 | f = box f; | ^^^^^ cyclic type of infinite size - | - = note: expected type `_` - found type `std::boxed::Box<_>` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:48:9 + --> $DIR/coerce-suggestions.rs:31:9 | -48 | s = format!("foo"); - | ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String` +31 | s = format!("foo"); + | ^^^^^^^^^^^^^^ + | | + | expected mutable reference, found struct `std::string::String` + | help: consider mutably borrowing here: `&mut format!("foo")` | = note: expected type `&mut std::string::String` found type `std::string::String` - = help: try with `&mut format!("foo")` - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 6 previous errors diff --git a/src/test/ui/span/destructor-restrictions.rs b/src/test/ui/span/destructor-restrictions.rs index 22f615cafd..d20194422f 100644 --- a/src/test/ui/span/destructor-restrictions.rs +++ b/src/test/ui/span/destructor-restrictions.rs @@ -15,7 +15,7 @@ use std::cell::RefCell; fn main() { let b = { let a = Box::new(RefCell::new(4)); - *a.borrow() + 1 //~ ERROR `*a` does not live long enough - }; + *a.borrow() + 1 + }; //~^ ERROR `*a` does not live long enough println!("{}", b); } diff --git a/src/test/ui/span/destructor-restrictions.stderr b/src/test/ui/span/destructor-restrictions.stderr index ee88545416..abe982c5ce 100644 --- a/src/test/ui/span/destructor-restrictions.stderr +++ b/src/test/ui/span/destructor-restrictions.stderr @@ -1,10 +1,10 @@ error[E0597]: `*a` does not live long enough - --> $DIR/destructor-restrictions.rs:19:5 + --> $DIR/destructor-restrictions.rs:18:10 | -18 | *a.borrow() + 1 //~ ERROR `*a` does not live long enough - | - borrow occurs here -19 | }; - | ^- borrowed value needs to live until here +18 | *a.borrow() + 1 + | ^ borrowed value does not live long enough +19 | }; //~^ ERROR `*a` does not live long enough + | -- borrowed value needs to live until here | | | `*a` dropped here while still borrowed diff --git a/src/test/ui/span/dropck-object-cycle.rs b/src/test/ui/span/dropck-object-cycle.rs index ce9bc17432..b2871342e8 100644 --- a/src/test/ui/span/dropck-object-cycle.rs +++ b/src/test/ui/span/dropck-object-cycle.rs @@ -35,7 +35,7 @@ impl<'t> MakerTrait for Box<Trait<'t>+'static> { pub fn main() { let m : Box<Trait+'static> = make_val(); assert_eq!(object_invoke1(&*m), (4,5)); - //~^ NOTE borrow occurs here + //~^ ERROR `*m` does not live long enough // the problem here is that the full type of `m` is // @@ -55,7 +55,4 @@ pub fn main() { // the type of `m` *strictly outlives* `'m`. Hence we get an // error. } -//~^ ERROR `*m` does not live long enough -//~| NOTE `*m` dropped here while still borrowed -//~| NOTE values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/dropck-object-cycle.stderr b/src/test/ui/span/dropck-object-cycle.stderr index 49115b244e..2b760415a1 100644 --- a/src/test/ui/span/dropck-object-cycle.stderr +++ b/src/test/ui/span/dropck-object-cycle.stderr @@ -1,11 +1,11 @@ error[E0597]: `*m` does not live long enough - --> $DIR/dropck-object-cycle.rs:57:1 + --> $DIR/dropck-object-cycle.rs:37:32 | 37 | assert_eq!(object_invoke1(&*m), (4,5)); - | -- borrow occurs here + | ^^ borrowed value does not live long enough ... 57 | } - | ^ `*m` dropped here while still borrowed + | - `*m` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/dropck_arr_cycle_checked.rs b/src/test/ui/span/dropck_arr_cycle_checked.rs index 995a198271..6bf2ae978a 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.rs +++ b/src/test/ui/span/dropck_arr_cycle_checked.rs @@ -13,7 +13,7 @@ // // (Compare against compile-fail/dropck_vec_cycle_checked.rs) -#![feature(const_atomic_usize_new)] + use std::cell::Cell; use id::Id; @@ -101,18 +101,18 @@ fn f() { b2 = B::new(); b3 = B::new(); b1.a[0].v.set(Some(&b2)); + //~^ ERROR `b2` does not live long enough b1.a[1].v.set(Some(&b3)); + //~^ ERROR `b3` does not live long enough b2.a[0].v.set(Some(&b2)); + //~^ ERROR `b2` does not live long enough b2.a[1].v.set(Some(&b3)); + //~^ ERROR `b3` does not live long enough b3.a[0].v.set(Some(&b1)); + //~^ ERROR `b1` does not live long enough b3.a[1].v.set(Some(&b2)); + //~^ ERROR `b2` does not live long enough } -//~^ ERROR `b2` does not live long enough -//~| ERROR `b3` does not live long enough -//~| ERROR `b2` does not live long enough -//~| ERROR `b3` does not live long enough -//~| ERROR `b1` does not live long enough -//~| ERROR `b2` does not live long enough fn main() { f(); diff --git a/src/test/ui/span/dropck_arr_cycle_checked.stderr b/src/test/ui/span/dropck_arr_cycle_checked.stderr index 4179ac1a94..1225c36ab3 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.stderr +++ b/src/test/ui/span/dropck_arr_cycle_checked.stderr @@ -1,65 +1,66 @@ error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:109:1 + --> $DIR/dropck_arr_cycle_checked.rs:103:25 | 103 | b1.a[0].v.set(Some(&b2)); - | -- borrow occurs here + | ^^ borrowed value does not live long enough ... -109 | } - | ^ `b2` dropped here while still borrowed +115 | } + | - `b2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b3` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:109:1 + --> $DIR/dropck_arr_cycle_checked.rs:105:25 | -104 | b1.a[1].v.set(Some(&b3)); - | -- borrow occurs here +105 | b1.a[1].v.set(Some(&b3)); + | ^^ borrowed value does not live long enough ... -109 | } - | ^ `b3` dropped here while still borrowed +115 | } + | - `b3` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:109:1 + --> $DIR/dropck_arr_cycle_checked.rs:107:25 | -105 | b2.a[0].v.set(Some(&b2)); - | -- borrow occurs here +107 | b2.a[0].v.set(Some(&b2)); + | ^^ borrowed value does not live long enough ... -109 | } - | ^ `b2` dropped here while still borrowed +115 | } + | - `b2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b3` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:109:1 + --> $DIR/dropck_arr_cycle_checked.rs:109:25 | -106 | b2.a[1].v.set(Some(&b3)); - | -- borrow occurs here +109 | b2.a[1].v.set(Some(&b3)); + | ^^ borrowed value does not live long enough ... -109 | } - | ^ `b3` dropped here while still borrowed +115 | } + | - `b3` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b1` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:109:1 + --> $DIR/dropck_arr_cycle_checked.rs:111:25 | -107 | b3.a[0].v.set(Some(&b1)); - | -- borrow occurs here -108 | b3.a[1].v.set(Some(&b2)); -109 | } - | ^ `b1` dropped here while still borrowed +111 | b3.a[0].v.set(Some(&b1)); + | ^^ borrowed value does not live long enough +... +115 | } + | - `b1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:109:1 + --> $DIR/dropck_arr_cycle_checked.rs:113:25 | -108 | b3.a[1].v.set(Some(&b2)); - | -- borrow occurs here -109 | } - | ^ `b2` dropped here while still borrowed +113 | b3.a[1].v.set(Some(&b2)); + | ^^ borrowed value does not live long enough +114 | //~^ ERROR `b2` does not live long enough +115 | } + | - `b2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.rs b/src/test/ui/span/dropck_direct_cycle_with_drop.rs index 6d13dfc7a7..0c6ebd5c8d 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.rs +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.rs @@ -44,10 +44,10 @@ impl<'a> Drop for D<'a> { fn g() { let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2"))); d1.p.set(Some(&d2)); + //~^ ERROR `d2` does not live long enough d2.p.set(Some(&d1)); + //~^ ERROR `d1` does not live long enough } -//~^ ERROR `d2` does not live long enough -//~| ERROR `d1` does not live long enough fn main() { g(); diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr index 597d42aabd..462b291f4f 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr @@ -1,21 +1,22 @@ error[E0597]: `d2` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:48:1 + --> $DIR/dropck_direct_cycle_with_drop.rs:46:20 | 46 | d1.p.set(Some(&d2)); - | -- borrow occurs here -47 | d2.p.set(Some(&d1)); -48 | } - | ^ `d2` dropped here while still borrowed + | ^^ borrowed value does not live long enough +... +50 | } + | - `d2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `d1` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:48:1 + --> $DIR/dropck_direct_cycle_with_drop.rs:48:20 | -47 | d2.p.set(Some(&d1)); - | -- borrow occurs here -48 | } - | ^ `d1` dropped here while still borrowed +48 | d2.p.set(Some(&d1)); + | ^^ borrowed value does not live long enough +49 | //~^ ERROR `d1` does not live long enough +50 | } + | - `d1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/dropck_misc_variants.rs b/src/test/ui/span/dropck_misc_variants.rs index 7b94eb10df..a98cce32e9 100644 --- a/src/test/ui/span/dropck_misc_variants.rs +++ b/src/test/ui/span/dropck_misc_variants.rs @@ -32,16 +32,16 @@ fn projection() { bomb = vec![""]; _w = Wrap::<&[&str]>(NoisyDrop(&bomb)); } -//~^ ERROR `bomb` does not live long enough +//~^^ ERROR `bomb` does not live long enough fn closure() { let (_w,v); v = vec![""]; _w = { let u = NoisyDrop(&v); + //~^ ERROR `v` does not live long enough move || u.0.len() }; } -//~^ ERROR `v` does not live long enough fn main() { closure(); projection() } diff --git a/src/test/ui/span/dropck_misc_variants.stderr b/src/test/ui/span/dropck_misc_variants.stderr index 958f229f65..b839701f08 100644 --- a/src/test/ui/span/dropck_misc_variants.stderr +++ b/src/test/ui/span/dropck_misc_variants.stderr @@ -1,21 +1,21 @@ error[E0597]: `bomb` does not live long enough - --> $DIR/dropck_misc_variants.rs:34:1 + --> $DIR/dropck_misc_variants.rs:33:37 | 33 | _w = Wrap::<&[&str]>(NoisyDrop(&bomb)); - | ---- borrow occurs here + | ^^^^ borrowed value does not live long enough 34 | } - | ^ `bomb` dropped here while still borrowed + | - `bomb` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `v` does not live long enough - --> $DIR/dropck_misc_variants.rs:44:1 + --> $DIR/dropck_misc_variants.rs:41:28 | 41 | let u = NoisyDrop(&v); - | - borrow occurs here + | ^ borrowed value does not live long enough ... -44 | } - | ^ `v` dropped here while still borrowed +45 | } + | - `v` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs index 5bcaa71f73..0560900e85 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.rs +++ b/src/test/ui/span/dropck_vec_cycle_checked.rs @@ -12,7 +12,7 @@ // // (Compare against compile-fail/dropck_arr_cycle_checked.rs) -#![feature(const_atomic_usize_new)] + use std::cell::Cell; use id::Id; @@ -108,18 +108,18 @@ fn f() { c3.v.push(CheckId(Cell::new(None))); c1.v[0].v.set(Some(&c2)); + //~^ ERROR `c2` does not live long enough c1.v[1].v.set(Some(&c3)); + //~^ ERROR `c3` does not live long enough c2.v[0].v.set(Some(&c2)); + //~^ ERROR `c2` does not live long enough c2.v[1].v.set(Some(&c3)); + //~^ ERROR `c3` does not live long enough c3.v[0].v.set(Some(&c1)); + //~^ ERROR `c1` does not live long enough c3.v[1].v.set(Some(&c2)); + //~^ ERROR `c2` does not live long enough } -//~^ ERROR `c2` does not live long enough -//~| ERROR `c3` does not live long enough -//~| ERROR `c2` does not live long enough -//~| ERROR `c3` does not live long enough -//~| ERROR `c1` does not live long enough -//~| ERROR `c2` does not live long enough fn main() { f(); diff --git a/src/test/ui/span/dropck_vec_cycle_checked.stderr b/src/test/ui/span/dropck_vec_cycle_checked.stderr index d7d0fe5323..799dfb8e20 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.stderr +++ b/src/test/ui/span/dropck_vec_cycle_checked.stderr @@ -1,65 +1,66 @@ error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:116:1 + --> $DIR/dropck_vec_cycle_checked.rs:110:25 | 110 | c1.v[0].v.set(Some(&c2)); - | -- borrow occurs here + | ^^ borrowed value does not live long enough ... -116 | } - | ^ `c2` dropped here while still borrowed +122 | } + | - `c2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c3` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:116:1 + --> $DIR/dropck_vec_cycle_checked.rs:112:25 | -111 | c1.v[1].v.set(Some(&c3)); - | -- borrow occurs here +112 | c1.v[1].v.set(Some(&c3)); + | ^^ borrowed value does not live long enough ... -116 | } - | ^ `c3` dropped here while still borrowed +122 | } + | - `c3` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:116:1 + --> $DIR/dropck_vec_cycle_checked.rs:114:25 | -112 | c2.v[0].v.set(Some(&c2)); - | -- borrow occurs here +114 | c2.v[0].v.set(Some(&c2)); + | ^^ borrowed value does not live long enough ... -116 | } - | ^ `c2` dropped here while still borrowed +122 | } + | - `c2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c3` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:116:1 + --> $DIR/dropck_vec_cycle_checked.rs:116:25 | -113 | c2.v[1].v.set(Some(&c3)); - | -- borrow occurs here +116 | c2.v[1].v.set(Some(&c3)); + | ^^ borrowed value does not live long enough ... -116 | } - | ^ `c3` dropped here while still borrowed +122 | } + | - `c3` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c1` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:116:1 + --> $DIR/dropck_vec_cycle_checked.rs:118:25 | -114 | c3.v[0].v.set(Some(&c1)); - | -- borrow occurs here -115 | c3.v[1].v.set(Some(&c2)); -116 | } - | ^ `c1` dropped here while still borrowed +118 | c3.v[0].v.set(Some(&c1)); + | ^^ borrowed value does not live long enough +... +122 | } + | - `c1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:116:1 + --> $DIR/dropck_vec_cycle_checked.rs:120:25 | -115 | c3.v[1].v.set(Some(&c2)); - | -- borrow occurs here -116 | } - | ^ `c2` dropped here while still borrowed +120 | c3.v[1].v.set(Some(&c2)); + | ^^ borrowed value does not live long enough +121 | //~^ ERROR `c2` does not live long enough +122 | } + | - `c2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/gated-features-attr-spans.rs b/src/test/ui/span/gated-features-attr-spans.rs index d5ccd2ea7a..ace185d016 100644 --- a/src/test/ui/span/gated-features-attr-spans.rs +++ b/src/test/ui/span/gated-features-attr-spans.rs @@ -10,14 +10,14 @@ #![feature(attr_literals)] -#[repr(align(16))] +#[repr(align(16))] //~ ERROR is experimental struct Gem { mohs_hardness: u8, poofed: bool, weapon: Weapon, } -#[repr(simd)] +#[repr(simd)] //~ ERROR are experimental struct Weapon { name: String, damage: u32 @@ -25,9 +25,10 @@ struct Weapon { impl Gem { #[must_use] fn summon_weapon(&self) -> Weapon { self.weapon } + //~^ WARN is experimental } -#[must_use] +#[must_use] //~ WARN is experimental fn bubble(gem: Gem) -> Result<Gem, ()> { if gem.poofed { Ok(gem) diff --git a/src/test/ui/span/gated-features-attr-spans.stderr b/src/test/ui/span/gated-features-attr-spans.stderr index 66b2567f72..d067470942 100644 --- a/src/test/ui/span/gated-features-attr-spans.stderr +++ b/src/test/ui/span/gated-features-attr-spans.stderr @@ -1,7 +1,7 @@ error: the struct `#[repr(align(u16))]` attribute is experimental (see issue #33626) --> $DIR/gated-features-attr-spans.rs:13:1 | -13 | #[repr(align(16))] +13 | #[repr(align(16))] //~ ERROR is experimental | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(repr_align)] to the crate attributes to enable @@ -9,7 +9,7 @@ error: the struct `#[repr(align(u16))]` attribute is experimental (see issue #33 error: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/gated-features-attr-spans.rs:20:1 | -20 | #[repr(simd)] +20 | #[repr(simd)] //~ ERROR are experimental | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable @@ -23,9 +23,9 @@ warning: `#[must_use]` on methods is experimental (see issue #43302) = help: add #![feature(fn_must_use)] to the crate attributes to enable warning: `#[must_use]` on functions is experimental (see issue #43302) - --> $DIR/gated-features-attr-spans.rs:30:1 + --> $DIR/gated-features-attr-spans.rs:31:1 | -30 | #[must_use] +31 | #[must_use] //~ WARN is experimental | ^^^^^^^^^^^ | = help: add #![feature(fn_must_use)] to the crate attributes to enable diff --git a/src/test/ui/span/impl-wrong-item-for-trait.rs b/src/test/ui/span/impl-wrong-item-for-trait.rs index 091df1d5dc..f86ee2b137 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.rs +++ b/src/test/ui/span/impl-wrong-item-for-trait.rs @@ -20,10 +20,8 @@ pub struct FooConstForMethod; impl Foo for FooConstForMethod { //~^ ERROR E0046 - //~| NOTE missing `bar` in implementation const bar: u64 = 1; //~^ ERROR E0323 - //~| NOTE does not match trait const MY_CONST: u32 = 1; } @@ -31,25 +29,23 @@ pub struct FooMethodForConst; impl Foo for FooMethodForConst { //~^ ERROR E0046 - //~| NOTE missing `MY_CONST` in implementation fn bar(&self) {} fn MY_CONST() {} //~^ ERROR E0324 - //~| NOTE does not match trait } pub struct FooTypeForMethod; impl Foo for FooTypeForMethod { //~^ ERROR E0046 - //~| NOTE missing `bar` in implementation type bar = u64; //~^ ERROR E0325 - //~| NOTE does not match trait + //~| ERROR E0437 const MY_CONST: u32 = 1; } impl Debug for FooTypeForMethod { } +//~^^ ERROR E0046 fn main () {} diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr index 5812cab0d0..6473b24dec 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.stderr +++ b/src/test/ui/span/impl-wrong-item-for-trait.stderr @@ -1,87 +1,68 @@ error[E0437]: type `bar` is not a member of trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:46:5 + --> $DIR/impl-wrong-item-for-trait.rs:41:5 | -46 | type bar = u64; +41 | type bar = u64; | ^^^^^^^^^^^^^^^ not a member of trait `Foo` error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:24:5 + --> $DIR/impl-wrong-item-for-trait.rs:23:5 | 15 | fn bar(&self); | -------------- item in trait ... -24 | const bar: u64 = 1; +23 | const bar: u64 = 1; | ^^^^^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `bar` --> $DIR/impl-wrong-item-for-trait.rs:21:1 | -15 | fn bar(&self); - | -------------- `bar` from trait +15 | fn bar(&self); + | -------------- `bar` from trait ... -21 | / impl Foo for FooConstForMethod { -22 | | //~^ ERROR E0046 -23 | | //~| NOTE missing `bar` in implementation -24 | | const bar: u64 = 1; -... | -27 | | const MY_CONST: u32 = 1; -28 | | } - | |_^ missing `bar` in implementation +21 | impl Foo for FooConstForMethod { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:36:5 + --> $DIR/impl-wrong-item-for-trait.rs:33:5 | 16 | const MY_CONST: u32; | -------------------- item in trait ... -36 | fn MY_CONST() {} +33 | fn MY_CONST() {} | ^^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `MY_CONST` - --> $DIR/impl-wrong-item-for-trait.rs:32:1 + --> $DIR/impl-wrong-item-for-trait.rs:30:1 | -16 | const MY_CONST: u32; - | -------------------- `MY_CONST` from trait +16 | const MY_CONST: u32; + | -------------------- `MY_CONST` from trait ... -32 | / impl Foo for FooMethodForConst { -33 | | //~^ ERROR E0046 -34 | | //~| NOTE missing `MY_CONST` in implementation -35 | | fn bar(&self) {} -... | -38 | | //~| NOTE does not match trait -39 | | } - | |_^ missing `MY_CONST` in implementation +30 | impl Foo for FooMethodForConst { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `MY_CONST` in implementation error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:46:5 + --> $DIR/impl-wrong-item-for-trait.rs:41:5 | 15 | fn bar(&self); | -------------- item in trait ... -46 | type bar = u64; +41 | type bar = u64; | ^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/impl-wrong-item-for-trait.rs:43:1 + --> $DIR/impl-wrong-item-for-trait.rs:39:1 | -15 | fn bar(&self); - | -------------- `bar` from trait +15 | fn bar(&self); + | -------------- `bar` from trait ... -43 | / impl Foo for FooTypeForMethod { -44 | | //~^ ERROR E0046 -45 | | //~| NOTE missing `bar` in implementation -46 | | type bar = u64; -... | -49 | | const MY_CONST: u32 = 1; -50 | | } - | |_^ missing `bar` in implementation +39 | impl Foo for FooTypeForMethod { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation error[E0046]: not all trait items implemented, missing: `fmt` - --> $DIR/impl-wrong-item-for-trait.rs:52:1 + --> $DIR/impl-wrong-item-for-trait.rs:47:1 | -52 | / impl Debug for FooTypeForMethod { -53 | | } - | |_^ missing `fmt` in implementation +47 | impl Debug for FooTypeForMethod { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` diff --git a/src/test/ui/span/issue-11925.rs b/src/test/ui/span/issue-11925.rs index 7bea8642cc..fd5625f689 100644 --- a/src/test/ui/span/issue-11925.rs +++ b/src/test/ui/span/issue-11925.rs @@ -15,7 +15,7 @@ fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f } fn main() { let r = { let x: Box<_> = box 42; - let f = to_fn_once(move|| &x); + let f = to_fn_once(move|| &x); //~ ERROR does not live long enough f() }; diff --git a/src/test/ui/span/issue-11925.stderr b/src/test/ui/span/issue-11925.stderr index 6b2942bc7a..01cd7661fb 100644 --- a/src/test/ui/span/issue-11925.stderr +++ b/src/test/ui/span/issue-11925.stderr @@ -1,10 +1,10 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-11925.rs:18:36 | -18 | let f = to_fn_once(move|| &x); +18 | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough | ^ | | - | borrow occurs here + | borrowed value does not live long enough | `x` dropped here while still borrowed ... 23 | } diff --git a/src/test/ui/span/issue-15480.rs b/src/test/ui/span/issue-15480.rs index 871e0af50b..2fbc63eb80 100644 --- a/src/test/ui/span/issue-15480.rs +++ b/src/test/ui/span/issue-15480.rs @@ -14,6 +14,7 @@ fn main() { let v = vec![ &id(3) ]; + //~^^ ERROR borrowed value does not live long enough for &&x in &v { println!("{}", x + 3); diff --git a/src/test/ui/span/issue-15480.stderr b/src/test/ui/span/issue-15480.stderr index 7f4ca19241..28841fbea9 100644 --- a/src/test/ui/span/issue-15480.stderr +++ b/src/test/ui/span/issue-15480.stderr @@ -1,12 +1,12 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-15480.rs:16:6 + --> $DIR/issue-15480.rs:15:10 | 15 | &id(3) - | ----- temporary value created here + | ^^^^^ temporary value does not live long enough 16 | ]; - | ^ temporary value dropped here while still borrowed + | - temporary value dropped here while still borrowed ... -21 | } +22 | } | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs index a04edd99b8..8f556d2881 100644 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs +++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs @@ -19,13 +19,14 @@ fn foo(x: RefCell<String>) -> String { let y = x; y.borrow().clone() } -//~^ ERROR `y` does not live long enough +//~^^ ERROR `y` does not live long enough fn foo2(x: RefCell<String>) -> String { let ret = { let y = x; - y.borrow().clone() //~ ERROR `y` does not live long enough + y.borrow().clone() }; + //~^^ ERROR `y` does not live long enough ret } diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr index 02c0331537..1c9a64bc21 100644 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr +++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr @@ -1,20 +1,20 @@ error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:21:1 + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5 | 20 | y.borrow().clone() - | - borrow occurs here + | ^ borrowed value does not live long enough 21 | } - | ^ `y` dropped here while still borrowed + | - `y` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:28:5 + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9 | -27 | y.borrow().clone() //~ ERROR `y` does not live long enough - | - borrow occurs here +27 | y.borrow().clone() + | ^ borrowed value does not live long enough 28 | }; - | ^- borrowed value needs to live until here + | -- borrowed value needs to live until here | | | `y` dropped here while still borrowed diff --git a/src/test/ui/span/issue-23729.rs b/src/test/ui/span/issue-23729.rs index 66134a03ba..e872fabfc2 100644 --- a/src/test/ui/span/issue-23729.rs +++ b/src/test/ui/span/issue-23729.rs @@ -19,8 +19,6 @@ fn main() { impl Iterator for Recurrence { //~^ ERROR E0046 - //~| NOTE missing `Item` in implementation - //~| NOTE `Item` from trait: `type Item;` #[inline] fn next(&mut self) -> Option<u64> { if self.pos < 2 { diff --git a/src/test/ui/span/issue-23729.stderr b/src/test/ui/span/issue-23729.stderr index d9f4bacce3..60bf804ff3 100644 --- a/src/test/ui/span/issue-23729.stderr +++ b/src/test/ui/span/issue-23729.stderr @@ -1,14 +1,8 @@ error[E0046]: not all trait items implemented, missing: `Item` --> $DIR/issue-23729.rs:20:9 | -20 | / impl Iterator for Recurrence { -21 | | //~^ ERROR E0046 -22 | | //~| NOTE missing `Item` in implementation -23 | | //~| NOTE `Item` from trait: `type Item;` -... | -36 | | } -37 | | } - | |_________^ missing `Item` in implementation +20 | impl Iterator for Recurrence { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation | = note: `Item` from trait: `type Item;` diff --git a/src/test/ui/span/issue-23827.rs b/src/test/ui/span/issue-23827.rs index 01269714c1..890f2623eb 100644 --- a/src/test/ui/span/issue-23827.rs +++ b/src/test/ui/span/issue-23827.rs @@ -35,8 +35,6 @@ impl<C: Component> FnMut<(C,)> for Prototype { impl<C: Component> FnOnce<(C,)> for Prototype { //~^ ERROR E0046 - //~| NOTE missing `Output` in implementation - //~| NOTE `Output` from trait: `type Output;` extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype { Fn::call(&self, (comp,)) } diff --git a/src/test/ui/span/issue-23827.stderr b/src/test/ui/span/issue-23827.stderr index 3127af157a..d06d6c0361 100644 --- a/src/test/ui/span/issue-23827.stderr +++ b/src/test/ui/span/issue-23827.stderr @@ -1,14 +1,8 @@ error[E0046]: not all trait items implemented, missing: `Output` --> $DIR/issue-23827.rs:36:1 | -36 | / impl<C: Component> FnOnce<(C,)> for Prototype { -37 | | //~^ ERROR E0046 -38 | | //~| NOTE missing `Output` in implementation -39 | | //~| NOTE `Output` from trait: `type Output;` -... | -42 | | } -43 | | } - | |_^ missing `Output` in implementation +36 | impl<C: Component> FnOnce<(C,)> for Prototype { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation | = note: `Output` from trait: `type Output;` diff --git a/src/test/ui/span/issue-24356.rs b/src/test/ui/span/issue-24356.rs index 0997dc802f..0580370033 100644 --- a/src/test/ui/span/issue-24356.rs +++ b/src/test/ui/span/issue-24356.rs @@ -29,8 +29,6 @@ fn main() { // Causes ICE impl Deref for Thing { //~^ ERROR E0046 - //~| NOTE missing `Target` in implementation - //~| NOTE `Target` from trait: `type Target;` fn deref(&self) -> i8 { self.0 } } diff --git a/src/test/ui/span/issue-24356.stderr b/src/test/ui/span/issue-24356.stderr index 71ab82d98b..58fb943fef 100644 --- a/src/test/ui/span/issue-24356.stderr +++ b/src/test/ui/span/issue-24356.stderr @@ -1,13 +1,8 @@ error[E0046]: not all trait items implemented, missing: `Target` --> $DIR/issue-24356.rs:30:9 | -30 | / impl Deref for Thing { -31 | | //~^ ERROR E0046 -32 | | //~| NOTE missing `Target` in implementation -33 | | //~| NOTE `Target` from trait: `type Target;` -34 | | fn deref(&self) -> i8 { self.0 } -35 | | } - | |_________^ missing `Target` in implementation +30 | impl Deref for Thing { + | ^^^^^^^^^^^^^^^^^^^^ missing `Target` in implementation | = note: `Target` from trait: `type Target;` diff --git a/src/test/ui/span/issue-24690.rs b/src/test/ui/span/issue-24690.rs index f59d284510..041ca6c426 100644 --- a/src/test/ui/span/issue-24690.rs +++ b/src/test/ui/span/issue-24690.rs @@ -18,8 +18,9 @@ #![warn(unused)] #[rustc_error] -fn main() { - let theTwo = 2; - let theOtherTwo = 2; +fn main() { //~ ERROR compilation successful + let theTwo = 2; //~ WARN should have a snake case name + let theOtherTwo = 2; //~ WARN should have a snake case name + //~^ WARN unused variable println!("{}", theTwo); } diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr index 718720ebf8..7e19c7492c 100644 --- a/src/test/ui/span/issue-24690.stderr +++ b/src/test/ui/span/issue-24690.stderr @@ -1,7 +1,7 @@ warning: unused variable: `theOtherTwo` --> $DIR/issue-24690.rs:23:9 | -23 | let theOtherTwo = 2; +23 | let theOtherTwo = 2; //~ WARN should have a snake case name | ^^^^^^^^^^^ | note: lint level defined here @@ -15,7 +15,7 @@ note: lint level defined here warning: variable `theTwo` should have a snake case name such as `the_two` --> $DIR/issue-24690.rs:22:9 | -22 | let theTwo = 2; +22 | let theTwo = 2; //~ WARN should have a snake case name | ^^^^^^ | = note: #[warn(non_snake_case)] on by default @@ -23,16 +23,17 @@ warning: variable `theTwo` should have a snake case name such as `the_two` warning: variable `theOtherTwo` should have a snake case name such as `the_other_two` --> $DIR/issue-24690.rs:23:9 | -23 | let theOtherTwo = 2; +23 | let theOtherTwo = 2; //~ WARN should have a snake case name | ^^^^^^^^^^^ error: compilation successful --> $DIR/issue-24690.rs:21:1 | -21 | / fn main() { -22 | | let theTwo = 2; -23 | | let theOtherTwo = 2; -24 | | println!("{}", theTwo); -25 | | } +21 | / fn main() { //~ ERROR compilation successful +22 | | let theTwo = 2; //~ WARN should have a snake case name +23 | | let theOtherTwo = 2; //~ WARN should have a snake case name +24 | | //~^ WARN unused variable +25 | | println!("{}", theTwo); +26 | | } | |_^ diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs index acd363fc6b..7b3c09659e 100644 --- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs +++ b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs @@ -36,11 +36,11 @@ fn f_child() { d1 = D_Child(1); // ... we store a reference to `d1` within `_d` ... _d = D_Child(&d1); + //~^ ERROR `d1` does not live long enough // ... dropck *should* complain, because Drop of _d could (and // does) access the already dropped `d1` via the `foo` method. } -//~^ ERROR `d1` does not live long enough fn main() { f_child(); diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr index 29587b7fbd..f61a091950 100644 --- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr +++ b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr @@ -1,11 +1,11 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:42:1 + --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:38:19 | 38 | _d = D_Child(&d1); - | -- borrow occurs here + | ^^ borrowed value does not live long enough ... -42 | } - | ^ `d1` dropped here while still borrowed +43 | } + | - `d1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.rs b/src/test/ui/span/issue-24805-dropck-trait-has-items.rs index 3deb71411e..7552338693 100644 --- a/src/test/ui/span/issue-24805-dropck-trait-has-items.rs +++ b/src/test/ui/span/issue-24805-dropck-trait-has-items.rs @@ -46,19 +46,19 @@ fn f_sm() { d1 = D_HasSelfMethod(1); _d = D_HasSelfMethod(&d1); } -//~^ ERROR `d1` does not live long enough +//~^^ ERROR `d1` does not live long enough fn f_mwsa() { let (_d, d1); d1 = D_HasMethodWithSelfArg(1); _d = D_HasMethodWithSelfArg(&d1); } -//~^ ERROR `d1` does not live long enough +//~^^ ERROR `d1` does not live long enough fn f_t() { let (_d, d1); d1 = D_HasType(1); _d = D_HasType(&d1); } -//~^ ERROR `d1` does not live long enough +//~^^ ERROR `d1` does not live long enough fn main() { f_sm(); diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr b/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr index c88d4a0202..662ec58805 100644 --- a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr +++ b/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr @@ -1,30 +1,30 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:48:1 + --> $DIR/issue-24805-dropck-trait-has-items.rs:47:27 | 47 | _d = D_HasSelfMethod(&d1); - | -- borrow occurs here + | ^^ borrowed value does not live long enough 48 | } - | ^ `d1` dropped here while still borrowed + | - `d1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:54:1 + --> $DIR/issue-24805-dropck-trait-has-items.rs:53:34 | 53 | _d = D_HasMethodWithSelfArg(&d1); - | -- borrow occurs here + | ^^ borrowed value does not live long enough 54 | } - | ^ `d1` dropped here while still borrowed + | - `d1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:60:1 + --> $DIR/issue-24805-dropck-trait-has-items.rs:59:21 | 59 | _d = D_HasType(&d1); - | -- borrow occurs here + | ^^ borrowed value does not live long enough 60 | } - | ^ `d1` dropped here while still borrowed + | - `d1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.rs b/src/test/ui/span/issue-24895-copy-clone-dropck.rs index a4207eb0aa..326e6b43e2 100644 --- a/src/test/ui/span/issue-24895-copy-clone-dropck.rs +++ b/src/test/ui/span/issue-24895-copy-clone-dropck.rs @@ -35,4 +35,5 @@ fn main() { let (d2, d1); d1 = D(34, "d1"); d2 = D(S(&d1, "inner"), "d2"); -} //~ ERROR `d1` does not live long enough +} +//~^^ ERROR `d1` does not live long enough diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr b/src/test/ui/span/issue-24895-copy-clone-dropck.stderr index 7f80e6e115..1c68cacad7 100644 --- a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr +++ b/src/test/ui/span/issue-24895-copy-clone-dropck.stderr @@ -1,10 +1,10 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24895-copy-clone-dropck.rs:38:1 + --> $DIR/issue-24895-copy-clone-dropck.rs:37:15 | 37 | d2 = D(S(&d1, "inner"), "d2"); - | -- borrow occurs here -38 | } //~ ERROR `d1` does not live long enough - | ^ `d1` dropped here while still borrowed + | ^^ borrowed value does not live long enough +38 | } + | - `d1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-25199.rs b/src/test/ui/span/issue-25199.rs index b88c58c29a..7b1f4005e6 100644 --- a/src/test/ui/span/issue-25199.rs +++ b/src/test/ui/span/issue-25199.rs @@ -78,8 +78,8 @@ impl<'a> Drop for Test<'a> { fn main() { let container = Container::new(); let test = Test{test: &container}; + //~^ ERROR `container` does not live long enough println!("container.v[30]: {:?}", container.v.v[30]); container.store(test); + //~^ ERROR `container` does not live long enough } -//~^ ERROR `container` does not live long enough -//~| ERROR `container` does not live long enough diff --git a/src/test/ui/span/issue-25199.stderr b/src/test/ui/span/issue-25199.stderr index 4f403b38f5..af02e9d6d5 100644 --- a/src/test/ui/span/issue-25199.stderr +++ b/src/test/ui/span/issue-25199.stderr @@ -1,21 +1,22 @@ error[E0597]: `container` does not live long enough - --> $DIR/issue-25199.rs:83:1 + --> $DIR/issue-25199.rs:80:28 | 80 | let test = Test{test: &container}; - | --------- borrow occurs here + | ^^^^^^^^^ borrowed value does not live long enough ... -83 | } - | ^ `container` dropped here while still borrowed +85 | } + | - `container` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `container` does not live long enough - --> $DIR/issue-25199.rs:83:1 + --> $DIR/issue-25199.rs:83:5 | -82 | container.store(test); - | --------- borrow occurs here -83 | } - | ^ `container` dropped here while still borrowed +83 | container.store(test); + | ^^^^^^^^^ borrowed value does not live long enough +84 | //~^ ERROR `container` does not live long enough +85 | } + | - `container` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-26656.rs b/src/test/ui/span/issue-26656.rs index 621da477dd..05f0ea5474 100644 --- a/src/test/ui/span/issue-26656.rs +++ b/src/test/ui/span/issue-26656.rs @@ -49,4 +49,4 @@ fn main() { ticking = Bomb { usable: true }; zook.button = B::BigRedButton(&ticking); } -//~^ ERROR `ticking` does not live long enough +//~^^ ERROR `ticking` does not live long enough diff --git a/src/test/ui/span/issue-26656.stderr b/src/test/ui/span/issue-26656.stderr index 748fcae48f..1d632271f8 100644 --- a/src/test/ui/span/issue-26656.stderr +++ b/src/test/ui/span/issue-26656.stderr @@ -1,10 +1,10 @@ error[E0597]: `ticking` does not live long enough - --> $DIR/issue-26656.rs:51:1 + --> $DIR/issue-26656.rs:50:36 | 50 | zook.button = B::BigRedButton(&ticking); - | ------- borrow occurs here + | ^^^^^^^ borrowed value does not live long enough 51 | } - | ^ `ticking` dropped here while still borrowed + | - `ticking` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-27522.rs b/src/test/ui/span/issue-27522.rs index 81fcb007eb..1e3eba4bf3 100644 --- a/src/test/ui/span/issue-27522.rs +++ b/src/test/ui/span/issue-27522.rs @@ -13,7 +13,7 @@ struct SomeType {} trait Foo { - fn handler(self: &SomeType); + fn handler(self: &SomeType); //~ ERROR invalid `self` type } fn main() {} diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr index e12fb57f15..dc02ad73ee 100644 --- a/src/test/ui/span/issue-27522.stderr +++ b/src/test/ui/span/issue-27522.stderr @@ -1,7 +1,7 @@ error[E0307]: invalid `self` type: &SomeType --> $DIR/issue-27522.rs:16:22 | -16 | fn handler(self: &SomeType); +16 | fn handler(self: &SomeType); //~ ERROR invalid `self` type | ^^^^^^^^^ | = note: type must be `Self` or a type that dereferences to it` diff --git a/src/test/ui/span/issue-29106.rs b/src/test/ui/span/issue-29106.rs index 8d28c64f26..03a9a629c9 100644 --- a/src/test/ui/span/issue-29106.rs +++ b/src/test/ui/span/issue-29106.rs @@ -24,11 +24,13 @@ fn main() { let (y, x); x = "alive".to_string(); y = Arc::new(Foo(&x)); - } //~ ERROR `x` does not live long enough + } + //~^^ ERROR `x` does not live long enough { let (y, x); x = "alive".to_string(); y = Rc::new(Foo(&x)); - } //~ ERROR `x` does not live long enough + } + //~^^ ERROR `x` does not live long enough } diff --git a/src/test/ui/span/issue-29106.stderr b/src/test/ui/span/issue-29106.stderr index f146028c2f..24042e23fe 100644 --- a/src/test/ui/span/issue-29106.stderr +++ b/src/test/ui/span/issue-29106.stderr @@ -1,20 +1,20 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:27:5 + --> $DIR/issue-29106.rs:26:27 | 26 | y = Arc::new(Foo(&x)); - | - borrow occurs here -27 | } //~ ERROR `x` does not live long enough - | ^ `x` dropped here while still borrowed + | ^ borrowed value does not live long enough +27 | } + | - `x` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:33:5 + --> $DIR/issue-29106.rs:33:26 | -32 | y = Rc::new(Foo(&x)); - | - borrow occurs here -33 | } //~ ERROR `x` does not live long enough - | ^ `x` dropped here while still borrowed +33 | y = Rc::new(Foo(&x)); + | ^ borrowed value does not live long enough +34 | } + | - `x` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-33884.stderr b/src/test/ui/span/issue-33884.stderr index 2a874181c7..cf5190bba0 100644 --- a/src/test/ui/span/issue-33884.stderr +++ b/src/test/ui/span/issue-33884.stderr @@ -6,7 +6,7 @@ error[E0308]: mismatched types | = note: expected type `std::fmt::Arguments<'_>` found type `std::string::String` - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/span/issue-34264.rs b/src/test/ui/span/issue-34264.rs index 00482f5061..8baa381fb2 100644 --- a/src/test/ui/span/issue-34264.rs +++ b/src/test/ui/span/issue-34264.rs @@ -8,13 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(Option<i32>, String) {} -fn bar(x, y: usize) {} +fn foo(Option<i32>, String) {} //~ ERROR expected one of +//~^ ERROR expected one of +fn bar(x, y: usize) {} //~ ERROR expected one of fn main() { foo(Some(42), 2); - foo(Some(42), 2, ""); - bar("", ""); + foo(Some(42), 2, ""); //~ ERROR this function takes + bar("", ""); //~ ERROR mismatched types bar(1, 2); - bar(1, 2, 3); + bar(1, 2, 3); //~ ERROR this function takes } diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index e25caacac8..3794d6ba2d 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -1,34 +1,34 @@ error: expected one of `:` or `@`, found `<` --> $DIR/issue-34264.rs:11:14 | -11 | fn foo(Option<i32>, String) {} +11 | fn foo(Option<i32>, String) {} //~ ERROR expected one of | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `)` --> $DIR/issue-34264.rs:11:27 | -11 | fn foo(Option<i32>, String) {} +11 | fn foo(Option<i32>, String) {} //~ ERROR expected one of | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `,` - --> $DIR/issue-34264.rs:12:9 + --> $DIR/issue-34264.rs:13:9 | -12 | fn bar(x, y: usize) {} +13 | fn bar(x, y: usize) {} //~ ERROR expected one of | ^ expected one of `:` or `@` here error[E0061]: this function takes 2 parameters but 3 parameters were supplied - --> $DIR/issue-34264.rs:16:9 + --> $DIR/issue-34264.rs:17:5 | -11 | fn foo(Option<i32>, String) {} - | ------------------------------ defined here +11 | fn foo(Option<i32>, String) {} //~ ERROR expected one of + | --------------------------- defined here ... -16 | foo(Some(42), 2, ""); - | ^^^^^^^^^^^^^^^ expected 2 parameters +17 | foo(Some(42), 2, ""); //~ ERROR this function takes + | ^^^^^^^^^^^^^^^^^^^^ expected 2 parameters error[E0308]: mismatched types - --> $DIR/issue-34264.rs:17:13 + --> $DIR/issue-34264.rs:18:13 | -17 | bar("", ""); +18 | bar("", ""); //~ ERROR mismatched types | ^^ expected usize, found reference | = note: expected type `usize` @@ -37,13 +37,13 @@ error[E0308]: mismatched types - .len() error[E0061]: this function takes 2 parameters but 3 parameters were supplied - --> $DIR/issue-34264.rs:19:9 + --> $DIR/issue-34264.rs:20:5 | -12 | fn bar(x, y: usize) {} - | ---------------------- defined here +13 | fn bar(x, y: usize) {} //~ ERROR expected one of + | ------------------- defined here ... -19 | bar(1, 2, 3); - | ^^^^^^^ expected 2 parameters +20 | bar(1, 2, 3); //~ ERROR this function takes + | ^^^^^^^^^^^^ expected 2 parameters error: aborting due to 6 previous errors diff --git a/src/test/ui/span/issue-35987.rs b/src/test/ui/span/issue-35987.rs index 8ff5f3b839..fa0410686c 100644 --- a/src/test/ui/span/issue-35987.rs +++ b/src/test/ui/span/issue-35987.rs @@ -13,6 +13,7 @@ struct Foo<T: Clone>(T); use std::ops::Add; impl<T: Clone, Add> Add for Foo<T> { +//~^ ERROR expected trait, found type parameter type Output = usize; fn add(self, rhs: Self) -> Self::Output { diff --git a/src/test/ui/span/issue-36530.rs b/src/test/ui/span/issue-36530.rs index 893c2168c2..c6cdb8b6db 100644 --- a/src/test/ui/span/issue-36530.rs +++ b/src/test/ui/span/issue-36530.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[foo] +#[foo] //~ ERROR is currently unknown to the compiler mod foo { - #![foo] + #![foo] //~ ERROR is currently unknown to the compiler } diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr index dc6190c2e7..50908b2ca3 100644 --- a/src/test/ui/span/issue-36530.stderr +++ b/src/test/ui/span/issue-36530.stderr @@ -1,7 +1,7 @@ error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-36530.rs:11:1 | -11 | #[foo] +11 | #[foo] //~ ERROR is currently unknown to the compiler | ^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ error: The attribute `foo` is currently unknown to the compiler and may have mea error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-36530.rs:13:5 | -13 | #![foo] +13 | #![foo] //~ ERROR is currently unknown to the compiler | ^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/span/issue-36537.rs b/src/test/ui/span/issue-36537.rs index 33182e02fa..3eac0106b1 100644 --- a/src/test/ui/span/issue-36537.rs +++ b/src/test/ui/span/issue-36537.rs @@ -11,8 +11,6 @@ fn main() { let p; let a = 42; - p = &a; //~ NOTE borrow occurs here + p = &a; + //~^ ERROR `a` does not live long enough } -//~^ ERROR `a` does not live long enough -//~| NOTE `a` dropped here while still borrowed -//~| NOTE values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-36537.stderr b/src/test/ui/span/issue-36537.stderr index 803e476b74..255700a55f 100644 --- a/src/test/ui/span/issue-36537.stderr +++ b/src/test/ui/span/issue-36537.stderr @@ -1,10 +1,11 @@ error[E0597]: `a` does not live long enough - --> $DIR/issue-36537.rs:15:1 + --> $DIR/issue-36537.rs:14:10 | -14 | p = &a; //~ NOTE borrow occurs here - | - borrow occurs here -15 | } - | ^ `a` dropped here while still borrowed +14 | p = &a; + | ^ borrowed value does not live long enough +15 | //~^ ERROR `a` does not live long enough +16 | } + | - `a` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-37767.rs b/src/test/ui/span/issue-37767.rs index 49ad40259d..2b0250d332 100644 --- a/src/test/ui/span/issue-37767.rs +++ b/src/test/ui/span/issue-37767.rs @@ -17,7 +17,7 @@ trait B : A { } fn bar<T: B>(a: &T) { - a.foo() + a.foo() //~ ERROR multiple applicable items } trait C { @@ -29,7 +29,7 @@ trait D : C { } fn quz<T: D>(a: &T) { - a.foo() + a.foo() //~ ERROR multiple applicable items } trait E : Sized { @@ -41,7 +41,7 @@ trait F : E { } fn foo<T: F>(a: T) { - a.foo() + a.foo() //~ ERROR multiple applicable items } fn pass<T: C>(a: &T) { diff --git a/src/test/ui/span/issue-37767.stderr b/src/test/ui/span/issue-37767.stderr index 7cf74eaab8..e9a1fe82f1 100644 --- a/src/test/ui/span/issue-37767.stderr +++ b/src/test/ui/span/issue-37767.stderr @@ -1,58 +1,58 @@ error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:20:7 | -20 | a.foo() +20 | a.foo() //~ ERROR multiple applicable items | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `A` --> $DIR/issue-37767.rs:12:5 | 12 | fn foo(&mut self) {} - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `A::foo(&a)` instead note: candidate #2 is defined in the trait `B` --> $DIR/issue-37767.rs:16:5 | 16 | fn foo(&mut self) {} - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `B::foo(&a)` instead error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:32:7 | -32 | a.foo() +32 | a.foo() //~ ERROR multiple applicable items | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `C` --> $DIR/issue-37767.rs:24:5 | 24 | fn foo(&self) {} - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ = help: to disambiguate the method call, write `C::foo(&a)` instead note: candidate #2 is defined in the trait `D` --> $DIR/issue-37767.rs:28:5 | 28 | fn foo(&self) {} - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ = help: to disambiguate the method call, write `D::foo(&a)` instead error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:44:7 | -44 | a.foo() +44 | a.foo() //~ ERROR multiple applicable items | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `E` --> $DIR/issue-37767.rs:36:5 | 36 | fn foo(self) {} - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ = help: to disambiguate the method call, write `E::foo(a)` instead note: candidate #2 is defined in the trait `F` --> $DIR/issue-37767.rs:40:5 | 40 | fn foo(self) {} - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ = help: to disambiguate the method call, write `F::foo(a)` instead error: aborting due to 3 previous errors diff --git a/src/test/ui/span/issue-39018.rs b/src/test/ui/span/issue-39018.rs index 1cbc5ff1d2..4c9d10ba46 100644 --- a/src/test/ui/span/issue-39018.rs +++ b/src/test/ui/span/issue-39018.rs @@ -10,11 +10,13 @@ pub fn main() { let x = "Hello " + "World!"; + //~^ ERROR cannot be applied to type // Make sure that the span outputs a warning // for not having an implementation for std::ops::Add // that won't output for the above string concatenation let y = World::Hello + World::Goodbye; + //~^ ERROR cannot be applied to type } enum World { diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index e865b5192a..db662a1df5 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -9,9 +9,9 @@ help: `to_owned()` can be used to create an owned `String` from a string referen | ^^^^^^^^^^^^^^^^^^^ error[E0369]: binary operation `+` cannot be applied to type `World` - --> $DIR/issue-39018.rs:17:13 + --> $DIR/issue-39018.rs:18:13 | -17 | let y = World::Hello + World::Goodbye; +18 | let y = World::Hello + World::Goodbye; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `World` diff --git a/src/test/ui/span/issue-39698.rs b/src/test/ui/span/issue-39698.rs index 17b3f1c5a8..33071c468b 100644 --- a/src/test/ui/span/issue-39698.rs +++ b/src/test/ui/span/issue-39698.rs @@ -18,5 +18,9 @@ enum T { fn main() { match T::T1(123, 456) { T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } + //~^ ERROR is not bound in all patterns + //~| ERROR is not bound in all patterns + //~| ERROR is not bound in all patterns + //~| ERROR is not bound in all patterns } } diff --git a/src/test/ui/span/issue-40157.rs b/src/test/ui/span/issue-40157.rs index 8f3a7ae341..9e33ecde91 100644 --- a/src/test/ui/span/issue-40157.rs +++ b/src/test/ui/span/issue-40157.rs @@ -10,4 +10,5 @@ fn main () { {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} + //~^ ERROR does not live long enough } diff --git a/src/test/ui/span/issue-40157.stderr b/src/test/ui/span/issue-40157.stderr index b689bef63f..cf33ccf809 100644 --- a/src/test/ui/span/issue-40157.stderr +++ b/src/test/ui/span/issue-40157.stderr @@ -1,14 +1,14 @@ error[E0597]: `foo` does not live long enough - --> $DIR/issue-40157.rs:12:64 + --> $DIR/issue-40157.rs:12:53 | 12 | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} - | ----------------------------------------------------------^------------- + | -----------------------------------------------^^^---------------------- | | | | | | | `foo` dropped here while still borrowed - | | borrow occurs here + | | borrowed value does not live long enough | borrowed value needs to live until here | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.rs b/src/test/ui/span/issue-43927-non-ADT-derive.rs index cf2a4b8d03..782cce26a9 100644 --- a/src/test/ui/span/issue-43927-non-ADT-derive.rs +++ b/src/test/ui/span/issue-43927-non-ADT-derive.rs @@ -11,6 +11,7 @@ #![allow(dead_code)] #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! +//~^ ERROR `derive` may only be applied to structs, enums and unions struct DerivedOn; fn main() {} diff --git a/src/test/ui/span/issue-7575.rs b/src/test/ui/span/issue-7575.rs index b74036c4f5..b1dbd5b86e 100644 --- a/src/test/ui/span/issue-7575.rs +++ b/src/test/ui/span/issue-7575.rs @@ -13,11 +13,11 @@ trait CtxtFn { fn f8(self, _: usize) -> usize; - fn f9(_: usize) -> usize; //~ NOTE candidate + fn f9(_: usize) -> usize; } trait OtherTrait { - fn f9(_: usize) -> usize; //~ NOTE candidate + fn f9(_: usize) -> usize; } // Note: this trait is not implemented, but we can't really tell @@ -26,7 +26,7 @@ trait OtherTrait { // candidate. This seems not unreasonable -- perhaps the user meant to // implement it, after all. trait UnusedTrait { - fn f9(_: usize) -> usize; //~ NOTE candidate + fn f9(_: usize) -> usize; } impl CtxtFn for usize { @@ -48,13 +48,13 @@ impl OtherTrait for usize { struct Myisize(isize); impl Myisize { - fn fff(i: isize) -> isize { //~ NOTE candidate + fn fff(i: isize) -> isize { i } } trait ManyImplTrait { - fn is_str() -> bool { //~ NOTE candidate + fn is_str() -> bool { false } } @@ -73,19 +73,14 @@ impl ManyImplTrait for Myisize {} fn no_param_bound(u: usize, m: Myisize) -> usize { u.f8(42) + u.f9(342) + m.fff(42) //~^ ERROR no method named `f9` found for type `usize` in the current scope - //~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter - //~| NOTE to use it here write `CtxtFn::f9(u, 342)` instead //~| ERROR no method named `fff` found for type `Myisize` in the current scope - //~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter - //~| NOTE to use it here write `OtherTrait::f9(u, 342)` instead - //~| NOTE to use it here write `UnusedTrait::f9(u, 342)` instead + + } fn param_bound<T: ManyImplTrait>(t: T) -> bool { t.is_str() //~^ ERROR no method named `is_str` found for type `T` in the current scope - //~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter - //~| NOTE to use it here write `ManyImplTrait::is_str(t)` instead } fn main() { diff --git a/src/test/ui/span/issue-7575.stderr b/src/test/ui/span/issue-7575.stderr index 08ec2a87fc..aeb98e4cab 100644 --- a/src/test/ui/span/issue-7575.stderr +++ b/src/test/ui/span/issue-7575.stderr @@ -9,19 +9,19 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope note: candidate #1 is defined in the trait `CtxtFn` --> $DIR/issue-7575.rs:16:5 | -16 | fn f9(_: usize) -> usize; //~ NOTE candidate +16 | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `CtxtFn::f9(u, 342)` instead note: candidate #2 is defined in the trait `OtherTrait` --> $DIR/issue-7575.rs:20:5 | -20 | fn f9(_: usize) -> usize; //~ NOTE candidate +20 | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `OtherTrait::f9(u, 342)` instead note: candidate #3 is defined in the trait `UnusedTrait` --> $DIR/issue-7575.rs:29:5 | -29 | fn f9(_: usize) -> usize; //~ NOTE candidate +29 | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `UnusedTrait::f9(u, 342)` instead = help: items from traits can only be used if the trait is implemented and in scope @@ -33,6 +33,9 @@ note: candidate #3 is defined in the trait `UnusedTrait` error[E0599]: no method named `fff` found for type `Myisize` in the current scope --> $DIR/issue-7575.rs:74:30 | +48 | struct Myisize(isize); + | ---------------------- method `fff` not found for this +... 74 | u.f8(42) + u.f9(342) + m.fff(42) | ^^^ | @@ -41,15 +44,13 @@ error[E0599]: no method named `fff` found for type `Myisize` in the current scop note: candidate #1 is defined in an impl for the type `Myisize` --> $DIR/issue-7575.rs:51:5 | -51 | / fn fff(i: isize) -> isize { //~ NOTE candidate -52 | | i -53 | | } - | |_____^ +51 | fn fff(i: isize) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0599]: no method named `is_str` found for type `T` in the current scope - --> $DIR/issue-7575.rs:85:7 + --> $DIR/issue-7575.rs:82:7 | -85 | t.is_str() +82 | t.is_str() | ^^^^^^ | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter @@ -57,10 +58,8 @@ error[E0599]: no method named `is_str` found for type `T` in the current scope note: candidate #1 is defined in the trait `ManyImplTrait` --> $DIR/issue-7575.rs:57:5 | -57 | / fn is_str() -> bool { //~ NOTE candidate -58 | | false -59 | | } - | |_____^ +57 | fn is_str() -> bool { + | ^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `ManyImplTrait::is_str(t)` instead = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `is_str`, perhaps you need to implement it: diff --git a/src/test/ui/span/issue28498-reject-ex1.rs b/src/test/ui/span/issue28498-reject-ex1.rs index bed768005b..cee7c57c20 100644 --- a/src/test/ui/span/issue28498-reject-ex1.rs +++ b/src/test/ui/span/issue28498-reject-ex1.rs @@ -42,7 +42,7 @@ fn main() { foo.data.push(Concrete(0, Cell::new(None))); foo.data[0].1.set(Some(&foo.data[1])); + //~^ ERROR `foo.data` does not live long enough foo.data[1].1.set(Some(&foo.data[0])); + //~^ ERROR `foo.data` does not live long enough } -//~^ ERROR `foo.data` does not live long enough -//~| ERROR `foo.data` does not live long enough diff --git a/src/test/ui/span/issue28498-reject-ex1.stderr b/src/test/ui/span/issue28498-reject-ex1.stderr index 6beb3109c7..8ade2f38ee 100644 --- a/src/test/ui/span/issue28498-reject-ex1.stderr +++ b/src/test/ui/span/issue28498-reject-ex1.stderr @@ -1,21 +1,22 @@ error[E0597]: `foo.data` does not live long enough - --> $DIR/issue28498-reject-ex1.rs:46:1 + --> $DIR/issue28498-reject-ex1.rs:44:29 | 44 | foo.data[0].1.set(Some(&foo.data[1])); - | -------- borrow occurs here -45 | foo.data[1].1.set(Some(&foo.data[0])); -46 | } - | ^ `foo.data` dropped here while still borrowed + | ^^^^^^^^ borrowed value does not live long enough +... +48 | } + | - `foo.data` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `foo.data` does not live long enough - --> $DIR/issue28498-reject-ex1.rs:46:1 + --> $DIR/issue28498-reject-ex1.rs:46:29 | -45 | foo.data[1].1.set(Some(&foo.data[0])); - | -------- borrow occurs here -46 | } - | ^ `foo.data` dropped here while still borrowed +46 | foo.data[1].1.set(Some(&foo.data[0])); + | ^^^^^^^^ borrowed value does not live long enough +47 | //~^ ERROR `foo.data` does not live long enough +48 | } + | - `foo.data` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.rs b/src/test/ui/span/issue28498-reject-lifetime-param.rs index 7e7893ac3c..92028c7a81 100644 --- a/src/test/ui/span/issue28498-reject-lifetime-param.rs +++ b/src/test/ui/span/issue28498-reject-lifetime-param.rs @@ -40,9 +40,9 @@ fn main() { last_dropped = ScribbleOnDrop(format!("last")); first_dropped = ScribbleOnDrop(format!("first")); foo0 = Foo(0, &last_dropped); + //~^ ERROR `last_dropped` does not live long enough foo1 = Foo(1, &first_dropped); + //~^ ERROR `first_dropped` does not live long enough println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); } -//~^ ERROR `last_dropped` does not live long enough -//~| ERROR `first_dropped` does not live long enough diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.stderr b/src/test/ui/span/issue28498-reject-lifetime-param.stderr index 358fa9b7c4..eb287265da 100644 --- a/src/test/ui/span/issue28498-reject-lifetime-param.stderr +++ b/src/test/ui/span/issue28498-reject-lifetime-param.stderr @@ -1,22 +1,22 @@ error[E0597]: `last_dropped` does not live long enough - --> $DIR/issue28498-reject-lifetime-param.rs:46:1 + --> $DIR/issue28498-reject-lifetime-param.rs:42:20 | 42 | foo0 = Foo(0, &last_dropped); - | ------------ borrow occurs here + | ^^^^^^^^^^^^ borrowed value does not live long enough ... -46 | } - | ^ `last_dropped` dropped here while still borrowed +48 | } + | - `last_dropped` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-lifetime-param.rs:46:1 + --> $DIR/issue28498-reject-lifetime-param.rs:44:20 | -43 | foo1 = Foo(1, &first_dropped); - | ------------- borrow occurs here +44 | foo1 = Foo(1, &first_dropped); + | ^^^^^^^^^^^^^ borrowed value does not live long enough ... -46 | } - | ^ `first_dropped` dropped here while still borrowed +48 | } + | - `first_dropped` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.rs b/src/test/ui/span/issue28498-reject-passed-to-fn.rs index 54fc20b62f..27378b1e0b 100644 --- a/src/test/ui/span/issue28498-reject-passed-to-fn.rs +++ b/src/test/ui/span/issue28498-reject-passed-to-fn.rs @@ -42,9 +42,9 @@ fn main() { last_dropped = ScribbleOnDrop(format!("last")); first_dropped = ScribbleOnDrop(format!("first")); foo0 = Foo(0, &last_dropped, Box::new(callback)); + //~^ ERROR `last_dropped` does not live long enough foo1 = Foo(1, &first_dropped, Box::new(callback)); + //~^ ERROR `first_dropped` does not live long enough println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); } -//~^ ERROR `last_dropped` does not live long enough -//~| ERROR `first_dropped` does not live long enough diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr index 0aaf2b27f6..53e0e02319 100644 --- a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr +++ b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr @@ -1,22 +1,22 @@ error[E0597]: `last_dropped` does not live long enough - --> $DIR/issue28498-reject-passed-to-fn.rs:48:1 + --> $DIR/issue28498-reject-passed-to-fn.rs:44:20 | 44 | foo0 = Foo(0, &last_dropped, Box::new(callback)); - | ------------ borrow occurs here + | ^^^^^^^^^^^^ borrowed value does not live long enough ... -48 | } - | ^ `last_dropped` dropped here while still borrowed +50 | } + | - `last_dropped` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-passed-to-fn.rs:48:1 + --> $DIR/issue28498-reject-passed-to-fn.rs:46:20 | -45 | foo1 = Foo(1, &first_dropped, Box::new(callback)); - | ------------- borrow occurs here +46 | foo1 = Foo(1, &first_dropped, Box::new(callback)); + | ^^^^^^^^^^^^^ borrowed value does not live long enough ... -48 | } - | ^ `first_dropped` dropped here while still borrowed +50 | } + | - `first_dropped` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue28498-reject-trait-bound.rs b/src/test/ui/span/issue28498-reject-trait-bound.rs index 6164beaf85..3904d68ba1 100644 --- a/src/test/ui/span/issue28498-reject-trait-bound.rs +++ b/src/test/ui/span/issue28498-reject-trait-bound.rs @@ -42,9 +42,9 @@ fn main() { last_dropped = ScribbleOnDrop(format!("last")); first_dropped = ScribbleOnDrop(format!("first")); foo0 = Foo(0, &last_dropped); + //~^ ERROR `last_dropped` does not live long enough foo1 = Foo(1, &first_dropped); + //~^ ERROR `first_dropped` does not live long enough println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); } -//~^ ERROR `last_dropped` does not live long enough -//~| ERROR `first_dropped` does not live long enough diff --git a/src/test/ui/span/issue28498-reject-trait-bound.stderr b/src/test/ui/span/issue28498-reject-trait-bound.stderr index 27a4d2384a..6b53745bbc 100644 --- a/src/test/ui/span/issue28498-reject-trait-bound.stderr +++ b/src/test/ui/span/issue28498-reject-trait-bound.stderr @@ -1,22 +1,22 @@ error[E0597]: `last_dropped` does not live long enough - --> $DIR/issue28498-reject-trait-bound.rs:48:1 + --> $DIR/issue28498-reject-trait-bound.rs:44:20 | 44 | foo0 = Foo(0, &last_dropped); - | ------------ borrow occurs here + | ^^^^^^^^^^^^ borrowed value does not live long enough ... -48 | } - | ^ `last_dropped` dropped here while still borrowed +50 | } + | - `last_dropped` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-trait-bound.rs:48:1 + --> $DIR/issue28498-reject-trait-bound.rs:46:20 | -45 | foo1 = Foo(1, &first_dropped); - | ------------- borrow occurs here +46 | foo1 = Foo(1, &first_dropped); + | ^^^^^^^^^^^^^ borrowed value does not live long enough ... -48 | } - | ^ `first_dropped` dropped here while still borrowed +50 | } + | - `first_dropped` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/lint-unused-unsafe.stderr b/src/test/ui/span/lint-unused-unsafe.stderr index f4998e0890..8a8b104098 100644 --- a/src/test/ui/span/lint-unused-unsafe.stderr +++ b/src/test/ui/span/lint-unused-unsafe.stderr @@ -2,7 +2,7 @@ error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:26:13 | 26 | fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block - | ^^^^^^^^^ unnecessary `unsafe` block + | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here --> $DIR/lint-unused-unsafe.rs:14:9 @@ -14,97 +14,54 @@ error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:27:13 | 27 | fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block - | ^^^^^^^^^^^^^^^^^ unnecessary `unsafe` block + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:28:20 | 28 | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block - | ^^^^^^^^^ unnecessary `unsafe` block - | -note: because it's nested under this `unsafe` fn - --> $DIR/lint-unused-unsafe.rs:28:1 - | -28 | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---------------- ^^^^^^ unnecessary `unsafe` block + | | + | because it's nested under this `unsafe` fn error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:29:13 | 29 | fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block - | ^^^^^^^^^^^^^^^^^^^^^^^^^ unnecessary `unsafe` block + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:30:20 | 30 | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block - | ^^^^^^^^^^^^^^^^^ unnecessary `unsafe` block - | -note: because it's nested under this `unsafe` fn - --> $DIR/lint-unused-unsafe.rs:30:1 - | -30 | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---------------- ^^^^^^ unnecessary `unsafe` block + | | + | because it's nested under this `unsafe` fn error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:33:9 | -33 | / unsafe { //~ ERROR: unnecessary `unsafe` block -34 | | unsf() -35 | | } - | |_________^ unnecessary `unsafe` block - | -note: because it's nested under this `unsafe` block - --> $DIR/lint-unused-unsafe.rs:32:5 - | -32 | / unsafe { // don't put the warning here -33 | | unsafe { //~ ERROR: unnecessary `unsafe` block -34 | | unsf() -35 | | } -36 | | } - | |_____^ +32 | unsafe { // don't put the warning here + | ------ because it's nested under this `unsafe` block +33 | unsafe { //~ ERROR: unnecessary `unsafe` block + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:39:5 | -39 | / unsafe { //~ ERROR: unnecessary `unsafe` block -40 | | unsafe { //~ ERROR: unnecessary `unsafe` block -41 | | unsf() -42 | | } -43 | | } - | |_____^ unnecessary `unsafe` block - | -note: because it's nested under this `unsafe` fn - --> $DIR/lint-unused-unsafe.rs:38:1 - | -38 | / unsafe fn bad7() { -39 | | unsafe { //~ ERROR: unnecessary `unsafe` block -40 | | unsafe { //~ ERROR: unnecessary `unsafe` block -41 | | unsf() -42 | | } -43 | | } -44 | | } - | |_^ +38 | unsafe fn bad7() { + | ---------------- because it's nested under this `unsafe` fn +39 | unsafe { //~ ERROR: unnecessary `unsafe` block + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:40:9 | -40 | / unsafe { //~ ERROR: unnecessary `unsafe` block -41 | | unsf() -42 | | } - | |_________^ unnecessary `unsafe` block - | -note: because it's nested under this `unsafe` fn - --> $DIR/lint-unused-unsafe.rs:38:1 - | -38 | / unsafe fn bad7() { -39 | | unsafe { //~ ERROR: unnecessary `unsafe` block -40 | | unsafe { //~ ERROR: unnecessary `unsafe` block -41 | | unsf() -42 | | } -43 | | } -44 | | } - | |_^ +38 | unsafe fn bad7() { + | ---------------- because it's nested under this `unsafe` fn +39 | unsafe { //~ ERROR: unnecessary `unsafe` block +40 | unsafe { //~ ERROR: unnecessary `unsafe` block + | ^^^^^^ unnecessary `unsafe` block error: aborting due to 8 previous errors diff --git a/src/test/ui/span/loan-extend.rs b/src/test/ui/span/loan-extend.rs deleted file mode 100644 index a4b951daab..0000000000 --- a/src/test/ui/span/loan-extend.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(conservative_impl_trait)] - -// Helper creating a fake borrow, captured by the impl Trait. -fn borrow<'a, T>(_: &'a mut T) -> impl Copy { () } - -fn main() { - let long; - let mut short = 0; - long = borrow(&mut short); - //~^ NOTE borrow occurs here -} -//~^ ERROR `short` does not live long enough -//~| NOTE `short` dropped here while still borrowed -//~| NOTE values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/loan-extend.stderr b/src/test/ui/span/loan-extend.stderr index 91bdd8a8ca..280ddd6581 100644 --- a/src/test/ui/span/loan-extend.stderr +++ b/src/test/ui/span/loan-extend.stderr @@ -3,7 +3,7 @@ error[E0597]: `short` does not live long enough | 19 | long = borrow(&mut short); | ----- borrow occurs here -20 | //~^ NOTE borrow occurs here +20 | 21 | } | ^ `short` dropped here while still borrowed | diff --git a/src/test/ui/span/macro-span-replacement.rs b/src/test/ui/span/macro-span-replacement.rs index b7aae39c46..0baa4fb4fe 100644 --- a/src/test/ui/span/macro-span-replacement.rs +++ b/src/test/ui/span/macro-span-replacement.rs @@ -8,11 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![warn(unused)] macro_rules! m { ($a:tt $b:tt) => { - $b $a; + $b $a; //~ WARN struct is never used } } diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index af03aa6a36..2a0e71e192 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,16 +1,16 @@ warning: struct is never used: `S` - --> $DIR/macro-span-replacement.rs:15:9 + --> $DIR/macro-span-replacement.rs:17:9 | -15 | $b $a; +17 | $b $a; //~ WARN struct is never used | ^^^^^^ ... -20 | m!(S struct); +22 | m!(S struct); | ------------- in this macro invocation | note: lint level defined here - --> $DIR/macro-span-replacement.rs:11:9 + --> $DIR/macro-span-replacement.rs:13:9 | -11 | #![warn(unused)] +13 | #![warn(unused)] | ^^^^^^ = note: #[warn(dead_code)] implied by #[warn(unused)] diff --git a/src/test/ui/span/macro-ty-params.rs b/src/test/ui/span/macro-ty-params.rs index c2443b024c..5d93b1266a 100644 --- a/src/test/ui/span/macro-ty-params.rs +++ b/src/test/ui/span/macro-ty-params.rs @@ -15,7 +15,8 @@ macro_rules! m { } fn main() { - foo::<T>!(); - foo::<>!(); - m!(MyTrait<>); + foo::<T>!(); //~ ERROR generic arguments in macro path + foo::<>!(); //~ ERROR generic arguments in macro path + m!(MyTrait<>); //~ ERROR generic arguments in macro path + //~^ ERROR unexpected generic arguments in path } diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr index 017a449d96..e3e9334d9f 100644 --- a/src/test/ui/span/macro-ty-params.stderr +++ b/src/test/ui/span/macro-ty-params.stderr @@ -1,25 +1,25 @@ error: unexpected generic arguments in path --> $DIR/macro-ty-params.rs:20:8 | -20 | m!(MyTrait<>); +20 | m!(MyTrait<>); //~ ERROR generic arguments in macro path | ^^^^^^^^^ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:18:8 | -18 | foo::<T>!(); +18 | foo::<T>!(); //~ ERROR generic arguments in macro path | ^^^^^ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:19:8 | -19 | foo::<>!(); +19 | foo::<>!(); //~ ERROR generic arguments in macro path | ^^^^ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:20:15 | -20 | m!(MyTrait<>); +20 | m!(MyTrait<>); //~ ERROR generic arguments in macro path | ^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/span/missing-unit-argument.rs b/src/test/ui/span/missing-unit-argument.rs index ba1a999121..a586d33eaa 100644 --- a/src/test/ui/span/missing-unit-argument.rs +++ b/src/test/ui/span/missing-unit-argument.rs @@ -18,10 +18,10 @@ impl S { } fn main() { - let _: Result<(), String> = Ok(); - foo(); - foo(()); - bar(); - S.baz(); - S.generic::<()>(); + let _: Result<(), String> = Ok(); //~ ERROR this function takes + foo(); //~ ERROR this function takes + foo(()); //~ ERROR this function takes + bar(); //~ ERROR this function takes + S.baz(); //~ ERROR this function takes + S.generic::<()>(); //~ ERROR this function takes } diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index 672b0718a0..77d037d497 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -1,68 +1,68 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/missing-unit-argument.rs:21:33 | -21 | let _: Result<(), String> = Ok(); +21 | let _: Result<(), String> = Ok(); //~ ERROR this function takes | ^^^^ help: expected the unit value `()`; create it with empty parentheses | -21 | let _: Result<(), String> = Ok(()); +21 | let _: Result<(), String> = Ok(()); //~ ERROR this function takes | ^^ error[E0061]: this function takes 2 parameters but 0 parameters were supplied --> $DIR/missing-unit-argument.rs:22:5 | 11 | fn foo(():(), ():()) {} - | ----------------------- defined here + | -------------------- defined here ... -22 | foo(); +22 | foo(); //~ ERROR this function takes | ^^^^^ expected 2 parameters error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/missing-unit-argument.rs:23:9 + --> $DIR/missing-unit-argument.rs:23:5 | 11 | fn foo(():(), ():()) {} - | ----------------------- defined here + | -------------------- defined here ... -23 | foo(()); - | ^^ expected 2 parameters +23 | foo(()); //~ ERROR this function takes + | ^^^^^^^ expected 2 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/missing-unit-argument.rs:24:5 | 12 | fn bar(():()) {} - | ---------------- defined here + | ------------- defined here ... -24 | bar(); +24 | bar(); //~ ERROR this function takes | ^^^^^ help: expected the unit value `()`; create it with empty parentheses | -24 | bar(()); +24 | bar(()); //~ ERROR this function takes | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/missing-unit-argument.rs:25:7 | 16 | fn baz(self, (): ()) { } - | ------------------------ defined here + | -------------------- defined here ... -25 | S.baz(); +25 | S.baz(); //~ ERROR this function takes | ^^^ help: expected the unit value `()`; create it with empty parentheses | -25 | S.baz(()); +25 | S.baz(()); //~ ERROR this function takes | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/missing-unit-argument.rs:26:7 | 17 | fn generic<T>(self, _: T) { } - | ----------------------------- defined here + | ------------------------- defined here ... -26 | S.generic::<()>(); +26 | S.generic::<()>(); //~ ERROR this function takes | ^^^^^^^ help: expected the unit value `()`; create it with empty parentheses | -26 | S.generic::<()>(()); +26 | S.generic::<()>(()); //~ ERROR this function takes | ^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/span/move-closure.rs b/src/test/ui/span/move-closure.rs index e11ef0ddda..87ce152929 100644 --- a/src/test/ui/span/move-closure.rs +++ b/src/test/ui/span/move-closure.rs @@ -12,5 +12,5 @@ // Make sure that the span of a closure marked `move` begins at the `move` keyword. fn main() { - let x: () = move || (); + let x: () = move || (); //~ ERROR mismatched types } diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr index 2294e6476d..9135a26bba 100644 --- a/src/test/ui/span/move-closure.stderr +++ b/src/test/ui/span/move-closure.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/move-closure.rs:15:17 | -15 | let x: () = move || (); +15 | let x: () = move || (); //~ ERROR mismatched types | ^^^^^^^^^^ expected (), found closure | = note: expected type `()` diff --git a/src/test/ui/span/multiline-span-E0072.rs b/src/test/ui/span/multiline-span-E0072.rs index 323e7fb5a4..2344d72f45 100644 --- a/src/test/ui/span/multiline-span-E0072.rs +++ b/src/test/ui/span/multiline-span-E0072.rs @@ -9,7 +9,7 @@ // except according to those terms. // It should just use the entire body instead of pointing at the next two lines -struct +struct //~ ERROR has infinite size ListNode { head: u8, diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr index a06cbd04de..124a53219a 100644 --- a/src/test/ui/span/multiline-span-E0072.stderr +++ b/src/test/ui/span/multiline-span-E0072.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `ListNode` has infinite size --> $DIR/multiline-span-E0072.rs:12:1 | -12 | / struct +12 | / struct //~ ERROR has infinite size 13 | | ListNode 14 | | { 15 | | head: u8, diff --git a/src/test/ui/span/multiline-span-simple.rs b/src/test/ui/span/multiline-span-simple.rs index 451492ba69..f8e4cbcbf1 100644 --- a/src/test/ui/span/multiline-span-simple.rs +++ b/src/test/ui/span/multiline-span-simple.rs @@ -20,7 +20,7 @@ fn main() { let x = 1; let y = 2; let z = 3; - foo(1 as u32 + + foo(1 as u32 + //~ ERROR not satisfied bar(x, diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index 3915f1b655..b068798630 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `u32: std::ops::Add<()>` is not satisfied --> $DIR/multiline-span-simple.rs:23:18 | -23 | foo(1 as u32 + +23 | foo(1 as u32 + //~ ERROR not satisfied | ^ no implementation for `u32 + ()` | = help: the trait `std::ops::Add<()>` is not implemented for `u32` diff --git a/src/test/ui/span/multispan-import-lint.rs b/src/test/ui/span/multispan-import-lint.rs index 66536b29c0..5fb0ff7fb7 100644 --- a/src/test/ui/span/multispan-import-lint.rs +++ b/src/test/ui/span/multispan-import-lint.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![warn(unused)] use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; +//~^ WARN unused imports fn main() { let _ = min(1, 2); diff --git a/src/test/ui/span/multispan-import-lint.stderr b/src/test/ui/span/multispan-import-lint.stderr index 1fecdea7d0..e2c1d9cdc7 100644 --- a/src/test/ui/span/multispan-import-lint.stderr +++ b/src/test/ui/span/multispan-import-lint.stderr @@ -1,13 +1,13 @@ warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd` - --> $DIR/multispan-import-lint.rs:13:16 + --> $DIR/multispan-import-lint.rs:15:16 | -13 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; +15 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; | ^^ ^^^ ^^^^^^^^^ ^^^^^^^^^^ | note: lint level defined here - --> $DIR/multispan-import-lint.rs:11:9 + --> $DIR/multispan-import-lint.rs:13:9 | -11 | #![warn(unused)] +13 | #![warn(unused)] | ^^^^^^ = note: #[warn(unused_imports)] implied by #[warn(unused)] diff --git a/src/test/ui/span/mut-arg-hint.rs b/src/test/ui/span/mut-arg-hint.rs index 296ee6ca10..b22cadf3ef 100644 --- a/src/test/ui/span/mut-arg-hint.rs +++ b/src/test/ui/span/mut-arg-hint.rs @@ -10,19 +10,19 @@ trait B { fn foo(mut a: &String) { - a.push_str("bar"); + a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content } } pub fn foo<'a>(mut a: &'a String) { - a.push_str("foo"); + a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content } struct A {} impl A { pub fn foo(mut a: &String) { - a.push_str("foo"); + a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content } } diff --git a/src/test/ui/span/mut-arg-hint.stderr b/src/test/ui/span/mut-arg-hint.stderr index f8584c6739..02c607ddc3 100644 --- a/src/test/ui/span/mut-arg-hint.stderr +++ b/src/test/ui/span/mut-arg-hint.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | 12 | fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable -13 | a.push_str("bar"); +13 | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | 17 | pub fn foo<'a>(mut a: &'a String) { | ---------- use `&'a mut String` here to make mutable -18 | a.push_str("foo"); +18 | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | 24 | pub fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable -25 | a.push_str("foo"); +25 | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content | ^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.rs b/src/test/ui/span/mut-ptr-cant-outlive-ref.rs index 8e968d90a2..9dc0836c5e 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.rs +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.rs @@ -15,6 +15,7 @@ fn main() { let p; { let b = m.borrow(); - p = &*b; //~ ERROR `b` does not live long enough + p = &*b; } + //~^^ ERROR `b` does not live long enough } diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr index 007a9fad83..e39af85017 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr @@ -1,11 +1,12 @@ error[E0597]: `b` does not live long enough - --> $DIR/mut-ptr-cant-outlive-ref.rs:19:5 + --> $DIR/mut-ptr-cant-outlive-ref.rs:18:15 | -18 | p = &*b; //~ ERROR `b` does not live long enough - | - borrow occurs here +18 | p = &*b; + | ^ borrowed value does not live long enough 19 | } - | ^ `b` dropped here while still borrowed -20 | } + | - `b` dropped here while still borrowed +20 | //~^^ ERROR `b` does not live long enough +21 | } | - borrowed value needs to live until here error: aborting due to previous error diff --git a/src/test/ui/span/non-existing-module-import.rs b/src/test/ui/span/non-existing-module-import.rs index 3d45a94d53..ad6409f014 100644 --- a/src/test/ui/span/non-existing-module-import.rs +++ b/src/test/ui/span/non-existing-module-import.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::bar::{foo1, foo2}; +use std::bar::{foo1, foo2}; //~ ERROR unresolved import fn main() {} diff --git a/src/test/ui/span/non-existing-module-import.stderr b/src/test/ui/span/non-existing-module-import.stderr index 93339576f4..74f5dac493 100644 --- a/src/test/ui/span/non-existing-module-import.stderr +++ b/src/test/ui/span/non-existing-module-import.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `std::bar` --> $DIR/non-existing-module-import.rs:11:10 | -11 | use std::bar::{foo1, foo2}; +11 | use std::bar::{foo1, foo2}; //~ ERROR unresolved import | ^^^ Could not find `bar` in `std` error: aborting due to previous error diff --git a/src/test/ui/span/pub-struct-field.rs b/src/test/ui/span/pub-struct-field.rs index 54cb0b59c7..11af361e8a 100644 --- a/src/test/ui/span/pub-struct-field.rs +++ b/src/test/ui/span/pub-struct-field.rs @@ -13,8 +13,8 @@ struct Foo { bar: u8, - pub bar: u8, - pub(crate) bar: u8, + pub bar: u8, //~ ERROR is already declared + pub(crate) bar: u8, //~ ERROR is already declared } fn main() {} diff --git a/src/test/ui/span/pub-struct-field.stderr b/src/test/ui/span/pub-struct-field.stderr index c66361c854..5b303758d2 100644 --- a/src/test/ui/span/pub-struct-field.stderr +++ b/src/test/ui/span/pub-struct-field.stderr @@ -3,7 +3,7 @@ error[E0124]: field `bar` is already declared | 15 | bar: u8, | ------- `bar` first declared here -16 | pub bar: u8, +16 | pub bar: u8, //~ ERROR is already declared | ^^^^^^^^^^^ field already declared error[E0124]: field `bar` is already declared @@ -11,8 +11,8 @@ error[E0124]: field `bar` is already declared | 15 | bar: u8, | ------- `bar` first declared here -16 | pub bar: u8, -17 | pub(crate) bar: u8, +16 | pub bar: u8, //~ ERROR is already declared +17 | pub(crate) bar: u8, //~ ERROR is already declared | ^^^^^^^^^^^^^^^^^^ field already declared error: aborting due to 2 previous errors diff --git a/src/test/ui/span/range-2.rs b/src/test/ui/span/range-2.rs index 94967693ec..d69b3ea098 100644 --- a/src/test/ui/span/range-2.rs +++ b/src/test/ui/span/range-2.rs @@ -15,7 +15,7 @@ pub fn main() { let a = 42; let b = 42; &a..&b - //~^ ERROR `a` does not live long enough - //~^^ ERROR `b` does not live long enough }; + //~^^ ERROR `a` does not live long enough + //~| ERROR `b` does not live long enough } diff --git a/src/test/ui/span/range-2.stderr b/src/test/ui/span/range-2.stderr index 285ab4aee4..106a8a7667 100644 --- a/src/test/ui/span/range-2.stderr +++ b/src/test/ui/span/range-2.stderr @@ -1,22 +1,22 @@ error[E0597]: `a` does not live long enough - --> $DIR/range-2.rs:20:5 + --> $DIR/range-2.rs:17:10 | 17 | &a..&b - | - borrow occurs here + | ^ borrowed value does not live long enough +18 | }; + | - `a` dropped here while still borrowed ... -20 | }; - | ^ `a` dropped here while still borrowed 21 | } | - borrowed value needs to live until here error[E0597]: `b` does not live long enough - --> $DIR/range-2.rs:20:5 + --> $DIR/range-2.rs:17:14 | 17 | &a..&b - | - borrow occurs here + | ^ borrowed value does not live long enough +18 | }; + | - `b` dropped here while still borrowed ... -20 | }; - | ^ `b` dropped here while still borrowed 21 | } | - borrowed value needs to live until here diff --git a/src/test/ui/span/recursive-type-field.rs b/src/test/ui/span/recursive-type-field.rs index 6fef4d30f7..764b539257 100644 --- a/src/test/ui/span/recursive-type-field.rs +++ b/src/test/ui/span/recursive-type-field.rs @@ -10,12 +10,12 @@ use std::rc::Rc; -struct Foo<'a> { +struct Foo<'a> { //~ ERROR recursive type bar: Bar<'a>, b: Rc<Bar<'a>>, } -struct Bar<'a> { +struct Bar<'a> { //~ ERROR recursive type y: (Foo<'a>, Foo<'a>), z: Option<Bar<'a>>, a: &'a Foo<'a>, diff --git a/src/test/ui/span/recursive-type-field.stderr b/src/test/ui/span/recursive-type-field.stderr index b4d0b5a6a2..bd9f5f032e 100644 --- a/src/test/ui/span/recursive-type-field.stderr +++ b/src/test/ui/span/recursive-type-field.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `Foo` has infinite size --> $DIR/recursive-type-field.rs:13:1 | -13 | struct Foo<'a> { +13 | struct Foo<'a> { //~ ERROR recursive type | ^^^^^^^^^^^^^^ recursive type has infinite size 14 | bar: Bar<'a>, | ------------ recursive without indirection @@ -11,7 +11,7 @@ error[E0072]: recursive type `Foo` has infinite size error[E0072]: recursive type `Bar` has infinite size --> $DIR/recursive-type-field.rs:18:1 | -18 | struct Bar<'a> { +18 | struct Bar<'a> { //~ ERROR recursive type | ^^^^^^^^^^^^^^ recursive type has infinite size 19 | y: (Foo<'a>, Foo<'a>), | --------------------- recursive without indirection diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs b/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs index 8ec6036762..93b3d67335 100644 --- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs +++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs @@ -14,7 +14,8 @@ fn main() { let mut f; { let c = 1; - let c_ref = &c; //~ ERROR `c` does not live long enough + let c_ref = &c; + //~^ ERROR `c` does not live long enough f = move |a: isize, b: isize| { a + b + *c_ref }; } } diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr index 29848412e4..ca453c22cc 100644 --- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr +++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr @@ -1,12 +1,12 @@ error[E0597]: `c` does not live long enough - --> $DIR/regionck-unboxed-closure-lifetimes.rs:19:5 + --> $DIR/regionck-unboxed-closure-lifetimes.rs:17:22 | -17 | let c_ref = &c; //~ ERROR `c` does not live long enough - | - borrow occurs here -18 | f = move |a: isize, b: isize| { a + b + *c_ref }; -19 | } - | ^ `c` dropped here while still borrowed -20 | } +17 | let c_ref = &c; + | ^ borrowed value does not live long enough +... +20 | } + | - `c` dropped here while still borrowed +21 | } | - borrowed value needs to live until here error: aborting due to previous error diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs index 99b0d6ed29..cf94969742 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs @@ -20,6 +20,7 @@ fn main() { let blah; { let ss: &isize = &id(1); + //~^ ERROR borrowed value does not live long enough blah = box ss as Box<Foo>; } } diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr index 6a3625441b..12f7067622 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr @@ -1,12 +1,12 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:24:5 + --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:27 | 22 | let ss: &isize = &id(1); - | ----- temporary value created here -23 | blah = box ss as Box<Foo>; -24 | } - | ^ temporary value dropped here while still borrowed -25 | } + | ^^^^^ temporary value does not live long enough +... +25 | } + | - temporary value dropped here while still borrowed +26 | } | - temporary value needs to live until here error: aborting due to previous error diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.rs b/src/test/ui/span/regions-close-over-type-parameter-2.rs index 053af49e06..e7eff6f255 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.rs +++ b/src/test/ui/span/regions-close-over-type-parameter-2.rs @@ -30,7 +30,8 @@ fn main() { let _ = { let tmp0 = 3; - let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough + let tmp1 = &tmp0; repeater3(tmp1) }; + //~^^^ ERROR `tmp0` does not live long enough } diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.stderr b/src/test/ui/span/regions-close-over-type-parameter-2.stderr index a89127b143..b90e67d5a3 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.stderr +++ b/src/test/ui/span/regions-close-over-type-parameter-2.stderr @@ -1,11 +1,11 @@ error[E0597]: `tmp0` does not live long enough - --> $DIR/regions-close-over-type-parameter-2.rs:35:5 + --> $DIR/regions-close-over-type-parameter-2.rs:33:21 | -33 | let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough - | ---- borrow occurs here +33 | let tmp1 = &tmp0; + | ^^^^ borrowed value does not live long enough 34 | repeater3(tmp1) 35 | }; - | ^- borrowed value needs to live until here + | -- borrowed value needs to live until here | | | `tmp0` dropped here while still borrowed diff --git a/src/test/ui/span/regions-escape-loop-via-variable.rs b/src/test/ui/span/regions-escape-loop-via-variable.rs index f588655d1a..96c1ccd532 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.rs +++ b/src/test/ui/span/regions-escape-loop-via-variable.rs @@ -18,6 +18,7 @@ fn main() { loop { let x = 1 + *p; - p = &x; //~ ERROR `x` does not live long enough + p = &x; } + //~^^ ERROR `x` does not live long enough } diff --git a/src/test/ui/span/regions-escape-loop-via-variable.stderr b/src/test/ui/span/regions-escape-loop-via-variable.stderr index cfdd1c8b15..8cdf4e2d82 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.stderr +++ b/src/test/ui/span/regions-escape-loop-via-variable.stderr @@ -1,11 +1,12 @@ error[E0597]: `x` does not live long enough - --> $DIR/regions-escape-loop-via-variable.rs:22:5 + --> $DIR/regions-escape-loop-via-variable.rs:21:14 | -21 | p = &x; //~ ERROR `x` does not live long enough - | - borrow occurs here +21 | p = &x; + | ^ borrowed value does not live long enough 22 | } - | ^ `x` dropped here while still borrowed -23 | } + | - `x` dropped here while still borrowed +23 | //~^^ ERROR `x` does not live long enough +24 | } | - borrowed value needs to live until here error: aborting due to previous error diff --git a/src/test/ui/span/regions-escape-loop-via-vec.rs b/src/test/ui/span/regions-escape-loop-via-vec.rs index 8982b5cd98..8e85ca5bce 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.rs +++ b/src/test/ui/span/regions-escape-loop-via-vec.rs @@ -12,20 +12,12 @@ fn broken() { let mut x = 3; let mut _y = vec![&mut x]; - //~^ NOTE borrow of `x` occurs here - //~| NOTE borrow of `x` occurs here - //~| NOTE borrow of `x` occurs here while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed - //~^ NOTE use of borrowed `x` let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed - //~^ NOTE use of borrowed `x` - _y.push(&mut z); //~ ERROR `z` does not live long enough - //~^ NOTE does not live long enough + _y.push(&mut z); + //~^ ERROR `z` does not live long enough x += 1; //~ ERROR cannot assign - //~^ NOTE assignment to borrowed `x` occurs here } - //~^ NOTE borrowed value only lives until here } -//~^ NOTE borrowed value needs to live until here fn main() { } diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr index b61df82e8a..73ff449b2b 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr @@ -1,40 +1,38 @@ error[E0597]: `z` does not live long enough - --> $DIR/regions-escape-loop-via-vec.rs:26:5 + --> $DIR/regions-escape-loop-via-vec.rs:17:22 | -22 | _y.push(&mut z); //~ ERROR `z` does not live long enough - | - borrow occurs here +17 | _y.push(&mut z); + | ^ borrowed value does not live long enough ... -26 | } - | ^ `z` dropped here while still borrowed -27 | //~^ NOTE borrowed value only lives until here -28 | } +20 | } + | - `z` dropped here while still borrowed +21 | } | - borrowed value needs to live until here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:18:11 + --> $DIR/regions-escape-loop-via-vec.rs:15:11 | 14 | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -... -18 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +15 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:20:13 + --> $DIR/regions-escape-loop-via-vec.rs:16:13 | 14 | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -... -20 | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +15 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +16 | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed | ^^^^^ use of borrowed `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/regions-escape-loop-via-vec.rs:24:9 + --> $DIR/regions-escape-loop-via-vec.rs:19:9 | 14 | let mut _y = vec![&mut x]; | - borrow of `x` occurs here ... -24 | x += 1; //~ ERROR cannot assign +19 | x += 1; //~ ERROR cannot assign | ^^^^^^ assignment to borrowed `x` occurs here error: aborting due to 4 previous errors diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs b/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs index a05658e9e5..b6adc2206e 100644 --- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs +++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs @@ -21,7 +21,8 @@ fn foo<C, M>(mut cond: C, mut make_box: M) where // Here we complain because the resulting region // of this borrow is the fn body as a whole. - y = borrow(&*x); //~ ERROR `*x` does not live long enough + y = borrow(&*x); + //~^ ERROR `*x` does not live long enough assert_eq!(*x, *y); if cond() { break; } diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr index 0960f5e1b2..1fc7e05f49 100644 --- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr +++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr @@ -1,13 +1,13 @@ error[E0597]: `*x` does not live long enough - --> $DIR/regions-infer-borrow-scope-within-loop.rs:28:5 + --> $DIR/regions-infer-borrow-scope-within-loop.rs:24:21 | -24 | y = borrow(&*x); //~ ERROR `*x` does not live long enough - | -- borrow occurs here +24 | y = borrow(&*x); + | ^^ borrowed value does not live long enough ... -28 | } - | ^ `*x` dropped here while still borrowed -29 | assert!(*y != 0); -30 | } +29 | } + | - `*x` dropped here while still borrowed +30 | assert!(*y != 0); +31 | } | - borrowed value needs to live until here error: aborting due to previous error diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.rs b/src/test/ui/span/send-is-not-static-ensures-scoping.rs index 1b7718d228..20f8d473ac 100644 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.rs +++ b/src/test/ui/span/send-is-not-static-ensures-scoping.rs @@ -23,7 +23,8 @@ impl<'a> Guard<'a> { fn main() { let bad = { let x = 1; - let y = &x; //~ ERROR `x` does not live long enough + let y = &x; + //~^ ERROR `x` does not live long enough scoped(|| { let _z = y; diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr index 02fc982049..657682d962 100644 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr +++ b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr @@ -1,27 +1,27 @@ error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:32:5 + --> $DIR/send-is-not-static-ensures-scoping.rs:26:18 | -26 | let y = &x; //~ ERROR `x` does not live long enough - | - borrow occurs here +26 | let y = &x; + | ^ borrowed value does not live long enough ... -32 | }; - | ^ `x` dropped here while still borrowed +33 | }; + | - `x` dropped here while still borrowed ... -35 | } +36 | } | - borrowed value needs to live until here error[E0597]: `y` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:29:22 + --> $DIR/send-is-not-static-ensures-scoping.rs:30:22 | -28 | scoped(|| { +29 | scoped(|| { | -- capture occurs here -29 | let _z = y; - | ^ does not live long enough +30 | let _z = y; + | ^ borrowed value does not live long enough ... -32 | }; +33 | }; | - borrowed value only lives until here ... -35 | } +36 | } | - borrowed value needs to live until here error: aborting due to 2 previous errors diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.rs b/src/test/ui/span/send-is-not-static-std-sync-2.rs index d9d3706586..a10f700fb5 100644 --- a/src/test/ui/span/send-is-not-static-std-sync-2.rs +++ b/src/test/ui/span/send-is-not-static-std-sync-2.rs @@ -18,8 +18,9 @@ use std::sync::{Mutex, RwLock, mpsc}; fn mutex() { let lock = { let x = 1; - Mutex::new(&x) //~ ERROR does not live long enough + Mutex::new(&x) }; + //~^^ ERROR `x` does not live long enough let _dangling = *lock.lock().unwrap(); } @@ -27,8 +28,9 @@ fn mutex() { fn rwlock() { let lock = { let x = 1; - RwLock::new(&x) //~ ERROR does not live long enough + RwLock::new(&x) }; + //~^^ ERROR `x` does not live long enough let _dangling = *lock.read().unwrap(); } @@ -36,9 +38,10 @@ fn channel() { let (_tx, rx) = { let x = 1; let (tx, rx) = mpsc::channel(); - let _ = tx.send(&x); //~ ERROR does not live long enough + let _ = tx.send(&x); (tx, rx) }; + //~^^^ ERROR `x` does not live long enough let _dangling = rx.recv(); } diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.stderr b/src/test/ui/span/send-is-not-static-std-sync-2.stderr index 318dab599f..af8b7aeaa6 100644 --- a/src/test/ui/span/send-is-not-static-std-sync-2.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync-2.stderr @@ -1,35 +1,35 @@ error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:22:5 + --> $DIR/send-is-not-static-std-sync-2.rs:21:21 | -21 | Mutex::new(&x) //~ ERROR does not live long enough - | - borrow occurs here +21 | Mutex::new(&x) + | ^ borrowed value does not live long enough 22 | }; - | ^ `x` dropped here while still borrowed + | - `x` dropped here while still borrowed ... -25 | } +26 | } | - borrowed value needs to live until here error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:31:5 + --> $DIR/send-is-not-static-std-sync-2.rs:31:22 | -30 | RwLock::new(&x) //~ ERROR does not live long enough - | - borrow occurs here -31 | }; - | ^ `x` dropped here while still borrowed -32 | let _dangling = *lock.read().unwrap(); -33 | } +31 | RwLock::new(&x) + | ^ borrowed value does not live long enough +32 | }; + | - `x` dropped here while still borrowed +... +35 | } | - borrowed value needs to live until here error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:41:5 + --> $DIR/send-is-not-static-std-sync-2.rs:41:26 | -39 | let _ = tx.send(&x); //~ ERROR does not live long enough - | - borrow occurs here -40 | (tx, rx) -41 | }; - | ^ `x` dropped here while still borrowed +41 | let _ = tx.send(&x); + | ^ borrowed value does not live long enough +42 | (tx, rx) +43 | }; + | - `x` dropped here while still borrowed ... -44 | } +47 | } | - borrowed value needs to live until here error: aborting due to 3 previous errors diff --git a/src/test/ui/span/send-is-not-static-std-sync.rs b/src/test/ui/span/send-is-not-static-std-sync.rs index 8ec2fe8a1e..4cf36e00a6 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.rs +++ b/src/test/ui/span/send-is-not-static-std-sync.rs @@ -23,8 +23,9 @@ fn mutex() { drop(y); //~ ERROR cannot move out { let z = 2; - *lock.lock().unwrap() = &z; //~ ERROR does not live long enough + *lock.lock().unwrap() = &z; } + //~^^ ERROR `z` does not live long enough } fn rwlock() { @@ -35,8 +36,9 @@ fn rwlock() { drop(y); //~ ERROR cannot move out { let z = 2; - *lock.write().unwrap() = &z; //~ ERROR does not live long enough + *lock.write().unwrap() = &z; } + //~^^ ERROR `z` does not live long enough } fn channel() { @@ -49,8 +51,9 @@ fn channel() { drop(y); //~ ERROR cannot move out { let z = 2; - tx.send(&z).unwrap(); //~ ERROR does not live long enough + tx.send(&z).unwrap(); } + //~^^ ERROR `z` does not live long enough } fn main() {} diff --git a/src/test/ui/span/send-is-not-static-std-sync.stderr b/src/test/ui/span/send-is-not-static-std-sync.stderr index 988ff22810..7c61398a86 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.stderr @@ -1,11 +1,12 @@ error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:27:5 + --> $DIR/send-is-not-static-std-sync.rs:26:34 | -26 | *lock.lock().unwrap() = &z; //~ ERROR does not live long enough - | - borrow occurs here +26 | *lock.lock().unwrap() = &z; + | ^ borrowed value does not live long enough 27 | } - | ^ `z` dropped here while still borrowed -28 | } + | - `z` dropped here while still borrowed +28 | //~^^ ERROR `z` does not live long enough +29 | } | - borrowed value needs to live until here error[E0505]: cannot move out of `y` because it is borrowed @@ -17,39 +18,41 @@ error[E0505]: cannot move out of `y` because it is borrowed | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:39:5 + --> $DIR/send-is-not-static-std-sync.rs:39:35 | -38 | *lock.write().unwrap() = &z; //~ ERROR does not live long enough - | - borrow occurs here -39 | } - | ^ `z` dropped here while still borrowed -40 | } +39 | *lock.write().unwrap() = &z; + | ^ borrowed value does not live long enough +40 | } + | - `z` dropped here while still borrowed +41 | //~^^ ERROR `z` does not live long enough +42 | } | - borrowed value needs to live until here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:35:10 + --> $DIR/send-is-not-static-std-sync.rs:36:10 | -34 | *lock.write().unwrap() = &*y; +35 | *lock.write().unwrap() = &*y; | -- borrow of `*y` occurs here -35 | drop(y); //~ ERROR cannot move out +36 | drop(y); //~ ERROR cannot move out | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:53:5 + --> $DIR/send-is-not-static-std-sync.rs:54:18 | -52 | tx.send(&z).unwrap(); //~ ERROR does not live long enough - | - borrow occurs here -53 | } - | ^ `z` dropped here while still borrowed -54 | } +54 | tx.send(&z).unwrap(); + | ^ borrowed value does not live long enough +55 | } + | - `z` dropped here while still borrowed +56 | //~^^ ERROR `z` does not live long enough +57 | } | - borrowed value needs to live until here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:49:10 + --> $DIR/send-is-not-static-std-sync.rs:51:10 | -48 | tx.send(&*y); +50 | tx.send(&*y); | -- borrow of `*y` occurs here -49 | drop(y); //~ ERROR cannot move out +51 | drop(y); //~ ERROR cannot move out | ^ move out of `y` occurs here error: aborting due to 6 previous errors diff --git a/src/test/ui/span/slice-borrow.stderr b/src/test/ui/span/slice-borrow.stderr index 5e8edf80df..540aae0983 100644 --- a/src/test/ui/span/slice-borrow.stderr +++ b/src/test/ui/span/slice-borrow.stderr @@ -1,15 +1,15 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/slice-borrow.rs:18:5 + --> $DIR/slice-borrow.rs:16:28 | 16 | let x: &[isize] = &vec![1, 2, 3, 4, 5]; - | ------------------- temporary value created here + | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough 17 | y = &x[1..]; 18 | } - | ^ temporary value dropped here while still borrowed + | - temporary value dropped here while still borrowed 19 | } | - temporary value needs to live until here | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/span/suggestion-non-ascii.rs b/src/test/ui/span/suggestion-non-ascii.rs index 67dbe1dc7b..2d82bba33c 100644 --- a/src/test/ui/span/suggestion-non-ascii.rs +++ b/src/test/ui/span/suggestion-non-ascii.rs @@ -11,6 +11,6 @@ fn main() { let tup = (1,); - println!("☃{}", tup[0]); + println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type } diff --git a/src/test/ui/span/suggestion-non-ascii.stderr b/src/test/ui/span/suggestion-non-ascii.stderr index c67a8fe32b..9ee8ccb01d 100644 --- a/src/test/ui/span/suggestion-non-ascii.stderr +++ b/src/test/ui/span/suggestion-non-ascii.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `({integer},)` --> $DIR/suggestion-non-ascii.rs:14:21 | -14 | println!("☃{}", tup[0]); +14 | println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type | ^^^^^^ help: to access tuple elements, use: `tup.0` error: aborting due to previous error diff --git a/src/test/ui/span/type-binding.rs b/src/test/ui/span/type-binding.rs index 05285c732f..d8a2e332a0 100644 --- a/src/test/ui/span/type-binding.rs +++ b/src/test/ui/span/type-binding.rs @@ -14,5 +14,6 @@ use std::ops::Deref; fn homura<T: Deref<Trget = i32>>(_: T) {} +//~^ ERROR not found fn main() {} diff --git a/src/test/ui/span/typo-suggestion.rs b/src/test/ui/span/typo-suggestion.rs index 536bf16142..7aeaa44bec 100644 --- a/src/test/ui/span/typo-suggestion.rs +++ b/src/test/ui/span/typo-suggestion.rs @@ -12,8 +12,8 @@ fn main() { let foo = 1; // `foo` shouldn't be suggested, it is too dissimilar from `bar`. - println!("Hello {}", bar); + println!("Hello {}", bar); //~ ERROR cannot find value // But this is close enough. - println!("Hello {}", fob); + println!("Hello {}", fob); //~ ERROR cannot find value } diff --git a/src/test/ui/span/typo-suggestion.stderr b/src/test/ui/span/typo-suggestion.stderr index dca0a93f89..2a084b1ae6 100644 --- a/src/test/ui/span/typo-suggestion.stderr +++ b/src/test/ui/span/typo-suggestion.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `bar` in this scope --> $DIR/typo-suggestion.rs:15:26 | -15 | println!("Hello {}", bar); +15 | println!("Hello {}", bar); //~ ERROR cannot find value | ^^^ not found in this scope error[E0425]: cannot find value `fob` in this scope --> $DIR/typo-suggestion.rs:18:26 | -18 | println!("Hello {}", fob); +18 | println!("Hello {}", fob); //~ ERROR cannot find value | ^^^ did you mean `foo`? error: aborting due to 2 previous errors diff --git a/src/test/ui/span/unused-warning-point-at-signature.rs b/src/test/ui/span/unused-warning-point-at-signature.rs index eb659d08da..6a7071d49a 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.rs +++ b/src/test/ui/span/unused-warning-point-at-signature.rs @@ -12,25 +12,25 @@ #![warn(unused)] -enum Enum { +enum Enum { //~ WARN enum is never used A, B, C, D, } -struct Struct { +struct Struct { //~ WARN struct is never used a: usize, b: usize, c: usize, d: usize, } -fn func() -> usize { +fn func() -> usize { //~ WARN function is never used 3 } -fn +fn //~ WARN function is never used func_complete_span() -> usize { diff --git a/src/test/ui/span/unused-warning-point-at-signature.stderr b/src/test/ui/span/unused-warning-point-at-signature.stderr index 8e658670e9..ed36bd1780 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.stderr +++ b/src/test/ui/span/unused-warning-point-at-signature.stderr @@ -1,7 +1,7 @@ warning: enum is never used: `Enum` --> $DIR/unused-warning-point-at-signature.rs:15:1 | -15 | enum Enum { +15 | enum Enum { //~ WARN enum is never used | ^^^^^^^^^ | note: lint level defined here @@ -14,19 +14,19 @@ note: lint level defined here warning: struct is never used: `Struct` --> $DIR/unused-warning-point-at-signature.rs:22:1 | -22 | struct Struct { +22 | struct Struct { //~ WARN struct is never used | ^^^^^^^^^^^^^ warning: function is never used: `func` --> $DIR/unused-warning-point-at-signature.rs:29:1 | -29 | fn func() -> usize { +29 | fn func() -> usize { //~ WARN function is never used | ^^^^^^^^^^^^^^^^^^ warning: function is never used: `func_complete_span` --> $DIR/unused-warning-point-at-signature.rs:33:1 | -33 | / fn +33 | / fn //~ WARN function is never used 34 | | func_complete_span() 35 | | -> usize 36 | | { diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs index d99f3bb19d..3cf07b8b09 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs @@ -23,7 +23,7 @@ // conditions above to be satisfied, meaning that if the dropck is // sound, it should reject this code. -#![feature(const_atomic_usize_new)] + use std::cell::Cell; use id::Id; @@ -125,10 +125,10 @@ fn f() { c1.v.push(CheckId(Cell::new(None))); c2.v.push(CheckId(Cell::new(None))); c1.v[0].v.set(Some(&c2)); + //~^ ERROR `c2` does not live long enough c2.v[0].v.set(Some(&c1)); + //~^ ERROR `c1` does not live long enough } -//~^ ERROR `c2` does not live long enough -//~| ERROR `c1` does not live long enough fn main() { f(); diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr index f7c94ed9f7..cc8e58179e 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr @@ -1,21 +1,22 @@ error[E0597]: `c2` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:1 + --> $DIR/vec-must-not-hide-type-from-dropck.rs:127:25 | 127 | c1.v[0].v.set(Some(&c2)); - | -- borrow occurs here -128 | c2.v[0].v.set(Some(&c1)); -129 | } - | ^ `c2` dropped here while still borrowed + | ^^ borrowed value does not live long enough +... +131 | } + | - `c2` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c1` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:1 + --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:25 | -128 | c2.v[0].v.set(Some(&c1)); - | -- borrow occurs here -129 | } - | ^ `c1` dropped here while still borrowed +129 | c2.v[0].v.set(Some(&c1)); + | ^^ borrowed value does not live long enough +130 | //~^ ERROR `c1` does not live long enough +131 | } + | - `c1` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/vec_refs_data_with_early_death.rs b/src/test/ui/span/vec_refs_data_with_early_death.rs index f40a25920b..42373a87a6 100644 --- a/src/test/ui/span/vec_refs_data_with_early_death.rs +++ b/src/test/ui/span/vec_refs_data_with_early_death.rs @@ -25,9 +25,9 @@ fn main() { let y: i8 = 4; v.push(&x); + //~^ ERROR `x` does not live long enough v.push(&y); + //~^ ERROR `y` does not live long enough assert_eq!(v, [&3, &4]); } -//~^ ERROR `x` does not live long enough -//~| ERROR `y` does not live long enough diff --git a/src/test/ui/span/vec_refs_data_with_early_death.stderr b/src/test/ui/span/vec_refs_data_with_early_death.stderr index 282e5caf20..acfc7babe0 100644 --- a/src/test/ui/span/vec_refs_data_with_early_death.stderr +++ b/src/test/ui/span/vec_refs_data_with_early_death.stderr @@ -1,22 +1,22 @@ error[E0597]: `x` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:31:1 + --> $DIR/vec_refs_data_with_early_death.rs:27:13 | 27 | v.push(&x); - | - borrow occurs here + | ^ borrowed value does not live long enough ... -31 | } - | ^ `x` dropped here while still borrowed +33 | } + | - `x` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: `y` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:31:1 + --> $DIR/vec_refs_data_with_early_death.rs:29:13 | -28 | v.push(&y); - | - borrow occurs here +29 | v.push(&y); + | ^ borrowed value does not live long enough ... -31 | } - | ^ `y` dropped here while still borrowed +33 | } + | - `y` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/visibility-ty-params.rs b/src/test/ui/span/visibility-ty-params.rs index 2a4a5edd04..5df28971e9 100644 --- a/src/test/ui/span/visibility-ty-params.rs +++ b/src/test/ui/span/visibility-ty-params.rs @@ -14,7 +14,6 @@ macro_rules! m { struct S<T>(T); m!{ S<u8> } //~ ERROR unexpected generic arguments in path -//~^ ERROR expected module, found struct `S` mod m { m!{ m<> } //~ ERROR unexpected generic arguments in path diff --git a/src/test/ui/span/visibility-ty-params.stderr b/src/test/ui/span/visibility-ty-params.stderr index 673b9a38e0..8460f81af8 100644 --- a/src/test/ui/span/visibility-ty-params.stderr +++ b/src/test/ui/span/visibility-ty-params.stderr @@ -5,9 +5,9 @@ error: unexpected generic arguments in path | ^^^^^ error: unexpected generic arguments in path - --> $DIR/visibility-ty-params.rs:20:9 + --> $DIR/visibility-ty-params.rs:19:9 | -20 | m!{ m<> } //~ ERROR unexpected generic arguments in path +19 | m!{ m<> } //~ ERROR unexpected generic arguments in path | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/span/wf-method-late-bound-regions.rs b/src/test/ui/span/wf-method-late-bound-regions.rs index b9d292fd15..d58c29d4a3 100644 --- a/src/test/ui/span/wf-method-late-bound-regions.rs +++ b/src/test/ui/span/wf-method-late-bound-regions.rs @@ -27,7 +27,8 @@ fn main() { let f2 = f; let dangling = { let pointer = Box::new(42); - f2.xmute(&pointer) //~ ERROR `pointer` does not live long enough + f2.xmute(&pointer) }; + //~^^ ERROR `pointer` does not live long enough println!("{}", dangling); } diff --git a/src/test/ui/span/wf-method-late-bound-regions.stderr b/src/test/ui/span/wf-method-late-bound-regions.stderr index a37b5d17aa..8dd7725903 100644 --- a/src/test/ui/span/wf-method-late-bound-regions.stderr +++ b/src/test/ui/span/wf-method-late-bound-regions.stderr @@ -1,12 +1,12 @@ error[E0597]: `pointer` does not live long enough - --> $DIR/wf-method-late-bound-regions.rs:31:5 + --> $DIR/wf-method-late-bound-regions.rs:30:19 | -30 | f2.xmute(&pointer) //~ ERROR `pointer` does not live long enough - | ------- borrow occurs here +30 | f2.xmute(&pointer) + | ^^^^^^^ borrowed value does not live long enough 31 | }; - | ^ `pointer` dropped here while still borrowed -32 | println!("{}", dangling); -33 | } + | - `pointer` dropped here while still borrowed +... +34 | } | - borrowed value needs to live until here error: aborting due to previous error diff --git a/src/test/compile-fail/specialization/specialization-feature-gate-default.rs b/src/test/ui/specialization-feature-gate-default.rs similarity index 100% rename from src/test/compile-fail/specialization/specialization-feature-gate-default.rs rename to src/test/ui/specialization-feature-gate-default.rs diff --git a/src/test/ui/specialization-feature-gate-default.stderr b/src/test/ui/specialization-feature-gate-default.stderr new file mode 100644 index 0000000000..e17d130838 --- /dev/null +++ b/src/test/ui/specialization-feature-gate-default.stderr @@ -0,0 +1,10 @@ +error: specialization is unstable (see issue #31844) + --> $DIR/specialization-feature-gate-default.rs:20:5 + | +20 | default fn foo(&self) {} //~ ERROR specialization is unstable + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(specialization)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/specialization/specialization-feature-gate-overlap.rs b/src/test/ui/specialization-feature-gate-overlap.rs similarity index 100% rename from src/test/compile-fail/specialization/specialization-feature-gate-overlap.rs rename to src/test/ui/specialization-feature-gate-overlap.rs diff --git a/src/test/ui/specialization-feature-gate-overlap.stderr b/src/test/ui/specialization-feature-gate-overlap.stderr new file mode 100644 index 0000000000..6ff261c696 --- /dev/null +++ b/src/test/ui/specialization-feature-gate-overlap.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `u8`: + --> $DIR/specialization-feature-gate-overlap.rs:23:1 + | +19 | impl<T> Foo for T { + | ----------------- first implementation here +... +23 | impl Foo for u8 { //~ ERROR E0119 + | ^^^^^^^^^^^^^^^ conflicting implementation for `u8` + +error: aborting due to previous error + diff --git a/src/test/ui/static-lifetime.rs b/src/test/ui/static-lifetime.rs index 7b1887b2d1..62abf11654 100644 --- a/src/test/ui/static-lifetime.rs +++ b/src/test/ui/static-lifetime.rs @@ -10,7 +10,7 @@ pub trait Arbitrary: Sized + 'static {} -impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} +impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound fn main() { -} \ No newline at end of file +} diff --git a/src/test/ui/static-lifetime.stderr b/src/test/ui/static-lifetime.stderr index adeabd9130..a99dbf21e5 100644 --- a/src/test/ui/static-lifetime.stderr +++ b/src/test/ui/static-lifetime.stderr @@ -1,13 +1,13 @@ error[E0478]: lifetime bound not satisfied --> $DIR/static-lifetime.rs:13:20 | -13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} +13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound | ^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 13:1 --> $DIR/static-lifetime.rs:13:1 | -13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} +13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: but lifetime parameter must outlive the static lifetime diff --git a/src/test/compile-fail/str-concat-on-double-ref.rs b/src/test/ui/str-concat-on-double-ref.rs similarity index 87% rename from src/test/compile-fail/str-concat-on-double-ref.rs rename to src/test/ui/str-concat-on-double-ref.rs index f85422f76d..292dcbf8ef 100644 --- a/src/test/compile-fail/str-concat-on-double-ref.rs +++ b/src/test/ui/str-concat-on-double-ref.rs @@ -13,6 +13,5 @@ fn main() { let b: &str = &"2"; let c = a + b; //~^ ERROR binary operation `+` cannot be applied to type `&std::string::String` - //~| NOTE an implementation of `std::ops::Add` might be missing for `&std::string::String` println!("{:?}", c); } diff --git a/src/test/ui/str-concat-on-double-ref.stderr b/src/test/ui/str-concat-on-double-ref.stderr new file mode 100644 index 0000000000..15d5781330 --- /dev/null +++ b/src/test/ui/str-concat-on-double-ref.stderr @@ -0,0 +1,10 @@ +error[E0369]: binary operation `+` cannot be applied to type `&std::string::String` + --> $DIR/str-concat-on-double-ref.rs:14:13 + | +14 | let c = a + b; + | ^^^^^ + | + = note: an implementation of `std::ops::Add` might be missing for `&std::string::String` + +error: aborting due to previous error + diff --git a/src/test/ui/str-lit-type-mismatch.rs b/src/test/ui/str-lit-type-mismatch.rs index 0fd7d3a9d8..4a062f78a3 100644 --- a/src/test/ui/str-lit-type-mismatch.rs +++ b/src/test/ui/str-lit-type-mismatch.rs @@ -10,7 +10,7 @@ fn main() { - let x: &[u8] = "foo"; - let y: &[u8; 4] = "baaa"; - let z: &str = b"foo"; + let x: &[u8] = "foo"; //~ ERROR mismatched types + let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types + let z: &str = b"foo"; //~ ERROR mismatched types } diff --git a/src/test/ui/str-lit-type-mismatch.stderr b/src/test/ui/str-lit-type-mismatch.stderr index 47418522df..b232bf7466 100644 --- a/src/test/ui/str-lit-type-mismatch.stderr +++ b/src/test/ui/str-lit-type-mismatch.stderr @@ -1,32 +1,38 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:13:20 | -13 | let x: &[u8] = "foo"; - | ^^^^^ expected slice, found str +13 | let x: &[u8] = "foo"; //~ ERROR mismatched types + | ^^^^^ + | | + | expected slice, found str + | help: consider adding a leading `b`: `b"foo"` | = note: expected type `&[u8]` found type `&'static str` - = help: try `b"foo"` error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:14:23 | -14 | let y: &[u8; 4] = "baaa"; - | ^^^^^^ expected array of 4 elements, found str +14 | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types + | ^^^^^^ + | | + | expected array of 4 elements, found str + | help: consider adding a leading `b`: `b"baaa"` | = note: expected type `&[u8; 4]` found type `&'static str` - = help: try `b"baaa"` error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:15:19 | -15 | let z: &str = b"foo"; - | ^^^^^^ expected str, found array of 3 elements +15 | let z: &str = b"foo"; //~ ERROR mismatched types + | ^^^^^^ + | | + | expected str, found array of 3 elements + | help: consider removing the leading `b`: `"foo"` | = note: expected type `&str` found type `&'static [u8; 3]` - = help: try `"foo"` error: aborting due to 3 previous errors diff --git a/src/test/ui/struct-field-init-syntax.rs b/src/test/ui/struct-field-init-syntax.rs index 8ea62fef9f..f1e24495f8 100644 --- a/src/test/ui/struct-field-init-syntax.rs +++ b/src/test/ui/struct-field-init-syntax.rs @@ -16,12 +16,12 @@ fn main() { let foo = Foo { one: 111, ..Foo::default(), - //~^ ERROR cannot use a comma after struct expansion + //~^ ERROR cannot use a comma after the base struct }; let foo = Foo { ..Foo::default(), - //~^ ERROR cannot use a comma after struct expansion + //~^ ERROR cannot use a comma after the base struct one: 111, }; } diff --git a/src/test/compile-fail/struct-fields-decl-dupe.rs b/src/test/ui/struct-fields-decl-dupe.rs similarity index 86% rename from src/test/compile-fail/struct-fields-decl-dupe.rs rename to src/test/ui/struct-fields-decl-dupe.rs index dd9d7d2946..1f6b070d83 100644 --- a/src/test/compile-fail/struct-fields-decl-dupe.rs +++ b/src/test/ui/struct-fields-decl-dupe.rs @@ -9,10 +9,9 @@ // except according to those terms. struct BuildData { - foo: isize, //~ NOTE `foo` first declared here + foo: isize, foo: isize, //~^ ERROR field `foo` is already declared [E0124] - //~| NOTE field already declared } fn main() { diff --git a/src/test/ui/struct-fields-decl-dupe.stderr b/src/test/ui/struct-fields-decl-dupe.stderr new file mode 100644 index 0000000000..8f2180716c --- /dev/null +++ b/src/test/ui/struct-fields-decl-dupe.stderr @@ -0,0 +1,10 @@ +error[E0124]: field `foo` is already declared + --> $DIR/struct-fields-decl-dupe.rs:13:5 + | +12 | foo: isize, + | ---------- `foo` first declared here +13 | foo: isize, + | ^^^^^^^^^^ field already declared + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-fields-hints-no-dupe.rs b/src/test/ui/struct-fields-hints-no-dupe.rs similarity index 91% rename from src/test/compile-fail/struct-fields-hints-no-dupe.rs rename to src/test/ui/struct-fields-hints-no-dupe.rs index de78503d90..e4366cf79b 100644 --- a/src/test/compile-fail/struct-fields-hints-no-dupe.rs +++ b/src/test/ui/struct-fields-hints-no-dupe.rs @@ -19,7 +19,6 @@ fn main() { foo : 5, bar : 42, //~^ ERROR struct `A` has no field named `bar` - //~| NOTE field does not exist - did you mean `barr`? car : 9, }; } diff --git a/src/test/ui/struct-fields-hints-no-dupe.stderr b/src/test/ui/struct-fields-hints-no-dupe.stderr new file mode 100644 index 0000000000..93cbe1f5af --- /dev/null +++ b/src/test/ui/struct-fields-hints-no-dupe.stderr @@ -0,0 +1,8 @@ +error[E0560]: struct `A` has no field named `bar` + --> $DIR/struct-fields-hints-no-dupe.rs:20:9 + | +20 | bar : 42, + | ^^^^^ field does not exist - did you mean `barr`? + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-fields-hints.rs b/src/test/ui/struct-fields-hints.rs similarity index 91% rename from src/test/compile-fail/struct-fields-hints.rs rename to src/test/ui/struct-fields-hints.rs index 628f03f327..85dc1aedb4 100644 --- a/src/test/compile-fail/struct-fields-hints.rs +++ b/src/test/ui/struct-fields-hints.rs @@ -19,6 +19,5 @@ fn main() { foo : 5, bar : 42, //~^ ERROR struct `A` has no field named `bar` - //~| NOTE field does not exist - did you mean `car`? }; } diff --git a/src/test/ui/struct-fields-hints.stderr b/src/test/ui/struct-fields-hints.stderr new file mode 100644 index 0000000000..a7c77103e7 --- /dev/null +++ b/src/test/ui/struct-fields-hints.stderr @@ -0,0 +1,8 @@ +error[E0560]: struct `A` has no field named `bar` + --> $DIR/struct-fields-hints.rs:20:9 + | +20 | bar : 42, + | ^^^^^ field does not exist - did you mean `car`? + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-fields-too-many.rs b/src/test/ui/struct-fields-too-many.rs similarity index 86% rename from src/test/compile-fail/struct-fields-too-many.rs rename to src/test/ui/struct-fields-too-many.rs index b1af142ad0..1e0b8efc96 100644 --- a/src/test/compile-fail/struct-fields-too-many.rs +++ b/src/test/ui/struct-fields-too-many.rs @@ -17,7 +17,5 @@ fn main() { foo: 0, bar: 0 //~^ ERROR struct `BuildData` has no field named `bar` - //~| NOTE `BuildData` does not have this field - //~| NOTE available fields are: `foo` }; } diff --git a/src/test/ui/struct-fields-too-many.stderr b/src/test/ui/struct-fields-too-many.stderr new file mode 100644 index 0000000000..ec353d00aa --- /dev/null +++ b/src/test/ui/struct-fields-too-many.stderr @@ -0,0 +1,10 @@ +error[E0560]: struct `BuildData` has no field named `bar` + --> $DIR/struct-fields-too-many.rs:18:9 + | +18 | bar: 0 + | ^^^^ `BuildData` does not have this field + | + = note: available fields are: `foo` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-path-self-type-mismatch.rs b/src/test/ui/struct-path-self-type-mismatch.rs similarity index 67% rename from src/test/compile-fail/struct-path-self-type-mismatch.rs rename to src/test/ui/struct-path-self-type-mismatch.rs index ad568b41fc..e966ea6590 100644 --- a/src/test/compile-fail/struct-path-self-type-mismatch.rs +++ b/src/test/ui/struct-path-self-type-mismatch.rs @@ -15,20 +15,15 @@ trait Bar { fn bar(); } impl Bar for Foo<i32> { fn bar() { Self { inner: 1.5f32 }; //~ ERROR mismatched types - //~^ NOTE expected i32, found f32 } } impl<T> Foo<T> { - fn new<U>(u: U) -> Foo<U> { //~ NOTE expected `Foo<U>` because of return type + fn new<U>(u: U) -> Foo<U> { Self { //~^ ERROR mismatched types - //~| NOTE expected type parameter, found a different type parameter - //~| NOTE expected type `Foo<U>` inner: u //~^ ERROR mismatched types - //~| NOTE expected type parameter, found a different type parameter - //~| NOTE expected type `T` } } } diff --git a/src/test/ui/struct-path-self-type-mismatch.stderr b/src/test/ui/struct-path-self-type-mismatch.stderr new file mode 100644 index 0000000000..a98ec0ec4b --- /dev/null +++ b/src/test/ui/struct-path-self-type-mismatch.stderr @@ -0,0 +1,32 @@ +error[E0308]: mismatched types + --> $DIR/struct-path-self-type-mismatch.rs:17:23 + | +17 | Self { inner: 1.5f32 }; //~ ERROR mismatched types + | ^^^^^^ expected i32, found f32 + +error[E0308]: mismatched types + --> $DIR/struct-path-self-type-mismatch.rs:25:20 + | +25 | inner: u + | ^ expected type parameter, found a different type parameter + | + = note: expected type `T` + found type `U` + +error[E0308]: mismatched types + --> $DIR/struct-path-self-type-mismatch.rs:23:9 + | +22 | fn new<U>(u: U) -> Foo<U> { + | ------ expected `Foo<U>` because of return type +23 | / Self { +24 | | //~^ ERROR mismatched types +25 | | inner: u +26 | | //~^ ERROR mismatched types +27 | | } + | |_________^ expected type parameter, found a different type parameter + | + = note: expected type `Foo<U>` + found type `Foo<T>` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/suggest-private-fields.rs b/src/test/ui/suggest-private-fields.rs similarity index 78% rename from src/test/compile-fail/suggest-private-fields.rs rename to src/test/ui/suggest-private-fields.rs index d0752b5f02..77b38abad8 100644 --- a/src/test/compile-fail/suggest-private-fields.rs +++ b/src/test/ui/suggest-private-fields.rs @@ -24,19 +24,14 @@ fn main () { let k = B { aa: 20, //~^ ERROR struct `xc::B` has no field named `aa` - //~| NOTE field does not exist - did you mean `a`? bb: 20, //~^ ERROR struct `xc::B` has no field named `bb` - //~| NOTE `xc::B` does not have this field - //~| NOTE available fields are: `a` }; // local crate struct let l = A { aa: 20, //~^ ERROR struct `A` has no field named `aa` - //~| NOTE field does not exist - did you mean `a`? bb: 20, //~^ ERROR struct `A` has no field named `bb` - //~| NOTE field does not exist - did you mean `b`? }; } diff --git a/src/test/ui/suggest-private-fields.stderr b/src/test/ui/suggest-private-fields.stderr new file mode 100644 index 0000000000..d32d85f6e3 --- /dev/null +++ b/src/test/ui/suggest-private-fields.stderr @@ -0,0 +1,28 @@ +error[E0560]: struct `xc::B` has no field named `aa` + --> $DIR/suggest-private-fields.rs:25:9 + | +25 | aa: 20, + | ^^^ field does not exist - did you mean `a`? + +error[E0560]: struct `xc::B` has no field named `bb` + --> $DIR/suggest-private-fields.rs:27:9 + | +27 | bb: 20, + | ^^^ `xc::B` does not have this field + | + = note: available fields are: `a` + +error[E0560]: struct `A` has no field named `aa` + --> $DIR/suggest-private-fields.rs:32:9 + | +32 | aa: 20, + | ^^^ field does not exist - did you mean `a`? + +error[E0560]: struct `A` has no field named `bb` + --> $DIR/suggest-private-fields.rs:34:9 + | +34 | bb: 20, + | ^^^ field does not exist - did you mean `b`? + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/suggestions/closure-immutable-outer-variable.rs b/src/test/ui/suggestions/closure-immutable-outer-variable.rs index fe8e2bc6c8..1d14afd6a0 100644 --- a/src/test/ui/suggestions/closure-immutable-outer-variable.rs +++ b/src/test/ui/suggestions/closure-immutable-outer-variable.rs @@ -16,5 +16,5 @@ fn foo(mut f: Box<FnMut()>) { fn main() { let y = true; - foo(Box::new(move || y = false) as Box<_>); + foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable } diff --git a/src/test/ui/suggestions/closure-immutable-outer-variable.stderr b/src/test/ui/suggestions/closure-immutable-outer-variable.stderr index 19f1cd0717..f272a3582c 100644 --- a/src/test/ui/suggestions/closure-immutable-outer-variable.stderr +++ b/src/test/ui/suggestions/closure-immutable-outer-variable.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure | 18 | let y = true; | - help: consider making `y` mutable: `mut y` -19 | foo(Box::new(move || y = false) as Box<_>); +19 | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs index fc3c58e522..ef1566ab56 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs @@ -16,6 +16,4 @@ fn main() { let o = Obj { closure: || 42 }; o.closure(); //~^ ERROR no method named `closure` found - //~| HELP use `(o.closure)(...)` if you meant to call the function stored in the `closure` field - //~| NOTE field, not a method } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr index 0ca6112763..bbe8fe7345 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr @@ -1,6 +1,9 @@ error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-18343.rs:16:28: 16:33]>` in the current scope --> $DIR/issue-18343.rs:17:7 | +11 | struct Obj<F> where F: FnMut() -> u32 { + | ------------------------------------- method `closure` not found for this +... 17 | o.closure(); | ^^^^^^^ field, not a method | diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs index f84f35ce84..f0c5a2a913 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs @@ -48,58 +48,36 @@ fn main() { let o_closure = Obj { closure: || 42, not_closure: 42 }; o_closure.closure(); //~ ERROR no method named `closure` found - //~^ HELP use `(o_closure.closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method o_closure.not_closure(); //~^ ERROR no method named `not_closure` found - //~| NOTE field, not a method - //~| HELP did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`? let o_func = Obj { closure: func, not_closure: 5 }; o_func.closure(); //~ ERROR no method named `closure` found - //~^ HELP use `(o_func.closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method let boxed_fn = BoxedObj { boxed_closure: Box::new(func) }; boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found - //~^ HELP use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box<FnBox() -> u32> }; boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found - //~^ HELP use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method // test expression writing in the notes let w = Wrapper { wrap: o_func }; w.wrap.closure();//~ ERROR no method named `closure` found - //~^ HELP use `(w.wrap.closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method w.wrap.not_closure(); //~^ ERROR no method named `not_closure` found - //~| NOTE field, not a method - //~| HELP did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`? check_expression().closure();//~ ERROR no method named `closure` found - //~^ HELP use `(check_expression().closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method } impl FuncContainerOuter { fn run(&self) { unsafe { (*self.container).f1(1); //~ ERROR no method named `f1` found - //~^ HELP use `((*self.container).f1)(...)` - //~| NOTE field, not a method (*self.container).f2(1); //~ ERROR no method named `f2` found - //~^ HELP use `((*self.container).f2)(...)` - //~| NOTE field, not a method (*self.container).f3(1); //~ ERROR no method named `f3` found - //~^ HELP use `((*self.container).f3)(...)` - //~| NOTE field, not a method } } } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr index c6f134f118..083245f0b8 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr @@ -1,90 +1,123 @@ error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope --> $DIR/issue-2392.rs:50:15 | +25 | struct Obj<F> where F: FnOnce() -> u32 { + | -------------------------------------- method `closure` not found for this +... 50 | o_closure.closure(); //~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope - --> $DIR/issue-2392.rs:54:15 + --> $DIR/issue-2392.rs:52:15 | -54 | o_closure.not_closure(); +25 | struct Obj<F> where F: FnOnce() -> u32 { + | -------------------------------------- method `not_closure` not found for this +... +52 | o_closure.not_closure(); | ^^^^^^^^^^^ field, not a method | = help: did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`? error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:60:12 + --> $DIR/issue-2392.rs:56:12 | -60 | o_func.closure(); //~ ERROR no method named `closure` found +25 | struct Obj<F> where F: FnOnce() -> u32 { + | -------------------------------------- method `closure` not found for this +... +56 | o_func.closure(); //~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:65:14 + --> $DIR/issue-2392.rs:59:14 | -65 | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found +30 | struct BoxedObj { + | --------------- method `boxed_closure` not found for this +... +59 | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:70:19 + --> $DIR/issue-2392.rs:62:19 | -70 | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found +30 | struct BoxedObj { + | --------------- method `boxed_closure` not found for this +... +62 | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:77:12 + --> $DIR/issue-2392.rs:67:12 | -77 | w.wrap.closure();//~ ERROR no method named `closure` found +25 | struct Obj<F> where F: FnOnce() -> u32 { + | -------------------------------------- method `closure` not found for this +... +67 | w.wrap.closure();//~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:81:12 + --> $DIR/issue-2392.rs:69:12 | -81 | w.wrap.not_closure(); +25 | struct Obj<F> where F: FnOnce() -> u32 { + | -------------------------------------- method `not_closure` not found for this +... +69 | w.wrap.not_closure(); | ^^^^^^^^^^^ field, not a method | = help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`? error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<std::boxed::FnBox<(), Output=u32> + 'static>>` in the current scope - --> $DIR/issue-2392.rs:86:24 + --> $DIR/issue-2392.rs:72:24 | -86 | check_expression().closure();//~ ERROR no method named `closure` found +25 | struct Obj<F> where F: FnOnce() -> u32 { + | -------------------------------------- method `closure` not found for this +... +72 | check_expression().closure();//~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:94:31 + --> $DIR/issue-2392.rs:78:31 | -94 | (*self.container).f1(1); //~ ERROR no method named `f1` found +15 | struct FuncContainer { + | -------------------- method `f1` not found for this +... +78 | (*self.container).f1(1); //~ ERROR no method named `f1` found | ^^ field, not a method | = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:97:31 + --> $DIR/issue-2392.rs:79:31 | -97 | (*self.container).f2(1); //~ ERROR no method named `f2` found +15 | struct FuncContainer { + | -------------------- method `f2` not found for this +... +79 | (*self.container).f2(1); //~ ERROR no method named `f2` found | ^^ field, not a method | = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:100:31 - | -100 | (*self.container).f3(1); //~ ERROR no method named `f3` found - | ^^ field, not a method - | - = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field + --> $DIR/issue-2392.rs:80:31 + | +15 | struct FuncContainer { + | -------------------- method `f3` not found for this +... +80 | (*self.container).f3(1); //~ ERROR no method named `f3` found + | ^^ field, not a method + | + = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field error: aborting due to 11 previous errors diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs index 2fd7dc246c..d306b38e00 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs @@ -21,7 +21,5 @@ fn main() { demo.example(1); //~^ ERROR no method named `example` - //~| HELP use `(demo.example)(...)` - //~| NOTE field, not a method // (demo.example)(1); } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr index a45e70d48c..d6a837a17a 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr @@ -1,6 +1,9 @@ error[E0599]: no method named `example` found for type `Example` in the current scope --> $DIR/issue-32128.rs:22:10 | +11 | struct Example { + | -------------- method `example` not found for this +... 22 | demo.example(1); | ^^^^^^^ field, not a method | diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs index 03c84fc57b..4cd50be50d 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs @@ -35,15 +35,9 @@ fn main() { let o = Obj { fn_ptr: empty, closure: || 42 }; let p = &o; p.closure(); //~ ERROR no method named `closure` found - //~^ HELP use `(p.closure)(...)` if you meant to call the function stored in the `closure` field - //~| NOTE `closure` is a field storing a function, not a method let q = &p; q.fn_ptr(); //~ ERROR no method named `fn_ptr` found - //~^ HELP use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field - //~| NOTE `fn_ptr` is a field storing a function, not a method let r = D(C { c_fn_ptr: empty }); let s = &r; s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found - //~^ HELP use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr` - //~| NOTE `c_fn_ptr` is a field storing a function, not a method } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr index d41f7cbdf5..28e2161021 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr @@ -7,17 +7,17 @@ error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue = help: use `(p.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope - --> $DIR/issue-33784.rs:41:7 + --> $DIR/issue-33784.rs:39:7 | -41 | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found +39 | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found | ^^^^^^ field, not a method | = help: use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scope - --> $DIR/issue-33784.rs:46:7 + --> $DIR/issue-33784.rs:42:7 | -46 | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found +42 | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found | ^^^^^^^^ field, not a method | = help: use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr` field diff --git a/src/test/ui/suggestions/confuse-field-and-method/private-field.rs b/src/test/ui/suggestions/confuse-field-and-method/private-field.rs index 94cf38fb32..4cf939bbed 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/private-field.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/private-field.rs @@ -23,7 +23,7 @@ pub mod animal { fn main() { let dog = animal::Dog::new(3); - let dog_age = dog.dog_age(); + let dog_age = dog.dog_age(); //~ ERROR no method //let dog_age = dog.dog_age; println!("{}", dog_age); } diff --git a/src/test/ui/suggestions/confuse-field-and-method/private-field.stderr b/src/test/ui/suggestions/confuse-field-and-method/private-field.stderr index 9451926626..caf78af6eb 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/private-field.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/private-field.stderr @@ -1,7 +1,10 @@ error[E0599]: no method named `dog_age` found for type `animal::Dog` in the current scope --> $DIR/private-field.rs:26:23 | -26 | let dog_age = dog.dog_age(); +12 | pub struct Dog { + | -------------- method `dog_age` not found for this +... +26 | let dog_age = dog.dog_age(); //~ ERROR no method | ^^^^^^^ private field, not a method error: aborting due to previous error diff --git a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs new file mode 100644 index 0000000000..0a2e7ef322 --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo(s: &str) -> bool { true } + +fn main() { + let x = vec![(String::new(), String::new())]; + x.iter() + .filter(|&(ref a, _)| foo(a)) + //~^ ERROR non-reference pattern used to match a reference + .collect(); +} diff --git a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr new file mode 100644 index 0000000000..799d9080b9 --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.stderr @@ -0,0 +1,10 @@ +error: non-reference pattern used to match a reference (see issue #42640) + --> $DIR/dont-suggest-dereference-on-arg.rs:16:18 + | +16 | .filter(|&(ref a, _)| foo(a)) + | ^^^^^^^^^^^ help: consider using a reference: `&&(ref a, _)` + | + = help: add #![feature(match_default_bindings)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/extern-crate-rename.rs b/src/test/ui/suggestions/extern-crate-rename.rs index b3fa5871a8..b58149fb0b 100644 --- a/src/test/ui/suggestions/extern-crate-rename.rs +++ b/src/test/ui/suggestions/extern-crate-rename.rs @@ -13,6 +13,6 @@ extern crate m1; -extern crate m2 as m1; +extern crate m2 as m1; //~ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/suggestions/extern-crate-rename.stderr b/src/test/ui/suggestions/extern-crate-rename.stderr index c15e238e8b..6268935b08 100644 --- a/src/test/ui/suggestions/extern-crate-rename.stderr +++ b/src/test/ui/suggestions/extern-crate-rename.stderr @@ -3,7 +3,7 @@ error[E0259]: the name `m1` is defined multiple times | 15 | extern crate m1; | ---------------- previous import of the extern crate `m1` here -16 | extern crate m2 as m1; +16 | extern crate m2 as m1; //~ ERROR is defined multiple times | ^^^^^^^^^^^^^^^^^^^^^^ | | | `m1` reimported here diff --git a/src/test/ui/suggestions/issue-32354-suggest-import-rename.rs b/src/test/ui/suggestions/issue-32354-suggest-import-rename.rs index 51aba27498..9d71ab1a78 100644 --- a/src/test/ui/suggestions/issue-32354-suggest-import-rename.rs +++ b/src/test/ui/suggestions/issue-32354-suggest-import-rename.rs @@ -17,6 +17,6 @@ pub mod extension2 { } use extension1::ConstructorExtension; -use extension2::ConstructorExtension; +use extension2::ConstructorExtension; //~ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr b/src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr index 0798519128..ae892db364 100644 --- a/src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr +++ b/src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `ConstructorExtension` is defined multiple times | 19 | use extension1::ConstructorExtension; | -------------------------------- previous import of the trait `ConstructorExtension` here -20 | use extension2::ConstructorExtension; +20 | use extension2::ConstructorExtension; //~ ERROR is defined multiple times | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ConstructorExtension` reimported here | = note: `ConstructorExtension` must be defined only once in the type namespace of this module help: You can use `as` to change the binding name of the import | -20 | use extension2::ConstructorExtension as OtherConstructorExtension; +20 | use extension2::ConstructorExtension as OtherConstructorExtension; //~ ERROR is defined multiple times | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-43420-no-over-suggest.rs b/src/test/ui/suggestions/issue-43420-no-over-suggest.rs index d504b7cae2..8c5bde45ba 100644 --- a/src/test/ui/suggestions/issue-43420-no-over-suggest.rs +++ b/src/test/ui/suggestions/issue-43420-no-over-suggest.rs @@ -15,5 +15,5 @@ fn foo(b: &[u16]) {} fn main() { let a: Vec<u8> = Vec::new(); - foo(&a); + foo(&a); //~ ERROR mismatched types } diff --git a/src/test/ui/suggestions/issue-43420-no-over-suggest.stderr b/src/test/ui/suggestions/issue-43420-no-over-suggest.stderr index bcad9ce56c..c3f64fef50 100644 --- a/src/test/ui/suggestions/issue-43420-no-over-suggest.stderr +++ b/src/test/ui/suggestions/issue-43420-no-over-suggest.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-43420-no-over-suggest.rs:18:9 | -18 | foo(&a); +18 | foo(&a); //~ ERROR mismatched types | ^^ expected slice, found struct `std::vec::Vec` | = note: expected type `&[u16]` diff --git a/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs new file mode 100644 index 0000000000..5617c46afa --- /dev/null +++ b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused)] + +fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { + and_yet + 1 +} + +fn main() { + let behold: isize = 2; + let with_tears: usize = 3; + light_flows_our_war_of_mocking_words(behold as usize); + //~^ ERROR mismatched types [E0308] + light_flows_our_war_of_mocking_words(with_tears + 4); + //~^ ERROR mismatched types [E0308] +} diff --git a/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr new file mode 100644 index 0000000000..4b3e8a3202 --- /dev/null +++ b/src/test/ui/suggestions/issue-46756-consider-borrowing-cast-or-binexpr.stderr @@ -0,0 +1,26 @@ +error[E0308]: mismatched types + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:20:42 + | +20 | light_flows_our_war_of_mocking_words(behold as usize); + | ^^^^^^^^^^^^^^^ + | | + | expected &usize, found usize + | help: consider borrowing here: `&(behold as usize)` + | + = note: expected type `&usize` + found type `usize` + +error[E0308]: mismatched types + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:22:42 + | +22 | light_flows_our_war_of_mocking_words(with_tears + 4); + | ^^^^^^^^^^^^^^ + | | + | expected &usize, found usize + | help: consider borrowing here: `&(with_tears + 4)` + | + = note: expected type `&usize` + found type `usize` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/suggestions/pub-ident-fn-2.rs b/src/test/ui/suggestions/pub-ident-fn-2.rs new file mode 100644 index 0000000000..44884bfcdf --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn-2.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub foo(s: usize) { bar() } +//~^ ERROR missing `fn` for method definition + +fn main() { + foo(2); +} diff --git a/src/test/ui/suggestions/pub-ident-fn-2.stderr b/src/test/ui/suggestions/pub-ident-fn-2.stderr new file mode 100644 index 0000000000..7d3abceb11 --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn-2.stderr @@ -0,0 +1,12 @@ +error: missing `fn` for method definition + --> $DIR/pub-ident-fn-2.rs:11:4 + | +11 | pub foo(s: usize) { bar() } + | ^ +help: add `fn` here to parse `foo` as a public method + | +11 | pub fn foo(s: usize) { bar() } + | ^^ + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct-2.rs b/src/test/ui/suggestions/pub-ident-fn-or-struct-2.rs new file mode 100644 index 0000000000..1ccadc8a40 --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn-or-struct-2.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub S(); +//~^ ERROR missing `fn` or `struct` for method or struct definition + +fn main() {} diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct-2.stderr b/src/test/ui/suggestions/pub-ident-fn-or-struct-2.stderr new file mode 100644 index 0000000000..68dea2aec3 --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn-or-struct-2.stderr @@ -0,0 +1,8 @@ +error: missing `fn` or `struct` for method or struct definition + --> $DIR/pub-ident-fn-or-struct-2.rs:11:4 + | +11 | pub S(); + | ---^- help: if you meant to call a macro, write instead: `S!` + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct.rs b/src/test/ui/suggestions/pub-ident-fn-or-struct.rs new file mode 100644 index 0000000000..0664918945 --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn-or-struct.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub S (foo) bar +//~^ ERROR missing `fn` or `struct` for method or struct definition + +fn main() {} diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct.stderr b/src/test/ui/suggestions/pub-ident-fn-or-struct.stderr new file mode 100644 index 0000000000..0c19f776bd --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn-or-struct.stderr @@ -0,0 +1,8 @@ +error: missing `fn` or `struct` for method or struct definition + --> $DIR/pub-ident-fn-or-struct.rs:11:4 + | +11 | pub S (foo) bar + | ---^- help: if you meant to call a macro, write instead: `S!` + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/pub-ident-fn.rs b/src/test/ui/suggestions/pub-ident-fn.rs new file mode 100644 index 0000000000..1d64199642 --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub foo(s: usize) -> bool { true } +//~^ ERROR missing `fn` for method definition + +fn main() { + foo(2); +} diff --git a/src/test/ui/suggestions/pub-ident-fn.stderr b/src/test/ui/suggestions/pub-ident-fn.stderr new file mode 100644 index 0000000000..d36b9b127e --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-fn.stderr @@ -0,0 +1,12 @@ +error: missing `fn` for method definition + --> $DIR/pub-ident-fn.rs:11:4 + | +11 | pub foo(s: usize) -> bool { true } + | ^^^ +help: add `fn` here to parse `foo` as a public method + | +11 | pub fn foo(s: usize) -> bool { true } + | ^^ + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/pub-ident-struct.rs b/src/test/ui/suggestions/pub-ident-struct.rs new file mode 100644 index 0000000000..d08d498f87 --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-struct.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub S { +//~^ ERROR missing `struct` for struct definition +} +fn main() {} diff --git a/src/test/ui/suggestions/pub-ident-struct.stderr b/src/test/ui/suggestions/pub-ident-struct.stderr new file mode 100644 index 0000000000..36ef307272 --- /dev/null +++ b/src/test/ui/suggestions/pub-ident-struct.stderr @@ -0,0 +1,12 @@ +error: missing `struct` for struct definition + --> $DIR/pub-ident-struct.rs:11:4 + | +11 | pub S { + | ^ +help: add `struct` here to parse `S` as a public struct + | +11 | pub struct S { + | ^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/return-type.rs b/src/test/ui/suggestions/return-type.rs new file mode 100644 index 0000000000..e63787949a --- /dev/null +++ b/src/test/ui/suggestions/return-type.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct S<T> { + t: T, +} + +fn foo<T>(x: T) -> S<T> { + S { t: x } +} + +fn bar() { + foo(4 as usize) + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/suggestions/return-type.stderr b/src/test/ui/suggestions/return-type.stderr new file mode 100644 index 0000000000..19c5d72dd7 --- /dev/null +++ b/src/test/ui/suggestions/return-type.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/return-type.rs:20:5 + | +20 | foo(4 as usize) + | ^^^^^^^^^^^^^^^ expected (), found struct `S` + | + = note: expected type `()` + found type `S<usize>` +help: try adding a semicolon + | +20 | foo(4 as usize); + | ^ +help: try adding a return type + | +19 | fn bar() -> S<usize> { + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/str-array-assignment.rs b/src/test/ui/suggestions/str-array-assignment.rs new file mode 100644 index 0000000000..b70028bd92 --- /dev/null +++ b/src/test/ui/suggestions/str-array-assignment.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let s = "abc"; + let t = if true { s[..2] } else { s }; + //~^ ERROR if and else have incompatible types + let u: &str = if true { s[..2] } else { s }; + //~^ ERROR mismatched types + let v = s[..2]; + //~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied + let w: &str = s[..2]; + //~^ ERROR mismatched types +} diff --git a/src/test/ui/suggestions/str-array-assignment.stderr b/src/test/ui/suggestions/str-array-assignment.stderr new file mode 100644 index 0000000000..4ef18e640a --- /dev/null +++ b/src/test/ui/suggestions/str-array-assignment.stderr @@ -0,0 +1,46 @@ +error[E0308]: if and else have incompatible types + --> $DIR/str-array-assignment.rs:13:11 + | +13 | let t = if true { s[..2] } else { s }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str + | + = note: expected type `str` + found type `&str` + +error[E0308]: mismatched types + --> $DIR/str-array-assignment.rs:15:27 + | +11 | fn main() { + | - expected `()` because of default return type +... +15 | let u: &str = if true { s[..2] } else { s }; + | ^^^^^^ expected &str, found str + | + = note: expected type `&str` + found type `str` + +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> $DIR/str-array-assignment.rs:17:7 + | +17 | let v = s[..2]; + | ^ ------ help: consider borrowing here: `&s[..2]` + | | + | `str` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: all local variables must have a statically known size + +error[E0308]: mismatched types + --> $DIR/str-array-assignment.rs:19:17 + | +19 | let w: &str = s[..2]; + | ^^^^^^ + | | + | expected &str, found str + | help: consider borrowing here: `&s[..2]` + | + = note: expected type `&str` + found type `str` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/suggestions/str-as-char.rs b/src/test/ui/suggestions/str-as-char.rs new file mode 100644 index 0000000000..09aca61147 --- /dev/null +++ b/src/test/ui/suggestions/str-as-char.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!('●●'); + //~^ ERROR character literal may only contain one codepoint +} diff --git a/src/test/ui/suggestions/str-as-char.stderr b/src/test/ui/suggestions/str-as-char.stderr new file mode 100644 index 0000000000..bf975053ff --- /dev/null +++ b/src/test/ui/suggestions/str-as-char.stderr @@ -0,0 +1,12 @@ +error: character literal may only contain one codepoint + --> $DIR/str-as-char.rs:12:14 + | +12 | println!('●●'); + | ^^^^ +help: if you meant to write a `str` literal, use double quotes + | +12 | println!("●●"); + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/suggest-labels.rs b/src/test/ui/suggestions/suggest-labels.rs index 5bebce79ec..8c97301f40 100644 --- a/src/test/ui/suggestions/suggest-labels.rs +++ b/src/test/ui/suggestions/suggest-labels.rs @@ -11,16 +11,16 @@ #[allow(unreachable_code)] fn main() { 'foo: loop { - break 'fo; + break 'fo; //~ ERROR use of undeclared label } 'bar: loop { - continue 'bor; + continue 'bor; //~ ERROR use of undeclared label } 'longlabel: loop { 'longlabel1: loop { - break 'longlable; + break 'longlable; //~ ERROR use of undeclared label } } } diff --git a/src/test/ui/suggestions/suggest-labels.stderr b/src/test/ui/suggestions/suggest-labels.stderr index 23aa18a365..c82b5decfd 100644 --- a/src/test/ui/suggestions/suggest-labels.stderr +++ b/src/test/ui/suggestions/suggest-labels.stderr @@ -1,19 +1,19 @@ error[E0426]: use of undeclared label `'fo` --> $DIR/suggest-labels.rs:14:15 | -14 | break 'fo; +14 | break 'fo; //~ ERROR use of undeclared label | ^^^ did you mean `'foo`? error[E0426]: use of undeclared label `'bor` --> $DIR/suggest-labels.rs:18:18 | -18 | continue 'bor; +18 | continue 'bor; //~ ERROR use of undeclared label | ^^^^ did you mean `'bar`? error[E0426]: use of undeclared label `'longlable` --> $DIR/suggest-labels.rs:23:19 | -23 | break 'longlable; +23 | break 'longlable; //~ ERROR use of undeclared label | ^^^^^^^^^^ did you mean `'longlabel1`? error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/suggest-methods.rs b/src/test/ui/suggestions/suggest-methods.rs index b02881dc7e..49027deecc 100644 --- a/src/test/ui/suggestions/suggest-methods.rs +++ b/src/test/ui/suggestions/suggest-methods.rs @@ -25,16 +25,16 @@ impl FooT for Foo { fn main() { let f = Foo; - f.bat(1.0); + f.bat(1.0); //~ ERROR no method named let s = "foo".to_string(); - let _ = s.is_emtpy(); + let _ = s.is_emtpy(); //~ ERROR no method named // Generates a warning for `count_zeros()`. `count_ones()` is also a close // match, but the former is closer. - let _ = 63u32.count_eos(); + let _ = 63u32.count_eos(); //~ ERROR no method named // Does not generate a warning - let _ = 63u32.count_o(); + let _ = 63u32.count_o(); //~ ERROR no method named } diff --git a/src/test/ui/suggestions/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr index 41beb73b1b..d3d8d302c7 100644 --- a/src/test/ui/suggestions/suggest-methods.stderr +++ b/src/test/ui/suggestions/suggest-methods.stderr @@ -1,7 +1,10 @@ error[E0599]: no method named `bat` found for type `Foo` in the current scope --> $DIR/suggest-methods.rs:28:7 | -28 | f.bat(1.0); +11 | struct Foo; + | ----------- method `bat` not found for this +... +28 | f.bat(1.0); //~ ERROR no method named | ^^^ | = help: did you mean `bar`? @@ -9,7 +12,7 @@ error[E0599]: no method named `bat` found for type `Foo` in the current scope error[E0599]: no method named `is_emtpy` found for type `std::string::String` in the current scope --> $DIR/suggest-methods.rs:31:15 | -31 | let _ = s.is_emtpy(); +31 | let _ = s.is_emtpy(); //~ ERROR no method named | ^^^^^^^^ | = help: did you mean `is_empty`? @@ -17,7 +20,7 @@ error[E0599]: no method named `is_emtpy` found for type `std::string::String` in error[E0599]: no method named `count_eos` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:35:19 | -35 | let _ = 63u32.count_eos(); +35 | let _ = 63u32.count_eos(); //~ ERROR no method named | ^^^^^^^^^ | = help: did you mean `count_zeros`? @@ -25,7 +28,7 @@ error[E0599]: no method named `count_eos` found for type `u32` in the current sc error[E0599]: no method named `count_o` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:38:19 | -38 | let _ = 63u32.count_o(); +38 | let _ = 63u32.count_o(); //~ ERROR no method named | ^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/try-on-option.rs b/src/test/ui/suggestions/try-on-option.rs index 4cd8cd8115..65ca23402d 100644 --- a/src/test/ui/suggestions/try-on-option.rs +++ b/src/test/ui/suggestions/try-on-option.rs @@ -14,12 +14,12 @@ fn main() {} fn foo() -> Result<u32, ()> { let x: Option<u32> = None; - x?; + x?; //~ the trait bound Ok(22) } fn bar() -> u32 { let x: Option<u32> = None; - x?; + x?; //~ the `?` operator 22 } diff --git a/src/test/ui/suggestions/try-on-option.stderr b/src/test/ui/suggestions/try-on-option.stderr index 86d4510cad..b1be9ad3cf 100644 --- a/src/test/ui/suggestions/try-on-option.stderr +++ b/src/test/ui/suggestions/try-on-option.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): std::convert::From<std::option::NoneError>` is not satisfied --> $DIR/try-on-option.rs:17:5 | -17 | x?; +17 | x?; //~ the trait bound | ^^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()` | = note: required by `std::convert::From::from` @@ -9,7 +9,7 @@ error[E0277]: the trait bound `(): std::convert::From<std::option::NoneError>` i error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`) --> $DIR/try-on-option.rs:23:5 | -23 | x?; +23 | x?; //~ the `?` operator | -- | | | cannot use the `?` operator in a function that returns `u32` diff --git a/src/test/ui/suggestions/try-operator-on-main.rs b/src/test/ui/suggestions/try-operator-on-main.rs index eadd12924d..e9d285941b 100644 --- a/src/test/ui/suggestions/try-operator-on-main.rs +++ b/src/test/ui/suggestions/try-operator-on-main.rs @@ -14,20 +14,20 @@ use std::ops::Try; fn main() { // error for a `Try` type on a non-`Try` fn - std::fs::File::open("foo")?; + std::fs::File::open("foo")?; //~ ERROR the `?` operator can only // a non-`Try` type on a non-`Try` fn - ()?; + ()?; //~ ERROR the `?` operator can only // an unrelated use of `Try` - try_trait_generic::<()>(); + try_trait_generic::<()>(); //~ ERROR the trait bound } fn try_trait_generic<T: Try>() -> T { // and a non-`Try` object on a `Try` fn. - ()?; + ()?; //~ ERROR the `?` operator can only loop {} } diff --git a/src/test/ui/suggestions/try-operator-on-main.stderr b/src/test/ui/suggestions/try-operator-on-main.stderr index e83bf2abc1..8b17e06065 100644 --- a/src/test/ui/suggestions/try-operator-on-main.stderr +++ b/src/test/ui/suggestions/try-operator-on-main.stderr @@ -1,7 +1,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`) --> $DIR/try-operator-on-main.rs:17:5 | -17 | std::fs::File::open("foo")?; +17 | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only | --------------------------- | | | cannot use the `?` operator in a function that returns `()` @@ -13,7 +13,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Resu error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/try-operator-on-main.rs:20:5 | -20 | ()?; +20 | ()?; //~ ERROR the `?` operator can only | --- | | | the `?` operator cannot be applied to type `()` @@ -25,7 +25,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `std error[E0277]: the trait bound `(): std::ops::Try` is not satisfied --> $DIR/try-operator-on-main.rs:23:5 | -23 | try_trait_generic::<()>(); +23 | try_trait_generic::<()>(); //~ ERROR the trait bound | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()` | = note: required by `try_trait_generic` @@ -33,7 +33,7 @@ error[E0277]: the trait bound `(): std::ops::Try` is not satisfied error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/try-operator-on-main.rs:30:5 | -30 | ()?; +30 | ()?; //~ ERROR the `?` operator can only | --- | | | the `?` operator cannot be applied to type `()` diff --git a/src/test/ui/suggestions/tuple-float-index.rs b/src/test/ui/suggestions/tuple-float-index.rs index 8bfbd0e74d..0a188305a9 100644 --- a/src/test/ui/suggestions/tuple-float-index.rs +++ b/src/test/ui/suggestions/tuple-float-index.rs @@ -11,5 +11,5 @@ // compile-flags: -Z parse-only fn main () { - (1, (2, 3)).1.1; + (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1` } diff --git a/src/test/ui/suggestions/tuple-float-index.stderr b/src/test/ui/suggestions/tuple-float-index.stderr index 4b1be26c86..7d133f11cb 100644 --- a/src/test/ui/suggestions/tuple-float-index.stderr +++ b/src/test/ui/suggestions/tuple-float-index.stderr @@ -1,7 +1,7 @@ error: unexpected token: `1.1` --> $DIR/tuple-float-index.rs:14:17 | -14 | (1, (2, 3)).1.1; +14 | (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1` | ------------^^^ | | | | | unexpected token diff --git a/src/test/ui/suggestions/type-ascription-instead-of-initializer.rs b/src/test/ui/suggestions/type-ascription-instead-of-initializer.rs index bcd965f10f..d80dad8fbd 100644 --- a/src/test/ui/suggestions/type-ascription-instead-of-initializer.rs +++ b/src/test/ui/suggestions/type-ascription-instead-of-initializer.rs @@ -9,5 +9,6 @@ // except according to those terms. fn main() { - let x: Vec::with_capacity(10, 20); + let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` + //~^ ERROR this function takes 1 parameter } diff --git a/src/test/ui/suggestions/type-ascription-instead-of-initializer.stderr b/src/test/ui/suggestions/type-ascription-instead-of-initializer.stderr index 647e3f8468..b14d233acd 100644 --- a/src/test/ui/suggestions/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/suggestions/type-ascription-instead-of-initializer.stderr @@ -1,17 +1,17 @@ error: expected type, found `10` --> $DIR/type-ascription-instead-of-initializer.rs:12:31 | -12 | let x: Vec::with_capacity(10, 20); +12 | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` | -- ^^ | || | |help: use `=` if you meant to assign | while parsing the type for `x` error[E0061]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/type-ascription-instead-of-initializer.rs:12:31 + --> $DIR/type-ascription-instead-of-initializer.rs:12:12 | -12 | let x: Vec::with_capacity(10, 20); - | ^^^^^^ expected 1 parameter +12 | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/type-ascription-instead-of-statement-end.rs b/src/test/ui/suggestions/type-ascription-instead-of-statement-end.rs index 93de55a39e..01d773dd5e 100644 --- a/src/test/ui/suggestions/type-ascription-instead-of-statement-end.rs +++ b/src/test/ui/suggestions/type-ascription-instead-of-statement-end.rs @@ -12,9 +12,9 @@ fn main() { println!("test"): - 0; + 0; //~ ERROR expected type, found `0` } fn foo() { - println!("test"): 0; + println!("test"): 0; //~ ERROR expected type, found `0` } diff --git a/src/test/ui/suggestions/type-ascription-instead-of-statement-end.stderr b/src/test/ui/suggestions/type-ascription-instead-of-statement-end.stderr index 550048c7b8..9d26d00467 100644 --- a/src/test/ui/suggestions/type-ascription-instead-of-statement-end.stderr +++ b/src/test/ui/suggestions/type-ascription-instead-of-statement-end.stderr @@ -3,13 +3,13 @@ error: expected type, found `0` | 14 | println!("test"): | - help: did you mean to use `;` here? -15 | 0; +15 | 0; //~ ERROR expected type, found `0` | ^ expecting a type here because of type ascription error: expected type, found `0` --> $DIR/type-ascription-instead-of-statement-end.rs:19:23 | -19 | println!("test"): 0; +19 | println!("test"): 0; //~ ERROR expected type, found `0` | ^ expecting a type here because of type ascription error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/type-ascription-with-fn-call.rs b/src/test/ui/suggestions/type-ascription-with-fn-call.rs index 7c10bf98c8..b2c25c37e8 100644 --- a/src/test/ui/suggestions/type-ascription-with-fn-call.rs +++ b/src/test/ui/suggestions/type-ascription-with-fn-call.rs @@ -12,7 +12,7 @@ fn main() { f() : - f(); + f(); //~ ERROR expected type, found function } fn f() {} diff --git a/src/test/ui/suggestions/type-ascription-with-fn-call.stderr b/src/test/ui/suggestions/type-ascription-with-fn-call.stderr index 93c65c263d..d5e0b00f3d 100644 --- a/src/test/ui/suggestions/type-ascription-with-fn-call.stderr +++ b/src/test/ui/suggestions/type-ascription-with-fn-call.stderr @@ -3,7 +3,7 @@ error[E0573]: expected type, found function `f` | 14 | f() : | - help: did you mean to use `;` here instead? -15 | f(); +15 | f(); //~ ERROR expected type, found function | ^^^ | | | not a type diff --git a/src/test/compile-fail/svh-change-lit.rs b/src/test/ui/svh-change-lit.rs similarity index 87% rename from src/test/compile-fail/svh-change-lit.rs rename to src/test/ui/svh-change-lit.rs index 1638caaa92..c529873e73 100644 --- a/src/test/compile-fail/svh-change-lit.rs +++ b/src/test/ui/svh-change-lit.rs @@ -14,12 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-lit.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: crate `a` path #1: -//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/ui/svh-change-lit.stderr b/src/test/ui/svh-change-lit.stderr new file mode 100644 index 0000000000..94e845c527 --- /dev/null +++ b/src/test/ui/svh-change-lit.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-lit.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-significant-cfg.rs b/src/test/ui/svh-change-significant-cfg.rs similarity index 87% rename from src/test/compile-fail/svh-change-significant-cfg.rs rename to src/test/ui/svh-change-significant-cfg.rs index 99523ca699..ad51cbc5ec 100644 --- a/src/test/compile-fail/svh-change-significant-cfg.rs +++ b/src/test/ui/svh-change-significant-cfg.rs @@ -14,12 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-significant-cfg.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: crate `a` path #1: -//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/ui/svh-change-significant-cfg.stderr b/src/test/ui/svh-change-significant-cfg.stderr new file mode 100644 index 0000000000..d2744771ec --- /dev/null +++ b/src/test/ui/svh-change-significant-cfg.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-significant-cfg.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-trait-bound.rs b/src/test/ui/svh-change-trait-bound.rs similarity index 87% rename from src/test/compile-fail/svh-change-trait-bound.rs rename to src/test/ui/svh-change-trait-bound.rs index dcf4859792..ae17ff3feb 100644 --- a/src/test/compile-fail/svh-change-trait-bound.rs +++ b/src/test/ui/svh-change-trait-bound.rs @@ -14,12 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-trait-bound.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: crate `a` path #1: -//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/ui/svh-change-trait-bound.stderr b/src/test/ui/svh-change-trait-bound.stderr new file mode 100644 index 0000000000..e272f399f7 --- /dev/null +++ b/src/test/ui/svh-change-trait-bound.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-trait-bound.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-type-arg.rs b/src/test/ui/svh-change-type-arg.rs similarity index 87% rename from src/test/compile-fail/svh-change-type-arg.rs rename to src/test/ui/svh-change-type-arg.rs index 7e51ca456b..5b796a3f5c 100644 --- a/src/test/compile-fail/svh-change-type-arg.rs +++ b/src/test/ui/svh-change-type-arg.rs @@ -14,12 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-arg.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: crate `a` path #1: -//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/ui/svh-change-type-arg.stderr b/src/test/ui/svh-change-type-arg.stderr new file mode 100644 index 0000000000..d94dd5e522 --- /dev/null +++ b/src/test/ui/svh-change-type-arg.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-arg.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-type-ret.rs b/src/test/ui/svh-change-type-ret.rs similarity index 87% rename from src/test/compile-fail/svh-change-type-ret.rs rename to src/test/ui/svh-change-type-ret.rs index 54ca87d84c..88bf146760 100644 --- a/src/test/compile-fail/svh-change-type-ret.rs +++ b/src/test/ui/svh-change-type-ret.rs @@ -14,12 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-ret.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: crate `a` path #1: -//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/ui/svh-change-type-ret.stderr b/src/test/ui/svh-change-type-ret.stderr new file mode 100644 index 0000000000..4484faabbf --- /dev/null +++ b/src/test/ui/svh-change-type-ret.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-ret.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-type-static.rs b/src/test/ui/svh-change-type-static.rs similarity index 87% rename from src/test/compile-fail/svh-change-type-static.rs rename to src/test/ui/svh-change-type-static.rs index ea90faaf61..c9a167c5a0 100644 --- a/src/test/compile-fail/svh-change-type-static.rs +++ b/src/test/ui/svh-change-type-static.rs @@ -14,12 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-static.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: crate `a` path #1: -//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/ui/svh-change-type-static.stderr b/src/test/ui/svh-change-type-static.stderr new file mode 100644 index 0000000000..24c5acbf6f --- /dev/null +++ b/src/test/ui/svh-change-type-static.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-static.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-use-trait.rs b/src/test/ui/svh-use-trait.rs similarity index 89% rename from src/test/compile-fail/svh-use-trait.rs rename to src/test/ui/svh-use-trait.rs index c0a5a0a17e..3a87f6bfc7 100644 --- a/src/test/compile-fail/svh-use-trait.rs +++ b/src/test/ui/svh-use-trait.rs @@ -14,6 +14,7 @@ // aux-build:svh-uta-base.rs // aux-build:svh-utb.rs // aux-build:svh-uta-change-use-trait.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" //! "compile-fail/svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash @@ -22,9 +23,6 @@ extern crate uta; extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends -//~| NOTE: perhaps that crate needs to be recompiled? -//~| NOTE: crate `uta` path #1: -//~| NOTE: crate `utb` path #1: fn main() { utb::foo() diff --git a/src/test/ui/svh-use-trait.stderr b/src/test/ui/svh-use-trait.stderr new file mode 100644 index 0000000000..e695d60e2a --- /dev/null +++ b/src/test/ui/svh-use-trait.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `uta` which `utb` depends on + --> $DIR/svh-use-trait.rs:25:1 + | +25 | extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends + | ^^^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `uta`: $PATH_uta + crate `utb`: $PATH_utb + +error: aborting due to previous error + diff --git a/src/test/ui/switched-expectations.rs b/src/test/ui/switched-expectations.rs new file mode 100644 index 0000000000..2a43679bdb --- /dev/null +++ b/src/test/ui/switched-expectations.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let var = 10i32; + let ref string: String = var; //~ ERROR mismatched types [E0308] +} diff --git a/src/test/ui/switched-expectations.stderr b/src/test/ui/switched-expectations.stderr new file mode 100644 index 0000000000..822ffeb0d3 --- /dev/null +++ b/src/test/ui/switched-expectations.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/switched-expectations.rs:13:30 + | +13 | let ref string: String = var; //~ ERROR mismatched types [E0308] + | ^^^ expected struct `std::string::String`, found i32 + | + = note: expected type `std::string::String` + found type `i32` + +error: aborting due to previous error + diff --git a/src/test/ui/token/bounds-obj-parens.rs b/src/test/ui/token/bounds-obj-parens.rs index 02c119cf72..9617df8fa2 100644 --- a/src/test/ui/token/bounds-obj-parens.rs +++ b/src/test/ui/token/bounds-obj-parens.rs @@ -14,4 +14,3 @@ type A = Box<(Fn(D::Error) -> E) + 'static + Send + Sync>; // OK (but see #39318 FAIL //~^ ERROR -//~| ERROR diff --git a/src/test/ui/token/issue-10636-2.rs b/src/test/ui/token/issue-10636-2.rs index 9375912361..4aa4127019 100644 --- a/src/test/ui/token/issue-10636-2.rs +++ b/src/test/ui/token/issue-10636-2.rs @@ -12,9 +12,8 @@ // first one. This would be easy-ish to address by better recovery in tokenisation. pub fn trace_option(option: Option<isize>) { - option.map(|some| 42; //~ NOTE: unclosed delimiter + option.map(|some| 42; //~^ ERROR: expected one of - //~| NOTE: expected one of - //~| NOTE: unexpected token + } //~ ERROR: incorrect close delimiter //~^ ERROR: expected expression, found `)` diff --git a/src/test/ui/token/issue-10636-2.stderr b/src/test/ui/token/issue-10636-2.stderr index 48bbeac75d..b4f0f30c6c 100644 --- a/src/test/ui/token/issue-10636-2.stderr +++ b/src/test/ui/token/issue-10636-2.stderr @@ -1,25 +1,25 @@ error: incorrect close delimiter: `}` - --> $DIR/issue-10636-2.rs:19:1 + --> $DIR/issue-10636-2.rs:18:1 | -19 | } //~ ERROR: incorrect close delimiter +18 | } //~ ERROR: incorrect close delimiter | ^ | note: unclosed delimiter --> $DIR/issue-10636-2.rs:15:15 | -15 | option.map(|some| 42; //~ NOTE: unclosed delimiter +15 | option.map(|some| 42; | ^ error: expected one of `,`, `.`, `?`, or an operator, found `;` --> $DIR/issue-10636-2.rs:15:25 | -15 | option.map(|some| 42; //~ NOTE: unclosed delimiter +15 | option.map(|some| 42; | ^ expected one of `,`, `.`, `?`, or an operator here error: expected expression, found `)` - --> $DIR/issue-10636-2.rs:19:1 + --> $DIR/issue-10636-2.rs:18:1 | -19 | } //~ ERROR: incorrect close delimiter +18 | } //~ ERROR: incorrect close delimiter | ^ error[E0601]: main function not found diff --git a/src/test/ui/token/issue-41155.rs b/src/test/ui/token/issue-41155.rs index 0f473c9e07..550a90fc6a 100644 --- a/src/test/ui/token/issue-41155.rs +++ b/src/test/ui/token/issue-41155.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -impl S { +impl S { //~ ERROR cannot find type pub -} +} //~ ERROR expected one of diff --git a/src/test/ui/token/issue-41155.stderr b/src/test/ui/token/issue-41155.stderr index 50a38da9d8..707784272e 100644 --- a/src/test/ui/token/issue-41155.stderr +++ b/src/test/ui/token/issue-41155.stderr @@ -3,13 +3,13 @@ error: expected one of `(`, `const`, `default`, `extern`, `fn`, `type`, or `unsa | 12 | pub | - expected one of 7 possible tokens here -13 | } +13 | } //~ ERROR expected one of | ^ unexpected token error[E0412]: cannot find type `S` in this scope --> $DIR/issue-41155.rs:11:6 | -11 | impl S { +11 | impl S { //~ ERROR cannot find type | ^ not found in this scope error[E0601]: main function not found diff --git a/src/test/ui/token/macro-incomplete-parse.rs b/src/test/ui/token/macro-incomplete-parse.rs index 0874937343..9b8fdaf9a2 100644 --- a/src/test/ui/token/macro-incomplete-parse.rs +++ b/src/test/ui/token/macro-incomplete-parse.rs @@ -20,8 +20,7 @@ macro_rules! ignored_item { macro_rules! ignored_expr { () => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,` - //~^ NOTE expected one of `.`, `;`, `?`, `}`, or an operator here - //~| NOTE unexpected token + 2 ) } @@ -29,12 +28,12 @@ macro_rules! ignored_pat { () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` } -ignored_item!(); //~ NOTE caused by the macro expansion here +ignored_item!(); fn main() { - ignored_expr!(); //~ NOTE in this expansion + ignored_expr!(); match 1 { - ignored_pat!() => (), //~ NOTE caused by the macro expansion here + ignored_pat!() => (), _ => (), } } diff --git a/src/test/ui/token/macro-incomplete-parse.stderr b/src/test/ui/token/macro-incomplete-parse.stderr index 6bce09af05..28ba6cc37c 100644 --- a/src/test/ui/token/macro-incomplete-parse.stderr +++ b/src/test/ui/token/macro-incomplete-parse.stderr @@ -5,9 +5,9 @@ error: macro expansion ignores token `,` and any following | ^ | note: caused by the macro expansion here; the usage of `ignored_item!` is likely invalid in item context - --> $DIR/macro-incomplete-parse.rs:32:1 + --> $DIR/macro-incomplete-parse.rs:31:1 | -32 | ignored_item!(); //~ NOTE caused by the macro expansion here +31 | ignored_item!(); | ^^^^^^^^^^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` @@ -16,19 +16,19 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` 22 | () => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,` | ^ expected one of `.`, `;`, `?`, `}`, or an operator here ... -35 | ignored_expr!(); //~ NOTE in this expansion +34 | ignored_expr!(); | ---------------- in this macro invocation error: macro expansion ignores token `,` and any following - --> $DIR/macro-incomplete-parse.rs:29:14 + --> $DIR/macro-incomplete-parse.rs:28:14 | -29 | () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` +28 | () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` | ^ | note: caused by the macro expansion here; the usage of `ignored_pat!` is likely invalid in pattern context - --> $DIR/macro-incomplete-parse.rs:37:9 + --> $DIR/macro-incomplete-parse.rs:36:9 | -37 | ignored_pat!() => (), //~ NOTE caused by the macro expansion here +36 | ignored_pat!() => (), | ^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/token/trailing-plus-in-bounds.rs b/src/test/ui/token/trailing-plus-in-bounds.rs index 2bb2c97790..72cae6abc2 100644 --- a/src/test/ui/token/trailing-plus-in-bounds.rs +++ b/src/test/ui/token/trailing-plus-in-bounds.rs @@ -18,4 +18,3 @@ fn main() { FAIL //~^ ERROR -//~| ERROR diff --git a/src/test/ui/trait-alias.rs b/src/test/ui/trait-alias.rs new file mode 100644 index 0000000000..9ea211b4d7 --- /dev/null +++ b/src/test/ui/trait-alias.rs @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(trait_alias)] + +trait SimpleAlias = Default; //~ERROR E0645 +trait GenericAlias<T> = Iterator<Item=T>; //~ERROR E0645 +trait Partial<T> = IntoIterator<Item=T>; //~ERROR E0645 + +trait Things<T> {} +trait Romeo {} +struct The<T>(T); +struct Fore<T>(T); +impl<T, U> Things<T> for The<U> {} +impl<T> Romeo for Fore<T> {} + +trait WithWhere<Art, Thou> = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; //~ERROR E0645 +trait BareWhere<Wild, Are> = where The<Wild>: Things<Are>; //~ERROR E0645 + +trait CD = Clone + Default; //~ERROR E0645 + +fn foo<T: CD>() -> (T, T) { + let one = T::default(); + let two = one.clone(); + (one, two) +} + +fn main() { + let both = foo(); + assert_eq!(both.0, 0); + assert_eq!(both.1, 0); + let both: (i32, i32) = foo(); + assert_eq!(both.0, 0); + assert_eq!(both.1, 0); +} + diff --git a/src/test/ui/trait-alias.stderr b/src/test/ui/trait-alias.stderr new file mode 100644 index 0000000000..ad299dc841 --- /dev/null +++ b/src/test/ui/trait-alias.stderr @@ -0,0 +1,38 @@ +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:13:1 + | +13 | trait SimpleAlias = Default; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:14:1 + | +14 | trait GenericAlias<T> = Iterator<Item=T>; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:15:1 + | +15 | trait Partial<T> = IntoIterator<Item=T>; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:24:1 + | +24 | trait WithWhere<Art, Thou> = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:25:1 + | +25 | trait BareWhere<Wild, Are> = where The<Wild>: Things<Are>; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0645]: trait aliases are not yet implemented (see issue #41517) + --> $DIR/trait-alias.rs:27:1 + | +27 | trait CD = Clone + Default; //~ERROR E0645 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/run-pass/issue-30276.rs b/src/test/ui/trait-duplicate-methods.rs similarity index 79% rename from src/test/run-pass/issue-30276.rs rename to src/test/ui/trait-duplicate-methods.rs index 5dd0cd8ba5..d35caa40a2 100644 --- a/src/test/run-pass/issue-30276.rs +++ b/src/test/ui/trait-duplicate-methods.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Test([i32]); -fn main() { - let _x: fn(_) -> Test = Test; +trait Foo { + fn orange(&self); + fn orange(&self); //~ ERROR the name `orange` is defined multiple times } + +fn main() {} diff --git a/src/test/ui/trait-duplicate-methods.stderr b/src/test/ui/trait-duplicate-methods.stderr new file mode 100644 index 0000000000..5f796777c4 --- /dev/null +++ b/src/test/ui/trait-duplicate-methods.stderr @@ -0,0 +1,12 @@ +error[E0428]: the name `orange` is defined multiple times + --> $DIR/trait-duplicate-methods.rs:13:5 + | +12 | fn orange(&self); + | ----------------- previous definition of the value `orange` here +13 | fn orange(&self); //~ ERROR the name `orange` is defined multiple times + | ^^^^^^^^^^^^^^^^^ `orange` redefined here + | + = note: `orange` must be defined only once in the value namespace of this trait + +error: aborting due to previous error + diff --git a/src/test/ui/trait-method-private.rs b/src/test/ui/trait-method-private.rs index 5c1bd668ac..54cf6e6783 100644 --- a/src/test/ui/trait-method-private.rs +++ b/src/test/ui/trait-method-private.rs @@ -26,5 +26,5 @@ mod inner { fn main() { let foo = inner::Foo; - foo.method(); + foo.method(); //~ ERROR is private } diff --git a/src/test/ui/trait-method-private.stderr b/src/test/ui/trait-method-private.stderr index c7a7b689ed..7406541a9d 100644 --- a/src/test/ui/trait-method-private.stderr +++ b/src/test/ui/trait-method-private.stderr @@ -1,12 +1,14 @@ error[E0624]: method `method` is private --> $DIR/trait-method-private.rs:29:9 | -29 | foo.method(); +29 | foo.method(); //~ ERROR is private | ^^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - candidate #1: `use inner::Bar;` +help: the following trait is implemented but not in scope, perhaps add a `use` for it: + | +11 | use inner::Bar; + | error: aborting due to previous error diff --git a/src/test/compile-fail/trait-safety-fn-body.rs b/src/test/ui/trait-safety-fn-body.rs similarity index 94% rename from src/test/compile-fail/trait-safety-fn-body.rs rename to src/test/ui/trait-safety-fn-body.rs index 65732a8ff6..1a2bcc471b 100644 --- a/src/test/compile-fail/trait-safety-fn-body.rs +++ b/src/test/ui/trait-safety-fn-body.rs @@ -20,7 +20,6 @@ unsafe impl UnsafeTrait for *mut isize { // Unsafe actions are not made legal by taking place in an unsafe trait: *self += 1; //~^ ERROR E0133 - //~| NOTE dereference of raw pointer } } diff --git a/src/test/ui/trait-safety-fn-body.stderr b/src/test/ui/trait-safety-fn-body.stderr new file mode 100644 index 0000000000..ab8793f8a7 --- /dev/null +++ b/src/test/ui/trait-safety-fn-body.stderr @@ -0,0 +1,8 @@ +error[E0133]: dereference of raw pointer requires unsafe function or block + --> $DIR/trait-safety-fn-body.rs:21:9 + | +21 | *self += 1; + | ^^^^^^^^^^ dereference of raw pointer + +error: aborting due to previous error + diff --git a/src/test/ui/trait-suggest-where-clause.rs b/src/test/ui/trait-suggest-where-clause.rs new file mode 100644 index 0000000000..5dcb4c8a22 --- /dev/null +++ b/src/test/ui/trait-suggest-where-clause.rs @@ -0,0 +1,46 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; + +struct Misc<T:?Sized>(T); + +fn check<T: Iterator, U: ?Sized>() { + // suggest a where-clause, if needed + mem::size_of::<U>(); + //~^ ERROR `U: std::marker::Sized` is not satisfied + + mem::size_of::<Misc<U>>(); + //~^ ERROR `U: std::marker::Sized` is not satisfied + + // ... even if T occurs as a type parameter + + <u64 as From<T>>::from; + //~^ ERROR `u64: std::convert::From<T>` is not satisfied + + <u64 as From<<T as Iterator>::Item>>::from; + //~^ ERROR `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied + + // ... but not if there are inference variables + + <Misc<_> as From<T>>::from; + //~^ ERROR `Misc<_>: std::convert::From<T>` is not satisfied + + // ... and also not if the error is not related to the type + + mem::size_of::<[T]>(); + //~^ ERROR `[T]: std::marker::Sized` is not satisfied + + mem::size_of::<[&U]>(); + //~^ ERROR `[&U]: std::marker::Sized` is not satisfied +} + +fn main() { +} diff --git a/src/test/ui/trait-suggest-where-clause.stderr b/src/test/ui/trait-suggest-where-clause.stderr new file mode 100644 index 0000000000..57d2b9aae7 --- /dev/null +++ b/src/test/ui/trait-suggest-where-clause.stderr @@ -0,0 +1,67 @@ +error[E0277]: the trait bound `U: std::marker::Sized` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:17:5 + | +17 | mem::size_of::<U>(); + | ^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `U` + = help: consider adding a `where U: std::marker::Sized` bound + = note: required by `std::mem::size_of` + +error[E0277]: the trait bound `U: std::marker::Sized` is not satisfied in `Misc<U>` + --> $DIR/trait-suggest-where-clause.rs:20:5 + | +20 | mem::size_of::<Misc<U>>(); + | ^^^^^^^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time + | + = help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U` + = help: consider adding a `where U: std::marker::Sized` bound + = note: required because it appears within the type `Misc<U>` + = note: required by `std::mem::size_of` + +error[E0277]: the trait bound `u64: std::convert::From<T>` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:25:5 + | +25 | <u64 as From<T>>::from; + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `u64` + | + = help: consider adding a `where u64: std::convert::From<T>` bound + = note: required by `std::convert::From::from` + +error[E0277]: the trait bound `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:28:5 + | +28 | <u64 as From<<T as Iterator>::Item>>::from; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<<T as std::iter::Iterator>::Item>` is not implemented for `u64` + | + = help: consider adding a `where u64: std::convert::From<<T as std::iter::Iterator>::Item>` bound + = note: required by `std::convert::From::from` + +error[E0277]: the trait bound `Misc<_>: std::convert::From<T>` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:33:5 + | +33 | <Misc<_> as From<T>>::from; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `Misc<_>` + | + = note: required by `std::convert::From::from` + +error[E0277]: the trait bound `[T]: std::marker::Sized` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:38:5 + | +38 | mem::size_of::<[T]>(); + | ^^^^^^^^^^^^^^^^^^^ `[T]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[T]` + = note: required by `std::mem::size_of` + +error[E0277]: the trait bound `[&U]: std::marker::Sized` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:41:5 + | +41 | mem::size_of::<[&U]>(); + | ^^^^^^^^^^^^^^^^^^^^ `[&U]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[&U]` + = note: required by `std::mem::size_of` + +error: aborting due to 7 previous errors + diff --git a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs b/src/test/ui/traits-multidispatch-convert-ambig-dest.rs similarity index 96% rename from src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs rename to src/test/ui/traits-multidispatch-convert-ambig-dest.rs index 2e115431c9..0d4855c544 100644 --- a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs +++ b/src/test/ui/traits-multidispatch-convert-ambig-dest.rs @@ -35,7 +35,6 @@ where T : Convert<U> fn a() { test(22, std::default::Default::default()); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `U` } fn main() {} diff --git a/src/test/ui/traits-multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits-multidispatch-convert-ambig-dest.stderr new file mode 100644 index 0000000000..8304fb3b79 --- /dev/null +++ b/src/test/ui/traits-multidispatch-convert-ambig-dest.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/traits-multidispatch-convert-ambig-dest.rs:36:5 + | +36 | test(22, std::default::Default::default()); + | ^^^^ cannot infer type for `U` + +error: aborting due to previous error + diff --git a/src/test/ui/transmute/main.rs b/src/test/ui/transmute/main.rs index ab448de656..285b079cf9 100644 --- a/src/test/ui/transmute/main.rs +++ b/src/test/ui/transmute/main.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// normalize-stderr-32bit: "&str (64 bits)" -> "&str ($STR bits)" -// normalize-stderr-64bit: "&str (128 bits)" -> "&str ($STR bits)" +// normalize-stderr-32bit: "&str \(64 bits\)" -> "&str ($$STR bits)" +// normalize-stderr-64bit: "&str \(128 bits\)" -> "&str ($$STR bits)" diff --git a/src/test/ui/transmute/transmute-from-fn-item-types-error.rs b/src/test/ui/transmute/transmute-from-fn-item-types-error.rs index d60c97f1d5..0a0214a24f 100644 --- a/src/test/ui/transmute/transmute-from-fn-item-types-error.rs +++ b/src/test/ui/transmute/transmute-from-fn-item-types-error.rs @@ -12,16 +12,16 @@ use std::mem; unsafe fn foo() -> (i8, *const (), Option<fn()>) { let i = mem::transmute(bar); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR transmute called with types of different sizes + let p = mem::transmute(foo); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR can't transmute zero-sized type + let of = mem::transmute(main); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR can't transmute zero-sized type + (i, p, of) } @@ -30,15 +30,15 @@ unsafe fn bar() { // Error as usual if the resulting type is not pointer-sized. mem::transmute::<_, u8>(main); //~^ ERROR transmute called with types of different sizes - //~^^ NOTE transmuting between fn() {main} and u8 + mem::transmute::<_, *mut ()>(foo); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR can't transmute zero-sized type + mem::transmute::<_, fn()>(bar); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR can't transmute zero-sized type + // No error if a coercion would otherwise occur. mem::transmute::<fn(), usize>(main); @@ -46,16 +46,16 @@ unsafe fn bar() { unsafe fn baz() { mem::transmute::<_, *mut ()>(Some(foo)); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR can't transmute zero-sized type + mem::transmute::<_, fn()>(Some(bar)); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR can't transmute zero-sized type + mem::transmute::<_, Option<fn()>>(Some(baz)); - //~^ ERROR is zero-sized and can't be transmuted - //~^^ NOTE cast with `as` to a pointer instead + //~^ ERROR can't transmute zero-sized type + // No error if a coercion would otherwise occur. mem::transmute::<Option<fn()>, usize>(Some(main)); diff --git a/src/test/ui/transmute/transmute-type-parameters.rs b/src/test/ui/transmute/transmute-type-parameters.rs index 117fc2cc5d..fe340295f7 100644 --- a/src/test/ui/transmute/transmute-type-parameters.rs +++ b/src/test/ui/transmute/transmute-type-parameters.rs @@ -19,17 +19,17 @@ use std::mem::transmute; unsafe fn f<T>(x: T) { let _: i32 = transmute(x); -//~^ ERROR differently sized types: T (size can vary) to i32 +//~^ ERROR transmute called with types of different sizes } unsafe fn g<T>(x: (T, i32)) { let _: i32 = transmute(x); -//~^ ERROR differently sized types: (T, i32) (size can vary because of T) to i32 +//~^ ERROR transmute called with types of different sizes } unsafe fn h<T>(x: [T; 10]) { let _: i32 = transmute(x); -//~^ ERROR differently sized types: [T; 10] (size can vary because of T) to i32 +//~^ ERROR transmute called with types of different sizes } struct Bad<T> { @@ -38,7 +38,7 @@ struct Bad<T> { unsafe fn i<T>(x: Bad<T>) { let _: i32 = transmute(x); -//~^ ERROR differently sized types: Bad<T> (size can vary because of T) to i32 +//~^ ERROR transmute called with types of different sizes } enum Worse<T> { @@ -48,12 +48,12 @@ enum Worse<T> { unsafe fn j<T>(x: Worse<T>) { let _: i32 = transmute(x); -//~^ ERROR differently sized types: Worse<T> (size can vary because of T) to i32 +//~^ ERROR transmute called with types of different sizes } unsafe fn k<T>(x: Option<T>) { let _: i32 = transmute(x); -//~^ ERROR differently sized types: std::option::Option<T> (size can vary because of T) to i32 +//~^ ERROR transmute called with types of different sizes } fn main() {} diff --git a/src/test/ui/type-check/assignment-in-if.rs b/src/test/ui/type-check/assignment-in-if.rs index 98dc55c666..d4d070ecae 100644 --- a/src/test/ui/type-check/assignment-in-if.rs +++ b/src/test/ui/type-check/assignment-in-if.rs @@ -24,25 +24,21 @@ fn main() { // `x { ... }` should not be interpreted as a struct literal here if x = x { //~^ ERROR mismatched types - //~| HELP did you mean to compare equality? println!("{}", x); } // Explicit parentheses on the left should match behavior of above if (x = x) { //~^ ERROR mismatched types - //~| HELP did you mean to compare equality? println!("{}", x); } // The struct literal interpretation is fine with explicit parentheses on the right if y = (Foo { foo: x }) { //~^ ERROR mismatched types - //~| HELP did you mean to compare equality? println!("{}", x); } // "invalid left-hand side expression" error is suppresed if 3 = x { //~^ ERROR mismatched types - //~| HELP did you mean to compare equality? println!("{}", x); } if (if true { x = 4 } else { x = 5 }) { diff --git a/src/test/ui/type-check/assignment-in-if.stderr b/src/test/ui/type-check/assignment-in-if.stderr index 6052b3091c..fffdca17d8 100644 --- a/src/test/ui/type-check/assignment-in-if.stderr +++ b/src/test/ui/type-check/assignment-in-if.stderr @@ -11,9 +11,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:31:8 + --> $DIR/assignment-in-if.rs:30:8 | -31 | if (x = x) { +30 | if (x = x) { | ^^^^^^^ | | | expected bool, found () @@ -23,9 +23,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:37:8 + --> $DIR/assignment-in-if.rs:35:8 | -37 | if y = (Foo { foo: x }) { +35 | if y = (Foo { foo: x }) { | ^^^^^^^^^^^^^^^^^^^^ | | | expected bool, found () @@ -35,9 +35,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:43:8 + --> $DIR/assignment-in-if.rs:40:8 | -43 | if 3 = x { +40 | if 3 = x { | ^^^^^ | | | expected bool, found () @@ -47,9 +47,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:48:8 + --> $DIR/assignment-in-if.rs:44:8 | -48 | if (if true { x = 4 } else { x = 5 }) { +44 | if (if true { x = 4 } else { x = 5 }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found () | = note: expected type `bool` diff --git a/src/test/ui/type-check/cannot_infer_local_or_array.rs b/src/test/ui/type-check/cannot_infer_local_or_array.rs index 0b35a9c3db..3ec96144da 100644 --- a/src/test/ui/type-check/cannot_infer_local_or_array.rs +++ b/src/test/ui/type-check/cannot_infer_local_or_array.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x = []; + let x = []; //~ ERROR type annotations needed } diff --git a/src/test/ui/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type-check/cannot_infer_local_or_array.stderr index 8c52bb5a1d..19369f5ca6 100644 --- a/src/test/ui/type-check/cannot_infer_local_or_array.stderr +++ b/src/test/ui/type-check/cannot_infer_local_or_array.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/cannot_infer_local_or_array.rs:12:13 | -12 | let x = []; +12 | let x = []; //~ ERROR type annotations needed | - ^^ cannot infer type for `_` | | | consider giving `x` a type diff --git a/src/test/ui/type-check/cannot_infer_local_or_vec.stderr b/src/test/ui/type-check/cannot_infer_local_or_vec.stderr index 4788fad208..bbbcb9158a 100644 --- a/src/test/ui/type-check/cannot_infer_local_or_vec.stderr +++ b/src/test/ui/type-check/cannot_infer_local_or_vec.stderr @@ -6,7 +6,7 @@ error[E0282]: type annotations needed | | | consider giving `x` a type | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.stderr b/src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.stderr index ccffadebe9..6c47624d6d 100644 --- a/src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.stderr +++ b/src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.stderr @@ -6,7 +6,7 @@ error[E0282]: type annotations needed | | | consider giving the pattern a type | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/type-check/issue-22897.rs b/src/test/ui/type-check/issue-22897.rs index 296dc81a89..62eaa616d3 100644 --- a/src/test/ui/type-check/issue-22897.rs +++ b/src/test/ui/type-check/issue-22897.rs @@ -11,5 +11,5 @@ fn main() { } fn unconstrained_type() { - []; + []; //~ ERROR type annotations needed } diff --git a/src/test/ui/type-check/issue-22897.stderr b/src/test/ui/type-check/issue-22897.stderr index 9568411885..5ee350746b 100644 --- a/src/test/ui/type-check/issue-22897.stderr +++ b/src/test/ui/type-check/issue-22897.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-22897.rs:14:5 | -14 | []; +14 | []; //~ ERROR type annotations needed | ^^ cannot infer type for `[_; 0]` error: aborting due to previous error diff --git a/src/test/ui/type-check/issue-40294.rs b/src/test/ui/type-check/issue-40294.rs index d30a425d10..d2817062b2 100644 --- a/src/test/ui/type-check/issue-40294.rs +++ b/src/test/ui/type-check/issue-40294.rs @@ -12,7 +12,7 @@ trait Foo: Sized { fn foo(self); } -fn foo<'a,'b,T>(x: &'a T, y: &'b T) +fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required where &'a T : Foo, &'b T : Foo { diff --git a/src/test/ui/type-check/issue-40294.stderr b/src/test/ui/type-check/issue-40294.stderr index bb3a371b26..2ca97aa3ef 100644 --- a/src/test/ui/type-check/issue-40294.stderr +++ b/src/test/ui/type-check/issue-40294.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `&'a T: Foo` --> $DIR/issue-40294.rs:15:1 | -15 | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) +15 | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required 16 | | where &'a T : Foo, 17 | | &'b T : Foo 18 | | { diff --git a/src/test/ui/type-check/issue-41314.rs b/src/test/ui/type-check/issue-41314.rs index 5127a8ce17..7b4d2f05f5 100644 --- a/src/test/ui/type-check/issue-41314.rs +++ b/src/test/ui/type-check/issue-41314.rs @@ -14,6 +14,7 @@ enum X { fn main() { match X::Y(0) { - X::Y { number } => {} + X::Y { number } => {} //~ ERROR does not have a field named `number` + //~^ ERROR pattern does not mention field `0` } } diff --git a/src/test/ui/type-check/issue-41314.stderr b/src/test/ui/type-check/issue-41314.stderr index acae7a3508..569924da6f 100644 --- a/src/test/ui/type-check/issue-41314.stderr +++ b/src/test/ui/type-check/issue-41314.stderr @@ -1,13 +1,13 @@ error[E0026]: variant `X::Y` does not have a field named `number` --> $DIR/issue-41314.rs:17:16 | -17 | X::Y { number } => {} +17 | X::Y { number } => {} //~ ERROR does not have a field named `number` | ^^^^^^ variant `X::Y` does not have field `number` error[E0027]: pattern does not mention field `0` --> $DIR/issue-41314.rs:17:9 | -17 | X::Y { number } => {} +17 | X::Y { number } => {} //~ ERROR does not have a field named `number` | ^^^^^^^^^^^^^^^ missing field `0` | = note: trying to match a tuple variant with a struct variant pattern diff --git a/src/test/ui/type-check/missing_trait_impl.rs b/src/test/ui/type-check/missing_trait_impl.rs new file mode 100644 index 0000000000..adf6b85b64 --- /dev/null +++ b/src/test/ui/type-check/missing_trait_impl.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { +} + +fn foo<T>(x: T, y: T) { + let z = x + y; //~ ERROR binary operation `+` cannot be applied to type `T` +} diff --git a/src/test/ui/type-check/missing_trait_impl.stderr b/src/test/ui/type-check/missing_trait_impl.stderr new file mode 100644 index 0000000000..64f8167eb1 --- /dev/null +++ b/src/test/ui/type-check/missing_trait_impl.stderr @@ -0,0 +1,10 @@ +error[E0369]: binary operation `+` cannot be applied to type `T` + --> $DIR/missing_trait_impl.rs:15:13 + | +15 | let z = x + y; //~ ERROR binary operation `+` cannot be applied to type `T` + | ^^^^^ + | + = note: `T` might need a bound for `std::ops::Add` + +error: aborting due to previous error + diff --git a/src/test/ui/type-check/unknown_type_for_closure.rs b/src/test/ui/type-check/unknown_type_for_closure.rs index f1d357df12..0c35597633 100644 --- a/src/test/ui/type-check/unknown_type_for_closure.rs +++ b/src/test/ui/type-check/unknown_type_for_closure.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x = |_| { }; + let x = |_| { }; //~ ERROR type annotations needed } diff --git a/src/test/ui/type-check/unknown_type_for_closure.stderr b/src/test/ui/type-check/unknown_type_for_closure.stderr index afbd15ca48..1d8c0ddc8b 100644 --- a/src/test/ui/type-check/unknown_type_for_closure.stderr +++ b/src/test/ui/type-check/unknown_type_for_closure.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/unknown_type_for_closure.rs:12:14 | -12 | let x = |_| { }; +12 | let x = |_| { }; //~ ERROR type annotations needed | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/compile-fail/type-recursive.rs b/src/test/ui/type-recursive.rs similarity index 82% rename from src/test/compile-fail/type-recursive.rs rename to src/test/ui/type-recursive.rs index 5dd76ce32c..4bb739800d 100644 --- a/src/test/compile-fail/type-recursive.rs +++ b/src/test/ui/type-recursive.rs @@ -9,9 +9,8 @@ // except according to those terms. struct t1 { //~ ERROR E0072 - //~| NOTE recursive type has infinite size foo: isize, - foolish: t1 //~ NOTE recursive without indirection + foolish: t1 } fn main() { } diff --git a/src/test/ui/type-recursive.stderr b/src/test/ui/type-recursive.stderr new file mode 100644 index 0000000000..4c76452979 --- /dev/null +++ b/src/test/ui/type-recursive.stderr @@ -0,0 +1,13 @@ +error[E0072]: recursive type `t1` has infinite size + --> $DIR/type-recursive.rs:11:1 + | +11 | struct t1 { //~ ERROR E0072 + | ^^^^^^^^^ recursive type has infinite size +12 | foo: isize, +13 | foolish: t1 + | ----------- recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `t1` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs b/src/test/ui/typeck-builtin-bound-type-parameters.rs similarity index 82% rename from src/test/compile-fail/typeck-builtin-bound-type-parameters.rs rename to src/test/ui/typeck-builtin-bound-type-parameters.rs index 0d98e044ab..15fc3ecab9 100644 --- a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs +++ b/src/test/ui/typeck-builtin-bound-type-parameters.rs @@ -10,26 +10,20 @@ fn foo1<T:Copy<U>, U>(x: T) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments trait Trait: Copy<Send> {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments struct MyStruct1<T: Copy<T>>; //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments struct MyStruct2<'a, T: Copy<'a>>; //~^ ERROR: wrong number of lifetime parameters: expected 0, found 1 -//~| NOTE unexpected lifetime parameter fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments //~| ERROR: wrong number of lifetime parameters: expected 0, found 1 -//~| NOTE unexpected lifetime parameter fn main() { } diff --git a/src/test/ui/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck-builtin-bound-type-parameters.stderr new file mode 100644 index 0000000000..cf280bf1cd --- /dev/null +++ b/src/test/ui/typeck-builtin-bound-type-parameters.stderr @@ -0,0 +1,38 @@ +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:11:11 + | +11 | fn foo1<T:Copy<U>, U>(x: T) {} + | ^^^^^^^ expected no type arguments + +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:14:14 + | +14 | trait Trait: Copy<Send> {} + | ^^^^^^^^^^ expected no type arguments + +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:17:21 + | +17 | struct MyStruct1<T: Copy<T>>; + | ^^^^^^^ expected no type arguments + +error[E0107]: wrong number of lifetime parameters: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:20:25 + | +20 | struct MyStruct2<'a, T: Copy<'a>>; + | ^^^^^^^^ unexpected lifetime parameter + +error[E0107]: wrong number of lifetime parameters: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:24:15 + | +24 | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} + | ^^^^^^^^^^^ unexpected lifetime parameter + +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:24:15 + | +24 | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} + | ^^^^^^^^^^^ expected no type arguments + +error: aborting due to 6 previous errors + diff --git a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs b/src/test/ui/typeck-default-trait-impl-outside-crate.rs similarity index 91% rename from src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs rename to src/test/ui/typeck-default-trait-impl-outside-crate.rs index da3e926d6f..ff0446e23e 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs +++ b/src/test/ui/typeck-default-trait-impl-outside-crate.rs @@ -12,5 +12,4 @@ #[allow(auto_impl)] impl Copy for .. {} //~ ERROR E0318 - //~^ NOTE `Copy` trait not defined in this crate fn main() {} diff --git a/src/test/ui/typeck-default-trait-impl-outside-crate.stderr b/src/test/ui/typeck-default-trait-impl-outside-crate.stderr new file mode 100644 index 0000000000..6b50fde01d --- /dev/null +++ b/src/test/ui/typeck-default-trait-impl-outside-crate.stderr @@ -0,0 +1,8 @@ +error[E0318]: cannot create default implementations for traits outside the crate they're defined in; define a new trait instead + --> $DIR/typeck-default-trait-impl-outside-crate.rs:14:6 + | +14 | impl Copy for .. {} //~ ERROR E0318 + | ^^^^ `Copy` trait not defined in this crate + +error: aborting due to previous error + diff --git a/src/test/compile-fail/typeck_type_placeholder_item.rs b/src/test/ui/typeck_type_placeholder_item.rs similarity index 75% rename from src/test/compile-fail/typeck_type_placeholder_item.rs rename to src/test/ui/typeck_type_placeholder_item.rs index 42db3b47a0..d4f3cdfd8b 100644 --- a/src/test/compile-fail/typeck_type_placeholder_item.rs +++ b/src/test/ui/typeck_type_placeholder_item.rs @@ -13,141 +13,107 @@ fn test() -> _ { 5 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures fn test2() -> (_, _) { (5, 5) } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures -//~| NOTE not allowed in type signatures static TEST3: _ = "test"; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures static TEST4: _ = 145; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures static TEST5: (_, _) = (1, 2); //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures -//~| NOTE not allowed in type signatures fn test6(_: _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures fn test7(x: _) { let _x: usize = x; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures fn test8(_f: fn() -> _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures struct Test9; impl Test9 { fn test9(&self) -> _ { () } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn test10(&self, _x : _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } impl Clone for Test9 { fn clone(&self) -> _ { Test9 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn clone_from(&mut self, other: _) { *self = Test9; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } struct Test10 { a: _, //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures b: (_, _), //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures } pub fn main() { fn fn_test() -> _ { 5 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test2() -> (_, _) { (5, 5) } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures static FN_TEST3: _ = "test"; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures static FN_TEST4: _ = 145; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures static FN_TEST5: (_, _) = (1, 2); //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures fn fn_test6(_: _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test7(x: _) { let _x: usize = x; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test8(_f: fn() -> _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures struct FnTest9; impl FnTest9 { fn fn_test9(&self) -> _ { () } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test10(&self, _x : _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } impl Clone for FnTest9 { fn clone(&self) -> _ { FnTest9 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn clone_from(&mut self, other: _) { *self = FnTest9; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } struct FnTest10 { a: _, //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures b: (_, _), //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures } } diff --git a/src/test/ui/typeck_type_placeholder_item.stderr b/src/test/ui/typeck_type_placeholder_item.stderr new file mode 100644 index 0000000000..39e4273157 --- /dev/null +++ b/src/test/ui/typeck_type_placeholder_item.stderr @@ -0,0 +1,206 @@ +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:14:14 + | +14 | fn test() -> _ { 5 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:17:16 + | +17 | fn test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:17:19 + | +17 | fn test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:21:15 + | +21 | static TEST3: _ = "test"; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:24:15 + | +24 | static TEST4: _ = 145; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:27:16 + | +27 | static TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:27:19 + | +27 | static TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:31:13 + | +31 | fn test6(_: _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:34:13 + | +34 | fn test7(x: _) { let _x: usize = x; } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:37:22 + | +37 | fn test8(_f: fn() -> _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:59:8 + | +59 | a: _, + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:61:9 + | +61 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:61:12 + | +61 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:67:21 + | +67 | fn fn_test() -> _ { 5 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:70:23 + | +70 | fn fn_test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:70:26 + | +70 | fn fn_test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:74:22 + | +74 | static FN_TEST3: _ = "test"; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:77:22 + | +77 | static FN_TEST4: _ = 145; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:80:23 + | +80 | static FN_TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:80:26 + | +80 | static FN_TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:84:20 + | +84 | fn fn_test6(_: _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:87:20 + | +87 | fn fn_test7(x: _) { let _x: usize = x; } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:90:29 + | +90 | fn fn_test8(_f: fn() -> _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:112:12 + | +112 | a: _, + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:114:13 + | +114 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:114:16 + | +114 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:43:24 + | +43 | fn test9(&self) -> _ { () } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:46:27 + | +46 | fn test10(&self, _x : _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:51:24 + | +51 | fn clone(&self) -> _ { Test9 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:54:37 + | +54 | fn clone_from(&mut self, other: _) { *self = Test9; } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:96:31 + | +96 | fn fn_test9(&self) -> _ { () } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:99:34 + | +99 | fn fn_test10(&self, _x : _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:104:28 + | +104 | fn clone(&self) -> _ { FnTest9 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:107:41 + | +107 | fn clone_from(&mut self, other: _) { *self = FnTest9; } + | ^ not allowed in type signatures + +error: aborting due to 34 previous errors + diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs b/src/test/ui/typeck_type_placeholder_lifetime_1.rs similarity index 95% rename from src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs rename to src/test/ui/typeck_type_placeholder_lifetime_1.rs index ad57752b6f..49774ab173 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs +++ b/src/test/ui/typeck_type_placeholder_lifetime_1.rs @@ -18,5 +18,4 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, _> = Foo { r: &5 }; //~^ ERROR wrong number of type arguments: expected 1, found 2 [E0244] - //~| NOTE expected 1 type argument } diff --git a/src/test/ui/typeck_type_placeholder_lifetime_1.stderr b/src/test/ui/typeck_type_placeholder_lifetime_1.stderr new file mode 100644 index 0000000000..8f017e6d9a --- /dev/null +++ b/src/test/ui/typeck_type_placeholder_lifetime_1.stderr @@ -0,0 +1,8 @@ +error[E0244]: wrong number of type arguments: expected 1, found 2 + --> $DIR/typeck_type_placeholder_lifetime_1.rs:19:12 + | +19 | let c: Foo<_, _> = Foo { r: &5 }; + | ^^^^^^^^^ expected 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs b/src/test/ui/typeck_type_placeholder_lifetime_2.rs similarity index 95% rename from src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs rename to src/test/ui/typeck_type_placeholder_lifetime_2.rs index f1ecad0056..40617613ed 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs +++ b/src/test/ui/typeck_type_placeholder_lifetime_2.rs @@ -18,5 +18,4 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, usize> = Foo { r: &5 }; //~^ ERROR wrong number of type arguments: expected 1, found 2 [E0244] - //~| NOTE expected 1 type argument } diff --git a/src/test/ui/typeck_type_placeholder_lifetime_2.stderr b/src/test/ui/typeck_type_placeholder_lifetime_2.stderr new file mode 100644 index 0000000000..396715f57a --- /dev/null +++ b/src/test/ui/typeck_type_placeholder_lifetime_2.stderr @@ -0,0 +1,8 @@ +error[E0244]: wrong number of type arguments: expected 1, found 2 + --> $DIR/typeck_type_placeholder_lifetime_2.rs:19:12 + | +19 | let c: Foo<_, usize> = Foo { r: &5 }; + | ^^^^^^^^^^^^^ expected 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23173.rs b/src/test/ui/unboxed-closure-no-cyclic-sig.rs similarity index 68% rename from src/test/compile-fail/issue-23173.rs rename to src/test/ui/unboxed-closure-no-cyclic-sig.rs index 946e4b9e96..506bce0dbe 100644 --- a/src/test/compile-fail/issue-23173.rs +++ b/src/test/ui/unboxed-closure-no-cyclic-sig.rs @@ -8,10 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } +// Test that unboxed closures cannot capture their own type. +// +// Also regression test for issue #21410. -fn use_token(token: &Token) { unimplemented!() } +fn g<F>(_: F) where F: FnOnce(Option<F>) {} fn main() { - use_token(&Token::Homura); //~ ERROR no associated item named + g(|_| { }); //~ ERROR closure/generator type that references itself } diff --git a/src/test/ui/unboxed-closure-no-cyclic-sig.stderr b/src/test/ui/unboxed-closure-no-cyclic-sig.stderr new file mode 100644 index 0000000000..75a87f7066 --- /dev/null +++ b/src/test/ui/unboxed-closure-no-cyclic-sig.stderr @@ -0,0 +1,12 @@ +error[E0644]: closure/generator type that references itself + --> $DIR/unboxed-closure-no-cyclic-sig.rs:18:7 + | +18 | g(|_| { }); //~ ERROR closure/generator type that references itself + | ^^^^^^^^ cyclic type of infinite size + | + = note: closures cannot capture themselves or take themselves as argument; + this error may be the result of a recent compiler bug-fix, + see https://github.com/rust-lang/rust/issues/46062 for more details + +error: aborting due to previous error + diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs b/src/test/ui/unboxed-closure-sugar-wrong-trait.rs similarity index 88% rename from src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs rename to src/test/ui/unboxed-closure-sugar-wrong-trait.rs index 95d78c0750..1519ceb898 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs +++ b/src/test/ui/unboxed-closure-sugar-wrong-trait.rs @@ -14,8 +14,6 @@ trait Trait {} fn f<F:Trait(isize) -> isize>(x: F) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments //~| ERROR E0220 -//~| NOTE associated type `Output` not found fn main() {} diff --git a/src/test/ui/unboxed-closure-sugar-wrong-trait.stderr b/src/test/ui/unboxed-closure-sugar-wrong-trait.stderr new file mode 100644 index 0000000000..544d4b74bb --- /dev/null +++ b/src/test/ui/unboxed-closure-sugar-wrong-trait.stderr @@ -0,0 +1,14 @@ +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:8 + | +15 | fn f<F:Trait(isize) -> isize>(x: F) {} + | ^^^^^^^^^^^^^^^^^^^^^ expected no type arguments + +error[E0220]: associated type `Output` not found for `Trait` + --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24 + | +15 | fn f<F:Trait(isize) -> isize>(x: F) {} + | ^^^^^ associated type `Output` not found + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.rs b/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.rs index 14ef3b5f17..481346ad4b 100644 --- a/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.rs +++ b/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.rs @@ -21,6 +21,6 @@ fn main() { // the closure implements `FnOnce`, not that it moves from inside // a `Fn` closure.) let y = (vec![1, 2, 3], 0); - let c = || drop(y.0); + let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait foo(c); } diff --git a/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.stderr index d968c40939..2c16c5b619 100644 --- a/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -1,16 +1,13 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:24:13 | -24 | let c = || drop(y.0); - | ^^^^^^^^^^^^ +24 | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait + | ^^^^^^^^-^^^ + | | | + | | closure is `FnOnce` because it moves the variable `y` out of its environment + | this closure implements `FnOnce`, not `Fn` 25 | foo(c); | --- the requirement to implement `Fn` derives from here - | -note: closure is `FnOnce` because it moves the variable `y` out of its environment - --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:24:21 - | -24 | let c = || drop(y.0); - | ^ error: aborting due to previous error diff --git a/src/test/compile-fail/unconstrained-none.rs b/src/test/ui/unconstrained-none.rs similarity index 92% rename from src/test/compile-fail/unconstrained-none.rs rename to src/test/ui/unconstrained-none.rs index 52ca91e62f..8124773497 100644 --- a/src/test/compile-fail/unconstrained-none.rs +++ b/src/test/ui/unconstrained-none.rs @@ -12,5 +12,4 @@ fn main() { None; //~ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` } diff --git a/src/test/ui/unconstrained-none.stderr b/src/test/ui/unconstrained-none.stderr new file mode 100644 index 0000000000..0f70cc5fd1 --- /dev/null +++ b/src/test/ui/unconstrained-none.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/unconstrained-none.rs:14:5 + | +14 | None; //~ ERROR type annotations needed [E0282] + | ^^^^ cannot infer type for `T` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/unconstrained-ref.rs b/src/test/ui/unconstrained-ref.rs similarity index 91% rename from src/test/compile-fail/unconstrained-ref.rs rename to src/test/ui/unconstrained-ref.rs index 6aaed78971..05c0d23b7e 100644 --- a/src/test/compile-fail/unconstrained-ref.rs +++ b/src/test/ui/unconstrained-ref.rs @@ -14,5 +14,4 @@ struct S<'a, T:'a> { fn main() { S { o: &None }; //~ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` } diff --git a/src/test/ui/unconstrained-ref.stderr b/src/test/ui/unconstrained-ref.stderr new file mode 100644 index 0000000000..96d9b8396a --- /dev/null +++ b/src/test/ui/unconstrained-ref.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/unconstrained-ref.rs:16:5 + | +16 | S { o: &None }; //~ ERROR type annotations needed [E0282] + | ^ cannot infer type for `T` + +error: aborting due to previous error + diff --git a/src/test/ui/union-fields.stderr b/src/test/ui/union-fields.stderr deleted file mode 100644 index f3a2702d5a..0000000000 --- a/src/test/ui/union-fields.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error: field is never used: `c` - --> $DIR/union-fields.rs:16:5 - | -16 | c: u8, // should be reported - | ^^^^^ - | -note: lint level defined here - --> $DIR/union-fields.rs:11:9 - | -11 | #![deny(dead_code)] - | ^^^^^^^^^ - -error: field is never used: `a` - --> $DIR/union-fields.rs:19:5 - | -19 | a: u8, // should be reported - | ^^^^^ - -error: field is never used: `a` - --> $DIR/union-fields.rs:23:20 - | -23 | union NoDropLike { a: u8 } // should be reported as unused - | ^^^^^ - -error: field is never used: `c` - --> $DIR/union-fields.rs:28:5 - | -28 | c: u8, // should be reported - | ^^^^^ - -error: aborting due to 4 previous errors - diff --git a/src/test/compile-fail/union/union-const-eval.rs b/src/test/ui/union/union-const-eval.rs similarity index 91% rename from src/test/compile-fail/union/union-const-eval.rs rename to src/test/ui/union/union-const-eval.rs index ee4d9fe99e..a4c969ba20 100644 --- a/src/test/compile-fail/union/union-const-eval.rs +++ b/src/test/ui/union/union-const-eval.rs @@ -19,6 +19,6 @@ fn main() { unsafe { let a: [u8; C.a]; // OK let b: [u8; C.b]; //~ ERROR constant evaluation error - //~^ NOTE nonexistent struct field + //~| WARNING constant evaluation error } } diff --git a/src/test/ui/union/union-const-eval.stderr b/src/test/ui/union/union-const-eval.stderr new file mode 100644 index 0000000000..3c98b5cdc6 --- /dev/null +++ b/src/test/ui/union/union-const-eval.stderr @@ -0,0 +1,16 @@ +warning: constant evaluation error: nonexistent struct field + --> $DIR/union-const-eval.rs:21:21 + | +21 | let b: [u8; C.b]; //~ ERROR constant evaluation error + | ^^^ + | + = note: #[warn(const_err)] on by default + +error[E0080]: constant evaluation error + --> $DIR/union-const-eval.rs:21:21 + | +21 | let b: [u8; C.b]; //~ ERROR constant evaluation error + | ^^^ nonexistent struct field + +error: aborting due to previous error + diff --git a/src/test/compile-fail/union/union-derive-eq.rs b/src/test/ui/union/union-derive-eq.rs similarity index 100% rename from src/test/compile-fail/union/union-derive-eq.rs rename to src/test/ui/union/union-derive-eq.rs diff --git a/src/test/ui/union/union-derive-eq.stderr b/src/test/ui/union/union-derive-eq.stderr new file mode 100644 index 0000000000..569191ca6e --- /dev/null +++ b/src/test/ui/union/union-derive-eq.stderr @@ -0,0 +1,10 @@ +error[E0277]: the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied + --> $DIR/union-derive-eq.rs:25:5 + | +25 | a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied + | ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq` + | + = note: required by `std::cmp::AssertParamIsEq` + +error: aborting due to previous error + diff --git a/src/test/ui/union-fields.rs b/src/test/ui/union/union-fields-1.rs similarity index 84% rename from src/test/ui/union-fields.rs rename to src/test/ui/union/union-fields-1.rs index 021f57e3ee..dc551bb899 100644 --- a/src/test/ui/union-fields.rs +++ b/src/test/ui/union/union-fields-1.rs @@ -13,19 +13,19 @@ union U1 { a: u8, // should not be reported b: u8, // should not be reported - c: u8, // should be reported + c: u8, //~ ERROR field is never used } union U2 { - a: u8, // should be reported + a: u8, //~ ERROR field is never used b: u8, // should not be reported c: u8, // should not be reported } -union NoDropLike { a: u8 } // should be reported as unused +union NoDropLike { a: u8 } //~ ERROR field is never used union U { a: u8, // should not be reported b: u8, // should not be reported - c: u8, // should be reported + c: u8, //~ ERROR field is never used } type A = U; diff --git a/src/test/ui/union/union-fields-1.stderr b/src/test/ui/union/union-fields-1.stderr new file mode 100644 index 0000000000..5204a13f6f --- /dev/null +++ b/src/test/ui/union/union-fields-1.stderr @@ -0,0 +1,32 @@ +error: field is never used: `c` + --> $DIR/union-fields-1.rs:16:5 + | +16 | c: u8, //~ ERROR field is never used + | ^^^^^ + | +note: lint level defined here + --> $DIR/union-fields-1.rs:11:9 + | +11 | #![deny(dead_code)] + | ^^^^^^^^^ + +error: field is never used: `a` + --> $DIR/union-fields-1.rs:19:5 + | +19 | a: u8, //~ ERROR field is never used + | ^^^^^ + +error: field is never used: `a` + --> $DIR/union-fields-1.rs:23:20 + | +23 | union NoDropLike { a: u8 } //~ ERROR field is never used + | ^^^^^ + +error: field is never used: `c` + --> $DIR/union-fields-1.rs:28:5 + | +28 | c: u8, //~ ERROR field is never used + | ^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/union/union-fields.rs b/src/test/ui/union/union-fields-2.rs similarity index 87% rename from src/test/compile-fail/union/union-fields.rs rename to src/test/ui/union/union-fields-2.rs index 124b16f99b..7b9ff866a4 100644 --- a/src/test/compile-fail/union/union-fields.rs +++ b/src/test/ui/union/union-fields-2.rs @@ -19,8 +19,6 @@ fn main() { let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field //~^ ERROR union `U` has no field named `c` - //~| NOTE `U` does not have this field - //~| NOTE available fields are: `a`, `b` let u = U { ..u }; //~ ERROR union expressions should have exactly one field //~^ ERROR functional record update syntax requires a struct @@ -29,7 +27,6 @@ fn main() { let U { a, b } = u; //~ ERROR union patterns should have exactly one field let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field //~^ ERROR union `U` does not have a field named `c` - //~| NOTE union `U` does not have field `c` let U { .. } = u; //~ ERROR union patterns should have exactly one field //~^ ERROR `..` cannot be used in union patterns let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns diff --git a/src/test/ui/union/union-fields-2.stderr b/src/test/ui/union/union-fields-2.stderr new file mode 100644 index 0000000000..f6c64dcabd --- /dev/null +++ b/src/test/ui/union/union-fields-2.stderr @@ -0,0 +1,82 @@ +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:17:13 + | +17 | let u = U {}; //~ ERROR union expressions should have exactly one field + | ^ + +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:19:13 + | +19 | let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field + | ^ + +error[E0560]: union `U` has no field named `c` + --> $DIR/union-fields-2.rs:20:29 + | +20 | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field + | ^^ `U` does not have this field + | + = note: available fields are: `a`, `b` + +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:20:13 + | +20 | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field + | ^ + +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:22:13 + | +22 | let u = U { ..u }; //~ ERROR union expressions should have exactly one field + | ^ + +error[E0436]: functional record update syntax requires a struct + --> $DIR/union-fields-2.rs:22:19 + | +22 | let u = U { ..u }; //~ ERROR union expressions should have exactly one field + | ^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:25:9 + | +25 | let U {} = u; //~ ERROR union patterns should have exactly one field + | ^^^^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:27:9 + | +27 | let U { a, b } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^^^ + +error[E0026]: union `U` does not have a field named `c` + --> $DIR/union-fields-2.rs:28:19 + | +28 | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field + | ^ union `U` does not have field `c` + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:28:9 + | +28 | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^^^^^^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:30:9 + | +30 | let U { .. } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^ + +error: `..` cannot be used in union patterns + --> $DIR/union-fields-2.rs:30:9 + | +30 | let U { .. } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^ + +error: `..` cannot be used in union patterns + --> $DIR/union-fields-2.rs:32:9 + | +32 | let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns + | ^^^^^^^^^^^ + +error: aborting due to 13 previous errors + diff --git a/src/test/ui/union/union-sized-field.rs b/src/test/ui/union/union-sized-field.rs new file mode 100644 index 0000000000..8999f1e093 --- /dev/null +++ b/src/test/ui/union/union-sized-field.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(untagged_unions)] + +union Foo<T: ?Sized> { + value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied +} + +struct Foo2<T: ?Sized> { + value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied + t: u32, +} + +enum Foo3<T: ?Sized> { + Value(T), //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr similarity index 82% rename from src/test/ui/union-sized-field.stderr rename to src/test/ui/union/union-sized-field.stderr index ea90d97c4c..9586f95073 100644 --- a/src/test/ui/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied --> $DIR/union-sized-field.rs:14:5 | -14 | value: T, +14 | value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` @@ -11,7 +11,7 @@ error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied --> $DIR/union-sized-field.rs:18:5 | -18 | value: T, +18 | value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` @@ -21,7 +21,7 @@ error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied --> $DIR/union-sized-field.rs:23:11 | -23 | Value(T), +23 | Value(T), //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied | ^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` diff --git a/src/test/compile-fail/union/union-suggest-field.rs b/src/test/ui/union/union-suggest-field.rs similarity index 86% rename from src/test/compile-fail/union/union-suggest-field.rs rename to src/test/ui/union/union-suggest-field.rs index 65c7c980b8..96fca78ef2 100644 --- a/src/test/compile-fail/union/union-suggest-field.rs +++ b/src/test/ui/union/union-suggest-field.rs @@ -19,10 +19,8 @@ impl U { fn main() { let u = U { principle: 0 }; //~^ ERROR union `U` has no field named `principle` - //~| NOTE field does not exist - did you mean `principal`? let w = u.principial; //~ ERROR no field `principial` on type `U` //~^ did you mean `principal`? let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` - //~^ HELP maybe a `()` to call it is missing? } diff --git a/src/test/ui/union/union-suggest-field.stderr b/src/test/ui/union/union-suggest-field.stderr new file mode 100644 index 0000000000..d2ea09553b --- /dev/null +++ b/src/test/ui/union/union-suggest-field.stderr @@ -0,0 +1,22 @@ +error[E0560]: union `U` has no field named `principle` + --> $DIR/union-suggest-field.rs:20:17 + | +20 | let u = U { principle: 0 }; + | ^^^^^^^^^^ field does not exist - did you mean `principal`? + +error[E0609]: no field `principial` on type `U` + --> $DIR/union-suggest-field.rs:22:15 + | +22 | let w = u.principial; //~ ERROR no field `principial` on type `U` + | ^^^^^^^^^^ did you mean `principal`? + +error[E0615]: attempted to take value of method `calculate` on type `U` + --> $DIR/union-suggest-field.rs:25:15 + | +25 | let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` + | ^^^^^^^^^ + | + = help: maybe a `()` to call it is missing? + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/unsafe-const-fn.rs b/src/test/ui/unsafe-const-fn.rs similarity index 95% rename from src/test/compile-fail/unsafe-const-fn.rs rename to src/test/ui/unsafe-const-fn.rs index 91e16592be..765e2059a4 100644 --- a/src/test/compile-fail/unsafe-const-fn.rs +++ b/src/test/ui/unsafe-const-fn.rs @@ -18,7 +18,6 @@ const unsafe fn dummy(v: u32) -> u32 { const VAL: u32 = dummy(0xFFFF); //~^ ERROR E0133 -//~| NOTE call to unsafe function fn main() { assert_eq!(VAL, 0xFFFF0000); diff --git a/src/test/ui/unsafe-const-fn.stderr b/src/test/ui/unsafe-const-fn.stderr new file mode 100644 index 0000000000..f3923244ab --- /dev/null +++ b/src/test/ui/unsafe-const-fn.stderr @@ -0,0 +1,8 @@ +error[E0133]: call to unsafe function requires unsafe function or block + --> $DIR/unsafe-const-fn.rs:19:18 + | +19 | const VAL: u32 = dummy(0xFFFF); + | ^^^^^^^^^^^^^ call to unsafe function + +error: aborting due to previous error + diff --git a/src/test/compile-fail/unsized-enum2.rs b/src/test/ui/unsized-enum2.rs similarity index 100% rename from src/test/compile-fail/unsized-enum2.rs rename to src/test/ui/unsized-enum2.rs diff --git a/src/test/ui/unsized-enum2.stderr b/src/test/ui/unsized-enum2.stderr new file mode 100644 index 0000000000..97a83456bb --- /dev/null +++ b/src/test/ui/unsized-enum2.stderr @@ -0,0 +1,190 @@ +error[E0277]: the trait bound `W: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:33:8 + | +33 | VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied + | ^^ `W` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `W` + = help: consider adding a `where W: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `X: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:34:8 + | +34 | VB{x: X}, //~ ERROR `X: std::marker::Sized` is not satisfied + | ^^^^ `X` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `X` + = help: consider adding a `where X: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Y: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:35:15 + | +35 | VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied + | ^^ `Y` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Y` + = help: consider adding a `where Y: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Z: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:36:18 + | +36 | VD{u: isize, x: Z}, //~ ERROR `Z: std::marker::Sized` is not satisfied + | ^^^^ `Z` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Z` + = help: consider adding a `where Z: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:39:8 + | +39 | VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied + | ^^^^^ `[u8]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[u8]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:40:8 + | +40 | VF{x: str}, //~ ERROR `str: std::marker::Sized` is not satisfied + | ^^^^^^ `str` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[f32]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:41:15 + | +41 | VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied + | ^^^^^^ `[f32]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[f32]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[u32]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:42:18 + | +42 | VH{u: isize, x: [u32]}, //~ ERROR `[u32]: std::marker::Sized` is not satisfied + | ^^^^^^^^ `[u32]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[u32]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Foo + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:51:8 + | +51 | VM(Foo), //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied + | ^^^^ `Foo + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Foo + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Bar + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:52:8 + | +52 | VN{x: Bar}, //~ ERROR `Bar + 'static: std::marker::Sized` is not satisfied + | ^^^^^^ `Bar + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Bar + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `FooBar + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:53:15 + | +53 | VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `BarFoo + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:54:18 + | +54 | VP{u: isize, x: BarFoo}, //~ ERROR `BarFoo + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^^^ `BarFoo + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `BarFoo + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[i8]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:57:8 + | +57 | VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[i8]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[char]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:58:8 + | +58 | VR{x: <&'static [char] as Deref>::Target}, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[char]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[char]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[f64]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:60:15 + | +60 | VS(isize, <&'static [f64] as Deref>::Target), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[f64]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[i32]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:62:18 + | +62 | VT{u: isize, x: <&'static [i32] as Deref>::Target}, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i32]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[i32]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper1 + 'static: std::marker::Sized` is not satisfied in `Path1` + --> $DIR/unsized-enum2.rs:45:8 + | +45 | VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time + | + = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `PathHelper1 + 'static` + = note: required because it appears within the type `Path1` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper2 + 'static: std::marker::Sized` is not satisfied in `Path2` + --> $DIR/unsized-enum2.rs:46:8 + | +46 | VJ{x: Path2}, //~ ERROR `PathHelper2 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^^ `PathHelper2 + 'static` does not have a constant size known at compile-time + | + = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `PathHelper2 + 'static` + = note: required because it appears within the type `Path2` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper3 + 'static: std::marker::Sized` is not satisfied in `Path3` + --> $DIR/unsized-enum2.rs:47:15 + | +47 | VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time + | + = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `PathHelper3 + 'static` + = note: required because it appears within the type `Path3` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper4 + 'static: std::marker::Sized` is not satisfied in `Path4` + --> $DIR/unsized-enum2.rs:48:18 + | +48 | VL{u: isize, x: Path4}, //~ ERROR `PathHelper4 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^^ `PathHelper4 + 'static` does not have a constant size known at compile-time + | + = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `PathHelper4 + 'static` + = note: required because it appears within the type `Path4` + = note: no field of an enum variant may have a dynamically sized type + +error: aborting due to 20 previous errors + diff --git a/src/test/ui/update-all-references.sh b/src/test/ui/update-all-references.sh index ddd69c399a..bfc6f923f9 100755 --- a/src/test/ui/update-all-references.sh +++ b/src/test/ui/update-all-references.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2015 The Rust Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution and at diff --git a/src/test/ui/update-references.sh b/src/test/ui/update-references.sh index aa99d35f7a..c2c842fcc4 100755 --- a/src/test/ui/update-references.sh +++ b/src/test/ui/update-references.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2015 The Rust Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution and at @@ -46,5 +46,3 @@ while [[ "$1" != "" ]]; do cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME fi done - - diff --git a/src/test/compile-fail/use-mod.rs b/src/test/ui/use-mod.rs similarity index 69% rename from src/test/compile-fail/use-mod.rs rename to src/test/ui/use-mod.rs index 485a75f0f9..37495cd172 100644 --- a/src/test/compile-fail/use-mod.rs +++ b/src/test/ui/use-mod.rs @@ -10,14 +10,10 @@ use foo::bar::{ self, -//~^ ERROR `self` import can only appear once in the list -//~^^ NOTE previous import of the module `bar` here +//~^ ERROR `self` import can only appear once in an import list Bar, self -//~^ NOTE another `self` import appears here -//~| ERROR the name `bar` is defined multiple times -//~| NOTE `bar` reimported here -//~| NOTE `bar` must be defined only once in the type namespace of this module +//~^ ERROR the name `bar` is defined multiple times }; use {self}; diff --git a/src/test/ui/use-mod.stderr b/src/test/ui/use-mod.stderr new file mode 100644 index 0000000000..bb64909e64 --- /dev/null +++ b/src/test/ui/use-mod.stderr @@ -0,0 +1,32 @@ +error[E0430]: `self` import can only appear once in an import list + --> $DIR/use-mod.rs:12:5 + | +12 | self, + | ^^^^ can only appear once in an import list +... +15 | self + | ---- another `self` import appears here + +error[E0431]: `self` import can only appear in an import list with a non-empty prefix + --> $DIR/use-mod.rs:19:6 + | +19 | use {self}; + | ^^^^ can only appear in an import list with a non-empty prefix + +error[E0252]: the name `bar` is defined multiple times + --> $DIR/use-mod.rs:15:5 + | +12 | self, + | ---- previous import of the module `bar` here +... +15 | self + | ^^^^ `bar` reimported here + | + = note: `bar` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +15 | self as Otherbar + | + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/variadic-ffi-3.rs b/src/test/ui/variadic-ffi-3.rs similarity index 87% rename from src/test/compile-fail/variadic-ffi-3.rs rename to src/test/ui/variadic-ffi-3.rs index fb10202718..12beebc181 100644 --- a/src/test/compile-fail/variadic-ffi-3.rs +++ b/src/test/ui/variadic-ffi-3.rs @@ -19,21 +19,17 @@ extern "C" fn bar(f: isize, x: u8) {} fn main() { unsafe { foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied - //~| NOTE expected at least 2 parameters foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied - //~| NOTE expected at least 2 parameters let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~^ ERROR: mismatched types //~| expected type `unsafe extern "C" fn(isize, u8)` //~| found type `unsafe extern "C" fn(isize, u8, ...) {foo}` - //~| NOTE: expected non-variadic fn, found variadic function let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~^ ERROR: mismatched types //~| expected type `extern "C" fn(isize, u8, ...)` //~| found type `extern "C" fn(isize, u8) {bar}` - //~| NOTE: expected variadic fn, found non-variadic function foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double` foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int` diff --git a/src/test/ui/variadic-ffi-3.stderr b/src/test/ui/variadic-ffi-3.stderr new file mode 100644 index 0000000000..be158c1e39 --- /dev/null +++ b/src/test/ui/variadic-ffi-3.stderr @@ -0,0 +1,74 @@ +error[E0060]: this function takes at least 2 parameters but 0 parameters were supplied + --> $DIR/variadic-ffi-3.rs:21:9 + | +12 | fn foo(f: isize, x: u8, ...); + | ----------------------------- defined here +... +21 | foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied + | ^^^^^ expected at least 2 parameters + +error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied + --> $DIR/variadic-ffi-3.rs:22:9 + | +12 | fn foo(f: isize, x: u8, ...); + | ----------------------------- defined here +... +22 | foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied + | ^^^^^^ expected at least 2 parameters + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-3.rs:24:56 + | +24 | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; + | ^^^ expected non-variadic fn, found variadic function + | + = note: expected type `unsafe extern "C" fn(isize, u8)` + found type `unsafe extern "C" fn(isize, u8, ...) {foo}` + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-3.rs:29:54 + | +29 | let y: extern "C" fn(f: isize, x: u8, ...) = bar; + | ^^^ expected variadic fn, found non-variadic function + | + = note: expected type `extern "C" fn(isize, u8, ...)` + found type `extern "C" fn(isize, u8) {bar}` + +error[E0617]: can't pass `f32` to variadic function, cast to `c_double` + --> $DIR/variadic-ffi-3.rs:34:19 + | +34 | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double` + | ^^^^ + +error[E0617]: can't pass `bool` to variadic function, cast to `c_int` + --> $DIR/variadic-ffi-3.rs:35:19 + | +35 | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int` + | ^^^^ + +error[E0617]: can't pass `i8` to variadic function, cast to `c_int` + --> $DIR/variadic-ffi-3.rs:36:19 + | +36 | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function, cast to `c_int` + | ^^^ + +error[E0617]: can't pass `u8` to variadic function, cast to `c_uint` + --> $DIR/variadic-ffi-3.rs:37:19 + | +37 | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function, cast to `c_uint` + | ^^^ + +error[E0617]: can't pass `i16` to variadic function, cast to `c_int` + --> $DIR/variadic-ffi-3.rs:38:19 + | +38 | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function, cast to `c_int` + | ^^^^ + +error[E0617]: can't pass `u16` to variadic function, cast to `c_uint` + --> $DIR/variadic-ffi-3.rs:39:19 + | +39 | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function, cast to `c_uint` + | ^^^^ + +error: aborting due to 10 previous errors + diff --git a/src/test/compile-fail/variance-unused-type-param.rs b/src/test/ui/variance-unused-type-param.rs similarity index 93% rename from src/test/compile-fail/variance-unused-type-param.rs rename to src/test/ui/variance-unused-type-param.rs index 862d842d62..a5f6fd2fda 100644 --- a/src/test/compile-fail/variance-unused-type-param.rs +++ b/src/test/ui/variance-unused-type-param.rs @@ -15,16 +15,13 @@ struct SomeStruct<A> { x: u32 } //~^ ERROR parameter `A` is never used -//~| HELP PhantomData enum SomeEnum<A> { Nothing } //~^ ERROR parameter `A` is never used -//~| HELP PhantomData // Here T might *appear* used, but in fact it isn't. enum ListCell<T> { //~^ ERROR parameter `T` is never used -//~| HELP PhantomData Cons(Box<ListCell<T>>), Nil } diff --git a/src/test/ui/variance-unused-type-param.stderr b/src/test/ui/variance-unused-type-param.stderr new file mode 100644 index 0000000000..0b07ac38cb --- /dev/null +++ b/src/test/ui/variance-unused-type-param.stderr @@ -0,0 +1,26 @@ +error[E0392]: parameter `A` is never used + --> $DIR/variance-unused-type-param.rs:16:19 + | +16 | struct SomeStruct<A> { x: u32 } + | ^ unused type parameter + | + = help: consider removing `A` or using a marker such as `std::marker::PhantomData` + +error[E0392]: parameter `A` is never used + --> $DIR/variance-unused-type-param.rs:19:15 + | +19 | enum SomeEnum<A> { Nothing } + | ^ unused type parameter + | + = help: consider removing `A` or using a marker such as `std::marker::PhantomData` + +error[E0392]: parameter `T` is never used + --> $DIR/variance-unused-type-param.rs:23:15 + | +23 | enum ListCell<T> { + | ^ unused type parameter + | + = help: consider removing `T` or using a marker such as `std::marker::PhantomData` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/ui/vector-no-ann.rs similarity index 86% rename from src/test/compile-fail/vector-no-ann.rs rename to src/test/ui/vector-no-ann.rs index de229ded46..2143d2b64c 100644 --- a/src/test/compile-fail/vector-no-ann.rs +++ b/src/test/ui/vector-no-ann.rs @@ -12,6 +12,4 @@ fn main() { let _foo = Vec::new(); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` - //~| NOTE consider giving `_foo` a type } diff --git a/src/test/ui/vector-no-ann.stderr b/src/test/ui/vector-no-ann.stderr new file mode 100644 index 0000000000..e788ea125a --- /dev/null +++ b/src/test/ui/vector-no-ann.stderr @@ -0,0 +1,10 @@ +error[E0282]: type annotations needed + --> $DIR/vector-no-ann.rs:13:16 + | +13 | let _foo = Vec::new(); + | ---- ^^^^^^^^ cannot infer type for `T` + | | + | consider giving `_foo` a type + +error: aborting due to previous error + diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 524ba7908b..fc2759df44 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -46,8 +46,9 @@ static HOSTS: &'static [&'static str] = &[ static TARGETS: &'static [&'static str] = &[ "aarch64-apple-ios", - "aarch64-unknown-fuchsia", "aarch64-linux-android", + "aarch64-unknown-cloudabi", + "aarch64-unknown-fuchsia", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "arm-linux-androideabi", @@ -55,8 +56,10 @@ static TARGETS: &'static [&'static str] = &[ "arm-unknown-linux-gnueabihf", "arm-unknown-linux-musleabi", "arm-unknown-linux-musleabihf", + "armv5te-unknown-linux-gnueabi", "armv7-apple-ios", "armv7-linux-androideabi", + "armv7-unknown-cloudabi-eabihf", "armv7-unknown-linux-gnueabihf", "armv7-unknown-linux-musleabihf", "armv7s-apple-ios", @@ -68,6 +71,7 @@ static TARGETS: &'static [&'static str] = &[ "i686-linux-android", "i686-pc-windows-gnu", "i686-pc-windows-msvc", + "i686-unknown-cloudabi", "i686-unknown-freebsd", "i686-unknown-linux-gnu", "i686-unknown-linux-musl", @@ -84,13 +88,15 @@ static TARGETS: &'static [&'static str] = &[ "sparc64-unknown-linux-gnu", "sparcv9-sun-solaris", "wasm32-unknown-emscripten", - "x86_64-linux-android", + "wasm32-unknown-unknown", "x86_64-apple-darwin", "x86_64-apple-ios", + "x86_64-linux-android", "x86_64-pc-windows-gnu", "x86_64-pc-windows-msvc", "x86_64-rumprun-netbsd", "x86_64-sun-solaris", + "x86_64-unknown-cloudabi", "x86_64-unknown-freebsd", "x86_64-unknown-fuchsia", "x86_64-unknown-linux-gnu", diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs index a6c56a1307..d04231bbac 100644 --- a/src/tools/cargotest/main.rs +++ b/src/tools/cargotest/main.rs @@ -61,7 +61,7 @@ const TEST_REPOS: &'static [Test] = &[ Test { name: "servo", repo: "https://github.com/servo/servo", - sha: "38fe9533b93e985657f99a29772bf3d3c8694822", + sha: "17e97b9320fdb7cdb33bbc5f4d0fde0653bbf2e4", lock: None, // Only test Stylo a.k.a. Quantum CSS, the parts of Servo going into Firefox. // This takes much less time to build than all of Servo and supports stable Rust. diff --git a/src/tools/clippy/CHANGELOG.md b/src/tools/clippy/CHANGELOG.md index 60a42ac1f9..25fcaf9d2d 100644 --- a/src/tools/clippy/CHANGELOG.md +++ b/src/tools/clippy/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log All notable changes to this project will be documented in this file. +## 0.0.174 +* Rustup to *rustc 1.23.0-nightly (63739ab7b 2017-11-21)* + +## 0.0.173 +* Rustup to *rustc 1.23.0-nightly (33374fa9d 2017-11-20)* + +## 0.0.172 +* Rustup to *rustc 1.23.0-nightly (d0f8e2913 2017-11-16)* + ## 0.0.171 * Rustup to *rustc 1.23.0-nightly (ff0f5de3b 2017-11-14)* @@ -535,6 +544,7 @@ All notable changes to this project will be documented in this file. [`filter_next`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#filter_next [`float_arithmetic`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#float_arithmetic [`float_cmp`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#float_cmp +[`float_cmp_const`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#float_cmp_const [`for_kv_map`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#for_kv_map [`for_loop_over_option`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#for_loop_over_option [`for_loop_over_result`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#for_loop_over_result diff --git a/src/tools/clippy/CONTRIBUTING.md b/src/tools/clippy/CONTRIBUTING.md index 81618aaceb..c5dcec2167 100644 --- a/src/tools/clippy/CONTRIBUTING.md +++ b/src/tools/clippy/CONTRIBUTING.md @@ -70,8 +70,9 @@ Please document your lint with a doc comment akin to the following: Clippy uses UI tests. UI tests check that the output of the compiler is exactly as expected. Of course there's little sense in writing the output yourself or copying it around. -Therefore you can simply run `tests/ui/update-all-references.sh` and check whether -the output looks as you expect with `git diff`. Commit all `*.stderr` files, too. +Therefore you can simply run `tests/ui/update-all-references.sh` (after running +`cargo test`) and check whether the output looks as you expect with `git diff`. Commit all +`*.stderr` files, too. ### Testing manually diff --git a/src/tools/clippy/Cargo.toml b/src/tools/clippy/Cargo.toml index a022264985..7bdb619e8d 100644 --- a/src/tools/clippy/Cargo.toml +++ b/src/tools/clippy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.171" +version = "0.0.174" authors = [ "Manish Goregaokar <manishsmail@gmail.com>", "Andre Bogus <bogusandre@gmail.com>", @@ -37,7 +37,7 @@ path = "src/driver.rs" [dependencies] # begin automatic update -clippy_lints = { version = "0.0.171", path = "clippy_lints" } +clippy_lints = { version = "0.0.174", path = "clippy_lints" } # end automatic update cargo_metadata = "0.2" regex = "0.2" diff --git a/src/tools/clippy/README.md b/src/tools/clippy/README.md index 52c1905c7a..82f1908bb2 100644 --- a/src/tools/clippy/README.md +++ b/src/tools/clippy/README.md @@ -3,7 +3,7 @@ [![Build Status](https://travis-ci.org/rust-lang-nursery/rust-clippy.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/rust-clippy) [![Windows build status](https://ci.appveyor.com/api/projects/status/github/rust-lang-nursery/rust-clippy?svg=true)](https://ci.appveyor.com/project/rust-lang-nursery/rust-clippy) [![Current Version](http://meritbadge.herokuapp.com/clippy)](https://crates.io/crates/clippy) -[![License: MPL-2.0](https://img.shields.io/crates/l/clippy.svg)](#License) +[![License: MPL-2.0](https://img.shields.io/crates/l/clippy.svg)](#license) A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code. diff --git a/src/tools/clippy/clippy_lints/Cargo.toml b/src/tools/clippy/clippy_lints/Cargo.toml index 94f4621987..4c88cc0c07 100644 --- a/src/tools/clippy/clippy_lints/Cargo.toml +++ b/src/tools/clippy/clippy_lints/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clippy_lints" # begin automatic update -version = "0.0.171" +version = "0.0.174" # end automatic update authors = [ "Manish Goregaokar <manishsmail@gmail.com>", diff --git a/src/tools/clippy/clippy_lints/src/booleans.rs b/src/tools/clippy/clippy_lints/src/booleans.rs index 9310cca4ae..50afd1b1e4 100644 --- a/src/tools/clippy/clippy_lints/src/booleans.rs +++ b/src/tools/clippy/clippy_lints/src/booleans.rs @@ -159,134 +159,115 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> { } } -// The boolean part of the return indicates whether some simplifications have been applied. -fn suggest(cx: &LateContext, suggestion: &Bool, terminals: &[&Expr]) -> (String, bool) { - fn recurse( - brackets: bool, - cx: &LateContext, - suggestion: &Bool, - terminals: &[&Expr], - mut s: String, - simplified: &mut bool, - ) -> String { +struct SuggestContext<'a, 'tcx: 'a, 'v> { + terminals: &'v [&'v Expr], + cx: &'a LateContext<'a, 'tcx>, + output: String, + simplified: bool, +} + +impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> { + fn snip(&self, e: &Expr) -> Option<String> { + snippet_opt(self.cx, e.span) + } + + fn simplify_not(&self, expr: &Expr) -> Option<String> { + match expr.node { + ExprBinary(binop, ref lhs, ref rhs) => { + match binop.node { + BiEq => Some(" != "), + BiNe => Some(" == "), + BiLt => Some(" >= "), + BiGt => Some(" <= "), + BiLe => Some(" > "), + BiGe => Some(" < "), + _ => None, + }.and_then(|op| Some(format!("{}{}{}", self.snip(lhs)?, op, self.snip(rhs)?))) + }, + ExprMethodCall(ref path, _, ref args) if args.len() == 1 => { + METHODS_WITH_NEGATION + .iter().cloned() + .flat_map(|(a, b)| vec![(a, b), (b, a)]) + .find(|&(a, _)| a == path.name.as_str()) + .and_then(|(_, neg_method)| Some(format!("{}.{}()", self.snip(&args[0])?, neg_method))) + }, + _ => None, + } + } + + fn recurse(&mut self, suggestion: &Bool) -> Option<()> { use quine_mc_cluskey::Bool::*; - let snip = |e: &Expr| snippet_opt(cx, e.span).expect("don't try to improve booleans created by macros"); match *suggestion { True => { - s.push_str("true"); - s + self.output.push_str("true"); }, False => { - s.push_str("false"); - s + self.output.push_str("false"); }, Not(ref inner) => match **inner { And(_) | Or(_) => { - s.push('!'); - recurse(true, cx, inner, terminals, s, simplified) + self.output.push('!'); + self.output.push('('); + self.recurse(inner); + self.output.push(')'); }, - Term(n) => match terminals[n as usize].node { - ExprBinary(binop, ref lhs, ref rhs) => { - let op = match binop.node { - BiEq => " != ", - BiNe => " == ", - BiLt => " >= ", - BiGt => " <= ", - BiLe => " > ", - BiGe => " < ", - _ => { - s.push('!'); - return recurse(true, cx, inner, terminals, s, simplified); - }, - }; - *simplified = true; - s.push_str(&snip(lhs)); - s.push_str(op); - s.push_str(&snip(rhs)); - s - }, - ExprMethodCall(ref path, _, ref args) if args.len() == 1 => { - let negation = METHODS_WITH_NEGATION - .iter().cloned() - .flat_map(|(a, b)| vec![(a, b), (b, a)]) - .find(|&(a, _)| a == path.name.as_str()); - if let Some((_, negation_method)) = negation { - *simplified = true; - s.push_str(&snip(&args[0])); - s.push('.'); - s.push_str(negation_method); - s.push_str("()"); - s - } else { - s.push('!'); - recurse(false, cx, inner, terminals, s, simplified) - } - }, - _ => { - s.push('!'); - recurse(false, cx, inner, terminals, s, simplified) - }, + Term(n) => { + let terminal = self.terminals[n as usize]; + if let Some(str) = self.simplify_not(terminal) { + self.simplified = true; + self.output.push_str(&str) + } else { + self.output.push('!'); + let snip = self.snip(terminal)?; + self.output.push_str(&snip); + } }, - _ => { - s.push('!'); - recurse(false, cx, inner, terminals, s, simplified) + True | False | Not(_) => { + self.output.push('!'); + self.recurse(inner)?; }, }, And(ref v) => { - if brackets { - s.push('('); - } - if let Or(_) = v[0] { - s = recurse(true, cx, &v[0], terminals, s, simplified); - } else { - s = recurse(false, cx, &v[0], terminals, s, simplified); - } - for inner in &v[1..] { - s.push_str(" && "); + for (index, inner) in v.iter().enumerate() { + if index > 0 { + self.output.push_str(" && "); + } if let Or(_) = *inner { - s = recurse(true, cx, inner, terminals, s, simplified); + self.output.push('('); + self.recurse(inner); + self.output.push(')'); } else { - s = recurse(false, cx, inner, terminals, s, simplified); + self.recurse(inner); } } - if brackets { - s.push(')'); - } - s }, Or(ref v) => { - if brackets { - s.push('('); + for (index, inner) in v.iter().enumerate() { + if index > 0 { + self.output.push_str(" || "); + } + self.recurse(inner); } - s = recurse(false, cx, &v[0], terminals, s, simplified); - for inner in &v[1..] { - s.push_str(" || "); - s = recurse(false, cx, inner, terminals, s, simplified); - } - if brackets { - s.push(')'); - } - s }, Term(n) => { - if brackets { - if let ExprBinary(..) = terminals[n as usize].node { - s.push('('); - } - } - s.push_str(&snip(terminals[n as usize])); - if brackets { - if let ExprBinary(..) = terminals[n as usize].node { - s.push(')'); - } - } - s + let snip = self.snip(self.terminals[n as usize])?; + self.output.push_str(&snip); }, } + Some(()) } - let mut simplified = false; - let s = recurse(false, cx, suggestion, terminals, String::new(), &mut simplified); - (s, simplified) +} + +// The boolean part of the return indicates whether some simplifications have been applied. +fn suggest(cx: &LateContext, suggestion: &Bool, terminals: &[&Expr]) -> (String, bool) { + let mut suggest_context = SuggestContext { + terminals: terminals, + cx: cx, + output: String::new(), + simplified: false, + }; + suggest_context.recurse(suggestion); + (suggest_context.output, suggest_context.simplified) } fn simple_negate(b: Bool) -> Bool { diff --git a/src/tools/clippy/clippy_lints/src/const_static_lifetime.rs b/src/tools/clippy/clippy_lints/src/const_static_lifetime.rs index 6ee4dad7db..69a4c0ae88 100644 --- a/src/tools/clippy/clippy_lints/src/const_static_lifetime.rs +++ b/src/tools/clippy/clippy_lints/src/const_static_lifetime.rs @@ -48,20 +48,23 @@ impl StaticConst { TyKind::Rptr(ref optional_lifetime, ref borrow_type) => { // Match the 'static lifetime if let Some(lifetime) = *optional_lifetime { - if let TyKind::Path(_, _) = borrow_type.ty.node { - // Verify that the path is a str - if lifetime.ident.name == "'static" { - let mut sug: String = String::new(); - span_lint_and_then( - cx, - CONST_STATIC_LIFETIME, - lifetime.span, - "Constants have by default a `'static` lifetime", - |db| { - db.span_suggestion(lifetime.span, "consider removing `'static`", sug); - }, - ); + match borrow_type.ty.node { + TyKind::Path(..) | TyKind::Slice(..) | TyKind::Array(..) | + TyKind::Tup(..) => { + if lifetime.ident.name == "'static" { + let mut sug: String = String::new(); + span_lint_and_then( + cx, + CONST_STATIC_LIFETIME, + lifetime.span, + "Constants have by default a `'static` lifetime", + |db| { + db.span_suggestion(lifetime.span, "consider removing `'static`", sug); + }, + ); + } } + _ => {} } } self.visit_type(&*borrow_type.ty, cx); diff --git a/src/tools/clippy/clippy_lints/src/consts.rs b/src/tools/clippy/clippy_lints/src/consts.rs index 7e6f3c2acf..69527ba6ff 100644 --- a/src/tools/clippy/clippy_lints/src/consts.rs +++ b/src/tools/clippy/clippy_lints/src/consts.rs @@ -74,9 +74,8 @@ impl PartialEq for Constant { } }, (&Constant::Bool(l), &Constant::Bool(r)) => l == r, - (&Constant::Vec(ref l), &Constant::Vec(ref r)) => l == r, + (&Constant::Vec(ref l), &Constant::Vec(ref r)) | (&Constant::Tuple(ref l), &Constant::Tuple(ref r)) => l == r, (&Constant::Repeat(ref lv, ref ls), &Constant::Repeat(ref rv, ref rs)) => ls == rs && lv == rv, - (&Constant::Tuple(ref l), &Constant::Tuple(ref r)) => l == r, _ => false, // TODO: Are there inter-type equalities? } } diff --git a/src/tools/clippy/clippy_lints/src/copies.rs b/src/tools/clippy/clippy_lints/src/copies.rs index 862272456e..5a693ce552 100644 --- a/src/tools/clippy/clippy_lints/src/copies.rs +++ b/src/tools/clippy/clippy_lints/src/copies.rs @@ -203,14 +203,10 @@ fn lint_match_arms(cx: &LateContext, expr: &Expr) { db.span_note(i.body.span, "same as this"); // Note: this does not use `span_suggestion` on purpose: there is no clean way - // to - // remove the other arm. Building a span and suggest to replace it to "" makes - // an - // even more confusing error message. Also in order not to make up a span for - // the - // whole pattern, the suggestion is only shown when there is only one pattern. - // The - // user should know about `|` if they are already using it… + // to remove the other arm. Building a span and suggest to replace it to "" + // makes an even more confusing error message. Also in order not to make up a + // span for the whole pattern, the suggestion is only shown when there is only + // one pattern. The user should know about `|` if they are already using it… if i.pats.len() == 1 && j.pats.len() == 1 { let lhs = snippet(cx, i.pats[0].span, "<pat1>"); @@ -329,10 +325,13 @@ where for expr in exprs { match map.entry(hash(expr)) { - Entry::Occupied(o) => for o in o.get() { - if eq(o, expr) { - return Some((o, expr)); + Entry::Occupied(mut o) => { + for o in o.get() { + if eq(o, expr) { + return Some((o, expr)); + } } + o.get_mut().push(expr); }, Entry::Vacant(v) => { v.insert(vec![expr]); diff --git a/src/tools/clippy/clippy_lints/src/doc.rs b/src/tools/clippy/clippy_lints/src/doc.rs index b6542b2ebc..ea8ecb91d0 100644 --- a/src/tools/clippy/clippy_lints/src/doc.rs +++ b/src/tools/clippy/clippy_lints/src/doc.rs @@ -206,8 +206,7 @@ fn check_doc<'a, Events: Iterator<Item = (usize, pulldown_cmark::Event<'a>)>>( End(Link(_, _)) => in_link = None, Start(_tag) | End(_tag) => (), // We don't care about other tags Html(_html) | InlineHtml(_html) => (), // HTML is weird, just ignore it - SoftBreak => (), - HardBreak => (), + SoftBreak | HardBreak => (), FootnoteReference(text) | Text(text) => { if Some(&text) == in_link.as_ref() { // Probably a link of the form `<http://example.com>` diff --git a/src/tools/clippy/clippy_lints/src/enum_variants.rs b/src/tools/clippy/clippy_lints/src/enum_variants.rs index ea7a378de2..b3dd275f66 100644 --- a/src/tools/clippy/clippy_lints/src/enum_variants.rs +++ b/src/tools/clippy/clippy_lints/src/enum_variants.rs @@ -264,8 +264,17 @@ impl EarlyLintPass for EnumVariantNames { let matching = partial_match(mod_camel, &item_camel); let rmatching = partial_rmatch(mod_camel, &item_camel); let nchars = mod_camel.chars().count(); + + let is_word_beginning = |c: char| { + c == '_' || c.is_uppercase() || c.is_numeric() + }; + if matching == nchars { - span_lint(cx, STUTTER, item.span, "item name starts with its containing module's name"); + match item_camel.chars().nth(nchars) { + Some(c) if is_word_beginning(c) => + span_lint(cx, STUTTER, item.span, "item name starts with its containing module's name"), + _ => () + } } if rmatching == nchars { span_lint(cx, STUTTER, item.span, "item name ends with its containing module's name"); diff --git a/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs b/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs index 0c91d0cd97..5b9830ad0a 100644 --- a/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs +++ b/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs @@ -2,7 +2,7 @@ use rustc::lint::*; use rustc::hir; use rustc::ty; use syntax_pos::Span; -use utils::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty}; +use utils::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_expn_of}; use utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT}; /// **What it does:** Checks for impls of `From<..>` that contain `panic!()` or `unwrap()` @@ -66,6 +66,7 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it if let ExprPath(QPath::Resolved(_, ref path)) = func_expr.node; if match_def_path(self.tcx, path.def.def_id(), &BEGIN_PANIC) || match_def_path(self.tcx, path.def.def_id(), &BEGIN_PANIC_FMT); + if is_expn_of(expr.span, "unreachable").is_none(); then { self.result.push(expr.span); } diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index b53b34b3b2..6ceb6176bd 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -367,6 +367,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) { arithmetic::INTEGER_ARITHMETIC, array_indexing::INDEXING_SLICING, assign_ops::ASSIGN_OPS, + misc::FLOAT_CMP_CONST, ]); reg.register_lint_group("clippy_pedantic", vec![ diff --git a/src/tools/clippy/clippy_lints/src/lifetimes.rs b/src/tools/clippy/clippy_lints/src/lifetimes.rs index 90c532f074..280e504d88 100644 --- a/src/tools/clippy/clippy_lints/src/lifetimes.rs +++ b/src/tools/clippy/clippy_lints/src/lifetimes.rs @@ -325,8 +325,14 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> { TyPath(ref path) => { self.collect_anonymous_lifetimes(path, ty); }, - TyImplTraitExistential(ref param_bounds) | - TyImplTraitUniversal(_, ref param_bounds) => for bound in param_bounds { + TyImplTraitExistential(ref exist_ty, _) => { + for bound in &exist_ty.bounds { + if let RegionTyParamBound(_) = *bound { + self.record(&None); + } + } + } + TyImplTraitUniversal(_, ref param_bounds) => for bound in param_bounds { if let RegionTyParamBound(_) = *bound { self.record(&None); } diff --git a/src/tools/clippy/clippy_lints/src/loops.rs b/src/tools/clippy/clippy_lints/src/loops.rs index babf3d3cc1..dfdbe97cef 100644 --- a/src/tools/clippy/clippy_lints/src/loops.rs +++ b/src/tools/clippy/clippy_lints/src/loops.rs @@ -1668,7 +1668,9 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> { self.visit_expr(expr); }, ExprCall(ref f, ref args) => { - for (ty, expr) in self.cx.tables.expr_ty(f).fn_sig(self.cx.tcx).inputs().skip_binder().iter().zip(args) { + self.visit_expr(f); + for expr in args { + let ty = self.cx.tables.expr_ty_adjusted(expr); self.prefer_mutable = false; if let ty::TyRef(_, mutbl) = ty.sty { if mutbl.mutbl == MutMutable { diff --git a/src/tools/clippy/clippy_lints/src/methods.rs b/src/tools/clippy/clippy_lints/src/methods.rs index ee61920b48..4a52df92b2 100644 --- a/src/tools/clippy/clippy_lints/src/methods.rs +++ b/src/tools/clippy/clippy_lints/src/methods.rs @@ -7,6 +7,7 @@ use rustc::ty::subst::Substs; use rustc_const_eval::ConstContext; use std::borrow::Cow; use std::fmt; +use std::iter; use syntax::ast; use syntax::codemap::Span; use utils::{get_trait_def_id, implements_trait, in_external_macro, in_macro, is_copy, is_self, is_self_ty, @@ -944,7 +945,7 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir: fn lint_clone_on_copy(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr, arg_ty: Ty) { let ty = cx.tables.expr_ty(expr); if let ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) = arg_ty.sty { - if let ty::TyRef(..) = inner.sty { + if let ty::TyRef(_, ty::TypeAndMut { ty: innermost, .. }) = inner.sty { span_lint_and_then( cx, CLONE_DOUBLE_REF, @@ -952,7 +953,17 @@ fn lint_clone_on_copy(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr, arg_t "using `clone` on a double-reference; \ this will copy the reference instead of cloning the inner type", |db| if let Some(snip) = sugg::Sugg::hir_opt(cx, arg) { - db.span_suggestion(expr.span, "try dereferencing it", format!("({}).clone()", snip.deref())); + let mut ty = innermost; + let mut n = 0; + while let ty::TyRef(_, ty::TypeAndMut { ty: inner, .. }) = ty.sty { + ty = inner; + n += 1; + } + let refs: String = iter::repeat('&').take(n + 1).collect(); + let derefs: String = iter::repeat('*').take(n).collect(); + let explicit = format!("{}{}::clone({})", refs, ty, snip); + db.span_suggestion(expr.span, "try dereferencing it", format!("{}({}{}).clone()", refs, derefs, snip.deref())); + db.span_suggestion(expr.span, "or try being explicit about what type to clone", explicit); }, ); return; // don't report clone_on_copy @@ -960,13 +971,40 @@ fn lint_clone_on_copy(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr, arg_t } if is_copy(cx, ty) { - span_lint_and_then(cx, CLONE_ON_COPY, expr.span, "using `clone` on a `Copy` type", |db| { - if let Some(snip) = sugg::Sugg::hir_opt(cx, arg) { - if let ty::TyRef(..) = cx.tables.expr_ty(arg).sty { - db.span_suggestion(expr.span, "try dereferencing it", format!("{}", snip.deref())); - } else { - db.span_suggestion(expr.span, "try removing the `clone` call", format!("{}", snip)); + let snip; + if let Some(snippet) = sugg::Sugg::hir_opt(cx, arg) { + if let ty::TyRef(..) = cx.tables.expr_ty(arg).sty { + let parent = cx.tcx.hir.get_parent_node(expr.id); + match cx.tcx.hir.get(parent) { + hir::map::NodeExpr(parent) => match parent.node { + // &*x is a nop, &x.clone() is not + hir::ExprAddrOf(..) | + // (*x).func() is useless, x.clone().func() can work in case func borrows mutably + hir::ExprMethodCall(..) => return, + _ => {}, + } + hir::map::NodeStmt(stmt) => { + if let hir::StmtDecl(ref decl, _) = stmt.node { + if let hir::DeclLocal(ref loc) = decl.node { + if let hir::PatKind::Ref(..) = loc.pat.node { + // let ref y = *x borrows x, let ref y = x.clone() does not + return; + } + } + } + }, + _ => {}, } + snip = Some(("try dereferencing it", format!("{}", snippet.deref()))); + } else { + snip = Some(("try removing the `clone` call", format!("{}", snippet))); + } + } else { + snip = None; + } + span_lint_and_then(cx, CLONE_ON_COPY, expr.span, "using `clone` on a `Copy` type", |db| { + if let Some((text, snip)) = snip { + db.span_suggestion(expr.span, text, snip); } }); } diff --git a/src/tools/clippy/clippy_lints/src/misc.rs b/src/tools/clippy/clippy_lints/src/misc.rs index e1d350a9ad..c9c404c174 100644 --- a/src/tools/clippy/clippy_lints/src/misc.rs +++ b/src/tools/clippy/clippy_lints/src/misc.rs @@ -13,6 +13,7 @@ use utils::{get_item_name, get_parent_expr, implements_trait, in_constant, in_ma span_lint_and_then, walk_ptrs_ty}; use utils::sugg::Sugg; use syntax::ast::{FloatTy, LitKind, CRATE_NODE_ID}; +use consts::constant; /// **What it does:** Checks for function arguments and let bindings denoted as /// `ref`. @@ -200,6 +201,27 @@ declare_lint! { "using 0 as *{const, mut} T" } +/// **What it does:** Checks for (in-)equality comparisons on floating-point +/// value and constant, except in functions called `*eq*` (which probably +/// implement equality for a type involving floats). +/// +/// **Why is this bad?** Floating point calculations are usually imprecise, so +/// asking if two values are *exactly* equal is asking for trouble. For a good +/// guide on what to do, see [the floating point +/// guide](http://www.floating-point-gui.de/errors/comparison). +/// +/// **Known problems:** None. +/// +/// **Example:** +/// ```rust +/// const ONE == 1.00f64 +/// x == ONE // where both are floats +/// ``` +declare_restriction_lint! { + pub FLOAT_CMP_CONST, + "using `==` or `!=` on float constants instead of comparing difference with an epsilon" +} + #[derive(Copy, Clone)] pub struct Pass; @@ -214,7 +236,8 @@ impl LintPass for Pass { REDUNDANT_PATTERN, USED_UNDERSCORE_BINDING, SHORT_CIRCUIT_STATEMENT, - ZERO_PTR + ZERO_PTR, + FLOAT_CMP_CONST ) } } @@ -334,7 +357,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { return; } } - span_lint_and_then(cx, FLOAT_CMP, expr.span, "strict comparison of f32 or f64", |db| { + let (lint, msg) = if is_named_constant(cx, left) || is_named_constant(cx, right) { + (FLOAT_CMP_CONST, "strict comparison of f32 or f64 constant") + } else { + (FLOAT_CMP, "strict comparison of f32 or f64") + }; + span_lint_and_then(cx, lint, expr.span, msg, |db| { let lhs = Sugg::hir(cx, left, ".."); let rhs = Sugg::hir(cx, right, ".."); @@ -423,6 +451,14 @@ fn check_nan(cx: &LateContext, path: &Path, expr: &Expr) { } } +fn is_named_constant<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -> bool { + if let Some((_, res)) = constant(cx, expr) { + res + } else { + false + } +} + fn is_allowed<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -> bool { let parent_item = cx.tcx.hir.get_parent(expr.id); let parent_def_id = cx.tcx.hir.local_def_id(parent_item); diff --git a/src/tools/clippy/clippy_lints/src/new_without_default.rs b/src/tools/clippy/clippy_lints/src/new_without_default.rs index d56833eb45..b281fd3060 100644 --- a/src/tools/clippy/clippy_lints/src/new_without_default.rs +++ b/src/tools/clippy/clippy_lints/src/new_without_default.rs @@ -1,9 +1,7 @@ -use rustc::hir::intravisit::FnKind; use rustc::hir::def_id::DefId; use rustc::hir; use rustc::lint::*; use rustc::ty::{self, Ty}; -use syntax::ast; use syntax::codemap::Span; use utils::paths; use utils::{get_trait_def_id, implements_trait, in_external_macro, return_ty, same_tys, span_lint_and_then}; @@ -90,66 +88,62 @@ impl LintPass for NewWithoutDefault { } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault { - fn check_fn( - &mut self, - cx: &LateContext<'a, 'tcx>, - kind: FnKind<'tcx>, - decl: &'tcx hir::FnDecl, - _: &'tcx hir::Body, - span: Span, - id: ast::NodeId, - ) { - if in_external_macro(cx, span) { - return; - } - - if let FnKind::Method(name, sig, _, _) = kind { - if sig.constness == hir::Constness::Const { - // can't be implemented by default - return; - } - if !cx.generics - .expect("method must have generics") - .ty_params - .is_empty() - { - // when the result of `new()` depends on a type parameter we should not require - // an - // impl of `Default` - return; - } - if decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) { - let self_ty = cx.tcx - .type_of(cx.tcx.hir.local_def_id(cx.tcx.hir.get_parent(id))); - if_chain! { - if same_tys(cx, self_ty, return_ty(cx, id)); - if let Some(default_trait_id) = get_trait_def_id(cx, &paths::DEFAULT_TRAIT); - if !implements_trait(cx, self_ty, default_trait_id, &[]); - then { - if let Some(sp) = can_derive_default(self_ty, cx, default_trait_id) { - span_lint_and_then( - cx, - NEW_WITHOUT_DEFAULT_DERIVE, - span, - &format!("you should consider deriving a `Default` implementation for `{}`", self_ty), - |db| { - db.suggest_item_with_attr(cx, sp, "try this", "#[derive(Default)]"); - }); - } else { - span_lint_and_then( - cx, - NEW_WITHOUT_DEFAULT, - span, - &format!("you should consider adding a `Default` implementation for `{}`", self_ty), - |db| { - db.suggest_prepend_item( - cx, - span, - "try this", - &create_new_without_default_suggest_msg(self_ty), - ); - }, - ); + fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) { + if let hir::ItemImpl(_, _, _, _, None, _, ref items) = item.node { + for assoc_item in items { + if let hir::AssociatedItemKind::Method { has_self: false } = assoc_item.kind { + let impl_item = cx.tcx.hir.impl_item(assoc_item.id); + if in_external_macro(cx, impl_item.span) { + return; + } + if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node { + let name = impl_item.name; + let id = impl_item.id; + if sig.constness == hir::Constness::Const { + // can't be implemented by default + return; + } + if !impl_item.generics.ty_params.is_empty() { + // when the result of `new()` depends on a type parameter we should not require + // an + // impl of `Default` + return; + } + if sig.decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) { + let self_ty = cx.tcx + .type_of(cx.tcx.hir.local_def_id(cx.tcx.hir.get_parent(id))); + if_chain! { + if same_tys(cx, self_ty, return_ty(cx, id)); + if let Some(default_trait_id) = get_trait_def_id(cx, &paths::DEFAULT_TRAIT); + if !implements_trait(cx, self_ty, default_trait_id, &[]); + then { + if let Some(sp) = can_derive_default(self_ty, cx, default_trait_id) { + span_lint_and_then( + cx, + NEW_WITHOUT_DEFAULT_DERIVE, + impl_item.span, + &format!("you should consider deriving a `Default` implementation for `{}`", self_ty), + |db| { + db.suggest_item_with_attr(cx, sp, "try this", "#[derive(Default)]"); + }); + } else { + span_lint_and_then( + cx, + NEW_WITHOUT_DEFAULT, + impl_item.span, + &format!("you should consider adding a `Default` implementation for `{}`", self_ty), + |db| { + db.suggest_prepend_item( + cx, + item.span, + "try this", + &create_new_without_default_suggest_msg(self_ty), + ); + }, + ); + } + } + } } } } diff --git a/src/tools/clippy/clippy_lints/src/utils/conf.rs b/src/tools/clippy/clippy_lints/src/utils/conf.rs index 83413ae8b4..31ed71695c 100644 --- a/src/tools/clippy/clippy_lints/src/utils/conf.rs +++ b/src/tools/clippy/clippy_lints/src/utils/conf.rs @@ -157,7 +157,7 @@ define_Conf! { "JavaScript", "NaN", "OAuth", - "OpenGL", "OpenSSH", "OpenSSL", + "OpenGL", "OpenSSH", "OpenSSL", "OpenStreetMap", "TrueType", "iOS", "macOS", "TeX", "LaTeX", "BibTeX", "BibLaTeX", diff --git a/src/tools/clippy/clippy_lints/src/utils/mod.rs b/src/tools/clippy/clippy_lints/src/utils/mod.rs index 8571e5bb56..77c70922db 100644 --- a/src/tools/clippy/clippy_lints/src/utils/mod.rs +++ b/src/tools/clippy/clippy_lints/src/utils/mod.rs @@ -9,6 +9,7 @@ use rustc::lint::{LateContext, Level, Lint, LintContext}; use rustc::session::Session; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt}; +use rustc::ty::layout::LayoutOf; use rustc_errors; use std::borrow::Cow; use std::env; @@ -1021,9 +1022,9 @@ pub fn is_try(expr: &Expr) -> Option<&Expr> { } pub fn type_size<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> Option<u64> { - ty.layout(cx.tcx, cx.param_env) + (cx.tcx, cx.param_env).layout_of(ty) .ok() - .map(|layout| layout.size(cx.tcx).bytes()) + .map(|layout| layout.size.bytes()) } /// Returns true if the lint is allowed in the current context diff --git a/src/tools/clippy/tests/ui/booleans.rs b/src/tools/clippy/tests/ui/booleans.rs index 52ce90dd63..0898de105a 100644 --- a/src/tools/clippy/tests/ui/booleans.rs +++ b/src/tools/clippy/tests/ui/booleans.rs @@ -53,4 +53,7 @@ fn methods_with_negation() { let _ = !b.is_ok(); let c = false; let _ = !(a.is_some() && !c); + let _ = !(!c ^ c) || !a.is_some(); + let _ = (!c ^ c) || !a.is_some(); + let _ = !c ^ c || !a.is_some(); } diff --git a/src/tools/clippy/tests/ui/booleans.stderr b/src/tools/clippy/tests/ui/booleans.stderr index 05696ba0f5..6367ba0348 100644 --- a/src/tools/clippy/tests/ui/booleans.stderr +++ b/src/tools/clippy/tests/ui/booleans.stderr @@ -72,7 +72,6 @@ error: this boolean expression can be simplified | 34 | let _ = a == b && c == 5 && a == b; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | help: try | 34 | let _ = a == b && c == 5; @@ -85,7 +84,6 @@ error: this boolean expression can be simplified | 35 | let _ = a == b && c == 5 && b == a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | help: try | 35 | let _ = a == b && c == 5; @@ -122,7 +120,6 @@ error: this boolean expression can be simplified | 39 | let _ = a != b || !(a != b || c == d); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | help: try | 39 | let _ = c != d || a != b; @@ -160,3 +157,21 @@ error: this boolean expression can be simplified 55 | let _ = !(a.is_some() && !c); | ^^^^^^^^^^^^^^^^^^^^ help: try: `c || a.is_none()` +error: this boolean expression can be simplified + --> $DIR/booleans.rs:56:13 + | +56 | let _ = !(!c ^ c) || !a.is_some(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!(!c ^ c) || a.is_none()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:57:13 + | +57 | let _ = (!c ^ c) || !a.is_some(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(!c ^ c) || a.is_none()` + +error: this boolean expression can be simplified + --> $DIR/booleans.rs:58:13 + | +58 | let _ = !c ^ c || !a.is_some(); + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()` + diff --git a/src/tools/clippy/tests/ui/clone_on_copy_mut.rs b/src/tools/clippy/tests/ui/clone_on_copy_mut.rs new file mode 100644 index 0000000000..5bfa256623 --- /dev/null +++ b/src/tools/clippy/tests/ui/clone_on_copy_mut.rs @@ -0,0 +1,18 @@ +pub fn dec_read_dec(i: &mut i32) -> i32 { + *i -= 1; + let ret = *i; + *i -= 1; + ret +} + +pub fn minus_1(i: &i32) -> i32 { + dec_read_dec(&mut i.clone()) +} + +fn main() { + let mut i = 10; + assert_eq!(minus_1(&i), 9); + assert_eq!(i, 10); + assert_eq!(dec_read_dec(&mut i), 9); + assert_eq!(i, 8); +} diff --git a/src/tools/clippy/tests/ui/collapsible_if.stderr b/src/tools/clippy/tests/ui/collapsible_if.stderr index e726a36282..bc10afcedb 100644 --- a/src/tools/clippy/tests/ui/collapsible_if.stderr +++ b/src/tools/clippy/tests/ui/collapsible_if.stderr @@ -25,7 +25,6 @@ error: this if statement can be collapsed 17 | | } 18 | | } | |_____^ - | help: try | 14 | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { @@ -42,7 +41,6 @@ error: this if statement can be collapsed 23 | | } 24 | | } | |_____^ - | help: try | 20 | if x == "hello" && x == "world" && (y == "world" || y == "hello") { @@ -59,7 +57,6 @@ error: this if statement can be collapsed 29 | | } 30 | | } | |_____^ - | help: try | 26 | if (x == "hello" || x == "world") && y == "world" && y == "hello" { @@ -76,7 +73,6 @@ error: this if statement can be collapsed 35 | | } 36 | | } | |_____^ - | help: try | 32 | if x == "hello" && x == "world" && y == "world" && y == "hello" { @@ -93,7 +89,6 @@ error: this if statement can be collapsed 41 | | } 42 | | } | |_____^ - | help: try | 38 | if 42 == 1337 && 'a' != 'A' { @@ -111,7 +106,6 @@ error: this `else { if .. }` block can be collapsed 50 | | } 51 | | } | |_____^ - | help: try | 47 | } else if y == "world" { @@ -129,7 +123,6 @@ error: this `else { if .. }` block can be collapsed 58 | | } 59 | | } | |_____^ - | help: try | 55 | } else if let Some(42) = Some(42) { @@ -149,7 +142,6 @@ error: this `else { if .. }` block can be collapsed 69 | | } 70 | | } | |_____^ - | help: try | 63 | } else if y == "world" { @@ -172,7 +164,6 @@ error: this `else { if .. }` block can be collapsed 80 | | } 81 | | } | |_____^ - | help: try | 74 | } else if let Some(42) = Some(42) { @@ -195,7 +186,6 @@ error: this `else { if .. }` block can be collapsed 91 | | } 92 | | } | |_____^ - | help: try | 85 | } else if let Some(42) = Some(42) { @@ -218,7 +208,6 @@ error: this `else { if .. }` block can be collapsed 102 | | } 103 | | } | |_____^ - | help: try | 96 | } else if x == "hello" { @@ -241,7 +230,6 @@ error: this `else { if .. }` block can be collapsed 113 | | } 114 | | } | |_____^ - | help: try | 107 | } else if let Some(42) = Some(42) { diff --git a/src/tools/clippy/tests/ui/const_static_lifetime.rs b/src/tools/clippy/tests/ui/const_static_lifetime.rs index d2caf59935..a033f2b368 100644 --- a/src/tools/clippy/tests/ui/const_static_lifetime.rs +++ b/src/tools/clippy/tests/ui/const_static_lifetime.rs @@ -17,6 +17,12 @@ const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"] const VAR_HEIGHT: &'static Foo = &Foo {}; +const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static. + +const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static. + +const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static. + fn main() { let false_positive: &'static str = "test"; println!("{}", VAR_ONE); diff --git a/src/tools/clippy/tests/ui/const_static_lifetime.stderr b/src/tools/clippy/tests/ui/const_static_lifetime.stderr index 1eeb27c244..d4558f7b24 100644 --- a/src/tools/clippy/tests/ui/const_static_lifetime.stderr +++ b/src/tools/clippy/tests/ui/const_static_lifetime.stderr @@ -24,6 +24,12 @@ error: Constants have by default a `'static` lifetime 10 | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR Consider removing 'static | ^^^^^^^ help: consider removing `'static` +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:12:18 + | +12 | const VAR_FIVE: &'static [&[&'static str]] = &[&["test"], &["other one"]]; // ERROR Consider removing 'static + | ^^^^^^^ help: consider removing `'static` + error: Constants have by default a `'static` lifetime --> $DIR/const_static_lifetime.rs:12:30 | @@ -36,6 +42,12 @@ error: Constants have by default a `'static` lifetime 14 | const VAR_SIX: &'static u8 = &5; | ^^^^^^^ help: consider removing `'static` +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:16:29 + | +16 | const VAR_SEVEN: &[&(&str, &'static [&'static str])] = &[&("one", &["other one"])]; + | ^^^^^^^ help: consider removing `'static` + error: Constants have by default a `'static` lifetime --> $DIR/const_static_lifetime.rs:16:39 | @@ -48,3 +60,21 @@ error: Constants have by default a `'static` lifetime 18 | const VAR_HEIGHT: &'static Foo = &Foo {}; | ^^^^^^^ help: consider removing `'static` +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:20:19 + | +20 | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR Consider removing 'static. + | ^^^^^^^ help: consider removing `'static` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:22:19 + | +22 | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR Consider removing 'static. + | ^^^^^^^ help: consider removing `'static` + +error: Constants have by default a `'static` lifetime + --> $DIR/const_static_lifetime.rs:24:19 + | +24 | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR Consider removing 'static. + | ^^^^^^^ help: consider removing `'static` + diff --git a/src/tools/clippy/tests/ui/fallible_impl_from.rs b/src/tools/clippy/tests/ui/fallible_impl_from.rs index eb1cd4c5e9..db11891907 100644 --- a/src/tools/clippy/tests/ui/fallible_impl_from.rs +++ b/src/tools/clippy/tests/ui/fallible_impl_from.rs @@ -61,4 +61,18 @@ impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid { } } +struct Unreachable; + +impl From<String> for Unreachable { + fn from(s: String) -> Unreachable { + if s.is_empty() { + return Unreachable; + } + match s.chars().next() { + Some(_) => Unreachable, + None => unreachable!(), // do not lint the unreachable macro + } + } +} + fn main() {} diff --git a/src/tools/clippy/tests/ui/fallible_impl_from.stderr b/src/tools/clippy/tests/ui/fallible_impl_from.stderr index 89dfaf623e..8e93966ccd 100644 --- a/src/tools/clippy/tests/ui/fallible_impl_from.stderr +++ b/src/tools/clippy/tests/ui/fallible_impl_from.stderr @@ -38,7 +38,7 @@ note: potential failure(s) | 31 | panic!(); | ^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: consider implementing `TryFrom` instead --> $DIR/fallible_impl_from.rs:37:1 @@ -65,7 +65,7 @@ note: potential failure(s) | ^^^^^^^^^^^^^^^^^^^^^^^^^ 43 | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: consider implementing `TryFrom` instead --> $DIR/fallible_impl_from.rs:55:1 @@ -87,5 +87,5 @@ note: potential failure(s) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 58 | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/tools/clippy/tests/ui/float_cmp_const.rs b/src/tools/clippy/tests/ui/float_cmp_const.rs new file mode 100644 index 0000000000..adf2ab7036 --- /dev/null +++ b/src/tools/clippy/tests/ui/float_cmp_const.rs @@ -0,0 +1,45 @@ + + + +#![warn(float_cmp_const)] +#![allow(float_cmp)] +#![allow(unused, no_effect, unnecessary_operation)] + +const ONE: f32 = 1.0; +const TWO: f32 = 2.0; + +fn eq_one(x: f32) -> bool { + if x.is_nan() { false } else { x == ONE } // no error, inside "eq" fn +} + +fn main() { + // has errors + 1f32 == ONE; + TWO == ONE; + TWO != ONE; + ONE + ONE == TWO; + 1 as f32 == ONE; + + let v = 0.9; + v == ONE; + v != ONE; + + // no errors, lower than or greater than comparisons + v < ONE; + v > ONE; + v <= ONE; + v >= ONE; + + // no errors, zero and infinity values + ONE != 0f32; + TWO == 0f32; + ONE != ::std::f32::INFINITY; + ONE == ::std::f32::NEG_INFINITY; + + // no errors, but will warn float_cmp if '#![allow(float_cmp)]' above is removed + let w = 1.1; + v == w; + v != w; + v == 1.0; + v != 1.0; +} diff --git a/src/tools/clippy/tests/ui/float_cmp_const.stderr b/src/tools/clippy/tests/ui/float_cmp_const.stderr new file mode 100644 index 0000000000..fe277de28d --- /dev/null +++ b/src/tools/clippy/tests/ui/float_cmp_const.stderr @@ -0,0 +1,85 @@ +error: strict comparison of f32 or f64 constant + --> $DIR/float_cmp_const.rs:17:5 + | +17 | 1f32 == ONE; + | ^^^^^^^^^^^ help: consider comparing them within some error: `(1f32 - ONE).abs() < error` + | + = note: `-D float-cmp-const` implied by `-D warnings` +note: std::f32::EPSILON and std::f64::EPSILON are available. + --> $DIR/float_cmp_const.rs:17:5 + | +17 | 1f32 == ONE; + | ^^^^^^^^^^^ + +error: strict comparison of f32 or f64 constant + --> $DIR/float_cmp_const.rs:18:5 + | +18 | TWO == ONE; + | ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() < error` + | +note: std::f32::EPSILON and std::f64::EPSILON are available. + --> $DIR/float_cmp_const.rs:18:5 + | +18 | TWO == ONE; + | ^^^^^^^^^^ + +error: strict comparison of f32 or f64 constant + --> $DIR/float_cmp_const.rs:19:5 + | +19 | TWO != ONE; + | ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() < error` + | +note: std::f32::EPSILON and std::f64::EPSILON are available. + --> $DIR/float_cmp_const.rs:19:5 + | +19 | TWO != ONE; + | ^^^^^^^^^^ + +error: strict comparison of f32 or f64 constant + --> $DIR/float_cmp_const.rs:20:5 + | +20 | ONE + ONE == TWO; + | ^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE + ONE - TWO).abs() < error` + | +note: std::f32::EPSILON and std::f64::EPSILON are available. + --> $DIR/float_cmp_const.rs:20:5 + | +20 | ONE + ONE == TWO; + | ^^^^^^^^^^^^^^^^ + +error: strict comparison of f32 or f64 constant + --> $DIR/float_cmp_const.rs:21:5 + | +21 | 1 as f32 == ONE; + | ^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(1 as f32 - ONE).abs() < error` + | +note: std::f32::EPSILON and std::f64::EPSILON are available. + --> $DIR/float_cmp_const.rs:21:5 + | +21 | 1 as f32 == ONE; + | ^^^^^^^^^^^^^^^ + +error: strict comparison of f32 or f64 constant + --> $DIR/float_cmp_const.rs:24:5 + | +24 | v == ONE; + | ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() < error` + | +note: std::f32::EPSILON and std::f64::EPSILON are available. + --> $DIR/float_cmp_const.rs:24:5 + | +24 | v == ONE; + | ^^^^^^^^ + +error: strict comparison of f32 or f64 constant + --> $DIR/float_cmp_const.rs:25:5 + | +25 | v != ONE; + | ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() < error` + | +note: std::f32::EPSILON and std::f64::EPSILON are available. + --> $DIR/float_cmp_const.rs:25:5 + | +25 | v != ONE; + | ^^^^^^^^ + diff --git a/src/tools/clippy/tests/ui/for_loop.stderr b/src/tools/clippy/tests/ui/for_loop.stderr index f968e08886..b09350970f 100644 --- a/src/tools/clippy/tests/ui/for_loop.stderr +++ b/src/tools/clippy/tests/ui/for_loop.stderr @@ -91,7 +91,6 @@ error: the loop variable `i` is only used to index `vec`. 96 | | let _ = vec[i]; 97 | | } | |_____^ - | help: consider using an iterator | 95 | for <item> in &vec { @@ -104,7 +103,6 @@ error: the loop variable `j` is only used to index `STATIC`. 101 | | println!("{:?}", STATIC[j]); 102 | | } | |_____^ - | help: consider using an iterator | 100 | for <item> in STATIC.iter().take(4) { @@ -117,7 +115,6 @@ error: the loop variable `j` is only used to index `CONST`. 105 | | println!("{:?}", CONST[j]); 106 | | } | |_____^ - | help: consider using an iterator | 104 | for <item> in CONST.iter().take(4) { @@ -130,7 +127,6 @@ error: the loop variable `i` is used to index `vec` 109 | | println!("{} {}", vec[i], i); 110 | | } | |_____^ - | help: consider using an iterator | 108 | for (i, <item>) in vec.iter().enumerate() { @@ -143,7 +139,6 @@ error: the loop variable `i` is only used to index `vec2`. 117 | | println!("{}", vec2[i]); 118 | | } | |_____^ - | help: consider using an iterator | 116 | for <item> in vec2.iter().take(vec.len()) { @@ -156,7 +151,6 @@ error: the loop variable `i` is only used to index `vec`. 121 | | println!("{}", vec[i]); 122 | | } | |_____^ - | help: consider using an iterator | 120 | for <item> in vec.iter().skip(5) { @@ -169,7 +163,6 @@ error: the loop variable `i` is only used to index `vec`. 125 | | println!("{}", vec[i]); 126 | | } | |_____^ - | help: consider using an iterator | 124 | for <item> in vec.iter().take(MAX_LEN) { @@ -182,7 +175,6 @@ error: the loop variable `i` is only used to index `vec`. 129 | | println!("{}", vec[i]); 130 | | } | |_____^ - | help: consider using an iterator | 128 | for <item> in vec.iter().take(MAX_LEN + 1) { @@ -195,7 +187,6 @@ error: the loop variable `i` is only used to index `vec`. 133 | | println!("{}", vec[i]); 134 | | } | |_____^ - | help: consider using an iterator | 132 | for <item> in vec.iter().take(10).skip(5) { @@ -208,7 +199,6 @@ error: the loop variable `i` is only used to index `vec`. 137 | | println!("{}", vec[i]); 138 | | } | |_____^ - | help: consider using an iterator | 136 | for <item> in vec.iter().take(10 + 1).skip(5) { @@ -221,7 +211,6 @@ error: the loop variable `i` is used to index `vec` 141 | | println!("{} {}", vec[i], i); 142 | | } | |_____^ - | help: consider using an iterator | 140 | for (i, <item>) in vec.iter().enumerate().skip(5) { @@ -234,7 +223,6 @@ error: the loop variable `i` is used to index `vec` 145 | | println!("{} {}", vec[i], i); 146 | | } | |_____^ - | help: consider using an iterator | 144 | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) { @@ -261,7 +249,6 @@ error: this range is empty so this for loop will never run 153 | | println!("{}", i); 154 | | } | |_____^ - | help: consider using the following if you are attempting to iterate over this range in reverse | 152 | for i in (0...10).rev() { @@ -274,7 +261,6 @@ error: this range is empty so this for loop will never run 157 | | println!("{}", i); 158 | | } | |_____^ - | help: consider using the following if you are attempting to iterate over this range in reverse | 156 | for i in (0..MAX_LEN).rev() { @@ -295,7 +281,6 @@ error: this range is empty so this for loop will never run 186 | | println!("{}", i); 187 | | } | |_____^ - | help: consider using the following if you are attempting to iterate over this range in reverse | 185 | for i in (5 + 4..10).rev() { @@ -308,7 +293,6 @@ error: this range is empty so this for loop will never run 190 | | println!("{}", i); 191 | | } | |_____^ - | help: consider using the following if you are attempting to iterate over this range in reverse | 189 | for i in ((3 - 1)..(5 + 2)).rev() { @@ -460,7 +444,6 @@ error: you seem to want to iterate on a map's values 394 | | // `in *m.values()` as we used to 395 | | } | |_____^ - | help: use the corresponding method | 390 | for v in (*m).values() { @@ -473,7 +456,6 @@ error: you seem to want to iterate on a map's values 399 | | let _v = v; 400 | | } | |_____^ - | help: use the corresponding method | 398 | for v in m.values_mut() { @@ -486,7 +468,6 @@ error: you seem to want to iterate on a map's values 404 | | let _v = v; 405 | | } | |_____^ - | help: use the corresponding method | 403 | for v in (*m).values_mut() { @@ -499,7 +480,6 @@ error: you seem to want to iterate on a map's keys 410 | | let _k = k; 411 | | } | |_____^ - | help: use the corresponding method | 409 | for k in rm.keys() { @@ -555,7 +535,6 @@ error: it looks like you're manually copying between slices 497 | | dst2[i + 500] = src[i] 498 | | } | |_____^ - | help: try replacing the loop by | 495 | dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)]) diff --git a/src/tools/clippy/tests/ui/implicit_hasher.stderr b/src/tools/clippy/tests/ui/implicit_hasher.stderr index 52b686bf8a..aaa1e37ca8 100644 --- a/src/tools/clippy/tests/ui/implicit_hasher.stderr +++ b/src/tools/clippy/tests/ui/implicit_hasher.stderr @@ -19,7 +19,6 @@ error: impl for `HashMap` should be generalized over different hashers | 20 | impl<K: Hash + Eq, V> Foo<i8> for (HashMap<K, V>,) { | ^^^^^^^^^^^^^ - | help: consider adding a type parameter | 20 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) { @@ -34,7 +33,6 @@ error: impl for `HashMap` should be generalized over different hashers | 25 | impl Foo<i16> for HashMap<String, String> { | ^^^^^^^^^^^^^^^^^^^^^^^ - | help: consider adding a type parameter | 25 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> { @@ -49,7 +47,6 @@ error: impl for `HashSet` should be generalized over different hashers | 43 | impl<T: Hash + Eq> Foo<i8> for HashSet<T> { | ^^^^^^^^^^ - | help: consider adding a type parameter | 43 | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> { @@ -64,7 +61,6 @@ error: impl for `HashSet` should be generalized over different hashers | 48 | impl Foo<i16> for HashSet<String> { | ^^^^^^^^^^^^^^^ - | help: consider adding a type parameter | 48 | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> { @@ -79,7 +75,6 @@ error: parameter of type `HashMap` should be generalized over different hashers | 65 | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) { | ^^^^^^^^^^^^^^^^^ - | help: consider adding a type parameter | 65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) { @@ -90,7 +85,6 @@ error: parameter of type `HashSet` should be generalized over different hashers | 65 | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) { | ^^^^^^^^^^^^ - | help: consider adding a type parameter | 65 | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) { @@ -104,7 +98,6 @@ error: impl for `HashMap` should be generalized over different hashers ... 83 | gen!(impl); | ----------- in this macro invocation - | help: consider adding a type parameter | 70 | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> { @@ -122,7 +115,6 @@ error: parameter of type `HashMap` should be generalized over different hashers ... 84 | gen!(fn bar); | ------------- in this macro invocation - | help: consider adding a type parameter | 78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) { @@ -136,7 +128,6 @@ error: parameter of type `HashSet` should be generalized over different hashers ... 84 | gen!(fn bar); | ------------- in this macro invocation - | help: consider adding a type parameter | 78 | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) { diff --git a/src/tools/clippy/tests/ui/int_plus_one.stderr b/src/tools/clippy/tests/ui/int_plus_one.stderr index 5d42ebb898..69a8621fb1 100644 --- a/src/tools/clippy/tests/ui/int_plus_one.stderr +++ b/src/tools/clippy/tests/ui/int_plus_one.stderr @@ -15,7 +15,6 @@ error: Unnecessary `>= y + 1` or `x - 1 >=` | 11 | y + 1 <= x; | ^^^^^^^^^^ - | help: change `>= y + 1` to `> y` as shown | 11 | y < x; @@ -26,7 +25,6 @@ error: Unnecessary `>= y + 1` or `x - 1 >=` | 13 | x - 1 >= y; | ^^^^^^^^^^ - | help: change `>= y + 1` to `> y` as shown | 13 | x > y; @@ -37,7 +35,6 @@ error: Unnecessary `>= y + 1` or `x - 1 >=` | 14 | y <= x - 1; | ^^^^^^^^^^ - | help: change `>= y + 1` to `> y` as shown | 14 | y < x; diff --git a/src/tools/clippy/tests/ui/large_enum_variant.stderr b/src/tools/clippy/tests/ui/large_enum_variant.stderr index 899a84edea..5c6aac7d4e 100644 --- a/src/tools/clippy/tests/ui/large_enum_variant.stderr +++ b/src/tools/clippy/tests/ui/large_enum_variant.stderr @@ -27,7 +27,6 @@ error: large size difference between variants | 34 | ContainingLargeEnum(LargeEnum), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | help: consider boxing the large fields to reduce the total size of the enum | 34 | ContainingLargeEnum(Box<LargeEnum>), @@ -62,7 +61,6 @@ error: large size difference between variants | 49 | StructLikeLarge2 { x: [i32; 8000] }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | help: consider boxing the large fields to reduce the total size of the enum | 49 | StructLikeLarge2 { x: Box<[i32; 8000]> }, diff --git a/src/tools/clippy/tests/ui/literals.stderr b/src/tools/clippy/tests/ui/literals.stderr index 82c651e629..bcb9dbd136 100644 --- a/src/tools/clippy/tests/ui/literals.stderr +++ b/src/tools/clippy/tests/ui/literals.stderr @@ -77,7 +77,6 @@ error: this is a decimal constant | 30 | let fail8 = 0123; | ^^^^ - | help: if you mean to use a decimal constant, remove the `0` to remove confusion | 30 | let fail8 = 123; diff --git a/src/tools/clippy/tests/ui/matches.rs b/src/tools/clippy/tests/ui/matches.rs index f97038ca1f..352749d48e 100644 --- a/src/tools/clippy/tests/ui/matches.rs +++ b/src/tools/clippy/tests/ui/matches.rs @@ -277,6 +277,42 @@ fn match_wild_err_arm() { Ok(_) => println!("ok"), Err(_) => {unreachable!();} } + + // no warning because of the guard + match x { + Ok(x) if x*x == 64 => println!("ok"), + Ok(_) => println!("ok"), + Err(_) => println!("err") + } + + // this is a current false positive, see #1996 + match x { + Ok(3) => println!("ok"), + Ok(x) if x*x == 64 => println!("ok 64"), + Ok(_) => println!("ok"), + Err(_) => println!("err") + } + + match (x, Some(1i32)) { + (Ok(x), Some(_)) => println!("ok {}", x), + (Ok(_), Some(x)) => println!("ok {}", x), + _ => println!("err") + } + + // no warning because of the different types for x + match (x, Some(1.0f64)) { + (Ok(x), Some(_)) => println!("ok {}", x), + (Ok(_), Some(x)) => println!("ok {}", x), + _ => println!("err") + } + + // because of a bug, no warning was generated for this case before #2251 + match x { + Ok(_tmp) => println!("ok"), + Ok(3) => println!("ok"), + Ok(_) => println!("ok"), + Err(_) => {unreachable!();} + } } fn main() { diff --git a/src/tools/clippy/tests/ui/matches.stderr b/src/tools/clippy/tests/ui/matches.stderr index 7ff38a3534..beb3387d03 100644 --- a/src/tools/clippy/tests/ui/matches.stderr +++ b/src/tools/clippy/tests/ui/matches.stderr @@ -143,7 +143,6 @@ error: you don't need to add `&` to all patterns 150 | | _ => println!("none"), 151 | | } | |_____^ - | help: instead of prefixing all patterns with `&`, you can dereference the expression | 148 | match *tup { .. } @@ -165,7 +164,6 @@ error: you don't need to add `&` to all patterns 166 | | println!("none"); 167 | | } | |_____^ - | help: instead of prefixing all patterns with `&`, you can dereference the expression | 165 | if let .. = *a { .. } @@ -266,7 +264,7 @@ note: consider refactoring into `Ok(3) | Ok(_)` | 238 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: Err(_) will match all errors, maybe not a good idea --> $DIR/matches.rs:246:9 @@ -292,7 +290,7 @@ note: consider refactoring into `Ok(3) | Ok(_)` | 244 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: Err(_) will match all errors, maybe not a good idea --> $DIR/matches.rs:252:9 @@ -318,7 +316,7 @@ note: consider refactoring into `Ok(3) | Ok(_)` | 250 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies --> $DIR/matches.rs:258:18 @@ -336,7 +334,7 @@ note: consider refactoring into `Ok(3) | Ok(_)` | 257 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies --> $DIR/matches.rs:265:18 @@ -354,7 +352,7 @@ note: consider refactoring into `Ok(3) | Ok(_)` | 264 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies --> $DIR/matches.rs:271:18 @@ -372,7 +370,7 @@ note: consider refactoring into `Ok(3) | Ok(_)` | 270 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies --> $DIR/matches.rs:277:18 @@ -390,5 +388,59 @@ note: consider refactoring into `Ok(3) | Ok(_)` | 276 | Ok(3) => println!("ok"), | ^^^^^^^^^^^^^^ - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: this `match` has identical arm bodies + --> $DIR/matches.rs:292:18 + | +292 | Ok(_) => println!("ok"), + | ^^^^^^^^^^^^^^ + | +note: same as this + --> $DIR/matches.rs:290:18 + | +290 | Ok(3) => println!("ok"), + | ^^^^^^^^^^^^^^ +note: consider refactoring into `Ok(3) | Ok(_)` + --> $DIR/matches.rs:290:18 + | +290 | Ok(3) => println!("ok"), + | ^^^^^^^^^^^^^^ + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: this `match` has identical arm bodies + --> $DIR/matches.rs:298:29 + | +298 | (Ok(_), Some(x)) => println!("ok {}", x), + | ^^^^^^^^^^^^^^^^^^^^ + | +note: same as this + --> $DIR/matches.rs:297:29 + | +297 | (Ok(x), Some(_)) => println!("ok {}", x), + | ^^^^^^^^^^^^^^^^^^^^ +note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))` + --> $DIR/matches.rs:297:29 + | +297 | (Ok(x), Some(_)) => println!("ok {}", x), + | ^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: this `match` has identical arm bodies + --> $DIR/matches.rs:313:18 + | +313 | Ok(_) => println!("ok"), + | ^^^^^^^^^^^^^^ + | +note: same as this + --> $DIR/matches.rs:312:18 + | +312 | Ok(3) => println!("ok"), + | ^^^^^^^^^^^^^^ +note: consider refactoring into `Ok(3) | Ok(_)` + --> $DIR/matches.rs:312:18 + | +312 | Ok(3) => println!("ok"), + | ^^^^^^^^^^^^^^ + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/tools/clippy/tests/ui/methods.stderr b/src/tools/clippy/tests/ui/methods.stderr index 469f81c657..65d8b82da1 100644 --- a/src/tools/clippy/tests/ui/methods.stderr +++ b/src/tools/clippy/tests/ui/methods.stderr @@ -212,7 +212,6 @@ error: called `map_or(None, f)` on an Option value. This can be done more direct 151 | | } 152 | | ); | |_________________^ - | help: try using and_then instead | 149 | let _ = opt.and_then(|x| { diff --git a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr index a6c0c0454c..2ca96b127e 100644 --- a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr +++ b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr @@ -29,7 +29,6 @@ error: this argument is passed by value, but not consumed in the function body | 44 | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) { | ^^^^^^^^^^^^^^^^^^^^^^ - | help: consider taking a reference instead | 44 | fn test_match(x: &Option<Option<String>>, y: Option<Option<String>>) { @@ -47,7 +46,6 @@ error: this argument is passed by value, but not consumed in the function body | 57 | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { | ^^^^^^^ - | help: consider taking a reference instead | 57 | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) { @@ -73,7 +71,6 @@ error: this argument is passed by value, but not consumed in the function body | 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { | ^^^^^^ - | help: consider changing the type to | 75 | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) { @@ -94,7 +91,6 @@ error: this argument is passed by value, but not consumed in the function body | 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { | ^^^^^^^^ - | help: consider changing the type to | 75 | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) { diff --git a/src/tools/clippy/tests/ui/needless_range_loop.stderr b/src/tools/clippy/tests/ui/needless_range_loop.stderr index 94ee5f613f..af78b370a1 100644 --- a/src/tools/clippy/tests/ui/needless_range_loop.stderr +++ b/src/tools/clippy/tests/ui/needless_range_loop.stderr @@ -19,7 +19,6 @@ error: the loop variable `i` is only used to index `ms`. 30 | | ms[i] *= 2; 31 | | } | |_____^ - | help: consider using an iterator | 29 | for <item> in &mut ms { @@ -33,7 +32,6 @@ error: the loop variable `i` is only used to index `ms`. 37 | | *x *= 2; 38 | | } | |_____^ - | help: consider using an iterator | 35 | for <item> in &mut ms { diff --git a/src/tools/clippy/tests/ui/new_without_default.rs b/src/tools/clippy/tests/ui/new_without_default.rs index 9fd0fea137..e618bf1c23 100644 --- a/src/tools/clippy/tests/ui/new_without_default.rs +++ b/src/tools/clippy/tests/ui/new_without_default.rs @@ -83,4 +83,10 @@ impl IgnoreGenericNew { pub fn new<T>() -> Self { IgnoreGenericNew } // the derived Default does not make sense here as the result depends on T } +pub trait TraitWithNew: Sized { + fn new() -> Self { + panic!() + } +} + fn main() {} diff --git a/src/tools/clippy/tests/ui/new_without_default.stderr b/src/tools/clippy/tests/ui/new_without_default.stderr index 0ced183b1e..c12c10b9ae 100644 --- a/src/tools/clippy/tests/ui/new_without_default.stderr +++ b/src/tools/clippy/tests/ui/new_without_default.stderr @@ -15,7 +15,6 @@ error: you should consider deriving a `Default` implementation for `Bar` | 16 | pub fn new() -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | help: try this | 13 | #[derive(Default)] @@ -30,11 +29,10 @@ error: you should consider adding a `Default` implementation for `LtKo<'c>` = note: `-D new-without-default` implied by `-D warnings` help: try this | -64 | impl Default for LtKo<'c> { -65 | fn default() -> Self { -66 | Self::new() -67 | } -68 | } -69 | - ... +63 | impl Default for LtKo<'c> { +64 | fn default() -> Self { +65 | Self::new() +66 | } +67 | } + | diff --git a/src/tools/clippy/tests/ui/ptr_arg.stderr b/src/tools/clippy/tests/ui/ptr_arg.stderr index 9c6804cd9a..4fbf73183c 100644 --- a/src/tools/clippy/tests/ui/ptr_arg.stderr +++ b/src/tools/clippy/tests/ui/ptr_arg.stderr @@ -23,7 +23,6 @@ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and canno | 40 | fn cloned(x: &Vec<u8>) -> Vec<u8> { | ^^^^^^^^ - | help: change this to | 40 | fn cloned(x: &[u8]) -> Vec<u8> { @@ -42,7 +41,6 @@ error: writing `&String` instead of `&str` involves a new object where a slice w | 49 | fn str_cloned(x: &String) -> String { | ^^^^^^^ - | help: change this to | 49 | fn str_cloned(x: &str) -> String { @@ -65,7 +63,6 @@ error: writing `&String` instead of `&str` involves a new object where a slice w | 59 | fn false_positive_capacity(x: &Vec<u8>, y: &String) { | ^^^^^^^ - | help: change this to | 59 | fn false_positive_capacity(x: &Vec<u8>, y: &str) { diff --git a/src/tools/clippy/tests/ui/regex.stderr b/src/tools/clippy/tests/ui/regex.stderr index 1c244c1df1..9f1397990b 100644 --- a/src/tools/clippy/tests/ui/regex.stderr +++ b/src/tools/clippy/tests/ui/regex.stderr @@ -112,7 +112,7 @@ error: trivial regex error: trivial regex --> $DIR/regex.rs:62:40 | -62 | let trivial_backslash = Regex::new("a//.b"); +62 | let trivial_backslash = Regex::new("a/.b"); | ^^^^^^^ | = help: consider using consider using `str::contains` diff --git a/src/tools/clippy/tests/ui/stutter.rs b/src/tools/clippy/tests/ui/stutter.rs index 24612fd3b3..761339b0a8 100644 --- a/src/tools/clippy/tests/ui/stutter.rs +++ b/src/tools/clippy/tests/ui/stutter.rs @@ -9,6 +9,10 @@ mod foo { pub fn bar_foo() {} pub struct FooCake {} pub enum CakeFoo {} + pub struct Foo7Bar; + + // Should not warn + pub struct Foobar; } fn main() {} diff --git a/src/tools/clippy/tests/ui/stutter.stderr b/src/tools/clippy/tests/ui/stutter.stderr index 38cbcaa32f..e6465a2bce 100644 --- a/src/tools/clippy/tests/ui/stutter.stderr +++ b/src/tools/clippy/tests/ui/stutter.stderr @@ -24,3 +24,9 @@ error: item name ends with its containing module's name 11 | pub enum CakeFoo {} | ^^^^^^^^^^^^^^^^^^^ +error: item name starts with its containing module's name + --> $DIR/stutter.rs:12:5 + | +12 | pub struct Foo7Bar; + | ^^^^^^^^^^^^^^^^^^^ + diff --git a/src/tools/clippy/tests/ui/ty_fn_sig.rs b/src/tools/clippy/tests/ui/ty_fn_sig.rs new file mode 100644 index 0000000000..9e2753dcb1 --- /dev/null +++ b/src/tools/clippy/tests/ui/ty_fn_sig.rs @@ -0,0 +1,14 @@ +// Regression test + +pub fn retry<F: Fn()>(f: F) { + for _i in 0.. { + f(); + } +} + +fn main() { + for y in 0..4 { + let func = || (); + func(); + } +} diff --git a/src/tools/clippy/tests/ui/unnecessary_clone.stderr b/src/tools/clippy/tests/ui/unnecessary_clone.stderr index 1726375698..437df1ee97 100644 --- a/src/tools/clippy/tests/ui/unnecessary_clone.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_clone.stderr @@ -54,9 +54,17 @@ error: using `clone` on a double-reference; this will copy the reference instead --> $DIR/unnecessary_clone.rs:49:22 | 49 | let z: &Vec<_> = y.clone(); - | ^^^^^^^^^ help: try dereferencing it: `(*y).clone()` + | ^^^^^^^^^ | = note: `-D clone-double-ref` implied by `-D warnings` +help: try dereferencing it + | +49 | let z: &Vec<_> = &(*y).clone(); + | ^^^^^^^^^^^^^ +help: or try being explicit about what type to clone + | +49 | let z: &Vec<_> = &std::vec::Vec<i32>::clone(y); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable --> $DIR/unnecessary_clone.rs:56:27 diff --git a/src/tools/clippy/tests/ui/unused_io_amount.stderr b/src/tools/clippy/tests/ui/unused_io_amount.stderr index 8739ac245a..b4a3cb2122 100644 --- a/src/tools/clippy/tests/ui/unused_io_amount.stderr +++ b/src/tools/clippy/tests/ui/unused_io_amount.stderr @@ -5,7 +5,7 @@ error: handle written amount returned or use `Write::write_all` instead | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D unused-io-amount` implied by `-D warnings` - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: handle read amount returned or use `Read::read_exact` instead --> $DIR/unused_io_amount.rs:13:5 @@ -13,7 +13,7 @@ error: handle read amount returned or use `Read::read_exact` instead 13 | try!(s.read(&mut buf)); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro outside of the current crate + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: handle written amount returned or use `Write::write_all` instead --> $DIR/unused_io_amount.rs:18:5 diff --git a/src/tools/clippy/tests/ui/update-all-references.sh b/src/tools/clippy/tests/ui/update-all-references.sh index d6aa69c7e8..acc38f15fb 100755 --- a/src/tools/clippy/tests/ui/update-all-references.sh +++ b/src/tools/clippy/tests/ui/update-all-references.sh @@ -18,7 +18,7 @@ # # See all `update-references.sh`, if you just want to update a single test. -if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" ]]; then +if [[ "$1" == "--help" || "$1" == "-h" ]]; then echo "usage: $0" fi diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index d4d567e63c..725c8e75e6 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -8,8 +8,11 @@ diff = "0.1.10" env_logger = { version = "0.4", default-features = false } filetime = "0.1" getopts = "0.2" -log = "0.3" +log = "0.4" +regex = "0.2" rustc-serialize = "0.3" + +[target.'cfg(unix)'.dependencies] libc = "0.2" [target.'cfg(windows)'.dependencies] diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 660462ad41..48c3c5c819 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -13,7 +13,7 @@ use std::fmt; use std::str::FromStr; use std::path::PathBuf; -use test::ColorConfig; +use test::{ColorConfig, TestPaths}; #[derive(Clone, Copy, PartialEq, Debug)] pub enum Mode { @@ -221,3 +221,17 @@ pub struct Config { pub llvm_cxxflags: String, pub nodejs: Option<String>, } + +/// Used by `ui` tests to generate things like `foo.stderr` from `foo.rs`. +pub fn expected_output_path(testpaths: &TestPaths, revision: Option<&str>, kind: &str) -> PathBuf { + assert!(UI_EXTENSIONS.contains(&kind)); + let extension = match revision { + Some(r) => format!("{}.{}", r, kind), + None => kind.to_string(), + }; + testpaths.file.with_extension(extension) +} + +pub const UI_EXTENSIONS: &[&str] = &[UI_STDERR, UI_STDOUT]; +pub const UI_STDERR: &str = "stderr"; +pub const UI_STDOUT: &str = "stdout"; diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index c853d53829..1f736e33c8 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -26,6 +26,7 @@ pub struct EarlyProps { pub ignore: bool, pub should_fail: bool, pub aux: Vec<String>, + pub revisions: Vec<String>, } impl EarlyProps { @@ -34,6 +35,7 @@ impl EarlyProps { ignore: false, should_fail: false, aux: Vec::new(), + revisions: vec![], }; iter_header(testfile, @@ -50,6 +52,10 @@ impl EarlyProps { props.aux.push(s); } + if let Some(r) = config.parse_revisions(ln) { + props.revisions.extend(r); + } + props.should_fail = props.should_fail || config.parse_name_directive(ln, "should-fail"); }); @@ -212,7 +218,7 @@ pub struct TestProps { // testing harness and used when generating compilation // arguments. (In particular, it propagates to the aux-builds.) pub incremental_dir: Option<PathBuf>, - // Specifies that a cfail test must actually compile without errors. + // Specifies that a test must actually compile without errors. pub must_compile_successfully: bool, // rustdoc will test the output of the `--test` option pub check_test_line_numbers_match: bool, @@ -353,10 +359,6 @@ impl TestProps { self.forbid_output.push(of); } - if !self.must_compile_successfully { - self.must_compile_successfully = config.parse_must_compile_successfully(ln); - } - if !self.check_test_line_numbers_match { self.check_test_line_numbers_match = config.parse_check_test_line_numbers_match(ln); } @@ -365,6 +367,12 @@ impl TestProps { self.run_pass = config.parse_run_pass(ln); } + if !self.must_compile_successfully { + // run-pass implies must_compile_sucessfully + self.must_compile_successfully = + config.parse_must_compile_successfully(ln) || self.run_pass; + } + if let Some(rule) = config.parse_custom_normalization(ln, "normalize-stdout") { self.normalize_stdout.push(rule); } diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 8e9cd1a12f..99d7dc7816 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -57,6 +57,25 @@ struct DiagnosticCode { explanation: Option<String>, } +pub fn extract_rendered(output: &str, proc_res: &ProcRes) -> String { + output.lines() + .filter_map(|line| if line.starts_with('{') { + match json::decode::<Diagnostic>(line) { + Ok(diagnostic) => diagnostic.rendered, + Err(error) => { + proc_res.fatal(Some(&format!("failed to decode compiler output as json: \ + `{}`\noutput: {}\nline: {}", + error, + line, + output))); + } + } + } else { + None + }) + .collect() +} + pub fn parse_output(file_name: &str, output: &str, proc_res: &ProcRes) -> Vec<Error> { output.lines() .flat_map(|line| parse_line(file_name, line, output, proc_res)) diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 6da37df192..80630b5e2c 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -9,22 +9,21 @@ // except according to those terms. #![crate_name = "compiletest"] - #![feature(test)] #![feature(slice_rotate)] - #![deny(warnings)] -#[cfg(unix)] -extern crate libc; -extern crate test; -extern crate getopts; -extern crate rustc_serialize; -#[macro_use] -extern crate log; +extern crate diff; extern crate env_logger; extern crate filetime; -extern crate diff; +extern crate getopts; +#[cfg(unix)] +extern crate libc; +#[macro_use] +extern crate log; +extern crate rustc_serialize; +extern crate regex; +extern crate test; use std::env; use std::ffi::OsString; @@ -35,8 +34,9 @@ use std::process::Command; use filetime::FileTime; use getopts::Options; use common::Config; -use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Mode}; -use test::{TestPaths, ColorConfig}; +use common::{DebugInfoGdb, DebugInfoLldb, Mode, Pretty}; +use common::{expected_output_path, UI_EXTENSIONS}; +use test::{ColorConfig, TestPaths}; use util::logv; use self::header::EarlyProps; @@ -63,53 +63,168 @@ fn main() { run_tests(&config); } -pub fn parse_config(args: Vec<String> ) -> Config { - +pub fn parse_config(args: Vec<String>) -> Config { let mut opts = Options::new(); - opts.reqopt("", "compile-lib-path", "path to host shared libraries", "PATH") - .reqopt("", "run-lib-path", "path to target shared libraries", "PATH") - .reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH") - .optopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH") - .reqopt("", "lldb-python", "path to python to use for doc tests", "PATH") - .reqopt("", "docck-python", "path to python to use for doc tests", "PATH") - .optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM") - .optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind") - .optopt("", "llvm-filecheck", "path to LLVM's FileCheck binary", "DIR") + opts.reqopt( + "", + "compile-lib-path", + "path to host shared libraries", + "PATH", + ).reqopt( + "", + "run-lib-path", + "path to target shared libraries", + "PATH", + ) + .reqopt( + "", + "rustc-path", + "path to rustc to use for compiling", + "PATH", + ) + .optopt( + "", + "rustdoc-path", + "path to rustdoc to use for compiling", + "PATH", + ) + .reqopt( + "", + "lldb-python", + "path to python to use for doc tests", + "PATH", + ) + .reqopt( + "", + "docck-python", + "path to python to use for doc tests", + "PATH", + ) + .optopt( + "", + "valgrind-path", + "path to Valgrind executable for Valgrind tests", + "PROGRAM", + ) + .optflag( + "", + "force-valgrind", + "fail if Valgrind tests cannot be run under Valgrind", + ) + .optopt( + "", + "llvm-filecheck", + "path to LLVM's FileCheck binary", + "DIR", + ) .reqopt("", "src-base", "directory to scan for test files", "PATH") - .reqopt("", "build-base", "directory to deposit test outputs", "PATH") - .reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET") - .reqopt("", "mode", "which sort of compile tests to run", - "(compile-fail|parse-fail|run-fail|run-pass|\ - run-pass-valgrind|pretty|debug-info|incremental|mir-opt)") + .reqopt( + "", + "build-base", + "directory to deposit test outputs", + "PATH", + ) + .reqopt( + "", + "stage-id", + "the target-stage identifier", + "stageN-TARGET", + ) + .reqopt( + "", + "mode", + "which sort of compile tests to run", + "(compile-fail|parse-fail|run-fail|run-pass|\ + run-pass-valgrind|pretty|debug-info|incremental|mir-opt)", + ) .optflag("", "ignored", "run tests marked as ignored") .optflag("", "exact", "filters match exactly") - .optopt("", "runtool", "supervisor program to run tests under \ - (eg. emulator, valgrind)", "PROGRAM") - .optopt("", "host-rustcflags", "flags to pass to rustc for host", "FLAGS") - .optopt("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS") + .optopt( + "", + "runtool", + "supervisor program to run tests under \ + (eg. emulator, valgrind)", + "PROGRAM", + ) + .optopt( + "", + "host-rustcflags", + "flags to pass to rustc for host", + "FLAGS", + ) + .optopt( + "", + "target-rustcflags", + "flags to pass to rustc for target", + "FLAGS", + ) .optflag("", "verbose", "run tests verbosely, showing all output") - .optflag("", "quiet", "print one character per test instead of one line") + .optflag( + "", + "quiet", + "print one character per test instead of one line", + ) .optopt("", "color", "coloring: auto, always, never", "WHEN") .optopt("", "logfile", "file to log test execution to", "FILE") .optopt("", "target", "the target to build for", "TARGET") .optopt("", "host", "the host to build for", "HOST") - .optopt("", "gdb", "path to GDB to use for GDB debuginfo tests", "PATH") - .optopt("", "lldb-version", "the version of LLDB used", "VERSION STRING") - .optopt("", "llvm-version", "the version of LLVM used", "VERSION STRING") + .optopt( + "", + "gdb", + "path to GDB to use for GDB debuginfo tests", + "PATH", + ) + .optopt( + "", + "lldb-version", + "the version of LLDB used", + "VERSION STRING", + ) + .optopt( + "", + "llvm-version", + "the version of LLVM used", + "VERSION STRING", + ) .optflag("", "system-llvm", "is LLVM the system LLVM") - .optopt("", "android-cross-path", "Android NDK standalone path", "PATH") + .optopt( + "", + "android-cross-path", + "Android NDK standalone path", + "PATH", + ) .optopt("", "adb-path", "path to the android debugger", "PATH") - .optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH") - .optopt("", "lldb-python-dir", "directory containing LLDB's python module", "PATH") + .optopt( + "", + "adb-test-dir", + "path to tests for the android debugger", + "PATH", + ) + .optopt( + "", + "lldb-python-dir", + "directory containing LLDB's python module", + "PATH", + ) .reqopt("", "cc", "path to a C compiler", "PATH") .reqopt("", "cxx", "path to a C++ compiler", "PATH") .reqopt("", "cflags", "flags for the C compiler", "FLAGS") .optopt("", "ar", "path to an archiver", "PATH") .optopt("", "linker", "path to a linker", "PATH") - .reqopt("", "llvm-components", "list of LLVM components built in", "LIST") + .reqopt( + "", + "llvm-components", + "list of LLVM components built in", + "LIST", + ) .reqopt("", "llvm-cxxflags", "C++ flags for LLVM", "FLAGS") .optopt("", "nodejs", "the name of nodejs", "PATH") - .optopt("", "remote-test-client", "path to the remote test client", "PATH") + .optopt( + "", + "remote-test-client", + "path to the remote test client", + "PATH", + ) .optflag("h", "help", "show this message"); let (argv0, args_) = args.split_first().unwrap(); @@ -120,11 +235,10 @@ pub fn parse_config(args: Vec<String> ) -> Config { panic!() } - let matches = - &match opts.parse(args_) { - Ok(m) => m, - Err(f) => panic!("{:?}", f) - }; + let matches = &match opts.parse(args_) { + Ok(m) => m, + Err(f) => panic!("{:?}", f), + }; if matches.opt_present("h") || matches.opt_present("help") { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); @@ -154,7 +268,10 @@ pub fn parse_config(args: Vec<String> ) -> Config { Some("auto") | None => ColorConfig::AutoColor, Some("always") => ColorConfig::AlwaysColor, Some("never") => ColorConfig::NeverColor, - Some(x) => panic!("argument for --color must be auto, always, or never, but found `{}`", x), + Some(x) => panic!( + "argument for --color must be auto, always, or never, but found `{}`", + x + ), }; Config { @@ -170,7 +287,11 @@ pub fn parse_config(args: Vec<String> ) -> Config { src_base: opt_path(matches, "src-base"), build_base: opt_path(matches, "build-base"), stage_id: matches.opt_str("stage-id").unwrap(), - mode: matches.opt_str("mode").unwrap().parse().expect("invalid mode"), + mode: matches + .opt_str("mode") + .unwrap() + .parse() + .expect("invalid mode"), run_ignored: matches.opt_present("ignored"), filter: matches.free.first().cloned(), filter_exact: matches.opt_present("exact"), @@ -189,10 +310,9 @@ pub fn parse_config(args: Vec<String> ) -> Config { android_cross_path: opt_path(matches, "android-cross-path"), adb_path: opt_str2(matches.opt_str("adb-path")), adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")), - adb_device_status: - opt_str2(matches.opt_str("target")).contains("android") && - "(none)" != opt_str2(matches.opt_str("adb-test-dir")) && - !opt_str2(matches.opt_str("adb-test-dir")).is_empty(), + adb_device_status: opt_str2(matches.opt_str("target")).contains("android") + && "(none)" != opt_str2(matches.opt_str("adb-test-dir")) + && !opt_str2(matches.opt_str("adb-test-dir")).is_empty(), lldb_python_dir: matches.opt_str("lldb-python-dir"), verbose: matches.opt_present("verbose"), quiet: matches.opt_present("quiet"), @@ -213,7 +333,10 @@ pub fn parse_config(args: Vec<String> ) -> Config { pub fn log_config(config: &Config) { let c = config; logv(c, "configuration:".to_string()); - logv(c, format!("compile_lib_path: {:?}", config.compile_lib_path)); + logv( + c, + format!("compile_lib_path: {:?}", config.compile_lib_path), + ); logv(c, format!("run_lib_path: {:?}", config.run_lib_path)); logv(c, format!("rustc_path: {:?}", config.rustc_path.display())); logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path)); @@ -222,24 +345,38 @@ pub fn log_config(config: &Config) { logv(c, format!("stage_id: {}", config.stage_id)); logv(c, format!("mode: {}", config.mode)); logv(c, format!("run_ignored: {}", config.run_ignored)); - logv(c, format!("filter: {}", - opt_str(&config.filter - .as_ref() - .map(|re| re.to_owned())))); + logv( + c, + format!( + "filter: {}", + opt_str(&config.filter.as_ref().map(|re| re.to_owned())) + ), + ); logv(c, format!("filter_exact: {}", config.filter_exact)); logv(c, format!("runtool: {}", opt_str(&config.runtool))); - logv(c, format!("host-rustcflags: {}", - opt_str(&config.host_rustcflags))); - logv(c, format!("target-rustcflags: {}", - opt_str(&config.target_rustcflags))); + logv( + c, + format!("host-rustcflags: {}", opt_str(&config.host_rustcflags)), + ); + logv( + c, + format!("target-rustcflags: {}", opt_str(&config.target_rustcflags)), + ); logv(c, format!("target: {}", config.target)); logv(c, format!("host: {}", config.host)); - logv(c, format!("android-cross-path: {:?}", - config.android_cross_path.display())); + logv( + c, + format!( + "android-cross-path: {:?}", + config.android_cross_path.display() + ), + ); logv(c, format!("adb_path: {:?}", config.adb_path)); logv(c, format!("adb_test_dir: {:?}", config.adb_test_dir)); - logv(c, format!("adb_device_status: {}", - config.adb_device_status)); + logv( + c, + format!("adb_device_status: {}", config.adb_device_status), + ); logv(c, format!("ar: {}", config.ar)); logv(c, format!("linker: {:?}", config.linker)); logv(c, format!("verbose: {}", config.verbose)); @@ -264,8 +401,11 @@ pub fn opt_str2(maybestr: Option<String>) -> String { pub fn run_tests(config: &Config) { if config.target.contains("android") { if let DebugInfoGdb = config.mode { - println!("{} debug-info test uses tcp 5039 port.\ - please reserve it", config.target); + println!( + "{} debug-info test uses tcp 5039 port.\ + please reserve it", + config.target + ); // android debug-info test uses remote debugger so, we test 1 thread // at once as they're all sharing the same TCP port to communicate @@ -281,12 +421,14 @@ pub fn run_tests(config: &Config) { DebugInfoLldb => { if let Some(lldb_version) = config.lldb_version.as_ref() { if is_blacklisted_lldb_version(&lldb_version[..]) { - println!("WARNING: The used version of LLDB ({}) has a \ - known issue that breaks debuginfo tests. See \ - issue #32520 for more information. Skipping all \ - LLDB-based tests!", - lldb_version); - return + println!( + "WARNING: The used version of LLDB ({}) has a \ + known issue that breaks debuginfo tests. See \ + issue #32520 for more information. Skipping all \ + LLDB-based tests!", + lldb_version + ); + return; } } @@ -297,11 +439,12 @@ pub fn run_tests(config: &Config) { } DebugInfoGdb => { - if config.remote_test_client.is_some() && - !config.target.contains("android"){ - println!("WARNING: debuginfo tests are not available when \ - testing with remote"); - return + if config.remote_test_client.is_some() && !config.target.contains("android") { + println!( + "WARNING: debuginfo tests are not available when \ + testing with remote" + ); + return; } } _ => { /* proceed */ } @@ -317,7 +460,9 @@ pub fn run_tests(config: &Config) { // sadly osx needs some file descriptor limits raised for running tests in // parallel (especially when we have lots and lots of child processes). // For context, see #8904 - unsafe { raise_fd_limit::raise_fd_limit(); } + unsafe { + raise_fd_limit::raise_fd_limit(); + } // Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows // If #11207 is resolved (adding manifest to .exe) this becomes unnecessary env::set_var("__COMPAT_LAYER", "RunAsInvoker"); @@ -346,7 +491,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts { bench_benchmarks: true, nocapture: match env::var("RUST_TEST_NOCAPTURE") { Ok(val) => &val != "0", - Err(_) => false + Err(_) => false, }, color: config.color, test_threads: None, @@ -357,24 +502,25 @@ pub fn test_opts(config: &Config) -> test::TestOpts { } pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> { - debug!("making tests from {:?}", - config.src_base.display()); + debug!("making tests from {:?}", config.src_base.display()); let mut tests = Vec::new(); - collect_tests_from_dir(config, - &config.src_base, - &config.src_base, - &PathBuf::new(), - &mut tests) - .unwrap(); + collect_tests_from_dir( + config, + &config.src_base, + &config.src_base, + &PathBuf::new(), + &mut tests, + ).unwrap(); tests } -fn collect_tests_from_dir(config: &Config, - base: &Path, - dir: &Path, - relative_dir_path: &Path, - tests: &mut Vec<test::TestDescAndFn>) - -> io::Result<()> { +fn collect_tests_from_dir( + config: &Config, + base: &Path, + dir: &Path, + relative_dir_path: &Path, + tests: &mut Vec<test::TestDescAndFn>, +) -> io::Result<()> { // Ignore directories that contain a file // `compiletest-ignore-dir`. for file in fs::read_dir(dir)? { @@ -390,7 +536,7 @@ fn collect_tests_from_dir(config: &Config, relative_dir: relative_dir_path.parent().unwrap().to_path_buf(), }; tests.push(make_test(config, &paths)); - return Ok(()) + return Ok(()); } } @@ -430,11 +576,7 @@ fn collect_tests_from_dir(config: &Config, fs::create_dir_all(&build_dir).unwrap(); } else { debug!("found directory: {:?}", file_path.display()); - collect_tests_from_dir(config, - base, - &file_path, - &relative_file_path, - tests)?; + collect_tests_from_dir(config, base, &file_path, &relative_file_path, tests)?; } } else { debug!("found other file/directory: {:?}", file_path.display()); @@ -467,13 +609,13 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn test::ShouldPanic::Yes } else { test::ShouldPanic::No - } + }, }; // Debugging emscripten code doesn't make sense today - let ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props) || - (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) && - config.target.contains("emscripten"); + let ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props) + || (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) + && config.target.contains("emscripten"); test::TestDescAndFn { desc: test::TestDesc { @@ -487,28 +629,32 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn } fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf { - let stamp_name = format!("{}-{}.stamp", - testpaths.file.file_name().unwrap() - .to_str().unwrap(), - config.stage_id); - config.build_base.canonicalize() - .unwrap_or_else(|_| config.build_base.clone()) - .join(&testpaths.relative_dir) - .join(stamp_name) + let stamp_name = format!( + "{}-{}.stamp", + testpaths.file.file_name().unwrap().to_str().unwrap(), + config.stage_id + ); + config + .build_base + .canonicalize() + .unwrap_or_else(|_| config.build_base.clone()) + .join(&testpaths.relative_dir) + .join(stamp_name) } fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool { - let rust_src_dir = config.find_rust_src_root().expect( - "Could not find Rust source root", - ); + let rust_src_dir = config + .find_rust_src_root() + .expect("Could not find Rust source root"); let stamp = mtime(&stamp(config, testpaths)); let mut inputs = vec![mtime(&testpaths.file), mtime(&config.rustc_path)]; for aux in props.aux.iter() { - inputs.push(mtime( - &testpaths.file.parent().unwrap().join("auxiliary").join( - aux, - ), - )); + inputs.push(mtime(&testpaths + .file + .parent() + .unwrap() + .join("auxiliary") + .join(aux))); } // Relevant pretty printer files let pretty_printer_files = [ @@ -529,21 +675,34 @@ fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> boo inputs.push(mtime(&rustdoc_path)); inputs.push(mtime(&rust_src_dir.join("src/etc/htmldocck.py"))); } + + // UI test files. + for extension in UI_EXTENSIONS { + for revision in &props.revisions { + let path = &expected_output_path(testpaths, Some(revision), extension); + inputs.push(mtime(path)); + } + + if props.revisions.is_empty() { + let path = &expected_output_path(testpaths, None, extension); + inputs.push(mtime(path)); + } + } + inputs.iter().any(|input| *input > stamp) } fn mtime(path: &Path) -> FileTime { - fs::metadata(path).map(|f| { - FileTime::from_last_modification_time(&f) - }).unwrap_or_else(|_| FileTime::zero()) + fs::metadata(path) + .map(|f| FileTime::from_last_modification_time(&f)) + .unwrap_or_else(|_| FileTime::zero()) } pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName { // Convert a complete path to something like // // run-pass/foo/bar/baz.rs - let path = - PathBuf::from(config.src_base.file_name().unwrap()) + let path = PathBuf::from(config.src_base.file_name().unwrap()) .join(&testpaths.relative_dir) .join(&testpaths.file.file_name().unwrap()); test::DynTestName(format!("[{}] {}", config.mode, path.display())) @@ -552,9 +711,7 @@ pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName pub fn make_test_closure(config: &Config, testpaths: &TestPaths) -> test::TestFn { let config = config.clone(); let testpaths = testpaths.clone(); - test::DynTestFn(Box::new(move |()| { - runtest::run(config, &testpaths) - })) + test::DynTestFn(Box::new(move || runtest::run(config, &testpaths))) } /// Returns (Path to GDB, GDB Version, GDB has Rust Support) @@ -572,9 +729,17 @@ fn analyze_gdb(gdb: Option<String>) -> (Option<String>, Option<u32>, bool) { Some(ref s) => s, }; - let version_line = Command::new(gdb).arg("--version").output().map(|output| { - String::from_utf8_lossy(&output.stdout).lines().next().unwrap().to_string() - }).ok(); + let version_line = Command::new(gdb) + .arg("--version") + .output() + .map(|output| { + String::from_utf8_lossy(&output.stdout) + .lines() + .next() + .unwrap() + .to_string() + }) + .ok(); let version = match version_line { Some(line) => extract_gdb_version(&line), @@ -600,7 +765,7 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> { for (pos, c) in full_version_line.char_indices() { if prev_was_digit || !c.is_digit(10) { prev_was_digit = c.is_digit(10); - continue + continue; } prev_was_digit = true; @@ -623,10 +788,15 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> { Some(idx) => if line.as_bytes()[idx] == b'.' { let patch = &line[idx + 1..]; - let patch_len = patch.find(|c: char| !c.is_digit(10)) - .unwrap_or_else(|| patch.len()); + let patch_len = patch + .find(|c: char| !c.is_digit(10)) + .unwrap_or_else(|| patch.len()); let patch = &patch[..patch_len]; - let patch = if patch_len > 3 || patch_len == 0 { None } else { Some(patch) }; + let patch = if patch_len > 3 || patch_len == 0 { + None + } else { + Some(patch) + }; (&line[..idx], patch) } else { @@ -666,21 +836,36 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> { let full_version_line = full_version_line.trim(); for (pos, l) in full_version_line.char_indices() { - if l != 'l' && l != 'L' { continue } - if pos + 5 >= full_version_line.len() { continue } + if l != 'l' && l != 'L' { + continue; + } + if pos + 5 >= full_version_line.len() { + continue; + } let l = full_version_line[pos + 1..].chars().next().unwrap(); - if l != 'l' && l != 'L' { continue } + if l != 'l' && l != 'L' { + continue; + } let d = full_version_line[pos + 2..].chars().next().unwrap(); - if d != 'd' && d != 'D' { continue } + if d != 'd' && d != 'D' { + continue; + } let b = full_version_line[pos + 3..].chars().next().unwrap(); - if b != 'b' && b != 'B' { continue } + if b != 'b' && b != 'B' { + continue; + } let dash = full_version_line[pos + 4..].chars().next().unwrap(); - if dash != '-' { continue } + if dash != '-' { + continue; + } - let vers = full_version_line[pos + 5..].chars().take_while(|c| { - c.is_digit(10) - }).collect::<String>(); - if !vers.is_empty() { return Some(vers) } + let vers = full_version_line[pos + 5..] + .chars() + .take_while(|c| c.is_digit(10)) + .collect::<String>(); + if !vers.is_empty() { + return Some(vers); + } } } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 749d1f4c37..7612b2d6e8 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -10,26 +10,28 @@ use common::Config; use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind}; -use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc, CodegenUnits}; -use common::{Incremental, RunMake, Ui, MirOpt}; +use common::{Codegen, CodegenUnits, DebugInfoGdb, DebugInfoLldb, Rustdoc}; +use common::{Incremental, MirOpt, RunMake, Ui}; +use common::{expected_output_path, UI_STDERR, UI_STDOUT}; use diff; -use errors::{self, ErrorKind, Error}; +use errors::{self, Error, ErrorKind}; use filetime::FileTime; use json; use header::TestProps; use test::TestPaths; use util::logv; +use regex::Regex; use std::collections::HashMap; use std::collections::HashSet; use std::env; use std::ffi::OsString; -use std::fs::{self, File, create_dir_all}; +use std::fs::{self, create_dir_all, File}; use std::fmt; use std::io::prelude::*; use std::io::{self, BufReader}; use std::path::{Path, PathBuf}; -use std::process::{Command, Output, ExitStatus, Stdio, Child}; +use std::process::{Child, Command, ExitStatus, Output, Stdio}; use std::str; use extract_gdb_version; @@ -49,7 +51,6 @@ pub fn dylib_env_var() -> &'static str { pub fn run(config: Config, testpaths: &TestPaths) { match &*config.target { - "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => { if !config.adb_device_status { panic!("android device not available"); @@ -71,24 +72,24 @@ pub fn run(config: Config, testpaths: &TestPaths) { debug!("running {:?}", testpaths.file.display()); let base_props = TestProps::from_file(&testpaths.file, None, &config); - let base_cx = TestCx { config: &config, - props: &base_props, - testpaths, - revision: None }; + let base_cx = TestCx { + config: &config, + props: &base_props, + testpaths, + revision: None, + }; base_cx.init_all(); if base_props.revisions.is_empty() { base_cx.run_revision() } else { for revision in &base_props.revisions { - let revision_props = TestProps::from_file(&testpaths.file, - Some(revision), - &config); + let revision_props = TestProps::from_file(&testpaths.file, Some(revision), &config); let rev_cx = TestCx { config: &config, props: &revision_props, testpaths, - revision: Some(revision) + revision: Some(revision), }; rev_cx.run_revision(); } @@ -103,7 +104,7 @@ struct TestCx<'test> { config: &'test Config, props: &'test TestProps, testpaths: &'test TestPaths, - revision: Option<&'test str> + revision: Option<&'test str>, } struct DebuggerCommands { @@ -125,8 +126,7 @@ impl<'test> TestCx<'test> { /// revisions, exactly once, with revision == None). fn run_revision(&self) { match self.config.mode { - CompileFail | - ParseFail => self.run_cfail_test(), + CompileFail | ParseFail => self.run_cfail_test(), RunFail => self.run_rfail_test(), RunPass => self.run_rpass_test(), RunPassValgrind => self.run_valgrind_test(), @@ -148,24 +148,26 @@ impl<'test> TestCx<'test> { assert!(self.revision.is_none(), "init_all invoked for a revision"); } - fn run_cfail_test(&self) { - let proc_res = self.compile_test(); - + fn check_if_test_should_compile(&self, proc_res: &ProcRes) { if self.props.must_compile_successfully { if !proc_res.status.success() { - self.fatal_proc_rec( - "test compilation failed although it shouldn't!", - &proc_res); + self.fatal_proc_rec("test compilation failed although it shouldn't!", proc_res); } } else { if proc_res.status.success() { self.fatal_proc_rec( &format!("{} test compiled successfully!", self.config.mode)[..], - &proc_res); + proc_res, + ); } - self.check_correct_failure_status(&proc_res); + self.check_correct_failure_status(proc_res); } + } + + fn run_cfail_test(&self) { + let proc_res = self.compile_test(); + self.check_if_test_should_compile(&proc_res); let output_to_check = self.get_output(&proc_res); let expected_errors = errors::load_errors(&self.testpaths.file, self.revision); @@ -215,9 +217,9 @@ impl<'test> TestCx<'test> { const RUST_ERR: i32 = 101; if proc_res.status.code() != Some(RUST_ERR) { self.fatal_proc_rec( - &format!("failure produced the wrong error: {}", - proc_res.status), - proc_res); + &format!("failure produced the wrong error: {}", proc_res.status), + proc_res, + ); } } @@ -230,8 +232,10 @@ impl<'test> TestCx<'test> { // FIXME(#41968): Move this check to tidy? let expected_errors = errors::load_errors(&self.testpaths.file, self.revision); - assert!(expected_errors.is_empty(), - "run-pass tests with expected warnings should be moved to ui/"); + assert!( + expected_errors.is_empty(), + "run-pass tests with expected warnings should be moved to ui/" + ); let proc_res = self.exec_compiled_test(); @@ -256,7 +260,10 @@ impl<'test> TestCx<'test> { let mut new_config = self.config.clone(); new_config.runtool = new_config.valgrind_path.clone(); - let new_cx = TestCx { config: &new_config, ..*self }; + let new_cx = TestCx { + config: &new_config, + ..*self + }; proc_res = new_cx.exec_compiled_test(); if !proc_res.status.success() { @@ -268,28 +275,48 @@ impl<'test> TestCx<'test> { if self.props.pp_exact.is_some() { logv(self.config, "testing for exact pretty-printing".to_owned()); } else { - logv(self.config, "testing for converging pretty-printing".to_owned()); + logv( + self.config, + "testing for converging pretty-printing".to_owned(), + ); } - let rounds = match self.props.pp_exact { Some(_) => 1, None => 2 }; + let rounds = match self.props.pp_exact { + Some(_) => 1, + None => 2, + }; let mut src = String::new(); - File::open(&self.testpaths.file).unwrap().read_to_string(&mut src).unwrap(); + File::open(&self.testpaths.file) + .unwrap() + .read_to_string(&mut src) + .unwrap(); let mut srcs = vec![src]; let mut round = 0; while round < rounds { - logv(self.config, format!("pretty-printing round {} revision {:?}", - round, self.revision)); + logv( + self.config, + format!( + "pretty-printing round {} revision {:?}", + round, + self.revision + ), + ); let proc_res = self.print_source(srcs[round].to_owned(), &self.props.pretty_mode); if !proc_res.status.success() { - self.fatal_proc_rec(&format!("pretty-printing failed in round {} revision {:?}", - round, self.revision), - &proc_res); + self.fatal_proc_rec( + &format!( + "pretty-printing failed in round {} revision {:?}", + round, + self.revision + ), + &proc_res, + ); } - let ProcRes{ stdout, .. } = proc_res; + let ProcRes { stdout, .. } = proc_res; srcs.push(stdout); round += 1; } @@ -298,10 +325,13 @@ impl<'test> TestCx<'test> { Some(ref file) => { let filepath = self.testpaths.file.parent().unwrap().join(file); let mut s = String::new(); - File::open(&filepath).unwrap().read_to_string(&mut s).unwrap(); + File::open(&filepath) + .unwrap() + .read_to_string(&mut s) + .unwrap(); s } - None => { srcs[srcs.len() - 2].clone() } + None => srcs[srcs.len() - 2].clone(), }; let mut actual = srcs[srcs.len() - 1].clone(); @@ -315,7 +345,9 @@ impl<'test> TestCx<'test> { self.compare_source(&expected, &actual); // If we're only making sure that the output matches then just stop here - if self.props.pretty_compare_only { return; } + if self.props.pretty_compare_only { + return; + } // Finally, let's make sure it actually appears to remain valid code let proc_res = self.typecheck_source(actual); @@ -323,7 +355,9 @@ impl<'test> TestCx<'test> { self.fatal_proc_rec("pretty-printed source does not typecheck", &proc_res); } - if !self.props.pretty_expanded { return } + if !self.props.pretty_expanded { + return; + } // additionally, run `--pretty expanded` and try to build it. let proc_res = self.print_source(srcs[round].clone(), "expanded"); @@ -331,12 +365,16 @@ impl<'test> TestCx<'test> { self.fatal_proc_rec("pretty-printing (expanded) failed", &proc_res); } - let ProcRes{ stdout: expanded_src, .. } = proc_res; + let ProcRes { + stdout: expanded_src, + .. + } = proc_res; let proc_res = self.typecheck_source(expanded_src); if !proc_res.status.success() { self.fatal_proc_rec( "pretty-printed source (expanded) does not typecheck", - &proc_res); + &proc_res, + ); } } @@ -344,37 +382,42 @@ impl<'test> TestCx<'test> { let aux_dir = self.aux_output_dir_name(); let mut rustc = Command::new(&self.config.rustc_path); - rustc.arg("-") + rustc + .arg("-") .arg("-Zunstable-options") .args(&["--unpretty", &pretty_type]) .args(&["--target", &self.config.target]) - .arg("-L").arg(&aux_dir) + .arg("-L") + .arg(&aux_dir) .args(self.split_maybe_args(&self.config.target_rustcflags)) .args(&self.props.compile_flags) .envs(self.props.exec_env.clone()); - self.compose_and_run(rustc, - self.config.compile_lib_path.to_str().unwrap(), - Some(aux_dir.to_str().unwrap()), - Some(src)) + self.compose_and_run( + rustc, + self.config.compile_lib_path.to_str().unwrap(), + Some(aux_dir.to_str().unwrap()), + Some(src), + ) } - fn compare_source(&self, - expected: &str, - actual: &str) { + fn compare_source(&self, expected: &str, actual: &str) { if expected != actual { self.error("pretty-printed source does not match expected source"); - println!("\n\ -expected:\n\ -------------------------------------------\n\ -{}\n\ -------------------------------------------\n\ -actual:\n\ -------------------------------------------\n\ -{}\n\ -------------------------------------------\n\ -\n", - expected, actual); + println!( + "\n\ + expected:\n\ + ------------------------------------------\n\ + {}\n\ + ------------------------------------------\n\ + actual:\n\ + ------------------------------------------\n\ + {}\n\ + ------------------------------------------\n\ + \n", + expected, + actual + ); panic!(); } } @@ -394,12 +437,16 @@ actual:\n\ let aux_dir = self.aux_output_dir_name(); - rustc.arg("-") + rustc + .arg("-") .arg("-Zno-trans") - .arg("--out-dir").arg(&out_dir) + .arg("--out-dir") + .arg(&out_dir) .arg(&format!("--target={}", target)) - .arg("-L").arg(&self.config.build_base) - .arg("-L").arg(aux_dir); + .arg("-L") + .arg(&self.config.build_base) + .arg("-L") + .arg(aux_dir); if let Some(revision) = self.revision { rustc.args(&["--cfg", revision]); @@ -417,7 +464,7 @@ actual:\n\ let config = Config { target_rustcflags: self.cleanup_debug_info_options(&self.config.target_rustcflags), host_rustcflags: self.cleanup_debug_info_options(&self.config.host_rustcflags), - .. self.config.clone() + ..self.config.clone() }; let test_cx = TestCx { @@ -444,7 +491,7 @@ actual:\n\ let DebuggerCommands { commands, check_lines, - breakpoint_lines + breakpoint_lines, } = self.parse_debugger_commands(prefixes); let mut cmds = commands.join("\n"); @@ -458,15 +505,12 @@ actual:\n\ let debugger_run_result; match &*self.config.target { - "arm-linux-androideabi" | - "armv7-linux-androideabi" | - "aarch64-linux-android" => { - + "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => { cmds = cmds.replace("run", "continue"); let tool_path = match self.config.android_cross_path.to_str() { Some(x) => x.to_owned(), - None => self.fatal("cannot find android cross path") + None => self.fatal("cannot find android cross path"), }; // write debugger script @@ -475,15 +519,20 @@ actual:\n\ script_str.push_str(&format!("set sysroot {}\n", tool_path)); script_str.push_str(&format!("file {}\n", exe_file.to_str().unwrap())); script_str.push_str("target remote :5039\n"); - script_str.push_str(&format!("set solib-search-path \ - ./{}/stage2/lib/rustlib/{}/lib/\n", - self.config.host, self.config.target)); + script_str.push_str(&format!( + "set solib-search-path \ + ./{}/stage2/lib/rustlib/{}/lib/\n", + self.config.host, + self.config.target + )); for line in &breakpoint_lines { - script_str.push_str(&format!("break {:?}:{}\n", - self.testpaths.file.file_name() - .unwrap() - .to_string_lossy(), - *line)[..]); + script_str.push_str( + &format!( + "break {:?}:{}\n", + self.testpaths.file.file_name().unwrap().to_string_lossy(), + *line + )[..], + ); } script_str.push_str(&cmds); script_str.push_str("\nquit\n"); @@ -505,14 +554,18 @@ actual:\n\ .status() .expect(&format!("failed to exec `{:?}`", adb_path)); - let adb_arg = format!("export LD_LIBRARY_PATH={}; \ - gdbserver{} :5039 {}/{}", - self.config.adb_test_dir.clone(), - if self.config.target.contains("aarch64") - {"64"} else {""}, - self.config.adb_test_dir.clone(), - exe_file.file_name().unwrap().to_str() - .unwrap()); + let adb_arg = format!( + "export LD_LIBRARY_PATH={}; \ + gdbserver{} :5039 {}/{}", + self.config.adb_test_dir.clone(), + if self.config.target.contains("aarch64") { + "64" + } else { + "" + }, + self.config.adb_test_dir.clone(), + exe_file.file_name().unwrap().to_str().unwrap() + ); debug!("adb arg: {}", adb_arg); let mut adb = Command::new(adb_path) @@ -531,25 +584,26 @@ actual:\n\ line.truncate(0); stdout.read_line(&mut line).unwrap(); if line.starts_with("Listening on port 5039") { - break + break; } } drop(stdout); let debugger_script = self.make_out_name("debugger.script"); // FIXME (#9639): This needs to handle non-utf8 paths - let debugger_opts = - vec!["-quiet".to_owned(), - "-batch".to_owned(), - "-nx".to_owned(), - format!("-command={}", debugger_script.to_str().unwrap())]; + let debugger_opts = vec![ + "-quiet".to_owned(), + "-batch".to_owned(), + "-nx".to_owned(), + format!("-command={}", debugger_script.to_str().unwrap()), + ]; let mut gdb_path = tool_path; gdb_path.push_str("/bin/gdb"); let Output { status, stdout, - stderr + stderr, } = Command::new(&gdb_path) .args(&debugger_opts) .output() @@ -574,14 +628,15 @@ actual:\n\ } _ => { - let rust_src_root = self.config.find_rust_src_root().expect( - "Could not find Rust source root", - ); + let rust_src_root = self.config + .find_rust_src_root() + .expect("Could not find Rust source root"); let rust_pp_module_rel_path = Path::new("./src/etc"); - let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path) - .to_str() - .unwrap() - .to_owned(); + let rust_pp_module_abs_path = rust_src_root + .join(rust_pp_module_rel_path) + .to_str() + .unwrap() + .to_owned(); // write debugger script let mut script_str = String::with_capacity(2048); script_str.push_str(&format!("set charset {}\n", Self::charset())); @@ -589,21 +644,25 @@ actual:\n\ match self.config.gdb_version { Some(version) => { - println!("NOTE: compiletest thinks it is using GDB version {}", - version); + println!( + "NOTE: compiletest thinks it is using GDB version {}", + version + ); if version > extract_gdb_version("7.4").unwrap() { // Add the directory containing the pretty printers to // GDB's script auto loading safe path - script_str.push_str( - &format!("add-auto-load-safe-path {}\n", - rust_pp_module_abs_path.replace(r"\", r"\\")) - ); + script_str.push_str(&format!( + "add-auto-load-safe-path {}\n", + rust_pp_module_abs_path.replace(r"\", r"\\") + )); } } _ => { - println!("NOTE: compiletest does not know which version of \ - GDB it is using"); + println!( + "NOTE: compiletest does not know which version of \ + GDB it is using" + ); } } @@ -612,13 +671,13 @@ actual:\n\ script_str.push_str("set print pretty off\n"); // Add the pretty printer directory to GDB's source-file search path - script_str.push_str(&format!("directory {}\n", - rust_pp_module_abs_path)); + script_str.push_str(&format!("directory {}\n", rust_pp_module_abs_path)); // Load the target executable - script_str.push_str(&format!("file {}\n", - exe_file.to_str().unwrap() - .replace(r"\", r"\\"))); + script_str.push_str(&format!( + "file {}\n", + exe_file.to_str().unwrap().replace(r"\", r"\\") + )); // Force GDB to print values in the Rust format. if self.config.gdb_native_rust { @@ -627,10 +686,11 @@ actual:\n\ // Add line breakpoints for line in &breakpoint_lines { - script_str.push_str(&format!("break '{}':{}\n", - self.testpaths.file.file_name().unwrap() - .to_string_lossy(), - *line)); + script_str.push_str(&format!( + "break '{}':{}\n", + self.testpaths.file.file_name().unwrap().to_string_lossy(), + *line + )); } script_str.push_str(&cmds); @@ -642,21 +702,23 @@ actual:\n\ let debugger_script = self.make_out_name("debugger.script"); // FIXME (#9639): This needs to handle non-utf8 paths - let debugger_opts = - vec!["-quiet".to_owned(), - "-batch".to_owned(), - "-nx".to_owned(), - format!("-command={}", debugger_script.to_str().unwrap())]; + let debugger_opts = vec![ + "-quiet".to_owned(), + "-batch".to_owned(), + "-nx".to_owned(), + format!("-command={}", debugger_script.to_str().unwrap()), + ]; let mut gdb = Command::new(self.config.gdb.as_ref().unwrap()); gdb.args(&debugger_opts) .env("PYTHONPATH", rust_pp_module_abs_path); - debugger_run_result = - self.compose_and_run(gdb, - self.config.run_lib_path.to_str().unwrap(), - None, - None); + debugger_run_result = self.compose_and_run( + gdb, + self.config.run_lib_path.to_str().unwrap(), + None, + None, + ); } } @@ -677,7 +739,7 @@ actual:\n\ let config = Config { target_rustcflags: self.cleanup_debug_info_options(&self.config.target_rustcflags), host_rustcflags: self.cleanup_debug_info_options(&self.config.host_rustcflags), - .. self.config.clone() + ..self.config.clone() }; @@ -700,12 +762,16 @@ actual:\n\ match self.config.lldb_version { Some(ref version) => { - println!("NOTE: compiletest thinks it is using LLDB version {}", - version); + println!( + "NOTE: compiletest thinks it is using LLDB version {}", + version + ); } _ => { - println!("NOTE: compiletest does not know which version of \ - LLDB it is using"); + println!( + "NOTE: compiletest does not know which version of \ + LLDB it is using" + ); } } @@ -725,17 +791,18 @@ actual:\n\ script_str.push_str("version\n"); // Switch LLDB into "Rust mode" - let rust_src_root = self.config.find_rust_src_root().expect( - "Could not find Rust source root", - ); + let rust_src_root = self.config + .find_rust_src_root() + .expect("Could not find Rust source root"); let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py"); - let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path) - .to_str() - .unwrap() - .to_owned(); + let rust_pp_module_abs_path = rust_src_root + .join(rust_pp_module_rel_path) + .to_str() + .unwrap() + .to_owned(); - script_str.push_str(&format!("command script import {}\n", - &rust_pp_module_abs_path[..])[..]); + script_str + .push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[..]); script_str.push_str("type summary add --no-value "); script_str.push_str("--python-function lldb_rust_formatters.print_val "); script_str.push_str("-x \".*\" --category Rust\n"); @@ -744,9 +811,11 @@ actual:\n\ // Set breakpoints on every line that contains the string "#break" let source_file_name = self.testpaths.file.file_name().unwrap().to_string_lossy(); for line in &breakpoint_lines { - script_str.push_str(&format!("breakpoint set --file '{}' --line {}\n", - source_file_name, - line)); + script_str.push_str(&format!( + "breakpoint set --file '{}' --line {}\n", + source_file_name, + line + )); } // Append the other commands @@ -764,9 +833,7 @@ actual:\n\ let debugger_script = self.make_out_name("debugger.script"); // Let LLDB execute the script via lldb_batchmode.py - let debugger_run_result = self.run_lldb(&exe_file, - &debugger_script, - &rust_src_root); + let debugger_run_result = self.run_lldb(&exe_file, &debugger_script, &rust_src_root); if !debugger_run_result.status.success() { self.fatal_proc_rec("Error while running LLDB", &debugger_run_result); @@ -775,32 +842,39 @@ actual:\n\ self.check_debugger_output(&debugger_run_result, &check_lines); } - fn run_lldb(&self, - test_executable: &Path, - debugger_script: &Path, - rust_src_root: &Path) - -> ProcRes { + fn run_lldb( + &self, + test_executable: &Path, + debugger_script: &Path, + rust_src_root: &Path, + ) -> ProcRes { // Prepare the lldb_batchmode which executes the debugger script let lldb_script_path = rust_src_root.join("src/etc/lldb_batchmode.py"); - self.cmd2procres(Command::new(&self.config.lldb_python) - .arg(&lldb_script_path) - .arg(test_executable) - .arg(debugger_script) - .env("PYTHONPATH", - self.config.lldb_python_dir.as_ref().unwrap())) + self.cmd2procres( + Command::new(&self.config.lldb_python) + .arg(&lldb_script_path) + .arg(test_executable) + .arg(debugger_script) + .env("PYTHONPATH", self.config.lldb_python_dir.as_ref().unwrap()), + ) } fn cmd2procres(&self, cmd: &mut Command) -> ProcRes { let (status, out, err) = match cmd.output() { - Ok(Output { status, stdout, stderr }) => { - (status, - String::from_utf8(stdout).unwrap(), - String::from_utf8(stderr).unwrap()) - }, - Err(e) => { - self.fatal(&format!("Failed to setup Python process for \ - LLDB script: {}", e)) - } + Ok(Output { + status, + stdout, + stderr, + }) => ( + status, + String::from_utf8(stdout).unwrap(), + String::from_utf8(stderr).unwrap(), + ), + Err(e) => self.fatal(&format!( + "Failed to setup Python process for \ + LLDB script: {}", + e + )), }; self.dump_output(&out, &err); @@ -808,15 +882,17 @@ actual:\n\ status, stdout: out, stderr: err, - cmdline: format!("{:?}", cmd) + cmdline: format!("{:?}", cmd), } } fn parse_debugger_commands(&self, debugger_prefixes: &[&str]) -> DebuggerCommands { - let directives = debugger_prefixes.iter().map(|prefix| ( - format!("{}-command", prefix), - format!("{}-check", prefix), - )).collect::<Vec<_>>(); + let directives = debugger_prefixes + .iter() + .map(|prefix| { + (format!("{}-command", prefix), format!("{}-check", prefix)) + }) + .collect::<Vec<_>>(); let mut breakpoint_lines = vec![]; let mut commands = vec![]; @@ -831,22 +907,16 @@ actual:\n\ } for &(ref command_directive, ref check_directive) in &directives { - self.config.parse_name_value_directive( - &line, - command_directive).map(|cmd| { - commands.push(cmd) - }); + self.config + .parse_name_value_directive(&line, command_directive) + .map(|cmd| commands.push(cmd)); - self.config.parse_name_value_directive( - &line, - check_directive).map(|cmd| { - check_lines.push(cmd) - }); + self.config + .parse_name_value_directive(&line, check_directive) + .map(|cmd| check_lines.push(cmd)); } } - Err(e) => { - self.fatal(&format!("Error while parsing debugger commands: {}", e)) - } + Err(e) => self.fatal(&format!("Error while parsing debugger commands: {}", e)), } counter += 1; } @@ -864,15 +934,11 @@ actual:\n\ } // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS. - let options_to_remove = [ - "-O".to_owned(), - "-g".to_owned(), - "--debuginfo".to_owned() - ]; - let new_options = - self.split_maybe_args(options).into_iter() - .filter(|x| !options_to_remove.contains(x)) - .collect::<Vec<String>>(); + let options_to_remove = ["-O".to_owned(), "-g".to_owned(), "--debuginfo".to_owned()]; + let new_options = self.split_maybe_args(options) + .into_iter() + .filter(|x| !options_to_remove.contains(x)) + .collect::<Vec<String>>(); Some(new_options.join(" ")) } @@ -891,9 +957,13 @@ actual:\n\ } } if check_line_index != num_check_lines && num_check_lines > 0 { - self.fatal_proc_rec(&format!("line not found in debugger output: {}", - check_lines[check_line_index]), - debugger_run_result); + self.fatal_proc_rec( + &format!( + "line not found in debugger output: {}", + check_lines[check_line_index] + ), + debugger_run_result, + ); } fn check_single_line(line: &str, check_line: &str) -> bool { @@ -904,17 +974,18 @@ actual:\n\ let can_start_anywhere = check_line.starts_with("[...]"); let can_end_anywhere = check_line.ends_with("[...]"); - let check_fragments: Vec<&str> = check_line.split("[...]") - .filter(|frag| !frag.is_empty()) - .collect(); + let check_fragments: Vec<&str> = check_line + .split("[...]") + .filter(|frag| !frag.is_empty()) + .collect(); if check_fragments.is_empty() { return true; } let (mut rest, first_fragment) = if can_start_anywhere { match line.find(check_fragments[0]) { - Some(pos) => (&line[pos + check_fragments[0].len() ..], 1), - None => return false + Some(pos) => (&line[pos + check_fragments[0].len()..], 1), + None => return false, } } else { (line, 0) @@ -923,9 +994,9 @@ actual:\n\ for current_fragment in &check_fragments[first_fragment..] { match rest.find(current_fragment) { Some(pos) => { - rest = &rest[pos + current_fragment.len() .. ]; + rest = &rest[pos + current_fragment.len()..]; } - None => return false + None => return false, } } @@ -937,15 +1008,15 @@ actual:\n\ } } - fn check_error_patterns(&self, - output_to_check: &str, - proc_res: &ProcRes) { + fn check_error_patterns(&self, output_to_check: &str, proc_res: &ProcRes) { if self.props.error_patterns.is_empty() { if self.props.must_compile_successfully { - return + return; } else { - self.fatal(&format!("no error pattern specified in {:?}", - self.testpaths.file.display())); + self.fatal(&format!( + "no error pattern specified in {:?}", + self.testpaths.file.display() + )); } } let mut next_err_idx = 0; @@ -963,13 +1034,16 @@ actual:\n\ next_err_pat = self.props.error_patterns[next_err_idx].trim(); } } - if done { return; } + if done { + return; + } let missing_patterns = &self.props.error_patterns[next_err_idx..]; if missing_patterns.len() == 1 { self.fatal_proc_rec( &format!("error pattern '{}' not found!", missing_patterns[0]), - proc_res); + proc_res, + ); } else { for pattern in missing_patterns { self.error(&format!("error pattern '{}' not found!", *pattern)); @@ -986,9 +1060,7 @@ actual:\n\ } } - fn check_forbid_output(&self, - output_to_check: &str, - proc_res: &ProcRes) { + fn check_forbid_output(&self, output_to_check: &str, proc_res: &ProcRes) { for pat in &self.props.forbid_output { if output_to_check.contains(pat) { self.fatal_proc_rec("forbidden pattern found in compiler output", proc_res); @@ -996,41 +1068,42 @@ actual:\n\ } } - fn check_expected_errors(&self, - expected_errors: Vec<errors::Error>, - proc_res: &ProcRes) { - if proc_res.status.success() && - expected_errors.iter().any(|x| x.kind == Some(ErrorKind::Error)) { + fn check_expected_errors(&self, expected_errors: Vec<errors::Error>, proc_res: &ProcRes) { + if proc_res.status.success() + && expected_errors + .iter() + .any(|x| x.kind == Some(ErrorKind::Error)) + { self.fatal_proc_rec("process did not return an error status", proc_res); } - let file_name = - format!("{}", self.testpaths.file.display()) - .replace(r"\", "/"); // on windows, translate all '\' path separators to '/' + // on windows, translate all '\' path separators to '/' + let file_name = format!("{}", self.testpaths.file.display()).replace(r"\", "/"); // If the testcase being checked contains at least one expected "help" // message, then we'll ensure that all "help" messages are expected. // Otherwise, all "help" messages reported by the compiler will be ignored. // This logic also applies to "note" messages. - let expect_help = expected_errors.iter().any(|ee| ee.kind == Some(ErrorKind::Help)); - let expect_note = expected_errors.iter().any(|ee| ee.kind == Some(ErrorKind::Note)); + let expect_help = expected_errors + .iter() + .any(|ee| ee.kind == Some(ErrorKind::Help)); + let expect_note = expected_errors + .iter() + .any(|ee| ee.kind == Some(ErrorKind::Note)); // Parse the JSON output from the compiler and extract out the messages. let actual_errors = json::parse_output(&file_name, &proc_res.stderr, proc_res); let mut unexpected = Vec::new(); let mut found = vec![false; expected_errors.len()]; for actual_error in &actual_errors { - let opt_index = - expected_errors - .iter() - .enumerate() - .position(|(index, expected_error)| { - !found[index] && - actual_error.line_num == expected_error.line_num && - (expected_error.kind.is_none() || - actual_error.kind == expected_error.kind) && - actual_error.msg.contains(&expected_error.msg) - }); + let opt_index = expected_errors.iter().enumerate().position( + |(index, expected_error)| { + !found[index] && actual_error.line_num == expected_error.line_num + && (expected_error.kind.is_none() + || actual_error.kind == expected_error.kind) + && actual_error.msg.contains(&expected_error.msg) + }, + ); match opt_index { Some(index) => { @@ -1041,14 +1114,16 @@ actual:\n\ None => { if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) { - self.error( - &format!("{}:{}: unexpected {}: '{}'", - file_name, - actual_error.line_num, - actual_error.kind.as_ref() - .map_or(String::from("message"), - |k| k.to_string()), - actual_error.msg)); + self.error(&format!( + "{}:{}: unexpected {}: '{}'", + file_name, + actual_error.line_num, + actual_error + .kind + .as_ref() + .map_or(String::from("message"), |k| k.to_string()), + actual_error.msg + )); unexpected.push(actual_error); } } @@ -1059,24 +1134,27 @@ actual:\n\ // anything not yet found is a problem for (index, expected_error) in expected_errors.iter().enumerate() { if !found[index] { - self.error( - &format!("{}:{}: expected {} not found: {}", - file_name, - expected_error.line_num, - expected_error.kind.as_ref() - .map_or("message".into(), - |k| k.to_string()), - expected_error.msg)); + self.error(&format!( + "{}:{}: expected {} not found: {}", + file_name, + expected_error.line_num, + expected_error + .kind + .as_ref() + .map_or("message".into(), |k| k.to_string()), + expected_error.msg + )); not_found.push(expected_error); } } if !unexpected.is_empty() || !not_found.is_empty() { - self.error( - &format!("{} unexpected errors found, {} expected errors not found", - unexpected.len(), not_found.len())); - println!("status: {}\ncommand: {}", - proc_res.status, proc_res.cmdline); + self.error(&format!( + "{} unexpected errors found, {} expected errors not found", + unexpected.len(), + not_found.len() + )); + println!("status: {}\ncommand: {}", proc_res.status, proc_res.cmdline); if !unexpected.is_empty() { println!("unexpected errors (from JSON output): {:#?}\n", unexpected); } @@ -1091,24 +1169,25 @@ actual:\n\ /// which did not match any of the expected error. We always require /// errors/warnings to be explicitly listed, but only require /// helps/notes if there are explicit helps/notes given. - fn is_unexpected_compiler_message(&self, - actual_error: &Error, - expect_help: bool, - expect_note: bool) - -> bool { + fn is_unexpected_compiler_message( + &self, + actual_error: &Error, + expect_help: bool, + expect_note: bool, + ) -> bool { match actual_error.kind { Some(ErrorKind::Help) => expect_help, Some(ErrorKind::Note) => expect_note, - Some(ErrorKind::Error) | - Some(ErrorKind::Warning) => true, - Some(ErrorKind::Suggestion) | - None => false + Some(ErrorKind::Error) | Some(ErrorKind::Warning) => true, + Some(ErrorKind::Suggestion) | None => false, } } fn compile_test(&self) -> ProcRes { let mut rustc = self.make_compile_args( - &self.testpaths.file, TargetLocation::ThisFile(self.make_exe_name())); + &self.testpaths.file, + TargetLocation::ThisFile(self.make_exe_name()), + ); rustc.arg("-L").arg(&self.aux_output_dir_name()); @@ -1131,14 +1210,14 @@ actual:\n\ if self.props.build_aux_docs { for rel_ab in &self.props.aux_builds { let aux_testpaths = self.compute_aux_test_paths(rel_ab); - let aux_props = self.props.from_aux_file(&aux_testpaths.file, - self.revision, - self.config); + let aux_props = + self.props + .from_aux_file(&aux_testpaths.file, self.revision, self.config); let aux_cx = TestCx { config: self.config, props: &aux_props, testpaths: &aux_testpaths, - revision: self.revision + revision: self.revision, }; let auxres = aux_cx.document(out_dir); if !auxres.status.success() { @@ -1149,15 +1228,25 @@ actual:\n\ let aux_dir = self.aux_output_dir_name(); - let rustdoc_path = self.config.rustdoc_path.as_ref().expect("--rustdoc-path passed"); + let rustdoc_path = self.config + .rustdoc_path + .as_ref() + .expect("--rustdoc-path passed"); let mut rustdoc = Command::new(rustdoc_path); - rustdoc.arg("-L").arg(aux_dir) - .arg("-o").arg(out_dir) + rustdoc + .arg("-L") + .arg(aux_dir) + .arg("-o") + .arg(out_dir) .arg(&self.testpaths.file) .args(&self.props.compile_flags); if let Some(ref linker) = self.config.linker { - rustdoc.arg("--linker").arg(linker).arg("-Z").arg("unstable-options"); + rustdoc + .arg("--linker") + .arg(linker) + .arg("-Z") + .arg("unstable-options"); } self.compose_and_run_compiler(rustdoc, None) @@ -1166,7 +1255,7 @@ actual:\n\ fn exec_compiled_test(&self) -> ProcRes { let env = &self.props.exec_env; - match &*self.config.target { + let proc_res = match &*self.config.target { // This is pretty similar to below, we're transforming: // // program arg1 arg2 @@ -1187,59 +1276,77 @@ actual:\n\ for entry in entries { let entry = entry.unwrap(); if !entry.path().is_file() { - continue + continue; } prog.push_str(":"); prog.push_str(entry.path().to_str().unwrap()); } } - let mut test_client = Command::new( - self.config.remote_test_client.as_ref().unwrap()); + let mut test_client = + Command::new(self.config.remote_test_client.as_ref().unwrap()); test_client .args(&["run", &prog]) .args(args) .envs(env.clone()); - self.compose_and_run(test_client, - self.config.run_lib_path.to_str().unwrap(), - Some(aux_dir.to_str().unwrap()), - None) + self.compose_and_run( + test_client, + self.config.run_lib_path.to_str().unwrap(), + Some(aux_dir.to_str().unwrap()), + None, + ) } _ => { let aux_dir = self.aux_output_dir_name(); let ProcArgs { prog, args } = self.make_run_args(); let mut program = Command::new(&prog); - program.args(args) + program + .args(args) .current_dir(&self.output_base_name().parent().unwrap()) .envs(env.clone()); - self.compose_and_run(program, - self.config.run_lib_path.to_str().unwrap(), - Some(aux_dir.to_str().unwrap()), - None) + self.compose_and_run( + program, + self.config.run_lib_path.to_str().unwrap(), + Some(aux_dir.to_str().unwrap()), + None, + ) } + }; + + if proc_res.status.success() { + // delete the executable after running it to save space. + // it is ok if the deletion failed. + let _ = fs::remove_file(self.make_exe_name()); } + + proc_res } /// For each `aux-build: foo/bar` annotation, we check to find the /// file in a `aux` directory relative to the test itself. fn compute_aux_test_paths(&self, rel_ab: &str) -> TestPaths { - let test_ab = self.testpaths.file - .parent() - .expect("test file path has no parent") - .join("auxiliary") - .join(rel_ab); + let test_ab = self.testpaths + .file + .parent() + .expect("test file path has no parent") + .join("auxiliary") + .join(rel_ab); if !test_ab.exists() { - self.fatal(&format!("aux-build `{}` source not found", test_ab.display())) + self.fatal(&format!( + "aux-build `{}` source not found", + test_ab.display() + )) } TestPaths { file: test_ab, base: self.testpaths.base.clone(), - relative_dir: self.testpaths.relative_dir - .join("auxiliary") - .join(rel_ab) - .parent() - .expect("aux-build path has no parent") - .to_path_buf() + relative_dir: self.testpaths + .relative_dir + .join("auxiliary") + .join(rel_ab) + .parent() + .expect("aux-build path has no parent") + .to_path_buf(), } } @@ -1252,9 +1359,9 @@ actual:\n\ for rel_ab in &self.props.aux_builds { let aux_testpaths = self.compute_aux_test_paths(rel_ab); - let aux_props = self.props.from_aux_file(&aux_testpaths.file, - self.revision, - self.config); + let aux_props = + self.props + .from_aux_file(&aux_testpaths.file, self.revision, self.config); let aux_output = { let f = self.make_lib_name(&self.testpaths.file); let parent = f.parent().unwrap(); @@ -1264,15 +1371,16 @@ actual:\n\ config: self.config, props: &aux_props, testpaths: &aux_testpaths, - revision: self.revision + revision: self.revision, }; let mut aux_rustc = aux_cx.make_compile_args(&aux_testpaths.file, aux_output); let crate_type = if aux_props.no_prefer_dynamic { None - } else if (self.config.target.contains("musl") && !aux_props.force_host) || - self.config.target.contains("wasm32") || - self.config.target.contains("emscripten") { + } else if (self.config.target.contains("musl") && !aux_props.force_host) + || self.config.target.contains("wasm32") + || self.config.target.contains("emscripten") + { // We primarily compile all auxiliary libraries as dynamic libraries // to avoid code size bloat and large binaries as much as possible // for the test suite (otherwise including libstd statically in all @@ -1293,32 +1401,40 @@ actual:\n\ aux_rustc.arg("-L").arg(&aux_dir); - let auxres = aux_cx.compose_and_run(aux_rustc, - aux_cx.config.compile_lib_path.to_str().unwrap(), - Some(aux_dir.to_str().unwrap()), - None); + let auxres = aux_cx.compose_and_run( + aux_rustc, + aux_cx.config.compile_lib_path.to_str().unwrap(), + Some(aux_dir.to_str().unwrap()), + None, + ); if !auxres.status.success() { self.fatal_proc_rec( - &format!("auxiliary build of {:?} failed to compile: ", - aux_testpaths.file.display()), - &auxres); + &format!( + "auxiliary build of {:?} failed to compile: ", + aux_testpaths.file.display() + ), + &auxres, + ); } } rustc.envs(self.props.rustc_env.clone()); - self.compose_and_run(rustc, - self.config.compile_lib_path.to_str().unwrap(), - Some(aux_dir.to_str().unwrap()), - input) + self.compose_and_run( + rustc, + self.config.compile_lib_path.to_str().unwrap(), + Some(aux_dir.to_str().unwrap()), + input, + ) } - fn compose_and_run(&self, - mut command: Command, - lib_path: &str, - aux_path: Option<&str>, - input: Option<String>) -> ProcRes { - let cmdline = - { + fn compose_and_run( + &self, + mut command: Command, + lib_path: &str, + aux_path: Option<&str>, + input: Option<String>, + ) -> ProcRes { + let cmdline = { let cmdline = self.make_cmdline(&command, lib_path); logv(self.config, format!("executing {}", cmdline)); cmdline @@ -1342,13 +1458,23 @@ actual:\n\ let newpath = env::join_paths(&path).unwrap(); command.env(dylib_env_var(), newpath); - let mut child = command.spawn().expect(&format!("failed to exec `{:?}`", &command)); + let mut child = command + .spawn() + .expect(&format!("failed to exec `{:?}`", &command)); if let Some(input) = input { - child.stdin.as_mut().unwrap().write_all(input.as_bytes()).unwrap(); + child + .stdin + .as_mut() + .unwrap() + .write_all(input.as_bytes()) + .unwrap(); } - let Output { status, stdout, stderr } = read2_abbreviated(child) - .expect("failed to read output"); + let Output { + status, + stdout, + stderr, + } = read2_abbreviated(child).expect("failed to read output"); let result = ProcRes { status, @@ -1364,13 +1490,13 @@ actual:\n\ fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> Command { let mut rustc = Command::new(&self.config.rustc_path); - rustc.arg(input_file) - .arg("-L").arg(&self.config.build_base); + rustc.arg(input_file).arg("-L").arg(&self.config.build_base); // Optionally prevent default --target if specified in test compile-flags. - let custom_target = self.props.compile_flags + let custom_target = self.props + .compile_flags .iter() - .fold(false, |acc, x| acc || x.starts_with("--target")); + .any(|x| x.starts_with("--target")); if !custom_target { let target = if self.props.force_host { @@ -1387,15 +1513,20 @@ actual:\n\ } if let Some(ref incremental_dir) = self.props.incremental_dir { - rustc.args(&["-Z", &format!("incremental={}", incremental_dir.display())]); + rustc.args(&[ + "-C", + &format!("incremental={}", incremental_dir.display()), + ]); rustc.args(&["-Z", "incremental-verify-ich"]); rustc.args(&["-Z", "incremental-queries"]); } + if self.config.mode == CodegenUnits { + rustc.args(&["-Z", "human_readable_cgu_names"]); + } + match self.config.mode { - CompileFail | - ParseFail | - Incremental => { + CompileFail | ParseFail | Incremental => { // If we are extracting and matching errors in the new // fashion, then you want JSON mode. Old-skool error // patterns still match the raw compiler output. @@ -1403,11 +1534,19 @@ actual:\n\ rustc.args(&["--error-format", "json"]); } } + Ui => if !self.props + .compile_flags + .iter() + .any(|s| s.starts_with("--error-format")) + { + rustc.args(&["--error-format", "json"]); + }, MirOpt => { rustc.args(&[ "-Zdump-mir=all", "-Zmir-opt-level=3", - "-Zdump-mir-exclude-pass-number"]); + "-Zdump-mir-exclude-pass-number", + ]); let mir_dump_dir = self.get_mir_dump_dir(); let _ = fs::remove_dir_all(&mir_dump_dir); @@ -1427,7 +1566,6 @@ actual:\n\ Codegen | Rustdoc | RunMake | - Ui | CodegenUnits => { // do not use JSON output } @@ -1528,26 +1666,21 @@ actual:\n\ args.extend(self.split_maybe_args(&self.props.run_flags)); let prog = args.remove(0); - ProcArgs { - prog, - args, - } + ProcArgs { prog, args } } fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<String> { match *argstr { - Some(ref s) => { - s - .split(' ') - .filter_map(|s| { - if s.chars().all(|c| c.is_whitespace()) { - None - } else { - Some(s.to_owned()) - } - }).collect() - } - None => Vec::new() + Some(ref s) => s.split(' ') + .filter_map(|s| { + if s.chars().all(|c| c.is_whitespace()) { + None + } else { + Some(s.to_owned()) + } + }) + .collect(), + None => Vec::new(), } } @@ -1561,7 +1694,11 @@ actual:\n\ // Build the LD_LIBRARY_PATH variable as it would be seen on the command line // for diagnostic purposes fn lib_path_cmd_prefix(path: &str) -> String { - format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path)) + format!( + "{}=\"{}\"", + util::lib_path_env_var(), + util::make_new_path(path) + ) } format!("{} {:?}", lib_path_cmd_prefix(libpath), command) @@ -1580,11 +1717,12 @@ actual:\n\ self.maybe_dump_to_stdout(out, err); } - fn dump_output_file(&self, - out: &str, - extension: &str) { + fn dump_output_file(&self, out: &str, extension: &str) { let outfile = self.make_out_name(extension); - File::create(&outfile).unwrap().write_all(out.as_bytes()).unwrap(); + File::create(&outfile) + .unwrap() + .write_all(out.as_bytes()) + .unwrap(); } fn make_out_name(&self, extension: &str) -> PathBuf { @@ -1609,8 +1747,7 @@ actual:\n\ let dir = self.config.build_base.join(&self.testpaths.relative_dir); // Note: The directory `dir` is created during `collect_tests_from_dir` - dir - .join(&self.output_testname(&self.testpaths.file)) + dir.join(&self.output_testname(&self.testpaths.file)) .with_extension(&self.config.stage_id) } @@ -1627,12 +1764,13 @@ actual:\n\ fn error(&self, err: &str) { match self.revision { Some(rev) => println!("\nerror in revision `{}`: {}", rev, err), - None => println!("\nerror: {}", err) + None => println!("\nerror: {}", err), } } fn fatal(&self, err: &str) -> ! { - self.error(err); panic!(); + self.error(err); + panic!(); } fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> ! { @@ -1648,10 +1786,10 @@ actual:\n\ // errors here. fn try_print_open_handles(&self) { if !cfg!(windows) { - return + return; } if self.config.mode != Incremental { - return + return; } let filename = match self.testpaths.file.file_stem() { @@ -1685,11 +1823,10 @@ actual:\n\ fn compile_test_and_save_ir(&self) -> ProcRes { let aux_dir = self.aux_output_dir_name(); - let output_file = TargetLocation::ThisDirectory( - self.output_base_name().parent().unwrap().to_path_buf()); + let output_file = + TargetLocation::ThisDirectory(self.output_base_name().parent().unwrap().to_path_buf()); let mut rustc = self.make_compile_args(&self.testpaths.file, output_file); - rustc.arg("-L").arg(aux_dir) - .arg("--emit=llvm-ir"); + rustc.arg("-L").arg(aux_dir).arg("--emit=llvm-ir"); self.compose_and_run_compiler(rustc, None) } @@ -1697,7 +1834,9 @@ actual:\n\ fn check_ir_with_filecheck(&self) -> ProcRes { let irfile = self.output_base_name().with_extension("ll"); let mut filecheck = Command::new(self.config.llvm_filecheck.as_ref().unwrap()); - filecheck.arg("--input-file").arg(irfile) + filecheck + .arg("--input-file") + .arg(irfile) .arg(&self.testpaths.file); self.compose_and_run(filecheck, "", None, None) } @@ -1759,105 +1898,119 @@ actual:\n\ } } - fn get_lines<P: AsRef<Path>>(&self, path: &P, - mut other_files: Option<&mut Vec<String>>) -> Vec<usize> { - let mut file = fs::File::open(path) - .expect("markdown_test_output_check_entry File::open failed"); + fn get_lines<P: AsRef<Path>>( + &self, + path: &P, + mut other_files: Option<&mut Vec<String>>, + ) -> Vec<usize> { + let mut file = + fs::File::open(path).expect("markdown_test_output_check_entry File::open failed"); let mut content = String::new(); file.read_to_string(&mut content) .expect("markdown_test_output_check_entry read_to_string failed"); let mut ignore = false; - content.lines() - .enumerate() - .filter_map(|(line_nb, line)| { - if (line.trim_left().starts_with("pub mod ") || - line.trim_left().starts_with("mod ")) && - line.ends_with(';') { - if let Some(ref mut other_files) = other_files { - other_files.push(line.rsplit("mod ") - .next() - .unwrap() - .replace(";", "")); - } - None - } else { - let sline = line.split("///").last().unwrap_or(""); - let line = sline.trim_left(); - if line.starts_with("```") { - if ignore { - ignore = false; - None - } else { - ignore = true; - Some(line_nb + 1) - } - } else { - None - } - } - }) - .collect() + content + .lines() + .enumerate() + .filter_map(|(line_nb, line)| { + if (line.trim_left().starts_with("pub mod ") + || line.trim_left().starts_with("mod ")) + && line.ends_with(';') + { + if let Some(ref mut other_files) = other_files { + other_files.push(line.rsplit("mod ").next().unwrap().replace(";", "")); + } + None + } else { + let sline = line.split("///").last().unwrap_or(""); + let line = sline.trim_left(); + if line.starts_with("```") { + if ignore { + ignore = false; + None + } else { + ignore = true; + Some(line_nb + 1) + } + } else { + None + } + } + }) + .collect() } fn check_rustdoc_test_option(&self, res: ProcRes) { let mut other_files = Vec::new(); let mut files: HashMap<String, Vec<usize>> = HashMap::new(); let cwd = env::current_dir().unwrap(); - files.insert(self.testpaths.file.strip_prefix(&cwd) - .unwrap_or(&self.testpaths.file) - .to_str() - .unwrap() - .replace('\\', "/"), - self.get_lines(&self.testpaths.file, Some(&mut other_files))); + files.insert( + self.testpaths + .file + .strip_prefix(&cwd) + .unwrap_or(&self.testpaths.file) + .to_str() + .unwrap() + .replace('\\', "/"), + self.get_lines(&self.testpaths.file, Some(&mut other_files)), + ); for other_file in other_files { let mut path = self.testpaths.file.clone(); path.set_file_name(&format!("{}.rs", other_file)); - files.insert(path.strip_prefix(&cwd) - .unwrap_or(&path) - .to_str() - .unwrap() - .replace('\\', "/"), - self.get_lines(&path, None)); + files.insert( + path.strip_prefix(&cwd) + .unwrap_or(&path) + .to_str() + .unwrap() + .replace('\\', "/"), + self.get_lines(&path, None), + ); } let mut tested = 0; - for _ in res.stdout.split('\n') - .filter(|s| s.starts_with("test ")) - .inspect(|s| { - let tmp: Vec<&str> = s.split(" - ").collect(); - if tmp.len() == 2 { - let path = tmp[0].rsplit("test ").next().unwrap(); - if let Some(ref mut v) = files.get_mut( - &path.replace('\\', "/")) { - tested += 1; - let mut iter = tmp[1].split("(line "); - iter.next(); - let line = iter.next() - .unwrap_or(")") - .split(')') - .next() - .unwrap_or("0") - .parse() - .unwrap_or(0); - if let Ok(pos) = v.binary_search(&line) { - v.remove(pos); - } else { - self.fatal_proc_rec( - &format!("Not found doc test: \"{}\" in \"{}\":{:?}", - s, path, v), - &res); - } - } - } - }) {} + for _ in res.stdout + .split('\n') + .filter(|s| s.starts_with("test ")) + .inspect(|s| { + let tmp: Vec<&str> = s.split(" - ").collect(); + if tmp.len() == 2 { + let path = tmp[0].rsplit("test ").next().unwrap(); + if let Some(ref mut v) = files.get_mut(&path.replace('\\', "/")) { + tested += 1; + let mut iter = tmp[1].split("(line "); + iter.next(); + let line = iter.next() + .unwrap_or(")") + .split(')') + .next() + .unwrap_or("0") + .parse() + .unwrap_or(0); + if let Ok(pos) = v.binary_search(&line) { + v.remove(pos); + } else { + self.fatal_proc_rec( + &format!("Not found doc test: \"{}\" in \"{}\":{:?}", s, path, v), + &res, + ); + } + } + } + }) {} if tested == 0 { self.fatal_proc_rec(&format!("No test has been found... {:?}", files), &res); } else { for (entry, v) in &files { if !v.is_empty() { - self.fatal_proc_rec(&format!("Not found test at line{} \"{}\":{:?}", - if v.len() > 1 { "s" } else { "" }, entry, v), - &res); + self.fatal_proc_rec( + &format!( + "Not found test at line{} \"{}\":{:?}", + if v.len() > 1 { "s" } else { "" }, + entry, + v + ), + &res, + ); } } } @@ -1893,13 +2046,13 @@ actual:\n\ let mut wrong_cgus = Vec::new(); for expected_item in &expected { - let actual_item_with_same_name = actual.iter() - .find(|ti| ti.name == expected_item.name); + let actual_item_with_same_name = actual.iter().find(|ti| ti.name == expected_item.name); if let Some(actual_item) = actual_item_with_same_name { if !expected_item.codegen_units.is_empty() && // Also check for codegen units - expected_item.codegen_units != actual_item.codegen_units { + expected_item.codegen_units != actual_item.codegen_units + { wrong_cgus.push((expected_item.clone(), actual_item.clone())); } } else { @@ -1907,11 +2060,11 @@ actual:\n\ } } - let unexpected: Vec<_> = - actual.iter() - .filter(|acgu| !expected.iter().any(|ecgu| acgu.name == ecgu.name)) - .map(|acgu| acgu.string.clone()) - .collect(); + let unexpected: Vec<_> = actual + .iter() + .filter(|acgu| !expected.iter().any(|ecgu| acgu.name == ecgu.name)) + .map(|acgu| acgu.string.clone()) + .collect(); if !missing.is_empty() { missing.sort(); @@ -1947,14 +2100,19 @@ actual:\n\ for &(ref expected_item, ref actual_item) in &wrong_cgus { println!("{}", expected_item.name); - println!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units)); - println!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units)); + println!( + " expected: {}", + codegen_units_to_str(&expected_item.codegen_units) + ); + println!( + " actual: {}", + codegen_units_to_str(&actual_item.codegen_units) + ); println!(""); } } - if !(missing.is_empty() && unexpected.is_empty() && wrong_cgus.is_empty()) - { + if !(missing.is_empty() && unexpected.is_empty() && wrong_cgus.is_empty()) { panic!(); } @@ -1976,22 +2134,22 @@ actual:\n\ let full_string = format!("{}{}", PREFIX, s.trim().to_owned()); let parts: Vec<&str> = s.split(CGU_MARKER) - .map(str::trim) - .filter(|s| !s.is_empty()) - .collect(); + .map(str::trim) + .filter(|s| !s.is_empty()) + .collect(); let name = parts[0].trim(); let cgus = if parts.len() > 1 { let cgus_str = parts[1]; - cgus_str.split(' ') - .map(str::trim) - .filter(|s| !s.is_empty()) - .map(str::to_owned) - .collect() - } - else { + cgus_str + .split(' ') + .map(str::trim) + .filter(|s| !s.is_empty()) + .map(str::to_owned) + .collect() + } else { HashSet::new() }; @@ -2002,8 +2160,7 @@ actual:\n\ } } - fn codegen_units_to_str(cgus: &HashSet<String>) -> String - { + fn codegen_units_to_str(cgus: &HashSet<String>) -> String { let mut cgus: Vec<_> = cgus.iter().collect(); cgus.sort(); @@ -2034,7 +2191,10 @@ actual:\n\ fs::create_dir_all(&incremental_dir).unwrap(); if self.config.verbose { - print!("init_incremental_test: incremental_dir={}", incremental_dir.display()); + print!( + "init_incremental_test: incremental_dir={}", + incremental_dir.display() + ); } } @@ -2058,11 +2218,15 @@ actual:\n\ // FIXME -- use non-incremental mode as an oracle? That doesn't apply // to #[rustc_dirty] and clean tests I guess - let revision = self.revision.expect("incremental tests require a list of revisions"); + let revision = self.revision + .expect("incremental tests require a list of revisions"); // Incremental workproduct directory should have already been created. let incremental_dir = self.incremental_dir(); - assert!(incremental_dir.exists(), "init_incremental_test failed to create incremental dir"); + assert!( + incremental_dir.exists(), + "init_incremental_test failed to create incremental dir" + ); // Add an extra flag pointing at the incremental directory. let mut revision_props = self.props.clone(); @@ -2076,7 +2240,11 @@ actual:\n\ }; if self.config.verbose { - print!("revision={:?} revision_props={:#?}", revision, revision_props); + print!( + "revision={:?} revision_props={:#?}", + revision, + revision_props + ); } if revision.starts_with("rpass") { @@ -2086,8 +2254,7 @@ actual:\n\ } else if revision.starts_with("cfail") { revision_cx.run_cfail_test(); } else { - revision_cx.fatal( - "revision name must begin with rpass, rfail, or cfail"); + revision_cx.fatal("revision name must begin with rpass, rfail, or cfail"); } } @@ -2099,13 +2266,18 @@ actual:\n\ fn run_rmake_test(&self) { // FIXME(#11094): we should fix these tests if self.config.host != self.config.target { - return + return; } let cwd = env::current_dir().unwrap(); - let src_root = self.config.src_base.parent().unwrap() - .parent().unwrap() - .parent().unwrap(); + let src_root = self.config + .src_base + .parent() + .unwrap() + .parent() + .unwrap() + .parent() + .unwrap(); let src_root = cwd.join(&src_root); let tmpdir = cwd.join(self.output_base_name()); @@ -2115,9 +2287,10 @@ actual:\n\ create_dir_all(&tmpdir).unwrap(); let host = &self.config.host; - let make = if host.contains("bitrig") || host.contains("dragonfly") || - host.contains("freebsd") || host.contains("netbsd") || - host.contains("openbsd") { + let make = if host.contains("bitrig") || host.contains("dragonfly") + || host.contains("freebsd") || host.contains("netbsd") + || host.contains("openbsd") + { "gmake" } else { "make" @@ -2125,21 +2298,26 @@ actual:\n\ let mut cmd = Command::new(make); cmd.current_dir(&self.testpaths.file) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .env("TARGET", &self.config.target) - .env("PYTHON", &self.config.docck_python) - .env("S", src_root) - .env("RUST_BUILD_STAGE", &self.config.stage_id) - .env("RUSTC", cwd.join(&self.config.rustc_path)) - .env("RUSTDOC", - cwd.join(&self.config.rustdoc_path.as_ref().expect("--rustdoc-path passed"))) - .env("TMPDIR", &tmpdir) - .env("LD_LIB_PATH_ENVVAR", dylib_env_var()) - .env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path)) - .env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path)) - .env("LLVM_COMPONENTS", &self.config.llvm_components) - .env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags); + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .env("TARGET", &self.config.target) + .env("PYTHON", &self.config.docck_python) + .env("S", src_root) + .env("RUST_BUILD_STAGE", &self.config.stage_id) + .env("RUSTC", cwd.join(&self.config.rustc_path)) + .env( + "RUSTDOC", + cwd.join(&self.config + .rustdoc_path + .as_ref() + .expect("--rustdoc-path passed")), + ) + .env("TMPDIR", &tmpdir) + .env("LD_LIB_PATH_ENVVAR", dylib_env_var()) + .env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path)) + .env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path)) + .env("LLVM_COMPONENTS", &self.config.llvm_components) + .env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags); if let Some(ref linker) = self.config.linker { cmd.env("RUSTC_LINKER", linker); @@ -2157,25 +2335,31 @@ actual:\n\ // MSYS doesn't like passing flags of the form `/foo` as it thinks it's // a path and instead passes `C:\msys64\foo`, so convert all // `/`-arguments to MSVC here to `-` arguments. - let cflags = self.config.cflags.split(' ').map(|s| s.replace("/", "-")) - .collect::<Vec<_>>().join(" "); + let cflags = self.config + .cflags + .split(' ') + .map(|s| s.replace("/", "-")) + .collect::<Vec<_>>() + .join(" "); cmd.env("IS_MSVC", "1") - .env("IS_WINDOWS", "1") - .env("MSVC_LIB", format!("'{}' -nologo", lib.display())) - .env("CC", format!("'{}' {}", self.config.cc, cflags)) - .env("CXX", &self.config.cxx); + .env("IS_WINDOWS", "1") + .env("MSVC_LIB", format!("'{}' -nologo", lib.display())) + .env("CC", format!("'{}' {}", self.config.cc, cflags)) + .env("CXX", &self.config.cxx); } else { cmd.env("CC", format!("{} {}", self.config.cc, self.config.cflags)) - .env("CXX", format!("{} {}", self.config.cxx, self.config.cflags)) - .env("AR", &self.config.ar); + .env("CXX", format!("{} {}", self.config.cxx, self.config.cflags)) + .env("AR", &self.config.ar); if self.config.target.contains("windows") { cmd.env("IS_WINDOWS", "1"); } } - let output = cmd.spawn().and_then(read2_abbreviated).expect("failed to spawn `make`"); + let output = cmd.spawn() + .and_then(read2_abbreviated) + .expect("failed to spawn `make`"); if !output.status.success() { let res = ProcRes { status: output.status, @@ -2211,18 +2395,33 @@ actual:\n\ } fn run_ui_test(&self) { - let proc_res = self.compile_test(); + // if the user specified a format in the ui test + // print the output to the stderr file, otherwise extract + // the rendered error messages from json and print them + let explicit = self.props + .compile_flags + .iter() + .any(|s| s.contains("--error-format")); - let expected_stderr_path = self.expected_output_path("stderr"); + let proc_res = self.compile_test(); + self.check_if_test_should_compile(&proc_res); + + let expected_stderr_path = self.expected_output_path(UI_STDERR); let expected_stderr = self.load_expected_output(&expected_stderr_path); - let expected_stdout_path = self.expected_output_path("stdout"); + let expected_stdout_path = self.expected_output_path(UI_STDOUT); let expected_stdout = self.load_expected_output(&expected_stdout_path); let normalized_stdout = self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout); - let normalized_stderr = - self.normalize_output(&proc_res.stderr, &self.props.normalize_stderr); + + let stderr = if explicit { + proc_res.stderr.clone() + } else { + json::extract_rendered(&proc_res.stderr, &proc_res) + }; + + let normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr); let mut errors = 0; errors += self.compare_output("stdout", &normalized_stdout, &expected_stdout); @@ -2230,17 +2429,23 @@ actual:\n\ if errors > 0 { println!("To update references, run this command from build directory:"); - let relative_path_to_file = - self.testpaths.relative_dir - .join(self.testpaths.file.file_name().unwrap()); - println!("{}/update-references.sh '{}' '{}'", - self.config.src_base.display(), - self.config.build_base.display(), - relative_path_to_file.display()); - self.fatal_proc_rec(&format!("{} errors occurred comparing output.", errors), - &proc_res); + let relative_path_to_file = self.testpaths + .relative_dir + .join(self.testpaths.file.file_name().unwrap()); + println!( + "{}/update-references.sh '{}' '{}'", + self.config.src_base.display(), + self.config.build_base.display(), + relative_path_to_file.display() + ); + self.fatal_proc_rec( + &format!("{} errors occurred comparing output.", errors), + &proc_res, + ); } + let expected_errors = errors::load_errors(&self.testpaths.file, self.revision); + if self.props.run_pass { let proc_res = self.exec_compiled_test(); @@ -2248,6 +2453,15 @@ actual:\n\ self.fatal_proc_rec("test run failed!", &proc_res); } } + if !explicit { + if !expected_errors.is_empty() || !proc_res.status.success() { + // "// error-pattern" comments + self.check_expected_errors(expected_errors, &proc_res); + } else if !self.props.error_patterns.is_empty() || !proc_res.status.success() { + // "//~ERROR comments" + self.check_error_patterns(&proc_res.stderr, &proc_res); + } + } } fn run_mir_opt_test(&self) { @@ -2267,13 +2481,14 @@ actual:\n\ fn check_mir_dump(&self) { let mut test_file_contents = String::new(); - fs::File::open(self.testpaths.file.clone()).unwrap() - .read_to_string(&mut test_file_contents) - .unwrap(); - if let Some(idx) = test_file_contents.find("// END RUST SOURCE") { + fs::File::open(self.testpaths.file.clone()) + .unwrap() + .read_to_string(&mut test_file_contents) + .unwrap(); + if let Some(idx) = test_file_contents.find("// END RUST SOURCE") { let (_, tests_text) = test_file_contents.split_at(idx + "// END_RUST SOURCE".len()); let tests_text_str = String::from(tests_text); - let mut curr_test : Option<&str> = None; + let mut curr_test: Option<&str> = None; let mut curr_test_contents = vec![ExpectedLine::Elision]; for l in tests_text_str.lines() { debug!("line: {:?}", l); @@ -2307,9 +2522,16 @@ actual:\n\ let output_time = t(output_file); let source_time = t(source_file); if source_time > output_time { - debug!("source file time: {:?} output file time: {:?}", source_time, output_time); - panic!("test source file `{}` is newer than potentially stale output file `{}`.", - source_file.display(), test_name); + debug!( + "source file time: {:?} output file time: {:?}", + source_time, + output_time + ); + panic!( + "test source file `{}` is newer than potentially stale output file `{}`.", + source_file.display(), + test_name + ); } } @@ -2320,22 +2542,30 @@ actual:\n\ debug!("comparing the contests of: {:?}", output_file); debug!("with: {:?}", expected_content); if !output_file.exists() { - panic!("Output file `{}` from test does not exist", - output_file.into_os_string().to_string_lossy()); + panic!( + "Output file `{}` from test does not exist", + output_file.into_os_string().to_string_lossy() + ); } self.check_mir_test_timestamp(test_name, &output_file); let mut dumped_file = fs::File::open(output_file.clone()).unwrap(); let mut dumped_string = String::new(); dumped_file.read_to_string(&mut dumped_string).unwrap(); - let mut dumped_lines = dumped_string.lines().filter(|l| !l.is_empty()); - let mut expected_lines = expected_content.iter().filter(|&l| { - if let &ExpectedLine::Text(l) = l { - !l.is_empty() - } else { - true - } - }).peekable(); + let mut dumped_lines = dumped_string + .lines() + .map(|l| nocomment_mir_line(l)) + .filter(|l| !l.is_empty()); + let mut expected_lines = expected_content + .iter() + .filter(|&l| { + if let &ExpectedLine::Text(l) = l { + !l.is_empty() + } else { + true + } + }) + .peekable(); let compare = |expected_line, dumped_line| { let e_norm = normalize_mir_line(expected_line); @@ -2346,27 +2576,31 @@ actual:\n\ }; let error = |expected_line, extra_msg| { - let normalize_all = dumped_string.lines() - .map(nocomment_mir_line) - .filter(|l| !l.is_empty()) - .collect::<Vec<_>>() - .join("\n"); + let normalize_all = dumped_string + .lines() + .map(nocomment_mir_line) + .filter(|l| !l.is_empty()) + .collect::<Vec<_>>() + .join("\n"); let f = |l: &ExpectedLine<_>| match l { &ExpectedLine::Elision => "... (elided)".into(), - &ExpectedLine::Text(t) => t + &ExpectedLine::Text(t) => t, }; - let expected_content = expected_content.iter() - .map(|l| f(l)) - .collect::<Vec<_>>() - .join("\n"); - panic!("Did not find expected line, error: {}\n\ - Actual Line: {:?}\n\ - Expected:\n{}\n\ - Actual:\n{}", - extra_msg, - expected_line, - expected_content, - normalize_all); + let expected_content = expected_content + .iter() + .map(|l| f(l)) + .collect::<Vec<_>>() + .join("\n"); + panic!( + "Did not find expected line, error: {}\n\ + Expected Line: {:?}\n\ + Expected:\n{}\n\ + Actual:\n{}", + extra_msg, + expected_line, + expected_content, + normalize_all + ); }; // We expect each non-empty line to appear consecutively, non-consecutive lines @@ -2382,11 +2616,18 @@ actual:\n\ if !compare(expected_line, dumped_line) { error!("{:?}", start_block_line); - error(expected_line, - format!("Mismatch in lines\nCurrnt block: {}\nExpected Line: {:?}", - start_block_line.unwrap_or("None"), dumped_line)); + error( + expected_line, + format!( + "Mismatch in lines\n\ + Current block: {}\n\ + Actual Line: {:?}", + start_block_line.unwrap_or("None"), + dumped_line + ), + ); } - }, + } Some(&ExpectedLine::Elision) => { // skip any number of elisions in a row. while let Some(&&ExpectedLine::Elision) = expected_lines.peek() { @@ -2407,8 +2648,8 @@ actual:\n\ error(expected_line, "ran out of mir dump to match against".into()); } } - }, - None => {}, + } + None => {} } } } @@ -2424,30 +2665,39 @@ actual:\n\ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String { let parent_dir = self.testpaths.file.parent().unwrap(); let cflags = self.props.compile_flags.join(" "); - let parent_dir_str = if cflags.contains("--error-format json") - || cflags.contains("--error-format pretty-json") { + let json = cflags.contains("--error-format json") + || cflags.contains("--error-format pretty-json") + || cflags.contains("--error-format=json") + || cflags.contains("--error-format=pretty-json"); + let parent_dir_str = if json { parent_dir.display().to_string().replace("\\", "\\\\") } else { parent_dir.display().to_string() }; - let mut normalized = output.replace(&parent_dir_str, "$DIR") - .replace("\\\\", "\\") // denormalize for paths on windows + let mut normalized = output.replace(&parent_dir_str, "$DIR"); + + if json { + // escaped newlines in json strings should be readable + // in the stderr files. There's no point int being correct, + // since only humans process the stderr files. + // Thus we just turn escaped newlines back into newlines. + normalized = normalized.replace("\\n", "\n"); + } + + normalized = normalized.replace("\\\\", "\\") // denormalize for paths on windows .replace("\\", "/") // normalize for paths on windows .replace("\r\n", "\n") // normalize for linebreaks on windows .replace("\t", "\\t"); // makes tabs visible for rule in custom_rules { - normalized = normalized.replace(&rule.0, &rule.1); + let re = Regex::new(&rule.0).expect("bad regex in custom normalization rule"); + normalized = re.replace_all(&normalized, &rule.1[..]).into_owned(); } normalized } fn expected_output_path(&self, kind: &str) -> PathBuf { - let extension = match self.revision { - Some(r) => format!("{}.{}", r, kind), - None => kind.to_string(), - }; - self.testpaths.file.with_extension(extension) + expected_output_path(&self.testpaths, self.revision, kind) } fn load_expected_output(&self, path: &Path) -> String { @@ -2458,10 +2708,11 @@ actual:\n\ let mut result = String::new(); match File::open(path).and_then(|mut f| f.read_to_string(&mut result)) { Ok(_) => result, - Err(e) => { - self.fatal(&format!("failed to load expected output from `{}`: {}", - path.display(), e)) - } + Err(e) => self.fatal(&format!( + "failed to load expected output from `{}`: {}", + path.display(), + e + )), } } @@ -2476,19 +2727,21 @@ actual:\n\ for diff in diff::lines(expected, actual) { match diff { - diff::Result::Left(l) => println!("-{}", l), + diff::Result::Left(l) => println!("-{}", l), diff::Result::Both(l, _) => println!(" {}", l), - diff::Result::Right(r) => println!("+{}", r), + diff::Result::Right(r) => println!("+{}", r), } } let output_file = self.output_base_name().with_extension(kind); match File::create(&output_file).and_then(|mut f| f.write_all(actual.as_bytes())) { - Ok(()) => { } - Err(e) => { - self.fatal(&format!("failed to write {} to `{}`: {}", - kind, output_file.display(), e)) - } + Ok(()) => {} + Err(e) => self.fatal(&format!( + "failed to write {} to `{}`: {}", + kind, + output_file.display(), + e + )), } println!("\nThe actual {0} differed from the expected {0}.", kind); @@ -2514,20 +2767,24 @@ impl ProcRes { if let Some(e) = err { println!("\nerror: {}", e); } - print!("\ - status: {}\n\ - command: {}\n\ - stdout:\n\ - ------------------------------------------\n\ - {}\n\ - ------------------------------------------\n\ - stderr:\n\ - ------------------------------------------\n\ - {}\n\ - ------------------------------------------\n\ - \n", - self.status, self.cmdline, self.stdout, - self.stderr); + print!( + "\ + status: {}\n\ + command: {}\n\ + stdout:\n\ + ------------------------------------------\n\ + {}\n\ + ------------------------------------------\n\ + stderr:\n\ + ------------------------------------------\n\ + {}\n\ + ------------------------------------------\n\ + \n", + self.status, + self.cmdline, + self.stdout, + self.stderr + ); panic!(); } } @@ -2540,12 +2797,12 @@ enum TargetLocation { #[derive(Clone, PartialEq, Eq)] enum ExpectedLine<T: AsRef<str>> { Elision, - Text(T) + Text(T), } impl<T> fmt::Debug for ExpectedLine<T> where - T: AsRef<str> + fmt::Debug + T: AsRef<str> + fmt::Debug, { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { if let &ExpectedLine::Text(ref t) = self { @@ -2582,7 +2839,7 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> { head: Vec<u8>, skipped: usize, tail: Box<[u8]>, - } + }, } impl ProcOutput { @@ -2597,9 +2854,17 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> { let tail = bytes.split_off(new_len - TAIL_LEN).into_boxed_slice(); let head = replace(bytes, Vec::new()); let skipped = new_len - HEAD_LEN - TAIL_LEN; - ProcOutput::Abbreviated { head, skipped, tail } + ProcOutput::Abbreviated { + head, + skipped, + tail, + } } - ProcOutput::Abbreviated { ref mut skipped, ref mut tail, .. } => { + ProcOutput::Abbreviated { + ref mut skipped, + ref mut tail, + .. + } => { *skipped += data.len(); if data.len() <= TAIL_LEN { tail[..data.len()].copy_from_slice(data); @@ -2616,7 +2881,11 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> { fn into_bytes(self) -> Vec<u8> { match self { ProcOutput::Full(bytes) => bytes, - ProcOutput::Abbreviated { mut head, skipped, tail } => { + ProcOutput::Abbreviated { + mut head, + skipped, + tail, + } => { write!(&mut head, "\n\n<<<<<< SKIPPED {} BYTES >>>>>>\n\n", skipped).unwrap(); head.extend_from_slice(&tail); head @@ -2629,10 +2898,14 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> { let mut stderr = ProcOutput::Full(Vec::new()); drop(child.stdin.take()); - read2(child.stdout.take().unwrap(), child.stderr.take().unwrap(), &mut |is_stdout, data, _| { - if is_stdout { &mut stdout } else { &mut stderr }.extend(data); - data.clear(); - })?; + read2( + child.stdout.take().unwrap(), + child.stderr.take().unwrap(), + &mut |is_stdout, data, _| { + if is_stdout { &mut stdout } else { &mut stderr }.extend(data); + data.clear(); + }, + )?; let status = child.wait()?; Ok(Output { diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index e0153e1e6f..469525ae73 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -81,6 +81,7 @@ fn small_url_encode(s: &str) -> String { .replace(";", "%3B") .replace("[", "%5B") .replace("]", "%5D") + .replace("\"", "%22") } impl FileEntry { @@ -131,7 +132,16 @@ fn check(cache: &mut Cache, // Unfortunately we're not 100% full of valid links today to we need a few // whitelists to get this past `make check` today. // FIXME(#32129) - if file.ends_with("std/string/struct.String.html") { + if file.ends_with("std/string/struct.String.html") || + file.ends_with("interpret/struct.ValTy.html") || + file.ends_with("symbol/struct.InternedString.html") || + file.ends_with("ast/struct.ThinVec.html") || + file.ends_with("util/struct.ThinVec.html") || + file.ends_with("util/struct.RcSlice.html") || + file.ends_with("layout/struct.TyLayout.html") || + file.ends_with("ty/struct.Slice.html") || + file.ends_with("ty/enum.Attributes.html") || + file.ends_with("ty/struct.SymbolName.html") { return None; } // FIXME(#32553) @@ -143,7 +153,16 @@ fn check(cache: &mut Cache, file.ends_with("struct.BTreeSet.html") || file.ends_with("btree_map/struct.BTreeMap.html") || file.ends_with("hash_map/struct.HashMap.html") || - file.ends_with("hash_set/struct.HashSet.html") { + file.ends_with("hash_set/struct.HashSet.html") || + file.ends_with("sync/struct.Lrc.html") || + file.ends_with("sync/struct.RwLock.html") { + return None; + } + // FIXME(#47038) + if file.ends_with("deriving/generic/index.html") || + file.ends_with("deriving/generic/macro.vec.html") || + file.ends_with("deriving/custom/macro.panic.html") || + file.ends_with("proc_macro_impl/macro.panic.html") { return None; } diff --git a/src/tools/miri/.editorconfig b/src/tools/miri/.editorconfig deleted file mode 100644 index 3c1f41bdcc..0000000000 --- a/src/tools/miri/.editorconfig +++ /dev/null @@ -1,25 +0,0 @@ -# EditorConfig helps developers define and maintain consistent -# coding styles between different editors and IDEs -# editorconfig.org - -root = true - - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 4 - -[*.rs] -indent_style = space -indent_size = 4 - -[*.toml] -indent_style = space -indent_size = 4 - -[*.md] -trim_trailing_whitespace = false diff --git a/src/tools/miri/.travis.yml b/src/tools/miri/.travis.yml deleted file mode 100644 index 86577702e9..0000000000 --- a/src/tools/miri/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: rust -rust: -- nightly -before_script: -- export PATH=$HOME/.local/bin:$PATH -- rustup target add i686-unknown-linux-gnu -- rustup target add i686-pc-windows-gnu -- rustup target add i686-pc-windows-msvc -- rustup component add rust-src -- cargo install --git https://github.com/japaric/xargo.git -- export RUST_SYSROOT=$HOME/rust -script: -- set -e -- | - # get ourselves a MIR-ful libstd - xargo/build.sh -- | - # Test plain miri - cargo build --locked --release --all-features && - cargo test --locked --release --all-features --all && - cargo install --locked --all-features -- | - # Test cargo miri - cd cargo-miri-test && - cargo miri && - cargo miri test && - cd .. -- | - # and run all tests with full mir - MIRI_SYSROOT=~/.xargo/HOST cargo test --locked --release -- | - # test that the rustc_tests binary compiles - cd rustc_tests && - cargo build --locked --release && - cd .. -notifications: - email: - on_success: never -branches: - only: - - master -env: - global: - - RUST_TEST_NOCAPTURE=1 - - TRAVIS_CARGO_NIGHTLY_FEATURE="" diff --git a/src/tools/miri/Cargo.lock b/src/tools/miri/Cargo.lock deleted file mode 100644 index 2e0f1e3562..0000000000 --- a/src/tools/miri/Cargo.lock +++ /dev/null @@ -1,388 +0,0 @@ -[root] -name = "rustc_miri" -version = "0.1.0" -dependencies = [ - "backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "aho-corasick" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitflags" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "byteorder" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cargo_metadata" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cfg-if" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "compiletest_rs" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "conv" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "custom_derive" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "dbghelp-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dtoa" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "env_logger" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gcc" -version = "0.3.53" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "itoa" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.30" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log_settings" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "magenta" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "magenta-sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miri" -version = "0.1.0" -dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "compiletest_rs 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_miri 0.1.0", -] - -[[package]] -name = "num-traits" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rand" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-demangle" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde_derive" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive_internals" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", - "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tempdir" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "utf8-ranges" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" -"checksum backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983" -"checksum backtrace-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "afccc5772ba333abccdf60d55200fa3406f8c59dcf54d5f7998c9107d3799c7c" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" -"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" -"checksum cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be1057b8462184f634c3a208ee35b0f935cfd94b694b26deadccd98732088d7b" -"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" -"checksum compiletest_rs 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2741d378feb7a434dba54228c89a70b4e427fee521de67cdda3750b8a0265f5a" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" -"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" -"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" -"checksum gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)" = "e8310f7e9c890398b0e80e301c4f474e9918d2b27fca8f48486ca775fa9ffc5a" -"checksum itoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f74cf6ca1bdbc28496a2b9798ab7fccc2ca5a42cace95bb2b219577216a5fb90" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" -"checksum libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915" -"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" -"checksum log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3d382732ea0fbc09790c4899db3255bdea0fc78b54bf234bd18a63bb603915b6" -"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" -"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" -"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" -"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf" -"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" -"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" -"checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f7726f29ddf9731b17ff113c461e362c381d9d69433f79de4f3dd572488823e9" -"checksum serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cf823e706be268e73e7747b147aa31c8f633ab4ba31f115efb57e5047c3a76dd" -"checksum serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37aee4e0da52d801acfbc0cc219eb1eda7142112339726e427926a6f6ee65d3a" -"checksum serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "48b04779552e92037212c3615370f6bd57a40ebba7f20e554ff9f55e41a69a7b" -"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" -"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/src/tools/miri/Cargo.toml b/src/tools/miri/Cargo.toml deleted file mode 100644 index 5dbf4521c9..0000000000 --- a/src/tools/miri/Cargo.toml +++ /dev/null @@ -1,39 +0,0 @@ -[package] -authors = ["Scott Olson <scott@solson.me>"] -description = "An experimental interpreter for Rust MIR." -license = "MIT/Apache-2.0" -name = "miri" -repository = "https://github.com/solson/miri" -version = "0.1.0" -build = "build.rs" - -[[bin]] -doc = false -name = "miri" -path = "miri/bin/miri.rs" - -[[bin]] -doc = false -name = "cargo-miri" -path = "miri/bin/cargo-miri.rs" -required-features = ["cargo_miri"] - -[lib] -path = "miri/lib.rs" - -[dependencies] -byteorder = { version = "1.1", features = ["i128"]} -env_logger = "0.4.3" -log = "0.3.6" -log_settings = "0.1.1" -cargo_metadata = { version = "0.2", optional = true } -rustc_miri = { path = "src/librustc_mir" } - -[features] -cargo_miri = ["cargo_metadata"] - -[dev-dependencies] -compiletest_rs = { version = "0.2.10", features = ["tmp"] } - -[workspace] -exclude = ["xargo", "cargo-miri-test", "rustc_tests"] diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md deleted file mode 100644 index 8edaba77fb..0000000000 --- a/src/tools/miri/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# Miri [[slides](https://solson.me/miri-slides.pdf)] [[report](https://solson.me/miri-report.pdf)] [![Build Status](https://travis-ci.org/solson/miri.svg?branch=master)](https://travis-ci.org/solson/miri) - - -An experimental interpreter for [Rust][rust]'s [mid-level intermediate -representation][mir] (MIR). This project began as part of my work for the -undergraduate research course at the [University of Saskatchewan][usask]. - -## Installing Rust - -I recommend that you install [rustup][rustup] and then use it to install the -current Rust nightly version: - -```sh -rustup update nightly -``` - -You should also make `nightly` the default version for your Miri directory by -running the following command while you're in it. If you don't do this, you can -run the later `cargo` commands by using `cargo +nightly` instead. - -```sh -rustup override add nightly -``` - -## Building Miri - -```sh -cargo build -``` - -If Miri fails to build, it's likely because a change in the latest nightly -compiler broke it. You could try an older nightly with `rustup update -nightly-<date>` where `<date>` is a few days or weeks ago, e.g. `2016-05-20` for -May 20th. Otherwise, you could notify me in an issue or on IRC. Or, if you know -how to fix it, you could send a PR. :smile: - -## Running tests - -```sh -cargo run --bin miri tests/run-pass/vecs.rs # Or whatever test you like. -``` - -## Debugging - -You can get detailed, statement-by-statement traces by setting the `MIRI_LOG` -environment variable to `trace`. These traces are indented based on call stack -depth. You can get a much less verbose set of information with other logging -levels such as `warn`. - -## Running miri on your own project('s test suite) - -Install miri as a cargo subcommand with `cargo install --debug`. -Then, inside your own project, use `cargo +nightly miri` to run your project, if it is -a bin project, or run `cargo +nightly miri test` to run all tests in your project -through miri. - -## Running miri with full libstd - -Per default libstd does not contain the MIR of non-polymorphic functions. When -miri hits a call to such a function, execution terminates. To fix this, it is -possible to compile libstd with full MIR: - -```sh -rustup component add rust-src -cargo install xargo -cd xargo/ -RUSTFLAGS='-Zalways-encode-mir' xargo build -``` - -Now you can run miri against the libstd compiled by xargo: - -```sh -MIRI_SYSROOT=~/.xargo/HOST cargo run --bin miri tests/run-pass-fullmir/vecs.rs -``` - -Notice that you will have to re-run the last step of the preparations above when -your toolchain changes (e.g., when you update the nightly). - -## Contributing and getting help - -Check out the issues on this GitHub repository for some ideas. There's lots that -needs to be done that I haven't documented in the issues yet, however. For more -ideas or help with running or hacking on Miri, you can contact me (`scott`) on -Mozilla IRC in any of the Rust IRC channels (`#rust`, `#rust-offtopic`, etc). - -## License - -Licensed under either of - * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or - http://www.apache.org/licenses/LICENSE-2.0) - * MIT license ([LICENSE-MIT](LICENSE-MIT) or - http://opensource.org/licenses/MIT) at your option. - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in the work by you shall be dual licensed as above, without any -additional terms or conditions. - -[rust]: https://www.rust-lang.org/ -[mir]: https://github.com/rust-lang/rfcs/blob/master/text/1211-mir.md -[usask]: https://www.usask.ca/ -[rustup]: https://www.rustup.rs diff --git a/src/tools/miri/appveyor.yml b/src/tools/miri/appveyor.yml deleted file mode 100644 index 2fa7a74c7c..0000000000 --- a/src/tools/miri/appveyor.yml +++ /dev/null @@ -1,35 +0,0 @@ -environment: - global: - PROJECT_NAME: miri - matrix: - - TARGET: i686-pc-windows-msvc - MSYS2_BITS: 32 - - TARGET: x86_64-pc-windows-msvc - MSYS2_BITS: 64 - -install: - - set PATH=C:\Program Files\Git\mingw64\bin;%PATH% - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin;C:\Users\appveyor\.rustup\toolchains\nightly-%TARGET%\bin - - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin - - rustc -V - - cargo -V - - rustup component add rust-src - - cargo install --git https://github.com/japaric/xargo.git - - cd xargo - - set RUSTFLAGS=-Zalways-encode-mir -Zmir-emit-validate=1 - - xargo build - - set RUSTFLAGS= - - cd .. - -build: false - -test_script: - - set RUST_BACKTRACE=1 - - cargo build --locked --release - - cargo test --locked --release - -notifications: - - provider: Email - on_build_success: false diff --git a/src/tools/miri/benches/fibonacci.rs b/src/tools/miri/benches/fibonacci.rs deleted file mode 100644 index 90b231a32b..0000000000 --- a/src/tools/miri/benches/fibonacci.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![feature(test, rustc_private)] - -extern crate test; -use test::Bencher; -mod helpers; -use helpers::*; - -#[bench] -fn fib(bencher: &mut Bencher) { - bencher.iter(|| { fibonacci_helper::main(); }) -} - -#[bench] -fn fib_miri(bencher: &mut Bencher) { - miri_helper::run("fibonacci_helper", bencher); -} - -#[bench] -fn fib_iter(bencher: &mut Bencher) { - bencher.iter(|| { fibonacci_helper_iterative::main(); }) -} - -#[bench] -fn fib_iter_miri(bencher: &mut Bencher) { - miri_helper::run("fibonacci_helper_iterative", bencher); -} diff --git a/src/tools/miri/benches/helpers/fibonacci_helper.rs b/src/tools/miri/benches/helpers/fibonacci_helper.rs deleted file mode 100644 index 586f1ce7da..0000000000 --- a/src/tools/miri/benches/helpers/fibonacci_helper.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[inline(never)] -pub fn main() { - assert_eq!(fib(10), 55); -} - -fn fib(n: usize) -> usize { - if n <= 2 { 1 } else { fib(n - 1) + fib(n - 2) } -} diff --git a/src/tools/miri/benches/helpers/fibonacci_helper_iterative.rs b/src/tools/miri/benches/helpers/fibonacci_helper_iterative.rs deleted file mode 100644 index 59283be482..0000000000 --- a/src/tools/miri/benches/helpers/fibonacci_helper_iterative.rs +++ /dev/null @@ -1,15 +0,0 @@ -#[inline(never)] -pub fn main() { - assert_eq!(fib(10), 55); -} - -fn fib(n: usize) -> usize { - let mut a = 0; - let mut b = 1; - for _ in 0..n { - let c = a; - a = b; - b = c + b; - } - a -} diff --git a/src/tools/miri/benches/helpers/miri_helper.rs b/src/tools/miri/benches/helpers/miri_helper.rs deleted file mode 100644 index 6657ba1199..0000000000 --- a/src/tools/miri/benches/helpers/miri_helper.rs +++ /dev/null @@ -1,75 +0,0 @@ -extern crate getopts; -extern crate miri; -extern crate rustc; -extern crate rustc_driver; -extern crate test; - -use self::miri::eval_main; -use self::rustc::session::Session; -use self::rustc_driver::{driver, CompilerCalls, Compilation}; -use std::cell::RefCell; -use std::rc::Rc; -use test::Bencher; - -pub struct MiriCompilerCalls<'a>(Rc<RefCell<&'a mut Bencher>>); - -fn find_sysroot() -> String { - // Taken from https://github.com/Manishearth/rust-clippy/pull/911. - let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); - let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); - match (home, toolchain) { - (Some(home), Some(toolchain)) => format!("{}/toolchains/{}", home, toolchain), - _ => { - option_env!("RUST_SYSROOT") - .expect( - "need to specify RUST_SYSROOT env var or use rustup or multirust", - ) - .to_owned() - } - } -} - -pub fn run(filename: &str, bencher: &mut Bencher) { - let args = &[ - "miri".to_string(), - format!("benches/helpers/{}.rs", filename), - "--sysroot".to_string(), - find_sysroot(), - ]; - let compiler_calls = &mut MiriCompilerCalls(Rc::new(RefCell::new(bencher))); - rustc_driver::run_compiler(args, compiler_calls, None, None); -} - -impl<'a> CompilerCalls<'a> for MiriCompilerCalls<'a> { - fn build_controller( - &mut self, - _: &Session, - _: &getopts::Matches, - ) -> driver::CompileController<'a> { - let mut control: driver::CompileController<'a> = driver::CompileController::basic(); - - let bencher = self.0.clone(); - - control.after_analysis.stop = Compilation::Stop; - control.after_analysis.callback = Box::new(move |state| { - state.session.abort_if_errors(); - - let tcx = state.tcx.unwrap(); - let (entry_node_id, _) = state.session.entry_fn.borrow().expect( - "no main or start function found", - ); - let entry_def_id = tcx.map.local_def_id(entry_node_id); - - let memory_size = 100 * 1024 * 1024; // 100MB - let step_limit = 1000_000; - let stack_limit = 100; - bencher.borrow_mut().iter(|| { - eval_main(tcx, entry_def_id, memory_size, step_limit, stack_limit); - }); - - state.session.abort_if_errors(); - }); - - control - } -} diff --git a/src/tools/miri/benches/helpers/mod.rs b/src/tools/miri/benches/helpers/mod.rs deleted file mode 100644 index 27504a2cc0..0000000000 --- a/src/tools/miri/benches/helpers/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -// This module gets included in multiple crates, and they each only use part of it. -#![allow(dead_code)] - -pub mod fibonacci_helper; -pub mod fibonacci_helper_iterative; -pub mod miri_helper; -pub mod smoke_helper; diff --git a/src/tools/miri/benches/helpers/repeat.rs b/src/tools/miri/benches/helpers/repeat.rs deleted file mode 100644 index 0e8c5980b8..0000000000 --- a/src/tools/miri/benches/helpers/repeat.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let data: [u8; 1024] = [42; 1024]; - assert_eq!(data.len(), 1024); -} diff --git a/src/tools/miri/benches/helpers/repeat_manual.rs b/src/tools/miri/benches/helpers/repeat_manual.rs deleted file mode 100644 index 6ef6f724ef..0000000000 --- a/src/tools/miri/benches/helpers/repeat_manual.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let mut data: [u8; 1024] = unsafe { std::mem::uninitialized() }; - for i in 0..data.len() { - unsafe { std::ptr::write(&mut data[i], 0); } - } - assert_eq!(data.len(), 1024); -} diff --git a/src/tools/miri/benches/helpers/smoke_helper.rs b/src/tools/miri/benches/helpers/smoke_helper.rs deleted file mode 100644 index e81db817ae..0000000000 --- a/src/tools/miri/benches/helpers/smoke_helper.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[inline(never)] -pub fn main() {} diff --git a/src/tools/miri/benches/repeat.rs b/src/tools/miri/benches/repeat.rs deleted file mode 100644 index f5920e83d9..0000000000 --- a/src/tools/miri/benches/repeat.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(test, rustc_private)] - -extern crate test; -use test::Bencher; -mod helpers; -use helpers::*; - -#[bench] -fn repeat(bencher: &mut Bencher) { - miri_helper::run("repeat", bencher); -} - -#[bench] -fn repeat_manual(bencher: &mut Bencher) { - miri_helper::run("repeat_manual", bencher); -} diff --git a/src/tools/miri/benches/smoke.rs b/src/tools/miri/benches/smoke.rs deleted file mode 100644 index 1dbc4fed82..0000000000 --- a/src/tools/miri/benches/smoke.rs +++ /dev/null @@ -1,35 +0,0 @@ -#![feature(test, rustc_private)] - -extern crate test; -use test::Bencher; -mod helpers; -use helpers::*; - -#[bench] -fn noop(bencher: &mut Bencher) { - bencher.iter(|| { smoke_helper::main(); }) -} - -/* -// really slow -#[bench] -fn noop_miri_full(bencher: &mut Bencher) { - let path = std::env::var("RUST_SYSROOT").expect("env variable `RUST_SYSROOT` not set"); - bencher.iter(|| { - let mut process = std::process::Command::new("target/release/miri"); - process.arg("benches/smoke_helper.rs") - .arg("--sysroot").arg(&path); - let output = process.output().unwrap(); - if !output.status.success() { - println!("{}", String::from_utf8(output.stdout).unwrap()); - println!("{}", String::from_utf8(output.stderr).unwrap()); - panic!("failed to run miri"); - } - }) -} -*/ - -#[bench] -fn noop_miri_interpreter(bencher: &mut Bencher) { - miri_helper::run("smoke_helper", bencher); -} diff --git a/src/tools/miri/build.rs b/src/tools/miri/build.rs deleted file mode 100644 index 2f74f7f4f6..0000000000 --- a/src/tools/miri/build.rs +++ /dev/null @@ -1,8 +0,0 @@ -use std::env; - -fn main() { - // Forward the profile to the main compilation - println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap()); - // Don't rebuild miri even if nothing changed - println!("cargo:rerun-if-changed=build.rs"); -} diff --git a/src/tools/miri/cargo-miri-test/Cargo.lock b/src/tools/miri/cargo-miri-test/Cargo.lock deleted file mode 100644 index 8b2387fa64..0000000000 --- a/src/tools/miri/cargo-miri-test/Cargo.lock +++ /dev/null @@ -1,14 +0,0 @@ -[root] -name = "cargo-miri-test" -version = "0.1.0" -dependencies = [ - "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "byteorder" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" diff --git a/src/tools/miri/cargo-miri-test/Cargo.toml b/src/tools/miri/cargo-miri-test/Cargo.toml deleted file mode 100644 index 5fbe923f23..0000000000 --- a/src/tools/miri/cargo-miri-test/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "cargo-miri-test" -version = "0.1.0" -authors = ["Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>"] - -[dependencies] -byteorder = "1.0" \ No newline at end of file diff --git a/src/tools/miri/cargo-miri-test/src/main.rs b/src/tools/miri/cargo-miri-test/src/main.rs deleted file mode 100644 index 07b0e4cee4..0000000000 --- a/src/tools/miri/cargo-miri-test/src/main.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate byteorder; - -use byteorder::{BigEndian, ByteOrder}; - -fn main() { - let buf = &[1,2,3,4]; - let n = <BigEndian as ByteOrder>::read_u32(buf); - assert_eq!(n, 0x01020304); -} diff --git a/src/tools/miri/cargo-miri-test/tests/foo.rs b/src/tools/miri/cargo-miri-test/tests/foo.rs deleted file mode 100644 index fb7fad21c9..0000000000 --- a/src/tools/miri/cargo-miri-test/tests/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[test] -fn bar() { - assert_eq!(4, 4); -} diff --git a/src/tools/miri/miri/bin/cargo-miri.rs b/src/tools/miri/miri/bin/cargo-miri.rs deleted file mode 100644 index 06d5b3e997..0000000000 --- a/src/tools/miri/miri/bin/cargo-miri.rs +++ /dev/null @@ -1,212 +0,0 @@ -extern crate cargo_metadata; - -use std::path::{PathBuf, Path}; -use std::io::Write; -use std::process::Command; - - -const CARGO_MIRI_HELP: &str = r#"Interprets bin crates - -Usage: - cargo miri [options] [--] [<opts>...] - -Common options: - -h, --help Print this message - --features Features to compile for the package - -V, --version Print version info and exit - -Other options are the same as `cargo rustc`. - -The feature `cargo-miri` is automatically defined for convenience. You can use -it to configure the resource limits - - #![cfg_attr(feature = "cargo-miri", memory_size = 42)] - -available resource limits are `memory_size`, `step_limit`, `stack_limit` -"#; - -fn show_help() { - println!("{}", CARGO_MIRI_HELP); -} - -fn show_version() { - println!("{}", env!("CARGO_PKG_VERSION")); -} - -fn main() { - // Check for version and help flags even when invoked as 'cargo-miri' - if std::env::args().any(|a| a == "--help" || a == "-h") { - show_help(); - return; - } - if std::env::args().any(|a| a == "--version" || a == "-V") { - show_version(); - return; - } - - if let Some("miri") = std::env::args().nth(1).as_ref().map(AsRef::as_ref) { - // this arm is when `cargo miri` is called - - let test = std::env::args().nth(2).map_or(false, |text| text == "test"); - let skip = if test { 3 } else { 2 }; - - let manifest_path_arg = std::env::args().skip(skip).find(|val| { - val.starts_with("--manifest-path=") - }); - - let mut metadata = if let Ok(metadata) = cargo_metadata::metadata( - manifest_path_arg.as_ref().map(AsRef::as_ref), - ) - { - metadata - } else { - let _ = std::io::stderr().write_fmt(format_args!( - "error: Could not obtain cargo metadata." - )); - std::process::exit(101); - }; - - let manifest_path = manifest_path_arg.map(|arg| { - PathBuf::from(Path::new(&arg["--manifest-path=".len()..])) - }); - - let current_dir = std::env::current_dir(); - - let package_index = metadata - .packages - .iter() - .position(|package| { - let package_manifest_path = Path::new(&package.manifest_path); - if let Some(ref manifest_path) = manifest_path { - package_manifest_path == manifest_path - } else { - let current_dir = current_dir.as_ref().expect( - "could not read current directory", - ); - let package_manifest_directory = package_manifest_path.parent().expect( - "could not find parent directory of package manifest", - ); - package_manifest_directory == current_dir - } - }) - .expect("could not find matching package"); - let package = metadata.packages.remove(package_index); - for target in package.targets { - let args = std::env::args().skip(skip); - let kind = target.kind.get(0).expect( - "badly formatted cargo metadata: target::kind is an empty array", - ); - if test && kind == "test" { - if let Err(code) = process( - vec!["--test".to_string(), target.name].into_iter().chain( - args, - ), - ) - { - std::process::exit(code); - } - } else if !test && kind == "bin" { - if let Err(code) = process( - vec!["--bin".to_string(), target.name].into_iter().chain( - args, - ), - ) - { - std::process::exit(code); - } - } - } - } else { - // this arm is executed when cargo-miri runs `cargo rustc` with the `RUSTC` env var set to itself - - let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); - let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); - let sys_root = if let (Some(home), Some(toolchain)) = (home, toolchain) { - format!("{}/toolchains/{}", home, toolchain) - } else { - option_env!("RUST_SYSROOT") - .map(|s| s.to_owned()) - .or_else(|| { - Command::new("rustc") - .arg("--print") - .arg("sysroot") - .output() - .ok() - .and_then(|out| String::from_utf8(out.stdout).ok()) - .map(|s| s.trim().to_owned()) - }) - .expect("need to specify RUST_SYSROOT env var during miri compilation, or use rustup or multirust") - }; - - // this conditional check for the --sysroot flag is there so users can call `cargo-miri` directly - // without having to pass --sysroot or anything - let mut args: Vec<String> = if std::env::args().any(|s| s == "--sysroot") { - std::env::args().skip(1).collect() - } else { - std::env::args() - .skip(1) - .chain(Some("--sysroot".to_owned())) - .chain(Some(sys_root)) - .collect() - }; - - // this check ensures that dependencies are built but not interpreted and the final crate is - // interpreted but not built - let miri_enabled = std::env::args().any(|s| s == "-Zno-trans"); - - let mut command = if miri_enabled { - let mut path = std::env::current_exe().expect("current executable path invalid"); - path.set_file_name("miri"); - Command::new(path) - } else { - Command::new("rustc") - }; - - args.extend_from_slice(&["-Z".to_owned(), "always-encode-mir".to_owned()]); - args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-miri""#.to_owned()]); - - match command.args(&args).status() { - Ok(exit) => { - if !exit.success() { - std::process::exit(exit.code().unwrap_or(42)); - } - } - Err(ref e) if miri_enabled => panic!("error during miri run: {:?}", e), - Err(ref e) => panic!("error during rustc call: {:?}", e), - } - } -} - -fn process<I>(old_args: I) -> Result<(), i32> -where - I: Iterator<Item = String>, -{ - let mut args = vec!["rustc".to_owned()]; - - let mut found_dashes = false; - for arg in old_args { - found_dashes |= arg == "--"; - args.push(arg); - } - if !found_dashes { - args.push("--".to_owned()); - } - args.push("-Zno-trans".to_owned()); - args.push("--cfg".to_owned()); - args.push(r#"feature="cargo-miri""#.to_owned()); - - let path = std::env::current_exe().expect("current executable path invalid"); - let exit_status = std::process::Command::new("cargo") - .args(&args) - .env("RUSTC", path) - .spawn() - .expect("could not run cargo") - .wait() - .expect("failed to wait for cargo?"); - - if exit_status.success() { - Ok(()) - } else { - Err(exit_status.code().unwrap_or(-1)) - } -} diff --git a/src/tools/miri/miri/bin/miri.rs b/src/tools/miri/miri/bin/miri.rs deleted file mode 100644 index d38f63610a..0000000000 --- a/src/tools/miri/miri/bin/miri.rs +++ /dev/null @@ -1,265 +0,0 @@ -#![feature(rustc_private, i128_type)] - -extern crate getopts; -extern crate miri; -extern crate rustc; -extern crate rustc_driver; -extern crate rustc_errors; -extern crate env_logger; -extern crate log_settings; -extern crate syntax; -extern crate log; - -use rustc::session::Session; -use rustc::middle::cstore::CrateStore; -use rustc_driver::{Compilation, CompilerCalls, RustcDefaultCalls}; -use rustc_driver::driver::{CompileState, CompileController}; -use rustc::session::config::{self, Input, ErrorOutputType}; -use rustc::hir::{self, itemlikevisit}; -use rustc::ty::TyCtxt; -use syntax::ast::{self, MetaItemKind, NestedMetaItemKind}; -use std::path::PathBuf; - -struct MiriCompilerCalls { - default: RustcDefaultCalls, -} - -impl<'a> CompilerCalls<'a> for MiriCompilerCalls { - fn early_callback( - &mut self, - matches: &getopts::Matches, - sopts: &config::Options, - cfg: &ast::CrateConfig, - descriptions: &rustc_errors::registry::Registry, - output: ErrorOutputType, - ) -> Compilation { - self.default.early_callback( - matches, - sopts, - cfg, - descriptions, - output, - ) - } - fn no_input( - &mut self, - matches: &getopts::Matches, - sopts: &config::Options, - cfg: &ast::CrateConfig, - odir: &Option<PathBuf>, - ofile: &Option<PathBuf>, - descriptions: &rustc_errors::registry::Registry, - ) -> Option<(Input, Option<PathBuf>)> { - self.default.no_input( - matches, - sopts, - cfg, - odir, - ofile, - descriptions, - ) - } - fn late_callback( - &mut self, - matches: &getopts::Matches, - sess: &Session, - cstore: &CrateStore, - input: &Input, - odir: &Option<PathBuf>, - ofile: &Option<PathBuf>, - ) -> Compilation { - self.default.late_callback(matches, sess, cstore, input, odir, ofile) - } - fn build_controller( - &mut self, - sess: &Session, - matches: &getopts::Matches, - ) -> CompileController<'a> { - let mut control = self.default.build_controller(sess, matches); - control.after_hir_lowering.callback = Box::new(after_hir_lowering); - control.after_analysis.callback = Box::new(after_analysis); - if sess.target.target != sess.host { - // only fully compile targets on the host. linking will fail for cross-compilation. - control.after_analysis.stop = Compilation::Stop; - } - control - } -} - -fn after_hir_lowering(state: &mut CompileState) { - let attr = ( - String::from("miri"), - syntax::feature_gate::AttributeType::Whitelisted, - ); - state.session.plugin_attributes.borrow_mut().push(attr); -} - -fn after_analysis<'a, 'tcx>(state: &mut CompileState<'a, 'tcx>) { - state.session.abort_if_errors(); - - let tcx = state.tcx.unwrap(); - let limits = resource_limits_from_attributes(state); - - if std::env::args().any(|arg| arg == "--test") { - struct Visitor<'a, 'tcx: 'a>( - miri::ResourceLimits, - TyCtxt<'a, 'tcx, 'tcx>, - &'a CompileState<'a, 'tcx> - ); - impl<'a, 'tcx: 'a, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'a, 'tcx> { - fn visit_item(&mut self, i: &'hir hir::Item) { - if let hir::Item_::ItemFn(_, _, _, _, _, body_id) = i.node { - if i.attrs.iter().any(|attr| { - attr.name().map_or(false, |n| n == "test") - }) - { - let did = self.1.hir.body_owner_def_id(body_id); - println!( - "running test: {}", - self.1.hir.def_path(did).to_string(self.1) - ); - miri::eval_main(self.1, did, None, self.0); - self.2.session.abort_if_errors(); - } - } - } - fn visit_trait_item(&mut self, _trait_item: &'hir hir::TraitItem) {} - fn visit_impl_item(&mut self, _impl_item: &'hir hir::ImplItem) {} - } - state.hir_crate.unwrap().visit_all_item_likes( - &mut Visitor(limits, tcx, state), - ); - } else if let Some((entry_node_id, _)) = *state.session.entry_fn.borrow() { - let entry_def_id = tcx.hir.local_def_id(entry_node_id); - let start_wrapper = tcx.lang_items().start_fn().and_then(|start_fn| { - if tcx.is_mir_available(start_fn) { - Some(start_fn) - } else { - None - } - }); - miri::eval_main(tcx, entry_def_id, start_wrapper, limits); - - state.session.abort_if_errors(); - } else { - println!("no main function found, assuming auxiliary build"); - } -} - -fn resource_limits_from_attributes(state: &CompileState) -> miri::ResourceLimits { - let mut limits = miri::ResourceLimits::default(); - let krate = state.hir_crate.as_ref().unwrap(); - let err_msg = "miri attributes need to be in the form `miri(key = value)`"; - let extract_int = |lit: &syntax::ast::Lit| -> u128 { - match lit.node { - syntax::ast::LitKind::Int(i, _) => i, - _ => { - state.session.span_fatal( - lit.span, - "expected an integer literal", - ) - } - } - }; - - for attr in krate.attrs.iter().filter(|a| { - a.name().map_or(false, |n| n == "miri") - }) - { - if let Some(items) = attr.meta_item_list() { - for item in items { - if let NestedMetaItemKind::MetaItem(ref inner) = item.node { - if let MetaItemKind::NameValue(ref value) = inner.node { - match &inner.name().as_str()[..] { - "memory_size" => limits.memory_size = extract_int(value) as u64, - "step_limit" => limits.step_limit = extract_int(value) as u64, - "stack_limit" => limits.stack_limit = extract_int(value) as usize, - _ => state.session.span_err(item.span, "unknown miri attribute"), - } - } else { - state.session.span_err(inner.span, err_msg); - } - } else { - state.session.span_err(item.span, err_msg); - } - } - } else { - state.session.span_err(attr.span, err_msg); - } - } - limits -} - -fn init_logger() { - let format = |record: &log::LogRecord| { - if record.level() == log::LogLevel::Trace { - // prepend spaces to indent the final string - let indentation = log_settings::settings().indentation; - format!( - "{lvl}:{module}:{indent:<indentation$} {text}", - lvl = record.level(), - module = record.location().module_path(), - indentation = indentation, - indent = "", - text = record.args(), - ) - } else { - format!( - "{lvl}:{module}: {text}", - lvl = record.level(), - module = record.location().module_path(), - text = record.args(), - ) - } - }; - - let mut builder = env_logger::LogBuilder::new(); - builder.format(format).filter( - None, - log::LogLevelFilter::Info, - ); - - if std::env::var("MIRI_LOG").is_ok() { - builder.parse(&std::env::var("MIRI_LOG").unwrap()); - } - - builder.init().unwrap(); -} - -fn find_sysroot() -> String { - if let Ok(sysroot) = std::env::var("MIRI_SYSROOT") { - return sysroot; - } - - // Taken from https://github.com/Manishearth/rust-clippy/pull/911. - let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); - let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); - match (home, toolchain) { - (Some(home), Some(toolchain)) => format!("{}/toolchains/{}", home, toolchain), - _ => { - option_env!("RUST_SYSROOT") - .expect( - "need to specify RUST_SYSROOT env var or use rustup or multirust", - ) - .to_owned() - } - } -} - -fn main() { - init_logger(); - let mut args: Vec<String> = std::env::args().collect(); - - let sysroot_flag = String::from("--sysroot"); - if !args.contains(&sysroot_flag) { - args.push(sysroot_flag); - args.push(find_sysroot()); - } - - // Make sure we always have all the MIR (e.g. for auxilary builds in unit tests). - args.push("-Zalways-encode-mir".to_owned()); - - rustc_driver::run_compiler(&args, &mut MiriCompilerCalls { - default: RustcDefaultCalls, - }, None, None); -} diff --git a/src/tools/miri/miri/fn_call.rs b/src/tools/miri/miri/fn_call.rs deleted file mode 100644 index 36d9c0b481..0000000000 --- a/src/tools/miri/miri/fn_call.rs +++ /dev/null @@ -1,653 +0,0 @@ -use rustc::ty::{self, Ty}; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; -use rustc::mir; -use syntax::attr; -use syntax::abi::Abi; -use syntax::codemap::Span; - -use std::mem; - -use rustc_miri::interpret::*; - -use super::{TlsKey, EvalContext}; - -use tls::MemoryExt; - -use super::memory::MemoryKind; - -pub trait EvalContextExt<'tcx> { - fn call_c_abi( - &mut self, - def_id: DefId, - args: &[ValTy<'tcx>], - dest: Lvalue, - dest_ty: Ty<'tcx>, - dest_block: mir::BasicBlock, - ) -> EvalResult<'tcx>; - - fn resolve_path(&self, path: &[&str]) -> EvalResult<'tcx, ty::Instance<'tcx>>; - - fn call_missing_fn( - &mut self, - instance: ty::Instance<'tcx>, - destination: Option<(Lvalue, mir::BasicBlock)>, - args: &[ValTy<'tcx>], - sig: ty::FnSig<'tcx>, - path: String, - ) -> EvalResult<'tcx>; - - fn eval_fn_call( - &mut self, - instance: ty::Instance<'tcx>, - destination: Option<(Lvalue, mir::BasicBlock)>, - args: &[ValTy<'tcx>], - span: Span, - sig: ty::FnSig<'tcx>, - ) -> EvalResult<'tcx, bool>; -} - -impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator> { - fn eval_fn_call( - &mut self, - instance: ty::Instance<'tcx>, - destination: Option<(Lvalue, mir::BasicBlock)>, - args: &[ValTy<'tcx>], - span: Span, - sig: ty::FnSig<'tcx>, - ) -> EvalResult<'tcx, bool> { - trace!("eval_fn_call: {:#?}, {:#?}", instance, destination); - - let mir = match self.load_mir(instance.def) { - Ok(mir) => mir, - Err(EvalError { kind: EvalErrorKind::NoMirFor(path), .. }) => { - self.call_missing_fn( - instance, - destination, - args, - sig, - path, - )?; - return Ok(true); - } - Err(other) => return Err(other), - }; - - let (return_lvalue, return_to_block) = match destination { - Some((lvalue, block)) => (lvalue, StackPopCleanup::Goto(block)), - None => (Lvalue::undef(), StackPopCleanup::None), - }; - - self.push_stack_frame( - instance, - span, - mir, - return_lvalue, - return_to_block, - )?; - - Ok(false) - } - - fn call_c_abi( - &mut self, - def_id: DefId, - args: &[ValTy<'tcx>], - dest: Lvalue, - dest_ty: Ty<'tcx>, - dest_block: mir::BasicBlock, - ) -> EvalResult<'tcx> { - let attrs = self.tcx.get_attrs(def_id); - let link_name = match attr::first_attr_value_str_by_name(&attrs, "link_name") { - Some(name) => name.as_str(), - None => self.tcx.item_name(def_id), - }; - - match &link_name[..] { - "malloc" => { - let size = self.value_to_primval(args[0])?.to_u64()?; - if size == 0 { - self.write_null(dest, dest_ty)?; - } else { - let align = self.memory.pointer_size(); - let ptr = self.memory.allocate(size, align, MemoryKind::C.into())?; - self.write_primval(dest, PrimVal::Ptr(ptr), dest_ty)?; - } - } - - "free" => { - let ptr = args[0].into_ptr(&mut self.memory)?; - if !ptr.is_null()? { - self.memory.deallocate( - ptr.to_ptr()?, - None, - MemoryKind::C.into(), - )?; - } - } - - "syscall" => { - // TODO: read `syscall` ids like `sysconf` ids and - // figure out some way to actually process some of them - // - // libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), GRND_NONBLOCK) - // is called if a `HashMap` is created the regular way. - match self.value_to_primval(args[0])?.to_u64()? { - 318 | 511 => { - return err!(Unimplemented( - "miri does not support random number generators".to_owned(), - )) - } - id => { - return err!(Unimplemented( - format!("miri does not support syscall id {}", id), - )) - } - } - } - - "dlsym" => { - let _handle = args[0].into_ptr(&mut self.memory)?; - let symbol = args[1].into_ptr(&mut self.memory)?.to_ptr()?; - let symbol_name = self.memory.read_c_str(symbol)?; - let err = format!("bad c unicode symbol: {:?}", symbol_name); - let symbol_name = ::std::str::from_utf8(symbol_name).unwrap_or(&err); - return err!(Unimplemented(format!( - "miri does not support dynamically loading libraries (requested symbol: {})", - symbol_name - ))); - } - - "__rust_maybe_catch_panic" => { - // fn __rust_maybe_catch_panic(f: fn(*mut u8), data: *mut u8, data_ptr: *mut usize, vtable_ptr: *mut usize) -> u32 - // We abort on panic, so not much is going on here, but we still have to call the closure - let u8_ptr_ty = self.tcx.mk_mut_ptr(self.tcx.types.u8); - let f = args[0].into_ptr(&mut self.memory)?.to_ptr()?; - let data = args[1].into_ptr(&mut self.memory)?; - let f_instance = self.memory.get_fn(f)?; - self.write_null(dest, dest_ty)?; - - // Now we make a function call. TODO: Consider making this re-usable? EvalContext::step does sth. similar for the TLS dtors, - // and of course eval_main. - let mir = self.load_mir(f_instance.def)?; - self.push_stack_frame( - f_instance, - mir.span, - mir, - Lvalue::undef(), - StackPopCleanup::Goto(dest_block), - )?; - - let arg_local = self.frame().mir.args_iter().next().ok_or( - EvalErrorKind::AbiViolation( - "Argument to __rust_maybe_catch_panic does not take enough arguments." - .to_owned(), - ), - )?; - let arg_dest = self.eval_lvalue(&mir::Lvalue::Local(arg_local))?; - self.write_ptr(arg_dest, data, u8_ptr_ty)?; - - // We ourselves return 0 - self.write_null(dest, dest_ty)?; - - // Don't fall through - return Ok(()); - } - - "__rust_start_panic" => { - return err!(Panic); - } - - "memcmp" => { - let left = args[0].into_ptr(&mut self.memory)?; - let right = args[1].into_ptr(&mut self.memory)?; - let n = self.value_to_primval(args[2])?.to_u64()?; - - let result = { - let left_bytes = self.memory.read_bytes(left, n)?; - let right_bytes = self.memory.read_bytes(right, n)?; - - use std::cmp::Ordering::*; - match left_bytes.cmp(right_bytes) { - Less => -1i8, - Equal => 0, - Greater => 1, - } - }; - - self.write_primval( - dest, - PrimVal::Bytes(result as u128), - dest_ty, - )?; - } - - "memrchr" => { - let ptr = args[0].into_ptr(&mut self.memory)?; - let val = self.value_to_primval(args[1])?.to_u64()? as u8; - let num = self.value_to_primval(args[2])?.to_u64()?; - if let Some(idx) = self.memory.read_bytes(ptr, num)?.iter().rev().position( - |&c| c == val, - ) - { - let new_ptr = ptr.offset(num - idx as u64 - 1, &self)?; - self.write_ptr(dest, new_ptr, dest_ty)?; - } else { - self.write_null(dest, dest_ty)?; - } - } - - "memchr" => { - let ptr = args[0].into_ptr(&mut self.memory)?; - let val = self.value_to_primval(args[1])?.to_u64()? as u8; - let num = self.value_to_primval(args[2])?.to_u64()?; - if let Some(idx) = self.memory.read_bytes(ptr, num)?.iter().position( - |&c| c == val, - ) - { - let new_ptr = ptr.offset(idx as u64, &self)?; - self.write_ptr(dest, new_ptr, dest_ty)?; - } else { - self.write_null(dest, dest_ty)?; - } - } - - "getenv" => { - let result = { - let name_ptr = args[0].into_ptr(&mut self.memory)?.to_ptr()?; - let name = self.memory.read_c_str(name_ptr)?; - match self.machine_data.env_vars.get(name) { - Some(&var) => PrimVal::Ptr(var), - None => PrimVal::Bytes(0), - } - }; - self.write_primval(dest, result, dest_ty)?; - } - - "unsetenv" => { - let mut success = None; - { - let name_ptr = args[0].into_ptr(&mut self.memory)?; - if !name_ptr.is_null()? { - let name = self.memory.read_c_str(name_ptr.to_ptr()?)?; - if !name.is_empty() && !name.contains(&b'=') { - success = Some(self.machine_data.env_vars.remove(name)); - } - } - } - if let Some(old) = success { - if let Some(var) = old { - self.memory.deallocate(var, None, MemoryKind::Env.into())?; - } - self.write_null(dest, dest_ty)?; - } else { - self.write_primval(dest, PrimVal::from_i128(-1), dest_ty)?; - } - } - - "setenv" => { - let mut new = None; - { - let name_ptr = args[0].into_ptr(&mut self.memory)?; - let value_ptr = args[1].into_ptr(&mut self.memory)?.to_ptr()?; - let value = self.memory.read_c_str(value_ptr)?; - if !name_ptr.is_null()? { - let name = self.memory.read_c_str(name_ptr.to_ptr()?)?; - if !name.is_empty() && !name.contains(&b'=') { - new = Some((name.to_owned(), value.to_owned())); - } - } - } - if let Some((name, value)) = new { - // +1 for the null terminator - let value_copy = self.memory.allocate( - (value.len() + 1) as u64, - 1, - MemoryKind::Env.into(), - )?; - self.memory.write_bytes(value_copy.into(), &value)?; - let trailing_zero_ptr = value_copy.offset(value.len() as u64, &self)?.into(); - self.memory.write_bytes(trailing_zero_ptr, &[0])?; - if let Some(var) = self.machine_data.env_vars.insert( - name.to_owned(), - value_copy, - ) - { - self.memory.deallocate(var, None, MemoryKind::Env.into())?; - } - self.write_null(dest, dest_ty)?; - } else { - self.write_primval(dest, PrimVal::from_i128(-1), dest_ty)?; - } - } - - "write" => { - let fd = self.value_to_primval(args[0])?.to_u64()?; - let buf = args[1].into_ptr(&mut self.memory)?; - let n = self.value_to_primval(args[2])?.to_u64()?; - trace!("Called write({:?}, {:?}, {:?})", fd, buf, n); - let result = if fd == 1 || fd == 2 { - // stdout/stderr - use std::io::{self, Write}; - - let buf_cont = self.memory.read_bytes(buf, n)?; - let res = if fd == 1 { - io::stdout().write(buf_cont) - } else { - io::stderr().write(buf_cont) - }; - match res { - Ok(n) => n as isize, - Err(_) => -1, - } - } else { - warn!("Ignored output to FD {}", fd); - n as isize // pretend it all went well - }; // now result is the value we return back to the program - self.write_primval( - dest, - PrimVal::Bytes(result as u128), - dest_ty, - )?; - } - - "strlen" => { - let ptr = args[0].into_ptr(&mut self.memory)?.to_ptr()?; - let n = self.memory.read_c_str(ptr)?.len(); - self.write_primval(dest, PrimVal::Bytes(n as u128), dest_ty)?; - } - - // Some things needed for sys::thread initialization to go through - "signal" | "sigaction" | "sigaltstack" => { - self.write_primval(dest, PrimVal::Bytes(0), dest_ty)?; - } - - "sysconf" => { - let name = self.value_to_primval(args[0])?.to_u64()?; - trace!("sysconf() called with name {}", name); - // cache the sysconf integers via miri's global cache - let paths = &[ - (&["libc", "_SC_PAGESIZE"], PrimVal::Bytes(4096)), - (&["libc", "_SC_GETPW_R_SIZE_MAX"], PrimVal::from_i128(-1)), - ]; - let mut result = None; - for &(path, path_value) in paths { - if let Ok(instance) = self.resolve_path(path) { - let cid = GlobalId { - instance, - promoted: None, - }; - // compute global if not cached - let val = match self.globals.get(&cid).cloned() { - Some(ptr) => self.value_to_primval(ValTy { value: Value::ByRef(ptr), ty: args[0].ty })?.to_u64()?, - None => eval_body_as_primval(self.tcx, instance)?.0.to_u64()?, - }; - if val == name { - result = Some(path_value); - break; - } - } - } - if let Some(result) = result { - self.write_primval(dest, result, dest_ty)?; - } else { - return err!(Unimplemented( - format!("Unimplemented sysconf name: {}", name), - )); - } - } - - // Hook pthread calls that go to the thread-local storage memory subsystem - "pthread_key_create" => { - let key_ptr = args[0].into_ptr(&mut self.memory)?; - - // Extract the function type out of the signature (that seems easier than constructing it ourselves...) - let dtor = match args[1].into_ptr(&mut self.memory)?.into_inner_primval() { - PrimVal::Ptr(dtor_ptr) => Some(self.memory.get_fn(dtor_ptr)?), - PrimVal::Bytes(0) => None, - PrimVal::Bytes(_) => return err!(ReadBytesAsPointer), - PrimVal::Undef => return err!(ReadUndefBytes), - }; - - // Figure out how large a pthread TLS key actually is. This is libc::pthread_key_t. - let key_type = args[0].ty.builtin_deref(true, ty::LvaluePreference::NoPreference) - .ok_or(EvalErrorKind::AbiViolation("Wrong signature used for pthread_key_create: First argument must be a raw pointer.".to_owned()))?.ty; - let key_size = { - let layout = self.type_layout(key_type)?; - layout.size(&self.tcx.data_layout) - }; - - // Create key and write it into the memory where key_ptr wants it - let key = self.memory.create_tls_key(dtor) as u128; - if key_size.bits() < 128 && key >= (1u128 << key_size.bits() as u128) { - return err!(OutOfTls); - } - self.memory.write_primval( - key_ptr.to_ptr()?, - PrimVal::Bytes(key), - key_size.bytes(), - false, - )?; - - // Return success (0) - self.write_null(dest, dest_ty)?; - } - "pthread_key_delete" => { - // The conversion into TlsKey here is a little fishy, but should work as long as usize >= libc::pthread_key_t - let key = self.value_to_primval(args[0])?.to_u64()? as TlsKey; - self.memory.delete_tls_key(key)?; - // Return success (0) - self.write_null(dest, dest_ty)?; - } - "pthread_getspecific" => { - // The conversion into TlsKey here is a little fishy, but should work as long as usize >= libc::pthread_key_t - let key = self.value_to_primval(args[0])?.to_u64()? as TlsKey; - let ptr = self.memory.load_tls(key)?; - self.write_ptr(dest, ptr, dest_ty)?; - } - "pthread_setspecific" => { - // The conversion into TlsKey here is a little fishy, but should work as long as usize >= libc::pthread_key_t - let key = self.value_to_primval(args[0])?.to_u64()? as TlsKey; - let new_ptr = args[1].into_ptr(&mut self.memory)?; - self.memory.store_tls(key, new_ptr)?; - - // Return success (0) - self.write_null(dest, dest_ty)?; - } - - // Stub out all the other pthread calls to just return 0 - link_name if link_name.starts_with("pthread_") => { - info!("ignoring C ABI call: {}", link_name); - self.write_null(dest, dest_ty)?; - } - - _ => { - return err!(Unimplemented( - format!("can't call C ABI function: {}", link_name), - )); - } - } - - // Since we pushed no stack frame, the main loop will act - // as if the call just completed and it's returning to the - // current frame. - self.dump_local(dest); - self.goto_block(dest_block); - Ok(()) - } - - /// Get an instance for a path. - fn resolve_path(&self, path: &[&str]) -> EvalResult<'tcx, ty::Instance<'tcx>> { - self.tcx - .crates() - .iter() - .find(|&&krate| self.tcx.original_crate_name(krate) == path[0]) - .and_then(|krate| { - let krate = DefId { - krate: *krate, - index: CRATE_DEF_INDEX, - }; - let mut items = self.tcx.item_children(krate); - let mut path_it = path.iter().skip(1).peekable(); - - while let Some(segment) = path_it.next() { - for item in mem::replace(&mut items, Default::default()).iter() { - if item.ident.name == *segment { - if path_it.peek().is_none() { - return Some(ty::Instance::mono(self.tcx, item.def.def_id())); - } - - items = self.tcx.item_children(item.def.def_id()); - break; - } - } - } - None - }) - .ok_or_else(|| { - let path = path.iter().map(|&s| s.to_owned()).collect(); - EvalErrorKind::PathNotFound(path).into() - }) - } - - fn call_missing_fn( - &mut self, - instance: ty::Instance<'tcx>, - destination: Option<(Lvalue, mir::BasicBlock)>, - args: &[ValTy<'tcx>], - sig: ty::FnSig<'tcx>, - path: String, - ) -> EvalResult<'tcx> { - // In some cases in non-MIR libstd-mode, not having a destination is legit. Handle these early. - match &path[..] { - "std::panicking::rust_panic_with_hook" | - "core::panicking::panic_fmt::::panic_impl" | - "std::rt::begin_panic_fmt" => return err!(Panic), - _ => {} - } - - let dest_ty = sig.output(); - let (dest, dest_block) = destination.ok_or_else( - || EvalErrorKind::NoMirFor(path.clone()), - )?; - - if sig.abi == Abi::C { - // An external C function - // TODO: That functions actually has a similar preamble to what follows here. May make sense to - // unify these two mechanisms for "hooking into missing functions". - self.call_c_abi( - instance.def_id(), - args, - dest, - dest_ty, - dest_block, - )?; - return Ok(()); - } - - match &path[..] { - // Allocators are magic. They have no MIR, even when the rest of libstd does. - "alloc::heap::::__rust_alloc" => { - let size = self.value_to_primval(args[0])?.to_u64()?; - let align = self.value_to_primval(args[1])?.to_u64()?; - if size == 0 { - return err!(HeapAllocZeroBytes); - } - if !align.is_power_of_two() { - return err!(HeapAllocNonPowerOfTwoAlignment(align)); - } - let ptr = self.memory.allocate(size, align, MemoryKind::Rust.into())?; - self.write_primval(dest, PrimVal::Ptr(ptr), dest_ty)?; - } - "alloc::heap::::__rust_alloc_zeroed" => { - let size = self.value_to_primval(args[0])?.to_u64()?; - let align = self.value_to_primval(args[1])?.to_u64()?; - if size == 0 { - return err!(HeapAllocZeroBytes); - } - if !align.is_power_of_two() { - return err!(HeapAllocNonPowerOfTwoAlignment(align)); - } - let ptr = self.memory.allocate(size, align, MemoryKind::Rust.into())?; - self.memory.write_repeat(ptr.into(), 0, size)?; - self.write_primval(dest, PrimVal::Ptr(ptr), dest_ty)?; - } - "alloc::heap::::__rust_dealloc" => { - let ptr = args[0].into_ptr(&mut self.memory)?.to_ptr()?; - let old_size = self.value_to_primval(args[1])?.to_u64()?; - let align = self.value_to_primval(args[2])?.to_u64()?; - if old_size == 0 { - return err!(HeapAllocZeroBytes); - } - if !align.is_power_of_two() { - return err!(HeapAllocNonPowerOfTwoAlignment(align)); - } - self.memory.deallocate( - ptr, - Some((old_size, align)), - MemoryKind::Rust.into(), - )?; - } - "alloc::heap::::__rust_realloc" => { - let ptr = args[0].into_ptr(&mut self.memory)?.to_ptr()?; - let old_size = self.value_to_primval(args[1])?.to_u64()?; - let old_align = self.value_to_primval(args[2])?.to_u64()?; - let new_size = self.value_to_primval(args[3])?.to_u64()?; - let new_align = self.value_to_primval(args[4])?.to_u64()?; - if old_size == 0 || new_size == 0 { - return err!(HeapAllocZeroBytes); - } - if !old_align.is_power_of_two() { - return err!(HeapAllocNonPowerOfTwoAlignment(old_align)); - } - if !new_align.is_power_of_two() { - return err!(HeapAllocNonPowerOfTwoAlignment(new_align)); - } - let new_ptr = self.memory.reallocate( - ptr, - old_size, - old_align, - new_size, - new_align, - MemoryKind::Rust.into(), - )?; - self.write_primval(dest, PrimVal::Ptr(new_ptr), dest_ty)?; - } - - // A Rust function is missing, which means we are running with MIR missing for libstd (or other dependencies). - // Still, we can make many things mostly work by "emulating" or ignoring some functions. - "std::io::_print" => { - warn!( - "Ignoring output. To run programs that print, make sure you have a libstd with full MIR." - ); - } - "std::thread::Builder::new" => { - return err!(Unimplemented("miri does not support threading".to_owned())) - } - "std::env::args" => { - return err!(Unimplemented( - "miri does not support program arguments".to_owned(), - )) - } - "std::panicking::panicking" | - "std::rt::panicking" => { - // we abort on panic -> `std::rt::panicking` always returns false - let bool = self.tcx.types.bool; - self.write_primval(dest, PrimVal::from_bool(false), bool)?; - } - "std::sys::imp::c::::AddVectoredExceptionHandler" | - "std::sys::imp::c::::SetThreadStackGuarantee" => { - let usize = self.tcx.types.usize; - // any non zero value works for the stdlib. This is just used for stackoverflows anyway - self.write_primval(dest, PrimVal::Bytes(1), usize)?; - }, - _ => return err!(NoMirFor(path)), - } - - // Since we pushed no stack frame, the main loop will act - // as if the call just completed and it's returning to the - // current frame. - self.dump_local(dest); - self.goto_block(dest_block); - return Ok(()); - } -} diff --git a/src/tools/miri/miri/helpers.rs b/src/tools/miri/miri/helpers.rs deleted file mode 100644 index 809e5ebfac..0000000000 --- a/src/tools/miri/miri/helpers.rs +++ /dev/null @@ -1,73 +0,0 @@ -use rustc_miri::interpret::{Pointer, EvalResult, PrimVal, EvalContext}; - -use rustc::ty::Ty; - -pub trait EvalContextExt<'tcx> { - fn wrapping_pointer_offset( - &self, - ptr: Pointer, - pointee_ty: Ty<'tcx>, - offset: i64, - ) -> EvalResult<'tcx, Pointer>; - - fn pointer_offset( - &self, - ptr: Pointer, - pointee_ty: Ty<'tcx>, - offset: i64, - ) -> EvalResult<'tcx, Pointer>; -} - -impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator> { - fn wrapping_pointer_offset( - &self, - ptr: Pointer, - pointee_ty: Ty<'tcx>, - offset: i64, - ) -> EvalResult<'tcx, Pointer> { - // FIXME: assuming here that type size is < i64::max_value() - let pointee_size = self.type_size(pointee_ty)?.expect( - "cannot offset a pointer to an unsized type", - ) as i64; - let offset = offset.overflowing_mul(pointee_size).0; - ptr.wrapping_signed_offset(offset, self) - } - - fn pointer_offset( - &self, - ptr: Pointer, - pointee_ty: Ty<'tcx>, - offset: i64, - ) -> EvalResult<'tcx, Pointer> { - // This function raises an error if the offset moves the pointer outside of its allocation. We consider - // ZSTs their own huge allocation that doesn't overlap with anything (and nothing moves in there because the size is 0). - // We also consider the NULL pointer its own separate allocation, and all the remaining integers pointers their own - // allocation. - - if ptr.is_null()? { - // NULL pointers must only be offset by 0 - return if offset == 0 { - Ok(ptr) - } else { - err!(InvalidNullPointerUsage) - }; - } - // FIXME: assuming here that type size is < i64::max_value() - let pointee_size = self.type_size(pointee_ty)?.expect( - "cannot offset a pointer to an unsized type", - ) as i64; - return if let Some(offset) = offset.checked_mul(pointee_size) { - let ptr = ptr.signed_offset(offset, self)?; - // Do not do bounds-checking for integers; they can never alias a normal pointer anyway. - if let PrimVal::Ptr(ptr) = ptr.into_inner_primval() { - self.memory.check_bounds(ptr, false)?; - } else if ptr.is_null()? { - // We moved *to* a NULL pointer. That seems wrong, LLVM considers the NULL pointer its own small allocation. Reject this, for now. - return err!(InvalidNullPointerUsage); - } - Ok(ptr) - } else { - err!(OverflowingMath) - }; - } -} diff --git a/src/tools/miri/miri/intrinsic.rs b/src/tools/miri/miri/intrinsic.rs deleted file mode 100644 index bcff3b4aa9..0000000000 --- a/src/tools/miri/miri/intrinsic.rs +++ /dev/null @@ -1,685 +0,0 @@ -use rustc::mir; -use rustc::traits::Reveal; -use rustc::ty::layout::Layout; -use rustc::ty::{self, Ty}; - -use rustc_miri::interpret::{EvalResult, Lvalue, LvalueExtra, PrimVal, PrimValKind, Value, Pointer, - HasMemory, AccessKind, EvalContext, PtrAndAlign, ValTy}; - -use helpers::EvalContextExt as HelperEvalContextExt; - -pub trait EvalContextExt<'tcx> { - fn call_intrinsic( - &mut self, - instance: ty::Instance<'tcx>, - args: &[ValTy<'tcx>], - dest: Lvalue, - dest_ty: Ty<'tcx>, - dest_layout: &'tcx Layout, - target: mir::BasicBlock, - ) -> EvalResult<'tcx>; -} - -impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator> { - fn call_intrinsic( - &mut self, - instance: ty::Instance<'tcx>, - args: &[ValTy<'tcx>], - dest: Lvalue, - dest_ty: Ty<'tcx>, - dest_layout: &'tcx Layout, - target: mir::BasicBlock, - ) -> EvalResult<'tcx> { - let substs = instance.substs; - - let intrinsic_name = &self.tcx.item_name(instance.def_id())[..]; - match intrinsic_name { - "align_offset" => { - // FIXME: return a real value in case the target allocation has an - // alignment bigger than the one requested - self.write_primval(dest, PrimVal::Bytes(u128::max_value()), dest_ty)?; - }, - - "add_with_overflow" => { - self.intrinsic_with_overflow( - mir::BinOp::Add, - args[0], - args[1], - dest, - dest_ty, - )? - } - - "sub_with_overflow" => { - self.intrinsic_with_overflow( - mir::BinOp::Sub, - args[0], - args[1], - dest, - dest_ty, - )? - } - - "mul_with_overflow" => { - self.intrinsic_with_overflow( - mir::BinOp::Mul, - args[0], - args[1], - dest, - dest_ty, - )? - } - - "arith_offset" => { - let offset = self.value_to_primval(args[1])?.to_i128()? as i64; - let ptr = args[0].into_ptr(&self.memory)?; - let result_ptr = self.wrapping_pointer_offset(ptr, substs.type_at(0), offset)?; - self.write_ptr(dest, result_ptr, dest_ty)?; - } - - "assume" => { - let cond = self.value_to_primval(args[0])?.to_bool()?; - if !cond { - return err!(AssumptionNotHeld); - } - } - - "atomic_load" | - "atomic_load_relaxed" | - "atomic_load_acq" | - "volatile_load" => { - let ptr = args[0].into_ptr(&self.memory)?; - let valty = ValTy { - value: Value::by_ref(ptr), - ty: substs.type_at(0), - }; - self.write_value(valty, dest)?; - } - - "atomic_store" | - "atomic_store_relaxed" | - "atomic_store_rel" | - "volatile_store" => { - let ty = substs.type_at(0); - let dest = args[0].into_ptr(&self.memory)?; - self.write_value_to_ptr(args[1].value, dest, ty)?; - } - - "atomic_fence_acq" => { - // we are inherently singlethreaded and singlecored, this is a nop - } - - _ if intrinsic_name.starts_with("atomic_xchg") => { - let ty = substs.type_at(0); - let ptr = args[0].into_ptr(&self.memory)?; - let change = self.value_to_primval(args[1])?; - let old = self.read_value(ptr, ty)?; - let old = match old { - Value::ByVal(val) => val, - Value::ByRef { .. } => bug!("just read the value, can't be byref"), - Value::ByValPair(..) => bug!("atomic_xchg doesn't work with nonprimitives"), - }; - self.write_primval(dest, old, ty)?; - self.write_primval( - Lvalue::from_primval_ptr(ptr), - change, - ty, - )?; - } - - _ if intrinsic_name.starts_with("atomic_cxchg") => { - let ty = substs.type_at(0); - let ptr = args[0].into_ptr(&self.memory)?; - let expect_old = self.value_to_primval(args[1])?; - let change = self.value_to_primval(args[2])?; - let old = self.read_value(ptr, ty)?; - let old = match old { - Value::ByVal(val) => val, - Value::ByRef { .. } => bug!("just read the value, can't be byref"), - Value::ByValPair(..) => bug!("atomic_cxchg doesn't work with nonprimitives"), - }; - let (val, _) = self.binary_op(mir::BinOp::Eq, old, ty, expect_old, ty)?; - let dest = self.force_allocation(dest)?.to_ptr()?; - self.write_pair_to_ptr(old, val, dest, dest_ty)?; - self.write_primval( - Lvalue::from_primval_ptr(ptr), - change, - ty, - )?; - } - - "atomic_or" | - "atomic_or_acq" | - "atomic_or_rel" | - "atomic_or_acqrel" | - "atomic_or_relaxed" | - "atomic_xor" | - "atomic_xor_acq" | - "atomic_xor_rel" | - "atomic_xor_acqrel" | - "atomic_xor_relaxed" | - "atomic_and" | - "atomic_and_acq" | - "atomic_and_rel" | - "atomic_and_acqrel" | - "atomic_and_relaxed" | - "atomic_xadd" | - "atomic_xadd_acq" | - "atomic_xadd_rel" | - "atomic_xadd_acqrel" | - "atomic_xadd_relaxed" | - "atomic_xsub" | - "atomic_xsub_acq" | - "atomic_xsub_rel" | - "atomic_xsub_acqrel" | - "atomic_xsub_relaxed" => { - let ty = substs.type_at(0); - let ptr = args[0].into_ptr(&self.memory)?; - let change = self.value_to_primval(args[1])?; - let old = self.read_value(ptr, ty)?; - let old = match old { - Value::ByVal(val) => val, - Value::ByRef { .. } => bug!("just read the value, can't be byref"), - Value::ByValPair(..) => { - bug!("atomic_xadd_relaxed doesn't work with nonprimitives") - } - }; - self.write_primval(dest, old, ty)?; - let op = match intrinsic_name.split('_').nth(1).unwrap() { - "or" => mir::BinOp::BitOr, - "xor" => mir::BinOp::BitXor, - "and" => mir::BinOp::BitAnd, - "xadd" => mir::BinOp::Add, - "xsub" => mir::BinOp::Sub, - _ => bug!(), - }; - // FIXME: what do atomics do on overflow? - let (val, _) = self.binary_op(op, old, ty, change, ty)?; - self.write_primval(Lvalue::from_primval_ptr(ptr), val, ty)?; - } - - "breakpoint" => unimplemented!(), // halt miri - - "copy" | - "copy_nonoverlapping" => { - let elem_ty = substs.type_at(0); - let elem_size = self.type_size(elem_ty)?.expect("cannot copy unsized value"); - let count = self.value_to_primval(args[2])?.to_u64()?; - if count * elem_size != 0 { - // TODO: We do not even validate alignment for the 0-bytes case. libstd relies on this in vec::IntoIter::next. - // Also see the write_bytes intrinsic. - let elem_align = self.type_align(elem_ty)?; - let src = args[0].into_ptr(&self.memory)?; - let dest = args[1].into_ptr(&self.memory)?; - self.memory.copy( - src, - dest, - count * elem_size, - elem_align, - intrinsic_name.ends_with("_nonoverlapping"), - )?; - } - } - - "ctpop" | "cttz" | "cttz_nonzero" | "ctlz" | "ctlz_nonzero" | "bswap" => { - let ty = substs.type_at(0); - let num = self.value_to_primval(args[0])?.to_bytes()?; - let kind = self.ty_to_primval_kind(ty)?; - let num = if intrinsic_name.ends_with("_nonzero") { - if num == 0 { - return err!(Intrinsic(format!("{} called on 0", intrinsic_name))); - } - numeric_intrinsic(intrinsic_name.trim_right_matches("_nonzero"), num, kind)? - } else { - numeric_intrinsic(intrinsic_name, num, kind)? - }; - self.write_primval(dest, num, ty)?; - } - - "discriminant_value" => { - let ty = substs.type_at(0); - let adt_ptr = args[0].into_ptr(&self.memory)?.to_ptr()?; - let discr_val = self.read_discriminant_value(adt_ptr, ty)?; - self.write_primval(dest, PrimVal::Bytes(discr_val), dest_ty)?; - } - - "sinf32" | "fabsf32" | "cosf32" | "sqrtf32" | "expf32" | "exp2f32" | "logf32" | - "log10f32" | "log2f32" | "floorf32" | "ceilf32" | "truncf32" => { - let f = self.value_to_primval(args[0])?.to_f32()?; - let f = match intrinsic_name { - "sinf32" => f.sin(), - "fabsf32" => f.abs(), - "cosf32" => f.cos(), - "sqrtf32" => f.sqrt(), - "expf32" => f.exp(), - "exp2f32" => f.exp2(), - "logf32" => f.ln(), - "log10f32" => f.log10(), - "log2f32" => f.log2(), - "floorf32" => f.floor(), - "ceilf32" => f.ceil(), - "truncf32" => f.trunc(), - _ => bug!(), - }; - self.write_primval(dest, PrimVal::from_f32(f), dest_ty)?; - } - - "sinf64" | "fabsf64" | "cosf64" | "sqrtf64" | "expf64" | "exp2f64" | "logf64" | - "log10f64" | "log2f64" | "floorf64" | "ceilf64" | "truncf64" => { - let f = self.value_to_primval(args[0])?.to_f64()?; - let f = match intrinsic_name { - "sinf64" => f.sin(), - "fabsf64" => f.abs(), - "cosf64" => f.cos(), - "sqrtf64" => f.sqrt(), - "expf64" => f.exp(), - "exp2f64" => f.exp2(), - "logf64" => f.ln(), - "log10f64" => f.log10(), - "log2f64" => f.log2(), - "floorf64" => f.floor(), - "ceilf64" => f.ceil(), - "truncf64" => f.trunc(), - _ => bug!(), - }; - self.write_primval(dest, PrimVal::from_f64(f), dest_ty)?; - } - - "fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" => { - let ty = substs.type_at(0); - let a = self.value_to_primval(args[0])?; - let b = self.value_to_primval(args[1])?; - let op = match intrinsic_name { - "fadd_fast" => mir::BinOp::Add, - "fsub_fast" => mir::BinOp::Sub, - "fmul_fast" => mir::BinOp::Mul, - "fdiv_fast" => mir::BinOp::Div, - "frem_fast" => mir::BinOp::Rem, - _ => bug!(), - }; - let result = self.binary_op(op, a, ty, b, ty)?; - self.write_primval(dest, result.0, dest_ty)?; - } - - "likely" | "unlikely" | "forget" => {} - - "init" => { - let size = self.type_size(dest_ty)?.expect("cannot zero unsized value"); - let init = |this: &mut Self, val: Value| { - let zero_val = match val { - Value::ByRef(PtrAndAlign { ptr, .. }) => { - // These writes have no alignment restriction anyway. - this.memory.write_repeat(ptr, 0, size)?; - val - } - // TODO(solson): Revisit this, it's fishy to check for Undef here. - Value::ByVal(PrimVal::Undef) => { - match this.ty_to_primval_kind(dest_ty) { - Ok(_) => Value::ByVal(PrimVal::Bytes(0)), - Err(_) => { - let ptr = this.alloc_ptr_with_substs(dest_ty, substs)?; - let ptr = Pointer::from(PrimVal::Ptr(ptr)); - this.memory.write_repeat(ptr, 0, size)?; - Value::by_ref(ptr) - } - } - } - Value::ByVal(_) => Value::ByVal(PrimVal::Bytes(0)), - Value::ByValPair(..) => { - Value::ByValPair(PrimVal::Bytes(0), PrimVal::Bytes(0)) - } - }; - Ok(zero_val) - }; - match dest { - Lvalue::Local { frame, local } => self.modify_local(frame, local, init)?, - Lvalue::Ptr { - ptr: PtrAndAlign { ptr, aligned: true }, - extra: LvalueExtra::None, - } => self.memory.write_repeat(ptr, 0, size)?, - Lvalue::Ptr { .. } => { - bug!("init intrinsic tried to write to fat or unaligned ptr target") - } - } - } - - "min_align_of" => { - let elem_ty = substs.type_at(0); - let elem_align = self.type_align(elem_ty)?; - let align_val = PrimVal::from_u128(elem_align as u128); - self.write_primval(dest, align_val, dest_ty)?; - } - - "pref_align_of" => { - let ty = substs.type_at(0); - let layout = self.type_layout(ty)?; - let align = layout.align(&self.tcx.data_layout).pref(); - let align_val = PrimVal::from_u128(align as u128); - self.write_primval(dest, align_val, dest_ty)?; - } - - "move_val_init" => { - let ty = substs.type_at(0); - let ptr = args[0].into_ptr(&self.memory)?; - self.write_value_to_ptr(args[1].value, ptr, ty)?; - } - - "needs_drop" => { - let ty = substs.type_at(0); - let env = ty::ParamEnv::empty(Reveal::All); - let needs_drop = ty.needs_drop(self.tcx, env); - self.write_primval( - dest, - PrimVal::from_bool(needs_drop), - dest_ty, - )?; - } - - "offset" => { - let offset = self.value_to_primval(args[1])?.to_i128()? as i64; - let ptr = args[0].into_ptr(&self.memory)?; - let result_ptr = self.pointer_offset(ptr, substs.type_at(0), offset)?; - self.write_ptr(dest, result_ptr, dest_ty)?; - } - - "overflowing_sub" => { - self.intrinsic_overflowing( - mir::BinOp::Sub, - args[0], - args[1], - dest, - dest_ty, - )?; - } - - "overflowing_mul" => { - self.intrinsic_overflowing( - mir::BinOp::Mul, - args[0], - args[1], - dest, - dest_ty, - )?; - } - - "overflowing_add" => { - self.intrinsic_overflowing( - mir::BinOp::Add, - args[0], - args[1], - dest, - dest_ty, - )?; - } - - "powf32" => { - let f = self.value_to_primval(args[0])?.to_f32()?; - let f2 = self.value_to_primval(args[1])?.to_f32()?; - self.write_primval( - dest, - PrimVal::from_f32(f.powf(f2)), - dest_ty, - )?; - } - - "powf64" => { - let f = self.value_to_primval(args[0])?.to_f64()?; - let f2 = self.value_to_primval(args[1])?.to_f64()?; - self.write_primval( - dest, - PrimVal::from_f64(f.powf(f2)), - dest_ty, - )?; - } - - "fmaf32" => { - let a = self.value_to_primval(args[0])?.to_f32()?; - let b = self.value_to_primval(args[1])?.to_f32()?; - let c = self.value_to_primval(args[2])?.to_f32()?; - self.write_primval( - dest, - PrimVal::from_f32(a * b + c), - dest_ty, - )?; - } - - "fmaf64" => { - let a = self.value_to_primval(args[0])?.to_f64()?; - let b = self.value_to_primval(args[1])?.to_f64()?; - let c = self.value_to_primval(args[2])?.to_f64()?; - self.write_primval( - dest, - PrimVal::from_f64(a * b + c), - dest_ty, - )?; - } - - "powif32" => { - let f = self.value_to_primval(args[0])?.to_f32()?; - let i = self.value_to_primval(args[1])?.to_i128()?; - self.write_primval( - dest, - PrimVal::from_f32(f.powi(i as i32)), - dest_ty, - )?; - } - - "powif64" => { - let f = self.value_to_primval(args[0])?.to_f64()?; - let i = self.value_to_primval(args[1])?.to_i128()?; - self.write_primval( - dest, - PrimVal::from_f64(f.powi(i as i32)), - dest_ty, - )?; - } - - "size_of" => { - let ty = substs.type_at(0); - let size = self.type_size(ty)?.expect( - "size_of intrinsic called on unsized value", - ) as u128; - self.write_primval(dest, PrimVal::from_u128(size), dest_ty)?; - } - - "size_of_val" => { - let ty = substs.type_at(0); - let (size, _) = self.size_and_align_of_dst(ty, args[0].value)?; - self.write_primval( - dest, - PrimVal::from_u128(size as u128), - dest_ty, - )?; - } - - "min_align_of_val" | - "align_of_val" => { - let ty = substs.type_at(0); - let (_, align) = self.size_and_align_of_dst(ty, args[0].value)?; - self.write_primval( - dest, - PrimVal::from_u128(align as u128), - dest_ty, - )?; - } - - "type_name" => { - let ty = substs.type_at(0); - let ty_name = ty.to_string(); - let value = self.str_to_value(&ty_name)?; - self.write_value(ValTy { value, ty: dest_ty }, dest)?; - } - "type_id" => { - let ty = substs.type_at(0); - let n = self.tcx.type_id_hash(ty); - self.write_primval(dest, PrimVal::Bytes(n as u128), dest_ty)?; - } - - "transmute" => { - let src_ty = substs.type_at(0); - let ptr = self.force_allocation(dest)?.to_ptr()?; - self.write_maybe_aligned_mut( - /*aligned*/ - false, - |ectx| { - ectx.write_value_to_ptr(args[0].value, ptr.into(), src_ty) - }, - )?; - } - - "unchecked_shl" => { - let bits = self.type_size(dest_ty)?.expect( - "intrinsic can't be called on unsized type", - ) as u128 * 8; - let rhs = self.value_to_primval(args[1])? - .to_bytes()?; - if rhs >= bits { - return err!(Intrinsic( - format!("Overflowing shift by {} in unchecked_shl", rhs), - )); - } - self.intrinsic_overflowing( - mir::BinOp::Shl, - args[0], - args[1], - dest, - dest_ty, - )?; - } - - "unchecked_shr" => { - let bits = self.type_size(dest_ty)?.expect( - "intrinsic can't be called on unsized type", - ) as u128 * 8; - let rhs = self.value_to_primval(args[1])? - .to_bytes()?; - if rhs >= bits { - return err!(Intrinsic( - format!("Overflowing shift by {} in unchecked_shr", rhs), - )); - } - self.intrinsic_overflowing( - mir::BinOp::Shr, - args[0], - args[1], - dest, - dest_ty, - )?; - } - - "unchecked_div" => { - let rhs = self.value_to_primval(args[1])? - .to_bytes()?; - if rhs == 0 { - return err!(Intrinsic(format!("Division by 0 in unchecked_div"))); - } - self.intrinsic_overflowing( - mir::BinOp::Div, - args[0], - args[1], - dest, - dest_ty, - )?; - } - - "unchecked_rem" => { - let rhs = self.value_to_primval(args[1])? - .to_bytes()?; - if rhs == 0 { - return err!(Intrinsic(format!("Division by 0 in unchecked_rem"))); - } - self.intrinsic_overflowing( - mir::BinOp::Rem, - args[0], - args[1], - dest, - dest_ty, - )?; - } - - "uninit" => { - let size = dest_layout.size(&self.tcx.data_layout).bytes(); - let uninit = |this: &mut Self, val: Value| match val { - Value::ByRef(PtrAndAlign { ptr, .. }) => { - this.memory.mark_definedness(ptr, size, false)?; - Ok(val) - } - _ => Ok(Value::ByVal(PrimVal::Undef)), - }; - match dest { - Lvalue::Local { frame, local } => self.modify_local(frame, local, uninit)?, - Lvalue::Ptr { - ptr: PtrAndAlign { ptr, aligned: true }, - extra: LvalueExtra::None, - } => self.memory.mark_definedness(ptr, size, false)?, - Lvalue::Ptr { .. } => { - bug!("uninit intrinsic tried to write to fat or unaligned ptr target") - } - } - } - - "write_bytes" => { - let ty = substs.type_at(0); - let ty_align = self.type_align(ty)?; - let val_byte = self.value_to_primval(args[1])?.to_u128()? as u8; - let size = self.type_size(ty)?.expect( - "write_bytes() type must be sized", - ); - let ptr = args[0].into_ptr(&self.memory)?; - let count = self.value_to_primval(args[2])?.to_u64()?; - if count > 0 { - // HashMap relies on write_bytes on a NULL ptr with count == 0 to work - // TODO: Should we, at least, validate the alignment? (Also see the copy intrinsic) - self.memory.check_align(ptr, ty_align, Some(AccessKind::Write))?; - self.memory.write_repeat(ptr, val_byte, size * count)?; - } - } - - name => return err!(Unimplemented(format!("unimplemented intrinsic: {}", name))), - } - - self.goto_block(target); - - // Since we pushed no stack frame, the main loop will act - // as if the call just completed and it's returning to the - // current frame. - Ok(()) - } -} - -fn numeric_intrinsic<'tcx>( - name: &str, - bytes: u128, - kind: PrimValKind, -) -> EvalResult<'tcx, PrimVal> { - macro_rules! integer_intrinsic { - ($method:ident) => ({ - use rustc_miri::interpret::PrimValKind::*; - let result_bytes = match kind { - I8 => (bytes as i8).$method() as u128, - U8 => (bytes as u8).$method() as u128, - I16 => (bytes as i16).$method() as u128, - U16 => (bytes as u16).$method() as u128, - I32 => (bytes as i32).$method() as u128, - U32 => (bytes as u32).$method() as u128, - I64 => (bytes as i64).$method() as u128, - U64 => (bytes as u64).$method() as u128, - I128 => (bytes as i128).$method() as u128, - U128 => bytes.$method() as u128, - _ => bug!("invalid `{}` argument: {:?}", name, bytes), - }; - - PrimVal::Bytes(result_bytes) - }); - } - - let result_val = match name { - "bswap" => integer_intrinsic!(swap_bytes), - "ctlz" => integer_intrinsic!(leading_zeros), - "ctpop" => integer_intrinsic!(count_ones), - "cttz" => integer_intrinsic!(trailing_zeros), - _ => bug!("not a numeric intrinsic: {}", name), - }; - - Ok(result_val) -} diff --git a/src/tools/miri/miri/lib.rs b/src/tools/miri/miri/lib.rs deleted file mode 100644 index 428724f7de..0000000000 --- a/src/tools/miri/miri/lib.rs +++ /dev/null @@ -1,270 +0,0 @@ -#![feature( - i128_type, - rustc_private, -)] - -// From rustc. -#[macro_use] -extern crate log; -#[macro_use] -extern crate rustc; -extern crate syntax; - -use rustc::ty::{self, TyCtxt}; -use rustc::ty::layout::Layout; -use rustc::hir::def_id::DefId; -use rustc::mir; - -use syntax::ast::Mutability; -use syntax::codemap::Span; - -use std::collections::{HashMap, BTreeMap}; - -#[macro_use] -extern crate rustc_miri; -pub use rustc_miri::interpret::*; - -mod fn_call; -mod operator; -mod intrinsic; -mod helpers; -mod memory; -mod tls; - -use fn_call::EvalContextExt as MissingFnsEvalContextExt; -use operator::EvalContextExt as OperatorEvalContextExt; -use intrinsic::EvalContextExt as IntrinsicEvalContextExt; -use tls::EvalContextExt as TlsEvalContextExt; - -pub fn eval_main<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - main_id: DefId, - start_wrapper: Option<DefId>, - limits: ResourceLimits, -) { - fn run_main<'a, 'tcx: 'a>( - ecx: &mut rustc_miri::interpret::EvalContext<'a, 'tcx, Evaluator>, - main_id: DefId, - start_wrapper: Option<DefId>, - ) -> EvalResult<'tcx> { - let main_instance = ty::Instance::mono(ecx.tcx, main_id); - let main_mir = ecx.load_mir(main_instance.def)?; - let mut cleanup_ptr = None; // Pointer to be deallocated when we are done - - if !main_mir.return_ty.is_nil() || main_mir.arg_count != 0 { - return err!(Unimplemented( - "miri does not support main functions without `fn()` type signatures" - .to_owned(), - )); - } - - if let Some(start_id) = start_wrapper { - let start_instance = ty::Instance::mono(ecx.tcx, start_id); - let start_mir = ecx.load_mir(start_instance.def)?; - - if start_mir.arg_count != 3 { - return err!(AbiViolation(format!( - "'start' lang item should have three arguments, but has {}", - start_mir.arg_count - ))); - } - - // Return value - let size = ecx.tcx.data_layout.pointer_size.bytes(); - let align = ecx.tcx.data_layout.pointer_align.abi(); - let ret_ptr = ecx.memory_mut().allocate(size, align, MemoryKind::Stack)?; - cleanup_ptr = Some(ret_ptr); - - // Push our stack frame - ecx.push_stack_frame( - start_instance, - start_mir.span, - start_mir, - Lvalue::from_ptr(ret_ptr), - StackPopCleanup::None, - )?; - - let mut args = ecx.frame().mir.args_iter(); - - // First argument: pointer to main() - let main_ptr = ecx.memory_mut().create_fn_alloc(main_instance); - let dest = ecx.eval_lvalue(&mir::Lvalue::Local(args.next().unwrap()))?; - let main_ty = main_instance.def.def_ty(ecx.tcx); - let main_ptr_ty = ecx.tcx.mk_fn_ptr(main_ty.fn_sig(ecx.tcx)); - ecx.write_value( - ValTy { - value: Value::ByVal(PrimVal::Ptr(main_ptr)), - ty: main_ptr_ty, - }, - dest, - )?; - - // Second argument (argc): 1 - let dest = ecx.eval_lvalue(&mir::Lvalue::Local(args.next().unwrap()))?; - let ty = ecx.tcx.types.isize; - ecx.write_primval(dest, PrimVal::Bytes(1), ty)?; - - // FIXME: extract main source file path - // Third argument (argv): &[b"foo"] - let dest = ecx.eval_lvalue(&mir::Lvalue::Local(args.next().unwrap()))?; - let ty = ecx.tcx.mk_imm_ptr(ecx.tcx.mk_imm_ptr(ecx.tcx.types.u8)); - let foo = ecx.memory.allocate_cached(b"foo\0")?; - let ptr_size = ecx.memory.pointer_size(); - let foo_ptr = ecx.memory.allocate(ptr_size * 1, ptr_size, MemoryKind::UninitializedStatic)?; - ecx.memory.write_primval(foo_ptr.into(), PrimVal::Ptr(foo.into()), ptr_size, false)?; - ecx.memory.mark_static_initalized(foo_ptr.alloc_id, Mutability::Immutable)?; - ecx.write_ptr(dest, foo_ptr.into(), ty)?; - } else { - ecx.push_stack_frame( - main_instance, - main_mir.span, - main_mir, - Lvalue::undef(), - StackPopCleanup::None, - )?; - } - - while ecx.step()? {} - ecx.run_tls_dtors()?; - if let Some(cleanup_ptr) = cleanup_ptr { - ecx.memory_mut().deallocate( - cleanup_ptr, - None, - MemoryKind::Stack, - )?; - } - Ok(()) - } - - let mut ecx = EvalContext::new(tcx, limits, Default::default(), Default::default()); - match run_main(&mut ecx, main_id, start_wrapper) { - Ok(()) => { - let leaks = ecx.memory().leak_report(); - if leaks != 0 { - tcx.sess.err("the evaluated program leaked memory"); - } - } - Err(mut e) => { - ecx.report(&mut e); - } - } -} - -pub struct Evaluator; -#[derive(Default)] -pub struct EvaluatorData { - /// Environment variables set by `setenv` - /// Miri does not expose env vars from the host to the emulated program - pub(crate) env_vars: HashMap<Vec<u8>, MemoryPointer>, -} - -pub type TlsKey = usize; - -#[derive(Copy, Clone, Debug)] -pub struct TlsEntry<'tcx> { - data: Pointer, // Will eventually become a map from thread IDs to `Pointer`s, if we ever support more than one thread. - dtor: Option<ty::Instance<'tcx>>, -} - -#[derive(Default)] -pub struct MemoryData<'tcx> { - /// The Key to use for the next thread-local allocation. - next_thread_local: TlsKey, - - /// pthreads-style thread-local storage. - thread_local: BTreeMap<TlsKey, TlsEntry<'tcx>>, -} - -impl<'tcx> Machine<'tcx> for Evaluator { - type Data = EvaluatorData; - type MemoryData = MemoryData<'tcx>; - type MemoryKinds = memory::MemoryKind; - - /// Returns Ok() when the function was handled, fail otherwise - fn eval_fn_call<'a>( - ecx: &mut EvalContext<'a, 'tcx, Self>, - instance: ty::Instance<'tcx>, - destination: Option<(Lvalue, mir::BasicBlock)>, - args: &[ValTy<'tcx>], - span: Span, - sig: ty::FnSig<'tcx>, - ) -> EvalResult<'tcx, bool> { - ecx.eval_fn_call(instance, destination, args, span, sig) - } - - fn call_intrinsic<'a>( - ecx: &mut rustc_miri::interpret::EvalContext<'a, 'tcx, Self>, - instance: ty::Instance<'tcx>, - args: &[ValTy<'tcx>], - dest: Lvalue, - dest_ty: ty::Ty<'tcx>, - dest_layout: &'tcx Layout, - target: mir::BasicBlock, - ) -> EvalResult<'tcx> { - ecx.call_intrinsic(instance, args, dest, dest_ty, dest_layout, target) - } - - fn try_ptr_op<'a>( - ecx: &rustc_miri::interpret::EvalContext<'a, 'tcx, Self>, - bin_op: mir::BinOp, - left: PrimVal, - left_ty: ty::Ty<'tcx>, - right: PrimVal, - right_ty: ty::Ty<'tcx>, - ) -> EvalResult<'tcx, Option<(PrimVal, bool)>> { - ecx.ptr_op(bin_op, left, left_ty, right, right_ty) - } - - fn mark_static_initialized(m: memory::MemoryKind) -> EvalResult<'tcx> { - use memory::MemoryKind::*; - match m { - // FIXME: This could be allowed, but not for env vars set during miri execution - Env => err!(Unimplemented("statics can't refer to env vars".to_owned())), - _ => Ok(()), - } - } - - fn box_alloc<'a>( - ecx: &mut EvalContext<'a, 'tcx, Self>, - ty: ty::Ty<'tcx>, - ) -> EvalResult<'tcx, PrimVal> { - // FIXME: call the `exchange_malloc` lang item if available - let size = ecx.type_size(ty)?.expect("box only works with sized types"); - let align = ecx.type_align(ty)?; - if size == 0 { - Ok(PrimVal::Bytes(align.into())) - } else { - ecx.memory - .allocate(size, align, MemoryKind::Machine(memory::MemoryKind::Rust)) - .map(PrimVal::Ptr) - } - } - - fn global_item_with_linkage<'a>( - ecx: &mut EvalContext<'a, 'tcx, Self>, - instance: ty::Instance<'tcx>, - mutability: Mutability, - ) -> EvalResult<'tcx> { - // FIXME: check that it's `#[linkage = "extern_weak"]` - trace!("Initializing an extern global with NULL"); - let ptr_size = ecx.memory.pointer_size(); - let ptr = ecx.memory.allocate( - ptr_size, - ptr_size, - MemoryKind::UninitializedStatic, - )?; - ecx.memory.write_ptr_sized_unsigned(ptr, PrimVal::Bytes(0))?; - ecx.memory.mark_static_initalized(ptr.alloc_id, mutability)?; - ecx.globals.insert( - GlobalId { - instance, - promoted: None, - }, - PtrAndAlign { - ptr: ptr.into(), - aligned: true, - }, - ); - Ok(()) - } -} diff --git a/src/tools/miri/miri/memory.rs b/src/tools/miri/miri/memory.rs deleted file mode 100644 index 110540c0cf..0000000000 --- a/src/tools/miri/miri/memory.rs +++ /dev/null @@ -1,16 +0,0 @@ - -#[derive(Debug, PartialEq, Copy, Clone)] -pub enum MemoryKind { - /// Error if deallocated any other way than `rust_deallocate` - Rust, - /// Error if deallocated any other way than `free` - C, - /// Part of env var emulation - Env, -} - -impl Into<::rustc_miri::interpret::MemoryKind<MemoryKind>> for MemoryKind { - fn into(self) -> ::rustc_miri::interpret::MemoryKind<MemoryKind> { - ::rustc_miri::interpret::MemoryKind::Machine(self) - } -} diff --git a/src/tools/miri/miri/operator.rs b/src/tools/miri/miri/operator.rs deleted file mode 100644 index 6d68aadf96..0000000000 --- a/src/tools/miri/miri/operator.rs +++ /dev/null @@ -1,175 +0,0 @@ -use rustc::ty; -use rustc::mir; - -use rustc_miri::interpret::*; - -use helpers::EvalContextExt as HelperEvalContextExt; - -pub trait EvalContextExt<'tcx> { - fn ptr_op( - &self, - bin_op: mir::BinOp, - left: PrimVal, - left_ty: ty::Ty<'tcx>, - right: PrimVal, - right_ty: ty::Ty<'tcx>, - ) -> EvalResult<'tcx, Option<(PrimVal, bool)>>; - - fn ptr_int_arithmetic( - &self, - bin_op: mir::BinOp, - left: MemoryPointer, - right: i128, - signed: bool, - ) -> EvalResult<'tcx, (PrimVal, bool)>; -} - -impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator> { - fn ptr_op( - &self, - bin_op: mir::BinOp, - left: PrimVal, - left_ty: ty::Ty<'tcx>, - right: PrimVal, - right_ty: ty::Ty<'tcx>, - ) -> EvalResult<'tcx, Option<(PrimVal, bool)>> { - use rustc_miri::interpret::PrimValKind::*; - use rustc::mir::BinOp::*; - let usize = PrimValKind::from_uint_size(self.memory.pointer_size()); - let isize = PrimValKind::from_int_size(self.memory.pointer_size()); - let left_kind = self.ty_to_primval_kind(left_ty)?; - let right_kind = self.ty_to_primval_kind(right_ty)?; - match bin_op { - Offset if left_kind == Ptr && right_kind == usize => { - let pointee_ty = left_ty - .builtin_deref(true, ty::LvaluePreference::NoPreference) - .expect("Offset called on non-ptr type") - .ty; - let ptr = self.pointer_offset( - left.into(), - pointee_ty, - right.to_bytes()? as i64, - )?; - Ok(Some((ptr.into_inner_primval(), false))) - } - // These work on anything - Eq if left_kind == right_kind => { - let result = match (left, right) { - (PrimVal::Bytes(left), PrimVal::Bytes(right)) => left == right, - (PrimVal::Ptr(left), PrimVal::Ptr(right)) => left == right, - (PrimVal::Undef, _) | - (_, PrimVal::Undef) => return err!(ReadUndefBytes), - _ => false, - }; - Ok(Some((PrimVal::from_bool(result), false))) - } - Ne if left_kind == right_kind => { - let result = match (left, right) { - (PrimVal::Bytes(left), PrimVal::Bytes(right)) => left != right, - (PrimVal::Ptr(left), PrimVal::Ptr(right)) => left != right, - (PrimVal::Undef, _) | - (_, PrimVal::Undef) => return err!(ReadUndefBytes), - _ => true, - }; - Ok(Some((PrimVal::from_bool(result), false))) - } - // These need both pointers to be in the same allocation - Lt | Le | Gt | Ge | Sub - if left_kind == right_kind && - (left_kind == Ptr || left_kind == usize || left_kind == isize) && - left.is_ptr() && right.is_ptr() => { - let left = left.to_ptr()?; - let right = right.to_ptr()?; - if left.alloc_id == right.alloc_id { - let res = match bin_op { - Lt => left.offset < right.offset, - Le => left.offset <= right.offset, - Gt => left.offset > right.offset, - Ge => left.offset >= right.offset, - Sub => { - return self.binary_op( - Sub, - PrimVal::Bytes(left.offset as u128), - self.tcx.types.usize, - PrimVal::Bytes(right.offset as u128), - self.tcx.types.usize, - ).map(Some) - } - _ => bug!("We already established it has to be one of these operators."), - }; - Ok(Some((PrimVal::from_bool(res), false))) - } else { - // Both are pointers, but from different allocations. - err!(InvalidPointerMath) - } - } - // These work if one operand is a pointer, the other an integer - Add | BitAnd | Sub - if left_kind == right_kind && (left_kind == usize || left_kind == isize) && - left.is_ptr() && right.is_bytes() => { - // Cast to i128 is fine as we checked the kind to be ptr-sized - self.ptr_int_arithmetic( - bin_op, - left.to_ptr()?, - right.to_bytes()? as i128, - left_kind == isize, - ).map(Some) - } - Add | BitAnd - if left_kind == right_kind && (left_kind == usize || left_kind == isize) && - left.is_bytes() && right.is_ptr() => { - // This is a commutative operation, just swap the operands - self.ptr_int_arithmetic( - bin_op, - right.to_ptr()?, - left.to_bytes()? as i128, - left_kind == isize, - ).map(Some) - } - _ => Ok(None), - } - } - - fn ptr_int_arithmetic( - &self, - bin_op: mir::BinOp, - left: MemoryPointer, - right: i128, - signed: bool, - ) -> EvalResult<'tcx, (PrimVal, bool)> { - use rustc::mir::BinOp::*; - - fn map_to_primval((res, over): (MemoryPointer, bool)) -> (PrimVal, bool) { - (PrimVal::Ptr(res), over) - } - - Ok(match bin_op { - Sub => - // The only way this can overflow is by underflowing, so signdeness of the right operands does not matter - map_to_primval(left.overflowing_signed_offset(-right, self)), - Add if signed => - map_to_primval(left.overflowing_signed_offset(right, self)), - Add if !signed => - map_to_primval(left.overflowing_offset(right as u64, self)), - - BitAnd if !signed => { - let base_mask : u64 = !(self.memory.get(left.alloc_id)?.align - 1); - let right = right as u64; - if right & base_mask == base_mask { - // Case 1: The base address bits are all preserved, i.e., right is all-1 there - (PrimVal::Ptr(MemoryPointer::new(left.alloc_id, left.offset & right)), false) - } else if right & base_mask == 0 { - // Case 2: The base address bits are all taken away, i.e., right is all-0 there - (PrimVal::from_u128((left.offset & right) as u128), false) - } else { - return err!(ReadPointerAsBytes); - } - } - - _ => { - let msg = format!("unimplemented binary op on pointer {:?}: {:?}, {:?} ({})", bin_op, left, right, if signed { "signed" } else { "unsigned" }); - return err!(Unimplemented(msg)); - } - }) - } -} diff --git a/src/tools/miri/miri/tls.rs b/src/tools/miri/miri/tls.rs deleted file mode 100644 index e592478f6f..0000000000 --- a/src/tools/miri/miri/tls.rs +++ /dev/null @@ -1,142 +0,0 @@ -use rustc::{ty, mir}; - -use super::{TlsKey, TlsEntry, EvalResult, EvalErrorKind, Pointer, Memory, Evaluator, Lvalue, - StackPopCleanup, EvalContext}; - -pub trait MemoryExt<'tcx> { - fn create_tls_key(&mut self, dtor: Option<ty::Instance<'tcx>>) -> TlsKey; - fn delete_tls_key(&mut self, key: TlsKey) -> EvalResult<'tcx>; - fn load_tls(&mut self, key: TlsKey) -> EvalResult<'tcx, Pointer>; - fn store_tls(&mut self, key: TlsKey, new_data: Pointer) -> EvalResult<'tcx>; - fn fetch_tls_dtor( - &mut self, - key: Option<TlsKey>, - ) -> EvalResult<'tcx, Option<(ty::Instance<'tcx>, Pointer, TlsKey)>>; -} - -pub trait EvalContextExt<'tcx> { - fn run_tls_dtors(&mut self) -> EvalResult<'tcx>; -} - -impl<'a, 'tcx: 'a> MemoryExt<'tcx> for Memory<'a, 'tcx, Evaluator> { - fn create_tls_key(&mut self, dtor: Option<ty::Instance<'tcx>>) -> TlsKey { - let new_key = self.data.next_thread_local; - self.data.next_thread_local += 1; - self.data.thread_local.insert( - new_key, - TlsEntry { - data: Pointer::null(), - dtor, - }, - ); - trace!("New TLS key allocated: {} with dtor {:?}", new_key, dtor); - return new_key; - } - - fn delete_tls_key(&mut self, key: TlsKey) -> EvalResult<'tcx> { - return match self.data.thread_local.remove(&key) { - Some(_) => { - trace!("TLS key {} removed", key); - Ok(()) - } - None => err!(TlsOutOfBounds), - }; - } - - fn load_tls(&mut self, key: TlsKey) -> EvalResult<'tcx, Pointer> { - return match self.data.thread_local.get(&key) { - Some(&TlsEntry { data, .. }) => { - trace!("TLS key {} loaded: {:?}", key, data); - Ok(data) - } - None => err!(TlsOutOfBounds), - }; - } - - fn store_tls(&mut self, key: TlsKey, new_data: Pointer) -> EvalResult<'tcx> { - return match self.data.thread_local.get_mut(&key) { - Some(&mut TlsEntry { ref mut data, .. }) => { - trace!("TLS key {} stored: {:?}", key, new_data); - *data = new_data; - Ok(()) - } - None => err!(TlsOutOfBounds), - }; - } - - /// Returns a dtor, its argument and its index, if one is supposed to run - /// - /// An optional destructor function may be associated with each key value. - /// At thread exit, if a key value has a non-NULL destructor pointer, - /// and the thread has a non-NULL value associated with that key, - /// the value of the key is set to NULL, and then the function pointed - /// to is called with the previously associated value as its sole argument. - /// The order of destructor calls is unspecified if more than one destructor - /// exists for a thread when it exits. - /// - /// If, after all the destructors have been called for all non-NULL values - /// with associated destructors, there are still some non-NULL values with - /// associated destructors, then the process is repeated. - /// If, after at least {PTHREAD_DESTRUCTOR_ITERATIONS} iterations of destructor - /// calls for outstanding non-NULL values, there are still some non-NULL values - /// with associated destructors, implementations may stop calling destructors, - /// or they may continue calling destructors until no non-NULL values with - /// associated destructors exist, even though this might result in an infinite loop. - fn fetch_tls_dtor( - &mut self, - key: Option<TlsKey>, - ) -> EvalResult<'tcx, Option<(ty::Instance<'tcx>, Pointer, TlsKey)>> { - use std::collections::Bound::*; - let start = match key { - Some(key) => Excluded(key), - None => Unbounded, - }; - for (&key, &mut TlsEntry { ref mut data, dtor }) in - self.data.thread_local.range_mut((start, Unbounded)) - { - if !data.is_null()? { - if let Some(dtor) = dtor { - let ret = Some((dtor, *data, key)); - *data = Pointer::null(); - return Ok(ret); - } - } - } - return Ok(None); - } -} - -impl<'a, 'tcx: 'a> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, Evaluator> { - fn run_tls_dtors(&mut self) -> EvalResult<'tcx> { - let mut dtor = self.memory.fetch_tls_dtor(None)?; - // FIXME: replace loop by some structure that works with stepping - while let Some((instance, ptr, key)) = dtor { - trace!("Running TLS dtor {:?} on {:?}", instance, ptr); - // TODO: Potentially, this has to support all the other possible instances? - // See eval_fn_call in interpret/terminator/mod.rs - let mir = self.load_mir(instance.def)?; - self.push_stack_frame( - instance, - mir.span, - mir, - Lvalue::undef(), - StackPopCleanup::None, - )?; - let arg_local = self.frame().mir.args_iter().next().ok_or( - EvalErrorKind::AbiViolation("TLS dtor does not take enough arguments.".to_owned()), - )?; - let dest = self.eval_lvalue(&mir::Lvalue::Local(arg_local))?; - let ty = self.tcx.mk_mut_ptr(self.tcx.types.u8); - self.write_ptr(dest, ptr, ty)?; - - // step until out of stackframes - while self.step()? {} - - dtor = match self.memory.fetch_tls_dtor(Some(key))? { - dtor @ Some(_) => dtor, - None => self.memory.fetch_tls_dtor(None)?, - }; - } - Ok(()) - } -} diff --git a/src/tools/miri/rustc_tests/Cargo.lock b/src/tools/miri/rustc_tests/Cargo.lock deleted file mode 100644 index a1e273a96b..0000000000 --- a/src/tools/miri/rustc_tests/Cargo.lock +++ /dev/null @@ -1,217 +0,0 @@ -[root] -name = "rustc_tests" -version = "0.1.0" -dependencies = [ - "miri 0.1.0", -] - -[[package]] -name = "aho-corasick" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "byteorder" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "dbghelp-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "env_logger" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gcc" -version = "0.3.53" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.30" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log_settings" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miri" -version = "0.1.0" -dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_miri 0.1.0", -] - -[[package]] -name = "regex" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-demangle" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_miri" -version = "0.1.0" -dependencies = [ - "backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "utf8-ranges" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" -"checksum backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983" -"checksum backtrace-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "afccc5772ba333abccdf60d55200fa3406f8c59dcf54d5f7998c9107d3799c7c" -"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" -"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" -"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" -"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" -"checksum gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)" = "e8310f7e9c890398b0e80e301c4f474e9918d2b27fca8f48486ca775fa9ffc5a" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" -"checksum libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915" -"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" -"checksum log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3d382732ea0fbc09790c4899db3255bdea0fc78b54bf234bd18a63bb603915b6" -"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" -"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" -"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" -"checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" -"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/src/tools/miri/rustc_tests/Cargo.toml b/src/tools/miri/rustc_tests/Cargo.toml deleted file mode 100644 index 736f062976..0000000000 --- a/src/tools/miri/rustc_tests/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "rustc_tests" -version = "0.1.0" -authors = ["Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>"] - -[dependencies] -miri = { path = ".." } diff --git a/src/tools/miri/rustc_tests/src/main.rs b/src/tools/miri/rustc_tests/src/main.rs deleted file mode 100644 index 819721c1cd..0000000000 --- a/src/tools/miri/rustc_tests/src/main.rs +++ /dev/null @@ -1,292 +0,0 @@ -#![feature(rustc_private, i128_type)] -extern crate miri; -extern crate getopts; -extern crate rustc; -extern crate rustc_driver; -extern crate rustc_errors; -extern crate syntax; - -use std::path::{PathBuf, Path}; -use std::io::Write; -use std::sync::{Mutex, Arc}; -use std::io; - - -use rustc::session::Session; -use rustc::middle::cstore::CrateStore; -use rustc_driver::{Compilation, CompilerCalls, RustcDefaultCalls}; -use rustc_driver::driver::{CompileState, CompileController}; -use rustc::session::config::{self, Input, ErrorOutputType}; -use rustc::hir::{self, itemlikevisit}; -use rustc::ty::TyCtxt; -use syntax::ast; - -struct MiriCompilerCalls { - default: RustcDefaultCalls, - /// whether we are building for the host - host_target: bool, -} - -impl<'a> CompilerCalls<'a> for MiriCompilerCalls { - fn early_callback( - &mut self, - matches: &getopts::Matches, - sopts: &config::Options, - cfg: &ast::CrateConfig, - descriptions: &rustc_errors::registry::Registry, - output: ErrorOutputType - ) -> Compilation { - self.default.early_callback(matches, sopts, cfg, descriptions, output) - } - fn no_input( - &mut self, - matches: &getopts::Matches, - sopts: &config::Options, - cfg: &ast::CrateConfig, - odir: &Option<PathBuf>, - ofile: &Option<PathBuf>, - descriptions: &rustc_errors::registry::Registry - ) -> Option<(Input, Option<PathBuf>)> { - self.default.no_input(matches, sopts, cfg, odir, ofile, descriptions) - } - fn late_callback( - &mut self, - matches: &getopts::Matches, - sess: &Session, - cstore: &CrateStore, - input: &Input, - odir: &Option<PathBuf>, - ofile: &Option<PathBuf> - ) -> Compilation { - self.default.late_callback(matches, sess, cstore, input, odir, ofile) - } - fn build_controller(&mut self, sess: &Session, matches: &getopts::Matches) -> CompileController<'a> { - let mut control = self.default.build_controller(sess, matches); - control.after_hir_lowering.callback = Box::new(after_hir_lowering); - control.after_analysis.callback = Box::new(after_analysis); - if !self.host_target { - // only fully compile targets on the host - control.after_analysis.stop = Compilation::Stop; - } - control - } -} - -fn after_hir_lowering(state: &mut CompileState) { - let attr = (String::from("miri"), syntax::feature_gate::AttributeType::Whitelisted); - state.session.plugin_attributes.borrow_mut().push(attr); -} - -fn after_analysis<'a, 'tcx>(state: &mut CompileState<'a, 'tcx>) { - state.session.abort_if_errors(); - - let tcx = state.tcx.unwrap(); - let limits = Default::default(); - - if std::env::args().any(|arg| arg == "--test") { - struct Visitor<'a, 'tcx: 'a>(miri::ResourceLimits, TyCtxt<'a, 'tcx, 'tcx>, &'a CompileState<'a, 'tcx>); - impl<'a, 'tcx: 'a, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'a, 'tcx> { - fn visit_item(&mut self, i: &'hir hir::Item) { - if let hir::Item_::ItemFn(_, _, _, _, _, body_id) = i.node { - if i.attrs.iter().any(|attr| attr.name().map_or(false, |n| n == "test")) { - let did = self.1.hir.body_owner_def_id(body_id); - println!("running test: {}", self.1.hir.def_path(did).to_string(self.1)); - miri::eval_main(self.1, did, None, self.0); - self.2.session.abort_if_errors(); - } - } - } - fn visit_trait_item(&mut self, _trait_item: &'hir hir::TraitItem) {} - fn visit_impl_item(&mut self, _impl_item: &'hir hir::ImplItem) {} - } - state.hir_crate.unwrap().visit_all_item_likes(&mut Visitor(limits, tcx, state)); - } else if let Some((entry_node_id, _)) = *state.session.entry_fn.borrow() { - let entry_def_id = tcx.hir.local_def_id(entry_node_id); - let start_wrapper = tcx.lang_items().start_fn().and_then(|start_fn| - if tcx.is_mir_available(start_fn) { Some(start_fn) } else { None }); - miri::eval_main(tcx, entry_def_id, start_wrapper, limits); - - state.session.abort_if_errors(); - } else { - println!("no main function found, assuming auxiliary build"); - } -} - -fn main() { - let path = option_env!("MIRI_RUSTC_TEST") - .map(String::from) - .unwrap_or_else(|| { - std::env::var("MIRI_RUSTC_TEST") - .expect("need to set MIRI_RUSTC_TEST to path of rustc tests") - }); - - let mut mir_not_found = Vec::new(); - let mut crate_not_found = Vec::new(); - let mut success = 0; - let mut failed = Vec::new(); - let mut c_abi_fns = Vec::new(); - let mut abi = Vec::new(); - let mut unsupported = Vec::new(); - let mut unimplemented_intrinsic = Vec::new(); - let mut limits = Vec::new(); - let mut files: Vec<_> = std::fs::read_dir(path).unwrap().collect(); - while let Some(file) = files.pop() { - let file = file.unwrap(); - let path = file.path(); - if file.metadata().unwrap().is_dir() { - if !path.to_str().unwrap().ends_with("auxiliary") { - // add subdirs recursively - files.extend(std::fs::read_dir(path).unwrap()); - } - continue; - } - if !file.metadata().unwrap().is_file() || !path.to_str().unwrap().ends_with(".rs") { - continue; - } - let stderr = std::io::stderr(); - write!(stderr.lock(), "test [miri-pass] {} ... ", path.display()).unwrap(); - let mut host_target = false; - let mut args: Vec<String> = std::env::args().filter(|arg| { - if arg == "--miri_host_target" { - host_target = true; - false // remove the flag, rustc doesn't know it - } else { - true - } - }).collect(); - // file to process - args.push(path.display().to_string()); - - let sysroot_flag = String::from("--sysroot"); - if !args.contains(&sysroot_flag) { - args.push(sysroot_flag); - args.push(Path::new(&std::env::var("HOME").unwrap()).join(".xargo").join("HOST").display().to_string()); - } - - args.push("-Zmir-opt-level=3".to_owned()); - // for auxilary builds in unit tests - args.push("-Zalways-encode-mir".to_owned()); - - // A threadsafe buffer for writing. - #[derive(Default, Clone)] - struct BufWriter(Arc<Mutex<Vec<u8>>>); - - impl Write for BufWriter { - fn write(&mut self, buf: &[u8]) -> io::Result<usize> { - self.0.lock().unwrap().write(buf) - } - fn flush(&mut self) -> io::Result<()> { - self.0.lock().unwrap().flush() - } - } - let buf = BufWriter::default(); - let output = buf.clone(); - let result = std::panic::catch_unwind(|| { - rustc_driver::run_compiler(&args, &mut MiriCompilerCalls { - default: RustcDefaultCalls, - host_target, - }, None, Some(Box::new(buf))); - }); - - match result { - Ok(()) => { - success += 1; - writeln!(stderr.lock(), "ok").unwrap() - }, - Err(_) => { - let output = output.0.lock().unwrap(); - let output_err = std::str::from_utf8(&output).unwrap(); - if let Some(text) = output_err.splitn(2, "no mir for `").nth(1) { - let end = text.find('`').unwrap(); - mir_not_found.push(text[..end].to_string()); - writeln!(stderr.lock(), "NO MIR FOR `{}`", &text[..end]).unwrap(); - } else if let Some(text) = output_err.splitn(2, "can't find crate for `").nth(1) { - let end = text.find('`').unwrap(); - crate_not_found.push(text[..end].to_string()); - writeln!(stderr.lock(), "CAN'T FIND CRATE FOR `{}`", &text[..end]).unwrap(); - } else { - for text in output_err.split("error: ").skip(1) { - let end = text.find('\n').unwrap_or(text.len()); - let c_abi = "can't call C ABI function: "; - let unimplemented_intrinsic_s = "unimplemented intrinsic: "; - let unsupported_s = "miri does not support "; - let abi_s = "can't handle function with "; - let limit_s = "reached the configured maximum "; - if text.starts_with(c_abi) { - c_abi_fns.push(text[c_abi.len()..end].to_string()); - } else if text.starts_with(unimplemented_intrinsic_s) { - unimplemented_intrinsic.push(text[unimplemented_intrinsic_s.len()..end].to_string()); - } else if text.starts_with(unsupported_s) { - unsupported.push(text[unsupported_s.len()..end].to_string()); - } else if text.starts_with(abi_s) { - abi.push(text[abi_s.len()..end].to_string()); - } else if text.starts_with(limit_s) { - limits.push(text[limit_s.len()..end].to_string()); - } else if text.find("aborting").is_none() { - failed.push(text[..end].to_string()); - } - } - writeln!(stderr.lock(), "stderr: \n {}", output_err).unwrap(); - } - } - } - } - let stderr = std::io::stderr(); - let mut stderr = stderr.lock(); - writeln!(stderr, "{} success, {} no mir, {} crate not found, {} failed, \ - {} C fn, {} ABI, {} unsupported, {} intrinsic", - success, mir_not_found.len(), crate_not_found.len(), failed.len(), - c_abi_fns.len(), abi.len(), unsupported.len(), unimplemented_intrinsic.len()).unwrap(); - writeln!(stderr, "# The \"other reasons\" errors").unwrap(); - writeln!(stderr, "(sorted, deduplicated)").unwrap(); - print_vec(&mut stderr, failed); - - writeln!(stderr, "# can't call C ABI function").unwrap(); - print_vec(&mut stderr, c_abi_fns); - - writeln!(stderr, "# unsupported ABI").unwrap(); - print_vec(&mut stderr, abi); - - writeln!(stderr, "# unsupported").unwrap(); - print_vec(&mut stderr, unsupported); - - writeln!(stderr, "# unimplemented intrinsics").unwrap(); - print_vec(&mut stderr, unimplemented_intrinsic); - - writeln!(stderr, "# mir not found").unwrap(); - print_vec(&mut stderr, mir_not_found); - - writeln!(stderr, "# crate not found").unwrap(); - print_vec(&mut stderr, crate_not_found); -} - -fn print_vec<W: std::io::Write>(stderr: &mut W, v: Vec<String>) { - writeln!(stderr, "```").unwrap(); - for (n, s) in vec_to_hist(v).into_iter().rev() { - writeln!(stderr, "{:4} {}", n, s).unwrap(); - } - writeln!(stderr, "```").unwrap(); -} - -fn vec_to_hist<T: PartialEq + Ord>(mut v: Vec<T>) -> Vec<(usize, T)> { - v.sort(); - let mut v = v.into_iter(); - let mut result = Vec::new(); - let mut current = v.next(); - 'outer: while let Some(current_val) = current { - let mut n = 1; - for next in &mut v { - if next == current_val { - n += 1; - } else { - result.push((n, current_val)); - current = Some(next); - continue 'outer; - } - } - result.push((n, current_val)); - break; - } - result.sort(); - result -} diff --git a/src/tools/miri/src/librustc_mir/Cargo.toml b/src/tools/miri/src/librustc_mir/Cargo.toml deleted file mode 100644 index c72de828c8..0000000000 --- a/src/tools/miri/src/librustc_mir/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -authors = ["Scott Olson <scott@solson.me>"] -description = "An experimental interpreter for Rust MIR." -license = "MIT/Apache-2.0" -name = "rustc_miri" -repository = "https://github.com/solson/miri" -version = "0.1.0" -workspace = "../.." - -[lib] -path = "lib.rs" - -[dependencies] -byteorder = { version = "1.1", features = ["i128"]} -log = "0.3.6" -log_settings = "0.1.1" -lazy_static = "0.2.8" -regex = "0.2.2" -backtrace = "0.3.3" diff --git a/src/tools/miri/src/librustc_mir/interpret/const_eval.rs b/src/tools/miri/src/librustc_mir/interpret/const_eval.rs deleted file mode 100644 index 7fa28dccba..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/const_eval.rs +++ /dev/null @@ -1,258 +0,0 @@ -use rustc::traits::Reveal; -use rustc::ty::{self, TyCtxt, Ty, Instance, layout}; -use rustc::mir; - -use syntax::ast::Mutability; -use syntax::codemap::Span; - -use super::{EvalResult, EvalError, EvalErrorKind, GlobalId, Lvalue, Value, PrimVal, EvalContext, - StackPopCleanup, PtrAndAlign, MemoryKind, ValTy}; - -use rustc_const_math::ConstInt; - -use std::fmt; -use std::error::Error; - -pub fn eval_body_as_primval<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - instance: Instance<'tcx>, -) -> EvalResult<'tcx, (PrimVal, Ty<'tcx>)> { - let limits = super::ResourceLimits::default(); - let mut ecx = EvalContext::<CompileTimeFunctionEvaluator>::new(tcx, limits, (), ()); - let cid = GlobalId { - instance, - promoted: None, - }; - if ecx.tcx.has_attr(instance.def_id(), "linkage") { - return Err(ConstEvalError::NotConst("extern global".to_string()).into()); - } - - let mir = ecx.load_mir(instance.def)?; - if !ecx.globals.contains_key(&cid) { - let size = ecx.type_size_with_substs(mir.return_ty, instance.substs)? - .expect("unsized global"); - let align = ecx.type_align_with_substs(mir.return_ty, instance.substs)?; - let ptr = ecx.memory.allocate( - size, - align, - MemoryKind::UninitializedStatic, - )?; - let aligned = !ecx.is_packed(mir.return_ty)?; - ecx.globals.insert( - cid, - PtrAndAlign { - ptr: ptr.into(), - aligned, - }, - ); - let mutable = !mir.return_ty.is_freeze( - ecx.tcx, - ty::ParamEnv::empty(Reveal::All), - mir.span, - ); - let mutability = if mutable { - Mutability::Mutable - } else { - Mutability::Immutable - }; - let cleanup = StackPopCleanup::MarkStatic(mutability); - let name = ty::tls::with(|tcx| tcx.item_path_str(instance.def_id())); - trace!("const_eval: pushing stack frame for global: {}", name); - ecx.push_stack_frame( - instance, - mir.span, - mir, - Lvalue::from_ptr(ptr), - cleanup, - )?; - - while ecx.step()? {} - } - let value = Value::ByRef(*ecx.globals.get(&cid).expect("global not cached")); - let valty = ValTy { - value, - ty: mir.return_ty, - }; - Ok((ecx.value_to_primval(valty)?, mir.return_ty)) -} - -pub fn eval_body_as_integer<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - instance: Instance<'tcx>, -) -> EvalResult<'tcx, ConstInt> { - let (prim, ty) = eval_body_as_primval(tcx, instance)?; - let prim = prim.to_bytes()?; - use syntax::ast::{IntTy, UintTy}; - use rustc::ty::TypeVariants::*; - use rustc_const_math::{ConstIsize, ConstUsize}; - Ok(match ty.sty { - TyInt(IntTy::I8) => ConstInt::I8(prim as i128 as i8), - TyInt(IntTy::I16) => ConstInt::I16(prim as i128 as i16), - TyInt(IntTy::I32) => ConstInt::I32(prim as i128 as i32), - TyInt(IntTy::I64) => ConstInt::I64(prim as i128 as i64), - TyInt(IntTy::I128) => ConstInt::I128(prim as i128), - TyInt(IntTy::Is) => ConstInt::Isize( - ConstIsize::new(prim as i128 as i64, tcx.sess.target.isize_ty) - .expect("miri should already have errored"), - ), - TyUint(UintTy::U8) => ConstInt::U8(prim as u8), - TyUint(UintTy::U16) => ConstInt::U16(prim as u16), - TyUint(UintTy::U32) => ConstInt::U32(prim as u32), - TyUint(UintTy::U64) => ConstInt::U64(prim as u64), - TyUint(UintTy::U128) => ConstInt::U128(prim), - TyUint(UintTy::Us) => ConstInt::Usize( - ConstUsize::new(prim as u64, tcx.sess.target.usize_ty) - .expect("miri should already have errored"), - ), - _ => { - return Err( - ConstEvalError::NeedsRfc( - "evaluating anything other than isize/usize during typeck".to_string(), - ).into(), - ) - } - }) -} - -struct CompileTimeFunctionEvaluator; - -impl<'tcx> Into<EvalError<'tcx>> for ConstEvalError { - fn into(self) -> EvalError<'tcx> { - EvalErrorKind::MachineError(Box::new(self)).into() - } -} - -#[derive(Clone, Debug)] -enum ConstEvalError { - NeedsRfc(String), - NotConst(String), -} - -impl fmt::Display for ConstEvalError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use self::ConstEvalError::*; - match *self { - NeedsRfc(ref msg) => { - write!( - f, - "\"{}\" needs an rfc before being allowed inside constants", - msg - ) - } - NotConst(ref msg) => write!(f, "Cannot evaluate within constants: \"{}\"", msg), - } - } -} - -impl Error for ConstEvalError { - fn description(&self) -> &str { - use self::ConstEvalError::*; - match *self { - NeedsRfc(_) => "this feature needs an rfc before being allowed inside constants", - NotConst(_) => "this feature is not compatible with constant evaluation", - } - } - - fn cause(&self) -> Option<&Error> { - None - } -} - -impl<'tcx> super::Machine<'tcx> for CompileTimeFunctionEvaluator { - type Data = (); - type MemoryData = (); - type MemoryKinds = !; - fn eval_fn_call<'a>( - ecx: &mut EvalContext<'a, 'tcx, Self>, - instance: ty::Instance<'tcx>, - destination: Option<(Lvalue, mir::BasicBlock)>, - _args: &[ValTy<'tcx>], - span: Span, - _sig: ty::FnSig<'tcx>, - ) -> EvalResult<'tcx, bool> { - if !ecx.tcx.is_const_fn(instance.def_id()) { - return Err( - ConstEvalError::NotConst(format!("calling non-const fn `{}`", instance)).into(), - ); - } - let mir = match ecx.load_mir(instance.def) { - Ok(mir) => mir, - Err(EvalError { kind: EvalErrorKind::NoMirFor(path), .. }) => { - // some simple things like `malloc` might get accepted in the future - return Err( - ConstEvalError::NeedsRfc(format!("calling extern function `{}`", path)) - .into(), - ); - } - Err(other) => return Err(other), - }; - let (return_lvalue, return_to_block) = match destination { - Some((lvalue, block)) => (lvalue, StackPopCleanup::Goto(block)), - None => (Lvalue::undef(), StackPopCleanup::None), - }; - - ecx.push_stack_frame( - instance, - span, - mir, - return_lvalue, - return_to_block, - )?; - - Ok(false) - } - - fn call_intrinsic<'a>( - _ecx: &mut EvalContext<'a, 'tcx, Self>, - _instance: ty::Instance<'tcx>, - _args: &[ValTy<'tcx>], - _dest: Lvalue, - _dest_ty: Ty<'tcx>, - _dest_layout: &'tcx layout::Layout, - _target: mir::BasicBlock, - ) -> EvalResult<'tcx> { - Err( - ConstEvalError::NeedsRfc("calling intrinsics".to_string()).into(), - ) - } - - fn try_ptr_op<'a>( - _ecx: &EvalContext<'a, 'tcx, Self>, - _bin_op: mir::BinOp, - left: PrimVal, - _left_ty: Ty<'tcx>, - right: PrimVal, - _right_ty: Ty<'tcx>, - ) -> EvalResult<'tcx, Option<(PrimVal, bool)>> { - if left.is_bytes() && right.is_bytes() { - Ok(None) - } else { - Err( - ConstEvalError::NeedsRfc("Pointer arithmetic or comparison".to_string()).into(), - ) - } - } - - fn mark_static_initialized(m: !) -> EvalResult<'tcx> { - m - } - - fn box_alloc<'a>( - _ecx: &mut EvalContext<'a, 'tcx, Self>, - _ty: ty::Ty<'tcx>, - ) -> EvalResult<'tcx, PrimVal> { - Err( - ConstEvalError::NeedsRfc("Heap allocations via `box` keyword".to_string()).into(), - ) - } - - fn global_item_with_linkage<'a>( - _ecx: &mut EvalContext<'a, 'tcx, Self>, - _instance: ty::Instance<'tcx>, - _mutability: Mutability, - ) -> EvalResult<'tcx> { - Err( - ConstEvalError::NotConst("statics with `linkage` attribute".to_string()).into(), - ) - } -} diff --git a/src/tools/miri/src/librustc_mir/interpret/eval_context.rs b/src/tools/miri/src/librustc_mir/interpret/eval_context.rs deleted file mode 100644 index 8fb63b3cb2..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/eval_context.rs +++ /dev/null @@ -1,2539 +0,0 @@ -use std::collections::{HashMap, HashSet}; -use std::fmt::Write; - -use rustc::hir::def_id::DefId; -use rustc::hir::map::definitions::DefPathData; -use rustc::middle::const_val::ConstVal; -use rustc::middle::region; -use rustc::mir; -use rustc::traits::Reveal; -use rustc::ty::layout::{self, Layout, Size, Align, HasDataLayout}; -use rustc::ty::subst::{Subst, Substs, Kind}; -use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; -use rustc_data_structures::indexed_vec::Idx; -use syntax::codemap::{self, DUMMY_SP}; -use syntax::ast::Mutability; -use syntax::abi::Abi; - -use super::{EvalError, EvalResult, EvalErrorKind, GlobalId, Lvalue, LvalueExtra, Memory, - MemoryPointer, HasMemory, MemoryKind, operator, PrimVal, PrimValKind, Value, Pointer, - ValidationQuery, Machine}; - -pub struct EvalContext<'a, 'tcx: 'a, M: Machine<'tcx>> { - /// Stores data required by the `Machine` - pub machine_data: M::Data, - - /// The results of the type checker, from rustc. - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, - - /// The virtual memory system. - pub memory: Memory<'a, 'tcx, M>, - - /// Lvalues that were suspended by the validation subsystem, and will be recovered later - pub(crate) suspended: HashMap<DynamicLifetime, Vec<ValidationQuery<'tcx>>>, - - /// Precomputed statics, constants and promoteds. - pub globals: HashMap<GlobalId<'tcx>, PtrAndAlign>, - - /// The virtual call stack. - pub(crate) stack: Vec<Frame<'tcx>>, - - /// The maximum number of stack frames allowed - pub(crate) stack_limit: usize, - - /// The maximum number of operations that may be executed. - /// This prevents infinite loops and huge computations from freezing up const eval. - /// Remove once halting problem is solved. - pub(crate) steps_remaining: u64, -} - -/// A stack frame. -pub struct Frame<'tcx> { - //////////////////////////////////////////////////////////////////////////////// - // Function and callsite information - //////////////////////////////////////////////////////////////////////////////// - /// The MIR for the function called on this frame. - pub mir: &'tcx mir::Mir<'tcx>, - - /// The def_id and substs of the current function - pub instance: ty::Instance<'tcx>, - - /// The span of the call site. - pub span: codemap::Span, - - //////////////////////////////////////////////////////////////////////////////// - // Return lvalue and locals - //////////////////////////////////////////////////////////////////////////////// - /// The block to return to when returning from the current stack frame - pub return_to_block: StackPopCleanup, - - /// The location where the result of the current stack frame should be written to. - pub return_lvalue: Lvalue, - - /// The list of locals for this stack frame, stored in order as - /// `[arguments..., variables..., temporaries...]`. The locals are stored as `Option<Value>`s. - /// `None` represents a local that is currently dead, while a live local - /// can either directly contain `PrimVal` or refer to some part of an `Allocation`. - /// - /// Before being initialized, arguments are `Value::ByVal(PrimVal::Undef)` and other locals are `None`. - pub locals: Vec<Option<Value>>, - - //////////////////////////////////////////////////////////////////////////////// - // Current position within the function - //////////////////////////////////////////////////////////////////////////////// - /// The block that is currently executed (or will be executed after the above call stacks - /// return). - pub block: mir::BasicBlock, - - /// The index of the currently evaluated statment. - pub stmt: usize, -} - -#[derive(Clone, Debug, Eq, PartialEq, Hash)] -pub enum StackPopCleanup { - /// The stackframe existed to compute the initial value of a static/constant, make sure it - /// isn't modifyable afterwards in case of constants. - /// In case of `static mut`, mark the memory to ensure it's never marked as immutable through - /// references or deallocated - MarkStatic(Mutability), - /// A regular stackframe added due to a function call will need to get forwarded to the next - /// block - Goto(mir::BasicBlock), - /// The main function and diverging functions have nowhere to return to - None, -} - -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] -pub struct DynamicLifetime { - pub frame: usize, - pub region: Option<region::Scope>, // "None" indicates "until the function ends" -} - -#[derive(Copy, Clone, Debug)] -pub struct ResourceLimits { - pub memory_size: u64, - pub step_limit: u64, - pub stack_limit: usize, -} - -impl Default for ResourceLimits { - fn default() -> Self { - ResourceLimits { - memory_size: 100 * 1024 * 1024, // 100 MB - step_limit: 1_000_000, - stack_limit: 100, - } - } -} - -#[derive(Copy, Clone, Debug)] -pub struct TyAndPacked<'tcx> { - pub ty: Ty<'tcx>, - pub packed: bool, -} - -#[derive(Copy, Clone, Debug)] -pub struct ValTy<'tcx> { - pub value: Value, - pub ty: Ty<'tcx>, -} - -impl<'tcx> ::std::ops::Deref for ValTy<'tcx> { - type Target = Value; - fn deref(&self) -> &Value { - &self.value - } -} - -#[derive(Copy, Clone, Debug)] -pub struct PtrAndAlign { - pub ptr: Pointer, - /// Remember whether this lvalue is *supposed* to be aligned. - pub aligned: bool, -} - -impl PtrAndAlign { - pub fn to_ptr<'tcx>(self) -> EvalResult<'tcx, MemoryPointer> { - self.ptr.to_ptr() - } - pub fn offset<'tcx, C: HasDataLayout>(self, i: u64, cx: C) -> EvalResult<'tcx, Self> { - Ok(PtrAndAlign { - ptr: self.ptr.offset(i, cx)?, - aligned: self.aligned, - }) - } -} - -impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> { - pub fn new( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - limits: ResourceLimits, - machine_data: M::Data, - memory_data: M::MemoryData, - ) -> Self { - EvalContext { - machine_data, - tcx, - memory: Memory::new(&tcx.data_layout, limits.memory_size, memory_data), - suspended: HashMap::new(), - globals: HashMap::new(), - stack: Vec::new(), - stack_limit: limits.stack_limit, - steps_remaining: limits.step_limit, - } - } - - pub fn alloc_ptr(&mut self, ty: Ty<'tcx>) -> EvalResult<'tcx, MemoryPointer> { - let substs = self.substs(); - self.alloc_ptr_with_substs(ty, substs) - } - - pub fn alloc_ptr_with_substs( - &mut self, - ty: Ty<'tcx>, - substs: &'tcx Substs<'tcx>, - ) -> EvalResult<'tcx, MemoryPointer> { - let size = self.type_size_with_substs(ty, substs)?.expect( - "cannot alloc memory for unsized type", - ); - let align = self.type_align_with_substs(ty, substs)?; - self.memory.allocate(size, align, MemoryKind::Stack) - } - - pub fn memory(&self) -> &Memory<'a, 'tcx, M> { - &self.memory - } - - pub fn memory_mut(&mut self) -> &mut Memory<'a, 'tcx, M> { - &mut self.memory - } - - pub fn stack(&self) -> &[Frame<'tcx>] { - &self.stack - } - - #[inline] - pub fn cur_frame(&self) -> usize { - assert!(self.stack.len() > 0); - self.stack.len() - 1 - } - - pub fn str_to_value(&mut self, s: &str) -> EvalResult<'tcx, Value> { - let ptr = self.memory.allocate_cached(s.as_bytes())?; - Ok(Value::ByValPair( - PrimVal::Ptr(ptr), - PrimVal::from_u128(s.len() as u128), - )) - } - - pub(super) fn const_to_value(&mut self, const_val: &ConstVal<'tcx>) -> EvalResult<'tcx, Value> { - use rustc::middle::const_val::ConstVal::*; - - let primval = match *const_val { - Integral(const_int) => PrimVal::Bytes(const_int.to_u128_unchecked()), - - Float(val) => PrimVal::Bytes(val.bits), - - Bool(b) => PrimVal::from_bool(b), - Char(c) => PrimVal::from_char(c), - - Str(ref s) => return self.str_to_value(s), - - ByteStr(ref bs) => { - let ptr = self.memory.allocate_cached(bs.data)?; - PrimVal::Ptr(ptr) - } - - Unevaluated(def_id, substs) => { - let instance = self.resolve_associated_const(def_id, substs); - let cid = GlobalId { - instance, - promoted: None, - }; - return Ok(Value::ByRef(*self.globals.get(&cid).expect("static/const not cached"))); - } - - Aggregate(..) | - Variant(_) => bug!("should not have aggregate or variant constants in MIR"), - // function items are zero sized and thus have no readable value - Function(..) => PrimVal::Undef, - }; - - Ok(Value::ByVal(primval)) - } - - pub(super) fn type_is_sized(&self, ty: Ty<'tcx>) -> bool { - // generics are weird, don't run this function on a generic - assert!(!ty.needs_subst()); - ty.is_sized(self.tcx, ty::ParamEnv::empty(Reveal::All), DUMMY_SP) - } - - pub fn load_mir( - &self, - instance: ty::InstanceDef<'tcx>, - ) -> EvalResult<'tcx, &'tcx mir::Mir<'tcx>> { - trace!("load mir {:?}", instance); - match instance { - ty::InstanceDef::Item(def_id) => { - self.tcx.maybe_optimized_mir(def_id).ok_or_else(|| { - EvalErrorKind::NoMirFor(self.tcx.item_path_str(def_id)).into() - }) - } - _ => Ok(self.tcx.instance_mir(instance)), - } - } - - pub fn monomorphize(&self, ty: Ty<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { - // miri doesn't care about lifetimes, and will choke on some crazy ones - // let's simply get rid of them - let without_lifetimes = self.tcx.erase_regions(&ty); - let substituted = without_lifetimes.subst(self.tcx, substs); - let substituted = self.tcx.normalize_associated_type(&substituted); - substituted - } - - /// Return the size and aligment of the value at the given type. - /// Note that the value does not matter if the type is sized. For unsized types, - /// the value has to be a fat pointer, and we only care about the "extra" data in it. - pub fn size_and_align_of_dst( - &mut self, - ty: ty::Ty<'tcx>, - value: Value, - ) -> EvalResult<'tcx, (u64, u64)> { - if let Some(size) = self.type_size(ty)? { - Ok((size as u64, self.type_align(ty)? as u64)) - } else { - match ty.sty { - ty::TyAdt(..) | ty::TyTuple(..) => { - // First get the size of all statically known fields. - // Don't use type_of::sizing_type_of because that expects t to be sized, - // and it also rounds up to alignment, which we want to avoid, - // as the unsized field's alignment could be smaller. - assert!(!ty.is_simd()); - let layout = self.type_layout(ty)?; - debug!("DST {} layout: {:?}", ty, layout); - - let (sized_size, sized_align) = match *layout { - ty::layout::Layout::Univariant { ref variant, .. } => { - ( - variant.offsets.last().map_or(0, |o| o.bytes()), - variant.align, - ) - } - _ => { - bug!( - "size_and_align_of_dst: expcted Univariant for `{}`, found {:#?}", - ty, - layout - ); - } - }; - debug!( - "DST {} statically sized prefix size: {} align: {:?}", - ty, - sized_size, - sized_align - ); - - // Recurse to get the size of the dynamically sized field (must be - // the last field). - let (unsized_size, unsized_align) = match ty.sty { - ty::TyAdt(def, substs) => { - let last_field = def.struct_variant().fields.last().unwrap(); - let field_ty = self.field_ty(substs, last_field); - self.size_and_align_of_dst(field_ty, value)? - } - ty::TyTuple(ref types, _) => { - let field_ty = types.last().unwrap(); - let field_ty = self.tcx.normalize_associated_type(field_ty); - self.size_and_align_of_dst(field_ty, value)? - } - _ => bug!("We already checked that we know this type"), - }; - - // FIXME (#26403, #27023): We should be adding padding - // to `sized_size` (to accommodate the `unsized_align` - // required of the unsized field that follows) before - // summing it with `sized_size`. (Note that since #26403 - // is unfixed, we do not yet add the necessary padding - // here. But this is where the add would go.) - - // Return the sum of sizes and max of aligns. - let size = sized_size + unsized_size; - - // Choose max of two known alignments (combined value must - // be aligned according to more restrictive of the two). - let align = - sized_align.max(Align::from_bytes(unsized_align, unsized_align).unwrap()); - - // Issue #27023: must add any necessary padding to `size` - // (to make it a multiple of `align`) before returning it. - // - // Namely, the returned size should be, in C notation: - // - // `size + ((size & (align-1)) ? align : 0)` - // - // emulated via the semi-standard fast bit trick: - // - // `(size + (align-1)) & -align` - - let size = Size::from_bytes(size).abi_align(align).bytes(); - Ok((size, align.abi())) - } - ty::TyDynamic(..) => { - let (_, vtable) = value.into_ptr_vtable_pair(&mut self.memory)?; - // the second entry in the vtable is the dynamic size of the object. - self.read_size_and_align_from_vtable(vtable) - } - - ty::TySlice(_) | ty::TyStr => { - let elem_ty = ty.sequence_element_type(self.tcx); - let elem_size = self.type_size(elem_ty)?.expect( - "slice element must be sized", - ) as u64; - let (_, len) = value.into_slice(&mut self.memory)?; - let align = self.type_align(elem_ty)?; - Ok((len * elem_size, align as u64)) - } - - _ => bug!("size_of_val::<{:?}>", ty), - } - } - } - - /// Returns the normalized type of a struct field - fn field_ty(&self, param_substs: &Substs<'tcx>, f: &ty::FieldDef) -> ty::Ty<'tcx> { - self.tcx.normalize_associated_type( - &f.ty(self.tcx, param_substs), - ) - } - - pub fn type_size(&self, ty: Ty<'tcx>) -> EvalResult<'tcx, Option<u64>> { - self.type_size_with_substs(ty, self.substs()) - } - - pub fn type_align(&self, ty: Ty<'tcx>) -> EvalResult<'tcx, u64> { - self.type_align_with_substs(ty, self.substs()) - } - - pub fn type_size_with_substs( - &self, - ty: Ty<'tcx>, - substs: &'tcx Substs<'tcx>, - ) -> EvalResult<'tcx, Option<u64>> { - let layout = self.type_layout_with_substs(ty, substs)?; - if layout.is_unsized() { - Ok(None) - } else { - Ok(Some(layout.size(&self.tcx.data_layout).bytes())) - } - } - - pub fn type_align_with_substs( - &self, - ty: Ty<'tcx>, - substs: &'tcx Substs<'tcx>, - ) -> EvalResult<'tcx, u64> { - self.type_layout_with_substs(ty, substs).map(|layout| { - layout.align(&self.tcx.data_layout).abi() - }) - } - - pub fn type_layout(&self, ty: Ty<'tcx>) -> EvalResult<'tcx, &'tcx Layout> { - self.type_layout_with_substs(ty, self.substs()) - } - - fn type_layout_with_substs( - &self, - ty: Ty<'tcx>, - substs: &'tcx Substs<'tcx>, - ) -> EvalResult<'tcx, &'tcx Layout> { - // TODO(solson): Is this inefficient? Needs investigation. - let ty = self.monomorphize(ty, substs); - - ty.layout(self.tcx, ty::ParamEnv::empty(Reveal::All)) - .map_err(|layout| EvalErrorKind::Layout(layout).into()) - } - - pub fn push_stack_frame( - &mut self, - instance: ty::Instance<'tcx>, - span: codemap::Span, - mir: &'tcx mir::Mir<'tcx>, - return_lvalue: Lvalue, - return_to_block: StackPopCleanup, - ) -> EvalResult<'tcx> { - ::log_settings::settings().indentation += 1; - - /// Return the set of locals that have a storage annotation anywhere - fn collect_storage_annotations<'tcx>(mir: &'tcx mir::Mir<'tcx>) -> HashSet<mir::Local> { - use rustc::mir::StatementKind::*; - - let mut set = HashSet::new(); - for block in mir.basic_blocks() { - for stmt in block.statements.iter() { - match stmt.kind { - StorageLive(local) | - StorageDead(local) => { - set.insert(local); - } - _ => {} - } - } - } - set - } - - // Subtract 1 because `local_decls` includes the ReturnMemoryPointer, but we don't store a local - // `Value` for that. - let num_locals = mir.local_decls.len() - 1; - - let locals = { - let annotated_locals = collect_storage_annotations(mir); - let mut locals = vec![None; num_locals]; - for i in 0..num_locals { - let local = mir::Local::new(i + 1); - if !annotated_locals.contains(&local) { - locals[i] = Some(Value::ByVal(PrimVal::Undef)); - } - } - locals - }; - - self.stack.push(Frame { - mir, - block: mir::START_BLOCK, - return_to_block, - return_lvalue, - locals, - span, - instance, - stmt: 0, - }); - - self.memory.cur_frame = self.cur_frame(); - - if self.stack.len() > self.stack_limit { - err!(StackFrameLimitReached) - } else { - Ok(()) - } - } - - pub(super) fn pop_stack_frame(&mut self) -> EvalResult<'tcx> { - ::log_settings::settings().indentation -= 1; - self.end_region(None)?; - let frame = self.stack.pop().expect( - "tried to pop a stack frame, but there were none", - ); - if !self.stack.is_empty() { - // TODO: Is this the correct time to start considering these accesses as originating from the returned-to stack frame? - self.memory.cur_frame = self.cur_frame(); - } - match frame.return_to_block { - StackPopCleanup::MarkStatic(mutable) => { - if let Lvalue::Ptr { ptr, .. } = frame.return_lvalue { - // FIXME: to_ptr()? might be too extreme here, static zsts might reach this under certain conditions - self.memory.mark_static_initalized( - ptr.to_ptr()?.alloc_id, - mutable, - )? - } else { - bug!("StackPopCleanup::MarkStatic on: {:?}", frame.return_lvalue); - } - } - StackPopCleanup::Goto(target) => self.goto_block(target), - StackPopCleanup::None => {} - } - // deallocate all locals that are backed by an allocation - for local in frame.locals { - self.deallocate_local(local)?; - } - - Ok(()) - } - - pub fn deallocate_local(&mut self, local: Option<Value>) -> EvalResult<'tcx> { - if let Some(Value::ByRef(ptr)) = local { - trace!("deallocating local"); - let ptr = ptr.to_ptr()?; - self.memory.dump_alloc(ptr.alloc_id); - match self.memory.get(ptr.alloc_id)?.kind { - // for a constant like `const FOO: &i32 = &1;` the local containing - // the `1` is referred to by the global. We transitively marked everything - // the global refers to as static itself, so we don't free it here - MemoryKind::Static => {} - MemoryKind::Stack => self.memory.deallocate(ptr, None, MemoryKind::Stack)?, - other => bug!("local contained non-stack memory: {:?}", other), - } - }; - Ok(()) - } - - pub fn assign_discr_and_fields( - &mut self, - dest: Lvalue, - dest_ty: Ty<'tcx>, - discr_offset: u64, - operands: &[mir::Operand<'tcx>], - discr_val: u128, - variant_idx: usize, - discr_size: u64, - discr_signed: bool, - ) -> EvalResult<'tcx> { - // FIXME(solson) - let dest_ptr = self.force_allocation(dest)?.to_ptr()?; - - let discr_dest = dest_ptr.offset(discr_offset, &self)?; - self.memory.write_primval(discr_dest, PrimVal::Bytes(discr_val), discr_size, discr_signed)?; - - let dest = Lvalue::Ptr { - ptr: PtrAndAlign { - ptr: dest_ptr.into(), - aligned: true, - }, - extra: LvalueExtra::DowncastVariant(variant_idx), - }; - - self.assign_fields(dest, dest_ty, operands) - } - - pub fn assign_fields( - &mut self, - dest: Lvalue, - dest_ty: Ty<'tcx>, - operands: &[mir::Operand<'tcx>], - ) -> EvalResult<'tcx> { - if self.type_size(dest_ty)? == Some(0) { - // zst assigning is a nop - return Ok(()); - } - if self.ty_to_primval_kind(dest_ty).is_ok() { - assert_eq!(operands.len(), 1); - let value = self.eval_operand(&operands[0])?; - return self.write_value(value, dest); - } - for (field_index, operand) in operands.iter().enumerate() { - let value = self.eval_operand(operand)?; - let field_dest = self.lvalue_field(dest, mir::Field::new(field_index), dest_ty, value.ty)?; - self.write_value(value, field_dest)?; - } - Ok(()) - } - - /// Evaluate an assignment statement. - /// - /// There is no separate `eval_rvalue` function. Instead, the code for handling each rvalue - /// type writes its results directly into the memory specified by the lvalue. - pub(super) fn eval_rvalue_into_lvalue( - &mut self, - rvalue: &mir::Rvalue<'tcx>, - lvalue: &mir::Lvalue<'tcx>, - ) -> EvalResult<'tcx> { - let dest = self.eval_lvalue(lvalue)?; - let dest_ty = self.lvalue_ty(lvalue); - let dest_layout = self.type_layout(dest_ty)?; - - use rustc::mir::Rvalue::*; - match *rvalue { - Use(ref operand) => { - let value = self.eval_operand(operand)?.value; - let valty = ValTy { - value, - ty: dest_ty, - }; - self.write_value(valty, dest)?; - } - - BinaryOp(bin_op, ref left, ref right) => { - let left = self.eval_operand(left)?; - let right = self.eval_operand(right)?; - if self.intrinsic_overflowing( - bin_op, - left, - right, - dest, - dest_ty, - )? - { - // There was an overflow in an unchecked binop. Right now, we consider this an error and bail out. - // The rationale is that the reason rustc emits unchecked binops in release mode (vs. the checked binops - // it emits in debug mode) is performance, but it doesn't cost us any performance in miri. - // If, however, the compiler ever starts transforming unchecked intrinsics into unchecked binops, - // we have to go back to just ignoring the overflow here. - return err!(OverflowingMath); - } - } - - CheckedBinaryOp(bin_op, ref left, ref right) => { - let left = self.eval_operand(left)?; - let right = self.eval_operand(right)?; - self.intrinsic_with_overflow( - bin_op, - left, - right, - dest, - dest_ty, - )?; - } - - UnaryOp(un_op, ref operand) => { - let val = self.eval_operand_to_primval(operand)?; - let kind = self.ty_to_primval_kind(dest_ty)?; - self.write_primval( - dest, - operator::unary_op(un_op, val, kind)?, - dest_ty, - )?; - } - - // Skip everything for zsts - Aggregate(..) if self.type_size(dest_ty)? == Some(0) => {} - - Aggregate(ref kind, ref operands) => { - self.inc_step_counter_and_check_limit(operands.len() as u64)?; - use rustc::ty::layout::Layout::*; - match *dest_layout { - Univariant { ref variant, .. } => { - self.write_maybe_aligned_mut(!variant.packed, |ecx| { - ecx.assign_fields(dest, dest_ty, operands) - })?; - } - - Array { .. } => { - self.assign_fields(dest, dest_ty, operands)?; - } - - General { - discr, - ref variants, - .. - } => { - if let mir::AggregateKind::Adt(adt_def, variant, _, _) = **kind { - let discr_val = adt_def - .discriminants(self.tcx) - .nth(variant) - .expect("broken mir: Adt variant id invalid") - .to_u128_unchecked(); - let discr_size = discr.size().bytes(); - - self.assign_discr_and_fields( - dest, - dest_ty, - variants[variant].offsets[0].bytes(), - operands, - discr_val, - variant, - discr_size, - false, - )?; - } else { - bug!("tried to assign {:?} to Layout::General", kind); - } - } - - RawNullablePointer { nndiscr, .. } => { - if let mir::AggregateKind::Adt(_, variant, _, _) = **kind { - if nndiscr == variant as u64 { - assert_eq!(operands.len(), 1); - let operand = &operands[0]; - let value = self.eval_operand(operand)?; - self.write_value(value, dest)?; - } else { - if let Some(operand) = operands.get(0) { - assert_eq!(operands.len(), 1); - let operand_ty = self.operand_ty(operand); - assert_eq!(self.type_size(operand_ty)?, Some(0)); - } - self.write_null(dest, dest_ty)?; - } - } else { - bug!("tried to assign {:?} to Layout::RawNullablePointer", kind); - } - } - - StructWrappedNullablePointer { - nndiscr, - ref discrfield_source, - ref nonnull, - .. - } => { - if let mir::AggregateKind::Adt(_, variant, _, _) = **kind { - if nndiscr == variant as u64 { - self.write_maybe_aligned_mut(!nonnull.packed, |ecx| { - ecx.assign_fields(dest, dest_ty, operands) - })?; - } else { - for operand in operands { - let operand_ty = self.operand_ty(operand); - assert_eq!(self.type_size(operand_ty)?, Some(0)); - } - self.write_struct_wrapped_null_pointer( - dest_ty, - nndiscr, - discrfield_source, - dest, - )?; - } - } else { - bug!("tried to assign {:?} to Layout::RawNullablePointer", kind); - } - } - - CEnum { .. } => { - assert_eq!(operands.len(), 0); - if let mir::AggregateKind::Adt(adt_def, variant, _, _) = **kind { - let n = adt_def - .discriminants(self.tcx) - .nth(variant) - .expect("broken mir: Adt variant index invalid") - .to_u128_unchecked(); - self.write_primval(dest, PrimVal::Bytes(n), dest_ty)?; - } else { - bug!("tried to assign {:?} to Layout::CEnum", kind); - } - } - - Vector { count, .. } => { - debug_assert_eq!(count, operands.len() as u64); - self.assign_fields(dest, dest_ty, operands)?; - } - - UntaggedUnion { ref variants } => { - assert_eq!(operands.len(), 1); - let operand = &operands[0]; - let value = self.eval_operand(operand)?; - self.write_maybe_aligned_mut(!variants.packed, |ecx| { - ecx.write_value(value, dest) - })?; - } - - _ => { - return err!(Unimplemented(format!( - "can't handle destination layout {:?} when assigning {:?}", - dest_layout, - kind - ))); - } - } - } - - Repeat(ref operand, _) => { - let (elem_ty, length) = match dest_ty.sty { - ty::TyArray(elem_ty, n) => (elem_ty, n.val.to_const_int().unwrap().to_u64().unwrap()), - _ => { - bug!( - "tried to assign array-repeat to non-array type {:?}", - dest_ty - ) - } - }; - self.inc_step_counter_and_check_limit(length)?; - let elem_size = self.type_size(elem_ty)?.expect( - "repeat element type must be sized", - ); - let value = self.eval_operand(operand)?.value; - - // FIXME(solson) - let dest = Pointer::from(self.force_allocation(dest)?.to_ptr()?); - - for i in 0..length { - let elem_dest = dest.offset(i * elem_size, &self)?; - self.write_value_to_ptr(value, elem_dest, elem_ty)?; - } - } - - Len(ref lvalue) => { - // FIXME(CTFE): don't allow computing the length of arrays in const eval - let src = self.eval_lvalue(lvalue)?; - let ty = self.lvalue_ty(lvalue); - let (_, len) = src.elem_ty_and_len(ty); - self.write_primval( - dest, - PrimVal::from_u128(len as u128), - dest_ty, - )?; - } - - Ref(_, _, ref lvalue) => { - let src = self.eval_lvalue(lvalue)?; - // We ignore the alignment of the lvalue here -- special handling for packed structs ends - // at the `&` operator. - let (ptr, extra) = self.force_allocation(src)?.to_ptr_extra_aligned(); - - let val = match extra { - LvalueExtra::None => ptr.ptr.to_value(), - LvalueExtra::Length(len) => ptr.ptr.to_value_with_len(len), - LvalueExtra::Vtable(vtable) => ptr.ptr.to_value_with_vtable(vtable), - LvalueExtra::DowncastVariant(..) => { - bug!("attempted to take a reference to an enum downcast lvalue") - } - }; - let valty = ValTy { - value: val, - ty: dest_ty, - }; - self.write_value(valty, dest)?; - } - - NullaryOp(mir::NullOp::Box, ty) => { - let ptr = M::box_alloc(self, ty)?; - self.write_primval(dest, ptr, dest_ty)?; - } - - NullaryOp(mir::NullOp::SizeOf, ty) => { - let size = self.type_size(ty)?.expect( - "SizeOf nullary MIR operator called for unsized type", - ); - self.write_primval( - dest, - PrimVal::from_u128(size as u128), - dest_ty, - )?; - } - - Cast(kind, ref operand, cast_ty) => { - debug_assert_eq!(self.monomorphize(cast_ty, self.substs()), dest_ty); - use rustc::mir::CastKind::*; - match kind { - Unsize => { - let src = self.eval_operand(operand)?; - self.unsize_into(src.value, src.ty, dest, dest_ty)?; - } - - Misc => { - let src = self.eval_operand(operand)?; - if self.type_is_fat_ptr(src.ty) { - match (src.value, self.type_is_fat_ptr(dest_ty)) { - (Value::ByRef { .. }, _) | - (Value::ByValPair(..), true) => { - let valty = ValTy { - value: src.value, - ty: dest_ty, - }; - self.write_value(valty, dest)?; - } - (Value::ByValPair(data, _), false) => { - let valty = ValTy { - value: Value::ByVal(data), - ty: dest_ty, - }; - self.write_value(valty, dest)?; - } - (Value::ByVal(_), _) => bug!("expected fat ptr"), - } - } else { - let src_val = self.value_to_primval(src)?; - let dest_val = self.cast_primval(src_val, src.ty, dest_ty)?; - let valty = ValTy { - value: Value::ByVal(dest_val), - ty: dest_ty, - }; - self.write_value(valty, dest)?; - } - } - - ReifyFnPointer => { - match self.operand_ty(operand).sty { - ty::TyFnDef(def_id, substs) => { - let instance = resolve(self.tcx, def_id, substs); - let fn_ptr = self.memory.create_fn_alloc(instance); - let valty = ValTy { - value: Value::ByVal(PrimVal::Ptr(fn_ptr)), - ty: dest_ty, - }; - self.write_value(valty, dest)?; - } - ref other => bug!("reify fn pointer on {:?}", other), - } - } - - UnsafeFnPointer => { - match dest_ty.sty { - ty::TyFnPtr(_) => { - let mut src = self.eval_operand(operand)?; - src.ty = dest_ty; - self.write_value(src, dest)?; - } - ref other => bug!("fn to unsafe fn cast on {:?}", other), - } - } - - ClosureFnPointer => { - match self.operand_ty(operand).sty { - ty::TyClosure(def_id, substs) => { - let instance = resolve_closure( - self.tcx, - def_id, - substs, - ty::ClosureKind::FnOnce, - ); - let fn_ptr = self.memory.create_fn_alloc(instance); - let valty = ValTy { - value: Value::ByVal(PrimVal::Ptr(fn_ptr)), - ty: dest_ty, - }; - self.write_value(valty, dest)?; - } - ref other => bug!("closure fn pointer on {:?}", other), - } - } - } - } - - Discriminant(ref lvalue) => { - let lval = self.eval_lvalue(lvalue)?; - let ty = self.lvalue_ty(lvalue); - let ptr = self.force_allocation(lval)?.to_ptr()?; - let discr_val = self.read_discriminant_value(ptr, ty)?; - if let ty::TyAdt(adt_def, _) = ty.sty { - trace!("Read discriminant {}, valid discriminants {:?}", discr_val, adt_def.discriminants(self.tcx).collect::<Vec<_>>()); - if adt_def.discriminants(self.tcx).all(|v| { - discr_val != v.to_u128_unchecked() - }) - { - return err!(InvalidDiscriminant); - } - self.write_primval(dest, PrimVal::Bytes(discr_val), dest_ty)?; - } else { - bug!("rustc only generates Rvalue::Discriminant for enums"); - } - } - } - - if log_enabled!(::log::LogLevel::Trace) { - self.dump_local(dest); - } - - Ok(()) - } - - pub(crate) fn write_struct_wrapped_null_pointer( - &mut self, - dest_ty: ty::Ty<'tcx>, - nndiscr: u64, - discrfield_source: &layout::FieldPath, - dest: Lvalue, - ) -> EvalResult<'tcx> { - let (offset, TyAndPacked { ty, packed }) = self.nonnull_offset_and_ty( - dest_ty, - nndiscr, - discrfield_source, - )?; - let nonnull = self.force_allocation(dest)?.to_ptr()?.offset( - offset.bytes(), - &self, - )?; - trace!("struct wrapped nullable pointer type: {}", ty); - // only the pointer part of a fat pointer is used for this space optimization - let discr_size = self.type_size(ty)?.expect( - "bad StructWrappedNullablePointer discrfield", - ); - self.memory.write_maybe_aligned_mut(!packed, |mem| { - // We're writing 0, signedness does not matter - mem.write_primval(nonnull, PrimVal::Bytes(0), discr_size, false) - }) - } - - pub(super) fn type_is_fat_ptr(&self, ty: Ty<'tcx>) -> bool { - match ty.sty { - ty::TyRawPtr(ref tam) | - ty::TyRef(_, ref tam) => !self.type_is_sized(tam.ty), - ty::TyAdt(def, _) if def.is_box() => !self.type_is_sized(ty.boxed_ty()), - _ => false, - } - } - - pub(super) fn nonnull_offset_and_ty( - &self, - ty: Ty<'tcx>, - nndiscr: u64, - discrfield: &[u32], - ) -> EvalResult<'tcx, (Size, TyAndPacked<'tcx>)> { - // Skip the constant 0 at the start meant for LLVM GEP and the outer non-null variant - let path = discrfield.iter().skip(2).map(|&i| i as usize); - - // Handle the field index for the outer non-null variant. - let (inner_offset, inner_ty) = match ty.sty { - ty::TyAdt(adt_def, substs) => { - let variant = &adt_def.variants[nndiscr as usize]; - let index = discrfield[1]; - let field = &variant.fields[index as usize]; - ( - self.get_field_offset(ty, index as usize)?, - field.ty(self.tcx, substs), - ) - } - _ => bug!("non-enum for StructWrappedNullablePointer: {}", ty), - }; - - self.field_path_offset_and_ty(inner_offset, inner_ty, path) - } - - fn field_path_offset_and_ty<I: Iterator<Item = usize>>( - &self, - mut offset: Size, - mut ty: Ty<'tcx>, - path: I, - ) -> EvalResult<'tcx, (Size, TyAndPacked<'tcx>)> { - // Skip the initial 0 intended for LLVM GEP. - let mut packed = false; - for field_index in path { - let field_offset = self.get_field_offset(ty, field_index)?; - trace!( - "field_path_offset_and_ty: {}, {}, {:?}, {:?}", - field_index, - ty, - field_offset, - offset - ); - let field_ty = self.get_field_ty(ty, field_index)?; - ty = field_ty.ty; - packed = packed || field_ty.packed; - offset = offset - .checked_add(field_offset, &self.tcx.data_layout) - .unwrap(); - } - - Ok((offset, TyAndPacked { ty, packed })) - } - fn get_fat_field( - &self, - pointee_ty: Ty<'tcx>, - field_index: usize, - ) -> EvalResult<'tcx, Ty<'tcx>> { - match (field_index, &self.tcx.struct_tail(pointee_ty).sty) { - (1, &ty::TyStr) | - (1, &ty::TySlice(_)) => Ok(self.tcx.types.usize), - (1, &ty::TyDynamic(..)) | - (0, _) => Ok(self.tcx.mk_imm_ptr(self.tcx.types.u8)), - _ => bug!("invalid fat pointee type: {}", pointee_ty), - } - } - - /// Returns the field type and whether the field is packed - pub fn get_field_ty( - &self, - ty: Ty<'tcx>, - field_index: usize, - ) -> EvalResult<'tcx, TyAndPacked<'tcx>> { - match ty.sty { - ty::TyAdt(adt_def, _) if adt_def.is_box() => Ok(TyAndPacked { - ty: self.get_fat_field(ty.boxed_ty(), field_index)?, - packed: false, - }), - ty::TyAdt(adt_def, substs) if adt_def.is_enum() => { - use rustc::ty::layout::Layout::*; - match *self.type_layout(ty)? { - RawNullablePointer { nndiscr, .. } => Ok(TyAndPacked { - ty: adt_def.variants[nndiscr as usize].fields[field_index].ty( - self.tcx, - substs, - ), - packed: false, - }), - StructWrappedNullablePointer { - nndiscr, - ref nonnull, - .. - } => { - let ty = adt_def.variants[nndiscr as usize].fields[field_index].ty( - self.tcx, - substs, - ); - Ok(TyAndPacked { - ty, - packed: nonnull.packed, - }) - } - // mir optimizations treat single variant enums as structs - General { .. } if adt_def.variants.len() == 1 => Ok(TyAndPacked { - ty: adt_def.variants[0].fields[field_index].ty(self.tcx, substs), - packed: false, - }), - _ => { - err!(Unimplemented(format!( - "get_field_ty can't handle enum type: {:?}, {:?}", - ty, - ty.sty - ))) - } - } - } - ty::TyAdt(adt_def, substs) => { - let variant_def = adt_def.struct_variant(); - use rustc::ty::layout::Layout::*; - match *self.type_layout(ty)? { - UntaggedUnion { ref variants } => Ok(TyAndPacked { - ty: variant_def.fields[field_index].ty(self.tcx, substs), - packed: variants.packed, - }), - Univariant { ref variant, .. } => Ok(TyAndPacked { - ty: variant_def.fields[field_index].ty(self.tcx, substs), - packed: variant.packed, - }), - _ => { - err!(Unimplemented(format!( - "get_field_ty can't handle struct type: {:?}, {:?}", - ty, - ty.sty - ))) - } - } - } - - ty::TyTuple(fields, _) => Ok(TyAndPacked { - ty: fields[field_index], - packed: false, - }), - - ty::TyRef(_, ref tam) | - ty::TyRawPtr(ref tam) => Ok(TyAndPacked { - ty: self.get_fat_field(tam.ty, field_index)?, - packed: false, - }), - - ty::TyArray(ref inner, _) => Ok(TyAndPacked { - ty: inner, - packed: false, - }), - - ty::TyClosure(def_id, ref closure_substs) => Ok(TyAndPacked { - ty: closure_substs.upvar_tys(def_id, self.tcx).nth(field_index).unwrap(), - packed: false, - }), - - _ => { - err!(Unimplemented( - format!("can't handle type: {:?}, {:?}", ty, ty.sty), - )) - } - } - } - - fn get_field_offset(&self, ty: Ty<'tcx>, field_index: usize) -> EvalResult<'tcx, Size> { - // Also see lvalue_field in lvalue.rs, which handles more cases but needs an actual value at the given type - let layout = self.type_layout(ty)?; - - use rustc::ty::layout::Layout::*; - match *layout { - Univariant { ref variant, .. } => Ok(variant.offsets[field_index]), - FatPointer { .. } => { - let bytes = field_index as u64 * self.memory.pointer_size(); - Ok(Size::from_bytes(bytes)) - } - StructWrappedNullablePointer { ref nonnull, .. } => Ok(nonnull.offsets[field_index]), - UntaggedUnion { .. } => Ok(Size::from_bytes(0)), - // mir optimizations treat single variant enums as structs - General { ref variants, .. } if variants.len() == 1 => Ok(variants[0].offsets[field_index]), - _ => { - let msg = format!( - "get_field_offset: can't handle type: {:?}, with layout: {:?}", - ty, - layout - ); - err!(Unimplemented(msg)) - } - } - } - - pub fn get_field_count(&self, ty: Ty<'tcx>) -> EvalResult<'tcx, u64> { - let layout = self.type_layout(ty)?; - - use rustc::ty::layout::Layout::*; - match *layout { - Univariant { ref variant, .. } => Ok(variant.offsets.len() as u64), - FatPointer { .. } => Ok(2), - StructWrappedNullablePointer { ref nonnull, .. } => Ok(nonnull.offsets.len() as u64), - Vector { count, .. } | - Array { count, .. } => Ok(count), - Scalar { .. } => Ok(0), - UntaggedUnion { .. } => Ok(1), - _ => { - let msg = format!( - "get_field_count: can't handle type: {:?}, with layout: {:?}", - ty, - layout - ); - err!(Unimplemented(msg)) - } - } - } - - pub(super) fn eval_operand_to_primval( - &mut self, - op: &mir::Operand<'tcx>, - ) -> EvalResult<'tcx, PrimVal> { - let valty = self.eval_operand(op)?; - self.value_to_primval(valty) - } - - pub(crate) fn operands_to_args( - &mut self, - ops: &[mir::Operand<'tcx>], - ) -> EvalResult<'tcx, Vec<ValTy<'tcx>>> { - ops.into_iter() - .map(|op| self.eval_operand(op)) - .collect() - } - - pub fn eval_operand(&mut self, op: &mir::Operand<'tcx>) -> EvalResult<'tcx, ValTy<'tcx>> { - use rustc::mir::Operand::*; - match *op { - Consume(ref lvalue) => { - Ok(ValTy { - value: self.eval_and_read_lvalue(lvalue)?, - ty: self.operand_ty(op), - }) - }, - - Constant(ref constant) => { - use rustc::mir::Literal; - let mir::Constant { ref literal, .. } = **constant; - let value = match *literal { - Literal::Value { ref value } => self.const_to_value(&value.val)?, - - Literal::Promoted { index } => { - let cid = GlobalId { - instance: self.frame().instance, - promoted: Some(index), - }; - Value::ByRef(*self.globals.get(&cid).expect("promoted not cached")) - } - }; - - Ok(ValTy { - value, - ty: self.operand_ty(op), - }) - } - } - } - - pub fn read_discriminant_value( - &self, - adt_ptr: MemoryPointer, - adt_ty: Ty<'tcx>, - ) -> EvalResult<'tcx, u128> { - use rustc::ty::layout::Layout::*; - let adt_layout = self.type_layout(adt_ty)?; - //trace!("read_discriminant_value {:#?}", adt_layout); - - let discr_val = match *adt_layout { - General { discr, .. } => { - let discr_size = discr.size().bytes(); - self.memory.read_primval(adt_ptr, discr_size, false)?.to_bytes()? - } - - CEnum { - discr, - signed, - .. - } => { - let discr_size = discr.size().bytes(); - self.memory.read_primval(adt_ptr, discr_size, signed)?.to_bytes()? - } - - RawNullablePointer { nndiscr, value } => { - let discr_size = value.size(&self.tcx.data_layout).bytes(); - trace!("rawnullablepointer with size {}", discr_size); - self.read_nonnull_discriminant_value( - adt_ptr, - nndiscr as u128, - discr_size, - )? - } - - StructWrappedNullablePointer { - nndiscr, - ref discrfield_source, - .. - } => { - let (offset, TyAndPacked { ty, packed }) = self.nonnull_offset_and_ty( - adt_ty, - nndiscr, - discrfield_source, - )?; - let nonnull = adt_ptr.offset(offset.bytes(), &*self)?; - trace!("struct wrapped nullable pointer type: {}", ty); - // only the pointer part of a fat pointer is used for this space optimization - let discr_size = self.type_size(ty)?.expect( - "bad StructWrappedNullablePointer discrfield", - ); - self.read_maybe_aligned(!packed, |ectx| { - ectx.read_nonnull_discriminant_value(nonnull, nndiscr as u128, discr_size) - })? - } - - // The discriminant_value intrinsic returns 0 for non-sum types. - Array { .. } | - FatPointer { .. } | - Scalar { .. } | - Univariant { .. } | - Vector { .. } | - UntaggedUnion { .. } => 0, - }; - - Ok(discr_val) - } - - fn read_nonnull_discriminant_value( - &self, - ptr: MemoryPointer, - nndiscr: u128, - discr_size: u64, - ) -> EvalResult<'tcx, u128> { - trace!( - "read_nonnull_discriminant_value: {:?}, {}, {}", - ptr, - nndiscr, - discr_size - ); - // We are only interested in 0 vs. non-0, the sign does not matter for this - let null = match self.memory.read_primval(ptr, discr_size, false)? { - PrimVal::Bytes(0) => true, - PrimVal::Bytes(_) | - PrimVal::Ptr(..) => false, - PrimVal::Undef => return err!(ReadUndefBytes), - }; - assert!(nndiscr == 0 || nndiscr == 1); - Ok(if !null { nndiscr } else { 1 - nndiscr }) - } - - pub fn read_global_as_value(&self, gid: GlobalId) -> Value { - Value::ByRef(*self.globals.get(&gid).expect("global not cached")) - } - - pub fn operand_ty(&self, operand: &mir::Operand<'tcx>) -> Ty<'tcx> { - self.monomorphize(operand.ty(self.mir(), self.tcx), self.substs()) - } - - fn copy(&mut self, src: Pointer, dest: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx> { - let size = self.type_size(ty)?.expect( - "cannot copy from an unsized type", - ); - let align = self.type_align(ty)?; - self.memory.copy(src, dest, size, align, false)?; - Ok(()) - } - - pub fn is_packed(&self, ty: Ty<'tcx>) -> EvalResult<'tcx, bool> { - let layout = self.type_layout(ty)?; - use rustc::ty::layout::Layout::*; - Ok(match *layout { - Univariant { ref variant, .. } => variant.packed, - - StructWrappedNullablePointer { ref nonnull, .. } => nonnull.packed, - - UntaggedUnion { ref variants } => variants.packed, - - // can only apply #[repr(packed)] to struct and union - _ => false, - }) - } - - pub fn force_allocation(&mut self, lvalue: Lvalue) -> EvalResult<'tcx, Lvalue> { - let new_lvalue = match lvalue { - Lvalue::Local { frame, local } => { - // -1 since we don't store the return value - match self.stack[frame].locals[local.index() - 1] { - None => return err!(DeadLocal), - Some(Value::ByRef(ptr)) => { - Lvalue::Ptr { - ptr, - extra: LvalueExtra::None, - } - } - Some(val) => { - let ty = self.stack[frame].mir.local_decls[local].ty; - let ty = self.monomorphize(ty, self.stack[frame].instance.substs); - let substs = self.stack[frame].instance.substs; - let ptr = self.alloc_ptr_with_substs(ty, substs)?; - self.stack[frame].locals[local.index() - 1] = - Some(Value::by_ref(ptr.into())); // it stays live - self.write_value_to_ptr(val, ptr.into(), ty)?; - Lvalue::from_ptr(ptr) - } - } - } - Lvalue::Ptr { .. } => lvalue, - }; - Ok(new_lvalue) - } - - /// ensures this Value is not a ByRef - pub(super) fn follow_by_ref_value( - &self, - value: Value, - ty: Ty<'tcx>, - ) -> EvalResult<'tcx, Value> { - match value { - Value::ByRef(PtrAndAlign { ptr, aligned }) => { - self.read_maybe_aligned(aligned, |ectx| ectx.read_value(ptr, ty)) - } - other => Ok(other), - } - } - - pub fn value_to_primval( - &self, - ValTy { value, ty } : ValTy<'tcx>, - ) -> EvalResult<'tcx, PrimVal> { - match self.follow_by_ref_value(value, ty)? { - Value::ByRef { .. } => bug!("follow_by_ref_value can't result in `ByRef`"), - - Value::ByVal(primval) => { - // TODO: Do we really want insta-UB here? - self.ensure_valid_value(primval, ty)?; - Ok(primval) - } - - Value::ByValPair(..) => bug!("value_to_primval can't work with fat pointers"), - } - } - - pub fn write_null(&mut self, dest: Lvalue, dest_ty: Ty<'tcx>) -> EvalResult<'tcx> { - self.write_primval(dest, PrimVal::Bytes(0), dest_ty) - } - - pub fn write_ptr(&mut self, dest: Lvalue, val: Pointer, dest_ty: Ty<'tcx>) -> EvalResult<'tcx> { - let valty = ValTy { - value: val.to_value(), - ty: dest_ty, - }; - self.write_value(valty, dest) - } - - pub fn write_primval( - &mut self, - dest: Lvalue, - val: PrimVal, - dest_ty: Ty<'tcx>, - ) -> EvalResult<'tcx> { - let valty = ValTy { - value: Value::ByVal(val), - ty: dest_ty, - }; - self.write_value(valty, dest) - } - - pub fn write_value( - &mut self, - ValTy { value: src_val, ty: dest_ty } : ValTy<'tcx>, - dest: Lvalue, - ) -> EvalResult<'tcx> { - //trace!("Writing {:?} to {:?} at type {:?}", src_val, dest, dest_ty); - // Note that it is really important that the type here is the right one, and matches the type things are read at. - // In case `src_val` is a `ByValPair`, we don't do any magic here to handle padding properly, which is only - // correct if we never look at this data with the wrong type. - - match dest { - Lvalue::Ptr { - ptr: PtrAndAlign { ptr, aligned }, - extra, - } => { - assert_eq!(extra, LvalueExtra::None); - self.write_maybe_aligned_mut( - aligned, - |ectx| ectx.write_value_to_ptr(src_val, ptr, dest_ty), - ) - } - - Lvalue::Local { frame, local } => { - let dest = self.stack[frame].get_local(local)?; - self.write_value_possibly_by_val( - src_val, - |this, val| this.stack[frame].set_local(local, val), - dest, - dest_ty, - ) - } - } - } - - // The cases here can be a bit subtle. Read carefully! - fn write_value_possibly_by_val<F: FnOnce(&mut Self, Value) -> EvalResult<'tcx>>( - &mut self, - src_val: Value, - write_dest: F, - old_dest_val: Value, - dest_ty: Ty<'tcx>, - ) -> EvalResult<'tcx> { - if let Value::ByRef(PtrAndAlign { - ptr: dest_ptr, - aligned, - }) = old_dest_val - { - // If the value is already `ByRef` (that is, backed by an `Allocation`), - // then we must write the new value into this allocation, because there may be - // other pointers into the allocation. These other pointers are logically - // pointers into the local variable, and must be able to observe the change. - // - // Thus, it would be an error to replace the `ByRef` with a `ByVal`, unless we - // knew for certain that there were no outstanding pointers to this allocation. - self.write_maybe_aligned_mut(aligned, |ectx| { - ectx.write_value_to_ptr(src_val, dest_ptr, dest_ty) - })?; - - } else if let Value::ByRef(PtrAndAlign { - ptr: src_ptr, - aligned, - }) = src_val - { - // If the value is not `ByRef`, then we know there are no pointers to it - // and we can simply overwrite the `Value` in the locals array directly. - // - // In this specific case, where the source value is `ByRef`, we must duplicate - // the allocation, because this is a by-value operation. It would be incorrect - // if they referred to the same allocation, since then a change to one would - // implicitly change the other. - // - // It is a valid optimization to attempt reading a primitive value out of the - // source and write that into the destination without making an allocation, so - // we do so here. - self.read_maybe_aligned_mut(aligned, |ectx| { - if let Ok(Some(src_val)) = ectx.try_read_value(src_ptr, dest_ty) { - write_dest(ectx, src_val)?; - } else { - let dest_ptr = ectx.alloc_ptr(dest_ty)?.into(); - ectx.copy(src_ptr, dest_ptr, dest_ty)?; - write_dest(ectx, Value::by_ref(dest_ptr))?; - } - Ok(()) - })?; - - } else { - // Finally, we have the simple case where neither source nor destination are - // `ByRef`. We may simply copy the source value over the the destintion. - write_dest(self, src_val)?; - } - Ok(()) - } - - pub fn write_value_to_ptr( - &mut self, - value: Value, - dest: Pointer, - dest_ty: Ty<'tcx>, - ) -> EvalResult<'tcx> { - match value { - Value::ByRef(PtrAndAlign { ptr, aligned }) => { - self.read_maybe_aligned_mut(aligned, |ectx| ectx.copy(ptr, dest, dest_ty)) - } - Value::ByVal(primval) => { - let size = self.type_size(dest_ty)?.expect("dest type must be sized"); - if size == 0 { - assert!(primval.is_undef()); - Ok(()) - } else { - // TODO: Do we need signedness? - self.memory.write_primval(dest.to_ptr()?, primval, size, false) - } - } - Value::ByValPair(a, b) => self.write_pair_to_ptr(a, b, dest.to_ptr()?, dest_ty), - } - } - - pub fn write_pair_to_ptr( - &mut self, - a: PrimVal, - b: PrimVal, - ptr: MemoryPointer, - mut ty: Ty<'tcx>, - ) -> EvalResult<'tcx> { - let mut packed = false; - while self.get_field_count(ty)? == 1 { - let field = self.get_field_ty(ty, 0)?; - ty = field.ty; - packed = packed || field.packed; - } - assert_eq!(self.get_field_count(ty)?, 2); - let field_0 = self.get_field_offset(ty, 0)?; - let field_1 = self.get_field_offset(ty, 1)?; - let field_0_ty = self.get_field_ty(ty, 0)?; - let field_1_ty = self.get_field_ty(ty, 1)?; - assert_eq!( - field_0_ty.packed, - field_1_ty.packed, - "the two fields must agree on being packed" - ); - packed = packed || field_0_ty.packed; - let field_0_size = self.type_size(field_0_ty.ty)?.expect( - "pair element type must be sized", - ); - let field_1_size = self.type_size(field_1_ty.ty)?.expect( - "pair element type must be sized", - ); - let field_0_ptr = ptr.offset(field_0.bytes(), &self)?.into(); - let field_1_ptr = ptr.offset(field_1.bytes(), &self)?.into(); - // TODO: What about signedess? - self.write_maybe_aligned_mut(!packed, |ectx| { - ectx.memory.write_primval(field_0_ptr, a, field_0_size, false) - })?; - self.write_maybe_aligned_mut(!packed, |ectx| { - ectx.memory.write_primval(field_1_ptr, b, field_1_size, false) - })?; - Ok(()) - } - - pub fn ty_to_primval_kind(&self, ty: Ty<'tcx>) -> EvalResult<'tcx, PrimValKind> { - use syntax::ast::FloatTy; - - let kind = match ty.sty { - ty::TyBool => PrimValKind::Bool, - ty::TyChar => PrimValKind::Char, - - ty::TyInt(int_ty) => { - use syntax::ast::IntTy::*; - let size = match int_ty { - I8 => 1, - I16 => 2, - I32 => 4, - I64 => 8, - I128 => 16, - Is => self.memory.pointer_size(), - }; - PrimValKind::from_int_size(size) - } - - ty::TyUint(uint_ty) => { - use syntax::ast::UintTy::*; - let size = match uint_ty { - U8 => 1, - U16 => 2, - U32 => 4, - U64 => 8, - U128 => 16, - Us => self.memory.pointer_size(), - }; - PrimValKind::from_uint_size(size) - } - - ty::TyFloat(FloatTy::F32) => PrimValKind::F32, - ty::TyFloat(FloatTy::F64) => PrimValKind::F64, - - ty::TyFnPtr(_) => PrimValKind::FnPtr, - - ty::TyRef(_, ref tam) | - ty::TyRawPtr(ref tam) if self.type_is_sized(tam.ty) => PrimValKind::Ptr, - - ty::TyAdt(def, _) if def.is_box() => PrimValKind::Ptr, - - ty::TyAdt(def, substs) => { - use rustc::ty::layout::Layout::*; - match *self.type_layout(ty)? { - CEnum { discr, signed, .. } => { - let size = discr.size().bytes(); - if signed { - PrimValKind::from_int_size(size) - } else { - PrimValKind::from_uint_size(size) - } - } - - RawNullablePointer { value, .. } => { - use rustc::ty::layout::Primitive::*; - match value { - // TODO(solson): Does signedness matter here? What should the sign be? - Int(int) => PrimValKind::from_uint_size(int.size().bytes()), - F32 => PrimValKind::F32, - F64 => PrimValKind::F64, - Pointer => PrimValKind::Ptr, - } - } - - // represent single field structs as their single field - Univariant { .. } => { - // enums with just one variant are no different, but `.struct_variant()` doesn't work for enums - let variant = &def.variants[0]; - // FIXME: also allow structs with only a single non zst field - if variant.fields.len() == 1 { - return self.ty_to_primval_kind(variant.fields[0].ty(self.tcx, substs)); - } else { - return err!(TypeNotPrimitive(ty)); - } - } - - _ => return err!(TypeNotPrimitive(ty)), - } - } - - _ => return err!(TypeNotPrimitive(ty)), - }; - - Ok(kind) - } - - fn ensure_valid_value(&self, val: PrimVal, ty: Ty<'tcx>) -> EvalResult<'tcx> { - match ty.sty { - ty::TyBool if val.to_bytes()? > 1 => err!(InvalidBool), - - ty::TyChar if ::std::char::from_u32(val.to_bytes()? as u32).is_none() => { - err!(InvalidChar(val.to_bytes()? as u32 as u128)) - } - - _ => Ok(()), - } - } - - pub fn read_value(&self, ptr: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx, Value> { - if let Some(val) = self.try_read_value(ptr, ty)? { - Ok(val) - } else { - bug!("primitive read failed for type: {:?}", ty); - } - } - - pub(crate) fn read_ptr( - &self, - ptr: MemoryPointer, - pointee_ty: Ty<'tcx>, - ) -> EvalResult<'tcx, Value> { - let ptr_size = self.memory.pointer_size(); - let p : Pointer = self.memory.read_ptr_sized_unsigned(ptr)?.into(); - if self.type_is_sized(pointee_ty) { - Ok(p.to_value()) - } else { - trace!("reading fat pointer extra of type {}", pointee_ty); - let extra = ptr.offset(ptr_size, self)?; - match self.tcx.struct_tail(pointee_ty).sty { - ty::TyDynamic(..) => Ok(p.to_value_with_vtable( - self.memory.read_ptr_sized_unsigned(extra)?.to_ptr()?, - )), - ty::TySlice(..) | ty::TyStr => Ok( - p.to_value_with_len(self.memory.read_ptr_sized_unsigned(extra)?.to_bytes()? as u64), - ), - _ => bug!("unsized primval ptr read from {:?}", pointee_ty), - } - } - } - - fn try_read_value(&self, ptr: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx, Option<Value>> { - use syntax::ast::FloatTy; - - let ptr = ptr.to_ptr()?; - let val = match ty.sty { - ty::TyBool => { - let val = self.memory.read_primval(ptr, 1, false)?; - let val = match val { - PrimVal::Bytes(0) => false, - PrimVal::Bytes(1) => true, - // TODO: This seems a little overeager, should reading at bool type already be UB? - _ => return err!(InvalidBool), - }; - PrimVal::from_bool(val) - } - ty::TyChar => { - let c = self.memory.read_primval(ptr, 4, false)?.to_bytes()? as u32; - match ::std::char::from_u32(c) { - Some(ch) => PrimVal::from_char(ch), - None => return err!(InvalidChar(c as u128)), - } - } - - ty::TyInt(int_ty) => { - use syntax::ast::IntTy::*; - let size = match int_ty { - I8 => 1, - I16 => 2, - I32 => 4, - I64 => 8, - I128 => 16, - Is => self.memory.pointer_size(), - }; - self.memory.read_primval(ptr, size, true)? - } - - ty::TyUint(uint_ty) => { - use syntax::ast::UintTy::*; - let size = match uint_ty { - U8 => 1, - U16 => 2, - U32 => 4, - U64 => 8, - U128 => 16, - Us => self.memory.pointer_size(), - }; - self.memory.read_primval(ptr, size, false)? - } - - ty::TyFloat(FloatTy::F32) => PrimVal::Bytes(self.memory.read_primval(ptr, 4, false)?.to_bytes()?), - ty::TyFloat(FloatTy::F64) => PrimVal::Bytes(self.memory.read_primval(ptr, 8, false)?.to_bytes()?), - - ty::TyFnPtr(_) => self.memory.read_ptr_sized_unsigned(ptr)?, - ty::TyRef(_, ref tam) | - ty::TyRawPtr(ref tam) => return self.read_ptr(ptr, tam.ty).map(Some), - - ty::TyAdt(def, _) => { - if def.is_box() { - return self.read_ptr(ptr, ty.boxed_ty()).map(Some); - } - use rustc::ty::layout::Layout::*; - if let CEnum { discr, signed, .. } = *self.type_layout(ty)? { - let size = discr.size().bytes(); - self.memory.read_primval(ptr, size, signed)? - } else { - return Ok(None); - } - } - - _ => return Ok(None), - }; - - Ok(Some(Value::ByVal(val))) - } - - pub fn frame(&self) -> &Frame<'tcx> { - self.stack.last().expect("no call frames exist") - } - - pub(super) fn frame_mut(&mut self) -> &mut Frame<'tcx> { - self.stack.last_mut().expect("no call frames exist") - } - - pub(super) fn mir(&self) -> &'tcx mir::Mir<'tcx> { - self.frame().mir - } - - pub(super) fn substs(&self) -> &'tcx Substs<'tcx> { - self.frame().instance.substs - } - - fn unsize_into_ptr( - &mut self, - src: Value, - src_ty: Ty<'tcx>, - dest: Lvalue, - dest_ty: Ty<'tcx>, - sty: Ty<'tcx>, - dty: Ty<'tcx>, - ) -> EvalResult<'tcx> { - // A<Struct> -> A<Trait> conversion - let (src_pointee_ty, dest_pointee_ty) = self.tcx.struct_lockstep_tails(sty, dty); - - match (&src_pointee_ty.sty, &dest_pointee_ty.sty) { - (&ty::TyArray(_, length), &ty::TySlice(_)) => { - let ptr = src.into_ptr(&self.memory)?; - // u64 cast is from usize to u64, which is always good - let valty = ValTy { - value: ptr.to_value_with_len(length.val.to_const_int().unwrap().to_u64().unwrap() ), - ty: dest_ty, - }; - self.write_value(valty, dest) - } - (&ty::TyDynamic(..), &ty::TyDynamic(..)) => { - // For now, upcasts are limited to changes in marker - // traits, and hence never actually require an actual - // change to the vtable. - let valty = ValTy { - value: src, - ty: dest_ty, - }; - self.write_value(valty, dest) - } - (_, &ty::TyDynamic(ref data, _)) => { - let trait_ref = data.principal().unwrap().with_self_ty( - self.tcx, - src_pointee_ty, - ); - let trait_ref = self.tcx.erase_regions(&trait_ref); - let vtable = self.get_vtable(src_pointee_ty, trait_ref)?; - let ptr = src.into_ptr(&self.memory)?; - let valty = ValTy { - value: ptr.to_value_with_vtable(vtable), - ty: dest_ty, - }; - self.write_value(valty, dest) - } - - _ => bug!("invalid unsizing {:?} -> {:?}", src_ty, dest_ty), - } - } - - fn unsize_into( - &mut self, - src: Value, - src_ty: Ty<'tcx>, - dest: Lvalue, - dest_ty: Ty<'tcx>, - ) -> EvalResult<'tcx> { - match (&src_ty.sty, &dest_ty.sty) { - (&ty::TyRef(_, ref s), &ty::TyRef(_, ref d)) | - (&ty::TyRef(_, ref s), &ty::TyRawPtr(ref d)) | - (&ty::TyRawPtr(ref s), &ty::TyRawPtr(ref d)) => { - self.unsize_into_ptr(src, src_ty, dest, dest_ty, s.ty, d.ty) - } - (&ty::TyAdt(def_a, substs_a), &ty::TyAdt(def_b, substs_b)) => { - if def_a.is_box() || def_b.is_box() { - if !def_a.is_box() || !def_b.is_box() { - panic!("invalid unsizing between {:?} -> {:?}", src_ty, dest_ty); - } - return self.unsize_into_ptr( - src, - src_ty, - dest, - dest_ty, - src_ty.boxed_ty(), - dest_ty.boxed_ty(), - ); - } - if self.ty_to_primval_kind(src_ty).is_ok() { - // TODO: We ignore the packed flag here - let sty = self.get_field_ty(src_ty, 0)?.ty; - let dty = self.get_field_ty(dest_ty, 0)?.ty; - return self.unsize_into(src, sty, dest, dty); - } - // unsizing of generic struct with pointer fields - // Example: `Arc<T>` -> `Arc<Trait>` - // here we need to increase the size of every &T thin ptr field to a fat ptr - - assert_eq!(def_a, def_b); - - let src_fields = def_a.variants[0].fields.iter(); - let dst_fields = def_b.variants[0].fields.iter(); - - //let src = adt::MaybeSizedValue::sized(src); - //let dst = adt::MaybeSizedValue::sized(dst); - let src_ptr = match src { - Value::ByRef(PtrAndAlign { ptr, aligned: true }) => ptr, - // TODO: Is it possible for unaligned pointers to occur here? - _ => bug!("expected aligned pointer, got {:?}", src), - }; - - // FIXME(solson) - let dest = self.force_allocation(dest)?.to_ptr()?; - let iter = src_fields.zip(dst_fields).enumerate(); - for (i, (src_f, dst_f)) in iter { - let src_fty = self.field_ty(substs_a, src_f); - let dst_fty = self.field_ty(substs_b, dst_f); - if self.type_size(dst_fty)? == Some(0) { - continue; - } - let src_field_offset = self.get_field_offset(src_ty, i)?.bytes(); - let dst_field_offset = self.get_field_offset(dest_ty, i)?.bytes(); - let src_f_ptr = src_ptr.offset(src_field_offset, &self)?; - let dst_f_ptr = dest.offset(dst_field_offset, &self)?; - if src_fty == dst_fty { - self.copy(src_f_ptr, dst_f_ptr.into(), src_fty)?; - } else { - self.unsize_into( - Value::by_ref(src_f_ptr), - src_fty, - Lvalue::from_ptr(dst_f_ptr), - dst_fty, - )?; - } - } - Ok(()) - } - _ => { - bug!( - "unsize_into: invalid conversion: {:?} -> {:?}", - src_ty, - dest_ty - ) - } - } - } - - pub fn dump_local(&self, lvalue: Lvalue) { - // Debug output - match lvalue { - Lvalue::Local { frame, local } => { - let mut allocs = Vec::new(); - let mut msg = format!("{:?}", local); - if frame != self.cur_frame() { - write!(msg, " ({} frames up)", self.cur_frame() - frame).unwrap(); - } - write!(msg, ":").unwrap(); - - match self.stack[frame].get_local(local) { - Err(EvalError { kind: EvalErrorKind::DeadLocal, .. }) => { - write!(msg, " is dead").unwrap(); - } - Err(err) => { - panic!("Failed to access local: {:?}", err); - } - Ok(Value::ByRef(PtrAndAlign { ptr, aligned })) => { - match ptr.into_inner_primval() { - PrimVal::Ptr(ptr) => { - write!(msg, " by {}ref:", if aligned { "" } else { "unaligned " }) - .unwrap(); - allocs.push(ptr.alloc_id); - } - ptr => write!(msg, " integral by ref: {:?}", ptr).unwrap(), - } - } - Ok(Value::ByVal(val)) => { - write!(msg, " {:?}", val).unwrap(); - if let PrimVal::Ptr(ptr) = val { - allocs.push(ptr.alloc_id); - } - } - Ok(Value::ByValPair(val1, val2)) => { - write!(msg, " ({:?}, {:?})", val1, val2).unwrap(); - if let PrimVal::Ptr(ptr) = val1 { - allocs.push(ptr.alloc_id); - } - if let PrimVal::Ptr(ptr) = val2 { - allocs.push(ptr.alloc_id); - } - } - } - - trace!("{}", msg); - self.memory.dump_allocs(allocs); - } - Lvalue::Ptr { ptr: PtrAndAlign { ptr, aligned }, .. } => { - match ptr.into_inner_primval() { - PrimVal::Ptr(ptr) => { - trace!("by {}ref:", if aligned { "" } else { "unaligned " }); - self.memory.dump_alloc(ptr.alloc_id); - } - ptr => trace!(" integral by ref: {:?}", ptr), - } - } - } - } - - /// Convenience function to ensure correct usage of locals - pub fn modify_local<F>(&mut self, frame: usize, local: mir::Local, f: F) -> EvalResult<'tcx> - where - F: FnOnce(&mut Self, Value) -> EvalResult<'tcx, Value>, - { - let val = self.stack[frame].get_local(local)?; - let new_val = f(self, val)?; - self.stack[frame].set_local(local, new_val)?; - // FIXME(solson): Run this when setting to Undef? (See previous version of this code.) - // if let Value::ByRef(ptr) = self.stack[frame].get_local(local) { - // self.memory.deallocate(ptr)?; - // } - Ok(()) - } - - pub fn report(&self, e: &mut EvalError) { - if let Some(ref mut backtrace) = e.backtrace { - let mut trace_text = "\n\nAn error occurred in miri:\n".to_string(); - let mut skip_init = true; - backtrace.resolve(); - 'frames: for (i, frame) in backtrace.frames().iter().enumerate() { - for symbol in frame.symbols() { - if let Some(name) = symbol.name() { - // unmangle the symbol via `to_string` - let name = name.to_string(); - if name.starts_with("miri::after_analysis") { - // don't report initialization gibberish - break 'frames; - } else if name.starts_with("backtrace::capture::Backtrace::new") - // debug mode produces funky symbol names - || name.starts_with("backtrace::capture::{{impl}}::new") - { - // don't report backtrace internals - skip_init = false; - continue 'frames; - } - } - } - if skip_init { - continue; - } - for symbol in frame.symbols() { - write!(trace_text, "{}: ", i).unwrap(); - if let Some(name) = symbol.name() { - write!(trace_text, "{}\n", name).unwrap(); - } else { - write!(trace_text, "<unknown>\n").unwrap(); - } - write!(trace_text, "\tat ").unwrap(); - if let Some(file_path) = symbol.filename() { - write!(trace_text, "{}", file_path.display()).unwrap(); - } else { - write!(trace_text, "<unknown_file>").unwrap(); - } - if let Some(line) = symbol.lineno() { - write!(trace_text, ":{}\n", line).unwrap(); - } else { - write!(trace_text, "\n").unwrap(); - } - } - } - error!("{}", trace_text); - } - if let Some(frame) = self.stack().last() { - let block = &frame.mir.basic_blocks()[frame.block]; - let span = if frame.stmt < block.statements.len() { - block.statements[frame.stmt].source_info.span - } else { - block.terminator().source_info.span - }; - let mut err = self.tcx.sess.struct_span_err(span, &e.to_string()); - for &Frame { instance, span, .. } in self.stack().iter().rev() { - if self.tcx.def_key(instance.def_id()).disambiguated_data.data == - DefPathData::ClosureExpr - { - err.span_note(span, "inside call to closure"); - continue; - } - err.span_note(span, &format!("inside call to {}", instance)); - } - err.emit(); - } else { - self.tcx.sess.err(&e.to_string()); - } - } -} - -impl<'tcx> Frame<'tcx> { - pub fn get_local(&self, local: mir::Local) -> EvalResult<'tcx, Value> { - // Subtract 1 because we don't store a value for the ReturnPointer, the local with index 0. - self.locals[local.index() - 1].ok_or(EvalErrorKind::DeadLocal.into()) - } - - fn set_local(&mut self, local: mir::Local, value: Value) -> EvalResult<'tcx> { - // Subtract 1 because we don't store a value for the ReturnPointer, the local with index 0. - match self.locals[local.index() - 1] { - None => err!(DeadLocal), - Some(ref mut local) => { - *local = value; - Ok(()) - } - } - } - - pub fn storage_live(&mut self, local: mir::Local) -> EvalResult<'tcx, Option<Value>> { - trace!("{:?} is now live", local); - - let old = self.locals[local.index() - 1]; - self.locals[local.index() - 1] = Some(Value::ByVal(PrimVal::Undef)); // StorageLive *always* kills the value that's currently stored - return Ok(old); - } - - /// Returns the old value of the local - pub fn storage_dead(&mut self, local: mir::Local) -> EvalResult<'tcx, Option<Value>> { - trace!("{:?} is now dead", local); - - let old = self.locals[local.index() - 1]; - self.locals[local.index() - 1] = None; - return Ok(old); - } -} - -// TODO(solson): Upstream these methods into rustc::ty::layout. - -pub(super) trait IntegerExt { - fn size(self) -> Size; -} - -impl IntegerExt for layout::Integer { - fn size(self) -> Size { - use rustc::ty::layout::Integer::*; - match self { - I1 | I8 => Size::from_bits(8), - I16 => Size::from_bits(16), - I32 => Size::from_bits(32), - I64 => Size::from_bits(64), - I128 => Size::from_bits(128), - } - } -} - -pub fn is_inhabited<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { - ty.uninhabited_from(&mut HashMap::default(), tcx).is_empty() -} - -/// FIXME: expose trans::monomorphize::resolve_closure -pub fn resolve_closure<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - def_id: DefId, - substs: ty::ClosureSubsts<'tcx>, - requested_kind: ty::ClosureKind, -) -> ty::Instance<'tcx> { - let actual_kind = tcx.closure_kind(def_id); - match needs_fn_once_adapter_shim(actual_kind, requested_kind) { - Ok(true) => fn_once_adapter_instance(tcx, def_id, substs), - _ => ty::Instance::new(def_id, substs.substs), - } -} - -fn fn_once_adapter_instance<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - closure_did: DefId, - substs: ty::ClosureSubsts<'tcx>, -) -> ty::Instance<'tcx> { - debug!("fn_once_adapter_shim({:?}, {:?})", closure_did, substs); - let fn_once = tcx.lang_items().fn_once_trait().unwrap(); - let call_once = tcx.associated_items(fn_once) - .find(|it| it.kind == ty::AssociatedKind::Method) - .unwrap() - .def_id; - let def = ty::InstanceDef::ClosureOnceShim { call_once }; - - let self_ty = tcx.mk_closure_from_closure_substs(closure_did, substs); - - let sig = tcx.fn_sig(closure_did).subst(tcx, substs.substs); - let sig = tcx.erase_late_bound_regions_and_normalize(&sig); - assert_eq!(sig.inputs().len(), 1); - let substs = tcx.mk_substs( - [Kind::from(self_ty), Kind::from(sig.inputs()[0])] - .iter() - .cloned(), - ); - - debug!("fn_once_adapter_shim: self_ty={:?} sig={:?}", self_ty, sig); - ty::Instance { def, substs } -} - -fn needs_fn_once_adapter_shim( - actual_closure_kind: ty::ClosureKind, - trait_closure_kind: ty::ClosureKind, -) -> Result<bool, ()> { - match (actual_closure_kind, trait_closure_kind) { - (ty::ClosureKind::Fn, ty::ClosureKind::Fn) | - (ty::ClosureKind::FnMut, ty::ClosureKind::FnMut) | - (ty::ClosureKind::FnOnce, ty::ClosureKind::FnOnce) => { - // No adapter needed. - Ok(false) - } - (ty::ClosureKind::Fn, ty::ClosureKind::FnMut) => { - // The closure fn `llfn` is a `fn(&self, ...)`. We want a - // `fn(&mut self, ...)`. In fact, at trans time, these are - // basically the same thing, so we can just return llfn. - Ok(false) - } - (ty::ClosureKind::Fn, ty::ClosureKind::FnOnce) | - (ty::ClosureKind::FnMut, ty::ClosureKind::FnOnce) => { - // The closure fn `llfn` is a `fn(&self, ...)` or `fn(&mut - // self, ...)`. We want a `fn(self, ...)`. We can produce - // this by doing something like: - // - // fn call_once(self, ...) { call_mut(&self, ...) } - // fn call_once(mut self, ...) { call_mut(&mut self, ...) } - // - // These are both the same at trans time. - Ok(true) - } - _ => Err(()), - } -} - -/// The point where linking happens. Resolve a (def_id, substs) -/// pair to an instance. -pub fn resolve<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - def_id: DefId, - substs: &'tcx Substs<'tcx>, -) -> ty::Instance<'tcx> { - debug!("resolve(def_id={:?}, substs={:?})", def_id, substs); - let result = if let Some(trait_def_id) = tcx.trait_of_item(def_id) { - debug!(" => associated item, attempting to find impl"); - let item = tcx.associated_item(def_id); - resolve_associated_item(tcx, &item, trait_def_id, substs) - } else { - let item_type = def_ty(tcx, def_id, substs); - let def = match item_type.sty { - ty::TyFnDef(..) - if { - let f = item_type.fn_sig(tcx); - f.abi() == Abi::RustIntrinsic || f.abi() == Abi::PlatformIntrinsic - } => { - debug!(" => intrinsic"); - ty::InstanceDef::Intrinsic(def_id) - } - _ => { - if Some(def_id) == tcx.lang_items().drop_in_place_fn() { - let ty = substs.type_at(0); - if needs_drop_glue(tcx, ty) { - debug!(" => nontrivial drop glue"); - ty::InstanceDef::DropGlue(def_id, Some(ty)) - } else { - debug!(" => trivial drop glue"); - ty::InstanceDef::DropGlue(def_id, None) - } - } else { - debug!(" => free item"); - ty::InstanceDef::Item(def_id) - } - } - }; - ty::Instance { def, substs } - }; - debug!( - "resolve(def_id={:?}, substs={:?}) = {}", - def_id, - substs, - result - ); - result -} - -pub fn needs_drop_glue<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, t: Ty<'tcx>) -> bool { - assert!(t.is_normalized_for_trans()); - - let t = tcx.erase_regions(&t); - - // FIXME (#22815): note that type_needs_drop conservatively - // approximates in some cases and may say a type expression - // requires drop glue when it actually does not. - // - // (In this case it is not clear whether any harm is done, i.e. - // erroneously returning `true` in some cases where we could have - // returned `false` does not appear unsound. The impact on - // code quality is unknown at this time.) - - let env = ty::ParamEnv::empty(Reveal::All); - if !t.needs_drop(tcx, env) { - return false; - } - match t.sty { - ty::TyAdt(def, _) if def.is_box() => { - let typ = t.boxed_ty(); - if !typ.needs_drop(tcx, env) && type_is_sized(tcx, typ) { - let layout = t.layout(tcx, ty::ParamEnv::empty(Reveal::All)).unwrap(); - // `Box<ZeroSizeType>` does not allocate. - layout.size(&tcx.data_layout).bytes() != 0 - } else { - true - } - } - _ => true, - } -} - -fn resolve_associated_item<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - trait_item: &ty::AssociatedItem, - trait_id: DefId, - rcvr_substs: &'tcx Substs<'tcx>, -) -> ty::Instance<'tcx> { - let def_id = trait_item.def_id; - debug!( - "resolve_associated_item(trait_item={:?}, \ - trait_id={:?}, \ - rcvr_substs={:?})", - def_id, - trait_id, - rcvr_substs - ); - - let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs); - let vtbl = tcx.trans_fulfill_obligation(DUMMY_SP, ty::Binder(trait_ref)); - - // Now that we know which impl is being used, we can dispatch to - // the actual function: - match vtbl { - ::rustc::traits::VtableImpl(impl_data) => { - let (def_id, substs) = - ::rustc::traits::find_associated_item(tcx, trait_item, rcvr_substs, &impl_data); - let substs = tcx.erase_regions(&substs); - ty::Instance::new(def_id, substs) - } - ::rustc::traits::VtableGenerator(closure_data) => { - ty::Instance { - def: ty::InstanceDef::Item(closure_data.closure_def_id), - substs: closure_data.substs.substs - } - } - ::rustc::traits::VtableClosure(closure_data) => { - let trait_closure_kind = tcx.lang_items().fn_trait_kind(trait_id).unwrap(); - resolve_closure( - tcx, - closure_data.closure_def_id, - closure_data.substs, - trait_closure_kind, - ) - } - ::rustc::traits::VtableFnPointer(ref data) => { - ty::Instance { - def: ty::InstanceDef::FnPtrShim(trait_item.def_id, data.fn_ty), - substs: rcvr_substs, - } - } - ::rustc::traits::VtableObject(ref data) => { - let index = tcx.get_vtable_index_of_object_method(data, def_id); - ty::Instance { - def: ty::InstanceDef::Virtual(def_id, index), - substs: rcvr_substs, - } - } - ::rustc::traits::VtableBuiltin(..) if Some(trait_id) == tcx.lang_items().clone_trait() => { - ty::Instance { - def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()), - substs: rcvr_substs - } - } - _ => bug!("static call to invalid vtable: {:?}", vtbl), - } -} - -pub fn def_ty<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - def_id: DefId, - substs: &'tcx Substs<'tcx>, -) -> Ty<'tcx> { - let ty = tcx.type_of(def_id); - apply_param_substs(tcx, substs, &ty) -} - -/// Monomorphizes a type from the AST by first applying the in-scope -/// substitutions and then normalizing any associated types. -pub fn apply_param_substs<'a, 'tcx, T>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_substs: &Substs<'tcx>, - value: &T, -) -> T -where - T: ::rustc::infer::TransNormalize<'tcx>, -{ - debug!( - "apply_param_substs(param_substs={:?}, value={:?})", - param_substs, - value - ); - let substituted = value.subst(tcx, param_substs); - let substituted = tcx.erase_regions(&substituted); - AssociatedTypeNormalizer { tcx }.fold(&substituted) -} - - -struct AssociatedTypeNormalizer<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, -} - -impl<'a, 'tcx> AssociatedTypeNormalizer<'a, 'tcx> { - fn fold<T: TypeFoldable<'tcx>>(&mut self, value: &T) -> T { - if !value.has_projections() { - value.clone() - } else { - value.fold_with(self) - } - } -} - -impl<'a, 'tcx> ::rustc::ty::fold::TypeFolder<'tcx, 'tcx> for AssociatedTypeNormalizer<'a, 'tcx> { - fn tcx<'c>(&'c self) -> TyCtxt<'c, 'tcx, 'tcx> { - self.tcx - } - - fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { - if !ty.has_projections() { - ty - } else { - self.tcx.normalize_associated_type(&ty) - } - } -} - -fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { - // generics are weird, don't run this function on a generic - assert!(!ty.needs_subst()); - ty.is_sized(tcx, ty::ParamEnv::empty(Reveal::All), DUMMY_SP) -} - -pub fn resolve_drop_in_place<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - ty: Ty<'tcx>, -) -> ty::Instance<'tcx> { - let def_id = tcx.require_lang_item(::rustc::middle::lang_items::DropInPlaceFnLangItem); - let substs = tcx.intern_substs(&[Kind::from(ty)]); - resolve(tcx, def_id, substs) -} diff --git a/src/tools/miri/src/librustc_mir/interpret/lvalue.rs b/src/tools/miri/src/librustc_mir/interpret/lvalue.rs deleted file mode 100644 index 7fb6ac4209..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/lvalue.rs +++ /dev/null @@ -1,506 +0,0 @@ -use rustc::mir; -use rustc::ty::layout::{Size, Align}; -use rustc::ty::{self, Ty}; -use rustc_data_structures::indexed_vec::Idx; - -use super::{EvalResult, EvalContext, MemoryPointer, PrimVal, Value, Pointer, Machine, PtrAndAlign, ValTy}; - -#[derive(Copy, Clone, Debug)] -pub enum Lvalue { - /// An lvalue referring to a value allocated in the `Memory` system. - Ptr { - /// An lvalue may have an invalid (integral or undef) pointer, - /// since it might be turned back into a reference - /// before ever being dereferenced. - ptr: PtrAndAlign, - extra: LvalueExtra, - }, - - /// An lvalue referring to a value on the stack. Represented by a stack frame index paired with - /// a Mir local index. - Local { frame: usize, local: mir::Local }, -} - -#[derive(Copy, Clone, Debug, Eq, PartialEq)] -pub enum LvalueExtra { - None, - Length(u64), - Vtable(MemoryPointer), - DowncastVariant(usize), -} - -/// Uniquely identifies a specific constant or static. -#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] -pub struct GlobalId<'tcx> { - /// For a constant or static, the `Instance` of the item itself. - /// For a promoted global, the `Instance` of the function they belong to. - pub instance: ty::Instance<'tcx>, - - /// The index for promoted globals within their function's `Mir`. - pub promoted: Option<mir::Promoted>, -} - -impl<'tcx> Lvalue { - /// Produces an Lvalue that will error if attempted to be read from - pub fn undef() -> Self { - Self::from_primval_ptr(PrimVal::Undef.into()) - } - - pub fn from_primval_ptr(ptr: Pointer) -> Self { - Lvalue::Ptr { - ptr: PtrAndAlign { ptr, aligned: true }, - extra: LvalueExtra::None, - } - } - - pub fn from_ptr(ptr: MemoryPointer) -> Self { - Self::from_primval_ptr(ptr.into()) - } - - pub(super) fn to_ptr_extra_aligned(self) -> (PtrAndAlign, LvalueExtra) { - match self { - Lvalue::Ptr { ptr, extra } => (ptr, extra), - _ => bug!("to_ptr_and_extra: expected Lvalue::Ptr, got {:?}", self), - - } - } - - pub fn to_ptr(self) -> EvalResult<'tcx, MemoryPointer> { - let (ptr, extra) = self.to_ptr_extra_aligned(); - // At this point, we forget about the alignment information -- the lvalue has been turned into a reference, - // and no matter where it came from, it now must be aligned. - assert_eq!(extra, LvalueExtra::None); - ptr.to_ptr() - } - - pub(super) fn elem_ty_and_len(self, ty: Ty<'tcx>) -> (Ty<'tcx>, u64) { - match ty.sty { - ty::TyArray(elem, n) => (elem, n.val.to_const_int().unwrap().to_u64().unwrap() as u64), - - ty::TySlice(elem) => { - match self { - Lvalue::Ptr { extra: LvalueExtra::Length(len), .. } => (elem, len), - _ => { - bug!( - "elem_ty_and_len of a TySlice given non-slice lvalue: {:?}", - self - ) - } - } - } - - _ => bug!("elem_ty_and_len expected array or slice, got {:?}", ty), - } - } -} - -impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> { - /// Reads a value from the lvalue without going through the intermediate step of obtaining - /// a `miri::Lvalue` - pub fn try_read_lvalue( - &mut self, - lvalue: &mir::Lvalue<'tcx>, - ) -> EvalResult<'tcx, Option<Value>> { - use rustc::mir::Lvalue::*; - match *lvalue { - // Might allow this in the future, right now there's no way to do this from Rust code anyway - Local(mir::RETURN_POINTER) => err!(ReadFromReturnPointer), - // Directly reading a local will always succeed - Local(local) => self.frame().get_local(local).map(Some), - // Directly reading a static will always succeed - Static(ref static_) => { - let instance = ty::Instance::mono(self.tcx, static_.def_id); - let cid = GlobalId { - instance, - promoted: None, - }; - Ok(Some(Value::ByRef( - *self.globals.get(&cid).expect("global not cached"), - ))) - } - Projection(ref proj) => self.try_read_lvalue_projection(proj), - } - } - - fn try_read_lvalue_projection( - &mut self, - proj: &mir::LvalueProjection<'tcx>, - ) -> EvalResult<'tcx, Option<Value>> { - use rustc::mir::ProjectionElem::*; - let base = match self.try_read_lvalue(&proj.base)? { - Some(base) => base, - None => return Ok(None), - }; - let base_ty = self.lvalue_ty(&proj.base); - match proj.elem { - Field(field, _) => match (field.index(), base) { - // the only field of a struct - (0, Value::ByVal(val)) => Ok(Some(Value::ByVal(val))), - // split fat pointers, 2 element tuples, ... - (0...1, Value::ByValPair(a, b)) if self.get_field_count(base_ty)? == 2 => { - let val = [a, b][field.index()]; - Ok(Some(Value::ByVal(val))) - }, - // the only field of a struct is a fat pointer - (0, Value::ByValPair(..)) => Ok(Some(base)), - _ => Ok(None), - }, - // The NullablePointer cases should work fine, need to take care for normal enums - Downcast(..) | - Subslice { .. } | - // reading index 0 or index 1 from a ByVal or ByVal pair could be optimized - ConstantIndex { .. } | Index(_) | - // No way to optimize this projection any better than the normal lvalue path - Deref => Ok(None), - } - } - - /// Returns a value and (in case of a ByRef) if we are supposed to use aligned accesses. - pub(super) fn eval_and_read_lvalue( - &mut self, - lvalue: &mir::Lvalue<'tcx>, - ) -> EvalResult<'tcx, Value> { - // Shortcut for things like accessing a fat pointer's field, - // which would otherwise (in the `eval_lvalue` path) require moving a `ByValPair` to memory - // and returning an `Lvalue::Ptr` to it - if let Some(val) = self.try_read_lvalue(lvalue)? { - return Ok(val); - } - let lvalue = self.eval_lvalue(lvalue)?; - self.read_lvalue(lvalue) - } - - pub fn read_lvalue(&self, lvalue: Lvalue) -> EvalResult<'tcx, Value> { - match lvalue { - Lvalue::Ptr { ptr, extra } => { - assert_eq!(extra, LvalueExtra::None); - Ok(Value::ByRef(ptr)) - } - Lvalue::Local { frame, local } => self.stack[frame].get_local(local), - } - } - - pub fn eval_lvalue(&mut self, mir_lvalue: &mir::Lvalue<'tcx>) -> EvalResult<'tcx, Lvalue> { - use rustc::mir::Lvalue::*; - let lvalue = match *mir_lvalue { - Local(mir::RETURN_POINTER) => self.frame().return_lvalue, - Local(local) => Lvalue::Local { - frame: self.cur_frame(), - local, - }, - - Static(ref static_) => { - let instance = ty::Instance::mono(self.tcx, static_.def_id); - let gid = GlobalId { - instance, - promoted: None, - }; - Lvalue::Ptr { - ptr: *self.globals.get(&gid).expect("uncached global"), - extra: LvalueExtra::None, - } - } - - Projection(ref proj) => { - let ty = self.lvalue_ty(&proj.base); - let lvalue = self.eval_lvalue(&proj.base)?; - return self.eval_lvalue_projection(lvalue, ty, &proj.elem); - } - }; - - if log_enabled!(::log::LogLevel::Trace) { - self.dump_local(lvalue); - } - - Ok(lvalue) - } - - pub fn lvalue_field( - &mut self, - base: Lvalue, - field: mir::Field, - base_ty: Ty<'tcx>, - field_ty: Ty<'tcx>, - ) -> EvalResult<'tcx, Lvalue> { - use rustc::ty::layout::Layout::*; - - let base_layout = self.type_layout(base_ty)?; - let field_index = field.index(); - let (offset, packed) = match *base_layout { - Univariant { ref variant, .. } => (variant.offsets[field_index], variant.packed), - - // mir optimizations treat single variant enums as structs - General { ref variants, .. } if variants.len() == 1 => { - (variants[0].offsets[field_index], variants[0].packed) - } - - General { ref variants, .. } => { - let (_, base_extra) = base.to_ptr_extra_aligned(); - if let LvalueExtra::DowncastVariant(variant_idx) = base_extra { - // +1 for the discriminant, which is field 0 - assert!(!variants[variant_idx].packed); - (variants[variant_idx].offsets[field_index + 1], false) - } else { - bug!("field access on enum had no variant index"); - } - } - - RawNullablePointer { .. } => { - assert_eq!(field_index, 0); - return Ok(base); - } - - StructWrappedNullablePointer { ref nonnull, .. } => { - (nonnull.offsets[field_index], nonnull.packed) - } - - UntaggedUnion { .. } => return Ok(base), - - Vector { element, count } => { - let field = field_index as u64; - assert!(field < count); - let elem_size = element.size(&self.tcx.data_layout).bytes(); - (Size::from_bytes(field * elem_size), false) - } - - // We treat arrays + fixed sized indexing like field accesses - Array { .. } => { - let field = field_index as u64; - let elem_size = match base_ty.sty { - ty::TyArray(elem_ty, n) => { - assert!(field < n.val.to_const_int().unwrap().to_u64().unwrap() as u64); - self.type_size(elem_ty)?.expect("array elements are sized") as u64 - } - _ => { - bug!( - "lvalue_field: got Array layout but non-array type {:?}", - base_ty - ) - } - }; - (Size::from_bytes(field * elem_size), false) - } - - FatPointer { .. } => { - let bytes = field_index as u64 * self.memory.pointer_size(); - let offset = Size::from_bytes(bytes); - (offset, false) - } - - _ => bug!("field access on non-product type: {:?}", base_layout), - }; - - // Do not allocate in trivial cases - let (base_ptr, base_extra) = match base { - Lvalue::Ptr { ptr, extra } => (ptr, extra), - Lvalue::Local { frame, local } => { - match self.stack[frame].get_local(local)? { - // in case the type has a single field, just return the value - Value::ByVal(_) - if self.get_field_count(base_ty).map(|c| c == 1).unwrap_or( - false, - ) => { - assert_eq!( - offset.bytes(), - 0, - "ByVal can only have 1 non zst field with offset 0" - ); - return Ok(base); - } - Value::ByRef { .. } | - Value::ByValPair(..) | - Value::ByVal(_) => self.force_allocation(base)?.to_ptr_extra_aligned(), - } - } - }; - - let offset = match base_extra { - LvalueExtra::Vtable(tab) => { - let (_, align) = self.size_and_align_of_dst( - base_ty, - base_ptr.ptr.to_value_with_vtable(tab), - )?; - offset - .abi_align(Align::from_bytes(align, align).unwrap()) - .bytes() - } - _ => offset.bytes(), - }; - - let mut ptr = base_ptr.offset(offset, &self)?; - // if we were unaligned, stay unaligned - // no matter what we were, if we are packed, we must not be aligned anymore - ptr.aligned &= !packed; - - let field_ty = self.monomorphize(field_ty, self.substs()); - - let extra = if self.type_is_sized(field_ty) { - LvalueExtra::None - } else { - match base_extra { - LvalueExtra::None => bug!("expected fat pointer"), - LvalueExtra::DowncastVariant(..) => { - bug!("Rust doesn't support unsized fields in enum variants") - } - LvalueExtra::Vtable(_) | - LvalueExtra::Length(_) => {} - } - base_extra - }; - - Ok(Lvalue::Ptr { ptr, extra }) - } - - pub(super) fn val_to_lvalue(&self, val: Value, ty: Ty<'tcx>) -> EvalResult<'tcx, Lvalue> { - Ok(match self.tcx.struct_tail(ty).sty { - ty::TyDynamic(..) => { - let (ptr, vtable) = val.into_ptr_vtable_pair(&self.memory)?; - Lvalue::Ptr { - ptr: PtrAndAlign { ptr, aligned: true }, - extra: LvalueExtra::Vtable(vtable), - } - } - ty::TyStr | ty::TySlice(_) => { - let (ptr, len) = val.into_slice(&self.memory)?; - Lvalue::Ptr { - ptr: PtrAndAlign { ptr, aligned: true }, - extra: LvalueExtra::Length(len), - } - } - _ => Lvalue::from_primval_ptr(val.into_ptr(&self.memory)?), - }) - } - - pub(super) fn lvalue_index( - &mut self, - base: Lvalue, - outer_ty: Ty<'tcx>, - n: u64, - ) -> EvalResult<'tcx, Lvalue> { - // Taking the outer type here may seem odd; it's needed because for array types, the outer type gives away the length. - let base = self.force_allocation(base)?; - let (base_ptr, _) = base.to_ptr_extra_aligned(); - - let (elem_ty, len) = base.elem_ty_and_len(outer_ty); - let elem_size = self.type_size(elem_ty)?.expect( - "slice element must be sized", - ); - assert!( - n < len, - "Tried to access element {} of array/slice with length {}", - n, - len - ); - let ptr = base_ptr.offset(n * elem_size, self.memory.layout)?; - Ok(Lvalue::Ptr { - ptr, - extra: LvalueExtra::None, - }) - } - - pub(super) fn eval_lvalue_projection( - &mut self, - base: Lvalue, - base_ty: Ty<'tcx>, - proj_elem: &mir::ProjectionElem<'tcx, mir::Local, Ty<'tcx>>, - ) -> EvalResult<'tcx, Lvalue> { - use rustc::mir::ProjectionElem::*; - let (ptr, extra) = match *proj_elem { - Field(field, field_ty) => { - return self.lvalue_field(base, field, base_ty, field_ty); - } - - Downcast(_, variant) => { - let base_layout = self.type_layout(base_ty)?; - // FIXME(solson) - let base = self.force_allocation(base)?; - let (base_ptr, base_extra) = base.to_ptr_extra_aligned(); - - use rustc::ty::layout::Layout::*; - let extra = match *base_layout { - General { .. } => LvalueExtra::DowncastVariant(variant), - RawNullablePointer { .. } | - StructWrappedNullablePointer { .. } => base_extra, - _ => bug!("variant downcast on non-aggregate: {:?}", base_layout), - }; - (base_ptr, extra) - } - - Deref => { - let val = self.read_lvalue(base)?; - - let pointee_type = match base_ty.sty { - ty::TyRawPtr(ref tam) | - ty::TyRef(_, ref tam) => tam.ty, - ty::TyAdt(def, _) if def.is_box() => base_ty.boxed_ty(), - _ => bug!("can only deref pointer types"), - }; - - trace!("deref to {} on {:?}", pointee_type, val); - - return self.val_to_lvalue(val, pointee_type); - } - - Index(local) => { - let value = self.frame().get_local(local)?; - let ty = self.tcx.types.usize; - let n = self.value_to_primval(ValTy { value, ty })?.to_u64()?; - return self.lvalue_index(base, base_ty, n); - } - - ConstantIndex { - offset, - min_length, - from_end, - } => { - // FIXME(solson) - let base = self.force_allocation(base)?; - let (base_ptr, _) = base.to_ptr_extra_aligned(); - - let (elem_ty, n) = base.elem_ty_and_len(base_ty); - let elem_size = self.type_size(elem_ty)?.expect( - "sequence element must be sized", - ); - assert!(n >= min_length as u64); - - let index = if from_end { - n - u64::from(offset) - } else { - u64::from(offset) - }; - - let ptr = base_ptr.offset(index * elem_size, &self)?; - (ptr, LvalueExtra::None) - } - - Subslice { from, to } => { - // FIXME(solson) - let base = self.force_allocation(base)?; - let (base_ptr, _) = base.to_ptr_extra_aligned(); - - let (elem_ty, n) = base.elem_ty_and_len(base_ty); - let elem_size = self.type_size(elem_ty)?.expect( - "slice element must be sized", - ); - assert!(u64::from(from) <= n - u64::from(to)); - let ptr = base_ptr.offset(u64::from(from) * elem_size, &self)?; - // sublicing arrays produces arrays - let extra = if self.type_is_sized(base_ty) { - LvalueExtra::None - } else { - LvalueExtra::Length(n - u64::from(to) - u64::from(from)) - }; - (ptr, extra) - } - }; - - Ok(Lvalue::Ptr { ptr, extra }) - } - - pub(super) fn lvalue_ty(&self, lvalue: &mir::Lvalue<'tcx>) -> Ty<'tcx> { - self.monomorphize( - lvalue.ty(self.mir(), self.tcx).to_ty(self.tcx), - self.substs(), - ) - } -} diff --git a/src/tools/miri/src/librustc_mir/interpret/memory.rs b/src/tools/miri/src/librustc_mir/interpret/memory.rs deleted file mode 100644 index bde79294ad..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/memory.rs +++ /dev/null @@ -1,1700 +0,0 @@ -use byteorder::{ReadBytesExt, WriteBytesExt, LittleEndian, BigEndian}; -use std::collections::{btree_map, BTreeMap, HashMap, HashSet, VecDeque}; -use std::{fmt, iter, ptr, mem, io}; -use std::cell::Cell; - -use rustc::ty::Instance; -use rustc::ty::layout::{self, TargetDataLayout, HasDataLayout}; -use syntax::ast::Mutability; -use rustc::middle::region; - -use super::{EvalResult, EvalErrorKind, PrimVal, Pointer, EvalContext, DynamicLifetime, Machine, - RangeMap, AbsLvalue}; - -//////////////////////////////////////////////////////////////////////////////// -// Locks -//////////////////////////////////////////////////////////////////////////////// - -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub enum AccessKind { - Read, - Write, -} - -/// Information about a lock that is currently held. -#[derive(Clone, Debug)] -struct LockInfo<'tcx> { - /// Stores for which lifetimes (of the original write lock) we got - /// which suspensions. - suspended: HashMap<WriteLockId<'tcx>, Vec<region::Scope>>, - /// The current state of the lock that's actually effective. - active: Lock, -} - -/// Write locks are identified by a stack frame and an "abstract" (untyped) lvalue. -/// It may be tempting to use the lifetime as identifier, but that does not work -/// for two reasons: -/// * First of all, due to subtyping, the same lock may be referred to with different -/// lifetimes. -/// * Secondly, different write locks may actually have the same lifetime. See `test2` -/// in `run-pass/many_shr_bor.rs`. -/// The Id is "captured" when the lock is first suspended; at that point, the borrow checker -/// considers the path frozen and hence the Id remains stable. -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -struct WriteLockId<'tcx> { - frame: usize, - path: AbsLvalue<'tcx>, -} - -#[derive(Clone, Debug, PartialEq)] -pub enum Lock { - NoLock, - WriteLock(DynamicLifetime), - ReadLock(Vec<DynamicLifetime>), // This should never be empty -- that would be a read lock held and nobody there to release it... -} -use self::Lock::*; - -impl<'tcx> Default for LockInfo<'tcx> { - fn default() -> Self { - LockInfo::new(NoLock) - } -} - -impl<'tcx> LockInfo<'tcx> { - fn new(lock: Lock) -> LockInfo<'tcx> { - LockInfo { - suspended: HashMap::new(), - active: lock, - } - } - - fn access_permitted(&self, frame: Option<usize>, access: AccessKind) -> bool { - use self::AccessKind::*; - match (&self.active, access) { - (&NoLock, _) => true, - (&ReadLock(ref lfts), Read) => { - assert!(!lfts.is_empty(), "Someone left an empty read lock behind."); - // Read access to read-locked region is okay, no matter who's holding the read lock. - true - } - (&WriteLock(ref lft), _) => { - // All access is okay if we are the ones holding it - Some(lft.frame) == frame - } - _ => false, // Nothing else is okay. - } - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Allocations and pointers -//////////////////////////////////////////////////////////////////////////////// - -#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct AllocId(u64); - -#[derive(Debug)] -pub enum AllocIdKind { - /// We can't ever have more than `usize::max_value` functions at the same time - /// since we never "deallocate" functions - Function(usize), - /// Locals and heap allocations (also statics for now, but those will get their - /// own variant soonish). - Runtime(u64), -} - -impl AllocIdKind { - pub fn into_alloc_id(self) -> AllocId { - match self { - AllocIdKind::Function(n) => AllocId(n as u64), - AllocIdKind::Runtime(n) => AllocId((1 << 63) | n), - } - } -} - -impl AllocId { - /// Currently yields the top bit to discriminate the `AllocIdKind`s - fn discriminant(self) -> u64 { - self.0 >> 63 - } - /// Yields everything but the discriminant bits - pub fn index(self) -> u64 { - self.0 & ((1 << 63) - 1) - } - pub fn into_alloc_id_kind(self) -> AllocIdKind { - match self.discriminant() { - 0 => AllocIdKind::Function(self.index() as usize), - 1 => AllocIdKind::Runtime(self.index()), - n => bug!("got discriminant {} for AllocId", n), - } - } -} - -impl fmt::Display for AllocId { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self.into_alloc_id_kind()) - } -} - -impl fmt::Debug for AllocId { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self.into_alloc_id_kind()) - } -} - -#[derive(Debug)] -pub struct Allocation<'tcx, M> { - /// The actual bytes of the allocation. - /// Note that the bytes of a pointer represent the offset of the pointer - pub bytes: Vec<u8>, - /// Maps from byte addresses to allocations. - /// Only the first byte of a pointer is inserted into the map. - pub relocations: BTreeMap<u64, AllocId>, - /// Denotes undefined memory. Reading from undefined memory is forbidden in miri - pub undef_mask: UndefMask, - /// The alignment of the allocation to detect unaligned reads. - pub align: u64, - /// Whether the allocation may be modified. - pub mutable: Mutability, - /// Use the `mark_static_initalized` method of `Memory` to ensure that an error occurs, if the memory of this - /// allocation is modified or deallocated in the future. - /// Helps guarantee that stack allocations aren't deallocated via `rust_deallocate` - pub kind: MemoryKind<M>, - /// Memory regions that are locked by some function - locks: RangeMap<LockInfo<'tcx>>, -} - -impl<'tcx, M> Allocation<'tcx, M> { - fn check_locks( - &self, - frame: Option<usize>, - offset: u64, - len: u64, - access: AccessKind, - ) -> Result<(), LockInfo<'tcx>> { - if len == 0 { - return Ok(()); - } - for lock in self.locks.iter(offset, len) { - // Check if the lock is in conflict with the access. - if !lock.access_permitted(frame, access) { - return Err(lock.clone()); - } - } - Ok(()) - } -} - -#[derive(Debug, PartialEq, Copy, Clone)] -pub enum MemoryKind<T> { - /// Error if deallocated except during a stack pop - Stack, - /// Static in the process of being initialized. - /// The difference is important: An immutable static referring to a - /// mutable initialized static will freeze immutably and would not - /// be able to distinguish already initialized statics from uninitialized ones - UninitializedStatic, - /// May never be deallocated - Static, - /// Additional memory kinds a machine wishes to distinguish from the builtin ones - Machine(T), -} - -#[derive(Copy, Clone, Debug, Eq, PartialEq)] -pub struct MemoryPointer { - pub alloc_id: AllocId, - pub offset: u64, -} - -impl<'tcx> MemoryPointer { - pub fn new(alloc_id: AllocId, offset: u64) -> Self { - MemoryPointer { alloc_id, offset } - } - - pub(crate) fn wrapping_signed_offset<C: HasDataLayout>(self, i: i64, cx: C) -> Self { - MemoryPointer::new( - self.alloc_id, - cx.data_layout().wrapping_signed_offset(self.offset, i), - ) - } - - pub fn overflowing_signed_offset<C: HasDataLayout>(self, i: i128, cx: C) -> (Self, bool) { - let (res, over) = cx.data_layout().overflowing_signed_offset(self.offset, i); - (MemoryPointer::new(self.alloc_id, res), over) - } - - pub(crate) fn signed_offset<C: HasDataLayout>(self, i: i64, cx: C) -> EvalResult<'tcx, Self> { - Ok(MemoryPointer::new( - self.alloc_id, - cx.data_layout().signed_offset(self.offset, i)?, - )) - } - - pub fn overflowing_offset<C: HasDataLayout>(self, i: u64, cx: C) -> (Self, bool) { - let (res, over) = cx.data_layout().overflowing_offset(self.offset, i); - (MemoryPointer::new(self.alloc_id, res), over) - } - - pub fn offset<C: HasDataLayout>(self, i: u64, cx: C) -> EvalResult<'tcx, Self> { - Ok(MemoryPointer::new( - self.alloc_id, - cx.data_layout().offset(self.offset, i)?, - )) - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Top-level interpreter memory -//////////////////////////////////////////////////////////////////////////////// - -pub struct Memory<'a, 'tcx, M: Machine<'tcx>> { - /// Additional data required by the Machine - pub data: M::MemoryData, - - /// Actual memory allocations (arbitrary bytes, may contain pointers into other allocations). - alloc_map: HashMap<u64, Allocation<'tcx, M::MemoryKinds>>, - - /// The AllocId to assign to the next new regular allocation. Always incremented, never gets smaller. - next_alloc_id: u64, - - /// Number of virtual bytes allocated. - memory_usage: u64, - - /// Maximum number of virtual bytes that may be allocated. - memory_size: u64, - - /// Function "allocations". They exist solely so pointers have something to point to, and - /// we can figure out what they point to. - functions: Vec<Instance<'tcx>>, - - /// Inverse map of `functions` so we don't allocate a new pointer every time we need one - function_alloc_cache: HashMap<Instance<'tcx>, AllocId>, - - /// Target machine data layout to emulate. - pub layout: &'a TargetDataLayout, - - /// A cache for basic byte allocations keyed by their contents. This is used to deduplicate - /// allocations for string and bytestring literals. - literal_alloc_cache: HashMap<Vec<u8>, AllocId>, - - /// To avoid having to pass flags to every single memory access, we have some global state saying whether - /// alignment checking is currently enforced for read and/or write accesses. - reads_are_aligned: Cell<bool>, - writes_are_aligned: Cell<bool>, - - /// The current stack frame. Used to check accesses against locks. - pub(super) cur_frame: usize, -} - -impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> { - pub fn new(layout: &'a TargetDataLayout, max_memory: u64, data: M::MemoryData) -> Self { - Memory { - data, - alloc_map: HashMap::new(), - functions: Vec::new(), - function_alloc_cache: HashMap::new(), - next_alloc_id: 0, - layout, - memory_size: max_memory, - memory_usage: 0, - literal_alloc_cache: HashMap::new(), - reads_are_aligned: Cell::new(true), - writes_are_aligned: Cell::new(true), - cur_frame: usize::max_value(), - } - } - - pub fn allocations<'x>( - &'x self, - ) -> impl Iterator<Item = (AllocId, &'x Allocation<M::MemoryKinds>)> { - self.alloc_map.iter().map(|(&id, alloc)| { - (AllocIdKind::Runtime(id).into_alloc_id(), alloc) - }) - } - - pub fn create_fn_alloc(&mut self, instance: Instance<'tcx>) -> MemoryPointer { - if let Some(&alloc_id) = self.function_alloc_cache.get(&instance) { - return MemoryPointer::new(alloc_id, 0); - } - let id = self.functions.len(); - debug!("creating fn ptr: {}", id); - self.functions.push(instance); - let alloc_id = AllocIdKind::Function(id).into_alloc_id(); - self.function_alloc_cache.insert(instance, alloc_id); - MemoryPointer::new(alloc_id, 0) - } - - pub fn allocate_cached(&mut self, bytes: &[u8]) -> EvalResult<'tcx, MemoryPointer> { - if let Some(&alloc_id) = self.literal_alloc_cache.get(bytes) { - return Ok(MemoryPointer::new(alloc_id, 0)); - } - - let ptr = self.allocate( - bytes.len() as u64, - 1, - MemoryKind::UninitializedStatic, - )?; - self.write_bytes(ptr.into(), bytes)?; - self.mark_static_initalized( - ptr.alloc_id, - Mutability::Immutable, - )?; - self.literal_alloc_cache.insert( - bytes.to_vec(), - ptr.alloc_id, - ); - Ok(ptr) - } - - pub fn allocate( - &mut self, - size: u64, - align: u64, - kind: MemoryKind<M::MemoryKinds>, - ) -> EvalResult<'tcx, MemoryPointer> { - assert_ne!(align, 0); - assert!(align.is_power_of_two()); - - if self.memory_size - self.memory_usage < size { - return err!(OutOfMemory { - allocation_size: size, - memory_size: self.memory_size, - memory_usage: self.memory_usage, - }); - } - self.memory_usage += size; - assert_eq!(size as usize as u64, size); - let alloc = Allocation { - bytes: vec![0; size as usize], - relocations: BTreeMap::new(), - undef_mask: UndefMask::new(size), - align, - kind, - mutable: Mutability::Mutable, - locks: RangeMap::new(), - }; - let id = self.next_alloc_id; - self.next_alloc_id += 1; - self.alloc_map.insert(id, alloc); - Ok(MemoryPointer::new( - AllocIdKind::Runtime(id).into_alloc_id(), - 0, - )) - } - - pub fn reallocate( - &mut self, - ptr: MemoryPointer, - old_size: u64, - old_align: u64, - new_size: u64, - new_align: u64, - kind: MemoryKind<M::MemoryKinds>, - ) -> EvalResult<'tcx, MemoryPointer> { - use std::cmp::min; - - if ptr.offset != 0 { - return err!(ReallocateNonBasePtr); - } - if let Ok(alloc) = self.get(ptr.alloc_id) { - if alloc.kind != kind { - return err!(ReallocatedWrongMemoryKind( - format!("{:?}", alloc.kind), - format!("{:?}", kind), - )); - } - } - - // For simplicities' sake, we implement reallocate as "alloc, copy, dealloc" - let new_ptr = self.allocate(new_size, new_align, kind)?; - self.copy( - ptr.into(), - new_ptr.into(), - min(old_size, new_size), - min(old_align, new_align), - /*nonoverlapping*/ - true, - )?; - self.deallocate(ptr, Some((old_size, old_align)), kind)?; - - Ok(new_ptr) - } - - pub fn deallocate( - &mut self, - ptr: MemoryPointer, - size_and_align: Option<(u64, u64)>, - kind: MemoryKind<M::MemoryKinds>, - ) -> EvalResult<'tcx> { - if ptr.offset != 0 { - return err!(DeallocateNonBasePtr); - } - - let alloc_id = match ptr.alloc_id.into_alloc_id_kind() { - AllocIdKind::Function(_) => { - return err!(DeallocatedWrongMemoryKind( - "function".to_string(), - format!("{:?}", kind), - )) - } - AllocIdKind::Runtime(id) => id, - }; - - let alloc = match self.alloc_map.remove(&alloc_id) { - Some(alloc) => alloc, - None => return err!(DoubleFree), - }; - - // It is okay for us to still holds locks on deallocation -- for example, we could store data we own - // in a local, and the local could be deallocated (from StorageDead) before the function returns. - // However, we should check *something*. For now, we make sure that there is no conflicting write - // lock by another frame. We *have* to permit deallocation if we hold a read lock. - // TODO: Figure out the exact rules here. - alloc - .check_locks( - Some(self.cur_frame), - 0, - alloc.bytes.len() as u64, - AccessKind::Read, - ) - .map_err(|lock| { - EvalErrorKind::DeallocatedLockedMemory { - ptr, - lock: lock.active, - } - })?; - - if alloc.kind != kind { - return err!(DeallocatedWrongMemoryKind( - format!("{:?}", alloc.kind), - format!("{:?}", kind), - )); - } - if let Some((size, align)) = size_and_align { - if size != alloc.bytes.len() as u64 || align != alloc.align { - return err!(IncorrectAllocationInformation); - } - } - - self.memory_usage -= alloc.bytes.len() as u64; - debug!("deallocated : {}", ptr.alloc_id); - - Ok(()) - } - - pub fn pointer_size(&self) -> u64 { - self.layout.pointer_size.bytes() - } - - pub fn endianess(&self) -> layout::Endian { - self.layout.endian - } - - /// Check that the pointer is aligned AND non-NULL. - pub fn check_align(&self, ptr: Pointer, align: u64, access: Option<AccessKind>) -> EvalResult<'tcx> { - // Check non-NULL/Undef, extract offset - let (offset, alloc_align) = match ptr.into_inner_primval() { - PrimVal::Ptr(ptr) => { - let alloc = self.get(ptr.alloc_id)?; - (ptr.offset, alloc.align) - } - PrimVal::Bytes(bytes) => { - let v = ((bytes as u128) % (1 << self.pointer_size())) as u64; - if v == 0 { - return err!(InvalidNullPointerUsage); - } - (v, align) // the base address if the "integer allocation" is 0 and hence always aligned - } - PrimVal::Undef => return err!(ReadUndefBytes), - }; - // See if alignment checking is disabled - let enforce_alignment = match access { - Some(AccessKind::Read) => self.reads_are_aligned.get(), - Some(AccessKind::Write) => self.writes_are_aligned.get(), - None => true, - }; - if !enforce_alignment { - return Ok(()); - } - // Check alignment - if alloc_align < align { - return err!(AlignmentCheckFailed { - has: alloc_align, - required: align, - }); - } - if offset % align == 0 { - Ok(()) - } else { - err!(AlignmentCheckFailed { - has: offset % align, - required: align, - }) - } - } - - pub fn check_bounds(&self, ptr: MemoryPointer, access: bool) -> EvalResult<'tcx> { - let alloc = self.get(ptr.alloc_id)?; - let allocation_size = alloc.bytes.len() as u64; - if ptr.offset > allocation_size { - return err!(PointerOutOfBounds { - ptr, - access, - allocation_size, - }); - } - Ok(()) - } -} - -/// Locking -impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> { - pub(crate) fn check_locks( - &self, - ptr: MemoryPointer, - len: u64, - access: AccessKind, - ) -> EvalResult<'tcx> { - if len == 0 { - return Ok(()); - } - let alloc = self.get(ptr.alloc_id)?; - let frame = self.cur_frame; - alloc - .check_locks(Some(frame), ptr.offset, len, access) - .map_err(|lock| { - EvalErrorKind::MemoryLockViolation { - ptr, - len, - frame, - access, - lock: lock.active, - }.into() - }) - } - - /// Acquire the lock for the given lifetime - pub(crate) fn acquire_lock( - &mut self, - ptr: MemoryPointer, - len: u64, - region: Option<region::Scope>, - kind: AccessKind, - ) -> EvalResult<'tcx> { - let frame = self.cur_frame; - assert!(len > 0); - trace!( - "Frame {} acquiring {:?} lock at {:?}, size {} for region {:?}", - frame, - kind, - ptr, - len, - region - ); - self.check_bounds(ptr.offset(len, self.layout)?, true)?; // if ptr.offset is in bounds, then so is ptr (because offset checks for overflow) - let alloc = self.get_mut_unchecked(ptr.alloc_id)?; - - // Iterate over our range and acquire the lock. If the range is already split into pieces, - // we have to manipulate all of them. - let lifetime = DynamicLifetime { frame, region }; - for lock in alloc.locks.iter_mut(ptr.offset, len) { - if !lock.access_permitted(None, kind) { - return err!(MemoryAcquireConflict { - ptr, - len, - kind, - lock: lock.active.clone(), - }); - } - // See what we have to do - match (&mut lock.active, kind) { - (active @ &mut NoLock, AccessKind::Write) => { - *active = WriteLock(lifetime); - } - (active @ &mut NoLock, AccessKind::Read) => { - *active = ReadLock(vec![lifetime]); - } - (&mut ReadLock(ref mut lifetimes), AccessKind::Read) => { - lifetimes.push(lifetime); - } - _ => bug!("We already checked that there is no conflicting lock"), - } - } - Ok(()) - } - - /// Release or suspend a write lock of the given lifetime prematurely. - /// When releasing, if there is a read lock or someone else's write lock, that's an error. - /// If no lock is held, that's fine. This can happen when e.g. a local is initialized - /// from a constant, and then suspended. - /// When suspending, the same cases are fine; we just register an additional suspension. - pub(crate) fn suspend_write_lock( - &mut self, - ptr: MemoryPointer, - len: u64, - lock_path: &AbsLvalue<'tcx>, - suspend: Option<region::Scope>, - ) -> EvalResult<'tcx> { - assert!(len > 0); - let cur_frame = self.cur_frame; - let alloc = self.get_mut_unchecked(ptr.alloc_id)?; - - 'locks: for lock in alloc.locks.iter_mut(ptr.offset, len) { - let is_our_lock = match lock.active { - WriteLock(lft) => - // Double-check that we are holding the lock. - // (Due to subtyping, checking the region would not make any sense.) - lft.frame == cur_frame, - ReadLock(_) | NoLock => false, - }; - if is_our_lock { - trace!("Releasing {:?}", lock.active); - // Disable the lock - lock.active = NoLock; - } else { - trace!( - "Not touching {:?} as it is not our lock", - lock.active, - ); - } - // Check if we want to register a suspension - if let Some(suspend_region) = suspend { - let lock_id = WriteLockId { - frame: cur_frame, - path: lock_path.clone(), - }; - trace!("Adding suspension to {:?}", lock_id); - let mut new_suspension = false; - lock.suspended - .entry(lock_id) - // Remember whether we added a new suspension or not - .or_insert_with(|| { new_suspension = true; Vec::new() }) - .push(suspend_region); - // If the suspension is new, we should have owned this. - // If there already was a suspension, we should NOT have owned this. - if new_suspension == is_our_lock { - // All is well - continue 'locks; - } - } else { - if !is_our_lock { - // All is well. - continue 'locks; - } - } - // If we get here, releasing this is an error except for NoLock. - if lock.active != NoLock { - return err!(InvalidMemoryLockRelease { - ptr, - len, - frame: cur_frame, - lock: lock.active.clone(), - }); - } - } - - Ok(()) - } - - /// Release a suspension from the write lock. If this is the last suspension or if there is no suspension, acquire the lock. - pub(crate) fn recover_write_lock( - &mut self, - ptr: MemoryPointer, - len: u64, - lock_path: &AbsLvalue<'tcx>, - lock_region: Option<region::Scope>, - suspended_region: region::Scope, - ) -> EvalResult<'tcx> { - assert!(len > 0); - let cur_frame = self.cur_frame; - let lock_id = WriteLockId { - frame: cur_frame, - path: lock_path.clone(), - }; - let alloc = self.get_mut_unchecked(ptr.alloc_id)?; - - for lock in alloc.locks.iter_mut(ptr.offset, len) { - // Check if we have a suspension here - let (got_the_lock, remove_suspension) = match lock.suspended.get_mut(&lock_id) { - None => { - trace!("No suspension around, we can just acquire"); - (true, false) - } - Some(suspensions) => { - trace!("Found suspension of {:?}, removing it", lock_id); - // That's us! Remove suspension (it should be in there). The same suspension can - // occur multiple times (when there are multiple shared borrows of this that have the same - // lifetime); only remove one of them. - let idx = match suspensions.iter().enumerate().find(|&(_, re)| re == &suspended_region) { - None => // TODO: Can the user trigger this? - bug!("We have this lock suspended, but not for the given region."), - Some((idx, _)) => idx - }; - suspensions.remove(idx); - let got_lock = suspensions.is_empty(); - if got_lock { - trace!("All suspensions are gone, we can have the lock again"); - } - (got_lock, got_lock) - } - }; - if remove_suspension { - // with NLL, we could do that up in the match above... - assert!(got_the_lock); - lock.suspended.remove(&lock_id); - } - if got_the_lock { - match lock.active { - ref mut active @ NoLock => { - *active = WriteLock( - DynamicLifetime { - frame: cur_frame, - region: lock_region, - } - ); - } - _ => { - return err!(MemoryAcquireConflict { - ptr, - len, - kind: AccessKind::Write, - lock: lock.active.clone(), - }) - } - } - } - } - - Ok(()) - } - - pub(crate) fn locks_lifetime_ended(&mut self, ending_region: Option<region::Scope>) { - let cur_frame = self.cur_frame; - trace!( - "Releasing frame {} locks that expire at {:?}", - cur_frame, - ending_region - ); - let has_ended = |lifetime: &DynamicLifetime| -> bool { - if lifetime.frame != cur_frame { - return false; - } - match ending_region { - None => true, // When a function ends, we end *all* its locks. It's okay for a function to still have lifetime-related locks - // when it returns, that can happen e.g. with NLL when a lifetime can, but does not have to, extend beyond the - // end of a function. Same for a function still having recoveries. - Some(ending_region) => lifetime.region == Some(ending_region), - } - }; - - for alloc in self.alloc_map.values_mut() { - for lock in alloc.locks.iter_mut_all() { - // Delete everything that ends now -- i.e., keep only all the other lifetimes. - let lock_ended = match lock.active { - WriteLock(ref lft) => has_ended(lft), - ReadLock(ref mut lfts) => { - lfts.retain(|lft| !has_ended(lft)); - lfts.is_empty() - } - NoLock => false, - }; - if lock_ended { - lock.active = NoLock; - } - // Also clean up suspended write locks when the function returns - if ending_region.is_none() { - lock.suspended.retain(|id, _suspensions| id.frame != cur_frame); - } - } - // Clean up the map - alloc.locks.retain(|lock| match lock.active { - NoLock => lock.suspended.len() > 0, - _ => true, - }); - } - } -} - -/// Allocation accessors -impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> { - pub fn get(&self, id: AllocId) -> EvalResult<'tcx, &Allocation<'tcx, M::MemoryKinds>> { - match id.into_alloc_id_kind() { - AllocIdKind::Function(_) => err!(DerefFunctionPointer), - AllocIdKind::Runtime(id) => { - match self.alloc_map.get(&id) { - Some(alloc) => Ok(alloc), - None => err!(DanglingPointerDeref), - } - } - } - } - - fn get_mut_unchecked( - &mut self, - id: AllocId, - ) -> EvalResult<'tcx, &mut Allocation<'tcx, M::MemoryKinds>> { - match id.into_alloc_id_kind() { - AllocIdKind::Function(_) => err!(DerefFunctionPointer), - AllocIdKind::Runtime(id) => { - match self.alloc_map.get_mut(&id) { - Some(alloc) => Ok(alloc), - None => err!(DanglingPointerDeref), - } - } - } - } - - fn get_mut(&mut self, id: AllocId) -> EvalResult<'tcx, &mut Allocation<'tcx, M::MemoryKinds>> { - let alloc = self.get_mut_unchecked(id)?; - if alloc.mutable == Mutability::Mutable { - Ok(alloc) - } else { - err!(ModifiedConstantMemory) - } - } - - pub fn get_fn(&self, ptr: MemoryPointer) -> EvalResult<'tcx, Instance<'tcx>> { - if ptr.offset != 0 { - return err!(InvalidFunctionPointer); - } - debug!("reading fn ptr: {}", ptr.alloc_id); - match ptr.alloc_id.into_alloc_id_kind() { - AllocIdKind::Function(id) => Ok(self.functions[id]), - AllocIdKind::Runtime(_) => err!(ExecuteMemory), - } - } - - /// For debugging, print an allocation and all allocations it points to, recursively. - pub fn dump_alloc(&self, id: AllocId) { - self.dump_allocs(vec![id]); - } - - /// For debugging, print a list of allocations and all allocations they point to, recursively. - pub fn dump_allocs(&self, mut allocs: Vec<AllocId>) { - use std::fmt::Write; - allocs.sort(); - allocs.dedup(); - let mut allocs_to_print = VecDeque::from(allocs); - let mut allocs_seen = HashSet::new(); - - while let Some(id) = allocs_to_print.pop_front() { - let mut msg = format!("Alloc {:<5} ", format!("{}:", id)); - let prefix_len = msg.len(); - let mut relocations = vec![]; - - let alloc = match id.into_alloc_id_kind() { - AllocIdKind::Function(id) => { - trace!("{} {}", msg, self.functions[id]); - continue; - } - AllocIdKind::Runtime(id) => { - match self.alloc_map.get(&id) { - Some(a) => a, - None => { - trace!("{} (deallocated)", msg); - continue; - } - } - } - }; - - for i in 0..(alloc.bytes.len() as u64) { - if let Some(&target_id) = alloc.relocations.get(&i) { - if allocs_seen.insert(target_id) { - allocs_to_print.push_back(target_id); - } - relocations.push((i, target_id)); - } - if alloc.undef_mask.is_range_defined(i, i + 1) { - // this `as usize` is fine, since `i` came from a `usize` - write!(msg, "{:02x} ", alloc.bytes[i as usize]).unwrap(); - } else { - msg.push_str("__ "); - } - } - - let immutable = match (alloc.kind, alloc.mutable) { - (MemoryKind::UninitializedStatic, _) => { - " (static in the process of initialization)".to_owned() - } - (MemoryKind::Static, Mutability::Mutable) => " (static mut)".to_owned(), - (MemoryKind::Static, Mutability::Immutable) => " (immutable)".to_owned(), - (MemoryKind::Machine(m), _) => format!(" ({:?})", m), - (MemoryKind::Stack, _) => " (stack)".to_owned(), - }; - trace!( - "{}({} bytes, alignment {}){}", - msg, - alloc.bytes.len(), - alloc.align, - immutable - ); - - if !relocations.is_empty() { - msg.clear(); - write!(msg, "{:1$}", "", prefix_len).unwrap(); // Print spaces. - let mut pos = 0; - let relocation_width = (self.pointer_size() - 1) * 3; - for (i, target_id) in relocations { - // this `as usize` is fine, since we can't print more chars than `usize::MAX` - write!(msg, "{:1$}", "", ((i - pos) * 3) as usize).unwrap(); - let target = format!("({})", target_id); - // this `as usize` is fine, since we can't print more chars than `usize::MAX` - write!(msg, "└{0:─^1$}┘ ", target, relocation_width as usize).unwrap(); - pos = i + self.pointer_size(); - } - trace!("{}", msg); - } - } - } - - pub fn leak_report(&self) -> usize { - trace!("### LEAK REPORT ###"); - let leaks: Vec<_> = self.alloc_map - .iter() - .filter_map(|(&key, val)| if val.kind != MemoryKind::Static { - Some(AllocIdKind::Runtime(key).into_alloc_id()) - } else { - None - }) - .collect(); - let n = leaks.len(); - self.dump_allocs(leaks); - n - } -} - -/// Byte accessors -impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> { - fn get_bytes_unchecked( - &self, - ptr: MemoryPointer, - size: u64, - align: u64, - ) -> EvalResult<'tcx, &[u8]> { - // Zero-sized accesses can use dangling pointers, but they still have to be aligned and non-NULL - self.check_align(ptr.into(), align, Some(AccessKind::Read))?; - if size == 0 { - return Ok(&[]); - } - self.check_locks(ptr, size, AccessKind::Read)?; - self.check_bounds(ptr.offset(size, self)?, true)?; // if ptr.offset is in bounds, then so is ptr (because offset checks for overflow) - let alloc = self.get(ptr.alloc_id)?; - assert_eq!(ptr.offset as usize as u64, ptr.offset); - assert_eq!(size as usize as u64, size); - let offset = ptr.offset as usize; - Ok(&alloc.bytes[offset..offset + size as usize]) - } - - fn get_bytes_unchecked_mut( - &mut self, - ptr: MemoryPointer, - size: u64, - align: u64, - ) -> EvalResult<'tcx, &mut [u8]> { - // Zero-sized accesses can use dangling pointers, but they still have to be aligned and non-NULL - self.check_align(ptr.into(), align, Some(AccessKind::Write))?; - if size == 0 { - return Ok(&mut []); - } - self.check_locks(ptr, size, AccessKind::Write)?; - self.check_bounds(ptr.offset(size, self.layout)?, true)?; // if ptr.offset is in bounds, then so is ptr (because offset checks for overflow) - let alloc = self.get_mut(ptr.alloc_id)?; - assert_eq!(ptr.offset as usize as u64, ptr.offset); - assert_eq!(size as usize as u64, size); - let offset = ptr.offset as usize; - Ok(&mut alloc.bytes[offset..offset + size as usize]) - } - - fn get_bytes(&self, ptr: MemoryPointer, size: u64, align: u64) -> EvalResult<'tcx, &[u8]> { - assert_ne!(size, 0); - if self.relocations(ptr, size)?.count() != 0 { - return err!(ReadPointerAsBytes); - } - self.check_defined(ptr, size)?; - self.get_bytes_unchecked(ptr, size, align) - } - - fn get_bytes_mut( - &mut self, - ptr: MemoryPointer, - size: u64, - align: u64, - ) -> EvalResult<'tcx, &mut [u8]> { - assert_ne!(size, 0); - self.clear_relocations(ptr, size)?; - self.mark_definedness(ptr.into(), size, true)?; - self.get_bytes_unchecked_mut(ptr, size, align) - } -} - -/// Reading and writing -impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> { - /// mark an allocation pointed to by a static as static and initialized - fn mark_inner_allocation_initialized( - &mut self, - alloc: AllocId, - mutability: Mutability, - ) -> EvalResult<'tcx> { - // relocations into other statics are not "inner allocations" - if self.get(alloc).ok().map_or(false, |alloc| { - alloc.kind != MemoryKind::UninitializedStatic - }) - { - self.mark_static_initalized(alloc, mutability)?; - } - Ok(()) - } - - /// mark an allocation as static and initialized, either mutable or not - pub fn mark_static_initalized( - &mut self, - alloc_id: AllocId, - mutability: Mutability, - ) -> EvalResult<'tcx> { - trace!( - "mark_static_initalized {:?}, mutability: {:?}", - alloc_id, - mutability - ); - // do not use `self.get_mut(alloc_id)` here, because we might have already marked a - // sub-element or have circular pointers (e.g. `Rc`-cycles) - let alloc_id = match alloc_id.into_alloc_id_kind() { - AllocIdKind::Function(_) => return Ok(()), - AllocIdKind::Runtime(id) => id, - }; - let relocations = match self.alloc_map.get_mut(&alloc_id) { - Some(&mut Allocation { - ref mut relocations, - ref mut kind, - ref mut mutable, - .. - }) => { - match *kind { - // const eval results can refer to "locals". - // E.g. `const Foo: &u32 = &1;` refers to the temp local that stores the `1` - MemoryKind::Stack | - // The entire point of this function - MemoryKind::UninitializedStatic => {}, - MemoryKind::Machine(m) => M::mark_static_initialized(m)?, - MemoryKind::Static => { - trace!("mark_static_initalized: skipping already initialized static referred to by static currently being initialized"); - return Ok(()); - }, - } - *kind = MemoryKind::Static; - *mutable = mutability; - // take out the relocations vector to free the borrow on self, so we can call - // mark recursively - mem::replace(relocations, Default::default()) - } - None => return err!(DanglingPointerDeref), - }; - // recurse into inner allocations - for &alloc in relocations.values() { - self.mark_inner_allocation_initialized(alloc, mutability)?; - } - // put back the relocations - self.alloc_map - .get_mut(&alloc_id) - .expect("checked above") - .relocations = relocations; - Ok(()) - } - - pub fn copy( - &mut self, - src: Pointer, - dest: Pointer, - size: u64, - align: u64, - nonoverlapping: bool, - ) -> EvalResult<'tcx> { - // Empty accesses don't need to be valid pointers, but they should still be aligned - self.check_align(src, align, Some(AccessKind::Read))?; - self.check_align(dest, align, Some(AccessKind::Write))?; - if size == 0 { - return Ok(()); - } - let src = src.to_ptr()?; - let dest = dest.to_ptr()?; - self.check_relocation_edges(src, size)?; - - // first copy the relocations to a temporary buffer, because - // `get_bytes_mut` will clear the relocations, which is correct, - // since we don't want to keep any relocations at the target. - - let relocations: Vec<_> = self.relocations(src, size)? - .map(|(&offset, &alloc_id)| { - // Update relocation offsets for the new positions in the destination allocation. - (offset + dest.offset - src.offset, alloc_id) - }) - .collect(); - - let src_bytes = self.get_bytes_unchecked(src, size, align)?.as_ptr(); - let dest_bytes = self.get_bytes_mut(dest, size, align)?.as_mut_ptr(); - - // SAFE: The above indexing would have panicked if there weren't at least `size` bytes - // behind `src` and `dest`. Also, we use the overlapping-safe `ptr::copy` if `src` and - // `dest` could possibly overlap. - unsafe { - assert_eq!(size as usize as u64, size); - if src.alloc_id == dest.alloc_id { - if nonoverlapping { - if (src.offset <= dest.offset && src.offset + size > dest.offset) || - (dest.offset <= src.offset && dest.offset + size > src.offset) - { - return err!(Intrinsic( - format!("copy_nonoverlapping called on overlapping ranges"), - )); - } - } - ptr::copy(src_bytes, dest_bytes, size as usize); - } else { - ptr::copy_nonoverlapping(src_bytes, dest_bytes, size as usize); - } - } - - self.copy_undef_mask(src, dest, size)?; - // copy back the relocations - self.get_mut(dest.alloc_id)?.relocations.extend(relocations); - - Ok(()) - } - - pub fn read_c_str(&self, ptr: MemoryPointer) -> EvalResult<'tcx, &[u8]> { - let alloc = self.get(ptr.alloc_id)?; - assert_eq!(ptr.offset as usize as u64, ptr.offset); - let offset = ptr.offset as usize; - match alloc.bytes[offset..].iter().position(|&c| c == 0) { - Some(size) => { - if self.relocations(ptr, (size + 1) as u64)?.count() != 0 { - return err!(ReadPointerAsBytes); - } - self.check_defined(ptr, (size + 1) as u64)?; - self.check_locks(ptr, (size + 1) as u64, AccessKind::Read)?; - Ok(&alloc.bytes[offset..offset + size]) - } - None => err!(UnterminatedCString(ptr)), - } - } - - pub fn read_bytes(&self, ptr: Pointer, size: u64) -> EvalResult<'tcx, &[u8]> { - // Empty accesses don't need to be valid pointers, but they should still be non-NULL - self.check_align(ptr, 1, Some(AccessKind::Read))?; - if size == 0 { - return Ok(&[]); - } - self.get_bytes(ptr.to_ptr()?, size, 1) - } - - pub fn write_bytes(&mut self, ptr: Pointer, src: &[u8]) -> EvalResult<'tcx> { - // Empty accesses don't need to be valid pointers, but they should still be non-NULL - self.check_align(ptr, 1, Some(AccessKind::Write))?; - if src.is_empty() { - return Ok(()); - } - let bytes = self.get_bytes_mut(ptr.to_ptr()?, src.len() as u64, 1)?; - bytes.clone_from_slice(src); - Ok(()) - } - - pub fn write_repeat(&mut self, ptr: Pointer, val: u8, count: u64) -> EvalResult<'tcx> { - // Empty accesses don't need to be valid pointers, but they should still be non-NULL - self.check_align(ptr, 1, Some(AccessKind::Write))?; - if count == 0 { - return Ok(()); - } - let bytes = self.get_bytes_mut(ptr.to_ptr()?, count, 1)?; - for b in bytes { - *b = val; - } - Ok(()) - } - - pub fn read_primval(&self, ptr: MemoryPointer, size: u64, signed: bool) -> EvalResult<'tcx, PrimVal> { - self.check_relocation_edges(ptr, size)?; // Make sure we don't read part of a pointer as a pointer - let endianess = self.endianess(); - let bytes = self.get_bytes_unchecked(ptr, size, self.int_align(size))?; - // Undef check happens *after* we established that the alignment is correct. - // We must not return Ok() for unaligned pointers! - if self.check_defined(ptr, size).is_err() { - return Ok(PrimVal::Undef.into()); - } - // Now we do the actual reading - let bytes = if signed { - read_target_int(endianess, bytes).unwrap() as u128 - } else { - read_target_uint(endianess, bytes).unwrap() - }; - // See if we got a pointer - if size != self.pointer_size() { - if self.relocations(ptr, size)?.count() != 0 { - return err!(ReadPointerAsBytes); - } - } else { - let alloc = self.get(ptr.alloc_id)?; - match alloc.relocations.get(&ptr.offset) { - Some(&alloc_id) => return Ok(PrimVal::Ptr(MemoryPointer::new(alloc_id, bytes as u64))), - None => {}, - } - } - // We don't. Just return the bytes. - Ok(PrimVal::Bytes(bytes)) - } - - pub fn read_ptr_sized_unsigned(&self, ptr: MemoryPointer) -> EvalResult<'tcx, PrimVal> { - self.read_primval(ptr, self.pointer_size(), false) - } - - pub fn write_primval(&mut self, ptr: MemoryPointer, val: PrimVal, size: u64, signed: bool) -> EvalResult<'tcx> { - let endianess = self.endianess(); - - let bytes = match val { - PrimVal::Ptr(val) => { - assert_eq!(size, self.pointer_size()); - val.offset as u128 - } - - PrimVal::Bytes(bytes) => { - // We need to mask here, or the byteorder crate can die when given a u64 larger - // than fits in an integer of the requested size. - let mask = match size { - 1 => !0u8 as u128, - 2 => !0u16 as u128, - 4 => !0u32 as u128, - 8 => !0u64 as u128, - 16 => !0, - n => bug!("unexpected PrimVal::Bytes size: {}", n), - }; - bytes & mask - } - - PrimVal::Undef => { - self.mark_definedness(PrimVal::Ptr(ptr).into(), size, false)?; - return Ok(()); - } - }; - - { - let align = self.int_align(size); - let dst = self.get_bytes_mut(ptr, size, align)?; - if signed { - write_target_int(endianess, dst, bytes as i128).unwrap(); - } else { - write_target_uint(endianess, dst, bytes).unwrap(); - } - } - - // See if we have to also write a relocation - match val { - PrimVal::Ptr(val) => { - self.get_mut(ptr.alloc_id)?.relocations.insert( - ptr.offset, - val.alloc_id, - ); - } - _ => {} - } - - Ok(()) - } - - pub fn write_ptr_sized_unsigned(&mut self, ptr: MemoryPointer, val: PrimVal) -> EvalResult<'tcx> { - let ptr_size = self.pointer_size(); - self.write_primval(ptr, val, ptr_size, false) - } - - fn int_align(&self, size: u64) -> u64 { - // We assume pointer-sized integers have the same alignment as pointers. - // We also assume signed and unsigned integers of the same size have the same alignment. - match size { - 1 => self.layout.i8_align.abi(), - 2 => self.layout.i16_align.abi(), - 4 => self.layout.i32_align.abi(), - 8 => self.layout.i64_align.abi(), - 16 => self.layout.i128_align.abi(), - _ => bug!("bad integer size: {}", size), - } - } -} - -/// Relocations -impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> { - fn relocations( - &self, - ptr: MemoryPointer, - size: u64, - ) -> EvalResult<'tcx, btree_map::Range<u64, AllocId>> { - let start = ptr.offset.saturating_sub(self.pointer_size() - 1); - let end = ptr.offset + size; - Ok(self.get(ptr.alloc_id)?.relocations.range(start..end)) - } - - fn clear_relocations(&mut self, ptr: MemoryPointer, size: u64) -> EvalResult<'tcx> { - // Find all relocations overlapping the given range. - let keys: Vec<_> = self.relocations(ptr, size)?.map(|(&k, _)| k).collect(); - if keys.is_empty() { - return Ok(()); - } - - // Find the start and end of the given range and its outermost relocations. - let start = ptr.offset; - let end = start + size; - let first = *keys.first().unwrap(); - let last = *keys.last().unwrap() + self.pointer_size(); - - let alloc = self.get_mut(ptr.alloc_id)?; - - // Mark parts of the outermost relocations as undefined if they partially fall outside the - // given range. - if first < start { - alloc.undef_mask.set_range(first, start, false); - } - if last > end { - alloc.undef_mask.set_range(end, last, false); - } - - // Forget all the relocations. - for k in keys { - alloc.relocations.remove(&k); - } - - Ok(()) - } - - fn check_relocation_edges(&self, ptr: MemoryPointer, size: u64) -> EvalResult<'tcx> { - let overlapping_start = self.relocations(ptr, 0)?.count(); - let overlapping_end = self.relocations(ptr.offset(size, self.layout)?, 0)?.count(); - if overlapping_start + overlapping_end != 0 { - return err!(ReadPointerAsBytes); - } - Ok(()) - } -} - -/// Undefined bytes -impl<'a, 'tcx, M: Machine<'tcx>> Memory<'a, 'tcx, M> { - // FIXME(solson): This is a very naive, slow version. - fn copy_undef_mask( - &mut self, - src: MemoryPointer, - dest: MemoryPointer, - size: u64, - ) -> EvalResult<'tcx> { - // The bits have to be saved locally before writing to dest in case src and dest overlap. - assert_eq!(size as usize as u64, size); - let mut v = Vec::with_capacity(size as usize); - for i in 0..size { - let defined = self.get(src.alloc_id)?.undef_mask.get(src.offset + i); - v.push(defined); - } - for (i, defined) in v.into_iter().enumerate() { - self.get_mut(dest.alloc_id)?.undef_mask.set( - dest.offset + - i as u64, - defined, - ); - } - Ok(()) - } - - fn check_defined(&self, ptr: MemoryPointer, size: u64) -> EvalResult<'tcx> { - let alloc = self.get(ptr.alloc_id)?; - if !alloc.undef_mask.is_range_defined( - ptr.offset, - ptr.offset + size, - ) - { - return err!(ReadUndefBytes); - } - Ok(()) - } - - pub fn mark_definedness( - &mut self, - ptr: Pointer, - size: u64, - new_state: bool, - ) -> EvalResult<'tcx> { - if size == 0 { - return Ok(()); - } - let ptr = ptr.to_ptr()?; - let alloc = self.get_mut(ptr.alloc_id)?; - alloc.undef_mask.set_range( - ptr.offset, - ptr.offset + size, - new_state, - ); - Ok(()) - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Methods to access integers in the target endianess -//////////////////////////////////////////////////////////////////////////////// - -fn write_target_uint( - endianess: layout::Endian, - mut target: &mut [u8], - data: u128, -) -> Result<(), io::Error> { - let len = target.len(); - match endianess { - layout::Endian::Little => target.write_uint128::<LittleEndian>(data, len), - layout::Endian::Big => target.write_uint128::<BigEndian>(data, len), - } -} -fn write_target_int( - endianess: layout::Endian, - mut target: &mut [u8], - data: i128, -) -> Result<(), io::Error> { - let len = target.len(); - match endianess { - layout::Endian::Little => target.write_int128::<LittleEndian>(data, len), - layout::Endian::Big => target.write_int128::<BigEndian>(data, len), - } -} - -fn read_target_uint(endianess: layout::Endian, mut source: &[u8]) -> Result<u128, io::Error> { - match endianess { - layout::Endian::Little => source.read_uint128::<LittleEndian>(source.len()), - layout::Endian::Big => source.read_uint128::<BigEndian>(source.len()), - } -} - -fn read_target_int(endianess: layout::Endian, mut source: &[u8]) -> Result<i128, io::Error> { - match endianess { - layout::Endian::Little => source.read_int128::<LittleEndian>(source.len()), - layout::Endian::Big => source.read_int128::<BigEndian>(source.len()), - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Undefined byte tracking -//////////////////////////////////////////////////////////////////////////////// - -type Block = u64; -const BLOCK_SIZE: u64 = 64; - -#[derive(Clone, Debug)] -pub struct UndefMask { - blocks: Vec<Block>, - len: u64, -} - -impl UndefMask { - fn new(size: u64) -> Self { - let mut m = UndefMask { - blocks: vec![], - len: 0, - }; - m.grow(size, false); - m - } - - /// Check whether the range `start..end` (end-exclusive) is entirely defined. - pub fn is_range_defined(&self, start: u64, end: u64) -> bool { - if end > self.len { - return false; - } - for i in start..end { - if !self.get(i) { - return false; - } - } - true - } - - fn set_range(&mut self, start: u64, end: u64, new_state: bool) { - let len = self.len; - if end > len { - self.grow(end - len, new_state); - } - self.set_range_inbounds(start, end, new_state); - } - - fn set_range_inbounds(&mut self, start: u64, end: u64, new_state: bool) { - for i in start..end { - self.set(i, new_state); - } - } - - fn get(&self, i: u64) -> bool { - let (block, bit) = bit_index(i); - (self.blocks[block] & 1 << bit) != 0 - } - - fn set(&mut self, i: u64, new_state: bool) { - let (block, bit) = bit_index(i); - if new_state { - self.blocks[block] |= 1 << bit; - } else { - self.blocks[block] &= !(1 << bit); - } - } - - fn grow(&mut self, amount: u64, new_state: bool) { - let unused_trailing_bits = self.blocks.len() as u64 * BLOCK_SIZE - self.len; - if amount > unused_trailing_bits { - let additional_blocks = amount / BLOCK_SIZE + 1; - assert_eq!(additional_blocks as usize as u64, additional_blocks); - self.blocks.extend( - iter::repeat(0).take(additional_blocks as usize), - ); - } - let start = self.len; - self.len += amount; - self.set_range_inbounds(start, start + amount, new_state); - } -} - -fn bit_index(bits: u64) -> (usize, usize) { - let a = bits / BLOCK_SIZE; - let b = bits % BLOCK_SIZE; - assert_eq!(a as usize as u64, a); - assert_eq!(b as usize as u64, b); - (a as usize, b as usize) -} - -//////////////////////////////////////////////////////////////////////////////// -// Unaligned accesses -//////////////////////////////////////////////////////////////////////////////// - -pub trait HasMemory<'a, 'tcx, M: Machine<'tcx>> { - fn memory_mut(&mut self) -> &mut Memory<'a, 'tcx, M>; - fn memory(&self) -> &Memory<'a, 'tcx, M>; - - // These are not supposed to be overriden. - fn read_maybe_aligned<F, T>(&self, aligned: bool, f: F) -> EvalResult<'tcx, T> - where - F: FnOnce(&Self) -> EvalResult<'tcx, T>, - { - let old = self.memory().reads_are_aligned.get(); - // Do alignment checking if *all* nested calls say it has to be aligned. - self.memory().reads_are_aligned.set(old && aligned); - let t = f(self); - self.memory().reads_are_aligned.set(old); - t - } - - fn read_maybe_aligned_mut<F, T>(&mut self, aligned: bool, f: F) -> EvalResult<'tcx, T> - where - F: FnOnce(&mut Self) -> EvalResult<'tcx, T>, - { - let old = self.memory().reads_are_aligned.get(); - // Do alignment checking if *all* nested calls say it has to be aligned. - self.memory().reads_are_aligned.set(old && aligned); - let t = f(self); - self.memory().reads_are_aligned.set(old); - t - } - - fn write_maybe_aligned_mut<F, T>(&mut self, aligned: bool, f: F) -> EvalResult<'tcx, T> - where - F: FnOnce(&mut Self) -> EvalResult<'tcx, T>, - { - let old = self.memory().writes_are_aligned.get(); - // Do alignment checking if *all* nested calls say it has to be aligned. - self.memory().writes_are_aligned.set(old && aligned); - let t = f(self); - self.memory().writes_are_aligned.set(old); - t - } -} - -impl<'a, 'tcx, M: Machine<'tcx>> HasMemory<'a, 'tcx, M> for Memory<'a, 'tcx, M> { - #[inline] - fn memory_mut(&mut self) -> &mut Memory<'a, 'tcx, M> { - self - } - - #[inline] - fn memory(&self) -> &Memory<'a, 'tcx, M> { - self - } -} - -impl<'a, 'tcx, M: Machine<'tcx>> HasMemory<'a, 'tcx, M> for EvalContext<'a, 'tcx, M> { - #[inline] - fn memory_mut(&mut self) -> &mut Memory<'a, 'tcx, M> { - &mut self.memory - } - - #[inline] - fn memory(&self) -> &Memory<'a, 'tcx, M> { - &self.memory - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Pointer arithmetic -//////////////////////////////////////////////////////////////////////////////// - -pub trait PointerArithmetic: layout::HasDataLayout { - // These are not supposed to be overriden. - - //// Trunace the given value to the pointer size; also return whether there was an overflow - fn truncate_to_ptr(self, val: u128) -> (u64, bool) { - let max_ptr_plus_1 = 1u128 << self.data_layout().pointer_size.bits(); - ((val % max_ptr_plus_1) as u64, val >= max_ptr_plus_1) - } - - // Overflow checking only works properly on the range from -u64 to +u64. - fn overflowing_signed_offset(self, val: u64, i: i128) -> (u64, bool) { - // FIXME: is it possible to over/underflow here? - if i < 0 { - // trickery to ensure that i64::min_value() works fine - // this formula only works for true negative values, it panics for zero! - let n = u64::max_value() - (i as u64) + 1; - val.overflowing_sub(n) - } else { - self.overflowing_offset(val, i as u64) - } - } - - fn overflowing_offset(self, val: u64, i: u64) -> (u64, bool) { - let (res, over1) = val.overflowing_add(i); - let (res, over2) = self.truncate_to_ptr(res as u128); - (res, over1 || over2) - } - - fn signed_offset<'tcx>(self, val: u64, i: i64) -> EvalResult<'tcx, u64> { - let (res, over) = self.overflowing_signed_offset(val, i as i128); - if over { err!(OverflowingMath) } else { Ok(res) } - } - - fn offset<'tcx>(self, val: u64, i: u64) -> EvalResult<'tcx, u64> { - let (res, over) = self.overflowing_offset(val, i); - if over { err!(OverflowingMath) } else { Ok(res) } - } - - fn wrapping_signed_offset(self, val: u64, i: i64) -> u64 { - self.overflowing_signed_offset(val, i as i128).0 - } -} - -impl<T: layout::HasDataLayout> PointerArithmetic for T {} - -impl<'a, 'tcx, M: Machine<'tcx>> layout::HasDataLayout for &'a Memory<'a, 'tcx, M> { - #[inline] - fn data_layout(&self) -> &TargetDataLayout { - self.layout - } -} -impl<'a, 'tcx, M: Machine<'tcx>> layout::HasDataLayout for &'a EvalContext<'a, 'tcx, M> { - #[inline] - fn data_layout(&self) -> &TargetDataLayout { - self.memory().layout - } -} - -impl<'c, 'b, 'a, 'tcx, M: Machine<'tcx>> layout::HasDataLayout - for &'c &'b mut EvalContext<'a, 'tcx, M> { - #[inline] - fn data_layout(&self) -> &TargetDataLayout { - self.memory().layout - } -} diff --git a/src/tools/miri/src/librustc_mir/interpret/mod.rs b/src/tools/miri/src/librustc_mir/interpret/mod.rs deleted file mode 100644 index 08837c4fb6..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/mod.rs +++ /dev/null @@ -1,42 +0,0 @@ -//! An interpreter for MIR used in CTFE and by miri - -#[macro_export] -macro_rules! err { - ($($tt:tt)*) => { Err($crate::interpret::EvalErrorKind::$($tt)*.into()) }; -} - -mod cast; -mod const_eval; -mod error; -mod eval_context; -mod lvalue; -mod validation; -mod machine; -mod memory; -mod operator; -mod range_map; -mod step; -mod terminator; -mod traits; -mod value; - -pub use self::error::{EvalError, EvalResult, EvalErrorKind}; - -pub use self::eval_context::{EvalContext, Frame, ResourceLimits, StackPopCleanup, DynamicLifetime, - TyAndPacked, PtrAndAlign, ValTy}; - -pub use self::lvalue::{Lvalue, LvalueExtra, GlobalId}; - -pub use self::memory::{AllocId, Memory, MemoryPointer, MemoryKind, HasMemory, AccessKind, AllocIdKind}; - -use self::memory::{PointerArithmetic, Lock}; - -use self::range_map::RangeMap; - -pub use self::value::{PrimVal, PrimValKind, Value, Pointer}; - -pub use self::const_eval::{eval_body_as_integer, eval_body_as_primval}; - -pub use self::machine::Machine; - -pub use self::validation::{ValidationQuery, AbsLvalue}; diff --git a/src/tools/miri/src/librustc_mir/interpret/range_map.rs b/src/tools/miri/src/librustc_mir/interpret/range_map.rs deleted file mode 100644 index 5cdcbe3512..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/range_map.rs +++ /dev/null @@ -1,250 +0,0 @@ -//! Implements a map from integer indices to data. -//! Rather than storing data for every index, internally, this maps entire ranges to the data. -//! To this end, the APIs all work on ranges, not on individual integers. Ranges are split as -//! necessary (e.g. when [0,5) is first associated with X, and then [1,2) is mutated). -//! Users must not depend on whether a range is coalesced or not, even though this is observable -//! via the iteration APIs. -use std::collections::BTreeMap; -use std::ops; - -#[derive(Clone, Debug)] -pub struct RangeMap<T> { - map: BTreeMap<Range, T>, -} - -// The derived `Ord` impl sorts first by the first field, then, if the fields are the same, -// by the second field. -// This is exactly what we need for our purposes, since a range query on a BTReeSet/BTreeMap will give us all -// `MemoryRange`s whose `start` is <= than the one we're looking for, but not > the end of the range we're checking. -// At the same time the `end` is irrelevant for the sorting and range searching, but used for the check. -// This kind of search breaks, if `end < start`, so don't do that! -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug)] -struct Range { - start: u64, - end: u64, // Invariant: end > start -} - -impl Range { - fn range(offset: u64, len: u64) -> ops::Range<Range> { - assert!(len > 0); - // We select all elements that are within - // the range given by the offset into the allocation and the length. - // This is sound if all ranges that intersect with the argument range, are in the - // resulting range of ranges. - let left = Range { - // lowest range to include `offset` - start: 0, - end: offset + 1, - }; - let right = Range { - // lowest (valid) range not to include `offset+len` - start: offset + len, - end: offset + len + 1, - }; - left..right - } - - /// Tests if all of [offset, offset+len) are contained in this range. - fn overlaps(&self, offset: u64, len: u64) -> bool { - assert!(len > 0); - offset < self.end && offset + len >= self.start - } -} - -impl<T> RangeMap<T> { - pub fn new() -> RangeMap<T> { - RangeMap { map: BTreeMap::new() } - } - - fn iter_with_range<'a>( - &'a self, - offset: u64, - len: u64, - ) -> impl Iterator<Item = (&'a Range, &'a T)> + 'a { - assert!(len > 0); - self.map.range(Range::range(offset, len)).filter_map( - move |(range, - data)| { - if range.overlaps(offset, len) { - Some((range, data)) - } else { - None - } - }, - ) - } - - pub fn iter<'a>(&'a self, offset: u64, len: u64) -> impl Iterator<Item = &'a T> + 'a { - self.iter_with_range(offset, len).map(|(_, data)| data) - } - - fn split_entry_at(&mut self, offset: u64) - where - T: Clone, - { - let range = match self.iter_with_range(offset, 1).next() { - Some((&range, _)) => range, - None => return, - }; - assert!( - range.start <= offset && range.end > offset, - "We got a range that doesn't even contain what we asked for." - ); - // There is an entry overlapping this position, see if we have to split it - if range.start < offset { - let data = self.map.remove(&range).unwrap(); - let old = self.map.insert( - Range { - start: range.start, - end: offset, - }, - data.clone(), - ); - assert!(old.is_none()); - let old = self.map.insert( - Range { - start: offset, - end: range.end, - }, - data, - ); - assert!(old.is_none()); - } - } - - pub fn iter_mut_all<'a>(&'a mut self) -> impl Iterator<Item = &'a mut T> + 'a { - self.map.values_mut() - } - - /// Provide mutable iteration over everything in the given range. As a side-effect, - /// this will split entries in the map that are only partially hit by the given range, - /// to make sure that when they are mutated, the effect is constrained to the given range. - pub fn iter_mut_with_gaps<'a>( - &'a mut self, - offset: u64, - len: u64, - ) -> impl Iterator<Item = &'a mut T> + 'a - where - T: Clone, - { - assert!(len > 0); - // Preparation: Split first and last entry as needed. - self.split_entry_at(offset); - self.split_entry_at(offset + len); - // Now we can provide a mutable iterator - self.map.range_mut(Range::range(offset, len)).filter_map( - move |(&range, data)| { - if range.overlaps(offset, len) { - assert!( - offset <= range.start && offset + len >= range.end, - "The splitting went wrong" - ); - Some(data) - } else { - // Skip this one - None - } - }, - ) - } - - /// Provide a mutable iterator over everything in the given range, with the same side-effects as - /// iter_mut_with_gaps. Furthermore, if there are gaps between ranges, fill them with the given default. - /// This is also how you insert. - pub fn iter_mut<'a>(&'a mut self, offset: u64, len: u64) -> impl Iterator<Item = &'a mut T> + 'a - where - T: Clone + Default, - { - // Do a first iteration to collect the gaps - let mut gaps = Vec::new(); - let mut last_end = offset; - for (range, _) in self.iter_with_range(offset, len) { - if last_end < range.start { - gaps.push(Range { - start: last_end, - end: range.start, - }); - } - last_end = range.end; - } - if last_end < offset + len { - gaps.push(Range { - start: last_end, - end: offset + len, - }); - } - - // Add default for all gaps - for gap in gaps { - let old = self.map.insert(gap, Default::default()); - assert!(old.is_none()); - } - - // Now provide mutable iteration - self.iter_mut_with_gaps(offset, len) - } - - pub fn retain<F>(&mut self, mut f: F) - where - F: FnMut(&T) -> bool, - { - let mut remove = Vec::new(); - for (range, data) in self.map.iter() { - if !f(data) { - remove.push(*range); - } - } - - for range in remove { - self.map.remove(&range); - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - /// Query the map at every offset in the range and collect the results. - fn to_vec<T: Copy>(map: &RangeMap<T>, offset: u64, len: u64) -> Vec<T> { - (offset..offset + len) - .into_iter() - .map(|i| *map.iter(i, 1).next().unwrap()) - .collect() - } - - #[test] - fn basic_insert() { - let mut map = RangeMap::<i32>::new(); - // Insert - for x in map.iter_mut(10, 1) { - *x = 42; - } - // Check - assert_eq!(to_vec(&map, 10, 1), vec![42]); - } - - #[test] - fn gaps() { - let mut map = RangeMap::<i32>::new(); - for x in map.iter_mut(11, 1) { - *x = 42; - } - for x in map.iter_mut(15, 1) { - *x = 42; - } - - // Now request a range that needs three gaps filled - for x in map.iter_mut(10, 10) { - if *x != 42 { - *x = 23; - } - } - - assert_eq!( - to_vec(&map, 10, 10), - vec![23, 42, 23, 23, 23, 42, 23, 23, 23, 23] - ); - assert_eq!(to_vec(&map, 13, 5), vec![23, 23, 42, 23, 23]); - } -} diff --git a/src/tools/miri/src/librustc_mir/interpret/step.rs b/src/tools/miri/src/librustc_mir/interpret/step.rs deleted file mode 100644 index 1f53870752..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/step.rs +++ /dev/null @@ -1,397 +0,0 @@ -//! This module contains the `EvalContext` methods for executing a single step of the interpreter. -//! -//! The main entry point is the `step` method. - -use rustc::hir::def_id::DefId; -use rustc::hir; -use rustc::mir::visit::{Visitor, LvalueContext}; -use rustc::mir; -use rustc::traits::Reveal; -use rustc::ty; -use rustc::ty::layout::Layout; -use rustc::ty::subst::Substs; -use rustc::middle::const_val::ConstVal; - -use super::{EvalResult, EvalContext, StackPopCleanup, PtrAndAlign, GlobalId, Lvalue, - MemoryKind, Machine, PrimVal}; - -use syntax::codemap::Span; -use syntax::ast::Mutability; - -impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> { - pub fn inc_step_counter_and_check_limit(&mut self, n: u64) -> EvalResult<'tcx> { - self.steps_remaining = self.steps_remaining.saturating_sub(n); - if self.steps_remaining > 0 { - Ok(()) - } else { - err!(ExecutionTimeLimitReached) - } - } - - /// Returns true as long as there are more things to do. - pub fn step(&mut self) -> EvalResult<'tcx, bool> { - self.inc_step_counter_and_check_limit(1)?; - if self.stack.is_empty() { - return Ok(false); - } - - let block = self.frame().block; - let stmt_id = self.frame().stmt; - let mir = self.mir(); - let basic_block = &mir.basic_blocks()[block]; - - if let Some(stmt) = basic_block.statements.get(stmt_id) { - let mut new = Ok(0); - ConstantExtractor { - span: stmt.source_info.span, - instance: self.frame().instance, - ecx: self, - mir, - new_constants: &mut new, - }.visit_statement( - block, - stmt, - mir::Location { - block, - statement_index: stmt_id, - }, - ); - // if ConstantExtractor added new frames, we don't execute anything here - // but await the next call to step - if new? == 0 { - self.statement(stmt)?; - } - return Ok(true); - } - - let terminator = basic_block.terminator(); - let mut new = Ok(0); - ConstantExtractor { - span: terminator.source_info.span, - instance: self.frame().instance, - ecx: self, - mir, - new_constants: &mut new, - }.visit_terminator( - block, - terminator, - mir::Location { - block, - statement_index: stmt_id, - }, - ); - // if ConstantExtractor added new frames, we don't execute anything here - // but await the next call to step - if new? == 0 { - self.terminator(terminator)?; - } - Ok(true) - } - - fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> EvalResult<'tcx> { - trace!("{:?}", stmt); - - use rustc::mir::StatementKind::*; - match stmt.kind { - Assign(ref lvalue, ref rvalue) => self.eval_rvalue_into_lvalue(rvalue, lvalue)?, - - SetDiscriminant { - ref lvalue, - variant_index, - } => { - let dest = self.eval_lvalue(lvalue)?; - let dest_ty = self.lvalue_ty(lvalue); - let dest_layout = self.type_layout(dest_ty)?; - - match *dest_layout { - Layout::General { discr, .. } => { - let discr_size = discr.size().bytes(); - let dest_ptr = self.force_allocation(dest)?.to_ptr()?; - self.memory.write_primval( - dest_ptr, - PrimVal::Bytes(variant_index as u128), - discr_size, - false - )? - } - - Layout::RawNullablePointer { nndiscr, .. } => { - if variant_index as u64 != nndiscr { - self.write_null(dest, dest_ty)?; - } - } - - Layout::StructWrappedNullablePointer { - nndiscr, - ref discrfield_source, - .. - } => { - if variant_index as u64 != nndiscr { - self.write_struct_wrapped_null_pointer( - dest_ty, - nndiscr, - discrfield_source, - dest, - )?; - } - } - - _ => { - bug!( - "SetDiscriminant on {} represented as {:#?}", - dest_ty, - dest_layout - ) - } - } - } - - // Mark locals as alive - StorageLive(local) => { - let old_val = self.frame_mut().storage_live(local)?; - self.deallocate_local(old_val)?; - } - - // Mark locals as dead - StorageDead(local) => { - let old_val = self.frame_mut().storage_dead(local)?; - self.deallocate_local(old_val)?; - } - - // Validity checks. - Validate(op, ref lvalues) => { - for operand in lvalues { - self.validation_op(op, operand)?; - } - } - EndRegion(ce) => { - self.end_region(Some(ce))?; - } - - // Defined to do nothing. These are added by optimization passes, to avoid changing the - // size of MIR constantly. - Nop => {} - - InlineAsm { .. } => return err!(InlineAsm), - } - - self.frame_mut().stmt += 1; - Ok(()) - } - - fn terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> EvalResult<'tcx> { - trace!("{:?}", terminator.kind); - self.eval_terminator(terminator)?; - if !self.stack.is_empty() { - trace!("// {:?}", self.frame().block); - } - Ok(()) - } - - /// returns `true` if a stackframe was pushed - fn global_item( - &mut self, - def_id: DefId, - substs: &'tcx Substs<'tcx>, - span: Span, - mutability: Mutability, - ) -> EvalResult<'tcx, bool> { - let instance = self.resolve_associated_const(def_id, substs); - let cid = GlobalId { - instance, - promoted: None, - }; - if self.globals.contains_key(&cid) { - return Ok(false); - } - if self.tcx.has_attr(def_id, "linkage") { - M::global_item_with_linkage(self, cid.instance, mutability)?; - return Ok(false); - } - let mir = self.load_mir(instance.def)?; - let size = self.type_size_with_substs(mir.return_ty, substs)?.expect( - "unsized global", - ); - let align = self.type_align_with_substs(mir.return_ty, substs)?; - let ptr = self.memory.allocate( - size, - align, - MemoryKind::UninitializedStatic, - )?; - let aligned = !self.is_packed(mir.return_ty)?; - self.globals.insert( - cid, - PtrAndAlign { - ptr: ptr.into(), - aligned, - }, - ); - let internally_mutable = !mir.return_ty.is_freeze( - self.tcx, - ty::ParamEnv::empty(Reveal::All), - span, - ); - let mutability = if mutability == Mutability::Mutable || internally_mutable { - Mutability::Mutable - } else { - Mutability::Immutable - }; - let cleanup = StackPopCleanup::MarkStatic(mutability); - let name = ty::tls::with(|tcx| tcx.item_path_str(def_id)); - trace!("pushing stack frame for global: {}", name); - self.push_stack_frame( - instance, - span, - mir, - Lvalue::from_ptr(ptr), - cleanup, - )?; - Ok(true) - } -} - -// WARNING: This code pushes new stack frames. Make sure that any methods implemented on this -// type don't ever access ecx.stack[ecx.cur_frame()], as that will change. This includes, e.g., -// using the current stack frame's substitution. -// Basically don't call anything other than `load_mir`, `alloc_ptr`, `push_stack_frame`. -struct ConstantExtractor<'a, 'b: 'a, 'tcx: 'b, M: Machine<'tcx> + 'a> { - span: Span, - ecx: &'a mut EvalContext<'b, 'tcx, M>, - mir: &'tcx mir::Mir<'tcx>, - instance: ty::Instance<'tcx>, - new_constants: &'a mut EvalResult<'tcx, u64>, -} - -impl<'a, 'b, 'tcx, M: Machine<'tcx>> ConstantExtractor<'a, 'b, 'tcx, M> { - fn try<F: FnOnce(&mut Self) -> EvalResult<'tcx, bool>>(&mut self, f: F) { - // previous constant errored - let n = match *self.new_constants { - Ok(n) => n, - Err(_) => return, - }; - match f(self) { - // everything ok + a new stackframe - Ok(true) => *self.new_constants = Ok(n + 1), - // constant correctly evaluated, but no new stackframe - Ok(false) => {} - // constant eval errored - Err(err) => *self.new_constants = Err(err), - } - } -} - -impl<'a, 'b, 'tcx, M: Machine<'tcx>> Visitor<'tcx> for ConstantExtractor<'a, 'b, 'tcx, M> { - fn visit_constant(&mut self, constant: &mir::Constant<'tcx>, location: mir::Location) { - self.super_constant(constant, location); - match constant.literal { - // already computed by rustc - mir::Literal::Value { value: &ty::Const { val: ConstVal::Unevaluated(def_id, substs), .. } } => { - self.try(|this| { - this.ecx.global_item( - def_id, - substs, - constant.span, - Mutability::Immutable, - ) - }); - } - mir::Literal::Value { .. } => {} - mir::Literal::Promoted { index } => { - let cid = GlobalId { - instance: self.instance, - promoted: Some(index), - }; - if self.ecx.globals.contains_key(&cid) { - return; - } - let mir = &self.mir.promoted[index]; - self.try(|this| { - let size = this.ecx - .type_size_with_substs(mir.return_ty, this.instance.substs)? - .expect("unsized global"); - let align = this.ecx.type_align_with_substs( - mir.return_ty, - this.instance.substs, - )?; - let ptr = this.ecx.memory.allocate( - size, - align, - MemoryKind::UninitializedStatic, - )?; - let aligned = !this.ecx.is_packed(mir.return_ty)?; - this.ecx.globals.insert( - cid, - PtrAndAlign { - ptr: ptr.into(), - aligned, - }, - ); - trace!("pushing stack frame for {:?}", index); - this.ecx.push_stack_frame( - this.instance, - constant.span, - mir, - Lvalue::from_ptr(ptr), - StackPopCleanup::MarkStatic(Mutability::Immutable), - )?; - Ok(true) - }); - } - } - } - - fn visit_lvalue( - &mut self, - lvalue: &mir::Lvalue<'tcx>, - context: LvalueContext<'tcx>, - location: mir::Location, - ) { - self.super_lvalue(lvalue, context, location); - if let mir::Lvalue::Static(ref static_) = *lvalue { - let def_id = static_.def_id; - let substs = self.ecx.tcx.intern_substs(&[]); - let span = self.span; - if let Some(node_item) = self.ecx.tcx.hir.get_if_local(def_id) { - if let hir::map::Node::NodeItem(&hir::Item { ref node, .. }) = node_item { - if let hir::ItemStatic(_, m, _) = *node { - self.try(|this| { - this.ecx.global_item( - def_id, - substs, - span, - if m == hir::MutMutable { - Mutability::Mutable - } else { - Mutability::Immutable - }, - ) - }); - return; - } else { - bug!("static def id doesn't point to static"); - } - } else { - bug!("static def id doesn't point to item"); - } - } else { - let def = self.ecx.tcx.describe_def(def_id).expect("static not found"); - if let hir::def::Def::Static(_, mutable) = def { - self.try(|this| { - this.ecx.global_item( - def_id, - substs, - span, - if mutable { - Mutability::Mutable - } else { - Mutability::Immutable - }, - ) - }); - } else { - bug!("static found but isn't a static: {:?}", def); - } - } - } - } -} diff --git a/src/tools/miri/src/librustc_mir/interpret/traits.rs b/src/tools/miri/src/librustc_mir/interpret/traits.rs deleted file mode 100644 index 3f7e10a9ea..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/traits.rs +++ /dev/null @@ -1,137 +0,0 @@ -use rustc::traits::{self, Reveal}; -use rustc::hir::def_id::DefId; -use rustc::ty::subst::Substs; -use rustc::ty::{self, Ty}; -use syntax::codemap::DUMMY_SP; -use syntax::ast::{self, Mutability}; - -use super::{EvalResult, EvalContext, eval_context, MemoryPointer, MemoryKind, Value, PrimVal, - Machine}; - -impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> { - pub(crate) fn fulfill_obligation( - &self, - trait_ref: ty::PolyTraitRef<'tcx>, - ) -> traits::Vtable<'tcx, ()> { - // Do the initial selection for the obligation. This yields the shallow result we are - // looking for -- that is, what specific impl. - self.tcx.infer_ctxt().enter(|infcx| { - let mut selcx = traits::SelectionContext::new(&infcx); - - let obligation = traits::Obligation::new( - traits::ObligationCause::misc(DUMMY_SP, ast::DUMMY_NODE_ID), - ty::ParamEnv::empty(Reveal::All), - trait_ref.to_poly_trait_predicate(), - ); - let selection = selcx.select(&obligation).unwrap().unwrap(); - - // Currently, we use a fulfillment context to completely resolve all nested obligations. - // This is because they can inform the inference of the impl's type parameters. - let mut fulfill_cx = traits::FulfillmentContext::new(); - let vtable = selection.map(|predicate| { - fulfill_cx.register_predicate_obligation(&infcx, predicate); - }); - infcx.drain_fulfillment_cx_or_panic(DUMMY_SP, &mut fulfill_cx, &vtable) - }) - } - - /// Creates a dynamic vtable for the given type and vtable origin. This is used only for - /// objects. - /// - /// The `trait_ref` encodes the erased self type. Hence if we are - /// making an object `Foo<Trait>` from a value of type `Foo<T>`, then - /// `trait_ref` would map `T:Trait`. - pub fn get_vtable( - &mut self, - ty: Ty<'tcx>, - trait_ref: ty::PolyTraitRef<'tcx>, - ) -> EvalResult<'tcx, MemoryPointer> { - debug!("get_vtable(trait_ref={:?})", trait_ref); - - let size = self.type_size(trait_ref.self_ty())?.expect( - "can't create a vtable for an unsized type", - ); - let align = self.type_align(trait_ref.self_ty())?; - - let ptr_size = self.memory.pointer_size(); - let methods = ::rustc::traits::get_vtable_methods(self.tcx, trait_ref); - let vtable = self.memory.allocate( - ptr_size * (3 + methods.count() as u64), - ptr_size, - MemoryKind::UninitializedStatic, - )?; - - let drop = eval_context::resolve_drop_in_place(self.tcx, ty); - let drop = self.memory.create_fn_alloc(drop); - self.memory.write_ptr_sized_unsigned(vtable, PrimVal::Ptr(drop))?; - - let size_ptr = vtable.offset(ptr_size, &self)?; - self.memory.write_ptr_sized_unsigned(size_ptr, PrimVal::Bytes(size as u128))?; - let align_ptr = vtable.offset(ptr_size * 2, &self)?; - self.memory.write_ptr_sized_unsigned(align_ptr, PrimVal::Bytes(align as u128))?; - - for (i, method) in ::rustc::traits::get_vtable_methods(self.tcx, trait_ref).enumerate() { - if let Some((def_id, substs)) = method { - let instance = eval_context::resolve(self.tcx, def_id, substs); - let fn_ptr = self.memory.create_fn_alloc(instance); - let method_ptr = vtable.offset(ptr_size * (3 + i as u64), &self)?; - self.memory.write_ptr_sized_unsigned(method_ptr, PrimVal::Ptr(fn_ptr))?; - } - } - - self.memory.mark_static_initalized( - vtable.alloc_id, - Mutability::Mutable, - )?; - - Ok(vtable) - } - - pub fn read_drop_type_from_vtable( - &self, - vtable: MemoryPointer, - ) -> EvalResult<'tcx, Option<ty::Instance<'tcx>>> { - // we don't care about the pointee type, we just want a pointer - match self.read_ptr(vtable, self.tcx.mk_nil_ptr())? { - // some values don't need to call a drop impl, so the value is null - Value::ByVal(PrimVal::Bytes(0)) => Ok(None), - Value::ByVal(PrimVal::Ptr(drop_fn)) => self.memory.get_fn(drop_fn).map(Some), - _ => err!(ReadBytesAsPointer), - } - } - - pub fn read_size_and_align_from_vtable( - &self, - vtable: MemoryPointer, - ) -> EvalResult<'tcx, (u64, u64)> { - let pointer_size = self.memory.pointer_size(); - let size = self.memory.read_ptr_sized_unsigned(vtable.offset(pointer_size, self)?)?.to_bytes()? as u64; - let align = self.memory.read_ptr_sized_unsigned( - vtable.offset(pointer_size * 2, self)? - )?.to_bytes()? as u64; - Ok((size, align)) - } - - pub(crate) fn resolve_associated_const( - &self, - def_id: DefId, - substs: &'tcx Substs<'tcx>, - ) -> ty::Instance<'tcx> { - if let Some(trait_id) = self.tcx.trait_of_item(def_id) { - let trait_ref = ty::Binder(ty::TraitRef::new(trait_id, substs)); - let vtable = self.fulfill_obligation(trait_ref); - if let traits::VtableImpl(vtable_impl) = vtable { - let name = self.tcx.item_name(def_id); - let assoc_const_opt = self.tcx.associated_items(vtable_impl.impl_def_id).find( - |item| { - item.kind == ty::AssociatedKind::Const && item.name == name - }, - ); - if let Some(assoc_const) = assoc_const_opt { - return ty::Instance::new(assoc_const.def_id, vtable_impl.substs); - } - } - } - ty::Instance::new(def_id, substs) - } -} diff --git a/src/tools/miri/src/librustc_mir/interpret/validation.rs b/src/tools/miri/src/librustc_mir/interpret/validation.rs deleted file mode 100644 index 9be9341ee2..0000000000 --- a/src/tools/miri/src/librustc_mir/interpret/validation.rs +++ /dev/null @@ -1,727 +0,0 @@ -use rustc::hir::{self, Mutability}; -use rustc::hir::Mutability::*; -use rustc::mir::{self, ValidationOp, ValidationOperand}; -use rustc::ty::{self, Ty, TypeFoldable, TyCtxt}; -use rustc::ty::subst::{Substs, Subst}; -use rustc::traits; -use rustc::infer::InferCtxt; -use rustc::traits::Reveal; -use rustc::middle::region; -use rustc_data_structures::indexed_vec::Idx; - -use super::{EvalError, EvalResult, EvalErrorKind, EvalContext, DynamicLifetime, AccessKind, Value, - Lvalue, LvalueExtra, Machine, ValTy}; - -pub type ValidationQuery<'tcx> = ValidationOperand<'tcx, (AbsLvalue<'tcx>, Lvalue)>; - -#[derive(Copy, Clone, Debug, PartialEq)] -enum ValidationMode { - Acquire, - /// Recover because the given region ended - Recover(region::Scope), - ReleaseUntil(Option<region::Scope>), -} - -impl ValidationMode { - fn acquiring(self) -> bool { - use self::ValidationMode::*; - match self { - Acquire | Recover(_) => true, - ReleaseUntil(_) => false, - } - } -} - -// Abstract lvalues -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub enum AbsLvalue<'tcx> { - Local(mir::Local), - Static(hir::def_id::DefId), - Projection(Box<AbsLvalueProjection<'tcx>>), -} - -type AbsLvalueProjection<'tcx> = mir::Projection<'tcx, AbsLvalue<'tcx>, u64, ()>; -type AbsLvalueElem<'tcx> = mir::ProjectionElem<'tcx, u64, ()>; - -impl<'tcx> AbsLvalue<'tcx> { - pub fn field(self, f: mir::Field) -> AbsLvalue<'tcx> { - self.elem(mir::ProjectionElem::Field(f, ())) - } - - pub fn deref(self) -> AbsLvalue<'tcx> { - self.elem(mir::ProjectionElem::Deref) - } - - pub fn downcast(self, adt_def: &'tcx ty::AdtDef, variant_index: usize) -> AbsLvalue<'tcx> { - self.elem(mir::ProjectionElem::Downcast(adt_def, variant_index)) - } - - pub fn index(self, index: u64) -> AbsLvalue<'tcx> { - self.elem(mir::ProjectionElem::Index(index)) - } - - fn elem(self, elem: AbsLvalueElem<'tcx>) -> AbsLvalue<'tcx> { - AbsLvalue::Projection(Box::new(AbsLvalueProjection { - base: self, - elem, - })) - } -} - -impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> { - fn abstract_lvalue_projection(&self, proj: &mir::LvalueProjection<'tcx>) -> EvalResult<'tcx, AbsLvalueProjection<'tcx>> { - use self::mir::ProjectionElem::*; - - let elem = match proj.elem { - Deref => Deref, - Field(f, _) => Field(f, ()), - Index(v) => { - let value = self.frame().get_local(v)?; - let ty = self.tcx.types.usize; - let n = self.value_to_primval(ValTy { value, ty })?.to_u64()?; - Index(n) - }, - ConstantIndex { offset, min_length, from_end } => - ConstantIndex { offset, min_length, from_end }, - Subslice { from, to } => - Subslice { from, to }, - Downcast(adt, sz) => Downcast(adt, sz), - }; - Ok(AbsLvalueProjection { - base: self.abstract_lvalue(&proj.base)?, - elem - }) - } - - fn abstract_lvalue(&self, lval: &mir::Lvalue<'tcx>) -> EvalResult<'tcx, AbsLvalue<'tcx>> { - Ok(match lval { - &mir::Lvalue::Local(l) => AbsLvalue::Local(l), - &mir::Lvalue::Static(ref s) => AbsLvalue::Static(s.def_id), - &mir::Lvalue::Projection(ref p) => - AbsLvalue::Projection(Box::new(self.abstract_lvalue_projection(&*p)?)), - }) - } - - // Validity checks - pub(crate) fn validation_op( - &mut self, - op: ValidationOp, - operand: &ValidationOperand<'tcx, mir::Lvalue<'tcx>>, - ) -> EvalResult<'tcx> { - // If mir-emit-validate is set to 0 (i.e., disabled), we may still see validation commands - // because other crates may have been compiled with mir-emit-validate > 0. Ignore those - // commands. This makes mir-emit-validate also a flag to control whether miri will do - // validation or not. - if self.tcx.sess.opts.debugging_opts.mir_emit_validate == 0 { - return Ok(()); - } - debug_assert!(self.memory.cur_frame == self.cur_frame()); - - // HACK: Determine if this method is whitelisted and hence we do not perform any validation. - // We currently insta-UB on anything passing around uninitialized memory, so we have to whitelist - // the places that are allowed to do that. - // The second group is stuff libstd does that is forbidden even under relaxed validation. - { - // The regexp we use for filtering - use regex::Regex; - lazy_static! { - static ref RE: Regex = Regex::new("^(\ - (std|alloc::heap::__core)::mem::(uninitialized|forget)::|\ - <(std|alloc)::heap::Heap as (std::heap|alloc::allocator)::Alloc>::|\ - <(std|alloc::heap::__core)::mem::ManuallyDrop<T>><.*>::new$|\ - <(std|alloc::heap::__core)::mem::ManuallyDrop<T> as std::ops::DerefMut><.*>::deref_mut$|\ - (std|alloc::heap::__core)::ptr::read::|\ - \ - <std::sync::Arc<T>><.*>::inner$|\ - <std::sync::Arc<T>><.*>::drop_slow$|\ - (std::heap|alloc::allocator)::Layout::for_value::|\ - (std|alloc::heap::__core)::mem::(size|align)_of_val::\ - )").unwrap(); - } - // Now test - let name = self.stack[self.cur_frame()].instance.to_string(); - if RE.is_match(&name) { - return Ok(()); - } - } - - // We need to monomorphize ty *without* erasing lifetimes - let ty = operand.ty.subst(self.tcx, self.substs()); - let lval = self.eval_lvalue(&operand.lval)?; - let abs_lval = self.abstract_lvalue(&operand.lval)?; - let query = ValidationQuery { - lval: (abs_lval, lval), - ty, - re: operand.re, - mutbl: operand.mutbl, - }; - - // Check the mode, and also perform mode-specific operations - let mode = match op { - ValidationOp::Acquire => ValidationMode::Acquire, - ValidationOp::Release => ValidationMode::ReleaseUntil(None), - ValidationOp::Suspend(scope) => { - if query.mutbl == MutMutable { - let lft = DynamicLifetime { - frame: self.cur_frame(), - region: Some(scope), // Notably, we only ever suspend things for given regions. - // Suspending for the entire function does not make any sense. - }; - trace!("Suspending {:?} until {:?}", query, scope); - self.suspended.entry(lft).or_insert_with(Vec::new).push( - query.clone(), - ); - } - ValidationMode::ReleaseUntil(Some(scope)) - } - }; - self.validate(query, mode) - } - - /// Release locks and executes suspensions of the given region (or the entire fn, in case of None). - pub(crate) fn end_region(&mut self, scope: Option<region::Scope>) -> EvalResult<'tcx> { - debug_assert!(self.memory.cur_frame == self.cur_frame()); - self.memory.locks_lifetime_ended(scope); - match scope { - Some(scope) => { - // Recover suspended lvals - let lft = DynamicLifetime { - frame: self.cur_frame(), - region: Some(scope), - }; - if let Some(queries) = self.suspended.remove(&lft) { - for query in queries { - trace!("Recovering {:?} from suspension", query); - self.validate(query, ValidationMode::Recover(scope))?; - } - } - } - None => { - // Clean suspension table of current frame - let cur_frame = self.cur_frame(); - self.suspended.retain(|lft, _| { - lft.frame != cur_frame // keep only what is in the other (lower) frames - }); - } - } - Ok(()) - } - - fn normalize_type_unerased(&self, ty: Ty<'tcx>) -> Ty<'tcx> { - return normalize_associated_type(self.tcx, &ty); - - use syntax::codemap::{Span, DUMMY_SP}; - - // We copy a bunch of stuff from rustc/infer/mod.rs to be able to tweak its behavior - fn normalize_projections_in<'a, 'gcx, 'tcx, T>( - self_: &InferCtxt<'a, 'gcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - value: &T, - ) -> T::Lifted - where - T: TypeFoldable<'tcx> + ty::Lift<'gcx>, - { - let mut selcx = traits::SelectionContext::new(self_); - let cause = traits::ObligationCause::dummy(); - let traits::Normalized { - value: result, - obligations, - } = traits::normalize(&mut selcx, param_env, cause, value); - - let mut fulfill_cx = traits::FulfillmentContext::new(); - - for obligation in obligations { - fulfill_cx.register_predicate_obligation(self_, obligation); - } - - drain_fulfillment_cx_or_panic(self_, DUMMY_SP, &mut fulfill_cx, &result) - } - - fn drain_fulfillment_cx_or_panic<'a, 'gcx, 'tcx, T>( - self_: &InferCtxt<'a, 'gcx, 'tcx>, - span: Span, - fulfill_cx: &mut traits::FulfillmentContext<'tcx>, - result: &T, - ) -> T::Lifted - where - T: TypeFoldable<'tcx> + ty::Lift<'gcx>, - { - // In principle, we only need to do this so long as `result` - // contains unbound type parameters. It could be a slight - // optimization to stop iterating early. - match fulfill_cx.select_all_or_error(self_) { - Ok(()) => { } - Err(errors) => { - span_bug!( - span, - "Encountered errors `{:?}` resolving bounds after type-checking", - errors - ); - } - } - - let result = self_.resolve_type_vars_if_possible(result); - let result = self_.tcx.fold_regions( - &result, - &mut false, - |r, _| match *r { - ty::ReVar(_) => self_.tcx.types.re_erased, - _ => r, - }, - ); - - match self_.tcx.lift_to_global(&result) { - Some(result) => result, - None => { - span_bug!(span, "Uninferred types/regions in `{:?}`", result); - } - } - } - - trait MyTransNormalize<'gcx>: TypeFoldable<'gcx> { - fn my_trans_normalize<'a, 'tcx>( - &self, - infcx: &InferCtxt<'a, 'gcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - ) -> Self; - } - - macro_rules! items { ($($item:item)+) => ($($item)+) } - macro_rules! impl_trans_normalize { - ($lt_gcx:tt, $($ty:ty),+) => { - items!($(impl<$lt_gcx> MyTransNormalize<$lt_gcx> for $ty { - fn my_trans_normalize<'a, 'tcx>(&self, - infcx: &InferCtxt<'a, $lt_gcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>) - -> Self { - normalize_projections_in(infcx, param_env, self) - } - })+); - } - } - - impl_trans_normalize!('gcx, - Ty<'gcx>, - &'gcx Substs<'gcx>, - ty::FnSig<'gcx>, - ty::PolyFnSig<'gcx>, - ty::ClosureSubsts<'gcx>, - ty::PolyTraitRef<'gcx>, - ty::ExistentialTraitRef<'gcx> - ); - - fn normalize_associated_type<'a, 'tcx, T>(self_: TyCtxt<'a, 'tcx, 'tcx>, value: &T) -> T - where - T: MyTransNormalize<'tcx>, - { - let param_env = ty::ParamEnv::empty(Reveal::All); - - if !value.has_projections() { - return value.clone(); - } - - self_.infer_ctxt().enter(|infcx| { - value.my_trans_normalize(&infcx, param_env) - }) - } - } - - fn validate_variant( - &mut self, - query: ValidationQuery<'tcx>, - variant: &ty::VariantDef, - subst: &ty::subst::Substs<'tcx>, - mode: ValidationMode, - ) -> EvalResult<'tcx> { - // TODO: Maybe take visibility/privacy into account. - for (idx, field_def) in variant.fields.iter().enumerate() { - let field_ty = field_def.ty(self.tcx, subst); - let field = mir::Field::new(idx); - let field_lvalue = self.lvalue_field(query.lval.1, field, query.ty, field_ty)?; - self.validate( - ValidationQuery { - lval: (query.lval.0.clone().field(field), field_lvalue), - ty: field_ty, - ..query - }, - mode, - )?; - } - Ok(()) - } - - fn validate_ptr( - &mut self, - val: Value, - abs_lval: AbsLvalue<'tcx>, - pointee_ty: Ty<'tcx>, - re: Option<region::Scope>, - mutbl: Mutability, - mode: ValidationMode, - ) -> EvalResult<'tcx> { - // Check alignment and non-NULLness - let (_, align) = self.size_and_align_of_dst(pointee_ty, val)?; - let ptr = val.into_ptr(&self.memory)?; - self.memory.check_align(ptr, align, None)?; - - // Recurse - let pointee_lvalue = self.val_to_lvalue(val, pointee_ty)?; - self.validate( - ValidationQuery { - lval: (abs_lval.deref(), pointee_lvalue), - ty: pointee_ty, - re, - mutbl, - }, - mode, - ) - } - - /// Validate the lvalue at the given type. If `acquire` is false, just do a release of all write locks - fn validate( - &mut self, - mut query: ValidationQuery<'tcx>, - mode: ValidationMode, - ) -> EvalResult<'tcx> { - use rustc::ty::TypeVariants::*; - use rustc::ty::RegionKind::*; - use rustc::ty::AdtKind; - - // No point releasing shared stuff. - if !mode.acquiring() && query.mutbl == MutImmutable { - return Ok(()); - } - // When we recover, we may see data whose validity *just* ended. Do not acquire it. - if let ValidationMode::Recover(ending_ce) = mode { - if query.re == Some(ending_ce) { - return Ok(()); - } - } - - query.ty = self.normalize_type_unerased(&query.ty); - trace!("{:?} on {:?}", mode, query); - - // Decide whether this type *owns* the memory it covers (like integers), or whether it - // just assembles pieces (that each own their memory) together to a larger whole. - // TODO: Currently, we don't acquire locks for padding and discriminants. We should. - let is_owning = match query.ty.sty { - TyInt(_) | TyUint(_) | TyRawPtr(_) | TyBool | TyFloat(_) | TyChar | TyStr | - TyRef(..) | TyFnPtr(..) | TyFnDef(..) | TyNever => true, - TyAdt(adt, _) if adt.is_box() => true, - TySlice(_) | TyAdt(_, _) | TyTuple(..) | TyClosure(..) | TyArray(..) | - TyDynamic(..) | TyGenerator(..) => false, - TyParam(_) | TyInfer(_) | TyProjection(_) | TyAnon(..) | TyError => { - bug!("I got an incomplete/unnormalized type for validation") - } - }; - if is_owning { - // We need to lock. So we need memory. So we have to force_acquire. - // Tracking the same state for locals not backed by memory would just duplicate too - // much machinery. - // FIXME: We ignore alignment. - let (ptr, extra) = self.force_allocation(query.lval.1)?.to_ptr_extra_aligned(); - // Determine the size - // FIXME: Can we reuse size_and_align_of_dst for Lvalues? - let len = match self.type_size(query.ty)? { - Some(size) => { - assert_eq!(extra, LvalueExtra::None, "Got a fat ptr to a sized type"); - size - } - None => { - // The only unsized typ we concider "owning" is TyStr. - assert_eq!( - query.ty.sty, - TyStr, - "Found a surprising unsized owning type" - ); - // The extra must be the length, in bytes. - match extra { - LvalueExtra::Length(len) => len, - _ => bug!("TyStr must have a length as extra"), - } - } - }; - // Handle locking - if len > 0 { - let ptr = ptr.to_ptr()?; - match query.mutbl { - MutImmutable => { - if mode.acquiring() { - self.memory.acquire_lock( - ptr, - len, - query.re, - AccessKind::Read, - )?; - } - } - // No releasing of read locks, ever. - MutMutable => { - match mode { - ValidationMode::Acquire => { - self.memory.acquire_lock( - ptr, - len, - query.re, - AccessKind::Write, - )? - } - ValidationMode::Recover(ending_ce) => { - self.memory.recover_write_lock( - ptr, - len, - &query.lval.0, - query.re, - ending_ce, - )? - } - ValidationMode::ReleaseUntil(suspended_ce) => { - self.memory.suspend_write_lock( - ptr, - len, - &query.lval.0, - suspended_ce, - )? - } - } - } - } - } - } - - let res = do catch { - match query.ty.sty { - TyInt(_) | TyUint(_) | TyRawPtr(_) => { - if mode.acquiring() { - // Make sure we can read this. - let val = self.read_lvalue(query.lval.1)?; - self.follow_by_ref_value(val, query.ty)?; - // FIXME: It would be great to rule out Undef here, but that doesn't actually work. - // Passing around undef data is a thing that e.g. Vec::extend_with does. - } - Ok(()) - } - TyBool | TyFloat(_) | TyChar => { - if mode.acquiring() { - let val = self.read_lvalue(query.lval.1)?; - let val = self.value_to_primval(ValTy { value: val, ty: query.ty })?; - val.to_bytes()?; - // TODO: Check if these are valid bool/float/codepoint/UTF-8 - } - Ok(()) - } - TyNever => err!(ValidationFailure(format!("The empty type is never valid."))), - TyRef(region, - ty::TypeAndMut { - ty: pointee_ty, - mutbl, - }) => { - let val = self.read_lvalue(query.lval.1)?; - // Sharing restricts our context - if mutbl == MutImmutable { - query.mutbl = MutImmutable; - } - // Inner lifetimes *outlive* outer ones, so only if we have no lifetime restriction yet, - // we record the region of this borrow to the context. - if query.re == None { - match *region { - ReScope(scope) => query.re = Some(scope), - // It is possible for us to encounter erased lifetimes here because the lifetimes in - // this functions' Subst will be erased. - _ => {} - } - } - self.validate_ptr(val, query.lval.0, pointee_ty, query.re, query.mutbl, mode) - } - TyAdt(adt, _) if adt.is_box() => { - let val = self.read_lvalue(query.lval.1)?; - self.validate_ptr(val, query.lval.0, query.ty.boxed_ty(), query.re, query.mutbl, mode) - } - TyFnPtr(_sig) => { - let ptr = self.read_lvalue(query.lval.1)? - .into_ptr(&self.memory)? - .to_ptr()?; - self.memory.get_fn(ptr)?; - // TODO: Check if the signature matches (should be the same check as what terminator/mod.rs already does on call?). - Ok(()) - } - TyFnDef(..) => { - // This is a zero-sized type with all relevant data sitting in the type. - // There is nothing to validate. - Ok(()) - } - - // Compound types - TyStr => { - // TODO: Validate strings - Ok(()) - } - TySlice(elem_ty) => { - let len = match query.lval.1 { - Lvalue::Ptr { extra: LvalueExtra::Length(len), .. } => len, - _ => { - bug!( - "acquire_valid of a TySlice given non-slice lvalue: {:?}", - query.lval - ) - } - }; - for i in 0..len { - let inner_lvalue = self.lvalue_index(query.lval.1, query.ty, i)?; - self.validate( - ValidationQuery { - lval: (query.lval.0.clone().index(i), inner_lvalue), - ty: elem_ty, - ..query - }, - mode, - )?; - } - Ok(()) - } - TyArray(elem_ty, len) => { - let len = len.val.to_const_int().unwrap().to_u64().unwrap(); - for i in 0..len { - let inner_lvalue = self.lvalue_index(query.lval.1, query.ty, i as u64)?; - self.validate( - ValidationQuery { - lval: (query.lval.0.clone().index(i as u64), inner_lvalue), - ty: elem_ty, - ..query - }, - mode, - )?; - } - Ok(()) - } - TyDynamic(_data, _region) => { - // Check that this is a valid vtable - let vtable = match query.lval.1 { - Lvalue::Ptr { extra: LvalueExtra::Vtable(vtable), .. } => vtable, - _ => { - bug!( - "acquire_valid of a TyDynamic given non-trait-object lvalue: {:?}", - query.lval - ) - } - }; - self.read_size_and_align_from_vtable(vtable)?; - // TODO: Check that the vtable contains all the function pointers we expect it to have. - // Trait objects cannot have any operations performed - // on them directly. We cannot, in general, even acquire any locks as the trait object *could* - // contain an UnsafeCell. If we call functions to get access to data, we will validate - // their return values. So, it doesn't seem like there's anything else to do. - Ok(()) - } - TyAdt(adt, subst) => { - if Some(adt.did) == self.tcx.lang_items().unsafe_cell_type() && - query.mutbl == MutImmutable - { - // No locks for shared unsafe cells. Also no other validation, the only field is private anyway. - return Ok(()); - } - - match adt.adt_kind() { - AdtKind::Enum => { - // TODO: Can we get the discriminant without forcing an allocation? - let ptr = self.force_allocation(query.lval.1)?.to_ptr()?; - let discr = self.read_discriminant_value(ptr, query.ty)?; - - // Get variant index for discriminant - let variant_idx = adt.discriminants(self.tcx).position(|variant_discr| { - variant_discr.to_u128_unchecked() == discr - }); - let variant_idx = match variant_idx { - Some(val) => val, - None => return err!(InvalidDiscriminant), - }; - let variant = &adt.variants[variant_idx]; - - if variant.fields.len() > 0 { - // Downcast to this variant, if needed - let lval = if adt.variants.len() > 1 { - ( - query.lval.0.downcast(adt, variant_idx), - self.eval_lvalue_projection( - query.lval.1, - query.ty, - &mir::ProjectionElem::Downcast(adt, variant_idx), - )?, - ) - } else { - query.lval - }; - - // Recursively validate the fields - self.validate_variant( - ValidationQuery { lval, ..query }, - variant, - subst, - mode, - ) - } else { - // No fields, nothing left to check. Downcasting may fail, e.g. in case of a CEnum. - Ok(()) - } - } - AdtKind::Struct => { - self.validate_variant(query, adt.struct_variant(), subst, mode) - } - AdtKind::Union => { - // No guarantees are provided for union types. - // TODO: Make sure that all access to union fields is unsafe; otherwise, we may have some checking to do (but what exactly?) - Ok(()) - } - } - } - TyTuple(ref types, _) => { - for (idx, field_ty) in types.iter().enumerate() { - let field = mir::Field::new(idx); - let field_lvalue = self.lvalue_field(query.lval.1, field, query.ty, field_ty)?; - self.validate( - ValidationQuery { - lval: (query.lval.0.clone().field(field), field_lvalue), - ty: field_ty, - ..query - }, - mode, - )?; - } - Ok(()) - } - TyClosure(def_id, ref closure_substs) => { - for (idx, field_ty) in closure_substs.upvar_tys(def_id, self.tcx).enumerate() { - let field = mir::Field::new(idx); - let field_lvalue = self.lvalue_field(query.lval.1, field, query.ty, field_ty)?; - self.validate( - ValidationQuery { - lval: (query.lval.0.clone().field(field), field_lvalue), - ty: field_ty, - ..query - }, - mode, - )?; - } - // TODO: Check if the signature matches (should be the same check as what terminator/mod.rs already does on call?). - // Is there other things we can/should check? Like vtable pointers? - Ok(()) - } - // FIXME: generators aren't validated right now - TyGenerator(..) => Ok(()), - _ => bug!("We already established that this is a type we support. ({})", query.ty), - } - }; - match res { - // ReleaseUntil(None) of an uninitalized variable is a NOP. This is needed because - // we have to release the return value of a function; due to destination-passing-style - // the callee may directly write there. - // TODO: Ideally we would know whether the destination is already initialized, and only - // release if it is. But of course that can't even always be statically determined. - Err(EvalError { kind: EvalErrorKind::ReadUndefBytes, .. }) - if mode == ValidationMode::ReleaseUntil(None) => { - return Ok(()); - } - res => res, - } - } -} diff --git a/src/tools/miri/src/librustc_mir/lib.rs b/src/tools/miri/src/librustc_mir/lib.rs deleted file mode 100644 index c640932e50..0000000000 --- a/src/tools/miri/src/librustc_mir/lib.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![feature( - i128_type, - rustc_private, - conservative_impl_trait, - never_type, - catch_expr, -)] - -// From rustc. -#[macro_use] -extern crate log; -extern crate log_settings; -#[macro_use] -extern crate rustc; -extern crate rustc_const_math; -extern crate rustc_data_structures; -extern crate syntax; - -// From crates.io. -extern crate byteorder; -#[macro_use] -extern crate lazy_static; -extern crate regex; -extern crate backtrace; - -pub mod interpret; diff --git a/src/tools/miri/tests/compile-fail-fullmir/undefined_byte_read.rs b/src/tools/miri/tests/compile-fail-fullmir/undefined_byte_read.rs deleted file mode 100644 index 99404b7d5f..0000000000 --- a/src/tools/miri/tests/compile-fail-fullmir/undefined_byte_read.rs +++ /dev/null @@ -1,9 +0,0 @@ -// This should fail even without validation -// compile-flags: -Zmir-emit-validate=0 - -fn main() { - let v: Vec<u8> = Vec::with_capacity(10); - let undef = unsafe { *v.get_unchecked(5) }; - let x = undef + 1; //~ ERROR: attempted to read undefined bytes - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/alignment.rs b/src/tools/miri/tests/compile-fail/alignment.rs deleted file mode 100644 index 4faaa359df..0000000000 --- a/src/tools/miri/tests/compile-fail/alignment.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn main() { - // miri always gives allocations the worst possible alignment, so a `u8` array is guaranteed - // to be at the virtual location 1 (so one byte offset from the ultimate alignemnt location 0) - let mut x = [0u8; 20]; - let x_ptr: *mut u8 = &mut x[0]; - let y_ptr = x_ptr as *mut u64; - unsafe { - *y_ptr = 42; //~ ERROR tried to access memory with alignment 1, but alignment - } - panic!("unreachable in miri"); -} diff --git a/src/tools/miri/tests/compile-fail/assume.rs b/src/tools/miri/tests/compile-fail/assume.rs deleted file mode 100644 index 69758a5d7f..0000000000 --- a/src/tools/miri/tests/compile-fail/assume.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![feature(core_intrinsics)] - -fn main() { - let x = 5; - unsafe { - std::intrinsics::assume(x < 10); - std::intrinsics::assume(x > 1); - std::intrinsics::assume(x > 42); //~ ERROR: `assume` argument was false - } -} diff --git a/src/tools/miri/tests/compile-fail/bitop-beyond-alignment.rs b/src/tools/miri/tests/compile-fail/bitop-beyond-alignment.rs deleted file mode 100644 index a30c054ab5..0000000000 --- a/src/tools/miri/tests/compile-fail/bitop-beyond-alignment.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] - -use std::mem; - -enum Tag<A> { - Tag2(A) -} - -struct Rec { - c8: u8, - t: Tag<u64> -} - -fn mk_rec() -> Rec { - return Rec { c8:0, t:Tag::Tag2(0) }; -} - -fn is_u64_aligned(u: &Tag<u64>) -> bool { - let p: usize = unsafe { mem::transmute(u) }; - let u64_align = std::mem::align_of::<u64>(); - return (p & (u64_align + 1)) == 0; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes -} - -pub fn main() { - let x = mk_rec(); - assert!(is_u64_aligned(&x.t)); -} diff --git a/src/tools/miri/tests/compile-fail/cast_box_int_to_fn_ptr.rs b/src/tools/miri/tests/compile-fail/cast_box_int_to_fn_ptr.rs deleted file mode 100644 index 912b1bd7d9..0000000000 --- a/src/tools/miri/tests/compile-fail/cast_box_int_to_fn_ptr.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Validation makes this fail in the wrong place -// compile-flags: -Zmir-emit-validate=0 - -fn main() { - let b = Box::new(42); - let g = unsafe { - std::mem::transmute::<&usize, &fn(i32)>(&b) - }; - - (*g)(42) //~ ERROR a memory access tried to interpret some bytes as a pointer -} diff --git a/src/tools/miri/tests/compile-fail/cast_fn_ptr.rs b/src/tools/miri/tests/compile-fail/cast_fn_ptr.rs deleted file mode 100644 index 7509ae6ed7..0000000000 --- a/src/tools/miri/tests/compile-fail/cast_fn_ptr.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - fn f() {} - - let g = unsafe { - std::mem::transmute::<fn(), fn(i32)>(f) - }; - - g(42) //~ ERROR tried to call a function with sig fn() through a function pointer of type fn(i32) -} diff --git a/src/tools/miri/tests/compile-fail/cast_fn_ptr2.rs b/src/tools/miri/tests/compile-fail/cast_fn_ptr2.rs deleted file mode 100644 index 5d902e1f9a..0000000000 --- a/src/tools/miri/tests/compile-fail/cast_fn_ptr2.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - fn f(_ : (i32,i32)) {} - - let g = unsafe { - std::mem::transmute::<fn((i32,i32)), fn(i32)>(f) - }; - - g(42) //~ ERROR tried to call a function with sig fn((i32, i32)) through a function pointer of type fn(i32) -} diff --git a/src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe.rs b/src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe.rs deleted file mode 100644 index 568681da3c..0000000000 --- a/src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe.rs +++ /dev/null @@ -1,10 +0,0 @@ -// just making sure that fn -> unsafe fn casts are handled by rustc so miri doesn't have to -fn main() { - fn f() {} - - let g = f as fn() as unsafe fn(i32); //~ERROR: non-primitive cast: `fn()` as `unsafe fn(i32)` - - unsafe { - g(42); - } -} diff --git a/src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe2.rs b/src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe2.rs deleted file mode 100644 index 314365939f..0000000000 --- a/src/tools/miri/tests/compile-fail/cast_fn_ptr_unsafe2.rs +++ /dev/null @@ -1,10 +0,0 @@ -// just making sure that fn -> unsafe fn casts are handled by rustc so miri doesn't have to -fn main() { - fn f() {} - - let g = f as fn() as fn(i32) as unsafe fn(i32); //~ERROR: non-primitive cast: `fn()` as `fn(i32)` - - unsafe { - g(42); - } -} diff --git a/src/tools/miri/tests/compile-fail/cast_int_to_fn_ptr.rs b/src/tools/miri/tests/compile-fail/cast_int_to_fn_ptr.rs deleted file mode 100644 index 23f85dbaf3..0000000000 --- a/src/tools/miri/tests/compile-fail/cast_int_to_fn_ptr.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Validation makes this fail in the wrong place -// compile-flags: -Zmir-emit-validate=0 - -fn main() { - let g = unsafe { - std::mem::transmute::<usize, fn(i32)>(42) - }; - - g(42) //~ ERROR a memory access tried to interpret some bytes as a pointer -} diff --git a/src/tools/miri/tests/compile-fail/copy_nonoverlapping.rs b/src/tools/miri/tests/compile-fail/copy_nonoverlapping.rs deleted file mode 100644 index f4acbadfd5..0000000000 --- a/src/tools/miri/tests/compile-fail/copy_nonoverlapping.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(core_intrinsics)] - -use std::intrinsics::*; - -//error-pattern: copy_nonoverlapping called on overlapping ranges - -fn main() { - let mut data = [0u8; 16]; - unsafe { - let a = &data[0] as *const _; - let b = &mut data[1] as *mut _; - std::ptr::copy_nonoverlapping(a, b, 2); - } -} diff --git a/src/tools/miri/tests/compile-fail/ctlz_nonzero.rs b/src/tools/miri/tests/compile-fail/ctlz_nonzero.rs deleted file mode 100644 index 704c4d4b7d..0000000000 --- a/src/tools/miri/tests/compile-fail/ctlz_nonzero.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(intrinsics)] - -mod rusti { - extern "rust-intrinsic" { - pub fn ctlz_nonzero<T>(x: T) -> T; - } -} - -pub fn main() { - unsafe { - use rusti::*; - - ctlz_nonzero(0u8); //~ ERROR: ctlz_nonzero called on 0 - } -} diff --git a/src/tools/miri/tests/compile-fail/cttz_nonzero.rs b/src/tools/miri/tests/compile-fail/cttz_nonzero.rs deleted file mode 100644 index eda25c6615..0000000000 --- a/src/tools/miri/tests/compile-fail/cttz_nonzero.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(intrinsics)] - -mod rusti { - extern "rust-intrinsic" { - pub fn cttz_nonzero<T>(x: T) -> T; - } -} - -pub fn main() { - unsafe { - use rusti::*; - - cttz_nonzero(0u8); //~ ERROR: cttz_nonzero called on 0 - } -} diff --git a/src/tools/miri/tests/compile-fail/dangling_pointer_deref.rs b/src/tools/miri/tests/compile-fail/dangling_pointer_deref.rs deleted file mode 100644 index 0ede7c96f0..0000000000 --- a/src/tools/miri/tests/compile-fail/dangling_pointer_deref.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - let p = { - let b = Box::new(42); - &*b as *const i32 - }; - let x = unsafe { *p }; //~ ERROR: dangling pointer was dereferenced - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/deallocate-bad-alignment.rs b/src/tools/miri/tests/compile-fail/deallocate-bad-alignment.rs deleted file mode 100644 index c1ae7477c8..0000000000 --- a/src/tools/miri/tests/compile-fail/deallocate-bad-alignment.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -// error-pattern: tried to deallocate or reallocate using incorrect alignment or size - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap(); - Heap.dealloc(x, Layout::from_size_align_unchecked(1, 2)); - } -} diff --git a/src/tools/miri/tests/compile-fail/deallocate-bad-size.rs b/src/tools/miri/tests/compile-fail/deallocate-bad-size.rs deleted file mode 100644 index 5577f10736..0000000000 --- a/src/tools/miri/tests/compile-fail/deallocate-bad-size.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -// error-pattern: tried to deallocate or reallocate using incorrect alignment or size - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap(); - Heap.dealloc(x, Layout::from_size_align_unchecked(2, 1)); - } -} diff --git a/src/tools/miri/tests/compile-fail/deallocate-twice.rs b/src/tools/miri/tests/compile-fail/deallocate-twice.rs deleted file mode 100644 index e11df0eb41..0000000000 --- a/src/tools/miri/tests/compile-fail/deallocate-twice.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -// error-pattern: tried to deallocate dangling pointer - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap(); - Heap.dealloc(x, Layout::from_size_align_unchecked(1, 1)); - Heap.dealloc(x, Layout::from_size_align_unchecked(1, 1)); - } -} diff --git a/src/tools/miri/tests/compile-fail/deref_fn_ptr.rs b/src/tools/miri/tests/compile-fail/deref_fn_ptr.rs deleted file mode 100644 index c1eaf7eaa6..0000000000 --- a/src/tools/miri/tests/compile-fail/deref_fn_ptr.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn f() {} - -fn main() { - let x: i32 = unsafe { - *std::mem::transmute::<fn(), *const i32>(f) //~ ERROR: tried to dereference a function pointer - }; - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/execute_memory.rs b/src/tools/miri/tests/compile-fail/execute_memory.rs deleted file mode 100644 index 87d975e1f9..0000000000 --- a/src/tools/miri/tests/compile-fail/execute_memory.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Validation makes this fail in the wrong place -// compile-flags: -Zmir-emit-validate=0 - -#![feature(box_syntax)] - -fn main() { - let x = box 42; - unsafe { - let f = std::mem::transmute::<Box<i32>, fn()>(x); - f() //~ ERROR: tried to treat a memory pointer as a function pointer - } -} diff --git a/src/tools/miri/tests/compile-fail/fn_ptr_offset.rs b/src/tools/miri/tests/compile-fail/fn_ptr_offset.rs deleted file mode 100644 index 45e32142a8..0000000000 --- a/src/tools/miri/tests/compile-fail/fn_ptr_offset.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Validation makes this fail in the wrong place -// compile-flags: -Zmir-emit-validate=0 - -use std::mem; - -fn f() {} - -fn main() { - let x : fn() = f; - let y : *mut u8 = unsafe { mem::transmute(x) }; - let y = y.wrapping_offset(1); - let x : fn() = unsafe { mem::transmute(y) }; - x(); //~ ERROR: tried to use a function pointer after offsetting it -} diff --git a/src/tools/miri/tests/compile-fail/invalid_bool.rs b/src/tools/miri/tests/compile-fail/invalid_bool.rs deleted file mode 100644 index c30c9b439a..0000000000 --- a/src/tools/miri/tests/compile-fail/invalid_bool.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR: invalid boolean value read - if b { unreachable!() } else { unreachable!() } -} diff --git a/src/tools/miri/tests/compile-fail/invalid_enum_discriminant.rs b/src/tools/miri/tests/compile-fail/invalid_enum_discriminant.rs deleted file mode 100644 index 9ce6d44ca4..0000000000 --- a/src/tools/miri/tests/compile-fail/invalid_enum_discriminant.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Validation makes this fail in the wrong place -// compile-flags: -Zmir-emit-validate=0 - -#[repr(C)] -pub enum Foo { - A, B, C, D -} - -fn main() { - let f = unsafe { std::mem::transmute::<i32, Foo>(42) }; - match f { - Foo::A => {}, //~ ERROR invalid enum discriminant value read - Foo::B => {}, - Foo::C => {}, - Foo::D => {}, - } -} diff --git a/src/tools/miri/tests/compile-fail/match_char.rs b/src/tools/miri/tests/compile-fail/match_char.rs deleted file mode 100644 index 4fee6e692b..0000000000 --- a/src/tools/miri/tests/compile-fail/match_char.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - assert!(std::char::from_u32(-1_i32 as u32).is_none()); - match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295 - 'a' => {}, - 'b' => {}, - _ => {}, - } -} diff --git a/src/tools/miri/tests/compile-fail/memleak.rs b/src/tools/miri/tests/compile-fail/memleak.rs deleted file mode 100644 index 71b4e2f442..0000000000 --- a/src/tools/miri/tests/compile-fail/memleak.rs +++ /dev/null @@ -1,5 +0,0 @@ -//error-pattern: the evaluated program leaked memory - -fn main() { - std::mem::forget(Box::new(42)); -} diff --git a/src/tools/miri/tests/compile-fail/memleak_rc.rs b/src/tools/miri/tests/compile-fail/memleak_rc.rs deleted file mode 100644 index b2bc6722af..0000000000 --- a/src/tools/miri/tests/compile-fail/memleak_rc.rs +++ /dev/null @@ -1,12 +0,0 @@ -//error-pattern: the evaluated program leaked memory - -use std::rc::Rc; -use std::cell::RefCell; - -struct Dummy(Rc<RefCell<Option<Dummy>>>); - -fn main() { - let x = Dummy(Rc::new(RefCell::new(None))); - let y = Dummy(x.0.clone()); - *x.0.borrow_mut() = Some(y); -} diff --git a/src/tools/miri/tests/compile-fail/modifying_constants.rs b/src/tools/miri/tests/compile-fail/modifying_constants.rs deleted file mode 100644 index cb2e7217d5..0000000000 --- a/src/tools/miri/tests/compile-fail/modifying_constants.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - let x = &1; // the `&1` is promoted to a constant, but it used to be that only the pointer is marked static, not the pointee - let y = unsafe { &mut *(x as *const i32 as *mut i32) }; - *y = 42; //~ ERROR tried to modify constant memory - assert_eq!(*x, 42); -} diff --git a/src/tools/miri/tests/compile-fail/never_say_never.rs b/src/tools/miri/tests/compile-fail/never_say_never.rs deleted file mode 100644 index 3e80cb20b3..0000000000 --- a/src/tools/miri/tests/compile-fail/never_say_never.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(never_type)] -#![allow(unreachable_code)] - -fn main() { - let y = &5; - let x: ! = unsafe { - *(y as *const _ as *const !) //~ ERROR tried to access a dead local variable - }; - f(x) -} - -fn f(x: !) -> ! { x } diff --git a/src/tools/miri/tests/compile-fail/never_transmute_humans.rs b/src/tools/miri/tests/compile-fail/never_transmute_humans.rs deleted file mode 100644 index 38406eeb3f..0000000000 --- a/src/tools/miri/tests/compile-fail/never_transmute_humans.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(never_type)] -#![allow(unreachable_code)] -#![allow(unused_variables)] - -struct Human; - -fn main() { - let x: ! = unsafe { - std::mem::transmute::<Human, !>(Human) //~ ERROR entered unreachable code - }; - f(x) -} - -fn f(x: !) -> ! { x } diff --git a/src/tools/miri/tests/compile-fail/never_transmute_void.rs b/src/tools/miri/tests/compile-fail/never_transmute_void.rs deleted file mode 100644 index 3fffacc55e..0000000000 --- a/src/tools/miri/tests/compile-fail/never_transmute_void.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(never_type)] -#![allow(unreachable_code)] -#![allow(unused_variables)] - -enum Void {} - -fn f(v: Void) -> ! { - match v {} -} - -fn main() { - let v: Void = unsafe { - std::mem::transmute::<(), Void>(()) //~ ERROR entered unreachable code - }; - f(v); -} diff --git a/src/tools/miri/tests/compile-fail/null_pointer_deref.rs b/src/tools/miri/tests/compile-fail/null_pointer_deref.rs deleted file mode 100644 index 5a26856eba..0000000000 --- a/src/tools/miri/tests/compile-fail/null_pointer_deref.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR: invalid use of NULL pointer - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/oom.rs b/src/tools/miri/tests/compile-fail/oom.rs deleted file mode 100644 index d4aebb912e..0000000000 --- a/src/tools/miri/tests/compile-fail/oom.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(custom_attribute, attr_literals)] -#![miri(memory_size=4095)] - -fn main() { - let _x = [42; 1024]; - //~^ERROR tried to allocate 4096 more bytes, but only -} diff --git a/src/tools/miri/tests/compile-fail/oom2.rs b/src/tools/miri/tests/compile-fail/oom2.rs deleted file mode 100644 index f439ac8c13..0000000000 --- a/src/tools/miri/tests/compile-fail/oom2.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Validation forces more allocation; disable it. -// compile-flags: -Zmir-emit-validate=0 -#![feature(box_syntax, custom_attribute, attr_literals)] -#![miri(memory_size=2048)] - -fn main() { - loop { - ::std::mem::forget(box 42); //~ ERROR tried to allocate 4 more bytes - } -} diff --git a/src/tools/miri/tests/compile-fail/out_of_bounds_ptr_1.rs b/src/tools/miri/tests/compile-fail/out_of_bounds_ptr_1.rs deleted file mode 100644 index 8dce7e5786..0000000000 --- a/src/tools/miri/tests/compile-fail/out_of_bounds_ptr_1.rs +++ /dev/null @@ -1,8 +0,0 @@ -// error-pattern: pointer computed at offset 5, outside bounds of allocation -fn main() { - let v = [0i8; 4]; - let x = &v as *const i8; - // The error is inside another function, so we cannot match it by line - let x = unsafe { x.offset(5) }; - panic!("this should never print: {:?}", x); -} diff --git a/src/tools/miri/tests/compile-fail/out_of_bounds_ptr_2.rs b/src/tools/miri/tests/compile-fail/out_of_bounds_ptr_2.rs deleted file mode 100644 index f754649457..0000000000 --- a/src/tools/miri/tests/compile-fail/out_of_bounds_ptr_2.rs +++ /dev/null @@ -1,7 +0,0 @@ -// error-pattern: overflowing math -fn main() { - let v = [0i8; 4]; - let x = &v as *const i8; - let x = unsafe { x.offset(-1) }; - panic!("this should never print: {:?}", x); -} diff --git a/src/tools/miri/tests/compile-fail/out_of_bounds_read.rs b/src/tools/miri/tests/compile-fail/out_of_bounds_read.rs deleted file mode 100644 index 8c56b14bdf..0000000000 --- a/src/tools/miri/tests/compile-fail/out_of_bounds_read.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let v: Vec<u8> = vec![1, 2]; - let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR: which has size 2 - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/out_of_bounds_read2.rs b/src/tools/miri/tests/compile-fail/out_of_bounds_read2.rs deleted file mode 100644 index d29b22ffb2..0000000000 --- a/src/tools/miri/tests/compile-fail/out_of_bounds_read2.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let v: Vec<u8> = vec![1, 2]; - let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR: memory access at offset 6, outside bounds of allocation - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/overflowing-rsh-2.rs b/src/tools/miri/tests/compile-fail/overflowing-rsh-2.rs deleted file mode 100644 index ac09a1740c..0000000000 --- a/src/tools/miri/tests/compile-fail/overflowing-rsh-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(exceeding_bitshifts, const_err)] - -fn main() { - // Make sure we catch overflows that would be hidden by first casting the RHS to u32 - let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ Overflow(Shr) -} diff --git a/src/tools/miri/tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_undefined.rs b/src/tools/miri/tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_undefined.rs deleted file mode 100644 index 50f51d0ba9..0000000000 --- a/src/tools/miri/tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_undefined.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn main() { - let mut p = &42; - unsafe { - let ptr: *mut _ = &mut p; - *(ptr as *mut u8) = 123; // if we ever support 8 bit pointers, this is gonna cause - // "attempted to interpret some raw bytes as a pointer address" instead of - // "attempted to read undefined bytes" - } - let x = *p; //~ ERROR: attempted to read undefined bytes - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/panic.rs b/src/tools/miri/tests/compile-fail/panic.rs deleted file mode 100644 index 80149eeffa..0000000000 --- a/src/tools/miri/tests/compile-fail/panic.rs +++ /dev/null @@ -1,7 +0,0 @@ -// FIXME: Something in panic handling fails validation with full-MIR -// compile-flags: -Zmir-emit-validate=0 -//error-pattern: the evaluated program panicked - -fn main() { - assert_eq!(5, 6); -} diff --git a/src/tools/miri/tests/compile-fail/pointer_byte_read_1.rs b/src/tools/miri/tests/compile-fail/pointer_byte_read_1.rs deleted file mode 100644 index 342eb28a97..0000000000 --- a/src/tools/miri/tests/compile-fail/pointer_byte_read_1.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let x = 13; - let y = &x; - let z = &y as *const &i32 as *const usize; - let ptr_bytes = unsafe { *z }; // the actual deref is fine, because we read the entire pointer at once - let _ = ptr_bytes % 432; //~ ERROR: tried to access part of a pointer value as raw bytes -} diff --git a/src/tools/miri/tests/compile-fail/pointer_byte_read_2.rs b/src/tools/miri/tests/compile-fail/pointer_byte_read_2.rs deleted file mode 100644 index b0f619332e..0000000000 --- a/src/tools/miri/tests/compile-fail/pointer_byte_read_2.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let x = 13; - let y = &x; - let z = &y as *const &i32 as *const u8; - // the deref fails, because we are reading only a part of the pointer - let _ = unsafe { *z }; //~ ERROR: tried to access part of a pointer value as raw bytes -} diff --git a/src/tools/miri/tests/compile-fail/pointers_to_different_allocations_are_unorderable.rs b/src/tools/miri/tests/compile-fail/pointers_to_different_allocations_are_unorderable.rs deleted file mode 100644 index 245b7527c5..0000000000 --- a/src/tools/miri/tests/compile-fail/pointers_to_different_allocations_are_unorderable.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let x: *const u8 = &1; - let y: *const u8 = &2; - if x < y { //~ ERROR: attempted to do invalid arithmetic on pointers - unreachable!() - } -} diff --git a/src/tools/miri/tests/compile-fail/ptr_bitops.rs b/src/tools/miri/tests/compile-fail/ptr_bitops.rs deleted file mode 100644 index 78fd8e912b..0000000000 --- a/src/tools/miri/tests/compile-fail/ptr_bitops.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let bytes = [0i8, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - let one = bytes.as_ptr().wrapping_offset(1); - let three = bytes.as_ptr().wrapping_offset(3); - let res = (one as usize) | (three as usize); //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes - println!("{}", res); -} diff --git a/src/tools/miri/tests/compile-fail/ptr_int_cast.rs b/src/tools/miri/tests/compile-fail/ptr_int_cast.rs deleted file mode 100644 index 396c71ebb0..0000000000 --- a/src/tools/miri/tests/compile-fail/ptr_int_cast.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - let x = &1; - // Casting down to u8 and back up to a pointer loses too much precision; this must not work. - let x = x as *const i32; - let x = x as u8; //~ ERROR: a raw memory access tried to access part of a pointer value as raw bytes - let x = x as *const i32; - let _ = unsafe { *x }; -} diff --git a/src/tools/miri/tests/compile-fail/ptr_offset_overflow.rs b/src/tools/miri/tests/compile-fail/ptr_offset_overflow.rs deleted file mode 100644 index 578468c339..0000000000 --- a/src/tools/miri/tests/compile-fail/ptr_offset_overflow.rs +++ /dev/null @@ -1,6 +0,0 @@ -//error-pattern: overflowing math -fn main() { - let v = [1i8, 2]; - let x = &v[1] as *const i8; - let _ = unsafe { x.offset(isize::min_value()) }; -} diff --git a/src/tools/miri/tests/compile-fail/reading_half_a_pointer.rs b/src/tools/miri/tests/compile-fail/reading_half_a_pointer.rs deleted file mode 100644 index cc41b52f33..0000000000 --- a/src/tools/miri/tests/compile-fail/reading_half_a_pointer.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![allow(dead_code)] - -// We use packed structs to get around alignment restrictions -#[repr(packed)] -struct Data { - pad: u8, - ptr: &'static i32, -} - -// But we need to gurantee some alignment -struct Wrapper { - align: u64, - data: Data, -} - -static G : i32 = 0; - -fn main() { - let mut w = Wrapper { align: 0, data: Data { pad: 0, ptr: &G } }; - - // Get a pointer to the beginning of the Data struct (one u8 byte, then the pointer bytes). - // Thanks to the wrapper, we know this is aligned-enough to perform a load at ptr size. - // We load at pointer type, so having a relocation is okay -- but here, the relocation - // starts 1 byte to the right, so using it would actually be wrong! - let d_alias = &mut w.data as *mut _ as *mut *const u8; - unsafe { - let _x = *d_alias; //~ ERROR: tried to access part of a pointer value as raw bytes - } -} diff --git a/src/tools/miri/tests/compile-fail/reallocate-bad-alignment-2.rs b/src/tools/miri/tests/compile-fail/reallocate-bad-alignment-2.rs deleted file mode 100644 index cd6214440f..0000000000 --- a/src/tools/miri/tests/compile-fail/reallocate-bad-alignment-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -// error-pattern: tried to deallocate or reallocate using incorrect alignment or size - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap(); - // Try realloc with a too big alignment. - let _y = Heap.realloc(x, Layout::from_size_align_unchecked(1, 2), Layout::from_size_align_unchecked(1, 1)).unwrap(); - } -} diff --git a/src/tools/miri/tests/compile-fail/reallocate-bad-alignment.rs b/src/tools/miri/tests/compile-fail/reallocate-bad-alignment.rs deleted file mode 100644 index da5fe1d819..0000000000 --- a/src/tools/miri/tests/compile-fail/reallocate-bad-alignment.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -// error-pattern: tried to deallocate or reallocate using incorrect alignment or size - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 2)).unwrap(); - // Try realloc with a too small alignment. - let _y = Heap.realloc(x, Layout::from_size_align_unchecked(1, 1), Layout::from_size_align_unchecked(1, 2)).unwrap(); - } -} diff --git a/src/tools/miri/tests/compile-fail/reallocate-bad-size.rs b/src/tools/miri/tests/compile-fail/reallocate-bad-size.rs deleted file mode 100644 index 953178742c..0000000000 --- a/src/tools/miri/tests/compile-fail/reallocate-bad-size.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -// error-pattern: tried to deallocate or reallocate using incorrect alignment or size - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap(); - let _y = Heap.realloc(x, Layout::from_size_align_unchecked(2, 1), Layout::from_size_align_unchecked(1, 1)).unwrap(); - } -} diff --git a/src/tools/miri/tests/compile-fail/reallocate-change-alloc.rs b/src/tools/miri/tests/compile-fail/reallocate-change-alloc.rs deleted file mode 100644 index 290c966a2b..0000000000 --- a/src/tools/miri/tests/compile-fail/reallocate-change-alloc.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap(); - let _y = Heap.realloc(x, Layout::from_size_align_unchecked(1, 1), Layout::from_size_align_unchecked(1, 1)).unwrap(); - let _z = *x; //~ ERROR: dangling pointer was dereferenced - } -} diff --git a/src/tools/miri/tests/compile-fail/reallocate-dangling.rs b/src/tools/miri/tests/compile-fail/reallocate-dangling.rs deleted file mode 100644 index 6225879a5a..0000000000 --- a/src/tools/miri/tests/compile-fail/reallocate-dangling.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(alloc, allocator_api)] - -extern crate alloc; - -use alloc::heap::Heap; -use alloc::allocator::*; - -// error-pattern: dangling pointer was dereferenced - -fn main() { - unsafe { - let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap(); - Heap.dealloc(x, Layout::from_size_align_unchecked(1, 1)); - Heap.realloc(x, Layout::from_size_align_unchecked(1, 1), Layout::from_size_align_unchecked(1, 1)); - } -} diff --git a/src/tools/miri/tests/compile-fail/reference_to_packed.rs b/src/tools/miri/tests/compile-fail/reference_to_packed.rs deleted file mode 100644 index cc927f8795..0000000000 --- a/src/tools/miri/tests/compile-fail/reference_to_packed.rs +++ /dev/null @@ -1,19 +0,0 @@ -// This should fail even without validation -// compile-flags: -Zmir-emit-validate=0 - -#![allow(dead_code, unused_variables)] - -#[repr(packed)] -struct Foo { - x: i32, - y: i32, -} - -fn main() { - let foo = Foo { - x: 42, - y: 99, - }; - let p = &foo.x; - let i = *p; //~ ERROR tried to access memory with alignment 1, but alignment 4 is required -} diff --git a/src/tools/miri/tests/compile-fail/repeat.rs b/src/tools/miri/tests/compile-fail/repeat.rs deleted file mode 100644 index abe89e233e..0000000000 --- a/src/tools/miri/tests/compile-fail/repeat.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let data: [u8; std::usize::MAX] = [42; std::usize::MAX]; - //~^ ERROR: rustc layout computation failed: SizeOverflow([u8; - assert_eq!(data.len(), 1024); -} diff --git a/src/tools/miri/tests/compile-fail/repeat2.rs b/src/tools/miri/tests/compile-fail/repeat2.rs deleted file mode 100644 index d489342b85..0000000000 --- a/src/tools/miri/tests/compile-fail/repeat2.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let data: [u8; 1024*1024*1024] = [42; 1024*1024*1024]; - //~^ ERROR: reached the configured maximum execution time - assert_eq!(data.len(), 1024*1024*1024); -} diff --git a/src/tools/miri/tests/compile-fail/stack_free.rs b/src/tools/miri/tests/compile-fail/stack_free.rs deleted file mode 100644 index 96006c884e..0000000000 --- a/src/tools/miri/tests/compile-fail/stack_free.rs +++ /dev/null @@ -1,7 +0,0 @@ -// error-pattern: tried to deallocate Stack memory but gave Machine(Rust) as the kind - -fn main() { - let x = 42; - let bad_box = unsafe { std::mem::transmute::<&i32, Box<i32>>(&x) }; - drop(bad_box); -} diff --git a/src/tools/miri/tests/compile-fail/stack_limit.rs b/src/tools/miri/tests/compile-fail/stack_limit.rs deleted file mode 100644 index c6aaf80e6a..0000000000 --- a/src/tools/miri/tests/compile-fail/stack_limit.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![feature(custom_attribute, attr_literals)] -#![miri(stack_limit=16)] - -//error-pattern: reached the configured maximum number of stack frames - -fn bar() { - foo(); -} - -fn foo() { - cake(); -} - -fn cake() { - bar(); -} - -fn main() { - bar(); -} diff --git a/src/tools/miri/tests/compile-fail/static_memory_modification.rs b/src/tools/miri/tests/compile-fail/static_memory_modification.rs deleted file mode 100644 index 11961becb2..0000000000 --- a/src/tools/miri/tests/compile-fail/static_memory_modification.rs +++ /dev/null @@ -1,9 +0,0 @@ -static X: usize = 5; - -#[allow(mutable_transmutes)] -fn main() { - unsafe { - *std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR: tried to modify constant memory - assert_eq!(X, 6); - } -} diff --git a/src/tools/miri/tests/compile-fail/static_memory_modification2.rs b/src/tools/miri/tests/compile-fail/static_memory_modification2.rs deleted file mode 100644 index f030a9c281..0000000000 --- a/src/tools/miri/tests/compile-fail/static_memory_modification2.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Validation detects that we are casting & to &mut and so it changes why we fail -// compile-flags: -Zmir-emit-validate=0 - -use std::mem::transmute; - -#[allow(mutable_transmutes)] -fn main() { - unsafe { - let s = "this is a test"; - transmute::<&[u8], &mut [u8]>(s.as_bytes())[4] = 42; //~ ERROR: tried to modify constant memory - } -} diff --git a/src/tools/miri/tests/compile-fail/static_memory_modification3.rs b/src/tools/miri/tests/compile-fail/static_memory_modification3.rs deleted file mode 100644 index 743fbe60ef..0000000000 --- a/src/tools/miri/tests/compile-fail/static_memory_modification3.rs +++ /dev/null @@ -1,9 +0,0 @@ -use std::mem::transmute; - -#[allow(mutable_transmutes)] -fn main() { - unsafe { - let bs = b"this is a test"; - transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR: tried to modify constant memory - } -} diff --git a/src/tools/miri/tests/compile-fail/timeout.rs b/src/tools/miri/tests/compile-fail/timeout.rs deleted file mode 100644 index edd4c31866..0000000000 --- a/src/tools/miri/tests/compile-fail/timeout.rs +++ /dev/null @@ -1,9 +0,0 @@ -//error-pattern: reached the configured maximum execution time -#![feature(custom_attribute, attr_literals)] -#![miri(step_limit=1000)] - -fn main() { - for i in 0..1000000 { - assert!(i < 1000); - } -} diff --git a/src/tools/miri/tests/compile-fail/transmute-pair-undef.rs b/src/tools/miri/tests/compile-fail/transmute-pair-undef.rs deleted file mode 100644 index acc6098af7..0000000000 --- a/src/tools/miri/tests/compile-fail/transmute-pair-undef.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![feature(core_intrinsics)] - -use std::mem; - -fn main() { - let x: Option<Box<[u8]>> = unsafe { - let z = std::intrinsics::add_with_overflow(0usize, 0usize); - std::mem::transmute::<(usize, bool), Option<Box<[u8]>>>(z) - }; - let y = &x; - // Now read this bytewise. There should be (ptr_size+1) def bytes followed by (ptr_size-1) undef bytes (the padding after the bool) in there. - let z : *const u8 = y as *const _ as *const _; - let first_undef = mem::size_of::<usize>() as isize + 1; - for i in 0..first_undef { - let byte = unsafe { *z.offset(i) }; - assert_eq!(byte, 0); - } - let v = unsafe { *z.offset(first_undef) }; - if v == 0 {} //~ ERROR attempted to read undefined bytes -} diff --git a/src/tools/miri/tests/compile-fail/transmute_fat.rs b/src/tools/miri/tests/compile-fail/transmute_fat.rs deleted file mode 100644 index 7d5d95a1dc..0000000000 --- a/src/tools/miri/tests/compile-fail/transmute_fat.rs +++ /dev/null @@ -1,15 +0,0 @@ -// This should fail even without validation -// compile-flags: -Zmir-emit-validate=0 -#![feature(i128_type)] - -fn main() { - #[cfg(target_pointer_width="64")] - let bad = unsafe { - std::mem::transmute::<&[u8], u128>(&[1u8]) - }; - #[cfg(target_pointer_width="32")] - let bad = unsafe { - std::mem::transmute::<&[u8], u64>(&[1u8]) - }; - bad + 1; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes -} diff --git a/src/tools/miri/tests/compile-fail/transmute_fat2.rs b/src/tools/miri/tests/compile-fail/transmute_fat2.rs deleted file mode 100644 index 028ed613ee..0000000000 --- a/src/tools/miri/tests/compile-fail/transmute_fat2.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(i128_type)] - -fn main() { - #[cfg(target_pointer_width="64")] - let bad = unsafe { - std::mem::transmute::<u128, &[u8]>(42) - }; - #[cfg(target_pointer_width="32")] - let bad = unsafe { - std::mem::transmute::<u64, &[u8]>(42) - }; - bad[0]; //~ ERROR index out of bounds: the len is 0 but the index is 0 -} diff --git a/src/tools/miri/tests/compile-fail/unaligned_ptr_cast.rs b/src/tools/miri/tests/compile-fail/unaligned_ptr_cast.rs deleted file mode 100644 index 8ad1b32325..0000000000 --- a/src/tools/miri/tests/compile-fail/unaligned_ptr_cast.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - let x = &2u16; - let x = x as *const _ as *const u32; - // This must fail because alignment is violated - let _x = unsafe { *x }; //~ ERROR: tried to access memory with alignment 2, but alignment 4 is required -} diff --git a/src/tools/miri/tests/compile-fail/unaligned_ptr_cast2.rs b/src/tools/miri/tests/compile-fail/unaligned_ptr_cast2.rs deleted file mode 100644 index 15fb7dd313..0000000000 --- a/src/tools/miri/tests/compile-fail/unaligned_ptr_cast2.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let x = &2u16; - let x = x as *const _ as *const *const u8; - // This must fail because alignment is violated. Test specifically for loading pointers, which have special code - // in miri's memory. - let _x = unsafe { *x }; //~ ERROR: tried to access memory with alignment 2, but alignment -} diff --git a/src/tools/miri/tests/compile-fail/unaligned_ptr_cast_zst.rs b/src/tools/miri/tests/compile-fail/unaligned_ptr_cast_zst.rs deleted file mode 100644 index fc60384068..0000000000 --- a/src/tools/miri/tests/compile-fail/unaligned_ptr_cast_zst.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - let x = &2u16; - let x = x as *const _ as *const [u32; 0]; - // This must fail because alignment is violated. Test specifically for loading ZST. - let _x = unsafe { *x }; //~ ERROR: tried to access memory with alignment 2, but alignment 4 is required -} diff --git a/src/tools/miri/tests/compile-fail/validation_aliasing_mut1.rs b/src/tools/miri/tests/compile-fail/validation_aliasing_mut1.rs deleted file mode 100644 index 86aa57447f..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_aliasing_mut1.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - pub fn safe(x: &mut i32, y: &mut i32) {} //~ ERROR: in conflict with lock WriteLock -} - -fn main() { - let x = &mut 0 as *mut _; - unsafe { safe::safe(&mut *x, &mut *x) }; -} diff --git a/src/tools/miri/tests/compile-fail/validation_aliasing_mut2.rs b/src/tools/miri/tests/compile-fail/validation_aliasing_mut2.rs deleted file mode 100644 index ed7497e5e5..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_aliasing_mut2.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - pub fn safe(x: &i32, y: &mut i32) {} //~ ERROR: in conflict with lock ReadLock -} - -fn main() { - let x = &mut 0 as *mut _; - unsafe { safe::safe(&*x, &mut *x) }; -} diff --git a/src/tools/miri/tests/compile-fail/validation_aliasing_mut3.rs b/src/tools/miri/tests/compile-fail/validation_aliasing_mut3.rs deleted file mode 100644 index 69fbbc167c..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_aliasing_mut3.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - pub fn safe(x: &mut i32, y: &i32) {} //~ ERROR: in conflict with lock WriteLock -} - -fn main() { - let x = &mut 0 as *mut _; - unsafe { safe::safe(&mut *x, &*x) }; -} diff --git a/src/tools/miri/tests/compile-fail/validation_aliasing_mut4.rs b/src/tools/miri/tests/compile-fail/validation_aliasing_mut4.rs deleted file mode 100644 index 3dac55aeaa..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_aliasing_mut4.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - use std::cell::Cell; - - // Make sure &mut UnsafeCell also has a lock to it - pub fn safe(x: &mut Cell<i32>, y: &i32) {} //~ ERROR: in conflict with lock WriteLock -} - -fn main() { - let x = &mut 0 as *mut _; - unsafe { safe::safe(&mut *(x as *mut _), &*x) }; -} diff --git a/src/tools/miri/tests/compile-fail/validation_buggy_as_mut_slice.rs b/src/tools/miri/tests/compile-fail/validation_buggy_as_mut_slice.rs deleted file mode 100644 index 98eca8d360..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_buggy_as_mut_slice.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![allow(unused_variables)] - -// For some reason, the error location is different when using fullmir -// error-pattern: in conflict with lock WriteLock - -mod safe { - use std::slice::from_raw_parts_mut; - - pub fn as_mut_slice<T>(self_: &Vec<T>) -> &mut [T] { - unsafe { - from_raw_parts_mut(self_.as_ptr() as *mut T, self_.len()) - } - } -} - -fn main() { - let v = vec![0,1,2]; - let v1_ = safe::as_mut_slice(&v); - let v2_ = safe::as_mut_slice(&v); -} diff --git a/src/tools/miri/tests/compile-fail/validation_buggy_split_at_mut.rs b/src/tools/miri/tests/compile-fail/validation_buggy_split_at_mut.rs deleted file mode 100644 index 9e67b2a4ab..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_buggy_split_at_mut.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - use std::slice::from_raw_parts_mut; - - pub fn split_at_mut<T>(self_: &mut [T], mid: usize) -> (&mut [T], &mut [T]) { - let len = self_.len(); - let ptr = self_.as_mut_ptr(); - - unsafe { - assert!(mid <= len); - - (from_raw_parts_mut(ptr, len - mid), // BUG: should be "mid" instead of "len - mid" - from_raw_parts_mut(ptr.offset(mid as isize), len - mid)) - } - } -} - -fn main() { - let mut array = [1,2,3,4]; - let _x = safe::split_at_mut(&mut array, 0); //~ ERROR: in conflict with lock WriteLock -} diff --git a/src/tools/miri/tests/compile-fail/validation_illegal_write.rs b/src/tools/miri/tests/compile-fail/validation_illegal_write.rs deleted file mode 100644 index 1432f4cc9f..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_illegal_write.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - pub(crate) fn safe(x: &u32) { - let x : &mut u32 = unsafe { &mut *(x as *const _ as *mut _) }; - *x = 42; //~ ERROR: in conflict with lock ReadLock - } -} - -fn main() { - let target = &mut 42; - let target_ref = ⌖ - // do a reborrow, but we keep the lock - safe::safe(&*target); -} diff --git a/src/tools/miri/tests/compile-fail/validation_lock_confusion.rs b/src/tools/miri/tests/compile-fail/validation_lock_confusion.rs deleted file mode 100644 index b352346114..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_lock_confusion.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Make sure validation can handle many overlapping shared borrows for different parts of a data structure -#![allow(unused_variables)] -use std::cell::RefCell; - -fn evil(x: *mut i32) { - unsafe { *x = 0; } //~ ERROR: in conflict with lock WriteLock -} - -fn test(r: &mut RefCell<i32>) { - let x = &*r; // releasing write lock, first suspension recorded - let mut x_ref = x.borrow_mut(); - let x_inner : &mut i32 = &mut *x_ref; // new inner write lock, with same lifetime as outer lock - { - let x_inner_shr = &*x_inner; // releasing inner write lock, recording suspension - let y = &*r; // second suspension for the outer write lock - let x_inner_shr2 = &*x_inner; // 2nd suspension for inner write lock - } - // If the two locks are mixed up, here we should have a write lock, but we do not. - evil(x_inner as *mut _); -} - -fn main() { - test(&mut RefCell::new(0)); -} diff --git a/src/tools/miri/tests/compile-fail/validation_pointer_smuggling.rs b/src/tools/miri/tests/compile-fail/validation_pointer_smuggling.rs deleted file mode 100644 index 3320d2a89d..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_pointer_smuggling.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![allow(unused_variables)] - -static mut PTR: *mut u8 = 0 as *mut _; - -fn fun1(x: &mut u8) { - unsafe { - PTR = x; - } -} - -fn fun2() { - // Now we use a pointer we are not allowed to use - let _x = unsafe { *PTR }; //~ ERROR: in conflict with lock WriteLock -} - -fn main() { - let mut val = 0; - fun1(&mut val); - fun2(); -} diff --git a/src/tools/miri/tests/compile-fail/validation_recover1.rs b/src/tools/miri/tests/compile-fail/validation_recover1.rs deleted file mode 100644 index 55c38a694c..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_recover1.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![allow(unused_variables)] - -#[repr(u32)] -enum Bool { True } - -mod safe { - pub(crate) fn safe(x: &mut super::Bool) { - let x = x as *mut _ as *mut u32; - unsafe { *x = 44; } // out-of-bounds enum discriminant - } -} - -fn main() { - let mut x = Bool::True; - safe::safe(&mut x); //~ ERROR: invalid enum discriminant -} diff --git a/src/tools/miri/tests/compile-fail/validation_recover2.rs b/src/tools/miri/tests/compile-fail/validation_recover2.rs deleted file mode 100644 index 756be9fde6..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_recover2.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - // This makes a ref that was passed to us via &mut alias with things it should not alias with - pub(crate) fn safe(x: &mut &u32, target: &mut u32) { - unsafe { *x = &mut *(target as *mut _); } - } -} - -fn main() { - let target = &mut 42; - let mut target_alias = &42; // initial dummy value - safe::safe(&mut target_alias, target); //~ ERROR: in conflict with lock ReadLock -} diff --git a/src/tools/miri/tests/compile-fail/validation_recover3.rs b/src/tools/miri/tests/compile-fail/validation_recover3.rs deleted file mode 100644 index afe6fe7c0b..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_recover3.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![allow(unused_variables)] - -mod safe { - pub(crate) fn safe(x: *mut u32) { - unsafe { *x = 42; } //~ ERROR: in conflict with lock WriteLock - } -} - -fn main() { - let target = &mut 42u32; - let target2 = target as *mut _; - drop(&mut *target); // reborrow - // Now make sure we still got the lock - safe::safe(target2); -} diff --git a/src/tools/miri/tests/compile-fail/validation_undef.rs b/src/tools/miri/tests/compile-fail/validation_undef.rs deleted file mode 100644 index b889b1ea53..0000000000 --- a/src/tools/miri/tests/compile-fail/validation_undef.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(unused_variables)] -// error-pattern: attempted to read undefined bytes - -mod safe { - use std::mem; - - pub(crate) fn make_float() -> f32 { - unsafe { mem::uninitialized() } - } -} - -fn main() { - let _x = safe::make_float(); -} diff --git a/src/tools/miri/tests/compile-fail/wild_pointer_deref.rs b/src/tools/miri/tests/compile-fail/wild_pointer_deref.rs deleted file mode 100644 index 57da8dfc01..0000000000 --- a/src/tools/miri/tests/compile-fail/wild_pointer_deref.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let p = 44 as *const i32; - let x = unsafe { *p }; //~ ERROR: a memory access tried to interpret some bytes as a pointer - panic!("this should never print: {}", x); -} diff --git a/src/tools/miri/tests/compile-fail/zst.rs b/src/tools/miri/tests/compile-fail/zst.rs deleted file mode 100644 index 3439824047..0000000000 --- a/src/tools/miri/tests/compile-fail/zst.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let x = &() as *const () as *const i32; - let _ = unsafe { *x }; //~ ERROR: tried to access memory with alignment 1, but alignment 4 is required -} diff --git a/src/tools/miri/tests/compiletest.rs b/src/tools/miri/tests/compiletest.rs deleted file mode 100644 index b1ea3fc8b0..0000000000 --- a/src/tools/miri/tests/compiletest.rs +++ /dev/null @@ -1,213 +0,0 @@ -#![feature(slice_concat_ext)] - -extern crate compiletest_rs as compiletest; - -use std::slice::SliceConcatExt; -use std::path::{PathBuf, Path}; -use std::io::Write; -use std::env; - -macro_rules! eprintln { - ($($arg:tt)*) => { - let stderr = std::io::stderr(); - writeln!(stderr.lock(), $($arg)*).unwrap(); - } -} - -fn miri_path() -> PathBuf { - if rustc_test_suite().is_some() { - PathBuf::from(option_env!("MIRI_PATH").unwrap()) - } else { - PathBuf::from(concat!("target/", env!("PROFILE"), "/miri")) - } -} - -fn rustc_test_suite() -> Option<PathBuf> { - option_env!("RUSTC_TEST_SUITE").map(PathBuf::from) -} - -fn rustc_lib_path() -> PathBuf { - option_env!("RUSTC_LIB_PATH").unwrap().into() -} - -fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: bool) { - eprintln!( - "## Running compile-fail tests in {} against miri for target {}", - path, - target - ); - let mut config = compiletest::Config::default().tempdir(); - config.mode = "compile-fail".parse().expect("Invalid mode"); - config.rustc_path = miri_path(); - let mut flags = Vec::new(); - if rustc_test_suite().is_some() { - config.run_lib_path = rustc_lib_path(); - config.compile_lib_path = rustc_lib_path(); - } - // if we are building as part of the rustc test suite, we already have fullmir for everything - if fullmir && rustc_test_suite().is_none() { - if host != target { - // skip fullmir on nonhost - return; - } - let sysroot = std::env::home_dir().unwrap() - .join(".xargo") - .join("HOST"); - config.target_rustcflags = Some(format!("--sysroot {}", sysroot.to_str().unwrap())); - config.src_base = PathBuf::from(path.to_string()); - } else { - config.target_rustcflags = Some(format!("--sysroot {}", sysroot.to_str().unwrap())); - config.src_base = PathBuf::from(path.to_string()); - } - flags.push("-Zmir-emit-validate=1".to_owned()); - config.target_rustcflags = Some(flags.join(" ")); - config.target = target.to_owned(); - compiletest::run_tests(&config); -} - -fn run_pass(path: &str) { - eprintln!("## Running run-pass tests in {} against rustc", path); - let mut config = compiletest::Config::default().tempdir(); - config.mode = "run-pass".parse().expect("Invalid mode"); - config.src_base = PathBuf::from(path); - if let Some(rustc_path) = rustc_test_suite() { - config.rustc_path = rustc_path; - config.run_lib_path = rustc_lib_path(); - config.compile_lib_path = rustc_lib_path(); - config.target_rustcflags = Some(format!("-Dwarnings --sysroot {}", get_sysroot().display())); - } else { - config.target_rustcflags = Some("-Dwarnings".to_owned()); - } - config.host_rustcflags = Some("-Dwarnings".to_string()); - compiletest::run_tests(&config); -} - -fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) { - let opt_str = if opt { " with optimizations" } else { "" }; - eprintln!( - "## Running run-pass tests in {} against miri for target {}{}", - path, - target, - opt_str - ); - let mut config = compiletest::Config::default().tempdir(); - config.mode = "ui".parse().expect("Invalid mode"); - config.src_base = PathBuf::from(path); - config.target = target.to_owned(); - config.host = host.to_owned(); - config.rustc_path = miri_path(); - if rustc_test_suite().is_some() { - config.run_lib_path = rustc_lib_path(); - config.compile_lib_path = rustc_lib_path(); - } - let mut flags = Vec::new(); - // Control miri logging. This is okay despite concurrent test execution as all tests - // will set this env var to the same value. - env::set_var("MIRI_LOG", "warn"); - // if we are building as part of the rustc test suite, we already have fullmir for everything - if fullmir && rustc_test_suite().is_none() { - if host != target { - // skip fullmir on nonhost - return; - } - let sysroot = std::env::home_dir().unwrap() - .join(".xargo") - .join("HOST"); - - flags.push(format!("--sysroot {}", sysroot.to_str().unwrap())); - } - if opt { - flags.push("-Zmir-opt-level=3".to_owned()); - } else { - flags.push("-Zmir-opt-level=0".to_owned()); - // For now, only validate without optimizations. Inlining breaks validation. - flags.push("-Zmir-emit-validate=1".to_owned()); - } - config.target_rustcflags = Some(flags.join(" ")); - compiletest::run_tests(&config); -} - -fn is_target_dir<P: Into<PathBuf>>(path: P) -> bool { - let mut path = path.into(); - path.push("lib"); - path.metadata().map(|m| m.is_dir()).unwrap_or(false) -} - -fn for_all_targets<F: FnMut(String)>(sysroot: &Path, mut f: F) { - let target_dir = sysroot.join("lib").join("rustlib"); - for entry in std::fs::read_dir(target_dir).expect("invalid sysroot") { - let entry = entry.unwrap(); - if !is_target_dir(entry.path()) { - continue; - } - let target = entry.file_name().into_string().unwrap(); - f(target); - } -} - -fn get_sysroot() -> PathBuf { - let sysroot = std::env::var("MIRI_SYSROOT").unwrap_or_else(|_| { - let sysroot = std::process::Command::new("rustc") - .arg("--print") - .arg("sysroot") - .output() - .expect("rustc not found") - .stdout; - String::from_utf8(sysroot).expect("sysroot is not utf8") - }); - PathBuf::from(sysroot.trim()) -} - -fn get_host() -> String { - let rustc = rustc_test_suite().unwrap_or(PathBuf::from("rustc")); - println!("using rustc at {}", rustc.display()); - let host = std::process::Command::new(rustc) - .arg("-vV") - .output() - .expect("rustc not found for -vV") - .stdout; - let host = std::str::from_utf8(&host).expect("sysroot is not utf8"); - let host = host.split("\nhost: ").nth(1).expect( - "no host: part in rustc -vV", - ); - let host = host.split('\n').next().expect("no \n after host"); - String::from(host) -} - -fn run_pass_miri(opt: bool) { - let sysroot = get_sysroot(); - let host = get_host(); - - for_all_targets(&sysroot, |target| { - miri_pass("tests/run-pass", &target, &host, false, opt); - }); - miri_pass("tests/run-pass-fullmir", &host, &host, true, opt); -} - -#[test] -fn run_pass_miri_noopt() { - run_pass_miri(false); -} - -#[test] -#[ignore] // FIXME: Disabled for now, as the optimizer is pretty broken and crashes... -fn run_pass_miri_opt() { - run_pass_miri(true); -} - -#[test] -fn run_pass_rustc() { - run_pass("tests/run-pass"); - run_pass("tests/run-pass-fullmir"); -} - -#[test] -fn compile_fail_miri() { - let sysroot = get_sysroot(); - let host = get_host(); - - for_all_targets(&sysroot, |target| { - compile_fail(&sysroot, "tests/compile-fail", &target, &host, false); - }); - compile_fail(&sysroot, "tests/compile-fail-fullmir", &host, &host, true); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/catch.rs b/src/tools/miri/tests/run-pass-fullmir/catch.rs deleted file mode 100644 index 490f17d4cf..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/catch.rs +++ /dev/null @@ -1,8 +0,0 @@ -//ignore-msvc -use std::panic::{catch_unwind, AssertUnwindSafe}; - -fn main() { - let mut i = 3; - let _ = catch_unwind(AssertUnwindSafe(|| {i -= 2;} )); - println!("{}", i); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/catch.stdout b/src/tools/miri/tests/run-pass-fullmir/catch.stdout deleted file mode 100644 index d00491fd7e..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/catch.stdout +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/src/tools/miri/tests/run-pass-fullmir/format.rs b/src/tools/miri/tests/run-pass-fullmir/format.rs deleted file mode 100644 index a14d7054e7..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/format.rs +++ /dev/null @@ -1,4 +0,0 @@ -//ignore-msvc -fn main() { - println!("Hello {}", 13); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/format.stdout b/src/tools/miri/tests/run-pass-fullmir/format.stdout deleted file mode 100644 index e193b8ae89..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/format.stdout +++ /dev/null @@ -1 +0,0 @@ -Hello 13 diff --git a/src/tools/miri/tests/run-pass-fullmir/from_utf8.rs b/src/tools/miri/tests/run-pass-fullmir/from_utf8.rs deleted file mode 100644 index c5d4abcfda..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/from_utf8.rs +++ /dev/null @@ -1,4 +0,0 @@ -//ignore-msvc -fn main() { - let _ = ::std::str::from_utf8(b"a"); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/hashmap.rs b/src/tools/miri/tests/run-pass-fullmir/hashmap.rs deleted file mode 100644 index 99f05e2598..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/hashmap.rs +++ /dev/null @@ -1,26 +0,0 @@ -//ignore-msvc -use std::collections::{self, HashMap}; -use std::hash::BuildHasherDefault; - -fn main() { - let mut map : HashMap<i32, i32, BuildHasherDefault<collections::hash_map::DefaultHasher>> = Default::default(); - map.insert(0, 0); - assert_eq!(map.values().fold(0, |x, y| x+y), 0); - - let table_base = map.get(&0).unwrap() as *const _; - - let num = 22; // large enough to trigger a resize - for i in 1..num { - map.insert(i, i); - } - assert!(table_base != map.get(&0).unwrap() as *const _); // make sure relocation happened - assert_eq!(map.values().fold(0, |x, y| x+y), num*(num-1)/2); // check the right things are in the table now - - // Inserting again replaces the existing entries - for i in 0..num { - map.insert(i, num-1-i); - } - assert_eq!(map.values().fold(0, |x, y| x+y), num*(num-1)/2); - - // TODO: Test Entry API -} diff --git a/src/tools/miri/tests/run-pass-fullmir/heap.rs b/src/tools/miri/tests/run-pass-fullmir/heap.rs deleted file mode 100644 index 917d51d0e4..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/heap.rs +++ /dev/null @@ -1,35 +0,0 @@ -//ignore-msvc -#![feature(box_syntax)] - -fn make_box() -> Box<(i16, i16)> { - Box::new((1, 2)) -} - -fn make_box_syntax() -> Box<(i16, i16)> { - box (1, 2) -} - -fn allocate_reallocate() { - let mut s = String::new(); - - // 6 byte heap alloc (__rust_allocate) - s.push_str("foobar"); - assert_eq!(s.len(), 6); - assert_eq!(s.capacity(), 6); - - // heap size doubled to 12 (__rust_reallocate) - s.push_str("baz"); - assert_eq!(s.len(), 9); - assert_eq!(s.capacity(), 12); - - // heap size reduced to 9 (__rust_reallocate) - s.shrink_to_fit(); - assert_eq!(s.len(), 9); - assert_eq!(s.capacity(), 9); -} - -fn main() { - assert_eq!(*make_box(), (1, 2)); - assert_eq!(*make_box_syntax(), (1, 2)); - allocate_reallocate(); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/hello.rs b/src/tools/miri/tests/run-pass-fullmir/hello.rs deleted file mode 100644 index 986efcaf90..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/hello.rs +++ /dev/null @@ -1,4 +0,0 @@ -//ignore-msvc -fn main() { - println!("Hello, world!"); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/hello.stdout b/src/tools/miri/tests/run-pass-fullmir/hello.stdout deleted file mode 100644 index af5626b4a1..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/hello.stdout +++ /dev/null @@ -1 +0,0 @@ -Hello, world! diff --git a/src/tools/miri/tests/run-pass-fullmir/integer-ops.rs b/src/tools/miri/tests/run-pass-fullmir/integer-ops.rs deleted file mode 100644 index 97c694fd56..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/integer-ops.rs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// FIXME: remove -Zmir-opt-level once https://github.com/rust-lang/rust/issues/43359 is fixed -// compile-flags: -Zmir-opt-level=0 - -//ignore-msvc -use std::i32; - -pub fn main() { - // This tests that do (not) do sign extension properly when loading integers - assert_eq!(u32::max_value() as i64, 4294967295); - assert_eq!(i32::min_value() as i64, -2147483648); - - assert_eq!(i8::min_value(), -128); - - assert_eq!(i8::max_value(), 127); - - assert_eq!(i32::from_str_radix("A", 16), Ok(10)); - - let n = -0b1000_0000i8; - assert_eq!(n.count_ones(), 1); - - let n = -0b1000_0000i8; - assert_eq!(n.count_zeros(), 7); - - let n = -1i16; - assert_eq!(n.leading_zeros(), 0); - - let n = -4i8; - assert_eq!(n.trailing_zeros(), 2); - - let n = 0x0123456789ABCDEFi64; - let m = -0x76543210FEDCBA99i64; - assert_eq!(n.rotate_left(32), m); - - let n = 0x0123456789ABCDEFi64; - let m = -0xFEDCBA987654322i64; - assert_eq!(n.rotate_right(4), m); - - let n = 0x0123456789ABCDEFi64; - let m = -0x1032547698BADCFFi64; - assert_eq!(n.swap_bytes(), m); - - let n = 0x0123456789ABCDEFi64; - if cfg!(target_endian = "big") { - assert_eq!(i64::from_be(n), n) - } else { - assert_eq!(i64::from_be(n), n.swap_bytes()) - } - - let n = 0x0123456789ABCDEFi64; - if cfg!(target_endian = "little") { - assert_eq!(i64::from_le(n), n) - } else { - assert_eq!(i64::from_le(n), n.swap_bytes()) - } - - let n = 0x0123456789ABCDEFi64; - if cfg!(target_endian = "big") { - assert_eq!(n.to_be(), n) - } else { - assert_eq!(n.to_be(), n.swap_bytes()) - } - - let n = 0x0123456789ABCDEFi64; - if cfg!(target_endian = "little") { - assert_eq!(n.to_le(), n) - } else { - assert_eq!(n.to_le(), n.swap_bytes()) - } - - assert_eq!(7i16.checked_add(32760), Some(32767)); - assert_eq!(8i16.checked_add(32760), None); - - assert_eq!((-127i8).checked_sub(1), Some(-128)); - assert_eq!((-128i8).checked_sub(1), None); - - assert_eq!(6i8.checked_mul(21), Some(126)); - assert_eq!(6i8.checked_mul(22), None); - - assert_eq!((-127i8).checked_div(-1), Some(127)); - assert_eq!((-128i8).checked_div(-1), None); - assert_eq!((1i8).checked_div(0), None); - - assert_eq!(5i32.checked_rem(2), Some(1)); - assert_eq!(5i32.checked_rem(0), None); - assert_eq!(i32::MIN.checked_rem(-1), None); - - assert_eq!(5i32.checked_neg(), Some(-5)); - assert_eq!(i32::MIN.checked_neg(), None); - - assert_eq!(0x10i32.checked_shl(4), Some(0x100)); - assert_eq!(0x10i32.checked_shl(33), None); - - assert_eq!(0x10i32.checked_shr(4), Some(0x1)); - assert_eq!(0x10i32.checked_shr(33), None); - - assert_eq!((-5i32).checked_abs(), Some(5)); - assert_eq!(i32::MIN.checked_abs(), None); - - assert_eq!(100i8.saturating_add(1), 101); - assert_eq!(100i8.saturating_add(127), 127); - - assert_eq!(100i8.saturating_sub(127), -27); - assert_eq!((-100i8).saturating_sub(127), -128); - - assert_eq!(100i32.saturating_mul(127), 12700); - assert_eq!((1i32 << 23).saturating_mul(1 << 23), i32::MAX); - assert_eq!((-1i32 << 23).saturating_mul(1 << 23), i32::MIN); - - assert_eq!(100i8.wrapping_add(27), 127); - assert_eq!(100i8.wrapping_add(127), -29); - - assert_eq!(0i8.wrapping_sub(127), -127); - assert_eq!((-2i8).wrapping_sub(127), 127); - - assert_eq!(10i8.wrapping_mul(12), 120); - assert_eq!(11i8.wrapping_mul(12), -124); - - assert_eq!(100u8.wrapping_div(10), 10); - assert_eq!((-128i8).wrapping_div(-1), -128); - - assert_eq!(100i8.wrapping_rem(10), 0); - assert_eq!((-128i8).wrapping_rem(-1), 0); - - assert_eq!(100i8.wrapping_neg(), -100); - assert_eq!((-128i8).wrapping_neg(), -128); - - assert_eq!((-1i8).wrapping_shl(7), -128); - assert_eq!((-1i8).wrapping_shl(8), -1); - - assert_eq!((-128i8).wrapping_shr(7), -1); - assert_eq!((-128i8).wrapping_shr(8), -128); - - assert_eq!(100i8.wrapping_abs(), 100); - assert_eq!((-100i8).wrapping_abs(), 100); - assert_eq!((-128i8).wrapping_abs(), -128); - assert_eq!((-128i8).wrapping_abs() as u8, 128); - - assert_eq!(5i32.overflowing_add(2), (7, false)); - assert_eq!(i32::MAX.overflowing_add(1), (i32::MIN, true)); - - assert_eq!(5i32.overflowing_sub(2), (3, false)); - assert_eq!(i32::MIN.overflowing_sub(1), (i32::MAX, true)); - - assert_eq!(5i32.overflowing_mul(2), (10, false)); - assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true)); - - assert_eq!(5i32.overflowing_div(2), (2, false)); - assert_eq!(i32::MIN.overflowing_div(-1), (i32::MIN, true)); - - assert_eq!(5i32.overflowing_rem(2), (1, false)); - assert_eq!(i32::MIN.overflowing_rem(-1), (0, true)); - - assert_eq!(2i32.overflowing_neg(), (-2, false)); - assert_eq!(i32::MIN.overflowing_neg(), (i32::MIN, true)); - - assert_eq!(0x10i32.overflowing_shl(4), (0x100, false)); - assert_eq!(0x10i32.overflowing_shl(36), (0x100, true)); - - assert_eq!(0x10i32.overflowing_shr(4), (0x1, false)); - assert_eq!(0x10i32.overflowing_shr(36), (0x1, true)); - - assert_eq!(10i8.overflowing_abs(), (10,false)); - assert_eq!((-10i8).overflowing_abs(), (10,false)); - assert_eq!((-128i8).overflowing_abs(), (-128,true)); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/issue-15080.rs b/src/tools/miri/tests/run-pass-fullmir/issue-15080.rs deleted file mode 100644 index 4a84f2bc5d..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/issue-15080.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//ignore-msvc - -#![feature(slice_patterns)] - -fn main() { - let mut x: &[_] = &[1, 2, 3, 4]; - - let mut result = vec!(); - loop { - x = match *x { - [1, n, 3, ref rest..] => { - result.push(n); - rest - } - [n, ref rest..] => { - result.push(n); - rest - } - [] => - break - } - } - assert_eq!(result, [2, 4]); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/issue-3794.rs b/src/tools/miri/tests/run-pass-fullmir/issue-3794.rs deleted file mode 100644 index 8d55af58ee..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/issue-3794.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//ignore-msvc -#![feature(box_syntax)] - -trait T { - fn print(&self); -} - -#[derive(Debug)] -struct S { - s: isize, -} - -impl T for S { - fn print(&self) { - println!("{:?}", self); - } -} - -fn print_t(t: &T) { - t.print(); -} - -fn print_s(s: &S) { - s.print(); -} - -pub fn main() { - let s: Box<S> = box S { s: 5 }; - print_s(&*s); - let t: Box<T> = s as Box<T>; - print_t(&*t); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/issue-3794.stdout b/src/tools/miri/tests/run-pass-fullmir/issue-3794.stdout deleted file mode 100644 index e4afe6fa55..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/issue-3794.stdout +++ /dev/null @@ -1,2 +0,0 @@ -S { s: 5 } -S { s: 5 } diff --git a/src/tools/miri/tests/run-pass-fullmir/loop-break-value.rs b/src/tools/miri/tests/run-pass-fullmir/loop-break-value.rs deleted file mode 100644 index 8a0ea113c5..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/loop-break-value.rs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//ignore-msvc - -#![feature(never_type)] -#![allow(unreachable_code)] - -#[allow(unused)] -fn never_returns() { - loop { - break loop {}; - } -} - -pub fn main() { - let value = 'outer: loop { - if 1 == 1 { - break 13; - } else { - let _never: ! = loop { - break loop { - break 'outer panic!(); - } - }; - } - }; - assert_eq!(value, 13); - - let x = [1, 3u32, 5]; - let y = [17]; - let z = []; - let coerced: &[_] = loop { - match 2 { - 1 => break &x, - 2 => break &y, - 3 => break &z, - _ => (), - } - }; - assert_eq!(coerced, &[17u32]); - - let trait_unified = loop { - break if true { - break Default::default() - } else { - break [13, 14] - }; - }; - assert_eq!(trait_unified, [0, 0]); - - let trait_unified_2 = loop { - if false { - break [String::from("Hello")] - } else { - break Default::default() - }; - }; - assert_eq!(trait_unified_2, [""]); - - let trait_unified_3 = loop { - break if false { - break [String::from("Hello")] - } else { - ["Yes".into()] - }; - }; - assert_eq!(trait_unified_3, ["Yes"]); - - let regular_break = loop { - if true { - break; - } else { - break break Default::default(); - } - }; - assert_eq!(regular_break, ()); - - let regular_break_2 = loop { - if true { - break Default::default(); - } else { - break; - } - }; - assert_eq!(regular_break_2, ()); - - let regular_break_3 = loop { - break if true { - Default::default() - } else { - break; - } - }; - assert_eq!(regular_break_3, ()); - - let regular_break_4 = loop { - break (); - break; - }; - assert_eq!(regular_break_4, ()); - - let regular_break_5 = loop { - break; - break (); - }; - assert_eq!(regular_break_5, ()); - - let nested_break_value = 'outer2: loop { - let _a: u32 = 'inner: loop { - if true { - break 'outer2 "hello"; - } else { - break 'inner 17; - } - }; - panic!(); - }; - assert_eq!(nested_break_value, "hello"); - - let break_from_while_cond = loop { - 'inner_loop: while break 'inner_loop { - panic!(); - } - break 123; - }; - assert_eq!(break_from_while_cond, 123); - - let break_from_while_to_outer = 'outer_loop: loop { - while break 'outer_loop 567 { - panic!("from_inner"); - } - panic!("from outer"); - }; - assert_eq!(break_from_while_to_outer, 567); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/regions-mock-trans.rs b/src/tools/miri/tests/run-pass-fullmir/regions-mock-trans.rs deleted file mode 100644 index cef62e47a5..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/regions-mock-trans.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// FIXME: We handle uninitialzied storage here, which currently makes validation fail. -// compile-flags: -Zmir-emit-validate=0 - -//ignore-msvc - -#![feature(libc)] - -#![allow(dead_code)] - -extern crate libc; -use std::mem; - -struct Arena(()); - -struct Bcx<'a> { - fcx: &'a Fcx<'a> -} - -struct Fcx<'a> { - arena: &'a Arena, - ccx: &'a Ccx -} - -struct Ccx { - x: isize -} - -fn alloc<'a>(_bcx : &'a Arena) -> &'a Bcx<'a> { - unsafe { - mem::transmute(libc::malloc(mem::size_of::<Bcx<'a>>() - as libc::size_t)) - } -} - -fn h<'a>(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> { - return alloc(bcx.fcx.arena); -} - -fn g(fcx : &Fcx) { - let bcx = Bcx { fcx: fcx }; - let bcx2 = h(&bcx); - unsafe { - libc::free(mem::transmute(bcx2)); - } -} - -fn f(ccx : &Ccx) { - let a = Arena(()); - let fcx = Fcx { arena: &a, ccx: ccx }; - return g(&fcx); -} - -pub fn main() { - let ccx = Ccx { x: 0 }; - f(&ccx); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/u128.rs b/src/tools/miri/tests/run-pass-fullmir/u128.rs deleted file mode 100644 index 5b2efdd205..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/u128.rs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//ignore-msvc - -#![feature(i128_type)] - -fn b<T>(t: T) -> T { t } - -fn main() { - let x: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFF; - assert_eq!(0, !x); - assert_eq!(0, !x); - let y: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFE; - assert_eq!(!1, y); - assert_eq!(x, y | 1); - assert_eq!(0xFAFF_0000_FF8F_0000__FFFF_0000_FFFF_FFFE, - y & - 0xFAFF_0000_FF8F_0000__FFFF_0000_FFFF_FFFF); - let z: u128 = 0xABCD_EF; - assert_eq!(z * z, 0x734C_C2F2_A521); - assert_eq!(z * z * z * z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); - assert_eq!(z + z + z + z, 0x2AF3_7BC); - let k: u128 = 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210; - assert_eq!(k + k, 0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420); - assert_eq!(0, k - k); - assert_eq!(0x1234_5678_9ABC_DEFF_EDCB_A987_5A86_421, k - z); - assert_eq!(0x1000_0000_0000_0000_0000_0000_0000_000, - k - 0x234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!(0x6EF5_DE4C_D3BC_2AAA_3BB4_CC5D_D6EE_8, k / 42); - assert_eq!(0, k % 42); - assert_eq!(15, z % 42); - assert_eq!(0x169D_A8020_CEC18, k % 0x3ACB_FE49_FF24_AC); - assert_eq!(0x91A2_B3C4_D5E6_F7, k >> 65); - assert_eq!(0xFDB9_7530_ECA8_6420_0000_0000_0000_0000, k << 65); - assert!(k > z); - assert!(y > k); - assert!(y < x); - assert_eq!(x as u64, !0); - assert_eq!(z as u64, 0xABCD_EF); - assert_eq!(k as u64, 0xFEDC_BA98_7654_3210); - assert_eq!(k as i128, 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!((z as f64) as u128, z); - assert_eq!((z as f32) as u128, z); - assert_eq!((z as f64 * 16.0) as u128, z * 16); - assert_eq!((z as f32 * 16.0) as u128, z * 16); - let l :u128 = 432 << 100; - assert_eq!((l as f32) as u128, l); - assert_eq!((l as f64) as u128, l); - // formatting - let j: u128 = 1 << 67; - assert_eq!("147573952589676412928", format!("{}", j)); - assert_eq!("80000000000000000", format!("{:x}", j)); - assert_eq!("20000000000000000000000", format!("{:o}", j)); - assert_eq!("10000000000000000000000000000000000000000000000000000000000000000000", - format!("{:b}", j)); - assert_eq!("340282366920938463463374607431768211455", - format!("{}", u128::max_value())); - assert_eq!("147573952589676412928", format!("{:?}", j)); - // common traits - assert_eq!(x, b(x.clone())); - // overflow checks - assert_eq!((z).checked_mul(z), Some(0x734C_C2F2_A521)); - assert_eq!((k).checked_mul(k), None); - let l: u128 = b(u128::max_value() - 10); - let o: u128 = b(17); - assert_eq!(l.checked_add(b(11)), None); - assert_eq!(l.checked_sub(l), Some(0)); - assert_eq!(o.checked_sub(b(18)), None); - assert_eq!(b(1u128).checked_shl(b(127)), Some(1 << 127)); - assert_eq!(o.checked_shl(b(128)), None); -} diff --git a/src/tools/miri/tests/run-pass-fullmir/vecs.rs b/src/tools/miri/tests/run-pass-fullmir/vecs.rs deleted file mode 100644 index 9a8912a6b9..0000000000 --- a/src/tools/miri/tests/run-pass-fullmir/vecs.rs +++ /dev/null @@ -1,52 +0,0 @@ -//ignore-msvc - -fn make_vec() -> Vec<u8> { - let mut v = Vec::with_capacity(4); - v.push(1); - v.push(2); - v -} - -fn make_vec_macro() -> Vec<u8> { - vec![1, 2] -} - -fn make_vec_macro_repeat() -> Vec<u8> { - vec![42; 5] -} - -fn make_vec_macro_repeat_zeroed() -> Vec<u8> { - vec![0; 7] -} - -fn vec_into_iter() -> u8 { - vec![1, 2, 3, 4] - .into_iter() - .map(|x| x * x) - .fold(0, |x, y| x + y) -} - -fn vec_into_iter_zst() -> usize { - vec![[0u64; 0], [0u64; 0]] - .into_iter() - .map(|x| x.len()) - .sum() -} - -fn vec_reallocate() -> Vec<u8> { - let mut v = vec![1, 2]; - v.push(3); - v.push(4); - v.push(5); - v -} - -fn main() { - assert_eq!(vec_reallocate().len(), 5); - assert_eq!(vec_into_iter(), 30); - assert_eq!(vec_into_iter_zst(), 0); - assert_eq!(make_vec().capacity(), 4); - assert_eq!(make_vec_macro(), [1, 2]); - assert_eq!(make_vec_macro_repeat(), [42; 5]); - assert_eq!(make_vec_macro_repeat_zeroed(), [0; 7]); -} diff --git a/src/tools/miri/tests/run-pass/arrays.rs b/src/tools/miri/tests/run-pass/arrays.rs deleted file mode 100644 index 469dde3091..0000000000 --- a/src/tools/miri/tests/run-pass/arrays.rs +++ /dev/null @@ -1,45 +0,0 @@ -fn empty_array() -> [u16; 0] { - [] -} - -fn mini_array() -> [u16; 1] { - [42] -} - -fn big_array() -> [u16; 5] { - [5, 4, 3, 2, 1] -} - -fn array_array() -> [[u8; 2]; 3] { - [[5, 4], [3, 2], [1, 0]] -} - -fn index_unsafe() -> i32 { - let a = [0, 10, 20, 30]; - unsafe { *a.get_unchecked(2) } -} - -fn index() -> i32 { - let a = [0, 10, 20, 30]; - a[2] -} - -fn array_repeat() -> [u8; 8] { - [42; 8] -} - -fn slice_index() -> u8 { - let arr: &[_] = &[101, 102, 103, 104, 105, 106]; - arr[5] -} - -fn main() { - assert_eq!(empty_array(), []); - assert_eq!(index_unsafe(), 20); - assert_eq!(index(), 20); - assert_eq!(slice_index(), 106); - assert_eq!(big_array(), [5, 4, 3, 2, 1]); - assert_eq!(array_array(), [[5, 4], [3, 2], [1, 0]]); - assert_eq!(array_repeat(), [42; 8]); - assert_eq!(mini_array(), [42]); -} diff --git a/src/tools/miri/tests/run-pass/assume_bug.rs b/src/tools/miri/tests/run-pass/assume_bug.rs deleted file mode 100644 index e14f875c02..0000000000 --- a/src/tools/miri/tests/run-pass/assume_bug.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - vec![()].into_iter(); -} diff --git a/src/tools/miri/tests/run-pass/atomic-access-bool.rs b/src/tools/miri/tests/run-pass/atomic-access-bool.rs deleted file mode 100644 index ada5847054..0000000000 --- a/src/tools/miri/tests/run-pass/atomic-access-bool.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT}; -use std::sync::atomic::Ordering::*; - -static mut ATOMIC: AtomicBool = ATOMIC_BOOL_INIT; - -fn main() { - unsafe { - assert_eq!(*ATOMIC.get_mut(), false); - ATOMIC.store(true, SeqCst); - assert_eq!(*ATOMIC.get_mut(), true); - ATOMIC.fetch_or(false, SeqCst); - assert_eq!(*ATOMIC.get_mut(), true); - ATOMIC.fetch_and(false, SeqCst); - assert_eq!(*ATOMIC.get_mut(), false); - ATOMIC.fetch_nand(true, SeqCst); - assert_eq!(*ATOMIC.get_mut(), true); - ATOMIC.fetch_xor(true, SeqCst); - assert_eq!(*ATOMIC.get_mut(), false); - } -} diff --git a/src/tools/miri/tests/run-pass/atomic-compare_exchange.rs b/src/tools/miri/tests/run-pass/atomic-compare_exchange.rs deleted file mode 100644 index 61e9a96588..0000000000 --- a/src/tools/miri/tests/run-pass/atomic-compare_exchange.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT}; -use std::sync::atomic::Ordering::*; - -static ATOMIC: AtomicIsize = ATOMIC_ISIZE_INIT; - -fn main() { - // Make sure trans can emit all the intrinsics correctly - ATOMIC.compare_exchange(0, 1, Relaxed, Relaxed).ok(); - ATOMIC.compare_exchange(0, 1, Acquire, Relaxed).ok(); - ATOMIC.compare_exchange(0, 1, Release, Relaxed).ok(); - ATOMIC.compare_exchange(0, 1, AcqRel, Relaxed).ok(); - ATOMIC.compare_exchange(0, 1, SeqCst, Relaxed).ok(); - ATOMIC.compare_exchange(0, 1, Acquire, Acquire).ok(); - ATOMIC.compare_exchange(0, 1, AcqRel, Acquire).ok(); - ATOMIC.compare_exchange(0, 1, SeqCst, Acquire).ok(); - ATOMIC.compare_exchange(0, 1, SeqCst, SeqCst).ok(); - ATOMIC.compare_exchange_weak(0, 1, Relaxed, Relaxed).ok(); - ATOMIC.compare_exchange_weak(0, 1, Acquire, Relaxed).ok(); - ATOMIC.compare_exchange_weak(0, 1, Release, Relaxed).ok(); - ATOMIC.compare_exchange_weak(0, 1, AcqRel, Relaxed).ok(); - ATOMIC.compare_exchange_weak(0, 1, SeqCst, Relaxed).ok(); - ATOMIC.compare_exchange_weak(0, 1, Acquire, Acquire).ok(); - ATOMIC.compare_exchange_weak(0, 1, AcqRel, Acquire).ok(); - ATOMIC.compare_exchange_weak(0, 1, SeqCst, Acquire).ok(); - ATOMIC.compare_exchange_weak(0, 1, SeqCst, SeqCst).ok(); -} diff --git a/src/tools/miri/tests/run-pass/aux_test.rs b/src/tools/miri/tests/run-pass/aux_test.rs deleted file mode 100644 index beed82e058..0000000000 --- a/src/tools/miri/tests/run-pass/aux_test.rs +++ /dev/null @@ -1,9 +0,0 @@ -// aux-build:dep.rs - -// ignore-cross-compile - -extern crate dep; - -fn main() { - dep::foo(); -} diff --git a/src/tools/miri/tests/run-pass/auxiliary/dep.rs b/src/tools/miri/tests/run-pass/auxiliary/dep.rs deleted file mode 100644 index b76b4321d6..0000000000 --- a/src/tools/miri/tests/run-pass/auxiliary/dep.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/src/tools/miri/tests/run-pass/bad_substs.rs b/src/tools/miri/tests/run-pass/bad_substs.rs deleted file mode 100644 index d8da2de5d6..0000000000 --- a/src/tools/miri/tests/run-pass/bad_substs.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let f: fn(i32) -> Option<i32> = Some::<i32>; - f(42); -} diff --git a/src/tools/miri/tests/run-pass/binops.rs b/src/tools/miri/tests/run-pass/binops.rs deleted file mode 100644 index a03b96fa49..0000000000 --- a/src/tools/miri/tests/run-pass/binops.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Binop corner cases - -fn test_nil() { - assert_eq!((), ()); - assert!((!(() != ()))); - assert!((!(() < ()))); - assert!((() <= ())); - assert!((!(() > ()))); - assert!((() >= ())); -} - -fn test_bool() { - assert!((!(true < false))); - assert!((!(true <= false))); - assert!((true > false)); - assert!((true >= false)); - - assert!((false < true)); - assert!((false <= true)); - assert!((!(false > true))); - assert!((!(false >= true))); - - // Bools support bitwise binops - assert_eq!(false & false, false); - assert_eq!(true & false, false); - assert_eq!(true & true, true); - assert_eq!(false | false, false); - assert_eq!(true | false, true); - assert_eq!(true | true, true); - assert_eq!(false ^ false, false); - assert_eq!(true ^ false, true); - assert_eq!(true ^ true, false); -} - -fn test_ptr() { - unsafe { - let p1: *const u8 = ::std::mem::transmute(0_usize); - let p2: *const u8 = ::std::mem::transmute(0_usize); - let p3: *const u8 = ::std::mem::transmute(1_usize); - - assert_eq!(p1, p2); - assert!(p1 != p3); - assert!(p1 < p3); - assert!(p1 <= p3); - assert!(p3 > p1); - assert!(p3 >= p3); - assert!(p1 <= p2); - assert!(p1 >= p2); - } -} - -#[derive(PartialEq, Debug)] -struct P { - x: isize, - y: isize, -} - -fn p(x: isize, y: isize) -> P { - P { - x: x, - y: y - } -} - -fn test_class() { - let q = p(1, 2); - let mut r = p(1, 2); - - assert_eq!(q, r); - r.y = 17; - assert!((r.y != q.y)); - assert_eq!(r.y, 17); - assert!((q != r)); -} - -pub fn main() { - test_nil(); - test_bool(); - test_ptr(); - test_class(); -} diff --git a/src/tools/miri/tests/run-pass/bools.rs b/src/tools/miri/tests/run-pass/bools.rs deleted file mode 100644 index 103d7eac27..0000000000 --- a/src/tools/miri/tests/run-pass/bools.rs +++ /dev/null @@ -1,28 +0,0 @@ -fn boolean() -> bool { - true -} - -fn if_false() -> i64 { - let c = false; - if c { 1 } else { 0 } -} - -fn if_true() -> i64 { - let c = true; - if c { 1 } else { 0 } -} - -fn match_bool() -> i16 { - let b = true; - match b { - true => 1, - _ => 0, - } -} - -fn main() { - assert!(boolean()); - assert_eq!(if_false(), 0); - assert_eq!(if_true(), 1); - assert_eq!(match_bool(), 1); -} diff --git a/src/tools/miri/tests/run-pass/box_box_trait.rs b/src/tools/miri/tests/run-pass/box_box_trait.rs deleted file mode 100644 index 57eef52d57..0000000000 --- a/src/tools/miri/tests/run-pass/box_box_trait.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![feature(box_syntax)] - -struct DroppableStruct; - -static mut DROPPED: bool = false; - -impl Drop for DroppableStruct { - fn drop(&mut self) { - unsafe { DROPPED = true; } - } -} - -trait MyTrait { fn dummy(&self) { } } -impl MyTrait for Box<DroppableStruct> {} - -struct Whatever { w: Box<MyTrait+'static> } -impl Whatever { - fn new(w: Box<MyTrait+'static>) -> Whatever { - Whatever { w: w } - } -} - -fn main() { - { - let f: Box<_> = box DroppableStruct; - let _a = Whatever::new(box f as Box<MyTrait>); - } - assert!(unsafe { DROPPED }); -} diff --git a/src/tools/miri/tests/run-pass/btreemap.rs b/src/tools/miri/tests/run-pass/btreemap.rs deleted file mode 100644 index 0fd28d6f1e..0000000000 --- a/src/tools/miri/tests/run-pass/btreemap.rs +++ /dev/null @@ -1,17 +0,0 @@ -// mir validation can't cope with `mem::uninitialized()`, so this test fails with validation & full-MIR. -// compile-flags: -Zmir-emit-validate=0 - -#[derive(PartialEq, Eq, PartialOrd, Ord)] -pub enum Foo { - A(&'static str), - _B, - _C, -} - -pub fn main() { - let mut b = std::collections::BTreeSet::new(); - b.insert(Foo::A("\'")); - b.insert(Foo::A("/=")); - b.insert(Foo::A("#")); - b.insert(Foo::A("0o")); -} diff --git a/src/tools/miri/tests/run-pass/c_enums.rs b/src/tools/miri/tests/run-pass/c_enums.rs deleted file mode 100644 index 11897b73eb..0000000000 --- a/src/tools/miri/tests/run-pass/c_enums.rs +++ /dev/null @@ -1,32 +0,0 @@ -enum Foo { - Bar = 42, - Baz, - Quux = 100, -} - -enum Signed { - Bar = -42, - Baz, - Quux = 100, -} - -fn foo() -> [u8; 3] { - [Foo::Bar as u8, Foo::Baz as u8, Foo::Quux as u8] -} - -fn signed() -> [i8; 3] { - [Signed::Bar as i8, Signed::Baz as i8, Signed::Quux as i8] -} - -fn unsafe_match() -> bool { - match unsafe { std::mem::transmute::<u8, Foo>(43) } { - Foo::Baz => true, - _ => false, - } -} - -fn main() { - assert_eq!(foo(), [42, 43, 100]); - assert_eq!(signed(), [-42, -41, 100]); - assert!(unsafe_match()); -} diff --git a/src/tools/miri/tests/run-pass/call_drop_on_array_elements.rs b/src/tools/miri/tests/run-pass/call_drop_on_array_elements.rs deleted file mode 100644 index c9b59f635e..0000000000 --- a/src/tools/miri/tests/run-pass/call_drop_on_array_elements.rs +++ /dev/null @@ -1,22 +0,0 @@ -struct Bar(u16); // ZSTs are tested separately - -static mut DROP_COUNT: usize = 0; - -impl Drop for Bar { - fn drop(&mut self) { - assert_eq!(self.0 as usize, unsafe { DROP_COUNT }); // tests whether we are called at a valid address - unsafe { DROP_COUNT += 1; } - } -} - -fn main() { - let b = [Bar(0), Bar(1), Bar(2), Bar(3)]; - assert_eq!(unsafe { DROP_COUNT }, 0); - drop(b); - assert_eq!(unsafe { DROP_COUNT }, 4); - - // check empty case - let b : [Bar; 0] = []; - drop(b); - assert_eq!(unsafe { DROP_COUNT }, 4); -} diff --git a/src/tools/miri/tests/run-pass/call_drop_on_fat_ptr_array_elements.rs b/src/tools/miri/tests/run-pass/call_drop_on_fat_ptr_array_elements.rs deleted file mode 100644 index a1ab5c45e3..0000000000 --- a/src/tools/miri/tests/run-pass/call_drop_on_fat_ptr_array_elements.rs +++ /dev/null @@ -1,20 +0,0 @@ -trait Foo {} - -struct Bar; - -impl Foo for Bar {} - -static mut DROP_COUNT: usize = 0; - -impl Drop for Bar { - fn drop(&mut self) { - unsafe { DROP_COUNT += 1; } - } -} - -fn main() { - let b: [Box<Foo>; 4] = [Box::new(Bar), Box::new(Bar), Box::new(Bar), Box::new(Bar)]; - assert_eq!(unsafe { DROP_COUNT }, 0); - drop(b); - assert_eq!(unsafe { DROP_COUNT }, 4); -} diff --git a/src/tools/miri/tests/run-pass/call_drop_on_zst_array_elements.rs b/src/tools/miri/tests/run-pass/call_drop_on_zst_array_elements.rs deleted file mode 100644 index 1887130fdd..0000000000 --- a/src/tools/miri/tests/run-pass/call_drop_on_zst_array_elements.rs +++ /dev/null @@ -1,21 +0,0 @@ -struct Bar; - -static mut DROP_COUNT: usize = 0; - -impl Drop for Bar { - fn drop(&mut self) { - unsafe { DROP_COUNT += 1; } - } -} - -fn main() { - let b = [Bar, Bar, Bar, Bar]; - assert_eq!(unsafe { DROP_COUNT }, 0); - drop(b); - assert_eq!(unsafe { DROP_COUNT }, 4); - - // check empty case - let b : [Bar; 0] = []; - drop(b); - assert_eq!(unsafe { DROP_COUNT }, 4); -} diff --git a/src/tools/miri/tests/run-pass/call_drop_through_owned_slice.rs b/src/tools/miri/tests/run-pass/call_drop_through_owned_slice.rs deleted file mode 100644 index 3ec6be65ed..0000000000 --- a/src/tools/miri/tests/run-pass/call_drop_through_owned_slice.rs +++ /dev/null @@ -1,16 +0,0 @@ -struct Bar; - -static mut DROP_COUNT: usize = 0; - -impl Drop for Bar { - fn drop(&mut self) { - unsafe { DROP_COUNT += 1; } - } -} - -fn main() { - let b: Box<[Bar]> = vec![Bar, Bar, Bar, Bar].into_boxed_slice(); - assert_eq!(unsafe { DROP_COUNT }, 0); - drop(b); - assert_eq!(unsafe { DROP_COUNT }, 4); -} diff --git a/src/tools/miri/tests/run-pass/call_drop_through_trait_object.rs b/src/tools/miri/tests/run-pass/call_drop_through_trait_object.rs deleted file mode 100644 index 9b6acf0b14..0000000000 --- a/src/tools/miri/tests/run-pass/call_drop_through_trait_object.rs +++ /dev/null @@ -1,20 +0,0 @@ -trait Foo {} - -struct Bar; - -static mut DROP_CALLED: bool = false; - -impl Drop for Bar { - fn drop(&mut self) { - unsafe { DROP_CALLED = true; } - } -} - -impl Foo for Bar {} - -fn main() { - let b: Box<Foo> = Box::new(Bar); - assert!(unsafe { !DROP_CALLED }); - drop(b); - assert!(unsafe { DROP_CALLED }); -} diff --git a/src/tools/miri/tests/run-pass/call_drop_through_trait_object_rc.rs b/src/tools/miri/tests/run-pass/call_drop_through_trait_object_rc.rs deleted file mode 100644 index ce56ca6a1c..0000000000 --- a/src/tools/miri/tests/run-pass/call_drop_through_trait_object_rc.rs +++ /dev/null @@ -1,22 +0,0 @@ -trait Foo {} - -struct Bar; - -static mut DROP_CALLED: bool = false; - -impl Drop for Bar { - fn drop(&mut self) { - unsafe { DROP_CALLED = true; } - } -} - -impl Foo for Bar {} - -use std::rc::Rc; - -fn main() { - let b: Rc<Foo> = Rc::new(Bar); - assert!(unsafe { !DROP_CALLED }); - drop(b); - assert!(unsafe { DROP_CALLED }); -} diff --git a/src/tools/miri/tests/run-pass/calls.rs b/src/tools/miri/tests/run-pass/calls.rs deleted file mode 100644 index c4ba4a9b70..0000000000 --- a/src/tools/miri/tests/run-pass/calls.rs +++ /dev/null @@ -1,45 +0,0 @@ -#![feature(const_fn)] - -fn call() -> i32 { - fn increment(x: i32) -> i32 { - x + 1 - } - increment(1) -} - -fn factorial_recursive() -> i64 { - fn fact(n: i64) -> i64 { - if n == 0 { - 1 - } else { - n * fact(n - 1) - } - } - fact(10) -} - -fn call_generic() -> (i16, bool) { - fn id<T>(t: T) -> T { t } - (id(42), id(true)) -} - -// Test calling a very simple function from the standard library. -fn cross_crate_fn_call() -> i64 { - if 1i32.is_positive() { 1 } else { 0 } -} - -const fn foo(i: i64) -> i64 { *&i + 1 } - -fn const_fn_call() -> i64 { - let x = 5 + foo(5); - assert_eq!(x, 11); - x -} - -fn main() { - assert_eq!(call(), 2); - assert_eq!(factorial_recursive(), 3628800); - assert_eq!(call_generic(), (42, true)); - assert_eq!(cross_crate_fn_call(), 1); - assert_eq!(const_fn_call(), 11); -} diff --git a/src/tools/miri/tests/run-pass/cast-rfc0401-vtable-kinds.rs b/src/tools/miri/tests/run-pass/cast-rfc0401-vtable-kinds.rs deleted file mode 100644 index afbd4760a3..0000000000 --- a/src/tools/miri/tests/run-pass/cast-rfc0401-vtable-kinds.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -// FIXME: remove the next line when https://github.com/rust-lang/rust/issues/43358 is resolved -// compile-flags: -Zmir-opt-level=0 - -// Check that you can cast between different pointers to trait objects -// whose vtable have the same kind (both lengths, or both trait pointers). - -trait Foo<T> { - fn foo(&self, _: T) -> u32 { 42 } -} - -trait Bar { - fn bar(&self) { println!("Bar!"); } -} - -impl<T> Foo<T> for () {} -impl Foo<u32> for u32 { fn foo(&self, _: u32) -> u32 { self+43 } } -impl Bar for () {} - -unsafe fn round_trip_and_call<'a>(t: *const (Foo<u32>+'a)) -> u32 { - let foo_e : *const Foo<u16> = t as *const _; - let r_1 = foo_e as *mut Foo<u32>; - - (&*r_1).foo(0) -} - -#[repr(C)] -struct FooS<T:?Sized>(T); -#[repr(C)] -struct BarS<T:?Sized>(T); - -fn foo_to_bar<T:?Sized>(u: *const FooS<T>) -> *const BarS<T> { - u as *const BarS<T> -} - -fn main() { - let x = 4u32; - let y : &Foo<u32> = &x; - let fl = unsafe { round_trip_and_call(y as *const Foo<u32>) }; - assert_eq!(fl, (43+4)); - - let s = FooS([0,1,2]); - let u: &FooS<[u32]> = &s; - let u: *const FooS<[u32]> = u; - let bar_ref : *const BarS<[u32]> = foo_to_bar(u); - let z : &BarS<[u32]> = unsafe{&*bar_ref}; - assert_eq!(&z.0, &[0,1,2]); - // If validation fails here, that's likely because an immutable suspension is recovered mutably. -} diff --git a/src/tools/miri/tests/run-pass/cast_fn_ptr.rs b/src/tools/miri/tests/run-pass/cast_fn_ptr.rs deleted file mode 100644 index 109e8dfc2a..0000000000 --- a/src/tools/miri/tests/run-pass/cast_fn_ptr.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - fn f(_: *const u8) {} - - let g = unsafe { - std::mem::transmute::<fn(*const u8), fn(*const i32)>(f) - }; - - g(&42 as *const _); -} diff --git a/src/tools/miri/tests/run-pass/cast_fn_ptr_unsafe.rs b/src/tools/miri/tests/run-pass/cast_fn_ptr_unsafe.rs deleted file mode 100644 index 0cabb369bf..0000000000 --- a/src/tools/miri/tests/run-pass/cast_fn_ptr_unsafe.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - fn f() {} - - let g = f as fn() as unsafe fn(); - unsafe { - g(); - } -} diff --git a/src/tools/miri/tests/run-pass/char.rs b/src/tools/miri/tests/run-pass/char.rs deleted file mode 100644 index 505c09b0ad..0000000000 --- a/src/tools/miri/tests/run-pass/char.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let c = 'x'; - assert_eq!(c, 'x'); - assert!('a' < 'z'); - assert!('1' < '9'); - assert_eq!(std::char::from_u32('x' as u32).unwrap(), 'x'); - // FIXME: - // assert_eq!(std::char::from_u32('x' as u32), Some('x')); -} diff --git a/src/tools/miri/tests/run-pass/closure-drop.rs b/src/tools/miri/tests/run-pass/closure-drop.rs deleted file mode 100644 index f1bdafaeb1..0000000000 --- a/src/tools/miri/tests/run-pass/closure-drop.rs +++ /dev/null @@ -1,25 +0,0 @@ -struct Foo<'a>(&'a mut bool); - -impl<'a> Drop for Foo<'a> { - fn drop(&mut self) { - *self.0 = true; - } -} - -fn f<T: FnOnce()>(t: T) { - t() -} - -fn main() { - let mut ran_drop = false; - { - let x = Foo(&mut ran_drop); - // this closure never by val uses its captures - // so it's basically a fn(&self) - // the shim used to not drop the `x` - let x = move || { let _ = x; }; - f(x); - } - assert!(ran_drop); -} - diff --git a/src/tools/miri/tests/run-pass/closure-field-ty.rs b/src/tools/miri/tests/run-pass/closure-field-ty.rs deleted file mode 100644 index 0d27728d22..0000000000 --- a/src/tools/miri/tests/run-pass/closure-field-ty.rs +++ /dev/null @@ -1,10 +0,0 @@ -// miri issue #304 -fn main() { - let mut y = 0; - { - let mut box_maybe_closure = Box::new(None); - *box_maybe_closure = Some(|| { y += 1; }); - (box_maybe_closure.unwrap())(); - } - assert_eq!(y, 1); -} diff --git a/src/tools/miri/tests/run-pass/closures.rs b/src/tools/miri/tests/run-pass/closures.rs deleted file mode 100644 index 9b379051eb..0000000000 --- a/src/tools/miri/tests/run-pass/closures.rs +++ /dev/null @@ -1,48 +0,0 @@ -fn simple() -> i32 { - let y = 10; - let f = |x| x + y; - f(2) -} - -fn crazy_closure() -> (i32, i32, i32) { - fn inner<T: Copy>(t: T) -> (i32, T, T) { - struct NonCopy; - let x = NonCopy; - - let a = 2; - let b = 40; - let f = move |y, z, asdf| { - drop(x); - (a + b + y + z, asdf, t) - }; - f(a, b, t) - } - - inner(10) -} - -fn closure_arg_adjustment_problem() -> i64 { - fn once<F: FnOnce(i64)>(f: F) { f(2); } - let mut y = 1; - { - let f = |x| y += x; - once(f); - } - y -} - -fn fn_once_closure_with_multiple_args() -> i64 { - fn once<F: FnOnce(i64, i64) -> i64>(f: F) -> i64 { f(2, 3) } - let y = 1; - { - let f = |x, z| x + y + z; - once(f) - } -} - -fn main() { - assert_eq!(simple(), 12); - assert_eq!(crazy_closure(), (84, 10, 10)); - assert_eq!(closure_arg_adjustment_problem(), 3); - assert_eq!(fn_once_closure_with_multiple_args(), 6); -} diff --git a/src/tools/miri/tests/run-pass/const-vec-of-fns.rs b/src/tools/miri/tests/run-pass/const-vec-of-fns.rs deleted file mode 100644 index 0338a766e2..0000000000 --- a/src/tools/miri/tests/run-pass/const-vec-of-fns.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// pretty-expanded FIXME #23616 - -/*! - * Try to double-check that static fns have the right size (with or - * without dummy env ptr, as appropriate) by iterating a size-2 array. - * If the static size differs from the runtime size, the second element - * should be read as a null or otherwise wrong pointer and crash. - */ - -fn f() { } -static mut CLOSURES: &'static mut [fn()] = &mut [f as fn(), f as fn()]; - -pub fn main() { - unsafe { - for closure in &mut *CLOSURES { - (*closure)() - } - } -} diff --git a/src/tools/miri/tests/run-pass/constants.rs b/src/tools/miri/tests/run-pass/constants.rs deleted file mode 100644 index 718c852601..0000000000 --- a/src/tools/miri/tests/run-pass/constants.rs +++ /dev/null @@ -1,9 +0,0 @@ -const A: usize = *&5; - -fn foo() -> usize { - A -} - -fn main() { - assert_eq!(foo(), A); -} diff --git a/src/tools/miri/tests/run-pass/deriving-associated-types.rs b/src/tools/miri/tests/run-pass/deriving-associated-types.rs deleted file mode 100644 index b67ef85acf..0000000000 --- a/src/tools/miri/tests/run-pass/deriving-associated-types.rs +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait DeclaredTrait { - type Type; -} - -impl DeclaredTrait for i32 { - type Type = i32; -} - -pub trait WhereTrait { - type Type; -} - -impl WhereTrait for i32 { - type Type = i32; -} - -// Make sure we don't add a bound that just shares a name with an associated -// type. -pub mod module { - pub type Type = i32; -} - -#[derive(PartialEq, Debug)] -struct PrivateStruct<T>(T); - -#[derive(PartialEq, Debug)] -struct TupleStruct<A, B: DeclaredTrait, C>( - module::Type, - Option<module::Type>, - A, - PrivateStruct<A>, - B, - B::Type, - Option<B::Type>, - <B as DeclaredTrait>::Type, - Option<<B as DeclaredTrait>::Type>, - C, - C::Type, - Option<C::Type>, - <C as WhereTrait>::Type, - Option<<C as WhereTrait>::Type>, - <i32 as DeclaredTrait>::Type, -) where C: WhereTrait; - -#[derive(PartialEq, Debug)] -pub struct Struct<A, B: DeclaredTrait, C> where C: WhereTrait { - m1: module::Type, - m2: Option<module::Type>, - a1: A, - a2: PrivateStruct<A>, - b: B, - b1: B::Type, - b2: Option<B::Type>, - b3: <B as DeclaredTrait>::Type, - b4: Option<<B as DeclaredTrait>::Type>, - c: C, - c1: C::Type, - c2: Option<C::Type>, - c3: <C as WhereTrait>::Type, - c4: Option<<C as WhereTrait>::Type>, - d: <i32 as DeclaredTrait>::Type, -} - -#[derive(PartialEq, Debug)] -enum Enum<A, B: DeclaredTrait, C> where C: WhereTrait { - Unit, - Seq( - module::Type, - Option<module::Type>, - A, - PrivateStruct<A>, - B, - B::Type, - Option<B::Type>, - <B as DeclaredTrait>::Type, - Option<<B as DeclaredTrait>::Type>, - C, - C::Type, - Option<C::Type>, - <C as WhereTrait>::Type, - Option<<C as WhereTrait>::Type>, - <i32 as DeclaredTrait>::Type, - ), - Map { - m1: module::Type, - m2: Option<module::Type>, - a1: A, - a2: PrivateStruct<A>, - b: B, - b1: B::Type, - b2: Option<B::Type>, - b3: <B as DeclaredTrait>::Type, - b4: Option<<B as DeclaredTrait>::Type>, - c: C, - c1: C::Type, - c2: Option<C::Type>, - c3: <C as WhereTrait>::Type, - c4: Option<<C as WhereTrait>::Type>, - d: <i32 as DeclaredTrait>::Type, - }, -} - -fn main() { - - let e: Enum< - i32, - i32, - i32, - > = Enum::Seq( - 0, - None, - 0, - PrivateStruct(0), - 0, - 0, - None, - 0, - None, - 0, - 0, - None, - 0, - None, - 0, - ); - assert_eq!(e, e); - - let e: Enum< - i32, - i32, - i32, - > = Enum::Map { - m1: 0, - m2: None, - a1: 0, - a2: PrivateStruct(0), - b: 0, - b1: 0, - b2: None, - b3: 0, - b4: None, - c: 0, - c1: 0, - c2: None, - c3: 0, - c4: None, - d: 0, - }; - assert_eq!(e, e); - let e: TupleStruct< - i32, - i32, - i32, - > = TupleStruct( - 0, - None, - 0, - PrivateStruct(0), - 0, - 0, - None, - 0, - None, - 0, - 0, - None, - 0, - None, - 0, - ); - assert_eq!(e, e); - - let e: Struct< - i32, - i32, - i32, - > = Struct { - m1: 0, - m2: None, - a1: 0, - a2: PrivateStruct(0), - b: 0, - b1: 0, - b2: None, - b3: 0, - b4: None, - c: 0, - c1: 0, - c2: None, - c3: 0, - c4: None, - d: 0, - }; - assert_eq!(e, e); - - let e = Enum::Unit::<i32, i32, i32>; - assert_eq!(e, e); -} diff --git a/src/tools/miri/tests/run-pass/drop_empty_slice.rs b/src/tools/miri/tests/run-pass/drop_empty_slice.rs deleted file mode 100644 index b21c8a612c..0000000000 --- a/src/tools/miri/tests/run-pass/drop_empty_slice.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(box_syntax)] - -fn main() { - // With the nested Vec, this is calling Offset(Unique::empty(), 0) on drop. - let args : Vec<Vec<i32>> = Vec::new(); - let _ = box args; -} diff --git a/src/tools/miri/tests/run-pass/dst-field-align.rs b/src/tools/miri/tests/run-pass/dst-field-align.rs deleted file mode 100644 index 5631b65ed9..0000000000 --- a/src/tools/miri/tests/run-pass/dst-field-align.rs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] - -struct Foo<T: ?Sized> { - a: u16, - b: T -} - -trait Bar { - fn get(&self) -> usize; -} - -impl Bar for usize { - fn get(&self) -> usize { *self } -} - -struct Baz<T: ?Sized> { - a: T -} - -struct HasDrop<T: ?Sized> { - ptr: Box<usize>, - data: T -} - -fn main() { - // Test that zero-offset works properly - let b : Baz<usize> = Baz { a: 7 }; - assert_eq!(b.a.get(), 7); - let b : &Baz<Bar> = &b; - assert_eq!(b.a.get(), 7); - - // Test that the field is aligned properly - let f : Foo<usize> = Foo { a: 0, b: 11 }; - assert_eq!(f.b.get(), 11); - let ptr1 : *const u8 = &f.b as *const _ as *const u8; - - let f : &Foo<Bar> = &f; - let ptr2 : *const u8 = &f.b as *const _ as *const u8; - assert_eq!(f.b.get(), 11); - - // The pointers should be the same - assert_eq!(ptr1, ptr2); - - // Test that nested DSTs work properly - let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }}; - assert_eq!(f.b.b.get(), 17); - let f : &Foo<Foo<Bar>> = &f; - assert_eq!(f.b.b.get(), 17); - - // Test that get the pointer via destructuring works - - let f : Foo<usize> = Foo { a: 0, b: 11 }; - let f : &Foo<Bar> = &f; - let &Foo { a: _, b: ref bar } = f; - assert_eq!(bar.get(), 11); - - // Make sure that drop flags don't screw things up - - let d : HasDrop<Baz<[i32; 4]>> = HasDrop { - ptr: Box::new(0), - data: Baz { a: [1,2,3,4] } - }; - assert_eq!([1,2,3,4], d.data.a); - - let d : &HasDrop<Baz<[i32]>> = &d; - assert_eq!(&[1,2,3,4], &d.data.a); -} diff --git a/src/tools/miri/tests/run-pass/dst-irrefutable-bind.rs b/src/tools/miri/tests/run-pass/dst-irrefutable-bind.rs deleted file mode 100644 index 9f8067f372..0000000000 --- a/src/tools/miri/tests/run-pass/dst-irrefutable-bind.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct Test<T: ?Sized>(T); - -fn main() { - let x = Test([1,2,3]); - let x : &Test<[i32]> = &x; - - let & ref _y = x; - - // Make sure binding to a fat pointer behind a reference - // still works - let slice = &[1,2,3]; - let x = Test(&slice); - let Test(&_slice) = x; -} diff --git a/src/tools/miri/tests/run-pass/dst-raw.rs b/src/tools/miri/tests/run-pass/dst-raw.rs deleted file mode 100644 index 3a74626b02..0000000000 --- a/src/tools/miri/tests/run-pass/dst-raw.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test DST raw pointers - - -trait Trait { - fn foo(&self) -> isize; -} - -struct A { - f: isize -} -impl Trait for A { - fn foo(&self) -> isize { - self.f - } -} - -struct Foo<T: ?Sized> { - f: T -} - -pub fn main() { - // raw trait object - let x = A { f: 42 }; - let z: *const Trait = &x; - let r = unsafe { - (&*z).foo() - }; - assert_eq!(r, 42); - - // raw DST struct - let p = Foo {f: A { f: 42 }}; - let o: *const Foo<Trait> = &p; - let r = unsafe { - (&*o).f.foo() - }; - assert_eq!(r, 42); - - // raw slice - let a: *const [_] = &[1, 2, 3]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - // raw slice with explicit cast - let a = &[1, 2, 3] as *const [i32]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - // raw DST struct with slice - let c: *const Foo<[_]> = &Foo {f: [1, 2, 3]}; - unsafe { - let b = (&*c).f[0]; - assert_eq!(b, 1); - let len = (&*c).f.len(); - assert_eq!(len, 3); - } - - // all of the above with *mut - let mut x = A { f: 42 }; - let z: *mut Trait = &mut x; - let r = unsafe { - (&*z).foo() - }; - assert_eq!(r, 42); - - let mut p = Foo {f: A { f: 42 }}; - let o: *mut Foo<Trait> = &mut p; - let r = unsafe { - (&*o).f.foo() - }; - assert_eq!(r, 42); - - let a: *mut [_] = &mut [1, 2, 3]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - let a = &mut [1, 2, 3] as *mut [i32]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - let c: *mut Foo<[_]> = &mut Foo {f: [1, 2, 3]}; - unsafe { - let b = (&*c).f[0]; - assert_eq!(b, 1); - let len = (&*c).f.len(); - assert_eq!(len, 3); - } -} diff --git a/src/tools/miri/tests/run-pass/dst-struct-sole.rs b/src/tools/miri/tests/run-pass/dst-struct-sole.rs deleted file mode 100644 index 58d7b35a52..0000000000 --- a/src/tools/miri/tests/run-pass/dst-struct-sole.rs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// As dst-struct.rs, but the unsized field is the only field in the struct. - - -struct Fat<T: ?Sized> { - ptr: T -} - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.ptr; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.ptr[1], 2); -} - -fn foo2<T:ToBar>(x: &Fat<[T]>) { - let y = &x.ptr; - let bar = Bar; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.ptr[1].to_bar(), bar); -} - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = Fat { ptr: [1, 2, 3] }; - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = Fat { ptr: [bar, bar, bar] }; - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &Fat { ptr: [bar, bar, bar] }; - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut Fat { ptr: [1, 2, 3] }; - f5.ptr[1] = 34; - assert_eq!(f5.ptr[0], 1); - assert_eq!(f5.ptr[1], 34); - assert_eq!(f5.ptr[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &Fat { ptr: [] }; - assert!(f5.ptr.is_empty()); - let f5: &Fat<[Bar]> = &Fat { ptr: [] }; - assert!(f5.ptr.is_empty()); -} diff --git a/src/tools/miri/tests/run-pass/dst-struct.rs b/src/tools/miri/tests/run-pass/dst-struct.rs deleted file mode 100644 index 932b571ecc..0000000000 --- a/src/tools/miri/tests/run-pass/dst-struct.rs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -#![allow(unused_features)] -#![feature(box_syntax)] - -struct Fat<T: ?Sized> { - f1: isize, - f2: &'static str, - ptr: T -} - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.ptr; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.ptr[1], 2); - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); -} - -fn foo2<T:ToBar>(x: &Fat<[T]>) { - let y = &x.ptr; - let bar = Bar; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.ptr[1].to_bar(), bar); - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); -} - -fn foo3(x: &Fat<Fat<[isize]>>) { - let y = &x.ptr.ptr; - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); - assert_eq!(x.ptr.f1, 8); - assert_eq!(x.ptr.f2, "deep str"); - assert_eq!(x.ptr.ptr.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.ptr.ptr[1], 2); -} - - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = Fat { f1: 5, f2: "some str", ptr: [bar, bar, bar] }; - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [bar, bar, bar] }; - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - f5.ptr[1] = 34; - assert_eq!(f5.ptr[0], 1); - assert_eq!(f5.ptr[1], 34); - assert_eq!(f5.ptr[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [] }; - assert!(f5.ptr.is_empty()); - let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [] }; - assert!(f5.ptr.is_empty()); - - // Deeply nested. - let f1 = Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} }; - foo3(&f1); - let f2 = &f1; - foo3(f2); - let f3: &Fat<Fat<[isize]>> = f2; - foo3(f3); - let f4: &Fat<Fat<[isize]>> = &f1; - foo3(f4); - let f5: &Fat<Fat<[isize]>> = - &Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} }; - foo3(f5); - - // Box. - let f1 = Box::new([1, 2, 3]); - assert_eq!((*f1)[1], 2); - let f2: Box<[isize]> = f1; - assert_eq!((*f2)[1], 2); - - // Nested Box. - let f1 : Box<Fat<[isize; 3]>> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - foo(&*f1); - let f2 : Box<Fat<[isize]>> = f1; - foo(&*f2); - - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - let f3 : Box<Fat<[isize]>> = - Box::<Fat<[_; 3]>>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); - foo(&*f3); -} diff --git a/src/tools/miri/tests/run-pass/enum-nullable-const-null-with-fields.rs b/src/tools/miri/tests/run-pass/enum-nullable-const-null-with-fields.rs deleted file mode 100644 index 1342c4e104..0000000000 --- a/src/tools/miri/tests/run-pass/enum-nullable-const-null-with-fields.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::result::Result; -use std::result::Result::Ok; - -static C: Result<(), Box<isize>> = Ok(()); - -// This is because of yet another bad assertion (ICE) about the null side of a nullable enum. -// So we won't actually compile if the bug is present, but we check the value in main anyway. - -pub fn main() { - assert!(C.is_ok()); -} diff --git a/src/tools/miri/tests/run-pass/enums.rs b/src/tools/miri/tests/run-pass/enums.rs deleted file mode 100644 index 1f27292904..0000000000 --- a/src/tools/miri/tests/run-pass/enums.rs +++ /dev/null @@ -1,34 +0,0 @@ -enum MyEnum { - MyEmptyVariant, - MyNewtypeVariant(i32), - MyTupleVariant(i32, i32), - MyStructVariant { - my_first_field: i32, - my_second_field: i32, - } -} - -fn test(me: MyEnum) { - match me { - MyEnum::MyEmptyVariant => {}, - MyEnum::MyNewtypeVariant(ref val) => assert_eq!(val, &42), - MyEnum::MyTupleVariant(ref a, ref b) => { - assert_eq!(a, &43); - assert_eq!(b, &44); - }, - MyEnum::MyStructVariant { ref my_first_field, ref my_second_field } => { - assert_eq!(my_first_field, &45); - assert_eq!(my_second_field, &46); - }, - } -} - -fn main() { - test(MyEnum::MyEmptyVariant); - test(MyEnum::MyNewtypeVariant(42)); - test(MyEnum::MyTupleVariant(43, 44)); - test(MyEnum::MyStructVariant{ - my_first_field: 45, - my_second_field: 46, - }); -} diff --git a/src/tools/miri/tests/run-pass/float_fast_math.rs b/src/tools/miri/tests/run-pass/float_fast_math.rs deleted file mode 100644 index c1b4b55bd3..0000000000 --- a/src/tools/miri/tests/run-pass/float_fast_math.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(core_intrinsics)] - -use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast}; - -#[inline(never)] -pub fn test_operations(a: f64, b: f64) { - // make sure they all map to the correct operation - unsafe { - assert_eq!(fadd_fast(a, b), a + b); - assert_eq!(fsub_fast(a, b), a - b); - assert_eq!(fmul_fast(a, b), a * b); - assert_eq!(fdiv_fast(a, b), a / b); - assert_eq!(frem_fast(a, b), a % b); - } -} - -fn main() { - test_operations(1., 2.); - test_operations(10., 5.); -} diff --git a/src/tools/miri/tests/run-pass/floats.rs b/src/tools/miri/tests/run-pass/floats.rs deleted file mode 100644 index 9c4d0594d1..0000000000 --- a/src/tools/miri/tests/run-pass/floats.rs +++ /dev/null @@ -1,11 +0,0 @@ - -fn main() { - assert_eq!(6.0_f32*6.0_f32, 36.0_f32); - assert_eq!(6.0_f64*6.0_f64, 36.0_f64); - assert_eq!(-{5.0_f32}, -5.0_f32); - assert!((5.0_f32/0.0).is_infinite()); - assert!((-5.0_f32).sqrt().is_nan()); - let x: u64 = unsafe { std::mem::transmute(42.0_f64) }; - let y: f64 = unsafe { std::mem::transmute(x) }; - assert_eq!(y, 42.0_f64); -} diff --git a/src/tools/miri/tests/run-pass/fn_item_as_closure_trait_object.rs b/src/tools/miri/tests/run-pass/fn_item_as_closure_trait_object.rs deleted file mode 100644 index 799f97a4f6..0000000000 --- a/src/tools/miri/tests/run-pass/fn_item_as_closure_trait_object.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn foo() {} - -fn main() { - let f: &Fn() = &foo; - f(); -} diff --git a/src/tools/miri/tests/run-pass/fn_item_with_args_as_closure_trait_object.rs b/src/tools/miri/tests/run-pass/fn_item_with_args_as_closure_trait_object.rs deleted file mode 100644 index 79ece75c77..0000000000 --- a/src/tools/miri/tests/run-pass/fn_item_with_args_as_closure_trait_object.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn foo(i: i32) { - assert_eq!(i, 42); -} - -fn main() { - let f: &Fn(i32) = &foo; - f(42); -} diff --git a/src/tools/miri/tests/run-pass/fn_item_with_multiple_args_as_closure_trait_object.rs b/src/tools/miri/tests/run-pass/fn_item_with_multiple_args_as_closure_trait_object.rs deleted file mode 100644 index f4b5b449aa..0000000000 --- a/src/tools/miri/tests/run-pass/fn_item_with_multiple_args_as_closure_trait_object.rs +++ /dev/null @@ -1,18 +0,0 @@ -fn foo(i: i32, j: i32) { - assert_eq!(i, 42); - assert_eq!(j, 55); -} - -fn bar(i: i32, j: i32, k: f32) { - assert_eq!(i, 42); - assert_eq!(j, 55); - assert_eq!(k, 3.14159) -} - - -fn main() { - let f: &Fn(i32, i32) = &foo; - f(42, 55); - let f: &Fn(i32, i32, f32) = &bar; - f(42, 55, 3.14159); -} diff --git a/src/tools/miri/tests/run-pass/fn_ptr_as_closure_trait_object.rs b/src/tools/miri/tests/run-pass/fn_ptr_as_closure_trait_object.rs deleted file mode 100644 index 24ae1f35bb..0000000000 --- a/src/tools/miri/tests/run-pass/fn_ptr_as_closure_trait_object.rs +++ /dev/null @@ -1,15 +0,0 @@ -fn foo() {} -fn bar(u: u32) { assert_eq!(u, 42); } -fn baa(u: u32, f: f32) { - assert_eq!(u, 42); - assert_eq!(f, 3.141); -} - -fn main() { - let f: &Fn() = &(foo as fn()); - f(); - let f: &Fn(u32) = &(bar as fn(u32)); - f(42); - let f: &Fn(u32, f32) = &(baa as fn(u32, f32)); - f(42, 3.141); -} diff --git a/src/tools/miri/tests/run-pass/function_pointers.rs b/src/tools/miri/tests/run-pass/function_pointers.rs deleted file mode 100644 index 4f597d4a2e..0000000000 --- a/src/tools/miri/tests/run-pass/function_pointers.rs +++ /dev/null @@ -1,46 +0,0 @@ -fn f() -> i32 { - 42 -} - -fn g(i: i32) -> i32 { - i*42 -} - -fn h(i: i32, j: i32) -> i32 { - j * i * 7 -} - -fn return_fn_ptr() -> fn() -> i32 { - f -} - -fn call_fn_ptr() -> i32 { - return_fn_ptr()() -} - -fn indirect<F: Fn() -> i32>(f: F) -> i32 { f() } -fn indirect_mut<F: FnMut() -> i32>(mut f: F) -> i32 { f() } -fn indirect_once<F: FnOnce() -> i32>(f: F) -> i32 { f() } - -fn indirect2<F: Fn(i32) -> i32>(f: F) -> i32 { f(10) } -fn indirect_mut2<F: FnMut(i32) -> i32>(mut f: F) -> i32 { f(10) } -fn indirect_once2<F: FnOnce(i32) -> i32>(f: F) -> i32 { f(10) } - -fn indirect3<F: Fn(i32, i32) -> i32>(f: F) -> i32 { f(10, 3) } -fn indirect_mut3<F: FnMut(i32, i32) -> i32>(mut f: F) -> i32 { f(10, 3) } -fn indirect_once3<F: FnOnce(i32, i32) -> i32>(f: F) -> i32 { f(10, 3) } - -fn main() { - assert_eq!(call_fn_ptr(), 42); - assert_eq!(indirect(f), 42); - assert_eq!(indirect_mut(f), 42); - assert_eq!(indirect_once(f), 42); - assert_eq!(indirect2(g), 420); - assert_eq!(indirect_mut2(g), 420); - assert_eq!(indirect_once2(g), 420); - assert_eq!(indirect3(h), 210); - assert_eq!(indirect_mut3(h), 210); - assert_eq!(indirect_once3(h), 210); - assert!(return_fn_ptr() == f); - assert!(return_fn_ptr() as unsafe fn() -> i32 == f as fn() -> i32 as unsafe fn() -> i32); -} diff --git a/src/tools/miri/tests/run-pass/generator_control_flow.rs b/src/tools/miri/tests/run-pass/generator_control_flow.rs deleted file mode 100644 index f15c7db9c2..0000000000 --- a/src/tools/miri/tests/run-pass/generator_control_flow.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(generators, generator_trait)] - -use std::ops::{GeneratorState, Generator}; - -fn finish<T>(mut amt: usize, mut t: T) -> T::Return - where T: Generator<Yield = ()> -{ - loop { - match t.resume() { - GeneratorState::Yielded(()) => amt -= 1, - GeneratorState::Complete(ret) => { - assert_eq!(amt, 0); - return ret - } - } - } - -} - -fn main() { - finish(1, || yield); - finish(3, || { - let mut x = 0; - yield; - x += 1; - yield; - x += 1; - yield; - assert_eq!(x, 2); - }); - finish(8, || { - for _ in 0..8 { - yield; - } - }); - finish(1, || { - if true { - yield; - } else { - } - }); - finish(1, || { - if false { - } else { - yield; - } - }); - finish(2, || { - if { yield; false } { - yield; - panic!() - } - yield - }); -} diff --git a/src/tools/miri/tests/run-pass/intrinsics-integer.rs b/src/tools/miri/tests/run-pass/intrinsics-integer.rs deleted file mode 100644 index 4896f02da2..0000000000 --- a/src/tools/miri/tests/run-pass/intrinsics-integer.rs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(intrinsics)] - -mod rusti { - extern "rust-intrinsic" { - pub fn ctpop<T>(x: T) -> T; - pub fn ctlz<T>(x: T) -> T; - pub fn ctlz_nonzero<T>(x: T) -> T; - pub fn cttz<T>(x: T) -> T; - pub fn cttz_nonzero<T>(x: T) -> T; - pub fn bswap<T>(x: T) -> T; - } -} - -pub fn main() { - unsafe { - use rusti::*; - - assert_eq!(ctpop(0u8), 0); assert_eq!(ctpop(0i8), 0); - assert_eq!(ctpop(0u16), 0); assert_eq!(ctpop(0i16), 0); - assert_eq!(ctpop(0u32), 0); assert_eq!(ctpop(0i32), 0); - assert_eq!(ctpop(0u64), 0); assert_eq!(ctpop(0i64), 0); - - assert_eq!(ctpop(1u8), 1); assert_eq!(ctpop(1i8), 1); - assert_eq!(ctpop(1u16), 1); assert_eq!(ctpop(1i16), 1); - assert_eq!(ctpop(1u32), 1); assert_eq!(ctpop(1i32), 1); - assert_eq!(ctpop(1u64), 1); assert_eq!(ctpop(1i64), 1); - - assert_eq!(ctpop(10u8), 2); assert_eq!(ctpop(10i8), 2); - assert_eq!(ctpop(10u16), 2); assert_eq!(ctpop(10i16), 2); - assert_eq!(ctpop(10u32), 2); assert_eq!(ctpop(10i32), 2); - assert_eq!(ctpop(10u64), 2); assert_eq!(ctpop(10i64), 2); - - assert_eq!(ctpop(100u8), 3); assert_eq!(ctpop(100i8), 3); - assert_eq!(ctpop(100u16), 3); assert_eq!(ctpop(100i16), 3); - assert_eq!(ctpop(100u32), 3); assert_eq!(ctpop(100i32), 3); - assert_eq!(ctpop(100u64), 3); assert_eq!(ctpop(100i64), 3); - - assert_eq!(ctpop(-1i8 as u8), 8); assert_eq!(ctpop(-1i8), 8); - assert_eq!(ctpop(-1i16 as u16), 16); assert_eq!(ctpop(-1i16), 16); - assert_eq!(ctpop(-1i32 as u32), 32); assert_eq!(ctpop(-1i32), 32); - assert_eq!(ctpop(-1i64 as u64), 64); assert_eq!(ctpop(-1i64), 64); - - assert_eq!(ctlz(0u8), 8); assert_eq!(ctlz(0i8), 8); - assert_eq!(ctlz(0u16), 16); assert_eq!(ctlz(0i16), 16); - assert_eq!(ctlz(0u32), 32); assert_eq!(ctlz(0i32), 32); - assert_eq!(ctlz(0u64), 64); assert_eq!(ctlz(0i64), 64); - - assert_eq!(ctlz(1u8), 7); assert_eq!(ctlz(1i8), 7); - assert_eq!(ctlz(1u16), 15); assert_eq!(ctlz(1i16), 15); - assert_eq!(ctlz(1u32), 31); assert_eq!(ctlz(1i32), 31); - assert_eq!(ctlz(1u64), 63); assert_eq!(ctlz(1i64), 63); - - assert_eq!(ctlz(10u8), 4); assert_eq!(ctlz(10i8), 4); - assert_eq!(ctlz(10u16), 12); assert_eq!(ctlz(10i16), 12); - assert_eq!(ctlz(10u32), 28); assert_eq!(ctlz(10i32), 28); - assert_eq!(ctlz(10u64), 60); assert_eq!(ctlz(10i64), 60); - - assert_eq!(ctlz(100u8), 1); assert_eq!(ctlz(100i8), 1); - assert_eq!(ctlz(100u16), 9); assert_eq!(ctlz(100i16), 9); - assert_eq!(ctlz(100u32), 25); assert_eq!(ctlz(100i32), 25); - assert_eq!(ctlz(100u64), 57); assert_eq!(ctlz(100i64), 57); - - assert_eq!(ctlz_nonzero(1u8), 7); assert_eq!(ctlz_nonzero(1i8), 7); - assert_eq!(ctlz_nonzero(1u16), 15); assert_eq!(ctlz_nonzero(1i16), 15); - assert_eq!(ctlz_nonzero(1u32), 31); assert_eq!(ctlz_nonzero(1i32), 31); - assert_eq!(ctlz_nonzero(1u64), 63); assert_eq!(ctlz_nonzero(1i64), 63); - - assert_eq!(ctlz_nonzero(10u8), 4); assert_eq!(ctlz_nonzero(10i8), 4); - assert_eq!(ctlz_nonzero(10u16), 12); assert_eq!(ctlz_nonzero(10i16), 12); - assert_eq!(ctlz_nonzero(10u32), 28); assert_eq!(ctlz_nonzero(10i32), 28); - assert_eq!(ctlz_nonzero(10u64), 60); assert_eq!(ctlz_nonzero(10i64), 60); - - assert_eq!(ctlz_nonzero(100u8), 1); assert_eq!(ctlz_nonzero(100i8), 1); - assert_eq!(ctlz_nonzero(100u16), 9); assert_eq!(ctlz_nonzero(100i16), 9); - assert_eq!(ctlz_nonzero(100u32), 25); assert_eq!(ctlz_nonzero(100i32), 25); - assert_eq!(ctlz_nonzero(100u64), 57); assert_eq!(ctlz_nonzero(100i64), 57); - - assert_eq!(cttz(-1i8 as u8), 0); assert_eq!(cttz(-1i8), 0); - assert_eq!(cttz(-1i16 as u16), 0); assert_eq!(cttz(-1i16), 0); - assert_eq!(cttz(-1i32 as u32), 0); assert_eq!(cttz(-1i32), 0); - assert_eq!(cttz(-1i64 as u64), 0); assert_eq!(cttz(-1i64), 0); - - assert_eq!(cttz(0u8), 8); assert_eq!(cttz(0i8), 8); - assert_eq!(cttz(0u16), 16); assert_eq!(cttz(0i16), 16); - assert_eq!(cttz(0u32), 32); assert_eq!(cttz(0i32), 32); - assert_eq!(cttz(0u64), 64); assert_eq!(cttz(0i64), 64); - - assert_eq!(cttz(1u8), 0); assert_eq!(cttz(1i8), 0); - assert_eq!(cttz(1u16), 0); assert_eq!(cttz(1i16), 0); - assert_eq!(cttz(1u32), 0); assert_eq!(cttz(1i32), 0); - assert_eq!(cttz(1u64), 0); assert_eq!(cttz(1i64), 0); - - assert_eq!(cttz(10u8), 1); assert_eq!(cttz(10i8), 1); - assert_eq!(cttz(10u16), 1); assert_eq!(cttz(10i16), 1); - assert_eq!(cttz(10u32), 1); assert_eq!(cttz(10i32), 1); - assert_eq!(cttz(10u64), 1); assert_eq!(cttz(10i64), 1); - - assert_eq!(cttz(100u8), 2); assert_eq!(cttz(100i8), 2); - assert_eq!(cttz(100u16), 2); assert_eq!(cttz(100i16), 2); - assert_eq!(cttz(100u32), 2); assert_eq!(cttz(100i32), 2); - assert_eq!(cttz(100u64), 2); assert_eq!(cttz(100i64), 2); - - assert_eq!(cttz_nonzero(-1i8 as u8), 0); assert_eq!(cttz_nonzero(-1i8), 0); - assert_eq!(cttz_nonzero(-1i16 as u16), 0); assert_eq!(cttz_nonzero(-1i16), 0); - assert_eq!(cttz_nonzero(-1i32 as u32), 0); assert_eq!(cttz_nonzero(-1i32), 0); - assert_eq!(cttz_nonzero(-1i64 as u64), 0); assert_eq!(cttz_nonzero(-1i64), 0); - - assert_eq!(cttz_nonzero(1u8), 0); assert_eq!(cttz_nonzero(1i8), 0); - assert_eq!(cttz_nonzero(1u16), 0); assert_eq!(cttz_nonzero(1i16), 0); - assert_eq!(cttz_nonzero(1u32), 0); assert_eq!(cttz_nonzero(1i32), 0); - assert_eq!(cttz_nonzero(1u64), 0); assert_eq!(cttz_nonzero(1i64), 0); - - assert_eq!(cttz_nonzero(10u8), 1); assert_eq!(cttz_nonzero(10i8), 1); - assert_eq!(cttz_nonzero(10u16), 1); assert_eq!(cttz_nonzero(10i16), 1); - assert_eq!(cttz_nonzero(10u32), 1); assert_eq!(cttz_nonzero(10i32), 1); - assert_eq!(cttz_nonzero(10u64), 1); assert_eq!(cttz_nonzero(10i64), 1); - - assert_eq!(cttz_nonzero(100u8), 2); assert_eq!(cttz_nonzero(100i8), 2); - assert_eq!(cttz_nonzero(100u16), 2); assert_eq!(cttz_nonzero(100i16), 2); - assert_eq!(cttz_nonzero(100u32), 2); assert_eq!(cttz_nonzero(100i32), 2); - assert_eq!(cttz_nonzero(100u64), 2); assert_eq!(cttz_nonzero(100i64), 2); - - assert_eq!(bswap(0x0Au8), 0x0A); // no-op - assert_eq!(bswap(0x0Ai8), 0x0A); // no-op - assert_eq!(bswap(0x0A0Bu16), 0x0B0A); - assert_eq!(bswap(0x0A0Bi16), 0x0B0A); - assert_eq!(bswap(0x0ABBCC0Du32), 0x0DCCBB0A); - assert_eq!(bswap(0x0ABBCC0Di32), 0x0DCCBB0A); - assert_eq!(bswap(0x0122334455667708u64), 0x0877665544332201); - assert_eq!(bswap(0x0122334455667708i64), 0x0877665544332201); - } -} diff --git a/src/tools/miri/tests/run-pass/intrinsics-math.rs b/src/tools/miri/tests/run-pass/intrinsics-math.rs deleted file mode 100644 index a2c5563474..0000000000 --- a/src/tools/miri/tests/run-pass/intrinsics-math.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -macro_rules! assert_approx_eq { - ($a:expr, $b:expr) => ({ - let (a, b) = (&$a, &$b); - assert!((*a - *b).abs() < 1.0e-6, - "{} is not approximately equal to {}", *a, *b); - }) -} - -pub fn main() { - use std::f32; - use std::f64; - - assert_approx_eq!(64f32.sqrt(), 8f32); - assert_approx_eq!(64f64.sqrt(), 8f64); - - assert_approx_eq!(25f32.powi(-2), 0.0016f32); - assert_approx_eq!(23.2f64.powi(2), 538.24f64); - - assert_approx_eq!(0f32.sin(), 0f32); - assert_approx_eq!((f64::consts::PI / 2f64).sin(), 1f64); - - assert_approx_eq!(0f32.cos(), 1f32); - assert_approx_eq!((f64::consts::PI * 2f64).cos(), 1f64); - - assert_approx_eq!(25f32.powf(-2f32), 0.0016f32); - assert_approx_eq!(400f64.powf(0.5f64), 20f64); - - assert_approx_eq!((1f32.exp() - f32::consts::E).abs(), 0f32); - assert_approx_eq!(1f64.exp(), f64::consts::E); - - assert_approx_eq!(10f32.exp2(), 1024f32); - assert_approx_eq!(50f64.exp2(), 1125899906842624f64); - - assert_approx_eq!((f32::consts::E.ln() - 1f32).abs(), 0f32); - assert_approx_eq!(1f64.ln(), 0f64); - - assert_approx_eq!(10f32.log10(), 1f32); - assert_approx_eq!(f64::consts::E.log10(), f64::consts::LOG10_E); - - assert_approx_eq!(8f32.log2(), 3f32); - assert_approx_eq!(f64::consts::E.log2(), f64::consts::LOG2_E); - - assert_approx_eq!(1.0f32.mul_add(2.0f32, 5.0f32), 7.0f32); - assert_approx_eq!(0.0f64.mul_add(-2.0f64, f64::consts::E), f64::consts::E); - - assert_approx_eq!((-1.0f32).abs(), 1.0f32); - assert_approx_eq!(34.2f64.abs(), 34.2f64); - - assert_approx_eq!(3.8f32.floor(), 3.0f32); - assert_approx_eq!((-1.1f64).floor(), -2.0f64); - - assert_approx_eq!((-2.3f32).ceil(), -2.0f32); - assert_approx_eq!(3.8f64.ceil(), 4.0f64); - - assert_approx_eq!(0.1f32.trunc(), 0.0f32); - assert_approx_eq!((-0.1f64).trunc(), 0.0f64); -} diff --git a/src/tools/miri/tests/run-pass/intrinsics.rs b/src/tools/miri/tests/run-pass/intrinsics.rs deleted file mode 100755 index 3152737a60..0000000000 --- a/src/tools/miri/tests/run-pass/intrinsics.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::mem::{size_of, size_of_val}; - -fn main() { - assert_eq!(size_of::<Option<i32>>(), 8); - assert_eq!(size_of_val(&()), 0); - assert_eq!(size_of_val(&42), 4); - assert_eq!(size_of_val(&[] as &[i32]), 0); - assert_eq!(size_of_val(&[1, 2, 3] as &[i32]), 12); - assert_eq!(size_of_val("foobar"), 6); -} diff --git a/src/tools/miri/tests/run-pass/ints.rs b/src/tools/miri/tests/run-pass/ints.rs deleted file mode 100644 index 4f23b5ec9c..0000000000 --- a/src/tools/miri/tests/run-pass/ints.rs +++ /dev/null @@ -1,58 +0,0 @@ -fn ret() -> i64 { - 1 -} - -fn neg() -> i64 { - -1 -} - -fn add() -> i64 { - 1 + 2 -} - -fn indirect_add() -> i64 { - let x = 1; - let y = 2; - x + y -} - -fn arith() -> i32 { - 3*3 + 4*4 -} - -fn match_int() -> i16 { - let n = 2; - match n { - 0 => 0, - 1 => 10, - 2 => 20, - 3 => 30, - _ => 100, - } -} - -fn match_int_range() -> i64 { - let n = 42; - match n { - 0...9 => 0, - 10...19 => 1, - 20...29 => 2, - 30...39 => 3, - 40...49 => 4, - _ => 5, - } -} - -fn main() { - assert_eq!(ret(), 1); - assert_eq!(neg(), -1); - assert_eq!(add(), 3); - assert_eq!(indirect_add(), 3); - assert_eq!(arith(), 5*5); - assert_eq!(match_int(), 20); - assert_eq!(match_int_range(), 4); - assert_eq!(i64::min_value().overflowing_mul(-1), (i64::min_value(), true)); - assert_eq!(i32::min_value().overflowing_mul(-1), (i32::min_value(), true)); - assert_eq!(i16::min_value().overflowing_mul(-1), (i16::min_value(), true)); - assert_eq!(i8::min_value().overflowing_mul(-1), (i8::min_value(), true)); -} diff --git a/src/tools/miri/tests/run-pass/issue-15523-big.rs b/src/tools/miri/tests/run-pass/issue-15523-big.rs deleted file mode 100644 index 33c81cab38..0000000000 --- a/src/tools/miri/tests/run-pass/issue-15523-big.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Issue 15523: derive(PartialOrd) should use the provided -// discriminant values for the derived ordering. -// -// This test is checking corner cases that arise when you have -// 64-bit values in the variants. - -#[derive(PartialEq, PartialOrd)] -#[repr(u64)] -enum Eu64 { - Pos2 = 2, - PosMax = !0, - Pos1 = 1, -} - -#[derive(PartialEq, PartialOrd)] -#[repr(i64)] -enum Ei64 { - Pos2 = 2, - Neg1 = -1, - NegMin = 1 << 63, - PosMax = !(1 << 63), - Pos1 = 1, -} - -fn main() { - assert!(Eu64::Pos2 > Eu64::Pos1); - assert!(Eu64::Pos2 < Eu64::PosMax); - assert!(Eu64::Pos1 < Eu64::PosMax); - - - assert!(Ei64::Pos2 > Ei64::Pos1); - assert!(Ei64::Pos2 > Ei64::Neg1); - assert!(Ei64::Pos1 > Ei64::Neg1); - assert!(Ei64::Pos2 > Ei64::NegMin); - assert!(Ei64::Pos1 > Ei64::NegMin); - assert!(Ei64::Pos2 < Ei64::PosMax); - assert!(Ei64::Pos1 < Ei64::PosMax); -} diff --git a/src/tools/miri/tests/run-pass/issue-17877.rs b/src/tools/miri/tests/run-pass/issue-17877.rs deleted file mode 100644 index b4b74b9905..0000000000 --- a/src/tools/miri/tests/run-pass/issue-17877.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//ignore-msvc - -#![feature(slice_patterns)] - -fn main() { - assert_eq!(match [0u8; 1024] { - _ => 42_usize, - }, 42_usize); - - assert_eq!(match [0u8; 1024] { - [1, _..] => 0_usize, - [0, _..] => 1_usize, - _ => 2_usize - }, 1_usize); -} diff --git a/src/tools/miri/tests/run-pass/issue-20575.rs b/src/tools/miri/tests/run-pass/issue-20575.rs deleted file mode 100644 index 7db7e3b28e..0000000000 --- a/src/tools/miri/tests/run-pass/issue-20575.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that overloaded calls work with zero arity closures - -// pretty-expanded FIXME #23616 - -fn main() { - let functions: [Box<Fn() -> Option<()>>; 1] = [Box::new(|| None)]; - - let _: Option<Vec<()>> = functions.iter().map(|f| (*f)()).collect(); -} diff --git a/src/tools/miri/tests/run-pass/issue-23261.rs b/src/tools/miri/tests/run-pass/issue-23261.rs deleted file mode 100644 index fc806f5429..0000000000 --- a/src/tools/miri/tests/run-pass/issue-23261.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Matching on a DST struct should not trigger an LLVM assertion. - -struct Foo<T: ?Sized> { - a: i32, - inner: T -} - -trait Get { - fn get(&self) -> i32; -} - -impl Get for i32 { - fn get(&self) -> i32 { - *self - } -} - -fn check_val(val: &Foo<[u8]>) { - match *val { - Foo { a, .. } => { - assert_eq!(a, 32); - } - } -} - -fn check_dst_val(val: &Foo<[u8]>) { - match *val { - Foo { ref inner, .. } => { - assert_eq!(inner, [1, 2, 3]); - } - } -} - -fn check_both(val: &Foo<[u8]>) { - match *val { - Foo { a, ref inner } => { - assert_eq!(a, 32); - assert_eq!(inner, [1, 2, 3]); - } - } -} - -fn check_trait_obj(val: &Foo<Get>) { - match *val { - Foo { a, ref inner } => { - assert_eq!(a, 32); - assert_eq!(inner.get(), 32); - } - } -} - -fn main() { - let foo: &Foo<[u8]> = &Foo { a: 32, inner: [1, 2, 3] }; - check_val(foo); - check_dst_val(foo); - check_both(foo); - - let foo: &Foo<Get> = &Foo { a: 32, inner: 32 }; - check_trait_obj(foo); -} diff --git a/src/tools/miri/tests/run-pass/issue-29746.rs b/src/tools/miri/tests/run-pass/issue-29746.rs deleted file mode 100644 index 61c601ac6a..0000000000 --- a/src/tools/miri/tests/run-pass/issue-29746.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// zip!(a1,a2,a3,a4) is equivalent to: -// a1.zip(a2).zip(a3).zip(a4).map(|(((x1,x2),x3),x4)| (x1,x2,x3,x4)) -macro_rules! zip { - // Entry point - ([$a:expr, $b:expr, $($rest:expr),*]) => { - zip!([$($rest),*], $a.zip($b), (x,y), [x,y]) - }; - - // Intermediate steps to build the zipped expression, the match pattern, and - // and the output tuple of the closure, using macro hygene to repeatedly - // introduce new variables named 'x'. - ([$a:expr, $($rest:expr),*], $zip:expr, $pat:pat, [$($flat:expr),*]) => { - zip!([$($rest),*], $zip.zip($a), ($pat,x), [$($flat),*, x]) - }; - - // Final step - ([], $zip:expr, $pat:pat, [$($flat:expr),+]) => { - $zip.map(|$pat| ($($flat),+)) - }; - - // Comma - ([$a:expr], $zip:expr, $pat:pat, [$($flat:expr),*]) => { - zip!([$a,], $zip, $pat, [$($flat),*]) - }; -} - -fn main() { - let p1 = vec![1i32, 2].into_iter(); - let p2 = vec!["10", "20"].into_iter(); - let p3 = vec![100u16, 200].into_iter(); - let p4 = vec![1000i64, 2000].into_iter(); - - let e = zip!([p1,p2,p3,p4]).collect::<Vec<_>>(); - assert_eq!(e[0], (1i32,"10",100u16,1000i64)); -} diff --git a/src/tools/miri/tests/run-pass/issue-30530.rs b/src/tools/miri/tests/run-pass/issue-30530.rs deleted file mode 100644 index d5139c908b..0000000000 --- a/src/tools/miri/tests/run-pass/issue-30530.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Regression test for Issue #30530: alloca's created for storing -// intermediate scratch values during brace-less match arms need to be -// initialized with their drop-flag set to "dropped" (or else we end -// up running the destructors on garbage data at the end of the -// function). - -pub enum Handler { - Default, - #[allow(dead_code)] - Custom(*mut Box<Fn()>), -} - -fn main() { - take(Handler::Default, Box::new(main)); -} - -#[inline(never)] -pub fn take(h: Handler, f: Box<Fn()>) -> Box<Fn()> { - unsafe { - match h { - Handler::Custom(ptr) => *Box::from_raw(ptr), - Handler::Default => f, - } - } -} diff --git a/src/tools/miri/tests/run-pass/issue-36278-prefix-nesting.rs b/src/tools/miri/tests/run-pass/issue-36278-prefix-nesting.rs deleted file mode 100644 index 95269d0569..0000000000 --- a/src/tools/miri/tests/run-pass/issue-36278-prefix-nesting.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Issue 36278: On an unsized struct with >1 level of nontrivial -// nesting, ensure we are computing dynamic size of prefix correctly. - -use std::mem; - -const SZ: usize = 100; -struct P<T: ?Sized>([u8; SZ], T); - -type Ack<T> = P<P<T>>; - -fn main() { - let size_of_sized; let size_of_unsized; - let x: Box<Ack<[u8; 0]>> = Box::new(P([0; SZ], P([0; SZ], [0; 0]))); - size_of_sized = mem::size_of_val::<Ack<_>>(&x); - let y: Box<Ack<[u8 ]>> = x; - size_of_unsized = mem::size_of_val::<Ack<_>>(&y); - assert_eq!(size_of_sized, size_of_unsized); -} diff --git a/src/tools/miri/tests/run-pass/issue-5917.rs b/src/tools/miri/tests/run-pass/issue-5917.rs deleted file mode 100644 index 69b95f2cd7..0000000000 --- a/src/tools/miri/tests/run-pass/issue-5917.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -struct T (&'static [isize]); -static STATIC : T = T (&[5, 4, 3]); -pub fn main () { - let T(ref v) = STATIC; - assert_eq!(v[0], 5); -} diff --git a/src/tools/miri/tests/run-pass/issue-miri-184.rs b/src/tools/miri/tests/run-pass/issue-miri-184.rs deleted file mode 100644 index 24775fe8a2..0000000000 --- a/src/tools/miri/tests/run-pass/issue-miri-184.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub fn main() { - let bytes: [u8; 8] = unsafe { ::std::mem::transmute(0u64) }; - let _: &[u8] = &bytes; -} diff --git a/src/tools/miri/tests/run-pass/iter_slice.rs b/src/tools/miri/tests/run-pass/iter_slice.rs deleted file mode 100644 index fd7229c345..0000000000 --- a/src/tools/miri/tests/run-pass/iter_slice.rs +++ /dev/null @@ -1,12 +0,0 @@ -fn main() { - for _ in Vec::<u32>::new().iter() { // this iterates over a Unique::empty() - panic!("We should never be here."); - } - - // Iterate over a ZST (uses arith_offset internally) - let mut count = 0; - for _ in &[(), (), ()] { - count += 1; - } - assert_eq!(count, 3); -} diff --git a/src/tools/miri/tests/run-pass/loops.rs b/src/tools/miri/tests/run-pass/loops.rs deleted file mode 100644 index 222287cbe0..0000000000 --- a/src/tools/miri/tests/run-pass/loops.rs +++ /dev/null @@ -1,35 +0,0 @@ -fn factorial_loop() -> i64 { - let mut product = 1; - let mut i = 1; - - while i <= 10 { - product *= i; - i += 1; - } - - product -} - -fn index_for_loop() -> usize { - let mut sum = 0; - let a = [0, 10, 20, 30]; - for i in 0..a.len() { - sum += a[i]; - } - sum -} - -fn for_loop() -> usize { - let mut sum = 0; - let a = [0, 10, 20, 30]; - for &n in &a { - sum += n; - } - sum -} - -fn main() { - assert_eq!(factorial_loop(), 3628800); - assert_eq!(index_for_loop(), 60); - assert_eq!(for_loop(), 60); -} diff --git a/src/tools/miri/tests/run-pass/main_fn.rs b/src/tools/miri/tests/run-pass/main_fn.rs deleted file mode 100644 index 91d183ee6a..0000000000 --- a/src/tools/miri/tests/run-pass/main_fn.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![feature(main)] - -#[main] -fn foo() { -} diff --git a/src/tools/miri/tests/run-pass/many_shr_bor.rs b/src/tools/miri/tests/run-pass/many_shr_bor.rs deleted file mode 100644 index 393bafebfe..0000000000 --- a/src/tools/miri/tests/run-pass/many_shr_bor.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Make sure validation can handle many overlapping shared borrows for different parts of a data structure -#![allow(unused_variables)] -use std::cell::RefCell; - -struct Test { - a: u32, - b: u32, -} - -fn test1() { - let t = &mut Test { a: 0, b: 0 }; - { - let x; - { - let y = &t.a; - x = &t; - let _y = *y; - } - let _x = x.a; - } - t.b = 42; -} - -fn test2(r: &mut RefCell<i32>) { - let x = &*r; // releasing write lock, first suspension recorded - let mut x_ref = x.borrow_mut(); - let x_inner : &mut i32 = &mut *x_ref; // new inner write lock, with same lifetime as outer lock - let x_inner_shr = &*x_inner; // releasing inner write lock, recording suspension - let y = &*r; // second suspension for the outer write lock - let x_inner_shr2 = &*x_inner; // 2nd suspension for inner write lock -} - -fn main() { - test1(); - test2(&mut RefCell::new(0)); -} diff --git a/src/tools/miri/tests/run-pass/match_slice.rs b/src/tools/miri/tests/run-pass/match_slice.rs deleted file mode 100644 index 568a1a1c88..0000000000 --- a/src/tools/miri/tests/run-pass/match_slice.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - let x = "hello"; - match x { - "foo" => {}, - "bar" => {}, - _ => {}, - } -} diff --git a/src/tools/miri/tests/run-pass/mir_coercions.rs b/src/tools/miri/tests/run-pass/mir_coercions.rs deleted file mode 100644 index 36155297e3..0000000000 --- a/src/tools/miri/tests/run-pass/mir_coercions.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(coerce_unsized, unsize)] - -use std::ops::CoerceUnsized; -use std::marker::Unsize; - -fn identity_coercion(x: &(Fn(u32)->u32 + Send)) -> &Fn(u32)->u32 { - x -} -fn fn_coercions(f: &fn(u32) -> u32) -> - (unsafe fn(u32) -> u32, - &(Fn(u32) -> u32+Send)) -{ - (*f, f) -} - -fn simple_array_coercion(x: &[u8; 3]) -> &[u8] { x } - -fn square(a: u32) -> u32 { a * a } - -#[derive(PartialEq,Eq)] -struct PtrWrapper<'a, T: 'a+?Sized>(u32, u32, (), &'a T); -impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> - CoerceUnsized<PtrWrapper<'a, U>> for PtrWrapper<'a, T> {} - -struct TrivPtrWrapper<'a, T: 'a+?Sized>(&'a T); -impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> - CoerceUnsized<TrivPtrWrapper<'a, U>> for TrivPtrWrapper<'a, T> {} - -fn coerce_ptr_wrapper(p: PtrWrapper<[u8; 3]>) -> PtrWrapper<[u8]> { - p -} - -fn coerce_triv_ptr_wrapper(p: TrivPtrWrapper<[u8; 3]>) -> TrivPtrWrapper<[u8]> { - p -} - -fn coerce_fat_ptr_wrapper(p: PtrWrapper<Fn(u32) -> u32+Send>) - -> PtrWrapper<Fn(u32) -> u32> { - p -} - -fn coerce_ptr_wrapper_poly<'a, T, Trait: ?Sized>(p: PtrWrapper<'a, T>) - -> PtrWrapper<'a, Trait> - where PtrWrapper<'a, T>: CoerceUnsized<PtrWrapper<'a, Trait>> -{ - p -} - -fn main() { - let a = [0,1,2]; - let square_local : fn(u32) -> u32 = square; - let (f,g) = fn_coercions(&square_local); - assert_eq!(f as *const (), square as *const()); - assert_eq!(g(4), 16); - assert_eq!(identity_coercion(g)(5), 25); - - assert_eq!(simple_array_coercion(&a), &a); - let w = coerce_ptr_wrapper(PtrWrapper(2,3,(),&a)); - assert!(w == PtrWrapper(2,3,(),&a) as PtrWrapper<[u8]>); - - let w = coerce_triv_ptr_wrapper(TrivPtrWrapper(&a)); - assert_eq!(&w.0, &a); - - let z = coerce_fat_ptr_wrapper(PtrWrapper(2,3,(),&square_local)); - assert_eq!((z.3)(6), 36); - - let z: PtrWrapper<Fn(u32) -> u32> = - coerce_ptr_wrapper_poly(PtrWrapper(2,3,(),&square_local)); - assert_eq!((z.3)(6), 36); -} diff --git a/src/tools/miri/tests/run-pass/mir_fat_ptr.rs b/src/tools/miri/tests/run-pass/mir_fat_ptr.rs deleted file mode 100644 index e5c9e3577d..0000000000 --- a/src/tools/miri/tests/run-pass/mir_fat_ptr.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// test that ordinary fat pointer operations work. - -struct Wrapper<T: ?Sized>(u32, T); - -struct FatPtrContainer<'a> { - ptr: &'a [u8] -} - -fn fat_ptr_project(a: &Wrapper<[u8]>) -> &[u8] { - &a.1 -} - -fn fat_ptr_simple(a: &[u8]) -> &[u8] { - a -} - -fn fat_ptr_via_local(a: &[u8]) -> &[u8] { - let x = a; - x -} - -fn fat_ptr_from_struct(s: FatPtrContainer) -> &[u8] { - s.ptr -} - -fn fat_ptr_to_struct(a: &[u8]) -> FatPtrContainer { - FatPtrContainer { ptr: a } -} - -fn fat_ptr_store_to<'a>(a: &'a [u8], b: &mut &'a [u8]) { - *b = a; -} - -fn fat_ptr_constant() -> &'static str { - "HELLO" -} - -fn main() { - let a = Wrapper(4, [7,6,5]); - - let p = fat_ptr_project(&a); - let p = fat_ptr_simple(p); - let p = fat_ptr_via_local(p); - let p = fat_ptr_from_struct(fat_ptr_to_struct(p)); - - let mut target : &[u8] = &[42]; - fat_ptr_store_to(p, &mut target); - assert_eq!(target, &a.1); - - assert_eq!(fat_ptr_constant(), "HELLO"); -} diff --git a/src/tools/miri/tests/run-pass/miri-issue-133.rs b/src/tools/miri/tests/run-pass/miri-issue-133.rs deleted file mode 100644 index 406b5e102c..0000000000 --- a/src/tools/miri/tests/run-pass/miri-issue-133.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::mem::size_of; - -struct S<U, V> { - _u: U, - size_of_u: usize, - _v: V, - size_of_v: usize -} - -impl<U, V> S<U, V> { - fn new(u: U, v: V) -> Self { - S { - _u: u, - size_of_u: size_of::<U>(), - _v: v, - size_of_v: size_of::<V>() - } - } -} - -impl<V, U> Drop for S<U, V> { - fn drop(&mut self) { - assert_eq!(size_of::<U>(), self.size_of_u); - assert_eq!(size_of::<V>(), self.size_of_v); - } -} - -fn main() { - S::new(0u8, 1u16); -} diff --git a/src/tools/miri/tests/run-pass/move-undef-primval.rs b/src/tools/miri/tests/run-pass/move-undef-primval.rs deleted file mode 100644 index 2c18c2d368..0000000000 --- a/src/tools/miri/tests/run-pass/move-undef-primval.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Moving around undef is not allowed by validation -// compile-flags: -Zmir-emit-validate=0 - -struct Foo { - _inner: i32, -} - -fn main() { - unsafe { - let foo = Foo { - _inner: std::mem::uninitialized(), - }; - let _bar = foo; - } -} diff --git a/src/tools/miri/tests/run-pass/multi_arg_closure.rs b/src/tools/miri/tests/run-pass/multi_arg_closure.rs deleted file mode 100644 index 30cfb5b685..0000000000 --- a/src/tools/miri/tests/run-pass/multi_arg_closure.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn foo(f: &mut FnMut(isize, isize) -> isize) -> isize { - f(1, 2) -} - -fn main() { - let z = foo(&mut |x, y| x * 10 + y); - assert_eq!(z, 12); -} diff --git a/src/tools/miri/tests/run-pass/negative_discriminant.rs b/src/tools/miri/tests/run-pass/negative_discriminant.rs deleted file mode 100644 index 16f175e7df..0000000000 --- a/src/tools/miri/tests/run-pass/negative_discriminant.rs +++ /dev/null @@ -1,13 +0,0 @@ -enum AB { A = -1, B = 1 } - -fn main() { - match AB::A { - AB::A => (), - AB::B => panic!(), - } - - match AB::B { - AB::A => panic!(), - AB::B => (), - } -} diff --git a/src/tools/miri/tests/run-pass/non_capture_closure_to_fn_ptr.rs b/src/tools/miri/tests/run-pass/non_capture_closure_to_fn_ptr.rs deleted file mode 100644 index c9daff9c9f..0000000000 --- a/src/tools/miri/tests/run-pass/non_capture_closure_to_fn_ptr.rs +++ /dev/null @@ -1,14 +0,0 @@ -// allow(const_err) to work around a bug in warnings -#[allow(const_err)] -static FOO: fn() = || { assert_ne!(42, 43) }; -#[allow(const_err)] -static BAR: fn(i32, i32) = |a, b| { assert_ne!(a, b) }; - -fn main() { - FOO(); - BAR(44, 45); - let bar: unsafe fn(i32, i32) = BAR; - unsafe { bar(46, 47) }; - let boo: &Fn(i32, i32) = &BAR; - boo(48, 49); -} diff --git a/src/tools/miri/tests/run-pass/observed_local_mut.rs b/src/tools/miri/tests/run-pass/observed_local_mut.rs deleted file mode 100644 index a4ecf1e635..0000000000 --- a/src/tools/miri/tests/run-pass/observed_local_mut.rs +++ /dev/null @@ -1,21 +0,0 @@ -// This test is intended to guard against the problem described in commit -// 39bb1254d1eaf74f45a4e741097e33fc942168d5. -// -// As written, it might be considered UB in compiled Rust, but of course Miri gives it a safe, -// deterministic behaviour (one that might not correspond with how an eventual Rust spec would -// defined this). -// -// An alternative way to write the test without `unsafe` would be to use `Cell<i32>`, but it would -// only surface the bug described by the above commit if `Cell<i32>` on the stack got represented -// as a primitive `PrimVal::I32` which is not yet the case. - -fn main() { - let mut x = 0; - let y: *const i32 = &x; - x = 1; - - // When the described bug is in place, this results in `0`, not observing the `x = 1` line. - assert_eq!(unsafe { *y }, 1); - - assert_eq!(x, 1); -} diff --git a/src/tools/miri/tests/run-pass/option_box_transmute_ptr.rs b/src/tools/miri/tests/run-pass/option_box_transmute_ptr.rs deleted file mode 100644 index 0786db1ef8..0000000000 --- a/src/tools/miri/tests/run-pass/option_box_transmute_ptr.rs +++ /dev/null @@ -1,15 +0,0 @@ -// This tests that the size of Option<Box<i32>> is the same as *const i32. -fn option_box_deref() -> i32 { - let val = Some(Box::new(42)); - unsafe { - let ptr: *const i32 = std::mem::transmute::<Option<Box<i32>>, *const i32>(val); - let ret = *ptr; - // unleak memory - std::mem::transmute::<*const i32, Option<Box<i32>>>(ptr); - ret - } -} - -fn main() { - assert_eq!(option_box_deref(), 42); -} diff --git a/src/tools/miri/tests/run-pass/option_eq.rs b/src/tools/miri/tests/run-pass/option_eq.rs deleted file mode 100644 index e698f87677..0000000000 --- a/src/tools/miri/tests/run-pass/option_eq.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - assert_eq!(std::char::from_u32('x' as u32), Some('x')); -} diff --git a/src/tools/miri/tests/run-pass/overloaded-calls-simple.rs b/src/tools/miri/tests/run-pass/overloaded-calls-simple.rs deleted file mode 100644 index 1eeda12ca0..0000000000 --- a/src/tools/miri/tests/run-pass/overloaded-calls-simple.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -#![feature(lang_items, unboxed_closures, fn_traits)] - -struct S3 { - x: i32, - y: i32, -} - -impl FnOnce<(i32,i32)> for S3 { - type Output = i32; - extern "rust-call" fn call_once(self, (z,zz): (i32,i32)) -> i32 { - self.x * self.y * z * zz - } -} - -fn main() { - let s = S3 { - x: 3, - y: 3, - }; - let ans = s(3, 1); - assert_eq!(ans, 27); -} diff --git a/src/tools/miri/tests/run-pass/packed_static.rs b/src/tools/miri/tests/run-pass/packed_static.rs deleted file mode 100644 index 1fa3a36967..0000000000 --- a/src/tools/miri/tests/run-pass/packed_static.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[repr(packed)] -struct Foo { - i: i32 -} - -fn main() { - assert_eq!({FOO.i}, 42); -} - -static FOO: Foo = Foo { i: 42 }; diff --git a/src/tools/miri/tests/run-pass/packed_struct.rs b/src/tools/miri/tests/run-pass/packed_struct.rs deleted file mode 100644 index e0387a5f40..0000000000 --- a/src/tools/miri/tests/run-pass/packed_struct.rs +++ /dev/null @@ -1,69 +0,0 @@ -// FIXME: We have to disable this, force_allocation fails. -// TODO: I think this can be triggered even without validation. -// compile-flags: -Zmir-emit-validate=0 -#![allow(dead_code)] -#![feature(unsize, coerce_unsized)] - -#[repr(packed)] -struct S { - a: i32, - b: i64, -} - -#[repr(packed)] -struct Test1<'a> { - x: u8, - other: &'a u32, -} - -#[repr(packed)] -struct Test2<'a> { - x: u8, - other: &'a Test1<'a>, -} - -fn test(t: Test2) { - let x = *t.other.other; - assert_eq!(x, 42); -} - -fn test_unsizing() { - #[repr(packed)] - struct UnalignedPtr<'a, T: ?Sized> - where T: 'a, - { - data: &'a T, - } - - impl<'a, T, U> std::ops::CoerceUnsized<UnalignedPtr<'a, U>> for UnalignedPtr<'a, T> - where - T: std::marker::Unsize<U> + ?Sized, - U: ?Sized, - { } - - let arr = [1, 2, 3]; - let arr_unaligned: UnalignedPtr<[i32; 3]> = UnalignedPtr { data: &arr }; - let arr_unaligned: UnalignedPtr<[i32]> = arr_unaligned; - let _unused = &arr_unaligned; // forcing an allocation, which could also yield "unaligned write"-errors -} - -fn main() { - let mut x = S { - a: 42, - b: 99, - }; - let a = x.a; - let b = x.b; - assert_eq!(a, 42); - assert_eq!(b, 99); - // can't do `assert_eq!(x.a, 42)`, because `assert_eq!` takes a reference - assert_eq!({x.a}, 42); - assert_eq!({x.b}, 99); - - x.b = 77; - assert_eq!({x.b}, 77); - - test(Test2 { x: 0, other: &Test1 { x: 0, other: &42 }}); - - test_unsizing(); -} diff --git a/src/tools/miri/tests/run-pass/pointers.rs b/src/tools/miri/tests/run-pass/pointers.rs deleted file mode 100644 index f3ae3ab913..0000000000 --- a/src/tools/miri/tests/run-pass/pointers.rs +++ /dev/null @@ -1,60 +0,0 @@ -fn one_line_ref() -> i16 { - *&1 -} - -fn basic_ref() -> i16 { - let x = &1; - *x -} - -fn basic_ref_mut() -> i16 { - let x = &mut 1; - *x += 2; - *x -} - -fn basic_ref_mut_var() -> i16 { - let mut a = 1; - { - let x = &mut a; - *x += 2; - } - a -} - -fn tuple_ref_mut() -> (i8, i8) { - let mut t = (10, 20); - { - let x = &mut t.1; - *x += 2; - } - t -} - -fn match_ref_mut() -> i8 { - let mut t = (20, 22); - { - let opt = Some(&mut t); - match opt { - Some(&mut (ref mut x, ref mut y)) => *x += *y, - None => {}, - } - } - t.0 -} - -fn dangling_pointer() -> *const i32 { - let b = Box::new(42); - &*b as *const i32 -} - -fn main() { - assert_eq!(one_line_ref(), 1); - assert_eq!(basic_ref(), 1); - assert_eq!(basic_ref_mut(), 3); - assert_eq!(basic_ref_mut_var(), 3); - assert_eq!(tuple_ref_mut(), (10, 22)); - assert_eq!(match_ref_mut(), 42); - // FIXME: improve this test... how? - assert!(dangling_pointer() != std::ptr::null()); -} diff --git a/src/tools/miri/tests/run-pass/products.rs b/src/tools/miri/tests/run-pass/products.rs deleted file mode 100644 index 86bb71a0be..0000000000 --- a/src/tools/miri/tests/run-pass/products.rs +++ /dev/null @@ -1,32 +0,0 @@ -fn tuple() -> (i16,) { - (1,) -} - -fn tuple_2() -> (i16, i16) { - (1, 2) -} - -fn tuple_5() -> (i16, i16, i16, i16, i16) { - (1, 2, 3, 4, 5) -} - -#[derive(Debug, PartialEq)] -struct Pair { x: i8, y: i8 } - -fn pair() -> Pair { - Pair { x: 10, y: 20 } -} - -fn field_access() -> (i8, i8) { - let mut p = Pair { x: 10, y: 20 }; - p.x += 5; - (p.x, p.y) -} - -fn main() { - assert_eq!(tuple(), (1,)); - assert_eq!(tuple_2(), (1, 2)); - assert_eq!(tuple_5(), (1, 2, 3, 4, 5)); - assert_eq!(pair(), Pair { x: 10, y: 20} ); - assert_eq!(field_access(), (15, 20)); -} diff --git a/src/tools/miri/tests/run-pass/ptr_arith_offset.rs b/src/tools/miri/tests/run-pass/ptr_arith_offset.rs deleted file mode 100644 index 7912da9fd4..0000000000 --- a/src/tools/miri/tests/run-pass/ptr_arith_offset.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - let v = [1i16, 2]; - let x = &v as *const i16; - let x = x.wrapping_offset(1); - assert_eq!(unsafe { *x }, 2); -} diff --git a/src/tools/miri/tests/run-pass/ptr_arith_offset_overflow.rs b/src/tools/miri/tests/run-pass/ptr_arith_offset_overflow.rs deleted file mode 100644 index 3383c3b801..0000000000 --- a/src/tools/miri/tests/run-pass/ptr_arith_offset_overflow.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let v = [1i16, 2]; - let x = &v[1] as *const i16; - // Adding 2*isize::max and then 1 is like substracting 1 - let x = x.wrapping_offset(isize::max_value()); - let x = x.wrapping_offset(isize::max_value()); - let x = x.wrapping_offset(1); - assert_eq!(unsafe { *x }, 1); -} diff --git a/src/tools/miri/tests/run-pass/ptr_int_casts.rs b/src/tools/miri/tests/run-pass/ptr_int_casts.rs deleted file mode 100644 index b1b0626305..0000000000 --- a/src/tools/miri/tests/run-pass/ptr_int_casts.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::mem; - -fn eq_ref<T>(x: &T, y: &T) -> bool { - x as *const _ == y as *const _ -} - -fn f() -> i32 { 42 } - -fn main() { - // int-ptr-int - assert_eq!(1 as *const i32 as usize, 1); - assert_eq!((1 as *const i32).wrapping_offset(4) as usize, 1 + 4*4); - - { // ptr-int-ptr - let x = 13; - let mut y = &x as &_ as *const _ as usize; - y += 13; - y -= 13; - let y = y as *const _; - assert!(eq_ref(&x, unsafe { &*y })); - } - - { // fnptr-int-fnptr - let x : fn() -> i32 = f; - let y : *mut u8 = unsafe { mem::transmute(x as fn() -> i32) }; - let mut y = y as usize; - y += 13; - y -= 13; - let x : fn() -> i32 = unsafe { mem::transmute(y as *mut u8) }; - assert_eq!(x(), 42); - } - - // involving types other than usize - assert_eq!((-1i32) as usize as *const i32 as usize, (-1i32) as usize); -} diff --git a/src/tools/miri/tests/run-pass/ptr_offset.rs b/src/tools/miri/tests/run-pass/ptr_offset.rs deleted file mode 100644 index 6add5212db..0000000000 --- a/src/tools/miri/tests/run-pass/ptr_offset.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - let v = [1i16, 2]; - let x = &v as *const i16; - let x = unsafe { x.offset(1) }; - assert_eq!(unsafe { *x }, 2); -} diff --git a/src/tools/miri/tests/run-pass/rc.rs b/src/tools/miri/tests/run-pass/rc.rs deleted file mode 100644 index 0bf7075031..0000000000 --- a/src/tools/miri/tests/run-pass/rc.rs +++ /dev/null @@ -1,39 +0,0 @@ -use std::cell::RefCell; -use std::rc::Rc; - -fn rc_refcell() { - let r = Rc::new(RefCell::new(42)); - *r.borrow_mut() += 10; - let x = *r.borrow(); - assert_eq!(x, 52); -} - -fn rc_raw() { - let r = Rc::new(0); - let r2 = Rc::into_raw(r.clone()); - let r2 = unsafe { Rc::from_raw(r2) }; - assert!(Rc::ptr_eq(&r, &r2)); - drop(r); - assert!(Rc::try_unwrap(r2).is_ok()); -} - -// Make sure this Rc doesn't fall apart when touched -fn check_unique_rc<T: ?Sized>(mut r: Rc<T>) { - let r2 = r.clone(); - assert!(Rc::get_mut(&mut r).is_none()); - drop(r2); - assert!(Rc::get_mut(&mut r).is_some()); -} - -fn rc_from() { - check_unique_rc::<[_]>(Rc::from(&[1,2,3] as &[_])); - check_unique_rc::<[_]>(Rc::from(vec![1,2,3])); - check_unique_rc::<[_]>(Rc::from(Box::new([1,2,3]) as Box<[_]>)); - check_unique_rc::<str>(Rc::from("Hello, World!")); -} - -fn main() { - rc_refcell(); - rc_raw(); - rc_from(); -} diff --git a/src/tools/miri/tests/run-pass/recursive_static.rs b/src/tools/miri/tests/run-pass/recursive_static.rs deleted file mode 100644 index d259ca6361..0000000000 --- a/src/tools/miri/tests/run-pass/recursive_static.rs +++ /dev/null @@ -1,12 +0,0 @@ -// FIXME: Disable validation until we figure out how to handle recursive statics. -// compile-flags: -Zmir-emit-validate=0 - -struct S(&'static S); -static S1: S = S(&S2); -static S2: S = S(&S1); - -fn main() { - let p: *const S = S2.0; - let q: *const S = &S1; - assert_eq!(p, q); -} diff --git a/src/tools/miri/tests/run-pass/ref-invalid-ptr.rs b/src/tools/miri/tests/run-pass/ref-invalid-ptr.rs deleted file mode 100644 index ebbbb77748..0000000000 --- a/src/tools/miri/tests/run-pass/ref-invalid-ptr.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let x = 2usize as *const u32; - let _y = unsafe { &*x as *const u32 }; - - let x = 0usize as *const u32; - let _y = unsafe { &*x as *const u32 }; -} diff --git a/src/tools/miri/tests/run-pass/regions-lifetime-nonfree-late-bound.rs b/src/tools/miri/tests/run-pass/regions-lifetime-nonfree-late-bound.rs deleted file mode 100644 index 1aef95d8a3..0000000000 --- a/src/tools/miri/tests/run-pass/regions-lifetime-nonfree-late-bound.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This is a regression test for the ICE from issue #10846. -// -// The original issue causing the ICE: the LUB-computations during -// type inference were encountering late-bound lifetimes, and -// asserting that such lifetimes should have already been substituted -// with a concrete lifetime. -// -// However, those encounters were occurring within the lexical scope -// of the binding for the late-bound lifetime; that is, the late-bound -// lifetimes were perfectly valid. The core problem was that the type -// folding code was over-zealously passing back all lifetimes when -// doing region-folding, when really all clients of the region-folding -// case only want to see FREE lifetime variables, not bound ones. - -// pretty-expanded FIXME #23616 - -#![allow(unused_features)] -#![feature(box_syntax)] - -pub fn main() { - fn explicit() { - fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<for<'a> FnMut(&'a isize)>) {} - test(Some(box |_f: Box<for<'a> FnMut(&'a isize)>| {})); - } - - // The code below is shorthand for the code above (and more likely - // to represent what one encounters in practice). - fn implicit() { - fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box< FnMut(& isize)>) {} - test(Some(box |_f: Box< FnMut(& isize)>| {})); - } - - explicit(); - implicit(); -} diff --git a/src/tools/miri/tests/run-pass/rfc1623.rs b/src/tools/miri/tests/run-pass/rfc1623.rs deleted file mode 100644 index 0ee523a5be..0000000000 --- a/src/tools/miri/tests/run-pass/rfc1623.rs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] - -// very simple test for a 'static static with default lifetime -static STATIC_STR: &str = "&'static str"; -const CONST_STR: &str = "&'static str"; - -// this should be the same as without default: -static EXPLICIT_STATIC_STR: &'static str = "&'static str"; -const EXPLICIT_CONST_STR: &'static str = "&'static str"; - -// a function that elides to an unbound lifetime for both in- and output -fn id_u8_slice(arg: &[u8]) -> &[u8] { - arg -} - -// one with a function, argument elided -static STATIC_SIMPLE_FN: &fn(&[u8]) -> &[u8] = &(id_u8_slice as fn(&[u8]) -> &[u8]); -const CONST_SIMPLE_FN: &fn(&[u8]) -> &[u8] = &(id_u8_slice as fn(&[u8]) -> &[u8]); - -// this should be the same as without elision -static STATIC_NON_ELIDED_FN: &for<'a> fn(&'a [u8]) -> &'a [u8] = - &(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]); -const CONST_NON_ELIDED_FN: &for<'a> fn(&'a [u8]) -> &'a [u8] = - &(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]); - -// another function that elides, each to a different unbound lifetime -fn multi_args(_a: &u8, _b: &u8, _c: &u8) {} - -static STATIC_MULTI_FN: &fn(&u8, &u8, &u8) = &(multi_args as fn(&u8, &u8, &u8)); -const CONST_MULTI_FN: &fn(&u8, &u8, &u8) = &(multi_args as fn(&u8, &u8, &u8)); - -struct Foo<'a> { - bools: &'a [bool], -} - -static STATIC_FOO: Foo = Foo { bools: &[true, false] }; -const CONST_FOO: Foo = Foo { bools: &[true, false] }; - -type Bar<'a> = Foo<'a>; - -static STATIC_BAR: Bar = Bar { bools: &[true, false] }; -const CONST_BAR: Bar = Bar { bools: &[true, false] }; - -type Baz<'a> = fn(&'a [u8]) -> Option<u8>; - -fn baz(e: &[u8]) -> Option<u8> { - e.first().map(|x| *x) -} - -static STATIC_BAZ: &Baz = &(baz as Baz); -const CONST_BAZ: &Baz = &(baz as Baz); - -static BYTES: &[u8] = &[1, 2, 3]; - -fn main() { - // make sure that the lifetime is actually elided (and not defaulted) - let x = &[1u8, 2, 3]; - STATIC_SIMPLE_FN(x); - CONST_SIMPLE_FN(x); - - STATIC_BAZ(BYTES); // neees static lifetime - CONST_BAZ(BYTES); - - // make sure this works with different lifetimes - let a = &1; - { - let b = &2; - let c = &3; - CONST_MULTI_FN(a, b, c); - } -} diff --git a/src/tools/miri/tests/run-pass/rust-lang-org.rs b/src/tools/miri/tests/run-pass/rust-lang-org.rs deleted file mode 100644 index 7ba68e6b23..0000000000 --- a/src/tools/miri/tests/run-pass/rust-lang-org.rs +++ /dev/null @@ -1,21 +0,0 @@ -// This code is editable and runnable! -fn main() { - // A simple integer calculator: - // `+` or `-` means add or subtract by 1 - // `*` or `/` means multiply or divide by 2 - - let program = "+ + * - /"; - let mut accumulator = 0; - - for token in program.chars() { - match token { - '+' => accumulator += 1, - '-' => accumulator -= 1, - '*' => accumulator *= 2, - '/' => accumulator /= 2, - _ => { /* ignore everything else */ } - } - } - - assert_eq!(accumulator, 1); -} diff --git a/src/tools/miri/tests/run-pass/send-is-not-static-par-for.rs b/src/tools/miri/tests/run-pass/send-is-not-static-par-for.rs deleted file mode 100644 index 4ac1b5436f..0000000000 --- a/src/tools/miri/tests/run-pass/send-is-not-static-par-for.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//ignore-windows - -use std::sync::Mutex; - -fn par_for<I, F>(iter: I, f: F) - where I: Iterator, - I::Item: Send, - F: Fn(I::Item) + Sync -{ - for item in iter { - f(item) - } -} - -fn sum(x: &[i32]) { - let sum_lengths = Mutex::new(0); - par_for(x.windows(4), |x| { - *sum_lengths.lock().unwrap() += x.len() - }); - - assert_eq!(*sum_lengths.lock().unwrap(), (x.len() - 3) * 4); -} - -fn main() { - let mut elements = [0; 20]; - - // iterators over references into this stack frame - par_for(elements.iter_mut().enumerate(), |(i, x)| { - *x = i as i32 - }); - - sum(&elements) -} diff --git a/src/tools/miri/tests/run-pass/simd-intrinsic-generic-elements.rs b/src/tools/miri/tests/run-pass/simd-intrinsic-generic-elements.rs deleted file mode 100644 index 36567f4c03..0000000000 --- a/src/tools/miri/tests/run-pass/simd-intrinsic-generic-elements.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd, platform_intrinsics)] - -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x2(i32, i32); -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x3(i32, i32, i32); -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x8(i32, i32, i32, i32, - i32, i32, i32, i32); - -fn main() { - let _x2 = i32x2(20, 21); - let _x3 = i32x3(30, 31, 32); - let _x4 = i32x4(40, 41, 42, 43); - let _x8 = i32x8(80, 81, 82, 83, 84, 85, 86, 87); - - let _y2 = i32x2(120, 121); - let _y3 = i32x3(130, 131, 132); - let _y4 = i32x4(140, 141, 142, 143); - let _y8 = i32x8(180, 181, 182, 183, 184, 185, 186, 187); - -} diff --git a/src/tools/miri/tests/run-pass/slice-of-zero-size-elements.rs b/src/tools/miri/tests/run-pass/slice-of-zero-size-elements.rs deleted file mode 100644 index dbe8ec9add..0000000000 --- a/src/tools/miri/tests/run-pass/slice-of-zero-size-elements.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -C debug-assertions - -use std::slice; - -fn foo<T>(v: &[T]) -> Option<&[T]> { - let mut it = v.iter(); - for _ in 0..5 { - let _ = it.next(); - } - Some(it.as_slice()) -} - -fn foo_mut<T>(v: &mut [T]) -> Option<&mut [T]> { - let mut it = v.iter_mut(); - for _ in 0..5 { - let _ = it.next(); - } - Some(it.into_slice()) -} - -pub fn main() { - // In a slice of zero-size elements the pointer is meaningless. - // Ensure iteration still works even if the pointer is at the end of the address space. - let slice: &[()] = unsafe { slice::from_raw_parts(-5isize as *const (), 10) }; - assert_eq!(slice.len(), 10); - assert_eq!(slice.iter().count(), 10); - - // .nth() on the iterator should also behave correctly - let mut it = slice.iter(); - assert!(it.nth(5).is_some()); - assert_eq!(it.count(), 4); - - // Converting Iter to a slice should never have a null pointer - assert!(foo(slice).is_some()); - - // Test mutable iterators as well - let slice: &mut [()] = unsafe { slice::from_raw_parts_mut(-5isize as *mut (), 10) }; - assert_eq!(slice.len(), 10); - assert_eq!(slice.iter_mut().count(), 10); - - { - let mut it = slice.iter_mut(); - assert!(it.nth(5).is_some()); - assert_eq!(it.count(), 4); - } - - assert!(foo_mut(slice).is_some()) -} diff --git a/src/tools/miri/tests/run-pass/small_enum_size_bug.rs b/src/tools/miri/tests/run-pass/small_enum_size_bug.rs deleted file mode 100644 index 7576a97e36..0000000000 --- a/src/tools/miri/tests/run-pass/small_enum_size_bug.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(dead_code)] - -enum E { - A = 1, - B = 2, - C = 3, -} - -fn main() { - let enone = None::<E>; - if let Some(..) = enone { - panic!(); - } -} diff --git a/src/tools/miri/tests/run-pass/specialization.rs b/src/tools/miri/tests/run-pass/specialization.rs deleted file mode 100644 index 13894926d3..0000000000 --- a/src/tools/miri/tests/run-pass/specialization.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(specialization)] - -trait IsUnit { - fn is_unit() -> bool; -} - -impl<T> IsUnit for T { - default fn is_unit() -> bool { false } -} - -impl IsUnit for () { - fn is_unit() -> bool { true } -} - -fn specialization() -> (bool, bool) { - (i32::is_unit(), <()>::is_unit()) -} - -fn main() { - assert_eq!(specialization(), (false, true)); -} diff --git a/src/tools/miri/tests/run-pass/static_memory_modification.rs b/src/tools/miri/tests/run-pass/static_memory_modification.rs deleted file mode 100644 index a68f727322..0000000000 --- a/src/tools/miri/tests/run-pass/static_memory_modification.rs +++ /dev/null @@ -1,8 +0,0 @@ -static mut X: usize = 5; - -fn main() { - unsafe { - X = 6; - assert_eq!(X, 6); - } -} diff --git a/src/tools/miri/tests/run-pass/static_mut.rs b/src/tools/miri/tests/run-pass/static_mut.rs deleted file mode 100644 index be5830698b..0000000000 --- a/src/tools/miri/tests/run-pass/static_mut.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![allow(dead_code)] - -static mut FOO: i32 = 42; -static BAR: Foo = Foo(unsafe { &FOO as *const _} ); - -struct Foo(*const i32); - -unsafe impl Sync for Foo {} - -fn main() { - unsafe { - assert_eq!(*BAR.0, 42); - FOO = 5; - assert_eq!(FOO, 5); - assert_eq!(*BAR.0, 5); - } -} diff --git a/src/tools/miri/tests/run-pass/std.rs b/src/tools/miri/tests/run-pass/std.rs deleted file mode 100644 index e0e23812d2..0000000000 --- a/src/tools/miri/tests/run-pass/std.rs +++ /dev/null @@ -1,33 +0,0 @@ -use std::cell::{Cell, RefCell}; -use std::rc::Rc; -use std::sync::Arc; - -fn rc_cell() -> Rc<Cell<i32>> { - let r = Rc::new(Cell::new(42)); - let x = r.get(); - r.set(x + x); - r -} - -fn rc_refcell() -> i32 { - let r = Rc::new(RefCell::new(42)); - *r.borrow_mut() += 10; - let x = *r.borrow(); - x -} - -fn arc() -> Arc<i32> { - let a = Arc::new(42); - a -} - -fn true_assert() { - assert_eq!(1, 1); -} - -fn main() { - assert_eq!(*arc(), 42); - assert_eq!(rc_cell().get(), 84); - assert_eq!(rc_refcell(), 52); - true_assert(); -} diff --git a/src/tools/miri/tests/run-pass/strings.rs b/src/tools/miri/tests/run-pass/strings.rs deleted file mode 100644 index d5fc80b41f..0000000000 --- a/src/tools/miri/tests/run-pass/strings.rs +++ /dev/null @@ -1,27 +0,0 @@ -fn empty() -> &'static str { - "" -} - -fn hello() -> &'static str { - "Hello, world!" -} - -fn hello_bytes() -> &'static [u8; 13] { - b"Hello, world!" -} - -fn hello_bytes_fat() -> &'static [u8] { - b"Hello, world!" -} - -fn fat_pointer_on_32_bit() { - Some(5).expect("foo"); -} - -fn main() { - assert_eq!(empty(), ""); - assert_eq!(hello(), "Hello, world!"); - assert_eq!(hello_bytes(), b"Hello, world!"); - assert_eq!(hello_bytes_fat(), b"Hello, world!"); - fat_pointer_on_32_bit(); // Should run without crashing. -} diff --git a/src/tools/miri/tests/run-pass/subslice_array.rs b/src/tools/miri/tests/run-pass/subslice_array.rs deleted file mode 100644 index 468cc9f094..0000000000 --- a/src/tools/miri/tests/run-pass/subslice_array.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(advanced_slice_patterns)] -#![feature(slice_patterns)] - -fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { - [a, b, b, a] -} - -fn main() { - let out = bar("baz", "foo"); - let [a, xs.., d] = out; - assert_eq!(a, "baz"); - assert_eq!(xs, ["foo", "foo"]); - assert_eq!(d, "baz"); -} diff --git a/src/tools/miri/tests/run-pass/sums.rs b/src/tools/miri/tests/run-pass/sums.rs deleted file mode 100644 index a8dfd5ed66..0000000000 --- a/src/tools/miri/tests/run-pass/sums.rs +++ /dev/null @@ -1,59 +0,0 @@ -// FIXME(solson): 32-bit mode doesn't test anything currently. -#![cfg_attr(target_pointer_width = "32", allow(dead_code))] - -#[derive(Debug, PartialEq)] -enum Unit { Unit(()) } // Force non-C-enum representation. - -fn return_unit() -> Unit { - Unit::Unit(()) -} - -#[derive(Debug, PartialEq)] -enum MyBool { False(()), True(()) } // Force non-C-enum representation. - -fn return_true() -> MyBool { - MyBool::True(()) -} - -fn return_false() -> MyBool { - MyBool::False(()) -} - -fn return_none() -> Option<i64> { - None -} - -fn return_some() -> Option<i64> { - Some(42) -} - -fn match_opt_none() -> i8 { - let x = None; - match x { - Some(data) => data, - None => 42, - } -} - -fn match_opt_some() -> i8 { - let x = Some(13); - match x { - Some(data) => data, - None => 20, - } -} - -fn two_nones() -> (Option<i16>, Option<i16>) { - (None, None) -} - -fn main() { - assert_eq!(two_nones(), (None, None)); - assert_eq!(match_opt_some(), 13); - assert_eq!(match_opt_none(), 42); - assert_eq!(return_some(), Some(42)); - assert_eq!(return_none(), None); - assert_eq!(return_false(), MyBool::False(())); - assert_eq!(return_true(), MyBool::True(())); - assert_eq!(return_unit(), Unit::Unit(())); -} diff --git a/src/tools/miri/tests/run-pass/tag-align-dyn-u64.rs b/src/tools/miri/tests/run-pass/tag-align-dyn-u64.rs deleted file mode 100644 index 81c19022ab..0000000000 --- a/src/tools/miri/tests/run-pass/tag-align-dyn-u64.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] - -use std::mem; - -enum Tag<A> { - Tag2(A) -} - -struct Rec { - c8: u8, - t: Tag<u64> -} - -fn mk_rec() -> Rec { - return Rec { c8:0, t:Tag::Tag2(0) }; -} - -fn is_u64_aligned(u: &Tag<u64>) -> bool { - let p: usize = unsafe { mem::transmute(u) }; - let u64_align = std::mem::align_of::<u64>(); - return (p & (u64_align - 1)) == 0; -} - -pub fn main() { - let x = mk_rec(); - assert!(is_u64_aligned(&x.t)); -} diff --git a/src/tools/miri/tests/run-pass/thread-local.rs b/src/tools/miri/tests/run-pass/thread-local.rs deleted file mode 100644 index db00e42d99..0000000000 --- a/src/tools/miri/tests/run-pass/thread-local.rs +++ /dev/null @@ -1,67 +0,0 @@ -//ignore-windows - -#![feature(libc)] -extern crate libc; - -use std::mem; - -pub type Key = libc::pthread_key_t; - -static mut RECORD : usize = 0; -static mut KEYS : [Key; 2] = [0; 2]; -static mut GLOBALS : [u64; 2] = [1, 0]; - -static mut CANNARY : *mut u64 = 0 as *mut _; // this serves as a cannary: if TLS dtors are not run properly, this will not get deallocated, making the test fail. - -pub unsafe fn create(dtor: Option<unsafe extern fn(*mut u8)>) -> Key { - let mut key = 0; - assert_eq!(libc::pthread_key_create(&mut key, mem::transmute(dtor)), 0); - key -} - -pub unsafe fn set(key: Key, value: *mut u8) { - let r = libc::pthread_setspecific(key, value as *mut _); - assert_eq!(r, 0); -} - -pub fn record(r: usize) { - assert!(r < 10); - unsafe { RECORD = RECORD*10 + r }; -} - -unsafe extern fn dtor(ptr: *mut u64) { - assert!(CANNARY != 0 as *mut _); // make sure we do not get run too often - let val = *ptr; - - let which_key = GLOBALS.iter().position(|global| global as *const _ == ptr).expect("Should find my global"); - record(which_key); - - if val > 0 { - *ptr = val-1; - set(KEYS[which_key], ptr as *mut _); - } - - // Check if the records matches what we expect. If yes, clear the cannary. - // If the record is wrong, the cannary will never get cleared, leading to a leak -> test fails. - // If the record is incomplete (i.e., more dtor calls happen), the check at the beginning of this function will fail -> test fails. - // The correct sequence is: First key 0, then key 1, then key 0. - if RECORD == 0_1_0 { - drop(Box::from_raw(CANNARY)); - CANNARY = 0 as *mut _; - } -} - -fn main() { - unsafe { - create(None); // check that the no-dtor case works - - // Initialize the keys we use to check destructor ordering - for (key, global) in KEYS.iter_mut().zip(GLOBALS.iter()) { - *key = create(Some(mem::transmute(dtor as unsafe extern fn(*mut u64)))); - set(*key, global as *const _ as *mut _); - } - - // Initialize cannary - CANNARY = Box::into_raw(Box::new(0u64)); - } -} diff --git a/src/tools/miri/tests/run-pass/too-large-primval-write-problem.rs b/src/tools/miri/tests/run-pass/too-large-primval-write-problem.rs deleted file mode 100644 index 1bbe45277c..0000000000 --- a/src/tools/miri/tests/run-pass/too-large-primval-write-problem.rs +++ /dev/null @@ -1,23 +0,0 @@ -// PrimVals in Miri are represented with 8 bytes (u64) and at the time of writing, the `-x` -// will sign extend into the entire 8 bytes. Then, if you tried to write the `-x` into -// something smaller than 8 bytes, like a 4 byte pointer, it would crash in byteorder crate -// code that assumed only the low 4 bytes would be set. Actually, we were masking properly for -// everything except pointers before I fixed it, so this was probably impossible to reproduce on -// 64-bit. -// -// This is just intended as a regression test to make sure we don't reintroduce this problem. - -#[cfg(target_pointer_width = "32")] -fn main() { - use std::mem::transmute; - - // Make the weird PrimVal. - let x = 1i32; - let bad = unsafe { transmute::<i32, *const u8>(-x) }; - - // Force it through the Memory::write_primval code. - Box::new(bad); -} - -#[cfg(not(target_pointer_width = "32"))] -fn main() {} diff --git a/src/tools/miri/tests/run-pass/traits.rs b/src/tools/miri/tests/run-pass/traits.rs deleted file mode 100644 index b2eae5d04f..0000000000 --- a/src/tools/miri/tests/run-pass/traits.rs +++ /dev/null @@ -1,30 +0,0 @@ -struct Struct(i32); - -trait Trait { - fn method(&self); -} - -impl Trait for Struct { - fn method(&self) { - assert_eq!(self.0, 42); - } -} - -struct Foo<T: ?Sized>(T); - -fn main() { - let y: &Trait = &Struct(42); - y.method(); - let x: Foo<Struct> = Foo(Struct(42)); - let y: &Foo<Trait> = &x; - y.0.method(); - - let x: Box<Fn(i32) -> i32> = Box::new(|x| x * 2); - assert_eq!(x(21), 42); - let mut i = 5; - { - let mut x: Box<FnMut()> = Box::new(|| i *= 2); - x(); x(); - } - assert_eq!(i, 20); -} diff --git a/src/tools/miri/tests/run-pass/trivial.rs b/src/tools/miri/tests/run-pass/trivial.rs deleted file mode 100644 index 891d115206..0000000000 --- a/src/tools/miri/tests/run-pass/trivial.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn empty() {} - -fn unit_var() { - let x = (); - x -} - -fn main() { - empty(); - unit_var(); -} diff --git a/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor.rs b/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor.rs deleted file mode 100644 index 5cf91b3f4d..0000000000 --- a/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - assert_eq!(Some(42).map(Some), Some(Some(42))); -} diff --git a/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_pointer_opt.rs b/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_pointer_opt.rs deleted file mode 100644 index fb57d4f4c1..0000000000 --- a/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_pointer_opt.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let x = 5; - assert_eq!(Some(&x).map(Some), Some(Some(&x))); -} diff --git a/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs b/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs deleted file mode 100644 index 44441ed1d3..0000000000 --- a/src/tools/miri/tests/run-pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs +++ /dev/null @@ -1,33 +0,0 @@ -#[derive(Copy, Clone, PartialEq, Debug)] -struct A<'a> { - x: i32, - y: &'a i32, -} - -#[derive(Copy, Clone, PartialEq, Debug)] -struct B<'a>(i32, &'a i32); - -#[derive(Copy, Clone, PartialEq, Debug)] -enum C<'a> { - Value(i32, &'a i32), - #[allow(dead_code)] - NoValue, -} - -fn main() { - let x = 5; - let a = A { x: 99, y: &x }; - assert_eq!(Some(a).map(Some), Some(Some(a))); - let f = B; - assert_eq!(Some(B(42, &x)), Some(f(42, &x))); - // the following doesn't compile :( - //let f: for<'a> fn(i32, &'a i32) -> B<'a> = B; - //assert_eq!(Some(B(42, &x)), Some(f(42, &x))); - assert_eq!(B(42, &x), foo(&x, B)); - let f = C::Value; - assert_eq!(C::Value(42, &x), f(42, &x)); -} - -fn foo<'a, F: Fn(i32, &'a i32) -> B<'a>>(i: &'a i32, f: F) -> B<'a> { - f(42, i) -} diff --git a/src/tools/miri/tests/run-pass/tuple_like_struct_constructor.rs b/src/tools/miri/tests/run-pass/tuple_like_struct_constructor.rs deleted file mode 100644 index 05e8893de1..0000000000 --- a/src/tools/miri/tests/run-pass/tuple_like_struct_constructor.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - #[derive(PartialEq, Eq, Debug)] - struct A(i32); - assert_eq!(Some(42).map(A), Some(A(42))); -} diff --git a/src/tools/miri/tests/run-pass/union-overwrite.rs b/src/tools/miri/tests/run-pass/union-overwrite.rs deleted file mode 100644 index df2ff6e51a..0000000000 --- a/src/tools/miri/tests/run-pass/union-overwrite.rs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(untagged_unions)] -#![allow(unions_with_drop_fields)] - -#[repr(C)] -struct Pair<T, U>(T, U); -#[repr(C)] -struct Triple<T>(T, T, T); - -#[repr(C)] -union U<A, B> { - a: Pair<A, A>, - b: B, -} - -#[repr(C)] -union W<A, B> { - a: A, - b: B, -} - -#[cfg(target_endian = "little")] -unsafe fn check() { - let mut u = U::<u8, u16> { b: 0xDE_DE }; - u.a.0 = 0xBE; - assert_eq!(u.b, 0xDE_BE); - - let mut u = U::<u16, u32> { b: 0xDEAD_DEAD }; - u.a.0 = 0xBEEF; - assert_eq!(u.b, 0xDEAD_BEEF); - - let mut u = U::<u32, u64> { b: 0xDEADBEEF_DEADBEEF }; - u.a.0 = 0xBAADF00D; - assert_eq!(u.b, 0xDEADBEEF_BAADF00D); - - let mut w = W::<Pair<Triple<u8>, u8>, u32> { b: 0xDEAD_DEAD }; - w.a.0 = Triple(0, 0, 0); - assert_eq!(w.b, 0xDE00_0000); - - let mut w = W::<Pair<u8, Triple<u8>>, u32> { b: 0xDEAD_DEAD }; - w.a.1 = Triple(0, 0, 0); - assert_eq!(w.b, 0x0000_00AD); -} - -#[cfg(target_endian = "big")] -unsafe fn check() { - let mut u = U::<u8, u16> { b: 0xDE_DE }; - u.a.0 = 0xBE; - assert_eq!(u.b, 0xBE_DE); - - let mut u = U::<u16, u32> { b: 0xDEAD_DEAD }; - u.a.0 = 0xBEEF; - assert_eq!(u.b, 0xBEEF_DEAD); - - let mut u = U::<u32, u64> { b: 0xDEADBEEF_DEADBEEF }; - u.a.0 = 0xBAADF00D; - assert_eq!(u.b, 0xBAADF00D_DEADBEEF); - - let mut w = W::<Pair<Triple<u8>, u8>, u32> { b: 0xDEAD_DEAD }; - w.a.0 = Triple(0, 0, 0); - assert_eq!(w.b, 0x0000_00AD); - - let mut w = W::<Pair<u8, Triple<u8>>, u32> { b: 0xDEAD_DEAD }; - w.a.1 = Triple(0, 0, 0); - assert_eq!(w.b, 0xDE00_0000); -} - -fn main() { - unsafe { - check(); - } -} diff --git a/src/tools/miri/tests/run-pass/union.rs b/src/tools/miri/tests/run-pass/union.rs deleted file mode 100644 index 342c94f3d4..0000000000 --- a/src/tools/miri/tests/run-pass/union.rs +++ /dev/null @@ -1,88 +0,0 @@ -#![feature(untagged_unions)] -#![allow(dead_code, unused_variables)] - -fn main() { - a(); - b(); - c(); - d(); -} - -fn a() { - union U { - f1: u32, - f2: f32, - } - let mut u = U { f1: 1 }; - unsafe { - let b1 = &mut u.f1; - *b1 = 5; - } - assert_eq!(unsafe { u.f1 }, 5); -} - -fn b() { - struct S { - x: u32, - y: u32, - } - - union U { - s: S, - both: u64, - } - let mut u = U { s: S { x: 1, y: 2 } }; - unsafe { - let bx = &mut u.s.x; - let by = &mut u.s.y; - *bx = 5; - *by = 10; - } - assert_eq!(unsafe { u.s.x }, 5); - assert_eq!(unsafe { u.s.y }, 10); -} - -fn c() { - #[repr(u32)] - enum Tag { I, F } - - #[repr(C)] - union U { - i: i32, - f: f32, - } - - #[repr(C)] - struct Value { - tag: Tag, - u: U, - } - - fn is_zero(v: Value) -> bool { - unsafe { - match v { - Value { tag: Tag::I, u: U { i: 0 } } => true, - Value { tag: Tag::F, u: U { f } } => f == 0.0, - _ => false, - } - } - } - assert!(is_zero(Value { tag: Tag::I, u: U { i: 0 }})); - assert!(is_zero(Value { tag: Tag::F, u: U { f: 0.0 }})); - assert!(!is_zero(Value { tag: Tag::I, u: U { i: 1 }})); - assert!(!is_zero(Value { tag: Tag::F, u: U { f: 42.0 }})); -} - -fn d() { - union MyUnion { - f1: u32, - f2: f32, - } - let u = MyUnion { f1: 10 }; - unsafe { - match u { - MyUnion { f1: 10 } => { } - MyUnion { f2 } => { panic!("foo"); } - } - } -} diff --git a/src/tools/miri/tests/run-pass/validation_lifetime_resolution.rs b/src/tools/miri/tests/run-pass/validation_lifetime_resolution.rs deleted file mode 100644 index 4d919f7352..0000000000 --- a/src/tools/miri/tests/run-pass/validation_lifetime_resolution.rs +++ /dev/null @@ -1,30 +0,0 @@ -trait Id { - type Out; - - fn id(self) -> Self::Out; -} - -impl<'a> Id for &'a mut i32 { - type Out = &'a mut i32; - - fn id(self) -> Self { self } -} - -impl<'a> Id for &'a mut u32 { - type Out = &'a mut u32; - - fn id(self) -> Self { self } -} - -fn foo<T>(mut x: T) where for<'a> &'a mut T: Id -{ - let x = &mut x; - let _y = x.id(); - // Inspecting the trace should show that _y has a type involving a local lifetime, when it gets validated. - // Unfortunately, there doesn't seem to be a way to actually have a test fail if it does not have the right - // type. Currently, this is NOT working correctly; see <https://github.com/solson/miri/issues/298>. -} - -fn main() { - foo(3) -} diff --git a/src/tools/miri/tests/run-pass/vec-matching-fold.rs b/src/tools/miri/tests/run-pass/vec-matching-fold.rs deleted file mode 100644 index ac80a4211a..0000000000 --- a/src/tools/miri/tests/run-pass/vec-matching-fold.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -#![feature(advanced_slice_patterns)] -#![feature(slice_patterns)] - -use std::fmt::Debug; - -fn foldl<T, U, F>(values: &[T], - initial: U, - mut function: F) - -> U where - U: Clone+Debug, T:Debug, - F: FnMut(U, &T) -> U, -{ match values { - &[ref head, ref tail..] => - foldl(tail, function(initial, head), function), - &[] => { - // FIXME: call guards - let res = initial.clone(); res - } - } -} - -fn foldr<T, U, F>(values: &[T], - initial: U, - mut function: F) - -> U where - U: Clone, - F: FnMut(&T, U) -> U, -{ - match values { - &[ref head.., ref tail] => - foldr(head, function(tail, initial), function), - &[] => { - // FIXME: call guards - let res = initial.clone(); res - } - } -} - -pub fn main() { - let x = &[1, 2, 3, 4, 5]; - - let product = foldl(x, 1, |a, b| a * *b); - assert_eq!(product, 120); - - let sum = foldr(x, 0, |a, b| *a + b); - assert_eq!(sum, 15); -} diff --git a/src/tools/miri/tests/run-pass/write-bytes.rs b/src/tools/miri/tests/run-pass/write-bytes.rs deleted file mode 100644 index 7c9a38fca6..0000000000 --- a/src/tools/miri/tests/run-pass/write-bytes.rs +++ /dev/null @@ -1,45 +0,0 @@ -#[repr(C)] -#[derive(Copy, Clone)] -struct Foo { - a: u64, - b: u64, - c: u64, -} - -fn main() { - const LENGTH: usize = 10; - let mut v: [u64; LENGTH] = [0; LENGTH]; - - for idx in 0..LENGTH { - assert_eq!(v[idx], 0); - } - - unsafe { - let p = v.as_mut_ptr(); - ::std::ptr::write_bytes(p, 0xab, LENGTH); - } - - for idx in 0..LENGTH { - assert_eq!(v[idx], 0xabababababababab); - } - - // ----- - - let mut w: [Foo; LENGTH] = [Foo { a: 0, b: 0, c: 0 }; LENGTH]; - for idx in 0..LENGTH { - assert_eq!(w[idx].a, 0); - assert_eq!(w[idx].b, 0); - assert_eq!(w[idx].c, 0); - } - - unsafe { - let p = w.as_mut_ptr(); - ::std::ptr::write_bytes(p, 0xcd, LENGTH); - } - - for idx in 0..LENGTH { - assert_eq!(w[idx].a, 0xcdcdcdcdcdcdcdcd); - assert_eq!(w[idx].b, 0xcdcdcdcdcdcdcdcd); - assert_eq!(w[idx].c, 0xcdcdcdcdcdcdcdcd); - } -} diff --git a/src/tools/miri/tests/run-pass/zero-sized-binary-heap-push.rs b/src/tools/miri/tests/run-pass/zero-sized-binary-heap-push.rs deleted file mode 100644 index 63a0d65f01..0000000000 --- a/src/tools/miri/tests/run-pass/zero-sized-binary-heap-push.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::collections::BinaryHeap; -use std::iter::Iterator; - -fn main() { - const N: usize = 8; - - for len in 0..N { - let mut tester = BinaryHeap::with_capacity(len); - assert_eq!(tester.len(), 0); - assert!(tester.capacity() >= len); - for _ in 0..len { - tester.push(()); - } - assert_eq!(tester.len(), len); - assert_eq!(tester.iter().count(), len); - tester.clear(); - } -} diff --git a/src/tools/miri/tests/run-pass/zst.rs b/src/tools/miri/tests/run-pass/zst.rs deleted file mode 100644 index c1c88875c5..0000000000 --- a/src/tools/miri/tests/run-pass/zst.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[derive(PartialEq, Debug)] -struct A; - -fn zst_ret() -> A { - A -} - -fn use_zst() -> A { - let a = A; - a -} - -fn main() { - assert_eq!(zst_ret(), A); - assert_eq!(use_zst(), A); - let x = 42 as *mut (); - unsafe { *x = (); } -} diff --git a/src/tools/miri/tests/run-pass/zst2.rs b/src/tools/miri/tests/run-pass/zst2.rs deleted file mode 100644 index c2d7b88ea0..0000000000 --- a/src/tools/miri/tests/run-pass/zst2.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(dead_code)] - -#[derive(Debug)] -struct A; - -fn main() { - // can't use assert_eq, b/c that will try to print the pointer addresses with full MIR enabled - - // FIXME: Test disabled for now, see <https://github.com/solson/miri/issues/131>. - //assert!(&A as *const A as *const () == &() as *const _); - //assert!(&A as *const A == &A as *const A); -} diff --git a/src/tools/miri/tests/run-pass/zst_box.rs b/src/tools/miri/tests/run-pass/zst_box.rs deleted file mode 100644 index 12138be5af..0000000000 --- a/src/tools/miri/tests/run-pass/zst_box.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - let x = Box::new(()); - let y = Box::new(()); - drop(y); - let z = Box::new(()); - drop(x); - drop(z); -} diff --git a/src/tools/miri/tests/run-pass/zst_variant_drop.rs b/src/tools/miri/tests/run-pass/zst_variant_drop.rs deleted file mode 100644 index a76f64ce29..0000000000 --- a/src/tools/miri/tests/run-pass/zst_variant_drop.rs +++ /dev/null @@ -1,23 +0,0 @@ -struct Foo; -impl Drop for Foo { - fn drop(&mut self) { - unsafe { - FOO = true; - } - } -} - -static mut FOO: bool = false; - -enum Bar { - A(Box<i32>), - B(Foo), -} - -fn main() { - assert!(unsafe { !FOO }); - drop(Bar::A(Box::new(42))); - assert!(unsafe { !FOO }); - drop(Bar::B(Foo)); - assert!(unsafe { FOO }); -} diff --git a/src/tools/miri/tex/final-presentation/latexmkrc b/src/tools/miri/tex/final-presentation/latexmkrc deleted file mode 100644 index 23aa1a481b..0000000000 --- a/src/tools/miri/tex/final-presentation/latexmkrc +++ /dev/null @@ -1,12 +0,0 @@ -# vim: ft=perl - -$pdf_mode = 1; -$pdflatex = 'lualatex --shell-escape %O %S'; -$out_dir = 'out'; - -# This improves latexmk's detection of source files and generated files. -$recorder = 1; - -# Ignore always-regenerated *.pyg files from the minted package when considering -# whether to run pdflatex again. -$hash_calc_ignore_pattern{'pyg'} = '.*'; diff --git a/src/tools/miri/tex/final-presentation/rust-logo-512x512.png b/src/tools/miri/tex/final-presentation/rust-logo-512x512.png deleted file mode 100644 index 38484c670e01f3f355672d6c95f79f035a963a44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 96029 zcmZs?XIxX!(mkAn0HKGD)X+hYqBLm<9YFy_rFRq*6cD77gr)(MA}A<TQR&j8mxPXh z0wTSHru5!Pd%5>M|8MW7b3UBkIWu$C%&awg?>GxHBPM!YdH?{xbi-Kx4gdhUxCH?q zG#8h{;6LX8VBqo%eVx0(Q=2X0_w6QYsYA6R<<&ATM?>BqoV}wf9YjpP)ALz<-8Cgy zRM%-;Diocg{Yx*NHg6gvgS8_I2m_M40l6z%ZZEzxyn83|2KtA;?1%;e1brSQtcng$ z&V<+{Ze}RBw8zl>|K9M&oCXqtS)plCDk#?fJ+X*jN4c?7P%F^ZMnWvy$tM4MK_@VN z2P-)1D~yyh<_8Zr_5bgUYJk0!qYgg&Ij=Q62%y$_OB{4yb?txOJ61j$KZ5MTbC{7C z*sT8<umG_!P4ZkNAP=nl7PQPBAA3!h8J^;O_+3zrB@d+7SL<j``tfsza{o0tZsy_0 zIP(cww$9D_pmhm0)S>@r1JRbuY8<X5eAaOZ5rR&|wx49agG|UNC{lfbx2EQWvnmc+ z{MVHfhW#YtHy&oDBtltewtgMG4wx9SWQ-OZ4+;%`ird-cM&@F7GoGMfL)%u+&+*tj z!~Lq*$F52whX493;<fBF?Z!$xYP4n$u&K^5;EsX--uuwqfe-wclLn9*Z*!ZH*%Ap{ z+}dZEWa|I>CfmB#gzy`qY<$a$#AyK#`UYr@ofR$Hiq9DxZ*Zs7`0W+UUZ0rJ+ut!y zB{DRk+Ws5JP04-k8V`*HOT(>-@i--lm?VN~J3VN>(@pyPU_4(#(WYe^G+#Ld!2{2m zmx8usVz5mQk4jPumO%fDR2J(x3*T_QrM5}VOSh|D+)WXp*r#24LWex;Dd$1ygB!lm zew*Qg`I*A%glm1o=NXQG{~2t9UQT$fkyU!g)0AbnY5^L8bBlt`dG|#?tuv)8$d*xD z>l{Lo@|G9oym0U{l)<Tdtg1Yn>f345;M$3Jc-zj4!M}flPU8oJoa3N)>WbMhpPaV; z#m^ErRNgz2b0+yB0gyNCZ;~feE+l;(ytJx<({_aSY3l&OTdlkH)=aKE)e!OBf)E0V zK14Lm2X(zHc{xctv$FJ;H-xX1>{=5X)+RJigl-sxo=%O|A8?B0P<y}ksQ53WdZjFS z@U>MGjvu)*=wP=X{L|4DSs9YAG&BVDS0RiAwBjQ^*Dy~Cfku?4w~YJ!>X~z3tO!c? z%QaO#9y~f1Yra0sw7bw<iR*FN2-0rzgL*pW`p|{1X*?Ca#p?V^`G48-$b$k*m|%Z3 zF!^t#$bKj&OP=PF18^o$k|BFnX7kV~sd7*?@#q1evQ@+GQt-It4>iOeA9?TuU-D^Y zg0lB46ZdX|Kl1qN_#pn<68RUQS<6n^*YKn6ytjeaMiRxuVV+den0?|a2od@w@IdGr zLwK{_&3UURHrk^*{9>Fm8~@&W|2K<&a{~BoR7bRO&npmK>?6`vlcYa+<o<}q-tW0` zYF_aNzPLpj{z_J>L}dQwTKp}vbSae=>|}hUWJ@ibCN$i;rAd>fJdC7q8tzvsNI3uU z0hifdqX7tGI9b?wD>dg(R=t};ekumF=$>Dkr_qUvu5Wkl(M-MdADHPkf}AB^Y?hBz z>{vbU7f}A`LXT$G>Rn||X(_Elfo&oHk0SK9h)dVyX>GQJLS-7hnBCX7dRU4<*T|U* z;UMMD1JWz+VE}xgL~m+qt&IoeFt+<C!y^Ql{Xoh4DQDPi*{&0r2j#n3PC9_nc>=)Z zl8^m{oP216c0~;hZ4}k7jt|d-<yaqIH|F>CT%0dsqy3-|T+TrCj4?)PRdMj){~&z_ zy-DDhL|M6`8f*i8<QHuxJT6@dtbv7<{A2zk()>kT-Dcl|j`KDH>D9n*X+5}AO9}5$ ziSLc!lEgOxXup_z>#g02ztyc$W>!^i<)Fbv(so}4o1DK?GoBp869Run^iP;%YzuWg z3!?5ZDGadcY@Aw?jw+m3)CDI-x0m<>kJrOF%ITzRN*xL-!R;S7X!w1Z=B$6|WJ@q6 z8oT)Z*#!RwRB=(FQyVV{h+00}*G`u8W{OwR_$spLE@??d{V!G|TC$1~9yvc=6{^(P z_IvyXxvaDSs}pFhe548^s}}TMkBM-UfK@+lFS+(sqqq1P7f|No8z%G>(^BIhf~f<i z_u8xUC2>r6Lrdq2^hfRIQx?(`Wc?G5q871y3VW*&YfRVJ<v3R7OG$p05~*l|c#1y_ zbpp8|jcWC<&Ni<Ch55ubmu;TrNGTj4>^xjoUUx8k`t^maFOYc?_S6?`Wv`CjcGRTc z=OZtF0jB5AHSj0S1b%8v>uEJ_g2v9sW>`5aT<K>~Df#EwWwT?i!g3i5Z|GaY!!O>i zy#oYbT5l^w59WZ63a)@0Yu|#eU#~N${JaoiC2qHQ{H)pYWJ230I0Z1M_ka#wE}So+ zp}Af5;8uNe%t1v!ch9?DQ+scQ^me^KALI4ns7zr}F22H-8Drcm7+fr>B{hJET_CSf zfQlrtQq=Vu<f0&*HYLOH`|muzZx1>p74BW1YEK{EWYWhE(g_{6{A}OZ>l>Jpxf+%; zobF$R8a4I(GkF`1qOL-HnclR0*ZNxyc5Ood8f+`#Tv`3h4*Fa=Y}j@YCw$CbCm(RX zDpn2ynAy2L`!&ByAOUvlaoT7=(k|PJBv6lp%naI@s<_7J_jYjI4h{ZB^$o{>0r9zZ zM#3*M&%^-1ksLH3cskg%@OL6A18@J+4`|g_-LE@KHrnj?Uame=N)Q?tcLPuQU@dDx z9m~1hu`h0>^^%prfCopHGo8MKh9nK%_d$ic0BmHhuQ3xG1}C1_gn9iKOL+H3_Bk{l z#@N;c2*w&Om*t;9?Qqi`3-l`Z+duFH)2CZ>3PP7xPI7(ZO@pzqV|R{_earDZHI-8O z(Hu~5elZK<Lf-(R%0kf;HD6Ym;;g(FU~+mk0CphqXs=qyMTPr=g3BU;0nIe+7-9P{ z^HlS^Ip-FI<|tSsEM+$ARBA?MPI)IadoS2j;4suM>7j<fu_?H?g-TvMa@*vXKaVk} zXbWoWsN=o{3&*{S^a0Wt;KJ*xGT4=by?d@D?_W!<V!HB0RyWt@pc84<!M~mF)><a} zE5cOmpPd%}e(mSw*q%xqr#ggZWi&-D+YyLCd-%<BKp5`uK>X&T6)+-(Jcp;xTG{6< z@q6<t)2}rEmd1L3&E#MOtN(Nl{<}bEm|V+GYF~Jh<MdY}qfM@r^*!NgJZ5Y|t9HQg z!BPJof%54ScbEJ*Gv$*n$9MRKQ(IalZUbfJ`mdbvG|g(s;6aOQZ6&^I63>^gjG`MX zqIO0v%Gra!om%GL*#Kj}&cR^p?sZaNoH4sL-m&fBUPxjEy1tyjzLmBjda#RxonI+8 zn(7w-eM(DUWRpy(NH>6iL<Huf(qO(YL!N-9I8ZM2Eso^?Nn8_O&lsL!JE%S5?JVS@ ztbhT2WdKSpV$j<DZ!aoJr;ZrKxtX)!?m>FbiiyX3;qzXzfe6Liq`l@Wd#N+yY~Hwz z-mELtMiLY@uu#o5i;cT^O|Zy0w_MG0kuwjNYSkjU&HDWpS0K+BR)Hc1SH7?|llGd| zR(_8E?8+>+LoO}_%kbW}Lq3$xL@wezzSX>n#$;15<4O&7p$u09H~bH^XCJ0uLEAnN z5$h8<UedE!Pvr4gboah3h3WsZ)go1wJs{QY2-LdC(R~65SE?ER<B|;|Ote4p84CiH zI%xCbKDTkb7HaL9SZLZXy3`3^cg@olSIiT3{l;;T!fF^$p8V5?<>}P?9-|}DVXjH7 z)+K}^6Q+FDmO<_kWVrgy;D-nC-Obus)spQf;9~GM?{N1S&64pvcCGRb)u!>uqHn+A z7~M;Z9bL4kWmQN6j>?>-#7?8VcO8PjW^DX4$9=TN)#?>7dElMIPY#es8#FelhchLw z$K;4~eap)dh;by$RXUX;$Gq*XQzpUFZf|_q>Gr6j)AhJ%=>1}J?q4|KSh$9IUKzNe zY{()ERvUY?so<|z@#z1#0CO!NMNdfg2icNM0K3;V|BkiDhcD&K)EX81G3Ys{9WKg! z`%ljL46YxDGJZAOwvI|vCyTruVJ%E`9Nf%yH$U>$${aV=ZohGVV%NQ{r*c?lf<CHw ztu`Ho%ATj|U)IknpBJY?AOD^hq%s5LJSqXS{nkfZ-_Z(|?rMK_Fz8K(%@h!<Mdxan zc4mXG!N`w@jw7dYhseuL`GO+>^>>hEFceuOi}wwEbfUG3g8baJty1e|(PdrB1s3fm zh*TPGPh!Oj9mWc4MPD%i#fm5Y&o$=}<qp~gyZdl~PtgoZsv^j#)}R}*iyxP~Mr*Y` zbQO$jt`6}Hmkp+GZT6`fJaqCN-4d82fl9;Xo+Q=nsjoh-8m|s5&L0$BdR;kj17hKy z^L=6E!`7v1v*aiY_7eE@i#E<1WAu09E!;_WkVu<oz7X>|t19Var3Yv7I_K-HVqi~m z90RX(Our6Og8ZI8UDkZ+r?gu?cD9bs>f3=>)rg+~nlWyQ?A&{?ZL)px{``)y4$r6a z(_!@iW7ujjBdF6pUG(GH0V9?R3|{7@QnqJoHoHty=rLa}PBZZKKNO7iHo!Y!k}@$2 zw{0RYT_SUbV3-B+4s4t{qfhV-_ot6NM{=wis}mE$r@r-^%m=-D+PeM<k9oKIY3^Ae z+%eER`{<yGi&T2cy*o~p2pOGM{+;U=I}RGmO39wyd^RtRJT|qRr*d^1gJjOFxL?r$ zAtX_kxd#vyH|yRpuyqqGPsyn;lXeaS2+_j;iC+=;%m3X9F{>?4r_B}kCbxS>^9I(m zT9UfWnVTujnVb5pp9{%h2@+!y%bfTs2$YxZoUO`jn@WSc$$NS!E>hf-@ve=lbC)!Y z-1RO%4DQGcN_DiU6@%uW(($kPZ(U&r+~fwJ9N%(bXR0Z&X8lcaK^r5DvvVeu5iFBr zzVK3GrzcbSe>KXf_l)Y+V@(1rI?S7f8T7FNK8B93hou?tkMMT2T2Bl9U03~-YX-aq zGk@zhxInPE)Bws=$h#6Dc+4-v&ZV)u<-TMJU0}at{vyJ!5}cBcV)AkA)CVq5Q?dZ0 zZzHe`_l&5CjJ%!M`|pXZr&^NJd#AdsV!O5(CcqhSh`2wKYyqsS>h|Y;K3wqPSa@BA z`aHsIHA;e}9;U{}36^4q==dhiL<YO&{W4&5r__7?hcQl=?$=2GT0fF+aKYi$MoI^J zHBCahWP(il913qK%rYdsl6f+w^xNs}!D)%ZgX68xsZZHoDm<v%LW-`8KDxrRdv?Y} zXY_FA;X-~>c53U}n&<!zcL7bB-hk`NJ>QlM+I6Z2evk`pW~D~ZvPLv8T$c4^z}`Zq zN=k;J>>;1hH6WgDu-BJOG->x_2Hu1XflFGy*f&#uU2-n2iDGYh&es4vJR*icZoaX= zEs0hpa|mlJ#zhCjv<KXk`rOP85RYzcFxz3?5nW}=*x9cPxyh+%skT+!3E&2M&_Ss_ zT$`7pc|0j|PXZ0K#`bj~I_(uN=$oJOqMef--s;aWb|_@4;;ihUHWY3{+}V34ROp|$ ze*Sl}tmd)R1fl#-O3gEgT(hzfjpNzweJ*vGy4y|WAJ&AM@D&eE)z9ie7bi}ydeK&< zMhGRHO7qn{p3{%X!i4j;e@dzu{}F55ZY?zU+m3l}wDs{ovfjgW&~4T{NH_>=J|Bb0 z{itvQ{F81-vYYL%=cgm&%ZbaU{OxE3ylnMzku7E{fR3SR+ph0)C2Ky{zaiU%YMHsP z=N-=)Lkwe#&hKmhl-|IX3E5i}Nj+zj_m!!!b5VpklgDBk5Q7${38nkMqvpd+Rpo)Z z`5&FUI1e_4@6#zGAM9bV@ej4#2|mK0xxz;6%?Q6|Ik1SD<d>VIdr)nsPO9l6@y3HE zpUahZ4ERp^uH4CFx!37_7j`a^$8rkXoVXgU{q=qye(Hyyje1Hg!$J>~5#w81l%^+n zBK_#+!Het9n3M`%y;u1w%`gW#5+4!-+7dR<uW`VfztNksm<(Lq$#YD1cL-fX*{*BY zrA!~`8px~&N^&(w*iX0%CpO2X*hEi7{Mo&ytOzku{Ma)4R?XOf!y8CK;9`l<xWMK+ zQFE3ESLa`A%mD_ozyh9NmpGs>*fD3M6A%OFM8E%!#OQ2`Gq-xI0&iQVAdbngm)!}# zjS2gbZ{=GP<B!i5gY8~5wE)gW>{~zdtZW2iznruX$gQ$!;8p!J<k(7ghe4!dCrK&& zsX_WI=3L7uP0#Jw7UwtRFm3Gi?>52MK^mE+pyXyK0O?}n^;szP<p~H9rX9Z`MvwR< z<Ebv%4D@TJ@@wwEZ!WFTA4~R$<HIgb20gP#zJYx4lX$Bmh!{cXBw-h}DA^}f6vxAA z%1ogfA5RA{fTTtUZ4nfGpV5h6IzKp~L1wlag*OMD6*9?iCsus%e|cpfo6Z{MD%n0x zjg~npi1L-4iD^^AI2kQIiz<Ol(2VV&)_@|GRW{Gmf!<Mw>)>oN9heFA!S72$rquTb z0rKopiU{4jssBSo=gYaiC&)%YOuXUATvl0Hr%>4jcFgQoLeZLKx_b6wBUq-bQ^|(s zoaM%Y6(u`-@oZhX-8*d|tiPS7UguWte)hrEwa2B*6<2SS{YY$Fbn6wkRCVuVy1)Vb zwbL1pez*Ut)iSiEcKhE`c9dj0<)gmt>EKaE)^|Eei!5e_iPE;LpGGX1#P02(;tmB) zRa;qfph!*rL7p8sp=b-84nA;ug8%c)5c!z)HC~n3drZ&DP1xfM+JgD(oHe`1AU10D zy{sr-4!SPHOLUq2Jd}#HB?#RK*txXZbp4`=kNyV?k&u#)=C;I*iqo}K`{y`j8{++1 z^UwHi*=dqV^$uy->wU+Lo-zsVyH>(>1U|zzRHA4X0~2Sv27X#{m3-*&?9bNj{`Y<R z2diiKcSuh6_F*Zq*x}DV(E=*($^tHd#hO(=oafRb_rEPb;1xGXw(%PzY<jWmzNB>> zl@p9jJ22hOdSe$uqpJjN{hXpr`!E__9XBtm@}lP^&r>-!D$l8<FDwm)8Rpl}-UUs? zva-45)eE!tUX}X2gmEf$&u`s(#<jix<BwD;j1IHtkkGisO3T}>PNYko5XQ(r+5>eI z-WKy%{6b5B+2SH&uaUL?=XYz;kw1C<{JlwpV{VHsEp}_deyV9l_gvoo;lcIE=$Su{ zXG5mK%spkQA>L+XU!E&%Ne}dG!nfb>YEL^peQ;t~_0dQDlKVS&v}_R2-CUn?F4Eof zZLEJl?Sn%J<1DAIv3BGD{`L+PYmmmz{dAkpq<S)Ha>;FNA>~C_59;9wFSX#}5<HO< zP1=5O?s`1ft@rKpRtL#RbMuiYb&nc1^XTT}B=0esuFKKl@b{Q@f>%$2LU0HfVz+vI z;9(<G)=bYEScBAV0l>zv7bkGx>m4Xn=zC`!OeCh^*+pG*#nZ}?1^bSzZkIb!7nKDh z=mox8y%}UPUf@9BT03xiwp2PjTD$%8$5G>bEo{Rdl@F@ZcewP<tDi}>@GTfshmBS` zJ>o0K{KQ(vm2{<Aa%fO^1IfvKbW%XtJUIIReizEIp(Pawr9)4w5twt-I|T(OajAP9 zYGUNwV8t-sMag3xAHoKu?VOL?MuTo!qB!f-KdHa%95Y9LhItKglSH{LNuvH`sEI4Q zm^RwIMz?et49?|K3&AjDsdb)<=j5Ee*NQ|0hgYR(F}|y$g@uTmhZSgUZWrANT=|UK zku*^wPg;W%=k@Q35hDq25Imn9fcCII&mxnH)vWby2w$duEE^?c%IP9W<S(L++OudL z?))<wxyJkwmaL0oqq+kb$UP=0STSGp`%MD6OK4$IJG);l4n?Q@bV?N)v-vJ@AcENo zU%avL8E^YoG-4yzuBxbp5%ukQZ4TTNT=w|%%7YtpPJ_E=6IuR9K{4Hop4jk9;+W_5 z74U3v2COZje;)3n^^ldckzh2DFlVbWvgSeh`8Uh>9@i~*6iYB-*$hwwFXaBL4Zb6J zRfxJ<XE7DW!K$`XY?LbOO`Mz;ZdH<sUj-treWZ^JR2)Sl#0LyvM6Yx$XfW;WiG>PD zSkS{>`KMLwIZN}uq*s~Rb`xdmfa-QU0qK=Fs!Z7aps~Gd1HTUV$+>yM@_HD@XMFWd z3^kM@Bnji-HI4E2)#N%1Iky#=wRvU+W7I|;vM<ak6Q9TnERm@H*g1=yBr08Wo(Z{5 zv?cWOI-^<_I)J)%;BChR<0WXn)96RZW`9eYM1GlF9Iqyg{m!@v|72F|#jZjr9qTL* ztxXx6D>C0{8r{w2(tbYgzk$_bZO#4J79|0a6ruQ*<wVfTc!#ZjM;WaQE-9MLhcVWs zRl_mMDF*o1w`T5x!@KNF(XY<PMQmf{HtLv&s8oWv_j!8mgEL@~UZUuJbfhOCPalku zM4mDs6C0nj8ibij?hUhIYhQdfA*+5K^iyKM<fCOe3Ey>~ojaXs#&DIeT908jVK`sc z^l&oH*qEL1iMGlgi5OjYOglTYg$)uU4DG#iDhbB<$T7ET&3FKuG^l%==_cVvOk!-* zCeVR5u+>77-FnMN_>DE#WttiN$Ps}d107vOfUp9Cu=6+m3-Z{jwtTFm9#xk+hcD@g zoFczlUqqSNZ5&Rub}WvY4==rMRVn6<yKXx+H{?-$l$qc3FQi9n7XIR}t5;xjt7st! zgQ7n^yy?Md7o*h@ssnA!jG!DXy4+OCD;<{pO4ptI9{#)Zoc1-`Pc!EA+~AWlR7E9w z??0ECr1tgP<y+BzU8!J@;KXxo%&Wf(%Ig2xbpgXf?Z|V%y8`b|5c6SLRN#iN)5B>0 zkk_Mc<#x((sD}mS@l-59x4sT>s7WgVf6ocT(Z708EbFK6E3T5Qy}jS?bAkdoSC1LD zBq7ac7FsW}Yv(526w%!I;w6-&1Io3`QJRN^eS{$<omod{N1%Qp)8&D%qdPi(gbPj9 znd=!q<y)FGRzZ0k5;UN&y-?EWbR1xaN*_JnGc6habM#M497*TgV1Hs(fP`_NYkWf0 zyTM@lfT+}NBtT3!L~8!7JKjiWIS=R#pE+1Llge5BBMB;y&F!`456@5fdv>;U?P`aW zg>rZmVMRyc&m{SHzp`GLpqhblLby%yAm^5xOd1@@$5(Ri+!8!G0~VJrdAzPmz9(<O z;;*x(VPg{>b_xFRm)Y_0E&siFlg($FDZQGk57oh^Y<z6y`)=#@N%KA&kB)tlp&6bD zdSn5=r>4S768l-*gO*URv3pS#6<qQ}xSl2&O53Lx4EQZsHy<QUKhNyTFTYT?Ca3f1 zP1}BK{;HPRfCPqE)^qQPkx2^}nMwHQW*?uW@9HdKhDUc?TKzHZbx0~(G7viFCBSF3 zE1B9oU`R=1vVww@HM<0TCb7;QgJ<G9^QCs)qdk40J^!8`Z+esX^3*ZndEu|pr8LdD zUnJ=b*T<3(0%@}w{wIIx>tY5zte@_EIObSLS_~^`BneEMok%y)4#O8;`@;_moBXN< zb&k_UOQtmH)*i9D@I6=+AG4uK>$2+^`Kq%&EVtjeoO4y(VXp4oG$bl#)mOOJ!TEy( z*j~XPdGe?bWFO6{s}TpnLaEDiIW(UZBlKLae}Jx0T!ZN9VK~ym&w9Ip%jNU3+!lHZ zcdc;3cQ=zl?xJq;F22+Ej>37gIWYFpMf;Y*&;ZQx`B6jQmhs+sO@4~1>Uz-Jthe(H zVaT@#jN4)#5T*&dm}-4dc5y|eV%5@&oDVk2&a)oyR-A>YEm%JJ@c1m?^HYD>H6!<f zsZ!-uZY={JxnCJMx=KqyDqD~8Mw?+I&SY}k$g_sTTD27?)kNRs28)gxwL&#MB4Nb~ z6uCX9!#?S96K$M%O-iiO)0BwAnGhpGbHefSee>AWYJ+{=wuI8@Tos9GG0@jL#E<}Z zNx(dqn;I!iA7hDdA9RRPi<;jqx+(_~k=kf(FwxCZr147UgVC%{h;<?u+k(WnsrF(c z@e5p?@sWPBoRI0{>Ko{{3Cdk1>5o+%9g5t_%LQG$#uKYl$CE1SRM+1_L9aKX&B%36 zARlDD(Xq#h14JIN!3ksIxYilAmj~g^NOwZVXk+VIMY&XF62p6>{sThu_16zi;vmYu ztuj*IHx%wzS!*2MqeaaaXxanxZ=g&BqVy8NcNIquiXwNWV*&X10{MxvAo<2K4bAZG zoU5UI+nlRzBE$uW?A@)&h_qey>67C7LYBFMY(I>i9MyL=QV{{?k$DUvxQCj$Im@53 zuAil1GVZ)b#zUVXp7TSh1ccwbeP1gF5maS(InM$Cc?h*FJ%rp;qHArn&$VU@7!x}^ zJMKw&!!wi}S>brqmzxSPCJA&ryic9}>z+@mX3`t(PPrIBG}PGyQkn{_2MX`X&_yoU zL+aIl|4Km@X>b#;`Pq!vb7irBDpcEEqkYb)Z0Y4ebHm;0YNR66M#CwaQy6`d@-k;D zAwQshv(sn6;#G~j#TqQad=p7ZT%`+k-y5+f+XXD6x(v4ak3x^Rk><8v2q<pS=Ahuf z=1b?v{EZy>-jBl?PdD7Q1(-sk+t^yYJ+3k@Oji*CWQh)J5ic$gRfcFkA5y@3TvV*i zl7iAb<$F!36n(Xb{alkpP3YNgw@Q9NoAZxlNVno#v^mWA9DNQMvJYl41Ki?EhODO6 zM^9r4)8z#dL}}I=czAXS&2$*WxM;rV!gO{3bdlZ;LOI!cCs(qLe6IZd5u=5?S#wtr z0(@r=QK|^4v$#4OgQJZU^dD7r`J~Vb&qzBIUp1Z^RHfcSeaBD~KHwius>^}AdfzzZ zmj5H1IR&LZX<nDTGWXL>uVeb%+bwpNl3}g&nVz1gLzadqLSv1*%HCQwai1819Ohnz zPdoe^`*pWczGZQUPo4M=ze3uCTX{{WV)&-i)n4roDn44v{<$vKc$nKKi~6K&+mW=@ zon(GGDMnZuh|{(;O%i#tMqzTY0~38Yfsf>7-VdOO`L23Ua=jRlt|39V(sy_ITt`Cf zW9X!HQ~C*1Gm;9ieL?Fqn^P3-DON;HuM8tHa-hE4G}|Q5w-%~Ps&f|$K}yqqH*z<Q zpBR~qJQIdTL-Uk7e7lNa;NqEB+~1Dd!oJxt2(7R%OZv#^*L~EO44HB|cIwLj*Ep=; zdtU*<GioLuv>7pg-{<gd>*eG1()5-^$^ExgobG-7TjFqqKJI~45wUAXlBYwc#uc5V z(Cz*Z*RqJ`80Mc=GQV@zOBb)5yN*7kA|xhE&=^y&73ZqXJ0p%nmw@>mTY`AuU(159 z_r3ca+n;m8s_>j`JyZ{NY}O{aPu8lB?)2uP9j@#oTB~7I1Pa|=N(LoV;GfZY-c1UH zyqGHbIMkEVE|5n@b(wR<un5MfxO+V1cf8-Os50tM?IjE~uvbhD{QCM|o2zD>$SPst z;~WbHpdwkvxPL3!1cGC--n@OGUWLJr^L6KW=_1|ULGuiC)Bu_P`n=lpBk9mQi$>X$ zjhc?l{=bip&s;eP0c}0ndBE-2*ma&oCj*sTdZuUk#1fYTVi}2;fye7xIyvz!<MZXW z-q*s)NXI4`Yb8tmnc#XVnEaxp{=52M_60-q1ACk{%<lHjFtGaMHvCizANX#M%IDAe z4B@dLUL?YrpxGbv2I<WNzqGJ&xg@ub-_BBcic~~HCIg)%ivYgK{MV`3uN$0;xaj6c z7`IR<xhM>Dp@rOH_PPMGhFVllnPUFPE1=$)fFot;fHl|JE^`tAcg|6t9#!y6R3vfq zt+-gx>*iU}0jD~xMPqPZ3Zd4Py66*HB_5!2yS@tq-JO?u8j>w^pEBMLJU(M%#pbe8 z!rZ%dLN8Bd3YLqJAJ@|FJAF(&`*qi3QQnUYj-TkMJF3}DBtHo_I01g+{@TE04z;03 z?5q|%)b6WTi%_BrPfORZz8*g|-5TOL++{++W<rv$y@vi4j8qLSML8r0CX^(8Ck05O z3HK^`BvFZiNU8)%QS_n5j4?bRCRc9K`~hpK%>XeQ*uFLLBfWRl>^zW-F9;g2o%}wS zXT*3yjwalmQ8UFAolf^XClZ+k<qF+cYy=f4Gfye9nKQ=7dMCveFVg!QGJtO{PJDmO zp&rE0yYk?bXkI#v1y@B3?mD+HplA1JR9*XmmsULe)+}+81A*R+{#8mjxTSQKGRv|^ zfoKr*%G22?)76}d#&g$t4@1UwJo>d<%_+}38lH2M^X+YTg`O?GxA@E4t8`T+7O+n2 z!adZVzP0mkXJokXJ293@4uJ2JjLYR3((E84C~4rOF}chP=fR3Nm2X0|DcW?A_mq^F zbky{(AeHuA?0vwm!}qpG-t0&+M*GH#%#m(c=yqdj_>twwpB}dbdk^vtfylcG|8zU~ z8+qp0so!o2hSC&9TF?PQbB(8-yqO>U5~>pP&(}~FMsKB9p;b%=RHKSmWu1sm<P3F4 zx>_59c*z0EeyWSx5djy+LJ>Ce;`+F&eIS|iQZgFTu>V2fHUfmkP#7?jRGtktp?hO2 zizuT`6ip|p@m1OLFz2J_O`V)Yv|xy_xzT$=qWHH?%FT^`xufQb3BqJO<_nb*p7i8t z?&GtxF9Z2NpURe3S7Q3E@0H^|5aa)8Wgp(Fg(nd7dybL+uANf__`ddDW}j>|Jddj) za?rs?H?@1jge*nV!5If5OS{+N(OUt=A)2PWZ#{WTjk|AqI7400Rg{;vI5$}iX)WUB z$NVCVppd8EaOx&BtZB5}7J@vL56;)<B2##T=kee(pB^W*<(fEPT}Rvue`G_(Z?qg3 z1O+KyRKc?fR=~wC*A3s&5G3l(l2$h<;SDb$n(zLc%Wv4xx{4AZ*LmoVVaFW09fLxG zqw!ZClj4bM$vG<lVm=<RGJDh9Czz*51G1}~)BD$_9*eA~)Cd;%1G46l(IaQzaZBIn zcxdcTiVy9cWv%&Ai2nJ>so}-!RFMny<=s|)^ga5F-4U@feH$M??Hn)Il6H1R4?Vbv zmEDc*gh{Ova86D0AZ{L+Y!6Hl2OIO;44_uq!$t!v^7e6y4WizlzZX76naeUR#sfFJ zV~aUdSVC=P_5lr`?9e2%6Fu-R<Sw1?5T7Xc6+pq|6BHDP+8t4L@Alju*&?g15ZkwD z_sabiPb%)MZyIIiUPT%Z6L6rdwH;jvs*Ty~Q}Hv^xcuP!rSMPP<sO9UZ_guMpFVh< z+YR8hGxh}t1ZS<d#^q{%oq{XxvaaD1Qn#j!;gMxnyLLR^Cv#h>!Hvm1*vwWXNQB~z zq5WWOY&dYf)d6#SEGT9*&)NWz?6(#QqBc>Z*=w+pVp-KiSHx&X>g&Q%q>N?3pNw0h zCjK&l>>i=@(Exd-tYQ9(CF+%xdZ+>j7Zaz8Ng7Y$ib$I!HO^wkHrQ?87^j_0C*3l< z8PPE(#Ikx;(`nSM{UbXThMF2-c~g+mI(D_B+vmz!r7^bCkXXIHYE!%=|K0O5UWA!0 z^rc`7%At-OZbMN@qCnist4KWsCKJg6#|7S8l&96iO*Z6X_gv;-$(pLLeObU5%NxK@ zTMxG-%)_A51R`aH4y8tV9ZvL74Gs#;zJ(ee9<b8^BRf4<cSRH4LRWoRL5M$0fM55E zexv`3IFn|pTgVTyl=#MTm!tCH5M;oKd~Cnkp5^@($aF;Itf)F+Ek<4a-Tm!#tIs~H zSgLB<T6hUNwzlx4$LY`8RdvGli9H)0lxOb5T!jzDofifZBtQQwS2<wa+le|nxOKV> z&e0xjvYE7{u}kv+4yAH^d<YDagcPUJN4ac6?p6yYD;&{l#>(u%tX*VSF6fQF2g}ZT zsBxfFitPun5B|!+L!8gShgBD=0sm+5y<5op+4zq8jRx722UgU)#N?x(dxlBNPh{S9 zqI&yI=~g$njm8?Gl+q_&xgy9Xek?oxxN9QR4`1@0XLXuu(d;z!O?Hp+zCKN=2wGJV z>>4+Sqd*N$P0pUAe$QsXCt;kj-{!Q|<O=*AWS;aeJoKx0yR*WJ`Rb{Zu$<$wIVFra zxqhRw!yaN0f_wS3&E#0)E$w&hNPC9J6b@4=w;QqOS*D5@bOz7rH7kb;`YSdja0}^v zf&~vZj-Q!6utKGs=H4jD_1VtX^WyJ>yFJ+)iF0~LxCIJW6l8VzJmRH%$hs!~xRc_O zCQUY#+;u2^)9K{KN^!VBBo(*HKS2UtpB`lV-O1Utlq4|Tcx291wL4G`t2}YldA?a9 zu1At$v5-dhV#{ySMLtu>q!m_p^A*Yy#0vUVg)3cUfqW>r&?eMu<^Qt^QRXyBx}Tkk zX&7bKBd%LJ@~&mptP_5{!p}{be>Nwao^@-lU!__2`FI%%y}Y!HP2AHpAX2nes1$O7 z8{e@1$1Ik@$|SSdk#z$7nHcHt!{MF&?P~o)YH<KUNh8Z!ogQ4IH2N2zbfKrdKZokV z#A=!7g)Ia{!E?XAqhr`W=cmr0kb3%yBEp)SBbwJu^X31Ni>~k7YMBdO)4Otgoe)F) zXF4}lW@y>SD?k{8sM04Ecfdv3ZeYJCi7#?5J3Y1QGU3LA%-zJyMUCA#R^N1?td}i^ zopJ7=^le-hIn>XRNYS$?o$!g}N({=D6+U=;O_DVG@T`axxj&%2!SuLtf)6-!8?l^A zwUEs8(K!fA<PR^nSc|#B-MAzIPGjFCpZmRHQOR3sO?(}6f5!x}D;TS$>#Rhr>MXK( z`G3XDBFblvA?~O}e)($dO4-X`8ngTGI)ctN>z|R3Y^SkPQ9m!@<LKP%!?&Y8)7W3C z=Prpt$|w=aJtbZw-0o2d88t|lJoyjPq5KUFZ|1p#H6(tN+8bQXIJB%g9O>Wozj-J( z-}zk<<UAqruHEokjIQA#I<+E~eHVgxUih<rP^iA2n<0)V`jAY#7)kGiM#r9vuTNIz z*lskWJbHvX&+KFc<*(5JMFBT6q|y-S6iSmjE4HvnX1{Kl1Pj9eR`zoqK`Z-?k6z`n zBkjH@W6hb6DvK`}5Osrk_Rab}Z65BYW{U;0K(4)UO7!cj)411lX@0{BWyV-h%4h6& zOs>SRf2aL~MseMN8ChVo3oxzP`_kE13hGKJ5Uo;DV00DmW;f!%>s05d2hICk;|(4h zpNzqszjgE8zR85zekDfGVxy0|{F4<!&*lJmB_Yr7UwZfvTt&WRMtno$4%i=mOw?SW zwXu^tV5Q4PmYc0Ez1&^BgsQGMFZj-kDn4URlfvXZ+Kup_CIpoyrD`uY1yc+%Uuppt zWEO=U6XR~RQ)hhgYZdFn+Wj{FIW{P?;1RjX{!uM=u;!!hb0Hi(X9E}GBnOS?Z%zwc zG$z+fbTgG9c6F(y-{^_%{AgFccd==BL|?l^B9teN6@>hG$#_D@8H~PA{cJGGt?W~7 zrNy9<1DW4-iT}P#I`#ciUL03F>FQvZIH9b^u~AUTXIMiz1S>`K&pEBjNh%4>9@7M< zR1oD(TuwT)9Ne$gIbBPR_;3+!zsQ~bYQTh)J22UQIGM>0THue$P-O@mmbH%D(@Cna zNj|5YvoG@yf&sLRg?B+DAba-cjal?*6wH}&_VKb6>wEyXI|d-7^1pI~AZK#zsZPhC zzKwRMp3?2p0_!dS3$9vd0KhWgOp682aYDaNCs0a@l%acVTM;fNl;|T>j_SSCsMAN% z(8zL@L}7CH8?qy`m0_~LeE)Xmo8R{Ze_(q>elf?jNbDwx)jeOnEw*XM-^<xCtlXh} zoL3Y@3e<%};?3rthp3}z+GrSjzWu4j$TGb8YQf7BxaPzoI>F2z|Bia|OJt#p^SAm7 zHe`W5RptJ!PH8S{E06Iw*C$s0{8HOO;##W<z9T}GcIM1SqM~*wqH(#KNH!i81d%0? zEI&v#(jkuMC>r2?2;oupMJd6P$UtLwkPT9<SDWcmU7L<Y8xev=fSm~pm*O$r3^7Xj zZ56c^t2YwTXGyUVG@8#!oUe!Zwf>R--?!k(NP7@j$=J=+wb3@%{dX-39Ews(geq9s zUzByJ<RhPMwu`=A(*%EU`s5Pok?wCv*}Rb55gYi!bLzcRfOU5%eDq`|`c!CPOMxF< z<g|NjNCwA3Pj9qEZV@5riVy?hw3$FteN<=MR2oIe+s=s<lCB>`U$(;{?ee-$JiB%; zHgmW^fV|vdtiJ3pzY1hcWD;Y1Wm{<NP?#D+|EmCDSR<u}{{hgy>td{c26bXD`MHy# zh(FfLzY7d!%I&eg$8PUep|VS=FqDWOamg?dGHnHcc4%I8uV47~O2H%0x}@>5_BpZ` zDGEji#w_n&rvc6J4+uA`FogJV1d1}+=ctN-Jl{i~aE4>zBJo2)2$6Y}J}S#u<;~d| z!^D$uzR8XLBVw(Ck7}A68Vv<4-C@l5&-9C$qk4;z@6T*GCbtwRf*hW7;+5Pmze&8j zK^bHJc}j_zHJ2o??%`?o;5yl;&E=0gO{f<h<OYd|ATO*l1g<^l69otiG=llj70Vkf zV{`QG%%v>4dQcK#XW~G@Aa@%82^bX3*({6Dop-5DZ)pyeZM@Ip>RfqZY!XI)hZW?; zd@<qwFO&viWJH_WzP0>b-z@lsjL3o8jKLrDpKER2vieeZ&~Hl#HM+iGWCUlWbey}Y z1T1=}+z5nk!x_?@-<dEe*{;6XD=;OlJv^Tj3+G$AXuNgq<C?F3QGW^yeGY4Y7-t9b zyMGv6ilntTvBINZgb5&MYVa~m=&A=O^F0#Z&JLMmr`D5VVAO>i)}1L{ng9EeY4!qI zd*9Go-jU<!d=u_LulspiX<QNUfKadh*zCD?bi5}5le(Q1M4Q*eUTJs^nEJVswPGH7 zN;jBtM46OPCl<|7#%+W!WT+%E=SY=2V3^rI0lv<-FS|!FJue#FwX8YtYx}yXt$Qov zk791c*SU`g=+f~~LN$VDfa^v)#lT+>*)<aZLoCE(r_`gKs-Q(@)kGj25FQp^g^Re! zU~wI-kK0*g4@Pbm-h#;HXe_EnWz=fGz&Nwka-aV6jrjZD_~}|317%OoLnA6(_}Qsh z@lORe&ZfpIsDFFV<9+^A?u>f{wK|lX?fre0M;YlVcK$_;u)Gm-6)8ggQGxhWit3}j zyWwP1=EO?DhDmRfJ16mevY{Z7$4-8)=7~`3*-+cYa85h8K|B6VOzsZ~lNi)jW$Zz8 zxLD<F8iy?5Gup^4>#9<}v-%eec=>qb%s(90Q~AE#${RWsR5}*bsYFGtcgDS6rC^fI z7Rq$BpKd@$Ky|#ae2Brx8ks-*6TN#T4M4v@w$BU9%i*NM>YVk(*f|7#vEjpO?iH`P zbUDF?^77+~7yu0`&JkaTcO)DIyOaLyiFD{n9Ak({Ps6eIP2C4uXVuz&P^Qb=7MHw~ zH~ZfLF3v*4N7T=I?EE53WIFErTYn$l`z$DA_d&X3iMhQsX~X@5T`^&n_*R-79?1;3 zBS6+CqCRfJ;~L2=`F|FY-jkQ$m3|YXR6h&_mW;gGp3Xh{<k8xRSpV)wVL9#9B2<Bn zV_KKw6$W%#0$SU7B(|bD?#j8%Wa#!%7<D9u*h+`0b>RQQ@d`0fCIuDAi`RN0uA2Az zAC2rsRdlWrgtY>Bq?Wl;lmL&)_@I$|6qjmTAg_S`yOq0hOu}Rx?+oM?xgL0wOzN5g zwhfrVkge}p>H)02MTuARz@?5_ee>Xo8YjM57zp&@_08q!ef%ksq_6}+EKZjj!NBVi z<0Z<Q2M>}d2FdWMwV;*e%_rvKc3M_H-<exge34@b8(wosSomEQYq1vkxw^`uwd{K^ z_cFfxG3k4imB7TuRLWhDY>-u@e0ov^_S;w`3RoUWwW+ftY(`EyN^<^+x-9jWWJ!cU zb<Y3zD9B_}IU<d9i4BkcnZ_Mn8{9pTg?n)GCL^4<FxtWhw8onmQRY$)!*k{Lu#)8+ z5t{ffn6pZ|k5%LCFb5rl!ceMt8qM}zSPDE2?G&kaNV96hY}qmIX#_ia^Xb%eo;G=p z!g{N{ZL&i3>h!{F)<&UwJq^fF1^?G=u(8E^;d{Cke93L_HZnZY-My$T{z^7W#a{+x z@3Y@7wIJ1tJdzOx)sDYncNR%n7K%9%5~pn3hU}L=6w)E@q#R*4IG3@=uTd?VW!>zJ z@mB(^(8OUEq00{rGV*gbcB>kWuhtIPR<%srsj3_bFQnKUd_>T9I)S}c1;}E6Q=%NJ z!q%=if~X{3fn4Ju#9Ue|&k!aDen}kMp!gA?O;noN_u8w;YtBWmP+sY@OIYj6%auBD z=x}$!dzIZU8GmJd@6hhw_Yq@F7Hs&VMu+4!PU_8l_@b=f(iHi9TqLg=uQHTMnGcsp z*r~FMv`DpbNsfojKLx--sV>_H%>dYdO3D=h3p`=|w=n1<ub#<2YqsOV9UNUauH-{? zWx;)}TQSXAxO4r9Cgq~@7l033AHHk|wXp#mF#sWbbkY@D5!}m-i#1e3wwh33oTEdj zPPE$<JH7U*K$4VQ({P1L#t;2gFz(;U#&eZ@%8L`MJ@Cv4bk?zNwM_ZvO)W_opM4N4 zLfHF!y!2yh#Y7eK*VLS76UvIS<qjjVC?>-Vw;<vg85@+y%GTbSVX<Z1uWV7Q-GtgK zf0AX{gWJzyp&7c>Iecd$!T6P&$H!~7RD@?oJOsd~7Uo}T(-FL~Nz%j`WqFCuOYgey z@{(@k#W=Hc?lti(yR#%2Bu472J_(VGNIwsBdLyg7(MeW<_sX0#Q6rH;yB%i}Zz!+# zR|MTnp^Ptz-To6UF`7b_i;+V6H6@6|lwPtv<0hcii~R$b3W2wtsEe#@d*X*lPQN7; zQ==^|4p#r9i--f5Lb6zOFQCNMmnts|y8p{c4-Bq{SYw~@V2uRyf2O#0m`Usl1HPA1 zD#TF5Csqfc@Dz%j0r}#n$ys^8TR#KBtDK32XDUgrP;&Zi{+!_fa=-6?Wyb~vCuMBp ze%;J88}{1sjye>ze8Q=5H;J1I^?l5I*{tV;9*Dk!PGH!jPg>Y$0Q9I%c$#i;&TL~} z8e)5x;FT#7>$@i=O?Ym%jcH>%@UoVB>gfUEeERpCd`3bKV9>T&Z{M7Oiu!GK3N*#l z`PwL6*bXE-{t0&rV&Q{Jy$^4qrJcW@?@J|^Z#A#X3w{f+ZoQi{ehU}Dt@GH`Ss<?p z$1Gsa5zAspHJl25E}W;2{vh^y_9BY6RdF)20J!<5ccI4MyMC+{^sKw<cbGm12!p<j z9bF2%n&MAzqC@*UT}}$6oOeC0Wu8X8?!_hquH^rkyWMw%;^9uHdt22o#+G==oy6+g zT9d{Orvqf4dWb*d&nrdU@j9$d(R>Tsb@kuaN4@;VYep_SK<Qm~<*#GdH+l)@N5?to z%L7vgX{HXj-bmF&Zr#tXG-w)xNuA0hrP2rqqaBs~8aTYeHqhy^80Gu!?V&MQK_^8h zur}x*Y}=4$xj6tgi+((Yzu(18Lkhf852VD%?CQP)L%ckpS^76%3$CB;W&@EG$rG3I z^l{eoBDjAvzO3`rN7R@%XrZSFPHtfT%7Yv8Z1QyajC${TD*>J{08b7F3XC!cy8yv~ z8ESH~F0eJe?2SQeX>KoydKt^O=;SGH@KqjzdItuuqWXpXLY=ComV6}1lRS$_wq*B{ z9<SX@?=oL&GUw*CP$=dUOXYqBH}IfjyTLyWv)E96=y@K>{9T6U+nmQAUSY+lGECiY zLWFw<0jg5BJl?GJOsC6p?{6l&5KcBm2}4P#1C{0LRi_SNGbZ3LVa6&sdfj@VIKUds z%-NTy+2yBzx8TQH;*oQrMNgz}>M&kxW>8Xua)R9I6JIr@fj@;Ae1@)a=prxx4<~>! z?fvR>PiFf_h;@s#8yFoo(|vKQ$sqTsa#fNl-$aj0jmkbsZyELVjVd8U*C7fJe2Hrr z3*JWo_fgD?s4-nNF<8>}YcXNUqx5^N?c3$P;*`Rpq#iUk+u&&=)&g#)OQLKKy9RPE zQ&!!j`QYNMbs~Xv=h|;!5?=tmqR3EG@t0=kjocsJD5pgF3l@TiK|23{bALmGw!@k} z!M643xPhaaH!_8oq8!J@t-B3yZkVWXD`P;`ya?Km)<~VIs9e@ej0OfUG={_|2}AEB zBJM)!8-R^a3<5l0%8Da^eigR@o>3_X`yx;J%Wq~F^X@1H?sF|kZWQL0=hOYYVo17M zji=u%GO*rY@F3b(YU{O74D8Z~+*4Z3ljakoH^fZSMO*SnVk!RVN%{{%cmY6aMZ}pV zrg`kIQMc32IEuN{!>ZFb;!el@4yCKZuxL2RgsxsbMbl}Gub|aD;l=98^|;(rc<VcF z%0L`e{doeM^Y;$o36`pcl(-%N7fkyG39dR(QxKRubvQ@gBAv)^+)ggyfw3ZjO~fO) za%Jg)E!YYXH}V|g(d^zwrzif>VfAXP<#2u#)h(Yph^*t!cf76JV$44L{zlP8Zz zr28c1d<@L!jc9H`db^R<S^s1yTtm_2OBKRfqNr<h{mH>1w%O#*w!(lMmp?wNFhvC+ z8pY_{0_QXHN1eI!XLdE=Fx{8iuvAI?<({m1J58ckt49S9JKt3qseWlebY~yl`GXSq zohbP|8(3?LwHM>?Itn}e+IDk;&{VupfP5xccg8a1|4SN_!y(7)&h-K>W85w=xr0sr z1QXCvfF`~JOA#nk;y^ZF-G!V*eq|Po(gl|~JXsbhX#A+KproUA8En|T?&$)DI}AyH z_;qp8pohcU3X-#Ek2~Nz{tCB?PUh&k)t90zLK#h{@kCUnQu+l`&JLLGPj0H3zlXON z^iaI(-=tE+dQnj-Ctuvp!n~I$rC;veWKG85+yU9YR9O}!lX-$8r^)M_o!H1aFCNv; z>hKi!^RuMvPq_&@rpn~x@%6)Tqf@Erq?$9WXFX^h#n06MPg_{3H@yFIdEhQB%l?5J zCuqv;P~dP}8`<M}hMKss;$vA6g^;0}VYvTEKJV2m8X8RRQeg-JT*Mh4rnL3E%g+I5 z3Ra6ne81tVne_pJF=j=-!LfAQl-R!*d$@{F{vIfM9#^MQ*t9OCtQm=&4caPG*tFMG zUk}))z+Gl^$YKz~>n3|=zcVDTA<1xVK-!w#%>iKiDP8%zg4E)LfWDnPPKYd6-Cs$F z_-+V)aAfXvji|qC`Q&Y)UUUr4e2w}#ZC)aZE_C?c<!SQ;-D<y~I5=KpzLKe?=+n+l z022;h1i^fk0Y8(c|IH01iGg&*K*bYOH|Y+uFB0HlheOo8Lux7Eir`kk@*f{w{gT75 zQVC!D9}zyV(OanJOQ>hM?u87?geHqPf3=jMyGY2~V*|!(?|bdg#GrSBH}(r&z<F=A zW%S)K{zKqKd!(JQpY>0Yud@Mueo@&M@((y0c_Ip1O?epgQZI$V|KKcbtN&GQ6~)-A z!GP?ec&((DVy>C9m-mt#{`!<D2fYCmGZLO!<-XP-v~P1juvDSVyD7(UxtbMD8%lfU z+m=Vt;aWS@;^1apCKW<Evq|)L$~%8&Csd&K1+=$T%GdzfsSebISo|9#fQDEQBIr47 zBPTQ)us=P?pH(4a;XU<JU33C4A_%|@8m`oF08hlAB|!fgBXl}UB=#i%zo?NDy}2s) zo~POUL?&brM=?%uo`?C_XK$7{&&<`lQ95Knl~R{Cz1T?|^3U6v9VZb<yx6{T?0n_W zO^VPF-0ldey||)#el5{ZyO@*^9rFf??IRbxm-LxL&imXVGXI|J6K&($AFPJ<zLPQ@ z7q}23AGCCxa68z$&n^ZV{~t|n9uC$2{*RwC24kPG7n!ky5F(UqM#xf@QY4B}cu7$T zWjSLhTb7a(YE(p0L`All>_W(%GPdm7Sch58cix}h^}8;A`R6>ZbMATG%VW7Cz;Y8S z4GiHUMLLTsJwWN?DZ$wHdFa&!iEaymHA!+cp~+kG29N-(3m$$ncy8{){9qe|8GzT* zS`?tYG{s+}>k`iyvU*E4?;%?;!0Gp85}(u>_PV6ULh-tKM+}pEx}2m0Wv!_EBFA*V z<22HTdyv8eDdqW`gFVxDy+G=}#76RoUn;rHSZy^Ap7=V{RCR{HY3Rw`U|=1N*FxTM ze%<yBmv)2V^#r;6T5wf;7xB>?_3+MM+2Cnp&9R`d#<_+AA64uXkoCuqjz<ac-~pt& z1#sy!f7Cl+5EW&&-l6+wkWh=yO@|TjA%~{Mzp#g&ijI!sZGxesxIt#Y<c&@BFIlYS z3$2ijFiq^`8{{g>{|Pg*=SpEK+;+2Q+bSFNH=g9iI{%d<N^=^ZPD`|#-11wOnQ+iV z`1Oi{sb#zhknXJvI^-niZvnHvEsYG-;!2Z<1ye|COkhb{`vp$D<lv})!{lm5Y*}ad zNGRRwboq~yREdv*kDWoDyFnC3I2}V-bm;!HU|SMgn&1j+b+zh$DezC*(X)8I%P*%8 zl+i_lk5`$ye349X{CsH$3J^tNq$Wt|Q?N@ajt$wYkrlI9yYGgzRPA|k?9*sYolw!= zY#o{d5dOu-P#^Nna~R@zSex?z75W4#z2@M7@~=uNs~1Hcx{Onb1s<^@Hn{&B3&JH3 z!#YjBM(c3mSXWg<@XGDLN9}q*K2TpO3TB}lBS5BqRH-VTwS2eN%m0+u<W4N*XLt21 z!Getry729I?&N0IDXM?KmQ(5fu+UUEPaI)U8DvPSKuxHihsAcpXs|#8>d7N&PZmp= z!2XQ#HT+q1u^r4kWqJ?HCoqH8y54qTgDwqyZ>m?_J&cHTNBZws)AE%^Bfq8_>D^c1 zd4dWBFx??#ITvD3bd%XH2}JIbsJyDIBM0SywTeH)v_P(69<u|8v{v!wKF<<rc)b~l z;a>u(<I?d<9W!op+2>>h_Nn11AI<?^(EEe&83_UtTIKPiQd_S`odp%gAgmtaZ_FnC z_UYTZ>lrmyQe9s#Kj}s8{r6_t#Bbunab^y4?tZ5EM5a`n5T)jst{B+#I9F&#>MMGd zH~92QTVY$3YHOi8U@*p)#f5!+G)<Yy8o4pPgiuCKBoHqofk)-FEfjEh3B)usScdm( zH-3L|(Wc|`Q)JUK4?cWtqVv4{*C$optiyv2Q~3GT-L`4$<R)9^Fc9tgu6gu)n-s0% zTN+s*vWO*eSZ?Au9FYc>DnNC`Ru9(`b|d|RNTan5&wM`w?q}1!+S)T?Wrvyb$4d2l z=b6K3FiJK7xFwa?>2c(JN@w$%hcbHG)`Ec;G!a#J8E%XPGPoiw1AqjgOP{oLHA3@n zsr*AeZ#$H=3L$}b=>if}obB@@!9>86!;@i$H&aa(T&D07IC%Uif8TEVkq6=gcFdB3 zZb3#}BGco}nX1Ql?7DdYoVOX#UWq<swf0zMte7S?ZX~sRa%|>&qXS7~=dr=olIDm? z+TQ@-)geX9s<xg#*qqVU39HRIR~@)wwi;^ztfD)k&hS*)$ML-~z};GYwjc3S6YCRm z(}J*j88?rdy+JAU7mfvHb-R?r!c>6swgye6kqYDVDg4Q_J+M+S%y(|pV#6E_O76rI z^PcL$`b#;i+I%aW*|%5l&e{s^4s13>T@{o0H-$a8Z?!Y(wzzhb{ua$EihIs2uy`fe z=tri}gbGtT7_zsdY&G=RjHbb(Y_dX|#mGfebgVtFic%O$RTc&Nq=?r#o+}<w$c3a@ zq(?qt<)sV=?kdT;S1+${#>A#cZ;i8Pq|X?#$-2rK)^9y(%+f&pDqT^BQE?OilHp{6 z;KL)Wq^GR3zYbGyS}QE|g1N6?{oC!$)D@6cT~k^C_I}Bp#7*!-=2_9>?pSnq94b*D z-aDf2bg+G@Iu7TI?6bx=b}k>@sYF%!B@okPt5DYe!lUyzxrpd@0qLLZlagQ}goe5V z_pQa;W!WS%6E<41ZNKT^>vhA(z*QC+QFJum<WENGS`S{Hr;mT^U+7fo9=ONDcK?ow zO5{GTOHvap0)E936S>@a&=bV*k?>oR2Ky#NloTWDtJ-$gHIdQBP_o_!E^}$S_K)&K zu}|(ES(_7X6ax+NP||Uzb6+e7UJp@28S3cQo8LKH44LUYUYAR_2|c$_ox#uAUE+35 zevN;a6Eay5cK55p)Bdy~x9`)Wj4u%vfQP>45IfKvdD!aE6n11RGcbiTxTQD2JC|yZ zIifwFq|JXQZT|#S-!3xjAX2yibL0<iF;}**1yQalb?1acEGk#|JGT12KONc9-4>L; z)8{x<Gl<ddJ|z>v@cez5U<jhYi0R?Wm%F^w&U|Z1?axnV|E_&4fY&f^ekC7pTy97= zCd(L>z2SuLR1@BT5VYP$bpc&xXc#ips}*lD;nMwq9omQ=(9q@=Y}hlzP3uhxji6j% zDW9C`6ly&qxM+)>RT#4f$E5i(JkKBFxEg7Dy;I&YRW=_@wlQot|M8vpf?89;y`Kjo zbuV3k(fmc#kn=Ji-R}<vBr>~Rw@q6dVE8o1Z=sT*tt{wPHB=Ao)#|&(Oo)f_Y!Jd` z4;sn3o_?I?EjlCf`ejNpmnmMN;F1!8X=6$0Rq_$d!y$q@${Q@q8qZZ%1W4Zr+B+`u z^e^+w47T^{&VhQ8ycNL^uy<^rdOT)Qzi*L~I$+W!zC4cX=;UcBxKm)u6tmc{i(Y&O zp5h~(Dq^%KMkW+;rHRg|`)3tXV-t$`qpUS0jjy^1=BXnd?{j>TE56!btbS75g2+sY zGu!p+3n;WXrn%LVxzp`Wmf?7p6!*1KRa!lU*>+c%Qzr8&fkqh)M@2r1K6|>|ElW<O zXD>R#s%7{3$D~r}5}_^E=NlcggZ}qMaortzLJN~aB#We5Es#pLxF_60I_@-EfC<F6 zzm~?8jds*Ke1pj{Pa7m8cgRayBW)f7%zkO?ihAJlnUIwA<mf*;mGU`U2JfLKPtm7h zuzJdz8_SeBe<F@v0Xn7YUQ(z~z%7URL~@($DtHPic<$%M<i=8n?VHCLM|@ujDf256 zcHvZ+9g(&@EZ1RVp&0z|I2+n>wrYci92UPHnCGL2M=3!*16^(SoZlL-s+QH6#&fKJ zyMN9|cE@`>f)X1Y=$AAgG37Ni<Zk-XouO-oIP->m*9|%ICLJUof2&SD3J9!V_v^J7 zbDb2=0^$YrS{~ysA-*!jKm6nN)>bG?=in!#T5yY72y*D2wR#RWG>eWpXe)nUhTdV{ zL`7LNVs%>_+I4X}N78miL`EqyBTU(i$i&8g|2=oh9+|5YcqBhLbw^#SGM=c<8R1mN z6OYCdRc;JJR`tphyLGC;Deb5#2$&*IDzVLmxd_j9mH2>%z%O~c1zX_yzsJn?X6(o$ zCYG{=jauqD7*>%5J^slKEm*%=`9%vud(%#CKF8*S<U7<DW1s#~d(N67>Tv>i0cjkI zqMP3k%zI3jI%fV5#ld_%JPZ*Z6$oO8h-q@b<t{G8aLdWgmj_j7B0qXr^zVjf;L31U zYX`ii6?Svb*r5i{6NJQedR@V?X@}*gun_3;cdb(cSabTmYURkXnXkLa{{reQ<oTlF z8Qv|&&|JZoz)nl#Lz2l4ZbApj)2f~Yn5~lxKD8in{hc0_*Ns3YF?x6APN<Wdw|>4x z;#xiWSXTBKx7NsmtGY6V68j;x$<=gfW$<ZIP;qLSD6Qa73yDbQ^Jcx}fY1jJzP*$7 z6KA`^lz5KOWi2RN@qnS_>Ul5Mhp1=9VU4Wcy^mV&3yNpMHGFcUk^xDmMs_v~dS|${ zRfAu9J1FDIaY4F!r^>kO_t}B+KXZJVcb;-fb#XkS?89P$#@EJfU$Y6U%2#^hAN)H1 zvI%>!wxLJ`1P-mvJ@j}C5tDgMa+oW*w193ic6b2ZZ>y#byHzcU$Ie~*aPp=H{4s&# z>2JV6QIE*wY5_x$=&(ws(I#Rws&HIk%pe}%^mr9oA9KbKW1E{|{-3M$>rjDG2)F0@ zxKy6@=r^4b-yfxsyv|%Uc9)P{DV!(G7AKwzK5O~5>b*j5!FvT=AH<_?a+8MQay04< z4fZY8>U04IjA+RB+gd&*5f=2bWq?B{eXlFw|D`(TV93)?nfvk=EnT?Xjx7Ceny>L| z89b1gdxDINbwfl;sO)wkJ`X}!Z*I#B<xH&lUsehTdi~{Aknt3C>I>^hD_M41edb!k z*<PybJusdL13Mx)ubq%41FW4^toQCF5BcWr;T0w5_Lk3^pCklrWkaUAlcS(fKqSh= ziUd4Db)Q0WkUt^=4OT$3GWC}BZ>V!szgh=A_MWOwex69Qlk%r^ImPJO>2r@iz4heg z!(VQ{6QV7ySs)O=emA^~%FGwBd^bRWXof6(uG{awrSb8viQdSg(Y@vWJ`-B;t2@rD zpFSKE2C`=dn6Vd3E^eKF4BKYn;CyW)A?$z~^5vZ;<vt(s3)^C*vhSmwJ>}4n_=u<V z^P{F|@01-H@yDw-yoz^*iapYxJz>chvet~>kV_hz<jBnsnu3j*S-TF=%osVw;J4e` zy<$$JnSz6niOe8tX6#a=E;XRO(NqkKvqAa;Cv&wMiD*#o81l1od7V=|U+BY|-@jZ_ z;f%5CZsiEw8Q|R2qL&M~2T%O=->bpt#5rM`n>?n5Sbh34czmWNw${I@Js^Q-?I4uB z@<H!kckNGR)Qhe`;h;4L>UqJ;yguboFX?t-2%!VtMZ`lNhhJ{CD8g;ZMRP8wHIbck zZ<g3&W~O0H4wJkwP?}+nSAiipb#Djzr<WIhw)5eqDKATpybBN{Rb(+|mCVq16PvpO z4wK;@<2J9{r~fC*+Zn0%cDRf4`P7jEZxjeEa!DYH7`LRiD90&sBo_BtP{cG5_U9FF znms-Wh)My+8)9HXpyPd@FcAZKRSwu6<}(N`vV0QoUuyftoS!CQ+8Q}_&lLJN@X&1K zY<SgQ`ebjX*W#pv4SR;=UpvUV7Pkp;sNKmO<oB}3MYDnAVk`oOSR-9Oa5V@A$1A|z zX1iV#)z-+4`^^9LtvIGHZUiVQe6)VHsjd!z^N-?5tGg$OtVj+FWXE7R++B^Rsi|}5 zwj{Q0ypdrZKX&$$F6+8!OV#K}BgS9h$+7ZE83&=AZ0(z93j(Pc)%x;(In6jPlDGv_ zkDPA0VT;keGaWAustniP-)*#@K6(jAzt#cbM8T^Q2lt=KLg60Tf}UdF;rhQEvz)3z zSwcRbi3lD;K3ljl+6GrNUq%62bAAUIftWjxCEF)~d4ORxO`W^syIbB0y%l<H;t#)* zJhe{hX@zVb!>FZo-s4AUR=V)`+u2ZTToS7U<(7swbU&p@k5%D&1oNsMH|$9*gLyd` z)19C%ZS8!tY-Z(Ohv#({XL!d)gctuS`JuXyYR){IbglTHn6mIo)R2t^a!rfV!d3Q8 z_>eEFadI5<+dX*%ad`BND+V<0%;1P`ED86O5kEo$0FQ`|IlwLN3?MKOczCmm!uRZ- zLhb_#;!SW1$5`13Etj){!0oqq*KH`}EqMk9-`7V0$;`VA9zh2x*adF?)qXT>wo;Ff z*bx9d6(LWc=;ohCo2hPg;s5^VDExv2*Hnz}|An(<x8Jxz=i7`#B`>g<09I;ZaC>Wg zv$k);YCmzBe`J1CLliH6`Q-(U>rqW5)>IY<27>YL(AH-K7cZhzF{^Rzdrltn#7sun za?*-v&d}D1wF6*rpU}rwdJjQYK7$VsmThQJLNs5nporUkb4SL%B?ReQs+(;1@Sv5k zU^QHwl*qjL7ry;@ZpG5)=nCBfxuf-&f5hVvp7#-6<Au%P(36xRtb#gfcnepXG1YZF zclsQtU3it9ev1l=lQyNSHtS3-Ty=%t_^vVRQW!nO_&dzh_WfpkQw9%6dor1mFZ)zN zw%&Z(zi!AWr}!eKpI@zSq*@`x6Qx62Rk$1#uCJ9X1cJUU6#ix|8=$7@UUc&9{__gC zcsq=?weY(n09|UpBOF72CrhYxJ-lCAnVWc#e=N82<KO<G1Kq{SKSOF5Urg6{5M!O( zhf_B0<!@@WVM8OU9v=)oTgH8xq4oK0H%-fr-M54vwIIq6-=?&s;UG;Qo_Un%F6h`m zQn+imdwB$VXDRH+aPKWr+m<c6R(yv%zws$xc1y)r<m_)F_Wm99YDhe|Zhm!;Ga!eY zF0aiD<6jnY)WU}v16nziCpi-}6r4!xYosjOB5B!(`>0AQBShr8seB^uhqH@%OT56v zi#Np6!7P-cwGyI`L485jL%vb)j28e7?IA>aYNViY`<KIw9S?Kw1=Ci59o|8$!Qb=j znmLgzcwP76mhs{z4l5kK+rMFTfnCZjAaq!;p8~n*yM&*da1pxuIo8KmV{zwz{m^Yg zY!;ZEKzTFe@XSx*SoCs5{0e6RX;(2oORd5m1)aYU&a=a(Vi(^YE@NZPHr%=bzx&Pl zzYBmCA_ZDfoQ*MQCWq1<s8ddWdW)LMTsK~bDtK0w4~T+YKL@Q&fcriT>KCBK65Msx zG6zpzKnk9~5CW|J)d3fft4kkWoDDY)%-RJF!{7S&X<cUJ1X%U6T+Z}jn^`YIp3q#O zBF0FoM+&3!^j4~&Fb2P`Qde&6W;N-?OzsQTnVF~`*}|3~^saM_C9QbBoz%%XOnkhS zNq-I#Px>%@BGMXgT&JQQ;UUrCYplL;ye$HEX<!8xxtZ4_7M}TkpMy^kF|-^@S#Bi! zX#<AEkMsuhiGmxE<bDyyPM+V~oWY~Y^ZKUbfSqb!`%WUDDL3{p<*=0{ah~^Cno7;D zPm5&-x;40eClUVQ*M9r$uE)Q{_pziJt{O86Eb)drU3vo11$&?$Q}4u}w4b#FcdDN3 z^v?Kt;5n9x>nDFGh8OH}CEK(ANOJncBkHZNj5nLap12ety<MHuK{8<JWzYnvMe8ve zR==B!@gLUhjxG$A3RIIyxsaXZt+AZbpT>aSg1IkS5Z@edOyHD8vjzXDD%`c-K*W5A zTwuMLPVD0*CW#TKncKnyl;dgrc@5sfZvTka*EN2>;Xq_gHT(-6X?Smz88f^yAT!e> zeVCliESQR?YU@Orv0pDcAPBC^a$BTh1b%U{U@iH_9Pv^lwr2;QzqI7Bu;w;^j|i91 zgQ*Tr$_o0vI5>-bSWDLZ-D1S(#j!8##CE39C3doxA~{lOI*B14Pvqnc)jOE9eTULK z+tAkqEWDwX9&u}g=MMiacq|L(wjc`GxC0fUpdF7YhJYaG@uu*!e>hFFLw<g;hxd+_ zSAKgrtt`Ej8uP&D3iGe2K6UQjF#Zu_p$PB!HWla1iX${8GI@XdF22bTAY!urrlz{t z@YVapxoP*EzG1YMX{uZXVNwQIncAlUvj<u4=1QIzNS=P{khH(}IKFImBx1mwT-Vo< z!OXYRE5^H?g1acoF4|8sIEHe6UJ%n7FIFMS4y@jElVBA1^G{_XN(7|FELR?>ww(}c zmH;#U`vy3h=iZ4V4vFO^0j|PBhq`i1g!@=Yne~@@vBPY4Aa?<JnGU_PWLE*X{v-}m z*Mh&qk<(NG&u&Nxg_+v|juj?RKX{%AO9Q*KJ3(d34o2+%HdaC|Zo_<cV9_2+wQG!@ z!jJ-Mc7C*|@k``+N3*}h{2NzVuK(xFl65%QN#$tz+boF3QW^=ioZg*i4a*m^-29xz zh85kBH73xL&dI7dWdzS;BJuDpV&g60ngik6o%l3y5VKx<fC%gati2@%9!<hAr0&4y z)<{pc@X7ZCt=9?`p|p_jrzgVj=c%MT(<tXt0(;YD2enZ$^AQfjbXaOkK8tlDhPh%O zd)a&zEJaa2G?1R|c2_2dgMI#@gUf?uEWt&Nfa3v^<2U*!5f#4=^G8vB^&F?VJvhsI zM4ka^>X#a1&JS0QHuy(BR<uI~x>O9eAM#w_Yb796If7%v6{j)IoWvD$N6~8jin;r4 zm!kaOM~;^6YX!S-;EDSk%s0b$KH{qZ{!d`(w};h0`e_u}Mtwr1hadw;On3GDxQYia ziYTnXT**)jIli3hxYM%*>{~<e&i6kah_x>lsQ70G%IPdF4<=C4$efRUS_1so9(_xZ z=kYe5u@Lu=*b_t{mgr7|USmBs=lLS<jm_utjEYbSz%=WgSOQsJp|y$l9#weK322N5 zba!2>4^dBjI~unLX~y;lrok5Jl)U5Y^zb^oExVzxLFAS-2A9bcw2`NX%zl5y>&pIl zkocK76Vt(*izS<;!2vCi)9TPSyC)OwkYP4cr(^ej_17hZY6YD6p|k{asDdR$F&;QC zYSF^m`z6&DME(}>ydY(S(8mz!2^rix*%Nw#%A&yQ1A&fDFTS&JOe9`j*Eo>-Y+-Gy z^B8b4u5jdH-){f7>HKZ{`7!OiiQa7Uy*o*}k@+8b0xW{*4!+48%Jj;<dA0@n^9met zg{1_@^|X={;4?G37mx%=PPg`?i1VU!(BPf_?@t3dMyWL>44QIAjUogU-p8nCb0(ZI zUxMzPo0b&Z58gIQ!qxgnV3~a@WlRRqsrLo#rM&p}ZF0ERnf5^>F^e`c87^PMaIsmS zN?l)`e8D!=w-ve@u0VLWYv(7;<%?XsQ$b3HXI}2r5B$;41~1dhf9*=`fzPQ0agc9Y z-35mj`sBo+{sCEQhN^>0<>313`B4@(sVw8!n&sP+Nx5Yit|}AmKSKElfug?Kwdp5f zQ#m-B@q@pfA*lhpLr>xX76Glj=f#OJz21V0M)P+vek~ksKSp#1s(4Q0DYf4CYL4S; z7{a+k)+a#Ip!7>pOQ6t)U<uG3)E?5Hgz$cje;IX!BVHulFUmu$a(C*!0lW+smt^9A z+#Zt`%(*LMjNwg@VX`Q|x*j}%ov<TbtvRWEpoMX}P#1h^SW~mi8LP*w*i69=M*x<J zN&T*aPc}&zD9hO_ILS;E5u^<+WzoxRcfTn!!_&e)CKyw#FUY28&w?k@GtH5C2a!4$ zuEU5SNwlvBXVj{W+NVjG{OZT?6+Rym_ZRQloDK4+7hDUyJR=SsLJ-8j`CZ%X9!pBD zJ-biCK7vQ~toI7^s`<>2TdW2Y=d&ug!@<GvS=9wBw%53tJV58SIW$n90UzR>GioCZ za6$8!=Ww=ee-7OSFg87<R?L|uX|=FKlehmVE<ic=i=nP~e9JJq4##vyv&<B?|0Kj7 z^kl7QqE_#n4+%@oSK|34j!4Z455`TZ$b0H-pTZN8NUQ<JA0M$MjmkHZ&nn=4xn9R( z0aqhCo>|4{Dpb6_;BQMJy~gD*v7L0llGw%;_|5HmF!f~HG`<HlJI=csxK>chKm!d| z{t?8xHK3v?htQy^taRAt2;k7Y7$PtQi44Gw-IIRXy$|rC<Ji~NA=9uBSk9YOt-}8O z2g6ZSvBDokenjEjECO1MT_!x8o(i#p_jA<*>n}H9Muycyx-St#%yvayC;*{}yJVby zn(@bi)HD{=*t!13KxS#buAVzkeBns*al<R?q#z6J<3K3)yWY)nB*`@Cu^Z8q!a-p7 z#j68s$r`{{?O<6I`>1hFjSYa_5%X2VUPs9KN(w<m19-VOj;qtC)FrG+B*GQ0$lG)< z0UD%tf|gbbRB}hhta#5(y&E7oRO6|QB%7}urFmqxGK0pN%pt^X)C4&JP(^(8FZm!_ ziLeEZ+~*j7^nC6V;ZnGDJZQA`xJWf9MRDa1{EM1ZMw~fHxhWF@{w^wBI3&eqClT@B z(zf}5+;_LlA93(_N?`~49WP;N3Y!t2a<v7<QMa{FBzwLyQ+T0*F-2Dx2i*cA6&GOX zVyKVB8$b2mBlHXGQsK5yHZwSTQ!48(NpGU7Z@NoyP6|0LQ-AOZ6S&7#R`4{M-h65) zKPC=Tp+kR7CF|3pa<Pg*@P|(tZ^gB#r@manP);;4vpTl<o-IOTWGneudSrSWc31b< ziMzio<6vK_FH1)*g4Y{UbAXFFgf8Hv<L&SjL(YL<hf)~pHURNevD+=UUj3dfNGBK5 zX3862PYfhi#tKi1d>b2px<kG!6AxJOo<kyuFDgsEU*M05JF}juh&bY??D&OI5O@}Q zm~q(_47lfasPo?)3E*8Ku@ESHm8$r_b^BEAPJmb1UcihUd+9I(^D1?G>4?tmAv-|u z#2PjYLDYe7-o3q|ds0GmjnrQZ7hGZS-rvL{L!yc!@6{(?`PP8Py25ohHtX0f@3U2S z$VxShJlt${P-N`OuguR>WpkG?vun6lz*q#rPmP$$<NPU1<p<|5TGd>ibm0UGLiq*c zxlK5*Q`l4a*p?HK8N;c73Xhjy*tl-3L#kmQPaYusmSMd{dNRNv{Z)Nt2hi^0pJ}3= zHho;r_r_<idSlH}%GrO0SdijGm&DwPZW%loAgqYgkpvg!^`3l`w&vi1{6Hnwys3j> zo>;f0EePL!&i{;WM^_ZQokCOw287-$J77v}rtrD_3@g1gY-z35%AmLe|N9GPIraD^ z{{sBhovyo@WK|sd<SCryzwDG8X`aGj%{_)*4YBUqGQ;e584p+2Z3|x+d&2y&Tq?-b z^S}E%f`-KrBEJ!Tgi47W)H;J)$#nP2%@FRK{9DAl<pEEY|A%M%N7PS%bBRE>N9U`9 z`u<f~?Z8!&hR&;!I|9{s+g+CMA?;ia|7BNw&7%=XvHP+>En^3j{|LbkvAFG+-^%FQ z;M|Il0#!i#f%Xw?6GW(;1UPb|q{-h9abxfa?}z@HLxH)j8q2TV5sjYl<D|xV-rZ{F zKDSsL>;b<=5|RebB3HQy*Ux${twai^?QDh0GDxf9$@d)I4Vx#%+`JpEb#PaH4GPnz z+&ICp(Mk~2-#FoVyQ9kzm>O84x>Z9|3}k8p;V}`dxJ-n66Fe#09YU}m;Cim<x^VOh zCo=T*Y2zxkO?L8g{yxnI6e9N{lz%U_6K`WEQaoRdS8)H@z6TgL&dBMX&02&=0>rvJ z1fXQUl4`x?F~3@#ii1T0f%wG(4EW7>TF#DEMZiWn0+;y|GA(0=qapiw25-)WP#ae8 zX4)83a~J&s5!$(_686E{4P~5$Aedz!<Z{IWCx_%Ukpou_5Lb8tKQWt9pd-jEfm|fu zIlz{SCA7dP*Z6=d?9ch9QJ`xt$?t>bN)LToZi@U+4p4wi&%uY+9SV*e9o#ux0lo5O z-F>(2^PIk|G@^z6WncksV|X-g5a2o~aJ&i|;uI?6Q*K4c5+q9J?gOU~#`gtQ88^of z55L|UcI!tEU1;xuZYBa1k;J%T08%JSjtG1YXgUn)|EEbv7Y9N~)}&U_s-r%KXafCU z$Gu=M=St%d{u}Mz{*tK)WWbu5R*T^gK2=)s7pRd-B3`fPeEv-o(Z?HzKhs`f<&eeF ziLo*td#4jD&`DI{uxWFjgndl;aM9%Z-}8gh_&8Lk29o#*76Ep)3vc2LqzI2-ryBhI zX1pak=ovhd3~k1RPGYaZ_7g6-8IQhwWePMeJ5-eo<~Ms->%(%7>*T{?#M#?M(Bfor zbZ7*R*oSU=4iq(xGUnqhPG|0(;;#(h80n3g+l+PYyjk4*lCE)U`JCWz^%9t?LwWPo zwigHmkd&`Zz&RiAa6(0_Sq=I3h0ZoOxu3qR8#Z+A2T#n_BK5BG;eAS%UYPb@>~z?x zA=nOK#h{O6EMv~|!(%R>q9csLQU-mM9tC#YM>`sU9G=z9y$EU!zJ5SU&P(z3v0Pc9 zlV1gWyPtrZZ6Dk3FyupVfONVd<h6#PqI4oNSPq}h;27|8R!TED@|=x%LaWEIJCB5| zyI;<8Wo%;4Oi<N-8BF=4xugBrpB!4a=cNCgx!5}_ib(DArU>8l*E+ZcKEfZ7-;0== z^_=I%X}po|R@e>IBn0K>XlN%B85ztZRR%VgvzBBhRnMh#Q};D(rGL(kW24he-$qIP z%JpU?x&Au0CKdk}&-)GWi*IPq6?)pdqqCoVOeMmc&T~`}=@u$86o<%_9{QI4x{~?< zox9*l{w=8Lg535>q57eW74(s6813QZBz1&u38mNj5D%Slm}|K@1-^_!F{Lx!L^PD` zIH<rkzip->DGJT(Gh49u9=HSzgzU8)BKk9Ber2%=lb$RpM#}EL4)h(j`m-vo;7Ps8 z;#*?N{@)7^Pp^|Nk!HSB?x1$m|1^~VSw9CaY2F7^BJ7aH`KfN<HS%d#No4mq93NnK zxK$ZAj9Il<0^<3J2Xk9cQHaC@We3l^cf~%r?=*f<-M1$H3+tcm{pzQ$CbGLHsCYNx z$93kdg&?offa8`!dt^M*<M!^+o$c>Br@f%yc8?p$3ShUIv*j-}TZ4%e7ou2N*jksz zfQMrvsl^{&Ik`(-36jNOx+_F1DQ`y>bViO5vBFAWr9A(|c!Xu#i5M_Ird-lkeQ_J~ zHgr_WUHE1W822GLJTZ+w*Ve9cWp8JPKWee7t81~ls3>?#qSx-_*cqq)M9|Ou)|k=) zJ71O0|Jbu{+sHnSc{ss5+&3HBAKA>wNb$XM_#y#d?EX_09+*o9azEiYztyZCVs7j! z>(wY?ByZW(or0H}D;Hjnaq)PMynt2~#S_cw+TD5%l-h!vIO1$g(U!3|{kCNH%VRzF z5-drrq8V|3p#pNI+SeZnbeCXivr&~If3B}R=74&<awm)@D(=b))?{y=FB(|+!oAxQ zhn5v|e&&R9N@x@I2vk^HkO|m6-kg2Hpe5@>g_YTwm|ebqVnc&+!iE`J*6u0-2Pv#y zx*aSW_uldX)rLcP6Z{WBv}c5c)TPv}e7M?GZ^{YILtEQZPYPKDXI28Xl$D^rplWL| z{z5fO6obtaBg~h1Ps=VEV7f_*Uuxat1Ia>9p`gWA_?Wd)++Kki^%lfj#6N^Z{aJl* zwedO4h(p7MxoqgMacf?cATtOJESk#kn#dXEr|F9cBilpdc-jrH-0g!{-gX8F*&aio zI!PDjywf<p{BhQ8Ud;m<J@xgQwA#qa0N!tJ1R&!nFE8Jp(%0X6TCf#y>_f>+75a6# zmz$}+QzhEJmS==1j<Rb|ksb13RBQh)QV3<Ga3>w8O#OuS*(wnumydSs1InKNY4zX- zZmGP?HU7lOro}_7VI{WgZzki#hR`W^DfWA$7?}O8W<XbhL#?uCWZ5Epj}bngA`w!# zUAI7lJF<AY@3mEjj0u1W{o{Wf@!0|xuj^o9ZHyaReh4|{GFD6e`|voGk1BwdK@iP= z(iYJ(_oQFved(+?D!UdS825fR&afy+<nWG`hoP*i>B7j}VWEZE@*ES9%un2DaJY<4 z*p;!;?O|0U1*QGR_QkfGCej*s2*ywVtLH>bfH3stU<O*`qUm~oB3n5Q0G>OH*I^%V z=$c($!!DG=u@~4`K<?tpm!UKZij(mHak)6ZU^BLB$F9H&`nKVS!Ic0<dc7w#9{3&j zEM>OqN-99&@qIV(vDomR10T4IU><9a(w0Plf$)_*NTM$)eBjhRBmUNsk<%z^Fi;8! zxp*_wCZ#GY?-R}(9$QBP+ww>`YcSUW*i>>P)uVSY^zXN3&0_%1hJCT~osWJ}zKbH> zyQGMJaQ`@R?=DR{?CwBU8cX*IEI5qMUMchpx?rl0ksQXWKxy=}MpQq;Y-6KkZ#NRy z3m1zqo6iJ!T-)D5kX@77PvqAGoU3L(lYb8_;)T|*fqisR)e+EeN9^TidXO#qxev>= zj3JOi-_C9dK=q@dl~9X{7_`lt>Jq0eW?Z)}%bP3;U<OqINiWU@OA!Ki`mzw%v8o8( zsgIL41fQVNgn>FNA0Uq?+SztQ5Z!tFPUmsOACJDZSIFH;!80%2u~zr@9+WH&bgW2O zB-Pe9wqM-f8Cvf({o1{Bb-jS)|8b<nTON386j6iJj`nv)0ev@q$Kr54L^gp_-0Fea zukUQ7Ml-GMfMYn=%!d7h#evsvl0UCyw!#K4S(&tC;#?Z1yFR>JPz^ZzZS|PIxD%s) z?v|gMp-MFdps1d3VswO_Lj2%bu&vwCkORm*z4p7^BK`1619xsMFvU|i8GTTSa!8VH zF|f086v=^~S6%Ia41_8p6$3U3!1%C$uLH-w7B3C#59C{foQH4w`JVJC-5;eCnB?|w z4*A;3`WP|$R>p^{a=)+F4wfwAr+u*;$ND8F&8QP&qRlDshmKFTo_YJ^u};3YXqT8s z@}~<|-F9j*G|NVR0vFNASX-*+J>cWWO$X4cw41YgUvEYr;IFr}5W{!|BU^r}!X;)= z1R#=)MLyy20%a5Fz*U$WO^0>xl)8@1a?(tw%-ESTT&69d+=ME&gT)-F3|c=&%2V9{ z9YsjlY`Pqv$-cLRxBjF{Q#sEJ(rzk;PSCV`HpEOKy#@lb*wWSoLhZZhoo%};9P<Ni zci*AKSOEgDJ-X^V5>QB~HE~8e?nh0T`Rf5`uT#{cTcFD;AcCz>1i=5TAv~`<acYP= zHumBe5JmAH@>M-k1MFe0P@L~00a>ROePSUZJY4)3N_F(X8hq3nhGG`s)XYm;3`9J< zp8Jv&Lx+;LOG`eHhDy+(X){5OUAU$yNrHbjAr~!%z#yEUGZCkP>*1&(DCC07I8JdZ zR0ePMz;XGOTTt;;c&j~PP2zRV>Ig{K|AxeHg{<gC(bNPt9;DR4Gu%f?eoVRXqGUUf zf-2Bebz%|lriOpj!&{4(gF+8OM}boAsORYWH{%E;-_fdeQQUk$uIpPhirqpr``xxk zK6H@5OLHlM18CKYGAKL<>}3=F;BA2Tw!2Um4WGQ1!Sdl?MPD(uD)~iY@d2&um<Nkk za16~^`;*slvyCiA>&glTI$L*NJYyO!tQ(mB-|4o9QJ0edLgv34fB}KBQT(Hk=X31G zJbrEPEb-JuZUU;i76^xc6p13B)JcBo2JxXb-*VAg!h1C$K+Gvb<ow)nI}4s45m-&F zP*h-GH9FZdjNyts^6XDWi&BTytR{)ly62i_n(>Pa89~UK<|4`Vl>=J0$}2xP#KW1x zrgqG$TV(EGm=<HCz$md}2KC32H^5N6(ZSYYvU3b6seYx!pR9QPg|7nobE9)r*#pXX z0!8_NnYm|M6Fx}7bN6E<M%&^nF<j?lh<l11P+Eej-iKVgrWk$eaxV2PfA@Pc4x#KG zXfJ;%zlZRJe^s^bw;Rv*9mp$#1w{xxT9g>ZC*rZ&48ciA6yWb}$2&iSj(%Ch>OE(^ zZcc`t?KtK3APTz-87(n*ycu>{lRP_!qp1Mau`=h^wiOn(^H)PG$YM)ET!RNEc>~W2 z6^kMH%PL9`oQTW&tVW2(0q=peX!VQYhZ(??vC8o}arQalQb(-N67eCAAnS+Z_lpQ3 zmk@C89U@Qx1n|e<?9<!;%J(`zT!hz3Y_~k}7V(6iu*b}<HS^tefG8}2-g$0%kkKV@ zDbt84@O6TEEnX~p5whE03#75U_P^4nm0YB!ULnX(`X7^B{{K*Pj)_`1h+`jU9}GRX zZTjOg_v-KinVrMqEg3Xgu0Ezzr3i@AmQ&T@j=XDla+r*~FG}OJ!kc)AnfvoTj2xj| zl3S$-Z?N_w7hTT)TTRYp;;?LE0s!!V&xW#!fDa~otJ^bN@5rWe`QKpj*dM5j_xQ@a z?>kfn&e=sH7JZuN99oVFP#Twt#+Ac0XjsJWITZk^R=ue3$$0!;0A{P^f)xFu@ZA;o zOb+AD2dapP$|CIzWh9XtfAVs7?_;R<2W#K>iiJwnJ`9PAa&~yIMh1s_d0}`*zUoiW z)hz_DdbBG5xvECN|4Sy$m_H~o`+0@Om?8u@g1Iz8E4yOSoF6Ip{5(P#Ad=#gSB<Z7 zT+`nZh|b(Z+P2t5?n?i=Vq;Xf?O@jCsjkhHppapbSjc}19yhmyH`ptIw75_Ba=O<R z^fZ>1j7-%P4Z6U@H{N?#&Q_-3o!wz9&eU9e9FnS6VnZ<lT#4{B9gZ4>FW9>)1BES% zR@0`>);WeMw=EPTea{c9*nFeT2~;-4k`<LVEvtUcGWQIK51LBC@smD8f$L!S)9Gp6 zFBCblct{l{5Y|jaUOuk*9`K+YCw%rmLetox&s<yMN9$4#0>~&GAW$iwK?#FH@MsY( z5`g8p0|aiu8BhWL=Yc^hTk#nSKKi{08<WYV@o)@`Ory@dS?9>Bv14z-m1(eQGy66$ z+YjV=ib70!fC2+1qvJ$Y%K8(q!`~xD8L+1g-2Zo_g`cp0JX0!<i2N%FSKVV>e8O-$ zLpMU4CJ_TVlkbV{BNnQynQ}0|A`;&nB4FC0%5cE}48{XBiZoRK_a1;l4ONQ(W1WfF z)P2a-t7d&Xs!m|8B|&$!cIY_Kj{@!y3Y%M~l%181^#CZ_*c-hv@zAMGcH3qufZJt@ zm)BmN#>&E&OU#&CLRE_SbjZ<uXWDL}<SP4+CR-M`Hw58D(&_MmP1;lT*iV=lV-zk@ z{+LyLeJi~-lK(98Q#kT$bWs!D)uWC4>K|KDoSjl>VBadU=ei)Dft#r=vi{n)u<C(R zRKthSvlTk#L|MK@8PI5Zg&;F#70mPYrYkr7C<aICN?N4KPR{{*npftu_HY}E``mxG zpNJ!J)TF*^I2&{zH#(5<kvp315#dw@-DX4f8`tuoquY>jBX$y{H8=jkr-vg{fWwt& z11De~4ng;XPb6H@%Kp?C4U`(~ym`tZ_2Jn4&sg0{4pHsUnATA-k&!J%_UW~fia#r- zN#yh;1FNY8Nf%PAOIn}+o1J9JMGV^1Tjoa{S>^RT3+x%<e<rZbK_zR323wx4Y?o%V zRWIUSt~U`NV__!=oR>VCSAQX@KLU_$`OKM3AQ6WF$`&|_xR{i`{ykx=^QMkCdtAQ` z1a3nwz6HIx3VX7h!eEl;GVC<<(R7O!VGj@mBA%>~jc3A&ufTUfpos3pWb~pFV8~b? zonFw)7HPMaDTlgp*l)`qo)e}QpE6}0ZC3x8S-HX(6^MABSmojQs_8q$;4C2PkT=3D zS#sCKj50l(@mxkN3P?P9^4Br{^-EZ{XlIJn7(V?hF@4W98XkR_e6Ze67Z)iqe?r+? z9DY+6c_S2C)ZnYup&ZH$;Baum^~jh-{N{<8K~MIZe0=CeTv_-5wuu76>eSM!BTkLj z<gnqwn^RiqIj|@YnXsL(2%*jkMIeEZZdl8BYMOjJk&|PqY<kSpEMPQ89ry}JwLEin zZQFH#dMuwkqOsK}N$=#b(gj~N<>t<c0jho_mf3^kOdPSxh6{*qO)|d`*Xsxp^?@6x zC&20+;Cs<$a!EXSAEzs5&H4csjmsABt$G8_pr_&3L|kwv7Y*OCP9}NE!D63*!VT>B zLL{Capp@Z3N(Ybt*)PCBQC(R8(1cf4Lxj?K$=le}7$vs!&~{4`-YShnO8i2;kq8|f z&zvA(ydOU-<aw5Pa#1C&2D|cJWg+0yI5|0*ih5Nc`S(yLXG7S=r=6DC_}llpY7q}4 zA0Rx=fQ^q8CKq}Sq65#pGd}DBPV;0m5o-ONTm?4*w2lvXyrh;duB@B~D8X&c1XjGe zJ(1WarGx#E{v8R7%MghlgF&KZE3*XewI7H8FcDPP3gi2LQWlRSdfn}_a-UbnK>ku= z@!Ve!_k6Pmi4aCj@EL1zg5=f8zDaYKY=S80VEfZu4<qe<?i$svTnJuyNpTS!7)ZUn z$I%xlewao*Thul|Qe)h^?x_cmN<Iq^o^Rrx7DN~9T+ZcsCP-hXS7mTbh&OL-HBIC1 z>|51;$iChZ{S{a0pu7rJ9q_!tWz98qG2HPOVJa^89w$6BnmpRsilP8rKQH|o+UWkb zR^5NEsk}e_+yPqEhGERZ;4416v)+`Ibx;V<N!#pgqcXy2T?uwu9v^yPU;T5RraY4A z?fb=EK4r2VZ-&H@mA{9WPX)Xwt-f%!kXJaIAL(MpLsYjaq4E%ci*xN(j1$gW?~|fN z&D6(6dNBxMiNkT*95xcX3V6B!6nSZih^RJ=dvcuj&{<~8F(x07i2pn(gMv<7Wb`(9 zRIZzG{skaA-bA!`(>U-5e%eZcy>N7e#kuX`Q`yO^gnx~{J=B3hXXZam$e@XYu<12_ z<I!8rPFZz1`zu5}JH$voeD7#ObhTr*Ck|y`!&E#=ere(-u&De%FSCww6S(ulDn_j= zv#ck7L-A@r$}KlD%FATB*W!4;i}bcKiZE_)7A)Nm0RlJ8jmRM2{(9X50bHMM*y+dv zh&yNoaGc{R1msv8Z1e~hDgf)EO9<ZZgC26+t#uF9bNmu5j{GNa0xNJt3cAzvIeS0M z<HJhk+`(h1Ux}rugL@)*@6W%Y@S#IjS60K)fw9-qgO$9vQX>J^ki&$oNL^s+rV_e? zxN>Q)=UwJU9)L6xrvVb0Q_czi5f>{ZB-MI(Z()i2;3u{WKwSRHLv(m#bb+(tQkBj9 ziKCwrB+9P=IAo5Q3?UKU{G9VC<8N|}aR4uCCM;6~Wc#vZ#HR6wcH<<X?@2LzC4lp5 zZxZo)nTV-XJm7?_V!ucvbI`t*^g-j_gP6!JOLEU;sxc<O`LKX+QA{+?S>BJ?IQHK= z<k1Tch$gp3t#*Rk-1s!?ftj8l9&gHKg3;n;Eoq2Xn@<6F)=A7z1Cc=PB}Rgo4ov$7 zM+QmYHqB?2;;;m!l)W``<(968v66x{Z&aXBIuCGcD%J8Uq@jjbTOfJweqMwPwBZl0 zcLJibVc#u}a8fTf-U_#YRFr&xcVG0n+rfJu%P_TJe^aEz*@9b%9BAUA4C}ncLcso> z620~i^HrAe^1HqD0mN=q+^RHBy$}yEXz(Ju84YB>TuK9BPf9n_G3Y@AXHgwrWT8)3 zQCuwuSUYTgqMp_DlmJS3e}Br9&ie+lPNR;jsFK%sCg2O2Z29lpJ(&v;{fi#_wZBCP zr|=R<MEW#d7>G;TEa6|LCLH-v2*!%hT9zV0|M2RvL>ox0bPPhYrptUd^2>gxL5|4d z%?h5NVj>4Esn@;-#C8{)KfD*@P3DO<yp($>$@}Zn1h#_2s~1hVc-R*JK5!H5S$FG1 z2w7l=+{UL6FHUDA(LqFkWMjFn+{DKRfMOk@W*{)DVxG&x35;v;A5-RKz+8bw*fx=@ zvGRU|W!l;$0USyGfgxPP(AgR%CsMOv=l|A8H`qo_kwP1Lj_5F6C2+|D>Y_KYSbdN2 z&irVEsCn|ioxw+&71gVQio2VrI;mqTwP=UFJ&`fU6=Lq_JTV5UmJ&h|C!V^zrK-t$ z8kj0IlHv}7(@pC#q-^>f@%58PQ)sAbKsgKr+)A602RyH6bP#Wgp5q3d2@WN4$`~&J zzzW<>Mx&Qi>zZU9vhNEdP=uat2q@FERGaax5=TyPiis=ES}^n=6$5-#+3bYWIBObI zSdrq9ia@0b``1Q@YQ+h8z4P(pnd5k@H)~%{h#EavbSFVF`FK=Rw&Pf_p`+K;v9}yS z#Rv9iCo<|UJr@LoEmr*qz{99ZOJ2LiIu!kau;Gy&(omQ-7YEUOF-a{*z%#3=S35?t z_Pw^|NZuzEWr2wy9v;9NDFMuC1wX0l7@1q-=-%v}2I#Z*S>B<w(AVGK7#<+tCWe2^ z!0R>{z?Zfl9yahLI_-VXhZ03vDz}<B5ec{p_O$J~{b-#zx$##tT&pSawOxa{cAx-i zJ}%0e4g}KD{$4A>;2hr}Jma6Emw3`XfIFK@yeuX5Ic_@QAA}@QU;gc_OU2<NyQR3y z{5xa$0Btmo63FkFvH}uUsuxvjVhqqT0$*B4NzRgR4yP{mIK&_qy<q(th7UXxow)T% z#Fm@5^4}JLsb@|teL9{g7AeGO(7V+psK@J9@@EIt>H8jS^UC&dA#YUh%TfqMAP{(V zPH$k=k8)At3Lk*tJ-m<e7LjLwVBEmUwkVL>+O7ude(zh+V*tO(Yxs$Ki4&>dhbfuD zW4CwN!kk!~INr{-0|Kvr02X_H2qN#vUnB#2;G$bwE>*BYlW9~rKj5jz&O}qq=t*b{ zn#ql#hmIM=@AO~#k`D!W?vNkT2j|ze?+#Eg5kApW|5qLXuU7Hml`i`VL1dy_5|o!U zc%gwn*w{(N<ozQcQM&RmHs}%HKW#3}=sl~f*ijz(Vf>X??gmXFkN^iqdtjdcz^Cq0 zTYfm)Z<#~e>@SfVm8k1HYr7o(QsfhSH^RY)S+4Jw!*U6OcU3(tX=I)r2eUIu2I$Qj z@d}N0{S&G1ti=lXMH$;!lI>?f9?&2^y6llU^il6<mI&V{7-gj$IClte?^`pxP5)CV z>cV}q+H>gh^+0gKXy3lFDB!}B-C5%E(z$Cj{G~$Pl&ffXaE$v1m%Pge@XH`qj;CId z7;ZnQDLv0<;i(G|uYFKae$L}i!AYd7>lOHy2Ay<yQ)?8UEMldAe{-v;n!7#{00G06 ziO*`jN*Jp~qK=3|wHqt%=nU0`?d(+p=Z$O?`e^)ao<seGbDW|hl#45cF!sZow(@aC z@4xkqO3dq(&}%P&=o4Ik(hoXNi~xWF@U&A6XH#+%RjT>3K1Gvx&n<1Ppohu(i7y|v zd&Eiy)2LjP^Qw1~1IB6`dTczi7x7w+%o8;py6}Jhpl2*Ci;YF91{>RY!t(&z1^suE zT@f=BC;w4B5q~;Qmqvcjm1LB0d09^6eaTT&=qq>XbTPHvpDNR{ZNKPdJ|x4-KN=lX z-5+)D62%-i5;A$G$XHji2ore%jqdt<LAq<C$)C)RqUcke`f_;&0@82vDf*$jj;o!I zcmT(aD5-t>OK3}~10hj^ti>|u8*`>)jGZ|NHLpP>2Z5XeKyEyIH1^tYp;JPYWn$1n z6P38|4Gj543EVM$|JGfZ@<^lcZO4rOoaP6Gv--+KDVzMCob{D!6WzFYM+s43{ZZ#V zDes%`N4#ez76vl%EmxUyzY|0**wQLuiRZd+83K`VBZ&2}HI``+qE(+j+fl_bVjjbi zKUwB^<BZ<b+7aDL=~|w-UhMb(?7Z1W1%Oud=!@ssaL-q!RypL3yz-M-ONW3*E76r- zJJ>gwc~y_0Px3&Zz<u(e;kxllf43Cz?}O6+q6OXuZIjL2&9%2LKdvwF9P^OwW+#V) z0f42HNA*VsHR3EOTb>XN>;*eb0j4ae+HKYA8g8+qIm|+am<`^nza~%@AP@%IE<O{C zcI2Lw2HyW<zo`|N*QZ452p4X#KQUqG`VaUY01Ohc?y+B<+8ZA+q{ATXEB;D_xW*6I zou)2I#zT7bE3aqY=d*rx1n{B%@Zu^xZew|Jz?ebLZWJz1fah0`7e)ja`|a?YEQEA- zH6wo2^3*SO;2jIa*`p|f`s3?O336NBWvQ%x|BxVs*Ox00Kt16GiZwzmvig1C8Nat$ zKCr-(+J$JgLG~J)AT9q{6xJ<LmM(+3_?B>zs=r1dR0s3F9pq`BO>goODmbRk2W7l2 zInE3GXdoab%4oQ;t9sw>W>Acz0|gP7%qIN5U)P3uUmlH*FlbB$f!uKN^&^sJ_8N)s zdhX4QdkdPH?EUo?{HixTC{Hm~KxIs4|5UH5S|oFl?D_VMgZJQq%llWcUG<Atjx@ip z9kSSg`;-}4je^6Fxm=&;#=`H(<8}95um>Z#i36gMA!RHbky&Bj2v<}o^#3@z@_4A; z?|<%{#n{Kbg^@%hltPIasZ=T|NhKqx6rqg@GnecX?OHxesq~?;CHkahh$xD7vdo~O zY-1nH^1I*P>*Y0ndGXx2&-0vf-pe@*-cg%yGI4VpQjQ4TC465pBe!a5MQmTMax2|o z^1uV`o;OPCKSOSXrUhp+Va^BQl}2WC;X`yFwSKhr*gtj{p)2VIUT-d#ED^KkUqk-g zBYU_K$S#^}C2=$f{11KlPh5CVhVS^E8QZ?@$e_uBW!>chdk|h0=Izyz9{FeX2jK+) zc2quQtc7m<xE&hrQ9|Kv@<cU5izd*Adj-DY?ekNWqqN-!-{(nNdh5JHR-B_D4D7z~ zcxm~MZ8T@)@RjyK??mo<&`}khpVAN2k*ZZ|B73#0JC~+-ih{@;Q!ni!=F^FoZ)3%@ zYR{N2j>(td*vnGjb$u~hDG4UQq10JsGTYVNR-iE0dG6J=y<-w_k2@DIeggmfQufu{ zvxe}{2>tI`?-0{V5s_jE2T_;JHu(B@!NYgoe6IN&lx4H}S<dw)n|N5n#Po>a3!0;f zHTxQR@LGhK({3B0+Wz?mf?EN25{R<x*7dYx80R(tP0&qSl6A!6V@A?{CZp8v0G1l~ z%V8_k4|r&fSZ6(vzO`80YFsO`ZYH0W>*j9EW4kxVj5j@o124l~zt@{xANw_xJK@a@ zFGU2C^6ZYgd<1kl0Ud2PvAt1us^G%!>R7fv?@g)tu?^xEkH0B@7ybzC>nBAjIv}8h zhNJ!y`!JyCsH%aOd?$lC`iVPEY~Bo_va9acfM+&GPPcx3wao@<Wo%)NYr9mV>Un*K zm(`~ev3aK!sIMA*OHF2B2M(U2BJaDHMJvRnZs>tYHhLM-01iJy=g<d=JEVC8ETYAn zk1JPHqV2Csg4^*aLY5#rk-=@PE?iaQ2%b8`P4_pNaDF^Ariy`BR>i2z#}>8PRsR0a z&|xUtKg~SzZEx4NSI4`pH^*g_;kE7g^_eeY?RY;<8qaFg$aIpGDAUg{qB^@>-lpL? z@#vz(py!67quu*|)jcs8owc&OJNAB0gdH`}p=s@KXW*S>%;d?UImu!Z;Hf3cMxv9o zephQw2m08G{%M^fsjBz)&e8S95sV_jF8q`CYV$N-1%wYhH1JD%Dz{>=Dm$3|vL_ z4~?!uR)6PiIcUeQ014I8fOcAu{Pm{d;6Bc`e9VAN7oP2p``&rJ<9+Nx6HZrCK%XRM zc-^_H2!ni-G;qkhC$d!$Cs0^+8zFo&C~GN8oPE?{HrN2E+QR^9f3I5E1*cy<gh%Q% z6si?acbBdeF460gW-4iB^uz{J+1LJYG5@(YVpGAHsFn?Ld7~$2Vhicmf1>>)hSMmH z#OI0*34*!RB0im|R5}dMGRr(S%GPG^j)<G)tQfo<wjF5QmqhzD4M<SFqQ~R;Jn@4a z{~1C!0sWn4W#Y4=OKr|+dE)t4{EF~@RPje3%5<d$otB?Ne9`A4zRx?S>VKdl>1DMY z=z<zhiSuBfQ7KNu&sE@QUzsjbVCYd=w$oq_aay-fCAlKjp{bTU_Z90-oJnE-=XS>5 z?MuV)(pzt3O$hyb`>(CzBbL^{laG#8qCdd(J=kjpV5|zF&fb=Xr3xTciIH&$5KW-^ zsI|$C+eokLBv#$l)%X%`98Ef{BHEOW9DIm2i|AfdY5kL^y68~af0bllPfh=$z_o8> z-H=S<Pu4Xk5udcLQ6?_ZY1n;QUj955m&oJYcgGX;P~Asz#G4~w1=`TE^$k+qwZE0z zlJjdPIkNlpm)Yy<ct>~7yh-R#K_hws6^PbVm<p_;_^$}M*lQZ|omv}x?>l{Q9P`l7 zI@XQnC!}T(y}wV~&ABLYjYjWCD0eePkP?}yP^t+63c#$`t=WEs_I>s;R~mTkVf-1% zowg3sX5Xe}4H8C-@7AY{a5wA995E(+f4*)w-6iK=1uPi5MSyNbhDILuvpZ`+A#hB^ z->Qd&L0j-0cn%9NgK+%|v?_vyP@9}jjy<7MLqAZwx5$XvcSIQ|MVptXh*ajIEH%Ks zVn>6_n@?;)AU)>e82!!EL4c2LBYC{F$F_|>Mi|6-<rg~}R^PKHeH1wom^q{uublo` zv(EEhlEEKfz<pe0R;l_Cf@!i5SUTGa)W9U#Oi*@nEqxPnJA$=~GoR~hq6)XB%OvK+ zCz2RdJkyuRTu~)c__<y@tJGZxjQoEAy9FAq6Up>9WjfHTCe1IAsK99^$=}aymqXA> zYJ~#f)UBMZ<q<pn{AOIGQb)8v@W9*M7?M{$MYLVSIvfSz$R7&A(@Q5kSUb%=5m5v1 zBHGXf;T89d;UJ6AQ>CS;F3r@NqF~@DtP0&S_hoP0ThIOZXl;V0sI9blqWrnv<f%z3 zQ%E*}cD$ech;_|H@1bp)YbM$2ey_4>_WA2pOkb8lm#tc(g)URbo)@>f0AdJrPiyk7 zOC}v^qy{xIZno++napWi7I{a;_6g7(&;b8NY16@(e@Wpj@k<!DyWIBGvHgDxSX8Ww z<mvj{7j92(h*1nhF@6o7Ud^0F8kPOVn}+~P3v(a)tV4a|ds>b>!H6xr7CUR>sZE?a zks>=?)A~MkYaK0fQXtA8Kt)lc^g01UCZ#NEgtzZ_X3Ux8@140R$47MTpm2eFFhD#y z5PM#YiufBZgcS(<GQkKK8Tsf;2Huu~tL&7elXK^gp(0iRW^WQrJ1v`}?39iJ^mEN@ z^pLZzY<=avpBd<Tw$IFUz}`4(o?al`r7uyuB;3yXequwXzC-qFwJMspiFDYS;nFzO zGr^VBPRpj@xoqb?ahU4N{{nvw34{Z(ljJD8zrc58ZJCw2thH$0i7R%8Zt6Z+D_-JD zxbc{bU?;kaPi+<LwH~{*mU&(UDt41j!%<A`(GQ`5dL<Ff*vA?Abx8PQW%&;qpUum8 zDDjm&0-^aw5h@6rv45Sjh!wB5*}4ui^veOV-GAVBcTTn*9^$o~_=B6VtO?`!<U9IC zOM$U~*aw`|yd_x!878~5$)|^Df~kaN+0@{f<d_%*u=!qB%1+KX6xEvd69;QNG*D<x zHwVUlvf_K})nLP$m2_7#t&aE(r=c<Wiw7mSy!|p6-$kqjo?p~pTQj-E`j6}c)ZZ$V z`54~-JPBH(Pk{xN)7MkE4hAVxc?CM`^jqEt*uRr}eKFI~G<kFlex+sa0HZb6);BM5 zvlZ}4Vw(MR!zri^E^lew@p}0)lK!pqwS=yJj?^-1w8v+@8<SfKQv4<(?z)X3fmL$; z+N?5V&JEa1%dGtie@(>EIGWc8)Wwg{pDtk;JuWe*)!*0+!W`?kx7<~K57eHqkkD0% znAyaZ>u$*8SUb3m@y)3R(=#e+Rf*1y=VT)Q)#AwcHO$cQ*8@2}kawNz6*BgmUugCc zgr_zkldBg`(eKJUW@UN9nTW8S2sg5(X;j|Y1>kE(g(nlA*qp$GpV`N+eYzto2$h6# z35=IGC!{9D4>tk!<$-`auL2=YfJ=;x=OjOTuio6sCvzta$o=HlH)i{bo2ON-_7<qg zXs>Hs_E7taO(r8sG8VVH8uOe`Z2LIkKmrn4v^+B*f9j){+OTajL=Mpg9JCC-VT3Z) z5MXLg8<##Lk@ij-d2gC53X`uFBj~Gnvt^_7H;1TEhoud<A5{_z3*afNPoLNTSaFI{ zsBHVI`G;g9!FslkJUmN!Bc+0r@B=KQ{Q**$&n6|@9Db-w9&$xFpZ<wuX@NdYCyzAk zKVux}g16c?0}E5Bt{N9*6ezN_?iM=Zsg1yyXjAxlkwv%$`R^lzli%fG`dvX{@TA<b zpUcnL%Y_%@5HUmQq~S8jzLp7Tg6Q*K|MpQG<zlmO1b}nH5E1nD<`UtszRb3|HoIL8 zex1!n({QX~LiL2ybA{?QGafGA(sqU~OElRiv~vmw*sOi1bhKh>8v%33lBvgdNo98d z`zyZwQkv_-z4qtw!?eZN@d4}oouh92wnK_gF(n(ePLd}E$>@zT<JB^*=cj)A3$lL} zLgx8vz|&fDJ*k_oeC#zs3tS}q1)Mn1tTr@uGnvo%hF#1tZ_$El_=Em!doeB7L2W#| zOhHK>$8UI;<K+dy-3wQ8S9oq;?tceIa$=hv9QFNnPVePtWy$Wi#JG$x$>@oAV!K>X zqB8)dY(tt0n#YWRGW!g}o*qP%n&tOB$Bi#1!;CNS32DxB7E80oJpQYhOVsfMn^d~g zAyDk#a{b(tXoWta27y|<7&!eUYPxL>K%k5WBYt?U;0+uMs6D_S)AdrqQ*earbJ&m3 z@8-aHD$cm`Ugr7&nUWQHj7r(h0%w^yYbTo!+I~F2>orQD>&u?pdmiR-N_MM;9T`#N zJu+no6}Kk75B)9NEDF|+F?+BQ1Xi#nAHmi^+#W_VLwEgiIrtWwxHm{qaHPvhwU&M7 zQ)xl_!jnYgs4?#(JxX~UZ|X89&Dz{&WRP$z$KYEHUkN#`*K8Ejg?OP}BXsqzn9~cM zA<|-(^e;hS&Yh%Z$TPTdkueN{ri`=J4lrI+nBuokhR-2a00(I#QFiX8Xpsv0b)T_R z^<UtmaF@gFxbL{-Qhx?#o|AversJ{JfyjW1l08>sPUpZx+M8d>w~^+hu#5agrnJE8 z-Au#t*@mmL5^Hf{(kVIcC1FWtD8DUl668W5_Jr<3eWLFI#p@_zf+hg;NhJop_DaWk ze(D`m1mW#(4-ljA(nvg!Z5T0{Jh0^5E34X;x79JbDS;%!hvcB%fL*A4#&u2m$Z!YD zQbv1oCsyfPK+=ceW9EQB;w;$kFI#sH$a0a%U&pAxDV#Tp$D4y((-ob02%|+E!slX# zWHFOKdnaSAkr`*e;tW~JZ<*?YS}A*<sG;s>Q!jU&H-c%*4&-!Wb<?qmgK*+^n2+@J zu!}2pQO!+u#CkTkt2^yy$?_6bWIX@y4esh^VOn@Dr~_8F@e`9NAXB~iO&;oyH^~yy zLd8zJ{)No<U3XS8csnQ$*NGRE5#~XN>mTD`v=TdvUDnx7gdF}liu$unkg5IFPi5I} zA7K3PW*|_ExKrvaSU`mI%70NBK5q4pYM^W{GbbUG6{G$Wk1%1oq%ztCiKc%9J%@6s zwa^j-+l&^p*!^P5L#?^V59yT0=?pSYb4bSK)hU|6!*1(b8VD?YFgJ(~_!@uNr&M!{ z-a1zJw4+G{ZYyw;3l0*n(nm5odG7nyK5YL;;N35;ole?2l*)DV7id$xlnG@!NdN7{ z2d$Mx5q>dv8}?w?dK9F?YSrg$cmcVX(mXAo$wBg0IRr50XNt0yO#a%|ux5p36}cO` z!Ex)5&>8_vu@4rFL~*W<T4C9ev8i41ARstw6xzWP$}?P&v+9hAbaY;pOs__EsJ@1s zoutO|$xwl<Dv&pVL|pm_*u^E+WnZOqUEQVmL5o^t#mR9Lv1qoMIy+pxf8hI1yo8X| zY}23@i(L&Ns5VR<gvH!PCq{Pm9H(oa4A~ev;B00uId<pz6Sm(_T{=^P#aZ)ssxbN` zd8Dr1UJ?Gjoheu}wKG_F!b5buK!Y{?zkDhRJmdYh+`Zu`aMPvA689cGTHW9OrnT$N zOg_^649=pdWnP5lL2G69wb&=D`o8i*)yqg&tg+)`^1U9@5VNHeXm0X0-8b3auwn90 zyBt;*^K%g2w<QWis=G6FApBlB;jX<>9^omra7i5UOim>rdMDN>Ee%AKKB_zAqq+#M zt@lIHv|w6~;yBbJi;tDV7~@Uh@|ixwlXGii79Sd9atpyfn6ZWEb5Isj$+vbLpQJaA z<4ExG)ry!fN*e*Yp|NRM913R?A>4DaJUzzgiOC0((bFGxzA?&}TSFS33~Suw{6w_e zK)PPE-z9h21HtrbWCz=7UG={LMlY5ANZ|fm%Ko>n;3EQ&HS_^5v4Nue5aROK#^1-; z%ZT`22MK$7qG0*!&N9-v9n`)Ep^|GZ|4i#6mbW2c*&DlS!aq^G>j@Xwr|zkm#6}?P z`wdD>Ll&>B_d}pQfx)M3`AuF9yjeJ0t5IY=jQY#?m6{fI90CMYS3P>ao^xCW>g3dj zI1#b@rvsG|qt+m{m>Cr{?Lui#%5HDX$^72|I6K)yx?w!~_Mzk~0xhNVB?!Edkr+Mf zS~72O->fOzJB(2IhBQR5Mos1_I$g*bDNk45msE0oq4dou?z(dBlDP2`c$al{`rTXX z@+}B&!?&DCi~g|NLXWR=#rTmg9#=i~%MMRN$nO)8wtU9NL9R}_nZKW{FP-9bK)o`t zf<bHf)D!gs*FK`5=2FdhGcFCrpWn?E+aO>?JZszPF$>OggZo=~9vL<F0M@LG?T?+l z!+E-%l2KDeZ~Uve$r+9y6mUR0uH4O8vequZS5av&z97+$Y&j2IuxjQURfyCuKgfFV zUk`<!t+LpxX?l9v06o=A;#~YV!%gMA(nsgbqKvYS3>6aBrOgH9sVB?Sb)mc#;iMn_ zqN;-$dh!D~w|lthBDtXK&o@N<cP7REq|lqB{Zv{1(d$h?-YB-wjNPjuJHCsnn!vx& zw>>#2LJt0_%P7fgVhz3ec2W+H!=i;F#8BEQHIg66;-!6a@)5@U9=v_hOjaviTPWO_ z5}gY%wX5&ktV{*X-%0<HgumW8#U(#IJ}2me_8UT1@aVE|zfH)TG*cJ770R@Qgc3eG z&{nG`jEJR0+kQZe>j(>0Nym_#kTybZmv~e^0p6W~3AYIcwbqq-<LgDUSGT_GR5uma z+eo`+_-wZJ!3Kcgx)GG~O2#B%$0gEt-PUW2Y){jc*ir_r67cv{$z`q>E8H$F9ygx! z_xk;5@DlgdF0MgOw2>k=Iw%r2Z_3M;r?B^%RBfgSspM^b62q$gM~dAK<`9=X)EE5x z621fc+tq!@C=Z{VdKrSJqFV9LL}*qZ!ZI{ezlNRsPUaY3z?nm8Om(=#+|Hv})BFoJ zB`@Ti+0J}4-OBhI@?bdenG8=GUsd`^>#lMMWT;>FwRY7UI4*Q*nag_#D{3Y9ooNp& zIS|=qsg4kZZ)!3u31nWh*E1zi;i-_DWA=xJleRQSh1Z`e2E4LPH@J$>IKZf=6xIE; zn#HI1`~sd~ZqD~#(l?6S4db<hn|BFNmck}>ljC+6yeATjtFd00RIpsfDgisf;JrA) zSV3ud^LCNrh|YY5Ikm`C8$G&d;^S)0dpQXaxUbGowj=v}#fK8FOz;Tz_p|5!kI#?N z!V}G|b{*^8_0rb>_D>P&ZnzK4c>vZ^ITny<I%a%@5wsf1kuFCW#(bITh+4if1spHa z55LIp(1Oe~mgl3$km_Ac#uV!n13u!&UkjK-OysXOqPoMWCv5AaYScvJVKN*tV^5W` z>>DIy^0JeUtN94_Bc5x}U8&tQrLA5`j{C8XqeN+EoW#8??~Ty*BZ?J#^&%3iZ&c#< z5^+N4(`SEl&WqQ$;Oe6lW}UVqLKqacQF{Lc%q%uxuq5jd?9zS4Itz!XuZp@rizZXU z^?yAPhs<3+b$;x`zE|26fuD_yTN^eKXkMTazcurX+@ZB!VIf-QZ+Qj6i81UDWWb}N z%QoYqpX+j@t7?n5e67P$@jjA&Xw5~@iAc5&{wn2uU+fxw(dHyO4uUOj`7e&M%VJpO z)y%v;JnZIG4;$$|B`W<in2xM?XCinfPh6I-?}^LT0&uqW#xT0xhqI*0r`ZT<*70`Y zitvfO=@PNsn-ULm_ZsF=LY4_*@8tGRXr?1FKI}d{S{tqX(jYNi`~bTQZ>hLOeEX7y zFfyD%1>trK$V?cfXZJ>37&(z%-J>@7-M;53F=$L`coTRVFxOho)A|3*4Bn^Da~$Do z$N9Y-%#g5&*h_VL?$zfR*2irgiSOt1rgjalqp)3*{ZNK&4Zq+x`&<Ik`KcrLFPiyi zm8@A~Mzmd5v$Kn&`Gr7GVF>Q-Viy8>ChsdYLEcH&NW&sPX*5~&yYmWcQEZi55ph3O zp)Pt|Am@cR?8+)3Voz5o1QHO@v2`CLb($Kq`S%_!D2}~S$ZXGi8EI^OZl^wASvfUw z4~KIu-p6MW&#MW9X#)A_UPL6(1T+anot=yiu$eal*ikDQJL5!LgV~FN78;<3!wQx~ zdhl#>S5UjPHcgfBZ!Ukec!vf@|E4iEB`MHkTTbLveh@tdj`R|HP=!rblwGpz8V0OP z;2K8X9bd6fE2cd6hG(;vZbf3>kx9ON<(BQg7NW0W!InBNu>pl0=p%rIFB(1*27dXd zI<i)Nc(vF$(AaOw^>*BlKODJM3*4mPll;GA?5}dODoWb6cqC2^`p^;XCCE(TZDlN8 zb1-8U_s&9Ce6HFzxllb(8<n=t!Fa~Fn3yD3v<a=eFOM0wTIqs2Fht0tA<DSFi+#Ip z9u)cX?LYPDduSdvMA<=8=AN8zP}1?y^08{E^vH}jl*0WS!hZWKWLBs!H$W%tf@y$3 z*xrnw9V2g6ZlkVE9;RNW+EW|f3k_%$B%&3@Xz^GHg>96YwVw-+yE)dTd+lDR?vBGc z{IJCjjY3un4*Q={hbg4*H+??|=y^nq%7ABXSU}=8p7NS|_a7S9a2FY?`rdiC{~*5o z8l~@NWu<>n+CcCAMF@_clwTewEFAi{ghs@!rsT9_lVOh0PZeYw=3G%@r|->6W5w^` zpMBI+*=6lJyfx>9_4}9$i{M1=^`SIw<Suq;JpUDQkJMzympZVv)@kIp)y=To%WfiM zoR{JsObR&G{QPSR=Q|Zc&yUS4T`wr+XE1g8*$b4ajZUswUX*|*-4|~T5mb2|UsOcO zHOBayWkKYlA5cs!JEz(;b=4GeduIjduEna1WVR^DJDRX{IPQ{+bZ{ogwz;Ryv3~As zZ*J__$*^{?Sb8?gh=HH-D>5}WUW(tE!8S;d@e&lu)Oj|^k=G&{lDQgSb7dmo1ye_Y zy~Mk2jnqk5#aksYIHnO;?9mV?QSp^bD00j1@-2$lpAUYdSUfCWDWDQxmB$$+cOYw% z`_JYhJ32IYy*SIQj#7wg>_T6voUU(ep*>Mf9PWtUfZ5x~V^;weT-0pFE)`(KHs|Gr zs^ayGM&IWCX<8WYlT;DAkrABAMTmD}dXs|2H3B^Dv(0AdDHD22W!sN>Fsz@dCbkTx z&4EcCF7GW`Qo9oxZlM-Z2j|o9l^mabyqo)2L9*##_ci*TA-8~14fgK8+dFn}AB;~K zmVqV+OMVXHv#0$p@Qtg76Z#_KI~{F;{7&(H^IOj>I<op-kN*W5{p^lCJ62<ra{eUP z_NDj|_L(5+?^40a_ecJ#j3;O(S?i<2GQE+o4;O+OVv7bdlcZct@$Gh^g*kFpvU9qP zCLJC0WMHk5ob5G!dzIpIdYiwhn#OXiJLQadM9*({!LqFKJJ61t66ZB-6Gg^{_d7|u z^0g&Chot8|Y?L|o4eumC=yh>N{Y=Ngsi+0w_i8ch6iKjZkDZH)(^0$&<6!>RQ&oK$ z;U)GQJ4#DxVhBz{V`mIFTEO9i1z?=8MwPLgymWLfM90|WBfJZjCJJKh(UP|=>ayHz z#yI%#UA25r83Zr%V00_1%Gx70Zk??$%1e3<v;7Tf`QSgyRttk5Q|#{+#QDhjPGr?W zqDc(AnBTSYkR(`*edftWtNwB-n>jx94~p$HldU@-nNVPxmd4nVxI5Oq)WYvg8_exe z==t@1&ao*5_Pf#3Skl}D*$0Fy#WhiiH5IFf#J3ur0jTCq<hdxRm7MHAX1!Xx4&nD$ z(16z}#-Z+}(;AFWof^AX6tbuXe+va3^&!N{f4U22(V1=D=Gb!EoNdbZzSc`;v(HVl z)5}j1*Bc^U>?fa`sXG!(7Z!Xu-qG}7By3g39v5*KEtR@>;<~)`wT5+R?2cVrLRaL{ z58oe#@E3m^POfANc$;bAKq%iRejI~pe4p?li1a$C2c(CI$YVpBZQJApG`#(DVnZjD zm$N7V&*7c|c69?wgJWaA9)!Q9E4pqAFZkM8c89AhY|h*?v~}*rQt9>C@?Bzg8ZTgh zr}tqJ$6nCZgR7mxnyR%;u{SyHdyw4G`M|ZS7``b|)zy~ZGsrPhL*2Hw7lWx1uL5aD z7Q%ap-}Ae;dt#)2H%cZbT<%)Ffy?>j3&ipy9E?(?wC^6VPKcEk%5U=hh9ZA-<v?#Y zt}FNVi3KWaRa?J5llNc)t^+Nq%mAvMAQ#JxtP<E)vto1(a2Z!lD~9J_DEK;Bd|(IV zl`B0XY=ZFh=Ggh9IO)W)MyVkPbdC~*ZbylpPUe>7sCG?4mFvjF-s?5|;~!O1xX-3! z>a4=`1+te9!Lv|g@7N!<xhry~aL>*b2|?aD4ynv+nQ*=JvdVTI+H`sB$ZqsckWV~7 z-}B2l&<1yxVpNVdp=c8`^aO2EY%hrFdl?VQCO>|V(e^~?23niX2xi?{^Ki@R^n2HQ zYRHWTit`}w4hd_(CIey%B4!=e0`3pMx;@l>-H6&!!_8Lyq$enRi##Jjk%}|ss*5x( z1fIFl*|L1zMF8>2;es#L($QoOd1#FP&=vI}tbw0KgfMsM#39Mh)O3f2^k6D0N-?HK zz}rg;A0PfXdek75J40@|8j1%X`>QmXp`jNIFX(9Rg5G?tr3V6{j0%nLl=CU#nbXVv zGPnLbwtKmM{A1UzUA1fIds5?9Kqaew(q9vAq<PqC4LEF6dE3d}gYwQS0E^tXxkX}G z81;}%5BKD-M@aCfd4v*VZjA)W2;Ga-d527nS$<IF&7kd-ncCB&wf|`M4?CVAeB?e_ zEB@z-_+{fv@bK98h2n{WvqQ<Ra%!YI&b{{V6dXGs5GQ@OrGW0Go;f|_+qRl<JbjJc zdCWk##2W&a^OT@XfhdThwW_pSP&If%ELR5J{{07&%TdA9283F9+Y1Dn*ATF$x94Wc zB?)4@S15hC0O2=MZq_hU?JDaMoN-$06J*`$a>wk3`1|xw*ghGC4_7VNmZMwRyq0-^ z<h@8r{Z9S2O+0m%!02(8`dyoqn20CRShn~g)7*0J@DAvTIxj}g+Mkx*qggGQM(s3m z6R%-=&9D+yv0Q?ID9()PxlKO#SaM4`vGvvlA+kw@3jTAP6ZwwwcPsx5GSNjxLSi25 z#eHjYGER~_uSwsd7hZ~MFf!cQ9w3MLpz}(j<dqJN@QYh#l9+Ak#Yau0Gk=-qM0r2D zh7$-_TletZZ_Iz&ndeLSh1GmY75i&q*G`(J^zprw>chIkxzt|rWuxR*WJDk0m47pA zi4X0G&2xgvZG!gfr37}8utTvrrUSjTx(&{^?%u#tvDd<2Q?O{0RUe(uiLhxXpM1;0 z0ikq5Tvf(hMTn*@CcxY=ercA3zqN+>=E924Ir0nTu#*sUovTBYxR=*(aW&Fd2`g-7 z_Pn~}Ldz^c$u|L6#nJpze^%M(L7%^UO=PkGrSG%qF2G4>$YJb$irCncMwYB>3D@?q zB+SfAnmGDpeX64zyM!~QZVI+2)R1|T)3eSSReqcFePXh#Y7|Bg{prhFsh;6Cm4bj{ zg)9YZ!ED_nS@vcwyFnXHem4GZ=J14dV|;fiQ^6+osRk^|=QG2;vD@PLidDmuv$h<L zm2O2`-_ZIq9kg&4z|;)pdO$TKhEksv5<^^4vhyJbeN?pElY~uOo>|K2Zjhf;n~&TR z-EyO-1|UZ~(gxYG;m)Ic1iFo!vlW>Kd&z$m3RnS|Due?FE`@YZ`-(M<y)k192g!Tl zfSX;6OoAWf_Nnq46Wq|8Z8!Bm-)FSYwm&ReIO{fUusGeip{Bsi_DOBSM()luLab;i zT;=1}i(xx~^AH~bCvRh^RNVnKpUn61l#mj2nzh2UbGU&0O0@zn&^pSb9C@Yt9k(+d zN#YF@jS$11%E$|m^1{Ir>Vy3Y8<nEzTM~Vojcjg84ibonc|bzg3gDSBW&;%c7hjMW zwteExnNVywI`txi4#EfgVg4iTvFhOmefGNr9h#@Cb3bC9=1T3AL*ug@j{|QaP#t=h zTBvZv8~yau(ci0p$T5faQEj&8$Q0Uk4q#Jw@s0vRW!Yfct-~l-P8UQGM9#=7cVIhd z5d9qm>Ye-x3q4s@l~B!&xlJjl9)N~7kD{g)!q3{N^^my-b|P@x6RE$2F!n5%^DwME z?7_)zIlGZ!|62%VFOiOR^B+CpdsOr1e8gP{Ogocyj9|>eQ-ccA)+YqU5xi=4ozy^W zUz-iWshFZ8N?(-Xs_XO4lTip+Lv9(>l!HpGv0r=BSGVZ~Em@ZwNs16YQ3}e?BhpeA zw`tcmCB1MFTPtRE72Jq<gZ@wFFlW)%*zV7GT-PZkh3hSXr=;e)<Ejr<-)^gkX?RhL z+5OFPlwOUI3X?X=#e~NcieJ|i-k22kn_~o>K>}!8|5eLB!{ugQ;_lhSeesKB9nUR} zW2QB8Lq>uQ)^e)(gOSO2@oE6cxbmPTv5H{h7jc4Ch8{d!zz9`dmPjHBq8f+xDP>0B zW%r{^6KWtB<#>eUE>lQueRW@y)^cG)vNWnVR-NLIKFRFe^PWcOX2w^1tYIQpB?@i< z!AutfOE-h~mRnKmfJHsWmBSDJVTai@syYc)y4`G03O7xn%qS)re?KdJyU!48YOL62 zx-xD-*#a!U5yfmvb7rmBvICN@itLxIEL$RfaaGKc;iEXW)J{f!4eM-_7AIWT6eXHN zfc5gQzSeDd7az;`>b&YE;i$F3%6PbK!%>X&Br)JLvLAD_**rPcut5d7gEDv2lU!PL zhhED2lo5O`WXSvd6nARZo4a0&UK&m6_84Mq7T3Pzr*C*#Y#6@ub77Us2QNJV*fg@V zp-AB}M5%RvMWK9m?|M%QQQNz_#_Fsy+S_WhFM1cXml$_QtjlF(CQxA_{k2g#6exK- zU)-7YN~3tHplBA+)CZzY;mTcX0{G(skatoFcy{L*pq?a~S=8>>W}ER}hOUfDim&wl z%wrndj{8=H_wxH6{uyT;%iR1~eXcJ#&>VLr<-hsN({ufGb6B6(ltC-;S0`H3&km^? z%*^73jNUWLrp;W$2o&+HYv~4Mb^`}CJz<|X%tU#Ik7M9}bQ=Q6ag)KW{}L&Gu?w<s zgN?FV&DxpW8H}Q}aeiCG=Zo7CL2#qBspk>bFoA!xDs1`1FyfpFBGLYTYd1wWX#_~Z zCWwJE)cd$6jOM3@hTj*SowNVSPOUZmJCL<3Lq-5e6-B_()eHm3hZmk^7C4X!l(wg* z*M}IyFSILDY3Atm{C8@ew;X}!J2-uRarkYe2LPcJqJF?0a5YRmCD}oEkiNwB9GWU) z-XUcsEUdb<m54cp;G1mIjRTA*lsLYSSG3OS#n%-2x>tMs9QyJ6%zpOyd}$eOebJKs zPGPzAy-bMP$Y_2$6N4hfYV%F}4c`eV$R{0tc_iQj$B-C4Ql5l;8E|@ra=)jgI8SCT zgdQ)X#Y5$KyIRp+i+dNeKd2mjoH}lK<Ky8|Hb)F*zD0Dq@=b1z4d-W45>2cS&`rcE zgRyh%Uk=H^T^T#zCV1K-cSY{tqaF#9?}M?;T)WjSTc($^4<!9&%v-o?%dtz6{%&I& zf?w~5Fv_}_!CZdfE-pWwyUmzuDte!Q%GqQN*B|TQ3vaAl?POd1jU&!5i9x)nxXUww z>QBV*&J(eog>hZN+Mf_*u7ZAa0)Pd7_dFQmT^Uhq+AXh%)rT!Olrj=0K(fA%@S0Wh zznL&@6)hG%*vEdD_tyXWhNV97{`k=*LU_Binty^rWzr{c@!aNRV|0T+Iodmsb3rQG zi;re)1;OxX`S52scsL$F;paPGxJ=Bce+kVyTa)NE;+F?@V0=n=mgF@P6<4|a=v|BN zkCh{lFZjdPM6)iU4sFRbO|e^P+1fP3MNij(-TE)OZ2aigyQdcHLGdS2j*XyVT10gg zq-uuhq#t9)dXv_N;~5si9fw_PugJKSXX;gYhg%O$-@*sjZby#<LnJY1icq6fwb!Qj z(C<V}K95kgENxxYdYM^#`TVNVz;FZv`n9roTNQw$-sR`&&7_91HT~Pg<w;2BEFpZA zHg3Y!&w6_TbPw(VY%Pktundl*toJfddgCezd*`wi{jOqgjZ{0+;0;$k(c9ka$UI7d z%h#oUr=qS-%<d5tXi2WAoh*Fq#_&f7xU$^vaHuA<A38|kJTk29Bq9dy?%`=}#kwpz zQg<t#s4uAwoU~nI*%$+~<^o~x%bR@%6i-trt6(if1*+6>$4=aFljaAyW>*H0-44WX ztSA2P{Ug{+3WUcSoHR-Kkg@=wvMI~Hsa6c{oE2HLNcLHsK4zywbTvw*ACzq*(K4u* z9zB&i_csZFx{V|T%2N~9wWY{5c%eKS5(+~I4=>5wG4BSfPi#G<!4Vm|E}APx^DmF? zt0$s2MXp?uyJcJD_@`&MzDi`hpqpR$h|jKOruCIS=FRG=%&EqqpgN@%8z_pymSjKQ z&)~D14wp@9mawR@^Fdi+WHh<?!7lOI%+@)VYRi(4$s?6XAg~wWYCWibpL-*$=-xQj z)Cu_{bjwRP_w;O5j*`laXo8J0q?{lR_pR@;M;I!NLXi7T9SZuE=XPfm@RU>OUijpX z%r6MGQKkTznm{|3L)|-9S7e;I9VJ~B^<Fu~kcU00XM+^{@k^Dj0C&ZdOr`0bmV@>0 zmE%m7+%q754L-NzcBxX|3nW|)YV4w4IYoM;vfEHRr{!<l#r<B*bobyF25_5y3K!{m zVX+sic~MYNat@5z`{(6lKb4qo5X~rI2<27!Mk*Fb!27<FDUkg?86w_3^Vl+cDhX)L zJpK23j&`@zB1E@jpfFVR=h1%FQY2t9Oc^AWs#N@idYP<`w=PNX96XxW<guDhcTy?N z7^6vXd4d-dwX@RG*a6>g=e+T`8`kzsh+zGd>0k4CzE4lObBLhHB4V2nxUsam5apSO zS#F*r3xGMdYMA=esU@FvZpoglrBWJ&%CU|PH!tdjIzsq-so(hQty>fJ?jnQvGm9;R zo00f8Jl={mbvgn=@YT;@s?c!HtBP^YPq?7^g8@&JIyEn91GX3*L1nf8glTw}gjF-d zbsHm)khD*)UTL4sd`3NzcW&eaN{Vq6Ac3NXIk<{C^Vbd_LUQwtC)yOz^x+@`Fc%UQ z^N<3xq7gtCE~#7;zaT>{G2x04G<;;3d`YOm|I5$XfIB5XW35t@?WI88My<J~(x@#6 zb?IA^Tv2Z6r=J8YXb}Wm5q<X?jimR7#S87%j<>Dvb0QIj8G?KQavlYv114CBY^#YB zPX=vJjI||eA=<JLyB4Pa^zDj(_{SR~CA$faypW)c$~r$%6nH9!GmhB`5GzGg6;di^ zPLZHq5t|>S0!ko=`pQ1d%uXy^gn%AsR1B40*J5PtDBg+C=nem_os=!PXUo-w`eg6e zt0Lp9d_o_|AzM-75$D*5Po*{ODPwszMQT%y{r4%ZvTqB+fPj5XdoYldLnvh~mPmge z!a+gy_7c2Ou_r6EC&UIPe{i8)=X-|$N1gcSPL=`qdyb)0A~uUh>ck*K_y^?S<$xaW zdK2U)2WyE9&j0uu*jCnYw;nd3MypQ9?kJqUA-U)yw`p}oE4@#P?AN^3p&3l(ns7W$ zBQraI7ar;?8MVX}e*XHfsss-a4?Y@2s27vL^2Kmd;&Y)nE?(gAQW?p1(>H7*ZJ}}p z2#Rit+}vaF*j?*KPGuWaB1vH8_;i6VTf6P3A7VpbEbeCh)7tdn5mzgot9F;K7Ljp> zXQ*58hk?yPQ2+rBn7|xKFnQ$rb<*3?>W5ks^j3fZl*5yz&h5BZW_J9@P07rWRIT45 zKm0Rqi7jb72R*9bgpA{U<c4g$n(Xz8=LA|1K>8ya^x&Os7-Z)1M#P@Q`mlZlf~{WV zk79m%#rtP28oA?oPTa$->e~~H;9RRHjQZzaBNQ8728=I$VpYov!~>khLV3E_J}0%4 zu1}0qcO{SHalMi|?EHxLP>kKkdcSz;yQw%kaMrMj``9L&@G%yycU~jG7Zf?pWV|im z=&^QXJ{wE%#@ko`)dm1RtIFX^Gxh{+6`g_>n=<67H*CQzU$lebB-+rfpzHfRa?q(C z^T=gu85Nd6I)xNmq~rDKI}tv3{9vCkvWk=AX~P#O{hDkLXs%jV=6q?zm86<%E8~fN z#W>H(k>FHwfrB$oD&H+*QXMm=dyMdX@T*4V<7ITb+B|&jS&3%%iAN6pg|(JaA~Y*7 zdUBS*vo=kPh?B#zz2|E9?;r7x;;!_&vUc+>cUm8VaT)RddwkcKYdZ*tcSD>oIJk7b zzxtfK<FW^2h_>ggOrFh`2OAt;vvCDI<RdLvhjd63K>N=(4W$RqnQlnE2HBN$w9EgA zoGXt+VWyL(2>2H<52BwEpbN1OEaxV_loK#g>4ELuiqRM1eKd3hQx+f`#vLh_7vsxU zoBbp!F4;k458n=-HKhdIpc~37q|U-O;H1mS%wXAWaex2R_sbLIPlV-(yt=(gGD2LM zO>->Zb!O^U6nTnwYQU5qQo=`cwxdgOt!Zo5xu`%PzJGC%0FHFXA-Bwq#v+4WG2av* z5DUf0IjX-LJYR^=Lge7LA@mU}TFwCN^BdfwU^9E*?)@Z81*g(0{{+w!@GuLbut^c9 zMz9DRQYV7l<B$I~b3xGyLD$r!!b3@mYjKI@S$?Cz$kg_?+=!7WU(qev%zKRp>$}tb z0#xZFjkg>glF<2A%BoziOk5T<T}U%T)<FvmD6P1Za!s=~YPUF#K(6_i!#PD_$jieE zyi-~HV$dv@d5tT1rGaD!7w3G4YmO^0o|23$=b8A;lmiy+YuO#^%=MLjL||~O1gpnw z=kBk|=b7W(qHciyXWWzU8&K@)pM7c-(ny_|MUHRxsh@F#A}V`c!7~)|R+sHD6)Rf~ z^HnZRk(Kln2p?#i7pA|Kqdf7KvSYrjD~ONg&u>*omMp}7DD=cLt85O$feN@70Oc?h zOXM9@+ha$~yfE6feD=W^*`q8a2P%DCENi8(wCmnpJ$N|8R|}LW;zk%<LER0%Ni`+5 zG3~=#rvXj0e7Z}_M(ED~d}|93Y}L3c_^ZpZI$t-Xj!JqfmXd6a&LMm$VO<<_A1SX~ zrQ3rQE!X%KW!A#4Go=g5p4QL&()E{zdFy^0QSjeIfZlGtPifAJUF^pv#D0qG{Umzl z?~e`^4-xVc+R7;O2mz!6`Rb_mWt#NZaw@!0zKs06fL$RY>M#=mm@DrA3XTV8j5cvz zWz%lrX1RHIH-alTwz!#%<rpQsGKJ{Wsf!}K<flPG$6XR*kBot%!QIH~K+Fu65nY^{ z@5*Cm;kXA8>bCYs;Ke|WomFkz&9>w2m2TI$NA3!i1U5?d8I?+a=QvXMWq4};H@-#J zFy)mjma~Bt-g$BCFJHJ~ha%Ck?mgIS*omu4LrlO4q4w*;cne@E$YB%d&kdzQLgv4! zyW#I#j#4e&i1qGTSjUsxbAm6G@}93^qBR@YHwRx7qnHK}c1e>Q>~_K?;O&9=BYBHr z_gU;uR*vnivnj2U$7D4N;FmTp8!*$?@?ESSQyzJVo4dKL59n4ihqs4Z|1cYz%kEa7 z6~fbxx|};<->4&D(Qo;W-^Z}tP2O58YPzXej!@>rG4f6Sd?hf-s7067fX!;&!Yk69 zIN6J1OzQYxLOj=O7}*Hak_p24$3NokE&E4TZA@yS45#^Q#+dv-W4D#z9;m<`a?g%0 z`1V=3o4t>W^|T_cBph2kZQ{9C^%25IpIR(h%5gdBBs7{_s_DQ`<wYiI1esJmpE7mt z==}~SQboae?Aqvg)x;s~%oy3zis~!RlJUPQ_zue{L8clUGQ3igy)$Fmm$J-bSX>I* zlqB1gw$3z`*OSkvQ}r|jpVbWY*A(PGk%0*=I8p&E8pOxE2e|wUcd99DTBL)H=u#Cb zzx{V%<QY$eh!DIBdR{-(#l_7-dkJ2AymJ6UT&M=&^3*N3(S;-0gZE{aQ&c6An|qWD z?Rp%P7p6Gnb8O$0101E%nNE+8L6&M;Onn1Q6#O<NcGH!e$Wl>%T0T0o=~}5Y0y3@S zpkysLBSP}eHU-GnlttoZ;?fcvt>F*f9nKcbUqzwE{ZIW*CR#a`_!)pM4QgaDzGNNN z&FIuUBw%=vAd2F1&KuVN^U_BACcOyQ2KDg4kRl)B%6<80%Vx6wvy96SJ(8h<i0e!? zoF8dm<7qTPsT@nkM3GwRRd?qgKX-!MMud^dJzSX~SBQGPHHyP)pXnzc9*Ozerdm`; zlX4e8(aP4>b_hJ1OL%Jbb`{wt`A<W_WR*u|Ha<G|q-BsIv|R--)wX=542>rs$b2O7 zWz%qpFv@I3sy_Am-0CzQqc^?CbcEgfGVoZ=8gJwzV0fW-I*bIR8X*S`ZaR#6EsNq{ z8NrGGmbejai(HEvZnx?STTrDcf6N*)B!<XC%RkBs7Gtc9M}E!tFGc4k;q|xvP7`!Q zwO6Cc-I>JM3C$xO4EQCB%NntMD>Z`}%iq(-Vr)YHYJl(sU^{VXkr^b@bx$c#*^=9U z#mr1QtW)E3NdNd$I72e|2L&Ej8<<EZ#%E*j<av$Az)X~~NB2AtZDI(>cWt#i^<b{} z#tsE!SPj(IQ8;h&?x`RaGmAWDm`D{<t(v>eJg%#!CE1K9ST7hQ7=kk<V$TEJ`3{-i zamws&<0Xz>C)v{p^k#fMKQI97_p~dIn1w<GPP%w<Zpg;98T6}vmXDMp*zIjDEreLv zUIfztaK9Ycx-MRE>RPzVDAP@(5FokvC(I2%-{MoTC*Gayb0P>kiEv&^7WBFX$LMiH zwY<FLg(``KAtS^6QEuH0+{HM%6^}hXtOD{{aFXJaIL%%lUI_QD_?Xk0Ynekt9|TT2 zKOpdM9q93+!UsWwkgB?c#FkJ6;@~Cs*vTtf8SO!e|BV~oowmVckt7J;0$2n4x7>n2 zEe^=4NJ}2L1uRZz>rTx%Inon%j+v8Ag*mPn1Vmuyg+mRf{q&vZ9{TbhS5-J^d@{T; ze_vrOfs=hGeoAMM0v~GlZ`0X5jV$H&GfrA8>$UWcDJ$>r<Y?gqO0hyEAFKkasPXyI zy>CP1q7=E^mVb_w&BIeb^xCDB#7q-UeDAydE_`!S9v$BtyL2Po5CNh__Pu@&tty@c z$gKz#T&x_@n*!e|3yv)P4}e<Mipmdy872`KXiyxnrsQ^B#2b8aYuC|Z7Bpw0VEj9Y z0@~(hTgXr06AmR-@e@X+*INEqcS!%%^Dk8X-f1^0XG#+L?tx@A@O@?g%Us0;{Zq4x z`op}R4eL~~f7}xis1*odxp;O3_dqvu)VDdu@P5<PPlqz3zDwz)6x60P=egW{$yW6< zrREIs400`Z60jTeY)M%hw95%uE9<insFb6Mio$bt!=7T7qkF^O5s@QWyj6NwC$`L6 zl{c87N2kzn%4irtY?*5D;&s==WB4g2YR<{Mj90{0n%;vj0^JR&RJhVA)$90!YdBVX zC~sKXUNWB1mi4LmQ0p@*NdsPO2``IgpZw%6t!6tCJK31PPU#B??I<U}U7d&~xpJDn zUOd|@B4e?uj76$eN7aR8yV8$g*e7k?e@ZJg10NCn7x^z&Kj=<`n3Eq>5!mngTqkp> z3*$$%W`&tODPWtU{ku;#sjuuEPhU)%EdRi_Pd;OxEW2+xoNLb@VUM1p{`)B6(ZDPT z2?QFzYuF0dh$BD@8TVZ#Yy@8D8+O|lBb#zU#G{@EF=r3?AQevCVcGp*2cL7b*2oUu zikJCw9!&D47bBRv)KW-BJI@tapA&I)iisdJ%13^ZsMI2L<NL?xjZ!srDqLG!V_X2i z0R8iU;Yxd^qHU~HVy+R?Y48dBomK`_=s#S|OZ+Y0?D|B0%h(cb|6tAfdk194UFvmc zPfncJr>m#*Ie_!%If+_I#y(Hm%;F30`Hb7^j9a@~JVN?i3d2{cc<%a%S&9Dyyxemj zQ?x&a6r?ys7JR{BucsHIo*jXpYohXv-<TP~s0A|~j$L!9%kD1>FAZ0mk9G!uK$+;j zt|@^}LEPnsNIqLOdF}umsioUjo98kT)w0Kj7CrnQ0>Zk))?4*9QL9vbJ88h9TUK)U zJK%&PLr>9i^;2n0onJsvfsL*3AMeR+e{lRX%L$^hRI4lmPLs1~`zB{Pb6Q>$<5P{! z868=0yLp<)B87W6NT=|aWQbSDZka#jVngy_?;r|N4cW{_>1K7j*-Q7>rDVs{LkCQ^ zo>=wR`IW2hYTrnV^U+2?A&!<K&}lK>|GNpSVae0{HzYuie5EU3yrvZpPVq@e<vm0E z2=VF0{9Iv=AG|X5zrB!rRuRWBcSG0%S0Xs3sHw}um*rn)W1GzyshQeeK_pTaLr3`* zUp%8;aYWH#9b>I{YBLCN8M-P}MkhjL(n1Cq1U~;yLL5BCf2Jlm`Z*A`XoWlk+A6|> zWV~LnyaAlAHT<iW*#G=ujqqNbdZk8vW0jnY#TBSfzo-z(;xMhCPVN8sy#+Ujap~Ps zm3DCiwTLoTwq;$k`YU6WO1g9_32MYn*Tf0-*f;5?zx;hGNtStpa60z&E@ycyrDBd= zVBxS_OAlUdi-NBFa}{_TT(9Q3I>23^T<Otq_9D{NWDtQgk7gqZTA+{u9R!hm@&vA( z!UOpoz~TTu^O+h{8i`fV_>lQ_8HCE$D1fwb>0&H`h<R(WUtD6Fmaw+JiReF{OH1!S z$)PK4n!TvW?fA;c==#R}xw|XVJbYI3=6Zn=l~%2Qe`4DS!r;5HnbAmz0&oizpkEz~ z5?c%2;*gD>G8}Ju(DGwIcTZYIngppdED9YZFcbyoLKrL+yrlr4TQ}2zGLIq91t^uV zR}XCIIM4tf_c_uXXvRIC$$u2w*byNt-=V#o3yf=V=7^iZ?KNZXoE4ArLJM9F($fEp z2-aApO5Vs2i0u$;JH_Yb4ZNgI!Z!4b9Z|WYr#tw%&^q8MhloC?SLL91K5XhG@1w@T z2fqNzm{)Z+WQ{Hnmk4Nr=V`kQ5N<<%cb#<ckbg6NdaG44f2$qN>m{WtBwCHoJhjWE zv3>o($st|?VI&dzV{`-=FoiXu<99Sx!aOIUM5|D`1H}eafC|gDiJ9dUqU%eh%6@fe zcNtWiL09)iv^(oQlp`w1CPPCFz#$g9-;zZ!C0c$M>D5l1jS`Ja36~$1nlfx$cqL1X z>U*+PkgZOQmk|f$qH9^SW6XaN_yiE(x(0;TTCIujUJ<cN76=x;$I0TtZ?bi1zyYC4 z0KRlDQdSp^pkZv6+wcEJ+MChbf|FL@jndFgRa|Gb*jqA$tLWsQS-TDRI2y$7W=6i{ zzdX+U>iXYN>+)EiNLSyp2=W+J*bK1=-jb=&A7ohQ!gExHbgEEgDJ$CfPd7c^g{OW+ z_<j&}O9=;Nrf9!KOD@R0E8*&)8;8*P?bV*jK5_C`Z;xc4^>hwSaX+(<ENq<if2q|R zp(;<6ozP^*W4ZT8ki4Vnw7O_2Vac^y@<rwN7e6&zgtHHp(>+6Myr1LVx8!|wB!$y! zszL{vR*UVgN)X4Rl}hX7unVH^nG?7~mV(wEbitTBPApy#y#wKYo1&Uk(9YU7xP})O zx#L6W^#c|x+0`xYb5o-YE#6D5Tg%Y+shC+D5QhT^eRzLJ58=O9r0V~Xbmf6e|NsB> ze(x}I%`Id@xvwa6usNc1ARQ{PQc)DDPbtUV=ui}WR8-2+K~#<o6t>FsDWVe{wkRpe z<{X>7f3Lp3zy0IA*Y$ipo{!@hj9D4_eIUC5hg!3ehl}ZVJXunN<rvc1PL_~7pd&yn z5&X7sNSAgNnGyl1R>9#Ebo-hu!dxlagWjBAj_sj5S<3nVXzxCf4!(8=!k(@4vPRz7 zxwuut)Z(g73yC*mM5OI#>Jb+IDX;4CdIfB^F?M8{A=^pG2CTl6uD%mPhKCTF<s9&c zBI>&scXuxK$^SOY6(LzxWJ-~SGnh6BT_4L~tyxJF27gVXB`j(}gql$5thzF{`-<9n zAT0T9q#W=JPhM%AB7Km37jA>+#mO{?oyN){^8oe%VLot??aD}MP(Nm?MCqz*k-O|X z(RFKF61Mp_N>gyww~$vfo#a_RV-6lT?5_Z8Ito+VqT6wbB{ZgZZ<-BCj$?DGWgeK| ztZ{6nkId>fg%!m3Lx?w@K-rsxZs%pg8&PZlQFNa_T(J$yAxfmHPjux}xKCGPG30tt zg*&(&m;>QfCaohBWM?S^HTN3vE2_1zBFssg-GgH76%TO5qqr`>vixC1Tsw>Ra!oHI zU?at$@xp&fTu+dsmI?OG^|3-&H?9EgIv51HkvClqbvf#&$z1?WA4Swy!h|T4HS|Un zUHnlKY)q=z;qfb&F-iXH#Nt;{Hfeb$pnpcyJ)#vDjAazsX7nZ<b8lWxNEBTD>7WOs z1MB(C$9C;T?(Bw6e{46hY1(~Ln`2~8OqGPb`s5|ke7ZK-jP<PGsk=KV41G|9@EJ*G zOp+Ec8<JrQMS&CI1qV;u%}8UNX(;HIrIEdaXDVsSc+<Ltb6Gnk0Q<&A1F$Jf<_6sp zL4XeWZ-?r#%8z{q(Uc5E?E69x+gO0S_W}=*olQ%v*@k97vj3DH9z4<9leo_>4U%Qo z1#y*C0Bh*`8L(#qrl)(u)Z>6TzuHcZP^wl&0z<D(tAlR^JuV18yBOssM6S5=RnJ&L zIk%oax8e6)$6@nlg3)cWV^?c(W`pvvvRTOW#5==!%Beg>z#qX^Ktl6R_eVdqK%s}1 zHaFxr?~0yX7%82U0UzsRbv$>KF23pD_}jlWD<5d0I(LdlVU9$RxDq#evI!Q15h-4j zW$y1*V!IhM_GUg?+4~1C{>*uOf;NRE_SZiaHWN$$Z`-g*3V5wPvF#LrFTWmlkP5Ps z9B;2uxpQd~Qu@F!-HU%o9lf`AE|IknPo(=vXWbo&fz$zlHaJ*5M{VPjy3BAslAIQd zd~LSk|5{r{2AloNh977{W2Sfwz2tT(7Tc`~0_yq%5IO1oDZu{a9DBY5e(wp)I>wk= z!R|1mmER@XJa7iC7`8B8r_l`R>vEw%B4xfl;Wxta1lTjf0!n;t`Eg*)gz~J18cp4! zw~bM(FCu7&2-q>npHXo9fER<pBSQnRDjk&dt$nhwt0%>klxVXTDF)>(*9rWCiFtcG z%eK?&k3&T;sSsZSpr;c!xYP3y)X^w$9{D*X#1V^A6&-XQ*Z)@g(Wn6;)x?J^2O+QA z2@LFA0^*^78cDe@g7Bl<Mqc#R1i;J9j4wIy9Xg#gsX)34qMU<tm~_;FxO%tp14~5p zUynMZf~A#OU=H!lGT6@$WG+kUm@P)9Ny}vGfQ1s`y2hdu+B@IAXdJ1ed_7BO_5Rn( z6xO#Vj92%`6%ZRyF@n3S(H2mPiNet2i(giN7N87i7{Mul{I+1d%!KEgCU{$R+H~w5 z^53H6-OS;BEDt(7+aVdg&44x9$TKS9XjVdHw(AKPDQL`J%!o9hggn#(H@*$_SQ2Yj z{Q~Uc;1U&7gx+}1dn?=DsFj`!YV29Cnwq)1no{cV<Mp*gqU8Rol?E)HVY=<{s@HK7 z@s6#bOMNzeeQ$$+(7d_O)Po=yKHHae{5Figg{Z!tXY1C?`zj*EXz%APwoi;5+8gm- z!Io1IM<p+*EC{#%B+&Xe2>^XUTkN1H`fV9T9#d3K2}XkR2ew)kgXkvmY=0zreY$N# zZ<hKl7ZCYvFWwLD!j15;EQwE$SsYe*T5@tdA+;$Ln~1qzdJK|yr>755kuDUDFi+_c zJz8#ivYI?9+_Eb<ac;3^6n5Zd6uui`ed{t}9cSoP+uq~d+;#n=LxMCm?@Dd_GJx&n zEHYhrBF*e~DL}!82;Xk<cKq^-_xuCao-Fq_o#%6V=|RmiV_7>4FCkFpDrDSh9`--p zMR%o2;`3}_Ro4{AS9pIKULsz%vXnUUzv^xPv+tog%;YDhu|?qXUh$;GU=dAiNENIl zV{0FR4nvkmjpBNT?7fKs?zOff<}{JB`#MPT6@R*TPVhCjAVkX>d5_8#IA~Z*CwkD< zsd#gZ15$xN%XR5sYHr*PhpUvU1-Hs<+g4Y0W>2+esdOY^sc^h>-2(+Xf6st;U-km` zd-=-FS5@{}QlQ(<mhNxDb*hzz%mKq1`Afo}h{prd_o9hg^yUI?Ab(dB=&IDl9X?_I zD%;8`Zllo~bU2x#pVWX{onxObU)_jr{M`%LYHFpRjg)o)KqvfkPVSdct|QU=oE4ua zL2tbjsN`MgSb_`_i8h}7tCP{p8|g<?kzXb38aq7~^1iPHW*ol8VO6v4mkOrQM#|Wy zfO=oh@{GbA!c76&fUf~|O4dDH*G6=u+{8WhYqNY_4ENHHSN~`BT)D>y=3f5njZpym zOof3fr;$u;%+nE4j~6#crEc3ap!4I3Mx$d#=-aZ;O_X^UN=wq<P#_%nO|dJE3^r65 z0F&I%@tG~U9JRLOe<*N2T?!#Z8fr;&h?{z2yI0)A!>oxyS4MqqKkG9kJvI6s*=Dyk zSU3-ZurAX#4Lhn1T7A>XO<1(-wdTY>_m@VR+pJXcA~9N2uR_C>CF~Pf=1WQJye6dz zylgfN`czmb02o6TmAY9K-FGs;^|JC8uE-P!Q|O7DB~ENLFt1*XQIvSK0$?GD7zEm8 zxVd$YCrv-)J$`x6B<Z*pD_(Da!t#{6la5jyRC~RjlJ&?7!MnL~(Y&Rddlaxww(>Yw z-4MX5zm|x%HqwMfwE1d88~Lh74O>8bTUh;_a&YI;PoQ<+y&6_nR;GN_`M0v(%@L?3 z@AASRHo46n+*1k7RIZ57M4XvM+nZzP70+H;d^)BG4ljydT4Pkb^Aa@}aScW|{8N9u z>n&}^GEx>%j><^LVHyX37MWKo0Aj|;BksGEt)xnEoo0mX4*`kUq>`oqXp}j?5D9>8 zJ;9f2UrrcJSUn+1##u&*zl5}pG~Y<GqggL!fj!6QX6hD15Iv|~(*`>HdWY}dfgknI zgI`03VmUpL3PrMLc}nNus)>(f`Y5CCL@QljaErhatyq<!w&I?`8rBE9MxH)}dl1y? z_GXDEj9c+6wQ}8{v?0kq8n-}iw9{51SS7k!Pu2#}>US2o8rT@Ko#yps#kKcsw}6Nj z0f62zIQa(yM~CAcXn~PSVt>W6Gf?z>8E_@h=|K2ABpa{~_o{xH3n8*F1wb)0*IG;# z?H`@PZ)(l{pjv(v-bBcoYNI?I;w&KippOVPp)6lnsTK~8y#m<ELs&Bo@Wl&|pY};q z1wZWHyU|sRg(?>&0=t&hBG=Ye5iaNva?~<Uq=_Qc#^v-=v1Fu@#5hE3x$dzd;3H?0 zovn;X>P5ZCLwHLK?<!5*5ba3-^C{a5Fe~CCUBXnet0fkmx<5SHbm5Vn1L6~G0N~;% zh9dlO4bDb5=fyUWxNgWPb78J|8W9Mts%U^(1L?`%OW>d2LA?NTrrSeEd9%LRrd%xl zO<~+4`2el~LIu%F({g_k!23LT{_sTEf4_$b;<DbYpP~KcC1f*+90Cx58T5ttvp#He zwK1GBYjb9m9aCWKf$(o$`Q9C`mTG}wB638V6{a!&=3TX91rvPtqSk&NsYlCjMK}>q zM(<*ke+d-;Dg9moT&>c5o_?zaSR4`S_h2Cn^wiq`p1XI}z;}NanKG-Ppak_4W~~I+ zP2BY6WERuzbPD~4*Cqpi2yOL{s#^(Nfj6?25FvbBhwQe-5>TIj);*g6j2mO`J;!3H zbJ9CjDS+L&_@zpYT7w|%e;ba#pIi^HX*Ty7Blc@JsBY*y@Q@}tqIz|yQ_fA`Q1l2j z328C@)O`Nwg&ZW_A$>K)e~k_GEn~JuAw5V{xh<VP{%pS?TCBma0u-P$=>-vwEVGUB zMz0GgieU69<G!eD<66|unTXONOH(zgEh6*n71sc^=D%;hd=oWp-BuoFTaZ%|px!9Z zhh;wt@LSr*%O(4Tiu|l~P7JE-+Gj02r={n-koDvdF-8WrZyQaJ8Ek`|2&i2ToauB8 zxS)9Z#BtHL*bhYHd$XK1@N`LanhUxUZhXpr6hSg5zB@Kd7steZ5J06S!oKz%-u{dL z1>yl|fNb<v)RWzmJQq*C0d2&uIW4o3aC#>zX^SZDkwweyb>*#+T#cNuIt`#>`h2K+ zdp2N5WeCFW>66Y?NV{PD0P#CS$o#2GIIoi8NCVC};nB>6t*XY|(2eNh#XW$S|LVjm z1mr>L3uiN+LCgL5`jJ=3w2N~0%)zfzHkAY%-)QN*g#lrM!K7fGnh$^3Z8f$4g+U*} zfVG6!C)_Q=1$2`Bwq1{@k+JfZLt#Ghg9OZfT7K6OYBh=#(f&N6-+*v6jeoPffw^s5 zzl?+yPpWOrQ_kz_=U17u(zvJaLW(vTxq`iK(?*>e_mp)YYjZD1bTnf7o2NpD_|2o5 ze?MkV182)cT8A%T_~dJr6A)Q}M@WE7ZJF#umq#kSJ+1oVxCZ*l=-5a^z$s>m1%={z z4~0}xHdH=R0U_FcUc*H1R>+YecuMxmNAe92|9_FqrrfW!<s(zqw$WBvYlFiiT8vt> z=VrFk)6<-DGX^lpSrQ)dITQ?}bKH9Ejk^B&69T)_G~xV@3dG%#$$^Z<9ZI84TjN&= zy6QfZo&b${>8Wa?c%>D07IJM37vbk8yT`xQ(m(@bx^dd&l{U+cVRIi(H>bIuIfIE~ z(pACN1VwPWAuoAB$34iVd1QAq%o8YJTX(o%7)I3PB=X38skbG118>vG;J^}SNA>B7 zO2X*pDT(X5@vngcWCnJ{gxD$`;mrnybNvv8nh6~B9JZW@R|&Wa@-kE3P$VyN%I~Uo zr~=j2oh*yN@EFdDJXwI`dnH$kXs2eCGh=G=`SWU!9{PCCbQH9T1*|<lRObvt_Ii>V z`W<U2Sf>bWSanmeU=sst5IobfFc!Au7ZWK!7-oMAgd*{Lb49);n+#_5n}XU)Mn^|* zkSFn3035<p&Os^6Jp$j&QGOn(%*d*_YZ1|mPvW@-y5_sOqeRRY8rpif1?!B7<6QBt zap~O%wp9ZTESJ}7JH&icWFUM8b@o?6_BDM(*F$zwJ(l?<qT0DSrjO9#Axutr5Gz?B zZr;aSO<-u<`1Xt&+~q8V3{Rl{JkLO>N)voG5>LW-4-l{z*i<V4IfByH66`L2Rm3_Y zUY9>8B~vV-sF|yRQS2z@^5Q7Crxf}i1#Bc`52m!O176wlL`LIy4H65KvB{@1^sN^o zZbqbi|0&cC(gqudqXyvlT&2|Q*6ejD*s4{sg<!~h``?Jq&zy-w2x3Y^uF8N0*%xdC zEF^%V<2{^Nz;z!5>@*cdeWY{|+`)Zet|vc5glGvn8``invI-LS52cGcSxskbzdWNP zR$%MB5cq)Dmt&nxu-L;s0`AMrAkv*Se-^Y87*WxXQyLy7UV%!h^Ch5cPZO#F=>#5H z$&IeX0$O<_fkNS0!ekXJIn_lJwWO}y8g&0q>xM0@9fnb%Eb;)LT~8UX<QpJttB|Tq z>d_@=^qjR~`qn25c_k^90?OfA&_5kEP*n8wrJ8>}%7P%%4HN`MftHO!M2n4DbDX6Y zUC?{0d)_C4??4y;`14kpL|gar!Y$<?W8+lJPQGi2)zMxx+SxP5W4?IFPeb0%r^(6P zud^<PC)-hB+4n0A8*K7q?Z>$Py~m=6DMd!nN=G|)P<!9}8vmt*=2xMGbDr%$Sc<;~ z#k(dB>Re+#gQ+{lvH1x|Y?3H5c~P)Rh{c$G^3dy<trLbWAQjp&vXzdEuLpdBH$B<5 zRz+mgL=~8GQE+qSpUVrL?pp!HT@`+Hr<)F>&&(Od>Ff!6z-FESv<V{+uMKZ`Lj{nE z-FU2QG3PJYzSs?XTXl=M81S<V5ax3Z0p&}@i=&$nuzfoT)Bz_rhIh6FSOdK+r6P9u zL>Bbb@i?5n)k*)1Nbeo0Y;g7;^(d{JO?O^>u|KJuzQgubd~5hh-yZ7<?_oMWA-wi& z?=@o`74_G>dzO1!_K2!SO2z~}|66ZFSa=w8#Op;mQrJs{hTE=vc>h$iX)rYy>+D?! zPi5!bPc#v^a=gTttrG+IH-cmyiXiels5Q;j%1DW|$7-lxMw%;%YCC<R%OoD5!iH+6 z??c;^xirvUKPid|#3ax67kHwq|03C${sgXMICWsSJw+6L4)7T-Sqvf#G`Jzy(_uOZ zz&wGUgk>KA%Toc%Z}Wrf?h!k_$Gdn_zG1;NGzEwv^57H6vghmQA(PS5@{uTo0|(Lx zVD)V7AX8;y?YfBqpV!T{SeKQ<B3w*Mqo@FH<=tmfL)#WTcD6KAK~iHVQ(5eb+x)Vo zERzqup^ePBX*8@X4#;TyH@5Ft0drao1EAn7JR6*nL$AE2n3@^s+u&D?-o@TV8x%7b z0#JL##Dq1}x0FJYNzRKOHizY&J_@1<3`iwlC}Y(l|2);4pgCj+OcD0yee<&g)OZU! z<ueA#DUqOo%J=+cbRKtMWWbo9<gdo<BXCU_5al?^S!h`>D(mJsJ8cVAeqd5X@I236 z1;DSfRM3SB%tq<$a&_RiJkuc_efG!T9k0&lbQBORqm$MmkoJMSrnq{aNZIEYJ1;wr z5>N^>sAr;~YqKoeu|;n65d_OQLC4hC1uHRGRM+H&cESqK1>*eMQYC$4R=!s39697T zrK@a2`6VjA<}$)IdTt?Kfr9*We6fKz?0~q%zchn);+eh4VUl`9M)TFC5VzOwOdYd? zJS4SysRD7y32?b1Ea-dLt|MwlzcYVu`%&J8tNy=&xwFuorhh;@ELJp78ffk287hQi zW|kKPdD$p}Sdp?WSlT7e*#!}`E!vopw3-ZFE~nIzxT_R0JAS-8U>y7JG``Ev$G7Y1 z9e5`86npmF_&8zX0($L0O)~vK=jGd3S^m#Al&A-MBC&hOks?G{zZv;)f<oE;t=Bl& zF_;8u^p^d`GhRP+lJsyc>7aMND9|x4;P9CYQUsYP1I?b7#A-#rAx*GyJpr7OWW+j2 zt2FSr&AnlpC&HoxJX863dT$SP`4`Vagx6oZ!GM(lIN$5cXE~K3<6itb5ww7|WDu>= zg|gN#8AtnBgEOG-vvTA-jdT=;bFA0id2Sa$8$sN>tlj?<$pcWUZD~%)nna<Dd740_ zuuK_Ej%&37#&W+m({__Ez+R1lQ#^H8TyO#AQWjPWjzW_}zf9~I)UJUx1un{`L3>0b z-k!lU5F*dcIAB$T;(}{iMuTnvB2o5f|BR#1dJI`v><*;P*kN=2g)T~U%0*_nyN_Rk z*@Z1Fgn%6rFcYg7oZE>{&W^x`2V3Mb>!*j)Ii?MQe^Oq$)KFu$s1fJuQ1^x{;9Amz z)5%!+X*&CvgTBOPv)Yoq8%e_7n4&8B0M%2*X!h4@aa@PRLixKBR}x@?v&6{z^J8iN z6%Y|uZEQ2Rt?#gsg#qk4=i<x?0+$K~<hiz><Kwv^`&ajyzd8W^!)}FuN+o!Kvj2NF zG~Ij!cm04F5VCAG0hm9;f!o+F5f<1n(081$<Xjl_#<)D<_yKXjY-b8{J=wWI`l6ee z&e>P{Xo%DEdq~iH6L;3cb<~row6<+Ii170&5UEU)Jkb~KUBP#w#D6s=);=soxlI0_ zP;f=*>MUrrzEop>J!N3efpfM?^tS$2!B{cZ+(UNV=7}g^GtJw$UQhzB?QBe$ZbclJ zl^uk<yacr&)&7_9Ws)C%#57Q@^a|P@RV!eVxSI|~1vNSbsez}2glb3++PFglj>QS_ zJQvLehBKcotGuo>vR31(&zhR<&TaM@8n*ZC8U~29kl-*(;D&9Mj{p7yj%YJ1rtxWt z@B(e-obk$w%<a=;kT>g=Tig2`xZF{`;PG(S@H$?92FIx~xsxO?Y$Ic}xj^VfJHX&V zrQ;)QtP^NEG4zQ)&+zkW=hD8OeOGWI<D_L&5IY*Kk`2zhqU?b)!3=(a2on5nscc4b zqiccnH$?AxTS}?U%ajK|j|GBH3@;$?>+?WY(fcVc7YA~@YOf&w(QLpX0-<38e(RkA z?L#wizMhHl>%R=~mi`nNHg`BmJ`F;<1!yn0O9}#Hga-ySTEMRqj2R`j+rB0*%c#L0 zw8(>?80#7URQHFf{Q2q9g4dEN)#1*6HC5W>mp4vNmJEl@EDt->AmDA}6%`JfgY@~Z zeN98~6xMwPcULkno*3CKin75=HPLu`V9Z_}qI~20({M7SW0Jt0!i^GUV)NYe)jV+~ zOf0Eb$Ps7&(LP~<!?^7=Zg`X0MLZ$Cr;KXPFZo`<-P)#xDPhq-sNslfrE`K-J^2We z)pWh74fwwVR$gyQ07(e4FaA(ao?shs)LN4h0;M&aC%YiO1B1hBv%f5arr`i*o`G7B zw#Nc>qur@tzf@dlLSuhmO1W{al4k`~0*tcx*Cc&oEUFuD{qXhhL|Cb~Y{9gAw)jw( zq?Gn-+x-IbHWW;572*-YZI62W{{8365u#h_-VdA3TPmj79Z4N9pfDnr`gcrHc33@m z(P~w)yX;|mS6}9J-;VD!?@R|qLVl^o6OEp>$MpYkN_>^)r2i4rWNjr-jJ?e~WCa&z zcJ4J6+8GO-bIIaC{Vy8D&E!=S3zvH;w~~2+Er>GlqWZkc`dZ&x490L@L%_Y7yuZI} z6G9u=@pwnMMOrNqRie#akIW~wSc0F5+?)TLP!aPyLr@SZznQBBgmW8kjdhrHl^VO_ zJ=xV_ey_#kEo&gr_VGpm6~$nBYH<Ol<u1B#kfSp|h|DBjz5Rq@7q9y?%2!mi7U#_Z z<oq6HgnX0iKPIa;i_W$N)vG4(Z!7T050k^Q#lwwvaB^=abS!+R%i!vIa3@<+CINEj zn?fwYnicpWmc)OuWLcR0gJlf14P{>$RrUUWzqwb4yy#9r1Abu9?@Y>cn8A`~LC6Yy z@a_N>svf-_`Buq2`U`JfCM#2WVOnr7!}O<lO&0-VAD3`ELoNeW+*&x4y7r>WKRzlf zff64!v>$?(WPbNR*wUo2#c`^1zBDuQt#fJ0t})TO{garEY!3-+J}!xQv-#ZiU*9c! z6i!_7!RLeMe&4<4XY2)5Qh(;M3EUwG57oqra>fN~#*QGseVhtD+bS>7qI`BE9za3W zG3@d*a!H4Ht&HjK#-VPXnIjurI!oyRrKK1ZMKUfDYPNI))7~XUvGb(3=Dcp){Ob=n z-cYOopB>2&L}>4T@M~?ehpF6VeNCjmC8GlRTsDSXeVHQZR4>@_7QASU&7|@VH{Dm_ zu8IWl8{%#IpW(*q=c&f0$MFyS>gRn}jD#-y&ans4CijbmlFb)$Zvp+A_z}xzog{^m zOag1(#~l-RY&hr8mT4ZZ9<Q>JXIaVWh(NcF0_w=9zY_YVS!>`fnmrJe(m78puoF1= zyWt_NQ%*lV3jdu?TC;+$23lsA3X>etAN*oqW`&o`p7ubo95UDZ`D-$)z(bITaA|d$ zZ0FiRD=T~?|Nl1`8n?ra=(vH%8w5bkcZH3dpom<p(ow5Z-MAXN!-*wftx3~O%yhRD z;00_IJtzD*p&JT$Kht?AHYB>T9j}@tePZ1w=o_CYI3r;~PocSB*`y=*tU_6`DvVXe z!iLvkulo)mz#FDIQPBX!y!Na`-#KpD!qC}w8en+u7#?*!Eq~_if_mK&oL4wOxKq5; zW5w=G{3<FoRA7ZP1q&B2gqjS-SZ<7%CG$%6{}HL42V#vF(<iK;f4oC#aVdD&BLDGR zPr-0OCt6jE5&{2_BeJhQ%n%`ZFASFKYAB<Hzb@)>@QlF!p=}x7foBCz^Gx4{nfE0N z3MGP^@+}k3qMipq<_D4zdKB{&6Nu};zLRDk){|$X56TA!U~~ZA&{v6b0#?P5gprQg zv3o@6_Qa0Q%mjogZl~eXVMFuG6f4W1;avNH4SdB_irJTWB#_@93hiKLD?qwtH*7Jh z<a>0FAGV~CPEWmFLuP_t7no<aFCH7hD^7F#>xKmey@LJE1h6U{xAfpkoFWy+G>8Yj zP=!5sUS1miRq1AQM}sI>|Lm^g*uT(}N#1FT^;-eJR{qY(#8<Ip!--}ujhpc??Wc-i z6bB$2+;s5UwgvQrUGM9+WN??n{{s~m;?Ih)11T7%IF2tUH6~*>2RP|<d}n^?BiKg* ztY$o`Q|c+33zQdu@>j-X`@hMVHH&!HhH%RZ@`6eUGdmj|vBV?0L5C7Ubk_r9Fx#er z!onJBbvWr$hOJ35{q?)g$$!Qv&;~}8!cRA{j=hHe<23Gc-79}a^RIKjSvOzN>CJ?s z60o3j=u4)C&NTCI9XR0**k=fD{Dh<j$fL~<k;=Q_YS)j3iUn&l!D<r2rS}EQF6y%I zK4K^3oIA!`FB@JfqX+YkkbvD)EAUyBSg%c~Ud-eh*32w#`6r+|tkF=Qv+Qn4U>FBG z4m6S#fu%06L4i(yykMnrx(OsYC$7!+kon(o8o3H&pB`9seIj@0Dj46pTX^V`YD;a& zmUtg@1_+nnO$g?eE)RM88#AIf{FyC$|6D6_uAz=+FD2$sU|e<rs09vO)TAJ*8sc9W z%+L5_&J6Q&m%!_S{K=q{sURLc{B?K%pt!**zI8Xh&x`fr7JoB=)k6SgL{?Xw5|+xs za?#g6_Gz<Xlrz(7D%1m?O2TH@0u9coFDJFKl<jnaR(0c*2{xjfbz_%3urf)3Wsb07 z`aWm%OJ~0SuY>#@yCH}OSJ4b`yEz|`*rs0mc$LCFwqcxoXP(q$Qr-!xjs60Iow@^? zt{z-;-6~scbU<(fn;O0yfoBCy^P=7sXyZi+z`u>smGK_?#NvOO?Zv<H5Dj=!@HFb* zQWe%<avk6rV=Gg355?3UlRRPYi-|VdO}6=Lk$atojFg2Hez^*W)};g-9vy4`1w3XS zLsT#WSi?%LKZ{jFCI3zNKl2|v^^@BB{LYyTy`cYjU2nF{xYy^w+M(v8L3#?G9QLF5 zPgE0yVlRJcGcXf9^W@VIZq~#LwV7c?h=-AiUvq(Eo3U^gi=QM#cHTax=7JlJkN?+o z;!fBz)@u1iXIL;^KO?!UPJ!2r&f#!2@el6s0#CERCr{euL6!NLsEw27pStIOmynge z^}UR&P`E|S3eQ=XeeB6)XAH#-(ULXrpuNa^fEjZ;%8twg)=c@I#|Qi0&>xSNSs>T` zjLDxnONSqi39OTFsRlk0q=knPu&j1PuvZmrpN)Pb041I(3RIBCDy&%HG0ZbH?0IcH zcJMriSnAM_bm1j#d=8gh8DUO=+A5N>2iQV9rveA+$@@X|m?lSKh>)qcW<dMdo=;$o zoHnDmPR@xr0#;I3E7%I7_<Xebb}Q$y&lK;^7Fk~>Zr@n5w0!mC;_HiqEWYMTc?8{9 zimz|vH4{s60e8X>5zZ??vXqdjNkXgV&<q0$OL#%aoKPpu2aJ24@$gl>f<SH7c|6Jj z*R7G!``<7TzLgc<1F&q75mK$~8||lG%hvxF6RS#1`<W)gVkS7*YRkoHdE{VE1NO#; zi0T0Y(CZ)f8cJ{u(nG<iy6A!xGMA(e@(=Hc{9F3S=T?;!*SU@gYdXHPtL4rx{}m4} zpP0ETfqMS<sgVEudvz${vWwKpS{va895RfS@Z{$zm4Vj%!!-(Q)dKr3_{n=P*1)*6 zY3YK6HdG6|)B2mdJtMptpRrSVLt_-7y)X1yvXUO0>bWvC+_-#Vd_kD@oqI|L5vUT- zyH%&OgZOR_#%Vv3j(Zq-j0p;<0lo%o&QQX8$N29W_#|z5)C|P`MzOR+<}GwOq!$hn z$g{;U0DPI4pV;go|Kcp=T)K(>Fq6C4_~q7(9l?fwyzu0|O~s^<qySz4VC!sjzbHR| z3zUE|a?_{PEAxsDc&O+w%JdH+>|tQ;F=n}1H;J3T^{sK0u9mBRm^ZvyJ5LV;OmHq| z)EpwTsCz^ap{m?{a5gCN=`LUk8J#~I(NMj0;0sw&XEjU?UTPq89iPp)qV&)2;ftDU zRpQ%p(Zj}=8CtB(Wx_eV%Zwl1{Z$oV7cZA>cw8+Wo>z$%g-loV;zL0AcE194Ifb9Z zVpS9wGh*j=5P%A0*%OtNV$}{G{=&zG#U#)%z({(vc99*m!uTrH_3-At;HNxa6F~`; z{fN-BW-&Lrx@mJ1d59&mZ(WQ?LV?CM3Z4?E;yM8nW9`rPKS2(5kX^@zKu0R)XngMZ zD)ed|5Z<N)MBfhNAMD0&Wl3^$h27AXNCuM$Crv;|BBWVsF}OuOgk6T&RtPOJSCZ4= zm3U<+tTCSqHj$$DDo4MN2gw#R`I;8ee(EN?f8ct>GX43K)wJ}$4pC$RU@c%BLGmTr zwCfu^ZW*O=!xCah^IgzOcd?-Hi0Qb|z2Hbe35be&fV`<xiT(C=lG*MT#=i|iiQQ@C zS+RS;{LeTnW1<dh`R0;8!#wter;T4FV;xmQpo1<lRJvir>r+TK=q=c%oZ3^tvKov6 z!u2fY{!p5?ndh{jx5{vCq47K;15EN`;V<nP*$JnFFmcRrFhbCy#cn;{6DA8|)E{ZY zul(o>S0fH2f$8uh7i{vBFs;=(;$1rtdwVCrutN=uHT#MP<>dt6{AoL0J16}DNxSb* z-b_}~{%(A~I&N;p%B`E2#)f}>gq!XtmLMkZy9L`R-ZjvhC4Xjco(BPq|G`;kyYuBp zC@9hhFwDtCzsAkNC`+8r>u((u>^A-b`1|VP0z1|?f1D$Gxw_gH?bcgnKzKR!_$qZ{ zV+<L~N=_Y4T3M#xzW!NRnd%213cuYB2@PiWi#^~-X(>pi#SWNGm=Omi1-GrRSAPii zIV;iZ!7!Ay5(TS}a~j)@73SBz9}sM5oe{u-_S_2Gd644>L{pmy*bg<tC5DtO6+kGd z`Yo9PGdb4ynJsKw88omN{n^i-wSB5DZ^j&S6}%{y1R3y?mIu6Zkxr%oH4tKaht8+r zAD>{E0yQA>+<=_9f7+R^h9OW(O&Hp$FJ!!3GNNlEj|l;>FYczg<WUC>Im%Sjh|v}f z+!~HX@?NCl13x7A&QphF6)$3Z^@x9-$nd+{apzI^P;uq9C~J}-D$hZ(-cvjNK5#|o zIrZ2JeiAr<V*t-3&82Bh2ravR1V3PQvKvpHmuAIRY$(`v{d4u)j-%KF=n$dH;5@8+ zlF+fxTCLXAdMqrbrQrEt&edVfVbR1D1+XXub0VRf%h1eJ?&j8z1C*egB&)=k)l@gt zP6s{JK-h57MTCx3NP;#-eyP!~K0EWWk?ANs1Xw2_xvg|SrF#fB_WOHu6hW=*0wRnv z7OHPT;!oc;Rx0qICm*j&82cO%*-xK)Bw|jsyV=*tS)@7stN?8+=gPlKc+L15rJh`? z+|SGID(-LiFFMe$bDy0Uj-f*B!C_$N#9m(i>g}L>_1xXQgmyndSn!z2HS_SEjq@5} z7DIk=mWODI$33!~v-5c4EI&M>7`-!Bp3zAhwBnyFqQ({~rxg8aKch@>c#8d@au<X3 zN{W!BQ7+56Be0f7`N?L1flDnB`7?+1$`Y>L#N(8}K{|E}GuVLaG!$<D+{&4acH>1d za}+47*5*5)M~pFN!mF?QXG*~RV-JdV_|B8kn}#@R4Yv*rN5=U@uexy=Fj|!Odk}ri zZ!1zwLgX$*$OZ8cRk5!0yJ$i0_bO|7W6Fx7A`~>vGFoh__UITE#9Q|?{pC*&F(hE% zTV}ICu=iZH`FntAKBNq+9iOn*0*21(kRA~c8%?e+aN<BU>9)edV_Du;U*Pcuc{2u} zqisOo1>wG$u^&G#$a#w5;T@2Qf0w|oLXic!K*9nm6aLKg*y#MHO}`J*KtE5CI}Wm( zk@YeFI4(>xvw6~jES1q!9P|Bi<CbjDd3j)ItX)r_Hs&7MFll1?{nXrsgR^?WPSOCw zM9^O%9NlK&z0n;3b^ojbYZqfc_+WmA1~>!B)Lu1VGBpHj+do#e?bSR&JxXk`!95!n zpC6}7rom^x3T#*L3yhgJ?b|B|K_a)~rNy+wjBfn-Ec}jy=>;eo!N3+ubr67hue*@O zF{HtHu57WH@aGCR<B@%V@UwHV8j-f--9F1ezc)iTxQrK1@|YLn))VZ3iH;jXxPb6R znlX0R2-1)W{$zIBos~T49k~qO(r`f?e`sbM0g!`5NeK8#I=UJN^A4fP`)g0kiglLJ zw^>evZQF1WF=(pqj5Zv*gpWz3KCmrVj4qRPo*Pg=SfxW8QeVoU3ds+T`?z_y?0zq9 zh(MKukt%xR8r9)#A(a&l<EG-3Qw|tsk6ya@3DqJ}wSN6`CT!HN+h>^G&%3?SQ>!qo z@B(#lKW}^_GJHAh#gtO9yNz)F0?L6kB!)Qbgk;pVGQDn}Ch-Ow%P!+g{xq4n;%Yyp zq=5RVP&$l&3iwQQ_(;40!1yHRvK|{qT(-@dF4(5JlW&`cOgdFkxw^<~$+?;FaH$cc z!=sZJMTykF55jZ}mV~%BLjHtjfE!s$huhxZF6Qz&RiFz`uRHO96VcC<ef5y|i7~@? zch3m#kO{`Wc1Jm7j_hjZJOyC2kIujILLSlKsONtsJ+V40`gB%>BxkDqA1{V-k}`Op z(osyT9Ty`Vk60*nv)3X*K1Z$(E|r3>)(sgk9<o7-xJLo3eo3%<eF(uK9EHy!6tgYm zS`pD?=<S@zNh<-RacdD}Ct=)XAUXkJw7EMb3Jl_M@rMcwdQ$lauT2h%GffaLwzVT2 z@uS5S9cQsvDkgsKp^yH@7@L49;2Ln`kYn-}GE74U{wQ3$*E|~^ywEuCq{=CnwAR@i zv<f)T0q9u|5PqevYylWL0@ztHa8vXn!dA|_!Am$<Z6@ZiPRjEencq?X9f%}QyX!i+ zQ7!QnBo~fKKShVg_Q$Q2?SaBZiGL<hUex7RQwkIiT6qlMr#!ycQARB<DSSJ^tO5tP z`fN|W*CqUF*hEYtUPHiAu@%-bmlW*D7-30&DuYfDwqc6Li3(so@f>VCk7xxTtkb@D zVg5|n`F~-hx#FDoaxU@q-ITQ?p*t^2m*vGb*(vX~*qe^8zg;71?`;PTCaQj>?T6Nh zmR8_{2^9Q^C-ed?Krq62Y&3+fP=mLNDilGe8Wv{FPt3e0cWeDGD#^Y?J#NZ*uDm9j z_C(@T^7q<2b(W<F+UoF~lRT)Cx@E;Tc=fm4jys?N@-(;DHP9Pnldk)57g%-P7~>Qq z{k<(8QAH{&{`C#WqAlvmPdi`hfEV3O=byIp7wx-VnEsks0t{FG2$ogNoBr{54rLb8 zmip#v40$aLo5wnGH?%bK)R#(|so@JZB~my;M6kiMH=@za+A^<&2d3)Z*#o3^b_R!; z#$Vc>5O?;1ST*kI-aY7&ppEj|YQ+3ecdV(ffPfJ__ywbi4-lUQK}n?wD;e99N&J%l zgh%@pD9v2dNUTyX_g~sqaV45(02a|8-gSpI@8b}@d<WjA1ERJ0kI*AZs0^?!;+I0- z&IdFGR~EL)+*|cJXYHfTZk$?q=*J`0cIg^PAi^y@s_tQ$@)`I2SrA$ZJ?U(w&mWgu zrZEJ5@U_77l0&bjFxPtS0$6<3>)MQeiLh&n*h`9?4}@39KqFxfaZVaH>+5jKq1g}w zJFE!kCC_`qUMQ6#nhX!V&&c9?=zNAy#U5X{Aw1>Bs@`EWs6FZOwq_Cd`hfi~V~D5j zKz`E}7@P0@Z9otn0pDF)&}GFBI*v&li9G;x3{D;c@L634^wsiTy@b0T!U=oV7`Clz zF!I5d$$ngEWj-&ASx>yAL%2rra3NJrW$jfa65olZIar1G`4DJMj;mGy%KHs39A~;K ziE#&aQE#)j0}8PL7O)PRqzynriU@!Ok{FbL-<Z={;;TeuPSGk&q--|Dm9;np`jgN! zau+B9Ugils(Bp%z7|Q%<#kxMkY3XKOBnXHr!Pv>V#AQP|<k`?(L+G;;GQ$Cz#2h<s zhp@X(w$xq5>yHfyCT0p;fCZ&^^J|VPC4Toh;5Z@n#-j9DcFKh}S+(|n6WTZs=I)+q zi3P?za4<g8ZyxZN9tE%-BzwOUsil?kpD}mlA@fGn+*|{C?M>%Q1pGPl5cR7Ej5B`E z{W<eR&%KM~NTJjeur?q)*T-N=4>5k20Cs9)saBv?zw7=;CtShL(hc3bR4i@Cx~Ksk zm0&?6ZW8!o#lLLl0}$<+WSDhN00)1T2#2_)a_c>fJOsS7SYT^FD?ge=FO<dH=UB`A zXF;)NVnrc7HUkckf%ZmHp7^tlYf!)jlCHjWYJ|Ge&vXm(6H8U^;|Xs!+RfxBurhc` zXky{nnda}?LH#Ww#T(oA(hG-4SlY8}1l*Iu(IpksFF6b(w-<>>G)4f4R!Qw>Ux)1k zl2-s6(iVmcley#k{z`h5rRaeo(2vXKJcq=bP~~^_rC?qOTDxx@GO>BP{GJu?g~UT* zv>vU)UD}*;<J`GiuWyB9qIV5dq~(MESuCx($$^#8Vqp-58Qn%ZTIk+Ab$ZKAE4+C| zKlgJsXz^}bOWlt<$X69T?~T95I1}-`w_r7b8H2FPjm(1B-^8vPBhX?<6IC5aQvnti zf$)XAao*Cyl3l}O$>Dv%X>-6=P=G(tx6p+&p#tc!!uBeNPN)3pyLB5Z=qxi9@(BoU zb$~Yes7lJqwWM@N+%mjr1(No<fDT#`uek5TXG>sn`zrG{G4>&H?&J;KR*t`=6!w^V z5U8DTUqW2sqs`Vo?)I3D9Ym|cVlE-<55cpRM65@Y0e6V!)6Gc?_+~Ow7`n;{a$JGV zSK*;1c`AdIwE8-U;l$AdkCere3K*2N>UZPm2H=IE{}UC_%WqtkHf#PvB>QX?j0T{w zf{^Xxu@Kd7Bv@A?zU~0p!I}1QjFZK;(em<~INID~&S+SeFJM)ipFMO(=Km6NAV;2J zHm-61pbkDC9Bcny7rF>^t>=&4Ls#b1WbKrVJF~`q?ed`cTApax=i1MFtkt4`?v#`W z0?nlbH-?xR8tZD^OvJv?t1}mztfK?T6a2a=u_G!TioPb4UQmKZF5tecBe)ZS-F{m3 z_x&sd@5l^OM(^ySH5J+cwxra!EXQPL{QLK0a9=-mn*>pPCn>0ZGkHaI$-!S6Cq@Sw z7+!#sfSBMXt@x86B!)dOke%|vuzD6nbU{A(4)&s64VJxmO@#AZWu9GWU+}FPZ~+2J z&~t0D_R8;f^GF!1q3wUK<&WM$WBZ}-q|X1cG+1`|uPo$bQXv9%dogU49Pi`N)%3!G zonof<1dnxDKJbz4Kf$DblTD_8>3CC@&qS~&^**ldE6che$;cVe6et29X;_Dy?6<;< z6yL2#dDY7Og2VmeG-$sRhuXcjGsDNQ{RFg_D)LWfHZGP)oxb8kitPOsQe+8u0B_|P zC(|?U`sPf$R3$!u&l`cSk%(lR(dAaPa-5}Apd*cz{U{Z0WpLMEB6Ape#9~#>1$pnm z1W~kudEG{SZ-}E+xHx<}K1Ys#j^)}|PgvXA54_?o8<tRsHX)-mCns0WL)hDKse3nm zRtq0Ak3nVs>~>J0&>mAo*NdoZJMzE1_EK4jCgLahemePY$H?t{2Y?1{>TfO7T?<EY zwZ|k0rQmlPC&>=DhEoP2G`Y@%KVQT32_eo5t{c$n9cHnH6m#)}g@3m_th7C_I-7x$ zRcOd}j>f()82dB-c?^qndj0eo2?n0vx91Am<jrrDfr68j)b~Bxh}!`X6%^AY5B!s; z>FM7aW}n^Vd!_4pl{x|VTmt-@nK1eHg@zkRdXZryZX33z7P`=M<b@(LT4O_7Zt*h5 zkXomh>HRXWuVJ{Qh{|G=pSI$M_WzU9UAAQy$CmQKjxm9a^dxf}-(rfn1O9RTc8Fl^ znTSES&BnqU?U^5eB=#tsz;dis3GlvE;P1MD6!cS|guc`0fH8}lS1oc&=O#;O*5XM* zz=JewsTytB4;<vmEe{rdD=?T3Sa%6_H4*samVTbP3fRzm{;O^~Y$drWq6KjMSHmXC zcr^Ddc&dpMS&a&cmM&Rz%1Y9QOsLk5hK^r;y_$3QX;zpvo3IYsvKE<eY}?CGK|F5p z$Y4y0^8f9Wo!}-ET3*OkXE8zg$W0Bk^>Uu?XhECY76ely>lwl`fSVtKVwV)a&XMUC z!gvBI*~Z8+2U(o~a{I;;pSwA>?Y;i<HY|HFIePNK9{2&kCa^yS?#p`!ctQmqFW@gt z=g2#ozemK=fe&gQNUC-&1-d@ktR5wrgGS!oJba~C;MMU$K*%F6AR6}e-Os#(8ZHE) z<KbajM*8ldN4;&QuLNgu%1S^?$Y%LOeh<%PhW^-n@41;Tw2t9;Fdwu`K9_C(`l(P0 zWOw`jK}42#Zu8a5slT|K)Iq-STD%Tmm8SAO7JT1dj0PC6A3(um0>1DnHIj_E+7otr z`?bbS&~<7e_fM1^BDfl1&hD@)8QZjaP*B(FUs1G@BOSmYZ*qhHoTT(ARLq&m{c$Au z5~U7+caUTrNRmJ=jSo=HsYnYTVetj$$c>6JwAo>>rfFtm-wHu;GJh8-|6<k5*>Z#K zx_fBItLDaSBPtAGLdAt6(EGD?qul+8^!ri|1&9$VBi6?yE+#__o5%7EDXapH;(dHf z?=*PPgLhqdj2B#=f|sfe_{ic%NJkSt!a4$7eO`1aEi=rEKmRu&wh8QCV#zgTe=r{q z|6IB9oW^sLj1heOg1#5>B!ru`3;SoTd=cybViA_9bTSi9@<@aprT|<m6ICr9R!Z6h zShM34!QW3Bxr>%pw9hBk_ebN^w?Eq_A<D{43wTm0DjA`J=iftC%KCoiRp(`%+6DND zy$_3v*3sz>6)&wh2HQ9{;Lq07XCsk(p51!rkCy29t820xr76Jb(o~;v_6@~u)DpPo z_L*2ndA4AzWUBoX9OQjc9e~p%ffcJc0qH;);t0Sh<6WTd89_y%09KpJEN)!_Tyk6i zYog%v>GWM|H79gSwsGpM)|V{p(SW&q19u%2?6!v+0X<bB=0jpj^nr-fjr*qKb4^r$ z<X~g{WrEn>^jA7`a*IfpZ?Ffh*K)z_rL5+A%>vhTSYPI=-at~Gp$?v(ff60+Q-%r{ z>>YQ)qQ5KL<m#S45P}`Wb$bQ9xB1XRVQCM(I*zE`-+aN%7S<_|7*;TqrGgDC-#99G z4lwQGKNP{iMZ%No5v!$D5`}o=2A%OmPw`H56|&|hhx!UfE8(D>9hJOksP2mTlly&% zzF4U0Hw9!rZKg(6{6Z!Up4Z6WBHS~FIR|IF23#r$oiw?9dRDp;U>#vD7CkGGxEZE% zD1mAGFcUy7<L$0sw$~p_NjcOGhYJgP&-JvApTxK1d_tI+YNvj-gf)i9v}YU|RqsZB z8*=|<H95TSeM$<X>=9t6=e~EHd{`M28v2+1E%KCrTb((qYZ40}QiNc#;0O@#$_bX@ ztX%nj5|@;#%=2>H?10&=8ydcbEWdLus8&CZ!L~E#AhZ5qyASRneaqRPG}VyX7&5f) ziPqg1t!KMRTk6)#YpI7L!eyrJQNVSqdz4ec5E>5S?(Ph`|CAgE<`KWn7bEC}HA&kR zzZHBVbuBRFx66u35a}vFQ&sMqV47Zdx9=pWU5i!r|2M7h<P_@uu|VwQ$=_1~D)F$F zMan>Apty2DXpX}(->jNSyo=k?9Pr;2%Sy@c2kJifE|Xu(C0K(J6_IwJZ}2saqju`h zpl<r${!j(ktzA#sPeSEmF)CZ=)(S*bx3>a5=j6pMYd$}!Vg<++J4p}I_xl6GgA{N? z)^06#)B;Psj^Mw2@ju)C2>u?;ODy5d1(cp7Yhh>!_|68g3>E?GQJvGtJ3F)C-#3!U zNAs;z8FH-^@tju<_~GY7>{v)E71un5J-&m^CqSHVK<w0@-orU@_Ae1d-}IXmOSU+Z zWJM7n*m04I7ys%dR73#76TJ1kyx?VBe~|>bV`PEcB|KmaLnPj8G%Jy+iHx{oY>-_= z)QNXw`4h6mG5c(6MqVS;_z6R?;OZ-vy^7HUK*R0VFE4=aagE8fqD%;LpExIu*wOF* z6mW_1Nz08SNw}F+e<4TPshAj@S+B8pS0;I9YJ=c27`TU49|FsshW(@h5z(dyj&PlN zHJ%MO<omb2`6T}Q{f;_K+OOBXI8Z5lmpS!b-oB+3mS&67ceBqWh8LDvRGp49$bB&< zSAL;^$#u(KFK&|!eZtQ?m~kt;U0rVv^6YN80j$OR`&v*!sKg8UR4`>CZPIenG~sK} z5Qh-X(FZLG4nH1SxjvmFLR0$a3A_Q}-a8h0!c_i^#G1m3EoS59=helBAgU4WZue@1 z@jOkreT9Z}^}BW2+y$UI?N4gxM7R9M>6?(;mA3*)qsnL>w(QPwn;2_I5pf>x(&k=w z27c0L;+&^NDwxBcRUTvitTgcGW!`O;XV1LdY%3?Cf1*+YZ7m4;FE-|?2YB$!r8!AP zG|_t^oJ;D1f!<@+O-_%ioGiH2*SpWzN`Bgp?_7x=PQ@A~w=JIeSVZm62dytTvdzGw zmmatGf}=IKI)X<?a~?JuB^+VN1}8s|`4+-CE3urLP41YFg;;^s@f*vZy1#*8XZAKQ zFkS7GawYzI)73@}=TZ9EdT#<`EP~xhCC<hE+QOSNKi$*zZ=!6ua$C%-Q_0?hypuB5 zF=EMaOpp9R9A`c(m%s)OFHt>7f=q82FvwHw`Y(PnBJbrj2LVEpm9YH2DB|qSWf|8U zuFaV}$qB#<jJfkal;E7LoW~Pg;q9iUILmV7!%fP|?%_5WiyF23@MLHXhs+M=ekF0= zFpWytLs>AJvq`>og12VY{@)71p|A|*7VvI}wCq!XNR!$8{n~Wku4O|%-knaKW%{n3 zvq_xbX#j`FG|pP`EMO5iNPmd-Jfl@F*om^jhhmyd<-U~1iZ7x-;>+GLJ78s&WRL&U z02V_z?~D?L4l9c}Db<f3&MG(YdNt!EGZx;%Ixf>3wzLxSkelMNQ$tMM*;-4-@I&(^ zicUikCYHFE5t<XRl`*yxx4MIfW&!?t1h94ICU5Eq_r&tWF|AXY#C$7?gm>$CFAhmO z?rtVKw^DAr=0E&q{Q&KmzXN~ZFrXKc^<F}ETYm^JhPv?r;qT-JgMv?}gDzNT#`k-C zQ%a9hd0t?<t~)%-O-%(9#JH&dkItti{uzmp56cu#vy2)t(0Wr3xTiUd4Gxt!QW4sA zD#>cbROf8$)ED)Rr}MF-JxL`Bb#ndlW0SXe{?-Y*?#86B7;_p0DOl4EratPf<takE z8=xFr_dGIh)m?1hP^|&mybl3=ch4|DtbiaC;1PhUey;N341sv+L8@a@1<Tsfz?2iF z{y{4eZv7?aB%IpuWsJ<EO|qhv|Jt`Pe<^{WMo7}0Gh1xlC#ZImpM~u_{&=gbuf=@o zu}~G^>mvmYAki4G#Xs~e&@lGvLkxb>pa602@s%x^*9!YXsux6rG?Y^|7o$UZ>#!$K zDj+M`D(`!QC~@9tkKTN+a5AQ#`0sx5O6Sb1K8UV8bw&~-NPe+-dU6-C(h+RG1U+R{ z<+~S|{2xhY8VKe0zVY+S!q~^YGZM;PDwSo%lJ-!RLXD`j2`PlkgNP_fq9l_N6-mjG zWu_u3g(PGdi70!v!OT4W^Zotbc;OAt%z5r}&V60i=l)k>bKTDAPfi`f?-6+8SONP2 z>)#MXkYIlb?JDkvK08eo8_Swi-o)D(TMO9fFua-?*wQc>i4|@KT>l+qxMSWVFV%}i zWz)kJ8Z(?;gjT2}m;%*sg3mRgWr@`%hVi&#A6!Y5)M=CDJAyN!AZ=v$)PFM0J|*OC z%#@@40>jAsFJP~$6rA`?P5ep?$CC2k{gtktf42yIiL^cweV&@c?-mT^bVko$vP;-N z#oCpUKaq_TDQH?aKy(@?eusxVV+$im09L3q92bMl0PA=+ARcWYL>S}Z*hb&6C;zCg za4`@w;D`6_70iy8G~A0IGcpAqJ9=T$v8z@QH&RAD^2;A#%X4`?Uyc)3*2%qK==1%2 z-sRp^mXA2sZc@hx)*n7itX>0JhS`4WE$+QE`ksH5!ZSI*lZT%6hRlVnW22(z2A~f* z=V<I_F(_ScYaR9212~04e#*T>+>Y5LIs$L0y`XX6S`^iWW-v{kLO}S7FIR_c=MQ+p z1=CZ)Wz>8K@87<0Ie%LP^opeA93Yz3vkXYg9Y7h6AhNd~HtK4xNK3f#xl5#kN|%nv zT+A7^K+XsQOD#%A0sV*Hn|%oSwM9=RLb4PV^}vrE*!(7P;C{7PBJ8rvR%15TJRm}7 zO4X4VdD)E}>LU@)HgY9SiOKNi#!@GjI75$GslFIB07-uJS%3%VJSJP>L3$2r=mcyl z^~^?r1HU!T+q&W9fD#}3f>1tKgFE5{zs+(@Z;^dVOzmH<3i;izX_>C<Xkkt~NrH62 zL!^Ey<N&;O%^#Q|eA#|ts($<SW6N^+V}CQm7$f7`52FYgqlR5}Xl8V@Np^m2y~{{2 z<B7SDE96a8r7v@<_7&io8fu5#z(LjOU!FuIIg3i9<hJSrWG5U1@%>e~U3l+4!NM!W zk8YXc5?X%~921JIgV`MkCJACkgiOZGI`0ifS%yk(Y=uSV&xQ=b?!6f7i9R7^y29qc zjaveWZqkWYV&0`X!08V|hV1m^q5Wo!pI@=>U+;F>EV8V#7ZO-caH+~Iz9jKNocCUs zSc4fQ`o7WmuI`yGjIBcfw=r^(RT4|`5Wjm8u!F4Yx-k;r8cFEpGTj~LrHWDh^+0Dl zujHn@!DH)qRHqd8_fIV#kv5f#ttD(|#>(+1gn;Tjju2(TZ=pEspS2Q!)=yt?^6!lt z6Z7iD$uuGoaqsa6{aoNEg}<n0uRcBEYI$C(rRa>v-KIQCkot>r{-p5p{<Nu#wYeVO zmmvhu0PO3!<i(Y}JS_#DThnDd1N`dey|y%M%EKJK?eLAvT0PE#uOe?vZN`>ehl?`O zeDZGinA|GDStgD#0DP|X>HNo{fw<@e9D93-GqO=%;${EjQ*|ILii<=*5L&$8XQUs+ z$dYG$^YIZXLhrPS2HMdY<+BQe&aFkBk02;>jG@6=7rd(I6#{ZQBC5>1PgZBTl?yI9 zc=b;FrDyC@a*e)`=O1w|iA#TS>Q+Gb(MiR*^(Un+cxv0%Mk#g>++PXP7Qw@1>S#BX z->}-_3iT*<TgeO4UZJjBxAC0lZR}y^mOqROmg9xQ`S<JAE_xV%#;5IU?%i=)`_mb| zdrrID@CmwWL-EgPtq}$F(VGFfENHL>G)+x+3Qt}HtdpmC^6nTfo`^x;7jUGwRg5n> zbsRt60g|bWE4rx^x1mL}69?8&m|B8veYb3VS_C-mF35r4>X&B#vtsTV`e)jf<eZ~o z5@{Qmoh!)Jn;?UYBk^mN3(JN@#25v!$(U|X9Ji23x#-BTaHZ7QcaOA)v2#<JST6mU zXMf;6JWGZ#y<fREu1q!3b>!owGB#~+UNWB~PCdny3WEy<{Ti<V#C{49T#f+3Sa|;- zE2XZgTyc6CIC6JzsbY+QYs;A@l7W+E&NJ}4QR=?C=H3;P@!$zr?TI`~PA?(nsrJC6 znKO;%QfS8&!70cV*F8E(JRJeN-4R;$Q&7|Z+XswM-=$!Epp-L>LmlS>92$JC?CsiV zFA>8?<i?OUKe{`j0iN{Y(Krxs?**66iRE%4Mrp1pb=iPcxk{J9mEFNTzf0kTIRNYb znJdV5b&?zAcWobg%PqGuzox-}-Ld1O<0pg&gqBeQg#Ankv@Ba3jo9wgoITT%wb@9p z$@k4xx~AFkYnebVl`{#{48fnj9Aq_56jvsut#+<5B_6$a-mYK7KKq%NwU9l;QvwA6 z+XdLLC&P9Yq5oaWK8~DnZaz**9bljvH#`BKp5Xe+1)(3b1p)ZGm^c_i8rNlkX{EX6 z$0YDOEl34dhuac%*7?=R&wV^1cZtPS)L5}>{;mu^RsxSFMR?XEUl%ylhxM(TTiyhN zlwuJ02XEIK$?Q|nTd&qKcFD=S^AXR(bZ!p9l9x#qYxjY?omvOBSMK;aw*H|9S%7&O zNBgF$Qxnpc$HHRB!)nEK$^+|WRC2BQ0UPO?I4oe~6wkG1EM0Pu_jWoudQ~5M=B9DY zK#LK>RQ}$`4$vR-6eMWs4!VG7w#VPAv-ti~>RNl`0E8!bglv3{d;ZOVS3@>+KLY^W z@3D^?aqdMm+3D$^^_S$~(F8~Gaxv-WRSg30u=Y_5>YQ-_{imc77#&5il)yh_qE2y% z#aaRf<`~`Rx2ivAP*V~I`;JByosGtf(*-*p99Cc~y;OHyqUSUT_ehQi!?l8#-{c01 zF-PW+RnzX$7f$5-u{vwKmXmKn;pxK9CN&DiT-WlZ6=>(B$#}HuSM$0BL1>sIc_{K- z&(@r(;y%5f9b_7gx;+ZrxQG;lw=};k{sq$G{2RoT0uiUA8w`l0dt<T$fW|3Uc4ghR z7*Tk2SlJNfi9`K~@Db{;7hCID2S@u?6r6080I6vlcb==$B+HpN!jwpL--kDq+RLG; ztIO0M*?;=}tRu7rf*<3YO`!A{XwnXOSwQ}E{)Z#49L__^-dk6zG57I8&Z0n!!d3*U zu3fLxRA@g4$P-pZf=8{*cyRV}vB$p$2v~9E+M+sMSFlE18gn5(zZqt9vQ)>^#uK+J zXLzYjOVD>{Q&W1pQDn~t0?iXN)<5KGf6_BSh0p^g|Mk|@6R}=AZEhY=ptyKXLlIN7 z+PlPR8&QH1`fnBlPIv}bpdo;;1Z2FHa+udyN)CdS1$x%Um)w0#iu>**MXQi$8GOT` z+_2B;(b&mt#z#NJ)vxtgqZr-a5a|h$xE9@g|EQO7=wAD=TPr%M@}6I`3Ll%X``r#n zQ!QZX3w-0Ms4Y+l!=5RENQ!quG#cL@u<t3Go4K?+DH=QANCd21aa)X*YBJv*@BcWW z%0-r@2S-Dfut!q;{z*id%@@YZ^rG$84+1_w>oI8F``ZVYzSHH0Kt#AY_}jdjXEBes z-0YIl5x9~23klz4k)aiS+~`A~eZeGmGAB`dDza9A@egFab&R1ltGZ~Dm!wNFRQGoA z$oj=HFv<MS$f_*16Hp9)O=gl!=^C=0Lt!tupT=@v>ietpsAd(9uFRdaUhv2y_n$-t zm%GFp0dp6ly0_VjpA|GI-~`2e5!m@WCFvWAZ&z~avbsR}^3l#xnnnpcq-<-@Zy^-j z-h{>gb5QtBIM5U9XX>5YatsT$8N!5d=!eUA;2H8VKLhEXDHj1pGrDtfjR=7{6zwPS zmC{aU#Ae3`%rVUw!ORC_jr0X=x3zWy9bFH(rdcvo`%WCns7*e7QC6f~_t3tM^Mel? zPfdp+v}Xt|>u+<}bg0`d;Is@z=FY#e)ZYMbs(BR!89s&r2|%KE`|*8`VZZPuoD`{q zq<^sa2}L=|e_XxQy2x?ERDDqT-*5?X#=jbQRNGgPCJR!ZYBHK11G0F_AV`kw=H8Lh zgi*cx7}S3rA1O>_pGp>)|G)=Apk<3qFOJ3(W~zdb3XJm-c$)`xwS5AC{LeUAJrs2j ze~9Y$K>mjIMd*P<hP*aI?6KAw^^4jHX<F04MsL8BY~RG-37;g7*K5nvrZq$CqZ-7( zCUbCFdt~zSg>F!~-N}e>Bf8`JSryQK6RX$Qn)%jEM^ggm3K{>Wa8?`4CxwFOnd<8I z8KJnA5sh)s0yEv6--MV!Ec|-pdD<L;4v@rZjIjWORIq~SD^(On|0$eG25Yy7p%icF zT2z9IG`XR($R#+J#f!M=VT=Tt*A%=4cxa+lHO7Mb!}<baQb9pilxR5TG(HnJHI)ma zURO*+bJN)qV^l3&ErG1B^cwZiUtIsSx&q=f%U<p0+;=&KFm6hzx9SCQxOktGrg4-6 zIG@4|c-$}?nT)=il3xcvaehMk-nWMQm-$IPEV;7nAAGYlpW-`E@P_P!0D$|lbL}42 zOmd*TIZ#+h$h2a3U=hiO1c#L`YLocaV$g#|f(tUs(qFjhRL~cS0Kwhb_mc&Hw@Fo& zk#%iz6q?uCQN8l`CxE)TtHO3l=}EEYnt){*%(MUean;d_Tft;I*uPpS$V7;yeqy<) zJYN`L3dRs-&)uP57t5Ut(=zwG^jdg*Nsi~Xy~tTy=ka(twIFvEdlzQUQ+?|={VwdA zJ8!W>&Gq=v)2;(*|E9IB8R_u6lqpWD-t$5cxf}m*%(L-`cgfwe8G={bryEyYJ~eON zAKmP@FZPdAS}cxCft@WgN`Dg(fg98!a$K6cTS%?7o(8vkwVME0H92{|iE)YfCt5wh zB7<k8$PW~wm^bF`@r|-vNGaY8Xw&yqe(ST(4MvpQ2>-=JR&6jn_Vt5k|8F8~twMFm z&+Qhf)x;^7zb53EOid9!PxM`!cMLj_!=Im}!1Ts<;Iw)%iKU23=40jv(C0fcC#mU5 zWSs;?jp^Il)I`iAZEwrt)2zex>M8!J5R{*T|8<W5Rtp|!!t>s$;Q%+vY`7VvS0>>r zW>|Agp<!@0dhaWCjm5PyAKTU+o0F4&*_d%Bw{Mw=2Z}<3yUOIiTuT4``s*>^heY7E z`*n=sbpxjfJ+@=5zqm8_^@4K$x@!%c<;4n^6K~_10U8YF+OT)crtjZ5w}}kLn}eir zH|YKWR?(ljyr)?vcxDcFv_NhG4&yRD6A>;AYGLbk>Vx3v;GoG7*CS!oj@P(DgA)w> z=}>Xx$z<^@{*eb-B^x)aii)1XY}Q;htd{Y6LpQ_wu!N{=6)$WM>HJP+uaIi}B2{&X z?uWgwCI9N!*)htT3BNrg%2sJ&c<@47X3UX(rp$F<s!>wBUFu@gV+lGASLc{!SAbI@ zGoON^0rK8V1Z<H2b`a#`A`<8Tw73LtbFr-uD=}VP2GA<2rZT{IsDSaT<$sFBl5iW^ z_+O>S5k_SVBOFtN@}n10-EAxo=x#JXHOWBVA21_LfOmHJ{Ok%~Ir<OVNMQ7cfw)4M zMVGWr_ttJb5@lOvQ~nPednLphunKSS<!&6F_BHwdrbc<0omtziwENtR>yyLUZSAcz zem88$)@PHGVECY{6Kq_8pDZ4F=acQl4_qjAci`7+PAkX)iD|$8y24xQw4gW8<eDL{ zggI344uHV3({UmXkiw{~1-QGyr8pH=R4ZSU?GKtIQKMRIZ+riLqYas`G@koi9Lm?c zFd#>sUhw$#m|&PPkKkHF(ba)cwCDGf=ZRqESKKv((q{_h_Y(V~;C7V9mw29kxsJ;B z`p7e!ZJb}^LpR-k1^{xhVG<;GuS=x<<{S7rADT^bDBLqt-{o}+0S*=k7do>SwMXe& zq!@5&Vacr&7;Ml(P%pu$S--edb}{s+1WgZQCS4p)+s%1$C8hlHS9t6BItL}fE@;8} zmDuRF>^a3A?&!Ln!TOTyz3xbYR{vHB<X0@zRO~7_r-^D7WTpYIGn{I;x5(I}vMps{ zCP#A-fvKj;2uwB}yMsgUNr~pU4&>A^S+PITq>B}K!c1S7d^x%2C^o)?g<2y{#-#-G zFHFPq3WPe_>_FgRA)s9rL1t^agxJfjOX^Yt)CDgSrbmN`E~lkt-TJW2x-X^=U(ekc zr7PwW@yu}k_YQK`s*JhNnxl-5aF^R3*I4{`JKT^wrrzbq1}M9T^oIaTd=?u0>a1-c zWrj0*OOVc;{PPvQ&V(13h!BJWcutXq%e$uhTyTU}IO|=1+|WyCD2fKhqc*}gC9va| z0W=DT@De>prNtpQwcrY*KeZhDPzAU$TAAR(x@|$El7(2*w@q%N@-Y({@%ODCBNRLK z0KBt2X<yG?KmeVbk+4|}JCR_uMItDXn_Tf-11N-7)BR(jRg<XoTbIYm^Dl$`nU@4` z#cdhfwPvZ}Mt)Q85HbUSRwJHL&sd?ZxL8L@!fbVn$`->pFZO3QC8eLfRL}5C=f2{$ zEk6xwLI4|B)ux{c0~=f;m_{J=aH`#z<+R%jSeLWMa&};{&Ou&R4{5q<hpbz?4imNd zNJoz-h2%|TlRc1Q@Md5GXED~NdP&+tXONH@iD`{(Uy|U=hK?mL%s_>msAVGS7s=?Y zV`^wDWDb2Xc=tloG>g3aYrC^JOL}NqPNuTDjM!~cJ2tGvj9m-3Kvm|pbf~I~%YYwy zz|9%=eR(`$?gKpwJVLv_gG>W01f(1Xx`W|a2=xEeh+Fj7t<;iUtJTa}-fJb8-cx%y z1Qz8B$FNT)drb14@wRX@S>0b&qMTLCO0Cp7&5Mk`3u)Z80XSvz%2ki+Nc8)EWt7<$ z%^WgA{pl)xF^%WGGiYMG&G$Sm-Zs;0`PByS+*woxD`5P|@$ou_kr_dj%CEXGZ95vN z2p!E)r?ON3;mHK1jFa-98@p;ub=vp=%!2;j__<oTVKMayVO<jnvGG7{NEi=0O7>94 zJ$$&}u_#RzH{4!Pk@?|DFd;pIgwt=ehH2+xr2S6hmK{7k47Y-ogvvsT<JEEXIW+W^ zm($I!**Nx`iw@<aJ`H6^5P9Qu@z8#nrFY%4&tcWODj%Uw8&b?1FS{PtTu}!fboX zoHGRLM-A)MM*d;;pK2iZB21r+2bP=AVo%pctbyZ~iWiC=Zs!?X<F*;0XV(R~6h5y= zdCm=ZQp7m_YO#3@{?^R`MIRZ39U_nbJt~Z+74Dwb3`%6B@f|mIvDC5AxETX|gw>QB zsYT+Nt{11m<#0_CIFBhRlCjX+9Rqi@Xb37A4}4dk$FRp3V`V)i`apx8`iHUUV_Yqb zC#|J^bqAoJH1=K6#=+Y#(N*%+M;XVk-1HuHm2af1B_uc4isDvC5)4CD39@l8K-;U5 z>G)caF4u@;ogxCd^!;u@B<y&SbCke2&;DD$^k;BRCG2zKz_$rF1$Ux9;`Ky$Q_9jj za@dV{w-RG!15>{10UrMow7|&TCcNiU1Y_Kkgr!|^i1(?ox-9P98ZczZC^Ta<3>C-x z##%>NF;k2KM!H_eH0Dv<xR#{}zFn-Nt70La)*ku8f-#sEvkc;N`6ovBIB&1&g~hhn zDdH25L3O!o3@s4^;C1MxUB=|g;*$m7;c5W>n91j_J=8bI>28*cv|Lx$CoX}UE1rFU zL(|m?g7n8}P$RtZ(^>@a)rQaA0~H_7XLlyv7$*xMAQ8)+FH^!z5I_a*_|Aa&S*Y&! z1yxedZRK=)Iujxr_!|yrNUemENzmxHL*ocL2f|y+?_!~KRC(85Q69X8O}n7(&UAfq zT&M8Z5SQcdy=F>yT7Hr<a$a;GC!U*MzIuoL$Lp~8!v*#b<<cjf!XLQ{nlGBeBksPu zrM~zgTm3W+wR2s{-?{4eBqnny8&3}O__T`Dm{@u95}L@Rd6F`v!V9yx@J%HYNz6mN z<zNyEkEFlNx4;3<sF(SQpnqp^B5S&)W`u-Wm6d;%p(u}j=*dh$Oxyn{(2BYFzN>m2 z<<+O@mqH)^+1w9@(_BtktWX6Hx%6NBjQIn{n;)pB{z*z7YwTDb<@4GGJ;P5M;K11> z%MYyOZP*ZkcuvK4ZK91cAh^ileV)bcKn*BM<w8J7cs;0AZ%(LMwG2rc(*qqA07Qsf zwt{94tJMMxQpK6_!F(M+!4LNWQE*2Q<atcs1M4(j3WiFQ#8@nD$_6}eMMQmbg&a{l zxcZ89Vp+U&xK#>JE>%1_MAgStqcPqfWf2GCvN&|+cJ)TsAX6tP$-O)-(WFXl`KTDE z2u#K7`oD5Bd$JEE9_(AdOcE}RNJ1gt8mDt6b3pTN+&zXc$M3c4B+Cdm5ospEwl1+R zpcQ!J6`Md_HI&Bn^EvySQBTHPoA~B*(QgSS>TLIXSqxZL2d8sK&%?O07xYT(54ptA z1gkcD+Af5enGljClaww03|o~WeM(@~$UPxlP24DQz3%7MYY9cX=bcaMwsBWKla^ZX zgv@g^p4J-<?BeY1!GS{QhI<VJw5kG``h>q&oa1qo{|XNjf|j!1b)Ve%U%HR~>>7+& zJtFN`Ol~aLLM=TX@X4Lm3!Fab?B}|>U<{+-QZT0U+^Xh$NN_A>qU;LCOQ<Y9&Dg38 z_DI7t+Nv$fTeM_kWPP32h)q8Vq4n1Q@;O=Xd&lZOv-#bHBR-TL<VMZ>ji2<Usf`k6 zPw%Di%y&44ywe9^&xsb#^l1iL*Vx#Y0<Rx__pDM#AT$W?y%b&RzEH8E=ue(B)qf)P zzT-8))kQqGO<0|^bskdhAF2$b+_Kr6PJU1V?Rk#F|9pbic0-DG=^g&C{_4+*Pfdrh z$2jkti}SPJY?`r?8J`4EfGk2lb?T1E5-!=V`D&t@7VBfI?sgBl?$L^7o3R>MV7cH3 zoIW<@(MHBi1{4FR)VcwdyV7;Q^ube}+xeQLcYeCeV+c)W971=LJbmgQ0iNGRtx`ll zc@5+a#zwJ*2K2J)g*WkZ#E)F0F{gv{09zhUbJ%2|@6LNWYi{m*WSYt@#H89p`UcHY z40CRz#r;#NvwC}qQ7-Y5{`rGx2KLP#<J{Ab#WH?3!DHD`VFIrXO2D%r5tj9^q(0S0 zWN`6HxJKFj2#G*pZFH7<=y0Z=$LhBHP42Q_)%@95sWVSvxs21E$Z-iUe~cEPAq&D^ zFHBmI=k5eN*7V_sgR|0PcTr2z7D;ftwK+^nc-qm1x7F(?<BDc}!&JCgZZ^-yLQ`RG zM-1mA9BEj`d5kM?@&^_|ryZLCEgN`CJ!4P-QyqMQGVJ>a`#VT~T{N1CM_!8J&fvf~ zvs=deNjxD$+8Rvtn|s*sPF)l3KL%)rhtG~f_1BS_{tqHrE59Z6Z^9zqN%hCXo@={? zx&f!WF>03F(5|oUyz-Mo=VtS|90V;}mVXdwRV;-1U;OF#T>^}Tw+DoD_Oboo|H9U@ zS}MOE38KJrIRJi(ddHw?8_1>{A}IXH=@<xjFX<!ZytSn$e!23^r>y`j#lz`m{;2nK zenGb%(<%i3*kPJg;+PY79~FV<fpq?GWC$3vfF$u{8=gVrOZrQ0amPoWO`1OoqYjE- zWgg>I?-iF<)~OT?e@@xRD0^JTP;ZakO~bj1oaGIdE%`YH+>L$P(((RZ4x&L6hrtv8 zOnrsPfyvfgt=)I<2$4o>$0JaHf6qD%38+iqQScKKXd}Rmme;9-7z$6yhq~jvAe~&O zba)NuFEa<$S5O-^i|dAXD1*ZS-!$g*ekM1i9$(K;xTgbQw~y?jtPJ#Skbv6`6eMr6 zNC)yR>dXz%dZ*`_?=@J#Aeh)|-LJ0@Q|j>^q(vO;^atpR<?+YW8$IqSG|c=uL)sQb zVG}{n2L5zojx&)-XWk<M4?~}0+`b*`un#q%UUd7f3B~^vZEd&}>{G%<m4L??<lA_3 zwVCmV(Q>&g<HtyOW>Q7?(o_BA(59#hB1maI{pjM=c^d38cK*$=N|6NXYxV9xChXW_ zv6Uo(<jplxx^Ow;e^L)+%E2616l;XWhDT^M8}xu+_$eAZCNM{6Uj$VVg7fV{fq+7t z?T4&jM{@*~gdyIJl_MwcoqqSNqznbHT=YLcN3Z@jIm=2c_D;BfjEN^<sm0uVaj0(Y zu4%d}pSS*j{`0*FNmpNZj+nc00eVpQOtUtgc4F{Bt!QSz)wOjP&6O}125)S)aG<}) z(SjC%TSpjt$M?aJP0bWS+>w7lFi=B*;HcH$??QmnkvU0JOPDY}Wj*k7H#%hdxgAFm zoy_zOR)wNa;=CmV^n8%`&#S-k@5%SnK#|l#DlUziArlD8RKN<0x$q8uoBwx@ytjR! zZ~{D$^slLs?1A6c*4wovUh~k;8dP@zuU0|v2EGP%aGKYkG>>@&>a`e@j<Gx26R4(C ziyTtohpAK5<FcwJy3TZN8MEuj8)>NI96N*a8a`zvPiWDlW%_TpB3<H4+DQs)TEh+* zpc})Nz(VFovmK6ouorOuNkjTlIIvtsdMv<u746te(SjRvum_WwoHws$ymjZD7~1GR zYc{<6N;+`oZGIytsL%c=@HFKG$*ssebcGoGX6JG;T&oC8?d<GR=-I>rU<0nhR`4y$ z2WZrPEgBgG%t}=evyz3x+-r$P6R>mK^suZj?G5j3eay^I`ict}%FzHa7lnZ+#Xo@> z7ZsW0iP%XkeHt{x{gW5$%_^ZOg3jxd2n`u9@mGkwgim4=bpK;9l6U-9x*oiPtGYc# z1{1O4?Hk+au|AHIIaxfKN6iGxPU!3=-Zx*yp0R)RJz*c)bf~;}TZG1tn%~k_2@q%p z{Cj_WjxZ%?w0Oe&wh*0s1V?L91l68c!PP0d3w1<fCyFLE8aOAhq(7nPTocIPb~sDy zcfsNxjqa8O)z{MlAlRHGnrW=4<*OOjwGgmgq4PAMG!GVD8F0tA?Pqx}o*g^?T&qvh zLgB*4sjOQ<&L0>qE^9@cFL6^=Pt$MfZyI1-Sy&Y1*m@YczTX%Ts<3=SwMKA$d}0`i zL3c3GAjVG^>;xp(hdYO6<6aE6!gZuo?TW_spzH9PrH=+c^50dFXMe}h#wNv`j~_L0 z0>({_&PNClc&gJDG;fJqsw64%T8+Za$5Fz#4X$Is;?ojwYr7YOk(2oT8F*?4RVF7= zZv*}@L3fexnLgqF6(FrT>bI4G&1ZxVsrhPk6UApdI1Xb0H+Zq0N>w>J-K_i882<Z) zn}4$_eRiC7s;rd@R#-m$_*3L}*Dek`BVZ2zI87vBw?qIrN=G0UBHDOwD;_mb0oT@n z76)2_)nx=k<RuWm(bt~u(=L|W{jJU?AW4h%qn;SqWk>fXsU$J3gaGAY{<l{Aq_L08 zz6!JWVe<W}1j!pTO01_)y2X)?cnZ}d6l()}=2H}#bV0#668P*7BFvapQV3A29Vm`% zI@^n|hhif+>3g$Te$AGQsS*0SsjUN4$!U{(*%cYd39Tckt5!bn2|ji=j%7_<eJlT? zkBoe*J`YJl#qSJrzCkqz^k=oog24wq%CK-<7hAppo!TkfnJve-=7zlPnW^EGZK1nC z3yMZ5A(w|XGDQ%bP3q56`l`-IjCub)|2UHXd*({YB~D7GAkcZyd0K(_+|CpsZPXV} zqWi4`PGdhgI;6~mY6Y<mQ6-|J0zYx!<lI5_M$sR5b_QX5V06;OXQ9md!RAAeKWCv< z!k$G+agcq(&b#RFV+H_90GO4<vJiGn7BYRYhUQhZrRMx%&Q?Jf(KL~ISMaBzQTvyp z?|a4yd4(#oEhSX<V_?5pvjr<{U#9MU<CM)umx_EI9^KA(2j3hwwm$ptryj)HL2E!y zkWdiEh|rk7du$2Dr-FRoV3j5Q7i&O7O65ktJs>%RZz=hlhLHKTdky6foKmmn!_kWu zY2LM&2uR)zD5;GfYXq!sD&)X~d78W{z#(_YotI3!oAF4*COmBBxA@MkFE?0I;x<s> zQKk0;#=g!zL*{X`yw6<vs6JYw+;Z<S02lB~jigh;Kz_ZQqqMm2g2#J@)mU2fL}+2~ z1I-tUAH4Q{Te}9{!xhYek~Ow2wfNMX`Z89)JwS9dUsO4#)2AA5<G6sSuW4u)o4Cvl zDA<ico`DC>eqc|I?-fS2vG_klhLZ3D1;O|QxWMKQ-c^B(E!2=lLjX|~e2`@#Y+>BU zhtGUQ^0?9OBdXr&F}qpfl7MMN1J6mc&VKq6n|Zv`7*l2H{w*@=bADZMlJfMK%^%37 zHnO;BYiD7ov{Sr2BM|t+N?HhT)j7VFX2b5Nibqf8f$5B3>=E+(<Q=S9`iRi!Ge~D| z|9nq5mvvkwAi#jxp7ZJ%xhF}B>=V^m1P6D%bxiu?)@J9UwSJYZ?_OTYmBU+kRByuz zs>SkOe^OU`7j<4}vK}8d-?8wc-jU(Jd@g>U{xbsUk;NH=_3%{AYaq!gw;4?a0=fSl zxHI_H_;NB?m!LMJ^*2w5u<;Rl0~wBre$8`a?aJyxB+vfKaz)E8D0!cKckNApa7ohq z+dVqQ#=qANWaQx*9L1FHkuz}w!@9nN&o?gt5s9_GiigGbQLK(B5jzl^gHHeVakPCe zj~E`4qwB0u_;!EY0Y*JQSkkn~1{H$-7Al_ECZtpjkE|0AaS#AjI(M}0;B~7KC*^Qw zRtQ|8du(sPv^iZxoxHC#Y7G%oD5YGXrgJf;oi9vJP3KEnPjIpTI82{8&1<vZpJ%b8 zCmJ^N_(nN!ppsj^;R$)Z>qK+xy%{ggdIZEhl}{b_Bbg$!6d@rS7%tl8hh=#wD+RhE z<gECr9G`9kRcc5HJ`q&uM#j88CNOf>L%}x&JwRh`rg-aFQSQHiYvGsw%k}8Tm>2-w zOkLf1nvAU*I4RVg^uebL0dhk=W`KK;@NH=W&Amm(;ECh%SL>bQmG7EZUzV{NTTKGN zMk6}JI(qND4RgJsK8rs%yw3bHm*@e1J)5`Gg@^Aq)D?2tJ|_EeI+c5Lt+7DlC#D`0 zEvntylV6|nB23|oK9-SpysbOk_FH<_sbOkjc_E+__<M(eMy1^;#pzk~jF)lTr`x*y zo>)m~3uLuTI77<>3X1f9^Au@}JEDVn;FLs8yNgiZOox`&{Z?}&k*8aZir-|}$Ev-S zc&@!WLXCi*r2WP2sLEqv_rMixCCPkm@xuD0x)n{)2LEk{lmOk8tsG~gXsccoQ;N6x zO;-Hcp3Sbrvv%$YVv&con(X0vyt?W$C{|<oP4q=!qm9{HT|&hfykS|TXs0l4mg8K7 zSeg{%G>qTzjyR*w%fpTHutuk@-J7VZmILM%3O=@vw9@y@N7+pm3m;rmm0Mq`k?}`p z-x0w~m_+W=hR1`fR5dbVYZ(K6I>G~mDj6N~n+G(H{-nFb7$cNFB+F%-OJdFw#PbP} zhGTg#TaP(nInawp2#24}%6hseqe(|#vDSFp?EAgT2>N#$|De{&FP=2C5GQV44JwgJ zd05o>5OleYF!pcc(62QyF%A)w!rx0r#}u}zP5T8iV`5}8@sDv+lgc8<@Da&NiGFGn z)1>e0e@Z_jU+X~l;OU&ciSQq|bFgAr7b0ke$n@~A5JruROe`ptUvZ*(cd_5)lYdK^ z6HXnlNl4nh%Y5TNvCj>+#BhYt@<$T@c};JUaq*$Y(?;DI&+}z}7He5sSn=JI`RWMT zQ_orXW#wQ->6_xKBP^F8!PBx&7n4&?WMDpSqSG=v1aRt+^LEK3+vG!<@ta0F1{iBJ ze(4Wg5mgA$>D*hIW+;IE3Z%p@g|=zp$oy=;Gj1k0x<%_tvAQ8oU*$Hnj@7eL;8QO1 zs+%@`Av1W5vf!MvhTP;oevCfiCrOya<Cc_hl1X;Pr2aKD6|qal+ZwY)kVpLy?+8G2 zHBaf?>MaMms7V!vB_B3n&5xBhnp3KjexJ3v$3_&@$foKH?OO#psme$CJ8g!%6?JI= zp58UI0qWZ<;)hpNS=vsip2YQXOskf#oE4`8T?v^V>LEwb4JjZxIkf>BV+;g)C#`>z zeVYE#6^V%a$TQLUl96D*iMnXs6=?ycE*uhqJh#lt@42-U>#qx&ZaeZl4~_-5KYq$l z#=B71p_gbQ99y1W%cRKz4*lAL-5amVF}~#O=l+qr;VaWOMv6#R0ynvz^l9Q|*!CmX z8}Qs?2V|OeKoig1Aoj*bh>rs_FRsP>8Pkdp>6z=1?itfz{yFa7+|4Wc6yay{MV&N~ zK}I*mOliK*a*Fd185@H$Kmx^>5`;{^wgxwcLO+%`6nteh{T4n*4g}JIpcVR2L<l>* zME|Q(3P`voQ^dln^GW_RAie(c=-)CnyrdXoZAZW|o@9EYaQNJ|`}7A9#9bs)nzxps zzYus$^;*E%S9#C8=GZQzA-(>-ZLZN7^UD0)VvK{YuBd27L^W%(^l2@@Me=}9D)9pW zViiBWbo^PXspk|Fd{z7Fq-d0|`C4wThN?_(BKeT)l9P^jqS@>+!~Fm@xeC*4895YU zFLZTsXeH_NiobG=ov)?><Qo^MD*_g@X*4nKnz624=#Ww55w0Qw=VR*_55AEZ2bQEh z@_gZHVyw`W)SU=mBwEc+Ee7c>4P5rHug-DUC7!sjg+{Znp;@ooBZjB^J{)xEg~jKg zeLAQDLH&d#TCy54D7}FbxgU?)DFm7nZ&cH(M1YgDX&guVpQxJaTS<b`*xM|2I{2a1 zxHHx?WLsX;dYOvs^e$@pPqz<*MjGWM=6`hLfH}>(h<ru};P7=a;qe~a{1Z*m#=dKp zo30J(K(u9o2d>)o=Gru$zL7t$FS+?Cj(dUlw`|LlznW!3{FLP)!MS>3sWLaNH2r$B zoF}}JhTp9_^for)BvaL9@>o7=0p=&4agOy5G$iEQo1_y-Jmd{_Sq96|lbs^Osox*2 z<n<)r@w42`SFtziDy~3nl?PPBy=InwPYAA@<HDIrdy~+0q{5@|gEcxsd+Mntudp^2 zz8@=M&i70%nyT)^<1WRcNspgzERH{%sw|x^t37Ze(q7HoK?&N8)~JLPmJv>pI!)H; zBh_*6nDt1y#Sm+=Mk~*%un2o+L$#`92r7Jr{-5IMnr<1<#yQ7R(T@kFW_ICmUvyU} zO<s85fx9>`u0)}jHP&GMy;%MsFB`uFQE+ZPAO<WG;?;9d5pZr%I1xL&CNAZ~{RUG8 z7MxzlEMY(9DY+ALv)M^*t2wzC=XWk8;8yzwv5?>-_8EnUGq<B2llKnIJe|&p%{{(J zsPlL59mVP7$|t0QMt}dTs5l8)i=T59>m!4{DNk!pQ|nG8Dn#{8nt$RO=)>y8denfq zh<PjX8Gn0EG1&1UU`wSYs*ijVrNn9~i<Da$L_z+fzx_cv|I{5p^#I-ZHWp^blX?Qs z58S+qkGg}4hw~T1mhvkrxIwzVX>5xabbAbHN}(8Pd3)j5BD%Oel%)p!3Q;y-b`ZB# z$UM(*KV~V4$0=kPi@Y`Qv;Nxn@6{R;gKYlnrX>|`<3GQq!`(z9)N#CD=c-#}Q0KrC zyUGZ<06+6!oeo-Tw{p+zi`E1BbCb$swqiskh1O-eXNdrBZ;O^!1wglDPp3o6aMJ@7 z+S`Emc<_3A;h%Zd4%lHg8txl=p<uP=xB=d=yjt^ZbC1zdZ{e7~a7vUv5@0~v5}3$o zZ22&Aqe_#+yg|J!P!JVaW457*AEm#T^I#Cmmx=njpxG+_Gk&T#^F8(N!f^5;R=5Gt z)gcT*=&tIvMcuvWbHz%v;Eu+AGk4yx_=?x;Bt~Q%<LP$ZgD5C?=Np2~88AFd{F{%* z9TUOj8fo=c0QaaePBdz_3m?`&lqHO*9JXb@XuzY~m<D65u?`j7e0z6!WjuG^>7$pk zpRgZ=%xi!7DaP$RE;7c{fs^aWq^6Zi^}0-N1MOn@?<H`y3wrG!5hrIc8|3!>SlLhM zetlph@kZ>^qbKB4mbbErg3W)ycH|LzM@gOtgpqo4#-D}s>OQ|0-KWUEgDW3pM@8yU zMiv$}-<~sH8k=Ykd!zh%k>4^?^+%;|{+ht;E%o;9D;I9^+@1dA#E&RmpKE?F=qPqE zDrO41!j+ieTcF(VFLd6CV{|e8i`SLSa*VpIb$+D_&$jowKh^=|P&f|P`T3Hk_tWBc z#|~a-&21{2D!n(6DwCDwk$Z-LAFEuL`Q-CY%!VzD#~H^^m}{FJ(PB{TSNfe^ies5L z2|#hTE(dGz9ZC(0;?N@W@be_{R)Cv!h5d(Lcbe;aK&rbxuFm)<=VSlYB=p);z#XIL znGXd8I_(ACg^q=XcX*ra9w)38RH^Ol4=wGF@X^z&XS_Qu<<!MUZ?vYq#pdtGzVo@I zN8kbPQvMbi^ccHc^Pj2bbmxytiq}3_oGRt}k3<{NW4eZK`Sg8mu1vGS#_tMtH&^Zr zOsN&ww!?o{w6BcZk1*tT26oruPgUl_dh1n-4NKQgTs{EZI9D6g(m1cTa#ugi5DULy z6LdB3RTE`Gt7)l2OOQi$&-$jp<Rd42DOVS#zc6INt2eZ--ZgC^oX99Wz{?*P*amA? z_V)c7%ZCNc#Q|H}Shc%Fu^qHJ31m=gl~j`NJmFH_nif1Fyy=1;JL*jT$zmk|fmFfX zf5>y|(-_q8NVV2<$9;r7O`J+#dM$jiy{8F1J}xg9Db6-Hlun+!F6|VuhioceUqC^< zW%uE`PX?u~9veMblP`kv+~jLZyC|7~gKhNTZ!xBb_ic$70ibnU36VhLH?7zfdavs3 zB(ZXNeNoXsl8n}<Z7t&s<MEHRIp0<`d=8%<|0pPWzwpC<Ni1wnB_Zn)D^ntBBK=>{ zLH_LA6@mG(^J9i&`&*rx-{I17)Ed>yFJzocHD5gO6O-0q+z}iw6OZ~`$ZFz21JT2n zT@1OfF@xOkV2$*~jN@Y8$ePm@Sh_wT>)d$p-{s&*j<%rh9`!bVUbkm}v2N%HY-SGX zEq5Poj?L!W+M5G#XGrL#sf$;WqYsft57g0uRlo@$al@U|7D;rN4fYK`*jR7ufuL|p zO8fAs;HfqLLzq2|eOfdiZGfzqriVU7f(}S9>up>l_RrAJiJ?uPUkP{g^o-G=HN(Lj zXRn5hp1?y2&u?4G>-{8?J84D9PTAGooa!y!;ld=6v433u9y8t-A}f7$vs@@EYk4#I z-?f(*`n7f^H}+mc5kPDA(6YQ0SlCYGSDkvR{g%bfC27{p1sLc|mk-5oB?d4JW9({m z&y4ee5|0O9R>{M+4-?a1T{jo9!W0wMUBYChk9zJFJDu+PCZ3wXZAj<pm2&CXUv!Hc zp_UbkO3i4HXzTkUpNQaUy;n}k4AAX*{>Uo4#ahKc)$gL{kG+n*Q81`;y5ItT_sySu z?G7-eHWL4)d<vIp&b)GxZTJK^qU7~id<`iRV&gsVo{`!4Yk5D7>cb&`&AYYvHNIa) z9Ng@^nRK<51z}3h2=9ldR%!Xsq7LkvzYniiN0}0FWjk6nR~4@gTN;?1uKF<6&9@Br z+A$f@no{20?>q6}fZ!H{Cbi5-L>ZKR(q!crSoSH(=#Vf%-#uH?O{4V21diL4%sI!` z4ohVou=gmF9J^953PszQ(IhQ_Rsu%6gqaO^h+z{Io;<1D(_6)4-(qv8L%s?2bj=(m zJK+hD{0q`~>*LXicyu(h?RqnciqY6LelcXhPAceJ{|MYw$L{T5U&G-cZ~QR%8+2wN zzY2tI0$f^wkl`btu)Q=l{E;opi7>oFMR|ksjS|~{KYI}EnGP7Y4ETvmc@peR9;%31 zW&qb#Gk+r3^Zk69)%b#}il}kBQ832^+sikHBQA3zN+utLLfyJr`++(_d-LIK)}@}} zoXO#_;m?s5+;yAB^<8Ty-s3L34?ABb7UtYq8aYHwq$)3#wodAuzb<vP|ICnf?Eow9 z*m4b^)kJ*cnd@I2!)kLhM;2I@xc^lcioo4?y10Z(*P4O9>2BiOYoG#Dv4HT<S!CM- znW=vJ*JJ=ng}tpT3cfFH0N$R7m=;f1ZqTmN$te0DSEc~x?S@yl&d*p8U{7oZcjQc; zA{Kq3(6Otc{jiEqIu(%lD|QNUUUm6;$iI_{v`?pEK98~L<na<9t=0(qs;@N%%=Dc8 zm$=xaeew9Yn*4Ugr(O}hf6sC+jwT#4K|^ycKm1xBqZxyn<L{FDs=kSr|8mvPgC16L zA?y9Z#l}L6r2O*4tc6<28uDo&5=%KN{5_p$^XAy5Rse$<Z#pJyd2|}Dt&!KZYPma^ zqY>eOustgn>%nPg(S9?-)gR3-sgr$OLN3WxJqHe(F;z^JC;i9;?;Bm@WJdqk2s|vF z#4r&wj<fF{XLgr(%j=eYXId#T6|;ZH;L=O$U+Ba|&~9rAHr{sCt2s2&tf?u)`>vRU zdfVDAY5fq3v^(@T)y;X|@{Gxam-l#mwSC)lIs7B>So3#-kB4Z-7pkY8jm??$T@Nfb zO%=L5$E(rbB%*ADeJM!Zwbzg`nzM&JxHW?JxPu;O!CO6=Klk%yeR0I4+C%Jfl2P>4 zJes%ND?%A0;4tS{^YR@qKr05UZ-eLc$^xcrsZ5w%*6i_`fT&CLQ7LY++9APO31<_^ zh3?E?=YCP#@xL9iPlBT}UJ|sX`zp_`l(BVp#XJ>PJbaV)pw^1vPg$2Q1goB+P=UTv zT;{0heF_{B)5pl~y0==Uh6u`|<FgzVbStY2e}&?arQla0&)adDRtlY;8@==7413Zy zVEog6N6&>Y3hNU%1xgKG44rK9z6bAeWzuw6$}ZsUA=a9{^6Tnr+-AcenXSjy*|D^c z^bL{n;H@56vwY=LiWU4b^j&Zc@}iCVnD?Mxm5jS@xZRjUXY;&;4cYq&OHzfijI^Uv zNI|sY#c#aLtU<JdqNk5*?uyYmq*onN#(wfoC@ey7D*l917Rk?2718tDVm-9j*{QU@ zsR}Sp0`{dKyoa{00U@bovGbrvx9?WH(UTU5m*ucMT4VR44i(*9yjxk0P5xSpx^iZI z(c&#tU%zo_r*Dw+F7X-LoEObr)T8|Bz2@7#ojB#U-T2S_@+?Sto2#}SaGZjN-2um( z0E7*{7fFx{&;m2jZCUsl2u`883h2WxE;bT@i^$X&tlOnFdh<Yqttw%krNhH+Tz3IE z`GLB38S&Ov8N&B!iZ>g~DgDWP(6t8vxISLk%zO5e*ZT{8Y_ELP^Yh|_<3XNhdQB|t ze%hMXS-1Xtu-}R+h}pU>;B`$&TAY<Ro%?O^>cx{ASjgH7i=6y7X?=RyPw=bqB+D1? zf0O#Dd3h?ME$I4Ahr0de_77?a0uJ+*4<GxszJnz-%)8?JIzT4s^@$YY!PWMjetd_P z6`DqZrO7ULuZXcf_wjEq+ov(>36KXG9(4!=hJb>9ta9A*-}{jL?$@x_9x7)oHRP$E z*Ht5mZJF}%{j!9c()*@F44FpHca@9(y+V6-L72Vnpv*Tduq}-a9dZlAK~ELLv-WuC zX8rG1_xH_ls+tRH(xhKAPuiMe>P2U24311nf*(eZxUkWN-Qts7JmaN5WD(W(>KQJ1 z^N?WeM}Ayufl|`dgx1E?0$t&}4*}Lj*50Klb(nZC|689~@3Lyt#f#cW0eZai!b&%I z-+5~PTWnTDAT0v)e{+jE#9;Ws=%mQtkx6<(84jrTon+toGV-D2@{YGehqH~UQ)UM> zMadgC{J_bV5>HMEw-`qcmA0xl0ZIojcSHzwv?rBB<|n=i?#e+N`t$XfO5zts!`DV} z!WYLIaOk6YGxJsBSu47=2&KKj&GOO4fSHwE-J6NWNA0osZTZZnRQ|m7$SA>0&LxMM zMy_|+_3+nW1;M#pdzyKd^m{JH6>@_fuk33+S{JhVhvn=1+=(^(l0*~Aa&d$i!$@#* zvC7)76NkcBzY3t#;e-K2Tg&@RyJ%oD7Vu_{^?3qAs;OW=^BjU+dtGAS{TT&UdZ#ai zu~LUmU!tHs<!TO|pbdwDlTy`0Im36FG}oB)F*1j5R1YD1#}Oe11NJ(+Th(jhSDhEi zI*XJiqKx%kTY<2Ajm?i`dfpdyY!4~ix}j?EM^w3W2p(id*5()W&)-ZA+Rn<t9L80r zCTH|2nsav3xXu%fw!Bk$rQ9HEy_bS|wIob%PC?c@kv6^HhLqk8_|!I8yqw4~UQUA+ zOTl}IsCOpgPoKdjYrHUuLlZKa*HO@C-93311(m;ts9BXZ*Cb>ZXD5e`-sTX{-E)f; z)_|?e$a}ak^GkxJ;@N@W#Wj5!=c7tieV@kJnthNhAbq<@?f3VHVM8*5ECNzRM;1q4 zFn;V)RtmmK2oVEclEU(H`}{8~mMln~`!`wsdUIDm>4Z>v^0gPfEK!s*wA-dVea}bC zyt1=la@bx&<_mA9byCdx9~OLd5U9#4XwKRDmU>-9I={{L-|Iu|qr+zz&f_B{r9$ZL zoK_a3BEM5!oVmhypICaa{Z+%gdk8w!Q672zxe!n$AWv^g3js-gp(8*kWNG>7H>&-H zH!)w1)!c`!pm*egIu`kt_$B=0KF|JAm0$Y6Prq^Rm*E*7Wtt7y^nP+oFo;e(x69>a z5D_=A0~8~_&qkq|G-bXTWtC!b9If*A29S~6u=$io>1rgD01Q`M_#<u-y2>#0kH}P1 z(U~Wzy|_yYZ&jB9zCWrxgRrIEdKd+q9C98hBeqP;1o)_kpAJoa{6x0a*t;yIVaLeK zuokZi;zt~8bK^^DWoH*Lv>&sp4|uhb-uIw<MjDjLU~|kZ)Q@wTD+Pl~dSUsak)tQu z^0)qnLG*Pr$=+Nw;mVPkoID~_r{U9~`ULm<vrpgt`4WP3{^v-`cav>GroMLW;CKfW zJ*@5;dmefaVoO&36OIh?v|ms8M4Qr1jyWQ3=+O6kD@9RLVaUZknif-Re3Z<zW*NMj zT>1W+e*c;buHzlEAL%|@pN+EB$BWkbsF!B3hqpj$S<le6Y|b{Xs`{<w%Adu!Dt*?W z4PrsiE_5)ZZ{Pb2bj^3Pa?b=~WDsk;%FxY2hwb*bOhp?0I;AMK>3TB`4A|x7mT|{# zYF~Sq!&}dK*URv@b-QXISA+VKE@28b;~XC_7PpOxf;nvG*}E0@rmtY+I3j?RG(9*~ zBoR;I)k;Uyl3NOJryq}ouim%+Q3OkRypFNk6_ou^SaXC_Dzv|$?4!au@v%3WQ@$|q zLtDm2xjMW#fYS8WCImgQA>y1-S`UIK_bvmTkL~T3VL}!;wFg9A%eHxm1<lmlsBkU* z(HtDuw!Y#};PiW#MVVQz>*0UcP|;$NANn;UNWonGb-;K_bJ9Jj*_nAy(Eg?E@U@xS z=@KE_3><rF`qJSk1Kge$U2CpuUQO5`uFUYEsVTiJZdf`VH~G5trFrO_$#Cy)*0sC* zCpd`u7@S<=isRMM5B@y$zkP5>&FA4H#iBn3wQ{VWP_!ZH*$r*#yL{II{}-`IkM+N) zHJYiTOERrzbfeMg?@Z5KQ7mILtyE8=)Sq3iw}UJYA|+SQn0Lm7AoLz}_L(FBk5`C? z3-aTRxCM;6{lN7exnI7TE(|F^PcHUre~red26<&hXc<=2hiQffL{+&~>3$1JKUTQd zyq^53TiJVJK7Tl^nN_5R+qJRPO0YJZx46<_X)4lWi*Vhp6)X3QEZ}1thXhhnt*P7` zm&fvo^UzX6q+R^-NNe7IdHG~fK(MNJh4k&ibCp4rE4Llvd;I@$c60?--VHEK4V4Hu zeFW|y*YHT}wbf2p{IZ|;0`~#6?zrcjkBGKmo+b_45~G|kj_U86Nkn1K`v(K>lB=^% zM?7o#i9_t&qS+g1-Yc|im_HN<yn5D0MbYzXV!l5+qIol2Va8uUQa-jgNkYY9Y@O=( zk()(nn*>Z&Tl+ct5*?>kJS<?M%^X{{06Ap>$vG<mE`grT4wVlq(KZp8oN3?`wQw35 zjDs~D7Dp~vt7`^cqBm%oHfwwytPfw^`Xa;eZMCTLBZKhA=gaTw6HdJ!F8@23#w~u@ zd4zQQ2ro;?>_~!>G9&w$goD!Clnx0=F)-iR2B}Gj33h-j{RF&Lfnk--8Cz7Cuzw_- zE4=ls&eY~#<{i9ePg6#9SN7Krl8T~>x^Cc+?qGS8)<?uCS34;@wiHc4RS7rLZ2(8! z=~joZ`I-HrryaU0H+Rb6KMu~SxPM$~G72f$(Y@06(en#&9nG)$c7%1Ok9%Gajk(1y z{c*7+kHI$h_kWdL_cvVM*Pa=J(MRvScM@H6qD2cKItijhC;E&Qgy<sC`y?dMOLRgA z(M5|oh!(w!GG^ZSeE)-Yez|Mby7#Vg_de%2XYaG0^SIoW(E{YG85P^oYrYSt^8sl5 zUsi!Fu|;8sJiuF%E@F(e&{g|Z_`{Sl#;=i}CGPVxgLT9e<rt<Q(S*S_b830~uhr>% ze=Z&B_yLSDk`-(_J;EDNbd9b2RWys`!d1^b)s|KzQL!Kx#&JVeb}qu=itt4H+x~~- zc5c9AJb(lY_LL>v0_~^BG2^J;Lk9YD?U=pGZw2a+;UoM-+~c0~^u7?@{zC2hvD7ye ziJyU>4VG$CEiWJxVmxu0seVsH=s6fvrL;x@QU*BuBk&n+3dMg}{U}AV{k=CtwSD1G zUBP&X#bkGLikTW}<-Ag`Qu)HA?u*OapSKr*Pu>d1n?hG+wK)LqnQ^sFUmicN??bo6 zd1`m1B&x^Do_;t06*;R#jx)ce2NgVft$)|}4aY+sPyWHOK3?)q#ro$Pc9#aRbu9cb zR?K->sxZE*qi_zvj5_CHd%;K%;kh)t{l=zM6!&&a<4>bEk$se~Qv%m@6g5nSvP_}X zHpO<)!WIW`QT{e>JLGZ`jsrWjvuowX$Uf@9&vB{CfGH{oH3vmm9?oJG3UHKYhmV^H z;$P8lM!<kK6#SVPfIAIaTD2I*+ZuRCrt~~P2?&T$r4cVplnDJOxxnUnN)#N5h5FbL zXR+^l3OgkEeo686@z~;*h<lpE(nNmltd$jI{zg`$GsnvXdY(&(ce_&IV!TsM<#;(A z6Hc`li@4mrRX}}9RsKt1!D`bqg0*jdI<a9U3c}b+3F(%RCgmS&oaqZ(Ob^?wEX8jN z6TvuXsgr(3&*$f@>CrcJM{1z~>#JoXVW6+bz_$nZiCvV!6+C&tSnOpNUiI6TyP?FS zQIz4SFEX=K<vCS1i%AJs>hdFw+EJny%3ugvbbJq#0i@vo*<KA)-w!~!;rGboScHAC z(u_*eJc_6ada`hb{Z1MgRABD{7@~P!M3D|#n-Mn*V6i}o02q?v;d9vw=lT!;6;OPn z0r>>8s!VzO;Qj;V<6o14#hN{ys$d?_GY(EIKtyK@$}I&>?<3Hzsmcs;RB3TF0L?^A zPp`OJ1~gj?OkTd>2P-hsnuv=edOkCB#>Z6vzqRU*ld)lwh>4n7Pwx4m)x+~Wc4{M# zT9b+JAkps?%gTLSajYDHMi?M96RrP!)L*PfGcu%Bioexz90K85a%83B6)i2TCuyVg zt$1JHDUfw=iW*jSV|2mQad$T)cUP;XV76lOe;bt>sTpD)c8Vmf_Ai*5<lg@Jg*k*E zk1SudNfnhnY1Uycg})AxhQ`Oezr^FIkW7n(=Wp0gxZOQ|@CY5n5VF@Yge?c0d1vDT zVoo@Yo6mV7>_WNHh@d=RJNiNaN_fjA2}jHt2QyR#(uNNoCJ+D?YpI5)qQ4f0B6TR? zNjM?<WpTjcDik|^4U<@_;{KD#Wn<^4LfSvsq>rmHr>e@I8bFN0#HtVueCs3u60|4K z!SDiaFeGxq{jV#2vJ`0wH{b{BYFOUSxZbudgF?-eY~&75<>si__EN0$Esw+PD^mGR zLUxPQh?9rs@AzP17e}aq%T5{P?7xWV2tG#YPfj*G>3c@p8cpU;>At+JO1=7%_r&R& zUq&rO;K<9FdNxI-UJM59AnGkFM-8yQ&js)MdeTx3NeF4WGwFxXXrbk`Fylg!zV&?| zcyBOt$D*)&^<7bd?2~+q1^s}2e-aZ&31vnnS0;ep0bDTo0LaGQ$)*>jERI#xF1*rE zU&~mL(Tk+y7y;#?ovk_U5wLzs$r6h`^RwtRG{lb(*)KB7`}Meh>c_{64!J1p9y(C` zG12^1)YbsP+#KFUn4uu-(BC6I1d>}MjOk~P`mk&Tc+}RjEe7gwtIrF+?39;QY~VH7 z%BiPR9H?8mEljWZX!tMYk*=d3uo#BYi`4zH@p~jBId9eTZ|23Fjnypb<rKn|GpxyW zl)F8fmT)1&U`Dbg(EB|Ax6Or?x`49h?}>Age^ol2EA1NrWr-juX0EodIYB7>cvz53 z_};j}kcv^5%9_Q~MC$9LX(kc?!G_w}-SG5z`=04!JS4c2P6Mn7P=5o!?YIh4a>S_y z1?$4wfT0{4c9wCXU<EzM68x9AD%vza<v56m-JU>8RX?-)gk<7n;$|2npV}VHaT9eZ z{t546gtyEDU(=JcrkO%93S;wPRWT27VF`Zis(0^(gwrOTacm_<eKak90sV!*t9!ua zDCa)+HM8!Z<CS4zHBOxp#PBNah_!M_>+a5F>F6o<ySJ+MU^yqsOO=iH4CA9XVdAD4 zuM(Qj6Ve^DdM6v(`cv^A%NHa0l%I}iR0!Ne>YcTqWFq=ut#)+G&KIckoh3oBPcz|m z6?<i~7mH0dm0^9W((V_wXD|xn5!Y985F_BGs4Q2x>FQ^N@>c7cDURe%X|b(IXbl9$ z{TH-b&h~9m!xK6H>5rJ6_(e}9&Xq3@Xtyuk2RE=~s;~Xt1BD)aI`Fc416U9=&SwqA zONRJBqMoCtQF=+{SFt_PrAhDome~{FQikj~f5GaOczF};o6HlS9#YP|hrg&K2sGqv zp-t1%!=*cOrbrgAz2~CfKFcVCD{uH4lFNJ=LaFe91fas`holZ|E)&BmN@~o*6sjPy z#FAC|?8WA88F!GKnd17#I{>vIh-L3{(Rp1R-{D)uOvixz!gezMkI=F|*It?RkI}jd zE%yEX>Eq66Nc*hL+sbC6`?tGhNBSp6UI{Pqv`#)Zm+L6&Q%jo^jbBfn1{GkS{Fkr! zLWy%P=jsT~z+gbZWxEL$3kB@nJws0Y!j~hhy!m<IO{o${Ki_%RYl@QtMrdLx@O9Dr znrLB3-`Bz9z~gYGleaY;q(AU_5KY(TgH7@$Y@4gAIteYzzP?>u0%Pfv9Ns<qTxj49 zxdd-i&M{%f&?gBlRbpTk#BhyKPHc1}WK)|alF}z}Cnc<#1H6}Ym?H?I0^T?oZ5kEr zFYIe+L*Q&f-HAyS8b_?bcKJDmdpSdpb9K8Y5j`N0Ah?{N=aXpCG;;w`hje1Ds&&Ys z;ggz>yt`Mp*^S(r9#92<UlN~ntKLXS5i=HLasbavzF~cc`F^wVR`QT8@FLM5WcH_W z70nveGZV)AsuP}}Z6DQ}`Ur{-+zTy5dI_3bd>M5i3w;*i&gzxQZ}^nwK5lJ(${SkM z9C2SS%j(dF3<>a*b4aku`ex)1DBBXip;tilBBpID*``WFnl(Cdr~0Hi05+(2A^ti6 zJFkXDgn+-||DA!EYnj)@QgMGs79JY<O`Q|I<t)J#4Vc%hP&pJ!q)-$*@e&ri$s;=P z3bZ>np$oP);aYnuMO0M}aK^Li;c$(`q1xCn1?+Jl{kZB4&7eXf<O&E(>l%%?59*;+ zGK~p{H3GoVTQ7%CCQwa&jcrnKe((e8r|FXm#?OjX5v}<7$Y%k$c{wkwLK1*g+wVjr zjkDF^H{S?FLmvZ%zMYKVl~!f|BSy1-kcR@p3EIwgwxmi{&>b~W>t~d57Bh75N1ZLn ziM_Sj^W^NgjSm>UO3nJPcq|=iY6SLykY1K}5yOM4HCCw8(np90gPR~*mA7n>p<}2y zJ<h3|%C6sB5XHDmbm>{_szCgob1p4a4yL$PTk?-aH!6fciRGWa?24OV8W$0Q0(w>d z{(2mc6yEs1LGN1myv|k0CVkST5_MQApN7p3COd^SL_f850`@pO0Ef#Dm8%>f1`wUj zf}j;|M1TARety~$%VHxgzyjPtfCStL9A>W-Fx^L7#jBJ|Z~;zOxg2i9P-OiPw7h^F zDJot-cnLn-R%XYtB1!}NMRi3$Eb062=p8R|O?V=mp*yqOz?QG0EPY7TcBKg)hp7c+ z0hotC=rO6twLX5Og_7#d*8^CIn_pCM=BB%waeF1o&8hB@^N8a;dDu%uKVuWGjwmJb zBCK2{v|^26Hi+I`{8wrnQuYWclCliosSmJPT^N)7`ayhcN%k;;Dzvh)Xj~-mQK+s+ zZ*P&6v0$X%$@BrwuJ@dJKMX#eS-dnlP@((#{lzcAmDXFqCZk>S+C*Vx;fl7T9{6bl z`hLsZD&Dmb=S@L|$U-991En!jn3vBU|0!auWLtu)$fOD;%4zqRpXQ`2Ke+3j_{uEQ zBk3Q|L4u9AOQv47h=K!jnS<|)r|i|=KPX-P(_*_{5fXJ4ctECl6$>AO<Z~KkLtEuP ziP)(^9xV^v^?kb29^7Z~aRRzt4asq-l0>a-w^;#<J&}E$e0W~HvA=up6$QYd3NQ6F zAHB5EH6neG&EMnsOf9ldCwfTTh0wJyOp=|i(t(jfPD@O6$b;h+uQTXFvSUo>amRcd zoah6Mw&-}>+(8O1xuZl70xmH!<AXRWolb2#JQT8MIzD;3F3m_B){`OWn&P{v%aa!3 zy|!fWDPs6?vnk!kaN9aRQxGFn=$(3w7i%>6(W2i_n!lM?ccG5z-|7*8&CScfznwS> z8b(Ug#utWBLDhg0Q_Q!A`!}kEtnWi>qWfXbD7%+<)zzrAeD|~q*f)!4#AP#(WMApG zHPOekodbj0in|K-fsDz7(JIz)Nh-M^CtDK2<<NO+sv=ps{=u745t0rq%Qco2xa>tM z4RDG_AWrpBM~@2XY!NA~sY)*yScD?!hpiLA;ZWDq5BNLoWyPE~&3A!9z@c8DhI&?a zB?(3!GQ@C!o)`~7n_ac}lV+dvZyrCHHtTsB@TxGv4S0-Ne0WFj)ki!274#Q^i+g+@ zX{V-&10A$E|N4hyLf*Gt_~h%tD*8Gr7QXYw_qh^cYt@t<%IQ)(jO<TbDVWMhe=-&! zpDtd6yXYP82e`w09X89h1723}T%ukTlpC1}F#jfXzlM4&#HBHJ-+#93<qD)=JeIo7 zBMUc}?xJ^HKkEQgrDFHGYN$CdQhVr}*H=b?ZT3_ufkeN5ePZvoH+o~iEO-*?PsA!G zsBn?g@@J&9JLlV9VX>GK_;FE?@1Dv*-*5IW9aoD(Y7nRX7sCX`mH<Ye5XpIjdd~=f zO_vSx>b&grPi{L3A^<B7Kp~~E>y3OW+Ms%^gqGC+6A*SI|I*5ZE3PkmGZJ3R0I|JV z|GQ#opT4Qiv+hhtXBNbfX}kh_B3643Y$>c?{MK2<Wb$WW{(8LJq%Kk%N8iiD+6cHx zOgS|Wo|bJBWc@HIpjggzB}vhJcd}#+etdHiYg9SLH7qmLlsbbsef+q5?c%tfrBE^V zm$rIMi%GPvR4TQnTDZGe=LhuBY)<-}Ug>JYifr7`1m&`?&MMoW{uWMM-sxFW;%e;g zKJC|PLbQ!$=qpQX4hP09|E7CH%~9^ev_Rz%Izco|MTea~k}LAWOGOy7y08ec_r>+F z*WC&gpSl$Ws#X5rt1aM|-bI{XWn9(_sJ?bLmJy7I>&Xj64u&WdVir(DU?mNnm!ssz zNjQ~~$stFZ;7|PD_Vv&9B|k3oMgsLdO#S?3Y0e0?&&nRThB_&F8q`waSwr!h{&Jb- z{37`0%^kG4R$?L59H<nN^!(93r@xx=81HHuiE41vFQ|wPwWVMt)z-iIOXyVtm{5mR z7B6gROO=7}n=#{t%;DAT5KcTEtN}AhLwj%hElT@mps+e~Y@k=vrZCi@t(;;;wUvJr zt<z8M?A{HLRCQ+4J9y<t8j<3aj&ZRHFUNnNV7K94^RauG>u!x<W$kR5E#`_jsvf@3 zKbLlPv#o(+ZQ4;}UB*jDF@knE1<+^(MYPKF3y(yS@>}nOE5T(f?!aa5SNBUPkg!*2 z?IE!D`={COdV`Cv+ARuis;%3uj1a-N=s-9dpUI4F$XI5LU;%yv1x|OLDyN4SHDgRj zDM2r_&EbYOWd44a<`sOn4O}AzGrZSynzpHoEB${&q5CdkCHi2@Nl$?Ks&GaBLa2H8 zvJLqc_dC23(o*<h&kl_)Lib+s0%Nq94JBno{((rZOQ>4ow2>C|!BaxMfMt|KZSQD5 z!Ql(1Jw<nk)aNtDo1mU^jJS3)=I7-%>qbC|);Vs$qIn6m<Y^Wlp?<V0&U+lZJ>^F# zF1q4&<jt99N<YYfnai_00SbC@;k1x`PpN)-;S9MK`p<vz{xvVrM&KNd3>$ej#=sAo zBeEw3%$#=`0^D!!n>-5U$EJLkl1;ETe?fR{v_7+{-G;pxrAvTWQ)3HxB7w+mw9osZ zbzza16C**AfH%7;e+Dpf<|P!AX&74+-X_dh6K)UDOagw8F8&OtxK#V6c~#}rCGetZ zq-L`5emFZB%j0Rn=j283wqoY*v<Lk2+8-R4qa9ddHJm(tG&Wzj$S6>D5$H}-&33CX zVevyIz<sr9pGD&PhBAPL`LEL+z2l$`6WXhTC64wd&+B5WJrRWo%N6`chwD!^Yw8Wl zZzYOX4)Ch`>+-buic1MGStK!&jdABY(#@9v52jCL$98PTjh_a{olg(rPJsm!naR~V zmLjB-i7KgLrzPrTy&|X_|Hg_F!Cowf*}1CD5JIu5!7F3wv&x^=0?i>ar=lmn8BN-A z@=kwnV4H<Iy<Y(G53#ZLfXM40k=<+2*d$Zzul<8Z^axB6ityX{?RT`4y#XWXk1rF# zBk~}>Tn8Np=_v6I<6i~gwLh*dAMiT=!CzFF@+>xK!t=ivzO<tJg!++o;Q4|h)q*2^ z#mYQDrrL1hX+sEv$|^HfvtQGiIPsq_33gkH*2EgEQb%B7oI0K`I%8T#;#f=J=#y~t zQcQ(XG$Dpg3}cW$sX#lcHzb$Vz`A=$OavN#4uyQH`1<h$1I-eiPow_I2TMpLsx!L_ z--8dPi(Q&IhER4GobG8FIaBMcGnXPL$E1A6nVZ^=HEHNEyh11Z&$!=;5w#xYHF>&D z8cMj59#y-m=hM>XpPiQ#zEX@^oz1*v`fH~A=IX>|63NPBM$3b(9OG#WV0K8j3QVJ{ zeMxpyf{EzzlVC`OJxCc&qHi?Q`JuxJrNJW#p&|*wpDzFs`mwsJfBScql<sv9B+0f| zD^u0XTt%{>-f8jZXQs+Eq3e1QKfr-YO7om>Z?rP@nCNb1+qEwIwemkDs8V{jD5-!s zoh}Pn|1)1vLQ{pMiG3lpH58(F73@s(CGk30pij_VWK)w7aZ%6tJ2}_ZxOeU+(4JFP zDZNv>?@b!7;6@Pb4V(P7a`g+Qr{8^r2Gp_wCs0g4b&v*X`ZmE9u}AhzKia<XWk}V9 zn1>D<FO`3(ktKhq?v+5vW==NHk8tb#wy^IBQR=cqzkO83ucEfsu&z4Njm3Jos>%tO zoV1NsTacB1XdUFM0!*15v%#S5s-`yegQnYb|5a%BU9LO*v&9(%0^eo($;7Q07GZ8o z#X9Sv+)ryS&p`U)ITR2WE8&<Fl?L%~!XIMbHPU(qakbt(#XE&O<#Mn`&B`{$tJ;?T z7W!S-<=XOD{$GJ)!E$9yd(u5kJo=+hwTdwhIa+VCq-SAGJVwP4t-r7<qi?WY@ps^$ z`98Se-D4IWjOcJ8|5Si0No;ty`PTx2iixkSS@3Bk&MAp5XJhPG<-{QYDoiYo?mFOc z<%Hl)mVsSt2C2a>3E^B+jGAF+RmC)l#?e(|Z?g5YF{LQa2*Fcg8V@d5`g!C)t%%=b zG;A79>e4X~qVjWN-~ETW`t1HsBQ@z;x_Y56%c8y=-9*pEuaZOgx{Nsru!Rq&kxe+D z`@<6<r`Gs-X-xTN-cex1)#%(#*6QT*@Q7$2$oz1i_)(M?YDnVsL^M?;8CGwFJ$%bS zf&m-Ml0!cY@%2oE3vf;ZLZS*=TEb_kL8GeH#q{64MSat=vw42=JUjHQRj<%s#nf^3 zvtI_7saLgYd53&P5pup>z1j}1uO@EKm9&NRk)(*}mTKJ-Mp1KY)c0H+Y`28PU7#@( zcC^J62aFh>Q+VVdENR5S!d=lB-|bAM(hcx4g!V3$EFb-R+LQm0C<N-CGER2ghLQhC zsTO#RoGSe&T9Pf<&4XZOicV#!*RW<aYSHs4D6@7J7R8WkU)wK!)^56`7ap#CG1Rs0 zvn>naSz%PWGB73fbAmBZf>q2_p~D$b+w{h};U6$_)xmFnrfLGxmEuHn*DnMkL?eMd zy%yvIF((4YpFu!l6D|%tNPr-VCGgw*o*cG<?7#AXZ;0dfstx6$-+d9tkkwr2bz5PZ zd8Rza`n=Ry)`7e%sN2xI#-XV@M}})^ynoxs!>6=HG_ggRm$WN-=e0A@1C!d!^u8$M za->#(W4OoR(eV88=cI$1w)vGssNx0fu39m5v#@y*qqqi?luE*+<vw|s;=j-b7qiSQ zN}aqYrHDh)gRB{~6ObmBj@`85p|SpoVgi@$x$A&p{2)?ZbIim`=Z4L`Od<4Df?y4` z#MQTY@C;B@8dYpk6T*zlVP*9_lAaY3DwVAcrof$4pNbp9cT9Zs-rTtZT3g;F@^_Y< z<?$<jOIxs#xbdT+4={T^H|~?pt_?W{srRfn1eJ>yv-(G$R+zom+CA)1L;D%H3o>$@ zI5Y+@AZ09pbEt>TB&A)e)Oaa>peK~T$0#-SSe;K^RD@zt$N1nstHbbMkJ6@=10vwA z23&%{C8J^aG?PHos`MIiK8ty8#c%5trg0nrDd^HVMMRxP3{L88bHVP7NT2)5Jp#OM zZ2MfdKaGjX7A!XFkoq_2p@rJY>s9(b)b#~7KR>F;9{2uR)~vQLruP+QfO!azauU?< zetqWeF4}BWBf61rPwAWG{VLf}3$p+G?9)co{y<Idwp@=(b)b%yz=o@5jCg1i9<Z({ z0}s7RbYhO{#h)ct2%N-KpSx3(t1?|u^`}2Pr?e;otC}Tq`46*^QZp<|+HBc+MCad~ zG;~lAAqMal7H6OSOen|(8DguS!MwFonw93Qa+G76%dAT}I|)i^H>?9R3P>K)$h}(y zFJE+CM1THn8a`F-g#@EMA-Jo4uq9W1k6V>yWj3U&<(S(V9t~0;nIM8B7zT}5oSwW~ z5Z>ROpz=ECJ*c5vJr3LBxJ}}?ZaMcU{Qj8h-<s?QocPU^K^j0#<f&S9q}%)x!N1&? zLRxKF+VBC~Fi$0T(KJ8cCdy~13ufS4ON^RSS4{-MP;i#7kBuk$2b!PM6A)i>`BHYM zaBR3~(x2e@-cN+oe$OItT2wLCgE*72RK%4WI0xiCevt71^?4b%QmHg20`tD}4yp}C z6wfl{@u~}d{ry7<I`o<NAwPi3{2tFA()<~NTbu7yqb>Yb*6q)ofVnAyJu=7;moD_P za)9eC`?zp_oW}-RqzjYES*Qb5!3E#>B(cMvUU7qPEv=h}`Dw<|52p!M5RT@JYlFII zS`D<XuT6Gu!zFITu+e+=I~etCNtBKHg%zZ=AO4fLRUa=Vsge?p2NcZ;UJ?Av()}=* zrE*G)zq@55(;4*8g?Q*W^qekP-uMSK&2vb6+X}10&3R{fPvt6XevOUk@cC=9Y)}K< zrVRjlW5*4!;$Aw}z={p0X=bUF{@rbFlUn4sUVFOy?qZ%bYYEg7O78WrQ%v>7RN~;y zhjb@h=~im!Q%M|x2UD8s;FeRBtMGBfNDw2jJMCddt@45GiOnf(Os~TOrVbmUa{I4? z14&J-$3#Fy;o4^;Kwg3rAvI1YNn8PAZEVjgo2<b_Pl$T1iAH>eUE^>IKP<0yw}0mb z&BMIusiJ;-d+GSVj6cAGUe&j@H0L3w_r7#<*w^guE}-J)zw1N+uIL&{z=5RUwg!F= z6dNlFPsVb|C2I%af|r`_bU;yIYK>G`%C1MZ+!{0F5aRw8U;B0rv>38-Kd{V|+ul&g zC<C3osB+qVl?_o<>MnTlqwD$1U1}d9LgOa*j@$j7*wvd}ToQ!VZjKts8%GIJlXP&# zFWmjy<0~Kx&0MDe;&SF3e1#?C(Vdrk6nm~@&Gm0ZA&cbCGF60;9%6Wo`mk<Oo1IyW z#XtwI1{WP$FG7)of^ZfmgKE#`^}@Y&nvL0S<M_dkn;qsoVIF=CX5-=h88le%^u;6Z z2xAr<pmD-2|Dl=<n7v&lFr>ACi2CgU{`&ZY4_grc&i|dXW^WzW*1-j}2Mu_jp8QMJ za&f~gtUBnREK$r}6o+(WeR-oZ7aof;&FRpZa%k~I*>e~C2a?5okSOkMT#x#*`)5fu zi}>bc7`m1p6fJ2((>jIztGUR8v_p~lXbiz>GU%H2if8Td+@_bJr1#B?MpDQ@v7X}} zSDV7|T)w6KV$c*}Bqm5Cwirj-?%k!U3m_%$mj!NxI)`x;DSZ$(Q>cA>_3>`?QkoQr z{abLDK84!5mZ)me!Nzi-%<{Pm_0I5+Ejn1U^e&sh+i)e_^uN{kF}=ZN!R?*lA%-3g z-IjM;9_vW1Ipb56eD2wGdbVchW?JrxP<$7o=)e^K0k&{JGE!|pu5UAMX8Y-Bs2W8c zj-9s9U&=ui%WrMRLN#VzEv&S7F#-o|)Ajiy&stMn!bzO~p3#V=Z>Is?O0$kdJ)b?k zr7(?|KHXW}Y66`avA-x>8H$Xk+Rrg_d-Ga)p<Fysr3OjLY5$$=M0hHvzx!(fHqK@+ z4@nNd!R^(tmu$o&;ttvPBAi*hCjr;lja%wL9z0<5vo#(Og0GyQ!>xWW@c8>ofWadn zh(b_UZa#>9jIQ;^0Kt7gWXr9(t6Qpn2}P;&Gi%!oau6JiH~Oz{6LC!mD&Bx7QmZSn z5NxuuCy0)lQW{*A7^9r`zShvDVQGdi@$$Ru^xMv%SWCBF?VA_ZmcHhyW^`yoMAEta zMDDZx>QP?eL%@INNWo5Czl^%YG0MfcZ`z?C#SuNyV9O{t!vt@%nmLC60aAqnTzR;U z=~bLKpwh+Hgd0J?WgitNlLgXTl<u{Cu!_|Dp*mZM$NwiK@U%&#B{L~r21TY=5Eg3` zah4SYfga+@ybTlrh?AB&=IG{YtpK(#YyRlt7(sNDk6y6<`5#{Fb0Pd5NFT~5Ez7s& z{-y8m5qBp{BUT(=@IVM|zx7#;zcA*iDCfAj&9&e%9mzjc!#ritj}7&(>`3pE8)XHM z5^S8T`*RmzW`>ed<K=;p94oq#X_x%~XMA<uXtGS&<HRUtNYvqYYwE}C72ITm4^&f) zSXr=Kb$#~1s&cx51`p$@X1)55D$kB|gE9}3t6j;%rgz#O7Wa``EXc2p1bSSNQY{e8 zCl1$c4ibN0b4(^G6U55b<7<jl(<oT*HOf2*2w7+H)s33!k!?Fl=psj~`Oc!a>xJ>W zUq^cGUZ13QW**0wbRW%;4#EC@mU!iiK-~#OYTO77cpKhkob#R_2IQT81l>m-*j+}~ z(BMAF1gT%mqby6(M+Z7WHQ1SRwBZtfMuG%iaSnma-f4)U+H0zNh~*nt5A4cx9;Ser z>%k>#r;i^v-OEBeH^4xNG%@KP$jXu89-(i=<L)q=kIywRWZLWx3_g>LgBZrqE#||d z_4KF8RdpTionLsc%$l2L>ZX?+0iEM%vWh-Ow+YI|L5V{>6EC%u*v+kRB%kn?G3VWa zQ%2;R5&ny)^sb$0Y>ygw`qAl=XdJrhp(nqDV;2RJ#9u<9%uT|h8Lk*O3Bq|nZ9ZO= zkvF@LO_gcpDHqq4Fjg&S$};<k;A^7cJf@v<`u-YKxW))mlc!&<4!bvDy1pJ~t<_WW zyCYt#GMLG+UHymJ@~MUJL{@hr#>ONFG;>-tCLR+Th3-n87ZTfbONyZhZ^)kr``5|) zi2H3I2l~iSV+HwCQ$<7})E=y*O(Gq}kxIK7dAX11&J%>6dxw{I<AlkRdG5NnB2L(_ zc<fAZ%>6X>y#Ik?f06cYxBk(h&MG(q)SiPtS%WnEv>y-)=<f*=BzVx>b8&s?cVn?U zSf=-Hk$Ikq2Cr=yw_+Qh#(xahiP97ULWiJFeWkyuy;RC;omV%A<Zs}(ymxkQ@q@g0 z`-D(6<Asa4QbdRCWUPwFa0u;=+(-K9`r976)|px1bU{3y_XV;=?CoF1=zv-Eh`|@( zrKw@UrJXJ2;QKO-Ico`_M}!gA_q&l7XYSn6_{i?_y&IX`k?AhJI}P0%<a6qp2&W&) zO(PLq>bO{XPz=-taYUxtX@wtf2~U)KR@Eg2R%;&PSw`813MqX3aqH)hL?2W4rG5+A z|BNC`k`o`WGHmdgPV)N4_vo|-poRo8Z|~zEu4wg}yWHkY=>#1@@>k+R-o<p>WQOwr zeybucG!3XCdRd1EJn0|b#2%%0pu#pI`20&SEYG-n2`JB(o%EJ?*x4Z;PhCr2iT*x$ zx4-sn!tk!z{!W4L1eJKc8d_d-mX6WZx<UFAs<&F-jad-j@Uxo>G?n0C4H^0jNCZCN zYE?@tzEwPA&R?2#aTsZ+B9?FdO^4sM{fFFYYp>9-RUpMr4-6iNB2R;PBBuo*3ZgG2 zGhrN0%^A4K^#too4U<9{KSe^jN%PTjX_qJ&;f!kg8oNr@Nt>|T5S4ik6<;gXmb}tW zp?(>5;GY!SHv;u7+xuY~K_}*@P3*gA=>!--IZUe@%lYUA>EW#vu4MIXO&Ao@du2aL z5Uy>rcNMh*J1~#*5It{vO{a0Nr##7R9aFky$%q)~%V#=yqwJFxo{$`xavJsBLC2P` z#n51+fYAIQr%<WUVvJnuC-3%Jo*)uk@3@!WA%KPw3iX)TQ<<5JJZ7%5KTF;TC4%T> z3+l{p@FY8<qj})3d5g~L?u!dBvIcgT)eYM<7wbN+%HfE3qx>wl21JT8Al#>!>8Nlw zNKC$`qOy+;+$>O=IOs%@(vd($P57!xKjsSIM9`}s{pt{E;4x4y%tW(u&lRUSxuDoI zv)-jg3Dr6^(NszPXM6vWQss(v6gOQY*F~9s&D)-tic34NtrnWmY=H}W#IFZGCyEJ1 zDIfCdG_JCy-(#260ZS1dy5<TDrye;wkPSr=Z$?U!|J0`HEc!R_bFY}*Uc1146xYUH z24>s_$*TRHofqSNTemfFbh+%#*32-?Rf21)#Lmig#K9*m9i(#UlPOV{meOsHNpsIO z;%L7s=IX_9@RDYFIM3u96-OBRB*}FA(FIbY|3vr$Zf(Xu4ZQnvzh)~u=-l7?W7^&F zh1pY@&-_ZrlO&KRDH>TEwu++V|NBAh8z)=BN3+mhj7s5OEZBnDZ&xiSGK$oeVj*^! z9eFz!69vG9u<x%vGv2OVW&irm0*Ss|o#6(ZOWx=6=JG!cL|+mmf-*&eyAD&~5?5|s z=Ns8qaXF4Y+3bh>k&E?AX?LV-Ma-!?bNT$C;txva{4WT<zv>uJpt+A0a*@EHO}{Gp zD|>R^g(s#<PM(N3eVX|Nkj6vt&z?Y?eZ*xb&Pi!}-OWam<L*&3H}BW=zV8=hV?My} zAh3s_;y*ZUa%3j=DcfDH#+a{JDr&B1|JO+C^<_0Lt5H{rvqeGI+9WFcgo0##Voyg^ zP0jLi_cYNf-WWR{KSM%N9~7O=cWg#C@YAi=X5tFh%^Y4Sy?43XcmKL-b!F`^%fiot z|9$nJjpq%=8svU%A5Xr}=+SI$#>xtkUZVTfY)J65j7PcyhMC=wD$%>AQNF&X6D^&+ zyXc&YshEH5Db$@YJJJhB)ox)CcO4yN+pa2u{uhim-}{DzA7-^fPIM1N1QJuflrn7z zX+`mplK1riHqS>;?HgdFx2+~ygsjX8d%ZdeeSz&xC<`nr$F0|zW=&$Ggw<T~T()Cj zYGrt2E2`)}r@tCx@667tQDR!QqP1_Ml^=eR7+r6*sotkbnM#L`&s8A|o$;2BLxPuK zO>T^IM|3&e`@VyTUD!j1+6VE?fAJIS-p*Y-{P*s{-&FUk`rZHDNe|E#4vdAo&fgN# zQqy6uiST?E=|P<P$j5FE?In4qh$V;Kz4{PXm$>q4dhY&3_j$*+8=CN&7ytRT^9`IN z2jY_uU0t)h=Ut=19jLrfG3L!qPqAJ{xBx>@-ogLH_{Oa*s^DTHiAX)Zwa^5>)#V@_ z7svbct`KRz=MF3?U)eL#51+TIkNA6WB^0&n;W8Bj8{2qJru==^RrMg6WfitH7uoW0 zM4Cc3Mqo546W=Q@awoMjMXc!NKRfqA04uR=rvi^?Y_$Jt6~RUkd45_qg>C`iMy}D! ze|I>by%PcVCQs1e|NW6*`vCdqk@2eFM*M1X9A{Tt#7PG-O=wJUi`2wD|KBbD|4Z^} aJeJ~~sNZ&L7?B?U_tVuf)cmUM5dD7*zoIh$ diff --git a/src/tools/miri/tex/final-presentation/slides.tex b/src/tools/miri/tex/final-presentation/slides.tex deleted file mode 100644 index c5e1f51ba1..0000000000 --- a/src/tools/miri/tex/final-presentation/slides.tex +++ /dev/null @@ -1,444 +0,0 @@ -\documentclass{beamer} -\usecolortheme{beaver} -\beamertemplatenavigationsymbolsempty - -% Fonts -\usepackage{fontspec} -\setmainfont{Source Serif Pro}[Ligatures=TeX] -\setsansfont{Source Sans Pro}[Ligatures=TeX] -\setmonofont{Source Code Pro}[ - BoldFont={* Medium}, - BoldItalicFont={* Medium Italic}, -] - -\usepackage[outputdir=out]{minted} -\usepackage{tikz} -\usetikzlibrary{positioning, fit} - -\tikzset{ - invisible/.style={opacity=0,text opacity=0}, - highlight/.style={color=red}, - intro/.code args={<#1>}{% - \only<#1>{\pgfkeysalso{highlight}} - \alt<#1->{}{\pgfkeysalso{invisible}} - }, -} - -\title{Miri} -\subtitle{An interpreter for Rust's mid-level intermediate representation} -\author{ - Scott Olson - \texorpdfstring{\\ \scriptsize{Supervisor: Christopher Dutchyn}}{} -} -\institute{ - CMPT 400 \\ - University of Saskatchewan -} -\date{} -\titlegraphic{ - \includegraphics[width=64px,height=64px]{rust-logo-512x512.png} \\ - \scriptsize{\url{https://www.rust-lang.org}} -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Intro slides -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\begin{document} - -\maketitle - -\begin{frame}[fragile] - \frametitle{What is Rust? \small{[review]}} - - According to the website\dots - - \begin{quote} - \textbf{Rust} is a systems programming language that runs blazingly fast, - prevents nearly all segfaults, and guarantees thread safety. - \end{quote} - - It's a new programming language from Mozilla, and it looks like this: - - \begin{minted}[ - autogobble, - fontsize=\footnotesize, - mathescape, - xleftmargin=.3in, - ]{rust} - fn factorial(n: u64) -> u64 { - (1..n).fold(1, |a, b| a * b) - } - - fn main() { - for x in 1..6 { - println!("{}", factorial(x)); - } - // $\Rightarrow$ 1 - // $\Rightarrow$ 1 - // $\Rightarrow$ 2 - // $\Rightarrow$ 6 - // $\Rightarrow$ 24 - } - \end{minted} -\end{frame} - -\begin{frame} - \frametitle{How does Rust compile code? \onslide<-6>{\small{[review]}}} - - \begin{center} - \begin{tikzpicture}[x=4cm, y=3.5cm, auto, rounded corners] - \tikzstyle{basic-stage}=[rectangle, draw, thick, align=center] - \tikzstyle{stage}=[basic-stage, font=\tiny] - \tikzstyle{pass}=[thick, -stealth] - \tikzstyle{pass-label}=[font=\footnotesize] - - \node[basic-stage] (src) at (0,0) {Source\\Code}; - \node[basic-stage] (mach) at (2,-1) {Machine\\Code}; - - \draw<1>[pass, out=0, in=180] - (src.east) to node[font=\Huge] {?} (mach.west); - - \node[stage, intro=<2>] (ast) at (1,0) - {\normalsize{AST} \\ Abstract Syntax Tree}; - \draw[pass, intro=<2>] - (src) -- node[pass-label] {Parse} (ast); - - \node[stage, intro=<3>] (hir) at (2,0) - {\normalsize{HIR} \\ High-level Intermediate\\Representation}; - \draw[pass, intro=<3>] - (ast) -- node[pass-label] {Simplify} (hir); - - \node[stage, intro=<4>] (mir) at (0,-1) - {\normalsize{MIR} \\ Mid-level Intermediate\\Representation}; - \path (hir.south) -- coordinate (middle) (mir.north); - \draw[pass, intro=<4>] - (hir.south) |- (middle) -| (mir.north); - \node[pass-label, above, intro=<4>] at (middle) {Lower}; - - \node[stage, intro=<5>] (llvm) at (1,-1) - {\normalsize{LLVM IR} \\ Low-level Intermediate\\Representation}; - \draw[pass, intro=<5>] - (mir) -- node[pass-label] {Translate} (llvm); - - \draw<6->[pass, intro=<6>] - (llvm) -- node[pass-label] {Magic} (mach); - - \node[stage, intro=<7>] (exec) at (1,-1.75) - {\normalsize{Execution}}; - \draw[pass, intro=<7>] - (mach) -- node[pass-label] {CPU} (exec); - - \draw[pass, intro=<8>] - (mir) -- node[pass-label] {Miri} (exec); - \end{tikzpicture} - \end{center} -\end{frame} - -\begin{frame} - \frametitle{Why build Miri?} - \begin{itemize} - \item For fun and learning. - - \item I originally planned to use it for testing the compiler and execution - of unsafe code, but shifted my goals along the way. \pause - - \item Now it serves as an experimental implementation of the upcoming - compile-time function evaluation feature in Rust. \pause - - \begin{itemize} - \item Similar to C++14's \mintinline{cpp}{constexpr} feature. - - \item You can do complicated calculations at compile time and compile - their \emph{results} into the executable. \pause - - \item For example, you can compute a ``perfect hash function'' for a - statically-known map at compile-time and have guaranteed no-collision - lookup at runtime. \pause - - \item Miri actually supports far more of Rust than C++14's - \mintinline{cpp}{constexpr} does of C++ --- even heap allocation and - unsafe code. - \end{itemize} - \end{itemize} -\end{frame} - -\begin{frame} - \frametitle{How was it built?} - - At first I wrote a naive version with a number of downsides: - - \begin{itemize} - \item represented values in a traditional dynamic language format, where - every value was the same size. - - \item didn't work well for aggregates (structs, enums, arrays, etc.). - - \item made unsafe programming tricks that make assumptions about low-level - value layout essentially impossible. - \end{itemize} -\end{frame} - -\begin{frame} - \frametitle{How was it built?} - \begin{itemize} - \item Later, a Rust compiler team member proposed a ``Rust abstract - machine'' with specialized value layout which solved my previous problems. - \pause - - \item His proposal was intended for a compile-time function evaluator in the - Rust compiler, so I effectively implemented an experimental version of - that. \pause - - \item After this point, making Miri work well was primarily a software - engineering problem. - \end{itemize} -\end{frame} - -\begin{frame} - \frametitle{Data layout} - \begin{itemize} - \item Memory in Miri is literally a HashMap from ``allocation IDs'' to - ``abstract allocations''. - - \item Allocations are represented by: \pause - \begin{enumerate} - \item An array of \textbf{raw bytes} with a size based on the type of - the value \pause - \item A set of \textbf{relocations} --- pointers into other abstract - allocations \pause - \item A mask determining which bytes are \textbf{undefined} - \end{enumerate} - \end{itemize} -\end{frame} - -\begin{frame}[fragile] - \frametitle{\texttt{square} example} - \begin{center} - \begin{minted}[autogobble,fontsize=\scriptsize]{rust} - // Rust - fn square(n: u64) -> u64 { - n * n - } - - // Generated MIR - fn square(arg0: u64) -> u64 { - let var0: u64; // n // On function entry, Miri creates - // virtual allocations for all the - // arguments, variables, and - // temporaries. - - bb0: { - var0 = arg0; // Copy the argument into `n`. - return = Mul(var0, var0); // Multiply `n` with itself. - goto -> bb1; // Jump to basic block `bb1`. - } - - bb1: { - return; // Return from the current fn. - } - } - \end{minted} - \end{center} -\end{frame} - -\begin{frame}[fragile] - \frametitle{\texttt{sum} example} - \begin{center} - \begin{minted}[autogobble,fontsize=\tiny]{rust} - // Rust - fn sum() -> u64 { - let mut sum = 0; let mut i = 0; - while i < 10 { sum += i; i += 1; } - sum - } - - // Generated MIR - fn sum() -> u64 { - let mut var0: u64; // sum - let mut var1: u64; // i - let mut tmp0: bool; - - bb0: { - // sum = 0; i = 0; - var0 = const 0u64; var1 = const 0u64; goto -> bb1; - } - bb1: { - // if i < 10 { goto bb2; } else { goto bb3; } - tmp0 = Lt(var1, const 10u64); - if(tmp0) -> [true: bb2, false: bb3]; - } - bb2: { - var0 = Add(var0, var1); // sum = sum + i; - var1 = Add(var1, const 1u64); // i = i + 1; - goto -> bb1; - } - bb3: { - return = var0; goto -> bb4; - } - bb4: { return; } - } - \end{minted} - \end{center} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Heap allocations!} - \begin{minted}[autogobble,fontsize=\scriptsize]{rust} - fn make_vec() -> Vec<u8> { - // Empty array with space for 4 bytes - allocated on the heap! - let mut vec = Vec::with_capacity(4); - // Initialize the first two slots. - vec.push(1); - vec.push(2); - vec - } - - // For reference: - // struct Vec<T> { capacity: usize, data: *mut T, length: usize } - - // Resulting allocations (on 32-bit little-endian architectures): - // Region A: - // 04 00 00 00 00 00 00 00 02 00 00 00 - // └───(B)───┘ - // - // Region B: - // 01 02 __ __ (underscores denote undefined bytes) - \end{minted} - - \footnotesize{Evaluating the above involves a number of compiler built-ins, - ``unsafe'' code blocks, and more inside the standard library, - but Miri handles it all.} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Unsafe code!} - \begin{minted}[autogobble,fontsize=\scriptsize]{rust} - fn out_of_bounds() -> u8 { - let mut vec = vec![1, 2] - unsafe { *vec.get_unchecked(5) } - } - - // test.rs:3: error: pointer offset outside bounds of allocation - // test.rs:3: unsafe { *vec.get_unchecked(5) } - // ^~~~~~~~~~~~~~~~~~~~~ - - fn undefined_bytes() -> u8 { - let mut vec = Vec::with_capacity(10); - unsafe { *vec.get_unchecked(5) } - } - - // test.rs:3: error: attempted to read undefined bytes - // test.rs:3: unsafe { *vec.get_unchecked(5) } - // ^~~~~~~~~~~~~~~~~~~~~ - \end{minted} -\end{frame} - -\begin{frame} - \frametitle{What can't Miri do?} - \begin{itemize} - \item Miri can't do all the stuff I didn't implement yet. :) - \begin{itemize} - \item non-trivial casts - \item function pointers - \item calling destructors and freeing memory - \item taking target architecture endianess and alignment information - into account when computing data layout - \item handling all constants properly (but, well, Miri might be - replacing the old constants system) - \end{itemize} - \pause - - \item Miri can't do foreign function calls (e.g. calling functions defined - in C or C++), but there is a reasonable way it could be done with libffi. - \begin{itemize} - \item On the other hand, for constant evaluation in the compiler, you - want the evaluator to be deterministic and safe, so FFI calls might be - banned anyway. - \end{itemize} - \pause - - \item Without quite some effort, Miri will probably never handle inline - assembly... - \end{itemize} -\end{frame} - -\begin{frame} - \begin{center} - \LARGE{Questions?} - \end{center} -\end{frame} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Extra slides -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\begin{frame}[fragile] - \frametitle{\texttt{varN} vs. \texttt{argN}} - \begin{center} - \begin{minted}[autogobble,fontsize=\scriptsize]{rust} - // Rust - type Pair = (u64, u64); - fn swap((a, b): Pair) -> Pair { - (b, a) - } - - // Generated MIR - fn swap(arg0: (u64, u64)) -> (u64, u64) { - let var0: u64; // a - let var1: u64; // b - - bb0: { - var0 = arg0.0; // get the 1st part of the pair - var1 = arg0.1; // get the 2nd part of the pair - return = (var1, var0); // build a new pair in the result - goto -> bb1; - } - - bb1: { - return; - } - } - \end{minted} - \end{center} -\end{frame} - -\begin{frame}[fragile] - \frametitle{\texttt{factorial} example} - \begin{center} - \begin{minted}[autogobble,fontsize=\tiny]{rust} - // Rust - fn factorial(n: u64) -> u64 { - (1..n).fold(1, |a, b| a * b) - } - - // Generated MIR - fn factorial(arg0: u64) -> u64 { - let var0: u64; // n - let mut tmp0: Range<u64>; // Miri calculates sizes for generics like Range<u64>. - let mut tmp1: [closure]; - - bb0: { - var0 = arg0; - - // tmp0 = 1..n - tmp0 = Range<u64> { start: const 1u64, end: var0 }; - - // tmp1 = |a, b| a * b - tmp1 = [closure]; - - // This loads the MIR for the `fold` fn from the standard library. - // In general, MIR for any function from any library can be loaded. - // return tmp0.fold(1, tmp1) - return = Range<u64>::fold(tmp0, const 1u64, tmp1) -> bb1; - } - - bb1: { - return; - } - } - \end{minted} - \end{center} -\end{frame} - -\end{document} diff --git a/src/tools/miri/tex/report/latexmkrc b/src/tools/miri/tex/report/latexmkrc deleted file mode 100644 index 23aa1a481b..0000000000 --- a/src/tools/miri/tex/report/latexmkrc +++ /dev/null @@ -1,12 +0,0 @@ -# vim: ft=perl - -$pdf_mode = 1; -$pdflatex = 'lualatex --shell-escape %O %S'; -$out_dir = 'out'; - -# This improves latexmk's detection of source files and generated files. -$recorder = 1; - -# Ignore always-regenerated *.pyg files from the minted package when considering -# whether to run pdflatex again. -$hash_calc_ignore_pattern{'pyg'} = '.*'; diff --git a/src/tools/miri/tex/report/miri-report.tex b/src/tools/miri/tex/report/miri-report.tex deleted file mode 100644 index f8bb37b911..0000000000 --- a/src/tools/miri/tex/report/miri-report.tex +++ /dev/null @@ -1,663 +0,0 @@ -% vim: tw=100 - -\documentclass[twocolumn]{article} -\usepackage{blindtext} -\usepackage[hypcap]{caption} -\usepackage{fontspec} -\usepackage[colorlinks, urlcolor={blue!80!black}]{hyperref} -\usepackage[outputdir=out]{minted} -\usepackage{relsize} -\usepackage{xcolor} - -\setmonofont{Source Code Pro}[ - BoldFont={* Medium}, - BoldItalicFont={* Medium Italic}, - Scale=MatchLowercase, -] - -\newcommand{\rust}[1]{\mintinline{rust}{#1}} - -\begin{document} - -\title{Miri: \\ \smaller{An interpreter for Rust's mid-level intermediate representation}} -\author{Scott Olson\footnote{\href{mailto:scott@solson.me}{scott@solson.me}} \\ - \smaller{Supervised by Christopher Dutchyn}} -\date{April 12th, 2016} -\maketitle - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Abstract} - -The increasing need for safe low-level code in contexts like operating systems and browsers is -driving the development of Rust\footnote{\url{https://www.rust-lang.org}}, a programming language -promising high performance without the risk of memory unsafety. To make programming more convenient, -it's often desirable to be able to generate code or perform some computation at compile-time. The -former is mostly covered by Rust's existing macro feature or build-time code generation, but the -latter is currently restricted to a limited form of constant evaluation capable of little beyond -simple math. - -The architecture of the compiler at the time the existing constant evaluator was built limited its -potential for future extension. However, a new intermediate representation was recently -added\footnote{\href{https://github.com/rust-lang/rfcs/blob/master/text/1211-mir.md}{Rust RFC \#1211: Mid-level IR (MIR)}} -to the Rust compiler between the abstract syntax tree and the back-end LLVM IR, called mid-level -intermediate representation, or MIR for short. This report will demonstrate that writing an -interpreter for MIR is a surprisingly effective approach for supporting a large proportion of Rust's -features in compile-time execution. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Background} - -The Rust compiler generates an instance of \rust{Mir} for each function [\autoref{fig:mir}]. Each -\rust{Mir} structure represents a control-flow graph for a given function, and contains a list of -``basic blocks'' which in turn contain a list of statements followed by a single terminator. Each -statement is of the form \rust{lvalue = rvalue}. An \rust{Lvalue} is used for referencing variables -and calculating addresses such as when dereferencing pointers, accessing fields, or indexing arrays. -An \rust{Rvalue} represents the core set of operations possible in MIR, including reading a value -from an lvalue, performing math operations, creating new pointers, structures, and arrays, and so -on. Finally, a terminator decides where control will flow next, optionally based on the value of a -boolean or integer. - -\begin{figure}[ht] - \begin{minted}[autogobble]{rust} - struct Mir { - basic_blocks: Vec<BasicBlockData>, - // ... - } - - struct BasicBlockData { - statements: Vec<Statement>, - terminator: Terminator, - // ... - } - - struct Statement { - lvalue: Lvalue, - rvalue: Rvalue - } - - enum Terminator { - Goto { target: BasicBlock }, - If { - cond: Operand, - targets: [BasicBlock; 2] - }, - // ... - } - \end{minted} - \caption{MIR (simplified)} - \label{fig:mir} -\end{figure} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{First implementation} - -\subsection{Basic operation} - -To investigate the possibility of executing Rust at compile-time I wrote an interpreter for MIR -called Miri\footnote{\url{https://github.com/solson/miri}}. The structure of the interpreter closely -mirrors the structure of MIR itself. It starts executing a function by iterating the statement list -in the starting basic block, translating the lvalue into a pointer and using the rvalue to decide -what to write into that pointer. Evaluating the rvalue may involve reads (such as for the two sides -of a binary operation) or construction of new values. When the terminator is reached, it is used to -decide which basic block to jump to next. Finally, Miri repeats this entire process, reading -statements from the new block. - -\subsection{Function calls} - -To handle function call terminators\footnote{Calls occur only as terminators, never as rvalues.}, -Miri is required to store some information in a virtual call stack so that it may pick up where it -left off when the callee returns. Each stack frame stores a reference to the \rust{Mir} for the -function being executed, its local variables, its return value location\footnote{Return value -pointers are passed in by callers.}, and the basic block where execution should resume. When Miri -encounters a \rust{Return} terminator in the MIR, it pops one frame off the stack and resumes the -previous function. Miri's execution ends when the function it was initially invoked with returns, -leaving the call stack empty. - -It should be noted that Miri does not itself recurse when a function is called; it merely pushes a -virtual stack frame and jumps to the top of the interpreter loop. Consequently, Miri can interpret -deeply recursive programs without overflowing its native call stack. This approach would allow Miri -to set a virtual stack depth limit and report an error when a program exceeds it. - -\subsection{Flaws} - -This version of Miri supported quite a bit of the Rust language, including booleans, integers, -if-conditions, while-loops, structures, enums, arrays, tuples, pointers, and function calls, -requiring approximately 400 lines of Rust code. However, it had a particularly naive value -representation with a number of downsides. It resembled the data layout of a dynamic language like -Ruby or Python, where every value has the same size\footnote{An \rust{enum} is a discriminated union -with a tag and space to fit the largest variant, regardless of which variant it contains.} in the -interpreter: - -\begin{minted}[autogobble]{rust} - enum Value { - Uninitialized, - Bool(bool), - Int(i64), - Pointer(Pointer), // index into stack - Aggregate { - variant: usize, - data: Pointer, - }, - } -\end{minted} - -This representation did not work well for aggregate types\footnote{That is, structures, enums, -arrays, tuples, and closures.} and required strange hacks to support them. Their contained values -were allocated elsewhere on the stack and pointed to by the aggregate value, which made it more -complicated to implement copying aggregate values from place to place. - -Moreover, while the aggregate issues could be worked around, this value representation made common -unsafe programming tricks (which make assumptions about the low-level value layout) fundamentally -impossible. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Current implementation} - -Roughly halfway through my time working on Miri, Eduard -Burtescu\footnote{\href{https://github.com/eddyb}{eddyb on GitHub}} from the Rust compiler -team\footnote{\url{https://www.rust-lang.org/team.html\#Compiler}} made a post on Rust's internal -forums about a ``Rust Abstract Machine'' -specification\footnote{\href{https://internals.rust-lang.org/t/mir-constant-evaluation/3143/31}{Burtescu's -reply on ``MIR constant evaluation''}} which could be used to implement more powerful compile-time -function execution, similar to what is supported by C++14's \mintinline{cpp}{constexpr} feature. -After clarifying some of the details of the data layout with Burtescu via IRC, I started -implementing it in Miri. - -\subsection{Raw value representation} - -The main difference in the new value representation was to represent values by ``abstract -allocations'' containing arrays of raw bytes with different sizes depending on their types. This -mimics how Rust values are represented when compiled for physical machines. In addition to the raw -bytes, allocations carry information about pointers and undefined bytes. - -\begin{minted}[autogobble]{rust} - struct Memory { - map: HashMap<AllocId, Allocation>, - next_id: AllocId, - } - - struct Allocation { - bytes: Vec<u8>, - relocations: BTreeMap<usize, AllocId>, - undef_mask: UndefMask, - } -\end{minted} - -\subsubsection{Relocations} - -The abstract machine represents pointers through ``relocations'', which are analogous to relocations -in linkers\footnote{\href{https://en.wikipedia.org/wiki/Relocation_(computing)}{Relocation -(computing) - Wikipedia}}. Instead of storing a global memory address in the raw byte representation -like on a physical machine, we store an offset from the start of the target allocation and add an -entry to the relocation table which maps the index of the offset bytes to the target allocation. - -In \autoref{fig:reloc}, the relocation stored at offset 0 in \rust{y} points to offset 2 in \rust{x} -(the 2nd 16-bit integer). Thus, the relocation table for \rust{y} is \texttt{\{0 => -x\}}, meaning the next $N$ bytes after offset 0 denote an offset into allocation \rust{x} where $N$ -is the size of a pointer (4 in this example). The example shows this as a labelled line beneath the -offset bytes. - -In effect, the abstract machine represents pointers as \rust{(allocation_id, offset)} pairs. This -makes it easy to detect when pointer accesses go out of bounds. - -\begin{figure}[hb] - \begin{minted}[autogobble]{rust} - let x: [i16; 3] = [0xAABB, 0xCCDD, 0xEEFF]; - let y = &x[1]; - // x: BB AA DD CC FF EE (6 bytes) - // y: 02 00 00 00 (4 bytes) - // └───(x)───┘ - \end{minted} - \caption{Example relocation on 32-bit little-endian} - \label{fig:reloc} -\end{figure} - -\subsubsection{Undefined byte mask} - -The final piece of an abstract allocation is the undefined byte mask. Logically, we store a boolean -for the definedness of every byte in the allocation, but there are multiple ways to make the storage -more compact. I tried two implementations: one based on the endpoints of alternating ranges of -defined and undefined bytes and the other based on a bitmask. The former is more compact but I found -it surprisingly difficult to update cleanly. I currently use the much simpler bitmask system. - -See \autoref{fig:undef} for an example of an undefined byte in a value, represented by underscores. -Note that there is a value for the second byte in the byte array, but it doesn't matter what it is. -The bitmask would be $10_2$, i.e.\ \rust{[true, false]}. - -\begin{figure}[hb] - \begin{minted}[autogobble]{rust} - let x: [u8; 2] = unsafe { - [1, std::mem::uninitialized()] - }; - // x: 01 __ (2 bytes) - \end{minted} - \caption{Example undefined byte} - \label{fig:undef} -\end{figure} - -\subsection{Computing data layout} - -Currently, the Rust compiler's data layouts for types are hidden from Miri, so it does its own data -layout computation which will not always match what the compiler does, since Miri doesn't take -target type alignments into account. In the future, the Rust compiler may be modified so that Miri -can use the exact same data layout. - -Miri's data layout calculation is a relatively simple transformation from Rust types to a structure -with constant size values for primitives and sets of fields with offsets for aggregate types. These -layouts are cached for performance. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Deterministic execution} -\label{sec:deterministic} - -In order to be effective as a compile-time evaluator, Miri must have \emph{deterministic execution}, -as explained by Burtescu in the ``Rust Abstract Machine'' post. That is, given a function and -arguments to that function, Miri should always produce identical results. This is important for -coherence in the type checker when constant evaluations are involved in types, such as for sizes of -array types: - -\begin{minted}[autogobble,mathescape]{rust} - const fn get_size() -> usize { /* $\ldots$ */ } - let array: [i32; get_size()]; -\end{minted} - -Since Miri allows execution of unsafe code\footnote{In fact, the distinction between safe and unsafe -doesn't exist at the MIR level.}, it is specifically designed to remain safe while interpreting -potentially unsafe code. When Miri encounters an unrecoverable error, it reports it via the Rust -compiler's usual error reporting mechanism, pointing to the part of the original code where the -error occurred. Below is an example from Miri's -repository.\footnote{\href{https://github.com/solson/miri/blob/master/test/errors.rs}{miri/test/errors.rs}} - -\begin{minted}[autogobble]{rust} - let b = Box::new(42); - let p: *const i32 = &*b; - drop(b); - unsafe { *p } - // ~~ error: dangling pointer - // was dereferenced -\end{minted} -\label{dangling-pointer} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Language support} - -In its current state, Miri supports a large proportion of the Rust language, detailed below. The -major exception is a lack of support for FFI\footnote{Foreign Function Interface, e.g.\ calling -functions defined in Assembly, C, or C++.}, which eliminates possibilities like reading and writing -files, user input, graphics, and more. However, for compile-time evaluation in Rust, this limitation -is desired. - -\subsection{Primitives} - -Miri supports booleans, integers of various sizes and signed-ness (i.e.\ \rust{i8}, \rust{i16}, -\rust{i32}, \rust{i64}, \rust{isize}, \rust{u8}, \rust{u16}, \rust{u32}, \rust{u64}, \rust{usize}), -and unary and binary operations over these types. The \rust{isize} and \rust{usize} types will be -sized according to the target machine's pointer size just like in compiled Rust. The \rust{char} and -float types (\rust{f32}, \rust{f64}) are not supported yet, but there are no known barriers to doing -so. - -When examining a boolean in an \rust{if} condition, Miri will report an error if its byte -representation is not precisely 0 or 1, since having any other value for a boolean is undefined -behaviour in Rust. The \rust{char} type will have similar restrictions once it is implemented. - -\subsection{Pointers} - -Both references and raw pointers are supported, with essentially no difference between them in Miri. -It is also possible to do pointer comparisons and math. However, a few operations are considered -errors and a few require special support. - -Firstly, pointers into the same allocations may be compared for ordering, but pointers into -different allocations are considered unordered and Miri will complain if you attempt this. The -reasoning is that different allocations may have different orderings in the global address space at -runtime, making this non-deterministic. However, pointers into different allocations \emph{may} be -compared for direct equality (they are always unequal). - -Secondly, pointers represented using relocations may be compared against pointers casted from -integers (e.g.\ \rust{0 as *const i32}) for things like null pointer checks. To handle these cases, -Miri has a concept of ``integer pointers'' which are always unequal to abstract pointers. Integer -pointers can be compared and operated upon freely. However, note that it is impossible to go from an -integer pointer to an abstract pointer backed by a relocation. It is not valid to dereference an -integer pointer. - -\subsubsection{Slice pointers} - -Rust supports pointers to ``dynamically-sized types'' such as \rust{[T]} and \rust{str} which -represent arrays of indeterminate size. Pointers to such types contain an address \emph{and} the -length of the referenced array. Miri supports these fully. - -\subsubsection{Trait objects} - -Rust also supports pointers to ``trait objects'' which represent some type that implements a trait, -with the specific type unknown at compile-time. These are implemented using virtual dispatch with a -vtable, similar to virtual methods in C++. Miri does not currently support these at all. - -\subsection{Aggregates} - -Aggregates include types declared with \rust{struct} or \rust{enum} as well as tuples, arrays, and -closures. Miri supports all common usage of all of these types. The main missing piece is to handle -\texttt{\#[repr(..)]} annotations which adjust the layout of a \rust{struct} or \rust{enum}. - -\subsection{Lvalue projections} - -This category includes field accesses, dereferencing, accessing data in an \rust{enum} variant, and -indexing arrays. Miri supports all of these, including nested projections such as -\rust{*foo.bar[2]}. - -\subsection{Control flow} - -All of Rust's standard control flow features, including \rust{loop}, \rust{while}, \rust{for}, -\rust{if}, \rust{if let}, \rust{while let}, \rust{match}, \rust{break}, \rust{continue}, and -\rust{return} are supported. In fact, supporting these was quite easy since the Rust compiler -reduces them all down to a small set of control-flow graph primitives in MIR. - -\subsection{Function calls} - -As previously described, Miri supports arbitrary function calls without growing the native stack -(only its virtual call stack). It is somewhat limited by the fact that cross-crate\footnote{A crate -is a single Rust library (or executable).} calls only work for functions whose MIR is stored in -crate metadata. This is currently true for \rust{const}, generic, and inline functions. -A branch of the compiler could be made that stores MIR for all functions. This would be a non-issue -for a compile-time evaluator based on Miri, since it would only call \rust{const fn}s. - -\subsubsection{Method calls} - -Miri supports trait method calls, including invoking all the compiler-internal lookup needed to find -the correct implementation of the method. - -\subsubsection{Closures} - -Calls to closures are also supported with the exception of one edge case\footnote{Calling a closure -that takes a reference to its captures via a closure interface that passes the captures by value is -not yet supported.}. The value part of a closure that holds the captured variables is handled as an -aggregate and the function call part is mostly the same as a trait method call, but with the added -complication that closures use a separate calling convention within the compiler. - -\subsubsection{Function pointers} - -Function pointers are not currently supported by Miri, but there is a relatively simple way they -could be encoded using a relocation with a special reserved allocation identifier. The offset of the -relocation would determine which function it points to in a special array of functions in the -interpreter. - -\subsubsection{Intrinsics} - -To support unsafe code, and in particular to support Rust's standard library, it became clear that -Miri would have to support calls to compiler -intrinsics\footnote{\url{https://doc.rust-lang.org/stable/std/intrinsics/index.html}}. Intrinsics -are function calls which cause the Rust compiler to produce special-purpose code instead of a -regular function call. Miri simply recognizes intrinsic calls by their unique -ABI\footnote{Application Binary Interface, which defines calling conventions. Includes ``C'', -``Rust'', and ``rust-intrinsic''.} and name and runs special-purpose code to handle them. - -An example of an important intrinsic is \rust{size_of} which will cause Miri to write the size of -the type in question to the return value location. The Rust standard library uses intrinsics heavily -to implement various data structures, so this was a major step toward supporting them. Intrinsics -have been implemented on a case-by-case basis as tests which required them were written, and not all -intrinsics are supported yet. - -\subsubsection{Generic function calls} - -Miri needs special support for generic function calls since Rust is a \emph{monomorphizing} -compiler, meaning it generates a special version of each function for each distinct set of type -parameters it gets called with. Since functions in MIR are still polymorphic, Miri has to do the -same thing and substitute function type parameters into all types it encounters to get fully -concrete, monomorphized types. For example, in\ldots - -\begin{minted}[autogobble]{rust} - fn some<T>(t: T) -> Option<T> { Some(t) } -\end{minted} - -\ldots{}Miri needs to know the size of \rust{T} to copy the right amount of bytes from the argument -to the return value. If we call \rust{some(10i32)} Miri will execute \rust{some} knowing that -\rust{T = i32} and generate a representation for \rust{Option<i32>}. - -Miri currently does this monomorphization lazily on-demand unlike the Rust back-end which does it -all ahead of time. - -\subsection{Heap allocations} - -The next piece of the puzzle for supporting interesting programs (and the standard library) was heap -allocations. There are two main interfaces for heap allocation in Rust: the built-in \rust{Box} -rvalue in MIR and a set of C ABI foreign functions including \rust{__rust_allocate}, -\rust{__rust_reallocate}, and \rust{__rust_deallocate}. These correspond approximately to -\mintinline{c}{malloc}, \mintinline{c}{realloc}, and \mintinline{c}{free} in C. - -The \rust{Box} rvalue allocates enough space for a single value of a given type. This was easy to -support in Miri. It simply creates a new abstract allocation in the same manner as for -stack-allocated values, since there's no major difference between them in Miri. - -The allocator functions, which are used to implement things like Rust's standard \rust{Vec<T>} type, -were a bit trickier. Rust declares them as \rust{extern "C" fn} so that different allocator -libraries can be linked in at the user's option. Since Miri doesn't actually support FFI and wants -full control of allocations for safety, it ``cheats'' and recognizes these allocator functions in -essentially the same way it recognizes compiler intrinsics. Then, a call to \rust{__rust_allocate} -simply creates another abstract allocation with the requested size and \rust{__rust_reallocate} -grows one. - -In the future, Miri should also track which allocations came from \rust{__rust_allocate} so it can -reject reallocate or deallocate calls on stack allocations. - -\subsection{Destructors} - -When a value which ``owns'' some resource (like a heap allocation or file handle) goes out of scope, -Rust inserts \emph{drop glue} that calls the user-defined destructor for the type if it has one, and -then drops all of the subfields. Destructors for types like \rust{Box<T>} and \rust{Vec<T>} -deallocate heap memory. - -Miri doesn't yet support calling user-defined destructors, but it has most of the machinery in place -to do so already. There \emph{is} support for dropping \rust{Box<T>} types, including deallocating -their associated allocations. This is enough to properly execute the dangling pointer example in -\autoref{sec:deterministic}. - -\subsection{Constants} - -Only basic integer, boolean, string, and byte-string literals are currently supported. Evaluating -more complicated constant expressions in their current form would be a somewhat pointless exercise -for Miri. Instead, we should lower constant expressions to MIR so Miri can run them directly, which -is precisely what would need be done to use Miri as the compiler's constant evaluator. - -\subsection{Static variables} - -Miri doesn't currently support statics, but they would need support similar to constants. Also note -that while it would be invalid to write to static (i.e.\ global) variables in Miri executions, it -would probably be fine to allow reads. - -\subsection{Standard library} - -Throughout the implementation of the above features, I often followed this process: - -\begin{enumerate} - \item Try using a feature from the standard library. - \item See where Miri runs into stuff it can't handle. - \item Fix the problem. - \item Go to 1. -\end{enumerate} - -At present, Miri supports a number of major non-trivial features from the standard library along -with tons of minor features. Smart pointer types such as \rust{Box}, \rust{Rc}\footnote{Reference -counted shared pointer} and \rust{Arc}\footnote{Atomically reference-counted thread-safe shared -pointer} all seem to work. I've also tested using the shared smart pointer types with \rust{Cell} -and \rust{RefCell}\footnote{\href{https://doc.rust-lang.org/stable/std/cell/index.html}{Rust -documentation for cell types}} for internal mutability, and that works as well, although -\rust{RefCell} can't ever be borrowed twice until I implement destructor calls, since a destructor -is what releases the borrow. - -But the standard library collection I spent the most time on was \rust{Vec}, the standard -dynamically-growable array type, similar to C++'s \texttt{std::vector} or Java's -\texttt{java.util.ArrayList}. In Rust, \rust{Vec} is an extremely pervasive collection, so -supporting it is a big win for supporting a larger swath of Rust programs in Miri. - -See \autoref{fig:vec} for an example (working in Miri today) of initializing a \rust{Vec} with a -small amount of space on the heap and then pushing enough elements to force it to reallocate its -data array. This involves cross-crate generic function calls, unsafe code using raw pointers, heap -allocation, handling of uninitialized memory, compiler intrinsics, and more. - -\begin{figure}[t] - \begin{minted}[autogobble]{rust} - struct Vec<T> { - data: *mut T, // 4 byte pointer - capacity: usize, // 4 byte integer - length: usize, // 4 byte integer - } - - let mut v: Vec<u8> = - Vec::with_capacity(2); - // v: 00 00 00 00 02 00 00 00 00 00 00 00 - // └─(data)──┘ - // data: __ __ - - v.push(1); - // v: 00 00 00 00 02 00 00 00 01 00 00 00 - // └─(data)──┘ - // data: 01 __ - - v.push(2); - // v: 00 00 00 00 02 00 00 00 02 00 00 00 - // └─(data)──┘ - // data: 01 02 - - v.push(3); - // v: 00 00 00 00 04 00 00 00 03 00 00 00 - // └─(data)──┘ - // data: 01 02 03 __ - \end{minted} - \caption{\rust{Vec} example on 32-bit little-endian} - \label{fig:vec} -\end{figure} - -Miri supports unsafe operations on \rust{Vec} like \rust{v.set_len(10)} or -\rust{v.get_unchecked(2)}, provided that such calls do no invoke undefined behaviour. If a call -\emph{does} invoke undefined behaviour, Miri will abort with an appropriate error message (see -\autoref{fig:vec-error}). - -\begin{figure}[t] - \begin{minted}[autogobble]{rust} - fn out_of_bounds() -> u8 { - let v = vec![1, 2]; - let p = unsafe { v.get_unchecked(5) }; - *p + 10 - // ~~ error: pointer offset outside - // bounds of allocation - } - - fn undefined_bytes() -> u8 { - let v = Vec::<u8>::with_capacity(10); - let p = unsafe { v.get_unchecked(5) }; - *p + 10 - // ~~~~~~~ error: attempted to read - // undefined bytes - } - \end{minted} - \caption{\rust{Vec} examples with undefined behaviour} - \label{fig:vec-error} -\end{figure} - -\newpage - -Here is one final code sample Miri can execute that demonstrates many features at once, including -vectors, heap allocation, iterators, closures, raw pointers, and math: - -\begin{minted}[autogobble]{rust} - let x: u8 = vec![1, 2, 3, 4] - .into_iter() - .map(|x| x * x) - .fold(0, |x, y| x + y); - // x: 1e (that is, the hex value - // 0x1e = 30 = 1 + 4 + 9 + 16) -\end{minted} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Future directions} - -\subsection{Finishing the implementation} - -There are a number of pressing items on my to-do list for Miri, including: - -\begin{itemize} - \item A much more comprehensive and automated test suite. - \item User-defined destructor calls. - \item Non-trivial casts between primitive types like integers and pointers. - \item Handling statics and global memory. - \item Reporting errors for all undefined behaviour.\footnote{\href{https://doc.rust-lang.org/reference.html\#behavior-considered-undefined}{The Rust reference on what is considered undefined behaviour}} - \item Function pointers. - \item Accounting for target machine primitive type alignment and endianness. - \item Optimizations (undefined byte masks, tail-calls). - \item Benchmarking Miri vs. unoptimized Rust. - \item Various \texttt{TODO}s and \texttt{FIXME}s left in the code. - \item Integrating into the compiler proper. -\end{itemize} - -\subsection{Future projects} - -Other possible Miri-related projects include: - -\begin{itemize} - \item A read-eval-print-loop (REPL) for Rust, which may be easier to implement on top of Miri than - the usual LLVM back-end. - \item A graphical or text-mode debugger that steps through MIR execution one statement at a time, - for figuring out why some compile-time execution is raising an error or simply learning how Rust - works at a low level. - \item A less restricted version of Miri that is able to run foreign functions from C/C++ and - generally has full access to the operating system. Such an interpreter could be used to more - quickly prototype changes to the Rust language that would otherwise require changes to the LLVM - back-end. - \item Unit-testing the compiler by comparing the results of Miri's execution against the results - of LLVM-compiled machine code's execution. This would help to guarantee that compile-time - execution works the same as runtime execution. - \item Some kind of Miri-based symbolic evaluator that examines multiple possible code paths at - once to determine if undefined behaviour could be observed on any of them. -\end{itemize} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Final thoughts} - -Writing an interpreter which models values of varying sizes, stack and heap allocation, unsafe -memory operations, and more requires some unconventional techniques compared to conventional -interpreters targeting dynamically-typed languages. However, aside from the somewhat complicated -abstract memory model, making Miri work was primarily a software engineering problem, and not a -particularly tricky one. This is a testament to MIR's suitability as an intermediate representation -for Rust---removing enough unnecessary abstraction to keep it simple. For example, Miri doesn't even -need to know that there are different kinds of loops, or how to match patterns in a \rust{match} -expression. - -Another advantage to targeting MIR is that any new features at the syntax-level or type-level -generally require little to no change in Miri. For example, when the new ``question mark'' syntax -for error handling\footnote{ - \href{https://github.com/rust-lang/rfcs/blob/master/text/0243-trait-based-exception-handling.md} - {Question mark syntax RFC}} -was added to rustc, Miri required no change to support it. -When specialization\footnote{ - \href{https://github.com/rust-lang/rfcs/blob/master/text/1210-impl-specialization.md} - {Specialization RFC}} -was added, Miri supported it with just minor changes to trait method lookup. - -Of course, Miri also has limitations. The inability to execute FFI and inline assembly reduces the -amount of Rust programs Miri could ever execute. The good news is that in the constant evaluator, -FFI can be stubbed out in cases where it makes sense, like I did with \rust{__rust_allocate}. For a -version of Miri not intended for constant evaluation, it may be possible to use libffi to call C -functions from the interpreter. - -In conclusion, Miri is a surprisingly effective project, and a lot of fun to implement. Due to MIR's -tendency to collapse multiple source-level features into one, I often ended up supporting features I -hadn't explicitly intended to. I am excited to work with the compiler team going forward to try to -make Miri useful for constant evaluation in Rust. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\section{Thanks} - -A big thanks goes to Eduard Burtescu for writing the abstract machine specification and answering my -incessant questions on IRC, to Niko Matsakis for coming up with the idea for Miri and supporting my -desire to work with the Rust compiler, and to my research supervisor Christopher Dutchyn. Thanks -also to everyone else on the compiler team and on Mozilla IRC who helped me figure stuff out. -Finally, thanks to Daniel Keep and everyone else who helped fix my numerous writing mistakes. - -\end{document} diff --git a/src/tools/miri/xargo/Cargo.lock b/src/tools/miri/xargo/Cargo.lock deleted file mode 100644 index 031ad9a879..0000000000 --- a/src/tools/miri/xargo/Cargo.lock +++ /dev/null @@ -1,4 +0,0 @@ -[root] -name = "miri-xargo" -version = "0.0.0" - diff --git a/src/tools/miri/xargo/Cargo.toml b/src/tools/miri/xargo/Cargo.toml deleted file mode 100644 index 9129c105b1..0000000000 --- a/src/tools/miri/xargo/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "miri-xargo" -description = "A dummy project for building libstd with xargo." -version = "0.0.0" - -[dependencies] diff --git a/src/tools/miri/xargo/Xargo.toml b/src/tools/miri/xargo/Xargo.toml deleted file mode 100644 index 4b650b97de..0000000000 --- a/src/tools/miri/xargo/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[dependencies] -std = {features = ["panic_unwind", "jemalloc", "backtrace"]} diff --git a/src/tools/miri/xargo/build.sh b/src/tools/miri/xargo/build.sh deleted file mode 100755 index 15a7c77091..0000000000 --- a/src/tools/miri/xargo/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -cd "$(dirname "$0")" -RUSTFLAGS='-Zalways-encode-mir -Zmir-emit-validate=1' xargo build diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py new file mode 100755 index 0000000000..b90947e5a4 --- /dev/null +++ b/src/tools/publish_toolstate.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright 2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +import sys +import re +import json +import copy +import datetime +import collections + +# List of people to ping when the status of a tool changed. +MAINTAINERS = { + 'miri': '@oli-obk @RalfJung @eddyb', + 'clippy-driver': '@Manishearth @llogiq @mcarton @oli-obk', + 'rls': '@nrc', + 'rustfmt': '@nrc', +} + + +def read_current_status(current_commit, path): + '''Reads build status of `current_commit` from content of `history/*.tsv` + ''' + with open(path, 'rU') as f: + for line in f: + (commit, status) = line.split('\t', 1) + if commit == current_commit: + return json.loads(status) + return {} + + +def update_latest(current_commit, relevant_pr_number, current_datetime): + '''Updates `_data/latest.json` to match build result of the given commit. + ''' + with open('_data/latest.json', 'rb+') as f: + latest = json.load(f, object_pairs_hook=collections.OrderedDict) + + current_status = { + os: read_current_status(current_commit, 'history/' + os + '.tsv') + for os in ['windows', 'linux'] + } + + slug = 'rust-lang/rust' + message = '📣 Toolstate changed by {}!\n\nTested on commit {}@{}.\n\n' \ + .format(relevant_pr_number, slug, current_commit) + anything_changed = False + for status in latest: + tool = status['tool'] + changed = False + + for os, s in current_status.items(): + old = status[os] + new = s.get(tool, old) + status[os] = new + if new > old: + changed = True + message += '🎉 {} on {}: {} → {}.\n' \ + .format(tool, os, old, new) + elif new < old: + changed = True + message += '💔 {} on {}: {} → {} (cc {}).\n' \ + .format(tool, os, old, new, MAINTAINERS[tool]) + + if changed: + status['commit'] = current_commit + status['datetime'] = current_datetime + anything_changed = True + + if not anything_changed: + return '' + + f.seek(0) + f.truncate(0) + json.dump(latest, f, indent=4, separators=(',', ': ')) + return message + + +if __name__ == '__main__': + cur_commit = sys.argv[1] + cur_datetime = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') + cur_commit_msg = sys.argv[2] + save_message_to_path = sys.argv[3] + + relevant_pr_match = re.search('#[0-9]+', cur_commit_msg) + if relevant_pr_match: + relevant_pr_number = 'rust-lang/rust' + relevant_pr_match.group(0) + else: + relevant_pr_number = '<unknown PR>' + + message = update_latest(cur_commit, relevant_pr_number, cur_datetime) + if message: + print(message) + with open(save_message_to_path, 'w') as f: + f.write(message) + else: + print('<Nothing changed>') diff --git a/src/tools/rust-installer/Cargo.toml b/src/tools/rust-installer/Cargo.toml index d054e3d623..2535744ded 100644 --- a/src/tools/rust-installer/Cargo.toml +++ b/src/tools/rust-installer/Cargo.toml @@ -10,7 +10,7 @@ path = "src/main.rs" [dependencies] error-chain = "0.11.0" -flate2 = "0.2.19" +flate2 = "1.0.1" tar = "0.4.13" walkdir = "1.0.7" xz2 = "0.1.3" diff --git a/src/tools/rust-installer/src/combiner.rs b/src/tools/rust-installer/src/combiner.rs index 3b827a3798..675ed8f2dc 100644 --- a/src/tools/rust-installer/src/combiner.rs +++ b/src/tools/rust-installer/src/combiner.rs @@ -65,8 +65,8 @@ impl Combiner { let components = create_new_file(package_dir.join("components"))?; for input_tarball in self.input_tarballs.split(',').map(str::trim).filter(|s| !s.is_empty()) { // Extract the input tarballs - GzDecoder::new(open_file(&input_tarball)?) - .and_then(|tar| Archive::new(tar).unpack(&self.work_dir)) + let tar = GzDecoder::new(open_file(&input_tarball)?); + Archive::new(tar).unpack(&self.work_dir) .chain_err(|| format!("unable to extract '{}' into '{}'", &input_tarball, self.work_dir))?; diff --git a/src/tools/rust-installer/src/tarballer.rs b/src/tools/rust-installer/src/tarballer.rs index f1eeb901c4..cd6adbe587 100644 --- a/src/tools/rust-installer/src/tarballer.rs +++ b/src/tools/rust-installer/src/tarballer.rs @@ -79,7 +79,7 @@ impl Tarballer { let contents2 = contents.clone(); let t = thread::spawn(move || { let mut gz = GzEncoder::new(create_new_file(tar_gz)?, - flate2::Compression::Best); + flate2::Compression::best()); gz.write_all(&contents2).chain_err(|| "failed to write .gz")?; gz.finish().chain_err(|| "failed to finish .gz") }); diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 9736c03993..3156e93cc7 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -89,9 +89,12 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) { let mut contents = String::new(); - super::walk_many(&[&path.join("test/compile-fail"), + super::walk_many(&[&path.join("test/ui-fulldeps"), + &path.join("test/ui"), + &path.join("test/compile-fail"), &path.join("test/compile-fail-fulldeps"), - &path.join("test/parse-fail"),], + &path.join("test/parse-fail"), + &path.join("test/ui"),], &mut |path| super::filter_dirs(path), &mut |file| { let filename = file.file_name().unwrap().to_string_lossy(); @@ -150,9 +153,9 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) { for &(name, _) in gate_untested.iter() { println!("Expected a gate test for the feature '{}'.", name); - println!("Hint: create a file named 'feature-gate-{}.rs' in the compile-fail\ - \n test suite, with its failures due to missing usage of\ - \n #![feature({})].", name, name); + println!("Hint: create a failing test file named 'feature-gate-{}.rs'\ + \n in the 'ui' test suite, with its failures due to\ + \n missing usage of #![feature({})].", name, name); println!("Hint: If you already have such a test and don't want to rename it,\ \n you can also add a // gate-test-{} line to the test file.", name); diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 598620fa29..61d71986b0 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -56,8 +56,8 @@ fn filter_dirs(path: &Path) -> bool { "src/llvm", "src/libbacktrace", "src/libcompiler_builtins", + "src/librustc_data_structures/owning_ref", "src/compiler-rt", - "src/rustllvm", "src/liblibc", "src/vendor", "src/rt/hoedown", @@ -67,6 +67,8 @@ fn filter_dirs(path: &Path) -> bool { "src/tools/rust-installer", "src/tools/rustfmt", "src/tools/miri", + "src/librustc/mir/interpret", + "src/librustc_mir/interpret", ]; skip.iter().any(|p| path.ends_with(p)) } diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index a689d8a8be..b784a0e4c5 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -50,6 +50,11 @@ const UNEXPLAINED_IGNORE_DOCTEST_INFO: &str = r#"unexplained "```ignore" doctest "#; +const LLVM_UNREACHABLE_INFO: &str = r"\ +C++ code used llvm_unreachable, which triggers undefined behavior +when executed when assertions are disabled. +Use llvm::report_fatal_error for increased robustness."; + /// Parser states for line_is_url. #[derive(PartialEq)] #[allow(non_camel_case_types)] @@ -108,7 +113,7 @@ pub fn check(path: &Path, bad: &mut bool) { let mut contents = String::new(); super::walk(path, &mut super::filter_dirs, &mut |file| { let filename = file.file_name().unwrap().to_string_lossy(); - let extensions = [".rs", ".py", ".js", ".sh", ".c", ".h"]; + let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h"]; if extensions.iter().all(|e| !filename.ends_with(e)) || filename.starts_with(".#") { return @@ -125,6 +130,7 @@ pub fn check(path: &Path, bad: &mut bool) { let skip_tab = contents.contains("ignore-tidy-tab"); let skip_length = contents.contains("ignore-tidy-linelength"); let skip_end_whitespace = contents.contains("ignore-tidy-end-whitespace"); + let mut trailing_new_lines = 0; for (i, line) in contents.split("\n").enumerate() { let mut err = |msg: &str| { tidy_error!(bad, "{}:{}: {}", file.display(), i + 1, msg); @@ -153,10 +159,23 @@ pub fn check(path: &Path, bad: &mut bool) { if line.ends_with("```ignore") || line.ends_with("```rust,ignore") { err(UNEXPLAINED_IGNORE_DOCTEST_INFO); } + if filename.ends_with(".cpp") && line.contains("llvm_unreachable") { + err(LLVM_UNREACHABLE_INFO); + } + if line.is_empty() { + trailing_new_lines += 1; + } else { + trailing_new_lines = 0; + } } if !licenseck(file, &contents) { tidy_error!(bad, "{}: incorrect license", file.display()); } + match trailing_new_lines { + 0 => tidy_error!(bad, "{}: missing trailing newline", file.display()), + 1 | 2 => {} + n => tidy_error!(bad, "{}: too many trailing newlines ({})", file.display(), n), + }; }) } diff --git a/src/tools/toolstate.toml b/src/tools/toolstate.toml deleted file mode 100644 index 744a0f96ad..0000000000 --- a/src/tools/toolstate.toml +++ /dev/null @@ -1,35 +0,0 @@ -# This file reflects the current status of all tools which are allowed -# to fail without failing the build. -# -# There are three states a tool can be in: -# 1. Broken: The tool doesn't build -# 2. Compiling: The tool builds but its tests are failing -# 3. Testing: The tool builds and its tests are passing -# -# In the future there will be further states like "Distributing", which -# configures whether the tool is included in the Rust distribution. -# -# If a tool was working before your PR but is broken now, consider -# opening a PR against the tool so that it works with your changes. -# If the tool stops compiling, change its state to `Broken`. If it -# still builds, change it to `Compiling`. -# How to do that is described in -# "CONTRIBUTING.md#External Dependencies". If the effort required is not -# warranted (e.g. due to the tool abusing some API that you changed, and -# fixing the tool would mean a significant refactoring) remember to ping -# the tool authors, so they can fix it, instead of being surprised by the -# breakage. -# -# Each tool has a list of people to ping - -# ping @oli-obk @RalfJung @eddyb -miri = "Broken" - -# ping @Manishearth @llogiq @mcarton @oli-obk -clippy = "Testing" - -# ping @nrc -rls = "Testing" - -# ping @nrc -rustfmt = "Testing" diff --git a/src/vendor/aho-corasick/.cargo-checksum.json b/src/vendor/aho-corasick/.cargo-checksum.json index e180eb0606..56e5d7175f 100644 --- a/src/vendor/aho-corasick/.cargo-checksum.json +++ b/src/vendor/aho-corasick/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"d471402ab06e94fb67bda462107845d5b20d9813b6f759fa4ac7f79448f3665c",".travis.yml":"e17babe5ba0bdd19ec59a37b4a099fd4313bff58be63a2ff506075f9a97dc172","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"b3fa06c2147a4749cd984ded69024ddcc8b7d578ab763b60227b3ba474c3ec70","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","Makefile":"a45a128685a2ae7d4fa39d310786674417ee113055ef290a11f88002285865fc","README.md":"9bc60d2cec222b50f87c85cf9475349bb228a36f89796c5d6481c52560ddde3a","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","benches/bench.rs":"acf4844efadeafc7bc396c2b16f2a184e140b6c17d1084dbaf454196de2090cd","benches/random.txt":"9386fb3efedc7ffbd09fb49088347f1056bc2d90a861009fa2f804cdb714efcb","ctags.rust":"3d128d3cc59f702e68953ba2fe6c3f46bc6991fc575308db060482d5da0c79f3","examples/dict-search.rs":"30eb44b1a0b599507db4c23a90f74199faabc64a8ae1d603ecdf3bba7428eb1e","session.vim":"95cb1d7caf0ff7fbe76ec911988d908ddd883381c925ba64b537695bc9f021c4","src/autiter.rs":"98c31a7fbe21cfacaa858f90409f0d86edd46dda1b7651f4e800d929a50afb7b","src/full.rs":"b83a9c8ff3ef611c316b68650915df2d7f361a49b59dab103dc2c5476f2d8303","src/lib.rs":"68bf2ed02d58bebee6f7f7579038f1e4b60a2c4acc334263cb837bcbe15ffe94","src/main.rs":"fc867cb5f0b02d0f49ecab06b72c05a247cbcf3bf9228c235de8e787bda7bef5"},"package":"500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"d471402ab06e94fb67bda462107845d5b20d9813b6f759fa4ac7f79448f3665c",".travis.yml":"e17babe5ba0bdd19ec59a37b4a099fd4313bff58be63a2ff506075f9a97dc172","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"2a912192049b3d5e15f2a5773fdd72087027859e1ee17dba5bc4ad5071481399","Cargo.toml.orig":"d9661f9adc22312ba97eba209caaebce29377e43f81487ba8e40d10143c25976","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","Makefile":"a45a128685a2ae7d4fa39d310786674417ee113055ef290a11f88002285865fc","README.md":"9fb3256ce6fc5b25c9a92fe3b8f7a82a26d380fcf6121c934c2bb6f85102fede","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","benches/bench.rs":"acf4844efadeafc7bc396c2b16f2a184e140b6c17d1084dbaf454196de2090cd","benches/random.txt":"9386fb3efedc7ffbd09fb49088347f1056bc2d90a861009fa2f804cdb714efcb","ctags.rust":"3d128d3cc59f702e68953ba2fe6c3f46bc6991fc575308db060482d5da0c79f3","examples/dict-search.rs":"30eb44b1a0b599507db4c23a90f74199faabc64a8ae1d603ecdf3bba7428eb1e","session.vim":"95cb1d7caf0ff7fbe76ec911988d908ddd883381c925ba64b537695bc9f021c4","src/autiter.rs":"98c31a7fbe21cfacaa858f90409f0d86edd46dda1b7651f4e800d929a50afb7b","src/full.rs":"b83a9c8ff3ef611c316b68650915df2d7f361a49b59dab103dc2c5476f2d8303","src/lib.rs":"68bf2ed02d58bebee6f7f7579038f1e4b60a2c4acc334263cb837bcbe15ffe94","src/main.rs":"fc867cb5f0b02d0f49ecab06b72c05a247cbcf3bf9228c235de8e787bda7bef5"},"package":"d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"} \ No newline at end of file diff --git a/src/vendor/aho-corasick/Cargo.toml b/src/vendor/aho-corasick/Cargo.toml index f33ed53cd7..93d5489c75 100644 --- a/src/vendor/aho-corasick/Cargo.toml +++ b/src/vendor/aho-corasick/Cargo.toml @@ -1,42 +1,26 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] name = "aho-corasick" -version = "0.6.3" #:version +version = "0.6.4" authors = ["Andrew Gallant <jamslam@gmail.com>"] +exclude = ["benches/sherlock.txt"] description = "Fast multiple substring searching with finite state machines." -documentation = "http://burntsushi.net/rustdoc/aho_corasick/" homepage = "https://github.com/BurntSushi/aho-corasick" -repository = "https://github.com/BurntSushi/aho-corasick" readme = "README.md" keywords = ["string", "search", "text", "aho", "corasick"] license = "Unlicense/MIT" -exclude = ["benches/sherlock.txt"] - -[lib] -name = "aho_corasick" - -[[bin]] -name = "aho-corasick-dot" -test = false -doc = false -bench = false - -[dependencies] -memchr = "1" - -[dev-dependencies] -csv = "0.15" -docopt = "0.7" -memmap = "0.5" -quickcheck = { version = "0.4", default-features = false } -rand = "0.3" -rustc-serialize = "0.3" - -[[bench]] -name = "bench" -path = "benches/bench.rs" -test = false -bench = true - +repository = "https://github.com/BurntSushi/aho-corasick" [profile.test] debug = true @@ -45,3 +29,40 @@ debug = true [profile.release] debug = true + +[lib] +name = "aho_corasick" + +[[bin]] +name = "aho-corasick-dot" +test = false +bench = false +doc = false + +[[bench]] +name = "bench" +path = "benches/bench.rs" +test = false +bench = true +[dependencies.memchr] +version = "2" +[dev-dependencies.csv] +version = "0.15" + +[dev-dependencies.docopt] +version = "0.7" + +[dev-dependencies.memmap] +version = "0.5" + +[dev-dependencies.quickcheck] +version = "0.5" +default-features = false + +[dev-dependencies.rand] +version = "0.3" + +[dev-dependencies.rustc-serialize] +version = "0.3" +[badges.travis-ci] +repository = "BurntSushi/aho-corasick" diff --git a/src/vendor/aho-corasick/Cargo.toml.orig b/src/vendor/aho-corasick/Cargo.toml.orig new file mode 100644 index 0000000000..b314846777 --- /dev/null +++ b/src/vendor/aho-corasick/Cargo.toml.orig @@ -0,0 +1,49 @@ +[package] +name = "aho-corasick" +version = "0.6.4" #:version +authors = ["Andrew Gallant <jamslam@gmail.com>"] +description = "Fast multiple substring searching with finite state machines." +homepage = "https://github.com/BurntSushi/aho-corasick" +repository = "https://github.com/BurntSushi/aho-corasick" +readme = "README.md" +keywords = ["string", "search", "text", "aho", "corasick"] +license = "Unlicense/MIT" +exclude = ["benches/sherlock.txt"] + +[badges] +travis-ci = { repository = "BurntSushi/aho-corasick" } + +[lib] +name = "aho_corasick" + +[[bin]] +name = "aho-corasick-dot" +test = false +doc = false +bench = false + +[dependencies] +memchr = "2" + +[dev-dependencies] +csv = "0.15" +docopt = "0.7" +memmap = "0.5" +quickcheck = { version = "0.5", default-features = false } +rand = "0.3" +rustc-serialize = "0.3" + +[[bench]] +name = "bench" +path = "benches/bench.rs" +test = false +bench = true + +[profile.test] +debug = true + +[profile.bench] +debug = true + +[profile.release] +debug = true diff --git a/src/vendor/aho-corasick/README.md b/src/vendor/aho-corasick/README.md index 604cd3d683..25e9ef9173 100644 --- a/src/vendor/aho-corasick/README.md +++ b/src/vendor/aho-corasick/README.md @@ -17,7 +17,7 @@ Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). ### Documentation -[http://burntsushi.net/rustdoc/aho_corasick/](http://burntsushi.net/rustdoc/aho_corasick/). +[https://docs.rs/aho-corasick/](https://docs.rs/aho-corasick/). ### Example diff --git a/src/vendor/ansi_term/.cargo-checksum.json b/src/vendor/ansi_term/.cargo-checksum.json index 2a5eee9d4a..ac1f2269e7 100644 --- a/src/vendor/ansi_term/.cargo-checksum.json +++ b/src/vendor/ansi_term/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7638f044db68ce808e7568297a91c0e4815d30c4a48237461259942b2778a210",".travis.yml":"eb7113e5f5e36c2e00ae8e88a84dd5273505036520f2787133ba575d5fdd93c1","Cargo.toml":"ffe01d108855864ea3c975aad9da22d2a2324730022a5d4e119639f5850209db","LICENCE":"2762990c7fbba9d550802a2593c1d857dcd52596bb0f9f192a97e9a7ac5f4f9e","README.md":"ee22a0db93788e9bfe4c3cf4d7df5daf881a3105f941a915140a34018ff394e5","src/lib.rs":"867242d0699126af5a115709030888e958edfb835a0b3c15c4159a045f367e18"},"package":"23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7638f044db68ce808e7568297a91c0e4815d30c4a48237461259942b2778a210",".travis.yml":"eb7113e5f5e36c2e00ae8e88a84dd5273505036520f2787133ba575d5fdd93c1","Cargo.toml":"7ee95481bc957d9c98cdb9e3ae6c9d982dd385a8276544445554b8321e604c97","Cargo.toml.orig":"3f2d31c4b3724b4ff94113de3d301482440f8e1440d34769c4a822ee64350fef","LICENCE":"2762990c7fbba9d550802a2593c1d857dcd52596bb0f9f192a97e9a7ac5f4f9e","README.md":"8a00b2016ab0b1c41b110b7f6561d7c2d675fd2442ef10a1cce36b8b8f68235a","src/ansi.rs":"a404efab736839d65c49e147c1d037fb3f852341d445ad41cc43181462310a65","src/debug.rs":"c40ea0796167161dda30bfb4b8b2596101da42e98a81b1c7d0e04fe53befb1c3","src/difference.rs":"9b4b8f91c72932bfda262abdceff0ec124a5a8dd27d07bd4d2e5e7889135c6c9","src/display.rs":"507d120de80411c9b8b2a05ff68f2336137ef226de4b8c537c790d7ccdacc3e1","src/lib.rs":"4847d21681c323236068bbcbf5523e69cf69e79470a9fec0927f520bd0670967","src/style.rs":"003b9832c4381c455b6ddf2c37b7150b48c9a5649c0c14da923a80e9fd6d898f","src/windows.rs":"0f806e0d70d8b15fdb158cc5f9bbb88ffba2ea9d64b0d69b5adfb95a2e2cdbef","src/write.rs":"c9ec03764ad1ecea8b680243c9cafc5e70919fcea7500cc18246ffd8f6bb4b33"},"package":"6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"} \ No newline at end of file diff --git a/src/vendor/ansi_term/Cargo.toml b/src/vendor/ansi_term/Cargo.toml index 93f4d272b1..255ce16da9 100644 --- a/src/vendor/ansi_term/Cargo.toml +++ b/src/vendor/ansi_term/Cargo.toml @@ -1,13 +1,24 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] name = "ansi_term" +version = "0.10.2" +authors = ["ogham@bsago.me", "Ryan Scheel (Havvy) <ryan.havvy@gmail.com>", "Josh Triplett <josh@joshtriplett.org>"] description = "Library for ANSI terminal colours and styles (bold, underline)" - -authors = [ "ogham@bsago.me", "Ryan Scheel (Havvy) <ryan.havvy@gmail.com>" ] -documentation = "https://docs.rs/ansi_term/0.9.0/ansi_term/" homepage = "https://github.com/ogham/rust-ansi-term" -license = "MIT" +documentation = "https://docs.rs/ansi_term" readme = "README.md" -version = "0.9.0" +license = "MIT" [lib] name = "ansi_term" diff --git a/src/vendor/ansi_term/Cargo.toml.orig b/src/vendor/ansi_term/Cargo.toml.orig new file mode 100644 index 0000000000..77d43801c2 --- /dev/null +++ b/src/vendor/ansi_term/Cargo.toml.orig @@ -0,0 +1,13 @@ +[package] +name = "ansi_term" +description = "Library for ANSI terminal colours and styles (bold, underline)" + +authors = [ "ogham@bsago.me", "Ryan Scheel (Havvy) <ryan.havvy@gmail.com>", "Josh Triplett <josh@joshtriplett.org>" ] +documentation = "https://docs.rs/ansi_term" +homepage = "https://github.com/ogham/rust-ansi-term" +license = "MIT" +readme = "README.md" +version = "0.10.2" + +[lib] +name = "ansi_term" diff --git a/src/vendor/ansi_term/README.md b/src/vendor/ansi_term/README.md index c6687142a7..7c31821b16 100644 --- a/src/vendor/ansi_term/README.md +++ b/src/vendor/ansi_term/README.md @@ -2,7 +2,7 @@ This is a library for controlling colours and formatting, such as red bold text or blue underlined text, on ANSI terminals. -### [View the Rustdoc](http://ogham.rustdocs.org/ansi_term) +### [View the Rustdoc](https://docs.rs/ansi_term/0.9.0/ansi_term/) # Installation @@ -11,7 +11,7 @@ This crate works with [Cargo](http://crates.io). Add the following to your `Carg ```toml [dependencies] -ansi_term = "0.8" +ansi_term = "0.9" ``` @@ -44,6 +44,11 @@ use std::string::ToString; let red_string = Red.paint("a red string").to_string(); ``` +**Note for Windows 10 users:** On Windows 10, the application must enable ANSI support first: + +```rust +let enabled = ansi_term::enable_ansi_support(); +``` ## Bold, underline, background, and other styles diff --git a/src/vendor/ansi_term/src/ansi.rs b/src/vendor/ansi_term/src/ansi.rs new file mode 100644 index 0000000000..d9e6569b99 --- /dev/null +++ b/src/vendor/ansi_term/src/ansi.rs @@ -0,0 +1,258 @@ +use style::{Colour, Style}; + +use std::fmt; + +use write::AnyWrite; + + +// ---- generating ANSI codes ---- + +impl Style { + + /// Write any ANSI codes that go *before* a piece of text. These should be + /// the codes to set the terminal to a different colour or font style. + fn write_prefix<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { + + // If there are actually no styles here, then don’t write *any* codes + // as the prefix. An empty ANSI code may not affect the terminal + // output at all, but a user may just want a code-free string. + if self.is_plain() { + return Ok(()); + } + + // Write the codes’ prefix, then write numbers, separated by + // semicolons, for each text style we want to apply. + write!(f, "\x1B[")?; + let mut written_anything = false; + + { + let mut write_char = |c| { + if written_anything { write!(f, ";")?; } + written_anything = true; + write!(f, "{}", c)?; + Ok(()) + }; + + if self.is_bold { write_char('1')? } + if self.is_dimmed { write_char('2')? } + if self.is_italic { write_char('3')? } + if self.is_underline { write_char('4')? } + if self.is_blink { write_char('5')? } + if self.is_reverse { write_char('7')? } + if self.is_hidden { write_char('8')? } + if self.is_strikethrough { write_char('9')? } + } + + // The foreground and background colours, if specified, need to be + // handled specially because the number codes are more complicated. + // (see `write_background_code` and `write_foreground_code`) + if let Some(bg) = self.background { + if written_anything { write!(f, ";")?; } + written_anything = true; + bg.write_background_code(f)?; + } + + if let Some(fg) = self.foreground { + if written_anything { write!(f, ";")?; } + fg.write_foreground_code(f)?; + } + + // All the codes end with an `m`, because reasons. + write!(f, "m")?; + + Ok(()) + } + + /// Write any ANSI codes that go *after* a piece of text. These should be + /// the codes to *reset* the terminal back to its normal colour and style. + fn write_suffix<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { + if self.is_plain() { + Ok(()) + } + else { + write!(f, "{}", RESET) + } + } +} + + +/// The code to send to reset all styles and return to `Style::default()`. +pub static RESET: &str = "\x1B[0m"; + + + +impl Colour { + fn write_foreground_code<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { + match *self { + Colour::Black => write!(f, "30"), + Colour::Red => write!(f, "31"), + Colour::Green => write!(f, "32"), + Colour::Yellow => write!(f, "33"), + Colour::Blue => write!(f, "34"), + Colour::Purple => write!(f, "35"), + Colour::Cyan => write!(f, "36"), + Colour::White => write!(f, "37"), + Colour::Fixed(num) => write!(f, "38;5;{}", &num), + Colour::RGB(r,g,b) => write!(f, "38;2;{};{};{}", &r, &g, &b), + } + } + + fn write_background_code<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { + match *self { + Colour::Black => write!(f, "40"), + Colour::Red => write!(f, "41"), + Colour::Green => write!(f, "42"), + Colour::Yellow => write!(f, "43"), + Colour::Blue => write!(f, "44"), + Colour::Purple => write!(f, "45"), + Colour::Cyan => write!(f, "46"), + Colour::White => write!(f, "47"), + Colour::Fixed(num) => write!(f, "48;5;{}", &num), + Colour::RGB(r,g,b) => write!(f, "48;2;{};{};{}", &r, &g, &b), + } + } +} + + +/// Like `ANSIString`, but only displays the style prefix. +#[derive(Clone, Copy, Debug)] +pub struct Prefix(Style); + +/// Like `ANSIString`, but only displays the difference between two +/// styles. +#[derive(Clone, Copy, Debug)] +pub struct Infix(Style, Style); + +/// Like `ANSIString`, but only displays the style suffix. +#[derive(Clone, Copy, Debug)] +pub struct Suffix(Style); + + +impl Style { + + /// The prefix for this style. + pub fn prefix(self) -> Prefix { + Prefix(self) + } + + /// The infix between this style and another. + pub fn infix(self, other: Style) -> Infix { + Infix(self, other) + } + + /// The suffix for this style. + pub fn suffix(self) -> Suffix { + Suffix(self) + } +} + + +impl Colour { + + /// The prefix for this colour. + pub fn prefix(self) -> Prefix { + Prefix(self.normal()) + } + + /// The infix between this colour and another. + pub fn infix(self, other: Colour) -> Infix { + Infix(self.normal(), other.normal()) + } + + /// The suffix for this colour. + pub fn suffix(self) -> Suffix { + Suffix(self.normal()) + } +} + + +impl fmt::Display for Prefix { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let f: &mut fmt::Write = f; + self.0.write_prefix(f) + } +} + + +impl fmt::Display for Infix { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use difference::Difference; + + match Difference::between(&self.0, &self.1) { + Difference::ExtraStyles(style) => { + let f: &mut fmt::Write = f; + style.write_prefix(f) + }, + Difference::Reset => { + let f: &mut fmt::Write = f; + write!(f, "{}{}", RESET, self.0.prefix()) + }, + Difference::NoDifference => { + Ok(()) // nothing to write + }, + } + } +} + + +impl fmt::Display for Suffix { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let f: &mut fmt::Write = f; + self.0.write_suffix(f) + } +} + + + +#[cfg(test)] +mod test { + use style::Style; + use style::Colour::*; + + macro_rules! test { + ($name: ident: $style: expr; $input: expr => $result: expr) => { + #[test] + fn $name() { + assert_eq!($style.paint($input).to_string(), $result.to_string()); + + let mut v = Vec::new(); + $style.paint($input.as_bytes()).write_to(&mut v).unwrap(); + assert_eq!(v.as_slice(), $result.as_bytes()); + } + }; + } + + test!(plain: Style::default(); "text/plain" => "text/plain"); + test!(red: Red; "hi" => "\x1B[31mhi\x1B[0m"); + test!(black: Black.normal(); "hi" => "\x1B[30mhi\x1B[0m"); + test!(yellow_bold: Yellow.bold(); "hi" => "\x1B[1;33mhi\x1B[0m"); + test!(yellow_bold_2: Yellow.normal().bold(); "hi" => "\x1B[1;33mhi\x1B[0m"); + test!(blue_underline: Blue.underline(); "hi" => "\x1B[4;34mhi\x1B[0m"); + test!(green_bold_ul: Green.bold().underline(); "hi" => "\x1B[1;4;32mhi\x1B[0m"); + test!(green_bold_ul_2: Green.underline().bold(); "hi" => "\x1B[1;4;32mhi\x1B[0m"); + test!(purple_on_white: Purple.on(White); "hi" => "\x1B[47;35mhi\x1B[0m"); + test!(purple_on_white_2: Purple.normal().on(White); "hi" => "\x1B[47;35mhi\x1B[0m"); + test!(yellow_on_blue: Style::new().on(Blue).fg(Yellow); "hi" => "\x1B[44;33mhi\x1B[0m"); + test!(yellow_on_blue_2: Cyan.on(Blue).fg(Yellow); "hi" => "\x1B[44;33mhi\x1B[0m"); + test!(cyan_bold_on_white: Cyan.bold().on(White); "hi" => "\x1B[1;47;36mhi\x1B[0m"); + test!(cyan_ul_on_white: Cyan.underline().on(White); "hi" => "\x1B[4;47;36mhi\x1B[0m"); + test!(cyan_bold_ul_on_white: Cyan.bold().underline().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m"); + test!(cyan_ul_bold_on_white: Cyan.underline().bold().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m"); + test!(fixed: Fixed(100); "hi" => "\x1B[38;5;100mhi\x1B[0m"); + test!(fixed_on_purple: Fixed(100).on(Purple); "hi" => "\x1B[45;38;5;100mhi\x1B[0m"); + test!(fixed_on_fixed: Fixed(100).on(Fixed(200)); "hi" => "\x1B[48;5;200;38;5;100mhi\x1B[0m"); + test!(rgb: RGB(70,130,180); "hi" => "\x1B[38;2;70;130;180mhi\x1B[0m"); + test!(rgb_on_blue: RGB(70,130,180).on(Blue); "hi" => "\x1B[44;38;2;70;130;180mhi\x1B[0m"); + test!(blue_on_rgb: Blue.on(RGB(70,130,180)); "hi" => "\x1B[48;2;70;130;180;34mhi\x1B[0m"); + test!(rgb_on_rgb: RGB(70,130,180).on(RGB(5,10,15)); "hi" => "\x1B[48;2;5;10;15;38;2;70;130;180mhi\x1B[0m"); + test!(bold: Style::new().bold(); "hi" => "\x1B[1mhi\x1B[0m"); + test!(underline: Style::new().underline(); "hi" => "\x1B[4mhi\x1B[0m"); + test!(bunderline: Style::new().bold().underline(); "hi" => "\x1B[1;4mhi\x1B[0m"); + test!(dimmed: Style::new().dimmed(); "hi" => "\x1B[2mhi\x1B[0m"); + test!(italic: Style::new().italic(); "hi" => "\x1B[3mhi\x1B[0m"); + test!(blink: Style::new().blink(); "hi" => "\x1B[5mhi\x1B[0m"); + test!(reverse: Style::new().reverse(); "hi" => "\x1B[7mhi\x1B[0m"); + test!(hidden: Style::new().hidden(); "hi" => "\x1B[8mhi\x1B[0m"); + test!(stricken: Style::new().strikethrough(); "hi" => "\x1B[9mhi\x1B[0m"); + +} diff --git a/src/vendor/ansi_term/src/debug.rs b/src/vendor/ansi_term/src/debug.rs new file mode 100644 index 0000000000..d8cd9734e0 --- /dev/null +++ b/src/vendor/ansi_term/src/debug.rs @@ -0,0 +1,122 @@ +use std::fmt; + +use style::Style; + + +/// Styles have a special `Debug` implementation that only shows the fields that +/// are set. Fields that haven’t been touched aren’t included in the output. +/// +/// This behaviour gets bypassed when using the alternate formatting mode +/// `format!("{:#?}")`. +/// +/// use ansi_term::Colour::{Red, Blue}; +/// assert_eq!("Style { fg(Red), on(Blue), bold, italic }", +/// format!("{:?}", Red.on(Blue).bold().italic())); +impl fmt::Debug for Style { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + if fmt.alternate() { + fmt.debug_struct("Style") + .field("foreground", &self.foreground) + .field("background", &self.background) + .field("blink", &self.is_blink) + .field("bold", &self.is_bold) + .field("dimmed", &self.is_dimmed) + .field("hidden", &self.is_hidden) + .field("italic", &self.is_italic) + .field("reverse", &self.is_reverse) + .field("strikethrough", &self.is_strikethrough) + .field("underline", &self.is_underline) + .finish() + } + else if self.is_plain() { + fmt.write_str("Style {}") + } + else { + fmt.write_str("Style { ")?; + + let mut written_anything = false; + + if let Some(fg) = self.foreground { + if written_anything { fmt.write_str(", ")? } + written_anything = true; + write!(fmt, "fg({:?})", fg)? + } + + if let Some(bg) = self.background { + if written_anything { fmt.write_str(", ")? } + written_anything = true; + write!(fmt, "on({:?})", bg)? + } + + { + let mut write_flag = |name| { + if written_anything { fmt.write_str(", ")? } + written_anything = true; + fmt.write_str(name) + }; + + if self.is_blink { write_flag("blink")? } + if self.is_bold { write_flag("bold")? } + if self.is_dimmed { write_flag("dimmed")? } + if self.is_hidden { write_flag("hidden")? } + if self.is_italic { write_flag("italic")? } + if self.is_reverse { write_flag("reverse")? } + if self.is_strikethrough { write_flag("strikethrough")? } + if self.is_underline { write_flag("underline")? } + } + + write!(fmt, " }}") + } + } +} + + +#[cfg(test)] +mod test { + use style::Colour::*; + use style::Style; + + fn style() -> Style { + Style::new() + } + + macro_rules! test { + ($name: ident: $obj: expr => $result: expr) => { + #[test] + fn $name() { + assert_eq!($result, format!("{:?}", $obj)); + } + }; + } + + test!(empty: style() => "Style {}"); + test!(bold: style().bold() => "Style { bold }"); + test!(italic: style().italic() => "Style { italic }"); + test!(both: style().bold().italic() => "Style { bold, italic }"); + + test!(red: Red.normal() => "Style { fg(Red) }"); + test!(redblue: Red.normal().on(RGB(3, 2, 4)) => "Style { fg(Red), on(RGB(3, 2, 4)) }"); + + test!(everything: + Red.on(Blue).blink().bold().dimmed().hidden().italic().reverse().strikethrough().underline() => + "Style { fg(Red), on(Blue), blink, bold, dimmed, hidden, italic, reverse, strikethrough, underline }"); + + #[test] + fn long_and_detailed() { + let debug = r##"Style { + foreground: Some( + Blue + ), + background: None, + blink: false, + bold: true, + dimmed: false, + hidden: false, + italic: false, + reverse: false, + strikethrough: false, + underline: false +}"##; + assert_eq!(debug, format!("{:#?}", Blue.bold())); + } +} diff --git a/src/vendor/ansi_term/src/difference.rs b/src/vendor/ansi_term/src/difference.rs new file mode 100644 index 0000000000..b0de07f7e8 --- /dev/null +++ b/src/vendor/ansi_term/src/difference.rs @@ -0,0 +1,179 @@ +use super::Style; + + +/// When printing out one coloured string followed by another, use one of +/// these rules to figure out which *extra* control codes need to be sent. +#[derive(PartialEq, Clone, Copy, Debug)] +pub enum Difference { + + /// Print out the control codes specified by this style to end up looking + /// like the second string's styles. + ExtraStyles(Style), + + /// Converting between these two is impossible, so just send a reset + /// command and then the second string's styles. + Reset, + + /// The before style is exactly the same as the after style, so no further + /// control codes need to be printed. + NoDifference, +} + + +impl Difference { + + /// Compute the 'style difference' required to turn an existing style into + /// the given, second style. + /// + /// For example, to turn green text into green bold text, it's redundant + /// to write a reset command then a second green+bold command, instead of + /// just writing one bold command. This method should see that both styles + /// use the foreground colour green, and reduce it to a single command. + /// + /// This method returns an enum value because it's not actually always + /// possible to turn one style into another: for example, text could be + /// made bold and underlined, but you can't remove the bold property + /// without also removing the underline property. So when this has to + /// happen, this function returns None, meaning that the entire set of + /// styles should be reset and begun again. + pub fn between(first: &Style, next: &Style) -> Difference { + use self::Difference::*; + + // XXX(Havvy): This algorithm is kind of hard to replicate without + // having the Plain/Foreground enum variants, so I'm just leaving + // it commented out for now, and defaulting to Reset. + + if first == next { + return NoDifference; + } + + // Cannot un-bold, so must Reset. + if first.is_bold && !next.is_bold { + return Reset; + } + + if first.is_dimmed && !next.is_dimmed { + return Reset; + } + + if first.is_italic && !next.is_italic { + return Reset; + } + + // Cannot un-underline, so must Reset. + if first.is_underline && !next.is_underline { + return Reset; + } + + if first.is_blink && !next.is_blink { + return Reset; + } + + if first.is_reverse && !next.is_reverse { + return Reset; + } + + if first.is_hidden && !next.is_hidden { + return Reset; + } + + if first.is_strikethrough && !next.is_strikethrough { + return Reset; + } + + // Cannot go from foreground to no foreground, so must Reset. + if first.foreground.is_some() && next.foreground.is_none() { + return Reset; + } + + // Cannot go from background to no background, so must Reset. + if first.background.is_some() && next.background.is_none() { + return Reset; + } + + let mut extra_styles = Style::default(); + + if first.is_bold != next.is_bold { + extra_styles.is_bold = true; + } + + if first.is_dimmed != next.is_dimmed { + extra_styles.is_dimmed = true; + } + + if first.is_italic != next.is_italic { + extra_styles.is_italic = true; + } + + if first.is_underline != next.is_underline { + extra_styles.is_underline = true; + } + + if first.is_blink != next.is_blink { + extra_styles.is_blink = true; + } + + if first.is_reverse != next.is_reverse { + extra_styles.is_reverse = true; + } + + if first.is_hidden != next.is_hidden { + extra_styles.is_hidden = true; + } + + if first.is_strikethrough != next.is_strikethrough { + extra_styles.is_strikethrough = true; + } + + if first.foreground != next.foreground { + extra_styles.foreground = next.foreground; + } + + if first.background != next.background { + extra_styles.background = next.background; + } + + ExtraStyles(extra_styles) + } +} + + +#[cfg(test)] +mod test { + use super::*; + use super::Difference::*; + use style::Colour::*; + use style::Style; + + fn style() -> Style { + Style::new() + } + + macro_rules! test { + ($name: ident: $first: expr; $next: expr => $result: expr) => { + #[test] + fn $name() { + assert_eq!($result, Difference::between(&$first, &$next)); + } + }; + } + + test!(nothing: Green.normal(); Green.normal() => NoDifference); + test!(uppercase: Green.normal(); Green.bold() => ExtraStyles(style().bold())); + test!(lowercase: Green.bold(); Green.normal() => Reset); + test!(nothing2: Green.bold(); Green.bold() => NoDifference); + + test!(colour_change: Red.normal(); Blue.normal() => ExtraStyles(Blue.normal())); + + test!(addition_of_blink: style(); style().blink() => ExtraStyles(style().blink())); + test!(addition_of_dimmed: style(); style().dimmed() => ExtraStyles(style().dimmed())); + test!(addition_of_hidden: style(); style().hidden() => ExtraStyles(style().hidden())); + test!(addition_of_reverse: style(); style().reverse() => ExtraStyles(style().reverse())); + test!(addition_of_strikethrough: style(); style().strikethrough() => ExtraStyles(style().strikethrough())); + + test!(removal_of_strikethrough: style().strikethrough(); style() => Reset); + test!(removal_of_reverse: style().reverse(); style() => Reset); + test!(removal_of_hidden: style().hidden(); style() => Reset); + test!(removal_of_dimmed: style().dimmed(); style() => Reset); + test!(removal_of_blink: style().blink(); style() => Reset); +} diff --git a/src/vendor/ansi_term/src/display.rs b/src/vendor/ansi_term/src/display.rs new file mode 100644 index 0000000000..d9421c9fdc --- /dev/null +++ b/src/vendor/ansi_term/src/display.rs @@ -0,0 +1,279 @@ +use std::borrow::Cow; +use std::fmt; +use std::io; +use std::ops::Deref; + +use ansi::RESET; +use difference::Difference; +use style::{Style, Colour}; +use write::AnyWrite; + + +/// An ANSIGenericString includes a generic string type and a Style to +/// display that string. ANSIString and ANSIByteString are aliases for +/// this type on str and [u8], respectively. +#[derive(PartialEq, Debug)] +pub struct ANSIGenericString<'a, S: 'a + ToOwned + ?Sized> +where <S as ToOwned>::Owned: fmt::Debug { + style: Style, + string: Cow<'a, S>, +} + + +/// Cloning an ANSIGenericString will clone its underlying string. +/// +/// ### Examples +/// +/// ``` +/// use ansi_term::ANSIString; +/// +/// let plain_string = ANSIString::from("a plain string"); +/// let clone_string = plain_string.clone(); +/// assert_eq!(clone_string, plain_string); +/// ``` +impl<'a, S: 'a + ToOwned + ?Sized> Clone for ANSIGenericString<'a, S> +where <S as ToOwned>::Owned: fmt::Debug { + fn clone(&self) -> ANSIGenericString<'a, S> { + ANSIGenericString { + style: self.style.clone(), + string: self.string.clone(), + } + } +} + +// You might think that the hand-written Clone impl above is the same as the +// one that gets generated with #[derive]. But it’s not *quite* the same! +// +// `str` is not Clone, and the derived Clone implementation puts a Clone +// constraint on the S type parameter (generated using --pretty=expanded): +// +// ↓_________________↓ +// impl <'a, S: ::std::clone::Clone + 'a + ToOwned + ?Sized> ::std::clone::Clone +// for ANSIGenericString<'a, S> where +// <S as ToOwned>::Owned: fmt::Debug { ... } +// +// This resulted in compile errors when you tried to derive Clone on a type +// that used it: +// +// #[derive(PartialEq, Debug, Clone, Default)] +// pub struct TextCellContents(Vec<ANSIString<'static>>); +// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// error[E0277]: the trait `std::clone::Clone` is not implemented for `str` +// +// The hand-written impl above can ignore that constraint and still compile. + + + +/// An ANSI String is a string coupled with the Style to display it +/// in a terminal. +/// +/// Although not technically a string itself, it can be turned into +/// one with the `to_string` method. +/// +/// ### Examples +/// +/// ```no_run +/// use ansi_term::ANSIString; +/// use ansi_term::Colour::Red; +/// +/// let red_string = Red.paint("a red string"); +/// println!("{}", red_string); +/// ``` +/// +/// ``` +/// use ansi_term::ANSIString; +/// +/// let plain_string = ANSIString::from("a plain string"); +/// assert_eq!(&*plain_string, "a plain string"); +/// ``` +pub type ANSIString<'a> = ANSIGenericString<'a, str>; + +/// An ANSIByteString represents a formatted series of bytes. Use +/// ANSIByteString when styling text with an unknown encoding. +pub type ANSIByteString<'a> = ANSIGenericString<'a, [u8]>; + +impl<'a, I, S: 'a + ToOwned + ?Sized> From<I> for ANSIGenericString<'a, S> +where I: Into<Cow<'a, S>>, + <S as ToOwned>::Owned: fmt::Debug { + fn from(input: I) -> ANSIGenericString<'a, S> { + ANSIGenericString { + string: input.into(), + style: Style::default(), + } + } +} + +impl<'a, S: 'a + ToOwned + ?Sized> Deref for ANSIGenericString<'a, S> +where <S as ToOwned>::Owned: fmt::Debug { + type Target = S; + + fn deref(&self) -> &S { + self.string.deref() + } +} + + +/// A set of `ANSIGenericString`s collected together, in order to be +/// written with a minimum of control characters. +pub struct ANSIGenericStrings<'a, S: 'a + ToOwned + ?Sized> + (pub &'a [ANSIGenericString<'a, S>]) + where <S as ToOwned>::Owned: fmt::Debug; + +/// A set of `ANSIString`s collected together, in order to be written with a +/// minimum of control characters. +pub type ANSIStrings<'a> = ANSIGenericStrings<'a, str>; + +/// A function to construct an ANSIStrings instance. +#[allow(non_snake_case)] +pub fn ANSIStrings<'a>(arg: &'a [ANSIString<'a>]) -> ANSIStrings<'a> { + ANSIGenericStrings(arg) +} + +/// A set of `ANSIByteString`s collected together, in order to be +/// written with a minimum of control characters. +pub type ANSIByteStrings<'a> = ANSIGenericStrings<'a, [u8]>; + +/// A function to construct an ANSIByteStrings instance. +#[allow(non_snake_case)] +pub fn ANSIByteStrings<'a>(arg: &'a [ANSIByteString<'a>]) -> ANSIByteStrings<'a> { + ANSIGenericStrings(arg) +} + + +// ---- paint functions ---- + +impl Style { + + /// Paints the given text with this colour, returning an ANSI string. + pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> ANSIGenericString<'a, S> + where I: Into<Cow<'a, S>>, + <S as ToOwned>::Owned: fmt::Debug { + ANSIGenericString { + string: input.into(), + style: self, + } + } +} + + +impl Colour { + + /// Paints the given text with this colour, returning an ANSI string. + /// This is a short-cut so you don’t have to use `Blue.normal()` just + /// to get blue text. + /// + /// ``` + /// use ansi_term::Colour::Blue; + /// println!("{}", Blue.paint("da ba dee")); + /// ``` + pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> ANSIGenericString<'a, S> + where I: Into<Cow<'a, S>>, + <S as ToOwned>::Owned: fmt::Debug { + ANSIGenericString { + string: input.into(), + style: self.normal(), + } + } +} + + +// ---- writers for individual ANSI strings ---- + +impl<'a> fmt::Display for ANSIString<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let w: &mut fmt::Write = f; + self.write_to_any(w) + } +} + +impl<'a> ANSIByteString<'a> { + /// Write an ANSIByteString to an io::Write. This writes the escape + /// sequences for the associated Style around the bytes. + pub fn write_to<W: io::Write>(&self, w: &mut W) -> io::Result<()> { + let w: &mut io::Write = w; + self.write_to_any(w) + } +} + +impl<'a, S: 'a + ToOwned + ?Sized> ANSIGenericString<'a, S> +where <S as ToOwned>::Owned: fmt::Debug, &'a S: AsRef<[u8]> { + fn write_to_any<W: AnyWrite<wstr=S> + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> { + write!(w, "{}", self.style.prefix())?; + w.write_str(self.string.as_ref())?; + write!(w, "{}", self.style.suffix()) + } +} + + +// ---- writers for combined ANSI strings ---- + +impl<'a> fmt::Display for ANSIStrings<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let f: &mut fmt::Write = f; + self.write_to_any(f) + } +} + +impl<'a> ANSIByteStrings<'a> { + /// Write ANSIByteStrings to an io::Write. This writes the minimal + /// escape sequences for the associated Styles around each set of + /// bytes. + pub fn write_to<W: io::Write>(&self, w: &mut W) -> io::Result<()> { + let w: &mut io::Write = w; + self.write_to_any(w) + } +} + +impl<'a, S: 'a + ToOwned + ?Sized> ANSIGenericStrings<'a, S> +where <S as ToOwned>::Owned: fmt::Debug, &'a S: AsRef<[u8]> { + fn write_to_any<W: AnyWrite<wstr=S> + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> { + use self::Difference::*; + + let first = match self.0.first() { + None => return Ok(()), + Some(f) => f, + }; + + write!(w, "{}", first.style.prefix())?; + w.write_str(first.string.as_ref())?; + + for window in self.0.windows(2) { + match Difference::between(&window[0].style, &window[1].style) { + ExtraStyles(style) => write!(w, "{}", style.prefix())?, + Reset => write!(w, "{}{}", RESET, window[1].style.prefix())?, + NoDifference => {/* Do nothing! */}, + } + + w.write_str(&window[1].string)?; + } + + // Write the final reset string after all of the ANSIStrings have been + // written, *except* if the last one has no styles, because it would + // have already been written by this point. + if let Some(last) = self.0.last() { + if !last.style.is_plain() { + write!(w, "{}", RESET)?; + } + } + + Ok(()) + } +} + + +// ---- tests ---- + +#[cfg(test)] +mod tests { + pub use super::super::ANSIStrings; + pub use style::Style; + pub use style::Colour::*; + + #[test] + fn no_control_codes_for_plain() { + let one = Style::default().paint("one"); + let two = Style::default().paint("two"); + let output = format!("{}", ANSIStrings( &[ one, two ] )); + assert_eq!(&*output, "onetwo"); + } +} diff --git a/src/vendor/ansi_term/src/lib.rs b/src/vendor/ansi_term/src/lib.rs index 84943bee0b..31022a0ca9 100644 --- a/src/vendor/ansi_term/src/lib.rs +++ b/src/vendor/ansi_term/src/lib.rs @@ -175,236 +175,11 @@ #![warn(trivial_casts, trivial_numeric_casts)] #![warn(unused_extern_crates, unused_qualifications)] +mod ansi; +pub use ansi::{Prefix, Infix, Suffix}; -use std::borrow::Cow; -use std::default::Default; -use std::fmt; -use std::io; -use std::ops::Deref; - -use Colour::*; -use Difference::*; - -trait AnyWrite { - type str : ?Sized; - type Error; - fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error>; - fn write_str(&mut self, s: &Self::str) -> Result<(), Self::Error>; -} - -impl<'a> AnyWrite for fmt::Write + 'a { - type str = str; - type Error = fmt::Error; - fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> { - fmt::Write::write_fmt(self, fmt) - } - fn write_str(&mut self, s: &Self::str) -> Result<(), Self::Error> { - fmt::Write::write_str(self, s) - } -} - -impl<'a> AnyWrite for io::Write + 'a { - type str = [u8]; - type Error = io::Error; - fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> { - io::Write::write_fmt(self, fmt) - } - fn write_str(&mut self, s: &Self::str) -> Result<(), Self::Error> { - io::Write::write_all(self, s) - } -} - -/// An ANSIGenericString includes a generic string type and a Style to -/// display that string. ANSIString and ANSIByteString are aliases for -/// this type on str and [u8], respectively. -#[derive(PartialEq, Debug, Clone)] -pub struct ANSIGenericString<'a, S: 'a + ToOwned + ?Sized> -where <S as ToOwned>::Owned: std::fmt::Debug { - style: Style, - string: Cow<'a, S>, -} - -impl<'a, S: 'a + ToOwned + ?Sized> ANSIGenericString<'a, S> -where <S as ToOwned>::Owned: std::fmt::Debug { - fn write_to_any<W: AnyWrite<str=S> + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> { - try!(self.style.write_prefix(w)); - try!(w.write_str(&self.string)); - self.style.write_suffix(w) - } -} - -/// An ANSI String is a string coupled with the Style to display it -/// in a terminal. -/// -/// Although not technically a string itself, it can be turned into -/// one with the `to_string` method. -/// -/// ### Examples -/// -/// ```no_run -/// use ansi_term::ANSIString; -/// use ansi_term::Colour::Red; -/// -/// let red_string = Red.paint("a red string"); -/// println!("{}", red_string); -/// ``` -/// -/// ``` -/// use ansi_term::ANSIString; -/// -/// let plain_string = ANSIString::from("a plain string"); -/// assert_eq!(&*plain_string, "a plain string"); -/// ``` -pub type ANSIString<'a> = ANSIGenericString<'a, str>; - -/// An ANSIByteString represents a formatted series of bytes. Use -/// ANSIByteString when styling text with an unknown encoding. -pub type ANSIByteString<'a> = ANSIGenericString<'a, [u8]>; - -/// Like `ANSIString`, but only displays the style prefix. -#[derive(Clone, Copy, Debug)] -pub struct Prefix(Style); - -/// Like `ANSIString`, but only displays the style suffix. -#[derive(Clone, Copy, Debug)] -pub struct Suffix(Style); - -/// Like `ANSIString`, but only displays the difference between two -/// styles. -#[derive(Clone, Copy, Debug)] -pub struct Infix(Style, Style); - -impl<'a> fmt::Display for ANSIString<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let w: &mut fmt::Write = f; - self.write_to_any(w) - } -} - -impl<'a> ANSIByteString<'a> { - /// Write an ANSIByteString to an io::Write. This writes the escape - /// sequences for the associated Style around the bytes. - pub fn write_to<W: io::Write>(&self, w: &mut W) -> io::Result<()> { - let w: &mut io::Write = w; - self.write_to_any(w) - } -} - - -impl<'a, I, S: 'a + ToOwned + ?Sized> From<I> for ANSIGenericString<'a, S> -where I: Into<Cow<'a, S>>, - <S as ToOwned>::Owned: std::fmt::Debug { - fn from(input: I) -> ANSIGenericString<'a, S> { - ANSIGenericString { - string: input.into(), - style: Style::default(), - } - } -} - -impl<'a, S: 'a + ToOwned + ?Sized> Deref for ANSIGenericString<'a, S> -where <S as ToOwned>::Owned: std::fmt::Debug { - type Target = S; - - fn deref(&self) -> &S { - self.string.deref() - } -} - - -impl fmt::Display for Prefix { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let f: &mut fmt::Write = f; - try!(self.0.write_prefix(f)); - Ok(()) - } -} - -impl fmt::Display for Suffix { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let f: &mut fmt::Write = f; - try!(self.0.write_suffix(f)); - Ok(()) - } -} - -impl fmt::Display for Infix { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self.0.difference(&self.1) { - ExtraStyles(style) => { - let f: &mut fmt::Write = f; - try!(style.write_prefix(f)) - }, - Reset => { - let f: &mut fmt::Write = f; - try!(f.write_str("\x1B[0m")); - try!(self.0.write_prefix(f)); - }, - NoDifference => { /* Do nothing! */ }, - } - Ok(()) - } -} - - -/// A colour is one specific type of ANSI escape code, and can refer -/// to either the foreground or background colour. -/// -/// These use the standard numeric sequences. -/// See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html -#[derive(PartialEq, Clone, Copy, Debug)] -pub enum Colour { - - /// Colour #0 (foreground code `30`, background code `40`). - /// - /// This is not necessarily the background colour, and using it as one may - /// render the text hard to read on terminals with dark backgrounds. - Black, - - /// Colour #1 (foreground code `31`, background code `41`). - Red, - - /// Colour #2 (foreground code `32`, background code `42`). - Green, - - /// Colour #3 (foreground code `33`, background code `43`). - Yellow, - - /// Colour #4 (foreground code `34`, background code `44`). - Blue, - - /// Colour #5 (foreground code `35`, background code `45`). - Purple, - - /// Colour #6 (foreground code `36`, background code `46`). - Cyan, - - /// Colour #7 (foreground code `37`, background code `47`). - /// - /// As above, this is not necessarily the foreground colour, and may be - /// hard to read on terminals with light backgrounds. - White, - - /// A colour number from 0 to 255, for use in 256-colour terminal - /// environments. - /// - /// - Colours 0 to 7 are the `Black` to `White` variants respectively. - /// These colours can usually be changed in the terminal emulator. - /// - Colours 8 to 15 are brighter versions of the eight colours above. - /// These can also usually be changed in the terminal emulator, or it - /// could be configured to use the original colours and show the text in - /// bold instead. It varies depending on the program. - /// - Colours 16 to 231 contain several palettes of bright colours, - /// arranged in six squares measuring six by six each. - /// - Colours 232 to 255 are shades of grey from black to white. - /// - /// It might make more sense to look at a [colour chart][cc]. - /// [cc]: https://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg - Fixed(u8), - - /// A 24-bit RGB color, as specified by ISO-8613-3. - RGB(u8, u8, u8), -} +mod style; +pub use style::{Colour, Style}; /// Color is a type alias for Colour for those who can't be bothered. pub use Colour as Color; @@ -415,685 +190,13 @@ pub use Colour as Color; // // Only *after* they'd installed it. -impl Colour { - fn write_foreground_code<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { - match *self { - Black => write!(f, "30"), - Red => write!(f, "31"), - Green => write!(f, "32"), - Yellow => write!(f, "33"), - Blue => write!(f, "34"), - Purple => write!(f, "35"), - Cyan => write!(f, "36"), - White => write!(f, "37"), - Fixed(num) => write!(f, "38;5;{}", &num), - RGB(r,g,b) => write!(f, "38;2;{};{};{}", &r, &g, &b), - } - } +mod difference; +mod display; +pub use display::*; - fn write_background_code<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { - match *self { - Black => write!(f, "40"), - Red => write!(f, "41"), - Green => write!(f, "42"), - Yellow => write!(f, "43"), - Blue => write!(f, "44"), - Purple => write!(f, "45"), - Cyan => write!(f, "46"), - White => write!(f, "47"), - Fixed(num) => write!(f, "48;5;{}", &num), - RGB(r,g,b) => write!(f, "48;2;{};{};{}", &r, &g, &b), - } - } +mod write; - /// Return a Style with the foreground colour set to this colour. - pub fn normal(self) -> Style { - Style { foreground: Some(self), .. Style::default() } - } +mod windows; +pub use windows::*; - /// Paints the given text with this colour, returning an ANSI string. - /// This is a short-cut so you don't have to use Blue.normal() just - /// to get blue text. - pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> ANSIGenericString<'a, S> - where I: Into<Cow<'a, S>>, - <S as ToOwned>::Owned: std::fmt::Debug { - ANSIGenericString { - string: input.into(), - style: self.normal(), - } - } - - /// The prefix for this colour. - pub fn prefix(self) -> Prefix { - Prefix(self.normal()) - } - - /// The suffix for this colour. - pub fn suffix(self) -> Suffix { - Suffix(self.normal()) - } - - /// The infix between this colour and another. - pub fn infix(self, other: Colour) -> Infix { - Infix(self.normal(), other.normal()) - } - - /// Returns a Style with the bold property set. - pub fn bold(self) -> Style { - Style { foreground: Some(self), is_bold: true, .. Style::default() } - } - - /// Returns a Style with the dimmed property set. - pub fn dimmed(self) -> Style { - Style { foreground: Some(self), is_dimmed: true, .. Style::default() } - } - - /// Returns a Style with the italic property set. - pub fn italic(self) -> Style { - Style { foreground: Some(self), is_italic: true, .. Style::default() } - } - - /// Returns a Style with the underline property set. - pub fn underline(self) -> Style { - Style { foreground: Some(self), is_underline: true, .. Style::default() } - } - - /// Returns a Style with the blink property set. - pub fn blink(self) -> Style { - Style { foreground: Some(self), is_blink: true, .. Style::default() } - } - - /// Returns a Style with the reverse property set. - pub fn reverse(self) -> Style { - Style { foreground: Some(self), is_reverse: true, .. Style::default() } - } - - /// Returns a Style with the hidden property set. - pub fn hidden(self) -> Style { - Style { foreground: Some(self), is_hidden: true, .. Style::default() } - } - - /// Returns a Style with the strikethrough property set. - pub fn strikethrough(self) -> Style { - Style { foreground: Some(self), is_strikethrough: true, .. Style::default() } - } - - /// Returns a Style with the background colour property set. - pub fn on(self, background: Colour) -> Style { - Style { foreground: Some(self), background: Some(background), .. Style::default() } - } -} - -/// A style is a collection of properties that can format a string -/// using ANSI escape codes. -#[derive(PartialEq, Clone, Copy, Debug)] -pub struct Style { - foreground: Option<Colour>, - background: Option<Colour>, - is_bold: bool, - is_dimmed: bool, - is_italic: bool, - is_underline: bool, - is_blink: bool, - is_reverse: bool, - is_hidden: bool, - is_strikethrough: bool -} - -impl Style { - /// Creates a new Style with no differences. - pub fn new() -> Style { - Style::default() - } - - /// Paints the given text with this colour, returning an ANSI string. - pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> ANSIGenericString<'a, S> - where I: Into<Cow<'a, S>>, - <S as ToOwned>::Owned: std::fmt::Debug { - ANSIGenericString { - string: input.into(), - style: self, - } - } - - /// The prefix for this style. - pub fn prefix(self) -> Prefix { - Prefix(self) - } - - /// The suffix for this style. - pub fn suffix(self) -> Suffix { - Suffix(self) - } - - /// The infix between this style and another. - pub fn infix(self, other: Style) -> Infix { - Infix(self, other) - } - - /// Returns a Style with the bold property set. - pub fn bold(&self) -> Style { - Style { is_bold: true, .. *self } - } - - /// Returns a Style with the dimmed property set. - pub fn dimmed(&self) -> Style { - Style { is_dimmed: true, .. *self } - } - - /// Returns a Style with the italic property set. - pub fn italic(&self) -> Style { - Style { is_italic: true, .. *self } - } - - /// Returns a Style with the underline property set. - pub fn underline(&self) -> Style { - Style { is_underline: true, .. *self } - } - - /// Returns a Style with the blink property set. - pub fn blink(&self) -> Style { - Style { is_blink: true, .. *self } - } - - /// Returns a Style with the reverse property set. - pub fn reverse(&self) -> Style { - Style { is_reverse: true, .. *self } - } - - /// Returns a Style with the hidden property set. - pub fn hidden(&self) -> Style { - Style { is_hidden: true, .. *self } - } - - /// Returns a Style with the hidden property set. - pub fn strikethrough(&self) -> Style { - Style { is_strikethrough: true, .. *self } - } - - /// Returns a Style with the foreground colour property set. - pub fn fg(&self, foreground: Colour) -> Style { - Style { foreground: Some(foreground), .. *self } - } - - /// Returns a Style with the background colour property set. - pub fn on(&self, background: Colour) -> Style { - Style { background: Some(background), .. *self } - } - - /// Write any ANSI codes that go *before* a piece of text. These should be - /// the codes to set the terminal to a different colour or font style. - fn write_prefix<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { - // If there are actually no styles here, then don’t write *any* codes - // as the prefix. An empty ANSI code may not affect the terminal - // output at all, but a user may just want a code-free string. - if self.is_plain() { - return Ok(()); - } - - // Write the codes’ prefix, then write numbers, separated by - // semicolons, for each text style we want to apply. - try!(write!(f, "\x1B[")); - let mut written_anything = false; - - { - let mut write_char = |c| { - if written_anything { try!(write!(f, ";")); } - written_anything = true; - try!(write!(f, "{}", c)); - Ok(()) - }; - - if self.is_bold { try!(write_char('1')); } - if self.is_dimmed { try!(write_char('2')); } - if self.is_italic { try!(write_char('3')); } - if self.is_underline { try!(write_char('4')); } - if self.is_blink { try!(write_char('5')); } - if self.is_reverse { try!(write_char('7')); } - if self.is_hidden { try!(write_char('8')); } - if self.is_strikethrough { try!(write_char('9')); } - } - - // The foreground and background colours, if specified, need to be - // handled specially because the number codes are more complicated. - // (see `write_background_code` and `write_foreground_code`) - if let Some(bg) = self.background { - if written_anything { try!(write!(f, ";")); } - written_anything = true; - - try!(bg.write_background_code(f)); - } - - if let Some(fg) = self.foreground { - if written_anything { try!(write!(f, ";")); } - - try!(fg.write_foreground_code(f)); - } - - // All the codes end with an `m`, because reasons. - try!(write!(f, "m")); - Ok(()) - } - - /// Write any ANSI codes that go *after* a piece of text. These should be - /// the codes to *reset* the terminal back to its normal colour and style. - fn write_suffix<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> { - if self.is_plain() { - Ok(()) - } - else { - write!(f, "\x1B[0m") - } - } - - /// Compute the 'style difference' required to turn an existing style into - /// the given, second style. - /// - /// For example, to turn green text into green bold text, it's redundant - /// to write a reset command then a second green+bold command, instead of - /// just writing one bold command. This method should see that both styles - /// use the foreground colour green, and reduce it to a single command. - /// - /// This method returns an enum value because it's not actually always - /// possible to turn one style into another: for example, text could be - /// made bold and underlined, but you can't remove the bold property - /// without also removing the underline property. So when this has to - /// happen, this function returns None, meaning that the entire set of - /// styles should be reset and begun again. - fn difference(&self, next: &Style) -> Difference { - // XXX(Havvy): This algorithm is kind of hard to replicate without - // having the Plain/Foreground enum variants, so I'm just leaving - // it commented out for now, and defaulting to Reset. - - if self == next { - return NoDifference; - } - - // Cannot un-bold, so must Reset. - if self.is_bold && !next.is_bold { - return Reset; - } - - if self.is_dimmed && !next.is_dimmed { - return Reset; - } - - if self.is_italic && !next.is_italic { - return Reset; - } - - // Cannot un-underline, so must Reset. - if self.is_underline && !next.is_underline { - return Reset; - } - - if self.is_blink && !next.is_blink { - return Reset; - } - - if self.is_reverse && !next.is_reverse { - return Reset; - } - - if self.is_hidden && !next.is_hidden { - return Reset; - } - - if self.is_strikethrough && !next.is_strikethrough { - return Reset; - } - - // Cannot go from foreground to no foreground, so must Reset. - if self.foreground.is_some() && next.foreground.is_none() { - return Reset; - } - - // Cannot go from background to no background, so must Reset. - if self.background.is_some() && next.background.is_none() { - return Reset; - } - - let mut extra_styles = Style::default(); - - if self.is_bold != next.is_bold { - extra_styles.is_bold = true; - } - - if self.is_dimmed != next.is_dimmed { - extra_styles.is_dimmed = true; - } - - if self.is_italic != next.is_italic { - extra_styles.is_italic = true; - } - - if self.is_underline != next.is_underline { - extra_styles.is_underline = true; - } - - if self.is_blink != next.is_blink { - extra_styles.is_blink = true; - } - - if self.is_reverse != next.is_reverse { - extra_styles.is_reverse = true; - } - - if self.is_hidden != next.is_hidden { - extra_styles.is_hidden = true; - } - - if self.is_strikethrough != next.is_strikethrough { - extra_styles.is_strikethrough = true; - } - - if self.foreground != next.foreground { - extra_styles.foreground = next.foreground; - } - - if self.background != next.background { - extra_styles.background = next.background; - } - - ExtraStyles(extra_styles) - } - - /// Return true if this `Style` has no actual styles, and can be written - /// without any control characters. - fn is_plain(self) -> bool { - self == Style::default() - } -} - -impl Default for Style { - fn default() -> Style { - Style { - foreground: None, - background: None, - is_bold: false, - is_dimmed: false, - is_italic: false, - is_underline: false, - is_blink: false, - is_reverse: false, - is_hidden: false, - is_strikethrough: false, - } - } -} - -/// When printing out one coloured string followed by another, use one of -/// these rules to figure out which *extra* control codes need to be sent. -#[derive(PartialEq, Clone, Copy, Debug)] -enum Difference { - - /// Print out the control codes specified by this style to end up looking - /// like the second string's styles. - ExtraStyles(Style), - - /// Converting between these two is impossible, so just send a reset - /// command and then the second string's styles. - Reset, - - /// The before style is exactly the same as the after style, so no further - /// control codes need to be printed. - NoDifference, -} - -/// A set of `ANSIGenericString`s collected together, in order to be -/// written with a minimum of control characters. -pub struct ANSIGenericStrings<'a, S: 'a + ToOwned + ?Sized> - (pub &'a [ANSIGenericString<'a, S>]) - where <S as ToOwned>::Owned: std::fmt::Debug; - -/// A set of `ANSIString`s collected together, in order to be written with a -/// minimum of control characters. -pub type ANSIStrings<'a> = ANSIGenericStrings<'a, str>; - -/// A function to construct an ANSIStrings instance. -#[allow(non_snake_case)] -pub fn ANSIStrings<'a>(arg: &'a [ANSIString<'a>]) -> ANSIStrings<'a> { - ANSIGenericStrings(arg) -} - -/// A set of `ANSIByteString`s collected together, in order to be -/// written with a minimum of control characters. -pub type ANSIByteStrings<'a> = ANSIGenericStrings<'a, [u8]>; - -/// A function to construct an ANSIByteStrings instance. -#[allow(non_snake_case)] -pub fn ANSIByteStrings<'a>(arg: &'a [ANSIByteString<'a>]) -> ANSIByteStrings<'a> { - ANSIGenericStrings(arg) -} - -impl<'a, S: 'a + ToOwned + ?Sized> ANSIGenericStrings<'a, S> -where <S as ToOwned>::Owned: std::fmt::Debug { - fn write_to_any<W: AnyWrite<str=S> + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> { - let first = match self.0.first() { - None => return Ok(()), - Some(f) => f, - }; - - try!(first.style.write_prefix(w)); - try!(w.write_str(&first.string)); - - for window in self.0.windows(2) { - match window[0].style.difference(&window[1].style) { - ExtraStyles(style) => try!(style.write_prefix(w)), - Reset => { - try!(write!(w, "\x1B[0m")); - try!(window[1].style.write_prefix(w)); - }, - NoDifference => { /* Do nothing! */ }, - } - - try!(w.write_str(&window[1].string)); - } - - // Write the final reset string after all of the ANSIStrings have been - // written, *except* if the last one has no styles, because it would - // have already been written by this point. - if let Some(last) = self.0.last() { - if !last.style.is_plain() { - try!(write!(w, "\x1B[0m")); - } - } - - Ok(()) - } -} - -impl<'a> fmt::Display for ANSIStrings<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let f: &mut fmt::Write = f; - self.write_to_any(f) - } -} - -impl<'a> ANSIByteStrings<'a> { - /// Write ANSIByteStrings to an io::Write. This writes the minimal - /// escape sequences for the associated Styles around each set of - /// bytes. - pub fn write_to<W: io::Write>(&self, w: &mut W) -> io::Result<()> { - let w: &mut io::Write = w; - self.write_to_any(w) - } -} - -#[cfg(test)] -mod tests { - pub use super::{Style, ANSIStrings}; - pub use super::Colour::*; - - macro_rules! test { - ($name: ident: $style: expr; $input: expr => $result: expr) => { - #[test] - fn $name() { - assert_eq!($style.paint($input).to_string(), $result.to_string()); - - let mut v = Vec::new(); - $style.paint($input.as_bytes()).write_to(&mut v).unwrap(); - assert_eq!(v.as_slice(), $result.as_bytes()); - } - }; - } - - test!(plain: Style::default(); "text/plain" => "text/plain"); - test!(red: Red; "hi" => "\x1B[31mhi\x1B[0m"); - test!(black: Black.normal(); "hi" => "\x1B[30mhi\x1B[0m"); - test!(yellow_bold: Yellow.bold(); "hi" => "\x1B[1;33mhi\x1B[0m"); - test!(yellow_bold_2: Yellow.normal().bold(); "hi" => "\x1B[1;33mhi\x1B[0m"); - test!(blue_underline: Blue.underline(); "hi" => "\x1B[4;34mhi\x1B[0m"); - test!(green_bold_ul: Green.bold().underline(); "hi" => "\x1B[1;4;32mhi\x1B[0m"); - test!(green_bold_ul_2: Green.underline().bold(); "hi" => "\x1B[1;4;32mhi\x1B[0m"); - test!(purple_on_white: Purple.on(White); "hi" => "\x1B[47;35mhi\x1B[0m"); - test!(purple_on_white_2: Purple.normal().on(White); "hi" => "\x1B[47;35mhi\x1B[0m"); - test!(yellow_on_blue: Style::new().on(Blue).fg(Yellow); "hi" => "\x1B[44;33mhi\x1B[0m"); - test!(yellow_on_blue_2: Cyan.on(Blue).fg(Yellow); "hi" => "\x1B[44;33mhi\x1B[0m"); - test!(cyan_bold_on_white: Cyan.bold().on(White); "hi" => "\x1B[1;47;36mhi\x1B[0m"); - test!(cyan_ul_on_white: Cyan.underline().on(White); "hi" => "\x1B[4;47;36mhi\x1B[0m"); - test!(cyan_bold_ul_on_white: Cyan.bold().underline().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m"); - test!(cyan_ul_bold_on_white: Cyan.underline().bold().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m"); - test!(fixed: Fixed(100); "hi" => "\x1B[38;5;100mhi\x1B[0m"); - test!(fixed_on_purple: Fixed(100).on(Purple); "hi" => "\x1B[45;38;5;100mhi\x1B[0m"); - test!(fixed_on_fixed: Fixed(100).on(Fixed(200)); "hi" => "\x1B[48;5;200;38;5;100mhi\x1B[0m"); - test!(rgb: RGB(70,130,180); "hi" => "\x1B[38;2;70;130;180mhi\x1B[0m"); - test!(rgb_on_blue: RGB(70,130,180).on(Blue); "hi" => "\x1B[44;38;2;70;130;180mhi\x1B[0m"); - test!(blue_on_rgb: Blue.on(RGB(70,130,180)); "hi" => "\x1B[48;2;70;130;180;34mhi\x1B[0m"); - test!(rgb_on_rgb: RGB(70,130,180).on(RGB(5,10,15)); "hi" => "\x1B[48;2;5;10;15;38;2;70;130;180mhi\x1B[0m"); - test!(bold: Style::new().bold(); "hi" => "\x1B[1mhi\x1B[0m"); - test!(underline: Style::new().underline(); "hi" => "\x1B[4mhi\x1B[0m"); - test!(bunderline: Style::new().bold().underline(); "hi" => "\x1B[1;4mhi\x1B[0m"); - test!(dimmed: Style::new().dimmed(); "hi" => "\x1B[2mhi\x1B[0m"); - test!(italic: Style::new().italic(); "hi" => "\x1B[3mhi\x1B[0m"); - test!(blink: Style::new().blink(); "hi" => "\x1B[5mhi\x1B[0m"); - test!(reverse: Style::new().reverse(); "hi" => "\x1B[7mhi\x1B[0m"); - test!(hidden: Style::new().hidden(); "hi" => "\x1B[8mhi\x1B[0m"); - test!(stricken: Style::new().strikethrough(); "hi" => "\x1B[9mhi\x1B[0m"); - - mod difference { - use super::*; - use super::super::Difference::*; - - #[test] - fn diff() { - let expected = ExtraStyles(Style::new().bold()); - let got = Green.normal().difference(&Green.bold()); - assert_eq!(expected, got) - } - - #[test] - fn dlb() { - let got = Green.bold().difference(&Green.normal()); - assert_eq!(Reset, got) - } - - #[test] - fn nothing() { - assert_eq!(NoDifference, Green.bold().difference(&Green.bold())); - } - - #[test] - fn nothing_2() { - assert_eq!(NoDifference, Green.normal().difference(&Green.normal())); - } - - #[test] - fn colour_change() { - assert_eq!(ExtraStyles(Blue.normal()), Red.normal().difference(&Blue.normal())) - } - - #[test] - fn removal_of_dimmed() { - let dimmed = Style::new().dimmed(); - let normal = Style::default(); - - assert_eq!(Reset, dimmed.difference(&normal)); - } - - #[test] - fn addition_of_dimmed() { - let dimmed = Style::new().dimmed(); - let normal = Style::default(); - let extra_styles = ExtraStyles(dimmed); - - assert_eq!(extra_styles, normal.difference(&dimmed)); - } - - #[test] - fn removal_of_blink() { - let blink = Style::new().blink(); - let normal = Style::default(); - - assert_eq!(Reset, blink.difference(&normal)); - } - - #[test] - fn addition_of_blink() { - let blink = Style::new().blink(); - let normal = Style::default(); - let extra_styles = ExtraStyles(blink); - - assert_eq!(extra_styles, normal.difference(&blink)); - } - - #[test] - fn removal_of_reverse() { - let reverse = Style::new().reverse(); - let normal = Style::default(); - - assert_eq!(Reset, reverse.difference(&normal)); - } - - #[test] - fn addition_of_reverse() { - let reverse = Style::new().reverse(); - let normal = Style::default(); - let extra_styles = ExtraStyles(reverse); - - assert_eq!(extra_styles, normal.difference(&reverse)); - } - - #[test] - fn removal_of_hidden() { - let hidden = Style::new().hidden(); - let normal = Style::default(); - - assert_eq!(Reset, hidden.difference(&normal)); - } - - #[test] - fn addition_of_hidden() { - let hidden = Style::new().hidden(); - let normal = Style::default(); - let extra_styles = ExtraStyles(hidden); - - assert_eq!(extra_styles, normal.difference(&hidden)); - } - - #[test] - fn removal_of_strikethrough() { - let strikethrough = Style::new().strikethrough(); - let normal = Style::default(); - - assert_eq!(Reset, strikethrough.difference(&normal)); - } - - #[test] - fn addition_of_strikethrough() { - let strikethrough = Style::new().strikethrough(); - let normal = Style::default(); - let extra_styles = ExtraStyles(strikethrough); - - assert_eq!(extra_styles, normal.difference(&strikethrough)); - } - - #[test] - fn no_control_codes_for_plain() { - let one = Style::default().paint("one"); - let two = Style::default().paint("two"); - let output = format!("{}", ANSIStrings( &[ one, two ] )); - assert_eq!(&*output, "onetwo"); - } - } -} +mod debug; diff --git a/src/vendor/ansi_term/src/style.rs b/src/vendor/ansi_term/src/style.rs new file mode 100644 index 0000000000..2f2b86ce45 --- /dev/null +++ b/src/vendor/ansi_term/src/style.rs @@ -0,0 +1,258 @@ +/// A style is a collection of properties that can format a string +/// using ANSI escape codes. +#[derive(PartialEq, Clone, Copy)] +pub struct Style { + + /// The style's foreground colour, if it has one. + pub foreground: Option<Colour>, + + /// The style's background colour, if it has one. + pub background: Option<Colour>, + + /// Whether this style is bold. + pub is_bold: bool, + + /// Whether this style is dimmed. + pub is_dimmed: bool, + + /// Whether this style is italic. + pub is_italic: bool, + + /// Whether this style is underlined. + pub is_underline: bool, + + /// Whether this style is blinking. + pub is_blink: bool, + + /// Whether this style has reverse colours. + pub is_reverse: bool, + + /// Whether this style is hidden. + pub is_hidden: bool, + + /// Whether this style is struckthrough. + pub is_strikethrough: bool +} + +impl Style { + /// Creates a new Style with no differences. + pub fn new() -> Style { + Style::default() + } + + /// Returns a Style with the bold property set. + pub fn bold(&self) -> Style { + Style { is_bold: true, .. *self } + } + + /// Returns a Style with the dimmed property set. + pub fn dimmed(&self) -> Style { + Style { is_dimmed: true, .. *self } + } + + /// Returns a Style with the italic property set. + pub fn italic(&self) -> Style { + Style { is_italic: true, .. *self } + } + + /// Returns a Style with the underline property set. + pub fn underline(&self) -> Style { + Style { is_underline: true, .. *self } + } + + /// Returns a Style with the blink property set. + pub fn blink(&self) -> Style { + Style { is_blink: true, .. *self } + } + + /// Returns a Style with the reverse property set. + pub fn reverse(&self) -> Style { + Style { is_reverse: true, .. *self } + } + + /// Returns a Style with the hidden property set. + pub fn hidden(&self) -> Style { + Style { is_hidden: true, .. *self } + } + + /// Returns a Style with the hidden property set. + pub fn strikethrough(&self) -> Style { + Style { is_strikethrough: true, .. *self } + } + + /// Returns a Style with the foreground colour property set. + pub fn fg(&self, foreground: Colour) -> Style { + Style { foreground: Some(foreground), .. *self } + } + + /// Returns a Style with the background colour property set. + pub fn on(&self, background: Colour) -> Style { + Style { background: Some(background), .. *self } + } + + /// Return true if this `Style` has no actual styles, and can be written + /// without any control characters. + pub fn is_plain(self) -> bool { + self == Style::default() + } +} + +impl Default for Style { + + /// Returns a style with *no* properties set. Formatting text using this + /// style returns the exact same text. + /// + /// ``` + /// use ansi_term::Style; + /// assert_eq!(None, Style::default().foreground); + /// assert_eq!(None, Style::default().background); + /// assert_eq!(false, Style::default().is_bold); + /// assert_eq!("txt", Style::default().paint("txt").to_string()); + /// ``` + fn default() -> Style { + Style { + foreground: None, + background: None, + is_bold: false, + is_dimmed: false, + is_italic: false, + is_underline: false, + is_blink: false, + is_reverse: false, + is_hidden: false, + is_strikethrough: false, + } + } +} + + +// ---- colours ---- + +/// A colour is one specific type of ANSI escape code, and can refer +/// to either the foreground or background colour. +/// +/// These use the standard numeric sequences. +/// See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html +#[derive(PartialEq, Clone, Copy, Debug)] +pub enum Colour { + + /// Colour #0 (foreground code `30`, background code `40`). + /// + /// This is not necessarily the background colour, and using it as one may + /// render the text hard to read on terminals with dark backgrounds. + Black, + + /// Colour #1 (foreground code `31`, background code `41`). + Red, + + /// Colour #2 (foreground code `32`, background code `42`). + Green, + + /// Colour #3 (foreground code `33`, background code `43`). + Yellow, + + /// Colour #4 (foreground code `34`, background code `44`). + Blue, + + /// Colour #5 (foreground code `35`, background code `45`). + Purple, + + /// Colour #6 (foreground code `36`, background code `46`). + Cyan, + + /// Colour #7 (foreground code `37`, background code `47`). + /// + /// As above, this is not necessarily the foreground colour, and may be + /// hard to read on terminals with light backgrounds. + White, + + /// A colour number from 0 to 255, for use in 256-colour terminal + /// environments. + /// + /// - Colours 0 to 7 are the `Black` to `White` variants respectively. + /// These colours can usually be changed in the terminal emulator. + /// - Colours 8 to 15 are brighter versions of the eight colours above. + /// These can also usually be changed in the terminal emulator, or it + /// could be configured to use the original colours and show the text in + /// bold instead. It varies depending on the program. + /// - Colours 16 to 231 contain several palettes of bright colours, + /// arranged in six squares measuring six by six each. + /// - Colours 232 to 255 are shades of grey from black to white. + /// + /// It might make more sense to look at a [colour chart][cc]. + /// [cc]: https://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg + Fixed(u8), + + /// A 24-bit RGB color, as specified by ISO-8613-3. + RGB(u8, u8, u8), +} + + +impl Colour { + /// Return a Style with the foreground colour set to this colour. + pub fn normal(self) -> Style { + Style { foreground: Some(self), .. Style::default() } + } + + /// Returns a Style with the bold property set. + pub fn bold(self) -> Style { + Style { foreground: Some(self), is_bold: true, .. Style::default() } + } + + /// Returns a Style with the dimmed property set. + pub fn dimmed(self) -> Style { + Style { foreground: Some(self), is_dimmed: true, .. Style::default() } + } + + /// Returns a Style with the italic property set. + pub fn italic(self) -> Style { + Style { foreground: Some(self), is_italic: true, .. Style::default() } + } + + /// Returns a Style with the underline property set. + pub fn underline(self) -> Style { + Style { foreground: Some(self), is_underline: true, .. Style::default() } + } + + /// Returns a Style with the blink property set. + pub fn blink(self) -> Style { + Style { foreground: Some(self), is_blink: true, .. Style::default() } + } + + /// Returns a Style with the reverse property set. + pub fn reverse(self) -> Style { + Style { foreground: Some(self), is_reverse: true, .. Style::default() } + } + + /// Returns a Style with the hidden property set. + pub fn hidden(self) -> Style { + Style { foreground: Some(self), is_hidden: true, .. Style::default() } + } + + /// Returns a Style with the strikethrough property set. + pub fn strikethrough(self) -> Style { + Style { foreground: Some(self), is_strikethrough: true, .. Style::default() } + } + + /// Returns a Style with the background colour property set. + pub fn on(self, background: Colour) -> Style { + Style { foreground: Some(self), background: Some(background), .. Style::default() } + } +} + +impl From<Colour> for Style { + + /// You can turn a `Colour` into a `Style` with the foreground colour set + /// with the `From` trait. + /// + /// ``` + /// use ansi_term::{Style, Colour}; + /// let green_foreground = Style::default().fg(Colour::Green); + /// assert_eq!(green_foreground, Colour::Green.normal()); + /// assert_eq!(green_foreground, Colour::Green.into()); + /// assert_eq!(green_foreground, Style::from(Colour::Green)); + /// ``` + fn from(colour: Colour) -> Style { + colour.normal() + } +} diff --git a/src/vendor/ansi_term/src/windows.rs b/src/vendor/ansi_term/src/windows.rs new file mode 100644 index 0000000000..b060b80e6f --- /dev/null +++ b/src/vendor/ansi_term/src/windows.rs @@ -0,0 +1,35 @@ +/// Enables ANSI code support on Windows 10. +/// +/// This uses Windows API calls to alter the properties of the console that +/// the program is running in. +/// +/// https://msdn.microsoft.com/en-us/library/windows/desktop/mt638032(v=vs.85).aspx +/// +/// Returns a `Result` with the Windows error code if unsuccessful. +#[cfg(windows)] +pub fn enable_ansi_support() -> Result<(), u64> { + + #[link(name = "kernel32")] + extern { + fn GetStdHandle(handle: u64) -> *const i32; + fn SetConsoleMode(handle: *const i32, mode: u32) -> bool; + fn GetLastError() -> u64; + } + + unsafe { + const STD_OUT_HANDLE: u64 = -11i32 as u64; + const ENABLE_ANSI_CODES: u32 = 7; + + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms683231(v=vs.85).aspx + let std_out_handle = GetStdHandle(STD_OUT_HANDLE); + let error_code = GetLastError(); + if error_code != 0 { return Err(error_code); } + + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx + SetConsoleMode(std_out_handle, ENABLE_ANSI_CODES); + let error_code = GetLastError(); + if error_code != 0 { return Err(error_code); } + } + + return Ok(()); +} diff --git a/src/vendor/ansi_term/src/write.rs b/src/vendor/ansi_term/src/write.rs new file mode 100644 index 0000000000..65a64feb29 --- /dev/null +++ b/src/vendor/ansi_term/src/write.rs @@ -0,0 +1,40 @@ +use std::fmt; +use std::io; + + +pub trait AnyWrite { + type wstr: ?Sized; + type Error; + + fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error>; + + fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error>; +} + + +impl<'a> AnyWrite for fmt::Write + 'a { + type wstr = str; + type Error = fmt::Error; + + fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> { + fmt::Write::write_fmt(self, fmt) + } + + fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error> { + fmt::Write::write_str(self, s) + } +} + + +impl<'a> AnyWrite for io::Write + 'a { + type wstr = [u8]; + type Error = io::Error; + + fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> { + io::Write::write_fmt(self, fmt) + } + + fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error> { + io::Write::write_all(self, s) + } +} diff --git a/src/vendor/byteorder/.cargo-checksum.json b/src/vendor/byteorder/.cargo-checksum.json new file mode 100644 index 0000000000..3ba8476173 --- /dev/null +++ b/src/vendor/byteorder/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"2879af3c0512f976015d532e2d768f04ff22fdcf8745b69b955b78fda321c3fb",".travis.yml":"a798200a7a2a7b499b4c44f0e516cd8975dc5f4b933144d1e2b1523087330b95","CHANGELOG.md":"750ff16a714caad77a272a62b4baed5ea113ead2846f8c3968342e592a99ecd5","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"cd633b2d76dd5d57191388e7cc31340eb2d6b89e2f98f587999dc685d977c673","Cargo.toml.orig":"4b08dd159b8e9f21bc03e10a4800295a5250cfcebb14c8918ae4708bb96de809","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"97c01a66dbff4615acd49a8c3a85d137bf29cc113fa514910195bb11aef445bc","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","benches/bench.rs":"250d46461a0529a856d76a6421fd45c499bccba2c532e05dbf438c94582a8eac","src/io.rs":"4221711399f9723ef21c5b07700b8e9319f6f665b1eaaceb49528f6e976a25a9","src/lib.rs":"07e5f53bf3b9e30f1da9f4cf37797b77ce3d16c9f2a3a3e56669dd323debd1b9"},"package":"652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"} \ No newline at end of file diff --git a/src/vendor/byteorder/.cargo-ok b/src/vendor/byteorder/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/byteorder/.gitignore b/src/vendor/byteorder/.gitignore new file mode 100644 index 0000000000..1fec0efb81 --- /dev/null +++ b/src/vendor/byteorder/.gitignore @@ -0,0 +1,6 @@ +.*.swp +doc +tags +build +target +Cargo.lock diff --git a/src/vendor/byteorder/.travis.yml b/src/vendor/byteorder/.travis.yml new file mode 100644 index 0000000000..b8bb203a42 --- /dev/null +++ b/src/vendor/byteorder/.travis.yml @@ -0,0 +1,22 @@ +language: rust +rust: + - 1.12.0 + - stable + - beta + - nightly +script: + - cargo build --verbose + - cargo doc + - cargo test --verbose + - cargo test --verbose --no-default-features --lib + - if [ "$TRAVIS_RUST_VERSION" = "nightly" ]; then + cargo test --verbose --features i128; + cargo test --verbose --no-default-features --features i128 --lib; + cargo bench --verbose --no-run; + cargo bench --verbose --no-run --no-default-features; + cargo bench --verbose --no-run --features i128; + cargo bench --verbose --no-run --no-default-features --features i128; + fi +branches: + only: + - master diff --git a/src/vendor/byteorder/CHANGELOG.md b/src/vendor/byteorder/CHANGELOG.md new file mode 100644 index 0000000000..d59eaa7c5a --- /dev/null +++ b/src/vendor/byteorder/CHANGELOG.md @@ -0,0 +1,58 @@ +1.2.1 +===== +This patch release removes more unnecessary uses of `unsafe` that +were overlooked in the prior `1.2.0` release. In particular, the +`ReadBytesExt::read_{f32,f64}_into_checked` methods have been deprecated and +replaced by more appropriately named `read_{f32,f64}_into` methods. + + +1.2.0 +===== +The most prominent change in this release of `byteorder` is the removal of +unnecessary signaling NaN masking, and in turn, the `unsafe` annotations +associated with methods that didn't do masking. See +[#103](https://github.com/BurntSushi/byteorder/issues/103) +for more details. + +* [BUG #102](https://github.com/BurntSushi/byteorder/issues/102): + Fix big endian tests. +* [BUG #103](https://github.com/BurntSushi/byteorder/issues/103): + Remove sNaN masking. + + +1.1.0 +===== +This release of `byteorder` features a number of fixes and improvements, mostly +as a result of the +[Litz Blitz evaluation](https://public.etherpad-mozilla.org/p/rust-crate-eval-byteorder). + +Feature enhancements: + +* [FEATURE #63](https://github.com/BurntSushi/byteorder/issues/63): + Add methods for reading/writing slices of numbers for a specific + endianness. +* [FEATURE #65](https://github.com/BurntSushi/byteorder/issues/65): + Add support for `u128`/`i128` types. (Behind the nightly only `i128` + feature.) +* [FEATURE #72](https://github.com/BurntSushi/byteorder/issues/72): + Add "panics" and "errors" sections for each relevant public API item. +* [FEATURE #74](https://github.com/BurntSushi/byteorder/issues/74): + Add CI badges to Cargo.toml. +* [FEATURE #75](https://github.com/BurntSushi/byteorder/issues/75): + Add more examples to public API items. +* Add 24-bit read/write methods. +* Add `BE` and `LE` type aliases for `BigEndian` and `LittleEndian`, + respectively. + +Bug fixes: + +* [BUG #68](https://github.com/BurntSushi/byteorder/issues/68): + Panic in {BigEndian,LittleEndian}::default. +* [BUG #69](https://github.com/BurntSushi/byteorder/issues/69): + Seal the `ByteOrder` trait to prevent out-of-crate implementations. +* [BUG #71](https://github.com/BurntSushi/byteorder/issues/71): + Guarantee that the results of `read_f32`/`read_f64` are always defined. +* [BUG #73](https://github.com/BurntSushi/byteorder/issues/73): + Add crates.io categories. +* [BUG #77](https://github.com/BurntSushi/byteorder/issues/77): + Add `html_root` doc attribute. diff --git a/src/vendor/memchr-1.0.2/COPYING b/src/vendor/byteorder/COPYING similarity index 100% rename from src/vendor/memchr-1.0.2/COPYING rename to src/vendor/byteorder/COPYING diff --git a/src/vendor/byteorder/Cargo.toml b/src/vendor/byteorder/Cargo.toml new file mode 100644 index 0000000000..06a18e2056 --- /dev/null +++ b/src/vendor/byteorder/Cargo.toml @@ -0,0 +1,43 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "byteorder" +version = "1.2.1" +authors = ["Andrew Gallant <jamslam@gmail.com>"] +description = "Library for reading/writing numbers in big-endian and little-endian." +homepage = "https://github.com/BurntSushi/byteorder" +documentation = "https://docs.rs/byteorder" +readme = "README.md" +keywords = ["byte", "endian", "big-endian", "little-endian", "binary"] +categories = ["encoding", "parsing"] +license = "Unlicense/MIT" +repository = "https://github.com/BurntSushi/byteorder" +[profile.bench] +opt-level = 3 + +[lib] +name = "byteorder" +bench = false +[dev-dependencies.quickcheck] +version = "0.4" +default-features = false + +[dev-dependencies.rand] +version = "0.3" + +[features] +default = ["std"] +i128 = [] +std = [] +[badges.travis-ci] +repository = "BurntSushi/byteorder" diff --git a/src/vendor/byteorder/Cargo.toml.orig b/src/vendor/byteorder/Cargo.toml.orig new file mode 100644 index 0000000000..55ec05e136 --- /dev/null +++ b/src/vendor/byteorder/Cargo.toml.orig @@ -0,0 +1,32 @@ +[package] +name = "byteorder" +# NB: When modifying, also modify html_root_url in lib.rs +version = "1.2.1" #:version +authors = ["Andrew Gallant <jamslam@gmail.com>"] +description = "Library for reading/writing numbers in big-endian and little-endian." +documentation = "https://docs.rs/byteorder" +homepage = "https://github.com/BurntSushi/byteorder" +repository = "https://github.com/BurntSushi/byteorder" +readme = "README.md" +categories = ["encoding", "parsing"] +keywords = ["byte", "endian", "big-endian", "little-endian", "binary"] +license = "Unlicense/MIT" + +[lib] +name = "byteorder" +bench = false + +[dev-dependencies] +quickcheck = { version = "0.4", default-features = false } +rand = "0.3" + +[features] +default = ["std"] +std = [] +i128 = [] + +[profile.bench] +opt-level = 3 + +[badges] +travis-ci = { repository = "BurntSushi/byteorder" } diff --git a/src/vendor/memchr-1.0.2/LICENSE-MIT b/src/vendor/byteorder/LICENSE-MIT similarity index 100% rename from src/vendor/memchr-1.0.2/LICENSE-MIT rename to src/vendor/byteorder/LICENSE-MIT diff --git a/src/vendor/byteorder/README.md b/src/vendor/byteorder/README.md new file mode 100644 index 0000000000..f282ab72e0 --- /dev/null +++ b/src/vendor/byteorder/README.md @@ -0,0 +1,56 @@ +This crate provides convenience methods for encoding and decoding numbers in +either big-endian or little-endian order. + +[![Build status](https://api.travis-ci.org/BurntSushi/byteorder.svg)](https://travis-ci.org/BurntSushi/byteorder) +[![](http://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder) + +Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). + + +### Documentation + +https://docs.rs/byteorder + + +### Installation + +This crate works with Cargo and is on +[crates.io](https://crates.io/crates/byteorder). Add it to your `Cargo.toml` +like so: + +```toml +[dependencies] +byteorder = "1" +``` + +If you want to augment existing `Read` and `Write` traits, then import the +extension methods like so: + +```rust +extern crate byteorder; + +use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian}; +``` + +For example: + +```rust +use std::io::Cursor; +use byteorder::{BigEndian, ReadBytesExt}; + +let mut rdr = Cursor::new(vec![2, 5, 3, 0]); +// Note that we use type parameters to indicate which kind of byte order +// we want! +assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap()); +assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap()); +``` + +### `no_std` crates + +This crate has a feature, `std`, that is enabled by default. To use this crate +in a `no_std` context, add the following to your `Cargo.toml`: + +```toml +[dependencies] +byteorder = { version = "1", default-features = false } +``` diff --git a/src/vendor/memchr-1.0.2/UNLICENSE b/src/vendor/byteorder/UNLICENSE similarity index 100% rename from src/vendor/memchr-1.0.2/UNLICENSE rename to src/vendor/byteorder/UNLICENSE diff --git a/src/vendor/byteorder/benches/bench.rs b/src/vendor/byteorder/benches/bench.rs new file mode 100644 index 0000000000..845e489f88 --- /dev/null +++ b/src/vendor/byteorder/benches/bench.rs @@ -0,0 +1,320 @@ +#![cfg_attr(feature = "i128", feature(i128))] +#![feature(test)] + +extern crate byteorder; +extern crate rand; +extern crate test; + +macro_rules! bench_num { + ($name:ident, $read:ident, $bytes:expr, $data:expr) => ( + mod $name { + use byteorder::{ByteOrder, BigEndian, NativeEndian, LittleEndian}; + use super::test::Bencher; + use super::test::black_box as bb; + + const NITER: usize = 100_000; + + #[bench] + fn read_big_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(BigEndian::$read(&buf, $bytes)); + } + }); + } + + #[bench] + fn read_little_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(LittleEndian::$read(&buf, $bytes)); + } + }); + } + + #[bench] + fn read_native_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(NativeEndian::$read(&buf, $bytes)); + } + }); + } + } + ); + ($ty:ident, $max:ident, + $read:ident, $write:ident, $size:expr, $data:expr) => ( + mod $ty { + use std::$ty; + use byteorder::{ByteOrder, BigEndian, NativeEndian, LittleEndian}; + use super::test::Bencher; + use super::test::black_box as bb; + + const NITER: usize = 100_000; + + #[bench] + fn read_big_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(BigEndian::$read(&buf)); + } + }); + } + + #[bench] + fn read_little_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(LittleEndian::$read(&buf)); + } + }); + } + + #[bench] + fn read_native_endian(b: &mut Bencher) { + let buf = $data; + b.iter(|| { + for _ in 0..NITER { + bb(NativeEndian::$read(&buf)); + } + }); + } + + #[bench] + fn write_big_endian(b: &mut Bencher) { + let mut buf = $data; + let n = $ty::$max; + b.iter(|| { + for _ in 0..NITER { + bb(BigEndian::$write(&mut buf, n)); + } + }); + } + + #[bench] + fn write_little_endian(b: &mut Bencher) { + let mut buf = $data; + let n = $ty::$max; + b.iter(|| { + for _ in 0..NITER { + bb(LittleEndian::$write(&mut buf, n)); + } + }); + } + + #[bench] + fn write_native_endian(b: &mut Bencher) { + let mut buf = $data; + let n = $ty::$max; + b.iter(|| { + for _ in 0..NITER { + bb(NativeEndian::$write(&mut buf, n)); + } + }); + } + } + ); +} + +bench_num!(u16, MAX, read_u16, write_u16, 2, [1, 2]); +bench_num!(i16, MAX, read_i16, write_i16, 2, [1, 2]); +bench_num!(u32, MAX, read_u32, write_u32, 4, [1, 2, 3, 4]); +bench_num!(i32, MAX, read_i32, write_i32, 4, [1, 2, 3, 4]); +bench_num!(u64, MAX, read_u64, write_u64, 8, [1, 2, 3, 4, 5, 6, 7, 8]); +bench_num!(i64, MAX, read_i64, write_i64, 8, [1, 2, 3, 4, 5, 6, 7, 8]); +bench_num!(f32, MAX, read_f32, write_f32, 4, [1, 2, 3, 4]); +bench_num!(f64, MAX, read_f64, write_f64, 8, + [1, 2, 3, 4, 5, 6, 7, 8]); + +bench_num!(uint_1, read_uint, 1, [1]); +bench_num!(uint_2, read_uint, 2, [1, 2]); +bench_num!(uint_3, read_uint, 3, [1, 2, 3]); +bench_num!(uint_4, read_uint, 4, [1, 2, 3, 4]); +bench_num!(uint_5, read_uint, 5, [1, 2, 3, 4, 5]); +bench_num!(uint_6, read_uint, 6, [1, 2, 3, 4, 5, 6]); +bench_num!(uint_7, read_uint, 7, [1, 2, 3, 4, 5, 6, 7]); +bench_num!(uint_8, read_uint, 8, [1, 2, 3, 4, 5, 6, 7, 8]); + +bench_num!(int_1, read_int, 1, [1]); +bench_num!(int_2, read_int, 2, [1, 2]); +bench_num!(int_3, read_int, 3, [1, 2, 3]); +bench_num!(int_4, read_int, 4, [1, 2, 3, 4]); +bench_num!(int_5, read_int, 5, [1, 2, 3, 4, 5]); +bench_num!(int_6, read_int, 6, [1, 2, 3, 4, 5, 6]); +bench_num!(int_7, read_int, 7, [1, 2, 3, 4, 5, 6, 7]); +bench_num!(int_8, read_int, 8, [1, 2, 3, 4, 5, 6, 7, 8]); + +#[cfg(feature = "i128")] +bench_num!(u128, MAX, read_u128, write_u128, + 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); +#[cfg(feature = "i128")] +bench_num!(i128, MAX, read_i128, write_i128, + 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); + +#[cfg(feature = "i128")] +bench_num!(uint128_1, read_uint128, + 1, [1]); +#[cfg(feature = "i128")] +bench_num!(uint128_2, read_uint128, + 2, [1, 2]); +#[cfg(feature = "i128")] +bench_num!(uint128_3, read_uint128, + 3, [1, 2, 3]); +#[cfg(feature = "i128")] +bench_num!(uint128_4, read_uint128, + 4, [1, 2, 3, 4]); +#[cfg(feature = "i128")] +bench_num!(uint128_5, read_uint128, + 5, [1, 2, 3, 4, 5]); +#[cfg(feature = "i128")] +bench_num!(uint128_6, read_uint128, + 6, [1, 2, 3, 4, 5, 6]); +#[cfg(feature = "i128")] +bench_num!(uint128_7, read_uint128, + 7, [1, 2, 3, 4, 5, 6, 7]); +#[cfg(feature = "i128")] +bench_num!(uint128_8, read_uint128, + 8, [1, 2, 3, 4, 5, 6, 7, 8]); +#[cfg(feature = "i128")] +bench_num!(uint128_9, read_uint128, + 9, [1, 2, 3, 4, 5, 6, 7, 8, 9]); +#[cfg(feature = "i128")] +bench_num!(uint128_10, read_uint128, + 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); +#[cfg(feature = "i128")] +bench_num!(uint128_11, read_uint128, + 11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); +#[cfg(feature = "i128")] +bench_num!(uint128_12, read_uint128, + 12, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); +#[cfg(feature = "i128")] +bench_num!(uint128_13, read_uint128, + 13, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]); +#[cfg(feature = "i128")] +bench_num!(uint128_14, read_uint128, + 14, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); +#[cfg(feature = "i128")] +bench_num!(uint128_15, read_uint128, + 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); +#[cfg(feature = "i128")] +bench_num!(uint128_16, read_uint128, + 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); + +#[cfg(feature = "i128")] +bench_num!(int128_1, read_int128, + 1, [1]); +#[cfg(feature = "i128")] +bench_num!(int128_2, read_int128, + 2, [1, 2]); +#[cfg(feature = "i128")] +bench_num!(int128_3, read_int128, + 3, [1, 2, 3]); +#[cfg(feature = "i128")] +bench_num!(int128_4, read_int128, + 4, [1, 2, 3, 4]); +#[cfg(feature = "i128")] +bench_num!(int128_5, read_int128, + 5, [1, 2, 3, 4, 5]); +#[cfg(feature = "i128")] +bench_num!(int128_6, read_int128, + 6, [1, 2, 3, 4, 5, 6]); +#[cfg(feature = "i128")] +bench_num!(int128_7, read_int128, + 7, [1, 2, 3, 4, 5, 6, 7]); +#[cfg(feature = "i128")] +bench_num!(int128_8, read_int128, + 8, [1, 2, 3, 4, 5, 6, 7, 8]); +#[cfg(feature = "i128")] +bench_num!(int128_9, read_int128, + 9, [1, 2, 3, 4, 5, 6, 7, 8, 9]); +#[cfg(feature = "i128")] +bench_num!(int128_10, read_int128, + 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); +#[cfg(feature = "i128")] +bench_num!(int128_11, read_int128, + 11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); +#[cfg(feature = "i128")] +bench_num!(int128_12, read_int128, + 12, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); +#[cfg(feature = "i128")] +bench_num!(int128_13, read_int128, + 13, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]); +#[cfg(feature = "i128")] +bench_num!(int128_14, read_int128, + 14, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); +#[cfg(feature = "i128")] +bench_num!(int128_15, read_int128, + 15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); +#[cfg(feature = "i128")] +bench_num!(int128_16, read_int128, + 16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); + + +macro_rules! bench_slice { + ($name:ident, $numty:ty, $read:ident, $write:ident) => { + mod $name { + use std::mem::size_of; + + use byteorder::{ByteOrder, BigEndian, LittleEndian}; + use rand::{self, Rng}; + use test::Bencher; + + #[bench] + fn read_big_endian(b: &mut Bencher) { + let mut numbers: Vec<$numty> = + rand::thread_rng().gen_iter().take(100000).collect(); + let mut bytes = vec![0; numbers.len() * size_of::<$numty>()]; + BigEndian::$write(&numbers, &mut bytes); + + b.bytes = bytes.len() as u64; + b.iter(|| { + BigEndian::$read(&bytes, &mut numbers); + }); + } + + #[bench] + fn read_little_endian(b: &mut Bencher) { + let mut numbers: Vec<$numty> = + rand::thread_rng().gen_iter().take(100000).collect(); + let mut bytes = vec![0; numbers.len() * size_of::<$numty>()]; + LittleEndian::$write(&numbers, &mut bytes); + + b.bytes = bytes.len() as u64; + b.iter(|| { + LittleEndian::$read(&bytes, &mut numbers); + }); + } + + #[bench] + fn write_big_endian(b: &mut Bencher) { + let numbers: Vec<$numty> = + rand::thread_rng().gen_iter().take(100000).collect(); + let mut bytes = vec![0; numbers.len() * size_of::<$numty>()]; + + b.bytes = bytes.len() as u64; + b.iter(|| { + BigEndian::$write(&numbers, &mut bytes); + }); + } + + #[bench] + fn write_little_endian(b: &mut Bencher) { + let numbers: Vec<$numty> = + rand::thread_rng().gen_iter().take(100000).collect(); + let mut bytes = vec![0; numbers.len() * size_of::<$numty>()]; + + b.bytes = bytes.len() as u64; + b.iter(|| { + LittleEndian::$write(&numbers, &mut bytes); + }); + } + } + } +} + +bench_slice!(slice_u64, u64, read_u64_into, write_u64_into); diff --git a/src/vendor/byteorder/src/io.rs b/src/vendor/byteorder/src/io.rs new file mode 100644 index 0000000000..c5645fa17f --- /dev/null +++ b/src/vendor/byteorder/src/io.rs @@ -0,0 +1,1264 @@ +use std::io::{self, Result}; +use std::slice; + +use ByteOrder; + +/// Extends `Read` with methods for reading numbers. (For `std::io`.) +/// +/// Most of the methods defined here have an unconstrained type parameter that +/// must be explicitly instantiated. Typically, it is instantiated with either +/// the `BigEndian` or `LittleEndian` types defined in this crate. +/// +/// # Examples +/// +/// Read unsigned 16 bit big-endian integers from a `Read`: +/// +/// ```rust +/// use std::io::Cursor; +/// use byteorder::{BigEndian, ReadBytesExt}; +/// +/// let mut rdr = Cursor::new(vec![2, 5, 3, 0]); +/// assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap()); +/// assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap()); +/// ``` +pub trait ReadBytesExt: io::Read { + /// Reads an unsigned 8 bit integer from the underlying reader. + /// + /// Note that since this reads a single byte, no byte order conversions + /// are used. It is included for completeness. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read unsigned 8 bit integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![2, 5]); + /// assert_eq!(2, rdr.read_u8().unwrap()); + /// assert_eq!(5, rdr.read_u8().unwrap()); + /// ``` + #[inline] + fn read_u8(&mut self) -> Result<u8> { + let mut buf = [0; 1]; + try!(self.read_exact(&mut buf)); + Ok(buf[0]) + } + + /// Reads a signed 8 bit integer from the underlying reader. + /// + /// Note that since this reads a single byte, no byte order conversions + /// are used. It is included for completeness. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read unsigned 8 bit integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x02, 0xfb]); + /// assert_eq!(2, rdr.read_i8().unwrap()); + /// assert_eq!(-5, rdr.read_i8().unwrap()); + /// ``` + #[inline] + fn read_i8(&mut self) -> Result<i8> { + let mut buf = [0; 1]; + try!(self.read_exact(&mut buf)); + Ok(buf[0] as i8) + } + + /// Reads an unsigned 16 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read unsigned 16 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![2, 5, 3, 0]); + /// assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap()); + /// assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_u16<T: ByteOrder>(&mut self) -> Result<u16> { + let mut buf = [0; 2]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u16(&buf)) + } + + /// Reads a signed 16 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read signed 16 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x00, 0xc1, 0xff, 0x7c]); + /// assert_eq!(193, rdr.read_i16::<BigEndian>().unwrap()); + /// assert_eq!(-132, rdr.read_i16::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_i16<T: ByteOrder>(&mut self) -> Result<i16> { + let mut buf = [0; 2]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i16(&buf)) + } + + /// Reads an unsigned 24 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read unsigned 24 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x00, 0x01, 0x0b]); + /// assert_eq!(267, rdr.read_u24::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_u24<T: ByteOrder>(&mut self) -> Result<u32> { + let mut buf = [0; 3]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u24(&buf)) + } + + /// Reads a signed 24 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read signed 24 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0xff, 0x7a, 0x33]); + /// assert_eq!(-34253, rdr.read_i24::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_i24<T: ByteOrder>(&mut self) -> Result<i32> { + let mut buf = [0; 3]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i24(&buf)) + } + + /// Reads an unsigned 32 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read unsigned 32 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x00, 0x00, 0x01, 0x0b]); + /// assert_eq!(267, rdr.read_u32::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_u32<T: ByteOrder>(&mut self) -> Result<u32> { + let mut buf = [0; 4]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u32(&buf)) + } + + /// Reads a signed 32 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read signed 32 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0xff, 0xff, 0x7a, 0x33]); + /// assert_eq!(-34253, rdr.read_i32::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_i32<T: ByteOrder>(&mut self) -> Result<i32> { + let mut buf = [0; 4]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i32(&buf)) + } + + /// Reads an unsigned 64 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read an unsigned 64 bit big-endian integer from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x00, 0x03, 0x43, 0x95, 0x4d, 0x60, 0x86, 0x83]); + /// assert_eq!(918733457491587, rdr.read_u64::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_u64<T: ByteOrder>(&mut self) -> Result<u64> { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u64(&buf)) + } + + /// Reads a signed 64 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a signed 64 bit big-endian integer from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x80, 0, 0, 0, 0, 0, 0, 0]); + /// assert_eq!(i64::min_value(), rdr.read_i64::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_i64<T: ByteOrder>(&mut self) -> Result<i64> { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i64(&buf)) + } + + /// Reads an unsigned 128 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read an unsigned 128 bit big-endian integer from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0x00, 0x03, 0x43, 0x95, 0x4d, 0x60, 0x86, 0x83, + /// 0x00, 0x03, 0x43, 0x95, 0x4d, 0x60, 0x86, 0x83 + /// ]); + /// assert_eq!(16947640962301618749969007319746179, rdr.read_u128::<BigEndian>().unwrap()); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn read_u128<T: ByteOrder>(&mut self) -> Result<u128> { + let mut buf = [0; 16]; + try!(self.read_exact(&mut buf)); + Ok(T::read_u128(&buf)) + } + + /// Reads a signed 128 bit integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a signed 128 bit big-endian integer from a `Read`: + /// + /// ```rust + /// #![feature(i128_type)] + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + /// assert_eq!(i128::min_value(), rdr.read_i128::<BigEndian>().unwrap()); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn read_i128<T: ByteOrder>(&mut self) -> Result<i128> { + let mut buf = [0; 16]; + try!(self.read_exact(&mut buf)); + Ok(T::read_i128(&buf)) + } + + /// Reads an unsigned n-bytes integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read an unsigned n-byte big-endian integer from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0x80, 0x74, 0xfa]); + /// assert_eq!(8418554, rdr.read_uint::<BigEndian>(3).unwrap()); + #[inline] + fn read_uint<T: ByteOrder>(&mut self, nbytes: usize) -> Result<u64> { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf[..nbytes])); + Ok(T::read_uint(&buf[..nbytes], nbytes)) + } + + /// Reads a signed n-bytes integer from the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read an unsigned n-byte big-endian integer from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0xc1, 0xff, 0x7c]); + /// assert_eq!(-4063364, rdr.read_int::<BigEndian>(3).unwrap()); + #[inline] + fn read_int<T: ByteOrder>(&mut self, nbytes: usize) -> Result<i64> { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf[..nbytes])); + Ok(T::read_int(&buf[..nbytes], nbytes)) + } + + /// Reads an unsigned n-bytes integer from the underlying reader. + #[cfg(feature = "i128")] + #[inline] + fn read_uint128<T: ByteOrder>(&mut self, nbytes: usize) -> Result<u128> { + let mut buf = [0; 16]; + try!(self.read_exact(&mut buf[..nbytes])); + Ok(T::read_uint128(&buf[..nbytes], nbytes)) + } + + /// Reads a signed n-bytes integer from the underlying reader. + #[cfg(feature = "i128")] + #[inline] + fn read_int128<T: ByteOrder>(&mut self, nbytes: usize) -> Result<i128> { + let mut buf = [0; 16]; + try!(self.read_exact(&mut buf[..nbytes])); + Ok(T::read_int128(&buf[..nbytes], nbytes)) + } + + /// Reads a IEEE754 single-precision (4 bytes) floating point number from + /// the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a big-endian single-precision floating point number from a `Read`: + /// + /// ```rust + /// use std::f32; + /// use std::io::Cursor; + /// + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0x40, 0x49, 0x0f, 0xdb, + /// ]); + /// assert_eq!(f32::consts::PI, rdr.read_f32::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_f32<T: ByteOrder>(&mut self) -> Result<f32> { + let mut buf = [0; 4]; + try!(self.read_exact(&mut buf)); + Ok(T::read_f32(&buf)) + } + + /// Reads a IEEE754 double-precision (8 bytes) floating point number from + /// the underlying reader. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a big-endian double-precision floating point number from a `Read`: + /// + /// ```rust + /// use std::f64; + /// use std::io::Cursor; + /// + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18, + /// ]); + /// assert_eq!(f64::consts::PI, rdr.read_f64::<BigEndian>().unwrap()); + /// ``` + #[inline] + fn read_f64<T: ByteOrder>(&mut self) -> Result<f64> { + let mut buf = [0; 8]; + try!(self.read_exact(&mut buf)); + Ok(T::read_f64(&buf)) + } + + /// Reads a sequence of unsigned 16 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of unsigned 16 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![2, 5, 3, 0]); + /// let mut dst = [0; 2]; + /// rdr.read_u16_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[inline] + fn read_u16_into<T: ByteOrder>(&mut self, dst: &mut [u16]) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_u16(dst); + Ok(()) + } + + /// Reads a sequence of unsigned 32 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of unsigned 32 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0, 0, 2, 5, 0, 0, 3, 0]); + /// let mut dst = [0; 2]; + /// rdr.read_u32_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[inline] + fn read_u32_into<T: ByteOrder>(&mut self, dst: &mut [u32]) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_u32(dst); + Ok(()) + } + + /// Reads a sequence of unsigned 64 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of unsigned 64 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0, 0, 0, 0, 0, 0, 2, 5, + /// 0, 0, 0, 0, 0, 0, 3, 0, + /// ]); + /// let mut dst = [0; 2]; + /// rdr.read_u64_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[inline] + fn read_u64_into<T: ByteOrder>(&mut self, dst: &mut [u64]) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_u64(dst); + Ok(()) + } + + /// Reads a sequence of unsigned 128 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of unsigned 128 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, + /// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, + /// ]); + /// let mut dst = [0; 2]; + /// rdr.read_u128_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn read_u128_into<T: ByteOrder>( + &mut self, + dst: &mut [u128], + ) -> Result<()> { + { + let mut buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_u128(dst); + Ok(()) + } + + /// Reads a sequence of signed 16 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of signed 16 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![2, 5, 3, 0]); + /// let mut dst = [0; 2]; + /// rdr.read_i16_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[inline] + fn read_i16_into<T: ByteOrder>(&mut self, dst: &mut [i16]) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_i16(dst); + Ok(()) + } + + /// Reads a sequence of signed 32 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of signed 32 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![0, 0, 2, 5, 0, 0, 3, 0]); + /// let mut dst = [0; 2]; + /// rdr.read_i32_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[inline] + fn read_i32_into<T: ByteOrder>(&mut self, dst: &mut [i32]) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_i32(dst); + Ok(()) + } + + /// Reads a sequence of signed 64 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of signed 64 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0, 0, 0, 0, 0, 0, 2, 5, + /// 0, 0, 0, 0, 0, 0, 3, 0, + /// ]); + /// let mut dst = [0; 2]; + /// rdr.read_i64_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[inline] + fn read_i64_into<T: ByteOrder>(&mut self, dst: &mut [i64]) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_i64(dst); + Ok(()) + } + + /// Reads a sequence of signed 128 bit integers from the underlying + /// reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of signed 128 bit big-endian integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, + /// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, + /// ]); + /// let mut dst = [0; 2]; + /// rdr.read_i128_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([517, 768], dst); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn read_i128_into<T: ByteOrder>( + &mut self, + dst: &mut [i128], + ) -> Result<()> { + { + let mut buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_i128(dst); + Ok(()) + } + + /// Reads a sequence of IEEE754 single-precision (4 bytes) floating + /// point numbers from the underlying reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of big-endian single-precision floating point number + /// from a `Read`: + /// + /// ```rust + /// use std::f32; + /// use std::io::Cursor; + /// + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0x40, 0x49, 0x0f, 0xdb, + /// 0x3f, 0x80, 0x00, 0x00, + /// ]); + /// let mut dst = [0.0; 2]; + /// rdr.read_f32_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([f32::consts::PI, 1.0], dst); + /// ``` + #[inline] + fn read_f32_into<T: ByteOrder>( + &mut self, + dst: &mut [f32], + ) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_f32(dst); + Ok(()) + } + + /// **DEPRECATED**. + /// + /// This method is deprecated. Use `read_f32_into` instead. + /// + /// Reads a sequence of IEEE754 single-precision (4 bytes) floating + /// point numbers from the underlying reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of big-endian single-precision floating point number + /// from a `Read`: + /// + /// ```rust + /// use std::f32; + /// use std::io::Cursor; + /// + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0x40, 0x49, 0x0f, 0xdb, + /// 0x3f, 0x80, 0x00, 0x00, + /// ]); + /// let mut dst = [0.0; 2]; + /// rdr.read_f32_into_unchecked::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([f32::consts::PI, 1.0], dst); + /// ``` + #[inline] + fn read_f32_into_unchecked<T: ByteOrder>( + &mut self, + dst: &mut [f32], + ) -> Result<()> { + self.read_f32_into::<T>(dst) + } + + /// Reads a sequence of IEEE754 double-precision (8 bytes) floating + /// point numbers from the underlying reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of big-endian single-precision floating point number + /// from a `Read`: + /// + /// ```rust + /// use std::f64; + /// use std::io::Cursor; + /// + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18, + /// 0x3f, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /// ]); + /// let mut dst = [0.0; 2]; + /// rdr.read_f64_into::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([f64::consts::PI, 1.0], dst); + /// ``` + #[inline] + fn read_f64_into<T: ByteOrder>( + &mut self, + dst: &mut [f64], + ) -> Result<()> { + { + let buf = unsafe { slice_to_u8_mut(dst) }; + try!(self.read_exact(buf)); + } + T::from_slice_f64(dst); + Ok(()) + } + + /// **DEPRECATED**. + /// + /// This method is deprecated. Use `read_f64_into` instead. + /// + /// Reads a sequence of IEEE754 double-precision (8 bytes) floating + /// point numbers from the underlying reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// # Safety + /// + /// This method is unsafe because there are no guarantees made about the + /// floating point values. In particular, this method does not check for + /// signaling NaNs, which may result in undefined behavior. + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of big-endian single-precision floating point number + /// from a `Read`: + /// + /// ```rust + /// use std::f64; + /// use std::io::Cursor; + /// + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![ + /// 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18, + /// 0x3f, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /// ]); + /// let mut dst = [0.0; 2]; + /// rdr.read_f64_into_unchecked::<BigEndian>(&mut dst).unwrap(); + /// assert_eq!([f64::consts::PI, 1.0], dst); + /// ``` + #[inline] + fn read_f64_into_unchecked<T: ByteOrder>( + &mut self, + dst: &mut [f64], + ) -> Result<()> { + self.read_f64_into::<T>(dst) + } +} + +/// All types that implement `Read` get methods defined in `ReadBytesExt` +/// for free. +impl<R: io::Read + ?Sized> ReadBytesExt for R {} + +/// Extends `Write` with methods for writing numbers. (For `std::io`.) +/// +/// Most of the methods defined here have an unconstrained type parameter that +/// must be explicitly instantiated. Typically, it is instantiated with either +/// the `BigEndian` or `LittleEndian` types defined in this crate. +/// +/// # Examples +/// +/// Write unsigned 16 bit big-endian integers to a `Write`: +/// +/// ```rust +/// use byteorder::{BigEndian, WriteBytesExt}; +/// +/// let mut wtr = vec![]; +/// wtr.write_u16::<BigEndian>(517).unwrap(); +/// wtr.write_u16::<BigEndian>(768).unwrap(); +/// assert_eq!(wtr, vec![2, 5, 3, 0]); +/// ``` +pub trait WriteBytesExt: io::Write { + /// Writes an unsigned 8 bit integer to the underlying writer. + /// + /// Note that since this writes a single byte, no byte order conversions + /// are used. It is included for completeness. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_u8(&mut self, n: u8) -> Result<()> { + self.write_all(&[n]) + } + + /// Writes a signed 8 bit integer to the underlying writer. + /// + /// Note that since this writes a single byte, no byte order conversions + /// are used. It is included for completeness. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_i8(&mut self, n: i8) -> Result<()> { + self.write_all(&[n as u8]) + } + + /// Writes an unsigned 16 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_u16<T: ByteOrder>(&mut self, n: u16) -> Result<()> { + let mut buf = [0; 2]; + T::write_u16(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 16 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_i16<T: ByteOrder>(&mut self, n: i16) -> Result<()> { + let mut buf = [0; 2]; + T::write_i16(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned 24 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_u24<T: ByteOrder>(&mut self, n: u32) -> Result<()> { + let mut buf = [0; 3]; + T::write_u24(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 24 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_i24<T: ByteOrder>(&mut self, n: i32) -> Result<()> { + let mut buf = [0; 3]; + T::write_i24(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned 32 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_u32<T: ByteOrder>(&mut self, n: u32) -> Result<()> { + let mut buf = [0; 4]; + T::write_u32(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 32 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_i32<T: ByteOrder>(&mut self, n: i32) -> Result<()> { + let mut buf = [0; 4]; + T::write_i32(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned 64 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_u64<T: ByteOrder>(&mut self, n: u64) -> Result<()> { + let mut buf = [0; 8]; + T::write_u64(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 64 bit integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_i64<T: ByteOrder>(&mut self, n: i64) -> Result<()> { + let mut buf = [0; 8]; + T::write_i64(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned 128 bit integer to the underlying writer. + #[cfg(feature = "i128")] + #[inline] + fn write_u128<T: ByteOrder>(&mut self, n: u128) -> Result<()> { + let mut buf = [0; 16]; + T::write_u128(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a signed 128 bit integer to the underlying writer. + #[cfg(feature = "i128")] + #[inline] + fn write_i128<T: ByteOrder>(&mut self, n: i128) -> Result<()> { + let mut buf = [0; 16]; + T::write_i128(&mut buf, n); + self.write_all(&buf) + } + + /// Writes an unsigned n-bytes integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + /// + /// # Panics + /// + /// If the given integer is not representable in the given number of bytes, + /// this method panics. If `nbytes > 8`, this method panics. + #[inline] + fn write_uint<T: ByteOrder>( + &mut self, + n: u64, + nbytes: usize, + ) -> Result<()> { + let mut buf = [0; 8]; + T::write_uint(&mut buf, n, nbytes); + self.write_all(&buf[0..nbytes]) + } + + /// Writes a signed n-bytes integer to the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + /// + /// # Panics + /// + /// If the given integer is not representable in the given number of bytes, + /// this method panics. If `nbytes > 8`, this method panics. + #[inline] + fn write_int<T: ByteOrder>( + &mut self, + n: i64, + nbytes: usize, + ) -> Result<()> { + let mut buf = [0; 8]; + T::write_int(&mut buf, n, nbytes); + self.write_all(&buf[0..nbytes]) + } + + /// Writes an unsigned n-bytes integer to the underlying writer. + /// + /// If the given integer is not representable in the given number of bytes, + /// this method panics. If `nbytes > 16`, this method panics. + #[cfg(feature = "i128")] + #[inline] + fn write_uint128<T: ByteOrder>( + &mut self, + n: u128, + nbytes: usize, + ) -> Result<()> { + let mut buf = [0; 16]; + T::write_uint128(&mut buf, n, nbytes); + self.write_all(&buf[0..nbytes]) + } + + /// Writes a signed n-bytes integer to the underlying writer. + /// + /// If the given integer is not representable in the given number of bytes, + /// this method panics. If `nbytes > 16`, this method panics. + #[cfg(feature = "i128")] + #[inline] + fn write_int128<T: ByteOrder>( + &mut self, + n: i128, + nbytes: usize, + ) -> Result<()> { + let mut buf = [0; 16]; + T::write_int128(&mut buf, n, nbytes); + self.write_all(&buf[0..nbytes]) + } + + /// Writes a IEEE754 single-precision (4 bytes) floating point number to + /// the underlying writer. + /// + /// # Errors + /// + /// This method returns the same errors as [`Write::write_all`]. + /// + /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all + #[inline] + fn write_f32<T: ByteOrder>(&mut self, n: f32) -> Result<()> { + let mut buf = [0; 4]; + T::write_f32(&mut buf, n); + self.write_all(&buf) + } + + /// Writes a IEEE754 double-precision (8 bytes) floating point number to + /// the underlying writer. + #[inline] + fn write_f64<T: ByteOrder>(&mut self, n: f64) -> Result<()> { + let mut buf = [0; 8]; + T::write_f64(&mut buf, n); + self.write_all(&buf) + } +} + +/// All types that implement `Write` get methods defined in `WriteBytesExt` +/// for free. +impl<W: io::Write + ?Sized> WriteBytesExt for W {} + +/// Convert a slice of T (where T is plain old data) to its mutable binary +/// representation. +/// +/// This function is wildly unsafe because it permits arbitrary modification of +/// the binary representation of any `Copy` type. Use with care. +unsafe fn slice_to_u8_mut<T: Copy>(slice: &mut [T]) -> &mut [u8] { + use std::mem::size_of; + + let len = size_of::<T>() * slice.len(); + slice::from_raw_parts_mut(slice.as_mut_ptr() as *mut u8, len) +} diff --git a/src/vendor/byteorder/src/lib.rs b/src/vendor/byteorder/src/lib.rs new file mode 100644 index 0000000000..0654e88d0c --- /dev/null +++ b/src/vendor/byteorder/src/lib.rs @@ -0,0 +1,3098 @@ +/*! +This crate provides convenience methods for encoding and decoding numbers +in either big-endian or little-endian order. + +The organization of the crate is pretty simple. A trait, `ByteOrder`, specifies +byte conversion methods for each type of number in Rust (sans numbers that have +a platform dependent size like `usize` and `isize`). Two types, `BigEndian` +and `LittleEndian` implement these methods. Finally, `ReadBytesExt` and +`WriteBytesExt` provide convenience methods available to all types that +implement `Read` and `Write`. + +# Examples + +Read unsigned 16 bit big-endian integers from a `Read` type: + +```rust +use std::io::Cursor; +use byteorder::{BigEndian, ReadBytesExt}; + +let mut rdr = Cursor::new(vec![2, 5, 3, 0]); +// Note that we use type parameters to indicate which kind of byte order +// we want! +assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap()); +assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap()); +``` + +Write unsigned 16 bit little-endian integers to a `Write` type: + +```rust +use byteorder::{LittleEndian, WriteBytesExt}; + +let mut wtr = vec![]; +wtr.write_u16::<LittleEndian>(517).unwrap(); +wtr.write_u16::<LittleEndian>(768).unwrap(); +assert_eq!(wtr, vec![5, 2, 0, 3]); +``` +*/ + +#![deny(missing_docs)] +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(feature = "i128", feature(i128_type))] +#![cfg_attr(all(feature = "i128", test), feature(i128))] +#![doc(html_root_url = "https://docs.rs/byteorder/1.2.1")] + +#[cfg(feature = "std")] +extern crate core; + +use core::fmt::Debug; +use core::hash::Hash; +use core::mem::transmute; +use core::ptr::copy_nonoverlapping; + +#[cfg(feature = "std")] +pub use io::{ReadBytesExt, WriteBytesExt}; + +#[cfg(feature = "std")] +mod io; + +#[inline] +fn extend_sign(val: u64, nbytes: usize) -> i64 { + let shift = (8 - nbytes) * 8; + (val << shift) as i64 >> shift +} + +#[cfg(feature = "i128")] +#[inline] +fn extend_sign128(val: u128, nbytes: usize) -> i128 { + let shift = (16 - nbytes) * 8; + (val << shift) as i128 >> shift +} + +#[inline] +fn unextend_sign(val: i64, nbytes: usize) -> u64 { + let shift = (8 - nbytes) * 8; + (val << shift) as u64 >> shift +} + +#[cfg(feature = "i128")] +#[inline] +fn unextend_sign128(val: i128, nbytes: usize) -> u128 { + let shift = (16 - nbytes) * 8; + (val << shift) as u128 >> shift +} + +#[inline] +fn pack_size(n: u64) -> usize { + if n < 1 << 8 { + 1 + } else if n < 1 << 16 { + 2 + } else if n < 1 << 24 { + 3 + } else if n < 1 << 32 { + 4 + } else if n < 1 << 40 { + 5 + } else if n < 1 << 48 { + 6 + } else if n < 1 << 56 { + 7 + } else { + 8 + } +} + +#[cfg(feature = "i128")] +#[inline] +fn pack_size128(n: u128) -> usize { + if n < 1 << 8 { + 1 + } else if n < 1 << 16 { + 2 + } else if n < 1 << 24 { + 3 + } else if n < 1 << 32 { + 4 + } else if n < 1 << 40 { + 5 + } else if n < 1 << 48 { + 6 + } else if n < 1 << 56 { + 7 + } else if n < 1 << 64 { + 8 + } else if n < 1 << 72 { + 9 + } else if n < 1 << 80 { + 10 + } else if n < 1 << 88 { + 11 + } else if n < 1 << 96 { + 12 + } else if n < 1 << 104 { + 13 + } else if n < 1 << 112 { + 14 + } else if n < 1 << 120 { + 15 + } else { + 16 + } +} + +mod private { + /// Sealed stops crates other than byteorder from implementing any traits + /// that use it. + pub trait Sealed{} + impl Sealed for super::LittleEndian {} + impl Sealed for super::BigEndian {} +} + +/// ByteOrder describes types that can serialize integers as bytes. +/// +/// Note that `Self` does not appear anywhere in this trait's definition! +/// Therefore, in order to use it, you'll need to use syntax like +/// `T::read_u16(&[0, 1])` where `T` implements `ByteOrder`. +/// +/// This crate provides two types that implement `ByteOrder`: `BigEndian` +/// and `LittleEndian`. +/// This trait is sealed and cannot be implemented for callers to avoid +/// breaking backwards compatibility when adding new derived traits. +/// +/// # Examples +/// +/// Write and read `u32` numbers in little endian order: +/// +/// ```rust +/// use byteorder::{ByteOrder, LittleEndian}; +/// +/// let mut buf = [0; 4]; +/// LittleEndian::write_u32(&mut buf, 1_000_000); +/// assert_eq!(1_000_000, LittleEndian::read_u32(&buf)); +/// ``` +/// +/// Write and read `i16` numbers in big endian order: +/// +/// ```rust +/// use byteorder::{ByteOrder, BigEndian}; +/// +/// let mut buf = [0; 2]; +/// BigEndian::write_i16(&mut buf, -50_000); +/// assert_eq!(-50_000, BigEndian::read_i16(&buf)); +/// ``` +pub trait ByteOrder + : Clone + Copy + Debug + Default + Eq + Hash + Ord + PartialEq + PartialOrd + + private::Sealed +{ + /// Reads an unsigned 16 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 2`. + fn read_u16(buf: &[u8]) -> u16; + + /// Reads an unsigned 24 bit integer from `buf`, stored in u32. + /// + /// # Panics + /// + /// Panics when `buf.len() < 3`. + /// + /// # Examples + /// + /// Write and read 24 bit `u32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_u24(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u24(&buf)); + /// ``` + fn read_u24(buf: &[u8]) -> u32 { + Self::read_uint(buf, 3) as u32 + } + + /// Reads an unsigned 32 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 4`. + /// + /// # Examples + /// + /// Write and read `u32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 4]; + /// LittleEndian::write_u32(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u32(&buf)); + /// ``` + fn read_u32(buf: &[u8]) -> u32; + + /// Reads an unsigned 64 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 8`. + /// + /// # Examples + /// + /// Write and read `u64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 8]; + /// LittleEndian::write_u64(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u64(&buf)); + /// ``` + fn read_u64(buf: &[u8]) -> u64; + + /// Reads an unsigned 128 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 16`. + /// + /// # Examples + /// + /// Write and read `u128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 16]; + /// LittleEndian::write_u128(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u128(&buf)); + /// ``` + #[cfg(feature = "i128")] + fn read_u128(buf: &[u8]) -> u128; + + /// Reads an unsigned n-bytes integer from `buf`. + /// + /// # Panics + /// + /// Panics when `nbytes < 1` or `nbytes > 8` or + /// `buf.len() < nbytes` + /// + /// # Examples + /// + /// Write and read an n-byte number in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_uint(&mut buf, 1_000_000, 3); + /// assert_eq!(1_000_000, LittleEndian::read_uint(&buf, 3)); + /// ``` + fn read_uint(buf: &[u8], nbytes: usize) -> u64; + + /// Reads an unsigned n-bytes integer from `buf`. + /// + /// # Panics + /// + /// Panics when `nbytes < 1` or `nbytes > 16` or + /// `buf.len() < nbytes` + /// + /// # Examples + /// + /// Write and read an n-byte number in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_uint128(&mut buf, 1_000_000, 3); + /// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3)); + /// ``` + #[cfg(feature = "i128")] + fn read_uint128(buf: &[u8], nbytes: usize) -> u128; + + /// Writes an unsigned 16 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 2`. + /// + /// # Examples + /// + /// Write and read `u16` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 2]; + /// LittleEndian::write_u16(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u16(&buf)); + /// ``` + fn write_u16(buf: &mut [u8], n: u16); + + /// Writes an unsigned 24 bit integer `n` to `buf`, stored in u32. + /// + /// # Panics + /// + /// Panics when `buf.len() < 3`. + /// + /// # Examples + /// + /// Write and read 24 bit `u32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_u24(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u24(&buf)); + /// ``` + fn write_u24(buf: &mut [u8], n: u32) { + Self::write_uint(buf, n as u64, 3) + } + + /// Writes an unsigned 32 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 4`. + /// + /// # Examples + /// + /// Write and read `u32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 4]; + /// LittleEndian::write_u32(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u32(&buf)); + /// ``` + fn write_u32(buf: &mut [u8], n: u32); + + /// Writes an unsigned 64 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 8`. + /// + /// # Examples + /// + /// Write and read `u64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 8]; + /// LittleEndian::write_u64(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u64(&buf)); + /// ``` + fn write_u64(buf: &mut [u8], n: u64); + + /// Writes an unsigned 128 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 16`. + /// + /// # Examples + /// + /// Write and read `u128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 16]; + /// LittleEndian::write_u128(&mut buf, 1_000_000); + /// assert_eq!(1_000_000, LittleEndian::read_u128(&buf)); + /// ``` + #[cfg(feature = "i128")] + fn write_u128(buf: &mut [u8], n: u128); + + /// Writes an unsigned integer `n` to `buf` using only `nbytes`. + /// + /// # Panics + /// + /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 8`, then + /// this method panics. + /// + /// # Examples + /// + /// Write and read an n-byte number in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_uint(&mut buf, 1_000_000, 3); + /// assert_eq!(1_000_000, LittleEndian::read_uint(&buf, 3)); + /// ``` + fn write_uint(buf: &mut [u8], n: u64, nbytes: usize); + + /// Writes an unsigned integer `n` to `buf` using only `nbytes`. + /// + /// # Panics + /// + /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 16`, then + /// this method panics. + /// + /// # Examples + /// + /// Write and read an n-byte number in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_uint128(&mut buf, 1_000_000, 3); + /// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3)); + /// ``` + #[cfg(feature = "i128")] + fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize); + + /// Reads a signed 16 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 2`. + /// + /// # Examples + /// + /// Write and read `i16` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 2]; + /// LittleEndian::write_i16(&mut buf, -1_000); + /// assert_eq!(-1_000, LittleEndian::read_i16(&buf)); + /// ``` + #[inline] + fn read_i16(buf: &[u8]) -> i16 { + Self::read_u16(buf) as i16 + } + + /// Reads a signed 24 bit integer from `buf`, stored in i32. + /// + /// # Panics + /// + /// Panics when `buf.len() < 3`. + /// + /// # Examples + /// + /// Write and read 24 bit `i32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_i24(&mut buf, -1_000_000); + /// assert_eq!(-1_000_000, LittleEndian::read_i24(&buf)); + /// ``` + #[inline] + fn read_i24(buf: &[u8]) -> i32 { + Self::read_int(buf, 3) as i32 + } + + /// Reads a signed 32 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 4`. + /// + /// # Examples + /// + /// Write and read `i32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 4]; + /// LittleEndian::write_i32(&mut buf, -1_000_000); + /// assert_eq!(-1_000_000, LittleEndian::read_i32(&buf)); + /// ``` + #[inline] + fn read_i32(buf: &[u8]) -> i32 { + Self::read_u32(buf) as i32 + } + + /// Reads a signed 64 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 8`. + /// + /// # Examples + /// + /// Write and read `i64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 8]; + /// LittleEndian::write_i64(&mut buf, -1_000_000_000); + /// assert_eq!(-1_000_000_000, LittleEndian::read_i64(&buf)); + /// ``` + #[inline] + fn read_i64(buf: &[u8]) -> i64 { + Self::read_u64(buf) as i64 + } + + /// Reads a signed 128 bit integer from `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 16`. + /// + /// # Examples + /// + /// Write and read `i128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 16]; + /// LittleEndian::write_i128(&mut buf, -1_000_000_000); + /// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf)); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn read_i128(buf: &[u8]) -> i128 { + Self::read_u128(buf) as i128 + } + + /// Reads a signed n-bytes integer from `buf`. + /// + /// # Panics + /// + /// Panics when `nbytes < 1` or `nbytes > 8` or + /// `buf.len() < nbytes` + /// + /// # Examples + /// + /// Write and read n-length signed numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_int(&mut buf, -1_000, 3); + /// assert_eq!(-1_000, LittleEndian::read_int(&buf, 3)); + /// ``` + #[inline] + fn read_int(buf: &[u8], nbytes: usize) -> i64 { + extend_sign(Self::read_uint(buf, nbytes), nbytes) + } + + /// Reads a signed n-bytes integer from `buf`. + /// + /// # Panics + /// + /// Panics when `nbytes < 1` or `nbytes > 16` or + /// `buf.len() < nbytes` + /// + /// # Examples + /// + /// Write and read n-length signed numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_int128(&mut buf, -1_000, 3); + /// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3)); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn read_int128(buf: &[u8], nbytes: usize) -> i128 { + extend_sign128(Self::read_uint128(buf, nbytes), nbytes) + } + + /// Reads a IEEE754 single-precision (4 bytes) floating point number. + /// + /// # Panics + /// + /// Panics when `buf.len() < 4`. + /// + /// # Examples + /// + /// Write and read `f32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let e = 2.71828; + /// let mut buf = [0; 4]; + /// LittleEndian::write_f32(&mut buf, e); + /// assert_eq!(e, LittleEndian::read_f32(&buf)); + /// ``` + #[inline] + fn read_f32(buf: &[u8]) -> f32 { + unsafe { transmute(Self::read_u32(buf)) } + } + + /// Reads a IEEE754 double-precision (8 bytes) floating point number. + /// + /// # Panics + /// + /// Panics when `buf.len() < 8`. + /// + /// # Examples + /// + /// Write and read `f64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let phi = 1.6180339887; + /// let mut buf = [0; 8]; + /// LittleEndian::write_f64(&mut buf, phi); + /// assert_eq!(phi, LittleEndian::read_f64(&buf)); + /// ``` + #[inline] + fn read_f64(buf: &[u8]) -> f64 { + unsafe { transmute(Self::read_u64(buf)) } + } + + /// Writes a signed 16 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 2`. + /// + /// # Examples + /// + /// Write and read `i16` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 2]; + /// LittleEndian::write_i16(&mut buf, -1_000); + /// assert_eq!(-1_000, LittleEndian::read_i16(&buf)); + /// ``` + #[inline] + fn write_i16(buf: &mut [u8], n: i16) { + Self::write_u16(buf, n as u16) + } + + /// Writes a signed 24 bit integer `n` to `buf`, stored in i32. + /// + /// # Panics + /// + /// Panics when `buf.len() < 3`. + /// + /// # Examples + /// + /// Write and read 24 bit `i32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_i24(&mut buf, -1_000_000); + /// assert_eq!(-1_000_000, LittleEndian::read_i24(&buf)); + /// ``` + #[inline] + fn write_i24(buf: &mut [u8], n: i32) { + Self::write_int(buf, n as i64, 3) + } + + /// Writes a signed 32 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 4`. + /// + /// # Examples + /// + /// Write and read `i32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 4]; + /// LittleEndian::write_i32(&mut buf, -1_000_000); + /// assert_eq!(-1_000_000, LittleEndian::read_i32(&buf)); + /// ``` + #[inline] + fn write_i32(buf: &mut [u8], n: i32) { + Self::write_u32(buf, n as u32) + } + + /// Writes a signed 64 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 8`. + /// + /// # Examples + /// + /// Write and read `i64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 8]; + /// LittleEndian::write_i64(&mut buf, -1_000_000_000); + /// assert_eq!(-1_000_000_000, LittleEndian::read_i64(&buf)); + /// ``` + #[inline] + fn write_i64(buf: &mut [u8], n: i64) { + Self::write_u64(buf, n as u64) + } + + /// Writes a signed 128 bit integer `n` to `buf`. + /// + /// # Panics + /// + /// Panics when `buf.len() < 16`. + /// + /// # Examples + /// + /// Write and read n-byte `i128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 16]; + /// LittleEndian::write_i128(&mut buf, -1_000_000_000); + /// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf)); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn write_i128(buf: &mut [u8], n: i128) { + Self::write_u128(buf, n as u128) + } + + /// Writes a signed integer `n` to `buf` using only `nbytes`. + /// + /// # Panics + /// + /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 8`, then + /// this method panics. + /// + /// # Examples + /// + /// Write and read an n-byte number in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_int(&mut buf, -1_000, 3); + /// assert_eq!(-1_000, LittleEndian::read_int(&buf, 3)); + /// ``` + #[inline] + fn write_int(buf: &mut [u8], n: i64, nbytes: usize) { + Self::write_uint(buf, unextend_sign(n, nbytes), nbytes) + } + + /// Writes a signed integer `n` to `buf` using only `nbytes`. + /// + /// # Panics + /// + /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 16`, then + /// this method panics. + /// + /// # Examples + /// + /// Write and read n-length signed numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut buf = [0; 3]; + /// LittleEndian::write_int128(&mut buf, -1_000, 3); + /// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3)); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn write_int128(buf: &mut [u8], n: i128, nbytes: usize) { + Self::write_uint128(buf, unextend_sign128(n, nbytes), nbytes) + } + + /// Writes a IEEE754 single-precision (4 bytes) floating point number. + /// + /// # Panics + /// + /// Panics when `buf.len() < 4`. + /// + /// # Examples + /// + /// Write and read `f32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let e = 2.71828; + /// let mut buf = [0; 4]; + /// LittleEndian::write_f32(&mut buf, e); + /// assert_eq!(e, LittleEndian::read_f32(&buf)); + /// ``` + #[inline] + fn write_f32(buf: &mut [u8], n: f32) { + Self::write_u32(buf, unsafe { transmute(n) }) + } + + /// Writes a IEEE754 double-precision (8 bytes) floating point number. + /// + /// # Panics + /// + /// Panics when `buf.len() < 8`. + /// + /// # Examples + /// + /// Write and read `f64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let phi = 1.6180339887; + /// let mut buf = [0; 8]; + /// LittleEndian::write_f64(&mut buf, phi); + /// assert_eq!(phi, LittleEndian::read_f64(&buf)); + /// ``` + #[inline] + fn write_f64(buf: &mut [u8], n: f64) { + Self::write_u64(buf, unsafe { transmute(n) }) + } + + /// Reads unsigned 16 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 2*dst.len()`. + /// + /// # Examples + /// + /// Write and read `u16` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 8]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u16_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u16_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn read_u16_into(src: &[u8], dst: &mut [u16]); + + /// Reads unsigned 32 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 4*dst.len()`. + /// + /// # Examples + /// + /// Write and read `u32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 16]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u32_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u32_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn read_u32_into(src: &[u8], dst: &mut [u32]); + + /// Reads unsigned 64 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 8*dst.len()`. + /// + /// # Examples + /// + /// Write and read `u64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 32]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u64_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u64_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn read_u64_into(src: &[u8], dst: &mut [u64]); + + /// Reads unsigned 128 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 16*dst.len()`. + /// + /// # Examples + /// + /// Write and read `u128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 64]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u128_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u128_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[cfg(feature = "i128")] + fn read_u128_into(src: &[u8], dst: &mut [u128]); + + /// Reads signed 16 bit integers from `src` to `dst`. + /// + /// # Panics + /// + /// Panics when `buf.len() != 2*dst.len()`. + /// + /// # Examples + /// + /// Write and read `i16` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 8]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i16_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i16_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[inline] + fn read_i16_into(src: &[u8], dst: &mut [i16]) { + Self::read_u16_into(src, unsafe { transmute(dst) }); + } + + /// Reads signed 32 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 4*dst.len()`. + /// + /// # Examples + /// + /// Write and read `i32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 16]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i32_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i32_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[inline] + fn read_i32_into(src: &[u8], dst: &mut [i32]) { + Self::read_u32_into(src, unsafe { transmute(dst) }); + } + + /// Reads signed 64 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 8*dst.len()`. + /// + /// # Examples + /// + /// Write and read `i64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 32]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i64_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i64_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[inline] + fn read_i64_into(src: &[u8], dst: &mut [i64]) { + Self::read_u64_into(src, unsafe { transmute(dst) }); + } + + /// Reads signed 128 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 16*dst.len()`. + /// + /// # Examples + /// + /// Write and read `i128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 64]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i128_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i128_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn read_i128_into(src: &[u8], dst: &mut [i128]) { + Self::read_u128_into(src, unsafe { transmute(dst) }); + } + + /// Reads IEEE754 single-precision (4 bytes) floating point numbers from + /// `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 4*dst.len()`. + /// + /// # Examples + /// + /// Write and read `f32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 16]; + /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91]; + /// LittleEndian::write_f32_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0.0; 4]; + /// LittleEndian::read_f32_into_unchecked(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[inline] + fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32]) { + Self::read_u32_into(src, unsafe { transmute(dst) }); + } + + /// Reads IEEE754 single-precision (4 bytes) floating point numbers from + /// `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 8*dst.len()`. + /// + /// # Examples + /// + /// Write and read `f64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 32]; + /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91]; + /// LittleEndian::write_f64_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0.0; 4]; + /// LittleEndian::read_f64_into_unchecked(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[inline] + fn read_f64_into_unchecked(src: &[u8], dst: &mut [f64]) { + Self::read_u64_into(src, unsafe { transmute(dst) }); + } + + /// Writes unsigned 16 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `dst.len() != 2*src.len()`. + /// + /// # Examples + /// + /// Write and read `u16` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 8]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u16_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u16_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_u16_into(src: &[u16], dst: &mut [u8]); + + /// Writes unsigned 32 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `dst.len() != 4*src.len()`. + /// + /// # Examples + /// + /// Write and read `u32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 16]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u32_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u32_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_u32_into(src: &[u32], dst: &mut [u8]); + + /// Writes unsigned 64 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `dst.len() != 8*src.len()`. + /// + /// # Examples + /// + /// Write and read `u64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 32]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u64_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u64_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_u64_into(src: &[u64], dst: &mut [u8]); + + /// Writes unsigned 128 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `dst.len() != 16*src.len()`. + /// + /// # Examples + /// + /// Write and read `u128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 64]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_u128_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_u128_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[cfg(feature = "i128")] + fn write_u128_into(src: &[u128], dst: &mut [u8]); + + /// Writes signed 16 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `buf.len() != 2*src.len()`. + /// + /// # Examples + /// + /// Write and read `i16` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 8]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i16_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i16_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_i16_into(src: &[i16], dst: &mut [u8]) { + Self::write_u16_into(unsafe { transmute(src) }, dst); + } + + /// Writes signed 32 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `dst.len() != 4*src.len()`. + /// + /// # Examples + /// + /// Write and read `i32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 16]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i32_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i32_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_i32_into(src: &[i32], dst: &mut [u8]) { + Self::write_u32_into(unsafe { transmute(src) }, dst); + } + + /// Writes signed 64 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `dst.len() != 8*src.len()`. + /// + /// # Examples + /// + /// Write and read `i64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 32]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i64_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i64_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_i64_into(src: &[i64], dst: &mut [u8]) { + Self::write_u64_into(unsafe { transmute(src) }, dst); + } + + /// Writes signed 128 bit integers from `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `dst.len() != 16*src.len()`. + /// + /// # Examples + /// + /// Write and read `i128` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 64]; + /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// LittleEndian::write_i128_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0; 4]; + /// LittleEndian::read_i128_into(&bytes, &mut numbers_got); + /// assert_eq!(numbers_given, numbers_got); + /// ``` + #[cfg(feature = "i128")] + fn write_i128_into(src: &[i128], dst: &mut [u8]) { + Self::write_u128_into(unsafe { transmute(src) }, dst); + } + + /// Writes IEEE754 single-precision (4 bytes) floating point numbers from + /// `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 4*dst.len()`. + /// + /// # Examples + /// + /// Write and read `f32` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 16]; + /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91]; + /// LittleEndian::write_f32_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0.0; 4]; + /// unsafe { + /// LittleEndian::read_f32_into_unchecked(&bytes, &mut numbers_got); + /// } + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_f32_into(src: &[f32], dst: &mut [u8]) { + Self::write_u32_into(unsafe { transmute(src) }, dst); + } + + /// Writes IEEE754 double-precision (8 bytes) floating point numbers from + /// `src` into `dst`. + /// + /// # Panics + /// + /// Panics when `src.len() != 8*dst.len()`. + /// + /// # Examples + /// + /// Write and read `f64` numbers in little endian order: + /// + /// ```rust + /// use byteorder::{ByteOrder, LittleEndian}; + /// + /// let mut bytes = [0; 32]; + /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91]; + /// LittleEndian::write_f64_into(&numbers_given, &mut bytes); + /// + /// let mut numbers_got = [0.0; 4]; + /// unsafe { + /// LittleEndian::read_f64_into_unchecked(&bytes, &mut numbers_got); + /// } + /// assert_eq!(numbers_given, numbers_got); + /// ``` + fn write_f64_into(src: &[f64], dst: &mut [u8]) { + Self::write_u64_into(unsafe { transmute(src) }, dst); + } + + /// Converts the given slice of unsigned 16 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_u16(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5u16.swap_bytes(), 65000u16.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + fn from_slice_u16(numbers: &mut [u16]); + + /// Converts the given slice of unsigned 32 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_u32(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5u32.swap_bytes(), 65000u32.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + fn from_slice_u32(numbers: &mut [u32]); + + /// Converts the given slice of unsigned 64 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_u64(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5u64.swap_bytes(), 65000u64.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + fn from_slice_u64(numbers: &mut [u64]); + + /// Converts the given slice of unsigned 128 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// #![feature(i128_type)] + /// + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_u128(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5u128.swap_bytes(), 65000u128.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + #[cfg(feature = "i128")] + fn from_slice_u128(numbers: &mut [u128]); + + /// Converts the given slice of signed 16 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_i16(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5i16.swap_bytes(), 65000i16.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + #[inline] + fn from_slice_i16(numbers: &mut [i16]) { + Self::from_slice_u16(unsafe { transmute(numbers) }); + } + + /// Converts the given slice of signed 32 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_i32(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5i32.swap_bytes(), 65000i32.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + #[inline] + fn from_slice_i32(numbers: &mut [i32]) { + Self::from_slice_u32(unsafe { transmute(numbers) }); + } + + /// Converts the given slice of signed 64 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_i64(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5i64.swap_bytes(), 65000i64.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + #[inline] + fn from_slice_i64(numbers: &mut [i64]) { + Self::from_slice_u64(unsafe { transmute(numbers) }); + } + + /// Converts the given slice of signed 128 bit integers to a particular + /// endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + /// + /// # Examples + /// + /// Convert the host platform's endianness to big-endian: + /// + /// ```rust + /// #![feature(i128_type)] + /// + /// use byteorder::{ByteOrder, BigEndian}; + /// + /// let mut numbers = [5, 65000]; + /// BigEndian::from_slice_i128(&mut numbers); + /// if cfg!(target_endian = "little") { + /// assert_eq!(numbers, [5i128.swap_bytes(), 65000i128.swap_bytes()]); + /// } else { + /// assert_eq!(numbers, [5, 65000]); + /// } + /// ``` + #[cfg(feature = "i128")] + #[inline] + fn from_slice_i128(numbers: &mut [i128]) { + Self::from_slice_u128(unsafe { transmute(numbers) }); + } + + /// Converts the given slice of IEEE754 single-precision (4 bytes) floating + /// point numbers to a particular endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + fn from_slice_f32(numbers: &mut [f32]); + + /// Converts the given slice of IEEE754 double-precision (8 bytes) floating + /// point numbers to a particular endianness. + /// + /// If the endianness matches the endianness of the host platform, then + /// this is a no-op. + fn from_slice_f64(numbers: &mut [f64]); +} + +/// Defines big-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +/// +/// # Examples +/// +/// Write and read `u32` numbers in big endian order: +/// +/// ```rust +/// use byteorder::{ByteOrder, BigEndian}; +/// +/// let mut buf = [0; 4]; +/// BigEndian::write_u32(&mut buf, 1_000_000); +/// assert_eq!(1_000_000, BigEndian::read_u32(&buf)); +/// ``` +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub enum BigEndian {} + +impl Default for BigEndian { + fn default() -> BigEndian { + panic!("BigEndian default") + } +} + +/// A type alias for `BigEndian`. +pub type BE = BigEndian; + +/// Defines little-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +/// +/// # Examples +/// +/// Write and read `u32` numbers in little endian order: +/// +/// ```rust +/// use byteorder::{ByteOrder, LittleEndian}; +/// +/// let mut buf = [0; 4]; +/// LittleEndian::write_u32(&mut buf, 1_000_000); +/// assert_eq!(1_000_000, LittleEndian::read_u32(&buf)); +/// ``` +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub enum LittleEndian {} + +impl Default for LittleEndian { + fn default() -> LittleEndian { + panic!("LittleEndian default") + } +} + +/// A type alias for `LittleEndian`. +pub type LE = LittleEndian; + +/// Defines network byte order serialization. +/// +/// Network byte order is defined by [RFC 1700][1] to be big-endian, and is +/// referred to in several protocol specifications. This type is an alias of +/// BigEndian. +/// +/// [1]: https://tools.ietf.org/html/rfc1700 +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +/// +/// # Examples +/// +/// Write and read `i16` numbers in big endian order: +/// +/// ```rust +/// use byteorder::{ByteOrder, NetworkEndian, BigEndian}; +/// +/// let mut buf = [0; 2]; +/// BigEndian::write_i16(&mut buf, -50_000); +/// assert_eq!(-50_000, NetworkEndian::read_i16(&buf)); +/// ``` +pub type NetworkEndian = BigEndian; + +/// Defines system native-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +#[cfg(target_endian = "little")] +pub type NativeEndian = LittleEndian; + +/// Defines system native-endian serialization. +/// +/// Note that this type has no value constructor. It is used purely at the +/// type level. +#[cfg(target_endian = "big")] +pub type NativeEndian = BigEndian; + +macro_rules! read_num_bytes { + ($ty:ty, $size:expr, $src:expr, $which:ident) => ({ + assert!($size == ::core::mem::size_of::<$ty>()); + assert!($size <= $src.len()); + let mut data: $ty = 0; + unsafe { + copy_nonoverlapping( + $src.as_ptr(), + &mut data as *mut $ty as *mut u8, + $size); + } + data.$which() + }); +} + +macro_rules! write_num_bytes { + ($ty:ty, $size:expr, $n:expr, $dst:expr, $which:ident) => ({ + assert!($size <= $dst.len()); + unsafe { + // N.B. https://github.com/rust-lang/rust/issues/22776 + let bytes = transmute::<_, [u8; $size]>($n.$which()); + copy_nonoverlapping((&bytes).as_ptr(), $dst.as_mut_ptr(), $size); + } + }); +} + +macro_rules! read_slice { + ($src:expr, $dst:expr, $size:expr, $which:ident) => {{ + assert_eq!($src.len(), $size * $dst.len()); + + unsafe { + copy_nonoverlapping( + $src.as_ptr(), + $dst.as_mut_ptr() as *mut u8, + $src.len()); + } + for v in $dst.iter_mut() { + *v = v.$which(); + } + }}; +} + +macro_rules! write_slice_native { + ($src:expr, $dst:expr, $ty:ty, $size:expr) => {{ + assert!($size == ::core::mem::size_of::<$ty>()); + assert_eq!($size * $src.len(), $dst.len()); + + unsafe { + copy_nonoverlapping( + $src.as_ptr() as *const u8, + $dst.as_mut_ptr(), + $dst.len()); + } + }}; +} + +macro_rules! write_slice { + ($src:expr, $dst:expr, $ty:ty, $size:expr, $write:expr) => ({ + assert!($size == ::core::mem::size_of::<$ty>()); + assert_eq!($size * $src.len(), $dst.len()); + + for (&n, chunk) in $src.iter().zip($dst.chunks_mut($size)) { + $write(chunk, n); + } + }); +} + +impl ByteOrder for BigEndian { + #[inline] + fn read_u16(buf: &[u8]) -> u16 { + read_num_bytes!(u16, 2, buf, to_be) + } + + #[inline] + fn read_u32(buf: &[u8]) -> u32 { + read_num_bytes!(u32, 4, buf, to_be) + } + + #[inline] + fn read_u64(buf: &[u8]) -> u64 { + read_num_bytes!(u64, 8, buf, to_be) + } + + #[cfg(feature = "i128")] + #[inline] + fn read_u128(buf: &[u8]) -> u128 { + read_num_bytes!(u128, 16, buf, to_be) + } + + #[inline] + fn read_uint(buf: &[u8], nbytes: usize) -> u64 { + assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len()); + let mut out = [0u8; 8]; + let ptr_out = out.as_mut_ptr(); + unsafe { + copy_nonoverlapping( + buf.as_ptr(), ptr_out.offset((8 - nbytes) as isize), nbytes); + (*(ptr_out as *const u64)).to_be() + } + } + + #[cfg(feature = "i128")] + #[inline] + fn read_uint128(buf: &[u8], nbytes: usize) -> u128 { + assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len()); + let mut out = [0u8; 16]; + let ptr_out = out.as_mut_ptr(); + unsafe { + copy_nonoverlapping( + buf.as_ptr(), ptr_out.offset((16 - nbytes) as isize), nbytes); + (*(ptr_out as *const u128)).to_be() + } + } + + #[inline] + fn write_u16(buf: &mut [u8], n: u16) { + write_num_bytes!(u16, 2, n, buf, to_be); + } + + #[inline] + fn write_u32(buf: &mut [u8], n: u32) { + write_num_bytes!(u32, 4, n, buf, to_be); + } + + #[inline] + fn write_u64(buf: &mut [u8], n: u64) { + write_num_bytes!(u64, 8, n, buf, to_be); + } + + #[cfg(feature = "i128")] + #[inline] + fn write_u128(buf: &mut [u8], n: u128) { + write_num_bytes!(u128, 16, n, buf, to_be); + } + + #[inline] + fn write_uint(buf: &mut [u8], n: u64, nbytes: usize) { + assert!(pack_size(n) <= nbytes && nbytes <= 8); + assert!(nbytes <= buf.len()); + unsafe { + let bytes: [u8; 8] = transmute(n.to_be()); + copy_nonoverlapping( + bytes.as_ptr().offset((8 - nbytes) as isize), + buf.as_mut_ptr(), + nbytes); + } + } + + #[cfg(feature = "i128")] + #[inline] + fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) { + assert!(pack_size128(n) <= nbytes && nbytes <= 16); + assert!(nbytes <= buf.len()); + unsafe { + let bytes: [u8; 16] = transmute(n.to_be()); + copy_nonoverlapping( + bytes.as_ptr().offset((16 - nbytes) as isize), + buf.as_mut_ptr(), + nbytes); + } + } + + #[inline] + fn read_u16_into(src: &[u8], dst: &mut [u16]) { + read_slice!(src, dst, 2, to_be); + } + + #[inline] + fn read_u32_into(src: &[u8], dst: &mut [u32]) { + read_slice!(src, dst, 4, to_be); + } + + #[inline] + fn read_u64_into(src: &[u8], dst: &mut [u64]) { + read_slice!(src, dst, 8, to_be); + } + + #[cfg(feature = "i128")] + #[inline] + fn read_u128_into(src: &[u8], dst: &mut [u128]) { + read_slice!(src, dst, 16, to_be); + } + + #[inline] + fn write_u16_into(src: &[u16], dst: &mut [u8]) { + if cfg!(target_endian = "big") { + write_slice_native!(src, dst, u16, 2); + } else { + write_slice!(src, dst, u16, 2, Self::write_u16); + } + } + + #[inline] + fn write_u32_into(src: &[u32], dst: &mut [u8]) { + if cfg!(target_endian = "big") { + write_slice_native!(src, dst, u32, 4); + } else { + write_slice!(src, dst, u32, 4, Self::write_u32); + } + } + + #[inline] + fn write_u64_into(src: &[u64], dst: &mut [u8]) { + if cfg!(target_endian = "big") { + write_slice_native!(src, dst, u64, 8); + } else { + write_slice!(src, dst, u64, 8, Self::write_u64); + } + } + + #[cfg(feature = "i128")] + #[inline] + fn write_u128_into(src: &[u128], dst: &mut [u8]) { + if cfg!(target_endian = "big") { + write_slice_native!(src, dst, u128, 16); + } else { + write_slice!(src, dst, u128, 16, Self::write_u128); + } + } + + #[inline] + fn from_slice_u16(numbers: &mut [u16]) { + if cfg!(target_endian = "little") { + for n in numbers { + *n = n.to_be(); + } + } + } + + #[inline] + fn from_slice_u32(numbers: &mut [u32]) { + if cfg!(target_endian = "little") { + for n in numbers { + *n = n.to_be(); + } + } + } + + #[inline] + fn from_slice_u64(numbers: &mut [u64]) { + if cfg!(target_endian = "little") { + for n in numbers { + *n = n.to_be(); + } + } + } + + #[cfg(feature = "i128")] + #[inline] + fn from_slice_u128(numbers: &mut [u128]) { + if cfg!(target_endian = "little") { + for n in numbers { + *n = n.to_be(); + } + } + } + + #[inline] + fn from_slice_f32(numbers: &mut [f32]) { + if cfg!(target_endian = "little") { + for n in numbers { + let int: u32 = unsafe { transmute(*n) }; + *n = unsafe { transmute(int.to_be()) }; + } + } + } + + #[inline] + fn from_slice_f64(numbers: &mut [f64]) { + if cfg!(target_endian = "little") { + for n in numbers { + let int: u64 = unsafe { transmute(*n) }; + *n = unsafe { transmute(int.to_be()) }; + } + } + } +} + +impl ByteOrder for LittleEndian { + #[inline] + fn read_u16(buf: &[u8]) -> u16 { + read_num_bytes!(u16, 2, buf, to_le) + } + + #[inline] + fn read_u32(buf: &[u8]) -> u32 { + read_num_bytes!(u32, 4, buf, to_le) + } + + #[inline] + fn read_u64(buf: &[u8]) -> u64 { + read_num_bytes!(u64, 8, buf, to_le) + } + + #[cfg(feature = "i128")] + #[inline] + fn read_u128(buf: &[u8]) -> u128 { + read_num_bytes!(u128, 16, buf, to_le) + } + + #[inline] + fn read_uint(buf: &[u8], nbytes: usize) -> u64 { + assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len()); + let mut out = [0u8; 8]; + let ptr_out = out.as_mut_ptr(); + unsafe { + copy_nonoverlapping(buf.as_ptr(), ptr_out, nbytes); + (*(ptr_out as *const u64)).to_le() + } + } + + #[cfg(feature = "i128")] + #[inline] + fn read_uint128(buf: &[u8], nbytes: usize) -> u128 { + assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len()); + let mut out = [0u8; 16]; + let ptr_out = out.as_mut_ptr(); + unsafe { + copy_nonoverlapping(buf.as_ptr(), ptr_out, nbytes); + (*(ptr_out as *const u128)).to_le() + } + } + + #[inline] + fn write_u16(buf: &mut [u8], n: u16) { + write_num_bytes!(u16, 2, n, buf, to_le); + } + + #[inline] + fn write_u32(buf: &mut [u8], n: u32) { + write_num_bytes!(u32, 4, n, buf, to_le); + } + + #[inline] + fn write_u64(buf: &mut [u8], n: u64) { + write_num_bytes!(u64, 8, n, buf, to_le); + } + + #[cfg(feature = "i128")] + #[inline] + fn write_u128(buf: &mut [u8], n: u128) { + write_num_bytes!(u128, 16, n, buf, to_le); + } + + #[inline] + fn write_uint(buf: &mut [u8], n: u64, nbytes: usize) { + assert!(pack_size(n as u64) <= nbytes && nbytes <= 8); + assert!(nbytes <= buf.len()); + unsafe { + let bytes: [u8; 8] = transmute(n.to_le()); + copy_nonoverlapping(bytes.as_ptr(), buf.as_mut_ptr(), nbytes); + } + } + + #[cfg(feature = "i128")] + #[inline] + fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) { + assert!(pack_size128(n as u128) <= nbytes && nbytes <= 16); + assert!(nbytes <= buf.len()); + unsafe { + let bytes: [u8; 16] = transmute(n.to_le()); + copy_nonoverlapping(bytes.as_ptr(), buf.as_mut_ptr(), nbytes); + } + } + + #[inline] + fn read_u16_into(src: &[u8], dst: &mut [u16]) { + read_slice!(src, dst, 2, to_le); + } + + #[inline] + fn read_u32_into(src: &[u8], dst: &mut [u32]) { + read_slice!(src, dst, 4, to_le); + } + + #[inline] + fn read_u64_into(src: &[u8], dst: &mut [u64]) { + read_slice!(src, dst, 8, to_le); + } + + #[cfg(feature = "i128")] + #[inline] + fn read_u128_into(src: &[u8], dst: &mut [u128]) { + read_slice!(src, dst, 16, to_le); + } + + #[inline] + fn write_u16_into(src: &[u16], dst: &mut [u8]) { + if cfg!(target_endian = "little") { + write_slice_native!(src, dst, u16, 2); + } else { + write_slice!(src, dst, u16, 2, Self::write_u16); + } + } + + #[inline] + fn write_u32_into(src: &[u32], dst: &mut [u8]) { + if cfg!(target_endian = "little") { + write_slice_native!(src, dst, u32, 4); + } else { + write_slice!(src, dst, u32, 4, Self::write_u32); + } + } + + #[inline] + fn write_u64_into(src: &[u64], dst: &mut [u8]) { + if cfg!(target_endian = "little") { + write_slice_native!(src, dst, u64, 8); + } else { + write_slice!(src, dst, u64, 8, Self::write_u64); + } + } + + #[cfg(feature = "i128")] + #[inline] + fn write_u128_into(src: &[u128], dst: &mut [u8]) { + if cfg!(target_endian = "little") { + write_slice_native!(src, dst, u128, 16); + } else { + write_slice!(src, dst, u128, 16, Self::write_u128); + } + } + + #[inline] + fn from_slice_u16(numbers: &mut [u16]) { + if cfg!(target_endian = "big") { + for n in numbers { + *n = n.to_le(); + } + } + } + + #[inline] + fn from_slice_u32(numbers: &mut [u32]) { + if cfg!(target_endian = "big") { + for n in numbers { + *n = n.to_le(); + } + } + } + + #[inline] + fn from_slice_u64(numbers: &mut [u64]) { + if cfg!(target_endian = "big") { + for n in numbers { + *n = n.to_le(); + } + } + } + + #[cfg(feature = "i128")] + #[inline] + fn from_slice_u128(numbers: &mut [u128]) { + if cfg!(target_endian = "big") { + for n in numbers { + *n = n.to_le(); + } + } + } + + #[inline] + fn from_slice_f32(numbers: &mut [f32]) { + if cfg!(target_endian = "big") { + for n in numbers { + let int: u32 = unsafe { transmute(*n) }; + *n = unsafe { transmute(int.to_le()) }; + } + } + } + + #[inline] + fn from_slice_f64(numbers: &mut [f64]) { + if cfg!(target_endian = "big") { + for n in numbers { + let int: u64 = unsafe { transmute(*n) }; + *n = unsafe { transmute(int.to_le()) }; + } + } + } +} + +#[cfg(test)] +mod test { + extern crate quickcheck; + extern crate rand; + + use self::quickcheck::{QuickCheck, StdGen, Testable}; + use self::rand::thread_rng; + #[cfg(feature = "i128")] use self::quickcheck::{Arbitrary, Gen}; + + pub const U24_MAX: u32 = 16_777_215; + pub const I24_MAX: i32 = 8_388_607; + + pub const U64_MAX: u64 = ::core::u64::MAX; + pub const I64_MAX: u64 = ::core::i64::MAX as u64; + + macro_rules! calc_max { + ($max:expr, $bytes:expr) => { calc_max!($max, $bytes, 8) }; + ($max:expr, $bytes:expr, $maxbytes:expr) => { + ($max - 1) >> (8 * ($maxbytes - $bytes)) + }; + } + + #[derive(Clone, Debug)] + pub struct Wi128<T>(pub T); + + #[cfg(feature = "i128")] + impl<T: Clone> Wi128<T> { + pub fn clone(&self) -> T { + self.0.clone() + } + } + + impl<T: PartialEq> PartialEq<T> for Wi128<T> { + fn eq(&self, other: &T) -> bool { + self.0.eq(other) + } + } + + #[cfg(feature = "i128")] + impl Arbitrary for Wi128<u128> { + fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<u128> { + let max = calc_max!(::core::u128::MAX, gen.size(), 16); + let output = + (gen.gen::<u64>() as u128) | + ((gen.gen::<u64>() as u128) << 64); + Wi128(output & (max - 1)) + } + } + + #[cfg(feature = "i128")] + impl Arbitrary for Wi128<i128> { + fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<i128> { + let max = calc_max!(::core::i128::MAX, gen.size(), 16); + let output = + (gen.gen::<i64>() as i128) | + ((gen.gen::<i64>() as i128) << 64); + Wi128(output & (max - 1)) + } + } + + pub fn qc_sized<A: Testable>(f: A, size: u64) { + QuickCheck::new() + .gen(StdGen::new(thread_rng(), size as usize)) + .tests(1_00) + .max_tests(10_000) + .quickcheck(f); + } + + macro_rules! qc_byte_order { + ($name:ident, $ty_int:ty, $max:expr, + $bytes:expr, $read:ident, $write:ident) => ( + mod $name { + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + #[allow(unused_imports)] use super::{ qc_sized, Wi128 }; + + #[test] + fn big_endian() { + fn prop(n: $ty_int) -> bool { + let mut buf = [0; 16]; + BigEndian::$write(&mut buf, n.clone(), $bytes); + n == BigEndian::$read(&mut buf[..$bytes], $bytes) + } + qc_sized(prop as fn($ty_int) -> bool, $max); + } + + #[test] + fn little_endian() { + fn prop(n: $ty_int) -> bool { + let mut buf = [0; 16]; + LittleEndian::$write(&mut buf, n.clone(), $bytes); + n == LittleEndian::$read(&mut buf[..$bytes], $bytes) + } + qc_sized(prop as fn($ty_int) -> bool, $max); + } + + #[test] + fn native_endian() { + fn prop(n: $ty_int) -> bool { + let mut buf = [0; 16]; + NativeEndian::$write(&mut buf, n.clone(), $bytes); + n == NativeEndian::$read(&mut buf[..$bytes], $bytes) + } + qc_sized(prop as fn($ty_int) -> bool, $max); + } + } + ); + ($name:ident, $ty_int:ty, $max:expr, + $read:ident, $write:ident) => ( + mod $name { + use core::mem::size_of; + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + #[allow(unused_imports)] use super::{ qc_sized, Wi128 }; + + #[test] + fn big_endian() { + fn prop(n: $ty_int) -> bool { + let bytes = size_of::<$ty_int>(); + let mut buf = [0; 16]; + BigEndian::$write(&mut buf[16 - bytes..], n.clone()); + n == BigEndian::$read(&mut buf[16 - bytes..]) + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn little_endian() { + fn prop(n: $ty_int) -> bool { + let bytes = size_of::<$ty_int>(); + let mut buf = [0; 16]; + LittleEndian::$write(&mut buf[..bytes], n.clone()); + n == LittleEndian::$read(&mut buf[..bytes]) + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn native_endian() { + fn prop(n: $ty_int) -> bool { + let bytes = size_of::<$ty_int>(); + let mut buf = [0; 16]; + NativeEndian::$write(&mut buf[..bytes], n.clone()); + n == NativeEndian::$read(&mut buf[..bytes]) + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + } + ); + } + + qc_byte_order!(prop_u16, u16, ::core::u16::MAX as u64, read_u16, write_u16); + qc_byte_order!(prop_i16, i16, ::core::i16::MAX as u64, read_i16, write_i16); + qc_byte_order!(prop_u24, u32, ::test::U24_MAX as u64, read_u24, write_u24); + qc_byte_order!(prop_i24, i32, ::test::I24_MAX as u64, read_i24, write_i24); + qc_byte_order!(prop_u32, u32, ::core::u32::MAX as u64, read_u32, write_u32); + qc_byte_order!(prop_i32, i32, ::core::i32::MAX as u64, read_i32, write_i32); + qc_byte_order!(prop_u64, u64, ::core::u64::MAX as u64, read_u64, write_u64); + qc_byte_order!(prop_i64, i64, ::core::i64::MAX as u64, read_i64, write_i64); + qc_byte_order!(prop_f32, f32, ::core::u64::MAX as u64, read_f32, write_f32); + qc_byte_order!(prop_f64, f64, ::core::i64::MAX as u64, read_f64, write_f64); + + #[cfg(feature = "i128")] + qc_byte_order!(prop_u128, Wi128<u128>, 16 + 1, read_u128, write_u128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_i128, Wi128<i128>, 16 + 1, read_i128, write_i128); + + qc_byte_order!(prop_uint_1, + u64, calc_max!(super::U64_MAX, 1), 1, read_uint, write_uint); + qc_byte_order!(prop_uint_2, + u64, calc_max!(super::U64_MAX, 2), 2, read_uint, write_uint); + qc_byte_order!(prop_uint_3, + u64, calc_max!(super::U64_MAX, 3), 3, read_uint, write_uint); + qc_byte_order!(prop_uint_4, + u64, calc_max!(super::U64_MAX, 4), 4, read_uint, write_uint); + qc_byte_order!(prop_uint_5, + u64, calc_max!(super::U64_MAX, 5), 5, read_uint, write_uint); + qc_byte_order!(prop_uint_6, + u64, calc_max!(super::U64_MAX, 6), 6, read_uint, write_uint); + qc_byte_order!(prop_uint_7, + u64, calc_max!(super::U64_MAX, 7), 7, read_uint, write_uint); + qc_byte_order!(prop_uint_8, + u64, calc_max!(super::U64_MAX, 8), 8, read_uint, write_uint); + + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_1, + Wi128<u128>, 1, 1, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_2, + Wi128<u128>, 2, 2, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_3, + Wi128<u128>, 3, 3, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_4, + Wi128<u128>, 4, 4, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_5, + Wi128<u128>, 5, 5, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_6, + Wi128<u128>, 6, 6, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_7, + Wi128<u128>, 7, 7, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_8, + Wi128<u128>, 8, 8, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_9, + Wi128<u128>, 9, 9, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_10, + Wi128<u128>, 10, 10, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_11, + Wi128<u128>, 11, 11, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_12, + Wi128<u128>, 12, 12, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_13, + Wi128<u128>, 13, 13, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_14, + Wi128<u128>, 14, 14, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_15, + Wi128<u128>, 15, 15, read_uint128, write_uint128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_uint128_16, + Wi128<u128>, 16, 16, read_uint128, write_uint128); + + qc_byte_order!(prop_int_1, + i64, calc_max!(super::I64_MAX, 1), 1, read_int, write_int); + qc_byte_order!(prop_int_2, + i64, calc_max!(super::I64_MAX, 2), 2, read_int, write_int); + qc_byte_order!(prop_int_3, + i64, calc_max!(super::I64_MAX, 3), 3, read_int, write_int); + qc_byte_order!(prop_int_4, + i64, calc_max!(super::I64_MAX, 4), 4, read_int, write_int); + qc_byte_order!(prop_int_5, + i64, calc_max!(super::I64_MAX, 5), 5, read_int, write_int); + qc_byte_order!(prop_int_6, + i64, calc_max!(super::I64_MAX, 6), 6, read_int, write_int); + qc_byte_order!(prop_int_7, + i64, calc_max!(super::I64_MAX, 7), 7, read_int, write_int); + qc_byte_order!(prop_int_8, + i64, calc_max!(super::I64_MAX, 8), 8, read_int, write_int); + + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_1, + Wi128<i128>, 1, 1, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_2, + Wi128<i128>, 2, 2, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_3, + Wi128<i128>, 3, 3, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_4, + Wi128<i128>, 4, 4, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_5, + Wi128<i128>, 5, 5, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_6, + Wi128<i128>, 6, 6, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_7, + Wi128<i128>, 7, 7, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_8, + Wi128<i128>, 8, 8, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_9, + Wi128<i128>, 9, 9, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_10, + Wi128<i128>, 10, 10, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_11, + Wi128<i128>, 11, 11, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_12, + Wi128<i128>, 12, 12, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_13, + Wi128<i128>, 13, 13, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_14, + Wi128<i128>, 14, 14, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_15, + Wi128<i128>, 15, 15, read_int128, write_int128); + #[cfg(feature = "i128")] + qc_byte_order!(prop_int128_16, + Wi128<i128>, 16, 16, read_int128, write_int128); + + + // Test that all of the byte conversion functions panic when given a + // buffer that is too small. + // + // These tests are critical to ensure safety, otherwise we might end up + // with a buffer overflow. + macro_rules! too_small { + ($name:ident, $maximally_small:expr, $zero:expr, + $read:ident, $write:ident) => ( + mod $name { + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + + #[test] + #[should_panic] + fn read_big_endian() { + let buf = [0; $maximally_small]; + BigEndian::$read(&buf); + } + + #[test] + #[should_panic] + fn read_little_endian() { + let buf = [0; $maximally_small]; + LittleEndian::$read(&buf); + } + + #[test] + #[should_panic] + fn read_native_endian() { + let buf = [0; $maximally_small]; + NativeEndian::$read(&buf); + } + + #[test] + #[should_panic] + fn write_big_endian() { + let mut buf = [0; $maximally_small]; + BigEndian::$write(&mut buf, $zero); + } + + #[test] + #[should_panic] + fn write_little_endian() { + let mut buf = [0; $maximally_small]; + LittleEndian::$write(&mut buf, $zero); + } + + #[test] + #[should_panic] + fn write_native_endian() { + let mut buf = [0; $maximally_small]; + NativeEndian::$write(&mut buf, $zero); + } + } + ); + ($name:ident, $maximally_small:expr, $read:ident) => ( + mod $name { + use {BigEndian, ByteOrder, NativeEndian, LittleEndian}; + + #[test] + #[should_panic] + fn read_big_endian() { + let buf = [0; $maximally_small]; + BigEndian::$read(&buf, $maximally_small + 1); + } + + #[test] + #[should_panic] + fn read_little_endian() { + let buf = [0; $maximally_small]; + LittleEndian::$read(&buf, $maximally_small + 1); + } + + #[test] + #[should_panic] + fn read_native_endian() { + let buf = [0; $maximally_small]; + NativeEndian::$read(&buf, $maximally_small + 1); + } + } + ); + } + + too_small!(small_u16, 1, 0, read_u16, write_u16); + too_small!(small_i16, 1, 0, read_i16, write_i16); + too_small!(small_u32, 3, 0, read_u32, write_u32); + too_small!(small_i32, 3, 0, read_i32, write_i32); + too_small!(small_u64, 7, 0, read_u64, write_u64); + too_small!(small_i64, 7, 0, read_i64, write_i64); + too_small!(small_f32, 3, 0.0, read_f32, write_f32); + too_small!(small_f64, 7, 0.0, read_f64, write_f64); + #[cfg(feature = "i128")] + too_small!(small_u128, 15, 0, read_u128, write_u128); + #[cfg(feature = "i128")] + too_small!(small_i128, 15, 0, read_i128, write_i128); + + too_small!(small_uint_1, 1, read_uint); + too_small!(small_uint_2, 2, read_uint); + too_small!(small_uint_3, 3, read_uint); + too_small!(small_uint_4, 4, read_uint); + too_small!(small_uint_5, 5, read_uint); + too_small!(small_uint_6, 6, read_uint); + too_small!(small_uint_7, 7, read_uint); + + #[cfg(feature = "i128")] + too_small!(small_uint128_1, 1, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_2, 2, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_3, 3, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_4, 4, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_5, 5, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_6, 6, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_7, 7, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_8, 8, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_9, 9, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_10, 10, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_11, 11, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_12, 12, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_13, 13, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_14, 14, read_uint128); + #[cfg(feature = "i128")] + too_small!(small_uint128_15, 15, read_uint128); + + too_small!(small_int_1, 1, read_int); + too_small!(small_int_2, 2, read_int); + too_small!(small_int_3, 3, read_int); + too_small!(small_int_4, 4, read_int); + too_small!(small_int_5, 5, read_int); + too_small!(small_int_6, 6, read_int); + too_small!(small_int_7, 7, read_int); + + #[cfg(feature = "i128")] + too_small!(small_int128_1, 1, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_2, 2, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_3, 3, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_4, 4, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_5, 5, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_6, 6, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_7, 7, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_8, 8, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_9, 9, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_10, 10, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_11, 11, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_12, 12, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_13, 13, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_14, 14, read_int128); + #[cfg(feature = "i128")] + too_small!(small_int128_15, 15, read_int128); + + // Test that reading/writing slices enforces the correct lengths. + macro_rules! slice_lengths { + ($name:ident, $read:ident, $write:ident, + $num_bytes:expr, $numbers:expr) => { + mod $name { + use {ByteOrder, BigEndian, NativeEndian, LittleEndian}; + + #[test] + #[should_panic] + fn read_big_endian() { + let bytes = [0; $num_bytes]; + let mut numbers = $numbers; + BigEndian::$read(&bytes, &mut numbers); + } + + #[test] + #[should_panic] + fn read_little_endian() { + let bytes = [0; $num_bytes]; + let mut numbers = $numbers; + LittleEndian::$read(&bytes, &mut numbers); + } + + #[test] + #[should_panic] + fn read_native_endian() { + let bytes = [0; $num_bytes]; + let mut numbers = $numbers; + NativeEndian::$read(&bytes, &mut numbers); + } + + #[test] + #[should_panic] + fn write_big_endian() { + let mut bytes = [0; $num_bytes]; + let numbers = $numbers; + BigEndian::$write(&numbers, &mut bytes); + } + + #[test] + #[should_panic] + fn write_little_endian() { + let mut bytes = [0; $num_bytes]; + let numbers = $numbers; + LittleEndian::$write(&numbers, &mut bytes); + } + + #[test] + #[should_panic] + fn write_native_endian() { + let mut bytes = [0; $num_bytes]; + let numbers = $numbers; + NativeEndian::$write(&numbers, &mut bytes); + } + } + } + } + + slice_lengths!( + slice_len_too_small_u16, read_u16_into, write_u16_into, 3, [0, 0]); + slice_lengths!( + slice_len_too_big_u16, read_u16_into, write_u16_into, 5, [0, 0]); + slice_lengths!( + slice_len_too_small_i16, read_i16_into, write_i16_into, 3, [0, 0]); + slice_lengths!( + slice_len_too_big_i16, read_i16_into, write_i16_into, 5, [0, 0]); + + slice_lengths!( + slice_len_too_small_u32, read_u32_into, write_u32_into, 7, [0, 0]); + slice_lengths!( + slice_len_too_big_u32, read_u32_into, write_u32_into, 9, [0, 0]); + slice_lengths!( + slice_len_too_small_i32, read_i32_into, write_i32_into, 7, [0, 0]); + slice_lengths!( + slice_len_too_big_i32, read_i32_into, write_i32_into, 9, [0, 0]); + + slice_lengths!( + slice_len_too_small_u64, read_u64_into, write_u64_into, 15, [0, 0]); + slice_lengths!( + slice_len_too_big_u64, read_u64_into, write_u64_into, 17, [0, 0]); + slice_lengths!( + slice_len_too_small_i64, read_i64_into, write_i64_into, 15, [0, 0]); + slice_lengths!( + slice_len_too_big_i64, read_i64_into, write_i64_into, 17, [0, 0]); + + #[cfg(feature = "i128")] + slice_lengths!( + slice_len_too_small_u128, read_u128_into, write_u128_into, 31, [0, 0]); + #[cfg(feature = "i128")] + slice_lengths!( + slice_len_too_big_u128, read_u128_into, write_u128_into, 33, [0, 0]); + #[cfg(feature = "i128")] + slice_lengths!( + slice_len_too_small_i128, read_i128_into, write_i128_into, 31, [0, 0]); + #[cfg(feature = "i128")] + slice_lengths!( + slice_len_too_big_i128, read_i128_into, write_i128_into, 33, [0, 0]); + + #[test] + fn uint_bigger_buffer() { + use {ByteOrder, LittleEndian}; + let n = LittleEndian::read_uint(&[1, 2, 3, 4, 5, 6, 7, 8], 5); + assert_eq!(n, 0x0504030201); + } +} + +#[cfg(test)] +#[cfg(feature = "std")] +mod stdtests { + extern crate quickcheck; + extern crate rand; + + use self::quickcheck::{QuickCheck, StdGen, Testable}; + use self::rand::thread_rng; + + fn qc_unsized<A: Testable>(f: A) { + + QuickCheck::new() + .gen(StdGen::new(thread_rng(), 16)) + .tests(1_00) + .max_tests(10_000) + .quickcheck(f); + } + + macro_rules! calc_max { + ($max:expr, $bytes:expr) => { ($max - 1) >> (8 * (8 - $bytes)) }; + } + + macro_rules! qc_bytes_ext { + ($name:ident, $ty_int:ty, $max:expr, + $bytes:expr, $read:ident, $write:ident) => ( + mod $name { + use std::io::Cursor; + use { + ReadBytesExt, WriteBytesExt, + BigEndian, NativeEndian, LittleEndian, + }; + #[allow(unused_imports)] use test::{qc_sized, Wi128}; + + #[test] + fn big_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::<BigEndian>(n.clone()).unwrap(); + let offset = wtr.len() - $bytes; + let mut rdr = Cursor::new(&mut wtr[offset..]); + n == rdr.$read::<BigEndian>($bytes).unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max); + } + + #[test] + fn little_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::<LittleEndian>(n.clone()).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::<LittleEndian>($bytes).unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max); + } + + #[test] + fn native_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::<NativeEndian>(n.clone()).unwrap(); + let offset = if cfg!(target_endian = "big") { + wtr.len() - $bytes + } else { + 0 + }; + let mut rdr = Cursor::new(&mut wtr[offset..]); + n == rdr.$read::<NativeEndian>($bytes).unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max); + } + } + ); + ($name:ident, $ty_int:ty, $max:expr, $read:ident, $write:ident) => ( + mod $name { + use std::io::Cursor; + use { + ReadBytesExt, WriteBytesExt, + BigEndian, NativeEndian, LittleEndian, + }; + #[allow(unused_imports)] use test::{qc_sized, Wi128}; + + #[test] + fn big_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::<BigEndian>(n.clone()).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::<BigEndian>().unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn little_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::<LittleEndian>(n.clone()).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::<LittleEndian>().unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + + #[test] + fn native_endian() { + fn prop(n: $ty_int) -> bool { + let mut wtr = vec![]; + wtr.$write::<NativeEndian>(n.clone()).unwrap(); + let mut rdr = Cursor::new(wtr); + n == rdr.$read::<NativeEndian>().unwrap() + } + qc_sized(prop as fn($ty_int) -> bool, $max - 1); + } + } + ); + } + + qc_bytes_ext!(prop_ext_u16, + u16, ::std::u16::MAX as u64, read_u16, write_u16); + qc_bytes_ext!(prop_ext_i16, + i16, ::std::i16::MAX as u64, read_i16, write_i16); + qc_bytes_ext!(prop_ext_u32, + u32, ::std::u32::MAX as u64, read_u32, write_u32); + qc_bytes_ext!(prop_ext_i32, + i32, ::std::i32::MAX as u64, read_i32, write_i32); + qc_bytes_ext!(prop_ext_u64, + u64, ::std::u64::MAX as u64, read_u64, write_u64); + qc_bytes_ext!(prop_ext_i64, + i64, ::std::i64::MAX as u64, read_i64, write_i64); + qc_bytes_ext!(prop_ext_f32, + f32, ::std::u64::MAX as u64, read_f32, write_f32); + qc_bytes_ext!(prop_ext_f64, + f64, ::std::i64::MAX as u64, read_f64, write_f64); + + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_u128, Wi128<u128>, 16 + 1, read_u128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_i128, Wi128<i128>, 16 + 1, read_i128, write_i128); + + qc_bytes_ext!(prop_ext_uint_1, + u64, calc_max!(::test::U64_MAX, 1), 1, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_2, + u64, calc_max!(::test::U64_MAX, 2), 2, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_3, + u64, calc_max!(::test::U64_MAX, 3), 3, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_4, + u64, calc_max!(::test::U64_MAX, 4), 4, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_5, + u64, calc_max!(::test::U64_MAX, 5), 5, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_6, + u64, calc_max!(::test::U64_MAX, 6), 6, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_7, + u64, calc_max!(::test::U64_MAX, 7), 7, read_uint, write_u64); + qc_bytes_ext!(prop_ext_uint_8, + u64, calc_max!(::test::U64_MAX, 8), 8, read_uint, write_u64); + + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_1, + Wi128<u128>, 1, 1, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_2, + Wi128<u128>, 2, 2, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_3, + Wi128<u128>, 3, 3, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_4, + Wi128<u128>, 4, 4, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_5, + Wi128<u128>, 5, 5, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_6, + Wi128<u128>, 6, 6, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_7, + Wi128<u128>, 7, 7, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_8, + Wi128<u128>, 8, 8, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_9, + Wi128<u128>, 9, 9, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_10, + Wi128<u128>, 10, 10, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_11, + Wi128<u128>, 11, 11, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_12, + Wi128<u128>, 12, 12, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_13, + Wi128<u128>, 13, 13, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_14, + Wi128<u128>, 14, 14, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_15, + Wi128<u128>, 15, 15, read_uint128, write_u128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_uint128_16, + Wi128<u128>, 16, 16, read_uint128, write_u128); + + qc_bytes_ext!(prop_ext_int_1, + i64, calc_max!(::test::I64_MAX, 1), 1, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_2, + i64, calc_max!(::test::I64_MAX, 2), 2, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_3, + i64, calc_max!(::test::I64_MAX, 3), 3, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_4, + i64, calc_max!(::test::I64_MAX, 4), 4, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_5, + i64, calc_max!(::test::I64_MAX, 5), 5, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_6, + i64, calc_max!(::test::I64_MAX, 6), 6, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_7, + i64, calc_max!(::test::I64_MAX, 1), 7, read_int, write_i64); + qc_bytes_ext!(prop_ext_int_8, + i64, calc_max!(::test::I64_MAX, 8), 8, read_int, write_i64); + + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_1, + Wi128<i128>, 1, 1, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_2, + Wi128<i128>, 2, 2, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_3, + Wi128<i128>, 3, 3, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_4, + Wi128<i128>, 4, 4, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_5, + Wi128<i128>, 5, 5, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_6, + Wi128<i128>, 6, 6, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_7, + Wi128<i128>, 7, 7, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_8, + Wi128<i128>, 8, 8, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_9, + Wi128<i128>, 9, 9, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_10, + Wi128<i128>, 10, 10, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_11, + Wi128<i128>, 11, 11, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_12, + Wi128<i128>, 12, 12, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_13, + Wi128<i128>, 13, 13, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_14, + Wi128<i128>, 14, 14, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_15, + Wi128<i128>, 15, 15, read_int128, write_i128); + #[cfg(feature = "i128")] + qc_bytes_ext!(prop_ext_int128_16, + Wi128<i128>, 16, 16, read_int128, write_i128); + + // Test slice serialization/deserialization. + macro_rules! qc_slice { + ($name:ident, $ty_int:ty, $read:ident, $write:ident, $zero:expr) => { + mod $name { + use core::mem::size_of; + use {ByteOrder, BigEndian, NativeEndian, LittleEndian}; + use super::qc_unsized; + #[allow(unused_imports)] + use test::Wi128; + + #[test] + fn big_endian() { + #[allow(unused_unsafe)] + fn prop(numbers: Vec<$ty_int>) -> bool { + let numbers: Vec<_> = numbers + .into_iter() + .map(|x| x.clone()) + .collect(); + let num_bytes = size_of::<$ty_int>() * numbers.len(); + let mut bytes = vec![0; num_bytes]; + + BigEndian::$write(&numbers, &mut bytes); + + let mut got = vec![$zero; numbers.len()]; + unsafe { BigEndian::$read(&bytes, &mut got); } + + numbers == got + } + qc_unsized(prop as fn(_) -> bool); + } + + #[test] + fn little_endian() { + #[allow(unused_unsafe)] + fn prop(numbers: Vec<$ty_int>) -> bool { + let numbers: Vec<_> = numbers + .into_iter() + .map(|x| x.clone()) + .collect(); + let num_bytes = size_of::<$ty_int>() * numbers.len(); + let mut bytes = vec![0; num_bytes]; + + LittleEndian::$write(&numbers, &mut bytes); + + let mut got = vec![$zero; numbers.len()]; + unsafe { LittleEndian::$read(&bytes, &mut got); } + + numbers == got + } + qc_unsized(prop as fn(_) -> bool); + } + + #[test] + fn native_endian() { + #[allow(unused_unsafe)] + fn prop(numbers: Vec<$ty_int>) -> bool { + let numbers: Vec<_> = numbers + .into_iter() + .map(|x| x.clone()) + .collect(); + let num_bytes = size_of::<$ty_int>() * numbers.len(); + let mut bytes = vec![0; num_bytes]; + + NativeEndian::$write(&numbers, &mut bytes); + + let mut got = vec![$zero; numbers.len()]; + unsafe { NativeEndian::$read(&bytes, &mut got); } + + numbers == got + } + qc_unsized(prop as fn(_) -> bool); + } + } + } + } + + qc_slice!(prop_slice_u16, u16, read_u16_into, write_u16_into, 0); + qc_slice!(prop_slice_i16, i16, read_i16_into, write_i16_into, 0); + qc_slice!(prop_slice_u32, u32, read_u32_into, write_u32_into, 0); + qc_slice!(prop_slice_i32, i32, read_i32_into, write_i32_into, 0); + qc_slice!(prop_slice_u64, u64, read_u64_into, write_u64_into, 0); + qc_slice!(prop_slice_i64, i64, read_i64_into, write_i64_into, 0); + #[cfg(feature = "i128")] + qc_slice!( + prop_slice_u128, Wi128<u128>, read_u128_into, write_u128_into, 0); + #[cfg(feature = "i128")] + qc_slice!( + prop_slice_i128, Wi128<i128>, read_i128_into, write_i128_into, 0); + + qc_slice!( + prop_slice_f32, f32, read_f32_into_unchecked, write_f32_into, 0.0); + qc_slice!( + prop_slice_f64, f64, read_f64_into_unchecked, write_f64_into, 0.0); +} diff --git a/src/vendor/cargo_metadata/.cargo-checksum.json b/src/vendor/cargo_metadata-0.2.3/.cargo-checksum.json similarity index 100% rename from src/vendor/cargo_metadata/.cargo-checksum.json rename to src/vendor/cargo_metadata-0.2.3/.cargo-checksum.json diff --git a/src/vendor/cargo_metadata-0.2.3/.cargo-ok b/src/vendor/cargo_metadata-0.2.3/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/cargo_metadata/.gitignore b/src/vendor/cargo_metadata-0.2.3/.gitignore similarity index 100% rename from src/vendor/cargo_metadata/.gitignore rename to src/vendor/cargo_metadata-0.2.3/.gitignore diff --git a/src/vendor/cargo_metadata/.travis.yml b/src/vendor/cargo_metadata-0.2.3/.travis.yml similarity index 100% rename from src/vendor/cargo_metadata/.travis.yml rename to src/vendor/cargo_metadata-0.2.3/.travis.yml diff --git a/src/vendor/cargo_metadata/Cargo.toml b/src/vendor/cargo_metadata-0.2.3/Cargo.toml similarity index 100% rename from src/vendor/cargo_metadata/Cargo.toml rename to src/vendor/cargo_metadata-0.2.3/Cargo.toml diff --git a/src/vendor/cargo_metadata/src/lib.rs b/src/vendor/cargo_metadata-0.2.3/src/lib.rs similarity index 100% rename from src/vendor/cargo_metadata/src/lib.rs rename to src/vendor/cargo_metadata-0.2.3/src/lib.rs diff --git a/src/vendor/cargo_metadata/tests/selftest.rs b/src/vendor/cargo_metadata-0.2.3/tests/selftest.rs similarity index 100% rename from src/vendor/cargo_metadata/tests/selftest.rs rename to src/vendor/cargo_metadata-0.2.3/tests/selftest.rs diff --git a/src/vendor/clap/.cargo-checksum.json b/src/vendor/clap/.cargo-checksum.json index 8985da0f5f..3ddfcefb1e 100644 --- a/src/vendor/clap/.cargo-checksum.json +++ b/src/vendor/clap/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".appveyor.yml":"38fb7e583271029caad727c9123a2b2679b7c59971de418f16dc5136dbebaeb5",".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".clog.toml":"f691701bd51b5f311931d0d8f05fa3d78c00dda8d60f3313e21011309c736ff1",".github/CONTRIBUTING.md":"f7eff737f3aa25294802fefb233e3758a64b248781dbbf3262532d693f340a87",".github/ISSUE_TEMPLATE.md":"181a07050efec74e52bb3890585eb02dc77259ac6396ff33fe0869208fa86cee",".gitignore":"57b1cc6deeaf68d35909201e4bb863c7dbec899ceaa17edde7b9fe64ece8c3e9",".mention-bot":"51790ab49f43ed86a4a7c3d2e468aa5fa526ca5e2ac6af20432a2cb5b2fdbe84",".travis.yml":"939aa491f28ece97d9a98e781ae8e76c484592742317390bb1de92224bf0678a","CHANGELOG.md":"9487316c1d190fa572f2779979c99395c687dd0495f4657ffb460e1a2a6c5019","CONTRIBUTORS.md":"6890277f02e66ec77120d3335240ac677abd126db5f7a9d9168f47f5cb4df977","Cargo.toml":"25cb059a452c73a7177ab54d9edf7c0dfcb1489e8013a3efd522e9b2fdfef05e","Cargo.toml.orig":"90db7bd16a30f0728d80891862480887846469946331774fb1f942cd22c5621a","LICENSE-MIT":"6725d1437fc6c77301f2ff0e7d52914cf4f9509213e1078dc77d9356dbe6eac5","README.md":"57e3b95a81faf3503cc8ba14f8b30f725172551507846b6a6e0f9eb1f1ba2b2a","SPONSORS.md":"097c6b7a80feba1e1b9170fa641a2d7d1868e6115fce73a90ab26448ba36f843","clap-test.rs":"995a9d41ef372a814616113f4a58c1e580043678e54527afc2ebee7e8e1d3ef5","index.html":"36f9ce4465266f3af9a259444b01c4239200473cabfc848f789f75b322a3ea8f","justfile":"811b2dec57aec46e570aeeb9945018cf87fe65f6d5b27cdb9ffca79d906910f6","rustfmt.toml":"8fd2d63119df515fd5f44e530c709b19d66b09fbc2e22a640bf4b64c57e7d6b3","src/app/help.rs":"6bf52a4b213ae6b1e53d206bd63816961608284c1c0cbb6cebe9cc1dcf0dc463","src/app/macros.rs":"77764555c2831180f4e976d5bcd95f3da4fdb609d77ae84c94f4ce602afd0c9b","src/app/meta.rs":"a56d28bb466a8ba68155b3f2883e85228b4b74cf25658f62fc050e07cff2dc85","src/app/mod.rs":"672b7472eb674dd0e875dddb6916f7f63c49873ad6d5afcb46f054b9161fc3a4","src/app/parser.rs":"dd87e6e5b22ec761d0228de66f6d929b68a06a692099cb86feabba1924506e4d","src/app/settings.rs":"e6e73720774d7040efa0c155267e996ad9a1d1d4626bb568f3b902edc8913344","src/app/usage.rs":"703cec975c53e7f01b14b4593de41c518910ab347bc4c54efe79367a704ffc4c","src/app/validator.rs":"0e8d58ce7f22482897a48c8b34d52540274ece40f974226fcca6078cc896ae02","src/args/any_arg.rs":"2960506a31a884a9b3142fea532afa0a01f7de8d14ba2a6347eb5cd5b2fdd98b","src/args/arg.rs":"e10c790b12aea012a52edec6c5e8afe27925ae4b936f83352830a40ef1f4c93d","src/args/arg_builder/base.rs":"8b99a9ab811df3e0bdcfba8c0994042b0bcd06d8ddf794ab559baaf9a490ba59","src/args/arg_builder/flag.rs":"fd6eef19c4de7ded217e86224de472147d4f4c5813607bc0fa67462c5d347b7a","src/args/arg_builder/mod.rs":"7a32c8fd85b48f7b60e5f2c13dc70fa9100aa65cd933ba419300d28d682bf722","src/args/arg_builder/option.rs":"e73031991e561ea7e61574f719207034df0fa3acdd28735502d8511f00d7adbf","src/args/arg_builder/positional.rs":"897df6cda52b67728103c7b2c0750f91326880b751204f4ab15852b18be0d929","src/args/arg_builder/switched.rs":"61f5121b0ec746461215a47e1b7a4d699a37a3f181172820e0615f68d5f6f0ef","src/args/arg_builder/valued.rs":"20998bf790a58206b27cf8b09f6740812d507336042a2026f203f99af4500ed5","src/args/arg_matcher.rs":"ff2b23b43fb5d61727410ab156844b90f898279e08b4aa56f244ad7ced12d03f","src/args/arg_matches.rs":"2342be87d96e3b7437d711a3550e8bf83a524a52b3cd1a34e91de02f16e01fa6","src/args/group.rs":"7fe5e2f0dd24faf1765410a9336d85976875e964d7f246e1fa216c4808d88dde","src/args/macros.rs":"57f248e2694f9413cbbaf9087813ed4f27064f5f8e29eaf4ec41ec2b274ae806","src/args/matched_arg.rs":"1ed8d338869ecc3b5fa426ef4cf42f4c9c3b1dd538cdea1fe0489169345536f7","src/args/mod.rs":"c155cd989fa4ca1f8de6a79115afbf5086f092adcb854ff9698b9100f45fc323","src/args/settings.rs":"2753ff50046def9ccb7f601b3d9f565348da1ef0253af24ccee94616a2e5c470","src/args/subcommand.rs":"e1ad9638c33785f1301675de1795b0a4f4b079452aa11f7526d263c2a1179432","src/completions/bash.rs":"116c6830ee2b6310f299a69924f5b1e39b05ebec2b5f7b0ffe3b6938b7fa5514","src/completions/fish.rs":"65782afc62724e068efcb1c85b193f7963891def2ff5cd6e5200ebdb67003bb5","src/completions/macros.rs":"ebad5037e6e63401b1a54498e09d3bd93d1a3a06f045c2990902d47eb9a73774","src/completions/mod.rs":"5d4a734df6a21e6c1e0831a2f7be50a45d2e7bdaf7475589ea78b978643229cd","src/completions/powershell.rs":"866409e5d0a9b2551d739f86c0e4faf86911e9e7c656fb74b38e6960844233b5","src/completions/shell.rs":"c7995ca229fd0d8671761da0aca0513c4f740165f02d06cd97aa0ae881c22cd4","src/completions/zsh.rs":"e98cc3676c0bfa67f0816947b932c92a14cbcf13b45656cf2f8683f9ab05fbca","src/errors.rs":"3c46a4d79d9304ffb152a190528ec9db0cb6c05799bb5211e6df9f7d7abab814","src/fmt.rs":"f205f784268572544ff7e84a89f416c898255404275d4ab1f8fea7e89695daa9","src/lib.rs":"804d8a9c384122e54cc230327810bde108660e61238c2b889d5bbbbcc2f19c75","src/macros.rs":"a65e1349b12ff164578b5c106c73eb646c86b8be04ec4964fa6da511b3135d76","src/map.rs":"67ac4802ed485359c78a1747c832666095b5ee05d68c686d110bd2e4aa9f06e2","src/osstringext.rs":"a87a5a0685dd8310f6329d5f8e8f54c0fac68eb75595a835aeb1c36208efd5f9","src/strext.rs":"d4418d396069e9c05804f92c042ba7192a4244e46059e2edc98670b45cd2daee","src/suggestions.rs":"1f348d393c0c85e622ca97253fd3f25fed9c2c660996d6ca5ac7e3abfd99783b","src/usage_parser.rs":"cc23ff4156d5bebc8a1bebc45edcf337947d8d217461b052271777e0bf31fa51"},"package":"1b8c532887f1a292d17de05ae858a8fe50a301e196f9ef0ddb7ccd0d1d00f180"} \ No newline at end of file +{"files":{".appveyor.yml":"38fb7e583271029caad727c9123a2b2679b7c59971de418f16dc5136dbebaeb5",".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".clog.toml":"f691701bd51b5f311931d0d8f05fa3d78c00dda8d60f3313e21011309c736ff1",".github/CONTRIBUTING.md":"ae52844fd9544b18f4f4689826620a68acfe15ea9729fff2987a065d482339eb",".github/ISSUE_TEMPLATE.md":"181a07050efec74e52bb3890585eb02dc77259ac6396ff33fe0869208fa86cee",".gitignore":"57b1cc6deeaf68d35909201e4bb863c7dbec899ceaa17edde7b9fe64ece8c3e9",".mention-bot":"51790ab49f43ed86a4a7c3d2e468aa5fa526ca5e2ac6af20432a2cb5b2fdbe84",".travis.yml":"e1a3ffda7330c7123e2abde736ec9ce5e80cb8e8caf07608320e2f55418ab8c5","CHANGELOG.md":"59838b10450321e0928463f9bba9fcf27c036716abcce741ea560debd61526eb","CONTRIBUTORS.md":"73ff2f39d730fb481c48bef5dd172ed44aa42c6724c2d8ade88c5d661a29cb08","Cargo.toml":"41dbae832e00da4478f456620c582616346c353e2c796310a1be0e570746dd9b","Cargo.toml.orig":"68aca649720ee44e584e0813cca6c102a96f122f631a84eefce0db7287c8a8d4","LICENSE-MIT":"6725d1437fc6c77301f2ff0e7d52914cf4f9509213e1078dc77d9356dbe6eac5","README.md":"094f06b05cf519473296e1cc2606bfc13b81d1ea57583277c329fe87cdde9f51","SPONSORS.md":"097c6b7a80feba1e1b9170fa641a2d7d1868e6115fce73a90ab26448ba36f843","clap-test.rs":"995a9d41ef372a814616113f4a58c1e580043678e54527afc2ebee7e8e1d3ef5","index.html":"36f9ce4465266f3af9a259444b01c4239200473cabfc848f789f75b322a3ea8f","justfile":"811b2dec57aec46e570aeeb9945018cf87fe65f6d5b27cdb9ffca79d906910f6","rustfmt.toml":"8fd2d63119df515fd5f44e530c709b19d66b09fbc2e22a640bf4b64c57e7d6b3","src/app/help.rs":"6d712557a40475c41a162f66641c2a49e4f351c67084bda7b5d5f47b68521702","src/app/macros.rs":"dea724f1ec30e4e4a60cd4af4a11a6ca38d8723ba8167925a2efa83f1dbec64a","src/app/meta.rs":"86f2f871e3d867fd190a8103429b640b77e0caeabb03ad78e7a92f929eeb5582","src/app/mod.rs":"e293e9fed44b57f355cc9926c30d59e1980337306b76288afc401b2d140f0495","src/app/parser.rs":"a9c2465c2bc80e527e699e51a538192bdbf0b08dda1d7156d92f156e86db4016","src/app/settings.rs":"3c7f64be5ee8b8e8bb9f8eef2ed2568fda3a9e34b297ef193ee9da246860ae08","src/app/usage.rs":"b96e80083ea7e6b761b2c018e595400568289d89da59be54adbfaedd6eae5ab7","src/app/validator.rs":"e0a389815aca17ca384d26994d88af417c97b7137fa19086f58b2f949c82ca27","src/args/any_arg.rs":"2960506a31a884a9b3142fea532afa0a01f7de8d14ba2a6347eb5cd5b2fdd98b","src/args/arg.rs":"128d9007a8993ce32164b0673729ee05951b17082acfbe24321921292c2a54da","src/args/arg_builder/base.rs":"49591af68854d3120a20f9f76522f375b3e0ca353abbf7dbe1c142b844e7c29e","src/args/arg_builder/flag.rs":"fd6eef19c4de7ded217e86224de472147d4f4c5813607bc0fa67462c5d347b7a","src/args/arg_builder/mod.rs":"7a32c8fd85b48f7b60e5f2c13dc70fa9100aa65cd933ba419300d28d682bf722","src/args/arg_builder/option.rs":"e73031991e561ea7e61574f719207034df0fa3acdd28735502d8511f00d7adbf","src/args/arg_builder/positional.rs":"897df6cda52b67728103c7b2c0750f91326880b751204f4ab15852b18be0d929","src/args/arg_builder/switched.rs":"832ef0284a0ceb2da6d03a98f864526a255bf7debfceec47a0018cf78f209dc3","src/args/arg_builder/valued.rs":"20998bf790a58206b27cf8b09f6740812d507336042a2026f203f99af4500ed5","src/args/arg_matcher.rs":"52e749e3ffbd2abd62f848c9b5f09bc80a4e9150bb5baec48183d47ca0160989","src/args/arg_matches.rs":"0defd001300d55cbecea0ee88fbff6aa067bb80ffb3aac5f77fe44d7a4101539","src/args/group.rs":"27ce8153a0f9ec44636936ec9a2f7d01d5cbc53b1bf3a395d3cdfcd4ad5b7ce2","src/args/macros.rs":"57f248e2694f9413cbbaf9087813ed4f27064f5f8e29eaf4ec41ec2b274ae806","src/args/matched_arg.rs":"f4867244d0eff6b5d06a7a024d923e452e66c8da8240b452a9c07e23eceedbbc","src/args/mod.rs":"21d7ddc2ef26f4c6e3b9434a63450235e99cf7143f9d59c447d5ed0fa26cb5d1","src/args/settings.rs":"da4c29263ab99d5a9966f31643783bd7b7d2df18d8c4f07c37781aabc5c9a414","src/args/subcommand.rs":"40d3178fb6f0e9d3dc99959bd45ebe4655f64e7e18145ff7a5e9632ac36b8006","src/completions/bash.rs":"353699a488f76cec20c0274cad67f78e75e07f227944ffc41a9032a202886e1c","src/completions/fish.rs":"7c37ac0e6f822a7f349f3a3bc6cfdf48f1f0dc8218991832f85811dda9fc3feb","src/completions/macros.rs":"6fed51ae20ed545f2306fab82d4fb7656ef285ccc439284a74cbabd0a6cb88ec","src/completions/mod.rs":"89dcd675fc57b74c61e22fe378d2fd44dfaf1f6878fb7206bb94320434f764d2","src/completions/powershell.rs":"db6115e5477629d6df15afe0e98f53a96dd3bb77961652b52ce8a844dd570aba","src/completions/shell.rs":"f147b7348fe04aab218a5b84a476c8d791c9c74ebb4184e9259b071fb8d6ed81","src/completions/zsh.rs":"bd2778fad58de76104549b910b62609971a953e33f6aa0d58d803e588fb4319e","src/errors.rs":"79f099c4c607c05ed46844a86569db2b7dce96aaf4f2ef576e3a455cfe16a47e","src/fmt.rs":"7afbd78efba9936a1c776e86c65207b8bdff7bdb2d62b5d042b39f477b843bd1","src/lib.rs":"753bf20124032e3e9b40350e51b19ca957e8fc6056ff59253048b5b52664544d","src/macros.rs":"b3cfd0e12fd41d32519c9b86f3e17c5062b681d2bc3bb3fb4779a3c958252756","src/map.rs":"10c57678b453673aa2d78f72de2d44510271eb2f9771a8d203952353581318a8","src/osstringext.rs":"edfbd9b64574492be65db1d95319ae3a1335cfa17764fa30d9726af7a4873e73","src/strext.rs":"d4418d396069e9c05804f92c042ba7192a4244e46059e2edc98670b45cd2daee","src/suggestions.rs":"aaf08a30ab8594f415ee0a376596f668c5e2ba4ee6ab3c312239f4cbad6d5930","src/usage_parser.rs":"5dda6ef41b4c3773ab461ac7150fbdcc58ecbda7751723a0848fcb95a4312cb2"},"package":"110d43e343eb29f4f51c1db31beb879d546db27998577e5715270a54bcf41d3f"} \ No newline at end of file diff --git a/src/vendor/clap/.github/CONTRIBUTING.md b/src/vendor/clap/.github/CONTRIBUTING.md index b973a54b26..ba84eab478 100644 --- a/src/vendor/clap/.github/CONTRIBUTING.md +++ b/src/vendor/clap/.github/CONTRIBUTING.md @@ -1,21 +1,67 @@ # How to Contribute -Contributions are always welcome! Please use the following guidelines when contributing to `clap` +Contributions are always welcome! And there is a multitude of ways in which you can help depending on what you like to do, or are good at. Anything from documentation, code cleanup, issue completion, new features, you name it, even filing issues is contributing and greatly appreciated! -## Goals +Another really great way to help is if you find an interesting, or helpful way in which to use `clap`. You can either add it to the [examples/](examples) directory, or file an issue and tell me. I'm all about giving credit where credit is due :) -There are a few goals of `clap` that I'd like to maintain throughout contributions. +### Testing Code -* Remain backwards compatible when possible - - If backwards compatibility *must* be broken, use deprecation warnings if at all possible before removing legacy code - - This does not apply for security concerns - - `clap` officially supports the current stable version of Rust, minus two releases (i.e. if 1.13.0 is current, `clap` must support 1.11.0 and beyond) -* Parse arguments quickly - - Parsing of arguments shouldn't slow down usage of the main program - - This is also true of generating help and usage information (although *slightly* less stringent, as the program is about to exit) -* Try to be cognizant of memory usage - - Once parsing is complete, the memory footprint of `clap` should be low since the main program is the star of the show -* `panic!` on *developer* error, exit gracefully on *end-user* error +To test with all features both enabled and disabled, you can run these commands: + +```sh +$ cargo test --no-default-features +$ cargo test --features "yaml unstable" +``` + +Alternatively, if you have [`just`](https://github.com/casey/just) installed you can run the prebuilt recipes. *Not* using `just` is perfectly fine as well, it simply bundles commands automatically. + +For example, to test the code, as above simply run: + +```sh +$ just run-tests +``` + +From here on, I will list the appropriate `cargo` command as well as the `just` command. + +Sometimes it's helpful to only run a subset of the tests, which can be done via: + +```sh +$ cargo test --test <test_name> + +# Or + +$ just run-test <test_name> +``` + +### Linting Code + +During the CI process `clap` runs against many different lints using [`clippy`](https://github.com/Manishearth/rust-clippy). In order to check if these lints pass on your own computer prior to submitting a PR you'll need a nightly compiler. + +In order to check the code for lints run either: + +```sh +$ rustup override add nightly +$ cargo build --features lints +$ rustup override remove + +# Or + +$ just lint +``` + +### Debugging Code + +Another helpful technique is to see the `clap` debug output while developing features. In order to see the debug output while running the full test suite or individual tests, run: + +```sh +$ cargo test --features debug + +# Or for individual tests +$ cargo test --test <test_name> --features debug + +# The corresponding just command for individual debugging tests is: +$ just debug <test_name> +``` ### Commit Messages @@ -54,3 +100,16 @@ I use a [conventional](https://github.com/ajoslin/conventional-changelog/blob/a5 Another really great way to help is if you find an interesting, or helpful way in which to use `clap`. You can either add it to the [examples/](../examples) directory, or file an issue and tell me. I'm all about giving credit where credit is due :) +### Goals + +There are a few goals of `clap` that I'd like to maintain throughout contributions. If your proposed changes break, or go against any of these goals we'll discuss the changes further before merging (but will *not* be ignored, all contributes are welcome!). These are by no means hard-and-fast rules, as I'm no expert and break them myself from time to time (even if by mistake or ignorance :P). + +* Remain backwards compatible when possible + - If backwards compatibility *must* be broken, use deprecation warnings if at all possible before removing legacy code + - This does not apply for security concerns +* Parse arguments quickly + - Parsing of arguments shouldn't slow down usage of the main program + - This is also true of generating help and usage information (although *slightly* less stringent, as the program is about to exit) +* Try to be cognizant of memory usage + - Once parsing is complete, the memory footprint of `clap` should be low since the main program is the star of the show +* `panic!` on *developer* error, exit gracefully on *end-user* error diff --git a/src/vendor/clap/.travis.yml b/src/vendor/clap/.travis.yml index fafed38056..1e3cfea70e 100644 --- a/src/vendor/clap/.travis.yml +++ b/src/vendor/clap/.travis.yml @@ -3,10 +3,10 @@ language: rust cache: cargo rust: - nightly - - nightly-2017-06-07 + - nightly-2017-10-11 - beta - stable - - 1.18.0 + - 1.20.0 matrix: allow_failures: - rust: nightly diff --git a/src/vendor/clap/CHANGELOG.md b/src/vendor/clap/CHANGELOG.md index f20d4ade57..43a9a897a0 100644 --- a/src/vendor/clap/CHANGELOG.md +++ b/src/vendor/clap/CHANGELOG.md @@ -1,3 +1,46 @@ +<a name="2.29.0"></a> +## 2.29.0 (2017-12-02) + + +#### API Additions + +* **Arg:** adds Arg::hide_env_values(bool) which allows one to hide any current env values and display only the key in help messages ([fb41d062](https://github.com/kbknapp/clap-rs/commit/fb41d062eedf37cb4f805c90adca29909bd197d7)) + + + +<a name="2.28.0"></a> +## 2.28.0 (2017-11-28) + +The minimum required Rust is now 1.20. This was done to start using bitflags 1.0 and having >1.0 deps is a *very good* thing! + +#### Documentation + +* changes the demo version to 2.28 to stay in sync ([ce6ca492](https://github.com/kbknapp/clap-rs/commit/ce6ca492c7510ab6474075806360b96081b021a9)) +* Fix URL path to github hosted files ([ce72aada](https://github.com/kbknapp/clap-rs/commit/ce72aada56a9581d4a6cb4bf9bdb861c3906f8df), closes [#1106](https://github.com/kbknapp/clap-rs/issues/1106)) +* fix typo ([002b07fc](https://github.com/kbknapp/clap-rs/commit/002b07fc98a1c85acb66296b1eec0b2aba906125)) +* **README.md:** updates the readme and pulls out some redundant sections ([db6caf86](https://github.com/kbknapp/clap-rs/commit/db6caf8663747e679d2f4ed3bd127f33476754aa)) + +#### Improvements + +* adds '[SUBCOMMAND]' to usage strings with only AppSettings::AllowExternalSubcommands is used with no other subcommands ([e78bb757](https://github.com/kbknapp/clap-rs/commit/e78bb757a3df16e82d539e450c06767a6bfcf859), closes [#1093](https://github.com/kbknapp/clap-rs/issues/1093)) + +#### API Additions + +* Adds Arg::case_insensitive(bool) which allows matching Arg::possible_values without worrying about ASCII case ([1fec268e](https://github.com/kbknapp/clap-rs/commit/1fec268e51736602e38e67c76266f439e2e0ef12), closes [#1118](https://github.com/kbknapp/clap-rs/issues/1118)) +* Adds the traits to be used with the clap-derive crate to be able to use Custom Derive ([6f4c3412](https://github.com/kbknapp/clap-rs/commit/6f4c3412415e882f5ca2cc3fbd6d4dce79440828)) + +#### Bug Fixes + +* Fixes a regression where --help couldn't be overridden ([a283d69f](https://github.com/kbknapp/clap-rs/commit/a283d69fc08aa016ae1bf9ba010012abecc7ba69), closes [#1112](https://github.com/kbknapp/clap-rs/issues/1112)) +* fixes a bug that allowed options to pass parsing when no value was provided ([2fb75821](https://github.com/kbknapp/clap-rs/commit/2fb758219c7a60d639da67692e100b855a8165ac), closes [#1105](https://github.com/kbknapp/clap-rs/issues/1105)) +* ignore PropagateGlobalValuesDown deprecation warning ([f61ce3f5](https://github.com/kbknapp/clap-rs/commit/f61ce3f55fe65e16b3db0bd4facdc4575de22767), closes [#1086](https://github.com/kbknapp/clap-rs/issues/1086)) + +#### Deps + +* Updates `bitflags` to 1.0 + + + <a name="v2.27.1"></a> ## v2.27.1 (2017-10-24) diff --git a/src/vendor/clap/CONTRIBUTORS.md b/src/vendor/clap/CONTRIBUTORS.md index 4f86b45573..d6b83808a6 100644 --- a/src/vendor/clap/CONTRIBUTORS.md +++ b/src/vendor/clap/CONTRIBUTORS.md @@ -5,37 +5,41 @@ the following is a list of contributors: :---: |:---: |:---: |:---: |:---: |:---: | [kbknapp](https://github.com/kbknapp) |[homu](https://github.com/homu) |[Vinatorul](https://github.com/Vinatorul) |[tormol](https://github.com/tormol) |[little-dude](https://github.com/little-dude) |[sru](https://github.com/sru) | -[<img alt="nabijaczleweli" src="https://avatars3.githubusercontent.com/u/6709544?v=4&s=117" width="117">](https://github.com/nabijaczleweli) |[<img alt="mgeisler" src="https://avatars0.githubusercontent.com/u/89623?v=4&s=117" width="117">](https://github.com/mgeisler) |[<img alt="Byron" src="https://avatars2.githubusercontent.com/u/63622?v=4&s=117" width="117">](https://github.com/Byron) |[<img alt="hgrecco" src="https://avatars0.githubusercontent.com/u/278566?v=4&s=117" width="117">](https://github.com/hgrecco) |[<img alt="nateozem" src="https://avatars2.githubusercontent.com/u/22719441?v=4&s=117" width="117">](https://github.com/nateozem) |[<img alt="james-darkfox" src="https://avatars3.githubusercontent.com/u/637155?v=4&s=117" width="117">](https://github.com/james-darkfox) | +[<img alt="willmurphyscode" src="https://avatars3.githubusercontent.com/u/12529630?v=4&s=117" width="117">](https://github.com/willmurphyscode) |[<img alt="mgeisler" src="https://avatars0.githubusercontent.com/u/89623?v=4&s=117" width="117">](https://github.com/mgeisler) |[<img alt="nabijaczleweli" src="https://avatars3.githubusercontent.com/u/6709544?v=4&s=117" width="117">](https://github.com/nabijaczleweli) |[<img alt="Byron" src="https://avatars2.githubusercontent.com/u/63622?v=4&s=117" width="117">](https://github.com/Byron) |[<img alt="hgrecco" src="https://avatars0.githubusercontent.com/u/278566?v=4&s=117" width="117">](https://github.com/hgrecco) |[<img alt="bluejekyll" src="https://avatars3.githubusercontent.com/u/986845?v=4&s=117" width="117">](https://github.com/bluejekyll) | :---: |:---: |:---: |:---: |:---: |:---: | -[nabijaczleweli](https://github.com/nabijaczleweli) |[mgeisler](https://github.com/mgeisler) |[Byron](https://github.com/Byron) |[hgrecco](https://github.com/hgrecco) |[nateozem](https://github.com/nateozem) |[james-darkfox](https://github.com/james-darkfox) | +[willmurphyscode](https://github.com/willmurphyscode) |[mgeisler](https://github.com/mgeisler) |[nabijaczleweli](https://github.com/nabijaczleweli) |[Byron](https://github.com/Byron) |[hgrecco](https://github.com/hgrecco) |[bluejekyll](https://github.com/bluejekyll) | -[<img alt="Arnavion" src="https://avatars2.githubusercontent.com/u/1096010?v=4&s=117" width="117">](https://github.com/Arnavion) |[<img alt="rtaycher" src="https://avatars0.githubusercontent.com/u/324733?v=4&s=117" width="117">](https://github.com/rtaycher) |[<img alt="glowing-chemist" src="https://avatars0.githubusercontent.com/u/17074682?v=4&s=117" width="117">](https://github.com/glowing-chemist) |[<img alt="untitaker" src="https://avatars0.githubusercontent.com/u/837573?v=4&s=117" width="117">](https://github.com/untitaker) |[<img alt="afiune" src="https://avatars0.githubusercontent.com/u/5712253?v=4&s=117" width="117">](https://github.com/afiune) |[<img alt="crazymerlyn" src="https://avatars1.githubusercontent.com/u/6919679?v=4&s=117" width="117">](https://github.com/crazymerlyn) | +[<img alt="ignatenkobrain" src="https://avatars1.githubusercontent.com/u/2866862?v=4&s=117" width="117">](https://github.com/ignatenkobrain) |[<img alt="james-darkfox" src="https://avatars3.githubusercontent.com/u/637155?v=4&s=117" width="117">](https://github.com/james-darkfox) |[<img alt="H2CO3" src="https://avatars2.githubusercontent.com/u/742370?v=4&s=117" width="117">](https://github.com/H2CO3) |[<img alt="nateozem" src="https://avatars2.githubusercontent.com/u/22719441?v=4&s=117" width="117">](https://github.com/nateozem) |[<img alt="glowing-chemist" src="https://avatars0.githubusercontent.com/u/17074682?v=4&s=117" width="117">](https://github.com/glowing-chemist) |[<img alt="rtaycher" src="https://avatars0.githubusercontent.com/u/324733?v=4&s=117" width="117">](https://github.com/rtaycher) | :---: |:---: |:---: |:---: |:---: |:---: | -[Arnavion](https://github.com/Arnavion) |[rtaycher](https://github.com/rtaycher) |[glowing-chemist](https://github.com/glowing-chemist) |[untitaker](https://github.com/untitaker) |[afiune](https://github.com/afiune) |[crazymerlyn](https://github.com/crazymerlyn) | +[ignatenkobrain](https://github.com/ignatenkobrain) |[james-darkfox](https://github.com/james-darkfox) |[H2CO3](https://github.com/H2CO3) |[nateozem](https://github.com/nateozem) |[glowing-chemist](https://github.com/glowing-chemist) |[rtaycher](https://github.com/rtaycher) | -[<img alt="SuperFluffy" src="https://avatars0.githubusercontent.com/u/701177?v=4&s=117" width="117">](https://github.com/SuperFluffy) |[<img alt="japaric" src="https://avatars3.githubusercontent.com/u/5018213?v=4&s=117" width="117">](https://github.com/japaric) |[<img alt="matthiasbeyer" src="https://avatars0.githubusercontent.com/u/427866?v=4&s=117" width="117">](https://github.com/matthiasbeyer) |[<img alt="SShrike" src="https://avatars1.githubusercontent.com/u/4061736?v=4&s=117" width="117">](https://github.com/SShrike) |[<img alt="tshepang" src="https://avatars0.githubusercontent.com/u/588486?v=4&s=117" width="117">](https://github.com/tshepang) |[<img alt="gohyda" src="https://avatars3.githubusercontent.com/u/10263838?v=4&s=117" width="117">](https://github.com/gohyda) | +[<img alt="Arnavion" src="https://avatars2.githubusercontent.com/u/1096010?v=4&s=117" width="117">](https://github.com/Arnavion) |[<img alt="japaric" src="https://avatars3.githubusercontent.com/u/5018213?v=4&s=117" width="117">](https://github.com/japaric) |[<img alt="untitaker" src="https://avatars0.githubusercontent.com/u/837573?v=4&s=117" width="117">](https://github.com/untitaker) |[<img alt="afiune" src="https://avatars0.githubusercontent.com/u/5712253?v=4&s=117" width="117">](https://github.com/afiune) |[<img alt="crazymerlyn" src="https://avatars1.githubusercontent.com/u/6919679?v=4&s=117" width="117">](https://github.com/crazymerlyn) |[<img alt="SuperFluffy" src="https://avatars0.githubusercontent.com/u/701177?v=4&s=117" width="117">](https://github.com/SuperFluffy) | :---: |:---: |:---: |:---: |:---: |:---: | -[SuperFluffy](https://github.com/SuperFluffy) |[japaric](https://github.com/japaric) |[matthiasbeyer](https://github.com/matthiasbeyer) |[SShrike](https://github.com/SShrike) |[tshepang](https://github.com/tshepang) |[gohyda](https://github.com/gohyda) | +[Arnavion](https://github.com/Arnavion) |[japaric](https://github.com/japaric) |[untitaker](https://github.com/untitaker) |[afiune](https://github.com/afiune) |[crazymerlyn](https://github.com/crazymerlyn) |[SuperFluffy](https://github.com/SuperFluffy) | -[<img alt="jimmycuadra" src="https://avatars2.githubusercontent.com/u/122457?v=4&s=117" width="117">](https://github.com/jimmycuadra) |[<img alt="Nemo157" src="https://avatars1.githubusercontent.com/u/81079?v=4&s=117" width="117">](https://github.com/Nemo157) |[<img alt="golem131" src="https://avatars3.githubusercontent.com/u/2429587?v=4&s=117" width="117">](https://github.com/golem131) |[<img alt="porglezomp" src="https://avatars1.githubusercontent.com/u/1690225?v=4&s=117" width="117">](https://github.com/porglezomp) |[<img alt="wdv4758h" src="https://avatars1.githubusercontent.com/u/2716047?v=4&s=117" width="117">](https://github.com/wdv4758h) |[<img alt="frewsxcv" src="https://avatars2.githubusercontent.com/u/416575?v=4&s=117" width="117">](https://github.com/frewsxcv) | +[<img alt="malbarbo" src="https://avatars3.githubusercontent.com/u/1678126?v=4&s=117" width="117">](https://github.com/malbarbo) |[<img alt="matthiasbeyer" src="https://avatars0.githubusercontent.com/u/427866?v=4&s=117" width="117">](https://github.com/matthiasbeyer) |[<img alt="gohyda" src="https://avatars3.githubusercontent.com/u/10263838?v=4&s=117" width="117">](https://github.com/gohyda) |[<img alt="tshepang" src="https://avatars0.githubusercontent.com/u/588486?v=4&s=117" width="117">](https://github.com/tshepang) |[<img alt="golem131" src="https://avatars3.githubusercontent.com/u/2429587?v=4&s=117" width="117">](https://github.com/golem131) |[<img alt="jimmycuadra" src="https://avatars2.githubusercontent.com/u/122457?v=4&s=117" width="117">](https://github.com/jimmycuadra) | :---: |:---: |:---: |:---: |:---: |:---: | -[jimmycuadra](https://github.com/jimmycuadra) |[Nemo157](https://github.com/Nemo157) |[golem131](https://github.com/golem131) |[porglezomp](https://github.com/porglezomp) |[wdv4758h](https://github.com/wdv4758h) |[frewsxcv](https://github.com/frewsxcv) | +[malbarbo](https://github.com/malbarbo) |[matthiasbeyer](https://github.com/matthiasbeyer) |[gohyda](https://github.com/gohyda) |[tshepang](https://github.com/tshepang) |[golem131](https://github.com/golem131) |[jimmycuadra](https://github.com/jimmycuadra) | -[<img alt="hoodie" src="https://avatars1.githubusercontent.com/u/260370?v=4&s=117" width="117">](https://github.com/hoodie) |[<img alt="huonw" src="https://avatars1.githubusercontent.com/u/1203825?v=4&s=117" width="117">](https://github.com/huonw) |[<img alt="GrappigPanda" src="https://avatars0.githubusercontent.com/u/2055372?v=4&s=117" width="117">](https://github.com/GrappigPanda) |[<img alt="ignatenkobrain" src="https://avatars1.githubusercontent.com/u/2866862?v=4&s=117" width="117">](https://github.com/ignatenkobrain) |[<img alt="shepmaster" src="https://avatars0.githubusercontent.com/u/174509?v=4&s=117" width="117">](https://github.com/shepmaster) |[<img alt="cstorey" src="https://avatars3.githubusercontent.com/u/743059?v=4&s=117" width="117">](https://github.com/cstorey) | +[<img alt="Nemo157" src="https://avatars1.githubusercontent.com/u/81079?v=4&s=117" width="117">](https://github.com/Nemo157) |[<img alt="SShrike" src="https://avatars1.githubusercontent.com/u/4061736?v=4&s=117" width="117">](https://github.com/SShrike) |[<img alt="Eijebong" src="https://avatars2.githubusercontent.com/u/3650385?v=4&s=117" width="117">](https://github.com/Eijebong) |[<img alt="cstorey" src="https://avatars3.githubusercontent.com/u/743059?v=4&s=117" width="117">](https://github.com/cstorey) |[<img alt="wdv4758h" src="https://avatars1.githubusercontent.com/u/2716047?v=4&s=117" width="117">](https://github.com/wdv4758h) |[<img alt="frewsxcv" src="https://avatars2.githubusercontent.com/u/416575?v=4&s=117" width="117">](https://github.com/frewsxcv) | :---: |:---: |:---: |:---: |:---: |:---: | -[hoodie](https://github.com/hoodie) |[huonw](https://github.com/huonw) |[GrappigPanda](https://github.com/GrappigPanda) |[ignatenkobrain](https://github.com/ignatenkobrain) |[shepmaster](https://github.com/shepmaster) |[cstorey](https://github.com/cstorey) | +[Nemo157](https://github.com/Nemo157) |[SShrike](https://github.com/SShrike) |[Eijebong](https://github.com/Eijebong) |[cstorey](https://github.com/cstorey) |[wdv4758h](https://github.com/wdv4758h) |[frewsxcv](https://github.com/frewsxcv) | -[<img alt="kieraneglin" src="https://avatars0.githubusercontent.com/u/569917?v=4&s=117" width="117">](https://github.com/kieraneglin) |[<img alt="musoke" src="https://avatars0.githubusercontent.com/u/16665084?v=4&s=117" width="117">](https://github.com/musoke) |[<img alt="nelsonjchen" src="https://avatars1.githubusercontent.com/u/5363?v=4&s=117" width="117">](https://github.com/nelsonjchen) |[<img alt="pkgw" src="https://avatars0.githubusercontent.com/u/59598?v=4&s=117" width="117">](https://github.com/pkgw) |[<img alt="Deedasmi" src="https://avatars0.githubusercontent.com/u/5093293?v=4&s=117" width="117">](https://github.com/Deedasmi) |[<img alt="vmchale" src="https://avatars1.githubusercontent.com/u/13259982?v=4&s=117" width="117">](https://github.com/vmchale) | +[<img alt="hoodie" src="https://avatars1.githubusercontent.com/u/260370?v=4&s=117" width="117">](https://github.com/hoodie) |[<img alt="huonw" src="https://avatars1.githubusercontent.com/u/1203825?v=4&s=117" width="117">](https://github.com/huonw) |[<img alt="GrappigPanda" src="https://avatars0.githubusercontent.com/u/2055372?v=4&s=117" width="117">](https://github.com/GrappigPanda) |[<img alt="shepmaster" src="https://avatars0.githubusercontent.com/u/174509?v=4&s=117" width="117">](https://github.com/shepmaster) |[<img alt="porglezomp" src="https://avatars1.githubusercontent.com/u/1690225?v=4&s=117" width="117">](https://github.com/porglezomp) |[<img alt="kieraneglin" src="https://avatars0.githubusercontent.com/u/569917?v=4&s=117" width="117">](https://github.com/kieraneglin) | :---: |:---: |:---: |:---: |:---: |:---: | -[kieraneglin](https://github.com/kieraneglin) |[musoke](https://github.com/musoke) |[nelsonjchen](https://github.com/nelsonjchen) |[pkgw](https://github.com/pkgw) |[Deedasmi](https://github.com/Deedasmi) |[vmchale](https://github.com/vmchale) | +[hoodie](https://github.com/hoodie) |[huonw](https://github.com/huonw) |[GrappigPanda](https://github.com/GrappigPanda) |[shepmaster](https://github.com/shepmaster) |[porglezomp](https://github.com/porglezomp) |[kieraneglin](https://github.com/kieraneglin) | -[<img alt="messense" src="https://avatars0.githubusercontent.com/u/1556054?v=4&s=117" width="117">](https://github.com/messense) |[<img alt="Keats" src="https://avatars2.githubusercontent.com/u/680355?v=4&s=117" width="117">](https://github.com/Keats) |[<img alt="starkat99" src="https://avatars1.githubusercontent.com/u/8295111?v=4&s=117" width="117">](https://github.com/starkat99) |[<img alt="alex-gulyas" src="https://avatars0.githubusercontent.com/u/8698329?v=4&s=117" width="117">](https://github.com/alex-gulyas) |[<img alt="cite-reader" src="https://avatars1.githubusercontent.com/u/4196987?v=4&s=117" width="117">](https://github.com/cite-reader) |[<img alt="alexbool" src="https://avatars3.githubusercontent.com/u/1283792?v=4&s=117" width="117">](https://github.com/alexbool) | +[<img alt="musoke" src="https://avatars0.githubusercontent.com/u/16665084?v=4&s=117" width="117">](https://github.com/musoke) |[<img alt="nelsonjchen" src="https://avatars1.githubusercontent.com/u/5363?v=4&s=117" width="117">](https://github.com/nelsonjchen) |[<img alt="pkgw" src="https://avatars0.githubusercontent.com/u/59598?v=4&s=117" width="117">](https://github.com/pkgw) |[<img alt="Deedasmi" src="https://avatars0.githubusercontent.com/u/5093293?v=4&s=117" width="117">](https://github.com/Deedasmi) |[<img alt="vmchale" src="https://avatars1.githubusercontent.com/u/13259982?v=4&s=117" width="117">](https://github.com/vmchale) |[<img alt="messense" src="https://avatars0.githubusercontent.com/u/1556054?v=4&s=117" width="117">](https://github.com/messense) | :---: |:---: |:---: |:---: |:---: |:---: | -[messense](https://github.com/messense) |[Keats](https://github.com/Keats) |[starkat99](https://github.com/starkat99) |[alex-gulyas](https://github.com/alex-gulyas) |[cite-reader](https://github.com/cite-reader) |[alexbool](https://github.com/alexbool) | +[musoke](https://github.com/musoke) |[nelsonjchen](https://github.com/nelsonjchen) |[pkgw](https://github.com/pkgw) |[Deedasmi](https://github.com/Deedasmi) |[vmchale](https://github.com/vmchale) |[messense](https://github.com/messense) | -[<img alt="AluisioASG" src="https://avatars2.githubusercontent.com/u/1904165?v=4&s=117" width="117">](https://github.com/AluisioASG) |[<img alt="BurntSushi" src="https://avatars3.githubusercontent.com/u/456674?v=4&s=117" width="117">](https://github.com/BurntSushi) |[<img alt="nox" src="https://avatars0.githubusercontent.com/u/123095?v=4&s=117" width="117">](https://github.com/nox) |[<img alt="mitsuhiko" src="https://avatars1.githubusercontent.com/u/7396?v=4&s=117" width="117">](https://github.com/mitsuhiko) |[<img alt="brennie" src="https://avatars3.githubusercontent.com/u/156585?v=4&s=117" width="117">](https://github.com/brennie) |[<img alt="pixelistik" src="https://avatars1.githubusercontent.com/u/170929?v=4&s=117" width="117">](https://github.com/pixelistik) | +[<img alt="Keats" src="https://avatars2.githubusercontent.com/u/680355?v=4&s=117" width="117">](https://github.com/Keats) |[<img alt="starkat99" src="https://avatars1.githubusercontent.com/u/8295111?v=4&s=117" width="117">](https://github.com/starkat99) |[<img alt="durka" src="https://avatars3.githubusercontent.com/u/47007?v=4&s=117" width="117">](https://github.com/durka) |[<img alt="alex-gulyas" src="https://avatars0.githubusercontent.com/u/8698329?v=4&s=117" width="117">](https://github.com/alex-gulyas) |[<img alt="cite-reader" src="https://avatars1.githubusercontent.com/u/4196987?v=4&s=117" width="117">](https://github.com/cite-reader) |[<img alt="alexbool" src="https://avatars3.githubusercontent.com/u/1283792?v=4&s=117" width="117">](https://github.com/alexbool) | :---: |:---: |:---: |:---: |:---: |:---: | -[AluisioASG](https://github.com/AluisioASG) |[BurntSushi](https://github.com/BurntSushi) |[nox](https://github.com/nox) |[mitsuhiko](https://github.com/mitsuhiko) |[brennie](https://github.com/brennie) |[pixelistik](https://github.com/pixelistik) | +[Keats](https://github.com/Keats) |[starkat99](https://github.com/starkat99) |[durka](https://github.com/durka) |[alex-gulyas](https://github.com/alex-gulyas) |[cite-reader](https://github.com/cite-reader) |[alexbool](https://github.com/alexbool) | + +[<img alt="AluisioASG" src="https://avatars2.githubusercontent.com/u/1904165?v=4&s=117" width="117">](https://github.com/AluisioASG) |[<img alt="BurntSushi" src="https://avatars3.githubusercontent.com/u/456674?v=4&s=117" width="117">](https://github.com/BurntSushi) |[<img alt="nox" src="https://avatars0.githubusercontent.com/u/123095?v=4&s=117" width="117">](https://github.com/nox) |[<img alt="pixelistik" src="https://avatars1.githubusercontent.com/u/170929?v=4&s=117" width="117">](https://github.com/pixelistik) |[<img alt="brennie" src="https://avatars3.githubusercontent.com/u/156585?v=4&s=117" width="117">](https://github.com/brennie) |[<img alt="ogham" src="https://avatars3.githubusercontent.com/u/503760?v=4&s=117" width="117">](https://github.com/ogham) | +:---: |:---: |:---: |:---: |:---: |:---: | +[AluisioASG](https://github.com/AluisioASG) |[BurntSushi](https://github.com/BurntSushi) |[nox](https://github.com/nox) |[pixelistik](https://github.com/pixelistik) |[brennie](https://github.com/brennie) |[ogham](https://github.com/ogham) | [<img alt="Bilalh" src="https://avatars0.githubusercontent.com/u/171602?v=4&s=117" width="117">](https://github.com/Bilalh) |[<img alt="dotdash" src="https://avatars1.githubusercontent.com/u/230962?v=4&s=117" width="117">](https://github.com/dotdash) |[<img alt="bradurani" src="https://avatars0.githubusercontent.com/u/4195952?v=4&s=117" width="117">](https://github.com/bradurani) |[<img alt="Seeker14491" src="https://avatars2.githubusercontent.com/u/6490497?v=4&s=117" width="117">](https://github.com/Seeker14491) |[<img alt="brianp" src="https://avatars1.githubusercontent.com/u/179134?v=4&s=117" width="117">](https://github.com/brianp) |[<img alt="casey" src="https://avatars2.githubusercontent.com/u/1945?v=4&s=117" width="117">](https://github.com/casey) | :---: |:---: |:---: |:---: |:---: |:---: | @@ -45,33 +49,37 @@ the following is a list of contributors: :---: |:---: |:---: |:---: |:---: |:---: | [volks73](https://github.com/volks73) |[daboross](https://github.com/daboross) |[mernen](https://github.com/mernen) |[dguo](https://github.com/dguo) |[davidszotten](https://github.com/davidszotten) |[drusellers](https://github.com/drusellers) | -[<img alt="eddyb" src="https://avatars2.githubusercontent.com/u/77424?v=4&s=117" width="117">](https://github.com/eddyb) |[<img alt="birkenfeld" src="https://avatars0.githubusercontent.com/u/144359?v=4&s=117" width="117">](https://github.com/birkenfeld) |[<img alt="guanqun" src="https://avatars0.githubusercontent.com/u/53862?v=4&s=117" width="117">](https://github.com/guanqun) |[<img alt="tanakh" src="https://avatars2.githubusercontent.com/u/109069?v=4&s=117" width="117">](https://github.com/tanakh) |[<img alt="SirVer" src="https://avatars0.githubusercontent.com/u/140115?v=4&s=117" width="117">](https://github.com/SirVer) |[<img alt="idmit" src="https://avatars1.githubusercontent.com/u/2546728?v=4&s=117" width="117">](https://github.com/idmit) | +[<img alt="eddyb" src="https://avatars2.githubusercontent.com/u/77424?v=4&s=117" width="117">](https://github.com/eddyb) |[<img alt="Fraser999" src="https://avatars3.githubusercontent.com/u/190532?v=4&s=117" width="117">](https://github.com/Fraser999) |[<img alt="birkenfeld" src="https://avatars0.githubusercontent.com/u/144359?v=4&s=117" width="117">](https://github.com/birkenfeld) |[<img alt="guanqun" src="https://avatars0.githubusercontent.com/u/53862?v=4&s=117" width="117">](https://github.com/guanqun) |[<img alt="tanakh" src="https://avatars2.githubusercontent.com/u/109069?v=4&s=117" width="117">](https://github.com/tanakh) |[<img alt="SirVer" src="https://avatars0.githubusercontent.com/u/140115?v=4&s=117" width="117">](https://github.com/SirVer) | :---: |:---: |:---: |:---: |:---: |:---: | -[eddyb](https://github.com/eddyb) |[birkenfeld](https://github.com/birkenfeld) |[guanqun](https://github.com/guanqun) |[tanakh](https://github.com/tanakh) |[SirVer](https://github.com/SirVer) |[idmit](https://github.com/idmit) | +[eddyb](https://github.com/eddyb) |[Fraser999](https://github.com/Fraser999) |[birkenfeld](https://github.com/birkenfeld) |[guanqun](https://github.com/guanqun) |[tanakh](https://github.com/tanakh) |[SirVer](https://github.com/SirVer) | -[<img alt="archer884" src="https://avatars1.githubusercontent.com/u/679494?v=4&s=117" width="117">](https://github.com/archer884) |[<img alt="jacobmischka" src="https://avatars1.githubusercontent.com/u/3939997?v=4&s=117" width="117">](https://github.com/jacobmischka) |[<img alt="jespino" src="https://avatars0.githubusercontent.com/u/290303?v=4&s=117" width="117">](https://github.com/jespino) |[<img alt="jtdowney" src="https://avatars1.githubusercontent.com/u/44654?v=4&s=117" width="117">](https://github.com/jtdowney) |[<img alt="andete" src="https://avatars2.githubusercontent.com/u/689017?v=4&s=117" width="117">](https://github.com/andete) |[<img alt="jdanford" src="https://avatars2.githubusercontent.com/u/5767112?v=4&s=117" width="117">](https://github.com/jdanford) | +[<img alt="idmit" src="https://avatars1.githubusercontent.com/u/2546728?v=4&s=117" width="117">](https://github.com/idmit) |[<img alt="archer884" src="https://avatars1.githubusercontent.com/u/679494?v=4&s=117" width="117">](https://github.com/archer884) |[<img alt="jacobmischka" src="https://avatars1.githubusercontent.com/u/3939997?v=4&s=117" width="117">](https://github.com/jacobmischka) |[<img alt="jespino" src="https://avatars0.githubusercontent.com/u/290303?v=4&s=117" width="117">](https://github.com/jespino) |[<img alt="jfrankenau" src="https://avatars3.githubusercontent.com/u/2736480?v=4&s=117" width="117">](https://github.com/jfrankenau) |[<img alt="jtdowney" src="https://avatars1.githubusercontent.com/u/44654?v=4&s=117" width="117">](https://github.com/jtdowney) | :---: |:---: |:---: |:---: |:---: |:---: | -[archer884](https://github.com/archer884) |[jacobmischka](https://github.com/jacobmischka) |[jespino](https://github.com/jespino) |[jtdowney](https://github.com/jtdowney) |[andete](https://github.com/andete) |[jdanford](https://github.com/jdanford) | +[idmit](https://github.com/idmit) |[archer884](https://github.com/archer884) |[jacobmischka](https://github.com/jacobmischka) |[jespino](https://github.com/jespino) |[jfrankenau](https://github.com/jfrankenau) |[jtdowney](https://github.com/jtdowney) | -[<img alt="joshtriplett" src="https://avatars2.githubusercontent.com/u/162737?v=4&s=117" width="117">](https://github.com/joshtriplett) |[<img alt="Kalwyn" src="https://avatars3.githubusercontent.com/u/22778640?v=4&s=117" width="117">](https://github.com/Kalwyn) |[<img alt="manuel-rhdt" src="https://avatars1.githubusercontent.com/u/3199013?v=4&s=117" width="117">](https://github.com/manuel-rhdt) |[<img alt="malbarbo" src="https://avatars3.githubusercontent.com/u/1678126?v=4&s=117" width="117">](https://github.com/malbarbo) |[<img alt="Marwes" src="https://avatars3.githubusercontent.com/u/957312?v=4&s=117" width="117">](https://github.com/Marwes) |[<img alt="mdaffin" src="https://avatars1.githubusercontent.com/u/171232?v=4&s=117" width="117">](https://github.com/mdaffin) | +[<img alt="andete" src="https://avatars2.githubusercontent.com/u/689017?v=4&s=117" width="117">](https://github.com/andete) |[<img alt="joshtriplett" src="https://avatars2.githubusercontent.com/u/162737?v=4&s=117" width="117">](https://github.com/joshtriplett) |[<img alt="Kalwyn" src="https://avatars3.githubusercontent.com/u/22778640?v=4&s=117" width="117">](https://github.com/Kalwyn) |[<img alt="manuel-rhdt" src="https://avatars1.githubusercontent.com/u/3199013?v=4&s=117" width="117">](https://github.com/manuel-rhdt) |[<img alt="Marwes" src="https://avatars3.githubusercontent.com/u/957312?v=4&s=117" width="117">](https://github.com/Marwes) |[<img alt="mdaffin" src="https://avatars1.githubusercontent.com/u/171232?v=4&s=117" width="117">](https://github.com/mdaffin) | :---: |:---: |:---: |:---: |:---: |:---: | -[joshtriplett](https://github.com/joshtriplett) |[Kalwyn](https://github.com/Kalwyn) |[manuel-rhdt](https://github.com/manuel-rhdt) |[malbarbo](https://github.com/malbarbo) |[Marwes](https://github.com/Marwes) |[mdaffin](https://github.com/mdaffin) | +[andete](https://github.com/andete) |[joshtriplett](https://github.com/joshtriplett) |[Kalwyn](https://github.com/Kalwyn) |[manuel-rhdt](https://github.com/manuel-rhdt) |[Marwes](https://github.com/Marwes) |[mdaffin](https://github.com/mdaffin) | [<img alt="iliekturtles" src="https://avatars3.githubusercontent.com/u/5081378?v=4&s=117" width="117">](https://github.com/iliekturtles) |[<img alt="nicompte" src="https://avatars2.githubusercontent.com/u/439369?v=4&s=117" width="117">](https://github.com/nicompte) |[<img alt="NickeZ" src="https://avatars2.githubusercontent.com/u/492753?v=4&s=117" width="117">](https://github.com/NickeZ) |[<img alt="nvzqz" src="https://avatars0.githubusercontent.com/u/10367662?v=4&s=117" width="117">](https://github.com/nvzqz) |[<img alt="nuew" src="https://avatars2.githubusercontent.com/u/26099511?v=4&s=117" width="117">](https://github.com/nuew) |[<img alt="Geogi" src="https://avatars1.githubusercontent.com/u/1818316?v=4&s=117" width="117">](https://github.com/Geogi) | :---: |:---: |:---: |:---: |:---: |:---: | [iliekturtles](https://github.com/iliekturtles) |[nicompte](https://github.com/nicompte) |[NickeZ](https://github.com/NickeZ) |[nvzqz](https://github.com/nvzqz) |[nuew](https://github.com/nuew) |[Geogi](https://github.com/Geogi) | -[<img alt="flying-sheep" src="https://avatars0.githubusercontent.com/u/291575?v=4&s=117" width="117">](https://github.com/flying-sheep) |[<img alt="Phlosioneer" src="https://avatars2.githubusercontent.com/u/4657718?v=4&s=117" width="117">](https://github.com/Phlosioneer) |[<img alt="peppsac" src="https://avatars3.githubusercontent.com/u/2198295?v=4&s=117" width="117">](https://github.com/peppsac) |[<img alt="golddranks" src="https://avatars1.githubusercontent.com/u/2675542?v=4&s=117" width="117">](https://github.com/golddranks) |[<img alt="hexjelly" src="https://avatars0.githubusercontent.com/u/435283?v=4&s=117" width="117">](https://github.com/hexjelly) |[<img alt="rnelson" src="https://avatars3.githubusercontent.com/u/118361?v=4&s=117" width="117">](https://github.com/rnelson) | +[<img alt="focusaurus" src="https://avatars1.githubusercontent.com/u/482377?v=4&s=117" width="117">](https://github.com/focusaurus) |[<img alt="flying-sheep" src="https://avatars0.githubusercontent.com/u/291575?v=4&s=117" width="117">](https://github.com/flying-sheep) |[<img alt="Phlosioneer" src="https://avatars2.githubusercontent.com/u/4657718?v=4&s=117" width="117">](https://github.com/Phlosioneer) |[<img alt="peppsac" src="https://avatars3.githubusercontent.com/u/2198295?v=4&s=117" width="117">](https://github.com/peppsac) |[<img alt="golddranks" src="https://avatars1.githubusercontent.com/u/2675542?v=4&s=117" width="117">](https://github.com/golddranks) |[<img alt="hexjelly" src="https://avatars0.githubusercontent.com/u/435283?v=4&s=117" width="117">](https://github.com/hexjelly) | :---: |:---: |:---: |:---: |:---: |:---: | -[flying-sheep](https://github.com/flying-sheep) |[Phlosioneer](https://github.com/Phlosioneer) |[peppsac](https://github.com/peppsac) |[golddranks](https://github.com/golddranks) |[hexjelly](https://github.com/hexjelly) |[rnelson](https://github.com/rnelson) | +[focusaurus](https://github.com/focusaurus) |[flying-sheep](https://github.com/flying-sheep) |[Phlosioneer](https://github.com/Phlosioneer) |[peppsac](https://github.com/peppsac) |[golddranks](https://github.com/golddranks) |[hexjelly](https://github.com/hexjelly) | -[<img alt="swatteau" src="https://avatars3.githubusercontent.com/u/5521255?v=4&s=117" width="117">](https://github.com/swatteau) |[<img alt="tspiteri" src="https://avatars0.githubusercontent.com/u/18604588?v=4&s=117" width="117">](https://github.com/tspiteri) |[<img alt="vks" src="https://avatars2.githubusercontent.com/u/33460?v=4&s=117" width="117">](https://github.com/vks) |[<img alt="th4t" src="https://avatars2.githubusercontent.com/u/2801030?v=4&s=117" width="117">](https://github.com/th4t) |[<img alt="mineo" src="https://avatars1.githubusercontent.com/u/78236?v=4&s=117" width="117">](https://github.com/mineo) |[<img alt="wabain" src="https://avatars3.githubusercontent.com/u/7651435?v=4&s=117" width="117">](https://github.com/wabain) | +[<img alt="rnelson" src="https://avatars3.githubusercontent.com/u/118361?v=4&s=117" width="117">](https://github.com/rnelson) |[<img alt="swatteau" src="https://avatars3.githubusercontent.com/u/5521255?v=4&s=117" width="117">](https://github.com/swatteau) |[<img alt="tspiteri" src="https://avatars0.githubusercontent.com/u/18604588?v=4&s=117" width="117">](https://github.com/tspiteri) |[<img alt="siiptuo" src="https://avatars0.githubusercontent.com/u/10729330?v=4&s=117" width="117">](https://github.com/siiptuo) |[<img alt="vks" src="https://avatars2.githubusercontent.com/u/33460?v=4&s=117" width="117">](https://github.com/vks) |[<img alt="vsupalov" src="https://avatars2.githubusercontent.com/u/2801030?v=4&s=117" width="117">](https://github.com/vsupalov) | :---: |:---: |:---: |:---: |:---: |:---: | -[swatteau](https://github.com/swatteau) |[tspiteri](https://github.com/tspiteri) |[vks](https://github.com/vks) |[th4t](https://github.com/th4t) |[mineo](https://github.com/mineo) |[wabain](https://github.com/wabain) | +[rnelson](https://github.com/rnelson) |[swatteau](https://github.com/swatteau) |[tspiteri](https://github.com/tspiteri) |[siiptuo](https://github.com/siiptuo) |[vks](https://github.com/vks) |[vsupalov](https://github.com/vsupalov) | -[<img alt="grossws" src="https://avatars2.githubusercontent.com/u/171284?v=4&s=117" width="117">](https://github.com/grossws) |[<img alt="kennytm" src="https://avatars1.githubusercontent.com/u/103023?v=4&s=117" width="117">](https://github.com/kennytm) |[<img alt="mvaude" src="https://avatars1.githubusercontent.com/u/9532611?v=4&s=117" width="117">](https://github.com/mvaude) |[<img alt="panicbit" src="https://avatars2.githubusercontent.com/u/628445?v=4&s=117" width="117">](https://github.com/panicbit) |[<img alt="ogham" src="https://avatars3.githubusercontent.com/u/503760?v=4&s=117" width="117">](https://github.com/ogham) | -:---: |:---: |:---: |:---: |:---: | -[grossws](https://github.com/grossws) |[kennytm](https://github.com/kennytm) |[mvaude](https://github.com/mvaude) |[panicbit](https://github.com/panicbit) |[ogham](https://github.com/ogham) | +[<img alt="mineo" src="https://avatars1.githubusercontent.com/u/78236?v=4&s=117" width="117">](https://github.com/mineo) |[<img alt="wabain" src="https://avatars3.githubusercontent.com/u/7651435?v=4&s=117" width="117">](https://github.com/wabain) |[<img alt="grossws" src="https://avatars2.githubusercontent.com/u/171284?v=4&s=117" width="117">](https://github.com/grossws) |[<img alt="kennytm" src="https://avatars1.githubusercontent.com/u/103023?v=4&s=117" width="117">](https://github.com/kennytm) |[<img alt="mvaude" src="https://avatars1.githubusercontent.com/u/9532611?v=4&s=117" width="117">](https://github.com/mvaude) |[<img alt="panicbit" src="https://avatars2.githubusercontent.com/u/628445?v=4&s=117" width="117">](https://github.com/panicbit) | +:---: |:---: |:---: |:---: |:---: |:---: | +[mineo](https://github.com/mineo) |[wabain](https://github.com/wabain) |[grossws](https://github.com/grossws) |[kennytm](https://github.com/kennytm) |[mvaude](https://github.com/mvaude) |[panicbit](https://github.com/panicbit) | + +[<img alt="mitsuhiko" src="https://avatars1.githubusercontent.com/u/7396?v=4&s=117" width="117">](https://github.com/mitsuhiko) | +:---: | +[mitsuhiko](https://github.com/mitsuhiko) | diff --git a/src/vendor/clap/Cargo.toml b/src/vendor/clap/Cargo.toml index 1d3f577b51..1d429af726 100644 --- a/src/vendor/clap/Cargo.toml +++ b/src/vendor/clap/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "clap" -version = "2.27.1" +version = "2.29.0" authors = ["Kevin K. <kbknapp@gmail.com>"] exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"] description = "A simple to use, efficient, and full featured Command Line Argument Parser\n" @@ -22,7 +22,7 @@ readme = "README.md" keywords = ["argument", "command", "arg", "parser", "parse"] categories = ["command-line-interface"] license = "MIT" -repository = "https://github.com/kbknapp/clap-rs.git" +repository = "https://github.com/kbknapp/clap-rs" [package.metadata.docs.rs] features = ["doc"] [profile.test] @@ -62,63 +62,63 @@ lto = true debug = false debug-assertions = false rpath = false -[dependencies.bitflags] -version = "0.9" - -[dependencies.clippy] -version = "~0.0.166" -optional = true - [dependencies.ansi_term] -version = "0.9.0" -optional = true - -[dependencies.vec_map] -version = "0.8" -optional = true - -[dependencies.strsim] -version = "0.6.0" +version = "0.10.0" optional = true [dependencies.atty] version = "0.2.2" optional = true -[dependencies.unicode-width] -version = "0.1.4" +[dependencies.bitflags] +version = "1.0" -[dependencies.textwrap] -version = "0.9.0" +[dependencies.clippy] +version = "~0.0.166" +optional = true + +[dependencies.strsim] +version = "0.6.0" +optional = true [dependencies.term_size] version = "0.3.0" optional = true +[dependencies.textwrap] +version = "0.9.0" + +[dependencies.unicode-width] +version = "0.1.4" + +[dependencies.vec_map] +version = "0.8" +optional = true + [dependencies.yaml-rust] version = "0.3.5" optional = true +[dev-dependencies.lazy_static] +version = "1" + [dev-dependencies.regex] version = "0.2" -[dev-dependencies.lazy_static] -version = "0.2" - [dev-dependencies.version-sync] -version = "0.3" +version = "0.5" [features] -debug = [] -no_cargo = [] -yaml = ["yaml-rust"] -nightly = [] color = ["ansi_term", "atty"] -suggestions = ["strsim"] +debug = [] default = ["suggestions", "color", "vec_map"] -wrap_help = ["term_size", "textwrap/term_size"] -lints = ["clippy"] -unstable = [] doc = ["yaml"] +lints = ["clippy"] +nightly = [] +no_cargo = [] +suggestions = ["strsim"] +unstable = [] +wrap_help = ["term_size", "textwrap/term_size"] +yaml = ["yaml-rust"] [badges.appveyor] repository = "kbknapp/clap-rs" diff --git a/src/vendor/clap/Cargo.toml.orig b/src/vendor/clap/Cargo.toml.orig index fda47f50b3..63e9922b97 100644 --- a/src/vendor/clap/Cargo.toml.orig +++ b/src/vendor/clap/Cargo.toml.orig @@ -1,10 +1,10 @@ [package] name = "clap" -version = "2.27.1" +version = "2.29.0" authors = ["Kevin K. <kbknapp@gmail.com>"] exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"] -repository = "https://github.com/kbknapp/clap-rs.git" +repository = "https://github.com/kbknapp/clap-rs" documentation = "https://docs.rs/clap/" homepage = "https://clap.rs/" readme = "README.md" @@ -20,11 +20,11 @@ travis-ci = { repository = "kbknapp/clap-rs" } appveyor = { repository = "kbknapp/clap-rs" } [dependencies] -bitflags = "0.9" +bitflags = "1.0" unicode-width = "0.1.4" textwrap = "0.9.0" strsim = { version = "0.6.0", optional = true } -ansi_term = { version = "0.9.0", optional = true } +ansi_term = { version = "0.10.0", optional = true } yaml-rust = { version = "0.3.5", optional = true } clippy = { version = "~0.0.166", optional = true } atty = { version = "0.2.2", optional = true } @@ -33,8 +33,8 @@ term_size = { version = "0.3.0", optional = true } [dev-dependencies] regex = "0.2" -lazy_static = "0.2" -version-sync = "0.3" +lazy_static = "1" +version-sync = "0.5" [features] default = ["suggestions", "color", "vec_map"] diff --git a/src/vendor/clap/README.md b/src/vendor/clap/README.md index c383b7bdff..eb488a59fc 100644 --- a/src/vendor/clap/README.md +++ b/src/vendor/clap/README.md @@ -10,9 +10,9 @@ Command Line Argument Parser for Rust It is a simple-to-use, efficient, and full-featured library for parsing command line arguments and subcommands when writing console/terminal applications. -## [documentation](https://docs.rs/clap/) -## [website](https://clap.rs/) -## [blog](https://blog.clap.rs/) +* [documentation](https://docs.rs/clap/) +* [website](https://clap.rs/) +* [video tutorials](https://www.youtube.com/playlist?list=PLza5oFLQGTl2Z5T8g1pRkIynR3E0_pc7U) Table of Contents ================= @@ -31,12 +31,9 @@ Table of Contents * [More Information](#more-information) * [Video Tutorials](#video-tutorials) * [How to Contribute](#how-to-contribute) - * [Testing Code](#testing-code) - * [Linting Code](#linting-code) - * [Debugging Code](#debugging-code) - * [Goals](#goals) * [Compatibility Policy](#compatibility-policy) * [Minimum Version of Rust](#minimum-version-of-rust) +* [Related Crates](#related-crates) * [License](#license) * [Recent Breaking Changes](#recent-breaking-changes) * [Deprecations](#deprecations) @@ -45,114 +42,35 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) ## What's New -Here's whats new in 2.27.1: +Here's whats new in 2.29.0: -** This release also contains a very minor breaking change to fix a bug ** +* **Arg:** adds Arg::hide_env_values(bool) which allows one to hide any current env values and display only the key in help messages -The only CLIs affected will be those using unrestrained multiple values and subcommands where the -subcommand name can coincide with one of the multiple values. +Here's whats new in 2.28.0: -See the commit [0c223f54](https://github.com/kbknapp/clap-rs/commit/0c223f54ed46da406bc8b43a5806e0b227863b31) for full details. +The minimum required Rust is now 1.20. This was done to start using bitflags 1.0 and having >1.0 deps is a *very good* thing! -* Adds `term_size` as an optional dependency (with feature `wrap_help`) to fix compile bug -* **The minimum required version of Rust is now 1.18.0 (Stable)** -* Values from global args are now propagated UP and DOWN! -* fixes a bug where using AppSettings::AllowHyphenValues would allow invalid arguments even when there is no way for them to be valid -* when an argument requires a value and that value happens to match a subcommand name, its parsed as a value -* fixes a bug that prevented number_of_values and default_values to be used together -* fixes a bug that didn't allow args with default values to have conflicts -* fixes a panic when using global args and calling App::get_matches_from_safe_borrow multiple times -* fixes issues and potential regressions with global args values not being propagated properly or at all -* fixes a bug where default values are not applied if the option supports zero values -* adds addtional blurbs about using multiples with subcommands -* updates the docs to reflect changes to global args and that global args values can now be propagated back up the stack -* add html_root_url attribute -* sync README version numbers with crate version -* args that have require_delimiter(true) is now reflected in help and usage strings -* if all subcommands are hidden, the subcommands section of the help message is no longer displayed -* fixes when an argument requires a value and that value happens to match a subcommand name, its parsed as a value -* **AppSettings::PropagateGlobalValuesDown:** this setting deprecated and is no longer required to propagate values down or up - -Here's the highlights for v2.21.0 to v2.26.2 - -* if all subcommands are hidden, the subcommands section of the help message is no longer displayed -* fixes a bug where default values are not applied if the option supports zero values -* fixes using require_equals(true) and min_values(0) together -* escape special characters in zsh and fish completions -* avoid panic generating default help msg if term width set to 0 due to bug in textwrap 0.7.0 -* Change `who's` -> `whose` in documentation -* **Help Message:** fixes `App::long_about` not being displayed -* **Suggestions:** output for flag after subcommand -* **The minimum required version of Rust is now 1.13.0 (Stable)** -* bumps unicode-segmentation to v1.2 -* update textwrap to version 0.7.0 which increases the performance of writing help strings -* impl Default for Values + OsValues for any lifetime. -* use textwrap crate for wrapping help texts -* suggests to use flag after subcommand when applicable -* Bumps bitflags crate to v0.9 -* fixes a bug where args that allow values to start with a hyphen couldnt contain a double hyphen -- as a value -* fixes a bug where positional argument help text is misaligned -* **App::template docs:** adds details about the necessity to use AppSettings::UnifiedHelpMessage when using {unified} tags in the help template -* **Arg::allow_hyphen_values docs:** updates the docs to include warnings for allow_hyphen_values and multiple(true) used together -* **clap_app! docs:** adds using the @group specifier to the macro docs -* adds a debug assertion to ensure all args added to groups actually exist -* fixes a bug where args with last(true) and required(true) set were not being printed in the usage string -* fixes a bug that was printing the arg name, instead of value name when Arg::last(true) was used -* fixes a bug where flags were parsed as flags AND positional values when specific combinations of settings were used -* **README.md:** fix some typos -* **Arg:** add `default_value_os` -* **arg_matches.rs:** Added a Default implementation for Values and OsValues iterators. -* **PowerShell Completions:** - * fixes a bug where powershells completions cant be used if no subcommands are defined - * massively dedups subcommand names in the generate script to make smaller scripts that are still functionally equiv -* allows specifying a short help vs a long help (i.e. varying levels of detail depending on if -h or --help was used) -* **clap_app!:** adds support for arg names with hyphens similar to longs with hyphens -* fixes a bug that wasn't allowing help and version to be properly overridden - * This may break code that was relying on this bug! If you add a flag with a long of `help` manually *and* rely on the help message to be printed automatically your code could break. Please see the commit link in the full CHANGELOG.md -* `App::long_about` -* `App::long_version` -* `App::print_long_help` -* `App::write_long_help` -* `App::print_long_version` -* `App::write_long_version` -* `Arg::long_help` -* **clap_app!:** documents the `--("some-arg")` method for using args with hyphens inside them -* fixes the usage string regression when using help templates -* fixes a big regression with custom usage strings -* adds the ability to change the name of the App instance after creation -* adds ability to hide the default value of an argument from the help string -* fixes support for loading author info from yaml -* adds fish subcommand help support -* options that use `require_equals(true)` now display the equals sign in help messages, usage strings, and errors -* setting the max term width now correctly propagates down through child subcommands -* fixes the precedence of this error to prioritize over other error messages -* fixes some regression bugs resulting from old asserts in debug mode. -* adds the ability to mark a positional argument as 'last' which means it should be used with `--` syntax and can be accessed early to effectivly skip other positional args -* Some performance improvements by reducing the ammount of duplicate work, cloning, and allocations in all cases. -* Some massive performance gains when using many args (i.e. things like shell glob expansions) -* adds a setting to allow one to infer shortened subcommands or aliases (i.e. for subcommmand "test", "t", "te", or "tes" would be allowed assuming no other ambiguities) -* when `AppSettings::SubcommandsNegateReqs` and `ArgsNegateSubcommands` are used, a new more accurate double line usage string is shown -* provides `default_value_os` and `default_value_if[s]_os` -* provides `App::help_message` and `App::version_message` which allows one to override the auto-generated help/version flag associated help -* adds the ability to require the equals syntax with options `--opt=val` -* doesn't print the argument sections in the help message if all args in that section are hidden -* doesn't include the various `[ARGS]` `[FLAGS]` or `[OPTIONS]` if the only ones available are hidden -* now correctly shows subcommand as required in the usage string when AppSettings::SubcommandRequiredElseHelp is used -* fixes some "memory leaks" when an error is detected and clap exits -* fixes a trait that's marked private accidentlly, but should be crate internal public -* fixes a bug that tried to propogate global args multiple times when generating multiple completion scripts -* Fixes a critical bug in the `clap_app!` macro of a missing fragment specifier when using `!property` style tags. -* Fix examples link in CONTRIBUTING.md +* Updates `bitflags` to 1.0 +* Adds the traits to be used with the `clap-derive` crate to be able to use Custom Derive (for now must be accessed with `unstable` feature flag) +* Adds Arg::case_insensitive(bool) which allows matching Arg::possible_values without worrying about ASCII case +* Fixes a regression where --help couldn't be overridden +* adds '[SUBCOMMAND]' to usage strings with only AppSettings::AllowExternalSubcommands is used with no other subcommands +* uses `.bash` for Bash completion scripts now instead of `.bash-completion` due to convention and `.bash-completion` not being supported by completion projects +* Fix URL path to github hosted files +* fix typos in docs +* **README.md:** updates the readme and pulls out some redundant sections +* fixes a bug that allowed options to pass parsing when no value was provided +* ignore PropagateGlobalValuesDown deprecation warning For full details, see [CHANGELOG.md](https://github.com/kbknapp/clap-rs/blob/master/CHANGELOG.md) ## About -`clap` is used to parse *and validate* the string of command line arguments provided by the user at runtime. You provide the list of valid possibilities, and `clap` handles the rest. This means you focus on your *applications* functionality, and less on the parsing and validating of arguments. +`clap` is used to parse *and validate* the string of command line arguments provided by a user at runtime. You provide the list of valid possibilities, and `clap` handles the rest. This means you focus on your *applications* functionality, and less on the parsing and validating of arguments. -`clap` also provides the traditional version and help switches (or flags) 'for free' meaning automatically with no configuration. It does this by checking list of valid possibilities you supplied and adding only the ones you haven't already defined. If you are using subcommands, `clap` will also auto-generate a `help` subcommand for you in addition to the traditional flags. +`clap` provides many things 'for free' (with no configuration) including the traditional version and help switches (or flags) along with associated messages. If you are using subcommands, `clap` will also auto-generate a `help` subcommand and separate associated help messages. -Once `clap` parses the user provided string of arguments, it returns the matches along with any applicable values. If the user made an error or typo, `clap` informs them of the mistake and exits gracefully (or returns a `Result` type and allows you to perform any clean up prior to exit). Because of this, you can make reasonable assumptions in your code about the validity of the arguments. +Once `clap` parses the user provided string of arguments, it returns the matches along with any applicable values. If the user made an error or typo, `clap` informs them with a friendly message and exits gracefully (or returns a `Result` type and allows you to perform any clean up prior to exit). Because of this, you can make reasonable assumptions in your code about the validity of the arguments prior to your applications main execution. ## FAQ @@ -178,17 +96,21 @@ I first want to say I'm a big a fan of BurntSushi's work, the creator of `Docopt Because `docopt` is doing a ton of work to parse your help messages and determine what you were trying to communicate as valid arguments, it's also one of the more heavy weight parsers performance-wise. For most applications this isn't a concern and this isn't to say `docopt` is slow, in fact far from it. This is just something to keep in mind while comparing. -#### All else being equal, what are some reasons to use `clap`? +#### All else being equal, what are some reasons to use `clap`? (The Pitch) `clap` is as fast, and as lightweight as possible while still giving all the features you'd expect from a modern argument parser. In fact, for the amount and type of features `clap` offers it remains about as fast as `getopts`. If you use `clap` when just need some simple arguments parsed, you'll find it's a walk in the park. `clap` also makes it possible to represent extremely complex, and advanced requirements, without too much thought. `clap` aims to be intuitive, easy to use, and fully capable for wide variety use cases and needs. +#### All else being equal, what are some reasons *not* to use `clap`? (The Anti Pitch) + +Depending on the style in which you choose to define the valid arguments, `clap` can be very verbose. `clap` also offers so many finetuning knobs and dials, that learning everything can seem overwhelming. I strive to keep the simple cases simple, but when turning all those custom dials it can get complex. `clap` is also opinionated about parsing. Even though so much can be tweaked and tuned with `clap` (and I'm adding more all the time), there are still certain features which `clap` implements in specific ways which may be contrary to some users use-cases. Finally, `clap` is "stringly typed" when referring to arguments which can cause typos in code. This particular paper-cut is being actively worked on, and should be gone in v3.x. + ## Features Below are a few of the features which `clap` supports, full descriptions and usage can be found in the [documentation](https://docs.rs/clap/) and [examples/](examples) directory * **Auto-generated Help, Version, and Usage information** - - Can optionally be fully, or partially overridden if you want a custom help, version, or usage -* **Auto-generated bash completion scripts at compile time** + - Can optionally be fully, or partially overridden if you want a custom help, version, or usage statements +* **Auto-generated completion scripts at compile time (Bash, Zsh, Fish, and PowerShell)** - Even works through many multiple levels of subcommands - Works with options which only accept certain values - Works with subcommand aliases @@ -217,6 +139,7 @@ Below are a few of the features which `clap` supports, full descriptions and usa - Can be required by default - Can be required only if certain arguments are present - Can require other arguments to be present + - Can be required only if certain values of other arguments are used * **Confliction Rules**: Arguments can optionally define the following types of exclusion rules - Can be disallowed when certain arguments are present - Can disallow use of other arguments when present @@ -224,11 +147,12 @@ Below are a few of the features which `clap` supports, full descriptions and usa - Fully compatible with other relational rules (requirements, conflicts, and overrides) which allows things like requiring the use of any arg in a group, or denying the use of an entire group conditionally * **Specific Value Sets**: Positional or Option Arguments can define a specific set of allowed values (i.e. imagine a `--mode` option which may *only* have one of two values `fast` or `slow` such as `--mode fast` or `--mode slow`) * **Default Values** + - Also supports conditional default values (i.e. a default which only applies if specific arguments are used, or specific values of those arguments) * **Automatic Version from Cargo.toml**: `clap` is fully compatible with Rust's `env!()` macro for automatically setting the version of your application to the version in your Cargo.toml. See [09_auto_version example](examples/09_auto_version.rs) for how to do this (Thanks to [jhelwig](https://github.com/jhelwig) for pointing this out) * **Typed Values**: You can use several convenience macros provided by `clap` to get typed values (i.e. `i32`, `u8`, etc.) from positional or option arguments so long as the type you request implements `std::str::FromStr` See the [12_typed_values example](examples/12_typed_values.rs). You can also use `clap`s `arg_enum!` macro to create an enum with variants that automatically implement `std::str::FromStr`. See [13a_enum_values_automatic example](examples/13a_enum_values_automatic.rs) for details * **Suggestions**: Suggests corrections when the user enters a typo. For example, if you defined a `--myoption` argument, and the user mistakenly typed `--moyption` (notice `y` and `o` transposed), they would receive a `Did you mean '--myoption'?` error and exit gracefully. This also works for subcommands and flags. (Thanks to [Byron](https://github.com/Byron) for the implementation) (This feature can optionally be disabled, see 'Optional Dependencies / Features') * **Colorized Errors (Non Windows OS only)**: Error message are printed in in colored text (this feature can optionally be disabled, see 'Optional Dependencies / Features'). -* **Global Arguments**: Arguments can optionally be defined once, and be available to all child subcommands. +* **Global Arguments**: Arguments can optionally be defined once, and be available to all child subcommands. There values will also be propagated up/down throughout all subcommands. * **Custom Validations**: You can define a function to use as a validator of argument values. Imagine defining a function to validate IP addresses, or fail parsing upon error. This means your application logic can be solely focused on *using* values. * **POSIX Compatible Conflicts/Overrides** - In POSIX args can be conflicting, but not fail parsing because whichever arg comes *last* "wins" so to speak. This allows things such as aliases (i.e. `alias ls='ls -l'` but then using `ls -C` in your terminal which ends up passing `ls -l -C` as the final arguments. Since `-l` and `-C` aren't compatible, this effectively runs `ls -C` in `clap` if you choose...`clap` also supports hard conflicts that fail parsing). (Thanks to [Vinatorul](https://github.com/Vinatorul)!) * Supports the Unix `--` meaning, only positional arguments follow @@ -237,9 +161,9 @@ Below are a few of the features which `clap` supports, full descriptions and usa The following examples show a quick example of some of the very basic functionality of `clap`. For more advanced usage, such as requirements, conflicts, groups, multiple values and occurrences see the [documentation](https://docs.rs/clap/), [examples/](examples) directory of this repository or the [video tutorials](https://www.youtube.com/playlist?list=PLza5oFLQGTl2Z5T8g1pRkIynR3E0_pc7U). - **NOTE:** All of these examples are functionally the same, but show different styles in which to use `clap` + **NOTE:** All of these examples are functionally the same, but show different styles in which to use `clap`. These different styles are purely a matter of personal preference. -The first example shows a method that allows more advanced configuration options (not shown in this small example), or even dynamically generating arguments when desired. The downside is it's more verbose. +The first example shows a method using the 'Builder Pattern' which allows more advanced configuration options (not shown in this small example), or even dynamically generating arguments when desired. The downside is it's more verbose. ```rust // (Full example with detailed comments in examples/01b_quick_example.rs) @@ -377,9 +301,9 @@ subcommands: Since this feature requires additional dependencies that not everyone may want, it is *not* compiled in by default and we need to enable a feature flag in Cargo.toml: -Simply change your `clap = "2.27"` to `clap = {version = "2.27", features = ["yaml"]}`. +Simply change your `clap = "2.29"` to `clap = {version = "2.87", features = ["yaml"]}`. -At last we create our `main.rs` file just like we would have with the previous two examples: +Finally we create our `main.rs` file just like we would have with the previous two examples: ```rust // (Full example with detailed comments in examples/17_yaml.rs) @@ -399,7 +323,7 @@ fn main() { } ``` -Finally there is a macro version, which is like a hybrid approach offering the speed of the builder pattern (the first example), but without all the verbosity. +Last but not least there is a macro version, which is like a hybrid approach offering the runtime speed of the builder pattern (the first example), but without all the verbosity. ```rust #[macro_use] @@ -437,7 +361,7 @@ USAGE: MyApp [FLAGS] [OPTIONS] <INPUT> [SUBCOMMAND] FLAGS: - -h, --help Prints this message + -h, --help Prints help information -v Sets the level of verbosity -V, --version Prints version information @@ -448,22 +372,23 @@ ARGS: INPUT The input file to use SUBCOMMANDS: - help Prints this message + help Prints this message or the help of the given subcommand(s) test Controls testing features ``` -**NOTE:** You could also run `myapp test --help` to see similar output and options for the `test` subcommand. +**NOTE:** You could also run `myapp test --help` or `myapp help test` to see the help message for the `test` subcommand. ## Try it! ### Pre-Built Test -To try out the pre-built example, use the following steps: +To try out the pre-built examples, use the following steps: -* Clone the repository `$ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/tests` -* Compile the example `$ cargo build --release` -* Run the help info `$ ./target/release/claptests --help` +* Clone the repository `$ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/` +* Compile the example `$ cargo build --example <EXAMPLE>` +* Run the help info `$ ./target/debug/examples/<EXAMPLE> --help` * Play with the arguments! +* You can also do a onetime run via `$ cargo run --example <EXAMPLE> -- [args to example] ### BYOB (Build Your Own Binary) @@ -496,7 +421,7 @@ For full usage, add `clap` as a dependency in your `Cargo.toml` () to use from c ```toml [dependencies] -clap = "~2.27" +clap = "~2.29" ``` (**note**: If you are concerned with supporting a minimum version of Rust that is *older* than the current stable Rust minus 2 stable releases, it's recommended to use the `~major.minor.patch` style versions in your `Cargo.toml` which will only update the patch version automatically. For more information see the [Compatibility Policy](#compatibility-policy)) @@ -513,14 +438,13 @@ Then run `cargo build` or `cargo update && cargo build` for your project. * **"suggestions"**: Turns on the `Did you mean '--myoption'?` feature for when users make typos. (builds dependency `strsim`) * **"color"**: Turns on colored error messages. This feature only works on non-Windows OSs. (builds dependency `ansi-term`) -* **"wrap_help"**: Wraps the help at the actual terminal width when available, instead of 120 characters. (builds dependency `term_size`) * **"vec_map"**: Use [`VecMap`](https://crates.io/crates/vec_map) internally instead of a [`BTreeMap`](https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html). This feature provides a _slight_ performance improvement. (builds dependency `vec_map`) To disable these, add this to your `Cargo.toml`: ```toml [dependencies.clap] -version = "2.27" +version = "2.29" default-features = false ``` @@ -528,7 +452,7 @@ You can also selectively enable only the features you'd like to include, by addi ```toml [dependencies.clap] -version = "2.27" +version = "2.29" default-features = false # Cherry-pick the features you'd like to use @@ -564,85 +488,7 @@ These videos slowly trickle out as I finish them and currently a work in progres ## How to Contribute -Contributions are always welcome! And there is a multitude of ways in which you can help depending on what you like to do, or are good at. Anything from documentation, code cleanup, issue completion, new features, you name it, even filing issues is contributing and greatly appreciated! - -Another really great way to help is if you find an interesting, or helpful way in which to use `clap`. You can either add it to the [examples/](examples) directory, or file an issue and tell me. I'm all about giving credit where credit is due :) - -Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) before you start contributing. - - -### Testing Code - -To test with all features both enabled and disabled, you can run these commands: - -```sh -$ cargo test --no-default-features -$ cargo test --features "yaml unstable" -``` - -Alternatively, if you have [`just`](https://github.com/casey/just) installed you can run the prebuilt recipes. *Not* using `just` is perfectly fine as well, it simply bundles commands automatically. - -For example, to test the code, as above simply run: - -```sh -$ just run-tests -``` - -From here on, I will list the appropriate `cargo` command as well as the `just` command. - -Sometimes it's helpful to only run a subset of the tests, which can be done via: - -```sh -$ cargo test --test <test_name> - -# Or - -$ just run-test <test_name> -``` - -### Linting Code - -During the CI process `clap` runs against many different lints using [`clippy`](https://github.com/Manishearth/rust-clippy). In order to check if these lints pass on your own computer prior to submitting a PR you'll need a nightly compiler. - -In order to check the code for lints run either: - -```sh -$ rustup override add nightly -$ cargo build --features lints -$ rustup override remove - -# Or - -$ just lint -``` - -### Debugging Code - -Another helpful technique is to see the `clap` debug output while developing features. In order to see the debug output while running the full test suite or individual tests, run: - -```sh -$ cargo test --features debug - -# Or for individual tests -$ cargo test --test <test_name> --features debug - -# The corresponding just command for individual debugging tests is: -$ just debug <test_name> -``` - -### Goals - -There are a few goals of `clap` that I'd like to maintain throughout contributions. If your proposed changes break, or go against any of these goals we'll discuss the changes further before merging (but will *not* be ignored, all contributes are welcome!). These are by no means hard-and-fast rules, as I'm no expert and break them myself from time to time (even if by mistake or ignorance :P). - -* Remain backwards compatible when possible - - If backwards compatibility *must* be broken, use deprecation warnings if at all possible before removing legacy code - - This does not apply for security concerns -* Parse arguments quickly - - Parsing of arguments shouldn't slow down usage of the main program - - This is also true of generating help and usage information (although *slightly* less stringent, as the program is about to exit) -* Try to be cognizant of memory usage - - Once parsing is complete, the memory footprint of `clap` should be low since the main program is the star of the show -* `panic!` on *developer* error, exit gracefully on *end-user* error +Details on how to contribute can be found in the [CONTRIBUTING.md](.github/CONTRIBUTING.md) file. ### Compatibility Policy @@ -654,7 +500,7 @@ In order to keep from being surprised of breaking changes, it is **highly** reco ```toml [dependencies] -clap = "~2.27" +clap = "~2.29" ``` This will cause *only* the patch version to be updated upon a `cargo update` call, and therefore cannot break due to new features, or bumped minimum versions of Rust. @@ -671,12 +517,11 @@ Right now Cargo's version resolution is pretty naive, it's just a brute-force se # In one Cargo.toml [dependencies] -clap = "~2.27.0" +clap = "~2.29.0" # In another Cargo.toml [dependencies] -clap = "2.27" - +clap = "2.29" ``` This is inherently an unresolvable crate graph in Cargo right now. Cargo requires there's only one major version of a crate, and being in the same workspace these two crates must share a version. This is impossible in this location, though, as these version constraints cannot be met. @@ -701,10 +546,21 @@ Upon bumping the minimum version of Rust (assuming it's within the stable-2 rang `clap` is licensed under the MIT license. Please read the [LICENSE-MIT](LICENSE-MIT) file in this repository for more information. +## Related Crates + +There are several excellent crates which can be used with `clap`, I recommend checking them all out! If you've got a crate that would be a good fit to be used with `clap` open an issue and let me know, I'd love to add it! + +* [`structopt`](https://github.com/TeXitoi/structopt) - This crate allows you to define a struct, and build a CLI from it! No more "stringly typed" and it uses `clap` behind the scenes! (*Note*: There is work underway to pull this crate into mainline `clap`). +* [`assert_cli`](https://github.com/killercup/assert_cli) - This crate allows you test your CLIs in a very intuitive and functional way! + ## Recent Breaking Changes `clap` follows semantic versioning, so breaking changes should only happen upon major version bumps. The only exception to this rule is breaking changes that happen due to implementation that was deemed to be a bug, security concerns, or it can be reasonably proved to affect no code. For the full details, see [CHANGELOG.md](./CHANGELOG.md). +As of 2.27.0: + +* Argument values now take precedence over subcommand names. This only arises by using unrestrained multiple values and subcommands together where the subcommand name can coincide with one of the multiple values. Such as `$ prog <files>... <subcommand>`. The fix is to place restraints on number of values, or disallow the use of `$ prog <prog-args> <subcommand>` structure. + As of 2.0.0 (From 1.x) * **Fewer lifetimes! Yay!** diff --git a/src/vendor/clap/src/app/help.rs b/src/vendor/clap/src/app/help.rs index 2bea1e4550..fc118a9e9a 100644 --- a/src/vendor/clap/src/app/help.rs +++ b/src/vendor/clap/src/app/help.rs @@ -505,11 +505,17 @@ impl<'a> Help<'a> { env.0, env.1 ); - spec_vals.push(format!( - " [env:{}: {}]", + let env_val = if !a.is_set(ArgSettings::HideEnvValues) { + format!("={}", env.1.map_or(Cow::Borrowed(""), |val| val.to_string_lossy())) + } else { + String::new() + }; + let env_info = format!( + " [env: {}{}]", env.0.to_string_lossy(), - env.1.map_or(Cow::Borrowed(""), |val| val.to_string_lossy()) - )); + env_val + ); + spec_vals.push(env_info); } if !a.is_set(ArgSettings::HideDefaultValue) { if let Some(pv) = a.default_val() { diff --git a/src/vendor/clap/src/app/macros.rs b/src/vendor/clap/src/app/macros.rs index 099f326e4b..e3f15e9673 100644 --- a/src/vendor/clap/src/app/macros.rs +++ b/src/vendor/clap/src/app/macros.rs @@ -85,7 +85,7 @@ macro_rules! arg_post_processing { .filter(|&&(val, _)| val.is_none()) .filter(|&&(_, req)| !$matcher.contains(&req)) .map(|&(_, name)| name) { - + $me.required.push(n); } } else { sdebugln!("No"); } diff --git a/src/vendor/clap/src/app/meta.rs b/src/vendor/clap/src/app/meta.rs index 6fbf412ce2..c7f128fe53 100644 --- a/src/vendor/clap/src/app/meta.rs +++ b/src/vendor/clap/src/app/meta.rs @@ -23,5 +23,11 @@ pub struct AppMeta<'b> { impl<'b> AppMeta<'b> { pub fn new() -> Self { Default::default() } - pub fn with_name(s: String) -> Self { AppMeta { name: s, disp_ord: 999, ..Default::default() } } -} \ No newline at end of file + pub fn with_name(s: String) -> Self { + AppMeta { + name: s, + disp_ord: 999, + ..Default::default() + } + } +} diff --git a/src/vendor/clap/src/app/mod.rs b/src/vendor/clap/src/app/mod.rs index d08f9de005..9c2d852b74 100644 --- a/src/vendor/clap/src/app/mod.rs +++ b/src/vendor/clap/src/app/mod.rs @@ -60,10 +60,10 @@ use map::{self, VecMap}; /// [`App::get_matches`]: ./struct.App.html#method.get_matches #[allow(missing_debug_implementations)] pub struct App<'a, 'b> - where 'a: 'b +where + 'a: 'b, { - #[doc(hidden)] - pub p: Parser<'a, 'b>, + #[doc(hidden)] pub p: Parser<'a, 'b>, } @@ -79,7 +79,11 @@ impl<'a, 'b> App<'a, 'b> { /// let prog = App::new("My Program") /// # ; /// ``` - pub fn new<S: Into<String>>(n: S) -> Self { App { p: Parser::with_name(n.into()) } } + pub fn new<S: Into<String>>(n: S) -> Self { + App { + p: Parser::with_name(n.into()), + } + } /// Get the name of the app pub fn get_name(&self) -> &str { &self.p.meta.name } @@ -103,7 +107,9 @@ impl<'a, 'b> App<'a, 'b> { /// [`App::version`]: ./struct.App.html#method.author #[deprecated(since="2.14.1", note="Can never work; use explicit App::author() and App::version() calls instead")] pub fn with_defaults<S: Into<String>>(n: S) -> Self { - let mut a = App { p: Parser::with_name(n.into()) }; + let mut a = App { + p: Parser::with_name(n.into()), + }; a.p.meta.author = Some("Kevin K. <kbknapp@gmail.com>"); a.p.meta.version = Some("2.19.2"); a @@ -1073,7 +1079,8 @@ impl<'a, 'b> App<'a, 'b> { /// [`SubCommand`]: ./struct.SubCommand.html /// [`IntoIterator`]: https://doc.rust-lang.org/std/iter/trait.IntoIterator.html pub fn subcommands<I>(mut self, subcmds: I) -> Self - where I: IntoIterator<Item = App<'a, 'b>> + where + I: IntoIterator<Item = App<'a, 'b>>, { for subcmd in subcmds { self.p.add_subcommand(subcmd); @@ -1375,15 +1382,17 @@ impl<'a, 'b> App<'a, 'b> { /// outdir); // Then say where write the completions to /// } /// ``` - /// Now, once we combile there will be a `{bin_name}.bash-completion` file in the directory. + /// Now, once we compile there will be a `{bin_name}.bash` file in the directory. /// Assuming we compiled with debug mode, it would be somewhere similar to - /// `<project>/target/debug/build/myapp-<hash>/out/myapp.bash-completion`. + /// `<project>/target/debug/build/myapp-<hash>/out/myapp.bash`. /// /// Fish shell completions will use the file format `{bin_name}.fish` - pub fn gen_completions<T: Into<OsString>, S: Into<String>>(&mut self, - bin_name: S, - for_shell: Shell, - out_dir: T) { + pub fn gen_completions<T: Into<OsString>, S: Into<String>>( + &mut self, + bin_name: S, + for_shell: Shell, + out_dir: T, + ) { self.p.meta.bin_name = Some(bin_name.into()); self.p.gen_completions(for_shell, out_dir.into()); } @@ -1419,12 +1428,14 @@ impl<'a, 'b> App<'a, 'b> { /// Usage: /// /// ```shell - /// $ myapp generate-bash-completions > /etc/bash_completion.d/myapp + /// $ myapp generate-bash-completions > /usr/share/bash-completion/completions/myapp.bash /// ``` - pub fn gen_completions_to<W: Write, S: Into<String>>(&mut self, - bin_name: S, - for_shell: Shell, - buf: &mut W) { + pub fn gen_completions_to<W: Write, S: Into<String>>( + &mut self, + bin_name: S, + for_shell: Shell, + buf: &mut W, + ) { self.p.meta.bin_name = Some(bin_name.into()); self.p.gen_completions_to(for_shell, buf); } @@ -1497,8 +1508,9 @@ impl<'a, 'b> App<'a, 'b> { /// [`Vec`]: https://doc.rust-lang.org/std/vec/struct.Vec.html /// [`AppSettings::NoBinaryName`]: ./enum.AppSettings.html#variant.NoBinaryName pub fn get_matches_from<I, T>(mut self, itr: I) -> ArgMatches<'a> - where I: IntoIterator<Item = T>, - T: Into<OsString> + Clone + where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone, { self.get_matches_from_safe_borrow(itr).unwrap_or_else(|e| { // Otherwise, write to stderr and exit @@ -1553,8 +1565,9 @@ impl<'a, 'b> App<'a, 'b> { /// [`kind`]: ./struct.Error.html /// [`AppSettings::NoBinaryName`]: ./enum.AppSettings.html#variant.NoBinaryName pub fn get_matches_from_safe<I, T>(mut self, itr: I) -> ClapResult<ArgMatches<'a>> - where I: IntoIterator<Item = T>, - T: Into<OsString> + Clone + where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone, { self.get_matches_from_safe_borrow(itr) } @@ -1581,8 +1594,9 @@ impl<'a, 'b> App<'a, 'b> { /// [`App::get_matches_from_safe`]: ./struct.App.html#method.get_matches_from_safe /// [`AppSettings::NoBinaryName`]: ./enum.AppSettings.html#variant.NoBinaryName pub fn get_matches_from_safe_borrow<I, T>(&mut self, itr: I) -> ClapResult<ArgMatches<'a>> - where I: IntoIterator<Item = T>, - T: Into<OsString> + Clone + where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone, { // If there are global arguments, or settings we need to propgate them down to subcommands // before parsing incase we run into a subcommand @@ -1622,7 +1636,7 @@ impl<'a, 'b> App<'a, 'b> { return Err(e); } - let global_arg_vec : Vec<&str> = (&self).p.global_args.iter().map(|ga| ga.b.name).collect(); + let global_arg_vec: Vec<&str> = (&self).p.global_args.iter().map(|ga| ga.b.name).collect(); matcher.propagate_globals(&global_arg_vec); Ok(matcher.into()) @@ -1674,14 +1688,18 @@ impl<'a> From<&'a Yaml> for App<'a, 'a> { if let Some(v) = yaml["display_order"].as_i64() { a = a.display_order(v as usize); } else if yaml["display_order"] != Yaml::BadValue { - panic!("Failed to convert YAML value {:?} to a u64", - yaml["display_order"]); + panic!( + "Failed to convert YAML value {:?} to a u64", + yaml["display_order"] + ); } if let Some(v) = yaml["setting"].as_str() { a = a.setting(v.parse().expect("unknown AppSetting found in YAML file")); } else if yaml["setting"] != Yaml::BadValue { - panic!("Failed to convert YAML value {:?} to an AppSetting", - yaml["setting"]); + panic!( + "Failed to convert YAML value {:?} to an AppSetting", + yaml["setting"] + ); } if let Some(v) = yaml["settings"].as_vec() { for ys in v { @@ -1692,27 +1710,32 @@ impl<'a> From<&'a Yaml> for App<'a, 'a> { } else if let Some(v) = yaml["settings"].as_str() { a = a.setting(v.parse().expect("unknown AppSetting found in YAML file")); } else if yaml["settings"] != Yaml::BadValue { - panic!("Failed to convert YAML value {:?} to a string", - yaml["settings"]); + panic!( + "Failed to convert YAML value {:?} to a string", + yaml["settings"] + ); } if let Some(v) = yaml["global_setting"].as_str() { a = a.setting(v.parse().expect("unknown AppSetting found in YAML file")); } else if yaml["global_setting"] != Yaml::BadValue { - panic!("Failed to convert YAML value {:?} to an AppSetting", - yaml["setting"]); + panic!( + "Failed to convert YAML value {:?} to an AppSetting", + yaml["setting"] + ); } if let Some(v) = yaml["global_settings"].as_vec() { for ys in v { if let Some(s) = ys.as_str() { - a = a.global_setting(s.parse() - .expect("unknown AppSetting found in YAML file")); + a = a.global_setting(s.parse().expect("unknown AppSetting found in YAML file")); } } } else if let Some(v) = yaml["global_settings"].as_str() { a = a.global_setting(v.parse().expect("unknown AppSetting found in YAML file")); } else if yaml["global_settings"] != Yaml::BadValue { - panic!("Failed to convert YAML value {:?} to a string", - yaml["global_settings"]); + panic!( + "Failed to convert YAML value {:?} to a string", + yaml["global_settings"] + ); } macro_rules! vec_or_str { @@ -1800,8 +1823,10 @@ impl<'n, 'e> AnyArg<'n, 'e> for App<'n, 'e> { fn longest_filter(&self) -> bool { true } fn aliases(&self) -> Option<Vec<&'e str>> { if let Some(ref aliases) = self.p.meta.aliases { - let vis_aliases: Vec<_> = - aliases.iter().filter_map(|&(n, v)| if v { Some(n) } else { None }).collect(); + let vis_aliases: Vec<_> = aliases + .iter() + .filter_map(|&(n, v)| if v { Some(n) } else { None }) + .collect(); if vis_aliases.is_empty() { None } else { diff --git a/src/vendor/clap/src/app/parser.rs b/src/vendor/clap/src/app/parser.rs index dafcf076ab..22c45c9a76 100644 --- a/src/vendor/clap/src/app/parser.rs +++ b/src/vendor/clap/src/app/parser.rs @@ -17,7 +17,7 @@ use app::App; use app::help::Help; use app::meta::AppMeta; use app::settings::AppFlags; -use args::{AnyArg, ArgMatcher, Base, Switched, Arg, ArgGroup, FlagBuilder, OptBuilder, PosBuilder}; +use args::{AnyArg, Arg, ArgGroup, ArgMatcher, Base, FlagBuilder, OptBuilder, PosBuilder, Switched}; use args::settings::ArgSettings; use completions::ComplGen; use errors::{Error, ErrorKind}; @@ -47,7 +47,8 @@ pub enum ParseResult<'a> { #[doc(hidden)] #[derive(Clone, Default)] pub struct Parser<'a, 'b> - where 'a: 'b +where + 'a: 'b, { pub meta: AppMeta<'b>, settings: AppFlags, @@ -70,11 +71,13 @@ pub struct Parser<'a, 'b> } impl<'a, 'b> Parser<'a, 'b> - where 'a: 'b +where + 'a: 'b, { pub fn with_name(n: String) -> Self { Parser { meta: AppMeta::with_name(n), + g_settings: AppFlags::zeroed(), ..Default::default() } } @@ -113,7 +116,7 @@ impl<'a, 'b> Parser<'a, 'b> let out_dir = PathBuf::from(od); let name = &*self.meta.bin_name.as_ref().unwrap().clone(); let file_name = match for_shell { - Shell::Bash => format!("{}.bash-completion", name), + Shell::Bash => format!("{}.bash", name), Shell::Fish => format!("{}.fish", name), Shell::Zsh => format!("_{}", name), Shell::PowerShell => format!("_{}.ps1", name), @@ -129,79 +132,85 @@ impl<'a, 'b> Parser<'a, 'b> #[inline] fn app_debug_asserts(&mut self) -> bool { assert!(self.verify_positionals()); - let should_err = self.groups - .iter() - .all(|g| { - g.args - .iter() - .all(|arg| { - (self.flags.iter().any(|f| &f.b.name == arg) || - self.opts.iter().any(|o| &o.b.name == arg) || - self.positionals.values().any(|p| &p.b.name == arg) || - self.groups.iter().any(|g| &g.name == arg)) - }) - }); - let g = self.groups - .iter() - .find(|g| { - g.args - .iter() - .any(|arg| { - !(self.flags.iter().any(|f| &f.b.name == arg) || - self.opts.iter().any(|o| &o.b.name == arg) || - self.positionals.values().any(|p| &p.b.name == arg) || - self.groups.iter().any(|g| &g.name == arg)) - }) - }); - assert!(should_err, - "The group '{}' contains the arg '{}' that doesn't actually exist.", - g.unwrap().name, - g.unwrap() - .args - .iter() - .find(|arg| { - !(self.flags.iter().any(|f| &&f.b.name == arg) || - self.opts.iter().any(|o| &&o.b.name == arg) || - self.positionals.values().any(|p| &&p.b.name == arg) || - self.groups.iter().any(|g| &&g.name == arg)) - }) - .unwrap()); + let should_err = self.groups.iter().all(|g| { + g.args.iter().all(|arg| { + (self.flags.iter().any(|f| &f.b.name == arg) + || self.opts.iter().any(|o| &o.b.name == arg) + || self.positionals.values().any(|p| &p.b.name == arg) + || self.groups.iter().any(|g| &g.name == arg)) + }) + }); + let g = self.groups.iter().find(|g| { + g.args.iter().any(|arg| { + !(self.flags.iter().any(|f| &f.b.name == arg) + || self.opts.iter().any(|o| &o.b.name == arg) + || self.positionals.values().any(|p| &p.b.name == arg) + || self.groups.iter().any(|g| &g.name == arg)) + }) + }); + assert!( + should_err, + "The group '{}' contains the arg '{}' that doesn't actually exist.", + g.unwrap().name, + g.unwrap() + .args + .iter() + .find(|arg| { + !(self.flags.iter().any(|f| &&f.b.name == arg) + || self.opts.iter().any(|o| &&o.b.name == arg) + || self.positionals.values().any(|p| &&p.b.name == arg) + || self.groups.iter().any(|g| &&g.name == arg)) + }) + .unwrap() + ); true } #[inline] fn debug_asserts(&self, a: &Arg) -> bool { - assert!(!arg_names!(self).any(|name| name == a.b.name), - format!("Non-unique argument name: {} is already in use", a.b.name)); + assert!( + !arg_names!(self).any(|name| name == a.b.name), + format!("Non-unique argument name: {} is already in use", a.b.name) + ); if let Some(l) = a.s.long { - assert!(!self.contains_long(l), - "Argument long must be unique\n\n\t--{} is already in use", - l); + assert!( + !self.contains_long(l), + "Argument long must be unique\n\n\t--{} is already in use", + l + ); } if let Some(s) = a.s.short { - assert!(!self.contains_short(s), - "Argument short must be unique\n\n\t-{} is already in use", - s); + assert!( + !self.contains_short(s), + "Argument short must be unique\n\n\t-{} is already in use", + s + ); } let i = if a.index.is_none() { (self.positionals.len() + 1) } else { a.index.unwrap() as usize }; - assert!(!self.positionals.contains_key(i), - "Argument \"{}\" has the same index as another positional \ - argument\n\n\tPerhaps try .multiple(true) to allow one positional argument \ - to take multiple values", - a.b.name); - assert!(!(a.is_set(ArgSettings::Required) && a.is_set(ArgSettings::Global)), - "Global arguments cannot be required.\n\n\t'{}' is marked as \ - global and required", - a.b.name); + assert!( + !self.positionals.contains_key(i), + "Argument \"{}\" has the same index as another positional \ + argument\n\n\tPerhaps try .multiple(true) to allow one positional argument \ + to take multiple values", + a.b.name + ); + assert!( + !(a.is_set(ArgSettings::Required) && a.is_set(ArgSettings::Global)), + "Global arguments cannot be required.\n\n\t'{}' is marked as \ + global and required", + a.b.name + ); if a.b.is_set(ArgSettings::Last) { - assert!(!self.positionals - .values() - .any(|p| p.b.is_set(ArgSettings::Last)), - "Only one positional argument may have last(true) set. Found two."); + assert!( + !self.positionals + .values() + .any(|p| p.b.is_set(ArgSettings::Last)), + "Only one positional argument may have last(true) set. Found two." + ); assert!(a.s.long.is_none(), "Flags or Options may not have last(true) set. {} has both a long and last(true) set.", a.b.name); @@ -245,9 +254,10 @@ impl<'a, 'b> Parser<'a, 'b> // If the arg is required, add all it's requirements to master required list if let Some(ref areqs) = a.b.requires { for name in areqs - .iter() - .filter(|&&(val, _)| val.is_none()) - .map(|&(_, name)| name) { + .iter() + .filter(|&&(val, _)| val.is_none()) + .map(|&(_, name)| name) + { self.required.push(name); } } @@ -355,9 +365,11 @@ impl<'a, 'b> Parser<'a, 'b> } pub fn add_subcommand(&mut self, mut subcmd: App<'a, 'b>) { - debugln!("Parser::add_subcommand: term_w={:?}, name={}", - self.meta.term_w, - subcmd.p.meta.name); + debugln!( + "Parser::add_subcommand: term_w={:?}, name={}", + self.meta.term_w, + subcmd.p.meta.name + ); subcmd.p.meta.term_w = self.meta.term_w; if subcmd.p.meta.name == "help" { self.unset(AS::NeedsSubcommandHelp); @@ -367,14 +379,18 @@ impl<'a, 'b> Parser<'a, 'b> } pub fn propagate_settings(&mut self) { - debugln!("Parser::propagate_settings: self={}, g_settings={:#?}", - self.meta.name, - self.g_settings); + debugln!( + "Parser::propagate_settings: self={}, g_settings={:#?}", + self.meta.name, + self.g_settings + ); for sc in &mut self.subcommands { - debugln!("Parser::propagate_settings: sc={}, settings={:#?}, g_settings={:#?}", - sc.p.meta.name, - sc.p.settings, - sc.p.g_settings); + debugln!( + "Parser::propagate_settings: sc={}, settings={:#?}, g_settings={:#?}", + sc.p.meta.name, + sc.p.settings, + sc.p.g_settings + ); // We have to create a new scope in order to tell rustc the borrow of `sc` is // done and to recursively call this method { @@ -402,21 +418,24 @@ impl<'a, 'b> Parser<'a, 'b> if self.is_set(AS::DeriveDisplayOrder) { let unified = self.is_set(AS::UnifiedHelpMessage); for (i, o) in self.opts - .iter_mut() - .enumerate() - .filter(|&(_, ref o)| o.s.disp_ord == 999) { + .iter_mut() + .enumerate() + .filter(|&(_, ref o)| o.s.disp_ord == 999) + { o.s.disp_ord = if unified { o.s.unified_ord } else { i }; } for (i, f) in self.flags - .iter_mut() - .enumerate() - .filter(|&(_, ref f)| f.s.disp_ord == 999) { + .iter_mut() + .enumerate() + .filter(|&(_, ref f)| f.s.disp_ord == 999) + { f.s.disp_ord = if unified { f.s.unified_ord } else { i }; } for (i, sc) in &mut self.subcommands - .iter_mut() - .enumerate() - .filter(|&(_, ref sc)| sc.p.meta.disp_ord == 999) { + .iter_mut() + .enumerate() + .filter(|&(_, ref sc)| sc.p.meta.disp_ord == 999) + { sc.p.meta.disp_ord = i; } } @@ -473,7 +492,11 @@ impl<'a, 'b> Parser<'a, 'b> #[inline] pub fn has_visible_subcommands(&self) -> bool { - self.has_subcommands() && self.subcommands.iter().filter(|sc| sc.p.meta.name != "help").any(|sc| !sc.p.is_set(AS::Hidden)) + self.has_subcommands() + && self.subcommands + .iter() + .filter(|sc| sc.p.meta.name != "help") + .any(|sc| !sc.p.is_set(AS::Hidden)) } #[inline] @@ -494,50 +517,57 @@ impl<'a, 'b> Parser<'a, 'b> // positional arguments to verify there are no gaps (i.e. supplying an index of 1 and 3 // but no 2) if let Some((idx, p)) = self.positionals.iter().rev().next() { - assert!(!(idx != self.positionals.len()), - "Found positional argument \"{}\" whose index is {} but there \ - are only {} positional arguments defined", - p.b.name, - idx, - self.positionals.len()); + assert!( + !(idx != self.positionals.len()), + "Found positional argument \"{}\" whose index is {} but there \ + are only {} positional arguments defined", + p.b.name, + idx, + self.positionals.len() + ); } // Next we verify that only the highest index has a .multiple(true) (if any) - if self.positionals - .values() - .any(|a| { - a.b.is_set(ArgSettings::Multiple) && - (a.index as usize != self.positionals.len()) - }) { + if self.positionals.values().any(|a| { + a.b.is_set(ArgSettings::Multiple) && (a.index as usize != self.positionals.len()) + }) { let mut it = self.positionals.values().rev(); let last = it.next().unwrap(); let second_to_last = it.next().unwrap(); // Either the final positional is required // Or the second to last has a terminator or .last(true) set - let ok = last.is_set(ArgSettings::Required) || - (second_to_last.v.terminator.is_some() || - second_to_last.b.is_set(ArgSettings::Last)) || - last.is_set(ArgSettings::Last); - assert!(ok, - "When using a positional argument with .multiple(true) that is *not the \ - last* positional argument, the last positional argument (i.e the one \ - with the highest index) *must* have .required(true) or .last(true) set."); + let ok = last.is_set(ArgSettings::Required) + || (second_to_last.v.terminator.is_some() + || second_to_last.b.is_set(ArgSettings::Last)) + || last.is_set(ArgSettings::Last); + assert!( + ok, + "When using a positional argument with .multiple(true) that is *not the \ + last* positional argument, the last positional argument (i.e the one \ + with the highest index) *must* have .required(true) or .last(true) set." + ); let ok = second_to_last.is_set(ArgSettings::Multiple) || last.is_set(ArgSettings::Last); - assert!(ok, - "Only the last positional argument, or second to last positional \ - argument may be set to .multiple(true)"); + assert!( + ok, + "Only the last positional argument, or second to last positional \ + argument may be set to .multiple(true)" + ); let count = self.positionals .values() - .filter(|p| p.b.settings.is_set(ArgSettings::Multiple) && p.v.num_vals.is_none()) + .filter(|p| { + p.b.settings.is_set(ArgSettings::Multiple) && p.v.num_vals.is_none() + }) .count(); - let ok = count <= 1 || - (last.is_set(ArgSettings::Last) && last.is_set(ArgSettings::Multiple) && - second_to_last.is_set(ArgSettings::Multiple) && - count == 2); - assert!(ok, - "Only one positional argument with .multiple(true) set is allowed per \ - command, unless the second one also has .last(true) set"); + let ok = count <= 1 + || (last.is_set(ArgSettings::Last) && last.is_set(ArgSettings::Multiple) + && second_to_last.is_set(ArgSettings::Multiple) + && count == 2); + assert!( + ok, + "Only one positional argument with .multiple(true) set is allowed per \ + command, unless the second one also has .last(true) set" + ); } @@ -548,12 +578,14 @@ impl<'a, 'b> Parser<'a, 'b> let mut foundx2 = false; for p in self.positionals.values().rev() { if foundx2 && !p.b.settings.is_set(ArgSettings::Required) { - assert!(p.b.is_set(ArgSettings::Required), - "Found positional argument which is not required with a lower \ - index than a required positional argument by two or more: {:?} \ - index {}", - p.b.name, - p.index); + assert!( + p.b.is_set(ArgSettings::Required), + "Found positional argument which is not required with a lower \ + index than a required positional argument by two or more: {:?} \ + index {}", + p.b.name, + p.index + ); } else if p.b.is_set(ArgSettings::Required) && !p.b.is_set(ArgSettings::Last) { // Args that .last(true) don't count since they can be required and have // positionals with a lower index that aren't required @@ -577,11 +609,13 @@ impl<'a, 'b> Parser<'a, 'b> let mut found = false; for p in self.positionals.values().rev() { if found { - assert!(p.b.is_set(ArgSettings::Required), - "Found positional argument which is not required with a lower \ - index than a required positional argument: {:?} index {}", - p.b.name, - p.index); + assert!( + p.b.is_set(ArgSettings::Required), + "Found positional argument which is not required with a lower \ + index than a required positional argument: {:?} index {}", + p.b.name, + p.index + ); } else if p.b.is_set(ArgSettings::Required) && !p.b.is_set(ArgSettings::Last) { // Args that .last(true) don't count since they can be required and have // positionals with a lower index that aren't required @@ -594,14 +628,14 @@ impl<'a, 'b> Parser<'a, 'b> } } } - if self.positionals - .values() - .any(|p| { - p.b.is_set(ArgSettings::Last) && p.b.is_set(ArgSettings::Required) - }) && self.has_subcommands() && - !self.is_set(AS::SubcommandsNegateReqs) { - panic!("Having a required positional argument with .last(true) set *and* child \ - subcommands without setting SubcommandsNegateReqs isn't compatible."); + if self.positionals.values().any(|p| { + p.b.is_set(ArgSettings::Last) && p.b.is_set(ArgSettings::Required) + }) && self.has_subcommands() && !self.is_set(AS::SubcommandsNegateReqs) + { + panic!( + "Having a required positional argument with .last(true) set *and* child \ + subcommands without setting SubcommandsNegateReqs isn't compatible." + ); } true @@ -646,16 +680,16 @@ impl<'a, 'b> Parser<'a, 'b> let v = self.subcommands .iter() .filter(|s| { - starts(&s.p.meta.name[..], &*arg_os) || - (s.p.meta.aliases.is_some() && - s.p - .meta - .aliases - .as_ref() - .unwrap() - .iter() - .filter(|&&(a, _)| starts(a, &*arg_os)) - .count() == 1) + starts(&s.p.meta.name[..], &*arg_os) + || (s.p.meta.aliases.is_some() + && s.p + .meta + .aliases + .as_ref() + .unwrap() + .iter() + .filter(|&&(a, _)| starts(a, &*arg_os)) + .count() == 1) }) .map(|sc| &sc.p.meta.name) .collect::<Vec<_>>(); @@ -668,8 +702,9 @@ impl<'a, 'b> Parser<'a, 'b> } fn parse_help_subcommand<I, T>(&self, it: &mut I) -> ClapResult<ParseResult<'a>> - where I: Iterator<Item = T>, - T: Into<OsString> + where + I: Iterator<Item = T>, + T: Into<OsString>, { debugln!("Parser::parse_help_subcommand;"); let cmds: Vec<OsString> = it.map(|c| c.into()).collect(); @@ -687,32 +722,35 @@ impl<'a, 'b> Parser<'a, 'b> help_help = true; } if let Some(c) = sc.subcommands - .iter() - .find(|s| &*s.p.meta.name == cmd) - .map(|sc| &sc.p) { + .iter() + .find(|s| &*s.p.meta.name == cmd) + .map(|sc| &sc.p) + { sc = c; if i == cmds.len() - 1 { break; } } else if let Some(c) = sc.subcommands - .iter() - .find(|s| if let Some(ref als) = s.p.meta.aliases { - als.iter().any(|&(a, _)| a == &*cmd.to_string_lossy()) - } else { - false - }) - .map(|sc| &sc.p) { + .iter() + .find(|s| { + if let Some(ref als) = s.p.meta.aliases { + als.iter().any(|&(a, _)| a == &*cmd.to_string_lossy()) + } else { + false + } + }) + .map(|sc| &sc.p) + { sc = c; if i == cmds.len() - 1 { break; } } else { - return Err(Error::unrecognized_subcommand(cmd.to_string_lossy().into_owned(), - self.meta - .bin_name - .as_ref() - .unwrap_or(&self.meta.name), - self.color())); + return Err(Error::unrecognized_subcommand( + cmd.to_string_lossy().into_owned(), + self.meta.bin_name.as_ref().unwrap_or(&self.meta.name), + self.color(), + )); } bin_name = format!("{} {}", bin_name, &*sc.meta.name); } @@ -736,9 +774,11 @@ impl<'a, 'b> Parser<'a, 'b> // allow wrong self convention due to self.valid_neg_num = true and it's a private method #[cfg_attr(feature = "lints", allow(wrong_self_convention))] fn is_new_arg(&mut self, arg_os: &OsStr, needs_val_of: ParseResult<'a>) -> bool { - debugln!("Parser::is_new_arg: arg={:?}, Needs Val of={:?}", - arg_os, - needs_val_of); + debugln!( + "Parser::is_new_arg: arg={:?}, Needs Val of={:?}", + arg_os, + needs_val_of + ); let app_wide_settings = if self.is_set(AS::AllowLeadingHyphen) { true } else if self.is_set(AS::AllowNegativeNumbers) { @@ -769,8 +809,10 @@ impl<'a, 'b> Parser<'a, 'b> } _ => false, }; - debugln!("Parser::is_new_arg: Arg::allow_leading_hyphen({:?})", - arg_allows_tac); + debugln!( + "Parser::is_new_arg: Arg::allow_leading_hyphen({:?})", + arg_allows_tac + ); // Is this a new argument, or values from a previous option? let mut ret = if arg_os.starts_with(b"--") { @@ -798,26 +840,26 @@ impl<'a, 'b> Parser<'a, 'b> // The actual parsing function #[cfg_attr(feature = "lints", allow(while_let_on_iterator, collapsible_if))] - pub fn get_matches_with<I, T>(&mut self, - matcher: &mut ArgMatcher<'a>, - it: &mut Peekable<I>) - -> ClapResult<()> - where I: Iterator<Item = T>, - T: Into<OsString> + Clone + pub fn get_matches_with<I, T>( + &mut self, + matcher: &mut ArgMatcher<'a>, + it: &mut Peekable<I>, + ) -> ClapResult<()> + where + I: Iterator<Item = T>, + T: Into<OsString> + Clone, { debugln!("Parser::get_matches_with;"); // Verify all positional assertions pass debug_assert!(self.app_debug_asserts()); - if self.positionals - .values() - .any(|a| { - a.b.is_set(ArgSettings::Multiple) && - (a.index as usize != self.positionals.len()) - }) && - self.positionals - .values() - .last() - .map_or(false, |p| !p.is_set(ArgSettings::Last)) { + if self.positionals.values().any(|a| { + a.b.is_set(ArgSettings::Multiple) && (a.index as usize != self.positionals.len()) + }) + && self.positionals + .values() + .last() + .map_or(false, |p| !p.is_set(ArgSettings::Last)) + { self.settings.set(AS::LowIndexMultiplePositional); } let has_args = self.has_args(); @@ -831,9 +873,11 @@ impl<'a, 'b> Parser<'a, 'b> let mut pos_counter = 1; while let Some(arg) = it.next() { let arg_os = arg.into(); - debugln!("Parser::get_matches_with: Begin parsing '{:?}' ({:?})", - arg_os, - &*arg_os.as_bytes()); + debugln!( + "Parser::get_matches_with: Begin parsing '{:?}' ({:?})", + arg_os, + &*arg_os.as_bytes() + ); self.unset(AS::ValidNegNumFound); // Is this a new argument, or values from a previous option? @@ -849,12 +893,14 @@ impl<'a, 'b> Parser<'a, 'b> // Does the arg match a subcommand name, or any of it's aliases (if defined) { match needs_val_of { - ParseResult::Opt(_) | ParseResult::Pos(_) =>(), + ParseResult::Opt(_) | ParseResult::Pos(_) => (), _ => { let (is_match, sc_name) = self.possible_subcommand(&arg_os); - debugln!("Parser::get_matches_with: possible_sc={:?}, sc={:?}", - is_match, - sc_name); + debugln!( + "Parser::get_matches_with: possible_sc={:?}, sc={:?}", + is_match, + sc_name + ); if is_match { let sc_name = sc_name.expect(INTERNAL_ERROR_MSG); if sc_name == "help" && self.is_set(AS::NeedsSubcommandHelp) { @@ -869,24 +915,26 @@ impl<'a, 'b> Parser<'a, 'b> if !starts_new_arg { if let ParseResult::Opt(name) = needs_val_of { - // Check to see if parsing a value from a previous arg - let arg = self.opts - .iter() - .find(|o| o.b.name == name) - .expect(INTERNAL_ERROR_MSG); - // get the OptBuilder so we can check the settings - needs_val_of = self.add_val_to_arg(arg, &arg_os, matcher)?; - // get the next value from the iterator - continue; + // Check to see if parsing a value from a previous arg + let arg = self.opts + .iter() + .find(|o| o.b.name == name) + .expect(INTERNAL_ERROR_MSG); + // get the OptBuilder so we can check the settings + needs_val_of = self.add_val_to_arg(arg, &arg_os, matcher)?; + // get the next value from the iterator + continue; } } else if arg_os.starts_with(b"--") { needs_val_of = self.parse_long_arg(matcher, &arg_os)?; - debugln!("Parser:get_matches_with: After parse_long_arg {:?}", - needs_val_of); + debugln!( + "Parser:get_matches_with: After parse_long_arg {:?}", + needs_val_of + ); match needs_val_of { - ParseResult::Flag | - ParseResult::Opt(..) | - ParseResult::ValuesDone => continue, + ParseResult::Flag | ParseResult::Opt(..) | ParseResult::ValuesDone => { + continue + } _ => (), } } else if arg_os.starts_with(b"-") && arg_os.len_() != 1 { @@ -895,53 +943,59 @@ impl<'a, 'b> Parser<'a, 'b> // an error, and instead return Ok(None) needs_val_of = self.parse_short_arg(matcher, &arg_os)?; // If it's None, we then check if one of those two AppSettings was set - debugln!("Parser:get_matches_with: After parse_short_arg {:?}", - needs_val_of); + debugln!( + "Parser:get_matches_with: After parse_short_arg {:?}", + needs_val_of + ); match needs_val_of { ParseResult::MaybeNegNum => { - if !(arg_os.to_string_lossy().parse::<i64>().is_ok() || - arg_os.to_string_lossy().parse::<f64>().is_ok()) { - return Err(Error::unknown_argument(&*arg_os.to_string_lossy(), - "", - &*usage::create_error_usage(self, matcher, None), - self.color())); + if !(arg_os.to_string_lossy().parse::<i64>().is_ok() + || arg_os.to_string_lossy().parse::<f64>().is_ok()) + { + return Err(Error::unknown_argument( + &*arg_os.to_string_lossy(), + "", + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } } - ParseResult::Opt(..) | - ParseResult::Flag | - ParseResult::ValuesDone => continue, + ParseResult::Opt(..) | ParseResult::Flag | ParseResult::ValuesDone => { + continue + } _ => (), } } - if !(self.is_set(AS::ArgsNegateSubcommands) && self.is_set(AS::ValidArgFound)) && - !self.is_set(AS::InferSubcommands) { - if let Some(cdate) = suggestions::did_you_mean(&*arg_os.to_string_lossy(), - sc_names!(self)) { - return Err(Error::invalid_subcommand(arg_os - .to_string_lossy() - .into_owned(), - cdate, - self.meta - .bin_name - .as_ref() - .unwrap_or(&self.meta.name), - &*usage::create_error_usage(self, - matcher, - None), - self.color())); + if !(self.is_set(AS::ArgsNegateSubcommands) && self.is_set(AS::ValidArgFound)) + && !self.is_set(AS::InferSubcommands) + { + if let Some(cdate) = + suggestions::did_you_mean(&*arg_os.to_string_lossy(), sc_names!(self)) + { + return Err(Error::invalid_subcommand( + arg_os.to_string_lossy().into_owned(), + cdate, + self.meta.bin_name.as_ref().unwrap_or(&self.meta.name), + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } } } - let low_index_mults = self.is_set(AS::LowIndexMultiplePositional) && - pos_counter == (self.positionals.len() - 1); - let missing_pos = self.is_set(AS::AllowMissingPositional) && - pos_counter == (self.positionals.len() - 1); - debugln!("Parser::get_matches_with: Positional counter...{}", - pos_counter); - debugln!("Parser::get_matches_with: Low index multiples...{:?}", - low_index_mults); + let low_index_mults = self.is_set(AS::LowIndexMultiplePositional) + && pos_counter == (self.positionals.len() - 1); + let missing_pos = self.is_set(AS::AllowMissingPositional) + && pos_counter == (self.positionals.len() - 1); + debugln!( + "Parser::get_matches_with: Positional counter...{}", + pos_counter + ); + debugln!( + "Parser::get_matches_with: Low index multiples...{:?}", + low_index_mults + ); if low_index_mults || missing_pos { if let Some(na) = it.peek() { let n = (*na).clone().into(); @@ -954,11 +1008,11 @@ impl<'a, 'b> Parser<'a, 'b> } else { ParseResult::ValuesDone }; - let sc_match = { - self.possible_subcommand(&n).0 - }; - if self.is_new_arg(&n, needs_val_of) || sc_match || - suggestions::did_you_mean(&n.to_string_lossy(), sc_names!(self)).is_some() { + let sc_match = { self.possible_subcommand(&n).0 }; + if self.is_new_arg(&n, needs_val_of) || sc_match + || suggestions::did_you_mean(&n.to_string_lossy(), sc_names!(self)) + .is_some() + { debugln!("Parser::get_matches_with: Bumping the positional counter..."); pos_counter += 1; } @@ -974,12 +1028,12 @@ impl<'a, 'b> Parser<'a, 'b> } if let Some(p) = self.positionals.get(pos_counter) { if p.is_set(ArgSettings::Last) && !self.is_set(AS::TrailingValues) { - return Err(Error::unknown_argument(&*arg_os.to_string_lossy(), - "", - &*usage::create_error_usage(self, - matcher, - None), - self.color())); + return Err(Error::unknown_argument( + &*arg_os.to_string_lossy(), + "", + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } parse_positional!(self, p, arg_os, pos_counter, matcher); self.settings.set(AS::ValidArgFound); @@ -989,10 +1043,10 @@ impl<'a, 'b> Parser<'a, 'b> Some(s) => s.to_string(), None => { if !self.is_set(AS::StrictUtf8) { - return Err(Error::invalid_utf8(&*usage::create_error_usage(self, - matcher, - None), - self.color())); + return Err(Error::invalid_utf8( + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } arg_os.to_string_lossy().into_owned() } @@ -1003,57 +1057,54 @@ impl<'a, 'b> Parser<'a, 'b> while let Some(v) = it.next() { let a = v.into(); if a.to_str().is_none() && !self.is_set(AS::StrictUtf8) { - return Err(Error::invalid_utf8(&*usage::create_error_usage(self, - matcher, - None), - self.color())); + return Err(Error::invalid_utf8( + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } sc_m.add_val_to("", &a); } matcher.subcommand(SubCommand { - name: sc_name, - matches: sc_m.into(), - }); - } else if !((self.is_set(AS::AllowLeadingHyphen) || - self.is_set(AS::AllowNegativeNumbers)) && arg_os.starts_with(b"-")) && - !self.is_set(AS::InferSubcommands) { - return Err(Error::unknown_argument(&*arg_os.to_string_lossy(), - "", - &*usage::create_error_usage(self, - matcher, - None), - self.color())); + name: sc_name, + matches: sc_m.into(), + }); + } else if !((self.is_set(AS::AllowLeadingHyphen) + || self.is_set(AS::AllowNegativeNumbers)) + && arg_os.starts_with(b"-")) + && !self.is_set(AS::InferSubcommands) + { + return Err(Error::unknown_argument( + &*arg_os.to_string_lossy(), + "", + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } else if !has_args || self.is_set(AS::InferSubcommands) && self.has_subcommands() { - if let Some(cdate) = suggestions::did_you_mean(&*arg_os.to_string_lossy(), - sc_names!(self)) { - return Err(Error::invalid_subcommand(arg_os.to_string_lossy().into_owned(), - cdate, - self.meta - .bin_name - .as_ref() - .unwrap_or(&self.meta.name), - &*usage::create_error_usage(self, - matcher, - None), - self.color())); + if let Some(cdate) = + suggestions::did_you_mean(&*arg_os.to_string_lossy(), sc_names!(self)) + { + return Err(Error::invalid_subcommand( + arg_os.to_string_lossy().into_owned(), + cdate, + self.meta.bin_name.as_ref().unwrap_or(&self.meta.name), + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } else { - return Err(Error::unrecognized_subcommand(arg_os - .to_string_lossy() - .into_owned(), - self.meta - .bin_name - .as_ref() - .unwrap_or(&self.meta.name), - self.color())); + return Err(Error::unrecognized_subcommand( + arg_os.to_string_lossy().into_owned(), + self.meta.bin_name.as_ref().unwrap_or(&self.meta.name), + self.color(), + )); } } else { - return Err(Error::unknown_argument(&*arg_os.to_string_lossy(), - "", - &*usage::create_error_usage(self, - matcher, - None), - self.color())); + return Err(Error::unknown_argument( + &*arg_os.to_string_lossy(), + "", + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } } @@ -1069,18 +1120,20 @@ impl<'a, 'b> Parser<'a, 'b> self.parse_subcommand(&*sc_name, matcher, it)?; } else if self.is_set(AS::SubcommandRequired) { let bn = self.meta.bin_name.as_ref().unwrap_or(&self.meta.name); - return Err(Error::missing_subcommand(bn, - &usage::create_error_usage(self, matcher, None), - self.color())); + return Err(Error::missing_subcommand( + bn, + &usage::create_error_usage(self, matcher, None), + self.color(), + )); } else if self.is_set(AS::SubcommandRequiredElseHelp) { debugln!("Parser::get_matches_with: SubcommandRequiredElseHelp=true"); let mut out = vec![]; self.write_help_err(&mut out)?; return Err(Error { - message: String::from_utf8_lossy(&*out).into_owned(), - kind: ErrorKind::MissingArgumentOrSubcommand, - info: None, - }); + message: String::from_utf8_lossy(&*out).into_owned(), + kind: ErrorKind::MissingArgumentOrSubcommand, + info: None, + }); } Validator::new(self).validate(needs_val_of, subcmd_name, matcher) @@ -1101,37 +1154,45 @@ impl<'a, 'b> Parser<'a, 'b> debug!("Parser::build_bin_names:iter: bin_name set..."); if sc.p.meta.bin_name.is_none() { sdebugln!("No"); - let bin_name = format!("{}{}{}", - self.meta - .bin_name - .as_ref() - .unwrap_or(&self.meta.name.clone()), - if self.meta.bin_name.is_some() { - " " - } else { - "" - }, - &*sc.p.meta.name); - debugln!("Parser::build_bin_names:iter: Setting bin_name of {} to {}", - self.meta.name, - bin_name); + let bin_name = format!( + "{}{}{}", + self.meta + .bin_name + .as_ref() + .unwrap_or(&self.meta.name.clone()), + if self.meta.bin_name.is_some() { + " " + } else { + "" + }, + &*sc.p.meta.name + ); + debugln!( + "Parser::build_bin_names:iter: Setting bin_name of {} to {}", + self.meta.name, + bin_name + ); sc.p.meta.bin_name = Some(bin_name); } else { sdebugln!("yes ({:?})", sc.p.meta.bin_name); } - debugln!("Parser::build_bin_names:iter: Calling build_bin_names from...{}", - sc.p.meta.name); + debugln!( + "Parser::build_bin_names:iter: Calling build_bin_names from...{}", + sc.p.meta.name + ); sc.p.build_bin_names(); } } - fn parse_subcommand<I, T>(&mut self, - sc_name: &str, - matcher: &mut ArgMatcher<'a>, - it: &mut Peekable<I>) - -> ClapResult<()> - where I: Iterator<Item = T>, - T: Into<OsString> + Clone + fn parse_subcommand<I, T>( + &mut self, + sc_name: &str, + matcher: &mut ArgMatcher<'a>, + it: &mut Peekable<I>, + ) -> ClapResult<()> + where + I: Iterator<Item = T>, + T: Into<OsString> + Clone, { use std::fmt::Write; debugln!("Parser::parse_subcommand;"); @@ -1149,36 +1210,42 @@ impl<'a, 'b> Parser<'a, 'b> } mid_string.push_str(" "); if let Some(ref mut sc) = self.subcommands - .iter_mut() - .find(|s| s.p.meta.name == sc_name) { + .iter_mut() + .find(|s| s.p.meta.name == sc_name) + { let mut sc_matcher = ArgMatcher::new(); // bin_name should be parent's bin_name + [<reqs>] + the sc's name separated by // a space - sc.p.meta.usage = Some(format!("{}{}{}", - self.meta.bin_name.as_ref().unwrap_or(&String::new()), - if self.meta.bin_name.is_some() { - &*mid_string - } else { - "" - }, - &*sc.p.meta.name)); - sc.p.meta.bin_name = - Some(format!("{}{}{}", - self.meta.bin_name.as_ref().unwrap_or(&String::new()), - if self.meta.bin_name.is_some() { - " " - } else { - "" - }, - &*sc.p.meta.name)); - debugln!("Parser::parse_subcommand: About to parse sc={}", - sc.p.meta.name); + sc.p.meta.usage = Some(format!( + "{}{}{}", + self.meta.bin_name.as_ref().unwrap_or(&String::new()), + if self.meta.bin_name.is_some() { + &*mid_string + } else { + "" + }, + &*sc.p.meta.name + )); + sc.p.meta.bin_name = Some(format!( + "{}{}{}", + self.meta.bin_name.as_ref().unwrap_or(&String::new()), + if self.meta.bin_name.is_some() { + " " + } else { + "" + }, + &*sc.p.meta.name + )); + debugln!( + "Parser::parse_subcommand: About to parse sc={}", + sc.p.meta.name + ); debugln!("Parser::parse_subcommand: sc settings={:#?}", sc.p.settings); sc.p.get_matches_with(&mut sc_matcher, it)?; matcher.subcommand(SubCommand { - name: sc.p.meta.name.clone(), - matches: sc_matcher.into(), - }); + name: sc.p.meta.name.clone(), + matches: sc_matcher.into(), + }); } Ok(()) } @@ -1212,10 +1279,11 @@ impl<'a, 'b> Parser<'a, 'b> let mut args = vec![]; for n in &self.groups - .iter() - .find(|g| g.name == group) - .expect(INTERNAL_ERROR_MSG) - .args { + .iter() + .find(|g| g.name == group) + .expect(INTERNAL_ERROR_MSG) + .args + { if let Some(f) = self.flags.iter().find(|f| &f.b.name == n) { args.push(f.to_string()); } else if let Some(f) = self.opts.iter().find(|o| &o.b.name == n) { @@ -1239,10 +1307,11 @@ impl<'a, 'b> Parser<'a, 'b> let mut args = vec![]; for n in &self.groups - .iter() - .find(|g| g.name == group) - .expect(INTERNAL_ERROR_MSG) - .args { + .iter() + .find(|g| g.name == group) + .expect(INTERNAL_ERROR_MSG) + .args + { if self.groups.iter().any(|g| g.name == *n) { args.extend(self.arg_names_in_group(n)); g_vec.push(*n); @@ -1296,12 +1365,14 @@ impl<'a, 'b> Parser<'a, 'b> }; self.flags.push(arg); } - if !self.subcommands.is_empty() && !self.is_set(AS::DisableHelpSubcommand) && - self.is_set(AS::NeedsSubcommandHelp) { + if !self.subcommands.is_empty() && !self.is_set(AS::DisableHelpSubcommand) + && self.is_set(AS::NeedsSubcommandHelp) + { debugln!("Parser::create_help_and_version: Building help"); - self.subcommands - .push(App::new("help") - .about("Prints this message or the help of the given subcommand(s)")); + self.subcommands.push( + App::new("help") + .about("Prints this message or the help of the given subcommand(s)"), + ); } } @@ -1309,8 +1380,10 @@ impl<'a, 'b> Parser<'a, 'b> // because those will be listed in self.required fn check_for_help_and_version_str(&self, arg: &OsStr) -> ClapResult<()> { debugln!("Parser::check_for_help_and_version_str;"); - debug!("Parser::check_for_help_and_version_str: Checking if --{} is help or version...", - arg.to_str().unwrap()); + debug!( + "Parser::check_for_help_and_version_str: Checking if --{} is help or version...", + arg.to_str().unwrap() + ); if arg == "help" && self.is_set(AS::NeedsLongHelp) { sdebugln!("Help"); return Err(self._help(true)); @@ -1326,8 +1399,10 @@ impl<'a, 'b> Parser<'a, 'b> fn check_for_help_and_version_char(&self, arg: char) -> ClapResult<()> { debugln!("Parser::check_for_help_and_version_char;"); - debug!("Parser::check_for_help_and_version_char: Checking if -{} is help or version...", - arg); + debug!( + "Parser::check_for_help_and_version_char: Checking if -{} is help or version...", + arg + ); if let Some(h) = self.help_short { if arg == h && self.is_set(AS::NeedsLongHelp) { sdebugln!("Help"); @@ -1345,13 +1420,12 @@ impl<'a, 'b> Parser<'a, 'b> } fn use_long_help(&self) -> bool { - self.meta.long_about.is_some() || - self.flags.iter().any(|f| f.b.long_help.is_some()) || - self.opts.iter().any(|o| o.b.long_help.is_some()) || - self.positionals.values().any(|p| p.b.long_help.is_some()) || - self.subcommands - .iter() - .any(|s| s.p.meta.long_about.is_some()) + self.meta.long_about.is_some() || self.flags.iter().any(|f| f.b.long_help.is_some()) + || self.opts.iter().any(|o| o.b.long_help.is_some()) + || self.positionals.values().any(|p| p.b.long_help.is_some()) + || self.subcommands + .iter() + .any(|s| s.p.meta.long_about.is_some()) } fn _help(&self, mut use_long: bool) -> Error { @@ -1364,7 +1438,7 @@ impl<'a, 'b> Parser<'a, 'b> message: String::from_utf8(buf).unwrap_or_default(), kind: ErrorKind::HelpDisplayed, info: None, - } + }, } } @@ -1378,14 +1452,15 @@ impl<'a, 'b> Parser<'a, 'b> message: String::new(), kind: ErrorKind::VersionDisplayed, info: None, - } + }, } } - fn parse_long_arg(&mut self, - matcher: &mut ArgMatcher<'a>, - full_arg: &OsStr) - -> ClapResult<ParseResult<'a>> { + fn parse_long_arg( + &mut self, + matcher: &mut ArgMatcher<'a>, + full_arg: &OsStr, + ) -> ClapResult<ParseResult<'a>> { // maybe here lifetime should be 'a debugln!("Parser::parse_long_arg;"); let mut val = None; @@ -1401,8 +1476,10 @@ impl<'a, 'b> Parser<'a, 'b> }; if let Some(opt) = find_opt_by_long!(@os self, arg) { - debugln!("Parser::parse_long_arg: Found valid opt '{}'", - opt.to_string()); + debugln!( + "Parser::parse_long_arg: Found valid opt '{}'", + opt.to_string() + ); self.settings.set(AS::ValidArgFound); let ret = self.parse_opt(val, opt, val.is_some(), matcher)?; if self.cache.map_or(true, |name| name != opt.b.name) { @@ -1412,8 +1489,10 @@ impl<'a, 'b> Parser<'a, 'b> return Ok(ret); } else if let Some(flag) = find_flag_by_long!(@os self, arg) { - debugln!("Parser::parse_long_arg: Found valid flag '{}'", - flag.to_string()); + debugln!( + "Parser::parse_long_arg: Found valid flag '{}'", + flag.to_string() + ); self.settings.set(AS::ValidArgFound); // Only flags could be help or version, and we need to check the raw long // so this is the first point to check @@ -1440,10 +1519,11 @@ impl<'a, 'b> Parser<'a, 'b> } #[cfg_attr(feature = "lints", allow(len_zero))] - fn parse_short_arg(&mut self, - matcher: &mut ArgMatcher<'a>, - full_arg: &OsStr) - -> ClapResult<ParseResult<'a>> { + fn parse_short_arg( + &mut self, + matcher: &mut ArgMatcher<'a>, + full_arg: &OsStr, + ) -> ClapResult<ParseResult<'a>> { debugln!("Parser::parse_short_arg: full_arg={:?}", full_arg); let arg_os = full_arg.trim_left_matches(b'-'); let arg = arg_os.to_string_lossy(); @@ -1452,8 +1532,10 @@ impl<'a, 'b> Parser<'a, 'b> // `-v` `-a` `-l` assuming `v` `a` and `l` are all, or mostly, valid shorts. if self.is_set(AS::AllowLeadingHyphen) { if arg.chars().any(|c| !self.contains_short(c)) { - debugln!("Parser::parse_short_arg: LeadingHyphenAllowed yet -{} isn't valid", - arg); + debugln!( + "Parser::parse_short_arg: LeadingHyphenAllowed yet -{} isn't valid", + arg + ); return Ok(ParseResult::MaybeHyphenValue); } } else if self.is_set(AS::ValidNegNumFound) { @@ -1475,16 +1557,20 @@ impl<'a, 'b> Parser<'a, 'b> self.settings.set(AS::ValidArgFound); // Check for trailing concatenated value let p: Vec<_> = arg.splitn(2, c).collect(); - debugln!("Parser::parse_short_arg:iter:{}: p[0]={:?}, p[1]={:?}", - c, - p[0].as_bytes(), - p[1].as_bytes()); + debugln!( + "Parser::parse_short_arg:iter:{}: p[0]={:?}, p[1]={:?}", + c, + p[0].as_bytes(), + p[1].as_bytes() + ); let i = p[0].as_bytes().len() + 1; let val = if p[1].as_bytes().len() > 0 { - debugln!("Parser::parse_short_arg:iter:{}: val={:?} (bytes), val={:?} (ascii)", - c, - arg_os.split_at(i).1.as_bytes(), - arg_os.split_at(i).1); + debugln!( + "Parser::parse_short_arg:iter:{}: val={:?} (bytes), val={:?} (ascii)", + c, + arg_os.split_at(i).1.as_bytes(), + arg_os.split_at(i).1 + ); Some(arg_os.split_at(i).1) } else { None @@ -1514,23 +1600,24 @@ impl<'a, 'b> Parser<'a, 'b> } } else { let arg = format!("-{}", c); - return Err(Error::unknown_argument(&*arg, - "", - &*usage::create_error_usage(self, - matcher, - None), - self.color())); + return Err(Error::unknown_argument( + &*arg, + "", + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } } Ok(ret) } - fn parse_opt(&self, - val: Option<&OsStr>, - opt: &OptBuilder<'a, 'b>, - had_eq: bool, - matcher: &mut ArgMatcher<'a>) - -> ClapResult<ParseResult<'a>> { + fn parse_opt( + &self, + val: Option<&OsStr>, + opt: &OptBuilder<'a, 'b>, + had_eq: bool, + matcher: &mut ArgMatcher<'a>, + ) -> ClapResult<ParseResult<'a>> { debugln!("Parser::parse_opt; opt={}, val={:?}", opt.b.name, val); debugln!("Parser::parse_opt; opt.settings={:?}", opt.b.settings); let mut has_eq = false; @@ -1543,24 +1630,28 @@ impl<'a, 'b> Parser<'a, 'b> if let Some(fv) = val { has_eq = fv.starts_with(&[b'=']) || had_eq; let v = fv.trim_left_matches(b'='); - if !empty_vals && - (v.len_() == 0 || (needs_eq && !has_eq)) { + if !empty_vals && (v.len_() == 0 || (needs_eq && !has_eq)) { sdebugln!("Found Empty - Error"); - return Err(Error::empty_value(opt, - &*usage::create_error_usage(self, matcher, None), - self.color())); + return Err(Error::empty_value( + opt, + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } sdebugln!("Found - {:?}, len: {}", v, v.len_()); - debugln!("Parser::parse_opt: {:?} contains '='...{:?}", - fv, - fv.starts_with(&[b'='])); + debugln!( + "Parser::parse_opt: {:?} contains '='...{:?}", + fv, + fv.starts_with(&[b'=']) + ); self.add_val_to_arg(opt, v, matcher)?; } else if needs_eq && !(empty_vals || min_vals_zero) { sdebugln!("None, but requires equals...Error"); - return Err(Error::empty_value(opt, - &*usage::create_error_usage(self, matcher, None), - self.color())); - + return Err(Error::empty_value( + opt, + &*usage::create_error_usage(self, matcher, None), + self.color(), + )); } else { sdebugln!("None"); } @@ -1583,17 +1674,21 @@ impl<'a, 'b> Parser<'a, 'b> Ok(ParseResult::ValuesDone) } - fn add_val_to_arg<A>(&self, - arg: &A, - val: &OsStr, - matcher: &mut ArgMatcher<'a>) - -> ClapResult<ParseResult<'a>> - where A: AnyArg<'a, 'b> + Display + fn add_val_to_arg<A>( + &self, + arg: &A, + val: &OsStr, + matcher: &mut ArgMatcher<'a>, + ) -> ClapResult<ParseResult<'a>> + where + A: AnyArg<'a, 'b> + Display, { debugln!("Parser::add_val_to_arg; arg={}, val={:?}", arg.name(), val); - debugln!("Parser::add_val_to_arg; trailing_vals={:?}, DontDelimTrailingVals={:?}", - self.is_set(AS::TrailingValues), - self.is_set(AS::DontDelimitTrailingValues)); + debugln!( + "Parser::add_val_to_arg; trailing_vals={:?}, DontDelimTrailingVals={:?}", + self.is_set(AS::TrailingValues), + self.is_set(AS::DontDelimitTrailingValues) + ); if !(self.is_set(AS::TrailingValues) && self.is_set(AS::DontDelimitTrailingValues)) { if let Some(delim) = arg.val_delim() { if val.is_empty_() { @@ -1604,10 +1699,11 @@ impl<'a, 'b> Parser<'a, 'b> iret = self.add_single_val_to_arg(arg, v, matcher)?; } // If there was a delimiter used, we're not looking for more values - if val.contains_byte(delim as u32 as u8) || - arg.is_set(ArgSettings::RequireDelimiter) { - iret = ParseResult::ValuesDone; - } + if val.contains_byte(delim as u32 as u8) + || arg.is_set(ArgSettings::RequireDelimiter) + { + iret = ParseResult::ValuesDone; + } Ok(iret) } } else { @@ -1618,12 +1714,14 @@ impl<'a, 'b> Parser<'a, 'b> } } - fn add_single_val_to_arg<A>(&self, - arg: &A, - v: &OsStr, - matcher: &mut ArgMatcher<'a>) - -> ClapResult<ParseResult<'a>> - where A: AnyArg<'a, 'b> + Display + fn add_single_val_to_arg<A>( + &self, + arg: &A, + v: &OsStr, + matcher: &mut ArgMatcher<'a>, + ) -> ClapResult<ParseResult<'a>> + where + A: AnyArg<'a, 'b> + Display, { debugln!("Parser::add_single_val_to_arg;"); debugln!("Parser::add_single_val_to_arg: adding val...{:?}", v); @@ -1648,10 +1746,11 @@ impl<'a, 'b> Parser<'a, 'b> } - fn parse_flag(&self, - flag: &FlagBuilder<'a, 'b>, - matcher: &mut ArgMatcher<'a>) - -> ClapResult<ParseResult<'a>> { + fn parse_flag( + &self, + flag: &FlagBuilder<'a, 'b>, + matcher: &mut ArgMatcher<'a>, + ) -> ClapResult<ParseResult<'a>> { debugln!("Parser::parse_flag;"); matcher.inc_occurrence_of(flag.b.name); @@ -1663,10 +1762,8 @@ impl<'a, 'b> Parser<'a, 'b> } fn did_you_mean_error(&self, arg: &str, matcher: &mut ArgMatcher<'a>) -> ClapResult<()> { - // Didn't match a flag or option - let suffix = - suggestions::did_you_mean_flag_suffix(arg, longs!(self), &self.subcommands); + let suffix = suggestions::did_you_mean_flag_suffix(arg, longs!(self), &self.subcommands); // Add the arg to the matches to build a proper usage string if let Some(name) = suffix.1 { @@ -1682,10 +1779,12 @@ impl<'a, 'b> Parser<'a, 'b> } let used_arg = format!("--{}", arg); - Err(Error::unknown_argument(&*used_arg, - &*suffix.0, - &*usage::create_error_usage(self, matcher, None), - self.color())) + Err(Error::unknown_argument( + &*used_arg, + &*suffix.0, + &*usage::create_error_usage(self, matcher, None), + self.color(), + )) } // Prints the version to the user and exits if quit=true @@ -1811,7 +1910,7 @@ impl<'a, 'b> Parser<'a, 'b> } Ok(()) } - + pub fn add_env(&mut self, matcher: &mut ArgMatcher<'a>) -> ClapResult<()> { macro_rules! add_val { ($_self:ident, $a:ident, $m:ident) => { @@ -1888,7 +1987,8 @@ impl<'a, 'b> Parser<'a, 'b> /// Check is a given string matches the binary name for this parser fn is_bin_name(&self, value: &str) -> bool { - self.meta.bin_name + self.meta + .bin_name .as_ref() .and_then(|name| Some(value == name)) .unwrap_or(false) @@ -1896,7 +1996,8 @@ impl<'a, 'b> Parser<'a, 'b> /// Check is a given string is an alias for this parser fn is_alias(&self, value: &str) -> bool { - self.meta.aliases + self.meta + .aliases .as_ref() .and_then(|aliases| { for alias in aliases { @@ -1913,8 +2014,10 @@ impl<'a, 'b> Parser<'a, 'b> #[cfg_attr(feature = "lints", allow(block_in_if_condition_stmt))] pub fn find_subcommand(&'b self, sc: &str) -> Option<&'b App<'a, 'b>> { debugln!("Parser::find_subcommand: sc={}", sc); - debugln!("Parser::find_subcommand: Currently in Parser...{}", - self.meta.bin_name.as_ref().unwrap()); + debugln!( + "Parser::find_subcommand: Currently in Parser...{}", + self.meta.bin_name.as_ref().unwrap() + ); for s in &self.subcommands { if s.p.is_bin_name(sc) { return Some(s); diff --git a/src/vendor/clap/src/app/settings.rs b/src/vendor/clap/src/app/settings.rs index d1bba53fc7..1b304225ab 100644 --- a/src/vendor/clap/src/app/settings.rs +++ b/src/vendor/clap/src/app/settings.rs @@ -1,4 +1,5 @@ // Std +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::str::FromStr; use std::ops::BitOr; @@ -59,54 +60,59 @@ impl BitOr for AppFlags { impl Default for AppFlags { fn default() -> Self { - AppFlags(NEEDS_LONG_VERSION | NEEDS_LONG_HELP | NEEDS_SC_HELP | UTF8_NONE | COLOR_AUTO) + AppFlags( + Flags::NEEDS_LONG_VERSION | Flags::NEEDS_LONG_HELP | Flags::NEEDS_SC_HELP + | Flags::UTF8_NONE | Flags::COLOR_AUTO, + ) } } +#[allow(deprecated)] impl AppFlags { pub fn new() -> Self { AppFlags::default() } + pub fn zeroed() -> Self { AppFlags(Flags::empty()) } impl_settings! { AppSettings, - ArgRequiredElseHelp => A_REQUIRED_ELSE_HELP, - ArgsNegateSubcommands => ARGS_NEGATE_SCS, - AllowExternalSubcommands => ALLOW_UNK_SC, - AllowInvalidUtf8 => UTF8_NONE, - AllowLeadingHyphen => LEADING_HYPHEN, - AllowNegativeNumbers => ALLOW_NEG_NUMS, - AllowMissingPositional => ALLOW_MISSING_POS, - ColoredHelp => COLORED_HELP, - ColorAlways => COLOR_ALWAYS, - ColorAuto => COLOR_AUTO, - ColorNever => COLOR_NEVER, - DontDelimitTrailingValues => DONT_DELIM_TRAIL, - DontCollapseArgsInUsage => DONT_COLLAPSE_ARGS, - DeriveDisplayOrder => DERIVE_DISP_ORDER, - DisableHelpSubcommand => DISABLE_HELP_SC, - DisableVersion => DISABLE_VERSION, - GlobalVersion => GLOBAL_VERSION, - HidePossibleValuesInHelp => NO_POS_VALUES, - Hidden => HIDDEN, - LowIndexMultiplePositional => LOW_INDEX_MUL_POS, - NeedsLongHelp => NEEDS_LONG_HELP, - NeedsLongVersion => NEEDS_LONG_VERSION, - NeedsSubcommandHelp => NEEDS_SC_HELP, - NoBinaryName => NO_BIN_NAME, - PropagateGlobalValuesDown=> PROPAGATE_VALS_DOWN, - StrictUtf8 => UTF8_STRICT, - SubcommandsNegateReqs => SC_NEGATE_REQS, - SubcommandRequired => SC_REQUIRED, - SubcommandRequiredElseHelp => SC_REQUIRED_ELSE_HELP, - TrailingVarArg => TRAILING_VARARG, - UnifiedHelpMessage => UNIFIED_HELP, - NextLineHelp => NEXT_LINE_HELP, - VersionlessSubcommands => VERSIONLESS_SC, - WaitOnError => WAIT_ON_ERROR, - TrailingValues => TRAILING_VALUES, - ValidNegNumFound => VALID_NEG_NUM_FOUND, - Propagated => PROPAGATED, - ValidArgFound => VALID_ARG_FOUND, - InferSubcommands => INFER_SUBCOMMANDS, - ContainsLast => CONTAINS_LAST + ArgRequiredElseHelp => Flags::A_REQUIRED_ELSE_HELP, + ArgsNegateSubcommands => Flags::ARGS_NEGATE_SCS, + AllowExternalSubcommands => Flags::ALLOW_UNK_SC, + AllowInvalidUtf8 => Flags::UTF8_NONE, + AllowLeadingHyphen => Flags::LEADING_HYPHEN, + AllowNegativeNumbers => Flags::ALLOW_NEG_NUMS, + AllowMissingPositional => Flags::ALLOW_MISSING_POS, + ColoredHelp => Flags::COLORED_HELP, + ColorAlways => Flags::COLOR_ALWAYS, + ColorAuto => Flags::COLOR_AUTO, + ColorNever => Flags::COLOR_NEVER, + DontDelimitTrailingValues => Flags::DONT_DELIM_TRAIL, + DontCollapseArgsInUsage => Flags::DONT_COLLAPSE_ARGS, + DeriveDisplayOrder => Flags::DERIVE_DISP_ORDER, + DisableHelpSubcommand => Flags::DISABLE_HELP_SC, + DisableVersion => Flags::DISABLE_VERSION, + GlobalVersion => Flags::GLOBAL_VERSION, + HidePossibleValuesInHelp => Flags::NO_POS_VALUES, + Hidden => Flags::HIDDEN, + LowIndexMultiplePositional => Flags::LOW_INDEX_MUL_POS, + NeedsLongHelp => Flags::NEEDS_LONG_HELP, + NeedsLongVersion => Flags::NEEDS_LONG_VERSION, + NeedsSubcommandHelp => Flags::NEEDS_SC_HELP, + NoBinaryName => Flags::NO_BIN_NAME, + PropagateGlobalValuesDown=> Flags::PROPAGATE_VALS_DOWN, + StrictUtf8 => Flags::UTF8_STRICT, + SubcommandsNegateReqs => Flags::SC_NEGATE_REQS, + SubcommandRequired => Flags::SC_REQUIRED, + SubcommandRequiredElseHelp => Flags::SC_REQUIRED_ELSE_HELP, + TrailingVarArg => Flags::TRAILING_VARARG, + UnifiedHelpMessage => Flags::UNIFIED_HELP, + NextLineHelp => Flags::NEXT_LINE_HELP, + VersionlessSubcommands => Flags::VERSIONLESS_SC, + WaitOnError => Flags::WAIT_ON_ERROR, + TrailingValues => Flags::TRAILING_VALUES, + ValidNegNumFound => Flags::VALID_NEG_NUM_FOUND, + Propagated => Flags::PROPAGATED, + ValidArgFound => Flags::VALID_ARG_FOUND, + InferSubcommands => Flags::INFER_SUBCOMMANDS, + ContainsLast => Flags::CONTAINS_LAST } } @@ -135,8 +141,8 @@ pub enum AppSettings { /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```")] /// # use clap::{App, AppSettings}; /// use std::ffi::OsString; /// use std::os::unix::ffi::{OsStrExt,OsStringExt}; @@ -589,9 +595,9 @@ pub enum AppSettings { NextLineHelp, /// **DEPRECATED**: This setting is no longer required in order to propagate values up or down - /// + /// /// Specifies that the parser should propagate global arg's values down or up through any *used* - /// child subcommands. Meaning, if a subcommand wasn't used, the values won't be propagated to + /// child subcommands. Meaning, if a subcommand wasn't used, the values won't be propagated to /// said subcommand. /// /// # Examples @@ -707,8 +713,8 @@ pub enum AppSettings { /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```")] /// # use clap::{App, AppSettings, ErrorKind}; /// use std::ffi::OsString; /// use std::os::unix::ffi::OsStringExt; @@ -836,32 +842,23 @@ pub enum AppSettings { /// [`SubCommand`]: ./struct.SubCommand.html WaitOnError, - #[doc(hidden)] - NeedsLongVersion, + #[doc(hidden)] NeedsLongVersion, - #[doc(hidden)] - NeedsLongHelp, + #[doc(hidden)] NeedsLongHelp, - #[doc(hidden)] - NeedsSubcommandHelp, + #[doc(hidden)] NeedsSubcommandHelp, - #[doc(hidden)] - LowIndexMultiplePositional, + #[doc(hidden)] LowIndexMultiplePositional, - #[doc(hidden)] - TrailingValues, + #[doc(hidden)] TrailingValues, - #[doc(hidden)] - ValidNegNumFound, + #[doc(hidden)] ValidNegNumFound, - #[doc(hidden)] - Propagated, + #[doc(hidden)] Propagated, - #[doc(hidden)] - ValidArgFound, + #[doc(hidden)] ValidArgFound, - #[doc(hidden)] - ContainsLast, + #[doc(hidden)] ContainsLast, } impl FromStr for AppSettings { @@ -913,74 +910,142 @@ mod test { #[test] fn app_settings_fromstr() { - assert_eq!("argsnegatesubcommands".parse::<AppSettings>().unwrap(), - AppSettings::ArgsNegateSubcommands); - assert_eq!("argrequiredelsehelp".parse::<AppSettings>().unwrap(), - AppSettings::ArgRequiredElseHelp); - assert_eq!("allowexternalsubcommands".parse::<AppSettings>().unwrap(), - AppSettings::AllowExternalSubcommands); - assert_eq!("allowinvalidutf8".parse::<AppSettings>().unwrap(), - AppSettings::AllowInvalidUtf8); - assert_eq!("allowleadinghyphen".parse::<AppSettings>().unwrap(), - AppSettings::AllowLeadingHyphen); - assert_eq!("allownegativenumbers".parse::<AppSettings>().unwrap(), - AppSettings::AllowNegativeNumbers); - assert_eq!("coloredhelp".parse::<AppSettings>().unwrap(), - AppSettings::ColoredHelp); - assert_eq!("colorauto".parse::<AppSettings>().unwrap(), - AppSettings::ColorAuto); - assert_eq!("coloralways".parse::<AppSettings>().unwrap(), - AppSettings::ColorAlways); - assert_eq!("colornever".parse::<AppSettings>().unwrap(), - AppSettings::ColorNever); - assert_eq!("disablehelpsubcommand".parse::<AppSettings>().unwrap(), - AppSettings::DisableHelpSubcommand); - assert_eq!("disableversion".parse::<AppSettings>().unwrap(), - AppSettings::DisableVersion); - assert_eq!("dontcollapseargsinusage".parse::<AppSettings>().unwrap(), - AppSettings::DontCollapseArgsInUsage); - assert_eq!("dontdelimittrailingvalues".parse::<AppSettings>().unwrap(), - AppSettings::DontDelimitTrailingValues); - assert_eq!("derivedisplayorder".parse::<AppSettings>().unwrap(), - AppSettings::DeriveDisplayOrder); - assert_eq!("globalversion".parse::<AppSettings>().unwrap(), - AppSettings::GlobalVersion); - assert_eq!("hidden".parse::<AppSettings>().unwrap(), - AppSettings::Hidden); - assert_eq!("hidepossiblevaluesinhelp".parse::<AppSettings>().unwrap(), - AppSettings::HidePossibleValuesInHelp); - assert_eq!("lowindexmultiplePositional".parse::<AppSettings>().unwrap(), - AppSettings::LowIndexMultiplePositional); - assert_eq!("nobinaryname".parse::<AppSettings>().unwrap(), - AppSettings::NoBinaryName); - assert_eq!("nextlinehelp".parse::<AppSettings>().unwrap(), - AppSettings::NextLineHelp); - assert_eq!("subcommandsnegatereqs".parse::<AppSettings>().unwrap(), - AppSettings::SubcommandsNegateReqs); - assert_eq!("subcommandrequired".parse::<AppSettings>().unwrap(), - AppSettings::SubcommandRequired); - assert_eq!("subcommandrequiredelsehelp".parse::<AppSettings>().unwrap(), - AppSettings::SubcommandRequiredElseHelp); - assert_eq!("strictutf8".parse::<AppSettings>().unwrap(), - AppSettings::StrictUtf8); - assert_eq!("trailingvararg".parse::<AppSettings>().unwrap(), - AppSettings::TrailingVarArg); - assert_eq!("unifiedhelpmessage".parse::<AppSettings>().unwrap(), - AppSettings::UnifiedHelpMessage); - assert_eq!("versionlesssubcommands".parse::<AppSettings>().unwrap(), - AppSettings::VersionlessSubcommands); - assert_eq!("waitonerror".parse::<AppSettings>().unwrap(), - AppSettings::WaitOnError); - assert_eq!("validnegnumfound".parse::<AppSettings>().unwrap(), - AppSettings::ValidNegNumFound); - assert_eq!("validargfound".parse::<AppSettings>().unwrap(), - AppSettings::ValidArgFound); - assert_eq!("propagated".parse::<AppSettings>().unwrap(), - AppSettings::Propagated); - assert_eq!("trailingvalues".parse::<AppSettings>().unwrap(), - AppSettings::TrailingValues); - assert_eq!("infersubcommands".parse::<AppSettings>().unwrap(), - AppSettings::InferSubcommands); + assert_eq!( + "argsnegatesubcommands".parse::<AppSettings>().unwrap(), + AppSettings::ArgsNegateSubcommands + ); + assert_eq!( + "argrequiredelsehelp".parse::<AppSettings>().unwrap(), + AppSettings::ArgRequiredElseHelp + ); + assert_eq!( + "allowexternalsubcommands".parse::<AppSettings>().unwrap(), + AppSettings::AllowExternalSubcommands + ); + assert_eq!( + "allowinvalidutf8".parse::<AppSettings>().unwrap(), + AppSettings::AllowInvalidUtf8 + ); + assert_eq!( + "allowleadinghyphen".parse::<AppSettings>().unwrap(), + AppSettings::AllowLeadingHyphen + ); + assert_eq!( + "allownegativenumbers".parse::<AppSettings>().unwrap(), + AppSettings::AllowNegativeNumbers + ); + assert_eq!( + "coloredhelp".parse::<AppSettings>().unwrap(), + AppSettings::ColoredHelp + ); + assert_eq!( + "colorauto".parse::<AppSettings>().unwrap(), + AppSettings::ColorAuto + ); + assert_eq!( + "coloralways".parse::<AppSettings>().unwrap(), + AppSettings::ColorAlways + ); + assert_eq!( + "colornever".parse::<AppSettings>().unwrap(), + AppSettings::ColorNever + ); + assert_eq!( + "disablehelpsubcommand".parse::<AppSettings>().unwrap(), + AppSettings::DisableHelpSubcommand + ); + assert_eq!( + "disableversion".parse::<AppSettings>().unwrap(), + AppSettings::DisableVersion + ); + assert_eq!( + "dontcollapseargsinusage".parse::<AppSettings>().unwrap(), + AppSettings::DontCollapseArgsInUsage + ); + assert_eq!( + "dontdelimittrailingvalues".parse::<AppSettings>().unwrap(), + AppSettings::DontDelimitTrailingValues + ); + assert_eq!( + "derivedisplayorder".parse::<AppSettings>().unwrap(), + AppSettings::DeriveDisplayOrder + ); + assert_eq!( + "globalversion".parse::<AppSettings>().unwrap(), + AppSettings::GlobalVersion + ); + assert_eq!( + "hidden".parse::<AppSettings>().unwrap(), + AppSettings::Hidden + ); + assert_eq!( + "hidepossiblevaluesinhelp".parse::<AppSettings>().unwrap(), + AppSettings::HidePossibleValuesInHelp + ); + assert_eq!( + "lowindexmultiplePositional".parse::<AppSettings>().unwrap(), + AppSettings::LowIndexMultiplePositional + ); + assert_eq!( + "nobinaryname".parse::<AppSettings>().unwrap(), + AppSettings::NoBinaryName + ); + assert_eq!( + "nextlinehelp".parse::<AppSettings>().unwrap(), + AppSettings::NextLineHelp + ); + assert_eq!( + "subcommandsnegatereqs".parse::<AppSettings>().unwrap(), + AppSettings::SubcommandsNegateReqs + ); + assert_eq!( + "subcommandrequired".parse::<AppSettings>().unwrap(), + AppSettings::SubcommandRequired + ); + assert_eq!( + "subcommandrequiredelsehelp".parse::<AppSettings>().unwrap(), + AppSettings::SubcommandRequiredElseHelp + ); + assert_eq!( + "strictutf8".parse::<AppSettings>().unwrap(), + AppSettings::StrictUtf8 + ); + assert_eq!( + "trailingvararg".parse::<AppSettings>().unwrap(), + AppSettings::TrailingVarArg + ); + assert_eq!( + "unifiedhelpmessage".parse::<AppSettings>().unwrap(), + AppSettings::UnifiedHelpMessage + ); + assert_eq!( + "versionlesssubcommands".parse::<AppSettings>().unwrap(), + AppSettings::VersionlessSubcommands + ); + assert_eq!( + "waitonerror".parse::<AppSettings>().unwrap(), + AppSettings::WaitOnError + ); + assert_eq!( + "validnegnumfound".parse::<AppSettings>().unwrap(), + AppSettings::ValidNegNumFound + ); + assert_eq!( + "validargfound".parse::<AppSettings>().unwrap(), + AppSettings::ValidArgFound + ); + assert_eq!( + "propagated".parse::<AppSettings>().unwrap(), + AppSettings::Propagated + ); + assert_eq!( + "trailingvalues".parse::<AppSettings>().unwrap(), + AppSettings::TrailingValues + ); + assert_eq!( + "infersubcommands".parse::<AppSettings>().unwrap(), + AppSettings::InferSubcommands + ); assert!("hahahaha".parse::<AppSettings>().is_err()); } } diff --git a/src/vendor/clap/src/app/usage.rs b/src/vendor/clap/src/app/usage.rs index 39489dc75a..609058843c 100644 --- a/src/vendor/clap/src/app/usage.rs +++ b/src/vendor/clap/src/app/usage.rs @@ -19,11 +19,13 @@ pub fn create_usage_with_title(p: &Parser, used: &[&str]) -> String { } // Creates a usage string to be used in error message (i.e. one with currently used args) -pub fn create_error_usage<'a, 'b>(p: &Parser<'a, 'b>, - matcher: &'b ArgMatcher<'a>, - extra: Option<&str>) - -> String { - let mut args: Vec<_> = matcher.arg_names() +pub fn create_error_usage<'a, 'b>( + p: &Parser<'a, 'b>, + matcher: &'b ArgMatcher<'a>, + extra: Option<&str>, +) -> String { + let mut args: Vec<_> = matcher + .arg_names() .iter() .filter(|n| { if let Some(o) = find_by_name!(p, **n, opts, iter) { @@ -60,20 +62,15 @@ pub fn create_help_usage(p: &Parser, incl_reqs: bool) -> String { let name = p.meta .usage .as_ref() - .unwrap_or_else(|| { - p.meta - .bin_name - .as_ref() - .unwrap_or(&p.meta.name) - }); + .unwrap_or_else(|| p.meta.bin_name.as_ref().unwrap_or(&p.meta.name)); usage.push_str(&*name); let req_string = if incl_reqs { let mut reqs: Vec<&str> = p.required().map(|r| &**r).collect(); reqs.sort(); reqs.dedup(); - get_required_usage_from(p, &reqs, None, None, false).iter().fold(String::new(), |a, s| { - a + &format!(" {}", s)[..] - }) + get_required_usage_from(p, &reqs, None, None, false) + .iter() + .fold(String::new(), |a, s| a + &format!(" {}", s)[..]) } else { String::new() }; @@ -84,8 +81,9 @@ pub fn create_help_usage(p: &Parser, incl_reqs: bool) -> String { } else if flags { usage.push_str(" [OPTIONS]"); } - if !p.is_set(AS::UnifiedHelpMessage) && - p.opts.iter().any(|o| !o.is_set(ArgSettings::Required) && !o.is_set(ArgSettings::Hidden)) { + if !p.is_set(AS::UnifiedHelpMessage) && p.opts.iter().any(|o| { + !o.is_set(ArgSettings::Required) && !o.is_set(ArgSettings::Hidden) + }) { usage.push_str(" [OPTIONS]"); } @@ -94,13 +92,19 @@ pub fn create_help_usage(p: &Parser, incl_reqs: bool) -> String { let has_last = p.positionals.values().any(|p| p.is_set(ArgSettings::Last)); // places a '--' in the usage string if there are args and options // supporting multiple values - if p.opts.iter().any(|o| o.is_set(ArgSettings::Multiple)) && - p.positionals.values().any(|p| !p.is_set(ArgSettings::Required)) && - !p.has_visible_subcommands() && !has_last { + if p.opts.iter().any(|o| o.is_set(ArgSettings::Multiple)) + && p.positionals + .values() + .any(|p| !p.is_set(ArgSettings::Required)) + && !(p.has_visible_subcommands() || p.is_set(AS::AllowExternalSubcommands)) + && !has_last + { usage.push_str(" [--]"); } - let not_req_or_hidden = - |p: &PosBuilder| (!p.is_set(ArgSettings::Required) || p.is_set(ArgSettings::Last)) && !p.is_set(ArgSettings::Hidden); + let not_req_or_hidden = |p: &PosBuilder| { + (!p.is_set(ArgSettings::Required) || p.is_set(ArgSettings::Last)) + && !p.is_set(ArgSettings::Hidden) + }; if p.has_positionals() && p.positionals.values().any(not_req_or_hidden) { if let Some(args_tag) = get_args_tag(p, incl_reqs) { usage.push_str(&*args_tag); @@ -114,7 +118,11 @@ pub fn create_help_usage(p: &Parser, incl_reqs: bool) -> String { .expect(INTERNAL_ERROR_MSG); debugln!("usage::create_help_usage: '{}' has .last(true)", pos.name()); let req = pos.is_set(ArgSettings::Required); - if req && p.positionals.values().any(|p| !p.is_set(ArgSettings::Required)) { + if req + && p.positionals + .values() + .any(|p| !p.is_set(ArgSettings::Required)) + { usage.push_str(" -- <"); } else if req { usage.push_str(" [--] <"); @@ -131,7 +139,7 @@ pub fn create_help_usage(p: &Parser, incl_reqs: bool) -> String { } // incl_reqs is only false when this function is called recursively - if p.has_visible_subcommands() && incl_reqs { + if p.has_visible_subcommands() && incl_reqs || p.is_set(AS::AllowExternalSubcommands) { if p.is_set(AS::SubcommandsNegateReqs) || p.is_set(AS::ArgsNegateSubcommands) { if !p.is_set(AS::ArgsNegateSubcommands) { usage.push_str("\n "); @@ -161,21 +169,16 @@ fn create_smart_usage(p: &Parser, used: &[&str]) -> String { let mut hs: Vec<&str> = p.required().map(|s| &**s).collect(); hs.extend_from_slice(used); - let r_string = - get_required_usage_from(p, &hs, None, None, false).iter().fold(String::new(), |acc, s| { - acc + &format!(" {}", s)[..] - }); + let r_string = get_required_usage_from(p, &hs, None, None, false) + .iter() + .fold(String::new(), |acc, s| acc + &format!(" {}", s)[..]); - usage.push_str(&p.meta - .usage - .as_ref() - .unwrap_or_else(|| { - p.meta - .bin_name - .as_ref() - .unwrap_or(&p.meta.name) - }) - [..]); + usage.push_str( + &p.meta + .usage + .as_ref() + .unwrap_or_else(|| p.meta.bin_name.as_ref().unwrap_or(&p.meta.name))[..], + ); usage.push_str(&*r_string); if p.is_set(AS::SubcommandRequired) { usage.push_str(" <SUBCOMMAND>"); @@ -189,10 +192,11 @@ fn get_args_tag(p: &Parser, incl_reqs: bool) -> Option<String> { debugln!("usage::get_args_tag;"); let mut count = 0; 'outer: for pos in p.positionals - .values() - .filter(|pos| !pos.is_set(ArgSettings::Required)) - .filter(|pos| !pos.is_set(ArgSettings::Hidden)) - .filter(|pos| !pos.is_set(ArgSettings::Last)) { + .values() + .filter(|pos| !pos.is_set(ArgSettings::Required)) + .filter(|pos| !pos.is_set(ArgSettings::Hidden)) + .filter(|pos| !pos.is_set(ArgSettings::Last)) + { debugln!("usage::get_args_tag:iter:{}:", pos.b.name); if let Some(g_vec) = p.groups_for_arg(pos.b.name) { for grp_s in &g_vec { @@ -204,8 +208,10 @@ fn get_args_tag(p: &Parser, incl_reqs: bool) -> Option<String> { } } count += 1; - debugln!("usage::get_args_tag:iter: {} Args not required or hidden", - count); + debugln!( + "usage::get_args_tag:iter: {} Args not required or hidden", + count + ); } if !p.is_set(AS::DontCollapseArgsInUsage) && count > 1 { debugln!("usage::get_args_tag:iter: More than one, returning [ARGS]"); @@ -214,52 +220,65 @@ fn get_args_tag(p: &Parser, incl_reqs: bool) -> Option<String> { let pos = p.positionals .values() .find(|pos| { - !pos.is_set(ArgSettings::Required) && !pos.is_set(ArgSettings::Hidden) && - !pos.is_set(ArgSettings::Last) - }) + !pos.is_set(ArgSettings::Required) && !pos.is_set(ArgSettings::Hidden) + && !pos.is_set(ArgSettings::Last) + }) .expect(INTERNAL_ERROR_MSG); - debugln!("usage::get_args_tag:iter: Exactly one, returning '{}'", - pos.name()); - return Some(format!(" [{}]{}", pos.name_no_brackets(), pos.multiple_str())); + debugln!( + "usage::get_args_tag:iter: Exactly one, returning '{}'", + pos.name() + ); + return Some(format!( + " [{}]{}", + pos.name_no_brackets(), + pos.multiple_str() + )); } else if p.is_set(AS::DontCollapseArgsInUsage) && !p.positionals.is_empty() && incl_reqs { debugln!("usage::get_args_tag:iter: Don't collapse returning all"); - return Some(p.positionals - .values() - .filter(|pos| !pos.is_set(ArgSettings::Required)) - .filter(|pos| !pos.is_set(ArgSettings::Hidden)) - .filter(|pos| !pos.is_set(ArgSettings::Last)) - .map(|pos| { - format!(" [{}]{}", pos.name_no_brackets(), pos.multiple_str()) - }) - .collect::<Vec<_>>() - .join("")); + return Some( + p.positionals + .values() + .filter(|pos| !pos.is_set(ArgSettings::Required)) + .filter(|pos| !pos.is_set(ArgSettings::Hidden)) + .filter(|pos| !pos.is_set(ArgSettings::Last)) + .map(|pos| { + format!(" [{}]{}", pos.name_no_brackets(), pos.multiple_str()) + }) + .collect::<Vec<_>>() + .join(""), + ); } else if !incl_reqs { debugln!("usage::get_args_tag:iter: incl_reqs=false, building secondary usage string"); let highest_req_pos = p.positionals .iter() - .filter_map(|(idx, pos)| if pos.b.is_set(ArgSettings::Required) && - !pos.b.is_set(ArgSettings::Last) { - Some(idx) - } else { - None - }) + .filter_map(|(idx, pos)| { + if pos.b.is_set(ArgSettings::Required) && !pos.b.is_set(ArgSettings::Last) { + Some(idx) + } else { + None + } + }) .max() .unwrap_or_else(|| p.positionals.len()); - return Some(p.positionals - .iter() - .filter_map(|(idx, pos)| if idx <= highest_req_pos { - Some(pos) - } else { - None - }) - .filter(|pos| !pos.is_set(ArgSettings::Required)) - .filter(|pos| !pos.is_set(ArgSettings::Hidden)) - .filter(|pos| !pos.is_set(ArgSettings::Last)) - .map(|pos| { - format!(" [{}]{}", pos.name_no_brackets(), pos.multiple_str()) - }) - .collect::<Vec<_>>() - .join("")); + return Some( + p.positionals + .iter() + .filter_map(|(idx, pos)| { + if idx <= highest_req_pos { + Some(pos) + } else { + None + } + }) + .filter(|pos| !pos.is_set(ArgSettings::Required)) + .filter(|pos| !pos.is_set(ArgSettings::Hidden)) + .filter(|pos| !pos.is_set(ArgSettings::Last)) + .map(|pos| { + format!(" [{}]{}", pos.name_no_brackets(), pos.multiple_str()) + }) + .collect::<Vec<_>>() + .join(""), + ); } Some("".into()) } @@ -296,15 +315,18 @@ fn needs_flags_tag(p: &Parser) -> bool { } // Returns the required args in usage string form by fully unrolling all groups -pub fn get_required_usage_from<'a, 'b>(p: &Parser<'a, 'b>, - reqs: &[&'a str], - matcher: Option<&ArgMatcher<'a>>, - extra: Option<&str>, - incl_last: bool) - -> VecDeque<String> { - debugln!("usage::get_required_usage_from: reqs={:?}, extra={:?}", - reqs, - extra); +pub fn get_required_usage_from<'a, 'b>( + p: &Parser<'a, 'b>, + reqs: &[&'a str], + matcher: Option<&ArgMatcher<'a>>, + extra: Option<&str>, + incl_last: bool, +) -> VecDeque<String> { + debugln!( + "usage::get_required_usage_from: reqs={:?}, extra={:?}", + reqs, + extra + ); let mut desc_reqs: Vec<&str> = vec![]; desc_reqs.extend(extra); let mut new_reqs: Vec<&str> = vec![]; @@ -346,8 +368,10 @@ pub fn get_required_usage_from<'a, 'b>(p: &Parser<'a, 'b>, get_requires!(@group a, new_reqs, reqs); } desc_reqs.extend_from_slice(&*new_reqs); - debugln!("usage::get_required_usage_from: after init desc_reqs={:?}", - desc_reqs); + debugln!( + "usage::get_required_usage_from: after init desc_reqs={:?}", + desc_reqs + ); loop { let mut tmp = vec![]; for a in &new_reqs { @@ -361,20 +385,26 @@ pub fn get_required_usage_from<'a, 'b>(p: &Parser<'a, 'b>, break; } else { debugln!("usage::get_required_usage_from: after iter tmp={:?}", tmp); - debugln!("usage::get_required_usage_from: after iter new_reqs={:?}", - new_reqs); + debugln!( + "usage::get_required_usage_from: after iter new_reqs={:?}", + new_reqs + ); desc_reqs.extend_from_slice(&*new_reqs); new_reqs.clear(); new_reqs.extend_from_slice(&*tmp); - debugln!("usage::get_required_usage_from: after iter desc_reqs={:?}", - desc_reqs); + debugln!( + "usage::get_required_usage_from: after iter desc_reqs={:?}", + desc_reqs + ); } } desc_reqs.extend_from_slice(reqs); desc_reqs.sort(); desc_reqs.dedup(); - debugln!("usage::get_required_usage_from: final desc_reqs={:?}", - desc_reqs); + debugln!( + "usage::get_required_usage_from: final desc_reqs={:?}", + desc_reqs + ); let mut ret_val = VecDeque::new(); let args_in_groups = p.groups .iter() @@ -383,7 +413,8 @@ pub fn get_required_usage_from<'a, 'b>(p: &Parser<'a, 'b>, .collect::<Vec<_>>(); let pmap = if let Some(m) = matcher { - desc_reqs.iter() + desc_reqs + .iter() .filter(|a| p.positionals.values().any(|p| &&p.b.name == a)) .filter(|&pos| !m.contains(pos)) .filter_map(|pos| p.positionals.values().find(|x| &x.b.name == pos)) @@ -392,7 +423,8 @@ pub fn get_required_usage_from<'a, 'b>(p: &Parser<'a, 'b>, .map(|pos| (pos.index, pos)) .collect::<BTreeMap<u64, &PosBuilder>>() // sort by index } else { - desc_reqs.iter() + desc_reqs + .iter() .filter(|a| p.positionals.values().any(|pos| &&pos.b.name == a)) .filter_map(|pos| p.positionals.values().find(|x| &x.b.name == pos)) .filter(|&pos| incl_last || !pos.is_set(ArgSettings::Last)) @@ -400,31 +432,39 @@ pub fn get_required_usage_from<'a, 'b>(p: &Parser<'a, 'b>, .map(|pos| (pos.index, pos)) .collect::<BTreeMap<u64, &PosBuilder>>() // sort by index }; - debugln!("usage::get_required_usage_from: args_in_groups={:?}", - args_in_groups); + debugln!( + "usage::get_required_usage_from: args_in_groups={:?}", + args_in_groups + ); for &p in pmap.values() { let s = p.to_string(); if args_in_groups.is_empty() || !args_in_groups.contains(&&*s) { ret_val.push_back(s); } } - for a in desc_reqs.iter() - .filter(|name| !p.positionals.values().any(|p| &&p.b.name == name)) - .filter(|name| !p.groups.iter().any(|g| &&g.name == name)) - .filter(|name| !args_in_groups.contains(name)) - .filter(|name| !(matcher.is_some() && matcher.as_ref().unwrap().contains(name))) { + for a in desc_reqs + .iter() + .filter(|name| !p.positionals.values().any(|p| &&p.b.name == name)) + .filter(|name| !p.groups.iter().any(|g| &&g.name == name)) + .filter(|name| !args_in_groups.contains(name)) + .filter(|name| { + !(matcher.is_some() && matcher.as_ref().unwrap().contains(name)) + }) { debugln!("usage::get_required_usage_from:iter:{}:", a); let arg = find_by_name!(p, *a, flags, iter) .map(|f| f.to_string()) .unwrap_or_else(|| { - find_by_name!(p, *a, opts, iter) - .map(|o| o.to_string()) - .expect(INTERNAL_ERROR_MSG) - }); + find_by_name!(p, *a, opts, iter) + .map(|o| o.to_string()) + .expect(INTERNAL_ERROR_MSG) + }); ret_val.push_back(arg); } let mut g_vec: Vec<String> = vec![]; - for g in desc_reqs.iter().filter(|n| p.groups.iter().any(|g| &&g.name == n)) { + for g in desc_reqs + .iter() + .filter(|n| p.groups.iter().any(|g| &&g.name == n)) + { let g_string = p.args_in_group(g).join("|"); let elem = format!("<{}>", &g_string[..g_string.len()]); if !g_vec.contains(&elem) { diff --git a/src/vendor/clap/src/app/validator.rs b/src/vendor/clap/src/app/validator.rs index fd152a835b..01373dd5f9 100644 --- a/src/vendor/clap/src/app/validator.rs +++ b/src/vendor/clap/src/app/validator.rs @@ -1,5 +1,7 @@ // std use std::fmt::Display; +#[allow(unused_imports)] +use std::ascii::AsciiExt; // Internal use INTERNAL_ERROR_MSG; @@ -10,22 +12,24 @@ use errors::{Error, ErrorKind}; use errors::Result as ClapResult; use osstringext::OsStrExt2; use app::settings::AppSettings as AS; -use app::parser::{Parser, ParseResult}; +use app::parser::{ParseResult, Parser}; use fmt::{Colorizer, ColorizerOption}; use app::usage; pub struct Validator<'a, 'b, 'z>(&'z mut Parser<'a, 'b>) - where 'a: 'b, - 'b: 'z; +where + 'a: 'b, + 'b: 'z; impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { pub fn new(p: &'z mut Parser<'a, 'b>) -> Self { Validator(p) } - pub fn validate(&mut self, - needs_val_of: ParseResult<'a>, - subcmd_name: Option<String>, - matcher: &mut ArgMatcher<'a>) - -> ClapResult<()> { + pub fn validate( + &mut self, + needs_val_of: ParseResult<'a>, + subcmd_name: Option<String>, + matcher: &mut ArgMatcher<'a>, + ) -> ClapResult<()> { debugln!("Validator::validate;"); let mut reqs_validated = false; self.0.add_env(matcher)?; @@ -45,21 +49,24 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { true }; if should_err { - return Err(Error::empty_value(o, - &*usage::create_error_usage(self.0, matcher, None), - self.0.color())); + return Err(Error::empty_value( + o, + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } } - if matcher.is_empty() && matcher.subcommand_name().is_none() && - self.0.is_set(AS::ArgRequiredElseHelp) { + if matcher.is_empty() && matcher.subcommand_name().is_none() + && self.0.is_set(AS::ArgRequiredElseHelp) + { let mut out = vec![]; self.0.write_help_err(&mut out)?; return Err(Error { - message: String::from_utf8_lossy(&*out).into_owned(), - kind: ErrorKind::MissingArgumentOrSubcommand, - info: None, - }); + message: String::from_utf8_lossy(&*out).into_owned(), + kind: ErrorKind::MissingArgumentOrSubcommand, + info: None, + }); } self.validate_blacklist(matcher)?; if !(self.0.is_set(AS::SubcommandsNegateReqs) && subcmd_name.is_some()) && !reqs_validated { @@ -71,40 +78,54 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { Ok(()) } - fn validate_values<A>(&self, - arg: &A, - ma: &MatchedArg, - matcher: &ArgMatcher<'a>) - -> ClapResult<()> - where A: AnyArg<'a, 'b> + Display + fn validate_values<A>( + &self, + arg: &A, + ma: &MatchedArg, + matcher: &ArgMatcher<'a>, + ) -> ClapResult<()> + where + A: AnyArg<'a, 'b> + Display, { debugln!("Validator::validate_values: arg={:?}", arg.name()); for val in &ma.vals { if self.0.is_set(AS::StrictUtf8) && val.to_str().is_none() { - debugln!("Validator::validate_values: invalid UTF-8 found in val {:?}", - val); - return Err(Error::invalid_utf8(&*usage::create_error_usage(self.0, matcher, None), - self.0.color())); + debugln!( + "Validator::validate_values: invalid UTF-8 found in val {:?}", + val + ); + return Err(Error::invalid_utf8( + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } if let Some(p_vals) = arg.possible_vals() { debugln!("Validator::validate_values: possible_vals={:?}", p_vals); let val_str = val.to_string_lossy(); - if !p_vals.contains(&&*val_str) { - return Err(Error::invalid_value(val_str, - p_vals, - arg, - &*usage::create_error_usage(self.0, - matcher, - None), - self.0.color())); + let ok = if arg.is_set(ArgSettings::CaseInsensitive) { + p_vals.iter().any(|pv| pv.eq_ignore_ascii_case(&*val_str)) + } else { + p_vals.contains(&&*val_str) + }; + if !ok { + return Err(Error::invalid_value( + val_str, + p_vals, + arg, + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } } - if !arg.is_set(ArgSettings::EmptyValues) && val.is_empty_() && - matcher.contains(&*arg.name()) { + if !arg.is_set(ArgSettings::EmptyValues) && val.is_empty_() + && matcher.contains(&*arg.name()) + { debugln!("Validator::validate_values: illegal empty val found"); - return Err(Error::empty_value(arg, - &*usage::create_error_usage(self.0, matcher, None), - self.0.color())); + return Err(Error::empty_value( + arg, + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } if let Some(vtor) = arg.validator() { debug!("Validator::validate_values: checking validator..."); @@ -119,9 +140,11 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { debug!("Validator::validate_values: checking validator_os..."); if let Err(e) = vtor(val) { sdebugln!("error"); - return Err(Error::value_validation(Some(arg), - (*e).to_string_lossy().to_string(), - self.0.color())); + return Err(Error::value_validation( + Some(arg), + (*e).to_string_lossy().to_string(), + self.0.color(), + )); } else { sdebugln!("good"); } @@ -131,15 +154,17 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { } fn validate_blacklist(&self, matcher: &mut ArgMatcher) -> ClapResult<()> { - debugln!("Validator::validate_blacklist: blacklist={:?}", - self.0.blacklist); + debugln!( + "Validator::validate_blacklist: blacklist={:?}", + self.0.blacklist + ); macro_rules! build_err { ($p:expr, $name:expr, $matcher:ident) => ({ debugln!("build_err!: name={}", $name); let mut c_with = find_from!($p, &$name, blacklist, &$matcher); c_with = c_with.or( $p.find_any_arg(&$name).map_or(None, |aa| aa.blacklist()) - .map_or(None, + .map_or(None, |bl| bl.iter().find(|arg| $matcher.contains(arg))) .map_or(None, |an| $p.find_any_arg(an)) .map_or(None, |aa| Some(format!("{}", aa))) @@ -166,19 +191,36 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { } for name in &self.0.blacklist { - debugln!("Validator::validate_blacklist:iter:{}: Checking blacklisted arg", name); + debugln!( + "Validator::validate_blacklist:iter:{}: Checking blacklisted arg", + name + ); let mut should_err = false; if self.0.groups.iter().any(|g| &g.name == name) { - debugln!("Validator::validate_blacklist:iter:{}: groups contains it...", name); + debugln!( + "Validator::validate_blacklist:iter:{}: groups contains it...", + name + ); for n in self.0.arg_names_in_group(name) { - debugln!("Validator::validate_blacklist:iter:{}:iter:{}: looking in group...", name, n); + debugln!( + "Validator::validate_blacklist:iter:{}:iter:{}: looking in group...", + name, + n + ); if matcher.contains(n) { - debugln!("Validator::validate_blacklist:iter:{}:iter:{}: matcher contains it...", name, n); + debugln!( + "Validator::validate_blacklist:iter:{}:iter:{}: matcher contains it...", + name, + n + ); return Err(build_err!(self.0, n, matcher)); } } } else if let Some(ma) = matcher.get(name) { - debugln!("Validator::validate_blacklist:iter:{}: matcher contains it...", name); + debugln!( + "Validator::validate_blacklist:iter:{}: matcher contains it...", + name + ); should_err = ma.occurs > 0; } if should_err { @@ -191,9 +233,11 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { fn validate_matched_args(&self, matcher: &mut ArgMatcher<'a>) -> ClapResult<()> { debugln!("Validator::validate_matched_args;"); for (name, ma) in matcher.iter() { - debugln!("Validator::validate_matched_args:iter:{}: vals={:#?}", - name, - ma.vals); + debugln!( + "Validator::validate_matched_args:iter:{}: vals={:#?}", + name, + ma.vals + ); if let Some(opt) = find_by_name!(self.0, *name, opts, iter) { self.validate_arg_num_vals(opt, ma, matcher)?; self.validate_values(opt, ma, matcher)?; @@ -223,31 +267,35 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { Ok(()) } - fn validate_arg_num_occurs<A>(&self, - a: &A, - ma: &MatchedArg, - matcher: &ArgMatcher) - -> ClapResult<()> - where A: AnyArg<'a, 'b> + Display + fn validate_arg_num_occurs<A>( + &self, + a: &A, + ma: &MatchedArg, + matcher: &ArgMatcher, + ) -> ClapResult<()> + where + A: AnyArg<'a, 'b> + Display, { debugln!("Validator::validate_arg_num_occurs: a={};", a.name()); if ma.occurs > 1 && !a.is_set(ArgSettings::Multiple) { // Not the first time, and we don't allow multiples - return Err(Error::unexpected_multiple_usage(a, - &*usage::create_error_usage(self.0, - matcher, - None), - self.0.color())); + return Err(Error::unexpected_multiple_usage( + a, + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } Ok(()) } - fn validate_arg_num_vals<A>(&self, - a: &A, - ma: &MatchedArg, - matcher: &ArgMatcher) - -> ClapResult<()> - where A: AnyArg<'a, 'b> + Display + fn validate_arg_num_vals<A>( + &self, + a: &A, + ma: &MatchedArg, + matcher: &ArgMatcher, + ) -> ClapResult<()> + where + A: AnyArg<'a, 'b> + Display, { debugln!("Validator::validate_arg_num_vals;"); if let Some(num) = a.num_vals() { @@ -259,73 +307,79 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { }; if should_err { debugln!("Validator::validate_arg_num_vals: Sending error WrongNumberOfValues"); - return Err(Error::wrong_number_of_values(a, - num, - if a.is_set(ArgSettings::Multiple) { - (ma.vals.len() % num as usize) - } else { - ma.vals.len() - }, - if ma.vals.len() == 1 || - (a.is_set(ArgSettings::Multiple) && - (ma.vals.len() % num as usize) == - 1) { - "as" - } else { - "ere" - }, - &*usage::create_error_usage(self.0, - matcher, - None), - self.0.color())); + return Err(Error::wrong_number_of_values( + a, + num, + if a.is_set(ArgSettings::Multiple) { + (ma.vals.len() % num as usize) + } else { + ma.vals.len() + }, + if ma.vals.len() == 1 + || (a.is_set(ArgSettings::Multiple) && (ma.vals.len() % num as usize) == 1) + { + "as" + } else { + "ere" + }, + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } } if let Some(num) = a.max_vals() { debugln!("Validator::validate_arg_num_vals: max_vals set...{}", num); if (ma.vals.len() as u64) > num { debugln!("Validator::validate_arg_num_vals: Sending error TooManyValues"); - return Err(Error::too_many_values(ma.vals - .iter() - .last() - .expect(INTERNAL_ERROR_MSG) - .to_str() - .expect(INVALID_UTF8), - a, - &*usage::create_error_usage(self.0, - matcher, - None), - self.0.color())); + return Err(Error::too_many_values( + ma.vals + .iter() + .last() + .expect(INTERNAL_ERROR_MSG) + .to_str() + .expect(INVALID_UTF8), + a, + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } } let min_vals_zero = if let Some(num) = a.min_vals() { debugln!("Validator::validate_arg_num_vals: min_vals set: {}", num); if (ma.vals.len() as u64) < num && num != 0 { debugln!("Validator::validate_arg_num_vals: Sending error TooFewValues"); - return Err(Error::too_few_values(a, - num, - ma.vals.len(), - &*usage::create_error_usage(self.0, - matcher, - None), - self.0.color())); + return Err(Error::too_few_values( + a, + num, + ma.vals.len(), + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } num == 0 - } else { false }; + } else { + false + }; // Issue 665 (https://github.com/kbknapp/clap-rs/issues/665) - if a.takes_value() && !(a.is_set(ArgSettings::EmptyValues) || min_vals_zero) && ma.vals.is_empty() { - return Err(Error::empty_value(a, - &*usage::create_error_usage(self.0, matcher, None), - self.0.color())); + // Issue 1105 (https://github.com/kbknapp/clap-rs/issues/1105) + if a.takes_value() && !min_vals_zero && ma.vals.is_empty() { + return Err(Error::empty_value( + a, + &*usage::create_error_usage(self.0, matcher, None), + self.0.color(), + )); } Ok(()) } - fn validate_arg_requires<A>(&self, - a: &A, - ma: &MatchedArg, - matcher: &ArgMatcher) - -> ClapResult<()> - where A: AnyArg<'a, 'b> + Display + fn validate_arg_requires<A>( + &self, + a: &A, + ma: &MatchedArg, + matcher: &ArgMatcher, + ) -> ClapResult<()> + where + A: AnyArg<'a, 'b> + Display, { debugln!("Validator::validate_arg_requires;"); if let Some(a_reqs) = a.requires() { @@ -341,8 +395,10 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { } fn validate_required(&self, matcher: &ArgMatcher) -> ClapResult<()> { - debugln!("Validator::validate_required: required={:?};", - self.0.required); + debugln!( + "Validator::validate_required: required={:?};", + self.0.required + ); 'outer: for name in &self.0.required { debugln!("Validator::validate_required:iter:{}:", name); if matcher.contains(name) { @@ -376,25 +432,25 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { } fn validate_conflicts<A>(&self, a: &A, matcher: &ArgMatcher) -> Option<bool> - where A: AnyArg<'a, 'b> + where + A: AnyArg<'a, 'b>, { debugln!("Validator::validate_conflicts: a={:?};", a.name()); - a.blacklist() - .map(|bl| { - bl.iter() - .any(|conf| { - matcher.contains(conf) || - self.0 - .groups - .iter() - .find(|g| &g.name == conf) - .map_or(false, |g| g.args.iter().any(|arg| matcher.contains(arg))) - }) + a.blacklist().map(|bl| { + bl.iter().any(|conf| { + matcher.contains(conf) + || self.0 + .groups + .iter() + .find(|g| &g.name == conf) + .map_or(false, |g| g.args.iter().any(|arg| matcher.contains(arg))) }) + }) } fn validate_required_unless<A>(&self, a: &A, matcher: &ArgMatcher) -> Option<bool> - where A: AnyArg<'a, 'b> + where + A: AnyArg<'a, 'b>, { debugln!("Validator::validate_required_unless: a={:?};", a.name()); macro_rules! check { @@ -410,7 +466,7 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { } }) }) - }}; + }}; } if a.is_set(ArgSettings::RequiredUnlessAll) { check!(all, self.0, a, matcher) @@ -425,11 +481,7 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { use_stderr: true, when: self.0.color(), }); - let mut reqs = self.0 - .required - .iter() - .map(|&r| &*r) - .collect::<Vec<_>>(); + let mut reqs = self.0.required.iter().map(|&r| &*r).collect::<Vec<_>>(); if let Some(r) = extra { reqs.push(r); } @@ -439,22 +491,27 @@ impl<'a, 'b, 'z> Validator<'a, 'b, 'z> { let req_args = usage::get_required_usage_from(self.0, &reqs[..], Some(matcher), extra, true) .iter() - .fold(String::new(), - |acc, s| acc + &format!("\n {}", c.error(s))[..]); - debugln!("Validator::missing_required_error: req_args={:#?}", - req_args); - Err(Error::missing_required_argument(&*req_args, - &*usage::create_error_usage(self.0, matcher, extra), - self.0.color())) + .fold(String::new(), |acc, s| { + acc + &format!("\n {}", c.error(s))[..] + }); + debugln!( + "Validator::missing_required_error: req_args={:#?}", + req_args + ); + Err(Error::missing_required_argument( + &*req_args, + &*usage::create_error_usage(self.0, matcher, extra), + self.0.color(), + )) } #[inline] fn is_missing_required_ok<A>(&self, a: &A, matcher: &ArgMatcher) -> bool - where A: AnyArg<'a, 'b> + where + A: AnyArg<'a, 'b>, { debugln!("Validator::is_missing_required_ok: a={}", a.name()); - self.validate_conflicts(a, matcher).unwrap_or(false) || - self.validate_required_unless(a, matcher) - .unwrap_or(false) + self.validate_conflicts(a, matcher).unwrap_or(false) + || self.validate_required_unless(a, matcher).unwrap_or(false) } } diff --git a/src/vendor/clap/src/args/arg.rs b/src/vendor/clap/src/args/arg.rs index 5d8e077429..92a5e7629f 100644 --- a/src/vendor/clap/src/args/arg.rs +++ b/src/vendor/clap/src/args/arg.rs @@ -1,10 +1,10 @@ #[cfg(feature = "yaml")] use std::collections::BTreeMap; use std::rc::Rc; -use std::ffi::{OsString, OsStr}; -#[cfg(target_os="windows")] +use std::ffi::{OsStr, OsString}; +#[cfg(target_os = "windows")] use osstringext::OsStrExt3; -#[cfg(not(target_os="windows"))] +#[cfg(not(target_os = "windows"))] use std::os::unix::ffi::OsStrExt; use std::env; @@ -14,7 +14,7 @@ use map::VecMap; use usage_parser::UsageParser; use args::settings::ArgSettings; -use args::arg_builder::{Base, Valued, Switched}; +use args::arg_builder::{Base, Switched, Valued}; /// The abstract representation of a command line argument. Used to set all the options and /// relationships that define a valid argument for the program. @@ -41,18 +41,14 @@ use args::arg_builder::{Base, Valued, Switched}; #[allow(missing_debug_implementations)] #[derive(Default, Clone)] pub struct Arg<'a, 'b> - where 'a: 'b +where + 'a: 'b, { - #[doc(hidden)] - pub b: Base<'a, 'b>, - #[doc(hidden)] - pub s: Switched<'b>, - #[doc(hidden)] - pub v: Valued<'a, 'b>, - #[doc(hidden)] - pub index: Option<u64>, - #[doc(hidden)] - pub r_ifs: Option<Vec<(&'a str, &'b str)>>, + #[doc(hidden)] pub b: Base<'a, 'b>, + #[doc(hidden)] pub s: Switched<'b>, + #[doc(hidden)] pub v: Valued<'a, 'b>, + #[doc(hidden)] pub index: Option<u64>, + #[doc(hidden)] pub r_ifs: Option<Vec<(&'a str, &'b str)>>, } impl<'a, 'b> Arg<'a, 'b> { @@ -73,7 +69,12 @@ impl<'a, 'b> Arg<'a, 'b> { /// ``` /// [`Arg::takes_value(true)`]: ./struct.Arg.html#method.takes_value /// [`Arg`]: ./struct.Arg.html - pub fn with_name(n: &'a str) -> Self { Arg { b: Base::new(n), ..Default::default() } } + pub fn with_name(n: &'a str) -> Self { + Arg { + b: Base::new(n), + ..Default::default() + } + } /// Creates a new instance of [`Arg`] from a .yml (YAML) file. /// @@ -143,11 +144,11 @@ impl<'a, 'b> Arg<'a, 'b> { a.setb(ArgSettings::RequiredUnlessAll); a } - s => { - panic!("Unknown Arg setting '{}' in YAML file for arg '{}'", - s, - name_str) - } + s => panic!( + "Unknown Arg setting '{}' in YAML file for arg '{}'", + s, + name_str + ), } } @@ -605,10 +606,10 @@ impl<'a, 'b> Arg<'a, 'b> { /// that cannot be read by this program. Obviously I'm going on /// and on, so I'll stop now. /// - /// -h, --help + /// -h, --help /// Prints help information /// - /// -V, --version + /// -V, --version /// Prints version information /// ``` /// [`Arg::help`]: ./struct.Arg.html#method.help @@ -624,13 +625,13 @@ impl<'a, 'b> Arg<'a, 'b> { /// allows one to access this arg early using the `--` syntax. Accessing an arg early, even with /// the `--` syntax is otherwise not possible. /// - /// **NOTE:** This will change the usage string to look like `$ prog [FLAGS] [-- <ARG>]` if + /// **NOTE:** This will change the usage string to look like `$ prog [FLAGS] [-- <ARG>]` if /// `ARG` is marked as `.last(true)`. /// /// **NOTE:** This setting will imply [`AppSettings::DontCollapseArgsInUsage`] because failing /// to set this can make the usage string very confusing. /// - /// **NOTE**: This setting only applies to positional arguments, and has no affect on FLAGS / + /// **NOTE**: This setting only applies to positional arguments, and has no affect on FLAGS / /// OPTIONS /// /// **CAUTION:** Setting an argument to `.last(true)` *and* having child subcommands is not @@ -1891,10 +1892,10 @@ impl<'a, 'b> Arg<'a, 'b> { /// **WARNING:** /// /// Setting `multiple(true)` for an [option] with no other details, allows multiple values - /// **and** multiple occurrences because it isn't possible to have more occurrences than values - /// for options. Because multiple values are allowed, `--option val1 val2 val3` is perfectly - /// valid, be careful when designing a CLI where positional arguments are expected after a - /// option which accepts multiple values, as `clap` will continue parsing *values* until it + /// **and** multiple occurrences because it isn't possible to have more occurrences than values + /// for options. Because multiple values are allowed, `--option val1 val2 val3` is perfectly + /// valid, be careful when designing a CLI where positional arguments are expected after a + /// option which accepts multiple values, as `clap` will continue parsing *values* until it /// reaches the max or specific number of values defined, or another flag or option. /// /// **Pro Tip**: @@ -1904,35 +1905,35 @@ impl<'a, 'b> Arg<'a, 'b> { /// [`Arg::multiple(true)`]. /// /// **WARNING:** - /// + /// /// When using args with `multiple(true)` on [options] or [positionals] (i.e. those args that /// accept values) and [subcommands], one needs to consider the posibility of an argument value /// being the same as a valid subcommand. By default `clap` will parse the argument in question /// as a value *only if* a value is possible at that moment. Otherwise it will be parsed as a /// subcommand. In effect, this means using `multiple(true)` with no additional parameters and - /// a possible value that coincides with a subcommand name, the subcommand cannot be called + /// a possible value that coincides with a subcommand name, the subcommand cannot be called /// unless another argument is passed first. - /// + /// /// As an example, consider a CLI with an option `--ui-paths=<paths>...` and subcommand `signer` - /// + /// /// The following would be parsed as values to `--ui-paths`. - /// + /// /// ```notrust /// $ program --ui-paths path1 path2 signer /// ``` - /// + /// /// This is because `--ui-paths` accepts multiple values. `clap` will continue parsing values /// until another argument is reached and it knows `--ui-paths` is done. - /// + /// /// By adding additional parameters to `--ui-paths` we can solve this issue. Consider adding - /// [`Arg::number_of_values(1)`] as discussed above. The following are all valid, and `signer` + /// [`Arg::number_of_values(1)`] as discussed above. The following are all valid, and `signer` /// is parsed as both a subcommand and a value in the second case. - /// + /// /// ```notrust /// $ program --ui-paths path1 signer /// $ program --ui-paths path1 --ui-paths signer signer /// ``` - /// + /// /// # Examples /// /// ```rust @@ -2133,8 +2134,8 @@ impl<'a, 'b> Arg<'a, 'b> { /// Specifies that an argument can be matched to all child [`SubCommand`]s. /// /// **NOTE:** Global arguments *only* propagate down, **not** up (to parent commands), however - /// their values once a user uses them will be propagated back up to parents. In effect, this - /// means one should *define* all global arguments at the top level, however it doesn't matter + /// their values once a user uses them will be propagated back up to parents. In effect, this + /// means one should *define* all global arguments at the top level, however it doesn't matter /// where the user *uses* the global argument. /// /// # Examples @@ -2390,6 +2391,59 @@ impl<'a, 'b> Arg<'a, 'b> { self } + /// When used with [`Arg::possible_values`] it allows the argument value to pass validation even if + /// the case differs from that of the specified `possible_value`. + /// + /// **Pro Tip:** Use this setting with [`arg_enum!`] + /// + /// # Examples + /// + /// ```rust + /// # use clap::{App, Arg}; + /// # use std::ascii::AsciiExt; + /// let m = App::new("pv") + /// .arg(Arg::with_name("option") + /// .long("--option") + /// .takes_value(true) + /// .possible_value("test123") + /// .case_insensitive(true)) + /// .get_matches_from(vec![ + /// "pv", "--option", "TeSt123", + /// ]); + /// + /// assert!(m.value_of("option").unwrap().eq_ignore_ascii_case("test123")); + /// ``` + /// + /// This setting also works when multiple values can be defined: + /// + /// ```rust + /// # use clap::{App, Arg}; + /// let m = App::new("pv") + /// .arg(Arg::with_name("option") + /// .short("-o") + /// .long("--option") + /// .takes_value(true) + /// .possible_value("test123") + /// .possible_value("test321") + /// .multiple(true) + /// .case_insensitive(true)) + /// .get_matches_from(vec![ + /// "pv", "--option", "TeSt123", "teST123", "tESt321" + /// ]); + /// + /// let matched_vals = m.values_of("option").unwrap().collect::<Vec<_>>(); + /// assert_eq!(&*matched_vals, &["TeSt123", "teST123", "tESt321"]); + /// ``` + /// [`Arg::case_insensitive(true)`]: ./struct.Arg.html#method.possible_values + /// [`arg_enum!`]: ./macro.arg_enum.html + pub fn case_insensitive(self, ci: bool) -> Self { + if ci { + self.set(ArgSettings::CaseInsensitive) + } else { + self.unset(ArgSettings::CaseInsensitive) + } + } + /// Specifies the name of the [`ArgGroup`] the argument belongs to. /// /// # Examples @@ -2550,19 +2604,20 @@ impl<'a, 'b> Arg<'a, 'b> { /// [`Err(String)`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err /// [`Rc`]: https://doc.rust-lang.org/std/rc/struct.Rc.html pub fn validator<F>(mut self, f: F) -> Self - where F: Fn(String) -> Result<(), String> + 'static + where + F: Fn(String) -> Result<(), String> + 'static, { self.v.validator = Some(Rc::new(f)); self } - /// Works identically to Validator but is intended to be used with values that could + /// Works identically to Validator but is intended to be used with values that could /// contain non UTF-8 formatted strings. /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```rust")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```rust")] /// # use clap::{App, Arg}; /// # use std::ffi::{OsStr, OsString}; /// # use std::os::unix::ffi::OsStrExt; @@ -2587,7 +2642,8 @@ impl<'a, 'b> Arg<'a, 'b> { /// [`Err(String)`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err /// [`Rc`]: https://doc.rust-lang.org/std/rc/struct.Rc.html pub fn validator_os<F>(mut self, f: F) -> Self - where F: Fn(&OsStr) -> Result<(), OsString> + 'static + where + F: Fn(&OsStr) -> Result<(), OsString> + 'static, { self.v.validator_os = Some(Rc::new(f)); self @@ -2890,9 +2946,11 @@ impl<'a, 'b> Arg<'a, 'b> { self.unsetb(ArgSettings::ValueDelimiterNotSet); self.setb(ArgSettings::TakesValue); self.setb(ArgSettings::UseValueDelimiter); - self.v.val_delim = Some(d.chars() - .nth(0) - .expect("Failed to get value_delimiter from arg")); + self.v.val_delim = Some( + d.chars() + .nth(0) + .expect("Failed to get value_delimiter from arg"), + ); self } @@ -3210,20 +3268,23 @@ impl<'a, 'b> Arg<'a, 'b> { /// [`Arg::takes_value(true)`]: ./struct.Arg.html#method.takes_value /// [`Arg::default_value`]: ./struct.Arg.html#method.default_value pub fn default_value_if(self, arg: &'a str, val: Option<&'b str>, default: &'b str) -> Self { - self.default_value_if_os(arg, - val.map(str::as_bytes).map(OsStr::from_bytes), - OsStr::from_bytes(default.as_bytes())) + self.default_value_if_os( + arg, + val.map(str::as_bytes).map(OsStr::from_bytes), + OsStr::from_bytes(default.as_bytes()), + ) } /// Provides a conditional default value in the exact same manner as [`Arg::default_value_if`] /// only using [`OsStr`]s instead. /// [`Arg::default_value_if`]: ./struct.Arg.html#method.default_value_if /// [`OsStr`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html - pub fn default_value_if_os(mut self, - arg: &'a str, - val: Option<&'b OsStr>, - default: &'b OsStr) - -> Self { + pub fn default_value_if_os( + mut self, + arg: &'a str, + val: Option<&'b OsStr>, + default: &'b OsStr, + ) -> Self { self.setb(ArgSettings::TakesValue); if let Some(ref mut vm) = self.v.default_vals_ifs { let l = vm.len(); @@ -3322,9 +3383,11 @@ impl<'a, 'b> Arg<'a, 'b> { /// [`Arg::default_value`]: ./struct.Arg.html#method.default_value pub fn default_value_ifs(mut self, ifs: &[(&'a str, Option<&'b str>, &'b str)]) -> Self { for &(arg, val, default) in ifs { - self = self.default_value_if_os(arg, - val.map(str::as_bytes).map(OsStr::from_bytes), - OsStr::from_bytes(default.as_bytes())); + self = self.default_value_if_os( + arg, + val.map(str::as_bytes).map(OsStr::from_bytes), + OsStr::from_bytes(default.as_bytes()), + ); } self } @@ -3344,7 +3407,7 @@ impl<'a, 'b> Arg<'a, 'b> { /// Specifies that if the value is not passed in as an argument, that it should be retrieved /// from the environment, if available. If it is not present in the environment, then default /// rules will apply. - /// + /// /// **NOTE:** If the user *does not* use this argument at runtime, [`ArgMatches::occurrences_of`] /// will return `0` even though the [`ArgMatches::value_of`] will return the default specified. /// @@ -3352,23 +3415,23 @@ impl<'a, 'b> Arg<'a, 'b> { /// return `true` if the variable is present in the environemnt . If you wish to determine whether /// the argument was used at runtime or not, consider [`ArgMatches::occurrences_of`] which will /// return `0` if the argument was *not* used at runtime. - /// + /// /// **NOTE:** This implicitly sets [`Arg::takes_value(true)`]. - /// + /// /// **NOTE:** If [`Arg::multiple(true)`] is set then [`Arg::use_delimiter(true)`] should also be /// set. Otherwise, only a single argument will be returned from the environment variable. The /// default delimiter is `,` and follows all the other delimiter rules. - /// + /// /// # Examples - /// + /// /// In this example, we show the variable coming from the environment: - /// + /// /// ```rust /// # use std::env; /// # use clap::{App, Arg}; /// /// env::set_var("MY_FLAG", "env"); - /// + /// /// let m = App::new("prog") /// .arg(Arg::with_name("flag") /// .long("flag") @@ -3379,15 +3442,15 @@ impl<'a, 'b> Arg<'a, 'b> { /// /// assert_eq!(m.value_of("flag"), Some("env")); /// ``` - /// + /// /// In this example, we show the variable coming from an option on the CLI: - /// + /// /// ```rust /// # use std::env; /// # use clap::{App, Arg}; /// /// env::set_var("MY_FLAG", "env"); - /// + /// /// let m = App::new("prog") /// .arg(Arg::with_name("flag") /// .long("flag") @@ -3398,16 +3461,16 @@ impl<'a, 'b> Arg<'a, 'b> { /// /// assert_eq!(m.value_of("flag"), Some("opt")); /// ``` - /// + /// /// In this example, we show the variable coming from the environment even with the /// presence of a default: - /// + /// /// ```rust /// # use std::env; /// # use clap::{App, Arg}; /// /// env::set_var("MY_FLAG", "env"); - /// + /// /// let m = App::new("prog") /// .arg(Arg::with_name("flag") /// .long("flag") @@ -3419,15 +3482,15 @@ impl<'a, 'b> Arg<'a, 'b> { /// /// assert_eq!(m.value_of("flag"), Some("env")); /// ``` - /// + /// /// In this example, we show the use of multiple values in a single environment variable: - /// + /// /// ```rust /// # use std::env; /// # use clap::{App, Arg}; /// /// env::set_var("MY_FLAG_MULTI", "env1,env2"); - /// + /// /// let m = App::new("prog") /// .arg(Arg::with_name("flag") /// .long("flag") @@ -3440,9 +3503,7 @@ impl<'a, 'b> Arg<'a, 'b> { /// /// assert_eq!(m.values_of("flag").unwrap().collect::<Vec<_>>(), vec!["env1", "env2"]); /// ``` - pub fn env(self, name: &'a str) -> Self { - self.env_os(OsStr::new(name)) - } + pub fn env(self, name: &'a str) -> Self { self.env_os(OsStr::new(name)) } /// Specifies that if the value is not passed in as an argument, that it should be retrieved /// from the environment if available in the exact same manner as [`Arg::env`] only using @@ -3454,6 +3515,15 @@ impl<'a, 'b> Arg<'a, 'b> { self } + /// @TODO @p2 @docs @release: write docs + pub fn hide_env_values(self, hide: bool) -> Self { + if hide { + self.set(ArgSettings::HideEnvValues) + } else { + self.unset(ArgSettings::HideEnvValues) + } + } + /// When set to `true` the help string will be displayed on the line after the argument and /// indented once. This can be helpful for arguments with very long or complex help messages. /// This can also be helpful for arguments with very long flag names, or many/long value names. @@ -3606,7 +3676,5 @@ impl<'a, 'b, 'z> From<&'z Arg<'a, 'b>> for Arg<'a, 'b> { } impl<'n, 'e> PartialEq for Arg<'n, 'e> { - fn eq(&self, other: &Arg<'n, 'e>) -> bool { - self.b == other.b - } + fn eq(&self, other: &Arg<'n, 'e>) -> bool { self.b == other.b } } diff --git a/src/vendor/clap/src/args/arg_builder/base.rs b/src/vendor/clap/src/args/arg_builder/base.rs index 5990bc0826..fef9d8ab97 100644 --- a/src/vendor/clap/src/args/arg_builder/base.rs +++ b/src/vendor/clap/src/args/arg_builder/base.rs @@ -1,9 +1,9 @@ - -use args::{ArgSettings, Arg, ArgFlags}; +use args::{Arg, ArgFlags, ArgSettings}; #[derive(Debug, Clone, Default)] pub struct Base<'a, 'b> - where 'a: 'b +where + 'a: 'b, { pub name: &'a str, pub help: Option<&'b str>, @@ -17,7 +17,12 @@ pub struct Base<'a, 'b> } impl<'n, 'e> Base<'n, 'e> { - pub fn new(name: &'n str) -> Self { Base { name: name, ..Default::default() } } + pub fn new(name: &'n str) -> Self { + Base { + name: name, + ..Default::default() + } + } pub fn set(&mut self, s: ArgSettings) { self.settings.set(s); } pub fn unset(&mut self, s: ArgSettings) { self.settings.unset(s); } @@ -29,7 +34,5 @@ impl<'n, 'e, 'z> From<&'z Arg<'n, 'e>> for Base<'n, 'e> { } impl<'n, 'e> PartialEq for Base<'n, 'e> { - fn eq(&self, other: &Base<'n, 'e>) -> bool { - self.name == other.name - } -} \ No newline at end of file + fn eq(&self, other: &Base<'n, 'e>) -> bool { self.name == other.name } +} diff --git a/src/vendor/clap/src/args/arg_builder/switched.rs b/src/vendor/clap/src/args/arg_builder/switched.rs index e42586c260..224b2f2b24 100644 --- a/src/vendor/clap/src/args/arg_builder/switched.rs +++ b/src/vendor/clap/src/args/arg_builder/switched.rs @@ -1,4 +1,3 @@ - use Arg; #[derive(Debug)] diff --git a/src/vendor/clap/src/args/arg_matcher.rs b/src/vendor/clap/src/args/arg_matcher.rs index 967516c501..4e76802e6e 100644 --- a/src/vendor/clap/src/args/arg_matcher.rs +++ b/src/vendor/clap/src/args/arg_matcher.rs @@ -21,16 +21,19 @@ impl<'a> Default for ArgMatcher<'a> { impl<'a> ArgMatcher<'a> { pub fn new() -> Self { ArgMatcher::default() } - pub fn propagate_globals(&mut self, global_arg_vec : &[&'a str]) { - debugln!("ArgMatcher::get_global_values: global_arg_vec={:?}", global_arg_vec); + pub fn propagate_globals(&mut self, global_arg_vec: &[&'a str]) { + debugln!( + "ArgMatcher::get_global_values: global_arg_vec={:?}", + global_arg_vec + ); let mut vals_map = HashMap::new(); self.fill_in_global_values(global_arg_vec, &mut vals_map); } fn fill_in_global_values( - &mut self, - global_arg_vec: &[&'a str], - vals_map: &mut HashMap<&'a str, MatchedArg> + &mut self, + global_arg_vec: &[&'a str], + vals_map: &mut HashMap<&'a str, MatchedArg>, ) { for global_arg in global_arg_vec { if let Some(ma) = self.get(global_arg) { @@ -120,7 +123,8 @@ impl<'a> ArgMatcher<'a> { } pub fn needs_more_vals<'b, A>(&self, o: &A) -> bool - where A: AnyArg<'a, 'b> + where + A: AnyArg<'a, 'b>, { debugln!("ArgMatcher::needs_more_vals: o={}", o.name()); if let Some(ma) = self.get(o.name()) { diff --git a/src/vendor/clap/src/args/arg_matches.rs b/src/vendor/clap/src/args/arg_matches.rs index 14a1904516..770067a34d 100644 --- a/src/vendor/clap/src/args/arg_matches.rs +++ b/src/vendor/clap/src/args/arg_matches.rs @@ -59,12 +59,9 @@ use args::SubCommand; /// [`App::get_matches`]: ./struct.App.html#method.get_matches #[derive(Debug, Clone)] pub struct ArgMatches<'a> { - #[doc(hidden)] - pub args: HashMap<&'a str, MatchedArg>, - #[doc(hidden)] - pub subcommand: Option<Box<SubCommand<'a>>>, - #[doc(hidden)] - pub usage: Option<String>, + #[doc(hidden)] pub args: HashMap<&'a str, MatchedArg>, + #[doc(hidden)] pub subcommand: Option<Box<SubCommand<'a>>>, + #[doc(hidden)] pub usage: Option<String>, } impl<'a> Default for ArgMatches<'a> { @@ -79,7 +76,11 @@ impl<'a> Default for ArgMatches<'a> { impl<'a> ArgMatches<'a> { #[doc(hidden)] - pub fn new() -> Self { ArgMatches { ..Default::default() } } + pub fn new() -> Self { + ArgMatches { + ..Default::default() + } + } /// Gets the value of a specific [option] or [positional] argument (i.e. an argument that takes /// an additional value at runtime). If the option wasn't present at runtime @@ -126,8 +127,8 @@ impl<'a> ArgMatches<'a> { /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```")] /// # use clap::{App, Arg}; /// use std::ffi::OsString; /// use std::os::unix::ffi::{OsStrExt,OsStringExt}; @@ -161,8 +162,8 @@ impl<'a> ArgMatches<'a> { /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```")] /// # use clap::{App, Arg}; /// use std::ffi::OsString; /// use std::os::unix::ffi::{OsStrExt,OsStringExt}; @@ -211,7 +212,9 @@ impl<'a> ArgMatches<'a> { if let Some(arg) = self.args.get(name.as_ref()) { fn to_str_slice(o: &OsString) -> &str { o.to_str().expect(INVALID_UTF8) } let to_str_slice: fn(&OsString) -> &str = to_str_slice; // coerce to fn pointer - return Some(Values { iter: arg.vals.iter().map(to_str_slice) }); + return Some(Values { + iter: arg.vals.iter().map(to_str_slice), + }); } None } @@ -222,8 +225,8 @@ impl<'a> ArgMatches<'a> { /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```")] /// # use clap::{App, Arg}; /// use std::ffi::OsString; /// use std::os::unix::ffi::OsStringExt; @@ -242,10 +245,12 @@ impl<'a> ArgMatches<'a> { /// ``` pub fn values_of_lossy<S: AsRef<str>>(&'a self, name: S) -> Option<Vec<String>> { if let Some(arg) = self.args.get(name.as_ref()) { - return Some(arg.vals - .iter() - .map(|v| v.to_string_lossy().into_owned()) - .collect()); + return Some( + arg.vals + .iter() + .map(|v| v.to_string_lossy().into_owned()) + .collect(), + ); } None } @@ -258,8 +263,8 @@ impl<'a> ArgMatches<'a> { /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```")] /// # use clap::{App, Arg}; /// use std::ffi::{OsStr,OsString}; /// use std::os::unix::ffi::{OsStrExt,OsStringExt}; @@ -285,7 +290,9 @@ impl<'a> ArgMatches<'a> { fn to_str_slice(o: &OsString) -> &OsStr { &*o } let to_str_slice: fn(&'a OsString) -> &'a OsStr = to_str_slice; // coerce to fn pointer if let Some(arg) = self.args.get(name.as_ref()) { - return Some(OsValues { iter: arg.vals.iter().map(to_str_slice) }); + return Some(OsValues { + iter: arg.vals.iter().map(to_str_slice), + }); } None } @@ -507,7 +514,9 @@ impl<'a> ArgMatches<'a> { /// [`ArgMatches::subcommand_matches`]: ./struct.ArgMatches.html#method.subcommand_matches /// [`ArgMatches::subcommand_name`]: ./struct.ArgMatches.html#method.subcommand_name pub fn subcommand(&self) -> (&str, Option<&ArgMatches<'a>>) { - self.subcommand.as_ref().map_or(("", None), |sc| (&sc.name[..], Some(&sc.matches))) + self.subcommand + .as_ref() + .map_or(("", None), |sc| (&sc.name[..], Some(&sc.matches))) } /// Returns a string slice of the usage statement for the [`App`] or [`SubCommand`] @@ -573,7 +582,9 @@ impl<'a> Default for Values<'a> { static EMPTY: [OsString; 0] = []; // This is never called because the iterator is empty: fn to_str_slice(_: &OsString) -> &str { unreachable!() }; - Values { iter: EMPTY[..].iter().map(to_str_slice) } + Values { + iter: EMPTY[..].iter().map(to_str_slice), + } } } @@ -596,8 +607,8 @@ fn test_default_values_with_shorter_lifetime() { /// /// # Examples /// -#[cfg_attr(not(unix), doc=" ```ignore")] -#[cfg_attr( unix , doc=" ```")] +#[cfg_attr(not(unix), doc = " ```ignore")] +#[cfg_attr(unix, doc = " ```")] /// # use clap::{App, Arg}; /// use std::ffi::OsString; /// use std::os::unix::ffi::{OsStrExt,OsStringExt}; @@ -634,7 +645,9 @@ impl<'a> Default for OsValues<'a> { static EMPTY: [OsString; 0] = []; // This is never called because the iterator is empty: fn to_str_slice(_: &OsString) -> &OsStr { unreachable!() }; - OsValues { iter: EMPTY[..].iter().map(to_str_slice) } + OsValues { + iter: EMPTY[..].iter().map(to_str_slice), + } } } diff --git a/src/vendor/clap/src/args/group.rs b/src/vendor/clap/src/args/group.rs index 1d555aba4c..e082b69f4d 100644 --- a/src/vendor/clap/src/args/group.rs +++ b/src/vendor/clap/src/args/group.rs @@ -79,18 +79,12 @@ use yaml_rust::Yaml; /// [requirement]: ./struct.Arg.html#method.requires #[derive(Default)] pub struct ArgGroup<'a> { - #[doc(hidden)] - pub name: &'a str, - #[doc(hidden)] - pub args: Vec<&'a str>, - #[doc(hidden)] - pub required: bool, - #[doc(hidden)] - pub requires: Option<Vec<&'a str>>, - #[doc(hidden)] - pub conflicts: Option<Vec<&'a str>>, - #[doc(hidden)] - pub multiple: bool, + #[doc(hidden)] pub name: &'a str, + #[doc(hidden)] pub args: Vec<&'a str>, + #[doc(hidden)] pub required: bool, + #[doc(hidden)] pub requires: Option<Vec<&'a str>>, + #[doc(hidden)] pub conflicts: Option<Vec<&'a str>>, + #[doc(hidden)] pub multiple: bool, } impl<'a> ArgGroup<'a> { @@ -154,9 +148,11 @@ impl<'a> ArgGroup<'a> { /// [argument]: ./struct.Arg.html #[cfg_attr(feature = "lints", allow(should_assert_eq))] pub fn arg(mut self, n: &'a str) -> Self { - assert!(self.name != n, - "ArgGroup '{}' can not have same name as arg inside it", - &*self.name); + assert!( + self.name != n, + "ArgGroup '{}' can not have same name as arg inside it", + &*self.name + ); self.args.push(n); self } @@ -426,19 +422,21 @@ impl<'a> ArgGroup<'a> { impl<'a> Debug for ArgGroup<'a> { fn fmt(&self, f: &mut Formatter) -> Result { - write!(f, - "{{\n\ - \tname: {:?},\n\ - \targs: {:?},\n\ - \trequired: {:?},\n\ - \trequires: {:?},\n\ - \tconflicts: {:?},\n\ - }}", - self.name, - self.args, - self.required, - self.requires, - self.conflicts) + write!( + f, + "{{\n\ + \tname: {:?},\n\ + \targs: {:?},\n\ + \trequired: {:?},\n\ + \trequires: {:?},\n\ + \tconflicts: {:?},\n\ + }}", + self.name, + self.args, + self.required, + self.requires, + self.conflicts + ) } } @@ -462,7 +460,9 @@ impl<'a> From<&'a BTreeMap<Yaml, Yaml>> for ArgGroup<'a> { let mut a = ArgGroup::default(); let group_settings = if b.len() == 1 { let name_yml = b.keys().nth(0).expect("failed to get name"); - let name_str = name_yml.as_str().expect("failed to convert arg YAML name to str"); + let name_str = name_yml + .as_str() + .expect("failed to convert arg YAML name to str"); a.name = name_str; b.get(name_yml) .expect("failed to get name_str") @@ -491,12 +491,12 @@ impl<'a> From<&'a BTreeMap<Yaml, Yaml>> for ArgGroup<'a> { } a } - s => { - panic!("Unknown ArgGroup setting '{}' in YAML file for \ - ArgGroup '{}'", - s, - a.name) - } + s => panic!( + "Unknown ArgGroup setting '{}' in YAML file for \ + ArgGroup '{}'", + s, + a.name + ), } } @@ -551,17 +551,19 @@ mod test { let reqs = vec!["r1", "r2", "r3", "r4"]; let confs = vec!["c1", "c2", "c3", "c4"]; - let debug_str = format!("{{\n\ - \tname: \"test\",\n\ - \targs: {:?},\n\ - \trequired: {:?},\n\ - \trequires: {:?},\n\ - \tconflicts: {:?},\n\ - }}", - args, - true, - Some(reqs), - Some(confs)); + let debug_str = format!( + "{{\n\ + \tname: \"test\",\n\ + \targs: {:?},\n\ + \trequired: {:?},\n\ + \trequires: {:?},\n\ + \tconflicts: {:?},\n\ + }}", + args, + true, + Some(reqs), + Some(confs) + ); assert_eq!(&*format!("{:?}", g), &*debug_str); } @@ -589,10 +591,9 @@ mod test { assert_eq!(g2.conflicts, Some(confs)); } - #[cfg(feature="yaml")] + #[cfg(feature = "yaml")] #[cfg_attr(feature = "yaml", test)] fn test_yaml() { - let g_yaml = "name: test args: - a1 diff --git a/src/vendor/clap/src/args/matched_arg.rs b/src/vendor/clap/src/args/matched_arg.rs index 9a73af9d59..4847718c60 100644 --- a/src/vendor/clap/src/args/matched_arg.rs +++ b/src/vendor/clap/src/args/matched_arg.rs @@ -4,10 +4,8 @@ use std::ffi::OsString; #[doc(hidden)] #[derive(Debug, Clone)] pub struct MatchedArg { - #[doc(hidden)] - pub occurs: u64, - #[doc(hidden)] - pub vals: Vec<OsString>, + #[doc(hidden)] pub occurs: u64, + #[doc(hidden)] pub vals: Vec<OsString>, } impl Default for MatchedArg { diff --git a/src/vendor/clap/src/args/mod.rs b/src/vendor/clap/src/args/mod.rs index 5c87e1be91..21f9b850d5 100644 --- a/src/vendor/clap/src/args/mod.rs +++ b/src/vendor/clap/src/args/mod.rs @@ -1,8 +1,8 @@ pub use self::any_arg::{AnyArg, DispOrder}; pub use self::arg::Arg; -pub use self::arg_builder::{Base, Switched, Valued, FlagBuilder, OptBuilder, PosBuilder}; +pub use self::arg_builder::{Base, FlagBuilder, OptBuilder, PosBuilder, Switched, Valued}; pub use self::arg_matcher::ArgMatcher; -pub use self::arg_matches::{Values, OsValues, ArgMatches}; +pub use self::arg_matches::{ArgMatches, OsValues, Values}; pub use self::group::ArgGroup; pub use self::matched_arg::MatchedArg; pub use self::settings::{ArgFlags, ArgSettings}; diff --git a/src/vendor/clap/src/args/settings.rs b/src/vendor/clap/src/args/settings.rs index c453e4a2ea..9de94d6957 100644 --- a/src/vendor/clap/src/args/settings.rs +++ b/src/vendor/clap/src/args/settings.rs @@ -1,9 +1,10 @@ // Std +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::str::FromStr; bitflags! { - struct Flags: u16 { + struct Flags: u32 { const REQUIRED = 1; const MULTIPLE = 1 << 1; const EMPTY_VALS = 1 << 2; @@ -20,6 +21,8 @@ bitflags! { const REQUIRE_EQUALS = 1 << 13; const LAST = 1 << 14; const HIDE_DEFAULT_VAL = 1 << 15; + const CASE_INSENSITIVE = 1 << 16; + const HIDE_ENV_VALS = 1 << 17; } } @@ -31,27 +34,29 @@ impl ArgFlags { pub fn new() -> Self { ArgFlags::default() } impl_settings!{ArgSettings, - Required => REQUIRED, - Multiple => MULTIPLE, - EmptyValues => EMPTY_VALS, - Global => GLOBAL, - Hidden => HIDDEN, - TakesValue => TAKES_VAL, - UseValueDelimiter => USE_DELIM, - NextLineHelp => NEXT_LINE_HELP, - RequiredUnlessAll => R_UNLESS_ALL, - RequireDelimiter => REQ_DELIM, - ValueDelimiterNotSet => DELIM_NOT_SET, - HidePossibleValues => HIDE_POS_VALS, - AllowLeadingHyphen => ALLOW_TAC_VALS, - RequireEquals => REQUIRE_EQUALS, - Last => LAST, - HideDefaultValue => HIDE_DEFAULT_VAL + Required => Flags::REQUIRED, + Multiple => Flags::MULTIPLE, + EmptyValues => Flags::EMPTY_VALS, + Global => Flags::GLOBAL, + Hidden => Flags::HIDDEN, + TakesValue => Flags::TAKES_VAL, + UseValueDelimiter => Flags::USE_DELIM, + NextLineHelp => Flags::NEXT_LINE_HELP, + RequiredUnlessAll => Flags::R_UNLESS_ALL, + RequireDelimiter => Flags::REQ_DELIM, + ValueDelimiterNotSet => Flags::DELIM_NOT_SET, + HidePossibleValues => Flags::HIDE_POS_VALS, + AllowLeadingHyphen => Flags::ALLOW_TAC_VALS, + RequireEquals => Flags::REQUIRE_EQUALS, + Last => Flags::LAST, + CaseInsensitive => Flags::CASE_INSENSITIVE, + HideEnvValues => Flags::HIDE_ENV_VALS, + HideDefaultValue => Flags::HIDE_DEFAULT_VAL } } impl Default for ArgFlags { - fn default() -> Self { ArgFlags(EMPTY_VALS | DELIM_NOT_SET) } + fn default() -> Self { ArgFlags(Flags::EMPTY_VALS | Flags::DELIM_NOT_SET) } } /// Various settings that apply to arguments and may be set, unset, and checked via getter/setter @@ -91,10 +96,12 @@ pub enum ArgSettings { Last, /// Hides the default value from the help string HideDefaultValue, - #[doc(hidden)] - RequiredUnlessAll, - #[doc(hidden)] - ValueDelimiterNotSet, + /// Makes `Arg::possible_values` case insensitive + CaseInsensitive, + /// Hides ENV values in the help message + HideEnvValues, + #[doc(hidden)] RequiredUnlessAll, + #[doc(hidden)] ValueDelimiterNotSet, } impl FromStr for ArgSettings { @@ -117,6 +124,8 @@ impl FromStr for ArgSettings { "requireequals" => Ok(ArgSettings::RequireEquals), "last" => Ok(ArgSettings::Last), "hidedefaultvalue" => Ok(ArgSettings::HideDefaultValue), + "caseinsensitive" => Ok(ArgSettings::CaseInsensitive), + "hideenvvalues" => Ok(ArgSettings::HideEnvValues), _ => Err("unknown ArgSetting, cannot convert from str".to_owned()), } } @@ -128,38 +137,75 @@ mod test { #[test] fn arg_settings_fromstr() { - assert_eq!("allowleadinghyphen".parse::<ArgSettings>().unwrap(), - ArgSettings::AllowLeadingHyphen); - assert_eq!("emptyvalues".parse::<ArgSettings>().unwrap(), - ArgSettings::EmptyValues); - assert_eq!("global".parse::<ArgSettings>().unwrap(), - ArgSettings::Global); - assert_eq!("hidepossiblevalues".parse::<ArgSettings>().unwrap(), - ArgSettings::HidePossibleValues); - assert_eq!("hidden".parse::<ArgSettings>().unwrap(), - ArgSettings::Hidden); - assert_eq!("multiple".parse::<ArgSettings>().unwrap(), - ArgSettings::Multiple); - assert_eq!("nextlinehelp".parse::<ArgSettings>().unwrap(), - ArgSettings::NextLineHelp); - assert_eq!("requiredunlessall".parse::<ArgSettings>().unwrap(), - ArgSettings::RequiredUnlessAll); - assert_eq!("requiredelimiter".parse::<ArgSettings>().unwrap(), - ArgSettings::RequireDelimiter); - assert_eq!("required".parse::<ArgSettings>().unwrap(), - ArgSettings::Required); - assert_eq!("takesvalue".parse::<ArgSettings>().unwrap(), - ArgSettings::TakesValue); - assert_eq!("usevaluedelimiter".parse::<ArgSettings>().unwrap(), - ArgSettings::UseValueDelimiter); - assert_eq!("valuedelimiternotset".parse::<ArgSettings>().unwrap(), - ArgSettings::ValueDelimiterNotSet); - assert_eq!("requireequals".parse::<ArgSettings>().unwrap(), - ArgSettings::RequireEquals); - assert_eq!("last".parse::<ArgSettings>().unwrap(), - ArgSettings::Last); - assert_eq!("hidedefaultvalue".parse::<ArgSettings>().unwrap(), - ArgSettings::HideDefaultValue); + assert_eq!( + "allowleadinghyphen".parse::<ArgSettings>().unwrap(), + ArgSettings::AllowLeadingHyphen + ); + assert_eq!( + "emptyvalues".parse::<ArgSettings>().unwrap(), + ArgSettings::EmptyValues + ); + assert_eq!( + "global".parse::<ArgSettings>().unwrap(), + ArgSettings::Global + ); + assert_eq!( + "hidepossiblevalues".parse::<ArgSettings>().unwrap(), + ArgSettings::HidePossibleValues + ); + assert_eq!( + "hidden".parse::<ArgSettings>().unwrap(), + ArgSettings::Hidden + ); + assert_eq!( + "multiple".parse::<ArgSettings>().unwrap(), + ArgSettings::Multiple + ); + assert_eq!( + "nextlinehelp".parse::<ArgSettings>().unwrap(), + ArgSettings::NextLineHelp + ); + assert_eq!( + "requiredunlessall".parse::<ArgSettings>().unwrap(), + ArgSettings::RequiredUnlessAll + ); + assert_eq!( + "requiredelimiter".parse::<ArgSettings>().unwrap(), + ArgSettings::RequireDelimiter + ); + assert_eq!( + "required".parse::<ArgSettings>().unwrap(), + ArgSettings::Required + ); + assert_eq!( + "takesvalue".parse::<ArgSettings>().unwrap(), + ArgSettings::TakesValue + ); + assert_eq!( + "usevaluedelimiter".parse::<ArgSettings>().unwrap(), + ArgSettings::UseValueDelimiter + ); + assert_eq!( + "valuedelimiternotset".parse::<ArgSettings>().unwrap(), + ArgSettings::ValueDelimiterNotSet + ); + assert_eq!( + "requireequals".parse::<ArgSettings>().unwrap(), + ArgSettings::RequireEquals + ); + assert_eq!("last".parse::<ArgSettings>().unwrap(), ArgSettings::Last); + assert_eq!( + "hidedefaultvalue".parse::<ArgSettings>().unwrap(), + ArgSettings::HideDefaultValue + ); + assert_eq!( + "caseinsensitive".parse::<ArgSettings>().unwrap(), + ArgSettings::CaseInsensitive + ); + assert_eq!( + "hideenvvalues".parse::<ArgSettings>().unwrap(), + ArgSettings::HideEnvValues + ); assert!("hahahaha".parse::<ArgSettings>().is_err()); } } diff --git a/src/vendor/clap/src/args/subcommand.rs b/src/vendor/clap/src/args/subcommand.rs index 5154c4114c..eebbf827ae 100644 --- a/src/vendor/clap/src/args/subcommand.rs +++ b/src/vendor/clap/src/args/subcommand.rs @@ -29,10 +29,8 @@ use ArgMatches; /// [arguments]: ./struct.Arg.html #[derive(Debug, Clone)] pub struct SubCommand<'a> { - #[doc(hidden)] - pub name: String, - #[doc(hidden)] - pub matches: ArgMatches<'a>, + #[doc(hidden)] pub name: String, + #[doc(hidden)] pub matches: ArgMatches<'a>, } impl<'a> SubCommand<'a> { diff --git a/src/vendor/clap/src/completions/bash.rs b/src/vendor/clap/src/completions/bash.rs index a5333828af..983b250bc4 100644 --- a/src/vendor/clap/src/completions/bash.rs +++ b/src/vendor/clap/src/completions/bash.rs @@ -7,7 +7,8 @@ use args::{ArgSettings, OptBuilder}; use completions; pub struct BashGen<'a, 'b> - where 'a: 'b +where + 'a: 'b, { p: &'b Parser<'a, 'b>, } @@ -16,9 +17,10 @@ impl<'a, 'b> BashGen<'a, 'b> { pub fn new(p: &'b Parser<'a, 'b>) -> Self { BashGen { p: p } } pub fn generate_to<W: Write>(&self, buf: &mut W) { - - w!(buf, - format!("_{name}() {{ + w!( + buf, + format!( + "_{name}() {{ local i cur prev opts cmds COMPREPLY=() cur=\"${{COMP_WORDS[COMP_CWORD]}}\" @@ -60,13 +62,14 @@ impl<'a, 'b> BashGen<'a, 'b> { complete -F _{name} -o bashdefault -o default {name} ", - name = self.p.meta.bin_name.as_ref().unwrap(), - name_opts = self.all_options_for_path(self.p.meta.bin_name.as_ref().unwrap()), - name_opts_details = - self.option_details_for_path(self.p.meta.bin_name.as_ref().unwrap()), - subcmds = self.all_subcommands(), - subcmd_details = self.subcommand_details()) - .as_bytes()); + name = self.p.meta.bin_name.as_ref().unwrap(), + name_opts = self.all_options_for_path(self.p.meta.bin_name.as_ref().unwrap()), + name_opts_details = + self.option_details_for_path(self.p.meta.bin_name.as_ref().unwrap()), + subcmds = self.all_subcommands(), + subcmd_details = self.subcommand_details() + ).as_bytes() + ); } fn all_subcommands(&self) -> String { @@ -75,12 +78,14 @@ complete -F _{name} -o bashdefault -o default {name} let scs = completions::all_subcommand_names(self.p); for sc in &scs { - subcmds = format!("{} + subcmds = format!( + "{} {name}) cmd+=\"__{name}\" ;;", - subcmds, - name = sc.replace("-", "__")); + subcmds, + name = sc.replace("-", "__") + ); } subcmds @@ -94,7 +99,8 @@ complete -F _{name} -o bashdefault -o default {name} scs.dedup(); for sc in &scs { - subcmd_dets = format!("{} + subcmd_dets = format!( + "{} {subcmd}) opts=\"{sc_opts}\" if [[ ${{cur}} == -* || ${{COMP_CWORD}} -eq {level} ]] ; then @@ -110,11 +116,12 @@ complete -F _{name} -o bashdefault -o default {name} COMPREPLY=( $(compgen -W \"${{opts}}\" -- ${{cur}}) ) return 0 ;;", - subcmd_dets, - subcmd = sc.replace("-", "__"), - sc_opts = self.all_options_for_path(&*sc), - level = sc.split("__").map(|_| 1).fold(0, |acc, n| acc + n), - opts_details = self.option_details_for_path(&*sc)); + subcmd_dets, + subcmd = sc.replace("-", "__"), + sc_opts = self.all_options_for_path(&*sc), + level = sc.split("__").map(|_| 1).fold(0, |acc, n| acc + n), + opts_details = self.option_details_for_path(&*sc) + ); } subcmd_dets @@ -130,24 +137,28 @@ complete -F _{name} -o bashdefault -o default {name} let mut opts = String::new(); for o in p.opts() { if let Some(l) = o.s.long { - opts = format!("{} + opts = format!( + "{} --{}) COMPREPLY=({}) return 0 ;;", - opts, - l, - self.vals_for(o)); + opts, + l, + self.vals_for(o) + ); } if let Some(s) = o.s.short { - opts = format!("{} + opts = format!( + "{} -{}) COMPREPLY=({}) return 0 ;;", - opts, - s, - self.vals_for(o)); + opts, + s, + self.vals_for(o) + ); } } opts @@ -164,10 +175,12 @@ complete -F _{name} -o bashdefault -o default {name} } else if let Some(vec) = o.val_names() { let mut it = vec.iter().peekable(); while let Some((_, val)) = it.next() { - ret = format!("{}<{}>{}", - ret, - val, - if it.peek().is_some() { " " } else { "" }); + ret = format!( + "{}<{}>{}", + ret, + val, + if it.peek().is_some() { " " } else { "" } + ); } let num = vec.len(); if o.is_set(ArgSettings::Multiple) && num == 1 { @@ -176,10 +189,12 @@ complete -F _{name} -o bashdefault -o default {name} } else if let Some(num) = o.num_vals() { let mut it = (0..num).peekable(); while let Some(_) = it.next() { - ret = format!("{}<{}>{}", - ret, - o.name(), - if it.peek().is_some() { " " } else { "" }); + ret = format!( + "{}<{}>{}", + ret, + o.name(), + if it.peek().is_some() { " " } else { "" } + ); } if o.is_set(ArgSettings::Multiple) && num == 1 { ret = format!("{}...", ret); @@ -203,26 +218,35 @@ complete -F _{name} -o bashdefault -o default {name} p = &find_subcmd!(p, sc).unwrap().p; } let mut opts = shorts!(p).fold(String::new(), |acc, s| format!("{} -{}", acc, s)); - opts = format!("{} {}", - opts, - longs!(p).fold(String::new(), |acc, l| format!("{} --{}", acc, l))); - opts = format!("{} {}", - opts, - p.positionals - .values() - .fold(String::new(), |acc, p| format!("{} {}", acc, p))); - opts = format!("{} {}", - opts, - p.subcommands - .iter() - .fold(String::new(), |acc, s| format!("{} {}", acc, s.p.meta.name))); + opts = format!( + "{} {}", + opts, + longs!(p).fold(String::new(), |acc, l| format!("{} --{}", acc, l)) + ); + opts = format!( + "{} {}", + opts, + p.positionals + .values() + .fold(String::new(), |acc, p| format!("{} {}", acc, p)) + ); + opts = format!( + "{} {}", + opts, + p.subcommands + .iter() + .fold(String::new(), |acc, s| format!("{} {}", acc, s.p.meta.name)) + ); for sc in &p.subcommands { if let Some(ref aliases) = sc.p.meta.aliases { - opts = format!("{} {}", - opts, - aliases.iter() - .map(|&(n, _)| n) - .fold(String::new(), |acc, a| format!("{} {}", acc, a))); + opts = format!( + "{} {}", + opts, + aliases + .iter() + .map(|&(n, _)| n) + .fold(String::new(), |acc, a| format!("{} {}", acc, a)) + ); } } opts diff --git a/src/vendor/clap/src/completions/fish.rs b/src/vendor/clap/src/completions/fish.rs index 96e8cc2463..841c39b3a3 100644 --- a/src/vendor/clap/src/completions/fish.rs +++ b/src/vendor/clap/src/completions/fish.rs @@ -1,4 +1,3 @@ - // Std use std::io::Write; @@ -6,7 +5,8 @@ use std::io::Write; use app::parser::Parser; pub struct FishGen<'a, 'b> - where 'a: 'b +where + 'a: 'b, { p: &'b Parser<'a, 'b>, } @@ -31,8 +31,7 @@ impl<'a, 'b> FishGen<'a, 'b> { return 1 end -"# - .to_string(); +"#.to_string(); let mut buffer = detect_subcommand_function; gen_fish_inner(command, self, &command.to_string(), &mut buffer); @@ -41,9 +40,7 @@ end } // Escape string inside single quotes -fn escape_string(string: &str) -> String { - string.replace("\\", "\\\\").replace("'", "\\'") -} +fn escape_string(string: &str) -> String { string.replace("\\", "\\\\").replace("'", "\\'") } fn gen_fish_inner(root_command: &str, comp_gen: &FishGen, parent_cmds: &str, buffer: &mut String) { debugln!("FishGen::gen_fish_inner;"); @@ -59,9 +56,11 @@ fn gen_fish_inner(root_command: &str, comp_gen: &FishGen, parent_cmds: &str, buf // -f # don't use file completion // -n "__fish_using_command myprog subcmd1" # complete for command "myprog subcmd1" - let basic_template = format!("complete -c {} -n \"__fish_using_command {}\"", - root_command, - parent_cmds); + let basic_template = format!( + "complete -c {} -n \"__fish_using_command {}\"", + root_command, + parent_cmds + ); for option in comp_gen.p.opts() { let mut template = basic_template.clone(); diff --git a/src/vendor/clap/src/completions/macros.rs b/src/vendor/clap/src/completions/macros.rs index a4ffce4bd8..653c72c486 100644 --- a/src/vendor/clap/src/completions/macros.rs +++ b/src/vendor/clap/src/completions/macros.rs @@ -1,4 +1,3 @@ - macro_rules! w { ($buf:expr, $to_w:expr) => { match $buf.write_all($to_w) { @@ -20,7 +19,7 @@ macro_rules! get_zsh_arg_conflicts { if let Some(l) = arg.long() { v.push(format!("--{}", l)); } - } + } v.join(" ") } else { String::new() diff --git a/src/vendor/clap/src/completions/mod.rs b/src/vendor/clap/src/completions/mod.rs index 6d067882bf..026b449354 100644 --- a/src/vendor/clap/src/completions/mod.rs +++ b/src/vendor/clap/src/completions/mod.rs @@ -18,7 +18,8 @@ use self::powershell::PowerShellGen; pub use self::shell::Shell; pub struct ComplGen<'a, 'b> - where 'a: 'b +where + 'a: 'b, { p: &'b Parser<'a, 'b>, } @@ -44,7 +45,10 @@ impl<'a, 'b> ComplGen<'a, 'b> { // aliasing. pub fn all_subcommand_names(p: &Parser) -> Vec<String> { debugln!("all_subcommand_names;"); - let mut subcmds: Vec<_> = subcommands_of(p).iter().map(|&(ref n, _)| n.clone()).collect(); + let mut subcmds: Vec<_> = subcommands_of(p) + .iter() + .map(|&(ref n, _)| n.clone()) + .collect(); for sc_v in p.subcommands.iter().map(|s| all_subcommand_names(&s.p)) { subcmds.extend(sc_v); } @@ -75,14 +79,24 @@ pub fn all_subcommands(p: &Parser) -> Vec<(String, String)> { // Also note, aliases are treated as their own subcommands but duplicates of whatever they're // aliasing. pub fn subcommands_of(p: &Parser) -> Vec<(String, String)> { - debugln!("subcommands_of: name={}, bin_name={}", - p.meta.name, - p.meta.bin_name.as_ref().unwrap()); + debugln!( + "subcommands_of: name={}, bin_name={}", + p.meta.name, + p.meta.bin_name.as_ref().unwrap() + ); let mut subcmds = vec![]; - debugln!("subcommands_of: Has subcommands...{:?}", p.has_subcommands()); + debugln!( + "subcommands_of: Has subcommands...{:?}", + p.has_subcommands() + ); if !p.has_subcommands() { - let mut ret = vec![(p.meta.name.clone(), p.meta.bin_name.as_ref().unwrap().clone())]; + let mut ret = vec![ + ( + p.meta.name.clone(), + p.meta.bin_name.as_ref().unwrap().clone(), + ), + ]; debugln!("subcommands_of: Looking for aliases..."); if let Some(ref aliases) = p.meta.aliases { for &(n, _) in aliases { @@ -98,9 +112,11 @@ pub fn subcommands_of(p: &Parser) -> Vec<(String, String)> { return ret; } for sc in &p.subcommands { - debugln!("subcommands_of:iter: name={}, bin_name={}", - sc.p.meta.name, - sc.p.meta.bin_name.as_ref().unwrap()); + debugln!( + "subcommands_of:iter: name={}, bin_name={}", + sc.p.meta.name, + sc.p.meta.bin_name.as_ref().unwrap() + ); debugln!("subcommands_of:iter: Looking for aliases..."); if let Some(ref aliases) = sc.p.meta.aliases { @@ -114,7 +130,10 @@ pub fn subcommands_of(p: &Parser) -> Vec<(String, String)> { subcmds.push((n.to_owned(), als_bin_name.join(" "))); } } - subcmds.push((sc.p.meta.name.clone(), sc.p.meta.bin_name.as_ref().unwrap().clone())); + subcmds.push(( + sc.p.meta.name.clone(), + sc.p.meta.bin_name.as_ref().unwrap().clone(), + )); } subcmds } @@ -138,7 +157,13 @@ pub fn get_all_subcommand_paths(p: &Parser, first: bool) -> Vec<String> { } for sc in &p.subcommands { let name = &*sc.p.meta.name; - let path = sc.p.meta.bin_name.as_ref().unwrap().clone().replace(" ", "__"); + let path = sc.p + .meta + .bin_name + .as_ref() + .unwrap() + .clone() + .replace(" ", "__"); subcmds.push(path.clone()); if let Some(ref aliases) = sc.p.meta.aliases { for &(n, _) in aliases { @@ -146,7 +171,10 @@ pub fn get_all_subcommand_paths(p: &Parser, first: bool) -> Vec<String> { } } } - for sc_v in p.subcommands.iter().map(|s| get_all_subcommand_paths(&s.p, false)) { + for sc_v in p.subcommands + .iter() + .map(|s| get_all_subcommand_paths(&s.p, false)) + { subcmds.extend(sc_v); } subcmds diff --git a/src/vendor/clap/src/completions/powershell.rs b/src/vendor/clap/src/completions/powershell.rs index 423dd450bf..19b149692e 100644 --- a/src/vendor/clap/src/completions/powershell.rs +++ b/src/vendor/clap/src/completions/powershell.rs @@ -1,4 +1,3 @@ - // Std use std::io::Write; @@ -7,7 +6,8 @@ use app::parser::Parser; use INTERNAL_ERROR_MSG; pub struct PowerShellGen<'a, 'b> - where 'a: 'b +where + 'a: 'b, { p: &'b Parser<'a, 'b>, } @@ -19,7 +19,8 @@ impl<'a, 'b> PowerShellGen<'a, 'b> { let bin_name = self.p.meta.bin_name.as_ref().unwrap(); let mut names = vec![]; - let (subcommands_detection_cases, subcommands_cases) = generate_inner(self.p, "", &mut names); + let (subcommands_detection_cases, subcommands_cases) = + generate_inner(self.p, "", &mut names); let mut bin_names = vec![bin_name.to_string(), format!("./{0}", bin_name)]; if cfg!(windows) { @@ -74,23 +75,33 @@ impl<'a, 'b> PowerShellGen<'a, 'b> { } } -fn generate_inner<'a, 'b, 'p>(p: &'p Parser<'a, 'b>, previous_command_name: &str, names: &mut Vec<&'p str>) -> (String, String) { +fn generate_inner<'a, 'b, 'p>( + p: &'p Parser<'a, 'b>, + previous_command_name: &str, + names: &mut Vec<&'p str>, +) -> (String, String) { debugln!("PowerShellGen::generate_inner;"); let command_name = if previous_command_name.is_empty() { - format!("{}_{}", previous_command_name, &p.meta.bin_name.as_ref().expect(INTERNAL_ERROR_MSG)) + format!( + "{}_{}", + previous_command_name, + &p.meta.bin_name.as_ref().expect(INTERNAL_ERROR_MSG) + ) } else { format!("{}_{}", previous_command_name, &p.meta.name) }; let mut subcommands_detection_cases = if !names.contains(&&*p.meta.name) { names.push(&*p.meta.name); - format!(r" + format!( + r" '{0}' {{ $command += '_{0}' break }} ", - &p.meta.name) + &p.meta.name + ) } else { String::new() }; @@ -106,13 +117,15 @@ fn generate_inner<'a, 'b, 'p>(p: &'p Parser<'a, 'b>, previous_command_name: &str completions.push_str(&format!("'--{}', ", long)); } - let mut subcommands_cases = format!(r" + let mut subcommands_cases = format!( + r" '{}' {{ $completions = @({}) }} ", - &command_name, - completions.trim_right_matches(", ")); + &command_name, + completions.trim_right_matches(", ") + ); for subcommand in &p.subcommands { let (subcommand_subcommands_detection_cases, subcommand_subcommands_cases) = diff --git a/src/vendor/clap/src/completions/shell.rs b/src/vendor/clap/src/completions/shell.rs index 60513ede1a..75b7d360b0 100644 --- a/src/vendor/clap/src/completions/shell.rs +++ b/src/vendor/clap/src/completions/shell.rs @@ -1,3 +1,4 @@ +#[allow(unused_imports)] use std::ascii::AsciiExt; use std::str::FromStr; use std::fmt; @@ -6,7 +7,7 @@ use std::fmt; #[cfg_attr(feature = "lints", allow(enum_variant_names))] #[derive(Debug, Copy, Clone)] pub enum Shell { - /// Generates a .bash-completion completion file for the Bourne Again SHell (BASH) + /// Generates a .bash completion file for the Bourne Again SHell (BASH) Bash, /// Generates a .fish completion file for the Friendly Interactive SHell (fish) Fish, @@ -26,7 +27,6 @@ impl FromStr for Shell { fn from_str(s: &str) -> Result<Self, Self::Err> { match s { - "ZSH" | _ if s.eq_ignore_ascii_case("zsh") => Ok(Shell::Zsh), "FISH" | _ if s.eq_ignore_ascii_case("fish") => Ok(Shell::Fish), "BASH" | _ if s.eq_ignore_ascii_case("bash") => Ok(Shell::Bash), diff --git a/src/vendor/clap/src/completions/zsh.rs b/src/vendor/clap/src/completions/zsh.rs index 298b5cadde..8fbc1ff69f 100644 --- a/src/vendor/clap/src/completions/zsh.rs +++ b/src/vendor/clap/src/completions/zsh.rs @@ -1,17 +1,18 @@ - // Std use std::io::Write; +#[allow(unused_imports)] use std::ascii::AsciiExt; // Internal use app::App; use app::parser::Parser; -use args::{ArgSettings, AnyArg}; +use args::{AnyArg, ArgSettings}; use completions; use INTERNAL_ERROR_MSG; pub struct ZshGen<'a, 'b> - where 'a: 'b +where + 'a: 'b, { p: &'b Parser<'a, 'b>, } @@ -24,8 +25,10 @@ impl<'a, 'b> ZshGen<'a, 'b> { pub fn generate_to<W: Write>(&self, buf: &mut W) { debugln!("ZshGen::generate_to;"); - w!(buf, - format!("\ + w!( + buf, + format!( + "\ #compdef {name} _{name}() {{ @@ -40,11 +43,12 @@ _{name}() {{ {subcommand_details} _{name} \"$@\"", - name = self.p.meta.bin_name.as_ref().unwrap(), - initial_args = get_args_of(self.p), - subcommands = get_subcommands_of(self.p), - subcommand_details = subcommand_details(self.p)).as_bytes()); - + name = self.p.meta.bin_name.as_ref().unwrap(), + initial_args = get_args_of(self.p), + subcommands = get_subcommands_of(self.p), + subcommand_details = subcommand_details(self.p) + ).as_bytes() + ); } } @@ -78,7 +82,9 @@ _{name} \"$@\"", fn subcommand_details(p: &Parser) -> String { debugln!("ZshGen::subcommand_details;"); // First we do ourself - let mut ret = vec![format!("\ + let mut ret = vec![ + format!( + "\ (( $+functions[_{bin_name_underscore}_commands] )) || _{bin_name_underscore}_commands() {{ local commands; commands=( @@ -88,7 +94,9 @@ _{bin_name_underscore}_commands() {{ }}", bin_name_underscore = p.meta.bin_name.as_ref().unwrap().replace(" ", "__"), bin_name = p.meta.bin_name.as_ref().unwrap(), - subcommands_and_args = subcommands_and_args_of(p))]; + subcommands_and_args = subcommands_and_args_of(p) + ), + ]; // Next we start looping through all the children, grandchildren, etc. let mut all_subcommands = completions::all_subcommands(p); @@ -96,7 +104,8 @@ _{bin_name_underscore}_commands() {{ all_subcommands.dedup(); for &(_, ref bin_name) in &all_subcommands { debugln!("ZshGen::subcommand_details:iter: bin_name={}", bin_name); - ret.push(format!("\ + ret.push(format!( + "\ (( $+functions[_{bin_name_underscore}_commands] )) || _{bin_name_underscore}_commands() {{ local commands; commands=( @@ -106,7 +115,8 @@ _{bin_name_underscore}_commands() {{ }}", bin_name_underscore = bin_name.replace(" ", "__"), bin_name = bin_name, - subcommands_and_args = subcommands_and_args_of(parser_of(p, bin_name)))); + subcommands_and_args = subcommands_and_args_of(parser_of(p, bin_name)) + )); } ret.join("\n") @@ -128,9 +138,16 @@ fn subcommands_and_args_of(p: &Parser) -> String { let mut ret = vec![]; fn add_sc(sc: &App, n: &str, ret: &mut Vec<String>) { debugln!("ZshGen::add_sc;"); - let s = format!("\"{name}:{help}\" \\", - name = n, - help = sc.p.meta.about.unwrap_or("").replace("[", "\\[").replace("]", "\\]")); + let s = format!( + "\"{name}:{help}\" \\", + name = n, + help = sc.p + .meta + .about + .unwrap_or("") + .replace("[", "\\[") + .replace("]", "\\]") + ); if !s.is_empty() { ret.push(s); } @@ -138,7 +155,10 @@ fn subcommands_and_args_of(p: &Parser) -> String { // First the subcommands for sc in p.subcommands() { - debugln!("ZshGen::subcommands_and_args_of:iter: subcommand={}", sc.p.meta.name); + debugln!( + "ZshGen::subcommands_and_args_of:iter: subcommand={}", + sc.p.meta.name + ); add_sc(sc, &sc.p.meta.name, &mut ret); if let Some(ref v) = sc.p.meta.aliases { for alias in v.iter().filter(|&&(_, vis)| vis).map(|&(n, _)| n) { @@ -150,9 +170,15 @@ fn subcommands_and_args_of(p: &Parser) -> String { // Then the positional args for arg in p.positionals() { debugln!("ZshGen::subcommands_and_args_of:iter: arg={}", arg.b.name); - let a = format!("\"{name}:{help}\" \\", - name = arg.b.name.to_ascii_uppercase(), - help = arg.b.help.unwrap_or("").replace("[", "\\[").replace("]", "\\]")); + let a = format!( + "\"{name}:{help}\" \\", + name = arg.b.name.to_ascii_uppercase(), + help = arg.b + .help + .unwrap_or("") + .replace("[", "\\[") + .replace("]", "\\]") + ); if !a.is_empty() { ret.push(a); @@ -194,7 +220,10 @@ fn subcommands_and_args_of(p: &Parser) -> String { fn get_subcommands_of(p: &Parser) -> String { debugln!("get_subcommands_of;"); - debugln!("get_subcommands_of: Has subcommands...{:?}", p.has_subcommands()); + debugln!( + "get_subcommands_of: Has subcommands...{:?}", + p.has_subcommands() + ); if !p.has_subcommands() { return String::new(); } @@ -217,17 +246,18 @@ fn get_subcommands_of(p: &Parser) -> String { } format!( -"case $state in + "case $state in ({name}) curcontext=\"${{curcontext%:*:*}}:{name_hyphen}-command-$words[1]:\" case $line[1] in {subcommands} esac ;; -esac", +esac", name = p.meta.name, name_hyphen = p.meta.bin_name.as_ref().unwrap().replace(" ", "-"), - subcommands = subcmds.join("\n")) + subcommands = subcmds.join("\n") + ) } fn parser_of<'a, 'b>(p: &'b Parser<'a, 'b>, sc: &str) -> &'b Parser<'a, 'b> { @@ -264,8 +294,10 @@ fn get_args_of(p: &Parser) -> String { let opts = write_opts_of(p); let flags = write_flags_of(p); let sc_or_a = if p.has_subcommands() || p.has_positionals() { - format!("\"1:: :_{name}_commands\" \\", - name = p.meta.bin_name.as_ref().unwrap().replace(" ", "__")) + format!( + "\"1:: :_{name}_commands\" \\", + name = p.meta.bin_name.as_ref().unwrap().replace(" ", "__") + ) } else { String::new() }; @@ -294,7 +326,8 @@ fn get_args_of(p: &Parser) -> String { // Escape string inside single quotes and brackets fn escape_string(string: &str) -> String { - string.replace("\\", "\\\\") + string + .replace("\\", "\\\\") .replace("'", "'\\''") .replace("[", "\\[") .replace("]", "\\]") @@ -324,23 +357,27 @@ fn write_opts_of(p: &Parser) -> String { String::new() }; if let Some(short) = o.short() { - let s = format!("'{conflicts}{multiple}-{arg}+[{help}]{possible_values}' \\", + let s = format!( + "'{conflicts}{multiple}-{arg}+[{help}]{possible_values}' \\", conflicts = conflicts, multiple = multiple, arg = short, possible_values = pv, - help = help); + help = help + ); debugln!("write_opts_of:iter: Wrote...{}", &*s); ret.push(s); } if let Some(long) = o.long() { - let l = format!("'{conflicts}{multiple}--{arg}+[{help}]{possible_values}' \\", + let l = format!( + "'{conflicts}{multiple}--{arg}+[{help}]{possible_values}' \\", conflicts = conflicts, multiple = multiple, arg = long, possible_values = pv, - help = help); + help = help + ); debugln!("write_opts_of:iter: Wrote...{}", &*l); ret.push(l); @@ -369,22 +406,26 @@ fn write_flags_of(p: &Parser) -> String { "" }; if let Some(short) = f.short() { - let s = format!("'{conflicts}{multiple}-{arg}[{help}]' \\", + let s = format!( + "'{conflicts}{multiple}-{arg}[{help}]' \\", multiple = multiple, conflicts = conflicts, arg = short, - help = help); + help = help + ); debugln!("write_flags_of:iter: Wrote...{}", &*s); ret.push(s); } if let Some(long) = f.long() { - let l = format!("'{conflicts}{multiple}--{arg}[{help}]' \\", + let l = format!( + "'{conflicts}{multiple}--{arg}[{help}]' \\", conflicts = conflicts, multiple = multiple, arg = long, - help = help); + help = help + ); debugln!("write_flags_of:iter: Wrote...{}", &*l); ret.push(l); diff --git a/src/vendor/clap/src/errors.rs b/src/vendor/clap/src/errors.rs index bd1e7d55f8..c4108a6467 100644 --- a/src/vendor/clap/src/errors.rs +++ b/src/vendor/clap/src/errors.rs @@ -8,8 +8,8 @@ use std::process; use std::result::Result as StdResult; // Internal -use args::{FlagBuilder, AnyArg}; -use fmt::{Colorizer, ColorizerOption, ColorWhen}; +use args::{AnyArg, FlagBuilder}; +use fmt::{ColorWhen, Colorizer, ColorizerOption}; use suggestions; /// Short hand for [`Result`] type @@ -58,8 +58,8 @@ pub enum ErrorKind { /// /// # Examples /// - #[cfg_attr(not(feature="suggestions"), doc=" ```no_run")] - #[cfg_attr( feature="suggestions" , doc=" ```")] + #[cfg_attr(not(feature = "suggestions"), doc = " ```no_run")] + #[cfg_attr(feature = "suggestions", doc = " ```")] /// # use clap::{App, Arg, ErrorKind, SubCommand}; /// let result = App::new("prog") /// .subcommand(SubCommand::with_name("config") @@ -300,8 +300,8 @@ pub enum ErrorKind { /// /// # Examples /// - #[cfg_attr(not(unix), doc=" ```ignore")] - #[cfg_attr( unix , doc=" ```")] + #[cfg_attr(not(unix), doc = " ```ignore")] + #[cfg_attr(unix, doc = " ```")] /// # use clap::{App, Arg, ErrorKind, AppSettings}; /// # use std::os::unix::ffi::OsStringExt; /// # use std::ffi::OsString; @@ -384,8 +384,7 @@ impl Error { /// Should the message be written to `stdout` or not pub fn use_stderr(&self) -> bool { match self.kind { - ErrorKind::HelpDisplayed | - ErrorKind::VersionDisplayed => false, + ErrorKind::HelpDisplayed | ErrorKind::VersionDisplayed => false, _ => true, } } @@ -405,14 +404,16 @@ impl Error { pub fn write_to<W: Write>(&self, w: &mut W) -> io::Result<()> { write!(w, "{}", self.message) } #[doc(hidden)] - pub fn argument_conflict<'a, 'b, A, O, U>(arg: &A, - other: Option<O>, - usage: U, - color: ColorWhen) - -> Self - where A: AnyArg<'a, 'b> + Display, - O: Into<String>, - U: Display + pub fn argument_conflict<'a, 'b, A, O, U>( + arg: &A, + other: Option<O>, + usage: U, + color: ColorWhen, + ) -> Self + where + A: AnyArg<'a, 'b> + Display, + O: Into<String>, + U: Display, { let mut v = vec![arg.name().to_owned()]; let c = Colorizer::new(ColorizerOption { @@ -420,24 +421,23 @@ impl Error { when: color, }); Error { - message: format!("{} The argument '{}' cannot be used with {}\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(&*arg.to_string()), - match other { - Some(name) => { - let n = name.into(); - v.push(n.clone()); - c.warning(format!("'{}'", n)) - } - None => { - c.none("one or more of the other specified arguments" - .to_owned()) - } - }, - usage, - c.good("--help")), + message: format!( + "{} The argument '{}' cannot be used with {}\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(&*arg.to_string()), + match other { + Some(name) => { + let n = name.into(); + v.push(n.clone()); + c.warning(format!("'{}'", n)) + } + None => c.none("one or more of the other specified arguments".to_owned()), + }, + usage, + c.good("--help") + ), kind: ErrorKind::ArgumentConflict, info: Some(v), } @@ -445,47 +445,49 @@ impl Error { #[doc(hidden)] pub fn empty_value<'a, 'b, A, U>(arg: &A, usage: U, color: ColorWhen) -> Self - where A: AnyArg<'a, 'b> + Display, - U: Display + where + A: AnyArg<'a, 'b> + Display, + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} The argument '{}' requires a value but none was supplied\ - \n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(arg.to_string()), - usage, - c.good("--help")), + message: format!( + "{} The argument '{}' requires a value but none was supplied\ + \n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(arg.to_string()), + usage, + c.good("--help") + ), kind: ErrorKind::EmptyValue, info: Some(vec![arg.name().to_owned()]), } } #[doc(hidden)] - pub fn invalid_value<'a, 'b, B, G, A, U>(bad_val: B, - good_vals: &[G], - arg: &A, - usage: U, - color: ColorWhen) - -> Self - where B: AsRef<str>, - G: AsRef<str> + Display, - A: AnyArg<'a, 'b> + Display, - U: Display + pub fn invalid_value<'a, 'b, B, G, A, U>( + bad_val: B, + good_vals: &[G], + arg: &A, + usage: U, + color: ColorWhen, + ) -> Self + where + B: AsRef<str>, + G: AsRef<str> + Display, + A: AnyArg<'a, 'b> + Display, + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); - let suffix = - suggestions::did_you_mean_value_suffix( - bad_val.as_ref(), - good_vals.iter()); + let suffix = suggestions::did_you_mean_value_suffix(bad_val.as_ref(), good_vals.iter()); let mut sorted = vec![]; for v in good_vals { @@ -495,34 +497,38 @@ impl Error { sorted.sort(); let valid_values = sorted.join(", "); Error { - message: format!("{} '{}' isn't a valid value for '{}'\n\t\ - [values: {}]\n\ - {}\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(bad_val.as_ref()), - c.warning(arg.to_string()), - valid_values, - suffix.0, - usage, - c.good("--help")), + message: format!( + "{} '{}' isn't a valid value for '{}'\n\t\ + [values: {}]\n\ + {}\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(bad_val.as_ref()), + c.warning(arg.to_string()), + valid_values, + suffix.0, + usage, + c.good("--help") + ), kind: ErrorKind::InvalidValue, info: Some(vec![arg.name().to_owned(), bad_val.as_ref().to_owned()]), } } #[doc(hidden)] - pub fn invalid_subcommand<S, D, N, U>(subcmd: S, - did_you_mean: D, - name: N, - usage: U, - color: ColorWhen) - -> Self - where S: Into<String>, - D: AsRef<str> + Display, - N: Display, - U: Display + pub fn invalid_subcommand<S, D, N, U>( + subcmd: S, + did_you_mean: D, + name: N, + usage: U, + color: ColorWhen, + ) -> Self + where + S: Into<String>, + D: AsRef<str> + Display, + N: Display, + U: Display, { let s = subcmd.into(); let c = Colorizer::new(ColorizerOption { @@ -530,20 +536,22 @@ impl Error { when: color, }); Error { - message: format!("{} The subcommand '{}' wasn't recognized\n\t\ - Did you mean '{}'?\n\n\ - If you believe you received this message in error, try \ - re-running with '{} {} {}'\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(&*s), - c.good(did_you_mean.as_ref()), - name, - c.good("--"), - &*s, - usage, - c.good("--help")), + message: format!( + "{} The subcommand '{}' wasn't recognized\n\t\ + Did you mean '{}'?\n\n\ + If you believe you received this message in error, try \ + re-running with '{} {} {}'\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(&*s), + c.good(did_you_mean.as_ref()), + name, + c.good("--"), + &*s, + usage, + c.good("--help") + ), kind: ErrorKind::InvalidSubcommand, info: Some(vec![s]), } @@ -551,8 +559,9 @@ impl Error { #[doc(hidden)] pub fn unrecognized_subcommand<S, N>(subcmd: S, name: N, color: ColorWhen) -> Self - where S: Into<String>, - N: Display + where + S: Into<String>, + N: Display, { let s = subcmd.into(); let c = Colorizer::new(ColorizerOption { @@ -560,15 +569,17 @@ impl Error { when: color, }); Error { - message: format!("{} The subcommand '{}' wasn't recognized\n\n\ - {}\n\t\ - {} help <subcommands>...\n\n\ - For more information try {}", - c.error("error:"), - c.warning(&*s), - c.warning("USAGE:"), - name, - c.good("--help")), + message: format!( + "{} The subcommand '{}' wasn't recognized\n\n\ + {}\n\t\ + {} help <subcommands>...\n\n\ + For more information try {}", + c.error("error:"), + c.warning(&*s), + c.warning("USAGE:"), + name, + c.good("--help") + ), kind: ErrorKind::UnrecognizedSubcommand, info: Some(vec![s]), } @@ -576,21 +587,24 @@ impl Error { #[doc(hidden)] pub fn missing_required_argument<R, U>(required: R, usage: U, color: ColorWhen) -> Self - where R: Display, - U: Display + where + R: Display, + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} The following required arguments were not provided:{}\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - required, - usage, - c.good("--help")), + message: format!( + "{} The following required arguments were not provided:{}\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + required, + usage, + c.good("--help") + ), kind: ErrorKind::MissingRequiredArgument, info: None, } @@ -598,21 +612,24 @@ impl Error { #[doc(hidden)] pub fn missing_subcommand<N, U>(name: N, usage: U, color: ColorWhen) -> Self - where N: AsRef<str> + Display, - U: Display + where + N: AsRef<str> + Display, + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} '{}' requires a subcommand, but one was not provided\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(name), - usage, - c.good("--help")), + message: format!( + "{} '{}' requires a subcommand, but one was not provided\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(name), + usage, + c.good("--help") + ), kind: ErrorKind::MissingSubcommand, info: None, } @@ -621,33 +638,33 @@ impl Error { #[doc(hidden)] pub fn invalid_utf8<U>(usage: U, color: ColorWhen) -> Self - where U: Display + where + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} Invalid UTF-8 was detected in one or more arguments\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - usage, - c.good("--help")), + message: format!( + "{} Invalid UTF-8 was detected in one or more arguments\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + usage, + c.good("--help") + ), kind: ErrorKind::InvalidUtf8, info: None, } } #[doc(hidden)] - pub fn too_many_values<'a, 'b, V, A, U>(val: V, - arg: &A, - usage: U, - color: ColorWhen) - -> Self - where V: AsRef<str> + Display + ToOwned, - A: AnyArg<'a, 'b> + Display, - U: Display + pub fn too_many_values<'a, 'b, V, A, U>(val: V, arg: &A, usage: U, color: ColorWhen) -> Self + where + V: AsRef<str> + Display + ToOwned, + A: AnyArg<'a, 'b> + Display, + U: Display, { let v = val.as_ref(); let c = Colorizer::new(ColorizerOption { @@ -655,46 +672,52 @@ impl Error { when: color, }); Error { - message: format!("{} The value '{}' was provided to '{}', but it wasn't expecting \ - any more values\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(v), - c.warning(arg.to_string()), - usage, - c.good("--help")), + message: format!( + "{} The value '{}' was provided to '{}', but it wasn't expecting \ + any more values\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(v), + c.warning(arg.to_string()), + usage, + c.good("--help") + ), kind: ErrorKind::TooManyValues, info: Some(vec![arg.name().to_owned(), v.to_owned()]), } } #[doc(hidden)] - pub fn too_few_values<'a, 'b, A, U>(arg: &A, - min_vals: u64, - curr_vals: usize, - usage: U, - color: ColorWhen) - -> Self - where A: AnyArg<'a, 'b> + Display, - U: Display + pub fn too_few_values<'a, 'b, A, U>( + arg: &A, + min_vals: u64, + curr_vals: usize, + usage: U, + color: ColorWhen, + ) -> Self + where + A: AnyArg<'a, 'b> + Display, + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} The argument '{}' requires at least {} values, but only {} w{} \ - provided\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(arg.to_string()), - c.warning(min_vals.to_string()), - c.warning(curr_vals.to_string()), - if curr_vals > 1 { "ere" } else { "as" }, - usage, - c.good("--help")), + message: format!( + "{} The argument '{}' requires at least {} values, but only {} w{} \ + provided\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(arg.to_string()), + c.warning(min_vals.to_string()), + c.warning(curr_vals.to_string()), + if curr_vals > 1 { "ere" } else { "as" }, + usage, + c.good("--help") + ), kind: ErrorKind::TooFewValues, info: Some(vec![arg.name().to_owned()]), } @@ -702,21 +725,24 @@ impl Error { #[doc(hidden)] pub fn value_validation<'a, 'b, A>(arg: Option<&A>, err: String, color: ColorWhen) -> Self - where A: AnyArg<'a, 'b> + Display + where + A: AnyArg<'a, 'b> + Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} Invalid value{}: {}", - c.error("error:"), - if let Some(a) = arg { - format!(" for '{}'", c.warning(a.to_string())) - } else { - "".to_string() - }, - err), + message: format!( + "{} Invalid value{}: {}", + c.error("error:"), + if let Some(a) = arg { + format!(" for '{}'", c.warning(a.to_string())) + } else { + "".to_string() + }, + err + ), kind: ErrorKind::ValueValidation, info: None, } @@ -724,38 +750,42 @@ impl Error { #[doc(hidden)] pub fn value_validation_auto(err: String) -> Self { - let n: Option<&FlagBuilder> = None; + let n: Option<&FlagBuilder> = None; Error::value_validation(n, err, ColorWhen::Auto) } #[doc(hidden)] - pub fn wrong_number_of_values<'a, 'b, A, S, U>(arg: &A, - num_vals: u64, - curr_vals: usize, - suffix: S, - usage: U, - color: ColorWhen) - -> Self - where A: AnyArg<'a, 'b> + Display, - S: Display, - U: Display + pub fn wrong_number_of_values<'a, 'b, A, S, U>( + arg: &A, + num_vals: u64, + curr_vals: usize, + suffix: S, + usage: U, + color: ColorWhen, + ) -> Self + where + A: AnyArg<'a, 'b> + Display, + S: Display, + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} The argument '{}' requires {} values, but {} w{} \ - provided\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(arg.to_string()), - c.warning(num_vals.to_string()), - c.warning(curr_vals.to_string()), - suffix, - usage, - c.good("--help")), + message: format!( + "{} The argument '{}' requires {} values, but {} w{} \ + provided\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(arg.to_string()), + c.warning(num_vals.to_string()), + c.warning(curr_vals.to_string()), + suffix, + usage, + c.good("--help") + ), kind: ErrorKind::WrongNumberOfValues, info: Some(vec![arg.name().to_owned()]), } @@ -763,35 +793,35 @@ impl Error { #[doc(hidden)] pub fn unexpected_multiple_usage<'a, 'b, A, U>(arg: &A, usage: U, color: ColorWhen) -> Self - where A: AnyArg<'a, 'b> + Display, - U: Display + where + A: AnyArg<'a, 'b> + Display, + U: Display, { let c = Colorizer::new(ColorizerOption { use_stderr: true, when: color, }); Error { - message: format!("{} The argument '{}' was provided more than once, but cannot \ - be used multiple times\n\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(arg.to_string()), - usage, - c.good("--help")), + message: format!( + "{} The argument '{}' was provided more than once, but cannot \ + be used multiple times\n\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(arg.to_string()), + usage, + c.good("--help") + ), kind: ErrorKind::UnexpectedMultipleUsage, info: Some(vec![arg.name().to_owned()]), } } #[doc(hidden)] - pub fn unknown_argument<A, U>(arg: A, - did_you_mean: &str, - usage: U, - color: ColorWhen) - -> Self - where A: Into<String>, - U: Display + pub fn unknown_argument<A, U>(arg: A, did_you_mean: &str, usage: U, color: ColorWhen) -> Self + where + A: Into<String>, + U: Display, { let a = arg.into(); let c = Colorizer::new(ColorizerOption { @@ -799,19 +829,21 @@ impl Error { when: color, }); Error { - message: format!("{} Found argument '{}' which wasn't expected, or isn't valid in \ - this context{}\n\ - {}\n\n\ - For more information try {}", - c.error("error:"), - c.warning(&*a), - if did_you_mean.is_empty() { - "\n".to_owned() - } else { - format!("{}\n", did_you_mean) - }, - usage, - c.good("--help")), + message: format!( + "{} Found argument '{}' which wasn't expected, or isn't valid in \ + this context{}\n\ + {}\n\n\ + For more information try {}", + c.error("error:"), + c.warning(&*a), + if did_you_mean.is_empty() { + "\n".to_owned() + } else { + format!("{}\n", did_you_mean) + }, + usage, + c.good("--help") + ), kind: ErrorKind::UnknownArgument, info: Some(vec![a]), } @@ -832,7 +864,8 @@ impl Error { #[doc(hidden)] pub fn argument_not_found_auto<A>(arg: A) -> Self - where A: Into<String> + where + A: Into<String>, { let a = arg.into(); let c = Colorizer::new(ColorizerOption { @@ -840,9 +873,11 @@ impl Error { when: ColorWhen::Auto, }); Error { - message: format!("{} The argument '{}' wasn't found", - c.error("error:"), - a.clone()), + message: format!( + "{} The argument '{}' wasn't found", + c.error("error:"), + a.clone() + ), kind: ErrorKind::ArgumentNotFound, info: Some(vec![a]), } diff --git a/src/vendor/clap/src/fmt.rs b/src/vendor/clap/src/fmt.rs index 9fccd3f530..334c5b103a 100644 --- a/src/vendor/clap/src/fmt.rs +++ b/src/vendor/clap/src/fmt.rs @@ -71,28 +71,32 @@ impl Colorizer { } pub fn good<T>(&self, msg: T) -> Format<T> - where T: fmt::Display + AsRef<str> + where + T: fmt::Display + AsRef<str>, { debugln!("Colorizer::good;"); color!(self, Good, msg) } pub fn warning<T>(&self, msg: T) -> Format<T> - where T: fmt::Display + AsRef<str> + where + T: fmt::Display + AsRef<str>, { debugln!("Colorizer::warning;"); color!(self, Warning, msg) } pub fn error<T>(&self, msg: T) -> Format<T> - where T: fmt::Display + AsRef<str> + where + T: fmt::Display + AsRef<str>, { debugln!("Colorizer::error;"); color!(self, Error, msg) } pub fn none<T>(&self, msg: T) -> Format<T> - where T: fmt::Display + AsRef<str> + where + T: fmt::Display + AsRef<str>, { debugln!("Colorizer::none;"); Format::None(msg) @@ -136,7 +140,7 @@ impl<T: AsRef<str>> Format<T> { } #[cfg(any(not(feature = "color"), target_os = "windows"))] -#[cfg_attr(feature="lints", allow(match_same_arms))] +#[cfg_attr(feature = "lints", allow(match_same_arms))] impl<T: fmt::Display> Format<T> { fn format(&self) -> &T { match *self { @@ -168,14 +172,18 @@ mod test { #[test] fn colored_output() { let err = Format::Error("error"); - assert_eq!(&*format!("{}", err), - &*format!("{}", Red.bold().paint("error"))); + assert_eq!( + &*format!("{}", err), + &*format!("{}", Red.bold().paint("error")) + ); let good = Format::Good("good"); assert_eq!(&*format!("{}", good), &*format!("{}", Green.paint("good"))); let warn = Format::Warning("warn"); assert_eq!(&*format!("{}", warn), &*format!("{}", Yellow.paint("warn"))); let none = Format::None("none"); - assert_eq!(&*format!("{}", none), - &*format!("{}", ANSIString::from("none"))); + assert_eq!( + &*format!("{}", none), + &*format!("{}", ANSIString::from("none")) + ); } } diff --git a/src/vendor/clap/src/lib.rs b/src/vendor/clap/src/lib.rs index b9446e33a9..a55ed80eb0 100644 --- a/src/vendor/clap/src/lib.rs +++ b/src/vendor/clap/src/lib.rs @@ -512,15 +512,10 @@ //! `clap` is licensed under the MIT license. Please read the [LICENSE-MIT](LICENSE-MIT) file in //! this repository for more information. -#![crate_type= "lib"] -#![doc(html_root_url = "https://docs.rs/clap/2.27.1")] -#![deny( - missing_docs, - missing_debug_implementations, - missing_copy_implementations, - trivial_casts, - unused_import_braces, - unused_allocation)] +#![crate_type = "lib"] +#![doc(html_root_url = "https://docs.rs/clap/2.29.0")] +#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, + unused_import_braces, unused_allocation)] // Lints we'd like to deny but are currently failing for upstream crates // unused_qualifications (bitflags, clippy) // trivial_numeric_casts (bitflags) @@ -533,26 +528,26 @@ #![cfg_attr(feature = "lints", allow(doc_markdown))] #![cfg_attr(feature = "lints", allow(explicit_iter_loop))] -#[cfg(feature = "suggestions")] -extern crate strsim; #[cfg(feature = "color")] extern crate ansi_term; -#[cfg(feature = "yaml")] -extern crate yaml_rust; -extern crate unicode_width; +#[cfg(feature = "color")] +extern crate atty; #[macro_use] extern crate bitflags; -#[cfg(feature = "vec_map")] -extern crate vec_map; +#[cfg(feature = "suggestions")] +extern crate strsim; #[cfg(feature = "wrap_help")] extern crate term_size; extern crate textwrap; -#[cfg(feature = "color")] -extern crate atty; +extern crate unicode_width; +#[cfg(feature = "vec_map")] +extern crate vec_map; +#[cfg(feature = "yaml")] +extern crate yaml_rust; #[cfg(feature = "yaml")] pub use yaml_rust::YamlLoader; -pub use args::{Arg, ArgGroup, ArgMatches, ArgSettings, SubCommand, Values, OsValues}; +pub use args::{Arg, ArgGroup, ArgMatches, ArgSettings, OsValues, SubCommand, Values}; pub use app::{App, AppSettings}; pub use fmt::Format; pub use errors::{Error, ErrorKind, Result}; @@ -574,3 +569,57 @@ mod map; const INTERNAL_ERROR_MSG: &'static str = "Fatal internal error. Please consider filing a bug \ report at https://github.com/kbknapp/clap-rs/issues"; const INVALID_UTF8: &'static str = "unexpected invalid UTF-8 code point"; + +#[cfg(unstable)] +pub use derive::{ArgEnum, ClapApp, FromArgMatches, IntoApp}; + +#[cfg(unstable)] +mod derive { + /// @TODO @release @docs + pub trait ClapApp: IntoApp + FromArgMatches + Sized { + /// @TODO @release @docs + fn parse() -> Self { Self::from_argmatches(Self::into_app().get_matches()) } + + /// @TODO @release @docs + fn parse_from<I, T>(argv: I) -> Self + where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone, + { + Self::from_argmatches(Self::into_app().get_matches_from(argv)) + } + + /// @TODO @release @docs + fn try_parse() -> Result<Self, clap::Error> { + Self::try_from_argmatches(Self::into_app().get_matches_safe()?) + } + + + /// @TODO @release @docs + fn try_parse_from<I, T>(argv: I) -> Result<Self, clap::Error> + where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone, + { + Self::try_from_argmatches(Self::into_app().get_matches_from_safe(argv)?) + } + } + + /// @TODO @release @docs + pub trait IntoApp { + /// @TODO @release @docs + fn into_app<'a, 'b>() -> clap::App<'a, 'b>; + } + + /// @TODO @release @docs + pub trait FromArgMatches: Sized { + /// @TODO @release @docs + fn from_argmatches<'a>(matches: clap::ArgMatches<'a>) -> Self; + + /// @TODO @release @docs + fn try_from_argmatches<'a>(matches: clap::ArgMatches<'a>) -> Result<Self, clap::Error>; + } + + /// @TODO @release @docs + pub trait ArgEnum {} +} diff --git a/src/vendor/clap/src/macros.rs b/src/vendor/clap/src/macros.rs index db8ea2f0a3..51bb95a7b0 100644 --- a/src/vendor/clap/src/macros.rs +++ b/src/vendor/clap/src/macros.rs @@ -262,7 +262,8 @@ macro_rules! _clap_count_exprs { /// retrieve a `Vec<&'static str>` of the variant names, as well as implementing [`FromStr`] and /// [`Display`] automatically. /// -/// **NOTE:** Case insensitivity is supported for ASCII characters only +/// **NOTE:** Case insensitivity is supported for ASCII characters only. It's highly recommended to +/// use [`Arg::case_insensitive(true)`] for args that will be used with these enums /// /// **NOTE:** This macro automatically implements [`std::str::FromStr`] and [`std::fmt::Display`] /// @@ -270,12 +271,12 @@ macro_rules! _clap_count_exprs { /// /// # Examples /// -/// ```no_run +/// ```rust /// # #[macro_use] /// # extern crate clap; /// # use clap::{App, Arg}; /// arg_enum!{ -/// #[derive(Debug)] +/// #[derive(PartialEq, Debug)] /// pub enum Foo { /// Bar, /// Baz, @@ -286,17 +287,22 @@ macro_rules! _clap_count_exprs { /// // and implements std::str::FromStr to use with the value_t! macros /// fn main() { /// let m = App::new("app") -/// .arg_from_usage("<foo> 'the foo'") -/// .get_matches(); +/// .arg(Arg::from_usage("<foo> 'the foo'") +/// .possible_values(&Foo::variants()) +/// .case_insensitive(true)) +/// .get_matches_from(vec![ +/// "app", "baz" +/// ]); /// let f = value_t!(m, "foo", Foo).unwrap_or_else(|e| e.exit()); /// -/// // Use f like any other Foo variant... +/// assert_eq!(f, Foo::Baz); /// } /// ``` /// [`FromStr`]: https://doc.rust-lang.org/std/str/trait.FromStr.html /// [`std::str::FromStr`]: https://doc.rust-lang.org/std/str/trait.FromStr.html /// [`Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html /// [`std::fmt::Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html +/// [`Arg::case_insensitive(true)`]: ./struct.Arg.html#method.case_insensitive #[macro_export] macro_rules! arg_enum { (@as_item $($i:item)*) => ($($i)*); @@ -308,6 +314,7 @@ macro_rules! arg_enum { type Err = String; fn from_str(s: &str) -> ::std::result::Result<Self,Self::Err> { + #[allow(unused_imports)] use ::std::ascii::AsciiExt; match s { $(stringify!($v) | @@ -338,6 +345,14 @@ macro_rules! arg_enum { } }); }; + ($(#[$($m:meta),+])+ pub enum $e:ident { $($v:ident $(=$val:expr)*,)+ } ) => { + arg_enum!(@impls + ($(#[$($m),+])+ + pub enum $e { + $($v$(=$val)*),+ + }) -> ($e, $($v),+) + ); + }; ($(#[$($m:meta),+])+ pub enum $e:ident { $($v:ident $(=$val:expr)*),+ } ) => { arg_enum!(@impls ($(#[$($m),+])+ @@ -346,7 +361,14 @@ macro_rules! arg_enum { }) -> ($e, $($v),+) ); }; - ($(#[$($m:meta),+])+ enum $e:ident { $($v:ident $(=$val:expr)*),+ } ) => { + ($(#[$($m:meta),+])+ enum $e:ident { $($v:ident $(=$val:expr)*,)+ } ) => { + arg_enum!($(#[$($m:meta),+])+ + enum $e:ident { + $($v:ident $(=$val:expr)*),+ + } + ); + }; + ($(#[$($m:meta),+])+ enum $e:ident { $($v:ident $(=$val:expr)*),+ } ) => { arg_enum!(@impls ($(#[$($m),+])+ enum $e { @@ -354,6 +376,11 @@ macro_rules! arg_enum { }) -> ($e, $($v),+) ); }; + (pub enum $e:ident { $($v:ident $(=$val:expr)*,)+ } ) => { + arg_enum!(pub enum $e:ident { + $($v:ident $(=$val:expr)*),+ + }); + }; (pub enum $e:ident { $($v:ident $(=$val:expr)*),+ } ) => { arg_enum!(@impls (pub enum $e { @@ -361,6 +388,11 @@ macro_rules! arg_enum { }) -> ($e, $($v),+) ); }; + (enum $e:ident { $($v:ident $(=$val:expr)*,)+ } ) => { + arg_enum!(enum $e:ident { + $($v:ident $(=$val:expr)*),+ + }); + }; (enum $e:ident { $($v:ident $(=$val:expr)*),+ } ) => { arg_enum!(@impls (enum $e { @@ -385,7 +417,7 @@ macro_rules! arg_enum { /// .get_matches(); /// # } /// ``` -#[cfg(not(feature="no_cargo"))] +#[cfg(not(feature = "no_cargo"))] #[macro_export] macro_rules! crate_version { () => { @@ -414,7 +446,7 @@ macro_rules! crate_version { /// .get_matches(); /// # } /// ``` -#[cfg(not(feature="no_cargo"))] +#[cfg(not(feature = "no_cargo"))] #[macro_export] macro_rules! crate_authors { ($sep:expr) => {{ @@ -465,7 +497,7 @@ macro_rules! crate_authors { /// .get_matches(); /// # } /// ``` -#[cfg(not(feature="no_cargo"))] +#[cfg(not(feature = "no_cargo"))] #[macro_export] macro_rules! crate_description { () => { @@ -486,7 +518,7 @@ macro_rules! crate_description { /// .get_matches(); /// # } /// ``` -#[cfg(not(feature="no_cargo"))] +#[cfg(not(feature = "no_cargo"))] #[macro_export] macro_rules! crate_name { () => { @@ -517,7 +549,7 @@ macro_rules! crate_name { /// let m = app_from_crate!().get_matches(); /// # } /// ``` -#[cfg(not(feature="no_cargo"))] +#[cfg(not(feature = "no_cargo"))] #[macro_export] macro_rules! app_from_crate { () => { @@ -739,7 +771,7 @@ macro_rules! clap_app { } macro_rules! impl_settings { - ($n:ident, $($v:ident => $c:ident),+) => { + ($n:ident, $($v:ident => $c:path),+) => { pub fn set(&mut self, s: $n) { match s { $($n::$v => self.0.insert($c)),+ @@ -770,6 +802,7 @@ macro_rules! wlnerr( #[cfg(feature = "debug")] #[cfg_attr(feature = "debug", macro_use)] +#[cfg_attr(feature = "debug", allow(unused_macros))] mod debug_macros { macro_rules! debugln { ($fmt:expr) => (println!(concat!("DEBUG:clap:", $fmt))); diff --git a/src/vendor/clap/src/map.rs b/src/vendor/clap/src/map.rs index 12385db4c9..063a860288 100644 --- a/src/vendor/clap/src/map.rs +++ b/src/vendor/clap/src/map.rs @@ -1,8 +1,8 @@ #[cfg(feature = "vec_map")] -pub use vec_map::{VecMap, Values}; +pub use vec_map::{Values, VecMap}; #[cfg(not(feature = "vec_map"))] -pub use self::vec_map::{VecMap, Values}; +pub use self::vec_map::{Values, VecMap}; #[cfg(not(feature = "vec_map"))] mod vec_map { @@ -17,40 +17,32 @@ mod vec_map { impl<V> VecMap<V> { pub fn new() -> Self { - VecMap { inner: Default::default() } + VecMap { + inner: Default::default(), + } } - pub fn len(&self) -> usize { - self.inner.len() - } + pub fn len(&self) -> usize { self.inner.len() } - pub fn is_empty(&self) -> bool { - self.inner.is_empty() - } + pub fn is_empty(&self) -> bool { self.inner.is_empty() } pub fn insert(&mut self, key: usize, value: V) -> Option<V> { self.inner.insert(key, value) } - pub fn values(&self) -> Values<V> { - self.inner.values() - } + pub fn values(&self) -> Values<V> { self.inner.values() } pub fn iter(&self) -> Iter<V> { - Iter { inner: self.inner.iter() } + Iter { + inner: self.inner.iter(), + } } - pub fn contains_key(&self, key: usize) -> bool { - self.inner.contains_key(&key) - } + pub fn contains_key(&self, key: usize) -> bool { self.inner.contains_key(&key) } - pub fn entry(&mut self, key: usize) -> Entry<V> { - self.inner.entry(key) - } + pub fn entry(&mut self, key: usize) -> Entry<V> { self.inner.entry(key) } - pub fn get(&self, key: usize) -> Option<&V> { - self.inner.get(&key) - } + pub fn get(&self, key: usize) -> Option<&V> { self.inner.get(&key) } } pub type Values<'a, V> = btree_map::Values<'a, usize, V>; @@ -71,9 +63,7 @@ mod vec_map { impl<'a, V: 'a> Iterator for Iter<'a, V> { type Item = (usize, &'a V); - fn next(&mut self) -> Option<Self::Item> { - self.inner.next().map(|(k, v)| (*k, v)) - } + fn next(&mut self) -> Option<Self::Item> { self.inner.next().map(|(k, v)| (*k, v)) } } impl<'a, V: 'a> DoubleEndedIterator for Iter<'a, V> { diff --git a/src/vendor/clap/src/osstringext.rs b/src/vendor/clap/src/osstringext.rs index 303cbcbef8..dc1d0c9ff6 100644 --- a/src/vendor/clap/src/osstringext.rs +++ b/src/vendor/clap/src/osstringext.rs @@ -48,24 +48,38 @@ impl OsStrExt2 for OsStr { fn split_at_byte(&self, byte: u8) -> (&OsStr, &OsStr) { for (i, b) in self.as_bytes().iter().enumerate() { if b == &byte { - return (OsStr::from_bytes(&self.as_bytes()[..i]), - OsStr::from_bytes(&self.as_bytes()[i + 1..])); + return ( + OsStr::from_bytes(&self.as_bytes()[..i]), + OsStr::from_bytes(&self.as_bytes()[i + 1..]), + ); } } - (&*self, OsStr::from_bytes(&self.as_bytes()[self.len_()..self.len_()])) + ( + &*self, + OsStr::from_bytes(&self.as_bytes()[self.len_()..self.len_()]), + ) } fn trim_left_matches(&self, byte: u8) -> &OsStr { + let mut found = false; for (i, b) in self.as_bytes().iter().enumerate() { if b != &byte { return OsStr::from_bytes(&self.as_bytes()[i..]); + } else { + found = true; } } + if found { + return OsStr::from_bytes(&self.as_bytes()[self.len_()..]); + } &*self } fn split_at(&self, i: usize) -> (&OsStr, &OsStr) { - (OsStr::from_bytes(&self.as_bytes()[..i]), OsStr::from_bytes(&self.as_bytes()[i..])) + ( + OsStr::from_bytes(&self.as_bytes()[..i]), + OsStr::from_bytes(&self.as_bytes()[i..]), + ) } fn len_(&self) -> usize { self.as_bytes().len() } diff --git a/src/vendor/clap/src/suggestions.rs b/src/vendor/clap/src/suggestions.rs index 7143c0b34d..23832cb3a0 100644 --- a/src/vendor/clap/src/suggestions.rs +++ b/src/vendor/clap/src/suggestions.rs @@ -13,15 +13,15 @@ use fmt::Format; #[cfg(feature = "suggestions")] #[cfg_attr(feature = "lints", allow(needless_lifetimes))] pub fn did_you_mean<'a, T: ?Sized, I>(v: &str, possible_values: I) -> Option<&'a str> - where T: AsRef<str> + 'a, - I: IntoIterator<Item = &'a T> +where + T: AsRef<str> + 'a, + I: IntoIterator<Item = &'a T>, { - let mut candidate: Option<(f64, &str)> = None; for pv in possible_values { let confidence = strsim::jaro_winkler(v, pv.as_ref()); - if confidence > 0.8 && - (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) + { candidate = Some((confidence, pv.as_ref())); } } @@ -33,47 +33,60 @@ pub fn did_you_mean<'a, T: ?Sized, I>(v: &str, possible_values: I) -> Option<&'a #[cfg(not(feature = "suggestions"))] pub fn did_you_mean<'a, T: ?Sized, I>(_: &str, _: I) -> Option<&'a str> - where T: AsRef<str> + 'a, - I: IntoIterator<Item = &'a T> +where + T: AsRef<str> + 'a, + I: IntoIterator<Item = &'a T>, { None } /// Returns a suffix that can be empty, or is the standard 'did you mean' phrase #[cfg_attr(feature = "lints", allow(needless_lifetimes))] -pub fn did_you_mean_flag_suffix<'z, T, I>(arg: &str, longs: I, subcommands: &'z [App]) - -> (String, Option<&'z str>) - where T: AsRef<str> + 'z, - I: IntoIterator<Item = &'z T> +pub fn did_you_mean_flag_suffix<'z, T, I>( + arg: &str, + longs: I, + subcommands: &'z [App], +) -> (String, Option<&'z str>) +where + T: AsRef<str> + 'z, + I: IntoIterator<Item = &'z T>, { match did_you_mean(arg, longs) { Some(candidate) => { - let suffix = format!("\n\tDid you mean {}{}?", Format::Good("--"), Format::Good(candidate)); - return (suffix, Some(candidate)) + let suffix = format!( + "\n\tDid you mean {}{}?", + Format::Good("--"), + Format::Good(candidate) + ); + return (suffix, Some(candidate)); } - None => { - for subcommand in subcommands { - let opts = subcommand.p.flags.iter().filter_map(|f| f.s.long).chain( - subcommand.p.opts.iter().filter_map(|o| o.s.long)); + None => for subcommand in subcommands { + let opts = subcommand + .p + .flags + .iter() + .filter_map(|f| f.s.long) + .chain(subcommand.p.opts.iter().filter_map(|o| o.s.long)); - if let Some(candidate) = did_you_mean(arg, opts) { - let suffix = format!( - "\n\tDid you mean to put '{}{}' after the subcommand '{}'?", - Format::Good("--"), - Format::Good(candidate), - Format::Good(subcommand.get_name())); - return (suffix, Some(candidate)); - } + if let Some(candidate) = did_you_mean(arg, opts) { + let suffix = format!( + "\n\tDid you mean to put '{}{}' after the subcommand '{}'?", + Format::Good("--"), + Format::Good(candidate), + Format::Good(subcommand.get_name()) + ); + return (suffix, Some(candidate)); } - } + }, } (String::new(), None) } /// Returns a suffix that can be empty, or is the standard 'did you mean' phrase pub fn did_you_mean_value_suffix<'z, T, I>(arg: &str, values: I) -> (String, Option<&'z str>) - where T: AsRef<str> + 'z, - I: IntoIterator<Item = &'z T> +where + T: AsRef<str> + 'z, + I: IntoIterator<Item = &'z T>, { match did_you_mean(arg, values) { Some(candidate) => { @@ -104,13 +117,19 @@ mod test { fn suffix_long() { let p_vals = ["test", "possible", "values"]; let suffix = "\n\tDid you mean \'--test\'?"; - assert_eq!(did_you_mean_flag_suffix("tst", p_vals.iter(), []), (suffix, Some("test"))); + assert_eq!( + did_you_mean_flag_suffix("tst", p_vals.iter(), []), + (suffix, Some("test")) + ); } #[test] fn suffix_enum() { let p_vals = ["test", "possible", "values"]; let suffix = "\n\tDid you mean \'test\'?"; - assert_eq!(did_you_mean_value_suffix("tst", p_vals.iter()), (suffix, Some("test"))); + assert_eq!( + did_you_mean_value_suffix("tst", p_vals.iter()), + (suffix, Some("test")) + ); } } diff --git a/src/vendor/clap/src/usage_parser.rs b/src/vendor/clap/src/usage_parser.rs index 2593ae7fa8..f6d5ac6069 100644 --- a/src/vendor/clap/src/usage_parser.rs +++ b/src/vendor/clap/src/usage_parser.rs @@ -1,4 +1,3 @@ - // Internal use INTERNAL_ERROR_MSG; use args::Arg; @@ -60,9 +59,13 @@ impl<'a> UsageParser<'a> { break; } } - debug_assert!(!arg.b.name.is_empty(), - format!("No name found for Arg when parsing usage string: {}", - self.usage)); + debug_assert!( + !arg.b.name.is_empty(), + format!( + "No name found for Arg when parsing usage string: {}", + self.usage + ) + ); arg.v.num_vals = match arg.v.val_names { Some(ref v) if v.len() >= 2 => Some(v.len() as u64), _ => None, @@ -73,8 +76,11 @@ impl<'a> UsageParser<'a> { fn name(&mut self, arg: &mut Arg<'a, 'a>) { debugln!("UsageParser::name;"); - if *self.usage.as_bytes().get(self.pos).expect(INTERNAL_ERROR_MSG) == b'<' && - !self.explicit_name_set { + if *self.usage + .as_bytes() + .get(self.pos) + .expect(INTERNAL_ERROR_MSG) == b'<' && !self.explicit_name_set + { arg.setb(ArgSettings::Required); } self.pos += 1; @@ -104,17 +110,25 @@ impl<'a> UsageParser<'a> { } fn stop_at<F>(&mut self, f: F) - where F: Fn(u8) -> bool + where + F: Fn(u8) -> bool, { debugln!("UsageParser::stop_at;"); self.start = self.pos; - self.pos += self.usage[self.start..].bytes().take_while(|&b| f(b)).count(); + self.pos += self.usage[self.start..] + .bytes() + .take_while(|&b| f(b)) + .count(); } fn short_or_long(&mut self, arg: &mut Arg<'a, 'a>) { debugln!("UsageParser::short_or_long;"); self.pos += 1; - if *self.usage.as_bytes().get(self.pos).expect(INTERNAL_ERROR_MSG) == b'-' { + if *self.usage + .as_bytes() + .get(self.pos) + .expect(INTERNAL_ERROR_MSG) == b'-' + { self.pos += 1; self.long(arg); return; @@ -181,9 +195,12 @@ impl<'a> UsageParser<'a> { self.stop_at(help_start); self.start = self.pos + 1; self.pos = self.usage.len() - 1; - debugln!("UsageParser::help: setting help...{}", &self.usage[self.start..self.pos]); + debugln!( + "UsageParser::help: setting help...{}", + &self.usage[self.start..self.pos] + ); arg.b.help = Some(&self.usage[self.start..self.pos]); - self.pos += 1; // Move to next byte to keep from thinking ending ' is a start + self.pos += 1; // Move to next byte to keep from thinking ending ' is a start self.prev = UsageToken::Help; } } @@ -332,7 +349,10 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -346,7 +366,10 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(b.v.num_vals.is_none()); } @@ -360,7 +383,10 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -374,7 +400,10 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(d.v.num_vals.is_none()); } @@ -388,7 +417,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -402,7 +434,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -416,7 +451,10 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(b.v.num_vals.is_none()); } @@ -430,7 +468,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -444,7 +485,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -458,7 +502,10 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(d.v.num_vals.is_none()); } @@ -472,7 +519,10 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -486,8 +536,10 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -501,7 +553,10 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -515,8 +570,10 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -530,7 +587,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -544,7 +604,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -558,8 +621,10 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -573,7 +638,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -587,7 +655,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -601,8 +672,10 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -616,7 +689,10 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -630,8 +706,10 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -645,7 +723,10 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -659,8 +740,10 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -674,7 +757,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -688,7 +774,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(a.v.num_vals.is_none()); } @@ -702,8 +791,10 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -717,7 +808,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -731,7 +825,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -745,8 +842,10 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -760,8 +859,10 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(a.v.num_vals.is_none()); } @@ -775,8 +876,10 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -790,7 +893,10 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -804,8 +910,10 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -819,8 +927,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(a.v.num_vals.is_none()); } @@ -834,8 +944,10 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -849,7 +961,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -863,8 +978,10 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -878,8 +995,10 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(a.v.num_vals.is_none()); } @@ -893,8 +1012,10 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -908,7 +1029,10 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -922,8 +1046,10 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -937,8 +1063,10 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(a.v.num_vals.is_none()); } @@ -952,8 +1080,10 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + b.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(b.v.num_vals.is_none()); } @@ -967,7 +1097,10 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.v.val_names.unwrap().values().collect::<Vec<_>>(), [&"opt"]); + assert_eq!( + c.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"opt"] + ); assert!(c.v.num_vals.is_none()); } @@ -981,8 +1114,10 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"option"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"option"] + ); assert!(d.v.num_vals.is_none()); } @@ -996,8 +1131,10 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"file", &"mode"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"file", &"mode"] + ); assert_eq!(d.v.num_vals.unwrap(), 2); } @@ -1011,8 +1148,10 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"file", &"mode"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"file", &"mode"] + ); assert_eq!(d.v.num_vals.unwrap(), 2); } @@ -1026,8 +1165,10 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"file", &"mode"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"file", &"mode"] + ); assert_eq!(d.v.num_vals.unwrap(), 2); } @@ -1041,8 +1182,10 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(!d.is_set(ArgSettings::Required)); - assert_eq!(d.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"file", &"mode"]); + assert_eq!( + d.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"file", &"mode"] + ); assert_eq!(d.v.num_vals.unwrap(), 2); } @@ -1116,8 +1259,10 @@ mod test { #[test] fn pos_help_newline() { - let c = Arg::from_usage("[pos]... 'some help{n}\ - info'"); + let c = Arg::from_usage( + "[pos]... 'some help{n}\ + info'", + ); assert_eq!(c.b.name, "pos"); assert_eq!(c.b.help.unwrap(), "some help{n}info"); assert!(c.is_set(ArgSettings::Multiple)); @@ -1128,8 +1273,10 @@ mod test { #[test] fn pos_help_newline_lit_sq() { - let c = Arg::from_usage("[pos]... 'some help\' stuff{n}\ - info'"); + let c = Arg::from_usage( + "[pos]... 'some help\' stuff{n}\ + info'", + ); assert_eq!(c.b.name, "pos"); assert_eq!(c.b.help.unwrap(), "some help' stuff{n}info"); assert!(c.is_set(ArgSettings::Multiple)); @@ -1191,8 +1338,10 @@ mod test { let a = Arg::from_usage("[ñämê] --ôpt=[üñíčöĐ€] 'hælp'"); assert_eq!(a.b.name, "ñämê"); assert_eq!(a.s.long, Some("ôpt")); - assert_eq!(a.v.val_names.unwrap().values().collect::<Vec<_>>(), - [&"üñíčöĐ€"]); + assert_eq!( + a.v.val_names.unwrap().values().collect::<Vec<_>>(), + [&"üñíčöĐ€"] + ); assert_eq!(a.b.help, Some("hælp")); } } diff --git a/src/vendor/cmake/.cargo-checksum.json b/src/vendor/cmake/.cargo-checksum.json index 989ceba9fd..e54632de04 100644 --- a/src/vendor/cmake/.cargo-checksum.json +++ b/src/vendor/cmake/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"c5565ac6e1981bf3a88d132c16e381411a239a1c25ec140ee13cf2d50f1f97d0","Cargo.toml":"fb41ab934c12ba136c1363b03b13de7118ae6520f8d68d365c3789da25915712","Cargo.toml.orig":"e6931a67af7df5994aaf61f0648096b9674f80fadd4c615f91cdccad4e203703","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"bf3a5b4a8948c1ce4c3a43a76a47d3e2a190877d1284350a787ab8a23a5dbf62","src/lib.rs":"c96c80fae7fa8ad3aac07c31f499854ef98984c363ab06b7b51909d69f471d05"},"package":"e14cd15a7cbc2c6a905677e54b831ee91af2ff43b352010f6133236463b65cac"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"c5565ac6e1981bf3a88d132c16e381411a239a1c25ec140ee13cf2d50f1f97d0","Cargo.toml":"159a1f1908654ee80dcab59e9eacee17525697b98cc99a8a4834ab423dfeaddb","Cargo.toml.orig":"55de4cd230605284c5cf0dafddba3fc8ac53b8ab37c2b2590ab3e5f74f31d992","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"07a575f3911ae3563dd87a8cc693d9af232e9b55e9c0b170bc49f37869a07f7f","src/lib.rs":"36af1560f494fc1e159253b4a8334f58937d7a3a3c2b7120d42d1c78b9e4b518"},"package":"56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"} \ No newline at end of file diff --git a/src/vendor/cmake/Cargo.toml b/src/vendor/cmake/Cargo.toml index 600ffda229..c3d525ce68 100644 --- a/src/vendor/cmake/Cargo.toml +++ b/src/vendor/cmake/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "cmake" -version = "0.1.28" +version = "0.1.29" authors = ["Alex Crichton <alex@alexcrichton.com>"] description = "A build dependency for running `cmake` to build a native library\n" homepage = "https://github.com/alexcrichton/cmake-rs" diff --git a/src/vendor/cmake/Cargo.toml.orig b/src/vendor/cmake/Cargo.toml.orig index 5b86b8ce06..0427289dc2 100644 --- a/src/vendor/cmake/Cargo.toml.orig +++ b/src/vendor/cmake/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "cmake" -version = "0.1.28" +version = "0.1.29" authors = ["Alex Crichton <alex@alexcrichton.com>"] license = "MIT/Apache-2.0" readme = "README.md" diff --git a/src/vendor/cmake/README.md b/src/vendor/cmake/README.md index f164958776..07453382b9 100644 --- a/src/vendor/cmake/README.md +++ b/src/vendor/cmake/README.md @@ -13,6 +13,9 @@ library. cmake = "0.2" ``` +The CMake executable is assumed to be `cmake` unless the `CMAKE` +environmental variable is set. + # License This project is licensed under either of diff --git a/src/vendor/cmake/src/lib.rs b/src/vendor/cmake/src/lib.rs index 0626b77e24..c1836b2f76 100644 --- a/src/vendor/cmake/src/lib.rs +++ b/src/vendor/cmake/src/lib.rs @@ -297,7 +297,8 @@ impl Config { let cmake_prefix_path = env::join_paths(&cmake_prefix_path).unwrap(); // Build up the first cmake command to build the build system. - let mut cmd = Command::new("cmake"); + let executable = env::var("CMAKE").unwrap_or("cmake".to_owned()); + let mut cmd = Command::new(executable); cmd.arg(&self.path) .current_dir(&build); if target.contains("windows-gnu") { diff --git a/src/vendor/compiletest_rs/.cargo-checksum.json b/src/vendor/compiletest_rs/.cargo-checksum.json index 8266a7aaee..3c970d1d54 100644 --- a/src/vendor/compiletest_rs/.cargo-checksum.json +++ b/src/vendor/compiletest_rs/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"1b62ffdb22769f5b5d65db4b2871aa19f0c8911d51ee9f4d7368e4a8c2cd3431",".travis.yml":"816e84bf33cade7731c1dc6c1dca568404e21903c25a251eaf81a0561a88eb7d","Cargo.toml":"a348a6f2547c8ce43be5485742af2b38d899acc2c1e8415202a6e955c24bc7e5","Cargo.toml.orig":"2c16cbd73765e0ed26e0aeb200ffb4f0424d42fb4990c7a38cdd7fee305abc2a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"f62a8e46b26d064942602b8fc5dff0566744f029aaeb29fc85587ba7d858dc3b","src/common.rs":"e954f056a69cac83c1502244ce293028c211e909b2f0d1a1696341327bc62e79","src/errors.rs":"dc52216b0c301a8d70820b90c45e10f44c427031ac33df81a450fddce6ae3758","src/header.rs":"a74396784d11a83fe440c244c846b4f7a453e7f0856ba7e1fe46f88ef52e5de8","src/json.rs":"7793d3c2d7890331e845dba973eecefde757db91d2252893fe9872c0e2c057a0","src/lib.rs":"942bd805c82fc762dd1703a02f3b0040969afb3397b2aaa8955ec74e9e5df47f","src/raise_fd_limit.rs":"b0840fe16df9edaae0571499e105db47768050fcd62729d1e56295f2db34318e","src/runtest.rs":"9ed33fb56abf95ff76b28c1bfcd7d598d9668d1ad0fdff745ff7d74fcd604daa","src/uidiff.rs":"2f612bd4ed76d68c0f6b3eb8dda5adf14a3e6ceef261c88c810ac6b6857e2d34","src/util.rs":"363096c007b53e3288ac4ab9264a1f64d3a0a6cc3b6c01e1fa3b215e515fab6c"},"package":"86f4663adfd113e17109c35c2067194eca782a5baf9c90f4696ca13d04631adb"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"1b62ffdb22769f5b5d65db4b2871aa19f0c8911d51ee9f4d7368e4a8c2cd3431",".travis.yml":"816e84bf33cade7731c1dc6c1dca568404e21903c25a251eaf81a0561a88eb7d","Cargo.toml":"f6a8a52eb5f626ecbced96780208a0cd0904aa0e72119f558c157c30ec816a28","Cargo.toml.orig":"7f347e0bbf19ad92f63a249663453c30d74f647e2888987b76f081103d44f99b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"de92c15e8e15705323625c208b79decfdd1bbbf3556a28c4273a92c1e32ab7aa","src/common.rs":"3cbcb504dbaa726be26546cfb14d5015cb33c5e8bd40d86dc01af10e8490d17e","src/errors.rs":"88a36d1726d90b11bf9272b1439dd52cd4fdf2e70e6e0cb6cfb323f76d84e3ff","src/header.rs":"d08661501f83d3183351fe91ea296e6797da493f6c5a3c447d8383c9ba4e7395","src/json.rs":"73af75860f9735106f95bc9cf2da2aee5959f1ca2ce871136f1eca69a8e62ff8","src/lib.rs":"6e4da496f66b66a66d3bf2a4d972b285415ee2a5501743381724c61f9af08611","src/raise_fd_limit.rs":"b0840fe16df9edaae0571499e105db47768050fcd62729d1e56295f2db34318e","src/read2.rs":"c2d17ead1766ce1fa27821a0a7337c57f169222e2e23bc4113dc4b47f7b783fc","src/runtest.rs":"aa573eb3546b91588bf9e34b6708589abdaf8de5e4434c068b82f55ed92d854a","src/uidiff.rs":"2f612bd4ed76d68c0f6b3eb8dda5adf14a3e6ceef261c88c810ac6b6857e2d34","src/util.rs":"19429c1c26ffe09a6991f5ea9aec088cb766806fd23623181ef1e085720b2bec"},"package":"562bafeec9aef1e3e08f1c5b0c542220bb80ff2894e5373a1f9d17c346412c66"} \ No newline at end of file diff --git a/src/vendor/compiletest_rs/Cargo.toml b/src/vendor/compiletest_rs/Cargo.toml index c99fa38144..7a8a71acc4 100644 --- a/src/vendor/compiletest_rs/Cargo.toml +++ b/src/vendor/compiletest_rs/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "compiletest_rs" -version = "0.3.1" +version = "0.3.3" authors = ["The Rust Project Developers", "Thomas Bracht Laumann Jespersen <laumann.thomas@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>"] description = "The compiletest utility from the Rust compiler as a standalone testing harness" readme = "README.md" @@ -25,24 +25,28 @@ name = "compiletest_rs" [dependencies.diff] version = "0.1.10" -[dependencies.rustc-serialize] -version = "0.3" +[dependencies.filetime] +version = "0.1" [dependencies.getopts] version = "0.2" +[dependencies.log] +version = "0.3" + +[dependencies.rustc-serialize] +version = "0.3" + [dependencies.tempdir] version = "0.3" optional = true -[dependencies.log] -version = "0.3" - -[dependencies.libc] -version = "0.2" - -[dependencies.filetime] -version = "0.1" - [features] tmp = ["tempdir"] +[target."cfg(unix)".dependencies.libc] +version = "0.2" +[target."cfg(windows)".dependencies.miow] +version = "0.2" + +[target."cfg(windows)".dependencies.winapi] +version = "0.2" diff --git a/src/vendor/compiletest_rs/Cargo.toml.orig b/src/vendor/compiletest_rs/Cargo.toml.orig index 3a6242e209..b98e664010 100644 --- a/src/vendor/compiletest_rs/Cargo.toml.orig +++ b/src/vendor/compiletest_rs/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "compiletest_rs" -version = "0.3.1" +version = "0.3.3" authors = [ "The Rust Project Developers" , "Thomas Bracht Laumann Jespersen <laumann.thomas@gmail.com>" , "Manish Goregaokar <manishsmail@gmail.com>" @@ -20,8 +20,14 @@ filetime = "0.1" getopts = "0.2" log = "0.3" rustc-serialize = "0.3" -libc = "0.2" tempdir = { version = "0.3", optional = true } +[target."cfg(unix)".dependencies] +libc = "0.2" + +[target."cfg(windows)".dependencies] +miow = "0.2" +winapi = "0.2" + [features] tmp = ["tempdir"] diff --git a/src/vendor/compiletest_rs/README.md b/src/vendor/compiletest_rs/README.md index 9d7769071a..6fadda2cf2 100644 --- a/src/vendor/compiletest_rs/README.md +++ b/src/vendor/compiletest_rs/README.md @@ -1,14 +1,13 @@ compiletest-rs ============== -This project is an attempt at extracting the `compiletest` utility from the Rust -compiler. +This project is an attempt at extracting [the `compiletest` utility][upstream] +from the Rust compiler. The `compiletest` utility is useful for library and plugin developers, who want to include test programs that should fail to compile, issue warnings or otherwise produce compile-time output. - To use in your project ---------------------- To use `compiletest-rs` in your application, add the following to `Cargo.toml` @@ -72,13 +71,35 @@ let mut config = compiletest::Config::default(); config.link_deps(); ``` +Note that `link_deps()` should not be used if any of the added paths contain +spaces, as these are currently not handled correctly. + Example ------- See the `test-project` folder for a complete working example using the `compiletest-rs` utility. Simply `cd test-project` and `cargo test` to see the -tests run. +tests run. The annotation syntax is documented in [rust's test-suite][tests]. TODO ---- - The `run-pass` mode is strictly not necessary since it's baked right into Cargo, but I haven't bothered to take it out + +Contributing +------------ + +Thank you for your interest in improving this utility! Please consider +submitting your patch to [the upstream source][src] instead, as it will +be incorporated into this repo in due time. Still, there are some supporting +files that are specific to this repo, for example: + +- src/lib.rs +- src/uidiff.rs +- test-project/ + +If you are unsure, open a pull request anyway and we would be glad to help! + + +[upstream]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest +[src]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src +[tests]: https://github.com/rust-lang/rust/blob/master/src/test/COMPILER_TESTS.md diff --git a/src/vendor/compiletest_rs/src/common.rs b/src/vendor/compiletest_rs/src/common.rs index 1c4d19313c..49dc4f7cbe 100644 --- a/src/vendor/compiletest_rs/src/common.rs +++ b/src/vendor/compiletest_rs/src/common.rs @@ -16,6 +16,7 @@ use std::path::PathBuf; use rustc; use test::ColorConfig; +use runtest::dylib_env_var; #[derive(Clone, Copy, PartialEq, Debug)] pub enum Mode { @@ -36,6 +37,20 @@ pub enum Mode { MirOpt, } +impl Mode { + pub fn disambiguator(self) -> &'static str { + // Run-pass and pretty run-pass tests could run concurrently, and if they do, + // they need to keep their output segregated. Same is true for debuginfo tests that + // can be run both on gdb and lldb. + match self { + Pretty => ".pretty", + DebugInfoGdb => ".gdb", + DebugInfoLldb => ".lldb", + _ => "", + } + } +} + impl FromStr for Mode { type Err = (); fn from_str(s: &str) -> Result<Mode, ()> { @@ -203,6 +218,8 @@ pub struct Config { pub cc: String, pub cxx: String, pub cflags: String, + pub ar: String, + pub linker: Option<String>, pub llvm_components: String, pub llvm_cxxflags: String, pub nodejs: Option<String>, @@ -211,11 +228,7 @@ pub struct Config { impl Config { /// Add rustc flags to link with the crate's dependencies in addition to the crate itself pub fn link_deps(&mut self) { - // The linked library path env var name depends on the target OS. Code copied from - // https://github.com/rust-lang/cargo/blob/master/src/cargo/util/paths.rs#L22-L26 - let varname = if cfg!(windows) { "PATH" } - else if cfg!(target_os = "macos") { "DYLD_LIBRARY_PATH" } - else { "LD_LIBRARY_PATH" }; + let varname = dylib_env_var(); // Dependencies can be found in the environment variable. Throw everything there into the // link flags @@ -317,6 +330,8 @@ impl Default for Config { cc: "cc".to_string(), cxx: "cxx".to_string(), cflags: "cflags".to_string(), + ar: "ar".to_string(), + linker: None, llvm_components: "llvm-components".to_string(), llvm_cxxflags: "llvm-cxxflags".to_string(), nodejs: None, diff --git a/src/vendor/compiletest_rs/src/errors.rs b/src/vendor/compiletest_rs/src/errors.rs index b7fb367016..251dd4d5ed 100644 --- a/src/vendor/compiletest_rs/src/errors.rs +++ b/src/vendor/compiletest_rs/src/errors.rs @@ -45,7 +45,7 @@ impl FromStr for ErrorKind { impl fmt::Display for ErrorKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - ErrorKind::Help => write!(f, "help"), + ErrorKind::Help => write!(f, "help message"), ErrorKind::Error => write!(f, "error"), ErrorKind::Note => write!(f, "note"), ErrorKind::Suggestion => write!(f, "suggestion"), diff --git a/src/vendor/compiletest_rs/src/header.rs b/src/vendor/compiletest_rs/src/header.rs index bb9bf57d55..c853d53829 100644 --- a/src/vendor/compiletest_rs/src/header.rs +++ b/src/vendor/compiletest_rs/src/header.rs @@ -150,6 +150,14 @@ impl EarlyProps { // Ignore if actual version is smaller the minimum required // version &actual_version[..] < min_version + } else if line.starts_with("min-system-llvm-version") { + let min_version = line.trim_right() + .rsplit(' ') + .next() + .expect("Malformed llvm version directive"); + // Ignore if using system LLVM and actual version + // is smaller the minimum required version + !(config.system_llvm && &actual_version[..] < min_version) } else { false } @@ -259,9 +267,9 @@ impl TestProps { props } - pub fn from_file(testfile: &Path, config: &Config) -> Self { + pub fn from_file(testfile: &Path, cfg: Option<&str>, config: &Config) -> Self { let mut props = TestProps::new(); - props.load_from(testfile, None, config); + props.load_from(testfile, cfg, config); props } @@ -269,10 +277,10 @@ impl TestProps { /// tied to a particular revision `foo` (indicated by writing /// `//[foo]`), then the property is ignored unless `cfg` is /// `Some("foo")`. - pub fn load_from(&mut self, - testfile: &Path, - cfg: Option<&str>, - config: &Config) { + fn load_from(&mut self, + testfile: &Path, + cfg: Option<&str>, + config: &Config) { iter_header(testfile, cfg, &mut |ln| { @@ -531,7 +539,7 @@ impl Config { let name = line[prefix.len()+1 ..].split(&[':', ' '][..]).next().unwrap(); name == "test" || - name == util::get_os(&self.target) || // target + util::matches_os(&self.target, name) || // target name == util::get_arch(&self.target) || // architecture name == util::get_pointer_width(&self.target) || // pointer width name == self.stage_id.split('-').next().unwrap() || // stage @@ -567,6 +575,19 @@ impl Config { None } } + + pub fn find_rust_src_root(&self) -> Option<PathBuf> { + let mut path = self.src_base.clone(); + let path_postfix = Path::new("src/etc/lldb_batchmode.py"); + + while path.pop() { + if path.join(&path_postfix).is_file() { + return Some(path); + } + } + + None + } } pub fn lldb_version_to_int(version_string: &str) -> isize { diff --git a/src/vendor/compiletest_rs/src/json.rs b/src/vendor/compiletest_rs/src/json.rs index 77ee93c300..8e9cd1a12f 100644 --- a/src/vendor/compiletest_rs/src/json.rs +++ b/src/vendor/compiletest_rs/src/json.rs @@ -36,6 +36,7 @@ struct DiagnosticSpan { column_end: usize, is_primary: bool, label: Option<String>, + suggested_replacement: Option<String>, expansion: Option<Box<DiagnosticSpanMacroExpansion>>, } @@ -164,15 +165,15 @@ fn push_expected_errors(expected_errors: &mut Vec<Error>, } // If the message has a suggestion, register that. - if let Some(ref rendered) = diagnostic.rendered { - let start_line = primary_spans.iter().map(|s| s.line_start).min().expect("\ - every suggestion should have at least one span"); - for (index, line) in rendered.lines().enumerate() { - expected_errors.push(Error { - line_num: start_line + index, - kind: Some(ErrorKind::Suggestion), - msg: line.to_string(), - }); + for span in primary_spans { + if let Some(ref suggested_replacement) = span.suggested_replacement { + for (index, line) in suggested_replacement.lines().enumerate() { + expected_errors.push(Error { + line_num: span.line_start + index, + kind: Some(ErrorKind::Suggestion), + msg: line.to_string(), + }); + } } } diff --git a/src/vendor/compiletest_rs/src/lib.rs b/src/vendor/compiletest_rs/src/lib.rs index 52882591ea..ce1a78beb2 100644 --- a/src/vendor/compiletest_rs/src/lib.rs +++ b/src/vendor/compiletest_rs/src/lib.rs @@ -12,10 +12,11 @@ #![feature(rustc_private)] #![feature(test)] +#![feature(slice_rotate)] #![deny(unused_imports)] -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(unix)] extern crate libc; extern crate test; extern crate rustc; @@ -40,21 +41,16 @@ use test::TestPaths; use self::header::EarlyProps; pub mod uidiff; -pub mod json; pub mod util; +mod json; pub mod header; pub mod runtest; pub mod common; pub mod errors; +mod read2; pub use common::Config; -#[deprecated(since="0.2.9", - note="Use Config::default() instead. This method will be removed in version 0.3.0")] -pub fn default_config() -> Config { - Config::default() -} - pub fn run_tests(config: &Config) { if config.target.contains("android") { if let DebugInfoGdb = config.mode { diff --git a/src/vendor/compiletest_rs/src/read2.rs b/src/vendor/compiletest_rs/src/read2.rs new file mode 100644 index 0000000000..1d8816c7db --- /dev/null +++ b/src/vendor/compiletest_rs/src/read2.rs @@ -0,0 +1,208 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// FIXME: This is a complete copy of `cargo/src/cargo/util/read2.rs` +// Consider unify the read2() in libstd, cargo and this to prevent further code duplication. + +pub use self::imp::read2; + +#[cfg(not(any(unix, windows)))] +mod imp { + use std::io::{self, Read}; + use std::process::{ChildStdout, ChildStderr}; + + pub fn read2(out_pipe: ChildStdout, + err_pipe: ChildStderr, + data: &mut FnMut(bool, &mut Vec<u8>, bool)) -> io::Result<()> { + let mut buffer = Vec::new(); + out_pipe.read_to_end(&mut buffer)?; + data(true, &mut buffer, true); + buffer.clear(); + err_pipe.read_to_end(&mut buffer)?; + data(false, &mut buffer, true); + Ok(()) + } +} + +#[cfg(unix)] +mod imp { + use std::io::prelude::*; + use std::io; + use std::mem; + use std::os::unix::prelude::*; + use std::process::{ChildStdout, ChildStderr}; + use libc; + + pub fn read2(mut out_pipe: ChildStdout, + mut err_pipe: ChildStderr, + data: &mut FnMut(bool, &mut Vec<u8>, bool)) -> io::Result<()> { + unsafe { + libc::fcntl(out_pipe.as_raw_fd(), libc::F_SETFL, libc::O_NONBLOCK); + libc::fcntl(err_pipe.as_raw_fd(), libc::F_SETFL, libc::O_NONBLOCK); + } + + let mut out_done = false; + let mut err_done = false; + let mut out = Vec::new(); + let mut err = Vec::new(); + + let mut fds: [libc::pollfd; 2] = unsafe { mem::zeroed() }; + fds[0].fd = out_pipe.as_raw_fd(); + fds[0].events = libc::POLLIN; + fds[1].fd = err_pipe.as_raw_fd(); + fds[1].events = libc::POLLIN; + loop { + // wait for either pipe to become readable using `select` + let r = unsafe { libc::poll(fds.as_mut_ptr(), 2, -1) }; + if r == -1 { + let err = io::Error::last_os_error(); + if err.kind() == io::ErrorKind::Interrupted { + continue + } + return Err(err) + } + + // Read as much as we can from each pipe, ignoring EWOULDBLOCK or + // EAGAIN. If we hit EOF, then this will happen because the underlying + // reader will return Ok(0), in which case we'll see `Ok` ourselves. In + // this case we flip the other fd back into blocking mode and read + // whatever's leftover on that file descriptor. + let handle = |res: io::Result<_>| { + match res { + Ok(_) => Ok(true), + Err(e) => { + if e.kind() == io::ErrorKind::WouldBlock { + Ok(false) + } else { + Err(e) + } + } + } + }; + if !out_done && fds[0].revents != 0 && handle(out_pipe.read_to_end(&mut out))? { + out_done = true; + } + data(true, &mut out, out_done); + if !err_done && fds[1].revents != 0 && handle(err_pipe.read_to_end(&mut err))? { + err_done = true; + } + data(false, &mut err, err_done); + + if out_done && err_done { + return Ok(()) + } + } + } +} + +#[cfg(windows)] +mod imp { + extern crate miow; + extern crate winapi; + + use std::io; + use std::os::windows::prelude::*; + use std::process::{ChildStdout, ChildStderr}; + use std::slice; + + use self::miow::iocp::{CompletionPort, CompletionStatus}; + use self::miow::pipe::NamedPipe; + use self::miow::Overlapped; + use self::winapi::ERROR_BROKEN_PIPE; + + struct Pipe<'a> { + dst: &'a mut Vec<u8>, + overlapped: Overlapped, + pipe: NamedPipe, + done: bool, + } + + pub fn read2(out_pipe: ChildStdout, + err_pipe: ChildStderr, + data: &mut FnMut(bool, &mut Vec<u8>, bool)) -> io::Result<()> { + let mut out = Vec::new(); + let mut err = Vec::new(); + + let port = CompletionPort::new(1)?; + port.add_handle(0, &out_pipe)?; + port.add_handle(1, &err_pipe)?; + + unsafe { + let mut out_pipe = Pipe::new(out_pipe, &mut out); + let mut err_pipe = Pipe::new(err_pipe, &mut err); + + out_pipe.read()?; + err_pipe.read()?; + + let mut status = [CompletionStatus::zero(), CompletionStatus::zero()]; + + while !out_pipe.done || !err_pipe.done { + for status in port.get_many(&mut status, None)? { + if status.token() == 0 { + out_pipe.complete(status); + data(true, out_pipe.dst, out_pipe.done); + out_pipe.read()?; + } else { + err_pipe.complete(status); + data(false, err_pipe.dst, err_pipe.done); + err_pipe.read()?; + } + } + } + + Ok(()) + } + } + + impl<'a> Pipe<'a> { + unsafe fn new<P: IntoRawHandle>(p: P, dst: &'a mut Vec<u8>) -> Pipe<'a> { + Pipe { + dst: dst, + pipe: NamedPipe::from_raw_handle(p.into_raw_handle()), + overlapped: Overlapped::zero(), + done: false, + } + } + + unsafe fn read(&mut self) -> io::Result<()> { + let dst = slice_to_end(self.dst); + match self.pipe.read_overlapped(dst, self.overlapped.raw()) { + Ok(_) => Ok(()), + Err(e) => { + if e.raw_os_error() == Some(ERROR_BROKEN_PIPE as i32) { + self.done = true; + Ok(()) + } else { + Err(e) + } + } + } + } + + unsafe fn complete(&mut self, status: &CompletionStatus) { + let prev = self.dst.len(); + self.dst.set_len(prev + status.bytes_transferred() as usize); + if status.bytes_transferred() == 0 { + self.done = true; + } + } + } + + unsafe fn slice_to_end(v: &mut Vec<u8>) -> &mut [u8] { + if v.capacity() == 0 { + v.reserve(16); + } + if v.capacity() == v.len() { + v.reserve(1); + } + slice::from_raw_parts_mut(v.as_mut_ptr().offset(v.len() as isize), + v.capacity() - v.len()) + } +} diff --git a/src/vendor/compiletest_rs/src/runtest.rs b/src/vendor/compiletest_rs/src/runtest.rs index 10ef326d9d..1fd48881ba 100644 --- a/src/vendor/compiletest_rs/src/runtest.rs +++ b/src/vendor/compiletest_rs/src/runtest.rs @@ -25,10 +25,11 @@ use std::collections::HashSet; use std::env; use std::ffi::OsString; use std::fs::{self, File, create_dir_all}; +use std::fmt; use std::io::prelude::*; use std::io::{self, BufReader}; use std::path::{Path, PathBuf}; -use std::process::{Command, Output, ExitStatus, Stdio}; +use std::process::{Command, Output, ExitStatus, Stdio, Child}; use std::str; use extract_gdb_version; @@ -68,7 +69,7 @@ pub fn run(config: Config, testpaths: &TestPaths) { print!("\n\n"); } debug!("running {:?}", testpaths.file.display()); - let base_props = TestProps::from_file(&testpaths.file, &config); + let base_props = TestProps::from_file(&testpaths.file, None, &config); let base_cx = TestCx { config: &config, props: &base_props, @@ -80,8 +81,9 @@ pub fn run(config: Config, testpaths: &TestPaths) { base_cx.run_revision() } else { for revision in &base_props.revisions { - let mut revision_props = base_props.clone(); - revision_props.load_from(&testpaths.file, Some(revision), &config); + let revision_props = TestProps::from_file(&testpaths.file, + Some(revision), + &config); let rev_cx = TestCx { config: &config, props: &revision_props, @@ -571,9 +573,10 @@ actual:\n\ } } - _=> { - let rust_src_root = self.find_rust_src_root() - .expect("Could not find Rust source root"); + _ => { + let rust_src_root = self.config.find_rust_src_root().expect( + "Could not find Rust source root", + ); let rust_pp_module_rel_path = Path::new("./src/etc"); let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path) .to_str() @@ -664,19 +667,6 @@ actual:\n\ self.check_debugger_output(&debugger_run_result, &check_lines); } - fn find_rust_src_root(&self) -> Option<PathBuf> { - let mut path = self.config.src_base.clone(); - let path_postfix = Path::new("src/etc/lldb_batchmode.py"); - - while path.pop() { - if path.join(&path_postfix).is_file() { - return Some(path); - } - } - - None - } - fn run_debuginfo_lldb_test(&self) { assert!(self.revision.is_none(), "revisions not relevant here"); @@ -735,7 +725,9 @@ actual:\n\ script_str.push_str("version\n"); // Switch LLDB into "Rust mode" - let rust_src_root = self.find_rust_src_root().expect("Could not find Rust source root"); + let rust_src_root = self.config.find_rust_src_root().expect( + "Could not find Rust source root", + ); let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py"); let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path) .to_str() @@ -1050,7 +1042,7 @@ actual:\n\ None => { if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) { self.error( - &format!("{}:{}: unexpected {:?}: '{}'", + &format!("{}:{}: unexpected {}: '{}'", file_name, actual_error.line_num, actual_error.kind.as_ref() @@ -1164,6 +1156,9 @@ actual:\n\ .arg("-o").arg(out_dir) .arg(&self.testpaths.file) .args(&self.props.compile_flags); + if let Some(ref linker) = self.config.linker { + rustdoc.arg("--linker").arg(linker).arg("-Z").arg("unstable-options"); + } self.compose_and_run_compiler(rustdoc, None) } @@ -1276,6 +1271,7 @@ actual:\n\ let crate_type = if aux_props.no_prefer_dynamic { None } else if (self.config.target.contains("musl") && !aux_props.force_host) || + self.config.target.contains("wasm32") || self.config.target.contains("emscripten") { // We primarily compile all auxiliary libraries as dynamic libraries // to avoid code size bloat and large binaries as much as possible @@ -1350,12 +1346,14 @@ actual:\n\ if let Some(input) = input { child.stdin.as_mut().unwrap().write_all(input.as_bytes()).unwrap(); } - let Output { status, stdout, stderr } = child.wait_with_output().unwrap(); + + let Output { status, stdout, stderr } = read2_abbreviated(child) + .expect("failed to read output"); let result = ProcRes { status, - stdout: String::from_utf8(stdout).unwrap(), - stderr: String::from_utf8(stderr).unwrap(), + stdout: String::from_utf8_lossy(&stdout).into_owned(), + stderr: String::from_utf8_lossy(&stderr).into_owned(), cmdline, }; @@ -1390,6 +1388,8 @@ actual:\n\ if let Some(ref incremental_dir) = self.props.incremental_dir { rustc.args(&["-Z", &format!("incremental={}", incremental_dir.display())]); + rustc.args(&["-Z", "incremental-verify-ich"]); + rustc.args(&["-Z", "incremental-queries"]); } match self.config.mode { @@ -1410,6 +1410,7 @@ actual:\n\ "-Zdump-mir-exclude-pass-number"]); let mir_dump_dir = self.get_mir_dump_dir(); + let _ = fs::remove_dir_all(&mir_dump_dir); create_dir_all(mir_dump_dir.as_path()).unwrap(); let mut dir_opt = "-Zdump-mir-dir=".to_string(); dir_opt.push_str(mir_dump_dir.to_str().unwrap()); @@ -1432,7 +1433,10 @@ actual:\n\ } } - if !self.props.no_prefer_dynamic { + + if self.config.target == "wasm32-unknown-unknown" { + // rustc.arg("-g"); // get any backtrace at all on errors + } else if !self.props.no_prefer_dynamic { rustc.args(&["-C", "prefer-dynamic"]); } @@ -1450,6 +1454,9 @@ actual:\n\ } else { rustc.args(self.split_maybe_args(&self.config.target_rustcflags)); } + if let Some(ref linker) = self.config.linker { + rustc.arg(format!("-Clinker={}", linker)); + } rustc.args(&self.props.compile_flags); @@ -1470,6 +1477,10 @@ actual:\n\ let mut fname = f.file_name().unwrap().to_os_string(); fname.push(".js"); f.set_file_name(&fname); + } else if self.config.target.contains("wasm32") { + let mut fname = f.file_name().unwrap().to_os_string(); + fname.push(".wasm"); + f.set_file_name(&fname); } else if !env::consts::EXE_SUFFIX.is_empty() { let mut fname = f.file_name().unwrap().to_os_string(); fname.push(env::consts::EXE_SUFFIX); @@ -1492,6 +1503,22 @@ actual:\n\ } } + // If this is otherwise wasm , then run tests under nodejs with our + // shim + if self.config.target.contains("wasm32") { + if let Some(ref p) = self.config.nodejs { + args.push(p.clone()); + } else { + self.fatal("no NodeJS binary found (--nodejs)"); + } + + let src = self.config.src_base + .parent().unwrap() // chop off `run-pass` + .parent().unwrap() // chop off `test` + .parent().unwrap(); // chop off `src` + args.push(src.join("src/etc/wasm32-shim.js").display().to_string()); + } + let exe_file = self.make_exe_name(); // FIXME (#9639): This needs to handle non-utf8 paths @@ -1567,7 +1594,7 @@ actual:\n\ fn aux_output_dir_name(&self) -> PathBuf { let f = self.output_base_name(); let mut fname = f.file_name().unwrap().to_os_string(); - fname.push(&format!(".{}.libaux", self.config.mode)); + fname.push(&format!("{}.aux", self.config.mode.disambiguator())); f.with_file_name(&fname) } @@ -1636,7 +1663,9 @@ actual:\n\ cmd.arg("-a").arg("-u"); cmd.arg(filename); cmd.arg("-nobanner"); - let output = match cmd.output() { + cmd.stdout(Stdio::piped()); + cmd.stderr(Stdio::piped()); + let output = match cmd.spawn().and_then(read2_abbreviated) { Ok(output) => output, Err(_) => return, }; @@ -1717,11 +1746,13 @@ actual:\n\ if self.props.check_test_line_numbers_match { self.check_rustdoc_test_option(proc_res); } else { - let root = self.find_rust_src_root().unwrap(); - let res = self.cmd2procres(Command::new(&self.config.docck_python) - .arg(root.join("src/etc/htmldocck.py")) - .arg(out_dir) - .arg(&self.testpaths.file)); + let root = self.config.find_rust_src_root().unwrap(); + let res = self.cmd2procres( + Command::new(&self.config.docck_python) + .arg(root.join("src/etc/htmldocck.py")) + .arg(out_dir) + .arg(&self.testpaths.file), + ); if !res.status.success() { self.fatal_proc_rec("htmldocck failed!", &res); } @@ -2036,7 +2067,6 @@ actual:\n\ // Add an extra flag pointing at the incremental directory. let mut revision_props = self.props.clone(); revision_props.incremental_dir = Some(incremental_dir); - revision_props.compile_flags.push(String::from("-Zincremental-info")); let revision_cx = TestCx { config: self.config, @@ -2095,6 +2125,8 @@ actual:\n\ let mut cmd = Command::new(make); cmd.current_dir(&self.testpaths.file) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) .env("TARGET", &self.config.target) .env("PYTHON", &self.config.docck_python) .env("S", src_root) @@ -2109,6 +2141,10 @@ actual:\n\ .env("LLVM_COMPONENTS", &self.config.llvm_components) .env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags); + if let Some(ref linker) = self.config.linker { + cmd.env("RUSTC_LINKER", linker); + } + // We don't want RUSTFLAGS set from the outside to interfere with // compiler flags set in the test cases: cmd.env_remove("RUSTFLAGS"); @@ -2131,14 +2167,15 @@ actual:\n\ .env("CXX", &self.config.cxx); } else { cmd.env("CC", format!("{} {}", self.config.cc, self.config.cflags)) - .env("CXX", format!("{} {}", self.config.cxx, self.config.cflags)); + .env("CXX", format!("{} {}", self.config.cxx, self.config.cflags)) + .env("AR", &self.config.ar); if self.config.target.contains("windows") { cmd.env("IS_WINDOWS", "1"); } } - let output = cmd.output().expect("failed to spawn `make`"); + let output = cmd.spawn().and_then(read2_abbreviated).expect("failed to spawn `make`"); if !output.status.success() { let res = ProcRes { status: output.status, @@ -2237,7 +2274,7 @@ actual:\n\ let (_, tests_text) = test_file_contents.split_at(idx + "// END_RUST SOURCE".len()); let tests_text_str = String::from(tests_text); let mut curr_test : Option<&str> = None; - let mut curr_test_contents = Vec::new(); + let mut curr_test_contents = vec![ExpectedLine::Elision]; for l in tests_text_str.lines() { debug!("line: {:?}", l); if l.starts_with("// START ") { @@ -2251,11 +2288,14 @@ actual:\n\ self.compare_mir_test_output(curr_test.unwrap(), &curr_test_contents); curr_test = None; curr_test_contents.clear(); + curr_test_contents.push(ExpectedLine::Elision); } else if l.is_empty() { // ignore + } else if l.starts_with("//") && l.split_at("//".len()).1.trim() == "..." { + curr_test_contents.push(ExpectedLine::Elision) } else if l.starts_with("// ") { let (_, test_content) = l.split_at("// ".len()); - curr_test_contents.push(test_content); + curr_test_contents.push(ExpectedLine::Text(test_content)); } } } @@ -2273,68 +2313,136 @@ actual:\n\ } } - fn compare_mir_test_output(&self, test_name: &str, expected_content: &[&str]) { + fn compare_mir_test_output(&self, test_name: &str, expected_content: &[ExpectedLine<&str>]) { let mut output_file = PathBuf::new(); output_file.push(self.get_mir_dump_dir()); output_file.push(test_name); debug!("comparing the contests of: {:?}", output_file); debug!("with: {:?}", expected_content); + if !output_file.exists() { + panic!("Output file `{}` from test does not exist", + output_file.into_os_string().to_string_lossy()); + } self.check_mir_test_timestamp(test_name, &output_file); let mut dumped_file = fs::File::open(output_file.clone()).unwrap(); let mut dumped_string = String::new(); dumped_file.read_to_string(&mut dumped_string).unwrap(); let mut dumped_lines = dumped_string.lines().filter(|l| !l.is_empty()); - let mut expected_lines = expected_content.iter().filter(|l| !l.is_empty()); - - // We expect each non-empty line from expected_content to appear - // in the dump in order, but there may be extra lines interleaved - while let Some(expected_line) = expected_lines.next() { - let e_norm = normalize_mir_line(expected_line); - if e_norm.is_empty() { - continue; - }; - let mut found = false; - while let Some(dumped_line) = dumped_lines.next() { - let d_norm = normalize_mir_line(dumped_line); - debug!("found: {:?}", d_norm); - debug!("expected: {:?}", e_norm); - if e_norm == d_norm { - found = true; - break; - }; + let mut expected_lines = expected_content.iter().filter(|&l| { + if let &ExpectedLine::Text(l) = l { + !l.is_empty() + } else { + true } - if !found { - let normalize_all = dumped_string.lines() - .map(nocomment_mir_line) - .filter(|l| !l.is_empty()) - .collect::<Vec<_>>() - .join("\n"); - panic!("ran out of mir dump output to match against.\n\ - Did not find expected line: {:?}\n\ - Expected:\n{}\n\ - Actual:\n{}", - expected_line, - expected_content.join("\n"), - normalize_all); + }).peekable(); + + let compare = |expected_line, dumped_line| { + let e_norm = normalize_mir_line(expected_line); + let d_norm = normalize_mir_line(dumped_line); + debug!("found: {:?}", d_norm); + debug!("expected: {:?}", e_norm); + e_norm == d_norm + }; + + let error = |expected_line, extra_msg| { + let normalize_all = dumped_string.lines() + .map(nocomment_mir_line) + .filter(|l| !l.is_empty()) + .collect::<Vec<_>>() + .join("\n"); + let f = |l: &ExpectedLine<_>| match l { + &ExpectedLine::Elision => "... (elided)".into(), + &ExpectedLine::Text(t) => t + }; + let expected_content = expected_content.iter() + .map(|l| f(l)) + .collect::<Vec<_>>() + .join("\n"); + panic!("Did not find expected line, error: {}\n\ + Actual Line: {:?}\n\ + Expected:\n{}\n\ + Actual:\n{}", + extra_msg, + expected_line, + expected_content, + normalize_all); + }; + + // We expect each non-empty line to appear consecutively, non-consecutive lines + // must be separated by at least one Elision + let mut start_block_line = None; + while let Some(dumped_line) = dumped_lines.next() { + match expected_lines.next() { + Some(&ExpectedLine::Text(expected_line)) => { + let normalized_expected_line = normalize_mir_line(expected_line); + if normalized_expected_line.contains(":{") { + start_block_line = Some(expected_line); + } + + if !compare(expected_line, dumped_line) { + error!("{:?}", start_block_line); + error(expected_line, + format!("Mismatch in lines\nCurrnt block: {}\nExpected Line: {:?}", + start_block_line.unwrap_or("None"), dumped_line)); + } + }, + Some(&ExpectedLine::Elision) => { + // skip any number of elisions in a row. + while let Some(&&ExpectedLine::Elision) = expected_lines.peek() { + expected_lines.next(); + } + if let Some(&ExpectedLine::Text(expected_line)) = expected_lines.next() { + let mut found = compare(expected_line, dumped_line); + if found { + continue; + } + while let Some(dumped_line) = dumped_lines.next() { + found = compare(expected_line, dumped_line); + if found { + break; + } + } + if !found { + error(expected_line, "ran out of mir dump to match against".into()); + } + } + }, + None => {}, } } } fn get_mir_dump_dir(&self) -> PathBuf { - let mut mir_dump_dir = PathBuf::from(self.config.build_base - .as_path() - .to_str() - .unwrap()); + let mut mir_dump_dir = PathBuf::from(self.config.build_base.as_path()); debug!("input_file: {:?}", self.testpaths.file); - mir_dump_dir.push(self.testpaths.file.file_stem().unwrap().to_str().unwrap()); + mir_dump_dir.push(&self.testpaths.relative_dir); + mir_dump_dir.push(self.testpaths.file.file_stem().unwrap()); mir_dump_dir } fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String { let parent_dir = self.testpaths.file.parent().unwrap(); - let parent_dir_str = parent_dir.display().to_string(); - let mut normalized = output.replace(&parent_dir_str, "$DIR") + let cflags = self.props.compile_flags.join(" "); + let json = cflags.contains("--error-format json") || + cflags.contains("--error-format pretty-json"); + let parent_dir_str = if json { + parent_dir.display().to_string().replace("\\", "\\\\") + } else { + parent_dir.display().to_string() + }; + + let mut normalized = output.replace(&parent_dir_str, "$DIR"); + + if json { + // escaped newlines in json strings should be readable + // in the stderr files. There's no point int being correct, + // since only humans process the stderr files. + // Thus we just turn escaped newlines back into newlines. + normalized = normalized.replace("\\n", "\n"); + } + + normalized = normalized.replace("\\\\", "\\") // denormalize for paths on windows .replace("\\", "/") // normalize for paths on windows .replace("\r\n", "\n") // normalize for linebreaks on windows .replace("\t", "\\t"); // makes tabs visible @@ -2439,6 +2547,25 @@ enum TargetLocation { ThisDirectory(PathBuf), } +#[derive(Clone, PartialEq, Eq)] +enum ExpectedLine<T: AsRef<str>> { + Elision, + Text(T) +} + +impl<T> fmt::Debug for ExpectedLine<T> +where + T: AsRef<str> + fmt::Debug +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + if let &ExpectedLine::Text(ref t) = self { + write!(formatter, "{:?}", t) + } else { + write!(formatter, "\"...\" (Elision)") + } + } +} + fn normalize_mir_line(line: &str) -> String { nocomment_mir_line(line).replace(char::is_whitespace, "") } @@ -2451,3 +2578,76 @@ fn nocomment_mir_line(line: &str) -> &str { line } } + +fn read2_abbreviated(mut child: Child) -> io::Result<Output> { + use std::mem::replace; + use read2::read2; + + const HEAD_LEN: usize = 160 * 1024; + const TAIL_LEN: usize = 256 * 1024; + + enum ProcOutput { + Full(Vec<u8>), + Abbreviated { + head: Vec<u8>, + skipped: usize, + tail: Box<[u8]>, + } + } + + impl ProcOutput { + fn extend(&mut self, data: &[u8]) { + let new_self = match *self { + ProcOutput::Full(ref mut bytes) => { + bytes.extend_from_slice(data); + let new_len = bytes.len(); + if new_len <= HEAD_LEN + TAIL_LEN { + return; + } + let tail = bytes.split_off(new_len - TAIL_LEN).into_boxed_slice(); + let head = replace(bytes, Vec::new()); + let skipped = new_len - HEAD_LEN - TAIL_LEN; + ProcOutput::Abbreviated { head, skipped, tail } + } + ProcOutput::Abbreviated { ref mut skipped, ref mut tail, .. } => { + *skipped += data.len(); + if data.len() <= TAIL_LEN { + tail[..data.len()].copy_from_slice(data); + tail.rotate(data.len()); + } else { + tail.copy_from_slice(&data[(data.len() - TAIL_LEN)..]); + } + return; + } + }; + *self = new_self; + } + + fn into_bytes(self) -> Vec<u8> { + match self { + ProcOutput::Full(bytes) => bytes, + ProcOutput::Abbreviated { mut head, skipped, tail } => { + write!(&mut head, "\n\n<<<<<< SKIPPED {} BYTES >>>>>>\n\n", skipped).unwrap(); + head.extend_from_slice(&tail); + head + } + } + } + } + + let mut stdout = ProcOutput::Full(Vec::new()); + let mut stderr = ProcOutput::Full(Vec::new()); + + drop(child.stdin.take()); + read2(child.stdout.take().unwrap(), child.stderr.take().unwrap(), &mut |is_stdout, data, _| { + if is_stdout { &mut stdout } else { &mut stderr }.extend(data); + data.clear(); + })?; + let status = child.wait()?; + + Ok(Output { + status, + stdout: stdout.into_bytes(), + stderr: stderr.into_bytes(), + }) +} diff --git a/src/vendor/compiletest_rs/src/util.rs b/src/vendor/compiletest_rs/src/util.rs index 85fa38bbd3..c00f28eae6 100644 --- a/src/vendor/compiletest_rs/src/util.rs +++ b/src/vendor/compiletest_rs/src/util.rs @@ -51,10 +51,15 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[ ("wasm32", "wasm32"), ]; -pub fn get_os(triple: &str) -> &'static str { +pub fn matches_os(triple: &str, name: &str) -> bool { + // For the wasm32 bare target we ignore anything also ignored on emscripten + // and then we also recognize `wasm32-bare` as the os for the target + if triple == "wasm32-unknown-unknown" { + return name == "emscripten" || name == "wasm32-bare" + } for &(triple_os, os) in OS_TABLE { if triple.contains(triple_os) { - return os; + return os == name; } } panic!("Cannot determine OS from triple"); @@ -73,7 +78,7 @@ pub fn get_env(triple: &str) -> Option<&str> { } pub fn get_pointer_width(triple: &str) -> &'static str { - if triple.contains("64") || triple.starts_with("s390x") { + if (triple.contains("64") && !triple.ends_with("gnux32")) || triple.starts_with("s390x") { "64bit" } else { "32bit" diff --git a/src/vendor/flate2/.cargo-checksum.json b/src/vendor/flate2/.cargo-checksum.json index 4cac1510d4..15c1fbf22a 100644 --- a/src/vendor/flate2/.cargo-checksum.json +++ b/src/vendor/flate2/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"98cf8c8df11438fb438cfe8226d1123bce6680832a4accf91f83614a10363466","Cargo.toml":"b143aa0bd29dbdd83e67e0d28f91f398e0a006d41a899a088c1b560af2bad5a8","Cargo.toml.orig":"edbd2097e392206d1175a453fc0932ea4431179b3ec78565a4c9c49e668c985b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"2accc2c811f3cfa17753c9cbe1cb9856f6a5f52705dafc355e1d5494d2a81e2f","appveyor.yml":"7293e690b6b1fb75cbab1f72ffc5077dd145c806282969b595cc1a82ce1a2e62","examples/deflatedecoder-bufread.rs":"9066719a7b91c57792c1e305a808c12727c93938e936ac2ae16b0e174b82138f","examples/deflatedecoder-read.rs":"39ee43782a5bee7f808da7d32e1b5cd8b51e8be5e344ac11ad9be8a300bc7c85","examples/deflatedecoder-write.rs":"fd084e864a6f6ea6597b8baa2c6f2ab59c2d07da1c3aeb094ec4391c0266d0ad","examples/deflateencoder-bufread.rs":"9c1bd6d215095e338c5a6fc2b3c3b4685f836cae8f102a229d8571c17e2ece6a","examples/deflateencoder-read.rs":"805b677b584c3209ba46e7b4e9706e93d15ebe5f26e086760931fdecef14aeff","examples/deflateencoder-write.rs":"fa402135fa3d009aba4d492ff1287dc2a7cfd745c6fff37d3eb12fef924bf7f4","examples/flatereadext.rs":"656b9bc5352d30a4e6ba7d33a187bc4c1adc28ccb4bd7bffd67fa74c75da3a95","examples/gzbuilder.rs":"2bccaf7f3fb81d1251f410323a3f9a98d838754ce3d370e16ed15c97be5d91bc","examples/gzdecoder-bufread.rs":"76b208873eb2461d213cdf8b20c4062c8fc5dd17a874df12f120415b43d81da3","examples/gzdecoder-read.rs":"e90f4b05312341bdd3b9995b919903efd5be75a7815473d472c1a494446acac2","examples/gzencoder-bufread.rs":"d403cb34700a0c654e11d111e4f862b7a0ae88d05df39a2c8ecd163fe3bcf2f0","examples/gzencoder-read.rs":"c97c87b059da9c46e0d0ddf06ea4db7c22a3dac9e699ab81dbb2d4a8b8681d3a","examples/gzencoder-write.rs":"5ff4f9ea1f9facad50d08ef1687bb785b2f657d6897b7253cd1af32e912e6284","examples/gzmultidecoder-bufread.rs":"23a92037081675fbab811b1d1ac1037130f4f8a4f2f0642c0bf063da835c0c94","examples/gzmultidecoder-read.rs":"d34e50a1fcd5d6c8c25cb203561fd44f698679ba624fe1ecfbfe7b67adff40ba","examples/hello_world.txt":"d2a84f4b8b650937ec8f73cd8be2c74add5a911ba64df27458ed8229da804a26","examples/zlibdecoder-bufread.rs":"b0d5646607d29a3b6d1add6ce002fab781a55463e9bb749ffff22492e2be0618","examples/zlibdecoder-read.rs":"5f5497f7534750229c182a90e17f2522f46ded904ebf942169fcc86fc2503abd","examples/zlibdecoder-write.rs":"755f6beec5d25874611101d6785b4245f405364e21e45f54ff6915d11a563f53","examples/zlibencoder-bufread.rs":"e7ab4059b98c583382a9d8ec21210329dd150c534af864d23e6beed58bd94ac1","examples/zlibencoder-read.rs":"61853ef3c41e94f45eecedbb90964175ce13390e1a5a01c13326af474714e962","examples/zlibencoder-write.rs":"ec2b7bdacc5b517029c1bd7a3ce6fd399a8f760503a98e9d31dea50f69296e0a","src/bufreader.rs":"ebfbaf104b292a64e8b46076c1bbb680c2941753c02928e85cb5215897891d4a","src/crc.rs":"fc9147392c4b87255950e9bb65e75f1ddebe3d45bfc985980a3937e80f345aab","src/deflate/bufread.rs":"9bbf8b1111f112db2a6bed9b797b2acf055611f605294be29010b8fb7cb67ada","src/deflate/mod.rs":"1f8280ea4ab35c91f886b0373eacbc89da89d53876d4473aa4ab32a07dd098aa","src/deflate/read.rs":"88c2ac0e393fbd8604639b4730f377eeb8797366dd729d52e14236c964af2b02","src/deflate/write.rs":"db6a4782fb4d46fbc87344e59fe8b4155522a76f8ea9d9bdea8bb1398b639b49","src/ffi.rs":"0cab9ad8d3c0c2558cc2b3e9d0faa9c7fc94a0518896fb1a130e573f72aad05e","src/gz/bufread.rs":"b9f038d1ace807e97c4408ea0d1e5bc615697b7fc87fe4dc4183d99b6270b9c2","src/gz/mod.rs":"8a59e00a571f59bab43722000de3b128d443ff869c25e8d7a7f0eaa180055be9","src/gz/read.rs":"4e0c3560de39d7481484f4df6a6f012979421e257eebce247dab5f54a49407e7","src/gz/write.rs":"f5558769630a7f8d8d61a29f8625570ee50fa898b1aa3f3b7d24fcf50ecb2736","src/lib.rs":"aca4a46ac726cce6c67bf06719722b96006faf5330a8596099a9135fa54cfde9","src/mem.rs":"d8bf64e13e0a0bce49d4e3ee2522283f2d4541e2049aa928774d964398358ea6","src/zio.rs":"1076ceab3cee8a455ef8d199f66c0d0f19b1ae512421a776aaa50c9f6bacace5","src/zlib/bufread.rs":"464083100ca54e20643c7acfb6cd6ea96c928dca42667593997aa29d9d0de823","src/zlib/mod.rs":"6c959d5f7ba78ce42a2337327e1f730b0c529b853a13fbd8a59e9ba150763fa2","src/zlib/read.rs":"e963274f6013cb81b52510e7074f5c6554954a44b0391491cb831fff8c190290","src/zlib/write.rs":"0ce320af2aad71fe7ac91ba258ca348641dd7627bb51756dfb30e2e9ca9d9ad8","tests/corrupt-file.gz":"083dd284aa1621916a2d0f66ea048c8d3ba7a722b22d0d618722633f51e7d39c","tests/early-flush.rs":"6ff08e3e16722a61d141fc503a438bbb84c5beb3bdd28bbac9dfa03d3562cc3d","tests/good-file.gz":"87296963e53024a74752179ce7e54087565d358a85d3e65c3b37ef36eaa3d4a6","tests/good-file.txt":"bc4e03658a441fe2ad2df7cd2197144b87e41696f01e327b380e869cd9b485a0","tests/gunzip.rs":"3d2e0a80756474dc2b08f20071685117083765c4f1763456c676f1feeaff35e9","tests/multi.gz":"efa3341da052f95056314cc6920e02a3da15bdef30234b2552fb407812db5cc6","tests/multi.txt":"dbea9325179efe46ea2add94f7b6b745ca983fabb208dc6d34aa064623d7ee23","tests/tokio.rs":"d19defd6c369877f406ed8bd74683a257fde7de51f4161004cea4260faf4464d","tests/zero-write.rs":"027330824a7141963657efa26d99d7503a16492ed8779d7e316e22bba0e7f190"},"package":"e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"3a1869337e8341e30dc40221d23bd832185a87bd7d81849ca10dcf0ceea7d84c","Cargo.toml":"7024cb49649732a718af25d83cf4734dc376455f86c81f8c77bb3232683b74cf","Cargo.toml.orig":"94205a9f3dd605ef6a211c9f8a75671582aee8b89daab345abba48136d88f203","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"6bd103720c4870cb162e21819a319322ef7da8aab4a1ea62594135d45f8ed466","appveyor.yml":"7293e690b6b1fb75cbab1f72ffc5077dd145c806282969b595cc1a82ce1a2e62","examples/deflatedecoder-bufread.rs":"897f245252460b7611696afb51174d829be77a3ff54faddb6e9f8f505a8041df","examples/deflatedecoder-read.rs":"751070ee3bbbbb50ccee19d8d3b5a0126f17901d2056026ccb9ff285147ba86f","examples/deflatedecoder-write.rs":"4a3663de0af773509a57ec5a95288a6461530f2ac75f7afddf82fa5f9a8bdb5f","examples/deflateencoder-bufread.rs":"c9a798336ed81c104fc01c3620380bb3369af90a710a89b19c2402f25c25d375","examples/deflateencoder-read.rs":"e2714d74aae10e28b99e47f31a0ff59c41879e9dd7c07d0a71cf254591a13d28","examples/deflateencoder-write.rs":"c15264846926339ad025f1bd385dcb9131f5503e6a558aa0443c989d63dc0b66","examples/gzbuilder.rs":"56c779c33a088dc4e9d5e77d7093ee49fda8210d722d0dd7f9681b0bdcbd0a0c","examples/gzdecoder-bufread.rs":"f3220e9f07d067a80667ec8caa2977588f867b5ee84eb2e3057969ed2b8421d2","examples/gzdecoder-read.rs":"5dccd8c2d5454a60b39f13fde234c499fbc51cf039e638451480ab16d13dffe3","examples/gzencoder-bufread.rs":"ad79e9f8630359ed21b74a1431d49fdb08c0673df7b21e98d0cad05b29357460","examples/gzencoder-read.rs":"5f4a5cb995254d0f5c4558142b1a55f8cddabb5f0411a1527bf33b80fa09dbb8","examples/gzencoder-write.rs":"40eccdce2be8b2c794e26989d72444bb8c05fae7c752c676dff8ac0c4fe7e433","examples/gzmultidecoder-bufread.rs":"68a3db0a2a032a02be1101261accdc5488f1a9e20691a531675460ec42a51d3a","examples/gzmultidecoder-read.rs":"ca85e260dc558b848aa9cad2111e8493b4aa30df23d9be9ca1314e606758b892","examples/hello_world.txt":"d2a84f4b8b650937ec8f73cd8be2c74add5a911ba64df27458ed8229da804a26","examples/zlibdecoder-bufread.rs":"373956fb2890a5757597740ca37e854d3a10fc58bdf37efe4ae810ec72d94920","examples/zlibdecoder-read.rs":"ead477d8e687c1fe343da895ad5d6897e8ba316072691dccaf4aeed8bb83ee9b","examples/zlibdecoder-write.rs":"b80f3ec163a2227166bdfefd61ab232942967f34841ebb6a63b31ce37feecb8a","examples/zlibencoder-bufread.rs":"667d3bdc83878e97d4faae6c820693339799989db1031e976dc52d7bc1e119ce","examples/zlibencoder-read.rs":"89767e7bb3aa786d813a6c31d1770aadc966eecc0d80f4e5263f82198c8baa21","examples/zlibencoder-write.rs":"05fd187dba9b2a67db8c97e3550050b08cf65c46e0b425529c1982c6c35922c6","src/bufreader.rs":"ebfbaf104b292a64e8b46076c1bbb680c2941753c02928e85cb5215897891d4a","src/crc.rs":"308fd636ccc2e304e90713a775aedf012205823aa2b956d36eaa9a64ce4d881d","src/deflate/bufread.rs":"a01791da80ff6552a0dba9cebac5c2dd071eed732468f2dc87d723ca26207815","src/deflate/mod.rs":"76e9b0081be3771853650e592e48d87e005a92f7f78eb67f5ecf6dd7890437d3","src/deflate/read.rs":"9a65e8452c8b5f8055121659f080ff4760d789a4cf58e722390ae2bef3bd14f1","src/deflate/write.rs":"9f99ae1160516481087a4b47457814bd4c60dcf7373fc25ed882b0055da7ef2f","src/ffi.rs":"10babc755e572f35f811fdbf6988dad890a8f0ef8bcb04e238ae0a19ea5c73fa","src/gz/bufread.rs":"8e23ba1d4b5b56c299d04f3fad4687af2dde046c0945388bb7ef65de84f03c79","src/gz/mod.rs":"27d46e013fce8f229f90394a1d5bd3f984c1bce424329ed4dfc38fa471587000","src/gz/read.rs":"a85bf61cc17804a7f0e611e565edc75d04f1c548a716c065e0eeb78a93018e57","src/gz/write.rs":"649bf7e3e6cfe47702b75490d8250f3558558e9648b4189db1ac69a32929b3a2","src/lib.rs":"a37282ec3b70bfeae346fe66f6225a2b7ba2e1c47f71d4b990dd918898e73b88","src/mem.rs":"8990d45d9a66be9dc5bc0aa1d9e7c71d846e2d1515bced6347c4d3c0c7bc5b1b","src/zio.rs":"14b62753f4ce593f7e4e9e4dcf40d66e03dba7e592f5411f381196ebb7be6456","src/zlib/bufread.rs":"6ffadc4f80b7c83218b9c0ddbe6493c1ce8e31f7ae0b7a1c2d6b63185b4f6ea4","src/zlib/mod.rs":"e48bd4c4b21339bfc1078fd3db54a6b7151fe02068c2fe5166b941874cf1ee26","src/zlib/read.rs":"bd293915d7c66a61c2286030c3bdf88100958af571fc587916ce477005d9ba7c","src/zlib/write.rs":"177f0650e299a7942ee60d63ba032039fe0cf410416ac9772283bbfe5c59b5f4","tests/corrupt-file.gz":"083dd284aa1621916a2d0f66ea048c8d3ba7a722b22d0d618722633f51e7d39c","tests/early-flush.rs":"29b73a15f6cdb6834ace208590caff1cbc38ebac56193f11caa719caca411491","tests/good-file.gz":"87296963e53024a74752179ce7e54087565d358a85d3e65c3b37ef36eaa3d4a6","tests/good-file.txt":"bc4e03658a441fe2ad2df7cd2197144b87e41696f01e327b380e869cd9b485a0","tests/gunzip.rs":"63d36eb0bbaad0906d12c223202590fb28a56565088567cf5b1c474acb48b538","tests/multi.gz":"efa3341da052f95056314cc6920e02a3da15bdef30234b2552fb407812db5cc6","tests/multi.txt":"dbea9325179efe46ea2add94f7b6b745ca983fabb208dc6d34aa064623d7ee23","tests/tokio.rs":"5fb574754bded91009e71bd64e7adf391f4328343aab3246657e2b09c381212b","tests/zero-write.rs":"ff8d0349a540b54363c55807c5fd7fbbdc363d08a536d35a3a40f0ce92c16489"},"package":"9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909"} \ No newline at end of file diff --git a/src/vendor/flate2/.travis.yml b/src/vendor/flate2/.travis.yml index eb722100d5..76257cc38a 100644 --- a/src/vendor/flate2/.travis.yml +++ b/src/vendor/flate2/.travis.yml @@ -1,11 +1,22 @@ language: rust -rust: - - stable - - beta - - nightly sudo: false -before_script: - - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH + +matrix: + include: + - rust: 1.21.0 + - rust: stable + - os: osx + - rust: beta + - rust: nightly + + - rust: nightly + before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH + script: + - cargo doc --no-deps --all-features + after_success: + - travis-cargo --only nightly doc-upload + script: - export CARGO_TARGET_DIR=`pwd`/target - cargo build --verbose @@ -15,11 +26,12 @@ script: - cargo test --verbose --features tokio - cargo test --verbose --features 'tokio zlib' - cargo test --verbose --features zlib --no-default-features + - cargo test --verbose --features rust_backend + - cargo test --verbose --features rust_backend --no-default-features - cargo clean && cargo build - cargo doc --no-deps - cargo doc --no-deps --manifest-path=miniz-sys/Cargo.toml -after_success: - - travis-cargo --only nightly doc-upload + env: global: secure: "PHVT7IaeP5nQQVwGHKwqCYBDp0QyetSlER7se2j2Xgfx+lw3Bu6VWH6VF04B636Gb0tHPN/sUCXSgGRcvDuy6XFOev4LfynoYxNKgHJYg2E34EP2QLwsFfnvE4iujaG3GJk3o935Y7OYGv2OP1HeG4Mv6JhQK0GLnNDBZQ65kWI=" @@ -27,6 +39,3 @@ env: notifications: email: on_success: never -os: - - linux - - osx diff --git a/src/vendor/flate2/Cargo.toml b/src/vendor/flate2/Cargo.toml index d1d100bb67..73a478243c 100644 --- a/src/vendor/flate2/Cargo.toml +++ b/src/vendor/flate2/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "flate2" -version = "0.2.20" +version = "1.0.1" authors = ["Alex Crichton <alex@alexcrichton.com>"] description = "Bindings to miniz.c for DEFLATE compression and decompression exposed as\nReader/Writer streams. Contains bindings for zlib, deflate, and gzip-based\nstreams.\n" homepage = "https://github.com/alexcrichton/flate2-rs" @@ -22,6 +22,10 @@ keywords = ["gzip", "flate", "zlib", "encoding"] categories = ["compression", "api-bindings"] license = "MIT/Apache-2.0" repository = "https://github.com/alexcrichton/flate2-rs" +[dependencies.futures] +version = "0.1" +optional = true + [dependencies.libc] version = "0.2" @@ -33,29 +37,30 @@ optional = true version = "0.1.7" optional = true -[dependencies.futures] +[dependencies.miniz_oxide_c_api] version = "0.1" optional = true [dependencies.tokio-io] version = "0.1" optional = true -[dev-dependencies.rand] -version = "0.3" - [dev-dependencies.quickcheck] version = "0.4" default-features = false +[dev-dependencies.rand] +version = "0.3" + [dev-dependencies.tokio-core] version = "0.1" [features] default = ["miniz-sys"] -zlib = ["libz-sys"] +rust_backend = ["miniz_oxide_c_api"] tokio = ["tokio-io", "futures"] -[badges.travis-ci] -repository = "alexcrichton/flate2-rs" - +zlib = ["libz-sys"] [badges.appveyor] repository = "alexcrichton/flate2-rs" + +[badges.travis-ci] +repository = "alexcrichton/flate2-rs" diff --git a/src/vendor/flate2/Cargo.toml.orig b/src/vendor/flate2/Cargo.toml.orig index 48731b468c..6d669ed5b4 100644 --- a/src/vendor/flate2/Cargo.toml.orig +++ b/src/vendor/flate2/Cargo.toml.orig @@ -2,7 +2,7 @@ name = "flate2" authors = ["Alex Crichton <alex@alexcrichton.com>"] -version = "0.2.20" +version = "1.0.1" license = "MIT/Apache-2.0" readme = "README.md" keywords = ["gzip", "flate", "zlib", "encoding"] @@ -24,6 +24,7 @@ miniz-sys = { path = "miniz-sys", version = "0.1.7", optional = true } libz-sys = { version = "1.0", optional = true } tokio-io = { version = "0.1", optional = true } futures = { version = "0.1", optional = true } +miniz_oxide_c_api = { version = "0.1", optional = true} [dev-dependencies] rand = "0.3" @@ -33,6 +34,7 @@ tokio-core = "0.1" [features] default = ["miniz-sys"] zlib = ["libz-sys"] +rust_backend = ["miniz_oxide_c_api"] tokio = ["tokio-io", "futures"] [badges] diff --git a/src/vendor/flate2/README.md b/src/vendor/flate2/README.md index c8937912f6..42c43f3fab 100644 --- a/src/vendor/flate2/README.md +++ b/src/vendor/flate2/README.md @@ -6,9 +6,13 @@ [![Documentation](https://docs.rs/flate2/badge.svg)](https://docs.rs/flate2) A streaming compression/decompression library for Rust. The underlying -implementation by default uses [`miniz`](https://code.google.com/p/miniz/) but +implementation by default uses [`miniz`](https://github.com/richgel999/miniz) but can optionally be configured to use the system zlib, if available. +There is also an experimental rust backend that uses the +[`miniz_oxide`](https://crates.io/crates/miniz_oxide) crate. This avoids the need +to build C code, but hasn't gone through as much testing as the other backends. + Supported formats: * deflate @@ -28,6 +32,13 @@ Using zlib instead of miniz: flate2 = { version = "0.2", features = ["zlib"], default-features = false } ``` +Using the rust back-end: + +```toml +[dependencies] +flate2 = { version = "0.2", features = ["rust_backend"], default-features = false } +``` + ## Compression ```rust @@ -38,7 +49,7 @@ use flate2::Compression; use flate2::write::ZlibEncoder; fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); + let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); e.write(b"foo"); e.write(b"bar"); let compressed_bytes = e.finish(); @@ -54,7 +65,7 @@ use std::io::prelude::*; use flate2::read::GzDecoder; fn main() { - let mut d = GzDecoder::new("...".as_bytes()).unwrap(); + let mut d = GzDecoder::new("...".as_bytes()); let mut s = String::new(); d.read_to_string(&mut s).unwrap(); println!("{}", s); @@ -63,8 +74,17 @@ fn main() { # License -`flate2-rs` is primarily distributed under the terms of both the MIT license and -the Apache License (Version 2.0), with portions covered by various BSD-like -licenses. +This project is licensed under either of -See LICENSE-APACHE, and LICENSE-MIT for details. + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or + http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this project by you, as defined in the Apache-2.0 license, +shall be dual licensed as above, without any additional terms or conditions. diff --git a/src/vendor/flate2/examples/deflatedecoder-bufread.rs b/src/vendor/flate2/examples/deflatedecoder-bufread.rs index 117297feba..22e313d6d8 100644 --- a/src/vendor/flate2/examples/deflatedecoder-bufread.rs +++ b/src/vendor/flate2/examples/deflatedecoder-bufread.rs @@ -8,7 +8,7 @@ use flate2::bufread::DeflateDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); + let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/examples/deflatedecoder-read.rs b/src/vendor/flate2/examples/deflatedecoder-read.rs index 2d26857802..8515c0928b 100644 --- a/src/vendor/flate2/examples/deflatedecoder-read.rs +++ b/src/vendor/flate2/examples/deflatedecoder-read.rs @@ -8,7 +8,7 @@ use flate2::read::DeflateDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); + let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/examples/deflatedecoder-write.rs b/src/vendor/flate2/examples/deflatedecoder-write.rs index 46791e623b..4c1f5d4d0b 100644 --- a/src/vendor/flate2/examples/deflatedecoder-write.rs +++ b/src/vendor/flate2/examples/deflatedecoder-write.rs @@ -8,7 +8,7 @@ use flate2::write::DeflateDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); + let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/examples/deflateencoder-bufread.rs b/src/vendor/flate2/examples/deflateencoder-bufread.rs index 4ec2ed1c72..abdebbb074 100644 --- a/src/vendor/flate2/examples/deflateencoder-bufread.rs +++ b/src/vendor/flate2/examples/deflateencoder-bufread.rs @@ -17,7 +17,7 @@ fn main() { fn open_hello_world() -> io::Result<Vec<u8>> { let f = File::open("examples/hello_world.txt")?; let b = BufReader::new(f); - let mut deflater = DeflateEncoder::new(b, Compression::Fast); + let mut deflater = DeflateEncoder::new(b, Compression::fast()); let mut buffer = Vec::new(); deflater.read_to_end(&mut buffer)?; Ok(buffer) diff --git a/src/vendor/flate2/examples/deflateencoder-read.rs b/src/vendor/flate2/examples/deflateencoder-read.rs index bf1bcc6a66..c2ea1450d3 100644 --- a/src/vendor/flate2/examples/deflateencoder-read.rs +++ b/src/vendor/flate2/examples/deflateencoder-read.rs @@ -14,7 +14,7 @@ fn main() { fn deflateencoder_read_hello_world() -> io::Result<Vec<u8>> { let mut ret_vec = [0;100]; let c = b"hello world"; - let mut deflater = DeflateEncoder::new(&c[..], Compression::Fast); + let mut deflater = DeflateEncoder::new(&c[..], Compression::fast()); let count = deflater.read(&mut ret_vec)?; Ok(ret_vec[0..count].to_vec()) } diff --git a/src/vendor/flate2/examples/deflateencoder-write.rs b/src/vendor/flate2/examples/deflateencoder-write.rs index f511aec4b9..f21af5b992 100644 --- a/src/vendor/flate2/examples/deflateencoder-write.rs +++ b/src/vendor/flate2/examples/deflateencoder-write.rs @@ -6,7 +6,7 @@ use flate2::write::DeflateEncoder; // Vec<u8> implements Write to print the compressed bytes of sample string fn main() { - let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); + let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); println!("{:?}", e.finish().unwrap()); } diff --git a/src/vendor/flate2/examples/flatereadext.rs b/src/vendor/flate2/examples/flatereadext.rs deleted file mode 100644 index a3a9b04449..0000000000 --- a/src/vendor/flate2/examples/flatereadext.rs +++ /dev/null @@ -1,22 +0,0 @@ -extern crate flate2; - -use flate2::{FlateReadExt, Compression}; -use std::io::prelude::*; -use std::io; -use std::fs::File; - -fn main() { - println!("{}", run().unwrap()); -} - -fn run() -> io::Result<String> { - let f = File::open("examples/hello_world.txt")?; - - //gz_encode method comes from FlateReadExt and applies to a std::fs::File - let data = f.gz_encode(Compression::Default); - let mut buffer = String::new(); - - //gz_decode method comes from FlateReadExt and applies to a &[u8] - &data.gz_decode()?.read_to_string(&mut buffer)?; - Ok(buffer) -} diff --git a/src/vendor/flate2/examples/gzbuilder.rs b/src/vendor/flate2/examples/gzbuilder.rs index a61a03f4f1..dc8f74f3b8 100644 --- a/src/vendor/flate2/examples/gzbuilder.rs +++ b/src/vendor/flate2/examples/gzbuilder.rs @@ -17,7 +17,7 @@ fn sample_builder() -> Result<(), io::Error> { let mut gz = GzBuilder::new() .filename("hello_world.txt") .comment("test file, please delete") - .write(f, Compression::Default); + .write(f, Compression::default()); gz.write(b"hello world")?; gz.finish()?; Ok(()) diff --git a/src/vendor/flate2/examples/gzdecoder-bufread.rs b/src/vendor/flate2/examples/gzdecoder-bufread.rs index 77f3251948..0ec6ff8eac 100644 --- a/src/vendor/flate2/examples/gzdecoder-bufread.rs +++ b/src/vendor/flate2/examples/gzdecoder-bufread.rs @@ -8,7 +8,7 @@ use flate2::bufread::GzDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::Default); + let mut e = GzEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); @@ -17,7 +17,7 @@ fn main() { // Uncompresses a Gz Encoded vector of bytes and returns a string or error // Here &[u8] implements BufRead fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = GzDecoder::new(&bytes[..])?; + let mut gz = GzDecoder::new(&bytes[..]); let mut s = String::new(); gz.read_to_string(&mut s)?; Ok(s) diff --git a/src/vendor/flate2/examples/gzdecoder-read.rs b/src/vendor/flate2/examples/gzdecoder-read.rs index 843d7bd6ad..333d534902 100644 --- a/src/vendor/flate2/examples/gzdecoder-read.rs +++ b/src/vendor/flate2/examples/gzdecoder-read.rs @@ -8,7 +8,7 @@ use flate2::read::GzDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::Default); + let mut e = GzEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); @@ -17,7 +17,7 @@ fn main() { // Uncompresses a Gz Encoded vector of bytes and returns a string or error // Here &[u8] implements Read fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = GzDecoder::new(&bytes[..])?; + let mut gz = GzDecoder::new(&bytes[..]); let mut s = String::new(); gz.read_to_string(&mut s)?; Ok(s) diff --git a/src/vendor/flate2/examples/gzencoder-bufread.rs b/src/vendor/flate2/examples/gzencoder-bufread.rs index 8b320d8137..3d57cd1d5f 100644 --- a/src/vendor/flate2/examples/gzencoder-bufread.rs +++ b/src/vendor/flate2/examples/gzencoder-bufread.rs @@ -17,7 +17,7 @@ fn main() { fn open_hello_world() -> io::Result<Vec<u8>> { let f = File::open("examples/hello_world.txt")?; let b = BufReader::new(f); - let mut gz = GzEncoder::new(b, Compression::Fast); + let mut gz = GzEncoder::new(b, Compression::fast()); let mut buffer = Vec::new(); gz.read_to_end(&mut buffer)?; Ok(buffer) diff --git a/src/vendor/flate2/examples/gzencoder-read.rs b/src/vendor/flate2/examples/gzencoder-read.rs index 65dd26bc49..ab0e596be8 100644 --- a/src/vendor/flate2/examples/gzencoder-read.rs +++ b/src/vendor/flate2/examples/gzencoder-read.rs @@ -14,7 +14,7 @@ fn main() { fn gzencoder_read_hello_world() -> io::Result<Vec<u8>> { let mut ret_vec = [0;100]; let c = b"hello world"; - let mut z = GzEncoder::new(&c[..], Compression::Fast); + let mut z = GzEncoder::new(&c[..], Compression::fast()); let count = z.read(&mut ret_vec)?; Ok(ret_vec[0..count].to_vec()) } diff --git a/src/vendor/flate2/examples/gzencoder-write.rs b/src/vendor/flate2/examples/gzencoder-write.rs index b423b52414..5cc1d5d1cf 100644 --- a/src/vendor/flate2/examples/gzencoder-write.rs +++ b/src/vendor/flate2/examples/gzencoder-write.rs @@ -6,7 +6,7 @@ use flate2::write::GzEncoder; // Vec<u8> implements Write to print the compressed bytes of sample string fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::Default); + let mut e = GzEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); println!("{:?}", e.finish().unwrap()); } diff --git a/src/vendor/flate2/examples/gzmultidecoder-bufread.rs b/src/vendor/flate2/examples/gzmultidecoder-bufread.rs index d5db3673e4..0768d2fea3 100644 --- a/src/vendor/flate2/examples/gzmultidecoder-bufread.rs +++ b/src/vendor/flate2/examples/gzmultidecoder-bufread.rs @@ -8,7 +8,7 @@ use flate2::bufread::MultiGzDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::Default); + let mut e = GzEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); @@ -17,7 +17,7 @@ fn main() { // Uncompresses a Gz Encoded vector of bytes and returns a string or error // Here &[u8] implements BufRead fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = MultiGzDecoder::new(&bytes[..])?; + let mut gz = MultiGzDecoder::new(&bytes[..]); let mut s = String::new(); gz.read_to_string(&mut s)?; Ok(s) diff --git a/src/vendor/flate2/examples/gzmultidecoder-read.rs b/src/vendor/flate2/examples/gzmultidecoder-read.rs index 9263292c92..93bda8447a 100644 --- a/src/vendor/flate2/examples/gzmultidecoder-read.rs +++ b/src/vendor/flate2/examples/gzmultidecoder-read.rs @@ -8,7 +8,7 @@ use flate2::read::MultiGzDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = GzEncoder::new(Vec::new(), Compression::Default); + let mut e = GzEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); @@ -17,7 +17,7 @@ fn main() { // Uncompresses a Gz Encoded vector of bytes and returns a string or error // Here &[u8] implements Read fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { - let mut gz = MultiGzDecoder::new(&bytes[..])?; + let mut gz = MultiGzDecoder::new(&bytes[..]); let mut s = String::new(); gz.read_to_string(&mut s)?; Ok(s) diff --git a/src/vendor/flate2/examples/zlibdecoder-bufread.rs b/src/vendor/flate2/examples/zlibdecoder-bufread.rs index 7216f801e8..8a1a603bff 100644 --- a/src/vendor/flate2/examples/zlibdecoder-bufread.rs +++ b/src/vendor/flate2/examples/zlibdecoder-bufread.rs @@ -8,7 +8,7 @@ use flate2::bufread::ZlibDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); + let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_bufreader(bytes).unwrap()); diff --git a/src/vendor/flate2/examples/zlibdecoder-read.rs b/src/vendor/flate2/examples/zlibdecoder-read.rs index ab82413fbd..2b5dc8b213 100644 --- a/src/vendor/flate2/examples/zlibdecoder-read.rs +++ b/src/vendor/flate2/examples/zlibdecoder-read.rs @@ -8,7 +8,7 @@ use flate2::read::ZlibDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); + let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/examples/zlibdecoder-write.rs b/src/vendor/flate2/examples/zlibdecoder-write.rs index c70ded3c1c..fad136a1b1 100644 --- a/src/vendor/flate2/examples/zlibdecoder-write.rs +++ b/src/vendor/flate2/examples/zlibdecoder-write.rs @@ -8,7 +8,7 @@ use flate2::write::ZlibDecoder; // Compress a sample string and print it after transformation. fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); + let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); let bytes = e.finish().unwrap(); println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/examples/zlibencoder-bufread.rs b/src/vendor/flate2/examples/zlibencoder-bufread.rs index 39d93611ac..8b8d3d084b 100644 --- a/src/vendor/flate2/examples/zlibencoder-bufread.rs +++ b/src/vendor/flate2/examples/zlibencoder-bufread.rs @@ -17,7 +17,7 @@ fn main() { fn open_hello_world() -> io::Result<Vec<u8>> { let f = File::open("examples/hello_world.txt")?; let b = BufReader::new(f); - let mut z = ZlibEncoder::new(b, Compression::Fast); + let mut z = ZlibEncoder::new(b, Compression::fast()); let mut buffer = Vec::new(); z.read_to_end(&mut buffer)?; Ok(buffer) diff --git a/src/vendor/flate2/examples/zlibencoder-read.rs b/src/vendor/flate2/examples/zlibencoder-read.rs index 3aef92ca49..6223391868 100644 --- a/src/vendor/flate2/examples/zlibencoder-read.rs +++ b/src/vendor/flate2/examples/zlibencoder-read.rs @@ -14,7 +14,7 @@ fn main() { // File implements Read fn open_hello_world() -> std::io::Result<Vec<u8>> { let f = File::open("examples/hello_world.txt")?; - let mut z = ZlibEncoder::new(f, Compression::Fast); + let mut z = ZlibEncoder::new(f, Compression::fast()); let mut buffer = [0;50]; let byte_count = z.read(&mut buffer)?; Ok(buffer[0..byte_count].to_vec()) diff --git a/src/vendor/flate2/examples/zlibencoder-write.rs b/src/vendor/flate2/examples/zlibencoder-write.rs index 9152b30eab..127bbc64f1 100644 --- a/src/vendor/flate2/examples/zlibencoder-write.rs +++ b/src/vendor/flate2/examples/zlibencoder-write.rs @@ -6,7 +6,7 @@ use flate2::write::ZlibEncoder; // Vec<u8> implements Write to print the compressed bytes of sample string fn main() { - let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); + let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); e.write(b"Hello World").unwrap(); println!("{:?}", e.finish().unwrap()); } diff --git a/src/vendor/flate2/src/crc.rs b/src/vendor/flate2/src/crc.rs index c6e93ac1f2..a7f8c69437 100644 --- a/src/vendor/flate2/src/crc.rs +++ b/src/vendor/flate2/src/crc.rs @@ -36,7 +36,7 @@ impl Crc { } /// The number of bytes that have been used to calculate the CRC. - /// This value is only accurate if the amount is lower than 2^32. + /// This value is only accurate if the amount is lower than 2<sup>32</sup>. pub fn amount(&self) -> u32 { self.amt } diff --git a/src/vendor/flate2/src/deflate/bufread.rs b/src/vendor/flate2/src/deflate/bufread.rs index 9a9a47ec61..b616ab3fdc 100644 --- a/src/vendor/flate2/src/deflate/bufread.rs +++ b/src/vendor/flate2/src/deflate/bufread.rs @@ -35,7 +35,7 @@ use {Compress, Decompress}; /// fn open_hello_world() -> io::Result<Vec<u8>> { /// let f = File::open("examples/hello_world.txt")?; /// let b = BufReader::new(f); -/// let mut deflater = DeflateEncoder::new(b, Compression::Fast); +/// let mut deflater = DeflateEncoder::new(b, Compression::fast()); /// let mut buffer = Vec::new(); /// deflater.read_to_end(&mut buffer)?; /// Ok(buffer) @@ -154,7 +154,7 @@ impl<R: AsyncWrite + BufRead> AsyncWrite for DeflateEncoder<R> { /// use flate2::bufread::DeflateDecoder; /// /// # fn main() { -/// # let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/src/deflate/mod.rs b/src/vendor/flate2/src/deflate/mod.rs index 7bacfa7c8a..c3a83963c9 100644 --- a/src/vendor/flate2/src/deflate/mod.rs +++ b/src/vendor/flate2/src/deflate/mod.rs @@ -9,12 +9,12 @@ mod tests { use rand::{thread_rng, Rng}; use super::{read, write}; - use Compression::Default; + use Compression; #[test] fn roundtrip() { let mut real = Vec::new(); - let mut w = write::DeflateEncoder::new(Vec::new(), Default); + let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default()); let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>(); for _ in 0..200 { let to_write = &v[..thread_rng().gen_range(0, v.len())]; @@ -31,7 +31,7 @@ mod tests { #[test] fn drop_writes() { let mut data = Vec::new(); - write::DeflateEncoder::new(&mut data, Default) + write::DeflateEncoder::new(&mut data, Compression::default()) .write_all(b"foo") .unwrap(); let mut r = read::DeflateDecoder::new(&data[..]); @@ -43,7 +43,7 @@ mod tests { #[test] fn total_in() { let mut real = Vec::new(); - let mut w = write::DeflateEncoder::new(Vec::new(), Default); + let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default()); let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>(); for _ in 0..200 { let to_write = &v[..thread_rng().gen_range(0, v.len())]; @@ -71,7 +71,7 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut r = read::DeflateDecoder::new(read::DeflateEncoder::new(&v[..], Default)); + let mut r = read::DeflateDecoder::new(read::DeflateEncoder::new(&v[..], Compression::default())); let mut ret = Vec::new(); r.read_to_end(&mut ret).unwrap(); assert_eq!(ret, v); @@ -83,7 +83,7 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut w = write::DeflateEncoder::new(write::DeflateDecoder::new(Vec::new()), Default); + let mut w = write::DeflateEncoder::new(write::DeflateDecoder::new(Vec::new()), Compression::default()); w.write_all(&v).unwrap(); let w = w.finish().unwrap().finish().unwrap(); assert!(w == v); @@ -95,13 +95,13 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut w = write::DeflateEncoder::new(Vec::new(), Default); + let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default()); w.write_all(&v).unwrap(); let a = w.reset(Vec::new()).unwrap(); w.write_all(&v).unwrap(); let b = w.finish().unwrap(); - let mut w = write::DeflateEncoder::new(Vec::new(), Default); + let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default()); w.write_all(&v).unwrap(); let c = w.finish().unwrap(); assert!(a == b && b == c); @@ -114,12 +114,12 @@ mod tests { .take(1024 * 1024) .collect::<Vec<_>>(); let (mut a, mut b, mut c) = (Vec::new(), Vec::new(), Vec::new()); - let mut r = read::DeflateEncoder::new(&v[..], Default); + let mut r = read::DeflateEncoder::new(&v[..], Compression::default()); r.read_to_end(&mut a).unwrap(); r.reset(&v[..]); r.read_to_end(&mut b).unwrap(); - let mut r = read::DeflateEncoder::new(&v[..], Default); + let mut r = read::DeflateEncoder::new(&v[..], Compression::default()); r.read_to_end(&mut c).unwrap(); assert!(a == b && b == c); } @@ -130,7 +130,7 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut w = write::DeflateEncoder::new(Vec::new(), Default); + let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default()); w.write_all(&v).unwrap(); let data = w.finish().unwrap(); @@ -163,7 +163,7 @@ mod tests { #[test] fn zero_length_read_with_data() { let m = vec![3u8; 128 * 1024 + 1]; - let mut c = read::DeflateEncoder::new(&m[..], ::Compression::Default); + let mut c = read::DeflateEncoder::new(&m[..], Compression::default()); let mut result = Vec::new(); c.read_to_end(&mut result).unwrap(); @@ -178,7 +178,7 @@ mod tests { ::quickcheck::quickcheck(test as fn(_) -> _); fn test(v: Vec<u8>) -> bool { - let mut r = read::DeflateDecoder::new(read::DeflateEncoder::new(&v[..], Default)); + let mut r = read::DeflateDecoder::new(read::DeflateEncoder::new(&v[..], Compression::default())); let mut v2 = Vec::new(); r.read_to_end(&mut v2).unwrap(); v == v2 @@ -190,7 +190,7 @@ mod tests { ::quickcheck::quickcheck(test as fn(_) -> _); fn test(v: Vec<u8>) -> bool { - let mut w = write::DeflateEncoder::new(write::DeflateDecoder::new(Vec::new()), Default); + let mut w = write::DeflateEncoder::new(write::DeflateDecoder::new(Vec::new()), Compression::default()); w.write_all(&v).unwrap(); v == w.finish().unwrap().finish().unwrap() } diff --git a/src/vendor/flate2/src/deflate/read.rs b/src/vendor/flate2/src/deflate/read.rs index e2363c9ccc..3b1ef409c3 100644 --- a/src/vendor/flate2/src/deflate/read.rs +++ b/src/vendor/flate2/src/deflate/read.rs @@ -32,7 +32,7 @@ use super::bufread; /// fn deflateencoder_read_hello_world() -> io::Result<Vec<u8>> { /// let mut ret_vec = [0;100]; /// let c = b"hello world"; -/// let mut deflater = DeflateEncoder::new(&c[..], Compression::Fast); +/// let mut deflater = DeflateEncoder::new(&c[..], Compression::fast()); /// let count = deflater.read(&mut ret_vec)?; /// Ok(ret_vec[0..count].to_vec()) /// } @@ -150,7 +150,7 @@ impl<R: AsyncRead + AsyncWrite> AsyncWrite for DeflateEncoder<R> { /// use flate2::read::DeflateDecoder; /// /// # fn main() { -/// # let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/src/deflate/write.rs b/src/vendor/flate2/src/deflate/write.rs index 596450348a..27c02b595b 100644 --- a/src/vendor/flate2/src/deflate/write.rs +++ b/src/vendor/flate2/src/deflate/write.rs @@ -26,7 +26,7 @@ use {Compress, Decompress}; /// // Vec<u8> implements Write to print the compressed bytes of sample string /// # fn main() { /// -/// let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); +/// let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); /// e.write(b"Hello World").unwrap(); /// println!("{:?}", e.finish().unwrap()); /// # } @@ -200,7 +200,7 @@ impl<W: AsyncRead + AsyncWrite> AsyncRead for DeflateEncoder<W> {} /// use flate2::write::DeflateDecoder; /// /// # fn main() { -/// # let mut e = DeflateEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = DeflateEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_writer(bytes).unwrap()); diff --git a/src/vendor/flate2/src/ffi.rs b/src/vendor/flate2/src/ffi.rs index 92a30a6a7e..449c205b18 100644 --- a/src/vendor/flate2/src/ffi.rs +++ b/src/vendor/flate2/src/ffi.rs @@ -98,14 +98,43 @@ mod imp { } } -#[cfg(not(feature = "zlib"))] +#[cfg(all(not(feature = "zlib"), feature = "rust_backend"))] +mod imp { + extern crate miniz_oxide_c_api; + use std::ops::{Deref, DerefMut}; + + pub use ffi::crc_imp::*; + pub use self::miniz_oxide_c_api::*; + pub use self::miniz_oxide_c_api::lib_oxide::*; + + #[derive(Debug, Default)] + pub struct StreamWrapper { + inner: mz_stream, + } + + impl Deref for StreamWrapper { + type Target = mz_stream; + + fn deref(&self) -> &Self::Target { + &self.inner + } + } + + impl DerefMut for StreamWrapper { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.inner + } + } +} + +#[cfg(all(not(feature = "zlib"), not(feature = "rust_backend")))] mod imp { extern crate miniz_sys; use std::mem; use std::ops::{Deref, DerefMut}; - use libc::{c_ulong, off_t}; pub use self::miniz_sys::*; + pub use ffi::crc_imp::*; pub struct StreamWrapper { inner: mz_stream, @@ -138,7 +167,11 @@ mod imp { &mut self.inner } } +} +#[cfg(not(feature = "zlib"))] +mod crc_imp { + use libc::{c_ulong, off_t}; pub unsafe extern fn mz_crc32_combine(crc1: c_ulong, crc2: c_ulong, len2: off_t) -> c_ulong { diff --git a/src/vendor/flate2/src/gz/bufread.rs b/src/vendor/flate2/src/gz/bufread.rs index 22be33ae35..4cf5151b1f 100644 --- a/src/vendor/flate2/src/gz/bufread.rs +++ b/src/vendor/flate2/src/gz/bufread.rs @@ -3,7 +3,7 @@ use std::io::prelude::*; use std::io; use std::mem; -use super::{Builder, Header}; +use super::{GzBuilder, GzHeader}; use super::{FCOMMENT, FEXTRA, FHCRC, FNAME}; use Compression; use crc::CrcReader; @@ -34,7 +34,7 @@ fn read_le_u16<R: Read>(r: &mut R) -> io::Result<u16> { Ok((b[0] as u16) | ((b[1] as u16) << 8)) } -fn read_gz_header<R: Read>(r: &mut R) -> io::Result<Header> { +fn read_gz_header<R: Read>(r: &mut R) -> io::Result<GzHeader> { let mut crc_reader = CrcReader::new(r); let mut header = [0; 10]; try!(crc_reader.read_exact(&mut header)); @@ -53,7 +53,7 @@ fn read_gz_header<R: Read>(r: &mut R) -> io::Result<Header> { let mtime = ((header[4] as u32) << 0) | ((header[5] as u32) << 8) | ((header[6] as u32) << 16) | ((header[7] as u32) << 24); let _xfl = header[8]; - let _os = header[9]; + let os = header[9]; let extra = if flg & FEXTRA != 0 { let xlen = try!(read_le_u16(&mut crc_reader)); @@ -100,10 +100,11 @@ fn read_gz_header<R: Read>(r: &mut R) -> io::Result<Header> { } } - Ok(Header { + Ok(GzHeader { extra: extra, filename: filename, comment: comment, + operating_system: os, mtime: mtime, }) } @@ -133,7 +134,7 @@ fn read_gz_header<R: Read>(r: &mut R) -> io::Result<Header> { /// fn open_hello_world() -> io::Result<Vec<u8>> { /// let f = File::open("examples/hello_world.txt")?; /// let b = BufReader::new(f); -/// let mut gz = GzEncoder::new(b, Compression::Fast); +/// let mut gz = GzEncoder::new(b, Compression::fast()); /// let mut buffer = Vec::new(); /// gz.read_to_end(&mut buffer)?; /// Ok(buffer) @@ -163,12 +164,12 @@ impl<R: BufRead> GzEncoder<R> { /// Creates a new encoder which will use the given compression level. /// /// The encoder is not configured specially for the emitted header. For - /// header configuration, see the `Builder` type. + /// header configuration, see the `GzBuilder` type. /// /// The data read from the stream `r` will be compressed and available /// through the returned reader. pub fn new(r: R, level: Compression) -> GzEncoder<R> { - Builder::new().buf_read(r, level) + GzBuilder::new().buf_read(r, level) } fn read_footer(&mut self, into: &mut [u8]) -> io::Result<usize> { @@ -262,7 +263,7 @@ impl<R: BufRead + Write> Write for GzEncoder<R> { /// use flate2::bufread::GzDecoder; /// /// # fn main() { -/// # let mut e = GzEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = GzEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); @@ -272,7 +273,7 @@ impl<R: BufRead + Write> Write for GzEncoder<R> { /// // Here &[u8] implements BufRead /// /// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { -/// let mut gz = GzDecoder::new(&bytes[..])?; +/// let mut gz = GzDecoder::new(&bytes[..]); /// let mut s = String::new(); /// gz.read_to_string(&mut s)?; /// Ok(s) @@ -281,7 +282,7 @@ impl<R: BufRead + Write> Write for GzEncoder<R> { #[derive(Debug)] pub struct GzDecoder<R> { inner: CrcReader<deflate::bufread::DeflateDecoder<R>>, - header: Header, + header: io::Result<GzHeader>, finished: bool, } @@ -289,20 +290,15 @@ pub struct GzDecoder<R> { impl<R: BufRead> GzDecoder<R> { /// Creates a new decoder from the given reader, immediately parsing the /// gzip header. - /// - /// # Errors - /// - /// If an error is encountered when parsing the gzip header, an error is - /// returned. - pub fn new(mut r: R) -> io::Result<GzDecoder<R>> { - let header = try!(read_gz_header(&mut r)); + pub fn new(mut r: R) -> GzDecoder<R> { + let header = read_gz_header(&mut r); let flate = deflate::bufread::DeflateDecoder::new(r); - return Ok(GzDecoder { + GzDecoder { inner: CrcReader::new(flate), header: header, finished: false, - }); + } } fn finish(&mut self) -> io::Result<()> { @@ -337,9 +333,9 @@ impl<R: BufRead> GzDecoder<R> { } impl<R> GzDecoder<R> { - /// Returns the header associated with this stream. - pub fn header(&self) -> &Header { - &self.header + /// Returns the header associated with this stream, if it was valid + pub fn header(&self) -> Option<&GzHeader> { + self.header.as_ref().ok() } /// Acquires a reference to the underlying reader. @@ -363,6 +359,10 @@ impl<R> GzDecoder<R> { impl<R: BufRead> Read for GzDecoder<R> { fn read(&mut self, into: &mut [u8]) -> io::Result<usize> { + if let Err(ref mut e) = self.header { + let another_error = io::ErrorKind::Other.into(); + return Err(mem::replace(e, another_error)) + } match try!(self.inner.read(into)) { 0 => { try!(self.finish()); @@ -409,7 +409,7 @@ impl<R: BufRead + Write> Write for GzDecoder<R> { /// use flate2::bufread::MultiGzDecoder; /// /// # fn main() { -/// # let mut e = GzEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = GzEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); @@ -419,7 +419,7 @@ impl<R: BufRead + Write> Write for GzDecoder<R> { /// // Here &[u8] implements BufRead /// /// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { -/// let mut gz = MultiGzDecoder::new(&bytes[..])?; +/// let mut gz = MultiGzDecoder::new(&bytes[..]); /// let mut s = String::new(); /// gz.read_to_string(&mut s)?; /// Ok(s) @@ -428,7 +428,7 @@ impl<R: BufRead + Write> Write for GzDecoder<R> { #[derive(Debug)] pub struct MultiGzDecoder<R> { inner: CrcReader<deflate::bufread::DeflateDecoder<R>>, - header: Header, + header: io::Result<GzHeader>, finished: bool, } @@ -437,20 +437,15 @@ impl<R: BufRead> MultiGzDecoder<R> { /// Creates a new decoder from the given reader, immediately parsing the /// (first) gzip header. If the gzip stream contains multiple members all will /// be decoded. - /// - /// # Errors - /// - /// If an error is encountered when parsing the gzip header, an error is - /// returned. - pub fn new(mut r: R) -> io::Result<MultiGzDecoder<R>> { - let header = try!(read_gz_header(&mut r)); + pub fn new(mut r: R) -> MultiGzDecoder<R> { + let header = read_gz_header(&mut r); let flate = deflate::bufread::DeflateDecoder::new(r); - return Ok(MultiGzDecoder { + MultiGzDecoder { inner: CrcReader::new(flate), header: header, finished: false, - }); + } } fn finish_member(&mut self) -> io::Result<usize> { @@ -489,8 +484,8 @@ impl<R: BufRead> MultiGzDecoder<R> { Err(e) => return Err(e), }; - let next_header = try!(read_gz_header(self.inner.get_mut().get_mut())); - mem::replace(&mut self.header, next_header); + let next_header = read_gz_header(self.inner.get_mut().get_mut()); + drop(mem::replace(&mut self.header, next_header)); self.inner.reset(); self.inner.get_mut().reset_data(); @@ -499,9 +494,9 @@ impl<R: BufRead> MultiGzDecoder<R> { } impl<R> MultiGzDecoder<R> { - /// Returns the current header associated with this stream. - pub fn header(&self) -> &Header { - &self.header + /// Returns the current header associated with this stream, if it's valid + pub fn header(&self) -> Option<&GzHeader> { + self.header.as_ref().ok() } /// Acquires a reference to the underlying reader. @@ -525,6 +520,10 @@ impl<R> MultiGzDecoder<R> { impl<R: BufRead> Read for MultiGzDecoder<R> { fn read(&mut self, into: &mut [u8]) -> io::Result<usize> { + if let Err(ref mut e) = self.header { + let another_error = io::ErrorKind::Other.into(); + return Err(mem::replace(e, another_error)) + } match try!(self.inner.read(into)) { 0 => match self.finish_member() { Ok(0) => Ok(0), diff --git a/src/vendor/flate2/src/gz/mod.rs b/src/vendor/flate2/src/gz/mod.rs index 04ff5fcf07..4ca439ef83 100644 --- a/src/vendor/flate2/src/gz/mod.rs +++ b/src/vendor/flate2/src/gz/mod.rs @@ -1,4 +1,3 @@ -use std::env; use std::ffi::CString; use std::io::prelude::*; use std::time; @@ -20,15 +19,16 @@ pub mod write; /// /// The header can contain metadata about the file that was compressed, if /// present. -#[derive(PartialEq, Debug)] -pub struct Header { +#[derive(PartialEq, Clone, Debug)] +pub struct GzHeader { extra: Option<Vec<u8>>, filename: Option<Vec<u8>>, comment: Option<Vec<u8>>, + operating_system: u8, mtime: u32, } -impl Header { +impl GzHeader { /// Returns the `filename` field of this gzip stream's header, if present. pub fn filename(&self) -> Option<&[u8]> { self.filename.as_ref().map(|s| &s[..]) @@ -44,6 +44,14 @@ impl Header { self.comment.as_ref().map(|s| &s[..]) } + /// Returns the `operating_system` field of this gzip stream's header. + /// + /// There are predefined values for various operating systems. + /// 255 means that the value is unknown. + pub fn operating_system(&self) -> u8 { + self.operating_system + } + /// This gives the most recent modification time of the original file being compressed. /// /// The time is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970. @@ -88,46 +96,54 @@ impl Header { /// use flate2::GzBuilder; /// use flate2::Compression; /// -/// // GzBuilder opens a file and writes a sample string using Builder pattern +/// // GzBuilder opens a file and writes a sample string using GzBuilder pattern /// /// # fn sample_builder() -> Result<(), io::Error> { /// let f = File::create("examples/hello_world.gz")?; /// let mut gz = GzBuilder::new() /// .filename("hello_world.txt") /// .comment("test file, please delete") -/// .write(f, Compression::Default); +/// .write(f, Compression::default()); /// gz.write(b"hello world")?; /// gz.finish()?; /// # Ok(()) /// # } /// ``` #[derive(Debug)] -pub struct Builder { +pub struct GzBuilder { extra: Option<Vec<u8>>, filename: Option<CString>, comment: Option<CString>, + operating_system: Option<u8>, mtime: u32, } -impl Builder { +impl GzBuilder { /// Create a new blank builder with no header by default. - pub fn new() -> Builder { - Builder { + pub fn new() -> GzBuilder { + GzBuilder { extra: None, filename: None, comment: None, + operating_system: None, mtime: 0, } } /// Configure the `mtime` field in the gzip header. - pub fn mtime(mut self, mtime: u32) -> Builder { + pub fn mtime(mut self, mtime: u32) -> GzBuilder { self.mtime = mtime; self } + /// Configure the `operating_system` field in the gzip header. + pub fn operating_system(mut self, os: u8) -> GzBuilder { + self.operating_system = Some(os); + self + } + /// Configure the `extra` field in the gzip header. - pub fn extra<T: Into<Vec<u8>>>(mut self, extra: T) -> Builder { + pub fn extra<T: Into<Vec<u8>>>(mut self, extra: T) -> GzBuilder { self.extra = Some(extra.into()); self } @@ -137,7 +153,7 @@ impl Builder { /// # Panics /// /// Panics if the `filename` slice contains a zero. - pub fn filename<T: Into<Vec<u8>>>(mut self, filename: T) -> Builder { + pub fn filename<T: Into<Vec<u8>>>(mut self, filename: T) -> GzBuilder { self.filename = Some(CString::new(filename.into()).unwrap()); self } @@ -147,7 +163,7 @@ impl Builder { /// # Panics /// /// Panics if the `comment` slice contains a zero. - pub fn comment<T: Into<Vec<u8>>>(mut self, comment: T) -> Builder { + pub fn comment<T: Into<Vec<u8>>>(mut self, comment: T) -> GzBuilder { self.comment = Some(CString::new(comment.into()).unwrap()); self } @@ -180,10 +196,11 @@ impl Builder { } fn into_header(self, lvl: Compression) -> Vec<u8> { - let Builder { + let GzBuilder { extra, filename, comment, + operating_system, mtime, } = self; let mut flg = 0; @@ -219,17 +236,19 @@ impl Builder { header[5] = (mtime >> 8) as u8; header[6] = (mtime >> 16) as u8; header[7] = (mtime >> 24) as u8; - header[8] = match lvl { - Compression::Best => 2, - Compression::Fast => 4, - _ => 0, + header[8] = if lvl.0 >= Compression::best().0 { + 2 + } else if lvl.0 <= Compression::fast().0 { + 4 + } else { + 0 }; // Typically this byte indicates what OS the gz stream was created on, // but in an effort to have cross-platform reproducible streams just - // always set this to 255. I'm not sure that if we "correctly" set this - // it'd do anything anyway... - header[9] = 255; + // default this value to 255. I'm not sure that if we "correctly" set + // this it'd do anything anyway... + header[9] = operating_system.unwrap_or(255); return header; } } @@ -238,16 +257,16 @@ impl Builder { mod tests { use std::io::prelude::*; - use super::{read, write, Builder}; - use Compression::Default; + use super::{read, write, GzBuilder}; + use Compression; use rand::{thread_rng, Rng}; #[test] fn roundtrip() { - let mut e = write::GzEncoder::new(Vec::new(), Default); + let mut e = write::GzEncoder::new(Vec::new(), Compression::default()); e.write_all(b"foo bar baz").unwrap(); let inner = e.finish().unwrap(); - let mut d = read::GzDecoder::new(&inner[..]).unwrap(); + let mut d = read::GzDecoder::new(&inner[..]); let mut s = String::new(); d.read_to_string(&mut s).unwrap(); assert_eq!(s, "foo bar baz"); @@ -255,9 +274,9 @@ mod tests { #[test] fn roundtrip_zero() { - let e = write::GzEncoder::new(Vec::new(), Default); + let e = write::GzEncoder::new(Vec::new(), Compression::default()); let inner = e.finish().unwrap(); - let mut d = read::GzDecoder::new(&inner[..]).unwrap(); + let mut d = read::GzDecoder::new(&inner[..]); let mut s = String::new(); d.read_to_string(&mut s).unwrap(); assert_eq!(s, ""); @@ -266,7 +285,7 @@ mod tests { #[test] fn roundtrip_big() { let mut real = Vec::new(); - let mut w = write::GzEncoder::new(Vec::new(), Default); + let mut w = write::GzEncoder::new(Vec::new(), Compression::default()); let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>(); for _ in 0..200 { let to_write = &v[..thread_rng().gen_range(0, v.len())]; @@ -274,7 +293,7 @@ mod tests { w.write_all(to_write).unwrap(); } let result = w.finish().unwrap(); - let mut r = read::GzDecoder::new(&result[..]).unwrap(); + let mut r = read::GzDecoder::new(&result[..]); let mut v = Vec::new(); r.read_to_end(&mut v).unwrap(); assert!(v == real); @@ -286,7 +305,7 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut r = read::GzDecoder::new(read::GzEncoder::new(&v[..], Default)).unwrap(); + let mut r = read::GzDecoder::new(read::GzEncoder::new(&v[..], Compression::default())); let mut res = Vec::new(); r.read_to_end(&mut res).unwrap(); assert!(res == v); @@ -295,15 +314,15 @@ mod tests { #[test] fn fields() { let r = vec![0, 2, 4, 6]; - let e = Builder::new() + let e = GzBuilder::new() .filename("foo.rs") .comment("bar") .extra(vec![0, 1, 2, 3]) - .read(&r[..], Default); - let mut d = read::GzDecoder::new(e).unwrap(); - assert_eq!(d.header().filename(), Some(&b"foo.rs"[..])); - assert_eq!(d.header().comment(), Some(&b"bar"[..])); - assert_eq!(d.header().extra(), Some(&b"\x00\x01\x02\x03"[..])); + .read(&r[..], Compression::default()); + let mut d = read::GzDecoder::new(e); + assert_eq!(d.header().unwrap().filename(), Some(&b"foo.rs"[..])); + assert_eq!(d.header().unwrap().comment(), Some(&b"bar"[..])); + assert_eq!(d.header().unwrap().extra(), Some(&b"\x00\x01\x02\x03"[..])); let mut res = Vec::new(); d.read_to_end(&mut res).unwrap(); assert_eq!(res, vec![0, 2, 4, 6]); @@ -311,10 +330,10 @@ mod tests { #[test] fn keep_reading_after_end() { - let mut e = write::GzEncoder::new(Vec::new(), Default); + let mut e = write::GzEncoder::new(Vec::new(), Compression::default()); e.write_all(b"foo bar baz").unwrap(); let inner = e.finish().unwrap(); - let mut d = read::GzDecoder::new(&inner[..]).unwrap(); + let mut d = read::GzDecoder::new(&inner[..]); let mut s = String::new(); d.read_to_string(&mut s).unwrap(); assert_eq!(s, "foo bar baz"); @@ -327,8 +346,8 @@ mod tests { ::quickcheck::quickcheck(test as fn(_) -> _); fn test(v: Vec<u8>) -> bool { - let r = read::GzEncoder::new(&v[..], Default); - let mut r = read::GzDecoder::new(r).unwrap(); + let r = read::GzEncoder::new(&v[..], Compression::default()); + let mut r = read::GzDecoder::new(r); let mut v2 = Vec::new(); r.read_to_end(&mut v2).unwrap(); v == v2 @@ -337,7 +356,7 @@ mod tests { #[test] fn flush_after_write() { - let mut f = write::GzEncoder::new(Vec::new(), Default); + let mut f = write::GzEncoder::new(Vec::new(), Compression::default()); write!(f, "Hello world").unwrap(); f.flush().unwrap(); } diff --git a/src/vendor/flate2/src/gz/read.rs b/src/vendor/flate2/src/gz/read.rs index c95e388a5f..e8ae92b4bf 100644 --- a/src/vendor/flate2/src/gz/read.rs +++ b/src/vendor/flate2/src/gz/read.rs @@ -1,7 +1,7 @@ use std::io::prelude::*; use std::io; -use super::{Builder, Header}; +use super::{GzBuilder, GzHeader}; use Compression; use bufreader::BufReader; use super::bufread; @@ -27,7 +27,7 @@ use super::bufread; /// fn gzencode_hello_world() -> io::Result<Vec<u8>> { /// let mut ret_vec = [0;100]; /// let bytestring = b"hello world"; -/// let mut gz = GzEncoder::new(&bytestring[..], Compression::Fast); +/// let mut gz = GzEncoder::new(&bytestring[..], Compression::fast()); /// let count = gz.read(&mut ret_vec)?; /// Ok(ret_vec[0..count].to_vec()) /// } @@ -47,12 +47,12 @@ impl<R: Read> GzEncoder<R> { /// Creates a new encoder which will use the given compression level. /// /// The encoder is not configured specially for the emitted header. For - /// header configuration, see the `Builder` type. + /// header configuration, see the `GzBuilder` type. /// /// The data read from the stream `r` will be compressed and available /// through the returned reader. pub fn new(r: R, level: Compression) -> GzEncoder<R> { - Builder::new().read(r, level) + GzBuilder::new().read(r, level) } } @@ -110,7 +110,7 @@ impl<R: Read + Write> Write for GzEncoder<R> { /// use flate2::read::GzDecoder; /// /// # fn main() { -/// # let mut e = GzEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = GzEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); @@ -120,7 +120,7 @@ impl<R: Read + Write> Write for GzEncoder<R> { /// // Here &[u8] implements Read /// /// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { -/// let mut gz = GzDecoder::new(&bytes[..])?; +/// let mut gz = GzDecoder::new(&bytes[..]); /// let mut s = String::new(); /// gz.read_to_string(&mut s)?; /// Ok(s) @@ -134,19 +134,16 @@ pub struct GzDecoder<R> { impl<R: Read> GzDecoder<R> { /// Creates a new decoder from the given reader, immediately parsing the /// gzip header. - /// - /// # Errors - /// - /// If an error is encountered when parsing the gzip header, an error is - /// returned. - pub fn new(r: R) -> io::Result<GzDecoder<R>> { - bufread::GzDecoder::new(BufReader::new(r)).map(|r| GzDecoder { inner: r }) + pub fn new(r: R) -> GzDecoder<R> { + GzDecoder { + inner: bufread::GzDecoder::new(BufReader::new(r)), + } } } impl<R> GzDecoder<R> { - /// Returns the header associated with this stream. - pub fn header(&self) -> &Header { + /// Returns the header associated with this stream, if it was valid. + pub fn header(&self) -> Option<&GzHeader> { self.inner.header() } @@ -209,7 +206,7 @@ impl<R: Read + Write> Write for GzDecoder<R> { /// use flate2::read::MultiGzDecoder; /// /// # fn main() { -/// # let mut e = GzEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = GzEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); @@ -219,7 +216,7 @@ impl<R: Read + Write> Write for GzDecoder<R> { /// // Here &[u8] implements Read /// /// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> { -/// let mut gz = MultiGzDecoder::new(&bytes[..])?; +/// let mut gz = MultiGzDecoder::new(&bytes[..]); /// let mut s = String::new(); /// gz.read_to_string(&mut s)?; /// Ok(s) @@ -234,19 +231,16 @@ impl<R: Read> MultiGzDecoder<R> { /// Creates a new decoder from the given reader, immediately parsing the /// (first) gzip header. If the gzip stream contains multiple members all will /// be decoded. - /// - /// # Errors - /// - /// If an error is encountered when parsing the gzip header, an error is - /// returned. - pub fn new(r: R) -> io::Result<MultiGzDecoder<R>> { - bufread::MultiGzDecoder::new(BufReader::new(r)).map(|r| MultiGzDecoder { inner: r }) + pub fn new(r: R) -> MultiGzDecoder<R> { + MultiGzDecoder { + inner: bufread::MultiGzDecoder::new(BufReader::new(r)), + } } } impl<R> MultiGzDecoder<R> { - /// Returns the current header associated with this stream. - pub fn header(&self) -> &Header { + /// Returns the current header associated with this stream, if it's valid. + pub fn header(&self) -> Option<&GzHeader> { self.inner.header() } diff --git a/src/vendor/flate2/src/gz/write.rs b/src/vendor/flate2/src/gz/write.rs index a9a10569a1..0b1c724f16 100644 --- a/src/vendor/flate2/src/gz/write.rs +++ b/src/vendor/flate2/src/gz/write.rs @@ -6,7 +6,7 @@ use futures::Poll; #[cfg(feature = "tokio")] use tokio_io::{AsyncRead, AsyncWrite}; -use super::Builder; +use super::GzBuilder; use {Compress, Compression}; use crc::Crc; use zio; @@ -28,7 +28,7 @@ use zio; /// // Vec<u8> implements Write to print the compressed bytes of sample string /// # fn main() { /// -/// let mut e = GzEncoder::new(Vec::new(), Compression::Default); +/// let mut e = GzEncoder::new(Vec::new(), Compression::default()); /// e.write(b"Hello World").unwrap(); /// println!("{:?}", e.finish().unwrap()); /// # } @@ -54,12 +54,12 @@ impl<W: Write> GzEncoder<W> { /// Creates a new encoder which will use the given compression level. /// /// The encoder is not configured specially for the emitted header. For - /// header configuration, see the `Builder` type. + /// header configuration, see the `GzBuilder` type. /// /// The data written to the returned encoder will be compressed and then /// written to the stream `w`. pub fn new(w: W, level: Compression) -> GzEncoder<W> { - Builder::new().write(w, level) + GzBuilder::new().write(w, level) } /// Acquires a reference to the underlying writer. diff --git a/src/vendor/flate2/src/lib.rs b/src/vendor/flate2/src/lib.rs index 3846913b9f..2c596fb3bb 100644 --- a/src/vendor/flate2/src/lib.rs +++ b/src/vendor/flate2/src/lib.rs @@ -1,20 +1,22 @@ //! A DEFLATE-based stream compression/decompression library //! -//! This library is meant to supplement/replace the standard distributon's -//! libflate library by providing a streaming encoder/decoder rather than purely +//! This library is meant to supplement/replace the +//! `flate` library that was previously part of the standard rust distribution +//! providing a streaming encoder/decoder rather than purely //! an in-memory encoder/decoder. //! -//! Like with [`libflate`], flate2 is based on [`miniz.c`][1] +//! Like with [`flate`], flate2 is based on [`miniz.c`][1] //! -//! [1]: https://code.google.com/p/miniz/ -//! [`libflate`]: https://docs.rs/crate/libflate/ +//! [1]: https://github.com/richgel999/miniz +//! [`flate`]: https://github.com/rust-lang/rust/tree/1.19.0/src/libflate //! //! # Organization //! -//! This crate consists mainly of two modules, [`read`] and [`write`]. Each -//! module contains a number of types used to encode and decode various streams -//! of data. All types in the [`write`] module work on instances of [`Write`], -//! whereas all types in the [`read`] module work on instances of [`Read`]. +//! This crate consists mainly of three modules, [`read`], [`write`], and +//! [`bufread`]. Each module contains a number of types used to encode and +//! decode various streams of data. All types in the [`write`] module work on +//! instances of [`Write`][write], whereas all types in the [`read`] module work on +//! instances of [`Read`][read] and [`bufread`] works with [`BufRead`][bufread]. //! //! ``` //! use flate2::write::GzEncoder; @@ -24,7 +26,7 @@ //! //! # fn main() { let _ = run(); } //! # fn run() -> io::Result<()> { -//! let mut encoder = GzEncoder::new(Vec::new(), Compression::Default); +//! let mut encoder = GzEncoder::new(Vec::new(), Compression::default()); //! encoder.write(b"Example")?; //! # Ok(()) //! # } @@ -32,46 +34,18 @@ //! //! //! Other various types are provided at the top-level of the crate for -//! management and dealing with encoders/decoders. +//! management and dealing with encoders/decoders. Also note that types which +//! operate over a specific trait often implement the mirroring trait as well. +//! For example a `flate2::read::DeflateDecoder<T>` *also* implements the +//! `Write` trait if `T: Write`. That is, the "dual trait" is forwarded directly +//! to the underlying object if available. //! //! [`read`]: read/index.html +//! [`bufread`]: bufread/index.html //! [`write`]: write/index.html -//! [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html -//! [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html -//! -//! # Helper traits -//! -//! There are two helper traits provided: [`FlateReadExt`] and [`FlateWriteExt`]. -//! These provide convenience methods for creating a decoder/encoder out of an -//! already existing stream to chain construction. -//! -//! [`FlateReadExt`]: trait.FlateReadExt.html -//! [`FlateWriteExt`]: trait.FlateWriteExt.html -//! -//! ``` -//! use flate2::{FlateReadExt, Compression}; -//! use std::io::prelude::*; -//! use std::io; -//! use std::fs::File; -//! -//! # fn main() { -//! # println!("{}", run().unwrap()); -//! # } -//! # -//! // Read contents of file with a compression stream, then decompress with GZ -//! -//! # fn run() -> io::Result<String> { -//! let f = File::open("examples/hello_world.txt")?; -//! -//! //gz_encode method comes from FlateReadExt and applies to a std::fs::File -//! let data = f.gz_encode(Compression::Default); -//! let mut buffer = String::new(); -//! -//! //gz_decode method comes from FlateReadExt and applies to a &[u8] -//! &data.gz_decode()?.read_to_string(&mut buffer)?; -//! # Ok(buffer) -//! # } -//! ``` +//! [read]: https://doc.rust-lang.org/std/io/trait.Read.html +//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html +//! [bufread]: https://doc.rust-lang.org/std/io/trait.BufRead.html //! //! # Async I/O //! @@ -113,12 +87,10 @@ extern crate rand; #[macro_use] extern crate tokio_io; -use std::io::prelude::*; -use std::io; - -pub use gz::Builder as GzBuilder; -pub use gz::Header as GzHeader; -pub use mem::{Compress, DataError, Decompress, Flush, Status}; +pub use gz::GzBuilder; +pub use gz::GzHeader; +pub use mem::{Compress, CompressError, DecompressError, Decompress, Status}; +pub use mem::{FlushCompress, FlushDecompress}; pub use crc::{Crc, CrcReader}; mod bufreader; @@ -190,119 +162,43 @@ fn _assert_send_sync() { /// When compressing data, the compression level can be specified by a value in /// this enum. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub enum Compression { +pub struct Compression(u32); + +impl Compression { + /// Creates a new description of the compression level with an explicitly + /// specified integer. + /// + /// The integer here is typically on a scale of 0-9 where 0 means "no + /// compression" and 9 means "take as long as you'd like". + pub fn new(level: u32) -> Compression { + Compression(level) + } + /// No compression is to be performed, this may actually inflate data /// slightly when encoding. - None = 0, + pub fn none() -> Compression { + Compression(0) + } + /// Optimize for the best speed of encoding. - Fast = 1, + pub fn fast() -> Compression { + Compression(1) + } + /// Optimize for the size of data being encoded. - Best = 9, - /// Choose the default compression, a balance between speed and size. - Default = 6, + pub fn best() -> Compression { + Compression(9) + } + + /// Returns an integer representing the compression level, typically on a + /// scale of 0-9 + pub fn level(&self) -> u32 { + self.0 + } } -/// Default to Compression::Default. impl Default for Compression { fn default() -> Compression { - Compression::Default - } -} - -/// A helper trait to create encoder/decoders with method syntax. -pub trait FlateReadExt: Read + Sized { - /// Consume this reader to create a compression stream at the specified - /// compression level. - fn gz_encode(self, lvl: Compression) -> read::GzEncoder<Self> { - read::GzEncoder::new(self, lvl) - } - - /// Consume this reader to create a decompression stream of this stream. - fn gz_decode(self) -> io::Result<read::GzDecoder<Self>> { - read::GzDecoder::new(self) - } - - /// Consume this reader to create a compression stream at the specified - /// compression level. - fn zlib_encode(self, lvl: Compression) -> read::ZlibEncoder<Self> { - read::ZlibEncoder::new(self, lvl) - } - - /// Consume this reader to create a decompression stream of this stream. - fn zlib_decode(self) -> read::ZlibDecoder<Self> { - read::ZlibDecoder::new(self) - } - - /// Consume this reader to create a compression stream at the specified - /// compression level. - fn deflate_encode(self, lvl: Compression) -> read::DeflateEncoder<Self> { - read::DeflateEncoder::new(self, lvl) - } - - /// Consume this reader to create a decompression stream of this stream. - fn deflate_decode(self) -> read::DeflateDecoder<Self> { - read::DeflateDecoder::new(self) - } -} - -/// A helper trait to create encoder/decoders with method syntax. -pub trait FlateWriteExt: Write + Sized { - /// Consume this writer to create a compression stream at the specified - /// compression level. - fn gz_encode(self, lvl: Compression) -> write::GzEncoder<Self> { - write::GzEncoder::new(self, lvl) - } - - // TODO: coming soon to a theater near you! - // /// Consume this writer to create a decompression stream of this stream. - // fn gz_decode(self) -> IoResult<write::GzDecoder<Self>> { - // write::GzDecoder::new(self) - // } - - /// Consume this writer to create a compression stream at the specified - /// compression level. - fn zlib_encode(self, lvl: Compression) -> write::ZlibEncoder<Self> { - write::ZlibEncoder::new(self, lvl) - } - - /// Consume this writer to create a decompression stream of this stream. - fn zlib_decode(self) -> write::ZlibDecoder<Self> { - write::ZlibDecoder::new(self) - } - - /// Consume this writer to create a compression stream at the specified - /// compression level. - fn deflate_encode(self, lvl: Compression) -> write::DeflateEncoder<Self> { - write::DeflateEncoder::new(self, lvl) - } - - /// Consume this writer to create a decompression stream of this stream. - fn deflate_decode(self) -> write::DeflateDecoder<Self> { - write::DeflateDecoder::new(self) - } -} - -impl<T: Read> FlateReadExt for T {} -impl<T: Write> FlateWriteExt for T {} - -#[cfg(test)] -mod test { - use std::io::prelude::*; - use {Compression, FlateReadExt}; - - #[test] - fn crazy() { - let rdr = &mut b"foobar"; - let mut res = Vec::new(); - rdr.gz_encode(Compression::Default) - .deflate_encode(Compression::Default) - .zlib_encode(Compression::Default) - .zlib_decode() - .deflate_decode() - .gz_decode() - .unwrap() - .read_to_end(&mut res) - .unwrap(); - assert_eq!(res, b"foobar"); + Compression(6) } } diff --git a/src/vendor/flate2/src/mem.rs b/src/vendor/flate2/src/mem.rs index 3eaf36abe7..36140782db 100644 --- a/src/vendor/flate2/src/mem.rs +++ b/src/vendor/flate2/src/mem.rs @@ -63,10 +63,10 @@ enum DirCompress {} #[derive(Debug)] enum DirDecompress {} -/// Values which indicate the form of flushing to be used when compressing or -/// decompressing in-memory data. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub enum Flush { +/// Values which indicate the form of flushing to be used when compressing +/// in-memory data. +pub enum FlushCompress { /// A typical parameter for passing to compression/decompression functions, /// this indicates that the underlying stream to decide how much data to /// accumulate before producing output in order to maximize compression. @@ -91,18 +91,6 @@ pub enum Flush { /// block before the empty fixed code block. Partial = ffi::MZ_PARTIAL_FLUSH as isize, - /// A deflate block is completed and emitted, as for `Flush::Sync`, but the - /// output is not aligned on a byte boundary and up to seven vits of the - /// current block are held to be written as the next byte after the next - /// deflate block is completed. - /// - /// In this case the decompressor may not be provided enough bits at this - /// point in order to complete decompression of the data provided so far to - /// the compressor, it may need to wait for the next block to be emitted. - /// This is for advanced applications that need to control the emission of - /// deflate blocks. - Block = ffi::MZ_BLOCK as isize, - /// All output is flushed as with `Flush::Sync` and the compression state is /// reset so decompression can restart from this point if previous /// compressed data has been damaged or if random access is desired. @@ -115,12 +103,48 @@ pub enum Flush { /// The return value may indicate that the stream is not yet done and more /// data has yet to be processed. Finish = ffi::MZ_FINISH as isize, + + #[doc(hidden)] + _Nonexhaustive +} + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +/// Values which indicate the form of flushing to be used when +/// decompressing in-memory data. +pub enum FlushDecompress { + /// A typical parameter for passing to compression/decompression functions, + /// this indicates that the underlying stream to decide how much data to + /// accumulate before producing output in order to maximize compression. + None = ffi::MZ_NO_FLUSH as isize, + + /// All pending output is flushed to the output buffer and the output is + /// aligned on a byte boundary so that the decompressor can get all input + /// data available so far. + /// + /// Flushing may degrade compression for some compression algorithms and so + /// it should only be used when necessary. This will complete the current + /// deflate block and follow it with an empty stored block. + Sync = ffi::MZ_SYNC_FLUSH as isize, + + /// Pending input is processed and pending output is flushed. + /// + /// The return value may indicate that the stream is not yet done and more + /// data has yet to be processed. + Finish = ffi::MZ_FINISH as isize, + + #[doc(hidden)] + _Nonexhaustive } /// Error returned when a decompression object finds that the input stream of /// bytes was not a valid input stream of bytes. #[derive(Debug)] -pub struct DataError(()); +pub struct DecompressError(()); + +/// Error returned when a compression object is used incorrectly or otherwise +/// generates an error. +#[derive(Debug)] +pub struct CompressError(()); /// Possible status results of compressing some data or successfully /// decompressing a block of data. @@ -129,7 +153,7 @@ pub enum Status { /// Indicates success. /// /// Means that more input may be needed but isn't available - /// and/or there' smore output to be written but the output buffer is full. + /// and/or there's more output to be written but the output buffer is full. Ok, /// Indicates that forward progress is not possible due to input or output @@ -161,7 +185,7 @@ impl Compress { unsafe { let mut state = ffi::StreamWrapper::default(); let ret = ffi::mz_deflateInit2(&mut *state, - level as c_int, + level.0 as c_int, ffi::MZ_DEFLATED, if zlib_header { ffi::MZ_DEFAULT_WINDOW_BITS @@ -208,15 +232,15 @@ impl Compress { /// Compresses the input data into the output, consuming only as much /// input as needed and writing as much output as possible. /// - /// The flush option can be any of the available flushing parameters. + /// The flush option can be any of the available `FlushCompress` parameters. /// /// To learn how much data was consumed or how much output was produced, use /// the `total_in` and `total_out` functions before/after this is called. pub fn compress(&mut self, input: &[u8], output: &mut [u8], - flush: Flush) - -> Status { + flush: FlushCompress) + -> Result<Status, CompressError> { let raw = &mut *self.inner.stream_wrapper; raw.next_in = input.as_ptr() as *mut _; raw.avail_in = input.len() as c_uint; @@ -233,9 +257,10 @@ impl Compress { output.as_ptr() as usize) as u64; match rc { - ffi::MZ_OK => Status::Ok, - ffi::MZ_BUF_ERROR => Status::BufError, - ffi::MZ_STREAM_END => Status::StreamEnd, + ffi::MZ_OK => Ok(Status::Ok), + ffi::MZ_BUF_ERROR => Ok(Status::BufError), + ffi::MZ_STREAM_END => Ok(Status::StreamEnd), + ffi::MZ_STREAM_ERROR => Err(CompressError(())), c => panic!("unknown return code: {}", c), } } @@ -251,8 +276,8 @@ impl Compress { pub fn compress_vec(&mut self, input: &[u8], output: &mut Vec<u8>, - flush: Flush) - -> Status { + flush: FlushCompress) + -> Result<Status, CompressError> { let cap = output.capacity(); let len = output.len(); @@ -310,14 +335,16 @@ impl Decompress { /// Decompresses the input data into the output, consuming only as much /// input as needed and writing as much output as possible. /// - /// The flush option provided can either be `Flush::None`, `Flush::Sync`, - /// or `Flush::Finish`. If the first call passes `Flush::Finish` it is - /// assumed that the input and output buffers are both sized large enough to - /// decompress the entire stream in a single call. + /// The flush option can be any of the available `FlushDecompress` parameters. /// - /// A flush value of `Flush::Finish` indicates that there are no more source - /// bytes available beside what's already in the input buffer, and the - /// output buffer is large enough to hold the rest of the decompressed data. + /// If the first call passes `FlushDecompress::Finish` it is assumed that + /// the input and output buffers are both sized large enough to decompress + /// the entire stream in a single call. + /// + /// A flush value of `FlushDecompress::Finish` indicates that there are no + /// more source bytes available beside what's already in the input buffer, + /// and the output buffer is large enough to hold the rest of the + /// decompressed data. /// /// To learn how much data was consumed or how much output was produced, use /// the `total_in` and `total_out` functions before/after this is called. @@ -326,12 +353,12 @@ impl Decompress { /// /// If the input data to this instance of `Decompress` is not a valid /// zlib/deflate stream then this function may return an instance of - /// `DataError` to indicate that the stream of input bytes is corrupted. + /// `DecompressError` to indicate that the stream of input bytes is corrupted. pub fn decompress(&mut self, input: &[u8], output: &mut [u8], - flush: Flush) - -> Result<Status, DataError> { + flush: FlushDecompress) + -> Result<Status, DecompressError> { let raw = &mut *self.inner.stream_wrapper; raw.next_in = input.as_ptr() as *mut u8; raw.avail_in = input.len() as c_uint; @@ -349,7 +376,7 @@ impl Decompress { match rc { ffi::MZ_DATA_ERROR | - ffi::MZ_STREAM_ERROR => Err(DataError(())), + ffi::MZ_STREAM_ERROR => Err(DecompressError(())), ffi::MZ_OK => Ok(Status::Ok), ffi::MZ_BUF_ERROR => Ok(Status::BufError), ffi::MZ_STREAM_END => Ok(Status::StreamEnd), @@ -370,12 +397,12 @@ impl Decompress { /// /// If the input data to this instance of `Decompress` is not a valid /// zlib/deflate stream then this function may return an instance of - /// `DataError` to indicate that the stream of input bytes is corrupted. + /// `DecompressError` to indicate that the stream of input bytes is corrupted. pub fn decompress_vec(&mut self, input: &[u8], output: &mut Vec<u8>, - flush: Flush) - -> Result<Status, DataError> { + flush: FlushDecompress) + -> Result<Status, DecompressError> { let cap = output.capacity(); let len = output.len(); @@ -423,17 +450,33 @@ impl Decompress { } } -impl Error for DataError { - fn description(&self) -> &str { "deflate data error" } +impl Error for DecompressError { + fn description(&self) -> &str { "deflate decompression error" } } -impl From<DataError> for io::Error { - fn from(data: DataError) -> io::Error { +impl From<DecompressError> for io::Error { + fn from(data: DecompressError) -> io::Error { io::Error::new(io::ErrorKind::Other, data) } } -impl fmt::Display for DataError { +impl fmt::Display for DecompressError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.description().fmt(f) + } +} + +impl Error for CompressError { + fn description(&self) -> &str { "deflate compression error" } +} + +impl From<CompressError> for io::Error { + fn from(data: CompressError) -> io::Error { + io::Error::new(io::ErrorKind::Other, data) + } +} + +impl fmt::Display for CompressError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.description().fmt(f) } @@ -463,7 +506,7 @@ mod tests { use std::io::Write; use write; - use {Compression, Decompress, Flush}; + use {Compression, Decompress, FlushDecompress}; #[test] fn issue51() { @@ -485,11 +528,11 @@ mod tests { let mut d = Decompress::new(false); // decompressed whole deflate stream - assert!(d.decompress_vec(&data[10..], &mut decoded, Flush::Finish).is_ok()); + assert!(d.decompress_vec(&data[10..], &mut decoded, FlushDecompress::Finish).is_ok()); // decompress data that has nothing to do with the deflate stream (this // used to panic) - drop(d.decompress_vec(&[0], &mut decoded, Flush::None)); + drop(d.decompress_vec(&[0], &mut decoded, FlushDecompress::None)); } #[test] @@ -498,18 +541,18 @@ mod tests { let mut zlib = Vec::new(); let mut deflate = Vec::new(); - let comp = Compression::Default; + let comp = Compression::default(); write::ZlibEncoder::new(&mut zlib, comp).write_all(string).unwrap(); write::DeflateEncoder::new(&mut deflate, comp).write_all(string).unwrap(); let mut dst = [0; 1024]; let mut decoder = Decompress::new(true); - decoder.decompress(&zlib, &mut dst, Flush::Finish).unwrap(); + decoder.decompress(&zlib, &mut dst, FlushDecompress::Finish).unwrap(); assert_eq!(decoder.total_out(), string.len() as u64); assert!(dst.starts_with(string)); decoder.reset(false); - decoder.decompress(&deflate, &mut dst, Flush::Finish).unwrap(); + decoder.decompress(&deflate, &mut dst, FlushDecompress::Finish).unwrap(); assert_eq!(decoder.total_out(), string.len() as u64); assert!(dst.starts_with(string)); } diff --git a/src/vendor/flate2/src/zio.rs b/src/vendor/flate2/src/zio.rs index 358ffb3262..23eae3b999 100644 --- a/src/vendor/flate2/src/zio.rs +++ b/src/vendor/flate2/src/zio.rs @@ -2,7 +2,7 @@ use std::io::prelude::*; use std::io; use std::mem; -use {Decompress, Compress, Status, Flush, DataError}; +use {Decompress, Compress, Status, FlushDecompress, FlushCompress, DecompressError}; #[derive(Debug)] pub struct Writer<W: Write, D: Ops> { @@ -12,40 +12,78 @@ pub struct Writer<W: Write, D: Ops> { } pub trait Ops { + type Flush: Flush; fn total_in(&self) -> u64; fn total_out(&self) -> u64; - fn run(&mut self, input: &[u8], output: &mut [u8], flush: Flush) - -> Result<Status, DataError>; - fn run_vec(&mut self, input: &[u8], output: &mut Vec<u8>, flush: Flush) - -> Result<Status, DataError>; + fn run(&mut self, input: &[u8], output: &mut [u8], flush: Self::Flush) + -> Result<Status, DecompressError>; + fn run_vec(&mut self, input: &[u8], output: &mut Vec<u8>, flush: Self::Flush) + -> Result<Status, DecompressError>; } impl Ops for Compress { + type Flush = FlushCompress; fn total_in(&self) -> u64 { self.total_in() } fn total_out(&self) -> u64 { self.total_out() } - fn run(&mut self, input: &[u8], output: &mut [u8], flush: Flush) - -> Result<Status, DataError> { - Ok(self.compress(input, output, flush)) + fn run(&mut self, input: &[u8], output: &mut [u8], flush: FlushCompress) + -> Result<Status, DecompressError> { + Ok(self.compress(input, output, flush).unwrap()) } - fn run_vec(&mut self, input: &[u8], output: &mut Vec<u8>, flush: Flush) - -> Result<Status, DataError> { - Ok(self.compress_vec(input, output, flush)) + fn run_vec(&mut self, input: &[u8], output: &mut Vec<u8>, flush: FlushCompress) + -> Result<Status, DecompressError> { + Ok(self.compress_vec(input, output, flush).unwrap()) } } impl Ops for Decompress { + type Flush = FlushDecompress; fn total_in(&self) -> u64 { self.total_in() } fn total_out(&self) -> u64 { self.total_out() } - fn run(&mut self, input: &[u8], output: &mut [u8], flush: Flush) - -> Result<Status, DataError> { + fn run(&mut self, input: &[u8], output: &mut [u8], flush: FlushDecompress) + -> Result<Status, DecompressError> { self.decompress(input, output, flush) } - fn run_vec(&mut self, input: &[u8], output: &mut Vec<u8>, flush: Flush) - -> Result<Status, DataError> { + fn run_vec(&mut self, input: &[u8], output: &mut Vec<u8>, flush: FlushDecompress) + -> Result<Status, DecompressError> { self.decompress_vec(input, output, flush) } } +pub trait Flush { + fn none() -> Self; + fn sync() -> Self; + fn finish() -> Self; +} + +impl Flush for FlushCompress { + fn none() -> Self { + FlushCompress::None + } + + fn sync() -> Self { + FlushCompress::Sync + } + + fn finish() -> Self { + FlushCompress::Finish + } +} + +impl Flush for FlushDecompress { + fn none() -> Self { + FlushDecompress::None + } + + fn sync() -> Self { + FlushDecompress::Sync + } + + fn finish() -> Self { + FlushDecompress::Finish + } +} + + pub fn read<R, D>(obj: &mut R, data: &mut D, dst: &mut [u8]) -> io::Result<usize> where R: BufRead, D: Ops { @@ -56,7 +94,11 @@ pub fn read<R, D>(obj: &mut R, data: &mut D, dst: &mut [u8]) -> io::Result<usize eof = input.is_empty(); let before_out = data.total_out(); let before_in = data.total_in(); - let flush = if eof {Flush::Finish} else {Flush::None}; + let flush = if eof { + D::Flush::finish() + } else { + D::Flush::none() + }; ret = data.run(input, dst, flush); read = (data.total_out() - before_out) as usize; consumed = (data.total_in() - before_in) as usize; @@ -96,7 +138,7 @@ impl<W: Write, D: Ops> Writer<W, D> { try!(self.dump()); let before = self.data.total_out(); - try!(self.data.run_vec(&[], &mut self.buf, Flush::Finish)); + try!(self.data.run_vec(&[], &mut self.buf, D::Flush::finish())); if before == self.data.total_out() { return Ok(()) } @@ -154,7 +196,7 @@ impl<W: Write, D: Ops> Write for Writer<W, D> { try!(self.dump()); let before_in = self.data.total_in(); - let ret = self.data.run_vec(buf, &mut self.buf, Flush::None); + let ret = self.data.run_vec(buf, &mut self.buf, D::Flush::none()); let written = (self.data.total_in() - before_in) as usize; if buf.len() > 0 && written == 0 && ret.is_ok() { @@ -172,7 +214,7 @@ impl<W: Write, D: Ops> Write for Writer<W, D> { } fn flush(&mut self) -> io::Result<()> { - self.data.run_vec(&[], &mut self.buf, Flush::Sync).unwrap(); + self.data.run_vec(&[], &mut self.buf, D::Flush::sync()).unwrap(); // Unfortunately miniz doesn't actually tell us when we're done with // pulling out all the data from the internal stream. To remedy this we @@ -182,7 +224,7 @@ impl<W: Write, D: Ops> Write for Writer<W, D> { loop { try!(self.dump()); let before = self.data.total_out(); - self.data.run_vec(&[], &mut self.buf, Flush::None).unwrap(); + self.data.run_vec(&[], &mut self.buf, D::Flush::none()).unwrap(); if before == self.data.total_out() { break } diff --git a/src/vendor/flate2/src/zlib/bufread.rs b/src/vendor/flate2/src/zlib/bufread.rs index a21a905f61..058e548314 100644 --- a/src/vendor/flate2/src/zlib/bufread.rs +++ b/src/vendor/flate2/src/zlib/bufread.rs @@ -31,7 +31,7 @@ use {Compress, Decompress}; /// # fn open_hello_world() -> std::io::Result<Vec<u8>> { /// let f = File::open("examples/hello_world.txt")?; /// let b = BufReader::new(f); -/// let mut z = ZlibEncoder::new(b, Compression::Fast); +/// let mut z = ZlibEncoder::new(b, Compression::fast()); /// let mut buffer = Vec::new(); /// z.read_to_end(&mut buffer)?; /// # Ok(buffer) @@ -150,7 +150,7 @@ impl<R: AsyncWrite + BufRead> AsyncWrite for ZlibEncoder<R> { /// use flate2::bufread::ZlibDecoder; /// /// # fn main() { -/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_bufreader(bytes).unwrap()); diff --git a/src/vendor/flate2/src/zlib/mod.rs b/src/vendor/flate2/src/zlib/mod.rs index b04e40b826..a407cdfe6d 100644 --- a/src/vendor/flate2/src/zlib/mod.rs +++ b/src/vendor/flate2/src/zlib/mod.rs @@ -11,12 +11,12 @@ mod tests { use rand::{thread_rng, Rng}; use zlib::{read, write}; - use Compression::Default; + use Compression; #[test] fn roundtrip() { let mut real = Vec::new(); - let mut w = write::ZlibEncoder::new(Vec::new(), Default); + let mut w = write::ZlibEncoder::new(Vec::new(), Compression::default()); let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>(); for _ in 0..200 { let to_write = &v[..thread_rng().gen_range(0, v.len())]; @@ -33,7 +33,7 @@ mod tests { #[test] fn drop_writes() { let mut data = Vec::new(); - write::ZlibEncoder::new(&mut data, Default) + write::ZlibEncoder::new(&mut data, Compression::default()) .write_all(b"foo") .unwrap(); let mut r = read::ZlibDecoder::new(&data[..]); @@ -45,7 +45,7 @@ mod tests { #[test] fn total_in() { let mut real = Vec::new(); - let mut w = write::ZlibEncoder::new(Vec::new(), Default); + let mut w = write::ZlibEncoder::new(Vec::new(), Compression::default()); let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>(); for _ in 0..200 { let to_write = &v[..thread_rng().gen_range(0, v.len())]; @@ -73,7 +73,7 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut r = read::ZlibDecoder::new(read::ZlibEncoder::new(&v[..], Default)); + let mut r = read::ZlibDecoder::new(read::ZlibEncoder::new(&v[..], Compression::default())); let mut ret = Vec::new(); r.read_to_end(&mut ret).unwrap(); assert_eq!(ret, v); @@ -85,7 +85,7 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut w = write::ZlibEncoder::new(write::ZlibDecoder::new(Vec::new()), Default); + let mut w = write::ZlibEncoder::new(write::ZlibDecoder::new(Vec::new()), Compression::default()); w.write_all(&v).unwrap(); let w = w.finish().unwrap().finish().unwrap(); assert!(w == v); @@ -97,7 +97,7 @@ mod tests { .gen_iter::<u8>() .take(1024 * 1024) .collect::<Vec<_>>(); - let mut w = write::ZlibEncoder::new(Vec::new(), Default); + let mut w = write::ZlibEncoder::new(Vec::new(), Compression::default()); w.write_all(&v).unwrap(); let data = w.finish().unwrap(); @@ -144,7 +144,7 @@ mod tests { ::quickcheck::quickcheck(test as fn(_) -> _); fn test(v: Vec<u8>) -> bool { - let mut r = read::ZlibDecoder::new(read::ZlibEncoder::new(&v[..], Default)); + let mut r = read::ZlibDecoder::new(read::ZlibEncoder::new(&v[..], Compression::default())); let mut v2 = Vec::new(); r.read_to_end(&mut v2).unwrap(); v == v2 @@ -156,7 +156,7 @@ mod tests { ::quickcheck::quickcheck(test as fn(_) -> _); fn test(v: Vec<u8>) -> bool { - let mut w = write::ZlibEncoder::new(write::ZlibDecoder::new(Vec::new()), Default); + let mut w = write::ZlibEncoder::new(write::ZlibDecoder::new(Vec::new()), Compression::default()); w.write_all(&v).unwrap(); v == w.finish().unwrap().finish().unwrap() } diff --git a/src/vendor/flate2/src/zlib/read.rs b/src/vendor/flate2/src/zlib/read.rs index a2eece78dd..78087687d9 100644 --- a/src/vendor/flate2/src/zlib/read.rs +++ b/src/vendor/flate2/src/zlib/read.rs @@ -28,7 +28,7 @@ use super::bufread; /// /// # fn open_hello_world() -> std::io::Result<Vec<u8>> { /// let f = File::open("examples/hello_world.txt")?; -/// let mut z = ZlibEncoder::new(f, Compression::Fast); +/// let mut z = ZlibEncoder::new(f, Compression::fast()); /// let mut buffer = [0;50]; /// let byte_count = z.read(&mut buffer)?; /// # Ok(buffer[0..byte_count].to_vec()) @@ -147,7 +147,7 @@ impl<R: AsyncRead + AsyncWrite> AsyncWrite for ZlibEncoder<R> { /// use flate2::read::ZlibDecoder; /// /// # fn main() { -/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/src/zlib/write.rs b/src/vendor/flate2/src/zlib/write.rs index 52e4fc28e5..e7a4d85c99 100644 --- a/src/vendor/flate2/src/zlib/write.rs +++ b/src/vendor/flate2/src/zlib/write.rs @@ -26,7 +26,7 @@ use {Compress, Decompress}; /// // Vec<u8> implements Write, assigning the compressed bytes of sample string /// /// # fn zlib_encoding() -> std::io::Result<()> { -/// let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); +/// let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); /// e.write(b"Hello World")?; /// let compressed = e.finish()?; /// # Ok(()) @@ -202,7 +202,7 @@ impl<W: AsyncRead + AsyncWrite> AsyncRead for ZlibEncoder<W> {} /// use flate2::write::ZlibDecoder; /// /// # fn main() { -/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::Default); +/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::default()); /// # e.write(b"Hello World").unwrap(); /// # let bytes = e.finish().unwrap(); /// # println!("{}", decode_reader(bytes).unwrap()); diff --git a/src/vendor/flate2/tests/early-flush.rs b/src/vendor/flate2/tests/early-flush.rs index 70c10673fd..c22f355566 100644 --- a/src/vendor/flate2/tests/early-flush.rs +++ b/src/vendor/flate2/tests/early-flush.rs @@ -7,13 +7,13 @@ use flate2::read::GzDecoder; #[test] fn smoke() { - let mut w = GzEncoder::new(Vec::new(), flate2::Compression::Default); + let mut w = GzEncoder::new(Vec::new(), flate2::Compression::default()); w.flush().unwrap(); w.write(b"hello").unwrap(); let bytes = w.finish().unwrap(); - let mut r = GzDecoder::new(&bytes[..]).unwrap(); + let mut r = GzDecoder::new(&bytes[..]); let mut s = String::new(); r.read_to_string(&mut s).unwrap(); assert_eq!(s, "hello"); diff --git a/src/vendor/flate2/tests/gunzip.rs b/src/vendor/flate2/tests/gunzip.rs index 37dcefe357..c75419bc74 100644 --- a/src/vendor/flate2/tests/gunzip.rs +++ b/src/vendor/flate2/tests/gunzip.rs @@ -45,7 +45,7 @@ fn test_extract_success_multi() { fn extract_file(path_compressed: &Path) -> io::Result<Vec<u8>>{ let mut v = Vec::new(); let f = try!(File::open(path_compressed)); - try!(try!(GzDecoder::new(f)).read_to_end(&mut v)); + try!(GzDecoder::new(f).read_to_end(&mut v)); Ok(v) } @@ -54,6 +54,6 @@ fn extract_file(path_compressed: &Path) -> io::Result<Vec<u8>>{ fn extract_file_multi(path_compressed: &Path) -> io::Result<Vec<u8>>{ let mut v = Vec::new(); let f = try!(File::open(path_compressed)); - try!(try!(MultiGzDecoder::new(f)).read_to_end(&mut v)); + try!(MultiGzDecoder::new(f).read_to_end(&mut v)); Ok(v) } diff --git a/src/vendor/flate2/tests/tokio.rs b/src/vendor/flate2/tests/tokio.rs index 47fb55c12d..3029c83171 100644 --- a/src/vendor/flate2/tests/tokio.rs +++ b/src/vendor/flate2/tests/tokio.rs @@ -45,7 +45,7 @@ fn tcp_stream_echo_pattern() { assert_eq!(b.read(&mut buf).unwrap(), 0); }); - let mut a = write::ZlibEncoder::new(a, Compression::Default); + let mut a = write::ZlibEncoder::new(a, Compression::default()); for i in 0..N { let buf = [i; M]; a.write_all(&buf).unwrap(); @@ -61,7 +61,7 @@ fn tcp_stream_echo_pattern() { let copy = stream.and_then(|s| { let (a, b) = s.split(); let a = read::ZlibDecoder::new(a); - let b = write::DeflateEncoder::new(b, Compression::Default); + let b = write::DeflateEncoder::new(b, Compression::default()); copy(a, b) }).then(|result| { let (amt, _a, b) = result.unwrap(); @@ -99,7 +99,7 @@ fn echo_random() { assert_eq!(b.read(&mut buf).unwrap(), 0); }); - let mut a = write::ZlibEncoder::new(a, Compression::Default); + let mut a = write::ZlibEncoder::new(a, Compression::default()); a.write_all(&v2).unwrap(); a.finish().unwrap() .shutdown(Shutdown::Write).unwrap(); @@ -112,7 +112,7 @@ fn echo_random() { let copy = stream.and_then(|s| { let (a, b) = s.split(); let a = read::ZlibDecoder::new(a); - let b = write::DeflateEncoder::new(b, Compression::Default); + let b = write::DeflateEncoder::new(b, Compression::default()); copy(a, b) }).then(|result| { let (amt, _a, b) = result.unwrap(); diff --git a/src/vendor/flate2/tests/zero-write.rs b/src/vendor/flate2/tests/zero-write.rs index 8174e0c396..f0db86cb8d 100644 --- a/src/vendor/flate2/tests/zero-write.rs +++ b/src/vendor/flate2/tests/zero-write.rs @@ -3,6 +3,6 @@ extern crate flate2; #[test] fn zero_write_is_error() { let mut buf = [0u8]; - let writer = flate2::write::DeflateEncoder::new(&mut buf[..], flate2::Compression::Default); + let writer = flate2::write::DeflateEncoder::new(&mut buf[..], flate2::Compression::default()); assert!(writer.finish().is_err()); } diff --git a/src/vendor/fuchsia-zircon-sys/.cargo-checksum.json b/src/vendor/fuchsia-zircon-sys/.cargo-checksum.json index 3e066d3ee1..b6b116f175 100644 --- a/src/vendor/fuchsia-zircon-sys/.cargo-checksum.json +++ b/src/vendor/fuchsia-zircon-sys/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","BUILD.gn":"862eccf06f706db5af1e0041b10b6b637dbc77257b6c4f536a72fc7d21d3dfb9","Cargo.toml":"d05607413136805977463d1c2b979e7692ea1ac06e051d598de440c64603e886","Cargo.toml.orig":"de5c1ade365052455bf789253dc8940aea4400e6e582ddde026ac85a628de7b4","examples/hello.rs":"66c6a147b98b913fef8e7a7da6387fb735f7f1e2c00abc8794a32a8cf0320851","src/definitions.rs":"0b13b741cad9ba42c1da5b654c6d60f03183a7c79a5843e7734a95b4f934d81f","src/lib.rs":"83c8b96c64b442d72a7b87455f182e6ffef6bf2cd7aa2c0c88db992ac9060bda"},"package":"43f3795b4bae048dc6123a6b972cadde2e676f9ded08aef6bb77f5f157684a82"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","BUILD.gn":"0a1529e038693c7d136f277d0987ccc35ebeaa46e5a8238ebce22da927e51bb2","Cargo.toml":"4e5d164984d16606c69affaa896d13a1303b9cfd5a2b5639875b5902472a28b1","Cargo.toml.orig":"c47e18166f40e7335c75515af420a32e621e0fea89b3028fd5c290ff3dfc5870","examples/hello.rs":"66c6a147b98b913fef8e7a7da6387fb735f7f1e2c00abc8794a32a8cf0320851","src/definitions.rs":"557c48c3ae148158901abbc479cfefe4852141bafb0b926faa8669440bf6123b","src/lib.rs":"a3d9eb3d2243fea31ee2cfd2bf1bbf8ed77e15accf0542f133b83a97c87f6ca7"},"package":"08b3a6f13ad6b96572b53ce7af74543132f1a7055ccceb6d073dd36c54481859"} \ No newline at end of file diff --git a/src/vendor/fuchsia-zircon-sys/BUILD.gn b/src/vendor/fuchsia-zircon-sys/BUILD.gn index 008dee6d8b..dc4701d3f9 100644 --- a/src/vendor/fuchsia-zircon-sys/BUILD.gn +++ b/src/vendor/fuchsia-zircon-sys/BUILD.gn @@ -5,7 +5,5 @@ import("//build/rust/rust_library.gni") rust_library("fuchsia-zircon-sys") { - deps = [ - "//third_party/rust-crates:bitflags-0.7.0", - ] + deps = [] } diff --git a/src/vendor/fuchsia-zircon-sys/Cargo.toml b/src/vendor/fuchsia-zircon-sys/Cargo.toml index 4fd808e6ae..50554bb090 100644 --- a/src/vendor/fuchsia-zircon-sys/Cargo.toml +++ b/src/vendor/fuchsia-zircon-sys/Cargo.toml @@ -12,10 +12,8 @@ [package] name = "fuchsia-zircon-sys" -version = "0.2.0" +version = "0.3.2" authors = ["Raph Levien <raph@google.com>"] description = "Low-level Rust bindings for the Zircon kernel" license = "BSD-3-Clause" repository = "https://fuchsia.googlesource.com/garnet/" -[dependencies.bitflags] -version = "0.7.0" diff --git a/src/vendor/fuchsia-zircon-sys/Cargo.toml.orig b/src/vendor/fuchsia-zircon-sys/Cargo.toml.orig index 4cf0510596..8e91bc9b3d 100644 --- a/src/vendor/fuchsia-zircon-sys/Cargo.toml.orig +++ b/src/vendor/fuchsia-zircon-sys/Cargo.toml.orig @@ -1,10 +1,7 @@ [package] name = "fuchsia-zircon-sys" -version = "0.2.0" +version = "0.3.2" license = "BSD-3-Clause" authors = ["Raph Levien <raph@google.com>"] description = "Low-level Rust bindings for the Zircon kernel" repository = "https://fuchsia.googlesource.com/garnet/" - -[dependencies] -bitflags = "0.7.0" diff --git a/src/vendor/fuchsia-zircon-sys/src/definitions.rs b/src/vendor/fuchsia-zircon-sys/src/definitions.rs index 13586f4b61..956313dc86 100644 --- a/src/vendor/fuchsia-zircon-sys/src/definitions.rs +++ b/src/vendor/fuchsia-zircon-sys/src/definitions.rs @@ -359,14 +359,14 @@ extern { pub fn zx_port_queue( handle: zx_handle_t, - packet: *const u8, + packet: *const zx_port_packet_t, size: usize ) -> zx_status_t; pub fn zx_port_wait( handle: zx_handle_t, deadline: zx_time_t, - packet: *mut u8, + packet: *mut zx_port_packet_t, size: usize ) -> zx_status_t; diff --git a/src/vendor/fuchsia-zircon-sys/src/lib.rs b/src/vendor/fuchsia-zircon-sys/src/lib.rs index a6e7c85784..e9d51f8ad3 100644 --- a/src/vendor/fuchsia-zircon-sys/src/lib.rs +++ b/src/vendor/fuchsia-zircon-sys/src/lib.rs @@ -3,184 +3,227 @@ // found in the LICENSE file. #![allow(non_camel_case_types)] - -#[macro_use] -extern crate bitflags; +#![deny(warnings)] use std::{cmp, fmt}; -pub type zx_handle_t = i32; - -pub type zx_status_t = i32; - -pub type zx_futex_t = isize; pub type zx_addr_t = usize; -pub type zx_paddr_t = usize; -pub type zx_vaddr_t = usize; -pub type zx_off_t = u64; - -// Auto-generated using tools/gen_status.py -pub const ZX_OK : zx_status_t = 0; -pub const ZX_ERR_INTERNAL : zx_status_t = -1; -pub const ZX_ERR_NOT_SUPPORTED : zx_status_t = -2; -pub const ZX_ERR_NO_RESOURCES : zx_status_t = -3; -pub const ZX_ERR_NO_MEMORY : zx_status_t = -4; -pub const ZX_ERR_CALL_FAILED : zx_status_t = -5; -pub const ZX_ERR_INTERRUPTED_RETRY : zx_status_t = -6; -pub const ZX_ERR_INVALID_ARGS : zx_status_t = -10; -pub const ZX_ERR_BAD_HANDLE : zx_status_t = -11; -pub const ZX_ERR_WRONG_TYPE : zx_status_t = -12; -pub const ZX_ERR_BAD_SYSCALL : zx_status_t = -13; -pub const ZX_ERR_OUT_OF_RANGE : zx_status_t = -14; -pub const ZX_ERR_BUFFER_TOO_SMALL : zx_status_t = -15; -pub const ZX_ERR_BAD_STATE : zx_status_t = -20; -pub const ZX_ERR_TIMED_OUT : zx_status_t = -21; -pub const ZX_ERR_SHOULD_WAIT : zx_status_t = -22; -pub const ZX_ERR_CANCELED : zx_status_t = -23; -pub const ZX_ERR_PEER_CLOSED : zx_status_t = -24; -pub const ZX_ERR_NOT_FOUND : zx_status_t = -25; -pub const ZX_ERR_ALREADY_EXISTS : zx_status_t = -26; -pub const ZX_ERR_ALREADY_BOUND : zx_status_t = -27; -pub const ZX_ERR_UNAVAILABLE : zx_status_t = -28; -pub const ZX_ERR_ACCESS_DENIED : zx_status_t = -30; -pub const ZX_ERR_IO : zx_status_t = -40; -pub const ZX_ERR_IO_REFUSED : zx_status_t = -41; -pub const ZX_ERR_IO_DATA_INTEGRITY : zx_status_t = -42; -pub const ZX_ERR_IO_DATA_LOSS : zx_status_t = -43; -pub const ZX_ERR_BAD_PATH : zx_status_t = -50; -pub const ZX_ERR_NOT_DIR : zx_status_t = -51; -pub const ZX_ERR_NOT_FILE : zx_status_t = -52; -pub const ZX_ERR_FILE_BIG : zx_status_t = -53; -pub const ZX_ERR_NO_SPACE : zx_status_t = -54; -pub const ZX_ERR_STOP : zx_status_t = -60; -pub const ZX_ERR_NEXT : zx_status_t = -61; - -pub type zx_time_t = u64; pub type zx_duration_t = u64; -pub const ZX_TIME_INFINITE : zx_time_t = ::std::u64::MAX; - -bitflags! { - #[repr(C)] - pub flags zx_signals_t: u32 { - const ZX_SIGNAL_NONE = 0, - const ZX_OBJECT_SIGNAL_ALL = 0x00ffffff, - const ZX_USER_SIGNAL_ALL = 0xff000000, - const ZX_OBJECT_SIGNAL_0 = 1 << 0, - const ZX_OBJECT_SIGNAL_1 = 1 << 1, - const ZX_OBJECT_SIGNAL_2 = 1 << 2, - const ZX_OBJECT_SIGNAL_3 = 1 << 3, - const ZX_OBJECT_SIGNAL_4 = 1 << 4, - const ZX_OBJECT_SIGNAL_5 = 1 << 5, - const ZX_OBJECT_SIGNAL_6 = 1 << 6, - const ZX_OBJECT_SIGNAL_7 = 1 << 7, - const ZX_OBJECT_SIGNAL_8 = 1 << 8, - const ZX_OBJECT_SIGNAL_9 = 1 << 9, - const ZX_OBJECT_SIGNAL_10 = 1 << 10, - const ZX_OBJECT_SIGNAL_11 = 1 << 11, - const ZX_OBJECT_SIGNAL_12 = 1 << 12, - const ZX_OBJECT_SIGNAL_13 = 1 << 13, - const ZX_OBJECT_SIGNAL_14 = 1 << 14, - const ZX_OBJECT_SIGNAL_15 = 1 << 15, - const ZX_OBJECT_SIGNAL_16 = 1 << 16, - const ZX_OBJECT_SIGNAL_17 = 1 << 17, - const ZX_OBJECT_SIGNAL_18 = 1 << 18, - const ZX_OBJECT_SIGNAL_19 = 1 << 19, - const ZX_OBJECT_SIGNAL_20 = 1 << 20, - const ZX_OBJECT_SIGNAL_21 = 1 << 21, - const ZX_OBJECT_LAST_HANDLE = 1 << 22, - const ZX_OBJECT_HANDLE_CLOSED = 1 << 23, - const ZX_USER_SIGNAL_0 = 1 << 24, - const ZX_USER_SIGNAL_1 = 1 << 25, - const ZX_USER_SIGNAL_2 = 1 << 26, - const ZX_USER_SIGNAL_3 = 1 << 27, - const ZX_USER_SIGNAL_4 = 1 << 28, - const ZX_USER_SIGNAL_5 = 1 << 29, - const ZX_USER_SIGNAL_6 = 1 << 30, - const ZX_USER_SIGNAL_7 = 1 << 31, - - const ZX_OBJECT_READABLE = ZX_OBJECT_SIGNAL_0.bits, - const ZX_OBJECT_WRITABLE = ZX_OBJECT_SIGNAL_1.bits, - const ZX_OBJECT_PEER_CLOSED = ZX_OBJECT_SIGNAL_2.bits, - - // Cancelation (handle was closed while waiting with it) - const ZX_SIGNAL_HANDLE_CLOSED = ZX_OBJECT_HANDLE_CLOSED.bits, - - // Only one user-more reference (handle) to the object exists. - const ZX_SIGNAL_LAST_HANDLE = ZX_OBJECT_LAST_HANDLE.bits, - - // Event - const ZX_EVENT_SIGNALED = ZX_OBJECT_SIGNAL_3.bits, - - // EventPair - const ZX_EPAIR_SIGNALED = ZX_OBJECT_SIGNAL_3.bits, - const ZX_EPAIR_CLOSED = ZX_OBJECT_SIGNAL_2.bits, - - // Task signals (process, thread, job) - const ZX_TASK_TERMINATED = ZX_OBJECT_SIGNAL_3.bits, - - // Channel - const ZX_CHANNEL_READABLE = ZX_OBJECT_SIGNAL_0.bits, - const ZX_CHANNEL_WRITABLE = ZX_OBJECT_SIGNAL_1.bits, - const ZX_CHANNEL_PEER_CLOSED = ZX_OBJECT_SIGNAL_2.bits, - - // Socket - const ZX_SOCKET_READABLE = ZX_OBJECT_SIGNAL_0.bits, - const ZX_SOCKET_WRITABLE = ZX_OBJECT_SIGNAL_1.bits, - const ZX_SOCKET_PEER_CLOSED = ZX_OBJECT_SIGNAL_2.bits, - - // Port - const ZX_PORT_READABLE = ZX_OBJECT_READABLE.bits, - - // Resource - const ZX_RESOURCE_DESTROYED = ZX_OBJECT_SIGNAL_3.bits, - const ZX_RESOURCE_READABLE = ZX_OBJECT_READABLE.bits, - const ZX_RESOURCE_WRITABLE = ZX_OBJECT_WRITABLE.bits, - const ZX_RESOURCE_CHILD_ADDED = ZX_OBJECT_SIGNAL_4.bits, - - // Fifo - const ZX_FIFO_READABLE = ZX_OBJECT_READABLE.bits, - const ZX_FIFO_WRITABLE = ZX_OBJECT_WRITABLE.bits, - const ZX_FIFO_PEER_CLOSED = ZX_OBJECT_PEER_CLOSED.bits, - - // Job - const ZX_JOB_NO_PROCESSES = ZX_OBJECT_SIGNAL_3.bits, - const ZX_JOB_NO_JOBS = ZX_OBJECT_SIGNAL_4.bits, - - // Process - const ZX_PROCESS_TERMINATED = ZX_OBJECT_SIGNAL_3.bits, - - // Thread - const ZX_THREAD_TERMINATED = ZX_OBJECT_SIGNAL_3.bits, - - // Log - const ZX_LOG_READABLE = ZX_OBJECT_READABLE.bits, - const ZX_LOG_WRITABLE = ZX_OBJECT_WRITABLE.bits, - - // Timer - const ZX_TIMER_SIGNALED = ZX_OBJECT_SIGNAL_3.bits, - } -} - +pub type zx_futex_t = i32; +pub type zx_handle_t = u32; +pub type zx_off_t = u64; +pub type zx_paddr_t = usize; +pub type zx_rights_t = u32; +pub type zx_signals_t = u32; pub type zx_size_t = usize; pub type zx_ssize_t = isize; +pub type zx_status_t = i32; +pub type zx_time_t = u64; +pub type zx_vaddr_t = usize; -bitflags! { - #[repr(C)] - pub flags zx_rights_t: u32 { - const ZX_RIGHT_NONE = 0, - const ZX_RIGHT_DUPLICATE = 1 << 0, - const ZX_RIGHT_TRANSFER = 1 << 1, - const ZX_RIGHT_READ = 1 << 2, - const ZX_RIGHT_WRITE = 1 << 3, - const ZX_RIGHT_EXECUTE = 1 << 4, - const ZX_RIGHT_MAP = 1 << 5, - const ZX_RIGHT_GET_PROPERTY = 1 << 6, - const ZX_RIGHT_SET_PROPERTY = 1 << 7, - const ZX_RIGHT_DEBUG = 1 << 8, - const ZX_RIGHT_SAME_RIGHTS = 1 << 31, +// TODO: combine these macros with the bitflags and assoc consts macros below +// so that we only have to do one macro invocation. +// The result would look something like: +// multiconst!(bitflags, zx_rights_t, Rights, [RIGHT_NONE => ZX_RIGHT_NONE = 0; ...]); +// multiconst!(assoc_consts, zx_status_t, Status, [OK => ZX_OK = 0; ...]); +// Note that the actual name of the inner macro (e.g. `bitflags`) can't be a variable. +// It'll just have to be matched on manually +macro_rules! multiconst { + ($typename:ident, [$($rawname:ident = $value:expr;)*]) => { + $( + pub const $rawname: $typename = $value; + )* } } +multiconst!(zx_handle_t, [ + ZX_HANDLE_INVALID = 0; +]); + +multiconst!(zx_time_t, [ + ZX_TIME_INFINITE = ::std::u64::MAX; +]); + +multiconst!(zx_rights_t, [ + ZX_RIGHT_NONE = 0; + ZX_RIGHT_DUPLICATE = 1 << 0; + ZX_RIGHT_TRANSFER = 1 << 1; + ZX_RIGHT_READ = 1 << 2; + ZX_RIGHT_WRITE = 1 << 3; + ZX_RIGHT_EXECUTE = 1 << 4; + ZX_RIGHT_MAP = 1 << 5; + ZX_RIGHT_GET_PROPERTY = 1 << 6; + ZX_RIGHT_SET_PROPERTY = 1 << 7; + ZX_RIGHT_ENUMERATE = 1 << 8; + ZX_RIGHT_DESTROY = 1 << 9; + ZX_RIGHT_SET_POLICY = 1 << 10; + ZX_RIGHT_GET_POLICY = 1 << 11; + ZX_RIGHT_SIGNAL = 1 << 12; + ZX_RIGHT_SIGNAL_PEER = 1 << 13; + ZX_RIGHT_WAIT = 0 << 14; // Coming Soon! + ZX_RIGHT_SAME_RIGHTS = 1 << 31; +]); + +// TODO: add an alias for this type in the C headers. +multiconst!(u32, [ + ZX_VMO_OP_COMMIT = 1; + ZX_VMO_OP_DECOMMIT = 2; + ZX_VMO_OP_LOCK = 3; + ZX_VMO_OP_UNLOCK = 4; + ZX_VMO_OP_LOOKUP = 5; + ZX_VMO_OP_CACHE_SYNC = 6; + ZX_VMO_OP_CACHE_INVALIDATE = 7; + ZX_VMO_OP_CACHE_CLEAN = 8; + ZX_VMO_OP_CACHE_CLEAN_INVALIDATE = 9; +]); + +// TODO: add an alias for this type in the C headers. +multiconst!(u32, [ + ZX_VM_FLAG_PERM_READ = 1 << 0; + ZX_VM_FLAG_PERM_WRITE = 1 << 1; + ZX_VM_FLAG_PERM_EXECUTE = 1 << 2; + ZX_VM_FLAG_COMPACT = 1 << 3; + ZX_VM_FLAG_SPECIFIC = 1 << 4; + ZX_VM_FLAG_SPECIFIC_OVERWRITE = 1 << 5; + ZX_VM_FLAG_CAN_MAP_SPECIFIC = 1 << 6; + ZX_VM_FLAG_CAN_MAP_READ = 1 << 7; + ZX_VM_FLAG_CAN_MAP_WRITE = 1 << 8; + ZX_VM_FLAG_CAN_MAP_EXECUTE = 1 << 9; +]); + +multiconst!(zx_status_t, [ + ZX_OK = 0; + ZX_ERR_INTERNAL = -1; + ZX_ERR_NOT_SUPPORTED = -2; + ZX_ERR_NO_RESOURCES = -3; + ZX_ERR_NO_MEMORY = -4; + ZX_ERR_CALL_FAILED = -5; + ZX_ERR_INTERRUPTED_RETRY = -6; + ZX_ERR_INVALID_ARGS = -10; + ZX_ERR_BAD_HANDLE = -11; + ZX_ERR_WRONG_TYPE = -12; + ZX_ERR_BAD_SYSCALL = -13; + ZX_ERR_OUT_OF_RANGE = -14; + ZX_ERR_BUFFER_TOO_SMALL = -15; + ZX_ERR_BAD_STATE = -20; + ZX_ERR_TIMED_OUT = -21; + ZX_ERR_SHOULD_WAIT = -22; + ZX_ERR_CANCELED = -23; + ZX_ERR_PEER_CLOSED = -24; + ZX_ERR_NOT_FOUND = -25; + ZX_ERR_ALREADY_EXISTS = -26; + ZX_ERR_ALREADY_BOUND = -27; + ZX_ERR_UNAVAILABLE = -28; + ZX_ERR_ACCESS_DENIED = -30; + ZX_ERR_IO = -40; + ZX_ERR_IO_REFUSED = -41; + ZX_ERR_IO_DATA_INTEGRITY = -42; + ZX_ERR_IO_DATA_LOSS = -43; + ZX_ERR_BAD_PATH = -50; + ZX_ERR_NOT_DIR = -51; + ZX_ERR_NOT_FILE = -52; + ZX_ERR_FILE_BIG = -53; + ZX_ERR_NO_SPACE = -54; + ZX_ERR_STOP = -60; + ZX_ERR_NEXT = -61; +]); + +multiconst!(zx_signals_t, [ + ZX_SIGNAL_NONE = 0; + ZX_OBJECT_SIGNAL_ALL = 0x00ffffff; + ZX_USER_SIGNAL_ALL = 0xff000000; + ZX_OBJECT_SIGNAL_0 = 1 << 0; + ZX_OBJECT_SIGNAL_1 = 1 << 1; + ZX_OBJECT_SIGNAL_2 = 1 << 2; + ZX_OBJECT_SIGNAL_3 = 1 << 3; + ZX_OBJECT_SIGNAL_4 = 1 << 4; + ZX_OBJECT_SIGNAL_5 = 1 << 5; + ZX_OBJECT_SIGNAL_6 = 1 << 6; + ZX_OBJECT_SIGNAL_7 = 1 << 7; + ZX_OBJECT_SIGNAL_8 = 1 << 8; + ZX_OBJECT_SIGNAL_9 = 1 << 9; + ZX_OBJECT_SIGNAL_10 = 1 << 10; + ZX_OBJECT_SIGNAL_11 = 1 << 11; + ZX_OBJECT_SIGNAL_12 = 1 << 12; + ZX_OBJECT_SIGNAL_13 = 1 << 13; + ZX_OBJECT_SIGNAL_14 = 1 << 14; + ZX_OBJECT_SIGNAL_15 = 1 << 15; + ZX_OBJECT_SIGNAL_16 = 1 << 16; + ZX_OBJECT_SIGNAL_17 = 1 << 17; + ZX_OBJECT_SIGNAL_18 = 1 << 18; + ZX_OBJECT_SIGNAL_19 = 1 << 19; + ZX_OBJECT_SIGNAL_20 = 1 << 20; + ZX_OBJECT_SIGNAL_21 = 1 << 21; + ZX_OBJECT_SIGNAL_22 = 1 << 22; + ZX_OBJECT_HANDLE_CLOSED = 1 << 23; + ZX_USER_SIGNAL_0 = 1 << 24; + ZX_USER_SIGNAL_1 = 1 << 25; + ZX_USER_SIGNAL_2 = 1 << 26; + ZX_USER_SIGNAL_3 = 1 << 27; + ZX_USER_SIGNAL_4 = 1 << 28; + ZX_USER_SIGNAL_5 = 1 << 29; + ZX_USER_SIGNAL_6 = 1 << 30; + ZX_USER_SIGNAL_7 = 1 << 31; + + ZX_OBJECT_READABLE = ZX_OBJECT_SIGNAL_0; + ZX_OBJECT_WRITABLE = ZX_OBJECT_SIGNAL_1; + ZX_OBJECT_PEER_CLOSED = ZX_OBJECT_SIGNAL_2; + + // Cancelation (handle was closed while waiting with it) + ZX_SIGNAL_HANDLE_CLOSED = ZX_OBJECT_HANDLE_CLOSED; + + // Event + ZX_EVENT_SIGNALED = ZX_OBJECT_SIGNAL_3; + + // EventPair + ZX_EPAIR_SIGNALED = ZX_OBJECT_SIGNAL_3; + ZX_EPAIR_CLOSED = ZX_OBJECT_SIGNAL_2; + + // Task signals (process, thread, job) + ZX_TASK_TERMINATED = ZX_OBJECT_SIGNAL_3; + + // Channel + ZX_CHANNEL_READABLE = ZX_OBJECT_SIGNAL_0; + ZX_CHANNEL_WRITABLE = ZX_OBJECT_SIGNAL_1; + ZX_CHANNEL_PEER_CLOSED = ZX_OBJECT_SIGNAL_2; + + // Socket + ZX_SOCKET_READABLE = ZX_OBJECT_SIGNAL_0; + ZX_SOCKET_WRITABLE = ZX_OBJECT_SIGNAL_1; + ZX_SOCKET_PEER_CLOSED = ZX_OBJECT_SIGNAL_2; + + // Port + ZX_PORT_READABLE = ZX_OBJECT_READABLE; + + // Resource + ZX_RESOURCE_DESTROYED = ZX_OBJECT_SIGNAL_3; + ZX_RESOURCE_READABLE = ZX_OBJECT_READABLE; + ZX_RESOURCE_WRITABLE = ZX_OBJECT_WRITABLE; + ZX_RESOURCE_CHILD_ADDED = ZX_OBJECT_SIGNAL_4; + + // Fifo + ZX_FIFO_READABLE = ZX_OBJECT_READABLE; + ZX_FIFO_WRITABLE = ZX_OBJECT_WRITABLE; + ZX_FIFO_PEER_CLOSED = ZX_OBJECT_PEER_CLOSED; + + // Job + ZX_JOB_NO_PROCESSES = ZX_OBJECT_SIGNAL_3; + ZX_JOB_NO_JOBS = ZX_OBJECT_SIGNAL_4; + + // Process + ZX_PROCESS_TERMINATED = ZX_OBJECT_SIGNAL_3; + + // Thread + ZX_THREAD_TERMINATED = ZX_OBJECT_SIGNAL_3; + + // Log + ZX_LOG_READABLE = ZX_OBJECT_READABLE; + ZX_LOG_WRITABLE = ZX_OBJECT_WRITABLE; + + // Timer + ZX_TIMER_SIGNALED = ZX_OBJECT_SIGNAL_3; +]); + // clock ids pub const ZX_CLOCK_MONOTONIC: u32 = 0; @@ -191,38 +234,9 @@ pub const ZX_CPRNG_ADD_ENTROPY_MAX_LEN: usize = 256; // Socket flags and limits. pub const ZX_SOCKET_HALF_CLOSE: u32 = 1; -// VM Object opcodes -pub const ZX_VMO_OP_COMMIT: u32 = 1; -pub const ZX_VMO_OP_DECOMMIT: u32 = 2; -pub const ZX_VMO_OP_LOCK: u32 = 3; -pub const ZX_VMO_OP_UNLOCK: u32 = 4; -pub const ZX_VMO_OP_LOOKUP: u32 = 5; -pub const ZX_VMO_OP_CACHE_SYNC: u32 = 6; -pub const ZX_VMO_OP_CACHE_INVALIDATE: u32 = 7; -pub const ZX_VMO_OP_CACHE_CLEAN: u32 = 8; -pub const ZX_VMO_OP_CACHE_CLEAN_INVALIDATE: u32 = 9; - // VM Object clone flags pub const ZX_VMO_CLONE_COPY_ON_WRITE: u32 = 1; -// Mapping flags to vmar routines -bitflags! { - #[repr(C)] - pub flags zx_vmar_flags_t: u32 { - // flags to vmar routines - const ZX_VM_FLAG_PERM_READ = 1 << 0, - const ZX_VM_FLAG_PERM_WRITE = 1 << 1, - const ZX_VM_FLAG_PERM_EXECUTE = 1 << 2, - const ZX_VM_FLAG_COMPACT = 1 << 3, - const ZX_VM_FLAG_SPECIFIC = 1 << 4, - const ZX_VM_FLAG_SPECIFIC_OVERWRITE = 1 << 5, - const ZX_VM_FLAG_CAN_MAP_SPECIFIC = 1 << 6, - const ZX_VM_FLAG_CAN_MAP_READ = 1 << 7, - const ZX_VM_FLAG_CAN_MAP_WRITE = 1 << 8, - const ZX_VM_FLAG_CAN_MAP_EXECUTE = 1 << 9, - } -} - #[repr(C)] #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum zx_cache_policy_t { @@ -457,4 +471,4 @@ pub struct zx_vcpu_create_args_t { pub ip: zx_vaddr_t, } -include!("definitions.rs"); \ No newline at end of file +include!("definitions.rs"); diff --git a/src/vendor/fuchsia-zircon/.cargo-checksum.json b/src/vendor/fuchsia-zircon/.cargo-checksum.json index de5f5f13cc..c9dd516486 100644 --- a/src/vendor/fuchsia-zircon/.cargo-checksum.json +++ b/src/vendor/fuchsia-zircon/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","BUILD.gn":"1d49d75a432f5b4587b59a50a9b86a21e2a3faf1fff60876b4e486e43cffca35","Cargo.toml":"263dce41c44c34a70fb9803acbfb77c1801ff2b23f0fa46bb2c90f14f33f0ac9","Cargo.toml.orig":"fde52eb95081c4500cf0a16b92a60f5e0cb8576c10def43f7e5667c834d002d6","LICENSE":"f82f9062a6dff28145c185f90f94c485eebdc2bb4c6f1c840513709e6d228453","README.md":"f4bff6efc5d888460e2d1eaf62fa0eaca8afe7b51df528ad7829340ec397b32c","examples/BUILD.gn":"fb7a491a26e5f3d48b8796db80d475be2d361bada7311213363dcce4efa9d4fc","src/channel.rs":"0b3c3761a831c9211e327f5332e58becc287cf2444b44164a4f680dc5bdded50","src/event.rs":"9b11c6c0c9fcdbe4e45c03f4a671ef66c31a1be540d3f50a5d0602314fdc1294","src/eventpair.rs":"aca1c6a15450badbfe71c33e287bab8aa05d6fff5968513b191436b853929ca8","src/fifo.rs":"ecc49463cc28713c1375ecafc8008b806767417da72fcc8685b42078ec0308df","src/job.rs":"827db2e4ea1bbf5ecabec9fb279f2721792032e4223b6bd15b56922d80c7ac01","src/lib.rs":"5bc01f9c7d1f3316826bf86cc5c8488523ca7f2ad2a58a8b539c3b49aed3f1a2","src/port.rs":"695aa7114d88d476954fde689180502f22ea6b70339855ebff89dce6694abb9e","src/process.rs":"0b5e42c4eb79b2a7fff9c70f0d99c8b805cefab99285e94fabf2542290b4b990","src/socket.rs":"6e8b799a8f605d42681660129989c9c6427b9039b83de9954c61aa351596218f","src/thread.rs":"d703414c440b5fa597dbafe7b8be925a94d1fe0cf8b47366c786b45eaaec4c60","src/timer.rs":"8fc50736e6a928cabccf78b18aec3e57ac7e5a57c1c519a1cd34158f59e1ff65","src/vmo.rs":"0f219777d5abffcfbc49a43f7eff3ef92b854d1d964579dc9a01d33ba57341c1","tools/BUILD.gn":"f4ce07b2906e6cde15a9d2ec253c58fbfe88ea1819083f864c154a0f1c50c14f","tools/README.md":"0217d58913c32b7e8aa231da852d96307d8387f99e2352a026196150cb180d07","tools/clang_wrapper.cc":"c62dcc1f71cab03f7e215c8800d798bd05af56fa7510ea8d59d6b15dce2b6a6f","tools/gen_status.py":"a2330db86564e12412af2dce60d4c605c0ab203fcdea8039d5c6a8e7f218a3c3"},"package":"f6c0581a4e363262e52b87f59ee2afe3415361c6ec35e665924eb08afe8ff159"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","BUILD.gn":"651b841730c01aa677f22906fd5eee96234a01d13139e4be12943698dd486a17","Cargo.toml":"214bcb9c80d8a0159e7445d1cfcd3e23a3a8f2b5568936ae90c49ed6d3e91601","Cargo.toml.orig":"53869ba8ff49774daa0c7641533a01a9509753d9616ce798f9fbc614a2565263","LICENSE":"f82f9062a6dff28145c185f90f94c485eebdc2bb4c6f1c840513709e6d228453","README.md":"f4bff6efc5d888460e2d1eaf62fa0eaca8afe7b51df528ad7829340ec397b32c","examples/BUILD.gn":"dd0eed1f081c593a3c367a20c4b81f9fe2855ae398ab2b2de83fdaa32c983905","src/channel.rs":"5d5aafc0ca04405f2c2b2b506a7f9b2d0af84cefe3ea092f0e4281fae5789fce","src/cprng.rs":"cd8a163f7e5e75e536ee898a00c1c377b10c748c7dc574c7c3582bb86fdc86c5","src/event.rs":"bbf0c91d154f01ec1618182efbaaa8c71580f05a807cac1d12208b5cbe8f6b74","src/eventpair.rs":"0bf0b1137c2fb08398edb4d09b89ded5990d07f94ffe55b6ec917c7bc9059ebe","src/fifo.rs":"9ac29d11330fdea847902b8dba6b2004ad44878d8ef65d26a197780cd443ebb8","src/handle.rs":"8741c4b5056a200cfb4237af2d2d2c1db083075b112df68166e351e6d81eb3f3","src/job.rs":"827db2e4ea1bbf5ecabec9fb279f2721792032e4223b6bd15b56922d80c7ac01","src/lib.rs":"748e2a4b6db583cd84c71930c99e8925b3f0e144eaddc43ff3c23267a8d4b71b","src/port.rs":"32501f17218ec9ad4d97741f4ff2d5ca8e89b7da7226473c82441fd06adbecc4","src/process.rs":"0b5e42c4eb79b2a7fff9c70f0d99c8b805cefab99285e94fabf2542290b4b990","src/rights.rs":"679422da3c0ff9f4e4928b8f41098ef0f5ec09af098496e088e2bac82fc9568d","src/signals.rs":"c07501df58b3c6264e37ebc0f5fd28f44ced040273a5ab5e839e3a204d351ea7","src/socket.rs":"cfb2f6ecb5ba9d9e354c18088061d6e5330dd420a20d0ced4a11f05d3332e3b8","src/status.rs":"4831adf17c1fbd4d52a0aacc63eebd98e49f6c0e28c407e8a0e40f380b3f3b2b","src/thread.rs":"d703414c440b5fa597dbafe7b8be925a94d1fe0cf8b47366c786b45eaaec4c60","src/time.rs":"10f2d2b6a4709f063525f6ad4b62941d12564e94df33c0b911dbe3fef5399f0c","src/vmar.rs":"e69a51287e3cb016fa39bb8d884c88ffba4799a452c17e881af9d63a507b37f7","src/vmo.rs":"377968eec57b79a7f4b117dff2f59f26a57ba97ca7f2f0334bd27b99fe87b299","tools/gen_status.py":"a2330db86564e12412af2dce60d4c605c0ab203fcdea8039d5c6a8e7f218a3c3"},"package":"bd510087c325af53ba24f3be8f1c081b0982319adcb8b03cad764512923ccc19"} \ No newline at end of file diff --git a/src/vendor/fuchsia-zircon/BUILD.gn b/src/vendor/fuchsia-zircon/BUILD.gn index f09705660e..1edb419d8f 100644 --- a/src/vendor/fuchsia-zircon/BUILD.gn +++ b/src/vendor/fuchsia-zircon/BUILD.gn @@ -7,6 +7,7 @@ import("//build/rust/rust_library.gni") rust_library("fuchsia-zircon") { deps = [ "//garnet/public/rust/crates/fuchsia-zircon/fuchsia-zircon-sys", + "//third_party/rust-crates:bitflags-0.7.0", ] with_tests = true diff --git a/src/vendor/fuchsia-zircon/Cargo.toml b/src/vendor/fuchsia-zircon/Cargo.toml index d8f9b47a7f..828c2acf94 100644 --- a/src/vendor/fuchsia-zircon/Cargo.toml +++ b/src/vendor/fuchsia-zircon/Cargo.toml @@ -12,10 +12,13 @@ [package] name = "fuchsia-zircon" -version = "0.2.1" +version = "0.3.2" authors = ["Raph Levien <raph@google.com>"] description = "Rust bindings for the Zircon kernel" license = "BSD-3-Clause" repository = "https://fuchsia.googlesource.com/garnet/" +[dependencies.bitflags] +version = "1.0.0" + [dependencies.fuchsia-zircon-sys] -version = "0.2.0" +version = "0.3.2" diff --git a/src/vendor/fuchsia-zircon/Cargo.toml.orig b/src/vendor/fuchsia-zircon/Cargo.toml.orig index 516f84aa63..c0c1c15448 100644 --- a/src/vendor/fuchsia-zircon/Cargo.toml.orig +++ b/src/vendor/fuchsia-zircon/Cargo.toml.orig @@ -1,10 +1,11 @@ [package] name = "fuchsia-zircon" -version = "0.2.1" +version = "0.3.2" license = "BSD-3-Clause" authors = ["Raph Levien <raph@google.com>"] description = "Rust bindings for the Zircon kernel" repository = "https://fuchsia.googlesource.com/garnet/" [dependencies] -fuchsia-zircon-sys = { path = "fuchsia-zircon-sys", version = "0.2.0" } +bitflags = "1.0.0" +fuchsia-zircon-sys = { version = "0.3.2", path = "fuchsia-zircon-sys" } diff --git a/src/vendor/fuchsia-zircon/examples/BUILD.gn b/src/vendor/fuchsia-zircon/examples/BUILD.gn index d2f0125c8e..41207ecca1 100644 --- a/src/vendor/fuchsia-zircon/examples/BUILD.gn +++ b/src/vendor/fuchsia-zircon/examples/BUILD.gn @@ -2,8 +2,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -group("examples") { +import("//packages/package.gni") + +package("zircon_rust_examples") { + system_image = true + deps = [ - "//garnet/public/rust/crates/fuchsia-zircon/examples/zx_toy", + "zx_toy", ] + + binaries = [ { + name = "example_zx_toy" + } ] } diff --git a/src/vendor/fuchsia-zircon/src/channel.rs b/src/vendor/fuchsia-zircon/src/channel.rs index 7f558309cc..28a535f268 100644 --- a/src/vendor/fuchsia-zircon/src/channel.rs +++ b/src/vendor/fuchsia-zircon/src/channel.rs @@ -4,8 +4,8 @@ //! Type-safe bindings for Zircon channel objects. -use {AsHandleRef, HandleBased, Handle, HandleRef, INVALID_HANDLE, Peered, Status, Time, usize_into_u32, size_to_u32_sat}; -use {sys, handle_drop, into_result}; +use {AsHandleRef, HandleBased, Handle, HandleRef, Peered, Status, Time, usize_into_u32, size_to_u32_sat}; +use {sys, ok}; use std::mem; /// An object representing a Zircon @@ -24,14 +24,16 @@ impl Channel { /// Wraps the /// [zx_channel_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/channel_create.md) /// syscall. - pub fn create(opts: ChannelOpts) -> Result<(Channel, Channel), Status> { + pub fn create() -> Result<(Channel, Channel), Status> { unsafe { let mut handle0 = 0; let mut handle1 = 0; - let status = sys::zx_channel_create(opts as u32, &mut handle0, &mut handle1); - into_result(status, || - (Self::from(Handle(handle0)), - Self::from(Handle(handle1)))) + let opts = 0; + ok(sys::zx_channel_create(opts, &mut handle0, &mut handle1))?; + Ok(( + Self::from(Handle::from_raw(handle0)), + Self::from(Handle::from_raw(handle1)) + )) } } @@ -42,21 +44,22 @@ impl Channel { /// If the `MessageBuf` lacks the capacity to hold the pending message, /// returns an `Err` with the number of bytes and number of handles needed. /// Otherwise returns an `Ok` with the result as usual. - pub fn read_raw(&self, opts: u32, buf: &mut MessageBuf) + pub fn read_raw(&self, buf: &mut MessageBuf) -> Result<Result<(), Status>, (usize, usize)> { + let opts = 0; unsafe { - buf.reset_handles(); + buf.clear(); let raw_handle = self.raw_handle(); let mut num_bytes: u32 = size_to_u32_sat(buf.bytes.capacity()); let mut num_handles: u32 = size_to_u32_sat(buf.handles.capacity()); - let status = sys::zx_channel_read(raw_handle, opts, - buf.bytes.as_mut_ptr(), buf.handles.as_mut_ptr(), - num_bytes, num_handles, &mut num_bytes, &mut num_handles); - if status == sys::ZX_ERR_BUFFER_TOO_SMALL { + let status = ok(sys::zx_channel_read(raw_handle, opts, + buf.bytes.as_mut_ptr(), buf.handles.as_mut_ptr() as *mut _, + num_bytes, num_handles, &mut num_bytes, &mut num_handles)); + if status == Err(Status::BUFFER_TOO_SMALL) { Err((num_bytes as usize, num_handles as usize)) } else { - Ok(into_result(status, || { + Ok(status.map(|()| { buf.bytes.set_len(num_bytes as usize); buf.handles.set_len(num_handles as usize); })) @@ -69,9 +72,9 @@ impl Channel { /// Note that this method can cause internal reallocations in the `MessageBuf` /// if it is lacks capacity to hold the full message. If such reallocations /// are not desirable, use `read_raw` instead. - pub fn read(&self, opts: u32, buf: &mut MessageBuf) -> Result<(), Status> { + pub fn read(&self, buf: &mut MessageBuf) -> Result<(), Status> { loop { - match self.read_raw(opts, buf) { + match self.read_raw(buf) { Ok(result) => return result, Err((num_bytes, num_handles)) => { buf.ensure_capacity_bytes(num_bytes); @@ -84,18 +87,19 @@ impl Channel { /// Write a message to a channel. Wraps the /// [zx_channel_write](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/channel_write.md) /// syscall. - pub fn write(&self, bytes: &[u8], handles: &mut Vec<Handle>, opts: u32) + pub fn write(&self, bytes: &[u8], handles: &mut Vec<Handle>) -> Result<(), Status> { - let n_bytes = try!(usize_into_u32(bytes.len()).map_err(|_| Status::ErrOutOfRange)); - let n_handles = try!(usize_into_u32(handles.len()).map_err(|_| Status::ErrOutOfRange)); + let opts = 0; + let n_bytes = try!(usize_into_u32(bytes.len()).map_err(|_| Status::OUT_OF_RANGE)); + let n_handles = try!(usize_into_u32(handles.len()).map_err(|_| Status::OUT_OF_RANGE)); unsafe { let status = sys::zx_channel_write(self.raw_handle(), opts, bytes.as_ptr(), n_bytes, handles.as_ptr() as *const sys::zx_handle_t, n_handles); - into_result(status, || { - // Handles were successfully transferred, forget them on sender side - handles.set_len(0); - }) + ok(status)?; + // Handles were successfully transferred, forget them on sender side + handles.set_len(0); + Ok(()) } } @@ -113,21 +117,21 @@ impl Channel { /// On failure returns the both the main and read status. /// /// [read]: struct.Channel.html#method.read - pub fn call(&self, options: u32, timeout: Time, bytes: &[u8], handles: &mut Vec<Handle>, + pub fn call(&self, timeout: Time, bytes: &[u8], handles: &mut Vec<Handle>, buf: &mut MessageBuf) -> Result<(), (Status, Status)> { let write_num_bytes = try!(usize_into_u32(bytes.len()).map_err( - |_| (Status::ErrOutOfRange, Status::NoError))); + |_| (Status::OUT_OF_RANGE, Status::OK))); let write_num_handles = try!(usize_into_u32(handles.len()).map_err( - |_| (Status::ErrOutOfRange, Status::NoError))); - buf.reset_handles(); + |_| (Status::OUT_OF_RANGE, Status::OK))); + buf.clear(); let read_num_bytes: u32 = size_to_u32_sat(buf.bytes.capacity()); let read_num_handles: u32 = size_to_u32_sat(buf.handles.capacity()); let args = sys::zx_channel_call_args_t { wr_bytes: bytes.as_ptr(), wr_handles: handles.as_ptr() as *const sys::zx_handle_t, rd_bytes: buf.bytes.as_mut_ptr(), - rd_handles: buf.handles.as_mut_ptr(), + rd_handles: buf.handles.as_mut_ptr() as *mut _, wr_num_bytes: write_num_bytes, wr_num_handles: write_num_handles, rd_num_bytes: read_num_bytes, @@ -135,40 +139,64 @@ impl Channel { }; let mut actual_read_bytes: u32 = 0; let mut actual_read_handles: u32 = 0; - let mut read_status = sys::ZX_OK; + let mut read_status = Status::OK.into_raw(); + let options = 0; let status = unsafe { - sys::zx_channel_call(self.raw_handle(), options, timeout, &args, &mut actual_read_bytes, - &mut actual_read_handles, &mut read_status) + Status::from_raw( + sys::zx_channel_call( + self.raw_handle(), options, timeout.nanos(), &args, &mut actual_read_bytes, + &mut actual_read_handles, &mut read_status)) }; - if status == sys::ZX_OK || status == sys::ZX_ERR_TIMED_OUT || status == sys::ZX_ERR_CALL_FAILED - { - // Handles were successfully transferred, even if we didn't get a response, so forget - // them on the sender side. - unsafe { handles.set_len(0); } + + match status { + Status::OK | + Status::TIMED_OUT | + Status::CALL_FAILED => { + // Handles were successfully transferred, + // even if we didn't get a response, so forget + // them on the sender side. + unsafe { handles.set_len(0); } + } + _ => {} } + unsafe { buf.bytes.set_len(actual_read_bytes as usize); buf.handles.set_len(actual_read_handles as usize); } - if status == sys::ZX_OK { + if Status::OK == status { Ok(()) } else { - Err((Status::from_raw(status), Status::from_raw(read_status))) + Err((status, Status::from_raw(read_status))) } } } -/// Options for creating a channel. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum ChannelOpts { - /// A normal channel. - Normal = 0, +#[test] +pub fn test_handle_repr() { + assert_eq!(::std::mem::size_of::<sys::zx_handle_t>(), 4); + assert_eq!(::std::mem::size_of::<Handle>(), 4); + assert_eq!(::std::mem::align_of::<sys::zx_handle_t>(), ::std::mem::align_of::<Handle>()); + + // This test asserts that repr(transparent) still works for Handle -> zx_handle_t + + let n: Vec<sys::zx_handle_t> = vec![0, 100, 2<<32-1]; + let v: Vec<Handle> = n.iter().map(|h| unsafe { Handle::from_raw(*h) } ).collect(); + + for (handle, raw) in v.iter().zip(n.iter()) { + unsafe { + assert_eq!(*(handle as *const _ as *const [u8; 4]), *(raw as *const _ as *const [u8; 4])); + } + } + + for h in v.into_iter() { + ::std::mem::forget(h); + } } -impl Default for ChannelOpts { - fn default() -> Self { - ChannelOpts::Normal +impl AsRef<Channel> for Channel { + fn as_ref(&self) -> &Self { + &self } } @@ -183,7 +211,7 @@ impl Default for ChannelOpts { #[derive(Debug)] pub struct MessageBuf { bytes: Vec<u8>, - handles: Vec<sys::zx_handle_t>, + handles: Vec<Handle>, } impl MessageBuf { @@ -192,6 +220,14 @@ impl MessageBuf { Default::default() } + /// Create a new non-empty message buffer. + pub fn new_with(v: Vec<u8>, h: Vec<Handle>) -> Self { + Self{ + bytes: v, + handles: h, + } + } + /// Ensure that the buffer has the capacity to hold at least `n_bytes` bytes. pub fn ensure_capacity_bytes(&mut self, n_bytes: usize) { ensure_capacity(&mut self.bytes, n_bytes); @@ -202,6 +238,14 @@ impl MessageBuf { ensure_capacity(&mut self.handles, n_handles); } + /// Ensure that at least n_bytes bytes are initialized (0 fill). + pub fn ensure_initialized_bytes(&mut self, n_bytes: usize) { + if n_bytes <= self.bytes.len() { + return; + } + self.bytes.resize(n_bytes, 0); + } + /// Get a reference to the bytes of the message buffer, as a `&[u8]` slice. pub fn bytes(&self) -> &[u8] { self.bytes.as_slice() @@ -218,35 +262,23 @@ impl MessageBuf { /// method is called again with the same index, it will return `None`, as /// will happen if the index exceeds the number of handles available. pub fn take_handle(&mut self, index: usize) -> Option<Handle> { - self.handles.get_mut(index).and_then(|handleref| - if *handleref == INVALID_HANDLE { + self.handles.get_mut(index).and_then(|handle| + if handle.is_invalid() { None } else { - Some(Handle(mem::replace(handleref, INVALID_HANDLE))) + Some(mem::replace(handle, Handle::invalid())) } ) } - fn drop_handles(&mut self) { - for &handle in &self.handles { - if handle != 0 { - handle_drop(handle); - } - } - } - - fn reset_handles(&mut self) { - self.drop_handles(); + /// Clear the bytes and handles contained in the buf. This will drop any + /// contained handles, resulting in their resources being freed. + pub fn clear(&mut self) { + self.bytes.clear(); self.handles.clear(); } } -impl Drop for MessageBuf { - fn drop(&mut self) { - self.drop_handles(); - } -} - fn ensure_capacity<T>(vec: &mut Vec<T>, size: usize) { let len = vec.len(); if size > len { @@ -257,31 +289,30 @@ fn ensure_capacity<T>(vec: &mut Vec<T>, size: usize) { #[cfg(test)] mod tests { use super::*; - use {Duration, ZX_CHANNEL_READABLE, ZX_CHANNEL_WRITABLE, ZX_RIGHT_SAME_RIGHTS, ZX_SIGNAL_LAST_HANDLE, Vmo, VmoOpts}; - use deadline_after; + use {DurationNum, Rights, Signals, Vmo}; use std::thread; #[test] fn channel_basic() { - let (p1, p2) = Channel::create(ChannelOpts::Normal).unwrap(); + let (p1, p2) = Channel::create().unwrap(); let mut empty = vec![]; - assert!(p1.write(b"hello", &mut empty, 0).is_ok()); + assert!(p1.write(b"hello", &mut empty).is_ok()); let mut buf = MessageBuf::new(); - assert!(p2.read(0, &mut buf).is_ok()); + assert!(p2.read(&mut buf).is_ok()); assert_eq!(buf.bytes(), b"hello"); } #[test] fn channel_read_raw_too_small() { - let (p1, p2) = Channel::create(ChannelOpts::Normal).unwrap(); + let (p1, p2) = Channel::create().unwrap(); let mut empty = vec![]; - assert!(p1.write(b"hello", &mut empty, 0).is_ok()); + assert!(p1.write(b"hello", &mut empty).is_ok()); let mut buf = MessageBuf::new(); - let result = p2.read_raw(0, &mut buf); + let result = p2.read_raw(&mut buf); assert_eq!(result, Err((5, 0))); assert_eq!(buf.bytes(), b""); } @@ -291,19 +322,19 @@ mod tests { let hello_length: usize = 5; // Create a pair of channels and a virtual memory object. - let (p1, p2) = Channel::create(ChannelOpts::Normal).unwrap(); - let vmo = Vmo::create(hello_length as u64, VmoOpts::Default).unwrap(); + let (p1, p2) = Channel::create().unwrap(); + let vmo = Vmo::create(hello_length as u64).unwrap(); // Duplicate VMO handle and send it down the channel. - let duplicate_vmo_handle = vmo.duplicate_handle(ZX_RIGHT_SAME_RIGHTS).unwrap().into(); + let duplicate_vmo_handle = vmo.duplicate_handle(Rights::SAME_RIGHTS).unwrap().into(); let mut handles_to_send: Vec<Handle> = vec![duplicate_vmo_handle]; - assert!(p1.write(b"", &mut handles_to_send, 0).is_ok()); + assert!(p1.write(b"", &mut handles_to_send).is_ok()); // Handle should be removed from vector. assert!(handles_to_send.is_empty()); // Read the handle from the receiving channel. let mut buf = MessageBuf::new(); - assert!(p2.read(0, &mut buf).is_ok()); + assert!(p2.read(&mut buf).is_ok()); assert_eq!(buf.n_handles(), 1); // Take the handle from the buffer. let received_handle = buf.take_handle(0).unwrap(); @@ -324,57 +355,64 @@ mod tests { #[test] fn channel_call_timeout() { - let ten_ms: Duration = 10_000_000; + let ten_ms = 10.millis(); // Create a pair of channels and a virtual memory object. - let (p1, p2) = Channel::create(ChannelOpts::Normal).unwrap(); - let vmo = Vmo::create(0 as u64, VmoOpts::Default).unwrap(); + let (p1, p2) = Channel::create().unwrap(); + let vmo = Vmo::create(0 as u64).unwrap(); // Duplicate VMO handle and send it along with the call. - let duplicate_vmo_handle = vmo.duplicate_handle(ZX_RIGHT_SAME_RIGHTS).unwrap().into(); + let duplicate_vmo_handle = vmo.duplicate_handle(Rights::SAME_RIGHTS).unwrap().into(); let mut handles_to_send: Vec<Handle> = vec![duplicate_vmo_handle]; let mut buf = MessageBuf::new(); - assert_eq!(p1.call(0, deadline_after(ten_ms), b"call", &mut handles_to_send, &mut buf), - Err((Status::ErrTimedOut, Status::NoError))); + assert_eq!(p1.call(ten_ms.after_now(), b"call", &mut handles_to_send, &mut buf), + Err((Status::TIMED_OUT, Status::OK))); // Handle should be removed from vector even though we didn't get a response, as it was // still sent over the channel. assert!(handles_to_send.is_empty()); // Should be able to read call even though it timed out waiting for a response. let mut buf = MessageBuf::new(); - assert!(p2.read(0, &mut buf).is_ok()); + assert!(p2.read(&mut buf).is_ok()); assert_eq!(buf.bytes(), b"call"); assert_eq!(buf.n_handles(), 1); } #[test] fn channel_call() { - let hundred_ms: Duration = 100_000_000; - // Create a pair of channels - let (p1, p2) = Channel::create(ChannelOpts::Normal).unwrap(); + let (p1, p2) = Channel::create().unwrap(); + + // create an mpsc channel for communicating the call data for later assertion + let (tx, rx) = ::std::sync::mpsc::channel(); // Start a new thread to respond to the call. - let server = thread::spawn(move || { - assert_eq!(p2.wait_handle(ZX_CHANNEL_READABLE, deadline_after(hundred_ms)), - Ok(ZX_CHANNEL_READABLE | ZX_CHANNEL_WRITABLE | ZX_SIGNAL_LAST_HANDLE)); + thread::spawn(move || { let mut buf = MessageBuf::new(); - assert_eq!(p2.read(0, &mut buf), Ok(())); - assert_eq!(buf.bytes(), b"txidcall"); - assert_eq!(buf.n_handles(), 0); - let mut empty = vec![]; - assert_eq!(p2.write(b"txidresponse", &mut empty, 0), Ok(())); + // if either the read or the write fail, this thread will panic, + // resulting in tx being dropped, which will be noticed by the rx. + p2.wait_handle(Signals::CHANNEL_READABLE, 1.seconds().after_now()).expect("callee wait error"); + p2.read(&mut buf).expect("callee read error"); + p2.write(b"txidresponse", &mut vec![]).expect("callee write error"); + tx.send(buf).expect("callee mpsc send error"); }); // Make the call. - let mut empty = vec![]; let mut buf = MessageBuf::new(); buf.ensure_capacity_bytes(12); - assert_eq!(p1.call(0, deadline_after(hundred_ms), b"txidcall", &mut empty, &mut buf), - Ok(())); + // NOTE(raggi): CQ has been seeing some long stalls from channel call, + // and it's as yet unclear why. The timeout here has been made much + // larger in order to avoid that, as the issues are not issues with this + // crate's concerns. The timeout is here just to prevent the tests from + // stalling forever if a developer makes a mistake locally in this + // crate. Tests of Zircon behavior or virtualization behavior should be + // covered elsewhere. See ZX-1324. + p1.call(30.seconds().after_now(), b"txidcall", &mut vec![], &mut buf).expect("channel call error"); assert_eq!(buf.bytes(), b"txidresponse"); assert_eq!(buf.n_handles(), 0); - assert!(server.join().is_ok()); + let sbuf = rx.recv().expect("mpsc channel recv error"); + assert_eq!(sbuf.bytes(), b"txidcall"); + assert_eq!(sbuf.n_handles(), 0); } } diff --git a/src/vendor/fuchsia-zircon/src/cprng.rs b/src/vendor/fuchsia-zircon/src/cprng.rs new file mode 100644 index 0000000000..433ed26d9e --- /dev/null +++ b/src/vendor/fuchsia-zircon/src/cprng.rs @@ -0,0 +1,68 @@ +use {Status, ok, sys}; + +/// Draw random bytes from the kernel's CPRNG to fill the given buffer. Returns the actual number of +/// bytes drawn, which may sometimes be less than the size of the buffer provided. +/// +/// The buffer must have length less than `ZX_CPRNG_DRAW_MAX_LEN`. +/// +/// Wraps the +/// [zx_cprng_draw](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/cprng_draw.md) +/// syscall. +pub fn cprng_draw(buffer: &mut [u8]) -> Result<usize, Status> { + let mut actual = 0; + let status = unsafe { sys::zx_cprng_draw(buffer.as_mut_ptr(), buffer.len(), &mut actual) }; + ok(status).map(|()| actual) +} + +/// Mix the given entropy into the kernel CPRNG. +/// +/// The buffer must have length less than `ZX_CPRNG_ADD_ENTROPY_MAX_LEN`. +/// +/// Wraps the +/// [zx_cprng_add_entropy](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/cprng_add_entropy.md) +/// syscall. +pub fn cprng_add_entropy(buffer: &[u8]) -> Result<(), Status> { + let status = unsafe { sys::zx_cprng_add_entropy(buffer.as_ptr(), buffer.len()) }; + ok(status) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn cprng() { + let mut buffer = [0; 20]; + assert_eq!(cprng_draw(&mut buffer), Ok(20)); + let mut first_zero = 0; + let mut last_zero = 0; + for _ in 0..30 { + let mut buffer = [0; 20]; + assert_eq!(cprng_draw(&mut buffer), Ok(20)); + if buffer[0] == 0 { + first_zero += 1; + } + if buffer[19] == 0 { + last_zero += 1; + } + } + assert_ne!(first_zero, 30); + assert_ne!(last_zero, 30); + } + + #[test] + fn cprng_too_large() { + let mut buffer = [0; sys::ZX_CPRNG_DRAW_MAX_LEN + 1]; + assert_eq!(cprng_draw(&mut buffer), Err(Status::INVALID_ARGS)); + + for mut s in buffer.chunks_mut(sys::ZX_CPRNG_DRAW_MAX_LEN) { + assert_eq!(cprng_draw(&mut s), Ok(s.len())); + } + } + + #[test] + fn cprng_add() { + let buffer = [0, 1, 2]; + assert_eq!(cprng_add_entropy(&buffer), Ok(())); + } +} \ No newline at end of file diff --git a/src/vendor/fuchsia-zircon/src/event.rs b/src/vendor/fuchsia-zircon/src/event.rs index ae476ba40e..533a8aafcc 100644 --- a/src/vendor/fuchsia-zircon/src/event.rs +++ b/src/vendor/fuchsia-zircon/src/event.rs @@ -5,7 +5,7 @@ //! Type-safe bindings for Zircon event objects. use {AsHandleRef, Cookied, HandleBased, Handle, HandleRef, Status}; -use {sys, into_result}; +use {sys, ok}; /// An object representing a Zircon /// [event object](https://fuchsia.googlesource.com/zircon/+/master/docs/objects/event.md). @@ -20,23 +20,13 @@ impl Event { /// Create an event object, an object which is signalable but nothing else. Wraps the /// [zx_event_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/event_create.md) /// syscall. - pub fn create(options: EventOpts) -> Result<Event, Status> { + pub fn create() -> Result<Event, Status> { let mut out = 0; - let status = unsafe { sys::zx_event_create(options as u32, &mut out) }; - into_result(status, || Self::from(Handle(out))) - } -} - -/// Options for creating an event object. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum EventOpts { - /// Default options. - Default = 0, -} - -impl Default for EventOpts { - fn default() -> Self { - EventOpts::Default + let opts = 0; + let status = unsafe { sys::zx_event_create(opts, &mut out) }; + ok(status)?; + unsafe { + Ok(Self::from(Handle::from_raw(out))) + } } } diff --git a/src/vendor/fuchsia-zircon/src/eventpair.rs b/src/vendor/fuchsia-zircon/src/eventpair.rs index 4e12c108b1..6f2d29806d 100644 --- a/src/vendor/fuchsia-zircon/src/eventpair.rs +++ b/src/vendor/fuchsia-zircon/src/eventpair.rs @@ -5,7 +5,7 @@ //! Type-safe bindings for Zircon event pairs. use {AsHandleRef, Cookied, HandleBased, Handle, HandleRef, Peered, Status}; -use {sys, into_result}; +use {sys, ok}; /// An object representing a Zircon /// [event pair](https://fuchsia.googlesource.com/zircon/+/master/docs/concepts.md#Other-IPC_Events_Event-Pairs_and-User-Signals). @@ -21,55 +21,45 @@ impl EventPair { /// Create an event pair, a pair of objects which can signal each other. Wraps the /// [zx_eventpair_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/eventpair_create.md) /// syscall. - pub fn create(options: EventPairOpts) -> Result<(EventPair, EventPair), Status> { + pub fn create() -> Result<(EventPair, EventPair), Status> { let mut out0 = 0; let mut out1 = 0; - let status = unsafe { sys::zx_eventpair_create(options as u32, &mut out0, &mut out1) }; - into_result(status, || - (Self::from(Handle(out0)), - Self::from(Handle(out1)))) - } -} - -/// Options for creating an event pair. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum EventPairOpts { - /// Default options. - Default = 0, -} - -impl Default for EventPairOpts { - fn default() -> Self { - EventPairOpts::Default + let options = 0; + let status = unsafe { sys::zx_eventpair_create(options, &mut out0, &mut out1) }; + ok(status)?; + unsafe { + Ok(( + Self::from(Handle::from_raw(out0)), + Self::from(Handle::from_raw(out1)) + )) + } } } #[cfg(test)] mod tests { use super::*; - use {Duration, ZX_SIGNAL_LAST_HANDLE, ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0}; - use deadline_after; + use {DurationNum, Signals}; #[test] fn wait_and_signal_peer() { - let (p1, p2) = EventPair::create(EventPairOpts::Default).unwrap(); - let eighty_ms: Duration = 80_000_000; + let (p1, p2) = EventPair::create().unwrap(); + let eighty_ms = 80.millis(); // Waiting on one without setting any signal should time out. - assert_eq!(p2.wait_handle(ZX_USER_SIGNAL_0, deadline_after(eighty_ms)), Err(Status::ErrTimedOut)); + assert_eq!(p2.wait_handle(Signals::USER_0, eighty_ms.after_now()), Err(Status::TIMED_OUT)); // If we set a signal, we should be able to wait for it. - assert!(p1.signal_peer(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - assert_eq!(p2.wait_handle(ZX_USER_SIGNAL_0, deadline_after(eighty_ms)).unwrap(), - ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert!(p1.signal_peer(Signals::NONE, Signals::USER_0).is_ok()); + assert_eq!(p2.wait_handle(Signals::USER_0, eighty_ms.after_now()).unwrap(), + Signals::USER_0); // Should still work, signals aren't automatically cleared. - assert_eq!(p2.wait_handle(ZX_USER_SIGNAL_0, deadline_after(eighty_ms)).unwrap(), - ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert_eq!(p2.wait_handle(Signals::USER_0, eighty_ms.after_now()).unwrap(), + Signals::USER_0); // Now clear it, and waiting should time out again. - assert!(p1.signal_peer(ZX_USER_SIGNAL_0, ZX_SIGNAL_NONE).is_ok()); - assert_eq!(p2.wait_handle(ZX_USER_SIGNAL_0, deadline_after(eighty_ms)), Err(Status::ErrTimedOut)); + assert!(p1.signal_peer(Signals::USER_0, Signals::NONE).is_ok()); + assert_eq!(p2.wait_handle(Signals::USER_0, eighty_ms.after_now()), Err(Status::TIMED_OUT)); } } diff --git a/src/vendor/fuchsia-zircon/src/fifo.rs b/src/vendor/fuchsia-zircon/src/fifo.rs index c948e99a7b..20af6f5236 100644 --- a/src/vendor/fuchsia-zircon/src/fifo.rs +++ b/src/vendor/fuchsia-zircon/src/fifo.rs @@ -5,7 +5,7 @@ //! Type-safe bindings for Zircon fifo objects. use {AsHandleRef, HandleBased, Handle, HandleRef, Status}; -use {sys, into_result}; +use {sys, ok}; /// An object representing a Zircon fifo. /// @@ -19,15 +19,20 @@ impl Fifo { /// element into the fifo from which the opposing endpoint reads. Wraps the /// [zx_fifo_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/fifo_create.md) /// syscall. - pub fn create(elem_count: u32, elem_size: u32, options: FifoOpts) + pub fn create(elem_count: u32, elem_size: u32) -> Result<(Fifo, Fifo), Status> { let mut out0 = 0; let mut out1 = 0; + let options = 0; let status = unsafe { - sys::zx_fifo_create(elem_count, elem_size, options as u32, &mut out0, &mut out1) + sys::zx_fifo_create(elem_count, elem_size, options, &mut out0, &mut out1) }; - into_result(status, || (Self::from(Handle(out0)), Self::from(Handle(out1)))) + ok(status)?; + unsafe { Ok(( + Self::from(Handle::from_raw(out0)), + Self::from(Handle::from_raw(out1)) + ))} } /// Attempts to write some number of elements into the fifo. The number of bytes written will be @@ -42,7 +47,7 @@ impl Fifo { sys::zx_fifo_write(self.raw_handle(), bytes.as_ptr(), bytes.len(), &mut num_entries_written) }; - into_result(status, || num_entries_written) + ok(status).map(|()| num_entries_written) } /// Attempts to read some number of elements out of the fifo. The number of bytes read will @@ -57,21 +62,7 @@ impl Fifo { sys::zx_fifo_read(self.raw_handle(), bytes.as_mut_ptr(), bytes.len(), &mut num_entries_read) }; - into_result(status, || num_entries_read) - } -} - -/// Options for creating a fifo pair. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum FifoOpts { - /// Default options. - Default = 0, -} - -impl Default for FifoOpts { - fn default() -> Self { - FifoOpts::Default + ok(status).map(|()| num_entries_read) } } @@ -81,11 +72,11 @@ mod tests { #[test] fn fifo_basic() { - let (fifo1, fifo2) = Fifo::create(4, 2, FifoOpts::Default).unwrap(); + let (fifo1, fifo2) = Fifo::create(4, 2).unwrap(); // Trying to write less than one element should fail. - assert_eq!(fifo1.write(b""), Err(Status::ErrOutOfRange)); - assert_eq!(fifo1.write(b"h"), Err(Status::ErrOutOfRange)); + assert_eq!(fifo1.write(b""), Err(Status::OUT_OF_RANGE)); + assert_eq!(fifo1.write(b"h"), Err(Status::OUT_OF_RANGE)); // Should write one element "he" and ignore the last half-element as it rounds down. assert_eq!(fifo1.write(b"hex").unwrap(), 1); @@ -94,7 +85,7 @@ mod tests { assert_eq!(fifo1.write(b"llo worlds").unwrap(), 3); // Now that the fifo is full any further attempts to write should fail. - assert_eq!(fifo1.write(b"blah blah"), Err(Status::ErrShouldWait)); + assert_eq!(fifo1.write(b"blah blah"), Err(Status::SHOULD_WAIT)); // Read all 4 entries from the other end. let mut read_vec = vec![0; 8]; @@ -102,6 +93,6 @@ mod tests { assert_eq!(read_vec, b"hello wo"); // Reading again should fail as the fifo is empty. - assert_eq!(fifo2.read(&mut read_vec), Err(Status::ErrShouldWait)); + assert_eq!(fifo2.read(&mut read_vec), Err(Status::SHOULD_WAIT)); } } diff --git a/src/vendor/fuchsia-zircon/src/handle.rs b/src/vendor/fuchsia-zircon/src/handle.rs new file mode 100644 index 0000000000..5c50f29f0e --- /dev/null +++ b/src/vendor/fuchsia-zircon/src/handle.rs @@ -0,0 +1,243 @@ +use {Port, Rights, Signals, Status, Time, WaitAsyncOpts, ok, sys}; +use std::marker::PhantomData; +use std::mem; + +/// An object representing a Zircon +/// [handle](https://fuchsia.googlesource.com/zircon/+/master/docs/handles.md). +/// +/// Internally, it is represented as a 32-bit integer, but this wrapper enforces +/// strict ownership semantics. The `Drop` implementation closes the handle. +/// +/// This type represents the most general reference to a kernel object, and can +/// be interconverted to and from more specific types. Those conversions are not +/// enforced in the type system; attempting to use them will result in errors +/// returned by the kernel. These conversions don't change the underlying +/// representation, but do change the type and thus what operations are available. +#[derive(Debug, Eq, PartialEq, Hash)] +pub struct Handle(sys::zx_handle_t); + +impl AsHandleRef for Handle { + fn as_handle_ref(&self) -> HandleRef { + HandleRef { handle: self.0, phantom: Default::default() } + } +} + +impl HandleBased for Handle {} + +impl Drop for Handle { + fn drop(&mut self) { + if self.0 != sys::ZX_HANDLE_INVALID { + unsafe { sys::zx_handle_close(self.0) }; + } + } +} + +impl Handle { + /// Initialize a handle backed by ZX_HANDLE_INVALID, the only safe non-handle. + pub fn invalid() -> Handle { + Handle(sys::ZX_HANDLE_INVALID) + } + + /// If a raw handle is obtained from some other source, this method converts + /// it into a type-safe owned handle. + pub unsafe fn from_raw(raw: sys::zx_handle_t) -> Handle { + Handle(raw) + } + + pub fn is_invalid(&self) -> bool { + self.0 == sys::ZX_HANDLE_INVALID + } + + pub fn replace(self, rights: Rights) -> Result<Handle, Status> { + let handle = self.0; + let mut out = 0; + let status = unsafe { sys::zx_handle_replace(handle, rights.bits(), &mut out) }; + ok(status).map(|()| Handle(out)) + } +} + +/// A borrowed reference to a `Handle`. +/// +/// Mostly useful as part of a `WaitItem`. +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub struct HandleRef<'a> { + handle: sys::zx_handle_t, + phantom: PhantomData<&'a sys::zx_handle_t>, +} + +impl<'a> HandleRef<'a> { + pub fn raw_handle(&self) -> sys::zx_handle_t { + self.handle + } + + pub fn duplicate(&self, rights: Rights) -> Result<Handle, Status> { + let handle = self.handle; + let mut out = 0; + let status = unsafe { sys::zx_handle_duplicate(handle, rights.bits(), &mut out) }; + ok(status).map(|()| Handle(out)) + } + + pub fn signal(&self, clear_mask: Signals, set_mask: Signals) -> Result<(), Status> { + let handle = self.handle; + let status = unsafe { sys::zx_object_signal(handle, clear_mask.bits(), set_mask.bits()) }; + ok(status) + } + + pub fn wait(&self, signals: Signals, deadline: Time) -> Result<Signals, Status> { + let handle = self.handle; + let mut pending = Signals::empty().bits(); + let status = unsafe { + sys::zx_object_wait_one(handle, signals.bits(), deadline.nanos(), &mut pending) + }; + ok(status).map(|()| Signals::from_bits_truncate(pending)) + } + + pub fn wait_async(&self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts) + -> Result<(), Status> + { + let handle = self.handle; + let status = unsafe { + sys::zx_object_wait_async( + handle, port.raw_handle(), key, signals.bits(), options as u32) + }; + ok(status) + } +} + +/// A trait to get a reference to the underlying handle of an object. +pub trait AsHandleRef { + /// Get a reference to the handle. One important use of such a reference is + /// for `object_wait_many`. + fn as_handle_ref(&self) -> HandleRef; + + /// Interpret the reference as a raw handle (an integer type). Two distinct + /// handles will have different raw values (so it can perhaps be used as a + /// key in a data structure). + fn raw_handle(&self) -> sys::zx_handle_t { + self.as_handle_ref().raw_handle() + } + + /// Set and clear userspace-accessible signal bits on an object. Wraps the + /// [zx_object_signal](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_signal.md) + /// syscall. + fn signal_handle(&self, clear_mask: Signals, set_mask: Signals) -> Result<(), Status> { + self.as_handle_ref().signal(clear_mask, set_mask) + } + + /// Waits on a handle. Wraps the + /// [zx_object_wait_one](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_wait_one.md) + /// syscall. + fn wait_handle(&self, signals: Signals, deadline: Time) -> Result<Signals, Status> { + self.as_handle_ref().wait(signals, deadline) + } + + /// Causes packet delivery on the given port when the object changes state and matches signals. + /// [zx_object_wait_async](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_wait_async.md) + /// syscall. + fn wait_async_handle(&self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts) + -> Result<(), Status> + { + self.as_handle_ref().wait_async(port, key, signals, options) + } +} + +impl<'a> AsHandleRef for HandleRef<'a> { + fn as_handle_ref(&self) -> HandleRef { *self } +} + +/// A trait implemented by all handle-based types. +/// +/// Note: it is reasonable for user-defined objects wrapping a handle to implement +/// this trait. For example, a specific interface in some protocol might be +/// represented as a newtype of `Channel`, and implement the `as_handle_ref` +/// method and the `From<Handle>` trait to facilitate conversion from and to the +/// interface. +pub trait HandleBased: AsHandleRef + From<Handle> + Into<Handle> { + /// Duplicate a handle, possibly reducing the rights available. Wraps the + /// [zx_handle_duplicate](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/handle_duplicate.md) + /// syscall. + fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status> { + self.as_handle_ref().duplicate(rights).map(|handle| Self::from(handle)) + } + + /// Create a replacement for a handle, possibly reducing the rights available. This invalidates + /// the original handle. Wraps the + /// [zx_handle_replace](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/handle_replace.md) + /// syscall. + fn replace_handle(self, rights: Rights) -> Result<Self, Status> { + <Self as Into<Handle>>::into(self) + .replace(rights).map(|handle| Self::from(handle)) + } + + /// Converts the value into its inner handle. + /// + /// This is a convenience function which simply forwards to the `Into` trait. + fn into_handle(self) -> Handle { + self.into() + } + + /// Converts the handle into it's raw representation. + /// + /// The caller takes ownership over the raw handle, and must close or transfer it to avoid a handle leak. + fn into_raw(self) -> sys::zx_handle_t { + let h = self.into_handle(); + let r = h.0; + mem::forget(h); + r + } + + /// Creates an instance of this type from a handle. + /// + /// This is a convenience function which simply forwards to the `From` trait. + fn from_handle(handle: Handle) -> Self { + Self::from(handle) + } + + /// Creates an instance of another handle-based type from this value's inner handle. + fn into_handle_based<H: HandleBased>(self) -> H { + H::from_handle(self.into_handle()) + } + + /// Creates an instance of this type from the inner handle of another + /// handle-based type. + fn from_handle_based<H: HandleBased>(h: H) -> Self { + Self::from_handle(h.into_handle()) + } +} + +/// A trait implemented by all handles for objects which have a peer. +pub trait Peered: HandleBased { + /// Set and clear userspace-accessible signal bits on the object's peer. Wraps the + /// [zx_object_signal_peer](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_signal.md) + /// syscall. + fn signal_peer(&self, clear_mask: Signals, set_mask: Signals) -> Result<(), Status> { + let handle = self.as_handle_ref().handle; + let status = unsafe { + sys::zx_object_signal_peer(handle, clear_mask.bits(), set_mask.bits()) + }; + ok(status) + } +} + +/// A trait implemented by all handles for objects which can have a cookie attached. +pub trait Cookied: HandleBased { + /// Get the cookie attached to this object, if any. Wraps the + /// [zx_object_get_cookie](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/object_get_cookie.md) + /// syscall. + fn get_cookie(&self, scope: &HandleRef) -> Result<u64, Status> { + let handle = self.as_handle_ref().handle; + let mut cookie = 0; + let status = unsafe { sys::zx_object_get_cookie(handle, scope.handle, &mut cookie) }; + ok(status).map(|()| cookie) + } + + /// Attach an opaque cookie to this object with the given scope. The cookie may be read or + /// changed in future only with the same scope. Wraps the + /// [zx_object_set_cookie](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/object_set_cookie.md) + /// syscall. + fn set_cookie(&self, scope: &HandleRef, cookie: u64) -> Result<(), Status> { + let handle = self.as_handle_ref().handle; + let status = unsafe { sys::zx_object_set_cookie(handle, scope.handle, cookie) }; + ok(status) + } +} diff --git a/src/vendor/fuchsia-zircon/src/lib.rs b/src/vendor/fuchsia-zircon/src/lib.rs index b226c87d59..a9e81e5a91 100644 --- a/src/vendor/fuchsia-zircon/src/lib.rs +++ b/src/vendor/fuchsia-zircon/src/lib.rs @@ -5,11 +5,14 @@ //! Type-safe bindings for Zircon kernel //! [syscalls](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls.md). -extern crate fuchsia_zircon_sys as zircon_sys; +#![deny(warnings)] -use std::io; -use std::marker::PhantomData; +#[macro_use] +extern crate bitflags; +pub extern crate fuchsia_zircon_sys as sys; + +// Implements the HandleBased traits for a Handle newtype struct macro_rules! impl_handle_based { ($type_name:path) => { impl AsHandleRef for $type_name { @@ -34,296 +37,72 @@ macro_rules! impl_handle_based { } } +// Creates associated constants of TypeName of the form +// `pub const NAME: TypeName = TypeName(value);` +macro_rules! assoc_consts { + ($typename:ident, [$($name:ident = $num:expr;)*]) => { + #[allow(non_upper_case_globals)] + impl $typename { + $( + pub const $name: $typename = $typename($num); + )* + } + } +} + mod channel; +mod cprng; mod event; mod eventpair; mod fifo; +mod handle; mod job; mod port; mod process; +mod rights; mod socket; -mod timer; +mod signals; +mod status; +mod time; mod thread; +mod vmar; mod vmo; -pub use channel::{Channel, ChannelOpts, MessageBuf}; -pub use event::{Event, EventOpts}; -pub use eventpair::{EventPair, EventPairOpts}; -pub use fifo::{Fifo, FifoOpts}; -pub use job::Job; -pub use port::{Packet, PacketContents, Port, PortOpts, SignalPacket, UserPacket, WaitAsyncOpts}; -pub use process::Process; -pub use socket::{Socket, SocketOpts, SocketReadOpts, SocketWriteOpts}; -pub use timer::{Timer, TimerOpts}; -pub use thread::Thread; -pub use vmo::{Vmo, VmoCloneOpts, VmoOp, VmoOpts}; +pub use channel::*; +pub use cprng::*; +pub use event::*; +pub use eventpair::*; +pub use fifo::*; +pub use handle::*; +pub use job::*; +pub use port::*; +pub use process::*; +pub use rights::*; +pub use socket::*; +pub use signals::*; +pub use status::*; +pub use thread::*; +pub use time::*; +pub use vmar::*; +pub use vmo::*; -use zircon_sys as sys; - -type Duration = sys::zx_duration_t; -type Time = sys::zx_time_t; -pub use zircon_sys::ZX_TIME_INFINITE; - -// A placeholder value used for handles that have been taken from the message buf. -// We rely on the kernel never to produce any actual handles with this value. -const INVALID_HANDLE: sys::zx_handle_t = 0; - -/// A status code returned from the Zircon kernel. -/// -/// See -/// [errors.md](https://fuchsia.googlesource.com/zircon/+/master/docs/errors.md) -/// in the Zircon documentation for more information about the meaning of these -/// codes. -#[derive(Debug, PartialEq, Eq, Clone, Copy)] -#[repr(i32)] -// Auto-generated using tools/gen_status.py -pub enum Status { - NoError = 0, - ErrInternal = -1, - ErrNotSupported = -2, - ErrNoResources = -3, - ErrNoMemory = -4, - ErrCallFailed = -5, - ErrInterruptedRetry = -6, - ErrInvalidArgs = -10, - ErrBadHandle = -11, - ErrWrongType = -12, - ErrBadSyscall = -13, - ErrOutOfRange = -14, - ErrBufferTooSmall = -15, - ErrBadState = -20, - ErrTimedOut = -21, - ErrShouldWait = -22, - ErrCanceled = -23, - ErrPeerClosed = -24, - ErrNotFound = -25, - ErrAlreadyExists = -26, - ErrAlreadyBound = -27, - ErrUnavailable = -28, - ErrAccessDenied = -30, - ErrIo = -40, - ErrIoRefused = -41, - ErrIoDataIntegrity = -42, - ErrIoDataLoss = -43, - ErrBadPath = -50, - ErrNotDir = -51, - ErrNotFile = -52, - ErrFileBig = -53, - ErrNoSpace = -54, - ErrStop = -60, - ErrNext = -61, - - /// Any zx_status_t not in the set above will map to the following: - UnknownOther = -32768, - - // used to prevent exhaustive matching - #[doc(hidden)] - __Nonexhaustive = -32787, +/// Prelude containing common utility traits. +/// Designed for use like `use fuchsia_zircon::prelude::*;` +pub mod prelude { + pub use { + AsHandleRef, + Cookied, + DurationNum, + HandleBased, + Peered, + }; } -impl Status { - pub fn from_raw(raw: sys::zx_status_t) -> Self { - match raw { - // Auto-generated using tools/gen_status.py - sys::ZX_OK => Status::NoError, - sys::ZX_ERR_INTERNAL => Status::ErrInternal, - sys::ZX_ERR_NOT_SUPPORTED => Status::ErrNotSupported, - sys::ZX_ERR_NO_RESOURCES => Status::ErrNoResources, - sys::ZX_ERR_NO_MEMORY => Status::ErrNoMemory, - sys::ZX_ERR_CALL_FAILED => Status::ErrCallFailed, - sys::ZX_ERR_INTERRUPTED_RETRY => Status::ErrInterruptedRetry, - sys::ZX_ERR_INVALID_ARGS => Status::ErrInvalidArgs, - sys::ZX_ERR_BAD_HANDLE => Status::ErrBadHandle, - sys::ZX_ERR_WRONG_TYPE => Status::ErrWrongType, - sys::ZX_ERR_BAD_SYSCALL => Status::ErrBadSyscall, - sys::ZX_ERR_OUT_OF_RANGE => Status::ErrOutOfRange, - sys::ZX_ERR_BUFFER_TOO_SMALL => Status::ErrBufferTooSmall, - sys::ZX_ERR_BAD_STATE => Status::ErrBadState, - sys::ZX_ERR_TIMED_OUT => Status::ErrTimedOut, - sys::ZX_ERR_SHOULD_WAIT => Status::ErrShouldWait, - sys::ZX_ERR_CANCELED => Status::ErrCanceled, - sys::ZX_ERR_PEER_CLOSED => Status::ErrPeerClosed, - sys::ZX_ERR_NOT_FOUND => Status::ErrNotFound, - sys::ZX_ERR_ALREADY_EXISTS => Status::ErrAlreadyExists, - sys::ZX_ERR_ALREADY_BOUND => Status::ErrAlreadyBound, - sys::ZX_ERR_UNAVAILABLE => Status::ErrUnavailable, - sys::ZX_ERR_ACCESS_DENIED => Status::ErrAccessDenied, - sys::ZX_ERR_IO => Status::ErrIo, - sys::ZX_ERR_IO_REFUSED => Status::ErrIoRefused, - sys::ZX_ERR_IO_DATA_INTEGRITY => Status::ErrIoDataIntegrity, - sys::ZX_ERR_IO_DATA_LOSS => Status::ErrIoDataLoss, - sys::ZX_ERR_BAD_PATH => Status::ErrBadPath, - sys::ZX_ERR_NOT_DIR => Status::ErrNotDir, - sys::ZX_ERR_NOT_FILE => Status::ErrNotFile, - sys::ZX_ERR_FILE_BIG => Status::ErrFileBig, - sys::ZX_ERR_NO_SPACE => Status::ErrNoSpace, - sys::ZX_ERR_STOP => Status::ErrStop, - sys::ZX_ERR_NEXT => Status::ErrNext, - _ => Status::UnknownOther, - } - } - - pub fn into_io_err(self) -> io::Error { - self.into() - } - - // Note: no to_raw, even though it's easy to implement, partly because - // handling of UnknownOther would be tricky. +/// Convenience re-export of `Status::ok`. +pub fn ok(raw: sys::zx_status_t) -> Result<(), Status> { + Status::ok(raw) } -impl From<io::ErrorKind> for Status { - fn from(kind: io::ErrorKind) -> Self { - use io::ErrorKind::*; - use Status::*; - - match kind { - NotFound => ErrNotFound, - PermissionDenied => ErrAccessDenied, - ConnectionRefused => ErrIoRefused, - ConnectionAborted => ErrPeerClosed, - AddrInUse => ErrAlreadyBound, - AddrNotAvailable => ErrUnavailable, - BrokenPipe => ErrPeerClosed, - AlreadyExists => ErrAlreadyExists, - WouldBlock => ErrShouldWait, - InvalidInput => ErrInvalidArgs, - TimedOut => ErrTimedOut, - Interrupted => ErrInterruptedRetry, - - UnexpectedEof | - WriteZero | - ConnectionReset | - NotConnected | - Other | _ => ErrIo, - } - } -} - -impl From<Status> for io::ErrorKind { - fn from(status: Status) -> io::ErrorKind { - use io::ErrorKind::*; - use Status::*; - - match status { - ErrInterruptedRetry => Interrupted, - ErrBadHandle => BrokenPipe, - ErrTimedOut => TimedOut, - ErrShouldWait => WouldBlock, - ErrPeerClosed => ConnectionAborted, - ErrNotFound => NotFound, - ErrAlreadyExists => AlreadyExists, - ErrAlreadyBound => AlreadyExists, - ErrUnavailable => AddrNotAvailable, - ErrAccessDenied => PermissionDenied, - ErrIoRefused => ConnectionRefused, - ErrIoDataIntegrity => InvalidData, - - ErrBadPath | - ErrInvalidArgs | - ErrOutOfRange | - ErrWrongType => InvalidInput, - - Status::__Nonexhaustive | - UnknownOther | - NoError | - ErrNext | - ErrStop | - ErrNoSpace | - ErrFileBig | - ErrNotFile | - ErrNotDir | - ErrIoDataLoss | - ErrIo | - ErrCanceled | - ErrBadState | - ErrBufferTooSmall | - ErrBadSyscall | - ErrInternal | - ErrNotSupported | - ErrNoResources | - ErrNoMemory | - ErrCallFailed => Other, - } - } -} - -impl From<io::Error> for Status { - fn from(err: io::Error) -> Status { - err.kind().into() - } -} - -impl From<Status> for io::Error { - fn from(status: Status) -> io::Error { - io::Error::from(io::ErrorKind::from(status)) - } -} - -/// Rights associated with a handle. -/// -/// See [rights.md](https://fuchsia.googlesource.com/zircon/+/master/docs/rights.md) -/// for more information. -pub type Rights = sys::zx_rights_t; -pub use zircon_sys::{ - ZX_RIGHT_NONE, - ZX_RIGHT_DUPLICATE, - ZX_RIGHT_TRANSFER, - ZX_RIGHT_READ, - ZX_RIGHT_WRITE, - ZX_RIGHT_EXECUTE, - ZX_RIGHT_MAP, - ZX_RIGHT_GET_PROPERTY, - ZX_RIGHT_SET_PROPERTY, - ZX_RIGHT_DEBUG, - ZX_RIGHT_SAME_RIGHTS, -}; - -/// Signals that can be waited upon. -/// -/// See -/// [Objects and signals](https://fuchsia.googlesource.com/zircon/+/master/docs/concepts.md#Objects-and-Signals) -/// in the Zircon kernel documentation. Note: the names of signals are still in flux. -pub type Signals = sys::zx_signals_t; - -pub use zircon_sys::{ - ZX_SIGNAL_NONE, - - ZX_SIGNAL_HANDLE_CLOSED, - ZX_SIGNAL_LAST_HANDLE, - - ZX_USER_SIGNAL_0, - ZX_USER_SIGNAL_1, - ZX_USER_SIGNAL_2, - ZX_USER_SIGNAL_3, - ZX_USER_SIGNAL_4, - ZX_USER_SIGNAL_5, - ZX_USER_SIGNAL_6, - ZX_USER_SIGNAL_7, - - // Event - ZX_EVENT_SIGNALED, - - // EventPair - ZX_EPAIR_SIGNALED, - ZX_EPAIR_CLOSED, - - // Task signals (process, thread, job) - ZX_TASK_TERMINATED, - - // Channel - ZX_CHANNEL_READABLE, - ZX_CHANNEL_WRITABLE, - ZX_CHANNEL_PEER_CLOSED, - - // Socket - ZX_SOCKET_READABLE, - ZX_SOCKET_WRITABLE, - ZX_SOCKET_PEER_CLOSED, - - // Timer - ZX_TIMER_SIGNALED, -}; - /// A "wait item" containing a handle reference and information about what signals /// to wait on, and, on return from `object_wait_many`, which are pending. #[repr(C)] @@ -337,7 +116,6 @@ pub struct WaitItem<'a> { pub pending: Signals, } - /// An identifier to select a particular clock. See /// [zx_time_get](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/time_get.md) /// for more information about the possible values. @@ -355,276 +133,6 @@ pub enum ClockId { Thread = 2, } -/// Get the current time, from the specific clock id. -/// -/// Wraps the -/// [zx_time_get](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/time_get.md) -/// syscall. -pub fn time_get(clock_id: ClockId) -> Time { - unsafe { sys::zx_time_get(clock_id as u32) } -} - -/// Read the number of high-precision timer ticks since boot. These ticks may be processor cycles, -/// high speed timer, profiling timer, etc. They are not guaranteed to continue advancing when the -/// system is asleep. -/// -/// Wraps the -/// [zx_ticks_get](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/ticks_get.md) -/// syscall. -pub fn ticks_get() -> u64 { - unsafe { sys::zx_ticks_get() } -} - -/// Compute a deadline for the time in the future that is the given `Duration` away. -/// -/// Wraps the -/// [zx_deadline_after](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/deadline_after.md) -/// syscall. -pub fn deadline_after(nanos: Duration) -> Time { - unsafe { sys::zx_deadline_after(nanos) } -} - -/// Sleep until the given deadline. -/// -/// Wraps the -/// [zx_nanosleep](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/nanosleep.md) -/// syscall. -pub fn nanosleep(deadline: Time) { - unsafe { sys::zx_nanosleep(deadline); } -} - -/// Return the number of high-precision timer ticks in a second. -/// -/// Wraps the -/// [zx_ticks_per_second](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/ticks_per_second.md) -/// syscall. -pub fn ticks_per_second() -> u64 { - unsafe { sys::zx_ticks_per_second() } -} - -pub use zircon_sys::{ - ZX_CPRNG_DRAW_MAX_LEN, - ZX_CPRNG_ADD_ENTROPY_MAX_LEN, -}; - -/// Draw random bytes from the kernel's CPRNG to fill the given buffer. Returns the actual number of -/// bytes drawn, which may sometimes be less than the size of the buffer provided. -/// -/// The buffer must have length less than `ZX_CPRNG_DRAW_MAX_LEN`. -/// -/// Wraps the -/// [zx_cprng_draw](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/cprng_draw.md) -/// syscall. -pub fn cprng_draw(buffer: &mut [u8]) -> Result<usize, Status> { - let mut actual = 0; - let status = unsafe { sys::zx_cprng_draw(buffer.as_mut_ptr(), buffer.len(), &mut actual) }; - into_result(status, || actual) -} - -/// Mix the given entropy into the kernel CPRNG. -/// -/// The buffer must have length less than `ZX_CPRNG_ADD_ENTROPY_MAX_LEN`. -/// -/// Wraps the -/// [zx_cprng_add_entropy](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/cprng_add_entropy.md) -/// syscall. -pub fn cprng_add_entropy(buffer: &[u8]) -> Result<(), Status> { - let status = unsafe { sys::zx_cprng_add_entropy(buffer.as_ptr(), buffer.len()) }; - into_result(status, || ()) -} - -fn into_result<T, F>(status: sys::zx_status_t, f: F) -> Result<T, Status> - where F: FnOnce() -> T { - // All non-negative values are assumed successful. Note: calls that don't try - // to multiplex success values into status return could be more strict here. - if status >= 0 { - Ok(f()) - } else { - Err(Status::from_raw(status)) - } -} - -// Handles - -/// A borrowed reference to a `Handle`. -/// -/// Mostly useful as part of a `WaitItem`. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub struct HandleRef<'a> { - handle: sys::zx_handle_t, - phantom: PhantomData<&'a sys::zx_handle_t>, -} - -impl<'a> HandleRef<'a> { - pub fn raw_handle(&self) -> sys::zx_handle_t { - self.handle - } - - pub fn duplicate(&self, rights: Rights) -> Result<Handle, Status> { - let handle = self.handle; - let mut out = 0; - let status = unsafe { sys::zx_handle_duplicate(handle, rights, &mut out) }; - into_result(status, || Handle(out)) - } - - pub fn signal(&self, clear_mask: Signals, set_mask: Signals) -> Result<(), Status> { - let handle = self.handle; - let status = unsafe { sys::zx_object_signal(handle, clear_mask.bits(), set_mask.bits()) }; - into_result(status, || ()) - } - - pub fn wait(&self, signals: Signals, deadline: Time) -> Result<Signals, Status> { - let handle = self.handle; - let mut pending = sys::zx_signals_t::empty(); - let status = unsafe { - sys::zx_object_wait_one(handle, signals, deadline, &mut pending) - }; - into_result(status, || pending) - } - - pub fn wait_async(&self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts) - -> Result<(), Status> - { - let handle = self.handle; - let status = unsafe { - sys::zx_object_wait_async(handle, port.raw_handle(), key, signals, options as u32) - }; - into_result(status, || ()) - } -} - -/// A trait to get a reference to the underlying handle of an object. -pub trait AsHandleRef { - /// Get a reference to the handle. One important use of such a reference is - /// for `object_wait_many`. - fn as_handle_ref(&self) -> HandleRef; - - /// Interpret the reference as a raw handle (an integer type). Two distinct - /// handles will have different raw values (so it can perhaps be used as a - /// key in a data structure). - fn raw_handle(&self) -> sys::zx_handle_t { - self.as_handle_ref().raw_handle() - } - - /// Set and clear userspace-accessible signal bits on an object. Wraps the - /// [zx_object_signal](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_signal.md) - /// syscall. - fn signal_handle(&self, clear_mask: Signals, set_mask: Signals) -> Result<(), Status> { - self.as_handle_ref().signal(clear_mask, set_mask) - } - - /// Waits on a handle. Wraps the - /// [zx_object_wait_one](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_wait_one.md) - /// syscall. - fn wait_handle(&self, signals: Signals, deadline: Time) -> Result<Signals, Status> { - self.as_handle_ref().wait(signals, deadline) - } - - /// Causes packet delivery on the given port when the object changes state and matches signals. - /// [zx_object_wait_async](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_wait_async.md) - /// syscall. - fn wait_async_handle(&self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts) - -> Result<(), Status> - { - self.as_handle_ref().wait_async(port, key, signals, options) - } -} - -impl<'a> AsHandleRef for HandleRef<'a> { - fn as_handle_ref(&self) -> HandleRef { *self } -} - -/// A trait implemented by all handle-based types. -/// -/// Note: it is reasonable for user-defined objects wrapping a handle to implement -/// this trait. For example, a specific interface in some protocol might be -/// represented as a newtype of `Channel`, and implement the `as_handle_ref` -/// method and the `From<Handle>` trait to facilitate conversion from and to the -/// interface. -pub trait HandleBased: AsHandleRef + From<Handle> + Into<Handle> { - /// Duplicate a handle, possibly reducing the rights available. Wraps the - /// [zx_handle_duplicate](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/handle_duplicate.md) - /// syscall. - fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status> { - self.as_handle_ref().duplicate(rights).map(|handle| Self::from(handle)) - } - - /// Create a replacement for a handle, possibly reducing the rights available. This invalidates - /// the original handle. Wraps the - /// [zx_handle_replace](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/handle_replace.md) - /// syscall. - fn replace_handle(self, rights: Rights) -> Result<Self, Status> { - <Self as Into<Handle>>::into(self) - .replace(rights).map(|handle| Self::from(handle)) - } - - /// Converts the value into its inner handle. - /// - /// This is a convenience function which simply forwards to the `Into` trait. - fn into_handle(self) -> Handle { - self.into() - } - - /// Creates an instance of this type from a handle. - /// - /// This is a convenience function which simply forwards to the `From` trait. - fn from_handle(handle: Handle) -> Self { - Self::from(handle) - } - - /// Creates an instance of another handle-based type from this value's inner handle. - fn into_handle_based<H: HandleBased>(self) -> H { - H::from_handle(self.into_handle()) - } - - /// Creates an instance of this type from the inner handle of another - /// handle-based type. - fn from_handle_based<H: HandleBased>(h: H) -> Self { - Self::from_handle(h.into_handle()) - } -} - -/// A trait implemented by all handles for objects which have a peer. -pub trait Peered: HandleBased { - /// Set and clear userspace-accessible signal bits on the object's peer. Wraps the - /// [zx_object_signal_peer](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/object_signal.md) - /// syscall. - fn signal_peer(&self, clear_mask: Signals, set_mask: Signals) -> Result<(), Status> { - let handle = self.as_handle_ref().handle; - let status = unsafe { - sys::zx_object_signal_peer(handle, clear_mask.bits(), set_mask.bits()) - }; - into_result(status, || ()) - } -} - -/// A trait implemented by all handles for objects which can have a cookie attached. -pub trait Cookied: HandleBased { - /// Get the cookie attached to this object, if any. Wraps the - /// [zx_object_get_cookie](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/object_get_cookie.md) - /// syscall. - fn get_cookie(&self, scope: &HandleRef) -> Result<u64, Status> { - let handle = self.as_handle_ref().handle; - let mut cookie = 0; - let status = unsafe { sys::zx_object_get_cookie(handle, scope.handle, &mut cookie) }; - into_result(status, || cookie) - } - - /// Attach an opaque cookie to this object with the given scope. The cookie may be read or - /// changed in future only with the same scope. Wraps the - /// [zx_object_set_cookie](https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/object_set_cookie.md) - /// syscall. - fn set_cookie(&self, scope: &HandleRef, cookie: u64) -> Result<(), Status> { - let handle = self.as_handle_ref().handle; - let status = unsafe { sys::zx_object_set_cookie(handle, scope.handle, cookie) }; - into_result(status, || ()) - } -} - -fn handle_drop(handle: sys::zx_handle_t) { - let _ = unsafe { sys::zx_handle_close(handle) }; -} - /// Wait on multiple handles. /// The success return value is a bool indicating whether one or more of the /// provided handle references was closed during the wait. @@ -634,113 +142,79 @@ fn handle_drop(handle: sys::zx_handle_t) { /// syscall. pub fn object_wait_many(items: &mut [WaitItem], deadline: Time) -> Result<bool, Status> { - let len = try!(usize_into_u32(items.len()).map_err(|_| Status::ErrOutOfRange)); + let len = try!(usize_into_u32(items.len()).map_err(|_| Status::OUT_OF_RANGE)); let items_ptr = items.as_mut_ptr() as *mut sys::zx_wait_item_t; - let status = unsafe { sys::zx_object_wait_many( items_ptr, len, deadline) }; + let status = unsafe { sys::zx_object_wait_many( items_ptr, len, deadline.nanos()) }; if status == sys::ZX_ERR_CANCELED { - return Ok((true)) - } - into_result(status, || false) -} - -// An untyped handle - -/// An object representing a Zircon -/// [handle](https://fuchsia.googlesource.com/zircon/+/master/docs/handles.md). -/// -/// Internally, it is represented as a 32-bit integer, but this wrapper enforces -/// strict ownership semantics. The `Drop` implementation closes the handle. -/// -/// This type represents the most general reference to a kernel object, and can -/// be interconverted to and from more specific types. Those conversions are not -/// enforced in the type system; attempting to use them will result in errors -/// returned by the kernel. These conversions don't change the underlying -/// representation, but do change the type and thus what operations are available. -#[derive(Debug, Eq, PartialEq, Hash)] -pub struct Handle(sys::zx_handle_t); - -impl AsHandleRef for Handle { - fn as_handle_ref(&self) -> HandleRef { - HandleRef { handle: self.0, phantom: Default::default() } - } -} - -impl HandleBased for Handle {} - -impl Drop for Handle { - fn drop(&mut self) { - handle_drop(self.0) - } -} - -impl Handle { - /// If a raw handle is obtained from some other source, this method converts - /// it into a type-safe owned handle. - pub unsafe fn from_raw(raw: sys::zx_handle_t) -> Handle { - Handle(raw) - } - - pub fn replace(self, rights: Rights) -> Result<Handle, Status> { - let handle = self.0; - let mut out = 0; - let status = unsafe { sys::zx_handle_replace(handle, rights, &mut out) }; - into_result(status, || Handle(out)) + return Ok(true) } + ok(status).map(|()| false) } #[cfg(test)] mod tests { use super::*; + #[allow(unused_imports)] + use super::prelude::*; #[test] fn monotonic_time_increases() { - let time1 = time_get(ClockId::Monotonic); - nanosleep(deadline_after(1_000)); - let time2 = time_get(ClockId::Monotonic); + let time1 = Time::get(ClockId::Monotonic); + 1_000.nanos().sleep(); + let time2 = Time::get(ClockId::Monotonic); assert!(time2 > time1); } #[test] fn utc_time_increases() { - let time1 = time_get(ClockId::UTC); - nanosleep(deadline_after(1_000)); - let time2 = time_get(ClockId::UTC); + let time1 = Time::get(ClockId::UTC); + 1_000.nanos().sleep(); + let time2 = Time::get(ClockId::UTC); assert!(time2 > time1); } #[test] fn thread_time_increases() { - let time1 = time_get(ClockId::Thread); - nanosleep(deadline_after(1_000)); - let time2 = time_get(ClockId::Thread); + let time1 = Time::get(ClockId::Thread); + 1_000.nanos().sleep(); + let time2 = Time::get(ClockId::Thread); assert!(time2 > time1); } #[test] fn ticks_increases() { let ticks1 = ticks_get(); - nanosleep(deadline_after(1_000)); + 1_000.nanos().sleep(); let ticks2 = ticks_get(); assert!(ticks2 > ticks1); } #[test] fn tick_length() { - let sleep_ns = 1_000_000; // 1ms - let one_second_ns = 1_000_000_000; // 1 second in ns + let sleep_time = 1.milli(); let ticks1 = ticks_get(); - nanosleep(deadline_after(sleep_ns)); + sleep_time.sleep(); let ticks2 = ticks_get(); + // The number of ticks should have increased by at least 1 ms worth - assert!(ticks2 > ticks1 + sleep_ns * ticks_per_second() / one_second_ns); + let sleep_ticks = sleep_time.millis() * ticks_per_second() / 1000; + assert!(ticks2 >= (ticks1 + sleep_ticks)); + } + + #[test] + fn into_raw() { + let vmo = Vmo::create(1).unwrap(); + let h = vmo.into_raw(); + let vmo2 = Vmo::from(unsafe { Handle::from_raw(h) }); + assert!(vmo2.write(b"1", 0).is_ok()); } #[test] fn sleep() { - let sleep_ns = 1_000_000; // 1ms - let time1 = time_get(ClockId::Monotonic); - nanosleep(deadline_after(sleep_ns)); - let time2 = time_get(ClockId::Monotonic); + let sleep_ns = 1.millis(); + let time1 = Time::get(ClockId::Monotonic); + sleep_ns.sleep(); + let time2 = Time::get(ClockId::Monotonic); assert!(time2 > time1 + sleep_ns); } @@ -750,16 +224,16 @@ mod tests { let hello_length: usize = 5; // Create a VMO and write some data to it. - let vmo = Vmo::create(hello_length as u64, VmoOpts::Default).unwrap(); + let vmo = Vmo::create(hello_length as u64).unwrap(); assert!(vmo.write(b"hello", 0).is_ok()); // Replace, reducing rights to read. - let readonly_vmo = vmo.duplicate_handle(ZX_RIGHT_READ).unwrap(); + let readonly_vmo = vmo.duplicate_handle(Rights::READ).unwrap(); // Make sure we can read but not write. let mut read_vec = vec![0; hello_length]; assert_eq!(readonly_vmo.read(&mut read_vec, 0).unwrap(), hello_length); assert_eq!(read_vec, b"hello"); - assert_eq!(readonly_vmo.write(b"", 0), Err(Status::ErrAccessDenied)); + assert_eq!(readonly_vmo.write(b"", 0), Err(Status::ACCESS_DENIED)); // Write new data to the original handle, and read it from the new handle assert!(vmo.write(b"bye", 0).is_ok()); @@ -773,84 +247,84 @@ mod tests { let hello_length: usize = 5; // Create a VMO and write some data to it. - let vmo = Vmo::create(hello_length as u64, VmoOpts::Default).unwrap(); + let vmo = Vmo::create(hello_length as u64).unwrap(); assert!(vmo.write(b"hello", 0).is_ok()); // Replace, reducing rights to read. - let readonly_vmo = vmo.replace_handle(ZX_RIGHT_READ).unwrap(); + let readonly_vmo = vmo.replace_handle(Rights::READ).unwrap(); // Make sure we can read but not write. let mut read_vec = vec![0; hello_length]; assert_eq!(readonly_vmo.read(&mut read_vec, 0).unwrap(), hello_length); assert_eq!(read_vec, b"hello"); - assert_eq!(readonly_vmo.write(b"", 0), Err(Status::ErrAccessDenied)); + assert_eq!(readonly_vmo.write(b"", 0), Err(Status::ACCESS_DENIED)); } #[test] fn wait_and_signal() { - let event = Event::create(EventOpts::Default).unwrap(); - let ten_ms: Duration = 10_000_000; + let event = Event::create().unwrap(); + let ten_ms = 10.millis(); // Waiting on it without setting any signal should time out. assert_eq!(event.wait_handle( - ZX_USER_SIGNAL_0, deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + Signals::USER_0, ten_ms.after_now()), Err(Status::TIMED_OUT)); // If we set a signal, we should be able to wait for it. - assert!(event.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - assert_eq!(event.wait_handle(ZX_USER_SIGNAL_0, deadline_after(ten_ms)).unwrap(), - ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert!(event.signal_handle(Signals::NONE, Signals::USER_0).is_ok()); + assert_eq!(event.wait_handle(Signals::USER_0, ten_ms.after_now()).unwrap(), + Signals::USER_0); // Should still work, signals aren't automatically cleared. - assert_eq!(event.wait_handle(ZX_USER_SIGNAL_0, deadline_after(ten_ms)).unwrap(), - ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert_eq!(event.wait_handle(Signals::USER_0, ten_ms.after_now()).unwrap(), + Signals::USER_0); // Now clear it, and waiting should time out again. - assert!(event.signal_handle(ZX_USER_SIGNAL_0, ZX_SIGNAL_NONE).is_ok()); + assert!(event.signal_handle(Signals::USER_0, Signals::NONE).is_ok()); assert_eq!(event.wait_handle( - ZX_USER_SIGNAL_0, deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + Signals::USER_0, ten_ms.after_now()), Err(Status::TIMED_OUT)); } #[test] fn wait_many_and_signal() { - let ten_ms: Duration = 10_000_000; - let e1 = Event::create(EventOpts::Default).unwrap(); - let e2 = Event::create(EventOpts::Default).unwrap(); + let ten_ms = 10.millis(); + let e1 = Event::create().unwrap(); + let e2 = Event::create().unwrap(); // Waiting on them now should time out. let mut items = vec![ - WaitItem { handle: e1.as_handle_ref(), waitfor: ZX_USER_SIGNAL_0, pending: ZX_SIGNAL_NONE }, - WaitItem { handle: e2.as_handle_ref(), waitfor: ZX_USER_SIGNAL_1, pending: ZX_SIGNAL_NONE }, + WaitItem { handle: e1.as_handle_ref(), waitfor: Signals::USER_0, pending: Signals::NONE }, + WaitItem { handle: e2.as_handle_ref(), waitfor: Signals::USER_1, pending: Signals::NONE }, ]; - assert_eq!(object_wait_many(&mut items, deadline_after(ten_ms)), Err(Status::ErrTimedOut)); - assert_eq!(items[0].pending, ZX_SIGNAL_LAST_HANDLE); - assert_eq!(items[1].pending, ZX_SIGNAL_LAST_HANDLE); + assert_eq!(object_wait_many(&mut items, ten_ms.after_now()), Err(Status::TIMED_OUT)); + assert_eq!(items[0].pending, Signals::NONE); + assert_eq!(items[1].pending, Signals::NONE); // Signal one object and it should return success. - assert!(e1.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - assert!(object_wait_many(&mut items, deadline_after(ten_ms)).is_ok()); - assert_eq!(items[0].pending, ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); - assert_eq!(items[1].pending, ZX_SIGNAL_LAST_HANDLE); + assert!(e1.signal_handle(Signals::NONE, Signals::USER_0).is_ok()); + assert!(object_wait_many(&mut items, ten_ms.after_now()).is_ok()); + assert_eq!(items[0].pending, Signals::USER_0); + assert_eq!(items[1].pending, Signals::NONE); // Signal the other and it should return both. - assert!(e2.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_1).is_ok()); - assert!(object_wait_many(&mut items, deadline_after(ten_ms)).is_ok()); - assert_eq!(items[0].pending, ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); - assert_eq!(items[1].pending, ZX_USER_SIGNAL_1 | ZX_SIGNAL_LAST_HANDLE); + assert!(e2.signal_handle(Signals::NONE, Signals::USER_1).is_ok()); + assert!(object_wait_many(&mut items, ten_ms.after_now()).is_ok()); + assert_eq!(items[0].pending, Signals::USER_0); + assert_eq!(items[1].pending, Signals::USER_1); // Clear signals on both; now it should time out again. - assert!(e1.signal_handle(ZX_USER_SIGNAL_0, ZX_SIGNAL_NONE).is_ok()); - assert!(e2.signal_handle(ZX_USER_SIGNAL_1, ZX_SIGNAL_NONE).is_ok()); - assert_eq!(object_wait_many(&mut items, deadline_after(ten_ms)), Err(Status::ErrTimedOut)); - assert_eq!(items[0].pending, ZX_SIGNAL_LAST_HANDLE); - assert_eq!(items[1].pending, ZX_SIGNAL_LAST_HANDLE); + assert!(e1.signal_handle(Signals::USER_0, Signals::NONE).is_ok()); + assert!(e2.signal_handle(Signals::USER_1, Signals::NONE).is_ok()); + assert_eq!(object_wait_many(&mut items, ten_ms.after_now()), Err(Status::TIMED_OUT)); + assert_eq!(items[0].pending, Signals::NONE); + assert_eq!(items[1].pending, Signals::NONE); } #[test] fn cookies() { - let event = Event::create(EventOpts::Default).unwrap(); - let scope = Event::create(EventOpts::Default).unwrap(); + let event = Event::create().unwrap(); + let scope = Event::create().unwrap(); // Getting a cookie when none has been set should fail. - assert_eq!(event.get_cookie(&scope.as_handle_ref()), Err(Status::ErrAccessDenied)); + assert_eq!(event.get_cookie(&scope.as_handle_ref()), Err(Status::ACCESS_DENIED)); // Set a cookie. assert_eq!(event.set_cookie(&scope.as_handle_ref(), 42), Ok(())); @@ -859,37 +333,13 @@ mod tests { assert_eq!(event.get_cookie(&scope.as_handle_ref()), Ok(42)); // but not with the wrong scope! - assert_eq!(event.get_cookie(&event.as_handle_ref()), Err(Status::ErrAccessDenied)); + assert_eq!(event.get_cookie(&event.as_handle_ref()), Err(Status::ACCESS_DENIED)); // Can change it, with the same scope... assert_eq!(event.set_cookie(&scope.as_handle_ref(), 123), Ok(())); // but not with a different scope. - assert_eq!(event.set_cookie(&event.as_handle_ref(), 123), Err(Status::ErrAccessDenied)); - } - - #[test] - fn cprng() { - let mut buffer = [0; 20]; - assert_eq!(cprng_draw(&mut buffer), Ok(20)); - assert_ne!(buffer[0], 0); - assert_ne!(buffer[19], 0); - } - - #[test] - fn cprng_too_large() { - let mut buffer = [0; ZX_CPRNG_DRAW_MAX_LEN + 1]; - assert_eq!(cprng_draw(&mut buffer), Err(Status::ErrInvalidArgs)); - - for mut s in buffer.chunks_mut(ZX_CPRNG_DRAW_MAX_LEN) { - assert_eq!(cprng_draw(&mut s), Ok(s.len())); - } - } - - #[test] - fn cprng_add() { - let buffer = [0, 1, 2]; - assert_eq!(cprng_add_entropy(&buffer), Ok(())); + assert_eq!(event.set_cookie(&event.as_handle_ref(), 123), Err(Status::ACCESS_DENIED)); } } diff --git a/src/vendor/fuchsia-zircon/src/port.rs b/src/vendor/fuchsia-zircon/src/port.rs index 74e3ea69b8..6a9e8a8f7f 100644 --- a/src/vendor/fuchsia-zircon/src/port.rs +++ b/src/vendor/fuchsia-zircon/src/port.rs @@ -7,7 +7,7 @@ use std::mem; use {AsHandleRef, HandleBased, Handle, HandleRef, Signals, Status, Time}; -use {sys, into_result}; +use {sys, ok}; /// An object representing a Zircon /// [port](https://fuchsia.googlesource.com/zircon/+/master/docs/objects/port.md). @@ -18,7 +18,7 @@ pub struct Port(Handle); impl_handle_based!(Port); /// A packet sent through a port. This is a type-safe wrapper for -/// [zx_port_packet_t](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait2.md). +/// [zx_port_packet_t](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait.md). #[derive(PartialEq, Eq, Debug)] pub struct Packet(sys::zx_port_packet_t); @@ -31,15 +31,18 @@ pub enum PacketContents { SignalOne(SignalPacket), /// A repeating signal packet generated via `object_wait_async`. SignalRep(SignalPacket), + + #[doc(hidden)] + __Nonexhaustive } /// Contents of a user packet (one sent by `port_queue`). This is a type-safe wrapper for -/// [zx_packet_user_t](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait2.md). +/// [zx_packet_user_t](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait.md). #[derive(Debug, Copy, Clone)] pub struct UserPacket(sys::zx_packet_user_t); /// Contents of a signal packet (one generated by the kernel). This is a type-safe wrapper for -/// [zx_packet_signal_t](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait2.md). +/// [zx_packet_signal_t](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait.md). #[derive(Debug, Copy, Clone)] pub struct SignalPacket(sys::zx_packet_signal_t); @@ -98,12 +101,12 @@ impl UserPacket { impl SignalPacket { /// The signals used in the call to `object_wait_async`. pub fn trigger(&self) -> Signals { - self.0.trigger + Signals::from_bits_truncate(self.0.trigger) } /// The observed signals. pub fn observed(&self) -> Signals { - self.0.observed + Signals::from_bits_truncate(self.0.observed) } /// A per object count of pending operations. @@ -118,11 +121,13 @@ impl Port { /// Wraps the /// [zx_port_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_create.md) /// syscall. - pub fn create(opts: PortOpts) -> Result<Port, Status> { + pub fn create() -> Result<Port, Status> { unsafe { let mut handle = 0; - let status = sys::zx_port_create(opts as u32, &mut handle); - into_result(status, || Self::from(Handle(handle))) + let opts = 0; + let status = sys::zx_port_create(opts, &mut handle); + ok(status)?; + Ok(Handle::from_raw(handle).into()) } } @@ -134,23 +139,24 @@ impl Port { pub fn queue(&self, packet: &Packet) -> Result<(), Status> { let status = unsafe { sys::zx_port_queue(self.raw_handle(), - &packet.0 as *const sys::zx_port_packet_t as *const u8, 0) + &packet.0 as *const sys::zx_port_packet_t, 0) }; - into_result(status, || ()) + ok(status) } /// Wait for a packet to arrive on a (V2) port. /// /// Wraps the - /// [zx_port_wait](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait2.md) + /// [zx_port_wait](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/port_wait.md) /// syscall. pub fn wait(&self, deadline: Time) -> Result<Packet, Status> { let mut packet = Default::default(); let status = unsafe { - sys::zx_port_wait(self.raw_handle(), deadline, - &mut packet as *mut sys::zx_port_packet_t as *mut u8, 0) + sys::zx_port_wait(self.raw_handle(), deadline.nanos(), + &mut packet as *mut sys::zx_port_packet_t, 0) }; - into_result(status, || Packet(packet)) + ok(status)?; + Ok(Packet(packet)) } /// Cancel pending wait_async calls for an object with the given key. @@ -162,21 +168,7 @@ impl Port { let status = unsafe { sys::zx_port_cancel(self.raw_handle(), source.raw_handle(), key) }; - into_result(status, || ()) - } -} - -/// Options for creating a port. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum PortOpts { - /// Default options. - Default = 0, -} - -impl Default for PortOpts { - fn default() -> Self { - PortOpts::Default + ok(status) } } @@ -191,18 +183,16 @@ pub enum WaitAsyncOpts { #[cfg(test)] mod tests { use super::*; - use {Duration, Event, EventOpts}; - use {ZX_SIGNAL_LAST_HANDLE, ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0, ZX_USER_SIGNAL_1}; - use deadline_after; + use {DurationNum, Event}; #[test] fn port_basic() { - let ten_ms: Duration = 10_000_000; + let ten_ms = 10.millis(); - let port = Port::create(PortOpts::Default).unwrap(); + let port = Port::create().unwrap(); // Waiting now should time out. - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // Send a valid packet. let packet = Packet::from_user_packet( @@ -213,50 +203,50 @@ mod tests { assert!(port.queue(&packet).is_ok()); // Waiting should succeed this time. We should get back the packet we sent. - let read_packet = port.wait(deadline_after(ten_ms)).unwrap(); + let read_packet = port.wait(ten_ms.after_now()).unwrap(); assert_eq!(read_packet, packet); } #[test] fn wait_async_once() { - let ten_ms: Duration = 10_000_000; + let ten_ms = 10.millis(); let key = 42; - let port = Port::create(PortOpts::Default).unwrap(); - let event = Event::create(EventOpts::Default).unwrap(); + let port = Port::create().unwrap(); + let event = Event::create().unwrap(); - assert!(event.wait_async_handle(&port, key, ZX_USER_SIGNAL_0 | ZX_USER_SIGNAL_1, + assert!(event.wait_async_handle(&port, key, Signals::USER_0 | Signals::USER_1, WaitAsyncOpts::Once).is_ok()); // Waiting without setting any signal should time out. - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // If we set a signal, we should be able to wait for it. - assert!(event.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - let read_packet = port.wait(deadline_after(ten_ms)).unwrap(); + assert!(event.signal_handle(Signals::NONE, Signals::USER_0).is_ok()); + let read_packet = port.wait(ten_ms.after_now()).unwrap(); assert_eq!(read_packet.key(), key); assert_eq!(read_packet.status(), 0); match read_packet.contents() { PacketContents::SignalOne(sig) => { - assert_eq!(sig.trigger(), ZX_USER_SIGNAL_0 | ZX_USER_SIGNAL_1); - assert_eq!(sig.observed(), ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert_eq!(sig.trigger(), Signals::USER_0 | Signals::USER_1); + assert_eq!(sig.observed(), Signals::USER_0); assert_eq!(sig.count(), 1); } _ => panic!("wrong packet type"), } // Shouldn't get any more packets. - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // Calling wait_async again should result in another packet. - assert!(event.wait_async_handle(&port, key, ZX_USER_SIGNAL_0, WaitAsyncOpts::Once).is_ok()); - let read_packet = port.wait(deadline_after(ten_ms)).unwrap(); + assert!(event.wait_async_handle(&port, key, Signals::USER_0, WaitAsyncOpts::Once).is_ok()); + let read_packet = port.wait(ten_ms.after_now()).unwrap(); assert_eq!(read_packet.key(), key); assert_eq!(read_packet.status(), 0); match read_packet.contents() { PacketContents::SignalOne(sig) => { - assert_eq!(sig.trigger(), ZX_USER_SIGNAL_0); - assert_eq!(sig.observed(), ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert_eq!(sig.trigger(), Signals::USER_0); + assert_eq!(sig.observed(), Signals::USER_0); assert_eq!(sig.count(), 1); } _ => panic!("wrong packet type"), @@ -264,41 +254,41 @@ mod tests { // Calling wait_async_handle then cancel, we should not get a packet as cancel will // remove it from the queue. - assert!(event.wait_async_handle(&port, key, ZX_USER_SIGNAL_0, WaitAsyncOpts::Once).is_ok()); + assert!(event.wait_async_handle(&port, key, Signals::USER_0, WaitAsyncOpts::Once).is_ok()); assert!(port.cancel(&event, key).is_ok()); - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // If the event is signalled after the cancel, we also shouldn't get a packet. - assert!(event.signal_handle(ZX_USER_SIGNAL_0, ZX_SIGNAL_NONE).is_ok()); // clear signal - assert!(event.wait_async_handle(&port, key, ZX_USER_SIGNAL_0, WaitAsyncOpts::Once).is_ok()); + assert!(event.signal_handle(Signals::USER_0, Signals::NONE).is_ok()); // clear signal + assert!(event.wait_async_handle(&port, key, Signals::USER_0, WaitAsyncOpts::Once).is_ok()); assert!(port.cancel(&event, key).is_ok()); - assert!(event.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert!(event.signal_handle(Signals::NONE, Signals::USER_0).is_ok()); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); } #[test] fn wait_async_repeating() { - let ten_ms: Duration = 10_000_000; + let ten_ms = 10.millis(); let key = 42; - let port = Port::create(PortOpts::Default).unwrap(); - let event = Event::create(EventOpts::Default).unwrap(); + let port = Port::create().unwrap(); + let event = Event::create().unwrap(); - assert!(event.wait_async_handle(&port, key, ZX_USER_SIGNAL_0 | ZX_USER_SIGNAL_1, + assert!(event.wait_async_handle(&port, key, Signals::USER_0 | Signals::USER_1, WaitAsyncOpts::Repeating).is_ok()); // Waiting without setting any signal should time out. - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // If we set a signal, we should be able to wait for it. - assert!(event.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - let read_packet = port.wait(deadline_after(ten_ms)).unwrap(); + assert!(event.signal_handle(Signals::NONE, Signals::USER_0).is_ok()); + let read_packet = port.wait(ten_ms.after_now()).unwrap(); assert_eq!(read_packet.key(), key); assert_eq!(read_packet.status(), 0); match read_packet.contents() { PacketContents::SignalRep(sig) => { - assert_eq!(sig.trigger(), ZX_USER_SIGNAL_0 | ZX_USER_SIGNAL_1); - assert_eq!(sig.observed(), ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert_eq!(sig.trigger(), Signals::USER_0 | Signals::USER_1); + assert_eq!(sig.observed(), Signals::USER_0); assert_eq!(sig.count(), 1); } _ => panic!("wrong packet type"), @@ -306,19 +296,19 @@ mod tests { // Should not get any more packets, as ZX_WAIT_ASYNC_REPEATING is edge triggered rather than // level triggered. - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // If we clear and resignal, we should get the same packet again, // even though we didn't call event.wait_async again. - assert!(event.signal_handle(ZX_USER_SIGNAL_0, ZX_SIGNAL_NONE).is_ok()); // clear signal - assert!(event.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - let read_packet = port.wait(deadline_after(ten_ms)).unwrap(); + assert!(event.signal_handle(Signals::USER_0, Signals::NONE).is_ok()); // clear signal + assert!(event.signal_handle(Signals::NONE, Signals::USER_0).is_ok()); + let read_packet = port.wait(ten_ms.after_now()).unwrap(); assert_eq!(read_packet.key(), key); assert_eq!(read_packet.status(), 0); match read_packet.contents() { PacketContents::SignalRep(sig) => { - assert_eq!(sig.trigger(), ZX_USER_SIGNAL_0 | ZX_USER_SIGNAL_1); - assert_eq!(sig.observed(), ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert_eq!(sig.trigger(), Signals::USER_0 | Signals::USER_1); + assert_eq!(sig.observed(), Signals::USER_0); assert_eq!(sig.count(), 1); } _ => panic!("wrong packet type"), @@ -326,22 +316,22 @@ mod tests { // Cancelling the wait should stop us getting packets... assert!(port.cancel(&event, key).is_ok()); - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // ... even if we clear and resignal - assert!(event.signal_handle(ZX_USER_SIGNAL_0, ZX_SIGNAL_NONE).is_ok()); // clear signal - assert!(event.signal_handle(ZX_SIGNAL_NONE, ZX_USER_SIGNAL_0).is_ok()); - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert!(event.signal_handle(Signals::USER_0, Signals::NONE).is_ok()); // clear signal + assert!(event.signal_handle(Signals::NONE, Signals::USER_0).is_ok()); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); // Calling wait_async again should result in another packet. assert!(event.wait_async_handle( - &port, key, ZX_USER_SIGNAL_0, WaitAsyncOpts::Repeating).is_ok()); - let read_packet = port.wait(deadline_after(ten_ms)).unwrap(); + &port, key, Signals::USER_0, WaitAsyncOpts::Repeating).is_ok()); + let read_packet = port.wait(ten_ms.after_now()).unwrap(); assert_eq!(read_packet.key(), key); assert_eq!(read_packet.status(), 0); match read_packet.contents() { PacketContents::SignalRep(sig) => { - assert_eq!(sig.trigger(), ZX_USER_SIGNAL_0); - assert_eq!(sig.observed(), ZX_USER_SIGNAL_0 | ZX_SIGNAL_LAST_HANDLE); + assert_eq!(sig.trigger(), Signals::USER_0); + assert_eq!(sig.observed(), Signals::USER_0); assert_eq!(sig.count(), 1); } _ => panic!("wrong packet type"), @@ -349,6 +339,6 @@ mod tests { // Closing the handle should stop us getting packets. drop(event); - assert_eq!(port.wait(deadline_after(ten_ms)), Err(Status::ErrTimedOut)); + assert_eq!(port.wait(ten_ms.after_now()), Err(Status::TIMED_OUT)); } } diff --git a/src/vendor/fuchsia-zircon/src/rights.rs b/src/vendor/fuchsia-zircon/src/rights.rs new file mode 100644 index 0000000000..a41ad12f54 --- /dev/null +++ b/src/vendor/fuchsia-zircon/src/rights.rs @@ -0,0 +1,28 @@ +use sys; + +bitflags! { + /// Rights associated with a handle. + /// + /// See [rights.md](https://fuchsia.googlesource.com/zircon/+/master/docs/rights.md) + /// for more information. + #[repr(C)] + pub struct Rights: sys::zx_rights_t { + const NONE = sys::ZX_RIGHT_NONE; + const DUPLICATE = sys::ZX_RIGHT_DUPLICATE; + const TRANSFER = sys::ZX_RIGHT_TRANSFER; + const READ = sys::ZX_RIGHT_READ; + const WRITE = sys::ZX_RIGHT_WRITE; + const EXECUTE = sys::ZX_RIGHT_EXECUTE; + const MAP = sys::ZX_RIGHT_MAP; + const GET_PROPERTY = sys::ZX_RIGHT_GET_PROPERTY; + const SET_PROPERTY = sys::ZX_RIGHT_SET_PROPERTY; + const ENUMERATE = sys::ZX_RIGHT_ENUMERATE; + const DESTROY = sys::ZX_RIGHT_DESTROY; + const SET_POLICY = sys::ZX_RIGHT_SET_POLICY; + const GET_POLICY = sys::ZX_RIGHT_GET_POLICY; + const SIGNAL = sys::ZX_RIGHT_SIGNAL; + const SIGNAL_PEER = sys::ZX_RIGHT_SIGNAL_PEER; + const WAIT = sys::ZX_RIGHT_WAIT; + const SAME_RIGHTS = sys::ZX_RIGHT_SAME_RIGHTS; + } +} \ No newline at end of file diff --git a/src/vendor/fuchsia-zircon/src/signals.rs b/src/vendor/fuchsia-zircon/src/signals.rs new file mode 100644 index 0000000000..e5189f5ebc --- /dev/null +++ b/src/vendor/fuchsia-zircon/src/signals.rs @@ -0,0 +1,105 @@ +use sys::*; + +bitflags! { + /// Signals that can be waited upon. + /// + /// See + /// [Objects and signals](https://fuchsia.googlesource.com/zircon/+/master/docs/concepts.md#Objects-and-Signals) + /// in the Zircon kernel documentation. Note: the names of signals are still in flux. + #[repr(C)] + pub struct Signals: zx_signals_t { + const NONE = ZX_SIGNAL_NONE; + const OBJECT_ALL = ZX_OBJECT_SIGNAL_ALL; + const USER_ALL = ZX_USER_SIGNAL_ALL; + const OBJECT_0 = ZX_OBJECT_SIGNAL_0; + const OBJECT_1 = ZX_OBJECT_SIGNAL_1; + const OBJECT_2 = ZX_OBJECT_SIGNAL_2; + const OBJECT_3 = ZX_OBJECT_SIGNAL_3; + const OBJECT_4 = ZX_OBJECT_SIGNAL_4; + const OBJECT_5 = ZX_OBJECT_SIGNAL_5; + const OBJECT_6 = ZX_OBJECT_SIGNAL_6; + const OBJECT_7 = ZX_OBJECT_SIGNAL_7; + const OBJECT_8 = ZX_OBJECT_SIGNAL_8; + const OBJECT_9 = ZX_OBJECT_SIGNAL_9; + const OBJECT_10 = ZX_OBJECT_SIGNAL_10; + const OBJECT_11 = ZX_OBJECT_SIGNAL_11; + const OBJECT_12 = ZX_OBJECT_SIGNAL_12; + const OBJECT_13 = ZX_OBJECT_SIGNAL_13; + const OBJECT_14 = ZX_OBJECT_SIGNAL_14; + const OBJECT_15 = ZX_OBJECT_SIGNAL_15; + const OBJECT_16 = ZX_OBJECT_SIGNAL_16; + const OBJECT_17 = ZX_OBJECT_SIGNAL_17; + const OBJECT_18 = ZX_OBJECT_SIGNAL_18; + const OBJECT_19 = ZX_OBJECT_SIGNAL_19; + const OBJECT_20 = ZX_OBJECT_SIGNAL_20; + const OBJECT_21 = ZX_OBJECT_SIGNAL_21; + const OBJECT_22 = ZX_OBJECT_SIGNAL_22; + const OBJECT_HANDLE_CLOSED = ZX_OBJECT_HANDLE_CLOSED; + const USER_0 = ZX_USER_SIGNAL_0; + const USER_1 = ZX_USER_SIGNAL_1; + const USER_2 = ZX_USER_SIGNAL_2; + const USER_3 = ZX_USER_SIGNAL_3; + const USER_4 = ZX_USER_SIGNAL_4; + const USER_5 = ZX_USER_SIGNAL_5; + const USER_6 = ZX_USER_SIGNAL_6; + const USER_7 = ZX_USER_SIGNAL_7; + + const OBJECT_READABLE = ZX_OBJECT_READABLE; + const OBJECT_WRITABLE = ZX_OBJECT_WRITABLE; + const OBJECT_PEER_CLOSED = ZX_OBJECT_PEER_CLOSED; + + // Cancelation (handle was closed while waiting with it) + const HANDLE_CLOSED = ZX_SIGNAL_HANDLE_CLOSED; + + // Event + const EVENT_SIGNALED = ZX_EVENT_SIGNALED; + + // EventPair + const EVENT_PAIR_SIGNALED = ZX_EPAIR_SIGNALED; + const EVENT_PAIR_CLOSED = ZX_EPAIR_CLOSED; + + // Task signals (process, thread, job) + const TASK_TERMINATED = ZX_TASK_TERMINATED; + + // Channel + const CHANNEL_READABLE = ZX_CHANNEL_READABLE; + const CHANNEL_WRITABLE = ZX_CHANNEL_WRITABLE; + const CHANNEL_PEER_CLOSED = ZX_CHANNEL_PEER_CLOSED; + + // Socket + const SOCKET_READABLE = ZX_SOCKET_READABLE; + const SOCKET_WRITABLE = ZX_SOCKET_WRITABLE; + const SOCKET_PEER_CLOSED = ZX_SOCKET_PEER_CLOSED; + + // Port + const PORT_READABLE = ZX_PORT_READABLE; + + // Resource + const RESOURCE_DESTROYED = ZX_RESOURCE_DESTROYED; + const RESOURCE_READABLE = ZX_RESOURCE_READABLE; + const RESOURCE_WRITABLE = ZX_RESOURCE_WRITABLE; + const RESOURCE_CHILD_ADDED = ZX_RESOURCE_CHILD_ADDED; + + // Fifo + const FIFO_READABLE = ZX_FIFO_READABLE; + const FIFO_WRITABLE = ZX_FIFO_WRITABLE; + const FIFO_PEER_CLOSED = ZX_FIFO_PEER_CLOSED; + + // Job + const JOB_NO_PROCESSES = ZX_JOB_NO_PROCESSES; + const JOB_NO_JOBS = ZX_JOB_NO_JOBS; + + // Process + const PROCESS_TERMINATED = ZX_PROCESS_TERMINATED; + + // Thread + const THREAD_TERMINATED = ZX_THREAD_TERMINATED; + + // Log + const LOG_READABLE = ZX_LOG_READABLE; + const LOG_WRITABLE = ZX_LOG_WRITABLE; + + // Timer + const TIMER_SIGNALED = ZX_TIMER_SIGNALED; + } +} \ No newline at end of file diff --git a/src/vendor/fuchsia-zircon/src/socket.rs b/src/vendor/fuchsia-zircon/src/socket.rs index 92a5693645..c93e98cb73 100644 --- a/src/vendor/fuchsia-zircon/src/socket.rs +++ b/src/vendor/fuchsia-zircon/src/socket.rs @@ -5,7 +5,7 @@ //! Type-safe bindings for Zircon sockets. use {AsHandleRef, HandleBased, Handle, HandleRef, Peered}; -use {sys, Status, into_result}; +use {sys, Status, ok}; use std::ptr; @@ -18,63 +18,23 @@ pub struct Socket(Handle); impl_handle_based!(Socket); impl Peered for Socket {} -/// Options for creating a socket pair. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum SocketOpts { - /// Default options. - Default = 0, -} - -impl Default for SocketOpts { - fn default() -> Self { - SocketOpts::Default - } -} - -/// Options for writing into a socket. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum SocketWriteOpts { - /// Default options. - Default = 0, -} - -impl Default for SocketWriteOpts { - fn default() -> Self { - SocketWriteOpts::Default - } -} - -/// Options for reading from a socket. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum SocketReadOpts { - /// Default options. - Default = 0, -} - -impl Default for SocketReadOpts { - fn default() -> Self { - SocketReadOpts::Default - } -} - - impl Socket { /// Create a socket, accessed through a pair of endpoints. Data written /// into one may be read from the other. /// /// Wraps /// [zx_socket_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/socket_create.md). - pub fn create(opts: SocketOpts) -> Result<(Socket, Socket), Status> { + pub fn create() -> Result<(Socket, Socket), Status> { unsafe { let mut out0 = 0; let mut out1 = 0; - let status = sys::zx_socket_create(opts as u32, &mut out0, &mut out1); - into_result(status, || - (Self::from(Handle(out0)), - Self::from(Handle(out1)))) + let opts = 0; + let status = sys::zx_socket_create(opts, &mut out0, &mut out1); + ok(status)?; + Ok(( + Self::from(Handle::from_raw(out0)), + Self::from(Handle::from_raw(out1)) + )) } } @@ -83,13 +43,14 @@ impl Socket { /// /// Wraps /// [zx_socket_write](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/socket_write.md). - pub fn write(&self, opts: SocketWriteOpts, bytes: &[u8]) -> Result<usize, Status> { + pub fn write(&self, bytes: &[u8]) -> Result<usize, Status> { let mut actual = 0; + let opts = 0; let status = unsafe { - sys::zx_socket_write(self.raw_handle(), opts as u32, bytes.as_ptr(), bytes.len(), + sys::zx_socket_write(self.raw_handle(), opts, bytes.as_ptr(), bytes.len(), &mut actual) }; - into_result(status, || actual) + ok(status).map(|()| actual) } /// Read the given bytes from the socket. @@ -97,18 +58,21 @@ impl Socket { /// /// Wraps /// [zx_socket_read](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/socket_read.md). - pub fn read(&self, opts: SocketReadOpts, bytes: &mut [u8]) -> Result<usize, Status> { + pub fn read(&self, bytes: &mut [u8]) -> Result<usize, Status> { let mut actual = 0; + let opts = 0; let status = unsafe { - sys::zx_socket_read(self.raw_handle(), opts as u32, bytes.as_mut_ptr(), + sys::zx_socket_read(self.raw_handle(), opts, bytes.as_mut_ptr(), bytes.len(), &mut actual) }; - if status != sys::ZX_OK { - // If an error is returned then actual is undefined, so to be safe we set it to 0 and - // ignore any data that is set in bytes. - actual = 0; - } - into_result(status, || actual) + ok(status) + .map(|()| actual) + .map_err(|status| { + // If an error is returned then actual is undefined, so to be safe + // we set it to 0 and ignore any data that is set in bytes. + actual = 0; + status + }) } /// Close half of the socket, so attempts by the other side to write will fail. @@ -118,7 +82,7 @@ impl Socket { pub fn half_close(&self) -> Result<(), Status> { let status = unsafe { sys::zx_socket_write(self.raw_handle(), sys::ZX_SOCKET_HALF_CLOSE, ptr::null(), 0, ptr::null_mut()) }; - into_result(status, || ()) + ok(status) } pub fn outstanding_read_bytes(&self) -> Result<usize, Status> { @@ -126,7 +90,7 @@ impl Socket { let status = unsafe { sys::zx_socket_read(self.raw_handle(), 0, ptr::null_mut(), 0, &mut outstanding) }; - into_result(status, || outstanding) + ok(status).map(|()| outstanding) } } @@ -136,27 +100,27 @@ mod tests { #[test] fn socket_basic() { - let (s1, s2) = Socket::create(SocketOpts::Default).unwrap(); + let (s1, s2) = Socket::create().unwrap(); // Write in one end and read it back out the other. - assert_eq!(s1.write(SocketWriteOpts::Default, b"hello").unwrap(), 5); + assert_eq!(s1.write(b"hello").unwrap(), 5); let mut read_vec = vec![0; 8]; - assert_eq!(s2.read(SocketReadOpts::Default, &mut read_vec).unwrap(), 5); + assert_eq!(s2.read(&mut read_vec).unwrap(), 5); assert_eq!(&read_vec[0..5], b"hello"); // Try reading when there is nothing to read. - assert_eq!(s2.read(SocketReadOpts::Default, &mut read_vec), Err(Status::ErrShouldWait)); + assert_eq!(s2.read(&mut read_vec), Err(Status::SHOULD_WAIT)); // Close the socket from one end. assert!(s1.half_close().is_ok()); - assert_eq!(s2.read(SocketReadOpts::Default, &mut read_vec), Err(Status::ErrBadState)); - assert_eq!(s1.write(SocketWriteOpts::Default, b"fail"), Err(Status::ErrBadState)); + assert_eq!(s2.read(&mut read_vec), Err(Status::BAD_STATE)); + assert_eq!(s1.write(b"fail"), Err(Status::BAD_STATE)); // Writing in the other direction should still work. - assert_eq!(s1.read(SocketReadOpts::Default, &mut read_vec), Err(Status::ErrShouldWait)); - assert_eq!(s2.write(SocketWriteOpts::Default, b"back").unwrap(), 4); - assert_eq!(s1.read(SocketReadOpts::Default, &mut read_vec).unwrap(), 4); + assert_eq!(s1.read(&mut read_vec), Err(Status::SHOULD_WAIT)); + assert_eq!(s2.write(b"back").unwrap(), 4); + assert_eq!(s1.read(&mut read_vec).unwrap(), 4); assert_eq!(&read_vec[0..4], b"back"); } } diff --git a/src/vendor/fuchsia-zircon/src/status.rs b/src/vendor/fuchsia-zircon/src/status.rs new file mode 100644 index 0000000000..4f3e38f988 --- /dev/null +++ b/src/vendor/fuchsia-zircon/src/status.rs @@ -0,0 +1,162 @@ +use std::ffi::NulError; +use std::io; +use sys; + +/// Status type indicating the result of a Fuchsia syscall. +/// +/// This type is generally used to indicate the reason for an error. +/// While this type can contain `Status::OK` (`ZX_OK` in C land), elements of this type are +/// generally constructed using the `ok` method, which checks for `ZX_OK` and returns a +/// `Result<(), Status>` appropriately. +#[repr(C)] +#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] +pub struct Status(sys::zx_status_t); +impl Status { + /// Returns `Ok(())` if the status was `OK`, + /// otherwise returns `Err(status)`. + pub fn ok(raw: sys::zx_status_t) -> Result<(), Status> { + if raw == Status::OK.0 { + Ok(()) + } else { + Err(Status(raw)) + } + } + + pub fn from_raw(raw: sys::zx_status_t) -> Self { + Status(raw) + } + + pub fn into_raw(self) -> sys::zx_status_t { + self.0 + } +} +assoc_consts!(Status, [ + OK = sys::ZX_OK; + INTERNAL = sys::ZX_ERR_INTERNAL; + NOT_SUPPORTED = sys::ZX_ERR_NOT_SUPPORTED; + NO_RESOURCES = sys::ZX_ERR_NO_RESOURCES; + NO_MEMORY = sys::ZX_ERR_NO_MEMORY; + CALL_FAILED = sys::ZX_ERR_CALL_FAILED; + INTERRUPTED_RETRY = sys::ZX_ERR_INTERRUPTED_RETRY; + INVALID_ARGS = sys::ZX_ERR_INVALID_ARGS; + BAD_HANDLE = sys::ZX_ERR_BAD_HANDLE; + WRONG_TYPE = sys::ZX_ERR_WRONG_TYPE; + BAD_SYSCALL = sys::ZX_ERR_BAD_SYSCALL; + OUT_OF_RANGE = sys::ZX_ERR_OUT_OF_RANGE; + BUFFER_TOO_SMALL = sys::ZX_ERR_BUFFER_TOO_SMALL; + BAD_STATE = sys::ZX_ERR_BAD_STATE; + TIMED_OUT = sys::ZX_ERR_TIMED_OUT; + SHOULD_WAIT = sys::ZX_ERR_SHOULD_WAIT; + CANCELED = sys::ZX_ERR_CANCELED; + PEER_CLOSED = sys::ZX_ERR_PEER_CLOSED; + NOT_FOUND = sys::ZX_ERR_NOT_FOUND; + ALREADY_EXISTS = sys::ZX_ERR_ALREADY_EXISTS; + ALREADY_BOUND = sys::ZX_ERR_ALREADY_BOUND; + UNAVAILABLE = sys::ZX_ERR_UNAVAILABLE; + ACCESS_DENIED = sys::ZX_ERR_ACCESS_DENIED; + IO = sys::ZX_ERR_IO; + IO_REFUSED = sys::ZX_ERR_IO_REFUSED; + IO_DATA_INTEGRITY = sys::ZX_ERR_IO_DATA_INTEGRITY; + IO_DATA_LOSS = sys::ZX_ERR_IO_DATA_LOSS; + BAD_PATH = sys::ZX_ERR_BAD_PATH; + NOT_DIR = sys::ZX_ERR_NOT_DIR; + NOT_FILE = sys::ZX_ERR_NOT_FILE; + FILE_BIG = sys::ZX_ERR_FILE_BIG; + NO_SPACE = sys::ZX_ERR_NO_SPACE; + STOP = sys::ZX_ERR_STOP; + NEXT = sys::ZX_ERR_NEXT; +]); + +impl Status { + pub fn into_io_error(self) -> io::Error { + self.into() + } +} + +impl From<io::ErrorKind> for Status { + fn from(kind: io::ErrorKind) -> Self { + use std::io::ErrorKind::*; + match kind { + NotFound => Status::NOT_FOUND, + PermissionDenied => Status::ACCESS_DENIED, + ConnectionRefused => Status::IO_REFUSED, + ConnectionAborted => Status::PEER_CLOSED, + AddrInUse => Status::ALREADY_BOUND, + AddrNotAvailable => Status::UNAVAILABLE, + BrokenPipe => Status::PEER_CLOSED, + AlreadyExists => Status::ALREADY_EXISTS, + WouldBlock => Status::SHOULD_WAIT, + InvalidInput => Status::INVALID_ARGS, + TimedOut => Status::TIMED_OUT, + Interrupted => Status::INTERRUPTED_RETRY, + UnexpectedEof | + WriteZero | + ConnectionReset | + NotConnected | + Other | _ => Status::IO, + } + } +} + +impl From<Status> for io::ErrorKind { + fn from(status: Status) -> io::ErrorKind { + use std::io::ErrorKind::*; + match status { + Status::INTERRUPTED_RETRY => Interrupted, + Status::BAD_HANDLE => BrokenPipe, + Status::TIMED_OUT => TimedOut, + Status::SHOULD_WAIT => WouldBlock, + Status::PEER_CLOSED => ConnectionAborted, + Status::NOT_FOUND => NotFound, + Status::ALREADY_EXISTS => AlreadyExists, + Status::ALREADY_BOUND => AlreadyExists, + Status::UNAVAILABLE => AddrNotAvailable, + Status::ACCESS_DENIED => PermissionDenied, + Status::IO_REFUSED => ConnectionRefused, + Status::IO_DATA_INTEGRITY => InvalidData, + + Status::BAD_PATH | + Status::INVALID_ARGS | + Status::OUT_OF_RANGE | + Status::WRONG_TYPE => InvalidInput, + + Status::OK | + Status::NEXT | + Status::STOP | + Status::NO_SPACE | + Status::FILE_BIG | + Status::NOT_FILE | + Status::NOT_DIR | + Status::IO_DATA_LOSS | + Status::IO | + Status::CANCELED | + Status::BAD_STATE | + Status::BUFFER_TOO_SMALL | + Status::BAD_SYSCALL | + Status::INTERNAL | + Status::NOT_SUPPORTED | + Status::NO_RESOURCES | + Status::NO_MEMORY | + Status::CALL_FAILED | + _ => Other, + } + } +} + +impl From<io::Error> for Status { + fn from(err: io::Error) -> Status { + err.kind().into() + } +} + +impl From<Status> for io::Error { + fn from(status: Status) -> io::Error { + io::Error::from(io::ErrorKind::from(status)) + } +} + +impl From<NulError> for Status { + fn from(_error: NulError) -> Status { + Status::INVALID_ARGS + } +} diff --git a/src/vendor/fuchsia-zircon/src/time.rs b/src/vendor/fuchsia-zircon/src/time.rs new file mode 100644 index 0000000000..249eedd518 --- /dev/null +++ b/src/vendor/fuchsia-zircon/src/time.rs @@ -0,0 +1,340 @@ +// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Type-safe bindings for Zircon timer objects. + +use {AsHandleRef, ClockId, HandleBased, Handle, HandleRef, Status}; +use {sys, ok}; +use std::ops; +use std::time as stdtime; + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +pub struct Duration(sys::zx_duration_t); + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +pub struct Time(sys::zx_time_t); + +impl From<stdtime::Duration> for Duration { + fn from(dur: stdtime::Duration) -> Self { + Duration::from_seconds(dur.as_secs()) + + Duration::from_nanos(dur.subsec_nanos() as u64) + } +} + +impl From<Duration> for stdtime::Duration { + fn from(dur: Duration) -> Self { + let secs = dur.seconds(); + let nanos = (dur.nanos() - (secs * 1_000_000_000)) as u32; + stdtime::Duration::new(secs, nanos) + } +} + +impl ops::Add<Duration> for Time { + type Output = Time; + fn add(self, dur: Duration) -> Time { + Time::from_nanos(dur.nanos() + self.nanos()) + } +} + +impl ops::Add<Time> for Duration { + type Output = Time; + fn add(self, time: Time) -> Time { + Time::from_nanos(self.nanos() + time.nanos()) + } +} + +impl ops::Add for Duration { + type Output = Duration; + fn add(self, dur: Duration) -> Duration { + Duration::from_nanos(self.nanos() + dur.nanos()) + } +} + +impl ops::Sub for Duration { + type Output = Duration; + fn sub(self, dur: Duration) -> Duration { + Duration::from_nanos(self.nanos() - dur.nanos()) + } +} + +impl ops::Sub<Duration> for Time { + type Output = Time; + fn sub(self, dur: Duration) -> Time { + Time::from_nanos(self.nanos() - dur.nanos()) + } +} + +impl ops::AddAssign for Duration { + fn add_assign(&mut self, dur: Duration) { + self.0 += dur.nanos() + } +} + +impl ops::SubAssign for Duration { + fn sub_assign(&mut self, dur: Duration) { + self.0 -= dur.nanos() + } +} + +impl ops::AddAssign<Duration> for Time { + fn add_assign(&mut self, dur: Duration) { + self.0 += dur.nanos() + } +} + +impl ops::SubAssign<Duration> for Time { + fn sub_assign(&mut self, dur: Duration) { + self.0 -= dur.nanos() + } +} + +impl<T> ops::Mul<T> for Duration + where T: Into<u64> +{ + type Output = Self; + fn mul(self, mul: T) -> Self { + Duration::from_nanos(self.0 * mul.into()) + } +} + +impl<T> ops::Div<T> for Duration + where T: Into<u64> +{ + type Output = Self; + fn div(self, div: T) -> Self { + Duration::from_nanos(self.0 / div.into()) + } +} + +impl Duration { + /// Sleep for the given amount of time. + pub fn sleep(self) { + Time::after(self).sleep() + } + + pub fn nanos(self) -> u64 { + self.0 + } + + pub fn millis(self) -> u64 { + self.0 / 1_000_000 + } + + pub fn seconds(self) -> u64 { + self.millis() / 1_000 + } + + pub fn minutes(self) -> u64 { + self.seconds() / 60 + } + + pub fn hours(self) -> u64 { + self.minutes() / 60 + } + + pub fn from_nanos(nanos: u64) -> Self { + Duration(nanos) + } + + pub fn from_millis(millis: u64) -> Self { + Duration(millis * 1_000_000) + } + + pub fn from_seconds(secs: u64) -> Self { + Duration::from_millis(secs * 1_000) + } + + pub fn from_minutes(min: u64) -> Self { + Duration::from_seconds(min * 60) + } + + pub fn from_hours(hours: u64) -> Self { + Duration::from_minutes(hours * 60) + } + + /// Returns a `Time` which is a `Duration` after the current time. + /// `duration.after_now()` is equivalent to `Time::after(duration)`. + pub fn after_now(self) -> Time { + Time::after(self) + } +} + +pub trait DurationNum: Sized { + fn nanos(self) -> Duration; + fn millis(self) -> Duration; + fn seconds(self) -> Duration; + fn minutes(self) -> Duration; + fn hours(self) -> Duration; + + // Singular versions to allow for `1.milli()` and `1.second()`, etc. + fn milli(self) -> Duration { self.millis() } + fn second(self) -> Duration { self.seconds() } + fn minute(self) -> Duration { self.minutes() } + fn hour(self) -> Duration { self.hours() } +} + +// Note: this could be implemented for other unsized integer types, but it doesn't seem +// necessary to support the usual case. +impl DurationNum for u64 { + fn nanos(self) -> Duration { + Duration::from_nanos(self) + } + + fn millis(self) -> Duration { + Duration::from_millis(self) + } + + fn seconds(self) -> Duration { + Duration::from_seconds(self) + } + + fn minutes(self) -> Duration { + Duration::from_minutes(self) + } + + fn hours(self) -> Duration { + Duration::from_hours(self) + } +} + +impl Time { + pub const INFINITE: Time = Time(sys::ZX_TIME_INFINITE); + + /// Get the current time, from the specific clock id. + /// + /// Wraps the + /// [zx_time_get](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/time_get.md) + /// syscall. + pub fn get(clock_id: ClockId) -> Time { + unsafe { Time(sys::zx_time_get(clock_id as u32)) } + } + + /// Compute a deadline for the time in the future that is the given `Duration` away. + /// + /// Wraps the + /// [zx_deadline_after](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/deadline_after.md) + /// syscall. + pub fn after(duration: Duration) -> Time { + unsafe { Time(sys::zx_deadline_after(duration.0)) } + } + + /// Sleep until the given time. + /// + /// Wraps the + /// [zx_nanosleep](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/nanosleep.md) + /// syscall. + pub fn sleep(self) { + unsafe { sys::zx_nanosleep(self.0); } + } + + pub fn nanos(self) -> u64 { + self.0 + } + + pub fn from_nanos(nanos: u64) -> Self { + Time(nanos) + } +} + +/// Read the number of high-precision timer ticks since boot. These ticks may be processor cycles, +/// high speed timer, profiling timer, etc. They are not guaranteed to continue advancing when the +/// system is asleep. +/// +/// Wraps the +/// [zx_ticks_get](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/ticks_get.md) +/// syscall. +pub fn ticks_get() -> u64 { + unsafe { sys::zx_ticks_get() } +} + +/// Return the number of high-precision timer ticks in a second. +/// +/// Wraps the +/// [zx_ticks_per_second](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/ticks_per_second.md) +/// syscall. +pub fn ticks_per_second() -> u64 { + unsafe { sys::zx_ticks_per_second() } +} + +/// An object representing a Zircon timer, such as the one returned by +/// [zx_timer_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/timer_create.md). +/// +/// As essentially a subtype of `Handle`, it can be freely interconverted. +#[derive(Debug, Eq, PartialEq)] +pub struct Timer(Handle); +impl_handle_based!(Timer); + +impl Timer { + /// Create a timer, an object that can signal when a specified point in time has been reached. + /// Wraps the + /// [zx_timer_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/timer_create.md) + /// syscall. + pub fn create(clock_id: ClockId) -> Result<Timer, Status> { + let mut out = 0; + let opts = 0; + let status = unsafe { sys::zx_timer_create(opts, clock_id as u32, &mut out) }; + ok(status)?; + unsafe { + Ok(Self::from(Handle::from_raw(out))) + } + } + + /// Start a one-shot timer that will fire when `deadline` passes. Wraps the + /// [zx_timer_set](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/timer_set.md) + /// syscall. + pub fn set(&self, deadline: Time, slack: Duration) -> Result<(), Status> { + let status = unsafe { + sys::zx_timer_set(self.raw_handle(), deadline.nanos(), slack.nanos()) + }; + ok(status) + } + + /// Cancels a pending timer that was started with start(). Wraps the + /// [zx_timer_cancel](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/timer_cancel.md) + /// syscall. + pub fn cancel(&self) -> Result<(), Status> { + let status = unsafe { sys::zx_timer_cancel(self.raw_handle()) }; + ok(status) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use Signals; + + #[test] + fn create_timer_invalid_clock() { + assert_eq!(Timer::create(ClockId::UTC).unwrap_err(), Status::INVALID_ARGS); + assert_eq!(Timer::create(ClockId::Thread), Err(Status::INVALID_ARGS)); + } + + #[test] + fn into_from_std() { + let std_dur = stdtime::Duration::new(25, 25); + assert_eq!(std_dur, stdtime::Duration::from(Duration::from(std_dur))); + } + + #[test] + fn timer_basic() { + let slack = 0.millis(); + let ten_ms = 10.millis(); + let twenty_ms = 20.millis(); + + // Create a timer + let timer = Timer::create(ClockId::Monotonic).unwrap(); + + // Should not signal yet. + assert_eq!(timer.wait_handle(Signals::TIMER_SIGNALED, ten_ms.after_now()), Err(Status::TIMED_OUT)); + + // Set it, and soon it should signal. + assert_eq!(timer.set(ten_ms.after_now(), slack), Ok(())); + assert_eq!(timer.wait_handle(Signals::TIMER_SIGNALED, twenty_ms.after_now()).unwrap(), + Signals::TIMER_SIGNALED); + + // Cancel it, and it should stop signalling. + assert_eq!(timer.cancel(), Ok(())); + assert_eq!(timer.wait_handle(Signals::TIMER_SIGNALED, ten_ms.after_now()), Err(Status::TIMED_OUT)); + } +} diff --git a/src/vendor/fuchsia-zircon/src/timer.rs b/src/vendor/fuchsia-zircon/src/timer.rs deleted file mode 100644 index 3379c54b22..0000000000 --- a/src/vendor/fuchsia-zircon/src/timer.rs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -//! Type-safe bindings for Zircon timer objects. - -use {AsHandleRef, ClockId, Duration, HandleBased, Handle, HandleRef, Status, Time}; -use {sys, into_result}; - -/// An object representing a Zircon -/// [event pair](https://fuchsia.googlesource.com/zircon/+/master/docs/concepts.md#Other-IPC_Events_Event-Pairs_and-User-Signals). -/// -/// As essentially a subtype of `Handle`, it can be freely interconverted. -#[derive(Debug, Eq, PartialEq)] -pub struct Timer(Handle); -impl_handle_based!(Timer); - -impl Timer { - /// Create a timer, an object that can signal when a specified point in time has been reached. - /// Wraps the - /// [zx_timer_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/timer_create.md) - /// syscall. - pub fn create(options: TimerOpts, clock_id: ClockId) -> Result<Timer, Status> { - let mut out = 0; - let status = unsafe { sys::zx_timer_create(options as u32, clock_id as u32, &mut out) }; - into_result(status, || Self::from(Handle(out))) - } - - /// Start a one-shot timer that will fire when `deadline` passes. Wraps the - /// [zx_timer_set](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/timer_set.md) - /// syscall. - pub fn set(&self, deadline: Time, slack: Duration) -> Result<(), Status> { - let status = unsafe { sys::zx_timer_set(self.raw_handle(), deadline, slack) }; - into_result(status, || ()) - } - - /// Cancels a pending timer that was started with start(). Wraps the - /// [zx_timer_cancel](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/timer_cancel.md) - /// syscall. - pub fn cancel(&self) -> Result<(), Status> { - let status = unsafe { sys::zx_timer_cancel(self.raw_handle()) }; - into_result(status, || ()) - } -} - -/// Options for creating a timer. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum TimerOpts { - /// Default options. - Default = 0, -} - -impl Default for TimerOpts { - fn default() -> Self { - TimerOpts::Default - } -} - -#[cfg(test)] -mod tests { - use super::*; - use {Duration, ZX_SIGNAL_LAST_HANDLE, ZX_TIMER_SIGNALED}; - use deadline_after; - - #[test] - fn create_timer_invalid_clock() { - assert_eq!(Timer::create(TimerOpts::Default, ClockId::UTC).unwrap_err(), Status::ErrInvalidArgs); - assert_eq!(Timer::create(TimerOpts::Default, ClockId::Thread), Err(Status::ErrInvalidArgs)); - } - - #[test] - fn timer_basic() { - let ten_ms: Duration = 10_000_000; - let twenty_ms: Duration = 20_000_000; - - // Create a timer - let timer = Timer::create(TimerOpts::Default, ClockId::Monotonic).unwrap(); - - // Should not signal yet. - assert_eq!(timer.wait_handle(ZX_TIMER_SIGNALED, deadline_after(ten_ms)), Err(Status::ErrTimedOut)); - - // Set it, and soon it should signal. - assert_eq!(timer.set(ten_ms, 0), Ok(())); - assert_eq!(timer.wait_handle(ZX_TIMER_SIGNALED, deadline_after(twenty_ms)).unwrap(), - ZX_TIMER_SIGNALED | ZX_SIGNAL_LAST_HANDLE); - - // Cancel it, and it should stop signalling. - assert_eq!(timer.cancel(), Ok(())); - assert_eq!(timer.wait_handle(ZX_TIMER_SIGNALED, deadline_after(ten_ms)), Err(Status::ErrTimedOut)); - } -} diff --git a/src/vendor/fuchsia-zircon/src/vmar.rs b/src/vendor/fuchsia-zircon/src/vmar.rs new file mode 100644 index 0000000000..a828195df4 --- /dev/null +++ b/src/vendor/fuchsia-zircon/src/vmar.rs @@ -0,0 +1,18 @@ +use sys; + +bitflags! { + /// Flags to VMAR routines + #[repr(C)] + pub struct VmarFlags: u32 { + const PERM_READ = sys::ZX_VM_FLAG_PERM_READ; + const PERM_WRITE = sys::ZX_VM_FLAG_PERM_WRITE; + const PERM_EXECUTE = sys::ZX_VM_FLAG_PERM_EXECUTE; + const COMPACT = sys::ZX_VM_FLAG_COMPACT; + const SPECIFIC = sys::ZX_VM_FLAG_SPECIFIC; + const SPECIFIC_OVERWRITE = sys::ZX_VM_FLAG_SPECIFIC_OVERWRITE; + const CAN_MAP_SPECIFIC = sys::ZX_VM_FLAG_CAN_MAP_SPECIFIC; + const CAN_MAP_READ = sys::ZX_VM_FLAG_CAN_MAP_READ; + const CAN_MAP_WRITE = sys::ZX_VM_FLAG_CAN_MAP_WRITE; + const CAN_MAP_EXECUTE = sys::ZX_VM_FLAG_CAN_MAP_EXECUTE; + } +} \ No newline at end of file diff --git a/src/vendor/fuchsia-zircon/src/vmo.rs b/src/vendor/fuchsia-zircon/src/vmo.rs index a2ccca597f..68c86b5429 100644 --- a/src/vendor/fuchsia-zircon/src/vmo.rs +++ b/src/vendor/fuchsia-zircon/src/vmo.rs @@ -5,7 +5,7 @@ //! Type-safe bindings for Zircon vmo objects. use {AsHandleRef, Cookied, HandleBased, Handle, HandleRef, Status}; -use {sys, into_result}; +use {sys, ok}; use std::{mem, ptr}; /// An object representing a Zircon @@ -25,11 +25,14 @@ impl Vmo { /// syscall. See the /// [Shared Memory: Virtual Memory Objects (VMOs)](https://fuchsia.googlesource.com/zircon/+/master/docs/concepts.md#Shared-Memory_Virtual-Memory-Objects-VMOs) /// for more information. - pub fn create(size: u64, options: VmoOpts) -> Result<Vmo, Status> { + pub fn create(size: u64) -> Result<Vmo, Status> { let mut handle = 0; - let status = unsafe { sys::zx_vmo_create(size, options as u32, &mut handle) }; - into_result(status, || - Vmo::from(Handle(handle))) + let opts = 0; + let status = unsafe { sys::zx_vmo_create(size, opts, &mut handle) }; + ok(status)?; + unsafe { + Ok(Vmo::from(Handle::from_raw(handle))) + } } /// Read from a virtual memory object. @@ -40,7 +43,7 @@ impl Vmo { let mut actual = 0; let status = sys::zx_vmo_read(self.raw_handle(), data.as_mut_ptr(), offset, data.len(), &mut actual); - into_result(status, || actual) + ok(status).map(|()| actual) } } @@ -52,7 +55,7 @@ impl Vmo { let mut actual = 0; let status = sys::zx_vmo_write(self.raw_handle(), data.as_ptr(), offset, data.len(), &mut actual); - into_result(status, || actual) + ok(status).map(|()| actual) } } @@ -62,7 +65,7 @@ impl Vmo { pub fn get_size(&self) -> Result<u64, Status> { let mut size = 0; let status = unsafe { sys::zx_vmo_get_size(self.raw_handle(), &mut size) }; - into_result(status, || size) + ok(status).map(|()| size) } /// Attempt to change the size of a virtual memory object. @@ -70,7 +73,7 @@ impl Vmo { /// Wraps the `zx_vmo_set_size` syscall. pub fn set_size(&self, size: u64) -> Result<(), Status> { let status = unsafe { sys::zx_vmo_set_size(self.raw_handle(), size) }; - into_result(status, || ()) + ok(status) } /// Perform an operation on a range of a virtual memory object. @@ -80,9 +83,9 @@ impl Vmo { /// syscall. pub fn op_range(&self, op: VmoOp, offset: u64, size: u64) -> Result<(), Status> { let status = unsafe { - sys::zx_vmo_op_range(self.raw_handle(), op as u32, offset, size, ptr::null_mut(), 0) + sys::zx_vmo_op_range(self.raw_handle(), op.into_raw(), offset, size, ptr::null_mut(), 0) }; - into_result(status, || ()) + ok(status) } /// Look up a list of physical addresses corresponding to the pages held by the VMO from @@ -95,10 +98,10 @@ impl Vmo { -> Result<(), Status> { let status = unsafe { - sys::zx_vmo_op_range(self.raw_handle(), sys::ZX_VMO_OP_LOOKUP, offset, size, + sys::zx_vmo_op_range(self.raw_handle(), VmoOp::LOOKUP.into_raw(), offset, size, buffer.as_mut_ptr() as *mut u8, buffer.len() * mem::size_of::<sys::zx_paddr_t>()) }; - into_result(status, || ()) + ok(status) } /// Create a new virtual memory object that clones a range of this one. @@ -106,62 +109,42 @@ impl Vmo { /// Wraps the /// [zx_vmo_clone](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/vmo_clone.md) /// syscall. - pub fn clone(&self, options: VmoCloneOpts, offset: u64, size: u64) -> Result<Vmo, Status> { + pub fn clone(&self, offset: u64, size: u64) -> Result<Vmo, Status> { let mut out = 0; + let opts = sys::ZX_VMO_CLONE_COPY_ON_WRITE; let status = unsafe { - sys::zx_vmo_clone(self.raw_handle(), options as u32, offset, size, &mut out) + sys::zx_vmo_clone(self.raw_handle(), opts, offset, size, &mut out) }; - into_result(status, || Vmo::from(Handle(out))) + ok(status)?; + unsafe { Ok(Vmo::from(Handle::from_raw(out))) } } } -/// Options for creating virtual memory objects. None supported yet. -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum VmoOpts { - /// Default options. - Default = 0, -} - -impl Default for VmoOpts { - fn default() -> Self { - VmoOpts::Default +/// VM Object opcodes +#[repr(C)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +pub struct VmoOp(u32); +impl VmoOp { + pub fn from_raw(raw: u32) -> VmoOp { + VmoOp(raw) + } + pub fn into_raw(self) -> u32 { + self.0 } } -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum VmoOp { - /// Commit `size` bytes worth of pages starting at byte `offset` for the VMO. - Commit = sys::ZX_VMO_OP_COMMIT, - /// Release a range of pages previously committed to the VMO from `offset` to `offset`+`size`. - Decommit = sys::ZX_VMO_OP_DECOMMIT, - // Presently unsupported. - Lock = sys::ZX_VMO_OP_LOCK, - // Presently unsupported. - Unlock = sys::ZX_VMO_OP_UNLOCK, - /// Perform a cache sync operation. - CacheSync = sys::ZX_VMO_OP_CACHE_SYNC, - /// Perform a cache invalidation operation. - CacheInvalidate = sys::ZX_VMO_OP_CACHE_INVALIDATE, - /// Perform a cache clean operation. - CacheClean = sys::ZX_VMO_OP_CACHE_CLEAN, - /// Perform cache clean and invalidation operations together. - CacheCleanInvalidate = sys::ZX_VMO_OP_CACHE_CLEAN_INVALIDATE, -} +assoc_consts!(VmoOp, [ + COMMIT = sys::ZX_VMO_OP_COMMIT; + DECOMMIT = sys::ZX_VMO_OP_DECOMMIT; + LOCK = sys::ZX_VMO_OP_LOCK; + UNLOCK = sys::ZX_VMO_OP_UNLOCK; + LOOKUP = sys::ZX_VMO_OP_LOOKUP; + CACHE_SYNC = sys::ZX_VMO_OP_CACHE_SYNC; + CACHE_INVALIDATE = sys::ZX_VMO_OP_CACHE_INVALIDATE; + CACHE_CLEAN = sys::ZX_VMO_OP_CACHE_CLEAN; + CACHE_CLEAN_INVALIDATE = sys::ZX_VMO_OP_CACHE_CLEAN_INVALIDATE; +]); -#[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum VmoCloneOpts { - /// Create a copy-on-write clone. - CopyOnWrite = sys::ZX_VMO_CLONE_COPY_ON_WRITE, -} - -impl Default for VmoCloneOpts { - fn default() -> Self { - VmoCloneOpts::CopyOnWrite - } -} #[cfg(test)] mod tests { @@ -170,14 +153,14 @@ mod tests { #[test] fn vmo_get_size() { let size = 16 * 1024 * 1024; - let vmo = Vmo::create(size, VmoOpts::Default).unwrap(); + let vmo = Vmo::create(size).unwrap(); assert_eq!(size, vmo.get_size().unwrap()); } #[test] fn vmo_set_size() { let start_size = 12; - let vmo = Vmo::create(start_size, VmoOpts::Default).unwrap(); + let vmo = Vmo::create(start_size).unwrap(); assert_eq!(start_size, vmo.get_size().unwrap()); // Change the size and make sure the new size is reported @@ -189,7 +172,7 @@ mod tests { #[test] fn vmo_read_write() { let mut vec1 = vec![0; 16]; - let vmo = Vmo::create(vec1.len() as u64, VmoOpts::Default).unwrap(); + let vmo = Vmo::create(vec1.len() as u64).unwrap(); assert_eq!(vmo.write(b"abcdef", 0), Ok(6)); assert_eq!(16, vmo.read(&mut vec1, 0).unwrap()); assert_eq!(b"abcdef", &vec1[0..6]); @@ -202,48 +185,48 @@ mod tests { #[test] fn vmo_op_range_unsupported() { - let vmo = Vmo::create(12, VmoOpts::Default).unwrap(); - assert_eq!(vmo.op_range(VmoOp::Lock, 0, 1), Err(Status::ErrNotSupported)); - assert_eq!(vmo.op_range(VmoOp::Unlock, 0, 1), Err(Status::ErrNotSupported)); + let vmo = Vmo::create(12).unwrap(); + assert_eq!(vmo.op_range(VmoOp::LOCK, 0, 1), Err(Status::NOT_SUPPORTED)); + assert_eq!(vmo.op_range(VmoOp::UNLOCK, 0, 1), Err(Status::NOT_SUPPORTED)); } #[test] fn vmo_lookup() { - let vmo = Vmo::create(12, VmoOpts::Default).unwrap(); + let vmo = Vmo::create(12).unwrap(); let mut buffer = vec![0; 2]; // Lookup will fail as it is not committed yet. - assert_eq!(vmo.lookup(0, 12, &mut buffer), Err(Status::ErrNoMemory)); + assert_eq!(vmo.lookup(0, 12, &mut buffer), Err(Status::NO_MEMORY)); - // Commit and try again. - assert_eq!(vmo.op_range(VmoOp::Commit, 0, 12), Ok(())); + // COMMIT and try again. + assert_eq!(vmo.op_range(VmoOp::COMMIT, 0, 12), Ok(())); assert_eq!(vmo.lookup(0, 12, &mut buffer), Ok(())); assert_ne!(buffer[0], 0); assert_eq!(buffer[1], 0); // If we decommit then lookup should go back to failing. - assert_eq!(vmo.op_range(VmoOp::Decommit, 0, 12), Ok(())); - assert_eq!(vmo.lookup(0, 12, &mut buffer), Err(Status::ErrNoMemory)); + assert_eq!(vmo.op_range(VmoOp::DECOMMIT, 0, 12), Ok(())); + assert_eq!(vmo.lookup(0, 12, &mut buffer), Err(Status::NO_MEMORY)); } #[test] fn vmo_cache() { - let vmo = Vmo::create(12, VmoOpts::Default).unwrap(); + let vmo = Vmo::create(12).unwrap(); // Cache operations should all succeed. - assert_eq!(vmo.op_range(VmoOp::CacheSync, 0, 12), Ok(())); - assert_eq!(vmo.op_range(VmoOp::CacheInvalidate, 0, 12), Ok(())); - assert_eq!(vmo.op_range(VmoOp::CacheClean, 0, 12), Ok(())); - assert_eq!(vmo.op_range(VmoOp::CacheCleanInvalidate, 0, 12), Ok(())); + assert_eq!(vmo.op_range(VmoOp::CACHE_SYNC, 0, 12), Ok(())); + assert_eq!(vmo.op_range(VmoOp::CACHE_INVALIDATE, 0, 12), Ok(())); + assert_eq!(vmo.op_range(VmoOp::CACHE_CLEAN, 0, 12), Ok(())); + assert_eq!(vmo.op_range(VmoOp::CACHE_CLEAN_INVALIDATE, 0, 12), Ok(())); } #[test] fn vmo_clone() { - let original = Vmo::create(12, VmoOpts::Default).unwrap(); + let original = Vmo::create(12).unwrap(); assert_eq!(original.write(b"one", 0), Ok(3)); // Clone the VMO, and make sure it contains what we expect. - let clone = original.clone(VmoCloneOpts::CopyOnWrite, 0, 10).unwrap(); + let clone = original.clone(0, 10).unwrap(); let mut read_buffer = vec![0; 16]; assert_eq!(clone.read(&mut read_buffer, 0), Ok(10)); assert_eq!(&read_buffer[0..3], b"one"); diff --git a/src/vendor/fuchsia-zircon/tools/BUILD.gn b/src/vendor/fuchsia-zircon/tools/BUILD.gn deleted file mode 100644 index 1549205864..0000000000 --- a/src/vendor/fuchsia-zircon/tools/BUILD.gn +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2017 The Fuchsia Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -group("clang_wrapper") { - deps = [ - ":arm64_wrapper", - ":x64_wrapper", - ] -} - -executable("clang_wrapper_bin") { - output_name = "rust_clang_wrapper" - - sources = [ - "clang_wrapper.cc", - ] - - if (is_linux) { - ldflags = [ - "-pthread", - ] - } -} - -template("copy_wrapper") { - - arch = invoker.arch - - copy(target_name) { - sources = [ - "$root_out_dir/rust_clang_wrapper", - ] - - outputs = [ - "$root_out_dir/$arch-unknown-fuchsia-cc", - ] - - deps = [ - ":clang_wrapper_bin", - ] - } -} - -copy_wrapper("arm64_wrapper") { - arch = "aarch64" -} - -copy_wrapper("x64_wrapper") { - arch = "x86_64" -} diff --git a/src/vendor/fuchsia-zircon/tools/README.md b/src/vendor/fuchsia-zircon/tools/README.md deleted file mode 100644 index cb7f3d6999..0000000000 --- a/src/vendor/fuchsia-zircon/tools/README.md +++ /dev/null @@ -1,26 +0,0 @@ -Build tools for Rust on Fuchsia -=============================== - -This directory contains a wrapper so that clang can be invoked using a -target-specific command line (as is typically done using Gnu tools for -cross-compiling). - -To compile standalone (not part of a build system): - -``` -clang++ -O --std=c++11 clang_wrapper.cc -o clang_wrapper -ln -s clang_wrapper x86-64-unknown-fuchsia-ar -ln -s clang_wrapper x86-64-unknown-fuchsia-cc -ln -s clang_wrapper aarch64-unknown-fuchsia-ar -ln -s clang_wrapper aarch64-unknown-fuchsia-cc -``` - -The resulting binaries (`x86-64-unknown-fuchsia-cc` and the like) must be -placed somewhere under the root of the fuchsia tree. - -The wrapper sets the target triple appropriately, and also finds the -appropriate sysroot for the given target (necessary for linking). - -Note: this wrapper is provisional, hopefully to be supplanted by a more -general config mechanism in LLVM -(see [relevant LLVM patch](https://reviews.llvm.org/D24933)). diff --git a/src/vendor/fuchsia-zircon/tools/clang_wrapper.cc b/src/vendor/fuchsia-zircon/tools/clang_wrapper.cc deleted file mode 100644 index eb3179e49a..0000000000 --- a/src/vendor/fuchsia-zircon/tools/clang_wrapper.cc +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Wrap the clang toolchain to supply triple-specific configuration parameters -// as arguments. - -// Gnu-style toolchains encode the target triple in the executable name (each -// executable is specialized to a single triple), and each toolchain also knows -// how to find the corresponding sysroot. By contrast, clang uses a single -// binary, and the target is specified as a command line argument. In addition, -// in the Fuchsia world, the sysroot is not bundled with the compiler. -// -// This wrapper infers the relevant configuration parameters from the command -// name used to invoke the wrapper, and also finds the sysroot at a known -// location relative to the jiri root, then invokes clang with the additional -// arguments. - -#include <map> -#include <string> -#include <vector> -#include <iostream> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/utsname.h> -#include <unistd.h> -#include <string.h> -#include <algorithm> - -using std::map; -using std::string; -using std::vector; - -// Get the real path of this executable, resolving symbolic links. -string GetPath(const char* argv0) { - char* path_c = realpath(argv0, nullptr); - string path = string(path_c); - free(path_c); - return path; -} - -// Return path of Jiri root, or empty string if not found. -string FindJiriRoot(const string& self_path) { - string path = self_path; - while (true) { - size_t pos = path.rfind('/'); - if (pos == string::npos) { - return ""; - } - string basedir = path.substr(0, pos + 1); - string trial = basedir + ".jiri_root"; - struct stat stat_buf; - int status = stat(trial.c_str(), &stat_buf); - if (status == 0) { - return basedir; - } - path = path.substr(0, pos); - } -} - -// Get the basename of the command used to invoke this wrapper. -// Typical return value: "x86-64-unknown-fuchsia-cc" -string GetCmd(const char* argv0) { - string cmd = argv0; - size_t pos = cmd.rfind('/'); - if (pos != string::npos) { - cmd = cmd.substr(pos + 1); - } - return cmd; -} - -// Given the command basename, get the llvm target triple. Empty string on failure. -// Typical return value: "x86_64-unknown-fuchsia" -string TargetTriple(const string& cmd) { - size_t pos = cmd.rfind('-'); - if (pos == string::npos) { - return ""; - } - string triple = cmd.substr(0, pos); - if (triple.find("x86-64") == 0) { - triple[3] = '_'; - } - return triple; -} - -// Given the path to the command, calculate the matching sysroot -string SysrootPath(const string& triple, const string& self_path) { - const string out_dir_name = "out/"; - size_t pos = self_path.find(out_dir_name); - if (pos != string::npos) { - string out_path = self_path.substr(0, pos + out_dir_name.length()); - string zircon_name = triple == "x86_64-unknown-fuchsia" ? - "build-zircon-pc-x86-64" : "build-zircon-qemu-arm64"; - string sysroot_path = out_path + "build-zircon/" + zircon_name + "/sysroot"; - struct stat stat_buf; - int status = stat(sysroot_path.c_str(), &stat_buf); - if (status == 0) { - return sysroot_path; - } - } - return ""; -} - -// Detect the host, get the host identifier (used to select a prebuilt toolchain). -// Empty string on failure. -// Typical return value: "mac-x64" -string HostDouble() { - struct utsname name; - int status = uname(&name); - if (status != 0) { - return ""; - } - map<string, string> cpumap = { - {"aarch64", "arm64"}, - {"x86_64", "x64"} - }; - map<string, string> osmap = { - {"Linux", "linux"}, - {"Darwin", "mac"} - }; - return osmap[name.sysname] + "-" + cpumap[name.machine]; -} - -// Given the command baseline, get the llvm binary to invoke. -// Note: the "llvm-ar" special case should probably go away, as Rust no longer -// invokes an external "ar" tool, and the llvm-ar one probably wouldn't work. -// Typical return value: "clang" -string InferTool(const string& cmd) { - size_t pos = cmd.rfind('-'); - string base; - if (pos != string::npos) { - base = cmd.substr(pos + 1); - } else { - base = cmd; - } - if (base == "cc" || base == "gcc") { - return "clang"; - } else if (base == "ar") { - return "llvm-ar"; - } - return base; -} - -// Collect C-style argc/argv into a vector of strings. -vector<string> CollectArgs(int argc, char** argv) { - vector<string> result; - for (int i = 0; i < argc; i++) { - result.push_back(argv[i]); - } - return result; -} - -// Do "execv" given command path as a string and args as a vector of strings. -int DoExecv(const string& cmd, vector<string>& args) { - vector<const char*> argvec; - for (auto& it : args) { - argvec.push_back(it.c_str()); - } - argvec.push_back(nullptr); - char* const* argv = const_cast<char* const*>(argvec.data()); - return execv(cmd.c_str(), argv); -} - -void Die(const string& message) { - std::cerr << message << std::endl; - exit(1); -} - -int main(int argc, char** argv) { - string self_path = GetPath(argv[0]); - string root = FindJiriRoot(self_path); - if (root.empty()) { - Die("Can't find .jiri_root in any parent of " + self_path); - } - string host = HostDouble(); - if (host.empty()) { - Die("Can't detect host (uname failed)"); - } - string cmd = GetCmd(argv[0]); - string tool = InferTool(cmd); - string triple = TargetTriple(cmd); - vector<string> args = CollectArgs(argc, argv); - - string newcmd = root + "buildtools/" + host + "/clang/bin/" + tool; - string sysroot = SysrootPath(triple, self_path); - if (sysroot.empty()) { - Die("Can't find sysroot from wrapper path"); - } - vector<string> newargs; - newargs.push_back(newcmd); - if (tool != "llvm-ar") { - newargs.push_back("-target"); - newargs.push_back(triple); - newargs.push_back("--sysroot=" + sysroot); - } - for (auto it = args.begin() + 1; it != args.end(); ++it) { - newargs.push_back(*it); - } - int status = DoExecv(newcmd, newargs); - if (status != 0) { - Die("error invoking " + newcmd + ": " + strerror(errno)); - } - return 0; -} diff --git a/src/vendor/html-diff/.cargo-checksum.json b/src/vendor/html-diff/.cargo-checksum.json index ff2c61b699..39a68e0518 100644 --- a/src/vendor/html-diff/.cargo-checksum.json +++ b/src/vendor/html-diff/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"9888d016778d0f68a79eb90f1d0af6a966562e4ee3135cd47b8dac2ef5dab5cf","Cargo.toml":"eb7d72869e90f446010f2f350323c97ddd6d37eb8a4a3a8222eb42bf97102e24","Cargo.toml.orig":"184b4dcbf701943c92aabb1907afedb2914ab9d3e7fe758d08b5f64a9434cca3","LICENSE":"d64fe3199be0c90d1f88b363e6b567d5812f64c01accc8957e71381598a3d670","README.md":"b157f868aaad98a7d0616fa5c46c7e0cf69514b2493949b7a15da98dc156bff1","src/lib.rs":"182d2f851904424247325b7eedd507795036a1673684120581a2e99fb06e4508","src/main.rs":"538328e195cb6725abf01c82b15017fe863ee9c039559e935ef2ef40cdec06f1","test_files/basic.html":"18a3a4a909bf50032a6ab2d315a8e1af0c65378dc808923586c7bc6ba55a64b8","test_files/basic.stdout":"0ddc11528b1c8e901313b99e9111210c8e45c8ca8d2cb7ea2fdf723f05703d07","test_files/basic_compare.html":"cc97d35ed1f086121b36717374cffe3b34133402849d12c7ac7540aef84a36f1","tests/test_files.rs":"c5fe66be9fc553fa6d5d3bc946a9d05e60372a30e97b8afea65b303730c24645"},"package":"5298d63081a642508fce965740ddb03a386c5d81bf1fef0579a815cf49cb8c68"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"9888d016778d0f68a79eb90f1d0af6a966562e4ee3135cd47b8dac2ef5dab5cf","Cargo.toml":"6f41707d9aea02510c49d80e45522d837f0c200cd2c924b2cdf8facf740ae9fb","Cargo.toml.orig":"efd2c1c52c29ba973ddf004dc28672aeebee300381cf8023eacb7cfff7aef94d","LICENSE":"d64fe3199be0c90d1f88b363e6b567d5812f64c01accc8957e71381598a3d670","README.md":"b157f868aaad98a7d0616fa5c46c7e0cf69514b2493949b7a15da98dc156bff1","src/lib.rs":"182d2f851904424247325b7eedd507795036a1673684120581a2e99fb06e4508","src/main.rs":"538328e195cb6725abf01c82b15017fe863ee9c039559e935ef2ef40cdec06f1","test_files/basic.html":"18a3a4a909bf50032a6ab2d315a8e1af0c65378dc808923586c7bc6ba55a64b8","test_files/basic.stdout":"0ddc11528b1c8e901313b99e9111210c8e45c8ca8d2cb7ea2fdf723f05703d07","test_files/basic_compare.html":"cc97d35ed1f086121b36717374cffe3b34133402849d12c7ac7540aef84a36f1","tests/test_files.rs":"c5fe66be9fc553fa6d5d3bc946a9d05e60372a30e97b8afea65b303730c24645"},"package":"9778743e3b3c3679f471f0ed1833c690f19f4a0919e33b281f12ef5f77ad64c6"} \ No newline at end of file diff --git a/src/vendor/html-diff/Cargo.toml b/src/vendor/html-diff/Cargo.toml index 557dd4de8e..3cd395123e 100644 --- a/src/vendor/html-diff/Cargo.toml +++ b/src/vendor/html-diff/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "html-diff" -version = "0.0.4" +version = "0.0.5" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] description = "Library detect HTML diffs" categories = ["html", "diff"] @@ -21,5 +21,6 @@ repository = "https://github.com/GuillaumeGomez/html-diff-rs" [[bin]] name = "html_diff" +path = "src/main.rs" [dependencies.kuchiki] -version = "0.5.1" +version = "0.6" diff --git a/src/vendor/html-diff/Cargo.toml.orig b/src/vendor/html-diff/Cargo.toml.orig index d12af69bb4..076285dd7f 100644 --- a/src/vendor/html-diff/Cargo.toml.orig +++ b/src/vendor/html-diff/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "html-diff" -version = "0.0.4" +version = "0.0.5" authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"] description = "Library detect HTML diffs" @@ -10,7 +10,8 @@ license = "MIT" categories = ["html", "diff"] [dependencies] -kuchiki = "0.5.1" +kuchiki = "0.6" [[bin]] name = "html_diff" +path = "src/main.rs" diff --git a/src/vendor/html5ever/.cargo-checksum.json b/src/vendor/html5ever/.cargo-checksum.json index d1f29edf2b..45de50c86e 100644 --- a/src/vendor/html5ever/.cargo-checksum.json +++ b/src/vendor/html5ever/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"d19819a8a7990a5daac8aae608eb5ebbca3f5a51ee4461313c9223b22ea3e913","benches/tokenizer.rs":"c26e9161bfbb96a3648b26e7e01052a6feab4f8334f87d78e432ff121534b34c","build.rs":"d4bc31f8af1b4798aee17860f2524d7f04bae0d74eea0fe1563c03daf4806aec","data/bench/lipsum-zh.html":"fafe3ed44b07f9cdb0a3ca5c010a3a73cc2534b64605593e71cc70a8cf8e27e4","data/bench/lipsum.html":"f37900ddb4ee463b9aa3191297bc1a4320b94bc72ee630de01882b50eb241740","data/bench/medium-fragment.html":"d21ab12c5e538ae48af6df7ee7d7939c6fe3b2d1e36b5874a3bbb957847ddba0","data/bench/small-fragment.html":"3825226a96ac919b0a69ae98e8547a5430214b16e56497570d382720af2bfca3","data/bench/strong.html":"5adb31981cca062df929353c60dfa1c7fb91170b5a389a13c8be6555a4cf107d","data/bench/tiny-fragment.html":"9cc2d58507945020d4d206738c8f166a618dc15161609935ab1975b913967edf","data/test/ignore":"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b","examples/capi/tokenize.c":"ca0d98155c275f0d25ef7ce6735dec9d7cedb89f54416a406f53f10c616656bf","examples/html2html.rs":"361db15963171b48d0818af17c8adeeaa51fbd38c630eb1f984f7deaf55cb7cd","examples/noop-tokenize.rs":"b5b4ed4d32c0f43cfb0cfe245e275cb8f19a54c43ba3a669578f296e6339f3db","examples/noop-tree-builder.rs":"d3085ddb88d5d6865fb0c3fd93c7ec3e0d3cbae7434f250d068915ac88b3f238","examples/print-rcdom.rs":"b264fee44e6ea1321504bcb2536ae8c086176f0e6fe01ce12a2c0c94408580dc","examples/print-tree-actions.rs":"a3548a7e62e43ad455e774fd5edf870e40db921d55b60ed653a3388e7a060bcd","examples/tokenize.rs":"c1d51886e277c1d1b2b338c3f5e3969e835d298baa70cb66ea2f8cc9b5fd87a9","macros/match_token.rs":"4c2a8faaccfb7bbee3a769240dedacf3396b633ad9317f00edc2e4e2d83f0f91","src/driver.rs":"08209edfdf0c0d08f7b1fbc3d6f3004597599da6e23e5b3c902c6d70533bdbd0","src/lib.rs":"0d793d0c84b86999103cb73b8d784d1faabe2a663588a0c053ece2ad3622a52d","src/macros.rs":"c5feda45a822c57a269e092e161cc9905663c119903bab405728f3752f544316","src/serialize/mod.rs":"a1a979ea0928eff8202707e289a83c159cbc4091cfe35c206243fc60c3ca2ca4","src/tokenizer/char_ref/mod.rs":"b22f42b28ac9af5749097dd4a6e65e8797170c19cbe537da220f1eee715c9f36","src/tokenizer/interface.rs":"f730ffddcfa124c8ecdbec98694c1d0540084274e9169c823f96c05092e4f601","src/tokenizer/mod.rs":"cc42f54e2c7ebc022da908d6fa9f7f5a7350304ca189564d28b74f834f843a05","src/tokenizer/states.rs":"49375599bcae0f1779261ced957faf7223847818580b4f7c7dee5135a7646098","src/tree_builder/actions.rs":"601fe98453d596e12cb421ba30b6aa574469c0615c8fe51e23413c63b31e6c53","src/tree_builder/data.rs":"78dffd4663ceda12db080fa96b3b295af9f9ec71ad29bd0811f81798aeee70a2","src/tree_builder/mod.rs":"777eca650a321b5b5c78dcb45430f690ab2d841db7524ee79e015173ec444635","src/tree_builder/rules.rs":"99b1f9393c9069659a056ece5e33a58728d240e21de0631b83b6f678e72d47a8","src/tree_builder/tag_sets.rs":"981e1e9172eb5b1e6398c674b8c2161d0fa3bb4b1ea7bd0cb366c1b30a1fc44e","src/tree_builder/types.rs":"7183b788427b0cefb2a2f4829ee3b7b715065d1713a2e0c9b5cba20ad07788e7","src/util/str.rs":"a21c85d3874698f88132dfc8e5c32609a18a1ef37d838d25bc1a4420bdc11c95","tests/foreach_html5lib_test/mod.rs":"9dbeafc7526f8f144aaa5a25a98521ef38f427884e95a3d22f8640c4fbd0e879","tests/serializer.rs":"f4e7c12cf281cff66156f5a99ef37d2ff522660c47a9ffa672453f1414abe8a8","tests/tokenizer.rs":"2a0c0731cdae8220922fb89da9d95bef265ac1120e0d8681f36930c0a4131859","tests/tree_builder.rs":"30f08aae36ef4ec7388b69c7c5f7fe8909e206cc71c946bd104a134d46de7838"},"package":"a49d5001dd1bddf042ea41ed4e0a671d50b1bf187e66b349d7ec613bdce4ad90"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"30d25bc90fc86a5852218dc6ce835d9b298be30fbb79e326c750b4f2c1e84c78","Cargo.toml.orig":"4d892e075d20b609052ecd46b29c11704db18ccdc256b8f941baccc218522a45","benches/tokenizer.rs":"3f1ccf24105c9867f17b7cb4e898e87467b979ead16c810aaff3e11bb049b317","build.rs":"d4bc31f8af1b4798aee17860f2524d7f04bae0d74eea0fe1563c03daf4806aec","data/bench/lipsum-zh.html":"fafe3ed44b07f9cdb0a3ca5c010a3a73cc2534b64605593e71cc70a8cf8e27e4","data/bench/lipsum.html":"f37900ddb4ee463b9aa3191297bc1a4320b94bc72ee630de01882b50eb241740","data/bench/medium-fragment.html":"d21ab12c5e538ae48af6df7ee7d7939c6fe3b2d1e36b5874a3bbb957847ddba0","data/bench/small-fragment.html":"3825226a96ac919b0a69ae98e8547a5430214b16e56497570d382720af2bfca3","data/bench/strong.html":"5adb31981cca062df929353c60dfa1c7fb91170b5a389a13c8be6555a4cf107d","data/bench/tiny-fragment.html":"9cc2d58507945020d4d206738c8f166a618dc15161609935ab1975b913967edf","data/test/ignore":"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b","examples/capi/tokenize.c":"ca0d98155c275f0d25ef7ce6735dec9d7cedb89f54416a406f53f10c616656bf","examples/html2html.rs":"361db15963171b48d0818af17c8adeeaa51fbd38c630eb1f984f7deaf55cb7cd","examples/noop-tokenize.rs":"b5b4ed4d32c0f43cfb0cfe245e275cb8f19a54c43ba3a669578f296e6339f3db","examples/noop-tree-builder.rs":"90f9986f073a387382ca7a24e506ab0dd206a2afe90ad381ef9ae8b3d8eb236c","examples/print-rcdom.rs":"b264fee44e6ea1321504bcb2536ae8c086176f0e6fe01ce12a2c0c94408580dc","examples/print-tree-actions.rs":"e328ea91a1761845841959de002469d9e2791fee4bace7135825ca2d37d53565","examples/tokenize.rs":"c1d51886e277c1d1b2b338c3f5e3969e835d298baa70cb66ea2f8cc9b5fd87a9","macros/match_token.rs":"4c2a8faaccfb7bbee3a769240dedacf3396b633ad9317f00edc2e4e2d83f0f91","src/driver.rs":"d60deaf45cd96e121fcf5170ee26af3ca8df9fc403293d2be06d0f10954f19f5","src/lib.rs":"0d793d0c84b86999103cb73b8d784d1faabe2a663588a0c053ece2ad3622a52d","src/macros.rs":"c5feda45a822c57a269e092e161cc9905663c119903bab405728f3752f544316","src/serialize/mod.rs":"464fe3c10146ca19ddfe61fba6e180e69a7271d933a6f97534b58bc438d20621","src/tokenizer/char_ref/mod.rs":"b22f42b28ac9af5749097dd4a6e65e8797170c19cbe537da220f1eee715c9f36","src/tokenizer/interface.rs":"f730ffddcfa124c8ecdbec98694c1d0540084274e9169c823f96c05092e4f601","src/tokenizer/mod.rs":"cc42f54e2c7ebc022da908d6fa9f7f5a7350304ca189564d28b74f834f843a05","src/tokenizer/states.rs":"49375599bcae0f1779261ced957faf7223847818580b4f7c7dee5135a7646098","src/tree_builder/data.rs":"78dffd4663ceda12db080fa96b3b295af9f9ec71ad29bd0811f81798aeee70a2","src/tree_builder/mod.rs":"027218e866870d3a7aa5d653e6109ea8a5f33fc5ac9793b2f21c8194e9b9c921","src/tree_builder/rules.rs":"9960148451a88ec65ce8fa306a9b1fb13864c3591100d6867d54d2774400d69e","src/tree_builder/tag_sets.rs":"981e1e9172eb5b1e6398c674b8c2161d0fa3bb4b1ea7bd0cb366c1b30a1fc44e","src/tree_builder/types.rs":"20d42389abb944d93595d279aab1fb1cbef4a4362b172e2638bce63e3fc373fb","src/util/str.rs":"a21c85d3874698f88132dfc8e5c32609a18a1ef37d838d25bc1a4420bdc11c95","tests/foreach_html5lib_test/mod.rs":"9dbeafc7526f8f144aaa5a25a98521ef38f427884e95a3d22f8640c4fbd0e879","tests/serializer.rs":"699ac8830264302fdde18b8ae22efd98ec1c82a53f46a5b21012eb3e65174558","tests/tokenizer.rs":"de63d45cbd032ff5c2a0b5b8f2d9b638c71703b5a1a90d21e9ffde7d7c44a633","tests/tree_builder.rs":"49fa8c343944d63a108820c4aee622c6d672cae129a7882b01ce7b05986373d9"},"package":"5bfb46978eb757a603b7dfe2dafb1c62cb4dee3428d8ac1de734d83d6b022d06"} \ No newline at end of file diff --git a/src/vendor/html5ever/Cargo.toml b/src/vendor/html5ever/Cargo.toml index 67448b962d..62aa34c219 100644 --- a/src/vendor/html5ever/Cargo.toml +++ b/src/vendor/html5ever/Cargo.toml @@ -1,17 +1,28 @@ -[package] +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) +[package] name = "html5ever" -version = "0.18.0" -authors = [ "The html5ever Project Developers" ] -license = "MIT / Apache-2.0" -repository = "https://github.com/servo/html5ever" +version = "0.20.0" +authors = ["The html5ever Project Developers"] +build = "build.rs" description = "High-performance browser-grade HTML5 parser" documentation = "https://docs.rs/html5ever" -build = "build.rs" +categories = ["parser-implementations", "web-programming"] +license = "MIT / Apache-2.0" +repository = "https://github.com/servo/html5ever" [lib] name = "html5ever" - doctest = true [[test]] @@ -28,20 +39,25 @@ name = "serializer" [[bench]] name = "tokenizer" harness = false +[dependencies.log] +version = "0.3" + +[dependencies.markup5ever] +version = "0.5" + +[dependencies.mac] +version = "0.1" +[dev-dependencies.rustc-serialize] +version = "0.3.15" + +[dev-dependencies.rustc-test] +version = "0.2" +[build-dependencies.quote] +version = "0.3.3" + +[build-dependencies.syn] +version = "0.11" +features = ["full", "visit"] [features] -unstable = ["markup5ever/unstable"] heap_size = ["markup5ever/heap_size"] - -[dependencies] -log = "0.3" -mac = "0.1" -markup5ever = { version = "0.3", path = "../markup5ever" } - -[dev-dependencies] -rustc-serialize = "0.3.15" -rustc-test = "0.1.3" - -[build-dependencies] -quote = "0.3.3" -syn = { version = "0.11", features = ["full", "visit"] } diff --git a/src/vendor/html5ever/Cargo.toml.orig b/src/vendor/html5ever/Cargo.toml.orig new file mode 100644 index 0000000000..7be7625028 --- /dev/null +++ b/src/vendor/html5ever/Cargo.toml.orig @@ -0,0 +1,47 @@ +[package] + +name = "html5ever" +version = "0.20.0" +authors = [ "The html5ever Project Developers" ] +license = "MIT / Apache-2.0" +repository = "https://github.com/servo/html5ever" +description = "High-performance browser-grade HTML5 parser" +documentation = "https://docs.rs/html5ever" +build = "build.rs" +categories = [ "parser-implementations", "web-programming" ] + +[lib] +name = "html5ever" + +doctest = true + +[[test]] +name = "tree_builder" +harness = false + +[[test]] +name = "tokenizer" +harness = false + +[[test]] +name = "serializer" + +[[bench]] +name = "tokenizer" +harness = false + +[features] +heap_size = ["markup5ever/heap_size"] + +[dependencies] +log = "0.3" +mac = "0.1" +markup5ever = { version = "0.5", path = "../markup5ever" } + +[dev-dependencies] +rustc-serialize = "0.3.15" +rustc-test = "0.2" + +[build-dependencies] +quote = "0.3.3" +syn = { version = "0.11", features = ["full", "visit"] } diff --git a/src/vendor/html5ever/benches/tokenizer.rs b/src/vendor/html5ever/benches/tokenizer.rs index 4b620e05e0..4901ddd903 100644 --- a/src/vendor/html5ever/benches/tokenizer.rs +++ b/src/vendor/html5ever/benches/tokenizer.rs @@ -16,7 +16,6 @@ use std::default::Default; use test::{black_box, Bencher, TestDesc, TestDescAndFn}; use test::{DynTestName, DynBenchFn, TDynBenchFn}; -use test::ShouldPanic::No; use html5ever::tokenizer::{BufferQueue, TokenSink, Token, Tokenizer, TokenizerOpts, TokenSinkResult}; use html5ever::tendril::*; @@ -108,17 +107,13 @@ impl TDynBenchFn for Bench { fn make_bench(name: &str, size: Option<usize>, clone_only: bool, opts: TokenizerOpts) -> TestDescAndFn { TestDescAndFn { - desc: TestDesc { - name: DynTestName([ - "tokenize ".to_string(), - name.to_string(), - size.map_or("".to_string(), |s| format!(" size {:7}", s)), - (if clone_only { " (clone only)" } else { "" }).to_string(), - (if opts.exact_errors { " (exact errors)" } else { "" }).to_string(), - ].concat().to_string()), - ignore: false, - should_panic: No, - }, + desc: TestDesc::new(DynTestName([ + "tokenize ".to_string(), + name.to_string(), + size.map_or("".to_string(), |s| format!(" size {:7}", s)), + (if clone_only { " (clone only)" } else { "" }).to_string(), + (if opts.exact_errors { " (exact errors)" } else { "" }).to_string(), + ].concat().to_string())), testfn: DynBenchFn(Box::new(Bench::new(name, size, clone_only, opts))), } } diff --git a/src/vendor/html5ever/examples/noop-tree-builder.rs b/src/vendor/html5ever/examples/noop-tree-builder.rs index fffc5be61d..7639a77579 100644 --- a/src/vendor/html5ever/examples/noop-tree-builder.rs +++ b/src/vendor/html5ever/examples/noop-tree-builder.rs @@ -86,6 +86,11 @@ impl TreeSink for Sink { _sibling: &usize, _new_node: NodeOrText<usize>) { } + fn append_based_on_parent_node(&mut self, + _element: &usize, + _prev_element: &usize, + _new_node: NodeOrText<usize>) { } + fn parse_error(&mut self, _msg: Cow<'static, str>) { } fn set_quirks_mode(&mut self, _mode: QuirksMode) { } fn append(&mut self, _parent: &usize, _child: NodeOrText<usize>) { } diff --git a/src/vendor/html5ever/examples/print-tree-actions.rs b/src/vendor/html5ever/examples/print-tree-actions.rs index 50c31ae9a0..d828298376 100644 --- a/src/vendor/html5ever/examples/print-tree-actions.rs +++ b/src/vendor/html5ever/examples/print-tree-actions.rs @@ -109,6 +109,18 @@ impl TreeSink for Sink { } } + fn append_based_on_parent_node(&mut self, + element: &Self::Handle, + prev_element: &Self::Handle, + child: NodeOrText<Self::Handle>) { + + if self.has_parent_node(element) { + self.append_before_sibling(element, child); + } else { + self.append(prev_element, child); + } + } + fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril, @@ -124,7 +136,7 @@ impl TreeSink for Sink { } } - fn associate_with_form(&mut self, _target: &usize, _form: &usize) { + fn associate_with_form(&mut self, _target: &usize, _form: &usize, _nodes: (&usize, Option<&usize>)) { // No form owner support. Since same_tree always returns // true we cannot be sure that this associate_with_form call is // valid diff --git a/src/vendor/html5ever/src/driver.rs b/src/vendor/html5ever/src/driver.rs index 20d49074b6..3ee5aaf0aa 100644 --- a/src/vendor/html5ever/src/driver.rs +++ b/src/vendor/html5ever/src/driver.rs @@ -36,7 +36,7 @@ pub struct ParseOpts { /// so that Unicode input may be provided incrementally, /// or all at once with the `one` method. /// -/// If your input is bytes, use `Parser::from_utf8` or `Parser::from_bytes`. +/// If your input is bytes, use `Parser::from_utf8`. pub fn parse_document<Sink>(sink: Sink, opts: ParseOpts) -> Parser<Sink> where Sink: TreeSink { let tb = TreeBuilder::new(sink, opts.tree_builder); let tok = Tokenizer::new(tb, opts.tokenizer); @@ -49,7 +49,7 @@ pub fn parse_document<Sink>(sink: Sink, opts: ParseOpts) -> Parser<Sink> where S /// so that Unicode input may be provided incrementally, /// or all at once with the `one` method. /// -/// If your input is bytes, use `Parser::from_utf8` or `Parser::from_bytes`. +/// If your input is bytes, use `Parser::from_utf8`. pub fn parse_fragment<Sink>(mut sink: Sink, opts: ParseOpts, context_name: QualName, context_attrs: Vec<Attribute>) -> Parser<Sink> diff --git a/src/vendor/html5ever/src/serialize/mod.rs b/src/vendor/html5ever/src/serialize/mod.rs index 1d69f295b5..69a412bf1e 100644 --- a/src/vendor/html5ever/src/serialize/mod.rs +++ b/src/vendor/html5ever/src/serialize/mod.rs @@ -15,28 +15,37 @@ use {LocalName, QualName}; pub fn serialize<Wr, T>(writer: Wr, node: &T, opts: SerializeOpts) -> io::Result<()> where Wr: Write, T: Serialize { - let mut ser = HtmlSerializer::new(writer, opts); + let mut ser = HtmlSerializer::new(writer, opts.clone()); node.serialize(&mut ser, opts.traversal_scope) } -#[derive(Copy, Clone)] +#[derive(Clone)] pub struct SerializeOpts { /// Is scripting enabled? pub scripting_enabled: bool, /// Serialize the root node? Default: ChildrenOnly pub traversal_scope: TraversalScope, + + /// If the serializer is asked to serialize an invalid tree, the default + /// behavior is to panic in the event that an `end_elem` is created without a + /// matching `start_elem`. Setting this to true will prevent those panics by + /// creating a default parent on the element stack. No extra start elem will + /// actually be written. Default: false + pub create_missing_parent: bool, } impl Default for SerializeOpts { fn default() -> SerializeOpts { SerializeOpts { scripting_enabled: true, - traversal_scope: TraversalScope::ChildrenOnly, + traversal_scope: TraversalScope::ChildrenOnly(None), + create_missing_parent: false, } } } +#[derive(Default)] struct ElemInfo { html_name: Option<LocalName>, ignore_children: bool, @@ -63,11 +72,15 @@ fn tagname(name: &QualName) -> LocalName { impl<Wr: Write> HtmlSerializer<Wr> { fn new(writer: Wr, opts: SerializeOpts) -> Self { + let html_name = match opts.traversal_scope { + TraversalScope::IncludeNode | TraversalScope::ChildrenOnly(None) => None, + TraversalScope::ChildrenOnly(Some(ref n)) => Some(tagname(n)) + }; HtmlSerializer { writer: writer, opts: opts, stack: vec!(ElemInfo { - html_name: None, + html_name: html_name, ignore_children: false, processed_first_child: false, }), @@ -75,7 +88,15 @@ impl<Wr: Write> HtmlSerializer<Wr> { } fn parent(&mut self) -> &mut ElemInfo { - self.stack.last_mut().expect("no parent ElemInfo") + if self.stack.len() == 0 { + if self.opts.create_missing_parent { + warn!("ElemInfo stack empty, creating new parent"); + self.stack.push(Default::default()); + } else { + panic!("no parent ElemInfo") + } + } + self.stack.last_mut().unwrap() } fn write_escaped(&mut self, text: &str, attr_mode: bool) -> io::Result<()> { @@ -159,7 +180,14 @@ impl<Wr: Write> Serializer for HtmlSerializer<Wr> { } fn end_elem(&mut self, name: QualName) -> io::Result<()> { - let info = self.stack.pop().expect("no ElemInfo"); + let info = match self.stack.pop() { + Some(info) => info, + None if self.opts.create_missing_parent => { + warn!("missing ElemInfo, creating default."); + Default::default() + } + _ => panic!("no ElemInfo"), + }; if info.ignore_children { return Ok(()); } @@ -170,18 +198,6 @@ impl<Wr: Write> Serializer for HtmlSerializer<Wr> { } fn write_text(&mut self, text: &str) -> io::Result<()> { - let prepend_lf = text.starts_with("\n") && { - let parent = self.parent(); - !parent.processed_first_child && match parent.html_name { - Some(local_name!("pre")) | Some(local_name!("textarea")) | Some(local_name!("listing")) => true, - _ => false, - } - }; - - if prepend_lf { - try!(self.writer.write_all(b"\n")); - } - let escape = match self.parent().html_name { Some(local_name!("style")) | Some(local_name!("script")) | Some(local_name!("xmp")) | Some(local_name!("iframe")) | Some(local_name!("noembed")) | Some(local_name!("noframes")) diff --git a/src/vendor/html5ever/src/tree_builder/actions.rs b/src/vendor/html5ever/src/tree_builder/actions.rs deleted file mode 100644 index 69ad69147d..0000000000 --- a/src/vendor/html5ever/src/tree_builder/actions.rs +++ /dev/null @@ -1,1164 +0,0 @@ -// Copyright 2014-2017 The html5ever Project Developers. See the -// COPYRIGHT file at the top-level directory of this distribution. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Helpers for implementing the tree builder rules. -//! -//! Many of these are named within the spec, e.g. "reset the insertion -//! mode appropriately". - -use {LocalName, Namespace, QualName, ExpandedName}; -use interface::{Attribute, TreeSink, QuirksMode, NodeOrText, AppendNode, AppendText, create_element}; -use tendril::StrTendril; -use tokenizer::{Tag, StartTag, EndTag}; -use tokenizer::states::{RawData, RawKind}; -use tree_builder::types::*; -use tree_builder::tag_sets::*; -use tree_builder::rules::TreeBuilderStep; -use util::str::to_escaped_string; - -use std::ascii::AsciiExt; -use std::{slice, fmt}; -use std::mem::replace; -use std::iter::{Rev, Enumerate}; -use std::borrow::Cow::Borrowed; - -pub use self::PushFlag::*; - -pub struct ActiveFormattingIter<'a, Handle: 'a> { - iter: Rev<Enumerate<slice::Iter<'a, FormatEntry<Handle>>>>, -} - -impl<'a, Handle> Iterator for ActiveFormattingIter<'a, Handle> { - type Item = (usize, &'a Handle, &'a Tag); - fn next(&mut self) -> Option<(usize, &'a Handle, &'a Tag)> { - match self.iter.next() { - None | Some((_, &Marker)) => None, - Some((i, &Element(ref h, ref t))) => Some((i, h, t)), - } - } -} - -pub enum PushFlag { - Push, - NoPush, -} - -enum Bookmark<Handle> { - Replace(Handle), - InsertAfter(Handle), -} - -macro_rules! qualname { - ("", $local:tt) => { - QualName { - prefix: None, - ns: ns!(), - local: local_name!($local), - } - }; - ($prefix: tt $ns:tt $local:tt) => { - QualName { - prefix: Some(namespace_prefix!($prefix)), - ns: ns!($ns), - local: local_name!($local), - } - } -} - -// These go in a trait so that we can control visibility. -pub trait TreeBuilderActions<Handle> { - fn unexpected<T: fmt::Debug>(&mut self, thing: &T) -> ProcessResult<Handle>; - fn assert_named(&mut self, node: &Handle, name: LocalName); - fn clear_active_formatting_to_marker(&mut self); - fn create_formatting_element_for(&mut self, tag: Tag) -> Handle; - fn append_text(&mut self, text: StrTendril) -> ProcessResult<Handle>; - fn append_comment(&mut self, text: StrTendril) -> ProcessResult<Handle>; - fn append_comment_to_doc(&mut self, text: StrTendril) -> ProcessResult<Handle>; - fn append_comment_to_html(&mut self, text: StrTendril) -> ProcessResult<Handle>; - fn insert_appropriately(&mut self, child: NodeOrText<Handle>, override_target: Option<Handle>); - fn insert_phantom(&mut self, name: LocalName) -> Handle; - fn insert_and_pop_element_for(&mut self, tag: Tag) -> Handle; - fn insert_element_for(&mut self, tag: Tag) -> Handle; - fn insert_element(&mut self, push: PushFlag, ns: Namespace, name: LocalName, attrs: Vec<Attribute>) -> Handle; - fn create_root(&mut self, attrs: Vec<Attribute>); - fn close_the_cell(&mut self); - fn reset_insertion_mode(&mut self) -> InsertionMode; - fn process_chars_in_table(&mut self, token: Token) -> ProcessResult<Handle>; - fn foster_parent_in_body(&mut self, token: Token) -> ProcessResult<Handle>; - fn is_type_hidden(&self, tag: &Tag) -> bool; - fn close_p_element_in_button_scope(&mut self); - fn close_p_element(&mut self); - fn expect_to_close(&mut self, name: LocalName); - fn pop_until_named(&mut self, name: LocalName) -> usize; - fn pop_until<TagSet>(&mut self, pred: TagSet) -> usize where TagSet: Fn(ExpandedName) -> bool; - fn pop_until_current<TagSet>(&mut self, pred: TagSet) where TagSet: Fn(ExpandedName) -> bool; - fn generate_implied_end_except(&mut self, except: LocalName); - fn generate_implied_end<TagSet>(&mut self, set: TagSet) where TagSet: Fn(ExpandedName) -> bool; - fn in_scope_named<TagSet>(&self, scope: TagSet, name: LocalName) -> bool - where TagSet: Fn(ExpandedName) -> bool; - - fn current_node_named(&self, name: LocalName) -> bool; - fn html_elem_named(&self, elem: &Handle, name: LocalName) -> bool; - fn in_html_elem_named(&self, name: LocalName) -> bool; - fn elem_in<TagSet>(&self, elem: &Handle, set: TagSet) -> bool - where TagSet: Fn(ExpandedName) -> bool; - - fn in_scope<TagSet,Pred>(&self, scope: TagSet, pred: Pred) -> bool - where TagSet: Fn(ExpandedName) -> bool, Pred: Fn(Handle) -> bool; - - fn check_body_end(&mut self); - fn body_elem(&self) -> Option<&Handle>; - fn html_elem(&self) -> &Handle; - fn reconstruct_formatting(&mut self); - fn remove_from_stack(&mut self, elem: &Handle); - fn pop(&mut self) -> Handle; - fn push(&mut self, elem: &Handle); - fn adoption_agency(&mut self, subject: LocalName); - fn current_node_in<TagSet>(&self, set: TagSet) -> bool where TagSet: Fn(ExpandedName) -> bool; - fn current_node(&self) -> &Handle; - fn adjusted_current_node(&self) -> &Handle; - fn parse_raw_data(&mut self, tag: Tag, k: RawKind) -> ProcessResult<Handle>; - fn to_raw_text_mode(&mut self, k: RawKind) -> ProcessResult<Handle>; - fn stop_parsing(&mut self) -> ProcessResult<Handle>; - fn set_quirks_mode(&mut self, mode: QuirksMode); - fn active_formatting_end_to_marker<'a>(&'a self) -> ActiveFormattingIter<'a, Handle>; - fn is_marker_or_open(&self, entry: &FormatEntry<Handle>) -> bool; - fn position_in_active_formatting(&self, element: &Handle) -> Option<usize>; - fn process_end_tag_in_body(&mut self, tag: Tag); - fn handle_misnested_a_tags(&mut self, tag: &Tag); - fn is_foreign(&mut self, token: &Token) -> bool; - fn enter_foreign(&mut self, tag: Tag, ns: Namespace) -> ProcessResult<Handle>; - fn adjust_attributes<F>(&mut self, tag: &mut Tag, mut map: F) - where F: FnMut(LocalName) -> Option<QualName>; - fn adjust_svg_tag_name(&mut self, tag: &mut Tag); - fn adjust_svg_attributes(&mut self, tag: &mut Tag); - fn adjust_mathml_attributes(&mut self, tag: &mut Tag); - fn adjust_foreign_attributes(&mut self, tag: &mut Tag); - fn foreign_start_tag(&mut self, tag: Tag) -> ProcessResult<Handle>; - fn unexpected_start_tag_in_foreign_content(&mut self, tag: Tag) -> ProcessResult<Handle>; -} - -pub fn html_elem<Handle>(open_elems: &[Handle]) -> &Handle { - &open_elems[0] -} - -#[doc(hidden)] -impl<Handle, Sink> TreeBuilderActions<Handle> - for super::TreeBuilder<Handle, Sink> - where Handle: Clone, - Sink: TreeSink<Handle=Handle>, -{ - fn unexpected<T: fmt::Debug>(&mut self, _thing: &T) -> ProcessResult<Handle> { - self.sink.parse_error(format_if!( - self.opts.exact_errors, - "Unexpected token", - "Unexpected token {} in insertion mode {:?}", to_escaped_string(_thing), self.mode)); - Done - } - - fn assert_named(&mut self, node: &Handle, name: LocalName) { - assert!(self.html_elem_named(&node, name)); - } - - /// Iterate over the active formatting elements (with index in the list) from the end - /// to the last marker, or the beginning if there are no markers. - fn active_formatting_end_to_marker<'a>(&'a self) -> ActiveFormattingIter<'a, Handle> { - ActiveFormattingIter { - iter: self.active_formatting.iter().enumerate().rev(), - } - } - - fn position_in_active_formatting(&self, element: &Handle) -> Option<usize> { - self.active_formatting - .iter() - .position(|n| { - match n { - &Marker => false, - &Element(ref handle, _) => self.sink.same_node(handle, element) - } - }) - } - - fn set_quirks_mode(&mut self, mode: QuirksMode) { - self.quirks_mode = mode; - self.sink.set_quirks_mode(mode); - } - - fn stop_parsing(&mut self) -> ProcessResult<Handle> { - warn!("stop_parsing not implemented, full speed ahead!"); - Done - } - - //§ parsing-elements-that-contain-only-text - // Switch to `Text` insertion mode, save the old mode, and - // switch the tokenizer to a raw-data state. - // The latter only takes effect after the current / next - // `process_token` of a start tag returns! - fn to_raw_text_mode(&mut self, k: RawKind) -> ProcessResult<Handle> { - self.orig_mode = Some(self.mode); - self.mode = Text; - ToRawData(k) - } - - // The generic raw text / RCDATA parsing algorithm. - fn parse_raw_data(&mut self, tag: Tag, k: RawKind) -> ProcessResult<Handle> { - self.insert_element_for(tag); - self.to_raw_text_mode(k) - } - //§ END - - fn current_node(&self) -> &Handle { - self.open_elems.last().expect("no current element") - } - - fn adjusted_current_node(&self) -> &Handle { - if self.open_elems.len() == 1 { - if let Some(ctx) = self.context_elem.as_ref() { - return ctx; - } - } - self.current_node() - } - - fn current_node_in<TagSet>(&self, set: TagSet) -> bool - where TagSet: Fn(ExpandedName) -> bool - { - set(self.sink.elem_name(self.current_node())) - } - - // Insert at the "appropriate place for inserting a node". - fn insert_appropriately(&mut self, child: NodeOrText<Handle>, override_target: Option<Handle>) { - let insertion_point = self.appropriate_place_for_insertion(override_target); - self.insert_at(insertion_point, child); - } - - fn adoption_agency(&mut self, subject: LocalName) { - // 1. - if self.current_node_named(subject.clone()) { - if self.position_in_active_formatting(self.current_node()).is_none() { - self.pop(); - return; - } - } - - // 2. 3. 4. - for _ in 0..8 { - // 5. - let (fmt_elem_index, fmt_elem, fmt_elem_tag) = unwrap_or_return!( - // We clone the Handle and Tag so they don't cause an immutable borrow of self. - self.active_formatting_end_to_marker() - .filter(|&(_, _, tag)| tag.name == subject) - .next() - .map(|(i, h, t)| (i, h.clone(), t.clone())), - - { - self.process_end_tag_in_body(Tag { - kind: EndTag, - name: subject, - self_closing: false, - attrs: vec!(), - }); - } - ); - - let fmt_elem_stack_index = unwrap_or_return!( - self.open_elems.iter() - .rposition(|n| self.sink.same_node(n, &fmt_elem)), - - { - self.sink.parse_error(Borrowed("Formatting element not open")); - self.active_formatting.remove(fmt_elem_index); - } - ); - - // 7. - if !self.in_scope(default_scope, |n| self.sink.same_node(&n, &fmt_elem)) { - self.sink.parse_error(Borrowed("Formatting element not in scope")); - return; - } - - // 8. - if !self.sink.same_node(self.current_node(), &fmt_elem) { - self.sink.parse_error(Borrowed("Formatting element not current node")); - } - - // 9. - let (furthest_block_index, furthest_block) = unwrap_or_return!( - self.open_elems.iter() - .enumerate() - .skip(fmt_elem_stack_index) - .filter(|&(_, open_element)| self.elem_in(open_element, special_tag)) - .next() - .map(|(i, h)| (i, h.clone())), - - // 10. - { - self.open_elems.truncate(fmt_elem_stack_index); - self.active_formatting.remove(fmt_elem_index); - } - ); - - // 11. - let common_ancestor = self.open_elems[fmt_elem_stack_index - 1].clone(); - - // 12. - let mut bookmark = Bookmark::Replace(fmt_elem.clone()); - - // 13. - let mut node; - let mut node_index = furthest_block_index; - let mut last_node = furthest_block.clone(); - - // 13.1. - let mut inner_counter = 0; - loop { - // 13.2. - inner_counter += 1; - - // 13.3. - node_index -= 1; - node = self.open_elems[node_index].clone(); - - // 13.4. - if self.sink.same_node(&node, &fmt_elem) { - break; - } - - // 13.5. - if inner_counter > 3 { - self.position_in_active_formatting(&node) - .map(|position| self.active_formatting.remove(position)); - self.open_elems.remove(node_index); - continue; - } - - let node_formatting_index = unwrap_or_else!( - self.position_in_active_formatting(&node), - - // 13.6. - { - self.open_elems.remove(node_index); - continue; - } - ); - - // 13.7. - let tag = match self.active_formatting[node_formatting_index] { - Element(ref h, ref t) => { - assert!(self.sink.same_node(h, &node)); - t.clone() - } - Marker => panic!("Found marker during adoption agency"), - }; - // FIXME: Is there a way to avoid cloning the attributes twice here (once on their - // own, once as part of t.clone() above)? - let new_element = create_element( - &mut self.sink, QualName::new(None, ns!(html), tag.name.clone()), - tag.attrs.clone()); - self.open_elems[node_index] = new_element.clone(); - self.active_formatting[node_formatting_index] = Element(new_element.clone(), tag); - node = new_element; - - // 13.8. - if self.sink.same_node(&last_node, &furthest_block) { - bookmark = Bookmark::InsertAfter(node.clone()); - } - - // 13.9. - self.sink.remove_from_parent(&last_node); - self.sink.append(&node, AppendNode(last_node.clone())); - - // 13.10. - last_node = node.clone(); - - // 13.11. - } - - // 14. - self.sink.remove_from_parent(&last_node); - self.insert_appropriately(AppendNode(last_node.clone()), Some(common_ancestor)); - - // 15. - // FIXME: Is there a way to avoid cloning the attributes twice here (once on their own, - // once as part of t.clone() above)? - let new_element = create_element( - &mut self.sink, QualName::new(None, ns!(html), fmt_elem_tag.name.clone()), - fmt_elem_tag.attrs.clone()); - let new_entry = Element(new_element.clone(), fmt_elem_tag); - - // 16. - self.sink.reparent_children(&furthest_block, &new_element); - - // 17. - self.sink.append(&furthest_block, AppendNode(new_element.clone())); - - // 18. - // FIXME: We could probably get rid of the position_in_active_formatting() calls here - // if we had a more clever Bookmark representation. - match bookmark { - Bookmark::Replace(to_replace) => { - let index = self.position_in_active_formatting(&to_replace) - .expect("bookmark not found in active formatting elements"); - self.active_formatting[index] = new_entry; - } - Bookmark::InsertAfter(previous) => { - let index = self.position_in_active_formatting(&previous) - .expect("bookmark not found in active formatting elements") + 1; - self.active_formatting.insert(index, new_entry); - let old_index = self.position_in_active_formatting(&fmt_elem) - .expect("formatting element not found in active formatting elements"); - self.active_formatting.remove(old_index); - } - } - - // 19. - self.remove_from_stack(&fmt_elem); - let new_furthest_block_index = self.open_elems.iter() - .position(|n| self.sink.same_node(n, &furthest_block)) - .expect("furthest block missing from open element stack"); - self.open_elems.insert(new_furthest_block_index + 1, new_element); - - // 20. - } - } - - fn push(&mut self, elem: &Handle) { - self.open_elems.push(elem.clone()); - } - - fn pop(&mut self) -> Handle { - let elem = self.open_elems.pop().expect("no current element"); - self.sink.pop(&elem); - elem - } - - fn remove_from_stack(&mut self, elem: &Handle) { - let sink = &mut self.sink; - let position = self.open_elems - .iter() - .rposition(|x| sink.same_node(elem, &x)); - if let Some(position) = position { - self.open_elems.remove(position); - sink.pop(elem); - } - } - - fn is_marker_or_open(&self, entry: &FormatEntry<Handle>) -> bool { - match *entry { - Marker => true, - Element(ref node, _) => { - self.open_elems.iter() - .rev() - .any(|n| self.sink.same_node(&n, &node)) - } - } - } - - /// Reconstruct the active formatting elements. - fn reconstruct_formatting(&mut self) { - { - let last = unwrap_or_return!(self.active_formatting.last(), ()); - if self.is_marker_or_open(last) { - return - } - } - - let mut entry_index = self.active_formatting.len() - 1; - loop { - if entry_index == 0 { - break - } - entry_index -= 1; - if self.is_marker_or_open(&self.active_formatting[entry_index]) { - entry_index += 1; - break - } - } - - loop { - let tag = match self.active_formatting[entry_index] { - Element(_, ref t) => t.clone(), - Marker => panic!("Found marker during formatting element reconstruction"), - }; - - // FIXME: Is there a way to avoid cloning the attributes twice here (once on their own, - // once as part of t.clone() above)? - let new_element = self.insert_element(Push, ns!(html), tag.name.clone(), - tag.attrs.clone()); - self.active_formatting[entry_index] = Element(new_element, tag); - if entry_index == self.active_formatting.len() - 1 { - break - } - entry_index += 1; - } - } - - /// Get the first element on the stack, which will be the <html> element. - fn html_elem(&self) -> &Handle { - &self.open_elems[0] - } - - /// Get the second element on the stack, if it's a HTML body element. - fn body_elem(&self) -> Option<&Handle> { - if self.open_elems.len() <= 1 { - return None; - } - - let node = &self.open_elems[1]; - if self.html_elem_named(node, local_name!("body")) { - Some(node) - } else { - None - } - } - - /// Signal an error depending on the state of the stack of open elements at - /// the end of the body. - fn check_body_end(&mut self) { - declare_tag_set!(body_end_ok = - "dd" "dt" "li" "optgroup" "option" "p" "rp" "rt" "tbody" "td" "tfoot" "th" - "thead" "tr" "body" "html"); - - for elem in self.open_elems.iter() { - let error; - { - let name = self.sink.elem_name(elem); - if body_end_ok(name) { - continue - } - error = format_if!(self.opts.exact_errors, - "Unexpected open tag at end of body", - "Unexpected open tag {:?} at end of body", name); - } - self.sink.parse_error(error); - // FIXME: Do we keep checking after finding one bad tag? - // The spec suggests not. - return; - } - } - - fn in_scope<TagSet,Pred>(&self, scope: TagSet, pred: Pred) -> bool - where TagSet: Fn(ExpandedName) -> bool, Pred: Fn(Handle) -> bool - { - for node in self.open_elems.iter().rev() { - if pred(node.clone()) { - return true; - } - if scope(self.sink.elem_name(node)) { - return false; - } - } - - // supposed to be impossible, because <html> is always in scope - - false - } - - fn elem_in<TagSet>(&self, elem: &Handle, set: TagSet) -> bool - where TagSet: Fn(ExpandedName) -> bool - { - set(self.sink.elem_name(elem)) - } - - fn html_elem_named(&self, elem: &Handle, name: LocalName) -> bool { - let expanded = self.sink.elem_name(elem); - *expanded.ns == ns!(html) && *expanded.local == name - } - - fn in_html_elem_named(&self, name: LocalName) -> bool { - self.open_elems.iter().any(|elem| self.html_elem_named(elem, name.clone())) - } - - fn current_node_named(&self, name: LocalName) -> bool { - self.html_elem_named(self.current_node(), name) - } - - fn in_scope_named<TagSet>(&self, scope: TagSet, name: LocalName) -> bool - where TagSet: Fn(ExpandedName) -> bool - { - self.in_scope(scope, |elem| self.html_elem_named(&elem, name.clone())) - } - - //§ closing-elements-that-have-implied-end-tags - fn generate_implied_end<TagSet>(&mut self, set: TagSet) - where TagSet: Fn(ExpandedName) -> bool - { - loop { - { - let elem = unwrap_or_return!(self.open_elems.last(), ()); - let nsname = self.sink.elem_name(elem); - if !set(nsname) { return; } - } - self.pop(); - } - } - - fn generate_implied_end_except(&mut self, except: LocalName) { - self.generate_implied_end(|p| { - if *p.ns == ns!(html) && *p.local == except { - false - } else { - cursory_implied_end(p) - } - }); - } - //§ END - - // Pop elements until the current element is in the set. - fn pop_until_current<TagSet>(&mut self, pred: TagSet) - where TagSet: Fn(ExpandedName) -> bool - { - loop { - if self.current_node_in(|x| pred(x)) { - break; - } - self.open_elems.pop(); - } - } - - // Pop elements until an element from the set has been popped. Returns the - // number of elements popped. - fn pop_until<P>(&mut self, pred: P) -> usize - where P: Fn(ExpandedName) -> bool - { - let mut n = 0; - loop { - n += 1; - match self.open_elems.pop() { - None => break, - Some(elem) => if pred(self.sink.elem_name(&elem)) { break; }, - } - } - n - } - - fn pop_until_named(&mut self, name: LocalName) -> usize { - self.pop_until(|p| *p.ns == ns!(html) && *p.local == name) - } - - // Pop elements until one with the specified name has been popped. - // Signal an error if it was not the first one. - fn expect_to_close(&mut self, name: LocalName) { - if self.pop_until_named(name.clone()) != 1 { - self.sink.parse_error(format_if!(self.opts.exact_errors, - "Unexpected open element", - "Unexpected open element while closing {:?}", name)); - } - } - - fn close_p_element(&mut self) { - declare_tag_set!(implied = [cursory_implied_end] - "p"); - self.generate_implied_end(implied); - self.expect_to_close(local_name!("p")); - } - - fn close_p_element_in_button_scope(&mut self) { - if self.in_scope_named(button_scope, local_name!("p")) { - self.close_p_element(); - } - } - - // Check <input> tags for type=hidden - fn is_type_hidden(&self, tag: &Tag) -> bool { - match tag.attrs.iter().find(|&at| at.name.expanded() == expanded_name!("", "type")) { - None => false, - Some(at) => (&*at.value).eq_ignore_ascii_case("hidden"), - } - } - - fn foster_parent_in_body(&mut self, token: Token) -> ProcessResult<Handle> { - warn!("foster parenting not implemented"); - self.foster_parenting = true; - let res = self.step(InBody, token); - // FIXME: what if res is Reprocess? - self.foster_parenting = false; - res - } - - fn process_chars_in_table(&mut self, token: Token) -> ProcessResult<Handle> { - declare_tag_set!(table_outer = "table" "tbody" "tfoot" "thead" "tr"); - if self.current_node_in(table_outer) { - assert!(self.pending_table_text.is_empty()); - self.orig_mode = Some(self.mode); - Reprocess(InTableText, token) - } else { - self.sink.parse_error(format_if!(self.opts.exact_errors, - "Unexpected characters in table", - "Unexpected characters {} in table", to_escaped_string(&token))); - self.foster_parent_in_body(token) - } - } - - // https://html.spec.whatwg.org/multipage/syntax.html#reset-the-insertion-mode-appropriately - fn reset_insertion_mode(&mut self) -> InsertionMode { - for (i, mut node) in self.open_elems.iter().enumerate().rev() { - let last = i == 0usize; - if let (true, Some(ctx)) = (last, self.context_elem.as_ref()) { - node = ctx; - } - let name = match self.sink.elem_name(node) { - ExpandedName { ns: &ns!(html), local } => local, - _ => continue, - }; - match *name { - local_name!("select") => { - for ancestor in self.open_elems[0..i].iter().rev() { - if self.html_elem_named(ancestor, local_name!("template")) { - return InSelect; - } else if self.html_elem_named(ancestor, local_name!("table")) { - return InSelectInTable; - } - } - return InSelect; - }, - local_name!("td") | local_name!("th") => if !last { return InCell; }, - local_name!("tr") => return InRow, - local_name!("tbody") | local_name!("thead") | local_name!("tfoot") => return InTableBody, - local_name!("caption") => return InCaption, - local_name!("colgroup") => return InColumnGroup, - local_name!("table") => return InTable, - local_name!("template") => return *self.template_modes.last().unwrap(), - local_name!("head") => if !last { return InHead }, - local_name!("body") => return InBody, - local_name!("frameset") => return InFrameset, - local_name!("html") => match self.head_elem { - None => return BeforeHead, - Some(_) => return AfterHead, - }, - - _ => (), - } - } - InBody - } - - fn close_the_cell(&mut self) { - self.generate_implied_end(cursory_implied_end); - if self.pop_until(td_th) != 1 { - self.sink.parse_error(Borrowed("expected to close <td> or <th> with cell")); - } - self.clear_active_formatting_to_marker(); - } - - fn append_text(&mut self, text: StrTendril) -> ProcessResult<Handle> { - self.insert_appropriately(AppendText(text), None); - Done - } - - fn append_comment(&mut self, text: StrTendril) -> ProcessResult<Handle> { - let comment = self.sink.create_comment(text); - self.insert_appropriately(AppendNode(comment), None); - Done - } - - fn append_comment_to_doc(&mut self, text: StrTendril) -> ProcessResult<Handle> { - let comment = self.sink.create_comment(text); - self.sink.append(&self.doc_handle, AppendNode(comment)); - Done - } - - fn append_comment_to_html(&mut self, text: StrTendril) -> ProcessResult<Handle> { - let target = html_elem(&self.open_elems); - let comment = self.sink.create_comment(text); - self.sink.append(target, AppendNode(comment)); - Done - } - - //§ creating-and-inserting-nodes - fn create_root(&mut self, attrs: Vec<Attribute>) { - let elem = create_element( - &mut self.sink, QualName::new(None, ns!(html), local_name!("html")), - attrs); - self.push(&elem); - self.sink.append(&self.doc_handle, AppendNode(elem)); - // FIXME: application cache selection algorithm - } - - // https://html.spec.whatwg.org/multipage/#create-an-element-for-the-token - fn insert_element(&mut self, push: PushFlag, ns: Namespace, name: LocalName, attrs: Vec<Attribute>) - -> Handle { - declare_tag_set!(form_associatable = - "button" "fieldset" "input" "object" - "output" "select" "textarea" "img"); - - declare_tag_set!(listed = [form_associatable] - "img"); - - // Step 7. - let qname = QualName::new(None, ns, name); - let elem = create_element(&mut self.sink, qname.clone(), attrs.clone()); - - let insertion_point = self.appropriate_place_for_insertion(None); - let tree_node = match insertion_point { - LastChild(ref p) | - BeforeSibling(ref p) => p.clone() - }; - - // Step 12. - if form_associatable(qname.expanded()) && - self.form_elem.is_some() && - !self.in_html_elem_named(local_name!("template")) && - !(listed(qname.expanded()) && - attrs.iter().any(|a| a.name.expanded() == expanded_name!("", "form"))) { - - let form = self.form_elem.as_ref().unwrap().clone(); - if self.sink.same_tree(&tree_node, &form) { - self.sink.associate_with_form(&elem, &form) - } - } - - self.insert_at(insertion_point, AppendNode(elem.clone())); - - match push { - Push => self.push(&elem), - NoPush => (), - } - // FIXME: Remove from the stack if we can't append? - elem - } - - fn insert_element_for(&mut self, tag: Tag) -> Handle { - self.insert_element(Push, ns!(html), tag.name, tag.attrs) - } - - fn insert_and_pop_element_for(&mut self, tag: Tag) -> Handle { - self.insert_element(NoPush, ns!(html), tag.name, tag.attrs) - } - - fn insert_phantom(&mut self, name: LocalName) -> Handle { - self.insert_element(Push, ns!(html), name, vec!()) - } - //§ END - - fn create_formatting_element_for(&mut self, tag: Tag) -> Handle { - // FIXME: This really wants unit tests. - let mut first_match = None; - let mut matches = 0usize; - for (i, _, old_tag) in self.active_formatting_end_to_marker() { - if tag.equiv_modulo_attr_order(old_tag) { - first_match = Some(i); - matches += 1; - } - } - - if matches >= 3 { - self.active_formatting.remove(first_match.expect("matches with no index")); - } - - let elem = self.insert_element(Push, ns!(html), tag.name.clone(), tag.attrs.clone()); - self.active_formatting.push(Element(elem.clone(), tag)); - elem - } - - fn clear_active_formatting_to_marker(&mut self) { - loop { - match self.active_formatting.pop() { - None | Some(Marker) => break, - _ => (), - } - } - } - - fn process_end_tag_in_body(&mut self, tag: Tag) { - // Look back for a matching open element. - let mut match_idx = None; - for (i, elem) in self.open_elems.iter().enumerate().rev() { - if self.html_elem_named(elem, tag.name.clone()) { - match_idx = Some(i); - break; - } - - if self.elem_in(elem, special_tag) { - self.sink.parse_error(Borrowed("Found special tag while closing generic tag")); - return; - } - } - - // Can't use unwrap_or_return!() due to rust-lang/rust#16617. - let match_idx = match match_idx { - None => { - // I believe this is impossible, because the root - // <html> element is in special_tag. - self.unexpected(&tag); - return; - } - Some(x) => x, - }; - - self.generate_implied_end_except(tag.name.clone()); - - if match_idx != self.open_elems.len() - 1 { - // mis-nested tags - self.unexpected(&tag); - } - self.open_elems.truncate(match_idx); - } - - fn handle_misnested_a_tags(&mut self, tag: &Tag) { - let node = unwrap_or_return!( - self.active_formatting_end_to_marker() - .filter(|&(_, n, _)| self.html_elem_named(n, local_name!("a"))) - .next() - .map(|(_, n, _)| n.clone()), - - () - ); - - self.unexpected(tag); - self.adoption_agency(local_name!("a")); - self.position_in_active_formatting(&node) - .map(|index| self.active_formatting.remove(index)); - self.remove_from_stack(&node); - } - - //§ tree-construction - fn is_foreign(&mut self, token: &Token) -> bool { - if let EOFToken = *token { - return false; - } - - if self.open_elems.len() == 0 { - return false; - } - - let name = self.sink.elem_name(self.adjusted_current_node()); - if let ns!(html) = *name.ns { - return false; - } - - if mathml_text_integration_point(name) { - match *token { - CharacterTokens(..) | NullCharacterToken => return false, - TagToken(Tag { kind: StartTag, ref name, .. }) - if !matches!(*name, local_name!("mglyph") | local_name!("malignmark")) => return false, - _ => (), - } - } - - if svg_html_integration_point(name) { - match *token { - CharacterTokens(..) | NullCharacterToken => return false, - TagToken(Tag { kind: StartTag, .. }) => return false, - _ => (), - } - } - - if let expanded_name!(mathml "annotation-xml") = name { - match *token { - TagToken(Tag { kind: StartTag, name: local_name!("svg"), .. }) => return false, - CharacterTokens(..) | NullCharacterToken | - TagToken(Tag { kind: StartTag, .. }) => { - return !self.sink.is_mathml_annotation_xml_integration_point( - self.adjusted_current_node()) - } - _ => {} - }; - } - - true - } - //§ END - - fn enter_foreign(&mut self, mut tag: Tag, ns: Namespace) -> ProcessResult<Handle> { - match ns { - ns!(mathml) => self.adjust_mathml_attributes(&mut tag), - ns!(svg) => self.adjust_svg_attributes(&mut tag), - _ => (), - } - self.adjust_foreign_attributes(&mut tag); - - if tag.self_closing { - self.insert_element(NoPush, ns, tag.name, tag.attrs); - DoneAckSelfClosing - } else { - self.insert_element(Push, ns, tag.name, tag.attrs); - Done - } - } - - fn adjust_svg_tag_name(&mut self, tag: &mut Tag) { - let Tag { ref mut name, .. } = *tag; - match *name { - local_name!("altglyph") => *name = local_name!("altGlyph"), - local_name!("altglyphdef") => *name = local_name!("altGlyphDef"), - local_name!("altglyphitem") => *name = local_name!("altGlyphItem"), - local_name!("animatecolor") => *name = local_name!("animateColor"), - local_name!("animatemotion") => *name = local_name!("animateMotion"), - local_name!("animatetransform") => *name = local_name!("animateTransform"), - local_name!("clippath") => *name = local_name!("clipPath"), - local_name!("feblend") => *name = local_name!("feBlend"), - local_name!("fecolormatrix") => *name = local_name!("feColorMatrix"), - local_name!("fecomponenttransfer") => *name = local_name!("feComponentTransfer"), - local_name!("fecomposite") => *name = local_name!("feComposite"), - local_name!("feconvolvematrix") => *name = local_name!("feConvolveMatrix"), - local_name!("fediffuselighting") => *name = local_name!("feDiffuseLighting"), - local_name!("fedisplacementmap") => *name = local_name!("feDisplacementMap"), - local_name!("fedistantlight") => *name = local_name!("feDistantLight"), - local_name!("fedropshadow") => *name = local_name!("feDropShadow"), - local_name!("feflood") => *name = local_name!("feFlood"), - local_name!("fefunca") => *name = local_name!("feFuncA"), - local_name!("fefuncb") => *name = local_name!("feFuncB"), - local_name!("fefuncg") => *name = local_name!("feFuncG"), - local_name!("fefuncr") => *name = local_name!("feFuncR"), - local_name!("fegaussianblur") => *name = local_name!("feGaussianBlur"), - local_name!("feimage") => *name = local_name!("feImage"), - local_name!("femerge") => *name = local_name!("feMerge"), - local_name!("femergenode") => *name = local_name!("feMergeNode"), - local_name!("femorphology") => *name = local_name!("feMorphology"), - local_name!("feoffset") => *name = local_name!("feOffset"), - local_name!("fepointlight") => *name = local_name!("fePointLight"), - local_name!("fespecularlighting") => *name = local_name!("feSpecularLighting"), - local_name!("fespotlight") => *name = local_name!("feSpotLight"), - local_name!("fetile") => *name = local_name!("feTile"), - local_name!("feturbulence") => *name = local_name!("feTurbulence"), - local_name!("foreignobject") => *name = local_name!("foreignObject"), - local_name!("glyphref") => *name = local_name!("glyphRef"), - local_name!("lineargradient") => *name = local_name!("linearGradient"), - local_name!("radialgradient") => *name = local_name!("radialGradient"), - local_name!("textpath") => *name = local_name!("textPath"), - _ => (), - } - } - - fn adjust_attributes<F>(&mut self, tag: &mut Tag, mut map: F) - where F: FnMut(LocalName) -> Option<QualName>, - { - for &mut Attribute { ref mut name, .. } in &mut tag.attrs { - if let Some(replacement) = map(name.local.clone()) { - *name = replacement; - } - } - } - - fn adjust_svg_attributes(&mut self, tag: &mut Tag) { - self.adjust_attributes(tag, |k| match k { - local_name!("attributename") => Some(qualname!("", "attributeName")), - local_name!("attributetype") => Some(qualname!("", "attributeType")), - local_name!("basefrequency") => Some(qualname!("", "baseFrequency")), - local_name!("baseprofile") => Some(qualname!("", "baseProfile")), - local_name!("calcmode") => Some(qualname!("", "calcMode")), - local_name!("clippathunits") => Some(qualname!("", "clipPathUnits")), - local_name!("diffuseconstant") => Some(qualname!("", "diffuseConstant")), - local_name!("edgemode") => Some(qualname!("", "edgeMode")), - local_name!("filterunits") => Some(qualname!("", "filterUnits")), - local_name!("glyphref") => Some(qualname!("", "glyphRef")), - local_name!("gradienttransform") => Some(qualname!("", "gradientTransform")), - local_name!("gradientunits") => Some(qualname!("", "gradientUnits")), - local_name!("kernelmatrix") => Some(qualname!("", "kernelMatrix")), - local_name!("kernelunitlength") => Some(qualname!("", "kernelUnitLength")), - local_name!("keypoints") => Some(qualname!("", "keyPoints")), - local_name!("keysplines") => Some(qualname!("", "keySplines")), - local_name!("keytimes") => Some(qualname!("", "keyTimes")), - local_name!("lengthadjust") => Some(qualname!("", "lengthAdjust")), - local_name!("limitingconeangle") => Some(qualname!("", "limitingConeAngle")), - local_name!("markerheight") => Some(qualname!("", "markerHeight")), - local_name!("markerunits") => Some(qualname!("", "markerUnits")), - local_name!("markerwidth") => Some(qualname!("", "markerWidth")), - local_name!("maskcontentunits") => Some(qualname!("", "maskContentUnits")), - local_name!("maskunits") => Some(qualname!("", "maskUnits")), - local_name!("numoctaves") => Some(qualname!("", "numOctaves")), - local_name!("pathlength") => Some(qualname!("", "pathLength")), - local_name!("patterncontentunits") => Some(qualname!("", "patternContentUnits")), - local_name!("patterntransform") => Some(qualname!("", "patternTransform")), - local_name!("patternunits") => Some(qualname!("", "patternUnits")), - local_name!("pointsatx") => Some(qualname!("", "pointsAtX")), - local_name!("pointsaty") => Some(qualname!("", "pointsAtY")), - local_name!("pointsatz") => Some(qualname!("", "pointsAtZ")), - local_name!("preservealpha") => Some(qualname!("", "preserveAlpha")), - local_name!("preserveaspectratio") => Some(qualname!("", "preserveAspectRatio")), - local_name!("primitiveunits") => Some(qualname!("", "primitiveUnits")), - local_name!("refx") => Some(qualname!("", "refX")), - local_name!("refy") => Some(qualname!("", "refY")), - local_name!("repeatcount") => Some(qualname!("", "repeatCount")), - local_name!("repeatdur") => Some(qualname!("", "repeatDur")), - local_name!("requiredextensions") => Some(qualname!("", "requiredExtensions")), - local_name!("requiredfeatures") => Some(qualname!("", "requiredFeatures")), - local_name!("specularconstant") => Some(qualname!("", "specularConstant")), - local_name!("specularexponent") => Some(qualname!("", "specularExponent")), - local_name!("spreadmethod") => Some(qualname!("", "spreadMethod")), - local_name!("startoffset") => Some(qualname!("", "startOffset")), - local_name!("stddeviation") => Some(qualname!("", "stdDeviation")), - local_name!("stitchtiles") => Some(qualname!("", "stitchTiles")), - local_name!("surfacescale") => Some(qualname!("", "surfaceScale")), - local_name!("systemlanguage") => Some(qualname!("", "systemLanguage")), - local_name!("tablevalues") => Some(qualname!("", "tableValues")), - local_name!("targetx") => Some(qualname!("", "targetX")), - local_name!("targety") => Some(qualname!("", "targetY")), - local_name!("textlength") => Some(qualname!("", "textLength")), - local_name!("viewbox") => Some(qualname!("", "viewBox")), - local_name!("viewtarget") => Some(qualname!("", "viewTarget")), - local_name!("xchannelselector") => Some(qualname!("", "xChannelSelector")), - local_name!("ychannelselector") => Some(qualname!("", "yChannelSelector")), - local_name!("zoomandpan") => Some(qualname!("", "zoomAndPan")), - _ => None, - }); - } - - fn adjust_mathml_attributes(&mut self, tag: &mut Tag) { - self.adjust_attributes(tag, |k| match k { - local_name!("definitionurl") => Some(qualname!("", "definitionURL")), - _ => None, - }); - } - - fn adjust_foreign_attributes(&mut self, tag: &mut Tag) { - self.adjust_attributes(tag, |k| match k { - local_name!("xlink:actuate") => Some(qualname!("xlink" xlink "actuate")), - local_name!("xlink:arcrole") => Some(qualname!("xlink" xlink "arcrole")), - local_name!("xlink:href") => Some(qualname!("xlink" xlink "href")), - local_name!("xlink:role") => Some(qualname!("xlink" xlink "role")), - local_name!("xlink:show") => Some(qualname!("xlink" xlink "show")), - local_name!("xlink:title") => Some(qualname!("xlink" xlink "title")), - local_name!("xlink:type") => Some(qualname!("xlink" xlink "type")), - local_name!("xml:base") => Some(qualname!("xml" xml "base")), - local_name!("xml:lang") => Some(qualname!("xml" xml "lang")), - local_name!("xml:space") => Some(qualname!("xml" xml "space")), - local_name!("xmlns") => Some(qualname!("" xmlns "xmlns")), - local_name!("xmlns:xlink") => Some(qualname!("xmlns" xmlns "xlink")), - _ => None, - }); - } - - fn foreign_start_tag(&mut self, mut tag: Tag) -> ProcessResult<Handle> { - let current_ns = self.sink.elem_name(self.adjusted_current_node()).ns.clone(); - match current_ns { - ns!(mathml) => self.adjust_mathml_attributes(&mut tag), - ns!(svg) => { - self.adjust_svg_tag_name(&mut tag); - self.adjust_svg_attributes(&mut tag); - } - _ => (), - } - self.adjust_foreign_attributes(&mut tag); - if tag.self_closing { - // FIXME(#118): <script /> in SVG - self.insert_element(NoPush, current_ns, tag.name, tag.attrs); - DoneAckSelfClosing - } else { - self.insert_element(Push, current_ns, tag.name, tag.attrs); - Done - } - } - - fn unexpected_start_tag_in_foreign_content(&mut self, tag: Tag) -> ProcessResult<Handle> { - self.unexpected(&tag); - if self.is_fragment() { - self.foreign_start_tag(tag) - } else { - self.pop(); - while !self.current_node_in(|n| { - *n.ns == ns!(html) || - mathml_text_integration_point(n) || - svg_html_integration_point(n) - }) { - self.pop(); - } - ReprocessForeign(TagToken(tag)) - } - } -} diff --git a/src/vendor/html5ever/src/tree_builder/mod.rs b/src/vendor/html5ever/src/tree_builder/mod.rs index fc2c6c8c4f..ac6e4e9efe 100644 --- a/src/vendor/html5ever/src/tree_builder/mod.rs +++ b/src/vendor/html5ever/src/tree_builder/mod.rs @@ -12,39 +12,41 @@ //! The HTML5 tree builder. pub use interface::{QuirksMode, Quirks, LimitedQuirks, NoQuirks}; -pub use interface::{NodeOrText, AppendNode, AppendText}; +pub use interface::{NodeOrText, AppendNode, AppendText, Attribute}; pub use interface::{TreeSink, Tracer, NextParserState, create_element, ElementFlags}; use self::types::*; -use self::actions::TreeBuilderActions; -use self::rules::TreeBuilderStep; -use ExpandedName; -use QualName; +use {ExpandedName, QualName, LocalName, Namespace}; use tendril::StrTendril; use tokenizer; -use tokenizer::{Doctype, StartTag, Tag, TokenSink, TokenSinkResult}; +use tokenizer::{Doctype, StartTag, Tag, EndTag, TokenSink, TokenSinkResult}; use tokenizer::states as tok_state; use util::str::is_ascii_whitespace; -use std::default::Default; -use std::mem::replace; +use std::{slice, fmt}; +use std::ascii::AsciiExt; use std::borrow::Cow::Borrowed; use std::collections::VecDeque; +use std::default::Default; +use std::iter::{Rev, Enumerate}; +use std::mem::replace; + +use tokenizer::states::{RawData, RawKind}; +use tree_builder::types::*; +use tree_builder::tag_sets::*; +use util::str::to_escaped_string; + +pub use self::PushFlag::*; #[macro_use] mod tag_sets; mod data; mod types; -mod actions; -mod rules { - //! The tree builder rules, as a single, enormous nested match expression. - - include!(concat!(env!("OUT_DIR"), "/rules.rs")); -} +include!(concat!(env!("OUT_DIR"), "/rules.rs")); /// Tree builder options, with an impl for Default. #[derive(Copy, Clone)] @@ -384,15 +386,10 @@ impl<Handle, Sink> TreeBuilder<Handle, Sink> let contents = self.sink.get_template_contents(&elem); return LastChild(contents); } else if self.html_elem_named(&elem, local_name!("table")) { - // Try inserting "inside last table's parent node, immediately before last table" - if self.sink.has_parent_node(&elem) { - return BeforeSibling(elem.clone()); - } else { - // If elem has no parent, we regain ownership of the child. - // Insert "inside previous element, after its last child (if any)" - let previous_element = (*iter.peek().unwrap()).clone(); - return LastChild(previous_element); - } + return TableFosterParenting { + element: elem.clone(), + prev_element: (*iter.peek().unwrap()).clone(), + }; } } let html_elem = self.html_elem(); @@ -402,7 +399,11 @@ impl<Handle, Sink> TreeBuilder<Handle, Sink> fn insert_at(&mut self, insertion_point: InsertionPoint<Handle>, child: NodeOrText<Handle>) { match insertion_point { LastChild(parent) => self.sink.append(&parent, child), - BeforeSibling(sibling) => self.sink.append_before_sibling(&sibling, child) + BeforeSibling(sibling) => self.sink.append_before_sibling(&sibling, child), + TableFosterParenting { element, prev_element } => self.sink.append_based_on_parent_node( + &element, + &prev_element, + child), } } } @@ -486,6 +487,1068 @@ impl<Handle, Sink> TokenSink } } +pub fn html_elem<Handle>(open_elems: &[Handle]) -> &Handle { + &open_elems[0] +} + +pub struct ActiveFormattingIter<'a, Handle: 'a> { + iter: Rev<Enumerate<slice::Iter<'a, FormatEntry<Handle>>>>, +} + +impl<'a, Handle> Iterator for ActiveFormattingIter<'a, Handle> { + type Item = (usize, &'a Handle, &'a Tag); + fn next(&mut self) -> Option<(usize, &'a Handle, &'a Tag)> { + match self.iter.next() { + None | Some((_, &Marker)) => None, + Some((i, &Element(ref h, ref t))) => Some((i, h, t)), + } + } +} + +pub enum PushFlag { + Push, + NoPush, +} + +enum Bookmark<Handle> { + Replace(Handle), + InsertAfter(Handle), +} + +macro_rules! qualname { + ("", $local:tt) => { + QualName { + prefix: None, + ns: ns!(), + local: local_name!($local), + } + }; + ($prefix: tt $ns:tt $local:tt) => { + QualName { + prefix: Some(namespace_prefix!($prefix)), + ns: ns!($ns), + local: local_name!($local), + } + } +} + +#[doc(hidden)] +impl<Handle, Sink> TreeBuilder<Handle, Sink> + where Handle: Clone, + Sink: TreeSink<Handle=Handle>, +{ + fn unexpected<T: fmt::Debug>(&mut self, _thing: &T) -> ProcessResult<Handle> { + self.sink.parse_error(format_if!( + self.opts.exact_errors, + "Unexpected token", + "Unexpected token {} in insertion mode {:?}", to_escaped_string(_thing), self.mode)); + Done + } + + fn assert_named(&mut self, node: &Handle, name: LocalName) { + assert!(self.html_elem_named(&node, name)); + } + + /// Iterate over the active formatting elements (with index in the list) from the end + /// to the last marker, or the beginning if there are no markers. + fn active_formatting_end_to_marker<'a>(&'a self) -> ActiveFormattingIter<'a, Handle> { + ActiveFormattingIter { + iter: self.active_formatting.iter().enumerate().rev(), + } + } + + fn position_in_active_formatting(&self, element: &Handle) -> Option<usize> { + self.active_formatting + .iter() + .position(|n| { + match n { + &Marker => false, + &Element(ref handle, _) => self.sink.same_node(handle, element) + } + }) + } + + fn set_quirks_mode(&mut self, mode: QuirksMode) { + self.quirks_mode = mode; + self.sink.set_quirks_mode(mode); + } + + fn stop_parsing(&mut self) -> ProcessResult<Handle> { + warn!("stop_parsing not implemented, full speed ahead!"); + Done + } + + //§ parsing-elements-that-contain-only-text + // Switch to `Text` insertion mode, save the old mode, and + // switch the tokenizer to a raw-data state. + // The latter only takes effect after the current / next + // `process_token` of a start tag returns! + fn to_raw_text_mode(&mut self, k: RawKind) -> ProcessResult<Handle> { + self.orig_mode = Some(self.mode); + self.mode = Text; + ToRawData(k) + } + + // The generic raw text / RCDATA parsing algorithm. + fn parse_raw_data(&mut self, tag: Tag, k: RawKind) -> ProcessResult<Handle> { + self.insert_element_for(tag); + self.to_raw_text_mode(k) + } + //§ END + + fn current_node(&self) -> &Handle { + self.open_elems.last().expect("no current element") + } + + fn adjusted_current_node(&self) -> &Handle { + if self.open_elems.len() == 1 { + if let Some(ctx) = self.context_elem.as_ref() { + return ctx; + } + } + self.current_node() + } + + fn current_node_in<TagSet>(&self, set: TagSet) -> bool + where TagSet: Fn(ExpandedName) -> bool + { + set(self.sink.elem_name(self.current_node())) + } + + // Insert at the "appropriate place for inserting a node". + fn insert_appropriately(&mut self, child: NodeOrText<Handle>, override_target: Option<Handle>) { + let insertion_point = self.appropriate_place_for_insertion(override_target); + self.insert_at(insertion_point, child); + } + + fn adoption_agency(&mut self, subject: LocalName) { + // 1. + if self.current_node_named(subject.clone()) { + if self.position_in_active_formatting(self.current_node()).is_none() { + self.pop(); + return; + } + } + + // 2. 3. 4. + for _ in 0..8 { + // 5. + let (fmt_elem_index, fmt_elem, fmt_elem_tag) = unwrap_or_return!( + // We clone the Handle and Tag so they don't cause an immutable borrow of self. + self.active_formatting_end_to_marker() + .filter(|&(_, _, tag)| tag.name == subject) + .next() + .map(|(i, h, t)| (i, h.clone(), t.clone())), + + { + self.process_end_tag_in_body(Tag { + kind: EndTag, + name: subject, + self_closing: false, + attrs: vec!(), + }); + } + ); + + let fmt_elem_stack_index = unwrap_or_return!( + self.open_elems.iter() + .rposition(|n| self.sink.same_node(n, &fmt_elem)), + + { + self.sink.parse_error(Borrowed("Formatting element not open")); + self.active_formatting.remove(fmt_elem_index); + } + ); + + // 7. + if !self.in_scope(default_scope, |n| self.sink.same_node(&n, &fmt_elem)) { + self.sink.parse_error(Borrowed("Formatting element not in scope")); + return; + } + + // 8. + if !self.sink.same_node(self.current_node(), &fmt_elem) { + self.sink.parse_error(Borrowed("Formatting element not current node")); + } + + // 9. + let (furthest_block_index, furthest_block) = unwrap_or_return!( + self.open_elems.iter() + .enumerate() + .skip(fmt_elem_stack_index) + .filter(|&(_, open_element)| self.elem_in(open_element, special_tag)) + .next() + .map(|(i, h)| (i, h.clone())), + + // 10. + { + self.open_elems.truncate(fmt_elem_stack_index); + self.active_formatting.remove(fmt_elem_index); + } + ); + + // 11. + let common_ancestor = self.open_elems[fmt_elem_stack_index - 1].clone(); + + // 12. + let mut bookmark = Bookmark::Replace(fmt_elem.clone()); + + // 13. + let mut node; + let mut node_index = furthest_block_index; + let mut last_node = furthest_block.clone(); + + // 13.1. + let mut inner_counter = 0; + loop { + // 13.2. + inner_counter += 1; + + // 13.3. + node_index -= 1; + node = self.open_elems[node_index].clone(); + + // 13.4. + if self.sink.same_node(&node, &fmt_elem) { + break; + } + + // 13.5. + if inner_counter > 3 { + self.position_in_active_formatting(&node) + .map(|position| self.active_formatting.remove(position)); + self.open_elems.remove(node_index); + continue; + } + + let node_formatting_index = unwrap_or_else!( + self.position_in_active_formatting(&node), + + // 13.6. + { + self.open_elems.remove(node_index); + continue; + } + ); + + // 13.7. + let tag = match self.active_formatting[node_formatting_index] { + Element(ref h, ref t) => { + assert!(self.sink.same_node(h, &node)); + t.clone() + } + Marker => panic!("Found marker during adoption agency"), + }; + // FIXME: Is there a way to avoid cloning the attributes twice here (once on their + // own, once as part of t.clone() above)? + let new_element = create_element( + &mut self.sink, QualName::new(None, ns!(html), tag.name.clone()), + tag.attrs.clone()); + self.open_elems[node_index] = new_element.clone(); + self.active_formatting[node_formatting_index] = Element(new_element.clone(), tag); + node = new_element; + + // 13.8. + if self.sink.same_node(&last_node, &furthest_block) { + bookmark = Bookmark::InsertAfter(node.clone()); + } + + // 13.9. + self.sink.remove_from_parent(&last_node); + self.sink.append(&node, AppendNode(last_node.clone())); + + // 13.10. + last_node = node.clone(); + + // 13.11. + } + + // 14. + self.sink.remove_from_parent(&last_node); + self.insert_appropriately(AppendNode(last_node.clone()), Some(common_ancestor)); + + // 15. + // FIXME: Is there a way to avoid cloning the attributes twice here (once on their own, + // once as part of t.clone() above)? + let new_element = create_element( + &mut self.sink, QualName::new(None, ns!(html), fmt_elem_tag.name.clone()), + fmt_elem_tag.attrs.clone()); + let new_entry = Element(new_element.clone(), fmt_elem_tag); + + // 16. + self.sink.reparent_children(&furthest_block, &new_element); + + // 17. + self.sink.append(&furthest_block, AppendNode(new_element.clone())); + + // 18. + // FIXME: We could probably get rid of the position_in_active_formatting() calls here + // if we had a more clever Bookmark representation. + match bookmark { + Bookmark::Replace(to_replace) => { + let index = self.position_in_active_formatting(&to_replace) + .expect("bookmark not found in active formatting elements"); + self.active_formatting[index] = new_entry; + } + Bookmark::InsertAfter(previous) => { + let index = self.position_in_active_formatting(&previous) + .expect("bookmark not found in active formatting elements") + 1; + self.active_formatting.insert(index, new_entry); + let old_index = self.position_in_active_formatting(&fmt_elem) + .expect("formatting element not found in active formatting elements"); + self.active_formatting.remove(old_index); + } + } + + // 19. + self.remove_from_stack(&fmt_elem); + let new_furthest_block_index = self.open_elems.iter() + .position(|n| self.sink.same_node(n, &furthest_block)) + .expect("furthest block missing from open element stack"); + self.open_elems.insert(new_furthest_block_index + 1, new_element); + + // 20. + } + } + + fn push(&mut self, elem: &Handle) { + self.open_elems.push(elem.clone()); + } + + fn pop(&mut self) -> Handle { + let elem = self.open_elems.pop().expect("no current element"); + self.sink.pop(&elem); + elem + } + + fn remove_from_stack(&mut self, elem: &Handle) { + let sink = &mut self.sink; + let position = self.open_elems + .iter() + .rposition(|x| sink.same_node(elem, &x)); + if let Some(position) = position { + self.open_elems.remove(position); + sink.pop(elem); + } + } + + fn is_marker_or_open(&self, entry: &FormatEntry<Handle>) -> bool { + match *entry { + Marker => true, + Element(ref node, _) => { + self.open_elems.iter() + .rev() + .any(|n| self.sink.same_node(&n, &node)) + } + } + } + + /// Reconstruct the active formatting elements. + fn reconstruct_formatting(&mut self) { + { + let last = unwrap_or_return!(self.active_formatting.last(), ()); + if self.is_marker_or_open(last) { + return + } + } + + let mut entry_index = self.active_formatting.len() - 1; + loop { + if entry_index == 0 { + break + } + entry_index -= 1; + if self.is_marker_or_open(&self.active_formatting[entry_index]) { + entry_index += 1; + break + } + } + + loop { + let tag = match self.active_formatting[entry_index] { + Element(_, ref t) => t.clone(), + Marker => panic!("Found marker during formatting element reconstruction"), + }; + + // FIXME: Is there a way to avoid cloning the attributes twice here (once on their own, + // once as part of t.clone() above)? + let new_element = self.insert_element(Push, ns!(html), tag.name.clone(), + tag.attrs.clone()); + self.active_formatting[entry_index] = Element(new_element, tag); + if entry_index == self.active_formatting.len() - 1 { + break + } + entry_index += 1; + } + } + + /// Get the first element on the stack, which will be the <html> element. + fn html_elem(&self) -> &Handle { + &self.open_elems[0] + } + + /// Get the second element on the stack, if it's a HTML body element. + fn body_elem(&self) -> Option<&Handle> { + if self.open_elems.len() <= 1 { + return None; + } + + let node = &self.open_elems[1]; + if self.html_elem_named(node, local_name!("body")) { + Some(node) + } else { + None + } + } + + /// Signal an error depending on the state of the stack of open elements at + /// the end of the body. + fn check_body_end(&mut self) { + declare_tag_set!(body_end_ok = + "dd" "dt" "li" "optgroup" "option" "p" "rp" "rt" "tbody" "td" "tfoot" "th" + "thead" "tr" "body" "html"); + + for elem in self.open_elems.iter() { + let error; + { + let name = self.sink.elem_name(elem); + if body_end_ok(name) { + continue + } + error = format_if!(self.opts.exact_errors, + "Unexpected open tag at end of body", + "Unexpected open tag {:?} at end of body", name); + } + self.sink.parse_error(error); + // FIXME: Do we keep checking after finding one bad tag? + // The spec suggests not. + return; + } + } + + fn in_scope<TagSet,Pred>(&self, scope: TagSet, pred: Pred) -> bool + where TagSet: Fn(ExpandedName) -> bool, Pred: Fn(Handle) -> bool + { + for node in self.open_elems.iter().rev() { + if pred(node.clone()) { + return true; + } + if scope(self.sink.elem_name(node)) { + return false; + } + } + + // supposed to be impossible, because <html> is always in scope + + false + } + + fn elem_in<TagSet>(&self, elem: &Handle, set: TagSet) -> bool + where TagSet: Fn(ExpandedName) -> bool + { + set(self.sink.elem_name(elem)) + } + + fn html_elem_named(&self, elem: &Handle, name: LocalName) -> bool { + let expanded = self.sink.elem_name(elem); + *expanded.ns == ns!(html) && *expanded.local == name + } + + fn in_html_elem_named(&self, name: LocalName) -> bool { + self.open_elems.iter().any(|elem| self.html_elem_named(elem, name.clone())) + } + + fn current_node_named(&self, name: LocalName) -> bool { + self.html_elem_named(self.current_node(), name) + } + + fn in_scope_named<TagSet>(&self, scope: TagSet, name: LocalName) -> bool + where TagSet: Fn(ExpandedName) -> bool + { + self.in_scope(scope, |elem| self.html_elem_named(&elem, name.clone())) + } + + //§ closing-elements-that-have-implied-end-tags + fn generate_implied_end<TagSet>(&mut self, set: TagSet) + where TagSet: Fn(ExpandedName) -> bool + { + loop { + { + let elem = unwrap_or_return!(self.open_elems.last(), ()); + let nsname = self.sink.elem_name(elem); + if !set(nsname) { return; } + } + self.pop(); + } + } + + fn generate_implied_end_except(&mut self, except: LocalName) { + self.generate_implied_end(|p| { + if *p.ns == ns!(html) && *p.local == except { + false + } else { + cursory_implied_end(p) + } + }); + } + //§ END + + // Pop elements until the current element is in the set. + fn pop_until_current<TagSet>(&mut self, pred: TagSet) + where TagSet: Fn(ExpandedName) -> bool + { + loop { + if self.current_node_in(|x| pred(x)) { + break; + } + self.open_elems.pop(); + } + } + + // Pop elements until an element from the set has been popped. Returns the + // number of elements popped. + fn pop_until<P>(&mut self, pred: P) -> usize + where P: Fn(ExpandedName) -> bool + { + let mut n = 0; + loop { + n += 1; + match self.open_elems.pop() { + None => break, + Some(elem) => if pred(self.sink.elem_name(&elem)) { break; }, + } + } + n + } + + fn pop_until_named(&mut self, name: LocalName) -> usize { + self.pop_until(|p| *p.ns == ns!(html) && *p.local == name) + } + + // Pop elements until one with the specified name has been popped. + // Signal an error if it was not the first one. + fn expect_to_close(&mut self, name: LocalName) { + if self.pop_until_named(name.clone()) != 1 { + self.sink.parse_error(format_if!(self.opts.exact_errors, + "Unexpected open element", + "Unexpected open element while closing {:?}", name)); + } + } + + fn close_p_element(&mut self) { + declare_tag_set!(implied = [cursory_implied_end] - "p"); + self.generate_implied_end(implied); + self.expect_to_close(local_name!("p")); + } + + fn close_p_element_in_button_scope(&mut self) { + if self.in_scope_named(button_scope, local_name!("p")) { + self.close_p_element(); + } + } + + // Check <input> tags for type=hidden + fn is_type_hidden(&self, tag: &Tag) -> bool { + match tag.attrs.iter().find(|&at| at.name.expanded() == expanded_name!("", "type")) { + None => false, + Some(at) => (&*at.value).eq_ignore_ascii_case("hidden"), + } + } + + fn foster_parent_in_body(&mut self, token: Token) -> ProcessResult<Handle> { + warn!("foster parenting not implemented"); + self.foster_parenting = true; + let res = self.step(InBody, token); + // FIXME: what if res is Reprocess? + self.foster_parenting = false; + res + } + + fn process_chars_in_table(&mut self, token: Token) -> ProcessResult<Handle> { + declare_tag_set!(table_outer = "table" "tbody" "tfoot" "thead" "tr"); + if self.current_node_in(table_outer) { + assert!(self.pending_table_text.is_empty()); + self.orig_mode = Some(self.mode); + Reprocess(InTableText, token) + } else { + self.sink.parse_error(format_if!(self.opts.exact_errors, + "Unexpected characters in table", + "Unexpected characters {} in table", to_escaped_string(&token))); + self.foster_parent_in_body(token) + } + } + + // https://html.spec.whatwg.org/multipage/syntax.html#reset-the-insertion-mode-appropriately + fn reset_insertion_mode(&mut self) -> InsertionMode { + for (i, mut node) in self.open_elems.iter().enumerate().rev() { + let last = i == 0usize; + if let (true, Some(ctx)) = (last, self.context_elem.as_ref()) { + node = ctx; + } + let name = match self.sink.elem_name(node) { + ExpandedName { ns: &ns!(html), local } => local, + _ => continue, + }; + match *name { + local_name!("select") => { + for ancestor in self.open_elems[0..i].iter().rev() { + if self.html_elem_named(ancestor, local_name!("template")) { + return InSelect; + } else if self.html_elem_named(ancestor, local_name!("table")) { + return InSelectInTable; + } + } + return InSelect; + }, + local_name!("td") | local_name!("th") => if !last { return InCell; }, + local_name!("tr") => return InRow, + local_name!("tbody") | local_name!("thead") | local_name!("tfoot") => return InTableBody, + local_name!("caption") => return InCaption, + local_name!("colgroup") => return InColumnGroup, + local_name!("table") => return InTable, + local_name!("template") => return *self.template_modes.last().unwrap(), + local_name!("head") => if !last { return InHead }, + local_name!("body") => return InBody, + local_name!("frameset") => return InFrameset, + local_name!("html") => match self.head_elem { + None => return BeforeHead, + Some(_) => return AfterHead, + }, + + _ => (), + } + } + InBody + } + + fn close_the_cell(&mut self) { + self.generate_implied_end(cursory_implied_end); + if self.pop_until(td_th) != 1 { + self.sink.parse_error(Borrowed("expected to close <td> or <th> with cell")); + } + self.clear_active_formatting_to_marker(); + } + + fn append_text(&mut self, text: StrTendril) -> ProcessResult<Handle> { + self.insert_appropriately(AppendText(text), None); + Done + } + + fn append_comment(&mut self, text: StrTendril) -> ProcessResult<Handle> { + let comment = self.sink.create_comment(text); + self.insert_appropriately(AppendNode(comment), None); + Done + } + + fn append_comment_to_doc(&mut self, text: StrTendril) -> ProcessResult<Handle> { + let comment = self.sink.create_comment(text); + self.sink.append(&self.doc_handle, AppendNode(comment)); + Done + } + + fn append_comment_to_html(&mut self, text: StrTendril) -> ProcessResult<Handle> { + let target = html_elem(&self.open_elems); + let comment = self.sink.create_comment(text); + self.sink.append(target, AppendNode(comment)); + Done + } + + //§ creating-and-inserting-nodes + fn create_root(&mut self, attrs: Vec<Attribute>) { + let elem = create_element( + &mut self.sink, QualName::new(None, ns!(html), local_name!("html")), + attrs); + self.push(&elem); + self.sink.append(&self.doc_handle, AppendNode(elem)); + // FIXME: application cache selection algorithm + } + + // https://html.spec.whatwg.org/multipage/#create-an-element-for-the-token + fn insert_element(&mut self, push: PushFlag, ns: Namespace, name: LocalName, attrs: Vec<Attribute>) + -> Handle { + declare_tag_set!(form_associatable = + "button" "fieldset" "input" "object" + "output" "select" "textarea" "img"); + + declare_tag_set!(listed = [form_associatable] - "img"); + + // Step 7. + let qname = QualName::new(None, ns, name); + let elem = create_element(&mut self.sink, qname.clone(), attrs.clone()); + + let insertion_point = self.appropriate_place_for_insertion(None); + let (node1, node2) = match insertion_point { + LastChild(ref p) | + BeforeSibling(ref p) => (p.clone(), None), + TableFosterParenting { ref element, ref prev_element } => (element.clone(), Some(prev_element.clone())), + }; + + // Step 12. + if form_associatable(qname.expanded()) && + self.form_elem.is_some() && + !self.in_html_elem_named(local_name!("template")) && + !(listed(qname.expanded()) && + attrs.iter().any(|a| a.name.expanded() == expanded_name!("", "form"))) { + + let form = self.form_elem.as_ref().unwrap().clone(); + let node2 = match node2 { + Some(ref n) => Some(n), + None => None, + }; + self.sink.associate_with_form(&elem, &form, (&node1, node2)); + } + + self.insert_at(insertion_point, AppendNode(elem.clone())); + + match push { + Push => self.push(&elem), + NoPush => (), + } + // FIXME: Remove from the stack if we can't append? + elem + } + + fn insert_element_for(&mut self, tag: Tag) -> Handle { + self.insert_element(Push, ns!(html), tag.name, tag.attrs) + } + + fn insert_and_pop_element_for(&mut self, tag: Tag) -> Handle { + self.insert_element(NoPush, ns!(html), tag.name, tag.attrs) + } + + fn insert_phantom(&mut self, name: LocalName) -> Handle { + self.insert_element(Push, ns!(html), name, vec!()) + } + //§ END + + fn create_formatting_element_for(&mut self, tag: Tag) -> Handle { + // FIXME: This really wants unit tests. + let mut first_match = None; + let mut matches = 0usize; + for (i, _, old_tag) in self.active_formatting_end_to_marker() { + if tag.equiv_modulo_attr_order(old_tag) { + first_match = Some(i); + matches += 1; + } + } + + if matches >= 3 { + self.active_formatting.remove(first_match.expect("matches with no index")); + } + + let elem = self.insert_element(Push, ns!(html), tag.name.clone(), tag.attrs.clone()); + self.active_formatting.push(Element(elem.clone(), tag)); + elem + } + + fn clear_active_formatting_to_marker(&mut self) { + loop { + match self.active_formatting.pop() { + None | Some(Marker) => break, + _ => (), + } + } + } + + fn process_end_tag_in_body(&mut self, tag: Tag) { + // Look back for a matching open element. + let mut match_idx = None; + for (i, elem) in self.open_elems.iter().enumerate().rev() { + if self.html_elem_named(elem, tag.name.clone()) { + match_idx = Some(i); + break; + } + + if self.elem_in(elem, special_tag) { + self.sink.parse_error(Borrowed("Found special tag while closing generic tag")); + return; + } + } + + // Can't use unwrap_or_return!() due to rust-lang/rust#16617. + let match_idx = match match_idx { + None => { + // I believe this is impossible, because the root + // <html> element is in special_tag. + self.unexpected(&tag); + return; + } + Some(x) => x, + }; + + self.generate_implied_end_except(tag.name.clone()); + + if match_idx != self.open_elems.len() - 1 { + // mis-nested tags + self.unexpected(&tag); + } + self.open_elems.truncate(match_idx); + } + + fn handle_misnested_a_tags(&mut self, tag: &Tag) { + let node = unwrap_or_return!( + self.active_formatting_end_to_marker() + .filter(|&(_, n, _)| self.html_elem_named(n, local_name!("a"))) + .next() + .map(|(_, n, _)| n.clone()), + + () + ); + + self.unexpected(tag); + self.adoption_agency(local_name!("a")); + self.position_in_active_formatting(&node) + .map(|index| self.active_formatting.remove(index)); + self.remove_from_stack(&node); + } + + //§ tree-construction + fn is_foreign(&mut self, token: &Token) -> bool { + if let EOFToken = *token { + return false; + } + + if self.open_elems.len() == 0 { + return false; + } + + let name = self.sink.elem_name(self.adjusted_current_node()); + if let ns!(html) = *name.ns { + return false; + } + + if mathml_text_integration_point(name) { + match *token { + CharacterTokens(..) | NullCharacterToken => return false, + TagToken(Tag { kind: StartTag, ref name, .. }) + if !matches!(*name, local_name!("mglyph") | local_name!("malignmark")) => return false, + _ => (), + } + } + + if svg_html_integration_point(name) { + match *token { + CharacterTokens(..) | NullCharacterToken => return false, + TagToken(Tag { kind: StartTag, .. }) => return false, + _ => (), + } + } + + if let expanded_name!(mathml "annotation-xml") = name { + match *token { + TagToken(Tag { kind: StartTag, name: local_name!("svg"), .. }) => return false, + CharacterTokens(..) | NullCharacterToken | + TagToken(Tag { kind: StartTag, .. }) => { + return !self.sink.is_mathml_annotation_xml_integration_point( + self.adjusted_current_node()) + } + _ => {} + }; + } + + true + } + //§ END + + fn enter_foreign(&mut self, mut tag: Tag, ns: Namespace) -> ProcessResult<Handle> { + match ns { + ns!(mathml) => self.adjust_mathml_attributes(&mut tag), + ns!(svg) => self.adjust_svg_attributes(&mut tag), + _ => (), + } + self.adjust_foreign_attributes(&mut tag); + + if tag.self_closing { + self.insert_element(NoPush, ns, tag.name, tag.attrs); + DoneAckSelfClosing + } else { + self.insert_element(Push, ns, tag.name, tag.attrs); + Done + } + } + + fn adjust_svg_tag_name(&mut self, tag: &mut Tag) { + let Tag { ref mut name, .. } = *tag; + match *name { + local_name!("altglyph") => *name = local_name!("altGlyph"), + local_name!("altglyphdef") => *name = local_name!("altGlyphDef"), + local_name!("altglyphitem") => *name = local_name!("altGlyphItem"), + local_name!("animatecolor") => *name = local_name!("animateColor"), + local_name!("animatemotion") => *name = local_name!("animateMotion"), + local_name!("animatetransform") => *name = local_name!("animateTransform"), + local_name!("clippath") => *name = local_name!("clipPath"), + local_name!("feblend") => *name = local_name!("feBlend"), + local_name!("fecolormatrix") => *name = local_name!("feColorMatrix"), + local_name!("fecomponenttransfer") => *name = local_name!("feComponentTransfer"), + local_name!("fecomposite") => *name = local_name!("feComposite"), + local_name!("feconvolvematrix") => *name = local_name!("feConvolveMatrix"), + local_name!("fediffuselighting") => *name = local_name!("feDiffuseLighting"), + local_name!("fedisplacementmap") => *name = local_name!("feDisplacementMap"), + local_name!("fedistantlight") => *name = local_name!("feDistantLight"), + local_name!("fedropshadow") => *name = local_name!("feDropShadow"), + local_name!("feflood") => *name = local_name!("feFlood"), + local_name!("fefunca") => *name = local_name!("feFuncA"), + local_name!("fefuncb") => *name = local_name!("feFuncB"), + local_name!("fefuncg") => *name = local_name!("feFuncG"), + local_name!("fefuncr") => *name = local_name!("feFuncR"), + local_name!("fegaussianblur") => *name = local_name!("feGaussianBlur"), + local_name!("feimage") => *name = local_name!("feImage"), + local_name!("femerge") => *name = local_name!("feMerge"), + local_name!("femergenode") => *name = local_name!("feMergeNode"), + local_name!("femorphology") => *name = local_name!("feMorphology"), + local_name!("feoffset") => *name = local_name!("feOffset"), + local_name!("fepointlight") => *name = local_name!("fePointLight"), + local_name!("fespecularlighting") => *name = local_name!("feSpecularLighting"), + local_name!("fespotlight") => *name = local_name!("feSpotLight"), + local_name!("fetile") => *name = local_name!("feTile"), + local_name!("feturbulence") => *name = local_name!("feTurbulence"), + local_name!("foreignobject") => *name = local_name!("foreignObject"), + local_name!("glyphref") => *name = local_name!("glyphRef"), + local_name!("lineargradient") => *name = local_name!("linearGradient"), + local_name!("radialgradient") => *name = local_name!("radialGradient"), + local_name!("textpath") => *name = local_name!("textPath"), + _ => (), + } + } + + fn adjust_attributes<F>(&mut self, tag: &mut Tag, mut map: F) + where F: FnMut(LocalName) -> Option<QualName>, + { + for &mut Attribute { ref mut name, .. } in &mut tag.attrs { + if let Some(replacement) = map(name.local.clone()) { + *name = replacement; + } + } + } + + fn adjust_svg_attributes(&mut self, tag: &mut Tag) { + self.adjust_attributes(tag, |k| match k { + local_name!("attributename") => Some(qualname!("", "attributeName")), + local_name!("attributetype") => Some(qualname!("", "attributeType")), + local_name!("basefrequency") => Some(qualname!("", "baseFrequency")), + local_name!("baseprofile") => Some(qualname!("", "baseProfile")), + local_name!("calcmode") => Some(qualname!("", "calcMode")), + local_name!("clippathunits") => Some(qualname!("", "clipPathUnits")), + local_name!("diffuseconstant") => Some(qualname!("", "diffuseConstant")), + local_name!("edgemode") => Some(qualname!("", "edgeMode")), + local_name!("filterunits") => Some(qualname!("", "filterUnits")), + local_name!("glyphref") => Some(qualname!("", "glyphRef")), + local_name!("gradienttransform") => Some(qualname!("", "gradientTransform")), + local_name!("gradientunits") => Some(qualname!("", "gradientUnits")), + local_name!("kernelmatrix") => Some(qualname!("", "kernelMatrix")), + local_name!("kernelunitlength") => Some(qualname!("", "kernelUnitLength")), + local_name!("keypoints") => Some(qualname!("", "keyPoints")), + local_name!("keysplines") => Some(qualname!("", "keySplines")), + local_name!("keytimes") => Some(qualname!("", "keyTimes")), + local_name!("lengthadjust") => Some(qualname!("", "lengthAdjust")), + local_name!("limitingconeangle") => Some(qualname!("", "limitingConeAngle")), + local_name!("markerheight") => Some(qualname!("", "markerHeight")), + local_name!("markerunits") => Some(qualname!("", "markerUnits")), + local_name!("markerwidth") => Some(qualname!("", "markerWidth")), + local_name!("maskcontentunits") => Some(qualname!("", "maskContentUnits")), + local_name!("maskunits") => Some(qualname!("", "maskUnits")), + local_name!("numoctaves") => Some(qualname!("", "numOctaves")), + local_name!("pathlength") => Some(qualname!("", "pathLength")), + local_name!("patterncontentunits") => Some(qualname!("", "patternContentUnits")), + local_name!("patterntransform") => Some(qualname!("", "patternTransform")), + local_name!("patternunits") => Some(qualname!("", "patternUnits")), + local_name!("pointsatx") => Some(qualname!("", "pointsAtX")), + local_name!("pointsaty") => Some(qualname!("", "pointsAtY")), + local_name!("pointsatz") => Some(qualname!("", "pointsAtZ")), + local_name!("preservealpha") => Some(qualname!("", "preserveAlpha")), + local_name!("preserveaspectratio") => Some(qualname!("", "preserveAspectRatio")), + local_name!("primitiveunits") => Some(qualname!("", "primitiveUnits")), + local_name!("refx") => Some(qualname!("", "refX")), + local_name!("refy") => Some(qualname!("", "refY")), + local_name!("repeatcount") => Some(qualname!("", "repeatCount")), + local_name!("repeatdur") => Some(qualname!("", "repeatDur")), + local_name!("requiredextensions") => Some(qualname!("", "requiredExtensions")), + local_name!("requiredfeatures") => Some(qualname!("", "requiredFeatures")), + local_name!("specularconstant") => Some(qualname!("", "specularConstant")), + local_name!("specularexponent") => Some(qualname!("", "specularExponent")), + local_name!("spreadmethod") => Some(qualname!("", "spreadMethod")), + local_name!("startoffset") => Some(qualname!("", "startOffset")), + local_name!("stddeviation") => Some(qualname!("", "stdDeviation")), + local_name!("stitchtiles") => Some(qualname!("", "stitchTiles")), + local_name!("surfacescale") => Some(qualname!("", "surfaceScale")), + local_name!("systemlanguage") => Some(qualname!("", "systemLanguage")), + local_name!("tablevalues") => Some(qualname!("", "tableValues")), + local_name!("targetx") => Some(qualname!("", "targetX")), + local_name!("targety") => Some(qualname!("", "targetY")), + local_name!("textlength") => Some(qualname!("", "textLength")), + local_name!("viewbox") => Some(qualname!("", "viewBox")), + local_name!("viewtarget") => Some(qualname!("", "viewTarget")), + local_name!("xchannelselector") => Some(qualname!("", "xChannelSelector")), + local_name!("ychannelselector") => Some(qualname!("", "yChannelSelector")), + local_name!("zoomandpan") => Some(qualname!("", "zoomAndPan")), + _ => None, + }); + } + + fn adjust_mathml_attributes(&mut self, tag: &mut Tag) { + self.adjust_attributes(tag, |k| match k { + local_name!("definitionurl") => Some(qualname!("", "definitionURL")), + _ => None, + }); + } + + fn adjust_foreign_attributes(&mut self, tag: &mut Tag) { + self.adjust_attributes(tag, |k| match k { + local_name!("xlink:actuate") => Some(qualname!("xlink" xlink "actuate")), + local_name!("xlink:arcrole") => Some(qualname!("xlink" xlink "arcrole")), + local_name!("xlink:href") => Some(qualname!("xlink" xlink "href")), + local_name!("xlink:role") => Some(qualname!("xlink" xlink "role")), + local_name!("xlink:show") => Some(qualname!("xlink" xlink "show")), + local_name!("xlink:title") => Some(qualname!("xlink" xlink "title")), + local_name!("xlink:type") => Some(qualname!("xlink" xlink "type")), + local_name!("xml:base") => Some(qualname!("xml" xml "base")), + local_name!("xml:lang") => Some(qualname!("xml" xml "lang")), + local_name!("xml:space") => Some(qualname!("xml" xml "space")), + local_name!("xmlns") => Some(qualname!("" xmlns "xmlns")), + local_name!("xmlns:xlink") => Some(qualname!("xmlns" xmlns "xlink")), + _ => None, + }); + } + + fn foreign_start_tag(&mut self, mut tag: Tag) -> ProcessResult<Handle> { + let current_ns = self.sink.elem_name(self.adjusted_current_node()).ns.clone(); + match current_ns { + ns!(mathml) => self.adjust_mathml_attributes(&mut tag), + ns!(svg) => { + self.adjust_svg_tag_name(&mut tag); + self.adjust_svg_attributes(&mut tag); + } + _ => (), + } + self.adjust_foreign_attributes(&mut tag); + if tag.self_closing { + // FIXME(#118): <script /> in SVG + self.insert_element(NoPush, current_ns, tag.name, tag.attrs); + DoneAckSelfClosing + } else { + self.insert_element(Push, current_ns, tag.name, tag.attrs); + Done + } + } + + fn unexpected_start_tag_in_foreign_content(&mut self, tag: Tag) -> ProcessResult<Handle> { + self.unexpected(&tag); + if self.is_fragment() { + self.foreign_start_tag(tag) + } else { + self.pop(); + while !self.current_node_in(|n| { + *n.ns == ns!(html) || + mathml_text_integration_point(n) || + svg_html_integration_point(n) + }) { + self.pop(); + } + ReprocessForeign(TagToken(tag)) + } + } +} + #[cfg(test)] #[allow(non_snake_case)] mod test { @@ -494,8 +1557,6 @@ mod test { use markup5ever::interface::{TreeSink, Tracer, ElementFlags}; use super::types::*; - use super::actions::TreeBuilderActions; - use super::rules::TreeBuilderStep; use ExpandedName; use QualName; @@ -585,6 +1646,14 @@ mod test { self.rcdom.append_before_sibling(sibling, child) } + fn append_based_on_parent_node( + &mut self, + element: &Handle, + prev_element: &Handle, + child: NodeOrText<Handle>) { + self.rcdom.append_based_on_parent_node(element, prev_element, child) + } + fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril, diff --git a/src/vendor/html5ever/src/tree_builder/rules.rs b/src/vendor/html5ever/src/tree_builder/rules.rs index aedc8d5095..5b5b8bc425 100644 --- a/src/vendor/html5ever/src/tree_builder/rules.rs +++ b/src/vendor/html5ever/src/tree_builder/rules.rs @@ -9,40 +9,25 @@ // The tree builder rules, as a single, enormous nested match expression. -use {ExpandedName, QualName}; -use interface::{Attribute, TreeSink, Quirks, AppendNode, create_element}; use tree_builder::types::*; use tree_builder::tag_sets::*; -use tree_builder::actions::{NoPush, Push, TreeBuilderActions, html_elem}; -use tokenizer::{EndTag, StartTag, Tag}; use tokenizer::states::{Rcdata, Rawtext, ScriptData, Plaintext}; -use util::str::is_ascii_whitespace; -use std::ascii::AsciiExt; -use std::mem::replace; -use std::borrow::Cow::Borrowed; use std::borrow::ToOwned; -use tendril::{StrTendril, SliceExt}; +use tendril::SliceExt; fn any_not_whitespace(x: &StrTendril) -> bool { // FIXME: this might be much faster as a byte scan x.chars().any(|c| !is_ascii_whitespace(c)) } -// This goes in a trait so that we can control visibility. -pub trait TreeBuilderStep<Handle> { - fn step(&mut self, mode: InsertionMode, token: Token) -> ProcessResult<Handle>; - fn step_foreign(&mut self, token: Token) -> ProcessResult<Handle>; -} - fn current_node<Handle>(open_elems: &[Handle]) -> &Handle { open_elems.last().expect("no current element") } #[doc(hidden)] -impl<Handle, Sink> TreeBuilderStep<Handle> - for super::TreeBuilder<Handle, Sink> +impl<Handle, Sink> TreeBuilder<Handle, Sink> where Handle: Clone, Sink: TreeSink<Handle=Handle>, { diff --git a/src/vendor/html5ever/src/tree_builder/types.rs b/src/vendor/html5ever/src/tree_builder/types.rs index c88afcb731..1192472cb9 100644 --- a/src/vendor/html5ever/src/tree_builder/types.rs +++ b/src/vendor/html5ever/src/tree_builder/types.rs @@ -86,5 +86,7 @@ pub enum InsertionPoint<Handle> { /// Insert as last child in this parent. LastChild(Handle), /// Insert before this following sibling. - BeforeSibling(Handle) + BeforeSibling(Handle), + /// Insertion point is decided based on existence of element's parent node. + TableFosterParenting { element: Handle, prev_element: Handle }, } diff --git a/src/vendor/html5ever/tests/serializer.rs b/src/vendor/html5ever/tests/serializer.rs index 338042d884..706feb1971 100644 --- a/src/vendor/html5ever/tests/serializer.rs +++ b/src/vendor/html5ever/tests/serializer.rs @@ -15,6 +15,84 @@ use html5ever::{parse_fragment, parse_document, serialize, QualName}; use html5ever::driver::ParseOpts; use html5ever::rcdom::RcDom; use html5ever::tendril::{StrTendril, SliceExt, TendrilSink}; +use html5ever::tokenizer::{Token, TokenSink, TokenSinkResult, TagKind, Tokenizer}; +use html5ever::serialize::{Serialize, Serializer, TraversalScope, SerializeOpts}; + +use std::io; + +struct Tokens(Vec<Token>); + +impl TokenSink for Tokens { + type Handle = (); + + fn process_token(&mut self, token: Token, _: u64) -> TokenSinkResult<()> { + self.0.push(token); + TokenSinkResult::Continue + } +} + +impl Serialize for Tokens { + fn serialize<S>(&self, serializer: &mut S, _: TraversalScope) -> io::Result<()> + where + S: Serializer, + { + for t in self.0.iter() { + match t { // TODO: check whether this is an IE conditional comment or a spec comment + &Token::TagToken(ref tag) => { + let name = QualName::new( + None, + "http://www.w3.org/1999/xhtml".into(), + tag.name.as_ref().into(), + ); + match tag.kind { + TagKind::StartTag => { + serializer.start_elem( + name, + tag.attrs.iter().map( + |at| (&at.name, &at.value[..]), + ), + )? + } + TagKind::EndTag => serializer.end_elem(name)?, + } + } + &Token::DoctypeToken(ref dt) => { + match dt.name { + Some(ref name) => serializer.write_doctype(&name)?, + None => {} + } + } + &Token::CommentToken(ref chars) => serializer.write_comment(&chars)?, + &Token::CharacterTokens(ref chars) => serializer.write_text(&chars)?, + &Token::NullCharacterToken | + &Token::EOFToken => {} + &Token::ParseError(ref e) => println!("parse error: {:#?}", e), + } + } + Ok(()) + } +} + +fn tokenize_and_serialize(input: StrTendril) -> StrTendril { + let mut input = { + let mut q = ::html5ever::tokenizer::BufferQueue::new(); + q.push_front(input.into()); + q + }; + let mut tokenizer = Tokenizer::new(Tokens(vec![]), Default::default()); + tokenizer.feed(&mut input); + tokenizer.end(); + let mut output = ::std::io::Cursor::new(vec![]); + serialize( + &mut output, + &tokenizer.sink, + SerializeOpts { + create_missing_parent: true, + ..Default::default() + }, + ).unwrap(); + StrTendril::try_from_byte_slice(&output.into_inner()).unwrap() +} fn parse_and_serialize(input: StrTendril) -> StrTendril { let dom = parse_fragment( @@ -28,20 +106,34 @@ fn parse_and_serialize(input: StrTendril) -> StrTendril { StrTendril::try_from_byte_slice(&result).unwrap() } -macro_rules! test { - ($name:ident, $input:expr, $output:expr) => { +macro_rules! test_fn { + ($f:ident, $name:ident, $input:expr, $output:expr) => { #[test] fn $name() { - assert_eq!($output, &*parse_and_serialize($input.to_tendril())); + assert_eq!($output, &*$f($input.to_tendril())); } }; // Shorthand for $output = $input - ($name:ident, $input:expr) => { - test!($name, $input, $input); + ($f:ident, $name:ident, $input:expr) => { + test_fn!($f, $name, $input, $input); }; } +macro_rules! test { + ($($t:tt)*) => { + test_fn!(parse_and_serialize, $($t)*); + }; +} + +macro_rules! test_no_parse { + ($($t:tt)*) => { + test_fn!(tokenize_and_serialize, $($t)*); + }; +} + + + test!(empty, r#""#); test!(smoke_test, r#"<p><i>Hello</i>, World!</p>"#); @@ -73,15 +165,15 @@ test!(noframes_literal, r#"<noframes>(x & 1) < 2; y > "foo" + 'bar'</noframes>"# test!(pre_lf_0, "<pre>foo bar</pre>"); test!(pre_lf_1, "<pre>\nfoo bar</pre>", "<pre>foo bar</pre>"); -test!(pre_lf_2, "<pre>\n\nfoo bar</pre>"); +test!(pre_lf_2, "<pre>\n\nfoo bar</pre>", "<pre>\nfoo bar</pre>"); test!(textarea_lf_0, "<textarea>foo bar</textarea>"); test!(textarea_lf_1, "<textarea>\nfoo bar</textarea>", "<textarea>foo bar</textarea>"); -test!(textarea_lf_2, "<textarea>\n\nfoo bar</textarea>"); +test!(textarea_lf_2, "<textarea>\n\nfoo bar</textarea>", "<textarea>\nfoo bar</textarea>"); test!(listing_lf_0, "<listing>foo bar</listing>"); test!(listing_lf_1, "<listing>\nfoo bar</listing>", "<listing>foo bar</listing>"); -test!(listing_lf_2, "<listing>\n\nfoo bar</listing>"); +test!(listing_lf_2, "<listing>\n\nfoo bar</listing>", "<listing>\nfoo bar</listing>"); test!(comment_1, r#"<p>hi <!--world--></p>"#); test!(comment_2, r#"<p>hi <!-- world--></p>"#); @@ -96,6 +188,8 @@ test!(attr_ns_2, r#"<svg xmlns:foo="bleh"></svg>"#); test!(attr_ns_3, r#"<svg xmlns:xlink="bleh"></svg>"#); test!(attr_ns_4, r#"<svg xlink:href="bleh"></svg>"#); +test_no_parse!(malformed_tokens, r#"foo</div><div>"#); + #[test] fn doctype() { let dom = parse_document( diff --git a/src/vendor/html5ever/tests/tokenizer.rs b/src/vendor/html5ever/tests/tokenizer.rs index cfe99dd12d..4bef8a0e16 100644 --- a/src/vendor/html5ever/tests/tokenizer.rs +++ b/src/vendor/html5ever/tests/tokenizer.rs @@ -20,7 +20,6 @@ use std::mem::replace; use std::default::Default; use std::path::Path; use test::{TestDesc, TestDescAndFn, DynTestName, DynTestFn}; -use test::ShouldPanic::No; use rustc_serialize::json::Json; use std::collections::BTreeMap; use std::borrow::Cow::Borrowed; @@ -314,11 +313,7 @@ fn unescape_json(js: &Json) -> Json { fn mk_test(desc: String, input: String, expect: Json, opts: TokenizerOpts) -> TestDescAndFn { TestDescAndFn { - desc: TestDesc { - name: DynTestName(desc), - ignore: false, - should_panic: No, - }, + desc: TestDesc::new(DynTestName(desc)), testfn: DynTestFn(Box::new(move || { // Split up the input at different points to test incremental tokenization. let insplits = splits(&input, 3); diff --git a/src/vendor/html5ever/tests/tree_builder.rs b/src/vendor/html5ever/tests/tree_builder.rs index 7539b82029..dcfb79119f 100644 --- a/src/vendor/html5ever/tests/tree_builder.rs +++ b/src/vendor/html5ever/tests/tree_builder.rs @@ -22,7 +22,6 @@ use std::default::Default; use std::path::Path; use std::collections::{HashSet, HashMap}; use test::{TestDesc, TestDescAndFn, DynTestName, TestFn}; -use test::ShouldPanic::No; use html5ever::{LocalName, QualName}; use html5ever::{ParseOpts, parse_document, parse_fragment}; @@ -199,9 +198,8 @@ fn make_test_desc_with_scripting_flag( TestDescAndFn { desc: TestDesc { - name: DynTestName(name), ignore: ignore, - should_panic: No, + .. TestDesc::new(DynTestName(name)) }, testfn: TestFn::dyn_test_fn(move || { // Do this here because Tendril isn't Send. diff --git a/src/vendor/kuchiki/.cargo-checksum.json b/src/vendor/kuchiki/.cargo-checksum.json index 8aff5fda2e..a1e5041525 100644 --- a/src/vendor/kuchiki/.cargo-checksum.json +++ b/src/vendor/kuchiki/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"a264f8d660cfb857f234139e79b8da7797608656c7e88f9786ecf6e312a745aa",".travis.yml":"96358cfe855b70bc211725a1144973b737196fd39783b6b46f7ac91b1e0be8ac","Cargo.toml":"b87501d59b32727be8ec1c4ab214854d79529e2fe1e2ebf86f985234802e4ef7","Cargo.toml.orig":"78067e148b21602d9360aee8d4dfa592391d631e002ecdc98bebabb2253768c9","README.md":"2600915662f99776522619e7bfa26bcad2f1300cbfd0cce479d7d523590471ec","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"4dec55355aa947d58b06182ba3e92abf2a3b9412fbc2dfa4b64616d6c3b63db8","docs/index.html":"4dec55355aa947d58b06182ba3e92abf2a3b9412fbc2dfa4b64616d6c3b63db8","examples/find_matches.rs":"aae6b5fa119f7e515597ac3a3b2a0ddb5970433691e3540839052bd4ff21d7c9","examples/stack-overflow.rs":"1b22905e878e9461caed92561e7566390cf85ad31982bfe5b845b1bf4d95e855","src/attributes.rs":"1f3b84ef1be9c5177c033a38be2f3f14cc0fef7bb625cc2fbd9cb87d25588982","src/iter.rs":"6e4a1d956d76f7dab06781b3844623405ca86518fc518b7ce8d883ae79bf4d47","src/lib.rs":"1445e6061414049070ffb7975bd878c9998791b99e7349bdae08a30207405d4a","src/move_cell.rs":"b2178a5fe2f3cbd4423d1065dafc8d362ce85b3f1ef9361dadb9591c8954b2cd","src/node_data_ref.rs":"9891761474f305134a0ba84e062505f0c6748b6cb804ce63574a517d2615a1d5","src/parser.rs":"622d620309badac634972b16f01740fd9eb2dfe01178782bbb38b4d3b27a9d4f","src/select.rs":"0595a90d030e30e0b3a4646dccdf5d23d065295ab4c06343594dfb31dd961fda","src/serializer.rs":"5e14efe52e03583b206a8dc93d232f296b18e623cead6805d8cbe28032501c59","src/tests.rs":"855f2d8666f68b445972e5e394a8a00a379eaf5c5a983930e89c0ff743c3015b","src/tree.rs":"83770c14a1fc02097bc63d6ab2e1f8787d9994075d4918bf9a6407f03dda2c40","test_data/foo.html":"c0e67d8138acefda54d4594e426d7a804c5309d0c6da49a6902791aa279307c7"},"package":"ef2ea4f2f7883cd7c6772b06c14abca01a2cc1f75c426cebffcf6b3b925ef9fc"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"a264f8d660cfb857f234139e79b8da7797608656c7e88f9786ecf6e312a745aa",".travis.yml":"96358cfe855b70bc211725a1144973b737196fd39783b6b46f7ac91b1e0be8ac","Cargo.toml":"7c7e3d178b79dd43b45fc195e80d63341f19c38c119311cfbc51a8a4645dc860","Cargo.toml.orig":"b40cb5d5cff038f860eb6057b6570938b9b862ffbcc6a0bca5a2af62512df215","README.md":"2600915662f99776522619e7bfa26bcad2f1300cbfd0cce479d7d523590471ec","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"4dec55355aa947d58b06182ba3e92abf2a3b9412fbc2dfa4b64616d6c3b63db8","docs/index.html":"4dec55355aa947d58b06182ba3e92abf2a3b9412fbc2dfa4b64616d6c3b63db8","examples/find_matches.rs":"aae6b5fa119f7e515597ac3a3b2a0ddb5970433691e3540839052bd4ff21d7c9","examples/stack-overflow.rs":"1b22905e878e9461caed92561e7566390cf85ad31982bfe5b845b1bf4d95e855","src/attributes.rs":"1f3b84ef1be9c5177c033a38be2f3f14cc0fef7bb625cc2fbd9cb87d25588982","src/iter.rs":"abeca23064ce2b1ec229f2704a2ac1f57f37d6bd43b4d9dd116ba753ba5fb723","src/lib.rs":"1445e6061414049070ffb7975bd878c9998791b99e7349bdae08a30207405d4a","src/move_cell.rs":"b2178a5fe2f3cbd4423d1065dafc8d362ce85b3f1ef9361dadb9591c8954b2cd","src/node_data_ref.rs":"9891761474f305134a0ba84e062505f0c6748b6cb804ce63574a517d2615a1d5","src/parser.rs":"447c31bac044d454afd0f0139520fd8cd4671fb78a1e2656539db1e6a6cb2e02","src/select.rs":"0595a90d030e30e0b3a4646dccdf5d23d065295ab4c06343594dfb31dd961fda","src/serializer.rs":"2243dbdbb3ae0750be01208d856dba2861c3083a9abf60eafc19c05af5604a3e","src/tests.rs":"cc8548360c7ca5bee396a2d3fe4f42c67362aa48411b754c2df789376491664e","src/tree.rs":"83770c14a1fc02097bc63d6ab2e1f8787d9994075d4918bf9a6407f03dda2c40","test_data/foo.html":"c0e67d8138acefda54d4594e426d7a804c5309d0c6da49a6902791aa279307c7"},"package":"e03098e8e719c92b7794515dfd5c1724e2b12f5ce1788e61cfa4663f82eba8d8"} \ No newline at end of file diff --git a/src/vendor/kuchiki/Cargo.toml b/src/vendor/kuchiki/Cargo.toml index 2f88fffe58..92f20d4f42 100644 --- a/src/vendor/kuchiki/Cargo.toml +++ b/src/vendor/kuchiki/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "kuchiki" -version = "0.5.1" +version = "0.6.0" authors = ["Simon Sapin <simon.sapin@exyr.org>"] description = "(朽木) HTML/XML tree manipulation library" license = "MIT" @@ -21,16 +21,16 @@ repository = "https://github.com/SimonSapin/kuchiki" [lib] name = "kuchiki" doctest = false -[dependencies.selectors] -version = "0.18" - [dependencies.matches] version = "0.1.4" -[dependencies.html5ever] -version = "0.18" - [dependencies.cssparser] version = "0.13" + +[dependencies.html5ever] +version = "0.20" + +[dependencies.selectors] +version = "0.18" [dev-dependencies.tempdir] version = "0.3" diff --git a/src/vendor/kuchiki/Cargo.toml.orig b/src/vendor/kuchiki/Cargo.toml.orig index 0175573124..07b0a86e0f 100644 --- a/src/vendor/kuchiki/Cargo.toml.orig +++ b/src/vendor/kuchiki/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "kuchiki" -version = "0.5.1" +version = "0.6.0" authors = ["Simon Sapin <simon.sapin@exyr.org>"] license = "MIT" description = "(朽木) HTML/XML tree manipulation library" @@ -13,7 +13,7 @@ doctest = false [dependencies] cssparser = "0.13" matches = "0.1.4" -html5ever = "0.18" +html5ever = "0.20" selectors = "0.18" [dev-dependencies] diff --git a/src/vendor/kuchiki/src/iter.rs b/src/vendor/kuchiki/src/iter.rs index 3aac1688b2..473cf22a9f 100644 --- a/src/vendor/kuchiki/src/iter.rs +++ b/src/vendor/kuchiki/src/iter.rs @@ -140,6 +140,13 @@ impl NodeRef { pub fn select(&self, selectors: &str) -> Result<Select<Elements<Descendants>>, ()> { self.inclusive_descendants().select(selectors) } + + /// Return the first inclusive descendants element that match the given selector list. + #[inline] + pub fn select_first(&self, selectors: &str) -> Result<NodeDataRef<ElementData>, ()> { + let mut elements = self.select(selectors)?; + elements.next().ok_or(()) + } } diff --git a/src/vendor/kuchiki/src/parser.rs b/src/vendor/kuchiki/src/parser.rs index 1e97febb85..b3bd6214ed 100644 --- a/src/vendor/kuchiki/src/parser.rs +++ b/src/vendor/kuchiki/src/parser.rs @@ -167,4 +167,13 @@ impl TreeSink for Sink { fn get_template_contents(&mut self, target: &NodeRef) -> NodeRef { target.as_element().unwrap().template_contents.clone().unwrap() } + + fn append_based_on_parent_node(&mut self, element: &NodeRef, + prev_element: &NodeRef, child: NodeOrText<NodeRef>) { + if self.has_parent_node(element) { + self.append_before_sibling(element, child) + } else { + self.append(prev_element, child) + } + } } diff --git a/src/vendor/kuchiki/src/serializer.rs b/src/vendor/kuchiki/src/serializer.rs index f89ce1be4d..544208b782 100644 --- a/src/vendor/kuchiki/src/serializer.rs +++ b/src/vendor/kuchiki/src/serializer.rs @@ -12,8 +12,8 @@ impl Serialize for NodeRef { fn serialize<S: Serializer>(&self, serializer: &mut S, traversal_scope: TraversalScope) -> Result<()> { match (traversal_scope, self.data()) { - (_, &NodeData::Element(ref element)) => { - if traversal_scope == IncludeNode { + (ref scope, &NodeData::Element(ref element)) => { + if *scope == IncludeNode { try!(serializer.start_elem( element.name.clone(), element.attributes.borrow().map.iter().map(|(name, value)| (name, &**value)))); @@ -23,7 +23,7 @@ impl Serialize for NodeRef { try!(Serialize::serialize(&child, serializer, IncludeNode)); } - if traversal_scope == IncludeNode { + if *scope == IncludeNode { try!(serializer.end_elem(element.name.clone())); } Ok(()) @@ -37,7 +37,7 @@ impl Serialize for NodeRef { Ok(()) } - (ChildrenOnly, _) => Ok(()), + (ChildrenOnly(_), _) => Ok(()), (IncludeNode, &NodeData::Doctype(ref doctype)) => serializer.write_doctype(&doctype.name), (IncludeNode, &NodeData::Text(ref text)) => serializer.write_text(&text.borrow()), diff --git a/src/vendor/kuchiki/src/tests.rs b/src/vendor/kuchiki/src/tests.rs index b6fd0c51a1..38b17bd422 100644 --- a/src/vendor/kuchiki/src/tests.rs +++ b/src/vendor/kuchiki/src/tests.rs @@ -92,6 +92,25 @@ fn select() { assert_eq!(matching[0].attributes.borrow().get(local_name!("class")), Some("foo")); } +#[test] +fn select_first() { + let html = r" +<title>Test case +

Foo +

Bar +

-i     case-insensitive
+i     case-insensitive: letters match both upper and lower case
 m     multi-line mode: ^ and $ match begin/end of line
 s     allow . to match \n
 U     swap the meaning of x* and x*?
@@ -382,8 +382,8 @@ u     Unicode support (enabled by default)
 x     ignore whitespace and allow line comments (starting with `#`)
 
-Here's an example that matches case-insensitively for only part of the -expression: +Flags can be toggled within a pattern. Here's an example that matches +case-insensitively for the first part but case-sensitively for the second part: ```rust # extern crate regex; use regex::Regex; @@ -397,6 +397,25 @@ assert_eq!(&cap[0], "AaAaAbb"); Notice that the `a+` matches either `a` or `A`, but the `b+` only matches `b`. +Multi-line mode means `^` and `$` no longer match just at the beginning/end of +the input, but at the beginning/end of lines: + +``` +# use regex::Regex; +let re = Regex::new(r"(?m)^line \d+").unwrap(); +let m = re.find("line one\nline 2\n").unwrap(); +assert_eq!(m.as_str(), "line 2"); +``` + +Note that `^` matches after new lines, even at the end of input: + +``` +# use regex::Regex; +let re = Regex::new(r"(?m)^").unwrap(); +let m = re.find_iter("test\n").last().unwrap(); +assert_eq!((m.start(), m.end()), (5, 5)); +``` + Here is an example that uses an ASCII word boundary instead of a Unicode word boundary: diff --git a/src/vendor/regex/src/literals.rs b/src/vendor/regex/src/literals.rs index 0dae0a6d4f..557d1b67a9 100644 --- a/src/vendor/regex/src/literals.rs +++ b/src/vendor/regex/src/literals.rs @@ -92,7 +92,7 @@ impl LiteralSearcher { /// is comprised of a single complete literal `a`, but the regular /// expression demands that it only match at the beginning of a string. pub fn complete(&self) -> bool { - self.complete && self.len() > 0 + self.complete && !self.is_empty() } /// Find the position of a literal in `haystack` if it exists. @@ -189,12 +189,12 @@ impl LiteralSearcher { impl Matcher { fn prefixes(lits: &syntax::Literals) -> Self { - let sset = SingleByteSet::prefixes(&lits); + let sset = SingleByteSet::prefixes(lits); Matcher::new(lits, sset) } fn suffixes(lits: &syntax::Literals) -> Self { - let sset = SingleByteSet::suffixes(&lits); + let sset = SingleByteSet::suffixes(lits); Matcher::new(lits, sset) } @@ -500,7 +500,7 @@ impl SingleSearch { if text.len() < self.len() { return false; } - &text[text.len() - self.len()..] == &*self.pat + text[text.len() - self.len()..] == *self.pat } pub fn len(&self) -> usize { diff --git a/src/vendor/regex/src/pikevm.rs b/src/vendor/regex/src/pikevm.rs index b96f0e7588..80d44717ae 100644 --- a/src/vendor/regex/src/pikevm.rs +++ b/src/vendor/regex/src/pikevm.rs @@ -109,7 +109,7 @@ impl<'r, I: Input> Fsm<'r, I> { start: usize, ) -> bool { let mut cache = cache.borrow_mut(); - let mut cache = &mut cache.pikevm; + let cache = &mut cache.pikevm; cache.clist.resize(prog.len(), prog.captures.len()); cache.nlist.resize(prog.len(), prog.captures.len()); let at = input.at(start); @@ -341,7 +341,7 @@ impl<'r, I: Input> Fsm<'r, I> { ip = inst.goto1; } Match(_) | Char(_) | Ranges(_) | Bytes(_) => { - let mut t = &mut nlist.caps(ip); + let t = &mut nlist.caps(ip); for (slot, val) in t.iter_mut().zip(thread_caps.iter()) { *slot = *val; } diff --git a/src/vendor/regex/src/prog.rs b/src/vendor/regex/src/prog.rs index 36f2aff879..6ae49f6a12 100644 --- a/src/vendor/regex/src/prog.rs +++ b/src/vendor/regex/src/prog.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use input::Char; use literals::LiteralSearcher; -/// InstPtr represents the index of an instruction in a regex program. +/// `InstPtr` represents the index of an instruction in a regex program. pub type InstPtr = usize; /// Program is a sequence of instructions and various facts about thos @@ -213,9 +213,8 @@ impl fmt::Debug for Program { .map(|r| format!("{:?}-{:?}", r.0, r.1)) .collect::>() .join(", "); - let s = format!("{}", ranges); try!(write!(f, "{:04} {}", - pc, with_goto(pc, inst.goto, s))); + pc, with_goto(pc, inst.goto, ranges))); } Bytes(ref inst) => { let s = format!( @@ -320,7 +319,7 @@ pub struct InstSplit { pub goto2: InstPtr, } -/// Representation of the EmptyLook instruction. +/// Representation of the `EmptyLook` instruction. #[derive(Clone, Debug)] pub struct InstEmptyLook { /// The next location to execute in the program if this instruction diff --git a/src/vendor/regex/src/re_builder.rs b/src/vendor/regex/src/re_builder.rs index 12b2515649..56dac2704e 100644 --- a/src/vendor/regex/src/re_builder.rs +++ b/src/vendor/regex/src/re_builder.rs @@ -59,7 +59,7 @@ impl RegexBuilder { /// Create a new regular expression builder with the given pattern. /// /// If the pattern is invalid, then an error will be returned when - /// `compile` is called. + /// `build` is called. pub fn new(pattern: &str) -> RegexBuilder { let mut builder = RegexBuilder(RegexOptions::default()); builder.0.pats.push(pattern.to_owned()); @@ -79,12 +79,20 @@ impl RegexBuilder { } /// Set the value for the case insensitive (`i`) flag. + /// + /// When enabled, letters in the pattern will match both upper case and + /// lower case variants. pub fn case_insensitive(&mut self, yes: bool) -> &mut RegexBuilder { self.0.case_insensitive = yes; self } /// Set the value for the multi-line matching (`m`) flag. + /// + /// When enabled, `^` matches the beginning of lines and `$` matches the + /// end of lines. + /// + /// By default, they match beginning/end of the input. pub fn multi_line(&mut self, yes: bool) -> &mut RegexBuilder { self.0.multi_line = yes; self @@ -103,18 +111,30 @@ impl RegexBuilder { } /// Set the value for the greedy swap (`U`) flag. + /// + /// When enabled, a pattern like `a*` is lazy (tries to find shortest + /// match) and `a*?` is greedy (tries to find longest match). + /// + /// By default, `a*` is greedy and `a*?` is lazy. pub fn swap_greed(&mut self, yes: bool) -> &mut RegexBuilder { self.0.swap_greed = yes; self } /// Set the value for the ignore whitespace (`x`) flag. + /// + /// When enabled, whitespace such as new lines and spaces will be ignored + /// between expressions of the pattern, and `#` can be used to start a + /// comment until the next new line. pub fn ignore_whitespace(&mut self, yes: bool) -> &mut RegexBuilder { self.0.ignore_whitespace = yes; self } /// Set the value for the Unicode (`u`) flag. + /// + /// Enabled by default. When disabled, character classes such as `\w` only + /// match ASCII word characters instead of all Unicode word characters. pub fn unicode(&mut self, yes: bool) -> &mut RegexBuilder { self.0.unicode = yes; self @@ -137,7 +157,7 @@ impl RegexBuilder { /// /// Note that this is a *per thread* limit. There is no way to set a global /// limit. In particular, if a regex is used from multiple threads - /// simulanteously, then each thread may use up to the number of bytes + /// simultaneously, then each thread may use up to the number of bytes /// specified here. pub fn dfa_size_limit(&mut self, limit: usize) -> &mut RegexBuilder { self.0.dfa_size_limit = limit; @@ -171,7 +191,7 @@ impl RegexSetBuilder { /// Create a new regular expression builder with the given pattern. /// /// If the pattern is invalid, then an error will be returned when - /// `compile` is called. + /// `build` is called. pub fn new(patterns: I) -> RegexSetBuilder where S: AsRef, I: IntoIterator { let mut builder = RegexSetBuilder(RegexOptions::default()); diff --git a/src/vendor/regex/src/re_bytes.rs b/src/vendor/regex/src/re_bytes.rs index 8a8550eb65..b393dd26d2 100644 --- a/src/vendor/regex/src/re_bytes.rs +++ b/src/vendor/regex/src/re_bytes.rs @@ -250,7 +250,7 @@ impl Regex { /// with a `usize`. /// /// The `0`th capture group is always unnamed, so it must always be - /// accessed with `at(0)` or `[0]`. + /// accessed with `get(0)` or `[0]`. pub fn captures<'t>(&self, text: &'t [u8]) -> Option> { let mut locs = self.locations(); self.read_captures_at(&mut locs, text, 0).map(|_| Captures { @@ -494,9 +494,13 @@ impl Regex { mut rep: R, ) -> Cow<'t, [u8]> { if let Some(rep) = rep.no_expansion() { + let mut it = self.find_iter(text).enumerate().peekable(); + if it.peek().is_none() { + return Cow::Borrowed(text); + } let mut new = Vec::with_capacity(text.len()); let mut last_match = 0; - for (i, m) in self.find_iter(text).enumerate() { + for (i, m) in it { if limit > 0 && i >= limit { break } @@ -504,9 +508,6 @@ impl Regex { new.extend_from_slice(&rep); last_match = m.end(); } - if last_match == 0 { - return Cow::Borrowed(text); - } new.extend_from_slice(&text[last_match..]); return Cow::Owned(new); } @@ -889,7 +890,7 @@ impl<'c, 't> fmt::Debug for CapturesDebug<'c, 't> { let mut map = f.debug_map(); for (slot, m) in self.0.locs.iter().enumerate() { let m = m.map(|(s, e)| escape_bytes(&self.0.text[s..e])); - if let Some(ref name) = slot_to_name.get(&slot) { + if let Some(name) = slot_to_name.get(&slot) { map.entry(&name, &m); } else { map.entry(&slot, &m); @@ -996,7 +997,7 @@ impl<'a> Replacer for &'a [u8] { caps.expand(*self, dst); } - fn no_expansion<'r>(&'r mut self) -> Option> { + fn no_expansion(&mut self) -> Option> { match memchr(b'$', *self) { Some(_) => None, None => Some(Cow::Borrowed(*self)), @@ -1010,7 +1011,7 @@ impl Replacer for F where F: FnMut(&Captures) -> Vec { } } -/// NoExpand indicates literal byte string replacement. +/// `NoExpand` indicates literal byte string replacement. /// /// It can be used with `replace` and `replace_all` to do a literal byte string /// replacement without expanding `$name` to their corresponding capture @@ -1025,7 +1026,7 @@ impl<'t> Replacer for NoExpand<'t> { dst.extend_from_slice(self.0); } - fn no_expansion<'r>(&'r mut self) -> Option> { + fn no_expansion(&mut self) -> Option> { Some(Cow::Borrowed(self.0)) } } diff --git a/src/vendor/regex/src/re_trait.rs b/src/vendor/regex/src/re_trait.rs index 9f3407c98b..de674bd528 100644 --- a/src/vendor/regex/src/re_trait.rs +++ b/src/vendor/regex/src/re_trait.rs @@ -37,7 +37,7 @@ impl Locations { /// appearance in the regular expression. Positions are byte indices /// in terms of the original string matched. pub fn iter(&self) -> SubCapturesPosIter { - SubCapturesPosIter { idx: 0, locs: &self } + SubCapturesPosIter { idx: 0, locs: self } } /// Returns the total number of capturing groups. @@ -84,7 +84,7 @@ impl<'c> Iterator for SubCapturesPosIter<'c> { } } -/// RegularExpression describes types that can implement regex searching. +/// `RegularExpression` describes types that can implement regex searching. /// /// This trait is my attempt at reducing code duplication and to standardize /// the internal API. Specific duplication that is avoided are the `find` @@ -148,10 +148,10 @@ pub trait RegularExpression: Sized { /// Returns an iterator over all non-overlapping successive leftmost-first /// matches. - fn find_iter<'t>( + fn find_iter ( self, - text: &'t Self::Text, - ) -> Matches<'t, Self> { + text: &Self::Text, + ) -> Matches { Matches { re: self, text: text, @@ -162,10 +162,10 @@ pub trait RegularExpression: Sized { /// Returns an iterator over all non-overlapping successive leftmost-first /// matches with captures. - fn captures_iter<'t>( + fn captures_iter( self, - text: &'t Self::Text, - ) -> CaptureMatches<'t, Self> { + text: &Self::Text, + ) -> CaptureMatches { CaptureMatches(self.find_iter(text)) } } @@ -206,7 +206,7 @@ impl<'t, R> Iterator for Matches<'t, R> // This is an empty match. To ensure we make progress, start // the next search at the smallest possible starting position // of the next match following this one. - self.last_end = self.re.next_after_empty(&self.text, e); + self.last_end = self.re.next_after_empty(self.text, e); // Don't accept empty matches immediately following a match. // Just move on to the next match. if Some(e) == self.last_match { @@ -255,7 +255,7 @@ impl<'t, R> Iterator for CaptureMatches<'t, R> Some((s, e)) => (s, e), }; if s == e { - self.0.last_end = self.0.re.next_after_empty(&self.0.text, e); + self.0.last_end = self.0.re.next_after_empty(self.0.text, e); if Some(e) == self.0.last_match { return self.next(); } diff --git a/src/vendor/regex/src/re_unicode.rs b/src/vendor/regex/src/re_unicode.rs index d90be4fb1c..60b0114cb5 100644 --- a/src/vendor/regex/src/re_unicode.rs +++ b/src/vendor/regex/src/re_unicode.rs @@ -73,6 +73,12 @@ impl<'t> Match<'t> { } } +impl<'t> From> for &'t str { + fn from(m: Match<'t>) -> &'t str { + m.as_str() + } +} + /// A compiled regular expression for matching Unicode strings. /// /// It is represented as either a sequence of bytecode instructions (dynamic) @@ -325,7 +331,7 @@ impl Regex { /// with a `usize`. /// /// The `0`th capture group is always unnamed, so it must always be - /// accessed with `at(0)` or `[0]`. + /// accessed with `get(0)` or `[0]`. pub fn captures<'t>(&self, text: &'t str) -> Option> { let mut locs = self.locations(); self.read_captures_at(&mut locs, text, 0).map(|_| Captures { @@ -577,9 +583,13 @@ impl Regex { // replacements inside the replacement string. We just push it // at each match and be done with it. if let Some(rep) = rep.no_expansion() { + let mut it = self.find_iter(text).enumerate().peekable(); + if it.peek().is_none() { + return Cow::Borrowed(text); + } let mut new = String::with_capacity(text.len()); let mut last_match = 0; - for (i, m) in self.find_iter(text).enumerate() { + for (i, m) in it { if limit > 0 && i >= limit { break } @@ -587,9 +597,6 @@ impl Regex { new.push_str(&rep); last_match = m.end(); } - if last_match == 0 { - return Cow::Borrowed(text); - } new.push_str(&text[last_match..]); return Cow::Owned(new); } @@ -731,7 +738,7 @@ impl Regex { pub fn as_str(&self) -> &str { match self.0 { _Regex::Dynamic(ref exec) => &exec.regex_strings()[0], - _Regex::Plugin(ref plug) => &plug.original, + _Regex::Plugin(ref plug) => plug.original, } } @@ -868,7 +875,7 @@ enum NamedGroups { impl NamedGroups { fn from_regex(regex: &Regex) -> NamedGroups { match regex.0 { - _Regex::Plugin(ref plug) => NamedGroups::Plugin(&plug.groups), + _Regex::Plugin(ref plug) => NamedGroups::Plugin(plug.groups), _Regex::Dynamic(ref exec) => { NamedGroups::Dynamic(exec.capture_name_idx().clone()) } @@ -882,12 +889,12 @@ impl NamedGroups { .ok().map(|i| groups[i].1) }, NamedGroups::Dynamic(ref groups) => { - groups.get(name).map(|i| *i) + groups.get(name).cloned() }, } } - fn iter<'n>(&'n self) -> NamedGroupsIter<'n> { + fn iter(& self) -> NamedGroupsIter { match *self { NamedGroups::Plugin(g) => NamedGroupsIter::Plugin(g.iter()), NamedGroups::Dynamic(ref g) => NamedGroupsIter::Dynamic(g.iter()), @@ -905,7 +912,7 @@ impl<'n> Iterator for NamedGroupsIter<'n> { fn next(&mut self) -> Option { match *self { - NamedGroupsIter::Plugin(ref mut it) => it.next().map(|&v| v), + NamedGroupsIter::Plugin(ref mut it) => it.next().cloned(), NamedGroupsIter::Dynamic(ref mut it) => { it.next().map(|(s, i)| (s.as_ref(), *i)) } @@ -1019,7 +1026,7 @@ impl<'c, 't> fmt::Debug for CapturesDebug<'c, 't> { let mut map = f.debug_map(); for (slot, m) in self.0.locs.iter().enumerate() { let m = m.map(|(s, e)| &self.0.text[s..e]); - if let Some(ref name) = slot_to_name.get(&slot) { + if let Some(name) = slot_to_name.get(&slot) { map.entry(&name, &m); } else { map.entry(&slot, &m); @@ -1202,7 +1209,7 @@ impl<'a> Replacer for &'a str { caps.expand(*self, dst); } - fn no_expansion<'r>(&'r mut self) -> Option> { + fn no_expansion(&mut self) -> Option> { match memchr(b'$', self.as_bytes()) { Some(_) => None, None => Some(Cow::Borrowed(*self)), @@ -1216,7 +1223,7 @@ impl Replacer for F where F: FnMut(&Captures) -> String { } } -/// NoExpand indicates literal string replacement. +/// `NoExpand` indicates literal string replacement. /// /// It can be used with `replace` and `replace_all` to do a literal string /// replacement without expanding `$name` to their corresponding capture @@ -1231,7 +1238,7 @@ impl<'t> Replacer for NoExpand<'t> { dst.push_str(self.0); } - fn no_expansion<'r>(&'r mut self) -> Option> { + fn no_expansion(&mut self) -> Option> { Some(Cow::Borrowed(self.0)) } } diff --git a/src/vendor/regex/src/utf8.rs b/src/vendor/regex/src/utf8.rs index 8f6ec1a022..75616f5fbd 100644 --- a/src/vendor/regex/src/utf8.rs +++ b/src/vendor/regex/src/utf8.rs @@ -149,8 +149,8 @@ pub fn decode_utf8(src: &[u8]) -> Option<(char, usize)> { } } -/// Like decode_utf8, but decodes the last UTF-8 sequence in `src` instead of -/// the first. +/// Like `decode_utf8`, but decodes the last UTF-8 sequence in `src` instead +/// of the first. pub fn decode_last_utf8(src: &[u8]) -> Option<(char, usize)> { if src.is_empty() { return None; diff --git a/src/vendor/regex/tests/api_str.rs b/src/vendor/regex/tests/api_str.rs index 5bdca8426a..410bd9036a 100644 --- a/src/vendor/regex/tests/api_str.rs +++ b/src/vendor/regex/tests/api_str.rs @@ -20,3 +20,12 @@ fn empty_match_unicode_captures_iter() { .collect(); assert_eq!(vec![(0, 0), (3, 3), (4, 4), (7, 7), (8, 8)], ms); } + +#[test] +fn match_as_str() { + let re = regex!(r"fo+"); + let caps = re.captures("barfoobar").unwrap(); + assert_eq!(caps.get(0).map(|m| m.as_str()), Some("foo")); + assert_eq!(caps.get(0).map(From::from), Some("foo")); + assert_eq!(caps.get(0).map(Into::into), Some("foo")); +} diff --git a/src/vendor/regex/tests/bytes.rs b/src/vendor/regex/tests/bytes.rs index 9d472aa518..0285950a1a 100644 --- a/src/vendor/regex/tests/bytes.rs +++ b/src/vendor/regex/tests/bytes.rs @@ -3,7 +3,7 @@ // A silly wrapper to make it possible to write and match raw bytes. struct R<'a>(&'a [u8]); -impl<'a> R<'a> { fn as_bytes(&self) -> &'a [u8] { &self.0 } } +impl<'a> R<'a> { fn as_bytes(&self) -> &'a [u8] { self.0 } } mat!(word_boundary, r"(?-u) \b", " δ", None); mat!(word_boundary_unicode, r" \b", " δ", Some((0, 1))); diff --git a/src/vendor/regex/tests/crazy.rs b/src/vendor/regex/tests/crazy.rs index ade839ade1..c7c5723084 100644 --- a/src/vendor/regex/tests/crazy.rs +++ b/src/vendor/regex/tests/crazy.rs @@ -47,6 +47,20 @@ mat!(negclass_space_comma, r"[^,\s]", ", a", Some((2, 3))); mat!(negclass_comma_space, r"[^\s,]", " ,a", Some((2, 3))); mat!(negclass_ascii, r"[^[:alpha:]Z]", "A1", Some((1, 2))); +// Test that repeated empty expressions don't loop forever. +mat!(lazy_many_many, r"((?:.*)*?)=", "a=b", Some((0, 2))); +mat!(lazy_many_optional, r"((?:.?)*?)=", "a=b", Some((0, 2))); +mat!(lazy_one_many_many, r"((?:.*)+?)=", "a=b", Some((0, 2))); +mat!(lazy_one_many_optional, r"((?:.?)+?)=", "a=b", Some((0, 2))); +mat!(lazy_range_min_many, r"((?:.*){1,}?)=", "a=b", Some((0, 2))); +mat!(lazy_range_many, r"((?:.*){1,2}?)=", "a=b", Some((0, 2))); +mat!(greedy_many_many, r"((?:.*)*)=", "a=b", Some((0, 2))); +mat!(greedy_many_optional, r"((?:.?)*)=", "a=b", Some((0, 2))); +mat!(greedy_one_many_many, r"((?:.*)+)=", "a=b", Some((0, 2))); +mat!(greedy_one_many_optional, r"((?:.?)+)=", "a=b", Some((0, 2))); +mat!(greedy_range_min_many, r"((?:.*){1,})=", "a=b", Some((0, 2))); +mat!(greedy_range_many, r"((?:.*){1,2})=", "a=b", Some((0, 2))); + // Test that the DFA can handle pathological cases. // (This should result in the DFA's cache being flushed too frequently, which // should cause it to quit and fall back to the NFA algorithm.) diff --git a/src/vendor/regex/tests/macros.rs b/src/vendor/regex/tests/macros.rs index 2cd1463b4e..3c4b888b20 100644 --- a/src/vendor/regex/tests/macros.rs +++ b/src/vendor/regex/tests/macros.rs @@ -14,7 +14,7 @@ macro_rules! ismatch { #[test] fn $name() { let re = regex!($re); - assert!($ismatch == re.is_match(text!($text))); + assert_eq!($ismatch, re.is_match(text!($text))); } }; } diff --git a/src/vendor/regex/tests/macros_bytes.rs b/src/vendor/regex/tests/macros_bytes.rs index 4a382c78dd..d6e406bd1a 100644 --- a/src/vendor/regex/tests/macros_bytes.rs +++ b/src/vendor/regex/tests/macros_bytes.rs @@ -4,9 +4,6 @@ macro_rules! t { ($re:expr) => { text!($re) } } macro_rules! match_text { ($text:expr) => { $text.as_bytes() } } macro_rules! bytes { ($text:expr) => { $text } } -macro_rules! b { ($text:expr) => { bytes!($text) } } - -// macro_rules! u { ($re:expr) => { concat!("(?u)", $re) } } macro_rules! no_expand { ($text:expr) => {{ diff --git a/src/vendor/regex/tests/macros_str.rs b/src/vendor/regex/tests/macros_str.rs index e5b0e219da..8f490f1420 100644 --- a/src/vendor/regex/tests/macros_str.rs +++ b/src/vendor/regex/tests/macros_str.rs @@ -3,11 +3,6 @@ macro_rules! text { ($text:expr) => { $text } } macro_rules! t { ($text:expr) => { text!($text) } } macro_rules! match_text { ($text:expr) => { $text.as_str() } } -macro_rules! bytes { ($text:expr) => { $text.as_bytes() } } -macro_rules! b { ($text:expr) => { bytes!($text) } } - -// macro_rules! u { ($re:expr) => { $re } } - macro_rules! no_expand { ($text:expr) => {{ use regex::NoExpand; diff --git a/src/vendor/regex/tests/replace.rs b/src/vendor/regex/tests/replace.rs index 22eb0c5e57..6e555b93ea 100644 --- a/src/vendor/regex/tests/replace.rs +++ b/src/vendor/regex/tests/replace.rs @@ -36,3 +36,6 @@ replace!(no_expand2, replace, // See https://github.com/rust-lang/regex/issues/314 replace!(match_at_start_replace_with_empty, replace_all, r"foo", "foobar", t!(""), "bar"); + +// See https://github.com/rust-lang/regex/issues/393 +replace!(single_empty_match, replace, r"^", "bar", t!("foo"), "foobar"); diff --git a/src/vendor/regex/tests/test_default_bytes.rs b/src/vendor/regex/tests/test_default_bytes.rs index b049b3d2aa..3ac3ce457f 100644 --- a/src/vendor/regex/tests/test_default_bytes.rs +++ b/src/vendor/regex/tests/test_default_bytes.rs @@ -43,7 +43,7 @@ include!("macros.rs"); // A silly wrapper to make it possible to write and match raw bytes. struct R<'a>(&'a [u8]); -impl<'a> R<'a> { fn as_bytes(&self) -> &'a [u8] { &self.0 } } +impl<'a> R<'a> { fn as_bytes(&self) -> &'a [u8] { self.0 } } // See: https://github.com/rust-lang/regex/issues/321 // diff --git a/src/vendor/rls-data/.cargo-checksum.json b/src/vendor/rls-data/.cargo-checksum.json index 56177e3db4..219289f375 100644 --- a/src/vendor/rls-data/.cargo-checksum.json +++ b/src/vendor/rls-data/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"1ef9c846e4e5922b78dd32b3ecccda2965c254f5d30b14a996cb613d49603ab6","Cargo.toml":"2e3048c1e86ff085807f3779f2ac02980a3bc1af43f1c8fc19cb6decd8a6449e","Cargo.toml.orig":"b2ddc03f6a5b672729f778b09c30af629d04526b0e0d283f733f2fb35f0e0ba4","README.md":"7bbd124ce5419c1a600dc4d10091f3c822a1b9a7ab51713c53f900e34126ecdf","src/config.rs":"d660e210d6e7aa1aa4706532b8a9b3cf3d31310145692acd562a565c4d3028b9","src/lib.rs":"296dc657d73523ccc0244f5a85e9264de66949cd95ca673481794654b3888e4f"},"package":"48257ceade23c2e01a3ca8d2fc4226101b107f6a3c868f829cf3fd2f204a1fe6"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"1ef9c846e4e5922b78dd32b3ecccda2965c254f5d30b14a996cb613d49603ab6","Cargo.toml":"8202955c874ce19e3943385f686eced95f5b0acf9bbda0068df17e6d6bb4428e","Cargo.toml.orig":"1ccf3dab07e8ce0cb6e7f0ebb40dd825fe8addb8c6ba915846efe5d271463b95","README.md":"7bbd124ce5419c1a600dc4d10091f3c822a1b9a7ab51713c53f900e34126ecdf","src/config.rs":"c469614866226c2d8d34ce874be81ce8ef543413d4129adab9f94d9cb917edcf","src/lib.rs":"4e610776d5318b24c12589ad31b6f3c67d016341683cefc0f425c931f1abc0a4"},"package":"8024f1feaca72d0aa4ae1e2a8d454a31b9a33ed02f8d0e9c8559bf53c267ec3c"} \ No newline at end of file diff --git a/src/vendor/rls-data/Cargo.toml b/src/vendor/rls-data/Cargo.toml index 5cdd8773ee..bab55312f2 100644 --- a/src/vendor/rls-data/Cargo.toml +++ b/src/vendor/rls-data/Cargo.toml @@ -12,27 +12,27 @@ [package] name = "rls-data" -version = "0.12.0" +version = "0.14.0" authors = ["Nick Cameron "] description = "Data structures used by the RLS and Rust compiler" categories = ["development-tools"] license = "Apache-2.0/MIT" repository = "https://github.com/nrc/rls-data" -[dependencies.rustc-serialize] -version = "0.3" - -[dependencies.serde_derive] -version = "1.0" -optional = true - [dependencies.rls-span] version = "0.4" features = ["serialize-rustc"] +[dependencies.rustc-serialize] +version = "0.3" + [dependencies.serde] version = "1.0" optional = true +[dependencies.serde_derive] +version = "1.0" +optional = true + [features] -serialize-serde = ["serde", "serde_derive"] borrows = [] +serialize-serde = ["serde", "serde_derive"] diff --git a/src/vendor/rls-data/Cargo.toml.orig b/src/vendor/rls-data/Cargo.toml.orig index 9119712990..68e1116ea6 100644 --- a/src/vendor/rls-data/Cargo.toml.orig +++ b/src/vendor/rls-data/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "rls-data" -version = "0.12.0" +version = "0.14.0" authors = ["Nick Cameron "] description = "Data structures used by the RLS and Rust compiler" license = "Apache-2.0/MIT" diff --git a/src/vendor/rls-data/src/config.rs b/src/vendor/rls-data/src/config.rs index 6740e25231..53f19220da 100644 --- a/src/vendor/rls-data/src/config.rs +++ b/src/vendor/rls-data/src/config.rs @@ -19,6 +19,8 @@ pub struct Config { /// If true only includes data for public items in a crate (useful for /// library crates). pub pub_only: bool, + /// If true only includes data for items reachable from the crate root. + pub reachable_only: bool, /// True if and only if the analysed crate is part of the standard Rust distro. pub distro_crate: bool, /// Include signature information. diff --git a/src/vendor/rls-data/src/lib.rs b/src/vendor/rls-data/src/lib.rs index 830bb23a13..d7f174b733 100644 --- a/src/vendor/rls-data/src/lib.rs +++ b/src/vendor/rls-data/src/lib.rs @@ -130,6 +130,7 @@ pub struct Import { pub span: SpanData, pub name: String, pub value: String, + pub parent: Option, } #[derive(Debug, RustcDecodable, RustcEncodable, Clone, Copy, PartialEq, Eq)] diff --git a/src/vendor/serde/.cargo-checksum.json b/src/vendor/serde/.cargo-checksum.json index 36b8e6bfe2..3b5fe5bcea 100644 --- a/src/vendor/serde/.cargo-checksum.json +++ b/src/vendor/serde/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"abf19cbbd19c84bc4f7ee63bad88474aacb5cbc8b74b57271f4fd55d9b1a0369","Cargo.toml.orig":"a3032b40ebecfbe0cd26c19759109ff0c76545ab44bb10b41b531d24cb3d86bf","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/de/from_primitive.rs":"28ec3ab1c430cf27d632b642ccfccb6d055eeb9fb576e7e446ba24c66f507fb4","src/de/ignored_any.rs":"1b5ee592f5ae58d69e321144d4397f149c047e327529d0b880e1a5285e781a35","src/de/impls.rs":"6a879dd2093ae482bebdc0bd7a4339ced994449715b582523a1c233870c790cc","src/de/mod.rs":"2ebbe708c7166da251ae2820b42bcf38006378f589429154df854289e3d28a2d","src/de/utf8.rs":"956b124b7ce98353cb781b56e43a6fed2e67f1389d35b7a468d5be75b1485853","src/de/value.rs":"fe31174cc41035a1b53d4657b6cae6f3bcb660be39eccaae281a6e3705655578","src/export.rs":"7477f5bd345ca9e0b8d56bccdc62484e42a92fc6cd909bf17fb6e05cd1eb7946","src/lib.rs":"9d9e47506d7881bec105f70cb05d78624a05b42ee0b360103d0aa3140045d296","src/macros.rs":"e1d542b1dac2c1d1f9d5ada7cc5b6639767fc67851421cc3adfb942a7cf750b6","src/private/de.rs":"153c0673c2f7ba1849846f13b3e6aa7180520dd852e663c6c9f27abcd783d647","src/private/macros.rs":"6861a4f332ea24d0ed5db1c28fe3105d2716523902f045c0bbbd439ebf9e44de","src/private/mod.rs":"bcd7c54838e139475c23a323678e20eccbe88c0be93f7977f7675cead4d3b6ed","src/private/ser.rs":"eec5aecf077cebf4dc3fdbe83780f716bf33d311806ee59ce42a0c53c2f92211","src/ser/impls.rs":"dc5219e898d67c9422fef81d1f36d25ea92341c5ad3d976c0017886f371a8d51","src/ser/impossible.rs":"35bd09bb517b28eda0048b0622eb5a0313d5aebf37c03b5a44dbca200d0a9ac8","src/ser/mod.rs":"3d92794f13c8d90c2ebc33716bd6e4d4dde552c6f7de42dfaf9967d8a9ab7d10"},"package":"6eda663e865517ee783b0891a3f6eb3a253e0b0dabb46418969ee9635beadd9e"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"99cc6eb2ce42af042fb50f0911ba907cf82648736834399ee30cba4664fdbcb9","Cargo.toml.orig":"ed5590af5c0cbb4b68ea6f47cd15aa92fad2038d511d5b6a78f98dd5b52b7b31","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/de/from_primitive.rs":"28ec3ab1c430cf27d632b642ccfccb6d055eeb9fb576e7e446ba24c66f507fb4","src/de/ignored_any.rs":"864eaefef0aaae36daf0c2bdee08165dabbf60710f3217142d5e280c0a35c1fe","src/de/impls.rs":"7273dd34886e13e0fd9ca6c3cb8c12b2821a8b9407ee281f8413ed88e2639895","src/de/mod.rs":"2984925d7844816cacc290067db049766912d1393732d9df280e6ba020582afc","src/de/utf8.rs":"956b124b7ce98353cb781b56e43a6fed2e67f1389d35b7a468d5be75b1485853","src/de/value.rs":"463e107e9ce9a56cc22901aeb60edbf0d10b144ca03dcdb78988d68f6c96022b","src/export.rs":"dd08253f225862aa5009b27900e04187480c96562c35205b71b36b2ac64c4cce","src/lib.rs":"5ac31066217b47745227c999c66a20fe2eb076c91f8babb3996ffc419248fb3e","src/macros.rs":"e1d542b1dac2c1d1f9d5ada7cc5b6639767fc67851421cc3adfb942a7cf750b6","src/private/de.rs":"55403af32b5b4112ab2203c1598bb033308f8c59ed5c4b5f4730dc2f26d3808d","src/private/macros.rs":"6861a4f332ea24d0ed5db1c28fe3105d2716523902f045c0bbbd439ebf9e44de","src/private/mod.rs":"bcd7c54838e139475c23a323678e20eccbe88c0be93f7977f7675cead4d3b6ed","src/private/ser.rs":"fed0c80a55a214c9bf411fe591f8f99562b01fcd27dfe968f6cc9d694a9c60b2","src/ser/impls.rs":"ecc4555ad4f0a680c9e5b4dbab1711286c85946729e4aae714e0150196ecd9d1","src/ser/impossible.rs":"009dce92e20bd25335db7d747c595111f5eb8d21dda0f6c75bccf0d0608c5751","src/ser/mod.rs":"b0b970c9e4987db7fbd7bc3bb9f32448e2de864c6596829922cf8fe131dae23d"},"package":"386122ba68c214599c44587e0c0b411e8d90894503a95425b4f9508e4317901f"} \ No newline at end of file diff --git a/src/vendor/serde/Cargo.toml b/src/vendor/serde/Cargo.toml index 68417b1ab9..655ddc8eb2 100644 --- a/src/vendor/serde/Cargo.toml +++ b/src/vendor/serde/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "serde" -version = "1.0.21" +version = "1.0.25" authors = ["Erick Tryzelaar ", "David Tolnay "] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "A generic serialization/deserialization framework" diff --git a/src/vendor/serde/Cargo.toml.orig b/src/vendor/serde/Cargo.toml.orig index 516a5b1c1b..f951818c9b 100644 --- a/src/vendor/serde/Cargo.toml.orig +++ b/src/vendor/serde/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "serde" -version = "1.0.21" # remember to update html_root_url +version = "1.0.25" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT/Apache-2.0" description = "A generic serialization/deserialization framework" diff --git a/src/vendor/serde/src/de/ignored_any.rs b/src/vendor/serde/src/de/ignored_any.rs index a4f3abe264..20b06b90bd 100644 --- a/src/vendor/serde/src/de/ignored_any.rs +++ b/src/vendor/serde/src/de/ignored_any.rs @@ -8,7 +8,7 @@ use lib::*; -use de::{Deserialize, Deserializer, Visitor, SeqAccess, MapAccess, Error}; +use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; /// An efficient way of discarding data from a deserializer. /// diff --git a/src/vendor/serde/src/de/impls.rs b/src/vendor/serde/src/de/impls.rs index ea48d34e6a..801d9870f8 100644 --- a/src/vendor/serde/src/de/impls.rs +++ b/src/vendor/serde/src/de/impls.rs @@ -15,6 +15,7 @@ use de::{Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, Va use de::MapAccess; use de::from_primitive::FromPrimitive; +use private::de::InPlaceSeed; #[cfg(any(feature = "std", feature = "alloc"))] use private::de::size_hint; @@ -210,6 +211,8 @@ impl<'de> Deserialize<'de> for char { #[cfg(any(feature = "std", feature = "alloc"))] struct StringVisitor; +#[cfg(any(feature = "std", feature = "alloc"))] +struct StringInPlaceVisitor<'a>(&'a mut String); #[cfg(any(feature = "std", feature = "alloc"))] impl<'de> Visitor<'de> for StringVisitor { @@ -249,7 +252,66 @@ impl<'de> Visitor<'de> for StringVisitor { { match String::from_utf8(v) { Ok(s) => Ok(s), - Err(e) => Err(Error::invalid_value(Unexpected::Bytes(&e.into_bytes()), &self),), + Err(e) => Err(Error::invalid_value( + Unexpected::Bytes(&e.into_bytes()), + &self, + )), + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de> Visitor<'de> for StringInPlaceVisitor<'a> { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a string") + } + + fn visit_str(self, v: &str) -> Result<(), E> + where + E: Error, + { + self.0.clear(); + self.0.push_str(v); + Ok(()) + } + + fn visit_string(self, v: String) -> Result<(), E> + where + E: Error, + { + *self.0 = v; + Ok(()) + } + + fn visit_bytes(self, v: &[u8]) -> Result<(), E> + where + E: Error, + { + match str::from_utf8(v) { + Ok(s) => { + self.0.clear(); + self.0.push_str(s); + Ok(()) + } + Err(_) => Err(Error::invalid_value(Unexpected::Bytes(v), &self)), + } + } + + fn visit_byte_buf(self, v: Vec) -> Result<(), E> + where + E: Error, + { + match String::from_utf8(v) { + Ok(s) => { + *self.0 = s; + Ok(()) + } + Err(e) => Err(Error::invalid_value( + Unexpected::Bytes(&e.into_bytes()), + &self, + )), } } } @@ -262,6 +324,13 @@ impl<'de> Deserialize<'de> for String { { deserializer.deserialize_string(StringVisitor) } + + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + deserializer.deserialize_string(StringInPlaceVisitor(place)) + } } //////////////////////////////////////////////////////////////////////////////// @@ -465,8 +534,16 @@ where where D: Deserializer<'de>, { - deserializer.deserialize_option(OptionVisitor { marker: PhantomData }) + deserializer.deserialize_option(OptionVisitor { + marker: PhantomData, + }) } + + // The Some variant's repr is opaque, so we can't play cute tricks with its + // tag to have deserialize_in_place build the content in place unconditionally. + // + // FIXME: investigate whether branching on the old value being Some to + // deserialize_in_place the value is profitable (probably data-dependent?) } //////////////////////////////////////////////////////////////////////////////// @@ -496,7 +573,9 @@ impl<'de, T> Deserialize<'de> for PhantomData { where D: Deserializer<'de>, { - let visitor = PhantomDataVisitor { marker: PhantomData }; + let visitor = PhantomDataVisitor { + marker: PhantomData, + }; deserializer.deserialize_unit_struct("PhantomData", visitor) } } @@ -509,7 +588,9 @@ macro_rules! seq_impl { $ty:ident < T $(: $tbound1:ident $(+ $tbound2:ident)*)* $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)* >, $access:ident, $ctor:expr, + $clear:expr, $with_capacity:expr, + $reserve:expr, $insert:expr ) => { impl<'de, T $(, $typaram)*> Deserialize<'de> for $ty @@ -554,16 +635,59 @@ macro_rules! seq_impl { let visitor = SeqVisitor { marker: PhantomData }; deserializer.deserialize_seq(visitor) } + + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + struct SeqInPlaceVisitor<'a, T: 'a $(, $typaram: 'a)*>(&'a mut $ty); + + impl<'a, 'de, T $(, $typaram)*> Visitor<'de> for SeqInPlaceVisitor<'a, T $(, $typaram)*> + where + T: Deserialize<'de> $(+ $tbound1 $(+ $tbound2)*)*, + $($typaram: $bound1 $(+ $bound2)*,)* + { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a sequence") + } + + #[inline] + fn visit_seq(mut self, mut $access: A) -> Result<(), A::Error> + where + A: SeqAccess<'de>, + { + $clear(&mut self.0); + $reserve(&mut self.0, size_hint::cautious($access.size_hint())); + + // FIXME: try to overwrite old values here? (Vec, VecDeque, LinkedList) + while let Some(value) = try!($access.next_element()) { + $insert(&mut self.0, value); + } + + Ok(()) + } + } + + deserializer.deserialize_seq(SeqInPlaceVisitor(place)) + } } } } +// Dummy impl of reserve +#[cfg(any(feature = "std", feature = "alloc"))] +fn nop_reserve(_seq: T, _n: usize) {} + #[cfg(any(feature = "std", feature = "alloc"))] seq_impl!( BinaryHeap, seq, BinaryHeap::new(), + BinaryHeap::clear, BinaryHeap::with_capacity(size_hint::cautious(seq.size_hint())), + BinaryHeap::reserve, BinaryHeap::push); #[cfg(any(feature = "std", feature = "alloc"))] @@ -571,7 +695,9 @@ seq_impl!( BTreeSet, seq, BTreeSet::new(), + BTreeSet::clear, BTreeSet::new(), + nop_reserve, BTreeSet::insert); #[cfg(any(feature = "std", feature = "alloc"))] @@ -579,15 +705,20 @@ seq_impl!( LinkedList, seq, LinkedList::new(), + LinkedList::clear, LinkedList::new(), - LinkedList::push_back); + nop_reserve, + LinkedList::push_back +); #[cfg(feature = "std")] seq_impl!( HashSet, seq, HashSet::with_hasher(S::default()), + HashSet::clear, HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()), + HashSet::reserve, HashSet::insert); #[cfg(any(feature = "std", feature = "alloc"))] @@ -595,26 +726,35 @@ seq_impl!( Vec, seq, Vec::new(), + Vec::clear, Vec::with_capacity(size_hint::cautious(seq.size_hint())), - Vec::push); + Vec::reserve, + Vec::push +); #[cfg(any(feature = "std", feature = "alloc"))] seq_impl!( VecDeque, seq, VecDeque::new(), + VecDeque::clear, VecDeque::with_capacity(size_hint::cautious(seq.size_hint())), - VecDeque::push_back); + VecDeque::reserve, + VecDeque::push_back +); //////////////////////////////////////////////////////////////////////////////// struct ArrayVisitor { marker: PhantomData, } +struct ArrayInPlaceVisitor<'a, A: 'a>(&'a mut A); impl ArrayVisitor { fn new() -> Self { - ArrayVisitor { marker: PhantomData } + ArrayVisitor { + marker: PhantomData, + } } } @@ -673,6 +813,35 @@ macro_rules! array_impls { } } + impl<'a, 'de, T> Visitor<'de> for ArrayInPlaceVisitor<'a, [T; $len]> + where + T: Deserialize<'de>, + { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("an array of length ", $len)) + } + + #[inline] + fn visit_seq(self, mut seq: A) -> Result<(), A::Error> + where + A: SeqAccess<'de>, + { + let mut fail_idx = None; + for (idx, dest) in self.0[..].iter_mut().enumerate() { + if try!(seq.next_element_seed(InPlaceSeed(dest))).is_none() { + fail_idx = Some(idx); + break; + } + } + if let Some(idx) = fail_idx { + return Err(Error::invalid_length(idx, &self)); + } + Ok(()) + } + } + impl<'de, T> Deserialize<'de> for [T; $len] where T: Deserialize<'de>, @@ -683,6 +852,13 @@ macro_rules! array_impls { { deserializer.deserialize_tuple($len, ArrayVisitor::<[T; $len]>::new()) } + + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + deserializer.deserialize_tuple($len, ArrayInPlaceVisitor(place)) + } } )+ } @@ -726,49 +902,76 @@ array_impls! { //////////////////////////////////////////////////////////////////////////////// macro_rules! tuple_impls { - ($($len:tt $visitor:ident => ($($n:tt $name:ident)+))+) => { + ($($len:tt => ($($n:tt $name:ident)+))+) => { $( - struct $visitor<$($name,)+> { - marker: PhantomData<($($name,)+)>, - } - - impl<$($name,)+> $visitor<$($name,)+> { - fn new() -> Self { - $visitor { marker: PhantomData } - } - } - - impl<'de, $($name: Deserialize<'de>),+> Visitor<'de> for $visitor<$($name,)+> { - type Value = ($($name,)+); - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str(concat!("a tuple of size ", $len)) - } - - #[inline] - #[allow(non_snake_case)] - fn visit_seq(self, mut seq: A) -> Result<($($name,)+), A::Error> - where - A: SeqAccess<'de>, - { - $( - let $name = match try!(seq.next_element()) { - Some(value) => value, - None => return Err(Error::invalid_length($n, &self)), - }; - )+ - - Ok(($($name,)+)) - } - } - impl<'de, $($name: Deserialize<'de>),+> Deserialize<'de> for ($($name,)+) { #[inline] fn deserialize(deserializer: D) -> Result<($($name,)+), D::Error> where D: Deserializer<'de>, { - deserializer.deserialize_tuple($len, $visitor::new()) + struct TupleVisitor<$($name,)+> { + marker: PhantomData<($($name,)+)>, + } + + impl<'de, $($name: Deserialize<'de>),+> Visitor<'de> for TupleVisitor<$($name,)+> { + type Value = ($($name,)+); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("a tuple of size ", $len)) + } + + #[inline] + #[allow(non_snake_case)] + fn visit_seq(self, mut seq: A) -> Result<($($name,)+), A::Error> + where + A: SeqAccess<'de>, + { + $( + let $name = match try!(seq.next_element()) { + Some(value) => value, + None => return Err(Error::invalid_length($n, &self)), + }; + )+ + + Ok(($($name,)+)) + } + } + + deserializer.deserialize_tuple($len, TupleVisitor { marker: PhantomData }) + } + + #[inline] + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + struct TupleInPlaceVisitor<'a, $($name: 'a,)+>(&'a mut ($($name,)+)); + + impl<'a, 'de, $($name: Deserialize<'de>),+> Visitor<'de> for TupleInPlaceVisitor<'a, $($name,)+> { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("a tuple of size ", $len)) + } + + #[inline] + #[allow(non_snake_case)] + fn visit_seq(self, mut seq: A) -> Result<(), A::Error> + where + A: SeqAccess<'de>, + { + $( + if try!(seq.next_element_seed(InPlaceSeed(&mut (self.0).$n))).is_none() { + return Err(Error::invalid_length($n, &self)); + } + )+ + + Ok(()) + } + } + + deserializer.deserialize_tuple($len, TupleInPlaceVisitor(place)) } } )+ @@ -776,22 +979,22 @@ macro_rules! tuple_impls { } tuple_impls! { - 1 TupleVisitor1 => (0 T0) - 2 TupleVisitor2 => (0 T0 1 T1) - 3 TupleVisitor3 => (0 T0 1 T1 2 T2) - 4 TupleVisitor4 => (0 T0 1 T1 2 T2 3 T3) - 5 TupleVisitor5 => (0 T0 1 T1 2 T2 3 T3 4 T4) - 6 TupleVisitor6 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5) - 7 TupleVisitor7 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6) - 8 TupleVisitor8 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7) - 9 TupleVisitor9 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8) - 10 TupleVisitor10 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9) - 11 TupleVisitor11 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10) - 12 TupleVisitor12 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11) - 13 TupleVisitor13 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12) - 14 TupleVisitor14 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13) - 15 TupleVisitor15 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14) - 16 TupleVisitor16 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14 15 T15) + 1 => (0 T0) + 2 => (0 T0 1 T1) + 3 => (0 T0 1 T1 2 T2) + 4 => (0 T0 1 T1 2 T2 3 T3) + 5 => (0 T0 1 T1 2 T2 3 T3 4 T4) + 6 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5) + 7 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6) + 8 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7) + 9 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8) + 10 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9) + 11 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10) + 12 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11) + 13 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12) + 14 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13) + 15 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14) + 16 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14 15 T15) } //////////////////////////////////////////////////////////////////////////////// @@ -1068,7 +1271,12 @@ impl<'de> Deserialize<'de> for net::SocketAddr { parse_socket_impl!(net::SocketAddrV4, net::SocketAddrV4::new); #[cfg(feature = "std")] -parse_socket_impl!(net::SocketAddrV6, |ip, port| net::SocketAddrV6::new(ip, port, 0, 0)); +parse_socket_impl!(net::SocketAddrV6, |ip, port| net::SocketAddrV6::new( + ip, + port, + 0, + 0 +)); //////////////////////////////////////////////////////////////////////////////// @@ -1179,7 +1387,9 @@ impl<'de> Visitor<'de> for OsStringVisitor { match try!(data.variant()) { (OsStringKind::Unix, v) => v.newtype_variant().map(OsString::from_vec), - (OsStringKind::Windows, _) => Err(Error::custom("cannot deserialize Windows OS string on Unix",),), + (OsStringKind::Windows, _) => Err(Error::custom( + "cannot deserialize Windows OS string on Unix", + )), } } @@ -1191,11 +1401,11 @@ impl<'de> Visitor<'de> for OsStringVisitor { use std::os::windows::ffi::OsStringExt; match try!(data.variant()) { - (OsStringKind::Windows, v) => { - v.newtype_variant::>() - .map(|vec| OsString::from_wide(&vec)) - } - (OsStringKind::Unix, _) => Err(Error::custom("cannot deserialize Unix OS string on Windows",),), + (OsStringKind::Windows, v) => v.newtype_variant::>() + .map(|vec| OsString::from_wide(&vec)), + (OsStringKind::Unix, _) => Err(Error::custom( + "cannot deserialize Unix OS string on Windows", + )), } } } @@ -1521,13 +1731,17 @@ impl<'de> Deserialize<'de> for SystemTime { match key { Field::Secs => { if secs.is_some() { - return Err(::duplicate_field("secs_since_epoch")); + return Err(::duplicate_field( + "secs_since_epoch", + )); } secs = Some(try!(map.next_value())); } Field::Nanos => { if nanos.is_some() { - return Err(::duplicate_field("nanos_since_epoch")); + return Err(::duplicate_field( + "nanos_since_epoch", + )); } nanos = Some(try!(map.next_value())); } @@ -1691,7 +1905,13 @@ where } const FIELDS: &'static [&'static str] = &["start", "end"]; - deserializer.deserialize_struct("Range", FIELDS, RangeVisitor { phantom: PhantomData }) + deserializer.deserialize_struct( + "Range", + FIELDS, + RangeVisitor { + phantom: PhantomData, + }, + ) } } @@ -1756,9 +1976,10 @@ where match value { 0 => Ok(Field::Ok), 1 => Ok(Field::Err), - _ => { - Err(Error::invalid_value(Unexpected::Unsigned(value as u64), &self),) - } + _ => Err(Error::invalid_value( + Unexpected::Unsigned(value as u64), + &self, + )), } } @@ -1780,14 +2001,12 @@ where match value { b"Ok" => Ok(Field::Ok), b"Err" => Ok(Field::Err), - _ => { - match str::from_utf8(value) { - Ok(value) => Err(Error::unknown_variant(value, VARIANTS)), - Err(_) => { - Err(Error::invalid_value(Unexpected::Bytes(value), &self)) - } + _ => match str::from_utf8(value) { + Ok(value) => Err(Error::unknown_variant(value, VARIANTS)), + Err(_) => { + Err(Error::invalid_value(Unexpected::Bytes(value), &self)) } - } + }, } } } @@ -1831,7 +2050,7 @@ where #[cfg(feature = "std")] impl<'de, T> Deserialize<'de> for Wrapping where - T: Deserialize<'de> + T: Deserialize<'de>, { fn deserialize(deserializer: D) -> Result, D::Error> where diff --git a/src/vendor/serde/src/de/mod.rs b/src/vendor/serde/src/de/mod.rs index 848183c7b0..fe5b35b3ee 100644 --- a/src/vendor/serde/src/de/mod.rs +++ b/src/vendor/serde/src/de/mod.rs @@ -504,6 +504,35 @@ pub trait Deserialize<'de>: Sized { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>; + + /// Deserializes a value into `self` from the given Deserializer. + /// + /// The purpose of this method is to allow the deserializer to reuse + /// resources and avoid copies. As such, if this method returns an error, + /// `self` will be in an indeterminate state where some parts of the struct + /// have been overwritten. Although whatever state that is will be + /// memory-safe. + /// + /// This is generally useful when repeateadly deserializing values that + /// are processed one at a time, where the value of `self` doesn't matter + /// when the next deserialization occurs. + /// + /// If you manually implement this, your recursive deserializations should + /// use `deserialize_in_place`. + /// + /// This method is stable and an official public API, but hidden from the + /// documentation because it is almost never what newbies are looking for. + /// Showing it in rustdoc would cause it to be featured more prominently + /// than it deserves. + #[doc(hidden)] + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + // Default implementation just delegates to `deserialize` impl. + *place = Deserialize::deserialize(deserializer)?; + Ok(()) + } } /// A data structure that can be deserialized without borrowing any data from @@ -1078,7 +1107,9 @@ pub trait Deserializer<'de>: Sized { /// change, as a value serialized in human-readable mode is not required to /// deserialize from the same data in compact mode. #[inline] - fn is_human_readable(&self) -> bool { true } + fn is_human_readable(&self) -> bool { + true + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/vendor/serde/src/de/value.rs b/src/vendor/serde/src/de/value.rs index 241d4df8a5..6dd1d21f02 100644 --- a/src/vendor/serde/src/de/value.rs +++ b/src/vendor/serde/src/de/value.rs @@ -37,7 +37,7 @@ use lib::*; -use de::{self, IntoDeserializer, Expected, SeqAccess}; +use de::{self, Expected, IntoDeserializer, SeqAccess}; use private::de::size_hint; use ser; use self::private::{First, Second}; @@ -62,7 +62,9 @@ impl de::Error for Error { where T: Display, { - Error { err: msg.to_string().into_boxed_str() } + Error { + err: msg.to_string().into_boxed_str(), + } } #[cfg(not(any(feature = "std", feature = "alloc")))] @@ -112,7 +114,9 @@ where type Deserializer = UnitDeserializer; fn into_deserializer(self) -> UnitDeserializer { - UnitDeserializer { marker: PhantomData } + UnitDeserializer { + marker: PhantomData, + } } } @@ -658,7 +662,10 @@ where } else { // First argument is the number of elements in the data, second // argument is the number of elements expected by the Deserialize. - Err(de::Error::invalid_length(self.count + remaining, &ExpectedInSeq(self.count)),) + Err(de::Error::invalid_length( + self.count + remaining, + &ExpectedInSeq(self.count), + )) } } } @@ -852,7 +859,10 @@ where } else { // First argument is the number of elements in the data, second // argument is the number of elements expected by the Deserialize. - Err(de::Error::invalid_length(self.count + remaining, &ExpectedInMap(self.count)),) + Err(de::Error::invalid_length( + self.count + remaining, + &ExpectedInMap(self.count), + )) } } } @@ -901,11 +911,7 @@ where Ok(value) } - fn deserialize_tuple( - self, - len: usize, - visitor: V, - ) -> Result + fn deserialize_tuple(self, len: usize, visitor: V) -> Result where V: de::Visitor<'de>, { @@ -1223,7 +1229,12 @@ mod private { } pub fn unit_only(t: T) -> (T, UnitOnly) { - (t, UnitOnly { marker: PhantomData }) + ( + t, + UnitOnly { + marker: PhantomData, + }, + ) } impl<'de, E> de::VariantAccess<'de> for UnitOnly @@ -1240,14 +1251,20 @@ mod private { where T: de::DeserializeSeed<'de>, { - Err(de::Error::invalid_type(Unexpected::UnitVariant, &"newtype variant"),) + Err(de::Error::invalid_type( + Unexpected::UnitVariant, + &"newtype variant", + )) } fn tuple_variant(self, _len: usize, _visitor: V) -> Result where V: de::Visitor<'de>, { - Err(de::Error::invalid_type(Unexpected::UnitVariant, &"tuple variant"),) + Err(de::Error::invalid_type( + Unexpected::UnitVariant, + &"tuple variant", + )) } fn struct_variant( @@ -1258,7 +1275,10 @@ mod private { where V: de::Visitor<'de>, { - Err(de::Error::invalid_type(Unexpected::UnitVariant, &"struct variant"),) + Err(de::Error::invalid_type( + Unexpected::UnitVariant, + &"struct variant", + )) } } diff --git a/src/vendor/serde/src/export.rs b/src/vendor/serde/src/export.rs index cb416d9f09..772f310330 100644 --- a/src/vendor/serde/src/export.rs +++ b/src/vendor/serde/src/export.rs @@ -12,7 +12,7 @@ pub use lib::default::Default; pub use lib::fmt::{self, Formatter}; pub use lib::marker::PhantomData; pub use lib::option::Option::{self, None, Some}; -pub use lib::result::Result::{self, Ok, Err}; +pub use lib::result::Result::{self, Err, Ok}; pub use self::string::from_utf8_lossy; diff --git a/src/vendor/serde/src/lib.rs b/src/vendor/serde/src/lib.rs index 1732347b13..9392b0175b 100644 --- a/src/vendor/serde/src/lib.rs +++ b/src/vendor/serde/src/lib.rs @@ -79,30 +79,21 @@ //////////////////////////////////////////////////////////////////////////////// // Serde types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/serde/1.0.21")] - +#![doc(html_root_url = "https://docs.rs/serde/1.0.25")] // Support using Serde without the standard library! #![cfg_attr(not(feature = "std"), no_std)] - // Unstable functionality only if the user asks for it. For tracking and // discussion of these features please refer to this issue: // // https://github.com/serde-rs/serde/issues/812 #![cfg_attr(feature = "unstable", feature(nonzero, specialization))] #![cfg_attr(feature = "alloc", feature(alloc))] - #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Whitelisted clippy lints -#![cfg_attr(feature = "cargo-clippy", allow( - cast_lossless, - const_static_lifetime, - doc_markdown, - linkedlist, - needless_pass_by_value, - type_complexity, - unreadable_literal, - zero_prefixed_literal, -))] +#![cfg_attr(feature = "cargo-clippy", + allow(cast_lossless, const_static_lifetime, doc_markdown, linkedlist, + needless_pass_by_value, type_complexity, unreadable_literal, + zero_prefixed_literal))] // Whitelisted clippy_pedantic lints #![cfg_attr(feature = "cargo-clippy", allow( // integer and float ser/de requires these sorts of casts @@ -125,7 +116,6 @@ empty_enum, use_debug, ))] - // Blacklisted Rust lints. #![deny(missing_docs, unused_imports)] @@ -149,8 +139,8 @@ mod lib { } pub use self::core::{cmp, iter, mem, ops, slice, str}; - pub use self::core::{i8, i16, i32, i64, isize}; - pub use self::core::{u8, u16, u32, u64, usize}; + pub use self::core::{isize, i16, i32, i64, i8}; + pub use self::core::{usize, u16, u32, u64, u8}; pub use self::core::{f32, f64}; pub use self::core::cell::{Cell, RefCell}; @@ -193,9 +183,9 @@ mod lib { pub use alloc::arc::Arc; #[cfg(feature = "std")] - pub use std::collections::{BinaryHeap, BTreeMap, BTreeSet, LinkedList, VecDeque}; + pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque}; #[cfg(all(feature = "alloc", not(feature = "std")))] - pub use alloc::{BinaryHeap, BTreeMap, BTreeSet, LinkedList, VecDeque}; + pub use alloc::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque}; #[cfg(feature = "std")] pub use std::{error, net}; @@ -203,9 +193,9 @@ mod lib { #[cfg(feature = "std")] pub use std::collections::{HashMap, HashSet}; #[cfg(feature = "std")] - pub use std::ffi::{CString, CStr, OsString, OsStr}; + pub use std::ffi::{CStr, CString, OsStr, OsString}; #[cfg(feature = "std")] - pub use std::hash::{Hash, BuildHasher}; + pub use std::hash::{BuildHasher, Hash}; #[cfg(feature = "std")] pub use std::io::Write; #[cfg(feature = "std")] diff --git a/src/vendor/serde/src/private/de.rs b/src/vendor/serde/src/private/de.rs index 67f1d94703..33b91a478e 100644 --- a/src/vendor/serde/src/private/de.rs +++ b/src/vendor/serde/src/private/de.rs @@ -8,16 +8,16 @@ use lib::*; -use de::{Deserialize, Deserializer, IntoDeserializer, Error, Visitor}; +use de::{Deserialize, DeserializeSeed, Deserializer, Error, IntoDeserializer, Visitor}; #[cfg(any(feature = "std", feature = "alloc"))] use de::Unexpected; #[cfg(any(feature = "std", feature = "alloc"))] -pub use self::content::{Content, ContentRefDeserializer, ContentDeserializer, - TaggedContentVisitor, TagOrContentField, TagOrContentFieldVisitor, - TagContentOtherField, TagContentOtherFieldVisitor, - InternallyTaggedUnitVisitor, UntaggedUnitVisitor}; +pub use self::content::{Content, ContentDeserializer, ContentRefDeserializer, + InternallyTaggedUnitVisitor, TagContentOtherField, + TagContentOtherFieldVisitor, TagOrContentField, TagOrContentFieldVisitor, + TaggedContentVisitor, UntaggedUnitVisitor}; /// If the missing field is of type `Option` then treat is as `None`, /// otherwise it is an error. @@ -120,7 +120,10 @@ where { match String::from_utf8(v) { Ok(s) => Ok(Cow::Owned(s)), - Err(e) => Err(Error::invalid_value(Unexpected::Bytes(&e.into_bytes()), &self),), + Err(e) => Err(Error::invalid_value( + Unexpected::Bytes(&e.into_bytes()), + &self, + )), } } } @@ -198,6 +201,7 @@ pub mod size_hint { helper(iter.size_hint()) } + #[inline] pub fn cautious(hint: Option) -> usize { cmp::min(hint.unwrap_or(0), 4096) } @@ -224,8 +228,8 @@ mod content { use lib::*; - use de::{self, Deserialize, DeserializeSeed, Deserializer, Visitor, SeqAccess, MapAccess, - EnumAccess, Unexpected}; + use de::{self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, MapAccess, SeqAccess, + Unexpected, Visitor}; use super::size_hint; /// Used from generated code to buffer the contents of the Deserializer when @@ -501,7 +505,9 @@ mod content { where V: EnumAccess<'de>, { - Err(de::Error::custom("untagged and internally tagged enums do not support enum input",),) + Err(de::Error::custom( + "untagged and internally tagged enums do not support enum input", + )) } } @@ -520,7 +526,10 @@ mod content { impl<'de> TagOrContentVisitor<'de> { fn new(name: &'static str) -> Self { - TagOrContentVisitor { name: name, value: PhantomData } + TagOrContentVisitor { + name: name, + value: PhantomData, + } } } @@ -557,7 +566,9 @@ mod content { where F: de::Error, { - ContentVisitor::new().visit_i8(value).map(TagOrContent::Content) + ContentVisitor::new() + .visit_i8(value) + .map(TagOrContent::Content) } fn visit_i16(self, value: i16) -> Result @@ -591,7 +602,9 @@ mod content { where F: de::Error, { - ContentVisitor::new().visit_u8(value).map(TagOrContent::Content) + ContentVisitor::new() + .visit_u8(value) + .map(TagOrContent::Content) } fn visit_u16(self, value: u16) -> Result @@ -730,14 +743,18 @@ mod content { where F: de::Error, { - ContentVisitor::new().visit_unit().map(TagOrContent::Content) + ContentVisitor::new() + .visit_unit() + .map(TagOrContent::Content) } fn visit_none(self) -> Result where F: de::Error, { - ContentVisitor::new().visit_none().map(TagOrContent::Content) + ContentVisitor::new() + .visit_none() + .map(TagOrContent::Content) } fn visit_some(self, deserializer: D) -> Result @@ -860,8 +877,7 @@ mod content { { let mut tag = None; let mut vec = Vec::with_capacity(size_hint::cautious(map.size_hint())); - while let Some(k) = - try!(map.next_key_seed(TagOrContentVisitor::new(self.tag_name))) { + while let Some(k) = try!(map.next_key_seed(TagOrContentVisitor::new(self.tag_name))) { match k { TagOrContent::Tag => { if tag.is_some() { @@ -877,14 +893,10 @@ mod content { } match tag { None => Err(de::Error::missing_field(self.tag_name)), - Some(tag) => { - Ok( - TaggedContent { - tag: tag, - content: Content::Map(vec), - }, - ) - } + Some(tag) => Ok(TaggedContent { + tag: tag, + content: Content::Map(vec), + }), } } } @@ -966,7 +978,11 @@ mod content { type Value = TagContentOtherField; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "{:?}, {:?}, or other ignored fields", self.tag, self.content) + write!( + formatter, + "{:?}, {:?}, or other ignored fields", + self.tag, self.content + ) } fn visit_str(self, field: &str) -> Result @@ -1030,10 +1046,8 @@ mod content { Ok(value) } Content::Map(v) => { - let map = v.into_iter().map(|(k, v)| { - (ContentDeserializer::new(k), - ContentDeserializer::new(v)) - }); + let map = v.into_iter() + .map(|(k, v)| (ContentDeserializer::new(k), ContentDeserializer::new(v))); let mut map_visitor = de::value::MapDeserializer::new(map); let value = try!(visitor.visit_map(&mut map_visitor)); try!(map_visitor.end()); @@ -1080,44 +1094,41 @@ mod content { let (variant, value) = match iter.next() { Some(v) => v, None => { - return Err( - de::Error::invalid_value( - de::Unexpected::Map, - &"map with a single key", - ), - ); + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); } }; // enums are encoded in json as maps with a single key:value pair if iter.next().is_some() { - return Err( - de::Error::invalid_value( - de::Unexpected::Map, - &"map with a single key", - ), - ); + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); } (variant, Some(value)) } s @ Content::String(_) | s @ Content::Str(_) => (s, None), other => { - return Err(de::Error::invalid_type(other.unexpected(), &"string or map"),); + return Err(de::Error::invalid_type( + other.unexpected(), + &"string or map", + )); } }; - visitor.visit_enum( - EnumDeserializer { - variant: variant, - value: value, - err: PhantomData, - }, - ) + visitor.visit_enum(EnumDeserializer { + variant: variant, + value: value, + err: PhantomData, + }) } fn deserialize_unit_struct( self, _name: &'static str, - visitor: V + visitor: V, ) -> Result where V: Visitor<'de>, @@ -1215,9 +1226,10 @@ mod content { { match self.value { Some(value) => seed.deserialize(ContentDeserializer::new(value)), - None => { - Err(de::Error::invalid_type(de::Unexpected::UnitVariant, &"newtype variant"),) - } + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"newtype variant", + )), } } @@ -1229,8 +1241,14 @@ mod content { Some(Content::Seq(v)) => { de::Deserializer::deserialize_any(SeqDeserializer::new(v), visitor) } - Some(other) => Err(de::Error::invalid_type(other.unexpected(), &"tuple variant"),), - None => Err(de::Error::invalid_type(de::Unexpected::UnitVariant, &"tuple variant"),), + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"tuple variant", + )), + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"tuple variant", + )), } } @@ -1249,8 +1267,14 @@ mod content { Some(Content::Seq(v)) => { de::Deserializer::deserialize_any(SeqDeserializer::new(v), visitor) } - Some(other) => Err(de::Error::invalid_type(other.unexpected(), &"struct variant"),), - _ => Err(de::Error::invalid_type(de::Unexpected::UnitVariant, &"struct variant"),), + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"struct variant", + )), + _ => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"struct variant", + )), } } } @@ -1318,10 +1342,7 @@ mod content { T: de::DeserializeSeed<'de>, { match self.iter.next() { - Some(value) => { - seed.deserialize(ContentDeserializer::new(value)) - .map(Some) - } + Some(value) => seed.deserialize(ContentDeserializer::new(value)).map(Some), None => Ok(None), } } @@ -1457,12 +1478,12 @@ mod content { Ok(value) } Content::Map(ref v) => { - let map = v.into_iter() - .map( - |&(ref k, ref v)| { - (ContentRefDeserializer::new(k), ContentRefDeserializer::new(v)) - }, - ); + let map = v.into_iter().map(|&(ref k, ref v)| { + ( + ContentRefDeserializer::new(k), + ContentRefDeserializer::new(v), + ) + }); let mut map_visitor = de::value::MapDeserializer::new(map); let value = try!(visitor.visit_map(&mut map_visitor)); try!(map_visitor.end()); @@ -1505,38 +1526,35 @@ mod content { let &(ref variant, ref value) = match iter.next() { Some(v) => v, None => { - return Err( - de::Error::invalid_value( - de::Unexpected::Map, - &"map with a single key", - ), - ); + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); } }; // enums are encoded in json as maps with a single key:value pair if iter.next().is_some() { - return Err( - de::Error::invalid_value( - de::Unexpected::Map, - &"map with a single key", - ), - ); + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); } (variant, Some(value)) } ref s @ Content::String(_) | ref s @ Content::Str(_) => (s, None), ref other => { - return Err(de::Error::invalid_type(other.unexpected(), &"string or map"),); + return Err(de::Error::invalid_type( + other.unexpected(), + &"string or map", + )); } }; - visitor.visit_enum( - EnumRefDeserializer { - variant: variant, - value: value, - err: PhantomData, - }, - ) + visitor.visit_enum(EnumRefDeserializer { + variant: variant, + value: value, + err: PhantomData, + }) } forward_to_deserialize_any! { @@ -1612,9 +1630,10 @@ mod content { { match self.value { Some(value) => seed.deserialize(ContentRefDeserializer::new(value)), - None => { - Err(de::Error::invalid_type(de::Unexpected::UnitVariant, &"newtype variant"),) - } + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"newtype variant", + )), } } @@ -1626,8 +1645,14 @@ mod content { Some(&Content::Seq(ref v)) => { de::Deserializer::deserialize_any(SeqRefDeserializer::new(v), visitor) } - Some(other) => Err(de::Error::invalid_type(other.unexpected(), &"tuple variant"),), - None => Err(de::Error::invalid_type(de::Unexpected::UnitVariant, &"tuple variant"),), + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"tuple variant", + )), + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"tuple variant", + )), } } @@ -1646,8 +1671,14 @@ mod content { Some(&Content::Seq(ref v)) => { de::Deserializer::deserialize_any(SeqRefDeserializer::new(v), visitor) } - Some(other) => Err(de::Error::invalid_type(other.unexpected(), &"struct variant"),), - _ => Err(de::Error::invalid_type(de::Unexpected::UnitVariant, &"struct variant"),), + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"struct variant", + )), + _ => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"struct variant", + )), } } } @@ -1715,10 +1746,8 @@ mod content { T: de::DeserializeSeed<'de>, { match self.iter.next() { - Some(value) => { - seed.deserialize(ContentRefDeserializer::new(value)) - .map(Some) - } + Some(value) => seed.deserialize(ContentRefDeserializer::new(value)) + .map(Some), None => Ok(None), } } @@ -1763,8 +1792,7 @@ mod content { match self.iter.next() { Some(&(ref key, ref value)) => { self.value = Some(value); - seed.deserialize(ContentRefDeserializer::new(key)) - .map(Some) + seed.deserialize(ContentRefDeserializer::new(key)).map(Some) } None => Ok(None), } @@ -1850,7 +1878,11 @@ mod content { type Value = (); fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "unit variant {}::{}", self.type_name, self.variant_name) + write!( + formatter, + "unit variant {}::{}", + self.type_name, self.variant_name + ) } fn visit_seq(self, _: S) -> Result<(), S::Error> @@ -1890,7 +1922,11 @@ mod content { type Value = (); fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "unit variant {}::{}", self.type_name, self.variant_name) + write!( + formatter, + "unit variant {}::{}", + self.type_name, self.variant_name + ) } fn visit_unit(self) -> Result<(), E> @@ -2008,3 +2044,21 @@ where map struct enum identifier ignored_any } } + +/// A DeserializeSeed helper for implementing deserialize_in_place Visitors. +/// +/// Wraps a mutable reference and calls deserialize_in_place on it. +pub struct InPlaceSeed<'a, T: 'a>(pub &'a mut T); + +impl<'a, 'de, T> DeserializeSeed<'de> for InPlaceSeed<'a, T> +where + T: Deserialize<'de>, +{ + type Value = (); + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + T::deserialize_in_place(deserializer, self.0) + } +} diff --git a/src/vendor/serde/src/private/ser.rs b/src/vendor/serde/src/private/ser.rs index 3f60d7cd1f..932ebf4aef 100644 --- a/src/vendor/serde/src/private/ser.rs +++ b/src/vendor/serde/src/private/ser.rs @@ -8,10 +8,10 @@ use lib::*; -use ser::{self, Serialize, Serializer, SerializeMap, SerializeStruct, Impossible}; +use ser::{self, Impossible, Serialize, SerializeMap, SerializeStruct, Serializer}; #[cfg(any(feature = "std", feature = "alloc"))] -use self::content::{SerializeTupleVariantAsMapValue, SerializeStructVariantAsMapValue}; +use self::content::{SerializeStructVariantAsMapValue, SerializeTupleVariantAsMapValue}; /// Used to check that serde(getter) attributes return the expected type. /// Not public API. @@ -32,15 +32,13 @@ where S: Serializer, T: Serialize, { - value.serialize( - TaggedSerializer { - type_ident: type_ident, - variant_ident: variant_ident, - tag: tag, - variant_name: variant_name, - delegate: serializer, - }, - ) + value.serialize(TaggedSerializer { + type_ident: type_ident, + variant_ident: variant_ident, + tag: tag, + variant_name: variant_name, + delegate: serializer, + }) } struct TaggedSerializer { @@ -92,13 +90,10 @@ where S: Serializer, { fn bad_type(self, what: Unsupported) -> S::Error { - ser::Error::custom( - format_args!( + ser::Error::custom(format_args!( "cannot serialize tagged newtype variant {}::{} containing {}", - self.type_ident, - self.variant_ident, - what), - ) + self.type_ident, self.variant_ident, what + )) } } @@ -281,7 +276,11 @@ where let mut map = try!(self.delegate.serialize_map(Some(2))); try!(map.serialize_entry(self.tag, self.variant_name)); try!(map.serialize_key(inner_variant)); - Ok(SerializeTupleVariantAsMapValue::new(map, inner_variant, len),) + Ok(SerializeTupleVariantAsMapValue::new( + map, + inner_variant, + len, + )) } fn serialize_map(self, len: Option) -> Result { @@ -324,7 +323,11 @@ where let mut map = try!(self.delegate.serialize_map(Some(2))); try!(map.serialize_entry(self.tag, self.variant_name)); try!(map.serialize_key(inner_variant)); - Ok(SerializeStructVariantAsMapValue::new(map, inner_variant, len),) + Ok(SerializeStructVariantAsMapValue::new( + map, + inner_variant, + len, + )) } #[cfg(not(any(feature = "std", feature = "alloc")))] @@ -402,7 +405,10 @@ mod content { } fn end(mut self) -> Result { - try!(self.map.serialize_value(&Content::TupleStruct(self.name, self.fields))); + try!( + self.map + .serialize_value(&Content::TupleStruct(self.name, self.fields)) + ); self.map.end() } } @@ -444,7 +450,10 @@ mod content { } fn end(mut self) -> Result { - try!(self.map.serialize_value(&Content::Struct(self.name, self.fields))); + try!( + self.map + .serialize_value(&Content::Struct(self.name, self.fields)) + ); self.map.end() } } @@ -485,7 +494,12 @@ mod content { TupleVariant(&'static str, u32, &'static str, Vec), Map(Vec<(Content, Content)>), Struct(&'static str, Vec<(&'static str, Content)>), - StructVariant(&'static str, u32, &'static str, Vec<(&'static str, Content)>), + StructVariant( + &'static str, + u32, + &'static str, + Vec<(&'static str, Content)>, + ), } impl Serialize for Content { @@ -687,7 +701,10 @@ mod content { where T: Serialize, { - Ok(Content::NewtypeStruct(name, Box::new(try!(value.serialize(self)))),) + Ok(Content::NewtypeStruct( + name, + Box::new(try!(value.serialize(self))), + )) } fn serialize_newtype_variant( @@ -700,32 +717,26 @@ mod content { where T: Serialize, { - Ok( - Content::NewtypeVariant( - name, - variant_index, - variant, - Box::new(try!(value.serialize(self))), - ), - ) + Ok(Content::NewtypeVariant( + name, + variant_index, + variant, + Box::new(try!(value.serialize(self))), + )) } fn serialize_seq(self, len: Option) -> Result { - Ok( - SerializeSeq { - elements: Vec::with_capacity(len.unwrap_or(0)), - error: PhantomData, - }, - ) + Ok(SerializeSeq { + elements: Vec::with_capacity(len.unwrap_or(0)), + error: PhantomData, + }) } fn serialize_tuple(self, len: usize) -> Result { - Ok( - SerializeTuple { - elements: Vec::with_capacity(len), - error: PhantomData, - }, - ) + Ok(SerializeTuple { + elements: Vec::with_capacity(len), + error: PhantomData, + }) } fn serialize_tuple_struct( @@ -733,13 +744,11 @@ mod content { name: &'static str, len: usize, ) -> Result { - Ok( - SerializeTupleStruct { - name: name, - fields: Vec::with_capacity(len), - error: PhantomData, - }, - ) + Ok(SerializeTupleStruct { + name: name, + fields: Vec::with_capacity(len), + error: PhantomData, + }) } fn serialize_tuple_variant( @@ -749,25 +758,21 @@ mod content { variant: &'static str, len: usize, ) -> Result { - Ok( - SerializeTupleVariant { - name: name, - variant_index: variant_index, - variant: variant, - fields: Vec::with_capacity(len), - error: PhantomData, - }, - ) + Ok(SerializeTupleVariant { + name: name, + variant_index: variant_index, + variant: variant, + fields: Vec::with_capacity(len), + error: PhantomData, + }) } fn serialize_map(self, len: Option) -> Result { - Ok( - SerializeMap { - entries: Vec::with_capacity(len.unwrap_or(0)), - key: None, - error: PhantomData, - }, - ) + Ok(SerializeMap { + entries: Vec::with_capacity(len.unwrap_or(0)), + key: None, + error: PhantomData, + }) } fn serialize_struct( @@ -775,13 +780,11 @@ mod content { name: &'static str, len: usize, ) -> Result { - Ok( - SerializeStruct { - name: name, - fields: Vec::with_capacity(len), - error: PhantomData, - }, - ) + Ok(SerializeStruct { + name: name, + fields: Vec::with_capacity(len), + error: PhantomData, + }) } fn serialize_struct_variant( @@ -791,15 +794,13 @@ mod content { variant: &'static str, len: usize, ) -> Result { - Ok( - SerializeStructVariant { - name: name, - variant_index: variant_index, - variant: variant, - fields: Vec::with_capacity(len), - error: PhantomData, - }, - ) + Ok(SerializeStructVariant { + name: name, + variant_index: variant_index, + variant: variant, + fields: Vec::with_capacity(len), + error: PhantomData, + }) } } @@ -907,7 +908,12 @@ mod content { } fn end(self) -> Result { - Ok(Content::TupleVariant(self.name, self.variant_index, self.variant, self.fields),) + Ok(Content::TupleVariant( + self.name, + self.variant_index, + self.variant, + self.fields, + )) } } @@ -1013,7 +1019,12 @@ mod content { } fn end(self) -> Result { - Ok(Content::StructVariant(self.name, self.variant_index, self.variant, self.fields),) + Ok(Content::StructVariant( + self.name, + self.variant_index, + self.variant, + self.fields, + )) } } } diff --git a/src/vendor/serde/src/ser/impls.rs b/src/vendor/serde/src/ser/impls.rs index 3d124ab109..fcda834d94 100644 --- a/src/vendor/serde/src/ser/impls.rs +++ b/src/vendor/serde/src/ser/impls.rs @@ -464,7 +464,8 @@ impl Serialize for SystemTime { S: Serializer, { use super::SerializeStruct; - let duration_since_epoch = self.duration_since(UNIX_EPOCH).expect("SystemTime must be later than UNIX_EPOCH"); + let duration_since_epoch = self.duration_since(UNIX_EPOCH) + .expect("SystemTime must be later than UNIX_EPOCH"); let mut state = try!(serializer.serialize_struct("SystemTime", 2)); try!(state.serialize_field("secs_since_epoch", &duration_since_epoch.as_secs())); try!(state.serialize_field("nanos_since_epoch", &duration_since_epoch.subsec_nanos())); @@ -513,10 +514,12 @@ impl Serialize for net::IpAddr { } } else { match *self { - net::IpAddr::V4(ref a) => - serializer.serialize_newtype_variant("IpAddr", 0, "V4", a), - net::IpAddr::V6(ref a) => - serializer.serialize_newtype_variant("IpAddr", 1, "V6", a), + net::IpAddr::V4(ref a) => { + serializer.serialize_newtype_variant("IpAddr", 0, "V4", a) + } + net::IpAddr::V6(ref a) => { + serializer.serialize_newtype_variant("IpAddr", 1, "V6", a) + } } } } @@ -567,10 +570,12 @@ impl Serialize for net::SocketAddr { } } else { match *self { - net::SocketAddr::V4(ref addr) => - serializer.serialize_newtype_variant("SocketAddr", 0, "V4", addr), - net::SocketAddr::V6(ref addr) => - serializer.serialize_newtype_variant("SocketAddr", 1, "V6", addr), + net::SocketAddr::V4(ref addr) => { + serializer.serialize_newtype_variant("SocketAddr", 0, "V4", addr) + } + net::SocketAddr::V6(ref addr) => { + serializer.serialize_newtype_variant("SocketAddr", 1, "V6", addr) + } } } } @@ -600,7 +605,10 @@ impl Serialize for net::SocketAddrV6 { { if serializer.is_human_readable() { const MAX_LEN: usize = 47; - debug_assert_eq!(MAX_LEN, "[1001:1002:1003:1004:1005:1006:1007:1008]:65000".len()); + debug_assert_eq!( + MAX_LEN, + "[1001:1002:1003:1004:1005:1006:1007:1008]:65000".len() + ); serialize_display_bounded_length!(self, MAX_LEN, serializer) } else { (self.ip(), self.port()).serialize(serializer) diff --git a/src/vendor/serde/src/ser/impossible.rs b/src/vendor/serde/src/ser/impossible.rs index f72748f69b..af49d14dab 100644 --- a/src/vendor/serde/src/ser/impossible.rs +++ b/src/vendor/serde/src/ser/impossible.rs @@ -10,8 +10,8 @@ use lib::*; -use ser::{self, Serialize, SerializeSeq, SerializeTuple, SerializeTupleStruct, - SerializeTupleVariant, SerializeMap, SerializeStruct, SerializeStructVariant}; +use ser::{self, Serialize, SerializeMap, SerializeSeq, SerializeStruct, SerializeStructVariant, + SerializeTuple, SerializeTupleStruct, SerializeTupleVariant}; /// Helper type for implementing a `Serializer` that does not support /// serializing one of the compound types. diff --git a/src/vendor/serde/src/ser/mod.rs b/src/vendor/serde/src/ser/mod.rs index bd0a69edf7..e23ef04aaa 100644 --- a/src/vendor/serde/src/ser/mod.rs +++ b/src/vendor/serde/src/ser/mod.rs @@ -1412,7 +1412,9 @@ pub trait Serializer: Sized { /// change, as a value serialized in human-readable mode is not required to /// deserialize from the same data in compact mode. #[inline] - fn is_human_readable(&self) -> bool { true } + fn is_human_readable(&self) -> bool { + true + } } /// Returned from `Serializer::serialize_seq`. diff --git a/src/vendor/serde_derive/.cargo-checksum.json b/src/vendor/serde_derive/.cargo-checksum.json index 2a54c6e9b1..025c196899 100644 --- a/src/vendor/serde_derive/.cargo-checksum.json +++ b/src/vendor/serde_derive/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"7384df7c1137038845d48dc285b8072f6dd2a1ecbb4d52ed658336210344c407","Cargo.toml.orig":"37421129145d08f7e4b3fb56cd55f2c8fd684b54b9d456438d1afb5dd81f0500","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/bound.rs":"38d4b683e10516dbaeb40a18eab2ecf3dc9ceff3f29e17354d9d5138b3a164ad","src/de.rs":"3fd21a32dc1a6c1bc3d752ff658fe12a81aaba781204e9892298a0e5fc8d005e","src/fragment.rs":"f1642a1c2abbc36191206a5ec8077e314bdc20a420d7649e4bec3a69d555f78d","src/lib.rs":"9a2ce59545b258c7337615efd34c64cc080a3e371c752f872eb91788c01576a8","src/ser.rs":"cabdcbbf6627500922d41983520bfda417f66a4aa7072bc8acc71d36d5d88f7e"},"package":"652bc323d694dc925829725ec6c890156d8e70ae5202919869cb00fe2eff3788"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"7fc1a5ebad28e81beaa511168f8bd69c9e0cabdd0e427374383c752b36b6aea8","Cargo.toml.orig":"748ac712b5cbb88c7c04abc9520fb534a451ac6a14b47b3ca273eb4ba9426702","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/bound.rs":"b07c091fe3473a9c93c8044bb73eb2102cfdda4b41b9602335ac96fb323278ba","src/de.rs":"6b4ee24060a6925cf1222af32b551fd2e95d6c10d9526b6a6b6b72c267fe2815","src/fragment.rs":"5a63181171d4d05cea9f28d8ed27a550bc8ac176ee90a911a0598fbe340eec1a","src/lib.rs":"0f289baf8940e2c149fecb9859a51bb302a75e031a91361abe4f332bf9bbcb51","src/ser.rs":"968343ac171fdb0114e15f8455706bc42b30951bdddeef8dff5d143fc7a1849b"},"package":"ec0bfa6c5784e7d110514448da0e1dbad41ea5514c3e68be755b23858b83a399"} \ No newline at end of file diff --git a/src/vendor/serde_derive/Cargo.toml b/src/vendor/serde_derive/Cargo.toml index 0aeb66f1e5..b9ace002a7 100644 --- a/src/vendor/serde_derive/Cargo.toml +++ b/src/vendor/serde_derive/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "serde_derive" -version = "1.0.21" +version = "1.0.25" authors = ["Erick Tryzelaar ", "David Tolnay "] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" @@ -30,7 +30,7 @@ proc-macro = true version = "0.3.8" [dependencies.serde_derive_internals] -version = "=0.17.0" +version = "=0.18.1" default-features = false [dependencies.syn] @@ -38,5 +38,9 @@ version = "0.11" features = ["visit"] [dev-dependencies.serde] version = "1.0" + +[features] +default = [] +deserialize_in_place = [] [badges.travis-ci] repository = "serde-rs/serde" diff --git a/src/vendor/serde_derive/Cargo.toml.orig b/src/vendor/serde_derive/Cargo.toml.orig index fa2ec39b2f..1cffc4e863 100644 --- a/src/vendor/serde_derive/Cargo.toml.orig +++ b/src/vendor/serde_derive/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "serde_derive" -version = "1.0.21" # remember to update html_root_url +version = "1.0.25" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT/Apache-2.0" description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" @@ -14,13 +14,17 @@ include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE- [badges] travis-ci = { repository = "serde-rs/serde" } +[features] +default = [] +deserialize_in_place = [] + [lib] name = "serde_derive" proc-macro = true [dependencies] quote = "0.3.8" -serde_derive_internals = { version = "=0.17.0", default-features = false, path = "../serde_derive_internals" } +serde_derive_internals = { version = "=0.18.1", default-features = false, path = "../serde_derive_internals" } syn = { version = "0.11", features = ["visit"] } [dev-dependencies] diff --git a/src/vendor/serde_derive/src/bound.rs b/src/vendor/serde_derive/src/bound.rs index 5dc68a0f1d..98f8f47571 100644 --- a/src/vendor/serde_derive/src/bound.rs +++ b/src/vendor/serde_derive/src/bound.rs @@ -27,14 +27,10 @@ pub fn without_defaults(generics: &syn::Generics) -> syn::Generics { ty_params: generics .ty_params .iter() - .map( - |ty_param| { - syn::TyParam { - default: None, - ..ty_param.clone() - } - }, - ) + .map(|ty_param| syn::TyParam { + default: None, + ..ty_param.clone() + }) .collect(), ..generics.clone() } @@ -137,17 +133,15 @@ where relevant_ty_params: HashSet::new(), }; match cont.body { - Body::Enum(ref variants) => { - for variant in variants.iter() { - let relevant_fields = variant - .fields - .iter() - .filter(|field| filter(&field.attrs, Some(&variant.attrs))); - for field in relevant_fields { - visit::walk_ty(&mut visitor, field.ty); - } + Body::Enum(ref variants) => for variant in variants.iter() { + let relevant_fields = variant + .fields + .iter() + .filter(|field| filter(&field.attrs, Some(&variant.attrs))); + for field in relevant_fields { + visit::walk_ty(&mut visitor, field.ty); } - } + }, Body::Struct(_, ref fields) => { for field in fields.iter().filter(|field| filter(&field.attrs, None)) { visit::walk_ty(&mut visitor, field.ty); @@ -160,27 +154,23 @@ where .iter() .map(|ty_param| ty_param.ident.clone()) .filter(|id| visitor.relevant_ty_params.contains(id)) - .map( - |id| { - syn::WherePredicate::BoundPredicate( - syn::WhereBoundPredicate { - bound_lifetimes: Vec::new(), - // the type parameter that is being bounded e.g. T - bounded_ty: syn::Ty::Path(None, id.into()), - // the bound e.g. Serialize - bounds: vec![ - syn::TyParamBound::Trait( - syn::PolyTraitRef { - bound_lifetimes: Vec::new(), - trait_ref: bound.clone(), - }, - syn::TraitBoundModifier::None, - ), - ], - }, - ) - }, - ); + .map(|id| { + syn::WherePredicate::BoundPredicate(syn::WhereBoundPredicate { + bound_lifetimes: Vec::new(), + // the type parameter that is being bounded e.g. T + bounded_ty: syn::Ty::Path(None, id.into()), + // the bound e.g. Serialize + bounds: vec![ + syn::TyParamBound::Trait( + syn::PolyTraitRef { + bound_lifetimes: Vec::new(), + trait_ref: bound.clone(), + }, + syn::TraitBoundModifier::None, + ), + ], + }) + }); let mut generics = generics.clone(); generics.where_clause.predicates.extend(new_predicates); @@ -196,25 +186,23 @@ pub fn with_self_bound( generics .where_clause .predicates - .push( - syn::WherePredicate::BoundPredicate( - syn::WhereBoundPredicate { - bound_lifetimes: Vec::new(), - // the type that is being bounded e.g. MyStruct<'a, T> - bounded_ty: type_of_item(cont), - // the bound e.g. Default - bounds: vec![ - syn::TyParamBound::Trait( - syn::PolyTraitRef { - bound_lifetimes: Vec::new(), - trait_ref: bound.clone(), - }, - syn::TraitBoundModifier::None, - ), - ], - }, - ), - ); + .push(syn::WherePredicate::BoundPredicate( + syn::WhereBoundPredicate { + bound_lifetimes: Vec::new(), + // the type that is being bounded e.g. MyStruct<'a, T> + bounded_ty: type_of_item(cont), + // the bound e.g. Default + bounds: vec![ + syn::TyParamBound::Trait( + syn::PolyTraitRef { + bound_lifetimes: Vec::new(), + trait_ref: bound.clone(), + }, + syn::TraitBoundModifier::None, + ), + ], + }, + )); generics } @@ -231,15 +219,11 @@ pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Gen .push(syn::TyParamBound::Region(syn::Lifetime::new(lifetime))); } - generics - .lifetimes - .push( - syn::LifetimeDef { - attrs: Vec::new(), - lifetime: syn::Lifetime::new(lifetime), - bounds: Vec::new(), - }, - ); + generics.lifetimes.push(syn::LifetimeDef { + attrs: Vec::new(), + lifetime: syn::Lifetime::new(lifetime), + bounds: Vec::new(), + }); generics } diff --git a/src/vendor/serde_derive/src/de.rs b/src/vendor/serde_derive/src/de.rs index 71326b84f3..294d816882 100644 --- a/src/vendor/serde_derive/src/de.rs +++ b/src/vendor/serde_derive/src/de.rs @@ -7,10 +7,10 @@ // except according to those terms. use syn::{self, Ident}; -use quote::{self, Tokens, ToTokens}; +use quote::{self, ToTokens, Tokens}; use bound; -use fragment::{Fragment, Expr, Stmts, Match}; +use fragment::{Expr, Fragment, Match, Stmts}; use internals::ast::{Body, Container, Field, Style, Variant}; use internals::{self, attr}; @@ -40,6 +40,8 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result for #ident #ty_generics #where_clause { @@ -48,6 +50,8 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result syn::Generi attr::Default::Default => { bound::with_self_bound(cont, &generics, &path!(_serde::export::Default)) } - attr::Default::None | - attr::Default::Path(_) => generics, + attr::Default::None | attr::Default::Path(_) => generics, }; let delife = borrowed.de_lifetime(); @@ -152,10 +155,8 @@ fn build_generics(cont: &Container, borrowed: &BorrowedLifetimes) -> syn::Generi // attribute specify their own bound so we do not generate one. All other fields // may need a `T: Deserialize` bound where T is the type of the field. fn needs_deserialize_bound(field: &attr::Field, variant: Option<&attr::Variant>) -> bool { - !field.skip_deserializing() && - field.deserialize_with().is_none() && - field.de_bound().is_none() && - variant.map_or(true, |variant| variant.deserialize_with().is_none()) + !field.skip_deserializing() && field.deserialize_with().is_none() && field.de_bound().is_none() + && variant.map_or(true, |variant| variant.deserialize_with().is_none()) } // Fields with a `default` attribute (not `default=...`), and fields with a @@ -179,13 +180,11 @@ impl BorrowedLifetimes { fn de_lifetime_def(&self) -> Option { match *self { - BorrowedLifetimes::Borrowed(ref bounds) => { - Some(syn::LifetimeDef { - attrs: Vec::new(), - lifetime: syn::Lifetime::new("'de"), - bounds: bounds.iter().cloned().collect(), - }) - } + BorrowedLifetimes::Borrowed(ref bounds) => Some(syn::LifetimeDef { + attrs: Vec::new(), + lifetime: syn::Lifetime::new("'de"), + bounds: bounds.iter().cloned().collect(), + }), BorrowedLifetimes::Static => None, } } @@ -226,8 +225,7 @@ fn deserialize_body(cont: &Container, params: &Parameters) -> Fragment { } deserialize_struct(None, params, fields, &cont.attrs, None, Untagged::No) } - Body::Struct(Style::Tuple, ref fields) | - Body::Struct(Style::Newtype, ref fields) => { + Body::Struct(Style::Tuple, ref fields) | Body::Struct(Style::Newtype, ref fields) => { if fields.iter().any(|field| field.ident.is_some()) { panic!("tuple struct has named fields"); } @@ -245,6 +243,51 @@ fn deserialize_body(cont: &Container, params: &Parameters) -> Fragment { } } +#[cfg(feature = "deserialize_in_place")] +fn deserialize_in_place_body(cont: &Container, params: &Parameters) -> Option { + // Only remote derives have getters, and we do not generate + // deserialize_in_place for remote derives. + assert!(!params.has_getter); + + if cont.attrs.from_type().is_some() || cont.attrs.identifier().is_some() + || cont.body + .all_fields() + .all(|f| f.attrs.deserialize_with().is_some()) + { + return None; + } + + let code = match cont.body { + Body::Struct(Style::Struct, ref fields) => { + deserialize_struct_in_place(None, params, fields, &cont.attrs, None, Untagged::No) + } + Body::Struct(Style::Tuple, ref fields) | Body::Struct(Style::Newtype, ref fields) => { + deserialize_tuple_in_place(None, params, fields, &cont.attrs, None) + } + Body::Enum(_) | Body::Struct(Style::Unit, _) => { + return None; + } + }; + + let delife = params.borrowed.de_lifetime(); + let stmts = Stmts(code); + + let fn_deserialize_in_place = quote_block! { + fn deserialize_in_place<__D>(__deserializer: __D, __place: &mut Self) -> _serde::export::Result<(), __D::Error> + where __D: _serde::Deserializer<#delife> + { + #stmts + } + }; + + Some(Stmts(fn_deserialize_in_place)) +} + +#[cfg(not(feature = "deserialize_in_place"))] +fn deserialize_in_place_body(_cont: &Container, _params: &Parameters) -> Option { + None +} + fn deserialize_from(from_type: &syn::Ty) -> Fragment { quote_block! { _serde::export::Result::map( @@ -289,7 +332,8 @@ fn deserialize_tuple( deserializer: Option, ) -> Fragment { let this = ¶ms.this; - let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = split_with_de_lifetime(params,); + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); // If there are getters (implying private fields), construct the local type @@ -340,9 +384,7 @@ fn deserialize_tuple( quote!(_serde::Deserializer::deserialize_tuple_struct(__deserializer, #type_name, #nfields, #visitor_expr)) }; - let all_skipped = fields - .iter() - .all(|field| field.attrs.skip_deserializing()); + let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing()); let visitor_var = if all_skipped { quote!(_) } else { @@ -376,6 +418,92 @@ fn deserialize_tuple( } } +#[cfg(feature = "deserialize_in_place")] +fn deserialize_tuple_in_place( + variant_ident: Option<&syn::Ident>, + params: &Parameters, + fields: &[Field], + cattrs: &attr::Container, + deserializer: Option, +) -> Fragment { + let this = ¶ms.this; + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); + let delife = params.borrowed.de_lifetime(); + + let is_enum = variant_ident.is_some(); + let expecting = match variant_ident { + Some(variant_ident) => format!("tuple variant {}::{}", params.type_name(), variant_ident), + None => format!("tuple struct {}", params.type_name()), + }; + + let nfields = fields.len(); + + let visit_newtype_struct = if !is_enum && nfields == 1 { + Some(deserialize_newtype_struct_in_place(params, &fields[0])) + } else { + None + }; + + let visit_seq = Stmts(deserialize_seq_in_place(params, fields, cattrs)); + + let visitor_expr = quote! { + __Visitor { + place: __place, + lifetime: _serde::export::PhantomData, + } + }; + + let dispatch = if let Some(deserializer) = deserializer { + quote!(_serde::Deserializer::deserialize_tuple(#deserializer, #nfields, #visitor_expr)) + } else if is_enum { + quote!(_serde::de::VariantAccess::tuple_variant(__variant, #nfields, #visitor_expr)) + } else if nfields == 1 { + let type_name = cattrs.name().deserialize_name(); + quote!(_serde::Deserializer::deserialize_newtype_struct(__deserializer, #type_name, #visitor_expr)) + } else { + let type_name = cattrs.name().deserialize_name(); + quote!(_serde::Deserializer::deserialize_tuple_struct(__deserializer, #type_name, #nfields, #visitor_expr)) + }; + + let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing()); + let visitor_var = if all_skipped { + quote!(_) + } else { + quote!(mut __seq) + }; + + let in_place_impl_generics = de_impl_generics.in_place(); + let in_place_ty_generics = de_ty_generics.in_place(); + let place_life = place_lifetime(); + + quote_block! { + struct __Visitor #in_place_impl_generics #where_clause { + place: &#place_life mut #this #ty_generics, + lifetime: _serde::export::PhantomData<&#delife ()>, + } + + impl #in_place_impl_generics _serde::de::Visitor<#delife> for __Visitor #in_place_ty_generics #where_clause { + type Value = (); + + fn expecting(&self, formatter: &mut _serde::export::Formatter) -> _serde::export::fmt::Result { + _serde::export::Formatter::write_str(formatter, #expecting) + } + + #visit_newtype_struct + + #[inline] + fn visit_seq<__A>(self, #visitor_var: __A) -> _serde::export::Result + where __A: _serde::de::SeqAccess<#delife> + { + #visit_seq + } + } + + #dispatch + } +} + fn deserialize_seq( type_path: &Tokens, params: &Parameters, @@ -392,42 +520,40 @@ fn deserialize_seq( let expecting = format!("tuple of {} elements", deserialized_count); let mut index_in_seq = 0usize; - let let_values = vars.clone().zip(fields) - .map(|(var, field)| { - if field.attrs.skip_deserializing() { - let default = Expr(expr_is_missing(&field, cattrs)); - quote! { - let #var = #default; - } - } else { - let visit = match field.attrs.deserialize_with() { - None => { - let field_ty = &field.ty; - quote!(try!(_serde::de::SeqAccess::next_element::<#field_ty>(&mut __seq))) - } - Some(path) => { - let (wrapper, wrapper_ty) = wrap_deserialize_field_with( - params, field.ty, path); - quote!({ - #wrapper - _serde::export::Option::map( - try!(_serde::de::SeqAccess::next_element::<#wrapper_ty>(&mut __seq)), - |__wrap| __wrap.value) - }) - } - }; - let assign = quote! { - let #var = match #visit { - Some(__value) => __value, - None => { - return _serde::export::Err(_serde::de::Error::invalid_length(#index_in_seq, &#expecting)); - } - }; - }; - index_in_seq += 1; - assign + let let_values = vars.clone().zip(fields).map(|(var, field)| { + if field.attrs.skip_deserializing() { + let default = Expr(expr_is_missing(&field, cattrs)); + quote! { + let #var = #default; } - }); + } else { + let visit = match field.attrs.deserialize_with() { + None => { + let field_ty = &field.ty; + quote!(try!(_serde::de::SeqAccess::next_element::<#field_ty>(&mut __seq))) + } + Some(path) => { + let (wrapper, wrapper_ty) = wrap_deserialize_field_with(params, field.ty, path); + quote!({ + #wrapper + _serde::export::Option::map( + try!(_serde::de::SeqAccess::next_element::<#wrapper_ty>(&mut __seq)), + |__wrap| __wrap.value) + }) + } + }; + let assign = quote! { + let #var = match #visit { + _serde::export::Some(__value) => __value, + _serde::export::None => { + return _serde::export::Err(_serde::de::Error::invalid_length(#index_in_seq, &#expecting)); + } + }; + }; + index_in_seq += 1; + assign + } + }); let mut result = if is_struct { let names = fields.iter().map(|f| &f.ident); @@ -447,12 +573,115 @@ fn deserialize_seq( }; } + let let_default = match *cattrs.default() { + attr::Default::Default => Some(quote!( + let __default: Self::Value = _serde::export::Default::default(); + )), + attr::Default::Path(ref path) => Some(quote!( + let __default: Self::Value = #path(); + )), + attr::Default::None => { + // We don't need the default value, to prevent an unused variable warning + // we'll leave the line empty. + None + } + }; + quote_block! { + #let_default #(#let_values)* _serde::export::Ok(#result) } } +#[cfg(feature = "deserialize_in_place")] +fn deserialize_seq_in_place( + params: &Parameters, + fields: &[Field], + cattrs: &attr::Container, +) -> Fragment { + let vars = (0..fields.len()).map(field_i as fn(_) -> _); + + let deserialized_count = fields + .iter() + .filter(|field| !field.attrs.skip_deserializing()) + .count(); + let expecting = format!("tuple of {} elements", deserialized_count); + + let mut index_in_seq = 0usize; + let write_values = vars.clone() + .zip(fields) + .enumerate() + .map(|(field_index, (_, field))| { + // If there's no field name, assume we're a tuple-struct and use a numeric index + let field_name = field + .ident + .clone() + .unwrap_or_else(|| Ident::new(field_index.to_string())); + + if field.attrs.skip_deserializing() { + let default = Expr(expr_is_missing(&field, cattrs)); + quote! { + self.place.#field_name = #default; + } + } else { + let return_invalid_length = quote! { + return _serde::export::Err(_serde::de::Error::invalid_length(#index_in_seq, &#expecting)); + }; + let write = match field.attrs.deserialize_with() { + None => { + quote! { + if let _serde::export::None = try!(_serde::de::SeqAccess::next_element_seed(&mut __seq, + _serde::private::de::InPlaceSeed(&mut self.place.#field_name))) + { + #return_invalid_length + } + } + } + Some(path) => { + let (wrapper, wrapper_ty) = + wrap_deserialize_field_with(params, field.ty, path); + quote!({ + #wrapper + match try!(_serde::de::SeqAccess::next_element::<#wrapper_ty>(&mut __seq)) { + _serde::export::Some(__wrap) => { + self.place.#field_name = __wrap.value; + } + _serde::export::None => { + #return_invalid_length + } + } + }) + } + }; + index_in_seq += 1; + write + } + }); + + let this = ¶ms.this; + let (_, ty_generics, _) = params.generics.split_for_impl(); + let let_default = match *cattrs.default() { + attr::Default::Default => Some(quote!( + let __default: #this #ty_generics = _serde::export::Default::default(); + )), + attr::Default::Path(ref path) => Some(quote!( + let __default: #this #ty_generics = #path(); + )), + attr::Default::None => { + // We don't need the default value, to prevent an unused variable warning + // we'll leave the line empty. + None + } + }; + + quote_block! { + #let_default + #(#write_values)* + _serde::export::Ok(()) + } +} + fn deserialize_newtype_struct(type_path: &Tokens, params: &Parameters, field: &Field) -> Tokens { let delife = params.borrowed.de_lifetime(); @@ -490,6 +719,23 @@ fn deserialize_newtype_struct(type_path: &Tokens, params: &Parameters, field: &F } } +#[cfg(feature = "deserialize_in_place")] +fn deserialize_newtype_struct_in_place(params: &Parameters, field: &Field) -> Tokens { + // We do not generate deserialize_in_place if every field has a deserialize_with. + assert!(field.attrs.deserialize_with().is_none()); + + let delife = params.borrowed.de_lifetime(); + + quote! { + #[inline] + fn visit_newtype_struct<__E>(self, __e: __E) -> _serde::export::Result + where __E: _serde::Deserializer<#delife> + { + _serde::Deserialize::deserialize_in_place(__e, &mut self.place.0) + } + } +} + enum Untagged { Yes, No, @@ -506,7 +752,8 @@ fn deserialize_struct( let is_enum = variant_ident.is_some(); let this = ¶ms.this; - let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = split_with_de_lifetime(params,); + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); // If there are getters (implying private fields), construct the local type @@ -557,9 +804,7 @@ fn deserialize_struct( } }; - let all_skipped = fields - .iter() - .all(|field| field.attrs.skip_deserializing()); + let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing()); let visitor_var = if all_skipped { quote!(_) } else { @@ -569,16 +814,14 @@ fn deserialize_struct( // untagged struct variants do not get a visit_seq method let visit_seq = match untagged { Untagged::Yes => None, - Untagged::No => { - Some(quote! { - #[inline] - fn visit_seq<__A>(self, #visitor_var: __A) -> _serde::export::Result - where __A: _serde::de::SeqAccess<#delife> - { - #visit_seq - } - }) - } + Untagged::No => Some(quote! { + #[inline] + fn visit_seq<__A>(self, #visitor_var: __A) -> _serde::export::Result + where __A: _serde::de::SeqAccess<#delife> + { + #visit_seq + } + }), }; quote_block! { @@ -612,6 +855,111 @@ fn deserialize_struct( } } +#[cfg(feature = "deserialize_in_place")] +fn deserialize_struct_in_place( + variant_ident: Option<&syn::Ident>, + params: &Parameters, + fields: &[Field], + cattrs: &attr::Container, + deserializer: Option, + untagged: Untagged, +) -> Fragment { + let is_enum = variant_ident.is_some(); + + let this = ¶ms.this; + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); + let delife = params.borrowed.de_lifetime(); + + let expecting = match variant_ident { + Some(variant_ident) => format!("struct variant {}::{}", params.type_name(), variant_ident), + None => format!("struct {}", params.type_name()), + }; + + let visit_seq = Stmts(deserialize_seq_in_place(params, fields, cattrs)); + + let (field_visitor, fields_stmt, visit_map) = + deserialize_struct_in_place_visitor(params, fields, cattrs); + let field_visitor = Stmts(field_visitor); + let fields_stmt = Stmts(fields_stmt); + let visit_map = Stmts(visit_map); + + let visitor_expr = quote! { + __Visitor { + place: __place, + lifetime: _serde::export::PhantomData, + } + }; + let dispatch = if let Some(deserializer) = deserializer { + quote! { + _serde::Deserializer::deserialize_any(#deserializer, #visitor_expr) + } + } else if is_enum { + quote! { + _serde::de::VariantAccess::struct_variant(__variant, FIELDS, #visitor_expr) + } + } else { + let type_name = cattrs.name().deserialize_name(); + quote! { + _serde::Deserializer::deserialize_struct(__deserializer, #type_name, FIELDS, #visitor_expr) + } + }; + + let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing()); + let visitor_var = if all_skipped { + quote!(_) + } else { + quote!(mut __seq) + }; + + // untagged struct variants do not get a visit_seq method + let visit_seq = match untagged { + Untagged::Yes => None, + Untagged::No => Some(quote! { + #[inline] + fn visit_seq<__A>(self, #visitor_var: __A) -> _serde::export::Result + where __A: _serde::de::SeqAccess<#delife> + { + #visit_seq + } + }), + }; + + let in_place_impl_generics = de_impl_generics.in_place(); + let in_place_ty_generics = de_ty_generics.in_place(); + let place_life = place_lifetime(); + + quote_block! { + #field_visitor + + struct __Visitor #in_place_impl_generics #where_clause { + place: &#place_life mut #this #ty_generics, + lifetime: _serde::export::PhantomData<&#delife ()>, + } + + impl #in_place_impl_generics _serde::de::Visitor<#delife> for __Visitor #in_place_ty_generics #where_clause { + type Value = (); + + fn expecting(&self, formatter: &mut _serde::export::Formatter) -> _serde::export::fmt::Result { + _serde::export::Formatter::write_str(formatter, #expecting) + } + + #visit_seq + + #[inline] + fn visit_map<__A>(self, mut __map: __A) -> _serde::export::Result + where __A: _serde::de::MapAccess<#delife> + { + #visit_map + } + } + + #fields_stmt + + #dispatch + } +} + fn deserialize_enum( params: &Parameters, variants: &[Variant], @@ -636,7 +984,8 @@ fn deserialize_externally_tagged_enum( cattrs: &attr::Container, ) -> Fragment { let this = ¶ms.this; - let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = split_with_de_lifetime(params,); + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); let type_name = cattrs.name().deserialize_name(); @@ -647,7 +996,7 @@ fn deserialize_externally_tagged_enum( .iter() .enumerate() .filter(|&(_, variant)| !variant.attrs.skip_deserializing()) - .map(|(i, variant)| (variant.attrs.name().deserialize_name(), field_i(i)),) + .map(|(i, variant)| (variant.attrs.name().deserialize_name(), field_i(i))) .collect(); let variants_stmt = { @@ -657,24 +1006,30 @@ fn deserialize_externally_tagged_enum( } }; - let variant_visitor = Stmts(deserialize_generated_identifier(variant_names_idents, cattrs, true),); + let variant_visitor = Stmts(deserialize_generated_identifier( + variant_names_idents, + cattrs, + true, + )); // Match arms to extract a variant from a string let variant_arms = variants .iter() .enumerate() .filter(|&(_, variant)| !variant.attrs.skip_deserializing()) - .map( - |(i, variant)| { - let variant_name = field_i(i); + .map(|(i, variant)| { + let variant_name = field_i(i); - let block = Match(deserialize_externally_tagged_variant(params, variant, cattrs),); + let block = Match(deserialize_externally_tagged_variant( + params, + variant, + cattrs, + )); - quote! { - (__Field::#variant_name, __variant) => #block - } - }, - ); + quote! { + (__Field::#variant_name, __variant) => #block + } + }); let all_skipped = variants .iter() @@ -740,7 +1095,7 @@ fn deserialize_internally_tagged_enum( .iter() .enumerate() .filter(|&(_, variant)| !variant.attrs.skip_deserializing()) - .map(|(i, variant)| (variant.attrs.name().deserialize_name(), field_i(i)),) + .map(|(i, variant)| (variant.attrs.name().deserialize_name(), field_i(i))) .collect(); let variants_stmt = { @@ -750,10 +1105,15 @@ fn deserialize_internally_tagged_enum( } }; - let variant_visitor = Stmts(deserialize_generated_identifier(variant_names_idents, cattrs, true),); + let variant_visitor = Stmts(deserialize_generated_identifier( + variant_names_idents, + cattrs, + true, + )); // Match arms to extract a variant from a string - let variant_arms = variants.iter() + let variant_arms = variants + .iter() .enumerate() .filter(|&(_, variant)| !variant.attrs.skip_deserializing()) .map(|(i, variant)| { @@ -763,7 +1123,9 @@ fn deserialize_internally_tagged_enum( params, variant, cattrs, - quote!(_serde::private::de::ContentDeserializer::<__D::Error>::new(__tagged.content)), + quote!( + _serde::private::de::ContentDeserializer::<__D::Error>::new(__tagged.content) + ), )); quote! { @@ -794,14 +1156,15 @@ fn deserialize_adjacently_tagged_enum( content: &str, ) -> Fragment { let this = ¶ms.this; - let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = split_with_de_lifetime(params,); + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); let variant_names_idents: Vec<_> = variants .iter() .enumerate() .filter(|&(_, variant)| !variant.attrs.skip_deserializing()) - .map(|(i, variant)| (variant.attrs.name().deserialize_name(), field_i(i)),) + .map(|(i, variant)| (variant.attrs.name().deserialize_name(), field_i(i))) .collect(); let variants_stmt = { @@ -811,30 +1174,30 @@ fn deserialize_adjacently_tagged_enum( } }; - let variant_visitor = Stmts(deserialize_generated_identifier(variant_names_idents, cattrs, true),); + let variant_visitor = Stmts(deserialize_generated_identifier( + variant_names_idents, + cattrs, + true, + )); let ref variant_arms: Vec<_> = variants .iter() .enumerate() .filter(|&(_, variant)| !variant.attrs.skip_deserializing()) - .map( - |(i, variant)| { - let variant_index = field_i(i); + .map(|(i, variant)| { + let variant_index = field_i(i); - let block = Match( - deserialize_untagged_variant( - params, - variant, - cattrs, - quote!(__deserializer), - ), - ); + let block = Match(deserialize_untagged_variant( + params, + variant, + cattrs, + quote!(__deserializer), + )); - quote! { - __Field::#variant_index => #block - } - }, - ) + quote! { + __Field::#variant_index => #block + } + }) .collect(); let expecting = format!("adjacently tagged enum {}", params.type_name()); @@ -870,25 +1233,21 @@ fn deserialize_adjacently_tagged_enum( let fallthrough = if variants.iter().all(is_unit) { None } else { - Some( - quote! { - _ => #missing_content - }, - ) + Some(quote! { + _ => #missing_content + }) }; let arms = variants .iter() .enumerate() - .filter(|&(_, variant)| !variant.attrs.skip_deserializing() && is_unit(variant),) - .map( - |(i, variant)| { - let variant_index = field_i(i); - let variant_ident = &variant.ident; - quote! { - __Field::#variant_index => _serde::export::Ok(#this::#variant_ident), - } - }, - ); + .filter(|&(_, variant)| !variant.attrs.skip_deserializing() && is_unit(variant)) + .map(|(i, variant)| { + let variant_index = field_i(i); + let variant_ident = &variant.ident; + quote! { + __Field::#variant_index => _serde::export::Ok(#this::#variant_ident), + } + }); missing_content = quote! { match __field { #(#arms)* @@ -907,29 +1266,27 @@ fn deserialize_adjacently_tagged_enum( let next_relevant_key = if deny_unknown_fields { next_key } else { - quote! { - { - let mut __rk : _serde::export::Option<_serde::private::de::TagOrContentField> = _serde::export::None; - while let _serde::export::Some(__k) = #next_key { - match __k { - _serde::private::de::TagContentOtherField::Other => { - try!(_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)); - continue; - }, - _serde::private::de::TagContentOtherField::Tag => { - __rk = _serde::export::Some(_serde::private::de::TagOrContentField::Tag); - break; - } - _serde::private::de::TagContentOtherField::Content => { - __rk = _serde::export::Some(_serde::private::de::TagOrContentField::Content); - break; - } + quote!({ + let mut __rk : _serde::export::Option<_serde::private::de::TagOrContentField> = _serde::export::None; + while let _serde::export::Some(__k) = #next_key { + match __k { + _serde::private::de::TagContentOtherField::Other => { + try!(_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)); + continue; + }, + _serde::private::de::TagContentOtherField::Tag => { + __rk = _serde::export::Some(_serde::private::de::TagOrContentField::Tag); + break; + } + _serde::private::de::TagContentOtherField::Content => { + __rk = _serde::export::Some(_serde::private::de::TagOrContentField::Content); + break; } } - - __rk } - } + + __rk + }) }; // Step through remaining keys, looking for duplicates of previously-seen @@ -1091,16 +1448,14 @@ fn deserialize_untagged_enum( let attempts = variants .iter() .filter(|variant| !variant.attrs.skip_deserializing()) - .map( - |variant| { - Expr(deserialize_untagged_variant( + .map(|variant| { + Expr(deserialize_untagged_variant( params, variant, cattrs, quote!(_serde::private::de::ContentRefDeserializer::<__D::Error>::new(&__content)), )) - }, - ); + }); // TODO this message could be better by saving the errors from the failed // attempts. The heuristic used by TOML was to count the number of fields @@ -1108,8 +1463,10 @@ fn deserialize_untagged_enum( // largest number of fields. I'm not sure I like that. Maybe it would be // better to save all the errors and combine them into one message that // explains why none of the variants matched. - let fallthrough_msg = - format!("data did not match any variant of untagged enum {}", params.type_name()); + let fallthrough_msg = format!( + "data did not match any variant of untagged enum {}", + params.type_name() + ); quote_block! { let __content = try!(<_serde::private::de::Content as _serde::Deserialize>::deserialize(__deserializer)); @@ -1155,9 +1512,14 @@ fn deserialize_externally_tagged_variant( Style::Tuple => { deserialize_tuple(Some(variant_ident), params, &variant.fields, cattrs, None) } - Style::Struct => { - deserialize_struct(Some(variant_ident), params, &variant.fields, cattrs, None, Untagged::No) - } + Style::Struct => deserialize_struct( + Some(variant_ident), + params, + &variant.fields, + cattrs, + None, + Untagged::No, + ), } } @@ -1183,24 +1545,20 @@ fn deserialize_internally_tagged_variant( _serde::export::Ok(#this::#variant_ident) } } - Style::Newtype => { - deserialize_untagged_newtype_variant( - variant_ident, - params, - &variant.fields[0], - deserializer, - ) - } - Style::Struct => { - deserialize_struct( - Some(variant_ident), - params, - &variant.fields, - cattrs, - Some(deserializer), - Untagged::No, - ) - } + Style::Newtype => deserialize_untagged_newtype_variant( + variant_ident, + params, + &variant.fields[0], + deserializer, + ), + Style::Struct => deserialize_struct( + Some(variant_ident), + params, + &variant.fields, + cattrs, + Some(deserializer), + Untagged::No, + ), Style::Tuple => unreachable!("checked in serde_derive_internals"), } } @@ -1237,33 +1595,27 @@ fn deserialize_untagged_variant( |()| #this::#variant_ident) } } - Style::Newtype => { - deserialize_untagged_newtype_variant( - variant_ident, - params, - &variant.fields[0], - deserializer, - ) - } - Style::Tuple => { - deserialize_tuple( - Some(variant_ident), - params, - &variant.fields, - cattrs, - Some(deserializer), - ) - } - Style::Struct => { - deserialize_struct( - Some(variant_ident), - params, - &variant.fields, - cattrs, - Some(deserializer), - Untagged::Yes, - ) - } + Style::Newtype => deserialize_untagged_newtype_variant( + variant_ident, + params, + &variant.fields[0], + deserializer, + ), + Style::Tuple => deserialize_tuple( + Some(variant_ident), + params, + &variant.fields, + cattrs, + Some(deserializer), + ), + Style::Struct => deserialize_struct( + Some(variant_ident), + params, + &variant.fields, + cattrs, + Some(deserializer), + Untagged::Yes, + ), } } @@ -1338,7 +1690,12 @@ fn deserialize_generated_identifier( (Some(ignore_variant), Some(fallthrough)) }; - let visitor_impl = Stmts(deserialize_identifier(this, &fields, is_variant, fallthrough),); + let visitor_impl = Stmts(deserialize_identifier( + this, + &fields, + is_variant, + fallthrough, + )); quote_block! { #[allow(non_camel_case_types)] @@ -1404,7 +1761,12 @@ fn deserialize_custom_identifier( let names_idents: Vec<_> = ordinary .iter() - .map(|variant| (variant.attrs.name().deserialize_name(), variant.ident.clone()),) + .map(|variant| { + ( + variant.attrs.name().deserialize_name(), + variant.ident.clone(), + ) + }) .collect(); let names = names_idents.iter().map(|&(ref name, _)| name); @@ -1423,10 +1785,15 @@ fn deserialize_custom_identifier( Some(fields) }; - let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = split_with_de_lifetime(params,); + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); - let visitor_impl = - Stmts(deserialize_identifier(this.clone(), &names_idents, is_variant, fallthrough),); + let visitor_impl = Stmts(deserialize_identifier( + this.clone(), + &names_idents, + is_variant, + fallthrough, + )); quote_block! { #names_const @@ -1460,9 +1827,9 @@ fn deserialize_identifier( let field_bytes = fields.iter().map(|&(ref name, _)| quote::ByteStr(name)); let constructors: &Vec<_> = &fields - .iter() - .map(|&(_, ref ident)| quote!(#this::#ident)) - .collect(); + .iter() + .map(|&(_, ref ident)| quote!(#this::#ident)) + .collect(); let expecting = if is_variant { "variant identifier" @@ -1470,11 +1837,7 @@ fn deserialize_identifier( "field identifier" }; - let index_expecting = if is_variant { - "variant" - } else { - "field" - }; + let index_expecting = if is_variant { "variant" } else { "field" }; let variant_indices = 0u64..; let fallthrough_msg = format!("{} index 0 <= i < {}", index_expecting, fields.len()); @@ -1558,7 +1921,7 @@ fn deserialize_struct_visitor( .iter() .enumerate() .filter(|&(_, field)| !field.attrs.skip_deserializing()) - .map(|(i, field)| (field.attrs.name().deserialize_name(), field_i(i)),) + .map(|(i, field)| (field.attrs.name().deserialize_name(), field_i(i))) .collect(); let fields_stmt = { @@ -1592,17 +1955,16 @@ fn deserialize_map( let let_values = fields_names .iter() .filter(|&&(field, _)| !field.attrs.skip_deserializing()) - .map( - |&(field, ref name)| { - let field_ty = &field.ty; - quote! { - let mut #name: _serde::export::Option<#field_ty> = _serde::export::None; - } - }, - ); + .map(|&(field, ref name)| { + let field_ty = &field.ty; + quote! { + let mut #name: _serde::export::Option<#field_ty> = _serde::export::None; + } + }); // Match arms to extract a value for a field. - let value_arms = fields_names.iter() + let value_arms = fields_names + .iter() .filter(|&&(field, _)| !field.attrs.skip_deserializing()) .map(|&(field, ref name)| { let deser_name = field.attrs.name().deserialize_name(); @@ -1615,8 +1977,7 @@ fn deserialize_map( } } Some(path) => { - let (wrapper, wrapper_ty) = wrap_deserialize_field_with( - params, field.ty, path); + let (wrapper, wrapper_ty) = wrap_deserialize_field_with(params, field.ty, path); quote!({ #wrapper try!(_serde::de::MapAccess::next_value::<#wrapper_ty>(&mut __map)).value @@ -1642,9 +2003,7 @@ fn deserialize_map( }) }; - let all_skipped = fields - .iter() - .all(|field| field.attrs.skip_deserializing()); + let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing()); let match_keys = if cattrs.deny_unknown_fields() && all_skipped { quote! { // FIXME: Once we drop support for Rust 1.15: @@ -1667,51 +2026,34 @@ fn deserialize_map( let extract_values = fields_names .iter() .filter(|&&(field, _)| !field.attrs.skip_deserializing()) - .map( - |&(field, ref name)| { - let missing_expr = Match(expr_is_missing(&field, cattrs)); + .map(|&(field, ref name)| { + let missing_expr = Match(expr_is_missing(&field, cattrs)); - quote! { - let #name = match #name { - _serde::export::Some(#name) => #name, - _serde::export::None => #missing_expr - }; - } - }, - ); + quote! { + let #name = match #name { + _serde::export::Some(#name) => #name, + _serde::export::None => #missing_expr + }; + } + }); - let result = fields_names - .iter() - .map( - |&(field, ref name)| { - let ident = field - .ident - .clone() - .expect("struct contains unnamed fields"); - if field.attrs.skip_deserializing() { - let value = Expr(expr_is_missing(&field, cattrs)); - quote!(#ident: #value) - } else { - quote!(#ident: #name) - } - }, - ); + let result = fields_names.iter().map(|&(field, ref name)| { + let ident = field.ident.clone().expect("struct contains unnamed fields"); + if field.attrs.skip_deserializing() { + let value = Expr(expr_is_missing(&field, cattrs)); + quote!(#ident: #value) + } else { + quote!(#ident: #name) + } + }); let let_default = match *cattrs.default() { - attr::Default::Default => { - Some( - quote!( - let __default: Self::Value = _serde::export::Default::default(); - ), - ) - } - attr::Default::Path(ref path) => { - Some( - quote!( - let __default: Self::Value = #path(); - ), - ) - } + attr::Default::Default => Some(quote!( + let __default: Self::Value = _serde::export::Default::default(); + )), + attr::Default::Path(ref path) => Some(quote!( + let __default: Self::Value = #path(); + )), attr::Default::None => { // We don't need the default value, to prevent an unused variable warning // we'll leave the line empty. @@ -1740,6 +2082,175 @@ fn deserialize_map( } } +#[cfg(feature = "deserialize_in_place")] +fn deserialize_struct_in_place_visitor( + params: &Parameters, + fields: &[Field], + cattrs: &attr::Container, +) -> (Fragment, Fragment, Fragment) { + let field_names_idents: Vec<_> = fields + .iter() + .enumerate() + .filter(|&(_, field)| !field.attrs.skip_deserializing()) + .map(|(i, field)| (field.attrs.name().deserialize_name(), field_i(i))) + .collect(); + + let fields_stmt = { + let field_names = field_names_idents.iter().map(|&(ref name, _)| name); + quote_block! { + const FIELDS: &'static [&'static str] = &[ #(#field_names),* ]; + } + }; + + let field_visitor = deserialize_generated_identifier(field_names_idents, cattrs, false); + + let visit_map = deserialize_map_in_place(params, fields, cattrs); + + (field_visitor, fields_stmt, visit_map) +} + +#[cfg(feature = "deserialize_in_place")] +fn deserialize_map_in_place( + params: &Parameters, + fields: &[Field], + cattrs: &attr::Container, +) -> Fragment { + // Create the field names for the fields. + let fields_names: Vec<_> = fields + .iter() + .enumerate() + .map(|(i, field)| (field, field_i(i))) + .collect(); + + // For deserialize_in_place, declare booleans for each field that will be deserialized. + let let_flags = fields_names + .iter() + .filter(|&&(field, _)| !field.attrs.skip_deserializing()) + .map(|&(_, ref name)| { + quote! { + let mut #name: bool = false; + } + }); + + // Match arms to extract a value for a field. + let value_arms_from = fields_names + .iter() + .filter(|&&(field, _)| !field.attrs.skip_deserializing()) + .map(|&(field, ref name)| { + let deser_name = field.attrs.name().deserialize_name(); + let field_name = &field.ident; + + let visit = match field.attrs.deserialize_with() { + None => { + quote! { + try!(_serde::de::MapAccess::next_value_seed(&mut __map, _serde::private::de::InPlaceSeed(&mut self.place.#field_name))) + } + } + Some(path) => { + let (wrapper, wrapper_ty) = wrap_deserialize_field_with(params, field.ty, path); + quote!({ + #wrapper + self.place.#field_name = try!(_serde::de::MapAccess::next_value::<#wrapper_ty>(&mut __map)).value + }) + } + }; + quote! { + __Field::#name => { + if #name { + return _serde::export::Err(<__A::Error as _serde::de::Error>::duplicate_field(#deser_name)); + } + #visit; + #name = true; + } + } + }); + + // Visit ignored values to consume them + let ignored_arm = if cattrs.deny_unknown_fields() { + None + } else { + Some(quote! { + _ => { let _ = try!(_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)); } + }) + }; + + let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing()); + + let match_keys = if cattrs.deny_unknown_fields() && all_skipped { + quote! { + // FIXME: Once we drop support for Rust 1.15: + // let _serde::export::None::<__Field> = try!(_serde::de::MapAccess::next_key(&mut __map)); + _serde::export::Option::map( + try!(_serde::de::MapAccess::next_key::<__Field>(&mut __map)), + |__impossible| match __impossible {}); + } + } else { + quote! { + while let _serde::export::Some(__key) = try!(_serde::de::MapAccess::next_key::<__Field>(&mut __map)) { + match __key { + #(#value_arms_from)* + #ignored_arm + } + } + } + }; + + let check_flags = fields_names + .iter() + .filter(|&&(field, _)| !field.attrs.skip_deserializing()) + .map(|&(field, ref name)| { + let missing_expr = expr_is_missing(&field, cattrs); + // If missing_expr unconditionally returns an error, don't try + // to assign its value to self.place. Maybe this could be handled + // more elegantly. + if missing_expr.as_ref().as_str().starts_with("return ") { + let missing_expr = Stmts(missing_expr); + quote! { + if !#name { + #missing_expr; + } + } + } else { + let field_name = &field.ident; + let missing_expr = Expr(missing_expr); + quote! { + if !#name { + self.place.#field_name = #missing_expr; + }; + } + } + }); + + let this = ¶ms.this; + let (_, _, ty_generics, _) = split_with_de_lifetime(params); + + let let_default = match *cattrs.default() { + attr::Default::Default => Some(quote!( + let __default: #this #ty_generics = _serde::export::Default::default(); + )), + attr::Default::Path(ref path) => Some(quote!( + let __default: #this #ty_generics = #path(); + )), + attr::Default::None => { + // We don't need the default value, to prevent an unused variable warning + // we'll leave the line empty. + None + } + }; + + quote_block! { + #(#let_flags)* + + #match_keys + + #let_default + + #(#check_flags)* + + _serde::export::Ok(()) + } +} + fn field_i(i: usize) -> Ident { Ident::new(format!("__field{}", i)) } @@ -1752,7 +2263,8 @@ fn wrap_deserialize_with( deserialize_with: &syn::Path, ) -> (Tokens, Tokens) { let this = ¶ms.this; - let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = split_with_de_lifetime(params,); + let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = + split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); let wrapper = quote! { @@ -1803,40 +2315,29 @@ fn wrap_deserialize_variant_with( let field_access = (0..variant.fields.len()).map(|n| Ident::new(format!("{}", n))); let unwrap_fn = match variant.style { Style::Struct => { - let field_idents = variant.fields.iter().map(|field| field.ident.as_ref().unwrap()); - quote! { - { - |__wrap| { - #this::#variant_ident { #(#field_idents: __wrap.value.#field_access),* } - } + let field_idents = variant + .fields + .iter() + .map(|field| field.ident.as_ref().unwrap()); + quote!({ + |__wrap| { + #this::#variant_ident { #(#field_idents: __wrap.value.#field_access),* } } - } + }) } - Style::Tuple => { - quote! { - { - |__wrap| { - #this::#variant_ident(#(__wrap.value.#field_access),*) - } - } + Style::Tuple => quote!({ + |__wrap| { + #this::#variant_ident(#(__wrap.value.#field_access),*) } - } - Style::Newtype => { - quote! { - { - |__wrap| { - #this::#variant_ident(__wrap.value) - } - } + }), + Style::Newtype => quote!({ + |__wrap| { + #this::#variant_ident(__wrap.value) } - } - Style::Unit => { - quote! { - { - |__wrap| { #this::#variant_ident } - } - } - } + }), + Style::Unit => quote!({ + |__wrap| { #this::#variant_ident } + }), }; (wrapper, wrapper_ty, unwrap_fn) @@ -1854,8 +2355,7 @@ fn expr_is_missing(field: &Field, cattrs: &attr::Container) -> Fragment { } match *cattrs.default() { - attr::Default::Default | - attr::Default::Path(_) => { + attr::Default::Default | attr::Default::Path(_) => { let ident = &field.ident; return quote_expr!(__default.#ident); } @@ -1878,6 +2378,8 @@ fn expr_is_missing(field: &Field, cattrs: &attr::Container) -> Fragment { } struct DeImplGenerics<'a>(&'a Parameters); +#[cfg(feature = "deserialize_in_place")] +struct InPlaceImplGenerics<'a>(&'a Parameters); impl<'a> ToTokens for DeImplGenerics<'a> { fn to_tokens(&self, tokens: &mut Tokens) { @@ -1890,23 +2392,86 @@ impl<'a> ToTokens for DeImplGenerics<'a> { } } +#[cfg(feature = "deserialize_in_place")] +impl<'a> ToTokens for InPlaceImplGenerics<'a> { + fn to_tokens(&self, tokens: &mut Tokens) { + let place_lifetime = place_lifetime(); + let mut generics = self.0.generics.clone(); + + // Add lifetime for `&'place mut Self, and `'a: 'place` + for lifetime in &mut generics.lifetimes { + lifetime.bounds.push(place_lifetime.lifetime.clone()); + } + for generic in &mut generics.ty_params { + generic + .bounds + .push(syn::TyParamBound::Region(place_lifetime.lifetime.clone())); + } + generics.lifetimes.insert(0, place_lifetime); + if let Some(de_lifetime) = self.0.borrowed.de_lifetime_def() { + generics.lifetimes.insert(0, de_lifetime); + } + let (impl_generics, _, _) = generics.split_for_impl(); + impl_generics.to_tokens(tokens); + } +} + +#[cfg(feature = "deserialize_in_place")] +impl<'a> DeImplGenerics<'a> { + fn in_place(self) -> InPlaceImplGenerics<'a> { + InPlaceImplGenerics(self.0) + } +} + struct DeTyGenerics<'a>(&'a Parameters); +#[cfg(feature = "deserialize_in_place")] +struct InPlaceTyGenerics<'a>(&'a Parameters); impl<'a> ToTokens for DeTyGenerics<'a> { fn to_tokens(&self, tokens: &mut Tokens) { let mut generics = self.0.generics.clone(); if self.0.borrowed.de_lifetime_def().is_some() { - generics - .lifetimes - .insert(0, syn::LifetimeDef::new("'de")); + generics.lifetimes.insert(0, syn::LifetimeDef::new("'de")); } let (_, ty_generics, _) = generics.split_for_impl(); ty_generics.to_tokens(tokens); } } -fn split_with_de_lifetime(params: &Parameters,) - -> (DeImplGenerics, DeTyGenerics, syn::TyGenerics, &syn::WhereClause) { +#[cfg(feature = "deserialize_in_place")] +impl<'a> ToTokens for InPlaceTyGenerics<'a> { + fn to_tokens(&self, tokens: &mut Tokens) { + let mut generics = self.0.generics.clone(); + generics.lifetimes.insert(0, place_lifetime()); + + if self.0.borrowed.de_lifetime_def().is_some() { + generics.lifetimes.insert(0, syn::LifetimeDef::new("'de")); + } + let (_, ty_generics, _) = generics.split_for_impl(); + ty_generics.to_tokens(tokens); + } +} + +#[cfg(feature = "deserialize_in_place")] +impl<'a> DeTyGenerics<'a> { + fn in_place(self) -> InPlaceTyGenerics<'a> { + InPlaceTyGenerics(self.0) + } +} + +#[cfg(feature = "deserialize_in_place")] +fn place_lifetime() -> syn::LifetimeDef { + syn::LifetimeDef::new("'place") +} + +fn split_with_de_lifetime( + params: &Parameters, +) -> ( + DeImplGenerics, + DeTyGenerics, + syn::TyGenerics, + &syn::WhereClause, +) { let de_impl_generics = DeImplGenerics(¶ms); let de_ty_generics = DeTyGenerics(¶ms); let (_, ty_generics, where_clause) = params.generics.split_for_impl(); diff --git a/src/vendor/serde_derive/src/fragment.rs b/src/vendor/serde_derive/src/fragment.rs index 58cf0a2cad..d333cd5f99 100644 --- a/src/vendor/serde_derive/src/fragment.rs +++ b/src/vendor/serde_derive/src/fragment.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use quote::{Tokens, ToTokens}; +use quote::{ToTokens, Tokens}; pub enum Fragment { /// Tokens that can be used as an expression. @@ -73,3 +73,12 @@ impl ToTokens for Match { } } } + +impl AsRef for Fragment { + fn as_ref(&self) -> &Tokens { + match *self { + Fragment::Expr(ref expr) => expr, + Fragment::Block(ref block) => block, + } + } +} diff --git a/src/vendor/serde_derive/src/lib.rs b/src/vendor/serde_derive/src/lib.rs index 7f88be7fb1..383b060843 100644 --- a/src/vendor/serde_derive/src/lib.rs +++ b/src/vendor/serde_derive/src/lib.rs @@ -22,17 +22,15 @@ //! //! [https://serde.rs/derive.html]: https://serde.rs/derive.html -#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.21")] - +#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.25")] #![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] #![cfg_attr(feature = "cargo-clippy", allow(used_underscore_binding))] - // The `quote!` macro requires deep recursion. #![recursion_limit = "192"] -extern crate syn; #[macro_use] extern crate quote; +extern crate syn; extern crate serde_derive_internals as internals; diff --git a/src/vendor/serde_derive/src/ser.rs b/src/vendor/serde_derive/src/ser.rs index aa48919312..56be715d04 100644 --- a/src/vendor/serde_derive/src/ser.rs +++ b/src/vendor/serde_derive/src/ser.rs @@ -10,7 +10,7 @@ use syn::{self, Ident}; use quote::Tokens; use bound; -use fragment::{Fragment, Stmts, Match}; +use fragment::{Fragment, Match, Stmts}; use internals::ast::{Body, Container, Field, Style, Variant}; use internals::{attr, Ctxt}; @@ -132,14 +132,12 @@ fn build_generics(cont: &Container) -> syn::Generics { match cont.attrs.ser_bound() { Some(predicates) => bound::with_where_predicates(&generics, predicates), - None => { - bound::with_bound( - cont, - &generics, - needs_serialize_bound, - &path!(_serde::Serialize), - ) - } + None => bound::with_bound( + cont, + &generics, + needs_serialize_bound, + &path!(_serde::Serialize), + ), } } @@ -149,10 +147,8 @@ fn build_generics(cont: &Container) -> syn::Generics { // their own bound so we do not generate one. All other fields may need a `T: // Serialize` bound where T is the type of the field. fn needs_serialize_bound(field: &attr::Field, variant: Option<&attr::Variant>) -> bool { - !field.skip_serializing() && - field.serialize_with().is_none() && - field.ser_bound().is_none() && - variant.map_or(true, |variant| variant.serialize_with().is_none()) + !field.skip_serializing() && field.serialize_with().is_none() && field.ser_bound().is_none() + && variant.map_or(true, |variant| variant.serialize_with().is_none()) } fn serialize_body(cont: &Container, params: &Parameters) -> Fragment { @@ -259,16 +255,14 @@ fn serialize_struct(params: &Parameters, fields: &[Field], cattrs: &attr::Contai let let_mut = mut_if(serialized_fields.peek().is_some()); let len = serialized_fields - .map( - |field| match field.attrs.skip_serializing_if() { - None => quote!(1), - Some(path) => { - let ident = field.ident.clone().expect("struct has unnamed fields"); - let field_expr = get_field(params, field, ident); - quote!(if #path(#field_expr) { 0 } else { 1 }) - } - }, - ) + .map(|field| match field.attrs.skip_serializing_if() { + None => quote!(1), + Some(path) => { + let ident = field.ident.clone().expect("struct has unnamed fields"); + let field_expr = get_field(params, field, ident); + quote!(if #path(#field_expr) { 0 } else { 1 }) + } + }) .fold(quote!(0), |sum, expr| quote!(#sum + #expr)); quote_block! { @@ -286,11 +280,9 @@ fn serialize_enum(params: &Parameters, variants: &[Variant], cattrs: &attr::Cont let arms: Vec<_> = variants .iter() .enumerate() - .map( - |(variant_index, variant)| { - serialize_variant(params, variant, variant_index as u32, cattrs) - }, - ) + .map(|(variant_index, variant)| { + serialize_variant(params, variant, variant_index as u32, cattrs) + }) .collect(); quote_expr! { @@ -321,13 +313,7 @@ fn serialize_variant( let fields_pat = match variant.style { Style::Unit => quote!(), Style::Newtype | Style::Tuple => quote!((..)), - Style::Struct => { - quote!( - { - .. - } - ) - } + Style::Struct => quote!({ .. }), }; quote! { #this::#variant_ident #fields_pat => #skipped_err, @@ -356,34 +342,26 @@ fn serialize_variant( let fields = variant .fields .iter() - .map( - |f| { - f.ident - .clone() - .expect("struct variant has unnamed fields") - }, - ); + .map(|f| f.ident.clone().expect("struct variant has unnamed fields")); quote! { #this::#variant_ident { #(ref #fields),* } } } }; - let body = Match( - match *cattrs.tag() { - attr::EnumTag::External => { - serialize_externally_tagged_variant(params, variant, variant_index, cattrs) - } - attr::EnumTag::Internal { ref tag } => { - serialize_internally_tagged_variant(params, variant, cattrs, tag) - } - attr::EnumTag::Adjacent { - ref tag, - ref content, - } => serialize_adjacently_tagged_variant(params, variant, cattrs, tag, content), - attr::EnumTag::None => serialize_untagged_variant(params, variant, cattrs), - }, - ); + let body = Match(match *cattrs.tag() { + attr::EnumTag::External => { + serialize_externally_tagged_variant(params, variant, variant_index, cattrs) + } + attr::EnumTag::Internal { ref tag } => { + serialize_internally_tagged_variant(params, variant, cattrs, tag) + } + attr::EnumTag::Adjacent { + ref tag, + ref content, + } => serialize_adjacently_tagged_variant(params, variant, cattrs, tag, content), + attr::EnumTag::None => serialize_untagged_variant(params, variant, cattrs), + }); quote! { #case => #body @@ -441,28 +419,24 @@ fn serialize_externally_tagged_variant( ) } } - Style::Tuple => { - serialize_tuple_variant( - TupleVariant::ExternallyTagged { - type_name: type_name, - variant_index: variant_index, - variant_name: variant_name, - }, - params, - &variant.fields, - ) - } - Style::Struct => { - serialize_struct_variant( - StructVariant::ExternallyTagged { - variant_index: variant_index, - variant_name: variant_name, - }, - params, - &variant.fields, - &type_name, - ) - } + Style::Tuple => serialize_tuple_variant( + TupleVariant::ExternallyTagged { + type_name: type_name, + variant_index: variant_index, + variant_name: variant_name, + }, + params, + &variant.fields, + ), + Style::Struct => serialize_struct_variant( + StructVariant::ExternallyTagged { + variant_index: variant_index, + variant_name: variant_name, + }, + params, + &variant.fields, + &type_name, + ), } } @@ -520,17 +494,15 @@ fn serialize_internally_tagged_variant( ) } } - Style::Struct => { - serialize_struct_variant( - StructVariant::InternallyTagged { - tag: tag, - variant_name: variant_name, - }, - params, - &variant.fields, - &type_name, - ) - } + Style::Struct => serialize_struct_variant( + StructVariant::InternallyTagged { + tag: tag, + variant_name: variant_name, + }, + params, + &variant.fields, + &type_name, + ), Style::Tuple => unreachable!("checked in serde_derive_internals"), } } @@ -546,48 +518,44 @@ fn serialize_adjacently_tagged_variant( let type_name = cattrs.name().serialize_name(); let variant_name = variant.attrs.name().serialize_name(); - let inner = Stmts( - if let Some(path) = variant.attrs.serialize_with() { - let ser = wrap_serialize_variant_with(params, path, &variant); - quote_expr! { - _serde::Serialize::serialize(#ser, __serializer) + let inner = Stmts(if let Some(path) = variant.attrs.serialize_with() { + let ser = wrap_serialize_variant_with(params, path, &variant); + quote_expr! { + _serde::Serialize::serialize(#ser, __serializer) + } + } else { + match variant.style { + Style::Unit => { + return quote_block! { + let mut __struct = try!(_serde::Serializer::serialize_struct( + __serializer, #type_name, 1)); + try!(_serde::ser::SerializeStruct::serialize_field( + &mut __struct, #tag, #variant_name)); + _serde::ser::SerializeStruct::end(__struct) + }; } - } else { - match variant.style { - Style::Unit => { - return quote_block! { - let mut __struct = try!(_serde::Serializer::serialize_struct( - __serializer, #type_name, 1)); - try!(_serde::ser::SerializeStruct::serialize_field( - &mut __struct, #tag, #variant_name)); - _serde::ser::SerializeStruct::end(__struct) - }; + Style::Newtype => { + let field = &variant.fields[0]; + let mut field_expr = quote!(__field0); + if let Some(path) = field.attrs.serialize_with() { + field_expr = wrap_serialize_field_with(params, field.ty, path, field_expr); } - Style::Newtype => { - let field = &variant.fields[0]; - let mut field_expr = quote!(__field0); - if let Some(path) = field.attrs.serialize_with() { - field_expr = wrap_serialize_field_with(params, field.ty, path, field_expr); - } - quote_expr! { - _serde::Serialize::serialize(#field_expr, __serializer) - } - } - Style::Tuple => { - serialize_tuple_variant(TupleVariant::Untagged, params, &variant.fields) - } - Style::Struct => { - serialize_struct_variant( - StructVariant::Untagged, - params, - &variant.fields, - &variant_name, - ) + quote_expr! { + _serde::Serialize::serialize(#field_expr, __serializer) } } - }, - ); + Style::Tuple => { + serialize_tuple_variant(TupleVariant::Untagged, params, &variant.fields) + } + Style::Struct => serialize_struct_variant( + StructVariant::Untagged, + params, + &variant.fields, + &variant_name, + ), + } + }); let fields_ty = variant.fields.iter().map(|f| &f.ty); let ref fields_ident: Vec<_> = match variant.style { @@ -599,24 +567,14 @@ fn serialize_adjacently_tagged_variant( } } Style::Newtype => vec![Ident::new("__field0")], - Style::Tuple => { - (0..variant.fields.len()) - .map(|i| Ident::new(format!("__field{}", i))) - .collect() - } - Style::Struct => { - variant - .fields - .iter() - .map( - |f| { - f.ident - .clone() - .expect("struct variant has unnamed fields") - }, - ) - .collect() - } + Style::Tuple => (0..variant.fields.len()) + .map(|i| Ident::new(format!("__field{}", i))) + .collect(), + Style::Struct => variant + .fields + .iter() + .map(|f| f.ident.clone().expect("struct variant has unnamed fields")) + .collect(), }; let (_, ty_generics, where_clause) = params.generics.split_for_impl(); @@ -753,7 +711,10 @@ enum StructVariant<'a> { variant_index: u32, variant_name: String, }, - InternallyTagged { tag: &'a str, variant_name: String }, + InternallyTagged { + tag: &'a str, + variant_name: String, + }, Untagged, } @@ -764,19 +725,14 @@ fn serialize_struct_variant<'a>( name: &str, ) -> Fragment { let (method, skip_method) = match context { - StructVariant::ExternallyTagged { .. } => { - ( - quote!(_serde::ser::SerializeStructVariant::serialize_field), - quote!(_serde::ser::SerializeStructVariant::skip_field), - ) - } - StructVariant::InternallyTagged { .. } | - StructVariant::Untagged => { - ( - quote!(_serde::ser::SerializeStruct::serialize_field), - quote!(_serde::ser::SerializeStruct::skip_field), - ) - } + StructVariant::ExternallyTagged { .. } => ( + quote!(_serde::ser::SerializeStructVariant::serialize_field), + quote!(_serde::ser::SerializeStructVariant::skip_field), + ), + StructVariant::InternallyTagged { .. } | StructVariant::Untagged => ( + quote!(_serde::ser::SerializeStruct::serialize_field), + quote!(_serde::ser::SerializeStruct::skip_field), + ), }; let serialize_fields = serialize_struct_visitor(fields, params, true, method, skip_method); @@ -789,16 +745,14 @@ fn serialize_struct_variant<'a>( let let_mut = mut_if(serialized_fields.peek().is_some()); let len = serialized_fields - .map( - |field| { - let ident = field.ident.clone().expect("struct has unnamed fields"); + .map(|field| { + let ident = field.ident.clone().expect("struct has unnamed fields"); - match field.attrs.skip_serializing_if() { - Some(path) => quote!(if #path(#ident) { 0 } else { 1 }), - None => quote!(1), - } - }, - ) + match field.attrs.skip_serializing_if() { + Some(path) => quote!(if #path(#ident) { 0 } else { 1 }), + None => quote!(1), + } + }) .fold(quote!(0), |sum, expr| quote!(#sum + #expr)); match context { @@ -857,34 +811,32 @@ fn serialize_tuple_struct_visitor( fields .iter() .enumerate() - .map( - |(i, field)| { - let mut field_expr = if is_enum { - let id = Ident::new(format!("__field{}", i)); - quote!(#id) - } else { - get_field(params, field, i) - }; + .map(|(i, field)| { + let mut field_expr = if is_enum { + let id = Ident::new(format!("__field{}", i)); + quote!(#id) + } else { + get_field(params, field, i) + }; - let skip = field - .attrs - .skip_serializing_if() - .map(|path| quote!(#path(#field_expr))); + let skip = field + .attrs + .skip_serializing_if() + .map(|path| quote!(#path(#field_expr))); - if let Some(path) = field.attrs.serialize_with() { - field_expr = wrap_serialize_field_with(params, field.ty, path, field_expr); - } + if let Some(path) = field.attrs.serialize_with() { + field_expr = wrap_serialize_field_with(params, field.ty, path, field_expr); + } - let ser = quote! { - try!(#func(&mut __serde_state, #field_expr)); - }; + let ser = quote! { + try!(#func(&mut __serde_state, #field_expr)); + }; - match skip { - None => ser, - Some(skip) => quote!(if !#skip { #ser }), - } - }, - ) + match skip { + None => ser, + Some(skip) => quote!(if !#skip { #ser }), + } + }) .collect() } @@ -898,44 +850,42 @@ fn serialize_struct_visitor( fields .iter() .filter(|&field| !field.attrs.skip_serializing()) - .map( - |field| { - let field_ident = field.ident.clone().expect("struct has unnamed field"); - let mut field_expr = if is_enum { - quote!(#field_ident) - } else { - get_field(params, field, field_ident) - }; + .map(|field| { + let field_ident = field.ident.clone().expect("struct has unnamed field"); + let mut field_expr = if is_enum { + quote!(#field_ident) + } else { + get_field(params, field, field_ident) + }; - let key_expr = field.attrs.name().serialize_name(); + let key_expr = field.attrs.name().serialize_name(); - let skip = field - .attrs - .skip_serializing_if() - .map(|path| quote!(#path(#field_expr))); + let skip = field + .attrs + .skip_serializing_if() + .map(|path| quote!(#path(#field_expr))); - if let Some(path) = field.attrs.serialize_with() { - field_expr = wrap_serialize_field_with(params, field.ty, path, field_expr); - } + if let Some(path) = field.attrs.serialize_with() { + field_expr = wrap_serialize_field_with(params, field.ty, path, field_expr); + } - let ser = quote! { - try!(#func(&mut __serde_state, #key_expr, #field_expr)); - }; + let ser = quote! { + try!(#func(&mut __serde_state, #key_expr, #field_expr)); + }; - match skip { - None => ser, - Some(skip) => { - quote! { - if !#skip { - #ser - } else { - try!(#skip_func(&mut __serde_state, #key_expr)); - } + match skip { + None => ser, + Some(skip) => { + quote! { + if !#skip { + #ser + } else { + try!(#skip_func(&mut __serde_state, #key_expr)); } } } - }, - ) + } + }) .collect() } @@ -945,10 +895,7 @@ fn wrap_serialize_field_with( serialize_with: &syn::Path, field_expr: Tokens, ) -> Tokens { - wrap_serialize_with(params, - serialize_with, - &[field_ty], - &[quote!(#field_expr)]) + wrap_serialize_with(params, serialize_with, &[field_ty], &[quote!(#field_expr)]) } fn wrap_serialize_variant_with( @@ -957,15 +904,24 @@ fn wrap_serialize_variant_with( variant: &Variant, ) -> Tokens { let field_tys: Vec<_> = variant.fields.iter().map(|field| field.ty).collect(); - let field_exprs: Vec<_> = variant.fields.iter() + let field_exprs: Vec<_> = variant + .fields + .iter() .enumerate() .map(|(i, field)| { - let id = field.ident.as_ref().map_or_else(|| Ident::new(format!("__field{}", i)), - |id| id.clone()); + let id = field + .ident + .as_ref() + .map_or_else(|| Ident::new(format!("__field{}", i)), |id| id.clone()); quote!(#id) }) .collect(); - wrap_serialize_with(params, serialize_with, field_tys.as_slice(), field_exprs.as_slice()) + wrap_serialize_with( + params, + serialize_with, + field_tys.as_slice(), + field_exprs.as_slice(), + ) } fn wrap_serialize_with( @@ -1014,7 +970,11 @@ fn wrap_serialize_with( // // where we want to omit the `mut` to avoid a warning. fn mut_if(is_mut: bool) -> Option { - if is_mut { Some(quote!(mut)) } else { None } + if is_mut { + Some(quote!(mut)) + } else { + None + } } fn get_field(params: &Parameters, field: &Field, ident: I) -> Tokens diff --git a/src/vendor/serde_derive_internals/.cargo-checksum.json b/src/vendor/serde_derive_internals/.cargo-checksum.json index 0ee5618a02..76cc0777d8 100644 --- a/src/vendor/serde_derive_internals/.cargo-checksum.json +++ b/src/vendor/serde_derive_internals/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"bc836401395b419f3a4265de0e912f8ad6af90b40d78e4a05ea172203e7a4f0e","Cargo.toml.orig":"0435204d95404e25ee07fa3169ddf5eef26bde3fce03f4e63e9e55774d620199","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/ast.rs":"9590055bf189794b70dcd068b8fc6dc6556203bccf8c4fdc697453361342a829","src/attr.rs":"51c92750f7b490a2c46950a68b5491d83181815d98e0fe3db102369b1ca9fe6e","src/case.rs":"be3288491dae43ca53643cb8409431e5e65ccf39c69c8047676e89c997827b0c","src/check.rs":"db2ba3b7a590769a70a353349e9e5b9e5c8cbc63fccf3d44e61cd6ce68d419fc","src/ctxt.rs":"98eab1acd3de8617b516d1de7d5d870bb1d2a1c1aca258a4cca2bde3f8df88e4","src/lib.rs":"f242433bcb42c2360b8887d6e9f1b286a332080f1f0a081de06b0c061b563348"},"package":"32f1926285523b2db55df263d2aa4eb69ddcfa7a7eade6430323637866b513ab"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"5349022d5b74908f42cd9ce578af7324eb5215aecc6a3d04831961177baaf336","Cargo.toml.orig":"75f7e3b8f7e51a7a47bdb2902bcdeb4f718f7593473058359dedd0a7b761d83f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7dc6376a88195594cd6b43cb891aad10f57144ff737178b55d046aa04739b43a","src/ast.rs":"c5ce213a29a8f5dc444022cf2492cc532c616155792d6c97d53b12622b68887a","src/attr.rs":"af9afd1a768db4d272ff13ff06412eae8d5edc57be0a29b396de8895499436c1","src/case.rs":"34611bf39a2b73b6b2ec2178785befdc82341f686fdda434a6fd76999e194a01","src/check.rs":"0c9a78d189fc11f87ae1ec1f29455e345c61dad612295de5e710727af8ccb844","src/ctxt.rs":"e842cc73bfd648f14f3bad73e3db321d6cd0f94d255d59e81ed768486fe5deda","src/lib.rs":"f664ff71691e4215234da00049a132d023000f813e2485745453e4a2fdf4e806"},"package":"730fe9f29fe8db69a601837f416e46cba07792031ed6b27557a43e49d62d89ae"} \ No newline at end of file diff --git a/src/vendor/serde_derive_internals/Cargo.toml b/src/vendor/serde_derive_internals/Cargo.toml index 595e40d184..2cc223cde5 100644 --- a/src/vendor/serde_derive_internals/Cargo.toml +++ b/src/vendor/serde_derive_internals/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "serde_derive_internals" -version = "0.17.0" +version = "0.18.1" authors = ["Erick Tryzelaar ", "David Tolnay "] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "AST representation used by Serde derive macros. Unstable." diff --git a/src/vendor/serde_derive_internals/Cargo.toml.orig b/src/vendor/serde_derive_internals/Cargo.toml.orig index 6148cda6b8..8af8e3dcb1 100644 --- a/src/vendor/serde_derive_internals/Cargo.toml.orig +++ b/src/vendor/serde_derive_internals/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "serde_derive_internals" -version = "0.17.0" # remember to update html_root_url +version = "0.18.1" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT/Apache-2.0" description = "AST representation used by Serde derive macros. Unstable." diff --git a/src/vendor/serde_derive_internals/src/ast.rs b/src/vendor/serde_derive_internals/src/ast.rs index dce1acc178..698a175c0f 100644 --- a/src/vendor/serde_derive_internals/src/ast.rs +++ b/src/vendor/serde_derive_internals/src/ast.rs @@ -49,27 +49,25 @@ impl<'a> Container<'a> { let attrs = attr::Container::from_ast(cx, item); let mut body = match item.body { - syn::Body::Enum(ref variants) => Body::Enum(enum_from_ast(cx, variants)), + syn::Body::Enum(ref variants) => { + Body::Enum(enum_from_ast(cx, variants, &attrs.default())) + } syn::Body::Struct(ref variant_data) => { - let (style, fields) = struct_from_ast(cx, variant_data, None); + let (style, fields) = struct_from_ast(cx, variant_data, None, &attrs.default()); Body::Struct(style, fields) } }; match body { - Body::Enum(ref mut variants) => { - for ref mut variant in variants { - variant.attrs.rename_by_rule(attrs.rename_all()); - for ref mut field in &mut variant.fields { - field.attrs.rename_by_rule(variant.attrs.rename_all()); - } + Body::Enum(ref mut variants) => for ref mut variant in variants { + variant.attrs.rename_by_rule(attrs.rename_all()); + for ref mut field in &mut variant.fields { + field.attrs.rename_by_rule(variant.attrs.rename_all()); } - } - Body::Struct(_, ref mut fields) => { - for field in fields { - field.attrs.rename_by_rule(attrs.rename_all()); - } - } + }, + Body::Struct(_, ref mut fields) => for field in fields { + field.attrs.rename_by_rule(attrs.rename_all()); + }, } let item = Container { @@ -98,47 +96,63 @@ impl<'a> Body<'a> { } } -fn enum_from_ast<'a>(cx: &Ctxt, variants: &'a [syn::Variant]) -> Vec> { +fn enum_from_ast<'a>( + cx: &Ctxt, + variants: &'a [syn::Variant], + container_default: &attr::Default, +) -> Vec> { variants .iter() - .map( - |variant| { - let attrs = attr::Variant::from_ast(cx, variant); - let (style, fields) = struct_from_ast(cx, &variant.data, Some(&attrs)); - Variant { - ident: variant.ident.clone(), - attrs: attrs, - style: style, - fields: fields, - } - }, - ) + .map(|variant| { + let attrs = attr::Variant::from_ast(cx, variant); + let (style, fields) = + struct_from_ast(cx, &variant.data, Some(&attrs), container_default); + Variant { + ident: variant.ident.clone(), + attrs: attrs, + style: style, + fields: fields, + } + }) .collect() } -fn struct_from_ast<'a>(cx: &Ctxt, data: &'a syn::VariantData, attrs: Option<&attr::Variant>) -> (Style, Vec>) { +fn struct_from_ast<'a>( + cx: &Ctxt, + data: &'a syn::VariantData, + attrs: Option<&attr::Variant>, + container_default: &attr::Default, +) -> (Style, Vec>) { match *data { - syn::VariantData::Struct(ref fields) => (Style::Struct, fields_from_ast(cx, fields, attrs)), - syn::VariantData::Tuple(ref fields) if fields.len() == 1 => { - (Style::Newtype, fields_from_ast(cx, fields, attrs)) - } - syn::VariantData::Tuple(ref fields) => (Style::Tuple, fields_from_ast(cx, fields, attrs)), + syn::VariantData::Struct(ref fields) => ( + Style::Struct, + fields_from_ast(cx, fields, attrs, container_default), + ), + syn::VariantData::Tuple(ref fields) if fields.len() == 1 => ( + Style::Newtype, + fields_from_ast(cx, fields, attrs, container_default), + ), + syn::VariantData::Tuple(ref fields) => ( + Style::Tuple, + fields_from_ast(cx, fields, attrs, container_default), + ), syn::VariantData::Unit => (Style::Unit, Vec::new()), } } -fn fields_from_ast<'a>(cx: &Ctxt, fields: &'a [syn::Field], attrs: Option<&attr::Variant>) -> Vec> { +fn fields_from_ast<'a>( + cx: &Ctxt, + fields: &'a [syn::Field], + attrs: Option<&attr::Variant>, + container_default: &attr::Default, +) -> Vec> { fields .iter() .enumerate() - .map( - |(i, field)| { - Field { - ident: field.ident.clone(), - attrs: attr::Field::from_ast(cx, i, field, attrs), - ty: &field.ty, - } - }, - ) + .map(|(i, field)| Field { + ident: field.ident.clone(), + attrs: attr::Field::from_ast(cx, i, field, attrs, container_default), + ty: &field.ty, + }) .collect() } diff --git a/src/vendor/serde_derive_internals/src/attr.rs b/src/vendor/serde_derive_internals/src/attr.rs index 7baeb59bb3..ce0ed0267c 100644 --- a/src/vendor/serde_derive_internals/src/attr.rs +++ b/src/vendor/serde_derive_internals/src/attr.rs @@ -164,6 +164,15 @@ pub enum Identifier { Variant, } +impl Identifier { + pub fn is_some(self) -> bool { + match self { + Identifier::No => false, + Identifier::Field | Identifier::Variant => true, + } + } +} + impl Container { /// Extract out the `#[serde(...)]` attributes from an item. pub fn from_ast(cx: &Ctxt, item: &syn::DeriveInput) -> Self { @@ -207,11 +216,11 @@ impl Container { if let Ok(s) = get_string_from_lit(cx, name.as_ref(), name.as_ref(), lit) { match RenameRule::from_str(&s) { Ok(rename_rule) => rename_all.set(rename_rule), - Err(()) => { - cx.error(format!("unknown rename rule for #[serde(rename_all \ - = {:?})]", - s)) - } + Err(()) => cx.error(format!( + "unknown rename rule for #[serde(rename_all \ + = {:?})]", + s + )), } } } @@ -222,19 +231,15 @@ impl Container { } // Parse `#[serde(default)]` - MetaItem(Word(ref name)) if name == "default" => { - match item.body { - syn::Body::Struct(syn::VariantData::Struct(_)) => { - default.set(Default::Default); - } - _ => { - cx.error( - "#[serde(default)] can only be used on structs \ - with named fields", - ) - } + MetaItem(Word(ref name)) if name == "default" => match item.body { + syn::Body::Struct(syn::VariantData::Struct(_)) => { + default.set(Default::Default); } - } + _ => cx.error( + "#[serde(default)] can only be used on structs \ + with named fields", + ), + }, // Parse `#[serde(default = "...")]` MetaItem(NameValue(ref name, ref lit)) if name == "default" => { @@ -243,12 +248,10 @@ impl Container { syn::Body::Struct(syn::VariantData::Struct(_)) => { default.set(Default::Path(path)); } - _ => { - cx.error( - "#[serde(default = \"...\")] can only be used \ - on structs with named fields", - ) - } + _ => cx.error( + "#[serde(default = \"...\")] can only be used \ + on structs with named fields", + ), } } } @@ -256,7 +259,8 @@ impl Container { // Parse `#[serde(bound = "D: Serialize")]` MetaItem(NameValue(ref name, ref lit)) if name == "bound" => { if let Ok(where_predicates) = - parse_lit_into_where(cx, name.as_ref(), name.as_ref(), lit) { + parse_lit_into_where(cx, name.as_ref(), name.as_ref(), lit) + { ser_bound.set(where_predicates.clone()); de_bound.set(where_predicates); } @@ -271,16 +275,14 @@ impl Container { } // Parse `#[serde(untagged)]` - MetaItem(Word(ref name)) if name == "untagged" => { - match item.body { - syn::Body::Enum(_) => { - untagged.set_true(); - } - syn::Body::Struct(_) => { - cx.error("#[serde(untagged)] can only be used on enums") - } + MetaItem(Word(ref name)) if name == "untagged" => match item.body { + syn::Body::Enum(_) => { + untagged.set_true(); } - } + syn::Body::Struct(_) => { + cx.error("#[serde(untagged)] can only be used on enums") + } + }, // Parse `#[serde(tag = "type")]` MetaItem(NameValue(ref name, ref lit)) if name == "tag" => { @@ -303,12 +305,10 @@ impl Container { syn::Body::Enum(_) => { content.set(s); } - syn::Body::Struct(_) => { - cx.error( - "#[serde(content = \"...\")] can only be used on \ - enums", - ) - } + syn::Body::Struct(_) => cx.error( + "#[serde(content = \"...\")] can only be used on \ + enums", + ), } } } @@ -345,8 +345,10 @@ impl Container { } MetaItem(ref meta_item) => { - cx.error(format!("unknown serde container attribute `{}`", - meta_item.name())); + cx.error(format!( + "unknown serde container attribute `{}`", + meta_item.name() + )); } Literal(_) => { @@ -434,13 +436,12 @@ fn decide_tag( if let syn::Body::Enum(ref variants) = item.body { for variant in variants { match variant.data { - syn::VariantData::Struct(_) | - syn::VariantData::Unit => {} + syn::VariantData::Struct(_) | syn::VariantData::Unit => {} syn::VariantData::Tuple(ref fields) => { if fields.len() != 1 { cx.error( "#[serde(tag = \"...\")] cannot be used with tuple \ - variants", + variants", ); break; } @@ -455,21 +456,19 @@ fn decide_tag( EnumTag::External // doesn't matter, will error } (false, None, Some(_)) => { - cx.error("#[serde(tag = \"...\", content = \"...\")] must be used together",); + cx.error("#[serde(tag = \"...\", content = \"...\")] must be used together"); EnumTag::External } (true, None, Some(_)) => { cx.error("untagged enum cannot have #[serde(content = \"...\")]"); EnumTag::External } - (false, Some(tag), Some(content)) => { - EnumTag::Adjacent { - tag: tag, - content: content, - } - } + (false, Some(tag), Some(content)) => EnumTag::Adjacent { + tag: tag, + content: content, + }, (true, Some(_), Some(_)) => { - cx.error("untagged enum cannot have #[serde(tag = \"...\", content = \"...\")]",); + cx.error("untagged enum cannot have #[serde(tag = \"...\", content = \"...\")]"); EnumTag::External } } @@ -484,7 +483,7 @@ fn decide_identifier( match (&item.body, field_identifier.get(), variant_identifier.get()) { (_, false, false) => Identifier::No, (_, true, true) => { - cx.error("`field_identifier` and `variant_identifier` cannot both be set",); + cx.error("`field_identifier` and `variant_identifier` cannot both be set"); Identifier::No } (&syn::Body::Struct(_), true, false) => { @@ -551,11 +550,11 @@ impl Variant { if let Ok(s) = get_string_from_lit(cx, name.as_ref(), name.as_ref(), lit) { match RenameRule::from_str(&s) { Ok(rename_rule) => rename_all.set(rename_rule), - Err(()) => { - cx.error(format!("unknown rename rule for #[serde(rename_all \ - = {:?})]", - s)) - } + Err(()) => cx.error(format!( + "unknown rename rule for #[serde(rename_all \ + = {:?})]", + s + )), } } } @@ -602,19 +601,20 @@ impl Variant { } // Defer `#[serde(borrow)]` and `#[serde(borrow = "'a + 'b")]` - MetaItem(ref mi) if mi.name() == "borrow" => { - match variant.data { - syn::VariantData::Tuple(ref fields) if fields.len() == 1 => { - borrow.set(mi.clone()); - } - _ => { - cx.error("#[serde(borrow)] may only be used on newtype variants"); - } + MetaItem(ref mi) if mi.name() == "borrow" => match variant.data { + syn::VariantData::Tuple(ref fields) if fields.len() == 1 => { + borrow.set(mi.clone()); } - } + _ => { + cx.error("#[serde(borrow)] may only be used on newtype variants"); + } + }, MetaItem(ref meta_item) => { - cx.error(format!("unknown serde variant attribute `{}`", meta_item.name())); + cx.error(format!( + "unknown serde variant attribute `{}`", + meta_item.name() + )); } Literal(_) => { @@ -714,7 +714,13 @@ pub enum Default { impl Field { /// Extract out the `#[serde(...)]` attributes from a struct field. - pub fn from_ast(cx: &Ctxt, index: usize, field: &syn::Field, attrs: Option<&Variant>) -> Self { + pub fn from_ast( + cx: &Ctxt, + index: usize, + field: &syn::Field, + attrs: Option<&Variant>, + container_default: &Default, + ) -> Self { let mut ser_name = Attr::none(cx, "rename"); let mut de_name = Attr::none(cx, "rename"); let mut skip_serializing = BoolAttr::none(cx, "skip_serializing"); @@ -739,7 +745,12 @@ impl Field { .as_ref() .map(|borrow| vec![MetaItem(borrow.clone())]); - for meta_items in field.attrs.iter().filter_map(get_serde_meta_items).chain(variant_borrow) { + for meta_items in field + .attrs + .iter() + .filter_map(get_serde_meta_items) + .chain(variant_borrow) + { for meta_item in meta_items { match meta_item { // Parse `#[serde(rename = "foo")]` @@ -784,7 +795,7 @@ impl Field { MetaItem(Word(ref name)) if name == "skip" => { skip_serializing.set_true(); skip_deserializing.set_true(); - }, + } // Parse `#[serde(skip_serializing_if = "...")]` MetaItem(NameValue(ref name, ref lit)) if name == "skip_serializing_if" => { @@ -822,7 +833,8 @@ impl Field { // Parse `#[serde(bound = "D: Serialize")]` MetaItem(NameValue(ref name, ref lit)) if name == "bound" => { if let Ok(where_predicates) = - parse_lit_into_where(cx, name.as_ref(), name.as_ref(), lit) { + parse_lit_into_where(cx, name.as_ref(), name.as_ref(), lit) + { ser_bound.set(where_predicates.clone()); de_bound.set(where_predicates); } @@ -849,13 +861,10 @@ impl Field { if let Ok(borrowable) = borrowable_lifetimes(cx, &ident, &field.ty) { for lifetime in &lifetimes { if !borrowable.contains(lifetime) { - cx.error( - format!( - "field `{}` does not have lifetime {}", - ident, - lifetime.ident - ), - ); + cx.error(format!( + "field `{}` does not have lifetime {}", + ident, lifetime.ident + )); } } borrowed_lifetimes.set(lifetimes); @@ -871,7 +880,10 @@ impl Field { } MetaItem(ref meta_item) => { - cx.error(format!("unknown serde field attribute `{}`", meta_item.name()),); + cx.error(format!( + "unknown serde field attribute `{}`", + meta_item.name() + )); } Literal(_) => { @@ -881,9 +893,10 @@ impl Field { } } - // Is skip_deserializing, initialize the field to Default::default() - // unless a different default is specified by `#[serde(default = "...")]` - if skip_deserializing.0.value.is_some() { + // Is skip_deserializing, initialize the field to Default::default() unless a different + // default is specified by `#[serde(default = "...")]` on ourselves or our container (e.g. + // the struct we are in). + if container_default == &Default::None && skip_deserializing.0.value.is_some() { default.set_if_none(Default::Default); } @@ -1018,13 +1031,11 @@ where } _ => { - cx.error( - format!( - "malformed {0} attribute, expected `{0}(serialize = ..., \ - deserialize = ...)`", - attr_name - ), - ); + cx.error(format!( + "malformed {0} attribute, expected `{0}(serialize = ..., \ + deserialize = ...)`", + attr_name + )); return Err(()); } } @@ -1060,13 +1071,10 @@ fn get_string_from_lit( if let syn::Lit::Str(ref s, _) = *lit { Ok(s.clone()) } else { - cx.error( - format!( - "expected serde {} attribute to be a string: `{} = \"...\"`", - attr_name, - meta_item_name - ), - ); + cx.error(format!( + "expected serde {} attribute to be a string: `{} = \"...\"`", + attr_name, meta_item_name + )); Err(()) } } @@ -1097,11 +1105,12 @@ fn parse_lit_into_where( fn parse_lit_into_ty(cx: &Ctxt, attr_name: &str, lit: &syn::Lit) -> Result { let string = try!(get_string_from_lit(cx, attr_name, attr_name, lit)); - syn::parse_type(&string).map_err( - |_| { - cx.error(format!("failed to parse type: {} = {:?}", attr_name, string),) - }, - ) + syn::parse_type(&string).map_err(|_| { + cx.error(format!( + "failed to parse type: {} = {:?}", + attr_name, string + )) + }) } // Parses a string literal like "'a + 'b + 'c" containing a nonempty list of @@ -1132,7 +1141,7 @@ fn parse_lit_into_lifetimes( return Ok(set); } } - Err(cx.error(format!("failed to parse borrowed lifetimes: {:?}", string)),) + Err(cx.error(format!("failed to parse borrowed lifetimes: {:?}", string))) } // Whether the type looks like it might be `std::borrow::Cow` where elem="T". @@ -1176,8 +1185,8 @@ fn is_cow(ty: &syn::Ty, elem: &str) -> bool { return false; } }; - seg.ident == "Cow" && params.lifetimes.len() == 1 && - params.types == vec![syn::parse_type(elem).unwrap()] && params.bindings.is_empty() + seg.ident == "Cow" && params.lifetimes.len() == 1 + && params.types == vec![syn::parse_type(elem).unwrap()] && params.bindings.is_empty() } // Whether the type looks like it might be `&T` where elem="T". This can have @@ -1203,8 +1212,8 @@ fn is_cow(ty: &syn::Ty, elem: &str) -> bool { fn is_rptr(ty: &syn::Ty, elem: &str) -> bool { match *ty { syn::Ty::Rptr(Some(_), ref mut_ty) => { - mut_ty.mutability == syn::Mutability::Immutable && - mut_ty.ty == syn::parse_type(elem).unwrap() + mut_ty.mutability == syn::Mutability::Immutable + && mut_ty.ty == syn::parse_type(elem).unwrap() } _ => false, } @@ -1225,7 +1234,7 @@ fn borrowable_lifetimes( let mut lifetimes = BTreeSet::new(); collect_lifetimes(ty, &mut lifetimes); if lifetimes.is_empty() { - Err(cx.error(format!("field `{}` has no lifetimes to borrow", name)),) + Err(cx.error(format!("field `{}` has no lifetimes to borrow", name))) } else { Ok(lifetimes) } @@ -1233,9 +1242,7 @@ fn borrowable_lifetimes( fn collect_lifetimes(ty: &syn::Ty, out: &mut BTreeSet) { match *ty { - syn::Ty::Slice(ref elem) | - syn::Ty::Array(ref elem, _) | - syn::Ty::Paren(ref elem) => { + syn::Ty::Slice(ref elem) | syn::Ty::Array(ref elem, _) | syn::Ty::Paren(ref elem) => { collect_lifetimes(elem, out); } syn::Ty::Ptr(ref elem) => { @@ -1245,11 +1252,9 @@ fn collect_lifetimes(ty: &syn::Ty, out: &mut BTreeSet) { out.extend(lifetime.iter().cloned()); collect_lifetimes(&elem.ty, out); } - syn::Ty::Tup(ref elems) => { - for elem in elems { - collect_lifetimes(elem, out); - } - } + syn::Ty::Tup(ref elems) => for elem in elems { + collect_lifetimes(elem, out); + }, syn::Ty::Path(ref qself, ref path) => { if let Some(ref qself) = *qself { collect_lifetimes(&qself.ty, out); @@ -1266,11 +1271,11 @@ fn collect_lifetimes(ty: &syn::Ty, out: &mut BTreeSet) { } } } - syn::Ty::BareFn(_) | - syn::Ty::Never | - syn::Ty::TraitObject(_) | - syn::Ty::ImplTrait(_) | - syn::Ty::Infer | - syn::Ty::Mac(_) => {} + syn::Ty::BareFn(_) + | syn::Ty::Never + | syn::Ty::TraitObject(_) + | syn::Ty::ImplTrait(_) + | syn::Ty::Infer + | syn::Ty::Mac(_) => {} } } diff --git a/src/vendor/serde_derive_internals/src/case.rs b/src/vendor/serde_derive_internals/src/case.rs index 75c38e48ac..0da478a1c6 100644 --- a/src/vendor/serde_derive_internals/src/case.rs +++ b/src/vendor/serde_derive_internals/src/case.rs @@ -31,7 +31,7 @@ pub enum RenameRule { /// Rename direct children to "kebab-case" style. KebabCase, /// Rename direct children to "SCREAMING-KEBAB-CASE" style. - ScreamingKebabCase + ScreamingKebabCase, } impl RenameRule { @@ -52,7 +52,9 @@ impl RenameRule { } ScreamingSnakeCase => SnakeCase.apply_to_variant(variant).to_ascii_uppercase(), KebabCase => SnakeCase.apply_to_variant(variant).replace('_', "-"), - ScreamingKebabCase => ScreamingSnakeCase.apply_to_variant(variant).replace('_', "-") + ScreamingKebabCase => ScreamingSnakeCase + .apply_to_variant(variant) + .replace('_', "-"), } } @@ -80,7 +82,7 @@ impl RenameRule { } ScreamingSnakeCase => field.to_ascii_uppercase(), KebabCase => field.replace('_', "-"), - ScreamingKebabCase => ScreamingSnakeCase.apply_to_field(field).replace('_', "-") + ScreamingKebabCase => ScreamingSnakeCase.apply_to_field(field).replace('_', "-"), } } } @@ -104,13 +106,28 @@ impl FromStr for RenameRule { #[test] fn rename_variants() { - for &(original, lower, camel, snake, screaming, kebab, screaming_kebab) in - &[ - ("Outcome", "outcome", "outcome", "outcome", "OUTCOME", "outcome", "OUTCOME"), - ("VeryTasty", "verytasty", "veryTasty", "very_tasty", "VERY_TASTY", "very-tasty", "VERY-TASTY"), - ("A", "a", "a", "a", "A", "a", "A"), - ("Z42", "z42", "z42", "z42", "Z42", "z42", "Z42"), - ] { + for &(original, lower, camel, snake, screaming, kebab, screaming_kebab) in &[ + ( + "Outcome", + "outcome", + "outcome", + "outcome", + "OUTCOME", + "outcome", + "OUTCOME", + ), + ( + "VeryTasty", + "verytasty", + "veryTasty", + "very_tasty", + "VERY_TASTY", + "very-tasty", + "VERY-TASTY", + ), + ("A", "a", "a", "a", "A", "a", "A"), + ("Z42", "z42", "z42", "z42", "Z42", "z42", "Z42"), + ] { assert_eq!(None.apply_to_variant(original), original); assert_eq!(LowerCase.apply_to_variant(original), lower); assert_eq!(PascalCase.apply_to_variant(original), original); @@ -118,19 +135,35 @@ fn rename_variants() { assert_eq!(SnakeCase.apply_to_variant(original), snake); assert_eq!(ScreamingSnakeCase.apply_to_variant(original), screaming); assert_eq!(KebabCase.apply_to_variant(original), kebab); - assert_eq!(ScreamingKebabCase.apply_to_variant(original), screaming_kebab); + assert_eq!( + ScreamingKebabCase.apply_to_variant(original), + screaming_kebab + ); } } #[test] fn rename_fields() { - for &(original, pascal, camel, screaming, kebab, screaming_kebab) in - &[ - ("outcome", "Outcome", "outcome", "OUTCOME", "outcome", "OUTCOME"), - ("very_tasty", "VeryTasty", "veryTasty", "VERY_TASTY", "very-tasty", "VERY-TASTY"), - ("a", "A", "a", "A", "a", "A"), - ("z42", "Z42", "z42", "Z42", "z42", "Z42"), - ] { + for &(original, pascal, camel, screaming, kebab, screaming_kebab) in &[ + ( + "outcome", + "Outcome", + "outcome", + "OUTCOME", + "outcome", + "OUTCOME", + ), + ( + "very_tasty", + "VeryTasty", + "veryTasty", + "VERY_TASTY", + "very-tasty", + "VERY-TASTY", + ), + ("a", "A", "a", "A", "a", "A"), + ("z42", "Z42", "z42", "Z42", "z42", "Z42"), + ] { assert_eq!(None.apply_to_field(original), original); assert_eq!(PascalCase.apply_to_field(original), pascal); assert_eq!(CamelCase.apply_to_field(original), camel); diff --git a/src/vendor/serde_derive_internals/src/check.rs b/src/vendor/serde_derive_internals/src/check.rs index 5d6a76ff87..2dae42f541 100644 --- a/src/vendor/serde_derive_internals/src/check.rs +++ b/src/vendor/serde_derive_internals/src/check.rs @@ -31,7 +31,7 @@ fn check_getter(cx: &Ctxt, cont: &Container) { if cont.body.has_getter() && cont.attrs.remote().is_none() { cx.error( "#[serde(getter = \"...\")] can only be used in structs \ - that have #[serde(remote = \"...\")]", + that have #[serde(remote = \"...\")]", ); } } @@ -53,10 +53,13 @@ fn check_identifier(cx: &Ctxt, cont: &Container) { }; for (i, variant) in variants.iter().enumerate() { - match (variant.style, cont.attrs.identifier(), variant.attrs.other()) { + match ( + variant.style, + cont.attrs.identifier(), + variant.attrs.other(), + ) { // The `other` attribute may only be used in a field_identifier. - (_, Identifier::Variant, true) | - (_, Identifier::No, true) => { + (_, Identifier::Variant, true) | (_, Identifier::No, true) => { cx.error("#[serde(other)] may only be used inside a field_identifier"); } @@ -109,42 +112,58 @@ fn check_variant_skip_attrs(cx: &Ctxt, cont: &Container) { for variant in variants.iter() { if variant.attrs.serialize_with().is_some() { if variant.attrs.skip_serializing() { - cx.error(format!("variant `{}` cannot have both #[serde(serialize_with)] and \ - #[serde(skip_serializing)]", variant.ident)); + cx.error(format!( + "variant `{}` cannot have both #[serde(serialize_with)] and \ + #[serde(skip_serializing)]", + variant.ident + )); } for (i, field) in variant.fields.iter().enumerate() { - let ident = field.ident.as_ref().map_or_else(|| format!("{}", i), - |ident| format!("`{}`", ident)); + let ident = field + .ident + .as_ref() + .map_or_else(|| format!("{}", i), |ident| format!("`{}`", ident)); if field.attrs.skip_serializing() { - cx.error(format!("variant `{}` cannot have both #[serde(serialize_with)] and \ - a field {} marked with #[serde(skip_serializing)]", - variant.ident, ident)); + cx.error(format!( + "variant `{}` cannot have both #[serde(serialize_with)] and \ + a field {} marked with #[serde(skip_serializing)]", + variant.ident, ident + )); } if field.attrs.skip_serializing_if().is_some() { - cx.error(format!("variant `{}` cannot have both #[serde(serialize_with)] and \ - a field {} marked with #[serde(skip_serializing_if)]", - variant.ident, ident)); + cx.error(format!( + "variant `{}` cannot have both #[serde(serialize_with)] and \ + a field {} marked with #[serde(skip_serializing_if)]", + variant.ident, ident + )); } } } if variant.attrs.deserialize_with().is_some() { if variant.attrs.skip_deserializing() { - cx.error(format!("variant `{}` cannot have both #[serde(deserialize_with)] and \ - #[serde(skip_deserializing)]", variant.ident)); + cx.error(format!( + "variant `{}` cannot have both #[serde(deserialize_with)] and \ + #[serde(skip_deserializing)]", + variant.ident + )); } for (i, field) in variant.fields.iter().enumerate() { if field.attrs.skip_deserializing() { - let ident = field.ident.as_ref().map_or_else(|| format!("{}", i), - |ident| format!("`{}`", ident)); + let ident = field + .ident + .as_ref() + .map_or_else(|| format!("{}", i), |ident| format!("`{}`", ident)); - cx.error(format!("variant `{}` cannot have both #[serde(deserialize_with)] \ - and a field {} marked with #[serde(skip_deserializing)]", - variant.ident, ident)); + cx.error(format!( + "variant `{}` cannot have both #[serde(deserialize_with)] \ + and a field {} marked with #[serde(skip_deserializing)]", + variant.ident, ident + )); } } } diff --git a/src/vendor/serde_derive_internals/src/ctxt.rs b/src/vendor/serde_derive_internals/src/ctxt.rs index fa8c57ad61..0ce7916cd2 100644 --- a/src/vendor/serde_derive_internals/src/ctxt.rs +++ b/src/vendor/serde_derive_internals/src/ctxt.rs @@ -16,7 +16,9 @@ pub struct Ctxt { impl Ctxt { pub fn new() -> Self { - Ctxt { errors: RefCell::new(Some(Vec::new())) } + Ctxt { + errors: RefCell::new(Some(Vec::new())), + } } pub fn error(&self, msg: T) { diff --git a/src/vendor/serde_derive_internals/src/lib.rs b/src/vendor/serde_derive_internals/src/lib.rs index 0667936a12..13e58f34e0 100644 --- a/src/vendor/serde_derive_internals/src/lib.rs +++ b/src/vendor/serde_derive_internals/src/lib.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.17.0")] +#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.18.1")] extern crate syn; #[macro_use] diff --git a/src/vendor/serde_json/.cargo-checksum.json b/src/vendor/serde_json/.cargo-checksum.json index a2018eee81..67f9983a10 100644 --- a/src/vendor/serde_json/.cargo-checksum.json +++ b/src/vendor/serde_json/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"931fd253ed29c5f1f6d3cbcab0914654dc5bd3f31a23c878dc1bc2e2dd930730","Cargo.toml.orig":"52c62a6ca171d117f8b4a7dced0f57c6fb5f2409504e14347f2b2f51c300c47d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"beecc7bbc5171a265264513a45653e2ffd8dc83c3a4ca4db90ae2c62ef74d53f","src/de.rs":"6b7ea06c0b3f14e2040d70068e9745d5eddee7749ed9c4fb47bc865821d2a0b5","src/error.rs":"93ffe9163c6766aa0cbb1e4214ac85dfd0c04ec8d73147ac19f7440b8924f211","src/iter.rs":"b5c77c5482e45bed1e63bd36a0f991a08f732811546a163228be48303e7f1b4d","src/lib.rs":"46a7abc3ddbc36bddbdc3af5121a8ad44ca1ee2189adc413d079a367446e3ded","src/macros.rs":"fca059b7c353528bd18da3dbf1552229ea6363d4b5942349765b250a86badd89","src/map.rs":"5df65bf055bf4821c73b1fd82ed5dfb20d27da34ab72a53c2c4c96d7520e6253","src/number.rs":"2143a6d6ffdbb993c46294283659a1b2380da6eb24de2b114a2103f8040a5f30","src/read.rs":"3ce991155e7d226549a91c34665eec281d5d161a131c2c2ec436674d558c7b2c","src/ser.rs":"aa3d90f2ac90c57548637dcf2681515990b7ea3b8efe191cbfb373f694303c94","src/value/de.rs":"462a19784e18597e411318d3de610756031bade2beec30cc2b59b5af78dcff43","src/value/from.rs":"4d8014c358458ad1a7985eb04aa7214d7ed9beeafa912ec53b84a1adb6b89b59","src/value/index.rs":"224568de290fed50be719742a07823d48cad230ba5a1a6f40e10b82e8355206f","src/value/mod.rs":"0c2a092e5bb2b34e175f86bc60c5045465d8df2fa434e2e5ef913d8c07e03886","src/value/partial_eq.rs":"9f2a71e8b76f8df5f75b183b7e92dd7363f52a68b66049c776ee3d8753ae5a88","src/value/ser.rs":"6e327ee7a15466ff2ccbb5d0f37cfe66d184d844571296b22e2221151b00d09c"},"package":"e4586746d1974a030c48919731ecffd0ed28d0c40749d0d18d43b3a7d6c9b20e"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"afa561ee04e7ec9159a31c7e3082621d83bd7d0f3a0cc968b74eedb6aed5d2a5","Cargo.toml.orig":"65febf4aceccf34ba5f8d6c043b1f1f64f039ccabba59517fe5f250fbdb253d1","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"beecc7bbc5171a265264513a45653e2ffd8dc83c3a4ca4db90ae2c62ef74d53f","src/de.rs":"ec01caf2fae8972c41b7c6f441863998af84bbc2f29b8881e686af2f641e2652","src/error.rs":"4a10727791c08420fec2bbd3bb87b6333074c04c9ab30d79efa5ff685ba98fce","src/iter.rs":"b5c77c5482e45bed1e63bd36a0f991a08f732811546a163228be48303e7f1b4d","src/lib.rs":"7515cf6a86e59a2fcfb9687fea7c5d8e776de9878234110b30adcd6810244649","src/macros.rs":"fca059b7c353528bd18da3dbf1552229ea6363d4b5942349765b250a86badd89","src/map.rs":"5df65bf055bf4821c73b1fd82ed5dfb20d27da34ab72a53c2c4c96d7520e6253","src/number.rs":"7566b69fa9261df5e03bf609b347d89acaaaf624f9e01654985e5a131f7be475","src/read.rs":"3ce991155e7d226549a91c34665eec281d5d161a131c2c2ec436674d558c7b2c","src/ser.rs":"aa3d90f2ac90c57548637dcf2681515990b7ea3b8efe191cbfb373f694303c94","src/value/de.rs":"462a19784e18597e411318d3de610756031bade2beec30cc2b59b5af78dcff43","src/value/from.rs":"4d8014c358458ad1a7985eb04aa7214d7ed9beeafa912ec53b84a1adb6b89b59","src/value/index.rs":"224568de290fed50be719742a07823d48cad230ba5a1a6f40e10b82e8355206f","src/value/mod.rs":"0c2a092e5bb2b34e175f86bc60c5045465d8df2fa434e2e5ef913d8c07e03886","src/value/partial_eq.rs":"9f2a71e8b76f8df5f75b183b7e92dd7363f52a68b66049c776ee3d8753ae5a88","src/value/ser.rs":"6e327ee7a15466ff2ccbb5d0f37cfe66d184d844571296b22e2221151b00d09c"},"package":"7cf5b0b5b4bd22eeecb7e01ac2e1225c7ef5e4272b79ee28a8392a8c8489c839"} \ No newline at end of file diff --git a/src/vendor/serde_json/Cargo.toml b/src/vendor/serde_json/Cargo.toml index 550e855ef5..e592e8cf7e 100644 --- a/src/vendor/serde_json/Cargo.toml +++ b/src/vendor/serde_json/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "serde_json" -version = "1.0.6" +version = "1.0.8" authors = ["Erick Tryzelaar ", "David Tolnay "] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "A JSON serialization file format" diff --git a/src/vendor/serde_json/Cargo.toml.orig b/src/vendor/serde_json/Cargo.toml.orig index 6d567aabfb..6a910456a6 100644 --- a/src/vendor/serde_json/Cargo.toml.orig +++ b/src/vendor/serde_json/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.6" # remember to update html_root_url +version = "1.0.8" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT/Apache-2.0" description = "A JSON serialization file format" diff --git a/src/vendor/serde_json/src/de.rs b/src/vendor/serde_json/src/de.rs index a2deef2cba..696585fdae 100644 --- a/src/vendor/serde_json/src/de.rs +++ b/src/vendor/serde_json/src/de.rs @@ -12,7 +12,7 @@ use std::{i32, u64}; use std::io; use std::marker::PhantomData; -use serde::de::{self, Unexpected}; +use serde::de::{self, Expected, Unexpected}; use super::error::{Error, ErrorCode, Result}; @@ -97,6 +97,14 @@ impl Number { Number::I64(x) => visitor.visit_i64(x), } } + + fn invalid_type(self, exp: &Expected) -> Error { + match self { + Number::F64(x) => de::Error::invalid_type(Unexpected::Float(x), exp), + Number::U64(x) => de::Error::invalid_type(Unexpected::Unsigned(x), exp), + Number::I64(x) => de::Error::invalid_type(Unexpected::Signed(x), exp), + } + } } impl<'de, R: Read<'de>> Deserializer { @@ -147,13 +155,15 @@ impl<'de, R: Read<'de>> Deserializer { } /// Error caused by a byte from next_char(). - fn error(&mut self, reason: ErrorCode) -> Error { + #[cold] + fn error(&self, reason: ErrorCode) -> Error { let pos = self.read.position(); Error::syntax(reason, pos.line, pos.column) } /// Error caused by a byte from peek(). - fn peek_error(&mut self, reason: ErrorCode) -> Error { + #[cold] + fn peek_error(&self, reason: ErrorCode) -> Error { let pos = self.read.peek_position(); Error::syntax(reason, pos.line, pos.column) } @@ -173,7 +183,64 @@ impl<'de, R: Read<'de>> Deserializer { } } - fn parse_value(&mut self, visitor: V) -> Result + #[cold] + fn peek_invalid_type(&mut self, exp: &Expected) -> Error { + let err = match self.peek_or_null().unwrap_or(b'\x00') { + b'n' => { + self.eat_char(); + if let Err(err) = self.parse_ident(b"ull") { + return err; + } + de::Error::invalid_type(Unexpected::Unit, exp) + } + b't' => { + self.eat_char(); + if let Err(err) = self.parse_ident(b"rue") { + return err; + } + de::Error::invalid_type(Unexpected::Bool(true), exp) + } + b'f' => { + self.eat_char(); + if let Err(err) = self.parse_ident(b"alse") { + return err; + } + de::Error::invalid_type(Unexpected::Bool(false), exp) + } + b'-' => { + self.eat_char(); + match self.parse_integer(false) { + Ok(n) => n.invalid_type(exp), + Err(err) => return err, + } + } + b'0'...b'9' => { + match self.parse_integer(true) { + Ok(n) => n.invalid_type(exp), + Err(err) => return err, + } + } + b'"' => { + self.eat_char(); + self.str_buf.clear(); + match self.read.parse_str(&mut self.str_buf) { + Ok(s) => de::Error::invalid_type(Unexpected::Str(&s), exp), + Err(err) => return err, + } + } + b'[' => { + de::Error::invalid_type(Unexpected::Seq, exp) + } + b'{' => { + de::Error::invalid_type(Unexpected::Map, exp) + } + _ => self.peek_error(ErrorCode::ExpectedSomeValue), + }; + + self.fix_position(err) + } + + fn deserialize_number(&mut self, visitor: V) -> Result where V: de::Visitor<'de>, { @@ -185,81 +252,25 @@ impl<'de, R: Read<'de>> Deserializer { }; let value = match peek { - b'n' => { - self.eat_char(); - try!(self.parse_ident(b"ull")); - visitor.visit_unit() - } - b't' => { - self.eat_char(); - try!(self.parse_ident(b"rue")); - visitor.visit_bool(true) - } - b'f' => { - self.eat_char(); - try!(self.parse_ident(b"alse")); - visitor.visit_bool(false) - } b'-' => { self.eat_char(); try!(self.parse_integer(false)).visit(visitor) } b'0'...b'9' => try!(self.parse_integer(true)).visit(visitor), - b'"' => { - self.eat_char(); - self.str_buf.clear(); - match try!(self.read.parse_str(&mut self.str_buf)) { - Reference::Borrowed(s) => visitor.visit_borrowed_str(s), - Reference::Copied(s) => visitor.visit_str(s), - } - } - b'[' => { - self.remaining_depth -= 1; - if self.remaining_depth == 0 { - return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); - } - - self.eat_char(); - let ret = visitor.visit_seq(SeqAccess::new(self)); - - self.remaining_depth += 1; - - match (ret, self.end_seq()) { - (Ok(ret), Ok(())) => Ok(ret), - (Err(err), _) | (_, Err(err)) => Err(err), - } - } - b'{' => { - self.remaining_depth -= 1; - if self.remaining_depth == 0 { - return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); - } - - self.eat_char(); - let ret = visitor.visit_map(MapAccess::new(self)); - - self.remaining_depth += 1; - - match (ret, self.end_map()) { - (Ok(ret), Ok(())) => Ok(ret), - (Err(err), _) | (_, Err(err)) => Err(err), - } - } - _ => Err(self.peek_error(ErrorCode::ExpectedSomeValue)), + _ => Err(self.peek_invalid_type(&visitor)), }; match value { Ok(value) => Ok(value), - // The de::Error and From impls both create errors - // with unknown line and column. Fill in the position here by - // looking at the current index in the input. There is no way to - // tell whether this should call `error` or `peek_error` so pick the - // one that seems correct more often. Worst case, the position is - // off by one character. - Err(err) => Err(err.fix_position(|code| self.error(code))), + Err(err) => Err(self.fix_position(err)), } } + #[cold] + fn fix_position(&self, err: Error) -> Error { + err.fix_position(move |code| self.error(code)) + } + fn parse_ident(&mut self, ident: &[u8]) -> Result<()> { for c in ident { if Some(*c) != try!(self.next_char()) { @@ -793,73 +804,232 @@ impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer { where V: de::Visitor<'de>, { - self.parse_value(visitor) - } + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; - /// Parses a `null` as a None, and any other values as a `Some(...)`. - #[inline] - fn deserialize_option(self, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - match try!(self.parse_whitespace()) { - Some(b'n') => { + let value = match peek { + b'n' => { self.eat_char(); try!(self.parse_ident(b"ull")); - visitor.visit_none() + visitor.visit_unit() } - _ => visitor.visit_some(self), - } - } - - /// Parses a newtype struct as the underlying value. - #[inline] - fn deserialize_newtype_struct(self, _name: &str, visitor: V) -> Result - where - V: de::Visitor<'de>, - { - visitor.visit_newtype_struct(self) - } - - /// Parses an enum as an object like `{"$KEY":$VALUE}`, where $VALUE is either a straight - /// value, a `[..]`, or a `{..}`. - #[inline] - fn deserialize_enum( - self, - _name: &str, - _variants: &'static [&'static str], - visitor: V, - ) -> Result - where - V: de::Visitor<'de>, - { - match try!(self.parse_whitespace()) { - Some(b'{') => { + b't' => { + self.eat_char(); + try!(self.parse_ident(b"rue")); + visitor.visit_bool(true) + } + b'f' => { + self.eat_char(); + try!(self.parse_ident(b"alse")); + visitor.visit_bool(false) + } + b'-' => { + self.eat_char(); + try!(self.parse_integer(false)).visit(visitor) + } + b'0'...b'9' => try!(self.parse_integer(true)).visit(visitor), + b'"' => { + self.eat_char(); + self.str_buf.clear(); + match try!(self.read.parse_str(&mut self.str_buf)) { + Reference::Borrowed(s) => visitor.visit_borrowed_str(s), + Reference::Copied(s) => visitor.visit_str(s), + } + } + b'[' => { self.remaining_depth -= 1; if self.remaining_depth == 0 { return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); } self.eat_char(); - let value = try!(visitor.visit_enum(VariantAccess::new(self))); + let ret = visitor.visit_seq(SeqAccess::new(self)); self.remaining_depth += 1; - match try!(self.parse_whitespace()) { - Some(b'}') => { - self.eat_char(); - Ok(value) - } - Some(_) => Err(self.error(ErrorCode::ExpectedSomeValue)), - None => Err(self.error(ErrorCode::EofWhileParsingObject)), + match (ret, self.end_seq()) { + (Ok(ret), Ok(())) => Ok(ret), + (Err(err), _) | (_, Err(err)) => Err(err), } } - Some(b'"') => visitor.visit_enum(UnitVariantAccess::new(self)), - Some(_) => Err(self.peek_error(ErrorCode::ExpectedSomeValue)), - None => Err(self.peek_error(ErrorCode::EofWhileParsingValue)), + b'{' => { + self.remaining_depth -= 1; + if self.remaining_depth == 0 { + return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); + } + + self.eat_char(); + let ret = visitor.visit_map(MapAccess::new(self)); + + self.remaining_depth += 1; + + match (ret, self.end_map()) { + (Ok(ret), Ok(())) => Ok(ret), + (Err(err), _) | (_, Err(err)) => Err(err), + } + } + _ => Err(self.peek_error(ErrorCode::ExpectedSomeValue)), + }; + + match value { + Ok(value) => Ok(value), + // The de::Error impl creates errors with unknown line and column. + // Fill in the position here by looking at the current index in the + // input. There is no way to tell whether this should call `error` + // or `peek_error` so pick the one that seems correct more often. + // Worst case, the position is off by one character. + Err(err) => Err(self.fix_position(err)), } } + fn deserialize_bool(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; + + let value = match peek { + b't' => { + self.eat_char(); + try!(self.parse_ident(b"rue")); + visitor.visit_bool(true) + } + b'f' => { + self.eat_char(); + try!(self.parse_ident(b"alse")); + visitor.visit_bool(false) + } + _ => Err(self.peek_invalid_type(&visitor)), + }; + + match value { + Ok(value) => Ok(value), + Err(err) => Err(self.fix_position(err)), + } + } + + fn deserialize_i8(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_i16(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_i32(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_i64(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_u8(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_u16(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_u32(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_u64(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_f32(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_f64(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_number(visitor) + } + + fn deserialize_char(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_str(visitor) + } + + fn deserialize_str(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; + + let value = match peek { + b'"' => { + self.eat_char(); + self.str_buf.clear(); + match try!(self.read.parse_str(&mut self.str_buf)) { + Reference::Borrowed(s) => visitor.visit_borrowed_str(s), + Reference::Copied(s) => visitor.visit_str(s), + } + } + _ => Err(self.peek_invalid_type(&visitor)), + }; + + match value { + Ok(value) => Ok(value), + Err(err) => Err(self.fix_position(err)), + } + } + + fn deserialize_string(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_str(visitor) + } + /// Parses a JSON string as bytes. Note that this function does not check /// whether the bytes represent a valid UTF-8 string. /// @@ -945,8 +1115,15 @@ impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer { where V: de::Visitor<'de>, { - match try!(self.parse_whitespace()) { - Some(b'"') => { + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; + + let value = match peek { + b'"' => { self.eat_char(); self.str_buf.clear(); match try!(self.read.parse_str_raw(&mut self.str_buf)) { @@ -954,9 +1131,14 @@ impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer { Reference::Copied(b) => visitor.visit_bytes(b), } } - _ => self.deserialize_any(visitor), - } + b'[' => self.deserialize_seq(visitor), + _ => Err(self.peek_invalid_type(&visitor)), + }; + match value { + Ok(value) => Ok(value), + Err(err) => Err(self.fix_position(err)), + } } #[inline] @@ -967,6 +1149,272 @@ impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer { self.deserialize_bytes(visitor) } + /// Parses a `null` as a None, and any other values as a `Some(...)`. + #[inline] + fn deserialize_option(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + match try!(self.parse_whitespace()) { + Some(b'n') => { + self.eat_char(); + try!(self.parse_ident(b"ull")); + visitor.visit_none() + } + _ => visitor.visit_some(self), + } + } + + fn deserialize_unit(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; + + let value = match peek { + b'n' => { + self.eat_char(); + try!(self.parse_ident(b"ull")); + visitor.visit_unit() + } + _ => Err(self.peek_invalid_type(&visitor)), + }; + + match value { + Ok(value) => Ok(value), + Err(err) => Err(self.fix_position(err)), + } + } + + fn deserialize_unit_struct( + self, + _name: &'static str, + visitor: V + ) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_unit(visitor) + } + + /// Parses a newtype struct as the underlying value. + #[inline] + fn deserialize_newtype_struct(self, _name: &str, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_newtype_struct(self) + } + + fn deserialize_seq(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; + + let value = match peek { + b'[' => { + self.remaining_depth -= 1; + if self.remaining_depth == 0 { + return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); + } + + self.eat_char(); + let ret = visitor.visit_seq(SeqAccess::new(self)); + + self.remaining_depth += 1; + + match (ret, self.end_seq()) { + (Ok(ret), Ok(())) => Ok(ret), + (Err(err), _) | (_, Err(err)) => Err(err), + } + } + _ => Err(self.peek_invalid_type(&visitor)), + }; + + match value { + Ok(value) => Ok(value), + Err(err) => Err(self.fix_position(err)), + } + } + + fn deserialize_tuple( + self, + _len: usize, + visitor: V + ) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_tuple_struct( + self, + _name: &'static str, + _len: usize, + visitor: V + ) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_map(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; + + let value = match peek { + b'{' => { + self.remaining_depth -= 1; + if self.remaining_depth == 0 { + return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); + } + + self.eat_char(); + let ret = visitor.visit_map(MapAccess::new(self)); + + self.remaining_depth += 1; + + match (ret, self.end_map()) { + (Ok(ret), Ok(())) => Ok(ret), + (Err(err), _) | (_, Err(err)) => Err(err), + } + } + _ => Err(self.peek_invalid_type(&visitor)), + }; + + match value { + Ok(value) => Ok(value), + Err(err) => Err(self.fix_position(err)), + } + } + + fn deserialize_struct( + self, + _name: &'static str, + _fields: &'static [&'static str], + visitor: V + ) -> Result + where + V: de::Visitor<'de>, + { + let peek = match try!(self.parse_whitespace()) { + Some(b) => b, + None => { + return Err(self.peek_error(ErrorCode::EofWhileParsingValue)); + } + }; + + let value = match peek { + b'[' => { + self.remaining_depth -= 1; + if self.remaining_depth == 0 { + return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); + } + + self.eat_char(); + let ret = visitor.visit_seq(SeqAccess::new(self)); + + self.remaining_depth += 1; + + match (ret, self.end_seq()) { + (Ok(ret), Ok(())) => Ok(ret), + (Err(err), _) | (_, Err(err)) => Err(err), + } + } + b'{' => { + self.remaining_depth -= 1; + if self.remaining_depth == 0 { + return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); + } + + self.eat_char(); + let ret = visitor.visit_map(MapAccess::new(self)); + + self.remaining_depth += 1; + + match (ret, self.end_map()) { + (Ok(ret), Ok(())) => Ok(ret), + (Err(err), _) | (_, Err(err)) => Err(err), + } + } + _ => Err(self.peek_invalid_type(&visitor)), + }; + + match value { + Ok(value) => Ok(value), + Err(err) => Err(self.fix_position(err)), + } + } + + /// Parses an enum as an object like `{"$KEY":$VALUE}`, where $VALUE is either a straight + /// value, a `[..]`, or a `{..}`. + #[inline] + fn deserialize_enum( + self, + _name: &str, + _variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + match try!(self.parse_whitespace()) { + Some(b'{') => { + self.remaining_depth -= 1; + if self.remaining_depth == 0 { + return Err(self.peek_error(ErrorCode::RecursionLimitExceeded)); + } + + self.eat_char(); + let value = try!(visitor.visit_enum(VariantAccess::new(self))); + + self.remaining_depth += 1; + + match try!(self.parse_whitespace()) { + Some(b'}') => { + self.eat_char(); + Ok(value) + } + Some(_) => Err(self.error(ErrorCode::ExpectedSomeValue)), + None => Err(self.error(ErrorCode::EofWhileParsingObject)), + } + } + Some(b'"') => visitor.visit_enum(UnitVariantAccess::new(self)), + Some(_) => Err(self.peek_error(ErrorCode::ExpectedSomeValue)), + None => Err(self.peek_error(ErrorCode::EofWhileParsingValue)), + } + } + + fn deserialize_identifier( + self, + visitor: V + ) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_str(visitor) + } + fn deserialize_ignored_any(self, visitor: V) -> Result where V: de::Visitor<'de>, @@ -974,11 +1422,6 @@ impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer { try!(self.ignore_value()); visitor.visit_unit() } - - forward_to_deserialize_any! { - bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string unit - unit_struct seq tuple tuple_struct map struct identifier - } } struct SeqAccess<'a, R: 'a> { @@ -1133,14 +1576,14 @@ impl<'de, 'a, R: Read<'de> + 'a> de::VariantAccess<'de> for VariantAccess<'a, R> where V: de::Visitor<'de>, { - de::Deserializer::deserialize_any(self.de, visitor) + de::Deserializer::deserialize_seq(self.de, visitor) } - fn struct_variant(self, _fields: &'static [&'static str], visitor: V) -> Result + fn struct_variant(self, fields: &'static [&'static str], visitor: V) -> Result where V: de::Visitor<'de>, { - de::Deserializer::deserialize_any(self.de, visitor) + de::Deserializer::deserialize_struct(self.de, "", fields, visitor) } } @@ -1231,7 +1674,12 @@ where where V: de::Visitor<'de>, { - self.de.parse_value(visitor) + self.de.eat_char(); + self.de.str_buf.clear(); + match try!(self.de.read.parse_str(&mut self.de.str_buf)) { + Reference::Borrowed(s) => visitor.visit_borrowed_str(s), + Reference::Copied(s) => visitor.visit_str(s), + } } deserialize_integer_key!(deserialize_i8 => visit_i8); @@ -1302,9 +1750,8 @@ where /// A stream deserializer can be created from any JSON deserializer using the /// `Deserializer::into_iter` method. /// -/// The data must consist of JSON arrays and JSON objects optionally separated -/// by whitespace. A null, boolean, number, or string at the top level are all -/// errors. +/// The data can consist of any JSON value. Values need to be a self-delineating value e.g. +/// arrays, objects, or strings, or be followed by whitespace or a self-delineating value. /// /// ```rust /// extern crate serde_json; @@ -1312,7 +1759,7 @@ where /// use serde_json::{Deserializer, Value}; /// /// fn main() { -/// let data = "{\"k\": 3} {} [0, 1, 2]"; +/// let data = "{\"k\": 3}1\"cool\"\"stuff\" 3{} [0, 1, 2]"; /// /// let stream = Deserializer::from_str(data).into_iter::(); /// @@ -1385,6 +1832,18 @@ where pub fn byte_offset(&self) -> usize { self.offset } + + fn peek_end_of_value(&mut self) -> Result<()> { + match try!(self.de.peek()) { + Some(b' ') | Some(b'\n') | Some(b'\t') | Some(b'\r') | + Some(b'"') | Some(b'[') | Some(b']') | Some(b'{') | + Some(b'}') | Some(b',') | Some(b':') | None => Ok(()), + Some(_) => { + let pos = self.de.read.peek_position(); + Err(Error::syntax(ErrorCode::TrailingCharacters, pos.line, pos.column)) + }, + } + } } impl<'de, R, T> Iterator for StreamDeserializer<'de, R, T> @@ -1403,16 +1862,30 @@ where self.offset = self.de.read.byte_offset(); None } - Ok(Some(b'{')) | Ok(Some(b'[')) => { + Ok(Some(b)) => { + // If the value does not have a clear way to show the end of the value + // (like numbers, null, true etc.) we have to look for whitespace or + // the beginning of a self-delineated value. + let self_delineated_value = match b { + b'[' | b'"' | b'{' => true, + _ => false, + }; self.offset = self.de.read.byte_offset(); let result = de::Deserialize::deserialize(&mut self.de); - if result.is_ok() { - self.offset = self.de.read.byte_offset(); - } - Some(result) + + Some(match result { + Ok(value) => { + self.offset = self.de.read.byte_offset(); + if self_delineated_value { + Ok(value) + } else { + self.peek_end_of_value().map(|_| value) + } + } + Err(e) => Err(e) + }) } - Ok(Some(_)) => Some(Err(self.de.peek_error(ErrorCode::ExpectedObjectOrArray))), - Err(e) => Some(Err(e)), + Err(e) => Some(Err(e)) } } } diff --git a/src/vendor/serde_json/src/error.rs b/src/vendor/serde_json/src/error.rs index 3338d88840..b9e8616491 100644 --- a/src/vendor/serde_json/src/error.rs +++ b/src/vendor/serde_json/src/error.rs @@ -190,7 +190,7 @@ struct ErrorImpl { #[derive(Debug)] pub enum ErrorCode { /// Catchall for syntax error messages - Message(String), + Message(Box), /// Some IO error occurred while serializing or deserializing. Io(io::Error), @@ -388,7 +388,7 @@ impl de::Error for Error { Error { err: Box::new( ErrorImpl { - code: ErrorCode::Message(msg.to_string()), + code: ErrorCode::Message(msg.to_string().into_boxed_str()), line: 0, column: 0, }, @@ -410,7 +410,7 @@ impl ser::Error for Error { Error { err: Box::new( ErrorImpl { - code: ErrorCode::Message(msg.to_string()), + code: ErrorCode::Message(msg.to_string().into_boxed_str()), line: 0, column: 0, }, diff --git a/src/vendor/serde_json/src/lib.rs b/src/vendor/serde_json/src/lib.rs index 37c8830ced..c16eb81ad0 100644 --- a/src/vendor/serde_json/src/lib.rs +++ b/src/vendor/serde_json/src/lib.rs @@ -309,7 +309,7 @@ //! [to_writer]: https://docs.serde.rs/serde_json/ser/fn.to_writer.html //! [macro]: https://docs.serde.rs/serde_json/macro.json.html -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.6")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.8")] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Whitelisted clippy lints #![cfg_attr(feature = "cargo-clippy", allow( @@ -358,6 +358,19 @@ pub use self::ser::{Serializer, to_string, to_string_pretty, to_vec, to_vec_pret #[doc(inline)] pub use self::value::{Map, Number, Value, from_value, to_value}; +// We only use our own error type; no need for From conversions provided by the +// standard library's try! macro. This reduces lines of LLVM IR by 4%. +macro_rules! try { + ($e:expr) => { + match $e { + ::std::result::Result::Ok(val) => val, + ::std::result::Result::Err(err) => { + return ::std::result::Result::Err(err) + } + } + } +} + #[macro_use] mod macros; diff --git a/src/vendor/serde_json/src/number.rs b/src/vendor/serde_json/src/number.rs index 929ddd1674..bbdd666c52 100644 --- a/src/vendor/serde_json/src/number.rs +++ b/src/vendor/serde_json/src/number.rs @@ -19,9 +19,6 @@ pub struct Number { n: N, } -// "N" is a prefix of "NegInt"... this is a false positive. -// https://github.com/Manishearth/rust-clippy/issues/1241 -#[cfg_attr(feature = "cargo-clippy", allow(enum_variant_names))] #[derive(Copy, Clone, Debug, PartialEq)] enum N { PosInt(u64), diff --git a/src/vendor/smallvec-0.3.3/.cargo-checksum.json b/src/vendor/smallvec-0.3.3/.cargo-checksum.json new file mode 100644 index 0000000000..66ad40a667 --- /dev/null +++ b/src/vendor/smallvec-0.3.3/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"8d8372a5e10c6d301d70d45da3d51a4b8cbd6d51b57a62e7730942adc69da200","Cargo.toml":"48402d1ef9c6e0015e98104e1b9ec5c406a2e5ca5d8f8b0382a1ed4decdf96f8","README.md":"85c6105e404b1febba9e06773350cc81fe5966369530210669b3465c66237a09","benches/bench.rs":"54cf4879d36ba2a9f3423af91bb93227b70849200e5bf74e384a166d6aa09893","lib.rs":"acdf2c4778adb0b613efb08ff4612d8d7fb2d67747da026ab3894539e7f3e3ed"},"package":"4f8266519bc1d17d0b5b16f6c21295625d562841c708f6376f49028a43e9c11e"} \ No newline at end of file diff --git a/src/vendor/smallvec-0.3.3/.cargo-ok b/src/vendor/smallvec-0.3.3/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/smallvec-0.3.3/.gitignore b/src/vendor/smallvec-0.3.3/.gitignore new file mode 100644 index 0000000000..a9d37c560c --- /dev/null +++ b/src/vendor/smallvec-0.3.3/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/src/vendor/smallvec-0.3.3/.travis.yml b/src/vendor/smallvec-0.3.3/.travis.yml new file mode 100644 index 0000000000..8a946c32de --- /dev/null +++ b/src/vendor/smallvec-0.3.3/.travis.yml @@ -0,0 +1,13 @@ +language: rust +rust: + - nightly + - beta + - stable +script: | + cargo build --verbose && + cargo build --features=heapsizeof --verbose && + cargo test --verbose && + cargo test --features=heapsizeof --verbose && + ([ $TRAVIS_RUST_VERSION != nightly ] || cargo bench --verbose bench) +notifications: + webhooks: http://build.servo.org:54856/travis diff --git a/src/vendor/smallvec-0.3.3/Cargo.toml b/src/vendor/smallvec-0.3.3/Cargo.toml new file mode 100644 index 0000000000..2a64c0419a --- /dev/null +++ b/src/vendor/smallvec-0.3.3/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "smallvec" +version = "0.3.3" +authors = ["Simon Sapin "] +license = "MPL-2.0" +repository = "https://github.com/servo/rust-smallvec" +description = "'Small vector' optimization: store up to a small number of items on the stack" +keywords = ["small", "vec", "vector", "stack"] +readme = "README.md" +documentation = "http://doc.servo.org/smallvec/" + +[features] +heapsizeof = ["heapsize"] + +[lib] +name = "smallvec" +path = "lib.rs" + +[dependencies] +heapsize = { version = "0.3", optional = true } diff --git a/src/vendor/smallvec-0.3.3/README.md b/src/vendor/smallvec-0.3.3/README.md new file mode 100644 index 0000000000..a7211e09ff --- /dev/null +++ b/src/vendor/smallvec-0.3.3/README.md @@ -0,0 +1,6 @@ +rust-smallvec +============= + +[Documentation](http://doc.servo.org/smallvec/) + +"Small vector" optimization for Rust: store up to a small number of items on the stack diff --git a/src/vendor/smallvec-0.3.3/benches/bench.rs b/src/vendor/smallvec-0.3.3/benches/bench.rs new file mode 100644 index 0000000000..3ca112aab9 --- /dev/null +++ b/src/vendor/smallvec-0.3.3/benches/bench.rs @@ -0,0 +1,111 @@ +#![feature(test)] + +extern crate smallvec; +extern crate test; + +use smallvec::SmallVec; +use self::test::Bencher; + +#[bench] +fn bench_push(b: &mut Bencher) { + #[inline(never)] + fn push_noinline(vec: &mut SmallVec<[u64; 16]>, x: u64) { + vec.push(x) + } + + b.iter(|| { + let mut vec: SmallVec<[u64; 16]> = SmallVec::new(); + for x in 0..100 { + push_noinline(&mut vec, x); + } + vec + }); +} + +#[bench] +fn bench_insert(b: &mut Bencher) { + #[inline(never)] + fn insert_noinline(vec: &mut SmallVec<[u64; 16]>, x: u64) { + vec.insert(0, x) + } + + b.iter(|| { + let mut vec: SmallVec<[u64; 16]> = SmallVec::new(); + for x in 0..100 { + insert_noinline(&mut vec, x); + } + vec + }); +} + +#[bench] +fn bench_insert_many(b: &mut Bencher) { + #[inline(never)] + fn insert_many_noinline>( + vec: &mut SmallVec<[u64; 16]>, index: usize, iterable: I) { + vec.insert_many(index, iterable) + } + + b.iter(|| { + let mut vec: SmallVec<[u64; 16]> = SmallVec::new(); + insert_many_noinline(&mut vec, 0, 0..100); + insert_many_noinline(&mut vec, 0, 0..100); + vec + }); +} + +#[bench] +fn bench_extend(b: &mut Bencher) { + b.iter(|| { + let mut vec: SmallVec<[u64; 16]> = SmallVec::new(); + vec.extend(0..100); + vec + }); +} + +#[bench] +fn bench_from_slice(b: &mut Bencher) { + let v: Vec = (0..100).collect(); + b.iter(|| { + let vec: SmallVec<[u64; 16]> = SmallVec::from_slice(&v); + vec + }); +} + +#[bench] +fn bench_extend_from_slice(b: &mut Bencher) { + let v: Vec = (0..100).collect(); + b.iter(|| { + let mut vec: SmallVec<[u64; 16]> = SmallVec::new(); + vec.extend_from_slice(&v); + vec + }); +} + +#[bench] +fn bench_insert_from_slice(b: &mut Bencher) { + let v: Vec = (0..100).collect(); + b.iter(|| { + let mut vec: SmallVec<[u64; 16]> = SmallVec::new(); + vec.insert_from_slice(0, &v); + vec.insert_from_slice(0, &v); + vec + }); +} + +#[bench] +fn bench_pushpop(b: &mut Bencher) { + #[inline(never)] + fn pushpop_noinline(vec: &mut SmallVec<[u64; 16]>, x: u64) { + vec.push(x); + vec.pop(); + } + + b.iter(|| { + let mut vec: SmallVec<[u64; 16]> = SmallVec::new(); + for x in 0..100 { + pushpop_noinline(&mut vec, x); + } + vec + }); +} diff --git a/src/vendor/smallvec-0.3.3/lib.rs b/src/vendor/smallvec-0.3.3/lib.rs new file mode 100644 index 0000000000..f03108a759 --- /dev/null +++ b/src/vendor/smallvec-0.3.3/lib.rs @@ -0,0 +1,1424 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! Small vectors in various sizes. These store a certain number of elements inline, and fall back +//! to the heap for larger allocations. This can be a useful optimization for improving cache +//! locality and reducing allocator traffic for workloads that fit within the inline buffer. + +#[cfg(feature="heapsizeof")] +extern crate heapsize; + +use std::borrow::{Borrow, BorrowMut}; +use std::cmp; +use std::fmt; +use std::hash::{Hash, Hasher}; +use std::iter::{IntoIterator, FromIterator}; +use std::mem; +use std::ops; +use std::ptr; +use std::slice; +#[cfg(feature="heapsizeof")] +use std::os::raw::c_void; + +#[cfg(feature="heapsizeof")] +use heapsize::{HeapSizeOf, heap_size_of}; +use SmallVecData::{Inline, Heap}; + +/// Common operations implemented by both `Vec` and `SmallVec`. +/// +/// This can be used to write generic code that works with both `Vec` and `SmallVec`. +/// +/// ## Example +/// +/// ```rust +/// use smallvec::{VecLike, SmallVec8}; +/// +/// fn initialize>(v: &mut V) { +/// for i in 0..5 { +/// v.push(i); +/// } +/// } +/// +/// let mut vec = Vec::new(); +/// initialize(&mut vec); +/// +/// let mut small_vec = SmallVec8::new(); +/// initialize(&mut small_vec); +/// ``` +pub trait VecLike: + ops::Index + + ops::IndexMut + + ops::Index, Output=[T]> + + ops::IndexMut> + + ops::Index, Output=[T]> + + ops::IndexMut> + + ops::Index, Output=[T]> + + ops::IndexMut> + + ops::Index + + ops::IndexMut + + ops::DerefMut + + Extend { + + /// Append an element to the vector. + fn push(&mut self, value: T); +} + +impl VecLike for Vec { + #[inline] + fn push(&mut self, value: T) { + Vec::push(self, value); + } +} + +unsafe fn deallocate(ptr: *mut T, capacity: usize) { + let _vec: Vec = Vec::from_raw_parts(ptr, 0, capacity); + // Let it drop. +} + +pub struct Drain<'a, T: 'a> { + iter: slice::IterMut<'a,T>, +} + +impl<'a, T: 'a> Iterator for Drain<'a,T> { + type Item = T; + + #[inline] + fn next(&mut self) -> Option { + match self.iter.next() { + None => None, + Some(reference) => { + unsafe { + Some(ptr::read(reference)) + } + } + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } +} + +impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> { + #[inline] + fn next_back(&mut self) -> Option { + match self.iter.next_back() { + None => None, + Some(reference) => { + unsafe { + Some(ptr::read(reference)) + } + } + } + } +} + +impl<'a, T> ExactSizeIterator for Drain<'a, T> { } + +impl<'a, T: 'a> Drop for Drain<'a,T> { + fn drop(&mut self) { + // Destroy the remaining elements. + for _ in self.by_ref() {} + } +} + +enum SmallVecData { + Inline { array: A }, + Heap { ptr: *mut A::Item, capacity: usize }, +} + +impl SmallVecData { + fn ptr_mut(&mut self) -> *mut A::Item { + match *self { + Inline { ref mut array } => array.ptr_mut(), + Heap { ptr, .. } => ptr, + } + } +} + +unsafe impl Send for SmallVecData {} +unsafe impl Sync for SmallVecData {} + +impl Drop for SmallVecData { + fn drop(&mut self) { + unsafe { + match *self { + ref mut inline @ Inline { .. } => { + // Inhibit the array destructor. + ptr::write(inline, Heap { + ptr: ptr::null_mut(), + capacity: 0, + }); + } + Heap { ptr, capacity } => deallocate(ptr, capacity), + } + } + } +} + +/// A `Vec`-like container that can store a small number of elements inline. +/// +/// `SmallVec` acts like a vector, but can store a limited amount of data inline within the +/// `Smallvec` struct rather than in a separate allocation. If the data exceeds this limit, the +/// `SmallVec` will "spill" its data onto the heap, allocating a new buffer to hold it. +/// +/// The amount of data that a `SmallVec` can store inline depends on its backing store. The backing +/// store can be any type that implements the `Array` trait; usually it is a small fixed-sized +/// array. For example a `SmallVec<[u64; 8]>` can hold up to eight 64-bit integers inline. +/// +/// Type aliases like `SmallVec8` are provided as convenient shorthand for types like +/// `SmallVec<[T; 8]>`. +/// +/// ## Example +/// +/// ```rust +/// use smallvec::SmallVec; +/// let mut v = SmallVec::<[u8; 4]>::new(); // initialize an empty vector +/// +/// use smallvec::SmallVec4; +/// let mut v: SmallVec4 = SmallVec::new(); // alternate way to write the above +/// +/// // SmallVec4 can hold up to 4 items without spilling onto the heap. +/// v.extend(0..4); +/// assert_eq!(v.len(), 4); +/// assert!(!v.spilled()); +/// +/// // Pushing another element will force the buffer to spill: +/// v.push(4); +/// assert_eq!(v.len(), 5); +/// assert!(v.spilled()); +/// ``` +pub struct SmallVec { + len: usize, + data: SmallVecData, +} + +impl SmallVec { + /// Construct an empty vector + #[inline] + pub fn new() -> SmallVec { + unsafe { + SmallVec { + len: 0, + data: Inline { array: mem::uninitialized() }, + } + } + } + + /// Construct a new `SmallVec` from a `Vec` without copying + /// elements. + /// + /// ```rust + /// use smallvec::SmallVec; + /// + /// let vec = vec![1, 2, 3, 4, 5]; + /// let small_vec: SmallVec<[_; 3]> = SmallVec::from_vec(vec); + /// + /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); + /// ``` + #[inline] + pub fn from_vec(mut vec: Vec) -> SmallVec { + let (ptr, cap, len) = (vec.as_mut_ptr(), vec.capacity(), vec.len()); + mem::forget(vec); + + SmallVec { + len: len, + data: SmallVecData::Heap { + ptr: ptr, + capacity: cap + } + } + } + + /// Sets the length of a vector. + /// + /// This will explicitly set the size of the vector, without actually + /// modifying its buffers, so it is up to the caller to ensure that the + /// vector is actually the specified size. + pub unsafe fn set_len(&mut self, new_len: usize) { + self.len = new_len + } + + /// The maximum number of elements this vector can hold inline + #[inline] + pub fn inline_size(&self) -> usize { + A::size() + } + + /// The number of elements stored in the vector + #[inline] + pub fn len(&self) -> usize { + self.len + } + + /// Returns `true` if the vector is empty + #[inline] + pub fn is_empty(&self) -> bool { + self.len == 0 + } + + /// The number of items the vector can hold without reallocating + #[inline] + pub fn capacity(&self) -> usize { + match self.data { + Inline { .. } => A::size(), + Heap { capacity, .. } => capacity, + } + } + + /// Returns `true` if the data has spilled into a separate heap-allocated buffer. + #[inline] + pub fn spilled(&self) -> bool { + match self.data { + Inline { .. } => false, + Heap { .. } => true, + } + } + + /// Empty the vector and return an iterator over its former contents. + pub fn drain(&mut self) -> Drain { + unsafe { + let current_len = self.len(); + self.set_len(0); + + let ptr = self.data.ptr_mut(); + + let slice = slice::from_raw_parts_mut(ptr, current_len); + + Drain { + iter: slice.iter_mut(), + } + } + } + + /// Append an item to the vector. + #[inline] + pub fn push(&mut self, value: A::Item) { + let cap = self.capacity(); + if self.len == cap { + self.grow(cmp::max(cap * 2, 1)) + } + unsafe { + let end = self.as_mut_ptr().offset(self.len as isize); + ptr::write(end, value); + let len = self.len; + self.set_len(len + 1) + } + } + + /// Append elements from an iterator. + /// + /// This function is deprecated; it has been replaced by `Extend::extend`. + #[deprecated(note = "Use `extend` instead")] + pub fn push_all_move>(&mut self, other: V) { + self.extend(other) + } + + /// Remove an item from the end of the vector and return it, or None if empty. + #[inline] + pub fn pop(&mut self) -> Option { + if self.len == 0 { + return None + } + let last_index = self.len - 1; + if (last_index as isize) < 0 { + panic!("overflow") + } + unsafe { + let end_ptr = self.as_mut_ptr().offset(last_index as isize); + let value = ptr::replace(end_ptr, mem::uninitialized()); + self.set_len(last_index); + Some(value) + } + } + + /// Re-allocate to set the capacity to `new_cap`. + /// + /// Panics if `new_cap` is less than the vector's length. + pub fn grow(&mut self, new_cap: usize) { + assert!(new_cap >= self.len); + let mut vec: Vec = Vec::with_capacity(new_cap); + let new_alloc = vec.as_mut_ptr(); + unsafe { + mem::forget(vec); + ptr::copy_nonoverlapping(self.as_ptr(), new_alloc, self.len); + + match self.data { + Inline { .. } => {} + Heap { ptr, capacity } => deallocate(ptr, capacity), + } + ptr::write(&mut self.data, Heap { + ptr: new_alloc, + capacity: new_cap, + }); + } + } + + /// Reserve capacity for `additional` more elements to be inserted. + /// + /// May reserve more space to avoid frequent reallocations. + /// + /// If the new capacity would overflow `usize` then it will be set to `usize::max_value()` + /// instead. (This means that inserting `additional` new elements is not guaranteed to be + /// possible after calling this function.) + pub fn reserve(&mut self, additional: usize) { + let len = self.len(); + if self.capacity() - len < additional { + match len.checked_add(additional).and_then(usize::checked_next_power_of_two) { + Some(cap) => self.grow(cap), + None => self.grow(usize::max_value()), + } + } + } + + /// Reserve the minumum capacity for `additional` more elements to be inserted. + /// + /// Panics if the new capacity overflows `usize`. + pub fn reserve_exact(&mut self, additional: usize) { + let len = self.len(); + if self.capacity() - len < additional { + match len.checked_add(additional) { + Some(cap) => self.grow(cap), + None => panic!("reserve_exact overflow"), + } + } + } + + /// Shrink the capacity of the vector as much as possible. + /// + /// When possible, this will move data from an external heap buffer to the vector's inline + /// storage. + pub fn shrink_to_fit(&mut self) { + let len = self.len; + if self.inline_size() >= len { + unsafe { + let (ptr, capacity) = match self.data { + Inline { .. } => return, + Heap { ptr, capacity } => (ptr, capacity), + }; + ptr::write(&mut self.data, Inline { array: mem::uninitialized() }); + ptr::copy_nonoverlapping(ptr, self.as_mut_ptr(), len); + deallocate(ptr, capacity); + } + } else if self.capacity() > len { + self.grow(len); + } + } + + /// Shorten the vector, keeping the first `len` elements and dropping the rest. + /// + /// If `len` is greater than or equal to the vector's current length, this has no + /// effect. + /// + /// This does not re-allocate. If you want the vector's capacity to shrink, call + /// `shrink_to_fit` after truncating. + pub fn truncate(&mut self, len: usize) { + let end_ptr = self.as_ptr(); + while len < self.len { + unsafe { + let last_index = self.len - 1; + self.set_len(last_index); + ptr::read(end_ptr.offset(last_index as isize)); + } + } + } + + /// Remove the element at position `index`, replacing it with the last element. + /// + /// This does not preserve ordering, but is O(1). + /// + /// Panics if `index` is out of bounds. + #[inline] + pub fn swap_remove(&mut self, index: usize) -> A::Item { + let len = self.len; + self.swap(len - 1, index); + self.pop().unwrap() + } + + /// Remove all elements from the vector. + #[inline] + pub fn clear(&mut self) { + self.truncate(0); + } + + /// Remove and return the element at position `index`, shifting all elements after it to the + /// left. + /// + /// Panics if `index` is out of bounds. + pub fn remove(&mut self, index: usize) -> A::Item { + let len = self.len(); + + assert!(index < len); + + unsafe { + let ptr = self.as_mut_ptr().offset(index as isize); + let item = ptr::read(ptr); + ptr::copy(ptr.offset(1), ptr, len - index - 1); + self.set_len(len - 1); + item + } + } + + /// Insert an element at position `index`, shifting all elements after it to the right. + /// + /// Panics if `index` is out of bounds. + pub fn insert(&mut self, index: usize, element: A::Item) { + self.reserve(1); + + let len = self.len; + assert!(index <= len); + + unsafe { + let ptr = self.as_mut_ptr().offset(index as isize); + ptr::copy(ptr, ptr.offset(1), len - index); + ptr::write(ptr, element); + self.set_len(len + 1); + } + } + + pub fn insert_many>(&mut self, index: usize, iterable: I) { + let iter = iterable.into_iter(); + let (lower_size_bound, _) = iter.size_hint(); + assert!(lower_size_bound <= std::isize::MAX as usize); // Ensure offset is indexable + assert!(index + lower_size_bound >= index); // Protect against overflow + self.reserve(lower_size_bound); + + unsafe { + let old_len = self.len; + assert!(index <= old_len); + let ptr = self.as_mut_ptr().offset(index as isize); + ptr::copy(ptr, ptr.offset(lower_size_bound as isize), old_len - index); + for (off, element) in iter.enumerate() { + if off < lower_size_bound { + ptr::write(ptr.offset(off as isize), element); + self.len = self.len + 1; + } else { + // Iterator provided more elements than the hint. + assert!(index + off >= index); // Protect against overflow. + self.insert(index + off, element); + } + } + let num_added = self.len - old_len; + if num_added < lower_size_bound { + // Iterator provided fewer elements than the hint + ptr::copy(ptr.offset(lower_size_bound as isize), ptr.offset(num_added as isize), old_len - index); + } + } + } + + /// Convert a SmallVec to a Vec, without reallocating if the SmallVec has already spilled onto + /// the heap. + pub fn into_vec(self) -> Vec { + match self.data { + Inline { .. } => self.into_iter().collect(), + Heap { ptr, capacity } => unsafe { + let v = Vec::from_raw_parts(ptr, self.len, capacity); + mem::forget(self); + v + } + } + } +} + +impl SmallVec where A::Item: Copy { + pub fn from_slice(slice: &[A::Item]) -> Self { + let mut vec = Self::new(); + vec.extend_from_slice(slice); + vec + } + + pub fn insert_from_slice(&mut self, index: usize, slice: &[A::Item]) { + self.reserve(slice.len()); + + let len = self.len; + assert!(index <= len); + + unsafe { + let slice_ptr = slice.as_ptr(); + let ptr = self.as_mut_ptr().offset(index as isize); + ptr::copy(ptr, ptr.offset(slice.len() as isize), len - index); + ptr::copy(slice_ptr, ptr, slice.len()); + self.set_len(len + slice.len()); + } + } + + #[inline] + pub fn extend_from_slice(&mut self, slice: &[A::Item]) { + let len = self.len(); + self.insert_from_slice(len, slice); + } +} + +#[cfg(feature="heapsizeof")] +impl HeapSizeOf for SmallVec where A::Item: HeapSizeOf { + fn heap_size_of_children(&self) -> usize { + match self.data { + Inline { .. } => 0, + Heap { ptr, .. } => { + self.iter().fold( + unsafe { heap_size_of(ptr as *const c_void) }, + |n, elem| n + elem.heap_size_of_children()) + }, + } + } +} + +impl ops::Deref for SmallVec { + type Target = [A::Item]; + #[inline] + fn deref(&self) -> &[A::Item] { + let ptr: *const _ = match self.data { + Inline { ref array } => array.ptr(), + Heap { ptr, .. } => ptr, + }; + unsafe { + slice::from_raw_parts(ptr, self.len) + } + } +} + +impl ops::DerefMut for SmallVec { + #[inline] + fn deref_mut(&mut self) -> &mut [A::Item] { + let ptr = self.data.ptr_mut(); + unsafe { + slice::from_raw_parts_mut(ptr, self.len) + } + } +} + +impl AsRef<[A::Item]> for SmallVec { + #[inline] + fn as_ref(&self) -> &[A::Item] { + self + } +} + +impl AsMut<[A::Item]> for SmallVec { + #[inline] + fn as_mut(&mut self) -> &mut [A::Item] { + self + } +} + +impl Borrow<[A::Item]> for SmallVec { + #[inline] + fn borrow(&self) -> &[A::Item] { + self + } +} + +impl BorrowMut<[A::Item]> for SmallVec { + #[inline] + fn borrow_mut(&mut self) -> &mut [A::Item] { + self + } +} + +impl<'a, A: Array> From<&'a [A::Item]> for SmallVec where A::Item: Clone { + #[inline] + fn from(slice: &'a [A::Item]) -> SmallVec { + slice.into_iter().cloned().collect() + } +} + +macro_rules! impl_index { + ($index_type: ty, $output_type: ty) => { + impl ops::Index<$index_type> for SmallVec { + type Output = $output_type; + #[inline] + fn index(&self, index: $index_type) -> &$output_type { + &(&**self)[index] + } + } + + impl ops::IndexMut<$index_type> for SmallVec { + #[inline] + fn index_mut(&mut self, index: $index_type) -> &mut $output_type { + &mut (&mut **self)[index] + } + } + } +} + +impl_index!(usize, A::Item); +impl_index!(ops::Range, [A::Item]); +impl_index!(ops::RangeFrom, [A::Item]); +impl_index!(ops::RangeTo, [A::Item]); +impl_index!(ops::RangeFull, [A::Item]); + + +impl VecLike for SmallVec { + #[inline] + fn push(&mut self, value: A::Item) { + SmallVec::push(self, value); + } +} + +impl FromIterator for SmallVec { + fn from_iter>(iterable: I) -> SmallVec { + let mut v = SmallVec::new(); + v.extend(iterable); + v + } +} + +impl Extend for SmallVec { + fn extend>(&mut self, iterable: I) { + let iter = iterable.into_iter(); + let (lower_size_bound, _) = iter.size_hint(); + + let target_len = self.len + lower_size_bound; + + if target_len > self.capacity() { + self.grow(target_len); + } + + for elem in iter { + self.push(elem); + } + } +} + +impl fmt::Debug for SmallVec where A::Item: fmt::Debug { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", &**self) + } +} + +impl Default for SmallVec { + #[inline] + fn default() -> SmallVec { + SmallVec::new() + } +} + +impl Drop for SmallVec { + fn drop(&mut self) { + // Note on panic safety: dropping an element may panic, + // but the inner SmallVecData destructor will still run + unsafe { + let ptr = self.as_ptr(); + for i in 0 .. self.len { + ptr::read(ptr.offset(i as isize)); + } + } + } +} + +impl Clone for SmallVec where A::Item: Clone { + fn clone(&self) -> SmallVec { + let mut new_vector = SmallVec::new(); + for element in self.iter() { + new_vector.push((*element).clone()) + } + new_vector + } +} + +impl PartialEq> for SmallVec + where A::Item: PartialEq { + #[inline] + fn eq(&self, other: &SmallVec) -> bool { self[..] == other[..] } + #[inline] + fn ne(&self, other: &SmallVec) -> bool { self[..] != other[..] } +} + +impl Eq for SmallVec where A::Item: Eq {} + +impl PartialOrd for SmallVec where A::Item: PartialOrd { + #[inline] + fn partial_cmp(&self, other: &SmallVec) -> Option { + PartialOrd::partial_cmp(&**self, &**other) + } +} + +impl Ord for SmallVec where A::Item: Ord { + #[inline] + fn cmp(&self, other: &SmallVec) -> cmp::Ordering { + Ord::cmp(&**self, &**other) + } +} + +impl Hash for SmallVec where A::Item: Hash { + fn hash(&self, state: &mut H) { + (**self).hash(state) + } +} + +unsafe impl Send for SmallVec where A::Item: Send {} + +pub struct IntoIter { + data: SmallVecData, + current: usize, + end: usize, +} + +impl Drop for IntoIter { + fn drop(&mut self) { + for _ in self { } + } +} + +impl Iterator for IntoIter { + type Item = A::Item; + + #[inline] + fn next(&mut self) -> Option { + if self.current == self.end { + None + } + else { + unsafe { + let current = self.current as isize; + self.current += 1; + Some(ptr::read(self.data.ptr_mut().offset(current))) + } + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let size = self.end - self.current; + (size, Some(size)) + } +} + +impl DoubleEndedIterator for IntoIter { + #[inline] + fn next_back(&mut self) -> Option { + if self.current == self.end { + None + } + else { + unsafe { + self.end -= 1; + Some(ptr::read(self.data.ptr_mut().offset(self.end as isize))) + } + } + } +} + +impl ExactSizeIterator for IntoIter { } + +impl IntoIterator for SmallVec { + type IntoIter = IntoIter; + type Item = A::Item; + fn into_iter(mut self) -> Self::IntoIter { + let len = self.len(); + unsafe { + // Only grab the `data` field, the `IntoIter` type handles dropping of the elements + let data = ptr::read(&mut self.data); + mem::forget(self); + IntoIter { + data: data, + current: 0, + end: len, + } + } + } +} + +impl<'a, A: Array> IntoIterator for &'a SmallVec { + type IntoIter = slice::Iter<'a, A::Item>; + type Item = &'a A::Item; + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + +impl<'a, A: Array> IntoIterator for &'a mut SmallVec { + type IntoIter = slice::IterMut<'a, A::Item>; + type Item = &'a mut A::Item; + fn into_iter(self) -> Self::IntoIter { + self.iter_mut() + } +} + +// TODO: Remove these and its users. + +/// Deprecated alias to ease transition from an earlier version. +#[deprecated] +pub type SmallVec1 = SmallVec<[T; 1]>; + +/// Deprecated alias to ease transition from an earlier version. +#[deprecated] +pub type SmallVec2 = SmallVec<[T; 2]>; + +/// Deprecated alias to ease transition from an earlier version. +#[deprecated] +pub type SmallVec4 = SmallVec<[T; 4]>; + +/// Deprecated alias to ease transition from an earlier version. +#[deprecated] +pub type SmallVec8 = SmallVec<[T; 8]>; + +/// Deprecated alias to ease transition from an earlier version. +#[deprecated] +pub type SmallVec16 = SmallVec<[T; 16]>; + +/// Deprecated alias to ease transition from an earlier version. +#[deprecated] +pub type SmallVec24 = SmallVec<[T; 24]>; + +/// Deprecated alias to ease transition from an earlier version. +#[deprecated] +pub type SmallVec32 = SmallVec<[T; 32]>; + +/// Types that can be used as the backing store for a SmallVec +pub unsafe trait Array { + type Item; + fn size() -> usize; + fn ptr(&self) -> *const Self::Item; + fn ptr_mut(&mut self) -> *mut Self::Item; +} + +macro_rules! impl_array( + ($($size:expr),+) => { + $( + unsafe impl Array for [T; $size] { + type Item = T; + fn size() -> usize { $size } + fn ptr(&self) -> *const T { &self[0] } + fn ptr_mut(&mut self) -> *mut T { &mut self[0] } + } + )+ + } +); + +impl_array!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 32, 36, + 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000); + +#[cfg(test)] +pub mod tests { + use SmallVec; + use std::borrow::ToOwned; + use std::iter::FromIterator; + + #[cfg(feature="heapsizeof")] + use heapsize::HeapSizeOf; + #[cfg(feature="heapsizeof")] + use std::mem::size_of; + + // We heap allocate all these strings so that double frees will show up under valgrind. + + #[test] + pub fn test_inline() { + let mut v = SmallVec::<[_; 16]>::new(); + v.push("hello".to_owned()); + v.push("there".to_owned()); + assert_eq!(&*v, &[ + "hello".to_owned(), + "there".to_owned(), + ][..]); + } + + #[test] + pub fn test_spill() { + let mut v = SmallVec::<[_; 2]>::new(); + v.push("hello".to_owned()); + assert_eq!(v[0], "hello"); + v.push("there".to_owned()); + v.push("burma".to_owned()); + assert_eq!(v[0], "hello"); + v.push("shave".to_owned()); + assert_eq!(&*v, &[ + "hello".to_owned(), + "there".to_owned(), + "burma".to_owned(), + "shave".to_owned(), + ][..]); + } + + #[test] + pub fn test_double_spill() { + let mut v = SmallVec::<[_; 2]>::new(); + v.push("hello".to_owned()); + v.push("there".to_owned()); + v.push("burma".to_owned()); + v.push("shave".to_owned()); + v.push("hello".to_owned()); + v.push("there".to_owned()); + v.push("burma".to_owned()); + v.push("shave".to_owned()); + assert_eq!(&*v, &[ + "hello".to_owned(), + "there".to_owned(), + "burma".to_owned(), + "shave".to_owned(), + "hello".to_owned(), + "there".to_owned(), + "burma".to_owned(), + "shave".to_owned(), + ][..]); + } + + /// https://github.com/servo/rust-smallvec/issues/4 + #[test] + fn issue_4() { + SmallVec::<[Box; 2]>::new(); + } + + /// https://github.com/servo/rust-smallvec/issues/5 + #[test] + fn issue_5() { + assert!(Some(SmallVec::<[&u32; 2]>::new()).is_some()); + } + + #[test] + fn drain() { + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(3); + assert_eq!(v.drain().collect::>(), &[3]); + + // spilling the vec + v.push(3); + v.push(4); + v.push(5); + assert_eq!(v.drain().collect::>(), &[3, 4, 5]); + } + + #[test] + fn drain_rev() { + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(3); + assert_eq!(v.drain().rev().collect::>(), &[3]); + + // spilling the vec + v.push(3); + v.push(4); + v.push(5); + assert_eq!(v.drain().rev().collect::>(), &[5, 4, 3]); + } + + #[test] + fn into_iter() { + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(3); + assert_eq!(v.into_iter().collect::>(), &[3]); + + // spilling the vec + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(3); + v.push(4); + v.push(5); + assert_eq!(v.into_iter().collect::>(), &[3, 4, 5]); + } + + #[test] + fn into_iter_rev() { + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(3); + assert_eq!(v.into_iter().rev().collect::>(), &[3]); + + // spilling the vec + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(3); + v.push(4); + v.push(5); + assert_eq!(v.into_iter().rev().collect::>(), &[5, 4, 3]); + } + + #[test] + fn into_iter_drop() { + use std::cell::Cell; + + struct DropCounter<'a>(&'a Cell); + + impl<'a> Drop for DropCounter<'a> { + fn drop(&mut self) { + self.0.set(self.0.get() + 1); + } + } + + { + let cell = Cell::new(0); + let mut v: SmallVec<[DropCounter; 2]> = SmallVec::new(); + v.push(DropCounter(&cell)); + v.into_iter(); + assert_eq!(cell.get(), 1); + } + + { + let cell = Cell::new(0); + let mut v: SmallVec<[DropCounter; 2]> = SmallVec::new(); + v.push(DropCounter(&cell)); + v.push(DropCounter(&cell)); + assert!(v.into_iter().next().is_some()); + assert_eq!(cell.get(), 2); + } + + { + let cell = Cell::new(0); + let mut v: SmallVec<[DropCounter; 2]> = SmallVec::new(); + v.push(DropCounter(&cell)); + v.push(DropCounter(&cell)); + v.push(DropCounter(&cell)); + assert!(v.into_iter().next().is_some()); + assert_eq!(cell.get(), 3); + } + { + let cell = Cell::new(0); + let mut v: SmallVec<[DropCounter; 2]> = SmallVec::new(); + v.push(DropCounter(&cell)); + v.push(DropCounter(&cell)); + v.push(DropCounter(&cell)); + { + let mut it = v.into_iter(); + assert!(it.next().is_some()); + assert!(it.next_back().is_some()); + } + assert_eq!(cell.get(), 3); + } + } + + #[test] + fn test_capacity() { + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.reserve(1); + assert_eq!(v.capacity(), 2); + assert!(!v.spilled()); + + v.reserve_exact(0x100); + assert!(v.capacity() >= 0x100); + + v.push(0); + v.push(1); + v.push(2); + v.push(3); + + v.shrink_to_fit(); + assert!(v.capacity() < 0x100); + } + + #[test] + fn test_truncate() { + let mut v: SmallVec<[Box; 8]> = SmallVec::new(); + + for x in 0..8 { + v.push(Box::new(x)); + } + v.truncate(4); + + assert_eq!(v.len(), 4); + assert!(!v.spilled()); + + assert_eq!(*v.swap_remove(1), 1); + assert_eq!(*v.remove(1), 3); + v.insert(1, Box::new(3)); + + assert_eq!(&v.iter().map(|v| **v).collect::>(), &[0, 3, 2]); + } + + #[test] + fn test_insert_many() { + let mut v: SmallVec<[u8; 8]> = SmallVec::new(); + for x in 0..4 { + v.push(x); + } + assert_eq!(v.len(), 4); + v.insert_many(1, [5, 6].iter().cloned()); + assert_eq!(&v.iter().map(|v| *v).collect::>(), &[0, 5, 6, 1, 2, 3]); + } + + struct MockHintIter{x: T, hint: usize} + impl Iterator for MockHintIter { + type Item = T::Item; + fn next(&mut self) -> Option {self.x.next()} + fn size_hint(&self) -> (usize, Option) {(self.hint, None)} + } + + #[test] + fn test_insert_many_short_hint() { + let mut v: SmallVec<[u8; 8]> = SmallVec::new(); + for x in 0..4 { + v.push(x); + } + assert_eq!(v.len(), 4); + v.insert_many(1, MockHintIter{x: [5, 6].iter().cloned(), hint: 5}); + assert_eq!(&v.iter().map(|v| *v).collect::>(), &[0, 5, 6, 1, 2, 3]); + } + + #[test] + fn test_insert_many_long_hint() { + let mut v: SmallVec<[u8; 8]> = SmallVec::new(); + for x in 0..4 { + v.push(x); + } + assert_eq!(v.len(), 4); + v.insert_many(1, MockHintIter{x: [5, 6].iter().cloned(), hint: 1}); + assert_eq!(&v.iter().map(|v| *v).collect::>(), &[0, 5, 6, 1, 2, 3]); + } + + #[test] + #[should_panic] + fn test_invalid_grow() { + let mut v: SmallVec<[u8; 8]> = SmallVec::new(); + v.extend(0..8); + v.grow(5); + } + + #[test] + fn test_insert_from_slice() { + let mut v: SmallVec<[u8; 8]> = SmallVec::new(); + for x in 0..4 { + v.push(x); + } + assert_eq!(v.len(), 4); + v.insert_from_slice(1, &[5, 6]); + assert_eq!(&v.iter().map(|v| *v).collect::>(), &[0, 5, 6, 1, 2, 3]); + } + + #[test] + fn test_extend_from_slice() { + let mut v: SmallVec<[u8; 8]> = SmallVec::new(); + for x in 0..4 { + v.push(x); + } + assert_eq!(v.len(), 4); + v.extend_from_slice(&[5, 6]); + assert_eq!(&v.iter().map(|v| *v).collect::>(), &[0, 1, 2, 3, 5, 6]); + } + + #[test] + #[should_panic] + fn test_drop_panic_smallvec() { + // This test should only panic once, and not double panic, + // which would mean a double drop + struct DropPanic; + + impl Drop for DropPanic { + fn drop(&mut self) { + panic!("drop"); + } + } + + let mut v = SmallVec::<[_; 1]>::new(); + v.push(DropPanic); + } + + #[test] + fn test_eq() { + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + let mut b: SmallVec<[u32; 2]> = SmallVec::new(); + let mut c: SmallVec<[u32; 2]> = SmallVec::new(); + // a = [1, 2] + a.push(1); + a.push(2); + // b = [1, 2] + b.push(1); + b.push(2); + // c = [3, 4] + c.push(3); + c.push(4); + + assert!(a == b); + assert!(a != c); + } + + #[test] + fn test_ord() { + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + let mut b: SmallVec<[u32; 2]> = SmallVec::new(); + let mut c: SmallVec<[u32; 2]> = SmallVec::new(); + // a = [1] + a.push(1); + // b = [1, 1] + b.push(1); + b.push(1); + // c = [1, 2] + c.push(1); + c.push(2); + + assert!(a < b); + assert!(b > a); + assert!(b < c); + assert!(c > b); + } + + #[test] + fn test_hash() { + use std::hash::Hash; + use std::collections::hash_map::DefaultHasher; + + { + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + let b = [1, 2]; + a.extend(b.iter().cloned()); + let mut hasher = DefaultHasher::new(); + assert_eq!(a.hash(&mut hasher), b.hash(&mut hasher)); + } + { + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + let b = [1, 2, 11, 12]; + a.extend(b.iter().cloned()); + let mut hasher = DefaultHasher::new(); + assert_eq!(a.hash(&mut hasher), b.hash(&mut hasher)); + } + } + + #[test] + fn test_as_ref() { + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + a.push(1); + assert_eq!(a.as_ref(), [1]); + a.push(2); + assert_eq!(a.as_ref(), [1, 2]); + a.push(3); + assert_eq!(a.as_ref(), [1, 2, 3]); + } + + #[test] + fn test_as_mut() { + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + a.push(1); + assert_eq!(a.as_mut(), [1]); + a.push(2); + assert_eq!(a.as_mut(), [1, 2]); + a.push(3); + assert_eq!(a.as_mut(), [1, 2, 3]); + a.as_mut()[1] = 4; + assert_eq!(a.as_mut(), [1, 4, 3]); + } + + #[test] + fn test_borrow() { + use std::borrow::Borrow; + + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + a.push(1); + assert_eq!(a.borrow(), [1]); + a.push(2); + assert_eq!(a.borrow(), [1, 2]); + a.push(3); + assert_eq!(a.borrow(), [1, 2, 3]); + } + + #[test] + fn test_borrow_mut() { + use std::borrow::BorrowMut; + + let mut a: SmallVec<[u32; 2]> = SmallVec::new(); + a.push(1); + assert_eq!(a.borrow_mut(), [1]); + a.push(2); + assert_eq!(a.borrow_mut(), [1, 2]); + a.push(3); + assert_eq!(a.borrow_mut(), [1, 2, 3]); + BorrowMut::<[u32]>::borrow_mut(&mut a)[1] = 4; + assert_eq!(a.borrow_mut(), [1, 4, 3]); + } + + #[test] + fn test_from() { + assert_eq!(&SmallVec::<[u32; 2]>::from(&[1][..])[..], [1]); + assert_eq!(&SmallVec::<[u32; 2]>::from(&[1, 2, 3][..])[..], [1, 2, 3]); + } + + #[test] + fn test_from_slice() { + assert_eq!(&SmallVec::<[u32; 2]>::from_slice(&[1][..])[..], [1]); + assert_eq!(&SmallVec::<[u32; 2]>::from_slice(&[1, 2, 3][..])[..], [1, 2, 3]); + } + + #[cfg(feature="heapsizeof")] + #[test] + fn test_heap_size_of_children() { + let mut vec = SmallVec::<[u32; 2]>::new(); + assert_eq!(vec.heap_size_of_children(), 0); + vec.push(1); + vec.push(2); + assert_eq!(vec.heap_size_of_children(), 0); + vec.push(3); + assert_eq!(vec.heap_size_of_children(), 16); + + // Now check with reserved space + let mut vec = SmallVec::<[u32; 2]>::new(); + vec.reserve(10); // Rounds up to 16 + assert_eq!(vec.heap_size_of_children(), 64); + + // Check with nested heap structures + let mut vec = SmallVec::<[Vec; 2]>::new(); + vec.reserve(10); + vec.push(vec![2, 3, 4]); + assert_eq!(vec.heap_size_of_children(), + vec![2, 3, 4].heap_size_of_children() + 16 * size_of::>()); + } + + #[test] + fn test_exact_size_iterator() { + let mut vec = SmallVec::<[u32; 2]>::from(&[1, 2, 3][..]); + assert_eq!(vec.clone().into_iter().len(), 3); + assert_eq!(vec.drain().len(), 3); + } + + #[test] + fn veclike_deref_slice() { + use super::VecLike; + + fn test>(vec: &mut T) { + assert!(!vec.is_empty()); + assert_eq!(vec.len(), 3); + + vec.sort(); + assert_eq!(&vec[..], [1, 2, 3]); + } + + let mut vec = SmallVec::<[i32; 2]>::from(&[3, 1, 2][..]); + test(&mut vec); + } + + #[test] + fn shrink_to_fit_unspill() { + let mut vec = SmallVec::<[u8; 2]>::from_iter(0..3); + vec.pop(); + assert!(vec.spilled()); + vec.shrink_to_fit(); + assert!(!vec.spilled(), "shrink_to_fit will un-spill if possible"); + } + + #[test] + fn test_into_vec() { + let vec = SmallVec::<[u8; 2]>::from_iter(0..2); + assert_eq!(vec.into_vec(), vec![0, 1]); + + let vec = SmallVec::<[u8; 2]>::from_iter(0..3); + assert_eq!(vec.into_vec(), vec![0, 1, 2]); + } + + #[test] + fn test_from_vec() { + let vec = vec![]; + let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); + assert_eq!(&*small_vec, &[]); + drop(small_vec); + + let vec = vec![]; + let small_vec: SmallVec<[u8; 1]> = SmallVec::from_vec(vec); + assert_eq!(&*small_vec, &[]); + drop(small_vec); + + let vec = vec![1]; + let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); + assert_eq!(&*small_vec, &[1]); + drop(small_vec); + + let vec = vec![1, 2, 3]; + let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); + assert_eq!(&*small_vec, &[1, 2, 3]); + drop(small_vec); + + let vec = vec![1, 2, 3, 4, 5]; + let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); + assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); + drop(small_vec); + + let vec = vec![1, 2, 3, 4, 5]; + let small_vec: SmallVec<[u8; 1]> = SmallVec::from_vec(vec); + assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); + drop(small_vec); + } +} diff --git a/src/vendor/smallvec/.cargo-checksum.json b/src/vendor/smallvec/.cargo-checksum.json index 66ad40a667..ac9206b226 100644 --- a/src/vendor/smallvec/.cargo-checksum.json +++ b/src/vendor/smallvec/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"8d8372a5e10c6d301d70d45da3d51a4b8cbd6d51b57a62e7730942adc69da200","Cargo.toml":"48402d1ef9c6e0015e98104e1b9ec5c406a2e5ca5d8f8b0382a1ed4decdf96f8","README.md":"85c6105e404b1febba9e06773350cc81fe5966369530210669b3465c66237a09","benches/bench.rs":"54cf4879d36ba2a9f3423af91bb93227b70849200e5bf74e384a166d6aa09893","lib.rs":"acdf2c4778adb0b613efb08ff4612d8d7fb2d67747da026ab3894539e7f3e3ed"},"package":"4f8266519bc1d17d0b5b16f6c21295625d562841c708f6376f49028a43e9c11e"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"91edce5ea2a1956399db4b17f580c8b7995af3aa9801c4314865f560c55d6d09","Cargo.toml":"1bbfc40ffd7370696242dd27dd4f0e211d3309aebca8b564029a6ac167e81726","Cargo.toml.orig":"416b608b16d97f86307906e28f8cdd15943620fb14b76063a269a6f5379c2b87","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"1bc64a621160a291c86b8770f3eeaa45a31c31d91c2a071f39981c14fdacb035","benches/bench.rs":"54cf4879d36ba2a9f3423af91bb93227b70849200e5bf74e384a166d6aa09893","lib.rs":"bd237262110649b266c6599d4f8b3d1f7d7c758d6852b65243c8221811d273e8"},"package":"44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"} \ No newline at end of file diff --git a/src/vendor/smallvec/.travis.yml b/src/vendor/smallvec/.travis.yml index 8a946c32de..7123702a79 100644 --- a/src/vendor/smallvec/.travis.yml +++ b/src/vendor/smallvec/.travis.yml @@ -5,9 +5,10 @@ rust: - stable script: | cargo build --verbose && - cargo build --features=heapsizeof --verbose && + cargo build --all-features --verbose && cargo test --verbose && - cargo test --features=heapsizeof --verbose && + cargo test --all-features --verbose && + ([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --no-default-features) && ([ $TRAVIS_RUST_VERSION != nightly ] || cargo bench --verbose bench) notifications: webhooks: http://build.servo.org:54856/travis diff --git a/src/vendor/smallvec/Cargo.toml b/src/vendor/smallvec/Cargo.toml index 2a64c0419a..02191cb84b 100644 --- a/src/vendor/smallvec/Cargo.toml +++ b/src/vendor/smallvec/Cargo.toml @@ -1,20 +1,36 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] name = "smallvec" -version = "0.3.3" +version = "0.6.0" authors = ["Simon Sapin "] +description = "'Small vector' optimization: store up to a small number of items on the stack" +documentation = "http://doc.servo.org/smallvec/" +readme = "README.md" +keywords = ["small", "vec", "vector", "stack", "no_std"] +categories = ["data-structures"] license = "MPL-2.0" repository = "https://github.com/servo/rust-smallvec" -description = "'Small vector' optimization: store up to a small number of items on the stack" -keywords = ["small", "vec", "vector", "stack"] -readme = "README.md" -documentation = "http://doc.servo.org/smallvec/" - -[features] -heapsizeof = ["heapsize"] [lib] name = "smallvec" path = "lib.rs" +[dependencies.serde] +version = "1" +optional = true +[dev-dependencies.bincode] +version = "0.8" -[dependencies] -heapsize = { version = "0.3", optional = true } +[features] +default = ["std"] +std = [] diff --git a/src/vendor/smallvec/Cargo.toml.orig b/src/vendor/smallvec/Cargo.toml.orig new file mode 100644 index 0000000000..6804204c81 --- /dev/null +++ b/src/vendor/smallvec/Cargo.toml.orig @@ -0,0 +1,25 @@ +[package] +name = "smallvec" +version = "0.6.0" +authors = ["Simon Sapin "] +license = "MPL-2.0" +repository = "https://github.com/servo/rust-smallvec" +description = "'Small vector' optimization: store up to a small number of items on the stack" +keywords = ["small", "vec", "vector", "stack", "no_std"] +categories = ["data-structures"] +readme = "README.md" +documentation = "http://doc.servo.org/smallvec/" + +[features] +std = [] +default = ["std"] + +[lib] +name = "smallvec" +path = "lib.rs" + +[dependencies] +serde = { version = "1", optional = true } + +[dev_dependencies] +bincode = "0.8" diff --git a/src/vendor/smallvec/LICENSE b/src/vendor/smallvec/LICENSE new file mode 100644 index 0000000000..398385c9fb --- /dev/null +++ b/src/vendor/smallvec/LICENSE @@ -0,0 +1,374 @@ + Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" +means each individual or legal entity that creates, contributes to +the creation of, or owns Covered Software. + +1.2. "Contributor Version" +means the combination of the Contributions of others (if any) used +by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" +means Covered Software of a particular Contributor. + +1.4. "Covered Software" +means Source Code Form to which the initial Contributor has attached +the notice in Exhibit A, the Executable Form of such Source Code +Form, and Modifications of such Source Code Form, in each case +including portions thereof. + +1.5. "Incompatible With Secondary Licenses" +means + +(a) that the initial Contributor has attached the notice described +in Exhibit B to the Covered Software; or + +(b) that the Covered Software was made available under the terms of +version 1.1 or earlier of the License, but not also under the +terms of a Secondary License. + +1.6. "Executable Form" +means any form of the work other than Source Code Form. + +1.7. "Larger Work" +means a work that combines Covered Software with other material, in +a separate file or files, that is not Covered Software. + +1.8. "License" +means this document. + +1.9. "Licensable" +means having the right to grant, to the maximum extent possible, +whether at the time of the initial grant or subsequently, any and +all of the rights conveyed by this License. + +1.10. "Modifications" +means any of the following: + +(a) any file in Source Code Form that results from an addition to, +deletion from, or modification of the contents of Covered +Software; or + +(b) any new file in Source Code Form that contains any Covered +Software. + +1.11. "Patent Claims" of a Contributor +means any patent claim(s), including without limitation, method, +process, and apparatus claims, in any patent Licensable by such +Contributor that would be infringed, but for the grant of the +License, by the making, using, selling, offering for sale, having +made, import, or transfer of either its Contributions or its +Contributor Version. + +1.12. "Secondary License" +means either the GNU General Public License, Version 2.0, the GNU +Lesser General Public License, Version 2.1, the GNU Affero General +Public License, Version 3.0, or any later versions of those +licenses. + +1.13. "Source Code Form" +means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") +means an individual or a legal entity exercising rights under this +License. For legal entities, "You" includes any entity that +controls, is controlled by, or is under common control with You. For +purposes of this definition, "control" means (a) the power, direct +or indirect, to cause the direction or management of such entity, +whether by contract or otherwise, or (b) ownership of more than +fifty percent (50%) of the outstanding shares or beneficial +ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) +Licensable by such Contributor to use, reproduce, make available, +modify, display, perform, distribute, and otherwise exploit its +Contributions, either on an unmodified basis, with Modifications, or +as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer +for sale, have made, import, and otherwise transfer either its +Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; +or + +(b) for infringements caused by: (i) Your and any other third party's +modifications of Covered Software, or (ii) the combination of its +Contributions with other software (except as part of its Contributor +Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of +its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code +Form, as described in Section 3.1, and You must inform recipients of +the Executable Form how they can obtain a copy of such Source Code +Form by reasonable means in a timely manner, at a charge no more +than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this +License, or sublicense it under different terms, provided that the +license for the Executable Form does not attempt to limit or alter +the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + +This Source Code Form is "Incompatible With Secondary Licenses", as +defined by the Mozilla Public License, v. 2.0. + diff --git a/src/vendor/smallvec/README.md b/src/vendor/smallvec/README.md index a7211e09ff..ebd5a13ded 100644 --- a/src/vendor/smallvec/README.md +++ b/src/vendor/smallvec/README.md @@ -1,6 +1,8 @@ rust-smallvec ============= -[Documentation](http://doc.servo.org/smallvec/) +[Documentation](http://docs.rs/smallvec/) + +[Release notes](https://github.com/servo/rust-smallvec/releases) "Small vector" optimization for Rust: store up to a small number of items on the stack diff --git a/src/vendor/smallvec/lib.rs b/src/vendor/smallvec/lib.rs index f03108a759..09cceab0ec 100644 --- a/src/vendor/smallvec/lib.rs +++ b/src/vendor/smallvec/lib.rs @@ -5,9 +5,35 @@ //! Small vectors in various sizes. These store a certain number of elements inline, and fall back //! to the heap for larger allocations. This can be a useful optimization for improving cache //! locality and reducing allocator traffic for workloads that fit within the inline buffer. +//! +//! ## no_std support +//! +//! By default, `smallvec` depends on `libstd`. However, it can be configured to use the unstable +//! `liballoc` API instead, for use on platforms that have `liballoc` but not `libstd`. This +//! configuration is currently unstable and is not guaranteed to work on all versions of Rust. +//! +//! To depend on `smallvec` without `libstd`, use `default-features = false` in the `smallvec` +//! section of Cargo.toml to disable its `"std"` feature. -#[cfg(feature="heapsizeof")] -extern crate heapsize; +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), feature(alloc))] +#![deny(missing_docs)] + + +#[cfg(not(feature = "std"))] +#[cfg_attr(test, macro_use)] +extern crate alloc; + +#[cfg(not(feature = "std"))] +use alloc::Vec; + +#[cfg(feature = "serde")] +extern crate serde; + +#[cfg(not(feature = "std"))] +mod std { + pub use core::*; +} use std::borrow::{Borrow, BorrowMut}; use std::cmp; @@ -18,11 +44,15 @@ use std::mem; use std::ops; use std::ptr; use std::slice; -#[cfg(feature="heapsizeof")] -use std::os::raw::c_void; +#[cfg(feature = "std")] +use std::io; +#[cfg(feature = "serde")] +use serde::ser::{Serialize, Serializer, SerializeSeq}; +#[cfg(feature = "serde")] +use serde::de::{Deserialize, Deserializer, SeqAccess, Visitor}; +#[cfg(feature = "serde")] +use std::marker::PhantomData; -#[cfg(feature="heapsizeof")] -use heapsize::{HeapSizeOf, heap_size_of}; use SmallVecData::{Inline, Heap}; /// Common operations implemented by both `Vec` and `SmallVec`. @@ -32,7 +62,7 @@ use SmallVecData::{Inline, Heap}; /// ## Example /// /// ```rust -/// use smallvec::{VecLike, SmallVec8}; +/// use smallvec::{VecLike, SmallVec}; /// /// fn initialize>(v: &mut V) { /// for i in 0..5 { @@ -43,9 +73,10 @@ use SmallVecData::{Inline, Heap}; /// let mut vec = Vec::new(); /// initialize(&mut vec); /// -/// let mut small_vec = SmallVec8::new(); +/// let mut small_vec = SmallVec::<[u8; 8]>::new(); /// initialize(&mut small_vec); /// ``` +#[deprecated(note = "Use `Extend` and `Deref<[T]>` instead")] pub trait VecLike: ops::Index + ops::IndexMut + @@ -64,6 +95,7 @@ pub trait VecLike: fn push(&mut self, value: T); } +#[allow(deprecated)] impl VecLike for Vec { #[inline] fn push(&mut self, value: T) { @@ -71,11 +103,46 @@ impl VecLike for Vec { } } +/// Trait to be implemented by a collection that can be extended from a slice +/// +/// ## Example +/// +/// ```rust +/// use smallvec::{ExtendFromSlice, SmallVec}; +/// +/// fn initialize>(v: &mut V) { +/// v.extend_from_slice(b"Test!"); +/// } +/// +/// let mut vec = Vec::new(); +/// initialize(&mut vec); +/// assert_eq!(&vec, b"Test!"); +/// +/// let mut small_vec = SmallVec::<[u8; 8]>::new(); +/// initialize(&mut small_vec); +/// assert_eq!(&small_vec as &[_], b"Test!"); +/// ``` +pub trait ExtendFromSlice { + /// Extends a collection from a slice of its element type + fn extend_from_slice(&mut self, other: &[T]); +} + +impl ExtendFromSlice for Vec { + fn extend_from_slice(&mut self, other: &[T]) { + Vec::extend_from_slice(self, other) + } +} + unsafe fn deallocate(ptr: *mut T, capacity: usize) { let _vec: Vec = Vec::from_raw_parts(ptr, 0, capacity); // Let it drop. } +/// An iterator that removes the items from a `SmallVec` and yields them by value. +/// +/// Returned from [`SmallVec::drain`][1]. +/// +/// [1]: struct.SmallVec.html#method.drain pub struct Drain<'a, T: 'a> { iter: slice::IterMut<'a,T>, } @@ -168,19 +235,13 @@ impl Drop for SmallVecData { /// store can be any type that implements the `Array` trait; usually it is a small fixed-sized /// array. For example a `SmallVec<[u64; 8]>` can hold up to eight 64-bit integers inline. /// -/// Type aliases like `SmallVec8` are provided as convenient shorthand for types like -/// `SmallVec<[T; 8]>`. -/// /// ## Example /// /// ```rust /// use smallvec::SmallVec; /// let mut v = SmallVec::<[u8; 4]>::new(); // initialize an empty vector /// -/// use smallvec::SmallVec4; -/// let mut v: SmallVec4 = SmallVec::new(); // alternate way to write the above -/// -/// // SmallVec4 can hold up to 4 items without spilling onto the heap. +/// // The vector can hold up to 4 items without spilling onto the heap. /// v.extend(0..4); /// assert_eq!(v.len(), 4); /// assert!(!v.spilled()); @@ -207,6 +268,26 @@ impl SmallVec { } } + /// Construct an empty vector with enough capacity pre-allocated to store at least `n` + /// elements. + /// + /// Will create a heap allocation only if `n` is larger than the inline capacity. + /// + /// ``` + /// # use smallvec::SmallVec; + /// + /// let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(100); + /// + /// assert!(v.is_empty()); + /// assert!(v.capacity() >= 100); + /// ``` + #[inline] + pub fn with_capacity(n: usize) -> Self { + let mut v = SmallVec::new(); + v.reserve_exact(n); + v + } + /// Construct a new `SmallVec` from a `Vec` without copying /// elements. /// @@ -232,6 +313,25 @@ impl SmallVec { } } + /// Constructs a new `SmallVec` on the stack from an `A` without + /// copying elements. + /// + /// ```rust + /// use smallvec::SmallVec; + /// + /// let buf = [1, 2, 3, 4, 5]; + /// let small_vec: SmallVec<_> = SmallVec::from_buf(buf); + /// + /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); + /// ``` + #[inline] + pub fn from_buf(buf: A) -> SmallVec { + SmallVec { + len: A::size(), + data: SmallVecData::Inline { array: buf }, + } + } + /// Sets the length of a vector. /// /// This will explicitly set the size of the vector, without actually @@ -308,14 +408,6 @@ impl SmallVec { } } - /// Append elements from an iterator. - /// - /// This function is deprecated; it has been replaced by `Extend::extend`. - #[deprecated(note = "Use `extend` instead")] - pub fn push_all_move>(&mut self, other: V) { - self.extend(other) - } - /// Remove an item from the end of the vector and return it, or None if empty. #[inline] pub fn pop(&mut self) -> Option { @@ -327,8 +419,8 @@ impl SmallVec { panic!("overflow") } unsafe { - let end_ptr = self.as_mut_ptr().offset(last_index as isize); - let value = ptr::replace(end_ptr, mem::uninitialized()); + let end_ptr = self.as_ptr().offset(last_index as isize); + let value = ptr::read(end_ptr); self.set_len(last_index); Some(value) } @@ -425,6 +517,20 @@ impl SmallVec { } } + /// Extracts a slice containing the entire vector. + /// + /// Equivalent to `&mut s[..]`. + pub fn as_slice(&self) -> &[A::Item] { + self + } + + /// Extracts a mutable slice of the entire vector. + /// + /// Equivalent to `&mut s[..]`. + pub fn as_mut_slice(&mut self) -> &mut [A::Item] { + self + } + /// Remove the element at position `index`, replacing it with the last element. /// /// This does not preserve ordering, but is O(1). @@ -478,6 +584,8 @@ impl SmallVec { } } + /// Insert multiple elements at position `index`, shifting all following elements toward the + /// back. pub fn insert_many>(&mut self, index: usize, iterable: I) { let iter = iterable.into_iter(); let (lower_size_bound, _) = iter.size_hint(); @@ -520,15 +628,84 @@ impl SmallVec { } } } + + /// Retains only the elements specified by the predicate. + /// + /// In other words, remove all elements `e` such that `f(&e)` returns `false`. + /// This method operates in place and preserves the order of the retained + /// elements. + pub fn retain bool>(&mut self, mut f: F) { + let mut del = 0; + let len = self.len; + for i in 0..len { + if !f(&mut self[i]) { + del += 1; + } else if del > 0 { + self.swap(i - del, i); + } + } + self.truncate(len - del); + } + + /// Removes consecutive duplicate elements. + pub fn dedup(&mut self) where A::Item: PartialEq { + self.dedup_by(|a, b| a == b); + } + + /// Removes consecutive duplicate elements using the given equality relation. + pub fn dedup_by(&mut self, mut same_bucket: F) + where F: FnMut(&mut A::Item, &mut A::Item) -> bool + { + // See the implementation of Vec::dedup_by in the + // standard library for an explanation of this algorithm. + let len = self.len; + if len <= 1 { + return; + } + + let ptr = self.as_mut_ptr(); + let mut w: usize = 1; + + unsafe { + for r in 1..len { + let p_r = ptr.offset(r as isize); + let p_wm1 = ptr.offset((w - 1) as isize); + if !same_bucket(&mut *p_r, &mut *p_wm1) { + if r != w { + let p_w = p_wm1.offset(1); + mem::swap(&mut *p_r, &mut *p_w); + } + w += 1; + } + } + } + + self.truncate(w); + } + + /// Removes consecutive elements that map to the same key. + pub fn dedup_by_key(&mut self, mut key: F) + where F: FnMut(&mut A::Item) -> K, + K: PartialEq + { + self.dedup_by(|a, b| key(a) == key(b)); + } } impl SmallVec where A::Item: Copy { + /// Copy the elements from a slice into a new `SmallVec`. + /// + /// For slices of `Copy` types, this is more efficient than `SmallVec::from(slice)`. pub fn from_slice(slice: &[A::Item]) -> Self { let mut vec = Self::new(); vec.extend_from_slice(slice); vec } + /// Copy elements from a slice into the vector at position `index`, shifting any following + /// elements toward the back. + /// + /// For slices of `Copy` types, this is more efficient than `insert`. pub fn insert_from_slice(&mut self, index: usize, slice: &[A::Item]) { self.reserve(slice.len()); @@ -539,11 +716,14 @@ impl SmallVec where A::Item: Copy { let slice_ptr = slice.as_ptr(); let ptr = self.as_mut_ptr().offset(index as isize); ptr::copy(ptr, ptr.offset(slice.len() as isize), len - index); - ptr::copy(slice_ptr, ptr, slice.len()); + ptr::copy_nonoverlapping(slice_ptr, ptr, slice.len()); self.set_len(len + slice.len()); } } + /// Copy elements from a slice and append them to the vector. + /// + /// For slices of `Copy` types, this is more efficient than `extend`. #[inline] pub fn extend_from_slice(&mut self, slice: &[A::Item]) { let len = self.len(); @@ -551,20 +731,6 @@ impl SmallVec where A::Item: Copy { } } -#[cfg(feature="heapsizeof")] -impl HeapSizeOf for SmallVec where A::Item: HeapSizeOf { - fn heap_size_of_children(&self) -> usize { - match self.data { - Inline { .. } => 0, - Heap { ptr, .. } => { - self.iter().fold( - unsafe { heap_size_of(ptr as *const c_void) }, - |n, elem| n + elem.heap_size_of_children()) - }, - } - } -} - impl ops::Deref for SmallVec { type Target = [A::Item]; #[inline] @@ -617,6 +783,74 @@ impl BorrowMut<[A::Item]> for SmallVec { } } +#[cfg(feature = "std")] +impl> io::Write for SmallVec { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result { + self.extend_from_slice(buf); + Ok(buf.len()) + } + + #[inline] + fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { + self.extend_from_slice(buf); + Ok(()) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +#[cfg(feature = "serde")] +impl Serialize for SmallVec where A::Item: Serialize { + fn serialize(&self, serializer: S) -> Result { + let mut state = serializer.serialize_seq(Some(self.len()))?; + for item in self { + state.serialize_element(&item)?; + } + state.end() + } +} + +#[cfg(feature = "serde")] +impl<'de, A: Array> Deserialize<'de> for SmallVec where A::Item: Deserialize<'de> { + fn deserialize>(deserializer: D) -> Result { + deserializer.deserialize_seq(SmallVecVisitor{phantom: PhantomData}) + } +} + +#[cfg(feature = "serde")] +struct SmallVecVisitor { + phantom: PhantomData +} + +#[cfg(feature = "serde")] +impl<'de, A: Array> Visitor<'de> for SmallVecVisitor +where A::Item: Deserialize<'de>, +{ + type Value = SmallVec; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a sequence") + } + + fn visit_seq(self, mut seq: B) -> Result + where + B: SeqAccess<'de>, + { + let len = seq.size_hint().unwrap_or(0); + let mut values = SmallVec::with_capacity(len); + + while let Some(value) = seq.next_element()? { + values.push(value); + } + + Ok(values) + } +} + impl<'a, A: Array> From<&'a [A::Item]> for SmallVec where A::Item: Clone { #[inline] fn from(slice: &'a [A::Item]) -> SmallVec { @@ -624,6 +858,20 @@ impl<'a, A: Array> From<&'a [A::Item]> for SmallVec where A::Item: Clone { } } +impl From> for SmallVec { + #[inline] + fn from(vec: Vec) -> SmallVec { + SmallVec::from_vec(vec) + } +} + +impl From for SmallVec { + #[inline] + fn from(array: A) -> SmallVec { + SmallVec::from_buf(array) + } +} + macro_rules! impl_index { ($index_type: ty, $output_type: ty) => { impl ops::Index<$index_type> for SmallVec { @@ -649,7 +897,13 @@ impl_index!(ops::RangeFrom, [A::Item]); impl_index!(ops::RangeTo, [A::Item]); impl_index!(ops::RangeFull, [A::Item]); +impl ExtendFromSlice for SmallVec where A::Item: Copy { + fn extend_from_slice(&mut self, other: &[A::Item]) { + SmallVec::extend_from_slice(self, other) + } +} +#[allow(deprecated)] impl VecLike for SmallVec { #[inline] fn push(&mut self, value: A::Item) { @@ -710,7 +964,7 @@ impl Drop for SmallVec { impl Clone for SmallVec where A::Item: Clone { fn clone(&self) -> SmallVec { - let mut new_vector = SmallVec::new(); + let mut new_vector = SmallVec::with_capacity(self.len()); for element in self.iter() { new_vector.push((*element).clone()) } @@ -750,6 +1004,11 @@ impl Hash for SmallVec where A::Item: Hash { unsafe impl Send for SmallVec where A::Item: Send {} +/// An iterator that consumes a `SmallVec` and yields its items by value. +/// +/// Returned from [`SmallVec::into_iter`][1]. +/// +/// [1]: struct.SmallVec.html#method.into_iter pub struct IntoIter { data: SmallVecData, current: usize, @@ -837,41 +1096,15 @@ impl<'a, A: Array> IntoIterator for &'a mut SmallVec { } } -// TODO: Remove these and its users. - -/// Deprecated alias to ease transition from an earlier version. -#[deprecated] -pub type SmallVec1 = SmallVec<[T; 1]>; - -/// Deprecated alias to ease transition from an earlier version. -#[deprecated] -pub type SmallVec2 = SmallVec<[T; 2]>; - -/// Deprecated alias to ease transition from an earlier version. -#[deprecated] -pub type SmallVec4 = SmallVec<[T; 4]>; - -/// Deprecated alias to ease transition from an earlier version. -#[deprecated] -pub type SmallVec8 = SmallVec<[T; 8]>; - -/// Deprecated alias to ease transition from an earlier version. -#[deprecated] -pub type SmallVec16 = SmallVec<[T; 16]>; - -/// Deprecated alias to ease transition from an earlier version. -#[deprecated] -pub type SmallVec24 = SmallVec<[T; 24]>; - -/// Deprecated alias to ease transition from an earlier version. -#[deprecated] -pub type SmallVec32 = SmallVec<[T; 32]>; - /// Types that can be used as the backing store for a SmallVec pub unsafe trait Array { + /// The type of the array's elements. type Item; + /// Returns the number of items the array can hold. fn size() -> usize; + /// Returns a pointer to the first element of the array. fn ptr(&self) -> *const Self::Item; + /// Returns a mutable pointer to the first element of the array. fn ptr_mut(&mut self) -> *mut Self::Item; } @@ -893,15 +1126,23 @@ impl_array!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 32, 3 0x10000, 0x20000, 0x40000, 0x80000, 0x100000); #[cfg(test)] -pub mod tests { +mod tests { use SmallVec; - use std::borrow::ToOwned; + use std::iter::FromIterator; - #[cfg(feature="heapsizeof")] - use heapsize::HeapSizeOf; - #[cfg(feature="heapsizeof")] - use std::mem::size_of; + #[cfg(feature = "std")] + use std::borrow::ToOwned; + #[cfg(not(feature = "std"))] + use alloc::borrow::ToOwned; + #[cfg(feature = "std")] + use std::rc::Rc; + #[cfg(not(feature = "std"))] + use alloc::rc::Rc; + #[cfg(not(feature = "std"))] + use alloc::boxed::Box; + #[cfg(not(feature = "std"))] + use alloc::vec::Vec; // We heap allocate all these strings so that double frees will show up under valgrind. @@ -968,6 +1209,19 @@ pub mod tests { assert!(Some(SmallVec::<[&u32; 2]>::new()).is_some()); } + #[test] + fn test_with_capacity() { + let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(1); + assert!(v.is_empty()); + assert!(!v.spilled()); + assert_eq!(v.capacity(), 3); + + let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(10); + assert!(v.is_empty()); + assert!(v.spilled()); + assert_eq!(v.capacity(), 10); + } + #[test] fn drain() { let mut v: SmallVec<[u8; 2]> = SmallVec::new(); @@ -1239,6 +1493,7 @@ pub mod tests { assert!(c > b); } + #[cfg(feature = "std")] #[test] fn test_hash() { use std::hash::Hash; @@ -1316,6 +1571,31 @@ pub mod tests { fn test_from() { assert_eq!(&SmallVec::<[u32; 2]>::from(&[1][..])[..], [1]); assert_eq!(&SmallVec::<[u32; 2]>::from(&[1, 2, 3][..])[..], [1, 2, 3]); + + let vec = vec![]; + let small_vec: SmallVec<[u8; 3]> = SmallVec::from(vec); + assert_eq!(&*small_vec, &[]); + drop(small_vec); + + let vec = vec![1, 2, 3, 4, 5]; + let small_vec: SmallVec<[u8; 3]> = SmallVec::from(vec); + assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); + drop(small_vec); + + let vec = vec![1, 2, 3, 4, 5]; + let small_vec: SmallVec<[u8; 1]> = SmallVec::from(vec); + assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); + drop(small_vec); + + let array = [1]; + let small_vec: SmallVec<[u8; 1]> = SmallVec::from(array); + assert_eq!(&*small_vec, &[1]); + drop(small_vec); + + let array = [99; 128]; + let small_vec: SmallVec<[u8; 128]> = SmallVec::from(array); + assert_eq!(&*small_vec, vec![99u8; 128].as_slice()); + drop(small_vec); } #[test] @@ -1324,30 +1604,6 @@ pub mod tests { assert_eq!(&SmallVec::<[u32; 2]>::from_slice(&[1, 2, 3][..])[..], [1, 2, 3]); } - #[cfg(feature="heapsizeof")] - #[test] - fn test_heap_size_of_children() { - let mut vec = SmallVec::<[u32; 2]>::new(); - assert_eq!(vec.heap_size_of_children(), 0); - vec.push(1); - vec.push(2); - assert_eq!(vec.heap_size_of_children(), 0); - vec.push(3); - assert_eq!(vec.heap_size_of_children(), 16); - - // Now check with reserved space - let mut vec = SmallVec::<[u32; 2]>::new(); - vec.reserve(10); // Rounds up to 16 - assert_eq!(vec.heap_size_of_children(), 64); - - // Check with nested heap structures - let mut vec = SmallVec::<[Vec; 2]>::new(); - vec.reserve(10); - vec.push(vec![2, 3, 4]); - assert_eq!(vec.heap_size_of_children(), - vec![2, 3, 4].heap_size_of_children() + 16 * size_of::>()); - } - #[test] fn test_exact_size_iterator() { let mut vec = SmallVec::<[u32; 2]>::from(&[1, 2, 3][..]); @@ -1356,6 +1612,7 @@ pub mod tests { } #[test] + #[allow(deprecated)] fn veclike_deref_slice() { use super::VecLike; @@ -1421,4 +1678,97 @@ pub mod tests { assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); drop(small_vec); } + + #[test] + fn test_retain() { + // Test inline data storate + let mut sv: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 2, 3, 3, 4]); + sv.retain(|&mut i| i != 3); + assert_eq!(sv.pop(), Some(4)); + assert_eq!(sv.pop(), Some(2)); + assert_eq!(sv.pop(), Some(1)); + assert_eq!(sv.pop(), None); + + // Test spilled data storage + let mut sv: SmallVec<[i32; 3]> = SmallVec::from_slice(&[1, 2, 3, 3, 4]); + sv.retain(|&mut i| i != 3); + assert_eq!(sv.pop(), Some(4)); + assert_eq!(sv.pop(), Some(2)); + assert_eq!(sv.pop(), Some(1)); + assert_eq!(sv.pop(), None); + + // Test that drop implementations are called for inline. + let one = Rc::new(1); + let mut sv: SmallVec<[Rc; 3]> = SmallVec::new(); + sv.push(Rc::clone(&one)); + assert_eq!(Rc::strong_count(&one), 2); + sv.retain(|_| false); + assert_eq!(Rc::strong_count(&one), 1); + + // Test that drop implementations are called for spilled data. + let mut sv: SmallVec<[Rc; 1]> = SmallVec::new(); + sv.push(Rc::clone(&one)); + sv.push(Rc::new(2)); + assert_eq!(Rc::strong_count(&one), 2); + sv.retain(|_| false); + assert_eq!(Rc::strong_count(&one), 1); + } + + #[test] + fn test_dedup() { + let mut dupes: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 1, 2, 3, 3]); + dupes.dedup(); + assert_eq!(&*dupes, &[1, 2, 3]); + + let mut empty: SmallVec<[i32; 5]> = SmallVec::new(); + empty.dedup(); + assert!(empty.is_empty()); + + let mut all_ones: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 1, 1, 1, 1]); + all_ones.dedup(); + assert_eq!(all_ones.len(), 1); + + let mut no_dupes: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 2, 3, 4, 5]); + no_dupes.dedup(); + assert_eq!(no_dupes.len(), 5); + } + + #[cfg(feature = "std")] + #[test] + fn test_write() { + use io::Write; + + let data = [1, 2, 3, 4, 5]; + + let mut small_vec: SmallVec<[u8; 2]> = SmallVec::new(); + let len = small_vec.write(&data[..]).unwrap(); + assert_eq!(len, 5); + assert_eq!(small_vec.as_ref(), data.as_ref()); + + let mut small_vec: SmallVec<[u8; 2]> = SmallVec::new(); + small_vec.write_all(&data[..]).unwrap(); + assert_eq!(small_vec.as_ref(), data.as_ref()); + } + + #[cfg(feature = "serde")] + extern crate bincode; + + #[cfg(feature = "serde")] + #[test] + fn test_serde() { + use self::bincode::{serialize, deserialize, Bounded}; + let mut small_vec: SmallVec<[i32; 2]> = SmallVec::new(); + small_vec.push(1); + let encoded = serialize(&small_vec, Bounded(100)).unwrap(); + let decoded: SmallVec<[i32; 2]> = deserialize(&encoded).unwrap(); + assert_eq!(small_vec, decoded); + small_vec.push(2); + // Spill the vec + small_vec.push(3); + small_vec.push(4); + // Check again after spilling. + let encoded = serialize(&small_vec, Bounded(100)).unwrap(); + let decoded: SmallVec<[i32; 2]> = deserialize(&encoded).unwrap(); + assert_eq!(small_vec, decoded); + } } diff --git a/src/vendor/tar/.cargo-checksum.json b/src/vendor/tar/.cargo-checksum.json index 017dad7dac..a13e76a317 100644 --- a/src/vendor/tar/.cargo-checksum.json +++ b/src/vendor/tar/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"641ce50921f9dd45b1d9043a44f61f4fb15cfbaf3b5d957f87fe4be2ba866593","Cargo.toml":"d16288c031c67eebd5793563108976a7f9bef1802c9d0864fb23ebe72ba6456d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"aa8360f3aa2630d68b5a3517c6fa7be8e756ecbe34b54778f46f06383d05239b","appveyor.yml":"2b698d8ab9a0b4b3781eb592d5d688f8b79c7e8044c9ccb3f3c5b5593fe1fb3b","examples/extract_file.rs":"22a009d59b85488bf6cc9dacde51516abc82934ce0ea813a0bea254e4794e56e","examples/list.rs":"36e412205eaffea8ab7f39be4173594b74e36acb369e091362b1975ee4a7a14b","examples/raw_list.rs":"491dd12840edc6460cce53a6aa5e824030a75231a0bf0209d1f33d902f49f32f","examples/write.rs":"94c6bd57a8e7a1f066121e58d761203b5a77f3584288eae09e9e2277fdf0ac71","src/archive.rs":"6f53af5666a0134754ec6fc1d632e58e29693fd2118454fa1483f209900977e6","src/builder.rs":"d118bb66c5a2faa5c9128ed7abd71dfda9b6872211e5aad3244dd405edfe5dd7","src/entry.rs":"fc472ad6f35f12fb4ed68ea637fe74550bc7ff04a8a0e7b09257016f3037a9b3","src/entry_type.rs":"2d6deb5520569f38949ac1a4309798212179cd93f34c8a0acf39cb2521eac599","src/error.rs":"64652621ecf5c605e8905c5dd004cacd9facfa1222b2ea215907d1d0b0ddbcc2","src/header.rs":"405024985aa4e38b01ccccf33ac50f708962964e7a477e1f65bf3ec8075a7a8e","src/lib.rs":"90b9fd4a72d1264da90b224ab062e2a45d4113e1a68839b0a456abafc92471cf","src/pax.rs":"127bcd5916be8c2a0080ad1f46a50e54cda6b6c461eed13ba65c7ab2b886ba48","tests/all.rs":"fbdb6fc2e19599ac007b0f5f9675ff14e4e31ef65a94d229e1917315784965b6","tests/archives/directory.tar":"ada2bda5ee257056ef9fbe6338f66f7188c9f32614991d73f83005b7972802f3","tests/archives/duplicate_dirs.tar":"7732db3e60c56e4bdf027021347b301452bcce66e83f2cfb4d4aa44e1b219a28","tests/archives/empty_filename.tar":"c58a599a8d6342841a7bff96f49e94fd779b96ab5d4f93795577b504afe1060a","tests/archives/file_times.tar":"35e1d58c149dafe0ec57793eedd14f4c3e7d36768d4068650a6cde63de014ba9","tests/archives/link.tar":"06ce2045e1d97d617821e7257721d446c876065a665a38bea6d5e9ce31a52f59","tests/archives/pax.tar":"ae37540f6940aad3707491ce2f37d0998cbee480919b1e6566794748cae9a097","tests/archives/reading_files.tar":"543b51829fbd4c5df77f873c63380c960c6dbea244999030cf7672b0b3a456a2","tests/archives/simple.tar":"1c3b1e2a39e83b85a8ee5c920aa3ed809cee2eeaa40b0ed79f10dfea91826daf","tests/archives/spaces.tar":"4f7d19a9fe2785e97a128d27263dee9d9df2fd8866dcece9fb44dcf20c2c0b24","tests/archives/sparse.tar":"64db241afcbfd9ced33a9482c577774f47c74cbd835207478ec235946c3c639d","tests/archives/xattrs.tar":"6df389a5be73fe184c0427d74a1689cce6af0d3488b270acdf3224e3b3f4acbb","tests/entry.rs":"788ee07e88b4b19162496d523fa69777f9450277a02dea1f56ae0490af0d49cf","tests/header/mod.rs":"86c4dfbfc35094e01ae2cf5420582838dab84ee2f3905d4418faf66d2db13861"},"package":"281285b717926caa919ad905ef89c63d75805c7d89437fb873100925a53f2b1b"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"641ce50921f9dd45b1d9043a44f61f4fb15cfbaf3b5d957f87fe4be2ba866593","Cargo.toml":"a0234ca24ece8debcad991f614163bac8c7b023876b1d908b63c18d7a71e32a1","Cargo.toml.orig":"c5a831ee00e805c3251bcdc13193d0f566948d157f42e39507ce99497cca9d18","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"e16ec1c38809cfef4b67a4a8b521d2c679832379eddedba5212444dbb3d1f436","appveyor.yml":"2b698d8ab9a0b4b3781eb592d5d688f8b79c7e8044c9ccb3f3c5b5593fe1fb3b","examples/extract_file.rs":"22a009d59b85488bf6cc9dacde51516abc82934ce0ea813a0bea254e4794e56e","examples/list.rs":"36e412205eaffea8ab7f39be4173594b74e36acb369e091362b1975ee4a7a14b","examples/raw_list.rs":"491dd12840edc6460cce53a6aa5e824030a75231a0bf0209d1f33d902f49f32f","examples/write.rs":"94c6bd57a8e7a1f066121e58d761203b5a77f3584288eae09e9e2277fdf0ac71","src/archive.rs":"6f53af5666a0134754ec6fc1d632e58e29693fd2118454fa1483f209900977e6","src/builder.rs":"5514155cf443d03c2ea480778d3168f2c60424455e565677a6fc9cfba436e813","src/entry.rs":"7906e0075590e00531d101e61f4427fc67a5bda6884aa25c060099347b3b7b5f","src/entry_type.rs":"2d6deb5520569f38949ac1a4309798212179cd93f34c8a0acf39cb2521eac599","src/error.rs":"64652621ecf5c605e8905c5dd004cacd9facfa1222b2ea215907d1d0b0ddbcc2","src/header.rs":"e1e6113faf4c5960b600de067e4b0e49858deea3b6ef16734e9b48d0c17bf8ab","src/lib.rs":"5679a5a1703e786f17207391ddc5ae27578f42f309d559430e4a16fdc850dcf7","src/pax.rs":"127bcd5916be8c2a0080ad1f46a50e54cda6b6c461eed13ba65c7ab2b886ba48","tests/all.rs":"904cf17f2345e65c5cf3efd859d8ec1bd6f6fcc49551ed9207ec9d34be3b09df","tests/archives/directory.tar":"ada2bda5ee257056ef9fbe6338f66f7188c9f32614991d73f83005b7972802f3","tests/archives/duplicate_dirs.tar":"7732db3e60c56e4bdf027021347b301452bcce66e83f2cfb4d4aa44e1b219a28","tests/archives/empty_filename.tar":"c58a599a8d6342841a7bff96f49e94fd779b96ab5d4f93795577b504afe1060a","tests/archives/file_times.tar":"35e1d58c149dafe0ec57793eedd14f4c3e7d36768d4068650a6cde63de014ba9","tests/archives/link.tar":"06ce2045e1d97d617821e7257721d446c876065a665a38bea6d5e9ce31a52f59","tests/archives/pax.tar":"ae37540f6940aad3707491ce2f37d0998cbee480919b1e6566794748cae9a097","tests/archives/reading_files.tar":"543b51829fbd4c5df77f873c63380c960c6dbea244999030cf7672b0b3a456a2","tests/archives/simple.tar":"1c3b1e2a39e83b85a8ee5c920aa3ed809cee2eeaa40b0ed79f10dfea91826daf","tests/archives/spaces.tar":"4f7d19a9fe2785e97a128d27263dee9d9df2fd8866dcece9fb44dcf20c2c0b24","tests/archives/sparse.tar":"64db241afcbfd9ced33a9482c577774f47c74cbd835207478ec235946c3c639d","tests/archives/xattrs.tar":"6df389a5be73fe184c0427d74a1689cce6af0d3488b270acdf3224e3b3f4acbb","tests/entry.rs":"8176c21203ca1ea5a7f8aefffca44aa5e5c386a98a6b5ee644f7aefa31caacb4","tests/header/mod.rs":"7f061d88bda1aed07b9fc5251e9ee110106a746ce6dfb76bbce73ec58825ae2b"},"package":"1605d3388ceb50252952ffebab4b5dc43017ead7e4481b175961c283bb951195"} \ No newline at end of file diff --git a/src/vendor/tar/Cargo.toml b/src/vendor/tar/Cargo.toml index f53137b8ba..668f4ab1dd 100644 --- a/src/vendor/tar/Cargo.toml +++ b/src/vendor/tar/Cargo.toml @@ -1,31 +1,38 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] - name = "tar" -version = "0.4.13" +version = "0.4.14" authors = ["Alex Crichton "] +description = "A Rust implementation of a TAR file reader and writer. This library does not\ncurrently handle compression, but it is abstract over all I/O readers and\nwriters. Additionally, great lengths are taken to ensure that the entire\ncontents are never required to be entirely resident in memory all at once.\n" homepage = "https://github.com/alexcrichton/tar-rs" -repository = "https://github.com/alexcrichton/tar-rs" documentation = "https://docs.rs/tar" -license = "MIT/Apache-2.0" -keywords = ["tar", "tarfile", "encoding"] readme = "README.md" - -description = """ -A Rust implementation of a TAR file reader and writer. This library does not -currently handle compression, but it is abstract over all I/O readers and -writers. Additionally, great lengths are taken to ensure that the entire -contents are never required to be entirely resident in memory all at once. -""" - -[dependencies] -libc = "0.2" -filetime = "0.1.5" - -[dev-dependencies] -tempdir = "0.3" - -[target."cfg(unix)".dependencies] -xattr = { version = "0.1.7", optional = true } +keywords = ["tar", "tarfile", "encoding"] +license = "MIT/Apache-2.0" +repository = "https://github.com/alexcrichton/tar-rs" +[dependencies.filetime] +version = "0.1.5" +[dev-dependencies.tempdir] +version = "0.3" [features] default = ["xattr"] +[target."cfg(target_os = \"redox\")".dependencies.redox_syscall] +version = "0.1" +[target."cfg(unix)".dependencies.libc] +version = "0.2" + +[target."cfg(unix)".dependencies.xattr] +version = "0.1.7" +optional = true diff --git a/src/vendor/tar/Cargo.toml.orig b/src/vendor/tar/Cargo.toml.orig new file mode 100644 index 0000000000..1832df9a56 --- /dev/null +++ b/src/vendor/tar/Cargo.toml.orig @@ -0,0 +1,34 @@ +[package] + +name = "tar" +version = "0.4.14" +authors = ["Alex Crichton "] +homepage = "https://github.com/alexcrichton/tar-rs" +repository = "https://github.com/alexcrichton/tar-rs" +documentation = "https://docs.rs/tar" +license = "MIT/Apache-2.0" +keywords = ["tar", "tarfile", "encoding"] +readme = "README.md" + +description = """ +A Rust implementation of a TAR file reader and writer. This library does not +currently handle compression, but it is abstract over all I/O readers and +writers. Additionally, great lengths are taken to ensure that the entire +contents are never required to be entirely resident in memory all at once. +""" + +[dependencies] +filetime = "0.1.5" + +[dev-dependencies] +tempdir = "0.3" + +[target."cfg(unix)".dependencies] +xattr = { version = "0.1.7", optional = true } +libc = "0.2" + +[target.'cfg(target_os = "redox")'.dependencies] +redox_syscall = "0.1" + +[features] +default = ["xattr"] diff --git a/src/vendor/tar/README.md b/src/vendor/tar/README.md index a0c5f213d9..28b5d94cf9 100644 --- a/src/vendor/tar/README.md +++ b/src/vendor/tar/README.md @@ -64,8 +64,17 @@ fn main() { # License -`tar-rs` is primarily distributed under the terms of both the MIT license and -the Apache License (Version 2.0), with portions covered by various BSD-like -licenses. +This project is licensed under either of -See LICENSE-APACHE, and LICENSE-MIT for details. + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or + http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be +dual licensed as above, without any additional terms or conditions. diff --git a/src/vendor/tar/src/builder.rs b/src/vendor/tar/src/builder.rs index 458c149b43..6f91cb7a08 100644 --- a/src/vendor/tar/src/builder.rs +++ b/src/vendor/tar/src/builder.rs @@ -13,6 +13,7 @@ use header::{bytes2path, HeaderMode, path2bytes}; /// arbitrary writer. pub struct Builder { mode: HeaderMode, + follow: bool, finished: bool, obj: Option, } @@ -24,6 +25,7 @@ impl Builder { pub fn new(obj: W) -> Builder { Builder { mode: HeaderMode::Complete, + follow: true, finished: false, obj: Some(obj), } @@ -40,6 +42,12 @@ impl Builder { self.mode = mode; } + /// Follow symlinks, archiving the contents of the file they point to rather + /// than adding a symlink to the archive. Defaults to true. + pub fn follow_symlinks(&mut self, follow: bool) { + self.follow = follow; + } + /// Unwrap this archive, returning the underlying object. /// /// This function will finish writing the archive if the `finish` function @@ -78,7 +86,7 @@ impl Builder { /// use tar::{Builder, Header}; /// /// let mut header = Header::new_gnu(); - /// header.set_path("foo"); + /// header.set_path("foo").unwrap(); /// header.set_size(4); /// header.set_cksum(); /// @@ -166,7 +174,8 @@ impl Builder { /// ``` pub fn append_path>(&mut self, path: P) -> io::Result<()> { let mode = self.mode.clone(); - append_path(self.inner(), path.as_ref(), mode) + let follow = self.follow; + append_path(self.inner(), path.as_ref(), mode, follow) } /// Adds a file to this archive with the given path as the name of the file @@ -259,7 +268,8 @@ impl Builder { where P: AsRef, Q: AsRef { let mode = self.mode.clone(); - append_dir_all(self.inner(), path.as_ref(), src_path.as_ref(), mode) + let follow = self.follow; + append_dir_all(self.inner(), path.as_ref(), src_path.as_ref(), mode, follow) } /// Finish writing this archive, emitting the termination sections. @@ -294,12 +304,19 @@ fn append(mut dst: &mut Write, Ok(()) } -fn append_path(dst: &mut Write, path: &Path, mode: HeaderMode) -> io::Result<()> { - let stat = try!(fs::metadata(path)); +fn append_path(dst: &mut Write, path: &Path, mode: HeaderMode, follow: bool) -> io::Result<()> { + let stat = if follow { + try!(fs::metadata(path)) + } else { + try!(fs::symlink_metadata(path)) + }; if stat.is_file() { - append_fs(dst, path, &stat, &mut try!(fs::File::open(path)), mode) + append_fs(dst, path, &stat, &mut try!(fs::File::open(path)), mode, None) } else if stat.is_dir() { - append_fs(dst, path, &stat, &mut io::empty(), mode) + append_fs(dst, path, &stat, &mut io::empty(), mode, None) + } else if stat.file_type().is_symlink() { + let link_name = try!(fs::read_link(path)); + append_fs(dst, path, &stat, &mut io::empty(), mode, Some(&link_name)) } else { Err(other("path has unknown file type")) } @@ -308,12 +325,12 @@ fn append_path(dst: &mut Write, path: &Path, mode: HeaderMode) -> io::Result<()> fn append_file(dst: &mut Write, path: &Path, file: &mut fs::File, mode: HeaderMode) -> io::Result<()> { let stat = try!(file.metadata()); - append_fs(dst, path, &stat, file, mode) + append_fs(dst, path, &stat, file, mode, None) } fn append_dir(dst: &mut Write, path: &Path, src_path: &Path, mode: HeaderMode) -> io::Result<()> { let stat = try!(fs::metadata(src_path)); - append_fs(dst, path, &stat, &mut io::empty(), mode) + append_fs(dst, path, &stat, &mut io::empty(), mode, None) } fn prepare_header(dst: &mut Write, header: &mut Header, path: &Path) -> io::Result<()> { @@ -349,27 +366,36 @@ fn append_fs(dst: &mut Write, path: &Path, meta: &fs::Metadata, read: &mut Read, - mode: HeaderMode) -> io::Result<()> { + mode: HeaderMode, + link_name: Option<&Path>) -> io::Result<()> { let mut header = Header::new_gnu(); try!(prepare_header(dst, &mut header, path)); header.set_metadata_in_mode(meta, mode); + if let Some(link_name) = link_name { + try!(header.set_link_name(link_name)); + } header.set_cksum(); append(dst, &header, read) } -fn append_dir_all(dst: &mut Write, path: &Path, src_path: &Path, mode: HeaderMode) -> io::Result<()> { - let mut stack = vec![(src_path.to_path_buf(), true)]; - while let Some((src, is_dir)) = stack.pop() { +fn append_dir_all(dst: &mut Write, path: &Path, src_path: &Path, mode: HeaderMode, follow: bool) -> io::Result<()> { + let mut stack = vec![(src_path.to_path_buf(), true, false)]; + while let Some((src, is_dir, is_symlink)) = stack.pop() { let dest = path.join(src.strip_prefix(&src_path).unwrap()); if is_dir { for entry in try!(fs::read_dir(&src)) { let entry = try!(entry); - stack.push((entry.path(), try!(entry.file_type()).is_dir())); + let file_type = try!(entry.file_type()); + stack.push((entry.path(), file_type.is_dir(), file_type.is_symlink())); } if dest != Path::new("") { try!(append_dir(dst, &dest, &src, mode)); } + } else if !follow && is_symlink { + let stat = try!(fs::symlink_metadata(&src)); + let link_name = try!(fs::read_link(&src)); + try!(append_fs(dst, &dest, &stat, &mut io::empty(), mode, Some(&link_name))); } else { try!(append_file(dst, &dest, &mut try!(fs::File::open(src)), mode)); } diff --git a/src/vendor/tar/src/entry.rs b/src/vendor/tar/src/entry.rs index 366498f822..6778136872 100644 --- a/src/vendor/tar/src/entry.rs +++ b/src/vendor/tar/src/entry.rs @@ -177,7 +177,7 @@ impl<'a, R: Read> Entry<'a, R> { /// } /// ``` pub fn unpack>(&mut self, dst: P) -> io::Result<()> { - self.fields.unpack(dst.as_ref()) + self.fields.unpack(None, dst.as_ref()) } /// Extracts this file under the specified path, avoiding security issues. @@ -362,13 +362,13 @@ impl<'a> EntryFields<'a> { // Abort if target (canonical) parent is outside of `dst` let canon_parent = try!(parent.canonicalize()); - let canon_dst = try!(dst.canonicalize()); - if !canon_parent.starts_with(&canon_dst) { + let canon_target = try!(dst.canonicalize()); + if !canon_parent.starts_with(&canon_target) { return Err(TarError::new("trying to unpack outside of destination path", Error::new(ErrorKind::Other, "Invalid argument")).into()); } - try!(self.unpack(&file_dst).map_err(|e| { + try!(self.unpack(Some(&canon_target), &file_dst).map_err(|e| { TarError::new(&format!("failed to unpack `{}`", file_dst.display()), e) })); @@ -378,6 +378,7 @@ impl<'a> EntryFields<'a> { /// Returns access to the header of this entry in the archive. fn unpack(&mut self, + target_base: Option<&Path>, dst: &Path) -> io::Result<()> { let kind = self.header.entry_type(); if kind.is_dir() { @@ -399,7 +400,11 @@ impl<'a> EntryFields<'a> { } return if kind.is_hard_link() { - fs::hard_link(&src, dst) + let link_src = match target_base { + None => src.into_owned(), + Some(ref p) => p.join(src), + }; + fs::hard_link(&link_src, dst) } else { symlink(&src, dst) }; @@ -408,7 +413,7 @@ impl<'a> EntryFields<'a> { fn symlink(src: &Path, dst: &Path) -> io::Result<()> { ::std::os::windows::fs::symlink_file(src, dst) } - #[cfg(unix)] + #[cfg(any(unix, target_os = "redox"))] fn symlink(src: &Path, dst: &Path) -> io::Result<()> { ::std::os::unix::fs::symlink(src, dst) } @@ -471,10 +476,8 @@ impl<'a> EntryFields<'a> { } return Ok(()); - #[cfg(unix)] - #[allow(deprecated)] // raw deprecated in 1.8 + #[cfg(any(unix, target_os = "redox"))] fn set_perms(dst: &Path, mode: u32, preserve: bool) -> io::Result<()> { - use std::os::unix::raw; use std::os::unix::prelude::*; let mode = if preserve { @@ -483,7 +486,7 @@ impl<'a> EntryFields<'a> { mode & 0o777 }; - let perm = fs::Permissions::from_mode(mode as raw::mode_t); + let perm = fs::Permissions::from_mode(mode as _); fs::set_permissions(dst, perm) } #[cfg(windows)] @@ -531,7 +534,7 @@ impl<'a> EntryFields<'a> { } // Windows does not completely support posix xattrs // https://en.wikipedia.org/wiki/Extended_file_attributes#Windows_NT - #[cfg(any(windows, not(feature = "xattr")))] + #[cfg(any(windows, target_os = "redox", not(feature = "xattr")))] fn set_xattrs(_: &mut EntryFields, _: &Path) -> io::Result<()> { Ok(()) } diff --git a/src/vendor/tar/src/header.rs b/src/vendor/tar/src/header.rs index 881af5e0d0..f9755747ad 100644 --- a/src/vendor/tar/src/header.rs +++ b/src/vendor/tar/src/header.rs @@ -1,4 +1,4 @@ -#[cfg(unix)] use std::os::unix::prelude::*; +#[cfg(any(unix, target_os = "redox"))] use std::os::unix::prelude::*; #[cfg(windows)] use std::os::windows::prelude::*; use std::borrow::Cow; @@ -6,6 +6,7 @@ use std::fmt; use std::fs; use std::io; use std::iter::repeat; +use std::iter; use std::mem; use std::path::{Path, PathBuf, Component}; use std::str; @@ -139,11 +140,12 @@ impl Header { /// atime/ctime metadata attributes of files. pub fn new_gnu() -> Header { let mut header = Header { bytes: [0; 512] }; - { - let gnu = header.cast_mut::(); + unsafe { + let gnu = cast_mut::<_, GnuHeader>(&mut header); gnu.magic = *b"ustar "; gnu.version = *b" \0"; } + header.set_mtime(0); header } @@ -156,11 +158,12 @@ impl Header { /// UStar is also the basis used for pax archives. pub fn new_ustar() -> Header { let mut header = Header { bytes: [0; 512] }; - { - let gnu = header.cast_mut::(); + unsafe { + let gnu = cast_mut::<_, UstarHeader>(&mut header); gnu.magic = *b"ustar\0"; gnu.version = *b"00"; } + header.set_mtime(0); header } @@ -171,26 +174,18 @@ impl Header { /// format limits the path name limit and isn't able to contain extra /// metadata like atime/ctime. pub fn new_old() -> Header { - Header { bytes: [0; 512] } - } - - fn cast(&self) -> &T { - assert_eq!(mem::size_of_val(self), mem::size_of::()); - unsafe { &*(self as *const Header as *const T) } - } - - fn cast_mut(&mut self) -> &mut T { - assert_eq!(mem::size_of_val(self), mem::size_of::()); - unsafe { &mut *(self as *mut Header as *mut T) } + let mut header = Header { bytes: [0; 512] }; + header.set_mtime(0); + header } fn is_ustar(&self) -> bool { - let ustar = self.cast::(); + let ustar = unsafe { cast::<_, UstarHeader>(self) }; ustar.magic[..] == b"ustar\0"[..] && ustar.version[..] == b"00"[..] } fn is_gnu(&self) -> bool { - let ustar = self.cast::(); + let ustar = unsafe { cast::<_, UstarHeader>(self) }; ustar.magic[..] == b"ustar "[..] && ustar.version[..] == b" \0"[..] } @@ -199,12 +194,12 @@ impl Header { /// This view will always succeed as all archive header formats will fill /// out at least the fields specified in the old header format. pub fn as_old(&self) -> &OldHeader { - self.cast() + unsafe { cast(self) } } /// Same as `as_old`, but the mutable version. pub fn as_old_mut(&mut self) -> &mut OldHeader { - self.cast_mut() + unsafe { cast_mut(self) } } /// View this archive header as a raw UStar archive header. @@ -217,12 +212,12 @@ impl Header { /// magic/version fields of the UStar format have the appropriate values, /// returning `None` if they aren't correct. pub fn as_ustar(&self) -> Option<&UstarHeader> { - if self.is_ustar() {Some(self.cast())} else {None} + if self.is_ustar() {Some(unsafe { cast(self) })} else {None} } /// Same as `as_ustar_mut`, but the mutable version. pub fn as_ustar_mut(&mut self) -> Option<&mut UstarHeader> { - if self.is_ustar() {Some(self.cast_mut())} else {None} + if self.is_ustar() {Some(unsafe { cast_mut(self) })} else {None} } /// View this archive header as a raw GNU archive header. @@ -235,12 +230,12 @@ impl Header { /// magic/version fields of the GNU format have the appropriate values, /// returning `None` if they aren't correct. pub fn as_gnu(&self) -> Option<&GnuHeader> { - if self.is_gnu() {Some(self.cast())} else {None} + if self.is_gnu() {Some(unsafe { cast(self) })} else {None} } /// Same as `as_gnu`, but the mutable version. pub fn as_gnu_mut(&mut self) -> Option<&mut GnuHeader> { - if self.is_gnu() {Some(self.cast_mut())} else {None} + if self.is_gnu() {Some(unsafe { cast_mut(self) })} else {None} } /// Returns a view into this header as a byte array. @@ -601,15 +596,26 @@ impl Header { /// Sets the checksum field of this header based on the current fields in /// this header. pub fn set_cksum(&mut self) { - self.as_old_mut().cksum = *b" "; - let cksum = self.bytes.iter().fold(0, |a, b| a + (*b as u32)); + let cksum = self.calculate_cksum(); octal_into(&mut self.as_old_mut().cksum, cksum); } + fn calculate_cksum(&self) -> u32 { + let old = self.as_old(); + let start = old as *const _ as usize; + let cksum_start = old.cksum.as_ptr() as *const _ as usize; + let offset = cksum_start - start; + let len = old.cksum.len(); + self.bytes[0..offset].iter() + .chain(iter::repeat(&b' ').take(len)) + .chain(&self.bytes[offset + len..]) + .fold(0, |a, b| a + (*b as u32)) + } + fn fill_from(&mut self, meta: &fs::Metadata, mode: HeaderMode) { self.fill_platform_from(meta, mode); // Set size of directories to zero - self.set_size(if meta.is_dir() { 0 } else { meta.len() }); + self.set_size(if meta.is_dir() || meta.file_type().is_symlink() { 0 } else { meta.len() }); if let Some(ustar) = self.as_ustar_mut() { ustar.set_device_major(0); ustar.set_device_minor(0); @@ -620,10 +626,8 @@ impl Header { } } - #[cfg(unix)] + #[cfg(any(unix, target_os = "redox"))] fn fill_platform_from(&mut self, meta: &fs::Metadata, mode: HeaderMode) { - use libc; - match mode { HeaderMode::Complete => { self.set_mtime(meta.mtime() as u64); @@ -658,15 +662,32 @@ impl Header { // [1]: https://github.com/alexcrichton/tar-rs/issues/70 // TODO: need to bind more file types - self.set_entry_type(match meta.mode() as libc::mode_t & libc::S_IFMT { - libc::S_IFREG => EntryType::file(), - libc::S_IFLNK => EntryType::symlink(), - libc::S_IFCHR => EntryType::character_special(), - libc::S_IFBLK => EntryType::block_special(), - libc::S_IFDIR => EntryType::dir(), - libc::S_IFIFO => EntryType::fifo(), - _ => EntryType::new(b' '), - }); + self.set_entry_type(entry_type(meta.mode())); + + #[cfg(not(target_os = "redox"))] + fn entry_type(mode: u32) -> EntryType { + use libc; + match mode as libc::mode_t & libc::S_IFMT { + libc::S_IFREG => EntryType::file(), + libc::S_IFLNK => EntryType::symlink(), + libc::S_IFCHR => EntryType::character_special(), + libc::S_IFBLK => EntryType::block_special(), + libc::S_IFDIR => EntryType::dir(), + libc::S_IFIFO => EntryType::fifo(), + _ => EntryType::new(b' '), + } + } + + #[cfg(target_os = "redox")] + fn entry_type(mode: u32) -> EntryType { + use syscall; + match mode as u16 & syscall::MODE_TYPE { + syscall::MODE_FILE => EntryType::file(), + syscall::MODE_SYMLINK => EntryType::symlink(), + syscall::MODE_DIR => EntryType::dir(), + _ => EntryType::new(b' '), + } + } } #[cfg(windows)] @@ -720,6 +741,69 @@ impl Header { EntryType::new(b' ') }); } + + fn debug_fields(&self, b: &mut fmt::DebugStruct) { + if let Ok(entry_size) = self.entry_size() { + b.field("entry_size", &entry_size); + } + if let Ok(size) = self.size() { + b.field("size", &size); + } + if let Ok(path) = self.path() { + b.field("path", &path); + } + if let Ok(link_name) = self.link_name() { + b.field("link_name", &link_name); + } + if let Ok(mode) = self.mode() { + b.field("mode", &DebugAsOctal(mode)); + } + if let Ok(uid) = self.uid() { + b.field("uid", &uid); + } + if let Ok(gid) = self.gid() { + b.field("gid", &gid); + } + if let Ok(mtime) = self.mtime() { + b.field("mtime", &mtime); + } + if let Ok(username) = self.username() { + b.field("username", &username); + } + if let Ok(groupname) = self.groupname() { + b.field("groupname", &groupname); + } + if let Ok(device_major) = self.device_major() { + b.field("device_major", &device_major); + } + if let Ok(device_minor) = self.device_minor() { + b.field("device_minor", &device_minor); + } + if let Ok(cksum) = self.cksum() { + b.field("cksum", &cksum); + b.field("cksum_valid", &(cksum == self.calculate_cksum())); + } + } +} + +struct DebugAsOctal(T); + +impl fmt::Debug for DebugAsOctal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Octal::fmt(&self.0, f) + } +} + +unsafe fn cast(a: &T) -> &U { + assert_eq!(mem::size_of_val(a), mem::size_of::()); + assert_eq!(mem::align_of_val(a), mem::align_of::()); + &*(a as *const T as *const U) +} + +unsafe fn cast_mut(a: &mut T) -> &mut U { + assert_eq!(mem::size_of_val(a), mem::size_of::()); + assert_eq!(mem::align_of_val(a), mem::align_of::()); + &mut *(a as *mut T as *mut U) } impl Clone for Header { @@ -728,6 +812,38 @@ impl Clone for Header { } } +impl fmt::Debug for Header { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if let Some(me) = self.as_ustar() { + me.fmt(f) + } else if let Some(me) = self.as_gnu() { + me.fmt(f) + } else { + self.as_old().fmt(f) + } + } +} + +impl OldHeader { + /// Views this as a normal `Header` + pub fn as_header(&self) -> &Header { + unsafe { cast(self) } + } + + /// Views this as a normal `Header` + pub fn as_header_mut(&mut self) -> &mut Header { + unsafe { cast_mut(self) } + } +} + +impl fmt::Debug for OldHeader { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut f = f.debug_struct("OldHeader"); + self.as_header().debug_fields(&mut f); + f.finish() + } +} + impl UstarHeader { /// See `Header::path_bytes` pub fn path_bytes(&self) -> Cow<[u8]> { @@ -823,6 +939,24 @@ impl UstarHeader { pub fn set_device_minor(&mut self, minor: u32) { octal_into(&mut self.dev_minor, minor); } + + /// Views this as a normal `Header` + pub fn as_header(&self) -> &Header { + unsafe { cast(self) } + } + + /// Views this as a normal `Header` + pub fn as_header_mut(&mut self) -> &mut Header { + unsafe { cast_mut(self) } + } +} + +impl fmt::Debug for UstarHeader { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut f = f.debug_struct("UstarHeader"); + self.as_header().debug_fields(&mut f); + f.finish() + } } impl GnuHeader { @@ -908,6 +1042,46 @@ impl GnuHeader { pub fn is_extended(&self) -> bool { self.isextended[0] == 1 } + + /// Views this as a normal `Header` + pub fn as_header(&self) -> &Header { + unsafe { cast(self) } + } + + /// Views this as a normal `Header` + pub fn as_header_mut(&mut self) -> &mut Header { + unsafe { cast_mut(self) } + } +} + +impl fmt::Debug for GnuHeader { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut f = f.debug_struct("GnuHeader"); + self.as_header().debug_fields(&mut f); + if let Ok(atime) = self.atime() { + f.field("atime", &atime); + } + if let Ok(ctime) = self.ctime() { + f.field("ctime", &ctime); + } + f.field("is_extended", &self.is_extended()) + .field("sparse", &DebugSparseHeaders(&self.sparse)) + .finish() + } +} + +struct DebugSparseHeaders<'a>(&'a [GnuSparseHeader]); + +impl<'a> fmt::Debug for DebugSparseHeaders<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut f = f.debug_list(); + for header in self.0 { + if !header.is_empty() { + f.entry(header); + } + } + f.finish() + } } impl GnuSparseHeader { @@ -931,6 +1105,19 @@ impl GnuSparseHeader { } } +impl fmt::Debug for GnuSparseHeader { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut f = f.debug_struct("GnuSparseHeader"); + if let Ok(offset) = self.offset() { + f.field("offset", &offset); + } + if let Ok(length) = self.length() { + f.field("length", &length); + } + f.finish() + } +} + impl GnuExtSparseHeader { /// Crates a new zero'd out sparse header entry. pub fn new() -> GnuExtSparseHeader { @@ -970,13 +1157,27 @@ impl Default for GnuExtSparseHeader { } fn octal_from(slice: &[u8]) -> io::Result { - let num = match str::from_utf8(truncate(slice)) { - Ok(n) => n, - Err(_) => return Err(other("numeric field did not have utf-8 text")), - }; - match u64::from_str_radix(num.trim(), 8) { - Ok(n) => Ok(n), - Err(_) => Err(other("numeric field was not a number")) + if slice[0] & 0x80 != 0 { + // number is expressed in binary as a GNU numeric extension - + // see https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current + // under section "Numeric Extensions" + let mut total = (slice[0] ^ 0x80) as u64; + let mut index = 1; + while index < slice.len() { + total <<= 8; + total |= slice[index] as u64; + index += 1; + } + Ok(total) + } else { + let num = match str::from_utf8(truncate(slice)) { + Ok(n) => n, + Err(_) => return Err(other("numeric field did not have utf-8 text")), + }; + match u64::from_str_radix(num.trim(), 8) { + Ok(n) => Ok(n), + Err(_) => Err(other("numeric field was not a number")) + } } } @@ -1022,6 +1223,7 @@ fn copy_path_into(mut slot: &mut [u8], path: &Path, is_link_name: bool) -> io::Result<()> { let mut emitted = false; + let mut needs_slash = false; for component in path.components() { let bytes = try!(path2bytes(Path::new(component.as_os_str()))); match (component, is_link_name) { @@ -1032,12 +1234,14 @@ fn copy_path_into(mut slot: &mut [u8], (Component::ParentDir, false) => { return Err(other("paths in archives must not have `..`")) } + // Allow "./" as the path + (Component::CurDir, false) if path.components().count() == 1 => {}, (Component::CurDir, false) => continue, (Component::Normal(_), _) | (_, true) => {} }; - if emitted { - try!(copy(&mut slot, &[b'/'])); + if needs_slash { + try!(copy(&mut slot, b"/")); } if bytes.contains(&b'/') { if let Component::Normal(..) = component { @@ -1045,6 +1249,9 @@ fn copy_path_into(mut slot: &mut [u8], } } try!(copy(&mut slot, &*bytes)); + if &*bytes != b"/" { + needs_slash = true; + } emitted = true; } if !emitted { @@ -1069,7 +1276,7 @@ fn ends_with_slash(p: &Path) -> bool { last == Some(b'/' as u16) || last == Some(b'\\' as u16) } -#[cfg(unix)] +#[cfg(any(unix, target_os = "redox"))] fn ends_with_slash(p: &Path) -> bool { p.as_os_str().as_bytes().ends_with(&[b'/']) } @@ -1094,7 +1301,7 @@ pub fn path2bytes(p: &Path) -> io::Result> { }) } -#[cfg(unix)] +#[cfg(any(unix, target_os = "redox"))] pub fn path2bytes(p: &Path) -> io::Result> { Ok(p.as_os_str().as_bytes()).map(Cow::Borrowed) } @@ -1121,7 +1328,7 @@ pub fn bytes2path(bytes: Cow<[u8]>) -> io::Result> { } } -#[cfg(unix)] +#[cfg(any(unix, target_os = "redox"))] pub fn bytes2path(bytes: Cow<[u8]>) -> io::Result> { use std::ffi::{OsStr, OsString}; diff --git a/src/vendor/tar/src/lib.rs b/src/vendor/tar/src/lib.rs index d211ccc942..b3b8fe5f7e 100644 --- a/src/vendor/tar/src/lib.rs +++ b/src/vendor/tar/src/lib.rs @@ -21,10 +21,13 @@ #![deny(missing_docs)] #![cfg_attr(test, deny(warnings))] +#[cfg(unix)] extern crate libc; extern crate filetime; #[cfg(all(unix, feature = "xattr"))] extern crate xattr; +#[cfg(target_os = "redox")] +extern crate syscall; use std::io::{Error, ErrorKind}; use std::ops::{Deref, DerefMut}; diff --git a/src/vendor/tar/tests/all.rs b/src/vendor/tar/tests/all.rs index 3e8744a3d6..6ecd440b28 100644 --- a/src/vendor/tar/tests/all.rs +++ b/src/vendor/tar/tests/all.rs @@ -192,7 +192,9 @@ fn extracting_directories() { #[test] #[cfg(all(unix, feature = "xattr"))] fn xattrs() { - let td = t!(TempDir::new("tar-rs")); + // If /tmp is a tmpfs, xattr will fail + // The xattr crate's unit tests also use /var/tmp for this reason + let td = t!(TempDir::new_in("/var/tmp", "tar-rs")); let rdr = Cursor::new(tar!("xattrs.tar")); let mut ar = Archive::new(rdr); ar.set_unpack_xattrs(true); @@ -348,7 +350,7 @@ fn extracting_malicious_tarball() { assert!(header.set_path(path).is_err(), "was ok: {:?}", path); { - let mut h = header.as_gnu_mut().unwrap(); + let h = header.as_gnu_mut().unwrap(); for (a, b) in h.name.iter_mut().zip(path.as_bytes()) { *a = *b; } @@ -368,8 +370,10 @@ fn extracting_malicious_tarball() { append("./../rel_evil3.txt"); append("some/../../rel_evil4.txt"); append(""); - append("././//./"); - append("."); + append("././//./.."); + append(".."); + append("/////////.."); + append("/////////"); } let mut ar = Archive::new(&evil_tar[..]); @@ -770,3 +774,30 @@ fn path_separators() { assert!(entries.next().is_none()); } + +#[test] +#[cfg(unix)] +fn append_path_symlink() { + use std::os::unix::fs::symlink; + use std::env; + use std::borrow::Cow; + + let mut ar = Builder::new(Vec::new()); + ar.follow_symlinks(false); + let td = t!(TempDir::new("tar-rs")); + + t!(env::set_current_dir(td.path())); + t!(symlink("testdest", "test")); + t!(ar.append_path("test")); + + let rd = Cursor::new(t!(ar.into_inner())); + let mut ar = Archive::new(rd); + let mut entries = t!(ar.entries()); + + let entry = t!(entries.next().unwrap()); + assert_eq!(t!(entry.path()), Path::new("test")); + assert_eq!(t!(entry.link_name()), Some(Cow::from(Path::new("testdest")))); + assert_eq!(t!(entry.header().size()), 0); + + assert!(entries.next().is_none()); +} diff --git a/src/vendor/tar/tests/entry.rs b/src/vendor/tar/tests/entry.rs index 029e9cac83..20ed4ac2b2 100644 --- a/src/vendor/tar/tests/entry.rs +++ b/src/vendor/tar/tests/entry.rs @@ -4,7 +4,6 @@ extern crate tempdir; use std::fs::File; use tempdir::TempDir; -use std::path::PathBuf; macro_rules! t { ($e:expr) => (match $e { @@ -14,7 +13,7 @@ macro_rules! t { } #[test] -fn absolute_link() { +fn absolute_symlink() { let mut ar = tar::Builder::new(Vec::new()); let mut header = tar::Header::new_gnu(); @@ -32,6 +31,68 @@ fn absolute_link() { t!(ar.unpack(td.path())); t!(td.path().join("foo").symlink_metadata()); + + let mut ar = tar::Archive::new(&bytes[..]); + let mut entries = t!(ar.entries()); + let entry = t!(entries.next().unwrap()); + assert_eq!(&*entry.link_name_bytes().unwrap(), b"/bar"); +} + +#[test] +fn absolute_hardlink() { + let td = t!(TempDir::new("tar")); + let mut ar = tar::Builder::new(Vec::new()); + + let mut header = tar::Header::new_gnu(); + header.set_size(0); + header.set_entry_type(tar::EntryType::Regular); + t!(header.set_path("foo")); + header.set_cksum(); + t!(ar.append(&header, &[][..])); + + let mut header = tar::Header::new_gnu(); + header.set_size(0); + header.set_entry_type(tar::EntryType::Link); + t!(header.set_path("bar")); + // This absolute path under tempdir will be created at unpack time + t!(header.set_link_name(td.path().join("foo"))); + header.set_cksum(); + t!(ar.append(&header, &[][..])); + + let bytes = t!(ar.into_inner()); + let mut ar = tar::Archive::new(&bytes[..]); + + t!(ar.unpack(td.path())); + t!(td.path().join("foo").metadata()); + t!(td.path().join("bar").metadata()); +} + +#[test] +fn relative_hardlink() { + let mut ar = tar::Builder::new(Vec::new()); + + let mut header = tar::Header::new_gnu(); + header.set_size(0); + header.set_entry_type(tar::EntryType::Regular); + t!(header.set_path("foo")); + header.set_cksum(); + t!(ar.append(&header, &[][..])); + + let mut header = tar::Header::new_gnu(); + header.set_size(0); + header.set_entry_type(tar::EntryType::Link); + t!(header.set_path("bar")); + t!(header.set_link_name("foo")); + header.set_cksum(); + t!(ar.append(&header, &[][..])); + + let bytes = t!(ar.into_inner()); + let mut ar = tar::Archive::new(&bytes[..]); + + let td = t!(TempDir::new("tar")); + t!(ar.unpack(td.path())); + t!(td.path().join("foo").metadata()); + t!(td.path().join("bar").metadata()); } #[test] @@ -159,6 +220,7 @@ fn parent_paths_error() { #[test] #[cfg(unix)] fn good_parent_paths_ok() { + use std::path::PathBuf; let mut ar = tar::Builder::new(Vec::new()); let mut header = tar::Header::new_gnu(); diff --git a/src/vendor/tar/tests/header/mod.rs b/src/vendor/tar/tests/header/mod.rs index 7ad255959c..b0a7a4bd74 100644 --- a/src/vendor/tar/tests/header/mod.rs +++ b/src/vendor/tar/tests/header/mod.rs @@ -1,11 +1,11 @@ use std::fs::{self, File}; use std::io::{self, Write}; use std::path::Path; -use std::{iter, thread, time}; +use std::{iter, mem, thread, time}; use tempdir::TempDir; -use tar::{Header, HeaderMode}; +use tar::{Header, HeaderMode, GnuHeader}; #[test] fn default_gnu() { @@ -59,6 +59,18 @@ fn link_name() { assert!(h.set_link_name("\0").is_err()); } +#[test] +fn mtime() { + let h = Header::new_gnu(); + assert_eq!(t!(h.mtime()), 0); + + let h = Header::new_ustar(); + assert_eq!(t!(h.mtime()), 0); + + let h = Header::new_old(); + assert_eq!(t!(h.mtime()), 0); +} + #[test] fn user_and_group_name() { let mut h = Header::new_gnu(); @@ -94,8 +106,8 @@ fn dev_major_minor() { assert_eq!(t!(h.device_major()), Some(1)); assert_eq!(t!(h.device_minor()), Some(2)); - h.as_ustar_mut().unwrap().dev_minor[0] = 0xff; - h.as_ustar_mut().unwrap().dev_major[0] = 0xff; + h.as_ustar_mut().unwrap().dev_minor[0] = 0x7f; + h.as_ustar_mut().unwrap().dev_major[0] = 0x7f; assert!(h.device_major().is_err()); assert!(h.device_minor().is_err()); @@ -187,3 +199,15 @@ fn set_metadata_deterministic() { assert_eq!(t!(one.uid()), t!(two.uid())); assert_eq!(t!(one.gid()), t!(two.gid())); } + +#[test] +fn extended_numeric_format() { + let mut h: GnuHeader = unsafe { mem::zeroed() }; + h.size = [0x80, 0, 0, 0, 0, 0, 0, 0x02, 0, 0, 0, 0]; + assert_eq!(h.as_header().entry_size().unwrap(), 0x0200000000); + // TODO uids can be up to 63 bits technically + h.uid = [0x80, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x78]; + assert_eq!(h.as_header().uid().unwrap(), 0x12345678); + h.mtime = [0x80, 0, 0, 0, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]; + assert_eq!(h.as_header().mtime().unwrap(), 0x0123456789abcdef); +} diff --git a/src/vendor/tendril/.cargo-checksum.json b/src/vendor/tendril/.cargo-checksum.json index c64589ce6f..dd616e278c 100644 --- a/src/vendor/tendril/.cargo-checksum.json +++ b/src/vendor/tendril/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"5250d665561f514c8539353e89c769eb4be067af3605a0bfa4918fa2609ba9d0","Cargo.toml":"5c21dd81051089b9b9b29ecbb375078046d135b23304cd98aed07b36fb9be629","Cargo.toml.orig":"159b547e14fc0e0335035488d4939d0c2cb4903cb0b2fcb1f247a49e7b0e751a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"60a7062291b01ba068f300612cdbdc20382ac1d4934f07bcdd7167c15299f309","README.md":"1e1d2637383ad85ff454f584be89a200ebc6c00be9da946a4c5fc0c7a083e4f6","examples/fuzz.rs":"e2b557a7f616746dde96dfe51d29cbf868aef9900ef7e87c40d90079adc1e4ee","src/bench.rs":"be63cc3a6c99390284d85deda450dc5d3a5c0d535aa46b95da1a15af5e501c7d","src/buf32.rs":"7950bb5fac1c9f7fe2216e6bd9017fc015076acf21a91af3c7ddfdfbc429f501","src/fmt.rs":"6c208a7b9be5d8a620cf0f4293e0029e6d2bc4e31e25bc36d9698b4a8e35fe75","src/lib.rs":"16f3fc9191fee73067e063f0cb4701abea2d4fca7551f306d18f5126b70eb090","src/stream.rs":"4c156c6af7d77ec1729088da84ca6668efe517992299ce6398434672421df54a","src/tendril.rs":"24a6f1705c9aed7194c9cceecaf00df65e64689bdbba9e9a91a16aac679f8642","src/utf8_decode.rs":"c70d0463ebdbc2175439dccc0dc943f0554d2d4d756d310af0bf42e5ad8866f2","src/util.rs":"7f533bb4ee98547358ecb1276b47bbd9e9f9053eafae85b911ec92c4ed188cdd"},"package":"8c1b72f8e2f5b73b65c315b1a70c730f24b9d7a25f39e98de8acbe2bb795caea"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"c1d2ef4638e211c017970afe439749c752e4b7ccf178181b54b03f2bd3b85445","Cargo.toml":"b586f8e7a95083f25e1dc724694a03edba28c45d92b3b8d15711cdeb2b7e6f97","Cargo.toml.orig":"a2e1e554f27b886d3205481c58bc8111b84ef32aa19be8f3953887e2ceea0aae","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"60a7062291b01ba068f300612cdbdc20382ac1d4934f07bcdd7167c15299f309","README.md":"1e1d2637383ad85ff454f584be89a200ebc6c00be9da946a4c5fc0c7a083e4f6","examples/fuzz.rs":"85771f8d710e2d604b8ef02ca89fffc798285b84dcd0d3fac212bf657738ce88","src/bench.rs":"be63cc3a6c99390284d85deda450dc5d3a5c0d535aa46b95da1a15af5e501c7d","src/buf32.rs":"26b1524f69156a764f0f15995a968b130b1371c538070f7ceaa67e9852b6c179","src/fmt.rs":"6c208a7b9be5d8a620cf0f4293e0029e6d2bc4e31e25bc36d9698b4a8e35fe75","src/lib.rs":"3605a8d6e33144389831d9d31659425d2aa891028e9d5ce6578370e40f18de64","src/stream.rs":"4c156c6af7d77ec1729088da84ca6668efe517992299ce6398434672421df54a","src/tendril.rs":"3988fbc194bfd30b13cf8a7de829a443517e43c1b4fc9339b7197a979b903905","src/utf8_decode.rs":"c70d0463ebdbc2175439dccc0dc943f0554d2d4d756d310af0bf42e5ad8866f2","src/util.rs":"7f533bb4ee98547358ecb1276b47bbd9e9f9053eafae85b911ec92c4ed188cdd"},"package":"9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508"} \ No newline at end of file diff --git a/src/vendor/tendril/.travis.yml b/src/vendor/tendril/.travis.yml index 643ba7bdde..c2335e6443 100644 --- a/src/vendor/tendril/.travis.yml +++ b/src/vendor/tendril/.travis.yml @@ -7,7 +7,7 @@ script: - cargo build - cargo doc - cargo test - - "if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo test --features unstable; fi" + - "if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo test --features bench; fi" - "if [ $TRAVIS_RUST_VERSION = nightly ]; then (cd capi/ctest; ./build-and-test.sh); fi" notifications: webhooks: http://build.servo.org:54856/travis diff --git a/src/vendor/tendril/Cargo.toml b/src/vendor/tendril/Cargo.toml index 9fabd7f84b..a99a08a5c0 100644 --- a/src/vendor/tendril/Cargo.toml +++ b/src/vendor/tendril/Cargo.toml @@ -12,26 +12,26 @@ [package] name = "tendril" -version = "0.3.1" +version = "0.4.0" authors = ["Keegan McAllister ", "Simon Sapin ", "Chris Morgan "] description = "Compact buffer/string type for zero-copy parsing" readme = "README.md" license = "MIT/Apache-2.0" repository = "https://github.com/servo/tendril" -[dependencies.mac] -version = "0.1" - [dependencies.encoding] version = "0.2" optional = true -[dependencies.utf-8] -version = "0.7" - [dependencies.futf] version = "0.1.1" + +[dependencies.mac] +version = "0.1" + +[dependencies.utf-8] +version = "0.7" [dev-dependencies.rand] version = "0" [features] -unstable = [] +bench = [] diff --git a/src/vendor/tendril/Cargo.toml.orig b/src/vendor/tendril/Cargo.toml.orig index de7c8873f4..8171c48442 100644 --- a/src/vendor/tendril/Cargo.toml.orig +++ b/src/vendor/tendril/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "tendril" -version = "0.3.1" +version = "0.4.0" authors = ["Keegan McAllister ", "Simon Sapin ", "Chris Morgan "] @@ -19,4 +19,4 @@ utf-8 = "0.7" rand = "0" [features] -unstable = [] +bench = [] diff --git a/src/vendor/tendril/examples/fuzz.rs b/src/vendor/tendril/examples/fuzz.rs index 9c978e9ed3..6d77f6792f 100644 --- a/src/vendor/tendril/examples/fuzz.rs +++ b/src/vendor/tendril/examples/fuzz.rs @@ -105,7 +105,7 @@ fn fuzz() { fn random_boundary(rng: &mut R, text: &str) -> usize { loop { let i = Range::new(0, text.len()+1).ind_sample(rng); - if is_char_boundary(text, i) { + if text.is_char_boundary(i) { return i; } } @@ -115,25 +115,16 @@ fn random_slice(rng: &mut R, text: &str) -> (usize, usize) { loop { let start = Range::new(0, text.len()+1).ind_sample(rng); let end = Range::new(start, text.len()+1).ind_sample(rng); - if !is_char_boundary(text, start) { + if !text.is_char_boundary(start) { continue; } - if end < text.len() && !is_char_boundary(text, end) { + if end < text.len() && !text.is_char_boundary(end) { continue; } return (start, end); } } -// Copy of the str::is_char_boundary method, which is unstable. -fn is_char_boundary(s: &str, index: usize) -> bool { - if index == s.len() { return true; } - match s.as_bytes().get(index) { - None => false, - Some(&b) => b < 128 || b >= 192, - } -} - static TEXT: &'static str = "It was from the artists and poets that the pertinent answers came, and I \ know that panic would have broken loose had they been able to compare notes. \ diff --git a/src/vendor/tendril/src/buf32.rs b/src/vendor/tendril/src/buf32.rs index 9fe7316eb3..3b1f91173c 100644 --- a/src/vendor/tendril/src/buf32.rs +++ b/src/vendor/tendril/src/buf32.rs @@ -16,7 +16,6 @@ pub const MAX_LEN: usize = u32::MAX as usize; /// A buffer points to a header of type `H`, which is followed by `MIN_CAP` or more /// bytes of storage. -#[repr(packed)] pub struct Buf32 { pub ptr: *mut H, pub len: u32, diff --git a/src/vendor/tendril/src/lib.rs b/src/vendor/tendril/src/lib.rs index 8ca3420657..23b8218dab 100644 --- a/src/vendor/tendril/src/lib.rs +++ b/src/vendor/tendril/src/lib.rs @@ -4,17 +4,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![cfg_attr(all(test, feature = "unstable"), feature(test))] +#![cfg_attr(all(test, feature = "bench"), feature(test))] #![cfg_attr(test, deny(warnings))] +#[cfg(all(test, feature = "bench"))] extern crate test; #[cfg(feature = "encoding")] pub extern crate encoding; #[macro_use] extern crate mac; extern crate futf; extern crate utf8; -#[cfg(all(test, feature = "unstable"))] -extern crate test; - pub use tendril::{Tendril, ByteTendril, StrTendril, SliceExt, ReadExt, SubtendrilError}; pub use tendril::{SendTendril, Atomicity, Atomic, NonAtomic}; pub use fmt::Format; diff --git a/src/vendor/tendril/src/tendril.rs b/src/vendor/tendril/src/tendril.rs index 171a1eda30..19c528c8d6 100644 --- a/src/vendor/tendril/src/tendril.rs +++ b/src/vendor/tendril/src/tendril.rs @@ -47,7 +47,7 @@ fn inline_tag(len: u32) -> NonZeroUsize { /// /// Exactly two types implement this trait: /// -/// - `Atomic`: use this in your tendril and you will have a `Send + Sync` tendril which works +/// - `Atomic`: use this in your tendril and you will have a `Send` tendril which works /// across threads; this is akin to `Arc`. /// /// - `NonAtomic`: use this in your tendril and you will have a tendril which is neither @@ -104,8 +104,8 @@ unsafe impl Atomicity for NonAtomic { /// A marker of an atomic (and hence concurrent) tendril. /// -/// This is used as the second, optional type parameter of a `Tendril`; `Tendril` thus -/// implements both `Send` and `Sync`. +/// This is used as the second, optional type parameter of a `Tendril`; +/// `Tendril` thus implements`Send`. /// /// This is akin to using `Arc` for reference counting. pub struct Atomic(AtomicUsize); @@ -182,11 +182,11 @@ pub enum SubtendrilError { /// /// The type parameter `A` indicates the atomicity of the tendril; it is by /// default `NonAtomic`, but can be specified as `Atomic` to get a tendril -/// which implements `Send` and `Sync` (viz. a thread-safe tendril). +/// which implements `Send` (viz. a thread-safe tendril). /// /// The maximum length of a `Tendril` is 4 GB. The library will panic if /// you attempt to go over the limit. -#[repr(packed)] +#[repr(C)] pub struct Tendril where F: fmt::Format, A: Atomicity, @@ -199,7 +199,6 @@ pub struct Tendril } unsafe impl Send for Tendril where F: fmt::Format, A: Atomicity + Sync { } -unsafe impl Sync for Tendril where F: fmt::Format, A: Atomicity + Sync { } /// `Tendril` for storing native Rust strings. pub type StrTendril = Tendril; @@ -1548,7 +1547,7 @@ impl<'a, A> From<&'a Tendril> for String } -#[cfg(all(test, feature = "unstable"))] +#[cfg(all(test, feature = "bench"))] #[path="bench.rs"] mod bench; @@ -1561,7 +1560,6 @@ mod test { use std::thread; fn assert_send() { } - fn assert_sync() { } #[test] fn smoke_test() { @@ -2208,7 +2206,6 @@ mod test { #[test] fn atomic() { assert_send::>(); - assert_sync::>(); let s: Tendril = Tendril::from_slice("this is a string"); assert!(!s.is_shared()); let mut t = s.clone(); diff --git a/src/vendor/thread_local/.cargo-checksum.json b/src/vendor/thread_local/.cargo-checksum.json index 499ca05e94..70cd105641 100644 --- a/src/vendor/thread_local/.cargo-checksum.json +++ b/src/vendor/thread_local/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"c01fcdfc31a1092bfdbdd22a0d88773bdc280550b806ab2ebe23ac4b32d4a5c2","Cargo.toml":"cc42ea81b9749fdd354f433e91f845f656841e904b986ad08c30bf419a26c6d7","Cargo.toml.orig":"e19900ba56c5619c35112a35b54f76452dd9dc8c12ba5639570541e9ddd7626e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"00a29378d5aeb66b7a48b77bee0d463c8b408b8a9cb0abb7674edb10d142aca0","benches/thread_local.rs":"cc8bde81ed6206525feff209598caf1e01e89a83bf21d8b7ccc0dadc8b89d815","src/lib.rs":"e5902751bf1768fb756b88146da66a128920d3f1b166b797fd0a5e1528f2e687","src/thread_id.rs":"0962c130061939557aa272115e4420fbbc63b6bd306783a456a8ffcbf304a447"},"package":"1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"c01fcdfc31a1092bfdbdd22a0d88773bdc280550b806ab2ebe23ac4b32d4a5c2","Cargo.toml":"a1b604dfa7a867267df097ac672afcceff2531c75e15982b7a3ecb3bf1604900","Cargo.toml.orig":"2b2cadccea1f706265042111dcf4969699af1ec8ea9d8d7c1f0a83469825614a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"00a29378d5aeb66b7a48b77bee0d463c8b408b8a9cb0abb7674edb10d142aca0","benches/thread_local.rs":"cc8bde81ed6206525feff209598caf1e01e89a83bf21d8b7ccc0dadc8b89d815","src/lib.rs":"e5902751bf1768fb756b88146da66a128920d3f1b166b797fd0a5e1528f2e687","src/thread_id.rs":"0962c130061939557aa272115e4420fbbc63b6bd306783a456a8ffcbf304a447"},"package":"279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"} \ No newline at end of file diff --git a/src/vendor/thread_local/Cargo.toml b/src/vendor/thread_local/Cargo.toml index f55e08badb..012719f943 100644 --- a/src/vendor/thread_local/Cargo.toml +++ b/src/vendor/thread_local/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "thread_local" -version = "0.3.4" +version = "0.3.5" authors = ["Amanieu d'Antras "] description = "Per-object thread-local storage" documentation = "https://amanieu.github.io/thread_local-rs/thread_local/index.html" @@ -20,8 +20,10 @@ readme = "README.md" keywords = ["thread_local", "concurrent", "thread"] license = "Apache-2.0/MIT" repository = "https://github.com/Amanieu/thread_local-rs" -[dependencies.unreachable] +[dependencies.lazy_static] version = "1.0" -[dependencies.lazy_static] -version = "0.2" +[dependencies.unreachable] +version = "1.0" +[badges.travis-ci] +repository = "Amanieu/thread_local-rs" diff --git a/src/vendor/thread_local/Cargo.toml.orig b/src/vendor/thread_local/Cargo.toml.orig index 8286cf1445..2a419044ea 100644 --- a/src/vendor/thread_local/Cargo.toml.orig +++ b/src/vendor/thread_local/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "thread_local" -version = "0.3.4" +version = "0.3.5" authors = ["Amanieu d'Antras "] description = "Per-object thread-local storage" documentation = "https://amanieu.github.io/thread_local-rs/thread_local/index.html" @@ -9,6 +9,9 @@ repository = "https://github.com/Amanieu/thread_local-rs" readme = "README.md" keywords = ["thread_local", "concurrent", "thread"] +[badges] +travis-ci = { repository = "Amanieu/thread_local-rs" } + [dependencies] unreachable = "1.0" -lazy_static = "0.2" +lazy_static = "1.0" diff --git a/src/vendor/time/.cargo-checksum.json b/src/vendor/time/.cargo-checksum.json new file mode 100644 index 0000000000..6f0c530b85 --- /dev/null +++ b/src/vendor/time/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"c1e953ee360e77de57f7b02f1b7880bd6a3dc22d1a69e953c2ac2c52cc52d247",".travis.yml":"f820708f76fe75456b05c99b9ee4e9e720e0dd6189da11f3df3d8094111fdf31","Cargo.toml":"3ab4502fee81692be228e864b7a85360e0d8f627ada9404f5e9622fafcf57895","Cargo.toml.orig":"5f356118b24ecfb4e0537bbc1199a40fef26948c25c2456ed7d29dd13a02f3c7","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"2c17f942c4a797f6f491c6d40570f904f35047531884ded3244438832b3d6f0a","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","benches/precise_time_ns.rs":"f331c85489a05ea3bb83df9d57131a6e651ce852ca881417f328c4e8f53503c6","src/display.rs":"b79a81b4f068e44934ad3398ba0259120cc30cf0855ac5108c4569e320fd7f1d","src/duration.rs":"c227f6809f837996d24145843ba4972650d0fca7e2af7bbb0ebc0dbcec3358d9","src/lib.rs":"76c6e34e867862bce527568459f1ad11a8b7183e29e46aad877d90542401ef19","src/parse.rs":"717ae5735dfdaaba513f2a54a179e73bb2a48f8d4fb8787740d4662d6ff3389c","src/sys.rs":"c3b3b8ce8176bbd503882d39b9edfe594196d2e31202e608eb417bffd32338e1"},"package":"a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098"} \ No newline at end of file diff --git a/src/vendor/time/.cargo-ok b/src/vendor/time/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/time/.gitignore b/src/vendor/time/.gitignore new file mode 100644 index 0000000000..4fffb2f89c --- /dev/null +++ b/src/vendor/time/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/src/vendor/time/.travis.yml b/src/vendor/time/.travis.yml new file mode 100644 index 0000000000..536099fe65 --- /dev/null +++ b/src/vendor/time/.travis.yml @@ -0,0 +1,31 @@ +language: rust +sudo: false + +matrix: + include: + - rust: 1.21.0 + - rust: stable + - os: osx + - rust: beta + - rust: nightly + + - rust: nightly + before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH + script: + - cargo doc --no-deps --all-features + after_success: + - travis-cargo --only nightly doc-upload + +script: + - cargo build + - cargo test + - cargo test --features rustc-serialize + +env: + global: + secure: "NlXnNaUBf2MgV2gPJyIQU+JM814e29itvvb8o5BvN4YB60rseu16yLbzKpO4FzuOFBc/Uc+1veDcKyzZYsdV6FIwQk4jfdUkNZ3i56InVCzXcaaHCe78cpg/IxK+/48fGy/EIJkWYdtQsoVCGunaf5NdF360Lzb6G/B1vheC34E=" + +notifications: + email: + on_success: never diff --git a/src/vendor/time/Cargo.toml b/src/vendor/time/Cargo.toml new file mode 100644 index 0000000000..7874f22e1e --- /dev/null +++ b/src/vendor/time/Cargo.toml @@ -0,0 +1,43 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "time" +version = "0.1.39" +authors = ["The Rust Project Developers"] +description = "Utilities for working with time-related functions in Rust.\n" +homepage = "https://github.com/rust-lang/time" +documentation = "https://doc.rust-lang.org/time" +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-lang/time" +[dependencies.libc] +version = "0.2.1" + +[dependencies.rustc-serialize] +version = "0.3" +optional = true +[dev-dependencies.log] +version = "0.3" + +[dev-dependencies.winapi] +version = "0.3.0" +features = ["std", "processthreadsapi", "winbase"] +[target."cfg(target_os = \"redox\")".dependencies.redox_syscall] +version = "0.1" +[target."cfg(windows)".dependencies.winapi] +version = "0.3.0" +features = ["std", "minwinbase", "minwindef", "ntdef", "profileapi", "sysinfoapi", "timezoneapi"] +[badges.appveyor] +repository = "alexcrichton/time" + +[badges.travis-ci] +repository = "rust-lang-deprecated/time" diff --git a/src/vendor/time/Cargo.toml.orig b/src/vendor/time/Cargo.toml.orig new file mode 100644 index 0000000000..4f0d7f3502 --- /dev/null +++ b/src/vendor/time/Cargo.toml.orig @@ -0,0 +1,30 @@ +[package] + +name = "time" +version = "0.1.39" +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +homepage = "https://github.com/rust-lang/time" +repository = "https://github.com/rust-lang/time" +documentation = "https://doc.rust-lang.org/time" +description = """ +Utilities for working with time-related functions in Rust. +""" + +[badges] +travis-ci = { repository = "rust-lang-deprecated/time" } +appveyor = { repository = "alexcrichton/time" } + +[dependencies] +libc = "0.2.1" +rustc-serialize = { version = "0.3", optional = true } + +[target.'cfg(target_os = "redox")'.dependencies] +redox_syscall = "0.1" + +[target.'cfg(windows)'.dependencies] +winapi = { version = "0.3.0", features = ["std", "minwinbase", "minwindef", "ntdef", "profileapi", "sysinfoapi", "timezoneapi"] } + +[dev-dependencies] +log = "0.3" +winapi = { version = "0.3.0", features = ["std", "processthreadsapi", "winbase"] } diff --git a/src/vendor/time/LICENSE-APACHE b/src/vendor/time/LICENSE-APACHE new file mode 100644 index 0000000000..16fe87b06e --- /dev/null +++ b/src/vendor/time/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/src/vendor/time/LICENSE-MIT b/src/vendor/time/LICENSE-MIT new file mode 100644 index 0000000000..39d4bdb5ac --- /dev/null +++ b/src/vendor/time/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/src/vendor/time/README.md b/src/vendor/time/README.md new file mode 100644 index 0000000000..9762f5ed8a --- /dev/null +++ b/src/vendor/time/README.md @@ -0,0 +1,30 @@ +time +==== + +Utilities for working with time-related functions in Rust + +[![Build Status](https://travis-ci.org/rust-lang-deprecated/time.svg?branch=master)](https://travis-ci.org/rust-lang-deprecated/time) +[![Build status](https://ci.appveyor.com/api/projects/status/55m7rbaj9a5v3ad7?svg=true)](https://ci.appveyor.com/project/alexcrichton/time) + +[Documentation](https://doc.rust-lang.org/time) + +## Notes + +This library is no longer actively maintained, but bugfixes will be added ([details](https://github.com/rust-lang-deprecated/time/issues/136)). + +In case you're looking for something a little fresher and more actively maintained have a look at the [`chrono`](https://github.com/lifthrasiir/rust-chrono) crate. + +## Usage + +Put this in your `Cargo.toml`: + +```toml +[dependencies] +time = "0.1" +``` + +And this in your crate root: + +```rust +extern crate time; +``` diff --git a/src/vendor/time/appveyor.yml b/src/vendor/time/appveyor.yml new file mode 100644 index 0000000000..6a1b8dc19c --- /dev/null +++ b/src/vendor/time/appveyor.yml @@ -0,0 +1,17 @@ +environment: + matrix: + - TARGET: x86_64-pc-windows-msvc + - TARGET: i686-pc-windows-msvc + - TARGET: i686-pc-windows-gnu +install: + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" + - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" + - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin + - SET PATH=%PATH%;C:\MinGW\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo test --verbose diff --git a/src/vendor/time/benches/precise_time_ns.rs b/src/vendor/time/benches/precise_time_ns.rs new file mode 100644 index 0000000000..d9170ea26b --- /dev/null +++ b/src/vendor/time/benches/precise_time_ns.rs @@ -0,0 +1,11 @@ +#![feature(test)] + +extern crate test; +extern crate time; + +use test::Bencher; + +#[bench] +fn bench_precise_time_ns(b: &mut Bencher) { + b.iter(|| time::precise_time_ns()) +} diff --git a/src/vendor/time/src/display.rs b/src/vendor/time/src/display.rs new file mode 100644 index 0000000000..27372d22e7 --- /dev/null +++ b/src/vendor/time/src/display.rs @@ -0,0 +1,260 @@ +use std::fmt::{self, Write}; + +use super::{TmFmt, Tm, Fmt}; + +impl<'a> fmt::Display for TmFmt<'a> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + match self.format { + Fmt::Str(ref s) => { + let mut chars = s.chars(); + while let Some(ch) = chars.next() { + if ch == '%' { + // we've already validated that % always precedes + // another char + try!(parse_type(fmt, chars.next().unwrap(), self.tm)); + } else { + try!(fmt.write_char(ch)); + } + } + + Ok(()) + } + Fmt::Ctime => self.tm.to_local().asctime().fmt(fmt), + Fmt::Rfc3339 => { + if self.tm.tm_utcoff == 0 { + TmFmt { + tm: self.tm, + format: Fmt::Str("%Y-%m-%dT%H:%M:%SZ"), + }.fmt(fmt) + } else { + let s = TmFmt { + tm: self.tm, + format: Fmt::Str("%Y-%m-%dT%H:%M:%S"), + }; + let sign = if self.tm.tm_utcoff > 0 { '+' } else { '-' }; + let mut m = abs(self.tm.tm_utcoff) / 60; + let h = m / 60; + m -= h * 60; + write!(fmt, "{}{}{:02}:{:02}", s, sign, h, m) + } + } + } + } +} + +fn is_leap_year(year: i32) -> bool { + (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)) +} + +fn days_in_year(year: i32) -> i32 { + if is_leap_year(year) { 366 } + else { 365 } +} + +fn iso_week_days(yday: i32, wday: i32) -> i32 { + /* The number of days from the first day of the first ISO week of this + * year to the year day YDAY with week day WDAY. + * ISO weeks start on Monday. The first ISO week has the year's first + * Thursday. + * YDAY may be as small as yday_minimum. + */ + let iso_week_start_wday: i32 = 1; /* Monday */ + let iso_week1_wday: i32 = 4; /* Thursday */ + let yday_minimum: i32 = 366; + /* Add enough to the first operand of % to make it nonnegative. */ + let big_enough_multiple_of_7: i32 = (yday_minimum / 7 + 2) * 7; + + yday - (yday - wday + iso_week1_wday + big_enough_multiple_of_7) % 7 + + iso_week1_wday - iso_week_start_wday +} + +fn iso_week(fmt: &mut fmt::Formatter, ch:char, tm: &Tm) -> fmt::Result { + let mut year = tm.tm_year + 1900; + let mut days = iso_week_days(tm.tm_yday, tm.tm_wday); + + if days < 0 { + /* This ISO week belongs to the previous year. */ + year -= 1; + days = iso_week_days(tm.tm_yday + (days_in_year(year)), tm.tm_wday); + } else { + let d = iso_week_days(tm.tm_yday - (days_in_year(year)), + tm.tm_wday); + if 0 <= d { + /* This ISO week belongs to the next year. */ + year += 1; + days = d; + } + } + + match ch { + 'G' => write!(fmt, "{}", year), + 'g' => write!(fmt, "{:02}", (year % 100 + 100) % 100), + 'V' => write!(fmt, "{:02}", days / 7 + 1), + _ => Ok(()) + } +} + +fn parse_type(fmt: &mut fmt::Formatter, ch: char, tm: &Tm) -> fmt::Result { + match ch { + 'A' => fmt.write_str(match tm.tm_wday { + 0 => "Sunday", + 1 => "Monday", + 2 => "Tuesday", + 3 => "Wednesday", + 4 => "Thursday", + 5 => "Friday", + 6 => "Saturday", + _ => unreachable!(), + }), + 'a' => fmt.write_str(match tm.tm_wday { + 0 => "Sun", + 1 => "Mon", + 2 => "Tue", + 3 => "Wed", + 4 => "Thu", + 5 => "Fri", + 6 => "Sat", + _ => unreachable!(), + }), + 'B' => fmt.write_str(match tm.tm_mon { + 0 => "January", + 1 => "February", + 2 => "March", + 3 => "April", + 4 => "May", + 5 => "June", + 6 => "July", + 7 => "August", + 8 => "September", + 9 => "October", + 10 => "November", + 11 => "December", + _ => unreachable!(), + }), + 'b' | 'h' => fmt.write_str(match tm.tm_mon { + 0 => "Jan", + 1 => "Feb", + 2 => "Mar", + 3 => "Apr", + 4 => "May", + 5 => "Jun", + 6 => "Jul", + 7 => "Aug", + 8 => "Sep", + 9 => "Oct", + 10 => "Nov", + 11 => "Dec", + _ => unreachable!(), + }), + 'C' => write!(fmt, "{:02}", (tm.tm_year + 1900) / 100), + 'c' => { + try!(parse_type(fmt, 'a', tm)); + try!(fmt.write_str(" ")); + try!(parse_type(fmt, 'b', tm)); + try!(fmt.write_str(" ")); + try!(parse_type(fmt, 'e', tm)); + try!(fmt.write_str(" ")); + try!(parse_type(fmt, 'T', tm)); + try!(fmt.write_str(" ")); + parse_type(fmt, 'Y', tm) + } + 'D' | 'x' => { + try!(parse_type(fmt, 'm', tm)); + try!(fmt.write_str("/")); + try!(parse_type(fmt, 'd', tm)); + try!(fmt.write_str("/")); + parse_type(fmt, 'y', tm) + } + 'd' => write!(fmt, "{:02}", tm.tm_mday), + 'e' => write!(fmt, "{:2}", tm.tm_mday), + 'f' => write!(fmt, "{:09}", tm.tm_nsec), + 'F' => { + try!(parse_type(fmt, 'Y', tm)); + try!(fmt.write_str("-")); + try!(parse_type(fmt, 'm', tm)); + try!(fmt.write_str("-")); + parse_type(fmt, 'd', tm) + } + 'G' => iso_week(fmt, 'G', tm), + 'g' => iso_week(fmt, 'g', tm), + 'H' => write!(fmt, "{:02}", tm.tm_hour), + 'I' => { + let mut h = tm.tm_hour; + if h == 0 { h = 12 } + if h > 12 { h -= 12 } + write!(fmt, "{:02}", h) + } + 'j' => write!(fmt, "{:03}", tm.tm_yday + 1), + 'k' => write!(fmt, "{:2}", tm.tm_hour), + 'l' => { + let mut h = tm.tm_hour; + if h == 0 { h = 12 } + if h > 12 { h -= 12 } + write!(fmt, "{:2}", h) + } + 'M' => write!(fmt, "{:02}", tm.tm_min), + 'm' => write!(fmt, "{:02}", tm.tm_mon + 1), + 'n' => fmt.write_str("\n"), + 'P' => fmt.write_str(if tm.tm_hour < 12 { "am" } else { "pm" }), + 'p' => fmt.write_str(if (tm.tm_hour) < 12 { "AM" } else { "PM" }), + 'R' => { + try!(parse_type(fmt, 'H', tm)); + try!(fmt.write_str(":")); + parse_type(fmt, 'M', tm) + } + 'r' => { + try!(parse_type(fmt, 'I', tm)); + try!(fmt.write_str(":")); + try!(parse_type(fmt, 'M', tm)); + try!(fmt.write_str(":")); + try!(parse_type(fmt, 'S', tm)); + try!(fmt.write_str(" ")); + parse_type(fmt, 'p', tm) + } + 'S' => write!(fmt, "{:02}", tm.tm_sec), + 's' => write!(fmt, "{}", tm.to_timespec().sec), + 'T' | 'X' => { + try!(parse_type(fmt, 'H', tm)); + try!(fmt.write_str(":")); + try!(parse_type(fmt, 'M', tm)); + try!(fmt.write_str(":")); + parse_type(fmt, 'S', tm) + } + 't' => fmt.write_str("\t"), + 'U' => write!(fmt, "{:02}", (tm.tm_yday - tm.tm_wday + 7) / 7), + 'u' => { + let i = tm.tm_wday; + write!(fmt, "{}", (if i == 0 { 7 } else { i })) + } + 'V' => iso_week(fmt, 'V', tm), + 'v' => { + try!(parse_type(fmt, 'e', tm)); + try!(fmt.write_str("-")); + try!(parse_type(fmt, 'b', tm)); + try!(fmt.write_str("-")); + parse_type(fmt, 'Y', tm) + } + 'W' => { + write!(fmt, "{:02}", (tm.tm_yday - (tm.tm_wday - 1 + 7) % 7 + 7) / 7) + } + 'w' => write!(fmt, "{}", tm.tm_wday), + 'Y' => write!(fmt, "{}", tm.tm_year + 1900), + 'y' => write!(fmt, "{:02}", (tm.tm_year + 1900) % 100), + // FIXME (#2350): support locale + 'Z' => fmt.write_str(if tm.tm_utcoff == 0 { "UTC"} else { "" }), + 'z' => { + let sign = if tm.tm_utcoff > 0 { '+' } else { '-' }; + let mut m = abs(tm.tm_utcoff) / 60; + let h = m / 60; + m -= h * 60; + write!(fmt, "{}{:02}{:02}", sign, h, m) + } + '+' => write!(fmt, "{}", tm.rfc3339()), + '%' => fmt.write_str("%"), + _ => unreachable!(), + } +} + +fn abs(i: i32) -> i32 { + if i < 0 {-i} else {i} +} diff --git a/src/vendor/time/src/duration.rs b/src/vendor/time/src/duration.rs new file mode 100644 index 0000000000..419af0fc7e --- /dev/null +++ b/src/vendor/time/src/duration.rs @@ -0,0 +1,648 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Temporal quantification + +use std::{fmt, i64}; +use std::error::Error; +use std::ops::{Add, Sub, Mul, Div, Neg, FnOnce}; +use std::time::Duration as StdDuration; + +/// The number of nanoseconds in a microsecond. +const NANOS_PER_MICRO: i32 = 1000; +/// The number of nanoseconds in a millisecond. +const NANOS_PER_MILLI: i32 = 1000_000; +/// The number of nanoseconds in seconds. +const NANOS_PER_SEC: i32 = 1_000_000_000; +/// The number of microseconds per second. +const MICROS_PER_SEC: i64 = 1000_000; +/// The number of milliseconds per second. +const MILLIS_PER_SEC: i64 = 1000; +/// The number of seconds in a minute. +const SECS_PER_MINUTE: i64 = 60; +/// The number of seconds in an hour. +const SECS_PER_HOUR: i64 = 3600; +/// The number of (non-leap) seconds in days. +const SECS_PER_DAY: i64 = 86400; +/// The number of (non-leap) seconds in a week. +const SECS_PER_WEEK: i64 = 604800; + +macro_rules! try_opt { + ($e:expr) => (match $e { Some(v) => v, None => return None }) +} + + +/// ISO 8601 time duration with nanosecond precision. +/// This also allows for the negative duration; see individual methods for details. +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] +pub struct Duration { + secs: i64, + nanos: i32, // Always 0 <= nanos < NANOS_PER_SEC +} + +/// The minimum possible `Duration`: `i64::MIN` milliseconds. +pub const MIN: Duration = Duration { + secs: i64::MIN / MILLIS_PER_SEC - 1, + nanos: NANOS_PER_SEC + (i64::MIN % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI +}; + +/// The maximum possible `Duration`: `i64::MAX` milliseconds. +pub const MAX: Duration = Duration { + secs: i64::MAX / MILLIS_PER_SEC, + nanos: (i64::MAX % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI +}; + +impl Duration { + /// Makes a new `Duration` with given number of weeks. + /// Equivalent to `Duration::seconds(weeks * 7 * 24 * 60 * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn weeks(weeks: i64) -> Duration { + let secs = weeks.checked_mul(SECS_PER_WEEK).expect("Duration::weeks out of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of days. + /// Equivalent to `Duration::seconds(days * 24 * 60 * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn days(days: i64) -> Duration { + let secs = days.checked_mul(SECS_PER_DAY).expect("Duration::days out of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of hours. + /// Equivalent to `Duration::seconds(hours * 60 * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn hours(hours: i64) -> Duration { + let secs = hours.checked_mul(SECS_PER_HOUR).expect("Duration::hours ouf of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of minutes. + /// Equivalent to `Duration::seconds(minutes * 60)` with overflow checks. + /// Panics when the duration is out of bounds. + #[inline] + pub fn minutes(minutes: i64) -> Duration { + let secs = minutes.checked_mul(SECS_PER_MINUTE).expect("Duration::minutes out of bounds"); + Duration::seconds(secs) + } + + /// Makes a new `Duration` with given number of seconds. + /// Panics when the duration is more than `i64::MAX` milliseconds + /// or less than `i64::MIN` milliseconds. + #[inline] + pub fn seconds(seconds: i64) -> Duration { + let d = Duration { secs: seconds, nanos: 0 }; + if d < MIN || d > MAX { + panic!("Duration::seconds out of bounds"); + } + d + } + + /// Makes a new `Duration` with given number of milliseconds. + #[inline] + pub fn milliseconds(milliseconds: i64) -> Duration { + let (secs, millis) = div_mod_floor_64(milliseconds, MILLIS_PER_SEC); + let nanos = millis as i32 * NANOS_PER_MILLI; + Duration { secs: secs, nanos: nanos } + } + + /// Makes a new `Duration` with given number of microseconds. + #[inline] + pub fn microseconds(microseconds: i64) -> Duration { + let (secs, micros) = div_mod_floor_64(microseconds, MICROS_PER_SEC); + let nanos = micros as i32 * NANOS_PER_MICRO; + Duration { secs: secs, nanos: nanos } + } + + /// Makes a new `Duration` with given number of nanoseconds. + #[inline] + pub fn nanoseconds(nanos: i64) -> Duration { + let (secs, nanos) = div_mod_floor_64(nanos, NANOS_PER_SEC as i64); + Duration { secs: secs, nanos: nanos as i32 } + } + + /// Runs a closure, returning the duration of time it took to run the + /// closure. + pub fn span(f: F) -> Duration where F: FnOnce() { + let before = super::precise_time_ns(); + f(); + Duration::nanoseconds((super::precise_time_ns() - before) as i64) + } + + /// Returns the total number of whole weeks in the duration. + #[inline] + pub fn num_weeks(&self) -> i64 { + self.num_days() / 7 + } + + /// Returns the total number of whole days in the duration. + pub fn num_days(&self) -> i64 { + self.num_seconds() / SECS_PER_DAY + } + + /// Returns the total number of whole hours in the duration. + #[inline] + pub fn num_hours(&self) -> i64 { + self.num_seconds() / SECS_PER_HOUR + } + + /// Returns the total number of whole minutes in the duration. + #[inline] + pub fn num_minutes(&self) -> i64 { + self.num_seconds() / SECS_PER_MINUTE + } + + /// Returns the total number of whole seconds in the duration. + pub fn num_seconds(&self) -> i64 { + // If secs is negative, nanos should be subtracted from the duration. + if self.secs < 0 && self.nanos > 0 { + self.secs + 1 + } else { + self.secs + } + } + + /// Returns the number of nanoseconds such that + /// `nanos_mod_sec() + num_seconds() * NANOS_PER_SEC` is the total number of + /// nanoseconds in the duration. + fn nanos_mod_sec(&self) -> i32 { + if self.secs < 0 && self.nanos > 0 { + self.nanos - NANOS_PER_SEC + } else { + self.nanos + } + } + + /// Returns the total number of whole milliseconds in the duration, + pub fn num_milliseconds(&self) -> i64 { + // A proper Duration will not overflow, because MIN and MAX are defined + // such that the range is exactly i64 milliseconds. + let secs_part = self.num_seconds() * MILLIS_PER_SEC; + let nanos_part = self.nanos_mod_sec() / NANOS_PER_MILLI; + secs_part + nanos_part as i64 + } + + /// Returns the total number of whole microseconds in the duration, + /// or `None` on overflow (exceeding 263 microseconds in either direction). + pub fn num_microseconds(&self) -> Option { + let secs_part = try_opt!(self.num_seconds().checked_mul(MICROS_PER_SEC)); + let nanos_part = self.nanos_mod_sec() / NANOS_PER_MICRO; + secs_part.checked_add(nanos_part as i64) + } + + /// Returns the total number of whole nanoseconds in the duration, + /// or `None` on overflow (exceeding 263 nanoseconds in either direction). + pub fn num_nanoseconds(&self) -> Option { + let secs_part = try_opt!(self.num_seconds().checked_mul(NANOS_PER_SEC as i64)); + let nanos_part = self.nanos_mod_sec(); + secs_part.checked_add(nanos_part as i64) + } + + /// Add two durations, returning `None` if overflow occurred. + pub fn checked_add(&self, rhs: &Duration) -> Option { + let mut secs = try_opt!(self.secs.checked_add(rhs.secs)); + let mut nanos = self.nanos + rhs.nanos; + if nanos >= NANOS_PER_SEC { + nanos -= NANOS_PER_SEC; + secs = try_opt!(secs.checked_add(1)); + } + let d = Duration { secs: secs, nanos: nanos }; + // Even if d is within the bounds of i64 seconds, + // it might still overflow i64 milliseconds. + if d < MIN || d > MAX { None } else { Some(d) } + } + + /// Subtract two durations, returning `None` if overflow occurred. + pub fn checked_sub(&self, rhs: &Duration) -> Option { + let mut secs = try_opt!(self.secs.checked_sub(rhs.secs)); + let mut nanos = self.nanos - rhs.nanos; + if nanos < 0 { + nanos += NANOS_PER_SEC; + secs = try_opt!(secs.checked_sub(1)); + } + let d = Duration { secs: secs, nanos: nanos }; + // Even if d is within the bounds of i64 seconds, + // it might still overflow i64 milliseconds. + if d < MIN || d > MAX { None } else { Some(d) } + } + + /// The minimum possible `Duration`: `i64::MIN` milliseconds. + #[inline] + pub fn min_value() -> Duration { MIN } + + /// The maximum possible `Duration`: `i64::MAX` milliseconds. + #[inline] + pub fn max_value() -> Duration { MAX } + + /// A duration where the stored seconds and nanoseconds are equal to zero. + #[inline] + pub fn zero() -> Duration { + Duration { secs: 0, nanos: 0 } + } + + /// Returns `true` if the duration equals `Duration::zero()`. + #[inline] + pub fn is_zero(&self) -> bool { + self.secs == 0 && self.nanos == 0 + } + + /// Creates a `time::Duration` object from `std::time::Duration` + /// + /// This function errors when original duration is larger than the maximum + /// value supported for this type. + pub fn from_std(duration: StdDuration) -> Result { + // We need to check secs as u64 before coercing to i64 + if duration.as_secs() > MAX.secs as u64 { + return Err(OutOfRangeError(())); + } + let d = Duration { + secs: duration.as_secs() as i64, + nanos: duration.subsec_nanos() as i32, + }; + if d > MAX { + return Err(OutOfRangeError(())); + } + Ok(d) + } + + /// Creates a `std::time::Duration` object from `time::Duration` + /// + /// This function errors when duration is less than zero. As standard + /// library implementation is limited to non-negative values. + pub fn to_std(&self) -> Result { + if self.secs < 0 { + return Err(OutOfRangeError(())); + } + Ok(StdDuration::new(self.secs as u64, self.nanos as u32)) + } +} + +impl Neg for Duration { + type Output = Duration; + + #[inline] + fn neg(self) -> Duration { + if self.nanos == 0 { + Duration { secs: -self.secs, nanos: 0 } + } else { + Duration { secs: -self.secs - 1, nanos: NANOS_PER_SEC - self.nanos } + } + } +} + +impl Add for Duration { + type Output = Duration; + + fn add(self, rhs: Duration) -> Duration { + let mut secs = self.secs + rhs.secs; + let mut nanos = self.nanos + rhs.nanos; + if nanos >= NANOS_PER_SEC { + nanos -= NANOS_PER_SEC; + secs += 1; + } + Duration { secs: secs, nanos: nanos } + } +} + +impl Sub for Duration { + type Output = Duration; + + fn sub(self, rhs: Duration) -> Duration { + let mut secs = self.secs - rhs.secs; + let mut nanos = self.nanos - rhs.nanos; + if nanos < 0 { + nanos += NANOS_PER_SEC; + secs -= 1; + } + Duration { secs: secs, nanos: nanos } + } +} + +impl Mul for Duration { + type Output = Duration; + + fn mul(self, rhs: i32) -> Duration { + // Multiply nanoseconds as i64, because it cannot overflow that way. + let total_nanos = self.nanos as i64 * rhs as i64; + let (extra_secs, nanos) = div_mod_floor_64(total_nanos, NANOS_PER_SEC as i64); + let secs = self.secs * rhs as i64 + extra_secs; + Duration { secs: secs, nanos: nanos as i32 } + } +} + +impl Div for Duration { + type Output = Duration; + + fn div(self, rhs: i32) -> Duration { + let mut secs = self.secs / rhs as i64; + let carry = self.secs - secs * rhs as i64; + let extra_nanos = carry * NANOS_PER_SEC as i64 / rhs as i64; + let mut nanos = self.nanos / rhs + extra_nanos as i32; + if nanos >= NANOS_PER_SEC { + nanos -= NANOS_PER_SEC; + secs += 1; + } + if nanos < 0 { + nanos += NANOS_PER_SEC; + secs -= 1; + } + Duration { secs: secs, nanos: nanos } + } +} + +impl fmt::Display for Duration { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // technically speaking, negative duration is not valid ISO 8601, + // but we need to print it anyway. + let (abs, sign) = if self.secs < 0 { (-*self, "-") } else { (*self, "") }; + + let days = abs.secs / SECS_PER_DAY; + let secs = abs.secs - days * SECS_PER_DAY; + let hasdate = days != 0; + let hastime = (secs != 0 || abs.nanos != 0) || !hasdate; + + try!(write!(f, "{}P", sign)); + + if hasdate { + try!(write!(f, "{}D", days)); + } + if hastime { + if abs.nanos == 0 { + try!(write!(f, "T{}S", secs)); + } else if abs.nanos % NANOS_PER_MILLI == 0 { + try!(write!(f, "T{}.{:03}S", secs, abs.nanos / NANOS_PER_MILLI)); + } else if abs.nanos % NANOS_PER_MICRO == 0 { + try!(write!(f, "T{}.{:06}S", secs, abs.nanos / NANOS_PER_MICRO)); + } else { + try!(write!(f, "T{}.{:09}S", secs, abs.nanos)); + } + } + Ok(()) + } +} + +/// Represents error when converting `Duration` to/from a standard library +/// implementation +/// +/// The `std::time::Duration` supports a range from zero to `u64::MAX` +/// *seconds*, while this module supports signed range of up to +/// `i64::MAX` of *milliseconds*. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct OutOfRangeError(()); + +impl fmt::Display for OutOfRangeError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.description()) + } +} + +impl Error for OutOfRangeError { + fn description(&self) -> &str { + "Source duration value is out of range for the target type" + } +} + +// Copied from libnum +#[inline] +fn div_mod_floor_64(this: i64, other: i64) -> (i64, i64) { + (div_floor_64(this, other), mod_floor_64(this, other)) +} + +#[inline] +fn div_floor_64(this: i64, other: i64) -> i64 { + match div_rem_64(this, other) { + (d, r) if (r > 0 && other < 0) + || (r < 0 && other > 0) => d - 1, + (d, _) => d, + } +} + +#[inline] +fn mod_floor_64(this: i64, other: i64) -> i64 { + match this % other { + r if (r > 0 && other < 0) + || (r < 0 && other > 0) => r + other, + r => r, + } +} + +#[inline] +fn div_rem_64(this: i64, other: i64) -> (i64, i64) { + (this / other, this % other) +} + +#[cfg(test)] +mod tests { + use super::{Duration, MIN, MAX, OutOfRangeError}; + use std::{i32, i64}; + use std::time::Duration as StdDuration; + + #[test] + fn test_duration() { + assert!(Duration::seconds(1) != Duration::zero()); + assert_eq!(Duration::seconds(1) + Duration::seconds(2), Duration::seconds(3)); + assert_eq!(Duration::seconds(86399) + Duration::seconds(4), + Duration::days(1) + Duration::seconds(3)); + assert_eq!(Duration::days(10) - Duration::seconds(1000), Duration::seconds(863000)); + assert_eq!(Duration::days(10) - Duration::seconds(1000000), Duration::seconds(-136000)); + assert_eq!(Duration::days(2) + Duration::seconds(86399) + + Duration::nanoseconds(1234567890), + Duration::days(3) + Duration::nanoseconds(234567890)); + assert_eq!(-Duration::days(3), Duration::days(-3)); + assert_eq!(-(Duration::days(3) + Duration::seconds(70)), + Duration::days(-4) + Duration::seconds(86400-70)); + } + + #[test] + fn test_duration_num_days() { + assert_eq!(Duration::zero().num_days(), 0); + assert_eq!(Duration::days(1).num_days(), 1); + assert_eq!(Duration::days(-1).num_days(), -1); + assert_eq!(Duration::seconds(86399).num_days(), 0); + assert_eq!(Duration::seconds(86401).num_days(), 1); + assert_eq!(Duration::seconds(-86399).num_days(), 0); + assert_eq!(Duration::seconds(-86401).num_days(), -1); + assert_eq!(Duration::days(i32::MAX as i64).num_days(), i32::MAX as i64); + assert_eq!(Duration::days(i32::MIN as i64).num_days(), i32::MIN as i64); + } + + #[test] + fn test_duration_num_seconds() { + assert_eq!(Duration::zero().num_seconds(), 0); + assert_eq!(Duration::seconds(1).num_seconds(), 1); + assert_eq!(Duration::seconds(-1).num_seconds(), -1); + assert_eq!(Duration::milliseconds(999).num_seconds(), 0); + assert_eq!(Duration::milliseconds(1001).num_seconds(), 1); + assert_eq!(Duration::milliseconds(-999).num_seconds(), 0); + assert_eq!(Duration::milliseconds(-1001).num_seconds(), -1); + } + + #[test] + fn test_duration_num_milliseconds() { + assert_eq!(Duration::zero().num_milliseconds(), 0); + assert_eq!(Duration::milliseconds(1).num_milliseconds(), 1); + assert_eq!(Duration::milliseconds(-1).num_milliseconds(), -1); + assert_eq!(Duration::microseconds(999).num_milliseconds(), 0); + assert_eq!(Duration::microseconds(1001).num_milliseconds(), 1); + assert_eq!(Duration::microseconds(-999).num_milliseconds(), 0); + assert_eq!(Duration::microseconds(-1001).num_milliseconds(), -1); + assert_eq!(Duration::milliseconds(i64::MAX).num_milliseconds(), i64::MAX); + assert_eq!(Duration::milliseconds(i64::MIN).num_milliseconds(), i64::MIN); + assert_eq!(MAX.num_milliseconds(), i64::MAX); + assert_eq!(MIN.num_milliseconds(), i64::MIN); + } + + #[test] + fn test_duration_num_microseconds() { + assert_eq!(Duration::zero().num_microseconds(), Some(0)); + assert_eq!(Duration::microseconds(1).num_microseconds(), Some(1)); + assert_eq!(Duration::microseconds(-1).num_microseconds(), Some(-1)); + assert_eq!(Duration::nanoseconds(999).num_microseconds(), Some(0)); + assert_eq!(Duration::nanoseconds(1001).num_microseconds(), Some(1)); + assert_eq!(Duration::nanoseconds(-999).num_microseconds(), Some(0)); + assert_eq!(Duration::nanoseconds(-1001).num_microseconds(), Some(-1)); + assert_eq!(Duration::microseconds(i64::MAX).num_microseconds(), Some(i64::MAX)); + assert_eq!(Duration::microseconds(i64::MIN).num_microseconds(), Some(i64::MIN)); + assert_eq!(MAX.num_microseconds(), None); + assert_eq!(MIN.num_microseconds(), None); + + // overflow checks + const MICROS_PER_DAY: i64 = 86400_000_000; + assert_eq!(Duration::days(i64::MAX / MICROS_PER_DAY).num_microseconds(), + Some(i64::MAX / MICROS_PER_DAY * MICROS_PER_DAY)); + assert_eq!(Duration::days(i64::MIN / MICROS_PER_DAY).num_microseconds(), + Some(i64::MIN / MICROS_PER_DAY * MICROS_PER_DAY)); + assert_eq!(Duration::days(i64::MAX / MICROS_PER_DAY + 1).num_microseconds(), None); + assert_eq!(Duration::days(i64::MIN / MICROS_PER_DAY - 1).num_microseconds(), None); + } + + #[test] + fn test_duration_num_nanoseconds() { + assert_eq!(Duration::zero().num_nanoseconds(), Some(0)); + assert_eq!(Duration::nanoseconds(1).num_nanoseconds(), Some(1)); + assert_eq!(Duration::nanoseconds(-1).num_nanoseconds(), Some(-1)); + assert_eq!(Duration::nanoseconds(i64::MAX).num_nanoseconds(), Some(i64::MAX)); + assert_eq!(Duration::nanoseconds(i64::MIN).num_nanoseconds(), Some(i64::MIN)); + assert_eq!(MAX.num_nanoseconds(), None); + assert_eq!(MIN.num_nanoseconds(), None); + + // overflow checks + const NANOS_PER_DAY: i64 = 86400_000_000_000; + assert_eq!(Duration::days(i64::MAX / NANOS_PER_DAY).num_nanoseconds(), + Some(i64::MAX / NANOS_PER_DAY * NANOS_PER_DAY)); + assert_eq!(Duration::days(i64::MIN / NANOS_PER_DAY).num_nanoseconds(), + Some(i64::MIN / NANOS_PER_DAY * NANOS_PER_DAY)); + assert_eq!(Duration::days(i64::MAX / NANOS_PER_DAY + 1).num_nanoseconds(), None); + assert_eq!(Duration::days(i64::MIN / NANOS_PER_DAY - 1).num_nanoseconds(), None); + } + + #[test] + fn test_duration_checked_ops() { + assert_eq!(Duration::milliseconds(i64::MAX - 1).checked_add(&Duration::microseconds(999)), + Some(Duration::milliseconds(i64::MAX - 2) + Duration::microseconds(1999))); + assert!(Duration::milliseconds(i64::MAX).checked_add(&Duration::microseconds(1000)) + .is_none()); + + assert_eq!(Duration::milliseconds(i64::MIN).checked_sub(&Duration::milliseconds(0)), + Some(Duration::milliseconds(i64::MIN))); + assert!(Duration::milliseconds(i64::MIN).checked_sub(&Duration::milliseconds(1)) + .is_none()); + } + + #[test] + fn test_duration_mul() { + assert_eq!(Duration::zero() * i32::MAX, Duration::zero()); + assert_eq!(Duration::zero() * i32::MIN, Duration::zero()); + assert_eq!(Duration::nanoseconds(1) * 0, Duration::zero()); + assert_eq!(Duration::nanoseconds(1) * 1, Duration::nanoseconds(1)); + assert_eq!(Duration::nanoseconds(1) * 1_000_000_000, Duration::seconds(1)); + assert_eq!(Duration::nanoseconds(1) * -1_000_000_000, -Duration::seconds(1)); + assert_eq!(-Duration::nanoseconds(1) * 1_000_000_000, -Duration::seconds(1)); + assert_eq!(Duration::nanoseconds(30) * 333_333_333, + Duration::seconds(10) - Duration::nanoseconds(10)); + assert_eq!((Duration::nanoseconds(1) + Duration::seconds(1) + Duration::days(1)) * 3, + Duration::nanoseconds(3) + Duration::seconds(3) + Duration::days(3)); + assert_eq!(Duration::milliseconds(1500) * -2, Duration::seconds(-3)); + assert_eq!(Duration::milliseconds(-1500) * 2, Duration::seconds(-3)); + } + + #[test] + fn test_duration_div() { + assert_eq!(Duration::zero() / i32::MAX, Duration::zero()); + assert_eq!(Duration::zero() / i32::MIN, Duration::zero()); + assert_eq!(Duration::nanoseconds(123_456_789) / 1, Duration::nanoseconds(123_456_789)); + assert_eq!(Duration::nanoseconds(123_456_789) / -1, -Duration::nanoseconds(123_456_789)); + assert_eq!(-Duration::nanoseconds(123_456_789) / -1, Duration::nanoseconds(123_456_789)); + assert_eq!(-Duration::nanoseconds(123_456_789) / 1, -Duration::nanoseconds(123_456_789)); + assert_eq!(Duration::seconds(1) / 3, Duration::nanoseconds(333_333_333)); + assert_eq!(Duration::seconds(4) / 3, Duration::nanoseconds(1_333_333_333)); + assert_eq!(Duration::seconds(-1) / 2, Duration::milliseconds(-500)); + assert_eq!(Duration::seconds(1) / -2, Duration::milliseconds(-500)); + assert_eq!(Duration::seconds(-1) / -2, Duration::milliseconds(500)); + assert_eq!(Duration::seconds(-4) / 3, Duration::nanoseconds(-1_333_333_333)); + assert_eq!(Duration::seconds(-4) / -3, Duration::nanoseconds(1_333_333_333)); + } + + #[test] + fn test_duration_fmt() { + assert_eq!(Duration::zero().to_string(), "PT0S"); + assert_eq!(Duration::days(42).to_string(), "P42D"); + assert_eq!(Duration::days(-42).to_string(), "-P42D"); + assert_eq!(Duration::seconds(42).to_string(), "PT42S"); + assert_eq!(Duration::milliseconds(42).to_string(), "PT0.042S"); + assert_eq!(Duration::microseconds(42).to_string(), "PT0.000042S"); + assert_eq!(Duration::nanoseconds(42).to_string(), "PT0.000000042S"); + assert_eq!((Duration::days(7) + Duration::milliseconds(6543)).to_string(), + "P7DT6.543S"); + assert_eq!(Duration::seconds(-86401).to_string(), "-P1DT1S"); + assert_eq!(Duration::nanoseconds(-1).to_string(), "-PT0.000000001S"); + + // the format specifier should have no effect on `Duration` + assert_eq!(format!("{:30}", Duration::days(1) + Duration::milliseconds(2345)), + "P1DT2.345S"); + } + + #[test] + fn test_to_std() { + assert_eq!(Duration::seconds(1).to_std(), Ok(StdDuration::new(1, 0))); + assert_eq!(Duration::seconds(86401).to_std(), Ok(StdDuration::new(86401, 0))); + assert_eq!(Duration::milliseconds(123).to_std(), Ok(StdDuration::new(0, 123000000))); + assert_eq!(Duration::milliseconds(123765).to_std(), Ok(StdDuration::new(123, 765000000))); + assert_eq!(Duration::nanoseconds(777).to_std(), Ok(StdDuration::new(0, 777))); + assert_eq!(MAX.to_std(), Ok(StdDuration::new(9223372036854775, 807000000))); + assert_eq!(Duration::seconds(-1).to_std(), + Err(OutOfRangeError(()))); + assert_eq!(Duration::milliseconds(-1).to_std(), + Err(OutOfRangeError(()))); + } + + #[test] + fn test_from_std() { + assert_eq!(Ok(Duration::seconds(1)), + Duration::from_std(StdDuration::new(1, 0))); + assert_eq!(Ok(Duration::seconds(86401)), + Duration::from_std(StdDuration::new(86401, 0))); + assert_eq!(Ok(Duration::milliseconds(123)), + Duration::from_std(StdDuration::new(0, 123000000))); + assert_eq!(Ok(Duration::milliseconds(123765)), + Duration::from_std(StdDuration::new(123, 765000000))); + assert_eq!(Ok(Duration::nanoseconds(777)), + Duration::from_std(StdDuration::new(0, 777))); + assert_eq!(Ok(MAX), + Duration::from_std(StdDuration::new(9223372036854775, 807000000))); + assert_eq!(Duration::from_std(StdDuration::new(9223372036854776, 0)), + Err(OutOfRangeError(()))); + assert_eq!(Duration::from_std(StdDuration::new(9223372036854775, 807000001)), + Err(OutOfRangeError(()))); + } +} diff --git a/src/vendor/time/src/lib.rs b/src/vendor/time/src/lib.rs new file mode 100644 index 0000000000..0407d3322f --- /dev/null +++ b/src/vendor/time/src/lib.rs @@ -0,0 +1,1275 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Simple time handling. +//! +//! # Usage +//! +//! This crate is [on crates.io](https://crates.io/crates/time) and can be +//! used by adding `time` to the dependencies in your project's `Cargo.toml`. +//! +//! ```toml +//! [dependencies] +//! time = "0.1" +//! ``` +//! +//! And this in your crate root: +//! +//! ```rust +//! extern crate time; +//! ``` +//! +//! This crate uses the same syntax for format strings as the +//! [`strftime()`](http://man7.org/linux/man-pages/man3/strftime.3.html) +//! function from the C standard library. + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/time/")] +#![allow(trivial_numeric_casts)] +#![cfg_attr(test, deny(warnings))] + +#[cfg(target_os = "redox")] extern crate syscall; +#[cfg(unix)] extern crate libc; +#[cfg(windows)] extern crate winapi; +#[cfg(feature = "rustc-serialize")] extern crate rustc_serialize; + +#[cfg(test)] #[macro_use] extern crate log; + +use std::cmp::Ordering; +use std::error::Error; +use std::fmt; +use std::ops::{Add, Sub}; + +pub use duration::{Duration, OutOfRangeError}; + +use self::ParseError::{InvalidDay, InvalidDayOfMonth, InvalidDayOfWeek, + InvalidDayOfYear, InvalidFormatSpecifier, InvalidHour, + InvalidMinute, InvalidMonth, InvalidSecond, InvalidTime, + InvalidYear, InvalidZoneOffset, InvalidSecondsSinceEpoch, + MissingFormatConverter, UnexpectedCharacter}; + +pub use parse::strptime; + +mod display; +mod duration; +mod parse; +mod sys; + +static NSEC_PER_SEC: i32 = 1_000_000_000; + +/// A record specifying a time value in seconds and nanoseconds, where +/// nanoseconds represent the offset from the given second. +/// +/// For example a timespec of 1.2 seconds after the beginning of the epoch would +/// be represented as {sec: 1, nsec: 200000000}. +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] +#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] +pub struct Timespec { pub sec: i64, pub nsec: i32 } +/* + * Timespec assumes that pre-epoch Timespecs have negative sec and positive + * nsec fields. Darwin's and Linux's struct timespec functions handle pre- + * epoch timestamps using a "two steps back, one step forward" representation, + * though the man pages do not actually document this. For example, the time + * -1.2 seconds before the epoch is represented by `Timespec { sec: -2_i64, + * nsec: 800_000_000 }`. + */ +impl Timespec { + pub fn new(sec: i64, nsec: i32) -> Timespec { + assert!(nsec >= 0 && nsec < NSEC_PER_SEC); + Timespec { sec: sec, nsec: nsec } + } +} + +impl Add for Timespec { + type Output = Timespec; + + fn add(self, other: Duration) -> Timespec { + let d_sec = other.num_seconds(); + // It is safe to unwrap the nanoseconds, because there cannot be + // more than one second left, which fits in i64 and in i32. + let d_nsec = (other - Duration::seconds(d_sec)) + .num_nanoseconds().unwrap() as i32; + let mut sec = self.sec + d_sec; + let mut nsec = self.nsec + d_nsec; + if nsec >= NSEC_PER_SEC { + nsec -= NSEC_PER_SEC; + sec += 1; + } else if nsec < 0 { + nsec += NSEC_PER_SEC; + sec -= 1; + } + Timespec::new(sec, nsec) + } +} + +impl Sub for Timespec { + type Output = Timespec; + + fn sub(self, other: Duration) -> Timespec { + let d_sec = other.num_seconds(); + // It is safe to unwrap the nanoseconds, because there cannot be + // more than one second left, which fits in i64 and in i32. + let d_nsec = (other - Duration::seconds(d_sec)) + .num_nanoseconds().unwrap() as i32; + let mut sec = self.sec - d_sec; + let mut nsec = self.nsec - d_nsec; + if nsec >= NSEC_PER_SEC { + nsec -= NSEC_PER_SEC; + sec += 1; + } else if nsec < 0 { + nsec += NSEC_PER_SEC; + sec -= 1; + } + Timespec::new(sec, nsec) + } +} + +impl Sub for Timespec { + type Output = Duration; + + fn sub(self, other: Timespec) -> Duration { + let sec = self.sec - other.sec; + let nsec = self.nsec - other.nsec; + Duration::seconds(sec) + Duration::nanoseconds(nsec as i64) + } +} + +/** + * Returns the current time as a `timespec` containing the seconds and + * nanoseconds since 1970-01-01T00:00:00Z. + */ +pub fn get_time() -> Timespec { + let (sec, nsec) = sys::get_time(); + Timespec::new(sec, nsec) +} + + +/** + * Returns the current value of a high-resolution performance counter + * in nanoseconds since an unspecified epoch. + */ +pub fn precise_time_ns() -> u64 { + sys::get_precise_ns() +} + + +/** + * Returns the current value of a high-resolution performance counter + * in seconds since an unspecified epoch. + */ +pub fn precise_time_s() -> f64 { + return (precise_time_ns() as f64) / 1000000000.; +} + +/// An opaque structure representing a moment in time. +/// +/// The only operation that can be performed on a `PreciseTime` is the +/// calculation of the `Duration` of time that lies between them. +/// +/// # Examples +/// +/// Repeatedly call a function for 1 second: +/// +/// ```rust +/// use time::{Duration, PreciseTime}; +/// # fn do_some_work() {} +/// +/// let start = PreciseTime::now(); +/// +/// while start.to(PreciseTime::now()) < Duration::seconds(1) { +/// do_some_work(); +/// } +/// ``` +#[derive(Copy, Clone)] +pub struct PreciseTime(u64); + +impl PreciseTime { + /// Returns a `PreciseTime` representing the current moment in time. + pub fn now() -> PreciseTime { + PreciseTime(precise_time_ns()) + } + + /// Returns a `Duration` representing the span of time from the value of + /// `self` to the value of `later`. + /// + /// # Notes + /// + /// If `later` represents a time before `self`, the result of this method + /// is unspecified. + /// + /// If `later` represents a time more than 293 years after `self`, the + /// result of this method is unspecified. + #[inline] + pub fn to(&self, later: PreciseTime) -> Duration { + // NB: even if later is less than self due to overflow, this will work + // since the subtraction will underflow properly as well. + // + // We could deal with the overflow when casting to an i64, but all that + // gets us is the ability to handle intervals of up to 584 years, which + // seems not very useful :) + Duration::nanoseconds((later.0 - self.0) as i64) + } +} + +/// A structure representing a moment in time. +/// +/// `SteadyTime`s are generated by a "steady" clock, that is, a clock which +/// never experiences discontinuous jumps and for which time always flows at +/// the same rate. +/// +/// # Examples +/// +/// Repeatedly call a function for 1 second: +/// +/// ```rust +/// # use time::{Duration, SteadyTime}; +/// # fn do_some_work() {} +/// let start = SteadyTime::now(); +/// +/// while SteadyTime::now() - start < Duration::seconds(1) { +/// do_some_work(); +/// } +/// ``` +#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug)] +pub struct SteadyTime(sys::SteadyTime); + +impl SteadyTime { + /// Returns a `SteadyTime` representing the current moment in time. + pub fn now() -> SteadyTime { + SteadyTime(sys::SteadyTime::now()) + } +} + +impl fmt::Display for SteadyTime { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + // TODO: needs a display customization + fmt::Debug::fmt(self, fmt) + } +} + +impl Sub for SteadyTime { + type Output = Duration; + + fn sub(self, other: SteadyTime) -> Duration { + self.0 - other.0 + } +} + +impl Sub for SteadyTime { + type Output = SteadyTime; + + fn sub(self, other: Duration) -> SteadyTime { + SteadyTime(self.0 - other) + } +} + +impl Add for SteadyTime { + type Output = SteadyTime; + + fn add(self, other: Duration) -> SteadyTime { + SteadyTime(self.0 + other) + } +} + +#[cfg(not(windows))] +pub fn tzset() { + extern { fn tzset(); } + unsafe { tzset() } +} + + +#[cfg(windows)] +pub fn tzset() {} + +/// Holds a calendar date and time broken down into its components (year, month, +/// day, and so on), also called a broken-down time value. +// FIXME: use c_int instead of i32? +#[repr(C)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] +#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] +pub struct Tm { + /// Seconds after the minute - [0, 60] + pub tm_sec: i32, + + /// Minutes after the hour - [0, 59] + pub tm_min: i32, + + /// Hours after midnight - [0, 23] + pub tm_hour: i32, + + /// Day of the month - [1, 31] + pub tm_mday: i32, + + /// Months since January - [0, 11] + pub tm_mon: i32, + + /// Years since 1900 + pub tm_year: i32, + + /// Days since Sunday - [0, 6]. 0 = Sunday, 1 = Monday, ..., 6 = Saturday. + pub tm_wday: i32, + + /// Days since January 1 - [0, 365] + pub tm_yday: i32, + + /// Daylight Saving Time flag. + /// + /// This value is positive if Daylight Saving Time is in effect, zero if + /// Daylight Saving Time is not in effect, and negative if this information + /// is not available. + pub tm_isdst: i32, + + /// Identifies the time zone that was used to compute this broken-down time + /// value, including any adjustment for Daylight Saving Time. This is the + /// number of seconds east of UTC. For example, for U.S. Pacific Daylight + /// Time, the value is `-7*60*60 = -25200`. + pub tm_utcoff: i32, + + /// Nanoseconds after the second - [0, 109 - 1] + pub tm_nsec: i32, +} + +impl Add for Tm { + type Output = Tm; + + /// The resulting Tm is in UTC. + // FIXME: The resulting Tm should have the same timezone as `self`; + // however, we need a function such as `at_tm(clock: Timespec, offset: i32)` + // for this. + fn add(self, other: Duration) -> Tm { + at_utc(self.to_timespec() + other) + } +} + +impl Sub for Tm { + type Output = Tm; + + /// The resulting Tm is in UTC. + // FIXME: The resulting Tm should have the same timezone as `self`; + // however, we need a function such as `at_tm(clock: Timespec, offset: i32)` + // for this. + fn sub(self, other: Duration) -> Tm { + at_utc(self.to_timespec() - other) + } +} + +impl Sub for Tm { + type Output = Duration; + + fn sub(self, other: Tm) -> Duration { + self.to_timespec() - other.to_timespec() + } +} + +impl PartialOrd for Tm { + fn partial_cmp(&self, other: &Tm) -> Option { + self.to_timespec().partial_cmp(&other.to_timespec()) + } +} + +impl Ord for Tm { + fn cmp(&self, other: &Tm) -> Ordering { + self.to_timespec().cmp(&other.to_timespec()) + } +} + +pub fn empty_tm() -> Tm { + Tm { + tm_sec: 0, + tm_min: 0, + tm_hour: 0, + tm_mday: 0, + tm_mon: 0, + tm_year: 0, + tm_wday: 0, + tm_yday: 0, + tm_isdst: 0, + tm_utcoff: 0, + tm_nsec: 0, + } +} + +/// Returns the specified time in UTC +pub fn at_utc(clock: Timespec) -> Tm { + let Timespec { sec, nsec } = clock; + let mut tm = empty_tm(); + sys::time_to_utc_tm(sec, &mut tm); + tm.tm_nsec = nsec; + tm +} + +/// Returns the current time in UTC +pub fn now_utc() -> Tm { + at_utc(get_time()) +} + +/// Returns the specified time in the local timezone +pub fn at(clock: Timespec) -> Tm { + let Timespec { sec, nsec } = clock; + let mut tm = empty_tm(); + sys::time_to_local_tm(sec, &mut tm); + tm.tm_nsec = nsec; + tm +} + +/// Returns the current time in the local timezone +pub fn now() -> Tm { + at(get_time()) +} + +impl Tm { + /// Convert time to the seconds from January 1, 1970 + pub fn to_timespec(&self) -> Timespec { + let sec = match self.tm_utcoff { + 0 => sys::utc_tm_to_time(self), + _ => sys::local_tm_to_time(self) + }; + + Timespec::new(sec, self.tm_nsec) + } + + /// Convert time to the local timezone + pub fn to_local(&self) -> Tm { + at(self.to_timespec()) + } + + /// Convert time to the UTC + pub fn to_utc(&self) -> Tm { + match self.tm_utcoff { + 0 => *self, + _ => at_utc(self.to_timespec()) + } + } + + /** + * Returns a TmFmt that outputs according to the `asctime` format in ISO + * C, in the local timezone. + * + * Example: "Thu Jan 1 00:00:00 1970" + */ + pub fn ctime(&self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Ctime, + } + } + + /** + * Returns a TmFmt that outputs according to the `asctime` format in ISO + * C. + * + * Example: "Thu Jan 1 00:00:00 1970" + */ + pub fn asctime(&self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Str("%c"), + } + } + + /// Formats the time according to the format string. + pub fn strftime<'a>(&'a self, format: &'a str) -> Result, ParseError> { + validate_format(TmFmt { + tm: self, + format: Fmt::Str(format), + }) + } + + /** + * Returns a TmFmt that outputs according to RFC 822. + * + * local: "Thu, 22 Mar 2012 07:53:18 PST" + * utc: "Thu, 22 Mar 2012 14:53:18 GMT" + */ + pub fn rfc822(&self) -> TmFmt { + let fmt = if self.tm_utcoff == 0 { + "%a, %d %b %Y %T GMT" + } else { + "%a, %d %b %Y %T %Z" + }; + TmFmt { + tm: self, + format: Fmt::Str(fmt), + } + } + + /** + * Returns a TmFmt that outputs according to RFC 822 with Zulu time. + * + * local: "Thu, 22 Mar 2012 07:53:18 -0700" + * utc: "Thu, 22 Mar 2012 14:53:18 -0000" + */ + pub fn rfc822z(&self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Str("%a, %d %b %Y %T %z"), + } + } + + /** + * Returns a TmFmt that outputs according to RFC 3339. RFC 3339 is + * compatible with ISO 8601. + * + * local: "2012-02-22T07:53:18-07:00" + * utc: "2012-02-22T14:53:18Z" + */ + pub fn rfc3339<'a>(&'a self) -> TmFmt { + TmFmt { + tm: self, + format: Fmt::Rfc3339, + } + } +} + +#[derive(Copy, PartialEq, Debug, Clone)] +pub enum ParseError { + InvalidSecond, + InvalidMinute, + InvalidHour, + InvalidDay, + InvalidMonth, + InvalidYear, + InvalidDayOfWeek, + InvalidDayOfMonth, + InvalidDayOfYear, + InvalidZoneOffset, + InvalidTime, + InvalidSecondsSinceEpoch, + MissingFormatConverter, + InvalidFormatSpecifier(char), + UnexpectedCharacter(char, char), +} + +impl fmt::Display for ParseError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + InvalidFormatSpecifier(ch) => { + write!(f, "{}: %{}", self.description(), ch) + } + UnexpectedCharacter(a, b) => { + write!(f, "expected: `{}`, found: `{}`", a, b) + } + _ => write!(f, "{}", self.description()) + } + } +} + +impl Error for ParseError { + fn description(&self) -> &str { + match *self { + InvalidSecond => "Invalid second.", + InvalidMinute => "Invalid minute.", + InvalidHour => "Invalid hour.", + InvalidDay => "Invalid day.", + InvalidMonth => "Invalid month.", + InvalidYear => "Invalid year.", + InvalidDayOfWeek => "Invalid day of the week.", + InvalidDayOfMonth => "Invalid day of the month.", + InvalidDayOfYear => "Invalid day of the year.", + InvalidZoneOffset => "Invalid zone offset.", + InvalidTime => "Invalid time.", + InvalidSecondsSinceEpoch => "Invalid seconds since epoch.", + MissingFormatConverter => "missing format converter after `%`", + InvalidFormatSpecifier(..) => "invalid format specifier", + UnexpectedCharacter(..) => "Unexpected character.", + } + } +} + +/// A wrapper around a `Tm` and format string that implements Display. +#[derive(Debug)] +pub struct TmFmt<'a> { + tm: &'a Tm, + format: Fmt<'a> +} + +#[derive(Debug)] +enum Fmt<'a> { + Str(&'a str), + Rfc3339, + Ctime, +} + +fn validate_format<'a>(fmt: TmFmt<'a>) -> Result, ParseError> { + + match (fmt.tm.tm_wday, fmt.tm.tm_mon) { + (0...6, 0...11) => (), + (_wday, 0...11) => return Err(InvalidDayOfWeek), + (0...6, _mon) => return Err(InvalidMonth), + _ => return Err(InvalidDay) + } + match fmt.format { + Fmt::Str(ref s) => { + let mut chars = s.chars(); + loop { + match chars.next() { + Some('%') => { + match chars.next() { + Some('A') | Some('a') | Some('B') | Some('b') | + Some('C') | Some('c') | Some('D') | Some('d') | + Some('e') | Some('F') | Some('f') | Some('G') | + Some('g') | Some('H') | Some('h') | Some('I') | + Some('j') | Some('k') | Some('l') | Some('M') | + Some('m') | Some('n') | Some('P') | Some('p') | + Some('R') | Some('r') | Some('S') | Some('s') | + Some('T') | Some('t') | Some('U') | Some('u') | + Some('V') | Some('v') | Some('W') | Some('w') | + Some('X') | Some('x') | Some('Y') | Some('y') | + Some('Z') | Some('z') | Some('+') | Some('%') => (), + + Some(c) => return Err(InvalidFormatSpecifier(c)), + None => return Err(MissingFormatConverter), + } + }, + None => break, + _ => () + } + } + }, + _ => () + } + Ok(fmt) +} + +/// Formats the time according to the format string. +pub fn strftime(format: &str, tm: &Tm) -> Result { + tm.strftime(format).map(|fmt| fmt.to_string()) +} + +#[cfg(test)] +mod tests { + use super::{Timespec, get_time, precise_time_ns, precise_time_s, + at_utc, at, strptime, PreciseTime, SteadyTime, ParseError, Duration}; + use super::ParseError::{InvalidTime, InvalidYear, MissingFormatConverter, + InvalidFormatSpecifier}; + + use std::sync::{Once, ONCE_INIT, Mutex, MutexGuard, LockResult}; + use std::mem; + + struct TzReset { + _tzreset: ::sys::TzReset, + _lock: LockResult>, + } + + fn set_time_zone_la_or_london(london: bool) -> TzReset { + // Lock manages current timezone because some tests require LA some + // London + static mut LOCK: *mut Mutex<()> = 0 as *mut _; + static INIT: Once = ONCE_INIT; + + unsafe { + INIT.call_once(|| { + LOCK = mem::transmute(Box::new(Mutex::new(()))); + }); + + let timezone_lock = (*LOCK).lock(); + let reset_func = if london { + ::sys::set_london_with_dst_time_zone() + } else { + ::sys::set_los_angeles_time_zone() + }; + TzReset { + _lock: timezone_lock, + _tzreset: reset_func, + } + } + } + + fn set_time_zone() -> TzReset { + set_time_zone_la_or_london(false) + } + + fn set_time_zone_london_dst() -> TzReset { + set_time_zone_la_or_london(true) + } + + #[test] + fn test_get_time() { + static SOME_RECENT_DATE: i64 = 1325376000i64; // 2012-01-01T00:00:00Z + static SOME_FUTURE_DATE: i64 = 1577836800i64; // 2020-01-01T00:00:00Z + + let tv1 = get_time(); + debug!("tv1={} sec + {} nsec", tv1.sec, tv1.nsec); + + assert!(tv1.sec > SOME_RECENT_DATE); + assert!(tv1.nsec < 1000000000i32); + + let tv2 = get_time(); + debug!("tv2={} sec + {} nsec", tv2.sec, tv2.nsec); + + assert!(tv2.sec >= tv1.sec); + assert!(tv2.sec < SOME_FUTURE_DATE); + assert!(tv2.nsec < 1000000000i32); + if tv2.sec == tv1.sec { + assert!(tv2.nsec >= tv1.nsec); + } + } + + #[test] + fn test_precise_time() { + let s0 = precise_time_s(); + debug!("s0={} sec", s0); + assert!(s0 > 0.); + + let ns0 = precise_time_ns(); + let ns1 = precise_time_ns(); + debug!("ns0={} ns", ns0); + debug!("ns1={} ns", ns1); + assert!(ns1 >= ns0); + + let ns2 = precise_time_ns(); + debug!("ns2={} ns", ns2); + assert!(ns2 >= ns1); + } + + #[test] + fn test_precise_time_to() { + let t0 = PreciseTime(1000); + let t1 = PreciseTime(1023); + assert_eq!(Duration::nanoseconds(23), t0.to(t1)); + } + + #[test] + fn test_at_utc() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + + assert_eq!(utc.tm_sec, 30); + assert_eq!(utc.tm_min, 31); + assert_eq!(utc.tm_hour, 23); + assert_eq!(utc.tm_mday, 13); + assert_eq!(utc.tm_mon, 1); + assert_eq!(utc.tm_year, 109); + assert_eq!(utc.tm_wday, 5); + assert_eq!(utc.tm_yday, 43); + assert_eq!(utc.tm_isdst, 0); + assert_eq!(utc.tm_utcoff, 0); + assert_eq!(utc.tm_nsec, 54321); + } + + #[test] + fn test_at() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let local = at(time); + + debug!("time_at: {:?}", local); + + assert_eq!(local.tm_sec, 30); + assert_eq!(local.tm_min, 31); + assert_eq!(local.tm_hour, 15); + assert_eq!(local.tm_mday, 13); + assert_eq!(local.tm_mon, 1); + assert_eq!(local.tm_year, 109); + assert_eq!(local.tm_wday, 5); + assert_eq!(local.tm_yday, 43); + assert_eq!(local.tm_isdst, 0); + assert_eq!(local.tm_utcoff, -28800); + assert_eq!(local.tm_nsec, 54321); + } + + #[test] + fn test_to_timespec() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + + assert_eq!(utc.to_timespec(), time); + assert_eq!(utc.to_local().to_timespec(), time); + } + + #[test] + fn test_conversions() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + assert!(local.to_local() == local); + assert!(local.to_utc() == utc); + assert!(local.to_utc().to_local() == local); + assert!(utc.to_utc() == utc); + assert!(utc.to_local() == local); + assert!(utc.to_local().to_utc() == utc); + } + + #[test] + fn test_strptime() { + let _reset = set_time_zone(); + + match strptime("", "") { + Ok(ref tm) => { + assert!(tm.tm_sec == 0); + assert!(tm.tm_min == 0); + assert!(tm.tm_hour == 0); + assert!(tm.tm_mday == 0); + assert!(tm.tm_mon == 0); + assert!(tm.tm_year == 0); + assert!(tm.tm_wday == 0); + assert!(tm.tm_isdst == 0); + assert!(tm.tm_utcoff == 0); + assert!(tm.tm_nsec == 0); + } + Err(_) => () + } + + let format = "%a %b %e %T.%f %Y"; + assert_eq!(strptime("", format), Err(ParseError::InvalidDay)); + assert_eq!(strptime("Fri Feb 13 15:31:30", format), + Err(InvalidTime)); + + match strptime("Fri Feb 13 15:31:30.01234 2009", format) { + Err(e) => panic!("{}", e), + Ok(ref tm) => { + assert_eq!(tm.tm_sec, 30); + assert_eq!(tm.tm_min, 31); + assert_eq!(tm.tm_hour, 15); + assert_eq!(tm.tm_mday, 13); + assert_eq!(tm.tm_mon, 1); + assert_eq!(tm.tm_year, 109); + assert_eq!(tm.tm_wday, 5); + assert_eq!(tm.tm_yday, 0); + assert_eq!(tm.tm_isdst, 0); + assert_eq!(tm.tm_utcoff, 0); + assert_eq!(tm.tm_nsec, 12340000); + } + } + + fn test(s: &str, format: &str) -> bool { + match strptime(s, format) { + Ok(tm) => { + tm.strftime(format).unwrap().to_string() == s.to_string() + }, + Err(e) => panic!("{:?}, s={:?}, format={:?}", e, s, format) + } + } + + fn test_oneway(s : &str, format : &str) -> bool { + match strptime(s, format) { + Ok(_) => { + // oneway tests are used when reformatting the parsed Tm + // back into a string can generate a different string + // from the original (i.e. leading zeroes) + true + }, + Err(e) => panic!("{:?}, s={:?}, format={:?}", e, s, format) + } + } + + let days = [ + "Sunday".to_string(), + "Monday".to_string(), + "Tuesday".to_string(), + "Wednesday".to_string(), + "Thursday".to_string(), + "Friday".to_string(), + "Saturday".to_string() + ]; + for day in days.iter() { + assert!(test(&day, "%A")); + } + + let days = [ + "Sun".to_string(), + "Mon".to_string(), + "Tue".to_string(), + "Wed".to_string(), + "Thu".to_string(), + "Fri".to_string(), + "Sat".to_string() + ]; + for day in days.iter() { + assert!(test(&day, "%a")); + } + + let months = [ + "January".to_string(), + "February".to_string(), + "March".to_string(), + "April".to_string(), + "May".to_string(), + "June".to_string(), + "July".to_string(), + "August".to_string(), + "September".to_string(), + "October".to_string(), + "November".to_string(), + "December".to_string() + ]; + for day in months.iter() { + assert!(test(&day, "%B")); + } + + let months = [ + "Jan".to_string(), + "Feb".to_string(), + "Mar".to_string(), + "Apr".to_string(), + "May".to_string(), + "Jun".to_string(), + "Jul".to_string(), + "Aug".to_string(), + "Sep".to_string(), + "Oct".to_string(), + "Nov".to_string(), + "Dec".to_string() + ]; + for day in months.iter() { + assert!(test(&day, "%b")); + } + + assert!(test("19", "%C")); + assert!(test("Fri Feb 3 23:31:30 2009", "%c")); + assert!(test("Fri Feb 13 23:31:30 2009", "%c")); + assert!(test("02/13/09", "%D")); + assert!(test("03", "%d")); + assert!(test("13", "%d")); + assert!(test(" 3", "%e")); + assert!(test("13", "%e")); + assert!(test("2009-02-13", "%F")); + assert!(test("03", "%H")); + assert!(test("13", "%H")); + assert!(test("03", "%I")); // FIXME (#2350): flesh out + assert!(test("11", "%I")); // FIXME (#2350): flesh out + assert!(test("044", "%j")); + assert!(test(" 3", "%k")); + assert!(test("13", "%k")); + assert!(test(" 1", "%l")); + assert!(test("11", "%l")); + assert!(test("03", "%M")); + assert!(test("13", "%M")); + assert!(test("\n", "%n")); + assert!(test("am", "%P")); + assert!(test("pm", "%P")); + assert!(test("AM", "%p")); + assert!(test("PM", "%p")); + assert!(test("23:31", "%R")); + assert!(test("11:31:30 AM", "%r")); + assert!(test("11:31:30 PM", "%r")); + assert!(test("03", "%S")); + assert!(test("13", "%S")); + assert!(test("15:31:30", "%T")); + assert!(test("\t", "%t")); + assert!(test("1", "%u")); + assert!(test("7", "%u")); + assert!(test("13-Feb-2009", "%v")); + assert!(test("0", "%w")); + assert!(test("6", "%w")); + assert!(test("2009", "%Y")); + assert!(test("09", "%y")); + + assert!(test_oneway("3", "%d")); + assert!(test_oneway("3", "%H")); + assert!(test_oneway("3", "%e")); + assert!(test_oneway("3", "%M")); + assert!(test_oneway("3", "%S")); + + assert!(strptime("-0000", "%z").unwrap().tm_utcoff == 0); + assert!(strptime("-00:00", "%z").unwrap().tm_utcoff == 0); + assert!(strptime("Z", "%z").unwrap().tm_utcoff == 0); + assert_eq!(-28800, strptime("-0800", "%z").unwrap().tm_utcoff); + assert_eq!(-28800, strptime("-08:00", "%z").unwrap().tm_utcoff); + assert_eq!(28800, strptime("+0800", "%z").unwrap().tm_utcoff); + assert_eq!(28800, strptime("+08:00", "%z").unwrap().tm_utcoff); + assert_eq!(5400, strptime("+0130", "%z").unwrap().tm_utcoff); + assert_eq!(5400, strptime("+01:30", "%z").unwrap().tm_utcoff); + assert!(test("%", "%%")); + + // Test for #7256 + assert_eq!(strptime("360", "%Y-%m-%d"), Err(InvalidYear)); + + // Test for epoch seconds parsing + { + assert!(test("1428035610", "%s")); + let tm = strptime("1428035610", "%s").unwrap(); + assert_eq!(tm.tm_utcoff, 0); + assert_eq!(tm.tm_isdst, 0); + assert_eq!(tm.tm_yday, 92); + assert_eq!(tm.tm_wday, 5); + assert_eq!(tm.tm_year, 115); + assert_eq!(tm.tm_mon, 3); + assert_eq!(tm.tm_mday, 3); + assert_eq!(tm.tm_hour, 4); + } + } + + #[test] + fn test_asctime() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + debug!("test_ctime: {} {}", utc.asctime(), local.asctime()); + + assert_eq!(utc.asctime().to_string(), "Fri Feb 13 23:31:30 2009".to_string()); + assert_eq!(local.asctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + } + + #[test] + fn test_ctime() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + debug!("test_ctime: {} {}", utc.ctime(), local.ctime()); + + assert_eq!(utc.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + } + + #[test] + fn test_strftime() { + let _reset = set_time_zone(); + + let time = Timespec::new(1234567890, 54321); + let utc = at_utc(time); + let local = at(time); + + assert_eq!(local.strftime("").unwrap().to_string(), "".to_string()); + assert_eq!(local.strftime("%A").unwrap().to_string(), "Friday".to_string()); + assert_eq!(local.strftime("%a").unwrap().to_string(), "Fri".to_string()); + assert_eq!(local.strftime("%B").unwrap().to_string(), "February".to_string()); + assert_eq!(local.strftime("%b").unwrap().to_string(), "Feb".to_string()); + assert_eq!(local.strftime("%C").unwrap().to_string(), "20".to_string()); + assert_eq!(local.strftime("%c").unwrap().to_string(), + "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.strftime("%D").unwrap().to_string(), "02/13/09".to_string()); + assert_eq!(local.strftime("%d").unwrap().to_string(), "13".to_string()); + assert_eq!(local.strftime("%e").unwrap().to_string(), "13".to_string()); + assert_eq!(local.strftime("%F").unwrap().to_string(), "2009-02-13".to_string()); + assert_eq!(local.strftime("%f").unwrap().to_string(), "000054321".to_string()); + assert_eq!(local.strftime("%G").unwrap().to_string(), "2009".to_string()); + assert_eq!(local.strftime("%g").unwrap().to_string(), "09".to_string()); + assert_eq!(local.strftime("%H").unwrap().to_string(), "15".to_string()); + assert_eq!(local.strftime("%h").unwrap().to_string(), "Feb".to_string()); + assert_eq!(local.strftime("%I").unwrap().to_string(), "03".to_string()); + assert_eq!(local.strftime("%j").unwrap().to_string(), "044".to_string()); + assert_eq!(local.strftime("%k").unwrap().to_string(), "15".to_string()); + assert_eq!(local.strftime("%l").unwrap().to_string(), " 3".to_string()); + assert_eq!(local.strftime("%M").unwrap().to_string(), "31".to_string()); + assert_eq!(local.strftime("%m").unwrap().to_string(), "02".to_string()); + assert_eq!(local.strftime("%n").unwrap().to_string(), "\n".to_string()); + assert_eq!(local.strftime("%P").unwrap().to_string(), "pm".to_string()); + assert_eq!(local.strftime("%p").unwrap().to_string(), "PM".to_string()); + assert_eq!(local.strftime("%R").unwrap().to_string(), "15:31".to_string()); + assert_eq!(local.strftime("%r").unwrap().to_string(), "03:31:30 PM".to_string()); + assert_eq!(local.strftime("%S").unwrap().to_string(), "30".to_string()); + assert_eq!(local.strftime("%s").unwrap().to_string(), "1234567890".to_string()); + assert_eq!(local.strftime("%T").unwrap().to_string(), "15:31:30".to_string()); + assert_eq!(local.strftime("%t").unwrap().to_string(), "\t".to_string()); + assert_eq!(local.strftime("%U").unwrap().to_string(), "06".to_string()); + assert_eq!(local.strftime("%u").unwrap().to_string(), "5".to_string()); + assert_eq!(local.strftime("%V").unwrap().to_string(), "07".to_string()); + assert_eq!(local.strftime("%v").unwrap().to_string(), "13-Feb-2009".to_string()); + assert_eq!(local.strftime("%W").unwrap().to_string(), "06".to_string()); + assert_eq!(local.strftime("%w").unwrap().to_string(), "5".to_string()); + // FIXME (#2350): support locale + assert_eq!(local.strftime("%X").unwrap().to_string(), "15:31:30".to_string()); + // FIXME (#2350): support locale + assert_eq!(local.strftime("%x").unwrap().to_string(), "02/13/09".to_string()); + assert_eq!(local.strftime("%Y").unwrap().to_string(), "2009".to_string()); + assert_eq!(local.strftime("%y").unwrap().to_string(), "09".to_string()); + // FIXME (#2350): support locale + assert_eq!(local.strftime("%Z").unwrap().to_string(), "".to_string()); + assert_eq!(local.strftime("%z").unwrap().to_string(), "-0800".to_string()); + assert_eq!(local.strftime("%+").unwrap().to_string(), + "2009-02-13T15:31:30-08:00".to_string()); + assert_eq!(local.strftime("%%").unwrap().to_string(), "%".to_string()); + + let invalid_specifiers = ["%E", "%J", "%K", "%L", "%N", "%O", "%o", "%Q", "%q"]; + for &sp in invalid_specifiers.iter() { + assert_eq!(local.strftime(sp).unwrap_err(), + InvalidFormatSpecifier(sp[1..].chars().next().unwrap())); + } + assert_eq!(local.strftime("%").unwrap_err(), MissingFormatConverter); + assert_eq!(local.strftime("%A %").unwrap_err(), MissingFormatConverter); + + assert_eq!(local.asctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.rfc822z().to_string(), "Fri, 13 Feb 2009 15:31:30 -0800".to_string()); + assert_eq!(local.rfc3339().to_string(), "2009-02-13T15:31:30-08:00".to_string()); + + assert_eq!(utc.asctime().to_string(), "Fri Feb 13 23:31:30 2009".to_string()); + assert_eq!(utc.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(utc.rfc822().to_string(), "Fri, 13 Feb 2009 23:31:30 GMT".to_string()); + assert_eq!(utc.rfc822z().to_string(), "Fri, 13 Feb 2009 23:31:30 -0000".to_string()); + assert_eq!(utc.rfc3339().to_string(), "2009-02-13T23:31:30Z".to_string()); + } + + #[test] + fn test_timespec_eq_ord() { + let a = &Timespec::new(-2, 1); + let b = &Timespec::new(-1, 2); + let c = &Timespec::new(1, 2); + let d = &Timespec::new(2, 1); + let e = &Timespec::new(2, 1); + + assert!(d.eq(e)); + assert!(c.ne(e)); + + assert!(a.lt(b)); + assert!(b.lt(c)); + assert!(c.lt(d)); + + assert!(a.le(b)); + assert!(b.le(c)); + assert!(c.le(d)); + assert!(d.le(e)); + assert!(e.le(d)); + + assert!(b.ge(a)); + assert!(c.ge(b)); + assert!(d.ge(c)); + assert!(e.ge(d)); + assert!(d.ge(e)); + + assert!(b.gt(a)); + assert!(c.gt(b)); + assert!(d.gt(c)); + } + + #[test] + #[allow(deprecated)] + fn test_timespec_hash() { + use std::hash::{Hash, Hasher}; + + let c = &Timespec::new(3, 2); + let d = &Timespec::new(2, 1); + let e = &Timespec::new(2, 1); + + let mut hasher = ::std::hash::SipHasher::new(); + + let d_hash:u64 = { + d.hash(&mut hasher); + hasher.finish() + }; + + hasher = ::std::hash::SipHasher::new(); + + let e_hash:u64 = { + e.hash(&mut hasher); + hasher.finish() + }; + + hasher = ::std::hash::SipHasher::new(); + + let c_hash:u64 = { + c.hash(&mut hasher); + hasher.finish() + }; + + assert_eq!(d_hash, e_hash); + assert!(c_hash != e_hash); + } + + #[test] + fn test_timespec_add() { + let a = Timespec::new(1, 2); + let b = Duration::seconds(2) + Duration::nanoseconds(3); + let c = a + b; + assert_eq!(c.sec, 3); + assert_eq!(c.nsec, 5); + + let p = Timespec::new(1, super::NSEC_PER_SEC - 2); + let q = Duration::seconds(2) + Duration::nanoseconds(2); + let r = p + q; + assert_eq!(r.sec, 4); + assert_eq!(r.nsec, 0); + + let u = Timespec::new(1, super::NSEC_PER_SEC - 2); + let v = Duration::seconds(2) + Duration::nanoseconds(3); + let w = u + v; + assert_eq!(w.sec, 4); + assert_eq!(w.nsec, 1); + + let k = Timespec::new(1, 0); + let l = Duration::nanoseconds(-1); + let m = k + l; + assert_eq!(m.sec, 0); + assert_eq!(m.nsec, 999_999_999); + } + + #[test] + fn test_timespec_sub() { + let a = Timespec::new(2, 3); + let b = Timespec::new(1, 2); + let c = a - b; + assert_eq!(c.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 + 1)); + + let p = Timespec::new(2, 0); + let q = Timespec::new(1, 2); + let r = p - q; + assert_eq!(r.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 - 2)); + + let u = Timespec::new(1, 2); + let v = Timespec::new(2, 3); + let w = u - v; + assert_eq!(w.num_nanoseconds(), Some(-super::NSEC_PER_SEC as i64 - 1)); + } + + #[test] + fn test_time_sub() { + let a = ::now(); + let b = at(a.to_timespec() + Duration::seconds(5)); + let c = b - a; + assert_eq!(c.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 * 5)); + } + + #[test] + fn test_steadytime_sub() { + let a = SteadyTime::now(); + let b = a + Duration::seconds(1); + assert_eq!(b - a, Duration::seconds(1)); + assert_eq!(a - b, Duration::seconds(-1)); + } + + #[test] + fn test_date_before_1970() { + let early = strptime("1901-01-06", "%F").unwrap(); + let late = strptime("2000-01-01", "%F").unwrap(); + assert!(early < late); + } + + #[test] + fn test_dst() { + let _reset = set_time_zone_london_dst(); + let utc_in_feb = strptime("2015-02-01Z", "%F%z").unwrap(); + let utc_in_jun = strptime("2015-06-01Z", "%F%z").unwrap(); + let utc_in_nov = strptime("2015-11-01Z", "%F%z").unwrap(); + let local_in_feb = utc_in_feb.to_local(); + let local_in_jun = utc_in_jun.to_local(); + let local_in_nov = utc_in_nov.to_local(); + + assert_eq!(local_in_feb.tm_mon, 1); + assert_eq!(local_in_feb.tm_hour, 0); + assert_eq!(local_in_feb.tm_utcoff, 0); + assert_eq!(local_in_feb.tm_isdst, 0); + + assert_eq!(local_in_jun.tm_mon, 5); + assert_eq!(local_in_jun.tm_hour, 1); + assert_eq!(local_in_jun.tm_utcoff, 3600); + assert_eq!(local_in_jun.tm_isdst, 1); + + assert_eq!(local_in_nov.tm_mon, 10); + assert_eq!(local_in_nov.tm_hour, 0); + assert_eq!(local_in_nov.tm_utcoff, 0); + assert_eq!(local_in_nov.tm_isdst, 0) + } +} diff --git a/src/vendor/time/src/parse.rs b/src/vendor/time/src/parse.rs new file mode 100644 index 0000000000..467c9be22d --- /dev/null +++ b/src/vendor/time/src/parse.rs @@ -0,0 +1,394 @@ +use super::{Timespec, Tm, at_utc, ParseError, NSEC_PER_SEC}; + +/// Parses the time from the string according to the format string. +pub fn strptime(mut s: &str, format: &str) -> Result { + let mut tm = Tm { + tm_sec: 0, + tm_min: 0, + tm_hour: 0, + tm_mday: 0, + tm_mon: 0, + tm_year: 0, + tm_wday: 0, + tm_yday: 0, + tm_isdst: 0, + tm_utcoff: 0, + tm_nsec: 0, + }; + let mut chars = format.chars(); + + while let Some(ch) = chars.next() { + if ch == '%' { + if let Some(ch) = chars.next() { + try!(parse_type(&mut s, ch, &mut tm)); + } + } else { + try!(parse_char(&mut s, ch)); + } + } + + Ok(tm) +} + +fn parse_type(s: &mut &str, ch: char, tm: &mut Tm) -> Result<(), ParseError> { + match ch { + 'A' => match match_strs(s, &[("Sunday", 0), + ("Monday", 1), + ("Tuesday", 2), + ("Wednesday", 3), + ("Thursday", 4), + ("Friday", 5), + ("Saturday", 6)]) { + Some(v) => { tm.tm_wday = v; Ok(()) } + None => Err(ParseError::InvalidDay) + }, + 'a' => match match_strs(s, &[("Sun", 0), + ("Mon", 1), + ("Tue", 2), + ("Wed", 3), + ("Thu", 4), + ("Fri", 5), + ("Sat", 6)]) { + Some(v) => { tm.tm_wday = v; Ok(()) } + None => Err(ParseError::InvalidDay) + }, + 'B' => match match_strs(s, &[("January", 0), + ("February", 1), + ("March", 2), + ("April", 3), + ("May", 4), + ("June", 5), + ("July", 6), + ("August", 7), + ("September", 8), + ("October", 9), + ("November", 10), + ("December", 11)]) { + Some(v) => { tm.tm_mon = v; Ok(()) } + None => Err(ParseError::InvalidMonth) + }, + 'b' | 'h' => match match_strs(s, &[("Jan", 0), + ("Feb", 1), + ("Mar", 2), + ("Apr", 3), + ("May", 4), + ("Jun", 5), + ("Jul", 6), + ("Aug", 7), + ("Sep", 8), + ("Oct", 9), + ("Nov", 10), + ("Dec", 11)]) { + Some(v) => { tm.tm_mon = v; Ok(()) } + None => Err(ParseError::InvalidMonth) + }, + 'C' => match match_digits_in_range(s, 1, 2, false, 0, 99) { + Some(v) => { tm.tm_year += (v * 100) - 1900; Ok(()) } + None => Err(ParseError::InvalidYear) + }, + 'c' => { + parse_type(s, 'a', tm) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'b', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'e', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'T', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'Y', tm)) + } + 'D' | 'x' => { + parse_type(s, 'm', tm) + .and_then(|()| parse_char(s, '/')) + .and_then(|()| parse_type(s, 'd', tm)) + .and_then(|()| parse_char(s, '/')) + .and_then(|()| parse_type(s, 'y', tm)) + } + 'd' => match match_digits_in_range(s, 1, 2, false, 1, 31) { + Some(v) => { tm.tm_mday = v; Ok(()) } + None => Err(ParseError::InvalidDayOfMonth) + }, + 'e' => match match_digits_in_range(s, 1, 2, true, 1, 31) { + Some(v) => { tm.tm_mday = v; Ok(()) } + None => Err(ParseError::InvalidDayOfMonth) + }, + 'f' => { + tm.tm_nsec = match_fractional_seconds(s); + Ok(()) + } + 'F' => { + parse_type(s, 'Y', tm) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'm', tm)) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'd', tm)) + } + 'H' => { + match match_digits_in_range(s, 1, 2, false, 0, 23) { + Some(v) => { tm.tm_hour = v; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'I' => { + match match_digits_in_range(s, 1, 2, false, 1, 12) { + Some(v) => { tm.tm_hour = if v == 12 { 0 } else { v }; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'j' => { + match match_digits_in_range(s, 1, 3, false, 1, 366) { + Some(v) => { tm.tm_yday = v - 1; Ok(()) } + None => Err(ParseError::InvalidDayOfYear) + } + } + 'k' => { + match match_digits_in_range(s, 1, 2, true, 0, 23) { + Some(v) => { tm.tm_hour = v; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'l' => { + match match_digits_in_range(s, 1, 2, true, 1, 12) { + Some(v) => { tm.tm_hour = if v == 12 { 0 } else { v }; Ok(()) } + None => Err(ParseError::InvalidHour) + } + } + 'M' => { + match match_digits_in_range(s, 1, 2, false, 0, 59) { + Some(v) => { tm.tm_min = v; Ok(()) } + None => Err(ParseError::InvalidMinute) + } + } + 'm' => { + match match_digits_in_range(s, 1, 2, false, 1, 12) { + Some(v) => { tm.tm_mon = v - 1; Ok(()) } + None => Err(ParseError::InvalidMonth) + } + } + 'n' => parse_char(s, '\n'), + 'P' => match match_strs(s, &[("am", 0), ("pm", 12)]) { + Some(v) => { tm.tm_hour += v; Ok(()) } + None => Err(ParseError::InvalidHour) + }, + 'p' => match match_strs(s, &[("AM", 0), ("PM", 12)]) { + Some(v) => { tm.tm_hour += v; Ok(()) } + None => Err(ParseError::InvalidHour) + }, + 'R' => { + parse_type(s, 'H', tm) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'M', tm)) + } + 'r' => { + parse_type(s, 'I', tm) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'M', tm)) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'S', tm)) + .and_then(|()| parse_char(s, ' ')) + .and_then(|()| parse_type(s, 'p', tm)) + } + 's' => { + match match_digits_i64(s, 1, 18, false) { + Some(v) => { + *tm = at_utc(Timespec::new(v, 0)); + Ok(()) + }, + None => Err(ParseError::InvalidSecondsSinceEpoch) + } + } + 'S' => { + match match_digits_in_range(s, 1, 2, false, 0, 60) { + Some(v) => { tm.tm_sec = v; Ok(()) } + None => Err(ParseError::InvalidSecond) + } + } + //'s' {} + 'T' | 'X' => { + parse_type(s, 'H', tm) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'M', tm)) + .and_then(|()| parse_char(s, ':')) + .and_then(|()| parse_type(s, 'S', tm)) + } + 't' => parse_char(s, '\t'), + 'u' => { + match match_digits_in_range(s, 1, 1, false, 1, 7) { + Some(v) => { tm.tm_wday = if v == 7 { 0 } else { v }; Ok(()) } + None => Err(ParseError::InvalidDayOfWeek) + } + } + 'v' => { + parse_type(s, 'e', tm) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'b', tm)) + .and_then(|()| parse_char(s, '-')) + .and_then(|()| parse_type(s, 'Y', tm)) + } + //'W' {} + 'w' => { + match match_digits_in_range(s, 1, 1, false, 0, 6) { + Some(v) => { tm.tm_wday = v; Ok(()) } + None => Err(ParseError::InvalidDayOfWeek) + } + } + 'Y' => { + match match_digits(s, 4, 4, false) { + Some(v) => { tm.tm_year = v - 1900; Ok(()) } + None => Err(ParseError::InvalidYear) + } + } + 'y' => { + match match_digits_in_range(s, 1, 2, false, 0, 99) { + Some(v) => { tm.tm_year = v; Ok(()) } + None => Err(ParseError::InvalidYear) + } + } + 'Z' => { + if match_str(s, "UTC") || match_str(s, "GMT") { + tm.tm_utcoff = 0; + Ok(()) + } else { + // It's odd, but to maintain compatibility with c's + // strptime we ignore the timezone. + for (i, ch) in s.char_indices() { + if ch == ' ' { + *s = &s[i..]; + return Ok(()) + } + } + *s = ""; + Ok(()) + } + } + 'z' => { + if parse_char(s, 'Z').is_ok() { + tm.tm_utcoff = 0; + Ok(()) + } else { + let sign = if parse_char(s, '+').is_ok() {1} + else if parse_char(s, '-').is_ok() {-1} + else { return Err(ParseError::InvalidZoneOffset) }; + + let hours; + let minutes; + + match match_digits(s, 2, 2, false) { + Some(h) => hours = h, + None => return Err(ParseError::InvalidZoneOffset) + } + + // consume the colon if its present, + // just ignore it otherwise + let _ = parse_char(s, ':'); + + match match_digits(s, 2, 2, false) { + Some(m) => minutes = m, + None => return Err(ParseError::InvalidZoneOffset) + } + + tm.tm_utcoff = sign * (hours * 60 * 60 + minutes * 60); + Ok(()) + } + } + '%' => parse_char(s, '%'), + ch => Err(ParseError::InvalidFormatSpecifier(ch)) + } +} + + +fn match_str(s: &mut &str, needle: &str) -> bool { + if s.starts_with(needle) { + *s = &s[needle.len()..]; + true + } else { + false + } +} + +fn match_strs(ss: &mut &str, strs: &[(&str, i32)]) -> Option { + for &(needle, value) in strs.iter() { + if match_str(ss, needle) { + return Some(value) + } + } + None +} + +fn match_digits(ss: &mut &str, min_digits : usize, max_digits: usize, ws: bool) -> Option { + match match_digits_i64(ss, min_digits, max_digits, ws) { + Some(v) => Some(v as i32), + None => None + } +} + +fn match_digits_i64(ss: &mut &str, min_digits : usize, max_digits: usize, ws: bool) -> Option { + let mut value : i64 = 0; + let mut n = 0; + if ws { + let s2 = ss.trim_left_matches(" "); + n = ss.len() - s2.len(); + if n > max_digits { return None } + } + let chars = ss[n..].char_indices(); + for (_, ch) in chars.take(max_digits - n) { + match ch { + '0' ... '9' => value = value * 10 + (ch as i64 - '0' as i64), + _ => break, + } + n += 1; + } + + if n >= min_digits && n <= max_digits { + *ss = &ss[n..]; + Some(value) + } else { + None + } +} + +fn match_fractional_seconds(ss: &mut &str) -> i32 { + let mut value = 0; + let mut multiplier = NSEC_PER_SEC / 10; + + let mut chars = ss.char_indices(); + let orig = *ss; + for (i, ch) in &mut chars { + *ss = &orig[i..]; + match ch { + '0' ... '9' => { + // This will drop digits after the nanoseconds place + let digit = ch as i32 - '0' as i32; + value += digit * multiplier; + multiplier /= 10; + } + _ => break + } + } + + value +} + +fn match_digits_in_range(ss: &mut &str, + min_digits : usize, max_digits : usize, + ws: bool, min: i32, max: i32) -> Option { + let before = *ss; + match match_digits(ss, min_digits, max_digits, ws) { + Some(val) if val >= min && val <= max => Some(val), + _ => { *ss = before; None } + } +} + +fn parse_char(s: &mut &str, c: char) -> Result<(), ParseError> { + match s.char_indices().next() { + Some((i, c2)) => { + if c == c2 { + *s = &s[i + c2.len_utf8()..]; + Ok(()) + } else { + Err(ParseError::UnexpectedCharacter(c, c2)) + } + } + None => Err(ParseError::InvalidTime), + } +} diff --git a/src/vendor/time/src/sys.rs b/src/vendor/time/src/sys.rs new file mode 100644 index 0000000000..3a7d4348a6 --- /dev/null +++ b/src/vendor/time/src/sys.rs @@ -0,0 +1,891 @@ +#![allow(bad_style)] + +pub use self::inner::*; + +#[cfg(target_os = "redox")] +mod inner { + use std::fmt; + use std::cmp::Ordering; + use std::ops::{Add, Sub}; + use syscall; + + use Duration; + use Tm; + + fn time_to_tm(ts: i64, tm: &mut Tm) { + let leapyear = |year| -> bool { + year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) + }; + + static _ytab: [[i64; 12]; 2] = [ + [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ], + [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ] + ]; + + let mut year = 1970; + + let dayclock = ts % 86400; + let mut dayno = ts / 86400; + + tm.tm_sec = (dayclock % 60) as i32; + tm.tm_min = ((dayclock % 3600) / 60) as i32; + tm.tm_hour = (dayclock / 3600) as i32; + tm.tm_wday = ((dayno + 4) % 7) as i32; + loop { + let yearsize = if leapyear(year) { + 366 + } else { + 365 + }; + if dayno >= yearsize { + dayno -= yearsize; + year += 1; + } else { + break; + } + } + tm.tm_year = (year - 1900) as i32; + tm.tm_yday = dayno as i32; + let mut mon = 0; + while dayno >= _ytab[if leapyear(year) { 1 } else { 0 }][mon] { + dayno -= _ytab[if leapyear(year) { 1 } else { 0 }][mon]; + mon += 1; + } + tm.tm_mon = mon as i32; + tm.tm_mday = dayno as i32 + 1; + tm.tm_isdst = 0; + } + + fn tm_to_time(tm: &Tm) -> i64 { + let mut y = tm.tm_year as i64 + 1900; + let mut m = tm.tm_mon as i64 + 1; + if m <= 2 { + y -= 1; + m += 12; + } + let d = tm.tm_mday as i64; + let h = tm.tm_hour as i64; + let mi = tm.tm_min as i64; + let s = tm.tm_sec as i64; + (365*y + y/4 - y/100 + y/400 + 3*(m+1)/5 + 30*m + d - 719561) + * 86400 + 3600 * h + 60 * mi + s + } + + pub fn time_to_utc_tm(sec: i64, tm: &mut Tm) { + time_to_tm(sec, tm); + } + + pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { + // FIXME: Add timezone logic + time_to_tm(sec, tm); + } + + pub fn utc_tm_to_time(tm: &Tm) -> i64 { + tm_to_time(tm) + } + + pub fn local_tm_to_time(tm: &Tm) -> i64 { + // FIXME: Add timezone logic + tm_to_time(tm) + } + + pub fn get_time() -> (i64, i32) { + let mut tv = syscall::TimeSpec { tv_sec: 0, tv_nsec: 0 }; + syscall::clock_gettime(syscall::CLOCK_REALTIME, &mut tv).unwrap(); + (tv.tv_sec as i64, tv.tv_nsec as i32) + } + + pub fn get_precise_ns() -> u64 { + let mut ts = syscall::TimeSpec { tv_sec: 0, tv_nsec: 0 }; + syscall::clock_gettime(syscall::CLOCK_MONOTONIC, &mut ts).unwrap(); + (ts.tv_sec as u64) * 1000000000 + (ts.tv_nsec as u64) + } + + #[derive(Copy)] + pub struct SteadyTime { + t: syscall::TimeSpec, + } + + impl fmt::Debug for SteadyTime { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "SteadyTime {{ tv_sec: {:?}, tv_nsec: {:?} }}", + self.t.tv_sec, self.t.tv_nsec) + } + } + + impl Clone for SteadyTime { + fn clone(&self) -> SteadyTime { + SteadyTime { t: self.t } + } + } + + impl SteadyTime { + pub fn now() -> SteadyTime { + let mut t = SteadyTime { + t: syscall::TimeSpec { + tv_sec: 0, + tv_nsec: 0, + } + }; + syscall::clock_gettime(syscall::CLOCK_MONOTONIC, &mut t.t).unwrap(); + t + } + } + + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + if self.t.tv_nsec >= other.t.tv_nsec { + Duration::seconds(self.t.tv_sec as i64 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 - other.t.tv_nsec as i64) + } else { + Duration::seconds(self.t.tv_sec as i64 - 1 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 + ::NSEC_PER_SEC as i64 - + other.t.tv_nsec as i64) + } + } + } + + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(mut self, other: Duration) -> SteadyTime { + let seconds = other.num_seconds(); + let nanoseconds = other - Duration::seconds(seconds); + let nanoseconds = nanoseconds.num_nanoseconds().unwrap(); + self.t.tv_sec += seconds; + self.t.tv_nsec += nanoseconds as i32; + if self.t.tv_nsec >= ::NSEC_PER_SEC { + self.t.tv_nsec -= ::NSEC_PER_SEC; + self.t.tv_sec += 1; + } else if self.t.tv_nsec < 0 { + self.t.tv_sec -= 1; + self.t.tv_nsec += ::NSEC_PER_SEC; + } + self + } + } + + impl PartialOrd for SteadyTime { + fn partial_cmp(&self, other: &SteadyTime) -> Option { + Some(self.cmp(other)) + } + } + + impl Ord for SteadyTime { + fn cmp(&self, other: &SteadyTime) -> Ordering { + match self.t.tv_sec.cmp(&other.t.tv_sec) { + Ordering::Equal => self.t.tv_nsec.cmp(&other.t.tv_nsec), + ord => ord + } + } + } + + impl PartialEq for SteadyTime { + fn eq(&self, other: &SteadyTime) -> bool { + self.t.tv_sec == other.t.tv_sec && + self.t.tv_nsec == other.t.tv_nsec + } + } + + impl Eq for SteadyTime {} +} + +#[cfg(unix)] +mod inner { + use libc::{self, time_t}; + use std::mem; + use std::io; + use Tm; + + #[cfg(any(target_os = "macos", target_os = "ios"))] + pub use self::mac::*; + #[cfg(all(not(target_os = "macos"), not(target_os = "ios")))] + pub use self::unix::*; + + #[cfg(target_os = "solaris")] + extern { + static timezone: time_t; + static altzone: time_t; + } + + fn rust_tm_to_tm(rust_tm: &Tm, tm: &mut libc::tm) { + tm.tm_sec = rust_tm.tm_sec; + tm.tm_min = rust_tm.tm_min; + tm.tm_hour = rust_tm.tm_hour; + tm.tm_mday = rust_tm.tm_mday; + tm.tm_mon = rust_tm.tm_mon; + tm.tm_year = rust_tm.tm_year; + tm.tm_wday = rust_tm.tm_wday; + tm.tm_yday = rust_tm.tm_yday; + tm.tm_isdst = rust_tm.tm_isdst; + } + + fn tm_to_rust_tm(tm: &libc::tm, utcoff: i32, rust_tm: &mut Tm) { + rust_tm.tm_sec = tm.tm_sec; + rust_tm.tm_min = tm.tm_min; + rust_tm.tm_hour = tm.tm_hour; + rust_tm.tm_mday = tm.tm_mday; + rust_tm.tm_mon = tm.tm_mon; + rust_tm.tm_year = tm.tm_year; + rust_tm.tm_wday = tm.tm_wday; + rust_tm.tm_yday = tm.tm_yday; + rust_tm.tm_isdst = tm.tm_isdst; + rust_tm.tm_utcoff = utcoff; + } + + #[cfg(any(target_os = "nacl", target_os = "solaris"))] + unsafe fn timegm(tm: *mut libc::tm) -> time_t { + use std::env::{set_var, var_os, remove_var}; + extern { + fn tzset(); + } + + let ret; + + let current_tz = var_os("TZ"); + set_var("TZ", "UTC"); + tzset(); + + ret = libc::mktime(tm); + + if let Some(tz) = current_tz { + set_var("TZ", tz); + } else { + remove_var("TZ"); + } + tzset(); + + ret + } + + pub fn time_to_utc_tm(sec: i64, tm: &mut Tm) { + unsafe { + let sec = sec as time_t; + let mut out = mem::zeroed(); + if libc::gmtime_r(&sec, &mut out).is_null() { + panic!("gmtime_r failed: {}", io::Error::last_os_error()); + } + tm_to_rust_tm(&out, 0, tm); + } + } + + pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { + unsafe { + let sec = sec as time_t; + let mut out = mem::zeroed(); + if libc::localtime_r(&sec, &mut out).is_null() { + panic!("localtime_r failed: {}", io::Error::last_os_error()); + } + #[cfg(target_os = "solaris")] + let gmtoff = { + ::tzset(); + // < 0 means we don't know; assume we're not in DST. + if out.tm_isdst == 0 { + // timezone is seconds west of UTC, tm_gmtoff is seconds east + -timezone + } else if out.tm_isdst > 0 { + -altzone + } else { + -timezone + } + }; + #[cfg(not(target_os = "solaris"))] + let gmtoff = out.tm_gmtoff; + tm_to_rust_tm(&out, gmtoff as i32, tm); + } + } + + pub fn utc_tm_to_time(rust_tm: &Tm) -> i64 { + #[cfg(all(target_os = "android", target_pointer_width = "32"))] + use libc::timegm64 as timegm; + #[cfg(not(any(all(target_os = "android", target_pointer_width = "32"), target_os = "nacl", target_os = "solaris")))] + use libc::timegm; + + let mut tm = unsafe { mem::zeroed() }; + rust_tm_to_tm(rust_tm, &mut tm); + unsafe { timegm(&mut tm) as i64 } + } + + pub fn local_tm_to_time(rust_tm: &Tm) -> i64 { + let mut tm = unsafe { mem::zeroed() }; + rust_tm_to_tm(rust_tm, &mut tm); + unsafe { libc::mktime(&mut tm) as i64 } + } + + #[cfg(any(target_os = "macos", target_os = "ios"))] + mod mac { + use libc::{self, timeval, mach_timebase_info}; + use std::sync::{Once, ONCE_INIT}; + use std::ops::{Add, Sub}; + use Duration; + + fn info() -> &'static mach_timebase_info { + static mut INFO: mach_timebase_info = mach_timebase_info { + numer: 0, + denom: 0, + }; + static ONCE: Once = ONCE_INIT; + + unsafe { + ONCE.call_once(|| { + mach_timebase_info(&mut INFO); + }); + &INFO + } + } + + pub fn get_time() -> (i64, i32) { + use std::ptr; + let mut tv = timeval { tv_sec: 0, tv_usec: 0 }; + unsafe { libc::gettimeofday(&mut tv, ptr::null_mut()); } + (tv.tv_sec as i64, tv.tv_usec * 1000) + } + + pub fn get_precise_ns() -> u64 { + unsafe { + let time = libc::mach_absolute_time(); + let info = info(); + time * info.numer as u64 / info.denom as u64 + } + } + + #[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug)] + pub struct SteadyTime { t: u64 } + + impl SteadyTime { + pub fn now() -> SteadyTime { + SteadyTime { t: get_precise_ns() } + } + } + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + Duration::nanoseconds(self.t as i64 - other.t as i64) + } + } + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(self, other: Duration) -> SteadyTime { + let delta = other.num_nanoseconds().unwrap(); + SteadyTime { + t: (self.t as i64 + delta) as u64 + } + } + } + } + + #[cfg(test)] + pub struct TzReset; + + #[cfg(test)] + pub fn set_los_angeles_time_zone() -> TzReset { + use std::env; + env::set_var("TZ", "America/Los_Angeles"); + ::tzset(); + TzReset + } + + #[cfg(test)] + pub fn set_london_with_dst_time_zone() -> TzReset { + use std::env; + env::set_var("TZ", "Europe/London"); + ::tzset(); + TzReset + } + + #[cfg(all(not(target_os = "macos"), not(target_os = "ios")))] + mod unix { + use std::fmt; + use std::cmp::Ordering; + use std::ops::{Add, Sub}; + use libc; + + use Duration; + + pub fn get_time() -> (i64, i32) { + let mut tv = libc::timespec { tv_sec: 0, tv_nsec: 0 }; + unsafe { libc::clock_gettime(libc::CLOCK_REALTIME, &mut tv); } + (tv.tv_sec as i64, tv.tv_nsec as i32) + } + + pub fn get_precise_ns() -> u64 { + let mut ts = libc::timespec { tv_sec: 0, tv_nsec: 0 }; + unsafe { + libc::clock_gettime(libc::CLOCK_MONOTONIC, &mut ts); + } + (ts.tv_sec as u64) * 1000000000 + (ts.tv_nsec as u64) + } + + #[derive(Copy)] + pub struct SteadyTime { + t: libc::timespec, + } + + impl fmt::Debug for SteadyTime { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "SteadyTime {{ tv_sec: {:?}, tv_nsec: {:?} }}", + self.t.tv_sec, self.t.tv_nsec) + } + } + + impl Clone for SteadyTime { + fn clone(&self) -> SteadyTime { + SteadyTime { t: self.t } + } + } + + impl SteadyTime { + pub fn now() -> SteadyTime { + let mut t = SteadyTime { + t: libc::timespec { + tv_sec: 0, + tv_nsec: 0, + } + }; + unsafe { + assert_eq!(0, libc::clock_gettime(libc::CLOCK_MONOTONIC, + &mut t.t)); + } + t + } + } + + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + if self.t.tv_nsec >= other.t.tv_nsec { + Duration::seconds(self.t.tv_sec as i64 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 - other.t.tv_nsec as i64) + } else { + Duration::seconds(self.t.tv_sec as i64 - 1 - other.t.tv_sec as i64) + + Duration::nanoseconds(self.t.tv_nsec as i64 + ::NSEC_PER_SEC as i64 - + other.t.tv_nsec as i64) + } + } + } + + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(mut self, other: Duration) -> SteadyTime { + let seconds = other.num_seconds(); + let nanoseconds = other - Duration::seconds(seconds); + let nanoseconds = nanoseconds.num_nanoseconds().unwrap(); + self.t.tv_sec += seconds as libc::time_t; + self.t.tv_nsec += nanoseconds as libc::c_long; + if self.t.tv_nsec >= ::NSEC_PER_SEC as libc::c_long { + self.t.tv_nsec -= ::NSEC_PER_SEC as libc::c_long; + self.t.tv_sec += 1; + } else if self.t.tv_nsec < 0 { + self.t.tv_sec -= 1; + self.t.tv_nsec += ::NSEC_PER_SEC as libc::c_long; + } + self + } + } + + impl PartialOrd for SteadyTime { + fn partial_cmp(&self, other: &SteadyTime) -> Option { + Some(self.cmp(other)) + } + } + + impl Ord for SteadyTime { + fn cmp(&self, other: &SteadyTime) -> Ordering { + match self.t.tv_sec.cmp(&other.t.tv_sec) { + Ordering::Equal => self.t.tv_nsec.cmp(&other.t.tv_nsec), + ord => ord + } + } + } + + impl PartialEq for SteadyTime { + fn eq(&self, other: &SteadyTime) -> bool { + self.t.tv_sec == other.t.tv_sec && + self.t.tv_nsec == other.t.tv_nsec + } + } + + impl Eq for SteadyTime {} + + } +} + +#[cfg(windows)] +#[allow(non_snake_case)] +mod inner { + use std::io; + use std::mem; + use std::sync::{Once, ONCE_INIT}; + use std::ops::{Add, Sub}; + use {Tm, Duration}; + + use winapi::um::winnt::*; + use winapi::shared::minwindef::*; + use winapi::um::minwinbase::SYSTEMTIME; + use winapi::um::profileapi::*; + use winapi::um::timezoneapi::*; + use winapi::um::sysinfoapi::GetSystemTimeAsFileTime; + + fn frequency() -> i64 { + static mut FREQUENCY: i64 = 0; + static ONCE: Once = ONCE_INIT; + + unsafe { + ONCE.call_once(|| { + let mut l = i64_to_large_integer(0); + QueryPerformanceFrequency(&mut l); + FREQUENCY = large_integer_to_i64(l); + }); + FREQUENCY + } + } + + fn i64_to_large_integer(i: i64) -> LARGE_INTEGER { + unsafe { + let mut large_integer: LARGE_INTEGER = mem::zeroed(); + *large_integer.QuadPart_mut() = i; + large_integer + } + } + + fn large_integer_to_i64(l: LARGE_INTEGER) -> i64 { + unsafe { + *l.QuadPart() + } + } + + const HECTONANOSECS_IN_SEC: i64 = 10_000_000; + const HECTONANOSEC_TO_UNIX_EPOCH: i64 = 11_644_473_600 * HECTONANOSECS_IN_SEC; + + fn time_to_file_time(sec: i64) -> FILETIME { + let t = (((sec * HECTONANOSECS_IN_SEC) + HECTONANOSEC_TO_UNIX_EPOCH)) as u64; + FILETIME { + dwLowDateTime: t as DWORD, + dwHighDateTime: (t >> 32) as DWORD + } + } + + fn file_time_as_u64(ft: &FILETIME) -> u64 { + ((ft.dwHighDateTime as u64) << 32) | (ft.dwLowDateTime as u64) + } + + fn file_time_to_nsec(ft: &FILETIME) -> i32 { + let t = file_time_as_u64(ft) as i64; + ((t % HECTONANOSECS_IN_SEC) * 100) as i32 + } + + fn file_time_to_unix_seconds(ft: &FILETIME) -> i64 { + let t = file_time_as_u64(ft) as i64; + ((t - HECTONANOSEC_TO_UNIX_EPOCH) / HECTONANOSECS_IN_SEC) as i64 + } + + fn system_time_to_file_time(sys: &SYSTEMTIME) -> FILETIME { + unsafe { + let mut ft = mem::zeroed(); + SystemTimeToFileTime(sys, &mut ft); + ft + } + } + + fn tm_to_system_time(tm: &Tm) -> SYSTEMTIME { + let mut sys: SYSTEMTIME = unsafe { mem::zeroed() }; + sys.wSecond = tm.tm_sec as WORD; + sys.wMinute = tm.tm_min as WORD; + sys.wHour = tm.tm_hour as WORD; + sys.wDay = tm.tm_mday as WORD; + sys.wDayOfWeek = tm.tm_wday as WORD; + sys.wMonth = (tm.tm_mon + 1) as WORD; + sys.wYear = (tm.tm_year + 1900) as WORD; + sys + } + + fn system_time_to_tm(sys: &SYSTEMTIME, tm: &mut Tm) { + tm.tm_sec = sys.wSecond as i32; + tm.tm_min = sys.wMinute as i32; + tm.tm_hour = sys.wHour as i32; + tm.tm_mday = sys.wDay as i32; + tm.tm_wday = sys.wDayOfWeek as i32; + tm.tm_mon = (sys.wMonth - 1) as i32; + tm.tm_year = (sys.wYear - 1900) as i32; + tm.tm_yday = yday(tm.tm_year, tm.tm_mon + 1, tm.tm_mday); + + fn yday(year: i32, month: i32, day: i32) -> i32 { + let leap = if month > 2 { + if year % 4 == 0 { 1 } else { 2 } + } else { + 0 + }; + let july = if month > 7 { 1 } else { 0 }; + + (month - 1) * 30 + month / 2 + (day - 1) - leap + july + } + } + + macro_rules! call { + ($name:ident($($arg:expr),*)) => { + if $name($($arg),*) == 0 { + panic!(concat!(stringify!($name), " failed with: {}"), + io::Error::last_os_error()); + } + } + } + + pub fn time_to_utc_tm(sec: i64, tm: &mut Tm) { + let mut out = unsafe { mem::zeroed() }; + let ft = time_to_file_time(sec); + unsafe { + call!(FileTimeToSystemTime(&ft, &mut out)); + } + system_time_to_tm(&out, tm); + tm.tm_utcoff = 0; + } + + pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { + let ft = time_to_file_time(sec); + unsafe { + let mut utc = mem::zeroed(); + let mut local = mem::zeroed(); + call!(FileTimeToSystemTime(&ft, &mut utc)); + call!(SystemTimeToTzSpecificLocalTime(0 as *const _, + &mut utc, &mut local)); + system_time_to_tm(&local, tm); + + let local = system_time_to_file_time(&local); + let local_sec = file_time_to_unix_seconds(&local); + + let mut tz = mem::zeroed(); + GetTimeZoneInformation(&mut tz); + + // SystemTimeToTzSpecificLocalTime already applied the biases so + // check if it non standard + tm.tm_utcoff = (local_sec - sec) as i32; + tm.tm_isdst = if tm.tm_utcoff == -60 * (tz.Bias + tz.StandardBias) { + 0 + } else { + 1 + }; + } + } + + pub fn utc_tm_to_time(tm: &Tm) -> i64 { + unsafe { + let mut ft = mem::zeroed(); + let sys_time = tm_to_system_time(tm); + call!(SystemTimeToFileTime(&sys_time, &mut ft)); + file_time_to_unix_seconds(&ft) + } + } + + pub fn local_tm_to_time(tm: &Tm) -> i64 { + unsafe { + let mut ft = mem::zeroed(); + let mut utc = mem::zeroed(); + let mut sys_time = tm_to_system_time(tm); + call!(TzSpecificLocalTimeToSystemTime(0 as *mut _, + &mut sys_time, &mut utc)); + call!(SystemTimeToFileTime(&utc, &mut ft)); + file_time_to_unix_seconds(&ft) + } + } + + pub fn get_time() -> (i64, i32) { + unsafe { + let mut ft = mem::zeroed(); + GetSystemTimeAsFileTime(&mut ft); + (file_time_to_unix_seconds(&ft), file_time_to_nsec(&ft)) + } + } + + pub fn get_precise_ns() -> u64 { + let mut ticks = i64_to_large_integer(0); + unsafe { + assert!(QueryPerformanceCounter(&mut ticks) == 1); + } + mul_div_i64(large_integer_to_i64(ticks), 1000000000, frequency()) as u64 + + } + + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] + pub struct SteadyTime { + t: i64, + } + + impl SteadyTime { + pub fn now() -> SteadyTime { + let mut l = i64_to_large_integer(0); + unsafe { QueryPerformanceCounter(&mut l); } + SteadyTime { t : large_integer_to_i64(l) } + } + } + + impl Sub for SteadyTime { + type Output = Duration; + fn sub(self, other: SteadyTime) -> Duration { + let diff = self.t as i64 - other.t as i64; + Duration::nanoseconds(mul_div_i64(diff, 1000000000, + frequency())) + } + } + + impl Sub for SteadyTime { + type Output = SteadyTime; + fn sub(self, other: Duration) -> SteadyTime { + self + -other + } + } + + impl Add for SteadyTime { + type Output = SteadyTime; + fn add(mut self, other: Duration) -> SteadyTime { + self.t += (other.num_microseconds().unwrap() * frequency() / + 1_000_000) as i64; + self + } + } + + #[cfg(test)] + pub struct TzReset { + old: TIME_ZONE_INFORMATION, + } + + #[cfg(test)] + impl Drop for TzReset { + fn drop(&mut self) { + unsafe { + call!(SetTimeZoneInformation(&self.old)); + } + } + } + + #[cfg(test)] + pub fn set_los_angeles_time_zone() -> TzReset { + acquire_privileges(); + + unsafe { + let mut tz = mem::zeroed::(); + GetTimeZoneInformation(&mut tz); + let ret = TzReset { old: tz }; + tz.Bias = 60 * 8; + call!(SetTimeZoneInformation(&tz)); + return ret + } + } + + #[cfg(test)] + pub fn set_london_with_dst_time_zone() -> TzReset { + acquire_privileges(); + + unsafe { + let mut tz = mem::zeroed::(); + GetTimeZoneInformation(&mut tz); + let ret = TzReset { old: tz }; + // Since date set precisely this is 2015's dates + tz.Bias = 0; + tz.DaylightBias = -60; + tz.DaylightDate.wYear = 0; + tz.DaylightDate.wMonth = 3; + tz.DaylightDate.wDayOfWeek = 0; + tz.DaylightDate.wDay = 5; + tz.DaylightDate.wHour = 2; + tz.StandardBias = 0; + tz.StandardDate.wYear = 0; + tz.StandardDate.wMonth = 10; + tz.StandardDate.wDayOfWeek = 0; + tz.StandardDate.wDay = 5; + tz.StandardDate.wHour = 2; + call!(SetTimeZoneInformation(&tz)); + return ret + } + } + + // Ensures that this process has the necessary privileges to set a new time + // zone, and this is all transcribed from: + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724944%28v=vs.85%29.aspx + #[cfg(test)] + fn acquire_privileges() { + use std::sync::{ONCE_INIT, Once}; + use winapi::um::processthreadsapi::*; + use winapi::um::winbase::LookupPrivilegeValueA; + const SE_PRIVILEGE_ENABLED: DWORD = 2; + static INIT: Once = ONCE_INIT; + + // TODO: FIXME + extern "system" { + fn AdjustTokenPrivileges( + TokenHandle: HANDLE, DisableAllPrivileges: BOOL, NewState: PTOKEN_PRIVILEGES, + BufferLength: DWORD, PreviousState: PTOKEN_PRIVILEGES, ReturnLength: PDWORD, + ) -> BOOL; + } + + #[repr(C)] + struct TKP { + tkp: TOKEN_PRIVILEGES, + laa: LUID_AND_ATTRIBUTES, + } + + INIT.call_once(|| unsafe { + let mut hToken = 0 as *mut _; + call!(OpenProcessToken(GetCurrentProcess(), + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, + &mut hToken)); + + let mut tkp = mem::zeroed::(); + assert_eq!(tkp.tkp.Privileges.len(), 0); + let c = ::std::ffi::CString::new("SeTimeZonePrivilege").unwrap(); + call!(LookupPrivilegeValueA(0 as *const _, c.as_ptr(), + &mut tkp.laa.Luid)); + tkp.tkp.PrivilegeCount = 1; + tkp.laa.Attributes = SE_PRIVILEGE_ENABLED; + call!(AdjustTokenPrivileges(hToken, FALSE, &mut tkp.tkp, 0, + 0 as *mut _, 0 as *mut _)); + }); + } + + + + // Computes (value*numer)/denom without overflow, as long as both + // (numer*denom) and the overall result fit into i64 (which is the case + // for our time conversions). + fn mul_div_i64(value: i64, numer: i64, denom: i64) -> i64 { + let q = value / denom; + let r = value % denom; + // Decompose value as (value/denom*denom + value%denom), + // substitute into (value*numer)/denom and simplify. + // r < denom, so (denom*numer) is the upper bound of (r*numer) + q * numer + r * numer / denom + } + + #[test] + fn test_muldiv() { + assert_eq!(mul_div_i64( 1_000_000_000_001, 1_000_000_000, 1_000_000), + 1_000_000_000_001_000); + assert_eq!(mul_div_i64(-1_000_000_000_001, 1_000_000_000, 1_000_000), + -1_000_000_000_001_000); + assert_eq!(mul_div_i64(-1_000_000_000_001,-1_000_000_000, 1_000_000), + 1_000_000_000_001_000); + assert_eq!(mul_div_i64( 1_000_000_000_001, 1_000_000_000,-1_000_000), + -1_000_000_000_001_000); + assert_eq!(mul_div_i64( 1_000_000_000_001,-1_000_000_000,-1_000_000), + 1_000_000_000_001_000); + } +} diff --git a/src/vendor/winapi-0.2.8/.cargo-checksum.json b/src/vendor/winapi-0.2.8/.cargo-checksum.json new file mode 100644 index 0000000000..84d20af66b --- /dev/null +++ b/src/vendor/winapi-0.2.8/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"d15a0464554e57323507a2ff34925a2c592f3dffec9beb092c7ce985440f5bda","LICENSE.md":"fd232cfaeeff018cd3b9f22e0279b1c2237742999277596638800e967f6e4a29","src/activation.rs":"0e25834dfecd59391e2ecfdaa2e01bb5ac4d181778b47d0b9f67c56a6b2bd75f","src/audioclient.rs":"8c645d4ddb171620a527bcc14fa2904ff9aeb529262e68a0a9957d2ed77118be","src/audiosessiontypes.rs":"ba8cd1950cdab112861208ac1ecc35e656cbbe36e60c31315e547cfe47707685","src/basetsd.rs":"7b879d3164d5e6ec1b94d18a6b58f74a7f4e62fc279df32126e76c4f3138239d","src/bcrypt.rs":"05fe44190a37dd744bff8fc682f25a47c5f4239d417b213d18542aaa19b08b06","src/cfg.rs":"057ace203f04f8c09b6f68fefba7d3eb6644c46f2e44ca8f1364a8bc3bdd4970","src/cfgmgr32.rs":"714289f058283fc89fc79bbd4932bdbc0e9a88edd62a1787aac82c338f2dfb45","src/combaseapi.rs":"45458b1e0d918b237afd7e9581e2714b58ee009a91bbec45827694d1159a2e8b","src/commctrl.rs":"c0173aabd50f34a85c2523876fa0191d052d1d0c157f95ed228d98508806cc7d","src/commdlg.rs":"e75f64491eea54f651884eb3cc5353588c7fe54b086b43557d6d4917abbf95cd","src/corsym.rs":"301f937c7cb394675b2127a24595beef261d269d8f7cb45d6b4ac21a063985e3","src/d2d1.rs":"e7aa08883d85e2631f5327541e644b650ad009095daadef606bb06d9ac99afd3","src/d2dbasetypes.rs":"5a26048c997a580d8bb2a3512f1cb20dba411da99ffd6b23f4b0615ab9378058","src/d3d10shader.rs":"d6edf923fa8442be35b7f4ebebcd2e4bec4c3842ed5aee4bfd05c2de11edc4e0","src/d3d11.rs":"3f2f681357730df7ea954fb78903f0f0ad0bb3b577727307e751fd9598a4e837","src/d3d11shader.rs":"29612cc75ba238e2cd691fdcc01be9c79ca12b046e207d3cbfc5af23f04c4cb9","src/d3d12.rs":"906e512385e78756fe84f9a9622c510ce5a6daeb121127cf93f11af0f2fa3763","src/d3d12sdklayers.rs":"b50edb48a1c51bc7e3bf7176733c3dad4eb45a4e9747096e3b5a723052e130c8","src/d3d12shader.rs":"ff58932ef32c108348e41864f09ac6f909d641cac4f94c3e4f6c3dc4e5916521","src/d3d9.rs":"e01614130a4d68bb6e2a23f62ffb4d5016381e9026f8477aaca64851c8dcad53","src/d3d9caps.rs":"d4bcf91b7ae307388c91c19eacdb808506faea184b03178feee5c47959211b7b","src/d3d9types.rs":"1e10aae6297bc8dc083b111da496313ff19dcb9b88450e2637f8e98c0401519c","src/d3dcommon.rs":"f841b2e4df6dfccb9eb1955add24689db7b173780ec25e99b89097140a012152","src/d3dcompiler.rs":"02269410bd7f83f49391f852320ca0d76fd8d907ed22c68a003af65b3f5ab54a","src/dbghelp.rs":"c0ea5bcd04f414a696cd876439a7c4d6ee63627f4662705d189fd6e0412622f8","src/dcommon.rs":"8889ca66e2f89f1c275e5d6b7d6b203e7f25b4e7a262689b2ec6f04b9d1b5ae8","src/devpropdef.rs":"74948513ed623d3bdf1ea3fbf1f540b3e9e46efb9c1674ecccfe7f2fae5792f2","src/docobj.rs":"43e214d9d0c436a88ed2c620b8386e58e4d549ba9c8be51bf52291caf95e225d","src/dpapi.rs":"d44a1a6c9e52b34e8e87df1079b97081c646f07d0eee51f0d0cf66ae1c6fd58a","src/dsgetdc.rs":"5911c35ef3d80a5162fdbea6902f9b07033b746ff91bff2657a0971edb07bff2","src/dsound.rs":"53a5532d645e1b7995f0b4a0f0711fc66da8a27b7f8c87ce3d9e0882cfdca07c","src/dsrole.rs":"50b27a8afb11188ce24ab49620fe69ea21658148d8fd6076b8927175db5c1a9e","src/dwmapi.rs":"e65ca961eec0db275e211e04c59a8995c8c13d36ab08dc36ce197d9a4856266f","src/dwrite.rs":"f138d36e8b93778a7866cc755893b4da19cfd6ce42427139589a0bbaa294eb44","src/dxgi.rs":"5b6fcc5c665df1c0c6ed3de5d678a7bade1bb8ab1acbe952b784ce99fc817e53","src/dxgi1_2.rs":"6ba44755d715f2493236103fc5c24d7d45dff2e1fc3690aefbd4eb6c859dbc07","src/dxgi1_3.rs":"1f86a9db5fd45199fcc3ce56423e5fcf0c58df4001e2b50c5586d38ab820b78f","src/dxgi1_4.rs":"c578e6fcb82d535b20fc10232b75a7b9512d068919cc1e3f1c7cf55f3eb46460","src/dxgiformat.rs":"2e73df34f480b6ef3b5e21de0a520dacec91b00772e42786568fd162ca5e9aa6","src/dxgitype.rs":"204b8dae38c13a1dd8cd2ce6ca68851f743b416213d6db1cd0d96808bcbf7058","src/errhandlingapi.rs":"a70f9db3dd8ab60aba0daf39f12b527e54e312ca640e0b80d80c93ffdb6913c6","src/excpt.rs":"b07cf9ff0d23dd50c0776d048d0c579e401b7d729635f78998f85d35f33f05a4","src/fileapi.rs":"d31814c612bbd9372abbf6f8455fc2af89ac236c6b1855da10d66545e485ec57","src/gl.rs":"9429708bb97aeecb2c40030460ed0c3415fc0f2335c9513c68afa6157bd9b465","src/guiddef.rs":"86618dcd39c77048c7e453e6e86dafe90358eb7f97144f9672ae09e7b9855729","src/heapapi.rs":"21e420ba7641e507e8f2801d2b0ed25dbcb98e967924d711beb5cbfa8a5785e4","src/hidclass.rs":"a93380d35dc4d45807b10bbd69ee63eb8517b75989b68391685070a2fcfbefa1","src/hidpi.rs":"0b641fc119ac35761fe8e5eaed9a0781e9018598ea269d6cd386dbf5563ab9a0","src/hidsdi.rs":"50abb938ea8d0af90ccdea7ac3de4bc10fe42e34bc6a6d6eb4da1b330727da34","src/hidusage.rs":"44adc029bc89f0d4977b1295b7e998ddabf5283de66e1e33146bda8968d1d98b","src/hstring.rs":"51b3e63e3f1ed48f54c63c3e820e0563fb857b2743529d5f947f718d43425b89","src/http.rs":"ebb8b8db9e786e2683ad8b9a9066ef418df773ae7ce4d75f166cb5321f85f5a0","src/imm.rs":"b9277502f17f4cc6bde4f80f722ec1b976913355edbf162814ccfec2b3b080fd","src/inaddr.rs":"938143669da02c83a31d207be11e2176ed5219edf0e6f8f7a5534a5c6c3ce8d1","src/inspectable.rs":"b01f1814a233a77bf9f25c264747252c0464388c7d9c7302e5bde57502b8139b","src/ksmedia.rs":"acb96b1ea0cf3b5397f9037958093c6b4dbb54c4246516e57b9fed055e8e69c1","src/lib.rs":"8a7840b030f56883f68bdf90a1a04df8be2a5e2698a9ea86c73fac59c9f09b6e","src/libloaderapi.rs":"21a5d17c9f8ac4c006b515979964a8870f30710be4482083f45c6a41a16a36ce","src/lmaccess.rs":"712661c871569513334152bdcdf56c07776c560a22cd5b892a0f38e1957e28db","src/lmcons.rs":"3449aab4399cc36e7d7db551e384d82dfa4204178c4cfb9642f90645687fbc81","src/lmdfs.rs":"c351cdb2d10bf3a7c5ce7400dcdca41a792554e21e75fa9e5378ac18d8d3e4e7","src/lmerrlog.rs":"7937928544d27575e302c5e9c5e6803e9033e1f4d715e7ca29be202276d7d7a6","src/lmjoin.rs":"362cdc71f3f50099b862eff0733b3a57dd0f95cac15943135f794424f651b916","src/lsalookup.rs":"4aef1a95033444181f2b2b9df364ea165b0fdedb396c63e5d12db6b7398a3d5f","src/macros.rs":"5dacc570f226b6f1ad31d76a03675f0d182a3d578846920000fabb7cd92fc7f8","src/memoryapi.rs":"2273b8bfd7fc36dcf654c320826952ad502e8922a84174f8c1f7ed08aa555a04","src/minschannel.rs":"139828de63a0a4476de2bee454f5bca5e8a46cc29f1680339bb2804ee2d17322","src/minwinbase.rs":"6cd387a7f79e1a708bc48b5b27eaeaa7aadf0fff7a5e0a76cda0bdf3fa871863","src/minwindef.rs":"47ba4f2ec7789109ae339170715ed76288ae60ee57a4f06d5cc50a0e6855699f","src/mmdeviceapi.rs":"c8b7f7b6b78488d23ccba2b34e8765eac60ec9f08e19c96b377d957f65b1b6d1","src/mmreg.rs":"1621fad6eaa16d1e5ca95055fd11bf066b777b1343625f9fdc74e4d313d60dea","src/mmsystem.rs":"f6a2bff3bf80af1468de2c2a5f7ff2ced2b625adaf24f08f9b303965ed5ee371","src/mscat.rs":"9226a8e30546c4142e4fcdc716f8a15cc7c8081c9e875ec72ff9e8551f86f9a1","src/mssip.rs":"d7e2b91e358ff4986e700396d04f92aa1671aafada0d4889914a413177c091e1","src/nb30.rs":"dd85d7849111f04d33895835269929dc219e04de4373e91468eb053e3e0a5c52","src/ncrypt.rs":"29f168dcddeaa2cb231a7174cec672be83cca192ffc4632cead4c4a25189fb49","src/ntdef.rs":"3be66042d16a862f0fed8f48406b08c3091fbf92885a44efb7747f4a764d7de7","src/ntsecapi.rs":"dfb2cc7e23e8b20fa5ffd30ccecdb81b62d8ffeb68fdf99f93fb141ff4155afd","src/ntstatus.rs":"de6208f4e119a6405c1726433ea5e47a8b5f46b345f5809e9f580cce88360a79","src/oaidl.rs":"640c911e39888928baf77145cca34c1a768bfd759ec9709f70649a2946cb3246","src/objbase.rs":"7c9edb6a9ea72baddb15a6aec3602b3f9e7b1ce969dd655f440eae0ede1372e2","src/objidl.rs":"2a623b989f2a216edca3bd118eceff41267632839a3fd4410df9a7c126a87b64","src/objidlbase.rs":"3415a0bcd1b5b63ff48e17138ff87dae7c31eaeb323ae81f34b6712efade1d04","src/olectl.rs":"da2014c3d5858c5abff1635e1b8c8223333e7d22d28cac614aac3305a7f04ee4","src/pdh.rs":"eb01459c2acc456ecd204c6716d26027a6c77c2b4a9b698d3c922254fe2cc319","src/playsoundapi.rs":"7efddfc8601de565946c8c93074211c83b20866a1588e36e0518bba9864d0cf0","src/processsnapshot.rs":"df99a56280e6e41c5896341ffa1abe734f6c8662f4d7ea960cb97fb34c5b85d9","src/processthreadsapi.rs":"bf8edf8984ee97bc5054e68d02ec4633b5f15720602ab19c95d78e7d420c9cc8","src/propidl.rs":"88b5f176e4624063cadd8db95db52bf07cff421d73a8cfe319f992a9c99cd315","src/propsys.rs":"05c411639479f88e77383c585117a886f48ea7453260210db9f283e2cafdffbf","src/prsht.rs":"f862538c0010a51a02e5f24b3a44b54ba5993c32400b98a3b0558741ae7473a3","src/psapi.rs":"512523c5f8334c9ad221a73776c0ed2da93d8e2353dc4d2cee951ffa6ea7c163","src/qos.rs":"9ef6183b7c03b5b412f81f38ebb06048ff6266032bc236964dd994f173b82ec4","src/reason.rs":"c92aded3bbea859f110eed73b9b0fb40df6ac4a6ed6431ca69882b46b5ad5229","src/restrictederrorinfo.rs":"b8c53f4ae149ea806028cdafe699390a20202d72028b5f62836bcbf97720d133","src/roapi.rs":"dbbefb19f402a2aece66b500739b0a9e2c4d0133a8bc94d076510d5a67def175","src/roerrorapi.rs":"84a0a71a3f9ce67a577954ee5761cbd97d892eb5e7eb2c381f6bd29d4e1d4af7","src/rpc.rs":"e2293651222edf37f3ad3076adaae9033b25b06bd7b88ed7372585a4ae46c7d9","src/rpcdce.rs":"de77ca3c9b689ffaaf395a6882d3dfc3a1cec181efa6cb6075e605e4462bc3f6","src/sapi.rs":"05dbc1166b836251538c9e52a772fa584a1d0a1ad823e4336ab5e6cfefb96d57","src/schannel.rs":"e48926896227ffae5033bd634a7c71f5359d7a08b7b8c6e94e03864d87a37f8b","src/servprov.rs":"f086b4330162c7da711ea59d7023304a8fa2a53470b54d846ea1c11567703693","src/setupapi.rs":"4959862dd39597cd711022fcefbaf5c75b61410d57d04e9dbec2ddf7a2fa6f31","src/shellapi.rs":"ce3e3e7cd8aefe8068d6c51256827c0c3d51a449e4ab73e7125ea28d44dd6b6d","src/shellscalingapi.rs":"59c162b0215ff4b71b3535b6e142cca8cd99028031f47f0a6efb960c160a8776","src/shlguid.rs":"dcb7a1ada1b1b90f405e6dea8bcf1fc6994725b49a3165b7908670b2c31490e5","src/shlobj.rs":"53ff059ec6123001bed8f007c36e40812f83e4e04bd50b371319d10b4e38c36f","src/shobjidl.rs":"953d6ef4dc2a0d175d7133dc2f41255123ab8f778b22feaebd8ca1fa77356aa7","src/shtypes.rs":"ff785004e819bcfc521ab79327e58f98debab4e40c20412bbecdcee1b2801371","src/spapidef.rs":"9abe751425b6aaac7e4a7ea49f6d8e859f8f73164abd4d69b48e3e224d7de829","src/sql.rs":"004ed353b40bb4bceab55d6e8c33063a8eac992b076e47e6ead8303dbbc5b67f","src/sqltypes.rs":"0c5fa183c9f5b9e16e292de6a9afdf73f554730e651250856148ac04718803b8","src/sspi.rs":"dbd9d544abea4396983867ef4f7fbe2588673cc953dbeb74e7edc46503b16fa0","src/strmif.rs":"168040999cf99843cc1447988e46c56481a7a343ae41ab854db40ef566fa1119","src/subauth.rs":"183dd0df6436e9f0e859d62ca78e8ed42d4c1a5dc0690dcf22d42467fd2e0700","src/synchapi.rs":"cfce677c85377a340cb9307d9ac9eb06ffe9fd5e2ce08ed4a0390729e3a7d717","src/sysinfoapi.rs":"9a5579143263ce20d8c365b9874a0ae90ef28bc3295eab26ba3782efa48b464a","src/threadpoolapi.rs":"57876ea70b86d08663f7916ce076547f17596c26b8bf4dfafbad60e78264ff95","src/timezoneapi.rs":"5ccd80e6d16a858c56e20a7f3c5570e29777dab0fdfc057b6d2fb06463d56eb3","src/tlhelp32.rs":"c96ef7416bceab473463cc4ad98f037aeaac87bb7adf45cc16c281308537e82f","src/unknwnbase.rs":"2708c19491deb7364100025f3bb88a791c219551a65af70a776f8f3c5bf18b05","src/urlhist.rs":"8c8c0d0a613e59f68bf0e8cec061ea2126baa98d1479df4d07c8df5e41b50bc1","src/urlmon.rs":"0652e602ef2f5826360e5eab68bdf4f9365827a012c2c89289c54016ea001b74","src/usb.rs":"7e682ee819b237eabe796e604cff2434c450f724f4c86d919683eb7a5167c343","src/usbspec.rs":"d19671960838eb592cda4cd7c84c6f66cd9484f0904b5a28e1d8fd91e9c2c6af","src/usp10.rs":"baa2c1ef6ca5f064bc55b24f39c0553ede45a87b9183318572916fd4f1c679c6","src/vadefs.rs":"0e2f12fd1c521a943908669b2d10fceea409bac45242ec6e87c0e69706c1b3d0","src/vsbackup.rs":"af71cb851bd7eacde9d3e46a112497baef3ecebb472aae3c76c7faff804d33f9","src/vss.rs":"a626613810a69309b8f50d0a3bd75928d9de771c2287b6242487cb8cd55394a0","src/vsserror.rs":"f06b108d66ea9f06ad15d83b981117ed6a2a9cd218bb3bf53f13b0055acd9b2e","src/vswriter.rs":"8c4f5d27fa0883d187506538136cc610074941bb952afbe0984f7cb7c3c656f7","src/werapi.rs":"a2d692514ff3a61126971c5c2c5a7298c0f822559550a7f14501f8c96d1d951a","src/winbase.rs":"e224c40d827b1f1a9c74643c000f71e87ad18f749810cc611425af325c9472b8","src/wincon.rs":"402c5ebf80aa6ab1002935b7ddca17e8a243d0c714982054395862fe0ae40a04","src/wincred.rs":"e5fa987622dd880151ae190bb45daa666ffae3ae8e2da97407210afe01dd93d6","src/wincrypt.rs":"f7f8743b6a89d3f5e8b07405e43010bb3729aa8a8cf4546cc02705f802947ebc","src/windef.rs":"89fa9f5ab2909a4840f16979ebbc0afa2134abcb1d47cb7435b581f31b227658","src/windowscodecs.rs":"7c63bc4e2d0e7ce60c7bb13b93ef5aa12213f71a46845b6e034a9c224ef3eb3c","src/windowsx.rs":"414a9a841590f88804da3eb9ba55d583372a467cc50ab1ebdd7cfc653ce5f627","src/winerror.rs":"f3882eba4e299acbdedd548feb1ff89de958fb72d665bd6ba013b6a1f7596b52","src/winevt.rs":"64ae96f475ed98da7a84704d53d16caccbac2dbd525de0ef0f65fc58a6775ed1","src/wingdi.rs":"35aa9dd14b4b4c5a227ac3df0d312c19cbaede2d1388c26ad8eb910e80efeafd","src/winhttp.rs":"37769be104a2eb9efa70ffd74c8f38a09d9639cf575a677ad75d941e8d87cd58","src/winioctl.rs":"0f0efe0a41894a325b70428d04aeddec8dd7a87a91489a4e564a248e8498861b","src/winnetwk.rs":"d492c3d14a422f611166d39b895ddc6dd749ebc64a020bf3125af452494f91dd","src/winnls.rs":"90904d6adad70081a620165223fb4a71b64d747596c64d0df7de9511cd0f75c6","src/winnt.rs":"2c51ad0a065006010f1cfe7a3335274304e4747adc63f9798e1ca1f7091154a5","src/winreg.rs":"c687a5c6433daa13793815ef9af8befaedc9635be14eea0c618ad5334952dc31","src/winscard.rs":"78ab1d3ae22e486726740c343a4cc6268ca318de43f4b7d7ba51acbdf1b93936","src/winsmcrd.rs":"62be129c3d4cdea9dd31e769b587f071a94c347c8df71a43bb1eea18d52a60cc","src/winsock2.rs":"21dc0393f37f56c15c59d49a32861fb24c8f28d43ce26b56d958a174a5040a76","src/winspool.rs":"a3bd8e04f2db6118fe529bf52cb856a773cd8b816d197fc8edc8ac942578fd74","src/winstring.rs":"dc535f972d93be2fe067a5ca64edb45b6ad8e4549ecc0ce24486bd94555d5707","src/winsvc.rs":"7999f00b341f3e0e8701ea89f71986a6600650ff8cffdb1292e9f55d47bd0a3e","src/winusb.rs":"0ac355aa879a4aae501db04f1e8859dbef5e33fda9d46a7a12ef25e5524ec396","src/winusbio.rs":"8e2d64832999b59b2ea900396184c36d34cf94c97f31e15916c299213748a3e1","src/winuser.rs":"791bd8625812feccc8ec421489194d635c94cb4c4d754287a0caa54fa8f71c19","src/ws2def.rs":"0a1c7a69e4da8edc0584b0e3fb4ad1fa4aed621510b1bc1b0d104990577c6a38","src/ws2ipdef.rs":"c6a898cf25d187ad83e110af1e2286824868691a60818ecc44e68fa0bbbd4ff6","src/ws2spi.rs":"e63da700de55a317769230319eb9e4ec85cc0ac80b2baa076399367338b7ca0f","src/ws2tcpip.rs":"698084fd5d631a2ef236fe76001e7c44afd9b8958243e4ad4c098ac4beb4b352","src/wtypes.rs":"2689e8f442ccdc0b0e1ec82160a5cc3e80abf95dca82855ec595314062774a14","src/wtypesbase.rs":"f6dc0a8b09f3f003339c5dd366bdddb9dd671894be9dcf4a42058b226d2917a8","src/xinput.rs":"e15cd46bf18977481e22d609f8e0bb5508776902d7fa64477bb5b78596c0f67d"},"package":"167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"} \ No newline at end of file diff --git a/src/vendor/winapi-0.2.8/.cargo-ok b/src/vendor/winapi-0.2.8/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/winapi-0.2.8/Cargo.toml b/src/vendor/winapi-0.2.8/Cargo.toml new file mode 100644 index 0000000000..941a659b0f --- /dev/null +++ b/src/vendor/winapi-0.2.8/Cargo.toml @@ -0,0 +1,61 @@ +[package] +name = "winapi" +version = "0.2.8" +authors = ["Peter Atashian "] +description = "Types and constants for WinAPI bindings. See README for list of crates providing function bindings." +documentation = "https://retep998.github.io/doc/winapi/" +repository = "https://github.com/retep998/winapi-rs" +readme = "README.md" +keywords = ["windows", "ffi", "win32", "com", "directx"] +license = "MIT" +include = ["src/**/*", "Cargo.toml", "LICENSE.md"] + +[dev-dependencies] +advapi32-sys = { version = "0", path = "lib/advapi32" } +bcrypt-sys = { version = "0", path = "lib/bcrypt" } +comctl32-sys = { version = "0", path = "lib/comctl32" } +comdlg32-sys = { version = "0", path = "lib/comdlg32" } +credui-sys = { version = "0", path = "lib/credui" } +crypt32-sys = { version = "0", path = "lib/crypt32" } +d2d1-sys = { version = "0", path = "lib/d2d1" } +d3d11-sys = { version = "0", path = "lib/d3d11" } +d3d12-sys = { version = "0", path = "lib/d3d12" } +d3d9-sys = { version = "0", path = "lib/d3d9" } +d3dcompiler-sys = { version = "0", path = "lib/d3dcompiler" } +dbghelp-sys = { version = "0", path = "lib/dbghelp" } +dsound-sys = { version = "0", path = "lib/dsound" } +dwmapi-sys = { version = "0", path = "lib/dwmapi" } +dwrite-sys = { version = "0", path = "lib/dwrite" } +dxgi-sys = { version = "0", path = "lib/dxgi" } +dxguid-sys = { version = "0", path = "lib/dxguid" } +gdi32-sys = { version = "0", path = "lib/gdi32" } +hid-sys = { version = "0", path = "lib/hid" } +httpapi-sys = { version = "0", path = "lib/httpapi" } +kernel32-sys = { version = "0", path = "lib/kernel32" } +ktmw32-sys = { version = "0", path = "lib/ktmw32" } +mpr-sys = { version = "0", path = "lib/mpr" } +netapi32-sys = { version = "0", path = "lib/netapi32" } +odbc32-sys = { version = "0", path = "lib/odbc32" } +ole32-sys = { version = "0", path = "lib/ole32" } +oleaut32-sys = { version = "0", path = "lib/oleaut32" } +opengl32-sys = { version = "0", path = "lib/opengl32" } +pdh-sys = { version = "0", path = "lib/pdh" } +psapi-sys = { version = "0", path = "lib/psapi" } +runtimeobject-sys = { version = "0", path = "lib/runtimeobject" } +secur32-sys = { version = "0", path = "lib/secur32" } +setupapi-sys = { version = "0", path = "lib/setupapi" } +shell32-sys = { version = "0", path = "lib/shell32" } +shlwapi-sys = { version = "0", path = "lib/shlwapi" } +user32-sys = { version = "0", path = "lib/user32" } +userenv-sys = { version = "0", path = "lib/userenv" } +usp10-sys = { version = "0", path = "lib/usp10" } +uuid-sys = { version = "0", path = "lib/uuid" } +vssapi-sys = { version = "0", path = "lib/vssapi" } +wevtapi-sys = { version = "0", path = "lib/wevtapi" } +winhttp-sys = { version = "0", path = "lib/winhttp" } +winmm-sys = { version = "0", path = "lib/winmm" } +winscard-sys = { version = "0", path = "lib/winscard" } +winspool-sys = { version = "0", path = "lib/winspool" } +winusb-sys = { version = "0", path = "lib/winusb" } +ws2_32-sys = { version = "0", path = "lib/ws2_32" } +xinput-sys = { version = "0", path = "lib/xinput" } diff --git a/src/vendor/winapi/LICENSE.md b/src/vendor/winapi-0.2.8/LICENSE.md similarity index 100% rename from src/vendor/winapi/LICENSE.md rename to src/vendor/winapi-0.2.8/LICENSE.md diff --git a/src/vendor/winapi/src/activation.rs b/src/vendor/winapi-0.2.8/src/activation.rs similarity index 100% rename from src/vendor/winapi/src/activation.rs rename to src/vendor/winapi-0.2.8/src/activation.rs diff --git a/src/vendor/winapi/src/audioclient.rs b/src/vendor/winapi-0.2.8/src/audioclient.rs similarity index 100% rename from src/vendor/winapi/src/audioclient.rs rename to src/vendor/winapi-0.2.8/src/audioclient.rs diff --git a/src/vendor/winapi/src/audiosessiontypes.rs b/src/vendor/winapi-0.2.8/src/audiosessiontypes.rs similarity index 100% rename from src/vendor/winapi/src/audiosessiontypes.rs rename to src/vendor/winapi-0.2.8/src/audiosessiontypes.rs diff --git a/src/vendor/winapi/src/basetsd.rs b/src/vendor/winapi-0.2.8/src/basetsd.rs similarity index 100% rename from src/vendor/winapi/src/basetsd.rs rename to src/vendor/winapi-0.2.8/src/basetsd.rs diff --git a/src/vendor/winapi/src/bcrypt.rs b/src/vendor/winapi-0.2.8/src/bcrypt.rs similarity index 100% rename from src/vendor/winapi/src/bcrypt.rs rename to src/vendor/winapi-0.2.8/src/bcrypt.rs diff --git a/src/vendor/winapi/src/cfg.rs b/src/vendor/winapi-0.2.8/src/cfg.rs similarity index 100% rename from src/vendor/winapi/src/cfg.rs rename to src/vendor/winapi-0.2.8/src/cfg.rs diff --git a/src/vendor/winapi/src/cfgmgr32.rs b/src/vendor/winapi-0.2.8/src/cfgmgr32.rs similarity index 100% rename from src/vendor/winapi/src/cfgmgr32.rs rename to src/vendor/winapi-0.2.8/src/cfgmgr32.rs diff --git a/src/vendor/winapi/src/combaseapi.rs b/src/vendor/winapi-0.2.8/src/combaseapi.rs similarity index 100% rename from src/vendor/winapi/src/combaseapi.rs rename to src/vendor/winapi-0.2.8/src/combaseapi.rs diff --git a/src/vendor/winapi/src/commctrl.rs b/src/vendor/winapi-0.2.8/src/commctrl.rs similarity index 100% rename from src/vendor/winapi/src/commctrl.rs rename to src/vendor/winapi-0.2.8/src/commctrl.rs diff --git a/src/vendor/winapi/src/commdlg.rs b/src/vendor/winapi-0.2.8/src/commdlg.rs similarity index 100% rename from src/vendor/winapi/src/commdlg.rs rename to src/vendor/winapi-0.2.8/src/commdlg.rs diff --git a/src/vendor/winapi/src/corsym.rs b/src/vendor/winapi-0.2.8/src/corsym.rs similarity index 100% rename from src/vendor/winapi/src/corsym.rs rename to src/vendor/winapi-0.2.8/src/corsym.rs diff --git a/src/vendor/winapi/src/d2d1.rs b/src/vendor/winapi-0.2.8/src/d2d1.rs similarity index 100% rename from src/vendor/winapi/src/d2d1.rs rename to src/vendor/winapi-0.2.8/src/d2d1.rs diff --git a/src/vendor/winapi/src/d2dbasetypes.rs b/src/vendor/winapi-0.2.8/src/d2dbasetypes.rs similarity index 100% rename from src/vendor/winapi/src/d2dbasetypes.rs rename to src/vendor/winapi-0.2.8/src/d2dbasetypes.rs diff --git a/src/vendor/winapi/src/d3d10shader.rs b/src/vendor/winapi-0.2.8/src/d3d10shader.rs similarity index 100% rename from src/vendor/winapi/src/d3d10shader.rs rename to src/vendor/winapi-0.2.8/src/d3d10shader.rs diff --git a/src/vendor/winapi/src/d3d11.rs b/src/vendor/winapi-0.2.8/src/d3d11.rs similarity index 100% rename from src/vendor/winapi/src/d3d11.rs rename to src/vendor/winapi-0.2.8/src/d3d11.rs diff --git a/src/vendor/winapi/src/d3d11shader.rs b/src/vendor/winapi-0.2.8/src/d3d11shader.rs similarity index 100% rename from src/vendor/winapi/src/d3d11shader.rs rename to src/vendor/winapi-0.2.8/src/d3d11shader.rs diff --git a/src/vendor/winapi/src/d3d12.rs b/src/vendor/winapi-0.2.8/src/d3d12.rs similarity index 100% rename from src/vendor/winapi/src/d3d12.rs rename to src/vendor/winapi-0.2.8/src/d3d12.rs diff --git a/src/vendor/winapi/src/d3d12sdklayers.rs b/src/vendor/winapi-0.2.8/src/d3d12sdklayers.rs similarity index 100% rename from src/vendor/winapi/src/d3d12sdklayers.rs rename to src/vendor/winapi-0.2.8/src/d3d12sdklayers.rs diff --git a/src/vendor/winapi/src/d3d12shader.rs b/src/vendor/winapi-0.2.8/src/d3d12shader.rs similarity index 100% rename from src/vendor/winapi/src/d3d12shader.rs rename to src/vendor/winapi-0.2.8/src/d3d12shader.rs diff --git a/src/vendor/winapi/src/d3d9.rs b/src/vendor/winapi-0.2.8/src/d3d9.rs similarity index 100% rename from src/vendor/winapi/src/d3d9.rs rename to src/vendor/winapi-0.2.8/src/d3d9.rs diff --git a/src/vendor/winapi/src/d3d9caps.rs b/src/vendor/winapi-0.2.8/src/d3d9caps.rs similarity index 100% rename from src/vendor/winapi/src/d3d9caps.rs rename to src/vendor/winapi-0.2.8/src/d3d9caps.rs diff --git a/src/vendor/winapi/src/d3d9types.rs b/src/vendor/winapi-0.2.8/src/d3d9types.rs similarity index 100% rename from src/vendor/winapi/src/d3d9types.rs rename to src/vendor/winapi-0.2.8/src/d3d9types.rs diff --git a/src/vendor/winapi/src/d3dcommon.rs b/src/vendor/winapi-0.2.8/src/d3dcommon.rs similarity index 100% rename from src/vendor/winapi/src/d3dcommon.rs rename to src/vendor/winapi-0.2.8/src/d3dcommon.rs diff --git a/src/vendor/winapi/src/d3dcompiler.rs b/src/vendor/winapi-0.2.8/src/d3dcompiler.rs similarity index 100% rename from src/vendor/winapi/src/d3dcompiler.rs rename to src/vendor/winapi-0.2.8/src/d3dcompiler.rs diff --git a/src/vendor/winapi/src/dbghelp.rs b/src/vendor/winapi-0.2.8/src/dbghelp.rs similarity index 100% rename from src/vendor/winapi/src/dbghelp.rs rename to src/vendor/winapi-0.2.8/src/dbghelp.rs diff --git a/src/vendor/winapi/src/dcommon.rs b/src/vendor/winapi-0.2.8/src/dcommon.rs similarity index 100% rename from src/vendor/winapi/src/dcommon.rs rename to src/vendor/winapi-0.2.8/src/dcommon.rs diff --git a/src/vendor/winapi/src/devpropdef.rs b/src/vendor/winapi-0.2.8/src/devpropdef.rs similarity index 100% rename from src/vendor/winapi/src/devpropdef.rs rename to src/vendor/winapi-0.2.8/src/devpropdef.rs diff --git a/src/vendor/winapi/src/docobj.rs b/src/vendor/winapi-0.2.8/src/docobj.rs similarity index 100% rename from src/vendor/winapi/src/docobj.rs rename to src/vendor/winapi-0.2.8/src/docobj.rs diff --git a/src/vendor/winapi/src/dpapi.rs b/src/vendor/winapi-0.2.8/src/dpapi.rs similarity index 100% rename from src/vendor/winapi/src/dpapi.rs rename to src/vendor/winapi-0.2.8/src/dpapi.rs diff --git a/src/vendor/winapi/src/dsgetdc.rs b/src/vendor/winapi-0.2.8/src/dsgetdc.rs similarity index 100% rename from src/vendor/winapi/src/dsgetdc.rs rename to src/vendor/winapi-0.2.8/src/dsgetdc.rs diff --git a/src/vendor/winapi/src/dsound.rs b/src/vendor/winapi-0.2.8/src/dsound.rs similarity index 100% rename from src/vendor/winapi/src/dsound.rs rename to src/vendor/winapi-0.2.8/src/dsound.rs diff --git a/src/vendor/winapi/src/dsrole.rs b/src/vendor/winapi-0.2.8/src/dsrole.rs similarity index 100% rename from src/vendor/winapi/src/dsrole.rs rename to src/vendor/winapi-0.2.8/src/dsrole.rs diff --git a/src/vendor/winapi/src/dwmapi.rs b/src/vendor/winapi-0.2.8/src/dwmapi.rs similarity index 100% rename from src/vendor/winapi/src/dwmapi.rs rename to src/vendor/winapi-0.2.8/src/dwmapi.rs diff --git a/src/vendor/winapi/src/dwrite.rs b/src/vendor/winapi-0.2.8/src/dwrite.rs similarity index 100% rename from src/vendor/winapi/src/dwrite.rs rename to src/vendor/winapi-0.2.8/src/dwrite.rs diff --git a/src/vendor/winapi/src/dxgi.rs b/src/vendor/winapi-0.2.8/src/dxgi.rs similarity index 100% rename from src/vendor/winapi/src/dxgi.rs rename to src/vendor/winapi-0.2.8/src/dxgi.rs diff --git a/src/vendor/winapi/src/dxgi1_2.rs b/src/vendor/winapi-0.2.8/src/dxgi1_2.rs similarity index 100% rename from src/vendor/winapi/src/dxgi1_2.rs rename to src/vendor/winapi-0.2.8/src/dxgi1_2.rs diff --git a/src/vendor/winapi/src/dxgi1_3.rs b/src/vendor/winapi-0.2.8/src/dxgi1_3.rs similarity index 100% rename from src/vendor/winapi/src/dxgi1_3.rs rename to src/vendor/winapi-0.2.8/src/dxgi1_3.rs diff --git a/src/vendor/winapi/src/dxgi1_4.rs b/src/vendor/winapi-0.2.8/src/dxgi1_4.rs similarity index 100% rename from src/vendor/winapi/src/dxgi1_4.rs rename to src/vendor/winapi-0.2.8/src/dxgi1_4.rs diff --git a/src/vendor/winapi/src/dxgiformat.rs b/src/vendor/winapi-0.2.8/src/dxgiformat.rs similarity index 100% rename from src/vendor/winapi/src/dxgiformat.rs rename to src/vendor/winapi-0.2.8/src/dxgiformat.rs diff --git a/src/vendor/winapi/src/dxgitype.rs b/src/vendor/winapi-0.2.8/src/dxgitype.rs similarity index 100% rename from src/vendor/winapi/src/dxgitype.rs rename to src/vendor/winapi-0.2.8/src/dxgitype.rs diff --git a/src/vendor/winapi/src/errhandlingapi.rs b/src/vendor/winapi-0.2.8/src/errhandlingapi.rs similarity index 100% rename from src/vendor/winapi/src/errhandlingapi.rs rename to src/vendor/winapi-0.2.8/src/errhandlingapi.rs diff --git a/src/vendor/winapi/src/excpt.rs b/src/vendor/winapi-0.2.8/src/excpt.rs similarity index 100% rename from src/vendor/winapi/src/excpt.rs rename to src/vendor/winapi-0.2.8/src/excpt.rs diff --git a/src/vendor/winapi/src/fileapi.rs b/src/vendor/winapi-0.2.8/src/fileapi.rs similarity index 100% rename from src/vendor/winapi/src/fileapi.rs rename to src/vendor/winapi-0.2.8/src/fileapi.rs diff --git a/src/vendor/winapi/src/gl.rs b/src/vendor/winapi-0.2.8/src/gl.rs similarity index 100% rename from src/vendor/winapi/src/gl.rs rename to src/vendor/winapi-0.2.8/src/gl.rs diff --git a/src/vendor/winapi/src/guiddef.rs b/src/vendor/winapi-0.2.8/src/guiddef.rs similarity index 100% rename from src/vendor/winapi/src/guiddef.rs rename to src/vendor/winapi-0.2.8/src/guiddef.rs diff --git a/src/vendor/winapi/src/heapapi.rs b/src/vendor/winapi-0.2.8/src/heapapi.rs similarity index 100% rename from src/vendor/winapi/src/heapapi.rs rename to src/vendor/winapi-0.2.8/src/heapapi.rs diff --git a/src/vendor/winapi/src/hidclass.rs b/src/vendor/winapi-0.2.8/src/hidclass.rs similarity index 100% rename from src/vendor/winapi/src/hidclass.rs rename to src/vendor/winapi-0.2.8/src/hidclass.rs diff --git a/src/vendor/winapi/src/hidpi.rs b/src/vendor/winapi-0.2.8/src/hidpi.rs similarity index 100% rename from src/vendor/winapi/src/hidpi.rs rename to src/vendor/winapi-0.2.8/src/hidpi.rs diff --git a/src/vendor/winapi/src/hidsdi.rs b/src/vendor/winapi-0.2.8/src/hidsdi.rs similarity index 100% rename from src/vendor/winapi/src/hidsdi.rs rename to src/vendor/winapi-0.2.8/src/hidsdi.rs diff --git a/src/vendor/winapi/src/hidusage.rs b/src/vendor/winapi-0.2.8/src/hidusage.rs similarity index 100% rename from src/vendor/winapi/src/hidusage.rs rename to src/vendor/winapi-0.2.8/src/hidusage.rs diff --git a/src/vendor/winapi/src/hstring.rs b/src/vendor/winapi-0.2.8/src/hstring.rs similarity index 100% rename from src/vendor/winapi/src/hstring.rs rename to src/vendor/winapi-0.2.8/src/hstring.rs diff --git a/src/vendor/winapi/src/http.rs b/src/vendor/winapi-0.2.8/src/http.rs similarity index 100% rename from src/vendor/winapi/src/http.rs rename to src/vendor/winapi-0.2.8/src/http.rs diff --git a/src/vendor/winapi/src/imm.rs b/src/vendor/winapi-0.2.8/src/imm.rs similarity index 100% rename from src/vendor/winapi/src/imm.rs rename to src/vendor/winapi-0.2.8/src/imm.rs diff --git a/src/vendor/winapi/src/inaddr.rs b/src/vendor/winapi-0.2.8/src/inaddr.rs similarity index 100% rename from src/vendor/winapi/src/inaddr.rs rename to src/vendor/winapi-0.2.8/src/inaddr.rs diff --git a/src/vendor/winapi/src/inspectable.rs b/src/vendor/winapi-0.2.8/src/inspectable.rs similarity index 100% rename from src/vendor/winapi/src/inspectable.rs rename to src/vendor/winapi-0.2.8/src/inspectable.rs diff --git a/src/vendor/winapi/src/ksmedia.rs b/src/vendor/winapi-0.2.8/src/ksmedia.rs similarity index 100% rename from src/vendor/winapi/src/ksmedia.rs rename to src/vendor/winapi-0.2.8/src/ksmedia.rs diff --git a/src/vendor/winapi-0.2.8/src/lib.rs b/src/vendor/winapi-0.2.8/src/lib.rs new file mode 100644 index 0000000000..0e99f815a8 --- /dev/null +++ b/src/vendor/winapi-0.2.8/src/lib.rs @@ -0,0 +1,368 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Types and constants for WinAPI bindings. +#![allow(bad_style)] +#![warn(trivial_casts, trivial_numeric_casts)] +#![warn(unused_qualifications, unused)] +#![cfg(windows)] +//------------------------------------------------------------------------------------------------- +// Imports +//------------------------------------------------------------------------------------------------- +pub use std::os::raw::{ + c_void, + c_char, + c_schar, + c_uchar, + c_short, + c_ushort, + c_int, + c_uint, + c_long, + c_ulong, + c_longlong, + c_ulonglong, + c_float, + c_double, +}; +pub use activation::*; +pub use audioclient::*; +pub use audiosessiontypes::*; +pub use basetsd::*; +pub use bcrypt::*; +pub use cfg::*; +pub use cfgmgr32::*; +pub use combaseapi::*; +pub use commctrl::*; +pub use commdlg::*; +pub use corsym::*; +pub use d2d1::*; +pub use d2dbasetypes::*; +pub use d3d9::*; +pub use d3d9caps::*; +pub use d3d9types::*; +pub use d3d11::*; +pub use d3d10shader::*; +pub use d3d11shader::*; +pub use d3d12::*; +pub use d3d12sdklayers::*; +pub use d3d12shader::*; +pub use d3dcommon::*; +pub use d3dcompiler::*; +pub use dbghelp::*; +pub use dcommon::*; +pub use devpropdef::*; +pub use docobj::*; +pub use dpapi::*; +pub use dsgetdc::*; +pub use dsound::*; +pub use dsrole::*; +pub use dwmapi::*; +pub use dwrite::*; +pub use dxgi::*; +pub use dxgi1_2::*; +pub use dxgi1_3::*; +pub use dxgi1_4::*; +pub use dxgiformat::*; +pub use dxgitype::*; +pub use errhandlingapi::*; +pub use excpt::*; +pub use fileapi::*; +pub use gl::*; +pub use guiddef::*; +pub use heapapi::*; +pub use hidclass::*; +pub use hidpi::*; +pub use hidsdi::*; +pub use hidusage::*; +pub use hstring::*; +pub use http::*; +pub use imm::*; +pub use inaddr::*; +pub use inspectable::*; +pub use ksmedia::*; +pub use libloaderapi::*; +pub use lmaccess::*; +pub use lmcons::*; +pub use lmdfs::*; +pub use lmerrlog::*; +pub use lmjoin::*; +pub use lsalookup::*; +pub use memoryapi::*; +pub use minschannel::*; +pub use minwinbase::*; +pub use minwindef::*; +pub use mmdeviceapi::*; +pub use mmreg::*; +pub use mmsystem::*; +pub use mscat::*; +pub use mssip::*; +pub use nb30::*; +pub use ncrypt::*; +pub use ntdef::*; +pub use ntsecapi::*; +pub use ntstatus::*; +pub use oaidl::*; +pub use objbase::*; +pub use objidl::*; +pub use objidlbase::*; +pub use olectl::*; +pub use pdh::*; +pub use playsoundapi::*; +pub use processsnapshot::*; +pub use processthreadsapi::*; +pub use propidl::*; +pub use propsys::*; +pub use prsht::*; +pub use psapi::*; +pub use qos::*; +pub use reason::*; +pub use restrictederrorinfo::*; +pub use roapi::*; +pub use roerrorapi::*; +pub use rpc::*; +pub use rpcdce::*; +pub use sapi::*; +pub use schannel::*; +pub use servprov::*; +pub use setupapi::*; +pub use shellapi::*; +pub use shellscalingapi::*; +pub use shlguid::*; +pub use shlobj::*; +pub use shobjidl::*; +pub use shtypes::*; +pub use spapidef::*; +pub use sqltypes::*; +pub use sspi::*; +pub use strmif::*; +pub use subauth::*; +pub use synchapi::*; +pub use sysinfoapi::*; +pub use threadpoolapi::*; +pub use timezoneapi::*; +pub use tlhelp32::*; +pub use unknwnbase::*; +pub use urlhist::*; +pub use urlmon::*; +pub use usb::*; +pub use usbspec::*; +pub use usp10::*; +pub use vadefs::*; +pub use vsbackup::*; +pub use vss::*; +pub use vsserror::*; +pub use vswriter::*; +pub use werapi::*; +pub use winbase::*; +pub use wincon::*; +pub use wincred::*; +pub use wincrypt::*; +pub use windowsx::*; +pub use windef::*; +pub use windowscodecs::*; +pub use winerror::*; +pub use winevt::*; +pub use wingdi::*; +pub use winhttp::*; +pub use winioctl::*; +pub use winnetwk::*; +pub use winnls::*; +pub use winnt::*; +pub use winreg::*; +pub use winscard::*; +pub use winsmcrd::*; +pub use winsock2::*; +pub use winspool::*; +pub use winstring::*; +pub use winsvc::*; +pub use winusb::*; +pub use winusbio::*; +pub use winuser::*; +pub use ws2def::*; +pub use ws2ipdef::*; +pub use ws2spi::*; +pub use ws2tcpip::*; +pub use wtypes::*; +pub use wtypesbase::*; +pub use xinput::*; +//------------------------------------------------------------------------------------------------- +// Modules +//------------------------------------------------------------------------------------------------- +#[macro_use] mod macros; +pub mod activation; +pub mod audioclient; +pub mod audiosessiontypes; +pub mod basetsd; +pub mod bcrypt; +pub mod cfg; +pub mod cfgmgr32; +pub mod combaseapi; +pub mod commctrl; +pub mod commdlg; +pub mod corsym; +pub mod d2d1; +pub mod d2dbasetypes; +pub mod d3d9; +pub mod d3d9caps; +pub mod d3d9types; +pub mod d3d11; +pub mod d3d10shader; +pub mod d3d11shader; +pub mod d3d12; +pub mod d3d12sdklayers; +pub mod d3d12shader; +pub mod d3dcommon; +pub mod d3dcompiler; +pub mod dbghelp; +pub mod dcommon; +pub mod devpropdef; +pub mod docobj; +pub mod dpapi; +pub mod dsgetdc; +pub mod dsound; +pub mod dsrole; +pub mod dwmapi; +pub mod dwrite; +pub mod dxgi; +pub mod dxgi1_2; +pub mod dxgi1_3; +pub mod dxgi1_4; +pub mod dxgiformat; +pub mod dxgitype; +pub mod errhandlingapi; +pub mod excpt; +pub mod fileapi; +pub mod gl; +pub mod guiddef; +pub mod heapapi; +pub mod hidclass; +pub mod hidpi; +pub mod hidsdi; +pub mod hidusage; +pub mod hstring; +pub mod http; +pub mod imm; +pub mod inaddr; +pub mod inspectable; +pub mod ksmedia; +pub mod libloaderapi; +pub mod lmaccess; +pub mod lmcons; +pub mod lmdfs; +pub mod lmerrlog; +pub mod lmjoin; +pub mod lsalookup; +pub mod memoryapi; +pub mod minschannel; +pub mod minwinbase; +pub mod minwindef; +pub mod mmdeviceapi; +pub mod mmreg; +pub mod mmsystem; +pub mod mscat; +pub mod mssip; +pub mod nb30; +pub mod ncrypt; +pub mod ntdef; +pub mod ntsecapi; +pub mod ntstatus; +pub mod oaidl; +pub mod objbase; +pub mod objidl; +pub mod objidlbase; +pub mod olectl; +pub mod pdh; +pub mod playsoundapi; +pub mod processsnapshot; +pub mod processthreadsapi; +pub mod propidl; +pub mod propsys; +pub mod prsht; +pub mod psapi; +pub mod qos; +pub mod reason; +pub mod restrictederrorinfo; +pub mod roapi; +pub mod roerrorapi; +pub mod rpc; +pub mod rpcdce; +pub mod sapi; +pub mod schannel; +pub mod servprov; +pub mod setupapi; +pub mod shellapi; +pub mod shellscalingapi; +pub mod shlguid; +pub mod shlobj; +pub mod shobjidl; +pub mod shtypes; +pub mod spapidef; +pub mod sqltypes; +pub mod sspi; +pub mod strmif; +pub mod subauth; +pub mod synchapi; +pub mod sysinfoapi; +pub mod threadpoolapi; +pub mod timezoneapi; +pub mod tlhelp32; +pub mod unknwnbase; +pub mod urlhist; +pub mod urlmon; +pub mod usb; +pub mod usbspec; +pub mod usp10; +pub mod vadefs; +pub mod vsbackup; +pub mod vss; +pub mod vsserror; +pub mod vswriter; +pub mod werapi; +pub mod winbase; +pub mod wincon; +pub mod wincred; +pub mod wincrypt; +pub mod windef; +pub mod windowscodecs; +pub mod windowsx; +pub mod winerror; +pub mod winevt; +pub mod wingdi; +pub mod winhttp; +pub mod winioctl; +pub mod winnetwk; +pub mod winnls; +pub mod winnt; +pub mod winreg; +pub mod winscard; +pub mod winsmcrd; +pub mod winsock2; +pub mod winspool; +pub mod winstring; +pub mod winsvc; +pub mod winusb; +pub mod winusbio; +pub mod winuser; +pub mod ws2def; +pub mod ws2ipdef; +pub mod ws2spi; +pub mod ws2tcpip; +pub mod wtypes; +pub mod wtypesbase; +pub mod xinput; +//------------------------------------------------------------------------------------------------- +// Primitive types not provided by std +//------------------------------------------------------------------------------------------------- +pub type __int8 = i8; +pub type __uint8 = u8; +pub type __int16 = i16; +pub type __uint16 = u16; +pub type __int32 = i32; +pub type __uint32 = u32; +pub type __int64 = i64; +pub type __uint64 = u64; +pub type wchar_t = c_ushort; +#[cfg(target_arch = "x86")] +pub type size_t = c_uint; +#[cfg(target_arch = "x86_64")] +pub type size_t = __uint64; diff --git a/src/vendor/winapi/src/libloaderapi.rs b/src/vendor/winapi-0.2.8/src/libloaderapi.rs similarity index 100% rename from src/vendor/winapi/src/libloaderapi.rs rename to src/vendor/winapi-0.2.8/src/libloaderapi.rs diff --git a/src/vendor/winapi/src/lmaccess.rs b/src/vendor/winapi-0.2.8/src/lmaccess.rs similarity index 100% rename from src/vendor/winapi/src/lmaccess.rs rename to src/vendor/winapi-0.2.8/src/lmaccess.rs diff --git a/src/vendor/winapi/src/lmcons.rs b/src/vendor/winapi-0.2.8/src/lmcons.rs similarity index 100% rename from src/vendor/winapi/src/lmcons.rs rename to src/vendor/winapi-0.2.8/src/lmcons.rs diff --git a/src/vendor/winapi/src/lmdfs.rs b/src/vendor/winapi-0.2.8/src/lmdfs.rs similarity index 100% rename from src/vendor/winapi/src/lmdfs.rs rename to src/vendor/winapi-0.2.8/src/lmdfs.rs diff --git a/src/vendor/winapi/src/lmerrlog.rs b/src/vendor/winapi-0.2.8/src/lmerrlog.rs similarity index 100% rename from src/vendor/winapi/src/lmerrlog.rs rename to src/vendor/winapi-0.2.8/src/lmerrlog.rs diff --git a/src/vendor/winapi/src/lmjoin.rs b/src/vendor/winapi-0.2.8/src/lmjoin.rs similarity index 100% rename from src/vendor/winapi/src/lmjoin.rs rename to src/vendor/winapi-0.2.8/src/lmjoin.rs diff --git a/src/vendor/winapi/src/lsalookup.rs b/src/vendor/winapi-0.2.8/src/lsalookup.rs similarity index 100% rename from src/vendor/winapi/src/lsalookup.rs rename to src/vendor/winapi-0.2.8/src/lsalookup.rs diff --git a/src/vendor/winapi-0.2.8/src/macros.rs b/src/vendor/winapi-0.2.8/src/macros.rs new file mode 100644 index 0000000000..0bbd6aabff --- /dev/null +++ b/src/vendor/winapi-0.2.8/src/macros.rs @@ -0,0 +1,270 @@ +// Copyright © 2015, Peter Atashian +// Licensed under the MIT License +//! Macros to make things easier to define +macro_rules! DECLARE_HANDLE { + ($name:ident, $inner:ident) => { + #[allow(missing_copy_implementations)] pub enum $inner { } + pub type $name = *mut $inner; + }; +} +macro_rules! MAKE_HRESULT { + ($sev:expr, $fac:expr, $code:expr) => { + ($sev << 31) | ($fac << 16) | $code + } +} +macro_rules! MAKE_SCODE { + ($sev:expr, $fac:expr, $code:expr) => { + ($sev << 31) | ($fac << 16) | $code + } +} +macro_rules! HIDP_ERROR_CODES { + ($sev:expr, $code:expr) => { + ($sev << 28) | (::FACILITY_HID_ERROR_CODE << 16) | $code + } +} +macro_rules! MAKEFOURCC { + ($a:expr, $b:expr, $c:expr, $d:expr) => { + ($a as i32) | (($b as i32) << 8) | (($c as i32) << 16) | (($d as i32) << 24) + } +} +#[macro_export] +macro_rules! DEFINE_GUID { + ( + $name:ident, $l:expr, $w1:expr, $w2:expr, $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, + $b6:expr, $b7:expr, $b8:expr + ) => { + pub const $name: $crate::GUID = $crate::GUID { + Data1: $l, + Data2: $w1, + Data3: $w2, + Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8], + }; + } +} +macro_rules! CTL_CODE { + ($DeviceType:expr, $Function:expr, $Method:expr, $Access:expr) => { + ($DeviceType << 16) | ($Access << 14) | ($Function << 2) | $Method + } +} +macro_rules! HID_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_NEITHER, ::FILE_ANY_ACCESS) + } +} +macro_rules! HID_BUFFER_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_BUFFERED, ::FILE_ANY_ACCESS) + } +} +macro_rules! HID_IN_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_IN_DIRECT, ::FILE_ANY_ACCESS) + } +} +macro_rules! HID_OUT_CTL_CODE { + ($id:expr) => { + CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_OUT_DIRECT, ::FILE_ANY_ACCESS) + } +} +macro_rules! AUDCLNT_ERR { + ($n:expr) => { + MAKE_HRESULT!(::SEVERITY_ERROR, ::FACILITY_AUDCLNT, $n) + }; +} +macro_rules! AUDCLNT_SUCCESS { + ($n:expr) => { + MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_AUDCLNT, $n) + }; +} +macro_rules! BCRYPT_MAKE_INTERFACE_VERSION { + ($major:expr, $minor:expr) => { + ::BCRYPT_INTERFACE_VERSION { MajorVersion: $major, MinorVersion: $minor } + } +} +#[macro_export] +macro_rules! RIDL { + (interface $interface:ident ($vtbl:ident) + {$( + fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty + ),+} + ) => { + #[repr(C)] #[allow(missing_copy_implementations)] + pub struct $vtbl { + $(pub $method: unsafe extern "system" fn( + This: *mut $interface + $(,$p: $t)* + ) -> $rtr),+ + } + #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] + pub struct $interface { + pub lpVtbl: *const $vtbl + } + impl $interface { + #[inline] + $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { + ((*self.lpVtbl).$method)(self $(,$p)*) + })+ + } + }; + (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) { + }) => { + #[repr(C)] #[allow(missing_copy_implementations)] + pub struct $vtbl { + pub parent: $crate::$pvtbl + } + #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] + pub struct $interface { + pub lpVtbl: *const $vtbl + } + impl ::std::ops::Deref for $interface { + type Target = $crate::$pinterface; + #[inline] + fn deref(&self) -> &$crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + impl ::std::ops::DerefMut for $interface { + #[inline] + fn deref_mut(&mut self) -> &mut $crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + }; + (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) + {$( + fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty + ),+} + ) => { + #[repr(C)] #[allow(missing_copy_implementations)] + pub struct $vtbl { + pub parent: $crate::$pvtbl + $(,pub $method: unsafe extern "system" fn( + This: *mut $interface + $(,$p: $t)* + ) -> $rtr)+ + } + #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] + pub struct $interface { + pub lpVtbl: *const $vtbl + } + impl $interface { + #[inline] + $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { + ((*self.lpVtbl).$method)(self $(,$p)*) + })+ + } + impl ::std::ops::Deref for $interface { + type Target = $crate::$pinterface; + #[inline] + fn deref(&self) -> &$crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + impl ::std::ops::DerefMut for $interface { + #[inline] + fn deref_mut(&mut self) -> &mut $crate::$pinterface { + unsafe { ::std::mem::transmute(self) } + } + } + }; +} +macro_rules! UNION { + ($base:ident, $field:ident, $variant:ident, $variantmut:ident, $fieldtype:ty) => { + impl $base { + #[inline] + pub unsafe fn $variant(&self) -> &$fieldtype { + ::std::mem::transmute(&self.$field) + } + #[inline] + pub unsafe fn $variantmut(&mut self) -> &mut $fieldtype { + ::std::mem::transmute(&mut self.$field) + } + } + } +} +macro_rules! BITFIELD { + ($base:ident $field:ident: $fieldtype:ty [ + $($thing:ident $set_thing:ident[$r:expr],)+ + ]) => { + impl $base {$( + #[inline] + pub fn $thing(&self) -> $fieldtype { + let size = ::std::mem::size_of::<$fieldtype>() * 8; + self.$field << (size - $r.end) >> (size - $r.end + $r.start) + } + #[inline] + pub fn $set_thing(&mut self, val: $fieldtype) { + let mask = ((1 << ($r.end - $r.start)) - 1) << $r.start; + self.$field &= !mask; + self.$field |= (val << $r.start) & mask; + } + )+} + } +} +#[macro_export] +macro_rules! ENUM { + {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { + #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] + pub struct $name(pub u32); + $(pub const $variant: $name = $name($value);)+ + }; + {enum $name:ident { $variant:ident = $value:expr, $($rest:tt)* }} => { + #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] + pub struct $name(pub u32); + pub const $variant: $name = $name($value); + ENUM!{@gen $name, $variant, $($rest)*} + }; + {enum $name:ident { $variant:ident, $($rest:tt)* }} => { + ENUM!{enum $name { $variant = 0, $($rest)* }} + }; + {@gen $name:ident, $base:ident,} => {}; + {@gen $name:ident, $base:ident, $variant:ident = $value:expr, $($rest:tt)*} => { + pub const $variant: $name = $name($value); + ENUM!{@gen $name, $variant, $($rest)*} + }; + {@gen $name:ident, $base:ident, $variant:ident, $($rest:tt)*} => { + pub const $variant: $name = $name($base.0 + 1u32); + ENUM!{@gen $name, $variant, $($rest)*} + }; +} +macro_rules! FLAGS { + {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { + #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] + pub struct $name(pub u32); + $(pub const $variant: $name = $name($value);)+ + impl ::std::ops::BitAnd<$name> for $name { + type Output = $name; + fn bitand(self, o: $name) -> $name { $name(self.0 & o.0) } + } + impl ::std::ops::BitOr<$name> for $name { + type Output = $name; + fn bitor(self, o: $name) -> $name { $name(self.0 | o.0) } + } + impl ::std::ops::BitXor<$name> for $name { + type Output = $name; + fn bitxor(self, o: $name) -> $name { $name(self.0 ^ o.0) } + } + impl ::std::ops::Not for $name { + type Output = $name; + fn not(self) -> $name { $name(!self.0) } + } + } +} +macro_rules! STRUCT { + {$(#[$attrs:meta])* nodebug struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { + #[repr(C)] $(#[$attrs])* + pub struct $name { + $(pub $field: $ftype,)+ + } + impl Copy for $name {} + impl Clone for $name { fn clone(&self) -> $name { *self } } + }; + {$(#[$attrs:meta])* struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { + #[repr(C)] #[derive(Debug)] $(#[$attrs])* + pub struct $name { + $(pub $field: $ftype,)+ + } + impl Copy for $name {} + impl Clone for $name { fn clone(&self) -> $name { *self } } + }; +} diff --git a/src/vendor/winapi/src/memoryapi.rs b/src/vendor/winapi-0.2.8/src/memoryapi.rs similarity index 100% rename from src/vendor/winapi/src/memoryapi.rs rename to src/vendor/winapi-0.2.8/src/memoryapi.rs diff --git a/src/vendor/winapi/src/minschannel.rs b/src/vendor/winapi-0.2.8/src/minschannel.rs similarity index 100% rename from src/vendor/winapi/src/minschannel.rs rename to src/vendor/winapi-0.2.8/src/minschannel.rs diff --git a/src/vendor/winapi/src/minwinbase.rs b/src/vendor/winapi-0.2.8/src/minwinbase.rs similarity index 100% rename from src/vendor/winapi/src/minwinbase.rs rename to src/vendor/winapi-0.2.8/src/minwinbase.rs diff --git a/src/vendor/winapi/src/minwindef.rs b/src/vendor/winapi-0.2.8/src/minwindef.rs similarity index 100% rename from src/vendor/winapi/src/minwindef.rs rename to src/vendor/winapi-0.2.8/src/minwindef.rs diff --git a/src/vendor/winapi/src/mmdeviceapi.rs b/src/vendor/winapi-0.2.8/src/mmdeviceapi.rs similarity index 100% rename from src/vendor/winapi/src/mmdeviceapi.rs rename to src/vendor/winapi-0.2.8/src/mmdeviceapi.rs diff --git a/src/vendor/winapi/src/mmreg.rs b/src/vendor/winapi-0.2.8/src/mmreg.rs similarity index 100% rename from src/vendor/winapi/src/mmreg.rs rename to src/vendor/winapi-0.2.8/src/mmreg.rs diff --git a/src/vendor/winapi/src/mmsystem.rs b/src/vendor/winapi-0.2.8/src/mmsystem.rs similarity index 100% rename from src/vendor/winapi/src/mmsystem.rs rename to src/vendor/winapi-0.2.8/src/mmsystem.rs diff --git a/src/vendor/winapi/src/mscat.rs b/src/vendor/winapi-0.2.8/src/mscat.rs similarity index 100% rename from src/vendor/winapi/src/mscat.rs rename to src/vendor/winapi-0.2.8/src/mscat.rs diff --git a/src/vendor/winapi/src/mssip.rs b/src/vendor/winapi-0.2.8/src/mssip.rs similarity index 100% rename from src/vendor/winapi/src/mssip.rs rename to src/vendor/winapi-0.2.8/src/mssip.rs diff --git a/src/vendor/winapi/src/nb30.rs b/src/vendor/winapi-0.2.8/src/nb30.rs similarity index 100% rename from src/vendor/winapi/src/nb30.rs rename to src/vendor/winapi-0.2.8/src/nb30.rs diff --git a/src/vendor/winapi/src/ncrypt.rs b/src/vendor/winapi-0.2.8/src/ncrypt.rs similarity index 100% rename from src/vendor/winapi/src/ncrypt.rs rename to src/vendor/winapi-0.2.8/src/ncrypt.rs diff --git a/src/vendor/winapi/src/ntdef.rs b/src/vendor/winapi-0.2.8/src/ntdef.rs similarity index 100% rename from src/vendor/winapi/src/ntdef.rs rename to src/vendor/winapi-0.2.8/src/ntdef.rs diff --git a/src/vendor/winapi/src/ntsecapi.rs b/src/vendor/winapi-0.2.8/src/ntsecapi.rs similarity index 100% rename from src/vendor/winapi/src/ntsecapi.rs rename to src/vendor/winapi-0.2.8/src/ntsecapi.rs diff --git a/src/vendor/winapi/src/ntstatus.rs b/src/vendor/winapi-0.2.8/src/ntstatus.rs similarity index 100% rename from src/vendor/winapi/src/ntstatus.rs rename to src/vendor/winapi-0.2.8/src/ntstatus.rs diff --git a/src/vendor/winapi/src/oaidl.rs b/src/vendor/winapi-0.2.8/src/oaidl.rs similarity index 100% rename from src/vendor/winapi/src/oaidl.rs rename to src/vendor/winapi-0.2.8/src/oaidl.rs diff --git a/src/vendor/winapi/src/objbase.rs b/src/vendor/winapi-0.2.8/src/objbase.rs similarity index 100% rename from src/vendor/winapi/src/objbase.rs rename to src/vendor/winapi-0.2.8/src/objbase.rs diff --git a/src/vendor/winapi/src/objidl.rs b/src/vendor/winapi-0.2.8/src/objidl.rs similarity index 100% rename from src/vendor/winapi/src/objidl.rs rename to src/vendor/winapi-0.2.8/src/objidl.rs diff --git a/src/vendor/winapi/src/objidlbase.rs b/src/vendor/winapi-0.2.8/src/objidlbase.rs similarity index 100% rename from src/vendor/winapi/src/objidlbase.rs rename to src/vendor/winapi-0.2.8/src/objidlbase.rs diff --git a/src/vendor/winapi/src/olectl.rs b/src/vendor/winapi-0.2.8/src/olectl.rs similarity index 100% rename from src/vendor/winapi/src/olectl.rs rename to src/vendor/winapi-0.2.8/src/olectl.rs diff --git a/src/vendor/winapi/src/pdh.rs b/src/vendor/winapi-0.2.8/src/pdh.rs similarity index 100% rename from src/vendor/winapi/src/pdh.rs rename to src/vendor/winapi-0.2.8/src/pdh.rs diff --git a/src/vendor/winapi/src/playsoundapi.rs b/src/vendor/winapi-0.2.8/src/playsoundapi.rs similarity index 100% rename from src/vendor/winapi/src/playsoundapi.rs rename to src/vendor/winapi-0.2.8/src/playsoundapi.rs diff --git a/src/vendor/winapi/src/processsnapshot.rs b/src/vendor/winapi-0.2.8/src/processsnapshot.rs similarity index 100% rename from src/vendor/winapi/src/processsnapshot.rs rename to src/vendor/winapi-0.2.8/src/processsnapshot.rs diff --git a/src/vendor/winapi/src/processthreadsapi.rs b/src/vendor/winapi-0.2.8/src/processthreadsapi.rs similarity index 100% rename from src/vendor/winapi/src/processthreadsapi.rs rename to src/vendor/winapi-0.2.8/src/processthreadsapi.rs diff --git a/src/vendor/winapi/src/propidl.rs b/src/vendor/winapi-0.2.8/src/propidl.rs similarity index 100% rename from src/vendor/winapi/src/propidl.rs rename to src/vendor/winapi-0.2.8/src/propidl.rs diff --git a/src/vendor/winapi/src/propsys.rs b/src/vendor/winapi-0.2.8/src/propsys.rs similarity index 100% rename from src/vendor/winapi/src/propsys.rs rename to src/vendor/winapi-0.2.8/src/propsys.rs diff --git a/src/vendor/winapi/src/prsht.rs b/src/vendor/winapi-0.2.8/src/prsht.rs similarity index 100% rename from src/vendor/winapi/src/prsht.rs rename to src/vendor/winapi-0.2.8/src/prsht.rs diff --git a/src/vendor/winapi/src/psapi.rs b/src/vendor/winapi-0.2.8/src/psapi.rs similarity index 100% rename from src/vendor/winapi/src/psapi.rs rename to src/vendor/winapi-0.2.8/src/psapi.rs diff --git a/src/vendor/winapi/src/qos.rs b/src/vendor/winapi-0.2.8/src/qos.rs similarity index 100% rename from src/vendor/winapi/src/qos.rs rename to src/vendor/winapi-0.2.8/src/qos.rs diff --git a/src/vendor/winapi/src/reason.rs b/src/vendor/winapi-0.2.8/src/reason.rs similarity index 100% rename from src/vendor/winapi/src/reason.rs rename to src/vendor/winapi-0.2.8/src/reason.rs diff --git a/src/vendor/winapi/src/restrictederrorinfo.rs b/src/vendor/winapi-0.2.8/src/restrictederrorinfo.rs similarity index 100% rename from src/vendor/winapi/src/restrictederrorinfo.rs rename to src/vendor/winapi-0.2.8/src/restrictederrorinfo.rs diff --git a/src/vendor/winapi/src/roapi.rs b/src/vendor/winapi-0.2.8/src/roapi.rs similarity index 100% rename from src/vendor/winapi/src/roapi.rs rename to src/vendor/winapi-0.2.8/src/roapi.rs diff --git a/src/vendor/winapi/src/roerrorapi.rs b/src/vendor/winapi-0.2.8/src/roerrorapi.rs similarity index 100% rename from src/vendor/winapi/src/roerrorapi.rs rename to src/vendor/winapi-0.2.8/src/roerrorapi.rs diff --git a/src/vendor/winapi/src/rpc.rs b/src/vendor/winapi-0.2.8/src/rpc.rs similarity index 100% rename from src/vendor/winapi/src/rpc.rs rename to src/vendor/winapi-0.2.8/src/rpc.rs diff --git a/src/vendor/winapi/src/rpcdce.rs b/src/vendor/winapi-0.2.8/src/rpcdce.rs similarity index 100% rename from src/vendor/winapi/src/rpcdce.rs rename to src/vendor/winapi-0.2.8/src/rpcdce.rs diff --git a/src/vendor/winapi/src/sapi.rs b/src/vendor/winapi-0.2.8/src/sapi.rs similarity index 100% rename from src/vendor/winapi/src/sapi.rs rename to src/vendor/winapi-0.2.8/src/sapi.rs diff --git a/src/vendor/winapi/src/schannel.rs b/src/vendor/winapi-0.2.8/src/schannel.rs similarity index 100% rename from src/vendor/winapi/src/schannel.rs rename to src/vendor/winapi-0.2.8/src/schannel.rs diff --git a/src/vendor/winapi/src/servprov.rs b/src/vendor/winapi-0.2.8/src/servprov.rs similarity index 100% rename from src/vendor/winapi/src/servprov.rs rename to src/vendor/winapi-0.2.8/src/servprov.rs diff --git a/src/vendor/winapi/src/setupapi.rs b/src/vendor/winapi-0.2.8/src/setupapi.rs similarity index 100% rename from src/vendor/winapi/src/setupapi.rs rename to src/vendor/winapi-0.2.8/src/setupapi.rs diff --git a/src/vendor/winapi/src/shellapi.rs b/src/vendor/winapi-0.2.8/src/shellapi.rs similarity index 100% rename from src/vendor/winapi/src/shellapi.rs rename to src/vendor/winapi-0.2.8/src/shellapi.rs diff --git a/src/vendor/winapi/src/shellscalingapi.rs b/src/vendor/winapi-0.2.8/src/shellscalingapi.rs similarity index 100% rename from src/vendor/winapi/src/shellscalingapi.rs rename to src/vendor/winapi-0.2.8/src/shellscalingapi.rs diff --git a/src/vendor/winapi/src/shlguid.rs b/src/vendor/winapi-0.2.8/src/shlguid.rs similarity index 100% rename from src/vendor/winapi/src/shlguid.rs rename to src/vendor/winapi-0.2.8/src/shlguid.rs diff --git a/src/vendor/winapi/src/shlobj.rs b/src/vendor/winapi-0.2.8/src/shlobj.rs similarity index 100% rename from src/vendor/winapi/src/shlobj.rs rename to src/vendor/winapi-0.2.8/src/shlobj.rs diff --git a/src/vendor/winapi/src/shobjidl.rs b/src/vendor/winapi-0.2.8/src/shobjidl.rs similarity index 100% rename from src/vendor/winapi/src/shobjidl.rs rename to src/vendor/winapi-0.2.8/src/shobjidl.rs diff --git a/src/vendor/winapi/src/shtypes.rs b/src/vendor/winapi-0.2.8/src/shtypes.rs similarity index 100% rename from src/vendor/winapi/src/shtypes.rs rename to src/vendor/winapi-0.2.8/src/shtypes.rs diff --git a/src/vendor/winapi/src/spapidef.rs b/src/vendor/winapi-0.2.8/src/spapidef.rs similarity index 100% rename from src/vendor/winapi/src/spapidef.rs rename to src/vendor/winapi-0.2.8/src/spapidef.rs diff --git a/src/vendor/winapi/src/sql.rs b/src/vendor/winapi-0.2.8/src/sql.rs similarity index 100% rename from src/vendor/winapi/src/sql.rs rename to src/vendor/winapi-0.2.8/src/sql.rs diff --git a/src/vendor/winapi/src/sqltypes.rs b/src/vendor/winapi-0.2.8/src/sqltypes.rs similarity index 100% rename from src/vendor/winapi/src/sqltypes.rs rename to src/vendor/winapi-0.2.8/src/sqltypes.rs diff --git a/src/vendor/winapi/src/sspi.rs b/src/vendor/winapi-0.2.8/src/sspi.rs similarity index 100% rename from src/vendor/winapi/src/sspi.rs rename to src/vendor/winapi-0.2.8/src/sspi.rs diff --git a/src/vendor/winapi/src/strmif.rs b/src/vendor/winapi-0.2.8/src/strmif.rs similarity index 100% rename from src/vendor/winapi/src/strmif.rs rename to src/vendor/winapi-0.2.8/src/strmif.rs diff --git a/src/vendor/winapi/src/subauth.rs b/src/vendor/winapi-0.2.8/src/subauth.rs similarity index 100% rename from src/vendor/winapi/src/subauth.rs rename to src/vendor/winapi-0.2.8/src/subauth.rs diff --git a/src/vendor/winapi/src/synchapi.rs b/src/vendor/winapi-0.2.8/src/synchapi.rs similarity index 100% rename from src/vendor/winapi/src/synchapi.rs rename to src/vendor/winapi-0.2.8/src/synchapi.rs diff --git a/src/vendor/winapi/src/sysinfoapi.rs b/src/vendor/winapi-0.2.8/src/sysinfoapi.rs similarity index 100% rename from src/vendor/winapi/src/sysinfoapi.rs rename to src/vendor/winapi-0.2.8/src/sysinfoapi.rs diff --git a/src/vendor/winapi/src/threadpoolapi.rs b/src/vendor/winapi-0.2.8/src/threadpoolapi.rs similarity index 100% rename from src/vendor/winapi/src/threadpoolapi.rs rename to src/vendor/winapi-0.2.8/src/threadpoolapi.rs diff --git a/src/vendor/winapi/src/timezoneapi.rs b/src/vendor/winapi-0.2.8/src/timezoneapi.rs similarity index 100% rename from src/vendor/winapi/src/timezoneapi.rs rename to src/vendor/winapi-0.2.8/src/timezoneapi.rs diff --git a/src/vendor/winapi/src/tlhelp32.rs b/src/vendor/winapi-0.2.8/src/tlhelp32.rs similarity index 100% rename from src/vendor/winapi/src/tlhelp32.rs rename to src/vendor/winapi-0.2.8/src/tlhelp32.rs diff --git a/src/vendor/winapi/src/unknwnbase.rs b/src/vendor/winapi-0.2.8/src/unknwnbase.rs similarity index 100% rename from src/vendor/winapi/src/unknwnbase.rs rename to src/vendor/winapi-0.2.8/src/unknwnbase.rs diff --git a/src/vendor/winapi/src/urlhist.rs b/src/vendor/winapi-0.2.8/src/urlhist.rs similarity index 100% rename from src/vendor/winapi/src/urlhist.rs rename to src/vendor/winapi-0.2.8/src/urlhist.rs diff --git a/src/vendor/winapi/src/urlmon.rs b/src/vendor/winapi-0.2.8/src/urlmon.rs similarity index 100% rename from src/vendor/winapi/src/urlmon.rs rename to src/vendor/winapi-0.2.8/src/urlmon.rs diff --git a/src/vendor/winapi/src/usb.rs b/src/vendor/winapi-0.2.8/src/usb.rs similarity index 100% rename from src/vendor/winapi/src/usb.rs rename to src/vendor/winapi-0.2.8/src/usb.rs diff --git a/src/vendor/winapi/src/usbspec.rs b/src/vendor/winapi-0.2.8/src/usbspec.rs similarity index 100% rename from src/vendor/winapi/src/usbspec.rs rename to src/vendor/winapi-0.2.8/src/usbspec.rs diff --git a/src/vendor/winapi/src/usp10.rs b/src/vendor/winapi-0.2.8/src/usp10.rs similarity index 100% rename from src/vendor/winapi/src/usp10.rs rename to src/vendor/winapi-0.2.8/src/usp10.rs diff --git a/src/vendor/winapi/src/vadefs.rs b/src/vendor/winapi-0.2.8/src/vadefs.rs similarity index 100% rename from src/vendor/winapi/src/vadefs.rs rename to src/vendor/winapi-0.2.8/src/vadefs.rs diff --git a/src/vendor/winapi/src/vsbackup.rs b/src/vendor/winapi-0.2.8/src/vsbackup.rs similarity index 100% rename from src/vendor/winapi/src/vsbackup.rs rename to src/vendor/winapi-0.2.8/src/vsbackup.rs diff --git a/src/vendor/winapi/src/vss.rs b/src/vendor/winapi-0.2.8/src/vss.rs similarity index 100% rename from src/vendor/winapi/src/vss.rs rename to src/vendor/winapi-0.2.8/src/vss.rs diff --git a/src/vendor/winapi/src/vsserror.rs b/src/vendor/winapi-0.2.8/src/vsserror.rs similarity index 100% rename from src/vendor/winapi/src/vsserror.rs rename to src/vendor/winapi-0.2.8/src/vsserror.rs diff --git a/src/vendor/winapi/src/vswriter.rs b/src/vendor/winapi-0.2.8/src/vswriter.rs similarity index 100% rename from src/vendor/winapi/src/vswriter.rs rename to src/vendor/winapi-0.2.8/src/vswriter.rs diff --git a/src/vendor/winapi/src/werapi.rs b/src/vendor/winapi-0.2.8/src/werapi.rs similarity index 100% rename from src/vendor/winapi/src/werapi.rs rename to src/vendor/winapi-0.2.8/src/werapi.rs diff --git a/src/vendor/winapi/src/winbase.rs b/src/vendor/winapi-0.2.8/src/winbase.rs similarity index 100% rename from src/vendor/winapi/src/winbase.rs rename to src/vendor/winapi-0.2.8/src/winbase.rs diff --git a/src/vendor/winapi/src/wincon.rs b/src/vendor/winapi-0.2.8/src/wincon.rs similarity index 100% rename from src/vendor/winapi/src/wincon.rs rename to src/vendor/winapi-0.2.8/src/wincon.rs diff --git a/src/vendor/winapi/src/wincred.rs b/src/vendor/winapi-0.2.8/src/wincred.rs similarity index 100% rename from src/vendor/winapi/src/wincred.rs rename to src/vendor/winapi-0.2.8/src/wincred.rs diff --git a/src/vendor/winapi/src/wincrypt.rs b/src/vendor/winapi-0.2.8/src/wincrypt.rs similarity index 100% rename from src/vendor/winapi/src/wincrypt.rs rename to src/vendor/winapi-0.2.8/src/wincrypt.rs diff --git a/src/vendor/winapi/src/windef.rs b/src/vendor/winapi-0.2.8/src/windef.rs similarity index 100% rename from src/vendor/winapi/src/windef.rs rename to src/vendor/winapi-0.2.8/src/windef.rs diff --git a/src/vendor/winapi/src/windowscodecs.rs b/src/vendor/winapi-0.2.8/src/windowscodecs.rs similarity index 100% rename from src/vendor/winapi/src/windowscodecs.rs rename to src/vendor/winapi-0.2.8/src/windowscodecs.rs diff --git a/src/vendor/winapi/src/windowsx.rs b/src/vendor/winapi-0.2.8/src/windowsx.rs similarity index 100% rename from src/vendor/winapi/src/windowsx.rs rename to src/vendor/winapi-0.2.8/src/windowsx.rs diff --git a/src/vendor/winapi/src/winerror.rs b/src/vendor/winapi-0.2.8/src/winerror.rs similarity index 100% rename from src/vendor/winapi/src/winerror.rs rename to src/vendor/winapi-0.2.8/src/winerror.rs diff --git a/src/vendor/winapi/src/winevt.rs b/src/vendor/winapi-0.2.8/src/winevt.rs similarity index 100% rename from src/vendor/winapi/src/winevt.rs rename to src/vendor/winapi-0.2.8/src/winevt.rs diff --git a/src/vendor/winapi/src/wingdi.rs b/src/vendor/winapi-0.2.8/src/wingdi.rs similarity index 100% rename from src/vendor/winapi/src/wingdi.rs rename to src/vendor/winapi-0.2.8/src/wingdi.rs diff --git a/src/vendor/winapi/src/winhttp.rs b/src/vendor/winapi-0.2.8/src/winhttp.rs similarity index 100% rename from src/vendor/winapi/src/winhttp.rs rename to src/vendor/winapi-0.2.8/src/winhttp.rs diff --git a/src/vendor/winapi/src/winioctl.rs b/src/vendor/winapi-0.2.8/src/winioctl.rs similarity index 100% rename from src/vendor/winapi/src/winioctl.rs rename to src/vendor/winapi-0.2.8/src/winioctl.rs diff --git a/src/vendor/winapi/src/winnetwk.rs b/src/vendor/winapi-0.2.8/src/winnetwk.rs similarity index 100% rename from src/vendor/winapi/src/winnetwk.rs rename to src/vendor/winapi-0.2.8/src/winnetwk.rs diff --git a/src/vendor/winapi/src/winnls.rs b/src/vendor/winapi-0.2.8/src/winnls.rs similarity index 100% rename from src/vendor/winapi/src/winnls.rs rename to src/vendor/winapi-0.2.8/src/winnls.rs diff --git a/src/vendor/winapi/src/winnt.rs b/src/vendor/winapi-0.2.8/src/winnt.rs similarity index 100% rename from src/vendor/winapi/src/winnt.rs rename to src/vendor/winapi-0.2.8/src/winnt.rs diff --git a/src/vendor/winapi/src/winreg.rs b/src/vendor/winapi-0.2.8/src/winreg.rs similarity index 100% rename from src/vendor/winapi/src/winreg.rs rename to src/vendor/winapi-0.2.8/src/winreg.rs diff --git a/src/vendor/winapi/src/winscard.rs b/src/vendor/winapi-0.2.8/src/winscard.rs similarity index 100% rename from src/vendor/winapi/src/winscard.rs rename to src/vendor/winapi-0.2.8/src/winscard.rs diff --git a/src/vendor/winapi/src/winsmcrd.rs b/src/vendor/winapi-0.2.8/src/winsmcrd.rs similarity index 100% rename from src/vendor/winapi/src/winsmcrd.rs rename to src/vendor/winapi-0.2.8/src/winsmcrd.rs diff --git a/src/vendor/winapi/src/winsock2.rs b/src/vendor/winapi-0.2.8/src/winsock2.rs similarity index 100% rename from src/vendor/winapi/src/winsock2.rs rename to src/vendor/winapi-0.2.8/src/winsock2.rs diff --git a/src/vendor/winapi/src/winspool.rs b/src/vendor/winapi-0.2.8/src/winspool.rs similarity index 100% rename from src/vendor/winapi/src/winspool.rs rename to src/vendor/winapi-0.2.8/src/winspool.rs diff --git a/src/vendor/winapi/src/winstring.rs b/src/vendor/winapi-0.2.8/src/winstring.rs similarity index 100% rename from src/vendor/winapi/src/winstring.rs rename to src/vendor/winapi-0.2.8/src/winstring.rs diff --git a/src/vendor/winapi/src/winsvc.rs b/src/vendor/winapi-0.2.8/src/winsvc.rs similarity index 100% rename from src/vendor/winapi/src/winsvc.rs rename to src/vendor/winapi-0.2.8/src/winsvc.rs diff --git a/src/vendor/winapi/src/winusb.rs b/src/vendor/winapi-0.2.8/src/winusb.rs similarity index 100% rename from src/vendor/winapi/src/winusb.rs rename to src/vendor/winapi-0.2.8/src/winusb.rs diff --git a/src/vendor/winapi/src/winusbio.rs b/src/vendor/winapi-0.2.8/src/winusbio.rs similarity index 100% rename from src/vendor/winapi/src/winusbio.rs rename to src/vendor/winapi-0.2.8/src/winusbio.rs diff --git a/src/vendor/winapi/src/winuser.rs b/src/vendor/winapi-0.2.8/src/winuser.rs similarity index 100% rename from src/vendor/winapi/src/winuser.rs rename to src/vendor/winapi-0.2.8/src/winuser.rs diff --git a/src/vendor/winapi/src/ws2def.rs b/src/vendor/winapi-0.2.8/src/ws2def.rs similarity index 100% rename from src/vendor/winapi/src/ws2def.rs rename to src/vendor/winapi-0.2.8/src/ws2def.rs diff --git a/src/vendor/winapi/src/ws2ipdef.rs b/src/vendor/winapi-0.2.8/src/ws2ipdef.rs similarity index 100% rename from src/vendor/winapi/src/ws2ipdef.rs rename to src/vendor/winapi-0.2.8/src/ws2ipdef.rs diff --git a/src/vendor/winapi/src/ws2spi.rs b/src/vendor/winapi-0.2.8/src/ws2spi.rs similarity index 100% rename from src/vendor/winapi/src/ws2spi.rs rename to src/vendor/winapi-0.2.8/src/ws2spi.rs diff --git a/src/vendor/winapi/src/ws2tcpip.rs b/src/vendor/winapi-0.2.8/src/ws2tcpip.rs similarity index 100% rename from src/vendor/winapi/src/ws2tcpip.rs rename to src/vendor/winapi-0.2.8/src/ws2tcpip.rs diff --git a/src/vendor/winapi/src/wtypes.rs b/src/vendor/winapi-0.2.8/src/wtypes.rs similarity index 100% rename from src/vendor/winapi/src/wtypes.rs rename to src/vendor/winapi-0.2.8/src/wtypes.rs diff --git a/src/vendor/winapi/src/wtypesbase.rs b/src/vendor/winapi-0.2.8/src/wtypesbase.rs similarity index 100% rename from src/vendor/winapi/src/wtypesbase.rs rename to src/vendor/winapi-0.2.8/src/wtypesbase.rs diff --git a/src/vendor/winapi/src/xinput.rs b/src/vendor/winapi-0.2.8/src/xinput.rs similarity index 100% rename from src/vendor/winapi/src/xinput.rs rename to src/vendor/winapi-0.2.8/src/xinput.rs diff --git a/src/vendor/winapi-i686-pc-windows-gnu/.cargo-checksum.json b/src/vendor/winapi-i686-pc-windows-gnu/.cargo-checksum.json new file mode 100644 index 0000000000..50bf16fd7e --- /dev/null +++ b/src/vendor/winapi-i686-pc-windows-gnu/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"9652222664ffc7e2a26fdcdebdce0917a455b39d8fbcbf451bf0b011a3067bf7","Cargo.toml.orig":"5257d6f5283ab052b6af51f578a8c74e14c31deb53a7c6cd9e6fa16135d57eb3","build.rs":"4344ce95f51197e1377429cd9ef7a8e3f97d39546776705857991f2f9416f545","lib/libwinapi_aclui.a":"0fbe9d7eba9a106e90db5b015ed7751761c67f239dc6514a2cfad4e530f92490","lib/libwinapi_activeds.a":"68625fcfe4d6a203982fc319b5cc11e6ad07a57ecac442d07f0240e0aac5b28c","lib/libwinapi_advapi32.a":"9ac26b513ab07aed0435d7fe264d811a3d221619d70a34e49261fe0fa78c2cb0","lib/libwinapi_advpack.a":"52b75cb9f96fbe517c52b64bdfc12c928cfc427f4448151828e3c74460334c4d","lib/libwinapi_amsi.a":"72601859db74036937fdb75b8e7f3323f88c52261f4b49f55d1796e8f18e258f","lib/libwinapi_api-ms-win-net-isolation-l1-1-0.a":"8be3322ca57f3b37c8a5f77455fde9f901eebc1533b3aea5783312cbecf1f7e4","lib/libwinapi_apidll.a":"5e8500ef8566b8057585cc9a442feb62487f92cd3ab44831375455138a34d824","lib/libwinapi_appmgmts.a":"c1abfaadf53df46e9e8cc53aa857ffa94f2018b2ac43d9eb9af5fb6351824aa8","lib/libwinapi_appnotify.a":"2aa211c2947c93f913e0d820adc988902664d501c6c19f024bf0c9631e237f4a","lib/libwinapi_asycfilt.a":"dcfb20c70c45f5effccea72ca1cf0ec7169437b666e08d0e6d1a1c9b1246f43e","lib/libwinapi_audioeng.a":"8fd59a757df15225867ed3a9da1fd0e89bb8510da0d864dfe7ee19c6cf8f128e","lib/libwinapi_authz.a":"c5f91aa9ed03b794b760f468122e38c321a936b851ee3127934bb7e5b3480373","lib/libwinapi_avifil32.a":"abb571ed8955cc629b21049cc26a9268d2a4b026d445472b9df13079362b7ae2","lib/libwinapi_avrt.a":"d5ffc07ffb0bcd8708982137d7707941d775d50dae8f8a48a7f34019593e32cd","lib/libwinapi_basesrv.a":"97947ae129d72d598ab1048621ed66ffdf8015c3ed48a4043b399ca5c39348f7","lib/libwinapi_bcrypt.a":"e326aa515c54b84398aefbb1f89cc25aa8e015e6de5aa9657bd520b571a3dbf8","lib/libwinapi_bluetoothapis.a":"fd0c6920651b1d2cc58aba2bd5dc2fdce24008311de9c2a64d214e759d0b5daf","lib/libwinapi_bthprops.a":"210d9ae0b3f8b5d541d247ce9f5dcc9f6f76fa742c679feddac7e734c1f67428","lib/libwinapi_cabinet.a":"0a939ce654b1da5e476ba96e3133ca91005d754ace0b8731192cef71c2aba610","lib/libwinapi_certadm.a":"fde5cbb6c17d881e9910ff1f92f6c7398fce6d9ac86e9953c22517f6efa3a95d","lib/libwinapi_certpoleng.a":"f10c0228d72cdd0d90c74710438f32874e2abc790b2147c553da0f66811b7597","lib/libwinapi_cfgmgr32.a":"d03afff062eb551659da083557e12ff0a475a910216aedf0b62c66ab2b12bca3","lib/libwinapi_chakrart.a":"68f5267b9fc1c58343c60767afac09353fed9072b1ec90de6af7ae148c588064","lib/libwinapi_cldapi.a":"f9d6edbbf01a27ebee6202a33031df41c25a0dddf4f883f5424a7e6992fe31e1","lib/libwinapi_clfsw32.a":"2e06e28b09b1e33711f3f8b26201841098c3b21b2a798c5e1f06d43d57d2dfed","lib/libwinapi_clusapi.a":"c9ff19d78cdb9ee4840c9670c50876dd592f13c1270fb47bff56ca639631a3a6","lib/libwinapi_comctl32.a":"ac22f45bcfa30dc99aca01f7bbdcc74e8c5c42174fed2433d72ab9394d874965","lib/libwinapi_comdlg32.a":"8627efe7eae1299973356102941d37717014a209d057e72a7ab0d939dac7c4df","lib/libwinapi_comppkgsup.a":"0b23a6896cbb77be7b61e2803dc813fd8045e55cebd404dafb906fd0490ef349","lib/libwinapi_compstui.a":"51d0b2a1f59132521a02e10af2456b39ad717b69584fd455f53897666a3135d2","lib/libwinapi_comsvcs.a":"850811393316175ba229824303af68b79d5e5298d139ff72739611fb6b0b51e8","lib/libwinapi_coremessaging.a":"e7f09278971204cd768d87aeaf360762a577e61487efbd506edfe98c532e5a00","lib/libwinapi_credui.a":"20f8d03a576e27450836d417d68bd2efbd95a24dd48747d628ac1f961d59dcf0","lib/libwinapi_crypt32.a":"d6636245cfaebc8dc5231782b89d720665e87c41cabce1f8bec8d16b22d3f29e","lib/libwinapi_cryptdll.a":"82c5078c0c1597a78c8ceb57b56c32c950903c30feb896811abdc56fd07dfb98","lib/libwinapi_cryptnet.a":"641416ef4ca071ecebea4df802ce962d2fa66d7d4d6fd79ebb4a5bed5a272df7","lib/libwinapi_cryptui.a":"b6cda968797c29c01fb18866cf572e07dadbba84536e57971b4f3f952111d6b4","lib/libwinapi_cryptxml.a":"a0549ca925339de1147171c3ea7a0290d5b25c11c2ba81e88967aceb6edb2bb8","lib/libwinapi_cscapi.a":"ee700f192690598942164bb7b68401941209d32a4ff7d337c4975f921b12dedf","lib/libwinapi_cscdll.a":"2c3102f7b9ece5bf5e76f31450b68f2918a49b38f423cfec4008b17926c15d1b","lib/libwinapi_d2d1.a":"2c5ef4461d9a423a70754b352df2c482a87fa9095de45117da6de9947313fa0f","lib/libwinapi_d3d10.a":"f4ab0d6f2f5fbb00b0695f2caa571fd4cfefedef0875c4dc9ec5d46b9394589e","lib/libwinapi_d3d10_1.a":"bbe5b92965a987c5ed5dd860218bc51cf2e1c8fffda4314ff608283655e53d73","lib/libwinapi_d3d11.a":"90e6d40c9faaecb427cc835b6d35f9c97b03fa6343b96254877ba1e0c5fc5be0","lib/libwinapi_d3d12.a":"78576e2db7b47ed1690d825e853e3d1674bf61b860da0efd4a4e14bd6aacbc61","lib/libwinapi_d3d9.a":"213ac512f39f2ffd714160465b86d75fba2a06fe62808c2a957f2d92b54d306e","lib/libwinapi_d3dcompiler.a":"424680ef712001ce3b9af808ceabd54c3510c3cc35a7fb65505994a3ea6f8406","lib/libwinapi_d3dcsx.a":"f85eed17ab41d79f7ffef10e586359a90ad70cecbff80cdeb51015f1440df91f","lib/libwinapi_d3dcsxd.a":"6d5e5c53acfe3eb8e292188aa2f777e07c2161fd1740d1eada9d8b0c271b3453","lib/libwinapi_davclnt.a":"0a99a29e6292f55e14a7c2d403b35d5b4de7125d77dc0ccb218f9d58de0d0f94","lib/libwinapi_dbgeng.a":"77eee9c92f9ebd54fdf746df2af14b8cc744f3e8c729d68ad7fc38af85f70fc5","lib/libwinapi_dbghelp.a":"f0ae8d1d66bee0b1d13e8699da7118a0556ba6912976544fbccaeb2d7b0a2f1c","lib/libwinapi_dciman32.a":"f22380ae622f6228d0062931ba26c5a8d6f82db059a3ef935cf568bec711734c","lib/libwinapi_dcomp.a":"2fbcba609dfbbf5be4698488c4576a6b672d05c7f7ee3596b4c7b0eaa7b5aeb2","lib/libwinapi_ddraw.a":"6c48b9705f4d8bd99c72fb046289403161e1cda68e20833c9976fbb2e7c2ad85","lib/libwinapi_deviceaccess.a":"3b304c6f3a7f608ced8ca1c1d12f80451c5c3e5c38a31ad6afbe1331def5da8c","lib/libwinapi_devmgr.a":"582335b229c0c41f117ecb231f2a3f454c1e4101a748006df5e48174063309ef","lib/libwinapi_dflayout.a":"ee4d80b5babc4e5c86a5a42c2ac81db97968b2ff0c4f90ae290893f575c0ccc3","lib/libwinapi_dhcpcsvc.a":"b56ecceb638e762306f5f1f211efdd18b00a50ff68043db24129008d22757732","lib/libwinapi_dhcpcsvc6.a":"4fcdb0360d94492060e8ff6447ac457ef574111c2ad609c93044a8e122ee9a80","lib/libwinapi_dhcpsapi.a":"d3ff30b18ba039ba0dbbb5b6ec1d72b1cb3f4dae9cbab0225ea6140e2006f58f","lib/libwinapi_difxapi.a":"bf7d9dcd82e317a49838ba62fe7a2f14bf7ac0c8532f37005eed70d3ac0a40df","lib/libwinapi_dinput8.a":"34110fbc33a44cba74d4ca6d6d929ad2ae966d94910f0219413e8940da3b2729","lib/libwinapi_dmprocessxmlfiltered.a":"44c65bfa21a4f02cb9da6ca37c6f0a9b96e8b4fa38a41ca579e89514d8c1af47","lib/libwinapi_dnsapi.a":"aa56f391dc111521f4fa1ab4f30f3ee865b62c6be8a0de8a4734058829651896","lib/libwinapi_dnsperf.a":"aefb3a4844da409f0400434521411f962865504ea7da7aa8f5d438adc518f8c5","lib/libwinapi_dnsrslvr.a":"ac9bb5a3501088c341e883bc9d57280cc27634e07f23910240cf72d190344be5","lib/libwinapi_dpx.a":"e6cee99989005e4437765d62d559abf7020c28eb153811af3044ec86472c86c9","lib/libwinapi_drt.a":"2d34b2d341f315055c4995616c3e403a512f9a082107328e0d4de3f2dfef19be","lib/libwinapi_drtprov.a":"6d843ca33dbf724a9144560c9ac102f93040aa4f497871b35b2b9f04742ec17c","lib/libwinapi_drttransport.a":"359e0e38a56303c810d0c0cde22ebb79c1d4d35b4ef05666ea4cc63b7db1b6a8","lib/libwinapi_dsound.a":"ca4ef310b1a647ac8ce805440fbec9b6ff5fa2c4cb182c9f036d5b1f722917b1","lib/libwinapi_dsprop.a":"9b6388208daa1fd6b3a9cf3b824562c080a33b3700f9ab0e900ec65bb72ac84c","lib/libwinapi_dssec.a":"67ad35bc06b48ae9fbff63ebb557ae659221ca205adc87ea0794673db3b2f5f1","lib/libwinapi_dststlog.a":"2c21e4394caba6685c241269a969e691aba2002a3a0d5231b9593e35b39ae09a","lib/libwinapi_dsuiext.a":"bffa87caa660df48f451c042bd508a0ebf42164e0d21b2fc28fa257e3176e9e3","lib/libwinapi_dwmapi.a":"90bfb9cc29ab4c1727ad5ce3d2377f4de3844a33fdef9c4fc8c1884a352366e0","lib/libwinapi_dwrite.a":"25175cc1f319922defc1250458235fc928220dc8c83ca47debc8c394c530272c","lib/libwinapi_dxgi.a":"a34fbbffc722a65e3dee7bd343922410bd967ee83312a51d012197719cebe914","lib/libwinapi_dxva2.a":"7e1e4970e62fcdd79e4da6c115cf86958f8b700d10cfe866cbf6de295b066927","lib/libwinapi_eappcfg.a":"f44b33f18ab48d02c0d0b3959d4e4b74e274ee7f16a0b379ecd2630060600eda","lib/libwinapi_eappprxy.a":"ef3613d4431002f745dfef5c86bff39bc46cfdb1a2613c08dc3bcd1c92f9cae1","lib/libwinapi_easregprov.a":"167ddbd0c62e76c61c20376abc5f3bd0a2e9a10b69b9ab406d43bb33375d15b2","lib/libwinapi_efswrt.a":"40de24aca17035eab38f9635c72304599b58df37c3ff1fabf62aefc036f31a5f","lib/libwinapi_elscore.a":"8790f716c925482c8f3a90e9f102e1cbd2a98a95d2da74e6ecb40cb213f98f72","lib/libwinapi_esent.a":"84fd8fd3a6a0a230a1932dbeded85e32e353eaa35bfbca14cb45de1c80f73bf1","lib/libwinapi_evr.a":"488b674f133d784acd30eb724f364f2ab95967be96f5644084d8909f573178ba","lib/libwinapi_faultrep.a":"a95e078bb07fe9e06a891013bcbd55eaeaba2fd08c79554803cd7f83e3a294e2","lib/libwinapi_feclient.a":"ca0dae89be31ef2cc4da0256882fb7807ef6b73d87eedd44a9199b85c19e1dae","lib/libwinapi_fhsvcctl.a":"31dd77b721e1f7e45231538d587984a2315b7e2881ae74ab078107f4ec344378","lib/libwinapi_fltlib.a":"75bc50b732fbfc074dc20a6807400d007697840414402d44f7efd8b6d80c6c3a","lib/libwinapi_fontsub.a":"32428decf64e4fc27eecd8f251ccbbfb4d5141f652f879998dbbd7bb259265ef","lib/libwinapi_framedyd.a":"bb0ab50255f033944d8193fd470344c00b8f780e37fe96a56b5e801debb2241a","lib/libwinapi_framedyn.a":"8f6c42e8c79b4e19e214136706aa4f8e45f89f46eeaefce9d3f1f37637dbc451","lib/libwinapi_fwpuclnt.a":"6f06cca6905ce91d0486dcfc14c3d855c8b04082e0d3b86995a4a54a408a9bea","lib/libwinapi_fxsutility.a":"86e20adbecb1ff711df062069687e1604ce8eedd8dc3e08e63610b60aa2e50d1","lib/libwinapi_gdi32.a":"090e67291731b23a6d72d905cfd2638007158413beba4857d822a13a99f90cbf","lib/libwinapi_gdiplus.a":"d74fc74cd1d29c5cd280a7e95a5a4d445af7bd91ab22641f3ae6299a47d1e3e0","lib/libwinapi_glmf32.a":"9906033164f6ea75e0f04794b4999584713a0fb368e026888a66650b10b99460","lib/libwinapi_glu32.a":"eff06b5b5ade0f732f52a989eb530bb4c40113272297d481187e554dc4742fdd","lib/libwinapi_gpedit.a":"a5dfaa48f7e5119fdb3aeecba3f054c3cba02bcd37976438b3214a6b383b2f3b","lib/libwinapi_hbaapi.a":"866f67233b72526add51607300951699f3898f89d6819b4aa17cc6632056588e","lib/libwinapi_hid.a":"153a556c5c938350af4a2bc4df1f365292450fd8f8587c94a397e9e2dfc10f68","lib/libwinapi_hlink.a":"2b9768209993f82cc588b9c5747834bb98332e5e2c0fe36360357e74b6477438","lib/libwinapi_hrtfapo.a":"737fab6f539c737dd6e3bc954646cd0544f779571832ee210bd6d480a2fe4a61","lib/libwinapi_httpapi.a":"06bd3ad3b5c053c25068b3a7e94f5e7f3d78640de81f2aa1ff47405eb39ce0d1","lib/libwinapi_iashlpr.a":"cd2f12894d85028c6d4f10ab126ec7e5232625ca9e5e5970d0afce9062193ece","lib/libwinapi_icm32.a":"fcfa09d72832a65d156b2bb368643cf8aad7305e503cc2a78f700fbda0585aba","lib/libwinapi_icmui.a":"b27fc55b65dd7e25ee29d164c2d419917c9d9051ed8d6ab1a014bfb44223c1ec","lib/libwinapi_icuin.a":"597ed6d86344cb2edebb6fb49a289a8c57bd2b7aef461a82e59b12fe7e7ca06e","lib/libwinapi_icuuc.a":"813ec6598db79798351b2360106b874e74891c864d238cbc2223ddba2c445a4f","lib/libwinapi_imagehlp.a":"052721c9e7c20fc720f99440b022ea8078423541e62c0ea29c977caf5c442309","lib/libwinapi_imgutil.a":"6c7e2e560c7af9de94e1564940cffebc461879f0e3ff584cdf7b455cf721d529","lib/libwinapi_imm32.a":"cd915a1cd725b687422819b3c0ae2ce44b5c7888464ff0d2ff1676688adfd60b","lib/libwinapi_infocardapi.a":"4f18800709730f89f173de9326d81d06e2073aa27c7baf8311cd7f8e6d5dd667","lib/libwinapi_inkobjcore.a":"33e0db4e11e77ed4bc6114d45ca529939b3b77bab57cf87118c9c76e6bc02cf0","lib/libwinapi_inseng.a":"d195b7f2386197d31441b3c38a54984a645af9f1bdc55478ac0203b69c694573","lib/libwinapi_iphlpapi.a":"744eb5929f23063698b334b0215366127b56355245cd13b54ca3aad43538a782","lib/libwinapi_iprop.a":"0fb9770f187923cdab0a3651073ca541c1fbe73235648bd5de294b16416a84eb","lib/libwinapi_irprops.a":"23fdc1e1a97503d3ecb0e80e2ec2dd26b976a81f314d4f68f17fd7ae0baea612","lib/libwinapi_iscsidsc.a":"6eb819c654e9e5fff54eec5bb8a92b39d83e99735279ad619d21049ba021a66c","lib/libwinapi_jsrt.a":"7c763e81a81b50fa22fa4ee8ee7c0aca94a5b4cd5dd1a3ada92a0af9a92ee191","lib/libwinapi_kernel32.a":"0388f0d48e65b04acca610f1810bef501c45d73a2262214d78ef849dfc01587d","lib/libwinapi_ksproxy.a":"542c343abc37f44ed008029b6225a45a450dea4dd44914e2f3f31b2b776d42af","lib/libwinapi_ksuser.a":"66e034242fcf78b7855ee275a55fbab76f7601b20bdc6523792f5d5728685d32","lib/libwinapi_ktmw32.a":"cb3ea9233bf46cbf14b498678af82aa5b3334629babda943ae145d35c9b9a4eb","lib/libwinapi_loadperf.a":"58ad561fcfdb9cba315222570c314e2f4ca35b385a4d50495a44ce367552b1c5","lib/libwinapi_lz32.a":"c67ea712f48e6f585fdbaca006a1a5735992d341f14f368f7a0e291ea082bdce","lib/libwinapi_magnification.a":"dc6703ab97d304c5382be388b985e22b2e1b46f32b3b522b79d7efc1935f1709","lib/libwinapi_mapi32.a":"886643d423fd9dbfb68f33cead4f3b170eb1bea241d504545dcd3e8e573c6fa4","lib/libwinapi_mciole32.a":"b698d2060864952d2bf8014aa372e664cbbf198e893768cd6739f1469fa3d149","lib/libwinapi_mdmlocalmanagement.a":"9b0c642332bff843e4ab02eec8cd00d5d08c7d2d1047b203b022601ef6785760","lib/libwinapi_mdmregistration.a":"065d25244ce5c866a3489e54b8b7772d8a1e92cd95ea39e13b838ef2d6109c31","lib/libwinapi_mf.a":"136eff680a3ed1d47826286ee61a0a77ee7776b6cbf78751ae4e7683dddcf23a","lib/libwinapi_mfcore.a":"8d086314d9f2a5d8e1facd389304de147c064b428874ec1834adebc71581614a","lib/libwinapi_mfplat.a":"f4ef284f7c5acda4ad72ea27389485b386fe1f76405981695d4387323235a6e2","lib/libwinapi_mfplay.a":"5db7d76cd8a3d4689381055685b4d2d9b03ad1e346de02fa998dd0c46d630f8f","lib/libwinapi_mfreadwrite.a":"ce1ba6835835b16445a2dea51cb8957d1fb1fe3f26c2501c4aedacf40eed2d13","lib/libwinapi_mfsensorgroup.a":"641454e135aa030f835088d98b42c1b5ed9ca1d605fe9f30da94de9bd7624e7c","lib/libwinapi_mfsrcsnk.a":"edc08719f808d2d56157647e991573222112856f1e1d26f6bc91e00bfdbb302a","lib/libwinapi_mgmtapi.a":"9605a3306379c2857226758b2feb1bfb9db5bd6ddd3c959eac818b633438c1f6","lib/libwinapi_mi.a":"2a0dca38bb4338a37c77f5b8dd964a33392db42b8d2c7b91db0ed9c3443d01f0","lib/libwinapi_mincore-api-ms-win-core-com-l1-1-0.a":"0a768dd0f0cdfee293589a8d63e9831a7c0f35a3e8d21a537ea6860f924769f5","lib/libwinapi_mincore-api-ms-win-core-com-l1-1-1.a":"edbeed560863d20918f95425c1ad2f2036bd0c638cd391b13685049b34761e10","lib/libwinapi_mincore-api-ms-win-core-com-l1-1-2.a":"b9832dd7d7405f7a10170555afa6d34bd4589eba680da1e4e9418ab3e5dffc5c","lib/libwinapi_mincore-api-ms-win-core-com-midlproxystub-l1-1-0.a":"6dfc0a2c4d89b578d665551a7f4edf4d1f518821e74081a3cbcd79e10eb60f4c","lib/libwinapi_mincore-api-ms-win-core-comm-l1-1-0.a":"ddb31dfe647ed2edbbc9be435aefe222aadb9742af5986928c7d439dbd2aaa43","lib/libwinapi_mincore-api-ms-win-core-comm-l1-1-1.a":"b778aea784de837bbc7c5909cb30935d088aa952ff6d032ec14ff935cf6fd561","lib/libwinapi_mincore-api-ms-win-core-console-l1-1-0.a":"69f925fccd8af3f57b671bf3a0df5766d9152044ee1e7417b6846241464ae914","lib/libwinapi_mincore-api-ms-win-core-console-l2-1-0.a":"8cc653f70efe3f0429365811f1b135eedd70b07c485c6483dbfec4d3faf25b22","lib/libwinapi_mincore-api-ms-win-core-datetime-l1-1-0.a":"fd818a070d14bb364d6c880ea2ff48ccb60e63739eb9be6c86c5f54d2ad000f2","lib/libwinapi_mincore-api-ms-win-core-datetime-l1-1-1.a":"dd45c010f178a8b81c8c6c778d9e59ff2952b2cfd37caca1060b4165637936d9","lib/libwinapi_mincore-api-ms-win-core-datetime-l1-1-2.a":"cbadd8bab30baa53143b4083ab0b51a4782585eedd34687840ac5e7b409ed0bb","lib/libwinapi_mincore-api-ms-win-core-debug-l1-1-0.a":"a6e126bb0f223f14951a2cd6fefc3724c94936901653d2f4054bb37723725aad","lib/libwinapi_mincore-api-ms-win-core-debug-l1-1-1.a":"7fe5fb93c165948f5c364d856fb247f028d001990532fac5e738cf7952e6d86b","lib/libwinapi_mincore-api-ms-win-core-debug-l1-1-2.a":"3881a5490d4fda0b41991ed9205b536cb2520a79855599168bbe2520612a6958","lib/libwinapi_mincore-api-ms-win-core-delayload-l1-1-0.a":"ec0a01289b7f908e2162791e2eecb2ef36b93ed51921ec70ff2ea3231551202d","lib/libwinapi_mincore-api-ms-win-core-delayload-l1-1-1.a":"6f2e56ef3a7715a5d2916749b87004e87f483be10f847c9ebcd1bb983cb46638","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-0.a":"05c6265c3d0a1fdfb345cbdafeec960ead6595fe1b0d065131dd43fd8adab78e","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-1.a":"d02379934fb212ec84e9df5d3b0f21b7728775134509b55b595a3c91f26d03cf","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-2.a":"682afd441ce478b1b7792b058934ef98690e096f3d944f7b2a52bc1158c021ec","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-3.a":"fa8ed8f3f501b8d87437fd1689edbc3a1b3ca5f87b007e30cb998249eb03c1c7","lib/libwinapi_mincore-api-ms-win-core-fibers-l1-1-0.a":"406eef3acd78a7d0ed3a882a72dd5e3ecccdebaf72de13a376288525c8b5b67e","lib/libwinapi_mincore-api-ms-win-core-fibers-l1-1-1.a":"aaf79b1f6cdc1078564041ac49e438f2603aaf432b8cfc219190994c7d23b37f","lib/libwinapi_mincore-api-ms-win-core-file-l1-1-0.a":"63bebd6f1cb8a22715e72ed90ee2b5ea2d3b0eb400273775de4a6bb1533eadc8","lib/libwinapi_mincore-api-ms-win-core-file-l1-2-0.a":"bae933701c0c334170e98e8d495ed06de8b0d8843cba538ab63e4f66cc27a47d","lib/libwinapi_mincore-api-ms-win-core-file-l1-2-1.a":"ab106bafb84360fa31fd4326d5a1aed6cbc694682ca0997f6e780d43d0422505","lib/libwinapi_mincore-api-ms-win-core-file-l1-2-2.a":"810cc1400bd09c037ebcead50b625edc80025ae4325d652af14efce21c982d3f","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-0.a":"1732b133cb5e7f1825546daddeccfc9848575ba92837d8fe420c06015aca4bee","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-1.a":"d083935f4238714d013811a5c064b0fadcffe770e37c89054fbd8467b1b28c2d","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-2.a":"148e266b040b29ce152a4d7627fea8081b30df0386dcf1d88be4c8bd0ff477b2","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-3.a":"076f2e6cb81e13f8e81df3f59c8c3b7bcfb1a1e954f3ced5684e925100e73ae7","lib/libwinapi_mincore-api-ms-win-core-firmware-l1-1-0.a":"b60822892e24eca9a137c60b9919f6fabafd797284736e1033ea468502bf20f7","lib/libwinapi_mincore-api-ms-win-core-handle-l1-1-0.a":"66714b765c428ba3d48a87cb388572abe76eb370a726a201fee6ffae6b58c58a","lib/libwinapi_mincore-api-ms-win-core-heap-l1-1-0.a":"c0e31d6801d3ab01cbf7150b3cbd9b1f0d3de949064ac1c91cb315f199c9789c","lib/libwinapi_mincore-api-ms-win-core-heap-l2-1-0.a":"fe494eef68d5369999f3f955e543033ee66bddb10b220bf6752a9a1152d4e7ed","lib/libwinapi_mincore-api-ms-win-core-interlocked-l1-1-0.a":"b7655e26bd63619c3c441fc8909be9f7901bf66e68ea89744ac1b6bdc1bdd888","lib/libwinapi_mincore-api-ms-win-core-interlocked-l1-2-0.a":"0c08a4eb795089082da5f02100855804486f6456fc6490045ea2be6e8f78ffb6","lib/libwinapi_mincore-api-ms-win-core-io-l1-1-0.a":"f1ae60c245a584968603acafcf39291df60575ae54a6af91346f3cd55dbe60c7","lib/libwinapi_mincore-api-ms-win-core-io-l1-1-1.a":"a3c4ae167b393d11c804dfe1023011bad0355ba64dd1855764249ebd09d9546c","lib/libwinapi_mincore-api-ms-win-core-job-l1-1-0.a":"e9fde2a40ec9b032fc4a368e8c20310d6381cc7cb75461c7f765b3256723b48f","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l1-2-0.a":"90380759dce4dc4f4d79f313313883b79ad05dcf458ca6ae707a4c5135fc62b8","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l1-2-1.a":"aa6b6648ccd5ed03b82f95ce236f0e515b3370389791f32c768ea5b1e9cd698b","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l1-2-2.a":"9f8425260a2ea46de8c1ac47f3066cb9034320713d6c0256f600e5a68fc9025d","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l2-1-0.a":"b80d4fe131e88cd1b7aff511f9a8801a24e8979d36ddbefd6af38e90c8b0f340","lib/libwinapi_mincore-api-ms-win-core-localization-l1-2-0.a":"2b8e6b1e236d1446210ae3c04478333be3b05affc61f2d87f79cc746cf3061b7","lib/libwinapi_mincore-api-ms-win-core-localization-l1-2-1.a":"9db8557b6d16de78ddb17aeda7a9ee53f5bab317bf8d6eda670af140613cea41","lib/libwinapi_mincore-api-ms-win-core-localization-l1-2-2.a":"cf24d229ed67439ba165ca88690733f6749cf96e6fc3389101744b213ce329db","lib/libwinapi_mincore-api-ms-win-core-localization-l2-1-0.a":"4a27c7bc16d1457f4958c11d811356b2ca8031d1294b49b0403e956476f649ff","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-0.a":"bba88f3d4b15ebcddea1d24e5960e4b672a1ba98efa1aa4eea80cea6497ddba6","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-1.a":"887438b3d8e0442cbc7249ebd56858914393aff5a450343355c56d2c58ec83be","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-2.a":"9f3dab5af0070cd7803478647dfc1a302613af901bdb901012def3869e59ad0b","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-3.a":"e821d0e25650112acbd7b4eb9e386a5a332328035b830f5cec134eacb0c86865","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-4.a":"0db1359bfd1dccb45542ffd01cf506d3566d5c2373c3cfd2072beb3c1e6458db","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-5.a":"fbd3c250b3903d847f12d6b532f42d55845a90f98d9ae824b4f6abea63c157f2","lib/libwinapi_mincore-api-ms-win-core-namedpipe-l1-1-0.a":"d174eee6bea84eef6ec5ae42bd6b22e238914d9fa5c78debc4dd0bd1f77d3419","lib/libwinapi_mincore-api-ms-win-core-namedpipe-l1-2-1.a":"93055270f2a4f829c54e6da5d183488c6e34b2f908a86c1b7b4f88cb2f7e4caf","lib/libwinapi_mincore-api-ms-win-core-namedpipe-l1-2-2.a":"520bbec5c993575fb8bbcab7f0e5324d1cad7b25b02ae9e9d4c2e1a37efcb0b9","lib/libwinapi_mincore-api-ms-win-core-namespace-l1-1-0.a":"3adce79118ad0d94c87d593ffe1d27cbe119671dc27e610d1d8376b0d228176d","lib/libwinapi_mincore-api-ms-win-core-path-l1-1-0.a":"84d2733438369fd440a732bb3a253a45f36489a3b91dbbce8bcf2adbc1af64f6","lib/libwinapi_mincore-api-ms-win-core-processenvironment-l1-1-0.a":"a769055d3f0d668d259b201a7cf7e5eca2ddc660c356abd3f2fd0e85cb4b2f72","lib/libwinapi_mincore-api-ms-win-core-processenvironment-l1-2-0.a":"5fcf5cc4bfecb5f85d3724f6ce0efc16ebef41cfc70afe7abcfbd18741d4ce50","lib/libwinapi_mincore-api-ms-win-core-processsnapshot-l1-1-0.a":"2de13a8f3b4c2ee0a255979e098c20b2a887b579aa14025d4b11af1462137fbc","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-0.a":"6b41760bf3765dd0f23cc2e3ec7e47791c9fcd22b91bab90d6a4dff5b70ce7de","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-1.a":"daba67d5d58df11f17ab5ba338527d9072b50a5c993d7dfac7cf9dfa00f28252","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-2.a":"90ca7e44d4348b1fb7f748bdd555ebd46a13a4ed9ca5c2fcff013759a99d6bb1","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-3.a":"99b6b7d260adbb22cfbde40c0cf4861687683fa0d466eb987c2fc45bf034dc33","lib/libwinapi_mincore-api-ms-win-core-processtopology-l1-1-0.a":"f284ac99690d0dba0c71a130ba2b76c7b3e8613c39a4bb24d3950ce86152dfcd","lib/libwinapi_mincore-api-ms-win-core-profile-l1-1-0.a":"5353045a09d71f476ebc7b5bfe997f771ed9ea5175aad5d71349fd0d9b1c82f4","lib/libwinapi_mincore-api-ms-win-core-psapi-l1-1-0.a":"3c68ee1e3dc7d727cfe7a59713388e15caf6c0bc815727687ff85c9e94fe938b","lib/libwinapi_mincore-api-ms-win-core-quirks-l1-1-0.a":"a41d662b9aa2b75d2850a4767df778c04dc2d84a6df30bf1f54bab12ee575635","lib/libwinapi_mincore-api-ms-win-core-quirks-l1-1-1.a":"399dca0788789249e60b9dd864d71d8492bf2fb4a40e3b7c7f1ef75e90e07a37","lib/libwinapi_mincore-api-ms-win-core-realtime-l1-1-0.a":"5ab31736b264962e259667cbbc562f3806a565997da9f6a4a856ec61b45cba35","lib/libwinapi_mincore-api-ms-win-core-realtime-l1-1-1.a":"dc73efb3037801cb681734dfa2bde7df449234f36cb8d96d50c8f717f20b423d","lib/libwinapi_mincore-api-ms-win-core-realtime-l1-1-2.a":"d5a4ddca6419ef157f40bcd53e586246f9ba406792c2099bdd018ff007992c68","lib/libwinapi_mincore-api-ms-win-core-registry-l1-1-0.a":"0f9f5987025d2a73d7bbb781bf5ee107a9a69d334ade820e762ff825d81e36a1","lib/libwinapi_mincore-api-ms-win-core-registry-l1-1-1.a":"6fc2f7bcd71a503b86ca4280100db839fd7323aa54a4213626d8b39d45ae98ff","lib/libwinapi_mincore-api-ms-win-core-registry-l1-1-2.a":"89eefb0e50e7742bc6449e92964588c149eb709bfd66e1c650177ca7e57abaac","lib/libwinapi_mincore-api-ms-win-core-rtlsupport-l1-1-0.a":"1e1d445734682622d17a01c68878c0e701394fb60b67ba5ac9048406a870bb86","lib/libwinapi_mincore-api-ms-win-core-rtlsupport-l1-2-0.a":"00bda2cb8e87172c51f64c9e561e083342cffa5e25f47a2af9cb3ce647063aea","lib/libwinapi_mincore-api-ms-win-core-shutdown-l1-1-0.a":"1be72599a305d240d3db2a5b2d14215dc6bd7523bb50f51581318c9a8142d9a0","lib/libwinapi_mincore-api-ms-win-core-shutdown-l1-1-1.a":"8cef705b7c111f4b419b1e3501fc8238ac8fb20e23e30a58ec8003a6841822aa","lib/libwinapi_mincore-api-ms-win-core-string-l1-1-0.a":"d50c3141fe9565a3d6840032fda736e661e5df6104c83747666cd48e02072138","lib/libwinapi_mincore-api-ms-win-core-string-l2-1-0.a":"453e9e4a96badb784e0d78c034bd6c762b54c9fd3a868337c5ee9b867003f889","lib/libwinapi_mincore-api-ms-win-core-string-l2-1-1.a":"396fc7787a3f8ed7229f764d7bef572e03ed177fbf240281e9feee523808803f","lib/libwinapi_mincore-api-ms-win-core-synch-l1-1-0.a":"7fe7823e6d066aee13460c2a29b7b1d87ac50c3434c03d178eb251516660becb","lib/libwinapi_mincore-api-ms-win-core-synch-l1-2-0.a":"13d8aaa16280287bda16a94140174e0f120acdd74d5ce9060a1af6258bb4e60f","lib/libwinapi_mincore-api-ms-win-core-synch-l1-2-1.a":"5bf2000f1448a7d9769a456262eed663762a757ebf9f32dc239044213e9b641c","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-1-0.a":"e96433e23e06f4bb679d6597611b29f7b5ccbc5e2017d1cccb9476611f8ee7ed","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-0.a":"d726f97fb99d6afe1d1b571531a91acb651ba72d6c5a88692348502c9b69fe9b","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-1.a":"cb3bf9f785a332aaf67b35671dede4f0c5151fc01ee12ec2c24a1d065e201615","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-2.a":"e14e1da2967718d7af259cc05bc92690effce83c2eff95de28201c9441df3352","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-3.a":"c7629e320ce40ba12d269f5d0a0e7b42c1c77c247a54609842bc935dcc289481","lib/libwinapi_mincore-api-ms-win-core-systemtopology-l1-1-0.a":"7e48665fe920c9274ad9ad32efebf2cdd7c494f4e02a51a94b5c3c1fee37953a","lib/libwinapi_mincore-api-ms-win-core-systemtopology-l1-1-1.a":"3933565c0fa91f18e579aa50d13f3957983e785d8fc86cab1ea4e0c32004164a","lib/libwinapi_mincore-api-ms-win-core-threadpool-l1-2-0.a":"38978f8427f5ce000c303ef76be6c8c3b53bd77232f09d57c1fd09cca3b10a96","lib/libwinapi_mincore-api-ms-win-core-timezone-l1-1-0.a":"deb71b00625e45b52c77a86b20b6ded210231cd8393f408aca36b53f87d14777","lib/libwinapi_mincore-api-ms-win-core-util-l1-1-0.a":"39430cbe7717727cf39c10d6daa268b2c6d2bd4edafb321aa47804471152894c","lib/libwinapi_mincore-api-ms-win-core-util-l1-1-1.a":"023c1d785eb7eb05f68b09cdd4e705f726dcfe12132ba591ecd49a978009392a","lib/libwinapi_mincore-api-ms-win-core-version-l1-1-0.a":"e3231d5b7ed82b40539d6cce58770f486be5e540e1b34074fbb71dc8434ee684","lib/libwinapi_mincore-api-ms-win-core-version-l1-1-1.a":"b56a474c026fd90945b5c87ec250715abc675db7efbc9de72f05e2b81f8bb8e0","lib/libwinapi_mincore-api-ms-win-core-winrt-error-l1-1-0.a":"c1bd6e9c3070c8bc1ccec1a070fb0fe4845e26f2f9319ef8d5ce2f296eeef376","lib/libwinapi_mincore-api-ms-win-core-winrt-error-l1-1-1.a":"d4c9658171d702015fe1f09d189773d08f92287572ff60d9c9b5880818ed6a79","lib/libwinapi_mincore-api-ms-win-core-winrt-l1-1-0.a":"8bc675d80fcf0c76eabbaad929696820993e8033039681bdf587e42d274bef0c","lib/libwinapi_mincore-api-ms-win-core-winrt-string-l1-1-0.a":"f4f83aa4ca2fa88a9e5f30ec1a249bc3345b113b250193b5516fe0d363221b12","lib/libwinapi_mincore-api-ms-win-core-winrt-string-l1-1-1.a":"96bc5168f805d40107ffcfb3240fb91cb0cc8f543f8d11fc2f44ba9b68d016f2","lib/libwinapi_mincore-api-ms-win-core-wow64-l1-1-0.a":"961ea44da0db20c1fc5fc3b55c38ff42a21bab671e8f3c28718a81ee7d0443cb","lib/libwinapi_mincore-api-ms-win-core-wow64-l1-1-1.a":"d741c43543343760166a79eb8ef5053f5bd3722d9b0018130352e187a3246c7f","lib/libwinapi_mincore-api-ms-win-core-wow64-l1-1-2.a":"aceef78b2dd9a72d3166068015a5f3df6697701ff7044524af691a209e466eea","lib/libwinapi_mincore-api-ms-win-core-xstate-l1-1-0.a":"9f67b5ecd99ebf53c56456d6ec1e8a9c8985417a0dc51b8be68980a1b8a83ae6","lib/libwinapi_mincore-api-ms-win-core-xstate-l1-1-1.a":"24ec470de618f9dfc426e450a07cb85cab05235d81077f3477f1ffe7ce0c9e5b","lib/libwinapi_mincore-api-ms-win-core-xstate-l1-1-2.a":"4399c090ea8eaeb449e06419afc8287ed6a56e44f0971e25d4ac6b9b0b216f4d","lib/libwinapi_mincore-api-ms-win-core-xstate-l2-1-0.a":"5a91eb1a242a21befd15584e5a4741e25d83186a42c58aa921630d2937da1bb6","lib/libwinapi_mincore-api-ms-win-devices-config-l1-1-1.a":"cf9810fec10165072812b8e31a3a951e73be581720ed19a562ad82cf465c056a","lib/libwinapi_mincore-api-ms-win-devices-config-l1-1-2.a":"780cfad93f3fc5e95ebec5181045ccb1426bc385253ce2668c483efa39c1b404","lib/libwinapi_mincore-api-ms-win-devices-swdevice-l1-1-0.a":"d837d7329ed6767d0487c814916fef36335a460fe1f62fdb85b46d36747c8d6a","lib/libwinapi_mincore-api-ms-win-devices-swdevice-l1-1-1.a":"3f85f22ca21b5df8e6173522085649e67ce84da16b77e9cae3d80c9f0e3ecf66","lib/libwinapi_mincore-api-ms-win-eventing-classicprovider-l1-1-0.a":"22e024a0968fd319b5b65df792f93e15116b50575911c0f7f1502dc1d8c70bd5","lib/libwinapi_mincore-api-ms-win-eventing-consumer-l1-1-0.a":"6cb298bb1a9908a2912c331e19774fc19bf80ead0f4cb63c3fc659f79035617c","lib/libwinapi_mincore-api-ms-win-eventing-consumer-l1-1-1.a":"2c6898a3d5bf294ec96de606bc608827dde28e3d3a185b741915ed9045564dd5","lib/libwinapi_mincore-api-ms-win-eventing-controller-l1-1-0.a":"a39ed9b36bb3cc0552d79ef532fc7e3cedfd67e9936e8bc08192b9c0aca2a9fb","lib/libwinapi_mincore-api-ms-win-eventing-provider-l1-1-0.a":"a27242e68654421c9b4dba80b1ff3389854dcf112258cbaeb20e5476a125d752","lib/libwinapi_mincore-api-ms-win-power-base-l1-1-0.a":"d136c5fe2c00a2318b5417bacd8eca2497e3d2446fb17e88af179588110f59ff","lib/libwinapi_mincore-api-ms-win-power-setting-l1-1-0.a":"5f15aea882f82ee5dc2d8d754a362ea04c5a4f862f03a00f7e74b0abbae984df","lib/libwinapi_mincore-api-ms-win-security-appcontainer-l1-1-0.a":"db86b02c2a0aff2984244461868a6b071b98765f4ab0b51b82c9e041eecb913f","lib/libwinapi_mincore-api-ms-win-security-base-l1-1-0.a":"2c5d63db76b846b908ce0b2d3baf783c140a536030d0baf7c658ae11b3fb1d1b","lib/libwinapi_mincore-api-ms-win-security-base-l1-2-0.a":"34f3af57df1e30cdaf70db34222df8e00ca72865be76b7242304aebb69c75465","lib/libwinapi_mincore-api-ms-win-security-base-l1-2-1.a":"8f2a38ea004085ebc2a424842ba7bc2c8ce9b15856823ce3cef74b165be9a06a","lib/libwinapi_mincore-api-ms-win-security-base-l1-2-2.a":"318c666ff4a8cd75cecb55526d5b42215f7020562c8577aa01276372e4ff213d","lib/libwinapi_mincore-api-ms-win-security-credentials-l1-1-0.a":"a1694e7a1b3d1a3fb5b22f93f4c06f400c017fed99e137521ca02e263b70c829","lib/libwinapi_mincore-api-ms-win-security-lsalookup-l2-1-0.a":"a68cd2ecff6a805f1f85200d5c2cd90e5a89745f8a78e57bfadb7442723cdbf4","lib/libwinapi_mincore-api-ms-win-security-lsalookup-l2-1-1.a":"add16314ad45f91498b7a7c2da6a34c6475455c0a866f7631b8ca5326153722c","lib/libwinapi_mincore-api-ms-win-security-sddl-l1-1-0.a":"c9eb0c4a5b7350b06e37638dcb4335cf7fe77261a89ea1a90201d066f85b1d1b","lib/libwinapi_mincore-api-ms-win-service-core-l1-1-0.a":"81a070d545cf9f7f9f8923c5de7368276fc061eecba8535c5437632d96f613d6","lib/libwinapi_mincore-api-ms-win-service-core-l1-1-1.a":"3bf1941875d31d4d2c7095647d366883efb613c23a983695f38de69905e22a0f","lib/libwinapi_mincore-api-ms-win-service-core-l1-1-2.a":"13ec744c7560f2a192b50b5bf23ed4faa59325f1048377f7a9844a47e2087dac","lib/libwinapi_mincore-api-ms-win-service-management-l1-1-0.a":"b8b7db62594b714406368918089a48868ca3b1cbfbf5e8440911a13b5bf28594","lib/libwinapi_mincore-api-ms-win-service-management-l2-1-0.a":"2ee6f8b431124f281650c94b544fd734c7719071b491d7b0fafaf71a9e1fdbe2","lib/libwinapi_mincore-api-ms-win-service-winsvc-l1-1-0.a":"16a711568a8a1ee771c8eac1508a27605f240dfce72e9162f620474c3b186ffb","lib/libwinapi_mincore-authz.a":"e99db6195035386f6848a397f465d23201e5f6c132901ab2e29b179467fdea7b","lib/libwinapi_mincore-bcrypt.a":"5f4d9f4146e24ac50ac50e846bf62088f99d23b5e55cb03e6a32661057822fa4","lib/libwinapi_mincore-cabinet.a":"c1b3263b233e95742a438e628644a7ab4014ff4e3b01547850d0832f4eea2674","lib/libwinapi_mincore-crypt32.a":"e84423856f2d7b5dda7dafd0843c4d1fdfa656f1b61677bd68edfcfa3fa84658","lib/libwinapi_mincore-cryptbase.a":"3566bd4fa7a9b4f441a6ba4af984ac0567e024d01efce922b503176f0a56ea97","lib/libwinapi_mincore-cryptnet.a":"92a5d8dfb436ab9792312d397e98d91f9b95771af48cf925fd3d867ca73d2823","lib/libwinapi_mincore-dfscli.a":"da814011c527a253e71a397b76595ac7a387c86c1bdfeed8e01209a260dd4fdd","lib/libwinapi_mincore-dnsapi.a":"14a2b0ceee12116cda15871aa7e0292c35452d7e6406a51e1708b4c8484ca5df","lib/libwinapi_mincore-dsparse.a":"11cc209fd1b87a1b2a68c7124e1d89da2a4221b591cbf6ce67e338b1183baab4","lib/libwinapi_mincore-dsrole.a":"61fcffb3afee81be3f3615d9ec09e875d5a5529c2f63c182a59b6c6fcc529158","lib/libwinapi_mincore-iphlpapi.a":"835004f7cb51eca876d2f85bbe6ad43260da907e10b03e019c188ee951de1fbb","lib/libwinapi_mincore-logoncli.a":"e5dc889da62fc4baad78290998d9bd22b843e7cf119fd7845c7b9e9fe1a77e65","lib/libwinapi_mincore-mpr.a":"dd07ae245db6f88c8d29f1397b0df0e9c44b2422be551e16dcb01c5a895636bb","lib/libwinapi_mincore-mswsock.a":"f48d2a370a9d62d46cf272a08629c3713eff8b9ecd2c16052e1cb5961f10a0cf","lib/libwinapi_mincore-ncrypt.a":"9c37a0e796b74654ee8ff25ae005ffa314a845255c74ff9e2c491fcfb8ef321d","lib/libwinapi_mincore-netutils.a":"68ad06d0fb08607b070f053286fecfff083ebbb456d631b209c62db4ad117134","lib/libwinapi_mincore-oleaut32.a":"fcec9caba52ef935cc1d0aa3f5e05aa56851446f2e6a864a7c152d4ec1afd978","lib/libwinapi_mincore-rpcrt4.a":"c1e4586166db2f2a082ef1c0018c6739c58bd343962048aaf4dce07ccc47ddd8","lib/libwinapi_mincore-samcli.a":"f5063f8c04cccf85db4782020c4cb4642e66850a259f7d63ac1c3d08909a827c","lib/libwinapi_mincore-schedcli.a":"2e84730fb110f1a0c83756145ac627b80450f847a64eca8652e5ca3044c5d5b0","lib/libwinapi_mincore-srvcli.a":"a79012855d575dcc1330d2619778b26e1956dc3e7bc0f4b3684e178a7be3088a","lib/libwinapi_mincore-sspicli.a":"5541c31892701510763c94b9eec15348a3886c7f6704f7c761ed759c2782a539","lib/libwinapi_mincore-userenv.a":"f3ca99855c0220cba5a1ff522d059f88ce269ea9d3726badafd73b40e3d44883","lib/libwinapi_mincore-websocket.a":"f5ee7e537a4f7d7c1bdafb5287aa437d5411010b41fb8a8eb6205b4aacca6458","lib/libwinapi_mincore-winhttp.a":"04a5911f093e885a5f14e0907d5ab3edbcaf43b4b060d45216ea435e52b23fed","lib/libwinapi_mincore-wkscli.a":"cbaf2dbc36dc6d77889dae85012523d40aa755f1489c4687eb7054ca6b6f8048","lib/libwinapi_mincore-wldap32.a":"fa72998300a3430697b64b3cbe4bade361ac705d5dc429572e1259e66c703eba","lib/libwinapi_mincore-ws2_32.a":"9e3911f8a7bff472e039fd91fe9acdc181aed3bde9a902ecb739e56ad48c699e","lib/libwinapi_mincore.a":"6825a9caee041465fd378b5107dafca1ac6cec81e60f0de331912985da0edbb3","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-advapi32-l1-1-0.a":"753630af44454ec3c92ebfb3c29d85a9590118608a111bac7657f0f06e36ed80","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-advapi32-l2-1-0.a":"f40742474b39a3aa908e3c15dab78de4f73fde4b4ed9ff9cc8f38a4a3e6bb776","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-normaliz-l1-1-0.a":"521d37a4d77b558db157129ec34f1a9cec364f82021f7f2c9a4c42ff6d9ea8b5","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-ole32-l1-1-0.a":"21afab5e6b411cf9f1b8839c352314229aa89af03a16cfe9d1428ba0a8941ade","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-shell32-l1-1-0.a":"c66675b5475c93e63dcbd4e3001a0e7ceb41eeeba74e3619935ba27c7511d59e","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-shlwapi-l1-1-0.a":"ebc30c785e96e1b2b802ca1e997fd1ec6966adfc150ef5b97c761f8aa49b7359","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-shlwapi-l2-1-0.a":"a5c180c4f39d4922449fc20bc72f1cf8bd30d768a56c00b12b19050ab52ce99a","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-user32-l1-1-0.a":"f3aa55bc305ed82258dc9d21fee4395f85a3aed1de0db1931817c3e75fc70f81","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-version-l1-1-0.a":"2f0fceb87948246ec375e2496fea888e2c99bddc0b953a06c953666ed3082688","lib/libwinapi_mincore_downlevel.a":"3d70f323b3fca7aef18d833b72ca3fbe60d376af109a1b4a919e6bcec22d860c","lib/libwinapi_mmdevapi.a":"2d79710fe620fd4f3ed41becab17a6c4923fcd1c0929700fed0d18d6d3514e02","lib/libwinapi_mpr.a":"680c8e016f20cb6e22a2849368e55643551f0206235b668d3893fa42d2144090","lib/libwinapi_mprapi.a":"3bae5791f784d3bf157d27c021c8e594964d4651ccef317822d4b2a17b9a04ee","lib/libwinapi_mprsnap.a":"5aac04f6244a965e8c3fffdf28de78a09fd9313c69b9e127528f174eacf057ba","lib/libwinapi_mqrt.a":"ca0c39e4301366ebede9384432054b7bc69cbbb0714af59c94ccab4ded35ca00","lib/libwinapi_mrmsupport.a":"4c877ee85c1c91721983488eb58ed617f672aa007e5ca631075889c845d95e8f","lib/libwinapi_msacm32.a":"93d5738ee1d7ea8239408436b074c43d5fbfd8f459543cb730d3c79d21ef59a2","lib/libwinapi_msajapi.a":"645e84f8175f03112007c3af7b06cfe11962d8b8dda6267ee9de8239a9543019","lib/libwinapi_mscms.a":"47fe5dd1a3a5d7c3c262701341a8228c3bae0a5e7aa132a58d4e583032997054","lib/libwinapi_msctfmonitor.a":"9fd55476a28cd5fb3329d79a0c4876222187944093fbdeece837f0123dead523","lib/libwinapi_msdelta.a":"037e08c128576a4801ebe10d5399b5932698e4c50e0885e9b6555b3f97d04afe","lib/libwinapi_msdmo.a":"bfcdeaeb2ebcfacf5d77c7985b4e647601bb018c737f8778c37562dae755bd96","lib/libwinapi_msdrm.a":"66f327106d29dadebfe6263fa5f734a3c3036d989e68cf739521a5ff66bb06b1","lib/libwinapi_msi.a":"98e5ea9ec823ed5e1b44f8732d5a897ab6e5d7de1d87411d2d4a8ae6ee4db5fc","lib/libwinapi_msimg32.a":"2f2d8c1fe1cd2fcc9e0689210e8a992423e32ea50ca030f92dab5f38e28377df","lib/libwinapi_mspatcha.a":"bf373ec37fe1f869b803cae997cb9d1304e9d2014b2f36677937f4adb5728bec","lib/libwinapi_mspatchc.a":"2fef8c9ec3f4185c20d4b8c20bdf97e97c5a890b874f2e2afd927e374079e3eb","lib/libwinapi_msports.a":"bf82dbc15ac2c02eb19e32b9dd6fa7ff840e85bff591ef63c69b3f4cf1fc1aa3","lib/libwinapi_msrating.a":"45df5b0e0f916e71d591195d6e896f21075d3ee2d455bb2b6400c0c050c44453","lib/libwinapi_mstask.a":"e5722cf20ff19d01ecbad869a1f609934e17b9ae350d424c5e3c5e73d5bd779e","lib/libwinapi_msv1_0.a":"62f3792e17ee38d086f544f0e750c5a1f537b128281c1ac4f5e687e636977e59","lib/libwinapi_msvfw32.a":"742e7b83ca4abbdfe708e1f5a5028bb033b3bf7c8004f8b7b9ee5dd0827ffa3e","lib/libwinapi_mswsock.a":"fdf2482eb3b9876986d8fb8b76d98da74f2abe2e65b1ddbdb9e76a3a2ba9faf6","lib/libwinapi_mtx.a":"97ce797761704ecdb75986c0cdfec06cd942af626da3d98ca614fe90cf1b1783","lib/libwinapi_mtxdm.a":"80f87abded3d644a60c25ccb693189f785e0eba3d831d97481ac7b91970da6b3","lib/libwinapi_ncrypt.a":"64b382c756d3047a29c5cb9af53003ea639c2f216298b2a7fa867eda4147c932","lib/libwinapi_nddeapi.a":"3c316dd45fe6bb0d26a6bc18d0859654bc8ecf7a2115d0623fca8dfb3f892bf3","lib/libwinapi_ndfapi.a":"618fe36ac1a948165c197df523696e4fdfb7cbb40da53c68eb349daafb947124","lib/libwinapi_netapi32.a":"bad05df64806485c12fe425b62cd56dca9757195db23383a28f2e80a3033f0eb","lib/libwinapi_netsh.a":"93011663fee375bd21bf79955495acea760ce0982da464983ce741afc94563ba","lib/libwinapi_newdev.a":"4b4c90a7ac3abb42db40b26a4c02b4eb58ae62ff3cd58af1cc15d4349a95bdbb","lib/libwinapi_ninput.a":"ab64698e33cb680fbb68d70de33615932dc10c16d436c8097dda7ad0cd662da7","lib/libwinapi_normaliz.a":"d6feb9a233918d62f9454a71a1b7984182bd243491be1729d4f75c9e4148ad7d","lib/libwinapi_ntdll.a":"1592142cd1e0bb1d7a67e4dd5aa6d08317db172674abe24e00b4562d272fdb35","lib/libwinapi_ntdsa.a":"eac08fe7f827b4a46b19957629228c4d070e8f38592c07cd6a17d6a60ec0cf3e","lib/libwinapi_ntdsapi.a":"f304dddd7a4b9cd1c3d43f1fae4931e7512bf31f752f7e44539721b75b9ccc14","lib/libwinapi_ntdsatq.a":"9771992eaae766af41ec3f7ce6dc573542126db45bb9221f6f788ec08efaced6","lib/libwinapi_ntdsetup.a":"1f81ab7713b55bdf9ef1ad78a97cd73b2d66b4dd633282f7dfe0329d6f35ff54","lib/libwinapi_ntfrsapi.a":"2dc8b0078f2c7351acebe9b9c86c55f125a9472855c4209b07cddf71e60ba077","lib/libwinapi_ntlanman.a":"ef144c29c940a04bb2dab839b5f00cc319273e6e2f611aee2acca8e8a16c0af1","lib/libwinapi_ntmarta.a":"5e5174c266e8189fb3799666aee9a1bc1c455f36dc38b26c326fcae61c3140c2","lib/libwinapi_ntquery.a":"bfab792990bde5de31c62b4f13cbc641cac611cc9ae5245c3adb166207ec52db","lib/libwinapi_ntvdm.a":"bd6d965ab94264566b978b6e1b814ad077a4ae79cb4c0c48c4b2f4e7cfcb7d4c","lib/libwinapi_odbc32.a":"70ade3b90849ecfb16285ce0dd664d0994fe17df23438d17da4214b34e8c2013","lib/libwinapi_odbcbcp.a":"a4286035e5d4bbef4dd81f7625bf7f8dc08e18893204091d9b4ca57ee45debb2","lib/libwinapi_oemlicense.a":"0b7a4c869927a60159e6fb52e0a770edcc762d78a8527d7c13d97b315caab8e3","lib/libwinapi_ole32.a":"7b6f2c7046748c82132ef02c85e66f32d98c05f50aeae8343dd9b85cc387dcbe","lib/libwinapi_oleacc.a":"d2fa43b88db071e48699116521e257246abcfc821f5996707d60214b9df9f75a","lib/libwinapi_oleaut32.a":"5f382f9501450e65108816190e1edf8661de0b83e76476732710f6bbd080c391","lib/libwinapi_olecli32.a":"9e69e6423b631c566735c8b696d3b65d0aa81411b8fbd08c079c9b539f591cc4","lib/libwinapi_oledlg.a":"eb5b1dc4a96444011e21ab25e1ecc8346e46255ab012b8f50d340fbe1f4947d6","lib/libwinapi_olepro32.a":"c2bb05450b0d75ddb2cfd724fc2353ad052e1e6398af67ff47090d6d63ae1cb8","lib/libwinapi_olesvr32.a":"8118417ac2b6266fb92873af089a55a9a8b52b64ac61ce5a156d4bb6064a3bb5","lib/libwinapi_ondemandconnroutehelper.a":"d5f4267a2f92a18b0a9c9a62c399466dd2b5e5c6c8383d41961992f23fd89888","lib/libwinapi_onecore-api-ms-win-core-atoms-l1-1-0.a":"7ce33ab13f8df12229ca991e33fed617cd4f9aaa9d190af14f975ae07c44062b","lib/libwinapi_onecore-api-ms-win-core-calendar-l1-1-0.a":"9ae8b55b700c97e5c327e6b39cbcfaa66648876dbefe21b7eb5e2b159a9f18b9","lib/libwinapi_onecore-api-ms-win-core-com-l1-1-0.a":"f3e4312912dc7cbb61414318a4c2966a7b0c80551be23679e0f58548864d7955","lib/libwinapi_onecore-api-ms-win-core-com-l1-1-1.a":"e314b1f3fab2a56d2d6112400cd932bb7cd3e95a09be144bc665e0be5480dc43","lib/libwinapi_onecore-api-ms-win-core-com-l1-1-2.a":"6aa14e1c117d293d295ee1568a3e6a81d21f15a0f155646c10c5cfa2224ae645","lib/libwinapi_onecore-api-ms-win-core-com-midlproxystub-l1-1-0.a":"a949240ab052c52430aa5349a284bbab08e790a8aad25f37cf9467537616583d","lib/libwinapi_onecore-api-ms-win-core-comm-l1-1-0.a":"98bd85008746e5c33aa8de5a40171fa578e33950c6c4645a965833f4c1cdd062","lib/libwinapi_onecore-api-ms-win-core-comm-l1-1-1.a":"b61e46a85881068c3bb64ebe00623482dc1bc96476130f9ae2b4248fdf8d1fd6","lib/libwinapi_onecore-api-ms-win-core-console-ansi-l2-1-0.a":"fff26f99c7f76b1e074671efc4ceba790e555fec74a8f34c725736060c200082","lib/libwinapi_onecore-api-ms-win-core-console-l1-1-0.a":"b82d11e22cb47b53cae43f7f0ddeddebcce8e7436e6353dd955ffa1b36feafe8","lib/libwinapi_onecore-api-ms-win-core-console-l2-1-0.a":"9c2c3c24387d5a46885802bb080c0baa05bec2ab1b41e0f3ed003136023ab534","lib/libwinapi_onecore-api-ms-win-core-console-l3-1-0.a":"97dedb121055645fd946238998374d81a8dfab4d8495a2e3e6581aa4827e88b0","lib/libwinapi_onecore-api-ms-win-core-datetime-l1-1-0.a":"370c50c9d69d0dea47756ee9129c0358a5a0730cfd9cf16cb3bf38a293d270e2","lib/libwinapi_onecore-api-ms-win-core-datetime-l1-1-1.a":"9164e60e37d8bc70987abce632fb608c4e804581070a244abb1e8e2c477bca91","lib/libwinapi_onecore-api-ms-win-core-datetime-l1-1-2.a":"2032dde8a93b2fff4427eb79d561dd67ed550cafb00f066f823e4f686ebc87da","lib/libwinapi_onecore-api-ms-win-core-debug-l1-1-0.a":"c825d6d04a0e302786c8ed95b9a2c2da747d3eb13f90afc96b671a356d982f09","lib/libwinapi_onecore-api-ms-win-core-debug-l1-1-1.a":"76c7ef02046d20f400874ccbb68eb9e1653fdbf1b095cb42f95d665eabce099c","lib/libwinapi_onecore-api-ms-win-core-debug-l1-1-2.a":"ea26792152225541f2649c57be0431ed4c444b56121a9d30e56c9913f235ba71","lib/libwinapi_onecore-api-ms-win-core-delayload-l1-1-0.a":"3072b4a9bad48fdd1f3ada0787b455580665f677493630e152aa6fd9d48a1af9","lib/libwinapi_onecore-api-ms-win-core-delayload-l1-1-1.a":"2abf03e85a577726e4ab1b5daa83bb6b7d0e909857d22dd14199180b809aa463","lib/libwinapi_onecore-api-ms-win-core-enclave-l1-1-0.a":"0439a0a7bc74a01589f3c55f2d149976c51c80fa021e72379dcfd7174fad3cbd","lib/libwinapi_onecore-api-ms-win-core-enclave-l1-1-1.a":"584da1dfd8c18c4bb67768da13ccaf85831df644f64a6fb30e5c9a3463ddb728","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-0.a":"b5de61d47e252cdc6c268777c9fdd3300a1ccdb62d3049e299d986d2070773e4","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-1.a":"c17226cb3dc4da0b2f16ed8cc538f2f666ba5341a0a506e99ad982147a6fe278","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-2.a":"757fcd24354081b7d79ff164e865c1427f49de3b20948ea4170c453c460c018e","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-3.a":"a2db8dca687000a7e1cee4382428fb8e325a9d76edd9bdef1e0d231dce42b48a","lib/libwinapi_onecore-api-ms-win-core-featurestaging-l1-1-0.a":"5d6e77c87c0429e8a22b69045b1c11be1818a1b656734bc5f84d3da355b0effe","lib/libwinapi_onecore-api-ms-win-core-featurestaging-l1-1-1.a":"6b9373447d69641afa916ce0f5ddec0f29c56e20d78f8873a65d61a70b1de500","lib/libwinapi_onecore-api-ms-win-core-fibers-l1-1-0.a":"66ca30c41fde5c4a99abfe5cc2146636e5b719d557af9abd77a90f8dc9b00032","lib/libwinapi_onecore-api-ms-win-core-fibers-l1-1-1.a":"eb51ac48674d0f9d338cd12156a216fcc3904c9efd058c3d2a579609f3c04987","lib/libwinapi_onecore-api-ms-win-core-fibers-l2-1-0.a":"fecea4e014a4034a23084021f068a6918ccb99f4ad495fcf93f16ab7d6c1a04a","lib/libwinapi_onecore-api-ms-win-core-fibers-l2-1-1.a":"d126b04f4561358fe1040eeec70186530de9e6667d9eb39b8a6a87e2488c354b","lib/libwinapi_onecore-api-ms-win-core-file-ansi-l1-1-0.a":"1ae79be5539951386656160661d39f0b4eef82464336a91443a7cbec41f7f3f7","lib/libwinapi_onecore-api-ms-win-core-file-ansi-l2-1-0.a":"5b1251a929535a44ddf256f4c5bbe607bb1ed66d444c6630c0e936598293e21e","lib/libwinapi_onecore-api-ms-win-core-file-l1-1-0.a":"2148eba5a06d1348001981c08cc4066ba7d65f4432b8aa88f0c422b80f19b36d","lib/libwinapi_onecore-api-ms-win-core-file-l1-2-0.a":"6a68a5ec48ea223c786f5bcddca1e04358f63b536217f2b014554388e392dd72","lib/libwinapi_onecore-api-ms-win-core-file-l1-2-1.a":"771cfff31cb38327610579cdb123522ac32432794be9f601bc4f83bfc2aac4ff","lib/libwinapi_onecore-api-ms-win-core-file-l1-2-2.a":"0c3fcfa360a3163168fa0951c3f61772ea7b50cd521539ea5424e897085b7412","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-0.a":"c27e89c1639e2380837b01edba5fc3cbaf4bb3078c8e7a661e008a1a7ab0cda2","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-1.a":"ea3d8cc0c78d730a56b0d4b9ab93fc6afbf1309f2e481bd8b590d3a128011faf","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-2.a":"3de9d7a4ad6acc06f2a522ca536959f50ef35eb072f71991ab7e2bacf8a012eb","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-3.a":"d1c4172bd2996b5ef4340bdc1ad96787ced73baac1d949d6cf35d2c2a38bf31a","lib/libwinapi_onecore-api-ms-win-core-firmware-l1-1-0.a":"0aae856a71f3126972c06a184e4550586744d0e88eda0a4007f1e2e87da984b3","lib/libwinapi_onecore-api-ms-win-core-handle-l1-1-0.a":"1968042df145c916017c3a7933e0014ecbd5f93e5c9065435f5e2bfcbb907820","lib/libwinapi_onecore-api-ms-win-core-heap-l1-1-0.a":"feffc41ff97440175ea1e188eb31a504d1e8b6e581ca2c6155f3fb859ccab2f1","lib/libwinapi_onecore-api-ms-win-core-heap-l2-1-0.a":"dbadd682960ea85e36d9d785684ac1bae01ad71a175d62247caec06045eda86a","lib/libwinapi_onecore-api-ms-win-core-heap-obsolete-l1-1-0.a":"6c0414ae95319079f2deff62274cac9e41b8c677dd59c6f8db128ac395d7d89e","lib/libwinapi_onecore-api-ms-win-core-interlocked-l1-1-0.a":"34d058aa1622e922dfbb8ebcee6f64070191fd1116c85d8ab409298e9e216a1d","lib/libwinapi_onecore-api-ms-win-core-interlocked-l1-2-0.a":"bcb0745904648e1ca6c4ab1c9dc7f4222c877bfefa3f1d064a79cd7bc83cf262","lib/libwinapi_onecore-api-ms-win-core-io-l1-1-0.a":"441dfb6c4d99734a6ed891497eb938d0296f40cf42a8eda197bd50c6885e163d","lib/libwinapi_onecore-api-ms-win-core-io-l1-1-1.a":"cf941cffa0d3b8a888bbed9752c9f5b0c03d553b6d199ff6258c19f1452d59b1","lib/libwinapi_onecore-api-ms-win-core-job-l1-1-0.a":"b293df0ca91ae8c286b46e06ad2969d8041be6fe20d5052fc20c0d57dd46bbd5","lib/libwinapi_onecore-api-ms-win-core-job-l2-1-0.a":"f29e41ba33e081765dba0ff04a961d7bc0673f9cf7e49351aa3ebc2446596cb3","lib/libwinapi_onecore-api-ms-win-core-job-l2-1-1.a":"4b4460884be3397e693d3ec6eae9e98e39405eb16028c2b09f7f90886d04cf38","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-ansi-l1-1-0.a":"3ac3369f2a9603d9c71b2e560c94436b58f50d144753a13cff85e1a410fd5fba","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-0.a":"5ca6ed6ff56a1c79a55399467bd3378a2033e438a5caae478a98c4993c3ef5fd","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-1.a":"6a493082455ec79ee94c2ec8855dbc7009f9ee0001bd0aed5e58042d6fc75efd","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-2.a":"88fdddb5f66280d31962782a02c4763196d6e518475ba573fb1d3f069bff30df","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-3.a":"d4a5e8cc328af09f59246f0c9b7e3d35cf0f4343946a622f39e3f920294a37db","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-4.a":"53e09de7b3daad97ae55823d82a3b7835926499c8c05e693b6c050c39e9e69bd","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-5.a":"510c0da995c955e2bb644eaa9216f23aaac0112feee526a0546757be2409729e","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-6.a":"debe275148636bfb197070e7fe2c50cdf09da53ebfb5d4ee997e925157f3bcac","lib/libwinapi_onecore-api-ms-win-core-largeinteger-l1-1-0.a":"595390057644c4a29afee502797c5db21cd470aee631b79e4c45320607c46b4a","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l1-2-0.a":"181e309b5e204ae6f024bb0179a87202b60403eda9984be1924116cfc474f212","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l1-2-1.a":"4c8c0b639bbfb3601c206405408fc9eee0317c50b9a4966a2dd46c87702559e0","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l1-2-2.a":"361bdc6179d8dd066c66e8f5c43be9f85d5119c55cd4622c61869bd94168c80c","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l2-1-0.a":"0db1bc8a5f3b4bef33e5443c991d3ece14833e2b28e925777ab48c5b4b716b5b","lib/libwinapi_onecore-api-ms-win-core-localization-ansi-l1-1-0.a":"a954ea83bb16f191fcd6c1ffa4954437c1aa587ddc370c6d0717a05aef6b3839","lib/libwinapi_onecore-api-ms-win-core-localization-l1-2-0.a":"ff332e34ef131f3f0fb62304e6671a507ba984be58a75ab26f52267ac6231d97","lib/libwinapi_onecore-api-ms-win-core-localization-l1-2-1.a":"f51f7ca530a6edd45a0bb824064a52894a511bf9bcc1cf1e81514c1e9ede7821","lib/libwinapi_onecore-api-ms-win-core-localization-l1-2-2.a":"e210ce2302727ea65ce9e3d651a908ddcddf0a160567fa00c0083c0f9f90aafd","lib/libwinapi_onecore-api-ms-win-core-localization-l2-1-0.a":"396c2c716fe85d651568681d6bc39b75754cd62d1d252a39ae3a4cc5fa50dd0e","lib/libwinapi_onecore-api-ms-win-core-localization-obsolete-l1-2-0.a":"4d6dd4f6456cbfd5f5ab3b77a308f23dec9a13968b7e4f6cfda037708ea379d4","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-0.a":"6457c46d1f8d693178159c9392e0fe56a4b50e27fb39b3ccfa8881e015e4306c","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-1.a":"c0e5ae12c989f02ce1bf2057f8979afdc2627ad108848045ce5f473b475084c5","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-2.a":"eda30a9d8d2b844e18f8e5839ca97065ae88acb569d2e060e3260ad5476f29bc","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-3.a":"aef9dbd4d28af47fd00d96aa20d2fefa14fba4cd56b1317b03214404dfa7df3e","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-4.a":"c3c5482c182529e3e5c8b07b40e4bc368b8eff21fa0b83342a30eca4d1bca2c4","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-5.a":"4df545b80104e32455474f20acff7f9da59257a5d4f3c74bf1124d4f8b5d8de9","lib/libwinapi_onecore-api-ms-win-core-namedpipe-ansi-l1-1-0.a":"5db78ea3889742c53e0e3882f4857d15e7db0e8e9db41bdd637d633c42d5b17e","lib/libwinapi_onecore-api-ms-win-core-namedpipe-ansi-l1-1-1.a":"849fc1d4f4d82a04d496e659d2ec52521f77e20ba93744d8277ae91ba2db1a65","lib/libwinapi_onecore-api-ms-win-core-namedpipe-l1-1-0.a":"4eb71e08030eca03ea393f2688f4e43899e226165348c8b0a239184fdabbf53c","lib/libwinapi_onecore-api-ms-win-core-namedpipe-l1-2-1.a":"8ce5c4d7569414b3d17a92516d6b10e2a2e9d3496d36a835ea78f999d70fc909","lib/libwinapi_onecore-api-ms-win-core-namedpipe-l1-2-2.a":"54293fbd0e570b6f37da02a14b02586f4c3cf1a3ed89d85e5f0aea7f4cd15c2c","lib/libwinapi_onecore-api-ms-win-core-namespace-ansi-l1-1-0.a":"99cab897df8772fd9e5573bf8c2c9bba8ca0c89796bb22e3ea1a7d521924a50e","lib/libwinapi_onecore-api-ms-win-core-namespace-l1-1-0.a":"1456c0f4ab7ccb9a9c67b0bb8bc6ae2ca37900f63eafc1f35cd6faa6c3f803f5","lib/libwinapi_onecore-api-ms-win-core-normalization-l1-1-0.a":"7fc88257b8e2569f3688b52c6f796ea3e733147a951b1c3c7214e130e6f7f8aa","lib/libwinapi_onecore-api-ms-win-core-path-l1-1-0.a":"61ad59ac5e91f6c99daab8495f3d0b0b977bc4bfdfa0fe4d11057a0f909783f8","lib/libwinapi_onecore-api-ms-win-core-perfcounters-l1-1-0.a":"71b0dc0c564b008e7bca39ae7b68f073fe17294846c80080c5d2787d64292af1","lib/libwinapi_onecore-api-ms-win-core-privateprofile-l1-1-0.a":"4d19c8751472e2cc17a367fa1c2aa3ceeb6ec2980e126e020b110e0ef7e593e9","lib/libwinapi_onecore-api-ms-win-core-privateprofile-l1-1-1.a":"b5c2cb75007b2b0f0ee1f9c9222ac9b7a96d3dbf4d2cc8934541c88c9455fae1","lib/libwinapi_onecore-api-ms-win-core-processenvironment-ansi-l1-1-0.a":"4c7549d5194f12429ed5caaf9e48a34f71a25bbed1de17f346fb42eeea9622f7","lib/libwinapi_onecore-api-ms-win-core-processenvironment-l1-1-0.a":"171d55c0a02aac157754b2f5dae64f31759d7f72fe34b3da3ef020bb6b772daa","lib/libwinapi_onecore-api-ms-win-core-processenvironment-l1-2-0.a":"a6e0932b840ffbcf397b498a73f03b08b3c364b0bee2ccb950a3d1f6256e4fd1","lib/libwinapi_onecore-api-ms-win-core-processsnapshot-l1-1-0.a":"d18f7d9b576d7f132ee979199aaf01b9888a6780be17a4884c068457cb461070","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-0.a":"6bd979768806ef4ad76f4587e11e1fb03af221e58db6bfc4e21f3458cbdf902f","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-1.a":"9b6e58a775abe1934b2eee8bfb3f119f868133416f40ca64ee3b21626d26c651","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-2.a":"401b925ff83dc5a3a351b2bdfd2806a76901a1c8a6bb55ddcfab8428dcf20106","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-3.a":"2b4b44dbdf98db7949e21bd950328a2513f1be268413fc732820bb1d81394c56","lib/libwinapi_onecore-api-ms-win-core-processtopology-l1-1-0.a":"f583a535849b8f45978bbe38f3ae80cd6c53dccec5e3e2425ebddd67ba15dbff","lib/libwinapi_onecore-api-ms-win-core-processtopology-obsolete-l1-1-0.a":"43e5b5bbb7dbecace68a4f4a0d4b4f39df4aff180ec328dcfc0a5b37b5f5619e","lib/libwinapi_onecore-api-ms-win-core-processtopology-obsolete-l1-1-1.a":"f87bf26cff6015b4b95107506627aa85da9ae63183494bdf37724cff2dc489d3","lib/libwinapi_onecore-api-ms-win-core-profile-l1-1-0.a":"7a2356a7e5b902f95e9d275ee11ff71be319dda03853d62d485fa38e2e4fcf54","lib/libwinapi_onecore-api-ms-win-core-psapi-ansi-l1-1-0.a":"287444f91238567da77e5b65005df039a26ea955e753a1b396abf0b52843954d","lib/libwinapi_onecore-api-ms-win-core-psapi-l1-1-0.a":"7478bf6e874171709669abbb4a8d6b9176995f749a66bd0916ef791ec0518421","lib/libwinapi_onecore-api-ms-win-core-quirks-l1-1-0.a":"d9d46d5045f1729d5cca3f4e5134038307783e3c5b6e84c840c13e04861a5c93","lib/libwinapi_onecore-api-ms-win-core-quirks-l1-1-1.a":"1e46ac200bdf5dd373e987cbec26b4eddc382dda60bde84bfe11785aeddaea37","lib/libwinapi_onecore-api-ms-win-core-realtime-l1-1-0.a":"ca985d1b45f7cd6daa4502a4919af7312b6caf9b721c77aaaffdc30245dff83f","lib/libwinapi_onecore-api-ms-win-core-realtime-l1-1-1.a":"31a042b0553caa596949da48b89446b8049fd41a55b5c51c81c338f64c9d82a2","lib/libwinapi_onecore-api-ms-win-core-realtime-l1-1-2.a":"42e4da8ce6a813cde55035c7e44b18b3d3f12250a12489a54a89dec7cffcd163","lib/libwinapi_onecore-api-ms-win-core-registry-l1-1-0.a":"0e4b0dbd290409ae848f63e56286490f0b2b2ac4ed76fb65c81745c52046e460","lib/libwinapi_onecore-api-ms-win-core-registry-l1-1-1.a":"799fe6984e2413f28889bf497c659fc993f04939570652614322ef67fd606cab","lib/libwinapi_onecore-api-ms-win-core-registry-l1-1-2.a":"0c13cd0f1731b933452e94e5a3010a38084946d5068ea32e3e54a9e67448e585","lib/libwinapi_onecore-api-ms-win-core-registry-l2-1-0.a":"a62258830da75dad67ba90a38e697666eea061730b680c6f1f35ea1929e8bb60","lib/libwinapi_onecore-api-ms-win-core-rtlsupport-l1-1-0.a":"38cc3759687a82153c13704b82148e297439bd72427f6bfb0c0fb79a04ded5ad","lib/libwinapi_onecore-api-ms-win-core-rtlsupport-l1-2-0.a":"ce35d7cdebedb07195bca23616bab8d7cb209a712ef1d306b01806229e514097","lib/libwinapi_onecore-api-ms-win-core-shutdown-ansi-l1-1-0.a":"bf1b67c53946eafbe27b895a37194fe33abb697506fb2ca8deaa38f8b354633b","lib/libwinapi_onecore-api-ms-win-core-shutdown-l1-1-0.a":"008c0f90de663907480e3433d7e500907d0ceeaa8d3e08eadf029db1c632642b","lib/libwinapi_onecore-api-ms-win-core-shutdown-l1-1-1.a":"fb8f227a8978db53b29a1506dbd460f2fac8a3a09e808234772c2196ea608ab7","lib/libwinapi_onecore-api-ms-win-core-sidebyside-ansi-l1-1-0.a":"ebe918eb1ee104f12c95753cfe2862caaf1bae2a8ccb4da7f35273a5dec9f31c","lib/libwinapi_onecore-api-ms-win-core-sidebyside-l1-1-0.a":"72f07cfc1e27a4166d10c1737b246d4dc722018f785c64581689860af90cb089","lib/libwinapi_onecore-api-ms-win-core-string-l1-1-0.a":"f13eae10c3f7a9a0bb1023e9d3426cba9b606782bd151aded523086eeba7652b","lib/libwinapi_onecore-api-ms-win-core-string-l2-1-0.a":"e059034de6817aa5ddc8c2dcbf0a0efd7453f48111f84d787c77b70e0185e834","lib/libwinapi_onecore-api-ms-win-core-string-l2-1-1.a":"ee3935afebd0bad19b9013de25cdec58e1d923a5ad5763cb0715233564f0a6d0","lib/libwinapi_onecore-api-ms-win-core-string-obsolete-l1-1-0.a":"166374b396d5767b0d405c9d4956a35eba6c817effb4f5fed5f905b41a7217da","lib/libwinapi_onecore-api-ms-win-core-string-obsolete-l1-1-1.a":"c3d5f969f191e92c9cffb4e454b23d75dafa859dc88c01749e169ff50e250baa","lib/libwinapi_onecore-api-ms-win-core-stringansi-l1-1-0.a":"683862e54edec7a9ef7760889cc464ddcfc85f2d032ac3539699696722ae8b31","lib/libwinapi_onecore-api-ms-win-core-synch-ansi-l1-1-0.a":"0c9e4393920eb49b1d9f93374313285b4687431eac6b36c298de9b2cd63d161d","lib/libwinapi_onecore-api-ms-win-core-synch-l1-1-0.a":"68333d231f6b90f6abcd887cfabf61264c4676083c0bcfabff09d2552565495a","lib/libwinapi_onecore-api-ms-win-core-synch-l1-2-0.a":"d45becb8167e3fd123eb7352ab70adca4c6fdea53ee8d7f632f623e39dc4975a","lib/libwinapi_onecore-api-ms-win-core-synch-l1-2-1.a":"2cdd52a7baf3a5649174cc5a1e27e209f856c7e671c738ce643a5a31a9abf973","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-1-0.a":"f7cf60bb402b7ab962a814b4706c925d5f8f36c2e9aca12de5e75797583f4a3e","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-0.a":"fbd3a3877515f1be804ed8bee1e8f61a7dc722de70bc9da1414f4308d45dce5d","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-1.a":"2d6ffeb92f9161d9e27242422705f8db162caba86f387b75fa476c71963518ab","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-2.a":"788419c2f5c2dbd75676d27fbb34d5a898ce0c14c196dd79abcd355e9f3a7c5a","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-3.a":"a3219664f76e064b676e8657ebc24bb26f0ed84da68381e38d3b547fcd5c3be3","lib/libwinapi_onecore-api-ms-win-core-systemtopology-l1-1-0.a":"fc793505ed82f5e9eb13382a895c95bbf0e189c8944af6f8110eb9205b7178c8","lib/libwinapi_onecore-api-ms-win-core-systemtopology-l1-1-1.a":"086b22b1bf1e6da2497362368a0e38c5092a0753d2f442d6dfd49efe058315b3","lib/libwinapi_onecore-api-ms-win-core-threadpool-l1-2-0.a":"263492b035f0d42f54997bd840d07415dcc84bf462901a20e06d337be29c3202","lib/libwinapi_onecore-api-ms-win-core-threadpool-legacy-l1-1-0.a":"0feabb26b0cff391271fd23d6c3cede97dfdd16af797ba3dd9b7c1b1285a8366","lib/libwinapi_onecore-api-ms-win-core-timezone-l1-1-0.a":"af55dace54c25f147137e747f444f348c7ac78b0b602f41b136e24e22d9fb47a","lib/libwinapi_onecore-api-ms-win-core-toolhelp-l1-1-0.a":"257c0445150a7da2c6c690f1d5d9a00eeb47b96b68a4b0ab9baa363063632c12","lib/libwinapi_onecore-api-ms-win-core-toolhelp-l1-1-1.a":"f634288c210ec13680ce347935e75a272f66787c3627d1c6fe3846d991c631ac","lib/libwinapi_onecore-api-ms-win-core-url-l1-1-0.a":"cd389802670d9cc261bcb07c7272c905da572f4365e87f8e691db8cd4d477d04","lib/libwinapi_onecore-api-ms-win-core-util-l1-1-0.a":"f76e77406c82761f9667a810e6338d815381990de372e41304663540ad56866d","lib/libwinapi_onecore-api-ms-win-core-util-l1-1-1.a":"a82268f0b237601994c56ce203191bdbbff0fb479539c569e0f2741c196b0cfc","lib/libwinapi_onecore-api-ms-win-core-version-l1-1-0.a":"8f3ac9011b2a26b62d97e2ebc8f39024c31f007e2871e61c029ca65a05471bf7","lib/libwinapi_onecore-api-ms-win-core-version-l1-1-1.a":"f70ab9ef523347c2b22803443fa70ccd73d45b7308c3e88832a19d7690cead78","lib/libwinapi_onecore-api-ms-win-core-versionansi-l1-1-0.a":"e5779c9294450ab4f479406bdbe01c5ec33aa3fe8ae9b9f61876b7997829a3f0","lib/libwinapi_onecore-api-ms-win-core-versionansi-l1-1-1.a":"70aa42246b091ef8d716dc90414a588b9aa25f8c77470d8bea57e5de97e9d79b","lib/libwinapi_onecore-api-ms-win-core-windowsceip-l1-1-0.a":"2d6fbe48c4083874933887f0d22efcc2e30a8395da48d959593ce0d7d1e6642f","lib/libwinapi_onecore-api-ms-win-core-windowserrorreporting-l1-1-0.a":"9e3c56f2154799a69add217cd9c77a86e6a1bde64bbf33460d4e70e3687d8b9f","lib/libwinapi_onecore-api-ms-win-core-windowserrorreporting-l1-1-1.a":"525df54260b84f1b9269c87f1144f1e5a0cd89fafd65360a62c601d6ba6ddbc2","lib/libwinapi_onecore-api-ms-win-core-windowserrorreporting-l1-1-2.a":"55e4cee223037780a42484456c77eb1e9770edc17045827e81b8e919cbb85737","lib/libwinapi_onecore-api-ms-win-core-winrt-error-l1-1-0.a":"5da39d2b1e8010cdf9b43227ab568c1756d0147b3dab8cb80167f5e78ededee6","lib/libwinapi_onecore-api-ms-win-core-winrt-error-l1-1-1.a":"faf697a2ae01bc6b761292fcadce0560e7c53022db2bd0ae6a0f3c875fbbe435","lib/libwinapi_onecore-api-ms-win-core-winrt-l1-1-0.a":"44bc68cde89ed432570a3a333d3ca70f6d10598075352fb81d8417caec5b51de","lib/libwinapi_onecore-api-ms-win-core-winrt-registration-l1-1-0.a":"d1f598a6e5f679f1c5cbf39d7aa943cedf5a6c55292e00ae18661de492f32709","lib/libwinapi_onecore-api-ms-win-core-winrt-robuffer-l1-1-0.a":"6966b4c35904d9615bbee8696aba3f00162f9384ce72fb7295a4a7f5b3a7c036","lib/libwinapi_onecore-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"c2992ea72fab9b721807c5c31dc0e94569540290af864d5c5bbe7adf9a154e5e","lib/libwinapi_onecore-api-ms-win-core-winrt-string-l1-1-0.a":"a922f544b8205ff46043f3143b267efbbb838c8a9f13ea088c6999ff78f67eb3","lib/libwinapi_onecore-api-ms-win-core-winrt-string-l1-1-1.a":"33123c82b4e595ad6a687831cf3ba94089be31bbfd23e63aaeef3fc869297399","lib/libwinapi_onecore-api-ms-win-core-wow64-l1-1-0.a":"91fcc265a2126384e079dfab0816ef424043138880e89aa779441444271d6ff8","lib/libwinapi_onecore-api-ms-win-core-wow64-l1-1-1.a":"46e4dcc37b939b91dfcfe917ba6f9d9ee6e607a55ff9b6bedcccf75e3c1905a6","lib/libwinapi_onecore-api-ms-win-core-wow64-l1-1-2.a":"2d344bb7c91132a539d488ce16a683e8146c6f4ef61c5e85c3d9501b42b6d930","lib/libwinapi_onecore-api-ms-win-core-xstate-l2-1-0.a":"6e090e7f7a713f5678abd290b2f43db5d97a4fda54dce7b1219667424292de71","lib/libwinapi_onecore-api-ms-win-devices-config-l1-1-1.a":"58e6da81b7f5632de81c1e1df8cba71ff4af193b930686f06613593e44f534a6","lib/libwinapi_onecore-api-ms-win-devices-config-l1-1-2.a":"d631fce3bf17a13ddd797a70b9cf63a144ba179511f451ab5c0bb8339970404b","lib/libwinapi_onecore-api-ms-win-devices-swdevice-l1-1-0.a":"a3a5179693fd5c8125c1709c0f7da0840e357352fd2675c285a80b4d340c6072","lib/libwinapi_onecore-api-ms-win-devices-swdevice-l1-1-1.a":"b3f42576a838eee69fad89e4d98bc59e6094f7e4fcb211960176f57a355e22b5","lib/libwinapi_onecore-api-ms-win-eventing-classicprovider-l1-1-0.a":"ad9e71140c583e5a06e73fd60079e4be8a4ce5a176de88f4c92c2a73a8044d5b","lib/libwinapi_onecore-api-ms-win-eventing-consumer-l1-1-0.a":"35b30ec4b0654649148fdc900550d903ba7ca6bb2557e12c2be816c2b8c402f5","lib/libwinapi_onecore-api-ms-win-eventing-consumer-l1-1-1.a":"1691aea951f9e97a5630606af45ecef1d35e0405ea1732d15bd4c169b41ee819","lib/libwinapi_onecore-api-ms-win-eventing-controller-l1-1-0.a":"edff320a89daf18d86701107d734c1b0b4a8ccd1ec46d50cbd16ba9b7a0c1173","lib/libwinapi_onecore-api-ms-win-eventing-legacy-l1-1-0.a":"9ced4f3c4f2336f28fa00f3f5cb5ba1dbe847f8cd60419368975a00fbc451097","lib/libwinapi_onecore-api-ms-win-eventing-obsolete-l1-1-0.a":"c2657a0b8af03da164208aeb2e1d1fcf81c109ab1346a48b00f60425d89a05a1","lib/libwinapi_onecore-api-ms-win-eventing-provider-l1-1-0.a":"47b3e6bc27ddc5c087a416678ea1793a30f348b3c41d6e07db7cdc9c22831c03","lib/libwinapi_onecore-api-ms-win-eventing-tdh-l1-1-0.a":"0f11e4cf0225f263288544cb9a7f0ab6f591ee1be60fc42cf9406de04854c5ca","lib/libwinapi_onecore-api-ms-win-gaming-deviceinformation-l1-1-0.a":"be96a1a7edf036cd8722f9e6726463687198706db532c800ecf7c81813b66903","lib/libwinapi_onecore-api-ms-win-mm-time-l1-1-0.a":"94f97eb87b5bf72bf96fd7d504bfa1fde396bb34fb52b5b14b03f8a72502b6df","lib/libwinapi_onecore-api-ms-win-oobe-notification-l1-1-0.a":"c3c2475a9324e792dcd4a813c6611d1c56c8fc15b093b55095f7be62eacf3f48","lib/libwinapi_onecore-api-ms-win-perf-legacy-l1-1-0.a":"d05aa84c6342b405a1667e69545c45da23511c7395091434cb86433123905f27","lib/libwinapi_onecore-api-ms-win-power-base-l1-1-0.a":"c099b2534f8225c5f459f006cef2079fe69eefc5c5c0814ad65b6266dfce6d5b","lib/libwinapi_onecore-api-ms-win-power-limitsmanagement-l1-1-0.a":"906dcd96ef83bc1ec4960208f28d20c11d3c4b4a9285457829ea9615d5f3ebdc","lib/libwinapi_onecore-api-ms-win-power-setting-l1-1-0.a":"8fc5951fb7aeffe7b26121a7b5e2843def7ef2022c177280ade4d1dc5edadf6b","lib/libwinapi_onecore-api-ms-win-ro-typeresolution-l1-1-0.a":"3b62535868ee933138b5f51622609f2ef6993f696854353d7a32417efd4c1357","lib/libwinapi_onecore-api-ms-win-security-appcontainer-l1-1-0.a":"843241145aa98032ad2607c3ff4882773dbac60c52087c107bc94ce553ae41f4","lib/libwinapi_onecore-api-ms-win-security-base-ansi-l1-1-0.a":"d825cd08215e04a66d6c2b0a2bf22a8fdd459c79df96d0900de1c9357f07670e","lib/libwinapi_onecore-api-ms-win-security-base-l1-1-0.a":"991613a90774d30321847f229737037e980ee4e1cf2530591bc15dd7136bd19c","lib/libwinapi_onecore-api-ms-win-security-base-l1-2-0.a":"1bde30f5f2bdee0463b0a6f218760866c7d8cbbd5caa195b592366fd5c696d39","lib/libwinapi_onecore-api-ms-win-security-base-l1-2-1.a":"007f08d1eb7eced643f122ddb82440bbe76e2ab2d7bc53c72fecf3715cbfb01c","lib/libwinapi_onecore-api-ms-win-security-base-l1-2-2.a":"2cbbc75286c357dbb97e043ad4cb4bcd5648db803634de04e213a482f72357f3","lib/libwinapi_onecore-api-ms-win-security-credentials-l1-1-0.a":"3ce050b1f472132076a4fc3f20355b6ed1e21d2729acc8b18f807077227287c5","lib/libwinapi_onecore-api-ms-win-security-cryptoapi-l1-1-0.a":"ae00a17a300e44df9e056f31676341cc3bdf008435b3ff13f2ce1509c428fdd0","lib/libwinapi_onecore-api-ms-win-security-isolatedcontainer-l1-1-0.a":"2e93b45b7e4ca0758ba473edcc4a75b068b9651187914ef4cd34623b9c04df25","lib/libwinapi_onecore-api-ms-win-security-lsalookup-ansi-l2-1-0.a":"6000fdc93f1a6a6a3be35c77764f06fe25c242e84c97459199b89ef39905a9ca","lib/libwinapi_onecore-api-ms-win-security-lsalookup-l2-1-0.a":"a8386c72dab1edd4001c38a8d81711bbe3fc376064b9eec14a56af3eb743e76b","lib/libwinapi_onecore-api-ms-win-security-lsalookup-l2-1-1.a":"ac9524bb45b8c7ced98b7ff5884f6949b7861be9a555938c28aaafd9e838bb44","lib/libwinapi_onecore-api-ms-win-security-provider-ansi-l1-1-0.a":"af68dc5e041cbeaef887e4ba3fa9aeb15155f99f90fca1860c1d5fc6cf744877","lib/libwinapi_onecore-api-ms-win-security-provider-l1-1-0.a":"4d155455dadec07a3b3e9927d5ebc15339b74d08cbb269ac4257832e2de17654","lib/libwinapi_onecore-api-ms-win-security-sddl-ansi-l1-1-0.a":"5444fff280642dd147181d1831dc1864a12175d928d10a1d1c66ea765771d61b","lib/libwinapi_onecore-api-ms-win-security-sddl-l1-1-0.a":"741a704b4e6b31b07a62bb662bd762ac23d991c7287ce5eed9e68593a533dc1c","lib/libwinapi_onecore-api-ms-win-security-systemfunctions-l1-1-0.a":"532d5bdbf0a544f46135549a09993232c88f25702d994dbb067cdc1883e75ec4","lib/libwinapi_onecore-api-ms-win-service-core-ansi-l1-1-0.a":"a7e67d849fa4be88b88f8fedd848fe139ab771520d9cab10fa3856ee121dfc21","lib/libwinapi_onecore-api-ms-win-service-core-ansi-l1-1-1.a":"cd9d6e3bce83e2c81a825337285fdae77d9d59016b8dccecc9d81e7c72e0b7c7","lib/libwinapi_onecore-api-ms-win-service-core-l1-1-0.a":"7bbffec6a893991136217e7677c88670faf88cc1ff6ea299bbfcbc3a442463b5","lib/libwinapi_onecore-api-ms-win-service-core-l1-1-1.a":"2d24e67d5e1d8cf53cf536565eb1d2a2c66b77bfc3d86dd7d41b25f9abaa5ee5","lib/libwinapi_onecore-api-ms-win-service-core-l1-1-2.a":"dc3cfa35578e93cc3c12fa34202491ff32833567d0a890390453e5ea99587c01","lib/libwinapi_onecore-api-ms-win-service-management-l1-1-0.a":"19990b2d2df2193e1a11aaaf1cbd7e14627ab764428c6a3e1425f25ce36f3145","lib/libwinapi_onecore-api-ms-win-service-management-l2-1-0.a":"dc8c68d4c9609d4e10432ea73d2ae81657cf4b3a46df476bc09bb8f935ed8c9d","lib/libwinapi_onecore-api-ms-win-service-winsvc-l1-1-0.a":"f0d2373f6692424d3552dea976a0a4b4a8ac4a51a9f1cbe98dfb8d4aada03741","lib/libwinapi_onecore-api-ms-win-shcore-path-l1-1-0.a":"6068069825c12832d9238011a47b6029c26a8e4f9327fd0822fc101628669115","lib/libwinapi_onecore-api-ms-win-shcore-registry-l1-1-0.a":"b7668ae7c15d01fe3bc580ef64af32458281c249873c048c9e874d7af428643c","lib/libwinapi_onecore-api-ms-win-shcore-registry-l1-1-1.a":"43fc980cf389793c54845afa83d4cbf1d89a8b24b3a4149e8064f8072df20d57","lib/libwinapi_onecore-api-ms-win-shcore-scaling-l1-1-0.a":"9f54ad31643cfc61c7ddea1b66cb04cd60c0ee0a3c16845534d52dbe4af753e5","lib/libwinapi_onecore-api-ms-win-shcore-scaling-l1-1-1.a":"1a02a3670ff8446f475bb6bd060f117a6b9ced76cb7ca859ba8b7f4a0768a11c","lib/libwinapi_onecore-api-ms-win-shcore-scaling-l1-1-2.a":"8e8d97698699baa2d0a4a3c6d3b7b197145b1bfd97247080bf6ba58990567ede","lib/libwinapi_onecore-api-ms-win-shcore-stream-winrt-l1-1-0.a":"f64cb18ac2baf4b1b9bc3a6fac1cca5829ebb958b2ea1864170f113e2ce085f0","lib/libwinapi_onecore-api-ms-win-shcore-sysinfo-l1-1-0.a":"c8f7c2be5391623d4384b2e6e0c375a4fe355ab359db707aa61ec3cca651ff7f","lib/libwinapi_onecore-api-ms-win-shcore-unicodeansi-l1-1-0.a":"1f300cfb0b58d4bddf27e03b81968076f229cbab10132746c8356d62fce4b36e","lib/libwinapi_onecore-api-ms-win-shell-shdirectory-l1-1-0.a":"a027bcccec10f79a351e65285830cdf50d46aaa5dd8c3af0aca6116f1ab7bad7","lib/libwinapi_onecore-authz.a":"c89f36c61fc7e48696568a3d2986c52e3071457b3a742b514900ce5f22c05e55","lib/libwinapi_onecore-bcrypt.a":"f9084f955c2614f3c478590a22a3e325e9f544138f7349d3d449d1366a0893be","lib/libwinapi_onecore-cabinet.a":"ee558f2fd9798a054ab5a1968ea301321417dd2bfca9f62527564111c54866de","lib/libwinapi_onecore-crypt32.a":"cddc073ca75649a707f804d9f1b11a2a8b3b4692309348ce6d55111577b5f4da","lib/libwinapi_onecore-cryptbase.a":"287fd63dc36f7037000e56c1da96dc6bf9836d7b484b21c6d8a0484b9bcadd4d","lib/libwinapi_onecore-cryptnet.a":"9e8ea0194d504ec9d80d9b83ee75d0596a9c183429b7913a8ac9e7fe8733aa9a","lib/libwinapi_onecore-dfscli.a":"30325d84bf52b50e784bf19b367141d85efbc278271015608335b680e3dc0580","lib/libwinapi_onecore-dnsapi.a":"e707bbf995c6648d1f89bf13f1852c2e7d8c4e355d821bc7cd0f1135d7b38a8a","lib/libwinapi_onecore-dsparse.a":"a5273bdcc29806fcc3313a4fbb6a756f1f2e5eb40a966fd8bbf3890cac674981","lib/libwinapi_onecore-dsrole.a":"28303cd4189df6a713db163e3ff2d838474d7092bfe5041a4fe92d1ff2a55da6","lib/libwinapi_onecore-fltlib.a":"44152e55ca753ba58a7e368511d38460410ce3be226ad63bd677ce2a549ebfa5","lib/libwinapi_onecore-iphlpapi.a":"4f6960e63e756adda1a5dcf96e7d6f68af9180ea6f8053dae6d442dd830a4e86","lib/libwinapi_onecore-logoncli.a":"4b52c029e23daa9a599294ebe808a9fb5a03d9eb35f3a7de3dc5611a6d1d7589","lib/libwinapi_onecore-mpr.a":"68822897ad26a22e8f260e65b9fe32bc09d8a9365ecc700b3217e911893734df","lib/libwinapi_onecore-mswsock.a":"ecb16deaa836f5b044c00764d787f6085933c618f0b28767aca5193f68795625","lib/libwinapi_onecore-ncrypt.a":"724065809a811e15848f2bde0900ea72623104ea952702864075cd4dd2af12c8","lib/libwinapi_onecore-netutils.a":"55b8269a1d66d70b7737568010a9b1ec5b8cb40cd9ddfc11ba3afa932cca74af","lib/libwinapi_onecore-ntdll.a":"9713c2aba3f363c0896ce9b41452e33b89ee086cbaf4bac5767f1cb7f3063f26","lib/libwinapi_onecore-oleaut32.a":"c1e9036ef62d38e665b262a84cbda4700347f81b7c51ef34366e41349664f234","lib/libwinapi_onecore-powrprof.a":"46d90ce9de053c665ababf56198282b837da18f6baafaa23fb31ecea0006c64c","lib/libwinapi_onecore-profapi.a":"df82267198948d81c4ca40e9ad63e5a7070fda8952136aabc51ed06645262181","lib/libwinapi_onecore-rpcrt4.a":"1e09fc72e60b15ccd9bd63a9ad1157f6fd1b493b45f74bb7438fe4e1f01808e4","lib/libwinapi_onecore-samcli.a":"4084b9afc3d3fc538bb3dc38ac4e51f237358ba468170c2cc31fd676d75ad3d4","lib/libwinapi_onecore-schedcli.a":"5153ef0da92bfb66a2fd1afe65bca65e31c7197e72731d3c6ece693f6253d571","lib/libwinapi_onecore-srvcli.a":"8697381d4fc81b6b1b7495219a8222ecff52bc3a5494dbe491bc209dd30baa65","lib/libwinapi_onecore-sspicli.a":"d85433520cdb952ef3145e6b097f9da6e5aba2c4126a1aa48b77b54325deebc3","lib/libwinapi_onecore-tokenbinding.a":"e6d97f0b962ba9447e201ee8f496c619e5e4d0bc813fbcf079c0c4180eb0c6bb","lib/libwinapi_onecore-userenv.a":"f087f66aca67f1a15ff3d151f3641be41b8986f8c4a38d2530ab2762f03263d8","lib/libwinapi_onecore-websocket.a":"87b2be52bc1c38c2e3009b47d17cbb929f6b4eeba2686de82da8754e4e869ebb","lib/libwinapi_onecore-winhttp.a":"c559378240c38cbb1d5921c1f77b07d6a94ac3683ad2b58689cd7f429b76dcf4","lib/libwinapi_onecore-wkscli.a":"550d7d3456b98551ddbd0f807873a31e4277bc9ece242011a01f7fbf44f9fcc0","lib/libwinapi_onecore-wldap32.a":"503951e442826910c99adfaffad67058c7d1f5b912a7e0ab5832a95272019ee3","lib/libwinapi_onecore-ws2_32.a":"fe9591008ba78154904c03e942f3c3e80910fa8642bc3cd786a749fccf995fff","lib/libwinapi_onecore-xmllite.a":"d2c04f0a5904f91a5d738039459c3fab2a913e06a9da77d6efd3e688d2fb948b","lib/libwinapi_onecore.a":"79f5ca419b388bf58352e9a4e988306e353a07ecd8a303ae4b75b71148dc477a","lib/libwinapi_onecore_downlevel-advapi32.a":"9a1470de3f901ff6d7346be7df21c2f6ecbb7f8c7b76725529aa7e485749da19","lib/libwinapi_onecore_downlevel-apphelp.a":"0924884d9445e27828f0e9c3e60f3a66e0270eda43122e52108b37b6234128da","lib/libwinapi_onecore_downlevel-comctl32.a":"af493e0072a3bb5ef7dc58f69b96926e0381b5f71df8f7397ae24285fa4b9f68","lib/libwinapi_onecore_downlevel-comdlg32.a":"90c4c25cf1bb25540a0c8a9c9713584e4882c25bf9a0e7e706d58383faf8e57b","lib/libwinapi_onecore_downlevel-d3d10.a":"d5d6ab17b1a35597ee630ac91fdac4f34d70be9321f099c01f193a80c05f1901","lib/libwinapi_onecore_downlevel-d3d9.a":"f5afd3767aff431bf2b96d5b716e4f0171bdd50e08e76520ded95d4b0105d8a7","lib/libwinapi_onecore_downlevel-d3dx10_47.a":"1a7c23582aef6cc6a4237a4fbe47e2bd5768bc405f33822e62d89c8b2b767ed9","lib/libwinapi_onecore_downlevel-difxapi.a":"f1042623f702d415ff8ecb33ac6dfb2467139c0f469b1cd1af349018bff2ae81","lib/libwinapi_onecore_downlevel-gdi32.a":"cfe9846de5dd823bacc40a1dcc7647a47cdc3547338b79c73c70f56b582cd60b","lib/libwinapi_onecore_downlevel-input.a":"0ee64638a356f8d225de89e88a0e5e0500c748f3cd3fc34bd74401e654eb63fd","lib/libwinapi_onecore_downlevel-kernel32.a":"f12a7e4f4d3cb78c42c2465ec74ecf2175ade86e59a7c6465765c636cca842ce","lib/libwinapi_onecore_downlevel-msi.a":"2233db7b130a7d98f178e924bdbdc495d25854bf35a9af2e46d413bb67d38da8","lib/libwinapi_onecore_downlevel-newdev.a":"3e98c28ddb2b78644d0823dfc234f28d33e6e5609268f86f5e1a918ee6ad7427","lib/libwinapi_onecore_downlevel-ole32.a":"e73a2282f0d79562ac9c676276548d7cc65099cfa59dddf6890c96640fce5afc","lib/libwinapi_onecore_downlevel-oleacc.a":"167aaea317be2a53f866cfde4ac381df3cc14349b05a5f45b8025ea6dfafc504","lib/libwinapi_onecore_downlevel-oleaut32.a":"3c09885c10a0e9f5b242716cb8c54c98d84d56ecec477376294d813e98070643","lib/libwinapi_onecore_downlevel-oledlg.a":"a5058dcf256384272424dfeaebb7dfb68a0156c51a7c4cf0a4aa5509a80c3137","lib/libwinapi_onecore_downlevel-pdh.a":"c08012da446bcc019dd4677ca81c8fe8c84a690d35910858b8d5c33bd43df784","lib/libwinapi_onecore_downlevel-psapi.a":"ce0f455594f25fb5ccd1780a42bea521c497e3979ee6e38aab5ca4c5b51e56d5","lib/libwinapi_onecore_downlevel-resutils.a":"eb85ead723be66a8bcd679153240809ce3eaca19f5e09fb50916389b2ec44bf9","lib/libwinapi_onecore_downlevel-rstrtmgr.a":"5b71806cce0ef47a12f04512af24068e0b28dbf8c73c821d33f40fc53afe8185","lib/libwinapi_onecore_downlevel-secur32.a":"b9b3c0dbf3453119cf38b030f9ac7c2c8b05c9a50064e83e647604bfc2716751","lib/libwinapi_onecore_downlevel-setupapi.a":"b4f8966901324fb3dc3542b5e3b1b9b61dcae54bfa3429e36b8dd8b9ed23b0ff","lib/libwinapi_onecore_downlevel-shell32.a":"750024575945363851dd13ef5ed07085f0d393d851b5b6182d0167da93e2d9ad","lib/libwinapi_onecore_downlevel-shlwapi.a":"bdda84057a267a2c96e92ab9902ee2c106a92ae8a2d9d6f6057c70004684e8f6","lib/libwinapi_onecore_downlevel-tdh.a":"9c0ef09e849e277b0dfc7d7cd8050e656b8f8b71226d46e332bc510f68fdf8af","lib/libwinapi_onecore_downlevel-twinapi.a":"da6071d2f9383b1918bca8f8e43e068f6110e0279bd4c2bb550aa51623740196","lib/libwinapi_onecore_downlevel-user32.a":"45162b307e5d0bd8558fc9d1546c0e74a8eaba61372ac3cd645944bbe385e62b","lib/libwinapi_onecore_downlevel-uxtheme.a":"64c40a49a0f21ecb41a1192c64ef00815b785e6ee4030575ae5b1d203666a832","lib/libwinapi_onecore_downlevel-version.a":"42dbd6b1186fd4e6da3bfde88c51199414f7c2980da46da12f9d6c760fa2686a","lib/libwinapi_onecore_downlevel-winmm.a":"2a17d8e31a4131334d59ed41e0f7a7763772be02454f12ca75254d3852ed2e21","lib/libwinapi_onecore_downlevel-winspool.a":"061b6216f3b343307d156833364f433116305f5e4d3e85de6bc146d65464702c","lib/libwinapi_onecore_downlevel-wtsapi32.a":"27cfe4b37a87e4e5c15fb61e400ec5ca949999bbcb18472864d14927c88ea6dc","lib/libwinapi_onecore_downlevel-xinput1_4.a":"c68a20b83e6c2ac77d7f98be2b4fad1601aa33d8996b613caabb02bc77e02ea1","lib/libwinapi_onecore_downlevel.a":"b970765271ccbbf0a2843dfb757f678f6b6fec0404914e861f24e289656335e8","lib/libwinapi_onecoreuap-api-ms-win-appmodel-runtime-l1-1-0.a":"d3c86590ac61e5d3b0d4d429a93632c2cbcb5842d84b8449e5b0a6807ba5c475","lib/libwinapi_onecoreuap-api-ms-win-appmodel-runtime-l1-1-1.a":"48415e10ec3ab60fcd7185def0b8e69cf7d4f81a3b7ae0edcf4c0eb4f9aad10a","lib/libwinapi_onecoreuap-api-ms-win-appmodel-runtime-l1-1-2.a":"267bdee09d1c9ebe8785ce68b65f5ca5a8664d29d0878286ce19eb145362837e","lib/libwinapi_onecoreuap-api-ms-win-core-atoms-l1-1-0.a":"4e3ee6e74bd59cabee0f82fb6764378d26bfc5ae3aec39de0a02e64d83bd7e69","lib/libwinapi_onecoreuap-api-ms-win-core-calendar-l1-1-0.a":"679c9a2425099afe8c74612d35969364b47dcad3773055c7854be1f495f6f5a2","lib/libwinapi_onecoreuap-api-ms-win-core-com-l1-1-0.a":"3f1a775d67835415d1afdb0f4034ca71bac4b51439690ec03f1b389e1b775120","lib/libwinapi_onecoreuap-api-ms-win-core-com-l1-1-1.a":"980b79f176613805271d73fd7ad35f763763858dbca5f564d2fa814a2bf31c0b","lib/libwinapi_onecoreuap-api-ms-win-core-com-l1-1-2.a":"00c8b599b3383b705a3d4c9c49ddbbd56371b4ce2b416da26219a8611e666585","lib/libwinapi_onecoreuap-api-ms-win-core-com-l2-1-1.a":"23324345965bff97ef1234889beff115969ddc2277338b22b0264deacd81e380","lib/libwinapi_onecoreuap-api-ms-win-core-com-midlproxystub-l1-1-0.a":"c81a1d129ead2cdd57f0a8957983e63d1f88ce29877823f16d24af2999218734","lib/libwinapi_onecoreuap-api-ms-win-core-comm-l1-1-0.a":"c1cb62129b8fdfa7e8fc585af0aa3737b177d2752825d9606ddb646ba5b567e3","lib/libwinapi_onecoreuap-api-ms-win-core-comm-l1-1-1.a":"125a0152d091e2e3d5a5b310332e001bcd0dd8d642144bbaf3d50904c0aa3637","lib/libwinapi_onecoreuap-api-ms-win-core-console-ansi-l2-1-0.a":"1c832fbd6f8f8c5c25164afaee442578e9fa3635bb49797d7634e75a897fd3a9","lib/libwinapi_onecoreuap-api-ms-win-core-console-l1-1-0.a":"f7b1bcdc025d31db9d43b8b6c8658ae9a66eaa9aa32454cd1547fdd917634d3a","lib/libwinapi_onecoreuap-api-ms-win-core-console-l2-1-0.a":"42cc06853f79b623e08556f05ca526610fa445d6023de2595c3ec49ac0c9fd14","lib/libwinapi_onecoreuap-api-ms-win-core-console-l3-1-0.a":"68a5a7b1d92129979588aa31c42fb97958461b928dfd2f7a045d70204311f0cb","lib/libwinapi_onecoreuap-api-ms-win-core-datetime-l1-1-0.a":"3b7b10e05a546839a77d7c5084a78a30bff0925c90e2a4ae6d92c478027cc4a5","lib/libwinapi_onecoreuap-api-ms-win-core-datetime-l1-1-1.a":"7881818a8ee239d8aac81b5b2911ebe648c44cc236dbaac2173455912a5a2b88","lib/libwinapi_onecoreuap-api-ms-win-core-datetime-l1-1-2.a":"f3cd722d06cf0357e7c028053f40e9153e2793b201bce822dd3581d3a046e88e","lib/libwinapi_onecoreuap-api-ms-win-core-debug-l1-1-0.a":"556fb78c433cfd083c07c74ca3925176f4d8b48c9a58e03daa62d19fd935397c","lib/libwinapi_onecoreuap-api-ms-win-core-debug-l1-1-1.a":"011e563fbe9356ca9917ae2dc9aafd8aea4735d166aba189fe29341f3537215f","lib/libwinapi_onecoreuap-api-ms-win-core-debug-l1-1-2.a":"cfbf8d52bad634cda3fc5441a5dffb72f12fc89da4a5620f390c9c70a22a2b2b","lib/libwinapi_onecoreuap-api-ms-win-core-delayload-l1-1-0.a":"eb7db447807c59b3f3c4a4896d16ce15e6bc4f1eee3bd6f53d1ef5e17ea5ac54","lib/libwinapi_onecoreuap-api-ms-win-core-delayload-l1-1-1.a":"36f22ac58c2fb1e420284e3fde54ccb0d9ca8a3eff842aa339ecea7edc51d220","lib/libwinapi_onecoreuap-api-ms-win-core-enclave-l1-1-0.a":"a31ad417ae86adacb47880039736845ddb7c318dd955f5f309ccb946706a8800","lib/libwinapi_onecoreuap-api-ms-win-core-enclave-l1-1-1.a":"db5331242f77516456e0fde1f53b3ae98cb5c9363a8e286cbf9b66c01495259a","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-0.a":"34789245073349fc68aa33a8ede222c967a551aadf31b3f86d56fb3915570f81","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-1.a":"8fde5f5f7a1a8b7bcda0b509a222c1d0ca75d97ad1b398159b3ebfecbfc603d9","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-2.a":"369d289445328091c31e346e78970619e77c4af3e50edd5425bc0203215b4462","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-3.a":"7f9093cf4d44540d295d6adbf96ec90b8ce3298aba899aad5d682ac7f4bc2fc5","lib/libwinapi_onecoreuap-api-ms-win-core-featurestaging-l1-1-0.a":"29d814a804f4778ef6fd4d1619a555c5644e5aaf7bf37ab7ad119addd721d5f4","lib/libwinapi_onecoreuap-api-ms-win-core-featurestaging-l1-1-1.a":"2f28d21147401dd8fbba19bfa040c215e7a6c62314305f527443bdb5ddf56ca3","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l1-1-0.a":"981daa2b794228cc1b0f5c83c08f1d2836e03ac460558fa58a3e7742f8cd2e5a","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l1-1-1.a":"b6e7b745b8b588189b817363e576a019067f2e30e7d00f0f941eb66078f687af","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l2-1-0.a":"b128dd7fb6ada26dd227ce86a98a7a096782f96178ec278be06cd04b4042b8d8","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l2-1-1.a":"9bb377627f9c2443f33a43c6cc3820106075cf950a9fcc02b3daf791f1ef219e","lib/libwinapi_onecoreuap-api-ms-win-core-file-ansi-l1-1-0.a":"d50709c46fbc52669a7d9896789cf4da085aba50bb1f2139f6e23b49d8100016","lib/libwinapi_onecoreuap-api-ms-win-core-file-ansi-l2-1-0.a":"ff2c9d565b71bb16f7e5bc730cfee673a469e6ff5a1ed83f33ede97c705c4fa6","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-1-0.a":"0eab57ca33867b10954c19bb791eef9d02b60edeba765f7f277301ecd5ad8659","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-2-0.a":"ea73055041fe18e9709b1094fb0c31b11b271ffb95b3a2e15fb249777adfd568","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-2-1.a":"0ae8a2d85d00854e933f163707e7773a14d49b4ede621d87d3bc5097c6378b74","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-2-2.a":"7a47049dee70562ee2070ace79a8212ec6f863c5dbcfe21aebb4fd7c1b69d9d5","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-0.a":"dd4beceb423668b7f214dc32e66c60575112d7dd3d51a60517318427f23baa1e","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-1.a":"aa8f1713e5696b03737c2591d84d23c5f0ed5143dcd198da14c67987e3711d3a","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-2.a":"85f8439e5786e36b585a2e2d94c4b81f23a8bc56dffcbc62270fb37066c5ab4f","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-3.a":"7aa9b32763e55c5c7a43b836a515b59d650ec6c09725a3b2670518bf787f77b2","lib/libwinapi_onecoreuap-api-ms-win-core-firmware-l1-1-0.a":"2674c264db3753cedd4c411d7b487fada1b6efbb0be8ca2d115d6f63fc1e7a31","lib/libwinapi_onecoreuap-api-ms-win-core-handle-l1-1-0.a":"8173abd5dfa36041c40923e65a16f02d9d6ca1397d6989e163239ef0b02bbe7b","lib/libwinapi_onecoreuap-api-ms-win-core-heap-l1-1-0.a":"3fcb04bce35545010b408f9ff4eb0ed16a0bf10be5d144f020299f87561748be","lib/libwinapi_onecoreuap-api-ms-win-core-heap-l2-1-0.a":"e39429d77525812669745c72a9574f93a431a8de9477771e1b7a1c312ef48335","lib/libwinapi_onecoreuap-api-ms-win-core-heap-obsolete-l1-1-0.a":"091ad5944fcc5136bc162915bdf64d58381ca8ea9a63ce839348ffc53ee330c6","lib/libwinapi_onecoreuap-api-ms-win-core-interlocked-l1-1-0.a":"0f52705fdbfdce70ba03c5c036ac5d0c0079ef3b3b4b35d2f672e64932962575","lib/libwinapi_onecoreuap-api-ms-win-core-interlocked-l1-2-0.a":"51a677e70953b1999902ad9aa8547a0eded32a2fab3dc307ff787d00e8d61377","lib/libwinapi_onecoreuap-api-ms-win-core-io-l1-1-0.a":"bcf91b892cbf3678c6b2706e8cb7dc6797b47fc77cd449a0ffdd922e437d3c03","lib/libwinapi_onecoreuap-api-ms-win-core-io-l1-1-1.a":"4c197c4be209f216dce71d520d21261634874b54e23bc0c24cb2892e5a011137","lib/libwinapi_onecoreuap-api-ms-win-core-job-l1-1-0.a":"4d7be6925bbb3d7c0d1916fb417613e0dab2b57e6c0f2c4be0b564fbf12c51c7","lib/libwinapi_onecoreuap-api-ms-win-core-job-l2-1-0.a":"4b1a622cda0d57fe752d78c09c333883f290625f3015f7497bcb7857063a09ff","lib/libwinapi_onecoreuap-api-ms-win-core-job-l2-1-1.a":"74f765a2a11db158c10c3348adc510f29c27c725f29e3bb1069eed17c4784a0a","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-ansi-l1-1-0.a":"bc31126b29484275b43c947596bf2e08f5fef6f2d83df78a299d2962165814f9","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-0.a":"94d5af97c1664a9e53cc2d3b85d2d02ad28231b89ed50847a90c29d21fd815ec","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-1.a":"75eb1e9161df1fc6e58d8183c9a63016d28c28d5adcb5872875ce51662f546b2","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-2.a":"c353ce2dd1f7c3411d83b0683215fadd3585d88667ddec2a6a8bd381ba1c2603","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-3.a":"21b13e0ecdc7c3a14512dbdf2846f86996cc16de0797f90e0472a97201e47fa2","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-4.a":"42b846000ee1b172d2f1520e308f3877bf60dd8fe4eb5ec71b208dd0efa98866","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-5.a":"dfa6f81a89f7e5e8019715b74145be5fd9ae68be722d93fb0ee93c04f3045326","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-6.a":"383b0645ed61362b0c07a7c4cfb2509eca3351b22e2bf3684d426c7622aab6c2","lib/libwinapi_onecoreuap-api-ms-win-core-largeinteger-l1-1-0.a":"3b23a209df9ab14d089bb2b5844e05b97db3a6f7b82cacf6dec70d7686e25d3d","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l1-2-0.a":"fcd6d6b4641fa4fc9e098218ac5e5394f4d73cb27bb008b08cce6e7f643f2ba7","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l1-2-1.a":"72a96e6532a6a27bae67a5ef133f03e30fb84ebdc36f4c900ad39d3e07ca3844","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l1-2-2.a":"d4f534c0b116466c6899ab60a86ed81983a40db61e2e92d3a37e688cddd5ad0d","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l2-1-0.a":"df036740da839181843676ade50cf20603b3479aefce6e793df39707a6fdf173","lib/libwinapi_onecoreuap-api-ms-win-core-localization-ansi-l1-1-0.a":"8c1da62a7dae359d4bd22d63683cf0d32f4857b3ae99f68d38738efcdecef988","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l1-2-0.a":"1c3870806e36a4e9c588899e28f4e5c4de8106dc329d79ef90da99c863e4152d","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l1-2-1.a":"3fa775366f4b011dd6361cd2cebf12f9624782b69f573dce0e50102fff96b44e","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l1-2-2.a":"15411409b7eb5d2a1d3eec112d987a3c6d5ab106e5241f83d58c88cffd8ece0f","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l2-1-0.a":"325684e8db77a522ad2afba966f4a2b49f0acea66b2aed43d9ae325cfdaabb4a","lib/libwinapi_onecoreuap-api-ms-win-core-localization-obsolete-l1-2-0.a":"22b7c413f185dab06cffd0be7771cc721fbf6f83fbc2cea0dae7e65337f6055a","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-0.a":"0ce9df0fc760bf6cc1aef4bfe066a76705a83066a5bec486a8514beefaaee6c3","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-1.a":"6fdb709c20b1d43029298b014d56ab4c06b2d395a88e7518caad576b4f88398d","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-2.a":"243cd4c16e8dc7ec9fd644013c10b4949aad0af52dd8e3db3dafb5cb2bd8eabf","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-3.a":"f24c7f20b0ab73a80201b20f6a1eccd48b9cba236725c059c2312fce629212e4","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-4.a":"1934abec8171e72074d5c24208313b3ec344593fbed1161176bfd125d683e620","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-5.a":"d980764c22793fb004b9d6ad38cba6f24df6a602375d9880ebcfbdcc7379223d","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-ansi-l1-1-0.a":"1cb14815487346aef5a3dbbd3a2b0d30940cce6bc9971f67959c5e9be379daaf","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-ansi-l1-1-1.a":"c5de9ae7e429fbf795a23d062c52c5727137a963abdd0dc84841b31b63a636aa","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-l1-1-0.a":"486b3f95eeb2683798486d68d11d4eecbc6c280087e41125290ca393d80a8222","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-l1-2-1.a":"0c17ff9e0d8a23dff2fe3050b9fbb195be65b7427c04b2212b6ccee8aaf5ee60","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-l1-2-2.a":"4b8dc31f16b2949308ed19af7cb9aca027e7895502498e545d50ebacd99366a3","lib/libwinapi_onecoreuap-api-ms-win-core-namespace-ansi-l1-1-0.a":"2fef444f0abe8c0920f31cce744e644ef7eb12e499d912595a7ed14222ad85d1","lib/libwinapi_onecoreuap-api-ms-win-core-namespace-l1-1-0.a":"4c76d9807883478f3120cd07b6cbefbdface7395579f97e0fed6f6b3a24ecc4c","lib/libwinapi_onecoreuap-api-ms-win-core-normalization-l1-1-0.a":"29609814bc5f82d39f4d7bb54194422bd2157e453222d19e0a6f506d08c107d4","lib/libwinapi_onecoreuap-api-ms-win-core-path-l1-1-0.a":"2f75edf68e1c98f473116442cf5d9eb2b423b9837e5adc86f92341a9ce211680","lib/libwinapi_onecoreuap-api-ms-win-core-perfcounters-l1-1-0.a":"9315a89cd14353866fd275198f8de1d1cf4f6b65061c5cc14bfdcea77e63de43","lib/libwinapi_onecoreuap-api-ms-win-core-privateprofile-l1-1-0.a":"10c02c555b6dbdda7b9ad0d92b84246e3b1184c6cbbb2d0f7084895345c05fea","lib/libwinapi_onecoreuap-api-ms-win-core-privateprofile-l1-1-1.a":"f92d83afc6664e46a881ac5fac52d4fb6964e96eee2e30cff6322cea97c0bef7","lib/libwinapi_onecoreuap-api-ms-win-core-processenvironment-ansi-l1-1-0.a":"09464dc83a12cd3c2d0853677087466a4204f31bda5dbb281988626b5e40e199","lib/libwinapi_onecoreuap-api-ms-win-core-processenvironment-l1-1-0.a":"545f03e2c75ed3c32169a6c434613a48b62302ff7331c473fb91b17b605e6cc5","lib/libwinapi_onecoreuap-api-ms-win-core-processenvironment-l1-2-0.a":"ee3e0e9a02a6ca01167b1dc76d9fb3424189407e4a847e11627d3864159bcac1","lib/libwinapi_onecoreuap-api-ms-win-core-processsnapshot-l1-1-0.a":"df1b934538dc0a4f882494a1c8abdf48b0d53a4e438178efd467e1cfc4a4d81d","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-0.a":"ccc89a05d8d0c99105e6d0ad1fbf2bc38f2892892ae9d15f9fff407311571246","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-1.a":"d4cb12d32b81cf5705686ad082f02029d92db818d7efd8b207d36541764637dc","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-2.a":"8fd3d7ea7a813f933a361328faca0e38c8b0b16b1d5520aa267662718b1b7c57","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-3.a":"2f155c81b6e30343acdc75c552555dca1f9a8926c032c6b3acee14cff972f960","lib/libwinapi_onecoreuap-api-ms-win-core-processtopology-l1-1-0.a":"5ce093dc8df1636e4cf347f5d51b8538ac857bf2d9722d3d99511143e781fd04","lib/libwinapi_onecoreuap-api-ms-win-core-processtopology-obsolete-l1-1-0.a":"38880be551d3f1f978c331e1ca5d8cc8b55cafa1e1871ee67fb739b9c612d04a","lib/libwinapi_onecoreuap-api-ms-win-core-processtopology-obsolete-l1-1-1.a":"76ef29dad970a16e1c40549ff34b0ee0b86bd584527f2a137b21be768ff7933b","lib/libwinapi_onecoreuap-api-ms-win-core-profile-l1-1-0.a":"dcfd4b505c08ffe79a5757fa94e09a77b1d4de56495422f057871ba4aefbb210","lib/libwinapi_onecoreuap-api-ms-win-core-psapi-ansi-l1-1-0.a":"ddd3168ed388af231eec3856534213d48bab350fa7bf4066029b0467dceebe6d","lib/libwinapi_onecoreuap-api-ms-win-core-psapi-l1-1-0.a":"41455407280d072f955e31fe23e35cb4fc5d21b1fede9c75414a9d18533a6bdc","lib/libwinapi_onecoreuap-api-ms-win-core-psm-appnotify-l1-1-0.a":"d606d6b977ec5743cffa24a78023cd1689e9a49f980f384257e1f26c45202f86","lib/libwinapi_onecoreuap-api-ms-win-core-quirks-l1-1-0.a":"51837092eefa3cf79f2bce33634edfd16f6c2e7afc1e126b8fb2ce544eb7e598","lib/libwinapi_onecoreuap-api-ms-win-core-quirks-l1-1-1.a":"e5238ceec5d73cabc0dd3eafe895c225cc486ea1a50d8a06f41b841d1a10a95c","lib/libwinapi_onecoreuap-api-ms-win-core-realtime-l1-1-0.a":"4d6a1d3393cd4148b33d03bfabf78e4192d0b36c757b608e207a407c7e51258d","lib/libwinapi_onecoreuap-api-ms-win-core-realtime-l1-1-1.a":"4c0ac153ed29cbf086eba2a213618dc1bd160bc10600651a62699e71574970e0","lib/libwinapi_onecoreuap-api-ms-win-core-realtime-l1-1-2.a":"48b271dffbe9fd590c75a03b07b95d296846b74865a985952571a3ed767230d6","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l1-1-0.a":"8e5364b76783a2a057e65bde14fefef76e45d75980f95bdf73f1ae85ce0a4c2f","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l1-1-1.a":"c249ee18479948017c89cdc72319f06936766f6f4b67c44ca45f345846009253","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l1-1-2.a":"fcd5e36aa26ff5956633691bf2fcc29597e208cbf7d990f63aab6740237e3b3b","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l2-1-0.a":"5870b00b573a1af4c9027bbf4d85fe8a7d399567a0b12a37003c2f4c61483117","lib/libwinapi_onecoreuap-api-ms-win-core-rtlsupport-l1-1-0.a":"2781431bfaf5ce5ebefcca998dd8795cbf8fcd5146c116a7c987a1354f77103d","lib/libwinapi_onecoreuap-api-ms-win-core-rtlsupport-l1-2-0.a":"202e861a1b520b3240b2a29392ab6533685a4961577278d03e4a7edeb8b2ef0f","lib/libwinapi_onecoreuap-api-ms-win-core-shutdown-ansi-l1-1-0.a":"d7658dbb5857d59b26239394cae3febae0bb3f42d08127fff44fa4ad3ecc9f6d","lib/libwinapi_onecoreuap-api-ms-win-core-shutdown-l1-1-0.a":"aaef3a002e3861a9fde26b62a8212343c6edf5fa40133be2a559dbb5e53c9a12","lib/libwinapi_onecoreuap-api-ms-win-core-shutdown-l1-1-1.a":"680ab1e2bc0ac585b7ea087dde64235a96e7b4f88bf9a09be2bff9705f6842ac","lib/libwinapi_onecoreuap-api-ms-win-core-sidebyside-ansi-l1-1-0.a":"f5bbe60a885264a82aa4d77b4615326038f66911a063f45859ef11a9aaec90df","lib/libwinapi_onecoreuap-api-ms-win-core-sidebyside-l1-1-0.a":"e6f0c4062d080c0a04b203b9bdb1444a19cff033fa605b90a419dc0881c4fc13","lib/libwinapi_onecoreuap-api-ms-win-core-slapi-l1-1-0.a":"215a69c1cbb52b067e37292b95b86de28a0648d89388ef5a15e8c40cca10f1b7","lib/libwinapi_onecoreuap-api-ms-win-core-string-l1-1-0.a":"451780a4598e947d000ff30b7eb10e360091b563bf70e20af2c94c7eec51a9c8","lib/libwinapi_onecoreuap-api-ms-win-core-string-l2-1-0.a":"1d4394e37606fa4baea5d0f6bce1da43775524b0b045d7963926e110180cc6cc","lib/libwinapi_onecoreuap-api-ms-win-core-string-l2-1-1.a":"d05d1992c5bcd95cd2ce7501625e634992c11a7211dd38c27e73a91502be2c4a","lib/libwinapi_onecoreuap-api-ms-win-core-string-obsolete-l1-1-0.a":"6ea0a007e81fa48e1fa2588944deda7385ad7c095828effb01b862c31da50a43","lib/libwinapi_onecoreuap-api-ms-win-core-string-obsolete-l1-1-1.a":"d9bb5b58d9300e8c02a6308ea5f00b8c4262bff684dad472a1cc2b29ea7e077f","lib/libwinapi_onecoreuap-api-ms-win-core-stringansi-l1-1-0.a":"a86890ba722cf2d6d004566cfcec8b4af09fd47b12816312a082b36c6bf075c2","lib/libwinapi_onecoreuap-api-ms-win-core-synch-ansi-l1-1-0.a":"4352877cd0720a1603f8075146fde3f099066f58aa0ec8302281321cd3d4b98d","lib/libwinapi_onecoreuap-api-ms-win-core-synch-l1-1-0.a":"5f0218f025935c7e4b65961e11eeed266492bd1f0301ce6c25ac24d002b22b62","lib/libwinapi_onecoreuap-api-ms-win-core-synch-l1-2-0.a":"e725dc6a2ef1d60d775efa4d343293909aa5517750cca04164bcb61d46e5916f","lib/libwinapi_onecoreuap-api-ms-win-core-synch-l1-2-1.a":"ac297b8eb54fc34eafa7b759bfed04dc18c93daa7f93e7f0f2cea3a7c475a7d6","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-1-0.a":"98c68375875558c4f411a88bad4dd37a340d6e4163fc032293d711d4db0d9284","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-0.a":"2a2fdc4266fe6b331347d856efbed6c31aef1095a2395958dfb138a22e7e0593","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-1.a":"32db6c6d93a4d037b50116bcc7910c6225d6e8d2a3608cd394284e1823f62808","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-2.a":"67dbe9be1cdf2767f1d3b3bec1a2c9df8f3c5eb0a975524e7556b9b0ea78a2aa","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-3.a":"8b1afcca9eaef220bbd5d8f0cdb6e88aa9036e90fc1ee9de96c2c1111c409bc8","lib/libwinapi_onecoreuap-api-ms-win-core-systemtopology-l1-1-0.a":"47cff5f175894c712e6d20d1c404090459d35d4dae53b3497d9242ef2f2d73e3","lib/libwinapi_onecoreuap-api-ms-win-core-systemtopology-l1-1-1.a":"f1d4efcd0ec7d87bc7c8dda10663fe8240c8d48aa07197bec6652ed525690649","lib/libwinapi_onecoreuap-api-ms-win-core-threadpool-l1-2-0.a":"b19ac8221162a0f9566c9eb87ce2b86e87a1910fe2a7881820211f38ee3aeba7","lib/libwinapi_onecoreuap-api-ms-win-core-threadpool-legacy-l1-1-0.a":"ad138cfa5e31068274a952129ef479bb7119d3b42b34374644dd41e49458ad27","lib/libwinapi_onecoreuap-api-ms-win-core-timezone-l1-1-0.a":"f21e218279a75c78afc87c40d2a2b754342da2bd0cc8af897f95f8af5a288d3b","lib/libwinapi_onecoreuap-api-ms-win-core-toolhelp-l1-1-0.a":"f00cc735cc566b693c5b742bfb2d2d354108bbcfe586c65614f014170d6dffa9","lib/libwinapi_onecoreuap-api-ms-win-core-toolhelp-l1-1-1.a":"68359a6e23bc3f7e0b28649b2043636878b3ab9b51d2ea654af5cc0dd121d3a5","lib/libwinapi_onecoreuap-api-ms-win-core-url-l1-1-0.a":"be126eccd520e8277bfc8d6a19c4c46ba1fff311c26cd06edb74f9051ad99893","lib/libwinapi_onecoreuap-api-ms-win-core-util-l1-1-0.a":"42c356e09939dda837beb51b64ba7f97166eeeda2f266cdcb6df896a04de3aaf","lib/libwinapi_onecoreuap-api-ms-win-core-util-l1-1-1.a":"ba0fea23ced4dac28a60163c4e8fd09f21e01f50b7f530b54ae011052a168bc9","lib/libwinapi_onecoreuap-api-ms-win-core-version-l1-1-0.a":"052ed9804659bd50c539cde044099ef780c243485a9115a69b8f63072db7a982","lib/libwinapi_onecoreuap-api-ms-win-core-version-l1-1-1.a":"d9e70d125b57d17914aa6bc13eb016d7ab4f91e7000a2c7080b8e87e295707c0","lib/libwinapi_onecoreuap-api-ms-win-core-versionansi-l1-1-0.a":"bbc4afbd98ce59031aee26fa274422ad398495992645d1cfced87c9190814275","lib/libwinapi_onecoreuap-api-ms-win-core-versionansi-l1-1-1.a":"1db4d7b4c6533b76908e02d0f10c503a462cdfab31943f0dd5977cdaebe80efe","lib/libwinapi_onecoreuap-api-ms-win-core-windowsceip-l1-1-0.a":"71083395675d6a70737a536740c738fc5a78fd994f2765e805114c7abf967145","lib/libwinapi_onecoreuap-api-ms-win-core-windowserrorreporting-l1-1-0.a":"815bde766214e8c587755e7a64b414e8c36ef5254271d349c8ccd83f572c2554","lib/libwinapi_onecoreuap-api-ms-win-core-windowserrorreporting-l1-1-1.a":"0a81e3a58b0eea1700b4c34aa134a6331d4676af07cb95d743629486410db5f6","lib/libwinapi_onecoreuap-api-ms-win-core-windowserrorreporting-l1-1-2.a":"d247c358caad935a249046662bd264177bc64c42bf7ee5fff3800c3bbe5a5cb4","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-error-l1-1-0.a":"4efad1a7223a869ac244611db554b0aedd7d71b3eceb5b1a05ca86ac227f18d9","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-error-l1-1-1.a":"18a5899b0514067a826165a2dc8b7269af1215fb6ebcb73f6d66ba5ac8cc6126","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-l1-1-0.a":"89fb7e6c8a71f2bd94e8b2c8582e364cb2c16bbc7ac6ccfd09a3d4928bc8e155","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-registration-l1-1-0.a":"3018bc64cbcad0a5e4f2971d9809fde825354fd0ae26687cc3e60360305f3eb9","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-robuffer-l1-1-0.a":"31ac7ba09d20175054ff31f9af80c08ad85c0a29be39cfc1635ed2b27e81eddb","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"636c8cd23dc6562b21eb38c5f669b24f35e6bdbcbbaa98b307e59c4f0f0a275f","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-string-l1-1-0.a":"b48880147bd2d1a80250763917d241d22f5a8e3a6f6e166794981b25f844d2bc","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-string-l1-1-1.a":"b610a885501f6cc752b489604dcba7263369c9d5bd77b2da2cab13f53b6bbb35","lib/libwinapi_onecoreuap-api-ms-win-core-wow64-l1-1-0.a":"d142984bd3e767cdc58fcac0424531a2c2d9b9a144a980f915f4284201853376","lib/libwinapi_onecoreuap-api-ms-win-core-wow64-l1-1-1.a":"4085cab48e40967e5e1e8e97e434b71ee99f6b61d37e0de094cf75e1aaac48f9","lib/libwinapi_onecoreuap-api-ms-win-core-wow64-l1-1-2.a":"59db977a01e378e44b99b1948c48ac05629ade8d7a765eb9bf5b907417dda47d","lib/libwinapi_onecoreuap-api-ms-win-core-xstate-l2-1-0.a":"673a6cd40adcdec372e4f19137bbd7313590d2b15968beeba81f621c614b0ebb","lib/libwinapi_onecoreuap-api-ms-win-devices-config-l1-1-1.a":"2005e03b1501f8132abdcefcc57f67bb035980921ce5a2fd1b3b562a09317fe5","lib/libwinapi_onecoreuap-api-ms-win-devices-config-l1-1-2.a":"c2c12007510ddebfd1bd0e728b5d2c22f7f3b2f1709e3292fdbef51272ea0e62","lib/libwinapi_onecoreuap-api-ms-win-devices-swdevice-l1-1-0.a":"39c656589749fdf35c69a1766d78e72f7d8752bb0160ecfb420dcd90b88aa641","lib/libwinapi_onecoreuap-api-ms-win-devices-swdevice-l1-1-1.a":"4b88fc33d145f75980a2c41c9e388a4b7306a188864bba2d691ef8e7b3b11be5","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-0.a":"678c64c107c4bc675c560beafd5825486b6df2a2fc188edd8486a557ad4dfabd","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-1.a":"bb05f6eb1f0653bb73a95f81e4ca4372cdfc4d8d5c1fd2bac77e42bcb1bba309","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-2.a":"4d3e3af73a57347050bcaf7fc41e6d808764fa76e4a376285bc80eb59148d7ed","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-3.a":"081c8645869cb668c6ad3afee70e2c34f195385415e709e9ae7535932f4da08a","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-4.a":"0bb03b24f02b1c7ba97178ee8e8f3b39e6bfa55afcade1f8bd8939f3b67f55f4","lib/libwinapi_onecoreuap-api-ms-win-eventing-classicprovider-l1-1-0.a":"db1288414b42cdc7044406f9921a81c5fb186bc73312e468749f156f6f03c40f","lib/libwinapi_onecoreuap-api-ms-win-eventing-consumer-l1-1-0.a":"2c79559696b2f870e4908288fa5408c847beb64b8dc73beb08cdcf0b1a40f6cd","lib/libwinapi_onecoreuap-api-ms-win-eventing-consumer-l1-1-1.a":"9e94fe7e1ffb578ca39bc43b0e0101205be66e6ac43a725f07f6548ed087300b","lib/libwinapi_onecoreuap-api-ms-win-eventing-controller-l1-1-0.a":"2a063c56d77f0addd6a16e8ea6d88e1462c023c702c991b2b86736f002ffebe0","lib/libwinapi_onecoreuap-api-ms-win-eventing-legacy-l1-1-0.a":"d4cd460dcb927feceb0dce96ae90d1642c82dc529cb3ccb4589a915b25fe1c34","lib/libwinapi_onecoreuap-api-ms-win-eventing-obsolete-l1-1-0.a":"025b8bcdca89ed47485c49dde4853e5970f7ed786f69b0ab5807ec06e7bba366","lib/libwinapi_onecoreuap-api-ms-win-eventing-provider-l1-1-0.a":"7876289ee5040a3f11148aefb7b01fa202ca79cb9069da5b8caf86737b437426","lib/libwinapi_onecoreuap-api-ms-win-eventing-tdh-l1-1-0.a":"89667e7ec7dae91e79ed5fa13d891c37a8e286bb45dd8de9a8dd448a2f736dce","lib/libwinapi_onecoreuap-api-ms-win-gaming-deviceinformation-l1-1-0.a":"5fd19100b3260241e8878141cd5bd8f3617ed4c48d6b6452e14aaf08cdd27089","lib/libwinapi_onecoreuap-api-ms-win-gaming-expandedresources-l1-1-0.a":"5e1cdc4cd8cec594d30db4914b729ebe6583a6f5af036ff93a177f099ad9ee53","lib/libwinapi_onecoreuap-api-ms-win-gaming-gamemonitor-l1-1-0.a":"38dfcc7ed83bcfe38b7e905561133b27cf594dfc1fbb96fa03b80feba76ca16c","lib/libwinapi_onecoreuap-api-ms-win-gaming-gamemonitor-l1-1-1.a":"38af3947214e5d665c024c29f9f39414c943707cd9c86b87dc2fb18d2295b0bb","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-0.a":"da3d65e5bd1915f53eec24d849e20091633a6b13f5a8d1be73388b0213e3439c","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-1.a":"0bd2282616214fb725aeda88bd59b7091059f6f5002d52ae2e8d754d7d06ae6f","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-2.a":"92a3e07e323a2f1614cdb421cfd140d427ec9703f8edfd2a114677246286c705","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-3.a":"9f93f9d9abe2634fbbec022e66b9d8adc281cbcfac531c9431e041c5cf9a89b6","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-4.a":"489159c1464d80c3fb0969411fab3f43b9aa1c285099a2975b61b28bb1875b64","lib/libwinapi_onecoreuap-api-ms-win-mm-misc-l1-1-0.a":"297a027aba604387f23060466cd5304cced64d47052f338bc86c2af9cf687b64","lib/libwinapi_onecoreuap-api-ms-win-mm-misc-l1-1-1.a":"fdc97903a1bacbec67e55d45b07b23bef41f4cc03a8616c5a648bf487a70e0a4","lib/libwinapi_onecoreuap-api-ms-win-mm-mme-l1-1-0.a":"a46a947a4eb895937163b34da1636c7409db1b1abd7062a48a36f3c35e8eabd9","lib/libwinapi_onecoreuap-api-ms-win-mm-playsound-l1-1-0.a":"c6aa65feeda4b5f202beadaaf82e6653dfbfe50262e3945d3d82136ab3b97f11","lib/libwinapi_onecoreuap-api-ms-win-mm-time-l1-1-0.a":"81d7edf1275352ac2fdd63d5ed7f7345fd264e352c9f52757de771e668b6e7a0","lib/libwinapi_onecoreuap-api-ms-win-ntuser-sysparams-l1-1-0.a":"7ca93f87be1e2a1d3216727b40f54af4877408697b366d7a8775fd3f0932ba05","lib/libwinapi_onecoreuap-api-ms-win-oobe-notification-l1-1-0.a":"5013e2276a50c14ee76197c6975d5e7e49477b9b94b7731b324528a43c8d8149","lib/libwinapi_onecoreuap-api-ms-win-perf-legacy-l1-1-0.a":"302d3b509146b4f79224111a98537bc5312f2b7462431b78041fd20180370ba2","lib/libwinapi_onecoreuap-api-ms-win-power-base-l1-1-0.a":"de568a8e22d5641b02b1ce215f40d928a994b5a812f7ddc6073ef990d14395de","lib/libwinapi_onecoreuap-api-ms-win-power-limitsmanagement-l1-1-0.a":"c571b5c61c89101d79153fd5e325e529746a4f935009502eccf49be2639fbcd0","lib/libwinapi_onecoreuap-api-ms-win-power-setting-l1-1-0.a":"ba367b58b92a4849b9d42358e114975fa77ae61db6566ad17b64b117767b7ac2","lib/libwinapi_onecoreuap-api-ms-win-ro-typeresolution-l1-1-0.a":"588c8f8e2a29ab4f8f42592a1a4b1bae39952e5e048ba009bb455241d94b9d6e","lib/libwinapi_onecoreuap-api-ms-win-security-appcontainer-l1-1-0.a":"91e9d15d917625efb826adbe249caf52b9374b73b69a3705590f9449f7a9728c","lib/libwinapi_onecoreuap-api-ms-win-security-base-ansi-l1-1-0.a":"e99e7d5084b34115b5857a0b0da2312c3b3bb35a19124a0fa9b6fb158df7a827","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-1-0.a":"29177671bb7aa2dc730255cc4e9e5a776d33627908d6fa804f613d502288fb1a","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-2-0.a":"3ccde6785b18b4ccb9954c58fcdfcbdc9ac956510fd3b6b5f673916e822a284f","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-2-1.a":"bdd276e8ee3b5bbcd4c963a125b7aeb41f09ba78f9393b9a782e75d701202cc5","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-2-2.a":"d73d1b267be96b03a77b62a0f0109ed57ca963d263c40cf0b8392376b7019737","lib/libwinapi_onecoreuap-api-ms-win-security-credentials-l1-1-0.a":"7db8b25fe27e4118a11ee1ce592ebc1ec02f311f24e4ad728a52c14bd57b5388","lib/libwinapi_onecoreuap-api-ms-win-security-cryptoapi-l1-1-0.a":"e78d3845b2d2a998071316cf02b84cf8768b4cec8c07f61ea6529b047c02e8bb","lib/libwinapi_onecoreuap-api-ms-win-security-isolatedcontainer-l1-1-0.a":"b39deb635c9b75ad994434ccb40a34ffa5a009537da8f2daa24be9e5f2e5b52f","lib/libwinapi_onecoreuap-api-ms-win-security-lsalookup-ansi-l2-1-0.a":"0e053bcb2dfedf93db1f0d1cc10fa6376291c74fe42d0632e446e651d4bdbfdd","lib/libwinapi_onecoreuap-api-ms-win-security-lsalookup-l2-1-0.a":"ea06cd6eb2ef5f91ce5842db474e25d932f6ea9a2308beed0987b1d87cecbe33","lib/libwinapi_onecoreuap-api-ms-win-security-lsalookup-l2-1-1.a":"7ff8b66d0cae038647b654a51971c03cb68dd2d276367494a42e12c68329e43a","lib/libwinapi_onecoreuap-api-ms-win-security-provider-ansi-l1-1-0.a":"55a1489c8a5fdc42c9c8837e9a60fb8ca846437bec53f15a622c273b5383ebfc","lib/libwinapi_onecoreuap-api-ms-win-security-provider-l1-1-0.a":"90fb932b6acfb04c18ad578d21e92d650bf85a533011cd0a475d0ec82a59bc2d","lib/libwinapi_onecoreuap-api-ms-win-security-sddl-ansi-l1-1-0.a":"a473d99ce6bb8322d7e689b15984663c800d7c1f3e67d1b3c5ccd9d96b959c88","lib/libwinapi_onecoreuap-api-ms-win-security-sddl-l1-1-0.a":"0ee760ace08e164fab85f820006ce8815044fc433231d68b6e9c3d159443acf6","lib/libwinapi_onecoreuap-api-ms-win-security-systemfunctions-l1-1-0.a":"b5c6e51d36999fc72d7522530cc2bbb0f217828aa95b32bc6c08392ab66e8af6","lib/libwinapi_onecoreuap-api-ms-win-service-core-ansi-l1-1-0.a":"00237c5c1db6884ce4838160ed785152cb40c41375e7b1629c681aea13adcd60","lib/libwinapi_onecoreuap-api-ms-win-service-core-ansi-l1-1-1.a":"80b7b1504cc24abe588f7ecd0790eedcb8b2c211ca663cce314c076f09a1b670","lib/libwinapi_onecoreuap-api-ms-win-service-core-l1-1-0.a":"db753a291d09fe4ec26112375fb6373b0aabed532d410b70c6ed24f23a51308c","lib/libwinapi_onecoreuap-api-ms-win-service-core-l1-1-1.a":"a781ed18c9c34337d5a4371c8a462b6113513e948421ff05c66aa6e75a769ea9","lib/libwinapi_onecoreuap-api-ms-win-service-core-l1-1-2.a":"034bc5dc8aca49021307759180266ae2356027122e448881c2802950afcbfd41","lib/libwinapi_onecoreuap-api-ms-win-service-management-l1-1-0.a":"a519ae4dc74c73a907c6eacc0a139c6d711dc197bd7ca20156d0b1b0fe3fff22","lib/libwinapi_onecoreuap-api-ms-win-service-management-l2-1-0.a":"aab7256caa9592403af60bb53576826db02ab98ee3ad159f28d7cc07b3b26ff7","lib/libwinapi_onecoreuap-api-ms-win-service-winsvc-l1-1-0.a":"e5cdb3ca221f979bf4a95b18fb6e10f37c8b5528ea2307a3aab168f05ef7d78c","lib/libwinapi_onecoreuap-api-ms-win-shcore-path-l1-1-0.a":"25745fd8cccea13271fb1e5bb77ce8e586fb6373083fa85c7643ca889c826cd5","lib/libwinapi_onecoreuap-api-ms-win-shcore-registry-l1-1-0.a":"83d9460385c14ca2b1c2d31cfba4a6f458c26b50ae6a881f69a2ada5438c0d8b","lib/libwinapi_onecoreuap-api-ms-win-shcore-registry-l1-1-1.a":"afc589549c805deb270fba1858895303b8c85009a5ea6f8a8ee851f2ec1fc435","lib/libwinapi_onecoreuap-api-ms-win-shcore-scaling-l1-1-0.a":"b55fe6d9d8fc9ae5caaf6dcd600d9e85e2565a5fd7d2ad935ac718ad071b66a8","lib/libwinapi_onecoreuap-api-ms-win-shcore-scaling-l1-1-1.a":"cff41a245275ce4997a00cbe133530bd53a2d1e11478bb0916216e04d9f3770c","lib/libwinapi_onecoreuap-api-ms-win-shcore-scaling-l1-1-2.a":"0789a760a1eff7954397e0c0bbf6a4361d207e768ebe7462408efa2bfe230245","lib/libwinapi_onecoreuap-api-ms-win-shcore-stream-winrt-l1-1-0.a":"912b8527edc807990ebe2e9b2d897f8999d2f46afa0f18a40a1f95bbb4da7260","lib/libwinapi_onecoreuap-api-ms-win-shcore-sysinfo-l1-1-0.a":"f93089f8d3b65e117a7e2da3a070c21020f17ba7fd4896007b49f835db63ec65","lib/libwinapi_onecoreuap-api-ms-win-shcore-unicodeansi-l1-1-0.a":"09a8c1c51c429f9d1372fa8da39e5347b04936ae4b91c9b42d5b7717289575b7","lib/libwinapi_onecoreuap-api-ms-win-shell-namespace-l1-1-0.a":"818744fc89764f3cede4ce7705477aa08f9b5fae7c268f7fda7a51632eb4ba4e","lib/libwinapi_onecoreuap-api-ms-win-shell-shdirectory-l1-1-0.a":"d9eae63e869b060ca7baf0d11636cd364ffed32d82e539ca49910708ac070ace","lib/libwinapi_onecoreuap-authz.a":"b0087e02bdc1ba5a6b604507ca7a0b4adc4911898edad9313fbbbe31ab5148f8","lib/libwinapi_onecoreuap-bcrypt.a":"4dfc5046f245c441eb73374f223191a4d31fe9e298f9da0c250deddf7e63fded","lib/libwinapi_onecoreuap-cabinet.a":"997c70e81fe1ee8aae77a783f8c22d113e0942364b79e6fee59ba98e88a6e28c","lib/libwinapi_onecoreuap-chakra.a":"4da85e72edbc4ab7f5f203f4721d062fa292706cb8a8e20553e5cb3f29f311d5","lib/libwinapi_onecoreuap-coremessaging.a":"e6bf985ee95bfa007e76fe4af6e692864afe304b598e284666ea99fb3e0c2e70","lib/libwinapi_onecoreuap-crypt32.a":"8f2f9990ef20feac1f86fc2fd53d0446e3bbff05e89a5db3d5040df557e129d7","lib/libwinapi_onecoreuap-cryptbase.a":"85deea089b92e7af4eb762b2d2ec37be6b7cf7becaeffbcb55b98b7e5158a959","lib/libwinapi_onecoreuap-cryptnet.a":"898938fde8b3a27249816d93ac806bdee05000fb4d154da57b66bcd9f0ef5c49","lib/libwinapi_onecoreuap-d2d1.a":"3f5e8bd1c3efed072f2b800c597b883e911a3688e008b3f61bf65329e001e230","lib/libwinapi_onecoreuap-d3d11.a":"16286d720860c65476daf0e1a2edd456a53e794881edfc9132f8f672cb6de336","lib/libwinapi_onecoreuap-d3d12.a":"275cf82ad1dadc157f6451a6e1e005115c99503a005b4b81f3c11c7e82aedc65","lib/libwinapi_onecoreuap-d3dcompiler_47.a":"69e4e84582ceda25cb6ced4da20a35f0714a174621a04eb781eb66a296ef900a","lib/libwinapi_onecoreuap-deviceaccess.a":"7e623da399c5b7ffcb22585fab44f19e9c6883730d58eaad12da4e62e683047f","lib/libwinapi_onecoreuap-dfscli.a":"ca27fe9acf7b684586eeb5adee70e3481da216d8a50fd040fa2cb90f03d8c3bc","lib/libwinapi_onecoreuap-dhcpcsvc.a":"189dc2186e79e0d69ba477ac57997d358697b6875e39068d28bb25e7487da647","lib/libwinapi_onecoreuap-dhcpcsvc6.a":"3cf7fa8066a4705acdfddf0b8807811eda2504d37e3cda9d4844b5307d0004bb","lib/libwinapi_onecoreuap-dnsapi.a":"0b23ce68f4dc3215ecd833f8fba9c0ae9dc3b65ef52eeca247dc2733c7858545","lib/libwinapi_onecoreuap-dsparse.a":"b1f3525fcc509959f68094b613f24fffa1ca79a0421e5e0700fa743fc22382e9","lib/libwinapi_onecoreuap-dsrole.a":"56a7e387412285e2be1aa2a9abeb58dea338d2fb952ca45653ed404edef4f6e5","lib/libwinapi_onecoreuap-dwrite.a":"7d70b0cea50eedc373bb21b0aedf0d37ca2073cf165a7a20024a3d8ec4b6f040","lib/libwinapi_onecoreuap-dxgi.a":"296c5520cad1dff933e00a3cce5f0c04a9bcbac7eedca01410f3cd5270cefa12","lib/libwinapi_onecoreuap-esent.a":"ca9b7ef4d8260391d985d6faa9778880d2923d5dff5808581ca15ef851c16a80","lib/libwinapi_onecoreuap-ext-ms-win-core-iuri-l1-1-0.a":"c21683fb91594c9e41a64bf85427e4dc2841817cf28af76db288109bb98f1607","lib/libwinapi_onecoreuap-ext-ms-win-gaming-xinput-l1-1-0.a":"0d6c985cb498bbad3aa7b8e4d838ce6b2e198ce51b62c411c557fd32d7ea7822","lib/libwinapi_onecoreuap-ext-ms-win-networking-wlanapi-l1-1-0.a":"daeeee3af2d3fc5604db26ae3944d5da419c2fe36682835199a7d67b0e9335e3","lib/libwinapi_onecoreuap-ext-ms-win-shell32-shellfolders-l1-1-0.a":"6db0f416b2e2b41c16c13083acf107c966f878736d669f0b6bb4e434fbe56e5c","lib/libwinapi_onecoreuap-ext-ms-win-shell32-shellfolders-l1-1-1.a":"f1a8b3c486a9deebe4ceaf19b5e6abe2854e7583565a52d00dff0e90efb82b40","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-0.a":"af6153478f9ecd5351c8177172037b5b88717c8cf3af620c8ad0f36655fc0fe1","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-1.a":"42e77d1277a6c9d8338d228776e773baa7402126ea3414e0578ca4c2812e1f83","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-2.a":"b0bfe4bdf945ceafd3e2555f933c6ed2890558094573b56c641468089ee2d0f8","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-3.a":"02f0d2d6e6389be7367468eb30d1dc8c096b6bdfcf7150799a1ec05a88094274","lib/libwinapi_onecoreuap-fltlib.a":"b888de58402865fc62b30e12161819e454edeeb81469aceb8bb537954e64ea7c","lib/libwinapi_onecoreuap-hid.a":"e721b5f6b4a14311c2989b3061daa6ac4846ef52f20ea0aa8c1cea8d452e9af1","lib/libwinapi_onecoreuap-hrtfapo.a":"e508ba82ef44b6eb4d598e7541b54f3a1d2f7dc09792b68fe9698b41844bba38","lib/libwinapi_onecoreuap-inkobjcore.a":"1e322dd27abaf96975a65c5a192ef8ee781964a15f0ce874b3c846720d768a5c","lib/libwinapi_onecoreuap-iphlpapi.a":"af8e1d386d8c772e58656d2ca189e35be48485bdd4cca82d0f0986d7cb256544","lib/libwinapi_onecoreuap-logoncli.a":"2b9fd321ddede7d228d2827338aea5f96ae3fc029791a5667389e4be89298934","lib/libwinapi_onecoreuap-mf.a":"a7eb11455bbdc1cbce6e76ae8deba2ff2063fa522378f2a6ee7fd51af60e2ec6","lib/libwinapi_onecoreuap-mfplat.a":"0c29638fd4287f7ecd0e50e3deb7f90c6ec742606301c648426b511f811e74da","lib/libwinapi_onecoreuap-mfreadwrite.a":"a8a5a490c6f5c0c65c86d0ec5b8d5e85a9490f95cb6d394270512ebd729984eb","lib/libwinapi_onecoreuap-mfsensorgroup.a":"f520843b4b52d97669beeb7ab1b909ad28d486468eeaa322692e7e46131097f6","lib/libwinapi_onecoreuap-mmdevapi.a":"45b7bf35c10cfc14a5e583befee0ea1b941f21284c1fd1e151dcc63a8dd2c0ea","lib/libwinapi_onecoreuap-mpr.a":"97a29ac8014e56c94128d495f833128fc82ec324f4a6422c9904f7be563669ac","lib/libwinapi_onecoreuap-msajapi.a":"387e2374ef7c7811f9b2fad493715bc2b4222a61c51780736ae1ff5161cf8227","lib/libwinapi_onecoreuap-mswsock.a":"fffb40fc34f6d1c814c708a8538cae9a063609ff00d303af8282f5bde64392ed","lib/libwinapi_onecoreuap-ncrypt.a":"92784794cde4bd1740b5a05c64dcc5cef5d74f9b0de75e5896f7fb93fb71793a","lib/libwinapi_onecoreuap-netutils.a":"479cb4ec40e4cfdd8922d2faeecac43574878a6aac4b79a40dab9ca4e06e8136","lib/libwinapi_onecoreuap-ntdll.a":"1d595844847f342d4aea12a72244b6a026c59cc1bcc53a22f897851ba3d7d78e","lib/libwinapi_onecoreuap-oleaut32.a":"b7cd9486d641252ff347d2789b5056eaf5e6aca133abf55f038d03bbe30b5cdd","lib/libwinapi_onecoreuap-powrprof.a":"ecbba8769819c8e4b875e811e6b16431ae72823eb1ecdc44ef6c0edd20ba251d","lib/libwinapi_onecoreuap-profapi.a":"6ca6834e6f360fba79663814de78f063cc66c91097a5022d38487d9ebeb17418","lib/libwinapi_onecoreuap-propsys.a":"06693d40f11365d3c5d02820a12438a28bb6bc303ba963de8e3db794db8b6d0a","lib/libwinapi_onecoreuap-rometadata.a":"5ce482d52f176128e7e21e21496e3a792b9aab7257d86833052f2a4d438d1881","lib/libwinapi_onecoreuap-rpcrt4.a":"a2201586d6b38834a9b5d6365f1370c223464dd00f02b4cd64f35cd6a818fdd7","lib/libwinapi_onecoreuap-samcli.a":"42de91bef47de2bacc6bbc87d8eb08539755679946a0e90b0063d85fd3271427","lib/libwinapi_onecoreuap-schedcli.a":"9b02171c8ff00202939861898e19d8b2179253174c2b13d5aa1cf7bf442136b1","lib/libwinapi_onecoreuap-srvcli.a":"5f4200132e924a3eacf5062efce801cfb013936cc2367dab171259a690aae9f8","lib/libwinapi_onecoreuap-sspicli.a":"0cb8421e125bf93af55e64d181013a57f319d6a2e789eaa01cd9bf77272ba0f1","lib/libwinapi_onecoreuap-tokenbinding.a":"4cd364aebc64795031bf77ace65846ff78b9a9b276ff98ee470ee446d2e4cc08","lib/libwinapi_onecoreuap-uiautomationcore.a":"2a3d7e26b81d7c5c16a430080a5b770ac4f29644f7fb881e073c3b5d26764105","lib/libwinapi_onecoreuap-urlmon.a":"174501cb43a18a7f888b1199f59e65417d63c77a548d0dda237ecffd5c324d17","lib/libwinapi_onecoreuap-userenv.a":"53949d2d08e0281903b926ece14d552864384875c0c2910f4b78013c59d30d78","lib/libwinapi_onecoreuap-webservices.a":"d4c2dafbd1940dd63a0650defdfe1295a52ee6578faacdfd5291f89770417e6b","lib/libwinapi_onecoreuap-websocket.a":"ef3391e989003ca6f0b2f5564cf50c96f7b7137d6a4a2f35646beba83368f474","lib/libwinapi_onecoreuap-windows.data.pdf.a":"1dd8dfa235ad8ac7dfc5bb180677a684de59f5db8ed5bc1f971504cdc2c296fd","lib/libwinapi_onecoreuap-windows.networking.a":"0efeb95876b2cdbca86d0ca4bd9f9779356a99b8ce6b79c082eb081d0ea6cb10","lib/libwinapi_onecoreuap-windowscodecs.a":"27283a7ecf13a918f0eb64dc8661098b8f4c99dd19418f23813c1f051ec16bd8","lib/libwinapi_onecoreuap-winhttp.a":"cee254504e5d88ac2fdac8a27aff6cdab52007e25ba9a88288d9e1e10b06badf","lib/libwinapi_onecoreuap-wintrust.a":"c310ffc6b7dbd2f2d94ba4f2b9be475a93e4ae2ee58fa4d0a3d01de3c12d12ef","lib/libwinapi_onecoreuap-wkscli.a":"e8831fd954aa9673eb5183d09160fd55aeee64d57ce99d93d33558d67973f371","lib/libwinapi_onecoreuap-wlanapi.a":"943692ec7c733dd0bd784f7fbc11d62d5e2f6d7372cea44d16054e92b78e650a","lib/libwinapi_onecoreuap-wldap32.a":"e589d481a5145ea87bb59092696c1208334333174e1b5e263ceaa0e4467a0cd3","lib/libwinapi_onecoreuap-wpprecorderum.a":"e79472031220317c981ee91825bab52852a0abd28cda89384cba1eb35b5c2cc6","lib/libwinapi_onecoreuap-ws2_32.a":"01d39c4c553d30d52266a44e0f6cd51aa13a4455d2ebd5ffd8aac506a572124b","lib/libwinapi_onecoreuap-xaudio2_9.a":"c26f6eb5ffcb6a9d0f6fcb1a0094940bc158bc983e18b2c4a68c78fb11921f2c","lib/libwinapi_onecoreuap-xmllite.a":"87e3282045b56f24691c48f3f317dfa1e75ccf2590cc3e64d6da0f93b9a9a961","lib/libwinapi_onecoreuap.a":"f2e1e86ce76b7aa86b93da35edf53d1811e8d52a10fe14de3c561d863834b116","lib/libwinapi_onecoreuap_downlevel-advapi32.a":"25951e37054b4a39380286855db8e8adc0faf7eaf77047129d9368fa195143d6","lib/libwinapi_onecoreuap_downlevel-apphelp.a":"08116313490555530b7b58cc3f830f95e0d8ae65dd645086be4dd379e97ca945","lib/libwinapi_onecoreuap_downlevel-comctl32.a":"86c35f513051d4f485822b57b0ff902738b818b6c6bdc1224c75db56d0a34225","lib/libwinapi_onecoreuap_downlevel-comdlg32.a":"b748579f6f3ab5976261d45247af5a3fa9295ac420d54c092cfbc97f7a207bd8","lib/libwinapi_onecoreuap_downlevel-d3d10.a":"bac5b376a858f0f2a4b95b21c44f251b114a767e58c09b8cf572fa66f93f31a3","lib/libwinapi_onecoreuap_downlevel-d3d9.a":"3824e7e31b12918efee786e170d200a1b920e19dae6a5d9e39c646cd8d3eb2c2","lib/libwinapi_onecoreuap_downlevel-d3dx10_47.a":"81e84968bdcce883ede84bad6d495bebc3303adb1ca7d70fed9e3d74c191413a","lib/libwinapi_onecoreuap_downlevel-difxapi.a":"1bfcf44f7098ba291c6899ea4bddb95ba2f7b0b93c4ad285bc83c7bef51e0243","lib/libwinapi_onecoreuap_downlevel-gdi32.a":"62fe9be7e7ccd0e47f415567240aa3fef909a6875145987c1ab4fc331a1e0106","lib/libwinapi_onecoreuap_downlevel-input.a":"fc7400b5de73bdb9f6bf313ef474b93364cddcdfeefae79d5eec744ccf6c20f6","lib/libwinapi_onecoreuap_downlevel-kernel32.a":"56bf726b936fd50ea3050f49eb1bbd156329b492b1dc9c843b1ffdda80a9057b","lib/libwinapi_onecoreuap_downlevel-msi.a":"d15452e3e099c2a5991c0b91760f4aac5eac944fe69f286bc3c63024826263f9","lib/libwinapi_onecoreuap_downlevel-newdev.a":"4210387641e4c1bc745ff9db429c1c572c81f8014cd4379bc00d8a1c6496bb10","lib/libwinapi_onecoreuap_downlevel-ole32.a":"e67f5790d85b1ee77263149e62a0f5b661b386c1da7f240058a4518354aa9edf","lib/libwinapi_onecoreuap_downlevel-oleacc.a":"ff9536113d3213fde19cbc9d0084fe031949d9705ed28a5338c5001f0401037c","lib/libwinapi_onecoreuap_downlevel-oleaut32.a":"2706f1dee8865df8adae8719b067b89ecbc974b5778c459c109cbc08162319bd","lib/libwinapi_onecoreuap_downlevel-oledlg.a":"eecb3aab1378d1c45d7e9aa7729e43c1b5717791770de9192230347cca902eb0","lib/libwinapi_onecoreuap_downlevel-pdh.a":"73820b4cc0348960c714080473696ceb67d89f0f570258ce93d52441e029b7a2","lib/libwinapi_onecoreuap_downlevel-psapi.a":"570746d0a825bdeaa71a7dfea67bb32657a27f5afe1624944750d209329c14c0","lib/libwinapi_onecoreuap_downlevel-resutils.a":"397de845de00297801c927c5d82d0b91bbcb2a0cda70066c817fbc5236123db9","lib/libwinapi_onecoreuap_downlevel-rstrtmgr.a":"827d5635d748a418dc1731ba057aa468725e907bfc9e60d6724adb1ce9bbd2c8","lib/libwinapi_onecoreuap_downlevel-secur32.a":"9a70ba1ced874cda827fe98af149b3d451adfb360c88c31862ed306a998f5f76","lib/libwinapi_onecoreuap_downlevel-setupapi.a":"0c82ad883260fef3f91ec1d7c2c5cb4677d26d091487fec4936f9f988462e720","lib/libwinapi_onecoreuap_downlevel-shell32.a":"bc7513e499984e3f43c2f9486f9ab68c9acb905e5f97bdfadb0f5ebbba1c4a46","lib/libwinapi_onecoreuap_downlevel-shlwapi.a":"e2b37f5820ac99c7532245623b5d16f5db7befb2e6b806070b80833ab74f1bd2","lib/libwinapi_onecoreuap_downlevel-tdh.a":"13dc97358c731f00d2a6ee35fa4cb0982b45dd4d2714048a4804d7f58e76a49d","lib/libwinapi_onecoreuap_downlevel-twinapi.a":"b86c1a5e36f38a9c0f31e682dc7f9fda58959ec0ed42cfeb9c566404c302d598","lib/libwinapi_onecoreuap_downlevel-user32.a":"c3179b1306b79d96f0b9b6c6c5626e17980514a87b805a4ccfc2857b187b92b3","lib/libwinapi_onecoreuap_downlevel-uxtheme.a":"7162baa362708a6f74d57bb41176537632aee62a1f21114e74e0d3137e28709b","lib/libwinapi_onecoreuap_downlevel-version.a":"250eb5e293a7615f14527959102ff12ba330964b81396d27c53c56231a955ed6","lib/libwinapi_onecoreuap_downlevel-winmm.a":"f5ada9831b7910c5a8242e24bd8cd212b522badfc4bfb264b703e0963a1225ae","lib/libwinapi_onecoreuap_downlevel-winspool.a":"f141ba828f5e27d4db6cb679d3bcdb27a558ee47ac1534b6ba89c199e776fd27","lib/libwinapi_onecoreuap_downlevel-wtsapi32.a":"5329f116b8eeb756c67230eb4a0e596d0a9e1ab0f13c934a0ba73f2dfb8debfd","lib/libwinapi_onecoreuap_downlevel-xinput1_4.a":"6608aab2240b67bb31862a6937f30a444f31d241ac7879db950903ea9a4dc946","lib/libwinapi_onecoreuap_downlevel.a":"27eea31922cb3fd8d246e99c301bc944cc7b533b4a7cbdf5df3576bce26f27a2","lib/libwinapi_opengl32.a":"a21d2c9027b5e12b0a301d91a342d1e0c4e09f1b17c0e9993516d6afbb8588bd","lib/libwinapi_p2p.a":"e326c9adf1a6a7463a07ab3d12d892b6e1742a68ba310bb0c79a3a3f15455336","lib/libwinapi_p2pgraph.a":"00450a6a4d2150ee58a953aff26c2aace3164774003634df2cc6cd4ed77d5917","lib/libwinapi_pathcch.a":"1afac1bcecb5829d4cdb6578781c90cd0df0e2bea8451eeae90530ef3d4572cc","lib/libwinapi_pdh.a":"d6c7f04fe2c3644b991b01158a2c4adfd7be1dbe92586a4f23a06399a6463d62","lib/libwinapi_peerdist.a":"8d76c8fdf7ce8ac440e870f58b41b6dcf40f76195f47dfe9af73dc56e14a9407","lib/libwinapi_powrprof.a":"229503fca740daf72ab00d667382ba9c7fece889e3cd1a71a3489acb75d72ddd","lib/libwinapi_prntvpt.a":"9ebba37677a82b045e82158a83c97b9f0e85c35b22d4685d56d39aa39c2b6d0c","lib/libwinapi_propsys.a":"772ef5cdd2543d6154e5ccd3e0e56238418cc26439668129a89a08018d07d323","lib/libwinapi_psapi.a":"6229c9845a705e1cf162d4d4c7d1c6963ed6984699295956e98c4c1387547328","lib/libwinapi_quartz.a":"e696d2cd3294d2440bbab92718f63af882414f7cb1df2b5a9e13a8900f327e76","lib/libwinapi_query.a":"f7db7da06e63f535f0af57a9b45e8d15c366b362afac56177765c137f46bdaa5","lib/libwinapi_qwave.a":"5454630cdf31cdd56e607f2c7bff2bba2d24ba2e00e0195e334418a7108e6f83","lib/libwinapi_rasapi32.a":"c4fac15981c0415e61104ee04de7a020735fb1ae53e684a7ced3f4be3ed95928","lib/libwinapi_rasdlg.a":"ed56000994e9e730e3926719d077e5882c316ddb440326ef7fbd77739a3f6c35","lib/libwinapi_resutils.a":"0dc8ca17810cc24f67330e7a60884a5603eac4b2701c3d7145e72ce26063523f","lib/libwinapi_rometadata.a":"112b0138a0d51f185ad2c8d7a996a96407b43509137223b9c09bf564df8d8990","lib/libwinapi_rpcexts.a":"b6ede0532c9e73afff9f4671c3047a33d43491088be0f65a9180f1e37641cec3","lib/libwinapi_rpcns4.a":"37c556274e43e069010547feecd4aabda21dba5d4ebc6ac44f8181bc72c082db","lib/libwinapi_rpcproxy.a":"081bebf46536fcc39e5a3502271c699f6954ed73ef5df0039f21b198053403b0","lib/libwinapi_rpcrt4.a":"ffa2d37f78b279cb94983f4b5bcf119b2eafc0b0eec6e454b3d314ccd79e58ea","lib/libwinapi_rstrtmgr.a":"628be186aafdaa96bc203f45a5c5f44418158886522fe48fc1c58ca2c11b1615","lib/libwinapi_rtm.a":"8e7d04db58dbb4e482fd83fb704afb44f79bb306a2671bb1cf795d75badeb52e","lib/libwinapi_rtutils.a":"4192a21edf7cbc36c094a91ad176e380ec7bd678419be3d2bc82a417485f559b","lib/libwinapi_rtworkq.a":"cf81238e5438972bee626c9a220c037f0fea65b13ab364617c35f00a2623a61a","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-error-l1-1-0.a":"c4e388681f040fbe1ab6553fb23004b647b5cf6162b41e2d00976a033d1288c2","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-error-l1-1-1.a":"1cb7108bd745cb6976f17119a2a4cf7c6e394aacb041946e9392185919589043","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-l1-1-0.a":"ea568779a9686d229b704fc0b55b09c01d231474bba2e3da89f0ac984f5c925e","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-registration-l1-1-0.a":"3ab533f82dc0809199c2f5832c4990479dd318595db52ffd6454b4163efc043c","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-robuffer-l1-1-0.a":"7a072baf8e59a84da283db866eae3759fd5b7b189b95c6fd9ddef1fc09b29b4d","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"d99870cde4fc641fe7fa82d9407cdf545c8418be12fc8a23c743970efbd8a458","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-string-l1-1-0.a":"e0a04ed845ee40af3ed6dafb8ccd6d5a4a02b62cb3fe711244c245482b168769","lib/libwinapi_runtimeobject-api-ms-win-ro-typeresolution-l1-1-0.a":"0374718fe78077f795409e34ddd72ecd859531db0b8299e32fca799133cdc611","lib/libwinapi_runtimeobject.a":"72696bdf24b57c25bb32bd8c4d2673625b5c7ee72c7933e4b95f907198b85b55","lib/libwinapi_samlib.a":"60d825306f7f501eec0c814dd5083f25cdd60eea31557a158708861ce87cd9fc","lib/libwinapi_samsrv.a":"7fe3c2d10a98985f2798360f4e54dd8acf4f0cc6c595f41b6b9c349669eaf3e2","lib/libwinapi_sas.a":"671ce72d72339636993a558b07c77706a99ffa568fb9146a93dfd08c1afb79fc","lib/libwinapi_scarddlg.a":"067d27d48528d706acb69b3c5c65f54350ff60c4aba6dadd15a84ec073e5225d","lib/libwinapi_scecli.a":"6ee7ee37fe3b701239a7fd68a251926e436dcce30738911096c023923f7a5fec","lib/libwinapi_scesrv.a":"506ad42e7752933622d402b9f2a93b2df9594e72803e0b5a3d0fa59408b998e6","lib/libwinapi_schannel.a":"191033c5eba0a29d3fede1a466cce4d2e5f7ab092b26405996e4305e33e14556","lib/libwinapi_secur32.a":"da204b8aeafe5d279a7a0a0951525685316cbb9a42055d129e2e245e10b65ec1","lib/libwinapi_security.a":"1be744253e860d65ccc2e692b572b7049b86d9211a7605da32ba6d3c64519a1a","lib/libwinapi_sens.a":"693fe45c5e369acc65b45b4a9674b766e1a898169791ede962c0995e532dce3e","lib/libwinapi_sensapi.a":"4f0596c3eed566208b21900679770ad1efb8eb566f5537feb31d68d43a15bf79","lib/libwinapi_sensorsutils.a":"2ba2441022e5ec201e4241cab6231441576ec078039052a75c4e10fbe2e0fe3a","lib/libwinapi_setupapi.a":"063417b0069302c187ede7df0f60b230941d4689addcfc0485795aeda5dedd18","lib/libwinapi_sfc.a":"1e78e5a5d401237b38560a9ff6b1a8533d6090c8b3d215d81e049477698e2520","lib/libwinapi_shcore-api-ms-win-core-featurestaging-l1-1-0.a":"98344bc027a9dd80dbf08a575dd1b6fc97d97e02c539c1e20f22c757a68504eb","lib/libwinapi_shcore-api-ms-win-core-featurestaging-l1-1-1.a":"04c2e6d47229324177b05cbd600190d5b2abf3ed228ee6e03fafef2db892e7b1","lib/libwinapi_shcore-api-ms-win-shcore-scaling-l1-1-0.a":"19eef865f78baddb60fc1f47289df74a07b72083d28ca68b85941c99ca550c80","lib/libwinapi_shcore-api-ms-win-shcore-scaling-l1-1-1.a":"e166a6ec67a36b3f2918be018977a8159b8635491b55605cb5dd3167386d7e8a","lib/libwinapi_shcore-api-ms-win-shcore-scaling-l1-1-2.a":"adf03c5853efb9b41d617cec9ebce4078cde77070c0bc2b3d325afd335a7fc6a","lib/libwinapi_shcore-api-ms-win-shcore-stream-winrt-l1-1-0.a":"632993df8e26c359cc5204b9e8daa13387a0aec8764f17556e41967550e4dc4b","lib/libwinapi_shcore.a":"0aae36b16b6c0fdba17f39f73cfae64d856ba9aaa06b4f1fca2437aa11c1c4c5","lib/libwinapi_shdocvw.a":"4bc14620d0cbe176991915bff0860601f62fa19fd08799b577eadf8b7587fdf6","lib/libwinapi_shell32.a":"8986ca544482cb3fa6fa4dbd0fbfa0fbd675d84623b902a6b107ff6983d0be74","lib/libwinapi_shfolder.a":"40b4ef0df707e9fe84490a5517b397bbf35df2f11845c00fd65ea5ebe327e0af","lib/libwinapi_shlwapi.a":"56f5b4b9aa857e7e2abec5e29e90cb604c30e0e378a217f5c63d0749ace2c378","lib/libwinapi_slc.a":"d1e968e1e2cd1f5517a0cb292d1bed0de352c3eb7f08a03bc256b6c9898bffde","lib/libwinapi_slcext.a":"3f435fb66d862b437381e155de17116bd25dfc3cdabbbb979e52e9f17eafcf6b","lib/libwinapi_slwga.a":"0daa0bb484b78fda78b198b0a1fe8e1ff01f2103155fb96396f76735540a392d","lib/libwinapi_snmpapi.a":"5fb36e79337358e343d2691a27e04e47b584c21869da9c4ea0cc04fecb851b4b","lib/libwinapi_spoolss.a":"4728dabac3364039ff2b3df5be911003ba6074b4022127f72b86b6d6bf792a3e","lib/libwinapi_sporder.a":"33bfc4229b72197bb74020eca4ccde0770512deb3eac0fb814cda40203969473","lib/libwinapi_srpapi.a":"2d074a6570ac4994014d7aa4f84f22353340541bdacb0d2033cea4fcac7d9f71","lib/libwinapi_ssdpapi.a":"2186218218995a2454dc5ffea0a3949f97dd4faad038ad2f22e09ad93e8e152e","lib/libwinapi_sti.a":"42835149c10ef8bb50e7e562af45009551003fc127278e9218d624d86a1ffc33","lib/libwinapi_swdevice.a":"16fa5d455edc79db45808633411d6eae89f65b6da1f99f775fb8c26e9edaa120","lib/libwinapi_synchronization.a":"46e1da98de3f92e2b8cf7d135e35978c418d4887080a4848a047eda81703c4ab","lib/libwinapi_t2embed.a":"f538b7f0a9add3796fa6bc18651c926c7ba0746f10d806f579cb98e734070d70","lib/libwinapi_tapi32.a":"bbc8dc40668a19af85e1782de0e994a55b2e2f4d3b073b75a687be4240448856","lib/libwinapi_tbs.a":"8bc36c289fcaf79f4c49ce8f10c28eb1e363c3ef63c6994b139b7c1ba95763b0","lib/libwinapi_tdh.a":"0dbd6204b039e117793145a6fbaed7109caa57fff41cec835977491ec280b538","lib/libwinapi_thunk32.a":"fdc3b4eaaf945bacdb88cbe5666c8717a0348f041858cad0f15d31d7bd83b6cc","lib/libwinapi_tokenbinding.a":"2067fb7f60368fe9ba420f13d508601e8c94e1c2abb5c7b831508fc54255e057","lib/libwinapi_traffic.a":"425d4da6b2df282bd8d0ca1e9626e419b2bc12d29e577bb3dc5a15dd1ddb9053","lib/libwinapi_tsec.a":"39071d6abdf019105c61f85eca91d578d2a0d480282856668ef0d62dcb12d9e1","lib/libwinapi_twain_32.a":"78d7b81b0353e749c36bcc8c07b3f4d1680f55fc43ee949d5ab84461f9ccbb14","lib/libwinapi_txfw32.a":"5e79373cfb16e47823a157305ca001420ba1f2f4cab5f52a79b71a3e93985c91","lib/libwinapi_ualapi.a":"48a778d2a2197f1921207badb2b07b6051e5ef2965dc816dc469b94eefe5044b","lib/libwinapi_uiautomationcore.a":"2247d182ec3eb1dc784f54c1bda305f9940b449047ab3c43f0dfddd308a22059","lib/libwinapi_umpdddi.a":"535ca1121764955e8c528ad0c8642d4c357afa5fa0ba28dbaf5e03cf5c60ddc5","lib/libwinapi_urlmon.a":"55be74bd0f8384c0bf84527cbb8b27601dc45b7c423809bc52760b729a5f86ef","lib/libwinapi_user32.a":"9d218297f1a130912c318391d3b159a487e6650c524aeff4656f4ac702dab2fc","lib/libwinapi_userenv.a":"8ff2850ba4437cd5fcf879d1dfcc9cbc5aef50ef205d9d397dd1a4700ae210da","lib/libwinapi_usp10.a":"e223cdb9e7a913eb3bc038f1a963c2cb4c669b084828bcf92539bd0595b62fde","lib/libwinapi_uxtheme.a":"d622c584adad49beeffe2d2641b72a31065340b16c16687cde46e7c41ac67b5f","lib/libwinapi_vdmdbg.a":"4f9390d8cda1b21a470724f85312e92a39edd5038621c0a1f051f2e83d776a7c","lib/libwinapi_version.a":"af226c499d3ec2f3aa9c128554b1a10a1d2c3658322f3137be0a5d4505d28c9a","lib/libwinapi_vfw32-avicap32.a":"516f00894b2cd61dc26b8a5d5ea59cbdf93c66a471f5aa5ab035d9629f187401","lib/libwinapi_vfw32-avifil32.a":"c356e4a74fbdc381143c6b84dc3edd117c43ad11b324d48619a40ab05e406b94","lib/libwinapi_vfw32-msvfw32.a":"4a3d662b600beddb1f973fea167e804965e1dd5cacb52a1433e1356e0418673d","lib/libwinapi_vfw32.a":"1f7bf15b2c0d637ef6a424ea0173f26d9adabb2bfbcc5711a95b408e060a7d96","lib/libwinapi_virtdisk.a":"f1e7237e523eef73b73cab8c7f9ee40b3df68f3003fd39dab9fb8bfd6d9a54bd","lib/libwinapi_vssapi.a":"0e0cbbeae26ab962bb1b7e738049e1b6d5cacafa01026aea553a37496bfd91fa","lib/libwinapi_wcmapi.a":"6d2f7593ba8c626b50f76072f07e1a49c249b14a3a8444e49d1932e2bad33f88","lib/libwinapi_wdsbp.a":"e904217b4f2b189b2d4cb2ef8f64896812e8a856ae3cb4eface35f1e38d3854d","lib/libwinapi_wdsclientapi.a":"47e5fcbbba5ad750586d102985f1f67cae7e7360fca331cbc866fff05ecebc00","lib/libwinapi_wdsmc.a":"97277aa23d70ff2b7d5d2f0ffbd70e6dabbe48d53fce30504a5176d6940d958e","lib/libwinapi_wdspxe.a":"a0668a171b4930c900c321d1d9d11e968fa4b2de32d36fa4238af8ebeeaf855f","lib/libwinapi_wdstptc.a":"ecd1ec06a48e3b98266d99a88797801a75bdc14956f92df90ec2d934d234fad4","lib/libwinapi_webservices.a":"889091e71202e8448edfaa7b02b299e9ffa8641635410eb85d41d4a41c592b59","lib/libwinapi_websocket.a":"b6d9f28c222fe4593b2587e95ab5f21a55ff16f96988a7843281b1d56548b105","lib/libwinapi_wecapi.a":"b206762c19af9ae83c0776754405b364f1aecc659d063b82f0f85a90e9ec39a2","lib/libwinapi_wer.a":"e69b6439516ddea86a7957de563719bc7a7e0794b70733659aed29d835ed26f1","lib/libwinapi_wevtapi.a":"da8dabe5e4a11e6a467c6b42c0bd193a7e097a2ff91c3b3743df8143e24dfe05","lib/libwinapi_wiaservc.a":"98af80f5e16013bc1f4a3da5a58debd00b879885d92a5c0fc90029229d20dd70","lib/libwinapi_winbio.a":"2f6275f01c300f097331fd3df333641453d855ec56d4cdf26586bd69b258bcfb","lib/libwinapi_windows.data.pdf.a":"78fc20ab685d930e28e113c2f26b8d8f137956d00c7a8406686543387a0a5dee","lib/libwinapi_windows.networking.a":"8e3c12ab2e0014c62c1d628fedf1fd2d7a5199a5b0324afb8d7c5715725ed59c","lib/libwinapi_windows.ui.a":"bd1c725946cabc374fdf6640c9e23550c05ec4309150e7cc7446cd13cddeff32","lib/libwinapi_windowsapp-api-ms-win-appmodel-runtime-l1-1-0.a":"c5b0f910c4f44a2b4ccbc4f1e5e7fe61441f3035c0f654b71022c3be347f1744","lib/libwinapi_windowsapp-api-ms-win-appmodel-runtime-l1-1-1.a":"921b323d3e681629b679b7afc1c83fd1c4cf8dd7b7331c59bbcaae5e42545b99","lib/libwinapi_windowsapp-api-ms-win-core-com-l1-1-0.a":"d2677e3f095cc9b75de682c89ad058e3030ed6d572b3d4d173d8a2280ef7728b","lib/libwinapi_windowsapp-api-ms-win-core-com-l1-1-1.a":"747263417baca3be11cd9746ecdc4a5204bae67f4e18bcb01989cd8fbcef33e4","lib/libwinapi_windowsapp-api-ms-win-core-com-l2-1-1.a":"8911d4bef439812de4e56f48f6a1e7fb45f345d0d165ac73e37a396675886e7e","lib/libwinapi_windowsapp-api-ms-win-core-com-midlproxystub-l1-1-0.a":"3887370abb1c93d8086c19b79e64a20be3fd0cbe0cd18e521932a66dd29991e4","lib/libwinapi_windowsapp-api-ms-win-core-comm-l1-1-0.a":"0fed3d2349d58b01779bdccb151389118c253fc3788eb22da84e74d4f7fe1659","lib/libwinapi_windowsapp-api-ms-win-core-comm-l1-1-1.a":"79a9cc1cfc7e68b9d5fa2413887dbaa06b174c63bf70445803f9f4edbccaa5d6","lib/libwinapi_windowsapp-api-ms-win-core-console-l1-1-0.a":"19490ac714cb91b47a0675babc6fb04b89917643fcbe748263dfb292fb3d2afa","lib/libwinapi_windowsapp-api-ms-win-core-console-l2-1-0.a":"b7df6615a287a325a92d6aeee71b8900e56b366a06f34653be04a20803e08b68","lib/libwinapi_windowsapp-api-ms-win-core-datetime-l1-1-1.a":"ef8097217b975f461e84bc49c995421e4655fa5905f45fd6ffab5b66a0a23e50","lib/libwinapi_windowsapp-api-ms-win-core-datetime-l1-1-2.a":"35f73c31046c03d050648d08d33448ae03df778fbfa209fdace98e0881a97998","lib/libwinapi_windowsapp-api-ms-win-core-debug-l1-1-0.a":"9b84a711d2f9062a84a8ae10847fc6dbb55a43fef4aae5bf822513d8e86995a0","lib/libwinapi_windowsapp-api-ms-win-core-delayload-l1-1-0.a":"0ea1333d7f77f97935d48cf5310fc09e21761a6bbe2ca16bf83884ab8bfabb75","lib/libwinapi_windowsapp-api-ms-win-core-delayload-l1-1-1.a":"61bd430910acb86c226ef8f25922ed18e181f5ea3961e8d437199de0b93c27d2","lib/libwinapi_windowsapp-api-ms-win-core-enclave-l1-1-0.a":"aae4fc49d326bcf224af545c5acc2ca73a882ee99823c010c2ce7fa4f3463934","lib/libwinapi_windowsapp-api-ms-win-core-errorhandling-l1-1-0.a":"b91bd32bb31b3bbc11d7879afbfa3835fb9e37dd95eb3a70aeecd5d5b3fb88e8","lib/libwinapi_windowsapp-api-ms-win-core-errorhandling-l1-1-2.a":"c7800772191799c701373b1057abef0884ad2b35d6361870c319a1929b579ca7","lib/libwinapi_windowsapp-api-ms-win-core-errorhandling-l1-1-3.a":"f7af10fa4da9fb9784d46078d3358caed4e5fb076a4f9e4b87faf4d69d1b1f2a","lib/libwinapi_windowsapp-api-ms-win-core-featurestaging-l1-1-0.a":"1dd99452503b5ae1b1887e6d3f4fb83b33ecd3d782a65acd776aefb208d98aa8","lib/libwinapi_windowsapp-api-ms-win-core-featurestaging-l1-1-1.a":"c106369ed8b7893b66af9822394181cab93cd05323bf770a6d6f21e4cf61f22e","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l1-1-0.a":"30fca3d3c91ecba19fdfa03c07f1d0b34011c032b0f8fe4d35d6a26981a7280b","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l1-1-1.a":"62fec7d91958134636b0eb473d0606709a222567c7c23c3661aea9b014d84d06","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l2-1-0.a":"0aa99edd2c9ccfe972b8433a8d1489563ebc573524af956332257fabd8a9c162","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l2-1-1.a":"29990a25dc42702f3b0cb7de68616c1d95bccb352c2438e7a1fa659f0056fd4c","lib/libwinapi_windowsapp-api-ms-win-core-file-ansi-l1-1-0.a":"4e3ad6c8b2c40e3fc18fbbf50ddac70e4dcbf8384def7004212eb1082aa717ab","lib/libwinapi_windowsapp-api-ms-win-core-file-ansi-l2-1-0.a":"a88c1593ae4c736332b59c35d4706f08f5a3a723234f13ccf1b88e4c1f4c573f","lib/libwinapi_windowsapp-api-ms-win-core-file-l1-1-0.a":"f79d009d3d96ec1e6141c366eab82ec9b2393a9a53d24573da11f92bdb64d8e1","lib/libwinapi_windowsapp-api-ms-win-core-file-l1-2-0.a":"cb43ae3737d19690c7590deaaec247296b4619e297d0f10a3c675cdbfb5b0b14","lib/libwinapi_windowsapp-api-ms-win-core-file-l1-2-2.a":"ec97314860cb28f6ac8e1c86be3d792753654b95cb97c01382719114e6bed03c","lib/libwinapi_windowsapp-api-ms-win-core-file-l2-1-0.a":"1b901ed918a4185500efd56d6b256f6ac1f533b95588e8bd91d039cc901dd8d8","lib/libwinapi_windowsapp-api-ms-win-core-file-l2-1-2.a":"c193e49f907ed28eadf228f1eec4f87f94ff1ded7aea62f7971ce400d9410c02","lib/libwinapi_windowsapp-api-ms-win-core-handle-l1-1-0.a":"c8965920439c950f8f5aa10d96fb47dabce00cfb583771ba3a004dcf81339d2f","lib/libwinapi_windowsapp-api-ms-win-core-heap-l1-1-0.a":"97bc9f0aabb84ac3d4f1eaccb2611ebc4c4e641057ae321823fce5bab135bb24","lib/libwinapi_windowsapp-api-ms-win-core-heap-l2-1-0.a":"f6653db4e2db6cdcf3dd5c67378a4960585b4f9d2d756d37bde43493030d6dde","lib/libwinapi_windowsapp-api-ms-win-core-heap-obsolete-l1-1-0.a":"6e0c202293a3a4d82db8e7761b3be4873934e23be1cbb5ca034e16a9c5a95516","lib/libwinapi_windowsapp-api-ms-win-core-interlocked-l1-1-0.a":"0db40d463c43faf20da093c8adf7bcfc694d60ad39c703840bb3dfe41d87d867","lib/libwinapi_windowsapp-api-ms-win-core-interlocked-l1-2-0.a":"4249e889356ddb2e03c71847d5a279aa9d55ab71c33af0841a174396df75c70b","lib/libwinapi_windowsapp-api-ms-win-core-io-l1-1-0.a":"139c4d1d6d7701c92c7235212ea18d8d41e3c80814d0009e7d2208456e19d88d","lib/libwinapi_windowsapp-api-ms-win-core-io-l1-1-1.a":"5b3679ae87db26dcfd813fba6e7219127e0be4164174e767dea31344dc7ab2fe","lib/libwinapi_windowsapp-api-ms-win-core-kernel32-legacy-ansi-l1-1-0.a":"ae2f6723973befc952038c82c5ecf1ab298a12d5a67e42cbe412ecd2cc3cb237","lib/libwinapi_windowsapp-api-ms-win-core-kernel32-legacy-l1-1-0.a":"bcc7ff242a65f295251e799c3981ad9ecfffa94122bc5acfb806f12368dbdfb9","lib/libwinapi_windowsapp-api-ms-win-core-largeinteger-l1-1-0.a":"7c95358ed9d08491fe9b4dcc2abe44f33a32731152aebf85600908b817aa5cdd","lib/libwinapi_windowsapp-api-ms-win-core-libraryloader-l1-2-0.a":"5f13a5baf504172298384a4f5894c4f015181c05cff13e7649b6d91709abc173","lib/libwinapi_windowsapp-api-ms-win-core-libraryloader-l2-1-0.a":"efc29ecfc1c177eae1b371304d809cd4c04e8c882bc9e8517315cc3024ca559d","lib/libwinapi_windowsapp-api-ms-win-core-localization-ansi-l1-1-0.a":"84a3683b612de399923e1ca199f504c5b6f07724ba1eb7cf31629a0ecf124b20","lib/libwinapi_windowsapp-api-ms-win-core-localization-l1-2-0.a":"70a9205a700f6f4692b76897a4b2af9d962b2bef4f8985a3f8d497d3fcb42df3","lib/libwinapi_windowsapp-api-ms-win-core-localization-l1-2-1.a":"5d6da3f78c52fc78b6e0e38202e7d0a14337c4e9645fcc1409d6fa8a284c340b","lib/libwinapi_windowsapp-api-ms-win-core-localization-l1-2-2.a":"dd10409d20098123b9ce8cbed2b84cd80422e7c915cc6aa558f9159918e68c25","lib/libwinapi_windowsapp-api-ms-win-core-localization-l2-1-0.a":"9477d17fd1a7fa542469845ea465551f48208d1e7a20508772eec708127171a8","lib/libwinapi_windowsapp-api-ms-win-core-localization-obsolete-l1-2-0.a":"c6aa11d3471a2ac848e7f4cd166aa5c27ec40a8ee236a3041819ab95860c5ff3","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-0.a":"ff78df5353763aadbab865dc35fb8d341108934ecb836e4aeed6d6ed239051ed","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-1.a":"cb79f0638f79e94417b9260b05a511dff38a65484662facff84b90c3ab944dba","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-2.a":"c6af86f6b2d53ad5e919598485e76db5c573b1723c8e8aeafd987669d83a1be0","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-3.a":"04954fbf299df7f7a82afdfd43de1c38f3570a0e418a5d2bd15fb468641e3da8","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-ansi-l1-1-0.a":"7390ed65bd34f830f34193e07a47a3386f2ea786adc752e9af9e667b3eae566d","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-ansi-l1-1-1.a":"3e7d32bfe57a7abc58a6bab31ebfdb2135583a08779038169ae953b379813a21","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-l1-1-0.a":"fec51f0b6ccf8fff21613039a69d7521e6086cfcaae762a8e5eef8ac8cccfcb9","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-l1-2-1.a":"8de55da9f36c953a8eadd98ddbf1de68b6be21800117f5d81cd94ead505f9bc6","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-l1-2-2.a":"22c4a7796605757145ce1ad6346f80d34f2b85ba948b6f7cf099cf8034a044e2","lib/libwinapi_windowsapp-api-ms-win-core-namespace-ansi-l1-1-0.a":"abeec4e5001de5abaf99087505ad1d9db334f216d6b6f0a086f949705607aa18","lib/libwinapi_windowsapp-api-ms-win-core-namespace-l1-1-0.a":"2a27d24879f73c7cf97f062d62948f92d3481cd3328af42f50fe3b9fd4593424","lib/libwinapi_windowsapp-api-ms-win-core-normalization-l1-1-0.a":"9e39a5fd470276e47d539c8363e41a2990a1177b7ef50ffc8572a8901bab2daf","lib/libwinapi_windowsapp-api-ms-win-core-path-l1-1-0.a":"9ad56c85293c2b75a8bf6f7bbc27d20cddfaf4a7f4a1864b572963717d0af10d","lib/libwinapi_windowsapp-api-ms-win-core-processenvironment-l1-1-0.a":"dd1dbd548a66b9544931f37af2bbe883360de543ba2682e0a252308127ad16a0","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-0.a":"fb9f08901b2f4bd4788054ed67a5802a16b449a7ae7c8bdcef99e7baaf78958d","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-1.a":"a5639c7a442b6832cd55097454a35c011204919e903e69d951d959b53dcde57e","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-2.a":"b096b4581ece69959a8d5ebfd72fd0dfb036653f9710ad2de49952418a2769b2","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-3.a":"68a523bb89aa76d957a6273bd8cd3e74ae272663086125f6596d87b54f73579c","lib/libwinapi_windowsapp-api-ms-win-core-processtopology-obsolete-l1-1-0.a":"cdc0393343eb169ef12f81fa31beb0351656dc915c93b8f23e27f08b8a1c11d5","lib/libwinapi_windowsapp-api-ms-win-core-profile-l1-1-0.a":"9316cdffcbf672f173d567f7a92d2466824140c7eb2384953107d81d3c3f348d","lib/libwinapi_windowsapp-api-ms-win-core-psapi-ansi-l1-1-0.a":"301062e0fb6842804778b03340600c8ec456b88c5556926d493d8a04d5596d1b","lib/libwinapi_windowsapp-api-ms-win-core-psapi-l1-1-0.a":"dddea56f7b9ce98346e62d212732813f2cb1814e55bd46b1a9590f012c9655d0","lib/libwinapi_windowsapp-api-ms-win-core-psm-appnotify-l1-1-0.a":"e09456eb053d27e437f93b6cce33e53ee84235ec4bd178eede7183f914b23bbc","lib/libwinapi_windowsapp-api-ms-win-core-realtime-l1-1-0.a":"ea4282c8e630531123f26680eeb0106e47151a8cc3eed133fd287579d0d6187b","lib/libwinapi_windowsapp-api-ms-win-core-realtime-l1-1-1.a":"560b6d11f2bdc6cac22e1a48898c0715fa5f115fdf7ec968431fcc079fc0378c","lib/libwinapi_windowsapp-api-ms-win-core-realtime-l1-1-2.a":"b1afb018e3339b40964c892a60ad60420f3be0ed09c9e881c38e4e51c0c80d8c","lib/libwinapi_windowsapp-api-ms-win-core-rtlsupport-l1-1-0.a":"8b680a4624d674a535b8c2c15a0ffda9e8895b5c8d166ba96dfe4c8a480c9705","lib/libwinapi_windowsapp-api-ms-win-core-rtlsupport-l1-2-0.a":"c3620f180a6f35812cea5cfac3b7de6a539220622a45b1b3e9142bc4ae3067f3","lib/libwinapi_windowsapp-api-ms-win-core-slapi-l1-1-0.a":"29e9e940b3a2734479127e3ea4ab5d802cd8247fb203ed8524331e238ad788f6","lib/libwinapi_windowsapp-api-ms-win-core-string-l1-1-0.a":"0e00bce3914402e978d4b002b7a97fb2088cc22777541cf57a4709d75d619279","lib/libwinapi_windowsapp-api-ms-win-core-synch-ansi-l1-1-0.a":"aa18983363e672d6ba0e02edca860ec3e49327890920590fa84afa41cfadc966","lib/libwinapi_windowsapp-api-ms-win-core-synch-l1-1-0.a":"a4fa5e25373c7c20b4055cce63617dc5b55088fe3b791b956c66bd962dde002c","lib/libwinapi_windowsapp-api-ms-win-core-synch-l1-2-0.a":"e3339a7e092b42f837b920bd9bdbe925c2aa96524bade80249122090b93aab26","lib/libwinapi_windowsapp-api-ms-win-core-synch-l1-2-1.a":"2a61c5c41d4f8bd0a1b2a018bb598b4105694b234cb779dd043d2b6f001fee64","lib/libwinapi_windowsapp-api-ms-win-core-sysinfo-l1-1-0.a":"07921deba9927172e88c9d7d247fafd36a80bfc3d7f56ca50e75494945b7387c","lib/libwinapi_windowsapp-api-ms-win-core-sysinfo-l1-2-0.a":"8ef0f417775f5f71aad900bf1d88428135e78dcc2453119a13e8276940172a91","lib/libwinapi_windowsapp-api-ms-win-core-sysinfo-l1-2-3.a":"3f77471cc4f5d6236f05afdd38d3aaec2537c73c0f77ae656a733d972c092bd2","lib/libwinapi_windowsapp-api-ms-win-core-threadpool-l1-2-0.a":"245f6cc49e7f28d23621cddde69613d08fcc3e9cdcb0f30f7bebb7f50a274601","lib/libwinapi_windowsapp-api-ms-win-core-timezone-l1-1-0.a":"3584394f9ee238a7b232e129f3761f48ed6dc08a1357840960b18dac87915e81","lib/libwinapi_windowsapp-api-ms-win-core-url-l1-1-0.a":"c93ba0c9b773af99e804414ae0cd5669edcd6d871c4422083586143a05694e6f","lib/libwinapi_windowsapp-api-ms-win-core-util-l1-1-0.a":"186cf4a8e6c5f48844488ef3e55b8b971fc487a4cae5f9f4306a36a384c31831","lib/libwinapi_windowsapp-api-ms-win-core-version-l1-1-0.a":"ea2abf3263cab4a37afe88804808c52e24f25a39bead22213448d383816bcf48","lib/libwinapi_windowsapp-api-ms-win-core-versionansi-l1-1-0.a":"e3a25f12131eb8efbbde17a6957b6ac91db0f218f81012bfb579c3491e600cd5","lib/libwinapi_windowsapp-api-ms-win-core-windowsceip-l1-1-0.a":"788f5b224086241ef514a46acd048402c26d0248ba010e5751b4dbf2739fbabc","lib/libwinapi_windowsapp-api-ms-win-core-windowserrorreporting-l1-1-0.a":"d70660ee6f87669d5a5be3d30498a0f8db90d47e213ef4673c9b22489aa8b8e3","lib/libwinapi_windowsapp-api-ms-win-core-windowserrorreporting-l1-1-1.a":"792d5c8d2f043151c658a150a2275243ad6f01eea274dbcd13c811cbd74fa023","lib/libwinapi_windowsapp-api-ms-win-core-windowserrorreporting-l1-1-2.a":"aedb7ca0091ecbf259e56a8ebcc191390b8a2751d6421f887f39d00522ef7348","lib/libwinapi_windowsapp-api-ms-win-core-winrt-error-l1-1-0.a":"992628a35f6cdc4e80e85b4994f0def4c4faf5b9e4065d66c180e903bfe99f69","lib/libwinapi_windowsapp-api-ms-win-core-winrt-error-l1-1-1.a":"f47f0a3c6ccf57afb975dd87be54d9a084d3758fb719f443e759bf0ae26f5be3","lib/libwinapi_windowsapp-api-ms-win-core-winrt-l1-1-0.a":"164925079d2aa31bc8d188ef464d5acaa04f557558ad227002d5ea3142498411","lib/libwinapi_windowsapp-api-ms-win-core-winrt-registration-l1-1-0.a":"abf0c280fcfd0e0a4bad6242e7684e80fbfa72aa663481a116f9b1f9b3cf2ea8","lib/libwinapi_windowsapp-api-ms-win-core-winrt-robuffer-l1-1-0.a":"c4f3a9e897910b6a82605e83d186294172f235db39364d22b82694f609d37e17","lib/libwinapi_windowsapp-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"dff3886a90efc4b7ed3c9c70b00353a882005e26129bb19c115ca010ebc68ff8","lib/libwinapi_windowsapp-api-ms-win-core-winrt-string-l1-1-0.a":"a1a4c84bc894e63abef803b40aaad5e5893fc3eb270e943fcefcb4eb386f5b56","lib/libwinapi_windowsapp-api-ms-win-core-wow64-l1-1-0.a":"683ecee0f94d0c6b85b8a378575bf0fdf51a6c0c6c69d3fa862beb847868b13a","lib/libwinapi_windowsapp-api-ms-win-core-xstate-l2-1-0.a":"3642f35e4c5a55deda3a44986e2481d27b3d9e546ee8950ec27c3122840556ab","lib/libwinapi_windowsapp-api-ms-win-eventing-classicprovider-l1-1-0.a":"e4043cd19d71c8a127fe349f024f8d61c3e73184bfc24c0826797aa94b5707d3","lib/libwinapi_windowsapp-api-ms-win-eventing-consumer-l1-1-0.a":"6e2ab9f1b1530861419b0e33f5f3d668248d86bebc9e0c4f2245f8d3834053e8","lib/libwinapi_windowsapp-api-ms-win-eventing-controller-l1-1-0.a":"b527178f285e0cb4697239812bd440550c256a283bd748c2cb410fae2adf0f92","lib/libwinapi_windowsapp-api-ms-win-eventing-legacy-l1-1-0.a":"3014d8d9ded6a717b207db72a80c6fc1f1b3f1f3f3f29c876da8771d43dd00c9","lib/libwinapi_windowsapp-api-ms-win-eventing-provider-l1-1-0.a":"e5944795e4f2884876ad23d27f91219357f10c7487dd814f93ea4b28c0f220ea","lib/libwinapi_windowsapp-api-ms-win-gaming-deviceinformation-l1-1-0.a":"05ee4a354736be759019d34b80abaacdd3e5f0baead949283ebb7568ab337e0f","lib/libwinapi_windowsapp-api-ms-win-gaming-expandedresources-l1-1-0.a":"16496885611e587698b8e92908770c4cd2554a0b9e69a7c813a27c907ff15aca","lib/libwinapi_windowsapp-api-ms-win-gaming-gamemonitor-l1-1-0.a":"38a138b8bc2778de5f9dec25b0a617a58de6c1edf0aaeb03255c21fa694b291b","lib/libwinapi_windowsapp-api-ms-win-gaming-gamemonitor-l1-1-1.a":"7be997fc4193df0e92a143c5059093518215f294c3c8c32860834f9acc39511f","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-0.a":"81a29ddddfa1ae233ee03e8f8155a30291730d2cc6d3eb2df735026efb199c7e","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-1.a":"057258f17e45d83448ed3bf0f4dcf0c6b8f41b6f935e05595ca8e92da5b1e5c8","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-2.a":"ea2d90390134f09f9fdb25db1a912cc386b7e3b7cb9cd97ecf2570624f54dc6d","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-3.a":"03f6c50bc09e454a5988aa1e42eddf3efc8eb8024332feb02b066940b142a193","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-4.a":"68142802477c61b59281344bc37a8f9ad74c2c3af99f3043b214ffea1751b0a5","lib/libwinapi_windowsapp-api-ms-win-ro-typeresolution-l1-1-0.a":"a823078b3d1fc528b7950b508573fdd3c5536ed59d6cb15d93daf01e0d09088a","lib/libwinapi_windowsapp-api-ms-win-security-base-l1-1-0.a":"a49fe302203c43b070ce7caac2ec2714b80f4f3349c3b763e011b2b97d347478","lib/libwinapi_windowsapp-api-ms-win-security-base-l1-2-0.a":"88c3548c16f1d4a6904675ddc2397a20a3da0974ad020244309181b6410fcca7","lib/libwinapi_windowsapp-api-ms-win-security-base-l1-2-1.a":"15574beb90cd18fff8d4ad3caf30eae1726b0d910b7271b7fec7251274a3f45e","lib/libwinapi_windowsapp-api-ms-win-security-cryptoapi-l1-1-0.a":"bac4066bc55c1c4ffaf883bbe621858625503b3557f252e50a87668e79f1d824","lib/libwinapi_windowsapp-api-ms-win-security-isolatedcontainer-l1-1-0.a":"5b5457ebf554266f90dfe8d1d802d0148ecee08fc32ddb26e4395de15d86c186","lib/libwinapi_windowsapp-api-ms-win-security-lsalookup-ansi-l2-1-0.a":"2872f87618c9802b02c02dd526f985ba6cde3f6e7cb40c9fb020bffa40a86874","lib/libwinapi_windowsapp-api-ms-win-security-lsalookup-l2-1-0.a":"f071517edb870d01283ff286076c4c69df68c3c3cb829bd0c7f9a963601cc09a","lib/libwinapi_windowsapp-api-ms-win-security-provider-ansi-l1-1-0.a":"cd4f492580f823ab76f767eeac8d83831f800dc7e8a7f7e3ebbe43f3a54c89b6","lib/libwinapi_windowsapp-api-ms-win-security-provider-l1-1-0.a":"67d89ae227bff24b8d9e642db5b8e0998c8904e076e3b31c5a930141a8f00b17","lib/libwinapi_windowsapp-api-ms-win-security-sddl-ansi-l1-1-0.a":"b680af515fe0218cf7e604c284e2d2cc3480cd42481dfd879cef7ee70da266b7","lib/libwinapi_windowsapp-api-ms-win-security-sddl-l1-1-0.a":"4854167c5d9c7b8d34f74c3b44d6b2dba2acce0b8cdc0d109a1e469b3acc5608","lib/libwinapi_windowsapp-api-ms-win-shcore-stream-winrt-l1-1-0.a":"6d403a8601eed410c7a7f88d6748b409510f7e97b6e3a8c90289491a5c34e4eb","lib/libwinapi_windowsapp-bcrypt.a":"973d55bc8d0b6e2e122270ae600bbb18fdcb19b358dfd2272d391fdb1dd36b39","lib/libwinapi_windowsapp-cabinet.a":"e84848066eb95f124eebff7da387586edabe953d3a57f410189bd7bdb77805ef","lib/libwinapi_windowsapp-chakra.a":"63ea1fc35871431493a0a316d91c3dd5bfe8a7d8f4717520a45beb9e936c3207","lib/libwinapi_windowsapp-coremessaging.a":"b2128fc3272977ce1d2698fa32b1392074853065c99b06fa4b8c96f5d6a5483f","lib/libwinapi_windowsapp-crypt32.a":"493f49ce5c585348fc7d3b7ea08fe0af317179b5d8978e43a4a8240589470924","lib/libwinapi_windowsapp-d2d1.a":"d19873d7c58bdbb34f5b047745e9c8a1461c5704a50f826621642c9076f7292a","lib/libwinapi_windowsapp-d3d11.a":"248e78e5913704107d3d2d04a6d949eba042eddb37a7a8823e2b9fea4cc755b5","lib/libwinapi_windowsapp-d3d12.a":"b43672fff645cdc5efbba81fe586aa71e9f4382e8f18490bca8c6a6626f80c8d","lib/libwinapi_windowsapp-d3dcompiler_47.a":"1ca1d96fe7cb943aa00d403ae96920ffe27b638b092ebe6975111c07a6481268","lib/libwinapi_windowsapp-deviceaccess.a":"e9be49e0cf5cc6e5c9eab3c31663cf6878320de064dca1fb9f91c0a24ec61363","lib/libwinapi_windowsapp-dhcpcsvc.a":"9b5f1fbaab5da120ddc0c3372d3fcdec309c6fae14c1f51480a89a39b551446e","lib/libwinapi_windowsapp-dhcpcsvc6.a":"13f15a4fd529f6fc68d910b50a7ae98a8be86a6d9d8af612cea977c610d234d1","lib/libwinapi_windowsapp-dwrite.a":"ee0478385c40b02c2b1df0d79ccc2aa224dab79f44c0db04bfcdcd5ae9af48ff","lib/libwinapi_windowsapp-dxgi.a":"d6a739e1bfa9fcb0f89717af65cce753e29d8bfc59017e2f846887805c0697bf","lib/libwinapi_windowsapp-esent.a":"037e46482a2b46da13b75048f73807cfa56d5d24ef36065ed50b279bae6ad246","lib/libwinapi_windowsapp-ext-ms-win-core-iuri-l1-1-0.a":"edeec625207e515fdb625b07e7e2b38c2cd73667c6b452f4456605b326a95864","lib/libwinapi_windowsapp-ext-ms-win-gaming-xinput-l1-1-0.a":"d5433d65cfa7cfe7b171d9f917a30c35cee237a807e92659f545b08d5ee8caea","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-0.a":"35260db55143ab8d0247cd7621a1d915f3c91dc1408aceddb77a42f5666e2285","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-1.a":"0ee840c8dcbddaa9ee9e48e89828c35e28b3d4bf80f699154d3ac445360feb82","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-2.a":"dea5a78aaf77341c658b482b907537469263e2f10c1e4270ca2ef7c3ad75e139","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-3.a":"6d302c7da5ba17b2d45c55a0937697545477d728adb6cdd9911fcc7d3f7fbf03","lib/libwinapi_windowsapp-hrtfapo.a":"1b02cfbe7eb71cecdd5da34b456f781f75c6eaf3e65eaed64bb786eb44c22823","lib/libwinapi_windowsapp-inkobjcore.a":"4ebaaa0305eee0c2edc21adb68da23869d6ee9ce0fe44578e650ad83369887f8","lib/libwinapi_windowsapp-iphlpapi.a":"e75029d637f81f91e51bab5b619dec0f0c58ee1dd18859d1b72290f35984f347","lib/libwinapi_windowsapp-mf.a":"2ae013b2f8c6c95fa29aaeb71781dfb5e25c87aabd5590eadbabe25556ced7d3","lib/libwinapi_windowsapp-mfplat.a":"20a7d1940ae503602322aaa57d74ed7e5f3ff344e193085d4d9eeb43e90bd759","lib/libwinapi_windowsapp-mfreadwrite.a":"9fd47afbfb271049090e26cf0d9767e2111ef74e6915ce19a417606255a80184","lib/libwinapi_windowsapp-mfsensorgroup.a":"abc64f326a4f5834dedd23e1ce3aca75c567e4afcff9a3e131837a5937e6763a","lib/libwinapi_windowsapp-mmdevapi.a":"66958af2e7ad7e872e0051440c618aede0ee623c2e3a2e1d194af18c0218a6b2","lib/libwinapi_windowsapp-msajapi.a":"e5c98e56b11c7bda04ad12acdafedd3760fe5cfd4a7162c947cba91e1e21d387","lib/libwinapi_windowsapp-mswsock.a":"9ea5245062abab4d6f986a8c22c7c8b82d253087ed16df5697aa0779dc7d2cab","lib/libwinapi_windowsapp-ncrypt.a":"26f25244ddbc526e1c09f746066b63d8c6e35ae8fa04a6c17496ecb923277710","lib/libwinapi_windowsapp-ntdll.a":"fa8044cf86e4874eee74c9469627d9c3d4b3e75b39c0a38f6cb541c778041b76","lib/libwinapi_windowsapp-oleaut32.a":"915fbe29c0d10e02ae07ce448b8e30d840dbbb9300e877419f6dd135ba1d400f","lib/libwinapi_windowsapp-propsys.a":"051a77cba76c77027e48073af393029330ae3e67910bb1bb2ab084dd0c2e1141","lib/libwinapi_windowsapp-rometadata.a":"562dac0a8fccf405618a18bbf52e12805ad2891cddef9826cf025544aef16bdb","lib/libwinapi_windowsapp-rpcrt4.a":"8f27df2bad159eefbf5220fe431a97d3b9992f11aca355468d80275a942e4065","lib/libwinapi_windowsapp-sspicli.a":"4fef993264ee3b667928d716aa7226386f8b400b9488544eae37f751dafe4db1","lib/libwinapi_windowsapp-uiautomationcore.a":"225604ed82687fd285341fd13e50a3f12ffb4fcc72e26a9a6fac89b52ff492ef","lib/libwinapi_windowsapp-urlmon.a":"107de902b8071750b28ccd2191b0fffc2e7a0d10df269debc53d6be3a218a500","lib/libwinapi_windowsapp-webservices.a":"fedf002ca88c8808428dba5e9a02e3582bd614638518bdfd450e00dff51b10fb","lib/libwinapi_windowsapp-windows.data.pdf.a":"6a5610f4886b3f3647f1ffe3aa9ef7af27e99cc35a7d819f8af4757203707440","lib/libwinapi_windowsapp-windows.networking.a":"315b0b15a77f52a734fe128cdebd993bce6370d4c08c4f9e3ddfd6788699ad1a","lib/libwinapi_windowsapp-windowscodecs.a":"5c76fcb37ebb0fb3cb9a16211d477e59c0d3550d21c169dff733cfbd8005640e","lib/libwinapi_windowsapp-ws2_32.a":"362558ef21906aa66e1e827152ef53b227667e033bcebbde8eb1216086d50889","lib/libwinapi_windowsapp-xaudio2_9.a":"b93cb26bb1c5c49b4b835ab7115695e914fbdfa8fef19bc00c998667dfb28ecb","lib/libwinapi_windowsapp-xmllite.a":"82a0624f77b63748c2cc456408ffd9da0516dfb0e23d24b06fdaf9c29b53183f","lib/libwinapi_windowsapp.a":"dfddd13a1be53af64a03d5d473a6c2c80c747fc7999e1cad7e7aad50d887a813","lib/libwinapi_windowsapp_downlevel-advapi32.a":"b15b64350cd697ed96ebd6c59716536c69c78cb589989058c83a5d2f4e8be98c","lib/libwinapi_windowsapp_downlevel-api-ms-win-core-localization-l1-2-0.a":"565299f3aea03821f84e8052b1142225a8ac05d71808aa660e2aec78b115a3f5","lib/libwinapi_windowsapp_downlevel-api-ms-win-core-winrt-l1-1-0.a":"f4d80cc039da4a39579155f7b30298e46ace98a936a387db47dbd64eb917d064","lib/libwinapi_windowsapp_downlevel-api-ms-win-core-winrt-robuffer-l1-1-0.a":"c941a5cfd8d2148bb8ec06c9a9b3c8a70723b37fc2634575e36c1c49d1df73cc","lib/libwinapi_windowsapp_downlevel-cabinet.a":"89a12c6584e2cdc05364aef6f6e17f77d0083769633adfab47b5d6793ad884e6","lib/libwinapi_windowsapp_downlevel-d2d1.a":"bda9d05a33ca5e056cf5937fef2a52a59b6700fe45578131391116ca4a4c5b31","lib/libwinapi_windowsapp_downlevel-d3d11.a":"151c55f421ac527340a812b669da6b35faf8e9b45d1e2d0e08deb982063a24e8","lib/libwinapi_windowsapp_downlevel-d3dcompiler_47.a":"b1377cd66a4f5e603f7713d253a8257da5942b4cdeb124f6172cc22573ec4f37","lib/libwinapi_windowsapp_downlevel-deviceaccess.a":"dae3ef67aedc2f6be5934edd881e94f0f1d557157eb120603033c3b33056b790","lib/libwinapi_windowsapp_downlevel-dhcpcsvc.a":"71c09c6b4a7957e41326568aa5c3843e3b801e64b8402fe29c39ef722de2f2cd","lib/libwinapi_windowsapp_downlevel-dhcpcsvc6.a":"1b2e5fe6ebe47482a817032559f7f7fef399e0af20c8a65263976efa41cfad30","lib/libwinapi_windowsapp_downlevel-dwrite.a":"8ec12a94050fb6be30d9ce89e9a3a3fdf229aef3ef851e934fac59a8c805c34d","lib/libwinapi_windowsapp_downlevel-dxgi.a":"5b399ce9491ac65f985c474bf8a12c052bceaeb9ef4287f1b52276652afed04f","lib/libwinapi_windowsapp_downlevel-esent.a":"b1410b4797fa48ff20422267b1be926d59cc4857aa7b95fb6e52f4f9ce7994ff","lib/libwinapi_windowsapp_downlevel-kernel32.a":"7a7c838ea5b0cdc182a1a6d258d70817dfc160c074258ce680a2db2cf7c10578","lib/libwinapi_windowsapp_downlevel-mf.a":"fe2d036c4a667eeb030566ce65f3f89b989c1fc1abe5f83945ca44fdc0b70c13","lib/libwinapi_windowsapp_downlevel-mfplat.a":"e5bee9fab643169b89c88cf568045bac6e6f016faf293f8aa30284f88a256238","lib/libwinapi_windowsapp_downlevel-mfreadwrite.a":"c5de9e0ce1202e8352f16d8b67f9a6fe1be12fbafa0daf61538225f499f69605","lib/libwinapi_windowsapp_downlevel-mmdevapi.a":"9c981c2a505652b7ce2455ba30ee8574427948ee7b67571bf5d09a8dc97ea375","lib/libwinapi_windowsapp_downlevel-msajapi.a":"7e59dbf0b6e104a79ecdbac529f45e44b0ddcbee1d38863d8aa7cf2674eaad67","lib/libwinapi_windowsapp_downlevel-mscoree.a":"1b062a2632e68b73495c1247e5279839e3033e3de02b5f5db104cbbc68af2be4","lib/libwinapi_windowsapp_downlevel-mswsock.a":"3f58e0deac30f5a96f3f2a6b4d1a80f2496dd6b1dbbd01235bf0755d51afe986","lib/libwinapi_windowsapp_downlevel-ole32.a":"e4b79dfc1813ee67f496b671e596cc01d2e0ba1c79f0d4d6ae2d7201f56a760d","lib/libwinapi_windowsapp_downlevel-oleaut32.a":"69308892c1dea408b9384284943e45f2147da04e74caacf4ab44de11cc2d364f","lib/libwinapi_windowsapp_downlevel-propsys.a":"b8b6552d2b28a7018468994d3394519b8a7101534b3f4e50173aa1813201f853","lib/libwinapi_windowsapp_downlevel-rpcrt4.a":"8eed742ab752bd17b586d1603e796339c5555e0b0bec3ee1f1d9532521c6e52d","lib/libwinapi_windowsapp_downlevel-uiautomationcore.a":"8d467b3c25c5e390893a47b1e3f8770776e2a36372a8bf0531c25a492f1125a0","lib/libwinapi_windowsapp_downlevel-urlmon.a":"42ad1a91664810df9c2908cdbf8050729db56f14e36125fbc71cf463243f7806","lib/libwinapi_windowsapp_downlevel-webservices.a":"89fadc0f43b06e47b373e9a44632c61b14b4f7a2f2e9ee82136c3e0bbdaf1f80","lib/libwinapi_windowsapp_downlevel-windows.data.pdf.a":"731707bc16a683848d60aa38954b1938900f089acb91a15c7e3613fa34784dfc","lib/libwinapi_windowsapp_downlevel-windows.networking.a":"3f03402c0a4dfef0d0064915f17f88604c8526edf7f03864ffc2a07838311407","lib/libwinapi_windowsapp_downlevel-windowscodecs.a":"f57a96186c4180602cdcb4ff71b3195cec7159d7f6fc32e4ef842d2616a8164d","lib/libwinapi_windowsapp_downlevel-ws2_32.a":"fbf4bee29fefae79bddfca5f7d26ef4b3fba39cd4ca38c69999ddf3b16ffc352","lib/libwinapi_windowsapp_downlevel-xaudio2_8.a":"575a6971d93bb159b37c4910495669d337e6644bae4d7b6f4148ace23d7bb89f","lib/libwinapi_windowsapp_downlevel-xinput1_4.a":"8ebe2d1cf4cc25f05f3f6cfafa9084295e07d022fb7849c655d3d29f40c65b78","lib/libwinapi_windowsapp_downlevel-xmllite.a":"499ea167ece4491d8a1e9a52344c4ba7edd04bdff77a6c79e32dacf57808a33f","lib/libwinapi_windowsapp_downlevel.a":"2194d9b733835788488e418bcb32fad827b37be22f4c4bf60ab2a9a79909b61e","lib/libwinapi_windowscodecs.a":"1d9a617d8619f0f754bd96735db2f21efec8f7c7bc4a14c5815e454b1b316d16","lib/libwinapi_winfax.a":"98cf3f776b3f05ea74eaf7fe7dc767db42e76bd07b4d253eb007349358f3cc80","lib/libwinapi_winhttp.a":"cce6f8284c2f68dd07b5cf7c5a4d1573f8a15645f8bfa465968709d2dd721920","lib/libwinapi_wininet.a":"01d3a33678e0b27ab1c07d0a160bf2382ef9069545f8a54a91e11d5c5f504228","lib/libwinapi_winmm.a":"edc07d91a9cfdb84393c2a1fd148ce6374c4c5cb8a8de8c3dbb6df0f9bf0a4aa","lib/libwinapi_winscard.a":"55058b121a5930e72c4e9b5c67b7d39b4da0af64cccc9d67e04604c1b6c6ff2d","lib/libwinapi_winspool.a":"cdb1f6a9d6b85f15e912b1e9d5cc20851297d0421bcace0f8f47ec200825055c","lib/libwinapi_winsqlite3.a":"a089b8a8083e37e93d77d3f8f94039157c7f4389026d19563cf6cc868cf1a1bb","lib/libwinapi_winsta.a":"618c97b3204cd65b588ec2c3821207207596170b7cc7bbba3f3c59db4d746d8c","lib/libwinapi_wintrust.a":"79e2228fb8ea93e0565c7b9db89bd35cbb6824ba4d384d295460495c21cad6a7","lib/libwinapi_winusb.a":"80e1e8b3ea87e67eba6d82026c611ca46e481134f65dc0a65e7cb8ab6b3cdf84","lib/libwinapi_wlanapi.a":"5efb1954fdface46feef7639ed76d1b13c0f9f38ff5d2879fc4cb7e26940466d","lib/libwinapi_wlanui.a":"990c834c28a1087962948e556e0427fd6c31e79e1dc81b34c6f744ef67c0f9be","lib/libwinapi_wldap32.a":"4c399e2d32d3d53359361a89ef059d4751412d8c68f5a0c2396462b34681e7bb","lib/libwinapi_wmip.a":"318d6e8f08041e59a05d82eb2a70e8794d123c91cd71339a65a1bff0d7b990be","lib/libwinapi_wmvcore.a":"df64a1a7af862fe93cf2cb3301504417148e5fad917e0182a41df0b3bb3dae83","lib/libwinapi_wofutil.a":"330612632e94d06d2ab63ba3e85db69e4c689b02fa14bd4602505be088c6b8b3","lib/libwinapi_wow32.a":"49bf68f714be90aa6cef22241be0b55f6553ff6405ca147824fc5653a60fda1b","lib/libwinapi_ws2_32.a":"b02a3fb740261e1e72cc6d88ae06f228565d39a253198122c23ac965b606982b","lib/libwinapi_wscapi.a":"4a9236b6557411c5bcef90c4f3062aef4377e0421fcf6f6fc7d3483014edeb92","lib/libwinapi_wsclient.a":"b3be16fa22186b2e36537feba46f81c70ec66978459d715a03600c1fa10c4baa","lib/libwinapi_wsdapi.a":"c8824e6b5d4aef2e8695b674905960fcaf1af8881965915235454d25bbb5c667","lib/libwinapi_wsmsvc.a":"11d5e8f6c72b2a16eddf3fe8c4db08932c3f70398808e57c9a797ef9ce8f548d","lib/libwinapi_wsnmp32.a":"4c8dbbe49a58aa683655b84952ec5e5dd6bc68cc4d062cdf6d000daa31a36aa2","lib/libwinapi_wsock32.a":"204c14be3fe2cc95e1ab464b4f4d86e59e56bcebd054dbda55cef49d676ea037","lib/libwinapi_wtsapi32.a":"6b0541ecba6bb1a20571ac9cf3cc6e3909c7592214128e9fe5259d8a520353b8","lib/libwinapi_xaudio2.a":"7ed568b3851cf3dea6d2a2a88b2d5f4c56899dbc8d7f6d8126a06ca7ee2ae139","lib/libwinapi_xaudio2_8.a":"d6717d6e560fa321413dba473d5b741c6d44d3730145c7089de3b996279494d8","lib/libwinapi_xinput.a":"b0edd4a52d698ca8b714ba86dc185ff75e1aa4c9179150dfdd5e01b766f93a36","lib/libwinapi_xinput9_1_0.a":"455441428a9a0bed23abf9cbf316e27bfbdb545d2eb5e7f4319eea8a02938512","lib/libwinapi_xinputuap.a":"7b9cbe2a468180055aea890071308a802d938ccdb81d324e4f904020820f29d1","lib/libwinapi_xmllite.a":"33792fc30a0332b48e0d93d90ac0cb08bcc6331c10d8d9813a5c27dff101b12f","lib/libwinapi_xolehlp.a":"23f63c0a9df8909599f487b90cbdb747781642f4fa60f2b1a2fb24beba4a01d6","lib/libwinapi_xpsdocumenttargetprint.a":"6880144760502cc9643ab5841befa150f05d59dc81be1ed530dcb582d31e6b93","lib/libwinapi_xpsprint.a":"55aef7583e713244611d79c87ff9c955760cdb9060a081fa8e28dc9cc58f27cd","src/lib.rs":"79212a91f610f8a77aa6ed4cc77212c2531eeb35630388bf07323cc328fcca42"},"package":"ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"} \ No newline at end of file diff --git a/src/vendor/winapi-i686-pc-windows-gnu/.cargo-ok b/src/vendor/winapi-i686-pc-windows-gnu/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml b/src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml new file mode 100644 index 0000000000..e3bd0c6bed --- /dev/null +++ b/src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml @@ -0,0 +1,22 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +authors = ["Peter Atashian "] +build = "build.rs" +include = ["src/*", "lib/*", "Cargo.toml", "build.rs"] +description = "Import libraries for the i686-pc-windows-gnu target. Please don't use this crate directly, depend on winapi instead." +keywords = ["windows"] +license = "MIT/Apache-2.0" +repository = "https://github.com/retep998/winapi-rs" diff --git a/src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml.orig b/src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml.orig new file mode 100644 index 0000000000..24c4997d26 --- /dev/null +++ b/src/vendor/winapi-i686-pc-windows-gnu/Cargo.toml.orig @@ -0,0 +1,10 @@ +[package] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +authors = ["Peter Atashian "] +license = "MIT/Apache-2.0" +description = "Import libraries for the i686-pc-windows-gnu target. Please don't use this crate directly, depend on winapi instead." +repository = "https://github.com/retep998/winapi-rs" +keywords = ["windows"] +include = ["src/*", "lib/*", "Cargo.toml", "build.rs"] +build = "build.rs" diff --git a/src/vendor/winapi-i686-pc-windows-gnu/build.rs b/src/vendor/winapi-i686-pc-windows-gnu/build.rs new file mode 100644 index 0000000000..7130b307ea --- /dev/null +++ b/src/vendor/winapi-i686-pc-windows-gnu/build.rs @@ -0,0 +1,18 @@ +// Copyright © 2016-2018 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +fn main() { + use std::env::var; + use std::path::Path; + println!("cargo:rerun-if-env-changed=WINAPI_NO_BUNDLED_LIBRARIES"); + if var("WINAPI_NO_BUNDLED_LIBRARIES").is_ok() { + return; + } + if var("TARGET").map(|target| target == "i686-pc-windows-gnu").unwrap_or(false) { + let dir = var("CARGO_MANIFEST_DIR").unwrap(); + println!("cargo:rustc-link-search=native={}", Path::new(&dir).join("lib").display()); + } +} diff --git a/src/vendor/winapi-i686-pc-windows-gnu/src/lib.rs b/src/vendor/winapi-i686-pc-windows-gnu/src/lib.rs new file mode 100644 index 0000000000..3b7f827d8f --- /dev/null +++ b/src/vendor/winapi-i686-pc-windows-gnu/src/lib.rs @@ -0,0 +1,7 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +#![no_std] diff --git a/src/vendor/winapi-x86_64-pc-windows-gnu/.cargo-checksum.json b/src/vendor/winapi-x86_64-pc-windows-gnu/.cargo-checksum.json new file mode 100644 index 0000000000..ce82be832e --- /dev/null +++ b/src/vendor/winapi-x86_64-pc-windows-gnu/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"a88605a11db5def9b6cf73398e83b3edb72228cb43ea935729fac5cd33cec22c","Cargo.toml.orig":"d158846cdb1259d606bfbeb050e386484cb18f14db41478568114eddb76ec43e","build.rs":"b4ab421e1dc98159dd4440813cdaf7d9ea98278324bc6118d0f7cf378933f371","lib/libwinapi_aclui.a":"276ddeb3f36f3bce5c1b65d6244c5d814ea6212a443023fd9f1755b815ab0183","lib/libwinapi_activeds.a":"f2a3162aafe48121cdd8f10092a5eec4ec1facba87f7a543e90f2fa79b8d5aa0","lib/libwinapi_advapi32.a":"61cea4489a1fd706ef7d8e67b836fd77b2d9d39167edba3a51fe4b0a3ead5640","lib/libwinapi_advpack.a":"d448fd3029b9bf1fed6da3259053abecc7481fe21392fd5218b61495e1bfa1bb","lib/libwinapi_amsi.a":"7549daec74980b0b0f5d9bd1b4f314433dc0ce0a170128a0c1aae6fc2526193d","lib/libwinapi_api-ms-win-net-isolation-l1-1-0.a":"1fe5ca42932d19191127555040e4ad2aa59636f9c17f9f3a3afaa1438cf9fdb3","lib/libwinapi_appmgmts.a":"7a4747e1d307d3b8bd50b1d0611c4f0454cf30bebee6de2bbd3e9bf3f66fcb2b","lib/libwinapi_appnotify.a":"b1a62c3d0a87866aded8f4bc3dd31cf52972a91f5c4bdb966f7b8a2432a50443","lib/libwinapi_audioeng.a":"73b5de7d57738e4067ceefea0cf654ae05e50a59d044461ccd5c79eb7feb6532","lib/libwinapi_authz.a":"adfe67282df67cd3a52d81407a98cc1ce8466d6b67bafa3a884b688b5624045d","lib/libwinapi_avifil32.a":"d80ede7f93091fe3670019291695183142eca029c4b2359b9b1d760803682554","lib/libwinapi_avrt.a":"246c2c6892823de74fb0dfc1ef889798d01e28f110498723a1b33120fa393d72","lib/libwinapi_basesrv.a":"73044d5e44b30581e91d6f3341ee98f99f0ed77d577a4210aa0e9f097e5f68b9","lib/libwinapi_bcrypt.a":"0c19e9a1b649b7226b6954948060edcdf4e4052e0f9e56c218a52b5d36014a99","lib/libwinapi_bluetoothapis.a":"f9178dc2281ca623497f7f83280c3a4d150fb8a55cf7d9efb0bc5c7d41d01ac2","lib/libwinapi_bthprops.a":"dd2aec07378487dc47ff1640b0c91458c90fd8991847c5bde3c97b2bedb801ef","lib/libwinapi_cabinet.a":"6ceb101c96c4bdc62be7362f45c62e9cf1469d5d81bd1bc282b2284b55855582","lib/libwinapi_certadm.a":"d3302510a8197ab0c513101c10cb92dc004f64c039843047bd382f96eb7edf6b","lib/libwinapi_certpoleng.a":"5081b94579847f972dd9549570ff12b78aef42ca10f90981d3de886fa7f0cafa","lib/libwinapi_cfgmgr32.a":"3b18b12d0bbe4e5bc3ef7683beb3fda64b32f459f8dbc78f44a40233e694b2be","lib/libwinapi_chakrart.a":"f1936dfcbd3357255735ca59df3c076a55a676abb9f1a883e0500fef36f26842","lib/libwinapi_cldapi.a":"985226ad1768a637d0ed6b4b868617033d655f1bcac8a0d6e0fd43e3c7f4977d","lib/libwinapi_clfsw32.a":"14a16bacc58aedd81521aa1b2902814cbe335b148662a58f859c520470ed7626","lib/libwinapi_clusapi.a":"dd4f925f888246934353bc109df338f545e5e79e7114fcd7d4b5ba98d39f7f83","lib/libwinapi_comctl32.a":"21b6ebe43ffe405d6be881741423d04e1b5d76c264fea3a131652be307ce17e6","lib/libwinapi_comdlg32.a":"62009b40ffcf2fcc5c4ba0f43922c6c386ccdc42db09c7fa598fe72330a44f1b","lib/libwinapi_comppkgsup.a":"fbea5db62858b6abe5411c9ef5f1ca87876807bb18d10db2cdccca4d0f8989db","lib/libwinapi_compstui.a":"71c05683ff02d0d1963ac72e9e22a1c21e72dc3e8465bd5d6f0d01fea2237b3f","lib/libwinapi_comsvcs.a":"a685111c8104c2c4c4dc20475c3c30e6d1e1ece855b2d35631a3ffe42ed8b2b3","lib/libwinapi_coremessaging.a":"467d27a2c2f3268ae91d37e825d3d54cea24212265c7b6011b3b38002074d459","lib/libwinapi_credui.a":"b965b731004fafe74539c0c9c4f8966ffdf856bf24b5dd584a5e9fe6e0dee7fa","lib/libwinapi_crypt32.a":"d12a2c398e5fa6fb366f768ab11d2e0b5e06ac3c0a5237dc822f291d2ca2e540","lib/libwinapi_cryptdll.a":"29d24bd4ee508988ff5839ded74e41b1849fb24383b45efb308eab935979888c","lib/libwinapi_cryptnet.a":"292ed55e95c5487af424aaf81c8b66f6f007fd3adbef2b85e66e687d1ab4628e","lib/libwinapi_cryptui.a":"c8dd855f6c16395b122eea8f1144e52837e49fc7887fdfe86cd29cbd34133f3b","lib/libwinapi_cryptxml.a":"0454ab761f153936ee26ea36013bdf0612c9b44449d617ee0bffd7b5ec9006b3","lib/libwinapi_cscapi.a":"b0cf26d0ee575dfdb761244e9e0b1b5255a8a56716c2eb01d4a0428709eff88e","lib/libwinapi_cscdll.a":"faa2988a37bf527a964c1772901de933660824bfd13fbe428a0eaa3a5f7cfb4a","lib/libwinapi_d2d1.a":"542b8de881286d507bf96791b68fa94a9529734e891e78dd839aeafc77373fb6","lib/libwinapi_d3d10.a":"287e4ab2b679444dae0254f047a7d2ac326d4110e72a603c0223ccb1a6b97ad9","lib/libwinapi_d3d10_1.a":"95141cf53dce108d49e60728740fa9f32be925bb3f5c07fea1b3e134870d090a","lib/libwinapi_d3d11.a":"792513e2b6829c7a003c24612b8c6440d90fc3dafea80cc0bf4782c0050131df","lib/libwinapi_d3d12.a":"d86f53d148ba6f7fc35518706ea9e8bafc63c39e9ab6bb65790ed1f413bbfaf5","lib/libwinapi_d3d9.a":"e9ddfdb0f0962d18fe6dccc1d6d5d6d1fd2cdcd9b3f070b98af23e6bafc66670","lib/libwinapi_d3dcompiler.a":"a945ee212af78ce62089be910300d251e3b29c52daabe7a5588e5ef87b3c01b4","lib/libwinapi_d3dcsx.a":"60f643b18f4f918c417f4f7258ee4c0dc4a359152952e0d98dd9de344b0d7480","lib/libwinapi_d3dcsxd.a":"062715028b50b17bed4fa0d7c5258f813b19fe09155f9fb3589e55b6c587fb01","lib/libwinapi_davclnt.a":"a050ad2a4c81336bbddc606e4be755c69ffea0dc37aeca118f03155b18d1fbec","lib/libwinapi_dbgeng.a":"4ea8c7e5caf3f437636c7c30df9760d7778646e482047afeed952de0f0c57398","lib/libwinapi_dbghelp.a":"430c90a39ebca43ef942d1794b542df388d0efb7b83793ec5f992feba2af3bed","lib/libwinapi_dciman32.a":"d0d4e849fb3ddc991a7e85d48089860a04d38365d7eb3e78c21fa1a4b386bc13","lib/libwinapi_dcomp.a":"d3c9ca747f96c899880b33b6bd58e3ad288f6e0c069d8cc97429178d841d9555","lib/libwinapi_ddraw.a":"dce5230d762bbd5e9ee997965187219893136cd7c0c800333284b3ad1c317ae5","lib/libwinapi_deviceaccess.a":"7f6ec4878c7d5294c28f9254258596b98722ac859618883a80817c4d7057740d","lib/libwinapi_devmgr.a":"0faf91b6fbdd85be3403477dfed36072ed0525543d4b8d9ed6a7b68a1f7fbb77","lib/libwinapi_dflayout.a":"82690fd574097cc7717707c3b6ed30317f326a906acde16004430265d1985d81","lib/libwinapi_dhcpcsvc.a":"20b578bc8abafd130d53145608d1daccf4c128fd7fba4cc58d815a1dfc2b1ac6","lib/libwinapi_dhcpcsvc6.a":"c620c2ab946015c9cd2a8e4fdad3d40bb70fbd765d12fe0ec14de932d80631b2","lib/libwinapi_dhcpsapi.a":"5408133e6e424729f957755ff13b0fd032998ad4e6eccf03ae3ab8795b21862a","lib/libwinapi_difxapi.a":"5944ce1a74924fbfbc6f15aa8832e1e3583f9f0bfa3cb37daa23ae001e9d9aee","lib/libwinapi_dinput8.a":"809cc0fd5bb0395cf9688e4bf72471c60df69c707cbb0f0ca2d76a347c292b5d","lib/libwinapi_dmprocessxmlfiltered.a":"02bbdef0b20fd01f80e53d64ffb7fe7ff1162134ab8032394b5a1ee4ea673e36","lib/libwinapi_dnsapi.a":"206041acf0e47cbbc1a9966d1e39cea349f3681edea8391c8b8bc59683144249","lib/libwinapi_dnsperf.a":"b79b560261e6d314cc5d8f4bed92ba3df4a8154ab0f720c9aaa8a21880b5d25e","lib/libwinapi_dnsrslvr.a":"6c22ba18a82dcc9abe3acb084481da21087203dce52ac90a6908198f9f782148","lib/libwinapi_dpx.a":"1d0705704952e7f3b482f14520f1ee9e0ca0241bff565f90c595a2a3b95c5b8b","lib/libwinapi_drt.a":"9c7a21f7b4d7b1cfb113d3bd8ca6070f6087727102b5ed02488bcf457cb66a26","lib/libwinapi_drtprov.a":"21fbb117f8d5ae07ce008e72b263461103ec3e94bfecff343ef68cdefdd17d12","lib/libwinapi_drttransport.a":"c3219661e16a06b0a7236cbcdb29f2dce052f404bd171713566a95b9185e34b8","lib/libwinapi_dsound.a":"971f74621612a1e7bfa746502732d5a744ced5fa9ccdb696ebfb9502b3c19141","lib/libwinapi_dsprop.a":"fee99d28a0831bfcab736c62b5ec94ef0b007088865074a9a0989bbb7186fc32","lib/libwinapi_dssec.a":"bddb5274732250390e746874ea74a8aa5088a62eb092d68d71966f7e476f27af","lib/libwinapi_dststlog.a":"4da2f1146cd9882f7e96c1e534b46f8c458480fad5fcb9d1c067d4dda218d04c","lib/libwinapi_dsuiext.a":"6ee8892083f731bee1e8f233bb58a43e5329252625435305a1d27bd6d8b0b900","lib/libwinapi_dwmapi.a":"d55cbdecc52c5051616383fb037ad0fd09947a5f45d1522cea2c443e3affbe4d","lib/libwinapi_dwrite.a":"ac3c297df0e44ecd5123d47a997bc5f2de73934d9808a429132c0f1cf299feba","lib/libwinapi_dxgi.a":"91ad18a2778be45cdcf701d357b32224879432da3f32d14f8717fc238ce2d02b","lib/libwinapi_dxva2.a":"34aa513c106f1deda9f71795ebaecfc01bb800b41993846a0503691c0acc3739","lib/libwinapi_eappcfg.a":"2b7cbebd80a61019356e7168fa57c68dbc5633ffdf3f566593d54b14104d637d","lib/libwinapi_eappprxy.a":"86f2289e79ffa1509ce41293bee75785851d87be7e657126e497c1c9d9a52005","lib/libwinapi_easregprov.a":"be44f53e21b54075aa3b24a45481eccf24219f6991d4551e41e3dd97538b862a","lib/libwinapi_efswrt.a":"5394eea8d86fc66f4df8cd5a8675ddaa39954164d89b7d9c96fd48a43dfd84b9","lib/libwinapi_elscore.a":"46a1f20b5e0616af5b8dc0a7f8db8aa837ea32fe4f8118016d6a2a10f15852c6","lib/libwinapi_esent.a":"e5fa9fd1095dc6c3980191f7665523e72c421e443a474500f41f8403402bf208","lib/libwinapi_evr.a":"b29f7e7997e8bfadcc81d247c2032381f21897d0a2a5ad0304e84945f7e913b2","lib/libwinapi_faultrep.a":"d332eeac469e87925e44ee9ed41408196e87ed1f8972e81540a19f20b1485102","lib/libwinapi_feclient.a":"9abe648543524e3a6024a63a454f7d36b6758d2fc5994efb4b9a513e06348041","lib/libwinapi_fhsvcctl.a":"8f26fdf62798fc19f0aa118e9887c4f5fd715b3505df723cdf87c9341d6600de","lib/libwinapi_fltlib.a":"0681ffdc1f4e87810dbfd664dcaf50592c96b07b9935bc49342982ed90b26a1f","lib/libwinapi_fontsub.a":"07676e49f5a46143fb9c5183e1177cac26c709db1daffc839a36fc72d32e9760","lib/libwinapi_framedyd.a":"cb13a8b7974bb247d497f56f1322a9d9926bfa7b0d3f083a323415e6f78704ab","lib/libwinapi_framedyn.a":"38ad80dd8f8b3fc5d881dc24ae6ae58bf641b3bc24702d205d7a1a8769d89c83","lib/libwinapi_fwpuclnt.a":"bf9d1fe3fe94b35d019ca51e30b0c3b4df085f7ec1a8626c917a4e07eb1bd887","lib/libwinapi_fxsutility.a":"4d2baf6d2d794039e34d07b876afab8963c7847fb90dc8b00150e699a5a88350","lib/libwinapi_gdi32.a":"2b3a916c16e4f91a2cd09386a52c2824bdc4d651166644d72ef5c85c767e6c10","lib/libwinapi_gdiplus.a":"9b1fee0f9f1b6237d0d62fd121e6a6dbf9e37de5690e84e9d41a1c27faee9867","lib/libwinapi_glmf32.a":"d3124a868592e0c37a9beb8e2b6c7b3d2b94c07ae687289a6f0669132072119c","lib/libwinapi_glu32.a":"ddb53f0d0c5f4c2d411e9fded6ae8e0be2b8f9a8a1c5962806f46e9ec03e70df","lib/libwinapi_gpedit.a":"d34919000fefbb37c6f6168fed15261506b6bbc025cb195fa5420f2257c3d4c7","lib/libwinapi_hbaapi.a":"a33dfefc4280c5e0e2b8b57a3ad3266a37bad1a2cef18a308d9f6378e76751b0","lib/libwinapi_hid.a":"6f15a85717f22156e2fb9b208beca41d1c10f90a77f85a54373ad8eee9cd0e2b","lib/libwinapi_hlink.a":"5ee9abfba000d2330a8b8eecbe7264e6a75eaa769314e509d87263574fabdf10","lib/libwinapi_hrtfapo.a":"5fc399db01ea1c885f967666ec3bf784be0ca743207863f4741973b1c57a734d","lib/libwinapi_httpapi.a":"01011dc404f7c79d1dda41cc07cf61a4aeedd4bdc5d7c5e9951a48fe263a169a","lib/libwinapi_iashlpr.a":"a3f8e4a9e57bc6c4ee9b2648e810b495b6d91b9a65388c9be203e44295a52364","lib/libwinapi_icm32.a":"38f11c45477be5e7a9db97803c777be7e897f624a038ee0aa963fb94b585b767","lib/libwinapi_icmui.a":"e44009b1e129de72112e85c305c07c97891590513427866eaebeef000686dcb5","lib/libwinapi_icuin.a":"8f8e4211c97344c7e18b2dc916311be77fdd2f57277d84d66e2fc747134da2a4","lib/libwinapi_icuuc.a":"6673008d48e04f68995c9312417693a97df0f509e06771e5f8fe463526a2ead5","lib/libwinapi_imagehlp.a":"a809cff5d98cbedef8a5c6c7e42f38d3c7dfc8c11d6a9faee124315aa59018b4","lib/libwinapi_imgutil.a":"cfb14abb38c53b4260c38984aadf719f47a1bec9ef649d8a27c3a7ef0c0242f3","lib/libwinapi_imm32.a":"f26dda47a3459748d872bd930aec687840a8d13b7f4831e05a4416e7333960af","lib/libwinapi_infocardapi.a":"1856c6b82964e75147dee0e9f44f7a212cf7352bf99e34d7be3ba9e889e96061","lib/libwinapi_inkobjcore.a":"136437815a0ea7de686880b3dc93c9f15acb99df63017b50c1b6b131d6fbf1e5","lib/libwinapi_inseng.a":"41df87d43fcdf2273da7fe5bb1a569d016b4bff77b1be9b18a0805230df77a2a","lib/libwinapi_iphlpapi.a":"2fd06dd2698d0943b0395ac431ae48df4317503ac8d1c35e127cb498ac6365df","lib/libwinapi_iprop.a":"cdae05efccc1fb56df272f9b4368db1943e23f299fdefa106fd8522c33935a2b","lib/libwinapi_irprops.a":"ca9d940ec3e8d4a15cf3650fa76665f7037fa9c1019c4eada59c867057c8c972","lib/libwinapi_iscsidsc.a":"12ffbd3ff5b6fa6e35dbed15920f9ee71a844b974c04752220585a4c69af4bc4","lib/libwinapi_jsrt.a":"d84cd2be85df653a0ebc2160559a955e9ff565989ea2d4916f1fabee4b96177b","lib/libwinapi_kernel32.a":"95d9ea840920496d039eab257c28b8ade71088d3f4a57aaf038207055231fc9a","lib/libwinapi_ksproxy.a":"1e5bf114bcab137b6c40b779509fe0db92b31456ec6a5f52df14d029ff53047e","lib/libwinapi_ksuser.a":"c0e457ec782e0ee328b26e84d4aadcec7a4764eff69311788820352b11a4a340","lib/libwinapi_ktmw32.a":"d500f383a098291825867758d7c6a00334ceb9aa5497894fce4532aa91405f6a","lib/libwinapi_loadperf.a":"82d539c5665e285f6842b282f872a73408cbe34e251a7c650864c0a1dafd6d69","lib/libwinapi_lz32.a":"359d76f02d09f9edc08322b2121dd683d2478ef696d861802797e46e0e213095","lib/libwinapi_magnification.a":"780c596bba6a4662eed52ccd123316d4d5c06ffb906f483aa8a3440cd50b7bc0","lib/libwinapi_mapi32.a":"287653cfedaf4d85e34de3ccf8f42297d02e8ff53407750d82efd6d264661188","lib/libwinapi_mciole32.a":"a7f54b102fd8e249be177c0afef73245a2ff750a6ba096b7fe51c5611f88fcba","lib/libwinapi_mdmlocalmanagement.a":"aa0cc66939649aacd882ca1263c778fb14b7779f6d2d0182d1a6519d3b7cd9ca","lib/libwinapi_mdmregistration.a":"8e51628bbae7b499509b45b72666b3a7593e00924aed10a4532f08529b19a958","lib/libwinapi_mf.a":"680d1931e07461ab845c17b126f59897c31d68bdb929e3d85cca347f5d5412f3","lib/libwinapi_mfcore.a":"2b20dc1c73b1a7e3f69b1ff003ed7147a58f3469911b25b2124ce9c64c9c8719","lib/libwinapi_mfplat.a":"986fefa67121059fb0e94f9dbea92641cf7bdd168e4a1d6aa99fef6d398c2c5e","lib/libwinapi_mfplay.a":"2570b1aae5f1e4f1f5354ffc14e63b164036c07814ea4d5c7dcd077e7901183c","lib/libwinapi_mfreadwrite.a":"11d82e73075a6c7eb134dc9007b082a98c66ed4e47b7afa48de2ee14b2862ae9","lib/libwinapi_mfsensorgroup.a":"517e80d135e00bfb906ce0836a1ef6a20d7dda394f07658f033b3aa9c60034eb","lib/libwinapi_mfsrcsnk.a":"510a26b17eaca78752fad354028568bfaa6aef06f77a1cdadfb425a785f5ed33","lib/libwinapi_mgmtapi.a":"982226ffd60eae1231da0ebd8bbe6178de804554a76c32777f75820113d137a2","lib/libwinapi_mi.a":"dfa3d4f68e432b3f1601fabc3425ec5d97c3afff14177721122d6444d34caced","lib/libwinapi_mincore-api-ms-win-core-com-l1-1-0.a":"76485df97f6a262297e42b7da5e4e0d8f4909d35c170e202454a1c60b7476c2f","lib/libwinapi_mincore-api-ms-win-core-com-l1-1-1.a":"ce95bce7429e6f6438ca9796350761679985297870763366bd24a7481742cd11","lib/libwinapi_mincore-api-ms-win-core-com-l1-1-2.a":"dc4ee3eee502ebb86eb6f254b1e8b9054b9ed4f8e10183f1c8279289ff67f528","lib/libwinapi_mincore-api-ms-win-core-com-midlproxystub-l1-1-0.a":"115f4ee281b2ec9b44c2c7d9ee36404a319324825acdd839a95bd5827e15672f","lib/libwinapi_mincore-api-ms-win-core-comm-l1-1-0.a":"11da992cddf9437b7962f503392cdbc324a015a4eb339462ffe490424a290e59","lib/libwinapi_mincore-api-ms-win-core-comm-l1-1-1.a":"d0ed125830b0d1f10d897d1ec50da10c5f9b2fc7add84c6eeb225eb604cb6292","lib/libwinapi_mincore-api-ms-win-core-console-l1-1-0.a":"d4083302dacd0bae7f3ad447e67277d537647df23ddf44a399fe327f430793b6","lib/libwinapi_mincore-api-ms-win-core-console-l2-1-0.a":"495cb87554da1f912c999261f5be4cddfa3e0b8af8669625d1ed3e9625d26eb7","lib/libwinapi_mincore-api-ms-win-core-datetime-l1-1-0.a":"131bcd3b2e44bc48d739b78a6a2c162d86b4db93423ec58163ca8ebf0f4b1127","lib/libwinapi_mincore-api-ms-win-core-datetime-l1-1-1.a":"16c8fedfa7b80e8208b99538e439d6b77348668560241978842b65fa820a18d9","lib/libwinapi_mincore-api-ms-win-core-datetime-l1-1-2.a":"af6dc27b8170b4b05ccb15734310c6a0c5eed201e86e2bbc6772ac9e215efb8b","lib/libwinapi_mincore-api-ms-win-core-debug-l1-1-0.a":"55ed7347bf664967590340f71d6bc0cc8387fe76a056a809a2942410c0d5a747","lib/libwinapi_mincore-api-ms-win-core-debug-l1-1-1.a":"3a4f57fbd03af27049b080f6845acfac07e3c3c7bed85abfee1a3d5b9fe2a762","lib/libwinapi_mincore-api-ms-win-core-debug-l1-1-2.a":"b225bb3ce5569915eb0a263069ba085bfaeaf45c470f04288b41f9f8521617c6","lib/libwinapi_mincore-api-ms-win-core-delayload-l1-1-0.a":"d81c5c1dc60979c59b7eff1b223055295343cf3845d2a0517e17035a14dd0880","lib/libwinapi_mincore-api-ms-win-core-delayload-l1-1-1.a":"e7bbb5f9e98f85df4db9b7aeec6039c481d039c7a268ad5923c5810673c4ca69","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-0.a":"f10fc3c99ecbb414a1d5389b9f3d3a340f0496500914678b11565003a882fb7e","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-1.a":"ddd872dd19a575e3dbd8ec25b2b34c2951ccfcdd61b38427126cf0a65f4a0cb4","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-2.a":"7d599b936357f4ac8f38582874345ed12215252f359988c751cc60cd32a8db17","lib/libwinapi_mincore-api-ms-win-core-errorhandling-l1-1-3.a":"337ffa10980babe0b17cfb17f4e44c1d243d4483ed8cac16bdbc213a99e2373e","lib/libwinapi_mincore-api-ms-win-core-fibers-l1-1-0.a":"fe878234568e92961e718322c3c081e3c0989eeafd6e5b0ee545bfc68eb81d44","lib/libwinapi_mincore-api-ms-win-core-fibers-l1-1-1.a":"e24ca6fd32df62cf49a7a8d616c350b344c22a0c8cb6d8627c675f201f4d9904","lib/libwinapi_mincore-api-ms-win-core-file-l1-1-0.a":"a97938a9e8f5eaa5b6fb2f489f93bb4f4fc58871f2d8d6269e14e19a337a53fb","lib/libwinapi_mincore-api-ms-win-core-file-l1-2-0.a":"37f05a0469dfe19cff5ece1406f4e959a063a981440cfcf3a5916e17a4e382dd","lib/libwinapi_mincore-api-ms-win-core-file-l1-2-1.a":"3569117f29b0d08505df253e61c0fcee12cf5b12177793a32e7af80d2d56a2f4","lib/libwinapi_mincore-api-ms-win-core-file-l1-2-2.a":"68d39750dc408b28594269d5d6ec80a5984dee8ae001b1b025002bd84e770085","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-0.a":"207be2f5cdbedd2fcf0e6e67b5680adcc32b8e9117837716dbce43aa5ca4b165","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-1.a":"ae5feb37150c28b3c344c0d395be86a28a484f4acd0b496ce183bcdcbf1eec0e","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-2.a":"b494cb791848ece954b1972e99e530b2ad48b4b0a4d05cba7b77bd2beff46096","lib/libwinapi_mincore-api-ms-win-core-file-l2-1-3.a":"c5bee07c3af2b8a191caa6c95fd047f2081b701c3a32fcb60e979c83f8a83fa8","lib/libwinapi_mincore-api-ms-win-core-firmware-l1-1-0.a":"d37f2e483f7ce07ea1f13da2bd6d11fd90b3d6e74b2eab16dd6675701d925dec","lib/libwinapi_mincore-api-ms-win-core-handle-l1-1-0.a":"4e4db210d18e80f5eab092933076a52378240696125d7e438555286fbea7bfa1","lib/libwinapi_mincore-api-ms-win-core-heap-l1-1-0.a":"a63ce183e48c98a1f03eb7e81d49431567e6a9e1434b950390038cd86d0c58ca","lib/libwinapi_mincore-api-ms-win-core-heap-l2-1-0.a":"d37b86d396eed705ff66ca7a15b9790cc771cca3781f9afe30595556b5b2e516","lib/libwinapi_mincore-api-ms-win-core-interlocked-l1-1-0.a":"ee2d2f445d8340bb7079a9a0ebfac3e776350bf06714b04d2d71f44f39c31ee5","lib/libwinapi_mincore-api-ms-win-core-interlocked-l1-2-0.a":"20a24186dcf33096ba39ecaa06144e16fa8e13508c4070fe2f4787e02a10b678","lib/libwinapi_mincore-api-ms-win-core-io-l1-1-0.a":"1a7e2901d936cfb930c10b5bd01e1cb174e155d63e389b9d0f93a67fe7767e7f","lib/libwinapi_mincore-api-ms-win-core-io-l1-1-1.a":"c2031a37160d4cc6cd10c7a1bb146242bd97bede479e38591514ca28f1c34052","lib/libwinapi_mincore-api-ms-win-core-job-l1-1-0.a":"2c6e24c3f21548b2a672cababc065f49dd6e8c77f5ca9c0931ea3cb842dffe2f","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l1-2-0.a":"de5b19aad7597b6ff8676d50cb57080a96314aa4a57e483b470fe27fcdc467a2","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l1-2-1.a":"0b082aa3bd4acbfdc92b698512b102d4e0f90e5d1853da62d0acf74fdb5b672c","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l1-2-2.a":"5989b4597e769277940c2f6c0492753c09c12292b28c932cfb5aba5f4fb24faa","lib/libwinapi_mincore-api-ms-win-core-libraryloader-l2-1-0.a":"074fcc7d7d03cf010f4c536a97447b2ea8b20d709b1001270cbea88240e43624","lib/libwinapi_mincore-api-ms-win-core-localization-l1-2-0.a":"25ffcd1067b026bccfafedf7d20505eec04632eb6af16698bfda0b7b62f93d9e","lib/libwinapi_mincore-api-ms-win-core-localization-l1-2-1.a":"9b2d7399e10336891b842516659ddc64a8d3d56ba014b5695c71c432d1d33d8c","lib/libwinapi_mincore-api-ms-win-core-localization-l1-2-2.a":"fedcced3e72d1353f075d4be8ec105b6860dca592c181ab240288fcb8595e0c0","lib/libwinapi_mincore-api-ms-win-core-localization-l2-1-0.a":"bf89dd69e8c7b6606b6b2978fcbedff972984423912489c955a2bd16ec421bc1","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-0.a":"b2e414d41d55a770b1ee5510f26e49658acde1a905da2699828d74e70f1a0911","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-1.a":"d8bd0584274bab01eafde0a2d345c795733f4f02687ba57c7732a796f6c615e1","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-2.a":"72048537dc3a79da7c288b317d1aada14a94b0c0ed81949b2a847265da04d68c","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-3.a":"c88dbc65f56198c6fb8b13dde3d831731c19062594ecc76d64ebd6519eaddb91","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-4.a":"503ab8fb1df38b8c92af9084bc04970b96210820f8453a4f0a8c393dad6648fe","lib/libwinapi_mincore-api-ms-win-core-memory-l1-1-5.a":"7092d745039c3614851ee3be3f3515104cd868d1135bfaeef67f3ae29d400ced","lib/libwinapi_mincore-api-ms-win-core-namedpipe-l1-1-0.a":"5a16f49d70f33f4a199722985ce6e006c9a7272865f12ddad38b4624c4939326","lib/libwinapi_mincore-api-ms-win-core-namedpipe-l1-2-1.a":"e7bee4535d9795e94a9acd93e70a771774f827c0bcc277b7363558a02243159c","lib/libwinapi_mincore-api-ms-win-core-namedpipe-l1-2-2.a":"df7e86061d0cb4f6564f0f7c0d6ecb41d3b1b37ff41804c3a340ba3046b0099a","lib/libwinapi_mincore-api-ms-win-core-namespace-l1-1-0.a":"8970229a62f4132de23f5801940eba485dfdd1809546cebe7a18d7c0184c48ac","lib/libwinapi_mincore-api-ms-win-core-path-l1-1-0.a":"91b50dd2d0c32a1aaf298f893cad0cdfb6685e20fba44dea649b89c50ed4c9a6","lib/libwinapi_mincore-api-ms-win-core-processenvironment-l1-1-0.a":"3e59f3ae56977fca3e452d1c7077fbd79ba4618378d6b3f6338670da2264b318","lib/libwinapi_mincore-api-ms-win-core-processenvironment-l1-2-0.a":"ba69dcc28276bc983a1bd59feda56528408c79fe18b2bc2f7245e2fbc3e8d75a","lib/libwinapi_mincore-api-ms-win-core-processsnapshot-l1-1-0.a":"bb0e5002cbce0a6cad7a0af82f456acfef3a7573de25ab4f2c76360185e1371a","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-0.a":"77067e3e43fb1db6d711b01c3ca6ee076a0ef87d96409ddba4be9732723cc2ba","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-1.a":"2c2e7b7ce85816c7974f605510cafc16ec3500876b490da4f462dcc967c6ad40","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-2.a":"af21a90245d69e44b82b66857797168b206b282a1e54cda6ca8cdd6e0c64912a","lib/libwinapi_mincore-api-ms-win-core-processthreads-l1-1-3.a":"a364ce3355f5c3a2719e3ecbe42f5b0e9e0d6b87146f7c762bd6752f0f3c9534","lib/libwinapi_mincore-api-ms-win-core-processtopology-l1-1-0.a":"9fdde1b7df00b8677e2f2978ceca2b9ef3e1539756f48fa5ed527c3d3229937b","lib/libwinapi_mincore-api-ms-win-core-profile-l1-1-0.a":"a9b8f92be12fc12ab7f278c5751dfbafe8a1c6c70b8a7895c601bcde27a49e4b","lib/libwinapi_mincore-api-ms-win-core-psapi-l1-1-0.a":"28af76aedcbe8e5d2fb1e3d71cb401381a3400bb802d0f61137509ddab50ceea","lib/libwinapi_mincore-api-ms-win-core-quirks-l1-1-0.a":"1a3d2f2a9cf9c43d2425b0200ec3985f3e411a89f90778beedeeacb7edb0929e","lib/libwinapi_mincore-api-ms-win-core-quirks-l1-1-1.a":"4f15f699337cd42650bd16f8503984aedb70a3f1ba581c0e131a6f798f3968c9","lib/libwinapi_mincore-api-ms-win-core-realtime-l1-1-0.a":"2602a72063a047c5767aa1d20248d701b81ce3ccde8c4ef07a6a107a9c3de9af","lib/libwinapi_mincore-api-ms-win-core-realtime-l1-1-1.a":"3a06e02a57871cb36caecfb78fd4139ca851b66474ca5bfb5b3b2a6037682d29","lib/libwinapi_mincore-api-ms-win-core-realtime-l1-1-2.a":"7faf55c7bb4c862a269bd5fe2be72c8858dd54b5b949399beb2892d7d4f891f9","lib/libwinapi_mincore-api-ms-win-core-registry-l1-1-0.a":"798c2464d813e306d061741351a2a56f570b8e363e550223f62be1c1608cffe8","lib/libwinapi_mincore-api-ms-win-core-registry-l1-1-1.a":"d165ef00b715eba2a96248ce2aab275d39c7d5c927c71fc2bc70cebed43b85f7","lib/libwinapi_mincore-api-ms-win-core-registry-l1-1-2.a":"92115b5933781d78b2d615b141732a6b8ef08a084bb97010aa844f75058ec465","lib/libwinapi_mincore-api-ms-win-core-rtlsupport-l1-1-0.a":"25d6790ed18e0921a38c57e1e390152a24f709e121b9b7296153720f2306e523","lib/libwinapi_mincore-api-ms-win-core-rtlsupport-l1-2-0.a":"2b3ef6c250e8be66cfb026436bff96f4c3ab04d9b8970fbf19cda9d24cd53889","lib/libwinapi_mincore-api-ms-win-core-shutdown-l1-1-0.a":"b549a555192a445540c93480d7c547fab359fcbb49254b75b58a6b624194d526","lib/libwinapi_mincore-api-ms-win-core-shutdown-l1-1-1.a":"c68db7f4c33cabd2818d0d1b47167672b1ee612ea70e0a88726f818b5f75a537","lib/libwinapi_mincore-api-ms-win-core-string-l1-1-0.a":"e6c31d64254c944e35513b540a525cefaf4b58665d6909a8e8964415453be06c","lib/libwinapi_mincore-api-ms-win-core-string-l2-1-0.a":"b218af872027015c5848985f7fb9cc6ede8cbb5451e85aaf8c51744a3acf2439","lib/libwinapi_mincore-api-ms-win-core-string-l2-1-1.a":"3c7be7fc72f0e3c21668c3ea854f2d097bc8c9e2f1592ab81480e03b17fd9649","lib/libwinapi_mincore-api-ms-win-core-synch-l1-1-0.a":"3662cf22a2ff4e0be5e95d7aea716ad92f5ffbc3d241556353658995885e2729","lib/libwinapi_mincore-api-ms-win-core-synch-l1-2-0.a":"ec56d87919192c2aa2c3babe67c2dae04afa31075ba3e89bc3941c00ac3280bf","lib/libwinapi_mincore-api-ms-win-core-synch-l1-2-1.a":"a6583348b7e00a8b291a70c17f5290251e43c8741937b134f8fd3a56460ef88c","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-1-0.a":"bbdd30605debb51d2f2d94688716024e5d75770500205f566080006a5d556ca4","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-0.a":"9ae56c06c30361106526eeea1d5db47082b838cacaf8b54d46c285bbc4b6e6e6","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-1.a":"0349a394597567544c5ea204ed880b54861f2760876e2ccda4176900c8a8352b","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-2.a":"ee54a2da3a078b1d1332b1ec5a1a053e816f7a3b6ace3c01f508282e985f5c67","lib/libwinapi_mincore-api-ms-win-core-sysinfo-l1-2-3.a":"0d2db7aaf08e283c04022b23d616e39f9403d7886af8ddddc02597ca3bdf42b2","lib/libwinapi_mincore-api-ms-win-core-systemtopology-l1-1-0.a":"c7befe692a33c5c2c3e1f273ba2513f649502b93012ea6da895131f8eb648f8b","lib/libwinapi_mincore-api-ms-win-core-systemtopology-l1-1-1.a":"d441a2feb8334a5680a8d5d354fc5a69aa63d89623d1be13f4ff600cb93dbf9c","lib/libwinapi_mincore-api-ms-win-core-threadpool-l1-2-0.a":"beaf292dd62a83315423fd580d057adec9b78aa3ba5ee08e35e9e785d0297ddd","lib/libwinapi_mincore-api-ms-win-core-timezone-l1-1-0.a":"775a51aa310c249d057df10cf67a05a85246a0be6df6e2889b64d640ab811d6b","lib/libwinapi_mincore-api-ms-win-core-util-l1-1-0.a":"5d3fbb17a4fb24d10279ebb137d11ec31b1fc3a6dc0e830bcd44e73330dfa92b","lib/libwinapi_mincore-api-ms-win-core-util-l1-1-1.a":"4885b71ff3c5fa95eca7a29bc0f4a9261ee57eb77c9b5a21705a394a6b888cb7","lib/libwinapi_mincore-api-ms-win-core-version-l1-1-0.a":"575b5e9d97ccbc3c4dac43496d6753209f5ee20103ff7c52c107a65236c174f9","lib/libwinapi_mincore-api-ms-win-core-version-l1-1-1.a":"1796148f6e9724cb3d4059b8b79f22f901de240bc460057250a3f4dd62cf450e","lib/libwinapi_mincore-api-ms-win-core-winrt-error-l1-1-0.a":"f6c9542def9f9be896602499debd7debb72808bc41e6c735ef189b29e0cac421","lib/libwinapi_mincore-api-ms-win-core-winrt-error-l1-1-1.a":"464f39672be5e9ecc1a95e9074a46bb3d1beb1abdf6cc4e705e95ac656bcd027","lib/libwinapi_mincore-api-ms-win-core-winrt-l1-1-0.a":"a0c9ea99fd5fda8a20591f2c88cf8eb52733be1520da706c636c08883578854a","lib/libwinapi_mincore-api-ms-win-core-winrt-string-l1-1-0.a":"b5bed34136bdd91e155dd0b347321ef8c9189544cf5dd94f93fce3092ae8d4c9","lib/libwinapi_mincore-api-ms-win-core-winrt-string-l1-1-1.a":"7426f42dd85d665bea5fc7bc7c1433d8005468902f8608b6b9ea8cb0698e2c3b","lib/libwinapi_mincore-api-ms-win-core-wow64-l1-1-0.a":"1f7b9a3be312c964092aab8b85f2241e348ffae828447be09804fa35f040770d","lib/libwinapi_mincore-api-ms-win-core-wow64-l1-1-1.a":"7133822afea480f54c3b6ce36cc000cff40bc50ee25c292711c14d0dd48dda30","lib/libwinapi_mincore-api-ms-win-core-wow64-l1-1-2.a":"02a87ebca8f6206f65e958ddeafb020672cb7c68d907098e056df0ac48ccb5ef","lib/libwinapi_mincore-api-ms-win-core-xstate-l1-1-0.a":"cdae8ce3826b8e94e76f3948eb386feb4145113d3c84d5159efc2aebb49a3822","lib/libwinapi_mincore-api-ms-win-core-xstate-l1-1-1.a":"b494ac0d24d2da51a6bebf16be7823e09952a3fc4beb60faed04d853304429af","lib/libwinapi_mincore-api-ms-win-core-xstate-l1-1-2.a":"90c7065fe698f38b2f24c2d4abdcd0ffc5e968c2aa9c77c40116297a71671bc2","lib/libwinapi_mincore-api-ms-win-core-xstate-l2-1-0.a":"1de3c7cac5fb4e6e4586afc825dd2ea308a0c008e7ffc5a9a3dc964a67af481e","lib/libwinapi_mincore-api-ms-win-devices-config-l1-1-1.a":"799d9550b9c6f19636b9becf563b4fa134df2f038a8054d86ec3468fb6003249","lib/libwinapi_mincore-api-ms-win-devices-config-l1-1-2.a":"56c9013e02a91971a55e3a8f7317eca162d73187e07749e4f2e6a2cab1be28c0","lib/libwinapi_mincore-api-ms-win-devices-swdevice-l1-1-0.a":"14ad208d3a557860b153480c8ccb779ff94febe333fb9ced466371a81249250e","lib/libwinapi_mincore-api-ms-win-devices-swdevice-l1-1-1.a":"7611317eddaeb55896baba49e4500a2bbd27542c461747cb0ada9dd9e8f88740","lib/libwinapi_mincore-api-ms-win-eventing-classicprovider-l1-1-0.a":"44693253b456e6e88051fae853cf6abac787f1317361237a4129466ac0460f56","lib/libwinapi_mincore-api-ms-win-eventing-consumer-l1-1-0.a":"2218e4b6463c52ac282b2cbdb4fd8710b6944db59bbcf938ccc502f9f87587f6","lib/libwinapi_mincore-api-ms-win-eventing-consumer-l1-1-1.a":"cb9801e38e8de95efc6c9e7b751568d21cba1de5e1e3e1150753d290aa6c1e5c","lib/libwinapi_mincore-api-ms-win-eventing-controller-l1-1-0.a":"147c26ebb856c0d66418d65b579aa9bdcdad35b76ddaea8e9eb51c1cbe9c4ad6","lib/libwinapi_mincore-api-ms-win-eventing-provider-l1-1-0.a":"293099241adaea5ddb48e81d00b692f26959d8b1b81a4dd8fdfab78d5cd51eb5","lib/libwinapi_mincore-api-ms-win-power-base-l1-1-0.a":"2a3e535ca1c92f9421a5259c07d534585682d4f6648b95507c24f478b1fe243f","lib/libwinapi_mincore-api-ms-win-power-setting-l1-1-0.a":"75579f3ab3bf8aa738ce064a3fc93ea2a77c3a07be84b2fc8c465cfbef884fe4","lib/libwinapi_mincore-api-ms-win-security-appcontainer-l1-1-0.a":"3f967e6487e80799c080e8b9750960c3133d115f8c7974ee5ab70d71ae38b52e","lib/libwinapi_mincore-api-ms-win-security-base-l1-1-0.a":"bd3ff6b57beabe52f0bf678e560b412d530bffa64515393235e0fc65aa712121","lib/libwinapi_mincore-api-ms-win-security-base-l1-2-0.a":"1d0184140d34f7c7b0e28ab71d16cd2b996e8bb4eb423b95ea83cd1eda494f11","lib/libwinapi_mincore-api-ms-win-security-base-l1-2-1.a":"639bf97214b059e78d4fd683a13ebfb79effabd2f3c38a86ceb20d98d1a848f8","lib/libwinapi_mincore-api-ms-win-security-base-l1-2-2.a":"9a7e3a5e1b55f82d12a9a2e927658ee9fd925658e8586cded710d79c9d979e57","lib/libwinapi_mincore-api-ms-win-security-credentials-l1-1-0.a":"04ff7d0965ef4f55369eb1fed1334a6b25e5e7e0767da732cfd43a70b18a180b","lib/libwinapi_mincore-api-ms-win-security-lsalookup-l2-1-0.a":"9f06f963a86647f8e5454b1e5a30dc4edacaae156eed0fb22ab322a71072102f","lib/libwinapi_mincore-api-ms-win-security-lsalookup-l2-1-1.a":"b39db949209210603da7c0f15ade2d206e92b8b519cc3a4d909d30d93531f79f","lib/libwinapi_mincore-api-ms-win-security-sddl-l1-1-0.a":"8c2e5f4cd8d7b65f0107464206636579dc23de724fc082442234a501068623e9","lib/libwinapi_mincore-api-ms-win-service-core-l1-1-0.a":"d4058a3f1d3680a81c151b15d33c73a4b5e912120ffcdc176ab7e4c7a1570b25","lib/libwinapi_mincore-api-ms-win-service-core-l1-1-1.a":"a358042a13a9815582fa09b992ed9ca94c28c4de0c8345faf1852cf7579922fe","lib/libwinapi_mincore-api-ms-win-service-core-l1-1-2.a":"e53544c3ce3f33431748dbff6e04e718868f1941ddbab5757b332d0bd42acec3","lib/libwinapi_mincore-api-ms-win-service-management-l1-1-0.a":"6bfc8493bda22dbd82cb0ea3e3dbf34cd37988cb593480d0527d97324e5820c5","lib/libwinapi_mincore-api-ms-win-service-management-l2-1-0.a":"b867beeac24056d3f25d5d7047a2b864e63db9b257e625513079ce0e172402af","lib/libwinapi_mincore-api-ms-win-service-winsvc-l1-1-0.a":"d29586bdb7382582f07ec2f66309f10e5ea36783c0c7d5a400bbb3889807c588","lib/libwinapi_mincore-authz.a":"78c90a4f4fdfab54ec3c9cdaaed95bcdfc1d5a904bc939d663c415ca4138ab1a","lib/libwinapi_mincore-bcrypt.a":"8028ddda07a33cfa4c1d0b1557a7fba85ea809c0f714532cb4222df561f7a1df","lib/libwinapi_mincore-cabinet.a":"99074d908dfa970113bfc9075dd05f6125982eed3f201588b7cba7e46d530146","lib/libwinapi_mincore-crypt32.a":"96efd8c18f1842c08f5c00c1e8781b6abe66db706d1f8bd7e4ad80727d13bdea","lib/libwinapi_mincore-cryptbase.a":"e4cae4a43dc43263c3189b607d6a28bb379b741e874802c6e867571a4c617a34","lib/libwinapi_mincore-cryptnet.a":"ec5d7b695f29b86a185ee392050a6845c19890afbd7ff517746ba51b833e0b61","lib/libwinapi_mincore-dfscli.a":"59392a64972249a746bc6fa9aee7ec2f43bd90f7edf96621874e7b1572b9a27d","lib/libwinapi_mincore-dnsapi.a":"c2b4aa0db97117ecd9ce97dc07647dd63d35167e91c5af0b078e4e37db3b9d35","lib/libwinapi_mincore-dsparse.a":"a016dd7f536dbd25316223eb51a55b4efbebf6e01e0e258a5f3b7d891d92e763","lib/libwinapi_mincore-dsrole.a":"7170af583eb32cc16cfeed9ac04de800c9ca29ab9e4f8eda3179c9f2ba14e5ed","lib/libwinapi_mincore-iphlpapi.a":"9a62c837eb80f1f18658fba4b0b3d4f2da9715b72301e7c714c8616c566183c7","lib/libwinapi_mincore-logoncli.a":"5ff77d42dc2c4ea94a04821d923ba949c9dcadd1c67806698ce5777f55894179","lib/libwinapi_mincore-mpr.a":"5bd99b5c3a615bd12ff81a6b25a33acd47ababb0f53b0b72b8f32f0c3ba18647","lib/libwinapi_mincore-mswsock.a":"b059e1eee395e608bbbfd95c4206041c9746652c19bdbb0bad0863950e9763e5","lib/libwinapi_mincore-ncrypt.a":"8e4014e7528270f379ccb28b1e18a623497e3a98177f3b6d0ef1f49106417c8b","lib/libwinapi_mincore-netutils.a":"78345bb6becd68887936be88abc58a258f6bf20156fb8ae4f0560d44eeebda90","lib/libwinapi_mincore-oleaut32.a":"49b78e0b2562aef799df49a8ea32a43ec593498ee0b6477f74b24f4eeadde287","lib/libwinapi_mincore-rpcrt4.a":"e8f651a7e06a3f4d2f5c3a6ede9f19c710229b18e66b0463abb937501e487150","lib/libwinapi_mincore-samcli.a":"7ae6ea2a6fc33eb2e664817fff4ac87002657b628a6bd05d596b6d05d8c2c891","lib/libwinapi_mincore-schedcli.a":"5e260d4c0a255d422cca310cca1e9c44d15479b07931aa50d99b90a45b9e9728","lib/libwinapi_mincore-srvcli.a":"2627f35c6e08b2180c91fccc2e44f3d38e905150a716175e263b83b41bc27db0","lib/libwinapi_mincore-sspicli.a":"7906f8cd451f63d520328db6bfccf85997e569b65f21585036a33cbd80dee600","lib/libwinapi_mincore-userenv.a":"46a3e75f2b40c32186d6c6f153127d5953d457ca39dab64d981e5e67eda27159","lib/libwinapi_mincore-websocket.a":"257a0439a55f732fe53a81c116a917e00aa7639dc5c422b126845fc847c501fc","lib/libwinapi_mincore-winhttp.a":"a227894d136c0c0c251f9fb385b1508226b7330b446010b4f9aa394b8c8192a1","lib/libwinapi_mincore-wkscli.a":"a744cd61255baabfe96463b3df9427e48af630b8946cc5ccbdcb2fbd61b70713","lib/libwinapi_mincore-wldap32.a":"433bedfc97cba10ab1069ad965653762a5529e37689197dfae8b40832a96a057","lib/libwinapi_mincore-ws2_32.a":"0bcd38e75dd94bc11c1a05ccec976bd2c9dd2ff65d01649b983f6be1b58cfb26","lib/libwinapi_mincore.a":"bbd52720f360b925bd6d3838a10407029f4b3659771bb22dfcabfe5dd914e97f","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-advapi32-l1-1-0.a":"c028b2a23e1134089d5b3e63d7ccd3e7d6984b17fb837755cb3569162cdc92ff","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-advapi32-l2-1-0.a":"be31168bd95083953baecbc47c6e31a6563353d4dee2d378db4c7de0da119847","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-normaliz-l1-1-0.a":"42812dc895f6489f96cef6e05131083afe8305a97eeac2aa580291831206d44f","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-ole32-l1-1-0.a":"0bc587f2d6418e987a6f9c07e6cf57cd2bc5d2fbe76a94f558e91d5dbcf9d18c","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-shell32-l1-1-0.a":"a9d7438cc5e37c1bd98d7a3cdc8e587b6a03310f289003aafeac05a4d5d6e205","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-shlwapi-l1-1-0.a":"55237a627af67ff560fe0a008270b4d408aed6192d5c1fa53bec4b7f0bbd1559","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-shlwapi-l2-1-0.a":"9d5731e369dae3f6a7ea57f9fbc94cf9500a2b283507f53038c8e089c1c9f797","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-user32-l1-1-0.a":"fe02038c2d5eda74736dc4efcd6c9139464f680c1d6b74fde9fa4532b2edd894","lib/libwinapi_mincore_downlevel-api-ms-win-downlevel-version-l1-1-0.a":"53b0522c269674cf18f43b64755dc378c90e15adbaa4e17021fd7e5793c24696","lib/libwinapi_mincore_downlevel.a":"36d63238be9e28ba41d89c21b6e4883b8bd01c7205e7f32d71848c9c762fe5ec","lib/libwinapi_mmdevapi.a":"56e34422597206e90ad3f7174837231f60652ac407f3645da6d08ddbec20df01","lib/libwinapi_mpr.a":"7406a65ace451acbd8974ceee8286f20e9159f3d2a164602afecd9bcedab8204","lib/libwinapi_mprapi.a":"ceb642c2aeec33437df6c092ca94273e3bcfdd859a484a4a2d7a7968a37e411b","lib/libwinapi_mprsnap.a":"cc44baa98a5414a6a5ccbda8a0de5a2e618e8beff3a241cd9002739eb051cde1","lib/libwinapi_mqrt.a":"9892fe3cc11c52076f8d9f5cbdcea5a5206bff0d217dc65d0828c65005f4b533","lib/libwinapi_mrmsupport.a":"63cdebd6fe466661f10a0c6bc3404d0e54e64d692e94ab007e95805c492aecaf","lib/libwinapi_msacm32.a":"f60a75b3408003c0d8b5d46d1cbfd5a8c992dc42adb1e763d58528df25fafa49","lib/libwinapi_msajapi.a":"a0b46a7d600516877f94edc4548586b7f073d4e6ae84433ef69b351b9837c069","lib/libwinapi_mscms.a":"b5fc1891c4e13744871a8b7b47445ab1fe5c142c1edb469d842f3b9fe977bbcd","lib/libwinapi_msctfmonitor.a":"510636f80e65611b8b234c15daf0756e23d00e6b2c33e10250ac03d892393a4c","lib/libwinapi_msdelta.a":"f45d9f984ead08c81c82aa6eaa972f76406e121110d276d735013194847b056d","lib/libwinapi_msdmo.a":"aa3b4a716b8c0d6d7bd5d3adc4709660dccc9145e202a3d9d666d099899ae37f","lib/libwinapi_msdrm.a":"3c52ccff324fe4f064930b829c5076a74780a0ed82c7bf717e5aacb034d11885","lib/libwinapi_msi.a":"0c6aadc211fd5619b0d49ad64281a158caaee1660613fbfa2e608029c00cd725","lib/libwinapi_msimg32.a":"b957bfe3b092087c037931bc32af15b6f34796b749935f3c47ee255c7ecbc624","lib/libwinapi_mspatcha.a":"4c3bbfd791c2d2c518de608139bee2795a2c17f654326d95c2e554d86d946c29","lib/libwinapi_mspatchc.a":"601f4995cd4c734203f4ed75266dd89a2cc5066b5c0a3048767d05e66b21e679","lib/libwinapi_msports.a":"fc87678647395a4dedaae3af5766b4c5f4f394fd542377b565684aa0144c7d24","lib/libwinapi_msrating.a":"6c9acbc1d3426bb5e71f2107a229a152f81d0ef7d71c61a508aae7f847e6d957","lib/libwinapi_mstask.a":"9b32f0e7ad02309bdc681dcd48fc5c471b312db307778a1021571752f75663fb","lib/libwinapi_msv1_0.a":"93a80a8ac2130ebc3cc35b120f79391a34c83daee7ef33e11f0f6dab113292bf","lib/libwinapi_msvfw32.a":"3cf557fa7f9f31f23d8f498add4930b6ffc304a055d371ff6d59c64824134e87","lib/libwinapi_mswsock.a":"381afc6ec584272549384654be6f1e52139a3d6768a6d9d101258bf92e711c2d","lib/libwinapi_mtx.a":"7f94c16ae24a21d23cee0914d0bc1fe96e680c54d40ec5ebf47007c16748f4e7","lib/libwinapi_mtxdm.a":"08081c65d362502423aa0e9113658f9df0f4022f87be81592b5b059fb3dfb66e","lib/libwinapi_nanosrv-api-ms-win-net-isolation-l1-1-0.a":"423f0645557c42b13ac439544e73ab721577fdea996615604d641c30f111b86f","lib/libwinapi_nanosrv-api-ms-win-net-isolation-l1-1-1.a":"61df616253b837284b9541c67086d902162dff7b2c915f8b059abdca33a48779","lib/libwinapi_nanosrv-clfsw32.a":"3b4d6434f3a4fd39e6d1bf4530e25d654bd24e37e685a22de23fc2cd378a57e4","lib/libwinapi_nanosrv-clusapi.a":"e55758fba6a73cde2f06124b8014860a39946df814158d8c0d6328b266b9a090","lib/libwinapi_nanosrv-cryptxml.a":"1d8444463051db7479bb541da43ccdb303f581ca8da74bd7c3fe5d4f5ee124b0","lib/libwinapi_nanosrv-dbgeng.a":"c2229ccb5959f07cc33a3553a2b96257379b601ee5c934fc2dc3173dede7fa95","lib/libwinapi_nanosrv-dbghelp.a":"4c5aa4edfb424c9b646f69e61f046e830a576a3cbc299d959b9b68e33834d5f3","lib/libwinapi_nanosrv-dnsperf.a":"51df95c4624745ca014c4064f9791d5f5a87f8e140e751b631078369cd951b67","lib/libwinapi_nanosrv-esent.a":"a27c8b50358d89cc85b5c5660520a912d5cc553d58acf03ac68f61d687a5c4d9","lib/libwinapi_nanosrv-faultrep.a":"9bddb8af62f936b76c9ab737b5e1a4fd71fe50e7d593d0226749f5fdf6b9753f","lib/libwinapi_nanosrv-framedynos.a":"ad8888d9f3426524fbb7ba5642ecf9173a2c8c972e6dc8a37ef7be3c36fa7fab","lib/libwinapi_nanosrv-fwpuclnt.a":"fe0e1f4ab2120396508cf4c61599cab66b8d1cb6e23b874a3f6f97879dd6f904","lib/libwinapi_nanosrv-hbaapi.a":"b9da44f2995f25608cb3eac7bc128e5ee5081e95382fbfbb79c3d9a126c2393f","lib/libwinapi_nanosrv-httpapi.a":"b58e460ef867312f210a6c914b74645eba848c957fb915bf75f0a06164cc438b","lib/libwinapi_nanosrv-iscsidsc.a":"780bed8fed327ff5169fdb6d9d261bd2d13cd8e41615ec7a2630a2ec1d366bb8","lib/libwinapi_nanosrv-ktmw32.a":"a266994f59e7dd4100a7434a10359af18bc06d65e24da38cb67b4869fe449004","lib/libwinapi_nanosrv-loadperf.a":"a2dfbb2b3328fd5484a1297ba7559fca69456fe5185b1b9966b49985bf4fe3c5","lib/libwinapi_nanosrv-mprapi.a":"dd1e92fdecc614bb55400cad71e05748d035a30ccc8be3112a896dc10ae3d256","lib/libwinapi_nanosrv-netsh.a":"508ed31e1dcff117a481e22b1a9cf715603e39797b1be841c285fac1242bb111","lib/libwinapi_nanosrv-ntdsapi.a":"da6b41c87a140aa5955e12146450c06ee69def0b4403df08fff03ab360691f03","lib/libwinapi_nanosrv-ntlanman.a":"e388f2e52d7725a131458fdc5b3819ccfa4b9693ee744ea60774b55ee8b1d97f","lib/libwinapi_nanosrv-pdh.a":"0293a1dc8cf65943d752591bab9fc7e35e52d8d3e434caffe01501efa12c7725","lib/libwinapi_nanosrv-resutils.a":"d07b9ae21e09e9fd1cf2a34e29d15083b4488cd379e86450e43fe96c94fa7c1a","lib/libwinapi_nanosrv-snmpapi.a":"23801069b59bfa63e1ddc1215952bc7cdf5c3759d737391b3f0022e3447fa342","lib/libwinapi_nanosrv-tbs.a":"0b238cecb91ac3f3009dadcd6ba5ab97966dd8ffb04fb2f02192b9d684572cc9","lib/libwinapi_nanosrv-traffic.a":"f785453c167afc1c307ccfdfe118623dbd76da7eca57693f8c3b0b48f5c99f54","lib/libwinapi_nanosrv-virtdisk.a":"e00fa531feb4605d0c57bd0fe666013cacb32f6a6f3b507783db1e6fc30bd5bc","lib/libwinapi_nanosrv-vssapi.a":"3f2d034551025175703eed381e2c7a57f066c338d03df1e928d65824cfd66a4c","lib/libwinapi_nanosrv-webservices.a":"2ae64d017c4e93543315c80651b85c50fe657a436dfa4981ccba86267fb1a27a","lib/libwinapi_nanosrv-wer.a":"63a98d54282376fc4164514ea6b3d0e52b24af62b2061e2f4470e4ddbee524f7","lib/libwinapi_nanosrv-wevtapi.a":"a92de1acd31bb0de7561d0639d43758d52a21b36e4bf31301e0b6684c7f2bb72","lib/libwinapi_nanosrv-wintrust.a":"b64d805e86062b99e3c91852e0d3b06cc730275353c6a0f5e73d37035a2d4452","lib/libwinapi_nanosrv-wnvapi.a":"4e9cc9f9c40c69cd8a35b347c65281340f8fee3a62c95589c4af382904b7113e","lib/libwinapi_nanosrv-wsmsvc.a":"ebf84b310b64ac901848e585bb2dc70052555685e327de26af717bde7d4edeb4","lib/libwinapi_nanosrv.a":"466d7a38f0751d8d45510cf885835ada4c6b620f04010bfe78088cc3af4466a3","lib/libwinapi_ncrypt.a":"9528d1ea3137810ff543e4a400e45694b3012bd020dc4d16d822bdd4c849c345","lib/libwinapi_nddeapi.a":"925181b8f854a2d3d1199c295973e72ccd41c6305d0e02acd14531f19a08e2c0","lib/libwinapi_ndfapi.a":"5ec4360cbb064903a5efedd5396b57a10233c377e823e69b95766d843023e11e","lib/libwinapi_netapi32.a":"feef4a95ccf8733c20ad24c3cd7ca44637663714121a5bc94ec52d0f7bb10613","lib/libwinapi_netsh.a":"72aaf2d1b4ce73e1b61d60fc82c7e9e4f2d02767bf25981012f3359ca7cf2114","lib/libwinapi_newdev.a":"90773a4fd90abb7e64c3bc5dbccbe070ef0035bc66c5747187d683c933ef2c55","lib/libwinapi_ninput.a":"34a426eb6ad23e4d5b6e0d947d6e10ef0dc119157d6d762be4926bfc0893c96c","lib/libwinapi_normaliz.a":"7e1b6bc02ace0c902a18244e907446411155a5fe5dbeb8f160bc5198c804266c","lib/libwinapi_ntdll.a":"3f2d8d2a13023b62c490611cb24585a8a5cafacf794e9ee5655a90678de03fe0","lib/libwinapi_ntdsa.a":"4137b9f3447a798fed0f916bcaa82d9413ac98fa1a7bc6dceaeb4e0ae7f45bb1","lib/libwinapi_ntdsapi.a":"b8671ed8ce19dc28f5daaefd891f6e621610523f180c70588764107b57ffae5c","lib/libwinapi_ntdsatq.a":"d2c39463900a5bcf52561dcac9fc8527f3a0348f61183f1b1e4e3b6e782eb8e4","lib/libwinapi_ntdsetup.a":"9d786bc32c3f4f9ad534cafdc07e81a9c375618eb6e1f342f7a89b9d1258f184","lib/libwinapi_ntfrsapi.a":"9c3095b92625fef6531bce0d2d08536f83fca0f8ee28d495f95976bbe73619f9","lib/libwinapi_ntlanman.a":"1bc7aa39f5d6bb0af7b3863d4902027af95414b9246b244d6b40c306b6dcb74c","lib/libwinapi_ntmarta.a":"cf146621e756a21cd45bb9ab5f4d8a016fa2081dbf4e108861b2b131dfde5d9f","lib/libwinapi_ntquery.a":"652de6a12f9d4bc5fe4462f1b476f1ad559d8407eafc28e0080bc59a3ad57a4d","lib/libwinapi_odbc32.a":"5d8ec8c2a587a5eb00eb8f6f08d7d7e00ed1e03cfaca2070efb1d0f4da6a9562","lib/libwinapi_odbcbcp.a":"8c99d188cd45f740a2a58ff7281b611ffdcf651be2bbb5af15543b60f872f6ea","lib/libwinapi_oemlicense.a":"bc88d3b4bb4a91945e8c288539e415d2a1ce5db6d3c342f3ec5860ba1e300df1","lib/libwinapi_ole32.a":"7ef3b297c9d0c5cdf5ed7517247829466da34fcd19d8348f3f2d6c775ca3ff65","lib/libwinapi_oleacc.a":"ed4c0afe844de194371ed21f8f2e18b48c80eb42377c143baba7e70dbc556456","lib/libwinapi_oleaut32.a":"b25824f0023161a0610e9c7d6d9731ebe7b541c6a31c34fa7bbe552b6754540d","lib/libwinapi_olecli32.a":"b3dd8c5f9dc52bbc832c7bf850a3e738ebd9de7b0fffca03b272721ecb687886","lib/libwinapi_oledlg.a":"3ab9a3c0688897d538e66926b1f01ad88719ac959fbda99be2f661baa9c24097","lib/libwinapi_olesvr32.a":"cb7cfb28a777c5f9e8cde3067d98fad5ccb3526acc5d9bbdd5d2d1bf981c37e0","lib/libwinapi_ondemandconnroutehelper.a":"0bcb234cde4260ffce27aafb540bd893cf99415dfc9ebf1060876e06987fbfa9","lib/libwinapi_onecore-api-ms-win-core-atoms-l1-1-0.a":"0812399abc86ab0215582f2f91886652038a12af419cbeadf0a1ae52168f5467","lib/libwinapi_onecore-api-ms-win-core-calendar-l1-1-0.a":"74994ed6e3beab0a6a2a7ac5c47c0f965305447c1a94db08c9475be3918dbd34","lib/libwinapi_onecore-api-ms-win-core-com-l1-1-0.a":"11a832d46628bf355e710643dbf7a4497fad47b22c2a5510fbce5bd1619fba05","lib/libwinapi_onecore-api-ms-win-core-com-l1-1-1.a":"553270f375f8be0fc596cb2e1435cc96b54a8270cc2898d6118e926c7a4131e7","lib/libwinapi_onecore-api-ms-win-core-com-l1-1-2.a":"94ac798c39cb9beb94082a6a62d55cf28a1122d3d81e982f2727a5548e96d27e","lib/libwinapi_onecore-api-ms-win-core-com-midlproxystub-l1-1-0.a":"000e19cab23d0aaf80f3d0421f217df0855fe6406418d898261125947c806b30","lib/libwinapi_onecore-api-ms-win-core-comm-l1-1-0.a":"c2f2465b2f801de6e60611e2341b7f6fd5816042fb0406edc8d6c283331b70ff","lib/libwinapi_onecore-api-ms-win-core-comm-l1-1-1.a":"512d357839150ce54a7e49d33f51492015a553babdc33cb4f38a60e61f6ae5d8","lib/libwinapi_onecore-api-ms-win-core-console-ansi-l2-1-0.a":"6aaaac3062b71b8c27397b362d1cd37f5ce0dd95bbf59f8993498dedfc960f4e","lib/libwinapi_onecore-api-ms-win-core-console-l1-1-0.a":"11714e54306dc6aa754da51731b711211bcce620d8f353ce58d4138e396237e0","lib/libwinapi_onecore-api-ms-win-core-console-l2-1-0.a":"e772713586ca9e3760e48d3c582742e68a06753f0f9417f9013a4393c5267fa5","lib/libwinapi_onecore-api-ms-win-core-console-l3-1-0.a":"d730564120a07cff27689d061caffe675421c109f48325a734c268afcb86ffa2","lib/libwinapi_onecore-api-ms-win-core-datetime-l1-1-0.a":"225560d62b6c7ed4cd540a98e7a13bed54860adc230390b182a8636f91739b63","lib/libwinapi_onecore-api-ms-win-core-datetime-l1-1-1.a":"aa94d82f882c7de0ca31a5120bd50387bb8cfb1bf46b37d667562d31a5035153","lib/libwinapi_onecore-api-ms-win-core-datetime-l1-1-2.a":"f229e2c630e9f0ed6393a116562b55f32a9eccd82db8ae7bb7dc59da6030d711","lib/libwinapi_onecore-api-ms-win-core-debug-l1-1-0.a":"e9a5c6d8fa217a81afb3265c8eb25d879f714974bc8893f3487ea82b996bf19f","lib/libwinapi_onecore-api-ms-win-core-debug-l1-1-1.a":"3ca35a5579d682998fd8165c7297e7897e878d314d8e4d36c9cad977b1bcf16f","lib/libwinapi_onecore-api-ms-win-core-debug-l1-1-2.a":"af5b2c57682045533e88c3b0cc2f135a18a70e92f1aef01d63d7004ec967e779","lib/libwinapi_onecore-api-ms-win-core-delayload-l1-1-0.a":"99f6670388088ca1887fb5dd1c9137431bda35f9a745c2a1c44c799aa48644d5","lib/libwinapi_onecore-api-ms-win-core-delayload-l1-1-1.a":"f573eb9a19338214d65bb2761ef980505f8e2c5baa1dd12e7c5b42ece09f3c49","lib/libwinapi_onecore-api-ms-win-core-enclave-l1-1-0.a":"3cadda78b2cf277479cb4a02e46239cc21758571f3624e95eada3f7ed1bb2cba","lib/libwinapi_onecore-api-ms-win-core-enclave-l1-1-1.a":"dec9e42133f0bee3d7401ef0b5047b4f256a9e04a93e009a6bdc74b604815b33","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-0.a":"3bc506d06a39131955c3b4e29649f46ab06151c3fa4fedbf869d8c679530929f","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-1.a":"14799617aaf44690708c4fcfaff49a70e773fb9b8943b88211a96c26f1a01280","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-2.a":"52c25a2c52724b98857d34dc5aad36282823fbb932e51f86c9d5712d9aec5df2","lib/libwinapi_onecore-api-ms-win-core-errorhandling-l1-1-3.a":"252bb3e39ed81e47c3f149119859ec65ceb2d1e65e7288e0a0bd0f552d56b597","lib/libwinapi_onecore-api-ms-win-core-featurestaging-l1-1-0.a":"e2df929933e2c413b3b8dd9c9f16abe5e2543ba89b9cd74a427a10a759453220","lib/libwinapi_onecore-api-ms-win-core-featurestaging-l1-1-1.a":"04cd671c6e0dc98b930c832db1c26a90a49c9073b8051dc23817cb56c59c559f","lib/libwinapi_onecore-api-ms-win-core-fibers-l1-1-0.a":"36501ad8bb5fa4f78dd28471ceb93b98e211c1dd550c0e3466ac97470fa7a3ff","lib/libwinapi_onecore-api-ms-win-core-fibers-l1-1-1.a":"0337bae492fd8e18731498095ac2a0ce523fe048eeff4d2159b4704bba32d7ad","lib/libwinapi_onecore-api-ms-win-core-fibers-l2-1-0.a":"d59ddaa31a6c62b75b6ebccb0f85c6fd454e87165127b1e4bc6bd3f7493c0410","lib/libwinapi_onecore-api-ms-win-core-fibers-l2-1-1.a":"4cb5b72b4737b3c953ac5d46d6a7438745f4f0c1d0d71dc7a05f3926293d3739","lib/libwinapi_onecore-api-ms-win-core-file-ansi-l1-1-0.a":"9e7c0db27b3362214c1b2d18ae63bb4d77b66b6aa4a26e104faf176a9584da05","lib/libwinapi_onecore-api-ms-win-core-file-ansi-l2-1-0.a":"386beeddd388cfd272c8d851e1a16f70f6c2e0fd467407651f548c90edbc2ff8","lib/libwinapi_onecore-api-ms-win-core-file-l1-1-0.a":"a51ece2c03202c0abc6b8a85f1ec7a6ef459cea1d1305e87bd61820a0b80151b","lib/libwinapi_onecore-api-ms-win-core-file-l1-2-0.a":"3256c7a1b9a18162d1e087c01833decfb3b423d9bdc798d024c0181add03279a","lib/libwinapi_onecore-api-ms-win-core-file-l1-2-1.a":"0cc7df4c4e9b351e98f855fa535705aa2e66b57419e21f5bee873e37f428cef7","lib/libwinapi_onecore-api-ms-win-core-file-l1-2-2.a":"d10c5a1bb1ea57a670cdd1963cee2634162e2609b603f13f0540ac6820d99639","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-0.a":"6c280211556cbea0f974ae0184f97d9d77062e2005068f017db1a37355acd452","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-1.a":"11199d60fb9f6ff631401da8add46a90420c36bdc5fa9f775026984c514ce1f2","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-2.a":"0e33bd2b47ab2abd61e9c8192b5bd6b74b709aa88eac9e6543e144435c233ab6","lib/libwinapi_onecore-api-ms-win-core-file-l2-1-3.a":"51f3f8a48bdf98220863dd08254cf13bacd3565b775c277a579a995b42ef8511","lib/libwinapi_onecore-api-ms-win-core-firmware-l1-1-0.a":"0c5ba3b62f84a3c09f9fd96d7cfb095c32ea239945df75105b8ae3c8d4d68d5d","lib/libwinapi_onecore-api-ms-win-core-handle-l1-1-0.a":"5274984398f2722c8bd9de4379f861dfb459e9996adb161161f097477a12996b","lib/libwinapi_onecore-api-ms-win-core-heap-l1-1-0.a":"9b740168c4b0c590322d58c04a4a03399a6fa5a4fb3417c7a22d536b13d62258","lib/libwinapi_onecore-api-ms-win-core-heap-l2-1-0.a":"3cb8d04859c3d52d7fca1ec72ce333dc80f57edd6d6a2e4469f906572af2cbfe","lib/libwinapi_onecore-api-ms-win-core-heap-obsolete-l1-1-0.a":"a46949618369e6ca98b4ecbf9a7ba11e0a499875a57b7d3823e2d47cdad51ed7","lib/libwinapi_onecore-api-ms-win-core-interlocked-l1-1-0.a":"ef84da9b01bd67d9ca5e4cb6e7cb940b0c87e328433ae21622493cfba643bad4","lib/libwinapi_onecore-api-ms-win-core-interlocked-l1-2-0.a":"f1885d437d2c71a165dbe1acec1004e9c0e46d867b99c98f2b8672ba3fa65d0b","lib/libwinapi_onecore-api-ms-win-core-io-l1-1-0.a":"00e3af3b885ebe7168dd41ed22ce70ed0d86c8b3e177d5e75cfdea6b7c58f10a","lib/libwinapi_onecore-api-ms-win-core-io-l1-1-1.a":"f625df3356c5b38ee99a3b333b64711e44a624994995a9e10934668df93097f9","lib/libwinapi_onecore-api-ms-win-core-job-l1-1-0.a":"ee0ac0735a10054b65f4938215d7e41ef644f9b2e5e81af6659868673c318cb0","lib/libwinapi_onecore-api-ms-win-core-job-l2-1-0.a":"903ea43d84e08de9d666196caa15153b08e662a928ee2e18215833fea3c11f39","lib/libwinapi_onecore-api-ms-win-core-job-l2-1-1.a":"37c8fa3a59f8f90ecefed722ba2c803b9673f3946d0ad978ef9a0de85399f448","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-ansi-l1-1-0.a":"0866b4788c59fe3bffdc96eef646b2f478ec36d24933fbaa8a8f33f92f97e428","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-0.a":"c81e555151a68d16ff8e04ceb9683c0d892ac05194a4d69819c60e5ac2c7a764","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-1.a":"f53901accee09d4bb6a1a9cd9bbe02b7c064885c4134e7ba41921264a057d1af","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-2.a":"2da3e0c1b26cbed327d20ea42595819e6c4f35ddcf891539adb76c222a51572c","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-3.a":"95c16a2c24de3bc76574937ef81202d79506a8cd02ac9fad8ed0b2b8cc6b4986","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-4.a":"fe9f7eabb02c5db5bab6f22e76843e93b9a7a1885435ffc51a50e5010bbd584b","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-5.a":"adc4ccf4230b51f7b8a52af5076f9a236817234dbdcfcf3d4268c35d9601b982","lib/libwinapi_onecore-api-ms-win-core-kernel32-legacy-l1-1-6.a":"b758191d8a9d730f571b6022d466ddefa3309ac2980a4da350bf48ba424386d8","lib/libwinapi_onecore-api-ms-win-core-largeinteger-l1-1-0.a":"a22ba51cf66d25f83d07ea6eac7e7dec65c084ae74046e7247c5e3dc2e2140f6","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l1-2-0.a":"68677b52813aa0b0ea5ef424b7855f96dae57ce90df274c58d602a5ca43909fb","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l1-2-1.a":"4e39c567d18195f2ad4da9a8f0bc2b78118ebf674f2d28435c2cad4ec0f118f6","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l1-2-2.a":"09f3783f156e9aafef1513f82b111e153d4742b8060e811234d08ce4cd7f9df5","lib/libwinapi_onecore-api-ms-win-core-libraryloader-l2-1-0.a":"a690308b96b335744482dc37e8e60946ff9e2ae1010c5c35547a1f4d03464e00","lib/libwinapi_onecore-api-ms-win-core-localization-ansi-l1-1-0.a":"4f1aa0006bb4f60f02a8202006ae9e28330330f1a7bf43a5c1a84eaa55e64ae0","lib/libwinapi_onecore-api-ms-win-core-localization-l1-2-0.a":"4dd512fa973a9af26b48beb0cbaebd4a0e0fdbb86e5e39cfec515e4e59915766","lib/libwinapi_onecore-api-ms-win-core-localization-l1-2-1.a":"36b1ad3787f9e65956608eac3851959246de8440f84cb6714dce8b97bb340eb2","lib/libwinapi_onecore-api-ms-win-core-localization-l1-2-2.a":"bbb7f176f1bd373f4344722d6800b27d3aad7e47e8ab588ce204d04e616c4488","lib/libwinapi_onecore-api-ms-win-core-localization-l2-1-0.a":"ae00c55870a9b20bee701ea81e9886bb34dce92581780b12d523b46f6b2fa2b1","lib/libwinapi_onecore-api-ms-win-core-localization-obsolete-l1-2-0.a":"d31290baa301772ce4aa988d2d5b8f299c199b5bfa887fbd5473102cb3babc07","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-0.a":"5240bbda416bb5ec960f7bbf79f08d475f5506000f72f1d9cfc9cd66596a06cb","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-1.a":"bd7235df3b99350337da93eed158cca56c4e78f3642b93e3d5ddcb0e9cef34c9","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-2.a":"2e6a99934abbd9efabdcbf881a5a98aebe2fa66ad8666c8441a68255de78d95c","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-3.a":"04b4aa2f4348cdb534d9b6acb5928ad215dcbf3bfea9a722be3dd0ba9f6082e4","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-4.a":"ce3cb40fe7191c017aadadb8014e4350151566c1a8699604c104e9853c63c828","lib/libwinapi_onecore-api-ms-win-core-memory-l1-1-5.a":"7d57f64caf57b70d1f608c9c4232405203217721d20ba21addccad59a255e860","lib/libwinapi_onecore-api-ms-win-core-namedpipe-ansi-l1-1-0.a":"91cdd0ea0d8ab1b7c6a8f6d14860d465b1906dab20a087da0e056531bed9b544","lib/libwinapi_onecore-api-ms-win-core-namedpipe-ansi-l1-1-1.a":"7378bc3ed7e88fc2f6183fb98e455fd749d14eef8a4af1247625ffb187862a8a","lib/libwinapi_onecore-api-ms-win-core-namedpipe-l1-1-0.a":"556b0d07663cd467eddab9f790f0a0c74e4dab4c032a0ae2d2f9f43d7e07c9a0","lib/libwinapi_onecore-api-ms-win-core-namedpipe-l1-2-1.a":"72a85c923fc506a03ce0004e0c8b1e4e52518ee8ac820b8ebb00da4d6a3ef9d2","lib/libwinapi_onecore-api-ms-win-core-namedpipe-l1-2-2.a":"89bc3d4b973fdafec0c0d3c3f90d5aaeef251151159c492b74893dd395fd6818","lib/libwinapi_onecore-api-ms-win-core-namespace-ansi-l1-1-0.a":"94334cbaa4d5be581a2dde5355703c7fd15ca8073b782566d8723b5ab5346875","lib/libwinapi_onecore-api-ms-win-core-namespace-l1-1-0.a":"7a66ecb0556eafd9eb5df60d1f803b2b8aadd97b774f9411531a4a3a61ec6bd6","lib/libwinapi_onecore-api-ms-win-core-normalization-l1-1-0.a":"0f267f6e3eef425ac76f6e7c0bdf112093f41aaef21865658ee8f745979042f8","lib/libwinapi_onecore-api-ms-win-core-path-l1-1-0.a":"6e79e97e807cdefc677bc39f2021a72f35089a454c3f5ac7338851bad48e0e0c","lib/libwinapi_onecore-api-ms-win-core-perfcounters-l1-1-0.a":"2f58c2aa61bc159d13daacf746353279e959b2543c48f32ac0c848eba2a66c53","lib/libwinapi_onecore-api-ms-win-core-privateprofile-l1-1-0.a":"6bd0917eb64474d9759928e9a8573bfad27ce0100b5d0b135e6fd8764dec52bf","lib/libwinapi_onecore-api-ms-win-core-privateprofile-l1-1-1.a":"d99e384c885a50e3eaa338fdd3622b203f3be5bb27963ce885ec43def000e887","lib/libwinapi_onecore-api-ms-win-core-processenvironment-ansi-l1-1-0.a":"324b59dceb78356919f696843114145930f8c4e8f9d927a7bd7bd1b4ce29ab11","lib/libwinapi_onecore-api-ms-win-core-processenvironment-l1-1-0.a":"446fdd1a3f8d9e761022248c8442e7c9db0950e50eedbb9ee7839c10cdd021ce","lib/libwinapi_onecore-api-ms-win-core-processenvironment-l1-2-0.a":"94490242107b24a541305dbbd617e8b04619ea688e28269ab0a685daec51a054","lib/libwinapi_onecore-api-ms-win-core-processsnapshot-l1-1-0.a":"c4556ba06d127b26cb13af4c60f5a35a13e7ff78ec63fcc2e5a7f0edd13af81f","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-0.a":"ace2860be9a90df5c430acbfaed6054a27a978f9e98f4a0604ee4b2796982741","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-1.a":"1234e12026f9f68bd59227aa20c5be4324d2f04eb9983a8fc99ab8e8dd39a8ec","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-2.a":"7fca19a6df8946d2be7f55ebdcf85cdc6a267b9ef5bc9fa26f47867d3fa4c132","lib/libwinapi_onecore-api-ms-win-core-processthreads-l1-1-3.a":"909e60143db5394c1207eaf8ceddc6df9be08cf595e012611d1f3f5211cc53bc","lib/libwinapi_onecore-api-ms-win-core-processtopology-l1-1-0.a":"d1143e676ad231352b8b00bed0b485091860bc3ce6f5e0f8b137a3580ea3d4c2","lib/libwinapi_onecore-api-ms-win-core-processtopology-obsolete-l1-1-0.a":"ebbe6e1ba85d1433cf9d9026e40a104b102241ebf947c025a4859e91e0694343","lib/libwinapi_onecore-api-ms-win-core-processtopology-obsolete-l1-1-1.a":"e119951f4458646e6ed9c43bbb8de80e7036e62ff455f98e1a9aee25d2e28cd6","lib/libwinapi_onecore-api-ms-win-core-profile-l1-1-0.a":"e85b0a4602e1e77c8de8bdf7f9e9b13e57240d1496e28304d9e8a092e4e1c12d","lib/libwinapi_onecore-api-ms-win-core-psapi-ansi-l1-1-0.a":"98fd2d3982e8e4713beb48f99974e73fd544cc4c2aff54e50109db2a07c14e15","lib/libwinapi_onecore-api-ms-win-core-psapi-l1-1-0.a":"bb00b81fd4fb193c85a6437b7ee986cf2e60362fb32831ca88f7dfea345c29e5","lib/libwinapi_onecore-api-ms-win-core-quirks-l1-1-0.a":"dfd8122b210a76758087e8c07b1ecc52f869d615d98ba3e4e76a90005448d5b2","lib/libwinapi_onecore-api-ms-win-core-quirks-l1-1-1.a":"b3b71a4db59b0c5419869cb5cf92c14fc17381b110b17cd4cfc8f5c4c74479a2","lib/libwinapi_onecore-api-ms-win-core-realtime-l1-1-0.a":"ad90128213421e6758c154b3e84c259dfb6d04db1986926342258a933266684a","lib/libwinapi_onecore-api-ms-win-core-realtime-l1-1-1.a":"1684a81e385a25f8690233b4b2e66695a955b516bed25c0da4ee59ddae5e79ce","lib/libwinapi_onecore-api-ms-win-core-realtime-l1-1-2.a":"bd31c35d7daec22904c6f08ed6ff684eba9b8e0f1b51ab22c60aa41667b4c3ec","lib/libwinapi_onecore-api-ms-win-core-registry-l1-1-0.a":"75e7e87e3f11ec241326ee839455f3e347771d56649390ffccededc021ba543c","lib/libwinapi_onecore-api-ms-win-core-registry-l1-1-1.a":"c20fbea2b3cdbc0226a08468a264354da50434ac664c737496fc9d6c9f84e2e1","lib/libwinapi_onecore-api-ms-win-core-registry-l1-1-2.a":"750b3188270989da73a237cb9a0d1f50cdc9e14711076161882f909bc98b0b5a","lib/libwinapi_onecore-api-ms-win-core-registry-l2-1-0.a":"f01e53c0fc755a96177623988e55f1b90cfaa5ab461ae94a30522a52a3cc626e","lib/libwinapi_onecore-api-ms-win-core-rtlsupport-l1-1-0.a":"ffe64e3fe1cf8b31250e77499e0dc7a7effaa0e9c8975affeb23cc6ad9e62e1a","lib/libwinapi_onecore-api-ms-win-core-rtlsupport-l1-2-0.a":"b9bcba8e05a69402ed0d42c42d9f3a0b02a78f049a3414866c4cb612e52d3d44","lib/libwinapi_onecore-api-ms-win-core-shutdown-ansi-l1-1-0.a":"1378aebbd3383751ac51943e258afe8cec4ca0642a7de787eabb867900beeeec","lib/libwinapi_onecore-api-ms-win-core-shutdown-l1-1-0.a":"8415bd37b28325d9f12ba022ecad9cced0a1a53cb98bd2d7bf5ca08f434af9cb","lib/libwinapi_onecore-api-ms-win-core-shutdown-l1-1-1.a":"5a386dbb47081c4835d4c712b5530c7ee8d2307d0d04c85d473011d20933826c","lib/libwinapi_onecore-api-ms-win-core-sidebyside-ansi-l1-1-0.a":"4694382000fbb05b54077132f0a5022a90a2eedd7973fa9d6e73ed71cb1a0350","lib/libwinapi_onecore-api-ms-win-core-sidebyside-l1-1-0.a":"95cb9ab35d06338b411cd22232df3f4ab7ef0a10782859f5bd861a2d3762c6b6","lib/libwinapi_onecore-api-ms-win-core-string-l1-1-0.a":"6d104770540533f00fb9b96ee8416a86483c692bef598804a55d73a8b7c56130","lib/libwinapi_onecore-api-ms-win-core-string-l2-1-0.a":"099570484acd8b263271b80cd6027f1a0ae98d2970acd686f63db6790834a55b","lib/libwinapi_onecore-api-ms-win-core-string-l2-1-1.a":"6f1090d7736991cadfc84ee9a6bda4410059142255d338990d3065d335e3de85","lib/libwinapi_onecore-api-ms-win-core-string-obsolete-l1-1-0.a":"cf77b087474ef60964614f323df7b94cc3f2a915860a7543ff3f35d9e773718b","lib/libwinapi_onecore-api-ms-win-core-string-obsolete-l1-1-1.a":"934ab5b1cd5a2a1bacb740e06d7bb028845d17185775106ee02456320d154c87","lib/libwinapi_onecore-api-ms-win-core-stringansi-l1-1-0.a":"5fe3329d1602f505c2336841d3984b3a894ad551dc4a0935d08035fa85d1e4d3","lib/libwinapi_onecore-api-ms-win-core-synch-ansi-l1-1-0.a":"65d6ceb10e4bcd2d49e539f2cd92e0eb598a74ccddff21b72c55d184b9eda1f9","lib/libwinapi_onecore-api-ms-win-core-synch-l1-1-0.a":"ed400709404d9f5a06929518da72eb212768ff315c08a66a07f3ad2b40a04310","lib/libwinapi_onecore-api-ms-win-core-synch-l1-2-0.a":"3eec255608b4a09359e6213d3222fe2bf21a6eb3584e2efa40bdfeae1ec2eef6","lib/libwinapi_onecore-api-ms-win-core-synch-l1-2-1.a":"7795df40583158c625c53dbc6a567ac6074fcb89524207233915a42e6b192842","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-1-0.a":"540a4ca86c9a10b5279437858fe0b8aa3265ada2c362ef60adfdf4abd8617fc1","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-0.a":"ea94de89764b714a3b8ed0798f727699172cb496b91eaa217afa064def19d268","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-1.a":"6f20ed61a65bb14ca16df5c3036cd919b5a41cb437b8b685a0c496d794255d5c","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-2.a":"5400ee8df09fa91470514c59b0c2d3862f19ec17c2ac53ab7cbeafef87e53a89","lib/libwinapi_onecore-api-ms-win-core-sysinfo-l1-2-3.a":"3c261a651b256e46bfa7bc518ab3c13783b3347ebcc8e02605f602d9ee0da1c9","lib/libwinapi_onecore-api-ms-win-core-systemtopology-l1-1-0.a":"a622795b6f3ba89aac17004549109f56eabaac6ae39ab3a92bc036210c3c39ec","lib/libwinapi_onecore-api-ms-win-core-systemtopology-l1-1-1.a":"0c4a4d58b42e982a269654a9b2a532f365e6ef6c2008dd30d4a9d255f3d24f1c","lib/libwinapi_onecore-api-ms-win-core-threadpool-l1-2-0.a":"cad2d51ce58c2ebeedad4cdb2d5cc5fe29fd4541d95a506185c40ea05e0782ef","lib/libwinapi_onecore-api-ms-win-core-threadpool-legacy-l1-1-0.a":"8034dad817b3b416added42802f7113a4ebe3262d22caeccbe436915a59e1df5","lib/libwinapi_onecore-api-ms-win-core-timezone-l1-1-0.a":"7e0f32bddb29e8243718fdb75d0484d6ab22ff190bc18464106f2f36984ba71a","lib/libwinapi_onecore-api-ms-win-core-toolhelp-l1-1-0.a":"5bb0e5476698fa8705032534cf4a14dc78967966b0d85f73b4ac6a47f683d173","lib/libwinapi_onecore-api-ms-win-core-toolhelp-l1-1-1.a":"406e1630f1f21547269a90b3d924320f21b0283a852c63be6e219a24489aed3f","lib/libwinapi_onecore-api-ms-win-core-url-l1-1-0.a":"a7fd5be6b75d6331126d56347a04f5325999d768dbea3fe41765bdbfab15a393","lib/libwinapi_onecore-api-ms-win-core-util-l1-1-0.a":"b373c42a81ed6e05ef9f6974d02d84b7a62f05982c6c91d2248457b2e75d7c58","lib/libwinapi_onecore-api-ms-win-core-util-l1-1-1.a":"318e7f0eb69f65a6541c73604ccb86acea6b8a057e2e3f2b992d7d5251c73ee0","lib/libwinapi_onecore-api-ms-win-core-version-l1-1-0.a":"80b563faec0b94b2c03418f91a5cbc4561b37054b70699bf931872f208e1e2f0","lib/libwinapi_onecore-api-ms-win-core-version-l1-1-1.a":"8503c18952cd31a1d98a917a4611ad9bcca9885d1b269b55ef411466d5d5d92f","lib/libwinapi_onecore-api-ms-win-core-versionansi-l1-1-0.a":"e8ebcd5e4b1d1c01315f7574af5240c107fba23655dd47e49adcb241abc5d4d7","lib/libwinapi_onecore-api-ms-win-core-versionansi-l1-1-1.a":"cc4532d656729f50dd0cf42fcbb8d6cb4023803afbd3c6ccb71543b1a54ab472","lib/libwinapi_onecore-api-ms-win-core-windowsceip-l1-1-0.a":"3f7c40c879b153cd9f66bd4c18137ac0d6aafeb17ed157439beb8f8591a3edd3","lib/libwinapi_onecore-api-ms-win-core-windowserrorreporting-l1-1-0.a":"cc4059edc72485280ce47980ae015ce4152f621367897065b2cb9a5509b235fd","lib/libwinapi_onecore-api-ms-win-core-windowserrorreporting-l1-1-1.a":"b1abe2529852fc309b692bea80d8c60611a40f48068ea6a9e7f19134611501a2","lib/libwinapi_onecore-api-ms-win-core-windowserrorreporting-l1-1-2.a":"ede7bf4ecfad8d0a9fc58fddd308b06ca815da52d6177cb531052c549134684c","lib/libwinapi_onecore-api-ms-win-core-winrt-error-l1-1-0.a":"3c2c0ca0e39ea6d7e376ebf309020ced4d2222975a33ed95547e4dd161d39f61","lib/libwinapi_onecore-api-ms-win-core-winrt-error-l1-1-1.a":"df55987015d91bbd5dd22763b011ad3f78dcf78fef76ce019a96d694361b9f24","lib/libwinapi_onecore-api-ms-win-core-winrt-l1-1-0.a":"4685cde798ecfc1e51915ef4c958f506dc881ffcbef15d544b9e6d3cfa973b4e","lib/libwinapi_onecore-api-ms-win-core-winrt-registration-l1-1-0.a":"7f777f480dc4be64729cc3675029b92bce019d498f6f70f05b32b9cfdcd416bb","lib/libwinapi_onecore-api-ms-win-core-winrt-robuffer-l1-1-0.a":"678aeed581412d7f57d7f5952a3fd26711743a0316c13c048b225f93dc416d63","lib/libwinapi_onecore-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"2d490f02015684e8bdc4513d0e98a0f4e2a7a137d4707b680d496fe32d5b08b5","lib/libwinapi_onecore-api-ms-win-core-winrt-string-l1-1-0.a":"17729e054168b9fff9d59aa70808e237561bf6bf6681c7c9a254e40e05a3dd8e","lib/libwinapi_onecore-api-ms-win-core-winrt-string-l1-1-1.a":"efa6a01c28f7087c559b2c3a62d89c2349f31b4bf26ed5b3bd96481852315ac9","lib/libwinapi_onecore-api-ms-win-core-wow64-l1-1-0.a":"eb8473b785c6f7a15c73a46f08b8244c3b50096464555bea8cdf5d97150d20af","lib/libwinapi_onecore-api-ms-win-core-wow64-l1-1-1.a":"a2580ddc6724143c43623d5a8616a631fce81b215537ea01a7debf0a7d0df4dc","lib/libwinapi_onecore-api-ms-win-core-wow64-l1-1-2.a":"0fb50f5b9fb8db51e3b10fa2751ce2d13c15a11476049062a7d765c82e296cb3","lib/libwinapi_onecore-api-ms-win-core-xstate-l2-1-0.a":"59273163fbd4bf35b5c77030b8eeb90deb24400690c3709497198e4bc82fa2c7","lib/libwinapi_onecore-api-ms-win-devices-config-l1-1-1.a":"56cc37d116f3b1c33f994507e20745702f160576f6f2405cc96eb501947aa6d0","lib/libwinapi_onecore-api-ms-win-devices-config-l1-1-2.a":"4c09217fc1f3e02608a71a36374f484697f7f7b7b4358be96653e6e3bad62234","lib/libwinapi_onecore-api-ms-win-devices-swdevice-l1-1-0.a":"0900989505caab7232ed73b5226dcbc30aad0c8a368ba6e8d733005c7f29b5f8","lib/libwinapi_onecore-api-ms-win-devices-swdevice-l1-1-1.a":"97c280911041c2f23ddfa24495d6c93f3e1184a732c05d3e6c873bbe67bb00ef","lib/libwinapi_onecore-api-ms-win-eventing-classicprovider-l1-1-0.a":"15b91234bd09670b2568c5e7b55b4aec80973f3b202bf59825437c60b37b45f8","lib/libwinapi_onecore-api-ms-win-eventing-consumer-l1-1-0.a":"502d877f0201f26732fc4a248049104e795b9f9f092d3b3f386ee148393da278","lib/libwinapi_onecore-api-ms-win-eventing-consumer-l1-1-1.a":"8684bb1e5507cf59e72cdb6b5c6adf60763657da95cd10207a72043e582e533d","lib/libwinapi_onecore-api-ms-win-eventing-controller-l1-1-0.a":"090323e98c1beda70440b499b27c360f8302e0ba5ae1fab8d48ba0f3037cb349","lib/libwinapi_onecore-api-ms-win-eventing-legacy-l1-1-0.a":"fc67ebc5ac0848e4a33266f88f6d78c5b4b86f52a43a909449d9f17cd44a85de","lib/libwinapi_onecore-api-ms-win-eventing-obsolete-l1-1-0.a":"9c3d8b7093047bb97af5c27b5094a85b4782dd40a65e4d09c32bfae29504b341","lib/libwinapi_onecore-api-ms-win-eventing-provider-l1-1-0.a":"9d083184f86b32bbf9f39339c8212db340bcc7204752749b91baba95ee0613d0","lib/libwinapi_onecore-api-ms-win-eventing-tdh-l1-1-0.a":"591aa0488133e53750db593dc0b5c1582dd1edddce9b3c07c645196bd15d80c6","lib/libwinapi_onecore-api-ms-win-gaming-deviceinformation-l1-1-0.a":"ac2eb3fedac7b16eb1137872aa10b3afda45f28a32ee7aa8f4e925014830c047","lib/libwinapi_onecore-api-ms-win-mm-time-l1-1-0.a":"8d31f4c9ce21d88d0331e1d721b4cca1e4dbedf193205f06ea857d2009367e7a","lib/libwinapi_onecore-api-ms-win-oobe-notification-l1-1-0.a":"65d2fbbb95fcb8a3b9dd3f383f3512a0ce4184a6e55168da3c43f2ae4de2f5d0","lib/libwinapi_onecore-api-ms-win-perf-legacy-l1-1-0.a":"f7dcae744e4e547b4c03974cda3cfca00b4c2eded5d288a01b622b1f1c8dee0e","lib/libwinapi_onecore-api-ms-win-power-base-l1-1-0.a":"ff1ff30822a8ae0489f71da371548569fd77c9d9fc7545090449a46c5a8289e8","lib/libwinapi_onecore-api-ms-win-power-limitsmanagement-l1-1-0.a":"59f2e3ceefa32e21b581421d8f53e4c6fdfda9cd9023d59a799e74d887b7d692","lib/libwinapi_onecore-api-ms-win-power-setting-l1-1-0.a":"0b429639fea442d6355d39b873ab8f2a4b434da2584be7813e4342a3029f2cf1","lib/libwinapi_onecore-api-ms-win-ro-typeresolution-l1-1-0.a":"349e6ca3c5b4bb467986317ba926f4a758384fe307229509579eabd973ba5797","lib/libwinapi_onecore-api-ms-win-security-appcontainer-l1-1-0.a":"2d2c1cb17bff1c13883b801aa7670f1794dd6035952427f50791c46090967d07","lib/libwinapi_onecore-api-ms-win-security-base-ansi-l1-1-0.a":"8369a1aa014110ffba11e84e0700c0006f9408677a4642bd1d4b9ef122734b21","lib/libwinapi_onecore-api-ms-win-security-base-l1-1-0.a":"00af2a7b42aadd401a9d8365ed0c8b544bb8ac62ffb2575c0611fe52a0eb77db","lib/libwinapi_onecore-api-ms-win-security-base-l1-2-0.a":"c0e7042956cf6bd167299086cbe250445a398f00417b5867a072c2a7a53cad56","lib/libwinapi_onecore-api-ms-win-security-base-l1-2-1.a":"1c74d3623c867e670dd3a43f6d9604a294d49ca10c8b584736775f988b7d7be8","lib/libwinapi_onecore-api-ms-win-security-base-l1-2-2.a":"e4ae626216830d21353522e0505d97bb41432a50798bb9ae2695ee4ea2d734a0","lib/libwinapi_onecore-api-ms-win-security-credentials-l1-1-0.a":"e2144642234de5f25bae8b719fbdccd34f0e83c7095f3909484f6bb572b8cd5e","lib/libwinapi_onecore-api-ms-win-security-cryptoapi-l1-1-0.a":"fe82598cf64786f69ebbe50262c92ee2e47303965cabfd46dddf52d3c29b3181","lib/libwinapi_onecore-api-ms-win-security-isolatedcontainer-l1-1-0.a":"eafca150987c4555dda05254c24454d0c035678d9dd9874a53e75614e32cbfe2","lib/libwinapi_onecore-api-ms-win-security-lsalookup-ansi-l2-1-0.a":"83b8bfb3724bfec221da2d5375675c1d972c1f65c88ce76260b4cce04ad0a90b","lib/libwinapi_onecore-api-ms-win-security-lsalookup-l2-1-0.a":"b3d93de7b83c76989e5be54a88fef493788b42e0269cdddb2035af5157644ab4","lib/libwinapi_onecore-api-ms-win-security-lsalookup-l2-1-1.a":"196fc35c8341a1e6964e164d98bcc1c1865f7751fa9b0f55445b885348d40729","lib/libwinapi_onecore-api-ms-win-security-provider-ansi-l1-1-0.a":"4b0f69acab66ce2afae8ed1a3bb44def669c3ec3e79eb1bed600eb66a8f5510c","lib/libwinapi_onecore-api-ms-win-security-provider-l1-1-0.a":"3607832456f9dc634c54f62f9015f6367a39c98545d0d1b60d76a2cb625ab38d","lib/libwinapi_onecore-api-ms-win-security-sddl-ansi-l1-1-0.a":"1b9998bae9a3f0c528cf798bcf8289912bd2747b1036739f3a421b9903e5008a","lib/libwinapi_onecore-api-ms-win-security-sddl-l1-1-0.a":"46452b33c2b9072de7931697b171c2f1c3a9f59184a1a7a728c4476a71612a95","lib/libwinapi_onecore-api-ms-win-security-systemfunctions-l1-1-0.a":"05f8bf2312e31fb15777f123e78be2635e99e9c8400bebf6858420990d82b24d","lib/libwinapi_onecore-api-ms-win-service-core-ansi-l1-1-0.a":"a214ee3ca07f06379f6ed1e7fe8492acade3dbac987bb9e05762ad61401477f4","lib/libwinapi_onecore-api-ms-win-service-core-ansi-l1-1-1.a":"1db42bfbc9470319a9e8fe161b22e174b06ef2f2ec2d98b3e6855160fd6d584d","lib/libwinapi_onecore-api-ms-win-service-core-l1-1-0.a":"963d16a443487762259857c127a1e93b455bdd659c831d601070d84fc165b597","lib/libwinapi_onecore-api-ms-win-service-core-l1-1-1.a":"381be039e2b937716a9378b04811b7f2d203043355aa0a6d665e60a16030a237","lib/libwinapi_onecore-api-ms-win-service-core-l1-1-2.a":"535892bc1cbfb57e6790d29dce29762de300187bf6711c129994360e8bc1af25","lib/libwinapi_onecore-api-ms-win-service-management-l1-1-0.a":"4676abab985cdcc5bfc05793431085ce090755767dad44e9d0f56917042161db","lib/libwinapi_onecore-api-ms-win-service-management-l2-1-0.a":"03e0749be1872a53c158eef8b9dcba7edef537034f82950527fc2d078e798e7e","lib/libwinapi_onecore-api-ms-win-service-winsvc-l1-1-0.a":"8507ec80f896c4cd292135beb33a39fc206873df7b0f85aa4efabacccd7965d8","lib/libwinapi_onecore-api-ms-win-shcore-path-l1-1-0.a":"03ebefd78e4e29d993adfb90e5adb2e674a91777d9e05981d7212fd515e2ae8b","lib/libwinapi_onecore-api-ms-win-shcore-registry-l1-1-0.a":"dbf5f6b9e2c97a864dc064ebbbf34ee7f4c876fe50791894fbb825007bc41698","lib/libwinapi_onecore-api-ms-win-shcore-registry-l1-1-1.a":"0b2d927ced5e272176d05ae2abfa458c2c1e8e1c7d402f3dc37c3b7cc113ff57","lib/libwinapi_onecore-api-ms-win-shcore-scaling-l1-1-0.a":"29c15701fa34edad9f07ebc62844ff8e0c7da7eb7879c2dcf790656729648657","lib/libwinapi_onecore-api-ms-win-shcore-scaling-l1-1-1.a":"823bb058035b58960d43dca45129e1c2d89c302281735e9f7397c3804700c98a","lib/libwinapi_onecore-api-ms-win-shcore-scaling-l1-1-2.a":"bd89d9adea94b9f60b74164b5c1c5552055263649399acfa4740d0326bc6fad5","lib/libwinapi_onecore-api-ms-win-shcore-stream-winrt-l1-1-0.a":"998dd225c130263e62b1422f1c6a07b9d6d99e761c80c2f4a22104f635166e86","lib/libwinapi_onecore-api-ms-win-shcore-sysinfo-l1-1-0.a":"ffb5112c8111c6f53c8d40f28833f9cd9b3e7f1037b6081883c9bcf956654406","lib/libwinapi_onecore-api-ms-win-shcore-unicodeansi-l1-1-0.a":"a6e0a2beb10da108f4346e44e551b65fb117a3b30db64d1dcbefc07dc498aced","lib/libwinapi_onecore-api-ms-win-shell-shdirectory-l1-1-0.a":"21d0bdfc474eea6cc0d54794591e7dffa35e3cbd46100d2d0c9af0d5fd9ace20","lib/libwinapi_onecore-authz.a":"49a58f5609fa0cce0ea9264c9e84e1901675696685a74a9e747a3924c63fbf1d","lib/libwinapi_onecore-bcrypt.a":"717fed5354b9505899ad794a2c9c01aaba0e566deaafeec46d6719b74c583ea7","lib/libwinapi_onecore-cabinet.a":"12116c8eb10af853d0e8154ae7cb0b53b4240a5084115fb24d82df6f13cbd9fb","lib/libwinapi_onecore-crypt32.a":"2319a22c1112ef3bc4f7992812945ef87593e4e42a1e1a72c70d06a30e9170af","lib/libwinapi_onecore-cryptbase.a":"acf88705ff0ebd208c17547ff41b35b5f489f59e4c37f5c8e31638dd6ca4ffb2","lib/libwinapi_onecore-cryptnet.a":"c3ce7255256fd6f0feb10879ea437c8b1caf54854d19e4c43746dd02924c39b7","lib/libwinapi_onecore-dfscli.a":"a1c83b4b2eeb361dbd82e7aa806182caa1f7386049b512764fa2b100f648329b","lib/libwinapi_onecore-dnsapi.a":"19aa00039284a9963e3e7b93f06e9f6f22f4e2f509d892bb91511b83925f9de9","lib/libwinapi_onecore-dsparse.a":"360b6e2a94e4e3f00917c4355b3181b97d965e3cfd567bf771c5f553b1e44252","lib/libwinapi_onecore-dsrole.a":"e44f0a3c7c012f3ff6e1a9074569939a596459ce865a32f346b2f192d80ec561","lib/libwinapi_onecore-fltlib.a":"431ce9d5a8a04b4538bb78e9f022720ed937c7aa255a32a803723225952d2832","lib/libwinapi_onecore-iphlpapi.a":"aafd64df92275cb714a16e5e7c3b89098c8a9b7222dd61986a6861d2f31adc00","lib/libwinapi_onecore-logoncli.a":"1a7b0a7cbe4427c403656addaff583ffa46cb3d3b21e8a293f9d36dab8e6fb71","lib/libwinapi_onecore-mpr.a":"d9851af2203bd2e135bfdcf07b30b699bf359e2552b580177c047bfc83ec4aba","lib/libwinapi_onecore-mswsock.a":"25311be32bf6762e7ce0afbbee1dcabd4d0671f25eacc81ef0df1bbda038673e","lib/libwinapi_onecore-ncrypt.a":"087dfe8b0de2be412397868c6ac3c22302f5062c49a35adf02049bfc39d7466c","lib/libwinapi_onecore-netutils.a":"a438a3673029c25ec1b11c518bb1f5998b8306df0aa57e23b860013e84c6536a","lib/libwinapi_onecore-ntdll.a":"ff8d3e71e411a1d8f93b62ff37e5aee91fc1141bb4a2d341c95badbfbfda8a71","lib/libwinapi_onecore-oleaut32.a":"bc4eda49c1613e15278f4d8a3f60aa01c59a871ad839d72fff3e93bad379552c","lib/libwinapi_onecore-powrprof.a":"ded544f89c79bbbaac63283a479bbfe0f6eda8695e3f03993538f837228586b9","lib/libwinapi_onecore-profapi.a":"58f6975302c178463b97388f58d13b5761a546c9d5d17ec77645c1a3c6196a06","lib/libwinapi_onecore-rpcrt4.a":"ed8143d7a2ebefad19460a937dbe08381346a208fc56bdc179f556385f44c2f5","lib/libwinapi_onecore-samcli.a":"3b4e5e362a4f4ca2cf09c505ade1feb5adef669c4d0e39a6efa0e258e4a45ab2","lib/libwinapi_onecore-schedcli.a":"f5d15c598ec6d8716457523b86d41ddfd012aed591f17237bd4190c1f22f7360","lib/libwinapi_onecore-srvcli.a":"fda98b9f248725979155b3bcde4118475bbeb9ac20b949632b6e25f81004e787","lib/libwinapi_onecore-sspicli.a":"ed3f3ca04a6b5b0f3c83785e40d75d9d73f4d5907c2ac62b90b0d37c304c2be2","lib/libwinapi_onecore-tokenbinding.a":"1fec2c3a85c528c8ac756c2b590446805886ce333de57fcc24a29f976177cf27","lib/libwinapi_onecore-userenv.a":"aa8e86961ec9dad96e8af293b535b18e43779cc99cf6a3262cc6ca96c18a91c7","lib/libwinapi_onecore-websocket.a":"a3192322098b110272dc4bd604ce2d90feab14393ce444358bd7cc9c2951d2f6","lib/libwinapi_onecore-winhttp.a":"ec3c64ef5b250ec3721b9c8a500e580f0e52873a0ab3071ad9a07717e898243b","lib/libwinapi_onecore-wkscli.a":"c07edd7e8b0efd63a31ae95d776f29700d8240355bda5982aa4cba1a4903b3d9","lib/libwinapi_onecore-wldap32.a":"f98ec840c25a4682b2bf3b27d7eeeedfc88182b76689bd5aa6767aaa5b31e404","lib/libwinapi_onecore-ws2_32.a":"b188d2e13765f6de978f53389512053bd9ba79434a86bcaa78151aecd1c79f45","lib/libwinapi_onecore-xmllite.a":"20e6eb39eeee75e3ef15b9a69ad11e6d665d3163686968c1a0d1a482fb26314b","lib/libwinapi_onecore.a":"b1b438f02522fa8511e7b61620d7cbe3841cecd575f9ce2d9487433413d6482c","lib/libwinapi_onecore_downlevel-advapi32.a":"48dc1206ddb4d6340addd0a57e485c20d73df8e9472c48b63d948830aadafb14","lib/libwinapi_onecore_downlevel-apphelp.a":"d861b0c9d0a9ec3429b789c491399b7f4f05552f5558a4d962e74f9a20491ebb","lib/libwinapi_onecore_downlevel-comctl32.a":"21c56dd6d89207523a0e54fa70e5610d26dac00f5f7c09845c3d1d321f9fa584","lib/libwinapi_onecore_downlevel-comdlg32.a":"0efb7387918178f59bb1a22b819a0a7f3f4c38772f633769d981df78bad33997","lib/libwinapi_onecore_downlevel-d3d10.a":"fb03e4884e8c89b2b2594389a979df0a15788b28e70e6c9141eeb273577ab4f6","lib/libwinapi_onecore_downlevel-d3d9.a":"8a7f5a3567e085d59181f1e1f9913aad3deab24248be70d7d89ee3946750a195","lib/libwinapi_onecore_downlevel-d3dx10_47.a":"da96a15d9ed6f5fc08a9fe19d4c1284af3a31714c9bcf7a90eb3607cdfc29dd4","lib/libwinapi_onecore_downlevel-difxapi.a":"20d592d0b07b753c35555e5aea48b71f199273e4cd41fed4d30e770cdb731dab","lib/libwinapi_onecore_downlevel-gdi32.a":"3b45e6f50209f32b1b00c222e57376bd1e22731bd334949eb8bb44126dc6d358","lib/libwinapi_onecore_downlevel-input.a":"d8021ed7e5dc1fe11b966a32e581c52ba672c020254870626947108c06d213b4","lib/libwinapi_onecore_downlevel-kernel32.a":"7f1a8b6870b6b5a117fe0b9ccbcd1a6b9133173baf6b0fdd91daf32ff2f3a920","lib/libwinapi_onecore_downlevel-msi.a":"3950469b8eabd579f17707f38029ff1d1d9485711b02ec516a95b99bdb1fba05","lib/libwinapi_onecore_downlevel-newdev.a":"0369225398f2d772410b3943a6635c26d5117f6711e03e49dde13a5f0db44f2b","lib/libwinapi_onecore_downlevel-ole32.a":"b5579a04a5777a471687c6e3fce7d8ebc87be0e3f3dfba3f358eb7dc3cd4c715","lib/libwinapi_onecore_downlevel-oleacc.a":"856fb87b2bcfedcfe10a104ec8a0e4275840f042efdce23e3aeea8fb90b3622a","lib/libwinapi_onecore_downlevel-oleaut32.a":"a9461245046a904f1e8ff78b7bdf00534746756a83b3e4de04e889c8c1df2244","lib/libwinapi_onecore_downlevel-oledlg.a":"d460a3f03bca729456a5e315e75af9b4cf3e79343c2bd81d827d377a4d4b05d0","lib/libwinapi_onecore_downlevel-pdh.a":"208131ebe23e8bcd31f03af369900ce7956b9a1e51bcf8be6e46ec1ff24576d7","lib/libwinapi_onecore_downlevel-psapi.a":"ca31fdd6661f575ddd7e15cf68a6cb97fa405677d01cfa00b70364ffc138ae81","lib/libwinapi_onecore_downlevel-resutils.a":"07e1b645395bef6352820aeb6867498dfecf1c576436be218e81db12fe8a3602","lib/libwinapi_onecore_downlevel-rstrtmgr.a":"87bfdc17145dce5ca717dbdd007970ab1139f7dfa7ecc17c9cb3c8cbdbaeaa58","lib/libwinapi_onecore_downlevel-secur32.a":"90d6b2fa7ff6b2e9555718c8a088614a461c5f5276fd2586cef7ee2058301e67","lib/libwinapi_onecore_downlevel-setupapi.a":"6af80ea73c581f1e21f5ac714f5da3b33ed50e9d1a9cac19e020ad24986202a8","lib/libwinapi_onecore_downlevel-shell32.a":"4b86e0540f359563ff2a81880f9fc4b40ce7f52409bcadeda2e678e1e28b3657","lib/libwinapi_onecore_downlevel-shlwapi.a":"3dbbe36f2d6473e88b1b2b6e71eefcb82bdfcbd85a09d5b96d618b0bad63d99a","lib/libwinapi_onecore_downlevel-tdh.a":"ba341ea2345143d5b1b55f264366aa72ea707ec955b1b079f47f00eabf4d51bc","lib/libwinapi_onecore_downlevel-twinapi.a":"7b18b95de7696d38c6a2bd24ab02301a95d6c856705a8ae4eb0206e293e1d8df","lib/libwinapi_onecore_downlevel-user32.a":"bcc698c26293e631b93825aa8d1ed5a3eccd0ba99db635cef2b95dfcc476a680","lib/libwinapi_onecore_downlevel-uxtheme.a":"788dffd0226fe85f4bc0f43ddf7d6d69e35e028742a8094c44c065a5a796d7e9","lib/libwinapi_onecore_downlevel-version.a":"706c173ea490ede7d5d8a3cf8a207f0a84efd3a045f8ec6e5111a36c569706f9","lib/libwinapi_onecore_downlevel-winmm.a":"b2fe34c14402f41101d658964d62f5abca5be0106f4dfb27ba630cd35d127277","lib/libwinapi_onecore_downlevel-winspool.a":"f7b78470b47ddc11240de3ab2a153e91620e281c0ca499e82a9c25dfbc68e80e","lib/libwinapi_onecore_downlevel-wtsapi32.a":"ec17d91e47de2d55dd4043318800415591832c9424cf9ed0350a4cb17c6eced2","lib/libwinapi_onecore_downlevel-xinput1_4.a":"3e0a8d45e88418b3c61455fdf91f39057108f9cd39dd5b00c41ec86c31f05f27","lib/libwinapi_onecore_downlevel.a":"9350efe517d660865703d03a12d0aea519ce286a1b90f8655f8211ba9e5d1176","lib/libwinapi_onecoreuap-api-ms-win-appmodel-runtime-l1-1-0.a":"208882e4e2230dd12d8b317d7a093f0bcbdc8179665778bc552fcbb898e9ee5b","lib/libwinapi_onecoreuap-api-ms-win-appmodel-runtime-l1-1-1.a":"91790658be1a8be50ddcde5ac956a1a56ca774dc7a690b2ef75021e9c3330951","lib/libwinapi_onecoreuap-api-ms-win-appmodel-runtime-l1-1-2.a":"6d7aa69999def908cd89ef1249f6c1116d418a11e897293e1aa1a716a74ef7a4","lib/libwinapi_onecoreuap-api-ms-win-core-atoms-l1-1-0.a":"f2489b312e02e70ff3b347f5a95b92fbf94ce4d4cac8dc8d2430a3ce07bce8b5","lib/libwinapi_onecoreuap-api-ms-win-core-calendar-l1-1-0.a":"1b1897310842d69519c547af2d07da04a432eeaee55809fe844cfe3bab463079","lib/libwinapi_onecoreuap-api-ms-win-core-com-l1-1-0.a":"ed5f934a0b2317af63fdc5140cc369dfb6cc54f0c2ed6e6108f77c2db49120e9","lib/libwinapi_onecoreuap-api-ms-win-core-com-l1-1-1.a":"9caf1ed02c8944e21ee329661d6e86525d48adcb30a0262e8bc651126fac05d0","lib/libwinapi_onecoreuap-api-ms-win-core-com-l1-1-2.a":"2d0f0a22bede0f52df0eb87983690bafadab0a8cc3ab055e774f0b7e81faac9f","lib/libwinapi_onecoreuap-api-ms-win-core-com-l2-1-1.a":"bd93ea942b8ace1884d16040fbbe418d7aabcce933d9a769173dcbbfef2ffcae","lib/libwinapi_onecoreuap-api-ms-win-core-com-midlproxystub-l1-1-0.a":"0cecd6ca334de304c25b825732ecbcc4ae1f0903b92fbb07642f2b60b6e32ab0","lib/libwinapi_onecoreuap-api-ms-win-core-comm-l1-1-0.a":"5dd747af301bd8a87a169fb4be5b27f35fe8d641e442da9650a681bb1ebca5fe","lib/libwinapi_onecoreuap-api-ms-win-core-comm-l1-1-1.a":"4af23fb67510708febfca2ab3c88b049cfa72dc8209ce3b10073345a2cc90ad4","lib/libwinapi_onecoreuap-api-ms-win-core-console-ansi-l2-1-0.a":"0d5642a37f8c438e8af493d14ce2e76dfce51fb77aa9e657b28883d6dfef105b","lib/libwinapi_onecoreuap-api-ms-win-core-console-l1-1-0.a":"6b8a4dab5532b978cc0b78a75d7e617041f70275ffec6c3ab2e09bd257490df3","lib/libwinapi_onecoreuap-api-ms-win-core-console-l2-1-0.a":"9b43334c98f0355bade21041cd010435f87f4a9f8ae2ff2da1daa77a1c58c7c6","lib/libwinapi_onecoreuap-api-ms-win-core-console-l3-1-0.a":"ae6bcfebc7a6e9d24a91f712e67e345c3716174ac13a1b086139d0dd42fc3aa4","lib/libwinapi_onecoreuap-api-ms-win-core-datetime-l1-1-0.a":"def26a1441d88fcf69a0cf71f2f37f585585027b181453ecd66b500869c1325e","lib/libwinapi_onecoreuap-api-ms-win-core-datetime-l1-1-1.a":"796cb7d7094c8cad58a4feb4d23659aa9931a4006fad2d95cbff1821f4590844","lib/libwinapi_onecoreuap-api-ms-win-core-datetime-l1-1-2.a":"81937e6fa94d1212375e5c14e3dbc5b9259f693bd657c198f1294e84670cbf83","lib/libwinapi_onecoreuap-api-ms-win-core-debug-l1-1-0.a":"1e4421bc92825052e1c6da76c5fb9f0b3b7b9e59e8297acf476e264a50f79b59","lib/libwinapi_onecoreuap-api-ms-win-core-debug-l1-1-1.a":"57b9316068a5a96938f30e7f6f23e720d4812e46a7cc4802135ff09284177f21","lib/libwinapi_onecoreuap-api-ms-win-core-debug-l1-1-2.a":"780fc66e5b9309f137092b8b0a4d0bdaa2b8f45d89d9ae8b0e9f2bc29e69c424","lib/libwinapi_onecoreuap-api-ms-win-core-delayload-l1-1-0.a":"6e350ff7b3c6329df2be85d6d709fe666742318019079a88e385a180500793bb","lib/libwinapi_onecoreuap-api-ms-win-core-delayload-l1-1-1.a":"3e718e8e2364bdcd6730ae57e138c09234583a2e5ae232228f383e3d040af377","lib/libwinapi_onecoreuap-api-ms-win-core-enclave-l1-1-0.a":"97552843d0f8b760db838172f22d443a491bc4885c35de15f4b3d579b373fd31","lib/libwinapi_onecoreuap-api-ms-win-core-enclave-l1-1-1.a":"cd81f5d09d6fb6f4125fc2770ec5086838ee72f0daf8368c392d51f5320e66ba","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-0.a":"f5b5904942ebb75a537ed4618b917b0d8b762dac20da0a0c0de7e57036fe72cf","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-1.a":"eed735344f097f222c660379acb00aeea935e730abf2253f9a4a26993c8fd344","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-2.a":"b3690a5e72008de4c4a8f82b1f5e352ae987f11229df791f6fdfc7e0ee862837","lib/libwinapi_onecoreuap-api-ms-win-core-errorhandling-l1-1-3.a":"4495bcbe1eccbf406b59a8cb55d3afbb8af8db728808c5f30d2a6be9727e91b0","lib/libwinapi_onecoreuap-api-ms-win-core-featurestaging-l1-1-0.a":"43e391c884a4a4f2b49c27a211d69161c24f6b916e9da7d171da447e8916493c","lib/libwinapi_onecoreuap-api-ms-win-core-featurestaging-l1-1-1.a":"1f8415d190ccb338224387f5319edb3c99942e77ff78808b8e2d07bf878889d8","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l1-1-0.a":"da3f54a70d3ae49cd4f1720af4a60f17840f813903cf906ebbc30959396173c8","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l1-1-1.a":"b0216bbabbd686401ad98754a5c049d8960d57541ae77a3d20358a66ff9adcba","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l2-1-0.a":"d45a173aa1f26ec0a4e43d6c27da3a7dc7a96917f9004f1b7b79ab612ca28975","lib/libwinapi_onecoreuap-api-ms-win-core-fibers-l2-1-1.a":"eabd8fde033e5a57b6c0b9a7c12c260de1d83394bc89d12c189f8e5717870e13","lib/libwinapi_onecoreuap-api-ms-win-core-file-ansi-l1-1-0.a":"fb58299452583cd8a8ac33d4bc5e9b7ebb9ac1e3f2028bdae5359cda166b3f1d","lib/libwinapi_onecoreuap-api-ms-win-core-file-ansi-l2-1-0.a":"ad8c10b9fd3fc027585c1d687b79b0e69d70600d44b9ce90aef6a66655a5d8e8","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-1-0.a":"199c464c17bce4d3dd0bceab0451a0cadca8aa1e2437be72f2f7ea6ed3fa93b1","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-2-0.a":"6d356b9052c0239a2ac548b2df4dbff1b4e6dbff31044ce2c0327753983e8e50","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-2-1.a":"4cc9d17c3a077bd35e3828510d1909898881d0b25c3affba7f456ddf113c63c3","lib/libwinapi_onecoreuap-api-ms-win-core-file-l1-2-2.a":"51501263dd66fc8121864da921eb14c0900b189a822ca1adfe47f1311b902792","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-0.a":"ab6f71c8c65ea6e7d513750a01626faf3175339e222ea54968e0ff0ad90a8b45","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-1.a":"b9314710e7a45bc933aea2aa0e57ec45167ab20fa09d747aedbeb097ab36da5e","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-2.a":"70479bdc939f5817083356c93964e10ec375829b1863ab538886b39b00aef7db","lib/libwinapi_onecoreuap-api-ms-win-core-file-l2-1-3.a":"9127441476b674a7a73f3222accb5be3dcfa63fcb7f1b95b6edcc93e6a652f48","lib/libwinapi_onecoreuap-api-ms-win-core-firmware-l1-1-0.a":"14c5e5fae456396c87d962a22cee320231ac759ce842de4bcf9a457b22cb0eac","lib/libwinapi_onecoreuap-api-ms-win-core-handle-l1-1-0.a":"7a5de073a89c411e4679f8b6796a7201a9f276bde8119392584efd788b3f8e89","lib/libwinapi_onecoreuap-api-ms-win-core-heap-l1-1-0.a":"1370ad95210fa9dd3e3aad0ab7caff8439ca05d0ccb6b3941fd7d26cd03ba6f6","lib/libwinapi_onecoreuap-api-ms-win-core-heap-l2-1-0.a":"7a497a59068adc9757ff546a78dcfd5c27184ff4ac566334baaee95cabeaed97","lib/libwinapi_onecoreuap-api-ms-win-core-heap-obsolete-l1-1-0.a":"0f64537add3fac2532141036a963fe64a98b5046804df3b685bf30986a0c2f0c","lib/libwinapi_onecoreuap-api-ms-win-core-interlocked-l1-1-0.a":"0d196cf294402e3b8a50eaa3413756b034680294c6b91bdda7547f3cf6f9c579","lib/libwinapi_onecoreuap-api-ms-win-core-interlocked-l1-2-0.a":"ca050c2d460caba9e6978b1745b22e0932c0ac148a06c1a1612eb08e512eec75","lib/libwinapi_onecoreuap-api-ms-win-core-io-l1-1-0.a":"ff28edf42698b4bc72ddbd143062132908c614536d60a732ba3000940b5a85f0","lib/libwinapi_onecoreuap-api-ms-win-core-io-l1-1-1.a":"93780a27ddfc82d162d7ab804a760faa78b5904471d8c36af19937d967457829","lib/libwinapi_onecoreuap-api-ms-win-core-job-l1-1-0.a":"a97523d85a93bcb4a6c857f115931afe45020769d7667759ee7038304b955311","lib/libwinapi_onecoreuap-api-ms-win-core-job-l2-1-0.a":"c44d11b52b83661540fa32202b7c7b425aee93b94381821325c292c2f6124fd9","lib/libwinapi_onecoreuap-api-ms-win-core-job-l2-1-1.a":"8325c8020cc66fd1baaa9e2d2c2275b14ca6245183a5fd2c38aa67ac69a2d99a","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-ansi-l1-1-0.a":"f25ff2bd0c4f841a4d48895c22b0a883eff15adc3494075d3a481724ba904998","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-0.a":"3348ace857245ff8567ee5eef16d0874da46e154a34db8045c2ebbedd6148e15","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-1.a":"9a753479c78dfd40aa71452860e294ef02204828d7743d18552bff78417eecc7","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-2.a":"6ebd97e5c62c047022a761b3293d51c864c40744473cd26bb14d24dcbe5028f6","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-3.a":"036f12e35650d8c350496613a856c27da923a24ab802c0d9657d7af8fc0cabd5","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-4.a":"a30a9756ec2296c149c0a463af96addff7cb6c0d00db847a5c9f77f1bcd6b655","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-5.a":"979f0d08708b6f80d1aa452a5a387f0d4311c76d88b5dbcadffe66d638cde66a","lib/libwinapi_onecoreuap-api-ms-win-core-kernel32-legacy-l1-1-6.a":"edc5f8763d03d84025dc7e083d698893cff79920e36f239de7e18f91bad6ef99","lib/libwinapi_onecoreuap-api-ms-win-core-largeinteger-l1-1-0.a":"e36f5ef88232466f1bfe08402d21c6ff1562bcd2d630387d45ad1187dc3345b1","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l1-2-0.a":"caca648ad69b3f52c628e977c18f149087f5777cf0079546f92a2414887b2d05","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l1-2-1.a":"93ec184d7ab34060ef1db49cd2270e80e95ee217bb5fc481946b51dba7c75339","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l1-2-2.a":"c5b4969372c801175c789b3b90f23d296b48922084fb2a3e6de34bc76f0c4452","lib/libwinapi_onecoreuap-api-ms-win-core-libraryloader-l2-1-0.a":"1a85b7be572525b0cd28edaee04b97c1027090e6d67273328113894c7d9d60f5","lib/libwinapi_onecoreuap-api-ms-win-core-localization-ansi-l1-1-0.a":"e1b13deb0d9f7aa240295a87cdcc398edb816e0c2b8d72261e259b17577d0496","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l1-2-0.a":"8c7dbfc3176c0bb0487c7ba7a9d04036b5600c7f124cab8ac3e4ddacf013c875","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l1-2-1.a":"34b04e8150846ee19c15ac417555cfd3a712cb4fadc564d6a9cc7ecd6c174f23","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l1-2-2.a":"fec9c576052f90d882c90e0e2dfdb717f94a5cfae111db76246e560501dc9c81","lib/libwinapi_onecoreuap-api-ms-win-core-localization-l2-1-0.a":"edc59db7005da93b96bb2e1eff6e6de2796f5fd6d0fb02a95ead84ad3d679996","lib/libwinapi_onecoreuap-api-ms-win-core-localization-obsolete-l1-2-0.a":"2b9eebd89310ac43ed54dbb9553172b36757a5a51b59ee5e14c31cfc8210d78e","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-0.a":"097862322accbc132b0b753698cdfd33cc68b22643f994bcf5b2fcf02c0a3dd8","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-1.a":"fafb08266b6465d3b283b5dfcc1924507e84bc0c0d658f3b111a237e88284791","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-2.a":"4d0dc0b85d99ec900d64193039f6442886e2f7cb57a45ca7de62b9c1c5738860","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-3.a":"40a6455f8fa2d5124cc69bc89de96a238b6ab3c83583c5ece746b281c70dc426","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-4.a":"59da5b17fec35fd627ef32ec5333c93bfc3cf71be9c78fc714ae0c695d628cee","lib/libwinapi_onecoreuap-api-ms-win-core-memory-l1-1-5.a":"d104bccd2274b6bc0f51c06489822ed46d3395c77ea421276f33a4be45847867","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-ansi-l1-1-0.a":"d8530787e73d174403d40232a09d0f01bae47f8d83c39cd6d818e8afed18d640","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-ansi-l1-1-1.a":"acb7f179f7c58f93457d17ac57feaf18deecc7c43a718c9e73bb895e7433244d","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-l1-1-0.a":"1a099dba3ab2aff0de9b82afde85e02d8f52ce39a5fc049ffcf9c0e6055e1be0","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-l1-2-1.a":"daf2d469a631f337a749317cc282f8ce30f84cba094fc61506472bc2418784a8","lib/libwinapi_onecoreuap-api-ms-win-core-namedpipe-l1-2-2.a":"76594e230e567f5f12379b7319e35ee1add83f51625b156908e87a63ae781895","lib/libwinapi_onecoreuap-api-ms-win-core-namespace-ansi-l1-1-0.a":"2df4f0d625e6313eb906f7fffe85e951d877d6bb063d6e51b93a317be2b7b474","lib/libwinapi_onecoreuap-api-ms-win-core-namespace-l1-1-0.a":"088eeee18edd58dedbfceef865fc38c32024eb9bf59b960b657893d89b242e46","lib/libwinapi_onecoreuap-api-ms-win-core-normalization-l1-1-0.a":"396abf7a271322dbc05f49e9b2018d8d2bddb0cdaa8d8885f5d1f1ba0103b188","lib/libwinapi_onecoreuap-api-ms-win-core-path-l1-1-0.a":"d9beb78fe6740ec2c31d8a6982da695fdb293aa0bd26726a1e73b0a71605fc9e","lib/libwinapi_onecoreuap-api-ms-win-core-perfcounters-l1-1-0.a":"d8c8f703a295f6c1d6e5a6cc7eaa06f254ca31eb02f5acf2b3189d98724b11c8","lib/libwinapi_onecoreuap-api-ms-win-core-privateprofile-l1-1-0.a":"44e2595ba027013f8638b3964bf49051e1c873fb9e43bf869967701074b001c9","lib/libwinapi_onecoreuap-api-ms-win-core-privateprofile-l1-1-1.a":"c32cc3af4fe8f1df5e4f14e3a0a9751a7493fca87cf2aad5c7009ed2667ab9bf","lib/libwinapi_onecoreuap-api-ms-win-core-processenvironment-ansi-l1-1-0.a":"42c74a8f731111df9aa02616708a9773b53d354898588d46a9592e6431bddc0a","lib/libwinapi_onecoreuap-api-ms-win-core-processenvironment-l1-1-0.a":"994978a054487a2549dc794a0135ad806ae747085bb46b169850c19feaf48f0d","lib/libwinapi_onecoreuap-api-ms-win-core-processenvironment-l1-2-0.a":"d32d2b2a6fb33136b6f982b03526efd6357fa95e8e68e0c24c429f906e2133dc","lib/libwinapi_onecoreuap-api-ms-win-core-processsnapshot-l1-1-0.a":"999d3c142a4f09d58897dd1862f0e3f3d01adc6426ed6858ae14c64cad2abe1a","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-0.a":"9900f0ab25eca8d5ecdabcdcdd24c2d741f8be6cac29e7fb137d47bb303f1942","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-1.a":"42c4aae5bb149898ffdf1db738ed2eb34564b2aaabd3580a44f4c40670cea7d3","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-2.a":"cbc354e5975489e90efe70d05fa7eaedc5625b48de0d8d7c42834a8c72d350db","lib/libwinapi_onecoreuap-api-ms-win-core-processthreads-l1-1-3.a":"d7787f9e7e25a936dbaf33e1f768ed9edbd76a45bec7898a802e3b46f5046294","lib/libwinapi_onecoreuap-api-ms-win-core-processtopology-l1-1-0.a":"0ee0eb2dfdbdf642645168cbf4df1004c8514dbcf4fcf68455170830039918bf","lib/libwinapi_onecoreuap-api-ms-win-core-processtopology-obsolete-l1-1-0.a":"fc787ca7ea17bd41447e8c7856f58ce1463132a7f9197cbd16fd21d51d626455","lib/libwinapi_onecoreuap-api-ms-win-core-processtopology-obsolete-l1-1-1.a":"3610f5a44c1696800b731cabd502ab9d674ae5e466e77e8cffd752449def98bf","lib/libwinapi_onecoreuap-api-ms-win-core-profile-l1-1-0.a":"8175c06e4065023e1d83a794458f668b575829a462859c4a9cdb1b317c417100","lib/libwinapi_onecoreuap-api-ms-win-core-psapi-ansi-l1-1-0.a":"cf60483967f15bb48a8104fea73abf63c96bee46db6436c5be5baada0bd65b5a","lib/libwinapi_onecoreuap-api-ms-win-core-psapi-l1-1-0.a":"ddcd4ed25ba23c6719b4d3143299bd3a0d3319aa66bcaf8209e91edc31e33f77","lib/libwinapi_onecoreuap-api-ms-win-core-psm-appnotify-l1-1-0.a":"05ecfb5ce0f45ba854917356d2a90b8c8933d4697a34aa7ed3df424ad5777f68","lib/libwinapi_onecoreuap-api-ms-win-core-quirks-l1-1-0.a":"4c8f9adf440d7d69732e0f8caedc22e8cc1e6aa3e9949084f2ad6d3cfac40202","lib/libwinapi_onecoreuap-api-ms-win-core-quirks-l1-1-1.a":"923e8bc57d1196eb3acb217a0f73b09886b1e0c8656de744bfeb3b4226028d6e","lib/libwinapi_onecoreuap-api-ms-win-core-realtime-l1-1-0.a":"36b66d1781bef9d74b1996b194642cfb12e21e503fbc796e5ad27e08e858e13b","lib/libwinapi_onecoreuap-api-ms-win-core-realtime-l1-1-1.a":"85e2bb960d2cb17a6fdfd14d745cffa998c5c16de55e0e5399009c0da9bdfb7d","lib/libwinapi_onecoreuap-api-ms-win-core-realtime-l1-1-2.a":"b21f1b497c03ba20cc30b9cf5c53824c93e542e74d05b8f8e7803c8fed674946","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l1-1-0.a":"f9fd25609615daa0c846bbccb1e1afb9df97457f3523928f18879cfc144bdb90","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l1-1-1.a":"029da1015d4150f207086cb60e457e4cd0a34dbf7a3b264b9b8bd348791dda05","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l1-1-2.a":"4e782b6afe5855007f30450045e421a35a1bbb61dbe1cd435ad228797b221895","lib/libwinapi_onecoreuap-api-ms-win-core-registry-l2-1-0.a":"1af46b02de30fc3183bdc8186a7ecc81461748cf22d05ad375ca3b436782d9ee","lib/libwinapi_onecoreuap-api-ms-win-core-rtlsupport-l1-1-0.a":"0fd519fe8af39e22c1a39ec37690b52d114591cb79e289351ed2e0d230dcecf8","lib/libwinapi_onecoreuap-api-ms-win-core-rtlsupport-l1-2-0.a":"74c170e870b9c767c3d0908f7c02f172dea37b2c2309701bc456f7a9ba24f6f7","lib/libwinapi_onecoreuap-api-ms-win-core-shutdown-ansi-l1-1-0.a":"28007b4f34f31ac5d0a340e759957598b945d7315b2ffb5fcfdef34831498899","lib/libwinapi_onecoreuap-api-ms-win-core-shutdown-l1-1-0.a":"584dc53a4aaad360864d643575b1197dabedf3366002c62fded126aa1ceb2794","lib/libwinapi_onecoreuap-api-ms-win-core-shutdown-l1-1-1.a":"2bb92bb8c085be0d875b73c8b0dd923862827cb1f8ffe775dc5bbb54aec8a3cb","lib/libwinapi_onecoreuap-api-ms-win-core-sidebyside-ansi-l1-1-0.a":"993aa0e559d8f069fe0e0a1179dee06e597e2bd3d02876f1a0082f37c729a30a","lib/libwinapi_onecoreuap-api-ms-win-core-sidebyside-l1-1-0.a":"badb929faa6993e9f2bb6b7fa26259ad8c7abbda8ba3d42d2e8ecfa453fb7eea","lib/libwinapi_onecoreuap-api-ms-win-core-slapi-l1-1-0.a":"f320eefb3763cc503aac9fbcc0489f38a939e3b38db1d39719e570717ea3e476","lib/libwinapi_onecoreuap-api-ms-win-core-string-l1-1-0.a":"f3037f023ee2c8578417e29cd698be3f7df598a62f3e6369978e7037be7fcd62","lib/libwinapi_onecoreuap-api-ms-win-core-string-l2-1-0.a":"c0757666e6a507d0c4fbc0b50902326712ce6cc2f4a365f94a890b564c9a94ef","lib/libwinapi_onecoreuap-api-ms-win-core-string-l2-1-1.a":"fac6581561dbf5794fb62c8fc43267274ca07a08213c4c93bdccb405ee23bcc4","lib/libwinapi_onecoreuap-api-ms-win-core-string-obsolete-l1-1-0.a":"a1cdb22e603571bcec39c1a5547600528cf89d28ed87d3e9dbf8caddc28aac7b","lib/libwinapi_onecoreuap-api-ms-win-core-string-obsolete-l1-1-1.a":"e66d86dbf902d9dd57734339a2129f921bc62d490ff524a5bb8c490f1d994425","lib/libwinapi_onecoreuap-api-ms-win-core-stringansi-l1-1-0.a":"7d9dddea1019f027215c65209127ccce9c221ea4cfab79405502920bf97fec17","lib/libwinapi_onecoreuap-api-ms-win-core-synch-ansi-l1-1-0.a":"c9c244acba6d4fa1b367d6d6e6f2673b4c256e2f6e02cd0b651f254ef1da78b6","lib/libwinapi_onecoreuap-api-ms-win-core-synch-l1-1-0.a":"291d20badb0ed98dcfee4b61a87ca7de71d91cc2f5fd5210c64e0495610ea422","lib/libwinapi_onecoreuap-api-ms-win-core-synch-l1-2-0.a":"2891ffc03c3859f46872611e6003078443a0f05245dcf5bb9d77f8dd3748686e","lib/libwinapi_onecoreuap-api-ms-win-core-synch-l1-2-1.a":"a7a8108a8c26843eff1c9a48c28b600c42f8431a488e13fc8c0839671fd0666a","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-1-0.a":"52e2a89087c219765f2dd2fb898466a01df2f9fdaef7a84e6e0a16b144121940","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-0.a":"1b107fa62b4b75121f42f9bfda4f304d1febbd83193309f0585dfeecdd207d29","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-1.a":"1af830ba3ae3c3790c77add6643305401172fc4e8a088bc9f6be4a888c9072bd","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-2.a":"b33a8c59f35e5843d016b58c6edbe9a58a9c81aec1324847fd86a612cb038e24","lib/libwinapi_onecoreuap-api-ms-win-core-sysinfo-l1-2-3.a":"fcf4b87d9d11784559a9bc4c5b06366dd9784be852ec7a0235a3e247ee506df3","lib/libwinapi_onecoreuap-api-ms-win-core-systemtopology-l1-1-0.a":"7e07a6e2854593a0edf944ae6d993ca9fafee53fb5185ef70b0ca9765dd4a288","lib/libwinapi_onecoreuap-api-ms-win-core-systemtopology-l1-1-1.a":"6ede88a05d440fa2d9d5ee26e8645a2d31e5e05662b975b4e1c54dced4d21d91","lib/libwinapi_onecoreuap-api-ms-win-core-threadpool-l1-2-0.a":"be01809a2c48a1be2311cab632ab5979983f2d15e84161b44734fc9372fca2c9","lib/libwinapi_onecoreuap-api-ms-win-core-threadpool-legacy-l1-1-0.a":"ad6c73e76b6e6af4746968e218bad365d42b3882c5352d449071b14743307ce6","lib/libwinapi_onecoreuap-api-ms-win-core-timezone-l1-1-0.a":"59b4bf42c2cb3243cc36728b6612f98956fdd99aa774acdfc277e393cc70011e","lib/libwinapi_onecoreuap-api-ms-win-core-toolhelp-l1-1-0.a":"4587831f353137ea730c40920e0a2d19645a868e76c41242462d734c6acd9756","lib/libwinapi_onecoreuap-api-ms-win-core-toolhelp-l1-1-1.a":"92aa37a2a7b14d0142d591e5f34dc2f15d19ca8073140e97a8bbd251017b3c98","lib/libwinapi_onecoreuap-api-ms-win-core-url-l1-1-0.a":"d7fdea9b8e4f30d68c3457952429670b7fa85c88ffab3652517d6b86e24d552a","lib/libwinapi_onecoreuap-api-ms-win-core-util-l1-1-0.a":"6f5cbf84f6bc55c73a4d3bfe56ee7cea780a66647d8f9c4859fabd59e97952f0","lib/libwinapi_onecoreuap-api-ms-win-core-util-l1-1-1.a":"5c768687034e6bc0bb740ddf3399cac95bb78e81cef1c195562c36c2198f1abe","lib/libwinapi_onecoreuap-api-ms-win-core-version-l1-1-0.a":"9d549df648d09ca88023c8270d1039564ed6033f2c834b98ae5b8de81f6350c7","lib/libwinapi_onecoreuap-api-ms-win-core-version-l1-1-1.a":"fcfa3edeef60bb20e4de99753123b69ce693f7a33b1b25ab9c998f7b4f4af7e7","lib/libwinapi_onecoreuap-api-ms-win-core-versionansi-l1-1-0.a":"aa56a4aabbad386571997c850488f8024f079ab10cf29c3f5018435e74280739","lib/libwinapi_onecoreuap-api-ms-win-core-versionansi-l1-1-1.a":"bc9e01a2e3e557cce8d365f54f0a1c4467e6da12524574f6884b1ff772fe3fa1","lib/libwinapi_onecoreuap-api-ms-win-core-windowsceip-l1-1-0.a":"b5037bebdccdc4636afb830078aa6fc78d142d5f4e4c069462a400106590c29c","lib/libwinapi_onecoreuap-api-ms-win-core-windowserrorreporting-l1-1-0.a":"442a64c404179f700fca3b620f4aeaefeb2f761d45fea88f8c289658355a56a5","lib/libwinapi_onecoreuap-api-ms-win-core-windowserrorreporting-l1-1-1.a":"8cb856aa014e3176b38f81cb98455b137597dd454aba9994544bd8d06808e0ad","lib/libwinapi_onecoreuap-api-ms-win-core-windowserrorreporting-l1-1-2.a":"bbf701fbf1a80d36acad75ba68f840623027872e8d0885c98932238ffe8b5c12","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-error-l1-1-0.a":"a5317cc287f2d8e822e2cf5c2c3d906b39f13603bfd001f83ba16c8cff2e5667","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-error-l1-1-1.a":"3c861782bc5bc28c0332e3d3a9fb1a82dd625fe0622af2ae8c6ce355fdc97b64","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-l1-1-0.a":"024505f5b3606fd9c6a6e6b9f1f2375a961e87ea2955f251ba7c87f665bab7ab","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-registration-l1-1-0.a":"311a0cd15ff274e5da94d1450635e2ac1ff80c769f4d6bb248a1d1c627f98165","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-robuffer-l1-1-0.a":"fc830efa784cec9681b78ba985e7676948004763c3e005daf5dbf4a76f7fff2a","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"e85de983d19dbf0eca5d8ba1f15c22a4345fb5ee91b1b5f17bf54592e83823d2","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-string-l1-1-0.a":"60c9ef2a7ff31e2c329add49379ee3df011f97d28f08b86a00d8dfb6af3937ff","lib/libwinapi_onecoreuap-api-ms-win-core-winrt-string-l1-1-1.a":"d277c8f1d589ae2135519b5dcfaa4da6f3e81430e7e0b653637684e81750d414","lib/libwinapi_onecoreuap-api-ms-win-core-wow64-l1-1-0.a":"43ed6811af9baffcbe6563cbfcf7098fe882d57c4de63f6f020a190cdb372f49","lib/libwinapi_onecoreuap-api-ms-win-core-wow64-l1-1-1.a":"37bfa87f4004ed6e9d485815f858ecf87da18bc004e4e5b6195d5da8e9628e7c","lib/libwinapi_onecoreuap-api-ms-win-core-wow64-l1-1-2.a":"b0bb3c836cf3f6b5079881fbc13d7ae0a29bb183121428c616400beaabc002a1","lib/libwinapi_onecoreuap-api-ms-win-core-xstate-l2-1-0.a":"41eaa65110287a9464924629fd20efc322a72682f7497eca0691ce8253f5d37c","lib/libwinapi_onecoreuap-api-ms-win-devices-config-l1-1-1.a":"791f257672dd55fa79dda0009a63ee6239045fb973df8ad1130c00303dd808ce","lib/libwinapi_onecoreuap-api-ms-win-devices-config-l1-1-2.a":"95df360f764e15b615fbce0cc242b0ae6a3065928de31be6d0f3d4e3e3e3ee9e","lib/libwinapi_onecoreuap-api-ms-win-devices-swdevice-l1-1-0.a":"a554ea50453252787740f501cd7a40985070da4c6b5b097933f96d01b20e8f3f","lib/libwinapi_onecoreuap-api-ms-win-devices-swdevice-l1-1-1.a":"298fb5fe0a10116fe88c405f42a3e7bc21c051b6a87de9e80438577319f635fc","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-0.a":"058b5f62ad4dfa972e1d45797e1a8693508c082c3a7ad66713c98d4cc0703689","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-1.a":"3da5018232fbdb7d941e248e167d5f2c19585cf6bd872a12c32de58d55eb7c30","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-2.a":"f032334d1603206c061405a6878a8baab0b7acf002fa537dbdba1ec3bfaa1818","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-3.a":"5eef46c15cba4181037e204b498803516eb7a6ec18af4fc43e229395bf2a6b1a","lib/libwinapi_onecoreuap-api-ms-win-dx-d3dkmt-l1-1-4.a":"e6c8abd4a28d996ff487e32ef92d606ab3c84f45fc9926e3ef548695d9efb5f7","lib/libwinapi_onecoreuap-api-ms-win-eventing-classicprovider-l1-1-0.a":"a69661d64a7c2398c03d521e0213f851bdf8cb969f02a99051e26a5c540cca47","lib/libwinapi_onecoreuap-api-ms-win-eventing-consumer-l1-1-0.a":"a96ce246518f17897a2d1e7427d0c3efed740e53cb743eea81b16472c675046d","lib/libwinapi_onecoreuap-api-ms-win-eventing-consumer-l1-1-1.a":"7146a9646aa0031bd7a368879da07d30c27e922f11de8d36acd08a7ebe1938ba","lib/libwinapi_onecoreuap-api-ms-win-eventing-controller-l1-1-0.a":"1b0ed3d9c8ba0b3486d3ace7e91d6a9cf59be0f59e6db299ef2a832270d0d799","lib/libwinapi_onecoreuap-api-ms-win-eventing-legacy-l1-1-0.a":"e0a32a81dbbde1b9b641e68603a9c160b7bd1e6b07c5325c681c590697977610","lib/libwinapi_onecoreuap-api-ms-win-eventing-obsolete-l1-1-0.a":"b9ee4fa1e5adcdc9cfdafec75d75fa42eda21ad976017ddabedf94e8df60ba68","lib/libwinapi_onecoreuap-api-ms-win-eventing-provider-l1-1-0.a":"70d16559b1a3706d53a787e0735bdaedd7dfdb6c594d72ede3b437e953de2598","lib/libwinapi_onecoreuap-api-ms-win-eventing-tdh-l1-1-0.a":"5ac9ae5f9757476280440b30a65e9e7cf99e72d7daf9b010cd39afe5b6d9165b","lib/libwinapi_onecoreuap-api-ms-win-gaming-deviceinformation-l1-1-0.a":"9b2c3120ab0d4ea1d3542f50f4224e8da43e807fbdaa7f6b9e77310c3e875698","lib/libwinapi_onecoreuap-api-ms-win-gaming-expandedresources-l1-1-0.a":"1e0bfd59214f3c0342d704d74b72b9668e6898388c9163fc5efbd7f10e05fa9f","lib/libwinapi_onecoreuap-api-ms-win-gaming-gamemonitor-l1-1-0.a":"41261c397970104547f4abfd1be9247021d69f74176e22fb2de9f28e6a954e43","lib/libwinapi_onecoreuap-api-ms-win-gaming-gamemonitor-l1-1-1.a":"012e835e10cff03ded37b67e60de23983e131125dbc9581a8002a0cdca177f6f","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-0.a":"5d59468964dbd7ab046296e4f6486e77ff111fa845ced7de61c5a0883255b2b8","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-1.a":"2d4b4edd5057460d3896749eb75d009ec7adf15be62f878d792757ea785216c3","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-2.a":"80412694d39f6110a5d1104839c3e750dca6ec1ddb1904e832564fdef92a55a5","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-3.a":"fbe27441bd2787d535874abacdf2d31700a9f5334d708e3186f3067e651d9b6a","lib/libwinapi_onecoreuap-api-ms-win-gaming-tcui-l1-1-4.a":"e1d5380c0b980bb1b07726d3cf4f2a02fcbc0ab88e954b4d1baf7f6d7a733474","lib/libwinapi_onecoreuap-api-ms-win-mm-misc-l1-1-0.a":"50d5e4e1e9659baee3d1225659c102deea61d72ce812593715d49f35f4c1b090","lib/libwinapi_onecoreuap-api-ms-win-mm-misc-l1-1-1.a":"6627afb481b3acfcb47045321aaa5e643aff3788490ced6a503fc973b6d701d6","lib/libwinapi_onecoreuap-api-ms-win-mm-mme-l1-1-0.a":"83d3cc59c5623f446ed2f4d21f5daaeab0e375b2d601576553e4da193e657d96","lib/libwinapi_onecoreuap-api-ms-win-mm-playsound-l1-1-0.a":"34376861728ccb4680372402c3e1f469d21a00dc396d4df143d5185aa8f529e9","lib/libwinapi_onecoreuap-api-ms-win-mm-time-l1-1-0.a":"e7a060c94e7076d45a4a4091825ef970869d2a54b3627bc670bfb8092a20d725","lib/libwinapi_onecoreuap-api-ms-win-ntuser-sysparams-l1-1-0.a":"2a44f39da22ab5b0ed37dc5e9562d42db9cc9d7e600b37ab0adfc4364bfd82a4","lib/libwinapi_onecoreuap-api-ms-win-oobe-notification-l1-1-0.a":"002f4467b7f58d7620b389ebd6d3983562ed859d527274bbc844d293539a1490","lib/libwinapi_onecoreuap-api-ms-win-perf-legacy-l1-1-0.a":"792efb6916e2cb05f7a443fca19d03943495e939b9aeea702ffeadfb399523d9","lib/libwinapi_onecoreuap-api-ms-win-power-base-l1-1-0.a":"e561f70c0420c63f20d1aec5ff2af3e744bcf4a8bfca6a1fca49bdf16e8f9e62","lib/libwinapi_onecoreuap-api-ms-win-power-limitsmanagement-l1-1-0.a":"40dae4c8443ad5839f8d04f82c293998b9ae1f8ac42a71924bae9d6c8a0ea0dd","lib/libwinapi_onecoreuap-api-ms-win-power-setting-l1-1-0.a":"f38422e9864a986d4779217c30e6be45e01c31255f7e46c79442d2db191d50a2","lib/libwinapi_onecoreuap-api-ms-win-ro-typeresolution-l1-1-0.a":"fb464a3682905b034a28e87d7c3fa52fe40b3d8974c5ff2f2a8366bd09a44773","lib/libwinapi_onecoreuap-api-ms-win-security-appcontainer-l1-1-0.a":"97e800780d16a3f303f192160406bc0718d5b0489cbdd9ee0051f02bcb9bc32b","lib/libwinapi_onecoreuap-api-ms-win-security-base-ansi-l1-1-0.a":"e7d2ca5998a14e92f06b0545918f42537d2463a7f90aeb8bacdea553c94582ad","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-1-0.a":"8ff1ee61e01a1a7c5c5be07aa83c79eacc0987ca9d136bd64e183cb43c6b496c","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-2-0.a":"1aa8bd19d74445826bb01cd74fa35fe9c4fba40a14388d9f179bfdf17ebe6f26","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-2-1.a":"5afeadeef24773505904bc67250964fcc0c34bc5090088866a85e0dd463c5943","lib/libwinapi_onecoreuap-api-ms-win-security-base-l1-2-2.a":"47dc7722b5899f6784d0de8799739885836f4c7753b2997f0692ebcadc7bdb0b","lib/libwinapi_onecoreuap-api-ms-win-security-credentials-l1-1-0.a":"0ff5ca478d2d34c9e54ddb2b19a95351b342d64cc110045b2cac78e1cf3525f2","lib/libwinapi_onecoreuap-api-ms-win-security-cryptoapi-l1-1-0.a":"c4efab90162893f22bcb1537ec564183b15917df952f81343a6315a99f014816","lib/libwinapi_onecoreuap-api-ms-win-security-isolatedcontainer-l1-1-0.a":"66d1d8b4c1d84ac76730df213a3f069e5bfebba5c338b9d7c17a51254ad6b780","lib/libwinapi_onecoreuap-api-ms-win-security-lsalookup-ansi-l2-1-0.a":"ad470f69c2d9486c92a96ec928fcefea6a2974855cc381309ca03f0f9078ccb7","lib/libwinapi_onecoreuap-api-ms-win-security-lsalookup-l2-1-0.a":"0165762604948743fd61ee01b032fb7c8c6ef7dcb9f1edb109cf1dfcb11b82d4","lib/libwinapi_onecoreuap-api-ms-win-security-lsalookup-l2-1-1.a":"e005dd2fd576330c8b4625219ee0014902ca6f990a92dac83be1a53722c80f4b","lib/libwinapi_onecoreuap-api-ms-win-security-provider-ansi-l1-1-0.a":"5ab8ea352510350036e7550d4b3ce6ff6cc49785063b65cbfe164bc7582b9b34","lib/libwinapi_onecoreuap-api-ms-win-security-provider-l1-1-0.a":"eadd184eeed25c2f689548611c17795c4ec7f14826fa9ebaf4181e9b14a410df","lib/libwinapi_onecoreuap-api-ms-win-security-sddl-ansi-l1-1-0.a":"03559b78a5214ed4f83dd341c0202700d69ff4acfe577ae6b92d4c862af590f8","lib/libwinapi_onecoreuap-api-ms-win-security-sddl-l1-1-0.a":"e04b7ac2b9aafe32392f30d03ecc836b39ab2956f98f4b6f13ea45e7cb9083de","lib/libwinapi_onecoreuap-api-ms-win-security-systemfunctions-l1-1-0.a":"12123b9729c86c8f4bf2e924908ed751e2f6a984c62141acff9858a3ea3da1f1","lib/libwinapi_onecoreuap-api-ms-win-service-core-ansi-l1-1-0.a":"70189c4736b78d0b9835feefbc77278f4a1fb79630d3bd8c79e85595b4a4e8a6","lib/libwinapi_onecoreuap-api-ms-win-service-core-ansi-l1-1-1.a":"a372303d42971dcfc465e226c5bf635e23dbb7a4df8a100e6b1ae668efcfc30e","lib/libwinapi_onecoreuap-api-ms-win-service-core-l1-1-0.a":"f9c50e32ff811decf56451868b8f2a08ec60fed80b5b6abb2b1b37dab442479b","lib/libwinapi_onecoreuap-api-ms-win-service-core-l1-1-1.a":"793d6d2e5d708b611c8c51b995eb26447f034c2f8f71804f26ab3b7eb5b4ea7f","lib/libwinapi_onecoreuap-api-ms-win-service-core-l1-1-2.a":"83e215dbdf6191426ec5974569fdac9725377933761ad73d51c0733f5312f160","lib/libwinapi_onecoreuap-api-ms-win-service-management-l1-1-0.a":"2d7240b34c6ab9b95d0b0c638baa254e7e174767d64d98a179e7b246a4cf5ac3","lib/libwinapi_onecoreuap-api-ms-win-service-management-l2-1-0.a":"060d20b241b8c0bfd28ea2ecb5a4efba76e2e77afc4388c42450ba18012c8f20","lib/libwinapi_onecoreuap-api-ms-win-service-winsvc-l1-1-0.a":"5e50383f61a8fdad9d0fba5e001933a17269a37d873428d3467b667c56bc6f14","lib/libwinapi_onecoreuap-api-ms-win-shcore-path-l1-1-0.a":"b121dcdc4e0bc485026d367c6b8f2322a02708b5a9aff2d156d6af3ed643c0a0","lib/libwinapi_onecoreuap-api-ms-win-shcore-registry-l1-1-0.a":"59cbe50f08a2c522a39d119ca3a3e9fb58cebd802b43f0a9d1e30165865f2cfd","lib/libwinapi_onecoreuap-api-ms-win-shcore-registry-l1-1-1.a":"bb99fca97f8654df71f7d39835cf067027a13f494c727c088f5bb24fb8e7914b","lib/libwinapi_onecoreuap-api-ms-win-shcore-scaling-l1-1-0.a":"132711f478eeeb8c13178eae7a4333a1dabe173cb290dafc1e63029d8ed3bf30","lib/libwinapi_onecoreuap-api-ms-win-shcore-scaling-l1-1-1.a":"c101777b4e550af3154997d7084e011535fe1fcff63fc1f308b56d5460a61da6","lib/libwinapi_onecoreuap-api-ms-win-shcore-scaling-l1-1-2.a":"851ad8f0e7e429ce19970c01c153847ac623331654477ca2471702afcda7c824","lib/libwinapi_onecoreuap-api-ms-win-shcore-stream-winrt-l1-1-0.a":"4beba4de71ef8d8e594d4eb11847a4b4f0b4af39065ab2d0514dbc21d6ece6b0","lib/libwinapi_onecoreuap-api-ms-win-shcore-sysinfo-l1-1-0.a":"903b8e5f31b2c0a7a51a1025068e776239f84d5576998e34b59a6c8c26b9076b","lib/libwinapi_onecoreuap-api-ms-win-shcore-unicodeansi-l1-1-0.a":"664a323b72d24e364c71ed70882f5cb88c3bcdbecab910a8011bb1d9b3db03a4","lib/libwinapi_onecoreuap-api-ms-win-shell-namespace-l1-1-0.a":"8d834943307f112bb5aafeba5a827220d46c2a98c3b3265db42c5c59208f1455","lib/libwinapi_onecoreuap-api-ms-win-shell-shdirectory-l1-1-0.a":"b2e7c8daf52e57e635ddd1968a5772a19d0224479d1a3e968c4c9ef388b113be","lib/libwinapi_onecoreuap-authz.a":"e0f0da30836359036e4eec83e11a38a613a91607b98372d3dca8d1df132d49e5","lib/libwinapi_onecoreuap-bcrypt.a":"b868acfe9f72de551803d49fa3cc69e4d96144d056a2b5d504453a17fef5972f","lib/libwinapi_onecoreuap-cabinet.a":"8542118dbca3daaf1c20059b5cf51fc217bc8d07f9be9371b73008a850eaf2a9","lib/libwinapi_onecoreuap-chakra.a":"996172c0c7155ff516e495530d1ac6acbd121dca5c1d31470c6d4ad0b8d50ed1","lib/libwinapi_onecoreuap-coremessaging.a":"4cd12df5bf31689a1a6224ae0c5b33c2d163de405343e496e6b878dd2d1f61fa","lib/libwinapi_onecoreuap-crypt32.a":"cf03822b1d0a289625f4ca5808763128bdfdf3211a7d98acbc70e351161c6de2","lib/libwinapi_onecoreuap-cryptbase.a":"669510bf3c470a2dd3d1006df48570af0b955a7db9fba70a7e3258e08a499c29","lib/libwinapi_onecoreuap-cryptnet.a":"881273b4aaf2d960a204125ab8effafb218a3b0c5c9ed015f00b23939ca825d6","lib/libwinapi_onecoreuap-d2d1.a":"5f241921ed594d78c66a70e2b8c81502a2ded3924f5ccd3a1b26599ef9128038","lib/libwinapi_onecoreuap-d3d11.a":"1b65a3d086ebd9ceae0060310a2336eae0df09e46d3e2ea3ad6415a99e4366e7","lib/libwinapi_onecoreuap-d3d12.a":"63ff81940648454813139c1f03ab0d4bcebc1b00a3a695cab8a31e0519e58aa0","lib/libwinapi_onecoreuap-d3dcompiler_47.a":"d1e48f68f3fd48eac3c440f3d47c4415fba29840f9cafce61b6f9ee5ed2d6701","lib/libwinapi_onecoreuap-deviceaccess.a":"426276a40e8cf0f39c15b6696e3877391599420894a4372c127375eb30acc4ed","lib/libwinapi_onecoreuap-dfscli.a":"a952b4318eff08d4bb48418b2a7f9fe47c342d29130d82d0fdda4b35b939d574","lib/libwinapi_onecoreuap-dhcpcsvc.a":"e14fa60521ec4281a5563bc541009ea65eca6ae8f2b27bfbb905f98a882e9200","lib/libwinapi_onecoreuap-dhcpcsvc6.a":"9307eb9eafac5e56eb8736e0460ccfabbeb7033c22370f6d63dbec15750c2c7d","lib/libwinapi_onecoreuap-dnsapi.a":"4e9cc60fff43de5e6bc12d0aee71780efde002c73b1a2b3e4d7f43849ffab9e1","lib/libwinapi_onecoreuap-dsparse.a":"7bcca65477240d1c54454f202f6415a2f349c8df0720b95c1396c75f109d96e1","lib/libwinapi_onecoreuap-dsrole.a":"750f331c4aea4e08e0bf57517eb5cf83f965320a40278aae5bb81a44f2e6a370","lib/libwinapi_onecoreuap-dwrite.a":"49281a37b0aee062ceb2d19efbcb065c64acf4c9a3ccf7fb53ae5e3bdb3f93fc","lib/libwinapi_onecoreuap-dxgi.a":"b978adb600527a5fa0e13033c0bd0550451543223e39b2eb55448e24283fcdde","lib/libwinapi_onecoreuap-esent.a":"44bddaf8c8a5c2c487583477978f1c726472cecf578b96a90ef9d5d94d10767a","lib/libwinapi_onecoreuap-ext-ms-win-core-iuri-l1-1-0.a":"15077a429ee981c3889f5f80f0d80908403032e9374923065d18dc5bb5f0cc21","lib/libwinapi_onecoreuap-ext-ms-win-gaming-xinput-l1-1-0.a":"d748bce05acf164423b9f51af34d27e156c3410b11a9124472dc754b125a227b","lib/libwinapi_onecoreuap-ext-ms-win-networking-wlanapi-l1-1-0.a":"04a60651bd9c7ac36c123da5385cf803be1493f5cb24c44d653dbfa99aaadf95","lib/libwinapi_onecoreuap-ext-ms-win-shell32-shellfolders-l1-1-0.a":"a499bd46bc48917584d8b2a787936f61d1de854c2fafbc079505fbc4f25eb662","lib/libwinapi_onecoreuap-ext-ms-win-shell32-shellfolders-l1-1-1.a":"111fca4ebf3213be20875af33b7347bcd93a183a81ab25e11d2cdb54bf73e6a3","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-0.a":"82bff3ea77bf75b0a77c0c425c8a421a50f25daca665216919ea39ce56af6ad1","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-1.a":"4d43bfe29e7456fd1c2564dcacdd87257376ca49a8cb99c0a3cd9c5a227959ce","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-2.a":"aa5222069f5cf71d21576f8d163996a1a3f1911075027c8eaaec6cb48035e52a","lib/libwinapi_onecoreuap-ext-ms-win-uiacore-l1-1-3.a":"8861213886555fa0c546526d976f5bd49eef5b08de37aef719e2de567da217f6","lib/libwinapi_onecoreuap-fltlib.a":"911feb95d3b46095c2590284fd4e88c281332573c16d8d72503d766e3536460d","lib/libwinapi_onecoreuap-hid.a":"b8cef8cbabee8fbe7268f574fd480b3bf02c45a600b72113f3024ceee0c47ad2","lib/libwinapi_onecoreuap-hrtfapo.a":"10a3665b5176bc622b462f1716b0a60ba83df18d63bdc960e90bb6400da78d19","lib/libwinapi_onecoreuap-inkobjcore.a":"058b9849faf46a66e49661b8f898803f440de328037ab7815fbe0d95ccc2ed66","lib/libwinapi_onecoreuap-iphlpapi.a":"7c85f15f4bf6b7fe151b274255c9ad03db1743397616ec68f90c1f4d30bdc5ec","lib/libwinapi_onecoreuap-logoncli.a":"10741f4518a7afb84b9db379c00a5331d5c4b28496f079a3eddc71871752782d","lib/libwinapi_onecoreuap-mf.a":"86f4f4346b4370da7717db46685fc92558c1fca013e8610c3cef8c10a0fb1bf2","lib/libwinapi_onecoreuap-mfplat.a":"a9dc0e798d2cc9dc4a5e75d308a9d839b105960b8152624359ac61d28085a482","lib/libwinapi_onecoreuap-mfreadwrite.a":"d91b57b8fb1babcc90f2e2a1e1fcfa893917ead5827fbc1a22fc55a6b4635488","lib/libwinapi_onecoreuap-mfsensorgroup.a":"def6ddf843cf014ed2d160b35f3a25dbb252eb95c22b4e1844df78214bc8d1a8","lib/libwinapi_onecoreuap-mmdevapi.a":"51b3a515eae39cce8d75ca9bf918373b42ea43c5c33e98195d1ba57e4b3d9c4a","lib/libwinapi_onecoreuap-mpr.a":"1b4b7839d796c512c1ea75e0317dfbb16f4b450eb939927132009e8911ead967","lib/libwinapi_onecoreuap-msajapi.a":"c5af226bc61eb42442d4ccfa0de3ae9e10c64fae32e99cae4f955b5cce83d2ac","lib/libwinapi_onecoreuap-mswsock.a":"99dba4dac3253cd88010bb41dee7d614451e02e1f97c5c4ab1d6e6741a40a371","lib/libwinapi_onecoreuap-ncrypt.a":"0325fad3e5e48c0b38c06ced23f902803ae756e977a8dcbddfe375972a56a40e","lib/libwinapi_onecoreuap-netutils.a":"495bf6025aa07914547714e9d40c41e5e849aae50d8a62076059180b17b0f8cd","lib/libwinapi_onecoreuap-ntdll.a":"42edae05c46b040e6602b48f41d9d2e2d634ee1b19702045dfb3ed6a948c3526","lib/libwinapi_onecoreuap-oleaut32.a":"67c0810d64b9aaf7d5acc2ad2177aa21c3422a32fda8f8dfc98370dd3443613a","lib/libwinapi_onecoreuap-powrprof.a":"cb06fc8b9ed56f4d14e29ec5914ef51bd2edf8a61e25ecfce3b2d6be6fb368f8","lib/libwinapi_onecoreuap-profapi.a":"edf98a33a7377ea7affa0847479cdce329af615a9ff90ce271e4311a275a4cdd","lib/libwinapi_onecoreuap-propsys.a":"e91eeeeb49bc5703934a86dfbbb2a458c77c11841583af037f771c068680739a","lib/libwinapi_onecoreuap-rometadata.a":"a36bf05aff08f2d227a96d0b0178d401c68a8a289f53a84dfb41c3f47f105cc5","lib/libwinapi_onecoreuap-rpcrt4.a":"e0fbd8c5a2374c45601de615672f568204dea9e700669c7c8aa5f57661b3e8f3","lib/libwinapi_onecoreuap-samcli.a":"87afe7ca91002af17023dc87fca3273ea7e1b8c528ddef4090bdf999b52c8286","lib/libwinapi_onecoreuap-schedcli.a":"926f2b3f46e738c629fc0c25d638f21265db4935fa0e88ea0534bc034f8461fa","lib/libwinapi_onecoreuap-srvcli.a":"97440b0de6f0d6c44f5cb164bd0bd003439aae65010d9776a15943755e03b4ac","lib/libwinapi_onecoreuap-sspicli.a":"f76d297919833bce142c60628afd8262001ced9167ddf0e5a4a88e0fd4bb3132","lib/libwinapi_onecoreuap-tokenbinding.a":"367436cc51ea44815e6787f36c94cc79d000695064a1af10d4838960df8ae23a","lib/libwinapi_onecoreuap-uiautomationcore.a":"8478851f63c4aaf3d4ebec90d401f600a1d5d766ace095f37e8a9e92806ae06c","lib/libwinapi_onecoreuap-urlmon.a":"377442751f9e9f60a975a719d64a218a6a6ef395705b81d24769f449a4045098","lib/libwinapi_onecoreuap-userenv.a":"e4521774b639d11c5f44a34f8d3e6e5dbe6d23b1dd96d8c7708334aa46bbc23e","lib/libwinapi_onecoreuap-webservices.a":"60ac62ece62892bb6ae6c56a59d75cbfb9e3cae4f93e043a45f7cabde83545c3","lib/libwinapi_onecoreuap-websocket.a":"1a05bc66523baac5824c146aa8926c35b6b2acfe1df2ab830e0897c44dcbd25b","lib/libwinapi_onecoreuap-windows.data.pdf.a":"26a379975426aabe528ff0fc7ea303618f72549f8db06c3c7e01e76d78b3bced","lib/libwinapi_onecoreuap-windows.networking.a":"d8a72775acb279a2506861da526f3157576a663eb3accc17cf9526d0c88724a2","lib/libwinapi_onecoreuap-windowscodecs.a":"7efa18011d3656e3fdbc212275e4d18dfbd0e761209eea62cb0a63607d473fe8","lib/libwinapi_onecoreuap-winhttp.a":"45349940a99a4be7bf19b3b62a8e9f422807bf49790c9af88cd7421b462da425","lib/libwinapi_onecoreuap-wintrust.a":"c0b468f69150163c919d067fa65adce769dc2c3b03a19b4b3146d6d677a0ad1b","lib/libwinapi_onecoreuap-wkscli.a":"eb5b920b6f24c96a0cf522adc25fe75f511ccf765f1d8ca35bb617f89397812a","lib/libwinapi_onecoreuap-wlanapi.a":"213899a6dc7d4c4429e297b633758e85fc416a90de41878661c14ed252734f1a","lib/libwinapi_onecoreuap-wldap32.a":"afcd3b76aa882d56bb07ca241fe82c5c44cb93c222002419d28469bcb662309e","lib/libwinapi_onecoreuap-wpprecorderum.a":"e0e7813d542aa825d4f8146c7c7532ba83586d2a28a05315fdf43b81b1d34c86","lib/libwinapi_onecoreuap-ws2_32.a":"d4b7bc67a1b2ef2c3b454cf47ccfef81539bed541bc7a254bf6de379082e6a96","lib/libwinapi_onecoreuap-xaudio2_9.a":"983acf7b29684338c3cfac1009d1f3ea1f0ce12e826018f8297e5aff40474343","lib/libwinapi_onecoreuap-xmllite.a":"15a707fbd4170432fe2f8d8ab1befc7621f67dc1f89d229feab79f551a44de85","lib/libwinapi_onecoreuap.a":"4e300d7c78faa2b7d468aa0a6638fc58c670537dce77cd5a2eb6ddb02b56d052","lib/libwinapi_onecoreuap_downlevel-advapi32.a":"446b131e441165d435585c347444f55eb11086da6d23e58e2cef7bac5de0ea1d","lib/libwinapi_onecoreuap_downlevel-apphelp.a":"6f450c64be21886b051f4110a30771fc5cdfe4c9494424ec5bd9add3c15efe90","lib/libwinapi_onecoreuap_downlevel-comctl32.a":"a5f4814e9854f7185466e0161ae4627d5a081d070c2e2598d4cc73794d098e25","lib/libwinapi_onecoreuap_downlevel-comdlg32.a":"ee490f9621d47e6adf6ee7e2a713829936f90808c6a09941a09a4c1e224b201f","lib/libwinapi_onecoreuap_downlevel-d3d10.a":"9ba34746f018aeb00629d1d9690d341e09770e0fd5f10dfbb81b63f6eed35e42","lib/libwinapi_onecoreuap_downlevel-d3d9.a":"a2a97b7dcda9519a50206b3cabb04517a7de6e5dcc51201eef932e5bcede3b73","lib/libwinapi_onecoreuap_downlevel-d3dx10_47.a":"3a964f22faa80576bca7d2d4d4b73fb0448dc87ba1c293e7e711b301705666fa","lib/libwinapi_onecoreuap_downlevel-difxapi.a":"f99ed8c8c4386ca76a0e0d09f8711577a636768b76a24a4586c294ef52784ab9","lib/libwinapi_onecoreuap_downlevel-gdi32.a":"f546864a2563ecef8edc6b1789ce4fe392e00f23c4e5b18dd572172b4d762d4d","lib/libwinapi_onecoreuap_downlevel-input.a":"8f059f86c0ba3e9f7352e01e6d19a40b0666aed67c464ebc2e8b4eaa132037c7","lib/libwinapi_onecoreuap_downlevel-kernel32.a":"f68ce42f050eaf7dde5a36de2f073e3a7021e13d0715b4c5a9b9b29c0bc0ad42","lib/libwinapi_onecoreuap_downlevel-msi.a":"727a6ad9ef23c36ba9dc511b39e6b5d08f8a06fb97357b70a3741dbf6196688b","lib/libwinapi_onecoreuap_downlevel-newdev.a":"1494c911ef6039ec297ed14800aac6aa694f4a75d80fd8ac3d7218b5dbf851fb","lib/libwinapi_onecoreuap_downlevel-ole32.a":"99934cc9b0f520238540aee73c345390fb657b51bd8d1a66723086a647ea3310","lib/libwinapi_onecoreuap_downlevel-oleacc.a":"2fb46c4eb802dcbcd767f81505f3ef2972be7133290ee38ea117338784a3d5a4","lib/libwinapi_onecoreuap_downlevel-oleaut32.a":"0085bfcb320c8129a2612f556fc7045ef71f2b521923292855574b7f10792e3a","lib/libwinapi_onecoreuap_downlevel-oledlg.a":"b2ca13d5a826424c60fbe47db98164fcc0c566acc9c52a5cd2eeeb4bdf305fe2","lib/libwinapi_onecoreuap_downlevel-pdh.a":"3a3083755e865e489cb362dcb5a13cad45f399dea58ae9509ee91a7e79b79e5c","lib/libwinapi_onecoreuap_downlevel-psapi.a":"6fd037774d3b2cf0c40e4b2a023f96133eb7d29d2adc2e95354c8fad39debf7b","lib/libwinapi_onecoreuap_downlevel-resutils.a":"36d52efc86720df0876fddd88d806c41f69809880e69239317d736f681a48951","lib/libwinapi_onecoreuap_downlevel-rstrtmgr.a":"fb4efcbc9c0d907c829fada91abb26cb922f1a2790fb01852fea812f18534257","lib/libwinapi_onecoreuap_downlevel-secur32.a":"3e7351302d67974e1c613d3734ef43db2aaa5ebd73f2b8a775b175db47741b8f","lib/libwinapi_onecoreuap_downlevel-setupapi.a":"fa6597834a8abe76e05dfed0a3e016929fcb077d6ea9c0200ec00b6cd9f1c6b1","lib/libwinapi_onecoreuap_downlevel-shell32.a":"94ec337fc06b86503f2418e483cb768ca16da2b63f8317cb84ac75fba9475f37","lib/libwinapi_onecoreuap_downlevel-shlwapi.a":"30021f8e94ed49fba0d48c496a9240424010b09c571a8f7cbcb4f94158f10e0d","lib/libwinapi_onecoreuap_downlevel-tdh.a":"2d9e5f8ec479e7cc72b88ca8a7eb1204dbafee1363c02c7451b83c191fd3ed1b","lib/libwinapi_onecoreuap_downlevel-twinapi.a":"0900ea4abb2b66ecef125c036aa1fe992f3ec77371c229743bd70e01d0af8346","lib/libwinapi_onecoreuap_downlevel-user32.a":"362b2072ff4c99501bff9bc5dc6aeb1f5808f78e3eb78c7c75f5a1af3363ac29","lib/libwinapi_onecoreuap_downlevel-uxtheme.a":"29b3faa13cfe3b390d8ebf41b9c08d56c84aa801c71cbdc5d9173381e61152d7","lib/libwinapi_onecoreuap_downlevel-version.a":"b03dcf6bf1ba34ba56b620ea8022a7179c7bddc967dedfdc8b60d3346db0f9e0","lib/libwinapi_onecoreuap_downlevel-winmm.a":"853ec28ba94036b193c79c85d1dad2b4db5fd913f737c6b796bc983c7ba17c99","lib/libwinapi_onecoreuap_downlevel-winspool.a":"510d3b0f0f11d3c51cb88bd6eac65c9a96b118550ea8d243493d5cd8ced4db43","lib/libwinapi_onecoreuap_downlevel-wtsapi32.a":"6306d9a9027228ef56769312823ff6e9631e4878ae7787e97bd10a8c321a3f64","lib/libwinapi_onecoreuap_downlevel-xinput1_4.a":"2dd8563974547350ad927aa5ae72b8286137685c91235a3e9657fb454780f64f","lib/libwinapi_onecoreuap_downlevel.a":"6122e2af86381e597496cae0a138331539bbc7ef6056086e4700e17cf7da3614","lib/libwinapi_opengl32.a":"cd61467bd26c2f04263a328e8f24a0eab68b5b4aadbfbe3783434ea3863a84e8","lib/libwinapi_opmxbox.a":"17754f6ac6a65ee1ad76cd4f9736a861900899e4b6e8d933158a9d9e7a356b60","lib/libwinapi_p2p.a":"6080dc0993d44a7fcb3d7823771389b94a1e6d98ea6c246d54b3a072d7e4c7ec","lib/libwinapi_p2pgraph.a":"8ba6ce395e5a033aa787a01caa231ff21e76cd474b8dc2a006252c41f5bcaf48","lib/libwinapi_pathcch.a":"ee5b051516e4c8ca29cfd16f0faf0ee38699be03f76c0eb2d16a7dc48fa2e10c","lib/libwinapi_pdh.a":"c38a909863a22830824d9970dbc026354846b5b54674694544c3928d25469f85","lib/libwinapi_peerdist.a":"c73e4b074e62add8b4030c6e2534ab2388ed5a4c8ba628284c65d27c5c64a777","lib/libwinapi_powrprof.a":"4c15dfa756dcab2e0433b76de463e0ee1ad68531a047bce5ea27e055d1f5f537","lib/libwinapi_prntvpt.a":"1c9516faafb35dfc21d52982cafb9dab98bd8f6942251ba7a4343445d711bc22","lib/libwinapi_propsys.a":"20757cbaec15022c8ed44b465a99f88f9d0bb42936fdc7751330df8dfe13442c","lib/libwinapi_psapi.a":"f6f67c5beee3e36eef891343bb7a93eed84735ea39e45097087830d775dbb651","lib/libwinapi_quartz.a":"173172c1bec299b8c6483950e531f5ad0d7716d2033e06b82aaa16149fd5b6f9","lib/libwinapi_query.a":"d78614fd2084f15e1c832ac41799cdbee92c98580323b4cf47a1344c41eccd05","lib/libwinapi_qwave.a":"8b393b0d5e937d30f57f649b389e6f4f654b5edbbdfe8bc60d7acbf5a44797f9","lib/libwinapi_rasapi32.a":"b1acb42a2631daafc18eb694619288b49fa47cc37f64be62313de9319b3c1d64","lib/libwinapi_rasdlg.a":"00391874f0541e15c9060d07c1035046669c122d2c620dd4ce1c08c0f2750b5a","lib/libwinapi_resutils.a":"d58453d2906d115579550ce88b3d34873262a600eb103f9130ef95356b748044","lib/libwinapi_rometadata.a":"5fd852779025837e7b66422dd543b4f8fdfb188b6f7fc5a6d758aed4f666043d","lib/libwinapi_rpcexts.a":"dcfb0696cb99c7c4fb66e614f991e9f5e6093557a88afd5da3d557d3d47f0262","lib/libwinapi_rpcns4.a":"7c642bd1aa5f392a8167459f84f942d60ce5ddea53f7e65d1cefc35b90313c89","lib/libwinapi_rpcproxy.a":"744bac498456a0d486cb1250390c57708479d815d1d028fb88222a45bbb9a31c","lib/libwinapi_rpcrt4.a":"81ad88b3cb4bda2a013695376a32d39d20a8c847fac82c1a640fb14ac2874cb4","lib/libwinapi_rstrtmgr.a":"58695aa1de3f1a45a3551e337d2278363e99e8994fde5bb7429ca91bf01eb670","lib/libwinapi_rtm.a":"e279ed0560e4e178a1e16c2f017b401bf4709f15f0bf48bbe5705edde7ed4ea9","lib/libwinapi_rtutils.a":"e4fbdd5ce86a67f0839adeaacddc5e3fb4dc1a44e443f51f79366311a27e8641","lib/libwinapi_rtworkq.a":"558abac8f635cfddae0806bca089faf1103b84222c7677c258e6d18325eee0aa","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-error-l1-1-0.a":"3c22240ddf62dfa3d893adc44e25040b26b3a38ebe772854e6bc9fea4628013d","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-error-l1-1-1.a":"cfda587f4371f9e7e0bdea96859b98d874ae18daa437b75725563d5c423e99e8","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-l1-1-0.a":"907707ad032da229b20bbae0d25c7306d22e996a7f977b3097c3a01d5317f261","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-registration-l1-1-0.a":"49618d57bd1a24aae006acf0103ae8095b9e66421a631e1e9ed384a7197d07f8","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-robuffer-l1-1-0.a":"70581a27d058901a5a9bbf41a16aa5d16bf72f65b12af4fb85984bb48e3ee1dc","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"07200e5f0379ae3cfbde9b851ddd5d91183b4b1994aa3e4b5b0484e302341612","lib/libwinapi_runtimeobject-api-ms-win-core-winrt-string-l1-1-0.a":"fffd7d400e5dfead0b73981ed370ea2b082382b07ebb93fc7232f374de10eadc","lib/libwinapi_runtimeobject-api-ms-win-ro-typeresolution-l1-1-0.a":"48a032b080076be0ea91bc87e0a0a6f7415e8091b9db50fab0c6baca209e3a95","lib/libwinapi_runtimeobject.a":"7a0548c5ef5fc5788025e031aa642d18ea94559299b48fca507d3f52ef2e4b9a","lib/libwinapi_samlib.a":"91ee9a8d2bdb3501c6766343d1bb6bae46c39a20fc587812c78830173f1396a3","lib/libwinapi_samsrv.a":"d08bf3016166a2f335d04301a3064c433853db5466f5bf5a86653e42e93c5d2a","lib/libwinapi_sas.a":"405d7376cb9c77f67cfd5670bcea8a01cc16b19be6c74a7d1df53a7b9c42017d","lib/libwinapi_scarddlg.a":"fcc2ce4de77b26febb5d4775a1d8ded0509663f0ed17a8e79348cbcece2b7e1d","lib/libwinapi_scecli.a":"da81628253676a97948a59b44c0c16e760a34bc3b7ae87191dc235f07960c0d9","lib/libwinapi_scesrv.a":"639df7dce2b17166d0258e7368712e1024035a51293a2c169b42ccecdfe11aa4","lib/libwinapi_schannel.a":"e9f5890a84dc3b8314ec11f29301ff8471d94b5937d46d25d3ed6081c2ab8073","lib/libwinapi_secur32.a":"ea9cb6b2cf08d69c851ba23894cded1f7c4d832264af7fe91be7b9e862f8d20e","lib/libwinapi_security.a":"ff008080e458fcc7ffbfbd79bfa4da9dfe867c88015490f2b01424afe20086b7","lib/libwinapi_sens.a":"44b53c350bca96699a47e731c60996bfb7a441b49eeb37baa7c3d0d6fef559d9","lib/libwinapi_sensapi.a":"19841a881728565c15ef3c431e7e317f8301813e6b046146f01203cca0fc3292","lib/libwinapi_sensorsutils.a":"e4073214a0d131b4a6429606a07ce59d90367b7700ec1a642813b8f62ee65c4f","lib/libwinapi_setupapi.a":"ca332f657ed83d5a06a576d90529c1519d90fbeafa93c71f3542d4cf6b03eb3b","lib/libwinapi_sfc.a":"2dc50bb6cb53e5424a6ffef118fdc727ad22964687da87d0a101659b08984139","lib/libwinapi_shcore-api-ms-win-core-featurestaging-l1-1-0.a":"fffb49f303f5b25760ca8aa705ef97be92f642e647346687fab8aeb1883ecc8a","lib/libwinapi_shcore-api-ms-win-core-featurestaging-l1-1-1.a":"47e523efb180adc869d72e03c084b895ebe56ae5120b49a9cec6c6883fd687ad","lib/libwinapi_shcore-api-ms-win-shcore-scaling-l1-1-0.a":"0f4d8acbe62d2437d856d45e09bac00f65f0ade09dc5c326581d9704957fd75f","lib/libwinapi_shcore-api-ms-win-shcore-scaling-l1-1-1.a":"d244e9560e96e214d80806f8598e71e98ba9103b653d372dbde5f45fa33a117b","lib/libwinapi_shcore-api-ms-win-shcore-scaling-l1-1-2.a":"b2e1d7ae641a34f3c1049b788300044c1bfaa5504533cc57e046d9a13e386ec0","lib/libwinapi_shcore-api-ms-win-shcore-stream-winrt-l1-1-0.a":"4c3a88da7377928ff249a0620741cd949355f7ae8c3a11db78c3a1b375a8eb89","lib/libwinapi_shcore.a":"e2d0fa7e9c0d06bfec41008a6f41c47769cd4ba6ca839efdb99bc2e0cf4e1a39","lib/libwinapi_shdocvw.a":"1e0f3f43046b0ea779d69a3c46ef31450386baf3a135f8198a2299f9e6531fe5","lib/libwinapi_shell32.a":"342bbf0eac1dc3441526dbda7ba79e269219a5820a9a54a6c41050e8b28b4d5a","lib/libwinapi_shfolder.a":"64695b29cf965c9de61fa26aacf27acc43d9653166edcf47cce011a4bc171f27","lib/libwinapi_shlwapi.a":"e111842c79bb11433d74b9f52d51a74ae8f78527470bfc401565847b9c59c5ba","lib/libwinapi_slc.a":"9841bf76a2366a73b33d7d14c220813aefd2cf0462f090231f0ab44e7b5bfdc2","lib/libwinapi_slcext.a":"f5141e0529d6788add8b0bd0fdd0b4268f25deafee8d2dd59f427fed82f63b6c","lib/libwinapi_slwga.a":"3a32c92e0d192e675b1aeb8a71272dc14608cc62b26aa6b9db0ec1c3fb6ff556","lib/libwinapi_snmpapi.a":"a1456434d462c80e906523d7c389792be7ea5eaa17dd0d162e65a1b543368e57","lib/libwinapi_spoolss.a":"f53249a979dfed0e0038db4e8f4a8536b1f6382998112429e2d0bfbb0bae6bde","lib/libwinapi_sporder.a":"c18d86b92469bed1231057ce4c2dd76be4fa325e5576cab1828ef04b11af0e26","lib/libwinapi_srpapi.a":"d9301c3d6778da6efd7fc82b081931548ac0f9cc0fa0985bceab6fdb533abada","lib/libwinapi_ssdpapi.a":"66300e9a08686873fb992c8398284c80b40d8a28b8d55cb9455024b8e3888acd","lib/libwinapi_sti.a":"1a674eeb27c4a0854d01a14b50ca2fec8cf116662087887c485f93315440072e","lib/libwinapi_swdevice.a":"1d6363c447b68581d2a9f0cf6b874c6296878f974f239e9ac1808eea1a2b9d06","lib/libwinapi_synchronization.a":"fdc8df30efc2b7fe58d83d4eefa6245f35f2e534bfa6357c069e061da91aaef1","lib/libwinapi_t2embed.a":"79a7a2ded05e377b286fe3319ff30840632c8e6b08cfebe619aed4ef18dcd701","lib/libwinapi_tapi32.a":"b92b8648e4d8024f6457a84f80432048c83e3946a069e3ee241fe7a0188e1329","lib/libwinapi_tbs.a":"85a9741c2789221e90d4677df38f12ca837235c46b6ca765d1516e5dd9b8b89f","lib/libwinapi_tdh.a":"7a40b11938eb4c888283edb75b523ce58ba7bc80598dacea4c9ccb674bf71603","lib/libwinapi_tokenbinding.a":"faa88b4ca04226baedacd9b34d9dc46bc332c1e8aa87a2bf1a7f152c106623a3","lib/libwinapi_traffic.a":"7838ad22ff777a4de867353c5f2960ada912bc502b421c70d2c1ab814af37696","lib/libwinapi_tsec.a":"94d58b06c649ac6febd1be8c0a14ad112871fdcad75122ef4bc39ee52d2744af","lib/libwinapi_txfw32.a":"630f274d67e4956ab9d066d3cf79cba5de57b173fa8988c242520be574ae0f2c","lib/libwinapi_ualapi.a":"dafc0cc5db2358020464598f1750ed79fb5deef00eff70332d134d922e08bea2","lib/libwinapi_uiautomationcore.a":"9386c67bc47a45637e8ad963133f2bef11adb1ba0f7744200378b7cad245a571","lib/libwinapi_umpdddi.a":"6917cd155ea1efc89df72102d9b240d5deebfd09d8131b1376fc30e44bd4cefc","lib/libwinapi_urlmon.a":"15500bc9703d990df5c76e9fc982549eff5137e912901833c36731cbb1ef03cd","lib/libwinapi_user32.a":"cab4ffa1522d2cd626585ef27f0355b89ca2cf6a1af208cb0a08a851be676c2a","lib/libwinapi_userenv.a":"490004a87dc9a33eaa5178d4e0f9d4e2e5704f227c28eab018c9ebdb329ad003","lib/libwinapi_usp10.a":"9388553f5594b2cb0fb5de349f86462945969b215baae6ec3563ef422c0ff236","lib/libwinapi_uxtheme.a":"e79890801a208f5a97a032527f1b6580860fc170fcad13f60af7025bc55816c9","lib/libwinapi_version.a":"9b39a94cd041c08006833571ef2c5010ad002580bd7a7f959ccae4b7bb2a53a2","lib/libwinapi_vertdll.a":"2d9e673b14ac040402fb01b7cae7c38a8f069de117f24ee528c48d2200dc046b","lib/libwinapi_vfw32-avicap32.a":"6539084f6426499412e3e227a60ade3f66c9c7cfc0c3b56574c247ad8ab20b6b","lib/libwinapi_vfw32-avifil32.a":"a46baae68ee4545847d0f943217b607b3db4c0e98c8f636bd0e6cb5358385f53","lib/libwinapi_vfw32-msvfw32.a":"df741fa382f893f72277d9c9c61186252df1b3a53fd46fef0bd4054eea583dbe","lib/libwinapi_vfw32.a":"1f7bf15b2c0d637ef6a424ea0173f26d9adabb2bfbcc5711a95b408e060a7d96","lib/libwinapi_virtdisk.a":"b49c9ad313c8f3721d471aa92efbb671a9033104d9b455fc001e7d51fe554c03","lib/libwinapi_vssapi.a":"b6419c12a1aa251b7afe503b506b3cc2d2110bfe7b63329974915535f7ffcba8","lib/libwinapi_wcmapi.a":"d7d5892554e47394023a11be4073dd8d37d68bae06445fae9031d9c4fe25550d","lib/libwinapi_wdsbp.a":"d66a854206703421d8047aab169c0164f5601d72b18aa9995866023df455ea5d","lib/libwinapi_wdsclientapi.a":"28cb87834670a97daee6b59bd2e3f93d7054591fa8534dc31b496c57c45605c8","lib/libwinapi_wdsmc.a":"64197d80127a7f2fd6d2a86dce0d22d279859bc30cc50990acc484e1f2268def","lib/libwinapi_wdspxe.a":"44a2932596e7332447c45e60d361bf2fcf07e4d80dd505e4d9154e1c104abed9","lib/libwinapi_wdstptc.a":"c080d87fc9aa5c90d9eb936a4c4087a90703b612109c415b319533e6b32aedaf","lib/libwinapi_webservices.a":"bbd4e2a1d1129f2402faa311d232b16d5459b8a735cf08172677e83e19eb232c","lib/libwinapi_websocket.a":"c43b8eda7cde0a8040732b4ac093a1197fc4e2408ee9b8014659da745c25829b","lib/libwinapi_wecapi.a":"88a7259bae69e5c6ecef972a56b529d50151170b5886503216010e3f0bda4b1f","lib/libwinapi_wer.a":"a345247b177870607ee9f53653ac31618b258f2167b08fd1f4e064f4bf7eb9b4","lib/libwinapi_wevtapi.a":"83f302ff302968a7baf739ba768669e4b9a4173377ca00ae2f9f273ed7f7a494","lib/libwinapi_wiaservc.a":"acdd02371456418233a310bc6c9f3b89679b1f404189610c4c8e4b2dc391289a","lib/libwinapi_winbio.a":"849ebb2527d786c4b9e7c003c1d0b3d6870760af55fb459d95b5ec5a9ac23841","lib/libwinapi_windows.data.pdf.a":"3bfaa6d9063849a48231a0f0389bff1d943fa8731e8f9dd0f44e60a1fe83b273","lib/libwinapi_windows.networking.a":"4779dcaaf565e38ba1b70de811a7b054f71b8518560aa197b31cda6e19dea6f2","lib/libwinapi_windows.ui.a":"ceacde478768ba266891473df34530edcbace3f0d2f63fd4ebc77f2db5ae035e","lib/libwinapi_windowsapp-api-ms-win-appmodel-runtime-l1-1-0.a":"ae5a529ae45288b871632f3ec12db35ce4dc1ce8535963928263e57a9b00e938","lib/libwinapi_windowsapp-api-ms-win-appmodel-runtime-l1-1-1.a":"83b45b3b1764b8bade36adf6be1e7b4129000deb8fa6a74da66010c2e1972d3b","lib/libwinapi_windowsapp-api-ms-win-core-com-l1-1-0.a":"4e371b5c9bc78e90de4bccfb5f8591f1a00ea52dcf3ebb5ac28d42cebd5323e4","lib/libwinapi_windowsapp-api-ms-win-core-com-l1-1-1.a":"508fdae146d10f709f241b72e50538b806411365bfd25d0b058f930087d48468","lib/libwinapi_windowsapp-api-ms-win-core-com-l2-1-1.a":"eb431ce92e4089fb2b4041beb5a1c6cb5b3a6b260f7c7b5b2cc939163842709d","lib/libwinapi_windowsapp-api-ms-win-core-com-midlproxystub-l1-1-0.a":"7732e7fb9cbcc6f7420942491e7e6ffda9d4d342df6cdc6d6ce8ba703db38280","lib/libwinapi_windowsapp-api-ms-win-core-comm-l1-1-0.a":"2854591f2764af61e6e9d0eecded807cd4d1bf1105c11d8443149f63faca95f6","lib/libwinapi_windowsapp-api-ms-win-core-comm-l1-1-1.a":"cb8d5769116f8bbfebf7ee76d5dd0328a07bd40c5fafedf9f77ab4233cbf0145","lib/libwinapi_windowsapp-api-ms-win-core-console-l1-1-0.a":"47cee44464b1b6ab8f830bed46a74268588123fb2fefbab2f995a5f4ecc6b05a","lib/libwinapi_windowsapp-api-ms-win-core-console-l2-1-0.a":"d1d821fbfa3dbd91b8e979132a8f8489a027ff012bef7dd966ae84887b264207","lib/libwinapi_windowsapp-api-ms-win-core-datetime-l1-1-1.a":"2d7c594d910f03157c45bd42746da0270fef7908068cc30700d07f6bf3549e0e","lib/libwinapi_windowsapp-api-ms-win-core-datetime-l1-1-2.a":"68d751df1f53f2076de469949b57bd90bb6ebc5b146835b43aa786bc6235a6fd","lib/libwinapi_windowsapp-api-ms-win-core-debug-l1-1-0.a":"09381a9efd95ddf5eeee4bb4f9a726f930c7de0cd33c559e5f18306d56ae97ac","lib/libwinapi_windowsapp-api-ms-win-core-delayload-l1-1-0.a":"3d346fa6b1fe9d9a73b0f8d0b9444cf57917bf59bce6ffa3579932788a8e11be","lib/libwinapi_windowsapp-api-ms-win-core-delayload-l1-1-1.a":"a2feab35eb695d0f9e6b2cd7ca5889831353ba5cf7e6a7101ccf7a054f97f2c8","lib/libwinapi_windowsapp-api-ms-win-core-enclave-l1-1-0.a":"567dafb75dbef76c3c323fccb2a0b53a2a38c22f4e62a9d67f59df122a1fb5ee","lib/libwinapi_windowsapp-api-ms-win-core-errorhandling-l1-1-0.a":"1759d5d8488b35db38e39328b66608ab3e253deb3a1241e14e79e7b329da024d","lib/libwinapi_windowsapp-api-ms-win-core-errorhandling-l1-1-2.a":"23fc0a3663b50a1961af9d96f6765cdb5fbab4093a5d39181ca0eb244f44478c","lib/libwinapi_windowsapp-api-ms-win-core-errorhandling-l1-1-3.a":"b4cfaf6b55bb108a94a5e68124d2e9e0c674390fd7a35b9b3c625ea5798b2774","lib/libwinapi_windowsapp-api-ms-win-core-featurestaging-l1-1-0.a":"74f32a510cce263ff575350680506802c6e3bb23d7088db7d0308725cd9da80b","lib/libwinapi_windowsapp-api-ms-win-core-featurestaging-l1-1-1.a":"363e8d61b1012f11ff747e76c23d271b3115dcd50b8c0269d7407c77e1792b7b","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l1-1-0.a":"e3a89400ce02e583cdaa8fa4de050d8e65ee0339b13ea82f73d5096de7cda622","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l1-1-1.a":"00e98c96b9ed76b067c279fe68582d292476186b4c2f2bbbe3ef414e89848571","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l2-1-0.a":"96c54ff9391a8c24f3c3437d1dc25ab3c84c360d3159f7ccd0d0e8c7f351d9e5","lib/libwinapi_windowsapp-api-ms-win-core-fibers-l2-1-1.a":"a7aabc370c4945162648ad40feb159defa54ea457c6d6def04e2bae1935bea5b","lib/libwinapi_windowsapp-api-ms-win-core-file-ansi-l1-1-0.a":"fe2f464e89d569e63bd5d87ceceb81beb440bba950b89e537a067f36319f92a2","lib/libwinapi_windowsapp-api-ms-win-core-file-ansi-l2-1-0.a":"6f9530c4aac755d101bd7d3106c44fa5ea3244e33f4a3c19a75d9a9407934d94","lib/libwinapi_windowsapp-api-ms-win-core-file-l1-1-0.a":"199bee21f074cbefa33b60301865ba5e4f1376f75c912147f13b55c7dea05610","lib/libwinapi_windowsapp-api-ms-win-core-file-l1-2-0.a":"1f5673e6408eb3f6bca799abd9296c32ef0cd32d97f5d9ca4133a99611dbd8c3","lib/libwinapi_windowsapp-api-ms-win-core-file-l1-2-2.a":"c37cb5b9d56b54b02d5938bbe8143637267d4c36dcb923e641fcac497c1b3f17","lib/libwinapi_windowsapp-api-ms-win-core-file-l2-1-0.a":"677786bc9efc8691621ef64dffb264bc16b7b1163efe6baaeafeb7c6e36ba389","lib/libwinapi_windowsapp-api-ms-win-core-file-l2-1-2.a":"a9a139d309cb0c125c4fa65307fafd2638786f336f0e6d6fd1a7449eee13da49","lib/libwinapi_windowsapp-api-ms-win-core-handle-l1-1-0.a":"26caaf18006bc0abbe3d56a73ff96a9698111d9f4b98fb1f0e790f4447d5ba59","lib/libwinapi_windowsapp-api-ms-win-core-heap-l1-1-0.a":"bfd091b593c6be02e8d274c3d175b0c220fd2984837dd87d135c351159e201b3","lib/libwinapi_windowsapp-api-ms-win-core-heap-l2-1-0.a":"73ea930467212eb507cfc65b6aa44d0afda3d61944d985f75b931e457087a8ab","lib/libwinapi_windowsapp-api-ms-win-core-heap-obsolete-l1-1-0.a":"ef5e4130be7b1a1b883df609dbefc06f9e54672ea9f4a24bcda165b2e9037cbe","lib/libwinapi_windowsapp-api-ms-win-core-interlocked-l1-1-0.a":"394b682dd8369924304efac3c96c0725ff708e9347aca12bcb0507bc1b12d9cd","lib/libwinapi_windowsapp-api-ms-win-core-interlocked-l1-2-0.a":"21d8e69b6b3c0d0842ead7195e4eeae70235eb4efd83672d370eb68c30230eb3","lib/libwinapi_windowsapp-api-ms-win-core-io-l1-1-0.a":"b2226ebecc94545b17792169b91fd2b9c484ef3fc57c2f2ee7fc8c24732b93d2","lib/libwinapi_windowsapp-api-ms-win-core-io-l1-1-1.a":"fb8c39c016226f510786f877ecf22aa3a0aad36035f43bf52e38eeb1d1d0dc2f","lib/libwinapi_windowsapp-api-ms-win-core-kernel32-legacy-ansi-l1-1-0.a":"075f58aefa7fb31879599afc6307ed2d6d21877106741cfc60198a6cdaaf47db","lib/libwinapi_windowsapp-api-ms-win-core-kernel32-legacy-l1-1-0.a":"dfc425b74e9c9b8a9ce0ac16d6b07720eb27039bb82d24b1d6f73f31453c7700","lib/libwinapi_windowsapp-api-ms-win-core-largeinteger-l1-1-0.a":"c842bd5d226d538229d7fa7b354c5ed80ab9e16abe4d05d687c7b5aa6166a7bc","lib/libwinapi_windowsapp-api-ms-win-core-libraryloader-l1-2-0.a":"dd46e937f2215d3b8066a73fb33dcf31612cd4c74aabe86cb17ba7dfb6c3541d","lib/libwinapi_windowsapp-api-ms-win-core-libraryloader-l2-1-0.a":"e19d3c11346e736ced16193b8419f6c887d7bc19d0b77bf64445467f8da453c1","lib/libwinapi_windowsapp-api-ms-win-core-localization-ansi-l1-1-0.a":"1b4eba533a023b9b2c1a0489fd4a8e1dabe129772414c8784b939c6b209a8393","lib/libwinapi_windowsapp-api-ms-win-core-localization-l1-2-0.a":"63b4a889f279bbcce34503874b546c12b610af3c336e94ab1b12a321af219da9","lib/libwinapi_windowsapp-api-ms-win-core-localization-l1-2-1.a":"798a833babb6b8901ae06ea1621a1d14ff4d573c9dd80be964ab2895ba1763d8","lib/libwinapi_windowsapp-api-ms-win-core-localization-l1-2-2.a":"25dcc0836462742853efb4b704e709ff182935495e7a4b6c385cfa30cf7b771e","lib/libwinapi_windowsapp-api-ms-win-core-localization-l2-1-0.a":"1e448b81a7d1ee34ca4915917f11762550fb0895619bd6aa8ce11522798abfcc","lib/libwinapi_windowsapp-api-ms-win-core-localization-obsolete-l1-2-0.a":"ea08db7dbadd651054597951dc0114e71563df15ccf39e770d7f70b73967db9a","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-0.a":"5c1b0121f7cc1578b79aa592f3a5a157d471d367e1337ea599281e1df7b308ff","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-1.a":"a2ec02ac776bb5f3dfcde0bef2478f8ca681c9d62a7ae7396eac3b3bdb5e0018","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-2.a":"7d3c77019c63c86e19d4a9d007687d2cf32d6c4c3a69597b52fab704bdb9380a","lib/libwinapi_windowsapp-api-ms-win-core-memory-l1-1-3.a":"bd87331f4656c12e21be4f809d3e6c15dfd3f5f623a26ab1eb816814cb229de5","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-ansi-l1-1-0.a":"679cf926529bfe1745149cf17072ae8842da2d8d43d51d595e47e50b7cc3ad88","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-ansi-l1-1-1.a":"f88640101f58332a336fb473ea273e400075bbdfb339c74936491e8d871dbc8e","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-l1-1-0.a":"ef8ee63a4f86b293b8da715f5879a5a68e1473aca6e9d9def7f80703652586f8","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-l1-2-1.a":"8b5111199eabcd7bed60691e5f0560e2fb8cbbef259cc6aeba814036dde1d64c","lib/libwinapi_windowsapp-api-ms-win-core-namedpipe-l1-2-2.a":"40bcff81cf7fb2dd08bf472a1c20cb5a68366563ef63ee377c2955c0b712eec8","lib/libwinapi_windowsapp-api-ms-win-core-namespace-ansi-l1-1-0.a":"53308d6bc82db5f0b8df19e8c2d0d3cc8ad175491f4afe3ad43d3f2459fa37ad","lib/libwinapi_windowsapp-api-ms-win-core-namespace-l1-1-0.a":"fd98443ae36986e88870d302b821de44f253b812846204c3b320936e94b9dcb8","lib/libwinapi_windowsapp-api-ms-win-core-normalization-l1-1-0.a":"74e7e75117b012a700079e7a8f6bc7dd772fa1b045426476ac4aa285510e8033","lib/libwinapi_windowsapp-api-ms-win-core-path-l1-1-0.a":"f0f658a64b32553cb31da782c975c2c10c89e9b0c4d2db8647c04419ac5afca1","lib/libwinapi_windowsapp-api-ms-win-core-processenvironment-l1-1-0.a":"2a1c018da98ba81eae3c952d3e2246dabd2815d6ecfa9c299597af31f41bc8b0","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-0.a":"af8ee6bcb56f69f6e8cae367d3e5ca7a7e5767a65ef025ab73444cc4cd84f2c5","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-1.a":"61283492150d56f27b1565ab137446329db98cab4d8a4686ddbe601f78533199","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-2.a":"2f3d245f6f1306f1982b9bc6b9f7f189478578475c74ccce41c74e2d0f9fdc71","lib/libwinapi_windowsapp-api-ms-win-core-processthreads-l1-1-3.a":"e1ec06ed7a57190a3b362ddae83a2d1673654780aaab2669e4ffa98148392388","lib/libwinapi_windowsapp-api-ms-win-core-processtopology-obsolete-l1-1-0.a":"0b8045cba487a094bdc9968ac70e7c74a06203ffdee79dc7f7161235beb7c3e0","lib/libwinapi_windowsapp-api-ms-win-core-profile-l1-1-0.a":"a21d40fa108dd467e7a1a33f28b275f747a101efc4207e8edf07ea043bd7e89e","lib/libwinapi_windowsapp-api-ms-win-core-psapi-ansi-l1-1-0.a":"d7e300765ebe2b9023a5212fe76fce6da4bf1811f9311c8753694cd4e4340f53","lib/libwinapi_windowsapp-api-ms-win-core-psapi-l1-1-0.a":"bc28e602fb4600315fc2e1c84520eac7ec1e3d21d31cd68b1f21ec2fa0967839","lib/libwinapi_windowsapp-api-ms-win-core-psm-appnotify-l1-1-0.a":"5205a816830618555705303c76171e70e4427f6eade4cf2f0b9925de49f971f5","lib/libwinapi_windowsapp-api-ms-win-core-realtime-l1-1-0.a":"94c517e63ad80396976472250b833a63918768b56fae0a560e9d0f2b7de8e043","lib/libwinapi_windowsapp-api-ms-win-core-realtime-l1-1-1.a":"a6162bad2c4390849f390725e9bc9300960f654c86ea4764d8a7abefa0dc15eb","lib/libwinapi_windowsapp-api-ms-win-core-realtime-l1-1-2.a":"44fde3a07b7f045e20eb7c93d26f760fbe7c77602a829c5393a7cb991383f837","lib/libwinapi_windowsapp-api-ms-win-core-rtlsupport-l1-1-0.a":"662a900b3f217c0355ce0b6f9946d39c84b2fa9ae94d0a485c8c52d28ce1f3af","lib/libwinapi_windowsapp-api-ms-win-core-slapi-l1-1-0.a":"da1a0bf48aac28cc96e29822c62333777787193394e9e7fa0aea17ad232a4940","lib/libwinapi_windowsapp-api-ms-win-core-string-l1-1-0.a":"02cb9f55b872652c53b2533ee92e75eb327c2dd52cbb2d327f336ef009f9e93c","lib/libwinapi_windowsapp-api-ms-win-core-synch-ansi-l1-1-0.a":"d46dc40c1ccb40880bb4052aa17a458c858388da0da7cc9eb96da8aa09b5231a","lib/libwinapi_windowsapp-api-ms-win-core-synch-l1-1-0.a":"677778edda4531176ae134475b895cda615e51df45576642dc932c8d8c9a10ee","lib/libwinapi_windowsapp-api-ms-win-core-synch-l1-2-0.a":"0d3cceadee76b329dc30d501c2d73755bc6276cafeee2697085b4586c544d06e","lib/libwinapi_windowsapp-api-ms-win-core-synch-l1-2-1.a":"a35894c59b361b4f35bead6a917a8a210508c1c96001826e0a96cc7baa1c842f","lib/libwinapi_windowsapp-api-ms-win-core-sysinfo-l1-1-0.a":"369718cfbdf91609efc62cf9605c8d81de831ff5f1f4fdd0f62df54f832df758","lib/libwinapi_windowsapp-api-ms-win-core-sysinfo-l1-2-0.a":"bce191f0587c8f9d7f676be1b5190de2de4f996a0910e4c76048e018930e8e88","lib/libwinapi_windowsapp-api-ms-win-core-sysinfo-l1-2-3.a":"f61f1d99bcfb7b5e8d96a56c52fb725d9a36bedfc7ed08cfd7a3bf1e2311a577","lib/libwinapi_windowsapp-api-ms-win-core-threadpool-l1-2-0.a":"2f51b21fe9a60b81b3c16709fd36d0cae88ff3b8f55c0816872c5c11fb423271","lib/libwinapi_windowsapp-api-ms-win-core-timezone-l1-1-0.a":"945698b1a3027bd6d13127847635311f4918f47797c2cdf00dce03e12beebda5","lib/libwinapi_windowsapp-api-ms-win-core-url-l1-1-0.a":"1053a4ea528bc28aa1c0100eeab95f608f12c6783bfbca11f907a243f7bbce9b","lib/libwinapi_windowsapp-api-ms-win-core-util-l1-1-0.a":"a1655c5410387c0051a553c1b1742553c4773a7eba8e53cf25ce24f886961a13","lib/libwinapi_windowsapp-api-ms-win-core-version-l1-1-0.a":"5df21a1d47100128914dee705e4911b34970157ac74ac254858089396367e281","lib/libwinapi_windowsapp-api-ms-win-core-versionansi-l1-1-0.a":"7aed54533b4709f6bdc9f097465bcb4a71b819431239978d5963fb48f83adab2","lib/libwinapi_windowsapp-api-ms-win-core-windowsceip-l1-1-0.a":"e806b412b7373abe95852102fdf75a2f0a6bbb95f01611154e6e135fe783d54c","lib/libwinapi_windowsapp-api-ms-win-core-windowserrorreporting-l1-1-0.a":"5ba4d916eed3e36d665efb99922c3e975d12f31ad838f72352b5116dc4adc054","lib/libwinapi_windowsapp-api-ms-win-core-windowserrorreporting-l1-1-1.a":"ab9513a9773ce626974fc0cd1d024361461396e343589753384e6dd098271d93","lib/libwinapi_windowsapp-api-ms-win-core-windowserrorreporting-l1-1-2.a":"ddc5f1e9c7748223abfb6b1254a29976c13ffa9b62eeebf4704b6ce778fbec53","lib/libwinapi_windowsapp-api-ms-win-core-winrt-error-l1-1-0.a":"ec0c3b1bd8ecad5411ae6b7f626132a682795a5d495e5cb8cf8456dacae1fdb9","lib/libwinapi_windowsapp-api-ms-win-core-winrt-error-l1-1-1.a":"bdcd1862f07ca2fa628fe32c850f02ec51fe31bb4c7169a320b0b3636715d27c","lib/libwinapi_windowsapp-api-ms-win-core-winrt-l1-1-0.a":"074094d4fb9d8cfa85bcf9eb55610b7635cedc0446d7d4bbba23ec29ee81fa23","lib/libwinapi_windowsapp-api-ms-win-core-winrt-registration-l1-1-0.a":"1aae3b87b4daa4ab1646dac2e2ec947c883f33fa5105c2b74a97eec98bf51aba","lib/libwinapi_windowsapp-api-ms-win-core-winrt-robuffer-l1-1-0.a":"45e0c6cc9374dbb69e0a2e4258f3a9372e0eba7165590f52cd8ca7279f38a33b","lib/libwinapi_windowsapp-api-ms-win-core-winrt-roparameterizediid-l1-1-0.a":"13f13a875a47020f343c5e8f45e607da17e865f930c10d7d1bb20e58c7d8d319","lib/libwinapi_windowsapp-api-ms-win-core-winrt-string-l1-1-0.a":"100007c54b80e4b063e81b9cf74e0031a2b7875557a2d39e4c66bb1c6fededc7","lib/libwinapi_windowsapp-api-ms-win-core-wow64-l1-1-0.a":"dc96f89d7d7d2fc4d011835bf72efad31bfaa396450d3bafb60b7b8c3cc3a29f","lib/libwinapi_windowsapp-api-ms-win-core-xstate-l2-1-0.a":"a94abe923e2e1e62e00ee6271c9493c9996d1866ddef1d6ae4baa31e3e193452","lib/libwinapi_windowsapp-api-ms-win-eventing-classicprovider-l1-1-0.a":"4cc2d512c93c466801ff1aba3b269eb6cd8bb5e068fb3997702d7e9de6d69e7b","lib/libwinapi_windowsapp-api-ms-win-eventing-consumer-l1-1-0.a":"0d2bfdf7f4e6bfacce139de90bef4e7b9be2247e46b590f43472bf512f9cd547","lib/libwinapi_windowsapp-api-ms-win-eventing-controller-l1-1-0.a":"f87ff616008bf1f362e6a0d3db8327108ed823f9705ed6d0becc09bd812c4321","lib/libwinapi_windowsapp-api-ms-win-eventing-legacy-l1-1-0.a":"dfc34fcafd7474b13c89c85e12d65f45e54c5c039b409587cd57d86da103fc37","lib/libwinapi_windowsapp-api-ms-win-eventing-provider-l1-1-0.a":"f1815af1a3878fe4ef29e9faa11662adc1695d2f20fd1fc4440ac30a3634a519","lib/libwinapi_windowsapp-api-ms-win-gaming-deviceinformation-l1-1-0.a":"c6dd8bef4e2c33ade7eea1fc40ec9b953f99ff67b6fa7a7af3a2f6b092256832","lib/libwinapi_windowsapp-api-ms-win-gaming-expandedresources-l1-1-0.a":"d4b20d678a7c9fcdea471ade884d25f65604267f9f0ecdfa12216c6739787fde","lib/libwinapi_windowsapp-api-ms-win-gaming-gamemonitor-l1-1-0.a":"833f719b840c9dc743a859a0c307c6cd6c6135834c861d88d65039ae46e862dd","lib/libwinapi_windowsapp-api-ms-win-gaming-gamemonitor-l1-1-1.a":"3a56df33b86c8b4120f684f596cacfd9aeb549e04828bf421cd0386e87cfcbd1","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-0.a":"a61a0f2491b6e8709a77e6f3c2355d699c8c3d66177d88b619219447991475a2","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-1.a":"c15d3c10174bb320025e4783e7c0325b018454f7c2a5362a522a6c3c81ac2e15","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-2.a":"e1893322b38da323190f399dcf6fa6a0bf1211d81604ccac0053d7bad8faa2e3","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-3.a":"9b5b10583e46bdde128c7cdc4eee470fe00e53faa060ea43240d599ea4acb714","lib/libwinapi_windowsapp-api-ms-win-gaming-tcui-l1-1-4.a":"70ed16b31f947bd7dbad9a2e8ec9ca4b1989dec49114e547a7fedaf0050853d6","lib/libwinapi_windowsapp-api-ms-win-ro-typeresolution-l1-1-0.a":"efb7105f66e30d6b47a4d7c4e4bc855bc93700cffc85c4fcb88c5ed01924c08f","lib/libwinapi_windowsapp-api-ms-win-security-base-l1-1-0.a":"bf3ae73201b0ca57f9e72ff63fc4bb02c8688be9bc1b26f03e7ec8625adce8c1","lib/libwinapi_windowsapp-api-ms-win-security-base-l1-2-0.a":"708c5b394d77eef855e38e5def7c20dc68c5eb3f42559da9a2410216b0dc804b","lib/libwinapi_windowsapp-api-ms-win-security-base-l1-2-1.a":"f6d0415df84733fbb00367d7ce8a58503b1ae82f00084b4017f43891e260d273","lib/libwinapi_windowsapp-api-ms-win-security-cryptoapi-l1-1-0.a":"08b92bbca14b3caa2800a1c6cb8a422d987453fc79e03f6bba2be6f321955788","lib/libwinapi_windowsapp-api-ms-win-security-isolatedcontainer-l1-1-0.a":"02cd4b104d098858228c9da7d98223aebd6c7cfe79fe04dd92e95b1acac90170","lib/libwinapi_windowsapp-api-ms-win-security-lsalookup-ansi-l2-1-0.a":"713e02a43329a4f7b1b89dcdb6b0978f70ee3f881c2e57b6f2089597afec02f3","lib/libwinapi_windowsapp-api-ms-win-security-lsalookup-l2-1-0.a":"e0c00d82c9c8b644eb66728a31911c0b46aa9bbbeeaf76d1e52a634dc6420489","lib/libwinapi_windowsapp-api-ms-win-security-provider-ansi-l1-1-0.a":"7949eb398bea0952d589f520b863c16b905b1f7336564bce2c56fc7504660116","lib/libwinapi_windowsapp-api-ms-win-security-provider-l1-1-0.a":"563c511de536d18586425400a822d23237fb08641fb7cf162064a318f68ada9d","lib/libwinapi_windowsapp-api-ms-win-security-sddl-ansi-l1-1-0.a":"d6f995485514312d425e618253d66c4e86577dab76338651be5e399b8f8319fa","lib/libwinapi_windowsapp-api-ms-win-security-sddl-l1-1-0.a":"0dc02e652b522c1322a92bdc26969509e8abb4dc8afbb38ceb4b313fd7453691","lib/libwinapi_windowsapp-api-ms-win-shcore-stream-winrt-l1-1-0.a":"a519bd8308ca63cd953624bc125861be000013815936a6a493fd54e5ad7003de","lib/libwinapi_windowsapp-bcrypt.a":"ec1329fa5a61a3b6cd84a3073aaada7b8785a77f63ac11f1d360caa1ae202bff","lib/libwinapi_windowsapp-cabinet.a":"7e29bea56ad7adb0179764acaf5f6b4def59c165c7558d593f63fda86ba368aa","lib/libwinapi_windowsapp-chakra.a":"bde73d3211bb74985a77de624a0f2a69a3a9ef75301651149eaa186111b2b7be","lib/libwinapi_windowsapp-coremessaging.a":"d72d946e4944c83e35a863db105b6f11410d013a4bd773b3e843ad9d53c15e51","lib/libwinapi_windowsapp-crypt32.a":"9b9536ccfc119865a0bdfc0abbc5292aeab79167663ab3667dd9a91453ef6f62","lib/libwinapi_windowsapp-d2d1.a":"4e5448b5f5062deadca8f55eec73dafa579fc8a23d55848700b7056847291429","lib/libwinapi_windowsapp-d3d11.a":"b811cce64afcdb1a0423633d197eb4a03e15a7ebf91026652e7792c69cc1acaf","lib/libwinapi_windowsapp-d3d12.a":"091aaa8fab3b7de11a9af54152575825dc8fac430ae033f4d4723d04b0399e11","lib/libwinapi_windowsapp-d3dcompiler_47.a":"fd94740862b56f0cac0810a6a7e88d625f5760ddf722d782c3d0b538fd357b31","lib/libwinapi_windowsapp-deviceaccess.a":"782f1edafaf4f507b5d6fc225c43442bbbc1392090c225c36b812c78b4008dcd","lib/libwinapi_windowsapp-dhcpcsvc.a":"3f3236df207c9500f86e8983523dffb321dd8e2be5eb046c2af02b7072c59f66","lib/libwinapi_windowsapp-dhcpcsvc6.a":"84770cc3af6607f00cfcc2bc78d7d360d34b1d01dc8b263bbe41fe78b4399111","lib/libwinapi_windowsapp-dwrite.a":"594f8cca0f490d89792bee1d520cd1fc8869fa33f26fd6efc99c2a365f6dab08","lib/libwinapi_windowsapp-dxgi.a":"9c4917fb8ce4fab92b7e5e0ef279935525a5a17ed6954a49a53e4c6cdb61fd6a","lib/libwinapi_windowsapp-esent.a":"c837999f299f9f404032de4e5d5cd8ae21f821ee7c296098be6e0c1290cbc7f2","lib/libwinapi_windowsapp-ext-ms-win-core-iuri-l1-1-0.a":"e174067c0f98d3fe42821d200b6788071ce59a723336f5d351c7dc64073eec81","lib/libwinapi_windowsapp-ext-ms-win-gaming-xinput-l1-1-0.a":"f6ff8db9b176d291809a8de91313a284dbfbbd9392c25ff960983c442f43d658","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-0.a":"1ddd5c48bf3ff80947f67273494508f03e61867c2c9d7304554edb748515abe1","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-1.a":"8c218ad73c7cdd0494021fd5bc0b44e2482000b33fa25df544b9f6587c324c17","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-2.a":"32d41a927d75a74f71490ba8dd8740b3a9a3e76c0dbe2b5203dfef80f75f5c8e","lib/libwinapi_windowsapp-ext-ms-win-uiacore-l1-1-3.a":"16acf3d5961624c5e4056ea513529ff0d8a6635b8f78b7aa102dfc6e6ad4e685","lib/libwinapi_windowsapp-hrtfapo.a":"f7eb622e5c5f03683f8dec62a38d1f4bd5b98df2a43b513ab052a04e14a050e0","lib/libwinapi_windowsapp-inkobjcore.a":"cccafb5cf43ee4a4613d05c638d7fd561548860b9a887fc76023ad628259f154","lib/libwinapi_windowsapp-iphlpapi.a":"bcc5cc9e14d4f47c573a00e4ab1031c13ce24cf68e865ffacf815f1535e3b6e6","lib/libwinapi_windowsapp-mf.a":"a7436da8e6d45c25a13f79b223543dfb073b82052e8abe588d26e92b97aa907e","lib/libwinapi_windowsapp-mfplat.a":"e00177157715c5759d1e35004a84983e3f3356305e64816a9edd066bb3b79b77","lib/libwinapi_windowsapp-mfreadwrite.a":"553ee451e5cfe200ac9b840fe35f234d1aff83ca48ab6f0318e7122bdb8cd957","lib/libwinapi_windowsapp-mfsensorgroup.a":"003bade21115ea520a913c452bc0af48a73ba60dbeea163d82f0127a992647a3","lib/libwinapi_windowsapp-mmdevapi.a":"b702a9ce7e2478d529d879afc7deb90ccb17b48029efddd28e0ecaa458648963","lib/libwinapi_windowsapp-msajapi.a":"81ff5804db8a0db27c57d56b1d238d7db0235dcc1193da621451684e8d94d89f","lib/libwinapi_windowsapp-mswsock.a":"74617292fa905a61eca74ada1440187607e5a0937a35e89290e7d8e1f64851f4","lib/libwinapi_windowsapp-ncrypt.a":"947d9d8dddd3cfcd9645be2f13204e7ef5629e78acba8f528899289c5b1a29a7","lib/libwinapi_windowsapp-ntdll.a":"035272f422deaabaedac61ce9c115ef21895b4eaeedaff7083195a84c01947c7","lib/libwinapi_windowsapp-oleaut32.a":"872e3c75ba251f3f78aa3dd7f392a0c33d285f6c995f6505944e75a4322f7a1b","lib/libwinapi_windowsapp-propsys.a":"3e95866b05f3b7fd53c2d49a4f53c0c2b702db430bce1a3fa8f88ed2f03f094f","lib/libwinapi_windowsapp-rometadata.a":"23d445f9a97153afda848b972af65633e02cfa35efa38c8872d1df88570ed6db","lib/libwinapi_windowsapp-rpcrt4.a":"6577a81b2b25becb9f90706779b716e0b6c2dfe6b1f6cadf7bd10542e46874a4","lib/libwinapi_windowsapp-sspicli.a":"f62ba19b2e0825f21a1fdf9cdaaf6bdda9dc40d0535f3fcb1228e325043156c4","lib/libwinapi_windowsapp-uiautomationcore.a":"542c44f951e5af5b0bcc6b2a6962d68eb8ed3c3cdfb09904b127a7638b1f9a0b","lib/libwinapi_windowsapp-urlmon.a":"de3d0611b244af770ab9e65857039151337d51119202b7483ed85ee84bb3dc78","lib/libwinapi_windowsapp-webservices.a":"ff53c0fb8d4e865aa2b37e689c84e0a6279f817a61289e0e6281c0a0684c2efd","lib/libwinapi_windowsapp-windows.data.pdf.a":"f9b822e9af43233a0a8be75d7b3d4cc6b2690fc292d68768e3ef61faaf9722c3","lib/libwinapi_windowsapp-windows.networking.a":"6aa6690420aaccb3a167cbb70ea8a6a76032872f22fe171934d57c39b3e0600f","lib/libwinapi_windowsapp-windowscodecs.a":"0e80cb4d48197baa7dc382662c8cf4162493605b67c1697ac89b2582ac995bc1","lib/libwinapi_windowsapp-ws2_32.a":"b3068fc789e498347385db2f729b73a0ccfb94170359e350d9169174b6a81c4a","lib/libwinapi_windowsapp-xaudio2_9.a":"ff8b1bfc160dc731a02537f2fce9c64cde48a7fae63232f9cc5c1d9c742f0fdc","lib/libwinapi_windowsapp-xmllite.a":"c99e2624f2c1039902293a13f83fbbafe69171e290b5116b113c1162892469d3","lib/libwinapi_windowsapp.a":"15a0928f6c65e96bddf217bc5fab9166d5bcf4ae7b1618e73ce5ae357f65a78d","lib/libwinapi_windowsapp_downlevel-advapi32.a":"d804e9388eb15e702e31b474c9e64ba16677965fdf5caba76de23a0fb624c026","lib/libwinapi_windowsapp_downlevel-api-ms-win-core-localization-l1-2-0.a":"cebc37539a6264bc56267d7f246bf944a409d7290ae2335aeb47be08cd4691a8","lib/libwinapi_windowsapp_downlevel-api-ms-win-core-winrt-l1-1-0.a":"8c279b034b05b79e0cba7558b761075e46de1410553efaf276c8461a37705ee5","lib/libwinapi_windowsapp_downlevel-api-ms-win-core-winrt-robuffer-l1-1-0.a":"d6e47b4dada0dd89213ddc74ee9543f3cdbe94f91740c05f5e8b8a8b6ac4275d","lib/libwinapi_windowsapp_downlevel-cabinet.a":"ea49a1a0c093425d6e0c322f20701f403a0e30cd2b9b4156fe09b548a7676c06","lib/libwinapi_windowsapp_downlevel-d2d1.a":"c9a1d9bbb75339aa8c5c65ab3ca4e34851b5e49745053434ebe8a526fdb1cf6e","lib/libwinapi_windowsapp_downlevel-d3d11.a":"edee3ff52dcef25cd1c2de9d94dbabd37935c3c6b5ec68d319752a99d44ca238","lib/libwinapi_windowsapp_downlevel-d3dcompiler_47.a":"07be895fb60a47c0630f70019181994c23fa703be133eb92970f3f8ebc268507","lib/libwinapi_windowsapp_downlevel-deviceaccess.a":"54f1efb0754195ef80008a74e3dc7b80ad6ba7e6408f9f5870826df93e10859d","lib/libwinapi_windowsapp_downlevel-dhcpcsvc.a":"9bb795163a31c0c40fe4bb43c2a08a4bdafff513f0fc4d5370c21158e83519a1","lib/libwinapi_windowsapp_downlevel-dhcpcsvc6.a":"3146a9987752eff657fdd33e18e1cf8290ddb927253f06113991796c8fb6a330","lib/libwinapi_windowsapp_downlevel-dwrite.a":"75f782fc139938ff2c321a64e23796febba0bb06bc3476572108fd42e7ae7465","lib/libwinapi_windowsapp_downlevel-dxgi.a":"660dcabf3d62a3d17ef66c226363539a2ee816b40311da7424bcbf9f36c8086c","lib/libwinapi_windowsapp_downlevel-esent.a":"b2decb268c245ed92163af4fe6b78d3bbc68bc8b00a67af963fd62184c674e91","lib/libwinapi_windowsapp_downlevel-kernel32.a":"39c37ea812c53ed3fc5478286cc2b056af45d89f21ca381154126350ca347350","lib/libwinapi_windowsapp_downlevel-mf.a":"e342dd811d7aa4284e29af405382ba79d38a40b3a68422bd4855ec8d1cd90b85","lib/libwinapi_windowsapp_downlevel-mfplat.a":"4229ff3fc4ea43992bd43cf62134571d29abc3cbde12f123ea5ff3109b543084","lib/libwinapi_windowsapp_downlevel-mfreadwrite.a":"ec48614cfcf6cdc3b176d3b5503bff913b5a484f028081ec37c4a10e3b9b52e1","lib/libwinapi_windowsapp_downlevel-mmdevapi.a":"3efa1a3536fe519e8e0956f1e388f592359304dc552a71b4d8b76a22f19585c4","lib/libwinapi_windowsapp_downlevel-msajapi.a":"f6abb91151be743fbe8df9aa317f1901bf64bc1784737b1d627222690daa91fe","lib/libwinapi_windowsapp_downlevel-mscoree.a":"cb5aedee76fe7c835dfba5b3b8a177f6d9a8babbba35a68151d27cd38ec88ab0","lib/libwinapi_windowsapp_downlevel-mswsock.a":"2969f7e7ba5ee53df84f0f55197662ba3be0e469d03d41fe7fb27df743b8fb6f","lib/libwinapi_windowsapp_downlevel-ole32.a":"0e4a0fe7f48178d172f2d65ebf65dadb81c5c6374ea636f57312ac1a25e7fecb","lib/libwinapi_windowsapp_downlevel-oleaut32.a":"df90f481709e792326553f4f0dd9cf5bef8819a7b83cfcaaa0159e94a15a39e0","lib/libwinapi_windowsapp_downlevel-propsys.a":"548af9a83ee1edd4d5e31eac1b73f80360372457f5e7d7ecda76f0ed00828eb6","lib/libwinapi_windowsapp_downlevel-rpcrt4.a":"50ed6864d1407224c0d24fa18704b4a5a0da7a290f7cd43774bc0f9a9b4339b3","lib/libwinapi_windowsapp_downlevel-uiautomationcore.a":"e8a14b5378ce7033982cf5492ed6f533f59cc6831958b24f09ad6cc5331774cb","lib/libwinapi_windowsapp_downlevel-urlmon.a":"ec850a21e8f13934a8aa241558c446bf066f84fe3dd9244af65dc16b8d98a876","lib/libwinapi_windowsapp_downlevel-webservices.a":"59034d8d9f7a7d84470af85a1ff8be61f7bcb8dbb9bb71c8216dc27adbdc1f3d","lib/libwinapi_windowsapp_downlevel-windows.data.pdf.a":"db3815d61dde72d54181491438f985c6bfc798daf94fc2c52b6dcacad753a000","lib/libwinapi_windowsapp_downlevel-windows.networking.a":"c2729b8d6f689c7c5e5837692b94c29e9686e10b28c313af92dd4ee5e2d93ade","lib/libwinapi_windowsapp_downlevel-windowscodecs.a":"7ff7bc125c1bf161d75266274063fe1284f1dbe206cc3e77af9c563f293ea16a","lib/libwinapi_windowsapp_downlevel-ws2_32.a":"c45dab0dd9b2b7a93f727e510e16f63bb1f917b7e20030e6a25c43dae6190aad","lib/libwinapi_windowsapp_downlevel-xaudio2_8.a":"01fa2a11e747d8b54ff562ce005d2ea0600cca6a8bd4769a3f5d0201e8766b08","lib/libwinapi_windowsapp_downlevel-xinput1_4.a":"716a44b40028af673877f3cd3af9a172c2c294c5b0037d2416a577f8d9f0baf4","lib/libwinapi_windowsapp_downlevel-xmllite.a":"af8ad4904f954f829e79b67743d9b412b9aeb34432ec6148bff6bddea254bd0f","lib/libwinapi_windowsapp_downlevel.a":"fd622c0c778e135e02d0e387ad4075c68aa1f564de4c39a2677d87478ab0496e","lib/libwinapi_windowscodecs.a":"2b3a50daec478e8d6c5586d131c3da93b667ab98a3d1874d157887aab05a869b","lib/libwinapi_winfax.a":"009b2d2f2bfa7620b515504c8b9551eca3b4a58d118c59555db0891306c51669","lib/libwinapi_winhttp.a":"0572b9da9ee2740f4074d58030acd3c0235f0087a3ad3da138d22184d361e29f","lib/libwinapi_wininet.a":"c23ef20a00fdfb68052715a00bf17a368eef28359a2f3fccda73d4aae0c7d9f3","lib/libwinapi_winmm.a":"ea571535c90557ca7b9331f70aa04271a77b0f38e85929da604a1472e9ae45be","lib/libwinapi_winscard.a":"07996dd9c98ae95fbb9797a87fbba1b1435c9e148e1401d482ccab08dea91824","lib/libwinapi_winspool.a":"f92b3b0a67b4c598e6cc583e9c9aefd1ed473b3202bdfaec606300a20a58d746","lib/libwinapi_winsqlite3.a":"63e42c08e791103952b60e72b634a43213dfe07f87d4e09f93a1a73c7053e45a","lib/libwinapi_winsta.a":"ac53400d8e9dedc1039a04734048d0260f93bc23b102cf6ab76aef81b2c71a2a","lib/libwinapi_wintrust.a":"2f0db077618eaddc9889ccff5cebe02f61914d689a613852e5c043bd7890df65","lib/libwinapi_winusb.a":"3115eb3c732d9bedec71dc257526f3c6a694c5844f8a5cd4c035b887aaf837ec","lib/libwinapi_wlanapi.a":"ace6c67a6e9b8cda60a4a9fd002191affc37ce729d69bce3a2f7e2ea145219e4","lib/libwinapi_wlanui.a":"a132997ec3188c2faeb13e21a9de81c663830c1d42902817a2c8471360dc031e","lib/libwinapi_wldap32.a":"828be18ed9d8e50d4bdab88630ba0e897914955639b9b45c785408fd3ed6d5c5","lib/libwinapi_wmip.a":"b48306f4382ec01e198eeffa8f9dc29475548838c1b3ac0fb9913c17c5125325","lib/libwinapi_wmvcore.a":"4f7ca2d39f4d3350ffaebd1f5967fa60f32b596cc232284c48de9ed10a033d30","lib/libwinapi_wnvapi.a":"1ebab5c51f70165c898a44801c6aca50e23c81ceaab77a691d14211344de8b69","lib/libwinapi_wofutil.a":"cd804de66b5dfaea2f78175c341e0498799256d20e91a14333fd81deb697115e","lib/libwinapi_ws2_32.a":"eb8c67a0fd619b75d4a097da6c535e36092dc31833da11976f4ea9737736c27c","lib/libwinapi_wscapi.a":"59237ea2addf8ae27350a3a26b56f2d2e1b88ec696f860671f6a9a54df7307b9","lib/libwinapi_wsclient.a":"dfc4151c51d6ac1b2f6f1c6c9ac4ab616109e84670a9dd35fedd0174211d97c2","lib/libwinapi_wsdapi.a":"7deeb90e59f8f8b769ccf07d180a4fa8566b41590e3826199ab7cec1a841cf75","lib/libwinapi_wsmsvc.a":"4eaa3ee281f0112883577efcf46f07592e4b2902e8373447d84c349bda041fda","lib/libwinapi_wsnmp32.a":"0388baf7ca8c080b56f8278069231d88c39bf205833c8f9dbbbd7d20a8974a5e","lib/libwinapi_wsock32.a":"933e7c6f7958ce14f8916fbc4076ebb7a962576e54eb14679a866044e018455d","lib/libwinapi_wtsapi32.a":"1d1f30f69eeaa5ee0f16b247766a14e37379a563554a3aafc2c75a5c916c9327","lib/libwinapi_xaudio2.a":"a93fd7427990945f365a570e5063cfc37cf168319a191c9cced99fd4ac7412c8","lib/libwinapi_xaudio2_8.a":"d81aa8d4571feb7d88662232611a35327d6e794762d86c88ab3bfc00fc1380b2","lib/libwinapi_xinput.a":"60c83153e2a71755e4f1d23871502a0bb63581e5d50f7bace76c72d1097a6080","lib/libwinapi_xinput9_1_0.a":"48419ab7aee0fdacf664322a6c4c4d194dbf27a47395acf6df6711ed9305af6f","lib/libwinapi_xinputuap.a":"a240c14282237577ecedb7e90fffdc990784299690ed0e2d47609a54991b0331","lib/libwinapi_xmllite.a":"74b5c91747bcc207f29b48f55e4592b6d87507cccc769b821568995712ccab19","lib/libwinapi_xolehlp.a":"43d442e8dddca465980518f23769550e2e57f942e97a0bbafb570466de0fb66c","lib/libwinapi_xpsdocumenttargetprint.a":"72ccc29f8c73be0c982ae0107654281cbe304b7e4e494a9dc73589f6cb61c615","lib/libwinapi_xpsprint.a":"15ce739546fda5e2ded348552001a3afe31458aa4d3debe88a7856cc525eb286","src/lib.rs":"79212a91f610f8a77aa6ed4cc77212c2531eeb35630388bf07323cc328fcca42"},"package":"712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"} \ No newline at end of file diff --git a/src/vendor/winapi-x86_64-pc-windows-gnu/.cargo-ok b/src/vendor/winapi-x86_64-pc-windows-gnu/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml b/src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml new file mode 100644 index 0000000000..7e1341b081 --- /dev/null +++ b/src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml @@ -0,0 +1,22 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +authors = ["Peter Atashian "] +build = "build.rs" +include = ["src/*", "lib/*", "Cargo.toml", "build.rs"] +description = "Import libraries for the x86_64-pc-windows-gnu target. Please don't use this crate directly, depend on winapi instead." +keywords = ["windows"] +license = "MIT/Apache-2.0" +repository = "https://github.com/retep998/winapi-rs" diff --git a/src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml.orig b/src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml.orig new file mode 100644 index 0000000000..fe5a8d0a3e --- /dev/null +++ b/src/vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml.orig @@ -0,0 +1,10 @@ +[package] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +authors = ["Peter Atashian "] +license = "MIT/Apache-2.0" +description = "Import libraries for the x86_64-pc-windows-gnu target. Please don't use this crate directly, depend on winapi instead." +repository = "https://github.com/retep998/winapi-rs" +keywords = ["windows"] +include = ["src/*", "lib/*", "Cargo.toml", "build.rs"] +build = "build.rs" diff --git a/src/vendor/winapi-x86_64-pc-windows-gnu/build.rs b/src/vendor/winapi-x86_64-pc-windows-gnu/build.rs new file mode 100644 index 0000000000..a655b7c9e0 --- /dev/null +++ b/src/vendor/winapi-x86_64-pc-windows-gnu/build.rs @@ -0,0 +1,18 @@ +// Copyright © 2016-2018 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +fn main() { + use std::env::var; + use std::path::Path; + println!("cargo:rerun-if-env-changed=WINAPI_NO_BUNDLED_LIBRARIES"); + if var("WINAPI_NO_BUNDLED_LIBRARIES").is_ok() { + return; + } + if var("TARGET").map(|target| target == "x86_64-pc-windows-gnu").unwrap_or(false) { + let dir = var("CARGO_MANIFEST_DIR").unwrap(); + println!("cargo:rustc-link-search=native={}", Path::new(&dir).join("lib").display()); + } +} diff --git a/src/vendor/winapi-x86_64-pc-windows-gnu/src/lib.rs b/src/vendor/winapi-x86_64-pc-windows-gnu/src/lib.rs new file mode 100644 index 0000000000..3b7f827d8f --- /dev/null +++ b/src/vendor/winapi-x86_64-pc-windows-gnu/src/lib.rs @@ -0,0 +1,7 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +#![no_std] diff --git a/src/vendor/winapi/.cargo-checksum.json b/src/vendor/winapi/.cargo-checksum.json index 84d20af66b..75bc4ed8c5 100644 --- a/src/vendor/winapi/.cargo-checksum.json +++ b/src/vendor/winapi/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"d15a0464554e57323507a2ff34925a2c592f3dffec9beb092c7ce985440f5bda","LICENSE.md":"fd232cfaeeff018cd3b9f22e0279b1c2237742999277596638800e967f6e4a29","src/activation.rs":"0e25834dfecd59391e2ecfdaa2e01bb5ac4d181778b47d0b9f67c56a6b2bd75f","src/audioclient.rs":"8c645d4ddb171620a527bcc14fa2904ff9aeb529262e68a0a9957d2ed77118be","src/audiosessiontypes.rs":"ba8cd1950cdab112861208ac1ecc35e656cbbe36e60c31315e547cfe47707685","src/basetsd.rs":"7b879d3164d5e6ec1b94d18a6b58f74a7f4e62fc279df32126e76c4f3138239d","src/bcrypt.rs":"05fe44190a37dd744bff8fc682f25a47c5f4239d417b213d18542aaa19b08b06","src/cfg.rs":"057ace203f04f8c09b6f68fefba7d3eb6644c46f2e44ca8f1364a8bc3bdd4970","src/cfgmgr32.rs":"714289f058283fc89fc79bbd4932bdbc0e9a88edd62a1787aac82c338f2dfb45","src/combaseapi.rs":"45458b1e0d918b237afd7e9581e2714b58ee009a91bbec45827694d1159a2e8b","src/commctrl.rs":"c0173aabd50f34a85c2523876fa0191d052d1d0c157f95ed228d98508806cc7d","src/commdlg.rs":"e75f64491eea54f651884eb3cc5353588c7fe54b086b43557d6d4917abbf95cd","src/corsym.rs":"301f937c7cb394675b2127a24595beef261d269d8f7cb45d6b4ac21a063985e3","src/d2d1.rs":"e7aa08883d85e2631f5327541e644b650ad009095daadef606bb06d9ac99afd3","src/d2dbasetypes.rs":"5a26048c997a580d8bb2a3512f1cb20dba411da99ffd6b23f4b0615ab9378058","src/d3d10shader.rs":"d6edf923fa8442be35b7f4ebebcd2e4bec4c3842ed5aee4bfd05c2de11edc4e0","src/d3d11.rs":"3f2f681357730df7ea954fb78903f0f0ad0bb3b577727307e751fd9598a4e837","src/d3d11shader.rs":"29612cc75ba238e2cd691fdcc01be9c79ca12b046e207d3cbfc5af23f04c4cb9","src/d3d12.rs":"906e512385e78756fe84f9a9622c510ce5a6daeb121127cf93f11af0f2fa3763","src/d3d12sdklayers.rs":"b50edb48a1c51bc7e3bf7176733c3dad4eb45a4e9747096e3b5a723052e130c8","src/d3d12shader.rs":"ff58932ef32c108348e41864f09ac6f909d641cac4f94c3e4f6c3dc4e5916521","src/d3d9.rs":"e01614130a4d68bb6e2a23f62ffb4d5016381e9026f8477aaca64851c8dcad53","src/d3d9caps.rs":"d4bcf91b7ae307388c91c19eacdb808506faea184b03178feee5c47959211b7b","src/d3d9types.rs":"1e10aae6297bc8dc083b111da496313ff19dcb9b88450e2637f8e98c0401519c","src/d3dcommon.rs":"f841b2e4df6dfccb9eb1955add24689db7b173780ec25e99b89097140a012152","src/d3dcompiler.rs":"02269410bd7f83f49391f852320ca0d76fd8d907ed22c68a003af65b3f5ab54a","src/dbghelp.rs":"c0ea5bcd04f414a696cd876439a7c4d6ee63627f4662705d189fd6e0412622f8","src/dcommon.rs":"8889ca66e2f89f1c275e5d6b7d6b203e7f25b4e7a262689b2ec6f04b9d1b5ae8","src/devpropdef.rs":"74948513ed623d3bdf1ea3fbf1f540b3e9e46efb9c1674ecccfe7f2fae5792f2","src/docobj.rs":"43e214d9d0c436a88ed2c620b8386e58e4d549ba9c8be51bf52291caf95e225d","src/dpapi.rs":"d44a1a6c9e52b34e8e87df1079b97081c646f07d0eee51f0d0cf66ae1c6fd58a","src/dsgetdc.rs":"5911c35ef3d80a5162fdbea6902f9b07033b746ff91bff2657a0971edb07bff2","src/dsound.rs":"53a5532d645e1b7995f0b4a0f0711fc66da8a27b7f8c87ce3d9e0882cfdca07c","src/dsrole.rs":"50b27a8afb11188ce24ab49620fe69ea21658148d8fd6076b8927175db5c1a9e","src/dwmapi.rs":"e65ca961eec0db275e211e04c59a8995c8c13d36ab08dc36ce197d9a4856266f","src/dwrite.rs":"f138d36e8b93778a7866cc755893b4da19cfd6ce42427139589a0bbaa294eb44","src/dxgi.rs":"5b6fcc5c665df1c0c6ed3de5d678a7bade1bb8ab1acbe952b784ce99fc817e53","src/dxgi1_2.rs":"6ba44755d715f2493236103fc5c24d7d45dff2e1fc3690aefbd4eb6c859dbc07","src/dxgi1_3.rs":"1f86a9db5fd45199fcc3ce56423e5fcf0c58df4001e2b50c5586d38ab820b78f","src/dxgi1_4.rs":"c578e6fcb82d535b20fc10232b75a7b9512d068919cc1e3f1c7cf55f3eb46460","src/dxgiformat.rs":"2e73df34f480b6ef3b5e21de0a520dacec91b00772e42786568fd162ca5e9aa6","src/dxgitype.rs":"204b8dae38c13a1dd8cd2ce6ca68851f743b416213d6db1cd0d96808bcbf7058","src/errhandlingapi.rs":"a70f9db3dd8ab60aba0daf39f12b527e54e312ca640e0b80d80c93ffdb6913c6","src/excpt.rs":"b07cf9ff0d23dd50c0776d048d0c579e401b7d729635f78998f85d35f33f05a4","src/fileapi.rs":"d31814c612bbd9372abbf6f8455fc2af89ac236c6b1855da10d66545e485ec57","src/gl.rs":"9429708bb97aeecb2c40030460ed0c3415fc0f2335c9513c68afa6157bd9b465","src/guiddef.rs":"86618dcd39c77048c7e453e6e86dafe90358eb7f97144f9672ae09e7b9855729","src/heapapi.rs":"21e420ba7641e507e8f2801d2b0ed25dbcb98e967924d711beb5cbfa8a5785e4","src/hidclass.rs":"a93380d35dc4d45807b10bbd69ee63eb8517b75989b68391685070a2fcfbefa1","src/hidpi.rs":"0b641fc119ac35761fe8e5eaed9a0781e9018598ea269d6cd386dbf5563ab9a0","src/hidsdi.rs":"50abb938ea8d0af90ccdea7ac3de4bc10fe42e34bc6a6d6eb4da1b330727da34","src/hidusage.rs":"44adc029bc89f0d4977b1295b7e998ddabf5283de66e1e33146bda8968d1d98b","src/hstring.rs":"51b3e63e3f1ed48f54c63c3e820e0563fb857b2743529d5f947f718d43425b89","src/http.rs":"ebb8b8db9e786e2683ad8b9a9066ef418df773ae7ce4d75f166cb5321f85f5a0","src/imm.rs":"b9277502f17f4cc6bde4f80f722ec1b976913355edbf162814ccfec2b3b080fd","src/inaddr.rs":"938143669da02c83a31d207be11e2176ed5219edf0e6f8f7a5534a5c6c3ce8d1","src/inspectable.rs":"b01f1814a233a77bf9f25c264747252c0464388c7d9c7302e5bde57502b8139b","src/ksmedia.rs":"acb96b1ea0cf3b5397f9037958093c6b4dbb54c4246516e57b9fed055e8e69c1","src/lib.rs":"8a7840b030f56883f68bdf90a1a04df8be2a5e2698a9ea86c73fac59c9f09b6e","src/libloaderapi.rs":"21a5d17c9f8ac4c006b515979964a8870f30710be4482083f45c6a41a16a36ce","src/lmaccess.rs":"712661c871569513334152bdcdf56c07776c560a22cd5b892a0f38e1957e28db","src/lmcons.rs":"3449aab4399cc36e7d7db551e384d82dfa4204178c4cfb9642f90645687fbc81","src/lmdfs.rs":"c351cdb2d10bf3a7c5ce7400dcdca41a792554e21e75fa9e5378ac18d8d3e4e7","src/lmerrlog.rs":"7937928544d27575e302c5e9c5e6803e9033e1f4d715e7ca29be202276d7d7a6","src/lmjoin.rs":"362cdc71f3f50099b862eff0733b3a57dd0f95cac15943135f794424f651b916","src/lsalookup.rs":"4aef1a95033444181f2b2b9df364ea165b0fdedb396c63e5d12db6b7398a3d5f","src/macros.rs":"5dacc570f226b6f1ad31d76a03675f0d182a3d578846920000fabb7cd92fc7f8","src/memoryapi.rs":"2273b8bfd7fc36dcf654c320826952ad502e8922a84174f8c1f7ed08aa555a04","src/minschannel.rs":"139828de63a0a4476de2bee454f5bca5e8a46cc29f1680339bb2804ee2d17322","src/minwinbase.rs":"6cd387a7f79e1a708bc48b5b27eaeaa7aadf0fff7a5e0a76cda0bdf3fa871863","src/minwindef.rs":"47ba4f2ec7789109ae339170715ed76288ae60ee57a4f06d5cc50a0e6855699f","src/mmdeviceapi.rs":"c8b7f7b6b78488d23ccba2b34e8765eac60ec9f08e19c96b377d957f65b1b6d1","src/mmreg.rs":"1621fad6eaa16d1e5ca95055fd11bf066b777b1343625f9fdc74e4d313d60dea","src/mmsystem.rs":"f6a2bff3bf80af1468de2c2a5f7ff2ced2b625adaf24f08f9b303965ed5ee371","src/mscat.rs":"9226a8e30546c4142e4fcdc716f8a15cc7c8081c9e875ec72ff9e8551f86f9a1","src/mssip.rs":"d7e2b91e358ff4986e700396d04f92aa1671aafada0d4889914a413177c091e1","src/nb30.rs":"dd85d7849111f04d33895835269929dc219e04de4373e91468eb053e3e0a5c52","src/ncrypt.rs":"29f168dcddeaa2cb231a7174cec672be83cca192ffc4632cead4c4a25189fb49","src/ntdef.rs":"3be66042d16a862f0fed8f48406b08c3091fbf92885a44efb7747f4a764d7de7","src/ntsecapi.rs":"dfb2cc7e23e8b20fa5ffd30ccecdb81b62d8ffeb68fdf99f93fb141ff4155afd","src/ntstatus.rs":"de6208f4e119a6405c1726433ea5e47a8b5f46b345f5809e9f580cce88360a79","src/oaidl.rs":"640c911e39888928baf77145cca34c1a768bfd759ec9709f70649a2946cb3246","src/objbase.rs":"7c9edb6a9ea72baddb15a6aec3602b3f9e7b1ce969dd655f440eae0ede1372e2","src/objidl.rs":"2a623b989f2a216edca3bd118eceff41267632839a3fd4410df9a7c126a87b64","src/objidlbase.rs":"3415a0bcd1b5b63ff48e17138ff87dae7c31eaeb323ae81f34b6712efade1d04","src/olectl.rs":"da2014c3d5858c5abff1635e1b8c8223333e7d22d28cac614aac3305a7f04ee4","src/pdh.rs":"eb01459c2acc456ecd204c6716d26027a6c77c2b4a9b698d3c922254fe2cc319","src/playsoundapi.rs":"7efddfc8601de565946c8c93074211c83b20866a1588e36e0518bba9864d0cf0","src/processsnapshot.rs":"df99a56280e6e41c5896341ffa1abe734f6c8662f4d7ea960cb97fb34c5b85d9","src/processthreadsapi.rs":"bf8edf8984ee97bc5054e68d02ec4633b5f15720602ab19c95d78e7d420c9cc8","src/propidl.rs":"88b5f176e4624063cadd8db95db52bf07cff421d73a8cfe319f992a9c99cd315","src/propsys.rs":"05c411639479f88e77383c585117a886f48ea7453260210db9f283e2cafdffbf","src/prsht.rs":"f862538c0010a51a02e5f24b3a44b54ba5993c32400b98a3b0558741ae7473a3","src/psapi.rs":"512523c5f8334c9ad221a73776c0ed2da93d8e2353dc4d2cee951ffa6ea7c163","src/qos.rs":"9ef6183b7c03b5b412f81f38ebb06048ff6266032bc236964dd994f173b82ec4","src/reason.rs":"c92aded3bbea859f110eed73b9b0fb40df6ac4a6ed6431ca69882b46b5ad5229","src/restrictederrorinfo.rs":"b8c53f4ae149ea806028cdafe699390a20202d72028b5f62836bcbf97720d133","src/roapi.rs":"dbbefb19f402a2aece66b500739b0a9e2c4d0133a8bc94d076510d5a67def175","src/roerrorapi.rs":"84a0a71a3f9ce67a577954ee5761cbd97d892eb5e7eb2c381f6bd29d4e1d4af7","src/rpc.rs":"e2293651222edf37f3ad3076adaae9033b25b06bd7b88ed7372585a4ae46c7d9","src/rpcdce.rs":"de77ca3c9b689ffaaf395a6882d3dfc3a1cec181efa6cb6075e605e4462bc3f6","src/sapi.rs":"05dbc1166b836251538c9e52a772fa584a1d0a1ad823e4336ab5e6cfefb96d57","src/schannel.rs":"e48926896227ffae5033bd634a7c71f5359d7a08b7b8c6e94e03864d87a37f8b","src/servprov.rs":"f086b4330162c7da711ea59d7023304a8fa2a53470b54d846ea1c11567703693","src/setupapi.rs":"4959862dd39597cd711022fcefbaf5c75b61410d57d04e9dbec2ddf7a2fa6f31","src/shellapi.rs":"ce3e3e7cd8aefe8068d6c51256827c0c3d51a449e4ab73e7125ea28d44dd6b6d","src/shellscalingapi.rs":"59c162b0215ff4b71b3535b6e142cca8cd99028031f47f0a6efb960c160a8776","src/shlguid.rs":"dcb7a1ada1b1b90f405e6dea8bcf1fc6994725b49a3165b7908670b2c31490e5","src/shlobj.rs":"53ff059ec6123001bed8f007c36e40812f83e4e04bd50b371319d10b4e38c36f","src/shobjidl.rs":"953d6ef4dc2a0d175d7133dc2f41255123ab8f778b22feaebd8ca1fa77356aa7","src/shtypes.rs":"ff785004e819bcfc521ab79327e58f98debab4e40c20412bbecdcee1b2801371","src/spapidef.rs":"9abe751425b6aaac7e4a7ea49f6d8e859f8f73164abd4d69b48e3e224d7de829","src/sql.rs":"004ed353b40bb4bceab55d6e8c33063a8eac992b076e47e6ead8303dbbc5b67f","src/sqltypes.rs":"0c5fa183c9f5b9e16e292de6a9afdf73f554730e651250856148ac04718803b8","src/sspi.rs":"dbd9d544abea4396983867ef4f7fbe2588673cc953dbeb74e7edc46503b16fa0","src/strmif.rs":"168040999cf99843cc1447988e46c56481a7a343ae41ab854db40ef566fa1119","src/subauth.rs":"183dd0df6436e9f0e859d62ca78e8ed42d4c1a5dc0690dcf22d42467fd2e0700","src/synchapi.rs":"cfce677c85377a340cb9307d9ac9eb06ffe9fd5e2ce08ed4a0390729e3a7d717","src/sysinfoapi.rs":"9a5579143263ce20d8c365b9874a0ae90ef28bc3295eab26ba3782efa48b464a","src/threadpoolapi.rs":"57876ea70b86d08663f7916ce076547f17596c26b8bf4dfafbad60e78264ff95","src/timezoneapi.rs":"5ccd80e6d16a858c56e20a7f3c5570e29777dab0fdfc057b6d2fb06463d56eb3","src/tlhelp32.rs":"c96ef7416bceab473463cc4ad98f037aeaac87bb7adf45cc16c281308537e82f","src/unknwnbase.rs":"2708c19491deb7364100025f3bb88a791c219551a65af70a776f8f3c5bf18b05","src/urlhist.rs":"8c8c0d0a613e59f68bf0e8cec061ea2126baa98d1479df4d07c8df5e41b50bc1","src/urlmon.rs":"0652e602ef2f5826360e5eab68bdf4f9365827a012c2c89289c54016ea001b74","src/usb.rs":"7e682ee819b237eabe796e604cff2434c450f724f4c86d919683eb7a5167c343","src/usbspec.rs":"d19671960838eb592cda4cd7c84c6f66cd9484f0904b5a28e1d8fd91e9c2c6af","src/usp10.rs":"baa2c1ef6ca5f064bc55b24f39c0553ede45a87b9183318572916fd4f1c679c6","src/vadefs.rs":"0e2f12fd1c521a943908669b2d10fceea409bac45242ec6e87c0e69706c1b3d0","src/vsbackup.rs":"af71cb851bd7eacde9d3e46a112497baef3ecebb472aae3c76c7faff804d33f9","src/vss.rs":"a626613810a69309b8f50d0a3bd75928d9de771c2287b6242487cb8cd55394a0","src/vsserror.rs":"f06b108d66ea9f06ad15d83b981117ed6a2a9cd218bb3bf53f13b0055acd9b2e","src/vswriter.rs":"8c4f5d27fa0883d187506538136cc610074941bb952afbe0984f7cb7c3c656f7","src/werapi.rs":"a2d692514ff3a61126971c5c2c5a7298c0f822559550a7f14501f8c96d1d951a","src/winbase.rs":"e224c40d827b1f1a9c74643c000f71e87ad18f749810cc611425af325c9472b8","src/wincon.rs":"402c5ebf80aa6ab1002935b7ddca17e8a243d0c714982054395862fe0ae40a04","src/wincred.rs":"e5fa987622dd880151ae190bb45daa666ffae3ae8e2da97407210afe01dd93d6","src/wincrypt.rs":"f7f8743b6a89d3f5e8b07405e43010bb3729aa8a8cf4546cc02705f802947ebc","src/windef.rs":"89fa9f5ab2909a4840f16979ebbc0afa2134abcb1d47cb7435b581f31b227658","src/windowscodecs.rs":"7c63bc4e2d0e7ce60c7bb13b93ef5aa12213f71a46845b6e034a9c224ef3eb3c","src/windowsx.rs":"414a9a841590f88804da3eb9ba55d583372a467cc50ab1ebdd7cfc653ce5f627","src/winerror.rs":"f3882eba4e299acbdedd548feb1ff89de958fb72d665bd6ba013b6a1f7596b52","src/winevt.rs":"64ae96f475ed98da7a84704d53d16caccbac2dbd525de0ef0f65fc58a6775ed1","src/wingdi.rs":"35aa9dd14b4b4c5a227ac3df0d312c19cbaede2d1388c26ad8eb910e80efeafd","src/winhttp.rs":"37769be104a2eb9efa70ffd74c8f38a09d9639cf575a677ad75d941e8d87cd58","src/winioctl.rs":"0f0efe0a41894a325b70428d04aeddec8dd7a87a91489a4e564a248e8498861b","src/winnetwk.rs":"d492c3d14a422f611166d39b895ddc6dd749ebc64a020bf3125af452494f91dd","src/winnls.rs":"90904d6adad70081a620165223fb4a71b64d747596c64d0df7de9511cd0f75c6","src/winnt.rs":"2c51ad0a065006010f1cfe7a3335274304e4747adc63f9798e1ca1f7091154a5","src/winreg.rs":"c687a5c6433daa13793815ef9af8befaedc9635be14eea0c618ad5334952dc31","src/winscard.rs":"78ab1d3ae22e486726740c343a4cc6268ca318de43f4b7d7ba51acbdf1b93936","src/winsmcrd.rs":"62be129c3d4cdea9dd31e769b587f071a94c347c8df71a43bb1eea18d52a60cc","src/winsock2.rs":"21dc0393f37f56c15c59d49a32861fb24c8f28d43ce26b56d958a174a5040a76","src/winspool.rs":"a3bd8e04f2db6118fe529bf52cb856a773cd8b816d197fc8edc8ac942578fd74","src/winstring.rs":"dc535f972d93be2fe067a5ca64edb45b6ad8e4549ecc0ce24486bd94555d5707","src/winsvc.rs":"7999f00b341f3e0e8701ea89f71986a6600650ff8cffdb1292e9f55d47bd0a3e","src/winusb.rs":"0ac355aa879a4aae501db04f1e8859dbef5e33fda9d46a7a12ef25e5524ec396","src/winusbio.rs":"8e2d64832999b59b2ea900396184c36d34cf94c97f31e15916c299213748a3e1","src/winuser.rs":"791bd8625812feccc8ec421489194d635c94cb4c4d754287a0caa54fa8f71c19","src/ws2def.rs":"0a1c7a69e4da8edc0584b0e3fb4ad1fa4aed621510b1bc1b0d104990577c6a38","src/ws2ipdef.rs":"c6a898cf25d187ad83e110af1e2286824868691a60818ecc44e68fa0bbbd4ff6","src/ws2spi.rs":"e63da700de55a317769230319eb9e4ec85cc0ac80b2baa076399367338b7ca0f","src/ws2tcpip.rs":"698084fd5d631a2ef236fe76001e7c44afd9b8958243e4ad4c098ac4beb4b352","src/wtypes.rs":"2689e8f442ccdc0b0e1ec82160a5cc3e80abf95dca82855ec595314062774a14","src/wtypesbase.rs":"f6dc0a8b09f3f003339c5dd366bdddb9dd671894be9dcf4a42058b226d2917a8","src/xinput.rs":"e15cd46bf18977481e22d609f8e0bb5508776902d7fa64477bb5b78596c0f67d"},"package":"167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"88d123fdeaf9d3653aec43b513005eb9fdb329375257968526147f6e398c5a83","Cargo.toml.orig":"6c719d20dbfa589b729470c52903138941121fdad2ba3d9ebe3985e891261b16","LICENSE-APACHE":"b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1","LICENSE-MIT":"5b19674a1db628a475850a131956ed49521b744e3dda8f5a94141f9aba681219","README.md":"2fd4c0142b8d6f03e838255ae0eb111cd003d61cbf435d532d501bb4578d0fae","build.rs":"3ac7f9cd553d3460d5a107f44aa50589d0df253fd366f88832730c6fecd30a4d","src/lib.rs":"f65adc2997f898b7a0d0605bf911479740bc007c708e10c0c285c3d3d5891b10","src/macros.rs":"b6cb61c5295cb5263a18dc3c8f294ab953b4572c08d9f98be6f2963583ecaffa","src/shared/basetsd.rs":"99856b585ba67a0e1cc0c6ce6f4a1ce3d43a47974bcfa9341ac7fbe0d3f66a0b","src/shared/bcrypt.rs":"c4af763c7ab609d00a5c0131dbeeaf81363320f7872f7f978c96e46e5709f963","src/shared/bugcodes.rs":"17ce3b68a8110846a4ce1ec1447944e44ba8e852098714176dfde8cb55d8c3b3","src/shared/cderr.rs":"23fafc514089bc50fa7dd7843a21c3ac3bf956f20430177eac2adabdff1dc47a","src/shared/cfg.rs":"8863b6a485e99956c03ebd5b921890877d059d2260db786aebeefb09b69b5409","src/shared/d3d9.rs":"d006692019459d28e1d62537f2f031b3999b56494cc70e1824c5f7fc48a793f2","src/shared/d3d9caps.rs":"191d7e6a120049eb510f268b178a192ac26b851373e7e9d5dee06112eaa7532f","src/shared/d3d9types.rs":"24c2aa38144e83b0089a7adde2b3dc2b93c103e520313d38cbad1444463cbd0b","src/shared/dcomptypes.rs":"24105520e49bff0249a7ce9a77a7cb9776f4a3977019ecc915d09a2fe187411a","src/shared/devguid.rs":"c7306502b0a9b7cf74382b85d87cb010356088b163a62cd19af3e8371ea315e7","src/shared/devpkey.rs":"df9d46b1494754f3b48d62866af443cd9f7b49409fa7ccc749a011d66346df9d","src/shared/devpropdef.rs":"b30c0e0984dc72e35223754cceb81a433fb21847d1a99ef7580c691e7c46c1e0","src/shared/dinputd.rs":"d3b6509875f1b65326faa59ec301ffba275d5c2ba7932937cbc388feecca6355","src/shared/dxgi.rs":"a131a68b095b928843cfb7581a9dfd4f510f749b8f67b1efc0719e5e56036eca","src/shared/dxgi1_2.rs":"65189e09fad5d4f8492d6e0f73f6fa3c6f7c8a90a4aadc30e69252a18f220c80","src/shared/dxgi1_3.rs":"c855e2bfcfd37c0573d171ad9229c4bade07e6b4032addf72def238181a63f10","src/shared/dxgi1_4.rs":"d8b9bd67f4b4908da6f41acc82133ef150a8e1b1ef7317d28087d9554f0b2339","src/shared/dxgi1_5.rs":"30f49ac821998f746f1f4df8397daa6d9d80a2be3fee94bac82f5e427aa84579","src/shared/dxgiformat.rs":"2052f3be936634aca5eb969fe53b9b24ce49e4a20d10ae20db5b4290d53d1bcc","src/shared/dxgitype.rs":"38d402cbf838ac6a27c5ecf03c7527400c7736e1756d11398533f570db0a4d1a","src/shared/guiddef.rs":"0b596aab671f86515d3979d961092531046070bb2b853709ced6085b0fd3a5e1","src/shared/hidclass.rs":"374185e80183ff79a3c0797daeca3af94f4e2bacb579ad79ba60bec5d76215ab","src/shared/hidpi.rs":"9b4d6b5cb4c198c5d47b233a8e896acd04a42fcf37f632999970ed0850f2b8f4","src/shared/hidsdi.rs":"206ac6152e920628398f2d0f3e3778007ac421a8ed09b85aabe1fb6712d7b0d4","src/shared/hidusage.rs":"7133890999bd672ad502a8f1d87c347a3e3f7624480fad7101f3b83322d6208c","src/shared/in6addr.rs":"927dacfbe1b76450673771f7f1c43cb7fe8c7cf3b808bf448b5d1a3c50defb9d","src/shared/inaddr.rs":"5162a678484065a012447b5e9182ef3b297e9f0e2f10c3fcef52d3fc77b72e7f","src/shared/intsafe.rs":"d0730302935824a06be422274f9018d5a4f9c7753f7d7a8b81489efc0e8afd70","src/shared/ksmedia.rs":"2ab9f9791b2e46b5e9c84cd81c8b8c86bf97f9981711be3441e996f84e1782ac","src/shared/ktmtypes.rs":"bbdaa6b33b732e3d162cf248f6c6a95a99301091bf29eec51126411c2bed5621","src/shared/lmcons.rs":"0d1efca38ea4e7f2a84b3309c27c453e4f1f87b1889443e39b27409616a04410","src/shared/minwindef.rs":"782a2b4b35945723e8e7ddff59bffe5d46b6be6770c5aa958de91665dbf42b93","src/shared/mmreg.rs":"61de7fcf55ddb536aec4d7bfe2322d36f2e56ba6d9a8d84c35a96d034c919819","src/shared/mod.rs":"780f7b4d26963df8aece7dc405bc2b2598bf0b18fbe289fd6ff1dbefffdf9543","src/shared/mstcpip.rs":"4db1b2a9ddcecec6cd51da22bab57d1595a1c58958616511a056f9608fd79869","src/shared/ntddscsi.rs":"1a44f487d2a99f7cf121387a6a1795cd8c12a5d9125b0686feb74495a7b60a42","src/shared/ntddser.rs":"3c49b36f7928557453637a69736b80529dd02eea47149f419a2edff28db5711d","src/shared/ntdef.rs":"fc50df4331dfdc2c7622ee63d457e93c2f587f9e15d4da317c29363925970bde","src/shared/ntstatus.rs":"2bc2fa4a8e57056222ec77491590a85a9d536d755d2786780ffa156c2f4b1481","src/shared/qos.rs":"0a9f83173195068a9e0a021eafa2d79964ceff2739b248842feeb707322f95ad","src/shared/rpc.rs":"eeec3424555f01232818fd381e772f1fd9694e04bdb26f90552c0bae9841ee1e","src/shared/rpcdce.rs":"ea3bba0248cd51c36dc3a8b4292e964cffdc94700f1230e04d5efc507d7fdd2d","src/shared/rpcndr.rs":"c91e74ab64d935c15b2712f1572c71db99d94036cd7796d543f5ccf730745ee7","src/shared/sspi.rs":"1f4b1e9751c620e0b8bb8c3ae83ce934c08ac4ab496dc424c0a67be8bb7185fd","src/shared/stralign.rs":"ec74ee5c0a62de19d823a0e48106cba3848d0c086e54806f64d786c821e67d21","src/shared/usb.rs":"4d58ece0cfc7263a09d57d716a07d846b202bb5cd720439a1f10a1454a9fa05e","src/shared/usbiodef.rs":"ecc1bc9aa8c45197457e1b0447e73813c3546c73ed9fa6edf141c62242dbbac4","src/shared/usbspec.rs":"5e11da75acb9f2246651fc6aa0d56fb06ed5fcafd72d2592c864fcc3b561cb6c","src/shared/windef.rs":"494d61edb7d8b1674bcfa3dad07a3bd98ced219e55d647af26c47505dc5b0f38","src/shared/windowsx.rs":"feca97a15762c381300db6dfa69630cef6c0bb6f4830fa3341be38ed5aee838e","src/shared/winerror.rs":"1ca025e81f40cc1263115d1efa037a0c4b80f2a67b9f473c6489a0725f5fa180","src/shared/winusbio.rs":"c1c6da5151682b1bdf0c8f3080258f8181ff4fb5470d586e2ec58e8825e33a36","src/shared/wnnc.rs":"274de0229564512d3217082bbd73dc3f2f64bbbe1dd441af16633d0f48d1ea3a","src/shared/ws2def.rs":"232950e7f313ba4d4e68a8c7816581913073daad348941734cf67a3815949736","src/shared/ws2ipdef.rs":"82ec54204d3dc9952c1285f3562621392a1aebd159f3cad6a2f817b99d5b44c0","src/shared/wtypes.rs":"0b4bc5dc98f65ec00fcdaa62c2efa6120839c801d806d7a5c5e0509495be76f2","src/shared/wtypesbase.rs":"595b91044a9b12d0fc53ed6f4b629521fa4a0f48940eda372076b0c34edf0011","src/um/audioclient.rs":"87423a9d08536b109ee8512c589c0c00ebc06e99c35ca2c67e22f3309d39be8e","src/um/audiosessiontypes.rs":"1b055c75524449f7b290c0dadb53518ffc19d1948b99e676c6be6c4146ba17e4","src/um/avrt.rs":"12eafc929b90f8b77cf01cefee9219324e43f25a2270bff1adad23f3572ea9ae","src/um/cfgmgr32.rs":"3fb021e02579bfd1180feac650c1ebee293020edd96c5bb7d56de689e79410dd","src/um/cguid.rs":"677e800cdc5fa8fc168dede555b1efd2a750052cafb7ab8276b4d568e1c01f21","src/um/combaseapi.rs":"7681eb93196f1bad57dd4ecebd09424fe17b2756b477b935265ce23a5441e86e","src/um/coml2api.rs":"9d2d9d211120d3ea584c3dabc4c30d3e238135b43de68136c1f371d39496656f","src/um/commapi.rs":"011e41c05decaec9aca1f80615261ad7b6298cb709c5dc6c5a7c9bf1731faffe","src/um/commctrl.rs":"64929a81f57331a467bc5c7b0b930bd04b0b6152a4e2cceeb1812964f957a65f","src/um/commdlg.rs":"048a22d8d8c11c9eb83a1532b341afe3f48594c27d2c3f20cb530a8b795cdc5b","src/um/commoncontrols.rs":"5e6a8d450e8649d301d31e8ea10721fadc7c2a93757ef5d284977f17c18e5ed4","src/um/consoleapi.rs":"94c81d472d3b295b592f1d4f35fccbdda6e17890a05563d0974800a5432261cf","src/um/corsym.rs":"426c36e0b8d9bff003c8221b6bf97489ec705e4e30ea6bac7d5c0375d9cdbc55","src/um/d2d1.rs":"3484ef55281b7da84eb0e837f91a0cafeb0c63acb0360e56dded4428a319a313","src/um/d2d1_1.rs":"fd1c1be2d1aa199232e2c1d1a00c9eb3ef607382aeb46e637692bf73dff9b37f","src/um/d2d1_2.rs":"c65a1edc4f0f9137345cc015829c80adff1a4b9566a7d32eec11cc02521fc69c","src/um/d2d1effectauthor.rs":"6007bed09c98044c8a19e74aec6d55d36a43d546ee5267e0b06661ea1269eea4","src/um/d2d1effects.rs":"7690360c6a0f4749aec71a602b0b3e905b9f8ecfce47a9ab4d7f1e12e0ec8327","src/um/d2d1effects_1.rs":"ea08450655b94679d41f263dc083df1ff6ca8437f8e796c8d79a513d6e110da9","src/um/d2d1effects_2.rs":"49477c515fa8fadbc6e3eccd5ba2cb7c85c4eb1d228a2bced08c32535614cf4b","src/um/d2dbasetypes.rs":"616f9edf34d828f7141bf416c97565f96c05743070870e4d4d90c172107a17aa","src/um/d3d.rs":"330569cb4fb4ec02d1d5dd2532071ecc7abe52b9a3e4e584a16506a4345ad28b","src/um/d3d10.rs":"fb1f897edf2183baca997e630273f37cab944d665185e49bcca188576bba97ba","src/um/d3d10_1.rs":"928b097741a4fe136a5dde080f1c017b57ab220051f37596f390b82b2ab31125","src/um/d3d10_1shader.rs":"fe44c5fe7dae6a306e146904a1887d7d6475e324616a773210c73189fd6628ff","src/um/d3d10effect.rs":"e80e7e03c73f3d75351ec4702202d47b4923f5157eae7cd0032b984b0f3b70d8","src/um/d3d10misc.rs":"e6c5ea73e6bebf870364eae9dd21c58c98d51121b00241e8cabf4a54d0801d0d","src/um/d3d10sdklayers.rs":"b8dc7f1cffc609129f468d8e09f104127ab9cd14c1e960fe8bf081efaace89df","src/um/d3d10shader.rs":"aeac67df2bc3030b78b520270edbdf7c88868e0b69cdb7dd568dd34d4b53ee95","src/um/d3d11.rs":"1dc3738a714316883b65494e2f9d5f6ffcf7613d16207dbe2da4043fb84dda9e","src/um/d3d11_1.rs":"a600581bcbb15784eddeff5bab4b19a00dc5745d5aa939aeedc4bb48fa8c7659","src/um/d3d11_2.rs":"c530723f9267b44f25c1cf903d633a3440cab763b22b2bc18c9695f37c304880","src/um/d3d11_3.rs":"f5d9fa55a43e19fe3586a3e9238103c58e5fd34c6e7ccdc1a05cf9fd18c1b025","src/um/d3d11_4.rs":"e770c8058d7120dc5c49244df8b53c5bd4fd2b2614c33402eeb91dc90511c0fe","src/um/d3d11on12.rs":"6d5fce57d92cbb200527af592925865d88433b78504ec4c6b5a43b9f8ec9fdf6","src/um/d3d11sdklayers.rs":"67363313d1435f6d143f986071d74a48399f9578807fc5a3238ae58a2051a0e1","src/um/d3d11shader.rs":"08c2179817999cba7da419ffc04b5cc431589f4bf5c7d9bb8e9301f063e4c38b","src/um/d3d12.rs":"54446d8b3b61428c28319a615411da45825d70409d8292103d511aeb65ac1f2e","src/um/d3d12sdklayers.rs":"f9436bab026a6193df5cca63288e5cba4f5e1cee210ea44905b0be0f30241d5c","src/um/d3d12shader.rs":"5fa55c73c12ec83de58519e7aa1bfe6375868b698ed1b83c380403f550c719fe","src/um/d3dcommon.rs":"7cf2b64bd954e1f93f7e3a5bfb8fa05902ea9cef1ad401e41e16ee841631fbf2","src/um/d3dcompiler.rs":"5fa5f430d07cff934e47b173c976c6c7a1e5dddec243003a220c7608c747461e","src/um/d3dcsx.rs":"1a859c5ecff97c768cec6b07f380b7d95461a841028f549a83b6878403125521","src/um/d3dx10core.rs":"693dafd6755452d282d4f2739b0ca23f7ef4c91c7ded1a422e81dc9f45910781","src/um/d3dx10math.rs":"eb45ac39eac6459eef2942eb652e7b7876b7c9a3593a43d81e7a3ae929d468fe","src/um/d3dx10mesh.rs":"ed4e70afa27dda8ebdf7b69692f639b6c86d9121cbf0cf80fd7b4b0fbb6a8938","src/um/datetimeapi.rs":"e280d15f02b260e0b6c3ccea3ee2f989ef93bc954a098c66903c4ce8a5f0ad92","src/um/davclnt.rs":"e282bbf42babaed01e6bdb0f20ea3ddb59395b594da5f70b6d61706756d86c09","src/um/dbghelp.rs":"0802044ac232f3f3b6eda5d4922ac9959190ecbf014dac00b301fd5a332aae26","src/um/dcommon.rs":"ecece66b2675dd1d63aa8c27e5299bd0ec4cf4271bcdf531661987c98dd60f14","src/um/dcomp.rs":"3a8daf77acfc5c615ddd11f2c2b83795136ace427ae586a817bfb7af087229ec","src/um/dcompanimation.rs":"5eebf243c1988e282b13e3edf615622b359b045dbb8dcc49df3e44b3b3405258","src/um/dde.rs":"ac010bf6cc6c3c72b2e13f5c62aeabd1c5ff0fa087babafa3323f01b5719b1de","src/um/ddraw.rs":"d9485ed844c2b4576bf5ef91ac4d012e505032559434f6e71f94fb856a979d9c","src/um/ddrawi.rs":"3b5db96b3cc668261223fd57e033a6d65f02ef1c7120faa76a365212529cb693","src/um/ddrawint.rs":"4de466a4f12d11c8a5463bc045a78cd9bdcae6ac71c5a200cc97e9618bec5d67","src/um/debugapi.rs":"2fc48ef68740503afd7411e2a58ae7e27691ee7a8e7fc5de96b17693ca7c82f1","src/um/dinput.rs":"5d61e3dd3e3743ea31fc594518733a114c5f1e3ac1eebd61b5f0282d63cc5456","src/um/dmksctl.rs":"8b7f64a5f1320168a9e047af93b8e4608b3c8ad985e60287c0d1a3f8f68e39f0","src/um/dmusicc.rs":"c04ebba40f56a73f357371980dca6ddca5ec3ed5b7ab99ddc4ea3a5cddb85fab","src/um/docobj.rs":"9d5e9d2e365d4ff4b73f50c812c39ff432ac742de0c7b7a3c660411bc77c67c2","src/um/documenttarget.rs":"1ce701a5ad7a0a62f3f65059d6f53e231ccf303d1600b5ecd469a84ff8ca283c","src/um/dpa_dsa.rs":"d8e2a95660e517d487250c7200d6309667177799dea5173b3f72fdffa134824a","src/um/dpapi.rs":"d905df74cebad05b55cd649d0e7cd991dcaca417d98f455470077708253cbbfb","src/um/dsgetdc.rs":"10a39c907d4f14fb26c6e243905ee9ae3ec4cf13e70214cbdae5747f95a9e1c7","src/um/dsound.rs":"a0863c647b60423b87afdb11cf660cce27223c836d15e15109d46ce6e861fade","src/um/dsrole.rs":"14fbdc0d01d63bd95422300cda3a03a633b5fc04e2624e02a93afcc9024eb8a1","src/um/dvp.rs":"d1eb0e0ba08a455d65563e687753795118ce535727d61175703c435e91e6f4bd","src/um/dwmapi.rs":"6ed0491bebbfaa0e6803b6254e089ca40dade9b0dfae1fe33b95f68a356787e1","src/um/dwrite.rs":"70323c9959272610426ed5494531e0340a2e6be2867f7bc236b12729846ac6a2","src/um/dwrite_1.rs":"e3bc9ff0edae57e8bb46c2a4a66428777709638dbb921d468143e61dac42344b","src/um/dwrite_2.rs":"18fc9de6626b5f0cf47cf5ae31eb65e63ecf158e714bb1079dbe3bd87cc30e11","src/um/dwrite_3.rs":"d68a9ba403102c0b0a1acf16f9239589a2dd02779c0312a3b7e044635a3b17e9","src/um/dxdiag.rs":"6e02c1a1b174b774f2d02cc0007b240ecbb551159c7221a81780db05caba9af2","src/um/dxfile.rs":"97a87d87ceff6c8aa2c1624c3ee891a7adc0914e1b0750d3df05ace6d20eeccc","src/um/dxgidebug.rs":"4bafaf969b3a7d11719aad1ee57a49969b89ade8bf0fcefb71c0b819a1b5eb17","src/um/errhandlingapi.rs":"5336cf6d97cd1278b783d861319a0521302788dd929b1dca0d8c404ac3bb4346","src/um/fibersapi.rs":"2240d53df44c605e09cc7b36c91ffe860c5af0bf834943aec3c6879564711205","src/um/fileapi.rs":"0a15a65add51284cb32f4ae09c5eb37b651b47bcca29b0e2f2de371a05de9c4e","src/um/gl/gl.rs":"9add9a323d87613a4586f4c688599b864cbf3d862d3d70ed0c18dc0da041d8bf","src/um/gl/mod.rs":"3e3fb3789ce9bfe7692fe2939121f65887f71005d5b0b3b1775f131c9b69222f","src/um/handleapi.rs":"3c3ba7150e50fe603f0a1e14f67777a5ba2d7221a4b66ab1df84566dcb07eb81","src/um/heapapi.rs":"7284592bea7212d0554dc7ed63b0888786f2ae3af4df59ac1e4b697c85edb922","src/um/http.rs":"755e53f3ef8f7bd0f3cbbcd619ea303980688343451f3ca36df71cedf2dcd3d4","src/um/imm.rs":"ba17745657f2125dad047a80a4099b7c89e84eaf78daf38bf3ccc1ff4980275f","src/um/interlockedapi.rs":"e9d2e12f2a2076f4cf26e19ba29d871f3a652b1acfef44670c05be7255103d2c","src/um/ioapiset.rs":"f4f99ecb0230020c6cf169e2bd987db085af8a6d25307d32196a0e08e5c6c66d","src/um/jobapi.rs":"e12153c40a82c3acb889d8b2f3d2ccf5cc1de40b2e4396d7e1bbff0d3594043f","src/um/jobapi2.rs":"5e919f05a84149b7dea9057a8d583b5c35cda9fd36432675260cd15c65ab5be9","src/um/knownfolders.rs":"02de8af90f560227c1cf1067efe1c40b4c7f308f02dda427651bd6fe29ffe511","src/um/ktmw32.rs":"43a6387979a79ac365667e73b9659d6ce608bc4440cc23aec5748fd2bf3af646","src/um/libloaderapi.rs":"130ff661c6ec51c16c4e5ac4111f01732d4767e5f9f9a286339d885742e1d3c1","src/um/lmaccess.rs":"03a4c77c728600d00edca52cfb35d4acfce6aa83c19fd64ce8a57de7dff6c66e","src/um/lmalert.rs":"f4510d6a8524f1950979500cee86aded86a46afb5249cb227e99a61b79f9d1d6","src/um/lmapibuf.rs":"3e761bb15d8c7e83683c1138624ce7606053ba6bc9077f4c2a87545d3efa56fd","src/um/lmat.rs":"fac23bdfcc071052de2fdb1e1cd6ac164cc4e35d502af709b3b634844f7ac449","src/um/lmdfs.rs":"228ab0745f456aa8e11a630014907eb124e1380377456701fa99353c763df4e8","src/um/lmerrlog.rs":"73d51724f07316ec0c8ace1febfdc0bd5958d637d253f79f36aa5331ec2bbbdf","src/um/lmjoin.rs":"9dafd3c9317c566e628824cb6d16d806fb95fff5813ced1948cea8882752832a","src/um/lmmsg.rs":"1b3566b3a1595dcdfb471304719af37f739b4223bc6c08744e3e7f7aaa14b597","src/um/lmremutl.rs":"4401f095e6db493b56ebc3fe2daa69317bd59e361bb71f1eb3cf6b672ba21cbe","src/um/lmrepl.rs":"4090bb897cdb9991c417e53850e333191527cea4d06258a497a3a5b1a448593f","src/um/lmserver.rs":"c1a123fb6ec29d743e4e7a42e9b28f450f2230234559592b6ea2b21709810e27","src/um/lmshare.rs":"13b15ba3eb252fe9e2a20d97b38849eb4b617a177cbc70c88d5ab210a031a58a","src/um/lmstats.rs":"3a114d58d9c564414421437285acab7f2262bcebb78517bb6e9b7b36c34ab36b","src/um/lmsvc.rs":"f3dce4607017e785c60142b55631a4f25854434fb9e50a11eb4dc37599e125cb","src/um/lmuse.rs":"6a3dbf4ebdef73dffed0dde131e52d7afcc2675e1537c01872dff43f6f5147ed","src/um/lmwksta.rs":"de6964159b6c08f0e5e57559653027cd210ddaeade7cad9e5e2af3dbc8c15835","src/um/lsalookup.rs":"cbf4a30d745de6416cce08bd04ed31a97572074629e6f2aa8bea8f2a25eb5d8d","src/um/memoryapi.rs":"ac65f2ea269607480e06921fa47fb3c64dce617c9f5f8cb97535dddd7b6e102f","src/um/minschannel.rs":"f6347c502f6eea1ee9be303a815624c063a870969db7ac0cdea3dfd2db69046a","src/um/minwinbase.rs":"5fcd41e829d173f88ec960ce2982af3b92baa5b9e2d5cb8f1f41371a9ad0c932","src/um/mmdeviceapi.rs":"a2879ff838d85b277a34cfc76aa9d83a3d235371db6254e712ffb1d67e8d6c13","src/um/mmeapi.rs":"955a2d66ff240db263be0b9054b27897228f6997e61c8daa2b701bc977d288d6","src/um/mmsystem.rs":"049c06631f376fa7faeb7bd480b9a13ed2e9b73d7793b265d87e7efb2fda02e7","src/um/mod.rs":"f495f2487f1a81560d3d2b05a315e0f3fc66ab6fdcaa144ecb7aedd8b7e5d9ad","src/um/msaatext.rs":"f7a04ed96e0767a435856bb84bb835ef31617a30e49a6157e4a51c99dccecaea","src/um/mscat.rs":"c3ceae9899811610a4b2f15a80eb2e41eae566262d26ad6c68f2f95d1785a1a2","src/um/mssip.rs":"0ec2cda4bc2cb2cc1c6ca83ff0a63ee6c85b731f6b90206909a3473c9084e79c","src/um/namedpipeapi.rs":"776f9b8b3310810bd6c22d9c2e68604fb2a196f787666f7b2a63833d96b0d134","src/um/namespaceapi.rs":"30c2a4e7b05c1426af95eb36216d9ac9c1219ee64f472b999286027a27a6e8fa","src/um/nb30.rs":"c16c9fceab92a52a5587a22760cbbff0b2bb8564dac1f9528f51eced3fcb8b69","src/um/ncrypt.rs":"d3efcc1526a29e14ad14dd114a64c848a3cadb948ecb138707b8f2c5528ef742","src/um/ntsecapi.rs":"902a284c7560d3688364d6e5d7eae4693eeb4c5d6a82b57974b54caa7957759d","src/um/oaidl.rs":"21e15244d1ca7afbe427b8f80839db1e1820363f03a367c8c60f40e173a8a6fc","src/um/objbase.rs":"17297f27028765c3e40c5b47a83cbb083723259956a064344e2b681816c65d87","src/um/objidl.rs":"4ebe979aa0a42aa5b4dcf5d10c4d684b10e546ef039c5094db984b897117bf0c","src/um/objidlbase.rs":"3cb828436c7603301886a5c97a32547ae4fb787df40e5ecb79e40a01e75b3648","src/um/ocidl.rs":"f1b42dc297b6e267c5411f92b626072e4f4efb8de2b6b53054f6aaf15938874b","src/um/oleauto.rs":"bae109c6c013f5d3a62c553b43e0cbe3ba6906946927d5f497124df94e03e726","src/um/olectl.rs":"29ca0c1151fb7e19eee5839ad0960a052bbe94c770299ab1f2ca72bd518b2cd5","src/um/pdh.rs":"086285ae0108b0cf43223352222f2c85437bc44d59acc6f515ecc9e44d561fb7","src/um/playsoundapi.rs":"1b20c049d6c6762c7ad046131c4f2ff7038112149ca43ab95c63c149f6f84639","src/um/powerbase.rs":"6e3409c14abd9827439c736907b8a172f405181a6f803233dd260d12dc3ecc33","src/um/powersetting.rs":"a80e15926ace650cfbe28e294545a00672b6e3ab3d4c04d54dbec8a8f54bab1d","src/um/powrprof.rs":"41f649be8d3b449e8bcc0dd50704d4b2b62d26cf821b609c198673974528cbb0","src/um/processenv.rs":"82d4d1d41b2254da608703a060f641a2ee08a43ededdad827137285bac68c549","src/um/processsnapshot.rs":"3772c245b6196e192c5bbb47f6ed336b4eee64af07b7adc28b942263f084567d","src/um/processthreadsapi.rs":"04284a25b963e708b7d55394e765d724c8d466a92647e726047fe36756d72363","src/um/processtopologyapi.rs":"e01d180d97b07885a034d2bd0286c38bee0e7f74452b786495a498f9145ba410","src/um/profileapi.rs":"8e2b70fff8d54996afa70dbff1d0feea56bf0ae6c3c872eeb76a08d5317d0a06","src/um/propidl.rs":"7595aa6e58ed166b21f550ebbe7b50cc45f847cd4d5685cf2c72492137c987c0","src/um/propkeydef.rs":"a96c903b81af6155ab032aaf1629e5f74dffb1567b38428c5da0c15456b26117","src/um/propsys.rs":"092d119997a4febbbe8ea3985230d05aa209c3e21a37c4ec88a6b448ecfa654f","src/um/prsht.rs":"e8171b46042b169095c6ab2f6ef0fc34c9912e6d53fdddfd083c2dbc80296436","src/um/psapi.rs":"242ad484c2d2c178bbc37e806c5e077c5dff6e6ed7ac1fd9cc196e3c9003aef0","src/um/realtimeapiset.rs":"9411d06bbbab05eb9700bda4dfd7355b34fe834d4616812d81bde24107a4d0ec","src/um/reason.rs":"d03dea55f23a29fcd2bc76202ddee5d42860f591830294d296fde52c05086ca5","src/um/restrictederrorinfo.rs":"b9db66ace1034701632037cc2a8466e5f7206724d5674decbdb4b952f8b15beb","src/um/rmxfguid.rs":"7a683ff98d3eaaacf4746c2f4cd1b97cca4a025d6060d24ea4ad0c4b12a31edb","src/um/sapi.rs":"cdb2d4394a1668393a61a910c24bdf0c8b77b4bb0a736d3a9ce3d9a52cc61df7","src/um/sapi51.rs":"64ee2af4d66e5095e7609349b58eea61c77e6e2aa75e2eff2c1c4e630b74a87b","src/um/sapi53.rs":"48849e3e0bab4d186c5cda86d3aa029543da5c5390fc981147310a9c4949fa81","src/um/sapiddk.rs":"ccd29c6ef0acd5a824b4958a6c8a66c57b2706681ef545fffba0dd6d2babad14","src/um/sapiddk51.rs":"362133f09f6f02c53401de2216de549f9944c96c6f0dd51845c4eceda32e2f36","src/um/schannel.rs":"9ba7437b82cbac1fe6ad0dc82ef58b1ec3484bbbaeac5b4a2fe12f56c46e5d13","src/um/securityappcontainer.rs":"933038334262d99c3f8f4160358758f16acdce8b95387f8fea449ce7749cd940","src/um/securitybaseapi.rs":"a13bc78058b10a2e7ba17d951a0bce7eca00a6db621f698aad3dcdaa058eac6b","src/um/servprov.rs":"7edf50368c727efde70880ec230c7a8fde4afc2cfb3c2893a2c4d1ba319627b8","src/um/setupapi.rs":"8eb251d72e9ab6785d99e26f82dd28e65076b83ff06d0821941c7da341b4398a","src/um/shellapi.rs":"64afe5917386ad4cad0b80eeaf37b1e9d8b5bfc21619f7b0e28430a3ad8d4b22","src/um/shellscalingapi.rs":"2cded3fba4480871733ba141b0a1a790e883d77e9f144ea34135215c89a40cf8","src/um/shlobj.rs":"bd604c083a0e8331049f9ac1200a03cffa2744d63d9d470c4aa94400482d4d44","src/um/shobjidl.rs":"1dbf4ea1d5469bc80702e28149a6ce200824b69169edb9ae0cc6ad05de6d536e","src/um/shobjidl_core.rs":"2b39f725c06dc44b4704f7a8cb10eef63636c13e811e114f19a667465150af34","src/um/shtypes.rs":"1f81638cc9eebd19b0023d7d07d95cabf5236029b03212516c04d1ea98205e76","src/um/spapidef.rs":"575b0632cb7ef628cf86130936c31f8a35c6f6269fb57d2a4cbd5bcdef539a1c","src/um/sporder.rs":"64d365a773a864fbf6789ff8156214ed669baee6b3cd90819c2d2b36324248a1","src/um/sql.rs":"abff2a2fb5f08be9f565eb03a65244043720348829f04b98656a89686e807216","src/um/sqlext.rs":"9545e0390ffde6ab4a620e0800265b399144cd4fc8bd94258041c1af9375573a","src/um/sqltypes.rs":"77c6c920023498820e51ede76942e9628c544a6024cfce5ea484b8995e664ba2","src/um/sqlucode.rs":"758a8e581fe6f0a960bef2a478a4047a494ee18995f1e7dfa34282ee2b0d18f5","src/um/sspi.rs":"0855fd38942aef19f613702506329c8103df99721b5e1bf6d508434a7cc24920","src/um/stringapiset.rs":"585f3051bec63cd82909b7edc10c76bb7bf92596c90f33792de28eabbe57ca8f","src/um/strmif.rs":"302d470618e6e5225c5168838228ba9773295e87c8864d6ad2c148cf28c7c3ed","src/um/subauth.rs":"203278f313af5f60dd6eef4cb3475988d16197521baf61882892ecd5b13c05da","src/um/synchapi.rs":"a53963ba8b51b2b8ac91039d91b7f5879b900910f913cf879e31177ead04039c","src/um/sysinfoapi.rs":"37ea5a4b3b120da417d2e1585210cdfd09b1280c3b546e3d53bd2975cbb5a4f8","src/um/systemtopologyapi.rs":"362c015c1799605fb5bcd28de53357805206f6fd4a4eb713e1c0bbc61d11ddba","src/um/textstor.rs":"3c2980ae947ea25a8299f7bc670ca73ec3c9a13a3ab7884c96b55575113d28c7","src/um/threadpoolapiset.rs":"0a96fd29497b2ece591d5a65a74a70ec40b444bf6e128fed8a03041460ea699a","src/um/threadpoollegacyapiset.rs":"d63f2aa225ba0587b567af78eb2b5a8a196f6ab878d97f9b022968cfba5e9141","src/um/timeapi.rs":"8c493994fb39f8e22f951b12d4b03d6287597b640150d5e605dc3b51a3237db9","src/um/timezoneapi.rs":"6cfb38964a156f77a94c51380a3c0e986c39aee3e0f85c1c773a34bf057147f4","src/um/tlhelp32.rs":"bf881357245abd5d164720d235efbcdc8cb700cc3ee924f324acc027baedd586","src/um/unknwnbase.rs":"071fc08d973b4167b5350bc73d28af7f872f803973c0ef10db2075c9980006ef","src/um/urlhist.rs":"d3cab3bd881fd21ac2b07066e30abb5e4733c700159ed3611846e2d4cbc324a3","src/um/urlmon.rs":"c56f1f5af41e8ee7c7c02f553327b2e5ac39f3abc2f7dc44c0cedbbe6fbfaa3f","src/um/userenv.rs":"144f129dc824a7d3f4e1586734b866e02e163bedbc357724e0e18f435e78501a","src/um/usp10.rs":"38abde24499aacdc229ec9581dc9000dc1bfb4f566b9c5b535adabc2b86300f0","src/um/utilapiset.rs":"f02a26c4a3c908bb0c80ffb29a667dc66b7b9ffa29d48ef190dbeda03a0cd78a","src/um/vsbackup.rs":"2181be0a43723a4cd1b0532ddf86bac784ddc4365aba17e6888e6fb8958b11ac","src/um/vss.rs":"a1f80c29d7099fa5fb588144908eaa4fa47e7311d1feca84e2fbf4bd64d11418","src/um/vsserror.rs":"1b43c769bc7377405ad286e0fa1442e02d0d7ee025ea949a04161653499d24fb","src/um/vswriter.rs":"4578dd1e785eac6324779507ab10307a6e8558a44b1980eb925df0419f7552a8","src/um/werapi.rs":"4e3563a6da5fccb6b05fb9ea4b01a50f2444d8290056e30ef040917079cfed00","src/um/winbase.rs":"8edaae2ec6a90e2ff819c93bff448062682e6c73772553fb88e8e00df5c02982","src/um/wincodec.rs":"fedaf0ef57edf6ddb207f4a9b5bad46b8129a78e2d37b8e80173adac65765f22","src/um/wincodecsdk.rs":"0e3215ea2347925b09412e631aacf4e071a451ff0999af0cb9d03cfd113e8f77","src/um/wincon.rs":"9aef7bf262c9b9ed0ec85e6ca97c25327d8f97df04d83aea5d8c9ae4b6d50604","src/um/wincred.rs":"cfd063771336399d8e7ea93104de3d38ec12799260d7b3407fbd5e1079c2c81c","src/um/wincrypt.rs":"31bc3b6213957fb1371c732d4453cc342fa1a4ab94553e432b147448b1e4899c","src/um/windowsceip.rs":"cfc2062daac6a9195690af64bd817fb41f086206c5091539da29d6e51a3a00c6","src/um/winevt.rs":"29f85bb49424efa7ac921cb10f2da4b77e4cfe863ca2fe17026137dc5dc2ca8d","src/um/wingdi.rs":"7f49f8a2a743d2de6a37c8f4708e265f0fb64b76479a22d342865db192e6724c","src/um/winhttp.rs":"f163b3b7ef893b6d769fd3886bba182972dd886674af382174ad0c96c774f54e","src/um/wininet.rs":"c96ff6e03d1602b50422ab2847f28c6e4ab80bb3f992d2e6a4e87c20ee17d83d","src/um/winineti.rs":"8624f54b40da0ceb7949b43f8eb54e3e07ca59f5b805328de2b9aa030adb341d","src/um/winioctl.rs":"df6248eea7c4cf1c023e9e14f1ac519f986a3392c586d51155588e465ef16557","src/um/winnetwk.rs":"bf3c503f6e6d99d8640d66102679522ffda0ac918022f0873dae8bf3fb837ba0","src/um/winnls.rs":"89ee897be3c6a7a9452082d797f2c71139112f8a7534b375cb8d34c6befde6a5","src/um/winnt.rs":"ed301efeb6cb025f6cb2fcc97420c7b8de58fb1984a907a3575fffdada25b355","src/um/winreg.rs":"d6f3af7e598140a4aca605b9b9a431e608d4b2aa0c795db8345e1c10446710c6","src/um/winscard.rs":"0fe23a54544c530838774f7c03708b2d375a3678fbf2f0390e6abddd128a3f33","src/um/winsmcrd.rs":"328de1e80ae94550590f11e000734d463b311190022953a770ae32dad365105b","src/um/winsock2.rs":"3ecedee15dae16920c39b880f32d5d39686651e6b232496c8e10cd32ce9aa81f","src/um/winspool.rs":"8ca9532933aa6bb35a1fa3ec7609a12bd5db82fde49fdd6f1d9aea61479df131","src/um/winsvc.rs":"2768d8886b149ca8ef00a247e04f8da3b089cc71250d575bac8584f5546a534c","src/um/winusb.rs":"6e223e0916aaac8ce08ae21c328c38c042f193aefbd3ee56b325a467c9941da0","src/um/winuser.rs":"59a5b59f761e0f17dd959dff8fa7b6889ab5f189dfb980be1178b72a6016f32a","src/um/winver.rs":"c0437e334c919489b02c7e14e0aedf64ece4ef1ad80569cc99f4e126c8c8d287","src/um/wow64apiset.rs":"42f0fbea817164c78133c014821486f2e312fcb79060f922435a60fdebfb07f3","src/um/ws2spi.rs":"79a2cceb67b4e632ee890000d8e2c00f2d578ab895af6d80d5df96883136ece9","src/um/ws2tcpip.rs":"ec7d0af8a43fb608e827e52b98937339359ffb9fdd47dcf5f9f3c4c086145527","src/um/xinput.rs":"5e55915c432e4b8de8cf489d35d774e9f3e259cfd3bbd9a09e3271cd78a2e00a","src/vc/excpt.rs":"c1000ba67ad7dc36a00433dadcc20633fba6b1a7306fb1e59e60a32369fe22d0","src/vc/limits.rs":"1421607eee3fd422ed26d8d764b09de271791f5223909c757ac53ed3a69dee4a","src/vc/mod.rs":"cb61848f0bcee5c96ebf2a6c3a69eebc31d84d29c108b0664d104f9c040e3aa2","src/vc/vadefs.rs":"3dc2f47dc3db9f6ff0e3c5ce5dc1487b031094240cb00d8ff194e333c959492e","src/vc/vcruntime.rs":"a9e21c05716dbbfeed5a17918e7b742103a80ca9923fcda3871859c0e863606e","src/winrt/activation.rs":"d3839c4c9f9fed955e64d87ee7e43a0e56b9a225061c2342350387e696ca771e","src/winrt/hstring.rs":"a1cfcb0e752360f56145382bd850938df4c63d00da9d0f1608bd104e2cba5bae","src/winrt/inspectable.rs":"7252d0813a1f3f734a8cb7134a6bf1a91518966bca3f57a35fbb3c447b513a9f","src/winrt/mod.rs":"13530a7c2b7bebc529d2c12666551d0fe4d30f0f653eedc9f38ddc833daea05f","src/winrt/roapi.rs":"0959be9cd87aefc2edd56a78201e332c535ddd36b3b93ef9668b8904d50f3909","src/winrt/robuffer.rs":"6c974c04c3c20784058753d8a4d6a640bd2f2d52f644249ffaed6886e12ec241","src/winrt/roerrorapi.rs":"90c1e113dc54121a72957b9b64dc3592eb688fc91015a03a04edffad4e62813e","src/winrt/winstring.rs":"a3875b317bd598040f98deb4838f5dbfb38b40f3eac0d450debc9084971f1386"},"package":"04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"} \ No newline at end of file diff --git a/src/vendor/winapi/Cargo.toml b/src/vendor/winapi/Cargo.toml index 941a659b0f..e20717c738 100644 --- a/src/vendor/winapi/Cargo.toml +++ b/src/vendor/winapi/Cargo.toml @@ -1,61 +1,334 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] name = "winapi" -version = "0.2.8" +version = "0.3.4" authors = ["Peter Atashian "] -description = "Types and constants for WinAPI bindings. See README for list of crates providing function bindings." -documentation = "https://retep998.github.io/doc/winapi/" -repository = "https://github.com/retep998/winapi-rs" +build = "build.rs" +include = ["/src/**/*", "/Cargo.toml", "/LICENSE-MIT", "/LICENSE-APACHE", "/build.rs", "/README.md"] +description = "Raw FFI bindings for all of Windows API." +documentation = "https://docs.rs/winapi/*/x86_64-pc-windows-msvc/winapi/" readme = "README.md" keywords = ["windows", "ffi", "win32", "com", "directx"] -license = "MIT" -include = ["src/**/*", "Cargo.toml", "LICENSE.md"] +categories = ["external-ffi-bindings", "no-std", "os::windows-apis"] +license = "MIT/Apache-2.0" +repository = "https://github.com/retep998/winapi-rs" +[package.metadata.docs.rs] +default-target = "x86_64-pc-windows-msvc" +features = ["everything"] -[dev-dependencies] -advapi32-sys = { version = "0", path = "lib/advapi32" } -bcrypt-sys = { version = "0", path = "lib/bcrypt" } -comctl32-sys = { version = "0", path = "lib/comctl32" } -comdlg32-sys = { version = "0", path = "lib/comdlg32" } -credui-sys = { version = "0", path = "lib/credui" } -crypt32-sys = { version = "0", path = "lib/crypt32" } -d2d1-sys = { version = "0", path = "lib/d2d1" } -d3d11-sys = { version = "0", path = "lib/d3d11" } -d3d12-sys = { version = "0", path = "lib/d3d12" } -d3d9-sys = { version = "0", path = "lib/d3d9" } -d3dcompiler-sys = { version = "0", path = "lib/d3dcompiler" } -dbghelp-sys = { version = "0", path = "lib/dbghelp" } -dsound-sys = { version = "0", path = "lib/dsound" } -dwmapi-sys = { version = "0", path = "lib/dwmapi" } -dwrite-sys = { version = "0", path = "lib/dwrite" } -dxgi-sys = { version = "0", path = "lib/dxgi" } -dxguid-sys = { version = "0", path = "lib/dxguid" } -gdi32-sys = { version = "0", path = "lib/gdi32" } -hid-sys = { version = "0", path = "lib/hid" } -httpapi-sys = { version = "0", path = "lib/httpapi" } -kernel32-sys = { version = "0", path = "lib/kernel32" } -ktmw32-sys = { version = "0", path = "lib/ktmw32" } -mpr-sys = { version = "0", path = "lib/mpr" } -netapi32-sys = { version = "0", path = "lib/netapi32" } -odbc32-sys = { version = "0", path = "lib/odbc32" } -ole32-sys = { version = "0", path = "lib/ole32" } -oleaut32-sys = { version = "0", path = "lib/oleaut32" } -opengl32-sys = { version = "0", path = "lib/opengl32" } -pdh-sys = { version = "0", path = "lib/pdh" } -psapi-sys = { version = "0", path = "lib/psapi" } -runtimeobject-sys = { version = "0", path = "lib/runtimeobject" } -secur32-sys = { version = "0", path = "lib/secur32" } -setupapi-sys = { version = "0", path = "lib/setupapi" } -shell32-sys = { version = "0", path = "lib/shell32" } -shlwapi-sys = { version = "0", path = "lib/shlwapi" } -user32-sys = { version = "0", path = "lib/user32" } -userenv-sys = { version = "0", path = "lib/userenv" } -usp10-sys = { version = "0", path = "lib/usp10" } -uuid-sys = { version = "0", path = "lib/uuid" } -vssapi-sys = { version = "0", path = "lib/vssapi" } -wevtapi-sys = { version = "0", path = "lib/wevtapi" } -winhttp-sys = { version = "0", path = "lib/winhttp" } -winmm-sys = { version = "0", path = "lib/winmm" } -winscard-sys = { version = "0", path = "lib/winscard" } -winspool-sys = { version = "0", path = "lib/winspool" } -winusb-sys = { version = "0", path = "lib/winusb" } -ws2_32-sys = { version = "0", path = "lib/ws2_32" } -xinput-sys = { version = "0", path = "lib/xinput" } +[features] +activation = [] +audioclient = [] +audiosessiontypes = [] +avrt = [] +basetsd = [] +bcrypt = [] +bugcodes = [] +cderr = [] +cfg = [] +cfgmgr32 = [] +cguid = [] +combaseapi = [] +coml2api = [] +commapi = [] +commctrl = [] +commdlg = [] +commoncontrols = [] +consoleapi = [] +corsym = [] +d2d1 = [] +d2d1_1 = [] +d2d1_2 = [] +d2d1effectauthor = [] +d2d1effects = [] +d2d1effects_1 = [] +d2d1effects_2 = [] +d2dbasetypes = [] +d3d = [] +d3d10 = [] +d3d10_1 = [] +d3d10_1shader = [] +d3d10effect = [] +d3d10misc = [] +d3d10sdklayers = [] +d3d10shader = [] +d3d11 = [] +d3d11_1 = [] +d3d11_2 = [] +d3d11_3 = [] +d3d11_4 = [] +d3d11on12 = [] +d3d11sdklayers = [] +d3d11shader = [] +d3d12 = [] +d3d12sdklayers = [] +d3d12shader = [] +d3d9 = [] +d3d9caps = [] +d3d9types = [] +d3dcommon = [] +d3dcompiler = [] +d3dcsx = [] +d3dx10core = [] +d3dx10math = [] +d3dx10mesh = [] +datetimeapi = [] +davclnt = [] +dbghelp = [] +dcommon = [] +dcomp = [] +dcompanimation = [] +dcomptypes = [] +dde = [] +ddraw = [] +ddrawi = [] +ddrawint = [] +debug = [] +debugapi = [] +devguid = [] +devpkey = [] +devpropdef = [] +dinput = [] +dinputd = [] +dmksctl = [] +dmusicc = [] +docobj = [] +documenttarget = [] +dpa_dsa = [] +dpapi = [] +dsgetdc = [] +dsound = [] +dsrole = [] +dvp = [] +dwmapi = [] +dwrite = [] +dwrite_1 = [] +dwrite_2 = [] +dwrite_3 = [] +dxdiag = [] +dxfile = [] +dxgi = [] +dxgi1_2 = [] +dxgi1_3 = [] +dxgi1_4 = [] +dxgi1_5 = [] +dxgidebug = [] +dxgiformat = [] +dxgitype = [] +errhandlingapi = [] +everything = [] +excpt = [] +fibersapi = [] +fileapi = [] +gl-gl = [] +guiddef = [] +handleapi = [] +heapapi = [] +hidclass = [] +hidpi = [] +hidsdi = [] +hidusage = [] +hstring = [] +http = [] +imm = [] +in6addr = [] +inaddr = [] +inspectable = [] +interlockedapi = [] +intsafe = [] +ioapiset = [] +jobapi = [] +jobapi2 = [] +knownfolders = [] +ksmedia = [] +ktmtypes = [] +ktmw32 = [] +libloaderapi = [] +limits = [] +lmaccess = [] +lmalert = [] +lmapibuf = [] +lmat = [] +lmcons = [] +lmdfs = [] +lmerrlog = [] +lmjoin = [] +lmmsg = [] +lmremutl = [] +lmrepl = [] +lmserver = [] +lmshare = [] +lmstats = [] +lmsvc = [] +lmuse = [] +lmwksta = [] +lsalookup = [] +memoryapi = [] +minschannel = [] +minwinbase = [] +minwindef = [] +mmdeviceapi = [] +mmeapi = [] +mmreg = [] +mmsystem = [] +msaatext = [] +mscat = [] +mssip = [] +mstcpip = [] +namedpipeapi = [] +namespaceapi = [] +nb30 = [] +ncrypt = [] +ntddscsi = [] +ntddser = [] +ntdef = [] +ntsecapi = [] +ntstatus = [] +oaidl = [] +objbase = [] +objidl = [] +objidlbase = [] +ocidl = [] +oleauto = [] +olectl = [] +pdh = [] +playsoundapi = [] +powerbase = [] +powersetting = [] +powrprof = [] +processenv = [] +processsnapshot = [] +processthreadsapi = [] +processtopologyapi = [] +profileapi = [] +propidl = [] +propkeydef = [] +propsys = [] +prsht = [] +psapi = [] +qos = [] +realtimeapiset = [] +reason = [] +restrictederrorinfo = [] +rmxfguid = [] +roapi = [] +robuffer = [] +roerrorapi = [] +rpc = [] +rpcdce = [] +rpcndr = [] +sapi = [] +sapi51 = [] +sapi53 = [] +sapiddk = [] +sapiddk51 = [] +schannel = [] +securityappcontainer = [] +securitybaseapi = [] +servprov = [] +setupapi = [] +shellapi = [] +shellscalingapi = [] +shlobj = [] +shobjidl = [] +shobjidl_core = [] +shtypes = [] +spapidef = [] +sporder = [] +sql = [] +sqlext = [] +sqltypes = [] +sqlucode = [] +sspi = [] +std = [] +stralign = [] +stringapiset = [] +strmif = [] +subauth = [] +synchapi = [] +sysinfoapi = [] +systemtopologyapi = [] +textstor = [] +threadpoolapiset = [] +threadpoollegacyapiset = [] +timeapi = [] +timezoneapi = [] +tlhelp32 = [] +unknwnbase = [] +urlhist = [] +urlmon = [] +usb = [] +usbiodef = [] +usbspec = [] +userenv = [] +usp10 = [] +utilapiset = [] +vadefs = [] +vcruntime = [] +vsbackup = [] +vss = [] +vsserror = [] +vswriter = [] +werapi = [] +winbase = [] +wincodec = [] +wincodecsdk = [] +wincon = [] +wincred = [] +wincrypt = [] +windef = [] +windowsceip = [] +windowsx = [] +winerror = [] +winevt = [] +wingdi = [] +winhttp = [] +wininet = [] +winineti = [] +winioctl = [] +winnetwk = [] +winnls = [] +winnt = [] +winreg = [] +winscard = [] +winsmcrd = [] +winsock2 = [] +winspool = [] +winstring = [] +winsvc = [] +winusb = [] +winusbio = [] +winuser = [] +winver = [] +wnnc = [] +wow64apiset = [] +ws2def = [] +ws2ipdef = [] +ws2spi = [] +ws2tcpip = [] +wtypes = [] +wtypesbase = [] +xinput = [] +[target.i686-pc-windows-gnu.dependencies.winapi-i686-pc-windows-gnu] +version = "0.4" +[target.x86_64-pc-windows-gnu.dependencies.winapi-x86_64-pc-windows-gnu] +version = "0.4" +[badges.appveyor] +branch = "0.3" +repository = "retep998/winapi-rs" +service = "github" + +[badges.travis-ci] +branch = "0.3" +repository = "retep998/winapi-rs" diff --git a/src/vendor/winapi/Cargo.toml.orig b/src/vendor/winapi/Cargo.toml.orig new file mode 100644 index 0000000000..4d981656c8 --- /dev/null +++ b/src/vendor/winapi/Cargo.toml.orig @@ -0,0 +1,327 @@ +[package] +name = "winapi" +version = "0.3.4" +authors = ["Peter Atashian "] +license = "MIT/Apache-2.0" +description = "Raw FFI bindings for all of Windows API." +documentation = "https://docs.rs/winapi/*/x86_64-pc-windows-msvc/winapi/" +repository = "https://github.com/retep998/winapi-rs" +readme = "README.md" +keywords = ["windows", "ffi", "win32", "com", "directx"] +categories = ["external-ffi-bindings", "no-std", "os::windows-apis"] +include = ["/src/**/*", "/Cargo.toml", "/LICENSE-MIT", "/LICENSE-APACHE", "/build.rs", "/README.md"] +build = "build.rs" + +[package.metadata.docs.rs] +features = ["everything"] +default-target = "x86_64-pc-windows-msvc" + +[badges] +travis-ci = { repository = "retep998/winapi-rs", branch = "0.3" } +appveyor = { repository = "retep998/winapi-rs", branch = "0.3", service = "github" } + +[target.i686-pc-windows-gnu.dependencies] +winapi-i686-pc-windows-gnu = { version = "0.4", path = "i686" } +[target.x86_64-pc-windows-gnu.dependencies] +winapi-x86_64-pc-windows-gnu = { version = "0.4", path = "x86_64" } + +[features] +debug = [] +everything = [] +std = [] +#km +#mmos +#shared +basetsd = [] +bcrypt = [] +bugcodes = [] +cderr = [] +cfg = [] +d3d9 = [] +d3d9caps = [] +d3d9types = [] +dcomptypes = [] +devguid = [] +devpkey = [] +devpropdef = [] +dinputd = [] +dxgi = [] +dxgi1_2 = [] +dxgi1_3 = [] +dxgi1_4 = [] +dxgi1_5 = [] +dxgiformat = [] +dxgitype = [] +guiddef = [] +hidclass = [] +hidpi = [] +hidsdi = [] +hidusage = [] +in6addr = [] +inaddr = [] +intsafe = [] +ksmedia = [] +ktmtypes = [] +lmcons = [] +minwindef = [] +mmreg = [] +mstcpip = [] +ntddscsi = [] +ntddser = [] +ntdef = [] +ntstatus = [] +qos = [] +rpc = [] +rpcdce = [] +rpcndr = [] +sspi = [] +stralign = [] +usb = [] +usbiodef = [] +usbspec = [] +windef = [] +windowsx = [] +winerror = [] +winusbio = [] +wnnc = [] +ws2def = [] +ws2ipdef = [] +wtypes = [] +wtypesbase = [] +#ucrt +#um +audioclient = [] +audiosessiontypes = [] +avrt = [] +cfgmgr32 = [] +cguid = [] +combaseapi = [] +coml2api = [] +commapi = [] +commctrl = [] +commdlg = [] +commoncontrols = [] +consoleapi = [] +corsym = [] +d2d1 = [] +d2d1_1 = [] +d2d1_2 = [] +d2d1effectauthor = [] +d2d1effects = [] +d2d1effects_1 = [] +d2d1effects_2 = [] +d2dbasetypes = [] +d3d = [] +d3d10 = [] +d3d10_1 = [] +d3d10_1shader = [] +d3d10effect = [] +d3d10misc = [] +d3d10sdklayers = [] +d3d10shader = [] +d3d11 = [] +d3d11_1 = [] +d3d11_2 = [] +d3d11_3 = [] +d3d11_4 = [] +d3d11on12 = [] +d3d11sdklayers = [] +d3d11shader = [] +d3d12 = [] +d3d12sdklayers = [] +d3d12shader = [] +d3dcommon = [] +d3dcompiler = [] +d3dcsx = [] +d3dx10core = [] +d3dx10math = [] +d3dx10mesh = [] +datetimeapi = [] +davclnt = [] +dbghelp = [] +dcommon = [] +dcomp = [] +dcompanimation = [] +dde = [] +ddraw = [] +ddrawi = [] +ddrawint = [] +debugapi = [] +dinput = [] +dmksctl = [] +dmusicc = [] +docobj = [] +documenttarget = [] +dpa_dsa = [] +dpapi = [] +dsgetdc = [] +dsound = [] +dsrole = [] +dvp = [] +dwmapi = [] +dwrite = [] +dwrite_1 = [] +dwrite_2 = [] +dwrite_3 = [] +dxdiag = [] +dxfile = [] +dxgidebug = [] +errhandlingapi = [] +fibersapi = [] +fileapi = [] +"gl-gl" = [] +handleapi = [] +heapapi = [] +http = [] +imm = [] +interlockedapi = [] +ioapiset = [] +jobapi = [] +jobapi2 = [] +knownfolders = [] +ktmw32 = [] +libloaderapi = [] +lmaccess = [] +lmalert = [] +lmapibuf = [] +lmat = [] +lmdfs = [] +lmerrlog = [] +lmjoin = [] +lmmsg = [] +lmremutl = [] +lmrepl = [] +lmserver = [] +lmshare = [] +lmstats = [] +lmsvc = [] +lmuse = [] +lmwksta = [] +lsalookup = [] +memoryapi = [] +minschannel = [] +minwinbase = [] +mmdeviceapi = [] +mmeapi = [] +mmsystem = [] +msaatext = [] +mscat = [] +mssip = [] +namedpipeapi = [] +namespaceapi = [] +nb30 = [] +ncrypt = [] +ntsecapi = [] +oaidl = [] +objbase = [] +objidl = [] +objidlbase = [] +ocidl = [] +oleauto = [] +olectl = [] +pdh = [] +playsoundapi = [] +powerbase = [] +powersetting = [] +powrprof = [] +processenv = [] +processsnapshot = [] +processthreadsapi = [] +processtopologyapi = [] +profileapi = [] +propidl = [] +propkeydef = [] +propsys = [] +prsht = [] +psapi = [] +realtimeapiset = [] +reason = [] +restrictederrorinfo = [] +rmxfguid = [] +sapi = [] +sapi51 = [] +sapi53 = [] +sapiddk = [] +sapiddk51 = [] +schannel = [] +securityappcontainer = [] +securitybaseapi = [] +servprov = [] +setupapi = [] +shellapi = [] +shellscalingapi = [] +shlobj = [] +shobjidl = [] +shobjidl_core = [] +shtypes = [] +spapidef = [] +sporder = [] +sql = [] +sqlext = [] +sqltypes = [] +sqlucode = [] +stringapiset = [] +strmif = [] +subauth = [] +synchapi = [] +sysinfoapi = [] +systemtopologyapi = [] +textstor = [] +threadpoolapiset = [] +threadpoollegacyapiset = [] +timeapi = [] +timezoneapi = [] +tlhelp32 = [] +unknwnbase = [] +urlhist = [] +urlmon = [] +userenv = [] +usp10 = [] +utilapiset = [] +vsbackup = [] +vss = [] +vsserror = [] +vswriter = [] +werapi = [] +winbase = [] +wincodec = [] +wincodecsdk = [] +wincon = [] +wincred = [] +wincrypt = [] +windowsceip = [] +winevt = [] +wingdi = [] +winhttp = [] +wininet = [] +winineti = [] +winioctl = [] +winnetwk = [] +winnls = [] +winnt = [] +winreg = [] +winscard = [] +winsmcrd = [] +winsock2 = [] +winspool = [] +winsvc = [] +winusb = [] +winuser = [] +winver = [] +wow64apiset = [] +ws2spi = [] +ws2tcpip = [] +xinput = [] +#vc +excpt = [] +limits = [] +vadefs = [] +vcruntime = [] +#winrt +activation = [] +hstring = [] +inspectable = [] +roapi = [] +robuffer = [] +roerrorapi = [] +winstring = [] diff --git a/src/vendor/winapi/LICENSE-APACHE b/src/vendor/winapi/LICENSE-APACHE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/src/vendor/winapi/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/vendor/winapi/LICENSE-MIT b/src/vendor/winapi/LICENSE-MIT new file mode 100644 index 0000000000..796e929aa5 --- /dev/null +++ b/src/vendor/winapi/LICENSE-MIT @@ -0,0 +1,19 @@ +Copyright (c) 2015 The winapi-rs Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/vendor/winapi/README.md b/src/vendor/winapi/README.md new file mode 100644 index 0000000000..a107ccecb0 --- /dev/null +++ b/src/vendor/winapi/README.md @@ -0,0 +1,65 @@ +# winapi-rs [![Build status](https://ci.appveyor.com/api/projects/status/i47oonf5e7qm5utq/branch/master?svg=true)](https://ci.appveyor.com/project/retep998/winapi-rs/branch/master) [![Build Status](https://travis-ci.org/retep998/winapi-rs.svg?branch=master)](https://travis-ci.org/retep998/winapi-rs) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/retep998/winapi-rs) [![Crates.io](https://img.shields.io/crates/v/winapi.svg)](https://crates.io/crates/winapi) ![Lines of Code](https://tokei.rs/b1/github/retep998/winapi-rs) ![100% unsafe](https://img.shields.io/badge/unsafe-100%25-blue.svg) # + +[Documentation](https://docs.rs/winapi/*/x86_64-pc-windows-msvc/winapi/) + +Official IRC channel: #winapi on [Mozilla IRC](https://wiki.mozilla.org/IRC) + +This crate provides raw FFI bindings to all of Windows API. They are gathered by hand using the Windows 10 SDK from Microsoft. I aim to replace all existing Windows FFI in other crates with this crate through the "[Embrace, extend, and extinguish](http://en.wikipedia.org/wiki/Embrace,_extend_and_extinguish)" technique. + +If this crate is missing something you need, feel free to create an issue, open a pull request, or contact me via [other means](http://www.rustaceans.org/retep998). + +This crate depends on Rust 1.6 or newer on Windows. On other platforms this crate is a no-op and should compile with Rust 1.2 or newer. + +## Frequently asked questions ## + +### How do I create an instance of a union? + +Use `std::mem::zeroed()` to create an instance of the union, and then assign the value you want using one of the variant methods. + +### Why am I getting errors about unresolved imports? + +Each module is gated on a feature flag, so you must enable the appropriate feature to gain access to those items. For example, if you want to use something from `winapi::um::winuser` you must enable the `winuser` feature. + +### How do I know which module an item is defined in? + +You can use the search functionality in the [documentation](https://docs.rs/winapi/*/x86_64-pc-windows-msvc/winapi/) to find where items are defined. + +### Why is there no documentation on how to use anything? + +This crate is nothing more than raw bindings to Windows API. If you wish to know how to use the various functionality in Windows API, you can look up the various items on [MSDN](https://msdn.microsoft.com/en-us/library/windows/desktop/aa906039) which is full of detailed documentation. + +## Example ## + +Cargo.toml: +```toml +[target.'cfg(windows)'.dependencies] +winapi = { version = "0.3", features = ["winuser"] } +``` +main.rs: +```Rust +#[cfg(windows)] extern crate winapi; +use std::io::Error; + +#[cfg(windows)] +fn print_message(msg: &str) -> Result { + use std::ffi::OsStr; + use std::iter::once; + use std::os::windows::ffi::OsStrExt; + use std::ptr::null_mut; + use winapi::um::winuser::{MB_OK, MessageBoxW}; + let wide: Vec = OsStr::new(msg).encode_wide().chain(once(0)).collect(); + let ret = unsafe { + MessageBoxW(null_mut(), wide.as_ptr(), wide.as_ptr(), MB_OK) + }; + if ret == 0 { Err(Error::last_os_error()) } + else { Ok(ret) } +} +#[cfg(not(windows))] +fn print_message(msg: &str) -> Result<(), Error> { + println!("{}", msg); + Ok(()) +} +fn main() { + print_message("Hello, world!").unwrap(); +} +``` diff --git a/src/vendor/winapi/build.rs b/src/vendor/winapi/build.rs new file mode 100644 index 0000000000..25925e5950 --- /dev/null +++ b/src/vendor/winapi/build.rs @@ -0,0 +1,412 @@ +// Copyright © 2016-2018 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use std::cell::Cell; +use std::collections::{HashMap, HashSet}; +use std::env::var; +// (header name, &[header dependencies], &[library dependencies]) +const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static str])] = &[ + // km + // mmos + // shared + ("basetsd", &[], &[]), + ("bcrypt", &["minwindef", "winnt"], &["bcrypt"]), + ("bugcodes", &["ntdef"], &[]), + ("cderr", &["minwindef"], &[]), + ("cfg", &["minwindef"], &[]), + ("d3d9", &["basetsd", "d3d9caps", "d3d9types", "guiddef", "minwindef", "unknwnbase", "windef", "wingdi", "winnt"], &["d3d9"]), + ("d3d9caps", &["d3d9types", "guiddef", "minwindef", "winnt"], &[]), + ("d3d9types", &["basetsd", "guiddef", "minwindef", "windef", "winnt"], &[]), + ("dcomptypes", &["dxgitype", "minwindef", "winnt"], &[]), + ("devguid", &[], &[]), + ("devpkey", &["devpropdef"], &[]), + ("devpropdef", &["guiddef", "minwindef", "winnt"], &[]), + ("dinputd", &[], &[]), + ("dxgi", &["basetsd", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["dxgi"]), + ("dxgi1_2", &["basetsd", "dxgi", "dxgiformat", "dxgitype", "guiddef", "minwinbase", "minwindef", "unknwnbase", "windef", "winnt"], &[]), + ("dxgi1_3", &["dxgi", "dxgi1_2", "dxgiformat", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["dxgi"]), + ("dxgi1_4", &["basetsd", "dxgi1_2", "dxgi1_3", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "winnt"], &[]), + ("dxgi1_5", &["basetsd", "dxgi", "dxgi1_2", "dxgi1_3", "dxgi1_4", "dxgiformat", "minwindef", "unknwnbase", "winnt"], &[]), + ("dxgiformat", &[], &[]), + ("dxgitype", &["d3d9types", "dxgiformat", "minwindef"], &[]), + ("guiddef", &[], &[]), + ("hidclass", &["guiddef", "minwindef", "winioctl", "winnt"], &[]), + ("hidpi", &["hidusage", "minwindef", "ntdef", "ntstatus", "winnt"], &["hid"]), + ("hidsdi", &["guiddef", "hidpi", "minwindef", "winnt"], &["hid"]), + ("hidusage", &["minwindef"], &[]), + ("in6addr", &["minwindef"], &[]), + ("inaddr", &["minwindef"], &[]), + ("intsafe", &[], &[]), + ("ksmedia", &[], &[]), + ("ktmtypes", &["guiddef", "minwindef", "winnt"], &[]), + ("lmcons", &["minwindef", "winnt"], &[]), + ("minwindef", &["basetsd", "ntdef"], &[]), + ("mmreg", &["guiddef", "minwindef"], &[]), + ("mstcpip", &["basetsd", "guiddef", "in6addr", "inaddr", "minwindef", "winnt", "ws2def"], &["ntdll"]), + ("ntddscsi", &["basetsd", "minwindef", "ntdef", "winioctl", "winnt"], &[]), + ("ntddser", &["devpropdef"], &[]), + ("ntdef", &["basetsd", "guiddef"], &[]), + ("ntstatus", &["ntdef"], &[]), + ("qos", &["minwindef"], &[]), + ("rpc", &[], &[]), + ("rpcdce", &["guiddef", "minwindef", "rpc"], &[]), + ("rpcndr", &[], &[]), + ("sspi", &["basetsd", "guiddef", "minwindef", "subauth", "wincred", "winnt"], &["credui", "secur32"]), + ("stralign", &["vcruntime", "winnt"], &["kernel32"]), + ("usb", &["minwindef", "usbspec", "winnt"], &[]), + ("usbiodef", &["guiddef", "minwindef", "winioctl", "winnt"], &[]), + ("usbspec", &["basetsd", "guiddef", "minwindef", "winnt"], &[]), + ("windef", &["minwindef", "winnt"], &[]), + ("windowsx", &["minwindef"], &[]), + ("winerror", &["minwindef"], &[]), + ("winusbio", &["minwindef", "usb"], &[]), + ("wnnc", &["minwindef"], &[]), + ("ws2def", &["basetsd", "guiddef", "inaddr", "minwindef", "vcruntime", "winnt"], &[]), + ("ws2ipdef", &["in6addr", "inaddr", "minwindef", "ws2def"], &[]), + ("wtypes", &["guiddef", "minwindef", "ntdef", "wtypesbase"], &[]), + ("wtypesbase", &["minwindef", "rpcndr", "winnt"], &[]), + // ucrt + // um + ("audioclient", &["audiosessiontypes", "basetsd", "guiddef", "minwindef", "mmreg", "strmif", "unknwnbase", "winerror", "winnt", "wtypesbase"], &[]), + ("audiosessiontypes", &["minwindef"], &[]), + ("avrt", &["guiddef", "minwindef", "winnt"], &["avrt"]), + ("cfgmgr32", &["basetsd", "cfg", "guiddef", "minwindef", "winnt", "winreg"], &["setupapi"]), + ("cguid", &[], &[]), + ("combaseapi", &["basetsd", "guiddef", "minwindef", "objidl", "objidlbase", "propidl", "rpcdce", "unknwnbase", "winnt", "wtypesbase"], &["ole32"]), + ("coml2api", &["minwindef"], &[]), + ("commapi", &["minwinbase", "minwindef", "winbase", "winnt"], &["kernel32"]), + ("commctrl", &["basetsd", "commoncontrols", "guiddef", "minwinbase", "minwindef", "vcruntime", "windef", "winnt", "winuser"], &["comctl32"]), + ("commdlg", &["basetsd", "minwindef", "prsht", "unknwnbase", "windef", "wingdi", "winnt", "winuser"], &["comdlg32"]), + ("commoncontrols", &["commctrl", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["comctl32"]), + ("consoleapi", &["minwindef", "wincon", "winnt"], &["kernel32"]), + ("corsym", &["basetsd", "objidlbase", "unknwnbase", "winnt"], &[]), + ("d2d1", &["basetsd", "d2dbasetypes", "d3dcommon", "dcommon", "dwrite", "dxgi", "guiddef", "minwindef", "unknwnbase", "wincodec", "windef", "winnt"], &["d2d1"]), + ("d2d1_1", &["basetsd", "d2d1", "d2d1effectauthor", "d2dbasetypes", "dcommon", "documenttarget", "dwrite", "dxgi", "dxgiformat", "guiddef", "minwindef", "objidlbase", "unknwnbase", "wincodec", "winnt"], &["d2d1"]), + ("d2d1_2", &["d2d1", "d2d1_1", "dxgi", "minwindef", "winnt"], &["d2d1"]), + ("d2d1effectauthor", &["basetsd", "minwindef", "ntdef", "unknwnbase"], &[]), + ("d2d1effects", &[], &[]), + ("d2d1effects_1", &[], &[]), + ("d2d1effects_2", &[], &[]), + ("d2dbasetypes", &["basetsd", "d3d9types", "minwindef", "windef"], &[]), + ("d3d", &[], &[]), + ("d3d10", &["d3dcommon"], &[]), + ("d3d10_1", &[], &[]), + ("d3d10_1shader", &[], &[]), + ("d3d10effect", &[], &[]), + ("d3d10misc", &[], &[]), + ("d3d10sdklayers", &[], &[]), + ("d3d10shader", &["d3d10", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]), + ("d3d11", &["basetsd", "d3dcommon", "dxgi", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["d3d11"]), + ("d3d11_1", &[], &[]), + ("d3d11_2", &[], &[]), + ("d3d11_3", &[], &[]), + ("d3d11_4", &[], &[]), + ("d3d11on12", &["d3d11", "d3d12", "d3dcommon", "guiddef", "minwindef", "unknwnbase", "winnt"], &["d3d11"]), + ("d3d11sdklayers", &[], &[]), + ("d3d11shader", &["basetsd", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]), + ("d3d12", &["basetsd", "d3dcommon", "dxgiformat", "dxgitype", "guiddef", "minwinbase", "minwindef", "unknwnbase", "windef", "winnt"], &["d3d12"]), + ("d3d12sdklayers", &["basetsd", "d3d12", "minwindef", "unknwnbase", "winnt"], &[]), + ("d3d12shader", &["basetsd", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]), + ("d3dcommon", &["basetsd", "minwindef", "unknwnbase", "winnt"], &[]), + ("d3dcompiler", &["basetsd", "d3d11shader", "d3dcommon", "guiddef", "minwindef", "winnt"], &["d3dcompiler"]), + ("d3dcsx", &[], &[]), + ("d3dx10core", &[], &[]), + ("d3dx10math", &[], &[]), + ("d3dx10mesh", &[], &[]), + ("datetimeapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("davclnt", &["minwindef", "winnt"], &["netapi32"]), + ("dbghelp", &["basetsd", "guiddef", "minwindef", "vcruntime", "winnt"], &["dbghelp"]), + ("dcommon", &["dxgiformat"], &[]), + ("dcomp", &["d2d1", "d2d1_1", "d2d1effects", "d2dbasetypes", "d3d9types", "d3dcommon", "dcompanimation", "dcomptypes", "dxgi", "dxgi1_2", "dxgiformat", "guiddef", "minwinbase", "minwindef", "ntdef", "unknwnbase", "windef"], &["dcomp"]), + ("dcompanimation", &["ntdef", "unknwnbase"], &[]), + ("dde", &["basetsd", "minwindef"], &["user32"]), + ("ddraw", &[], &[]), + ("ddrawi", &[], &[]), + ("ddrawint", &[], &[]), + ("debugapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("dinput", &[], &[]), + ("dmksctl", &[], &[]), + ("dmusicc", &[], &[]), + ("docobj", &["guiddef", "minwindef", "oaidl", "unknwnbase", "winnt"], &[]), + ("documenttarget", &["basetsd", "guiddef", "ntdef", "unknwnbase"], &[]), + ("dpa_dsa", &["basetsd", "minwindef", "winnt"], &["comctl32"]), + ("dpapi", &["minwindef", "wincrypt", "windef", "winnt"], &["crypt32"]), + ("dsgetdc", &["guiddef", "minwindef", "ntsecapi", "winnt", "ws2def"], &["netapi32"]), + ("dsound", &["guiddef", "minwindef", "mmsystem", "unknwnbase", "windef", "winerror", "winnt"], &["dsound"]), + ("dsrole", &["guiddef", "minwindef", "winnt"], &["netapi32"]), + ("dvp", &[], &[]), + ("dwmapi", &["minwindef", "windef", "winnt"], &["dwmapi"]), + ("dwrite", &["basetsd", "d2d1", "dcommon", "guiddef", "minwindef", "unknwnbase", "windef", "winerror", "wingdi", "winnt"], &["dwrite"]), + ("dwrite_1", &["basetsd", "dcommon", "dwrite", "minwindef", "winnt"], &[]), + ("dwrite_2", &["basetsd", "d3d9types", "dcommon", "dwrite", "dwrite_1", "minwindef", "unknwnbase", "winnt"], &[]), + ("dwrite_3", &["basetsd", "dcommon", "dwrite", "dwrite_1", "dwrite_2", "minwindef", "unknwnbase", "wingdi", "winnt"], &[]), + ("dxdiag", &[], &[]), + ("dxfile", &[], &[]), + ("dxgidebug", &[], &[]), + ("errhandlingapi", &["basetsd", "minwindef", "winnt"], &["kernel32"]), + ("fibersapi", &["minwindef", "winnt"], &["kernel32"]), + ("fileapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("gl-gl", &[], &["opengl32"]), + ("handleapi", &["minwindef", "winnt"], &["kernel32"]), + ("heapapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("http", &["guiddef", "minwinbase", "minwindef", "sspi", "winnt", "ws2def"], &["winhttp"]), + ("imm", &[], &[]), + ("interlockedapi", &["minwindef", "winnt"], &["kernel32"]), + ("ioapiset", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("jobapi", &["minwindef", "winnt"], &["kernel32"]), + ("jobapi2", &["basetsd", "minwinbase", "minwindef", "ntdef", "winnt"], &["kernel32"]), + ("knownfolders", &[], &[]), + ("ktmw32", &["guiddef", "minwinbase", "minwindef", "winnt"], &["ktmw32"]), + ("libloaderapi", &["basetsd", "minwindef", "winnt"], &["kernel32", "user32"]), + ("lmaccess", &["basetsd", "lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmalert", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmapibuf", &["lmcons", "minwindef"], &["netapi32"]), + ("lmat", &["basetsd", "lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmdfs", &["guiddef", "lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmerrlog", &["minwindef", "winnt"], &[]), + ("lmjoin", &["lmcons", "minwindef", "wincrypt", "winnt"], &["netapi32"]), + ("lmmsg", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmremutl", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmrepl", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmserver", &["guiddef", "lmcons", "minwindef", "winnt", "winsvc"], &["advapi32", "netapi32"]), + ("lmshare", &["basetsd", "guiddef", "lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmstats", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmsvc", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmuse", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lmwksta", &["lmcons", "minwindef", "winnt"], &["netapi32"]), + ("lsalookup", &["guiddef", "minwindef", "winnt"], &[]), + ("memoryapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("minschannel", &["guiddef", "minwindef", "wincrypt", "winnt"], &[]), + ("minwinbase", &["basetsd", "minwindef", "ntstatus", "winnt"], &[]), + ("mmdeviceapi", &["guiddef", "minwindef", "propidl", "propsys", "unknwnbase", "winnt", "wtypes"], &["mmdevapi"]), + ("mmeapi", &["basetsd", "imm", "minwindef", "mmsystem", "winnt"], &["winmm"]), + ("mmsystem", &["basetsd", "minwindef", "mmreg", "winnt"], &[]), + ("msaatext", &[], &[]), + ("mscat", &["guiddef", "minwindef", "mssip", "wincrypt", "winnt"], &[]), + ("mssip", &["guiddef", "minwindef", "mscat", "wincrypt", "winnt"], &["crypt32"]), + ("namedpipeapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("namespaceapi", &["minwinbase", "minwindef", "ntdef", "winnt"], &["kernel32"]), + ("nb30", &["minwindef", "winnt"], &["netapi32"]), + ("ncrypt", &["basetsd", "sspi"], &["ncrypt"]), + ("ntsecapi", &["basetsd", "guiddef", "lsalookup", "minwindef", "ntdef", "sspi", "subauth", "winnt"], &["advapi32"]), + ("oaidl", &["basetsd", "guiddef", "minwindef", "rpcndr", "unknwnbase", "winnt", "wtypes", "wtypesbase"], &[]), + ("objbase", &["combaseapi", "minwindef", "winnt"], &["ole32"]), + ("objidl", &["basetsd", "guiddef", "minwindef", "objidlbase", "unknwnbase", "winnt", "wtypesbase"], &[]), + ("objidlbase", &["basetsd", "guiddef", "minwindef", "unknwnbase", "winnt", "wtypesbase"], &[]), + ("ocidl", &["guiddef", "minwindef", "ntdef", "oaidl", "unknwnbase", "wtypes", "wtypesbase"], &[]), + ("oleauto", &["basetsd", "minwinbase", "minwindef", "oaidl", "winnt", "wtypes", "wtypesbase"], &["oleaut32"]), + ("olectl", &["winerror", "winnt"], &[]), + ("pdh", &["basetsd", "guiddef", "minwindef", "windef", "winnt"], &["pdh"]), + ("playsoundapi", &["minwindef", "winnt"], &["winmm"]), + ("powerbase", &["minwindef", "winnt", "winuser"], &["powrprof"]), + ("powersetting", &["guiddef", "minwindef", "winnt", "winuser"], &["powrprof"]), + ("powrprof", &["guiddef", "minwindef", "winnt", "winreg"], &["powrprof"]), + ("processenv", &["minwindef", "winnt"], &["kernel32"]), + ("processsnapshot", &["basetsd", "minwindef", "winnt"], &["kernel32"]), + ("processthreadsapi", &["basetsd", "guiddef", "minwinbase", "minwindef", "winnt"], &["advapi32", "kernel32"]), + ("processtopologyapi", &["minwindef", "winnt"], &["kernel32"]), + ("profileapi", &["minwindef", "winnt"], &["kernel32"]), + ("propidl", &["minwindef", "wtypes"], &[]), + ("propkeydef", &["guiddef", "wtypes"], &[]), + ("propsys", &["minwindef", "propidl", "propkeydef", "unknwnbase", "winnt", "wtypes"], &[]), + ("prsht", &["basetsd", "minwindef", "windef", "winnt", "winuser"], &["comctl32"]), + ("psapi", &["basetsd", "minwindef", "winnt"], &["kernel32", "psapi"]), + ("realtimeapiset", &["basetsd", "minwindef", "winnt"], &["kernel32"]), + ("reason", &["minwindef"], &[]), + ("restrictederrorinfo", &["unknwnbase", "winnt", "wtypes"], &[]), + ("rmxfguid", &[], &[]), + ("sapi", &["guiddef", "minwindef", "sapi53", "unknwnbase", "winnt"], &[]), + ("sapi51", &["guiddef", "minwindef", "mmreg", "oaidl", "objidlbase", "rpcndr", "servprov", "unknwnbase", "windef", "winnt", "wtypes", "wtypesbase"], &[]), + ("sapi53", &["guiddef", "minwindef", "oaidl", "sapi51", "unknwnbase", "urlmon", "winnt", "wtypes"], &[]), + ("sapiddk", &["guiddef", "minwindef", "sapi", "sapiddk51", "unknwnbase", "winnt"], &[]), + ("sapiddk51", &["guiddef", "minwindef", "mmreg", "oaidl", "objidlbase", "sapi", "unknwnbase", "windef", "winnt"], &[]), + ("schannel", &["guiddef", "minwindef", "wincrypt", "windef", "winnt"], &[]), + ("securityappcontainer", &["minwindef", "winnt"], &["kernel32"]), + ("securitybaseapi", &["minwindef", "winnt"], &["advapi32", "kernel32"]), + ("servprov", &["guiddef", "unknwnbase", "winnt"], &[]), + ("setupapi", &["basetsd", "commctrl", "devpropdef", "guiddef", "minwindef", "prsht", "spapidef", "windef", "winnt", "winreg"], &["setupapi"]), + ("shellapi", &["basetsd", "guiddef", "minwinbase", "minwindef", "processthreadsapi", "windef", "winnt", "winuser"], &["shell32", "shlwapi"]), + ("shellscalingapi", &["minwindef", "windef", "winnt"], &["shcore"]), + ("shlobj", &["guiddef", "minwinbase", "minwindef", "shtypes", "windef", "winnt"], &["shell32"]), + ("shobjidl", &["guiddef", "minwindef", "objidl", "propkeydef", "propsys", "shobjidl_core", "shtypes", "unknwnbase", "windef", "winnt"], &[]), + ("shobjidl_core", &["guiddef", "minwindef", "objidl", "unknwnbase", "windef", "winnt"], &[]), + ("shtypes", &["guiddef", "minwindef", "winnt"], &[]), + ("spapidef", &["minwindef", "winnt"], &[]), + ("sporder", &["guiddef", "minwindef"], &["sporder"]), + ("sql", &["sqltypes"], &["odbc32"]), + ("sqlext", &["sql", "sqltypes"], &[]), + ("sqltypes", &["basetsd", "guiddef", "windef"], &[]), + ("sqlucode", &["sqltypes"], &["odbc32"]), + ("stringapiset", &["minwindef", "winnls", "winnt"], &["kernel32"]), + ("strmif", &["winnt"], &[]), + ("subauth", &["minwindef", "winnt"], &[]), + ("synchapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32", "synchronization"]), + ("sysinfoapi", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("systemtopologyapi", &["minwindef", "winnt"], &["kernel32"]), + ("textstor", &[], &[]), + ("threadpoolapiset", &["basetsd", "minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("threadpoollegacyapiset", &["minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("timeapi", &["minwindef", "mmsystem"], &["winmm"]), + ("timezoneapi", &["minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("tlhelp32", &["basetsd", "minwindef", "winnt"], &["kernel32"]), + ("unknwnbase", &["guiddef", "minwindef", "winnt"], &[]), + ("urlhist", &["docobj", "guiddef", "minwindef", "unknwnbase", "winnt", "wtypesbase"], &[]), + ("urlmon", &["minwindef", "unknwnbase", "winnt"], &[]), + ("userenv", &["minwindef", "winnt"], &["userenv"]), + ("usp10", &["minwindef", "ntdef", "windef", "winerror", "wingdi", "winnt"], &["usp10"]), + ("utilapiset", &["minwindef", "ntdef"], &["kernel32"]), + ("vsbackup", &["guiddef", "minwindef", "unknwnbase", "vss", "vswriter", "winnt", "wtypes"], &["vssapi"]), + ("vss", &["guiddef", "minwindef", "unknwnbase", "winnt"], &[]), + ("vsserror", &["winnt"], &[]), + ("vswriter", &["minwindef", "unknwnbase", "vss", "winnt", "wtypes"], &[]), + ("werapi", &["minwindef", "winnt"], &["kernel32"]), + ("winbase", &["basetsd", "cfgmgr32", "fileapi", "guiddef", "libloaderapi", "minwinbase", "minwindef", "processthreadsapi", "vadefs", "windef", "winnt"], &["kernel32"]), + ("wincodec", &["basetsd", "d2d1", "d2d1_1", "dcommon", "dxgiformat", "dxgitype", "guiddef", "minwindef", "ntdef", "objidlbase", "ocidl", "propidl", "unknwnbase", "windef", "winerror", "winnt"], &["windowscodecs"]), + ("wincodecsdk", &["guiddef", "minwindef", "oaidl", "objidl", "objidlbase", "ocidl", "propidl", "unknwnbase", "wincodec", "winnt", "wtypes"], &["ole32", "oleaut32", "windowscodecs"]), + ("wincon", &["minwinbase", "minwindef", "windef", "wingdi", "winnt"], &["kernel32"]), + ("wincred", &["minwindef", "sspi", "windef", "winnt"], &["advapi32", "credui"]), + ("wincrypt", &["basetsd", "bcrypt", "guiddef", "minwinbase", "minwindef", "ncrypt", "vcruntime", "winnt"], &["advapi32", "crypt32", "cryptnet"]), + ("windowsceip", &["minwindef"], &["kernel32"]), + ("winevt", &["basetsd", "guiddef", "minwinbase", "minwindef", "vcruntime", "winnt"], &["wevtapi"]), + ("wingdi", &["basetsd", "minwindef", "windef", "winnt"], &["gdi32", "msimg32", "opengl32", "winspool"]), + ("winhttp", &["basetsd", "minwinbase", "minwindef", "winnt"], &["winhttp"]), + ("wininet", &["basetsd", "minwinbase", "minwindef", "ntdef", "windef", "winineti", "winnt"], &["wininet"]), + ("winineti", &["minwindef"], &[]), + ("winioctl", &["devpropdef", "minwindef", "winnt"], &[]), + ("winnetwk", &["basetsd", "minwindef", "windef", "winerror", "winnt"], &["mpr"]), + ("winnls", &["basetsd", "guiddef", "minwinbase", "minwindef", "winnt"], &["kernel32"]), + ("winnt", &["basetsd", "excpt", "guiddef", "ktmtypes", "minwindef", "vcruntime"], &["kernel32"]), + ("winreg", &["basetsd", "minwinbase", "minwindef", "winnt"], &["advapi32"]), + ("winscard", &["basetsd", "guiddef", "minwindef", "rpcdce", "windef", "winnt", "winsmcrd"], &["winscard"]), + ("winsmcrd", &["minwindef", "winioctl"], &[]), + ("winsock2", &["basetsd", "guiddef", "inaddr", "minwinbase", "minwindef", "qos", "winbase", "windef", "winerror", "winnt", "ws2def", "wtypesbase"], &["ws2_32"]), + ("winspool", &["guiddef", "minwinbase", "minwindef", "vcruntime", "windef", "winerror", "wingdi", "winnt"], &["winspool"]), + ("winsvc", &["minwindef", "winnt"], &["advapi32"]), + ("winusb", &["minwinbase", "minwindef", "usb", "usbspec", "winnt", "winusbio"], &["winusb"]), + ("winuser", &["basetsd", "guiddef", "limits", "minwinbase", "minwindef", "vadefs", "windef", "wingdi", "winnt"], &["user32"]), + ("winver", &["minwindef", "winnt"], &["kernel32", "version"]), + ("wow64apiset", &["minwindef", "winnt"], &["kernel32"]), + ("ws2spi", &["basetsd", "guiddef", "minwindef", "vcruntime", "windef", "winnt", "winsock2", "ws2def", "wtypesbase"], &["ws2_32"]), + ("ws2tcpip", &["guiddef", "minwinbase", "minwindef", "mstcpip", "vcruntime", "winerror", "winnt", "winsock2", "ws2def", "wtypesbase"], &["fwpuclnt", "ws2_32"]), + ("xinput", &["guiddef", "minwindef", "winnt"], &["xinput"]), + // vc + ("excpt", &[], &[]), + ("limits", &[], &[]), + ("vadefs", &[], &[]), + ("vcruntime", &[], &[]), + // winrt + ("activation", &["inspectable", "winnt"], &[]), + ("hstring", &["winnt"], &[]), + ("inspectable", &["guiddef", "hstring", "minwindef", "unknwnbase", "winnt"], &[]), + ("roapi", &["activation", "basetsd", "guiddef", "hstring", "inspectable", "objidl", "winnt"], &["runtimeobject"]), + ("robuffer", &["objidl", "winnt"], &["runtimeobject"]), + ("roerrorapi", &["basetsd", "hstring", "minwindef", "restrictederrorinfo", "unknwnbase", "winnt"], &["runtimeobject"]), + ("winstring", &["basetsd", "hstring", "minwindef", "winnt"], &["runtimeobject"]), +]; +struct Header { + required: bool, + included: Cell, + dependencies: &'static [&'static str], + libraries: &'static [&'static str], +} +struct Graph(HashMap<&'static str, Header>); +impl Graph { + fn generate() -> Graph { + Graph(DATA.iter().map(|&(name, dependencies, libraries)| { + let header = Header { + required: false, + included: Cell::new(false), + dependencies: dependencies, + libraries: libraries, + }; + (name, header) + }).collect()) + } + fn identify_required(&mut self) { + for (name, header) in &mut self.0 { + if let Ok(_) = var(&format!("CARGO_FEATURE_{}", name.to_uppercase())) { + header.required = true; + header.included.set(true); + } + } + } + fn check_everything(&self) { + if let Ok(_) = var("CARGO_FEATURE_EVERYTHING") { + for (_, header) in &self.0 { + header.included.set(true); + } + } + } + fn resolve_dependencies(&self) { + let mut done = false; + while !done { + done = true; + for (_, header) in &self.0 { + if header.included.get() { + for dep in header.dependencies { + let dep = &self.0.get(dep).expect(dep); + if !dep.included.get() { + done = false; + dep.included.set(true); + } + } + } + } + } + } + fn emit_features(&self) { + for (name, header) in &self.0 { + if header.included.get() && !header.required { + println!("cargo:rustc-cfg=feature=\"{}\"", name); + } + } + } + fn emit_libraries(&self) { + let libs = self.0.iter().filter(|&(_, header)| { + header.included.get() + }).flat_map(|(_, header)| { + header.libraries.iter() + }).collect::>(); + let prefix = library_prefix(); + let kind = library_kind(); + for lib in libs { + println!("cargo:rustc-link-lib={}={}{}", kind, prefix, lib); + } + } +} +fn library_prefix() -> &'static str { + if var("TARGET").map(|target| + target == "i686-pc-windows-gnu" || target == "x86_64-pc-windows-gnu" + ).unwrap_or(false) && var("WINAPI_NO_BUNDLED_LIBRARIES").is_err() { + "winapi_" + } else { + "" + } +} +fn library_kind() -> &'static str { + if var("WINAPI_STATIC_NOBUNDLE").is_ok() { + "static-nobundle" + } else { + "dylib" + } +} +fn try_everything() { + let mut graph = Graph::generate(); + graph.identify_required(); + graph.check_everything(); + graph.resolve_dependencies(); + graph.emit_features(); + graph.emit_libraries(); +} +fn main() { + println!("cargo:rerun-if-env-changed=WINAPI_NO_BUNDLED_LIBRARIES"); + println!("cargo:rerun-if-env-changed=WINAPI_STATIC_NOBUNDLE"); + let target = var("TARGET").unwrap(); + let target: Vec<_> = target.split('-').collect(); + if target.get(2) == Some(&"windows") { + try_everything(); + } +} diff --git a/src/vendor/winapi/src/lib.rs b/src/vendor/winapi/src/lib.rs index 0e99f815a8..8a82f8b8f2 100644 --- a/src/vendor/winapi/src/lib.rs +++ b/src/vendor/winapi/src/lib.rs @@ -1,368 +1,59 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Types and constants for WinAPI bindings. -#![allow(bad_style)] -#![warn(trivial_casts, trivial_numeric_casts)] -#![warn(unused_qualifications, unused)] +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. #![cfg(windows)] -//------------------------------------------------------------------------------------------------- -// Imports -//------------------------------------------------------------------------------------------------- -pub use std::os::raw::{ - c_void, - c_char, - c_schar, - c_uchar, - c_short, - c_ushort, - c_int, - c_uint, - c_long, - c_ulong, - c_longlong, - c_ulonglong, - c_float, - c_double, -}; -pub use activation::*; -pub use audioclient::*; -pub use audiosessiontypes::*; -pub use basetsd::*; -pub use bcrypt::*; -pub use cfg::*; -pub use cfgmgr32::*; -pub use combaseapi::*; -pub use commctrl::*; -pub use commdlg::*; -pub use corsym::*; -pub use d2d1::*; -pub use d2dbasetypes::*; -pub use d3d9::*; -pub use d3d9caps::*; -pub use d3d9types::*; -pub use d3d11::*; -pub use d3d10shader::*; -pub use d3d11shader::*; -pub use d3d12::*; -pub use d3d12sdklayers::*; -pub use d3d12shader::*; -pub use d3dcommon::*; -pub use d3dcompiler::*; -pub use dbghelp::*; -pub use dcommon::*; -pub use devpropdef::*; -pub use docobj::*; -pub use dpapi::*; -pub use dsgetdc::*; -pub use dsound::*; -pub use dsrole::*; -pub use dwmapi::*; -pub use dwrite::*; -pub use dxgi::*; -pub use dxgi1_2::*; -pub use dxgi1_3::*; -pub use dxgi1_4::*; -pub use dxgiformat::*; -pub use dxgitype::*; -pub use errhandlingapi::*; -pub use excpt::*; -pub use fileapi::*; -pub use gl::*; -pub use guiddef::*; -pub use heapapi::*; -pub use hidclass::*; -pub use hidpi::*; -pub use hidsdi::*; -pub use hidusage::*; -pub use hstring::*; -pub use http::*; -pub use imm::*; -pub use inaddr::*; -pub use inspectable::*; -pub use ksmedia::*; -pub use libloaderapi::*; -pub use lmaccess::*; -pub use lmcons::*; -pub use lmdfs::*; -pub use lmerrlog::*; -pub use lmjoin::*; -pub use lsalookup::*; -pub use memoryapi::*; -pub use minschannel::*; -pub use minwinbase::*; -pub use minwindef::*; -pub use mmdeviceapi::*; -pub use mmreg::*; -pub use mmsystem::*; -pub use mscat::*; -pub use mssip::*; -pub use nb30::*; -pub use ncrypt::*; -pub use ntdef::*; -pub use ntsecapi::*; -pub use ntstatus::*; -pub use oaidl::*; -pub use objbase::*; -pub use objidl::*; -pub use objidlbase::*; -pub use olectl::*; -pub use pdh::*; -pub use playsoundapi::*; -pub use processsnapshot::*; -pub use processthreadsapi::*; -pub use propidl::*; -pub use propsys::*; -pub use prsht::*; -pub use psapi::*; -pub use qos::*; -pub use reason::*; -pub use restrictederrorinfo::*; -pub use roapi::*; -pub use roerrorapi::*; -pub use rpc::*; -pub use rpcdce::*; -pub use sapi::*; -pub use schannel::*; -pub use servprov::*; -pub use setupapi::*; -pub use shellapi::*; -pub use shellscalingapi::*; -pub use shlguid::*; -pub use shlobj::*; -pub use shobjidl::*; -pub use shtypes::*; -pub use spapidef::*; -pub use sqltypes::*; -pub use sspi::*; -pub use strmif::*; -pub use subauth::*; -pub use synchapi::*; -pub use sysinfoapi::*; -pub use threadpoolapi::*; -pub use timezoneapi::*; -pub use tlhelp32::*; -pub use unknwnbase::*; -pub use urlhist::*; -pub use urlmon::*; -pub use usb::*; -pub use usbspec::*; -pub use usp10::*; -pub use vadefs::*; -pub use vsbackup::*; -pub use vss::*; -pub use vsserror::*; -pub use vswriter::*; -pub use werapi::*; -pub use winbase::*; -pub use wincon::*; -pub use wincred::*; -pub use wincrypt::*; -pub use windowsx::*; -pub use windef::*; -pub use windowscodecs::*; -pub use winerror::*; -pub use winevt::*; -pub use wingdi::*; -pub use winhttp::*; -pub use winioctl::*; -pub use winnetwk::*; -pub use winnls::*; -pub use winnt::*; -pub use winreg::*; -pub use winscard::*; -pub use winsmcrd::*; -pub use winsock2::*; -pub use winspool::*; -pub use winstring::*; -pub use winsvc::*; -pub use winusb::*; -pub use winusbio::*; -pub use winuser::*; -pub use ws2def::*; -pub use ws2ipdef::*; -pub use ws2spi::*; -pub use ws2tcpip::*; -pub use wtypes::*; -pub use wtypesbase::*; -pub use xinput::*; -//------------------------------------------------------------------------------------------------- +#![deny(unused, unused_qualifications)] +#![allow(bad_style, overflowing_literals, unused_macros)] +#![recursion_limit = "128"] +#![no_std] + +#[cfg(feature = "std")] +extern crate std; + +/// Hack for exported macros +#[doc(hidden)] +pub extern crate core as _core; + // Modules -//------------------------------------------------------------------------------------------------- -#[macro_use] mod macros; -pub mod activation; -pub mod audioclient; -pub mod audiosessiontypes; -pub mod basetsd; -pub mod bcrypt; -pub mod cfg; -pub mod cfgmgr32; -pub mod combaseapi; -pub mod commctrl; -pub mod commdlg; -pub mod corsym; -pub mod d2d1; -pub mod d2dbasetypes; -pub mod d3d9; -pub mod d3d9caps; -pub mod d3d9types; -pub mod d3d11; -pub mod d3d10shader; -pub mod d3d11shader; -pub mod d3d12; -pub mod d3d12sdklayers; -pub mod d3d12shader; -pub mod d3dcommon; -pub mod d3dcompiler; -pub mod dbghelp; -pub mod dcommon; -pub mod devpropdef; -pub mod docobj; -pub mod dpapi; -pub mod dsgetdc; -pub mod dsound; -pub mod dsrole; -pub mod dwmapi; -pub mod dwrite; -pub mod dxgi; -pub mod dxgi1_2; -pub mod dxgi1_3; -pub mod dxgi1_4; -pub mod dxgiformat; -pub mod dxgitype; -pub mod errhandlingapi; -pub mod excpt; -pub mod fileapi; -pub mod gl; -pub mod guiddef; -pub mod heapapi; -pub mod hidclass; -pub mod hidpi; -pub mod hidsdi; -pub mod hidusage; -pub mod hstring; -pub mod http; -pub mod imm; -pub mod inaddr; -pub mod inspectable; -pub mod ksmedia; -pub mod libloaderapi; -pub mod lmaccess; -pub mod lmcons; -pub mod lmdfs; -pub mod lmerrlog; -pub mod lmjoin; -pub mod lsalookup; -pub mod memoryapi; -pub mod minschannel; -pub mod minwinbase; -pub mod minwindef; -pub mod mmdeviceapi; -pub mod mmreg; -pub mod mmsystem; -pub mod mscat; -pub mod mssip; -pub mod nb30; -pub mod ncrypt; -pub mod ntdef; -pub mod ntsecapi; -pub mod ntstatus; -pub mod oaidl; -pub mod objbase; -pub mod objidl; -pub mod objidlbase; -pub mod olectl; -pub mod pdh; -pub mod playsoundapi; -pub mod processsnapshot; -pub mod processthreadsapi; -pub mod propidl; -pub mod propsys; -pub mod prsht; -pub mod psapi; -pub mod qos; -pub mod reason; -pub mod restrictederrorinfo; -pub mod roapi; -pub mod roerrorapi; -pub mod rpc; -pub mod rpcdce; -pub mod sapi; -pub mod schannel; -pub mod servprov; -pub mod setupapi; -pub mod shellapi; -pub mod shellscalingapi; -pub mod shlguid; -pub mod shlobj; -pub mod shobjidl; -pub mod shtypes; -pub mod spapidef; -pub mod sqltypes; -pub mod sspi; -pub mod strmif; -pub mod subauth; -pub mod synchapi; -pub mod sysinfoapi; -pub mod threadpoolapi; -pub mod timezoneapi; -pub mod tlhelp32; -pub mod unknwnbase; -pub mod urlhist; -pub mod urlmon; -pub mod usb; -pub mod usbspec; -pub mod usp10; -pub mod vadefs; -pub mod vsbackup; -pub mod vss; -pub mod vsserror; -pub mod vswriter; -pub mod werapi; -pub mod winbase; -pub mod wincon; -pub mod wincred; -pub mod wincrypt; -pub mod windef; -pub mod windowscodecs; -pub mod windowsx; -pub mod winerror; -pub mod winevt; -pub mod wingdi; -pub mod winhttp; -pub mod winioctl; -pub mod winnetwk; -pub mod winnls; -pub mod winnt; -pub mod winreg; -pub mod winscard; -pub mod winsmcrd; -pub mod winsock2; -pub mod winspool; -pub mod winstring; -pub mod winsvc; -pub mod winusb; -pub mod winusbio; -pub mod winuser; -pub mod ws2def; -pub mod ws2ipdef; -pub mod ws2spi; -pub mod ws2tcpip; -pub mod wtypes; -pub mod wtypesbase; -pub mod xinput; -//------------------------------------------------------------------------------------------------- -// Primitive types not provided by std -//------------------------------------------------------------------------------------------------- -pub type __int8 = i8; -pub type __uint8 = u8; -pub type __int16 = i16; -pub type __uint16 = u16; -pub type __int32 = i32; -pub type __uint32 = u32; -pub type __int64 = i64; -pub type __uint64 = u64; -pub type wchar_t = c_ushort; -#[cfg(target_arch = "x86")] -pub type size_t = c_uint; -#[cfg(target_arch = "x86_64")] -pub type size_t = __uint64; +#[macro_use] +mod macros; +pub mod shared; +pub mod um; +pub mod vc; +pub mod winrt; + +/// Built in primitive types provided by the C language +pub mod ctypes { + #[cfg(feature = "std")] + pub use std::os::raw::c_void; + #[cfg(not(feature = "std"))] + pub enum c_void {} + pub type c_char = i8; + pub type c_schar = i8; + pub type c_uchar = u8; + pub type c_short = i16; + pub type c_ushort = u16; + pub type c_int = i32; + pub type c_uint = u32; + pub type c_long = i32; + pub type c_ulong = u32; + pub type c_longlong = i64; + pub type c_ulonglong = u64; + pub type c_float = f32; + pub type c_double = f64; + pub type __int8 = i8; + pub type __uint8 = u8; + pub type __int16 = i16; + pub type __uint16 = u16; + pub type __int32 = i32; + pub type __uint32 = u32; + pub type __int64 = i64; + pub type __uint64 = u64; + pub type wchar_t = u16; +} +pub trait Interface { + fn uuidof() -> shared::guiddef::GUID; +} diff --git a/src/vendor/winapi/src/macros.rs b/src/vendor/winapi/src/macros.rs index 0bbd6aabff..05a7a539f8 100644 --- a/src/vendor/winapi/src/macros.rs +++ b/src/vendor/winapi/src/macros.rs @@ -1,9 +1,13 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. //! Macros to make things easier to define macro_rules! DECLARE_HANDLE { ($name:ident, $inner:ident) => { - #[allow(missing_copy_implementations)] pub enum $inner { } + pub enum $inner {} pub type $name = *mut $inner; }; } @@ -19,21 +23,21 @@ macro_rules! MAKE_SCODE { } macro_rules! HIDP_ERROR_CODES { ($sev:expr, $code:expr) => { - ($sev << 28) | (::FACILITY_HID_ERROR_CODE << 16) | $code + ($sev << 28) | (FACILITY_HID_ERROR_CODE << 16) | $code } } macro_rules! MAKEFOURCC { ($a:expr, $b:expr, $c:expr, $d:expr) => { - ($a as i32) | (($b as i32) << 8) | (($c as i32) << 16) | (($d as i32) << 24) + ($a as u32) | (($b as u32) << 8) | (($c as u32) << 16) | (($d as u32) << 24) } } #[macro_export] macro_rules! DEFINE_GUID { ( - $name:ident, $l:expr, $w1:expr, $w2:expr, $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, - $b6:expr, $b7:expr, $b8:expr + $name:ident, $l:expr, $w1:expr, $w2:expr, + $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, $b6:expr, $b7:expr, $b8:expr ) => { - pub const $name: $crate::GUID = $crate::GUID { + pub const $name: $crate::shared::guiddef::GUID = $crate::shared::guiddef::GUID { Data1: $l, Data2: $w1, Data3: $w2, @@ -41,6 +45,43 @@ macro_rules! DEFINE_GUID { }; } } +#[macro_export] +macro_rules! DEFINE_PROPERTYKEY { + ( + $name:ident, $l:expr, $w1:expr, $w2:expr, + $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, $b6:expr, $b7:expr, $b8:expr, + $pid:expr + ) => { + pub const $name: $crate::shared::wtypes::PROPERTYKEY + = $crate::shared::wtypes::PROPERTYKEY { + fmtid: $crate::shared::guiddef::GUID { + Data1: $l, + Data2: $w1, + Data3: $w2, + Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8], + }, + pid: $pid, + }; + } +} +#[macro_export] +macro_rules! DEFINE_DEVPROPKEY { + ( + $name:ident, $l:expr, $w1:expr, $w2:expr, + $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, $b6:expr, $b7:expr, $b8:expr, + $pid:expr + ) => { + pub const $name: DEVPROPKEY = DEVPROPKEY { + fmtid: $crate::shared::guiddef::GUID { + Data1: $l, + Data2: $w1, + Data3: $w2, + Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8], + }, + pid: $pid, + }; + } +} macro_rules! CTL_CODE { ($DeviceType:expr, $Function:expr, $Method:expr, $Access:expr) => { ($DeviceType << 16) | ($Access << 14) | ($Function << 2) | $Method @@ -48,139 +89,211 @@ macro_rules! CTL_CODE { } macro_rules! HID_CTL_CODE { ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_NEITHER, ::FILE_ANY_ACCESS) + CTL_CODE!(FILE_DEVICE_KEYBOARD, $id, METHOD_NEITHER, FILE_ANY_ACCESS) } } macro_rules! HID_BUFFER_CTL_CODE { ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_BUFFERED, ::FILE_ANY_ACCESS) + CTL_CODE!(FILE_DEVICE_KEYBOARD, $id, METHOD_BUFFERED, FILE_ANY_ACCESS) } } macro_rules! HID_IN_CTL_CODE { ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_IN_DIRECT, ::FILE_ANY_ACCESS) + CTL_CODE!(FILE_DEVICE_KEYBOARD, $id, METHOD_IN_DIRECT, FILE_ANY_ACCESS) } } macro_rules! HID_OUT_CTL_CODE { ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_OUT_DIRECT, ::FILE_ANY_ACCESS) + CTL_CODE!(FILE_DEVICE_KEYBOARD, $id, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) } } macro_rules! AUDCLNT_ERR { ($n:expr) => { - MAKE_HRESULT!(::SEVERITY_ERROR, ::FACILITY_AUDCLNT, $n) + MAKE_HRESULT!(SEVERITY_ERROR, FACILITY_AUDCLNT, $n) }; } macro_rules! AUDCLNT_SUCCESS { ($n:expr) => { - MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_AUDCLNT, $n) + MAKE_SCODE!(SEVERITY_SUCCESS, FACILITY_AUDCLNT, $n) }; } macro_rules! BCRYPT_MAKE_INTERFACE_VERSION { ($major:expr, $minor:expr) => { - ::BCRYPT_INTERFACE_VERSION { MajorVersion: $major, MinorVersion: $minor } + $crate::shared::bcrypt::BCRYPT_INTERFACE_VERSION { + MajorVersion: $major, MinorVersion: $minor, + } } } +macro_rules! MAKEINTRESOURCE { + ($i:expr) => { $i as u16 as usize as LPWSTR } +} #[macro_export] macro_rules! RIDL { - (interface $interface:ident ($vtbl:ident) - {$( - fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty - ),+} - ) => { - #[repr(C)] #[allow(missing_copy_implementations)] + (#[uuid($($uuid:expr),+)] + interface $interface:ident ($vtbl:ident) {$( + $(#[$($attrs:tt)*])* fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty, + )+}) => ( + RIDL!{@vtbl $interface $vtbl () $( + $(#[$($attrs)*])* fn $method($($p: $t,)*) -> $rtr, + )+} + #[repr(C)] + pub struct $interface { + pub lpVtbl: *const $vtbl, + } + impl $interface { + $(RIDL!{@method $(#[$($attrs)*])* fn $method($($p: $t,)*) -> $rtr})+ + } + RIDL!{@uuid $interface $($uuid),+} + ); + (#[uuid($($uuid:expr),+)] + interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) { + }) => ( + RIDL!{@vtbl $interface $vtbl (pub parent: $pvtbl,)} + #[repr(C)] + pub struct $interface { + pub lpVtbl: *const $vtbl, + } + RIDL!{@deref $interface $pinterface} + RIDL!{@uuid $interface $($uuid),+} + ); + (#[uuid($($uuid:expr),+)] + interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) {$( + $(#[$($attrs:tt)*])* fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty, + )+}) => ( + RIDL!{@vtbl $interface $vtbl (pub parent: $pvtbl,) $( + $(#[$($attrs)*])* fn $method($($p: $t,)*) -> $rtr, + )+} + #[repr(C)] + pub struct $interface { + pub lpVtbl: *const $vtbl, + } + impl $interface { + $(RIDL!{@method $(#[$($attrs)*])* fn $method($($p: $t,)*) -> $rtr})+ + } + RIDL!{@deref $interface $pinterface} + RIDL!{@uuid $interface $($uuid),+} + ); + (@deref $interface:ident $pinterface:ident) => ( + impl $crate::_core::ops::Deref for $interface { + type Target = $pinterface; + #[inline] + fn deref(&self) -> &$pinterface { + unsafe { &*(self as *const $interface as *const $pinterface) } + } + } + ); + (@method fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty) => ( + #[inline] pub unsafe fn $method(&self, $($p: $t,)*) -> $rtr { + ((*self.lpVtbl).$method)(self as *const _ as *mut _, $($p,)*) + } + ); + (@method #[fixme] fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty) => ( + #[inline] pub unsafe fn $method(&self, $($p: $t,)*) -> $rtr { + let mut ret = $crate::_core::mem::uninitialized(); + ((*self.lpVtbl).$method)(self as *const _ as *mut _, &mut ret, $($p,)*); + ret + } + ); + (@vtbl $interface:ident $vtbl:ident ($($fields:tt)*) + $(fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty,)* + ) => ( + RIDL!{@item #[repr(C)] pub struct $vtbl { + $($fields)* $(pub $method: unsafe extern "system" fn( - This: *mut $interface - $(,$p: $t)* - ) -> $rtr),+ - } - #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] - pub struct $interface { - pub lpVtbl: *const $vtbl - } - impl $interface { + This: *mut $interface, + $($p: $t,)* + ) -> $rtr,)* + }} + ); + (@vtbl $interface:ident $vtbl:ident ($($fields:tt)*) + fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty, + $($tail:tt)*) => ( + RIDL!{@vtbl $interface $vtbl ( + $($fields)* + pub $method: unsafe extern "system" fn( + This: *mut $interface, + $($p: $t,)* + ) -> $rtr, + ) $($tail)*} + ); + (@vtbl $interface:ident $vtbl:ident ($($fields:tt)*) + #[fixme] fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty, + $($tail:tt)*) => ( + RIDL!{@vtbl $interface $vtbl ( + $($fields)* + pub $method: unsafe extern "system" fn( + This: *mut $interface, + ret: *mut $rtr, + $($p: $t,)* + ) -> *mut $rtr, + ) $($tail)*} + ); + (@uuid $interface:ident + $l:expr, $w1:expr, $w2:expr, + $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, $b6:expr, $b7:expr, $b8:expr + ) => ( + impl $crate::Interface for $interface { #[inline] - $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { - ((*self.lpVtbl).$method)(self $(,$p)*) - })+ - } - }; - (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) { - }) => { - #[repr(C)] #[allow(missing_copy_implementations)] - pub struct $vtbl { - pub parent: $crate::$pvtbl - } - #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] - pub struct $interface { - pub lpVtbl: *const $vtbl - } - impl ::std::ops::Deref for $interface { - type Target = $crate::$pinterface; - #[inline] - fn deref(&self) -> &$crate::$pinterface { - unsafe { ::std::mem::transmute(self) } + fn uuidof() -> $crate::shared::guiddef::GUID { + $crate::shared::guiddef::GUID { + Data1: $l, + Data2: $w1, + Data3: $w2, + Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8], + } } } - impl ::std::ops::DerefMut for $interface { - #[inline] - fn deref_mut(&mut self) -> &mut $crate::$pinterface { - unsafe { ::std::mem::transmute(self) } - } - } - }; - (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) - {$( - fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty - ),+} - ) => { - #[repr(C)] #[allow(missing_copy_implementations)] - pub struct $vtbl { - pub parent: $crate::$pvtbl - $(,pub $method: unsafe extern "system" fn( - This: *mut $interface - $(,$p: $t)* - ) -> $rtr)+ - } - #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] - pub struct $interface { - pub lpVtbl: *const $vtbl - } - impl $interface { - #[inline] - $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { - ((*self.lpVtbl).$method)(self $(,$p)*) - })+ - } - impl ::std::ops::Deref for $interface { - type Target = $crate::$pinterface; - #[inline] - fn deref(&self) -> &$crate::$pinterface { - unsafe { ::std::mem::transmute(self) } - } - } - impl ::std::ops::DerefMut for $interface { - #[inline] - fn deref_mut(&mut self) -> &mut $crate::$pinterface { - unsafe { ::std::mem::transmute(self) } - } - } - }; + ); + (@item $thing:item) => ($thing); } macro_rules! UNION { - ($base:ident, $field:ident, $variant:ident, $variantmut:ident, $fieldtype:ty) => { - impl $base { + ($(#[$attrs:meta])* union $name:ident { + [$stype:ty; $ssize:expr], + $($variant:ident $variant_mut:ident: $ftype:ty,)+ + }) => ( + #[repr(C)] $(#[$attrs])* + pub struct $name([$stype; $ssize]); + impl Copy for $name {} + impl Clone for $name { #[inline] - pub unsafe fn $variant(&self) -> &$fieldtype { - ::std::mem::transmute(&self.$field) - } - #[inline] - pub unsafe fn $variantmut(&mut self) -> &mut $fieldtype { - ::std::mem::transmute(&mut self.$field) - } + fn clone(&self) -> $name { *self } } - } + impl $name {$( + #[inline] + pub unsafe fn $variant(&self) -> &$ftype { + &*(self as *const _ as *const $ftype) + } + #[inline] + pub unsafe fn $variant_mut(&mut self) -> &mut $ftype { + &mut *(self as *mut _ as *mut $ftype) + } + )+} + ); + ($(#[$attrs:meta])* union $name:ident { + [$stype32:ty; $ssize32:expr] [$stype64:ty; $ssize64:expr], + $($variant:ident $variant_mut:ident: $ftype:ty,)+ + }) => ( + #[repr(C)] $(#[$attrs])* #[cfg(target_arch = "x86")] + pub struct $name([$stype32; $ssize32]); + #[repr(C)] $(#[$attrs])* #[cfg(target_arch = "x86_64")] + pub struct $name([$stype64; $ssize64]); + impl Copy for $name {} + impl Clone for $name { + #[inline] + fn clone(&self) -> $name { *self } + } + impl $name {$( + #[inline] + pub unsafe fn $variant(&self) -> &$ftype { + &*(self as *const _ as *const $ftype) + } + #[inline] + pub unsafe fn $variant_mut(&mut self) -> &mut $ftype { + &mut *(self as *mut _ as *mut $ftype) + } + )+} + ); } macro_rules! BITFIELD { ($base:ident $field:ident: $fieldtype:ty [ @@ -189,7 +302,7 @@ macro_rules! BITFIELD { impl $base {$( #[inline] pub fn $thing(&self) -> $fieldtype { - let size = ::std::mem::size_of::<$fieldtype>() * 8; + let size = $crate::core::mem::size_of::<$fieldtype>() * 8; self.$field << (size - $r.end) >> (size - $r.end + $r.start) } #[inline] @@ -204,67 +317,60 @@ macro_rules! BITFIELD { #[macro_export] macro_rules! ENUM { {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { - #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] - pub struct $name(pub u32); - $(pub const $variant: $name = $name($value);)+ + pub type $name = u32; + $(pub const $variant: $name = $value;)+ }; {enum $name:ident { $variant:ident = $value:expr, $($rest:tt)* }} => { - #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] - pub struct $name(pub u32); - pub const $variant: $name = $name($value); - ENUM!{@gen $name, $variant, $($rest)*} + pub type $name = u32; + pub const $variant: $name = $value; + ENUM!{@gen $name $variant, $($rest)*} }; {enum $name:ident { $variant:ident, $($rest:tt)* }} => { ENUM!{enum $name { $variant = 0, $($rest)* }} }; - {@gen $name:ident, $base:ident,} => {}; - {@gen $name:ident, $base:ident, $variant:ident = $value:expr, $($rest:tt)*} => { - pub const $variant: $name = $name($value); - ENUM!{@gen $name, $variant, $($rest)*} + {@gen $name:ident $base:ident,} => {}; + {@gen $name:ident $base:ident, $variant:ident = $value:expr, $($rest:tt)*} => { + pub const $variant: $name = $value; + ENUM!{@gen $name $variant, $($rest)*} }; - {@gen $name:ident, $base:ident, $variant:ident, $($rest:tt)*} => { - pub const $variant: $name = $name($base.0 + 1u32); - ENUM!{@gen $name, $variant, $($rest)*} + {@gen $name:ident $base:ident, $variant:ident, $($rest:tt)*} => { + pub const $variant: $name = $base + 1u32; + ENUM!{@gen $name $variant, $($rest)*} }; } -macro_rules! FLAGS { - {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { - #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] - pub struct $name(pub u32); - $(pub const $variant: $name = $name($value);)+ - impl ::std::ops::BitAnd<$name> for $name { - type Output = $name; - fn bitand(self, o: $name) -> $name { $name(self.0 & o.0) } - } - impl ::std::ops::BitOr<$name> for $name { - type Output = $name; - fn bitor(self, o: $name) -> $name { $name(self.0 | o.0) } - } - impl ::std::ops::BitXor<$name> for $name { - type Output = $name; - fn bitxor(self, o: $name) -> $name { $name(self.0 ^ o.0) } - } - impl ::std::ops::Not for $name { - type Output = $name; - fn not(self) -> $name { $name(!self.0) } - } - } -} +#[macro_export] macro_rules! STRUCT { - {$(#[$attrs:meta])* nodebug struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { + (#[debug] $($rest:tt)*) => ( + STRUCT!{#[cfg_attr(feature = "debug", derive(Debug))] $($rest)*} + ); + ($(#[$attrs:meta])* struct $name:ident { + $($field:ident: $ftype:ty,)+ + }) => ( #[repr(C)] $(#[$attrs])* pub struct $name { $(pub $field: $ftype,)+ } impl Copy for $name {} - impl Clone for $name { fn clone(&self) -> $name { *self } } - }; - {$(#[$attrs:meta])* struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { - #[repr(C)] #[derive(Debug)] $(#[$attrs])* - pub struct $name { - $(pub $field: $ftype,)+ + impl Clone for $name { + #[inline] + fn clone(&self) -> $name { *self } } - impl Copy for $name {} - impl Clone for $name { fn clone(&self) -> $name { *self } } - }; + ); +} +macro_rules! IFDEF { + ($($thing:item)*) => ($($thing)*) +} +macro_rules! FN { + (stdcall $func:ident($($t:ty,)*) -> $ret:ty) => ( + pub type $func = Option $ret>; + ); + (stdcall $func:ident($($p:ident: $t:ty,)*) -> $ret:ty) => ( + pub type $func = Option $ret>; + ); + (cdecl $func:ident($($t:ty,)*) -> $ret:ty) => ( + pub type $func = Option $ret>; + ); + (cdecl $func:ident($($p:ident: $t:ty,)*) -> $ret:ty) => ( + pub type $func = Option $ret>; + ); } diff --git a/src/vendor/winapi/src/shared/basetsd.rs b/src/vendor/winapi/src/shared/basetsd.rs new file mode 100644 index 0000000000..4953a6711e --- /dev/null +++ b/src/vendor/winapi/src/shared/basetsd.rs @@ -0,0 +1,71 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Type definitions for the basic sized types. +use ctypes::{__int64, __uint64, c_int, c_schar, c_short, c_uchar, c_uint, c_ushort}; +pub type POINTER_64_INT = usize; +pub type INT8 = c_schar; +pub type PINT8 = *mut c_schar; +pub type INT16 = c_short; +pub type PINT16 = *mut c_short; +pub type INT32 = c_int; +pub type PINT32 = *mut c_int; +pub type INT64 = __int64; +pub type PINT64 = *mut __int64; +pub type UINT8 = c_uchar; +pub type PUINT8 = *mut c_uchar; +pub type UINT16 = c_ushort; +pub type PUINT16 = *mut c_ushort; +pub type UINT32 = c_uint; +pub type PUINT32 = *mut c_uint; +pub type UINT64 = __uint64; +pub type PUINT64 = *mut __uint64; +pub type LONG32 = c_int; +pub type PLONG32 = *mut c_int; +pub type ULONG32 = c_uint; +pub type PULONG32 = *mut c_uint; +pub type DWORD32 = c_uint; +pub type PDWORD32 = *mut c_uint; +pub type INT_PTR = isize; +pub type PINT_PTR = *mut isize; +pub type UINT_PTR = usize; +pub type PUINT_PTR = *mut usize; +pub type LONG_PTR = isize; +pub type PLONG_PTR = *mut isize; +pub type ULONG_PTR = usize; +pub type PULONG_PTR = *mut usize; +pub type SHANDLE_PTR = isize; +pub type HANDLE_PTR = usize; +#[cfg(target_arch = "x86")] +pub type UHALF_PTR = c_ushort; +#[cfg(target_arch = "x86_64")] +pub type UHALF_PTR = c_uint; +#[cfg(target_arch = "x86")] +pub type PUHALF_PTR = *mut c_ushort; +#[cfg(target_arch = "x86_64")] +pub type PUHALF_PTR = *mut c_uint; +#[cfg(target_arch = "x86")] +pub type HALF_PTR = c_short; +#[cfg(target_arch = "x86_64")] +pub type HALF_PTR = c_int; +#[cfg(target_arch = "x86")] +pub type PHALF_PTR = *mut c_short; +#[cfg(target_arch = "x86_64")] +pub type PHALF_PTR = *mut c_int; +pub type SIZE_T = ULONG_PTR; +pub type PSIZE_T = *mut ULONG_PTR; +pub type SSIZE_T = LONG_PTR; +pub type PSSIZE_T = *mut LONG_PTR; +pub type DWORD_PTR = ULONG_PTR; +pub type PDWORD_PTR = *mut ULONG_PTR; +pub type LONG64 = __int64; +pub type PLONG64 = *mut __int64; +pub type ULONG64 = __uint64; +pub type PULONG64 = *mut __uint64; +pub type DWORD64 = __uint64; +pub type PDWORD64 = *mut __uint64; +pub type KAFFINITY = ULONG_PTR; +pub type PKAFFINITY = *mut KAFFINITY; diff --git a/src/vendor/winapi/src/shared/bcrypt.rs b/src/vendor/winapi/src/shared/bcrypt.rs new file mode 100644 index 0000000000..283e4dc050 --- /dev/null +++ b/src/vendor/winapi/src/shared/bcrypt.rs @@ -0,0 +1,1002 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Cryptographic Primitive API Prototypes and Definitions +use shared::minwindef::{PUCHAR, UCHAR, ULONG, USHORT}; +use um::winnt::{BOOLEAN, HANDLE, LONG, LPCWSTR, LPWSTR, PVOID, PWSTR, ULONGLONG, VOID}; +pub type NTSTATUS = LONG; +pub type PNTSTATUS = *mut NTSTATUS; +#[inline] +pub fn BCRYPT_SUCCESS(Status: NTSTATUS) -> bool { + Status >= 0 +} +pub const BCRYPT_OBJECT_ALIGNMENT: usize = 16; +pub const BCRYPT_KDF_HASH: &'static str = "HASH"; +pub const BCRYPT_KDF_HMAC: &'static str = "HMAC"; +pub const BCRYPT_KDF_TLS_PRF: &'static str = "TLS_PRF"; +pub const BCRYPT_KDF_SP80056A_CONCAT: &'static str = "SP800_56A_CONCAT"; +pub const BCRYPT_KDF_RAW_SECRET: &'static str = "TRUNCATE"; +pub const KDF_HASH_ALGORITHM: ULONG = 0x0; +pub const KDF_SECRET_PREPEND: ULONG = 0x1; +pub const KDF_SECRET_APPEND: ULONG = 0x2; +pub const KDF_HMAC_KEY: ULONG = 0x3; +pub const KDF_TLS_PRF_LABEL: ULONG = 0x4; +pub const KDF_TLS_PRF_SEED: ULONG = 0x5; +pub const KDF_SECRET_HANDLE: ULONG = 0x6; +pub const KDF_TLS_PRF_PROTOCOL: ULONG = 0x7; +pub const KDF_ALGORITHMID: ULONG = 0x8; +pub const KDF_PARTYUINFO: ULONG = 0x9; +pub const KDF_PARTYVINFO: ULONG = 0xA; +pub const KDF_SUPPPUBINFO: ULONG = 0xB; +pub const KDF_SUPPPRIVINFO: ULONG = 0xC; +pub const KDF_LABEL: ULONG = 0xD; +pub const KDF_CONTEXT: ULONG = 0xE; +pub const KDF_SALT: ULONG = 0xF; +pub const KDF_ITERATION_COUNT: ULONG = 0x10; +pub const KDF_GENERIC_PARAMETER: ULONG = 0x11; +pub const KDF_KEYBITLENGTH: ULONG = 0x12; +pub const KDF_USE_SECRET_AS_HMAC_KEY_FLAG: ULONG = 0x1; +STRUCT!{struct BCRYPT_KEY_LENGTHS_STRUCT { + dwMinLength: ULONG, + dwMaxLength: ULONG, + dwIncrement: ULONG, +}} +pub type BCRYPT_AUTH_TAG_LENGTHS_STRUCT = BCRYPT_KEY_LENGTHS_STRUCT; +STRUCT!{struct BCRYPT_OID { + cbOID: ULONG, + pbOID: PUCHAR, +}} +STRUCT!{struct BCRYPT_OID_LIST { + dwOIDCount: ULONG, + pOIDs: *mut BCRYPT_OID, +}} +STRUCT!{struct BCRYPT_PKCS1_PADDING_INFO { + pszAlgId: LPCWSTR, +}} +STRUCT!{struct BCRYPT_PSS_PADDING_INFO { + pszAlgId: LPCWSTR, + cbSalt: ULONG, +}} +STRUCT!{struct BCRYPT_OAEP_PADDING_INFO { + pszAlgId: LPCWSTR, + pbLabel: PUCHAR, + cbLabel: ULONG, +}} +pub const BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION: ULONG = 1; +pub const BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG: ULONG = 0x00000001; +pub const BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG: ULONG = 0x00000002; +STRUCT!{struct BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO { + cbSize: ULONG, + dwInfoVersion: ULONG, + pbNonce: PUCHAR, + cbNonce: ULONG, + pbAuthData: PUCHAR, + cbAuthData: ULONG, + pbTag: PUCHAR, + cbTag: ULONG, + pbMacContext: PUCHAR, + cbMacContext: ULONG, + cbAAD: ULONG, + cbData: ULONGLONG, + dwFlags: ULONG, +}} +pub type PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO = *mut BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO; +pub const BCRYPT_OPAQUE_KEY_BLOB: &'static str = "OpaqueKeyBlob"; +pub const BCRYPT_KEY_DATA_BLOB: &'static str = "KeyDataBlob"; +pub const BCRYPT_AES_WRAP_KEY_BLOB: &'static str = "Rfc3565KeyWrapBlob"; +pub const BCRYPT_OBJECT_LENGTH: &'static str = "ObjectLength"; +pub const BCRYPT_ALGORITHM_NAME: &'static str = "AlgorithmName"; +pub const BCRYPT_PROVIDER_HANDLE: &'static str = "ProviderHandle"; +pub const BCRYPT_CHAINING_MODE: &'static str = "ChainingMode"; +pub const BCRYPT_BLOCK_LENGTH: &'static str = "BlockLength"; +pub const BCRYPT_KEY_LENGTH: &'static str = "KeyLength"; +pub const BCRYPT_KEY_OBJECT_LENGTH: &'static str = "KeyObjectLength"; +pub const BCRYPT_KEY_STRENGTH: &'static str = "KeyStrength"; +pub const BCRYPT_KEY_LENGTHS: &'static str = "KeyLengths"; +pub const BCRYPT_BLOCK_SIZE_LIST: &'static str = "BlockSizeList"; +pub const BCRYPT_EFFECTIVE_KEY_LENGTH: &'static str = "EffectiveKeyLength"; +pub const BCRYPT_HASH_LENGTH: &'static str = "HashDigestLength"; +pub const BCRYPT_HASH_OID_LIST: &'static str = "HashOIDList"; +pub const BCRYPT_PADDING_SCHEMES: &'static str = "PaddingSchemes"; +pub const BCRYPT_SIGNATURE_LENGTH: &'static str = "SignatureLength"; +pub const BCRYPT_HASH_BLOCK_LENGTH: &'static str = "HashBlockLength"; +pub const BCRYPT_AUTH_TAG_LENGTH: &'static str = "AuthTagLength"; +pub const BCRYPT_PRIMITIVE_TYPE: &'static str = "PrimitiveType"; +pub const BCRYPT_IS_KEYED_HASH: &'static str = "IsKeyedHash"; +pub const BCRYPT_IS_REUSABLE_HASH: &'static str = "IsReusableHash"; +pub const BCRYPT_MESSAGE_BLOCK_LENGTH: &'static str = "MessageBlockLength"; +pub const BCRYPT_PUBLIC_KEY_LENGTH: &'static str = "PublicKeyLength"; +pub const BCRYPT_PCP_PLATFORM_TYPE_PROPERTY: &'static str = "PCP_PLATFORM_TYPE"; +pub const BCRYPT_PCP_PROVIDER_VERSION_PROPERTY: &'static str = "PCP_PROVIDER_VERSION"; +pub const BCRYPT_MULTI_OBJECT_LENGTH: &'static str = "MultiObjectLength"; +pub const BCRYPT_INITIALIZATION_VECTOR: &'static str = "IV"; +pub const BCRYPT_CHAIN_MODE_NA: &'static str = "ChainingModeN/A"; +pub const BCRYPT_CHAIN_MODE_CBC: &'static str = "ChainingModeCBC"; +pub const BCRYPT_CHAIN_MODE_ECB: &'static str = "ChainingModeECB"; +pub const BCRYPT_CHAIN_MODE_CFB: &'static str = "ChainingModeCFB"; +pub const BCRYPT_CHAIN_MODE_CCM: &'static str = "ChainingModeCCM"; +pub const BCRYPT_CHAIN_MODE_GCM: &'static str = "ChainingModeGCM"; +pub const BCRYPT_PROV_DISPATCH: ULONG = 0x00000001; +pub const BCRYPT_BLOCK_PADDING: ULONG = 0x00000001; +pub const BCRYPT_PAD_NONE: ULONG = 0x00000001; +pub const BCRYPT_PAD_PKCS1: ULONG = 0x00000002; +pub const BCRYPT_PAD_OAEP: ULONG = 0x00000004; +pub const BCRYPT_PAD_PSS: ULONG = 0x00000008; +pub const BCRYPT_PAD_PKCS1_OPTIONAL_HASH_OID: ULONG = 0x00000010; +pub const BCRYPTBUFFER_VERSION: ULONG = 0; +STRUCT!{struct BCryptBuffer { + cbBuffer: ULONG, + BufferType: ULONG, + pvBuffer: PVOID, +}} +pub type PBCryptBuffer = *mut BCryptBuffer; +STRUCT!{struct BCryptBufferDesc { + ulVersion: ULONG, + cBuffers: ULONG, + pBuffers: PBCryptBuffer, +}} +pub type PBCryptBufferDesc = *mut BCryptBufferDesc; +pub type BCRYPT_HANDLE = PVOID; +pub type BCRYPT_ALG_HANDLE = PVOID; +pub type BCRYPT_KEY_HANDLE = PVOID; +pub type BCRYPT_HASH_HANDLE = PVOID; +pub type BCRYPT_SECRET_HANDLE = PVOID; +pub const BCRYPT_PUBLIC_KEY_BLOB: &'static str = "PUBLICBLOB"; +pub const BCRYPT_PRIVATE_KEY_BLOB: &'static str = "PRIVATEBLOB"; +STRUCT!{struct BCRYPT_KEY_BLOB { + Magic: ULONG, +}} +pub const BCRYPT_RSAPUBLIC_BLOB: &'static str = "RSAPUBLICBLOB"; +pub const BCRYPT_RSAPRIVATE_BLOB: &'static str = "RSAPRIVATEBLOB"; +pub const LEGACY_RSAPUBLIC_BLOB: &'static str = "CAPIPUBLICBLOB"; +pub const LEGACY_RSAPRIVATE_BLOB: &'static str = "CAPIPRIVATEBLOB"; +pub const BCRYPT_RSAPUBLIC_MAGIC: ULONG = 0x31415352; +pub const BCRYPT_RSAPRIVATE_MAGIC: ULONG = 0x32415352; +STRUCT!{struct BCRYPT_RSAKEY_BLOB { + Magic: ULONG, + BitLength: ULONG, + cbPublicExp: ULONG, + cbModulus: ULONG, + cbPrime1: ULONG, + cbPrime2: ULONG, +}} +pub const BCRYPT_RSAFULLPRIVATE_BLOB: &'static str = "RSAFULLPRIVATEBLOB"; +pub const BCRYPT_RSAFULLPRIVATE_MAGIC: ULONG = 0x33415352; +pub const BCRYPT_GLOBAL_PARAMETERS: &'static str = "SecretAgreementParam"; +pub const BCRYPT_PRIVATE_KEY: &'static str = "PrivKeyVal"; +pub const BCRYPT_ECCPUBLIC_BLOB: &'static str = "ECCPUBLICBLOB"; +pub const BCRYPT_ECCPRIVATE_BLOB: &'static str = "ECCPRIVATEBLOB"; +pub const BCRYPT_ECCFULLPUBLIC_BLOB: &'static str = "ECCFULLPUBLICBLOB"; +pub const BCRYPT_ECCFULLPRIVATE_BLOB: &'static str = "ECCFULLPRIVATEBLOB"; +pub const SSL_ECCPUBLIC_BLOB: &'static str = "SSLECCPUBLICBLOB"; +pub const BCRYPT_ECDH_PUBLIC_P256_MAGIC: ULONG = 0x314B4345; +pub const BCRYPT_ECDH_PRIVATE_P256_MAGIC: ULONG = 0x324B4345; +pub const BCRYPT_ECDH_PUBLIC_P384_MAGIC: ULONG = 0x334B4345; +pub const BCRYPT_ECDH_PRIVATE_P384_MAGIC: ULONG = 0x344B4345; +pub const BCRYPT_ECDH_PUBLIC_P521_MAGIC: ULONG = 0x354B4345; +pub const BCRYPT_ECDH_PRIVATE_P521_MAGIC: ULONG = 0x364B4345; +pub const BCRYPT_ECDH_PUBLIC_GENERIC_MAGIC: ULONG = 0x504B4345; +pub const BCRYPT_ECDH_PRIVATE_GENERIC_MAGIC: ULONG = 0x564B4345; +pub const BCRYPT_ECDSA_PUBLIC_P256_MAGIC: ULONG = 0x31534345; +pub const BCRYPT_ECDSA_PRIVATE_P256_MAGIC: ULONG = 0x32534345; +pub const BCRYPT_ECDSA_PUBLIC_P384_MAGIC: ULONG = 0x33534345; +pub const BCRYPT_ECDSA_PRIVATE_P384_MAGIC: ULONG = 0x34534345; +pub const BCRYPT_ECDSA_PUBLIC_P521_MAGIC: ULONG = 0x35534345; +pub const BCRYPT_ECDSA_PRIVATE_P521_MAGIC: ULONG = 0x36534345; +pub const BCRYPT_ECDSA_PUBLIC_GENERIC_MAGIC: ULONG = 0x50444345; +pub const BCRYPT_ECDSA_PRIVATE_GENERIC_MAGIC: ULONG = 0x56444345; +STRUCT!{struct BCRYPT_ECCKEY_BLOB { + dwMagic: ULONG, + cbKey: ULONG, +}} +pub type PBCRYPT_ECCKEY_BLOB = *mut BCRYPT_ECCKEY_BLOB; +STRUCT!{struct SSL_ECCKEY_BLOB { + dwCurveType: ULONG, + cbKey: ULONG, +}} +pub type PSSL_ECCKEY_BLOB = *mut SSL_ECCKEY_BLOB; +pub const BCRYPT_ECC_FULLKEY_BLOB_V1: ULONG = 0x1; +ENUM!{enum ECC_CURVE_TYPE_ENUM { + BCRYPT_ECC_PRIME_SHORT_WEIERSTRASS_CURVE = 0x1, + BCRYPT_ECC_PRIME_TWISTED_EDWARDS_CURVE = 0x2, + BCRYPT_ECC_PRIME_MONTGOMERY_CURVE = 0x3, +}} +ENUM!{enum ECC_CURVE_ALG_ID_ENUM { + BCRYPT_NO_CURVE_GENERATION_ALG_ID = 0x0, +}} +STRUCT!{struct BCRYPT_ECCFULLKEY_BLOB { + dwMagic: ULONG, + dwVersion: ULONG, + dwCurveType: ECC_CURVE_TYPE_ENUM, + dwCurveGenerationAlgId: ECC_CURVE_ALG_ID_ENUM, + cbFieldLength: ULONG, + cbSubgroupOrder: ULONG, + cbCofactor: ULONG, + cbSeed: ULONG, +}} +pub type PBCRYPT_ECCFULLKEY_BLOB = *mut BCRYPT_ECCFULLKEY_BLOB; +pub const BCRYPT_DH_PUBLIC_BLOB: &'static str = "DHPUBLICBLOB"; +pub const BCRYPT_DH_PRIVATE_BLOB: &'static str = "DHPRIVATEBLOB"; +pub const LEGACY_DH_PUBLIC_BLOB: &'static str = "CAPIDHPUBLICBLOB"; +pub const LEGACY_DH_PRIVATE_BLOB: &'static str = "CAPIDHPRIVATEBLOB"; +pub const BCRYPT_DH_PUBLIC_MAGIC: ULONG = 0x42504844; +pub const BCRYPT_DH_PRIVATE_MAGIC: ULONG = 0x56504844; +STRUCT!{struct BCRYPT_DH_KEY_BLOB { + dwMagic: ULONG, + cbKey: ULONG, +}} +pub type PBCRYPT_DH_KEY_BLOB = *mut BCRYPT_DH_KEY_BLOB; +pub const BCRYPT_DH_PARAMETERS: &'static str = "DHParameters"; +pub const BCRYPT_DH_PARAMETERS_MAGIC: ULONG = 0x4d504844; +STRUCT!{struct BCRYPT_DH_PARAMETER_HEADER { + cbLength: ULONG, + dwMagic: ULONG, + cbKeyLength: ULONG, +}} +pub const BCRYPT_DSA_PUBLIC_BLOB: &'static str = "DSAPUBLICBLOB"; +pub const BCRYPT_DSA_PRIVATE_BLOB: &'static str = "DSAPRIVATEBLOB"; +pub const LEGACY_DSA_PUBLIC_BLOB: &'static str = "CAPIDSAPUBLICBLOB"; +pub const LEGACY_DSA_PRIVATE_BLOB: &'static str = "CAPIDSAPRIVATEBLOB"; +pub const LEGACY_DSA_V2_PUBLIC_BLOB: &'static str = "V2CAPIDSAPUBLICBLOB"; +pub const LEGACY_DSA_V2_PRIVATE_BLOB: &'static str = "V2CAPIDSAPRIVATEBLOB"; +pub const BCRYPT_DSA_PUBLIC_MAGIC: ULONG = 0x42505344; +pub const BCRYPT_DSA_PRIVATE_MAGIC: ULONG = 0x56505344; +pub const BCRYPT_DSA_PUBLIC_MAGIC_V2: ULONG = 0x32425044; +pub const BCRYPT_DSA_PRIVATE_MAGIC_V2: ULONG = 0x32565044; +STRUCT!{struct BCRYPT_DSA_KEY_BLOB { + dwMagic: ULONG, + cbKey: ULONG, + Count: [UCHAR; 4], + Seed: [UCHAR; 20], + q: [UCHAR; 20], +}} +pub type PBCRYPT_DSA_KEY_BLOB = *mut BCRYPT_DSA_KEY_BLOB; +ENUM!{enum HASHALGORITHM_ENUM { + DSA_HASH_ALGORITHM_SHA1, + DSA_HASH_ALGORITHM_SHA256, + DSA_HASH_ALGORITHM_SHA512, +}} +ENUM!{enum DSAFIPSVERSION_ENUM { + DSA_FIPS186_2, + DSA_FIPS186_3, +}} +STRUCT!{struct BCRYPT_DSA_KEY_BLOB_V2 { + dwMagic: ULONG, + cbKey: ULONG, + hashAlgorithm: HASHALGORITHM_ENUM, + standardVersion: DSAFIPSVERSION_ENUM, + cbSeedLength: ULONG, + cbGroupSize: ULONG, + Count: [UCHAR; 4], +}} +pub type PBCRYPT_DSA_KEY_BLOB_V2 = *mut BCRYPT_DSA_KEY_BLOB_V2; +STRUCT!{struct BCRYPT_KEY_DATA_BLOB_HEADER { + dwMagic: ULONG, + dwVersion: ULONG, + cbKeyData: ULONG, +}} +pub type PBCRYPT_KEY_DATA_BLOB_HEADER = *mut BCRYPT_KEY_DATA_BLOB_HEADER; +pub const BCRYPT_KEY_DATA_BLOB_MAGIC: ULONG = 0x4d42444b; +pub const BCRYPT_KEY_DATA_BLOB_VERSION1: ULONG = 0x1; +pub const BCRYPT_DSA_PARAMETERS: &'static str = "DSAParameters"; +pub const BCRYPT_DSA_PARAMETERS_MAGIC: ULONG = 0x4d505344; +pub const BCRYPT_DSA_PARAMETERS_MAGIC_V2: ULONG = 0x324d5044; +STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER { + cbLength: ULONG, + dwMagic: ULONG, + cbKeyLength: ULONG, + Count: [UCHAR; 4], + Seed: [UCHAR; 20], + q: [UCHAR; 20], +}} +STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER_V2 { + cbLength: ULONG, + dwMagic: ULONG, + cbKeyLength: ULONG, + hashAlgorithm: HASHALGORITHM_ENUM, + standardVersion: DSAFIPSVERSION_ENUM, + cbSeedLength: ULONG, + cbGroupSize: ULONG, + Count: [UCHAR; 4], +}} +pub const BCRYPT_ECC_PARAMETERS: &'static str = "ECCParameters"; +pub const BCRYPT_ECC_CURVE_NAME: &'static str = "ECCCurveName"; +pub const BCRYPT_ECC_CURVE_NAME_LIST: &'static str = "ECCCurveNameList"; +pub const BCRYPT_ECC_PARAMETERS_MAGIC: ULONG = 0x50434345; +STRUCT!{struct BCRYPT_ECC_CURVE_NAMES { + dwEccCurveNames: ULONG, + pEccCurveNames: LPWSTR, +}} +pub const BCRYPT_ECC_CURVE_BRAINPOOLP160R1: &'static str = "brainpoolP160r1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP160T1: &'static str = "brainpoolP160t1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP192R1: &'static str = "brainpoolP192r1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP192T1: &'static str = "brainpoolP192t1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP224R1: &'static str = "brainpoolP224r1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP224T1: &'static str = "brainpoolP224t1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP256R1: &'static str = "brainpoolP256r1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP256T1: &'static str = "brainpoolP256t1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP320R1: &'static str = "brainpoolP320r1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP320T1: &'static str = "brainpoolP320t1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP384R1: &'static str = "brainpoolP384r1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP384T1: &'static str = "brainpoolP384t1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP512R1: &'static str = "brainpoolP512r1"; +pub const BCRYPT_ECC_CURVE_BRAINPOOLP512T1: &'static str = "brainpoolP512t1"; +pub const BCRYPT_ECC_CURVE_25519: &'static str = "curve25519"; +pub const BCRYPT_ECC_CURVE_EC192WAPI: &'static str = "ec192wapi"; +pub const BCRYPT_ECC_CURVE_NISTP192: &'static str = "nistP192"; +pub const BCRYPT_ECC_CURVE_NISTP224: &'static str = "nistP224"; +pub const BCRYPT_ECC_CURVE_NISTP256: &'static str = "nistP256"; +pub const BCRYPT_ECC_CURVE_NISTP384: &'static str = "nistP384"; +pub const BCRYPT_ECC_CURVE_NISTP521: &'static str = "nistP521"; +pub const BCRYPT_ECC_CURVE_NUMSP256T1: &'static str = "numsP256t1"; +pub const BCRYPT_ECC_CURVE_NUMSP384T1: &'static str = "numsP384t1"; +pub const BCRYPT_ECC_CURVE_NUMSP512T1: &'static str = "numsP512t1"; +pub const BCRYPT_ECC_CURVE_SECP160K1: &'static str = "secP160k1"; +pub const BCRYPT_ECC_CURVE_SECP160R1: &'static str = "secP160r1"; +pub const BCRYPT_ECC_CURVE_SECP160R2: &'static str = "secP160r2"; +pub const BCRYPT_ECC_CURVE_SECP192K1: &'static str = "secP192k1"; +pub const BCRYPT_ECC_CURVE_SECP192R1: &'static str = "secP192r1"; +pub const BCRYPT_ECC_CURVE_SECP224K1: &'static str = "secP224k1"; +pub const BCRYPT_ECC_CURVE_SECP224R1: &'static str = "secP224r1"; +pub const BCRYPT_ECC_CURVE_SECP256K1: &'static str = "secP256k1"; +pub const BCRYPT_ECC_CURVE_SECP256R1: &'static str = "secP256r1"; +pub const BCRYPT_ECC_CURVE_SECP384R1: &'static str = "secP384r1"; +pub const BCRYPT_ECC_CURVE_SECP521R1: &'static str = "secP521r1"; +pub const BCRYPT_ECC_CURVE_WTLS7: &'static str = "wtls7"; +pub const BCRYPT_ECC_CURVE_WTLS9: &'static str = "wtls9"; +pub const BCRYPT_ECC_CURVE_WTLS12: &'static str = "wtls12"; +pub const BCRYPT_ECC_CURVE_X962P192V1: &'static str = "x962P192v1"; +pub const BCRYPT_ECC_CURVE_X962P192V2: &'static str = "x962P192v2"; +pub const BCRYPT_ECC_CURVE_X962P192V3: &'static str = "x962P192v3"; +pub const BCRYPT_ECC_CURVE_X962P239V1: &'static str = "x962P239v1"; +pub const BCRYPT_ECC_CURVE_X962P239V2: &'static str = "x962P239v2"; +pub const BCRYPT_ECC_CURVE_X962P239V3: &'static str = "x962P239v3"; +pub const BCRYPT_ECC_CURVE_X962P256V1: &'static str = "x962P256v1"; +ENUM!{enum BCRYPT_HASH_OPERATION_TYPE { + BCRYPT_HASH_OPERATION_HASH_DATA = 1, + BCRYPT_HASH_OPERATION_FINISH_HASH = 2, +}} +STRUCT!{struct BCRYPT_MULTI_HASH_OPERATION { + iHash: ULONG, + hashOperation: BCRYPT_HASH_OPERATION_TYPE, + pbBuffer: PUCHAR, + cbBuffer: ULONG, +}} +ENUM!{enum BCRYPT_MULTI_OPERATION_TYPE { + BCRYPT_OPERATION_TYPE_HASH = 1, +}} +STRUCT!{struct BCRYPT_MULTI_OBJECT_LENGTH_STRUCT { + cbPerObject: ULONG, + cbPerElement: ULONG, +}} +pub const MS_PRIMITIVE_PROVIDER: &'static str = "Microsoft Primitive Provider"; +pub const MS_PLATFORM_CRYPTO_PROVIDER: &'static str = "Microsoft Platform Crypto Provider"; +pub const BCRYPT_RSA_ALGORITHM: &'static str = "RSA"; +pub const BCRYPT_RSA_SIGN_ALGORITHM: &'static str = "RSA_SIGN"; +pub const BCRYPT_DH_ALGORITHM: &'static str = "DH"; +pub const BCRYPT_DSA_ALGORITHM: &'static str = "DSA"; +pub const BCRYPT_RC2_ALGORITHM: &'static str = "RC2"; +pub const BCRYPT_RC4_ALGORITHM: &'static str = "RC4"; +pub const BCRYPT_AES_ALGORITHM: &'static str = "AES"; +pub const BCRYPT_DES_ALGORITHM: &'static str = "DES"; +pub const BCRYPT_DESX_ALGORITHM: &'static str = "DESX"; +pub const BCRYPT_3DES_ALGORITHM: &'static str = "3DES"; +pub const BCRYPT_3DES_112_ALGORITHM: &'static str = "3DES_112"; +pub const BCRYPT_MD2_ALGORITHM: &'static str = "MD2"; +pub const BCRYPT_MD4_ALGORITHM: &'static str = "MD4"; +pub const BCRYPT_MD5_ALGORITHM: &'static str = "MD5"; +pub const BCRYPT_SHA1_ALGORITHM: &'static str = "SHA1"; +pub const BCRYPT_SHA256_ALGORITHM: &'static str = "SHA256"; +pub const BCRYPT_SHA384_ALGORITHM: &'static str = "SHA384"; +pub const BCRYPT_SHA512_ALGORITHM: &'static str = "SHA512"; +pub const BCRYPT_AES_GMAC_ALGORITHM: &'static str = "AES-GMAC"; +pub const BCRYPT_AES_CMAC_ALGORITHM: &'static str = "AES-CMAC"; +pub const BCRYPT_ECDSA_P256_ALGORITHM: &'static str = "ECDSA_P256"; +pub const BCRYPT_ECDSA_P384_ALGORITHM: &'static str = "ECDSA_P384"; +pub const BCRYPT_ECDSA_P521_ALGORITHM: &'static str = "ECDSA_P521"; +pub const BCRYPT_ECDH_P256_ALGORITHM: &'static str = "ECDH_P256"; +pub const BCRYPT_ECDH_P384_ALGORITHM: &'static str = "ECDH_P384"; +pub const BCRYPT_ECDH_P521_ALGORITHM: &'static str = "ECDH_P521"; +pub const BCRYPT_RNG_ALGORITHM: &'static str = "RNG"; +pub const BCRYPT_RNG_FIPS186_DSA_ALGORITHM: &'static str = "FIPS186DSARNG"; +pub const BCRYPT_RNG_DUAL_EC_ALGORITHM: &'static str = "DUALECRNG"; +pub const BCRYPT_SP800108_CTR_HMAC_ALGORITHM: &'static str = "SP800_108_CTR_HMAC"; +pub const BCRYPT_SP80056A_CONCAT_ALGORITHM: &'static str = "SP800_56A_CONCAT"; +pub const BCRYPT_PBKDF2_ALGORITHM: &'static str = "PBKDF2"; +pub const BCRYPT_CAPI_KDF_ALGORITHM: &'static str = "CAPI_KDF"; +pub const BCRYPT_TLS1_1_KDF_ALGORITHM: &'static str = "TLS1_1_KDF"; +pub const BCRYPT_TLS1_2_KDF_ALGORITHM: &'static str = "TLS1_2_KDF"; +pub const BCRYPT_ECDSA_ALGORITHM: &'static str = "ECDSA"; +pub const BCRYPT_ECDH_ALGORITHM: &'static str = "ECDH"; +pub const BCRYPT_XTS_AES_ALGORITHM: &'static str = "XTS-AES"; +pub const BCRYPT_CIPHER_INTERFACE: ULONG = 0x00000001; +pub const BCRYPT_HASH_INTERFACE: ULONG = 0x00000002; +pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE: ULONG = 0x00000003; +pub const BCRYPT_SECRET_AGREEMENT_INTERFACE: ULONG = 0x00000004; +pub const BCRYPT_SIGNATURE_INTERFACE: ULONG = 0x00000005; +pub const BCRYPT_RNG_INTERFACE: ULONG = 0x00000006; +pub const BCRYPT_KEY_DERIVATION_INTERFACE: ULONG = 0x00000007; +pub const BCRYPT_MD2_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000001 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_MD4_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000011 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_MD5_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000021 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_SHA1_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000031 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_SHA256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000041 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_SHA384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000051 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_SHA512_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000061 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_RC4_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000071 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_RNG_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000081 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_HMAC_MD5_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000091 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_HMAC_SHA1_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000a1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_HMAC_SHA256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000b1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_HMAC_SHA384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000c1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_HMAC_SHA512_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000d1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_RSA_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000e1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDSA_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000f1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_AES_CMAC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000101 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_AES_GMAC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000111 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_HMAC_MD2_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000121 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_HMAC_MD4_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000131 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_3DES_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000141 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_3DES_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000151 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_3DES_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000161 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_3DES_112_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000171 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_3DES_112_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000181 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_3DES_112_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000191 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_AES_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001a1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_AES_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001b1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_AES_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001c1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_AES_CCM_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001d1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_AES_GCM_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001e1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DES_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001f1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DES_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000201 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DES_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000211 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DESX_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000221 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DESX_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000231 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DESX_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000241 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_RC2_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000251 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_RC2_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000261 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_RC2_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000271 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DH_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000281 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDH_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000291 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDH_P256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002a1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDH_P384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002b1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDH_P521_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002c1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_DSA_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002d1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDSA_P256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002e1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDSA_P384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002f1 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ECDSA_P521_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000301 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_RSA_SIGN_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000311 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_CAPI_KDF_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000321 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_PBKDF2_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000331 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_SP800108_CTR_HMAC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000341 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_SP80056A_CONCAT_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000351 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_TLS1_1_KDF_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000361 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_TLS1_2_KDF_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000371 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_XTS_AES_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000381 as BCRYPT_ALG_HANDLE; +pub const BCRYPT_ALG_HANDLE_HMAC_FLAG: ULONG = 0x00000008; +pub const BCRYPT_CAPI_AES_FLAG: ULONG = 0x00000010; +pub const BCRYPT_HASH_REUSABLE_FLAG: ULONG = 0x00000020; +pub const BCRYPT_BUFFERS_LOCKED_FLAG: ULONG = 0x00000040; +pub const BCRYPT_EXTENDED_KEYSIZE: ULONG = 0x00000080; +pub const BCRYPT_ENABLE_INCOMPATIBLE_FIPS_CHECKS: ULONG = 0x00000100; +extern "system" { + pub fn BCryptOpenAlgorithmProvider( + phAlgorithm: *mut BCRYPT_ALG_HANDLE, + pszAlgId: LPCWSTR, + pszImplementation: LPCWSTR, + dwFlags: ULONG, + ) -> NTSTATUS; +} +pub const BCRYPT_CIPHER_OPERATION: ULONG = 0x00000001; +pub const BCRYPT_HASH_OPERATION: ULONG = 0x00000002; +pub const BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION: ULONG = 0x00000004; +pub const BCRYPT_SECRET_AGREEMENT_OPERATION: ULONG = 0x00000008; +pub const BCRYPT_SIGNATURE_OPERATION: ULONG = 0x00000010; +pub const BCRYPT_RNG_OPERATION: ULONG = 0x00000020; +pub const BCRYPT_KEY_DERIVATION_OPERATION: ULONG = 0x00000040; +STRUCT!{struct BCRYPT_ALGORITHM_IDENTIFIER { + pszName: LPWSTR, + dwClass: ULONG, + dwFlags: ULONG, +}} +extern "system" { + pub fn BCryptEnumAlgorithms( + dwAlgOperations: ULONG, + pAlgCount: *mut ULONG, + ppAlgList: *mut *mut BCRYPT_ALGORITHM_IDENTIFIER, + dwFlags: ULONG, + ) -> NTSTATUS; +} +STRUCT!{struct BCRYPT_PROVIDER_NAME { + pszProviderName: LPWSTR, +}} +extern "system" { + pub fn BCryptEnumProviders( + pszAlgId: LPCWSTR, + pImplCount: *mut ULONG, + ppImplList: *mut *mut BCRYPT_PROVIDER_NAME, + dwFlags: ULONG, + ) -> NTSTATUS; +} +pub const BCRYPT_PUBLIC_KEY_FLAG: ULONG = 0x00000001; +pub const BCRYPT_PRIVATE_KEY_FLAG: ULONG = 0x00000002; +extern "system" { + pub fn BCryptGetProperty( + hObject: BCRYPT_HANDLE, + pszProperty: LPCWSTR, + pbOutput: PUCHAR, + cbOutput: ULONG, + pcbResult: *mut ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptSetProperty( + hObject: BCRYPT_HANDLE, + pszProperty: LPCWSTR, + pbInput: PUCHAR, + cbInput: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptCloseAlgorithmProvider( + hAlgorithm: BCRYPT_ALG_HANDLE, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptFreeBuffer( + pvBuffer: PVOID, + ); + pub fn BCryptGenerateSymmetricKey( + hAlgorithm: BCRYPT_ALG_HANDLE, + phKey: *mut BCRYPT_KEY_HANDLE, + pbKeyObject: PUCHAR, + cbKeyObject: ULONG, + pbSecret: PUCHAR, + cbSecret: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptGenerateKeyPair( + hAlgorithm: BCRYPT_ALG_HANDLE, + phKey: *mut BCRYPT_KEY_HANDLE, + dwLength: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptEncrypt( + hKey: BCRYPT_KEY_HANDLE, + pbInput: PUCHAR, + cbInput: ULONG, + pPaddingInfo: *mut VOID, + pbIV: PUCHAR, + cbIV: ULONG, + pbOutput: PUCHAR, + cbOutput: ULONG, + pcbResult: *mut ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDecrypt( + hKey: BCRYPT_KEY_HANDLE, + pbInput: PUCHAR, + cbInput: ULONG, + pPaddingInfo: *mut VOID, + pbIV: PUCHAR, + cbIV: ULONG, + pbOutput: PUCHAR, + cbOutput: ULONG, + pcbResult: *mut ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptExportKey( + hKey: BCRYPT_KEY_HANDLE, + hExportKey: BCRYPT_KEY_HANDLE, + pszBlobType: LPCWSTR, + pbOutput: PUCHAR, + cbOutput: ULONG, + pcbResult: *mut ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptImportKey( + hAlgorithm: BCRYPT_ALG_HANDLE, + hImportKey: BCRYPT_KEY_HANDLE, + pszBlobType: LPCWSTR, + phKey: *mut BCRYPT_KEY_HANDLE, + pbKeyObject: PUCHAR, + cbKeyObject: ULONG, + pbInput: PUCHAR, + cbInput: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; +} +pub const BCRYPT_NO_KEY_VALIDATION: ULONG = 0x00000008; +extern "system" { + pub fn BCryptImportKeyPair( + hAlgorithm: BCRYPT_ALG_HANDLE, + hImportKey: BCRYPT_KEY_HANDLE, + pszBlobType: LPCWSTR, + phKey: *mut BCRYPT_KEY_HANDLE, + pbInput: PUCHAR, + cbInput: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDuplicateKey( + hKey: BCRYPT_KEY_HANDLE, + phNewKey: *mut BCRYPT_KEY_HANDLE, + pbKeyObject: PUCHAR, + cbKeyObject: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptFinalizeKeyPair( + hKey: BCRYPT_KEY_HANDLE, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDestroyKey( + hKey: BCRYPT_KEY_HANDLE, + ) -> NTSTATUS; + pub fn BCryptDestroySecret( + hSecret: BCRYPT_SECRET_HANDLE, + ) -> NTSTATUS; + pub fn BCryptSignHash( + hKey: BCRYPT_KEY_HANDLE, + pPaddingInfo: *mut VOID, + pbInput: PUCHAR, + cbInput: ULONG, + pbOutput: PUCHAR, + cbOutput: ULONG, + pcbResult: *mut ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptVerifySignature( + hKey: BCRYPT_KEY_HANDLE, + pPaddingInfo: *mut VOID, + pbHash: PUCHAR, + cbHash: ULONG, + pbSignature: PUCHAR, + cbSignature: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptSecretAgreement( + hPrivKey: BCRYPT_KEY_HANDLE, + hPubKey: BCRYPT_KEY_HANDLE, + phAgreedSecret: *mut BCRYPT_SECRET_HANDLE, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDeriveKey( + hSharedSecret: BCRYPT_SECRET_HANDLE, + pwszKDF: LPCWSTR, + pParameterList: *mut BCryptBufferDesc, + pbDerivedKey: PUCHAR, + cbDerivedKey: ULONG, + pcbResult: *mut ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptKeyDerivation( + hKey: BCRYPT_KEY_HANDLE, + pParameterList: *mut BCryptBufferDesc, + pbDerivedKey: PUCHAR, + cbDerivedKey: ULONG, + pcbResult: *mut ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptCreateHash( + hAlgorithm: BCRYPT_ALG_HANDLE, + phHash: *mut BCRYPT_HASH_HANDLE, + pbHashObject: PUCHAR, + cbHashObject: ULONG, + pbSecret: PUCHAR, + cbSecret: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptHashData( + hHash: BCRYPT_HASH_HANDLE, + pbInput: PUCHAR, + cbInput: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptFinishHash( + hHash: BCRYPT_HASH_HANDLE, + pbOutput: PUCHAR, + cbOutput: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptCreateMultiHash( + hAlgorithm: BCRYPT_ALG_HANDLE, + phHash: *mut BCRYPT_HASH_HANDLE, + nHashes: ULONG, + pbHashObject: PUCHAR, + cbHashObject: ULONG, + pbSecret: PUCHAR, + cbSecret: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptProcessMultiOperations( + hObject: BCRYPT_HANDLE, + operationType: BCRYPT_MULTI_OPERATION_TYPE, + pOperations: PVOID, + cbOperations: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDuplicateHash( + hHash: BCRYPT_HASH_HANDLE, + phNewHash: *mut BCRYPT_HASH_HANDLE, + pbHashObject: PUCHAR, + cbHashObject: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDestroyHash( + hHash: BCRYPT_HASH_HANDLE, + ) -> NTSTATUS; + pub fn BCryptHash( + hAlgorithm: BCRYPT_ALG_HANDLE, + pbSecret: PUCHAR, + cbSecret: ULONG, + pbInput: PUCHAR, + cbInput: ULONG, + pbOutput: PUCHAR, + cbOutput: ULONG, + ) -> NTSTATUS; +} +pub const BCRYPT_RNG_USE_ENTROPY_IN_BUFFER: ULONG = 0x00000001; +pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: ULONG = 0x00000002; +extern "system" { + pub fn BCryptGenRandom( + hAlgorithm: BCRYPT_ALG_HANDLE, + pbBuffer: PUCHAR, + cbBuffer: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDeriveKeyCapi( + hHash: BCRYPT_HASH_HANDLE, + hTargetAlg: BCRYPT_ALG_HANDLE, + pbDerivedKey: PUCHAR, + cbDerivedKey: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; + pub fn BCryptDeriveKeyPBKDF2( + hPrf: BCRYPT_ALG_HANDLE, + pbPassword: PUCHAR, + cbPassword: ULONG, + pbSalt: PUCHAR, + cbSalt: ULONG, + cIterations: ULONGLONG, + pbDerivedKey: PUCHAR, + cbDerivedKey: ULONG, + dwFlags: ULONG, + ) -> NTSTATUS; +} +STRUCT!{struct BCRYPT_INTERFACE_VERSION { + MajorVersion: USHORT, + MinorVersion: USHORT, +}} +pub type PBCRYPT_INTERFACE_VERSION = *mut BCRYPT_INTERFACE_VERSION; +#[inline] +pub fn BCRYPT_IS_INTERFACE_VERSION_COMPATIBLE( + loader: BCRYPT_INTERFACE_VERSION, + provider: BCRYPT_INTERFACE_VERSION, +) -> bool { + loader.MajorVersion <= provider.MajorVersion +} +pub const BCRYPT_CIPHER_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_HASH_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_HASH_INTERFACE_MAJORVERSION_2: USHORT = 2; +pub const BCRYPT_HASH_INTERFACE_VERSION_2: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(BCRYPT_HASH_INTERFACE_MAJORVERSION_2, 0); +pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_SECRET_AGREEMENT_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_SIGNATURE_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const BCRYPT_RNG_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = + BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); +pub const CRYPT_MIN_DEPENDENCIES: ULONG = 0x00000001; +pub const CRYPT_PROCESS_ISOLATE: ULONG = 0x00010000; +pub const CRYPT_UM: ULONG = 0x00000001; +pub const CRYPT_KM: ULONG = 0x00000002; +pub const CRYPT_MM: ULONG = 0x00000003; +pub const CRYPT_ANY: ULONG = 0x00000004; +pub const CRYPT_OVERWRITE: ULONG = 0x00000001; +pub const CRYPT_LOCAL: ULONG = 0x00000001; +pub const CRYPT_DOMAIN: ULONG = 0x00000002; +pub const CRYPT_EXCLUSIVE: ULONG = 0x00000001; +pub const CRYPT_OVERRIDE: ULONG = 0x00010000; +pub const CRYPT_ALL_FUNCTIONS: ULONG = 0x00000001; +pub const CRYPT_ALL_PROVIDERS: ULONG = 0x00000002; +pub const CRYPT_PRIORITY_TOP: ULONG = 0x00000000; +pub const CRYPT_PRIORITY_BOTTOM: ULONG = 0xFFFFFFFF; +pub const CRYPT_DEFAULT_CONTEXT: &'static str = "Default"; +STRUCT!{struct CRYPT_INTERFACE_REG { + dwInterface: ULONG, + dwFlags: ULONG, + cFunctions: ULONG, + rgpszFunctions: *mut PWSTR, +}} +pub type PCRYPT_INTERFACE_REG = *mut CRYPT_INTERFACE_REG; +STRUCT!{struct CRYPT_IMAGE_REG { + pszImage: PWSTR, + cInterfaces: ULONG, + rgpInterfaces: *mut PCRYPT_INTERFACE_REG, +}} +pub type PCRYPT_IMAGE_REG = *mut CRYPT_IMAGE_REG; +STRUCT!{struct CRYPT_PROVIDER_REG { + cAliases: ULONG, + rgpszAliases: *mut PWSTR, + pUM: PCRYPT_IMAGE_REG, + pKM: PCRYPT_IMAGE_REG, +}} +pub type PCRYPT_PROVIDER_REG = *mut CRYPT_PROVIDER_REG; +STRUCT!{struct CRYPT_PROVIDERS { + cProviders: ULONG, + rgpszProviders: *mut PWSTR, +}} +pub type PCRYPT_PROVIDERS = *mut CRYPT_PROVIDERS; +STRUCT!{struct CRYPT_CONTEXT_CONFIG { + dwFlags: ULONG, + dwReserved: ULONG, +}} +pub type PCRYPT_CONTEXT_CONFIG = *mut CRYPT_CONTEXT_CONFIG; +STRUCT!{struct CRYPT_CONTEXT_FUNCTION_CONFIG { + dwFlags: ULONG, + dwReserved: ULONG, +}} +pub type PCRYPT_CONTEXT_FUNCTION_CONFIG = *mut CRYPT_CONTEXT_FUNCTION_CONFIG; +STRUCT!{struct CRYPT_CONTEXTS { + cContexts: ULONG, + rgpszContexts: *mut PWSTR, +}} +pub type PCRYPT_CONTEXTS = *mut CRYPT_CONTEXTS; +STRUCT!{struct CRYPT_CONTEXT_FUNCTIONS { + cFunctions: ULONG, + rgpszFunctions: *mut PWSTR, +}} +pub type PCRYPT_CONTEXT_FUNCTIONS = *mut CRYPT_CONTEXT_FUNCTIONS; +STRUCT!{struct CRYPT_CONTEXT_FUNCTION_PROVIDERS { + cProviders: ULONG, + rgpszProviders: *mut PWSTR, +}} +pub type PCRYPT_CONTEXT_FUNCTION_PROVIDERS = *mut CRYPT_CONTEXT_FUNCTION_PROVIDERS; +STRUCT!{struct CRYPT_PROPERTY_REF { + pszProperty: PWSTR, + cbValue: ULONG, + pbValue: PUCHAR, +}} +pub type PCRYPT_PROPERTY_REF = *mut CRYPT_PROPERTY_REF; +STRUCT!{struct CRYPT_IMAGE_REF { + pszImage: PWSTR, + dwFlags: ULONG, +}} +pub type PCRYPT_IMAGE_REF = *mut CRYPT_IMAGE_REF; +STRUCT!{struct CRYPT_PROVIDER_REF { + dwInterface: ULONG, + pszFunction: PWSTR, + pszProvider: PWSTR, + cProperties: ULONG, + rgpProperties: *mut PCRYPT_PROPERTY_REF, + pUM: PCRYPT_IMAGE_REF, + pKM: PCRYPT_IMAGE_REF, +}} +pub type PCRYPT_PROVIDER_REF = *mut CRYPT_PROVIDER_REF; +STRUCT!{struct CRYPT_PROVIDER_REFS { + cProviders: ULONG, + rgpProviders: *mut PCRYPT_PROVIDER_REF, +}} +pub type PCRYPT_PROVIDER_REFS = *mut CRYPT_PROVIDER_REFS; +extern "system" { + pub fn BCryptQueryProviderRegistration( + pszProvider: LPCWSTR, + dwMode: ULONG, + dwInterface: ULONG, + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_PROVIDER_REG, + ) -> NTSTATUS; + pub fn BCryptEnumRegisteredProviders( + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_PROVIDERS, + ) -> NTSTATUS; + pub fn BCryptCreateContext( + dwTable: ULONG, + pszContext: LPCWSTR, + pConfig: PCRYPT_CONTEXT_CONFIG, + ) -> NTSTATUS; + pub fn BCryptDeleteContext( + dwTable: ULONG, + pszContext: LPCWSTR, + ) -> NTSTATUS; + pub fn BCryptEnumContexts( + dwTable: ULONG, + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_CONTEXTS, + ) -> NTSTATUS; + pub fn BCryptConfigureContext( + dwTable: ULONG, + pszContext: LPCWSTR, + pConfig: PCRYPT_CONTEXT_CONFIG, + ) -> NTSTATUS; + pub fn BCryptQueryContextConfiguration( + dwTable: ULONG, + pszContext: LPCWSTR, + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_CONTEXT_CONFIG, + ) -> NTSTATUS; + pub fn BCryptAddContextFunction( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + dwPosition: ULONG, + ) -> NTSTATUS; + pub fn BCryptRemoveContextFunction( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + ) -> NTSTATUS; + pub fn BCryptEnumContextFunctions( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_CONTEXT_FUNCTIONS, + ) -> NTSTATUS; + pub fn BCryptConfigureContextFunction( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + pConfig: PCRYPT_CONTEXT_FUNCTION_CONFIG, + ) -> NTSTATUS; + pub fn BCryptQueryContextFunctionConfiguration( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_CONTEXT_FUNCTION_CONFIG, + ) -> NTSTATUS; + pub fn BCryptEnumContextFunctionProviders( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_CONTEXT_FUNCTION_PROVIDERS, + ) -> NTSTATUS; + pub fn BCryptSetContextFunctionProperty( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + pszProperty: LPCWSTR, + cbValue: ULONG, + pbValue: PUCHAR, + ) -> NTSTATUS; + pub fn BCryptQueryContextFunctionProperty( + dwTable: ULONG, + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + pszProperty: LPCWSTR, + pcbValue: *mut ULONG, + ppbValue: *mut PUCHAR, + ) -> NTSTATUS; + pub fn BCryptRegisterConfigChangeNotify( + phEvent: *mut HANDLE, + ) -> NTSTATUS; + pub fn BCryptUnregisterConfigChangeNotify( + hEvent: HANDLE, + ) -> NTSTATUS; + pub fn BCryptResolveProviders( + pszContext: LPCWSTR, + dwInterface: ULONG, + pszFunction: LPCWSTR, + pszProvider: LPCWSTR, + dwMode: ULONG, + dwFlags: ULONG, + pcbBuffer: *mut ULONG, + ppBuffer: *mut PCRYPT_PROVIDER_REFS, + ) -> NTSTATUS; + pub fn BCryptGetFipsAlgorithmMode( + pfEnabled: *mut BOOLEAN, + ) -> NTSTATUS; + pub fn CngGetFipsAlgorithmMode() -> BOOLEAN; +} diff --git a/src/vendor/winapi/src/shared/bugcodes.rs b/src/vendor/winapi/src/shared/bugcodes.rs new file mode 100644 index 0000000000..18356eb472 --- /dev/null +++ b/src/vendor/winapi/src/shared/bugcodes.rs @@ -0,0 +1,457 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Definitions of system bug check codes +use shared::ntdef::ULONG; +pub const HARDWARE_PROFILE_UNDOCKED_STRING: ULONG = 0x40010001; +pub const HARDWARE_PROFILE_DOCKED_STRING: ULONG = 0x40010002; +pub const HARDWARE_PROFILE_UNKNOWN_STRING: ULONG = 0x40010003; +pub const WINDOWS_NT_BANNER: ULONG = 0x4000007E; +pub const WINDOWS_NT_CSD_STRING: ULONG = 0x40000087; +pub const WINDOWS_NT_INFO_STRING: ULONG = 0x40000088; +pub const WINDOWS_NT_MP_STRING: ULONG = 0x40000089; +pub const THREAD_TERMINATE_HELD_MUTEX: ULONG = 0x4000008A; +pub const WINDOWS_NT_INFO_STRING_PLURAL: ULONG = 0x4000009D; +pub const WINDOWS_NT_RC_STRING: ULONG = 0x4000009E; +pub const APC_INDEX_MISMATCH: ULONG = 0x00000001; +pub const DEVICE_QUEUE_NOT_BUSY: ULONG = 0x00000002; +pub const INVALID_AFFINITY_SET: ULONG = 0x00000003; +pub const INVALID_DATA_ACCESS_TRAP: ULONG = 0x00000004; +pub const INVALID_PROCESS_ATTACH_ATTEMPT: ULONG = 0x00000005; +pub const INVALID_PROCESS_DETACH_ATTEMPT: ULONG = 0x00000006; +pub const INVALID_SOFTWARE_INTERRUPT: ULONG = 0x00000007; +pub const IRQL_NOT_DISPATCH_LEVEL: ULONG = 0x00000008; +pub const IRQL_NOT_GREATER_OR_EQUAL: ULONG = 0x00000009; +pub const IRQL_NOT_LESS_OR_EQUAL: ULONG = 0x0000000A; +pub const NO_EXCEPTION_HANDLING_SUPPORT: ULONG = 0x0000000B; +pub const MAXIMUM_WAIT_OBJECTS_EXCEEDED: ULONG = 0x0000000C; +pub const MUTEX_LEVEL_NUMBER_VIOLATION: ULONG = 0x0000000D; +pub const NO_USER_MODE_CONTEXT: ULONG = 0x0000000E; +pub const SPIN_LOCK_ALREADY_OWNED: ULONG = 0x0000000F; +pub const SPIN_LOCK_NOT_OWNED: ULONG = 0x00000010; +pub const THREAD_NOT_MUTEX_OWNER: ULONG = 0x00000011; +pub const TRAP_CAUSE_UNKNOWN: ULONG = 0x00000012; +pub const EMPTY_THREAD_REAPER_LIST: ULONG = 0x00000013; +pub const CREATE_DELETE_LOCK_NOT_LOCKED: ULONG = 0x00000014; +pub const LAST_CHANCE_CALLED_FROM_KMODE: ULONG = 0x00000015; +pub const CID_HANDLE_CREATION: ULONG = 0x00000016; +pub const CID_HANDLE_DELETION: ULONG = 0x00000017; +pub const REFERENCE_BY_POINTER: ULONG = 0x00000018; +pub const BAD_POOL_HEADER: ULONG = 0x00000019; +pub const MEMORY_MANAGEMENT: ULONG = 0x0000001A; +pub const PFN_SHARE_COUNT: ULONG = 0x0000001B; +pub const PFN_REFERENCE_COUNT: ULONG = 0x0000001C; +pub const NO_SPIN_LOCK_AVAILABLE: ULONG = 0x0000001D; +pub const KMODE_EXCEPTION_NOT_HANDLED: ULONG = 0x0000001E; +pub const SHARED_RESOURCE_CONV_ERROR: ULONG = 0x0000001F; +pub const KERNEL_APC_PENDING_DURING_EXIT: ULONG = 0x00000020; +pub const QUOTA_UNDERFLOW: ULONG = 0x00000021; +pub const FILE_SYSTEM: ULONG = 0x00000022; +pub const FAT_FILE_SYSTEM: ULONG = 0x00000023; +pub const NTFS_FILE_SYSTEM: ULONG = 0x00000024; +pub const NPFS_FILE_SYSTEM: ULONG = 0x00000025; +pub const CDFS_FILE_SYSTEM: ULONG = 0x00000026; +pub const RDR_FILE_SYSTEM: ULONG = 0x00000027; +pub const CORRUPT_ACCESS_TOKEN: ULONG = 0x00000028; +pub const SECURITY_SYSTEM: ULONG = 0x00000029; +pub const INCONSISTENT_IRP: ULONG = 0x0000002A; +pub const PANIC_STACK_SWITCH: ULONG = 0x0000002B; +pub const PORT_DRIVER_INTERNAL: ULONG = 0x0000002C; +pub const SCSI_DISK_DRIVER_INTERNAL: ULONG = 0x0000002D; +pub const DATA_BUS_ERROR: ULONG = 0x0000002E; +pub const INSTRUCTION_BUS_ERROR: ULONG = 0x0000002F; +pub const SET_OF_INVALID_CONTEXT: ULONG = 0x00000030; +pub const PHASE0_INITIALIZATION_FAILED: ULONG = 0x00000031; +pub const PHASE1_INITIALIZATION_FAILED: ULONG = 0x00000032; +pub const UNEXPECTED_INITIALIZATION_CALL: ULONG = 0x00000033; +pub const CACHE_MANAGER: ULONG = 0x00000034; +pub const NO_MORE_IRP_STACK_LOCATIONS: ULONG = 0x00000035; +pub const DEVICE_REFERENCE_COUNT_NOT_ZERO: ULONG = 0x00000036; +pub const FLOPPY_INTERNAL_ERROR: ULONG = 0x00000037; +pub const SERIAL_DRIVER_INTERNAL: ULONG = 0x00000038; +pub const SYSTEM_EXIT_OWNED_MUTEX: ULONG = 0x00000039; +pub const SYSTEM_UNWIND_PREVIOUS_USER: ULONG = 0x0000003A; +pub const SYSTEM_SERVICE_EXCEPTION: ULONG = 0x0000003B; +pub const INTERRUPT_UNWIND_ATTEMPTED: ULONG = 0x0000003C; +pub const INTERRUPT_EXCEPTION_NOT_HANDLED: ULONG = 0x0000003D; +pub const MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED: ULONG = 0x0000003E; +pub const NO_MORE_SYSTEM_PTES: ULONG = 0x0000003F; +pub const TARGET_MDL_TOO_SMALL: ULONG = 0x00000040; +pub const MUST_SUCCEED_POOL_EMPTY: ULONG = 0x00000041; +pub const ATDISK_DRIVER_INTERNAL: ULONG = 0x00000042; +pub const NO_SUCH_PARTITION: ULONG = 0x00000043; +pub const MULTIPLE_IRP_COMPLETE_REQUESTS: ULONG = 0x00000044; +pub const INSUFFICIENT_SYSTEM_MAP_REGS: ULONG = 0x00000045; +pub const DEREF_UNKNOWN_LOGON_SESSION: ULONG = 0x00000046; +pub const REF_UNKNOWN_LOGON_SESSION: ULONG = 0x00000047; +pub const CANCEL_STATE_IN_COMPLETED_IRP: ULONG = 0x00000048; +pub const PAGE_FAULT_WITH_INTERRUPTS_OFF: ULONG = 0x00000049; +pub const IRQL_GT_ZERO_AT_SYSTEM_SERVICE: ULONG = 0x0000004A; +pub const STREAMS_INTERNAL_ERROR: ULONG = 0x0000004B; +pub const FATAL_UNHANDLED_HARD_ERROR: ULONG = 0x0000004C; +pub const NO_PAGES_AVAILABLE: ULONG = 0x0000004D; +pub const PFN_LIST_CORRUPT: ULONG = 0x0000004E; +pub const NDIS_INTERNAL_ERROR: ULONG = 0x0000004F; +pub const PAGE_FAULT_IN_NONPAGED_AREA: ULONG = 0x00000050; +pub const PAGE_FAULT_IN_NONPAGED_AREA_M: ULONG = 0x10000050; +pub const REGISTRY_ERROR: ULONG = 0x00000051; +pub const MAILSLOT_FILE_SYSTEM: ULONG = 0x00000052; +pub const NO_BOOT_DEVICE: ULONG = 0x00000053; +pub const LM_SERVER_INTERNAL_ERROR: ULONG = 0x00000054; +pub const DATA_COHERENCY_EXCEPTION: ULONG = 0x00000055; +pub const INSTRUCTION_COHERENCY_EXCEPTION: ULONG = 0x00000056; +pub const XNS_INTERNAL_ERROR: ULONG = 0x00000057; +pub const VOLMGRX_INTERNAL_ERROR: ULONG = 0x00000058; +pub const PINBALL_FILE_SYSTEM: ULONG = 0x00000059; +pub const CRITICAL_SERVICE_FAILED: ULONG = 0x0000005A; +pub const SET_ENV_VAR_FAILED: ULONG = 0x0000005B; +pub const HAL_INITIALIZATION_FAILED: ULONG = 0x0000005C; +pub const UNSUPPORTED_PROCESSOR: ULONG = 0x0000005D; +pub const OBJECT_INITIALIZATION_FAILED: ULONG = 0x0000005E; +pub const SECURITY_INITIALIZATION_FAILED: ULONG = 0x0000005F; +pub const PROCESS_INITIALIZATION_FAILED: ULONG = 0x00000060; +pub const HAL1_INITIALIZATION_FAILED: ULONG = 0x00000061; +pub const OBJECT1_INITIALIZATION_FAILED: ULONG = 0x00000062; +pub const SECURITY1_INITIALIZATION_FAILED: ULONG = 0x00000063; +pub const SYMBOLIC_INITIALIZATION_FAILED: ULONG = 0x00000064; +pub const MEMORY1_INITIALIZATION_FAILED: ULONG = 0x00000065; +pub const CACHE_INITIALIZATION_FAILED: ULONG = 0x00000066; +pub const CONFIG_INITIALIZATION_FAILED: ULONG = 0x00000067; +pub const FILE_INITIALIZATION_FAILED: ULONG = 0x00000068; +pub const IO1_INITIALIZATION_FAILED: ULONG = 0x00000069; +pub const LPC_INITIALIZATION_FAILED: ULONG = 0x0000006A; +pub const PROCESS1_INITIALIZATION_FAILED: ULONG = 0x0000006B; +pub const REFMON_INITIALIZATION_FAILED: ULONG = 0x0000006C; +pub const SESSION1_INITIALIZATION_FAILED: ULONG = 0x0000006D; +pub const BOOTPROC_INITIALIZATION_FAILED: ULONG = 0x0000006E; +pub const VSL_INITIALIZATION_FAILED: ULONG = 0x0000006F; +pub const SOFT_RESTART_FATAL_ERROR: ULONG = 0x00000070; +pub const ASSIGN_DRIVE_LETTERS_FAILED: ULONG = 0x00000072; +pub const CONFIG_LIST_FAILED: ULONG = 0x00000073; +pub const BAD_SYSTEM_CONFIG_INFO: ULONG = 0x00000074; +pub const CANNOT_WRITE_CONFIGURATION: ULONG = 0x00000075; +pub const PROCESS_HAS_LOCKED_PAGES: ULONG = 0x00000076; +pub const KERNEL_STACK_INPAGE_ERROR: ULONG = 0x00000077; +pub const PHASE0_EXCEPTION: ULONG = 0x00000078; +pub const MISMATCHED_HAL: ULONG = 0x00000079; +pub const KERNEL_DATA_INPAGE_ERROR: ULONG = 0x0000007A; +pub const INACCESSIBLE_BOOT_DEVICE: ULONG = 0x0000007B; +pub const BUGCODE_NDIS_DRIVER: ULONG = 0x0000007C; +pub const INSTALL_MORE_MEMORY: ULONG = 0x0000007D; +pub const SYSTEM_THREAD_EXCEPTION_NOT_HANDLED: ULONG = 0x0000007E; +pub const SYSTEM_THREAD_EXCEPTION_NOT_HANDLED_M: ULONG = 0x1000007E; +pub const UNEXPECTED_KERNEL_MODE_TRAP: ULONG = 0x0000007F; +pub const UNEXPECTED_KERNEL_MODE_TRAP_M: ULONG = 0x1000007F; +pub const NMI_HARDWARE_FAILURE: ULONG = 0x00000080; +pub const SPIN_LOCK_INIT_FAILURE: ULONG = 0x00000081; +pub const DFS_FILE_SYSTEM: ULONG = 0x00000082; +pub const OFS_FILE_SYSTEM: ULONG = 0x00000083; +pub const RECOM_DRIVER: ULONG = 0x00000084; +pub const SETUP_FAILURE: ULONG = 0x00000085; +pub const AUDIT_FAILURE: ULONG = 0x00000086; +pub const MBR_CHECKSUM_MISMATCH: ULONG = 0x0000008B; +pub const KERNEL_MODE_EXCEPTION_NOT_HANDLED: ULONG = 0x0000008E; +pub const KERNEL_MODE_EXCEPTION_NOT_HANDLED_M: ULONG = 0x1000008E; +pub const PP0_INITIALIZATION_FAILED: ULONG = 0x0000008F; +pub const PP1_INITIALIZATION_FAILED: ULONG = 0x00000090; +pub const WIN32K_INIT_OR_RIT_FAILURE: ULONG = 0x00000091; +pub const UP_DRIVER_ON_MP_SYSTEM: ULONG = 0x00000092; +pub const INVALID_KERNEL_HANDLE: ULONG = 0x00000093; +pub const KERNEL_STACK_LOCKED_AT_EXIT: ULONG = 0x00000094; +pub const PNP_INTERNAL_ERROR: ULONG = 0x00000095; +pub const INVALID_WORK_QUEUE_ITEM: ULONG = 0x00000096; +pub const BOUND_IMAGE_UNSUPPORTED: ULONG = 0x00000097; +pub const END_OF_NT_EVALUATION_PERIOD: ULONG = 0x00000098; +pub const INVALID_REGION_OR_SEGMENT: ULONG = 0x00000099; +pub const SYSTEM_LICENSE_VIOLATION: ULONG = 0x0000009A; +pub const UDFS_FILE_SYSTEM: ULONG = 0x0000009B; +pub const MACHINE_CHECK_EXCEPTION: ULONG = 0x0000009C; +pub const USER_MODE_HEALTH_MONITOR: ULONG = 0x0000009E; +pub const DRIVER_POWER_STATE_FAILURE: ULONG = 0x0000009F; +pub const INTERNAL_POWER_ERROR: ULONG = 0x000000A0; +pub const PCI_BUS_DRIVER_INTERNAL: ULONG = 0x000000A1; +pub const MEMORY_IMAGE_CORRUPT: ULONG = 0x000000A2; +pub const ACPI_DRIVER_INTERNAL: ULONG = 0x000000A3; +pub const CNSS_FILE_SYSTEM_FILTER: ULONG = 0x000000A4; +pub const ACPI_BIOS_ERROR: ULONG = 0x000000A5; +pub const FP_EMULATION_ERROR: ULONG = 0x000000A6; +pub const BAD_EXHANDLE: ULONG = 0x000000A7; +pub const BOOTING_IN_SAFEMODE_MINIMAL: ULONG = 0x000000A8; +pub const BOOTING_IN_SAFEMODE_NETWORK: ULONG = 0x000000A9; +pub const BOOTING_IN_SAFEMODE_DSREPAIR: ULONG = 0x000000AA; +pub const SESSION_HAS_VALID_POOL_ON_EXIT: ULONG = 0x000000AB; +pub const HAL_MEMORY_ALLOCATION: ULONG = 0x000000AC; +pub const VIDEO_DRIVER_DEBUG_REPORT_REQUEST: ULONG = 0x400000AD; +pub const BGI_DETECTED_VIOLATION: ULONG = 0x000000B1; +pub const VIDEO_DRIVER_INIT_FAILURE: ULONG = 0x000000B4; +pub const BOOTLOG_LOADED: ULONG = 0x000000B5; +pub const BOOTLOG_NOT_LOADED: ULONG = 0x000000B6; +pub const BOOTLOG_ENABLED: ULONG = 0x000000B7; +pub const ATTEMPTED_SWITCH_FROM_DPC: ULONG = 0x000000B8; +pub const CHIPSET_DETECTED_ERROR: ULONG = 0x000000B9; +pub const SESSION_HAS_VALID_VIEWS_ON_EXIT: ULONG = 0x000000BA; +pub const NETWORK_BOOT_INITIALIZATION_FAILED: ULONG = 0x000000BB; +pub const NETWORK_BOOT_DUPLICATE_ADDRESS: ULONG = 0x000000BC; +pub const INVALID_HIBERNATED_STATE: ULONG = 0x000000BD; +pub const ATTEMPTED_WRITE_TO_READONLY_MEMORY: ULONG = 0x000000BE; +pub const MUTEX_ALREADY_OWNED: ULONG = 0x000000BF; +pub const PCI_CONFIG_SPACE_ACCESS_FAILURE: ULONG = 0x000000C0; +pub const SPECIAL_POOL_DETECTED_MEMORY_CORRUPTION: ULONG = 0x000000C1; +pub const BAD_POOL_CALLER: ULONG = 0x000000C2; +pub const SYSTEM_IMAGE_BAD_SIGNATURE: ULONG = 0x000000C3; +pub const DRIVER_VERIFIER_DETECTED_VIOLATION: ULONG = 0x000000C4; +pub const DRIVER_CORRUPTED_EXPOOL: ULONG = 0x000000C5; +pub const DRIVER_CAUGHT_MODIFYING_FREED_POOL: ULONG = 0x000000C6; +pub const TIMER_OR_DPC_INVALID: ULONG = 0x000000C7; +pub const IRQL_UNEXPECTED_VALUE: ULONG = 0x000000C8; +pub const DRIVER_VERIFIER_IOMANAGER_VIOLATION: ULONG = 0x000000C9; +pub const PNP_DETECTED_FATAL_ERROR: ULONG = 0x000000CA; +pub const DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS: ULONG = 0x000000CB; +pub const PAGE_FAULT_IN_FREED_SPECIAL_POOL: ULONG = 0x000000CC; +pub const PAGE_FAULT_BEYOND_END_OF_ALLOCATION: ULONG = 0x000000CD; +pub const DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS: ULONG = 0x000000CE; +pub const TERMINAL_SERVER_DRIVER_MADE_INCORRECT_MEMORY_REFERENCE: ULONG = 0x000000CF; +pub const DRIVER_CORRUPTED_MMPOOL: ULONG = 0x000000D0; +pub const DRIVER_IRQL_NOT_LESS_OR_EQUAL: ULONG = 0x000000D1; +pub const BUGCODE_ID_DRIVER: ULONG = 0x000000D2; +pub const DRIVER_PORTION_MUST_BE_NONPAGED: ULONG = 0x000000D3; +pub const SYSTEM_SCAN_AT_RAISED_IRQL_CAUGHT_IMPROPER_DRIVER_UNLOAD: ULONG = 0x000000D4; +pub const DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL: ULONG = 0x000000D5; +pub const DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION: ULONG = 0x000000D6; +pub const DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION_M: ULONG = 0x100000D6; +pub const DRIVER_UNMAPPING_INVALID_VIEW: ULONG = 0x000000D7; +pub const DRIVER_USED_EXCESSIVE_PTES: ULONG = 0x000000D8; +pub const LOCKED_PAGES_TRACKER_CORRUPTION: ULONG = 0x000000D9; +pub const SYSTEM_PTE_MISUSE: ULONG = 0x000000DA; +pub const DRIVER_CORRUPTED_SYSPTES: ULONG = 0x000000DB; +pub const DRIVER_INVALID_STACK_ACCESS: ULONG = 0x000000DC; +pub const POOL_CORRUPTION_IN_FILE_AREA: ULONG = 0x000000DE; +pub const IMPERSONATING_WORKER_THREAD: ULONG = 0x000000DF; +pub const ACPI_BIOS_FATAL_ERROR: ULONG = 0x000000E0; +pub const WORKER_THREAD_RETURNED_AT_BAD_IRQL: ULONG = 0x000000E1; +pub const MANUALLY_INITIATED_CRASH: ULONG = 0x000000E2; +pub const RESOURCE_NOT_OWNED: ULONG = 0x000000E3; +pub const WORKER_INVALID: ULONG = 0x000000E4; +pub const POWER_FAILURE_SIMULATE: ULONG = 0x000000E5; +pub const DRIVER_VERIFIER_DMA_VIOLATION: ULONG = 0x000000E6; +pub const INVALID_FLOATING_POINT_STATE: ULONG = 0x000000E7; +pub const INVALID_CANCEL_OF_FILE_OPEN: ULONG = 0x000000E8; +pub const ACTIVE_EX_WORKER_THREAD_TERMINATION: ULONG = 0x000000E9; +pub const SAVER_UNSPECIFIED: ULONG = 0x0000F000; +pub const SAVER_BLANKSCREEN: ULONG = 0x0000F002; +pub const SAVER_INPUT: ULONG = 0x0000F003; +pub const SAVER_WATCHDOG: ULONG = 0x0000F004; +pub const SAVER_STARTNOTVISIBLE: ULONG = 0x0000F005; +pub const SAVER_NAVIGATIONMODEL: ULONG = 0x0000F006; +pub const SAVER_OUTOFMEMORY: ULONG = 0x0000F007; +pub const SAVER_GRAPHICS: ULONG = 0x0000F008; +pub const SAVER_NAVSERVERTIMEOUT: ULONG = 0x0000F009; +pub const SAVER_CHROMEPROCESSCRASH: ULONG = 0x0000F00A; +pub const SAVER_NOTIFICATIONDISMISSAL: ULONG = 0x0000F00B; +pub const SAVER_SPEECHDISMISSAL: ULONG = 0x0000F00C; +pub const SAVER_CALLDISMISSAL: ULONG = 0x0000F00D; +pub const SAVER_APPBARDISMISSAL: ULONG = 0x0000F00E; +pub const SAVER_RILADAPTATIONCRASH: ULONG = 0x0000F00F; +pub const SAVER_APPLISTUNREACHABLE: ULONG = 0x0000F010; +pub const SAVER_REPORTNOTIFICATIONFAILURE: ULONG = 0x0000F011; +pub const SAVER_UNEXPECTEDSHUTDOWN: ULONG = 0x0000F012; +pub const SAVER_RPCFAILURE: ULONG = 0x0000F013; +pub const SAVER_AUXILIARYFULLDUMP: ULONG = 0x0000F014; +pub const SAVER_ACCOUNTPROVSVCINITFAILURE: ULONG = 0x0000F015; +pub const SAVER_MTBFCOMMANDTIMEOUT: ULONG = 0x00000315; +pub const SAVER_MTBFCOMMANDHANG: ULONG = 0x0000F101; +pub const SAVER_MTBFPASSBUGCHECK: ULONG = 0x0000F102; +pub const SAVER_MTBFIOERROR: ULONG = 0x0000F103; +pub const SAVER_RENDERTHREADHANG: ULONG = 0x0000F200; +pub const SAVER_RENDERMOBILEUIOOM: ULONG = 0x0000F201; +pub const SAVER_DEVICEUPDATEUNSPECIFIED: ULONG = 0x0000F300; +pub const SAVER_AUDIODRIVERHANG: ULONG = 0x0000F400; +pub const SAVER_BATTERYPULLOUT: ULONG = 0x0000F500; +pub const SAVER_MEDIACORETESTHANG: ULONG = 0x0000F600; +pub const SAVER_RESOURCEMANAGEMENT: ULONG = 0x0000F700; +pub const SAVER_CAPTURESERVICE: ULONG = 0x0000F800; +pub const SAVER_WAITFORSHELLREADY: ULONG = 0x0000F900; +pub const SAVER_NONRESPONSIVEPROCESS: ULONG = 0x00000194; +pub const SAVER_SICKAPPLICATION: ULONG = 0x00008866; +pub const THREAD_STUCK_IN_DEVICE_DRIVER: ULONG = 0x000000EA; +pub const THREAD_STUCK_IN_DEVICE_DRIVER_M: ULONG = 0x100000EA; +pub const DIRTY_MAPPED_PAGES_CONGESTION: ULONG = 0x000000EB; +pub const SESSION_HAS_VALID_SPECIAL_POOL_ON_EXIT: ULONG = 0x000000EC; +pub const UNMOUNTABLE_BOOT_VOLUME: ULONG = 0x000000ED; +pub const CRITICAL_PROCESS_DIED: ULONG = 0x000000EF; +pub const STORAGE_MINIPORT_ERROR: ULONG = 0x000000F0; +pub const SCSI_VERIFIER_DETECTED_VIOLATION: ULONG = 0x000000F1; +pub const HARDWARE_INTERRUPT_STORM: ULONG = 0x000000F2; +pub const DISORDERLY_SHUTDOWN: ULONG = 0x000000F3; +pub const CRITICAL_OBJECT_TERMINATION: ULONG = 0x000000F4; +pub const FLTMGR_FILE_SYSTEM: ULONG = 0x000000F5; +pub const PCI_VERIFIER_DETECTED_VIOLATION: ULONG = 0x000000F6; +pub const DRIVER_OVERRAN_STACK_BUFFER: ULONG = 0x000000F7; +pub const RAMDISK_BOOT_INITIALIZATION_FAILED: ULONG = 0x000000F8; +pub const DRIVER_RETURNED_STATUS_REPARSE_FOR_VOLUME_OPEN: ULONG = 0x000000F9; +pub const HTTP_DRIVER_CORRUPTED: ULONG = 0x000000FA; +pub const RECURSIVE_MACHINE_CHECK: ULONG = 0x000000FB; +pub const ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY: ULONG = 0x000000FC; +pub const DIRTY_NOWRITE_PAGES_CONGESTION: ULONG = 0x000000FD; +pub const BUGCODE_USB_DRIVER: ULONG = 0x000000FE; +pub const BC_BLUETOOTH_VERIFIER_FAULT: ULONG = 0x00000BFE; +pub const BC_BTHMINI_VERIFIER_FAULT: ULONG = 0x00000BFF; +pub const RESERVE_QUEUE_OVERFLOW: ULONG = 0x000000FF; +pub const LOADER_BLOCK_MISMATCH: ULONG = 0x00000100; +pub const CLOCK_WATCHDOG_TIMEOUT: ULONG = 0x00000101; +pub const DPC_WATCHDOG_TIMEOUT: ULONG = 0x00000102; +pub const MUP_FILE_SYSTEM: ULONG = 0x00000103; +pub const AGP_INVALID_ACCESS: ULONG = 0x00000104; +pub const AGP_GART_CORRUPTION: ULONG = 0x00000105; +pub const AGP_ILLEGALLY_REPROGRAMMED: ULONG = 0x00000106; +pub const KERNEL_EXPAND_STACK_ACTIVE: ULONG = 0x00000107; +pub const THIRD_PARTY_FILE_SYSTEM_FAILURE: ULONG = 0x00000108; +pub const CRITICAL_STRUCTURE_CORRUPTION: ULONG = 0x00000109; +pub const APP_TAGGING_INITIALIZATION_FAILED: ULONG = 0x0000010A; +pub const DFSC_FILE_SYSTEM: ULONG = 0x0000010B; +pub const FSRTL_EXTRA_CREATE_PARAMETER_VIOLATION: ULONG = 0x0000010C; +pub const WDF_VIOLATION: ULONG = 0x0000010D; +pub const VIDEO_MEMORY_MANAGEMENT_INTERNAL: ULONG = 0x0000010E; +pub const DRIVER_INVALID_CRUNTIME_PARAMETER: ULONG = 0x00000110; +pub const RECURSIVE_NMI: ULONG = 0x00000111; +pub const MSRPC_STATE_VIOLATION: ULONG = 0x00000112; +pub const VIDEO_DXGKRNL_FATAL_ERROR: ULONG = 0x00000113; +pub const VIDEO_SHADOW_DRIVER_FATAL_ERROR: ULONG = 0x00000114; +pub const AGP_INTERNAL: ULONG = 0x00000115; +pub const VIDEO_TDR_FAILURE: ULONG = 0x00000116; +pub const VIDEO_TDR_TIMEOUT_DETECTED: ULONG = 0x00000117; +pub const NTHV_GUEST_ERROR: ULONG = 0x00000118; +pub const VIDEO_SCHEDULER_INTERNAL_ERROR: ULONG = 0x00000119; +pub const EM_INITIALIZATION_ERROR: ULONG = 0x0000011A; +pub const DRIVER_RETURNED_HOLDING_CANCEL_LOCK: ULONG = 0x0000011B; +pub const ATTEMPTED_WRITE_TO_CM_PROTECTED_STORAGE: ULONG = 0x0000011C; +pub const EVENT_TRACING_FATAL_ERROR: ULONG = 0x0000011D; +pub const TOO_MANY_RECURSIVE_FAULTS: ULONG = 0x0000011E; +pub const INVALID_DRIVER_HANDLE: ULONG = 0x0000011F; +pub const BITLOCKER_FATAL_ERROR: ULONG = 0x00000120; +pub const DRIVER_VIOLATION: ULONG = 0x00000121; +pub const WHEA_INTERNAL_ERROR: ULONG = 0x00000122; +pub const CRYPTO_SELF_TEST_FAILURE: ULONG = 0x00000123; +pub const WHEA_UNCORRECTABLE_ERROR: ULONG = 0x00000124; +pub const NMR_INVALID_STATE: ULONG = 0x00000125; +pub const NETIO_INVALID_POOL_CALLER: ULONG = 0x00000126; +pub const PAGE_NOT_ZERO: ULONG = 0x00000127; +pub const WORKER_THREAD_RETURNED_WITH_BAD_IO_PRIORITY: ULONG = 0x00000128; +pub const WORKER_THREAD_RETURNED_WITH_BAD_PAGING_IO_PRIORITY: ULONG = 0x00000129; +pub const MUI_NO_VALID_SYSTEM_LANGUAGE: ULONG = 0x0000012A; +pub const FAULTY_HARDWARE_CORRUPTED_PAGE: ULONG = 0x0000012B; +pub const EXFAT_FILE_SYSTEM: ULONG = 0x0000012C; +pub const VOLSNAP_OVERLAPPED_TABLE_ACCESS: ULONG = 0x0000012D; +pub const INVALID_MDL_RANGE: ULONG = 0x0000012E; +pub const VHD_BOOT_INITIALIZATION_FAILED: ULONG = 0x0000012F; +pub const DYNAMIC_ADD_PROCESSOR_MISMATCH: ULONG = 0x00000130; +pub const INVALID_EXTENDED_PROCESSOR_STATE: ULONG = 0x00000131; +pub const RESOURCE_OWNER_POINTER_INVALID: ULONG = 0x00000132; +pub const DPC_WATCHDOG_VIOLATION: ULONG = 0x00000133; +pub const DRIVE_EXTENDER: ULONG = 0x00000134; +pub const REGISTRY_FILTER_DRIVER_EXCEPTION: ULONG = 0x00000135; +pub const VHD_BOOT_HOST_VOLUME_NOT_ENOUGH_SPACE: ULONG = 0x00000136; +pub const WIN32K_HANDLE_MANAGER: ULONG = 0x00000137; +pub const GPIO_CONTROLLER_DRIVER_ERROR: ULONG = 0x00000138; +pub const KERNEL_SECURITY_CHECK_FAILURE: ULONG = 0x00000139; +pub const KERNEL_MODE_HEAP_CORRUPTION: ULONG = 0x0000013A; +pub const PASSIVE_INTERRUPT_ERROR: ULONG = 0x0000013B; +pub const INVALID_IO_BOOST_STATE: ULONG = 0x0000013C; +pub const CRITICAL_INITIALIZATION_FAILURE: ULONG = 0x0000013D; +pub const ERRATA_WORKAROUND_UNSUCCESSFUL: ULONG = 0x0000013E; +pub const STORAGE_DEVICE_ABNORMALITY_DETECTED: ULONG = 0x00000140; +pub const VIDEO_ENGINE_TIMEOUT_DETECTED: ULONG = 0x00000141; +pub const VIDEO_TDR_APPLICATION_BLOCKED: ULONG = 0x00000142; +pub const PROCESSOR_DRIVER_INTERNAL: ULONG = 0x00000143; +pub const BUGCODE_USB3_DRIVER: ULONG = 0x00000144; +pub const SECURE_BOOT_VIOLATION: ULONG = 0x00000145; +pub const NDIS_NET_BUFFER_LIST_INFO_ILLEGALLY_TRANSFERRED: ULONG = 0x00000146; +pub const ABNORMAL_RESET_DETECTED: ULONG = 0x00000147; +pub const IO_OBJECT_INVALID: ULONG = 0x00000148; +pub const REFS_FILE_SYSTEM: ULONG = 0x00000149; +pub const KERNEL_WMI_INTERNAL: ULONG = 0x0000014A; +pub const SOC_SUBSYSTEM_FAILURE: ULONG = 0x0000014B; +pub const FATAL_ABNORMAL_RESET_ERROR: ULONG = 0x0000014C; +pub const EXCEPTION_SCOPE_INVALID: ULONG = 0x0000014D; +pub const SOC_CRITICAL_DEVICE_REMOVED: ULONG = 0x0000014E; +pub const PDC_WATCHDOG_TIMEOUT: ULONG = 0x0000014F; +pub const TCPIP_AOAC_NIC_ACTIVE_REFERENCE_LEAK: ULONG = 0x00000150; +pub const UNSUPPORTED_INSTRUCTION_MODE: ULONG = 0x00000151; +pub const INVALID_PUSH_LOCK_FLAGS: ULONG = 0x00000152; +pub const KERNEL_LOCK_ENTRY_LEAKED_ON_THREAD_TERMINATION: ULONG = 0x00000153; +pub const UNEXPECTED_STORE_EXCEPTION: ULONG = 0x00000154; +pub const OS_DATA_TAMPERING: ULONG = 0x00000155; +pub const WINSOCK_DETECTED_HUNG_CLOSESOCKET_LIVEDUMP: ULONG = 0x00000156; +pub const KERNEL_THREAD_PRIORITY_FLOOR_VIOLATION: ULONG = 0x00000157; +pub const ILLEGAL_IOMMU_PAGE_FAULT: ULONG = 0x00000158; +pub const HAL_ILLEGAL_IOMMU_PAGE_FAULT: ULONG = 0x00000159; +pub const SDBUS_INTERNAL_ERROR: ULONG = 0x0000015A; +pub const WORKER_THREAD_RETURNED_WITH_SYSTEM_PAGE_PRIORITY_ACTIVE: ULONG = 0x0000015B; +pub const PDC_WATCHDOG_TIMEOUT_LIVEDUMP: ULONG = 0x0000015C; +pub const SOC_SUBSYSTEM_FAILURE_LIVEDUMP: ULONG = 0x0000015D; +pub const BUGCODE_NDIS_DRIVER_LIVE_DUMP: ULONG = 0x0000015E; +pub const CONNECTED_STANDBY_WATCHDOG_TIMEOUT_LIVEDUMP: ULONG = 0x0000015F; +pub const WIN32K_ATOMIC_CHECK_FAILURE: ULONG = 0x00000160; +pub const LIVE_SYSTEM_DUMP: ULONG = 0x00000161; +pub const KERNEL_AUTO_BOOST_INVALID_LOCK_RELEASE: ULONG = 0x00000162; +pub const WORKER_THREAD_TEST_CONDITION: ULONG = 0x00000163; +pub const WIN32K_CRITICAL_FAILURE: ULONG = 0x00000164; +pub const CLUSTER_CSV_STATUS_IO_TIMEOUT_LIVEDUMP: ULONG = 0x00000165; +pub const CLUSTER_RESOURCE_CALL_TIMEOUT_LIVEDUMP: ULONG = 0x00000166; +pub const CLUSTER_CSV_SNAPSHOT_DEVICE_INFO_TIMEOUT_LIVEDUMP: ULONG = 0x00000167; +pub const CLUSTER_CSV_STATE_TRANSITION_TIMEOUT_LIVEDUMP: ULONG = 0x00000168; +pub const CLUSTER_CSV_VOLUME_ARRIVAL_LIVEDUMP: ULONG = 0x00000169; +pub const CLUSTER_CSV_VOLUME_REMOVAL_LIVEDUMP: ULONG = 0x0000016A; +pub const CLUSTER_CSV_CLUSTER_WATCHDOG_LIVEDUMP: ULONG = 0x0000016B; +pub const INVALID_RUNDOWN_PROTECTION_FLAGS: ULONG = 0x0000016C; +pub const INVALID_SLOT_ALLOCATOR_FLAGS: ULONG = 0x0000016D; +pub const ERESOURCE_INVALID_RELEASE: ULONG = 0x0000016E; +pub const CLUSTER_CSV_STATE_TRANSITION_INTERVAL_TIMEOUT_LIVEDUMP: ULONG = 0x0000016F; +pub const CLUSTER_CSV_CLUSSVC_DISCONNECT_WATCHDOG: ULONG = 0x00000170; +pub const CRYPTO_LIBRARY_INTERNAL_ERROR: ULONG = 0x00000171; +pub const COREMSGCALL_INTERNAL_ERROR: ULONG = 0x00000173; +pub const COREMSG_INTERNAL_ERROR: ULONG = 0x00000174; +pub const PREVIOUS_FATAL_ABNORMAL_RESET_ERROR: ULONG = 0x00000175; +pub const ELAM_DRIVER_DETECTED_FATAL_ERROR: ULONG = 0x00000178; +pub const PDC_LOCK_WATCHDOG_LIVEDUMP: ULONG = 0x0000017C; +pub const PDC_UNEXPECTED_REVOCATION_LIVEDUMP: ULONG = 0x0000017D; +pub const WVR_LIVEDUMP_REPLICATION_IOCONTEXT_TIMEOUT: ULONG = 0x00000180; +pub const WVR_LIVEDUMP_STATE_TRANSITION_TIMEOUT: ULONG = 0x00000181; +pub const WVR_LIVEDUMP_RECOVERY_IOCONTEXT_TIMEOUT: ULONG = 0x00000182; +pub const WVR_LIVEDUMP_APP_IO_TIMEOUT: ULONG = 0x00000183; +pub const WVR_LIVEDUMP_MANUALLY_INITIATED: ULONG = 0x00000184; +pub const WVR_LIVEDUMP_STATE_FAILURE: ULONG = 0x00000185; +pub const WVR_LIVEDUMP_CRITICAL_ERROR: ULONG = 0x00000186; +pub const VIDEO_DWMINIT_TIMEOUT_FALLBACK_BDD: ULONG = 0x00000187; +pub const CLUSTER_CSVFS_LIVEDUMP: ULONG = 0x00000188; +pub const BAD_OBJECT_HEADER: ULONG = 0x00000189; +pub const SILO_CORRUPT: ULONG = 0x0000018A; +pub const SECURE_KERNEL_ERROR: ULONG = 0x0000018B; +pub const HYPERGUARD_VIOLATION: ULONG = 0x0000018C; +pub const WIN32K_CRITICAL_FAILURE_LIVEDUMP: ULONG = 0x00000190; +pub const PF_DETECTED_CORRUPTION: ULONG = 0x00000191; +pub const KERNEL_AUTO_BOOST_LOCK_ACQUISITION_WITH_RAISED_IRQL: ULONG = 0x00000192; +pub const VIDEO_DXGKRNL_LIVEDUMP: ULONG = 0x00000193; +pub const KERNEL_STORAGE_SLOT_IN_USE: ULONG = 0x00000199; +pub const SMB_SERVER_LIVEDUMP: ULONG = 0x00000195; +pub const LOADER_ROLLBACK_DETECTED: ULONG = 0x00000196; +pub const WIN32K_SECURITY_FAILURE: ULONG = 0x00000197; +pub const UFX_LIVEDUMP: ULONG = 0x00000198; +pub const WORKER_THREAD_RETURNED_WHILE_ATTACHED_TO_SILO: ULONG = 0x0000019A; +pub const TTM_FATAL_ERROR: ULONG = 0x0000019B; +pub const WIN32K_POWER_WATCHDOG_TIMEOUT: ULONG = 0x0000019C; +pub const CLUSTER_SVHDX_LIVEDUMP: ULONG = 0x0000019D; +pub const DRIVER_VERIFIER_DETECTED_VIOLATION_LIVEDUMP: ULONG = 0x000001C4; +pub const IO_THREADPOOL_DEADLOCK_LIVEDUMP: ULONG = 0x000001C5; +pub const XBOX_CORRUPTED_IMAGE: ULONG = 0x00000357; +pub const XBOX_INVERTED_FUNCTION_TABLE_OVERFLOW: ULONG = 0x00000358; +pub const XBOX_CORRUPTED_IMAGE_BASE: ULONG = 0x00000359; +pub const XBOX_360_SYSTEM_CRASH: ULONG = 0x00000360; +pub const XBOX_360_SYSTEM_CRASH_RESERVED: ULONG = 0x00000420; +pub const HYPERVISOR_ERROR: ULONG = 0x00020001; +pub const WINLOGON_FATAL_ERROR: ULONG = 0xC000021A; +pub const MANUALLY_INITIATED_CRASH1: ULONG = 0xDEADDEAD; +pub const BUGCHECK_CONTEXT_MODIFIER: ULONG = 0x80000000; diff --git a/src/vendor/winapi/src/shared/cderr.rs b/src/vendor/winapi/src/shared/cderr.rs new file mode 100644 index 0000000000..324ac8ff1a --- /dev/null +++ b/src/vendor/winapi/src/shared/cderr.rs @@ -0,0 +1,45 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Common dialog error return codes +use shared::minwindef::DWORD; +pub const CDERR_DIALOGFAILURE: DWORD = 0xFFFF; +pub const CDERR_GENERALCODES: DWORD = 0x0000; +pub const CDERR_STRUCTSIZE: DWORD = 0x0001; +pub const CDERR_INITIALIZATION: DWORD = 0x0002; +pub const CDERR_NOTEMPLATE: DWORD = 0x0003; +pub const CDERR_NOHINSTANCE: DWORD = 0x0004; +pub const CDERR_LOADSTRFAILURE: DWORD = 0x0005; +pub const CDERR_FINDRESFAILURE: DWORD = 0x0006; +pub const CDERR_LOADRESFAILURE: DWORD = 0x0007; +pub const CDERR_LOCKRESFAILURE: DWORD = 0x0008; +pub const CDERR_MEMALLOCFAILURE: DWORD = 0x0009; +pub const CDERR_MEMLOCKFAILURE: DWORD = 0x000A; +pub const CDERR_NOHOOK: DWORD = 0x000B; +pub const CDERR_REGISTERMSGFAIL: DWORD = 0x000C; +pub const PDERR_PRINTERCODES: DWORD = 0x1000; +pub const PDERR_SETUPFAILURE: DWORD = 0x1001; +pub const PDERR_PARSEFAILURE: DWORD = 0x1002; +pub const PDERR_RETDEFFAILURE: DWORD = 0x1003; +pub const PDERR_LOADDRVFAILURE: DWORD = 0x1004; +pub const PDERR_GETDEVMODEFAIL: DWORD = 0x1005; +pub const PDERR_INITFAILURE: DWORD = 0x1006; +pub const PDERR_NODEVICES: DWORD = 0x1007; +pub const PDERR_NODEFAULTPRN: DWORD = 0x1008; +pub const PDERR_DNDMMISMATCH: DWORD = 0x1009; +pub const PDERR_CREATEICFAILURE: DWORD = 0x100A; +pub const PDERR_PRINTERNOTFOUND: DWORD = 0x100B; +pub const PDERR_DEFAULTDIFFERENT: DWORD = 0x100C; +pub const CFERR_CHOOSEFONTCODES: DWORD = 0x2000; +pub const CFERR_NOFONTS: DWORD = 0x2001; +pub const CFERR_MAXLESSTHANMIN: DWORD = 0x2002; +pub const FNERR_FILENAMECODES: DWORD = 0x3000; +pub const FNERR_SUBCLASSFAILURE: DWORD = 0x3001; +pub const FNERR_INVALIDFILENAME: DWORD = 0x3002; +pub const FNERR_BUFFERTOOSMALL: DWORD = 0x3003; +pub const FRERR_FINDREPLACECODES: DWORD = 0x4000; +pub const FRERR_BUFFERLENGTHZERO: DWORD = 0x4001; +pub const CCERR_CHOOSECOLORCODES: DWORD = 0x5000; diff --git a/src/vendor/winapi/src/shared/cfg.rs b/src/vendor/winapi/src/shared/cfg.rs new file mode 100644 index 0000000000..a698fa1b0a --- /dev/null +++ b/src/vendor/winapi/src/shared/cfg.rs @@ -0,0 +1,139 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! common Configuration Manager definitions for both user mode and kernel mode code +use shared::minwindef::{DWORD, ULONG}; +ENUM!{enum PNP_VETO_TYPE { + PNP_VetoTypeUnknown, + PNP_VetoLegacyDevice, + PNP_VetoPendingClose, + PNP_VetoWindowsApp, + PNP_VetoWindowsService, + PNP_VetoOutstandingOpen, + PNP_VetoDevice, + PNP_VetoDriver, + PNP_VetoIllegalDeviceRequest, + PNP_VetoInsufficientPower, + PNP_VetoNonDisableable, + PNP_VetoLegacyDriver, + PNP_VetoInsufficientRights, +}} +pub type PPNP_VETO_TYPE = *mut PNP_VETO_TYPE; +pub const CM_PROB_NOT_CONFIGURED: DWORD = 0x00000001; +pub const CM_PROB_DEVLOADER_FAILED: DWORD = 0x00000002; +pub const CM_PROB_OUT_OF_MEMORY: DWORD = 0x00000003; +pub const CM_PROB_ENTRY_IS_WRONG_TYPE: DWORD = 0x00000004; +pub const CM_PROB_LACKED_ARBITRATOR: DWORD = 0x00000005; +pub const CM_PROB_BOOT_CONFIG_CONFLICT: DWORD = 0x00000006; +pub const CM_PROB_FAILED_FILTER: DWORD = 0x00000007; +pub const CM_PROB_DEVLOADER_NOT_FOUND: DWORD = 0x00000008; +pub const CM_PROB_INVALID_DATA: DWORD = 0x00000009; +pub const CM_PROB_FAILED_START: DWORD = 0x0000000A; +pub const CM_PROB_LIAR: DWORD = 0x0000000B; +pub const CM_PROB_NORMAL_CONFLICT: DWORD = 0x0000000C; +pub const CM_PROB_NOT_VERIFIED: DWORD = 0x0000000D; +pub const CM_PROB_NEED_RESTART: DWORD = 0x0000000E; +pub const CM_PROB_REENUMERATION: DWORD = 0x0000000F; +pub const CM_PROB_PARTIAL_LOG_CONF: DWORD = 0x00000010; +pub const CM_PROB_UNKNOWN_RESOURCE: DWORD = 0x00000011; +pub const CM_PROB_REINSTALL: DWORD = 0x00000012; +pub const CM_PROB_REGISTRY: DWORD = 0x00000013; +pub const CM_PROB_VXDLDR: DWORD = 0x00000014; +pub const CM_PROB_WILL_BE_REMOVED: DWORD = 0x00000015; +pub const CM_PROB_DISABLED: DWORD = 0x00000016; +pub const CM_PROB_DEVLOADER_NOT_READY: DWORD = 0x00000017; +pub const CM_PROB_DEVICE_NOT_THERE: DWORD = 0x00000018; +pub const CM_PROB_MOVED: DWORD = 0x00000019; +pub const CM_PROB_TOO_EARLY: DWORD = 0x0000001A; +pub const CM_PROB_NO_VALID_LOG_CONF: DWORD = 0x0000001B; +pub const CM_PROB_FAILED_INSTALL: DWORD = 0x0000001C; +pub const CM_PROB_HARDWARE_DISABLED: DWORD = 0x0000001D; +pub const CM_PROB_CANT_SHARE_IRQ: DWORD = 0x0000001E; +pub const CM_PROB_FAILED_ADD: DWORD = 0x0000001F; +pub const CM_PROB_DISABLED_SERVICE: DWORD = 0x00000020; +pub const CM_PROB_TRANSLATION_FAILED: DWORD = 0x00000021; +pub const CM_PROB_NO_SOFTCONFIG: DWORD = 0x00000022; +pub const CM_PROB_BIOS_TABLE: DWORD = 0x00000023; +pub const CM_PROB_IRQ_TRANSLATION_FAILED: DWORD = 0x00000024; +pub const CM_PROB_FAILED_DRIVER_ENTRY: DWORD = 0x00000025; +pub const CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD: DWORD = 0x00000026; +pub const CM_PROB_DRIVER_FAILED_LOAD: DWORD = 0x00000027; +pub const CM_PROB_DRIVER_SERVICE_KEY_INVALID: DWORD = 0x00000028; +pub const CM_PROB_LEGACY_SERVICE_NO_DEVICES: DWORD = 0x00000029; +pub const CM_PROB_DUPLICATE_DEVICE: DWORD = 0x0000002A; +pub const CM_PROB_FAILED_POST_START: DWORD = 0x0000002B; +pub const CM_PROB_HALTED: DWORD = 0x0000002C; +pub const CM_PROB_PHANTOM: DWORD = 0x0000002D; +pub const CM_PROB_SYSTEM_SHUTDOWN: DWORD = 0x0000002E; +pub const CM_PROB_HELD_FOR_EJECT: DWORD = 0x0000002F; +pub const CM_PROB_DRIVER_BLOCKED: DWORD = 0x00000030; +pub const CM_PROB_REGISTRY_TOO_LARGE: DWORD = 0x00000031; +pub const CM_PROB_SETPROPERTIES_FAILED: DWORD = 0x00000032; +pub const CM_PROB_WAITING_ON_DEPENDENCY: DWORD = 0x00000033; +pub const CM_PROB_UNSIGNED_DRIVER: DWORD = 0x00000034; +pub const CM_PROB_USED_BY_DEBUGGER: DWORD = 0x00000035; +pub const NUM_CM_PROB_V1: DWORD = 0x00000025; +pub const NUM_CM_PROB_V2: DWORD = 0x00000032; +pub const NUM_CM_PROB_V3: DWORD = 0x00000033; +pub const NUM_CM_PROB_V4: DWORD = 0x00000034; +pub const NUM_CM_PROB_V5: DWORD = 0x00000035; +pub const NUM_CM_PROB_V6: DWORD = 0x00000036; +pub const DN_ROOT_ENUMERATED: DWORD = 0x00000001; +pub const DN_DRIVER_LOADED: DWORD = 0x00000002; +pub const DN_ENUM_LOADED: DWORD = 0x00000004; +pub const DN_STARTED: DWORD = 0x00000008; +pub const DN_MANUAL: DWORD = 0x00000010; +pub const DN_NEED_TO_ENUM: DWORD = 0x00000020; +pub const DN_NOT_FIRST_TIME: DWORD = 0x00000040; +pub const DN_HARDWARE_ENUM: DWORD = 0x00000080; +pub const DN_LIAR: DWORD = 0x00000100; +pub const DN_HAS_MARK: DWORD = 0x00000200; +pub const DN_HAS_PROBLEM: DWORD = 0x00000400; +pub const DN_FILTERED: DWORD = 0x00000800; +pub const DN_MOVED: DWORD = 0x00001000; +pub const DN_DISABLEABLE: DWORD = 0x00002000; +pub const DN_REMOVABLE: DWORD = 0x00004000; +pub const DN_PRIVATE_PROBLEM: DWORD = 0x00008000; +pub const DN_MF_PARENT: DWORD = 0x00010000; +pub const DN_MF_CHILD: DWORD = 0x00020000; +pub const DN_WILL_BE_REMOVED: DWORD = 0x00040000; +pub const DN_NOT_FIRST_TIMEE: DWORD = 0x00080000; +pub const DN_STOP_FREE_RES: DWORD = 0x00100000; +pub const DN_REBAL_CANDIDATE: DWORD = 0x00200000; +pub const DN_BAD_PARTIAL: DWORD = 0x00400000; +pub const DN_NT_ENUMERATOR: DWORD = 0x00800000; +pub const DN_NT_DRIVER: DWORD = 0x01000000; +pub const DN_NEEDS_LOCKING: DWORD = 0x02000000; +pub const DN_ARM_WAKEUP: DWORD = 0x04000000; +pub const DN_APM_ENUMERATOR: DWORD = 0x08000000; +pub const DN_APM_DRIVER: DWORD = 0x10000000; +pub const DN_SILENT_INSTALL: DWORD = 0x20000000; +pub const DN_NO_SHOW_IN_DM: DWORD = 0x40000000; +pub const DN_BOOT_LOG_PROB: DWORD = 0x80000000; +pub const DN_NEED_RESTART: DWORD = DN_LIAR; +pub const DN_DRIVER_BLOCKED: DWORD = DN_NOT_FIRST_TIME; +pub const DN_LEGACY_DRIVER: DWORD = DN_MOVED; +pub const DN_CHILD_WITH_INVALID_ID: DWORD = DN_HAS_MARK; +pub const DN_DEVICE_DISCONNECTED: DWORD = DN_NEEDS_LOCKING; +pub const DN_CHANGEABLE_FLAGS: DWORD = DN_NOT_FIRST_TIME + DN_HARDWARE_ENUM + DN_HAS_MARK + + DN_DISABLEABLE + DN_REMOVABLE + DN_MF_CHILD + DN_MF_PARENT + DN_NOT_FIRST_TIMEE + + DN_STOP_FREE_RES + DN_REBAL_CANDIDATE + DN_NT_ENUMERATOR + DN_NT_DRIVER + DN_SILENT_INSTALL + + DN_NO_SHOW_IN_DM; +pub const LCPRI_FORCECONFIG: ULONG = 0x00000000; +pub const LCPRI_BOOTCONFIG: ULONG = 0x00000001; +pub const LCPRI_DESIRED: ULONG = 0x00002000; +pub const LCPRI_NORMAL: ULONG = 0x00003000; +pub const LCPRI_LASTBESTCONFIG: ULONG = 0x00003FFF; +pub const LCPRI_SUBOPTIMAL: ULONG = 0x00005000; +pub const LCPRI_LASTSOFTCONFIG: ULONG = 0x00007FFF; +pub const LCPRI_RESTART: ULONG = 0x00008000; +pub const LCPRI_REBOOT: ULONG = 0x00009000; +pub const LCPRI_POWEROFF: ULONG = 0x0000A000; +pub const LCPRI_HARDRECONFIG: ULONG = 0x0000C000; +pub const LCPRI_HARDWIRED: ULONG = 0x0000E000; +pub const LCPRI_IMPOSSIBLE: ULONG = 0x0000F000; +pub const LCPRI_DISABLED: ULONG = 0x0000FFFF; +pub const MAX_LCPRI: ULONG = 0x0000FFFF; diff --git a/src/vendor/winapi/src/shared/d3d9.rs b/src/vendor/winapi/src/shared/d3d9.rs new file mode 100644 index 0000000000..a7d7adf854 --- /dev/null +++ b/src/vendor/winapi/src/shared/d3d9.rs @@ -0,0 +1,1279 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Direct3D include file +use shared::basetsd::UINT32; +use shared::d3d9caps::{D3DCAPS9, D3DCONTENTPROTECTIONCAPS, D3DOVERLAYCAPS}; +use shared::d3d9types::{ + D3DADAPTER_IDENTIFIER9, D3DAUTHENTICATEDCHANNELTYPE, D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT, + D3DBACKBUFFER_TYPE, D3DBOX, D3DCLIPSTATUS9, D3DCOLOR, D3DCOMPOSERECTSOP, D3DCUBEMAP_FACES, + D3DDEVICE_CREATION_PARAMETERS, D3DDEVTYPE, D3DDISPLAYMODE, D3DDISPLAYMODEEX, + D3DDISPLAYMODEFILTER, D3DDISPLAYROTATION, D3DENCRYPTED_BLOCK_INFO, D3DFORMAT, D3DGAMMARAMP, + D3DINDEXBUFFER_DESC, D3DLIGHT9, D3DLOCKED_BOX, D3DLOCKED_RECT, D3DMATERIAL9, D3DMATRIX, + D3DMULTISAMPLE_TYPE, D3DPOOL, D3DPRESENTSTATS, D3DPRESENT_PARAMETERS, D3DPRIMITIVETYPE, + D3DQUERYTYPE, D3DRASTER_STATUS, D3DRECT, D3DRECTPATCH_INFO, D3DRENDERSTATETYPE, + D3DRESOURCETYPE, D3DSAMPLERSTATETYPE, D3DSTATEBLOCKTYPE, D3DSURFACE_DESC, D3DTEXTUREFILTERTYPE, + D3DTEXTURESTAGESTATETYPE, D3DTRANSFORMSTATETYPE, D3DTRIPATCH_INFO, D3DVERTEXBUFFER_DESC, + D3DVERTEXELEMENT9, D3DVIEWPORT9, D3DVOLUME_DESC, +}; +use shared::guiddef::{GUID, IID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, INT, UINT}; +use shared::windef::{HDC, HMONITOR, HWND, POINT, RECT}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::wingdi::{PALETTEENTRY, RGNDATA}; +use um::winnt::{HANDLE, HRESULT, LPCWSTR, LUID, VOID}; +pub const D3D_SDK_VERSION: DWORD = 32; +pub const D3D9b_SDK_VERSION: DWORD = 31; +DEFINE_GUID!{IID_IDirect3D9, + 0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x01, 0x47, 0xf4, 0x27, 0x5c} +DEFINE_GUID!{IID_IDirect3DDevice9, + 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0x0d, 0x82, 0xb9, 0xeb} +DEFINE_GUID!{IID_IDirect3DResource9, + 0x05eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x04} +DEFINE_GUID!{IID_IDirect3DBaseTexture9, + 0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce} +DEFINE_GUID!{IID_IDirect3DTexture9, + 0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5} +DEFINE_GUID!{IID_IDirect3DCubeTexture9, + 0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f} +DEFINE_GUID!{IID_IDirect3DVolumeTexture9, + 0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6} +DEFINE_GUID!{IID_IDirect3DVertexBuffer9, + 0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3} +DEFINE_GUID!{IID_IDirect3DIndexBuffer9, + 0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35} +DEFINE_GUID!{IID_IDirect3DSurface9, + 0x0cfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b} +DEFINE_GUID!{IID_IDirect3DVolume9, + 0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1} +DEFINE_GUID!{IID_IDirect3DSwapChain9, + 0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0x0b, 0x0b, 0x50, 0x3b} +DEFINE_GUID!{IID_IDirect3DVertexDeclaration9, + 0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46} +DEFINE_GUID!{IID_IDirect3DVertexShader9, + 0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36} +DEFINE_GUID!{IID_IDirect3DPixelShader9, + 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89} +DEFINE_GUID!{IID_IDirect3DStateBlock9, + 0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0x0f, 0x20, 0x6f, 0x21, 0x8b} +DEFINE_GUID!{IID_IDirect3DQuery9, + 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc} +DEFINE_GUID!{IID_HelperName, + 0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x04, 0xc0, 0x7f, 0x4c, 0xc8} +DEFINE_GUID!{IID_IDirect3D9Ex, + 0x02177241, 0x69fc, 0x400c, 0x8f, 0xf1, 0x93, 0xa4, 0x4d, 0xf6, 0x86, 0x1d} +DEFINE_GUID!{IID_IDirect3DDevice9Ex, + 0xb18b10ce, 0x2649, 0x405a, 0x87, 0x0f, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a} +DEFINE_GUID!{IID_IDirect3DSwapChain9Ex, + 0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x03} +DEFINE_GUID!{IID_IDirect3D9ExOverlayExtension, + 0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x08, 0x8c, 0x0d, 0xf8} +DEFINE_GUID!{IID_IDirect3DDevice9Video, + 0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95} +DEFINE_GUID!{IID_IDirect3DAuthenticatedChannel9, + 0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9} +DEFINE_GUID!{IID_IDirect3DCryptoSession9, + 0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34} +extern "system" { + pub fn Direct3DCreate9( + SDKVersion: UINT, + ) -> *mut IDirect3D9; + pub fn D3DPERF_BeginEvent( + col: D3DCOLOR, + wszName: LPCWSTR, + ) -> INT; + pub fn D3DPERF_EndEvent() -> INT; + pub fn D3DPERF_SetMarker( + col: D3DCOLOR, + wszName: LPCWSTR, + ) -> (); + pub fn D3DPERF_SetRegion( + col: D3DCOLOR, + wszName: LPCWSTR, + ) -> (); + pub fn D3DPERF_QueryRepeatFrame() -> BOOL; + pub fn D3DPERF_SetOptions( + dwOptions: DWORD, + ) -> (); + pub fn D3DPERF_GetStatus() -> DWORD; +} +RIDL!(#[uuid(0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c)] +interface IDirect3D9(IDirect3D9Vtbl): IUnknown(IUnknownVtbl) { + fn RegisterSoftwareDevice( + pInitializeFunction: *mut VOID, + ) -> HRESULT, + fn GetAdapterCount() -> UINT, + fn GetAdapterIdentifier( + Adapter: UINT, + Flags: DWORD, + pIdentifier: *mut D3DADAPTER_IDENTIFIER9, + ) -> HRESULT, + fn GetAdapterModeCount( + Adapter: UINT, + Format: D3DFORMAT, + ) -> UINT, + fn EnumAdapterModes( + Adapter: UINT, + Format: D3DFORMAT, + Mode: UINT, + pMode: *mut D3DDISPLAYMODE, + ) -> HRESULT, + fn GetAdapterDisplayMode( + Adapter: UINT, + pMode: *mut D3DDISPLAYMODE, + ) -> HRESULT, + fn CheckDeviceType( + Adapter: UINT, + DevType: D3DDEVTYPE, + AdapterFormat: D3DFORMAT, + BackBufferFormat: D3DFORMAT, + bWindowed: BOOL, + ) -> HRESULT, + fn CheckDeviceFormat( + Adapter: UINT, + DeviceType: D3DDEVTYPE, + AdapterFormat: D3DFORMAT, + Usage: DWORD, + RType: D3DRESOURCETYPE, + CheckFormat: D3DFORMAT, + ) -> HRESULT, + fn CheckDeviceMultiSampleType( + Adapter: UINT, + DeviceType: D3DDEVTYPE, + SurfaceFormat: D3DFORMAT, + Windowed: BOOL, + MultiSampleType: D3DMULTISAMPLE_TYPE, + pQualityLevels: *mut DWORD, + ) -> HRESULT, + fn CheckDepthStencilMatch( + Adapter: UINT, + DeviceType: D3DDEVTYPE, + AdapterFormat: D3DFORMAT, + RenderTargetFormat: D3DFORMAT, + DepthStencilFormat: D3DFORMAT, + ) -> HRESULT, + fn CheckDeviceFormatConversion( + Adapter: UINT, + DeviceType: D3DDEVTYPE, + SourceFormat: D3DFORMAT, + TargetFormat: D3DFORMAT, + ) -> HRESULT, + fn GetDeviceCaps( + Adapter: UINT, + DeviceType: D3DDEVTYPE, + pCaps: *mut D3DCAPS9, + ) -> HRESULT, + fn GetAdapterMonitor( + Adapter: UINT, + ) -> HMONITOR, + fn CreateDevice( + Adapter: UINT, + DeviceType: D3DDEVTYPE, + hFocusWindow: HWND, + BehaviorFlags: DWORD, + pPresentationParameters: *mut D3DPRESENT_PARAMETERS, + ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9, + ) -> HRESULT, +} +); +pub type LPDIRECT3D9 = *mut IDirect3D9; +pub type PDIRECT3D9 = *mut IDirect3D9; +RIDL!(#[uuid(0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb)] +interface IDirect3DDevice9(IDirect3DDevice9Vtbl): IUnknown(IUnknownVtbl) { + fn TestCooperativeLevel() -> HRESULT, + fn GetAvailableTextureMem() -> UINT, + fn EvictManagedResources() -> HRESULT, + fn GetDirect3D( + ppD3D9: *mut *mut IDirect3D9, + ) -> HRESULT, + fn GetDeviceCaps( + pCaps: *mut D3DCAPS9, + ) -> HRESULT, + fn GetDisplayMode( + iSwapChain: UINT, + pMode: *mut D3DDISPLAYMODE, + ) -> HRESULT, + fn GetCreationParameters( + pParameters: *mut D3DDEVICE_CREATION_PARAMETERS, + ) -> HRESULT, + fn SetCursorProperties( + XHotSpot: UINT, + YHotSpot: UINT, + pCursorBitmap: *mut IDirect3DSurface9, + ) -> HRESULT, + fn SetCursorPosition( + X: INT, + Y: INT, + Flags: DWORD, + ) -> (), + fn ShowCursor( + bShow: BOOL, + ) -> BOOL, + fn CreateAdditionalSwapChain( + pPresentationParameters: *mut D3DPRESENT_PARAMETERS, + pSwapChain: *mut *mut IDirect3DSwapChain9, + ) -> HRESULT, + fn GetSwapChain( + iSwapChain: UINT, + pSwapChain: *mut *mut IDirect3DSwapChain9, + ) -> HRESULT, + fn GetNumberOfSwapChains() -> UINT, + fn Reset( + pPresentationParameters: *mut D3DPRESENT_PARAMETERS, + ) -> HRESULT, + fn Present( + pSourceRect: *const RECT, + pDestRect: *const RECT, + hDestWindowOverride: HWND, + pDirtyRegion: *const RGNDATA, + ) -> HRESULT, + fn GetBackBuffer( + iSwapChain: UINT, + iBackBuffer: UINT, + Type: D3DBACKBUFFER_TYPE, + ppBackBuffer: *mut *mut IDirect3DSurface9, + ) -> HRESULT, + fn GetRasterStatus( + iSwapChain: UINT, + pRasterStatus: *mut D3DRASTER_STATUS, + ) -> HRESULT, + fn SetDialogBoxMode( + bEnableDialogs: BOOL, + ) -> HRESULT, + fn SetGammaRamp( + iSwapChain: UINT, + Flags: DWORD, + pRamp: *const D3DGAMMARAMP, + ) -> (), + fn GetGammaRamp( + iSwapChain: UINT, + pRamp: *mut D3DGAMMARAMP, + ) -> (), + fn CreateTexture( + Width: UINT, + Height: UINT, + Levels: UINT, + Usage: DWORD, + Format: D3DFORMAT, + Pool: D3DPOOL, + ppTexture: *mut *mut IDirect3DTexture9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn CreateVolumeTexture( + Width: UINT, + Height: UINT, + Depth: UINT, + Levels: UINT, + Usage: DWORD, + Format: D3DFORMAT, + Pool: D3DPOOL, + ppVolumeTexture: *mut *mut IDirect3DVolumeTexture9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn CreateCubeTexture( + EdgeLength: UINT, + Levels: UINT, + Usage: DWORD, + Format: D3DFORMAT, + Pool: D3DPOOL, + ppCubeTexture: *mut *mut IDirect3DCubeTexture9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn CreateVertexBuffer( + Length: UINT, + Usage: DWORD, + FVF: DWORD, + Pool: D3DPOOL, + ppVertexBuffer: *mut *mut IDirect3DVertexBuffer9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn CreateIndexBuffer( + Length: UINT, + Usage: DWORD, + Format: D3DFORMAT, + Pool: D3DPOOL, + ppIndexBuffer: *mut *mut IDirect3DIndexBuffer9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn CreateRenderTarget( + Width: UINT, + Height: UINT, + Format: D3DFORMAT, + MultiSample: D3DMULTISAMPLE_TYPE, + MultisampleQuality: DWORD, + Lockable: BOOL, + ppSurface: *mut *mut IDirect3DSurface9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn CreateDepthStencilSurface( + Width: UINT, + Height: UINT, + Format: D3DFORMAT, + MultiSample: D3DMULTISAMPLE_TYPE, + MultisampleQuality: DWORD, + Discard: BOOL, + ppSurface: *mut *mut IDirect3DSurface9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn UpdateSurface( + pSourceSurface: *mut IDirect3DSurface9, + pSourceRect: *const RECT, + pDestinationSurface: *mut IDirect3DSurface9, + pDestPoint: *const POINT, + ) -> HRESULT, + fn UpdateTexture( + pSourceTexture: *mut IDirect3DBaseTexture9, + pDestinationTexture: *mut IDirect3DBaseTexture9, + ) -> HRESULT, + fn GetRenderTargetData( + pRenderTarget: *mut IDirect3DSurface9, + pDestSurface: *mut IDirect3DSurface9, + ) -> HRESULT, + fn GetFrontBufferData( + iSwapChain: UINT, + pDestSurface: *mut IDirect3DSurface9, + ) -> HRESULT, + fn StretchRect( + pSourceSurface: *mut IDirect3DSurface9, + pSourceRect: *const RECT, + pDestSurface: *mut IDirect3DSurface9, + pDestRect: *const RECT, + Filter: D3DTEXTUREFILTERTYPE, + ) -> HRESULT, + fn ColorFill( + pSurface: *mut IDirect3DSurface9, + pRect: *const RECT, + color: D3DCOLOR, + ) -> HRESULT, + fn CreateOffscreenPlainSurface( + Width: UINT, + Height: UINT, + Format: D3DFORMAT, + Pool: D3DPOOL, + ppSurface: *mut *mut IDirect3DSurface9, + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn SetRenderTarget( + RenderTargetIndex: DWORD, + pRenderTarget: *mut IDirect3DSurface9, + ) -> HRESULT, + fn GetRenderTarget( + RenderTargetIndex: DWORD, + ppRenderTarget: *mut *mut IDirect3DSurface9, + ) -> HRESULT, + fn SetDepthStencilSurface( + pNewZStencil: *mut IDirect3DSurface9, + ) -> HRESULT, + fn GetDepthStencilSurface( + ppZStencilSurface: *mut *mut IDirect3DSurface9, + ) -> HRESULT, + fn BeginScene() -> HRESULT, + fn EndScene() -> HRESULT, + fn Clear( + Count: DWORD, + pRects: *const D3DRECT, + Flags: DWORD, + Color: D3DCOLOR, + Z: FLOAT, + Stencil: DWORD, + ) -> HRESULT, + fn SetTransform( + State: D3DTRANSFORMSTATETYPE, + pMatrix: *const D3DMATRIX, + ) -> HRESULT, + fn GetTransform( + State: D3DTRANSFORMSTATETYPE, + pMatrix: *mut D3DMATRIX, + ) -> HRESULT, + fn MultiplyTransform( + arg1: D3DTRANSFORMSTATETYPE, + arg2: *const D3DMATRIX, + ) -> HRESULT, + fn SetViewport( + pViewport: *const D3DVIEWPORT9, + ) -> HRESULT, + fn GetViewport( + pViewport: *mut D3DVIEWPORT9, + ) -> HRESULT, + fn SetMaterial( + pMaterial: *const D3DMATERIAL9, + ) -> HRESULT, + fn GetMaterial( + pMaterial: *mut D3DMATERIAL9, + ) -> HRESULT, + fn SetLight( + Index: DWORD, + arg1: *const D3DLIGHT9, + ) -> HRESULT, + fn GetLight( + Index: DWORD, + arg1: *mut D3DLIGHT9, + ) -> HRESULT, + fn LightEnable( + Index: DWORD, + Enable: BOOL, + ) -> HRESULT, + fn GetLightEnable( + Index: DWORD, + pEnable: *mut BOOL, + ) -> HRESULT, + fn SetClipPlane( + Index: DWORD, + pPlane: *const FLOAT, + ) -> HRESULT, + fn GetClipPlane( + Index: DWORD, + pPlane: *mut FLOAT, + ) -> HRESULT, + fn SetRenderState( + State: D3DRENDERSTATETYPE, + Value: DWORD, + ) -> HRESULT, + fn GetRenderState( + State: D3DRENDERSTATETYPE, + pValue: *mut DWORD, + ) -> HRESULT, + fn CreateStateBlock( + Type: D3DSTATEBLOCKTYPE, + ppSB: *mut *mut IDirect3DStateBlock9, + ) -> HRESULT, + fn BeginStateBlock() -> HRESULT, + fn EndStateBlock( + ppSB: *mut *mut IDirect3DStateBlock9, + ) -> HRESULT, + fn SetClipStatus( + pClipStatus: *const D3DCLIPSTATUS9, + ) -> HRESULT, + fn GetClipStatus( + pClipStatus: *mut D3DCLIPSTATUS9, + ) -> HRESULT, + fn GetTexture( + Stage: DWORD, + ppTexture: *mut *mut IDirect3DBaseTexture9, + ) -> HRESULT, + fn SetTexture( + Stage: DWORD, + pTexture: *mut IDirect3DBaseTexture9, + ) -> HRESULT, + fn GetTextureStageState( + Stage: DWORD, + Type: D3DTEXTURESTAGESTATETYPE, + pValue: *mut DWORD, + ) -> HRESULT, + fn SetTextureStageState( + Stage: DWORD, + Type: D3DTEXTURESTAGESTATETYPE, + Value: DWORD, + ) -> HRESULT, + fn GetSamplerState( + Sampler: DWORD, + Type: D3DSAMPLERSTATETYPE, + pValue: *mut DWORD, + ) -> HRESULT, + fn SetSamplerState( + Sampler: DWORD, + Type: D3DSAMPLERSTATETYPE, + Value: DWORD, + ) -> HRESULT, + fn ValidateDevice( + pNumPasses: *mut DWORD, + ) -> HRESULT, + fn SetPaletteEntries( + PaletteNumber: UINT, + pEntries: *const PALETTEENTRY, + ) -> HRESULT, + fn GetPaletteEntries( + PaletteNumber: UINT, + pEntries: *mut PALETTEENTRY, + ) -> HRESULT, + fn SetCurrentTexturePalette( + PaletteNumber: UINT, + ) -> HRESULT, + fn GetCurrentTexturePalette( + PaletteNumber: *mut UINT, + ) -> HRESULT, + fn SetScissorRect( + pRect: *const RECT, + ) -> HRESULT, + fn GetScissorRect( + pRect: *mut RECT, + ) -> HRESULT, + fn SetSoftwareVertexProcessing( + bSoftware: BOOL, + ) -> HRESULT, + fn GetSoftwareVertexProcessing() -> BOOL, + fn SetNPatchMode( + nSegments: FLOAT, + ) -> HRESULT, + fn GetNPatchMode() -> FLOAT, + fn DrawPrimitive( + PrimitiveType: D3DPRIMITIVETYPE, + StartVertex: UINT, + PrimitiveCount: UINT, + ) -> HRESULT, + fn DrawIndexedPrimitive( + arg1: D3DPRIMITIVETYPE, + BaseVertexIndex: INT, + MinVertexIndex: UINT, + NumVertices: UINT, + startIndex: UINT, + primCount: UINT, + ) -> HRESULT, + fn DrawPrimitiveUP( + PrimitiveType: D3DPRIMITIVETYPE, + PrimitiveCount: UINT, + pVertexStreamZeroData: *const VOID, + VertexStreamZeroStride: UINT, + ) -> HRESULT, + fn DrawIndexedPrimitiveUP( + PrimitiveType: D3DPRIMITIVETYPE, + MinVertexIndex: UINT, + NumVertices: UINT, + PrimitiveCount: UINT, + pIndexData: *const VOID, + IndexDataFormat: D3DFORMAT, + pVertexStreamZeroData: *const VOID, + VertexStreamZeroStride: UINT, + ) -> HRESULT, + fn ProcessVertices( + SrcStartIndex: UINT, + DestIndex: UINT, + VertexCount: UINT, + pDestBuffer: *mut IDirect3DVertexBuffer9, + pVertexDecl: *mut IDirect3DVertexDeclaration9, + Flags: DWORD, + ) -> HRESULT, + fn CreateVertexDeclaration( + pVertexElements: *const D3DVERTEXELEMENT9, + ppDecl: *mut *mut IDirect3DVertexDeclaration9, + ) -> HRESULT, + fn SetVertexDeclaration( + pDecl: *mut IDirect3DVertexDeclaration9, + ) -> HRESULT, + fn GetVertexDeclaration( + ppDecl: *mut *mut IDirect3DVertexDeclaration9, + ) -> HRESULT, + fn SetFVF( + FVF: DWORD, + ) -> HRESULT, + fn GetFVF( + pFVF: *mut DWORD, + ) -> HRESULT, + fn CreateVertexShader( + pFunction: *const DWORD, + ppShader: *mut *mut IDirect3DVertexShader9, + ) -> HRESULT, + fn SetVertexShader( + pShader: *mut IDirect3DVertexShader9, + ) -> HRESULT, + fn GetVertexShader( + ppShader: *mut *mut IDirect3DVertexShader9, + ) -> HRESULT, + fn SetVertexShaderConstantF( + StartRegister: UINT, + pConstantData: *const FLOAT, + Vector4fCount: UINT, + ) -> HRESULT, + fn GetVertexShaderConstantF( + StartRegister: UINT, + pConstantData: *mut FLOAT, + Vector4fCount: UINT, + ) -> HRESULT, + fn SetVertexShaderConstantI( + StartRegister: UINT, + pConstantData: *const INT, + Vector4iCount: UINT, + ) -> HRESULT, + fn GetVertexShaderConstantI( + StartRegister: UINT, + pConstantData: *mut INT, + Vector4iCount: UINT, + ) -> HRESULT, + fn SetVertexShaderConstantB( + StartRegister: UINT, + pConstantData: *const BOOL, + BoolCount: UINT, + ) -> HRESULT, + fn GetVertexShaderConstantB( + StartRegister: UINT, + pConstantData: *mut BOOL, + BoolCount: UINT, + ) -> HRESULT, + fn SetStreamSource( + StreamNumber: UINT, + pStreamData: *mut IDirect3DVertexBuffer9, + OffsetInBytes: UINT, + Stride: UINT, + ) -> HRESULT, + fn GetStreamSource( + StreamNumber: UINT, + ppStreamData: *mut *mut IDirect3DVertexBuffer9, + pOffsetInBytes: *mut UINT, + pStride: *mut UINT, + ) -> HRESULT, + fn SetStreamSourceFreq( + StreamNumber: UINT, + Setting: UINT, + ) -> HRESULT, + fn GetStreamSourceFreq( + StreamNumber: UINT, + pSetting: *mut UINT, + ) -> HRESULT, + fn SetIndices( + pIndexData: *mut IDirect3DIndexBuffer9, + ) -> HRESULT, + fn GetIndices( + ppIndexData: *mut *mut IDirect3DIndexBuffer9, + ) -> HRESULT, + fn CreatePixelShader( + pFunction: *const DWORD, + ppShader: *mut *mut IDirect3DPixelShader9, + ) -> HRESULT, + fn SetPixelShader( + pShader: *mut IDirect3DPixelShader9, + ) -> HRESULT, + fn GetPixelShader( + ppShader: *mut *mut IDirect3DPixelShader9, + ) -> HRESULT, + fn SetPixelShaderConstantF( + StartRegister: UINT, + pConstantData: *const FLOAT, + Vector4fCount: UINT, + ) -> HRESULT, + fn GetPixelShaderConstantF( + StartRegister: UINT, + pConstantData: *mut FLOAT, + Vector4fCount: UINT, + ) -> HRESULT, + fn SetPixelShaderConstantI( + StartRegister: UINT, + pConstantData: *const INT, + Vector4iCount: UINT, + ) -> HRESULT, + fn GetPixelShaderConstantI( + StartRegister: UINT, + pConstantData: *mut INT, + Vector4iCount: UINT, + ) -> HRESULT, + fn SetPixelShaderConstantB( + StartRegister: UINT, + pConstantData: *const BOOL, + BoolCount: UINT, + ) -> HRESULT, + fn GetPixelShaderConstantB( + StartRegister: UINT, + pConstantData: *mut BOOL, + BoolCount: UINT, + ) -> HRESULT, + fn DrawRectPatch( + Handle: UINT, + pNumSegs: *const FLOAT, + pRectPatchInfo: *const D3DRECTPATCH_INFO, + ) -> HRESULT, + fn DrawTriPatch( + Handle: UINT, + pNumSegs: *const FLOAT, + pTriPatchInfo: *const D3DTRIPATCH_INFO, + ) -> HRESULT, + fn DeletePatch( + Handle: UINT, + ) -> HRESULT, + fn CreateQuery( + Type: D3DQUERYTYPE, + ppQuery: *mut *mut IDirect3DQuery9, + ) -> HRESULT, +} +); +pub type LPDIRECT3DDEVICE9 = *mut IDirect3DDevice9; +pub type PDIRECT3DDEVICE9 = *mut IDirect3DDevice9; +RIDL!(#[uuid(0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b)] +interface IDirect3DStateBlock9(IDirect3DStateBlock9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn Capture() -> HRESULT, + fn Apply() -> HRESULT, +} +); +pub type LPDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9; +pub type PDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9; +RIDL!(#[uuid(0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b)] +interface IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl): IUnknown(IUnknownVtbl) { + fn Present( + pSourceRect: *const RECT, + pDestRect: *const RECT, + hDestWindowOverride: HWND, + pDirtyRegion: *const RGNDATA, + dwFlags: DWORD, + ) -> HRESULT, + fn GetFrontBufferData( + pDestSurface: *mut IDirect3DSurface9, + ) -> HRESULT, + fn GetBackBuffer( + iBackBuffer: UINT, + Type: D3DBACKBUFFER_TYPE, + ppBackBuffer: *mut *mut IDirect3DSurface9, + ) -> HRESULT, + fn GetRasterStatus( + pRasterStatus: *mut D3DRASTER_STATUS, + ) -> HRESULT, + fn GetDisplayMode( + pMode: *mut D3DDISPLAYMODE, + ) -> HRESULT, + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn GetPresentParameters( + pPresentationParameters: *mut D3DPRESENT_PARAMETERS, + ) -> HRESULT, +} +); +pub type LPDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9; +pub type PDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9; +RIDL!(#[uuid(0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4)] +interface IDirect3DResource9(IDirect3DResource9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn SetPrivateData( + refguid: *const GUID, + pData: *const VOID, + SizeOfData: DWORD, + Flags: DWORD, + ) -> HRESULT, + fn GetPrivateData( + refguid: *const GUID, + pData: *mut VOID, + pSizeOfData: *mut DWORD, + ) -> HRESULT, + fn FreePrivateData( + refguid: *const GUID, + ) -> HRESULT, + fn SetPriority( + PriorityNew: DWORD, + ) -> DWORD, + fn GetPriority() -> DWORD, + fn PreLoad() -> (), + fn GetType() -> D3DRESOURCETYPE, +} +); +pub type LPDIRECT3DRESOURCE9 = *mut IDirect3DResource9; +pub type PDIRECT3DRESOURCE9 = *mut IDirect3DResource9; +RIDL!(#[uuid(0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46)] +interface IDirect3DVertexDeclaration9(IDirect3DVertexDeclaration9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn GetDeclaration( + pElement: *mut D3DVERTEXELEMENT9, + pNumElements: *mut UINT, + ) -> HRESULT, +} +); +pub type LPDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9; +pub type PDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9; +RIDL!(#[uuid(0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36)] +interface IDirect3DVertexShader9(IDirect3DVertexShader9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn GetFunction( + arg1: *mut VOID, + pSizeOfData: *mut UINT, + ) -> HRESULT, +} +); +pub type LPDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9; +pub type PDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9; +RIDL!(#[uuid(0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89)] +interface IDirect3DPixelShader9(IDirect3DPixelShader9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn GetFunction( + arg1: *mut VOID, + pSizeOfData: *mut UINT, + ) -> HRESULT, +} +); +pub type LPDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9; +pub type PDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9; +RIDL!{#[uuid(0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce)] +interface IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl): + IDirect3DResource9(IDirect3DResource9Vtbl) { + fn SetLOD( + LODNew: DWORD, + ) -> DWORD, + fn GetLOD() -> DWORD, + fn GetLevelCount() -> DWORD, + fn SetAutoGenFilterType( + FilterType: D3DTEXTUREFILTERTYPE, + ) -> HRESULT, + fn GetAutoGenFilterType() -> D3DTEXTUREFILTERTYPE, + fn GenerateMipSubLevels() -> (), +}} +pub type LPDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9; +pub type PDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9; +RIDL!{#[uuid(0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5)] +interface IDirect3DTexture9(IDirect3DTexture9Vtbl): + IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { + fn GetLevelDesc( + Level: UINT, + pDesc: *mut D3DSURFACE_DESC, + ) -> HRESULT, + fn GetSurfaceLevel( + Level: UINT, + ppSurfaceLevel: *mut *mut IDirect3DSurface9, + ) -> HRESULT, + fn LockRect( + Level: UINT, + pLockedRect: *mut D3DLOCKED_RECT, + pRect: *const RECT, + Flags: DWORD, + ) -> HRESULT, + fn UnlockRect( + Level: UINT, + ) -> HRESULT, + fn AddDirtyRect( + pDirtyRect: *const RECT, + ) -> HRESULT, +}} +pub type LPDIRECT3DTEXTURE9 = *mut IDirect3DTexture9; +pub type PDIRECT3DTEXTURE9 = *mut IDirect3DTexture9; +RIDL!{#[uuid(0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6)] +interface IDirect3DVolumeTexture9(IDirect3DVolumeTexture9Vtbl): + IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { + fn GetLevelDesc( + Level: UINT, + pDesc: *mut D3DVOLUME_DESC, + ) -> HRESULT, + fn GetVolumeLevel( + Level: UINT, + ppVolumeLevel: *mut *mut IDirect3DVolume9, + ) -> HRESULT, + fn LockBox( + Level: UINT, + pLockedVolume: *mut D3DLOCKED_BOX, + pBox: *const D3DBOX, + Flags: DWORD, + ) -> HRESULT, + fn UnlockBox( + Level: UINT, + ) -> HRESULT, + fn AddDirtyBox( + pDirtyBox: *const D3DBOX, + ) -> HRESULT, +}} +pub type LPDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9; +pub type PDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9; +RIDL!{#[uuid(0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f)] +interface IDirect3DCubeTexture9(IDirect3DCubeTexture9Vtbl): + IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { + fn GetLevelDesc( + Level: UINT, + pDesc: *mut D3DSURFACE_DESC, + ) -> HRESULT, + fn GetCubeMapSurface( + FaceType: D3DCUBEMAP_FACES, + Level: UINT, + ppCubeMapSurface: *mut *mut IDirect3DSurface9, + ) -> HRESULT, + fn LockRect( + FaceType: D3DCUBEMAP_FACES, + Level: UINT, + pLockedRect: *mut D3DLOCKED_RECT, + pRect: *const RECT, + Flags: DWORD, + ) -> HRESULT, + fn UnlockRect( + FaceType: D3DCUBEMAP_FACES, + Level: UINT, + ) -> HRESULT, + fn AddDirtyRect( + FaceType: D3DCUBEMAP_FACES, + pDirtyRect: *const RECT, + ) -> HRESULT, +}} +pub type LPDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9; +pub type PDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9; +RIDL!{#[uuid(0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3)] +interface IDirect3DVertexBuffer9(IDirect3DVertexBuffer9Vtbl): + IDirect3DResource9(IDirect3DResource9Vtbl) { + fn Lock( + OffsetToLock: UINT, + SizeToLock: UINT, + ppbData: *mut *mut VOID, + Flags: DWORD, + ) -> HRESULT, + fn Unlock() -> HRESULT, + fn GetDesc( + pDesc: *mut D3DVERTEXBUFFER_DESC, + ) -> HRESULT, +}} +pub type LPDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9; +pub type PDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9; +RIDL!{#[uuid(0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35)] +interface IDirect3DIndexBuffer9(IDirect3DIndexBuffer9Vtbl): + IDirect3DResource9(IDirect3DResource9Vtbl) { + fn Lock( + OffsetToLock: UINT, + SizeToLock: UINT, + ppbData: *mut *mut VOID, + Flags: DWORD, + ) -> HRESULT, + fn Unlock() -> HRESULT, + fn GetDesc( + pDesc: *mut D3DINDEXBUFFER_DESC, + ) -> HRESULT, +}} +pub type LPDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9; +pub type PDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9; +RIDL!{#[uuid(0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b)] +interface IDirect3DSurface9(IDirect3DSurface9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { + fn GetContainer( + riid: *const IID, + ppContainer: *mut *mut VOID, + ) -> HRESULT, + fn GetDesc( + pDesc: *mut D3DSURFACE_DESC, + ) -> HRESULT, + fn LockRect( + pLockedRect: *mut D3DLOCKED_RECT, + pRect: *const RECT, + Flags: DWORD, + ) -> HRESULT, + fn UnlockRect() -> HRESULT, + fn GetDC( + phdc: *mut HDC, + ) -> HRESULT, + fn ReleaseDC( + hdc: HDC, + ) -> HRESULT, +}} +pub type LPDIRECT3DSURFACE9 = *mut IDirect3DSurface9; +pub type PDIRECT3DSURFACE9 = *mut IDirect3DSurface9; +RIDL!{#[uuid(0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1)] +interface IDirect3DVolume9(IDirect3DVolume9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn SetPrivateData( + refguid: *const GUID, + pData: *const VOID, + SizeOfData: DWORD, + Flags: DWORD, + ) -> HRESULT, + fn GetPrivateData( + refguid: *const GUID, + pData: *mut VOID, + pSizeOfData: *mut DWORD, + ) -> HRESULT, + fn FreePrivateData( + refguid: *const GUID, + ) -> HRESULT, + fn GetContainer( + riid: *const IID, + ppContainer: *mut *mut VOID, + ) -> HRESULT, + fn GetDesc( + pDesc: *mut D3DVOLUME_DESC, + ) -> HRESULT, + fn LockBox( + pLockedVolume: *mut D3DLOCKED_BOX, + pBox: *const D3DBOX, + Flags: DWORD, + ) -> HRESULT, + fn UnlockBox() -> HRESULT, +}} +pub type LPDIRECT3DVOLUME9 = *mut IDirect3DVolume9; +pub type PDIRECT3DVOLUME9 = *mut IDirect3DVolume9; +RIDL!{#[uuid(0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc)] +interface IDirect3DQuery9(IDirect3DQuery9Vtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut IDirect3DDevice9, + ) -> HRESULT, + fn GetType() -> D3DRESOURCETYPE, + fn GetDataSize() -> DWORD, + fn Issue( + dwIssueFlags: DWORD, + ) -> HRESULT, + fn GetData( + pData: *mut VOID, + dwSize: DWORD, + dwGetDataFlags: DWORD, + ) -> HRESULT, +}} +pub type LPDIRECT3DQUERY9 = *mut IDirect3DQuery9; +pub type PDIRECT3DQUERY9 = *mut IDirect3DQuery9; +pub const D3DCREATE_FPU_PRESERVE: DWORD = 0x2; +pub const D3DCREATE_MULTITHREADED: DWORD = 0x4; +pub const D3DCREATE_PUREDEVICE: DWORD = 0x10; +pub const D3DCREATE_SOFTWARE_VERTEXPROCESSING: DWORD = 0x20; +pub const D3DCREATE_HARDWARE_VERTEXPROCESSING: DWORD = 0x40; +pub const D3DCREATE_MIXED_VERTEXPROCESSING: DWORD = 0x80; +pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT: DWORD = 0x100; +pub const D3DCREATE_ADAPTERGROUP_DEVICE: DWORD = 0x200; +pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX: DWORD = 0x400; +pub const D3DCREATE_NOWINDOWCHANGES: DWORD = 0x800; +pub const D3DCREATE_DISABLE_PSGP_THREADING: DWORD = 0x2000; +pub const D3DCREATE_ENABLE_PRESENTSTATS: DWORD = 0x4000; +pub const D3DCREATE_DISABLE_PRESENTSTATS: DWORD = 0x8000; +pub const D3DCREATE_SCREENSAVER: DWORD = 0x10000000; +pub const D3DADAPTER_DEFAULT: DWORD = 0; +extern "system" { + pub fn Direct3DCreate9Ex( + SDKVersion: UINT, + arg1: *mut *mut IDirect3D9Ex, + ) -> HRESULT; +} +RIDL!{#[uuid(0x02177241, 0x69fc, 0x400c, 0x8f, 0xf1, 0x93, 0xa4, 0x4d, 0xf6, 0x86, 0x1d)] +interface IDirect3D9Ex(IDirect3D9ExVtbl): IDirect3D9(IDirect3D9Vtbl) { + fn GetAdapterModeCountEx( + Adapter: UINT, + pFilter: *const D3DDISPLAYMODEFILTER, + ) -> UINT, + fn EnumAdapterModesEx( + Adapter: UINT, + pFilter: *const D3DDISPLAYMODEFILTER, + Mode: UINT, + pMode: *mut D3DDISPLAYMODEEX, + ) -> HRESULT, + fn GetAdapterDisplayModeEx( + Adapter: UINT, + pMode: *mut D3DDISPLAYMODEEX, + pRotation: *mut D3DDISPLAYROTATION, + ) -> HRESULT, + fn CreateDeviceEx( + Adapter: UINT, + DeviceType: D3DDEVTYPE, + hFocusWindow: HWND, + BehaviorFlags: DWORD, + pPresentationParameters: *mut D3DPRESENT_PARAMETERS, + pFullscreenDisplayMode: *mut D3DDISPLAYMODEEX, + ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9Ex, + ) -> HRESULT, + fn GetAdapterLUID( + Adapter: UINT, + pLUID: *mut LUID, + ) -> HRESULT, +}} +pub type LPDIRECT3D9EX = *mut IDirect3D9Ex; +pub type PDIRECT3D9EX = *mut IDirect3D9Ex; +RIDL!{#[uuid(0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a)] +interface IDirect3DDevice9Ex(IDirect3DDevice9ExVtbl): IDirect3DDevice9(IDirect3DDevice9Vtbl) { + fn SetConvolutionMonoKernel( + width: UINT, + height: UINT, + rows: *mut FLOAT, + columns: *mut FLOAT, + ) -> HRESULT, + fn ComposeRects( + pSrc: *mut IDirect3DSurface9, + pDst: *mut IDirect3DSurface9, + pSrcRectDescs: *mut IDirect3DVertexBuffer9, + NumRects: UINT, + pDstRectDescs: *mut IDirect3DVertexBuffer9, + Operation: D3DCOMPOSERECTSOP, + Xoffset: INT, + Yoffset: INT, + ) -> HRESULT, + fn PresentEx( + pSourceRect: *const RECT, + pDestRect: *const RECT, + hDestWindowOverride: HWND, + pDirtyRegion: *const RGNDATA, + dwFlags: DWORD, + ) -> HRESULT, + fn GetGPUThreadPriority( + pPriority: *mut INT, + ) -> HRESULT, + fn SetGPUThreadPriority( + Priority: INT, + ) -> HRESULT, + fn WaitForVBlank( + iSwapChain: UINT, + ) -> HRESULT, + fn CheckResourceResidency( + pResourceArray: *mut *mut IDirect3DResource9, + NumResources: UINT32, + ) -> HRESULT, + fn SetMaximumFrameLatency( + MaxLatency: UINT, + ) -> HRESULT, + fn GetMaximumFrameLatency( + pMaxLatency: *mut UINT, + ) -> HRESULT, + fn CheckDeviceState( + hDestinationWindow: HWND, + ) -> HRESULT, + fn CreateRenderTargetEx( + Width: UINT, + Height: UINT, + Format: D3DFORMAT, + MultiSample: D3DMULTISAMPLE_TYPE, + MultisampleQuality: DWORD, + Lockable: BOOL, + ppSurface: *mut *mut IDirect3DSurface9, + pSharedHandle: *mut HANDLE, + Usage: DWORD, + ) -> HRESULT, + fn CreateOffscreenPlainSurfaceEx( + Width: UINT, + Height: UINT, + Format: D3DFORMAT, + Pool: D3DPOOL, + ppSurface: *mut *mut IDirect3DSurface9, + pSharedHandle: *mut HANDLE, + Usage: DWORD, + ) -> HRESULT, + fn CreateDepthStencilSurfaceEx( + Width: UINT, + Height: UINT, + Format: D3DFORMAT, + MultiSample: D3DMULTISAMPLE_TYPE, + MultisampleQuality: DWORD, + Discard: BOOL, + ppSurface: *mut *mut IDirect3DSurface9, + pSharedHandle: *mut HANDLE, + Usage: DWORD, + ) -> HRESULT, + fn ResetEx( + pPresentationParameters: *mut D3DPRESENT_PARAMETERS, + pFullscreenDisplayMode: *mut D3DDISPLAYMODEEX, + ) -> HRESULT, + fn GetDisplayModeEx( + iSwapChain: UINT, + pMode: *mut D3DDISPLAYMODEEX, + pRotation: *mut D3DDISPLAYROTATION, + ) -> HRESULT, +}} +pub type LPDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex; +pub type PDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex; +RIDL!{#[uuid(0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x3)] +interface IDirect3DSwapChain9Ex(IDirect3DSwapChain9ExVtbl): + IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl) { + fn GetLastPresentCount( + pLastPresentCount: *mut UINT, + ) -> HRESULT, + fn GetPresentStats( + pPresentationStatistics: *mut D3DPRESENTSTATS, + ) -> HRESULT, + fn GetDisplayModeEx( + pMode: *mut D3DDISPLAYMODEEX, + pRotation: *mut D3DDISPLAYROTATION, + ) -> HRESULT, +}} +pub type LPDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex; +pub type PDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex; +RIDL!{#[uuid(0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x8, 0x8c, 0xd, 0xf8)] +interface IDirect3D9ExOverlayExtension(IDirect3D9ExOverlayExtensionVtbl): IUnknown(IUnknownVtbl) { + fn CheckDeviceOverlayType( + Adapter: UINT, + DevType: D3DDEVTYPE, + OverlayWidth: UINT, + OverlayHeight: UINT, + OverlayFormat: D3DFORMAT, + pDisplayMode: *mut D3DDISPLAYMODEEX, + DisplayRotation: D3DDISPLAYROTATION, + pOverlayCaps: *mut D3DOVERLAYCAPS, + ) -> HRESULT, +}} +pub type LPDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension; +pub type PDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension; +RIDL!{#[uuid(0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95)] +interface IDirect3DDevice9Video(IDirect3DDevice9VideoVtbl): IUnknown(IUnknownVtbl) { + fn GetContentProtectionCaps( + pCryptoType: *const GUID, + pDecodeProfile: *const GUID, + pCaps: *mut D3DCONTENTPROTECTIONCAPS, + ) -> HRESULT, + fn CreateAuthenticatedChannel( + ChannelType: D3DAUTHENTICATEDCHANNELTYPE, + ppAuthenticatedChannel: *mut *mut IDirect3DAuthenticatedChannel9, + pChannelHandle: *mut HANDLE, + ) -> HRESULT, + fn CreateCryptoSession( + pCryptoType: *const GUID, + pDecodeProfile: *const GUID, + ppCryptoSession: *mut *mut IDirect3DCryptoSession9, + pCryptoHandle: *mut HANDLE, + ) -> HRESULT, +}} +pub type LPDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video; +pub type PDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video; +RIDL!(#[uuid(0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9)] +interface IDirect3DAuthenticatedChannel9(IDirect3DAuthenticatedChannel9Vtbl): + IUnknown(IUnknownVtbl) { + fn GetCertificateSize( + pCertificateSize: *mut UINT, + ) -> HRESULT, + fn GetCertificate( + CertifacteSize: UINT, + ppCertificate: *mut BYTE, + ) -> HRESULT, + fn NegotiateKeyExchange( + DataSize: UINT, + pData: *mut VOID, + ) -> HRESULT, + fn Query( + InputSize: UINT, + pInput: *const VOID, + OutputSize: UINT, + pOutput: *mut VOID, + ) -> HRESULT, + fn Configure( + InputSize: UINT, + pInput: *const VOID, + pOutput: *mut D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT, + ) -> HRESULT, +} +); +pub type LPDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9; +pub type PDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9; +RIDL!(#[uuid(0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34)] +interface IDirect3DCryptoSession9(IDirect3DCryptoSession9Vtbl): IUnknown(IUnknownVtbl) { + fn GetCertificateSize( + pCertificateSize: *mut UINT, + ) -> HRESULT, + fn GetCertificate( + CertifacteSize: UINT, + ppCertificate: *mut BYTE, + ) -> HRESULT, + fn NegotiateKeyExchange( + DataSize: UINT, + pData: *mut VOID, + ) -> HRESULT, + fn EncryptionBlt( + pSrcSurface: *mut IDirect3DSurface9, + pDstSurface: *mut IDirect3DSurface9, + DstSurfaceSize: UINT, + pIV: *mut VOID, + ) -> HRESULT, + fn DecryptionBlt( + pSrcSurface: *mut IDirect3DSurface9, + pDstSurface: *mut IDirect3DSurface9, + SrcSurfaceSize: UINT, + pEncryptedBlockInfo: *mut D3DENCRYPTED_BLOCK_INFO, + pContentKey: *mut VOID, + pIV: *mut VOID, + ) -> HRESULT, + fn GetSurfacePitch( + pSrcSurface: *mut IDirect3DSurface9, + pSurfacePitch: *mut UINT, + ) -> HRESULT, + fn StartSessionKeyRefresh( + pRandomNumber: *mut VOID, + RandomNumberSize: UINT, + ) -> HRESULT, + fn FinishSessionKeyRefresh() -> HRESULT, + fn GetEncryptionBltKey( + pReadbackKey: *mut VOID, + KeySize: UINT, + ) -> HRESULT, +} +); +pub type LPDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9; +pub type PDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9; diff --git a/src/vendor/winapi/src/shared/d3d9caps.rs b/src/vendor/winapi/src/shared/d3d9caps.rs new file mode 100644 index 0000000000..cd079012c6 --- /dev/null +++ b/src/vendor/winapi/src/shared/d3d9caps.rs @@ -0,0 +1,367 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Direct3D capabilities include file +use ctypes::c_float; +use shared::d3d9types::D3DDEVTYPE; +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, INT, UINT}; +use um::winnt::ULONGLONG; +STRUCT!{struct D3DVSHADERCAPS2_0 { + Caps: DWORD, + DynamicFlowControlDepth: INT, + NumTemps: INT, + StaticFlowControlDepth: INT, +}} +pub const D3DVS20CAPS_PREDICATION: DWORD = 1 << 0; +pub const D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH: DWORD = 24; +pub const D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH: DWORD = 0; +pub const D3DVS20_MAX_NUMTEMPS: DWORD = 32; +pub const D3DVS20_MIN_NUMTEMPS: DWORD = 12; +pub const D3DVS20_MAX_STATICFLOWCONTROLDEPTH: DWORD = 4; +pub const D3DVS20_MIN_STATICFLOWCONTROLDEPTH: DWORD = 1; +STRUCT!{struct D3DPSHADERCAPS2_0 { + Caps: DWORD, + DynamicFlowControlDepth: INT, + NumTemps: INT, + StaticFlowControlDepth: INT, + NumInstructionSlots: INT, +}} +pub const D3DPS20CAPS_ARBITRARYSWIZZLE: DWORD = 1 << 0; +pub const D3DPS20CAPS_GRADIENTINSTRUCTIONS: DWORD = 1 << 1; +pub const D3DPS20CAPS_PREDICATION: DWORD = 1 << 2; +pub const D3DPS20CAPS_NODEPENDENTREADLIMIT: DWORD = 1 << 3; +pub const D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT: DWORD = 1 << 4; +pub const D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH: DWORD = 24; +pub const D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH: DWORD = 0; +pub const D3DPS20_MAX_NUMTEMPS: DWORD = 32; +pub const D3DPS20_MIN_NUMTEMPS: DWORD = 12; +pub const D3DPS20_MAX_STATICFLOWCONTROLDEPTH: DWORD = 4; +pub const D3DPS20_MIN_STATICFLOWCONTROLDEPTH: DWORD = 0; +pub const D3DPS20_MAX_NUMINSTRUCTIONSLOTS: DWORD = 512; +pub const D3DPS20_MIN_NUMINSTRUCTIONSLOTS: DWORD = 96; +pub const D3DMIN30SHADERINSTRUCTIONS: DWORD = 512; +pub const D3DMAX30SHADERINSTRUCTIONS: DWORD = 32768; +STRUCT!{struct D3DOVERLAYCAPS { + Caps: UINT, + MaxOverlayDisplayWidth: UINT, + MaxOverlayDisplayHeight: UINT, +}} +pub const D3DOVERLAYCAPS_FULLRANGERGB: DWORD = 0x00000001; +pub const D3DOVERLAYCAPS_LIMITEDRANGERGB: DWORD = 0x00000002; +pub const D3DOVERLAYCAPS_YCbCr_BT601: DWORD = 0x00000004; +pub const D3DOVERLAYCAPS_YCbCr_BT709: DWORD = 0x00000008; +pub const D3DOVERLAYCAPS_YCbCr_BT601_xvYCC: DWORD = 0x00000010; +pub const D3DOVERLAYCAPS_YCbCr_BT709_xvYCC: DWORD = 0x00000020; +pub const D3DOVERLAYCAPS_STRETCHX: DWORD = 0x00000040; +pub const D3DOVERLAYCAPS_STRETCHY: DWORD = 0x00000080; +// FIXME packed(4) +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct D3DCONTENTPROTECTIONCAPS { + Caps: DWORD, + KeyExchangeType: GUID, + BufferAlignmentStart: UINT, + BlockAlignmentSize: UINT, + ProtectedMemorySize: ULONGLONG, +}} +pub const D3DCPCAPS_SOFTWARE: DWORD = 0x00000001; +pub const D3DCPCAPS_HARDWARE: DWORD = 0x00000002; +pub const D3DCPCAPS_PROTECTIONALWAYSON: DWORD = 0x00000004; +pub const D3DCPCAPS_PARTIALDECRYPTION: DWORD = 0x00000008; +pub const D3DCPCAPS_CONTENTKEY: DWORD = 0x00000010; +pub const D3DCPCAPS_FRESHENSESSIONKEY: DWORD = 0x00000020; +pub const D3DCPCAPS_ENCRYPTEDREADBACK: DWORD = 0x00000040; +pub const D3DCPCAPS_ENCRYPTEDREADBACKKEY: DWORD = 0x00000080; +pub const D3DCPCAPS_SEQUENTIAL_CTR_IV: DWORD = 0x00000100; +pub const D3DCPCAPS_ENCRYPTSLICEDATAONLY: DWORD = 0x00000200; +DEFINE_GUID!{D3DCRYPTOTYPE_AES128_CTR, + 0x9b6bd711, 0x4f74, 0x41c9, 0x9e, 0x7b, 0x0b, 0xe2, 0xd7, 0xd9, 0x3b, 0x4f} +DEFINE_GUID!{D3DCRYPTOTYPE_PROPRIETARY, + 0xab4e9afd, 0x1d1c, 0x46e6, 0xa7, 0x2f, 0x08, 0x69, 0x91, 0x7b, 0x0d, 0xe8} +DEFINE_GUID!{D3DKEYEXCHANGE_RSAES_OAEP, + 0xc1949895, 0xd72a, 0x4a1d, 0x8e, 0x5d, 0xed, 0x85, 0x7d, 0x17, 0x15, 0x20} +DEFINE_GUID!{D3DKEYEXCHANGE_DXVA, + 0x43d3775c, 0x38e5, 0x4924, 0x8d, 0x86, 0xd3, 0xfc, 0xcf, 0x15, 0x3e, 0x9b} +STRUCT!{struct D3DCAPS9 { + DeviceType: D3DDEVTYPE, + AdapterOrdinal: UINT, + Caps: DWORD, + Caps2: DWORD, + Caps3: DWORD, + PresentationIntervals: DWORD, + CursorCaps: DWORD, + DevCaps: DWORD, + PrimitiveMiscCaps: DWORD, + RasterCaps: DWORD, + ZCmpCaps: DWORD, + SrcBlendCaps: DWORD, + DestBlendCaps: DWORD, + AlphaCmpCaps: DWORD, + ShadeCaps: DWORD, + TextureCaps: DWORD, + TextureFilterCaps: DWORD, + CubeTextureFilterCaps: DWORD, + VolumeTextureFilterCaps: DWORD, + TextureAddressCaps: DWORD, + VolumeTextureAddressCaps: DWORD, + LineCaps: DWORD, + MaxTextureWidth: DWORD, + MaxTextureHeight: DWORD, + MaxVolumeExtent: DWORD, + MaxTextureRepeat: DWORD, + MaxTextureAspectRatio: DWORD, + MaxAnisotropy: DWORD, + MaxVertexW: c_float, + GuardBandLeft: c_float, + GuardBandTop: c_float, + GuardBandRight: c_float, + GuardBandBottom: c_float, + ExtentsAdjust: c_float, + StencilCaps: DWORD, + FVFCaps: DWORD, + TextureOpCaps: DWORD, + MaxTextureBlendStages: DWORD, + MaxSimultaneousTextures: DWORD, + VertexProcessingCaps: DWORD, + MaxActiveLights: DWORD, + MaxUserClipPlanes: DWORD, + MaxVertexBlendMatrices: DWORD, + MaxVertexBlendMatrixIndex: DWORD, + MaxPointSize: c_float, + MaxPrimitiveCount: DWORD, + MaxVertexIndex: DWORD, + MaxStreams: DWORD, + MaxStreamStride: DWORD, + VertexShaderVersion: DWORD, + MaxVertexShaderConst: DWORD, + PixelShaderVersion: DWORD, + PixelShader1xMaxValue: c_float, + DevCaps2: DWORD, + MaxNpatchTessellationLevel: c_float, + Reserved5: DWORD, + MasterAdapterOrdinal: UINT, + AdapterOrdinalInGroup: UINT, + NumberOfAdaptersInGroup: UINT, + DeclTypes: DWORD, + NumSimultaneousRTs: DWORD, + StretchRectFilterCaps: DWORD, + VS20Caps: D3DVSHADERCAPS2_0, + PS20Caps: D3DPSHADERCAPS2_0, + VertexTextureFilterCaps: DWORD, + MaxVShaderInstructionsExecuted: DWORD, + MaxPShaderInstructionsExecuted: DWORD, + MaxVertexShader30InstructionSlots: DWORD, + MaxPixelShader30InstructionSlots: DWORD, +}} +pub const D3DCAPS_OVERLAY: DWORD = 0x00000800; +pub const D3DCAPS_READ_SCANLINE: DWORD = 0x00020000; +pub const D3DCAPS2_FULLSCREENGAMMA: DWORD = 0x00020000; +pub const D3DCAPS2_CANCALIBRATEGAMMA: DWORD = 0x00100000; +pub const D3DCAPS2_RESERVED: DWORD = 0x02000000; +pub const D3DCAPS2_CANMANAGERESOURCE: DWORD = 0x10000000; +pub const D3DCAPS2_DYNAMICTEXTURES: DWORD = 0x20000000; +pub const D3DCAPS2_CANAUTOGENMIPMAP: DWORD = 0x40000000; +pub const D3DCAPS2_CANSHARERESOURCE: DWORD = 0x80000000; +pub const D3DCAPS3_RESERVED: DWORD = 0x8000001f; +pub const D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD: DWORD = 0x00000020; +pub const D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION: DWORD = 0x00000080; +pub const D3DCAPS3_COPY_TO_VIDMEM: DWORD = 0x00000100; +pub const D3DCAPS3_COPY_TO_SYSTEMMEM: DWORD = 0x00000200; +pub const D3DCAPS3_DXVAHD: DWORD = 0x00000400; +pub const D3DCAPS3_DXVAHD_LIMITED: DWORD = 0x00000800; +pub const D3DPRESENT_INTERVAL_DEFAULT: DWORD = 0x00000000; +pub const D3DPRESENT_INTERVAL_ONE: DWORD = 0x00000001; +pub const D3DPRESENT_INTERVAL_TWO: DWORD = 0x00000002; +pub const D3DPRESENT_INTERVAL_THREE: DWORD = 0x00000004; +pub const D3DPRESENT_INTERVAL_FOUR: DWORD = 0x00000008; +pub const D3DPRESENT_INTERVAL_IMMEDIATE: DWORD = 0x80000000; +pub const D3DCURSORCAPS_COLOR: DWORD = 0x00000001; +pub const D3DCURSORCAPS_LOWRES: DWORD = 0x00000002; +pub const D3DDEVCAPS_EXECUTESYSTEMMEMORY: DWORD = 0x00000010; +pub const D3DDEVCAPS_EXECUTEVIDEOMEMORY: DWORD = 0x00000020; +pub const D3DDEVCAPS_TLVERTEXSYSTEMMEMORY: DWORD = 0x00000040; +pub const D3DDEVCAPS_TLVERTEXVIDEOMEMORY: DWORD = 0x00000080; +pub const D3DDEVCAPS_TEXTURESYSTEMMEMORY: DWORD = 0x00000100; +pub const D3DDEVCAPS_TEXTUREVIDEOMEMORY: DWORD = 0x00000200; +pub const D3DDEVCAPS_DRAWPRIMTLVERTEX: DWORD = 0x00000400; +pub const D3DDEVCAPS_CANRENDERAFTERFLIP: DWORD = 0x00000800; +pub const D3DDEVCAPS_TEXTURENONLOCALVIDMEM: DWORD = 0x00001000; +pub const D3DDEVCAPS_DRAWPRIMITIVES2: DWORD = 0x00002000; +pub const D3DDEVCAPS_SEPARATETEXTUREMEMORIES: DWORD = 0x00004000; +pub const D3DDEVCAPS_DRAWPRIMITIVES2EX: DWORD = 0x00008000; +pub const D3DDEVCAPS_HWTRANSFORMANDLIGHT: DWORD = 0x00010000; +pub const D3DDEVCAPS_CANBLTSYSTONONLOCAL: DWORD = 0x00020000; +pub const D3DDEVCAPS_HWRASTERIZATION: DWORD = 0x00080000; +pub const D3DDEVCAPS_PUREDEVICE: DWORD = 0x00100000; +pub const D3DDEVCAPS_QUINTICRTPATCHES: DWORD = 0x00200000; +pub const D3DDEVCAPS_RTPATCHES: DWORD = 0x00400000; +pub const D3DDEVCAPS_RTPATCHHANDLEZERO: DWORD = 0x00800000; +pub const D3DDEVCAPS_NPATCHES: DWORD = 0x01000000; +pub const D3DPMISCCAPS_MASKZ: DWORD = 0x00000002; +pub const D3DPMISCCAPS_CULLNONE: DWORD = 0x00000010; +pub const D3DPMISCCAPS_CULLCW: DWORD = 0x00000020; +pub const D3DPMISCCAPS_CULLCCW: DWORD = 0x00000040; +pub const D3DPMISCCAPS_COLORWRITEENABLE: DWORD = 0x00000080; +pub const D3DPMISCCAPS_CLIPPLANESCALEDPOINTS: DWORD = 0x00000100; +pub const D3DPMISCCAPS_CLIPTLVERTS: DWORD = 0x00000200; +pub const D3DPMISCCAPS_TSSARGTEMP: DWORD = 0x00000400; +pub const D3DPMISCCAPS_BLENDOP: DWORD = 0x00000800; +pub const D3DPMISCCAPS_NULLREFERENCE: DWORD = 0x00001000; +pub const D3DPMISCCAPS_INDEPENDENTWRITEMASKS: DWORD = 0x00004000; +pub const D3DPMISCCAPS_PERSTAGECONSTANT: DWORD = 0x00008000; +pub const D3DPMISCCAPS_FOGANDSPECULARALPHA: DWORD = 0x00010000; +pub const D3DPMISCCAPS_SEPARATEALPHABLEND: DWORD = 0x00020000; +pub const D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS: DWORD = 0x00040000; +pub const D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING: DWORD = 0x00080000; +pub const D3DPMISCCAPS_FOGVERTEXCLAMPED: DWORD = 0x00100000; +pub const D3DPMISCCAPS_POSTBLENDSRGBCONVERT: DWORD = 0x00200000; +pub const D3DLINECAPS_TEXTURE: DWORD = 0x00000001; +pub const D3DLINECAPS_ZTEST: DWORD = 0x00000002; +pub const D3DLINECAPS_BLEND: DWORD = 0x00000004; +pub const D3DLINECAPS_ALPHACMP: DWORD = 0x00000008; +pub const D3DLINECAPS_FOG: DWORD = 0x00000010; +pub const D3DLINECAPS_ANTIALIAS: DWORD = 0x00000020; +pub const D3DPRASTERCAPS_DITHER: DWORD = 0x00000001; +pub const D3DPRASTERCAPS_ZTEST: DWORD = 0x00000010; +pub const D3DPRASTERCAPS_FOGVERTEX: DWORD = 0x00000080; +pub const D3DPRASTERCAPS_FOGTABLE: DWORD = 0x00000100; +pub const D3DPRASTERCAPS_MIPMAPLODBIAS: DWORD = 0x00002000; +pub const D3DPRASTERCAPS_ZBUFFERLESSHSR: DWORD = 0x00008000; +pub const D3DPRASTERCAPS_FOGRANGE: DWORD = 0x00010000; +pub const D3DPRASTERCAPS_ANISOTROPY: DWORD = 0x00020000; +pub const D3DPRASTERCAPS_WBUFFER: DWORD = 0x00040000; +pub const D3DPRASTERCAPS_WFOG: DWORD = 0x00100000; +pub const D3DPRASTERCAPS_ZFOG: DWORD = 0x00200000; +pub const D3DPRASTERCAPS_COLORPERSPECTIVE: DWORD = 0x00400000; +pub const D3DPRASTERCAPS_SCISSORTEST: DWORD = 0x01000000; +pub const D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS: DWORD = 0x02000000; +pub const D3DPRASTERCAPS_DEPTHBIAS: DWORD = 0x04000000; +pub const D3DPRASTERCAPS_MULTISAMPLE_TOGGLE: DWORD = 0x08000000; +pub const D3DPCMPCAPS_NEVER: DWORD = 0x00000001; +pub const D3DPCMPCAPS_LESS: DWORD = 0x00000002; +pub const D3DPCMPCAPS_EQUAL: DWORD = 0x00000004; +pub const D3DPCMPCAPS_LESSEQUAL: DWORD = 0x00000008; +pub const D3DPCMPCAPS_GREATER: DWORD = 0x00000010; +pub const D3DPCMPCAPS_NOTEQUAL: DWORD = 0x00000020; +pub const D3DPCMPCAPS_GREATEREQUAL: DWORD = 0x00000040; +pub const D3DPCMPCAPS_ALWAYS: DWORD = 0x00000080; +pub const D3DPBLENDCAPS_ZERO: DWORD = 0x00000001; +pub const D3DPBLENDCAPS_ONE: DWORD = 0x00000002; +pub const D3DPBLENDCAPS_SRCCOLOR: DWORD = 0x00000004; +pub const D3DPBLENDCAPS_INVSRCCOLOR: DWORD = 0x00000008; +pub const D3DPBLENDCAPS_SRCALPHA: DWORD = 0x00000010; +pub const D3DPBLENDCAPS_INVSRCALPHA: DWORD = 0x00000020; +pub const D3DPBLENDCAPS_DESTALPHA: DWORD = 0x00000040; +pub const D3DPBLENDCAPS_INVDESTALPHA: DWORD = 0x00000080; +pub const D3DPBLENDCAPS_DESTCOLOR: DWORD = 0x00000100; +pub const D3DPBLENDCAPS_INVDESTCOLOR: DWORD = 0x00000200; +pub const D3DPBLENDCAPS_SRCALPHASAT: DWORD = 0x00000400; +pub const D3DPBLENDCAPS_BOTHSRCALPHA: DWORD = 0x00000800; +pub const D3DPBLENDCAPS_BOTHINVSRCALPHA: DWORD = 0x00001000; +pub const D3DPBLENDCAPS_BLENDFACTOR: DWORD = 0x00002000; +pub const D3DPBLENDCAPS_SRCCOLOR2: DWORD = 0x00004000; +pub const D3DPBLENDCAPS_INVSRCCOLOR2: DWORD = 0x00008000; +pub const D3DPSHADECAPS_COLORGOURAUDRGB: DWORD = 0x00000008; +pub const D3DPSHADECAPS_SPECULARGOURAUDRGB: DWORD = 0x00000200; +pub const D3DPSHADECAPS_ALPHAGOURAUDBLEND: DWORD = 0x00004000; +pub const D3DPSHADECAPS_FOGGOURAUD: DWORD = 0x00080000; +pub const D3DPTEXTURECAPS_PERSPECTIVE: DWORD = 0x00000001; +pub const D3DPTEXTURECAPS_POW2: DWORD = 0x00000002; +pub const D3DPTEXTURECAPS_ALPHA: DWORD = 0x00000004; +pub const D3DPTEXTURECAPS_SQUAREONLY: DWORD = 0x00000020; +pub const D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE: DWORD = 0x00000040; +pub const D3DPTEXTURECAPS_ALPHAPALETTE: DWORD = 0x00000080; +pub const D3DPTEXTURECAPS_NONPOW2CONDITIONAL: DWORD = 0x00000100; +pub const D3DPTEXTURECAPS_PROJECTED: DWORD = 0x00000400; +pub const D3DPTEXTURECAPS_CUBEMAP: DWORD = 0x00000800; +pub const D3DPTEXTURECAPS_VOLUMEMAP: DWORD = 0x00002000; +pub const D3DPTEXTURECAPS_MIPMAP: DWORD = 0x00004000; +pub const D3DPTEXTURECAPS_MIPVOLUMEMAP: DWORD = 0x00008000; +pub const D3DPTEXTURECAPS_MIPCUBEMAP: DWORD = 0x00010000; +pub const D3DPTEXTURECAPS_CUBEMAP_POW2: DWORD = 0x00020000; +pub const D3DPTEXTURECAPS_VOLUMEMAP_POW2: DWORD = 0x00040000; +pub const D3DPTEXTURECAPS_NOPROJECTEDBUMPENV: DWORD = 0x00200000; +pub const D3DPTFILTERCAPS_MINFPOINT: DWORD = 0x00000100; +pub const D3DPTFILTERCAPS_MINFLINEAR: DWORD = 0x00000200; +pub const D3DPTFILTERCAPS_MINFANISOTROPIC: DWORD = 0x00000400; +pub const D3DPTFILTERCAPS_MINFPYRAMIDALQUAD: DWORD = 0x00000800; +pub const D3DPTFILTERCAPS_MINFGAUSSIANQUAD: DWORD = 0x00001000; +pub const D3DPTFILTERCAPS_MIPFPOINT: DWORD = 0x00010000; +pub const D3DPTFILTERCAPS_MIPFLINEAR: DWORD = 0x00020000; +pub const D3DPTFILTERCAPS_CONVOLUTIONMONO: DWORD = 0x00040000; +pub const D3DPTFILTERCAPS_MAGFPOINT: DWORD = 0x01000000; +pub const D3DPTFILTERCAPS_MAGFLINEAR: DWORD = 0x02000000; +pub const D3DPTFILTERCAPS_MAGFANISOTROPIC: DWORD = 0x04000000; +pub const D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD: DWORD = 0x08000000; +pub const D3DPTFILTERCAPS_MAGFGAUSSIANQUAD: DWORD = 0x10000000; +pub const D3DPTADDRESSCAPS_WRAP: DWORD = 0x00000001; +pub const D3DPTADDRESSCAPS_MIRROR: DWORD = 0x00000002; +pub const D3DPTADDRESSCAPS_CLAMP: DWORD = 0x00000004; +pub const D3DPTADDRESSCAPS_BORDER: DWORD = 0x00000008; +pub const D3DPTADDRESSCAPS_INDEPENDENTUV: DWORD = 0x00000010; +pub const D3DPTADDRESSCAPS_MIRRORONCE: DWORD = 0x00000020; +pub const D3DSTENCILCAPS_KEEP: DWORD = 0x00000001; +pub const D3DSTENCILCAPS_ZERO: DWORD = 0x00000002; +pub const D3DSTENCILCAPS_REPLACE: DWORD = 0x00000004; +pub const D3DSTENCILCAPS_INCRSAT: DWORD = 0x00000008; +pub const D3DSTENCILCAPS_DECRSAT: DWORD = 0x00000010; +pub const D3DSTENCILCAPS_INVERT: DWORD = 0x00000020; +pub const D3DSTENCILCAPS_INCR: DWORD = 0x00000040; +pub const D3DSTENCILCAPS_DECR: DWORD = 0x00000080; +pub const D3DSTENCILCAPS_TWOSIDED: DWORD = 0x00000100; +pub const D3DTEXOPCAPS_DISABLE: DWORD = 0x00000001; +pub const D3DTEXOPCAPS_SELECTARG1: DWORD = 0x00000002; +pub const D3DTEXOPCAPS_SELECTARG2: DWORD = 0x00000004; +pub const D3DTEXOPCAPS_MODULATE: DWORD = 0x00000008; +pub const D3DTEXOPCAPS_MODULATE2X: DWORD = 0x00000010; +pub const D3DTEXOPCAPS_MODULATE4X: DWORD = 0x00000020; +pub const D3DTEXOPCAPS_ADD: DWORD = 0x00000040; +pub const D3DTEXOPCAPS_ADDSIGNED: DWORD = 0x00000080; +pub const D3DTEXOPCAPS_ADDSIGNED2X: DWORD = 0x00000100; +pub const D3DTEXOPCAPS_SUBTRACT: DWORD = 0x00000200; +pub const D3DTEXOPCAPS_ADDSMOOTH: DWORD = 0x00000400; +pub const D3DTEXOPCAPS_BLENDDIFFUSEALPHA: DWORD = 0x00000800; +pub const D3DTEXOPCAPS_BLENDTEXTUREALPHA: DWORD = 0x00001000; +pub const D3DTEXOPCAPS_BLENDFACTORALPHA: DWORD = 0x00002000; +pub const D3DTEXOPCAPS_BLENDTEXTUREALPHAPM: DWORD = 0x00004000; +pub const D3DTEXOPCAPS_BLENDCURRENTALPHA: DWORD = 0x00008000; +pub const D3DTEXOPCAPS_PREMODULATE: DWORD = 0x00010000; +pub const D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR: DWORD = 0x00020000; +pub const D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA: DWORD = 0x00040000; +pub const D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR: DWORD = 0x00080000; +pub const D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA: DWORD = 0x00100000; +pub const D3DTEXOPCAPS_BUMPENVMAP: DWORD = 0x00200000; +pub const D3DTEXOPCAPS_BUMPENVMAPLUMINANCE: DWORD = 0x00400000; +pub const D3DTEXOPCAPS_DOTPRODUCT3: DWORD = 0x00800000; +pub const D3DTEXOPCAPS_MULTIPLYADD: DWORD = 0x01000000; +pub const D3DTEXOPCAPS_LERP: DWORD = 0x02000000; +pub const D3DFVFCAPS_TEXCOORDCOUNTMASK: DWORD = 0x0000ffff; +pub const D3DFVFCAPS_DONOTSTRIPELEMENTS: DWORD = 0x00080000; +pub const D3DFVFCAPS_PSIZE: DWORD = 0x00100000; +pub const D3DVTXPCAPS_TEXGEN: DWORD = 0x00000001; +pub const D3DVTXPCAPS_MATERIALSOURCE7: DWORD = 0x00000002; +pub const D3DVTXPCAPS_DIRECTIONALLIGHTS: DWORD = 0x00000008; +pub const D3DVTXPCAPS_POSITIONALLIGHTS: DWORD = 0x00000010; +pub const D3DVTXPCAPS_LOCALVIEWER: DWORD = 0x00000020; +pub const D3DVTXPCAPS_TWEENING: DWORD = 0x00000040; +pub const D3DVTXPCAPS_TEXGEN_SPHEREMAP: DWORD = 0x00000100; +pub const D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER: DWORD = 0x00000200; +pub const D3DDEVCAPS2_STREAMOFFSET: DWORD = 0x00000001; +pub const D3DDEVCAPS2_DMAPNPATCH: DWORD = 0x00000002; +pub const D3DDEVCAPS2_ADAPTIVETESSRTPATCH: DWORD = 0x00000004; +pub const D3DDEVCAPS2_ADAPTIVETESSNPATCH: DWORD = 0x00000008; +pub const D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES: DWORD = 0x00000010; +pub const D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH: DWORD = 0x00000020; +pub const D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET: DWORD = 0x00000040; +pub const D3DDTCAPS_UBYTE4: DWORD = 0x00000001; +pub const D3DDTCAPS_UBYTE4N: DWORD = 0x00000002; +pub const D3DDTCAPS_SHORT2N: DWORD = 0x00000004; +pub const D3DDTCAPS_SHORT4N: DWORD = 0x00000008; +pub const D3DDTCAPS_USHORT2N: DWORD = 0x00000010; +pub const D3DDTCAPS_USHORT4N: DWORD = 0x00000020; +pub const D3DDTCAPS_UDEC3: DWORD = 0x00000040; +pub const D3DDTCAPS_DEC3N: DWORD = 0x00000080; +pub const D3DDTCAPS_FLOAT16_2: DWORD = 0x00000100; +pub const D3DDTCAPS_FLOAT16_4: DWORD = 0x00000200; diff --git a/src/vendor/winapi/src/shared/d3d9types.rs b/src/vendor/winapi/src/shared/d3d9types.rs new file mode 100644 index 0000000000..19534effa2 --- /dev/null +++ b/src/vendor/winapi/src/shared/d3d9types.rs @@ -0,0 +1,1459 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Direct3D capabilities include file +use ctypes::{c_char, c_float, c_void}; +use shared::basetsd::UINT64; +use shared::guiddef::GUID; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, INT, UINT, USHORT, WORD}; +use shared::windef::HWND; +use um::winnt::{HANDLE, HRESULT, LARGE_INTEGER, LONG, SHORT}; +pub type D3DCOLOR = DWORD; +STRUCT!{struct D3DVECTOR { + x: c_float, + y: c_float, + z: c_float, +}} +STRUCT!{struct D3DCOLORVALUE { + r: c_float, + g: c_float, + b: c_float, + a: c_float, +}} +STRUCT!{struct D3DRECT { + x1: LONG, + y1: LONG, + x2: LONG, + y2: LONG, +}} +STRUCT!{struct D3DMATRIX { + m: [[c_float; 4]; 4], +}} +STRUCT!{struct D3DVIEWPORT9 { + X: DWORD, + Y: DWORD, + Width: DWORD, + Height: DWORD, + MinZ: c_float, + MaxZ: c_float, +}} +pub const D3DMAXUSERCLIPPLANES: DWORD = 32; +pub const D3DCLIPPLANE0: DWORD = 1 << 0; +pub const D3DCLIPPLANE1: DWORD = 1 << 1; +pub const D3DCLIPPLANE2: DWORD = 1 << 2; +pub const D3DCLIPPLANE3: DWORD = 1 << 3; +pub const D3DCLIPPLANE4: DWORD = 1 << 4; +pub const D3DCLIPPLANE5: DWORD = 1 << 5; +pub const D3DCS_LEFT: DWORD = 0x00000001; +pub const D3DCS_RIGHT: DWORD = 0x00000002; +pub const D3DCS_TOP: DWORD = 0x00000004; +pub const D3DCS_BOTTOM: DWORD = 0x00000008; +pub const D3DCS_FRONT: DWORD = 0x00000010; +pub const D3DCS_BACK: DWORD = 0x00000020; +pub const D3DCS_PLANE0: DWORD = 0x00000040; +pub const D3DCS_PLANE1: DWORD = 0x00000080; +pub const D3DCS_PLANE2: DWORD = 0x00000100; +pub const D3DCS_PLANE3: DWORD = 0x00000200; +pub const D3DCS_PLANE4: DWORD = 0x00000400; +pub const D3DCS_PLANE5: DWORD = 0x00000800; +pub const D3DCS_ALL: DWORD = D3DCS_LEFT | D3DCS_RIGHT | D3DCS_TOP | D3DCS_BOTTOM | D3DCS_FRONT + | D3DCS_BACK | D3DCS_PLANE0 | D3DCS_PLANE1 | D3DCS_PLANE2 | D3DCS_PLANE3 | D3DCS_PLANE4 + | D3DCS_PLANE5; +STRUCT!{struct D3DCLIPSTATUS9 { + ClipUnion: DWORD, + ClipIntersection: DWORD, +}} +STRUCT!{struct D3DMATERIAL9 { + Diffuse: D3DCOLORVALUE, + Ambient: D3DCOLORVALUE, + Specular: D3DCOLORVALUE, + Emissive: D3DCOLORVALUE, + Power: c_float, +}} +ENUM!{enum D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, +}} +STRUCT!{struct D3DLIGHT9 { + Type: D3DLIGHTTYPE, + Diffuse: D3DCOLORVALUE, + Specular: D3DCOLORVALUE, + Ambient: D3DCOLORVALUE, + Position: D3DVECTOR, + Direction: D3DVECTOR, + Range: c_float, + Falloff: c_float, + Attenuation0: c_float, + Attenuation1: c_float, + Attenuation2: c_float, + Theta: c_float, + Phi: c_float, +}} +pub const D3DCLEAR_TARGET: DWORD = 0x00000001; +pub const D3DCLEAR_ZBUFFER: DWORD = 0x00000002; +pub const D3DCLEAR_STENCIL: DWORD = 0x00000004; +ENUM!{enum D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, +}} +ENUM!{enum D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, +}} +ENUM!{enum D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_BLENDFACTOR = 14, + D3DBLEND_INVBLENDFACTOR = 15, + D3DBLEND_SRCCOLOR2 = 16, + D3DBLEND_INVSRCCOLOR2 = 17, +}} +ENUM!{enum D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, +}} +ENUM!{enum D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, +}} +ENUM!{enum D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, +}} +ENUM!{enum D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, +}} +ENUM!{enum D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, +}} +ENUM!{enum D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, +}} +ENUM!{enum D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, + D3DZB_USEW = 2, +}} +ENUM!{enum D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, +}} +ENUM!{enum D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, +}} +macro_rules! D3DTS_WORLDMATRIX { + ($index:expr) => ($index + 256) +} +pub const D3DTS_WORLD: D3DTRANSFORMSTATETYPE = D3DTS_WORLDMATRIX!(0); +pub const D3DTS_WORLD1: D3DTRANSFORMSTATETYPE = D3DTS_WORLDMATRIX!(1); +pub const D3DTS_WORLD2: D3DTRANSFORMSTATETYPE = D3DTS_WORLDMATRIX!(2); +pub const D3DTS_WORLD3: D3DTRANSFORMSTATETYPE = D3DTS_WORLDMATRIX!(3); +ENUM!{enum D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, + D3DRS_FILLMODE = 8, + D3DRS_SHADEMODE = 9, + D3DRS_ZWRITEENABLE = 14, + D3DRS_ALPHATESTENABLE = 15, + D3DRS_LASTPIXEL = 16, + D3DRS_SRCBLEND = 19, + D3DRS_DESTBLEND = 20, + D3DRS_CULLMODE = 22, + D3DRS_ZFUNC = 23, + D3DRS_ALPHAREF = 24, + D3DRS_ALPHAFUNC = 25, + D3DRS_DITHERENABLE = 26, + D3DRS_ALPHABLENDENABLE = 27, + D3DRS_FOGENABLE = 28, + D3DRS_SPECULARENABLE = 29, + D3DRS_FOGCOLOR = 34, + D3DRS_FOGTABLEMODE = 35, + D3DRS_FOGSTART = 36, + D3DRS_FOGEND = 37, + D3DRS_FOGDENSITY = 38, + D3DRS_RANGEFOGENABLE = 48, + D3DRS_STENCILENABLE = 52, + D3DRS_STENCILFAIL = 53, + D3DRS_STENCILZFAIL = 54, + D3DRS_STENCILPASS = 55, + D3DRS_STENCILFUNC = 56, + D3DRS_STENCILREF = 57, + D3DRS_STENCILMASK = 58, + D3DRS_STENCILWRITEMASK = 59, + D3DRS_TEXTUREFACTOR = 60, + D3DRS_WRAP0 = 128, + D3DRS_WRAP1 = 129, + D3DRS_WRAP2 = 130, + D3DRS_WRAP3 = 131, + D3DRS_WRAP4 = 132, + D3DRS_WRAP5 = 133, + D3DRS_WRAP6 = 134, + D3DRS_WRAP7 = 135, + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_POINTSIZE = 154, + D3DRS_POINTSIZE_MIN = 155, + D3DRS_POINTSPRITEENABLE = 156, + D3DRS_POINTSCALEENABLE = 157, + D3DRS_POINTSCALE_A = 158, + D3DRS_POINTSCALE_B = 159, + D3DRS_POINTSCALE_C = 160, + D3DRS_MULTISAMPLEANTIALIAS = 161, + D3DRS_MULTISAMPLEMASK = 162, + D3DRS_PATCHEDGESTYLE = 163, + D3DRS_DEBUGMONITORTOKEN = 165, + D3DRS_POINTSIZE_MAX = 166, + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, + D3DRS_TWEENFACTOR = 170, + D3DRS_BLENDOP = 171, + D3DRS_POSITIONDEGREE = 172, + D3DRS_NORMALDEGREE = 173, + D3DRS_SCISSORTESTENABLE = 174, + D3DRS_SLOPESCALEDEPTHBIAS = 175, + D3DRS_ANTIALIASEDLINEENABLE = 176, + D3DRS_MINTESSELLATIONLEVEL = 178, + D3DRS_MAXTESSELLATIONLEVEL = 179, + D3DRS_ADAPTIVETESS_X = 180, + D3DRS_ADAPTIVETESS_Y = 181, + D3DRS_ADAPTIVETESS_Z = 182, + D3DRS_ADAPTIVETESS_W = 183, + D3DRS_ENABLEADAPTIVETESSELLATION = 184, + D3DRS_TWOSIDEDSTENCILMODE = 185, + D3DRS_CCW_STENCILFAIL = 186, + D3DRS_CCW_STENCILZFAIL = 187, + D3DRS_CCW_STENCILPASS = 188, + D3DRS_CCW_STENCILFUNC = 189, + D3DRS_COLORWRITEENABLE1 = 190, + D3DRS_COLORWRITEENABLE2 = 191, + D3DRS_COLORWRITEENABLE3 = 192, + D3DRS_BLENDFACTOR = 193, + D3DRS_SRGBWRITEENABLE = 194, + D3DRS_DEPTHBIAS = 195, + D3DRS_WRAP8 = 198, + D3DRS_WRAP9 = 199, + D3DRS_WRAP10 = 200, + D3DRS_WRAP11 = 201, + D3DRS_WRAP12 = 202, + D3DRS_WRAP13 = 203, + D3DRS_WRAP14 = 204, + D3DRS_WRAP15 = 205, + D3DRS_SEPARATEALPHABLENDENABLE = 206, + D3DRS_SRCBLENDALPHA = 207, + D3DRS_DESTBLENDALPHA = 208, + D3DRS_BLENDOPALPHA = 209, +}} +pub const D3D_MAX_SIMULTANEOUS_RENDERTARGETS: DWORD = 4; +ENUM!{enum D3DMATERIALCOLORSOURCE { + D3DMCS_MATERIAL = 0, + D3DMCS_COLOR1 = 1, + D3DMCS_COLOR2 = 2, +}} +pub const D3DRENDERSTATE_WRAPBIAS: DWORD = 128; +pub const D3DWRAP_U: DWORD = 0x00000001; +pub const D3DWRAP_V: DWORD = 0x00000002; +pub const D3DWRAP_W: DWORD = 0x00000004; +pub const D3DWRAPCOORD_0: DWORD = 0x00000001; +pub const D3DWRAPCOORD_1: DWORD = 0x00000002; +pub const D3DWRAPCOORD_2: DWORD = 0x00000004; +pub const D3DWRAPCOORD_3: DWORD = 0x00000008; +pub const D3DCOLORWRITEENABLE_RED: DWORD = 1 << 0; +pub const D3DCOLORWRITEENABLE_GREEN: DWORD = 1 << 1; +pub const D3DCOLORWRITEENABLE_BLUE: DWORD = 1 << 2; +pub const D3DCOLORWRITEENABLE_ALPHA: DWORD = 1 << 3; +ENUM!{enum D3DTEXTURESTAGESTATETYPE { + D3DTSS_COLOROP = 1, + D3DTSS_COLORARG1 = 2, + D3DTSS_COLORARG2 = 3, + D3DTSS_ALPHAOP = 4, + D3DTSS_ALPHAARG1 = 5, + D3DTSS_ALPHAARG2 = 6, + D3DTSS_BUMPENVMAT00 = 7, + D3DTSS_BUMPENVMAT01 = 8, + D3DTSS_BUMPENVMAT10 = 9, + D3DTSS_BUMPENVMAT11 = 10, + D3DTSS_TEXCOORDINDEX = 11, + D3DTSS_BUMPENVLSCALE = 22, + D3DTSS_BUMPENVLOFFSET = 23, + D3DTSS_TEXTURETRANSFORMFLAGS = 24, + D3DTSS_COLORARG0 = 26, + D3DTSS_ALPHAARG0 = 27, + D3DTSS_RESULTARG = 28, + D3DTSS_CONSTANT = 32, +}} +ENUM!{enum D3DSAMPLERSTATETYPE { + D3DSAMP_ADDRESSU = 1, + D3DSAMP_ADDRESSV = 2, + D3DSAMP_ADDRESSW = 3, + D3DSAMP_BORDERCOLOR = 4, + D3DSAMP_MAGFILTER = 5, + D3DSAMP_MINFILTER = 6, + D3DSAMP_MIPFILTER = 7, + D3DSAMP_MIPMAPLODBIAS = 8, + D3DSAMP_MAXMIPLEVEL = 9, + D3DSAMP_MAXANISOTROPY = 10, + D3DSAMP_SRGBTEXTURE = 11, + D3DSAMP_ELEMENTINDEX = 12, + D3DSAMP_DMAPOFFSET = 13, +}} +pub const D3DDMAPSAMPLER: DWORD = 256; +pub const D3DVERTEXTEXTURESAMPLER0: DWORD = D3DDMAPSAMPLER + 1; +pub const D3DVERTEXTEXTURESAMPLER1: DWORD = D3DDMAPSAMPLER + 2; +pub const D3DVERTEXTEXTURESAMPLER2: DWORD = D3DDMAPSAMPLER + 3; +pub const D3DVERTEXTEXTURESAMPLER3: DWORD = D3DDMAPSAMPLER + 4; +pub const D3DTSS_TCI_PASSTHRU: DWORD = 0x00000000; +pub const D3DTSS_TCI_CAMERASPACENORMAL: DWORD = 0x00010000; +pub const D3DTSS_TCI_CAMERASPACEPOSITION: DWORD = 0x00020000; +pub const D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR: DWORD = 0x00030000; +pub const D3DTSS_TCI_SPHEREMAP: DWORD = 0x00040000; +ENUM!{enum D3DTEXTUREOP { + D3DTOP_DISABLE = 1, + D3DTOP_SELECTARG1 = 2, + D3DTOP_SELECTARG2 = 3, + D3DTOP_MODULATE = 4, + D3DTOP_MODULATE2X = 5, + D3DTOP_MODULATE4X = 6, + D3DTOP_ADD = 7, + D3DTOP_ADDSIGNED = 8, + D3DTOP_ADDSIGNED2X = 9, + D3DTOP_SUBTRACT = 10, + D3DTOP_ADDSMOOTH = 11, + D3DTOP_BLENDDIFFUSEALPHA = 12, + D3DTOP_BLENDTEXTUREALPHA = 13, + D3DTOP_BLENDFACTORALPHA = 14, + D3DTOP_BLENDTEXTUREALPHAPM = 15, + D3DTOP_BLENDCURRENTALPHA = 16, + D3DTOP_PREMODULATE = 17, + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, + D3DTOP_MODULATECOLOR_ADDALPHA = 19, + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, + D3DTOP_BUMPENVMAP = 22, + D3DTOP_BUMPENVMAPLUMINANCE = 23, + D3DTOP_DOTPRODUCT3 = 24, + D3DTOP_MULTIPLYADD = 25, + D3DTOP_LERP = 26, +}} +pub const D3DTA_SELECTMASK: DWORD = 0x0000000f; +pub const D3DTA_DIFFUSE: DWORD = 0x00000000; +pub const D3DTA_CURRENT: DWORD = 0x00000001; +pub const D3DTA_TEXTURE: DWORD = 0x00000002; +pub const D3DTA_TFACTOR: DWORD = 0x00000003; +pub const D3DTA_SPECULAR: DWORD = 0x00000004; +pub const D3DTA_TEMP: DWORD = 0x00000005; +pub const D3DTA_CONSTANT: DWORD = 0x00000006; +pub const D3DTA_COMPLEMENT: DWORD = 0x00000010; +pub const D3DTA_ALPHAREPLICATE: DWORD = 0x00000020; +ENUM!{enum D3DTEXTUREFILTERTYPE { + D3DTEXF_NONE = 0, + D3DTEXF_POINT = 1, + D3DTEXF_LINEAR = 2, + D3DTEXF_ANISOTROPIC = 3, + D3DTEXF_PYRAMIDALQUAD = 6, + D3DTEXF_GAUSSIANQUAD = 7, + D3DTEXF_CONVOLUTIONMONO = 8, +}} +pub const D3DPV_DONOTCOPYDATA: DWORD = 1 << 0; +pub const D3DFVF_RESERVED0: DWORD = 0x001; +pub const D3DFVF_POSITION_MASK: DWORD = 0x400E; +pub const D3DFVF_XYZ: DWORD = 0x002; +pub const D3DFVF_XYZRHW: DWORD = 0x004; +pub const D3DFVF_XYZB1: DWORD = 0x006; +pub const D3DFVF_XYZB2: DWORD = 0x008; +pub const D3DFVF_XYZB3: DWORD = 0x00a; +pub const D3DFVF_XYZB4: DWORD = 0x00c; +pub const D3DFVF_XYZB5: DWORD = 0x00e; +pub const D3DFVF_XYZW: DWORD = 0x4002; +pub const D3DFVF_NORMAL: DWORD = 0x010; +pub const D3DFVF_PSIZE: DWORD = 0x020; +pub const D3DFVF_DIFFUSE: DWORD = 0x040; +pub const D3DFVF_SPECULAR: DWORD = 0x080; +pub const D3DFVF_TEXCOUNT_MASK: DWORD = 0xf00; +pub const D3DFVF_TEXCOUNT_SHIFT: DWORD = 8; +pub const D3DFVF_TEX0: DWORD = 0x000; +pub const D3DFVF_TEX1: DWORD = 0x100; +pub const D3DFVF_TEX2: DWORD = 0x200; +pub const D3DFVF_TEX3: DWORD = 0x300; +pub const D3DFVF_TEX4: DWORD = 0x400; +pub const D3DFVF_TEX5: DWORD = 0x500; +pub const D3DFVF_TEX6: DWORD = 0x600; +pub const D3DFVF_TEX7: DWORD = 0x700; +pub const D3DFVF_TEX8: DWORD = 0x800; +pub const D3DFVF_LASTBETA_UBYTE4: DWORD = 0x1000; +pub const D3DFVF_LASTBETA_D3DCOLOR: DWORD = 0x8000; +pub const D3DFVF_RESERVED2: DWORD = 0x6000; +ENUM!{enum D3DDECLUSAGE { + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT, + D3DDECLUSAGE_BLENDINDICES, + D3DDECLUSAGE_NORMAL, + D3DDECLUSAGE_PSIZE, + D3DDECLUSAGE_TEXCOORD, + D3DDECLUSAGE_TANGENT, + D3DDECLUSAGE_BINORMAL, + D3DDECLUSAGE_TESSFACTOR, + D3DDECLUSAGE_POSITIONT, + D3DDECLUSAGE_COLOR, + D3DDECLUSAGE_FOG, + D3DDECLUSAGE_DEPTH, + D3DDECLUSAGE_SAMPLE, +}} +pub const MAXD3DDECLUSAGE: D3DDECLUSAGE = D3DDECLUSAGE_SAMPLE; +pub const MAXD3DDECLUSAGEINDEX: DWORD = 15; +pub const MAXD3DDECLLENGTH: DWORD = 64; +ENUM!{enum D3DDECLMETHOD { + D3DDECLMETHOD_DEFAULT = 0, + D3DDECLMETHOD_PARTIALU, + D3DDECLMETHOD_PARTIALV, + D3DDECLMETHOD_CROSSUV, + D3DDECLMETHOD_UV, + D3DDECLMETHOD_LOOKUP, + D3DDECLMETHOD_LOOKUPPRESAMPLED, +}} +pub const MAXD3DDECLMETHOD: D3DDECLMETHOD = D3DDECLMETHOD_LOOKUPPRESAMPLED; +ENUM!{enum D3DDECLTYPE { + D3DDECLTYPE_FLOAT1 = 0, + D3DDECLTYPE_FLOAT2 = 1, + D3DDECLTYPE_FLOAT3 = 2, + D3DDECLTYPE_FLOAT4 = 3, + D3DDECLTYPE_D3DCOLOR = 4, + D3DDECLTYPE_UBYTE4 = 5, + D3DDECLTYPE_SHORT2 = 6, + D3DDECLTYPE_SHORT4 = 7, + D3DDECLTYPE_UBYTE4N = 8, + D3DDECLTYPE_SHORT2N = 9, + D3DDECLTYPE_SHORT4N = 10, + D3DDECLTYPE_USHORT2N = 11, + D3DDECLTYPE_USHORT4N = 12, + D3DDECLTYPE_UDEC3 = 13, + D3DDECLTYPE_DEC3N = 14, + D3DDECLTYPE_FLOAT16_2 = 15, + D3DDECLTYPE_FLOAT16_4 = 16, + D3DDECLTYPE_UNUSED = 17, +}} +pub const MAXD3DDECLTYPE: D3DDECLTYPE = D3DDECLTYPE_UNUSED; +STRUCT!{struct D3DVERTEXELEMENT9 { + Stream: WORD, + Offset: WORD, + Type: BYTE, + Method: BYTE, + Usage: BYTE, + UsageIndex: BYTE, +}} +pub type LPD3DVERTEXELEMENT9 = *mut D3DVERTEXELEMENT9; +pub const D3DDECL_END: D3DVERTEXELEMENT9 = D3DVERTEXELEMENT9 { + Stream: 0xFF, + Offset: 0, + Type: D3DDECLTYPE_UNUSED as BYTE, + Method: 0, + Usage: 0, + UsageIndex: 0, +}; +pub const D3DDP_MAXTEXCOORD: DWORD = 8; +pub const D3DSTREAMSOURCE_INDEXEDDATA: DWORD = 1 << 30; +pub const D3DSTREAMSOURCE_INSTANCEDATA: DWORD = 2 << 30; +pub const D3DSI_OPCODE_MASK: DWORD = 0x0000FFFF; +pub const D3DSI_INSTLENGTH_MASK: DWORD = 0x0F000000; +pub const D3DSI_INSTLENGTH_SHIFT: DWORD = 24; +ENUM!{enum D3DSHADER_INSTRUCTION_OPCODE_TYPE { + D3DSIO_NOP = 0, + D3DSIO_MOV, + D3DSIO_ADD, + D3DSIO_SUB, + D3DSIO_MAD, + D3DSIO_MUL, + D3DSIO_RCP, + D3DSIO_RSQ, + D3DSIO_DP3, + D3DSIO_DP4, + D3DSIO_MIN, + D3DSIO_MAX, + D3DSIO_SLT, + D3DSIO_SGE, + D3DSIO_EXP, + D3DSIO_LOG, + D3DSIO_LIT, + D3DSIO_DST, + D3DSIO_LRP, + D3DSIO_FRC, + D3DSIO_M4x4, + D3DSIO_M4x3, + D3DSIO_M3x4, + D3DSIO_M3x3, + D3DSIO_M3x2, + D3DSIO_CALL, + D3DSIO_CALLNZ, + D3DSIO_LOOP, + D3DSIO_RET, + D3DSIO_ENDLOOP, + D3DSIO_LABEL, + D3DSIO_DCL, + D3DSIO_POW, + D3DSIO_CRS, + D3DSIO_SGN, + D3DSIO_ABS, + D3DSIO_NRM, + D3DSIO_SINCOS, + D3DSIO_REP, + D3DSIO_ENDREP, + D3DSIO_IF, + D3DSIO_IFC, + D3DSIO_ELSE, + D3DSIO_ENDIF, + D3DSIO_BREAK, + D3DSIO_BREAKC, + D3DSIO_MOVA, + D3DSIO_DEFB, + D3DSIO_DEFI, + D3DSIO_TEXCOORD = 64, + D3DSIO_TEXKILL, + D3DSIO_TEX, + D3DSIO_TEXBEM, + D3DSIO_TEXBEML, + D3DSIO_TEXREG2AR, + D3DSIO_TEXREG2GB, + D3DSIO_TEXM3x2PAD, + D3DSIO_TEXM3x2TEX, + D3DSIO_TEXM3x3PAD, + D3DSIO_TEXM3x3TEX, + D3DSIO_RESERVED0, + D3DSIO_TEXM3x3SPEC, + D3DSIO_TEXM3x3VSPEC, + D3DSIO_EXPP, + D3DSIO_LOGP, + D3DSIO_CND, + D3DSIO_DEF, + D3DSIO_TEXREG2RGB, + D3DSIO_TEXDP3TEX, + D3DSIO_TEXM3x2DEPTH, + D3DSIO_TEXDP3, + D3DSIO_TEXM3x3, + D3DSIO_TEXDEPTH, + D3DSIO_CMP, + D3DSIO_BEM, + D3DSIO_DP2ADD, + D3DSIO_DSX, + D3DSIO_DSY, + D3DSIO_TEXLDD, + D3DSIO_SETP, + D3DSIO_TEXLDL, + D3DSIO_BREAKP, + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, +}} +pub const D3DSI_COISSUE: DWORD = 0x40000000; +pub const D3DSP_OPCODESPECIFICCONTROL_MASK: DWORD = 0x00ff0000; +pub const D3DSP_OPCODESPECIFICCONTROL_SHIFT: DWORD = 16; +pub const D3DSI_TEXLD_PROJECT: DWORD = 0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT; +pub const D3DSI_TEXLD_BIAS: DWORD = 0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT; +ENUM!{enum D3DSHADER_COMPARISON { + D3DSPC_RESERVED0 = 0, + D3DSPC_GT = 1, + D3DSPC_EQ = 2, + D3DSPC_GE = 3, + D3DSPC_LT = 4, + D3DSPC_NE = 5, + D3DSPC_LE = 6, + D3DSPC_RESERVED1 = 7, +}} +pub const D3DSHADER_COMPARISON_SHIFT: DWORD = D3DSP_OPCODESPECIFICCONTROL_SHIFT; +pub const D3DSHADER_COMPARISON_MASK: DWORD = 0x7 << D3DSHADER_COMPARISON_SHIFT; +pub const D3DSHADER_INSTRUCTION_PREDICATED: DWORD = 0x1 << 28; +pub const D3DSP_DCL_USAGE_SHIFT: DWORD = 0; +pub const D3DSP_DCL_USAGE_MASK: DWORD = 0x0000000f; +pub const D3DSP_DCL_USAGEINDEX_SHIFT: DWORD = 16; +pub const D3DSP_DCL_USAGEINDEX_MASK: DWORD = 0x000f0000; +pub const D3DSP_TEXTURETYPE_SHIFT: DWORD = 27; +pub const D3DSP_TEXTURETYPE_MASK: DWORD = 0x78000000; +ENUM!{enum D3DSAMPLER_TEXTURE_TYPE { + D3DSTT_UNKNOWN = 0 << D3DSP_TEXTURETYPE_SHIFT, + D3DSTT_2D = 2 << D3DSP_TEXTURETYPE_SHIFT, + D3DSTT_CUBE = 3 << D3DSP_TEXTURETYPE_SHIFT, + D3DSTT_VOLUME = 4 << D3DSP_TEXTURETYPE_SHIFT, +}} +pub const D3DSP_REGNUM_MASK: DWORD = 0x000007FF; +pub const D3DSP_WRITEMASK_0: DWORD = 0x00010000; +pub const D3DSP_WRITEMASK_1: DWORD = 0x00020000; +pub const D3DSP_WRITEMASK_2: DWORD = 0x00040000; +pub const D3DSP_WRITEMASK_3: DWORD = 0x00080000; +pub const D3DSP_WRITEMASK_ALL: DWORD = 0x000F0000; +pub const D3DSP_DSTMOD_SHIFT: DWORD = 20; +pub const D3DSP_DSTMOD_MASK: DWORD = 0x00F00000; +pub const D3DSPDM_NONE: DWORD = 0 << D3DSP_DSTMOD_SHIFT; +pub const D3DSPDM_SATURATE: DWORD = 1 << D3DSP_DSTMOD_SHIFT; +pub const D3DSPDM_PARTIALPRECISION: DWORD = 2 << D3DSP_DSTMOD_SHIFT; +pub const D3DSPDM_MSAMPCENTROID: DWORD = 4 << D3DSP_DSTMOD_SHIFT; +pub const D3DSP_DSTSHIFT_SHIFT: DWORD = 24; +pub const D3DSP_DSTSHIFT_MASK: DWORD = 0x0F000000; +pub const D3DSP_REGTYPE_SHIFT: DWORD = 28; +pub const D3DSP_REGTYPE_SHIFT2: DWORD = 8; +pub const D3DSP_REGTYPE_MASK: DWORD = 0x70000000; +pub const D3DSP_REGTYPE_MASK2: DWORD = 0x00001800; +ENUM!{enum D3DSHADER_PARAM_REGISTER_TYPE { + D3DSPR_TEMP = 0, + D3DSPR_INPUT = 1, + D3DSPR_CONST = 2, + D3DSPR_ADDR = 3, + D3DSPR_TEXTURE = 3, + D3DSPR_RASTOUT = 4, + D3DSPR_ATTROUT = 5, + D3DSPR_TEXCRDOUT = 6, + D3DSPR_OUTPUT = 6, + D3DSPR_CONSTINT = 7, + D3DSPR_COLOROUT = 8, + D3DSPR_DEPTHOUT = 9, + D3DSPR_SAMPLER = 10, + D3DSPR_CONST2 = 11, + D3DSPR_CONST3 = 12, + D3DSPR_CONST4 = 13, + D3DSPR_CONSTBOOL = 14, + D3DSPR_LOOP = 15, + D3DSPR_TEMPFLOAT16 = 16, + D3DSPR_MISCTYPE = 17, + D3DSPR_LABEL = 18, + D3DSPR_PREDICATE = 19, +}} +ENUM!{enum D3DSHADER_MISCTYPE_OFFSETS { + D3DSMO_POSITION = 0, + D3DSMO_FACE = 1, +}} +ENUM!{enum D3DVS_RASTOUT_OFFSETS { + D3DSRO_POSITION = 0, + D3DSRO_FOG, + D3DSRO_POINT_SIZE, +}} +pub const D3DVS_ADDRESSMODE_SHIFT: DWORD = 13; +pub const D3DVS_ADDRESSMODE_MASK: DWORD = 1 << D3DVS_ADDRESSMODE_SHIFT; +ENUM!{enum D3DVS_ADDRESSMODE_TYPE { + D3DVS_ADDRMODE_ABSOLUTE = 0 << D3DVS_ADDRESSMODE_SHIFT, + D3DVS_ADDRMODE_RELATIVE = 1 << D3DVS_ADDRESSMODE_SHIFT, +}} +pub const D3DSHADER_ADDRESSMODE_SHIFT: DWORD = 13; +pub const D3DSHADER_ADDRESSMODE_MASK: DWORD = 1 << D3DSHADER_ADDRESSMODE_SHIFT; +ENUM!{enum D3DSHADER_ADDRESSMODE_TYPE { + D3DSHADER_ADDRMODE_ABSOLUTE = 0 << D3DSHADER_ADDRESSMODE_SHIFT, + D3DSHADER_ADDRMODE_RELATIVE = 1 << D3DSHADER_ADDRESSMODE_SHIFT, +}} +pub const D3DVS_SWIZZLE_SHIFT: DWORD = 16; +pub const D3DVS_SWIZZLE_MASK: DWORD = 0x00FF0000; +pub const D3DVS_X_X: DWORD = 0 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_X_Y: DWORD = 1 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_X_Z: DWORD = 2 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_X_W: DWORD = 3 << D3DVS_SWIZZLE_SHIFT; +pub const D3DVS_Y_X: DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Y_Y: DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Y_Z: DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Y_W: DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 2); +pub const D3DVS_Z_X: DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_Z_Y: DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_Z_Z: DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_Z_W: DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 4); +pub const D3DVS_W_X: DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_W_Y: DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_W_Z: DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_W_W: DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 6); +pub const D3DVS_NOSWIZZLE: DWORD = D3DVS_X_X | D3DVS_Y_Y | D3DVS_Z_Z | D3DVS_W_W; +pub const D3DSP_SWIZZLE_SHIFT: DWORD = 16; +pub const D3DSP_SWIZZLE_MASK: DWORD = 0x00FF0000; +pub const D3DSP_NOSWIZZLE: DWORD = (0 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (3 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATERED: DWORD = (0 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (0 << (D3DSP_SWIZZLE_SHIFT + 2)) | (0 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (0 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATEGREEN: DWORD = (1 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (1 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (1 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATEBLUE: DWORD = (2 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (2 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (2 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_REPLICATEALPHA: DWORD = (3 << (D3DSP_SWIZZLE_SHIFT + 0)) + | (3 << (D3DSP_SWIZZLE_SHIFT + 2)) | (3 << (D3DSP_SWIZZLE_SHIFT + 4)) + | (3 << (D3DSP_SWIZZLE_SHIFT + 6)); +pub const D3DSP_SRCMOD_SHIFT: DWORD = 24; +pub const D3DSP_SRCMOD_MASK: DWORD = 0x0F000000; +ENUM!{enum D3DSHADER_PARAM_SRCMOD_TYPE { + D3DSPSM_NONE = 0 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_NEG = 1 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_BIAS = 2 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_BIASNEG = 3 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_SIGN = 4 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_SIGNNEG = 5 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_COMP = 6 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_X2 = 7 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_X2NEG = 8 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_DZ = 9 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_DW = 10 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_ABS = 11 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_ABSNEG = 12 << D3DSP_SRCMOD_SHIFT, + D3DSPSM_NOT = 13 << D3DSP_SRCMOD_SHIFT, +}} +pub const D3DSP_MIN_PRECISION_SHIFT: DWORD = 14; +pub const D3DSP_MIN_PRECISION_MASK: DWORD = 0x0000C000; +ENUM!{enum D3DSHADER_MIN_PRECISION { + D3DMP_DEFAULT = 0, + D3DMP_16 = 1, + D3DMP_2_8 = 2, +}} +pub const D3DSI_COMMENTSIZE_SHIFT: DWORD = 16; +pub const D3DSI_COMMENTSIZE_MASK: DWORD = 0x7FFF0000; +pub const D3DPS_END: DWORD = 0x0000FFFF; +pub const D3DVS_END: DWORD = 0x0000FFFF; +ENUM!{enum D3DBASISTYPE { + D3DBASIS_BEZIER = 0, + D3DBASIS_BSPLINE = 1, + D3DBASIS_CATMULL_ROM = 2, +}} +ENUM!{enum D3DDEGREETYPE { + D3DDEGREE_LINEAR = 1, + D3DDEGREE_QUADRATIC = 2, + D3DDEGREE_CUBIC = 3, + D3DDEGREE_QUINTIC = 5, +}} +ENUM!{enum D3DPATCHEDGESTYLE { + D3DPATCHEDGE_DISCRETE = 0, + D3DPATCHEDGE_CONTINUOUS = 1, +}} +ENUM!{enum D3DSTATEBLOCKTYPE { + D3DSBT_ALL = 1, + D3DSBT_PIXELSTATE = 2, + D3DSBT_VERTEXSTATE = 3, +}} +ENUM!{enum D3DVERTEXBLENDFLAGS { + D3DVBF_DISABLE = 0, + D3DVBF_1WEIGHTS = 1, + D3DVBF_2WEIGHTS = 2, + D3DVBF_3WEIGHTS = 3, + D3DVBF_TWEENING = 255, + D3DVBF_0WEIGHTS = 256, +}} +ENUM!{enum D3DTEXTURETRANSFORMFLAGS { + D3DTTFF_DISABLE = 0, + D3DTTFF_COUNT1 = 1, + D3DTTFF_COUNT2 = 2, + D3DTTFF_COUNT3 = 3, + D3DTTFF_COUNT4 = 4, + D3DTTFF_PROJECTED = 256, +}} +pub const D3DFVF_TEXTUREFORMAT2: DWORD = 0; +pub const D3DFVF_TEXTUREFORMAT1: DWORD = 3; +pub const D3DFVF_TEXTUREFORMAT3: DWORD = 1; +pub const D3DFVF_TEXTUREFORMAT4: DWORD = 2; +ENUM!{enum D3DDEVTYPE { + D3DDEVTYPE_HAL = 1, + D3DDEVTYPE_REF = 2, + D3DDEVTYPE_SW = 3, + D3DDEVTYPE_NULLREF = 4, +}} +ENUM!{enum D3DMULTISAMPLE_TYPE { + D3DMULTISAMPLE_NONE = 0, + D3DMULTISAMPLE_NONMASKABLE = 1, + D3DMULTISAMPLE_2_SAMPLES = 2, + D3DMULTISAMPLE_3_SAMPLES = 3, + D3DMULTISAMPLE_4_SAMPLES = 4, + D3DMULTISAMPLE_5_SAMPLES = 5, + D3DMULTISAMPLE_6_SAMPLES = 6, + D3DMULTISAMPLE_7_SAMPLES = 7, + D3DMULTISAMPLE_8_SAMPLES = 8, + D3DMULTISAMPLE_9_SAMPLES = 9, + D3DMULTISAMPLE_10_SAMPLES = 10, + D3DMULTISAMPLE_11_SAMPLES = 11, + D3DMULTISAMPLE_12_SAMPLES = 12, + D3DMULTISAMPLE_13_SAMPLES = 13, + D3DMULTISAMPLE_14_SAMPLES = 14, + D3DMULTISAMPLE_15_SAMPLES = 15, + D3DMULTISAMPLE_16_SAMPLES = 16, +}} +ENUM!{enum D3DFORMAT { + D3DFMT_UNKNOWN = 0, + D3DFMT_R8G8B8 = 20, + D3DFMT_A8R8G8B8 = 21, + D3DFMT_X8R8G8B8 = 22, + D3DFMT_R5G6B5 = 23, + D3DFMT_X1R5G5B5 = 24, + D3DFMT_A1R5G5B5 = 25, + D3DFMT_A4R4G4B4 = 26, + D3DFMT_R3G3B2 = 27, + D3DFMT_A8 = 28, + D3DFMT_A8R3G3B2 = 29, + D3DFMT_X4R4G4B4 = 30, + D3DFMT_A2B10G10R10 = 31, + D3DFMT_A8B8G8R8 = 32, + D3DFMT_X8B8G8R8 = 33, + D3DFMT_G16R16 = 34, + D3DFMT_A2R10G10B10 = 35, + D3DFMT_A16B16G16R16 = 36, + D3DFMT_A8P8 = 40, + D3DFMT_P8 = 41, + D3DFMT_L8 = 50, + D3DFMT_A8L8 = 51, + D3DFMT_A4L4 = 52, + D3DFMT_V8U8 = 60, + D3DFMT_L6V5U5 = 61, + D3DFMT_X8L8V8U8 = 62, + D3DFMT_Q8W8V8U8 = 63, + D3DFMT_V16U16 = 64, + D3DFMT_A2W10V10U10 = 67, + D3DFMT_UYVY = MAKEFOURCC!(b'U', b'Y', b'V', b'Y'), + D3DFMT_R8G8_B8G8 = MAKEFOURCC!(b'R', b'G', b'B', b'G'), + D3DFMT_YUY2 = MAKEFOURCC!(b'Y', b'U', b'Y', b'2'), + D3DFMT_G8R8_G8B8 = MAKEFOURCC!(b'G', b'R', b'G', b'B'), + D3DFMT_DXT1 = MAKEFOURCC!(b'D', b'X', b'T', b'1'), + D3DFMT_DXT2 = MAKEFOURCC!(b'D', b'X', b'T', b'2'), + D3DFMT_DXT3 = MAKEFOURCC!(b'D', b'X', b'T', b'3'), + D3DFMT_DXT4 = MAKEFOURCC!(b'D', b'X', b'T', b'4'), + D3DFMT_DXT5 = MAKEFOURCC!(b'D', b'X', b'T', b'5'), + D3DFMT_D16_LOCKABLE = 70, + D3DFMT_D32 = 71, + D3DFMT_D15S1 = 73, + D3DFMT_D24S8 = 75, + D3DFMT_D24X8 = 77, + D3DFMT_D24X4S4 = 79, + D3DFMT_D16 = 80, + D3DFMT_D32F_LOCKABLE = 82, + D3DFMT_D24FS8 = 83, + D3DFMT_D32_LOCKABLE = 84, + D3DFMT_S8_LOCKABLE = 85, + D3DFMT_L16 = 81, + D3DFMT_VERTEXDATA = 100, + D3DFMT_INDEX16 = 101, + D3DFMT_INDEX32 = 102, + D3DFMT_Q16W16V16U16 = 110, + D3DFMT_MULTI2_ARGB8 = MAKEFOURCC!(b'M', b'E', b'T', b'1'), + D3DFMT_R16F = 111, + D3DFMT_G16R16F = 112, + D3DFMT_A16B16G16R16F = 113, + D3DFMT_R32F = 114, + D3DFMT_G32R32F = 115, + D3DFMT_A32B32G32R32F = 116, + D3DFMT_CxV8U8 = 117, + D3DFMT_A1 = 118, + D3DFMT_A2B10G10R10_XR_BIAS = 119, + D3DFMT_BINARYBUFFER = 199, +}} +STRUCT!{struct D3DDISPLAYMODE { + Width: UINT, + Height: UINT, + RefreshRate: UINT, + Format: D3DFORMAT, +}} +STRUCT!{struct D3DDEVICE_CREATION_PARAMETERS { + AdapterOrdinal: UINT, + DeviceType: D3DDEVTYPE, + hFocusWindow: HWND, + BehaviorFlags: DWORD, +}} +ENUM!{enum D3DSWAPEFFECT { + D3DSWAPEFFECT_DISCARD = 1, + D3DSWAPEFFECT_FLIP = 2, + D3DSWAPEFFECT_COPY = 3, + D3DSWAPEFFECT_OVERLAY = 4, + D3DSWAPEFFECT_FLIPEX = 5, +}} +ENUM!{enum D3DPOOL { + D3DPOOL_DEFAULT = 0, + D3DPOOL_MANAGED = 1, + D3DPOOL_SYSTEMMEM = 2, + D3DPOOL_SCRATCH = 3, +}} +pub const D3DPRESENT_RATE_DEFAULT: DWORD = 0x00000000; +STRUCT!{struct D3DPRESENT_PARAMETERS { + BackBufferWidth: UINT, + BackBufferHeight: UINT, + BackBufferFormat: D3DFORMAT, + BackBufferCount: UINT, + MultiSampleType: D3DMULTISAMPLE_TYPE, + MultiSampleQuality: DWORD, + SwapEffect: D3DSWAPEFFECT, + hDeviceWindow: HWND, + Windowed: BOOL, + EnableAutoDepthStencil: BOOL, + AutoDepthStencilFormat: D3DFORMAT, + Flags: DWORD, + FullScreen_RefreshRateInHz: UINT, + PresentationInterval: UINT, +}} +pub const D3DPRESENTFLAG_LOCKABLE_BACKBUFFER: DWORD = 0x00000001; +pub const D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL: DWORD = 0x00000002; +pub const D3DPRESENTFLAG_DEVICECLIP: DWORD = 0x00000004; +pub const D3DPRESENTFLAG_VIDEO: DWORD = 0x00000010; +pub const D3DPRESENTFLAG_NOAUTOROTATE: DWORD = 0x00000020; +pub const D3DPRESENTFLAG_UNPRUNEDMODE: DWORD = 0x00000040; +pub const D3DPRESENTFLAG_OVERLAY_LIMITEDRGB: DWORD = 0x00000080; +pub const D3DPRESENTFLAG_OVERLAY_YCbCr_BT709: DWORD = 0x00000100; +pub const D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC: DWORD = 0x00000200; +pub const D3DPRESENTFLAG_RESTRICTED_CONTENT: DWORD = 0x00000400; +pub const D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER: DWORD = 0x00000800; +STRUCT!{struct D3DGAMMARAMP { + red: [WORD; 256], + green: [WORD; 256], + blue: [WORD; 256], +}} +ENUM!{enum D3DBACKBUFFER_TYPE { + D3DBACKBUFFER_TYPE_MONO = 0, + D3DBACKBUFFER_TYPE_LEFT = 1, + D3DBACKBUFFER_TYPE_RIGHT = 2, +}} +ENUM!{enum D3DRESOURCETYPE { + D3DRTYPE_SURFACE = 1, + D3DRTYPE_VOLUME = 2, + D3DRTYPE_TEXTURE = 3, + D3DRTYPE_VOLUMETEXTURE = 4, + D3DRTYPE_CUBETEXTURE = 5, + D3DRTYPE_VERTEXBUFFER = 6, + D3DRTYPE_INDEXBUFFER = 7, +}} +pub const D3DUSAGE_RENDERTARGET: DWORD = 0x00000001; +pub const D3DUSAGE_DEPTHSTENCIL: DWORD = 0x00000002; +pub const D3DUSAGE_DYNAMIC: DWORD = 0x00000200; +pub const D3DUSAGE_NONSECURE: DWORD = 0x00800000; +pub const D3DUSAGE_AUTOGENMIPMAP: DWORD = 0x00000400; +pub const D3DUSAGE_DMAP: DWORD = 0x00004000; +pub const D3DUSAGE_QUERY_LEGACYBUMPMAP: DWORD = 0x00008000; +pub const D3DUSAGE_QUERY_SRGBREAD: DWORD = 0x00010000; +pub const D3DUSAGE_QUERY_FILTER: DWORD = 0x00020000; +pub const D3DUSAGE_QUERY_SRGBWRITE: DWORD = 0x00040000; +pub const D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING: DWORD = 0x00080000; +pub const D3DUSAGE_QUERY_VERTEXTEXTURE: DWORD = 0x00100000; +pub const D3DUSAGE_QUERY_WRAPANDMIP: DWORD = 0x00200000; +pub const D3DUSAGE_WRITEONLY: DWORD = 0x00000008; +pub const D3DUSAGE_SOFTWAREPROCESSING: DWORD = 0x00000010; +pub const D3DUSAGE_DONOTCLIP: DWORD = 0x00000020; +pub const D3DUSAGE_POINTS: DWORD = 0x00000040; +pub const D3DUSAGE_RTPATCHES: DWORD = 0x00000080; +pub const D3DUSAGE_NPATCHES: DWORD = 0x00000100; +pub const D3DUSAGE_TEXTAPI: DWORD = 0x10000000; +pub const D3DUSAGE_RESTRICTED_CONTENT: DWORD = 0x00000800; +pub const D3DUSAGE_RESTRICT_SHARED_RESOURCE: DWORD = 0x00002000; +pub const D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER: DWORD = 0x00001000; +ENUM!{enum D3DCUBEMAP_FACES { + D3DCUBEMAP_FACE_POSITIVE_X = 0, + D3DCUBEMAP_FACE_NEGATIVE_X = 1, + D3DCUBEMAP_FACE_POSITIVE_Y = 2, + D3DCUBEMAP_FACE_NEGATIVE_Y = 3, + D3DCUBEMAP_FACE_POSITIVE_Z = 4, + D3DCUBEMAP_FACE_NEGATIVE_Z = 5, +}} +pub const D3DLOCK_READONLY: DWORD = 0x00000010; +pub const D3DLOCK_DISCARD: DWORD = 0x00002000; +pub const D3DLOCK_NOOVERWRITE: DWORD = 0x00001000; +pub const D3DLOCK_NOSYSLOCK: DWORD = 0x00000800; +pub const D3DLOCK_DONOTWAIT: DWORD = 0x00004000; +pub const D3DLOCK_NO_DIRTY_UPDATE: DWORD = 0x00008000; +STRUCT!{struct D3DVERTEXBUFFER_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: DWORD, + Pool: D3DPOOL, + Size: UINT, + FVF: DWORD, +}} +STRUCT!{struct D3DINDEXBUFFER_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: DWORD, + Pool: D3DPOOL, + Size: UINT, +}} +STRUCT!{struct D3DSURFACE_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: DWORD, + Pool: D3DPOOL, + MultiSampleType: D3DMULTISAMPLE_TYPE, + MultiSampleQuality: DWORD, + Width: UINT, + Height: UINT, +}} +STRUCT!{struct D3DVOLUME_DESC { + Format: D3DFORMAT, + Type: D3DRESOURCETYPE, + Usage: DWORD, + Pool: D3DPOOL, + Width: UINT, + Height: UINT, + Depth: UINT, +}} +STRUCT!{struct D3DLOCKED_RECT { + Pitch: INT, + pBits: *mut c_void, +}} +STRUCT!{struct D3DBOX { + Left: UINT, + Top: UINT, + Right: UINT, + Bottom: UINT, + Front: UINT, + Back: UINT, +}} +STRUCT!{struct D3DLOCKED_BOX { + RowPitch: INT, + SlicePitch: INT, + pBits: *mut c_void, +}} +STRUCT!{struct D3DRANGE { + Offset: UINT, + Size: UINT, +}} +STRUCT!{struct D3DRECTPATCH_INFO { + StartVertexOffsetWidth: UINT, + StartVertexOffsetHeight: UINT, + Width: UINT, + Height: UINT, + Stride: UINT, + Basis: D3DBASISTYPE, + Degree: D3DDEGREETYPE, +}} +STRUCT!{struct D3DTRIPATCH_INFO { + StartVertexOffset: UINT, + NumVertices: UINT, + Basis: D3DBASISTYPE, + Degree: D3DDEGREETYPE, +}} +pub const MAX_DEVICE_IDENTIFIER_STRING: usize = 512; +// FIXME packed(4) +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct D3DADAPTER_IDENTIFIER9 { + Driver: [c_char; MAX_DEVICE_IDENTIFIER_STRING], + Description: [c_char; MAX_DEVICE_IDENTIFIER_STRING], + DeviceName: [c_char; 32], + DriverVersion: LARGE_INTEGER, + VendorId: DWORD, + DeviceId: DWORD, + SubSysId: DWORD, + Revision: DWORD, + DeviceIdentifier: GUID, + WHQLLevel: DWORD, +}} +STRUCT!{struct D3DRASTER_STATUS { + InVBlank: BOOL, + ScanLine: UINT, +}} +ENUM!{enum D3DDEBUGMONITORTOKENS { + D3DDMT_ENABLE = 0, + D3DDMT_DISABLE = 1, +}} +ENUM!{enum D3DQUERYTYPE { + D3DQUERYTYPE_VCACHE = 4, + D3DQUERYTYPE_RESOURCEMANAGER = 5, + D3DQUERYTYPE_VERTEXSTATS = 6, + D3DQUERYTYPE_EVENT = 8, + D3DQUERYTYPE_OCCLUSION = 9, + D3DQUERYTYPE_TIMESTAMP = 10, + D3DQUERYTYPE_TIMESTAMPDISJOINT = 11, + D3DQUERYTYPE_TIMESTAMPFREQ = 12, + D3DQUERYTYPE_PIPELINETIMINGS = 13, + D3DQUERYTYPE_INTERFACETIMINGS = 14, + D3DQUERYTYPE_VERTEXTIMINGS = 15, + D3DQUERYTYPE_PIXELTIMINGS = 16, + D3DQUERYTYPE_BANDWIDTHTIMINGS = 17, + D3DQUERYTYPE_CACHEUTILIZATION = 18, + D3DQUERYTYPE_MEMORYPRESSURE = 19, +}} +pub const D3DISSUE_END: DWORD = 1 << 0; +pub const D3DISSUE_BEGIN: DWORD = 1 << 1; +pub const D3DGETDATA_FLUSH: DWORD = 1 << 0; +STRUCT!{struct D3DRESOURCESTATS { + bThrashing: BOOL, + ApproxBytesDownloaded: DWORD, + NumEvicts: DWORD, + NumVidCreates: DWORD, + LastPri: DWORD, + NumUsed: DWORD, + NumUsedInVidMem: DWORD, + WorkingSet: DWORD, + WorkingSetBytes: DWORD, + TotalManaged: DWORD, + TotalBytes: DWORD, +}} +pub const D3DRTYPECOUNT: usize = D3DRTYPE_INDEXBUFFER as usize + 1; +STRUCT!{struct D3DDEVINFO_RESOURCEMANAGER { + stats: [D3DRESOURCESTATS; D3DRTYPECOUNT], +}} +pub type LPD3DDEVINFO_RESOURCEMANAGER = *mut D3DDEVINFO_RESOURCEMANAGER; +STRUCT!{struct D3DDEVINFO_D3DVERTEXSTATS { + NumRenderedTriangles: DWORD, + NumExtraClippingTriangles: DWORD, +}} +pub type LPD3DDEVINFO_D3DVERTEXSTATS = *mut D3DDEVINFO_D3DVERTEXSTATS; +STRUCT!{struct D3DDEVINFO_VCACHE { + Pattern: DWORD, + OptMethod: DWORD, + CacheSize: DWORD, + MagicNumber: DWORD, +}} +pub type LPD3DDEVINFO_VCACHE = *mut D3DDEVINFO_VCACHE; +STRUCT!{struct D3DDEVINFO_D3D9PIPELINETIMINGS { + VertexProcessingTimePercent: FLOAT, + PixelProcessingTimePercent: FLOAT, + OtherGPUProcessingTimePercent: FLOAT, + GPUIdleTimePercent: FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9INTERFACETIMINGS { + WaitingForGPUToUseApplicationResourceTimePercent: FLOAT, + WaitingForGPUToAcceptMoreCommandsTimePercent: FLOAT, + WaitingForGPUToStayWithinLatencyTimePercent: FLOAT, + WaitingForGPUExclusiveResourceTimePercent: FLOAT, + WaitingForGPUOtherTimePercent: FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9STAGETIMINGS { + MemoryProcessingPercent: FLOAT, + ComputationProcessingPercent: FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9BANDWIDTHTIMINGS { + MaxBandwidthUtilized: FLOAT, + FrontEndUploadMemoryUtilizedPercent: FLOAT, + VertexRateUtilizedPercent: FLOAT, + TriangleSetupRateUtilizedPercent: FLOAT, + FillRateUtilizedPercent: FLOAT, +}} +STRUCT!{struct D3DDEVINFO_D3D9CACHEUTILIZATION { + TextureCacheHitRate: FLOAT, + PostTransformVertexCacheHitRate: FLOAT, +}} +// FIXME packed(4) +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct D3DMEMORYPRESSURE { + BytesEvictedFromProcess: UINT64, + SizeOfInefficientAllocation: UINT64, + LevelOfEfficiency: DWORD, +}} +ENUM!{enum D3DCOMPOSERECTSOP { + D3DCOMPOSERECTS_COPY = 1, + D3DCOMPOSERECTS_OR = 2, + D3DCOMPOSERECTS_AND = 3, + D3DCOMPOSERECTS_NEG = 4, +}} +STRUCT!{struct D3DCOMPOSERECTDESC { + X: USHORT, + Y: USHORT, + Width: USHORT, + Height: USHORT, +}} +STRUCT!{struct D3DCOMPOSERECTDESTINATION { + SrcRectIndex: USHORT, + Reserved: USHORT, + X: SHORT, + Y: SHORT, +}} +pub const D3DCOMPOSERECTS_MAXNUMRECTS: DWORD = 0xFFFF; +pub const D3DCONVOLUTIONMONO_MAXWIDTH: DWORD = 7; +pub const D3DCONVOLUTIONMONO_MAXHEIGHT: DWORD = D3DCONVOLUTIONMONO_MAXWIDTH; +pub const D3DFMT_A1_SURFACE_MAXWIDTH: DWORD = 8192; +pub const D3DFMT_A1_SURFACE_MAXHEIGHT: DWORD = 2048; +// FIXME packed(4) +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct D3DPRESENTSTATS { + PresentCount: UINT, + PresentRefreshCount: UINT, + SyncRefreshCount: UINT, + SyncQPCTime: LARGE_INTEGER, + SyncGPUTime: LARGE_INTEGER, +}} +ENUM!{enum D3DSCANLINEORDERING { + D3DSCANLINEORDERING_UNKNOWN = 0, + D3DSCANLINEORDERING_PROGRESSIVE = 1, + D3DSCANLINEORDERING_INTERLACED = 2, +}} +STRUCT!{struct D3DDISPLAYMODEEX { + Size: UINT, + Width: UINT, + Height: UINT, + RefreshRate: UINT, + Format: D3DFORMAT, + ScanLineOrdering: D3DSCANLINEORDERING, +}} +STRUCT!{struct D3DDISPLAYMODEFILTER { + Size: UINT, + Format: D3DFORMAT, + ScanLineOrdering: D3DSCANLINEORDERING, +}} +ENUM!{enum D3DDISPLAYROTATION { + D3DDISPLAYROTATION_IDENTITY = 1, + D3DDISPLAYROTATION_90 = 2, + D3DDISPLAYROTATION_180 = 3, + D3DDISPLAYROTATION_270 = 4, +}} +pub const D3D9_RESOURCE_PRIORITY_MINIMUM: DWORD = 0x28000000; +pub const D3D9_RESOURCE_PRIORITY_LOW: DWORD = 0x50000000; +pub const D3D9_RESOURCE_PRIORITY_NORMAL: DWORD = 0x78000000; +pub const D3D9_RESOURCE_PRIORITY_HIGH: DWORD = 0xa0000000; +pub const D3D9_RESOURCE_PRIORITY_MAXIMUM: DWORD = 0xc8000000; +pub const D3D_OMAC_SIZE: usize = 16; +STRUCT!{struct D3D_OMAC { + Omac: [BYTE; D3D_OMAC_SIZE], +}} +ENUM!{enum D3DAUTHENTICATEDCHANNELTYPE { + D3DAUTHENTICATEDCHANNEL_D3D9 = 1, + D3DAUTHENTICATEDCHANNEL_DRIVER_SOFTWARE = 2, + D3DAUTHENTICATEDCHANNEL_DRIVER_HARDWARE = 3, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERY_INPUT { + QueryType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT { + omac: D3D_OMAC, + QueryType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, + ReturnCode: HRESULT, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_PROTECTION, + 0xa84eb584, 0xc495, 0x48aa, 0xb9, 0x4d, 0x8b, 0xd2, 0xd6, 0xfb, 0xce, 0x5} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS { + Value: UINT, +}} +BITFIELD!{D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS Value: UINT [ + ProtectionEnabled set_ProtectionEnabled[0..1], + OverlayOrFullscreenRequired set_OverlayOrFullscreenRequired[1..2], +]} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + ProtectionFlags: D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_CHANNELTYPE, + 0xbc1b18a5, 0xb1fb, 0x42ab, 0xbd, 0x94, 0xb5, 0x82, 0x8b, 0x4b, 0xf7, 0xbe} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + ChannelType: D3DAUTHENTICATEDCHANNELTYPE, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_DEVICEHANDLE, + 0xec1c539d, 0x8cff, 0x4e2a, 0xbc, 0xc4, 0xf5, 0x69, 0x2f, 0x99, 0xf4, 0x80} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DeviceHandle: HANDLE, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_CRYPTOSESSION, + 0x2634499e, 0xd018, 0x4d74, 0xac, 0x17, 0x7f, 0x72, 0x40, 0x59, 0x52, 0x8d} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + DXVA2DecodeHandle: HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DXVA2DecodeHandle: HANDLE, + CryptoSessionHandle: HANDLE, + DeviceHandle: HANDLE, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESSCOUNT, + 0xdb207b3, 0x9450, 0x46a6, 0x82, 0xde, 0x1b, 0x96, 0xd4, 0x4f, 0x9c, 0xf2} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + NumRestrictedSharedResourceProcesses: UINT, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESS, + 0x649bbadb, 0xf0f4, 0x4639, 0xa1, 0x5b, 0x24, 0x39, 0x3f, 0xc3, 0xab, 0xac} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + ProcessIndex: UINT, +}} +ENUM!{enum D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE { + PROCESSIDTYPE_UNKNOWN = 0, + PROCESSIDTYPE_DWM = 1, + PROCESSIDTYPE_HANDLE = 2, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + ProcessIndex: UINT, + ProcessIdentifer: D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE, + ProcessHandle: HANDLE, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_UNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT, + 0x12f0bd6, 0xe662, 0x4474, 0xbe, 0xfd, 0xaa, 0x53, 0xe5, 0x14, 0x3c, 0x6d} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + NumUnrestrictedProtectedSharedResources: UINT, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_OUTPUTIDCOUNT, + 0x2c042b5e, 0x8c07, 0x46d5, 0xaa, 0xbe, 0x8f, 0x75, 0xcb, 0xad, 0x4c, 0x31} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + NumOutputIDs: UINT, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_OUTPUTID, + 0x839ddca3, 0x9b4e, 0x41e4, 0xb0, 0x53, 0x89, 0x2b, 0xd2, 0xa1, 0x1e, 0xe7} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDIndex: UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDIndex: UINT, + OutputID: UINT64, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_ACCESSIBILITYATTRIBUTES, + 0x6214d9d2, 0x432c, 0x4abb, 0x9f, 0xce, 0x21, 0x6e, 0xea, 0x26, 0x9e, 0x3b} +ENUM!{enum D3DBUSTYPE { + D3DBUSTYPE_OTHER = 0x00000000, + D3DBUSTYPE_PCI = 0x00000001, + D3DBUSTYPE_PCIX = 0x00000002, + D3DBUSTYPE_PCIEXPRESS = 0x00000003, + D3DBUSTYPE_AGP = 0x00000004, + D3DBUSIMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x00010000, + MD3DBUSIMPL_ODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x00020000, + D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x00030000, + D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x00040000, + D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x00050000, + D3DBUSIMPL_MODIFIER_NON_STANDARD = 0x80000000, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + BusType: D3DBUSTYPE, + bAccessibleInContiguousBlocks: BOOL, + bAccessibleInNonContiguousBlocks: BOOL, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUIDCOUNT, + 0xb30f7066, 0x203c, 0x4b07, 0x93, 0xfc, 0xce, 0xaa, 0xfd, 0x61, 0x24, 0x1e} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + NumEncryptionGuids: UINT, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUID, + 0xf83a5958, 0xe986, 0x4bda, 0xbe, 0xb0, 0x41, 0x1f, 0x6a, 0x7a, 0x1, 0xb7} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT { + Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, + EncryptionGuidIndex: UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + EncryptionGuidIndex: UINT, + EncryptionGuid: GUID, +}} +DEFINE_GUID!{D3DAUTHENTICATEDQUERY_CURRENTENCRYPTIONWHENACCESSIBLE, + 0xec1791c7, 0xdad3, 0x4f15, 0x9e, 0xc3, 0xfa, 0xa9, 0x3d, 0x60, 0xd4, 0xf0} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT { + Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, + EncryptionGuid: GUID, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT { + omac: D3D_OMAC, + ConfigureType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, +}} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT { + omac: D3D_OMAC, + ConfigureType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, + ReturnCode: HRESULT, +}} +DEFINE_GUID!{D3DAUTHENTICATEDCONFIGURE_INITIALIZE, + 0x6114bdb, 0x3523, 0x470a, 0x8d, 0xca, 0xfb, 0xc2, 0x84, 0x51, 0x54, 0xf0} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + StartSequenceQuery: UINT, + StartSequenceConfigure: UINT, +}} +DEFINE_GUID!{D3DAUTHENTICATEDCONFIGURE_PROTECTION, + 0x50455658, 0x3f47, 0x4362, 0xbf, 0x99, 0xbf, 0xdf, 0xcd, 0xe9, 0xed, 0x29} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + Protections: D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, +}} +DEFINE_GUID!{D3DAUTHENTICATEDCONFIGURE_CRYPTOSESSION, + 0x6346cc54, 0x2cfc, 0x4ad4, 0x82, 0x24, 0xd1, 0x58, 0x37, 0xde, 0x77, 0x0} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + DXVA2DecodeHandle: HANDLE, + CryptoSessionHandle: HANDLE, + DeviceHandle: HANDLE, +}} +DEFINE_GUID!{D3DAUTHENTICATEDCONFIGURE_SHAREDRESOURCE, + 0x772d047, 0x1b40, 0x48e8, 0x9c, 0xa6, 0xb5, 0xf5, 0x10, 0xde, 0x9f, 0x1} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + ProcessIdentiferType: D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE, + ProcessHandle: HANDLE, + AllowAccess: BOOL, +}} +DEFINE_GUID!{D3DAUTHENTICATEDCONFIGURE_ENCRYPTIONWHENACCESSIBLE, + 0x41fff286, 0x6ae0, 0x4d43, 0x9d, 0x55, 0xa4, 0x6e, 0x9e, 0xfd, 0x15, 0x8a} +STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION { + Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, + EncryptionGuid: GUID, +}} +STRUCT!{struct D3DENCRYPTED_BLOCK_INFO { + NumEncryptedBytesAtBeginning: UINT, + NumBytesInSkipPattern: UINT, + NumBytesInEncryptPattern: UINT, +}} +STRUCT!{struct D3DAES_CTR_IV { + IV: UINT64, + Count: UINT64, +}} diff --git a/src/vendor/winapi/src/shared/dcomptypes.rs b/src/vendor/winapi/src/shared/dcomptypes.rs new file mode 100644 index 0000000000..c93779924d --- /dev/null +++ b/src/vendor/winapi/src/shared/dcomptypes.rs @@ -0,0 +1,51 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dcomptypes.h +use shared::dxgitype::DXGI_RATIONAL; +use shared::minwindef::DWORD; +use um::winnt::LARGE_INTEGER; +ENUM!{enum DCOMPOSITION_BITMAP_INTERPOLATION_MODE { + DCOMPOSITION_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + DCOMPOSITION_BITMAP_INTERPOLATION_MODE_LINEAR = 1, + DCOMPOSITION_BITMAP_INTERPOLATION_MODE_INHERIT = 0xffffffff, +}} +ENUM!{enum DCOMPOSITION_BORDER_MODE { + DCOMPOSITION_BORDER_MODE_SOFT = 0, + DCOMPOSITION_BORDER_MODE_HARD = 1, + DCOMPOSITION_BORDER_MODE_INHERIT = 0xffffffff, +}} +ENUM!{enum DCOMPOSITION_COMPOSITE_MODE { + DCOMPOSITION_COMPOSITE_MODE_SOURCE_OVER = 0, + DCOMPOSITION_COMPOSITE_MODE_DESTINATION_INVERT = 1, + DCOMPOSITION_COMPOSITE_MODE_MIN_BLEND = 2, + DCOMPOSITION_COMPOSITE_MODE_INHERIT = 0xffffffff, +}} +ENUM!{enum DCOMPOSITION_BACKFACE_VISIBILITY { + DCOMPOSITION_BACKFACE_VISIBILITY_VISIBLE = 0, + DCOMPOSITION_BACKFACE_VISIBILITY_HIDDEN = 1, + DCOMPOSITION_BACKFACE_VISIBILITY_INHERIT = 0xffffffff, +}} +ENUM!{enum DCOMPOSITION_OPACITY_MODE { + DCOMPOSITION_OPACITY_MODE_LAYER = 0, + DCOMPOSITION_OPACITY_MODE_MULTIPLY = 1, + DCOMPOSITION_OPACITY_MODE_INHERIT = 0xffffffff, +}} +ENUM!{enum DCOMPOSITION_DEPTH_MODE { + DCOMPOSITION_DEPTH_MODE_TREE = 0, + DCOMPOSITION_DEPTH_MODE_SPATIAL = 1, + DCOMPOSITION_DEPTH_MODE_INHERIT = 0xffffffff, +}} +STRUCT!{struct DCOMPOSITION_FRAME_STATISTICS { + lastFrameTime: LARGE_INTEGER, + currentCompositionRate: DXGI_RATIONAL, + currentTime: LARGE_INTEGER, + timeFrequency: LARGE_INTEGER, + nextEstimatedFrameTime: LARGE_INTEGER, +}} +pub const COMPOSITIONOBJECT_READ: DWORD = 0x0001; +pub const COMPOSITIONOBJECT_WRITE: DWORD = 0x0002; +pub const COMPOSITIONOBJECT_ALL_ACCESS: DWORD = COMPOSITIONOBJECT_READ | COMPOSITIONOBJECT_WRITE; diff --git a/src/vendor/winapi/src/shared/devguid.rs b/src/vendor/winapi/src/shared/devguid.rs new file mode 100644 index 0000000000..3ed6a6458f --- /dev/null +++ b/src/vendor/winapi/src/shared/devguid.rs @@ -0,0 +1,179 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Defines GUIDs for device classes used in Plug & Play. +DEFINE_GUID!{GUID_DEVCLASS_1394, + 0x6bdd1fc1, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f} +DEFINE_GUID!{GUID_DEVCLASS_1394DEBUG, + 0x66f250d6, 0x7801, 0x4a64, 0xb1, 0x39, 0xee, 0xa8, 0x0a, 0x45, 0x0b, 0x24} +DEFINE_GUID!{GUID_DEVCLASS_61883, + 0x7ebefbc0, 0x3200, 0x11d2, 0xb4, 0xc2, 0x00, 0xa0, 0xc9, 0x69, 0x7d, 0x07} +DEFINE_GUID!{GUID_DEVCLASS_ADAPTER, + 0x4d36e964, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_APMSUPPORT, + 0xd45b1c18, 0xc8fa, 0x11d1, 0x9f, 0x77, 0x00, 0x00, 0xf8, 0x05, 0xf5, 0x30} +DEFINE_GUID!{GUID_DEVCLASS_AVC, + 0xc06ff265, 0xae09, 0x48f0, 0x81, 0x2c, 0x16, 0x75, 0x3d, 0x7c, 0xba, 0x83} +DEFINE_GUID!{GUID_DEVCLASS_BATTERY, + 0x72631e54, 0x78a4, 0x11d0, 0xbc, 0xf7, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a} +DEFINE_GUID!{GUID_DEVCLASS_BIOMETRIC, + 0x53d29ef7, 0x377c, 0x4d14, 0x86, 0x4b, 0xeb, 0x3a, 0x85, 0x76, 0x93, 0x59} +DEFINE_GUID!{GUID_DEVCLASS_BLUETOOTH, + 0xe0cbf06c, 0xcd8b, 0x4647, 0xbb, 0x8a, 0x26, 0x3b, 0x43, 0xf0, 0xf9, 0x74} +DEFINE_GUID!{GUID_DEVCLASS_CDROM, + 0x4d36e965, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_COMPUTER, + 0x4d36e966, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_DECODER, + 0x6bdd1fc2, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f} +DEFINE_GUID!{GUID_DEVCLASS_DISKDRIVE, + 0x4d36e967, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_DISPLAY, + 0x4d36e968, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_DOT4, + 0x48721b56, 0x6795, 0x11d2, 0xb1, 0xa8, 0x00, 0x80, 0xc7, 0x2e, 0x74, 0xa2} +DEFINE_GUID!{GUID_DEVCLASS_DOT4PRINT, + 0x49ce6ac8, 0x6f86, 0x11d2, 0xb1, 0xe5, 0x00, 0x80, 0xc7, 0x2e, 0x74, 0xa2} +DEFINE_GUID!{GUID_DEVCLASS_ENUM1394, + 0xc459df55, 0xdb08, 0x11d1, 0xb0, 0x09, 0x00, 0xa0, 0xc9, 0x08, 0x1f, 0xf6} +DEFINE_GUID!{GUID_DEVCLASS_FDC, + 0x4d36e969, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_FLOPPYDISK, + 0x4d36e980, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_GPS, + 0x6bdd1fc3, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f} +DEFINE_GUID!{GUID_DEVCLASS_HDC, + 0x4d36e96a, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_HIDCLASS, + 0x745a17a0, 0x74d3, 0x11d0, 0xb6, 0xfe, 0x00, 0xa0, 0xc9, 0x0f, 0x57, 0xda} +DEFINE_GUID!{GUID_DEVCLASS_IMAGE, + 0x6bdd1fc6, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f} +DEFINE_GUID!{GUID_DEVCLASS_INFINIBAND, + 0x30ef7132, 0xd858, 0x4a0c, 0xac, 0x24, 0xb9, 0x02, 0x8a, 0x5c, 0xca, 0x3f} +DEFINE_GUID!{GUID_DEVCLASS_INFRARED, + 0x6bdd1fc5, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f} +DEFINE_GUID!{GUID_DEVCLASS_KEYBOARD, + 0x4d36e96b, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_LEGACYDRIVER, + 0x8ecc055d, 0x047f, 0x11d1, 0xa5, 0x37, 0x00, 0x00, 0xf8, 0x75, 0x3e, 0xd1} +DEFINE_GUID!{GUID_DEVCLASS_MEDIA, + 0x4d36e96c, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_MEDIUM_CHANGER, + 0xce5939ae, 0xebde, 0x11d0, 0xb1, 0x81, 0x00, 0x00, 0xf8, 0x75, 0x3e, 0xc4} +DEFINE_GUID!{GUID_DEVCLASS_MODEM, + 0x4d36e96d, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_MEMORY, + 0x5099944a, 0xf6b9, 0x4057, 0xa0, 0x56, 0x8c, 0x55, 0x02, 0x28, 0x54, 0x4c} +DEFINE_GUID!{GUID_DEVCLASS_MONITOR, + 0x4d36e96e, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_MOUSE, + 0x4d36e96f, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_MTD, + 0x4d36e970, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_MULTIFUNCTION, + 0x4d36e971, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_MULTIPORTSERIAL, + 0x50906cb8, 0xba12, 0x11d1, 0xbf, 0x5d, 0x00, 0x00, 0xf8, 0x05, 0xf5, 0x30} +DEFINE_GUID!{GUID_DEVCLASS_NET, + 0x4d36e972, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_NETCLIENT, + 0x4d36e973, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_NETSERVICE, + 0x4d36e974, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_NETTRANS, + 0x4d36e975, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_NODRIVER, + 0x4d36e976, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_PCMCIA, + 0x4d36e977, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_PNPPRINTERS, + 0x4658ee7e, 0xf050, 0x11d1, 0xb6, 0xbd, 0x00, 0xc0, 0x4f, 0xa3, 0x72, 0xa7} +DEFINE_GUID!{GUID_DEVCLASS_PORTS, + 0x4d36e978, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_PRINTER, + 0x4d36e979, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_PRINTERUPGRADE, + 0x4d36e97a, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_PROCESSOR, + 0x50127dc3, 0x0f36, 0x415e, 0xa6, 0xcc, 0x4c, 0xb3, 0xbe, 0x91, 0x0B, 0x65} +DEFINE_GUID!{GUID_DEVCLASS_SBP2, + 0xd48179be, 0xec20, 0x11d1, 0xb6, 0xb8, 0x00, 0xc0, 0x4f, 0xa3, 0x72, 0xa7} +DEFINE_GUID!{GUID_DEVCLASS_SCSIADAPTER, + 0x4d36e97b, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_SECURITYACCELERATOR, + 0x268c95a1, 0xedfe, 0x11d3, 0x95, 0xc3, 0x00, 0x10, 0xdc, 0x40, 0x50, 0xa5} +DEFINE_GUID!{GUID_DEVCLASS_SENSOR, + 0x5175d334, 0xc371, 0x4806, 0xb3, 0xba, 0x71, 0xfd, 0x53, 0xc9, 0x25, 0x8d} +DEFINE_GUID!{GUID_DEVCLASS_SIDESHOW, + 0x997b5d8d, 0xc442, 0x4f2e, 0xba, 0xf3, 0x9c, 0x8e, 0x67, 0x1e, 0x9e, 0x21} +DEFINE_GUID!{GUID_DEVCLASS_SMARTCARDREADER, + 0x50dd5230, 0xba8a, 0x11d1, 0xbf, 0x5d, 0x00, 0x00, 0xf8, 0x05, 0xf5, 0x30} +DEFINE_GUID!{GUID_DEVCLASS_SOUND, + 0x4d36e97c, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_SYSTEM, + 0x4d36e97d, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_TAPEDRIVE, + 0x6d807884, 0x7d21, 0x11cf, 0x80, 0x1c, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_UNKNOWN, + 0x4d36e97e, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_DEVCLASS_USB, + 0x36fc9e60, 0xc465, 0x11cf, 0x80, 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_DEVCLASS_VOLUME, + 0x71a27cdd, 0x812a, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f} +DEFINE_GUID!{GUID_DEVCLASS_VOLUMESNAPSHOT, + 0x533c5b84, 0xec70, 0x11d2, 0x95, 0x05, 0x00, 0xc0, 0x4f, 0x79, 0xde, 0xaf} +DEFINE_GUID!{GUID_DEVCLASS_WCEUSBS, + 0x25dbce51, 0x6c8f, 0x4a72, 0x8a, 0x6d, 0xb5, 0x4c, 0x2b, 0x4f, 0xc8, 0x35} +DEFINE_GUID!{GUID_DEVCLASS_WPD, + 0xeec5ad98, 0x8080, 0x425f, 0x92, 0x2a, 0xda, 0xbf, 0x3d, 0xe3, 0xf6, 0x9a} +DEFINE_GUID!{GUID_DEVCLASS_EHSTORAGESILO, + 0x9da2b80f, 0xf89f, 0x4a49, 0xa5, 0xc2, 0x51, 0x1b, 0x08, 0x5b, 0x9e, 0x8a} +DEFINE_GUID!{GUID_DEVCLASS_FIRMWARE, + 0xf2e7dd72, 0x6468, 0x4e36, 0xb6, 0xf1, 0x64, 0x88, 0xf4, 0x2c, 0x1b, 0x52} +DEFINE_GUID!{GUID_DEVCLASS_EXTENSION, + 0xe2f84ce7, 0x8efa, 0x411c, 0xaa, 0x69, 0x97, 0x45, 0x4c, 0xa4, 0xcb, 0x57} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_TOP, + 0xb369baf4, 0x5568, 0x4e82, 0xa8, 0x7e, 0xa9, 0x3e, 0xb1, 0x6b, 0xca, 0x87} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_ACTIVITYMONITOR, + 0xb86dff51, 0xa31e, 0x4bac, 0xb3, 0xcf, 0xe8, 0xcf, 0xe7, 0x5c, 0x9f, 0xc2} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_UNDELETE, + 0xfe8f1572, 0xc67a, 0x48c0, 0xbb, 0xac, 0x0b, 0x5c, 0x6d, 0x66, 0xca, 0xfb} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_ANTIVIRUS, + 0xb1d1a169, 0xc54f, 0x4379, 0x81, 0xdb, 0xbe, 0xe7, 0xd8, 0x8d, 0x74, 0x54} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_REPLICATION, + 0x48d3ebc4, 0x4cf8, 0x48ff, 0xb8, 0x69, 0x9c, 0x68, 0xad, 0x42, 0xeb, 0x9f} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_CONTINUOUSBACKUP, + 0x71aa14f8, 0x6fad, 0x4622, 0xad, 0x77, 0x92, 0xbb, 0x9d, 0x7e, 0x69, 0x47} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_CONTENTSCREENER, + 0x3e3f0674, 0xc83c, 0x4558, 0xbb, 0x26, 0x98, 0x20, 0xe1, 0xeb, 0xa5, 0xc5} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_QUOTAMANAGEMENT, + 0x8503c911, 0xa6c7, 0x4919, 0x8f, 0x79, 0x50, 0x28, 0xf5, 0x86, 0x6b, 0x0c} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_SYSTEMRECOVERY, + 0x2db15374, 0x706e, 0x4131, 0xa0, 0xc7, 0xd7, 0xc7, 0x8e, 0xb0, 0x28, 0x9a} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_CFSMETADATASERVER, + 0xcdcf0939, 0xb75b, 0x4630, 0xbf, 0x76, 0x80, 0xf7, 0xba, 0x65, 0x58, 0x84} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_HSM, + 0xd546500a, 0x2aeb, 0x45f6, 0x94, 0x82, 0xf4, 0xb1, 0x79, 0x9c, 0x31, 0x77} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_COMPRESSION, + 0xf3586baf, 0xb5aa, 0x49b5, 0x8d, 0x6c, 0x05, 0x69, 0x28, 0x4c, 0x63, 0x9f} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_ENCRYPTION, + 0xa0a701c0, 0xa511, 0x42ff, 0xaa, 0x6c, 0x06, 0xdc, 0x03, 0x95, 0x57, 0x6f} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_VIRTUALIZATION, + 0xf75a86c0, 0x10d8, 0x4c3a, 0xb2, 0x33, 0xed, 0x60, 0xe4, 0xcd, 0xfa, 0xac} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_PHYSICALQUOTAMANAGEMENT, + 0x6a0a8e78, 0xbba6, 0x4fc4, 0xa7, 0x09, 0x1e, 0x33, 0xcd, 0x09, 0xd6, 0x7e} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_OPENFILEBACKUP, + 0xf8ecafa6, 0x66d1, 0x41a5, 0x89, 0x9b, 0x66, 0x58, 0x5d, 0x72, 0x16, 0xb7} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_SECURITYENHANCER, + 0xd02bc3da, 0x0c8e, 0x4945, 0x9b, 0xd5, 0xf1, 0x88, 0x3c, 0x22, 0x6c, 0x8c} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_COPYPROTECTION, + 0x89786ff1, 0x9c12, 0x402f, 0x9c, 0x9e, 0x17, 0x75, 0x3c, 0x7f, 0x43, 0x75} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_BOTTOM, + 0x37765ea0, 0x5958, 0x4fc9, 0xb0, 0x4b, 0x2f, 0xdf, 0xef, 0x97, 0xe5, 0x9e} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_SYSTEM, + 0x5d1b9aaa, 0x01e2, 0x46af, 0x84, 0x9f, 0x27, 0x2b, 0x3f, 0x32, 0x4c, 0x46} +DEFINE_GUID!{GUID_DEVCLASS_FSFILTER_INFRASTRUCTURE, + 0xe55fa6f9, 0x128c, 0x4d04, 0xab, 0xab, 0x63, 0x0c, 0x74, 0xb1, 0x45, 0x3a} diff --git a/src/vendor/winapi/src/shared/devpkey.rs b/src/vendor/winapi/src/shared/devpkey.rs new file mode 100644 index 0000000000..d17fb92f7c --- /dev/null +++ b/src/vendor/winapi/src/shared/devpkey.rs @@ -0,0 +1,402 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! Defines property keys for the Plug and Play Device Property API. +use shared::devpropdef::DEVPROPKEY; +DEFINE_DEVPROPKEY!{DEVPKEY_NAME, + 0xb725f130, 0x47ef, 0x101a, 0xa5, 0xf1, 0x02, 0x60, 0x8c, 0x9e, 0xeb, 0xac, 10} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DeviceDesc, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_HardwareIds, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_CompatibleIds, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Service, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Class, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 9} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ClassGuid, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 10} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Driver, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 11} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ConfigFlags, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 12} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Manufacturer, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 13} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_FriendlyName, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_LocationInfo, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 15} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_PDOName, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 16} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Capabilities, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 17} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_UINumber, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 18} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_UpperFilters, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 19} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_LowerFilters, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 20} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_BusTypeGuid, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 21} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_LegacyBusType, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 22} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_BusNumber, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 23} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_EnumeratorName, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 24} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Security, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 25} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_SecuritySDS, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 26} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DevType, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 27} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Exclusive, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 28} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Characteristics, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 29} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Address, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 30} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_UINumberDescFormat, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 31} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_PowerData, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 32} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_RemovalPolicy, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 33} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_RemovalPolicyDefault, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 34} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_RemovalPolicyOverride, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 35} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_InstallState, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 36} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_LocationPaths, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 37} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_BaseContainerId, + 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 38} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_InstanceId, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 256} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DevNodeStatus, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ProblemCode, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_EjectionRelations, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_RemovalRelations, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 5} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_PowerRelations, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_BusRelations, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 7} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Parent, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 8} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Children, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 9} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Siblings, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 10} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_TransportRelations, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 11} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ProblemStatus, + 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 12} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Reported, + 0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Legacy, + 0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ContainerId, + 0x8c7ed206, 0x3f8a, 0x4827, 0xb3, 0xab, 0xae, 0x9e, 0x1f, 0xae, 0xfc, 0x6c, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_InLocalMachineContainer, + 0x8c7ed206, 0x3f8a, 0x4827, 0xb3, 0xab, 0xae, 0x9e, 0x1f, 0xae, 0xfc, 0x6c, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Model, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 39} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ModelId, + 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_FriendlyNameAttributes, + 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ManufacturerAttributes, + 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_PresenceNotForDevice, + 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 5} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_SignalStrength, + 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_IsAssociateableByUserAction, + 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 7} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ShowInUninstallUI, + 0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 8} +pub const DEVPKEY_Numa_Proximity_Domain: DEVPROPKEY = DEVPKEY_Device_Numa_Proximity_Domain; +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Numa_Proximity_Domain, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 1} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DHP_Rebalance_Policy, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Numa_Node, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_BusReportedDeviceDesc, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_IsPresent, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 5} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_HasProblem, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ConfigurationId, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 7} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ReportedDeviceIdsHash, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 8} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_PhysicalDeviceLocation, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 9} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_BiosDeviceName, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 10} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverProblemDesc, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 11} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DebuggerSafe, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 12} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_PostInstallInProgress, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 13} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_Stack, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 14} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ExtendedConfigurationIds, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 15} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_IsRebootRequired, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 16} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_FirmwareDate, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 17} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_FirmwareVersion, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 18} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_FirmwareRevision, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 19} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DependencyProviders, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 20} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DependencyDependents, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 21} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_SoftRestartSupported, + 0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 22} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_SessionId, + 0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_InstallDate, + 0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 100} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_FirstInstallDate, + 0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 101} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_LastArrivalDate, + 0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 102} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_LastRemovalDate, + 0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 103} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverDate, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverVersion, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverDesc, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverInfPath, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 5} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverInfSection, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverInfSectionExt, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 7} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_MatchingDeviceId, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 8} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverProvider, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 9} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverPropPageProvider, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 10} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverCoInstallers, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 11} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ResourcePickerTags, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 12} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_ResourcePickerExceptions, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 13} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverRank, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 14} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_DriverLogoLevel, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 15} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_NoConnectSound, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 17} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_GenericDriverInstalled, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 18} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_AdditionalSoftwareRequested, + 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 19} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_SafeRemovalRequired, + 0xafd97640, 0x86a3, 0x4210, 0xb6, 0x7c, 0x28, 0x9c, 0x41, 0xaa, 0xbe, 0x55, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Device_SafeRemovalRequiredOverride, + 0xafd97640, 0x86a3, 0x4210, 0xb6, 0x7c, 0x28, 0x9c, 0x41, 0xaa, 0xbe, 0x55, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_DrvPkg_Model, + 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_DrvPkg_VendorWebSite, + 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_DrvPkg_DetailedDescription, + 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_DrvPkg_DocumentationLink, + 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 5} +DEFINE_DEVPROPKEY!{DEVPKEY_DrvPkg_Icon, + 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_DrvPkg_BrandingIcon, + 0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 7} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_UpperFilters, + 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 19} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_LowerFilters, + 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 20} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_Security, + 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 25} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_SecuritySDS, + 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 26} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_DevType, + 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 27} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_Exclusive, + 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 28} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_Characteristics, + 0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 29} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_Name, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_ClassName, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_Icon, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_ClassInstaller, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 5} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_PropPageProvider, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_NoInstallClass, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 7} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_NoDisplayClass, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 8} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_SilentInstall, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 9} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_NoUseClass, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 10} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_DefaultService, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 11} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_IconPath, + 0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 12} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_DHPRebalanceOptOut, + 0xd14d3ef3, 0x66cf, 0x4ba2, 0x9d, 0x38, 0x0d, 0xdb, 0x37, 0xab, 0x47, 0x01, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceClass_ClassCoInstallers, + 0x713d1703, 0xa2e2, 0x49f5, 0x92, 0x14, 0x56, 0x47, 0x2e, 0xf3, 0xda, 0x5c, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_FriendlyName, + 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_Enabled, + 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_ClassGuid, + 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 4} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_ReferenceString, + 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 5} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_Restricted, + 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 6} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterfaceClass_DefaultInterface, + 0x14c83a99, 0x0b3f, 0x44b7, 0xbe, 0x4c, 0xa1, 0x78, 0xd3, 0x99, 0x05, 0x64, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterfaceClass_Name, + 0x14c83a99, 0x0b3f, 0x44b7, 0xbe, 0x4c, 0xa1, 0x78, 0xd3, 0x99, 0x05, 0x64, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Address, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 51} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_DiscoveryMethod, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 52} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsEncrypted, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 53} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsAuthenticated, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 54} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsConnected, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 55} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsPaired, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 56} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Icon, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 57} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Version, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 65} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Last_Seen, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 66} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Last_Connected, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 67} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsShowInDisconnectedState, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 68} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsLocalMachine, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 70} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_MetadataPath, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 71} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsMetadataSearchInProgress, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 72} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_MetadataChecksum, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 73} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsNotInterestingForDisplay, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 74} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_LaunchDeviceStageOnDeviceConnect, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 76} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_LaunchDeviceStageFromExplorer, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 77} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_BaselineExperienceId, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 78} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsDeviceUniquelyIdentifiable, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 79} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_AssociationArray, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 80} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_DeviceDescription1, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 81} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_DeviceDescription2, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 82} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_HasProblem, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 83} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsSharedDevice, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 84} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsNetworkDevice, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 85} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsDefaultDevice, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 86} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_MetadataCabinet, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 87} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_RequiresPairingElevation, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 88} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_ExperienceId, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 89} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Category, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 90} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Category_Desc_Singular, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 91} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Category_Desc_Plural, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 92} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Category_Icon, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 93} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_CategoryGroup_Desc, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 94} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_CategoryGroup_Icon, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 95} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_PrimaryCategory, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 97} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_UnpairUninstall, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 98} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_RequiresUninstallElevation, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 99} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_DeviceFunctionSubRank, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 100} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_AlwaysShowDeviceAsConnected, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 101} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_ConfigFlags, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 105} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_PrivilegedPackageFamilyNames, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 106} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_CustomPrivilegedPackageFamilyNames, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 107} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_IsRebootRequired, + 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 108} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_FriendlyName, + 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 12288} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_Manufacturer, + 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 8192} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_ModelName, + 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 8194} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_ModelNumber, + 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 8195} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceContainer_InstallInProgress, + 0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 9} +pub const DEVPKEY_DeviceDisplay_DiscoveryMethod: DEVPROPKEY + = DEVPKEY_DeviceContainer_DiscoveryMethod; +pub const DEVPKEY_DeviceDisplay_IsShowInDisconnectedState: DEVPROPKEY + = DEVPKEY_DeviceContainer_IsShowInDisconnectedState; +pub const DEVPKEY_DeviceDisplay_IsNotInterestingForDisplay: DEVPROPKEY + = DEVPKEY_DeviceContainer_IsNotInterestingForDisplay; +pub const DEVPKEY_DeviceDisplay_IsNetworkDevice: DEVPROPKEY + = DEVPKEY_DeviceContainer_IsNetworkDevice; +pub const DEVPKEY_DeviceDisplay_Category: DEVPROPKEY = DEVPKEY_DeviceContainer_Category; +pub const DEVPKEY_DeviceDisplay_UnpairUninstall: DEVPROPKEY + = DEVPKEY_DeviceContainer_UnpairUninstall; +pub const DEVPKEY_DeviceDisplay_RequiresUninstallElevation: DEVPROPKEY + = DEVPKEY_DeviceContainer_RequiresUninstallElevation; +pub const DEVPKEY_DeviceDisplay_AlwaysShowDeviceAsConnected: DEVPROPKEY + = DEVPKEY_DeviceContainer_AlwaysShowDeviceAsConnected; +DEFINE_DEVPROPKEY!{DEVPKEY_DevQuery_ObjectType, + 0x13673f42, 0xa3d6, 0x49f6, 0xb4, 0xda, 0xae, 0x46, 0xe0, 0xc5, 0x23, 0x7c, 2} diff --git a/src/vendor/winapi/src/shared/devpropdef.rs b/src/vendor/winapi/src/shared/devpropdef.rs new file mode 100644 index 0000000000..78f92f71b1 --- /dev/null +++ b/src/vendor/winapi/src/shared/devpropdef.rs @@ -0,0 +1,84 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Defines property types and keys for the Plug and Play Device Property API +use shared::guiddef::{GUID, IsEqualGUID}; +use shared::minwindef::ULONG; +use um::winnt::{CHAR, PCWSTR, PVOID}; +pub type DEVPROPTYPE = ULONG; +pub type PDEVPROPTYPE = *mut ULONG; +pub const DEVPROP_TYPEMOD_ARRAY: DEVPROPTYPE = 0x00001000; +pub const DEVPROP_TYPEMOD_LIST: DEVPROPTYPE = 0x00002000; +pub const DEVPROP_TYPE_EMPTY: DEVPROPTYPE = 0x00000000; +pub const DEVPROP_TYPE_NULL: DEVPROPTYPE = 0x00000001; +pub const DEVPROP_TYPE_SBYTE: DEVPROPTYPE = 0x00000002; +pub const DEVPROP_TYPE_BYTE: DEVPROPTYPE = 0x00000003; +pub const DEVPROP_TYPE_INT16: DEVPROPTYPE = 0x00000004; +pub const DEVPROP_TYPE_UINT16: DEVPROPTYPE = 0x00000005; +pub const DEVPROP_TYPE_INT32: DEVPROPTYPE = 0x00000006; +pub const DEVPROP_TYPE_UINT32: DEVPROPTYPE = 0x00000007; +pub const DEVPROP_TYPE_INT64: DEVPROPTYPE = 0x00000008; +pub const DEVPROP_TYPE_UINT64: DEVPROPTYPE = 0x00000009; +pub const DEVPROP_TYPE_FLOAT: DEVPROPTYPE = 0x0000000A; +pub const DEVPROP_TYPE_DOUBLE: DEVPROPTYPE = 0x0000000B; +pub const DEVPROP_TYPE_DECIMAL: DEVPROPTYPE = 0x0000000C; +pub const DEVPROP_TYPE_GUID: DEVPROPTYPE = 0x0000000D; +pub const DEVPROP_TYPE_CURRENCY: DEVPROPTYPE = 0x0000000E; +pub const DEVPROP_TYPE_DATE: DEVPROPTYPE = 0x0000000F; +pub const DEVPROP_TYPE_FILETIME: DEVPROPTYPE = 0x00000010; +pub const DEVPROP_TYPE_BOOLEAN: DEVPROPTYPE = 0x00000011; +pub const DEVPROP_TYPE_STRING: DEVPROPTYPE = 0x00000012; +pub const DEVPROP_TYPE_STRING_LIST: DEVPROPTYPE = DEVPROP_TYPE_STRING | DEVPROP_TYPEMOD_LIST; +pub const DEVPROP_TYPE_SECURITY_DESCRIPTOR: DEVPROPTYPE = 0x00000013; +pub const DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING: DEVPROPTYPE = 0x00000014; +pub const DEVPROP_TYPE_DEVPROPKEY: DEVPROPTYPE = 0x00000015; +pub const DEVPROP_TYPE_DEVPROPTYPE: DEVPROPTYPE = 0x00000016; +pub const DEVPROP_TYPE_BINARY: DEVPROPTYPE = DEVPROP_TYPE_BYTE | DEVPROP_TYPEMOD_ARRAY; +pub const DEVPROP_TYPE_ERROR: DEVPROPTYPE = 0x00000017; +pub const DEVPROP_TYPE_NTSTATUS: DEVPROPTYPE = 0x00000018; +pub const DEVPROP_TYPE_STRING_INDIRECT: DEVPROPTYPE = 0x00000019; +pub const MAX_DEVPROP_TYPE: DEVPROPTYPE = 0x00000019; +pub const MAX_DEVPROP_TYPEMOD: DEVPROPTYPE = 0x00002000; +pub const DEVPROP_MASK_TYPE: DEVPROPTYPE = 0x00000FFF; +pub const DEVPROP_MASK_TYPEMOD: DEVPROPTYPE = 0x0000F000; +pub type DEVPROP_BOOLEAN = CHAR; +pub type PDEVPROP_BOOLEAN = *mut CHAR; +pub const DEVPROP_TRUE: DEVPROP_BOOLEAN = -1; +pub const DEVPROP_FALSE: DEVPROP_BOOLEAN = 0; +pub type DEVPROPGUID = GUID; +pub type PDEVPROPGUID = *mut GUID; +pub type DEVPROPID = ULONG; +pub type PDEVPROPID = *mut ULONG; +STRUCT!{struct DEVPROPKEY { + fmtid: DEVPROPGUID, + pid: DEVPROPID, +}} +pub type PDEVPROPKEY = *mut DEVPROPKEY; +#[inline] +pub fn IsEqualDevPropKey(a: &DEVPROPKEY, b: &DEVPROPKEY) -> bool { + (a.pid == b.pid) && IsEqualGUID(&a.fmtid, &b.fmtid) +} +ENUM!{enum DEVPROPSTORE { + DEVPROP_STORE_SYSTEM, + DEVPROP_STORE_USER, +}} +pub type PDEVPROPSTORE = *mut DEVPROPSTORE; +STRUCT!{struct DEVPROPCOMPKEY { + Key: DEVPROPKEY, + Store: DEVPROPSTORE, + LocaleName: PCWSTR, +}} +pub type PDEVPROPCOMPKEY = *mut DEVPROPCOMPKEY; +// IsEqualLocaleName +// IsEqualDevPropCompKey +STRUCT!{struct DEVPROPERTY { + CompKey: DEVPROPCOMPKEY, + Type: DEVPROPTYPE, + BufferSize: ULONG, + Buffer: PVOID, +}} +pub type PDEVPROPERTY = *mut DEVPROPERTY; +pub const DEVPROPID_FIRST_USABLE: DEVPROPID = 2; diff --git a/src/vendor/winapi/src/shared/dinputd.rs b/src/vendor/winapi/src/shared/dinputd.rs new file mode 100644 index 0000000000..f16b74dc39 --- /dev/null +++ b/src/vendor/winapi/src/shared/dinputd.rs @@ -0,0 +1,22 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_IDirectInputEffectDriver, + 0x02538130, 0x898f, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{IID_IDirectInputJoyConfig, + 0x1de12ab1, 0xc9f5, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInputPIDDriver, + 0xeec6993a, 0xb3fd, 0x11d2, 0xa9, 0x16, 0x00, 0xc0, 0x4f, 0xb9, 0x86, 0x38} +DEFINE_GUID!{IID_IDirectInputJoyConfig8, + 0xeb0d7dfa, 0x1990, 0x4f27, 0xb4, 0xd6, 0xed, 0xf2, 0xee, 0xc4, 0xa4, 0x4c} +DEFINE_GUID!{GUID_KeyboardClass, + 0x4d36e96b, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_MediaClass, + 0x4d36e96c, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_MouseClass, + 0x4d36e96f, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18} +DEFINE_GUID!{GUID_HIDClass, + 0x745a17a0, 0x74d3, 0x11d0, 0xb6, 0xfe, 0x00, 0xa0, 0xc9, 0x0f, 0x57, 0xda} diff --git a/src/vendor/winapi/src/shared/dxgi.rs b/src/vendor/winapi/src/shared/dxgi.rs new file mode 100644 index 0000000000..28cd924f4a --- /dev/null +++ b/src/vendor/winapi/src/shared/dxgi.rs @@ -0,0 +1,404 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dxgi.h +use ctypes::c_void; +use shared::basetsd::{SIZE_T, UINT64}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::dxgitype::{ + DXGI_GAMMA_CONTROL, DXGI_GAMMA_CONTROL_CAPABILITIES, DXGI_MODE_DESC, DXGI_MODE_ROTATION, + DXGI_SAMPLE_DESC, DXGI_USAGE, +}; +use shared::guiddef::{REFGUID, REFIID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, HMODULE, UINT}; +use shared::windef::{HDC, HMONITOR, HWND, RECT}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, INT, LARGE_INTEGER, LUID, WCHAR}; +STRUCT!{struct DXGI_FRAME_STATISTICS { + PresentCount: UINT, + PresentRefreshCount: UINT, + SyncRefreshCount: UINT, + SyncQPCTime: LARGE_INTEGER, + SyncGPUTime: LARGE_INTEGER, +}} +STRUCT!{struct DXGI_MAPPED_RECT { + Pitch: INT, + pBits: *mut BYTE, +}} +STRUCT!{struct DXGI_ADAPTER_DESC { + Description: [WCHAR; 128], + VendorId: UINT, + DeviceId: UINT, + SubSysId: UINT, + Revision: UINT, + DedicatedVideoMemory: SIZE_T, + DedicatedSystemMemory: SIZE_T, + SharedSystemMemory: SIZE_T, + AdapterLuid: LUID, +}} +STRUCT!{struct DXGI_OUTPUT_DESC { + DeviceName: [WCHAR; 32], + DesktopCoordinates: RECT, + AttachedToDesktop: BOOL, + Rotation: DXGI_MODE_ROTATION, + Monitor: HMONITOR, +}} +STRUCT!{struct DXGI_SHARED_RESOURCE { + Handle: HANDLE, +}} +pub const DXGI_RESOURCE_PRIORITY_MINIMUM: DWORD = 0x28000000; +pub const DXGI_RESOURCE_PRIORITY_LOW: DWORD = 0x50000000; +pub const DXGI_RESOURCE_PRIORITY_NORMAL: DWORD = 0x78000000; +pub const DXGI_RESOURCE_PRIORITY_HIGH: DWORD = 0xa0000000; +pub const DXGI_RESOURCE_PRIORITY_MAXIMUM: DWORD = 0xc8000000; +ENUM!{enum DXGI_RESIDENCY { + DXGI_RESIDENCY_FULLY_RESIDENT = 1, + DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, + DXGI_RESIDENCY_EVICTED_TO_DISK = 3, +}} +STRUCT!{struct DXGI_SURFACE_DESC { + Width: UINT, + Height: UINT, + Format: DXGI_FORMAT, + SampleDesc: DXGI_SAMPLE_DESC, +}} +ENUM!{enum DXGI_SWAP_EFFECT { + DXGI_SWAP_EFFECT_DISCARD = 0, + DXGI_SWAP_EFFECT_SEQUENTIAL = 1, + DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, + DXGI_SWAP_EFFECT_FLIP_DISCARD = 4, +}} +ENUM!{enum DXGI_SWAP_CHAIN_FLAG { + DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, + DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, + DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4, + DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8, + DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16, + DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32, + DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 64, + DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, + DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, + DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, +}} +STRUCT!{struct DXGI_SWAP_CHAIN_DESC { + BufferDesc: DXGI_MODE_DESC, + SampleDesc: DXGI_SAMPLE_DESC, + BufferUsage: DXGI_USAGE, + BufferCount: UINT, + OutputWindow: HWND, + Windowed: BOOL, + SwapEffect: DXGI_SWAP_EFFECT, + Flags: UINT, +}} +RIDL!(#[uuid(0xaec22fb8, 0x76f3, 0x4639, 0x9b, 0xe0, 0x28, 0xeb, 0x43, 0xa6, 0x7a, 0x2e)] +interface IDXGIObject(IDXGIObjectVtbl): IUnknown(IUnknownVtbl) { + fn SetPrivateData( + Name: REFGUID, + DataSize: UINT, + pData: *const c_void, + ) -> HRESULT, + fn SetPrivateDataInterface( + Name: REFGUID, + pUnknown: *const IUnknown, + ) -> HRESULT, + fn GetPrivateData( + Name: REFGUID, + pDataSize: *mut UINT, + pData: *mut c_void, + ) -> HRESULT, + fn GetParent( + riid: REFIID, + ppParent: *mut *mut c_void, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3d3e0379, 0xf9de, 0x4d58, 0xbb, 0x6c, 0x18, 0xd6, 0x29, 0x92, 0xf1, 0xa6)] +interface IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetDevice( + riid: REFIID, + ppDevice: *mut *mut c_void, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x035f3ab4, 0x482e, 0x4e50, 0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b)] +interface IDXGIResource(IDXGIResourceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn GetSharedHandle( + pSharedHandle: *mut HANDLE, + ) -> HRESULT, + fn GetUsage( + pUsage: *mut DXGI_USAGE, + ) -> HRESULT, + fn SetEvictionPriority( + EvictionPriority: UINT, + ) -> HRESULT, + fn GetEvictionPriority( + pEvictionPriority: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x9d8e1289, 0xd7b3, 0x465f, 0x81, 0x26, 0x25, 0x0e, 0x34, 0x9a, 0xf8, 0x5d)] +interface IDXGIKeyedMutex(IDXGIKeyedMutexVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn AcquireSync( + Key: UINT64, + dwMilliseconds: DWORD, + ) -> HRESULT, + fn ReleaseSync( + Key: UINT64, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xcafcb56c, 0x6ac3, 0x4889, 0xbf, 0x47, 0x9e, 0x23, 0xbb, 0xd2, 0x60, 0xec)] +interface IDXGISurface(IDXGISurfaceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn GetDesc( + pDesc: *mut DXGI_SURFACE_DESC, + ) -> HRESULT, + fn Map( + pLockedRect: *mut DXGI_MAPPED_RECT, + MapFlags: UINT, + ) -> HRESULT, + fn Unmap() -> HRESULT, +}); +RIDL!(#[uuid(0x4ae63092, 0x6327, 0x4c1b, 0x80, 0xae, 0xbf, 0xe1, 0x2e, 0xa3, 0x2b, 0x86)] +interface IDXGISurface1(IDXGISurface1Vtbl): IDXGISurface(IDXGISurfaceVtbl) { + fn GetDC( + Discard: BOOL, + phdc: *mut HDC, + ) -> HRESULT, + fn ReleaseDC( + pDirtyRect: *mut RECT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x2411e7e1, 0x12ac, 0x4ccf, 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0)] +interface IDXGIAdapter(IDXGIAdapterVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn EnumOutputs( + Output: UINT, + ppOutput: *mut *mut IDXGIOutput, + ) -> HRESULT, + fn GetDesc( + pDesc: *mut DXGI_ADAPTER_DESC, + ) -> HRESULT, + fn CheckInterfaceSupport( + InterfaceName: REFGUID, + pUMDVersion: *mut LARGE_INTEGER, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xae02eedb, 0xc735, 0x4690, 0x8d, 0x52, 0x5a, 0x8d, 0xc2, 0x02, 0x13, 0xaa)] +interface IDXGIOutput(IDXGIOutputVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetDesc( + pDesc: *mut DXGI_OUTPUT_DESC, + ) -> HRESULT, + fn GetDisplayModeList( + EnumFormat: DXGI_FORMAT, + Flags: UINT, + pNumModes: *mut UINT, + pDesc: *mut DXGI_MODE_DESC, + ) -> HRESULT, + fn FindClosestMatchingMode( + pModeToMatch: *const DXGI_MODE_DESC, + pClosestMatch: *mut DXGI_MODE_DESC, + pConcernedDevice: *mut IUnknown, + ) -> HRESULT, + fn WaitForVBlank() -> HRESULT, + fn TakeOwnership( + pDevice: *mut IUnknown, + Exclusive: BOOL, + ) -> HRESULT, + fn ReleaseOwnership() -> (), + fn GetGammaControlCapabilities( + pGammaCaps: *mut DXGI_GAMMA_CONTROL_CAPABILITIES, + ) -> HRESULT, + fn SetGammaControl( + pArray: *const DXGI_GAMMA_CONTROL, + ) -> HRESULT, + fn GetGammaControl( + pArray: *mut DXGI_GAMMA_CONTROL, + ) -> HRESULT, + fn SetDisplaySurface( + pScanoutSurface: *mut IDXGISurface, + ) -> HRESULT, + fn GetDisplaySurfaceData( + pDestination: *mut IDXGISurface, + ) -> HRESULT, + fn GetFrameStatistics( + pStats: *mut DXGI_FRAME_STATISTICS, + ) -> HRESULT, +}); +pub const DXGI_MAX_SWAP_CHAIN_BUFFERS: DWORD = 16; +pub const DXGI_PRESENT_TEST: DWORD = 0x00000001; +pub const DXGI_PRESENT_DO_NOT_SEQUENCE: DWORD = 0x00000002; +pub const DXGI_PRESENT_RESTART: DWORD = 0x00000004; +pub const DXGI_PRESENT_DO_NOT_WAIT: DWORD = 0x00000008; +pub const DXGI_PRESENT_STEREO_PREFER_RIGHT: DWORD = 0x00000010; +pub const DXGI_PRESENT_STEREO_TEMPORARY_MONO: DWORD = 0x00000020; +pub const DXGI_PRESENT_RESTRICT_TO_OUTPUT: DWORD = 0x00000040; +pub const DXGI_PRESENT_USE_DURATION: DWORD = 0x00000100; +RIDL!(#[uuid(0x310d36a0, 0xd2e7, 0x4c0a, 0xaa, 0x04, 0x6a, 0x9d, 0x23, 0xb8, 0x88, 0x6a)] +interface IDXGISwapChain(IDXGISwapChainVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { + fn Present( + SyncInterval: UINT, + Flags: UINT, + ) -> HRESULT, + fn GetBuffer( + Buffer: UINT, + riid: REFIID, + ppSurface: *mut *mut c_void, + ) -> HRESULT, + fn SetFullscreenState( + Fullscreen: BOOL, + pTarget: *mut IDXGIOutput, + ) -> HRESULT, + fn GetFullscreenState( + pFullscreen: *mut BOOL, + ppTarget: *mut *mut IDXGIOutput, + ) -> HRESULT, + fn GetDesc( + pDesc: *mut DXGI_SWAP_CHAIN_DESC, + ) -> HRESULT, + fn ResizeBuffers( + BufferCount: UINT, + Width: UINT, + Height: UINT, + NewFormat: DXGI_FORMAT, + SwapChainFlags: UINT, + ) -> HRESULT, + fn ResizeTarget( + pNewTargetParameters: *const DXGI_MODE_DESC, + ) -> HRESULT, + fn GetContainingOutput( + ppOutput: *mut *mut IDXGIOutput, + ) -> HRESULT, + fn GetFrameStatistics( + pStats: *mut DXGI_FRAME_STATISTICS, + ) -> HRESULT, + fn GetLastPresentCount( + pLastPresentCount: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69)] +interface IDXGIFactory(IDXGIFactoryVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn EnumAdapters( + Adapter: UINT, + ppAdapter: *mut *mut IDXGIAdapter, + ) -> HRESULT, + fn MakeWindowAssociation( + WindowHandle: HWND, + Flags: UINT, + ) -> HRESULT, + fn GetWindowAssociation( + pWindowHandle: *mut HWND, + ) -> HRESULT, + fn CreateSwapChain( + pDevice: *mut IUnknown, + pDesc: *mut DXGI_SWAP_CHAIN_DESC, + ppSwapChain: *mut *mut IDXGISwapChain, + ) -> HRESULT, + fn CreateSoftwareAdapter( + Module: HMODULE, + ppAdapter: *mut *mut IDXGIAdapter, + ) -> HRESULT, +}); +extern "system" { + pub fn CreateDXGIFactory( + riid: REFIID, + ppFactory: *mut *mut c_void, + ) -> HRESULT; + pub fn CreateDXGIFactory1( + riid: REFIID, + ppFactory: *mut *mut c_void, + ) -> HRESULT; +} +RIDL!(#[uuid(0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c)] +interface IDXGIDevice(IDXGIDeviceVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetAdapter( + pAdapter: *mut *mut IDXGIAdapter, + ) -> HRESULT, + fn CreateSurface( + pDesc: *const DXGI_SURFACE_DESC, + NumSurfaces: UINT, + Usage: DXGI_USAGE, + pSharedResource: *const DXGI_SHARED_RESOURCE, + ppSurface: *mut *mut IDXGISurface, + ) -> HRESULT, + fn QueryResourceResidency( + ppResources: *const *mut IUnknown, + pResidencyStatus: *mut DXGI_RESIDENCY, + NumResources: UINT, + ) -> HRESULT, + fn SetGPUThreadPriority( + Priority: INT, + ) -> HRESULT, + fn GetGPUThreadPriority( + pPriority: *mut INT, + ) -> HRESULT, +}); +ENUM!{enum DXGI_ADAPTER_FLAG { + DXGI_ADAPTER_FLAG_NONE, + DXGI_ADAPTER_FLAG_REMOTE, + DXGI_ADAPTER_FLAG_SOFTWARE, +}} +STRUCT!{struct DXGI_ADAPTER_DESC1 { + Description: [WCHAR; 128], + VendorId: UINT, + DeviceId: UINT, + SubSysId: UINT, + Revision: UINT, + DedicatedVideoMemory: SIZE_T, + DedicatedSystemMemory: SIZE_T, + SharedSystemMemory: SIZE_T, + AdapterLuid: LUID, + Flags: UINT, +}} +STRUCT!{struct DXGI_DISPLAY_COLOR_SPACE { + PrimaryCoordinates: [[FLOAT; 2]; 8], + WhitePoints: [[FLOAT; 2]; 16], +}} +RIDL!(#[uuid(0x770aae78, 0xf26f, 0x4dba, 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87)] +interface IDXGIFactory1(IDXGIFactory1Vtbl): IDXGIFactory(IDXGIFactoryVtbl) { + fn EnumAdapters1( + Adapter: UINT, + ppAdapter: *mut *mut IDXGIAdapter1, + ) -> HRESULT, + fn IsCurrent() -> BOOL, +}); +RIDL!(#[uuid(0x29038f61, 0x3839, 0x4626, 0x91, 0xfd, 0x08, 0x68, 0x79, 0x01, 0x1a, 0x05)] +interface IDXGIAdapter1(IDXGIAdapter1Vtbl): IDXGIAdapter(IDXGIAdapterVtbl) { + fn GetDesc1( + pDesc: *mut DXGI_ADAPTER_DESC1, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x77db970f, 0x6276, 0x48ba, 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c)] +interface IDXGIDevice1(IDXGIDevice1Vtbl): IDXGIDevice(IDXGIDeviceVtbl) { + fn SetMaximumFrameLatency( + MaxLatency: UINT, + ) -> HRESULT, + fn GetMaximumFrameLatency( + pMaxLatency: *mut UINT, + ) -> HRESULT, +}); +DEFINE_GUID!{IID_IDXGIObject, + 0xaec22fb8, 0x76f3, 0x4639, 0x9b, 0xe0, 0x28, 0xeb, 0x43, 0xa6, 0x7a, 0x2e} +DEFINE_GUID!{IID_IDXGIDeviceSubObject, + 0x3d3e0379, 0xf9de, 0x4d58, 0xbb, 0x6c, 0x18, 0xd6, 0x29, 0x92, 0xf1, 0xa6} +DEFINE_GUID!{IID_IDXGIResource, + 0x035f3ab4, 0x482e, 0x4e50, 0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b} +DEFINE_GUID!{IID_IDXGIKeyedMutex, + 0x9d8e1289, 0xd7b3, 0x465f, 0x81, 0x26, 0x25, 0x0e, 0x34, 0x9a, 0xf8, 0x5d} +DEFINE_GUID!{IID_IDXGISurface, + 0xcafcb56c, 0x6ac3, 0x4889, 0xbf, 0x47, 0x9e, 0x23, 0xbb, 0xd2, 0x60, 0xec} +DEFINE_GUID!{IID_IDXGISurface1, + 0x4ae63092, 0x6327, 0x4c1b, 0x80, 0xae, 0xbf, 0xe1, 0x2e, 0xa3, 0x2b, 0x86} +DEFINE_GUID!{IID_IDXGIAdapter, + 0x2411e7e1, 0x12ac, 0x4ccf, 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0} +DEFINE_GUID!{IID_IDXGIOutput, + 0xae02eedb, 0xc735, 0x4690, 0x8d, 0x52, 0x5a, 0x8d, 0xc2, 0x02, 0x13, 0xaa} +DEFINE_GUID!{IID_IDXGISwapChain, + 0x310d36a0, 0xd2e7, 0x4c0a, 0xaa, 0x04, 0x6a, 0x9d, 0x23, 0xb8, 0x88, 0x6a} +DEFINE_GUID!{IID_IDXGIFactory, + 0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69} +DEFINE_GUID!{IID_IDXGIDevice, + 0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c} +DEFINE_GUID!{IID_IDXGIFactory1, + 0x770aae78, 0xf26f, 0x4dba, 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87} +DEFINE_GUID!{IID_IDXGIAdapter1, + 0x29038f61, 0x3839, 0x4626, 0x91, 0xfd, 0x08, 0x68, 0x79, 0x01, 0x1a, 0x05} +DEFINE_GUID!{IID_IDXGIDevice1, + 0x77db970f, 0x6276, 0x48ba, 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c} diff --git a/src/vendor/winapi/src/shared/dxgi1_2.rs b/src/vendor/winapi/src/shared/dxgi1_2.rs new file mode 100644 index 0000000000..62973b18f3 --- /dev/null +++ b/src/vendor/winapi/src/shared/dxgi1_2.rs @@ -0,0 +1,356 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dxgi1_2.h +use ctypes::c_void; +use shared::basetsd::SIZE_T; +use shared::dxgi::{ + DXGI_MAPPED_RECT, DXGI_SWAP_EFFECT, IDXGIAdapter1, IDXGIAdapter1Vtbl, IDXGIDevice1, + IDXGIDevice1Vtbl, IDXGIFactory1, IDXGIFactory1Vtbl, IDXGIObject, IDXGIObjectVtbl, IDXGIOutput, + IDXGIOutputVtbl, IDXGIResource, IDXGIResourceVtbl, IDXGISurface1, IDXGISurface1Vtbl, + IDXGISwapChain, IDXGISwapChainVtbl, +}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::dxgitype::{ + DXGI_MODE_DESC, DXGI_MODE_ROTATION, DXGI_MODE_SCALING, DXGI_MODE_SCANLINE_ORDER, DXGI_RATIONAL, + DXGI_RGBA, DXGI_SAMPLE_DESC, DXGI_USAGE, +}; +use shared::guiddef::REFGUID; +use shared::minwindef::{BOOL, DWORD, UINT}; +use shared::windef::{HWND, POINT, RECT}; +use um::minwinbase::SECURITY_ATTRIBUTES; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, LARGE_INTEGER, LPCWSTR, LUID, WCHAR}; +ENUM!{enum DXGI_ALPHA_MODE { + DXGI_ALPHA_MODE_UNSPECIFIED = 0, + DXGI_ALPHA_MODE_PREMULTIPLIED = 1, + DXGI_ALPHA_MODE_STRAIGHT = 2, + DXGI_ALPHA_MODE_IGNORE = 3, + DXGI_ALPHA_MODE_FORCE_DWORD = 0xFFFFFFFF, +}} +ENUM!{enum DXGI_COMPUTE_PREEMPTION_GRANULARITY { + DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, + DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY = 1, + DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY = 2, + DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY = 3, + DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY = 4, +}} +ENUM!{enum DXGI_GRAPHICS_PREEMPTION_GRANULARITY { + DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, + DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY = 1, + DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY = 2, + DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY = 3, + DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY = 4, +}} +ENUM!{enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE { + DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME = 1, + DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR = 2, + DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR = 4, +}} +ENUM!{enum DXGI_SCALING { + DXGI_SCALING_STRETCH = 0, + DXGI_SCALING_NONE = 1, + DXGI_SCALING_ASPECT_RATIO_STRETCH = 2, +}} +ENUM!{enum _DXGI_OFFER_RESOURCE_PRIORITY { + DXGI_OFFER_RESOURCE_PRIORITY_LOW = 1, + DXGI_OFFER_RESOURCE_PRIORITY_NORMAL = 2, + DXGI_OFFER_RESOURCE_PRIORITY_HIGH = 3, +}} +STRUCT!{struct DXGI_ADAPTER_DESC2 { + Description: [WCHAR; 128], + VendorId: UINT, + DeviceId: UINT, + SubSysId: UINT, + Revision: UINT, + DedicatedVideoMemory: SIZE_T, + DedicatedSystemMemory: SIZE_T, + SharedSystemMemory: SIZE_T, + AdapterLuid: LUID, + Flags: UINT, + GraphicsPreemptionGranularity: DXGI_GRAPHICS_PREEMPTION_GRANULARITY, + ComputePreemptionGranularity: DXGI_COMPUTE_PREEMPTION_GRANULARITY, +}} +STRUCT!{struct DXGI_MODE_DESC1 { + Width: UINT, + Height: UINT, + RefreshRate: DXGI_RATIONAL, + Format: DXGI_FORMAT, + ScanlineOrdering: DXGI_MODE_SCANLINE_ORDER, + Scaling: DXGI_MODE_SCALING, + Stereo: BOOL, +}} +STRUCT!{struct DXGI_OUTDUPL_DESC { + ModeDesc: DXGI_MODE_DESC, + Rotation: DXGI_MODE_ROTATION, + DesktopImageInSystemMemory: BOOL, +}} +STRUCT!{struct DXGI_OUTDUPL_FRAME_INFO { + LastPresentTime: LARGE_INTEGER, + LastMouseUpdateTime: LARGE_INTEGER, + AccumulatedFrames: UINT, + RectsCoalesced: BOOL, + ProtectedContentMaskedOut: BOOL, + PointerPosition: DXGI_OUTDUPL_POINTER_POSITION, + TotalMetadataBufferSize: UINT, + PointerShapeBufferSize: UINT, +}} +STRUCT!{struct DXGI_OUTDUPL_MOVE_RECT { + SourcePoint: POINT, + DestinationRect: RECT, +}} +STRUCT!{struct DXGI_OUTDUPL_POINTER_POSITION { + Position: POINT, + Visible: BOOL, +}} +STRUCT!{struct DXGI_OUTDUPL_POINTER_SHAPE_INFO { + Type: UINT, + Width: UINT, + Height: UINT, + Pitch: UINT, + HotSpot: POINT, +}} +STRUCT!{struct DXGI_PRESENT_PARAMETERS { + DirtyRectsCount: UINT, + pDirtyRects: *mut RECT, + pScrollRect: *mut RECT, + pScrollOffset: *mut POINT, +}} +STRUCT!{struct DXGI_SWAP_CHAIN_DESC1 { + Width: UINT, + Height: UINT, + Format: DXGI_FORMAT, + Stereo: BOOL, + SampleDesc: DXGI_SAMPLE_DESC, + BufferUsage: DXGI_USAGE, + BufferCount: UINT, + Scaling: DXGI_SCALING, + SwapEffect: DXGI_SWAP_EFFECT, + AlphaMode: DXGI_ALPHA_MODE, + Flags: UINT, +}} +STRUCT!{struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC { + RefreshRate: DXGI_RATIONAL, + ScanlineOrdering: DXGI_MODE_SCANLINE_ORDER, + Scaling: DXGI_MODE_SCALING, + Windowed: BOOL, +}} +RIDL!(#[uuid(0x0aa1ae0a, 0xfa0e, 0x4b84, 0x86, 0x44, 0xe0, 0x5f, 0xf8, 0xe5, 0xac, 0xb5)] +interface IDXGIAdapter2(IDXGIAdapter2Vtbl): IDXGIAdapter1(IDXGIAdapter1Vtbl) { + fn GetDesc2( + pDesc: *mut DXGI_ADAPTER_DESC2, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x05008617, 0xfbfd, 0x4051, 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9)] +interface IDXGIDevice2(IDXGIDevice2Vtbl): IDXGIDevice1(IDXGIDevice1Vtbl) { + fn OfferResources( + NumResources: UINT, + ppResources: *mut *mut IDXGIResource, + Priority: DXGI_OFFER_RESOURCE_PRIORITY, + ) -> HRESULT, + fn ReclaimResources( + NumResources: UINT, + ppResources: *mut *mut IDXGIResource, + pDiscarded: *mut BOOL, + ) -> HRESULT, + fn EnqueueSetEvent( + hEvent: HANDLE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xea9dbf1a, 0xc88e, 0x4486, 0x85, 0x4a, 0x98, 0xaa, 0x01, 0x38, 0xf3, 0x0c)] +interface IDXGIDisplayControl(IDXGIDisplayControlVtbl): IUnknown(IUnknownVtbl) { + fn IsStereoEnabled() -> BOOL, + fn SetStereoEnabled( + enabled: BOOL, + ) -> (), +}); +RIDL!(#[uuid(0x50c83a1c, 0xe072, 0x4c48, 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0)] +interface IDXGIFactory2(IDXGIFactory2Vtbl): IDXGIFactory1(IDXGIFactory1Vtbl) { + fn IsWindowedStereoEnabled() -> BOOL, + fn CreateSwapChainForHwnd( + pDevice: *mut IUnknown, + hWnd: HWND, + pDesc: *const DXGI_SWAP_CHAIN_DESC1, + pFullscreenDesc: *const DXGI_SWAP_CHAIN_FULLSCREEN_DESC, + pRestrictToOutput: *mut IDXGIOutput, + ppSwapChain: *mut *mut IDXGISwapChain1, + ) -> HRESULT, + fn CreateSwapChainForCoreWindow( + pDevice: *mut IUnknown, + pWindow: *mut IUnknown, + pDesc: *const DXGI_SWAP_CHAIN_DESC1, + pRestrictToOutput: *mut IDXGIOutput, + ppSwapChain: *mut *mut IDXGISwapChain1, + ) -> HRESULT, + fn GetSharedResourceAdapterLuid( + hResource: HANDLE, + pLuid: *mut LUID, + ) -> HRESULT, + fn RegisterStereoStatusWindow( + WindowHandle: HWND, + wMsg: UINT, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn RegisterStereoStatusEvent( + hEvent: HANDLE, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn UnregisterStereoStatus( + dwCookie: DWORD, + ) -> (), + fn RegisterOcclusionStatusWindow( + WindowHandle: HWND, + wMsg: UINT, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn RegisterOcclusionStatusEvent( + hEvent: HANDLE, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn UnregisterOcclusionStatus( + dwCookie: DWORD, + ) -> (), + fn CreateSwapChainForComposition( + pDevice: *mut IUnknown, + pDesc: *const DXGI_SWAP_CHAIN_DESC1, + pRestrictToOutput: *mut IDXGIOutput, + ppSwapChain: *mut *mut IDXGISwapChain1, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00cddea8, 0x939b, 0x4b83, 0xa3, 0x40, 0xa6, 0x85, 0x22, 0x66, 0x66, 0xcc)] +interface IDXGIOutput1(IDXGIOutput1Vtbl): IDXGIOutput(IDXGIOutputVtbl) { + fn GetDisplayModeList1( + EnumFormat: DXGI_FORMAT, + Flags: UINT, + pNumModes: *mut UINT, + pDesc: *mut DXGI_MODE_DESC1, + ) -> HRESULT, + fn FindClosestMatchingMode1( + pModeToMatch: *const DXGI_MODE_DESC1, + pClosestMatch: *mut DXGI_MODE_DESC1, + pConcernedDevice: *mut IUnknown, + ) -> HRESULT, + fn GetDisplaySurfaceData1( + pDestination: *mut IDXGIResource, + ) -> HRESULT, + fn DuplicateOutput( + pDevice: *mut IUnknown, + ppOutputDuplication: *mut *mut IDXGIOutputDuplication, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x191cfac3, 0xa341, 0x470d, 0xb2, 0x6e, 0xa8, 0x64, 0xf4, 0x28, 0x31, 0x9c)] +interface IDXGIOutputDuplication(IDXGIOutputDuplicationVtbl): IDXGIObject(IDXGIObjectVtbl) { + fn GetDesc( + pDesc: *mut DXGI_OUTDUPL_DESC, + ) -> (), + fn AcquireNextFrame( + TimeoutInMilliseconds: UINT, + pFrameInfo: *mut DXGI_OUTDUPL_FRAME_INFO, + ppDesktopResource: *mut *mut IDXGIResource, + ) -> HRESULT, + fn GetFrameDirtyRects( + DirtyRectsBufferSize: UINT, + pDirtyRectsBuffer: *mut RECT, + pDirtyRectsBufferSizeRequired: *mut UINT, + ) -> HRESULT, + fn GetFrameMoveRects( + MoveRectsBufferSize: UINT, + pMoveRectBuffer: *mut DXGI_OUTDUPL_MOVE_RECT, + pMoveRectsBufferSizeRequired: *mut UINT, + ) -> HRESULT, + fn GetFramePointerShape( + PointerShapeBufferSize: UINT, + pPointerShapeBuffer: *mut c_void, + pPointerShapeBufferSizeRequired: *mut UINT, + pPointerShapeInfo: *mut DXGI_OUTDUPL_POINTER_SHAPE_INFO, + ) -> HRESULT, + fn MapDesktopSurface( + pLockedRect: *mut DXGI_MAPPED_RECT, + ) -> HRESULT, + fn UnMapDesktopSurface() -> HRESULT, + fn ReleaseFrame() -> HRESULT, +}); +RIDL!(#[uuid(0x30961379, 0x4609, 0x4a41, 0x99, 0x8e, 0x54, 0xfe, 0x56, 0x7e, 0xe0, 0xc1)] +interface IDXGIResource1(IDXGIResource1Vtbl): IDXGIResource(IDXGIResourceVtbl) { + fn CreateSubresourceSurface( + index: UINT, + ppSurface: *mut *mut IDXGISurface2, + ) -> HRESULT, + fn CreateSharedHandle( + pAttributes: *const SECURITY_ATTRIBUTES, + dwAccess: DWORD, + lpName: LPCWSTR, + pHandle: *mut HANDLE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xaba496dd, 0xb617, 0x4cb8, 0xa8, 0x66, 0xbc, 0x44, 0xd7, 0xeb, 0x1f, 0xa2)] +interface IDXGISurface2(IDXGISurface2Vtbl): IDXGISurface1(IDXGISurface1Vtbl) { + fn GetResource( + riid: REFGUID, + ppParentResource: *mut *mut c_void, + pSubresourceIndex: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x790a45f7, 0x0d42, 0x4876, 0x98, 0x3a, 0x0a, 0x55, 0xcf, 0xe6, 0xf4, 0xaa)] +interface IDXGISwapChain1(IDXGISwapChain1Vtbl): IDXGISwapChain(IDXGISwapChainVtbl) { + fn GetDesc1( + pDesc: *mut DXGI_SWAP_CHAIN_DESC1, + ) -> HRESULT, + fn GetFullscreenDesc( + pDesc: *mut DXGI_SWAP_CHAIN_FULLSCREEN_DESC, + ) -> HRESULT, + fn GetHwnd( + pHwnd: *mut HWND, + ) -> HRESULT, + fn GetCoreWindow( + refiid: REFGUID, + ppUnk: *mut *mut c_void, + ) -> HRESULT, + fn Present1( + SyncInterval: UINT, + PresentFlags: UINT, + pPresentParameters: *const DXGI_PRESENT_PARAMETERS, + ) -> HRESULT, + fn IsTemporaryMonoSupported() -> BOOL, + fn GetRestrictToOutput( + ppRestrictToOutput: *mut *mut IDXGIOutput, + ) -> HRESULT, + fn SetBackgroundColor( + pColor: *const DXGI_RGBA, + ) -> HRESULT, + fn GetBackgroundColor( + pColor: *mut DXGI_RGBA, + ) -> HRESULT, + fn SetRotation( + Rotation: DXGI_MODE_ROTATION, + ) -> HRESULT, + fn GetRotation( + pRotation: *mut DXGI_MODE_ROTATION, + ) -> HRESULT, +}); +pub type DXGI_OFFER_RESOURCE_PRIORITY = _DXGI_OFFER_RESOURCE_PRIORITY; +pub const DXGI_ENUM_MODES_DISABLED_STEREO: UINT = 8; +pub const DXGI_ENUM_MODES_STEREO: UINT = 4; +pub const DXGI_SHARED_RESOURCE_READ: UINT = 0x80000000; +pub const DXGI_SHARED_RESOURCE_WRITE: UINT = 1; +DEFINE_GUID!{IID_IDXGIDisplayControl, + 0xea9dbf1a, 0xc88e, 0x4486, 0x85, 0x4a, 0x98, 0xaa, 0x01, 0x38, 0xf3, 0x0c} +DEFINE_GUID!{IID_IDXGIOutputDuplication, + 0x191cfac3, 0xa341, 0x470d, 0xb2, 0x6e, 0xa8, 0x64, 0xf4, 0x28, 0x31, 0x9c} +DEFINE_GUID!{IID_IDXGISurface2, + 0xaba496dd, 0xb617, 0x4cb8, 0xa8, 0x66, 0xbc, 0x44, 0xd7, 0xeb, 0x1f, 0xa2} +DEFINE_GUID!{IID_IDXGIResource1, + 0x30961379, 0x4609, 0x4a41, 0x99, 0x8e, 0x54, 0xfe, 0x56, 0x7e, 0xe0, 0xc1} +DEFINE_GUID!{IID_IDXGIDevice2, + 0x05008617, 0xfbfd, 0x4051, 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9} +DEFINE_GUID!{IID_IDXGISwapChain1, + 0x790a45f7, 0x0d42, 0x4876, 0x98, 0x3a, 0x0a, 0x55, 0xcf, 0xe6, 0xf4, 0xaa} +DEFINE_GUID!{IID_IDXGIFactory2, + 0x50c83a1c, 0xe072, 0x4c48, 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0} +DEFINE_GUID!{IID_IDXGIAdapter2, + 0x0aa1ae0a, 0xfa0e, 0x4b84, 0x86, 0x44, 0xe0, 0x5f, 0xf8, 0xe5, 0xac, 0xb5} +DEFINE_GUID!{IID_IDXGIOutput1, + 0x00cddea8, 0x939b, 0x4b83, 0xa3, 0x40, 0xa6, 0x85, 0x22, 0x66, 0x66, 0xcc} diff --git a/src/vendor/winapi/src/shared/dxgi1_3.rs b/src/vendor/winapi/src/shared/dxgi1_3.rs new file mode 100644 index 0000000000..2ffd4305e3 --- /dev/null +++ b/src/vendor/winapi/src/shared/dxgi1_3.rs @@ -0,0 +1,191 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dxgi1_3.h +use ctypes::c_void; +use shared::dxgi::{IDXGIOutput, IDXGIResource}; +use shared::dxgi1_2::{ + DXGI_SWAP_CHAIN_DESC1, IDXGIDevice2, IDXGIDevice2Vtbl, IDXGIFactory2, IDXGIFactory2Vtbl, + IDXGIOutput1, IDXGIOutput1Vtbl, IDXGISwapChain1, IDXGISwapChain1Vtbl, +}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, FLOAT, UINT}; +use shared::windef::RECT; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, LARGE_INTEGER}; +ENUM!{enum DXGI_FRAME_PRESENTATION_MODE { + DXGI_FRAME_PRESENTATION_MODE_COMPOSED = 0, + DXGI_FRAME_PRESENTATION_MODE_OVERLAY = 1, + DXGI_FRAME_PRESENTATION_MODE_NONE = 2, + DXGI_FRAME_PRESENTATION_MODE_COMPOSITION_FAILURE = 3, +}} +ENUM!{enum DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS { + DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1, + DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2, + DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4, +}} +ENUM!{enum DXGI_OVERLAY_SUPPORT_FLAG { + DXGI_OVERLAY_SUPPORT_FLAG_DIRECT = 0x1, + DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2, +}} +STRUCT!{struct DXGI_DECODE_SWAP_CHAIN_DESC { + Flags: UINT, +}} +STRUCT!{struct DXGI_FRAME_STATISTICS_MEDIA { + PresentCount: UINT, + PresentRefreshCount: UINT, + SyncRefreshCount: UINT, + SyncQPCTime: LARGE_INTEGER, + SyncGPUTime: LARGE_INTEGER, + CompositionMode: DXGI_FRAME_PRESENTATION_MODE, + ApprovedPresentDuration: UINT, +}} +STRUCT!{struct DXGI_MATRIX_3X2_F { + _11: FLOAT, + _12: FLOAT, + _21: FLOAT, + _22: FLOAT, + _31: FLOAT, + _32: FLOAT, +}} +RIDL!(#[uuid(0x2633066b, 0x4514, 0x4c7a, 0x8f, 0xd8, 0x12, 0xea, 0x98, 0x05, 0x9d, 0x18)] +interface IDXGIDecodeSwapChain(IDXGIDecodeSwapChainVtbl): IUnknown(IUnknownVtbl) { + fn PresentBuffer( + BufferToPresent: UINT, + SyncInterval: UINT, + Flags: UINT, + ) -> HRESULT, + fn SetSourceRect( + pRect: *const RECT, + ) -> HRESULT, + fn SetTargetRect( + pRect: *const RECT, + ) -> HRESULT, + fn SetDestSize( + Width: UINT, + Height: UINT, + ) -> HRESULT, + fn GetSourceRect( + pRect: *mut RECT, + ) -> HRESULT, + fn GetTargetRect( + pRect: *mut RECT, + ) -> HRESULT, + fn GetDestSize( + pWidth: *mut UINT, + pHeight: *mut UINT, + ) -> HRESULT, + fn SetColorSpace( + ColorSpace: DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS, + ) -> HRESULT, + fn GetColorSpace() -> DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS, +}); +extern "system" { + pub fn CreateDXGIFactory2( + Flags: UINT, + riid: REFIID, + ppFactory: *mut *mut c_void, + ) -> HRESULT; + pub fn DXGIGetDebugInterface1( + Flags: UINT, + riid: REFIID, + pDebug: *mut *mut c_void, + ) -> HRESULT; +} +RIDL!(#[uuid(0x6007896c, 0x3244, 0x4afd, 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23)] +interface IDXGIDevice3(IDXGIDevice3Vtbl): IDXGIDevice2(IDXGIDevice2Vtbl) { + fn Trim() -> (), +}); +RIDL!(#[uuid(0x25483823, 0xcd46, 0x4c7d, 0x86, 0xca, 0x47, 0xaa, 0x95, 0xb8, 0x37, 0xbd)] +interface IDXGIFactory3(IDXGIFactory3Vtbl): IDXGIFactory2(IDXGIFactory2Vtbl) { + fn GetCreationFlags() -> UINT, +}); +RIDL!(#[uuid(0x41e7d1f2, 0xa591, 0x4f7b, 0xa2, 0xe5, 0xfa, 0x9c, 0x84, 0x3e, 0x1c, 0x12)] +interface IDXGIFactoryMedia(IDXGIFactoryMediaVtbl): IUnknown(IUnknownVtbl) { + fn CreateSwapChainForCompositionSurfaceHandle( + pDevice: *mut IUnknown, + hSurface: HANDLE, + pDesc: *const DXGI_SWAP_CHAIN_DESC1, + pRestrictToOutput: *mut IDXGIOutput, + ppSwapChain: *mut *mut IDXGISwapChain1, + ) -> HRESULT, + fn CreateDecodeSwapChainForCompositionSurfaceHandle( + pDevice: *mut IUnknown, + hSurface: HANDLE, + pDesc: *mut DXGI_DECODE_SWAP_CHAIN_DESC, + pYuvDecodeBuffers: *mut IDXGIResource, + pRestrictToOutput: *mut IDXGIOutput, + ppSwapChain: *mut *mut IDXGIDecodeSwapChain, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x595e39d1, 0x2724, 0x4663, 0x99, 0xb1, 0xda, 0x96, 0x9d, 0xe2, 0x83, 0x64)] +interface IDXGIOutput2(IDXGIOutput2Vtbl): IDXGIOutput1(IDXGIOutput1Vtbl) { + fn SupportsOverlays() -> BOOL, +}); +RIDL!(#[uuid(0x8a6bb301, 0x7e7e, 0x41f4, 0xa8, 0xe0, 0x5b, 0x32, 0xf7, 0xf9, 0x9b, 0x18)] +interface IDXGIOutput3(IDXGIOutput3Vtbl): IDXGIOutput2(IDXGIOutput2Vtbl) { + fn CheckOverlaySupport( + EnumFormat: DXGI_FORMAT, + pConcernedDevice: *mut IUnknown, + pFlags: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa8be2ac4, 0x199f, 0x4946, 0xb3, 0x31, 0x79, 0x59, 0x9f, 0xb9, 0x8d, 0xe7)] +interface IDXGISwapChain2(IDXGISwapChain2Vtbl): IDXGISwapChain1(IDXGISwapChain1Vtbl) { + fn SetSourceSize( + Width: UINT, + Height: UINT, + ) -> HRESULT, + fn GetSourceSize( + pWidth: *mut UINT, + pHeight: *mut UINT, + ) -> HRESULT, + fn SetMaximumFrameLatency( + MaxLatency: UINT, + ) -> HRESULT, + fn GetMaximumFrameLatency( + pMaxLatency: *mut UINT, + ) -> HRESULT, + fn GetFrameLatencyWaitableObject() -> HANDLE, + fn SetMatrixTransform( + pMatrix: *const DXGI_MATRIX_3X2_F, + ) -> HRESULT, + fn GetMatrixTransform( + pMatrix: *mut DXGI_MATRIX_3X2_F, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xdd95b90b, 0xf05f, 0x4f6a, 0xbd, 0x65, 0x25, 0xbf, 0xb2, 0x64, 0xbd, 0x84)] +interface IDXGISwapChainMedia(IDXGISwapChainMediaVtbl): IUnknown(IUnknownVtbl) { + fn GetFrameStatisticsMedia( + pStats: *mut DXGI_FRAME_STATISTICS_MEDIA, + ) -> HRESULT, + fn SetPresentDuration( + Duration: UINT, + ) -> HRESULT, + fn CheckPresentDurationSupport( + DesiredPresentDuration: UINT, + pClosestSmallerPresentDuration: *mut UINT, + pClosestLargerPresentDuration: *mut UINT, + ) -> HRESULT, +}); +pub const DXGI_CREATE_FACTORY_DEBUG: UINT = 0x1; +DEFINE_GUID!{IID_IDXGIDevice3, + 0x6007896c, 0x3244, 0x4afd, 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23} +DEFINE_GUID!{IID_IDXGISwapChain2, + 0xa8be2ac4, 0x199f, 0x4946, 0xb3, 0x31, 0x79, 0x59, 0x9f, 0xb9, 0x8d, 0xe7} +DEFINE_GUID!{IID_IDXGIOutput2, + 0x595e39d1, 0x2724, 0x4663, 0x99, 0xb1, 0xda, 0x96, 0x9d, 0xe2, 0x83, 0x64} +DEFINE_GUID!{IID_IDXGIFactory3, + 0x25483823, 0xcd46, 0x4c7d, 0x86, 0xca, 0x47, 0xaa, 0x95, 0xb8, 0x37, 0xbd} +DEFINE_GUID!{IID_IDXGIDecodeSwapChain, + 0x2633066b, 0x4514, 0x4c7a, 0x8f, 0xd8, 0x12, 0xea, 0x98, 0x05, 0x9d, 0x18} +DEFINE_GUID!{IID_IDXGIFactoryMedia, + 0x41e7d1f2, 0xa591, 0x4f7b, 0xa2, 0xe5, 0xfa, 0x9c, 0x84, 0x3e, 0x1c, 0x12} +DEFINE_GUID!{IID_IDXGISwapChainMedia, + 0xdd95b90b, 0xf05f, 0x4f6a, 0xbd, 0x65, 0x25, 0xbf, 0xb2, 0x64, 0xbd, 0x84} +DEFINE_GUID!{IID_IDXGIOutput3, + 0x8a6bb301, 0x7e7e, 0x41f4, 0xa8, 0xe0, 0x5b, 0x32, 0xf7, 0xf9, 0x9b, 0x18} diff --git a/src/vendor/winapi/src/shared/dxgi1_4.rs b/src/vendor/winapi/src/shared/dxgi1_4.rs new file mode 100644 index 0000000000..1b136e989e --- /dev/null +++ b/src/vendor/winapi/src/shared/dxgi1_4.rs @@ -0,0 +1,113 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dxgi1_4.h +use ctypes::c_void; +use shared::basetsd::UINT64; +use shared::dxgi1_2::{IDXGIAdapter2, IDXGIAdapter2Vtbl}; +use shared::dxgi1_3::{ + IDXGIFactory3, IDXGIFactory3Vtbl, IDXGIOutput3, IDXGIOutput3Vtbl, IDXGISwapChain2, + IDXGISwapChain2Vtbl, +}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::dxgitype::DXGI_COLOR_SPACE_TYPE; +use shared::guiddef::REFGUID; +use shared::minwindef::{DWORD, UINT}; +use um::unknwnbase::IUnknown; +use um::winnt::{HANDLE, HRESULT, LUID}; +ENUM!{enum DXGI_MEMORY_SEGMENT_GROUP { + DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0, + DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1, +}} +ENUM!{enum DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG { + DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, +}} +ENUM!{enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG { + DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, + DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x2, +}} +STRUCT!{struct DXGI_QUERY_VIDEO_MEMORY_INFO { + Budget: UINT64, + CurrentUsage: UINT64, + AvailableForReservation: UINT64, + CurrentReservation: UINT64, +}} +RIDL!(#[uuid(0x645967a4, 0x1392, 0x4310, 0xa7, 0x98, 0x80, 0x53, 0xce, 0x3e, 0x93, 0xfd)] +interface IDXGIAdapter3(IDXGIAdapter3Vtbl): IDXGIAdapter2(IDXGIAdapter2Vtbl) { + fn RegisterHardwareContentProtectionTeardownStatusEvent( + hEvent: HANDLE, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn UnregisterHardwareContentProtectionTeardownStatus( + dwCookie: DWORD, + ) -> (), + fn QueryVideoMemoryInfo( + NodeIndex: UINT, + MemorySegmentGroup: DXGI_MEMORY_SEGMENT_GROUP, + pVideoMemoryInfo: *mut DXGI_QUERY_VIDEO_MEMORY_INFO, + ) -> HRESULT, + fn SetVideoMemoryReservation( + NodeIndex: UINT, + MemorySegmentGroup: DXGI_MEMORY_SEGMENT_GROUP, + Reservation: UINT64, + ) -> HRESULT, + fn RegisterVideoMemoryBudgetChangeNotificationEvent( + hEvent: HANDLE, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn UnregisterVideoMemoryBudgetChangeNotification( + dwCookie: DWORD, + ) -> (), +}); +RIDL!(#[uuid(0x1bc6ea02, 0xef36, 0x464f, 0xbf, 0x0c, 0x21, 0xca, 0x39, 0xe5, 0x16, 0x8a)] +interface IDXGIFactory4(IDXGIFactory4Vtbl): IDXGIFactory3(IDXGIFactory3Vtbl) { + fn EnumAdapterByLuid( + AdapterLuid: LUID, + riid: REFGUID, + ppvAdapter: *mut *mut c_void, + ) -> HRESULT, + fn EnumWarpAdapter( + riid: REFGUID, + ppvAdapter: *mut *mut c_void, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xdc7dca35, 0x2196, 0x414d, 0x9f, 0x53, 0x61, 0x78, 0x84, 0x03, 0x2a, 0x60)] +interface IDXGIOutput4(IDXGIOutput4Vtbl): IDXGIOutput3(IDXGIOutput3Vtbl) { + fn CheckOverlayColorSpaceSupport( + Format: DXGI_FORMAT, + ColorSpace: DXGI_COLOR_SPACE_TYPE, + pConcernedDevice: *mut IUnknown, + pFlags: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x94d99bdb, 0xf1f8, 0x4ab0, 0xb2, 0x36, 0x7d, 0xa0, 0x17, 0x0e, 0xda, 0xb1)] +interface IDXGISwapChain3(IDXGISwapChain3Vtbl): IDXGISwapChain2(IDXGISwapChain2Vtbl) { + fn GetCurrentBackBufferIndex() -> UINT, + fn CheckColorSpaceSupport( + ColorSpace: DXGI_COLOR_SPACE_TYPE, + pColorSpaceSupport: *mut UINT, + ) -> HRESULT, + fn SetColorSpace1( + ColorSpace: DXGI_COLOR_SPACE_TYPE, + ) -> HRESULT, + fn ResizeBuffers1( + BufferCount: UINT, + Width: UINT, + Height: UINT, + Format: DXGI_FORMAT, + SwapChainFlags: UINT, + pCreationNodeMask: *const UINT, + ppPresentQueue: *mut *mut IUnknown, + ) -> HRESULT, +}); +DEFINE_GUID!{IID_IDXGISwapChain3, + 0x94d99bdb, 0xf1f8, 0x4ab0, 0xb2, 0x36, 0x7d, 0xa0, 0x17, 0x0e, 0xda, 0xb1} +DEFINE_GUID!{IID_IDXGIOutput4, + 0xdc7dca35, 0x2196, 0x414d, 0x9f, 0x53, 0x61, 0x78, 0x84, 0x03, 0x2a, 0x60} +DEFINE_GUID!{IID_IDXGIFactory4, + 0x1bc6ea02, 0xef36, 0x464f, 0xbf, 0x0c, 0x21, 0xca, 0x39, 0xe5, 0x16, 0x8a} +DEFINE_GUID!{IID_IDXGIAdapter3, + 0x645967a4, 0x1392, 0x4310, 0xa7, 0x98, 0x80, 0x53, 0xce, 0x3e, 0x93, 0xfd} diff --git a/src/vendor/winapi/src/shared/dxgi1_5.rs b/src/vendor/winapi/src/shared/dxgi1_5.rs new file mode 100644 index 0000000000..a3e6ddd959 --- /dev/null +++ b/src/vendor/winapi/src/shared/dxgi1_5.rs @@ -0,0 +1,93 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dxgi1_5.h +use ctypes::c_void; +use shared::basetsd::UINT16; +use shared::dxgi::IDXGIResource; +use shared::dxgi1_2::{DXGI_OFFER_RESOURCE_PRIORITY, IDXGIOutputDuplication}; +use shared::dxgi1_3::{IDXGIDevice3, IDXGIDevice3Vtbl}; +use shared::dxgi1_4::{ + IDXGIFactory4, IDXGIFactory4Vtbl, IDXGIOutput4, IDXGIOutput4Vtbl, IDXGISwapChain3, + IDXGISwapChain3Vtbl, +}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::minwindef::UINT; +use um::unknwnbase::IUnknown; +use um::winnt::HRESULT; +RIDL!(#[uuid(0x80a07424, 0xab52, 0x42eb, 0x83, 0x3c, 0x0c, 0x42, 0xfd, 0x28, 0x2d, 0x98)] +interface IDXGIOutput5(IDXGIOutput5Vtbl): IDXGIOutput4(IDXGIOutput4Vtbl) { + fn DuplicateOutput1( + pDevice: *mut IUnknown, + Flags: UINT, + SupportedFormatsCount: UINT, + pSupportedFormats: *const DXGI_FORMAT, + ppOutputDuplication: *mut *mut IDXGIOutputDuplication, + )-> HRESULT, +}); +ENUM!{enum DXGI_HDR_METADATA_TYPE { + DXGI_HDR_METADATA_TYPE_NONE = 0, + DXGI_HDR_METADATA_TYPE_HDR10 = 1, +}} +STRUCT!{struct DXGI_HDR_METADATA_HDR10 { + RedPrimary: [UINT16; 2], + GreenPrimary: [UINT16; 2], + BluePrimary: [UINT16; 2], + WhitePoint: [UINT16; 2], + MaxMasteringLuminance: UINT, + MinMasteringLuminance: UINT, + MaxContentLightLevel: UINT16, + MaxFrameAverageLightLevel: UINT16, +}} +RIDL!(#[uuid(0x3d585d5a, 0xbd4a, 0x489e, 0xb1, 0xf4, 0x3d, 0xbc, 0xb6, 0x45, 0x2f, 0xfb)] +interface IDXGISwapChain4(IDXGISwapChain4Vtbl): IDXGISwapChain3(IDXGISwapChain3Vtbl) { + fn SetHDRMetaData( + Type: DXGI_HDR_METADATA_TYPE, + Size: UINT, + pMetaData: *mut c_void, + )-> HRESULT, +}); +ENUM!{enum DXGI_OFFER_RESOURCE_FLAGS { + DXGI_OFFER_RESOURCE_FLAG_ALLOW_DECOMMIT = 0x1, +}} +ENUM!{enum DXGI_RECLAIM_RESOURCE_RESULTS { + DXGI_RECLAIM_RESOURCE_RESULT_OK = 0, + DXGI_RECLAIM_RESOURCE_RESULT_DISCARDED = 1, + DXGI_RECLAIM_RESOURCE_RESULT_NOT_COMMITTED = 2, +}} +RIDL!(#[uuid(0x95b4f95f, 0xd8da, 0x4ca4, 0x9e, 0xe6, 0x3b, 0x76, 0xd5, 0x96, 0x8a, 0x10)] +interface IDXGIDevice4(IDXGIDevice4Vtbl): IDXGIDevice3(IDXGIDevice3Vtbl) { + fn OfferResources1( + NumResources: UINT, + ppResources: *mut *mut IDXGIResource, + Priority: DXGI_OFFER_RESOURCE_PRIORITY, + Flags: UINT, + ) -> HRESULT, + fn ReclaimResources1( + NumResources: UINT, + ppResources: *mut *mut IDXGIResource, + pResults: *mut DXGI_RECLAIM_RESOURCE_RESULTS, + ) -> HRESULT, +}); +ENUM!{enum DXGI_FEATURE { + DXGI_FEATURE_PRESENT_ALLOW_TEARING = 0, +}} +RIDL!(#[uuid(0x7632e1f5, 0xee65, 0x4dca, 0x87, 0xfd, 0x84, 0xcd, 0x75, 0xf8, 0x83, 0x8d)] +interface IDXGIFactory5(IDXGIFactory5Vtbl): IDXGIFactory4(IDXGIFactory4Vtbl) { + fn CheckFeatureSupport( + Feature: DXGI_FEATURE, + pFeatureSupportData: *mut c_void, + FeatureSupportDataSize: UINT, + ) -> HRESULT, +}); +DEFINE_GUID!{IID_IDXGIOutput5, + 0x80A07424, 0xAB52, 0x42EB, 0x83, 0x3C, 0x0C, 0x42, 0xFD, 0x28, 0x2D, 0x98} +DEFINE_GUID!{IID_IDXGISwapChain4, + 0x3D585D5A, 0xBD4A, 0x489E, 0xB1, 0xF4, 0x3D, 0xBC, 0xB6, 0x45, 0x2F, 0xFB} +DEFINE_GUID!{IID_IDXGIDevice4, + 0x95B4F95F, 0xD8DA, 0x4CA4, 0x9E, 0xE6, 0x3B, 0x76, 0xD5, 0x96, 0x8A, 0x10} +DEFINE_GUID!{IID_IDXGIFactory5, + 0x7632e1f5, 0xee65, 0x4dca, 0x87, 0xfd, 0x84, 0xcd, 0x75, 0xf8, 0x83, 0x8d} diff --git a/src/vendor/winapi/src/shared/dxgiformat.rs b/src/vendor/winapi/src/shared/dxgiformat.rs new file mode 100644 index 0000000000..cc60409bf4 --- /dev/null +++ b/src/vendor/winapi/src/shared/dxgiformat.rs @@ -0,0 +1,128 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dxgiformat.h +ENUM!{enum DXGI_FORMAT { + DXGI_FORMAT_UNKNOWN = 0, + DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, + DXGI_FORMAT_R32G32B32A32_FLOAT = 2, + DXGI_FORMAT_R32G32B32A32_UINT = 3, + DXGI_FORMAT_R32G32B32A32_SINT = 4, + DXGI_FORMAT_R32G32B32_TYPELESS = 5, + DXGI_FORMAT_R32G32B32_FLOAT = 6, + DXGI_FORMAT_R32G32B32_UINT = 7, + DXGI_FORMAT_R32G32B32_SINT = 8, + DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, + DXGI_FORMAT_R16G16B16A16_FLOAT = 10, + DXGI_FORMAT_R16G16B16A16_UNORM = 11, + DXGI_FORMAT_R16G16B16A16_UINT = 12, + DXGI_FORMAT_R16G16B16A16_SNORM = 13, + DXGI_FORMAT_R16G16B16A16_SINT = 14, + DXGI_FORMAT_R32G32_TYPELESS = 15, + DXGI_FORMAT_R32G32_FLOAT = 16, + DXGI_FORMAT_R32G32_UINT = 17, + DXGI_FORMAT_R32G32_SINT = 18, + DXGI_FORMAT_R32G8X24_TYPELESS = 19, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, + DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, + DXGI_FORMAT_R10G10B10A2_UNORM = 24, + DXGI_FORMAT_R10G10B10A2_UINT = 25, + DXGI_FORMAT_R11G11B10_FLOAT = 26, + DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, + DXGI_FORMAT_R8G8B8A8_UNORM = 28, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, + DXGI_FORMAT_R8G8B8A8_UINT = 30, + DXGI_FORMAT_R8G8B8A8_SNORM = 31, + DXGI_FORMAT_R8G8B8A8_SINT = 32, + DXGI_FORMAT_R16G16_TYPELESS = 33, + DXGI_FORMAT_R16G16_FLOAT = 34, + DXGI_FORMAT_R16G16_UNORM = 35, + DXGI_FORMAT_R16G16_UINT = 36, + DXGI_FORMAT_R16G16_SNORM = 37, + DXGI_FORMAT_R16G16_SINT = 38, + DXGI_FORMAT_R32_TYPELESS = 39, + DXGI_FORMAT_D32_FLOAT = 40, + DXGI_FORMAT_R32_FLOAT = 41, + DXGI_FORMAT_R32_UINT = 42, + DXGI_FORMAT_R32_SINT = 43, + DXGI_FORMAT_R24G8_TYPELESS = 44, + DXGI_FORMAT_D24_UNORM_S8_UINT = 45, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, + DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, + DXGI_FORMAT_R8G8_TYPELESS = 48, + DXGI_FORMAT_R8G8_UNORM = 49, + DXGI_FORMAT_R8G8_UINT = 50, + DXGI_FORMAT_R8G8_SNORM = 51, + DXGI_FORMAT_R8G8_SINT = 52, + DXGI_FORMAT_R16_TYPELESS = 53, + DXGI_FORMAT_R16_FLOAT = 54, + DXGI_FORMAT_D16_UNORM = 55, + DXGI_FORMAT_R16_UNORM = 56, + DXGI_FORMAT_R16_UINT = 57, + DXGI_FORMAT_R16_SNORM = 58, + DXGI_FORMAT_R16_SINT = 59, + DXGI_FORMAT_R8_TYPELESS = 60, + DXGI_FORMAT_R8_UNORM = 61, + DXGI_FORMAT_R8_UINT = 62, + DXGI_FORMAT_R8_SNORM = 63, + DXGI_FORMAT_R8_SINT = 64, + DXGI_FORMAT_A8_UNORM = 65, + DXGI_FORMAT_R1_UNORM = 66, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, + DXGI_FORMAT_R8G8_B8G8_UNORM = 68, + DXGI_FORMAT_G8R8_G8B8_UNORM = 69, + DXGI_FORMAT_BC1_TYPELESS = 70, + DXGI_FORMAT_BC1_UNORM = 71, + DXGI_FORMAT_BC1_UNORM_SRGB = 72, + DXGI_FORMAT_BC2_TYPELESS = 73, + DXGI_FORMAT_BC2_UNORM = 74, + DXGI_FORMAT_BC2_UNORM_SRGB = 75, + DXGI_FORMAT_BC3_TYPELESS = 76, + DXGI_FORMAT_BC3_UNORM = 77, + DXGI_FORMAT_BC3_UNORM_SRGB = 78, + DXGI_FORMAT_BC4_TYPELESS = 79, + DXGI_FORMAT_BC4_UNORM = 80, + DXGI_FORMAT_BC4_SNORM = 81, + DXGI_FORMAT_BC5_TYPELESS = 82, + DXGI_FORMAT_BC5_UNORM = 83, + DXGI_FORMAT_BC5_SNORM = 84, + DXGI_FORMAT_B5G6R5_UNORM = 85, + DXGI_FORMAT_B5G5R5A1_UNORM = 86, + DXGI_FORMAT_B8G8R8A8_UNORM = 87, + DXGI_FORMAT_B8G8R8X8_UNORM = 88, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, + DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, + DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, + DXGI_FORMAT_BC6H_TYPELESS = 94, + DXGI_FORMAT_BC6H_UF16 = 95, + DXGI_FORMAT_BC6H_SF16 = 96, + DXGI_FORMAT_BC7_TYPELESS = 97, + DXGI_FORMAT_BC7_UNORM = 98, + DXGI_FORMAT_BC7_UNORM_SRGB = 99, + DXGI_FORMAT_AYUV = 100, + DXGI_FORMAT_Y410 = 101, + DXGI_FORMAT_Y416 = 102, + DXGI_FORMAT_NV12 = 103, + DXGI_FORMAT_P010 = 104, + DXGI_FORMAT_P016 = 105, + DXGI_FORMAT_420_OPAQUE = 106, + DXGI_FORMAT_YUY2 = 107, + DXGI_FORMAT_Y210 = 108, + DXGI_FORMAT_Y216 = 109, + DXGI_FORMAT_NV11 = 110, + DXGI_FORMAT_AI44 = 111, + DXGI_FORMAT_IA44 = 112, + DXGI_FORMAT_P8 = 113, + DXGI_FORMAT_A8P8 = 114, + DXGI_FORMAT_B4G4R4A4_UNORM = 115, + DXGI_FORMAT_P208 = 130, + DXGI_FORMAT_V208 = 131, + DXGI_FORMAT_V408 = 132, +}} diff --git a/src/vendor/winapi/src/shared/dxgitype.rs b/src/vendor/winapi/src/shared/dxgitype.rs new file mode 100644 index 0000000000..21076a5c2d --- /dev/null +++ b/src/vendor/winapi/src/shared/dxgitype.rs @@ -0,0 +1,110 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dxgitype.h +use shared::d3d9types::D3DCOLORVALUE; +use shared::dxgiformat::DXGI_FORMAT; +use shared::minwindef::{BOOL, BYTE, DWORD, UINT}; +pub const DXGI_CPU_ACCESS_NONE: DWORD = 0; +pub const DXGI_CPU_ACCESS_DYNAMIC: DWORD = 1; +pub const DXGI_CPU_ACCESS_READ_WRITE: DWORD = 2; +pub const DXGI_CPU_ACCESS_SCRATCH: DWORD = 3; +pub const DXGI_CPU_ACCESS_FIELD: DWORD = 15; +ENUM!{enum DXGI_USAGE { + DXGI_USAGE_SHADER_INPUT = 1 << (0 + 4), + DXGI_USAGE_RENDER_TARGET_OUTPUT = 1 << (1 + 4), + DXGI_USAGE_BACK_BUFFER = 1 << (2 + 4), + DXGI_USAGE_SHARED = 1 << (3 + 4), + DXGI_USAGE_READ_ONLY = 1 << (4 + 4), + DXGI_USAGE_DISCARD_ON_PRESENT = 1 << (5 + 4), + DXGI_USAGE_UNORDERED_ACCESS = 1 << (6 + 4), +}} +STRUCT!{struct DXGI_RGB { + Red: f32, + Green: f32, + Blue: f32, +}} +pub type DXGI_RGBA = D3DCOLORVALUE; +STRUCT!{struct DXGI_GAMMA_CONTROL { + Scale: DXGI_RGB, + Offset: DXGI_RGB, + GammaCurve: [DXGI_RGB; 1025], +}} +STRUCT!{struct DXGI_GAMMA_CONTROL_CAPABILITIES { + ScaleAndOffsetSupported: BOOL, + MaxConvertedValue: f32, + MinConvertedValue: f32, + NumGammaControlPoints: UINT, + ControlPointPositions: [f32; 1025], +}} +STRUCT!{struct DXGI_RATIONAL { + Numerator: UINT, + Denominator: UINT, +}} +ENUM!{enum DXGI_MODE_SCANLINE_ORDER { + DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED, + DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE, + DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST, + DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST, +}} +ENUM!{enum DXGI_MODE_SCALING { + DXGI_MODE_SCALING_UNSPECIFIED, + DXGI_MODE_SCALING_CENTERED, + DXGI_MODE_SCALING_STRETCHED, +}} +ENUM!{enum DXGI_MODE_ROTATION { + DXGI_MODE_ROTATION_UNSPECIFIED, + DXGI_MODE_ROTATION_IDENTITY, + DXGI_MODE_ROTATION_ROTATE90, + DXGI_MODE_ROTATION_ROTATE180, + DXGI_MODE_ROTATION_ROTATE270, +}} +STRUCT!{struct DXGI_MODE_DESC { + Width: UINT, + Height: UINT, + RefreshRate: DXGI_RATIONAL, + Format: DXGI_FORMAT, + ScanlineOrdering: DXGI_MODE_SCANLINE_ORDER, + Scaling: DXGI_MODE_SCALING, +}} +STRUCT!{struct DXGI_SAMPLE_DESC { + Count: UINT, + Quality: UINT, +}} +STRUCT!{struct DXGI_JPEG_DC_HUFFMAN_TABLE { + CodeCounts: [BYTE; 12], + CodeValues: [BYTE; 12], +}} +STRUCT!{struct DXGI_JPEG_AC_HUFFMAN_TABLE { + CodeCounts: [BYTE; 16], + CodeValues: [BYTE; 162], +}} +STRUCT!{struct DXGI_JPEG_QUANTIZATION_TABLE { + Elements: [BYTE; 64], +}} +ENUM!{enum DXGI_COLOR_SPACE_TYPE { + DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0, + DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1, + DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2, + DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3, + DXGI_COLOR_SPACE_RESERVED = 4, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11, + DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13, + DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16, + DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17, + DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF, +}} +pub const DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN: UINT = 0xfffffffe; +pub const DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN: UINT = 0xffffffff; diff --git a/src/vendor/winapi/src/shared/guiddef.rs b/src/vendor/winapi/src/shared/guiddef.rs new file mode 100644 index 0000000000..15f6b461f9 --- /dev/null +++ b/src/vendor/winapi/src/shared/guiddef.rs @@ -0,0 +1,37 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! GUID definition +use ctypes::{c_uchar, c_ulong, c_ushort}; +STRUCT!{struct GUID { + Data1: c_ulong, + Data2: c_ushort, + Data3: c_ushort, + Data4: [c_uchar; 8], +}} +pub type LPGUID = *mut GUID; +pub type LPCGUID = *const GUID; +pub type IID = GUID; +pub type LPIID = *mut IID; +pub use self::IsEqualGUID as IsEqualIID; +pub type CLSID = GUID; +pub type LPCLSID = *mut CLSID; +pub use self::IsEqualGUID as IsEqualCLSID; +pub type FMTID = GUID; +pub type LPFMTID = *mut FMTID; +pub use self::IsEqualGUID as IsEqualFMTID; +pub type REFGUID = *const GUID; +pub type REFIID = *const IID; +pub type REFCLSID = *const IID; +pub type REFFMTID = *const IID; +DEFINE_GUID!{IID_NULL, + 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} +#[inline] +pub fn IsEqualGUID(g1: &GUID, g2: &GUID) -> bool { + let a = unsafe { &*(g1 as *const _ as *const [u32; 4]) }; + let b = unsafe { &*(g2 as *const _ as *const [u32; 4]) }; + a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3] +} diff --git a/src/vendor/winapi/src/shared/hidclass.rs b/src/vendor/winapi/src/shared/hidclass.rs new file mode 100644 index 0000000000..4723a79db8 --- /dev/null +++ b/src/vendor/winapi/src/shared/hidclass.rs @@ -0,0 +1,69 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, PUCHAR, UCHAR, ULONG, USHORT}; +use um::winioctl::{ + FILE_ANY_ACCESS, FILE_DEVICE_KEYBOARD, METHOD_BUFFERED, METHOD_IN_DIRECT, METHOD_NEITHER, + METHOD_OUT_DIRECT, +}; +use um::winnt::BOOLEAN; +DEFINE_GUID!{GUID_DEVINTERFACE_HID, + 0x4D1E55B2, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} +pub const GUID_CLASS_INPUT: GUID = GUID_DEVINTERFACE_HID; +DEFINE_GUID!{GUID_HID_INTERFACE_NOTIFY, + 0x2c4e2e88, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81} +DEFINE_GUID!{GUID_HID_INTERFACE_HIDPARSE, + 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b} +// FIXME devpropkey stuff +pub const HID_REVISION: DWORD = 0x00000001; +pub const IOCTL_HID_GET_DRIVER_CONFIG: DWORD = HID_BUFFER_CTL_CODE!(100); +pub const IOCTL_HID_SET_DRIVER_CONFIG: DWORD = HID_BUFFER_CTL_CODE!(101); +pub const IOCTL_HID_GET_POLL_FREQUENCY_MSEC: DWORD = HID_BUFFER_CTL_CODE!(102); +pub const IOCTL_HID_SET_POLL_FREQUENCY_MSEC: DWORD = HID_BUFFER_CTL_CODE!(103); +pub const IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS: DWORD = HID_BUFFER_CTL_CODE!(104); +pub const IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS: DWORD = HID_BUFFER_CTL_CODE!(105); +pub const IOCTL_HID_GET_COLLECTION_INFORMATION: DWORD = HID_BUFFER_CTL_CODE!(106); +pub const IOCTL_HID_ENABLE_WAKE_ON_SX: DWORD = HID_BUFFER_CTL_CODE!(107); +pub const IOCTL_HID_SET_S0_IDLE_TIMEOUT: DWORD = HID_BUFFER_CTL_CODE!(108); +pub const IOCTL_HID_GET_COLLECTION_DESCRIPTOR: DWORD = HID_CTL_CODE!(100); +pub const IOCTL_HID_FLUSH_QUEUE: DWORD = HID_CTL_CODE!(101); +pub const IOCTL_HID_SET_FEATURE: DWORD = HID_IN_CTL_CODE!(100); +pub const IOCTL_HID_SET_OUTPUT_REPORT: DWORD = HID_IN_CTL_CODE!(101); +pub const IOCTL_HID_GET_FEATURE: DWORD = HID_OUT_CTL_CODE!(100); +pub const IOCTL_GET_PHYSICAL_DESCRIPTOR: DWORD = HID_OUT_CTL_CODE!(102); +pub const IOCTL_HID_GET_HARDWARE_ID: DWORD = HID_OUT_CTL_CODE!(103); +pub const IOCTL_HID_GET_INPUT_REPORT: DWORD = HID_OUT_CTL_CODE!(104); +pub const IOCTL_HID_GET_OUTPUT_REPORT: DWORD = HID_OUT_CTL_CODE!(105); +pub const IOCTL_HID_GET_MANUFACTURER_STRING: DWORD = HID_OUT_CTL_CODE!(110); +pub const IOCTL_HID_GET_PRODUCT_STRING: DWORD = HID_OUT_CTL_CODE!(111); +pub const IOCTL_HID_GET_SERIALNUMBER_STRING: DWORD = HID_OUT_CTL_CODE!(112); +pub const IOCTL_HID_GET_INDEXED_STRING: DWORD = HID_OUT_CTL_CODE!(120); +pub const IOCTL_HID_GET_MS_GENRE_DESCRIPTOR: DWORD = HID_OUT_CTL_CODE!(121); +pub const IOCTL_HID_ENABLE_SECURE_READ: DWORD = HID_CTL_CODE!(130); +pub const IOCTL_HID_DISABLE_SECURE_READ: DWORD = HID_CTL_CODE!(131); +pub const IOCTL_HID_DEVICERESET_NOTIFICATION: DWORD = HID_CTL_CODE!(140); +STRUCT!{struct HID_XFER_PACKET { + reportBuffer: PUCHAR, + reportBufferLen: ULONG, + reportId: UCHAR, +}} +pub type PHID_XFER_PACKET = *mut HID_XFER_PACKET; +//FIXME Stuff for NT_INCLUDED +STRUCT!{struct HID_COLLECTION_INFORMATION { + DescriptorSize: ULONG, + Polled: BOOLEAN, + Reserved1: [UCHAR; 1], + VendorID: USHORT, + ProductID: USHORT, + VersionNumber: USHORT, +}} +pub type PHID_COLLECTION_INFORMATION = *mut HID_COLLECTION_INFORMATION; +STRUCT!{struct HID_DRIVER_CONFIG { + Size: ULONG, + RingBufferSize: ULONG, +}} +pub type PHID_DRIVER_CONFIG = *mut HID_DRIVER_CONFIG; diff --git a/src/vendor/winapi/src/shared/hidpi.rs b/src/vendor/winapi/src/shared/hidpi.rs new file mode 100644 index 0000000000..e6621895dd --- /dev/null +++ b/src/vendor/winapi/src/shared/hidpi.rs @@ -0,0 +1,394 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::hidusage::{PUSAGE, USAGE}; +use shared::minwindef::{PUCHAR, PULONG, PUSHORT, UCHAR, ULONG, USHORT}; +use shared::ntdef::NTSTATUS; +use shared::ntstatus::FACILITY_HID_ERROR_CODE; +use um::winnt::{BOOLEAN, LONG, PCHAR, PLONG, PVOID}; +pub const HIDP_LINK_COLLECTION_ROOT: USHORT = -1i16 as u16; +pub const HIDP_LINK_COLLECTION_UNSPECIFIED: USHORT = 0; +ENUM!{enum HIDP_REPORT_TYPE { + HidP_Input, + HidP_Output, + HidP_Feature, +}} +STRUCT!{struct USAGE_AND_PAGE { + Usage: USAGE, + UsagePage: USAGE, +}} +pub type PUSAGE_AND_PAGE = *mut USAGE_AND_PAGE; +// HidP_IsSameUsageAndPage +STRUCT!{struct HIDP_CAPS_Range { + UsageMin: USAGE, + UsageMax: USAGE, + StringMin: USHORT, + StringMax: USHORT, + DesignatorMin: USHORT, + DesignatorMax: USHORT, + DataIndexMin: USHORT, + DataIndexMax: USHORT, +}} +STRUCT!{struct HIDP_CAPS_NotRange { + Usage: USAGE, + Reserved1: USAGE, + StringIndex: USHORT, + Reserved2: USHORT, + DesignatorIndex: USHORT, + Reserved3: USHORT, + DataIndex: USHORT, + Reserved4: USHORT, +}} +UNION!{union HIDP_CAPS_u { + [u16; 8], + Range Range_mut: HIDP_CAPS_Range, + NotRange NotRange_mut: HIDP_CAPS_NotRange, +}} +STRUCT!{struct HIDP_BUTTON_CAPS { + UsagePage: USAGE, + ReportID: UCHAR, + IsAlias: BOOLEAN, + BitField: USHORT, + LinkCollection: USHORT, + LinkUsage: USAGE, + LinkUsagePage: USAGE, + IsRange: BOOLEAN, + IsStringRange: BOOLEAN, + IsDesignatorRange: BOOLEAN, + IsAbsolute: BOOLEAN, + Reserved: [ULONG; 10], + u: HIDP_CAPS_u, +}} +pub type PHIDP_BUTTON_CAPS = *mut HIDP_BUTTON_CAPS; +STRUCT!{struct HIDP_VALUE_CAPS { + UsagePage: USAGE, + ReportID: UCHAR, + IsAlias: BOOLEAN, + BitField: USHORT, + LinkCollection: USHORT, + LinkUsage: USAGE, + LinkUsagePage: USAGE, + IsRange: BOOLEAN, + IsStringRange: BOOLEAN, + IsDesignatorRange: BOOLEAN, + IsAbsolute: BOOLEAN, + HasNull: BOOLEAN, + Reserved: UCHAR, + BitSize: USHORT, + ReportCount: USHORT, + Reserved2: [USHORT; 5], + UnitsExp: ULONG, + Units: ULONG, + LogicalMin: LONG, + LogicalMax: LONG, + PhysicalMin: LONG, + PhysicalMax: LONG, + u: HIDP_CAPS_u, +}} +pub type PHIDP_VALUE_CAPS = *mut HIDP_VALUE_CAPS; +STRUCT!{struct HIDP_LINK_COLLECTION_NODE { + LinkUsage: USAGE, + LinkUsagePage: USAGE, + Parent: USHORT, + NumberOfChildren: USHORT, + NextSibling: USHORT, + FirstChild: USHORT, + bit_fields: ULONG, + UserContext: PVOID, +}} +BITFIELD!{HIDP_LINK_COLLECTION_NODE bit_fields: ULONG [ + CollectionType set_CollectionType[0..8], + IsAlias set_IsAlias[8..9], +]} +pub type PHIDP_LINK_COLLECTION_NODE = *mut HIDP_LINK_COLLECTION_NODE; +pub type PHIDP_REPORT_DESCRIPTOR = PUCHAR; +pub enum HIDP_PREPARSED_DATA {} +pub type PHIDP_PREPARSED_DATA = *mut HIDP_PREPARSED_DATA; +STRUCT!{struct HIDP_CAPS { + Usage: USAGE, + UsagePage: USAGE, + InputReportByteLength: USHORT, + OutputReportByteLength: USHORT, + FeatureReportByteLength: USHORT, + Reserved: [USHORT; 17], + NumberLinkCollectionNodes: USHORT, + NumberInputButtonCaps: USHORT, + NumberInputValueCaps: USHORT, + NumberInputDataIndices: USHORT, + NumberOutputButtonCaps: USHORT, + NumberOutputValueCaps: USHORT, + NumberOutputDataIndices: USHORT, + NumberFeatureButtonCaps: USHORT, + NumberFeatureValueCaps: USHORT, + NumberFeatureDataIndices: USHORT, +}} +pub type PHIDP_CAPS = *mut HIDP_CAPS; +UNION!{union HIDP_DATA_u { + [u32; 1], + RawValue RawValue_mut: ULONG, + On On_mut: BOOLEAN, +}} +STRUCT!{struct HIDP_DATA { + DataIndex: USHORT, + Reserved: USHORT, + u: HIDP_DATA_u, +}} +pub type PHIDP_DATA = *mut HIDP_DATA; +STRUCT!{struct HIDP_UNKNOWN_TOKEN { + Token: UCHAR, + Reserved: [UCHAR; 3], + BitField: ULONG, +}} +pub type PHIDP_UNKNOWN_TOKEN = *mut HIDP_UNKNOWN_TOKEN; +STRUCT!{struct HIDP_EXTENDED_ATTRIBUTES { + NumGlobalUnknowns: UCHAR, + Reserved: [UCHAR; 3], + GlobalUnknowns: PHIDP_UNKNOWN_TOKEN, + Data: [ULONG; 1], +}} +pub type PHIDP_EXTENDED_ATTRIBUTES = *mut HIDP_EXTENDED_ATTRIBUTES; +extern "system" { + pub fn HidP_GetCaps( + PreparsedData: PHIDP_PREPARSED_DATA, + Capabilities: PHIDP_CAPS, + ) -> NTSTATUS; + pub fn HidP_GetLinkCollectionNodes( + LinkCollectionNodes: PHIDP_LINK_COLLECTION_NODE, + LinkCollectionNodesLength: PULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> NTSTATUS; + pub fn HidP_GetSpecificButtonCaps( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + ButtonCaps: PHIDP_BUTTON_CAPS, + ButtonCapsLength: PUSHORT, + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> NTSTATUS; + pub fn HidP_GetButtonCaps( + ReportType: HIDP_REPORT_TYPE, + ButtonCaps: PHIDP_BUTTON_CAPS, + ButtonCapsLength: PUSHORT, + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> NTSTATUS; + pub fn HidP_GetSpecificValueCaps( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + ValueCaps: PHIDP_VALUE_CAPS, + ValueCapsLength: PUSHORT, + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> NTSTATUS; + pub fn HidP_GetValueCaps( + ReportType: HIDP_REPORT_TYPE, + ValueCaps: PHIDP_VALUE_CAPS, + ValueCapsLength: PUSHORT, + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> NTSTATUS; + pub fn HidP_GetExtendedAttributes( + ReportType: HIDP_REPORT_TYPE, + DataIndex: USHORT, + PreparsedData: PHIDP_PREPARSED_DATA, + Attributes: PHIDP_EXTENDED_ATTRIBUTES, + LengthAttributes: PULONG, + ) -> NTSTATUS; + pub fn HidP_InitializeReportForID( + ReportType: HIDP_REPORT_TYPE, + ReportID: UCHAR, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_SetData( + ReportType: HIDP_REPORT_TYPE, + DataList: PHIDP_DATA, + DataLength: PULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_GetData( + ReportType: HIDP_REPORT_TYPE, + DataList: PHIDP_DATA, + DataLength: PULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_MaxDataListLength( + ReportType: HIDP_REPORT_TYPE, + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> ULONG; + pub fn HidP_SetUsages( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + UsageList: PUSAGE, + UsageLength: PULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_UnsetUsages( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + UsageList: PUSAGE, + UsageLength: PULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_GetUsages( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + UsageList: PUSAGE, + UsageLength: PULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_GetUsagesEx( + ReportType: HIDP_REPORT_TYPE, + LinkCollection: USHORT, + ButtonList: PUSAGE_AND_PAGE, + UsageLength: *mut ULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_MaxUsageListLength( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> ULONG; + pub fn HidP_SetUsageValue( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + UsageValue: ULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_SetScaledUsageValue( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + UsageValue: LONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_SetUsageValueArray( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + UsageValue: PCHAR, + UsageValueByteLength: USHORT, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_GetUsageValue( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + UsageValue: PULONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_GetScaledUsageValue( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + UsageValue: PLONG, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_GetUsageValueArray( + ReportType: HIDP_REPORT_TYPE, + UsagePage: USAGE, + LinkCollection: USHORT, + Usage: USAGE, + UsageValue: PCHAR, + UsageValueByteLength: USHORT, + PreparsedData: PHIDP_PREPARSED_DATA, + Report: PCHAR, + ReportLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_UsageListDifference( + PreviousUsageList: PUSAGE, + CurrentUsageList: PUSAGE, + BreakUsageList: PUSAGE, + MakeUsageList: PUSAGE, + UsageListLength: ULONG, + ) -> NTSTATUS; + pub fn HidP_TranslateUsagesToI8042ScanCodes( + ChangedUsageList: PUSAGE, + UsageListLength: ULONG, + KeyAction: HIDP_KEYBOARD_DIRECTION, + ModifierState: PHIDP_KEYBOARD_MODIFIER_STATE, + InsertCodesProcedure: PHIDP_INSERT_SCANCODES, + InsertCodesContext: PVOID, + ) -> NTSTATUS; +} +ENUM!{enum HIDP_KEYBOARD_DIRECTION { + HidP_Keyboard_Break, + HidP_Keyboard_Make, +}} +STRUCT!{struct HIDP_KEYBOARD_MODIFIER_STATE { + ul: ULONG, +}} +BITFIELD!{HIDP_KEYBOARD_MODIFIER_STATE ul: ULONG [ + LeftControl set_LeftControl[0..1], + LeftShift set_LeftShift[1..2], + LeftAlt set_LeftAlt[2..3], + LeftGUI set_LeftGUI[3..4], + RightControl set_RightControl[4..5], + RightShift set_RightShift[5..6], + RightAlt set_RightAlt[6..7], + RigthGUI set_RigthGUI[7..8], + CapsLock set_CapsLock[8..9], + ScollLock set_ScollLock[9..10], + NumLock set_NumLock[10..11], +]} +pub type PHIDP_KEYBOARD_MODIFIER_STATE = *mut HIDP_KEYBOARD_MODIFIER_STATE; +FN!{stdcall PHIDP_INSERT_SCANCODES( + Context: PVOID, + NewScanCodes: PCHAR, + Length: ULONG, +) -> BOOLEAN} +pub const HIDP_STATUS_SUCCESS: NTSTATUS = HIDP_ERROR_CODES!(0x0, 0); +pub const HIDP_STATUS_NULL: NTSTATUS = HIDP_ERROR_CODES!(0x8, 1); +pub const HIDP_STATUS_INVALID_PREPARSED_DATA: NTSTATUS = HIDP_ERROR_CODES!(0xC, 1); +pub const HIDP_STATUS_INVALID_REPORT_TYPE: NTSTATUS = HIDP_ERROR_CODES!(0xC, 2); +pub const HIDP_STATUS_INVALID_REPORT_LENGTH: NTSTATUS = HIDP_ERROR_CODES!(0xC, 3); +pub const HIDP_STATUS_USAGE_NOT_FOUND: NTSTATUS = HIDP_ERROR_CODES!(0xC, 4); +pub const HIDP_STATUS_VALUE_OUT_OF_RANGE: NTSTATUS = HIDP_ERROR_CODES!(0xC, 5); +pub const HIDP_STATUS_BAD_LOG_PHY_VALUES: NTSTATUS = HIDP_ERROR_CODES!(0xC, 6); +pub const HIDP_STATUS_BUFFER_TOO_SMALL: NTSTATUS = HIDP_ERROR_CODES!(0xC, 7); +pub const HIDP_STATUS_INTERNAL_ERROR: NTSTATUS = HIDP_ERROR_CODES!(0xC, 8); +pub const HIDP_STATUS_I8042_TRANS_UNKNOWN: NTSTATUS = HIDP_ERROR_CODES!(0xC, 9); +pub const HIDP_STATUS_INCOMPATIBLE_REPORT_ID: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xA); +pub const HIDP_STATUS_NOT_VALUE_ARRAY: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xB); +pub const HIDP_STATUS_IS_VALUE_ARRAY: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xC); +pub const HIDP_STATUS_DATA_INDEX_NOT_FOUND: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xD); +pub const HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xE); +pub const HIDP_STATUS_BUTTON_NOT_PRESSED: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xF); +pub const HIDP_STATUS_REPORT_DOES_NOT_EXIST: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0x10); +pub const HIDP_STATUS_NOT_IMPLEMENTED: NTSTATUS = HIDP_ERROR_CODES!(0xC, 0x20); +pub const HIDP_STATUS_I8242_TRANS_UNKNOWN: NTSTATUS = HIDP_STATUS_I8042_TRANS_UNKNOWN; diff --git a/src/vendor/winapi/src/shared/hidsdi.rs b/src/vendor/winapi/src/shared/hidsdi.rs new file mode 100644 index 0000000000..cd70ff9b8e --- /dev/null +++ b/src/vendor/winapi/src/shared/hidsdi.rs @@ -0,0 +1,111 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::guiddef::LPGUID; +use shared::hidpi::PHIDP_PREPARSED_DATA; +use shared::minwindef::{PULONG, ULONG, USHORT}; +use um::winnt::{BOOLEAN, HANDLE, PVOID}; +STRUCT!{struct HIDD_CONFIGURATION { + cookie: PVOID, + size: ULONG, + RingBufferSize: ULONG, +}} +pub type PHIDD_CONFIGURATION = *mut HIDD_CONFIGURATION; +STRUCT!{struct HIDD_ATTRIBUTES { + Size: ULONG, + VendorID: USHORT, + ProductID: USHORT, + VersionNumber: USHORT, +}} +pub type PHIDD_ATTRIBUTES = *mut HIDD_ATTRIBUTES; +extern "system" { + pub fn HidD_GetAttributes( + HidDeviceObject: HANDLE, + Attributes: PHIDD_ATTRIBUTES, + ) -> BOOLEAN; + pub fn HidD_GetHidGuid( + HidGuid: LPGUID, + ); + pub fn HidD_GetPreparsedData( + HidDeviceObject: HANDLE, + PreparsedData: *mut PHIDP_PREPARSED_DATA, + ) -> BOOLEAN; + pub fn HidD_FreePreparsedData( + PreparsedData: PHIDP_PREPARSED_DATA, + ) -> BOOLEAN; + pub fn HidD_FlushQueue( + HidDeviceObject: HANDLE, + ) -> BOOLEAN; + pub fn HidD_GetConfiguration( + HidDeviceObject: HANDLE, + Configuration: PHIDD_CONFIGURATION, + ConfigurationLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_SetConfiguration( + HidDeviceObject: HANDLE, + Configuration: PHIDD_CONFIGURATION, + ConfigurationLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetFeature( + HidDeviceObject: HANDLE, + ReportBuffer: PVOID, + ReportBufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_SetFeature( + HidDeviceObject: HANDLE, + ReportBuffer: PVOID, + ReportBufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetInputReport( + HidDeviceObject: HANDLE, + ReportBuffer: PVOID, + ReportBufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_SetOutputReport( + HidDeviceObject: HANDLE, + ReportBuffer: PVOID, + ReportBufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetNumInputBuffers( + HidDeviceObject: HANDLE, + NumberBuffers: PULONG, + ) -> BOOLEAN; + pub fn HidD_SetNumInputBuffers( + HidDeviceObject: HANDLE, + NumberBuffers: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetPhysicalDescriptor( + HidDeviceObject: HANDLE, + Buffer: PVOID, + BufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetManufacturerString( + HidDeviceObject: HANDLE, + Buffer: PVOID, + BufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetProductString( + HidDeviceObject: HANDLE, + Buffer: PVOID, + BufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetIndexedString( + HidDeviceObject: HANDLE, + StringIndex: ULONG, + Buffer: PVOID, + BufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetSerialNumberString( + HidDeviceObject: HANDLE, + Buffer: PVOID, + BufferLength: ULONG, + ) -> BOOLEAN; + pub fn HidD_GetMsGenreDescriptor( + HidDeviceObject: HANDLE, + Buffer: PVOID, + BufferLength: ULONG, + ) -> BOOLEAN; +} diff --git a/src/vendor/winapi/src/shared/hidusage.rs b/src/vendor/winapi/src/shared/hidusage.rs new file mode 100644 index 0000000000..d22f17076b --- /dev/null +++ b/src/vendor/winapi/src/shared/hidusage.rs @@ -0,0 +1,275 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::USHORT; +pub type USAGE = USHORT; +pub type PUSAGE = *mut USAGE; +pub const HID_USAGE_PAGE_UNDEFINED: USAGE = 0x00; +pub const HID_USAGE_PAGE_GENERIC: USAGE = 0x01; +pub const HID_USAGE_PAGE_SIMULATION: USAGE = 0x02; +pub const HID_USAGE_PAGE_VR: USAGE = 0x03; +pub const HID_USAGE_PAGE_SPORT: USAGE = 0x04; +pub const HID_USAGE_PAGE_GAME: USAGE = 0x05; +pub const HID_USAGE_PAGE_KEYBOARD: USAGE = 0x07; +pub const HID_USAGE_PAGE_LED: USAGE = 0x08; +pub const HID_USAGE_PAGE_BUTTON: USAGE = 0x09; +pub const HID_USAGE_PAGE_ORDINAL: USAGE = 0x0A; +pub const HID_USAGE_PAGE_TELEPHONY: USAGE = 0x0B; +pub const HID_USAGE_PAGE_CONSUMER: USAGE = 0x0C; +pub const HID_USAGE_PAGE_DIGITIZER: USAGE = 0x0D; +pub const HID_USAGE_PAGE_UNICODE: USAGE = 0x10; +pub const HID_USAGE_PAGE_ALPHANUMERIC: USAGE = 0x14; +pub const HID_USAGE_PAGE_SENSOR: USAGE = 0x20; +pub const HID_USAGE_PAGE_BARCODE_SCANNER: USAGE = 0x8C; +pub const HID_USAGE_PAGE_WEIGHING_DEVICE: USAGE = 0x8D; +pub const HID_USAGE_PAGE_MAGNETIC_STRIPE_READER: USAGE = 0x8E; +pub const HID_USAGE_PAGE_CAMERA_CONTROL: USAGE = 0x90; +pub const HID_USAGE_PAGE_MICROSOFT_BLUETOOTH_HANDSFREE: USAGE = 0xFFF3; +pub const HID_USAGE_PAGE_VENDOR_DEFINED_BEGIN: USAGE = 0xFF00; +pub const HID_USAGE_PAGE_VENDOR_DEFINED_END: USAGE = 0xFFFF; +pub const HID_USAGE_GENERIC_POINTER: USAGE = 0x01; +pub const HID_USAGE_GENERIC_MOUSE: USAGE = 0x02; +pub const HID_USAGE_GENERIC_JOYSTICK: USAGE = 0x04; +pub const HID_USAGE_GENERIC_GAMEPAD: USAGE = 0x05; +pub const HID_USAGE_GENERIC_KEYBOARD: USAGE = 0x06; +pub const HID_USAGE_GENERIC_KEYPAD: USAGE = 0x07; +pub const HID_USAGE_GENERIC_PORTABLE_DEVICE_CONTROL: USAGE = 0x0D; +pub const HID_USAGE_GENERIC_SYSTEM_CTL: USAGE = 0x80; +pub const HID_USAGE_GENERIC_X: USAGE = 0x30; +pub const HID_USAGE_GENERIC_Y: USAGE = 0x31; +pub const HID_USAGE_GENERIC_Z: USAGE = 0x32; +pub const HID_USAGE_GENERIC_RX: USAGE = 0x33; +pub const HID_USAGE_GENERIC_RY: USAGE = 0x34; +pub const HID_USAGE_GENERIC_RZ: USAGE = 0x35; +pub const HID_USAGE_GENERIC_SLIDER: USAGE = 0x36; +pub const HID_USAGE_GENERIC_DIAL: USAGE = 0x37; +pub const HID_USAGE_GENERIC_WHEEL: USAGE = 0x38; +pub const HID_USAGE_GENERIC_HATSWITCH: USAGE = 0x39; +pub const HID_USAGE_GENERIC_COUNTED_BUFFER: USAGE = 0x3A; +pub const HID_USAGE_GENERIC_BYTE_COUNT: USAGE = 0x3B; +pub const HID_USAGE_GENERIC_MOTION_WAKEUP: USAGE = 0x3C; +pub const HID_USAGE_GENERIC_VX: USAGE = 0x40; +pub const HID_USAGE_GENERIC_VY: USAGE = 0x41; +pub const HID_USAGE_GENERIC_VZ: USAGE = 0x42; +pub const HID_USAGE_GENERIC_VBRX: USAGE = 0x43; +pub const HID_USAGE_GENERIC_VBRY: USAGE = 0x44; +pub const HID_USAGE_GENERIC_VBRZ: USAGE = 0x45; +pub const HID_USAGE_GENERIC_VNO: USAGE = 0x46; +pub const HID_USAGE_GENERIC_RESOLUTION_MULTIPLIER: USAGE = 0x48; +pub const HID_USAGE_GENERIC_SYSCTL_POWER: USAGE = 0x81; +pub const HID_USAGE_GENERIC_SYSCTL_SLEEP: USAGE = 0x82; +pub const HID_USAGE_GENERIC_SYSCTL_WAKE: USAGE = 0x83; +pub const HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU: USAGE = 0x84; +pub const HID_USAGE_GENERIC_SYSCTL_MAIN_MENU: USAGE = 0x85; +pub const HID_USAGE_GENERIC_SYSCTL_APP_MENU: USAGE = 0x86; +pub const HID_USAGE_GENERIC_SYSCTL_HELP_MENU: USAGE = 0x87; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_EXIT: USAGE = 0x88; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_SELECT: USAGE = 0x89; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT: USAGE = 0x8A; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_LEFT: USAGE = 0x8B; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_UP: USAGE = 0x8C; +pub const HID_USAGE_GENERIC_SYSCTL_MENU_DOWN: USAGE = 0x8D; +pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_BUTTON: USAGE = 0xC9; +pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_SLIDER_SWITCH: USAGE = 0xCA; +pub const HID_USAGE_GENERIC_CONTROL_ENABLE: USAGE = 0xCB; +pub const HID_USAGE_SIMULATION_RUDDER: USAGE = 0xBA; +pub const HID_USAGE_SIMULATION_THROTTLE: USAGE = 0xBB; +pub const HID_USAGE_KEYBOARD_NOEVENT: USAGE = 0x00; +pub const HID_USAGE_KEYBOARD_ROLLOVER: USAGE = 0x01; +pub const HID_USAGE_KEYBOARD_POSTFAIL: USAGE = 0x02; +pub const HID_USAGE_KEYBOARD_UNDEFINED: USAGE = 0x03; +pub const HID_USAGE_KEYBOARD_aA: USAGE = 0x04; +pub const HID_USAGE_KEYBOARD_zZ: USAGE = 0x1D; +pub const HID_USAGE_KEYBOARD_ONE: USAGE = 0x1E; +pub const HID_USAGE_KEYBOARD_ZERO: USAGE = 0x27; +pub const HID_USAGE_KEYBOARD_LCTRL: USAGE = 0xE0; +pub const HID_USAGE_KEYBOARD_LSHFT: USAGE = 0xE1; +pub const HID_USAGE_KEYBOARD_LALT: USAGE = 0xE2; +pub const HID_USAGE_KEYBOARD_LGUI: USAGE = 0xE3; +pub const HID_USAGE_KEYBOARD_RCTRL: USAGE = 0xE4; +pub const HID_USAGE_KEYBOARD_RSHFT: USAGE = 0xE5; +pub const HID_USAGE_KEYBOARD_RALT: USAGE = 0xE6; +pub const HID_USAGE_KEYBOARD_RGUI: USAGE = 0xE7; +pub const HID_USAGE_KEYBOARD_SCROLL_LOCK: USAGE = 0x47; +pub const HID_USAGE_KEYBOARD_NUM_LOCK: USAGE = 0x53; +pub const HID_USAGE_KEYBOARD_CAPS_LOCK: USAGE = 0x39; +pub const HID_USAGE_KEYBOARD_F1: USAGE = 0x3A; +pub const HID_USAGE_KEYBOARD_F2: USAGE = 0x3B; +pub const HID_USAGE_KEYBOARD_F3: USAGE = 0x3C; +pub const HID_USAGE_KEYBOARD_F4: USAGE = 0x3D; +pub const HID_USAGE_KEYBOARD_F5: USAGE = 0x3E; +pub const HID_USAGE_KEYBOARD_F6: USAGE = 0x3F; +pub const HID_USAGE_KEYBOARD_F7: USAGE = 0x40; +pub const HID_USAGE_KEYBOARD_F8: USAGE = 0x41; +pub const HID_USAGE_KEYBOARD_F9: USAGE = 0x42; +pub const HID_USAGE_KEYBOARD_F10: USAGE = 0x43; +pub const HID_USAGE_KEYBOARD_F11: USAGE = 0x44; +pub const HID_USAGE_KEYBOARD_F12: USAGE = 0x45; +pub const HID_USAGE_KEYBOARD_F13: USAGE = 0x68; +pub const HID_USAGE_KEYBOARD_F14: USAGE = 0x69; +pub const HID_USAGE_KEYBOARD_F15: USAGE = 0x6A; +pub const HID_USAGE_KEYBOARD_F16: USAGE = 0x6B; +pub const HID_USAGE_KEYBOARD_F17: USAGE = 0x6C; +pub const HID_USAGE_KEYBOARD_F18: USAGE = 0x6D; +pub const HID_USAGE_KEYBOARD_F19: USAGE = 0x6E; +pub const HID_USAGE_KEYBOARD_F20: USAGE = 0x6F; +pub const HID_USAGE_KEYBOARD_F21: USAGE = 0x70; +pub const HID_USAGE_KEYBOARD_F22: USAGE = 0x71; +pub const HID_USAGE_KEYBOARD_F23: USAGE = 0x72; +pub const HID_USAGE_KEYBOARD_F24: USAGE = 0x73; +pub const HID_USAGE_KEYBOARD_RETURN: USAGE = 0x28; +pub const HID_USAGE_KEYBOARD_ESCAPE: USAGE = 0x29; +pub const HID_USAGE_KEYBOARD_DELETE: USAGE = 0x2A; +pub const HID_USAGE_KEYBOARD_PRINT_SCREEN: USAGE = 0x46; +pub const HID_USAGE_KEYBOARD_DELETE_FORWARD: USAGE = 0x4C; +pub const HID_USAGE_LED_NUM_LOCK: USAGE = 0x01; +pub const HID_USAGE_LED_CAPS_LOCK: USAGE = 0x02; +pub const HID_USAGE_LED_SCROLL_LOCK: USAGE = 0x03; +pub const HID_USAGE_LED_COMPOSE: USAGE = 0x04; +pub const HID_USAGE_LED_KANA: USAGE = 0x05; +pub const HID_USAGE_LED_POWER: USAGE = 0x06; +pub const HID_USAGE_LED_SHIFT: USAGE = 0x07; +pub const HID_USAGE_LED_DO_NOT_DISTURB: USAGE = 0x08; +pub const HID_USAGE_LED_MUTE: USAGE = 0x09; +pub const HID_USAGE_LED_TONE_ENABLE: USAGE = 0x0A; +pub const HID_USAGE_LED_HIGH_CUT_FILTER: USAGE = 0x0B; +pub const HID_USAGE_LED_LOW_CUT_FILTER: USAGE = 0x0C; +pub const HID_USAGE_LED_EQUALIZER_ENABLE: USAGE = 0x0D; +pub const HID_USAGE_LED_SOUND_FIELD_ON: USAGE = 0x0E; +pub const HID_USAGE_LED_SURROUND_FIELD_ON: USAGE = 0x0F; +pub const HID_USAGE_LED_REPEAT: USAGE = 0x10; +pub const HID_USAGE_LED_STEREO: USAGE = 0x11; +pub const HID_USAGE_LED_SAMPLING_RATE_DETECT: USAGE = 0x12; +pub const HID_USAGE_LED_SPINNING: USAGE = 0x13; +pub const HID_USAGE_LED_CAV: USAGE = 0x14; +pub const HID_USAGE_LED_CLV: USAGE = 0x15; +pub const HID_USAGE_LED_RECORDING_FORMAT_DET: USAGE = 0x16; +pub const HID_USAGE_LED_OFF_HOOK: USAGE = 0x17; +pub const HID_USAGE_LED_RING: USAGE = 0x18; +pub const HID_USAGE_LED_MESSAGE_WAITING: USAGE = 0x19; +pub const HID_USAGE_LED_DATA_MODE: USAGE = 0x1A; +pub const HID_USAGE_LED_BATTERY_OPERATION: USAGE = 0x1B; +pub const HID_USAGE_LED_BATTERY_OK: USAGE = 0x1C; +pub const HID_USAGE_LED_BATTERY_LOW: USAGE = 0x1D; +pub const HID_USAGE_LED_SPEAKER: USAGE = 0x1E; +pub const HID_USAGE_LED_HEAD_SET: USAGE = 0x1F; +pub const HID_USAGE_LED_HOLD: USAGE = 0x20; +pub const HID_USAGE_LED_MICROPHONE: USAGE = 0x21; +pub const HID_USAGE_LED_COVERAGE: USAGE = 0x22; +pub const HID_USAGE_LED_NIGHT_MODE: USAGE = 0x23; +pub const HID_USAGE_LED_SEND_CALLS: USAGE = 0x24; +pub const HID_USAGE_LED_CALL_PICKUP: USAGE = 0x25; +pub const HID_USAGE_LED_CONFERENCE: USAGE = 0x26; +pub const HID_USAGE_LED_STAND_BY: USAGE = 0x27; +pub const HID_USAGE_LED_CAMERA_ON: USAGE = 0x28; +pub const HID_USAGE_LED_CAMERA_OFF: USAGE = 0x29; +pub const HID_USAGE_LED_ON_LINE: USAGE = 0x2A; +pub const HID_USAGE_LED_OFF_LINE: USAGE = 0x2B; +pub const HID_USAGE_LED_BUSY: USAGE = 0x2C; +pub const HID_USAGE_LED_READY: USAGE = 0x2D; +pub const HID_USAGE_LED_PAPER_OUT: USAGE = 0x2E; +pub const HID_USAGE_LED_PAPER_JAM: USAGE = 0x2F; +pub const HID_USAGE_LED_REMOTE: USAGE = 0x30; +pub const HID_USAGE_LED_FORWARD: USAGE = 0x31; +pub const HID_USAGE_LED_REVERSE: USAGE = 0x32; +pub const HID_USAGE_LED_STOP: USAGE = 0x33; +pub const HID_USAGE_LED_REWIND: USAGE = 0x34; +pub const HID_USAGE_LED_FAST_FORWARD: USAGE = 0x35; +pub const HID_USAGE_LED_PLAY: USAGE = 0x36; +pub const HID_USAGE_LED_PAUSE: USAGE = 0x37; +pub const HID_USAGE_LED_RECORD: USAGE = 0x38; +pub const HID_USAGE_LED_ERROR: USAGE = 0x39; +pub const HID_USAGE_LED_SELECTED_INDICATOR: USAGE = 0x3A; +pub const HID_USAGE_LED_IN_USE_INDICATOR: USAGE = 0x3B; +pub const HID_USAGE_LED_MULTI_MODE_INDICATOR: USAGE = 0x3C; +pub const HID_USAGE_LED_INDICATOR_ON: USAGE = 0x3D; +pub const HID_USAGE_LED_INDICATOR_FLASH: USAGE = 0x3E; +pub const HID_USAGE_LED_INDICATOR_SLOW_BLINK: USAGE = 0x3F; +pub const HID_USAGE_LED_INDICATOR_FAST_BLINK: USAGE = 0x40; +pub const HID_USAGE_LED_INDICATOR_OFF: USAGE = 0x41; +pub const HID_USAGE_LED_FLASH_ON_TIME: USAGE = 0x42; +pub const HID_USAGE_LED_SLOW_BLINK_ON_TIME: USAGE = 0x43; +pub const HID_USAGE_LED_SLOW_BLINK_OFF_TIME: USAGE = 0x44; +pub const HID_USAGE_LED_FAST_BLINK_ON_TIME: USAGE = 0x45; +pub const HID_USAGE_LED_FAST_BLINK_OFF_TIME: USAGE = 0x46; +pub const HID_USAGE_LED_INDICATOR_COLOR: USAGE = 0x47; +pub const HID_USAGE_LED_RED: USAGE = 0x48; +pub const HID_USAGE_LED_GREEN: USAGE = 0x49; +pub const HID_USAGE_LED_AMBER: USAGE = 0x4A; +pub const HID_USAGE_LED_GENERIC_INDICATOR: USAGE = 0x4B; +pub const HID_USAGE_TELEPHONY_PHONE: USAGE = 0x01; +pub const HID_USAGE_TELEPHONY_ANSWERING_MACHINE: USAGE = 0x02; +pub const HID_USAGE_TELEPHONY_MESSAGE_CONTROLS: USAGE = 0x03; +pub const HID_USAGE_TELEPHONY_HANDSET: USAGE = 0x04; +pub const HID_USAGE_TELEPHONY_HEADSET: USAGE = 0x05; +pub const HID_USAGE_TELEPHONY_KEYPAD: USAGE = 0x06; +pub const HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON: USAGE = 0x07; +pub const HID_USAGE_TELEPHONY_REDIAL: USAGE = 0x24; +pub const HID_USAGE_TELEPHONY_TRANSFER: USAGE = 0x25; +pub const HID_USAGE_TELEPHONY_DROP: USAGE = 0x26; +pub const HID_USAGE_TELEPHONY_LINE: USAGE = 0x2A; +pub const HID_USAGE_TELEPHONY_RING_ENABLE: USAGE = 0x2D; +pub const HID_USAGE_TELEPHONY_SEND: USAGE = 0x31; +pub const HID_USAGE_TELEPHONY_KEYPAD_0: USAGE = 0xB0; +pub const HID_USAGE_TELEPHONY_KEYPAD_D: USAGE = 0xBF; +pub const HID_USAGE_TELEPHONY_HOST_AVAILABLE: USAGE = 0xF1; +pub const HID_USAGE_CONSUMERCTRL: USAGE = 0x01; +pub const HID_USAGE_CONSUMER_CHANNEL_INCREMENT: USAGE = 0x9C; +pub const HID_USAGE_CONSUMER_CHANNEL_DECREMENT: USAGE = 0x9D; +pub const HID_USAGE_CONSUMER_PLAY: USAGE = 0xB0; +pub const HID_USAGE_CONSUMER_PAUSE: USAGE = 0xB1; +pub const HID_USAGE_CONSUMER_RECORD: USAGE = 0xB2; +pub const HID_USAGE_CONSUMER_FAST_FORWARD: USAGE = 0xB3; +pub const HID_USAGE_CONSUMER_REWIND: USAGE = 0xB4; +pub const HID_USAGE_CONSUMER_SCAN_NEXT_TRACK: USAGE = 0xB5; +pub const HID_USAGE_CONSUMER_SCAN_PREV_TRACK: USAGE = 0xB6; +pub const HID_USAGE_CONSUMER_STOP: USAGE = 0xB7; +pub const HID_USAGE_CONSUMER_PLAY_PAUSE: USAGE = 0xCD; +pub const HID_USAGE_CONSUMER_VOLUME: USAGE = 0xE0; +pub const HID_USAGE_CONSUMER_BALANCE: USAGE = 0xE1; +pub const HID_USAGE_CONSUMER_MUTE: USAGE = 0xE2; +pub const HID_USAGE_CONSUMER_BASS: USAGE = 0xE3; +pub const HID_USAGE_CONSUMER_TREBLE: USAGE = 0xE4; +pub const HID_USAGE_CONSUMER_BASS_BOOST: USAGE = 0xE5; +pub const HID_USAGE_CONSUMER_SURROUND_MODE: USAGE = 0xE6; +pub const HID_USAGE_CONSUMER_LOUDNESS: USAGE = 0xE7; +pub const HID_USAGE_CONSUMER_MPX: USAGE = 0xE8; +pub const HID_USAGE_CONSUMER_VOLUME_INCREMENT: USAGE = 0xE9; +pub const HID_USAGE_CONSUMER_VOLUME_DECREMENT: USAGE = 0xEA; +pub const HID_USAGE_CONSUMER_BASS_INCREMENT: USAGE = 0x152; +pub const HID_USAGE_CONSUMER_BASS_DECREMENT: USAGE = 0x153; +pub const HID_USAGE_CONSUMER_TREBLE_INCREMENT: USAGE = 0x154; +pub const HID_USAGE_CONSUMER_TREBLE_DECREMENT: USAGE = 0x155; +pub const HID_USAGE_CONSUMER_AL_CONFIGURATION: USAGE = 0x183; +pub const HID_USAGE_CONSUMER_AL_EMAIL: USAGE = 0x18A; +pub const HID_USAGE_CONSUMER_AL_CALCULATOR: USAGE = 0x192; +pub const HID_USAGE_CONSUMER_AL_BROWSER: USAGE = 0x194; +pub const HID_USAGE_CONSUMER_AC_SEARCH: USAGE = 0x221; +pub const HID_USAGE_CONSUMER_AC_GOTO: USAGE = 0x222; +pub const HID_USAGE_CONSUMER_AC_HOME: USAGE = 0x223; +pub const HID_USAGE_CONSUMER_AC_BACK: USAGE = 0x224; +pub const HID_USAGE_CONSUMER_AC_FORWARD: USAGE = 0x225; +pub const HID_USAGE_CONSUMER_AC_STOP: USAGE = 0x226; +pub const HID_USAGE_CONSUMER_AC_REFRESH: USAGE = 0x227; +pub const HID_USAGE_CONSUMER_AC_PREVIOUS: USAGE = 0x228; +pub const HID_USAGE_CONSUMER_AC_NEXT: USAGE = 0x229; +pub const HID_USAGE_CONSUMER_AC_BOOKMARKS: USAGE = 0x22A; +pub const HID_USAGE_CONSUMER_AC_PAN: USAGE = 0x238; +pub const HID_USAGE_CONSUMER_EXTENDED_KEYBOARD_ATTRIBUTES_COLLECTION: USAGE = 0x2C0; +pub const HID_USAGE_CONSUMER_KEYBOARD_FORM_FACTOR: USAGE = 0x2C1; +pub const HID_USAGE_CONSUMER_KEYBOARD_KEY_TYPE: USAGE = 0x2C2; +pub const HID_USAGE_CONSUMER_KEYBOARD_PHYSICAL_LAYOUT: USAGE = 0x2C3; +pub const HID_USAGE_CONSUMER_VENDOR_SPECIFIC_KEYBOARD_PHYSICAL_LAYOUT: USAGE = 0x2C4; +pub const HID_USAGE_CONSUMER_KEYBOARD_IETF_LANGUAGE_TAG_INDEX: USAGE = 0x2C5; +pub const HID_USAGE_CONSUMER_IMPLEMENTED_KEYBOARD_INPUT_ASSIST_CONTROLS: USAGE = 0x2C6; +pub const HID_USAGE_DIGITIZER_PEN: USAGE = 0x02; +pub const HID_USAGE_DIGITIZER_IN_RANGE: USAGE = 0x32; +pub const HID_USAGE_DIGITIZER_TIP_SWITCH: USAGE = 0x42; +pub const HID_USAGE_DIGITIZER_BARREL_SWITCH: USAGE = 0x44; +pub const HID_USAGE_CAMERA_AUTO_FOCUS: USAGE = 0x20; +pub const HID_USAGE_CAMERA_SHUTTER: USAGE = 0x21; +pub const HID_USAGE_MS_BTH_HF_DIALNUMBER: USAGE = 0x21; +pub const HID_USAGE_MS_BTH_HF_DIALMEMORY: USAGE = 0x22; diff --git a/src/vendor/winapi/src/shared/in6addr.rs b/src/vendor/winapi/src/shared/in6addr.rs new file mode 100644 index 0000000000..515e8a600e --- /dev/null +++ b/src/vendor/winapi/src/shared/in6addr.rs @@ -0,0 +1,18 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{UCHAR, USHORT}; +UNION!{union in6_addr_u { + [u16; 8], + Byte Byte_mut: [UCHAR; 16], + Word Word_mut: [USHORT; 8], +}} +STRUCT!{struct in6_addr { + u: in6_addr_u, +}} +pub type IN6_ADDR = in6_addr; +pub type PIN6_ADDR = *mut IN6_ADDR; +pub type LPIN6_ADDR = *mut IN6_ADDR; diff --git a/src/vendor/winapi/src/shared/inaddr.rs b/src/vendor/winapi/src/shared/inaddr.rs new file mode 100644 index 0000000000..df2d934efc --- /dev/null +++ b/src/vendor/winapi/src/shared/inaddr.rs @@ -0,0 +1,30 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! IPv4 Internet address +use shared::minwindef::{UCHAR, ULONG, USHORT}; +STRUCT!{struct in_addr_S_un_b { + s_b1: UCHAR, + s_b2: UCHAR, + s_b3: UCHAR, + s_b4: UCHAR, +}} +STRUCT!{struct in_addr_S_un_w { + s_w1: USHORT, + s_w2: USHORT, +}} +UNION!{union in_addr_S_un { + [u32; 1], + S_un_b S_un_b_mut: in_addr_S_un_b, + S_un_w S_un_w_mut: in_addr_S_un_w, + S_addr S_addr_mut: ULONG, +}} +STRUCT!{struct in_addr { + S_un: in_addr_S_un, +}} +pub type IN_ADDR = in_addr; +pub type PIN_ADDR = *mut in_addr; +pub type LPIN_ADDR = *mut in_addr; diff --git a/src/vendor/winapi/src/shared/intsafe.rs b/src/vendor/winapi/src/shared/intsafe.rs new file mode 100644 index 0000000000..6854b022e2 --- /dev/null +++ b/src/vendor/winapi/src/shared/intsafe.rs @@ -0,0 +1,6 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. diff --git a/src/vendor/winapi/src/shared/ksmedia.rs b/src/vendor/winapi/src/shared/ksmedia.rs new file mode 100644 index 0000000000..9f563af2b9 --- /dev/null +++ b/src/vendor/winapi/src/shared/ksmedia.rs @@ -0,0 +1,23 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +// Licensed under the MIT License +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_ANALOG, + 0x6DBA3190, 0x67BD, 0x11CF, 0xA0, 0xF7, 0x00, 0x20, 0xAF, 0xD1, 0x56, 0xE4} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_PCM, + 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, + 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_DRM, + 0x00000009, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_ALAW, + 0x00000006, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_MULAW, + 0x00000007, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_ADPCM, + 0x00000002, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_MPEG, + 0x00000050, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71} diff --git a/src/vendor/winapi/src/shared/ktmtypes.rs b/src/vendor/winapi/src/shared/ktmtypes.rs new file mode 100644 index 0000000000..06b43972c3 --- /dev/null +++ b/src/vendor/winapi/src/shared/ktmtypes.rs @@ -0,0 +1,139 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Common types for KTM exposed at both the Nt- and Win32-layer +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, ULONG}; +use um::winnt::{LARGE_INTEGER, PVOID, WCHAR}; +pub type UOW = GUID; +pub type PUOW = *mut GUID; +pub type CRM_PROTOCOL_ID = GUID; +pub type PCRM_PROTOCOL_ID = *mut GUID; +pub const TRANSACTION_MANAGER_VOLATILE: ULONG = 0x00000001; +pub const TRANSACTION_MANAGER_COMMIT_DEFAULT: ULONG = 0x00000000; +pub const TRANSACTION_MANAGER_COMMIT_SYSTEM_VOLUME: ULONG = 0x00000002; +pub const TRANSACTION_MANAGER_COMMIT_SYSTEM_HIVES: ULONG = 0x00000004; +pub const TRANSACTION_MANAGER_COMMIT_LOWEST: ULONG = 0x00000008; +pub const TRANSACTION_MANAGER_CORRUPT_FOR_RECOVERY: ULONG = 0x00000010; +pub const TRANSACTION_MANAGER_CORRUPT_FOR_PROGRESS: ULONG = 0x00000020; +pub const TRANSACTION_MANAGER_MAXIMUM_OPTION: ULONG = 0x0000003F; +pub const TRANSACTION_DO_NOT_PROMOTE: DWORD = 0x00000001; +pub const TRANSACTION_MAXIMUM_OPTION: DWORD = 0x00000001; +pub const RESOURCE_MANAGER_VOLATILE: DWORD = 0x00000001; +pub const RESOURCE_MANAGER_COMMUNICATION: DWORD = 0x00000002; +pub const RESOURCE_MANAGER_MAXIMUM_OPTION: DWORD = 0x00000003; +pub const CRM_PROTOCOL_EXPLICIT_MARSHAL_ONLY: DWORD = 0x00000001; +pub const CRM_PROTOCOL_DYNAMIC_MARSHAL_INFO: DWORD = 0x00000002; +pub const CRM_PROTOCOL_MAXIMUM_OPTION: DWORD = 0x00000003; +pub const ENLISTMENT_SUPERIOR: ULONG = 0x00000001; +pub const ENLISTMENT_MAXIMUM_OPTION: ULONG = 0x00000001; +pub type NOTIFICATION_MASK = ULONG; +pub const TRANSACTION_NOTIFY_MASK: ULONG = 0x3FFFFFFF; +pub const TRANSACTION_NOTIFY_PREPREPARE: ULONG = 0x00000001; +pub const TRANSACTION_NOTIFY_PREPARE: ULONG = 0x00000002; +pub const TRANSACTION_NOTIFY_COMMIT: ULONG = 0x00000004; +pub const TRANSACTION_NOTIFY_ROLLBACK: ULONG = 0x00000008; +pub const TRANSACTION_NOTIFY_PREPREPARE_COMPLETE: ULONG = 0x00000010; +pub const TRANSACTION_NOTIFY_PREPARE_COMPLETE: ULONG = 0x00000020; +pub const TRANSACTION_NOTIFY_COMMIT_COMPLETE: ULONG = 0x00000040; +pub const TRANSACTION_NOTIFY_ROLLBACK_COMPLETE: ULONG = 0x00000080; +pub const TRANSACTION_NOTIFY_RECOVER: ULONG = 0x00000100; +pub const TRANSACTION_NOTIFY_SINGLE_PHASE_COMMIT: ULONG = 0x00000200; +pub const TRANSACTION_NOTIFY_DELEGATE_COMMIT: ULONG = 0x00000400; +pub const TRANSACTION_NOTIFY_RECOVER_QUERY: ULONG = 0x00000800; +pub const TRANSACTION_NOTIFY_ENLIST_PREPREPARE: ULONG = 0x00001000; +pub const TRANSACTION_NOTIFY_LAST_RECOVER: ULONG = 0x00002000; +pub const TRANSACTION_NOTIFY_INDOUBT: ULONG = 0x00004000; +pub const TRANSACTION_NOTIFY_PROPAGATE_PULL: ULONG = 0x00008000; +pub const TRANSACTION_NOTIFY_PROPAGATE_PUSH: ULONG = 0x00010000; +pub const TRANSACTION_NOTIFY_MARSHAL: ULONG = 0x00020000; +pub const TRANSACTION_NOTIFY_ENLIST_MASK: ULONG = 0x00040000; +pub const TRANSACTION_NOTIFY_RM_DISCONNECTED: ULONG = 0x01000000; +pub const TRANSACTION_NOTIFY_TM_ONLINE: ULONG = 0x02000000; +pub const TRANSACTION_NOTIFY_COMMIT_REQUEST: ULONG = 0x04000000; +pub const TRANSACTION_NOTIFY_PROMOTE: ULONG = 0x08000000; +pub const TRANSACTION_NOTIFY_PROMOTE_NEW: ULONG = 0x10000000; +pub const TRANSACTION_NOTIFY_REQUEST_OUTCOME: ULONG = 0x20000000; +pub const TRANSACTION_NOTIFY_COMMIT_FINALIZE: ULONG = 0x40000000; +pub const TRANSACTIONMANAGER_OBJECT_PATH: &'static str = "\\TransactionManager\\"; +pub const TRANSACTION_OBJECT_PATH: &'static str = "\\Transaction\\"; +pub const ENLISTMENT_OBJECT_PATH: &'static str = "\\Enlistment\\"; +pub const RESOURCE_MANAGER_OBJECT_PATH: &'static str = "\\ResourceManager\\"; +STRUCT!{struct TRANSACTION_NOTIFICATION { + TransactionKey: PVOID, + TransactionNotification: ULONG, + TmVirtualClock: LARGE_INTEGER, + ArgumentLength: ULONG, +}} +pub type PTRANSACTION_NOTIFICATION = *mut TRANSACTION_NOTIFICATION; +STRUCT!{struct TRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT { + EnlistmentId: GUID, + UOW: UOW, +}} +pub type PTRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT + = *mut TRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT; +pub const TRANSACTION_NOTIFICATION_TM_ONLINE_FLAG_IS_CLUSTERED: ULONG = 0x1; +STRUCT!{struct TRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT { + TmIdentity: GUID, + Flags: ULONG, +}} +pub type PTRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT + = *mut TRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT; +pub type SAVEPOINT_ID = ULONG; +pub type PSAVEPOINT_ID = *mut ULONG; +STRUCT!{struct TRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT { + SavepointId: SAVEPOINT_ID, +}} +pub type PTRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT + = *mut TRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT; +STRUCT!{struct TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT { + PropagationCookie: ULONG, + UOW: GUID, + TmIdentity: GUID, + BufferLength: ULONG, +}} +pub type PTRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT + = *mut TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT; +STRUCT!{struct TRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT { + MarshalCookie: ULONG, + UOW: GUID, +}} +pub type PTRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT + = *mut TRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT; +pub type TRANSACTION_NOTIFICATION_PROMOTE_ARGUMENT = TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT; +pub type PTRANSACTION_NOTIFICATION_PROMOTE_ARGUMENT + = *mut TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT; +pub const KTM_MARSHAL_BLOB_VERSION_MAJOR: ULONG = 1; +pub const KTM_MARSHAL_BLOB_VERSION_MINOR: ULONG = 1; +pub const MAX_TRANSACTION_DESCRIPTION_LENGTH: usize = 64; +pub const MAX_RESOURCEMANAGER_DESCRIPTION_LENGTH: usize = 64; +STRUCT!{struct KCRM_MARSHAL_HEADER { + VersionMajor: ULONG, + VersionMinor: ULONG, + NumProtocols: ULONG, + Unused: ULONG, +}} +pub type PKCRM_MARSHAL_HEADER = *mut KCRM_MARSHAL_HEADER; +pub type PRKCRM_MARSHAL_HEADER = *mut KCRM_MARSHAL_HEADER; +STRUCT!{struct KCRM_TRANSACTION_BLOB { + UOW: UOW, + TmIdentity: GUID, + IsolationLevel: ULONG, + IsolationFlags: ULONG, + Timeout: ULONG, + Description: [WCHAR; MAX_TRANSACTION_DESCRIPTION_LENGTH], +}} +pub type PKCRM_TRANSACTION_BLOB = *mut KCRM_TRANSACTION_BLOB; +pub type PRKCRM_TRANSACTION_BLOB = *mut KCRM_TRANSACTION_BLOB; +STRUCT!{struct KCRM_PROTOCOL_BLOB { + ProtocolId: CRM_PROTOCOL_ID, + StaticInfoLength: ULONG, + TransactionIdInfoLength: ULONG, + Unused1: ULONG, + Unused2: ULONG, +}} +pub type PKCRM_PROTOCOL_BLOB = *mut KCRM_PROTOCOL_BLOB; +pub type PRKCRM_PROTOCOL_BLOB = *mut KCRM_PROTOCOL_BLOB; diff --git a/src/vendor/winapi/src/shared/lmcons.rs b/src/vendor/winapi/src/shared/lmcons.rs new file mode 100644 index 0000000000..639fd9af6f --- /dev/null +++ b/src/vendor/winapi/src/shared/lmcons.rs @@ -0,0 +1,61 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains constants used throughout the LAN Manager API header files. +use shared::minwindef::DWORD; +use um::winnt::{LPCWSTR, LPWSTR}; +pub const CNLEN: DWORD = 15; +pub const LM20_CNLEN: DWORD = 15; +pub const DNLEN: DWORD = CNLEN; +pub const LM20_DNLEN: DWORD = LM20_CNLEN; +pub const UNCLEN: DWORD = CNLEN + 2; +pub const LM20_UNCLEN: DWORD = LM20_CNLEN + 2; +pub const NNLEN: DWORD = 80; +pub const LM20_NNLEN: DWORD = 12; +pub const RMLEN: DWORD = UNCLEN + 1 + NNLEN; +pub const LM20_RMLEN: DWORD = LM20_UNCLEN + 1 + LM20_NNLEN; +pub const SNLEN: usize = 80; +pub const LM20_SNLEN: DWORD = 15; +pub const STXTLEN: DWORD = 256; +pub const LM20_STXTLEN: DWORD = 63; +pub const PATHLEN: DWORD = 256; +pub const LM20_PATHLEN: DWORD = 256; +pub const DEVLEN: DWORD = 80; +pub const LM20_DEVLEN: DWORD = 8; +pub const EVLEN: usize = 16; +pub const UNLEN: DWORD = 256; +pub const LM20_UNLEN: DWORD = 20; +pub const GNLEN: DWORD = UNLEN; +pub const LM20_GNLEN: DWORD = LM20_UNLEN; +pub const PWLEN: DWORD = 256; +pub const LM20_PWLEN: DWORD = 14; +pub const SHPWLEN: DWORD = 8; +pub const CLTYPE_LEN: DWORD = 12; +pub const MAXCOMMENTSZ: DWORD = 256; +pub const LM20_MAXCOMMENTSZ: DWORD = 48; +pub const QNLEN: DWORD = NNLEN; +pub const LM20_QNLEN: DWORD = LM20_NNLEN; +pub const ALERTSZ: DWORD = 128; +pub const MAXDEVENTRIES: DWORD = 4 * 8; // FIXME: sizeof(int) instead of 4 +pub const NETBIOS_NAME_LEN: DWORD = 16; +pub const MAX_PREFERRED_LENGTH: DWORD = -1i32 as u32; +pub const CRYPT_KEY_LEN: DWORD = 7; +pub const CRYPT_TXT_LEN: DWORD = 8; +pub const ENCRYPTED_PWLEN: usize = 16; +pub const SESSION_PWLEN: DWORD = 24; +pub const SESSION_CRYPT_KLEN: DWORD = 21; +pub const PARM_ERROR_UNKNOWN: DWORD = -1i32 as u32; +pub const PARM_ERROR_NONE: DWORD = 0; +pub const PARMNUM_BASE_INFOLEVEL: DWORD = 1000; +pub type LMSTR = LPWSTR; +pub type LMCSTR = LPCWSTR; +pub type NET_API_STATUS = DWORD; +pub type API_RET_TYPE = NET_API_STATUS; +pub const PLATFORM_ID_DOS: DWORD = 300; +pub const PLATFORM_ID_OS2: DWORD = 400; +pub const PLATFORM_ID_NT: DWORD = 500; +pub const PLATFORM_ID_OSF: DWORD = 600; +pub const PLATFORM_ID_VMS: DWORD = 700; diff --git a/src/vendor/winapi/src/shared/minwindef.rs b/src/vendor/winapi/src/shared/minwindef.rs new file mode 100644 index 0000000000..00dad343f9 --- /dev/null +++ b/src/vendor/winapi/src/shared/minwindef.rs @@ -0,0 +1,103 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Basic Windows Type Definitions for minwin partition +use ctypes::{c_char, c_float, c_int, c_long, c_uchar, c_uint, c_ulong, c_ushort, c_void}; +use shared::basetsd::{LONG_PTR, UINT_PTR}; +use shared::ntdef::{HANDLE, LONG}; +pub type ULONG = c_ulong; +pub type PULONG = *mut ULONG; +pub type USHORT = c_ushort; +pub type PUSHORT = *mut USHORT; +pub type UCHAR = c_uchar; +pub type PUCHAR = *mut UCHAR; +pub type PSZ = *mut c_char; +pub const MAX_PATH: usize = 260; +pub const FALSE: BOOL = 0; +pub const TRUE: BOOL = 1; +pub type DWORD = c_ulong; +pub type BOOL = c_int; +pub type BYTE = c_uchar; +pub type WORD = c_ushort; +pub type FLOAT = c_float; +pub type PFLOAT = *mut FLOAT; +pub type PBOOL = *mut BOOL; +pub type LPBOOL = *mut BOOL; +pub type PBYTE = *mut BYTE; +pub type LPBYTE = *mut BYTE; +pub type PINT = *mut c_int; +pub type LPINT = *mut c_int; +pub type PWORD = *mut WORD; +pub type LPWORD = *mut WORD; +pub type LPLONG = *mut c_long; +pub type PDWORD = *mut DWORD; +pub type LPDWORD = *mut DWORD; +pub type LPVOID = *mut c_void; +pub type LPCVOID = *const c_void; +pub type INT = c_int; +pub type UINT = c_uint; +pub type PUINT = *mut c_uint; +pub type WPARAM = UINT_PTR; +pub type LPARAM = LONG_PTR; +pub type LRESULT = LONG_PTR; +#[inline] +pub fn MAKEWORD(a: BYTE, b: BYTE) -> WORD { + (a as WORD) | ((b as WORD) << 8) +} +#[inline] +pub fn MAKELONG(a: WORD, b: WORD) -> LONG { + ((a as DWORD) | ((b as DWORD) << 16)) as LONG +} +#[inline] +pub fn LOWORD(l: DWORD) -> WORD { + (l & 0xffff) as WORD +} +#[inline] +pub fn HIWORD(l: DWORD) -> WORD { + ((l >> 16) & 0xffff) as WORD +} +#[inline] +pub fn LOBYTE(l: WORD) -> BYTE { + (l & 0xff) as BYTE +} +#[inline] +pub fn HIBYTE(l: WORD) -> BYTE { + ((l >> 8) & 0xff) as BYTE +} +pub type SPHANDLE = *mut HANDLE; +pub type LPHANDLE = *mut HANDLE; +pub type HGLOBAL = HANDLE; +pub type HLOCAL = HANDLE; +pub type GLOBALHANDLE = HANDLE; +pub type LOCALHANDLE = HANDLE; +pub enum __some_function {} +/// Pointer to a function with unknown type signature. +pub type FARPROC = *mut __some_function; +/// Pointer to a function with unknown type signature. +pub type NEARPROC = *mut __some_function; +/// Pointer to a function with unknown type signature. +pub type PROC = *mut __some_function; +pub type ATOM = WORD; +DECLARE_HANDLE!(HKEY, HKEY__); +pub type PHKEY = *mut HKEY; +DECLARE_HANDLE!(HMETAFILE, HMETAFILE__); +DECLARE_HANDLE!(HINSTANCE, HINSTANCE__); +pub type HMODULE = HINSTANCE; +DECLARE_HANDLE!(HRGN, HRGN__); +DECLARE_HANDLE!(HRSRC, HRSRC__); +DECLARE_HANDLE!(HSPRITE, HSPRITE__); +DECLARE_HANDLE!(HLSURF, HLSURF__); +DECLARE_HANDLE!(HSTR, HSTR__); +DECLARE_HANDLE!(HTASK, HTASK__); +DECLARE_HANDLE!(HWINSTA, HWINSTA__); +DECLARE_HANDLE!(HKL, HKL__); +pub type HFILE = c_int; +STRUCT!{struct FILETIME { + dwLowDateTime: DWORD, + dwHighDateTime: DWORD, +}} +pub type PFILETIME = *mut FILETIME; +pub type LPFILETIME = *mut FILETIME; diff --git a/src/vendor/winapi/src/shared/mmreg.rs b/src/vendor/winapi/src/shared/mmreg.rs new file mode 100644 index 0000000000..9fbd7e3cff --- /dev/null +++ b/src/vendor/winapi/src/shared/mmreg.rs @@ -0,0 +1,310 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, WORD}; +pub const WAVE_FORMAT_UNKNOWN: WORD = 0x0000; +pub const WAVE_FORMAT_PCM: WORD = 0x0001; +pub const WAVE_FORMAT_ADPCM: WORD = 0x0002; +pub const WAVE_FORMAT_IEEE_FLOAT: WORD = 0x0003; +pub const WAVE_FORMAT_VSELP: WORD = 0x0004; +pub const WAVE_FORMAT_IBM_CVSD: WORD = 0x0005; +pub const WAVE_FORMAT_ALAW: WORD = 0x0006; +pub const WAVE_FORMAT_MULAW: WORD = 0x0007; +pub const WAVE_FORMAT_DTS: WORD = 0x0008; +pub const WAVE_FORMAT_DRM: WORD = 0x0009; +pub const WAVE_FORMAT_WMAVOICE9: WORD = 0x000A; +pub const WAVE_FORMAT_WMAVOICE10: WORD = 0x000B; +pub const WAVE_FORMAT_OKI_ADPCM: WORD = 0x0010; +pub const WAVE_FORMAT_DVI_ADPCM: WORD = 0x0011; +pub const WAVE_FORMAT_IMA_ADPCM: WORD = WAVE_FORMAT_DVI_ADPCM; +pub const WAVE_FORMAT_MEDIASPACE_ADPCM: WORD = 0x0012; +pub const WAVE_FORMAT_SIERRA_ADPCM: WORD = 0x0013; +pub const WAVE_FORMAT_G723_ADPCM: WORD = 0x0014; +pub const WAVE_FORMAT_DIGISTD: WORD = 0x0015; +pub const WAVE_FORMAT_DIGIFIX: WORD = 0x0016; +pub const WAVE_FORMAT_DIALOGIC_OKI_ADPCM: WORD = 0x0017; +pub const WAVE_FORMAT_MEDIAVISION_ADPCM: WORD = 0x0018; +pub const WAVE_FORMAT_CU_CODEC: WORD = 0x0019; +pub const WAVE_FORMAT_HP_DYN_VOICE: WORD = 0x001A; +pub const WAVE_FORMAT_YAMAHA_ADPCM: WORD = 0x0020; +pub const WAVE_FORMAT_SONARC: WORD = 0x0021; +pub const WAVE_FORMAT_DSPGROUP_TRUESPEECH: WORD = 0x0022; +pub const WAVE_FORMAT_ECHOSC1: WORD = 0x0023; +pub const WAVE_FORMAT_AUDIOFILE_AF36: WORD = 0x0024; +pub const WAVE_FORMAT_APTX: WORD = 0x0025; +pub const WAVE_FORMAT_AUDIOFILE_AF10: WORD = 0x0026; +pub const WAVE_FORMAT_PROSODY_1612: WORD = 0x0027; +pub const WAVE_FORMAT_LRC: WORD = 0x0028; +pub const WAVE_FORMAT_DOLBY_AC2: WORD = 0x0030; +pub const WAVE_FORMAT_GSM610: WORD = 0x0031; +pub const WAVE_FORMAT_MSNAUDIO: WORD = 0x0032; +pub const WAVE_FORMAT_ANTEX_ADPCME: WORD = 0x0033; +pub const WAVE_FORMAT_CONTROL_RES_VQLPC: WORD = 0x0034; +pub const WAVE_FORMAT_DIGIREAL: WORD = 0x0035; +pub const WAVE_FORMAT_DIGIADPCM: WORD = 0x0036; +pub const WAVE_FORMAT_CONTROL_RES_CR10: WORD = 0x0037; +pub const WAVE_FORMAT_NMS_VBXADPCM: WORD = 0x0038; +pub const WAVE_FORMAT_CS_IMAADPCM: WORD = 0x0039; +pub const WAVE_FORMAT_ECHOSC3: WORD = 0x003A; +pub const WAVE_FORMAT_ROCKWELL_ADPCM: WORD = 0x003B; +pub const WAVE_FORMAT_ROCKWELL_DIGITALK: WORD = 0x003C; +pub const WAVE_FORMAT_XEBEC: WORD = 0x003D; +pub const WAVE_FORMAT_G721_ADPCM: WORD = 0x0040; +pub const WAVE_FORMAT_G728_CELP: WORD = 0x0041; +pub const WAVE_FORMAT_MSG723: WORD = 0x0042; +pub const WAVE_FORMAT_INTEL_G723_1: WORD = 0x0043; +pub const WAVE_FORMAT_INTEL_G729: WORD = 0x0044; +pub const WAVE_FORMAT_SHARP_G726: WORD = 0x0045; +pub const WAVE_FORMAT_MPEG: WORD = 0x0050; +pub const WAVE_FORMAT_RT24: WORD = 0x0052; +pub const WAVE_FORMAT_PAC: WORD = 0x0053; +pub const WAVE_FORMAT_MPEGLAYER3: WORD = 0x0055; +pub const WAVE_FORMAT_LUCENT_G723: WORD = 0x0059; +pub const WAVE_FORMAT_CIRRUS: WORD = 0x0060; +pub const WAVE_FORMAT_ESPCM: WORD = 0x0061; +pub const WAVE_FORMAT_VOXWARE: WORD = 0x0062; +pub const WAVE_FORMAT_CANOPUS_ATRAC: WORD = 0x0063; +pub const WAVE_FORMAT_G726_ADPCM: WORD = 0x0064; +pub const WAVE_FORMAT_G722_ADPCM: WORD = 0x0065; +pub const WAVE_FORMAT_DSAT: WORD = 0x0066; +pub const WAVE_FORMAT_DSAT_DISPLAY: WORD = 0x0067; +pub const WAVE_FORMAT_VOXWARE_BYTE_ALIGNED: WORD = 0x0069; +pub const WAVE_FORMAT_VOXWARE_AC8: WORD = 0x0070; +pub const WAVE_FORMAT_VOXWARE_AC10: WORD = 0x0071; +pub const WAVE_FORMAT_VOXWARE_AC16: WORD = 0x0072; +pub const WAVE_FORMAT_VOXWARE_AC20: WORD = 0x0073; +pub const WAVE_FORMAT_VOXWARE_RT24: WORD = 0x0074; +pub const WAVE_FORMAT_VOXWARE_RT29: WORD = 0x0075; +pub const WAVE_FORMAT_VOXWARE_RT29HW: WORD = 0x0076; +pub const WAVE_FORMAT_VOXWARE_VR12: WORD = 0x0077; +pub const WAVE_FORMAT_VOXWARE_VR18: WORD = 0x0078; +pub const WAVE_FORMAT_VOXWARE_TQ40: WORD = 0x0079; +pub const WAVE_FORMAT_VOXWARE_SC3: WORD = 0x007A; +pub const WAVE_FORMAT_VOXWARE_SC3_1: WORD = 0x007B; +pub const WAVE_FORMAT_SOFTSOUND: WORD = 0x0080; +pub const WAVE_FORMAT_VOXWARE_TQ60: WORD = 0x0081; +pub const WAVE_FORMAT_MSRT24: WORD = 0x0082; +pub const WAVE_FORMAT_G729A: WORD = 0x0083; +pub const WAVE_FORMAT_MVI_MVI2: WORD = 0x0084; +pub const WAVE_FORMAT_DF_G726: WORD = 0x0085; +pub const WAVE_FORMAT_DF_GSM610: WORD = 0x0086; +pub const WAVE_FORMAT_ISIAUDIO: WORD = 0x0088; +pub const WAVE_FORMAT_ONLIVE: WORD = 0x0089; +pub const WAVE_FORMAT_MULTITUDE_FT_SX20: WORD = 0x008A; +pub const WAVE_FORMAT_INFOCOM_ITS_G721_ADPCM: WORD = 0x008B; +pub const WAVE_FORMAT_CONVEDIA_G729: WORD = 0x008C; +pub const WAVE_FORMAT_CONGRUENCY: WORD = 0x008D; +pub const WAVE_FORMAT_SBC24: WORD = 0x0091; +pub const WAVE_FORMAT_DOLBY_AC3_SPDIF: WORD = 0x0092; +pub const WAVE_FORMAT_MEDIASONIC_G723: WORD = 0x0093; +pub const WAVE_FORMAT_PROSODY_8KBPS: WORD = 0x0094; +pub const WAVE_FORMAT_ZYXEL_ADPCM: WORD = 0x0097; +pub const WAVE_FORMAT_PHILIPS_LPCBB: WORD = 0x0098; +pub const WAVE_FORMAT_PACKED: WORD = 0x0099; +pub const WAVE_FORMAT_MALDEN_PHONYTALK: WORD = 0x00A0; +pub const WAVE_FORMAT_RACAL_RECORDER_GSM: WORD = 0x00A1; +pub const WAVE_FORMAT_RACAL_RECORDER_G720_A: WORD = 0x00A2; +pub const WAVE_FORMAT_RACAL_RECORDER_G723_1: WORD = 0x00A3; +pub const WAVE_FORMAT_RACAL_RECORDER_TETRA_ACELP: WORD = 0x00A4; +pub const WAVE_FORMAT_NEC_AAC: WORD = 0x00B0; +pub const WAVE_FORMAT_RAW_AAC1: WORD = 0x00FF; +pub const WAVE_FORMAT_RHETOREX_ADPCM: WORD = 0x0100; +pub const WAVE_FORMAT_IRAT: WORD = 0x0101; +pub const WAVE_FORMAT_VIVO_G723: WORD = 0x0111; +pub const WAVE_FORMAT_VIVO_SIREN: WORD = 0x0112; +pub const WAVE_FORMAT_PHILIPS_CELP: WORD = 0x0120; +pub const WAVE_FORMAT_PHILIPS_GRUNDIG: WORD = 0x0121; +pub const WAVE_FORMAT_DIGITAL_G723: WORD = 0x0123; +pub const WAVE_FORMAT_SANYO_LD_ADPCM: WORD = 0x0125; +pub const WAVE_FORMAT_SIPROLAB_ACEPLNET: WORD = 0x0130; +pub const WAVE_FORMAT_SIPROLAB_ACELP4800: WORD = 0x0131; +pub const WAVE_FORMAT_SIPROLAB_ACELP8V3: WORD = 0x0132; +pub const WAVE_FORMAT_SIPROLAB_G729: WORD = 0x0133; +pub const WAVE_FORMAT_SIPROLAB_G729A: WORD = 0x0134; +pub const WAVE_FORMAT_SIPROLAB_KELVIN: WORD = 0x0135; +pub const WAVE_FORMAT_VOICEAGE_AMR: WORD = 0x0136; +pub const WAVE_FORMAT_G726ADPCM: WORD = 0x0140; +pub const WAVE_FORMAT_DICTAPHONE_CELP68: WORD = 0x0141; +pub const WAVE_FORMAT_DICTAPHONE_CELP54: WORD = 0x0142; +pub const WAVE_FORMAT_QUALCOMM_PUREVOICE: WORD = 0x0150; +pub const WAVE_FORMAT_QUALCOMM_HALFRATE: WORD = 0x0151; +pub const WAVE_FORMAT_TUBGSM: WORD = 0x0155; +pub const WAVE_FORMAT_MSAUDIO1: WORD = 0x0160; +pub const WAVE_FORMAT_WMAUDIO2: WORD = 0x0161; +pub const WAVE_FORMAT_WMAUDIO3: WORD = 0x0162; +pub const WAVE_FORMAT_WMAUDIO_LOSSLESS: WORD = 0x0163; +pub const WAVE_FORMAT_WMASPDIF: WORD = 0x0164; +pub const WAVE_FORMAT_UNISYS_NAP_ADPCM: WORD = 0x0170; +pub const WAVE_FORMAT_UNISYS_NAP_ULAW: WORD = 0x0171; +pub const WAVE_FORMAT_UNISYS_NAP_ALAW: WORD = 0x0172; +pub const WAVE_FORMAT_UNISYS_NAP_16K: WORD = 0x0173; +pub const WAVE_FORMAT_SYCOM_ACM_SYC008: WORD = 0x0174; +pub const WAVE_FORMAT_SYCOM_ACM_SYC701_G726L: WORD = 0x0175; +pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP54: WORD = 0x0176; +pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP68: WORD = 0x0177; +pub const WAVE_FORMAT_KNOWLEDGE_ADVENTURE_ADPCM: WORD = 0x0178; +pub const WAVE_FORMAT_FRAUNHOFER_IIS_MPEG2_AAC: WORD = 0x0180; +pub const WAVE_FORMAT_DTS_DS: WORD = 0x0190; +pub const WAVE_FORMAT_CREATIVE_ADPCM: WORD = 0x0200; +pub const WAVE_FORMAT_CREATIVE_FASTSPEECH8: WORD = 0x0202; +pub const WAVE_FORMAT_CREATIVE_FASTSPEECH10: WORD = 0x0203; +pub const WAVE_FORMAT_UHER_ADPCM: WORD = 0x0210; +pub const WAVE_FORMAT_ULEAD_DV_AUDIO: WORD = 0x0215; +pub const WAVE_FORMAT_ULEAD_DV_AUDIO_1: WORD = 0x0216; +pub const WAVE_FORMAT_QUARTERDECK: WORD = 0x0220; +pub const WAVE_FORMAT_ILINK_VC: WORD = 0x0230; +pub const WAVE_FORMAT_RAW_SPORT: WORD = 0x0240; +pub const WAVE_FORMAT_ESST_AC3: WORD = 0x0241; +pub const WAVE_FORMAT_GENERIC_PASSTHRU: WORD = 0x0249; +pub const WAVE_FORMAT_IPI_HSX: WORD = 0x0250; +pub const WAVE_FORMAT_IPI_RPELP: WORD = 0x0251; +pub const WAVE_FORMAT_CS2: WORD = 0x0260; +pub const WAVE_FORMAT_SONY_SCX: WORD = 0x0270; +pub const WAVE_FORMAT_SONY_SCY: WORD = 0x0271; +pub const WAVE_FORMAT_SONY_ATRAC3: WORD = 0x0272; +pub const WAVE_FORMAT_SONY_SPC: WORD = 0x0273; +pub const WAVE_FORMAT_TELUM_AUDIO: WORD = 0x0280; +pub const WAVE_FORMAT_TELUM_IA_AUDIO: WORD = 0x0281; +pub const WAVE_FORMAT_NORCOM_VOICE_SYSTEMS_ADPCM: WORD = 0x0285; +pub const WAVE_FORMAT_FM_TOWNS_SND: WORD = 0x0300; +pub const WAVE_FORMAT_MICRONAS: WORD = 0x0350; +pub const WAVE_FORMAT_MICRONAS_CELP833: WORD = 0x0351; +pub const WAVE_FORMAT_BTV_DIGITAL: WORD = 0x0400; +pub const WAVE_FORMAT_INTEL_MUSIC_CODER: WORD = 0x0401; +pub const WAVE_FORMAT_INDEO_AUDIO: WORD = 0x0402; +pub const WAVE_FORMAT_QDESIGN_MUSIC: WORD = 0x0450; +pub const WAVE_FORMAT_ON2_VP7_AUDIO: WORD = 0x0500; +pub const WAVE_FORMAT_ON2_VP6_AUDIO: WORD = 0x0501; +pub const WAVE_FORMAT_VME_VMPCM: WORD = 0x0680; +pub const WAVE_FORMAT_TPC: WORD = 0x0681; +pub const WAVE_FORMAT_LIGHTWAVE_LOSSLESS: WORD = 0x08AE; +pub const WAVE_FORMAT_OLIGSM: WORD = 0x1000; +pub const WAVE_FORMAT_OLIADPCM: WORD = 0x1001; +pub const WAVE_FORMAT_OLICELP: WORD = 0x1002; +pub const WAVE_FORMAT_OLISBC: WORD = 0x1003; +pub const WAVE_FORMAT_OLIOPR: WORD = 0x1004; +pub const WAVE_FORMAT_LH_CODEC: WORD = 0x1100; +pub const WAVE_FORMAT_LH_CODEC_CELP: WORD = 0x1101; +pub const WAVE_FORMAT_LH_CODEC_SBC8: WORD = 0x1102; +pub const WAVE_FORMAT_LH_CODEC_SBC12: WORD = 0x1103; +pub const WAVE_FORMAT_LH_CODEC_SBC16: WORD = 0x1104; +pub const WAVE_FORMAT_NORRIS: WORD = 0x1400; +pub const WAVE_FORMAT_ISIAUDIO_2: WORD = 0x1401; +pub const WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS: WORD = 0x1500; +pub const WAVE_FORMAT_MPEG_ADTS_AAC: WORD = 0x1600; +pub const WAVE_FORMAT_MPEG_RAW_AAC: WORD = 0x1601; +pub const WAVE_FORMAT_MPEG_LOAS: WORD = 0x1602; +pub const WAVE_FORMAT_NOKIA_MPEG_ADTS_AAC: WORD = 0x1608; +pub const WAVE_FORMAT_NOKIA_MPEG_RAW_AAC: WORD = 0x1609; +pub const WAVE_FORMAT_VODAFONE_MPEG_ADTS_AAC: WORD = 0x160A; +pub const WAVE_FORMAT_VODAFONE_MPEG_RAW_AAC: WORD = 0x160B; +pub const WAVE_FORMAT_MPEG_HEAAC: WORD = 0x1610; +pub const WAVE_FORMAT_VOXWARE_RT24_SPEECH: WORD = 0x181C; +pub const WAVE_FORMAT_SONICFOUNDRY_LOSSLESS: WORD = 0x1971; +pub const WAVE_FORMAT_INNINGS_TELECOM_ADPCM: WORD = 0x1979; +pub const WAVE_FORMAT_LUCENT_SX8300P: WORD = 0x1C07; +pub const WAVE_FORMAT_LUCENT_SX5363S: WORD = 0x1C0C; +pub const WAVE_FORMAT_CUSEEME: WORD = 0x1F03; +pub const WAVE_FORMAT_NTCSOFT_ALF2CM_ACM: WORD = 0x1FC4; +pub const WAVE_FORMAT_DVM: WORD = 0x2000; +pub const WAVE_FORMAT_DTS2: WORD = 0x2001; +pub const WAVE_FORMAT_MAKEAVIS: WORD = 0x3313; +pub const WAVE_FORMAT_DIVIO_MPEG4_AAC: WORD = 0x4143; +pub const WAVE_FORMAT_NOKIA_ADAPTIVE_MULTIRATE: WORD = 0x4201; +pub const WAVE_FORMAT_DIVIO_G726: WORD = 0x4243; +pub const WAVE_FORMAT_LEAD_SPEECH: WORD = 0x434C; +pub const WAVE_FORMAT_LEAD_VORBIS: WORD = 0x564C; +pub const WAVE_FORMAT_WAVPACK_AUDIO: WORD = 0x5756; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_1: WORD = 0x674F; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_2: WORD = 0x6750; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_3: WORD = 0x6751; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_1_PLUS: WORD = 0x676F; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_2_PLUS: WORD = 0x6770; +pub const WAVE_FORMAT_OGG_VORBIS_MODE_3_PLUS: WORD = 0x6771; +pub const WAVE_FORMAT_3COM_NBX: WORD = 0x7000; +pub const WAVE_FORMAT_FAAD_AAC: WORD = 0x706D; +pub const WAVE_FORMAT_AMR_NB: WORD = 0x7361; +pub const WAVE_FORMAT_AMR_WB: WORD = 0x7362; +pub const WAVE_FORMAT_AMR_WP: WORD = 0x7363; +pub const WAVE_FORMAT_GSM_AMR_CBR: WORD = 0x7A21; +pub const WAVE_FORMAT_GSM_AMR_VBR_SID: WORD = 0x7A22; +pub const WAVE_FORMAT_COMVERSE_INFOSYS_G723_1: WORD = 0xA100; +pub const WAVE_FORMAT_COMVERSE_INFOSYS_AVQSBC: WORD = 0xA101; +pub const WAVE_FORMAT_COMVERSE_INFOSYS_SBC: WORD = 0xA102; +pub const WAVE_FORMAT_SYMBOL_G729_A: WORD = 0xA103; +pub const WAVE_FORMAT_VOICEAGE_AMR_WB: WORD = 0xA104; +pub const WAVE_FORMAT_INGENIENT_G726: WORD = 0xA105; +pub const WAVE_FORMAT_MPEG4_AAC: WORD = 0xA106; +pub const WAVE_FORMAT_ENCORE_G726: WORD = 0xA107; +pub const WAVE_FORMAT_ZOLL_ASAO: WORD = 0xA108; +pub const WAVE_FORMAT_SPEEX_VOICE: WORD = 0xA109; +pub const WAVE_FORMAT_VIANIX_MASC: WORD = 0xA10A; +pub const WAVE_FORMAT_WM9_SPECTRUM_ANALYZER: WORD = 0xA10B; +pub const WAVE_FORMAT_WMF_SPECTRUM_ANAYZER: WORD = 0xA10C; +pub const WAVE_FORMAT_GSM_610: WORD = 0xA10D; +pub const WAVE_FORMAT_GSM_620: WORD = 0xA10E; +pub const WAVE_FORMAT_GSM_660: WORD = 0xA10F; +pub const WAVE_FORMAT_GSM_690: WORD = 0xA110; +pub const WAVE_FORMAT_GSM_ADAPTIVE_MULTIRATE_WB: WORD = 0xA111; +pub const WAVE_FORMAT_POLYCOM_G722: WORD = 0xA112; +pub const WAVE_FORMAT_POLYCOM_G728: WORD = 0xA113; +pub const WAVE_FORMAT_POLYCOM_G729_A: WORD = 0xA114; +pub const WAVE_FORMAT_POLYCOM_SIREN: WORD = 0xA115; +pub const WAVE_FORMAT_GLOBAL_IP_ILBC: WORD = 0xA116; +pub const WAVE_FORMAT_RADIOTIME_TIME_SHIFT_RADIO: WORD = 0xA117; +pub const WAVE_FORMAT_NICE_ACA: WORD = 0xA118; +pub const WAVE_FORMAT_NICE_ADPCM: WORD = 0xA119; +pub const WAVE_FORMAT_VOCORD_G721: WORD = 0xA11A; +pub const WAVE_FORMAT_VOCORD_G726: WORD = 0xA11B; +pub const WAVE_FORMAT_VOCORD_G722_1: WORD = 0xA11C; +pub const WAVE_FORMAT_VOCORD_G728: WORD = 0xA11D; +pub const WAVE_FORMAT_VOCORD_G729: WORD = 0xA11E; +pub const WAVE_FORMAT_VOCORD_G729_A: WORD = 0xA11F; +pub const WAVE_FORMAT_VOCORD_G723_1: WORD = 0xA120; +pub const WAVE_FORMAT_VOCORD_LBC: WORD = 0xA121; +pub const WAVE_FORMAT_NICE_G728: WORD = 0xA122; +pub const WAVE_FORMAT_FRACE_TELECOM_G729: WORD = 0xA123; +pub const WAVE_FORMAT_CODIAN: WORD = 0xA124; +pub const WAVE_FORMAT_FLAC: WORD = 0xF1AC; +pub const WAVE_FORMAT_EXTENSIBLE: WORD = 0xFFFE; +pub const WAVE_FORMAT_DEVELOPMENT: WORD = 0xFFFF; +//2557 +pub const SPEAKER_FRONT_LEFT: DWORD = 0x1; +pub const SPEAKER_FRONT_RIGHT: DWORD = 0x2; +pub const SPEAKER_FRONT_CENTER: DWORD = 0x4; +pub const SPEAKER_LOW_FREQUENCY: DWORD = 0x8; +pub const SPEAKER_BACK_LEFT: DWORD = 0x10; +pub const SPEAKER_BACK_RIGHT: DWORD = 0x20; +pub const SPEAKER_FRONT_LEFT_OF_CENTER: DWORD = 0x40; +pub const SPEAKER_FRONT_RIGHT_OF_CENTER: DWORD = 0x80; +pub const SPEAKER_BACK_CENTER: DWORD = 0x100; +pub const SPEAKER_SIDE_LEFT: DWORD = 0x200; +pub const SPEAKER_SIDE_RIGHT: DWORD = 0x400; +pub const SPEAKER_TOP_CENTER: DWORD = 0x800; +pub const SPEAKER_TOP_FRONT_LEFT: DWORD = 0x1000; +pub const SPEAKER_TOP_FRONT_CENTER: DWORD = 0x2000; +pub const SPEAKER_TOP_FRONT_RIGHT: DWORD = 0x4000; +pub const SPEAKER_TOP_BACK_LEFT: DWORD = 0x8000; +pub const SPEAKER_TOP_BACK_CENTER: DWORD = 0x10000; +pub const SPEAKER_TOP_BACK_RIGHT: DWORD = 0x20000; +pub const SPEAKER_RESERVED: DWORD = 0x7FFC0000; +pub const SPEAKER_ALL: DWORD = 0x80000000; +STRUCT!{#[repr(packed)] struct WAVEFORMATEX { + wFormatTag: WORD, + nChannels: WORD, + nSamplesPerSec: DWORD, + nAvgBytesPerSec: DWORD, + nBlockAlign: WORD, + wBitsPerSample: WORD, + cbSize: WORD, +}} +STRUCT!{#[repr(packed)] struct WAVEFORMATEXTENSIBLE { + Format: WAVEFORMATEX, + Samples: WORD, + dwChannelMask: DWORD, + SubFormat: GUID, +}} diff --git a/src/vendor/winapi/src/shared/mod.rs b/src/vendor/winapi/src/shared/mod.rs new file mode 100644 index 0000000000..748f01ffde --- /dev/null +++ b/src/vendor/winapi/src/shared/mod.rs @@ -0,0 +1,63 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Headers shared between user mode and kernel mode +#[cfg(feature = "basetsd")] pub mod basetsd; +#[cfg(feature = "bcrypt")] pub mod bcrypt; +#[cfg(feature = "bugcodes")] pub mod bugcodes; +#[cfg(feature = "cderr")] pub mod cderr; +#[cfg(feature = "cfg")] pub mod cfg; +#[cfg(feature = "d3d9")] pub mod d3d9; +#[cfg(feature = "d3d9caps")] pub mod d3d9caps; +#[cfg(feature = "d3d9types")] pub mod d3d9types; +#[cfg(feature = "dcomptypes")] pub mod dcomptypes; +#[cfg(feature = "devguid")] pub mod devguid; +#[cfg(feature = "devpkey")] pub mod devpkey; +#[cfg(feature = "devpropdef")] pub mod devpropdef; +#[cfg(feature = "dinputd")] pub mod dinputd; +#[cfg(feature = "dxgi")] pub mod dxgi; +#[cfg(feature = "dxgi1_2")] pub mod dxgi1_2; +#[cfg(feature = "dxgi1_3")] pub mod dxgi1_3; +#[cfg(feature = "dxgi1_4")] pub mod dxgi1_4; +#[cfg(feature = "dxgi1_5")] pub mod dxgi1_5; +#[cfg(feature = "dxgiformat")] pub mod dxgiformat; +#[cfg(feature = "dxgitype")] pub mod dxgitype; +pub mod guiddef; +#[cfg(feature = "hidclass")] pub mod hidclass; +#[cfg(feature = "hidpi")] pub mod hidpi; +#[cfg(feature = "hidsdi")] pub mod hidsdi; +#[cfg(feature = "hidusage")] pub mod hidusage; +#[cfg(feature = "in6addr")] pub mod in6addr; +#[cfg(feature = "inaddr")] pub mod inaddr; +#[cfg(feature = "intsafe")] pub mod intsafe; +#[cfg(feature = "ksmedia")] pub mod ksmedia; +#[cfg(feature = "ktmtypes")] pub mod ktmtypes; +#[cfg(feature = "lmcons")] pub mod lmcons; +#[cfg(feature = "minwindef")] pub mod minwindef; +#[cfg(feature = "mmreg")] pub mod mmreg; +#[cfg(feature = "mstcpip")] pub mod mstcpip; +#[cfg(feature = "ntddscsi")] pub mod ntddscsi; +#[cfg(feature = "ntddser")] pub mod ntddser; +#[cfg(feature = "ntdef")] pub mod ntdef; +#[cfg(feature = "ntstatus")] pub mod ntstatus; +#[cfg(feature = "qos")] pub mod qos; +#[cfg(feature = "rpc")] pub mod rpc; +#[cfg(feature = "rpcdce")] pub mod rpcdce; +#[cfg(feature = "rpcndr")] pub mod rpcndr; +#[cfg(feature = "sspi")] pub mod sspi; +#[cfg(feature = "stralign")] pub mod stralign; +#[cfg(feature = "usb")] pub mod usb; +#[cfg(feature = "usbiodef")] pub mod usbiodef; +#[cfg(feature = "usbspec")] pub mod usbspec; +#[cfg(feature = "windef")] pub mod windef; +#[cfg(feature = "windowsx")] pub mod windowsx; +#[cfg(feature = "winerror")] pub mod winerror; +#[cfg(feature = "winusbio")] pub mod winusbio; +#[cfg(feature = "wnnc")] pub mod wnnc; +#[cfg(feature = "ws2def")] pub mod ws2def; +#[cfg(feature = "ws2ipdef")] pub mod ws2ipdef; +#[cfg(feature = "wtypes")] pub mod wtypes; +#[cfg(feature = "wtypesbase")] pub mod wtypesbase; diff --git a/src/vendor/winapi/src/shared/mstcpip.rs b/src/vendor/winapi/src/shared/mstcpip.rs new file mode 100644 index 0000000000..5bd3c9d61e --- /dev/null +++ b/src/vendor/winapi/src/shared/mstcpip.rs @@ -0,0 +1,496 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! This module contains Microsoft-specific extensions to the core Winsock definitions. +use ctypes::wchar_t; +use shared::basetsd::{UINT32, UINT64, ULONG64}; +use shared::guiddef::GUID; +use shared::in6addr::IN6_ADDR; +use shared::inaddr::IN_ADDR; +use shared::minwindef::{DWORD, PULONG, PUSHORT, UCHAR, ULONG, USHORT}; +use shared::ws2def::{ + INADDR_ANY, INADDR_BROADCAST, INADDR_NONE, IOC_IN, IOC_INOUT, IOC_OUT, IOC_VENDOR, SOCKADDR_IN, + SOCKADDR_STORAGE, +}; +use um::winnt::{BOOLEAN, LONG, LPCWSTR, PCSTR, PCWSTR, PSTR, PWSTR}; +DEFINE_GUID!{SOCKET_DEFAULT2_QM_POLICY, + 0xaec2ef9c, 0x3a4d, 0x4d3e, 0x88, 0x42, 0x23, 0x99, 0x42, 0xe3, 0x9a, 0x47} +DEFINE_GUID!{REAL_TIME_NOTIFICATION_CAPABILITY, + 0x6b59819a, 0x5cae, 0x492d, 0xa9, 0x01, 0x2a, 0x3c, 0x2c, 0x50, 0x16, 0x4f} +DEFINE_GUID!{REAL_TIME_NOTIFICATION_CAPABILITY_EX, + 0x6843da03, 0x154a, 0x4616, 0xa5, 0x08, 0x44, 0x37, 0x12, 0x95, 0xf9, 0x6b} +DEFINE_GUID!{ASSOCIATE_NAMERES_CONTEXT, + 0x59a38b67, 0xd4fe, 0x46e1, 0xba, 0x3c, 0x87, 0xea, 0x74, 0xca, 0x30, 0x49} +ENUM!{enum TCPSTATE { + TCPSTATE_CLOSED, + TCPSTATE_LISTEN, + TCPSTATE_SYN_SENT, + TCPSTATE_SYN_RCVD, + TCPSTATE_ESTABLISHED, + TCPSTATE_FIN_WAIT_1, + TCPSTATE_FIN_WAIT_2, + TCPSTATE_CLOSE_WAIT, + TCPSTATE_CLOSING, + TCPSTATE_LAST_ACK, + TCPSTATE_TIME_WAIT, + TCPSTATE_MAX, +}} +STRUCT!{struct TRANSPORT_SETTING_ID { + Guid: GUID, +}} +pub type PTRANSPORT_SETTING_ID = *mut TRANSPORT_SETTING_ID; +STRUCT!{struct tcp_keepalive { + onoff: ULONG, + keepalivetime: ULONG, + keepaliveinterval: ULONG, +}} +ENUM!{enum CONTROL_CHANNEL_TRIGGER_STATUS { + CONTROL_CHANNEL_TRIGGER_STATUS_INVALID = 0, + CONTROL_CHANNEL_TRIGGER_STATUS_SOFTWARE_SLOT_ALLOCATED = 1, + CONTROL_CHANNEL_TRIGGER_STATUS_HARDWARE_SLOT_ALLOCATED = 2, + CONTROL_CHANNEL_TRIGGER_STATUS_POLICY_ERROR = 3, + CONTROL_CHANNEL_TRIGGER_STATUS_SYSTEM_ERROR = 4, + CONTROL_CHANNEL_TRIGGER_STATUS_TRANSPORT_DISCONNECTED = 5, + CONTROL_CHANNEL_TRIGGER_STATUS_SERVICE_UNAVAILABLE = 6, +}} +pub type PCONTROL_CHANNEL_TRIGGER_STATUS = *mut CONTROL_CHANNEL_TRIGGER_STATUS; +pub const CONTROL_CHANNEL_TRIGGER_STATUS_MAX: u32 = CONTROL_CHANNEL_TRIGGER_STATUS_SYSTEM_ERROR; +STRUCT!{struct REAL_TIME_NOTIFICATION_SETTING_INPUT { + TransportSettingId: TRANSPORT_SETTING_ID, + BrokerEventGuid: GUID, +}} +pub type PREAL_TIME_NOTIFICATION_SETTING_INPUT = *mut REAL_TIME_NOTIFICATION_SETTING_INPUT; +STRUCT!{struct REAL_TIME_NOTIFICATION_SETTING_INPUT_EX { + TransportSettingId: TRANSPORT_SETTING_ID, + BrokerEventGuid: GUID, + Unmark: BOOLEAN, +}} +pub type PREAL_TIME_NOTIFICATION_SETTING_INPUT_EX = *mut REAL_TIME_NOTIFICATION_SETTING_INPUT_EX; +STRUCT!{struct REAL_TIME_NOTIFICATION_SETTING_OUTPUT { + ChannelStatus: CONTROL_CHANNEL_TRIGGER_STATUS, +}} +pub type PREAL_TIME_NOTIFICATION_SETTING_OUTPUT = *mut REAL_TIME_NOTIFICATION_SETTING_OUTPUT; +STRUCT!{struct ASSOCIATE_NAMERES_CONTEXT_INPUT { + TransportSettingId: TRANSPORT_SETTING_ID, + Handle: UINT64, +}} +pub type PASSOCIATE_NAMERES_CONTEXT_INPUT = *mut ASSOCIATE_NAMERES_CONTEXT_INPUT; +macro_rules! _WSAIOR { ($x:expr, $y:expr) => { IOC_OUT | $x | $y } } +macro_rules! _WSAIOW { ($x:expr, $y:expr) => { IOC_IN | $x | $y } } +macro_rules! _WSAIORW { ($x:expr, $y:expr) => { IOC_INOUT | $x | $y } } +pub const SIO_RCVALL: DWORD = _WSAIOW!(IOC_VENDOR,1); +pub const SIO_RCVALL_MCAST: DWORD = _WSAIOW!(IOC_VENDOR,2); +pub const SIO_RCVALL_IGMPMCAST: DWORD = _WSAIOW!(IOC_VENDOR,3); +pub const SIO_KEEPALIVE_VALS: DWORD = _WSAIOW!(IOC_VENDOR,4); +pub const SIO_ABSORB_RTRALERT: DWORD = _WSAIOW!(IOC_VENDOR,5); +pub const SIO_UCAST_IF: DWORD = _WSAIOW!(IOC_VENDOR,6); +pub const SIO_LIMIT_BROADCASTS: DWORD = _WSAIOW!(IOC_VENDOR,7); +pub const SIO_INDEX_BIND: DWORD = _WSAIOW!(IOC_VENDOR,8); +pub const SIO_INDEX_MCASTIF: DWORD = _WSAIOW!(IOC_VENDOR,9); +pub const SIO_INDEX_ADD_MCAST: DWORD = _WSAIOW!(IOC_VENDOR,10); +pub const SIO_INDEX_DEL_MCAST: DWORD = _WSAIOW!(IOC_VENDOR,11); +pub const SIO_RCVALL_MCAST_IF: DWORD = _WSAIOW!(IOC_VENDOR,13); +pub const SIO_RCVALL_IF: DWORD = _WSAIOW!(IOC_VENDOR,14); +pub const SIO_LOOPBACK_FAST_PATH: DWORD = _WSAIOW!(IOC_VENDOR,16); +pub const SIO_TCP_INITIAL_RTO: DWORD = _WSAIOW!(IOC_VENDOR,17); +pub const SIO_APPLY_TRANSPORT_SETTING: DWORD = _WSAIOW!(IOC_VENDOR,19); +pub const SIO_QUERY_TRANSPORT_SETTING: DWORD = _WSAIOW!(IOC_VENDOR,20); +pub const SIO_TCP_SET_ICW: DWORD = _WSAIOW!(IOC_VENDOR,22); +pub const SIO_TCP_SET_ACK_FREQUENCY: DWORD = _WSAIOW!(IOC_VENDOR,23); +pub const SIO_TCP_INFO: DWORD = _WSAIORW!(IOC_VENDOR,39); +ENUM!{enum RCVALL_VALUE { + RCVALL_OFF = 0, + RCVALL_ON = 1, + RCVALL_SOCKETLEVELONLY = 2, + RCVALL_IPLEVEL = 3, +}} +pub type PRCVALL_VALUE = *mut RCVALL_VALUE; +STRUCT!{struct RCVALL_IF { + Mode: RCVALL_VALUE, + Interface: ULONG, +}} +pub type PRCVALL_IF = *mut RCVALL_IF; +pub const TCP_INITIAL_RTO_UNSPECIFIED_RTT: USHORT = -1i16 as u16; +pub const TCP_INITIAL_RTO_UNSPECIFIED_MAX_SYN_RETRANSMISSIONS: UCHAR = -1i8 as u8; +pub const TCP_INITIAL_RTO_DEFAULT_RTT: USHORT = 0; +pub const TCP_INITIAL_RTO_DEFAULT_MAX_SYN_RETRANSMISSIONS: UCHAR = 0; +STRUCT!{struct TCP_INITIAL_RTO_PARAMETERS { + Rtt: USHORT, + MaxSynRetransmissions: UCHAR, +}} +pub type PTCP_INITIAL_RTO_PARAMETERS = *mut TCP_INITIAL_RTO_PARAMETERS; +ENUM!{enum TCP_ICW_LEVEL { + TCP_ICW_LEVEL_DEFAULT = 0, + TCP_ICW_LEVEL_HIGH = 1, + TCP_ICW_LEVEL_VERY_HIGH = 2, + TCP_ICW_LEVEL_AGGRESSIVE = 3, + TCP_ICW_LEVEL_EXPERIMENTAL = 4, + TCP_ICW_LEVEL_COMPAT = 254, + TCP_ICW_LEVEL_MAX = 255, +}} +pub type PTCP_ICW_LEVEL = *mut TCP_ICW_LEVEL; +STRUCT!{struct TCP_ICW_PARAMETERS { + Level: TCP_ICW_LEVEL, +}} +pub type PTCP_ICW_PARAMETERS = *mut TCP_ICW_PARAMETERS; +STRUCT!{struct TCP_ACK_FREQUENCY_PARAMETERS { + TcpDelayedAckFrequency: UCHAR, +}} +pub type PTCP_ACK_FREQUENCY_PARAMETERS = *mut TCP_ACK_FREQUENCY_PARAMETERS; +STRUCT!{struct TCP_INFO_v0 { + State: TCPSTATE, + Mss: ULONG, + ConnectionTimeMs: ULONG64, + TimestampsEnabled: BOOLEAN, + RttUs: ULONG, + MinRttUs: ULONG, + BytesInFlight: ULONG, + Cwnd: ULONG, + SndWnd: ULONG, + RcvWnd: ULONG, + RcvBuf: ULONG, + BytesOut: ULONG64, + BytesIn: ULONG64, + BytesReordered: ULONG, + BytesRetrans: ULONG, + FastRetrans: ULONG, + DupAcksIn: ULONG, + TimeoutEpisodes: ULONG, + SynRetrans: UCHAR, +}} +pub type PTCP_INFO_v0 = *mut TCP_INFO_v0; +pub const SIO_ACQUIRE_PORT_RESERVATION: DWORD = _WSAIOW!(IOC_VENDOR, 100); +pub const SIO_RELEASE_PORT_RESERVATION: DWORD = _WSAIOW!(IOC_VENDOR, 101); +pub const SIO_ASSOCIATE_PORT_RESERVATION: DWORD = _WSAIOW!(IOC_VENDOR, 102); +STRUCT!{struct INET_PORT_RANGE { + StartPort: USHORT, + NumberOfPorts: USHORT, +}} +pub type PINET_PORT_RANGE = *mut INET_PORT_RANGE; +pub type INET_PORT_RESERVATION = INET_PORT_RANGE; +pub type PINET_PORT_RESERVATION = *mut INET_PORT_RANGE; +STRUCT!{struct INET_PORT_RESERVATION_TOKEN { + Token: ULONG64, +}} +pub type PINET_PORT_RESERVATION_TOKEN = *mut INET_PORT_RESERVATION_TOKEN; +STRUCT!{struct INET_PORT_RESERVATION_INSTANCE { + Reservation: INET_PORT_RESERVATION, + Token: INET_PORT_RESERVATION_TOKEN, +}} +pub type PINET_PORT_RESERVATION_INSTANCE = *mut INET_PORT_RESERVATION_INSTANCE; +STRUCT!{struct INET_PORT_RESERVATION_INFORMATION { + OwningPid: ULONG, +}} +pub type PINET_PORT_RESERVATION_INFORMATION = *mut INET_PORT_RESERVATION_INFORMATION; +pub const SIO_SET_SECURITY: DWORD = _WSAIOW!(IOC_VENDOR, 200); +pub const SIO_QUERY_SECURITY: DWORD = _WSAIORW!(IOC_VENDOR, 201); +pub const SIO_SET_PEER_TARGET_NAME: DWORD = _WSAIOW!(IOC_VENDOR, 202); +pub const SIO_DELETE_PEER_TARGET_NAME: DWORD = _WSAIOW!(IOC_VENDOR, 203); +pub const SIO_QUERY_WFP_CONNECTION_REDIRECT_RECORDS: DWORD = _WSAIOW!(IOC_VENDOR, 220); +pub const SIO_QUERY_WFP_CONNECTION_REDIRECT_CONTEXT: DWORD = _WSAIOW!(IOC_VENDOR, 221); +pub const SIO_SET_WFP_CONNECTION_REDIRECT_RECORDS: DWORD = _WSAIOW!(IOC_VENDOR, 222); +pub const SIO_SOCKET_USAGE_NOTIFICATION: DWORD = _WSAIOW!(IOC_VENDOR, 204); +ENUM!{enum SOCKET_USAGE_TYPE { + SYSTEM_CRITICAL_SOCKET = 1, +}} +ENUM!{enum SOCKET_SECURITY_PROTOCOL { + SOCKET_SECURITY_PROTOCOL_DEFAULT, + SOCKET_SECURITY_PROTOCOL_IPSEC, + SOCKET_SECURITY_PROTOCOL_IPSEC2, + SOCKET_SECURITY_PROTOCOL_INVALID, +}} +STRUCT!{struct SOCKET_SECURITY_SETTINGS { + SecurityProtocol: SOCKET_SECURITY_PROTOCOL, + SecurityFlags: ULONG, +}} +pub const SOCKET_SETTINGS_IPSEC_SKIP_FILTER_INSTANTIATION: ULONG = 0x1; +pub const SOCKET_SETTINGS_IPSEC_OPTIONAL_PEER_NAME_VERIFICATION: ULONG = 0x2; +pub const SOCKET_SETTINGS_IPSEC_ALLOW_FIRST_INBOUND_PKT_UNENCRYPTED: ULONG = 0x4; +pub const SOCKET_SETTINGS_IPSEC_PEER_NAME_IS_RAW_FORMAT: ULONG = 0x8; +STRUCT!{struct SOCKET_SECURITY_SETTINGS_IPSEC { + SecurityProtocol: SOCKET_SECURITY_PROTOCOL, + SecurityFlags: ULONG, + IpsecFlags: ULONG, + AuthipMMPolicyKey: GUID, + AuthipQMPolicyKey: GUID, + Reserved: GUID, + Reserved2: UINT64, + UserNameStringLen: ULONG, + DomainNameStringLen: ULONG, + PasswordStringLen: ULONG, + AllStrings: [wchar_t; 0], +}} +STRUCT!{struct SOCKET_PEER_TARGET_NAME { + SecurityProtocol: SOCKET_SECURITY_PROTOCOL, + PeerAddress: SOCKADDR_STORAGE, + PeerTargetNameStringLen: ULONG, + AllStrings: [wchar_t; 0], +}} +STRUCT!{struct SOCKET_SECURITY_QUERY_TEMPLATE { + SecurityProtocol: SOCKET_SECURITY_PROTOCOL, + PeerAddress: SOCKADDR_STORAGE, + PeerTokenAccessMask: ULONG, +}} +pub const SOCKET_QUERY_IPSEC2_ABORT_CONNECTION_ON_FIELD_CHANGE: ULONG = 0x1; +pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_MM_SA_ID: ULONG = 0x1; +pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_QM_SA_ID: ULONG = 0x2; +STRUCT!{struct SOCKET_SECURITY_QUERY_TEMPLATE_IPSEC2 { + SecurityProtocol: SOCKET_SECURITY_PROTOCOL, + PeerAddress: SOCKADDR_STORAGE, + PeerTokenAccessMask: ULONG, + Flags: ULONG, + FieldMask: ULONG, +}} +pub const SOCKET_INFO_CONNECTION_SECURED: ULONG = 0x1; +pub const SOCKET_INFO_CONNECTION_ENCRYPTED: ULONG = 0x2; +pub const SOCKET_INFO_CONNECTION_IMPERSONATED: ULONG = 0x4; +STRUCT!{struct SOCKET_SECURITY_QUERY_INFO { + SecurityProtocol: SOCKET_SECURITY_PROTOCOL, + Flags: ULONG, + PeerApplicationAccessTokenHandle: UINT64, + PeerMachineAccessTokenHandle: UINT64, +}} +STRUCT!{struct SOCKET_SECURITY_QUERY_INFO_IPSEC2 { + SecurityProtocol: SOCKET_SECURITY_PROTOCOL, + Flags: ULONG, + PeerApplicationAccessTokenHandle: UINT64, + PeerMachineAccessTokenHandle: UINT64, + MmSaId: UINT64, + QmSaId: UINT64, + NegotiationWinerr: UINT32, + SaLookupContext: GUID, +}} +pub const SIO_QUERY_WFP_ALE_ENDPOINT_HANDLE: DWORD = _WSAIOR!(IOC_VENDOR, 205); +pub const SIO_QUERY_RSS_SCALABILITY_INFO: DWORD = _WSAIOR!(IOC_VENDOR, 210); +STRUCT!{struct RSS_SCALABILITY_INFO { + RssEnabled: BOOLEAN, +}} +pub type PRSS_SCALABILITY_INFO = *mut RSS_SCALABILITY_INFO; +#[inline] +pub fn IN4_CLASSA(i: LONG) -> bool { + (i & 0x80) == 0 +} +#[inline] +pub fn IN4_CLASSB(i: LONG) -> bool { + (i & 0xc0) == 0x80 +} +#[inline] +pub fn IN4_CLASSC(i: LONG) -> bool { + (i & 0xe0) == 0xc0 +} +#[inline] +pub fn IN4_CLASSD(i: LONG) -> bool { + (i & 0xf0) == 0xe0 +} +#[inline] +pub fn IN4_MULTICAST(i: LONG) -> bool { + IN4_CLASSD(i) +} +pub const IN4ADDR_ANY: ULONG = INADDR_ANY; +pub const IN4ADDR_LOOPBACK: ULONG = 0x0100007f; +pub const IN4ADDR_BROADCAST: ULONG = INADDR_BROADCAST; +pub const IN4ADDR_NONE: ULONG = INADDR_NONE; +pub const IN4ADDR_LOOPBACKPREFIX_LENGTH: usize = 8; +pub const IN4ADDR_LINKLOCALPREFIX_LENGTH: usize = 16; +pub const IN4ADDR_MULTICASTPREFIX_LENGTH: usize = 4; +#[inline] +pub fn IN4_ADDR_EQUAL(a: &IN_ADDR, b: &IN_ADDR) -> bool { + unsafe { *a.S_un.S_addr() == *b.S_un.S_addr() } +} +#[inline] +pub fn IN4_UNALIGNED_ADDR_EQUAL(a: &IN_ADDR, b: &IN_ADDR) -> bool { + unsafe { *a.S_un.S_addr() == *b.S_un.S_addr() } +} +#[inline] +pub fn IN4_IS_ADDR_UNSPECIFIED(a: &IN_ADDR) -> bool { + unsafe { *a.S_un.S_addr() == IN4ADDR_ANY } +} +#[inline] +pub fn IN4_IS_UNALIGNED_ADDR_UNSPECIFIED(a: &IN_ADDR) -> bool { + unsafe { *a.S_un.S_addr() == IN4ADDR_ANY } +} +#[inline] +pub fn IN4_IS_ADDR_LOOPBACK(a: &IN_ADDR) -> bool { + unsafe { a.S_un.S_un_b().s_b1 == 0x7f } +} +#[inline] +pub fn IN4_IS_UNALIGNED_ADDR_LOOPBACK(a: &IN_ADDR) -> bool { + unsafe { a.S_un.S_un_b().s_b1 == 0x7f } +} +#[inline] +pub fn IN4_IS_ADDR_BROADCAST(a: &IN_ADDR) -> bool { + unsafe { *a.S_un.S_addr() == IN4ADDR_BROADCAST } +} +#[inline] +pub fn IN4_IS_UNALIGNED_ADDR_BROADCAST(a: &IN_ADDR) -> bool { + unsafe { *a.S_un.S_addr() == IN4ADDR_BROADCAST } +} +#[inline] +pub fn IN4_IS_ADDR_MULTICAST(a: &IN_ADDR) -> bool { + IN4_MULTICAST(unsafe { *a.S_un.S_addr() as LONG }) +} +#[inline] +pub fn IN4_IS_UNALIGNED_ADDR_MULTICAST(a: &IN_ADDR) -> bool { + IN4_MULTICAST(unsafe { *a.S_un.S_addr() as LONG }) +} +#[inline] +pub fn IN4_IS_ADDR_LINKLOCAL(a: &IN_ADDR) -> bool { + unsafe { (*a.S_un.S_addr() & 0xffff) == 0xfea9 } +} +#[inline] +pub fn IN4_IS_UNALIGNED_ADDR_LINKLOCAL(a: &IN_ADDR) -> bool { + unsafe { (*a.S_un.S_addr() & 0xffff) == 0xfea9 } +} +#[inline] +pub fn IN4_IS_ADDR_SITELOCAL(_: &IN_ADDR) -> bool { + false +} +#[inline] +pub fn IN4_IS_UNALIGNED_ADDR_SITELOCAL(_: &IN_ADDR) -> bool { + false +} +#[inline] +pub fn IN4_IS_ADDR_RFC1918(a: &IN_ADDR) -> bool { + let s_addr = unsafe { *a.S_un.S_addr() }; + ((s_addr & 0x00ff) == 0x0a) || ((s_addr & 0xf0ff) == 0x10ac) || ((s_addr & 0xffff) == 0xa8c0) +} +#[inline] +pub fn IN4_IS_UNALIGNED_ADDR_RFC1918(a: &IN_ADDR) -> bool { + IN4_IS_ADDR_RFC1918(a) +} +#[inline] +pub fn IN4_IS_ADDR_MC_LINKLOCAL(a: &IN_ADDR) -> bool { + unsafe { (*a.S_un.S_addr() & 0xffffff) == 0xe0 } +} +#[inline] +pub fn IN4_IS_ADDR_MC_ADMINLOCAL(a: &IN_ADDR) -> bool { + unsafe { (*a.S_un.S_addr() & 0xffff) == 0xffef } +} +#[inline] +pub fn IN4_IS_ADDR_MC_SITELOCAL(a: &IN_ADDR) -> bool { + let first = unsafe { (*a.S_un.S_addr() & 0xff) == 0xef }; + first && !IN4_IS_ADDR_MC_ADMINLOCAL(a) +} +#[inline] +pub fn IN4ADDR_ISANY(a: &SOCKADDR_IN) -> bool { + IN4_IS_ADDR_UNSPECIFIED(&a.sin_addr) +} +#[inline] +pub fn IN4ADDR_ISLOOPBACK(a: &SOCKADDR_IN) -> bool { + IN4_IS_ADDR_LOOPBACK(&a.sin_addr) +} +extern "system" { + pub fn RtlIpv4AddressToStringA( + Addr: *const IN_ADDR, + S: PSTR, + ) -> PSTR; + pub fn RtlIpv4AddressToStringExA( + Address: *const IN_ADDR, + Port: USHORT, + AddressString: PSTR, + AddressStringLength: PULONG, + ) -> LONG; + pub fn RtlIpv4AddressToStringW( + Addr: *const IN_ADDR, + S: PWSTR, + ) -> PWSTR; + pub fn RtlIpv4AddressToStringExW( + Address: *const IN_ADDR, + Port: USHORT, + AddressString: PWSTR, + AddressStringLength: PULONG, + ) -> LONG; + pub fn RtlIpv4StringToAddressA( + S: PCSTR, + Strict: BOOLEAN, + Terminator: *mut PCSTR, + Addr: *mut IN_ADDR, + ) -> LONG; + pub fn RtlIpv4StringToAddressExA( + AddressString: PCSTR, + Strict: BOOLEAN, + Address: *mut IN_ADDR, + Port: PUSHORT, + ) -> LONG; + pub fn RtlIpv4StringToAddressW( + S: PCWSTR, + Strict: BOOLEAN, + Terminator: *mut LPCWSTR, + Addr: *mut IN_ADDR, + ) -> LONG; + pub fn RtlIpv4StringToAddressExW( + AddressString: PCWSTR, + Strict: BOOLEAN, + Address: *mut IN_ADDR, + Port: PUSHORT, + ) -> LONG; + pub fn RtlIpv6AddressToStringA( + Addr: *const IN6_ADDR, + S: PSTR, + ) -> PSTR; + pub fn RtlIpv6AddressToStringExA( + Address: *const IN6_ADDR, + ScopeId: ULONG, + Port: USHORT, + AddressString: PSTR, + AddressStringLength: PULONG, + ) -> LONG; + pub fn RtlIpv6AddressToStringW( + Addr: *const IN6_ADDR, + S: PWSTR, + ) -> PWSTR; + pub fn RtlIpv6AddressToStringExW( + Address: *const IN6_ADDR, + ScopeId: ULONG, + Port: USHORT, + AddressString: PWSTR, + AddressStringLength: PULONG, + ) -> LONG; + pub fn RtlIpv6StringToAddressA( + S: PCSTR, + Terminator: *mut PCSTR, + Addr: *mut IN6_ADDR, + ) -> LONG; + pub fn RtlIpv6StringToAddressExA( + AddressString: PCSTR, + Address: *mut IN6_ADDR, + ScopeId: PULONG, + Port: PUSHORT, + ) -> LONG; + pub fn RtlIpv6StringToAddressW( + S: PCWSTR, + Terminator: *mut PCWSTR, + Addr: *mut IN6_ADDR, + ) -> LONG; + pub fn RtlIpv6StringToAddressExW( + AddressString: PCWSTR, + Address: *mut IN6_ADDR, + ScopeId: PULONG, + Port: PUSHORT, + ) -> LONG; +} +DECLARE_HANDLE!(DL_EUI48, _DL_EUI48); +pub type PDL_EUI48 = *mut DL_EUI48; +extern "system" { + pub fn RtlEthernetAddressToStringA( + Addr: *const DL_EUI48, + S: PSTR, + ) -> PSTR; + pub fn RtlEthernetAddressToStringW( + Addr: *const DL_EUI48, + S: PWSTR, + ) -> PWSTR; + pub fn RtlEthernetStringToAddressA( + S: PCSTR, + Terminator: *mut PCSTR, + Addr: *mut DL_EUI48, + ) -> LONG; + pub fn RtlEthernetStringToAddressW( + S: PCWSTR, + Terminator: *mut LPCWSTR, + Addr: *mut DL_EUI48, + ) -> LONG; +} diff --git a/src/vendor/winapi/src/shared/ntddscsi.rs b/src/vendor/winapi/src/shared/ntddscsi.rs new file mode 100644 index 0000000000..cfe2e0385b --- /dev/null +++ b/src/vendor/winapi/src/shared/ntddscsi.rs @@ -0,0 +1,823 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Constants and types for accessing SCSI port adapters. +use shared::basetsd::{ULONG32, ULONG_PTR}; +use shared::minwindef::{UCHAR, ULONG, USHORT}; +use shared::ntdef::{LARGE_INTEGER, LONG, LONGLONG, PVOID, ULONGLONG, VOID, WCHAR}; +use um::winioctl::{ + DEVICE_TYPE, FILE_ANY_ACCESS, FILE_DEVICE_CONTROLLER, FILE_READ_ACCESS, + FILE_WRITE_ACCESS, METHOD_BUFFERED +}; +use um::winnt::{ANYSIZE_ARRAY, BOOLEAN, PBOOLEAN}; +DEFINE_GUID!(ScsiRawInterfaceGuid, + 0x53f56309, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); +DEFINE_GUID!(WmiScsiAddressGuid, + 0x53f5630f, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); +pub const IOCTL_SCSI_BASE: DEVICE_TYPE = FILE_DEVICE_CONTROLLER; +pub const FILE_DEVICE_SCSI: ULONG = 0x0000001; +pub const DD_SCSI_DEVICE_NAME: &'static str = "\\Device\\ScsiPort"; +pub const IOCTL_SCSI_PASS_THROUGH: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SCSI_MINIPORT: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SCSI_GET_INQUIRY_DATA: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SCSI_GET_CAPABILITIES: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SCSI_PASS_THROUGH_DIRECT: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SCSI_GET_ADDRESS: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SCSI_RESCAN_BUS: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0407, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SCSI_GET_DUMP_POINTERS: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0408, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SCSI_FREE_DUMP_POINTERS: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0409, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_IDE_PASS_THROUGH: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x040a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_ATA_PASS_THROUGH: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x040b, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_ATA_PASS_THROUGH_DIRECT: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x040c, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_ATA_MINIPORT: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x040d, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_MINIPORT_PROCESS_SERVICE_IRP: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x040e, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_MPIO_PASS_THROUGH_PATH: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x040f, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_MPIO_PASS_THROUGH_PATH_DIRECT: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0410, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SCSI_PASS_THROUGH_EX: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0411, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SCSI_PASS_THROUGH_DIRECT_EX: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0412, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_MPIO_PASS_THROUGH_PATH_EX: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0413, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_MPIO_PASS_THROUGH_PATH_DIRECT_EX: ULONG = + CTL_CODE!(IOCTL_SCSI_BASE, 0x0414, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SCSI_MINIPORT_NVCACHE: ULONG = ((FILE_DEVICE_SCSI << 16) + 0x0600); +pub const IOCTL_SCSI_MINIPORT_HYBRID: ULONG = ((FILE_DEVICE_SCSI << 16) + 0x0620); +pub const IOCTL_SCSI_MINIPORT_FIRMWARE: ULONG = ((FILE_DEVICE_SCSI << 16) + 0x0780); +STRUCT!{struct SCSI_PASS_THROUGH { + Length: USHORT, + ScsiStatus: UCHAR, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + CdbLength: UCHAR, + SenseInfoLength: UCHAR, + DataIn: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + DataBufferOffset: ULONG_PTR, + SenseInfoOffset: ULONG, + Cdb: [UCHAR; 16], +}} +pub type PSCSI_PASS_THROUGH = *mut SCSI_PASS_THROUGH; +STRUCT!{struct SCSI_PASS_THROUGH_DIRECT { + Length: USHORT, + ScsiStatus: UCHAR, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + CdbLength: UCHAR, + SenseInfoLength: UCHAR, + DataIn: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + DataBuffer: PVOID, + SenseInfoOffset: ULONG, + Cdb: [UCHAR; 16], +}} +pub type PSCSI_PASS_THROUGH_DIRECT = *mut SCSI_PASS_THROUGH_DIRECT; +STRUCT!{struct SCSI_PASS_THROUGH32 { + Length: USHORT, + ScsiStatus: UCHAR, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + CdbLength: UCHAR, + SenseInfoLength: UCHAR, + DataIn: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + DataBufferOffset: ULONG32, + SenseInfoOffset: ULONG, + Cdb: [UCHAR; 16], +}} +pub type PSCSI_PASS_THROUGH32 = *mut SCSI_PASS_THROUGH32; +STRUCT!{struct SCSI_PASS_THROUGH_DIRECT32 { + Length: USHORT, + ScsiStatus: UCHAR, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + CdbLength: UCHAR, + SenseInfoLength: UCHAR, + DataIn: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + DataBuffer: ULONG32, // Rust doesn't have anything like __ptr32 + SenseInfoOffset: ULONG, + Cdb: [UCHAR; 16], +}} +pub type PSCSI_PASS_THROUGH_DIRECT32 = *mut SCSI_PASS_THROUGH_DIRECT32; +STRUCT!{struct SCSI_PASS_THROUGH_EX { + Version: ULONG, + Length: ULONG, + CdbLength: ULONG, + StorAddressLength: ULONG, + ScsiStatus: UCHAR, + SenseInfolength: UCHAR, + DataDirection: UCHAR, + Reserved: UCHAR, + TimeOutValue: ULONG, + StorAddressOffset: ULONG, + SenseInfoOffset: ULONG, + DataOutTransferLength: ULONG, + DataInTransferLength: ULONG, + DataOutBufferOffset: ULONG_PTR, + DataInBufferOffset: ULONG_PTR, + Cdb: [UCHAR; ANYSIZE_ARRAY], +}} +pub type PSCSI_PASS_THROUGH_EX = *mut SCSI_PASS_THROUGH_EX; +STRUCT!{struct SCSI_PASS_THROUGH_DIRECT_EX { + Version: ULONG, + Length: ULONG, + CdbLength: ULONG, + StorAddressLength: ULONG, + ScsiStatus: UCHAR, + SenseInfolength: UCHAR, + DataDirection: UCHAR, + Reserved: UCHAR, + TimeOutValue: ULONG, + StorAddressOffset: ULONG, + SenseInfoOffset: ULONG, + DataOutTransferLength: ULONG, + DataInTransferLength: ULONG, + DataOutBuffer: *mut VOID, + DataInBuffer: *mut VOID, + Cdb: [UCHAR; ANYSIZE_ARRAY], +}} +pub type PSCSI_PASS_THROUGH_DIRECT_EX = *mut SCSI_PASS_THROUGH_DIRECT_EX; +STRUCT!{struct SCSI_PASS_THROUGH32_EX { + Version: ULONG, + Length: ULONG, + CdbLength: ULONG, + StorAddressLength: ULONG, + ScsiStatus: UCHAR, + SenseInfolength: UCHAR, + DataDirection: UCHAR, + Reserved: UCHAR, + TimeOutValue: ULONG, + StorAddressOffset: ULONG, + SenseInfoOffset: ULONG, + DataOutTransferLength: ULONG, + DataInTransferLength: ULONG, + DataOutBufferOffset: ULONG32, + DataInBufferOffset: ULONG32, + Cdb: [UCHAR; ANYSIZE_ARRAY], +}} +pub type PSCSI_PASS_THROUGH32_EX = *mut SCSI_PASS_THROUGH32_EX; +STRUCT!{struct SCSI_PASS_THROUGH_DIRECT32_EX { + Version: ULONG, + Length: ULONG, + CdbLength: ULONG, + StorAddressLength: ULONG, + ScsiStatus: UCHAR, + SenseInfolength: UCHAR, + DataDirection: UCHAR, + Reserved: UCHAR, + TimeOutValue: ULONG, + StorAddressOffset: ULONG, + SenseInfoOffset: ULONG, + DataOutTransferLength: ULONG, + DataInTransferLength: ULONG, + DataOutBuffer: ULONG32, + DataInBuffer: ULONG32, + Cdb: [UCHAR; ANYSIZE_ARRAY], +}} +pub type PSCSI_PASS_THROUGH_DIRECT32_EX = *mut SCSI_PASS_THROUGH_DIRECT32_EX; +STRUCT!{struct ATA_PASS_THROUGH_EX { + Length: USHORT, + AtaFlags: USHORT, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + ReservedAsUchar: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + ReservedAsUlong: ULONG, + DataBufferOffset: ULONG_PTR, + PreviousTaskFile: [UCHAR; 8], + CurrentTaskFile: [UCHAR; 8], +}} +pub type PATA_PASS_THROUGH_EX = *mut ATA_PASS_THROUGH_EX; +STRUCT!{struct ATA_PASS_THROUGH_DIRECT { + Length: USHORT, + AtaFlags: USHORT, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + ReservedAsUchar: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + ReservedAsUlong: ULONG, + DataBuffer: PVOID, + PreviousTaskFile: [UCHAR; 8], + CurrentTaskFile: [UCHAR; 8], +}} +pub type PATA_PASS_THROUGH_DIRECT = *mut ATA_PASS_THROUGH_DIRECT; +STRUCT!{struct ATA_PASS_THROUGH_EX32 { + Length: USHORT, + AtaFlags: USHORT, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + ReservedAsUchar: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + ReservedAsUlong: ULONG, + DataBufferOffset: ULONG32, + PreviousTaskFile: [UCHAR; 8], + CurrentTaskFile: [UCHAR; 8], +}} +pub type PATA_PASS_THROUGH_EX32 = *mut ATA_PASS_THROUGH_EX32; +STRUCT!{struct ATA_PASS_THROUGH_DIRECT32 { + Length: USHORT, + AtaFlags: USHORT, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + ReservedAsUchar: UCHAR, + DataTransferLength: ULONG, + TimeOutValue: ULONG, + ReservedAsUlong: ULONG, + DataBuffer: ULONG32, + PreviousTaskFile: [UCHAR; 8], + CurrentTaskFile: [UCHAR; 8], +}} +pub type PATA_PASS_THROUGH_DIRECT32 = *mut ATA_PASS_THROUGH_DIRECT32; +pub const ATA_FLAGS_DRDY_REQUIRED: USHORT = 1 << 0; +pub const ATA_FLAGS_DATA_IN: USHORT = 1 << 1; +pub const ATA_FLAGS_DATA_OUT: USHORT = 1 << 2; +pub const ATA_FLAGS_48BIT_COMMAND: USHORT = 1 << 3; +pub const ATA_FLAGS_USE_DMA: USHORT = 1 << 4; +pub const ATA_FLAGS_NO_MULTIPLE: USHORT = 1 << 5; +STRUCT!{struct IDE_IO_CONTROL { + HeaderLength: ULONG, + Signature: [UCHAR; 8], + Timeout: ULONG, + ControlCode: ULONG, + ReturnStatus: ULONG, + DataLength: ULONG, +}} +pub type PIDE_IO_CONTROL = *mut IDE_IO_CONTROL; +STRUCT!{struct MPIO_PASS_THROUGH_PATH { + PassThrough: SCSI_PASS_THROUGH, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH = *mut MPIO_PASS_THROUGH_PATH; +STRUCT!{struct MPIO_PASS_THROUGH_PATH_DIRECT { + PassThrough: SCSI_PASS_THROUGH_DIRECT, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH_DIRECT = *mut MPIO_PASS_THROUGH_PATH_DIRECT; +STRUCT!{struct MPIO_PASS_THROUGH_PATH_EX { + PassThroughOffset: ULONG, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH_EX = *mut MPIO_PASS_THROUGH_PATH_EX; +STRUCT!{struct MPIO_PASS_THROUGH_PATH_DIRECT_EX { + PassThroughOffset: ULONG, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH_DIRECT_EX = *mut MPIO_PASS_THROUGH_PATH_DIRECT_EX; +STRUCT!{struct MPIO_PASS_THROUGH_PATH32 { + PassThrough: SCSI_PASS_THROUGH32, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH32 = *mut MPIO_PASS_THROUGH_PATH32; +STRUCT!{struct MPIO_PASS_THROUGH_PATH_DIRECT32 { + PassThrough: SCSI_PASS_THROUGH_DIRECT32, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH_DIRECT32 = *mut MPIO_PASS_THROUGH_PATH_DIRECT32; +STRUCT!{struct MPIO_PASS_THROUGH_PATH32_EX { + PassThroughOffset: ULONG, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH32_EX = *mut MPIO_PASS_THROUGH_PATH32_EX; +STRUCT!{struct MPIO_PASS_THROUGH_PATH_DIRECT32_EX { + PassThroughOffset: ULONG, + Version: ULONG, + Length: USHORT, + Flags: UCHAR, + PortNumber: UCHAR, + MpioPathId: ULONGLONG, +}} +pub type PMPIO_PASS_THROUGH_PATH_DIRECT32_EX = *mut MPIO_PASS_THROUGH_PATH_DIRECT32_EX; +STRUCT!{struct SCSI_BUS_DATA { + NumberOfLogicalUnits: UCHAR, + InitiatorBusId: UCHAR, + InquiryDataOffset: ULONG, +}} +pub type PSCSI_BUS_DATA = *mut SCSI_BUS_DATA; +STRUCT!{struct SCSI_ADAPTER_BUS_INFO { + NumberOfBuses: UCHAR, + BusData: [SCSI_BUS_DATA; 1], +}} +pub type PSCSI_ADAPTER_BUS_INFO = *mut SCSI_ADAPTER_BUS_INFO; +STRUCT!{struct SCSI_INQUIRY_DATA { + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, + DeviceClaimed: BOOLEAN, + InquiryDataLength: ULONG, + NextInquiryDataOffset: ULONG, + InquiryData: [UCHAR; 1], +}} +pub type PSCSI_INQUIRY_DATA = *mut SCSI_INQUIRY_DATA; +pub const IOCTL_MINIPORT_SIGNATURE_SCSIDISK: &'static str = "SCSIDISK"; +pub const IOCTL_MINIPORT_SIGNATURE_HYBRDISK: &'static str = "HYBRDISK"; +pub const IOCTL_MINIPORT_SIGNATURE_DSM_NOTIFICATION: &'static str = "MPDSM "; +pub const IOCTL_MINIPORT_SIGNATURE_DSM_GENERAL: &'static str = "MPDSMGEN"; +pub const IOCTL_MINIPORT_SIGNATURE_FIRMWARE: &'static str = "FIRMWARE"; +pub const IOCTL_MINIPORT_SIGNATURE_QUERY_PROTOCOL: &'static str = "PROTOCOL"; +pub const IOCTL_MINIPORT_SIGNATURE_QUERY_TEMPERATURE: &'static str = "TEMPERAT"; +pub const IOCTL_MINIPORT_SIGNATURE_SET_TEMPERATURE_THRESHOLD: &'static str = "SETTEMPT"; +pub const IOCTL_MINIPORT_SIGNATURE_QUERY_PHYSICAL_TOPOLOGY: &'static str = "TOPOLOGY"; +STRUCT!{struct SRB_IO_CONTROL { + HeaderLength: ULONG, + Signature: [UCHAR; 8], + Timeout: ULONG, + ControlCode: ULONG, + ReturnCode: ULONG, + Length: ULONG, +}} +pub type PSRB_IO_CONTROL = *mut SRB_IO_CONTROL; +STRUCT!{struct NVCACHE_REQUEST_BLOCK { + NRBSize: ULONG, + Function: USHORT, + NRBFlags: ULONG, + NRBStatus: ULONG, + Count: ULONG, + LBA: ULONGLONG, + DataBufSize: ULONG, + NVCacheStatus: ULONG, + NVCacheSubStatus: ULONG, +}} +pub type PNVCACHE_REQUEST_BLOCK = *mut NVCACHE_REQUEST_BLOCK; +pub const NRB_FUNCTION_NVCACHE_INFO: USHORT = 0xEC; +pub const NRB_FUNCTION_SPINDLE_STATUS: USHORT = 0xE5; +pub const NRB_FUNCTION_NVCACHE_POWER_MODE_SET: USHORT = 0x00; +pub const NRB_FUNCTION_NVCACHE_POWER_MODE_RETURN: USHORT = 0x01; +pub const NRB_FUNCTION_FLUSH_NVCACHE: USHORT = 0x14; +pub const NRB_FUNCTION_QUERY_PINNED_SET: USHORT = 0x12; +pub const NRB_FUNCTION_QUERY_CACHE_MISS: USHORT = 0x13; +pub const NRB_FUNCTION_ADD_LBAS_PINNED_SET: USHORT = 0x10; +pub const NRB_FUNCTION_REMOVE_LBAS_PINNED_SET: USHORT = 0x11; +pub const NRB_FUNCTION_QUERY_ASCENDER_STATUS: USHORT = 0xD0; +pub const NRB_FUNCTION_QUERY_HYBRID_DISK_STATUS: USHORT = 0xD1; +pub const NRB_FUNCTION_PASS_HINT_PAYLOAD: USHORT = 0xE0; +pub const NRB_FUNCTION_NVSEPARATED_INFO: USHORT = 0xc0; +pub const NRB_FUNCTION_NVSEPARATED_FLUSH: USHORT = 0xc1; +pub const NRB_FUNCTION_NVSEPARATED_WB_DISABLE: USHORT = 0xc2; +pub const NRB_FUNCTION_NVSEPARATED_WB_REVERT_DEFAULT: USHORT = 0xc3; +pub const NRB_SUCCESS: ULONG = 0; +pub const NRB_ILLEGAL_REQUEST: ULONG = 1; +pub const NRB_INVALID_PARAMETER: ULONG = 2; +pub const NRB_INPUT_DATA_OVERRUN: ULONG = 3; +pub const NRB_INPUT_DATA_UNDERRUN: ULONG = 4; +pub const NRB_OUTPUT_DATA_OVERRUN: ULONG = 5; +pub const NRB_OUTPUT_DATA_UNDERRUN: ULONG = 6; +STRUCT!{struct NV_FEATURE_PARAMETER { + NVPowerModeEnabled: USHORT, + NVParameterReserv1: USHORT, + NVCmdEnabled: USHORT, + NVParameterReserv2: USHORT, + NVPowerModeVer: USHORT, + NVCmdVer: USHORT, + NVSize: ULONG, + NVReadSpeed: USHORT, + NVWrtSpeed: USHORT, + DeviceSpinUpTime: ULONG, +}} +pub type PNV_FEATURE_PARAMETER = *mut NV_FEATURE_PARAMETER; +STRUCT!{struct NVCACHE_HINT_PAYLOAD { + Command: UCHAR, + Feature7_0: UCHAR, + Feature15_8: UCHAR, + Count15_8: UCHAR, + LBA7_0: UCHAR, + LBA15_8: UCHAR, + LBA23_16: UCHAR, + LBA31_24: UCHAR, + LBA39_32: UCHAR, + LBA47_40: UCHAR, + Auxiliary7_0: UCHAR, + Auxiliary23_16: UCHAR, + Reserved: [UCHAR; 4], +}} +pub type PNVCACHE_HINT_PAYLOAD = *mut NVCACHE_HINT_PAYLOAD; +STRUCT!{struct NV_SEP_CACHE_PARAMETER { + Version: ULONG, + Size: ULONG, + Flags: NV_SEP_CACHE_PARAMETER_Flags, + WriteCacheType: UCHAR, + WriteCacheTypeEffective: UCHAR, + ParameterReserve1: [UCHAR; 3], +}} +pub type PNV_SEP_CACHE_PARAMETER = *mut NV_SEP_CACHE_PARAMETER; +UNION!{union NV_SEP_CACHE_PARAMETER_Flags { + [u8; 1], + CacheFlags CacheFlags_mut: NV_SEP_CACHE_PARAMETER_Flags_CacheFlags, + CacheFlagsSet CacheFlagsSet_mut: UCHAR, +}} +STRUCT!{struct NV_SEP_CACHE_PARAMETER_Flags_CacheFlags { + Bitfield: UCHAR, +}} +BITFIELD!(NV_SEP_CACHE_PARAMETER_Flags_CacheFlags Bitfield: UCHAR [ + WriteCacheEnabled set_WriteCacheEnabled[0..1], + WriteCacheChangeable set_WriteCacheChangeable[1..2], + WriteThroughIOSupported set_WriteThroughIOSupported[2..3], + FlushCacheSupported set_FlushCacheSupported[3..4], + ReservedBits set_ReservedBits[4..8], +]); +pub const NV_SEP_CACHE_PARAMETER_VERSION_1: ULONG = 1; +pub const NV_SEP_CACHE_PARAMETER_VERSION: ULONG = NV_SEP_CACHE_PARAMETER_VERSION_1; +ENUM!{enum NV_SEP_WRITE_CACHE_TYPE { + NVSEPWriteCacheTypeUnknown = 0, + NVSEPWriteCacheTypeNone = 1, + NVSEPWriteCacheTypeWriteBack = 2, + NVSEPWriteCacheTypeWriteThrough = 3, +}} +pub type PNV_SEP_WRITE_CACHE_TYPE = *mut NV_SEP_WRITE_CACHE_TYPE; +STRUCT!{struct MP_DEVICE_DATA_SET_RANGE { + StartingOffset: LONGLONG, + LengthInBytes: ULONGLONG, +}} +pub type PMP_DEVICE_DATA_SET_RANGE = *mut MP_DEVICE_DATA_SET_RANGE; +STRUCT!{struct DSM_NOTIFICATION_REQUEST_BLOCK { + Size: ULONG, + Version: ULONG, + NotifyFlags: ULONG, + DataSetProfile: ULONG, + Reserved: [ULONG; 3], + DataSetRangesCount: ULONG, + DataSetRanges: [MP_DEVICE_DATA_SET_RANGE; ANYSIZE_ARRAY], +}} +pub type PDSM_NOTIFICATION_REQUEST_BLOCK = *mut DSM_NOTIFICATION_REQUEST_BLOCK; +pub const MINIPORT_DSM_NOTIFICATION_VERSION_1: ULONG = 1; +pub const MINIPORT_DSM_NOTIFICATION_VERSION: ULONG = MINIPORT_DSM_NOTIFICATION_VERSION_1; +pub const MINIPORT_DSM_PROFILE_UNKNOWN: ULONG = 0; +pub const MINIPORT_DSM_PROFILE_PAGE_FILE: ULONG = 1; +pub const MINIPORT_DSM_PROFILE_HIBERNATION_FILE: ULONG = 2; +pub const MINIPORT_DSM_PROFILE_CRASHDUMP_FILE: ULONG = 3; +pub const MINIPORT_DSM_NOTIFY_FLAG_BEGIN: ULONG = 0x00000001; +pub const MINIPORT_DSM_NOTIFY_FLAG_END: ULONG = 0x00000002; +pub const HYBRID_FUNCTION_GET_INFO: ULONG = 0x01; +pub const HYBRID_FUNCTION_DISABLE_CACHING_MEDIUM: ULONG = 0x10; +pub const HYBRID_FUNCTION_ENABLE_CACHING_MEDIUM: ULONG = 0x11; +pub const HYBRID_FUNCTION_SET_DIRTY_THRESHOLD: ULONG = 0x12; +pub const HYBRID_FUNCTION_DEMOTE_BY_SIZE: ULONG = 0x13; +pub const HYBRID_STATUS_SUCCESS: ULONG = 0x0; +pub const HYBRID_STATUS_ILLEGAL_REQUEST: ULONG = 0x1; +pub const HYBRID_STATUS_INVALID_PARAMETER: ULONG = 0x2; +pub const HYBRID_STATUS_OUTPUT_BUFFER_TOO_SMALL: ULONG = 0x3; +pub const HYBRID_STATUS_ENABLE_REFCOUNT_HOLD: ULONG = 0x10; +pub const HYBRID_REQUEST_BLOCK_STRUCTURE_VERSION: ULONG = 0x1; +STRUCT!{struct HYBRID_REQUEST_BLOCK { + Version: ULONG, + Size: ULONG, + Function: ULONG, + Flags: ULONG, + DataBufferOffset: ULONG, + DataBufferLength: ULONG, +}} +pub type PHYBRID_REQUEST_BLOCK = *mut HYBRID_REQUEST_BLOCK; +ENUM!{enum NVCACHE_TYPE { + NvCacheTypeUnknown = 0, + NvCacheTypeNone = 1, + NvCacheTypeWriteBack = 2, + NvCacheTypeWriteThrough = 3, +}} +ENUM!{enum NVCACHE_STATUS { + NvCacheStatusUnknown = 0, + NvCacheStatusDisabling = 1, + NvCacheStatusDisabled = 2, + NvCacheStatusEnabled = 3, +}} +STRUCT!{struct NVCACHE_PRIORITY_LEVEL_DESCRIPTOR { + PriorityLevel: UCHAR, + Reserved0: [UCHAR; 3], + ConsumedNVMSizeFraction: ULONG, + ConsumedMappingResourcesFraction: ULONG, + ConsumedNVMSizeForDirtyDataFraction: ULONG, + ConsumedMappingResourcesForDirtyDataFraction: ULONG, + Reserved1: ULONG, +}} +pub type PNVCACHE_PRIORITY_LEVEL_DESCRIPTOR = *mut NVCACHE_PRIORITY_LEVEL_DESCRIPTOR; +pub const HYBRID_REQUEST_INFO_STRUCTURE_VERSION: ULONG = 1; +STRUCT!{struct HYBRID_INFORMATION { + Version: ULONG, + Size: ULONG, + HybridSupported: BOOLEAN, + Status: NVCACHE_STATUS, + CacheTypeEffective: NVCACHE_TYPE, + CacheTypeDefault: NVCACHE_TYPE, + FractionBase: ULONG, + CacheSize: ULONGLONG, + Attributes: HYBRID_INFORMATION_Attributes, + Priorities: HYBRID_INFORMATION_Priorities, +}} +pub type PHYBRID_INFORMATION = *mut HYBRID_INFORMATION; +STRUCT!{struct HYBRID_INFORMATION_Attributes { + Bitfield: ULONG, +}} +BITFIELD!(HYBRID_INFORMATION_Attributes Bitfield: ULONG [ + WriteCacheChangeable set_WriteCacheChangeable[0..1], + WriteThroughIoSupported set_WriteThroughIoSupported[1..2], + FlushCacheSupported set_FlushCacheSupported[2..3], + Removable set_Removable[3..4], + ReservedBits set_ReservedBits[4..32], +]); +STRUCT!{struct HYBRID_INFORMATION_Priorities { + PriorityLevelCount: UCHAR, + MaxPriorityBehavior: BOOLEAN, + OptimalWriteGranularity: UCHAR, + Reserved: UCHAR, + DirtyThresholdLow: ULONG, + DirtyThresholdHigh: ULONG, + SupportedCommands: HYBRID_INFORMATION_Priorities_SupportedCommands, + Priority: [NVCACHE_PRIORITY_LEVEL_DESCRIPTOR; 0], +}} +STRUCT!{struct HYBRID_INFORMATION_Priorities_SupportedCommands { + Bitfield: ULONG, + MaxEvictCommands: ULONG, + MaxLbaRangeCountForEvict: ULONG, + MaxLbaRangeCountForChangeLba: ULONG, +}} +BITFIELD!(HYBRID_INFORMATION_Priorities_SupportedCommands Bitfield: ULONG [ + CacheDisable set_CacheDisable[0..1], + SetDirtyThreshold set_SetDirtyThreshold[1..2], + PriorityDemoteBySize set_PriorityDemoteBySize[2..3], + PriorityChangeByLbaRange set_PriorityChangeByLbaRange[3..4], + Evict set_Evict[4..5], + ReservedBits set_ReservedBits[5..32], +]); +STRUCT!{struct HYBRID_DIRTY_THRESHOLDS { + Version: ULONG, + Size: ULONG, + DirtyLowThreshold: ULONG, + DirtyHighThreshold: ULONG, +}} +pub type PHYBRID_DIRTY_THRESHOLDS = *mut HYBRID_DIRTY_THRESHOLDS; +STRUCT!{struct HYBRID_DEMOTE_BY_SIZE { + Version: ULONG, + Size: ULONG, + SourcePriority: UCHAR, + TargetPriority: UCHAR, + Reserved0: USHORT, + Reserved1: ULONG, + LbaCount: ULONGLONG, +}} +pub type PHYBRID_DEMOTE_BY_SIZE = *mut HYBRID_DEMOTE_BY_SIZE; +pub const FIRMWARE_FUNCTION_GET_INFO: ULONG = 0x01; +pub const FIRMWARE_FUNCTION_DOWNLOAD: ULONG = 0x02; +pub const FIRMWARE_FUNCTION_ACTIVATE: ULONG = 0x03; +pub const FIRMWARE_STATUS_SUCCESS: ULONG = 0x0; +pub const FIRMWARE_STATUS_ERROR: ULONG = 0x1; +pub const FIRMWARE_STATUS_ILLEGAL_REQUEST: ULONG = 0x2; +pub const FIRMWARE_STATUS_INVALID_PARAMETER: ULONG = 0x3; +pub const FIRMWARE_STATUS_INPUT_BUFFER_TOO_BIG: ULONG = 0x4; +pub const FIRMWARE_STATUS_OUTPUT_BUFFER_TOO_SMALL: ULONG = 0x5; +pub const FIRMWARE_STATUS_INVALID_SLOT: ULONG = 0x6; +pub const FIRMWARE_STATUS_INVALID_IMAGE: ULONG = 0x7; +pub const FIRMWARE_STATUS_CONTROLLER_ERROR: ULONG = 0x10; +pub const FIRMWARE_STATUS_POWER_CYCLE_REQUIRED: ULONG = 0x20; +pub const FIRMWARE_STATUS_DEVICE_ERROR: ULONG = 0x40; +pub const FIRMWARE_STATUS_INTERFACE_CRC_ERROR: ULONG = 0x80; +pub const FIRMWARE_STATUS_UNCORRECTABLE_DATA_ERROR: ULONG = 0x81; +pub const FIRMWARE_STATUS_MEDIA_CHANGE: ULONG = 0x82; +pub const FIRMWARE_STATUS_ID_NOT_FOUND: ULONG = 0x83; +pub const FIRMWARE_STATUS_MEDIA_CHANGE_REQUEST: ULONG = 0x84; +pub const FIRMWARE_STATUS_COMMAND_ABORT: ULONG = 0x85; +pub const FIRMWARE_STATUS_END_OF_MEDIA: ULONG = 0x86; +pub const FIRMWARE_STATUS_ILLEGAL_LENGTH: ULONG = 0x87; +pub const FIRMWARE_REQUEST_BLOCK_STRUCTURE_VERSION: ULONG = 0x1; +STRUCT!{struct FIRMWARE_REQUEST_BLOCK { + Version: ULONG, + Size: ULONG, + Function: ULONG, + Flags: ULONG, + DataBufferOffset: ULONG, + DataBufferLength: ULONG, +}} +pub type PFIRMWARE_REQUEST_BLOCK = *mut FIRMWARE_REQUEST_BLOCK; +pub const FIRMWARE_REQUEST_FLAG_CONTROLLER: ULONG = 0x00000001; +pub const FIRMWARE_REQUEST_FLAG_LAST_SEGMENT: ULONG = 0x00000002; +pub const FIRMWARE_REQUEST_FLAG_SWITCH_TO_EXISTING_FIRMWARE: ULONG = 0x80000000; +pub const STORAGE_FIRMWARE_INFO_STRUCTURE_VERSION: ULONG = 0x1; +pub const STORAGE_FIRMWARE_INFO_STRUCTURE_VERSION_V2: ULONG = 0x2; +pub const STORAGE_FIRMWARE_INFO_INVALID_SLOT: UCHAR = 0xFF; +STRUCT!{struct STORAGE_FIRMWARE_SLOT_INFO { + SlotNumber: UCHAR, + ReadOnly: BOOLEAN, + Reserved: [UCHAR; 6], + Revision: STORAGE_FIRMWARE_SLOT_INFO_Revision, +}} +pub type PSTORAGE_FIRMWARE_SLOT_INFO = *mut STORAGE_FIRMWARE_SLOT_INFO; +UNION!{union STORAGE_FIRMWARE_SLOT_INFO_Revision { + [u64; 1], + Info Info_mut: [UCHAR; 8], + AsUlonglong AsUlonglong_mut: ULONGLONG, +}} +pub const STORAGE_FIRMWARE_SLOT_INFO_V2_REVISION_LENGTH: usize = 16; +STRUCT!{struct STORAGE_FIRMWARE_SLOT_INFO_V2 { + SlotNumber: UCHAR, + ReadOnly: BOOLEAN, + Reserved: [UCHAR; 6], + Revision: [UCHAR; STORAGE_FIRMWARE_SLOT_INFO_V2_REVISION_LENGTH], +}} +pub type PSTORAGE_FIRMWARE_SLOT_INFO_V2 = *mut STORAGE_FIRMWARE_SLOT_INFO_V2; +STRUCT!{struct STORAGE_FIRMWARE_INFO { + Version: ULONG, + Size: ULONG, + UpgradeSupport: BOOLEAN, + SlotCount: UCHAR, + ActiveSlot: UCHAR, + PendingActivateSlot: UCHAR, + Reserved: ULONG, + Slot: [STORAGE_FIRMWARE_SLOT_INFO; 0], +}} +pub type PSTORAGE_FIRMWARE_INFO = *mut STORAGE_FIRMWARE_INFO; +STRUCT!{struct STORAGE_FIRMWARE_INFO_V2 { + Version: ULONG, + Size: ULONG, + UpgradeSupport: BOOLEAN, + SlotCount: UCHAR, + ActiveSlot: UCHAR, + PendingActivateSlot: UCHAR, + FirmwareShared: BOOLEAN, + Reserved: [UCHAR; 3], + ImagePayloadAlignment: ULONG, + ImagePayloadMaxSize: ULONG, + Slot: [STORAGE_FIRMWARE_SLOT_INFO_V2; 0], +}} +pub type PSTORAGE_FIRMWARE_INFO_V2 = *mut STORAGE_FIRMWARE_INFO_V2; +pub const STORAGE_FIRMWARE_DOWNLOAD_STRUCTURE_VERSION: ULONG = 0x1; +pub const STORAGE_FIRMWARE_DOWNLOAD_STRUCTURE_VERSION_V2: ULONG = 0x2; +STRUCT!{struct STORAGE_FIRMWARE_DOWNLOAD { + Version: ULONG, + Size: ULONG, + Offset: ULONGLONG, + BufferSize: ULONGLONG, + ImageBuffer: [UCHAR; 0], +}} +pub type PSTORAGE_FIRMWARE_DOWNLOAD = *mut STORAGE_FIRMWARE_DOWNLOAD; +STRUCT!{struct STORAGE_FIRMWARE_DOWNLOAD_V2 { + Version: ULONG, + Size: ULONG, + Offset: ULONGLONG, + BufferSize: ULONGLONG, + Slot: UCHAR, + Reserved: [UCHAR; 7], + ImageBuffer: [UCHAR; 0], +}} +pub type PSTORAGE_FIRMWARE_DOWNLOAD_V2 = *mut STORAGE_FIRMWARE_DOWNLOAD_V2; +pub const STORAGE_FIRMWARE_ACTIVATE_STRUCTURE_VERSION: ULONG = 0x1; +STRUCT!{struct STORAGE_FIRMWARE_ACTIVATE { + Version: ULONG, + Size: ULONG, + SlotToActivate: UCHAR, + Reserved0: [UCHAR; 3], +}} +pub type PSTORAGE_FIRMWARE_ACTIVATE = *mut STORAGE_FIRMWARE_ACTIVATE; +STRUCT!{struct IO_SCSI_CAPABILITIES { + Length: ULONG, + MaximumTransferLength: ULONG, + MaximumPhysicalPages: ULONG, + SupportedAsynchronousEvents: ULONG, + AlignmentMask: ULONG, + TaggedQueuing: BOOLEAN, + AdapterScansDown: BOOLEAN, + AdapterUsesPio: BOOLEAN, +}} +pub type PIO_SCSI_CAPABILITIES = *mut IO_SCSI_CAPABILITIES; +STRUCT!{struct SCSI_ADDRESS { + Length: ULONG, + PortNumber: UCHAR, + PathId: UCHAR, + TargetId: UCHAR, + Lun: UCHAR, +}} +pub type PSCSI_ADDRESS = *mut SCSI_ADDRESS; +pub const DUMP_POINTERS_VERSION_1: ULONG = 1; +pub const DUMP_POINTERS_VERSION_2: ULONG = 2; +pub const DUMP_POINTERS_VERSION_3: ULONG = 3; +pub const DUMP_POINTERS_VERSION_4: ULONG = 4; +pub const DUMP_DRIVER_NAME_LENGTH: usize = 15; +FN!{cdecl DUMP_DEVICE_POWERON_ROUTINE( + Context: PVOID, +) -> LONG} +pub type PDUMP_DEVICE_POWERON_ROUTINE = *mut DUMP_DEVICE_POWERON_ROUTINE; +STRUCT!{struct DUMP_POINTERS_VERSION { + Version: ULONG, + Size: ULONG, +}} +pub type PDUMP_POINTERS_VERSION = *mut DUMP_POINTERS_VERSION; +STRUCT!{struct DUMP_POINTERS { + AdapterObject: PVOID, // struct _ADAPTER_OBJECT * + MappedRegisterBase: PVOID, + DumpData: PVOID, + CommonBufferVa: PVOID, + CommonBufferPa: LARGE_INTEGER, + CommonBufferSize: ULONG, + AllocateCommonBuffers: BOOLEAN, + UseDiskDump: BOOLEAN, + Spare1: [UCHAR; 2], + DeviceObject: PVOID, +}} +pub type PDUMP_POINTERS = *mut DUMP_POINTERS; +STRUCT!{struct DUMP_POINTERS_EX { + Header: DUMP_POINTERS_VERSION, + DumpData: PVOID, + CommonBufferVa: PVOID, + CommonBufferSize: ULONG, + AllocateCommonBuffers: BOOLEAN, + DeviceObject: PVOID, + DriverList: PVOID, + dwPortFlags: ULONG, + MaxDeviceDumpSectionSize: ULONG, + MaxDeviceDumpLevel: ULONG, + MaxTransferSize: ULONG, + AdapterObject: PVOID, + MappedRegisterBase: PVOID, + DeviceReady: PBOOLEAN, + DumpDevicePowerOn: PDUMP_DEVICE_POWERON_ROUTINE, + DumpDevicePowerOnContext: PVOID, +}} +pub type PDUMP_POINTERS_EX = *mut DUMP_POINTERS_EX; +// TODO: Revisit these definitions when const size_of and offset_of! arrive. +#[cfg(target_pointer_width = "32")] +IFDEF!{ +pub const DUMP_POINTERS_EX_V2_SIZE: ULONG = 32; +pub const DUMP_POINTERS_EX_V3_SIZE: ULONG = 60; +pub const DUMP_POINTERS_EX_V4_SIZE: ULONG = 68; +} +#[cfg(target_pointer_width = "64")] +IFDEF!{ +pub const DUMP_POINTERS_EX_V2_SIZE: ULONG = 48; +pub const DUMP_POINTERS_EX_V3_SIZE: ULONG = 88; +pub const DUMP_POINTERS_EX_V4_SIZE: ULONG = 104; +} +pub const DUMP_EX_FLAG_SUPPORT_64BITMEMORY: ULONG = 0x00000001; +pub const DUMP_EX_FLAG_SUPPORT_DD_TELEMETRY: ULONG = 0x00000002; +pub const DUMP_EX_FLAG_RESUME_SUPPORT: ULONG = 0x00000004; +STRUCT!{struct DUMP_DRIVER { + DumpDriverList: PVOID, + DriverName: [WCHAR; DUMP_DRIVER_NAME_LENGTH], + BaseName: [WCHAR; DUMP_DRIVER_NAME_LENGTH], +}} +pub type PDUMP_DRIVER = *mut DUMP_DRIVER; +pub const SCSI_IOCTL_DATA_OUT: UCHAR = 0; +pub const SCSI_IOCTL_DATA_IN: UCHAR = 1; +pub const SCSI_IOCTL_DATA_UNSPECIFIED: UCHAR = 2; +pub const SCSI_IOCTL_DATA_BIDIRECTIONAL: UCHAR = 3; +pub const MPIO_IOCTL_FLAG_USE_PATHID: UCHAR = 1; +pub const MPIO_IOCTL_FLAG_USE_SCSIADDRESS: UCHAR = 2; +pub const MPIO_IOCTL_FLAG_INVOLVE_DSM: UCHAR = 4; diff --git a/src/vendor/winapi/src/shared/ntddser.rs b/src/vendor/winapi/src/shared/ntddser.rs new file mode 100644 index 0000000000..67ecd22d41 --- /dev/null +++ b/src/vendor/winapi/src/shared/ntddser.rs @@ -0,0 +1,18 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! This is the include file that defines all constants and types for accessing the Serial device. +use shared::devpropdef::DEVPROPKEY; +DEFINE_GUID!{GUID_DEVINTERFACE_COMPORT, + 0x86E0D1E0, 0x8089, 0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73} +DEFINE_GUID!{GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, + 0x4D36E978, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_Serial_UsbVendorId, + 0x4C6BF15C, 0x4C03, 0x4AAC, 0x91, 0xF5, 0x64, 0xC0, 0xF8, 0x52, 0xBC, 0xF4, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_Serial_UsbProductId, + 0x4C6BF15C, 0x4C03, 0x4AAC, 0x91, 0xF5, 0x64, 0xC0, 0xF8, 0x52, 0xBC, 0xF4, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_DeviceInterface_Serial_PortName, + 0x4C6BF15C, 0x4C03, 0x4AAC, 0x91, 0xF5, 0x64, 0xC0, 0xF8, 0x52, 0xBC, 0xF4, 4} diff --git a/src/vendor/winapi/src/shared/ntdef.rs b/src/vendor/winapi/src/shared/ntdef.rs new file mode 100644 index 0000000000..546684ac47 --- /dev/null +++ b/src/vendor/winapi/src/shared/ntdef.rs @@ -0,0 +1,1074 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Type definitions for the basic types. +use ctypes::{ + __int64, __uint64, c_char, c_double, c_int, c_long, c_schar, c_short, c_uchar, c_ulong, + c_ushort, c_void, wchar_t +}; +use shared::basetsd::{KAFFINITY, LONG_PTR, ULONG64, ULONG_PTR}; +use shared::guiddef::GUID; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub const MAX_NATURAL_ALIGNMENT: usize = 8; +pub const MEMORY_ALLOCATION_ALIGNMENT: usize = 16; +} +#[cfg(not(target_arch = "x86_64"))] +IFDEF!{ +pub const MAX_NATURAL_ALIGNMENT: usize = 4; +pub const MEMORY_ALLOCATION_ALIGNMENT: usize = 8; +} +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +pub const SYSTEM_CACHE_ALIGNMENT_SIZE: usize = 64; +#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))] +pub const SYSTEM_CACHE_ALIGNMENT_SIZE: usize = 128; +pub type PVOID = *mut c_void; +pub type PVOID64 = u64; // This is a 64-bit pointer, even when in 32-bit +pub type VOID = c_void; +pub type CHAR = c_char; +pub type SHORT = c_short; +pub type LONG = c_long; +pub type INT = c_int; +pub type WCHAR = wchar_t; +pub type PWCHAR = *mut WCHAR; +pub type LPWCH = *mut WCHAR; +pub type PWCH = *mut WCHAR; +pub type LPCWCH = *const WCHAR; +pub type PCWCH = *const WCHAR; +pub type NWPSTR = *mut WCHAR; +pub type LPWSTR = *mut WCHAR; +pub type LPTSTR = LPSTR; +pub type PWSTR = *mut WCHAR; +pub type PZPWSTR = *mut PWSTR; +pub type PCZPWSTR = *const PWSTR; +pub type LPUWSTR = *mut WCHAR; // Unaligned pointer +pub type PUWSTR = *mut WCHAR; // Unaligned pointer +pub type LPCWSTR = *const WCHAR; +pub type PCWSTR = *const WCHAR; +pub type PZPCWSTR = *mut PCWSTR; +pub type PCZPCWSTR = *const PCWSTR; +pub type LPCUWSTR = *const WCHAR; // Unaligned pointer +pub type PCUWSTR = *const WCHAR; // Unaligned pointer +pub type PZZWSTR = *mut WCHAR; +pub type PCZZWSTR = *const WCHAR; +pub type PUZZWSTR = *mut WCHAR; // Unaligned pointer +pub type PCUZZWSTR = *const WCHAR; // Unaligned pointer +pub type PNZWCH = *mut WCHAR; +pub type PCNZWCH = *const WCHAR; +pub type PUNZWCH = *mut WCHAR; // Unaligned pointer +pub type PCUNZWCH = *const WCHAR; // Unaligned pointer +pub type LPCWCHAR = *const WCHAR; +pub type PCWCHAR = *const WCHAR; +pub type LPCUWCHAR = *const WCHAR; // Unaligned pointer +pub type PCUWCHAR = *const WCHAR; // Unaligned pointer +pub type UCSCHAR = c_ulong; +pub const UCSCHAR_INVALID_CHARACTER: UCSCHAR = 0xffffffff; +pub const MIN_UCSCHAR: UCSCHAR = 0; +pub const MAX_UCSCHAR: UCSCHAR = 0x0010FFFF; +pub type PUCSCHAR = *mut UCSCHAR; +pub type PCUCSCHAR = *const UCSCHAR; +pub type PUCSSTR = *mut UCSCHAR; +pub type PUUCSSTR = *mut UCSCHAR; // Unaligned pointer +pub type PCUCSSTR = *const UCSCHAR; +pub type PCUUCSSTR = *const UCSCHAR; // Unaligned pointer +pub type PUUCSCHAR = *mut UCSCHAR; // Unaligned pointer +pub type PCUUCSCHAR = *const UCSCHAR; // Unaligned pointer +pub type PCHAR = *mut CHAR; +pub type LPCH = *mut CHAR; +pub type PCH = *mut CHAR; +pub type LPCCH = *const CHAR; +pub type PCCH = *const CHAR; +pub type NPSTR = *mut CHAR; +pub type LPSTR = *mut CHAR; +pub type PSTR = *mut CHAR; +pub type PZPSTR = *mut PSTR; +pub type PCZPSTR = *const PSTR; +pub type LPCSTR = *const CHAR; +pub type PCSTR = *const CHAR; +pub type PZPCSTR = *mut PCSTR; +pub type PCZPCSTR = *const PCSTR; +pub type PZZSTR = *mut CHAR; +pub type PCZZSTR = *const CHAR; +pub type PNZCH = *mut CHAR; +pub type PCNZCH = *const CHAR; +// Skipping TCHAR things +pub type DOUBLE = c_double; +STRUCT!{struct QUAD { + UseThisFieldToCopy: __int64, +}} +pub type PSHORT = *mut SHORT; +pub type PLONG = *mut LONG; +pub type PQUAD = *mut QUAD; +pub type UCHAR = c_uchar; +pub type USHORT = c_ushort; +pub type ULONG = c_ulong; +pub type UQUAD = QUAD; +pub type PUCHAR = *mut UCHAR; +pub type PUSHORT = *mut USHORT; +pub type PULONG = *mut ULONG; +pub type PUQUAD = *mut UQUAD; +pub type PCUCHAR = *const UCHAR; +pub type PCUSHORT = *const USHORT; +pub type PCULONG = *const ULONG; +pub type PCUQUAD = *const UQUAD; +pub type SCHAR = c_schar; +pub type PSCHAR = *mut SCHAR; +pub type PCSCHAR = *const SCHAR; +pub const ALL_PROCESSOR_GROUPS: USHORT = 0xffff; +STRUCT!{struct PROCESSOR_NUMBER { + Group: USHORT, + Number: UCHAR, + Reserved: UCHAR, +}} +pub type PPROCESSOR_NUMBER = *mut PROCESSOR_NUMBER; +STRUCT!{struct GROUP_AFFINITY { + Mask: KAFFINITY, + Group: USHORT, + Reserved: [USHORT; 3], +}} +pub type PGROUP_AFFINITY = *mut GROUP_AFFINITY; +#[cfg(target_arch = "x86_64")] +pub const MAXIMUM_PROC_PER_GROUP: UCHAR = 64; +#[cfg(not(target_arch = "x86_64"))] +pub const MAXIMUM_PROC_PER_GROUP: UCHAR = 32; +pub const MAXIMUM_PROCESSORS: UCHAR = MAXIMUM_PROC_PER_GROUP; +pub type HANDLE = *mut c_void; +pub type PHANDLE = *mut HANDLE; +pub type FCHAR = UCHAR; +pub type FSHORT = USHORT; +pub type FLONG = ULONG; +pub type HRESULT = c_long; +pub const OBJ_HANDLE_TAGBITS: usize = 0x00000003; +pub type CCHAR = c_char; +pub type CSHORT = c_short; +pub type CLONG = ULONG; +pub type PCCHAR = *mut CCHAR; +pub type PCSHORT = *mut CSHORT; +pub type PCLONG = *mut CLONG; +pub type LCID = ULONG; +pub type PLCID = PULONG; +pub type LANGID = USHORT; +ENUM!{enum COMPARTMENT_ID { + UNSPECIFIED_COMPARTMENT_ID = 0, + DEFAULT_COMPARTMENT_ID, +}} +pub type PCOMPARTMENT_ID = *mut COMPARTMENT_ID; +pub type LOGICAL = ULONG; +pub type PLOGICAL = *mut ULONG; +pub type NTSTATUS = LONG; +pub type PNTSTATUS = *mut NTSTATUS; +pub type PCNTSTATUS = *const NTSTATUS; +#[inline] +pub fn NT_SUCCESS(Status: NTSTATUS) -> bool { + Status >= 0 +} +#[inline] +pub fn NT_INFORMATION(Status: NTSTATUS) -> bool { + ((Status as ULONG) >> 30) == 1 +} +#[inline] +pub fn NT_WARNING(Status: NTSTATUS) -> bool { + ((Status as ULONG) >> 30) == 2 +} +#[inline] +pub fn NT_ERROR(Status: NTSTATUS) -> bool { + ((Status as ULONG) >> 30) == 3 +} +pub const APPLICATION_ERROR_MASK: ULONG = 0x20000000; +pub const ERROR_SEVERITY_SUCCESS: ULONG = 0x00000000; +pub const ERROR_SEVERITY_INFORMATIONAL: ULONG = 0x40000000; +pub const ERROR_SEVERITY_WARNING: ULONG = 0x80000000; +pub const ERROR_SEVERITY_ERROR: ULONG = 0xC0000000; +pub type SECURITY_STATUS = c_long; +pub type TIME = LARGE_INTEGER; +pub type PTIME = *mut TIME; +STRUCT!{struct FLOAT128 { + LowPart: __int64, + HighPart: __int64, +}} +pub type PFLOAT128 = *mut FLOAT128; +pub type LONGLONG = __int64; +pub type ULONGLONG = __uint64; +pub const MAXLONGLONG: LONGLONG = 0x7fffffffffffffff; +pub type PLONGLONG = *mut LONGLONG; +pub type PULONGLONG = *mut ULONGLONG; +pub type USN = LONGLONG; +UNION!{union LARGE_INTEGER { + [i64; 1], + s s_mut: LARGE_INTEGER_s, + QuadPart QuadPart_mut: LONGLONG, +}} +STRUCT!{struct LARGE_INTEGER_s { + LowPart: ULONG, + HighPart: LONG, +}} +pub type PLARGE_INTEGER = *mut LARGE_INTEGER; +UNION!{union ULARGE_INTEGER { + [u64; 1], + s s_mut: ULARGE_INTEGER_s, + QuadPart QuadPart_mut: ULONGLONG, +}} +STRUCT!{struct ULARGE_INTEGER_s { + LowPart: ULONG, + HighPart: ULONG, +}} +pub type PULARGE_INTEGER = *mut ULARGE_INTEGER; +pub type RTL_REFERENCE_COUNT = LONG_PTR; +pub type PRTL_REFERENCE_COUNT = *mut RTL_REFERENCE_COUNT; +STRUCT!{struct LUID { + LowPart: ULONG, + HighPart: LONG, +}} +pub type PLUID = *mut LUID; +pub type DWORDLONG = ULONGLONG; +pub type PDWORDLONG = *mut DWORDLONG; +pub type PHYSICAL_ADDRESS = LARGE_INTEGER; +pub type PPHYSICAL_ADDRESS = *mut PHYSICAL_ADDRESS; +ENUM!{enum EVENT_TYPE { + NotificationEvent, + SynchronizationEvent, +}} +ENUM!{enum TIMER_TYPE { + NotificationTimer, + SynchronizationTimer, +}} +ENUM!{enum WAIT_TYPE { + WaitAll, + WaitAny, + WaitNotification, + WaitDequeue, +}} +pub type PSZ = *mut CHAR; +pub type PCSZ = *const c_char; +pub type RTL_STRING_LENGTH_TYPE = USHORT; +STRUCT!{struct STRING { + Length: USHORT, + MaximumLength: USHORT, + Buffer: PCHAR, +}} +pub type PSTRING = *mut STRING; +pub type ANSI_STRING = STRING; +pub type PANSI_STRING = PSTRING; +pub type OEM_STRING = STRING; +pub type POEM_STRING = PSTRING; +pub type PCOEM_STRING = *const STRING; +STRUCT!{struct CSTRING { + Length: USHORT, + MaximumLength: USHORT, + Buffer: *const c_char, +}} +pub type PCSTRING = *mut CSTRING; +pub const ANSI_NULL: CHAR = 0; +pub type CANSI_STRING = STRING; +pub type PCANSI_STRING = PSTRING; +STRUCT!{struct UNICODE_STRING { + Length: USHORT, + MaximumLength: USHORT, + Buffer: PWCH, +}} +pub type PUNICODE_STRING = *mut UNICODE_STRING; +pub type PCUNICODE_STRING = *const UNICODE_STRING; +pub const UNICODE_NULL: WCHAR = 0; +pub const UNICODE_STRING_MAX_BYTES: USHORT = 65534; +pub const UNICODE_STRING_MAX_CHARS: usize = 32767; +pub type BOOLEAN = UCHAR; +pub type PBOOLEAN = *mut BOOLEAN; +STRUCT!{struct LIST_ENTRY { + Flink: *mut LIST_ENTRY, + Blink: *mut LIST_ENTRY, +}} +pub type PLIST_ENTRY = *mut LIST_ENTRY; +pub type PRLIST_ENTRY = *mut LIST_ENTRY; // Restricted pointer +STRUCT!{struct SINGLE_LIST_ENTRY { + Next: *mut SINGLE_LIST_ENTRY, +}} +pub type PSINGLE_LIST_ENTRY = *mut SINGLE_LIST_ENTRY; +STRUCT!{struct RTL_BALANCED_NODE { + u: RTL_BALANCED_NODE_u, + ParentValue: ULONG_PTR, +}} +UNION!{union RTL_BALANCED_NODE_u { + [usize; 2], + Children Children_mut: [*mut RTL_BALANCED_NODE; 2], + s s_mut: RTL_BALANCED_NODE_s, +}} +STRUCT!{struct RTL_BALANCED_NODE_s { + Left: *mut RTL_BALANCED_NODE, + Right: *mut RTL_BALANCED_NODE, +}} +pub const RTL_BALANCED_NODE_RESERVED_PARENT_MASK: ULONG_PTR = 3; +pub type PRTL_BALANCED_NODE = *mut RTL_BALANCED_NODE; +#[inline] +pub unsafe fn RTL_BALANCED_NODE_GET_PARENT_POINTER( + Node: PRTL_BALANCED_NODE, +) -> PRTL_BALANCED_NODE { + ((*Node).ParentValue & !RTL_BALANCED_NODE_RESERVED_PARENT_MASK) as *mut RTL_BALANCED_NODE +} +STRUCT!{struct LIST_ENTRY32 { + Flink: ULONG, + Blink: ULONG, +}} +pub type PLIST_ENTRY32 = *mut LIST_ENTRY32; +STRUCT!{struct LIST_ENTRY64 { + Flink: ULONGLONG, + Blink: ULONGLONG, +}} +pub type PLIST_ENTRY64 = *mut LIST_ENTRY64; +STRUCT!{struct SINGLE_LIST_ENTRY32 { + Next: ULONG, +}} +pub type PSINGLE_LIST_ENTRY32 = *mut SINGLE_LIST_ENTRY32; +#[inline] +pub unsafe fn ListEntry32To64(l32: PLIST_ENTRY32, l64: PLIST_ENTRY64) { + (*l64).Flink = (*l32).Flink as ULONGLONG; + (*l64).Blink = (*l32).Blink as ULONGLONG; +} +#[inline] +pub unsafe fn ListEntry64To32(l64: PLIST_ENTRY64, l32: PLIST_ENTRY32) { + (*l32).Flink = (*l64).Flink as ULONG; + (*l32).Blink = (*l64).Blink as ULONG; +} +STRUCT!{struct WNF_STATE_NAME { + Data: [ULONG; 2], +}} +pub type PWNF_STATE_NAME = *mut WNF_STATE_NAME; +pub type PCWNF_STATE_NAME = *const WNF_STATE_NAME; +STRUCT!{struct STRING32 { + Length: USHORT, + MaximumLength: USHORT, + Buffer: ULONG, +}} +pub type PSTRING32 = *mut STRING32; +pub type UNICODE_STRING32 = STRING32; +pub type PUNICODE_STRING32 = *mut UNICODE_STRING32; +pub type ANSI_STRING32 = STRING32; +pub type PANSI_STRING32 = *mut ANSI_STRING32; +STRUCT!{struct STRING64 { + Length: USHORT, + MaximumLength: USHORT, + Buffer: ULONGLONG, +}} +pub type PSTRING64 = *mut STRING64; +pub type UNICODE_STRING64 = STRING64; +pub type PUNICODE_STRING64 = *mut UNICODE_STRING64; +pub type ANSI_STRING64 = STRING64; +pub type PANSI_STRING64 = *mut ANSI_STRING64; +pub const OBJ_INHERIT: ULONG = 0x00000002; +pub const OBJ_PERMANENT: ULONG = 0x00000010; +pub const OBJ_EXCLUSIVE: ULONG = 0x00000020; +pub const OBJ_CASE_INSENSITIVE: ULONG = 0x00000040; +pub const OBJ_OPENIF: ULONG = 0x00000080; +pub const OBJ_OPENLINK: ULONG = 0x00000100; +pub const OBJ_KERNEL_HANDLE: ULONG = 0x00000200; +pub const OBJ_FORCE_ACCESS_CHECK: ULONG = 0x00000400; +pub const OBJ_IGNORE_IMPERSONATED_DEVICEMAP: ULONG = 0x00000800; +pub const OBJ_DONT_REPARSE: ULONG = 0x00001000; +pub const OBJ_VALID_ATTRIBUTES: ULONG = 0x00001FF2; +STRUCT!{struct OBJECT_ATTRIBUTES64 { + Length: ULONG, + RootDirectory: ULONG64, + ObjectName: ULONG64, + Attributes: ULONG, + SecurityDescriptor: ULONG64, + SecurityQualityOfService: ULONG64, +}} +pub type POBJECT_ATTRIBUTES64 = *mut OBJECT_ATTRIBUTES64; +pub type PCOBJECT_ATTRIBUTES64 = *const OBJECT_ATTRIBUTES64; +STRUCT!{struct OBJECT_ATTRIBUTES32 { + Length: ULONG, + RootDirectory: ULONG, + ObjectName: ULONG, + Attributes: ULONG, + SecurityDescriptor: ULONG, + SecurityQualityOfService: ULONG, +}} +pub type POBJECT_ATTRIBUTES32 = *mut OBJECT_ATTRIBUTES32; +pub type PCOBJECT_ATTRIBUTES32 = *const OBJECT_ATTRIBUTES32; +STRUCT!{struct OBJECT_ATTRIBUTES { + Length: ULONG, + RootDirectory: HANDLE, + ObjectName: PUNICODE_STRING, + Attributes: ULONG, + SecurityDescriptor: PVOID, + SecurityQualityOfService: PVOID, +}} +pub type POBJECT_ATTRIBUTES = *mut OBJECT_ATTRIBUTES; +pub type PCOBJECT_ATTRIBUTES = *const OBJECT_ATTRIBUTES; +#[inline] +pub unsafe fn InitializeObjectAttributes( + p: POBJECT_ATTRIBUTES, + n: PUNICODE_STRING, + a: ULONG, + r: HANDLE, + s: PVOID, +) { + use core::mem::size_of; + (*p).Length = size_of::() as ULONG; + (*p).RootDirectory = r; + (*p).Attributes = a; + (*p).ObjectName = n; + (*p).SecurityDescriptor = s; + (*p).SecurityQualityOfService = NULL; +} +pub const FALSE: BOOLEAN = 0; +pub const TRUE: BOOLEAN = 1; +pub const NULL: PVOID = 0 as PVOID; +pub const NULL64: PVOID64 = 0; +STRUCT!{struct OBJECTID { + Lineage: GUID, + Uniquifier: ULONG, +}} +pub const MINCHAR: CHAR = 0x80; +pub const MAXCHAR: CHAR = 0x7f; +pub const MINSHORT: SHORT = 0x8000; +pub const MAXSHORT: SHORT = 0x7fff; +pub const MINLONG: LONG = 0x80000000; +pub const MAXLONG: LONG = 0x7fffffff; +pub const MAXUCHAR: UCHAR = 0xff; +pub const MAXUSHORT: USHORT = 0xffff; +pub const MAXULONG: ULONG = 0xffffffff; +// PEXCEPTION_ROUTINE: Can't define here, because it needs EXCEPTION_RECORD and CONTEXT. +pub type KIRQL = UCHAR; +pub type PKIRQL = *mut KIRQL; +ENUM!{enum NT_PRODUCT_TYPE { + NtProductWinNt = 1, + NtProductLanManNt, + NtProductServer, +}} +pub type PNT_PRODUCT_TYPE = *mut NT_PRODUCT_TYPE; +ENUM!{enum SUITE_TYPE { + SmallBusiness, + Enterprise, + BackOffice, + CommunicationServer, + TerminalServer, + SmallBusinessRestricted, + EmbeddedNT, + DataCenter, + SingleUserTS, + Personal, + Blade, + EmbeddedRestricted, + SecurityAppliance, + StorageServer, + ComputeServer, + WHServer, + PhoneNT, + MaxSuiteType, +}} +pub const VER_SERVER_NT: ULONG = 0x80000000; +pub const VER_WORKSTATION_NT: ULONG = 0x40000000; +pub const VER_SUITE_SMALLBUSINESS: ULONG = 0x00000001; +pub const VER_SUITE_ENTERPRISE: ULONG = 0x00000002; +pub const VER_SUITE_BACKOFFICE: ULONG = 0x00000004; +pub const VER_SUITE_COMMUNICATIONS: ULONG = 0x00000008; +pub const VER_SUITE_TERMINAL: ULONG = 0x00000010; +pub const VER_SUITE_SMALLBUSINESS_RESTRICTED: ULONG = 0x00000020; +pub const VER_SUITE_EMBEDDEDNT: ULONG = 0x00000040; +pub const VER_SUITE_DATACENTER: ULONG = 0x00000080; +pub const VER_SUITE_SINGLEUSERTS: ULONG = 0x00000100; +pub const VER_SUITE_PERSONAL: ULONG = 0x00000200; +pub const VER_SUITE_BLADE: ULONG = 0x00000400; +pub const VER_SUITE_EMBEDDED_RESTRICTED: ULONG = 0x00000800; +pub const VER_SUITE_SECURITY_APPLIANCE: ULONG = 0x00001000; +pub const VER_SUITE_STORAGE_SERVER: ULONG = 0x00002000; +pub const VER_SUITE_COMPUTE_SERVER: ULONG = 0x00004000; +pub const VER_SUITE_WH_SERVER: ULONG = 0x00008000; +pub const PRODUCT_UNDEFINED: ULONG = 0x00000000; +pub const PRODUCT_ULTIMATE: ULONG = 0x00000001; +pub const PRODUCT_HOME_BASIC: ULONG = 0x00000002; +pub const PRODUCT_HOME_PREMIUM: ULONG = 0x00000003; +pub const PRODUCT_ENTERPRISE: ULONG = 0x00000004; +pub const PRODUCT_HOME_BASIC_N: ULONG = 0x00000005; +pub const PRODUCT_BUSINESS: ULONG = 0x00000006; +pub const PRODUCT_STANDARD_SERVER: ULONG = 0x00000007; +pub const PRODUCT_DATACENTER_SERVER: ULONG = 0x00000008; +pub const PRODUCT_SMALLBUSINESS_SERVER: ULONG = 0x00000009; +pub const PRODUCT_ENTERPRISE_SERVER: ULONG = 0x0000000A; +pub const PRODUCT_STARTER: ULONG = 0x0000000B; +pub const PRODUCT_DATACENTER_SERVER_CORE: ULONG = 0x0000000C; +pub const PRODUCT_STANDARD_SERVER_CORE: ULONG = 0x0000000D; +pub const PRODUCT_ENTERPRISE_SERVER_CORE: ULONG = 0x0000000E; +pub const PRODUCT_ENTERPRISE_SERVER_IA64: ULONG = 0x0000000F; +pub const PRODUCT_BUSINESS_N: ULONG = 0x00000010; +pub const PRODUCT_WEB_SERVER: ULONG = 0x00000011; +pub const PRODUCT_CLUSTER_SERVER: ULONG = 0x00000012; +pub const PRODUCT_HOME_SERVER: ULONG = 0x00000013; +pub const PRODUCT_STORAGE_EXPRESS_SERVER: ULONG = 0x00000014; +pub const PRODUCT_STORAGE_STANDARD_SERVER: ULONG = 0x00000015; +pub const PRODUCT_STORAGE_WORKGROUP_SERVER: ULONG = 0x00000016; +pub const PRODUCT_STORAGE_ENTERPRISE_SERVER: ULONG = 0x00000017; +pub const PRODUCT_SERVER_FOR_SMALLBUSINESS: ULONG = 0x00000018; +pub const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: ULONG = 0x00000019; +pub const PRODUCT_HOME_PREMIUM_N: ULONG = 0x0000001A; +pub const PRODUCT_ENTERPRISE_N: ULONG = 0x0000001B; +pub const PRODUCT_ULTIMATE_N: ULONG = 0x0000001C; +pub const PRODUCT_WEB_SERVER_CORE: ULONG = 0x0000001D; +pub const PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT: ULONG = 0x0000001E; +pub const PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY: ULONG = 0x0000001F; +pub const PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING: ULONG = 0x00000020; +pub const PRODUCT_SERVER_FOUNDATION: ULONG = 0x00000021; +pub const PRODUCT_HOME_PREMIUM_SERVER: ULONG = 0x00000022; +pub const PRODUCT_SERVER_FOR_SMALLBUSINESS_V: ULONG = 0x00000023; +pub const PRODUCT_STANDARD_SERVER_V: ULONG = 0x00000024; +pub const PRODUCT_DATACENTER_SERVER_V: ULONG = 0x00000025; +pub const PRODUCT_ENTERPRISE_SERVER_V: ULONG = 0x00000026; +pub const PRODUCT_DATACENTER_SERVER_CORE_V: ULONG = 0x00000027; +pub const PRODUCT_STANDARD_SERVER_CORE_V: ULONG = 0x00000028; +pub const PRODUCT_ENTERPRISE_SERVER_CORE_V: ULONG = 0x00000029; +pub const PRODUCT_HYPERV: ULONG = 0x0000002A; +pub const PRODUCT_STORAGE_EXPRESS_SERVER_CORE: ULONG = 0x0000002B; +pub const PRODUCT_STORAGE_STANDARD_SERVER_CORE: ULONG = 0x0000002C; +pub const PRODUCT_STORAGE_WORKGROUP_SERVER_CORE: ULONG = 0x0000002D; +pub const PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE: ULONG = 0x0000002E; +pub const PRODUCT_STARTER_N: ULONG = 0x0000002F; +pub const PRODUCT_PROFESSIONAL: ULONG = 0x00000030; +pub const PRODUCT_PROFESSIONAL_N: ULONG = 0x00000031; +pub const PRODUCT_SB_SOLUTION_SERVER: ULONG = 0x00000032; +pub const PRODUCT_SERVER_FOR_SB_SOLUTIONS: ULONG = 0x00000033; +pub const PRODUCT_STANDARD_SERVER_SOLUTIONS: ULONG = 0x00000034; +pub const PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE: ULONG = 0x00000035; +pub const PRODUCT_SB_SOLUTION_SERVER_EM: ULONG = 0x00000036; +pub const PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM: ULONG = 0x00000037; +pub const PRODUCT_SOLUTION_EMBEDDEDSERVER: ULONG = 0x00000038; +pub const PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE: ULONG = 0x00000039; +pub const PRODUCT_PROFESSIONAL_EMBEDDED: ULONG = 0x0000003A; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT: ULONG = 0x0000003B; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL: ULONG = 0x0000003C; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC: ULONG = 0x0000003D; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC: ULONG = 0x0000003E; +pub const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE: ULONG = 0x0000003F; +pub const PRODUCT_CLUSTER_SERVER_V: ULONG = 0x00000040; +pub const PRODUCT_EMBEDDED: ULONG = 0x00000041; +pub const PRODUCT_STARTER_E: ULONG = 0x00000042; +pub const PRODUCT_HOME_BASIC_E: ULONG = 0x00000043; +pub const PRODUCT_HOME_PREMIUM_E: ULONG = 0x00000044; +pub const PRODUCT_PROFESSIONAL_E: ULONG = 0x00000045; +pub const PRODUCT_ENTERPRISE_E: ULONG = 0x00000046; +pub const PRODUCT_ULTIMATE_E: ULONG = 0x00000047; +pub const PRODUCT_ENTERPRISE_EVALUATION: ULONG = 0x00000048; +pub const PRODUCT_MULTIPOINT_STANDARD_SERVER: ULONG = 0x0000004C; +pub const PRODUCT_MULTIPOINT_PREMIUM_SERVER: ULONG = 0x0000004D; +pub const PRODUCT_STANDARD_EVALUATION_SERVER: ULONG = 0x0000004F; +pub const PRODUCT_DATACENTER_EVALUATION_SERVER: ULONG = 0x00000050; +pub const PRODUCT_ENTERPRISE_N_EVALUATION: ULONG = 0x00000054; +pub const PRODUCT_EMBEDDED_AUTOMOTIVE: ULONG = 0x00000055; +pub const PRODUCT_EMBEDDED_INDUSTRY_A: ULONG = 0x00000056; +pub const PRODUCT_THINPC: ULONG = 0x00000057; +pub const PRODUCT_EMBEDDED_A: ULONG = 0x00000058; +pub const PRODUCT_EMBEDDED_INDUSTRY: ULONG = 0x00000059; +pub const PRODUCT_EMBEDDED_E: ULONG = 0x0000005A; +pub const PRODUCT_EMBEDDED_INDUSTRY_E: ULONG = 0x0000005B; +pub const PRODUCT_EMBEDDED_INDUSTRY_A_E: ULONG = 0x0000005C; +pub const PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER: ULONG = 0x0000005F; +pub const PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER: ULONG = 0x00000060; +pub const PRODUCT_CORE_ARM: ULONG = 0x00000061; +pub const PRODUCT_CORE_N: ULONG = 0x00000062; +pub const PRODUCT_CORE_COUNTRYSPECIFIC: ULONG = 0x00000063; +pub const PRODUCT_CORE_SINGLELANGUAGE: ULONG = 0x00000064; +pub const PRODUCT_CORE: ULONG = 0x00000065; +pub const PRODUCT_PROFESSIONAL_WMC: ULONG = 0x00000067; +pub const PRODUCT_MOBILE_CORE: ULONG = 0x00000068; +pub const PRODUCT_EMBEDDED_INDUSTRY_EVAL: ULONG = 0x00000069; +pub const PRODUCT_EMBEDDED_INDUSTRY_E_EVAL: ULONG = 0x0000006A; +pub const PRODUCT_EMBEDDED_EVAL: ULONG = 0x0000006B; +pub const PRODUCT_EMBEDDED_E_EVAL: ULONG = 0x0000006C; +pub const PRODUCT_NANO_SERVER: ULONG = 0x0000006D; +pub const PRODUCT_CLOUD_STORAGE_SERVER: ULONG = 0x0000006E; +pub const PRODUCT_CORE_CONNECTED: ULONG = 0x0000006F; +pub const PRODUCT_PROFESSIONAL_STUDENT: ULONG = 0x00000070; +pub const PRODUCT_CORE_CONNECTED_N: ULONG = 0x00000071; +pub const PRODUCT_PROFESSIONAL_STUDENT_N: ULONG = 0x00000072; +pub const PRODUCT_CORE_CONNECTED_SINGLELANGUAGE: ULONG = 0x00000073; +pub const PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC: ULONG = 0x00000074; +pub const PRODUCT_CONNECTED_CAR: ULONG = 0x00000075; +pub const PRODUCT_INDUSTRY_HANDHELD: ULONG = 0x00000076; +pub const PRODUCT_PPI_PRO: ULONG = 0x00000077; +pub const PRODUCT_ARM64_SERVER: ULONG = 0x00000078; +pub const PRODUCT_EDUCATION: ULONG = 0x00000079; +pub const PRODUCT_EDUCATION_N: ULONG = 0x0000007A; +pub const PRODUCT_IOTUAP: ULONG = 0x0000007B; +pub const PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER: ULONG = 0x0000007C; +pub const PRODUCT_ENTERPRISE_S: ULONG = 0x0000007D; +pub const PRODUCT_ENTERPRISE_S_N: ULONG = 0x0000007E; +pub const PRODUCT_PROFESSIONAL_S: ULONG = 0x0000007F; +pub const PRODUCT_PROFESSIONAL_S_N: ULONG = 0x00000080; +pub const PRODUCT_ENTERPRISE_S_EVALUATION: ULONG = 0x00000081; +pub const PRODUCT_ENTERPRISE_S_N_EVALUATION: ULONG = 0x00000082; +pub const PRODUCT_HOLOGRAPHIC: ULONG = 0x00000087; +pub const PRODUCT_PRO_SINGLE_LANGUAGE: ULONG = 0x0000008A; +pub const PRODUCT_PRO_CHINA: ULONG = 0x0000008B; +pub const PRODUCT_ENTERPRISE_SUBSCRIPTION: ULONG = 0x0000008C; +pub const PRODUCT_ENTERPRISE_SUBSCRIPTION_N: ULONG = 0x0000008D; +pub const PRODUCT_DATACENTER_NANO_SERVER: ULONG = 0x0000008F; +pub const PRODUCT_STANDARD_NANO_SERVER: ULONG = 0x00000090; +pub const PRODUCT_DATACENTER_A_SERVER_CORE: ULONG = 0x00000091; +pub const PRODUCT_STANDARD_A_SERVER_CORE: ULONG = 0x00000092; +pub const PRODUCT_DATACENTER_WS_SERVER_CORE: ULONG = 0x00000093; +pub const PRODUCT_STANDARD_WS_SERVER_CORE: ULONG = 0x00000094; +pub const PRODUCT_UTILITY_VM: ULONG = 0x00000095; +pub const PRODUCT_DATACENTER_EVALUATION_SERVER_CORE: ULONG = 0x0000009F; +pub const PRODUCT_STANDARD_EVALUATION_SERVER_CORE: ULONG = 0x000000A0; +pub const PRODUCT_PRO_WORKSTATION: ULONG = 0x000000A1; +pub const PRODUCT_PRO_WORKSTATION_N: ULONG = 0x000000A2; +pub const PRODUCT_PRO_FOR_EDUCATION: ULONG = 0x000000A4; +pub const PRODUCT_PRO_FOR_EDUCATION_N: ULONG = 0x000000A5; +pub const PRODUCT_AZURE_SERVER_CORE: ULONG = 0x000000A8; +pub const PRODUCT_AZURE_NANO_SERVER: ULONG = 0x000000A9; +pub const PRODUCT_UNLICENSED: ULONG = 0xABCDABCD; +pub const LANG_NEUTRAL: USHORT = 0x00; +pub const LANG_INVARIANT: USHORT = 0x7f; +pub const LANG_AFRIKAANS: USHORT = 0x36; +pub const LANG_ALBANIAN: USHORT = 0x1c; +pub const LANG_ALSATIAN: USHORT = 0x84; +pub const LANG_AMHARIC: USHORT = 0x5e; +pub const LANG_ARABIC: USHORT = 0x01; +pub const LANG_ARMENIAN: USHORT = 0x2b; +pub const LANG_ASSAMESE: USHORT = 0x4d; +pub const LANG_AZERI: USHORT = 0x2c; +pub const LANG_AZERBAIJANI: USHORT = 0x2c; +pub const LANG_BANGLA: USHORT = 0x45; +pub const LANG_BASHKIR: USHORT = 0x6d; +pub const LANG_BASQUE: USHORT = 0x2d; +pub const LANG_BELARUSIAN: USHORT = 0x23; +pub const LANG_BENGALI: USHORT = 0x45; +pub const LANG_BRETON: USHORT = 0x7e; +pub const LANG_BOSNIAN: USHORT = 0x1a; +pub const LANG_BOSNIAN_NEUTRAL: USHORT = 0x781a; +pub const LANG_BULGARIAN: USHORT = 0x02; +pub const LANG_CATALAN: USHORT = 0x03; +pub const LANG_CENTRAL_KURDISH: USHORT = 0x92; +pub const LANG_CHEROKEE: USHORT = 0x5c; +pub const LANG_CHINESE: USHORT = 0x04; +pub const LANG_CHINESE_SIMPLIFIED: USHORT = 0x04; +pub const LANG_CHINESE_TRADITIONAL: USHORT = 0x7c04; +pub const LANG_CORSICAN: USHORT = 0x83; +pub const LANG_CROATIAN: USHORT = 0x1a; +pub const LANG_CZECH: USHORT = 0x05; +pub const LANG_DANISH: USHORT = 0x06; +pub const LANG_DARI: USHORT = 0x8c; +pub const LANG_DIVEHI: USHORT = 0x65; +pub const LANG_DUTCH: USHORT = 0x13; +pub const LANG_ENGLISH: USHORT = 0x09; +pub const LANG_ESTONIAN: USHORT = 0x25; +pub const LANG_FAEROESE: USHORT = 0x38; +pub const LANG_FARSI: USHORT = 0x29; +pub const LANG_FILIPINO: USHORT = 0x64; +pub const LANG_FINNISH: USHORT = 0x0b; +pub const LANG_FRENCH: USHORT = 0x0c; +pub const LANG_FRISIAN: USHORT = 0x62; +pub const LANG_FULAH: USHORT = 0x67; +pub const LANG_GALICIAN: USHORT = 0x56; +pub const LANG_GEORGIAN: USHORT = 0x37; +pub const LANG_GERMAN: USHORT = 0x07; +pub const LANG_GREEK: USHORT = 0x08; +pub const LANG_GREENLANDIC: USHORT = 0x6f; +pub const LANG_GUJARATI: USHORT = 0x47; +pub const LANG_HAUSA: USHORT = 0x68; +pub const LANG_HAWAIIAN: USHORT = 0x75; +pub const LANG_HEBREW: USHORT = 0x0d; +pub const LANG_HINDI: USHORT = 0x39; +pub const LANG_HUNGARIAN: USHORT = 0x0e; +pub const LANG_ICELANDIC: USHORT = 0x0f; +pub const LANG_IGBO: USHORT = 0x70; +pub const LANG_INDONESIAN: USHORT = 0x21; +pub const LANG_INUKTITUT: USHORT = 0x5d; +pub const LANG_IRISH: USHORT = 0x3c; +pub const LANG_ITALIAN: USHORT = 0x10; +pub const LANG_JAPANESE: USHORT = 0x11; +pub const LANG_KANNADA: USHORT = 0x4b; +pub const LANG_KASHMIRI: USHORT = 0x60; +pub const LANG_KAZAK: USHORT = 0x3f; +pub const LANG_KHMER: USHORT = 0x53; +pub const LANG_KICHE: USHORT = 0x86; +pub const LANG_KINYARWANDA: USHORT = 0x87; +pub const LANG_KONKANI: USHORT = 0x57; +pub const LANG_KOREAN: USHORT = 0x12; +pub const LANG_KYRGYZ: USHORT = 0x40; +pub const LANG_LAO: USHORT = 0x54; +pub const LANG_LATVIAN: USHORT = 0x26; +pub const LANG_LITHUANIAN: USHORT = 0x27; +pub const LANG_LOWER_SORBIAN: USHORT = 0x2e; +pub const LANG_LUXEMBOURGISH: USHORT = 0x6e; +pub const LANG_MACEDONIAN: USHORT = 0x2f; +pub const LANG_MALAY: USHORT = 0x3e; +pub const LANG_MALAYALAM: USHORT = 0x4c; +pub const LANG_MALTESE: USHORT = 0x3a; +pub const LANG_MANIPURI: USHORT = 0x58; +pub const LANG_MAORI: USHORT = 0x81; +pub const LANG_MAPUDUNGUN: USHORT = 0x7a; +pub const LANG_MARATHI: USHORT = 0x4e; +pub const LANG_MOHAWK: USHORT = 0x7c; +pub const LANG_MONGOLIAN: USHORT = 0x50; +pub const LANG_NEPALI: USHORT = 0x61; +pub const LANG_NORWEGIAN: USHORT = 0x14; +pub const LANG_OCCITAN: USHORT = 0x82; +pub const LANG_ODIA: USHORT = 0x48; +pub const LANG_ORIYA: USHORT = 0x48; +pub const LANG_PASHTO: USHORT = 0x63; +pub const LANG_PERSIAN: USHORT = 0x29; +pub const LANG_POLISH: USHORT = 0x15; +pub const LANG_PORTUGUESE: USHORT = 0x16; +pub const LANG_PULAR: USHORT = 0x67; +pub const LANG_PUNJABI: USHORT = 0x46; +pub const LANG_QUECHUA: USHORT = 0x6b; +pub const LANG_ROMANIAN: USHORT = 0x18; +pub const LANG_ROMANSH: USHORT = 0x17; +pub const LANG_RUSSIAN: USHORT = 0x19; +pub const LANG_SAKHA: USHORT = 0x85; +pub const LANG_SAMI: USHORT = 0x3b; +pub const LANG_SANSKRIT: USHORT = 0x4f; +pub const LANG_SCOTTISH_GAELIC: USHORT = 0x91; +pub const LANG_SERBIAN: USHORT = 0x1a; +pub const LANG_SERBIAN_NEUTRAL: USHORT = 0x7c1a; +pub const LANG_SINDHI: USHORT = 0x59; +pub const LANG_SINHALESE: USHORT = 0x5b; +pub const LANG_SLOVAK: USHORT = 0x1b; +pub const LANG_SLOVENIAN: USHORT = 0x24; +pub const LANG_SOTHO: USHORT = 0x6c; +pub const LANG_SPANISH: USHORT = 0x0a; +pub const LANG_SWAHILI: USHORT = 0x41; +pub const LANG_SWEDISH: USHORT = 0x1d; +pub const LANG_SYRIAC: USHORT = 0x5a; +pub const LANG_TAJIK: USHORT = 0x28; +pub const LANG_TAMAZIGHT: USHORT = 0x5f; +pub const LANG_TAMIL: USHORT = 0x49; +pub const LANG_TATAR: USHORT = 0x44; +pub const LANG_TELUGU: USHORT = 0x4a; +pub const LANG_THAI: USHORT = 0x1e; +pub const LANG_TIBETAN: USHORT = 0x51; +pub const LANG_TIGRIGNA: USHORT = 0x73; +pub const LANG_TIGRINYA: USHORT = 0x73; +pub const LANG_TSWANA: USHORT = 0x32; +pub const LANG_TURKISH: USHORT = 0x1f; +pub const LANG_TURKMEN: USHORT = 0x42; +pub const LANG_UIGHUR: USHORT = 0x80; +pub const LANG_UKRAINIAN: USHORT = 0x22; +pub const LANG_UPPER_SORBIAN: USHORT = 0x2e; +pub const LANG_URDU: USHORT = 0x20; +pub const LANG_UZBEK: USHORT = 0x43; +pub const LANG_VALENCIAN: USHORT = 0x03; +pub const LANG_VIETNAMESE: USHORT = 0x2a; +pub const LANG_WELSH: USHORT = 0x52; +pub const LANG_WOLOF: USHORT = 0x88; +pub const LANG_XHOSA: USHORT = 0x34; +pub const LANG_YAKUT: USHORT = 0x85; +pub const LANG_YI: USHORT = 0x78; +pub const LANG_YORUBA: USHORT = 0x6a; +pub const LANG_ZULU: USHORT = 0x35; +pub const SUBLANG_NEUTRAL: USHORT = 0x00; +pub const SUBLANG_DEFAULT: USHORT = 0x01; +pub const SUBLANG_SYS_DEFAULT: USHORT = 0x02; +pub const SUBLANG_CUSTOM_DEFAULT: USHORT = 0x03; +pub const SUBLANG_CUSTOM_UNSPECIFIED: USHORT = 0x04; +pub const SUBLANG_UI_CUSTOM_DEFAULT: USHORT = 0x05; +pub const SUBLANG_AFRIKAANS_SOUTH_AFRICA: USHORT = 0x01; +pub const SUBLANG_ALBANIAN_ALBANIA: USHORT = 0x01; +pub const SUBLANG_ALSATIAN_FRANCE: USHORT = 0x01; +pub const SUBLANG_AMHARIC_ETHIOPIA: USHORT = 0x01; +pub const SUBLANG_ARABIC_SAUDI_ARABIA: USHORT = 0x01; +pub const SUBLANG_ARABIC_IRAQ: USHORT = 0x02; +pub const SUBLANG_ARABIC_EGYPT: USHORT = 0x03; +pub const SUBLANG_ARABIC_LIBYA: USHORT = 0x04; +pub const SUBLANG_ARABIC_ALGERIA: USHORT = 0x05; +pub const SUBLANG_ARABIC_MOROCCO: USHORT = 0x06; +pub const SUBLANG_ARABIC_TUNISIA: USHORT = 0x07; +pub const SUBLANG_ARABIC_OMAN: USHORT = 0x08; +pub const SUBLANG_ARABIC_YEMEN: USHORT = 0x09; +pub const SUBLANG_ARABIC_SYRIA: USHORT = 0x0a; +pub const SUBLANG_ARABIC_JORDAN: USHORT = 0x0b; +pub const SUBLANG_ARABIC_LEBANON: USHORT = 0x0c; +pub const SUBLANG_ARABIC_KUWAIT: USHORT = 0x0d; +pub const SUBLANG_ARABIC_UAE: USHORT = 0x0e; +pub const SUBLANG_ARABIC_BAHRAIN: USHORT = 0x0f; +pub const SUBLANG_ARABIC_QATAR: USHORT = 0x10; +pub const SUBLANG_ARMENIAN_ARMENIA: USHORT = 0x01; +pub const SUBLANG_ASSAMESE_INDIA: USHORT = 0x01; +pub const SUBLANG_AZERI_LATIN: USHORT = 0x01; +pub const SUBLANG_AZERI_CYRILLIC: USHORT = 0x02; +pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN: USHORT = 0x01; +pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC: USHORT = 0x02; +pub const SUBLANG_BANGLA_INDIA: USHORT = 0x01; +pub const SUBLANG_BANGLA_BANGLADESH: USHORT = 0x02; +pub const SUBLANG_BASHKIR_RUSSIA: USHORT = 0x01; +pub const SUBLANG_BASQUE_BASQUE: USHORT = 0x01; +pub const SUBLANG_BELARUSIAN_BELARUS: USHORT = 0x01; +pub const SUBLANG_BENGALI_INDIA: USHORT = 0x01; +pub const SUBLANG_BENGALI_BANGLADESH: USHORT = 0x02; +pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: USHORT = 0x05; +pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: USHORT = 0x08; +pub const SUBLANG_BRETON_FRANCE: USHORT = 0x01; +pub const SUBLANG_BULGARIAN_BULGARIA: USHORT = 0x01; +pub const SUBLANG_CATALAN_CATALAN: USHORT = 0x01; +pub const SUBLANG_CENTRAL_KURDISH_IRAQ: USHORT = 0x01; +pub const SUBLANG_CHEROKEE_CHEROKEE: USHORT = 0x01; +pub const SUBLANG_CHINESE_TRADITIONAL: USHORT = 0x01; +pub const SUBLANG_CHINESE_SIMPLIFIED: USHORT = 0x02; +pub const SUBLANG_CHINESE_HONGKONG: USHORT = 0x03; +pub const SUBLANG_CHINESE_SINGAPORE: USHORT = 0x04; +pub const SUBLANG_CHINESE_MACAU: USHORT = 0x05; +pub const SUBLANG_CORSICAN_FRANCE: USHORT = 0x01; +pub const SUBLANG_CZECH_CZECH_REPUBLIC: USHORT = 0x01; +pub const SUBLANG_CROATIAN_CROATIA: USHORT = 0x01; +pub const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: USHORT = 0x04; +pub const SUBLANG_DANISH_DENMARK: USHORT = 0x01; +pub const SUBLANG_DARI_AFGHANISTAN: USHORT = 0x01; +pub const SUBLANG_DIVEHI_MALDIVES: USHORT = 0x01; +pub const SUBLANG_DUTCH: USHORT = 0x01; +pub const SUBLANG_DUTCH_BELGIAN: USHORT = 0x02; +pub const SUBLANG_ENGLISH_US: USHORT = 0x01; +pub const SUBLANG_ENGLISH_UK: USHORT = 0x02; +pub const SUBLANG_ENGLISH_AUS: USHORT = 0x03; +pub const SUBLANG_ENGLISH_CAN: USHORT = 0x04; +pub const SUBLANG_ENGLISH_NZ: USHORT = 0x05; +pub const SUBLANG_ENGLISH_EIRE: USHORT = 0x06; +pub const SUBLANG_ENGLISH_SOUTH_AFRICA: USHORT = 0x07; +pub const SUBLANG_ENGLISH_JAMAICA: USHORT = 0x08; +pub const SUBLANG_ENGLISH_CARIBBEAN: USHORT = 0x09; +pub const SUBLANG_ENGLISH_BELIZE: USHORT = 0x0a; +pub const SUBLANG_ENGLISH_TRINIDAD: USHORT = 0x0b; +pub const SUBLANG_ENGLISH_ZIMBABWE: USHORT = 0x0c; +pub const SUBLANG_ENGLISH_PHILIPPINES: USHORT = 0x0d; +pub const SUBLANG_ENGLISH_INDIA: USHORT = 0x10; +pub const SUBLANG_ENGLISH_MALAYSIA: USHORT = 0x11; +pub const SUBLANG_ENGLISH_SINGAPORE: USHORT = 0x12; +pub const SUBLANG_ESTONIAN_ESTONIA: USHORT = 0x01; +pub const SUBLANG_FAEROESE_FAROE_ISLANDS: USHORT = 0x01; +pub const SUBLANG_FILIPINO_PHILIPPINES: USHORT = 0x01; +pub const SUBLANG_FINNISH_FINLAND: USHORT = 0x01; +pub const SUBLANG_FRENCH: USHORT = 0x01; +pub const SUBLANG_FRENCH_BELGIAN: USHORT = 0x02; +pub const SUBLANG_FRENCH_CANADIAN: USHORT = 0x03; +pub const SUBLANG_FRENCH_SWISS: USHORT = 0x04; +pub const SUBLANG_FRENCH_LUXEMBOURG: USHORT = 0x05; +pub const SUBLANG_FRENCH_MONACO: USHORT = 0x06; +pub const SUBLANG_FRISIAN_NETHERLANDS: USHORT = 0x01; +pub const SUBLANG_FULAH_SENEGAL: USHORT = 0x02; +pub const SUBLANG_GALICIAN_GALICIAN: USHORT = 0x01; +pub const SUBLANG_GEORGIAN_GEORGIA: USHORT = 0x01; +pub const SUBLANG_GERMAN: USHORT = 0x01; +pub const SUBLANG_GERMAN_SWISS: USHORT = 0x02; +pub const SUBLANG_GERMAN_AUSTRIAN: USHORT = 0x03; +pub const SUBLANG_GERMAN_LUXEMBOURG: USHORT = 0x04; +pub const SUBLANG_GERMAN_LIECHTENSTEIN: USHORT = 0x05; +pub const SUBLANG_GREEK_GREECE: USHORT = 0x01; +pub const SUBLANG_GREENLANDIC_GREENLAND: USHORT = 0x01; +pub const SUBLANG_GUJARATI_INDIA: USHORT = 0x01; +pub const SUBLANG_HAUSA_NIGERIA_LATIN: USHORT = 0x01; +pub const SUBLANG_HAWAIIAN_US: USHORT = 0x01; +pub const SUBLANG_HEBREW_ISRAEL: USHORT = 0x01; +pub const SUBLANG_HINDI_INDIA: USHORT = 0x01; +pub const SUBLANG_HUNGARIAN_HUNGARY: USHORT = 0x01; +pub const SUBLANG_ICELANDIC_ICELAND: USHORT = 0x01; +pub const SUBLANG_IGBO_NIGERIA: USHORT = 0x01; +pub const SUBLANG_INDONESIAN_INDONESIA: USHORT = 0x01; +pub const SUBLANG_INUKTITUT_CANADA: USHORT = 0x01; +pub const SUBLANG_INUKTITUT_CANADA_LATIN: USHORT = 0x02; +pub const SUBLANG_IRISH_IRELAND: USHORT = 0x02; +pub const SUBLANG_ITALIAN: USHORT = 0x01; +pub const SUBLANG_ITALIAN_SWISS: USHORT = 0x02; +pub const SUBLANG_JAPANESE_JAPAN: USHORT = 0x01; +pub const SUBLANG_KANNADA_INDIA: USHORT = 0x01; +pub const SUBLANG_KASHMIRI_SASIA: USHORT = 0x02; +pub const SUBLANG_KASHMIRI_INDIA: USHORT = 0x02; +pub const SUBLANG_KAZAK_KAZAKHSTAN: USHORT = 0x01; +pub const SUBLANG_KHMER_CAMBODIA: USHORT = 0x01; +pub const SUBLANG_KICHE_GUATEMALA: USHORT = 0x01; +pub const SUBLANG_KINYARWANDA_RWANDA: USHORT = 0x01; +pub const SUBLANG_KONKANI_INDIA: USHORT = 0x01; +pub const SUBLANG_KOREAN: USHORT = 0x01; +pub const SUBLANG_KYRGYZ_KYRGYZSTAN: USHORT = 0x01; +pub const SUBLANG_LAO_LAO: USHORT = 0x01; +pub const SUBLANG_LATVIAN_LATVIA: USHORT = 0x01; +pub const SUBLANG_LITHUANIAN: USHORT = 0x01; +pub const SUBLANG_LOWER_SORBIAN_GERMANY: USHORT = 0x02; +pub const SUBLANG_LUXEMBOURGISH_LUXEMBOURG: USHORT = 0x01; +pub const SUBLANG_MACEDONIAN_MACEDONIA: USHORT = 0x01; +pub const SUBLANG_MALAY_MALAYSIA: USHORT = 0x01; +pub const SUBLANG_MALAY_BRUNEI_DARUSSALAM: USHORT = 0x02; +pub const SUBLANG_MALAYALAM_INDIA: USHORT = 0x01; +pub const SUBLANG_MALTESE_MALTA: USHORT = 0x01; +pub const SUBLANG_MAORI_NEW_ZEALAND: USHORT = 0x01; +pub const SUBLANG_MAPUDUNGUN_CHILE: USHORT = 0x01; +pub const SUBLANG_MARATHI_INDIA: USHORT = 0x01; +pub const SUBLANG_MOHAWK_MOHAWK: USHORT = 0x01; +pub const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: USHORT = 0x01; +pub const SUBLANG_MONGOLIAN_PRC: USHORT = 0x02; +pub const SUBLANG_NEPALI_INDIA: USHORT = 0x02; +pub const SUBLANG_NEPALI_NEPAL: USHORT = 0x01; +pub const SUBLANG_NORWEGIAN_BOKMAL: USHORT = 0x01; +pub const SUBLANG_NORWEGIAN_NYNORSK: USHORT = 0x02; +pub const SUBLANG_OCCITAN_FRANCE: USHORT = 0x01; +pub const SUBLANG_ODIA_INDIA: USHORT = 0x01; +pub const SUBLANG_ORIYA_INDIA: USHORT = 0x01; +pub const SUBLANG_PASHTO_AFGHANISTAN: USHORT = 0x01; +pub const SUBLANG_PERSIAN_IRAN: USHORT = 0x01; +pub const SUBLANG_POLISH_POLAND: USHORT = 0x01; +pub const SUBLANG_PORTUGUESE: USHORT = 0x02; +pub const SUBLANG_PORTUGUESE_BRAZILIAN: USHORT = 0x01; +pub const SUBLANG_PULAR_SENEGAL: USHORT = 0x02; +pub const SUBLANG_PUNJABI_INDIA: USHORT = 0x01; +pub const SUBLANG_PUNJABI_PAKISTAN: USHORT = 0x02; +pub const SUBLANG_QUECHUA_BOLIVIA: USHORT = 0x01; +pub const SUBLANG_QUECHUA_ECUADOR: USHORT = 0x02; +pub const SUBLANG_QUECHUA_PERU: USHORT = 0x03; +pub const SUBLANG_ROMANIAN_ROMANIA: USHORT = 0x01; +pub const SUBLANG_ROMANSH_SWITZERLAND: USHORT = 0x01; +pub const SUBLANG_RUSSIAN_RUSSIA: USHORT = 0x01; +pub const SUBLANG_SAKHA_RUSSIA: USHORT = 0x01; +pub const SUBLANG_SAMI_NORTHERN_NORWAY: USHORT = 0x01; +pub const SUBLANG_SAMI_NORTHERN_SWEDEN: USHORT = 0x02; +pub const SUBLANG_SAMI_NORTHERN_FINLAND: USHORT = 0x03; +pub const SUBLANG_SAMI_LULE_NORWAY: USHORT = 0x04; +pub const SUBLANG_SAMI_LULE_SWEDEN: USHORT = 0x05; +pub const SUBLANG_SAMI_SOUTHERN_NORWAY: USHORT = 0x06; +pub const SUBLANG_SAMI_SOUTHERN_SWEDEN: USHORT = 0x07; +pub const SUBLANG_SAMI_SKOLT_FINLAND: USHORT = 0x08; +pub const SUBLANG_SAMI_INARI_FINLAND: USHORT = 0x09; +pub const SUBLANG_SANSKRIT_INDIA: USHORT = 0x01; +pub const SUBLANG_SCOTTISH_GAELIC: USHORT = 0x01; +pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN: USHORT = 0x06; +pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC: USHORT = 0x07; +pub const SUBLANG_SERBIAN_MONTENEGRO_LATIN: USHORT = 0x0b; +pub const SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC: USHORT = 0x0c; +pub const SUBLANG_SERBIAN_SERBIA_LATIN: USHORT = 0x09; +pub const SUBLANG_SERBIAN_SERBIA_CYRILLIC: USHORT = 0x0a; +pub const SUBLANG_SERBIAN_CROATIA: USHORT = 0x01; +pub const SUBLANG_SERBIAN_LATIN: USHORT = 0x02; +pub const SUBLANG_SERBIAN_CYRILLIC: USHORT = 0x03; +pub const SUBLANG_SINDHI_INDIA: USHORT = 0x01; +pub const SUBLANG_SINDHI_PAKISTAN: USHORT = 0x02; +pub const SUBLANG_SINDHI_AFGHANISTAN: USHORT = 0x02; +pub const SUBLANG_SINHALESE_SRI_LANKA: USHORT = 0x01; +pub const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA: USHORT = 0x01; +pub const SUBLANG_SLOVAK_SLOVAKIA: USHORT = 0x01; +pub const SUBLANG_SLOVENIAN_SLOVENIA: USHORT = 0x01; +pub const SUBLANG_SPANISH: USHORT = 0x01; +pub const SUBLANG_SPANISH_MEXICAN: USHORT = 0x02; +pub const SUBLANG_SPANISH_MODERN: USHORT = 0x03; +pub const SUBLANG_SPANISH_GUATEMALA: USHORT = 0x04; +pub const SUBLANG_SPANISH_COSTA_RICA: USHORT = 0x05; +pub const SUBLANG_SPANISH_PANAMA: USHORT = 0x06; +pub const SUBLANG_SPANISH_DOMINICAN_REPUBLIC: USHORT = 0x07; +pub const SUBLANG_SPANISH_VENEZUELA: USHORT = 0x08; +pub const SUBLANG_SPANISH_COLOMBIA: USHORT = 0x09; +pub const SUBLANG_SPANISH_PERU: USHORT = 0x0a; +pub const SUBLANG_SPANISH_ARGENTINA: USHORT = 0x0b; +pub const SUBLANG_SPANISH_ECUADOR: USHORT = 0x0c; +pub const SUBLANG_SPANISH_CHILE: USHORT = 0x0d; +pub const SUBLANG_SPANISH_URUGUAY: USHORT = 0x0e; +pub const SUBLANG_SPANISH_PARAGUAY: USHORT = 0x0f; +pub const SUBLANG_SPANISH_BOLIVIA: USHORT = 0x10; +pub const SUBLANG_SPANISH_EL_SALVADOR: USHORT = 0x11; +pub const SUBLANG_SPANISH_HONDURAS: USHORT = 0x12; +pub const SUBLANG_SPANISH_NICARAGUA: USHORT = 0x13; +pub const SUBLANG_SPANISH_PUERTO_RICO: USHORT = 0x14; +pub const SUBLANG_SPANISH_US: USHORT = 0x15; +pub const SUBLANG_SWAHILI_KENYA: USHORT = 0x01; +pub const SUBLANG_SWEDISH: USHORT = 0x01; +pub const SUBLANG_SWEDISH_FINLAND: USHORT = 0x02; +pub const SUBLANG_SYRIAC_SYRIA: USHORT = 0x01; +pub const SUBLANG_TAJIK_TAJIKISTAN: USHORT = 0x01; +pub const SUBLANG_TAMAZIGHT_ALGERIA_LATIN: USHORT = 0x02; +pub const SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH: USHORT = 0x04; +pub const SUBLANG_TAMIL_INDIA: USHORT = 0x01; +pub const SUBLANG_TAMIL_SRI_LANKA: USHORT = 0x02; +pub const SUBLANG_TATAR_RUSSIA: USHORT = 0x01; +pub const SUBLANG_TELUGU_INDIA: USHORT = 0x01; +pub const SUBLANG_THAI_THAILAND: USHORT = 0x01; +pub const SUBLANG_TIBETAN_PRC: USHORT = 0x01; +pub const SUBLANG_TIGRIGNA_ERITREA: USHORT = 0x02; +pub const SUBLANG_TIGRINYA_ERITREA: USHORT = 0x02; +pub const SUBLANG_TIGRINYA_ETHIOPIA: USHORT = 0x01; +pub const SUBLANG_TSWANA_BOTSWANA: USHORT = 0x02; +pub const SUBLANG_TSWANA_SOUTH_AFRICA: USHORT = 0x01; +pub const SUBLANG_TURKISH_TURKEY: USHORT = 0x01; +pub const SUBLANG_TURKMEN_TURKMENISTAN: USHORT = 0x01; +pub const SUBLANG_UIGHUR_PRC: USHORT = 0x01; +pub const SUBLANG_UKRAINIAN_UKRAINE: USHORT = 0x01; +pub const SUBLANG_UPPER_SORBIAN_GERMANY: USHORT = 0x01; +pub const SUBLANG_URDU_PAKISTAN: USHORT = 0x01; +pub const SUBLANG_URDU_INDIA: USHORT = 0x02; +pub const SUBLANG_UZBEK_LATIN: USHORT = 0x01; +pub const SUBLANG_UZBEK_CYRILLIC: USHORT = 0x02; +pub const SUBLANG_VALENCIAN_VALENCIA: USHORT = 0x02; +pub const SUBLANG_VIETNAMESE_VIETNAM: USHORT = 0x01; +pub const SUBLANG_WELSH_UNITED_KINGDOM: USHORT = 0x01; +pub const SUBLANG_WOLOF_SENEGAL: USHORT = 0x01; +pub const SUBLANG_XHOSA_SOUTH_AFRICA: USHORT = 0x01; +pub const SUBLANG_YAKUT_RUSSIA: USHORT = 0x01; +pub const SUBLANG_YI_PRC: USHORT = 0x01; +pub const SUBLANG_YORUBA_NIGERIA: USHORT = 0x01; +pub const SUBLANG_ZULU_SOUTH_AFRICA: USHORT = 0x01; +pub const SORT_DEFAULT: USHORT = 0x0; +pub const SORT_INVARIANT_MATH: USHORT = 0x1; +pub const SORT_JAPANESE_XJIS: USHORT = 0x0; +pub const SORT_JAPANESE_UNICODE: USHORT = 0x1; +pub const SORT_JAPANESE_RADICALSTROKE: USHORT = 0x4; +pub const SORT_CHINESE_BIG5: USHORT = 0x0; +pub const SORT_CHINESE_PRCP: USHORT = 0x0; +pub const SORT_CHINESE_UNICODE: USHORT = 0x1; +pub const SORT_CHINESE_PRC: USHORT = 0x2; +pub const SORT_CHINESE_BOPOMOFO: USHORT = 0x3; +pub const SORT_CHINESE_RADICALSTROKE: USHORT = 0x4; +pub const SORT_KOREAN_KSC: USHORT = 0x0; +pub const SORT_KOREAN_UNICODE: USHORT = 0x1; +pub const SORT_GERMAN_PHONE_BOOK: USHORT = 0x1; +pub const SORT_HUNGARIAN_DEFAULT: USHORT = 0x0; +pub const SORT_HUNGARIAN_TECHNICAL: USHORT = 0x1; +pub const SORT_GEORGIAN_TRADITIONAL: USHORT = 0x0; +pub const SORT_GEORGIAN_MODERN: USHORT = 0x1; +macro_rules! MAKELANGID { + ($p:expr, $s:expr) => { + (($s as USHORT) << 10) | ($p as USHORT) + } +} +#[inline] +pub fn MAKELANGID(p: USHORT, s: USHORT) -> LANGID { (s << 10) | p } +#[inline] +pub fn PRIMARYLANGID(lgid: LANGID) -> USHORT { lgid & 0x3ff } +#[inline] +pub fn SUBLANGID(lgid: LANGID) -> USHORT { lgid >> 10 } +pub const NLS_VALID_LOCALE_MASK: ULONG = 0x000fffff; +macro_rules! MAKELCID { + ($lgid:expr, $srtid:expr) => { + (($srtid as ULONG) << 16) | ($lgid as ULONG) + } +} +#[inline] +pub fn MAKELCID(lgid: LANGID, srtid: USHORT) -> LCID { + ((srtid as ULONG) << 16) | (lgid as ULONG) +} +#[inline] +pub fn MAKESORTLCID(lgid: LANGID, srtid: USHORT, ver: USHORT) -> LCID { + MAKELCID(lgid, srtid) | ((ver as ULONG) << 20) +} +#[inline] +pub fn LANGIDFROMLCID(lcid: LCID) -> LANGID { lcid as LANGID } +#[inline] +pub fn SORTIDFROMLCID(lcid: LCID) -> USHORT { ((lcid >> 16) & 0xf) as USHORT } +#[inline] +pub fn SORTVERSIONFROMLCID(lcid: LCID) -> USHORT { ((lcid >> 16) & 0xf) as USHORT } +pub const LOCALE_NAME_MAX_LENGTH: usize = 85; +pub const LANG_SYSTEM_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT); +pub const LANG_USER_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_DEFAULT); +pub const LOCALE_SYSTEM_DEFAULT: LCID = MAKELCID!(LANG_SYSTEM_DEFAULT, SORT_DEFAULT); +pub const LOCALE_USER_DEFAULT: LCID = MAKELCID!(LANG_USER_DEFAULT, SORT_DEFAULT); +pub const LOCALE_CUSTOM_DEFAULT: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT); +pub const LOCALE_CUSTOM_UNSPECIFIED: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT); +pub const LOCALE_CUSTOM_UI_DEFAULT: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT); +pub const LOCALE_NEUTRAL: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT); +pub const LOCALE_INVARIANT: LCID + = MAKELCID!(MAKELANGID!(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT); +pub const LOCALE_TRANSIENT_KEYBOARD1: LCID = 0x2000; +pub const LOCALE_TRANSIENT_KEYBOARD2: LCID = 0x2400; +pub const LOCALE_TRANSIENT_KEYBOARD3: LCID = 0x2800; +pub const LOCALE_TRANSIENT_KEYBOARD4: LCID = 0x2c00; +pub const LOCALE_UNASSIGNED_LCID: LCID = LOCALE_CUSTOM_UNSPECIFIED; diff --git a/src/vendor/winapi/src/shared/ntstatus.rs b/src/vendor/winapi/src/shared/ntstatus.rs new file mode 100644 index 0000000000..2663ae5a4e --- /dev/null +++ b/src/vendor/winapi/src/shared/ntstatus.rs @@ -0,0 +1,2575 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Constant definitions for the NTSTATUS values. +use shared::ntdef::NTSTATUS; +pub const STATUS_WAIT_0: NTSTATUS = 0x00000000; +pub const FACILITY_VSM: NTSTATUS = 0x45; +pub const FACILITY_VOLSNAP: NTSTATUS = 0x50; +pub const FACILITY_VOLMGR: NTSTATUS = 0x38; +pub const FACILITY_VIRTUALIZATION: NTSTATUS = 0x37; +pub const FACILITY_VIDEO: NTSTATUS = 0x1B; +pub const FACILITY_USB_ERROR_CODE: NTSTATUS = 0x10; +pub const FACILITY_TRANSACTION: NTSTATUS = 0x19; +pub const FACILITY_TPM: NTSTATUS = 0x29; +pub const FACILITY_TERMINAL_SERVER: NTSTATUS = 0xA; +pub const FACILITY_SXS_ERROR_CODE: NTSTATUS = 0x15; +pub const FACILITY_NTSSPI: NTSTATUS = 0x9; +pub const FACILITY_SPACES: NTSTATUS = 0xE7; +pub const FACILITY_SMB: NTSTATUS = 0x5D; +pub const FACILITY_SYSTEM_INTEGRITY: NTSTATUS = 0xE9; +pub const FACILITY_SHARED_VHDX: NTSTATUS = 0x5C; +pub const FACILITY_SECUREBOOT: NTSTATUS = 0x43; +pub const FACILITY_SECURITY_CORE: NTSTATUS = 0xE8; +pub const FACILITY_SDBUS: NTSTATUS = 0x51; +pub const FACILITY_RTPM: NTSTATUS = 0x2A; +pub const FACILITY_RPC_STUBS: NTSTATUS = 0x3; +pub const FACILITY_RPC_RUNTIME: NTSTATUS = 0x2; +pub const FACILITY_RESUME_KEY_FILTER: NTSTATUS = 0x40; +pub const FACILITY_RDBSS: NTSTATUS = 0x41; +pub const FACILITY_PLATFORM_MANIFEST: NTSTATUS = 0xEB; +pub const FACILITY_NTWIN32: NTSTATUS = 0x7; +pub const FACILITY_WIN32K_NTUSER: NTSTATUS = 0x3E; +pub const FACILITY_WIN32K_NTGDI: NTSTATUS = 0x3F; +pub const FACILITY_NDIS_ERROR_CODE: NTSTATUS = 0x23; +pub const FACILTIY_MUI_ERROR_CODE: NTSTATUS = 0xB; +pub const FACILITY_MONITOR: NTSTATUS = 0x1D; +pub const FACILITY_MAXIMUM_VALUE: NTSTATUS = 0xEC; +pub const FACILITY_LICENSING: NTSTATUS = 0xEA; +pub const FACILITY_IPSEC: NTSTATUS = 0x36; +pub const FACILITY_IO_ERROR_CODE: NTSTATUS = 0x4; +pub const FACILITY_INTERIX: NTSTATUS = 0x99; +pub const FACILITY_HYPERVISOR: NTSTATUS = 0x35; +pub const FACILITY_HID_ERROR_CODE: NTSTATUS = 0x11; +pub const FACILITY_GRAPHICS_KERNEL: NTSTATUS = 0x1E; +pub const FACILITY_FWP_ERROR_CODE: NTSTATUS = 0x22; +pub const FACILITY_FVE_ERROR_CODE: NTSTATUS = 0x21; +pub const FACILITY_FIREWIRE_ERROR_CODE: NTSTATUS = 0x12; +pub const FACILITY_FILTER_MANAGER: NTSTATUS = 0x1C; +pub const FACILITY_DRIVER_FRAMEWORK: NTSTATUS = 0x20; +pub const FACILITY_DEBUGGER: NTSTATUS = 0x1; +pub const FACILITY_COMMONLOG: NTSTATUS = 0x1A; +pub const FACILITY_CODCLASS_ERROR_CODE: NTSTATUS = 0x6; +pub const FACILITY_CLUSTER_ERROR_CODE: NTSTATUS = 0x13; +pub const FACILITY_NTCERT: NTSTATUS = 0x8; +pub const FACILITY_BTH_ATT: NTSTATUS = 0x42; +pub const FACILITY_BCD_ERROR_CODE: NTSTATUS = 0x39; +pub const FACILITY_AUDIO_KERNEL: NTSTATUS = 0x44; +pub const FACILITY_ACPI_ERROR_CODE: NTSTATUS = 0x14; +pub const STATUS_SEVERITY_WARNING: NTSTATUS = 0x2; +pub const STATUS_SEVERITY_SUCCESS: NTSTATUS = 0x0; +pub const STATUS_SEVERITY_INFORMATIONAL: NTSTATUS = 0x1; +pub const STATUS_SEVERITY_ERROR: NTSTATUS = 0x3; +pub const STATUS_SUCCESS: NTSTATUS = 0x00000000; +pub const STATUS_WAIT_1: NTSTATUS = 0x00000001; +pub const STATUS_WAIT_2: NTSTATUS = 0x00000002; +pub const STATUS_WAIT_3: NTSTATUS = 0x00000003; +pub const STATUS_WAIT_63: NTSTATUS = 0x0000003F; +pub const STATUS_ABANDONED: NTSTATUS = 0x00000080; +pub const STATUS_ABANDONED_WAIT_0: NTSTATUS = 0x00000080; +pub const STATUS_ABANDONED_WAIT_63: NTSTATUS = 0x000000BF; +pub const STATUS_USER_APC: NTSTATUS = 0x000000C0; +pub const STATUS_ALREADY_COMPLETE: NTSTATUS = 0x000000FF; +pub const STATUS_KERNEL_APC: NTSTATUS = 0x00000100; +pub const STATUS_ALERTED: NTSTATUS = 0x00000101; +pub const STATUS_TIMEOUT: NTSTATUS = 0x00000102; +pub const STATUS_PENDING: NTSTATUS = 0x00000103; +pub const STATUS_REPARSE: NTSTATUS = 0x00000104; +pub const STATUS_MORE_ENTRIES: NTSTATUS = 0x00000105; +pub const STATUS_NOT_ALL_ASSIGNED: NTSTATUS = 0x00000106; +pub const STATUS_SOME_NOT_MAPPED: NTSTATUS = 0x00000107; +pub const STATUS_OPLOCK_BREAK_IN_PROGRESS: NTSTATUS = 0x00000108; +pub const STATUS_VOLUME_MOUNTED: NTSTATUS = 0x00000109; +pub const STATUS_RXACT_COMMITTED: NTSTATUS = 0x0000010A; +pub const STATUS_NOTIFY_CLEANUP: NTSTATUS = 0x0000010B; +pub const STATUS_NOTIFY_ENUM_DIR: NTSTATUS = 0x0000010C; +pub const STATUS_NO_QUOTAS_FOR_ACCOUNT: NTSTATUS = 0x0000010D; +pub const STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED: NTSTATUS = 0x0000010E; +pub const STATUS_PAGE_FAULT_TRANSITION: NTSTATUS = 0x00000110; +pub const STATUS_PAGE_FAULT_DEMAND_ZERO: NTSTATUS = 0x00000111; +pub const STATUS_PAGE_FAULT_COPY_ON_WRITE: NTSTATUS = 0x00000112; +pub const STATUS_PAGE_FAULT_GUARD_PAGE: NTSTATUS = 0x00000113; +pub const STATUS_PAGE_FAULT_PAGING_FILE: NTSTATUS = 0x00000114; +pub const STATUS_CACHE_PAGE_LOCKED: NTSTATUS = 0x00000115; +pub const STATUS_CRASH_DUMP: NTSTATUS = 0x00000116; +pub const STATUS_BUFFER_ALL_ZEROS: NTSTATUS = 0x00000117; +pub const STATUS_REPARSE_OBJECT: NTSTATUS = 0x00000118; +pub const STATUS_RESOURCE_REQUIREMENTS_CHANGED: NTSTATUS = 0x00000119; +pub const STATUS_TRANSLATION_COMPLETE: NTSTATUS = 0x00000120; +pub const STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY: NTSTATUS = 0x00000121; +pub const STATUS_NOTHING_TO_TERMINATE: NTSTATUS = 0x00000122; +pub const STATUS_PROCESS_NOT_IN_JOB: NTSTATUS = 0x00000123; +pub const STATUS_PROCESS_IN_JOB: NTSTATUS = 0x00000124; +pub const STATUS_VOLSNAP_HIBERNATE_READY: NTSTATUS = 0x00000125; +pub const STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY: NTSTATUS = 0x00000126; +pub const STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED: NTSTATUS = 0x00000127; +pub const STATUS_INTERRUPT_STILL_CONNECTED: NTSTATUS = 0x00000128; +pub const STATUS_PROCESS_CLONED: NTSTATUS = 0x00000129; +pub const STATUS_FILE_LOCKED_WITH_ONLY_READERS: NTSTATUS = 0x0000012A; +pub const STATUS_FILE_LOCKED_WITH_WRITERS: NTSTATUS = 0x0000012B; +pub const STATUS_VALID_IMAGE_HASH: NTSTATUS = 0x0000012C; +pub const STATUS_VALID_CATALOG_HASH: NTSTATUS = 0x0000012D; +pub const STATUS_VALID_STRONG_CODE_HASH: NTSTATUS = 0x0000012E; +pub const STATUS_GHOSTED: NTSTATUS = 0x0000012F; +pub const STATUS_RESOURCEMANAGER_READ_ONLY: NTSTATUS = 0x00000202; +pub const STATUS_RING_PREVIOUSLY_EMPTY: NTSTATUS = 0x00000210; +pub const STATUS_RING_PREVIOUSLY_FULL: NTSTATUS = 0x00000211; +pub const STATUS_RING_PREVIOUSLY_ABOVE_QUOTA: NTSTATUS = 0x00000212; +pub const STATUS_RING_NEWLY_EMPTY: NTSTATUS = 0x00000213; +pub const STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT: NTSTATUS = 0x00000214; +pub const STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE: NTSTATUS = 0x00000215; +pub const STATUS_OPLOCK_HANDLE_CLOSED: NTSTATUS = 0x00000216; +pub const STATUS_WAIT_FOR_OPLOCK: NTSTATUS = 0x00000367; +pub const STATUS_REPARSE_GLOBAL: NTSTATUS = 0x00000368; +pub const DBG_EXCEPTION_HANDLED: NTSTATUS = 0x00010001; +pub const DBG_CONTINUE: NTSTATUS = 0x00010002; +pub const STATUS_FLT_IO_COMPLETE: NTSTATUS = 0x001C0001; +pub const STATUS_OBJECT_NAME_EXISTS: NTSTATUS = 0x40000000; +pub const STATUS_THREAD_WAS_SUSPENDED: NTSTATUS = 0x40000001; +pub const STATUS_WORKING_SET_LIMIT_RANGE: NTSTATUS = 0x40000002; +pub const STATUS_IMAGE_NOT_AT_BASE: NTSTATUS = 0x40000003; +pub const STATUS_RXACT_STATE_CREATED: NTSTATUS = 0x40000004; +pub const STATUS_SEGMENT_NOTIFICATION: NTSTATUS = 0x40000005; +pub const STATUS_LOCAL_USER_SESSION_KEY: NTSTATUS = 0x40000006; +pub const STATUS_BAD_CURRENT_DIRECTORY: NTSTATUS = 0x40000007; +pub const STATUS_SERIAL_MORE_WRITES: NTSTATUS = 0x40000008; +pub const STATUS_REGISTRY_RECOVERED: NTSTATUS = 0x40000009; +pub const STATUS_FT_READ_RECOVERY_FROM_BACKUP: NTSTATUS = 0x4000000A; +pub const STATUS_FT_WRITE_RECOVERY: NTSTATUS = 0x4000000B; +pub const STATUS_SERIAL_COUNTER_TIMEOUT: NTSTATUS = 0x4000000C; +pub const STATUS_NULL_LM_PASSWORD: NTSTATUS = 0x4000000D; +pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH: NTSTATUS = 0x4000000E; +pub const STATUS_RECEIVE_PARTIAL: NTSTATUS = 0x4000000F; +pub const STATUS_RECEIVE_EXPEDITED: NTSTATUS = 0x40000010; +pub const STATUS_RECEIVE_PARTIAL_EXPEDITED: NTSTATUS = 0x40000011; +pub const STATUS_EVENT_DONE: NTSTATUS = 0x40000012; +pub const STATUS_EVENT_PENDING: NTSTATUS = 0x40000013; +pub const STATUS_CHECKING_FILE_SYSTEM: NTSTATUS = 0x40000014; +pub const STATUS_FATAL_APP_EXIT: NTSTATUS = 0x40000015; +pub const STATUS_PREDEFINED_HANDLE: NTSTATUS = 0x40000016; +pub const STATUS_WAS_UNLOCKED: NTSTATUS = 0x40000017; +pub const STATUS_SERVICE_NOTIFICATION: NTSTATUS = 0x40000018; +pub const STATUS_WAS_LOCKED: NTSTATUS = 0x40000019; +pub const STATUS_LOG_HARD_ERROR: NTSTATUS = 0x4000001A; +pub const STATUS_ALREADY_WIN32: NTSTATUS = 0x4000001B; +pub const STATUS_WX86_UNSIMULATE: NTSTATUS = 0x4000001C; +pub const STATUS_WX86_CONTINUE: NTSTATUS = 0x4000001D; +pub const STATUS_WX86_SINGLE_STEP: NTSTATUS = 0x4000001E; +pub const STATUS_WX86_BREAKPOINT: NTSTATUS = 0x4000001F; +pub const STATUS_WX86_EXCEPTION_CONTINUE: NTSTATUS = 0x40000020; +pub const STATUS_WX86_EXCEPTION_LASTCHANCE: NTSTATUS = 0x40000021; +pub const STATUS_WX86_EXCEPTION_CHAIN: NTSTATUS = 0x40000022; +pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE: NTSTATUS = 0x40000023; +pub const STATUS_NO_YIELD_PERFORMED: NTSTATUS = 0x40000024; +pub const STATUS_TIMER_RESUME_IGNORED: NTSTATUS = 0x40000025; +pub const STATUS_ARBITRATION_UNHANDLED: NTSTATUS = 0x40000026; +pub const STATUS_CARDBUS_NOT_SUPPORTED: NTSTATUS = 0x40000027; +pub const STATUS_WX86_CREATEWX86TIB: NTSTATUS = 0x40000028; +pub const STATUS_MP_PROCESSOR_MISMATCH: NTSTATUS = 0x40000029; +pub const STATUS_HIBERNATED: NTSTATUS = 0x4000002A; +pub const STATUS_RESUME_HIBERNATION: NTSTATUS = 0x4000002B; +pub const STATUS_FIRMWARE_UPDATED: NTSTATUS = 0x4000002C; +pub const STATUS_DRIVERS_LEAKING_LOCKED_PAGES: NTSTATUS = 0x4000002D; +pub const STATUS_MESSAGE_RETRIEVED: NTSTATUS = 0x4000002E; +pub const STATUS_SYSTEM_POWERSTATE_TRANSITION: NTSTATUS = 0x4000002F; +pub const STATUS_ALPC_CHECK_COMPLETION_LIST: NTSTATUS = 0x40000030; +pub const STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: NTSTATUS = 0x40000031; +pub const STATUS_ACCESS_AUDIT_BY_POLICY: NTSTATUS = 0x40000032; +pub const STATUS_ABANDON_HIBERFILE: NTSTATUS = 0x40000033; +pub const STATUS_BIZRULES_NOT_ENABLED: NTSTATUS = 0x40000034; +pub const STATUS_FT_READ_FROM_COPY: NTSTATUS = 0x40000035; +pub const STATUS_IMAGE_AT_DIFFERENT_BASE: NTSTATUS = 0x40000036; +pub const DBG_REPLY_LATER: NTSTATUS = 0x40010001; +pub const DBG_UNABLE_TO_PROVIDE_HANDLE: NTSTATUS = 0x40010002; +pub const DBG_TERMINATE_THREAD: NTSTATUS = 0x40010003; +pub const DBG_TERMINATE_PROCESS: NTSTATUS = 0x40010004; +pub const DBG_CONTROL_C: NTSTATUS = 0x40010005; +pub const DBG_PRINTEXCEPTION_C: NTSTATUS = 0x40010006; +pub const DBG_RIPEXCEPTION: NTSTATUS = 0x40010007; +pub const DBG_CONTROL_BREAK: NTSTATUS = 0x40010008; +pub const DBG_COMMAND_EXCEPTION: NTSTATUS = 0x40010009; +pub const DBG_PRINTEXCEPTION_WIDE_C: NTSTATUS = 0x4001000A; +pub const STATUS_HEURISTIC_DAMAGE_POSSIBLE: NTSTATUS = 0x40190001; +pub const STATUS_GUARD_PAGE_VIOLATION: NTSTATUS = 0x80000001; +pub const STATUS_DATATYPE_MISALIGNMENT: NTSTATUS = 0x80000002; +pub const STATUS_BREAKPOINT: NTSTATUS = 0x80000003; +pub const STATUS_SINGLE_STEP: NTSTATUS = 0x80000004; +pub const STATUS_BUFFER_OVERFLOW: NTSTATUS = 0x80000005; +pub const STATUS_NO_MORE_FILES: NTSTATUS = 0x80000006; +pub const STATUS_WAKE_SYSTEM_DEBUGGER: NTSTATUS = 0x80000007; +pub const STATUS_HANDLES_CLOSED: NTSTATUS = 0x8000000A; +pub const STATUS_NO_INHERITANCE: NTSTATUS = 0x8000000B; +pub const STATUS_GUID_SUBSTITUTION_MADE: NTSTATUS = 0x8000000C; +pub const STATUS_PARTIAL_COPY: NTSTATUS = 0x8000000D; +pub const STATUS_DEVICE_PAPER_EMPTY: NTSTATUS = 0x8000000E; +pub const STATUS_DEVICE_POWERED_OFF: NTSTATUS = 0x8000000F; +pub const STATUS_DEVICE_OFF_LINE: NTSTATUS = 0x80000010; +pub const STATUS_DEVICE_BUSY: NTSTATUS = 0x80000011; +pub const STATUS_NO_MORE_EAS: NTSTATUS = 0x80000012; +pub const STATUS_INVALID_EA_NAME: NTSTATUS = 0x80000013; +pub const STATUS_EA_LIST_INCONSISTENT: NTSTATUS = 0x80000014; +pub const STATUS_INVALID_EA_FLAG: NTSTATUS = 0x80000015; +pub const STATUS_VERIFY_REQUIRED: NTSTATUS = 0x80000016; +pub const STATUS_EXTRANEOUS_INFORMATION: NTSTATUS = 0x80000017; +pub const STATUS_RXACT_COMMIT_NECESSARY: NTSTATUS = 0x80000018; +pub const STATUS_NO_MORE_ENTRIES: NTSTATUS = 0x8000001A; +pub const STATUS_FILEMARK_DETECTED: NTSTATUS = 0x8000001B; +pub const STATUS_MEDIA_CHANGED: NTSTATUS = 0x8000001C; +pub const STATUS_BUS_RESET: NTSTATUS = 0x8000001D; +pub const STATUS_END_OF_MEDIA: NTSTATUS = 0x8000001E; +pub const STATUS_BEGINNING_OF_MEDIA: NTSTATUS = 0x8000001F; +pub const STATUS_MEDIA_CHECK: NTSTATUS = 0x80000020; +pub const STATUS_SETMARK_DETECTED: NTSTATUS = 0x80000021; +pub const STATUS_NO_DATA_DETECTED: NTSTATUS = 0x80000022; +pub const STATUS_REDIRECTOR_HAS_OPEN_HANDLES: NTSTATUS = 0x80000023; +pub const STATUS_SERVER_HAS_OPEN_HANDLES: NTSTATUS = 0x80000024; +pub const STATUS_ALREADY_DISCONNECTED: NTSTATUS = 0x80000025; +pub const STATUS_LONGJUMP: NTSTATUS = 0x80000026; +pub const STATUS_CLEANER_CARTRIDGE_INSTALLED: NTSTATUS = 0x80000027; +pub const STATUS_PLUGPLAY_QUERY_VETOED: NTSTATUS = 0x80000028; +pub const STATUS_UNWIND_CONSOLIDATE: NTSTATUS = 0x80000029; +pub const STATUS_REGISTRY_HIVE_RECOVERED: NTSTATUS = 0x8000002A; +pub const STATUS_DLL_MIGHT_BE_INSECURE: NTSTATUS = 0x8000002B; +pub const STATUS_DLL_MIGHT_BE_INCOMPATIBLE: NTSTATUS = 0x8000002C; +pub const STATUS_STOPPED_ON_SYMLINK: NTSTATUS = 0x8000002D; +pub const STATUS_CANNOT_GRANT_REQUESTED_OPLOCK: NTSTATUS = 0x8000002E; +pub const STATUS_NO_ACE_CONDITION: NTSTATUS = 0x8000002F; +pub const STATUS_DEVICE_SUPPORT_IN_PROGRESS: NTSTATUS = 0x80000030; +pub const STATUS_DEVICE_POWER_CYCLE_REQUIRED: NTSTATUS = 0x80000031; +pub const STATUS_NO_WORK_DONE: NTSTATUS = 0x80000032; +pub const DBG_EXCEPTION_NOT_HANDLED: NTSTATUS = 0x80010001; +pub const STATUS_CLUSTER_NODE_ALREADY_UP: NTSTATUS = 0x80130001; +pub const STATUS_CLUSTER_NODE_ALREADY_DOWN: NTSTATUS = 0x80130002; +pub const STATUS_CLUSTER_NETWORK_ALREADY_ONLINE: NTSTATUS = 0x80130003; +pub const STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE: NTSTATUS = 0x80130004; +pub const STATUS_CLUSTER_NODE_ALREADY_MEMBER: NTSTATUS = 0x80130005; +pub const STATUS_FLT_BUFFER_TOO_SMALL: NTSTATUS = 0x801C0001; +pub const STATUS_FVE_PARTIAL_METADATA: NTSTATUS = 0x80210001; +pub const STATUS_FVE_TRANSIENT_STATE: NTSTATUS = 0x80210002; +pub const STATUS_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH: NTSTATUS = 0x8000CF00; +pub const STATUS_UNSUCCESSFUL: NTSTATUS = 0xC0000001; +pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = 0xC0000002; +pub const STATUS_INVALID_INFO_CLASS: NTSTATUS = 0xC0000003; +pub const STATUS_INFO_LENGTH_MISMATCH: NTSTATUS = 0xC0000004; +pub const STATUS_ACCESS_VIOLATION: NTSTATUS = 0xC0000005; +pub const STATUS_IN_PAGE_ERROR: NTSTATUS = 0xC0000006; +pub const STATUS_PAGEFILE_QUOTA: NTSTATUS = 0xC0000007; +pub const STATUS_INVALID_HANDLE: NTSTATUS = 0xC0000008; +pub const STATUS_BAD_INITIAL_STACK: NTSTATUS = 0xC0000009; +pub const STATUS_BAD_INITIAL_PC: NTSTATUS = 0xC000000A; +pub const STATUS_INVALID_CID: NTSTATUS = 0xC000000B; +pub const STATUS_TIMER_NOT_CANCELED: NTSTATUS = 0xC000000C; +pub const STATUS_INVALID_PARAMETER: NTSTATUS = 0xC000000D; +pub const STATUS_NO_SUCH_DEVICE: NTSTATUS = 0xC000000E; +pub const STATUS_NO_SUCH_FILE: NTSTATUS = 0xC000000F; +pub const STATUS_INVALID_DEVICE_REQUEST: NTSTATUS = 0xC0000010; +pub const STATUS_END_OF_FILE: NTSTATUS = 0xC0000011; +pub const STATUS_WRONG_VOLUME: NTSTATUS = 0xC0000012; +pub const STATUS_NO_MEDIA_IN_DEVICE: NTSTATUS = 0xC0000013; +pub const STATUS_UNRECOGNIZED_MEDIA: NTSTATUS = 0xC0000014; +pub const STATUS_NONEXISTENT_SECTOR: NTSTATUS = 0xC0000015; +pub const STATUS_MORE_PROCESSING_REQUIRED: NTSTATUS = 0xC0000016; +pub const STATUS_NO_MEMORY: NTSTATUS = 0xC0000017; +pub const STATUS_CONFLICTING_ADDRESSES: NTSTATUS = 0xC0000018; +pub const STATUS_NOT_MAPPED_VIEW: NTSTATUS = 0xC0000019; +pub const STATUS_UNABLE_TO_FREE_VM: NTSTATUS = 0xC000001A; +pub const STATUS_UNABLE_TO_DELETE_SECTION: NTSTATUS = 0xC000001B; +pub const STATUS_INVALID_SYSTEM_SERVICE: NTSTATUS = 0xC000001C; +pub const STATUS_ILLEGAL_INSTRUCTION: NTSTATUS = 0xC000001D; +pub const STATUS_INVALID_LOCK_SEQUENCE: NTSTATUS = 0xC000001E; +pub const STATUS_INVALID_VIEW_SIZE: NTSTATUS = 0xC000001F; +pub const STATUS_INVALID_FILE_FOR_SECTION: NTSTATUS = 0xC0000020; +pub const STATUS_ALREADY_COMMITTED: NTSTATUS = 0xC0000021; +pub const STATUS_ACCESS_DENIED: NTSTATUS = 0xC0000022; +pub const STATUS_BUFFER_TOO_SMALL: NTSTATUS = 0xC0000023; +pub const STATUS_OBJECT_TYPE_MISMATCH: NTSTATUS = 0xC0000024; +pub const STATUS_NONCONTINUABLE_EXCEPTION: NTSTATUS = 0xC0000025; +pub const STATUS_INVALID_DISPOSITION: NTSTATUS = 0xC0000026; +pub const STATUS_UNWIND: NTSTATUS = 0xC0000027; +pub const STATUS_BAD_STACK: NTSTATUS = 0xC0000028; +pub const STATUS_INVALID_UNWIND_TARGET: NTSTATUS = 0xC0000029; +pub const STATUS_NOT_LOCKED: NTSTATUS = 0xC000002A; +pub const STATUS_PARITY_ERROR: NTSTATUS = 0xC000002B; +pub const STATUS_UNABLE_TO_DECOMMIT_VM: NTSTATUS = 0xC000002C; +pub const STATUS_NOT_COMMITTED: NTSTATUS = 0xC000002D; +pub const STATUS_INVALID_PORT_ATTRIBUTES: NTSTATUS = 0xC000002E; +pub const STATUS_PORT_MESSAGE_TOO_LONG: NTSTATUS = 0xC000002F; +pub const STATUS_INVALID_PARAMETER_MIX: NTSTATUS = 0xC0000030; +pub const STATUS_INVALID_QUOTA_LOWER: NTSTATUS = 0xC0000031; +pub const STATUS_DISK_CORRUPT_ERROR: NTSTATUS = 0xC0000032; +pub const STATUS_OBJECT_NAME_INVALID: NTSTATUS = 0xC0000033; +pub const STATUS_OBJECT_NAME_NOT_FOUND: NTSTATUS = 0xC0000034; +pub const STATUS_OBJECT_NAME_COLLISION: NTSTATUS = 0xC0000035; +pub const STATUS_PORT_DO_NOT_DISTURB: NTSTATUS = 0xC0000036; +pub const STATUS_PORT_DISCONNECTED: NTSTATUS = 0xC0000037; +pub const STATUS_DEVICE_ALREADY_ATTACHED: NTSTATUS = 0xC0000038; +pub const STATUS_OBJECT_PATH_INVALID: NTSTATUS = 0xC0000039; +pub const STATUS_OBJECT_PATH_NOT_FOUND: NTSTATUS = 0xC000003A; +pub const STATUS_OBJECT_PATH_SYNTAX_BAD: NTSTATUS = 0xC000003B; +pub const STATUS_DATA_OVERRUN: NTSTATUS = 0xC000003C; +pub const STATUS_DATA_LATE_ERROR: NTSTATUS = 0xC000003D; +pub const STATUS_DATA_ERROR: NTSTATUS = 0xC000003E; +pub const STATUS_CRC_ERROR: NTSTATUS = 0xC000003F; +pub const STATUS_SECTION_TOO_BIG: NTSTATUS = 0xC0000040; +pub const STATUS_PORT_CONNECTION_REFUSED: NTSTATUS = 0xC0000041; +pub const STATUS_INVALID_PORT_HANDLE: NTSTATUS = 0xC0000042; +pub const STATUS_SHARING_VIOLATION: NTSTATUS = 0xC0000043; +pub const STATUS_QUOTA_EXCEEDED: NTSTATUS = 0xC0000044; +pub const STATUS_INVALID_PAGE_PROTECTION: NTSTATUS = 0xC0000045; +pub const STATUS_MUTANT_NOT_OWNED: NTSTATUS = 0xC0000046; +pub const STATUS_SEMAPHORE_LIMIT_EXCEEDED: NTSTATUS = 0xC0000047; +pub const STATUS_PORT_ALREADY_SET: NTSTATUS = 0xC0000048; +pub const STATUS_SECTION_NOT_IMAGE: NTSTATUS = 0xC0000049; +pub const STATUS_SUSPEND_COUNT_EXCEEDED: NTSTATUS = 0xC000004A; +pub const STATUS_THREAD_IS_TERMINATING: NTSTATUS = 0xC000004B; +pub const STATUS_BAD_WORKING_SET_LIMIT: NTSTATUS = 0xC000004C; +pub const STATUS_INCOMPATIBLE_FILE_MAP: NTSTATUS = 0xC000004D; +pub const STATUS_SECTION_PROTECTION: NTSTATUS = 0xC000004E; +pub const STATUS_EAS_NOT_SUPPORTED: NTSTATUS = 0xC000004F; +pub const STATUS_EA_TOO_LARGE: NTSTATUS = 0xC0000050; +pub const STATUS_NONEXISTENT_EA_ENTRY: NTSTATUS = 0xC0000051; +pub const STATUS_NO_EAS_ON_FILE: NTSTATUS = 0xC0000052; +pub const STATUS_EA_CORRUPT_ERROR: NTSTATUS = 0xC0000053; +pub const STATUS_FILE_LOCK_CONFLICT: NTSTATUS = 0xC0000054; +pub const STATUS_LOCK_NOT_GRANTED: NTSTATUS = 0xC0000055; +pub const STATUS_DELETE_PENDING: NTSTATUS = 0xC0000056; +pub const STATUS_CTL_FILE_NOT_SUPPORTED: NTSTATUS = 0xC0000057; +pub const STATUS_UNKNOWN_REVISION: NTSTATUS = 0xC0000058; +pub const STATUS_REVISION_MISMATCH: NTSTATUS = 0xC0000059; +pub const STATUS_INVALID_OWNER: NTSTATUS = 0xC000005A; +pub const STATUS_INVALID_PRIMARY_GROUP: NTSTATUS = 0xC000005B; +pub const STATUS_NO_IMPERSONATION_TOKEN: NTSTATUS = 0xC000005C; +pub const STATUS_CANT_DISABLE_MANDATORY: NTSTATUS = 0xC000005D; +pub const STATUS_NO_LOGON_SERVERS: NTSTATUS = 0xC000005E; +pub const STATUS_NO_SUCH_LOGON_SESSION: NTSTATUS = 0xC000005F; +pub const STATUS_NO_SUCH_PRIVILEGE: NTSTATUS = 0xC0000060; +pub const STATUS_PRIVILEGE_NOT_HELD: NTSTATUS = 0xC0000061; +pub const STATUS_INVALID_ACCOUNT_NAME: NTSTATUS = 0xC0000062; +pub const STATUS_USER_EXISTS: NTSTATUS = 0xC0000063; +pub const STATUS_NO_SUCH_USER: NTSTATUS = 0xC0000064; +pub const STATUS_GROUP_EXISTS: NTSTATUS = 0xC0000065; +pub const STATUS_NO_SUCH_GROUP: NTSTATUS = 0xC0000066; +pub const STATUS_MEMBER_IN_GROUP: NTSTATUS = 0xC0000067; +pub const STATUS_MEMBER_NOT_IN_GROUP: NTSTATUS = 0xC0000068; +pub const STATUS_LAST_ADMIN: NTSTATUS = 0xC0000069; +pub const STATUS_WRONG_PASSWORD: NTSTATUS = 0xC000006A; +pub const STATUS_ILL_FORMED_PASSWORD: NTSTATUS = 0xC000006B; +pub const STATUS_PASSWORD_RESTRICTION: NTSTATUS = 0xC000006C; +pub const STATUS_LOGON_FAILURE: NTSTATUS = 0xC000006D; +pub const STATUS_ACCOUNT_RESTRICTION: NTSTATUS = 0xC000006E; +pub const STATUS_INVALID_LOGON_HOURS: NTSTATUS = 0xC000006F; +pub const STATUS_INVALID_WORKSTATION: NTSTATUS = 0xC0000070; +pub const STATUS_PASSWORD_EXPIRED: NTSTATUS = 0xC0000071; +pub const STATUS_ACCOUNT_DISABLED: NTSTATUS = 0xC0000072; +pub const STATUS_NONE_MAPPED: NTSTATUS = 0xC0000073; +pub const STATUS_TOO_MANY_LUIDS_REQUESTED: NTSTATUS = 0xC0000074; +pub const STATUS_LUIDS_EXHAUSTED: NTSTATUS = 0xC0000075; +pub const STATUS_INVALID_SUB_AUTHORITY: NTSTATUS = 0xC0000076; +pub const STATUS_INVALID_ACL: NTSTATUS = 0xC0000077; +pub const STATUS_INVALID_SID: NTSTATUS = 0xC0000078; +pub const STATUS_INVALID_SECURITY_DESCR: NTSTATUS = 0xC0000079; +pub const STATUS_PROCEDURE_NOT_FOUND: NTSTATUS = 0xC000007A; +pub const STATUS_INVALID_IMAGE_FORMAT: NTSTATUS = 0xC000007B; +pub const STATUS_NO_TOKEN: NTSTATUS = 0xC000007C; +pub const STATUS_BAD_INHERITANCE_ACL: NTSTATUS = 0xC000007D; +pub const STATUS_RANGE_NOT_LOCKED: NTSTATUS = 0xC000007E; +pub const STATUS_DISK_FULL: NTSTATUS = 0xC000007F; +pub const STATUS_SERVER_DISABLED: NTSTATUS = 0xC0000080; +pub const STATUS_SERVER_NOT_DISABLED: NTSTATUS = 0xC0000081; +pub const STATUS_TOO_MANY_GUIDS_REQUESTED: NTSTATUS = 0xC0000082; +pub const STATUS_GUIDS_EXHAUSTED: NTSTATUS = 0xC0000083; +pub const STATUS_INVALID_ID_AUTHORITY: NTSTATUS = 0xC0000084; +pub const STATUS_AGENTS_EXHAUSTED: NTSTATUS = 0xC0000085; +pub const STATUS_INVALID_VOLUME_LABEL: NTSTATUS = 0xC0000086; +pub const STATUS_SECTION_NOT_EXTENDED: NTSTATUS = 0xC0000087; +pub const STATUS_NOT_MAPPED_DATA: NTSTATUS = 0xC0000088; +pub const STATUS_RESOURCE_DATA_NOT_FOUND: NTSTATUS = 0xC0000089; +pub const STATUS_RESOURCE_TYPE_NOT_FOUND: NTSTATUS = 0xC000008A; +pub const STATUS_RESOURCE_NAME_NOT_FOUND: NTSTATUS = 0xC000008B; +pub const STATUS_ARRAY_BOUNDS_EXCEEDED: NTSTATUS = 0xC000008C; +pub const STATUS_FLOAT_DENORMAL_OPERAND: NTSTATUS = 0xC000008D; +pub const STATUS_FLOAT_DIVIDE_BY_ZERO: NTSTATUS = 0xC000008E; +pub const STATUS_FLOAT_INEXACT_RESULT: NTSTATUS = 0xC000008F; +pub const STATUS_FLOAT_INVALID_OPERATION: NTSTATUS = 0xC0000090; +pub const STATUS_FLOAT_OVERFLOW: NTSTATUS = 0xC0000091; +pub const STATUS_FLOAT_STACK_CHECK: NTSTATUS = 0xC0000092; +pub const STATUS_FLOAT_UNDERFLOW: NTSTATUS = 0xC0000093; +pub const STATUS_INTEGER_DIVIDE_BY_ZERO: NTSTATUS = 0xC0000094; +pub const STATUS_INTEGER_OVERFLOW: NTSTATUS = 0xC0000095; +pub const STATUS_PRIVILEGED_INSTRUCTION: NTSTATUS = 0xC0000096; +pub const STATUS_TOO_MANY_PAGING_FILES: NTSTATUS = 0xC0000097; +pub const STATUS_FILE_INVALID: NTSTATUS = 0xC0000098; +pub const STATUS_ALLOTTED_SPACE_EXCEEDED: NTSTATUS = 0xC0000099; +pub const STATUS_INSUFFICIENT_RESOURCES: NTSTATUS = 0xC000009A; +pub const STATUS_DFS_EXIT_PATH_FOUND: NTSTATUS = 0xC000009B; +pub const STATUS_DEVICE_DATA_ERROR: NTSTATUS = 0xC000009C; +pub const STATUS_DEVICE_NOT_CONNECTED: NTSTATUS = 0xC000009D; +pub const STATUS_DEVICE_POWER_FAILURE: NTSTATUS = 0xC000009E; +pub const STATUS_FREE_VM_NOT_AT_BASE: NTSTATUS = 0xC000009F; +pub const STATUS_MEMORY_NOT_ALLOCATED: NTSTATUS = 0xC00000A0; +pub const STATUS_WORKING_SET_QUOTA: NTSTATUS = 0xC00000A1; +pub const STATUS_MEDIA_WRITE_PROTECTED: NTSTATUS = 0xC00000A2; +pub const STATUS_DEVICE_NOT_READY: NTSTATUS = 0xC00000A3; +pub const STATUS_INVALID_GROUP_ATTRIBUTES: NTSTATUS = 0xC00000A4; +pub const STATUS_BAD_IMPERSONATION_LEVEL: NTSTATUS = 0xC00000A5; +pub const STATUS_CANT_OPEN_ANONYMOUS: NTSTATUS = 0xC00000A6; +pub const STATUS_BAD_VALIDATION_CLASS: NTSTATUS = 0xC00000A7; +pub const STATUS_BAD_TOKEN_TYPE: NTSTATUS = 0xC00000A8; +pub const STATUS_BAD_MASTER_BOOT_RECORD: NTSTATUS = 0xC00000A9; +pub const STATUS_INSTRUCTION_MISALIGNMENT: NTSTATUS = 0xC00000AA; +pub const STATUS_INSTANCE_NOT_AVAILABLE: NTSTATUS = 0xC00000AB; +pub const STATUS_PIPE_NOT_AVAILABLE: NTSTATUS = 0xC00000AC; +pub const STATUS_INVALID_PIPE_STATE: NTSTATUS = 0xC00000AD; +pub const STATUS_PIPE_BUSY: NTSTATUS = 0xC00000AE; +pub const STATUS_ILLEGAL_FUNCTION: NTSTATUS = 0xC00000AF; +pub const STATUS_PIPE_DISCONNECTED: NTSTATUS = 0xC00000B0; +pub const STATUS_PIPE_CLOSING: NTSTATUS = 0xC00000B1; +pub const STATUS_PIPE_CONNECTED: NTSTATUS = 0xC00000B2; +pub const STATUS_PIPE_LISTENING: NTSTATUS = 0xC00000B3; +pub const STATUS_INVALID_READ_MODE: NTSTATUS = 0xC00000B4; +pub const STATUS_IO_TIMEOUT: NTSTATUS = 0xC00000B5; +pub const STATUS_FILE_FORCED_CLOSED: NTSTATUS = 0xC00000B6; +pub const STATUS_PROFILING_NOT_STARTED: NTSTATUS = 0xC00000B7; +pub const STATUS_PROFILING_NOT_STOPPED: NTSTATUS = 0xC00000B8; +pub const STATUS_COULD_NOT_INTERPRET: NTSTATUS = 0xC00000B9; +pub const STATUS_FILE_IS_A_DIRECTORY: NTSTATUS = 0xC00000BA; +pub const STATUS_NOT_SUPPORTED: NTSTATUS = 0xC00000BB; +pub const STATUS_REMOTE_NOT_LISTENING: NTSTATUS = 0xC00000BC; +pub const STATUS_DUPLICATE_NAME: NTSTATUS = 0xC00000BD; +pub const STATUS_BAD_NETWORK_PATH: NTSTATUS = 0xC00000BE; +pub const STATUS_NETWORK_BUSY: NTSTATUS = 0xC00000BF; +pub const STATUS_DEVICE_DOES_NOT_EXIST: NTSTATUS = 0xC00000C0; +pub const STATUS_TOO_MANY_COMMANDS: NTSTATUS = 0xC00000C1; +pub const STATUS_ADAPTER_HARDWARE_ERROR: NTSTATUS = 0xC00000C2; +pub const STATUS_INVALID_NETWORK_RESPONSE: NTSTATUS = 0xC00000C3; +pub const STATUS_UNEXPECTED_NETWORK_ERROR: NTSTATUS = 0xC00000C4; +pub const STATUS_BAD_REMOTE_ADAPTER: NTSTATUS = 0xC00000C5; +pub const STATUS_PRINT_QUEUE_FULL: NTSTATUS = 0xC00000C6; +pub const STATUS_NO_SPOOL_SPACE: NTSTATUS = 0xC00000C7; +pub const STATUS_PRINT_CANCELLED: NTSTATUS = 0xC00000C8; +pub const STATUS_NETWORK_NAME_DELETED: NTSTATUS = 0xC00000C9; +pub const STATUS_NETWORK_ACCESS_DENIED: NTSTATUS = 0xC00000CA; +pub const STATUS_BAD_DEVICE_TYPE: NTSTATUS = 0xC00000CB; +pub const STATUS_BAD_NETWORK_NAME: NTSTATUS = 0xC00000CC; +pub const STATUS_TOO_MANY_NAMES: NTSTATUS = 0xC00000CD; +pub const STATUS_TOO_MANY_SESSIONS: NTSTATUS = 0xC00000CE; +pub const STATUS_SHARING_PAUSED: NTSTATUS = 0xC00000CF; +pub const STATUS_REQUEST_NOT_ACCEPTED: NTSTATUS = 0xC00000D0; +pub const STATUS_REDIRECTOR_PAUSED: NTSTATUS = 0xC00000D1; +pub const STATUS_NET_WRITE_FAULT: NTSTATUS = 0xC00000D2; +pub const STATUS_PROFILING_AT_LIMIT: NTSTATUS = 0xC00000D3; +pub const STATUS_NOT_SAME_DEVICE: NTSTATUS = 0xC00000D4; +pub const STATUS_FILE_RENAMED: NTSTATUS = 0xC00000D5; +pub const STATUS_VIRTUAL_CIRCUIT_CLOSED: NTSTATUS = 0xC00000D6; +pub const STATUS_NO_SECURITY_ON_OBJECT: NTSTATUS = 0xC00000D7; +pub const STATUS_CANT_WAIT: NTSTATUS = 0xC00000D8; +pub const STATUS_PIPE_EMPTY: NTSTATUS = 0xC00000D9; +pub const STATUS_CANT_ACCESS_DOMAIN_INFO: NTSTATUS = 0xC00000DA; +pub const STATUS_CANT_TERMINATE_SELF: NTSTATUS = 0xC00000DB; +pub const STATUS_INVALID_SERVER_STATE: NTSTATUS = 0xC00000DC; +pub const STATUS_INVALID_DOMAIN_STATE: NTSTATUS = 0xC00000DD; +pub const STATUS_INVALID_DOMAIN_ROLE: NTSTATUS = 0xC00000DE; +pub const STATUS_NO_SUCH_DOMAIN: NTSTATUS = 0xC00000DF; +pub const STATUS_DOMAIN_EXISTS: NTSTATUS = 0xC00000E0; +pub const STATUS_DOMAIN_LIMIT_EXCEEDED: NTSTATUS = 0xC00000E1; +pub const STATUS_OPLOCK_NOT_GRANTED: NTSTATUS = 0xC00000E2; +pub const STATUS_INVALID_OPLOCK_PROTOCOL: NTSTATUS = 0xC00000E3; +pub const STATUS_INTERNAL_DB_CORRUPTION: NTSTATUS = 0xC00000E4; +pub const STATUS_INTERNAL_ERROR: NTSTATUS = 0xC00000E5; +pub const STATUS_GENERIC_NOT_MAPPED: NTSTATUS = 0xC00000E6; +pub const STATUS_BAD_DESCRIPTOR_FORMAT: NTSTATUS = 0xC00000E7; +pub const STATUS_INVALID_USER_BUFFER: NTSTATUS = 0xC00000E8; +pub const STATUS_UNEXPECTED_IO_ERROR: NTSTATUS = 0xC00000E9; +pub const STATUS_UNEXPECTED_MM_CREATE_ERR: NTSTATUS = 0xC00000EA; +pub const STATUS_UNEXPECTED_MM_MAP_ERROR: NTSTATUS = 0xC00000EB; +pub const STATUS_UNEXPECTED_MM_EXTEND_ERR: NTSTATUS = 0xC00000EC; +pub const STATUS_NOT_LOGON_PROCESS: NTSTATUS = 0xC00000ED; +pub const STATUS_LOGON_SESSION_EXISTS: NTSTATUS = 0xC00000EE; +pub const STATUS_INVALID_PARAMETER_1: NTSTATUS = 0xC00000EF; +pub const STATUS_INVALID_PARAMETER_2: NTSTATUS = 0xC00000F0; +pub const STATUS_INVALID_PARAMETER_3: NTSTATUS = 0xC00000F1; +pub const STATUS_INVALID_PARAMETER_4: NTSTATUS = 0xC00000F2; +pub const STATUS_INVALID_PARAMETER_5: NTSTATUS = 0xC00000F3; +pub const STATUS_INVALID_PARAMETER_6: NTSTATUS = 0xC00000F4; +pub const STATUS_INVALID_PARAMETER_7: NTSTATUS = 0xC00000F5; +pub const STATUS_INVALID_PARAMETER_8: NTSTATUS = 0xC00000F6; +pub const STATUS_INVALID_PARAMETER_9: NTSTATUS = 0xC00000F7; +pub const STATUS_INVALID_PARAMETER_10: NTSTATUS = 0xC00000F8; +pub const STATUS_INVALID_PARAMETER_11: NTSTATUS = 0xC00000F9; +pub const STATUS_INVALID_PARAMETER_12: NTSTATUS = 0xC00000FA; +pub const STATUS_REDIRECTOR_NOT_STARTED: NTSTATUS = 0xC00000FB; +pub const STATUS_REDIRECTOR_STARTED: NTSTATUS = 0xC00000FC; +pub const STATUS_STACK_OVERFLOW: NTSTATUS = 0xC00000FD; +pub const STATUS_NO_SUCH_PACKAGE: NTSTATUS = 0xC00000FE; +pub const STATUS_BAD_FUNCTION_TABLE: NTSTATUS = 0xC00000FF; +pub const STATUS_VARIABLE_NOT_FOUND: NTSTATUS = 0xC0000100; +pub const STATUS_DIRECTORY_NOT_EMPTY: NTSTATUS = 0xC0000101; +pub const STATUS_FILE_CORRUPT_ERROR: NTSTATUS = 0xC0000102; +pub const STATUS_NOT_A_DIRECTORY: NTSTATUS = 0xC0000103; +pub const STATUS_BAD_LOGON_SESSION_STATE: NTSTATUS = 0xC0000104; +pub const STATUS_LOGON_SESSION_COLLISION: NTSTATUS = 0xC0000105; +pub const STATUS_NAME_TOO_LONG: NTSTATUS = 0xC0000106; +pub const STATUS_FILES_OPEN: NTSTATUS = 0xC0000107; +pub const STATUS_CONNECTION_IN_USE: NTSTATUS = 0xC0000108; +pub const STATUS_MESSAGE_NOT_FOUND: NTSTATUS = 0xC0000109; +pub const STATUS_PROCESS_IS_TERMINATING: NTSTATUS = 0xC000010A; +pub const STATUS_INVALID_LOGON_TYPE: NTSTATUS = 0xC000010B; +pub const STATUS_NO_GUID_TRANSLATION: NTSTATUS = 0xC000010C; +pub const STATUS_CANNOT_IMPERSONATE: NTSTATUS = 0xC000010D; +pub const STATUS_IMAGE_ALREADY_LOADED: NTSTATUS = 0xC000010E; +pub const STATUS_ABIOS_NOT_PRESENT: NTSTATUS = 0xC000010F; +pub const STATUS_ABIOS_LID_NOT_EXIST: NTSTATUS = 0xC0000110; +pub const STATUS_ABIOS_LID_ALREADY_OWNED: NTSTATUS = 0xC0000111; +pub const STATUS_ABIOS_NOT_LID_OWNER: NTSTATUS = 0xC0000112; +pub const STATUS_ABIOS_INVALID_COMMAND: NTSTATUS = 0xC0000113; +pub const STATUS_ABIOS_INVALID_LID: NTSTATUS = 0xC0000114; +pub const STATUS_ABIOS_SELECTOR_NOT_AVAILABLE: NTSTATUS = 0xC0000115; +pub const STATUS_ABIOS_INVALID_SELECTOR: NTSTATUS = 0xC0000116; +pub const STATUS_NO_LDT: NTSTATUS = 0xC0000117; +pub const STATUS_INVALID_LDT_SIZE: NTSTATUS = 0xC0000118; +pub const STATUS_INVALID_LDT_OFFSET: NTSTATUS = 0xC0000119; +pub const STATUS_INVALID_LDT_DESCRIPTOR: NTSTATUS = 0xC000011A; +pub const STATUS_INVALID_IMAGE_NE_FORMAT: NTSTATUS = 0xC000011B; +pub const STATUS_RXACT_INVALID_STATE: NTSTATUS = 0xC000011C; +pub const STATUS_RXACT_COMMIT_FAILURE: NTSTATUS = 0xC000011D; +pub const STATUS_MAPPED_FILE_SIZE_ZERO: NTSTATUS = 0xC000011E; +pub const STATUS_TOO_MANY_OPENED_FILES: NTSTATUS = 0xC000011F; +pub const STATUS_CANCELLED: NTSTATUS = 0xC0000120; +pub const STATUS_CANNOT_DELETE: NTSTATUS = 0xC0000121; +pub const STATUS_INVALID_COMPUTER_NAME: NTSTATUS = 0xC0000122; +pub const STATUS_FILE_DELETED: NTSTATUS = 0xC0000123; +pub const STATUS_SPECIAL_ACCOUNT: NTSTATUS = 0xC0000124; +pub const STATUS_SPECIAL_GROUP: NTSTATUS = 0xC0000125; +pub const STATUS_SPECIAL_USER: NTSTATUS = 0xC0000126; +pub const STATUS_MEMBERS_PRIMARY_GROUP: NTSTATUS = 0xC0000127; +pub const STATUS_FILE_CLOSED: NTSTATUS = 0xC0000128; +pub const STATUS_TOO_MANY_THREADS: NTSTATUS = 0xC0000129; +pub const STATUS_THREAD_NOT_IN_PROCESS: NTSTATUS = 0xC000012A; +pub const STATUS_TOKEN_ALREADY_IN_USE: NTSTATUS = 0xC000012B; +pub const STATUS_PAGEFILE_QUOTA_EXCEEDED: NTSTATUS = 0xC000012C; +pub const STATUS_COMMITMENT_LIMIT: NTSTATUS = 0xC000012D; +pub const STATUS_INVALID_IMAGE_LE_FORMAT: NTSTATUS = 0xC000012E; +pub const STATUS_INVALID_IMAGE_NOT_MZ: NTSTATUS = 0xC000012F; +pub const STATUS_INVALID_IMAGE_PROTECT: NTSTATUS = 0xC0000130; +pub const STATUS_INVALID_IMAGE_WIN_16: NTSTATUS = 0xC0000131; +pub const STATUS_LOGON_SERVER_CONFLICT: NTSTATUS = 0xC0000132; +pub const STATUS_TIME_DIFFERENCE_AT_DC: NTSTATUS = 0xC0000133; +pub const STATUS_SYNCHRONIZATION_REQUIRED: NTSTATUS = 0xC0000134; +pub const STATUS_DLL_NOT_FOUND: NTSTATUS = 0xC0000135; +pub const STATUS_OPEN_FAILED: NTSTATUS = 0xC0000136; +pub const STATUS_IO_PRIVILEGE_FAILED: NTSTATUS = 0xC0000137; +pub const STATUS_ORDINAL_NOT_FOUND: NTSTATUS = 0xC0000138; +pub const STATUS_ENTRYPOINT_NOT_FOUND: NTSTATUS = 0xC0000139; +pub const STATUS_CONTROL_C_EXIT: NTSTATUS = 0xC000013A; +pub const STATUS_LOCAL_DISCONNECT: NTSTATUS = 0xC000013B; +pub const STATUS_REMOTE_DISCONNECT: NTSTATUS = 0xC000013C; +pub const STATUS_REMOTE_RESOURCES: NTSTATUS = 0xC000013D; +pub const STATUS_LINK_FAILED: NTSTATUS = 0xC000013E; +pub const STATUS_LINK_TIMEOUT: NTSTATUS = 0xC000013F; +pub const STATUS_INVALID_CONNECTION: NTSTATUS = 0xC0000140; +pub const STATUS_INVALID_ADDRESS: NTSTATUS = 0xC0000141; +pub const STATUS_DLL_INIT_FAILED: NTSTATUS = 0xC0000142; +pub const STATUS_MISSING_SYSTEMFILE: NTSTATUS = 0xC0000143; +pub const STATUS_UNHANDLED_EXCEPTION: NTSTATUS = 0xC0000144; +pub const STATUS_APP_INIT_FAILURE: NTSTATUS = 0xC0000145; +pub const STATUS_PAGEFILE_CREATE_FAILED: NTSTATUS = 0xC0000146; +pub const STATUS_NO_PAGEFILE: NTSTATUS = 0xC0000147; +pub const STATUS_INVALID_LEVEL: NTSTATUS = 0xC0000148; +pub const STATUS_WRONG_PASSWORD_CORE: NTSTATUS = 0xC0000149; +pub const STATUS_ILLEGAL_FLOAT_CONTEXT: NTSTATUS = 0xC000014A; +pub const STATUS_PIPE_BROKEN: NTSTATUS = 0xC000014B; +pub const STATUS_REGISTRY_CORRUPT: NTSTATUS = 0xC000014C; +pub const STATUS_REGISTRY_IO_FAILED: NTSTATUS = 0xC000014D; +pub const STATUS_NO_EVENT_PAIR: NTSTATUS = 0xC000014E; +pub const STATUS_UNRECOGNIZED_VOLUME: NTSTATUS = 0xC000014F; +pub const STATUS_SERIAL_NO_DEVICE_INITED: NTSTATUS = 0xC0000150; +pub const STATUS_NO_SUCH_ALIAS: NTSTATUS = 0xC0000151; +pub const STATUS_MEMBER_NOT_IN_ALIAS: NTSTATUS = 0xC0000152; +pub const STATUS_MEMBER_IN_ALIAS: NTSTATUS = 0xC0000153; +pub const STATUS_ALIAS_EXISTS: NTSTATUS = 0xC0000154; +pub const STATUS_LOGON_NOT_GRANTED: NTSTATUS = 0xC0000155; +pub const STATUS_TOO_MANY_SECRETS: NTSTATUS = 0xC0000156; +pub const STATUS_SECRET_TOO_LONG: NTSTATUS = 0xC0000157; +pub const STATUS_INTERNAL_DB_ERROR: NTSTATUS = 0xC0000158; +pub const STATUS_FULLSCREEN_MODE: NTSTATUS = 0xC0000159; +pub const STATUS_TOO_MANY_CONTEXT_IDS: NTSTATUS = 0xC000015A; +pub const STATUS_LOGON_TYPE_NOT_GRANTED: NTSTATUS = 0xC000015B; +pub const STATUS_NOT_REGISTRY_FILE: NTSTATUS = 0xC000015C; +pub const STATUS_NT_CROSS_ENCRYPTION_REQUIRED: NTSTATUS = 0xC000015D; +pub const STATUS_DOMAIN_CTRLR_CONFIG_ERROR: NTSTATUS = 0xC000015E; +pub const STATUS_FT_MISSING_MEMBER: NTSTATUS = 0xC000015F; +pub const STATUS_ILL_FORMED_SERVICE_ENTRY: NTSTATUS = 0xC0000160; +pub const STATUS_ILLEGAL_CHARACTER: NTSTATUS = 0xC0000161; +pub const STATUS_UNMAPPABLE_CHARACTER: NTSTATUS = 0xC0000162; +pub const STATUS_UNDEFINED_CHARACTER: NTSTATUS = 0xC0000163; +pub const STATUS_FLOPPY_VOLUME: NTSTATUS = 0xC0000164; +pub const STATUS_FLOPPY_ID_MARK_NOT_FOUND: NTSTATUS = 0xC0000165; +pub const STATUS_FLOPPY_WRONG_CYLINDER: NTSTATUS = 0xC0000166; +pub const STATUS_FLOPPY_UNKNOWN_ERROR: NTSTATUS = 0xC0000167; +pub const STATUS_FLOPPY_BAD_REGISTERS: NTSTATUS = 0xC0000168; +pub const STATUS_DISK_RECALIBRATE_FAILED: NTSTATUS = 0xC0000169; +pub const STATUS_DISK_OPERATION_FAILED: NTSTATUS = 0xC000016A; +pub const STATUS_DISK_RESET_FAILED: NTSTATUS = 0xC000016B; +pub const STATUS_SHARED_IRQ_BUSY: NTSTATUS = 0xC000016C; +pub const STATUS_FT_ORPHANING: NTSTATUS = 0xC000016D; +pub const STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT: NTSTATUS = 0xC000016E; +pub const STATUS_PARTITION_FAILURE: NTSTATUS = 0xC0000172; +pub const STATUS_INVALID_BLOCK_LENGTH: NTSTATUS = 0xC0000173; +pub const STATUS_DEVICE_NOT_PARTITIONED: NTSTATUS = 0xC0000174; +pub const STATUS_UNABLE_TO_LOCK_MEDIA: NTSTATUS = 0xC0000175; +pub const STATUS_UNABLE_TO_UNLOAD_MEDIA: NTSTATUS = 0xC0000176; +pub const STATUS_EOM_OVERFLOW: NTSTATUS = 0xC0000177; +pub const STATUS_NO_MEDIA: NTSTATUS = 0xC0000178; +pub const STATUS_NO_SUCH_MEMBER: NTSTATUS = 0xC000017A; +pub const STATUS_INVALID_MEMBER: NTSTATUS = 0xC000017B; +pub const STATUS_KEY_DELETED: NTSTATUS = 0xC000017C; +pub const STATUS_NO_LOG_SPACE: NTSTATUS = 0xC000017D; +pub const STATUS_TOO_MANY_SIDS: NTSTATUS = 0xC000017E; +pub const STATUS_LM_CROSS_ENCRYPTION_REQUIRED: NTSTATUS = 0xC000017F; +pub const STATUS_KEY_HAS_CHILDREN: NTSTATUS = 0xC0000180; +pub const STATUS_CHILD_MUST_BE_VOLATILE: NTSTATUS = 0xC0000181; +pub const STATUS_DEVICE_CONFIGURATION_ERROR: NTSTATUS = 0xC0000182; +pub const STATUS_DRIVER_INTERNAL_ERROR: NTSTATUS = 0xC0000183; +pub const STATUS_INVALID_DEVICE_STATE: NTSTATUS = 0xC0000184; +pub const STATUS_IO_DEVICE_ERROR: NTSTATUS = 0xC0000185; +pub const STATUS_DEVICE_PROTOCOL_ERROR: NTSTATUS = 0xC0000186; +pub const STATUS_BACKUP_CONTROLLER: NTSTATUS = 0xC0000187; +pub const STATUS_LOG_FILE_FULL: NTSTATUS = 0xC0000188; +pub const STATUS_TOO_LATE: NTSTATUS = 0xC0000189; +pub const STATUS_NO_TRUST_LSA_SECRET: NTSTATUS = 0xC000018A; +pub const STATUS_NO_TRUST_SAM_ACCOUNT: NTSTATUS = 0xC000018B; +pub const STATUS_TRUSTED_DOMAIN_FAILURE: NTSTATUS = 0xC000018C; +pub const STATUS_TRUSTED_RELATIONSHIP_FAILURE: NTSTATUS = 0xC000018D; +pub const STATUS_EVENTLOG_FILE_CORRUPT: NTSTATUS = 0xC000018E; +pub const STATUS_EVENTLOG_CANT_START: NTSTATUS = 0xC000018F; +pub const STATUS_TRUST_FAILURE: NTSTATUS = 0xC0000190; +pub const STATUS_MUTANT_LIMIT_EXCEEDED: NTSTATUS = 0xC0000191; +pub const STATUS_NETLOGON_NOT_STARTED: NTSTATUS = 0xC0000192; +pub const STATUS_ACCOUNT_EXPIRED: NTSTATUS = 0xC0000193; +pub const STATUS_POSSIBLE_DEADLOCK: NTSTATUS = 0xC0000194; +pub const STATUS_NETWORK_CREDENTIAL_CONFLICT: NTSTATUS = 0xC0000195; +pub const STATUS_REMOTE_SESSION_LIMIT: NTSTATUS = 0xC0000196; +pub const STATUS_EVENTLOG_FILE_CHANGED: NTSTATUS = 0xC0000197; +pub const STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: NTSTATUS = 0xC0000198; +pub const STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT: NTSTATUS = 0xC0000199; +pub const STATUS_NOLOGON_SERVER_TRUST_ACCOUNT: NTSTATUS = 0xC000019A; +pub const STATUS_DOMAIN_TRUST_INCONSISTENT: NTSTATUS = 0xC000019B; +pub const STATUS_FS_DRIVER_REQUIRED: NTSTATUS = 0xC000019C; +pub const STATUS_IMAGE_ALREADY_LOADED_AS_DLL: NTSTATUS = 0xC000019D; +pub const STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: NTSTATUS + = 0xC000019E; +pub const STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: NTSTATUS = 0xC000019F; +pub const STATUS_SECURITY_STREAM_IS_INCONSISTENT: NTSTATUS = 0xC00001A0; +pub const STATUS_INVALID_LOCK_RANGE: NTSTATUS = 0xC00001A1; +pub const STATUS_INVALID_ACE_CONDITION: NTSTATUS = 0xC00001A2; +pub const STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT: NTSTATUS = 0xC00001A3; +pub const STATUS_NOTIFICATION_GUID_ALREADY_DEFINED: NTSTATUS = 0xC00001A4; +pub const STATUS_INVALID_EXCEPTION_HANDLER: NTSTATUS = 0xC00001A5; +pub const STATUS_DUPLICATE_PRIVILEGES: NTSTATUS = 0xC00001A6; +pub const STATUS_NOT_ALLOWED_ON_SYSTEM_FILE: NTSTATUS = 0xC00001A7; +pub const STATUS_REPAIR_NEEDED: NTSTATUS = 0xC00001A8; +pub const STATUS_QUOTA_NOT_ENABLED: NTSTATUS = 0xC00001A9; +pub const STATUS_NO_APPLICATION_PACKAGE: NTSTATUS = 0xC00001AA; +pub const STATUS_FILE_METADATA_OPTIMIZATION_IN_PROGRESS: NTSTATUS = 0xC00001AB; +pub const STATUS_NOT_SAME_OBJECT: NTSTATUS = 0xC00001AC; +pub const STATUS_FATAL_MEMORY_EXHAUSTION: NTSTATUS = 0xC00001AD; +pub const STATUS_ERROR_PROCESS_NOT_IN_JOB: NTSTATUS = 0xC00001AE; +pub const STATUS_CPU_SET_INVALID: NTSTATUS = 0xC00001AF; +pub const STATUS_NETWORK_OPEN_RESTRICTION: NTSTATUS = 0xC0000201; +pub const STATUS_NO_USER_SESSION_KEY: NTSTATUS = 0xC0000202; +pub const STATUS_USER_SESSION_DELETED: NTSTATUS = 0xC0000203; +pub const STATUS_RESOURCE_LANG_NOT_FOUND: NTSTATUS = 0xC0000204; +pub const STATUS_INSUFF_SERVER_RESOURCES: NTSTATUS = 0xC0000205; +pub const STATUS_INVALID_BUFFER_SIZE: NTSTATUS = 0xC0000206; +pub const STATUS_INVALID_ADDRESS_COMPONENT: NTSTATUS = 0xC0000207; +pub const STATUS_INVALID_ADDRESS_WILDCARD: NTSTATUS = 0xC0000208; +pub const STATUS_TOO_MANY_ADDRESSES: NTSTATUS = 0xC0000209; +pub const STATUS_ADDRESS_ALREADY_EXISTS: NTSTATUS = 0xC000020A; +pub const STATUS_ADDRESS_CLOSED: NTSTATUS = 0xC000020B; +pub const STATUS_CONNECTION_DISCONNECTED: NTSTATUS = 0xC000020C; +pub const STATUS_CONNECTION_RESET: NTSTATUS = 0xC000020D; +pub const STATUS_TOO_MANY_NODES: NTSTATUS = 0xC000020E; +pub const STATUS_TRANSACTION_ABORTED: NTSTATUS = 0xC000020F; +pub const STATUS_TRANSACTION_TIMED_OUT: NTSTATUS = 0xC0000210; +pub const STATUS_TRANSACTION_NO_RELEASE: NTSTATUS = 0xC0000211; +pub const STATUS_TRANSACTION_NO_MATCH: NTSTATUS = 0xC0000212; +pub const STATUS_TRANSACTION_RESPONDED: NTSTATUS = 0xC0000213; +pub const STATUS_TRANSACTION_INVALID_ID: NTSTATUS = 0xC0000214; +pub const STATUS_TRANSACTION_INVALID_TYPE: NTSTATUS = 0xC0000215; +pub const STATUS_NOT_SERVER_SESSION: NTSTATUS = 0xC0000216; +pub const STATUS_NOT_CLIENT_SESSION: NTSTATUS = 0xC0000217; +pub const STATUS_CANNOT_LOAD_REGISTRY_FILE: NTSTATUS = 0xC0000218; +pub const STATUS_DEBUG_ATTACH_FAILED: NTSTATUS = 0xC0000219; +pub const STATUS_SYSTEM_PROCESS_TERMINATED: NTSTATUS = 0xC000021A; +pub const STATUS_DATA_NOT_ACCEPTED: NTSTATUS = 0xC000021B; +pub const STATUS_NO_BROWSER_SERVERS_FOUND: NTSTATUS = 0xC000021C; +pub const STATUS_VDM_HARD_ERROR: NTSTATUS = 0xC000021D; +pub const STATUS_DRIVER_CANCEL_TIMEOUT: NTSTATUS = 0xC000021E; +pub const STATUS_REPLY_MESSAGE_MISMATCH: NTSTATUS = 0xC000021F; +pub const STATUS_MAPPED_ALIGNMENT: NTSTATUS = 0xC0000220; +pub const STATUS_IMAGE_CHECKSUM_MISMATCH: NTSTATUS = 0xC0000221; +pub const STATUS_LOST_WRITEBEHIND_DATA: NTSTATUS = 0xC0000222; +pub const STATUS_CLIENT_SERVER_PARAMETERS_INVALID: NTSTATUS = 0xC0000223; +pub const STATUS_PASSWORD_MUST_CHANGE: NTSTATUS = 0xC0000224; +pub const STATUS_NOT_FOUND: NTSTATUS = 0xC0000225; +pub const STATUS_NOT_TINY_STREAM: NTSTATUS = 0xC0000226; +pub const STATUS_RECOVERY_FAILURE: NTSTATUS = 0xC0000227; +pub const STATUS_STACK_OVERFLOW_READ: NTSTATUS = 0xC0000228; +pub const STATUS_FAIL_CHECK: NTSTATUS = 0xC0000229; +pub const STATUS_DUPLICATE_OBJECTID: NTSTATUS = 0xC000022A; +pub const STATUS_OBJECTID_EXISTS: NTSTATUS = 0xC000022B; +pub const STATUS_CONVERT_TO_LARGE: NTSTATUS = 0xC000022C; +pub const STATUS_RETRY: NTSTATUS = 0xC000022D; +pub const STATUS_FOUND_OUT_OF_SCOPE: NTSTATUS = 0xC000022E; +pub const STATUS_ALLOCATE_BUCKET: NTSTATUS = 0xC000022F; +pub const STATUS_PROPSET_NOT_FOUND: NTSTATUS = 0xC0000230; +pub const STATUS_MARSHALL_OVERFLOW: NTSTATUS = 0xC0000231; +pub const STATUS_INVALID_VARIANT: NTSTATUS = 0xC0000232; +pub const STATUS_DOMAIN_CONTROLLER_NOT_FOUND: NTSTATUS = 0xC0000233; +pub const STATUS_ACCOUNT_LOCKED_OUT: NTSTATUS = 0xC0000234; +pub const STATUS_HANDLE_NOT_CLOSABLE: NTSTATUS = 0xC0000235; +pub const STATUS_CONNECTION_REFUSED: NTSTATUS = 0xC0000236; +pub const STATUS_GRACEFUL_DISCONNECT: NTSTATUS = 0xC0000237; +pub const STATUS_ADDRESS_ALREADY_ASSOCIATED: NTSTATUS = 0xC0000238; +pub const STATUS_ADDRESS_NOT_ASSOCIATED: NTSTATUS = 0xC0000239; +pub const STATUS_CONNECTION_INVALID: NTSTATUS = 0xC000023A; +pub const STATUS_CONNECTION_ACTIVE: NTSTATUS = 0xC000023B; +pub const STATUS_NETWORK_UNREACHABLE: NTSTATUS = 0xC000023C; +pub const STATUS_HOST_UNREACHABLE: NTSTATUS = 0xC000023D; +pub const STATUS_PROTOCOL_UNREACHABLE: NTSTATUS = 0xC000023E; +pub const STATUS_PORT_UNREACHABLE: NTSTATUS = 0xC000023F; +pub const STATUS_REQUEST_ABORTED: NTSTATUS = 0xC0000240; +pub const STATUS_CONNECTION_ABORTED: NTSTATUS = 0xC0000241; +pub const STATUS_BAD_COMPRESSION_BUFFER: NTSTATUS = 0xC0000242; +pub const STATUS_USER_MAPPED_FILE: NTSTATUS = 0xC0000243; +pub const STATUS_AUDIT_FAILED: NTSTATUS = 0xC0000244; +pub const STATUS_TIMER_RESOLUTION_NOT_SET: NTSTATUS = 0xC0000245; +pub const STATUS_CONNECTION_COUNT_LIMIT: NTSTATUS = 0xC0000246; +pub const STATUS_LOGIN_TIME_RESTRICTION: NTSTATUS = 0xC0000247; +pub const STATUS_LOGIN_WKSTA_RESTRICTION: NTSTATUS = 0xC0000248; +pub const STATUS_IMAGE_MP_UP_MISMATCH: NTSTATUS = 0xC0000249; +pub const STATUS_INSUFFICIENT_LOGON_INFO: NTSTATUS = 0xC0000250; +pub const STATUS_BAD_DLL_ENTRYPOINT: NTSTATUS = 0xC0000251; +pub const STATUS_BAD_SERVICE_ENTRYPOINT: NTSTATUS = 0xC0000252; +pub const STATUS_LPC_REPLY_LOST: NTSTATUS = 0xC0000253; +pub const STATUS_IP_ADDRESS_CONFLICT1: NTSTATUS = 0xC0000254; +pub const STATUS_IP_ADDRESS_CONFLICT2: NTSTATUS = 0xC0000255; +pub const STATUS_REGISTRY_QUOTA_LIMIT: NTSTATUS = 0xC0000256; +pub const STATUS_PATH_NOT_COVERED: NTSTATUS = 0xC0000257; +pub const STATUS_NO_CALLBACK_ACTIVE: NTSTATUS = 0xC0000258; +pub const STATUS_LICENSE_QUOTA_EXCEEDED: NTSTATUS = 0xC0000259; +pub const STATUS_PWD_TOO_SHORT: NTSTATUS = 0xC000025A; +pub const STATUS_PWD_TOO_RECENT: NTSTATUS = 0xC000025B; +pub const STATUS_PWD_HISTORY_CONFLICT: NTSTATUS = 0xC000025C; +pub const STATUS_PLUGPLAY_NO_DEVICE: NTSTATUS = 0xC000025E; +pub const STATUS_UNSUPPORTED_COMPRESSION: NTSTATUS = 0xC000025F; +pub const STATUS_INVALID_HW_PROFILE: NTSTATUS = 0xC0000260; +pub const STATUS_INVALID_PLUGPLAY_DEVICE_PATH: NTSTATUS = 0xC0000261; +pub const STATUS_DRIVER_ORDINAL_NOT_FOUND: NTSTATUS = 0xC0000262; +pub const STATUS_DRIVER_ENTRYPOINT_NOT_FOUND: NTSTATUS = 0xC0000263; +pub const STATUS_RESOURCE_NOT_OWNED: NTSTATUS = 0xC0000264; +pub const STATUS_TOO_MANY_LINKS: NTSTATUS = 0xC0000265; +pub const STATUS_QUOTA_LIST_INCONSISTENT: NTSTATUS = 0xC0000266; +pub const STATUS_FILE_IS_OFFLINE: NTSTATUS = 0xC0000267; +pub const STATUS_EVALUATION_EXPIRATION: NTSTATUS = 0xC0000268; +pub const STATUS_ILLEGAL_DLL_RELOCATION: NTSTATUS = 0xC0000269; +pub const STATUS_LICENSE_VIOLATION: NTSTATUS = 0xC000026A; +pub const STATUS_DLL_INIT_FAILED_LOGOFF: NTSTATUS = 0xC000026B; +pub const STATUS_DRIVER_UNABLE_TO_LOAD: NTSTATUS = 0xC000026C; +pub const STATUS_DFS_UNAVAILABLE: NTSTATUS = 0xC000026D; +pub const STATUS_VOLUME_DISMOUNTED: NTSTATUS = 0xC000026E; +pub const STATUS_WX86_INTERNAL_ERROR: NTSTATUS = 0xC000026F; +pub const STATUS_WX86_FLOAT_STACK_CHECK: NTSTATUS = 0xC0000270; +pub const STATUS_VALIDATE_CONTINUE: NTSTATUS = 0xC0000271; +pub const STATUS_NO_MATCH: NTSTATUS = 0xC0000272; +pub const STATUS_NO_MORE_MATCHES: NTSTATUS = 0xC0000273; +pub const STATUS_NOT_A_REPARSE_POINT: NTSTATUS = 0xC0000275; +pub const STATUS_IO_REPARSE_TAG_INVALID: NTSTATUS = 0xC0000276; +pub const STATUS_IO_REPARSE_TAG_MISMATCH: NTSTATUS = 0xC0000277; +pub const STATUS_IO_REPARSE_DATA_INVALID: NTSTATUS = 0xC0000278; +pub const STATUS_IO_REPARSE_TAG_NOT_HANDLED: NTSTATUS = 0xC0000279; +pub const STATUS_PWD_TOO_LONG: NTSTATUS = 0xC000027A; +pub const STATUS_STOWED_EXCEPTION: NTSTATUS = 0xC000027B; +pub const STATUS_REPARSE_POINT_NOT_RESOLVED: NTSTATUS = 0xC0000280; +pub const STATUS_DIRECTORY_IS_A_REPARSE_POINT: NTSTATUS = 0xC0000281; +pub const STATUS_RANGE_LIST_CONFLICT: NTSTATUS = 0xC0000282; +pub const STATUS_SOURCE_ELEMENT_EMPTY: NTSTATUS = 0xC0000283; +pub const STATUS_DESTINATION_ELEMENT_FULL: NTSTATUS = 0xC0000284; +pub const STATUS_ILLEGAL_ELEMENT_ADDRESS: NTSTATUS = 0xC0000285; +pub const STATUS_MAGAZINE_NOT_PRESENT: NTSTATUS = 0xC0000286; +pub const STATUS_REINITIALIZATION_NEEDED: NTSTATUS = 0xC0000287; +pub const STATUS_DEVICE_REQUIRES_CLEANING: NTSTATUS = 0x80000288; +pub const STATUS_DEVICE_DOOR_OPEN: NTSTATUS = 0x80000289; +pub const STATUS_ENCRYPTION_FAILED: NTSTATUS = 0xC000028A; +pub const STATUS_DECRYPTION_FAILED: NTSTATUS = 0xC000028B; +pub const STATUS_RANGE_NOT_FOUND: NTSTATUS = 0xC000028C; +pub const STATUS_NO_RECOVERY_POLICY: NTSTATUS = 0xC000028D; +pub const STATUS_NO_EFS: NTSTATUS = 0xC000028E; +pub const STATUS_WRONG_EFS: NTSTATUS = 0xC000028F; +pub const STATUS_NO_USER_KEYS: NTSTATUS = 0xC0000290; +pub const STATUS_FILE_NOT_ENCRYPTED: NTSTATUS = 0xC0000291; +pub const STATUS_NOT_EXPORT_FORMAT: NTSTATUS = 0xC0000292; +pub const STATUS_FILE_ENCRYPTED: NTSTATUS = 0xC0000293; +pub const STATUS_WAKE_SYSTEM: NTSTATUS = 0x40000294; +pub const STATUS_WMI_GUID_NOT_FOUND: NTSTATUS = 0xC0000295; +pub const STATUS_WMI_INSTANCE_NOT_FOUND: NTSTATUS = 0xC0000296; +pub const STATUS_WMI_ITEMID_NOT_FOUND: NTSTATUS = 0xC0000297; +pub const STATUS_WMI_TRY_AGAIN: NTSTATUS = 0xC0000298; +pub const STATUS_SHARED_POLICY: NTSTATUS = 0xC0000299; +pub const STATUS_POLICY_OBJECT_NOT_FOUND: NTSTATUS = 0xC000029A; +pub const STATUS_POLICY_ONLY_IN_DS: NTSTATUS = 0xC000029B; +pub const STATUS_VOLUME_NOT_UPGRADED: NTSTATUS = 0xC000029C; +pub const STATUS_REMOTE_STORAGE_NOT_ACTIVE: NTSTATUS = 0xC000029D; +pub const STATUS_REMOTE_STORAGE_MEDIA_ERROR: NTSTATUS = 0xC000029E; +pub const STATUS_NO_TRACKING_SERVICE: NTSTATUS = 0xC000029F; +pub const STATUS_SERVER_SID_MISMATCH: NTSTATUS = 0xC00002A0; +pub const STATUS_DS_NO_ATTRIBUTE_OR_VALUE: NTSTATUS = 0xC00002A1; +pub const STATUS_DS_INVALID_ATTRIBUTE_SYNTAX: NTSTATUS = 0xC00002A2; +pub const STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED: NTSTATUS = 0xC00002A3; +pub const STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS: NTSTATUS = 0xC00002A4; +pub const STATUS_DS_BUSY: NTSTATUS = 0xC00002A5; +pub const STATUS_DS_UNAVAILABLE: NTSTATUS = 0xC00002A6; +pub const STATUS_DS_NO_RIDS_ALLOCATED: NTSTATUS = 0xC00002A7; +pub const STATUS_DS_NO_MORE_RIDS: NTSTATUS = 0xC00002A8; +pub const STATUS_DS_INCORRECT_ROLE_OWNER: NTSTATUS = 0xC00002A9; +pub const STATUS_DS_RIDMGR_INIT_ERROR: NTSTATUS = 0xC00002AA; +pub const STATUS_DS_OBJ_CLASS_VIOLATION: NTSTATUS = 0xC00002AB; +pub const STATUS_DS_CANT_ON_NON_LEAF: NTSTATUS = 0xC00002AC; +pub const STATUS_DS_CANT_ON_RDN: NTSTATUS = 0xC00002AD; +pub const STATUS_DS_CANT_MOD_OBJ_CLASS: NTSTATUS = 0xC00002AE; +pub const STATUS_DS_CROSS_DOM_MOVE_FAILED: NTSTATUS = 0xC00002AF; +pub const STATUS_DS_GC_NOT_AVAILABLE: NTSTATUS = 0xC00002B0; +pub const STATUS_DIRECTORY_SERVICE_REQUIRED: NTSTATUS = 0xC00002B1; +pub const STATUS_REPARSE_ATTRIBUTE_CONFLICT: NTSTATUS = 0xC00002B2; +pub const STATUS_CANT_ENABLE_DENY_ONLY: NTSTATUS = 0xC00002B3; +pub const STATUS_FLOAT_MULTIPLE_FAULTS: NTSTATUS = 0xC00002B4; +pub const STATUS_FLOAT_MULTIPLE_TRAPS: NTSTATUS = 0xC00002B5; +pub const STATUS_DEVICE_REMOVED: NTSTATUS = 0xC00002B6; +pub const STATUS_JOURNAL_DELETE_IN_PROGRESS: NTSTATUS = 0xC00002B7; +pub const STATUS_JOURNAL_NOT_ACTIVE: NTSTATUS = 0xC00002B8; +pub const STATUS_NOINTERFACE: NTSTATUS = 0xC00002B9; +pub const STATUS_DS_RIDMGR_DISABLED: NTSTATUS = 0xC00002BA; +pub const STATUS_DS_ADMIN_LIMIT_EXCEEDED: NTSTATUS = 0xC00002C1; +pub const STATUS_DRIVER_FAILED_SLEEP: NTSTATUS = 0xC00002C2; +pub const STATUS_MUTUAL_AUTHENTICATION_FAILED: NTSTATUS = 0xC00002C3; +pub const STATUS_CORRUPT_SYSTEM_FILE: NTSTATUS = 0xC00002C4; +pub const STATUS_DATATYPE_MISALIGNMENT_ERROR: NTSTATUS = 0xC00002C5; +pub const STATUS_WMI_READ_ONLY: NTSTATUS = 0xC00002C6; +pub const STATUS_WMI_SET_FAILURE: NTSTATUS = 0xC00002C7; +pub const STATUS_COMMITMENT_MINIMUM: NTSTATUS = 0xC00002C8; +pub const STATUS_REG_NAT_CONSUMPTION: NTSTATUS = 0xC00002C9; +pub const STATUS_TRANSPORT_FULL: NTSTATUS = 0xC00002CA; +pub const STATUS_DS_SAM_INIT_FAILURE: NTSTATUS = 0xC00002CB; +pub const STATUS_ONLY_IF_CONNECTED: NTSTATUS = 0xC00002CC; +pub const STATUS_DS_SENSITIVE_GROUP_VIOLATION: NTSTATUS = 0xC00002CD; +pub const STATUS_PNP_RESTART_ENUMERATION: NTSTATUS = 0xC00002CE; +pub const STATUS_JOURNAL_ENTRY_DELETED: NTSTATUS = 0xC00002CF; +pub const STATUS_DS_CANT_MOD_PRIMARYGROUPID: NTSTATUS = 0xC00002D0; +pub const STATUS_SYSTEM_IMAGE_BAD_SIGNATURE: NTSTATUS = 0xC00002D1; +pub const STATUS_PNP_REBOOT_REQUIRED: NTSTATUS = 0xC00002D2; +pub const STATUS_POWER_STATE_INVALID: NTSTATUS = 0xC00002D3; +pub const STATUS_DS_INVALID_GROUP_TYPE: NTSTATUS = 0xC00002D4; +pub const STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: NTSTATUS = 0xC00002D5; +pub const STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: NTSTATUS = 0xC00002D6; +pub const STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: NTSTATUS = 0xC00002D7; +pub const STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: NTSTATUS = 0xC00002D8; +pub const STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: NTSTATUS = 0xC00002D9; +pub const STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: NTSTATUS = 0xC00002DA; +pub const STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: NTSTATUS = 0xC00002DB; +pub const STATUS_DS_HAVE_PRIMARY_MEMBERS: NTSTATUS = 0xC00002DC; +pub const STATUS_WMI_NOT_SUPPORTED: NTSTATUS = 0xC00002DD; +pub const STATUS_INSUFFICIENT_POWER: NTSTATUS = 0xC00002DE; +pub const STATUS_SAM_NEED_BOOTKEY_PASSWORD: NTSTATUS = 0xC00002DF; +pub const STATUS_SAM_NEED_BOOTKEY_FLOPPY: NTSTATUS = 0xC00002E0; +pub const STATUS_DS_CANT_START: NTSTATUS = 0xC00002E1; +pub const STATUS_DS_INIT_FAILURE: NTSTATUS = 0xC00002E2; +pub const STATUS_SAM_INIT_FAILURE: NTSTATUS = 0xC00002E3; +pub const STATUS_DS_GC_REQUIRED: NTSTATUS = 0xC00002E4; +pub const STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: NTSTATUS = 0xC00002E5; +pub const STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS: NTSTATUS = 0xC00002E6; +pub const STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: NTSTATUS = 0xC00002E7; +pub const STATUS_MULTIPLE_FAULT_VIOLATION: NTSTATUS = 0xC00002E8; +pub const STATUS_CURRENT_DOMAIN_NOT_ALLOWED: NTSTATUS = 0xC00002E9; +pub const STATUS_CANNOT_MAKE: NTSTATUS = 0xC00002EA; +pub const STATUS_SYSTEM_SHUTDOWN: NTSTATUS = 0xC00002EB; +pub const STATUS_DS_INIT_FAILURE_CONSOLE: NTSTATUS = 0xC00002EC; +pub const STATUS_DS_SAM_INIT_FAILURE_CONSOLE: NTSTATUS = 0xC00002ED; +pub const STATUS_UNFINISHED_CONTEXT_DELETED: NTSTATUS = 0xC00002EE; +pub const STATUS_NO_TGT_REPLY: NTSTATUS = 0xC00002EF; +pub const STATUS_OBJECTID_NOT_FOUND: NTSTATUS = 0xC00002F0; +pub const STATUS_NO_IP_ADDRESSES: NTSTATUS = 0xC00002F1; +pub const STATUS_WRONG_CREDENTIAL_HANDLE: NTSTATUS = 0xC00002F2; +pub const STATUS_CRYPTO_SYSTEM_INVALID: NTSTATUS = 0xC00002F3; +pub const STATUS_MAX_REFERRALS_EXCEEDED: NTSTATUS = 0xC00002F4; +pub const STATUS_MUST_BE_KDC: NTSTATUS = 0xC00002F5; +pub const STATUS_STRONG_CRYPTO_NOT_SUPPORTED: NTSTATUS = 0xC00002F6; +pub const STATUS_TOO_MANY_PRINCIPALS: NTSTATUS = 0xC00002F7; +pub const STATUS_NO_PA_DATA: NTSTATUS = 0xC00002F8; +pub const STATUS_PKINIT_NAME_MISMATCH: NTSTATUS = 0xC00002F9; +pub const STATUS_SMARTCARD_LOGON_REQUIRED: NTSTATUS = 0xC00002FA; +pub const STATUS_KDC_INVALID_REQUEST: NTSTATUS = 0xC00002FB; +pub const STATUS_KDC_UNABLE_TO_REFER: NTSTATUS = 0xC00002FC; +pub const STATUS_KDC_UNKNOWN_ETYPE: NTSTATUS = 0xC00002FD; +pub const STATUS_SHUTDOWN_IN_PROGRESS: NTSTATUS = 0xC00002FE; +pub const STATUS_SERVER_SHUTDOWN_IN_PROGRESS: NTSTATUS = 0xC00002FF; +pub const STATUS_NOT_SUPPORTED_ON_SBS: NTSTATUS = 0xC0000300; +pub const STATUS_WMI_GUID_DISCONNECTED: NTSTATUS = 0xC0000301; +pub const STATUS_WMI_ALREADY_DISABLED: NTSTATUS = 0xC0000302; +pub const STATUS_WMI_ALREADY_ENABLED: NTSTATUS = 0xC0000303; +pub const STATUS_MFT_TOO_FRAGMENTED: NTSTATUS = 0xC0000304; +pub const STATUS_COPY_PROTECTION_FAILURE: NTSTATUS = 0xC0000305; +pub const STATUS_CSS_AUTHENTICATION_FAILURE: NTSTATUS = 0xC0000306; +pub const STATUS_CSS_KEY_NOT_PRESENT: NTSTATUS = 0xC0000307; +pub const STATUS_CSS_KEY_NOT_ESTABLISHED: NTSTATUS = 0xC0000308; +pub const STATUS_CSS_SCRAMBLED_SECTOR: NTSTATUS = 0xC0000309; +pub const STATUS_CSS_REGION_MISMATCH: NTSTATUS = 0xC000030A; +pub const STATUS_CSS_RESETS_EXHAUSTED: NTSTATUS = 0xC000030B; +pub const STATUS_PASSWORD_CHANGE_REQUIRED: NTSTATUS = 0xC000030C; +pub const STATUS_PKINIT_FAILURE: NTSTATUS = 0xC0000320; +pub const STATUS_SMARTCARD_SUBSYSTEM_FAILURE: NTSTATUS = 0xC0000321; +pub const STATUS_NO_KERB_KEY: NTSTATUS = 0xC0000322; +pub const STATUS_HOST_DOWN: NTSTATUS = 0xC0000350; +pub const STATUS_UNSUPPORTED_PREAUTH: NTSTATUS = 0xC0000351; +pub const STATUS_EFS_ALG_BLOB_TOO_BIG: NTSTATUS = 0xC0000352; +pub const STATUS_PORT_NOT_SET: NTSTATUS = 0xC0000353; +pub const STATUS_DEBUGGER_INACTIVE: NTSTATUS = 0xC0000354; +pub const STATUS_DS_VERSION_CHECK_FAILURE: NTSTATUS = 0xC0000355; +pub const STATUS_AUDITING_DISABLED: NTSTATUS = 0xC0000356; +pub const STATUS_PRENT4_MACHINE_ACCOUNT: NTSTATUS = 0xC0000357; +pub const STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: NTSTATUS = 0xC0000358; +pub const STATUS_INVALID_IMAGE_WIN_32: NTSTATUS = 0xC0000359; +pub const STATUS_INVALID_IMAGE_WIN_64: NTSTATUS = 0xC000035A; +pub const STATUS_BAD_BINDINGS: NTSTATUS = 0xC000035B; +pub const STATUS_NETWORK_SESSION_EXPIRED: NTSTATUS = 0xC000035C; +pub const STATUS_APPHELP_BLOCK: NTSTATUS = 0xC000035D; +pub const STATUS_ALL_SIDS_FILTERED: NTSTATUS = 0xC000035E; +pub const STATUS_NOT_SAFE_MODE_DRIVER: NTSTATUS = 0xC000035F; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT: NTSTATUS = 0xC0000361; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_PATH: NTSTATUS = 0xC0000362; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER: NTSTATUS = 0xC0000363; +pub const STATUS_ACCESS_DISABLED_BY_POLICY_OTHER: NTSTATUS = 0xC0000364; +pub const STATUS_FAILED_DRIVER_ENTRY: NTSTATUS = 0xC0000365; +pub const STATUS_DEVICE_ENUMERATION_ERROR: NTSTATUS = 0xC0000366; +pub const STATUS_MOUNT_POINT_NOT_RESOLVED: NTSTATUS = 0xC0000368; +pub const STATUS_INVALID_DEVICE_OBJECT_PARAMETER: NTSTATUS = 0xC0000369; +pub const STATUS_MCA_OCCURED: NTSTATUS = 0xC000036A; +pub const STATUS_DRIVER_BLOCKED_CRITICAL: NTSTATUS = 0xC000036B; +pub const STATUS_DRIVER_BLOCKED: NTSTATUS = 0xC000036C; +pub const STATUS_DRIVER_DATABASE_ERROR: NTSTATUS = 0xC000036D; +pub const STATUS_SYSTEM_HIVE_TOO_LARGE: NTSTATUS = 0xC000036E; +pub const STATUS_INVALID_IMPORT_OF_NON_DLL: NTSTATUS = 0xC000036F; +pub const STATUS_DS_SHUTTING_DOWN: NTSTATUS = 0x40000370; +pub const STATUS_NO_SECRETS: NTSTATUS = 0xC0000371; +pub const STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: NTSTATUS = 0xC0000372; +pub const STATUS_FAILED_STACK_SWITCH: NTSTATUS = 0xC0000373; +pub const STATUS_HEAP_CORRUPTION: NTSTATUS = 0xC0000374; +pub const STATUS_SMARTCARD_WRONG_PIN: NTSTATUS = 0xC0000380; +pub const STATUS_SMARTCARD_CARD_BLOCKED: NTSTATUS = 0xC0000381; +pub const STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED: NTSTATUS = 0xC0000382; +pub const STATUS_SMARTCARD_NO_CARD: NTSTATUS = 0xC0000383; +pub const STATUS_SMARTCARD_NO_KEY_CONTAINER: NTSTATUS = 0xC0000384; +pub const STATUS_SMARTCARD_NO_CERTIFICATE: NTSTATUS = 0xC0000385; +pub const STATUS_SMARTCARD_NO_KEYSET: NTSTATUS = 0xC0000386; +pub const STATUS_SMARTCARD_IO_ERROR: NTSTATUS = 0xC0000387; +pub const STATUS_DOWNGRADE_DETECTED: NTSTATUS = 0xC0000388; +pub const STATUS_SMARTCARD_CERT_REVOKED: NTSTATUS = 0xC0000389; +pub const STATUS_ISSUING_CA_UNTRUSTED: NTSTATUS = 0xC000038A; +pub const STATUS_REVOCATION_OFFLINE_C: NTSTATUS = 0xC000038B; +pub const STATUS_PKINIT_CLIENT_FAILURE: NTSTATUS = 0xC000038C; +pub const STATUS_SMARTCARD_CERT_EXPIRED: NTSTATUS = 0xC000038D; +pub const STATUS_DRIVER_FAILED_PRIOR_UNLOAD: NTSTATUS = 0xC000038E; +pub const STATUS_SMARTCARD_SILENT_CONTEXT: NTSTATUS = 0xC000038F; +pub const STATUS_PER_USER_TRUST_QUOTA_EXCEEDED: NTSTATUS = 0xC0000401; +pub const STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED: NTSTATUS = 0xC0000402; +pub const STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED: NTSTATUS = 0xC0000403; +pub const STATUS_DS_NAME_NOT_UNIQUE: NTSTATUS = 0xC0000404; +pub const STATUS_DS_DUPLICATE_ID_FOUND: NTSTATUS = 0xC0000405; +pub const STATUS_DS_GROUP_CONVERSION_ERROR: NTSTATUS = 0xC0000406; +pub const STATUS_VOLSNAP_PREPARE_HIBERNATE: NTSTATUS = 0xC0000407; +pub const STATUS_USER2USER_REQUIRED: NTSTATUS = 0xC0000408; +pub const STATUS_STACK_BUFFER_OVERRUN: NTSTATUS = 0xC0000409; +pub const STATUS_NO_S4U_PROT_SUPPORT: NTSTATUS = 0xC000040A; +pub const STATUS_CROSSREALM_DELEGATION_FAILURE: NTSTATUS = 0xC000040B; +pub const STATUS_REVOCATION_OFFLINE_KDC: NTSTATUS = 0xC000040C; +pub const STATUS_ISSUING_CA_UNTRUSTED_KDC: NTSTATUS = 0xC000040D; +pub const STATUS_KDC_CERT_EXPIRED: NTSTATUS = 0xC000040E; +pub const STATUS_KDC_CERT_REVOKED: NTSTATUS = 0xC000040F; +pub const STATUS_PARAMETER_QUOTA_EXCEEDED: NTSTATUS = 0xC0000410; +pub const STATUS_HIBERNATION_FAILURE: NTSTATUS = 0xC0000411; +pub const STATUS_DELAY_LOAD_FAILED: NTSTATUS = 0xC0000412; +pub const STATUS_AUTHENTICATION_FIREWALL_FAILED: NTSTATUS = 0xC0000413; +pub const STATUS_VDM_DISALLOWED: NTSTATUS = 0xC0000414; +pub const STATUS_HUNG_DISPLAY_DRIVER_THREAD: NTSTATUS = 0xC0000415; +pub const STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: NTSTATUS + = 0xC0000416; +pub const STATUS_INVALID_CRUNTIME_PARAMETER: NTSTATUS = 0xC0000417; +pub const STATUS_NTLM_BLOCKED: NTSTATUS = 0xC0000418; +pub const STATUS_DS_SRC_SID_EXISTS_IN_FOREST: NTSTATUS = 0xC0000419; +pub const STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST: NTSTATUS = 0xC000041A; +pub const STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST: NTSTATUS = 0xC000041B; +pub const STATUS_INVALID_USER_PRINCIPAL_NAME: NTSTATUS = 0xC000041C; +pub const STATUS_FATAL_USER_CALLBACK_EXCEPTION: NTSTATUS = 0xC000041D; +pub const STATUS_ASSERTION_FAILURE: NTSTATUS = 0xC0000420; +pub const STATUS_VERIFIER_STOP: NTSTATUS = 0xC0000421; +pub const STATUS_CALLBACK_POP_STACK: NTSTATUS = 0xC0000423; +pub const STATUS_INCOMPATIBLE_DRIVER_BLOCKED: NTSTATUS = 0xC0000424; +pub const STATUS_HIVE_UNLOADED: NTSTATUS = 0xC0000425; +pub const STATUS_COMPRESSION_DISABLED: NTSTATUS = 0xC0000426; +pub const STATUS_FILE_SYSTEM_LIMITATION: NTSTATUS = 0xC0000427; +pub const STATUS_INVALID_IMAGE_HASH: NTSTATUS = 0xC0000428; +pub const STATUS_NOT_CAPABLE: NTSTATUS = 0xC0000429; +pub const STATUS_REQUEST_OUT_OF_SEQUENCE: NTSTATUS = 0xC000042A; +pub const STATUS_IMPLEMENTATION_LIMIT: NTSTATUS = 0xC000042B; +pub const STATUS_ELEVATION_REQUIRED: NTSTATUS = 0xC000042C; +pub const STATUS_NO_SECURITY_CONTEXT: NTSTATUS = 0xC000042D; +pub const STATUS_PKU2U_CERT_FAILURE: NTSTATUS = 0xC000042F; +pub const STATUS_BEYOND_VDL: NTSTATUS = 0xC0000432; +pub const STATUS_ENCOUNTERED_WRITE_IN_PROGRESS: NTSTATUS = 0xC0000433; +pub const STATUS_PTE_CHANGED: NTSTATUS = 0xC0000434; +pub const STATUS_PURGE_FAILED: NTSTATUS = 0xC0000435; +pub const STATUS_CRED_REQUIRES_CONFIRMATION: NTSTATUS = 0xC0000440; +pub const STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: NTSTATUS = 0xC0000441; +pub const STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER: NTSTATUS = 0xC0000442; +pub const STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: NTSTATUS = 0xC0000443; +pub const STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: NTSTATUS = 0xC0000444; +pub const STATUS_CS_ENCRYPTION_FILE_NOT_CSE: NTSTATUS = 0xC0000445; +pub const STATUS_INVALID_LABEL: NTSTATUS = 0xC0000446; +pub const STATUS_DRIVER_PROCESS_TERMINATED: NTSTATUS = 0xC0000450; +pub const STATUS_AMBIGUOUS_SYSTEM_DEVICE: NTSTATUS = 0xC0000451; +pub const STATUS_SYSTEM_DEVICE_NOT_FOUND: NTSTATUS = 0xC0000452; +pub const STATUS_RESTART_BOOT_APPLICATION: NTSTATUS = 0xC0000453; +pub const STATUS_INSUFFICIENT_NVRAM_RESOURCES: NTSTATUS = 0xC0000454; +pub const STATUS_INVALID_SESSION: NTSTATUS = 0xC0000455; +pub const STATUS_THREAD_ALREADY_IN_SESSION: NTSTATUS = 0xC0000456; +pub const STATUS_THREAD_NOT_IN_SESSION: NTSTATUS = 0xC0000457; +pub const STATUS_INVALID_WEIGHT: NTSTATUS = 0xC0000458; +pub const STATUS_REQUEST_PAUSED: NTSTATUS = 0xC0000459; +pub const STATUS_NO_RANGES_PROCESSED: NTSTATUS = 0xC0000460; +pub const STATUS_DISK_RESOURCES_EXHAUSTED: NTSTATUS = 0xC0000461; +pub const STATUS_NEEDS_REMEDIATION: NTSTATUS = 0xC0000462; +pub const STATUS_DEVICE_FEATURE_NOT_SUPPORTED: NTSTATUS = 0xC0000463; +pub const STATUS_DEVICE_UNREACHABLE: NTSTATUS = 0xC0000464; +pub const STATUS_INVALID_TOKEN: NTSTATUS = 0xC0000465; +pub const STATUS_SERVER_UNAVAILABLE: NTSTATUS = 0xC0000466; +pub const STATUS_FILE_NOT_AVAILABLE: NTSTATUS = 0xC0000467; +pub const STATUS_DEVICE_INSUFFICIENT_RESOURCES: NTSTATUS = 0xC0000468; +pub const STATUS_PACKAGE_UPDATING: NTSTATUS = 0xC0000469; +pub const STATUS_NOT_READ_FROM_COPY: NTSTATUS = 0xC000046A; +pub const STATUS_FT_WRITE_FAILURE: NTSTATUS = 0xC000046B; +pub const STATUS_FT_DI_SCAN_REQUIRED: NTSTATUS = 0xC000046C; +pub const STATUS_OBJECT_NOT_EXTERNALLY_BACKED: NTSTATUS = 0xC000046D; +pub const STATUS_EXTERNAL_BACKING_PROVIDER_UNKNOWN: NTSTATUS = 0xC000046E; +pub const STATUS_COMPRESSION_NOT_BENEFICIAL: NTSTATUS = 0xC000046F; +pub const STATUS_DATA_CHECKSUM_ERROR: NTSTATUS = 0xC0000470; +pub const STATUS_INTERMIXED_KERNEL_EA_OPERATION: NTSTATUS = 0xC0000471; +pub const STATUS_TRIM_READ_ZERO_NOT_SUPPORTED: NTSTATUS = 0xC0000472; +pub const STATUS_TOO_MANY_SEGMENT_DESCRIPTORS: NTSTATUS = 0xC0000473; +pub const STATUS_INVALID_OFFSET_ALIGNMENT: NTSTATUS = 0xC0000474; +pub const STATUS_INVALID_FIELD_IN_PARAMETER_LIST: NTSTATUS = 0xC0000475; +pub const STATUS_OPERATION_IN_PROGRESS: NTSTATUS = 0xC0000476; +pub const STATUS_INVALID_INITIATOR_TARGET_PATH: NTSTATUS = 0xC0000477; +pub const STATUS_SCRUB_DATA_DISABLED: NTSTATUS = 0xC0000478; +pub const STATUS_NOT_REDUNDANT_STORAGE: NTSTATUS = 0xC0000479; +pub const STATUS_RESIDENT_FILE_NOT_SUPPORTED: NTSTATUS = 0xC000047A; +pub const STATUS_COMPRESSED_FILE_NOT_SUPPORTED: NTSTATUS = 0xC000047B; +pub const STATUS_DIRECTORY_NOT_SUPPORTED: NTSTATUS = 0xC000047C; +pub const STATUS_IO_OPERATION_TIMEOUT: NTSTATUS = 0xC000047D; +pub const STATUS_SYSTEM_NEEDS_REMEDIATION: NTSTATUS = 0xC000047E; +pub const STATUS_APPX_INTEGRITY_FAILURE_CLR_NGEN: NTSTATUS = 0xC000047F; +pub const STATUS_SHARE_UNAVAILABLE: NTSTATUS = 0xC0000480; +pub const STATUS_APISET_NOT_HOSTED: NTSTATUS = 0xC0000481; +pub const STATUS_APISET_NOT_PRESENT: NTSTATUS = 0xC0000482; +pub const STATUS_DEVICE_HARDWARE_ERROR: NTSTATUS = 0xC0000483; +pub const STATUS_FIRMWARE_SLOT_INVALID: NTSTATUS = 0xC0000484; +pub const STATUS_FIRMWARE_IMAGE_INVALID: NTSTATUS = 0xC0000485; +pub const STATUS_STORAGE_TOPOLOGY_ID_MISMATCH: NTSTATUS = 0xC0000486; +pub const STATUS_WIM_NOT_BOOTABLE: NTSTATUS = 0xC0000487; +pub const STATUS_BLOCKED_BY_PARENTAL_CONTROLS: NTSTATUS = 0xC0000488; +pub const STATUS_NEEDS_REGISTRATION: NTSTATUS = 0xC0000489; +pub const STATUS_QUOTA_ACTIVITY: NTSTATUS = 0xC000048A; +pub const STATUS_CALLBACK_INVOKE_INLINE: NTSTATUS = 0xC000048B; +pub const STATUS_BLOCK_TOO_MANY_REFERENCES: NTSTATUS = 0xC000048C; +pub const STATUS_MARKED_TO_DISALLOW_WRITES: NTSTATUS = 0xC000048D; +pub const STATUS_NETWORK_ACCESS_DENIED_EDP: NTSTATUS = 0xC000048E; +pub const STATUS_ENCLAVE_FAILURE: NTSTATUS = 0xC000048F; +pub const STATUS_PNP_NO_COMPAT_DRIVERS: NTSTATUS = 0xC0000490; +pub const STATUS_PNP_DRIVER_PACKAGE_NOT_FOUND: NTSTATUS = 0xC0000491; +pub const STATUS_PNP_DRIVER_CONFIGURATION_NOT_FOUND: NTSTATUS = 0xC0000492; +pub const STATUS_PNP_DRIVER_CONFIGURATION_INCOMPLETE: NTSTATUS = 0xC0000493; +pub const STATUS_PNP_FUNCTION_DRIVER_REQUIRED: NTSTATUS = 0xC0000494; +pub const STATUS_PNP_DEVICE_CONFIGURATION_PENDING: NTSTATUS = 0xC0000495; +pub const STATUS_DEVICE_HINT_NAME_BUFFER_TOO_SMALL: NTSTATUS = 0xC0000496; +pub const STATUS_PACKAGE_NOT_AVAILABLE: NTSTATUS = 0xC0000497; +pub const STATUS_DEVICE_IN_MAINTENANCE: NTSTATUS = 0xC0000499; +pub const STATUS_NOT_SUPPORTED_ON_DAX: NTSTATUS = 0xC000049A; +pub const STATUS_FREE_SPACE_TOO_FRAGMENTED: NTSTATUS = 0xC000049B; +pub const STATUS_DAX_MAPPING_EXISTS: NTSTATUS = 0xC000049C; +pub const STATUS_CHILD_PROCESS_BLOCKED: NTSTATUS = 0xC000049D; +pub const STATUS_STORAGE_LOST_DATA_PERSISTENCE: NTSTATUS = 0xC000049E; +pub const STATUS_INVALID_TASK_NAME: NTSTATUS = 0xC0000500; +pub const STATUS_INVALID_TASK_INDEX: NTSTATUS = 0xC0000501; +pub const STATUS_THREAD_ALREADY_IN_TASK: NTSTATUS = 0xC0000502; +pub const STATUS_CALLBACK_BYPASS: NTSTATUS = 0xC0000503; +pub const STATUS_UNDEFINED_SCOPE: NTSTATUS = 0xC0000504; +pub const STATUS_INVALID_CAP: NTSTATUS = 0xC0000505; +pub const STATUS_NOT_GUI_PROCESS: NTSTATUS = 0xC0000506; +pub const STATUS_DEVICE_HUNG: NTSTATUS = 0xC0000507; +pub const STATUS_CONTAINER_ASSIGNED: NTSTATUS = 0xC0000508; +pub const STATUS_JOB_NO_CONTAINER: NTSTATUS = 0xC0000509; +pub const STATUS_DEVICE_UNRESPONSIVE: NTSTATUS = 0xC000050A; +pub const STATUS_REPARSE_POINT_ENCOUNTERED: NTSTATUS = 0xC000050B; +pub const STATUS_FAIL_FAST_EXCEPTION: NTSTATUS = 0xC0000602; +pub const STATUS_IMAGE_CERT_REVOKED: NTSTATUS = 0xC0000603; +pub const STATUS_DYNAMIC_CODE_BLOCKED: NTSTATUS = 0xC0000604; +pub const STATUS_IMAGE_CERT_EXPIRED: NTSTATUS = 0xC0000605; +pub const STATUS_PORT_CLOSED: NTSTATUS = 0xC0000700; +pub const STATUS_MESSAGE_LOST: NTSTATUS = 0xC0000701; +pub const STATUS_INVALID_MESSAGE: NTSTATUS = 0xC0000702; +pub const STATUS_REQUEST_CANCELED: NTSTATUS = 0xC0000703; +pub const STATUS_RECURSIVE_DISPATCH: NTSTATUS = 0xC0000704; +pub const STATUS_LPC_RECEIVE_BUFFER_EXPECTED: NTSTATUS = 0xC0000705; +pub const STATUS_LPC_INVALID_CONNECTION_USAGE: NTSTATUS = 0xC0000706; +pub const STATUS_LPC_REQUESTS_NOT_ALLOWED: NTSTATUS = 0xC0000707; +pub const STATUS_RESOURCE_IN_USE: NTSTATUS = 0xC0000708; +pub const STATUS_HARDWARE_MEMORY_ERROR: NTSTATUS = 0xC0000709; +pub const STATUS_THREADPOOL_HANDLE_EXCEPTION: NTSTATUS = 0xC000070A; +pub const STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED: NTSTATUS = 0xC000070B; +pub const STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED: NTSTATUS + = 0xC000070C; +pub const STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED: NTSTATUS = 0xC000070D; +pub const STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED: NTSTATUS = 0xC000070E; +pub const STATUS_THREADPOOL_RELEASED_DURING_OPERATION: NTSTATUS = 0xC000070F; +pub const STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING: NTSTATUS = 0xC0000710; +pub const STATUS_APC_RETURNED_WHILE_IMPERSONATING: NTSTATUS = 0xC0000711; +pub const STATUS_PROCESS_IS_PROTECTED: NTSTATUS = 0xC0000712; +pub const STATUS_MCA_EXCEPTION: NTSTATUS = 0xC0000713; +pub const STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE: NTSTATUS = 0xC0000714; +pub const STATUS_SYMLINK_CLASS_DISABLED: NTSTATUS = 0xC0000715; +pub const STATUS_INVALID_IDN_NORMALIZATION: NTSTATUS = 0xC0000716; +pub const STATUS_NO_UNICODE_TRANSLATION: NTSTATUS = 0xC0000717; +pub const STATUS_ALREADY_REGISTERED: NTSTATUS = 0xC0000718; +pub const STATUS_CONTEXT_MISMATCH: NTSTATUS = 0xC0000719; +pub const STATUS_PORT_ALREADY_HAS_COMPLETION_LIST: NTSTATUS = 0xC000071A; +pub const STATUS_CALLBACK_RETURNED_THREAD_PRIORITY: NTSTATUS = 0xC000071B; +pub const STATUS_INVALID_THREAD: NTSTATUS = 0xC000071C; +pub const STATUS_CALLBACK_RETURNED_TRANSACTION: NTSTATUS = 0xC000071D; +pub const STATUS_CALLBACK_RETURNED_LDR_LOCK: NTSTATUS = 0xC000071E; +pub const STATUS_CALLBACK_RETURNED_LANG: NTSTATUS = 0xC000071F; +pub const STATUS_CALLBACK_RETURNED_PRI_BACK: NTSTATUS = 0xC0000720; +pub const STATUS_CALLBACK_RETURNED_THREAD_AFFINITY: NTSTATUS = 0xC0000721; +pub const STATUS_LPC_HANDLE_COUNT_EXCEEDED: NTSTATUS = 0xC0000722; +pub const STATUS_DISK_REPAIR_DISABLED: NTSTATUS = 0xC0000800; +pub const STATUS_DS_DOMAIN_RENAME_IN_PROGRESS: NTSTATUS = 0xC0000801; +pub const STATUS_DISK_QUOTA_EXCEEDED: NTSTATUS = 0xC0000802; +pub const STATUS_DATA_LOST_REPAIR: NTSTATUS = 0x80000803; +pub const STATUS_CONTENT_BLOCKED: NTSTATUS = 0xC0000804; +pub const STATUS_BAD_CLUSTERS: NTSTATUS = 0xC0000805; +pub const STATUS_VOLUME_DIRTY: NTSTATUS = 0xC0000806; +pub const STATUS_DISK_REPAIR_REDIRECTED: NTSTATUS = 0x40000807; +pub const STATUS_DISK_REPAIR_UNSUCCESSFUL: NTSTATUS = 0xC0000808; +pub const STATUS_CORRUPT_LOG_OVERFULL: NTSTATUS = 0xC0000809; +pub const STATUS_CORRUPT_LOG_CORRUPTED: NTSTATUS = 0xC000080A; +pub const STATUS_CORRUPT_LOG_UNAVAILABLE: NTSTATUS = 0xC000080B; +pub const STATUS_CORRUPT_LOG_DELETED_FULL: NTSTATUS = 0xC000080C; +pub const STATUS_CORRUPT_LOG_CLEARED: NTSTATUS = 0xC000080D; +pub const STATUS_ORPHAN_NAME_EXHAUSTED: NTSTATUS = 0xC000080E; +pub const STATUS_PROACTIVE_SCAN_IN_PROGRESS: NTSTATUS = 0xC000080F; +pub const STATUS_ENCRYPTED_IO_NOT_POSSIBLE: NTSTATUS = 0xC0000810; +pub const STATUS_CORRUPT_LOG_UPLEVEL_RECORDS: NTSTATUS = 0xC0000811; +pub const STATUS_FILE_CHECKED_OUT: NTSTATUS = 0xC0000901; +pub const STATUS_CHECKOUT_REQUIRED: NTSTATUS = 0xC0000902; +pub const STATUS_BAD_FILE_TYPE: NTSTATUS = 0xC0000903; +pub const STATUS_FILE_TOO_LARGE: NTSTATUS = 0xC0000904; +pub const STATUS_FORMS_AUTH_REQUIRED: NTSTATUS = 0xC0000905; +pub const STATUS_VIRUS_INFECTED: NTSTATUS = 0xC0000906; +pub const STATUS_VIRUS_DELETED: NTSTATUS = 0xC0000907; +pub const STATUS_BAD_MCFG_TABLE: NTSTATUS = 0xC0000908; +pub const STATUS_CANNOT_BREAK_OPLOCK: NTSTATUS = 0xC0000909; +pub const STATUS_BAD_KEY: NTSTATUS = 0xC000090A; +pub const STATUS_BAD_DATA: NTSTATUS = 0xC000090B; +pub const STATUS_NO_KEY: NTSTATUS = 0xC000090C; +pub const STATUS_FILE_HANDLE_REVOKED: NTSTATUS = 0xC0000910; +pub const STATUS_WOW_ASSERTION: NTSTATUS = 0xC0009898; +pub const STATUS_INVALID_SIGNATURE: NTSTATUS = 0xC000A000; +pub const STATUS_HMAC_NOT_SUPPORTED: NTSTATUS = 0xC000A001; +pub const STATUS_AUTH_TAG_MISMATCH: NTSTATUS = 0xC000A002; +pub const STATUS_INVALID_STATE_TRANSITION: NTSTATUS = 0xC000A003; +pub const STATUS_INVALID_KERNEL_INFO_VERSION: NTSTATUS = 0xC000A004; +pub const STATUS_INVALID_PEP_INFO_VERSION: NTSTATUS = 0xC000A005; +pub const STATUS_HANDLE_REVOKED: NTSTATUS = 0xC000A006; +pub const STATUS_EOF_ON_GHOSTED_RANGE: NTSTATUS = 0xC000A007; +pub const STATUS_IPSEC_QUEUE_OVERFLOW: NTSTATUS = 0xC000A010; +pub const STATUS_ND_QUEUE_OVERFLOW: NTSTATUS = 0xC000A011; +pub const STATUS_HOPLIMIT_EXCEEDED: NTSTATUS = 0xC000A012; +pub const STATUS_PROTOCOL_NOT_SUPPORTED: NTSTATUS = 0xC000A013; +pub const STATUS_FASTPATH_REJECTED: NTSTATUS = 0xC000A014; +pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: NTSTATUS = 0xC000A080; +pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: NTSTATUS = 0xC000A081; +pub const STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: NTSTATUS = 0xC000A082; +pub const STATUS_XML_PARSE_ERROR: NTSTATUS = 0xC000A083; +pub const STATUS_XMLDSIG_ERROR: NTSTATUS = 0xC000A084; +pub const STATUS_WRONG_COMPARTMENT: NTSTATUS = 0xC000A085; +pub const STATUS_AUTHIP_FAILURE: NTSTATUS = 0xC000A086; +pub const STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: NTSTATUS = 0xC000A087; +pub const STATUS_DS_OID_NOT_FOUND: NTSTATUS = 0xC000A088; +pub const STATUS_INCORRECT_ACCOUNT_TYPE: NTSTATUS = 0xC000A089; +pub const STATUS_HASH_NOT_SUPPORTED: NTSTATUS = 0xC000A100; +pub const STATUS_HASH_NOT_PRESENT: NTSTATUS = 0xC000A101; +pub const STATUS_SECONDARY_IC_PROVIDER_NOT_REGISTERED: NTSTATUS = 0xC000A121; +pub const STATUS_GPIO_CLIENT_INFORMATION_INVALID: NTSTATUS = 0xC000A122; +pub const STATUS_GPIO_VERSION_NOT_SUPPORTED: NTSTATUS = 0xC000A123; +pub const STATUS_GPIO_INVALID_REGISTRATION_PACKET: NTSTATUS = 0xC000A124; +pub const STATUS_GPIO_OPERATION_DENIED: NTSTATUS = 0xC000A125; +pub const STATUS_GPIO_INCOMPATIBLE_CONNECT_MODE: NTSTATUS = 0xC000A126; +pub const STATUS_GPIO_INTERRUPT_ALREADY_UNMASKED: NTSTATUS = 0x8000A127; +pub const STATUS_CANNOT_SWITCH_RUNLEVEL: NTSTATUS = 0xC000A141; +pub const STATUS_INVALID_RUNLEVEL_SETTING: NTSTATUS = 0xC000A142; +pub const STATUS_RUNLEVEL_SWITCH_TIMEOUT: NTSTATUS = 0xC000A143; +pub const STATUS_SERVICES_FAILED_AUTOSTART: NTSTATUS = 0x4000A144; +pub const STATUS_RUNLEVEL_SWITCH_AGENT_TIMEOUT: NTSTATUS = 0xC000A145; +pub const STATUS_RUNLEVEL_SWITCH_IN_PROGRESS: NTSTATUS = 0xC000A146; +pub const STATUS_NOT_APPCONTAINER: NTSTATUS = 0xC000A200; +pub const STATUS_NOT_SUPPORTED_IN_APPCONTAINER: NTSTATUS = 0xC000A201; +pub const STATUS_INVALID_PACKAGE_SID_LENGTH: NTSTATUS = 0xC000A202; +pub const STATUS_APP_DATA_NOT_FOUND: NTSTATUS = 0xC000A281; +pub const STATUS_APP_DATA_EXPIRED: NTSTATUS = 0xC000A282; +pub const STATUS_APP_DATA_CORRUPT: NTSTATUS = 0xC000A283; +pub const STATUS_APP_DATA_LIMIT_EXCEEDED: NTSTATUS = 0xC000A284; +pub const STATUS_APP_DATA_REBOOT_REQUIRED: NTSTATUS = 0xC000A285; +pub const STATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED: NTSTATUS = 0xC000A2A1; +pub const STATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: NTSTATUS = 0xC000A2A2; +pub const STATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED: NTSTATUS = 0xC000A2A3; +pub const STATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: NTSTATUS = 0xC000A2A4; +pub const STATUS_CLOUD_FILE_PROVIDER_UNKNOWN: NTSTATUS = 0xC000CF00; +pub const STATUS_CLOUD_FILE_PROVIDER_NOT_RUNNING: NTSTATUS = 0xC000CF01; +pub const STATUS_CLOUD_FILE_METADATA_CORRUPT: NTSTATUS = 0xC000CF02; +pub const STATUS_CLOUD_FILE_METADATA_TOO_LARGE: NTSTATUS = 0xC000CF03; +pub const STATUS_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE: NTSTATUS = 0x8000CF04; +pub const DBG_NO_STATE_CHANGE: NTSTATUS = 0xC0010001; +pub const DBG_APP_NOT_IDLE: NTSTATUS = 0xC0010002; +pub const RPC_NT_INVALID_STRING_BINDING: NTSTATUS = 0xC0020001; +pub const RPC_NT_WRONG_KIND_OF_BINDING: NTSTATUS = 0xC0020002; +pub const RPC_NT_INVALID_BINDING: NTSTATUS = 0xC0020003; +pub const RPC_NT_PROTSEQ_NOT_SUPPORTED: NTSTATUS = 0xC0020004; +pub const RPC_NT_INVALID_RPC_PROTSEQ: NTSTATUS = 0xC0020005; +pub const RPC_NT_INVALID_STRING_UUID: NTSTATUS = 0xC0020006; +pub const RPC_NT_INVALID_ENDPOINT_FORMAT: NTSTATUS = 0xC0020007; +pub const RPC_NT_INVALID_NET_ADDR: NTSTATUS = 0xC0020008; +pub const RPC_NT_NO_ENDPOINT_FOUND: NTSTATUS = 0xC0020009; +pub const RPC_NT_INVALID_TIMEOUT: NTSTATUS = 0xC002000A; +pub const RPC_NT_OBJECT_NOT_FOUND: NTSTATUS = 0xC002000B; +pub const RPC_NT_ALREADY_REGISTERED: NTSTATUS = 0xC002000C; +pub const RPC_NT_TYPE_ALREADY_REGISTERED: NTSTATUS = 0xC002000D; +pub const RPC_NT_ALREADY_LISTENING: NTSTATUS = 0xC002000E; +pub const RPC_NT_NO_PROTSEQS_REGISTERED: NTSTATUS = 0xC002000F; +pub const RPC_NT_NOT_LISTENING: NTSTATUS = 0xC0020010; +pub const RPC_NT_UNKNOWN_MGR_TYPE: NTSTATUS = 0xC0020011; +pub const RPC_NT_UNKNOWN_IF: NTSTATUS = 0xC0020012; +pub const RPC_NT_NO_BINDINGS: NTSTATUS = 0xC0020013; +pub const RPC_NT_NO_PROTSEQS: NTSTATUS = 0xC0020014; +pub const RPC_NT_CANT_CREATE_ENDPOINT: NTSTATUS = 0xC0020015; +pub const RPC_NT_OUT_OF_RESOURCES: NTSTATUS = 0xC0020016; +pub const RPC_NT_SERVER_UNAVAILABLE: NTSTATUS = 0xC0020017; +pub const RPC_NT_SERVER_TOO_BUSY: NTSTATUS = 0xC0020018; +pub const RPC_NT_INVALID_NETWORK_OPTIONS: NTSTATUS = 0xC0020019; +pub const RPC_NT_NO_CALL_ACTIVE: NTSTATUS = 0xC002001A; +pub const RPC_NT_CALL_FAILED: NTSTATUS = 0xC002001B; +pub const RPC_NT_CALL_FAILED_DNE: NTSTATUS = 0xC002001C; +pub const RPC_NT_PROTOCOL_ERROR: NTSTATUS = 0xC002001D; +pub const RPC_NT_UNSUPPORTED_TRANS_SYN: NTSTATUS = 0xC002001F; +pub const RPC_NT_UNSUPPORTED_TYPE: NTSTATUS = 0xC0020021; +pub const RPC_NT_INVALID_TAG: NTSTATUS = 0xC0020022; +pub const RPC_NT_INVALID_BOUND: NTSTATUS = 0xC0020023; +pub const RPC_NT_NO_ENTRY_NAME: NTSTATUS = 0xC0020024; +pub const RPC_NT_INVALID_NAME_SYNTAX: NTSTATUS = 0xC0020025; +pub const RPC_NT_UNSUPPORTED_NAME_SYNTAX: NTSTATUS = 0xC0020026; +pub const RPC_NT_UUID_NO_ADDRESS: NTSTATUS = 0xC0020028; +pub const RPC_NT_DUPLICATE_ENDPOINT: NTSTATUS = 0xC0020029; +pub const RPC_NT_UNKNOWN_AUTHN_TYPE: NTSTATUS = 0xC002002A; +pub const RPC_NT_MAX_CALLS_TOO_SMALL: NTSTATUS = 0xC002002B; +pub const RPC_NT_STRING_TOO_LONG: NTSTATUS = 0xC002002C; +pub const RPC_NT_PROTSEQ_NOT_FOUND: NTSTATUS = 0xC002002D; +pub const RPC_NT_PROCNUM_OUT_OF_RANGE: NTSTATUS = 0xC002002E; +pub const RPC_NT_BINDING_HAS_NO_AUTH: NTSTATUS = 0xC002002F; +pub const RPC_NT_UNKNOWN_AUTHN_SERVICE: NTSTATUS = 0xC0020030; +pub const RPC_NT_UNKNOWN_AUTHN_LEVEL: NTSTATUS = 0xC0020031; +pub const RPC_NT_INVALID_AUTH_IDENTITY: NTSTATUS = 0xC0020032; +pub const RPC_NT_UNKNOWN_AUTHZ_SERVICE: NTSTATUS = 0xC0020033; +pub const EPT_NT_INVALID_ENTRY: NTSTATUS = 0xC0020034; +pub const EPT_NT_CANT_PERFORM_OP: NTSTATUS = 0xC0020035; +pub const EPT_NT_NOT_REGISTERED: NTSTATUS = 0xC0020036; +pub const RPC_NT_NOTHING_TO_EXPORT: NTSTATUS = 0xC0020037; +pub const RPC_NT_INCOMPLETE_NAME: NTSTATUS = 0xC0020038; +pub const RPC_NT_INVALID_VERS_OPTION: NTSTATUS = 0xC0020039; +pub const RPC_NT_NO_MORE_MEMBERS: NTSTATUS = 0xC002003A; +pub const RPC_NT_NOT_ALL_OBJS_UNEXPORTED: NTSTATUS = 0xC002003B; +pub const RPC_NT_INTERFACE_NOT_FOUND: NTSTATUS = 0xC002003C; +pub const RPC_NT_ENTRY_ALREADY_EXISTS: NTSTATUS = 0xC002003D; +pub const RPC_NT_ENTRY_NOT_FOUND: NTSTATUS = 0xC002003E; +pub const RPC_NT_NAME_SERVICE_UNAVAILABLE: NTSTATUS = 0xC002003F; +pub const RPC_NT_INVALID_NAF_ID: NTSTATUS = 0xC0020040; +pub const RPC_NT_CANNOT_SUPPORT: NTSTATUS = 0xC0020041; +pub const RPC_NT_NO_CONTEXT_AVAILABLE: NTSTATUS = 0xC0020042; +pub const RPC_NT_INTERNAL_ERROR: NTSTATUS = 0xC0020043; +pub const RPC_NT_ZERO_DIVIDE: NTSTATUS = 0xC0020044; +pub const RPC_NT_ADDRESS_ERROR: NTSTATUS = 0xC0020045; +pub const RPC_NT_FP_DIV_ZERO: NTSTATUS = 0xC0020046; +pub const RPC_NT_FP_UNDERFLOW: NTSTATUS = 0xC0020047; +pub const RPC_NT_FP_OVERFLOW: NTSTATUS = 0xC0020048; +pub const RPC_NT_NO_MORE_ENTRIES: NTSTATUS = 0xC0030001; +pub const RPC_NT_SS_CHAR_TRANS_OPEN_FAIL: NTSTATUS = 0xC0030002; +pub const RPC_NT_SS_CHAR_TRANS_SHORT_FILE: NTSTATUS = 0xC0030003; +pub const RPC_NT_SS_IN_NULL_CONTEXT: NTSTATUS = 0xC0030004; +pub const RPC_NT_SS_CONTEXT_MISMATCH: NTSTATUS = 0xC0030005; +pub const RPC_NT_SS_CONTEXT_DAMAGED: NTSTATUS = 0xC0030006; +pub const RPC_NT_SS_HANDLES_MISMATCH: NTSTATUS = 0xC0030007; +pub const RPC_NT_SS_CANNOT_GET_CALL_HANDLE: NTSTATUS = 0xC0030008; +pub const RPC_NT_NULL_REF_POINTER: NTSTATUS = 0xC0030009; +pub const RPC_NT_ENUM_VALUE_OUT_OF_RANGE: NTSTATUS = 0xC003000A; +pub const RPC_NT_BYTE_COUNT_TOO_SMALL: NTSTATUS = 0xC003000B; +pub const RPC_NT_BAD_STUB_DATA: NTSTATUS = 0xC003000C; +pub const RPC_NT_CALL_IN_PROGRESS: NTSTATUS = 0xC0020049; +pub const RPC_NT_NO_MORE_BINDINGS: NTSTATUS = 0xC002004A; +pub const RPC_NT_GROUP_MEMBER_NOT_FOUND: NTSTATUS = 0xC002004B; +pub const EPT_NT_CANT_CREATE: NTSTATUS = 0xC002004C; +pub const RPC_NT_INVALID_OBJECT: NTSTATUS = 0xC002004D; +pub const RPC_NT_NO_INTERFACES: NTSTATUS = 0xC002004F; +pub const RPC_NT_CALL_CANCELLED: NTSTATUS = 0xC0020050; +pub const RPC_NT_BINDING_INCOMPLETE: NTSTATUS = 0xC0020051; +pub const RPC_NT_COMM_FAILURE: NTSTATUS = 0xC0020052; +pub const RPC_NT_UNSUPPORTED_AUTHN_LEVEL: NTSTATUS = 0xC0020053; +pub const RPC_NT_NO_PRINC_NAME: NTSTATUS = 0xC0020054; +pub const RPC_NT_NOT_RPC_ERROR: NTSTATUS = 0xC0020055; +pub const RPC_NT_UUID_LOCAL_ONLY: NTSTATUS = 0x40020056; +pub const RPC_NT_SEC_PKG_ERROR: NTSTATUS = 0xC0020057; +pub const RPC_NT_NOT_CANCELLED: NTSTATUS = 0xC0020058; +pub const RPC_NT_INVALID_ES_ACTION: NTSTATUS = 0xC0030059; +pub const RPC_NT_WRONG_ES_VERSION: NTSTATUS = 0xC003005A; +pub const RPC_NT_WRONG_STUB_VERSION: NTSTATUS = 0xC003005B; +pub const RPC_NT_INVALID_PIPE_OBJECT: NTSTATUS = 0xC003005C; +pub const RPC_NT_INVALID_PIPE_OPERATION: NTSTATUS = 0xC003005D; +pub const RPC_NT_WRONG_PIPE_VERSION: NTSTATUS = 0xC003005E; +pub const RPC_NT_PIPE_CLOSED: NTSTATUS = 0xC003005F; +pub const RPC_NT_PIPE_DISCIPLINE_ERROR: NTSTATUS = 0xC0030060; +pub const RPC_NT_PIPE_EMPTY: NTSTATUS = 0xC0030061; +pub const RPC_NT_INVALID_ASYNC_HANDLE: NTSTATUS = 0xC0020062; +pub const RPC_NT_INVALID_ASYNC_CALL: NTSTATUS = 0xC0020063; +pub const RPC_NT_PROXY_ACCESS_DENIED: NTSTATUS = 0xC0020064; +pub const RPC_NT_COOKIE_AUTH_FAILED: NTSTATUS = 0xC0020065; +pub const RPC_NT_SEND_INCOMPLETE: NTSTATUS = 0x400200AF; +pub const STATUS_ACPI_INVALID_OPCODE: NTSTATUS = 0xC0140001; +pub const STATUS_ACPI_STACK_OVERFLOW: NTSTATUS = 0xC0140002; +pub const STATUS_ACPI_ASSERT_FAILED: NTSTATUS = 0xC0140003; +pub const STATUS_ACPI_INVALID_INDEX: NTSTATUS = 0xC0140004; +pub const STATUS_ACPI_INVALID_ARGUMENT: NTSTATUS = 0xC0140005; +pub const STATUS_ACPI_FATAL: NTSTATUS = 0xC0140006; +pub const STATUS_ACPI_INVALID_SUPERNAME: NTSTATUS = 0xC0140007; +pub const STATUS_ACPI_INVALID_ARGTYPE: NTSTATUS = 0xC0140008; +pub const STATUS_ACPI_INVALID_OBJTYPE: NTSTATUS = 0xC0140009; +pub const STATUS_ACPI_INVALID_TARGETTYPE: NTSTATUS = 0xC014000A; +pub const STATUS_ACPI_INCORRECT_ARGUMENT_COUNT: NTSTATUS = 0xC014000B; +pub const STATUS_ACPI_ADDRESS_NOT_MAPPED: NTSTATUS = 0xC014000C; +pub const STATUS_ACPI_INVALID_EVENTTYPE: NTSTATUS = 0xC014000D; +pub const STATUS_ACPI_HANDLER_COLLISION: NTSTATUS = 0xC014000E; +pub const STATUS_ACPI_INVALID_DATA: NTSTATUS = 0xC014000F; +pub const STATUS_ACPI_INVALID_REGION: NTSTATUS = 0xC0140010; +pub const STATUS_ACPI_INVALID_ACCESS_SIZE: NTSTATUS = 0xC0140011; +pub const STATUS_ACPI_ACQUIRE_GLOBAL_LOCK: NTSTATUS = 0xC0140012; +pub const STATUS_ACPI_ALREADY_INITIALIZED: NTSTATUS = 0xC0140013; +pub const STATUS_ACPI_NOT_INITIALIZED: NTSTATUS = 0xC0140014; +pub const STATUS_ACPI_INVALID_MUTEX_LEVEL: NTSTATUS = 0xC0140015; +pub const STATUS_ACPI_MUTEX_NOT_OWNED: NTSTATUS = 0xC0140016; +pub const STATUS_ACPI_MUTEX_NOT_OWNER: NTSTATUS = 0xC0140017; +pub const STATUS_ACPI_RS_ACCESS: NTSTATUS = 0xC0140018; +pub const STATUS_ACPI_INVALID_TABLE: NTSTATUS = 0xC0140019; +pub const STATUS_ACPI_REG_HANDLER_FAILED: NTSTATUS = 0xC0140020; +pub const STATUS_ACPI_POWER_REQUEST_FAILED: NTSTATUS = 0xC0140021; +pub const STATUS_CTX_WINSTATION_NAME_INVALID: NTSTATUS = 0xC00A0001; +pub const STATUS_CTX_INVALID_PD: NTSTATUS = 0xC00A0002; +pub const STATUS_CTX_PD_NOT_FOUND: NTSTATUS = 0xC00A0003; +pub const STATUS_CTX_CDM_CONNECT: NTSTATUS = 0x400A0004; +pub const STATUS_CTX_CDM_DISCONNECT: NTSTATUS = 0x400A0005; +pub const STATUS_CTX_CLOSE_PENDING: NTSTATUS = 0xC00A0006; +pub const STATUS_CTX_NO_OUTBUF: NTSTATUS = 0xC00A0007; +pub const STATUS_CTX_MODEM_INF_NOT_FOUND: NTSTATUS = 0xC00A0008; +pub const STATUS_CTX_INVALID_MODEMNAME: NTSTATUS = 0xC00A0009; +pub const STATUS_CTX_RESPONSE_ERROR: NTSTATUS = 0xC00A000A; +pub const STATUS_CTX_MODEM_RESPONSE_TIMEOUT: NTSTATUS = 0xC00A000B; +pub const STATUS_CTX_MODEM_RESPONSE_NO_CARRIER: NTSTATUS = 0xC00A000C; +pub const STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE: NTSTATUS = 0xC00A000D; +pub const STATUS_CTX_MODEM_RESPONSE_BUSY: NTSTATUS = 0xC00A000E; +pub const STATUS_CTX_MODEM_RESPONSE_VOICE: NTSTATUS = 0xC00A000F; +pub const STATUS_CTX_TD_ERROR: NTSTATUS = 0xC00A0010; +pub const STATUS_CTX_LICENSE_CLIENT_INVALID: NTSTATUS = 0xC00A0012; +pub const STATUS_CTX_LICENSE_NOT_AVAILABLE: NTSTATUS = 0xC00A0013; +pub const STATUS_CTX_LICENSE_EXPIRED: NTSTATUS = 0xC00A0014; +pub const STATUS_CTX_WINSTATION_NOT_FOUND: NTSTATUS = 0xC00A0015; +pub const STATUS_CTX_WINSTATION_NAME_COLLISION: NTSTATUS = 0xC00A0016; +pub const STATUS_CTX_WINSTATION_BUSY: NTSTATUS = 0xC00A0017; +pub const STATUS_CTX_BAD_VIDEO_MODE: NTSTATUS = 0xC00A0018; +pub const STATUS_CTX_GRAPHICS_INVALID: NTSTATUS = 0xC00A0022; +pub const STATUS_CTX_NOT_CONSOLE: NTSTATUS = 0xC00A0024; +pub const STATUS_CTX_CLIENT_QUERY_TIMEOUT: NTSTATUS = 0xC00A0026; +pub const STATUS_CTX_CONSOLE_DISCONNECT: NTSTATUS = 0xC00A0027; +pub const STATUS_CTX_CONSOLE_CONNECT: NTSTATUS = 0xC00A0028; +pub const STATUS_CTX_SHADOW_DENIED: NTSTATUS = 0xC00A002A; +pub const STATUS_CTX_WINSTATION_ACCESS_DENIED: NTSTATUS = 0xC00A002B; +pub const STATUS_CTX_INVALID_WD: NTSTATUS = 0xC00A002E; +pub const STATUS_CTX_WD_NOT_FOUND: NTSTATUS = 0xC00A002F; +pub const STATUS_CTX_SHADOW_INVALID: NTSTATUS = 0xC00A0030; +pub const STATUS_CTX_SHADOW_DISABLED: NTSTATUS = 0xC00A0031; +pub const STATUS_RDP_PROTOCOL_ERROR: NTSTATUS = 0xC00A0032; +pub const STATUS_CTX_CLIENT_LICENSE_NOT_SET: NTSTATUS = 0xC00A0033; +pub const STATUS_CTX_CLIENT_LICENSE_IN_USE: NTSTATUS = 0xC00A0034; +pub const STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE: NTSTATUS = 0xC00A0035; +pub const STATUS_CTX_SHADOW_NOT_RUNNING: NTSTATUS = 0xC00A0036; +pub const STATUS_CTX_LOGON_DISABLED: NTSTATUS = 0xC00A0037; +pub const STATUS_CTX_SECURITY_LAYER_ERROR: NTSTATUS = 0xC00A0038; +pub const STATUS_TS_INCOMPATIBLE_SESSIONS: NTSTATUS = 0xC00A0039; +pub const STATUS_TS_VIDEO_SUBSYSTEM_ERROR: NTSTATUS = 0xC00A003A; +pub const STATUS_PNP_BAD_MPS_TABLE: NTSTATUS = 0xC0040035; +pub const STATUS_PNP_TRANSLATION_FAILED: NTSTATUS = 0xC0040036; +pub const STATUS_PNP_IRQ_TRANSLATION_FAILED: NTSTATUS = 0xC0040037; +pub const STATUS_PNP_INVALID_ID: NTSTATUS = 0xC0040038; +pub const STATUS_IO_REISSUE_AS_CACHED: NTSTATUS = 0xC0040039; +pub const STATUS_MUI_FILE_NOT_FOUND: NTSTATUS = 0xC00B0001; +pub const STATUS_MUI_INVALID_FILE: NTSTATUS = 0xC00B0002; +pub const STATUS_MUI_INVALID_RC_CONFIG: NTSTATUS = 0xC00B0003; +pub const STATUS_MUI_INVALID_LOCALE_NAME: NTSTATUS = 0xC00B0004; +pub const STATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME: NTSTATUS = 0xC00B0005; +pub const STATUS_MUI_FILE_NOT_LOADED: NTSTATUS = 0xC00B0006; +pub const STATUS_RESOURCE_ENUM_USER_STOP: NTSTATUS = 0xC00B0007; +//FILTER_FLT_NTSTATUS_FROM_HRESULT +pub const STATUS_FLT_NO_HANDLER_DEFINED: NTSTATUS = 0xC01C0001; +pub const STATUS_FLT_CONTEXT_ALREADY_DEFINED: NTSTATUS = 0xC01C0002; +pub const STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST: NTSTATUS = 0xC01C0003; +pub const STATUS_FLT_DISALLOW_FAST_IO: NTSTATUS = 0xC01C0004; +pub const STATUS_FLT_INVALID_NAME_REQUEST: NTSTATUS = 0xC01C0005; +pub const STATUS_FLT_NOT_SAFE_TO_POST_OPERATION: NTSTATUS = 0xC01C0006; +pub const STATUS_FLT_NOT_INITIALIZED: NTSTATUS = 0xC01C0007; +pub const STATUS_FLT_FILTER_NOT_READY: NTSTATUS = 0xC01C0008; +pub const STATUS_FLT_POST_OPERATION_CLEANUP: NTSTATUS = 0xC01C0009; +pub const STATUS_FLT_INTERNAL_ERROR: NTSTATUS = 0xC01C000A; +pub const STATUS_FLT_DELETING_OBJECT: NTSTATUS = 0xC01C000B; +pub const STATUS_FLT_MUST_BE_NONPAGED_POOL: NTSTATUS = 0xC01C000C; +pub const STATUS_FLT_DUPLICATE_ENTRY: NTSTATUS = 0xC01C000D; +pub const STATUS_FLT_CBDQ_DISABLED: NTSTATUS = 0xC01C000E; +pub const STATUS_FLT_DO_NOT_ATTACH: NTSTATUS = 0xC01C000F; +pub const STATUS_FLT_DO_NOT_DETACH: NTSTATUS = 0xC01C0010; +pub const STATUS_FLT_INSTANCE_ALTITUDE_COLLISION: NTSTATUS = 0xC01C0011; +pub const STATUS_FLT_INSTANCE_NAME_COLLISION: NTSTATUS = 0xC01C0012; +pub const STATUS_FLT_FILTER_NOT_FOUND: NTSTATUS = 0xC01C0013; +pub const STATUS_FLT_VOLUME_NOT_FOUND: NTSTATUS = 0xC01C0014; +pub const STATUS_FLT_INSTANCE_NOT_FOUND: NTSTATUS = 0xC01C0015; +pub const STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND: NTSTATUS = 0xC01C0016; +pub const STATUS_FLT_INVALID_CONTEXT_REGISTRATION: NTSTATUS = 0xC01C0017; +pub const STATUS_FLT_NAME_CACHE_MISS: NTSTATUS = 0xC01C0018; +pub const STATUS_FLT_NO_DEVICE_OBJECT: NTSTATUS = 0xC01C0019; +pub const STATUS_FLT_VOLUME_ALREADY_MOUNTED: NTSTATUS = 0xC01C001A; +pub const STATUS_FLT_ALREADY_ENLISTED: NTSTATUS = 0xC01C001B; +pub const STATUS_FLT_CONTEXT_ALREADY_LINKED: NTSTATUS = 0xC01C001C; +pub const STATUS_FLT_NO_WAITER_FOR_REPLY: NTSTATUS = 0xC01C0020; +pub const STATUS_FLT_REGISTRATION_BUSY: NTSTATUS = 0xC01C0023; +pub const STATUS_SXS_SECTION_NOT_FOUND: NTSTATUS = 0xC0150001; +pub const STATUS_SXS_CANT_GEN_ACTCTX: NTSTATUS = 0xC0150002; +pub const STATUS_SXS_INVALID_ACTCTXDATA_FORMAT: NTSTATUS = 0xC0150003; +pub const STATUS_SXS_ASSEMBLY_NOT_FOUND: NTSTATUS = 0xC0150004; +pub const STATUS_SXS_MANIFEST_FORMAT_ERROR: NTSTATUS = 0xC0150005; +pub const STATUS_SXS_MANIFEST_PARSE_ERROR: NTSTATUS = 0xC0150006; +pub const STATUS_SXS_ACTIVATION_CONTEXT_DISABLED: NTSTATUS = 0xC0150007; +pub const STATUS_SXS_KEY_NOT_FOUND: NTSTATUS = 0xC0150008; +pub const STATUS_SXS_VERSION_CONFLICT: NTSTATUS = 0xC0150009; +pub const STATUS_SXS_WRONG_SECTION_TYPE: NTSTATUS = 0xC015000A; +pub const STATUS_SXS_THREAD_QUERIES_DISABLED: NTSTATUS = 0xC015000B; +pub const STATUS_SXS_ASSEMBLY_MISSING: NTSTATUS = 0xC015000C; +pub const STATUS_SXS_RELEASE_ACTIVATION_CONTEXT: NTSTATUS = 0x4015000D; +pub const STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET: NTSTATUS = 0xC015000E; +pub const STATUS_SXS_EARLY_DEACTIVATION: NTSTATUS = 0xC015000F; +pub const STATUS_SXS_INVALID_DEACTIVATION: NTSTATUS = 0xC0150010; +pub const STATUS_SXS_MULTIPLE_DEACTIVATION: NTSTATUS = 0xC0150011; +pub const STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: NTSTATUS = 0xC0150012; +pub const STATUS_SXS_PROCESS_TERMINATION_REQUESTED: NTSTATUS = 0xC0150013; +pub const STATUS_SXS_CORRUPT_ACTIVATION_STACK: NTSTATUS = 0xC0150014; +pub const STATUS_SXS_CORRUPTION: NTSTATUS = 0xC0150015; +pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: NTSTATUS = 0xC0150016; +pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: NTSTATUS = 0xC0150017; +pub const STATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: NTSTATUS = 0xC0150018; +pub const STATUS_SXS_IDENTITY_PARSE_ERROR: NTSTATUS = 0xC0150019; +pub const STATUS_SXS_COMPONENT_STORE_CORRUPT: NTSTATUS = 0xC015001A; +pub const STATUS_SXS_FILE_HASH_MISMATCH: NTSTATUS = 0xC015001B; +pub const STATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: NTSTATUS + = 0xC015001C; +pub const STATUS_SXS_IDENTITIES_DIFFERENT: NTSTATUS = 0xC015001D; +pub const STATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: NTSTATUS = 0xC015001E; +pub const STATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY: NTSTATUS = 0xC015001F; +pub const STATUS_ADVANCED_INSTALLER_FAILED: NTSTATUS = 0xC0150020; +pub const STATUS_XML_ENCODING_MISMATCH: NTSTATUS = 0xC0150021; +pub const STATUS_SXS_MANIFEST_TOO_BIG: NTSTATUS = 0xC0150022; +pub const STATUS_SXS_SETTING_NOT_REGISTERED: NTSTATUS = 0xC0150023; +pub const STATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE: NTSTATUS = 0xC0150024; +pub const STATUS_SMI_PRIMITIVE_INSTALLER_FAILED: NTSTATUS = 0xC0150025; +pub const STATUS_GENERIC_COMMAND_FAILED: NTSTATUS = 0xC0150026; +pub const STATUS_SXS_FILE_HASH_MISSING: NTSTATUS = 0xC0150027; +pub const STATUS_CLUSTER_INVALID_NODE: NTSTATUS = 0xC0130001; +pub const STATUS_CLUSTER_NODE_EXISTS: NTSTATUS = 0xC0130002; +pub const STATUS_CLUSTER_JOIN_IN_PROGRESS: NTSTATUS = 0xC0130003; +pub const STATUS_CLUSTER_NODE_NOT_FOUND: NTSTATUS = 0xC0130004; +pub const STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND: NTSTATUS = 0xC0130005; +pub const STATUS_CLUSTER_NETWORK_EXISTS: NTSTATUS = 0xC0130006; +pub const STATUS_CLUSTER_NETWORK_NOT_FOUND: NTSTATUS = 0xC0130007; +pub const STATUS_CLUSTER_NETINTERFACE_EXISTS: NTSTATUS = 0xC0130008; +pub const STATUS_CLUSTER_NETINTERFACE_NOT_FOUND: NTSTATUS = 0xC0130009; +pub const STATUS_CLUSTER_INVALID_REQUEST: NTSTATUS = 0xC013000A; +pub const STATUS_CLUSTER_INVALID_NETWORK_PROVIDER: NTSTATUS = 0xC013000B; +pub const STATUS_CLUSTER_NODE_DOWN: NTSTATUS = 0xC013000C; +pub const STATUS_CLUSTER_NODE_UNREACHABLE: NTSTATUS = 0xC013000D; +pub const STATUS_CLUSTER_NODE_NOT_MEMBER: NTSTATUS = 0xC013000E; +pub const STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS: NTSTATUS = 0xC013000F; +pub const STATUS_CLUSTER_INVALID_NETWORK: NTSTATUS = 0xC0130010; +pub const STATUS_CLUSTER_NO_NET_ADAPTERS: NTSTATUS = 0xC0130011; +pub const STATUS_CLUSTER_NODE_UP: NTSTATUS = 0xC0130012; +pub const STATUS_CLUSTER_NODE_PAUSED: NTSTATUS = 0xC0130013; +pub const STATUS_CLUSTER_NODE_NOT_PAUSED: NTSTATUS = 0xC0130014; +pub const STATUS_CLUSTER_NO_SECURITY_CONTEXT: NTSTATUS = 0xC0130015; +pub const STATUS_CLUSTER_NETWORK_NOT_INTERNAL: NTSTATUS = 0xC0130016; +pub const STATUS_CLUSTER_POISONED: NTSTATUS = 0xC0130017; +pub const STATUS_CLUSTER_NON_CSV_PATH: NTSTATUS = 0xC0130018; +pub const STATUS_CLUSTER_CSV_VOLUME_NOT_LOCAL: NTSTATUS = 0xC0130019; +pub const STATUS_CLUSTER_CSV_READ_OPLOCK_BREAK_IN_PROGRESS: NTSTATUS = 0xC0130020; +pub const STATUS_CLUSTER_CSV_AUTO_PAUSE_ERROR: NTSTATUS = 0xC0130021; +pub const STATUS_CLUSTER_CSV_REDIRECTED: NTSTATUS = 0xC0130022; +pub const STATUS_CLUSTER_CSV_NOT_REDIRECTED: NTSTATUS = 0xC0130023; +pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING: NTSTATUS = 0xC0130024; +pub const STATUS_CLUSTER_CSV_SNAPSHOT_CREATION_IN_PROGRESS: NTSTATUS = 0xC0130025; +pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING_SUCCEEDED_DOWNLEVEL: NTSTATUS = 0xC0130026; +pub const STATUS_CLUSTER_CSV_NO_SNAPSHOTS: NTSTATUS = 0xC0130027; +pub const STATUS_CSV_IO_PAUSE_TIMEOUT: NTSTATUS = 0xC0130028; +pub const STATUS_CLUSTER_CSV_INVALID_HANDLE: NTSTATUS = 0xC0130029; +pub const STATUS_CLUSTER_CSV_SUPPORTED_ONLY_ON_COORDINATOR: NTSTATUS = 0xC0130030; +pub const STATUS_TRANSACTIONAL_CONFLICT: NTSTATUS = 0xC0190001; +pub const STATUS_INVALID_TRANSACTION: NTSTATUS = 0xC0190002; +pub const STATUS_TRANSACTION_NOT_ACTIVE: NTSTATUS = 0xC0190003; +pub const STATUS_TM_INITIALIZATION_FAILED: NTSTATUS = 0xC0190004; +pub const STATUS_RM_NOT_ACTIVE: NTSTATUS = 0xC0190005; +pub const STATUS_RM_METADATA_CORRUPT: NTSTATUS = 0xC0190006; +pub const STATUS_TRANSACTION_NOT_JOINED: NTSTATUS = 0xC0190007; +pub const STATUS_DIRECTORY_NOT_RM: NTSTATUS = 0xC0190008; +pub const STATUS_COULD_NOT_RESIZE_LOG: NTSTATUS = 0x80190009; +pub const STATUS_TRANSACTIONS_UNSUPPORTED_REMOTE: NTSTATUS = 0xC019000A; +pub const STATUS_LOG_RESIZE_INVALID_SIZE: NTSTATUS = 0xC019000B; +pub const STATUS_REMOTE_FILE_VERSION_MISMATCH: NTSTATUS = 0xC019000C; +pub const STATUS_CRM_PROTOCOL_ALREADY_EXISTS: NTSTATUS = 0xC019000F; +pub const STATUS_TRANSACTION_PROPAGATION_FAILED: NTSTATUS = 0xC0190010; +pub const STATUS_CRM_PROTOCOL_NOT_FOUND: NTSTATUS = 0xC0190011; +pub const STATUS_TRANSACTION_SUPERIOR_EXISTS: NTSTATUS = 0xC0190012; +pub const STATUS_TRANSACTION_REQUEST_NOT_VALID: NTSTATUS = 0xC0190013; +pub const STATUS_TRANSACTION_NOT_REQUESTED: NTSTATUS = 0xC0190014; +pub const STATUS_TRANSACTION_ALREADY_ABORTED: NTSTATUS = 0xC0190015; +pub const STATUS_TRANSACTION_ALREADY_COMMITTED: NTSTATUS = 0xC0190016; +pub const STATUS_TRANSACTION_INVALID_MARSHALL_BUFFER: NTSTATUS = 0xC0190017; +pub const STATUS_CURRENT_TRANSACTION_NOT_VALID: NTSTATUS = 0xC0190018; +pub const STATUS_LOG_GROWTH_FAILED: NTSTATUS = 0xC0190019; +pub const STATUS_OBJECT_NO_LONGER_EXISTS: NTSTATUS = 0xC0190021; +pub const STATUS_STREAM_MINIVERSION_NOT_FOUND: NTSTATUS = 0xC0190022; +pub const STATUS_STREAM_MINIVERSION_NOT_VALID: NTSTATUS = 0xC0190023; +pub const STATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: NTSTATUS + = 0xC0190024; +pub const STATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: NTSTATUS = 0xC0190025; +pub const STATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS: NTSTATUS = 0xC0190026; +pub const STATUS_HANDLE_NO_LONGER_VALID: NTSTATUS = 0xC0190028; +pub const STATUS_NO_TXF_METADATA: NTSTATUS = 0x80190029; +pub const STATUS_LOG_CORRUPTION_DETECTED: NTSTATUS = 0xC0190030; +pub const STATUS_CANT_RECOVER_WITH_HANDLE_OPEN: NTSTATUS = 0x80190031; +pub const STATUS_RM_DISCONNECTED: NTSTATUS = 0xC0190032; +pub const STATUS_ENLISTMENT_NOT_SUPERIOR: NTSTATUS = 0xC0190033; +pub const STATUS_RECOVERY_NOT_NEEDED: NTSTATUS = 0x40190034; +pub const STATUS_RM_ALREADY_STARTED: NTSTATUS = 0x40190035; +pub const STATUS_FILE_IDENTITY_NOT_PERSISTENT: NTSTATUS = 0xC0190036; +pub const STATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: NTSTATUS = 0xC0190037; +pub const STATUS_CANT_CROSS_RM_BOUNDARY: NTSTATUS = 0xC0190038; +pub const STATUS_TXF_DIR_NOT_EMPTY: NTSTATUS = 0xC0190039; +pub const STATUS_INDOUBT_TRANSACTIONS_EXIST: NTSTATUS = 0xC019003A; +pub const STATUS_TM_VOLATILE: NTSTATUS = 0xC019003B; +pub const STATUS_ROLLBACK_TIMER_EXPIRED: NTSTATUS = 0xC019003C; +pub const STATUS_TXF_ATTRIBUTE_CORRUPT: NTSTATUS = 0xC019003D; +pub const STATUS_EFS_NOT_ALLOWED_IN_TRANSACTION: NTSTATUS = 0xC019003E; +pub const STATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED: NTSTATUS = 0xC019003F; +pub const STATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: NTSTATUS = 0xC0190040; +pub const STATUS_TXF_METADATA_ALREADY_PRESENT: NTSTATUS = 0x80190041; +pub const STATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: NTSTATUS = 0x80190042; +pub const STATUS_TRANSACTION_REQUIRED_PROMOTION: NTSTATUS = 0xC0190043; +pub const STATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION: NTSTATUS = 0xC0190044; +pub const STATUS_TRANSACTIONS_NOT_FROZEN: NTSTATUS = 0xC0190045; +pub const STATUS_TRANSACTION_FREEZE_IN_PROGRESS: NTSTATUS = 0xC0190046; +pub const STATUS_NOT_SNAPSHOT_VOLUME: NTSTATUS = 0xC0190047; +pub const STATUS_NO_SAVEPOINT_WITH_OPEN_FILES: NTSTATUS = 0xC0190048; +pub const STATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION: NTSTATUS = 0xC0190049; +pub const STATUS_TM_IDENTITY_MISMATCH: NTSTATUS = 0xC019004A; +pub const STATUS_FLOATED_SECTION: NTSTATUS = 0xC019004B; +pub const STATUS_CANNOT_ACCEPT_TRANSACTED_WORK: NTSTATUS = 0xC019004C; +pub const STATUS_CANNOT_ABORT_TRANSACTIONS: NTSTATUS = 0xC019004D; +pub const STATUS_TRANSACTION_NOT_FOUND: NTSTATUS = 0xC019004E; +pub const STATUS_RESOURCEMANAGER_NOT_FOUND: NTSTATUS = 0xC019004F; +pub const STATUS_ENLISTMENT_NOT_FOUND: NTSTATUS = 0xC0190050; +pub const STATUS_TRANSACTIONMANAGER_NOT_FOUND: NTSTATUS = 0xC0190051; +pub const STATUS_TRANSACTIONMANAGER_NOT_ONLINE: NTSTATUS = 0xC0190052; +pub const STATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: NTSTATUS = 0xC0190053; +pub const STATUS_TRANSACTION_NOT_ROOT: NTSTATUS = 0xC0190054; +pub const STATUS_TRANSACTION_OBJECT_EXPIRED: NTSTATUS = 0xC0190055; +pub const STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: NTSTATUS = 0xC0190056; +pub const STATUS_TRANSACTION_RESPONSE_NOT_ENLISTED: NTSTATUS = 0xC0190057; +pub const STATUS_TRANSACTION_RECORD_TOO_LONG: NTSTATUS = 0xC0190058; +pub const STATUS_NO_LINK_TRACKING_IN_TRANSACTION: NTSTATUS = 0xC0190059; +pub const STATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: NTSTATUS = 0xC019005A; +pub const STATUS_TRANSACTION_INTEGRITY_VIOLATED: NTSTATUS = 0xC019005B; +pub const STATUS_TRANSACTIONMANAGER_IDENTITY_MISMATCH: NTSTATUS = 0xC019005C; +pub const STATUS_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT: NTSTATUS = 0xC019005D; +pub const STATUS_TRANSACTION_MUST_WRITETHROUGH: NTSTATUS = 0xC019005E; +pub const STATUS_TRANSACTION_NO_SUPERIOR: NTSTATUS = 0xC019005F; +pub const STATUS_EXPIRED_HANDLE: NTSTATUS = 0xC0190060; +pub const STATUS_TRANSACTION_NOT_ENLISTED: NTSTATUS = 0xC0190061; +pub const STATUS_LOG_SECTOR_INVALID: NTSTATUS = 0xC01A0001; +pub const STATUS_LOG_SECTOR_PARITY_INVALID: NTSTATUS = 0xC01A0002; +pub const STATUS_LOG_SECTOR_REMAPPED: NTSTATUS = 0xC01A0003; +pub const STATUS_LOG_BLOCK_INCOMPLETE: NTSTATUS = 0xC01A0004; +pub const STATUS_LOG_INVALID_RANGE: NTSTATUS = 0xC01A0005; +pub const STATUS_LOG_BLOCKS_EXHAUSTED: NTSTATUS = 0xC01A0006; +pub const STATUS_LOG_READ_CONTEXT_INVALID: NTSTATUS = 0xC01A0007; +pub const STATUS_LOG_RESTART_INVALID: NTSTATUS = 0xC01A0008; +pub const STATUS_LOG_BLOCK_VERSION: NTSTATUS = 0xC01A0009; +pub const STATUS_LOG_BLOCK_INVALID: NTSTATUS = 0xC01A000A; +pub const STATUS_LOG_READ_MODE_INVALID: NTSTATUS = 0xC01A000B; +pub const STATUS_LOG_NO_RESTART: NTSTATUS = 0x401A000C; +pub const STATUS_LOG_METADATA_CORRUPT: NTSTATUS = 0xC01A000D; +pub const STATUS_LOG_METADATA_INVALID: NTSTATUS = 0xC01A000E; +pub const STATUS_LOG_METADATA_INCONSISTENT: NTSTATUS = 0xC01A000F; +pub const STATUS_LOG_RESERVATION_INVALID: NTSTATUS = 0xC01A0010; +pub const STATUS_LOG_CANT_DELETE: NTSTATUS = 0xC01A0011; +pub const STATUS_LOG_CONTAINER_LIMIT_EXCEEDED: NTSTATUS = 0xC01A0012; +pub const STATUS_LOG_START_OF_LOG: NTSTATUS = 0xC01A0013; +pub const STATUS_LOG_POLICY_ALREADY_INSTALLED: NTSTATUS = 0xC01A0014; +pub const STATUS_LOG_POLICY_NOT_INSTALLED: NTSTATUS = 0xC01A0015; +pub const STATUS_LOG_POLICY_INVALID: NTSTATUS = 0xC01A0016; +pub const STATUS_LOG_POLICY_CONFLICT: NTSTATUS = 0xC01A0017; +pub const STATUS_LOG_PINNED_ARCHIVE_TAIL: NTSTATUS = 0xC01A0018; +pub const STATUS_LOG_RECORD_NONEXISTENT: NTSTATUS = 0xC01A0019; +pub const STATUS_LOG_RECORDS_RESERVED_INVALID: NTSTATUS = 0xC01A001A; +pub const STATUS_LOG_SPACE_RESERVED_INVALID: NTSTATUS = 0xC01A001B; +pub const STATUS_LOG_TAIL_INVALID: NTSTATUS = 0xC01A001C; +pub const STATUS_LOG_FULL: NTSTATUS = 0xC01A001D; +pub const STATUS_LOG_MULTIPLEXED: NTSTATUS = 0xC01A001E; +pub const STATUS_LOG_DEDICATED: NTSTATUS = 0xC01A001F; +pub const STATUS_LOG_ARCHIVE_NOT_IN_PROGRESS: NTSTATUS = 0xC01A0020; +pub const STATUS_LOG_ARCHIVE_IN_PROGRESS: NTSTATUS = 0xC01A0021; +pub const STATUS_LOG_EPHEMERAL: NTSTATUS = 0xC01A0022; +pub const STATUS_LOG_NOT_ENOUGH_CONTAINERS: NTSTATUS = 0xC01A0023; +pub const STATUS_LOG_CLIENT_ALREADY_REGISTERED: NTSTATUS = 0xC01A0024; +pub const STATUS_LOG_CLIENT_NOT_REGISTERED: NTSTATUS = 0xC01A0025; +pub const STATUS_LOG_FULL_HANDLER_IN_PROGRESS: NTSTATUS = 0xC01A0026; +pub const STATUS_LOG_CONTAINER_READ_FAILED: NTSTATUS = 0xC01A0027; +pub const STATUS_LOG_CONTAINER_WRITE_FAILED: NTSTATUS = 0xC01A0028; +pub const STATUS_LOG_CONTAINER_OPEN_FAILED: NTSTATUS = 0xC01A0029; +pub const STATUS_LOG_CONTAINER_STATE_INVALID: NTSTATUS = 0xC01A002A; +pub const STATUS_LOG_STATE_INVALID: NTSTATUS = 0xC01A002B; +pub const STATUS_LOG_PINNED: NTSTATUS = 0xC01A002C; +pub const STATUS_LOG_METADATA_FLUSH_FAILED: NTSTATUS = 0xC01A002D; +pub const STATUS_LOG_INCONSISTENT_SECURITY: NTSTATUS = 0xC01A002E; +pub const STATUS_LOG_APPENDED_FLUSH_FAILED: NTSTATUS = 0xC01A002F; +pub const STATUS_LOG_PINNED_RESERVATION: NTSTATUS = 0xC01A0030; +pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD: NTSTATUS = 0xC01B00EA; +pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED: NTSTATUS = 0x801B00EB; +pub const STATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST: NTSTATUS = 0x401B00EC; +pub const STATUS_MONITOR_NO_DESCRIPTOR: NTSTATUS = 0xC01D0001; +pub const STATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: NTSTATUS = 0xC01D0002; +pub const STATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: NTSTATUS = 0xC01D0003; +pub const STATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK: NTSTATUS = 0xC01D0004; +pub const STATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: NTSTATUS = 0xC01D0005; +pub const STATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: NTSTATUS = 0xC01D0006; +pub const STATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: NTSTATUS = 0xC01D0007; +pub const STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA: NTSTATUS = 0xC01D0008; +pub const STATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK: NTSTATUS = 0xC01D0009; +pub const STATUS_MONITOR_INVALID_MANUFACTURE_DATE: NTSTATUS = 0xC01D000A; +pub const STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: NTSTATUS = 0xC01E0000; +pub const STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: NTSTATUS = 0xC01E0001; +pub const STATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER: NTSTATUS = 0xC01E0002; +pub const STATUS_GRAPHICS_ADAPTER_WAS_RESET: NTSTATUS = 0xC01E0003; +pub const STATUS_GRAPHICS_INVALID_DRIVER_MODEL: NTSTATUS = 0xC01E0004; +pub const STATUS_GRAPHICS_PRESENT_MODE_CHANGED: NTSTATUS = 0xC01E0005; +pub const STATUS_GRAPHICS_PRESENT_OCCLUDED: NTSTATUS = 0xC01E0006; +pub const STATUS_GRAPHICS_PRESENT_DENIED: NTSTATUS = 0xC01E0007; +pub const STATUS_GRAPHICS_CANNOTCOLORCONVERT: NTSTATUS = 0xC01E0008; +pub const STATUS_GRAPHICS_DRIVER_MISMATCH: NTSTATUS = 0xC01E0009; +pub const STATUS_GRAPHICS_PARTIAL_DATA_POPULATED: NTSTATUS = 0x401E000A; +pub const STATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED: NTSTATUS = 0xC01E000B; +pub const STATUS_GRAPHICS_PRESENT_UNOCCLUDED: NTSTATUS = 0xC01E000C; +pub const STATUS_GRAPHICS_WINDOWDC_NOT_AVAILABLE: NTSTATUS = 0xC01E000D; +pub const STATUS_GRAPHICS_WINDOWLESS_PRESENT_DISABLED: NTSTATUS = 0xC01E000E; +pub const STATUS_GRAPHICS_NO_VIDEO_MEMORY: NTSTATUS = 0xC01E0100; +pub const STATUS_GRAPHICS_CANT_LOCK_MEMORY: NTSTATUS = 0xC01E0101; +pub const STATUS_GRAPHICS_ALLOCATION_BUSY: NTSTATUS = 0xC01E0102; +pub const STATUS_GRAPHICS_TOO_MANY_REFERENCES: NTSTATUS = 0xC01E0103; +pub const STATUS_GRAPHICS_TRY_AGAIN_LATER: NTSTATUS = 0xC01E0104; +pub const STATUS_GRAPHICS_TRY_AGAIN_NOW: NTSTATUS = 0xC01E0105; +pub const STATUS_GRAPHICS_ALLOCATION_INVALID: NTSTATUS = 0xC01E0106; +pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: NTSTATUS = 0xC01E0107; +pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: NTSTATUS = 0xC01E0108; +pub const STATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: NTSTATUS = 0xC01E0109; +pub const STATUS_GRAPHICS_INVALID_ALLOCATION_USAGE: NTSTATUS = 0xC01E0110; +pub const STATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: NTSTATUS = 0xC01E0111; +pub const STATUS_GRAPHICS_ALLOCATION_CLOSED: NTSTATUS = 0xC01E0112; +pub const STATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE: NTSTATUS = 0xC01E0113; +pub const STATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE: NTSTATUS = 0xC01E0114; +pub const STATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE: NTSTATUS = 0xC01E0115; +pub const STATUS_GRAPHICS_ALLOCATION_CONTENT_LOST: NTSTATUS = 0xC01E0116; +pub const STATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: NTSTATUS = 0xC01E0200; +pub const STATUS_GRAPHICS_SKIP_ALLOCATION_PREPARATION: NTSTATUS = 0x401E0201; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY: NTSTATUS = 0xC01E0300; +pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: NTSTATUS = 0xC01E0301; +pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: NTSTATUS = 0xC01E0302; +pub const STATUS_GRAPHICS_INVALID_VIDPN: NTSTATUS = 0xC01E0303; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: NTSTATUS = 0xC01E0304; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: NTSTATUS = 0xC01E0305; +pub const STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: NTSTATUS = 0xC01E0306; +pub const STATUS_GRAPHICS_MODE_NOT_PINNED: NTSTATUS = 0x401E0307; +pub const STATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: NTSTATUS = 0xC01E0308; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET: NTSTATUS = 0xC01E0309; +pub const STATUS_GRAPHICS_INVALID_FREQUENCY: NTSTATUS = 0xC01E030A; +pub const STATUS_GRAPHICS_INVALID_ACTIVE_REGION: NTSTATUS = 0xC01E030B; +pub const STATUS_GRAPHICS_INVALID_TOTAL_REGION: NTSTATUS = 0xC01E030C; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: NTSTATUS = 0xC01E0310; +pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: NTSTATUS = 0xC01E0311; +pub const STATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: NTSTATUS = 0xC01E0312; +pub const STATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: NTSTATUS = 0xC01E0313; +pub const STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET: NTSTATUS = 0xC01E0314; +pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: NTSTATUS = 0xC01E0315; +pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: NTSTATUS = 0xC01E0316; +pub const STATUS_GRAPHICS_SOURCE_ALREADY_IN_SET: NTSTATUS = 0xC01E0317; +pub const STATUS_GRAPHICS_TARGET_ALREADY_IN_SET: NTSTATUS = 0xC01E0318; +pub const STATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: NTSTATUS = 0xC01E0319; +pub const STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: NTSTATUS = 0xC01E031A; +pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: NTSTATUS = 0xC01E031B; +pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: NTSTATUS = 0xC01E031C; +pub const STATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: NTSTATUS = 0xC01E031D; +pub const STATUS_GRAPHICS_NO_PREFERRED_MODE: NTSTATUS = 0x401E031E; +pub const STATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: NTSTATUS = 0xC01E031F; +pub const STATUS_GRAPHICS_STALE_MODESET: NTSTATUS = 0xC01E0320; +pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: NTSTATUS = 0xC01E0321; +pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: NTSTATUS = 0xC01E0322; +pub const STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: NTSTATUS = 0xC01E0323; +pub const STATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: NTSTATUS = 0xC01E0324; +pub const STATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: NTSTATUS + = 0xC01E0325; +pub const STATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: NTSTATUS = 0xC01E0326; +pub const STATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY: NTSTATUS = 0xC01E0327; +pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: NTSTATUS = 0xC01E0328; +pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: NTSTATUS = 0xC01E0329; +pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET: NTSTATUS = 0xC01E032A; +pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR: NTSTATUS = 0xC01E032B; +pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: NTSTATUS = 0xC01E032C; +pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: NTSTATUS = 0xC01E032D; +pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: NTSTATUS = 0xC01E032E; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: NTSTATUS = 0xC01E032F; +pub const STATUS_GRAPHICS_RESOURCES_NOT_RELATED: NTSTATUS = 0xC01E0330; +pub const STATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: NTSTATUS = 0xC01E0331; +pub const STATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: NTSTATUS = 0xC01E0332; +pub const STATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: NTSTATUS = 0xC01E0333; +pub const STATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: NTSTATUS + = 0xC01E0334; +pub const STATUS_GRAPHICS_NO_VIDPNMGR: NTSTATUS = 0xC01E0335; +pub const STATUS_GRAPHICS_NO_ACTIVE_VIDPN: NTSTATUS = 0xC01E0336; +pub const STATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY: NTSTATUS = 0xC01E0337; +pub const STATUS_GRAPHICS_MONITOR_NOT_CONNECTED: NTSTATUS = 0xC01E0338; +pub const STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: NTSTATUS = 0xC01E0339; +pub const STATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: NTSTATUS = 0xC01E033A; +pub const STATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE: NTSTATUS = 0xC01E033B; +pub const STATUS_GRAPHICS_INVALID_STRIDE: NTSTATUS = 0xC01E033C; +pub const STATUS_GRAPHICS_INVALID_PIXELFORMAT: NTSTATUS = 0xC01E033D; +pub const STATUS_GRAPHICS_INVALID_COLORBASIS: NTSTATUS = 0xC01E033E; +pub const STATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: NTSTATUS = 0xC01E033F; +pub const STATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: NTSTATUS = 0xC01E0340; +pub const STATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: NTSTATUS = 0xC01E0341; +pub const STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: NTSTATUS = 0xC01E0342; +pub const STATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: NTSTATUS = 0xC01E0343; +pub const STATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: NTSTATUS = 0xC01E0344; +pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: NTSTATUS + = 0xC01E0345; +pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: NTSTATUS + = 0xC01E0346; +pub const STATUS_GRAPHICS_INVALID_GAMMA_RAMP: NTSTATUS = 0xC01E0347; +pub const STATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: NTSTATUS = 0xC01E0348; +pub const STATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: NTSTATUS = 0xC01E0349; +pub const STATUS_GRAPHICS_MODE_NOT_IN_MODESET: NTSTATUS = 0xC01E034A; +pub const STATUS_GRAPHICS_DATASET_IS_EMPTY: NTSTATUS = 0x401E034B; +pub const STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: NTSTATUS = 0x401E034C; +pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: NTSTATUS + = 0xC01E034D; +pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE: NTSTATUS = 0xC01E034E; +pub const STATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE: NTSTATUS = 0xC01E034F; +pub const STATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: NTSTATUS = 0xC01E0350; +pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: NTSTATUS = 0x401E0351; +pub const STATUS_GRAPHICS_INVALID_SCANLINE_ORDERING: NTSTATUS = 0xC01E0352; +pub const STATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: NTSTATUS = 0xC01E0353; +pub const STATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: NTSTATUS = 0xC01E0354; +pub const STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: NTSTATUS = 0xC01E0355; +pub const STATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: NTSTATUS = 0xC01E0356; +pub const STATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: NTSTATUS = 0xC01E0357; +pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: NTSTATUS + = 0xC01E0358; +pub const STATUS_GRAPHICS_MAX_NUM_PATHS_REACHED: NTSTATUS = 0xC01E0359; +pub const STATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: NTSTATUS = 0xC01E035A; +pub const STATUS_GRAPHICS_INVALID_CLIENT_TYPE: NTSTATUS = 0xC01E035B; +pub const STATUS_GRAPHICS_CLIENTVIDPN_NOT_SET: NTSTATUS = 0xC01E035C; +pub const STATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: NTSTATUS = 0xC01E0400; +pub const STATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: NTSTATUS = 0xC01E0401; +pub const STATUS_GRAPHICS_UNKNOWN_CHILD_STATUS: NTSTATUS = 0x401E042F; +pub const STATUS_GRAPHICS_NOT_A_LINKED_ADAPTER: NTSTATUS = 0xC01E0430; +pub const STATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED: NTSTATUS = 0xC01E0431; +pub const STATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: NTSTATUS = 0xC01E0432; +pub const STATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY: NTSTATUS = 0xC01E0433; +pub const STATUS_GRAPHICS_CHAINLINKS_NOT_STARTED: NTSTATUS = 0xC01E0434; +pub const STATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: NTSTATUS = 0xC01E0435; +pub const STATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: NTSTATUS = 0xC01E0436; +pub const STATUS_GRAPHICS_LEADLINK_START_DEFERRED: NTSTATUS = 0x401E0437; +pub const STATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER: NTSTATUS = 0xC01E0438; +pub const STATUS_GRAPHICS_POLLING_TOO_FREQUENTLY: NTSTATUS = 0x401E0439; +pub const STATUS_GRAPHICS_START_DEFERRED: NTSTATUS = 0x401E043A; +pub const STATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: NTSTATUS = 0xC01E043B; +pub const STATUS_GRAPHICS_DEPENDABLE_CHILD_STATUS: NTSTATUS = 0x401E043C; +pub const STATUS_GRAPHICS_OPM_NOT_SUPPORTED: NTSTATUS = 0xC01E0500; +pub const STATUS_GRAPHICS_COPP_NOT_SUPPORTED: NTSTATUS = 0xC01E0501; +pub const STATUS_GRAPHICS_UAB_NOT_SUPPORTED: NTSTATUS = 0xC01E0502; +pub const STATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: NTSTATUS = 0xC01E0503; +pub const STATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST: NTSTATUS = 0xC01E0505; +pub const STATUS_GRAPHICS_OPM_INTERNAL_ERROR: NTSTATUS = 0xC01E050B; +pub const STATUS_GRAPHICS_OPM_INVALID_HANDLE: NTSTATUS = 0xC01E050C; +pub const STATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: NTSTATUS = 0xC01E050E; +pub const STATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED: NTSTATUS = 0xC01E050F; +pub const STATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED: NTSTATUS = 0xC01E0510; +pub const STATUS_GRAPHICS_PVP_HFS_FAILED: NTSTATUS = 0xC01E0511; +pub const STATUS_GRAPHICS_OPM_INVALID_SRM: NTSTATUS = 0xC01E0512; +pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: NTSTATUS = 0xC01E0513; +pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: NTSTATUS = 0xC01E0514; +pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: NTSTATUS = 0xC01E0515; +pub const STATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: NTSTATUS = 0xC01E0516; +pub const STATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: NTSTATUS = 0xC01E0517; +pub const STATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: NTSTATUS = 0xC01E0518; +pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS: NTSTATUS = 0xC01E051A; +pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: NTSTATUS + = 0xC01E051C; +pub const STATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: NTSTATUS = 0xC01E051D; +pub const STATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: NTSTATUS = 0xC01E051E; +pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: NTSTATUS + = 0xC01E051F; +pub const STATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: NTSTATUS = 0xC01E0520; +pub const STATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: NTSTATUS = 0xC01E0521; +pub const STATUS_GRAPHICS_I2C_NOT_SUPPORTED: NTSTATUS = 0xC01E0580; +pub const STATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: NTSTATUS = 0xC01E0581; +pub const STATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: NTSTATUS = 0xC01E0582; +pub const STATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA: NTSTATUS = 0xC01E0583; +pub const STATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: NTSTATUS = 0xC01E0584; +pub const STATUS_GRAPHICS_DDCCI_INVALID_DATA: NTSTATUS = 0xC01E0585; +pub const STATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: NTSTATUS + = 0xC01E0586; +pub const STATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING: NTSTATUS = 0xC01E0587; +pub const STATUS_GRAPHICS_MCA_INTERNAL_ERROR: NTSTATUS = 0xC01E0588; +pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: NTSTATUS = 0xC01E0589; +pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: NTSTATUS = 0xC01E058A; +pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: NTSTATUS = 0xC01E058B; +pub const STATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: NTSTATUS = 0xC01E058C; +pub const STATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS: NTSTATUS = 0xC01E058D; +pub const STATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: NTSTATUS = 0xC01E05E0; +pub const STATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: NTSTATUS = 0xC01E05E1; +pub const STATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: NTSTATUS = 0xC01E05E2; +pub const STATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: NTSTATUS = 0xC01E05E3; +pub const STATUS_GRAPHICS_INVALID_POINTER: NTSTATUS = 0xC01E05E4; +pub const STATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: NTSTATUS + = 0xC01E05E5; +pub const STATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: NTSTATUS = 0xC01E05E6; +pub const STATUS_GRAPHICS_INTERNAL_ERROR: NTSTATUS = 0xC01E05E7; +pub const STATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: NTSTATUS = 0xC01E05E8; +pub const STATUS_FVE_LOCKED_VOLUME: NTSTATUS = 0xC0210000; +pub const STATUS_FVE_NOT_ENCRYPTED: NTSTATUS = 0xC0210001; +pub const STATUS_FVE_BAD_INFORMATION: NTSTATUS = 0xC0210002; +pub const STATUS_FVE_TOO_SMALL: NTSTATUS = 0xC0210003; +pub const STATUS_FVE_FAILED_WRONG_FS: NTSTATUS = 0xC0210004; +pub const STATUS_FVE_BAD_PARTITION_SIZE: NTSTATUS = 0xC0210005; +pub const STATUS_FVE_FS_NOT_EXTENDED: NTSTATUS = 0xC0210006; +pub const STATUS_FVE_FS_MOUNTED: NTSTATUS = 0xC0210007; +pub const STATUS_FVE_NO_LICENSE: NTSTATUS = 0xC0210008; +pub const STATUS_FVE_ACTION_NOT_ALLOWED: NTSTATUS = 0xC0210009; +pub const STATUS_FVE_BAD_DATA: NTSTATUS = 0xC021000A; +pub const STATUS_FVE_VOLUME_NOT_BOUND: NTSTATUS = 0xC021000B; +pub const STATUS_FVE_NOT_DATA_VOLUME: NTSTATUS = 0xC021000C; +pub const STATUS_FVE_CONV_READ_ERROR: NTSTATUS = 0xC021000D; +pub const STATUS_FVE_CONV_WRITE_ERROR: NTSTATUS = 0xC021000E; +pub const STATUS_FVE_OVERLAPPED_UPDATE: NTSTATUS = 0xC021000F; +pub const STATUS_FVE_FAILED_SECTOR_SIZE: NTSTATUS = 0xC0210010; +pub const STATUS_FVE_FAILED_AUTHENTICATION: NTSTATUS = 0xC0210011; +pub const STATUS_FVE_NOT_OS_VOLUME: NTSTATUS = 0xC0210012; +pub const STATUS_FVE_KEYFILE_NOT_FOUND: NTSTATUS = 0xC0210013; +pub const STATUS_FVE_KEYFILE_INVALID: NTSTATUS = 0xC0210014; +pub const STATUS_FVE_KEYFILE_NO_VMK: NTSTATUS = 0xC0210015; +pub const STATUS_FVE_TPM_DISABLED: NTSTATUS = 0xC0210016; +pub const STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO: NTSTATUS = 0xC0210017; +pub const STATUS_FVE_TPM_INVALID_PCR: NTSTATUS = 0xC0210018; +pub const STATUS_FVE_TPM_NO_VMK: NTSTATUS = 0xC0210019; +pub const STATUS_FVE_PIN_INVALID: NTSTATUS = 0xC021001A; +pub const STATUS_FVE_AUTH_INVALID_APPLICATION: NTSTATUS = 0xC021001B; +pub const STATUS_FVE_AUTH_INVALID_CONFIG: NTSTATUS = 0xC021001C; +pub const STATUS_FVE_DEBUGGER_ENABLED: NTSTATUS = 0xC021001D; +pub const STATUS_FVE_DRY_RUN_FAILED: NTSTATUS = 0xC021001E; +pub const STATUS_FVE_BAD_METADATA_POINTER: NTSTATUS = 0xC021001F; +pub const STATUS_FVE_OLD_METADATA_COPY: NTSTATUS = 0xC0210020; +pub const STATUS_FVE_REBOOT_REQUIRED: NTSTATUS = 0xC0210021; +pub const STATUS_FVE_RAW_ACCESS: NTSTATUS = 0xC0210022; +pub const STATUS_FVE_RAW_BLOCKED: NTSTATUS = 0xC0210023; +pub const STATUS_FVE_NO_AUTOUNLOCK_MASTER_KEY: NTSTATUS = 0xC0210024; +pub const STATUS_FVE_MOR_FAILED: NTSTATUS = 0xC0210025; +pub const STATUS_FVE_NO_FEATURE_LICENSE: NTSTATUS = 0xC0210026; +pub const STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: NTSTATUS = 0xC0210027; +pub const STATUS_FVE_CONV_RECOVERY_FAILED: NTSTATUS = 0xC0210028; +pub const STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG: NTSTATUS = 0xC0210029; +pub const STATUS_FVE_INVALID_DATUM_TYPE: NTSTATUS = 0xC021002A; +pub const STATUS_FVE_VOLUME_TOO_SMALL: NTSTATUS = 0xC0210030; +pub const STATUS_FVE_ENH_PIN_INVALID: NTSTATUS = 0xC0210031; +pub const STATUS_FVE_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE: NTSTATUS = 0xC0210032; +pub const STATUS_FVE_WIPE_NOT_ALLOWED_ON_TP_STORAGE: NTSTATUS = 0xC0210033; +pub const STATUS_FVE_NOT_ALLOWED_ON_CSV_STACK: NTSTATUS = 0xC0210034; +pub const STATUS_FVE_NOT_ALLOWED_ON_CLUSTER: NTSTATUS = 0xC0210035; +pub const STATUS_FVE_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING: NTSTATUS = 0xC0210036; +pub const STATUS_FVE_WIPE_CANCEL_NOT_APPLICABLE: NTSTATUS = 0xC0210037; +pub const STATUS_FVE_EDRIVE_DRY_RUN_FAILED: NTSTATUS = 0xC0210038; +pub const STATUS_FVE_SECUREBOOT_DISABLED: NTSTATUS = 0xC0210039; +pub const STATUS_FVE_SECUREBOOT_CONFIG_CHANGE: NTSTATUS = 0xC021003A; +pub const STATUS_FVE_DEVICE_LOCKEDOUT: NTSTATUS = 0xC021003B; +pub const STATUS_FVE_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT: NTSTATUS = 0xC021003C; +pub const STATUS_FVE_NOT_DE_VOLUME: NTSTATUS = 0xC021003D; +pub const STATUS_FVE_PROTECTION_DISABLED: NTSTATUS = 0xC021003E; +pub const STATUS_FVE_PROTECTION_CANNOT_BE_DISABLED: NTSTATUS = 0xC021003F; +pub const STATUS_FWP_CALLOUT_NOT_FOUND: NTSTATUS = 0xC0220001; +pub const STATUS_FWP_CONDITION_NOT_FOUND: NTSTATUS = 0xC0220002; +pub const STATUS_FWP_FILTER_NOT_FOUND: NTSTATUS = 0xC0220003; +pub const STATUS_FWP_LAYER_NOT_FOUND: NTSTATUS = 0xC0220004; +pub const STATUS_FWP_PROVIDER_NOT_FOUND: NTSTATUS = 0xC0220005; +pub const STATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND: NTSTATUS = 0xC0220006; +pub const STATUS_FWP_SUBLAYER_NOT_FOUND: NTSTATUS = 0xC0220007; +pub const STATUS_FWP_NOT_FOUND: NTSTATUS = 0xC0220008; +pub const STATUS_FWP_ALREADY_EXISTS: NTSTATUS = 0xC0220009; +pub const STATUS_FWP_IN_USE: NTSTATUS = 0xC022000A; +pub const STATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS: NTSTATUS = 0xC022000B; +pub const STATUS_FWP_WRONG_SESSION: NTSTATUS = 0xC022000C; +pub const STATUS_FWP_NO_TXN_IN_PROGRESS: NTSTATUS = 0xC022000D; +pub const STATUS_FWP_TXN_IN_PROGRESS: NTSTATUS = 0xC022000E; +pub const STATUS_FWP_TXN_ABORTED: NTSTATUS = 0xC022000F; +pub const STATUS_FWP_SESSION_ABORTED: NTSTATUS = 0xC0220010; +pub const STATUS_FWP_INCOMPATIBLE_TXN: NTSTATUS = 0xC0220011; +pub const STATUS_FWP_TIMEOUT: NTSTATUS = 0xC0220012; +pub const STATUS_FWP_NET_EVENTS_DISABLED: NTSTATUS = 0xC0220013; +pub const STATUS_FWP_INCOMPATIBLE_LAYER: NTSTATUS = 0xC0220014; +pub const STATUS_FWP_KM_CLIENTS_ONLY: NTSTATUS = 0xC0220015; +pub const STATUS_FWP_LIFETIME_MISMATCH: NTSTATUS = 0xC0220016; +pub const STATUS_FWP_BUILTIN_OBJECT: NTSTATUS = 0xC0220017; +pub const STATUS_FWP_TOO_MANY_CALLOUTS: NTSTATUS = 0xC0220018; +pub const STATUS_FWP_NOTIFICATION_DROPPED: NTSTATUS = 0xC0220019; +pub const STATUS_FWP_TRAFFIC_MISMATCH: NTSTATUS = 0xC022001A; +pub const STATUS_FWP_INCOMPATIBLE_SA_STATE: NTSTATUS = 0xC022001B; +pub const STATUS_FWP_NULL_POINTER: NTSTATUS = 0xC022001C; +pub const STATUS_FWP_INVALID_ENUMERATOR: NTSTATUS = 0xC022001D; +pub const STATUS_FWP_INVALID_FLAGS: NTSTATUS = 0xC022001E; +pub const STATUS_FWP_INVALID_NET_MASK: NTSTATUS = 0xC022001F; +pub const STATUS_FWP_INVALID_RANGE: NTSTATUS = 0xC0220020; +pub const STATUS_FWP_INVALID_INTERVAL: NTSTATUS = 0xC0220021; +pub const STATUS_FWP_ZERO_LENGTH_ARRAY: NTSTATUS = 0xC0220022; +pub const STATUS_FWP_NULL_DISPLAY_NAME: NTSTATUS = 0xC0220023; +pub const STATUS_FWP_INVALID_ACTION_TYPE: NTSTATUS = 0xC0220024; +pub const STATUS_FWP_INVALID_WEIGHT: NTSTATUS = 0xC0220025; +pub const STATUS_FWP_MATCH_TYPE_MISMATCH: NTSTATUS = 0xC0220026; +pub const STATUS_FWP_TYPE_MISMATCH: NTSTATUS = 0xC0220027; +pub const STATUS_FWP_OUT_OF_BOUNDS: NTSTATUS = 0xC0220028; +pub const STATUS_FWP_RESERVED: NTSTATUS = 0xC0220029; +pub const STATUS_FWP_DUPLICATE_CONDITION: NTSTATUS = 0xC022002A; +pub const STATUS_FWP_DUPLICATE_KEYMOD: NTSTATUS = 0xC022002B; +pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER: NTSTATUS = 0xC022002C; +pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER: NTSTATUS = 0xC022002D; +pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER: NTSTATUS = 0xC022002E; +pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: NTSTATUS = 0xC022002F; +pub const STATUS_FWP_INCOMPATIBLE_AUTH_METHOD: NTSTATUS = 0xC0220030; +pub const STATUS_FWP_INCOMPATIBLE_DH_GROUP: NTSTATUS = 0xC0220031; +pub const STATUS_FWP_EM_NOT_SUPPORTED: NTSTATUS = 0xC0220032; +pub const STATUS_FWP_NEVER_MATCH: NTSTATUS = 0xC0220033; +pub const STATUS_FWP_PROVIDER_CONTEXT_MISMATCH: NTSTATUS = 0xC0220034; +pub const STATUS_FWP_INVALID_PARAMETER: NTSTATUS = 0xC0220035; +pub const STATUS_FWP_TOO_MANY_SUBLAYERS: NTSTATUS = 0xC0220036; +pub const STATUS_FWP_CALLOUT_NOTIFICATION_FAILED: NTSTATUS = 0xC0220037; +pub const STATUS_FWP_INVALID_AUTH_TRANSFORM: NTSTATUS = 0xC0220038; +pub const STATUS_FWP_INVALID_CIPHER_TRANSFORM: NTSTATUS = 0xC0220039; +pub const STATUS_FWP_INCOMPATIBLE_CIPHER_TRANSFORM: NTSTATUS = 0xC022003A; +pub const STATUS_FWP_INVALID_TRANSFORM_COMBINATION: NTSTATUS = 0xC022003B; +pub const STATUS_FWP_DUPLICATE_AUTH_METHOD: NTSTATUS = 0xC022003C; +pub const STATUS_FWP_INVALID_TUNNEL_ENDPOINT: NTSTATUS = 0xC022003D; +pub const STATUS_FWP_L2_DRIVER_NOT_READY: NTSTATUS = 0xC022003E; +pub const STATUS_FWP_KEY_DICTATOR_ALREADY_REGISTERED: NTSTATUS = 0xC022003F; +pub const STATUS_FWP_KEY_DICTATION_INVALID_KEYING_MATERIAL: NTSTATUS = 0xC0220040; +pub const STATUS_FWP_CONNECTIONS_DISABLED: NTSTATUS = 0xC0220041; +pub const STATUS_FWP_INVALID_DNS_NAME: NTSTATUS = 0xC0220042; +pub const STATUS_FWP_STILL_ON: NTSTATUS = 0xC0220043; +pub const STATUS_FWP_IKEEXT_NOT_RUNNING: NTSTATUS = 0xC0220044; +pub const STATUS_FWP_TCPIP_NOT_READY: NTSTATUS = 0xC0220100; +pub const STATUS_FWP_INJECT_HANDLE_CLOSING: NTSTATUS = 0xC0220101; +pub const STATUS_FWP_INJECT_HANDLE_STALE: NTSTATUS = 0xC0220102; +pub const STATUS_FWP_CANNOT_PEND: NTSTATUS = 0xC0220103; +pub const STATUS_FWP_DROP_NOICMP: NTSTATUS = 0xC0220104; +pub const STATUS_NDIS_CLOSING: NTSTATUS = 0xC0230002; +pub const STATUS_NDIS_BAD_VERSION: NTSTATUS = 0xC0230004; +pub const STATUS_NDIS_BAD_CHARACTERISTICS: NTSTATUS = 0xC0230005; +pub const STATUS_NDIS_ADAPTER_NOT_FOUND: NTSTATUS = 0xC0230006; +pub const STATUS_NDIS_OPEN_FAILED: NTSTATUS = 0xC0230007; +pub const STATUS_NDIS_DEVICE_FAILED: NTSTATUS = 0xC0230008; +pub const STATUS_NDIS_MULTICAST_FULL: NTSTATUS = 0xC0230009; +pub const STATUS_NDIS_MULTICAST_EXISTS: NTSTATUS = 0xC023000A; +pub const STATUS_NDIS_MULTICAST_NOT_FOUND: NTSTATUS = 0xC023000B; +pub const STATUS_NDIS_REQUEST_ABORTED: NTSTATUS = 0xC023000C; +pub const STATUS_NDIS_RESET_IN_PROGRESS: NTSTATUS = 0xC023000D; +pub const STATUS_NDIS_NOT_SUPPORTED: NTSTATUS = 0xC02300BB; +pub const STATUS_NDIS_INVALID_PACKET: NTSTATUS = 0xC023000F; +pub const STATUS_NDIS_ADAPTER_NOT_READY: NTSTATUS = 0xC0230011; +pub const STATUS_NDIS_INVALID_LENGTH: NTSTATUS = 0xC0230014; +pub const STATUS_NDIS_INVALID_DATA: NTSTATUS = 0xC0230015; +pub const STATUS_NDIS_BUFFER_TOO_SHORT: NTSTATUS = 0xC0230016; +pub const STATUS_NDIS_INVALID_OID: NTSTATUS = 0xC0230017; +pub const STATUS_NDIS_ADAPTER_REMOVED: NTSTATUS = 0xC0230018; +pub const STATUS_NDIS_UNSUPPORTED_MEDIA: NTSTATUS = 0xC0230019; +pub const STATUS_NDIS_GROUP_ADDRESS_IN_USE: NTSTATUS = 0xC023001A; +pub const STATUS_NDIS_FILE_NOT_FOUND: NTSTATUS = 0xC023001B; +pub const STATUS_NDIS_ERROR_READING_FILE: NTSTATUS = 0xC023001C; +pub const STATUS_NDIS_ALREADY_MAPPED: NTSTATUS = 0xC023001D; +pub const STATUS_NDIS_RESOURCE_CONFLICT: NTSTATUS = 0xC023001E; +pub const STATUS_NDIS_MEDIA_DISCONNECTED: NTSTATUS = 0xC023001F; +pub const STATUS_NDIS_INVALID_ADDRESS: NTSTATUS = 0xC0230022; +pub const STATUS_NDIS_INVALID_DEVICE_REQUEST: NTSTATUS = 0xC0230010; +pub const STATUS_NDIS_PAUSED: NTSTATUS = 0xC023002A; +pub const STATUS_NDIS_INTERFACE_NOT_FOUND: NTSTATUS = 0xC023002B; +pub const STATUS_NDIS_UNSUPPORTED_REVISION: NTSTATUS = 0xC023002C; +pub const STATUS_NDIS_INVALID_PORT: NTSTATUS = 0xC023002D; +pub const STATUS_NDIS_INVALID_PORT_STATE: NTSTATUS = 0xC023002E; +pub const STATUS_NDIS_LOW_POWER_STATE: NTSTATUS = 0xC023002F; +pub const STATUS_NDIS_REINIT_REQUIRED: NTSTATUS = 0xC0230030; +pub const STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED: NTSTATUS = 0xC0232000; +pub const STATUS_NDIS_DOT11_MEDIA_IN_USE: NTSTATUS = 0xC0232001; +pub const STATUS_NDIS_DOT11_POWER_STATE_INVALID: NTSTATUS = 0xC0232002; +pub const STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL: NTSTATUS = 0xC0232003; +pub const STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: NTSTATUS = 0xC0232004; +pub const STATUS_NDIS_DOT11_AP_CHANNEL_CURRENTLY_NOT_AVAILABLE: NTSTATUS = 0xC0232005; +pub const STATUS_NDIS_DOT11_AP_BAND_CURRENTLY_NOT_AVAILABLE: NTSTATUS = 0xC0232006; +pub const STATUS_NDIS_DOT11_AP_CHANNEL_NOT_ALLOWED: NTSTATUS = 0xC0232007; +pub const STATUS_NDIS_DOT11_AP_BAND_NOT_ALLOWED: NTSTATUS = 0xC0232008; +pub const STATUS_NDIS_INDICATION_REQUIRED: NTSTATUS = 0x40230001; +pub const STATUS_NDIS_OFFLOAD_POLICY: NTSTATUS = 0xC023100F; +pub const STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED: NTSTATUS = 0xC0231012; +pub const STATUS_NDIS_OFFLOAD_PATH_REJECTED: NTSTATUS = 0xC0231013; +pub const STATUS_TPM_ERROR_MASK: NTSTATUS = 0xC0290000; +pub const STATUS_TPM_AUTHFAIL: NTSTATUS = 0xC0290001; +pub const STATUS_TPM_BADINDEX: NTSTATUS = 0xC0290002; +pub const STATUS_TPM_BAD_PARAMETER: NTSTATUS = 0xC0290003; +pub const STATUS_TPM_AUDITFAILURE: NTSTATUS = 0xC0290004; +pub const STATUS_TPM_CLEAR_DISABLED: NTSTATUS = 0xC0290005; +pub const STATUS_TPM_DEACTIVATED: NTSTATUS = 0xC0290006; +pub const STATUS_TPM_DISABLED: NTSTATUS = 0xC0290007; +pub const STATUS_TPM_DISABLED_CMD: NTSTATUS = 0xC0290008; +pub const STATUS_TPM_FAIL: NTSTATUS = 0xC0290009; +pub const STATUS_TPM_BAD_ORDINAL: NTSTATUS = 0xC029000A; +pub const STATUS_TPM_INSTALL_DISABLED: NTSTATUS = 0xC029000B; +pub const STATUS_TPM_INVALID_KEYHANDLE: NTSTATUS = 0xC029000C; +pub const STATUS_TPM_KEYNOTFOUND: NTSTATUS = 0xC029000D; +pub const STATUS_TPM_INAPPROPRIATE_ENC: NTSTATUS = 0xC029000E; +pub const STATUS_TPM_MIGRATEFAIL: NTSTATUS = 0xC029000F; +pub const STATUS_TPM_INVALID_PCR_INFO: NTSTATUS = 0xC0290010; +pub const STATUS_TPM_NOSPACE: NTSTATUS = 0xC0290011; +pub const STATUS_TPM_NOSRK: NTSTATUS = 0xC0290012; +pub const STATUS_TPM_NOTSEALED_BLOB: NTSTATUS = 0xC0290013; +pub const STATUS_TPM_OWNER_SET: NTSTATUS = 0xC0290014; +pub const STATUS_TPM_RESOURCES: NTSTATUS = 0xC0290015; +pub const STATUS_TPM_SHORTRANDOM: NTSTATUS = 0xC0290016; +pub const STATUS_TPM_SIZE: NTSTATUS = 0xC0290017; +pub const STATUS_TPM_WRONGPCRVAL: NTSTATUS = 0xC0290018; +pub const STATUS_TPM_BAD_PARAM_SIZE: NTSTATUS = 0xC0290019; +pub const STATUS_TPM_SHA_THREAD: NTSTATUS = 0xC029001A; +pub const STATUS_TPM_SHA_ERROR: NTSTATUS = 0xC029001B; +pub const STATUS_TPM_FAILEDSELFTEST: NTSTATUS = 0xC029001C; +pub const STATUS_TPM_AUTH2FAIL: NTSTATUS = 0xC029001D; +pub const STATUS_TPM_BADTAG: NTSTATUS = 0xC029001E; +pub const STATUS_TPM_IOERROR: NTSTATUS = 0xC029001F; +pub const STATUS_TPM_ENCRYPT_ERROR: NTSTATUS = 0xC0290020; +pub const STATUS_TPM_DECRYPT_ERROR: NTSTATUS = 0xC0290021; +pub const STATUS_TPM_INVALID_AUTHHANDLE: NTSTATUS = 0xC0290022; +pub const STATUS_TPM_NO_ENDORSEMENT: NTSTATUS = 0xC0290023; +pub const STATUS_TPM_INVALID_KEYUSAGE: NTSTATUS = 0xC0290024; +pub const STATUS_TPM_WRONG_ENTITYTYPE: NTSTATUS = 0xC0290025; +pub const STATUS_TPM_INVALID_POSTINIT: NTSTATUS = 0xC0290026; +pub const STATUS_TPM_INAPPROPRIATE_SIG: NTSTATUS = 0xC0290027; +pub const STATUS_TPM_BAD_KEY_PROPERTY: NTSTATUS = 0xC0290028; +pub const STATUS_TPM_BAD_MIGRATION: NTSTATUS = 0xC0290029; +pub const STATUS_TPM_BAD_SCHEME: NTSTATUS = 0xC029002A; +pub const STATUS_TPM_BAD_DATASIZE: NTSTATUS = 0xC029002B; +pub const STATUS_TPM_BAD_MODE: NTSTATUS = 0xC029002C; +pub const STATUS_TPM_BAD_PRESENCE: NTSTATUS = 0xC029002D; +pub const STATUS_TPM_BAD_VERSION: NTSTATUS = 0xC029002E; +pub const STATUS_TPM_NO_WRAP_TRANSPORT: NTSTATUS = 0xC029002F; +pub const STATUS_TPM_AUDITFAIL_UNSUCCESSFUL: NTSTATUS = 0xC0290030; +pub const STATUS_TPM_AUDITFAIL_SUCCESSFUL: NTSTATUS = 0xC0290031; +pub const STATUS_TPM_NOTRESETABLE: NTSTATUS = 0xC0290032; +pub const STATUS_TPM_NOTLOCAL: NTSTATUS = 0xC0290033; +pub const STATUS_TPM_BAD_TYPE: NTSTATUS = 0xC0290034; +pub const STATUS_TPM_INVALID_RESOURCE: NTSTATUS = 0xC0290035; +pub const STATUS_TPM_NOTFIPS: NTSTATUS = 0xC0290036; +pub const STATUS_TPM_INVALID_FAMILY: NTSTATUS = 0xC0290037; +pub const STATUS_TPM_NO_NV_PERMISSION: NTSTATUS = 0xC0290038; +pub const STATUS_TPM_REQUIRES_SIGN: NTSTATUS = 0xC0290039; +pub const STATUS_TPM_KEY_NOTSUPPORTED: NTSTATUS = 0xC029003A; +pub const STATUS_TPM_AUTH_CONFLICT: NTSTATUS = 0xC029003B; +pub const STATUS_TPM_AREA_LOCKED: NTSTATUS = 0xC029003C; +pub const STATUS_TPM_BAD_LOCALITY: NTSTATUS = 0xC029003D; +pub const STATUS_TPM_READ_ONLY: NTSTATUS = 0xC029003E; +pub const STATUS_TPM_PER_NOWRITE: NTSTATUS = 0xC029003F; +pub const STATUS_TPM_FAMILYCOUNT: NTSTATUS = 0xC0290040; +pub const STATUS_TPM_WRITE_LOCKED: NTSTATUS = 0xC0290041; +pub const STATUS_TPM_BAD_ATTRIBUTES: NTSTATUS = 0xC0290042; +pub const STATUS_TPM_INVALID_STRUCTURE: NTSTATUS = 0xC0290043; +pub const STATUS_TPM_KEY_OWNER_CONTROL: NTSTATUS = 0xC0290044; +pub const STATUS_TPM_BAD_COUNTER: NTSTATUS = 0xC0290045; +pub const STATUS_TPM_NOT_FULLWRITE: NTSTATUS = 0xC0290046; +pub const STATUS_TPM_CONTEXT_GAP: NTSTATUS = 0xC0290047; +pub const STATUS_TPM_MAXNVWRITES: NTSTATUS = 0xC0290048; +pub const STATUS_TPM_NOOPERATOR: NTSTATUS = 0xC0290049; +pub const STATUS_TPM_RESOURCEMISSING: NTSTATUS = 0xC029004A; +pub const STATUS_TPM_DELEGATE_LOCK: NTSTATUS = 0xC029004B; +pub const STATUS_TPM_DELEGATE_FAMILY: NTSTATUS = 0xC029004C; +pub const STATUS_TPM_DELEGATE_ADMIN: NTSTATUS = 0xC029004D; +pub const STATUS_TPM_TRANSPORT_NOTEXCLUSIVE: NTSTATUS = 0xC029004E; +pub const STATUS_TPM_OWNER_CONTROL: NTSTATUS = 0xC029004F; +pub const STATUS_TPM_DAA_RESOURCES: NTSTATUS = 0xC0290050; +pub const STATUS_TPM_DAA_INPUT_DATA0: NTSTATUS = 0xC0290051; +pub const STATUS_TPM_DAA_INPUT_DATA1: NTSTATUS = 0xC0290052; +pub const STATUS_TPM_DAA_ISSUER_SETTINGS: NTSTATUS = 0xC0290053; +pub const STATUS_TPM_DAA_TPM_SETTINGS: NTSTATUS = 0xC0290054; +pub const STATUS_TPM_DAA_STAGE: NTSTATUS = 0xC0290055; +pub const STATUS_TPM_DAA_ISSUER_VALIDITY: NTSTATUS = 0xC0290056; +pub const STATUS_TPM_DAA_WRONG_W: NTSTATUS = 0xC0290057; +pub const STATUS_TPM_BAD_HANDLE: NTSTATUS = 0xC0290058; +pub const STATUS_TPM_BAD_DELEGATE: NTSTATUS = 0xC0290059; +pub const STATUS_TPM_BADCONTEXT: NTSTATUS = 0xC029005A; +pub const STATUS_TPM_TOOMANYCONTEXTS: NTSTATUS = 0xC029005B; +pub const STATUS_TPM_MA_TICKET_SIGNATURE: NTSTATUS = 0xC029005C; +pub const STATUS_TPM_MA_DESTINATION: NTSTATUS = 0xC029005D; +pub const STATUS_TPM_MA_SOURCE: NTSTATUS = 0xC029005E; +pub const STATUS_TPM_MA_AUTHORITY: NTSTATUS = 0xC029005F; +pub const STATUS_TPM_PERMANENTEK: NTSTATUS = 0xC0290061; +pub const STATUS_TPM_BAD_SIGNATURE: NTSTATUS = 0xC0290062; +pub const STATUS_TPM_NOCONTEXTSPACE: NTSTATUS = 0xC0290063; +pub const STATUS_TPM_COMMAND_BLOCKED: NTSTATUS = 0xC0290400; +pub const STATUS_TPM_INVALID_HANDLE: NTSTATUS = 0xC0290401; +pub const STATUS_TPM_DUPLICATE_VHANDLE: NTSTATUS = 0xC0290402; +pub const STATUS_TPM_EMBEDDED_COMMAND_BLOCKED: NTSTATUS = 0xC0290403; +pub const STATUS_TPM_EMBEDDED_COMMAND_UNSUPPORTED: NTSTATUS = 0xC0290404; +pub const STATUS_TPM_RETRY: NTSTATUS = 0xC0290800; +pub const STATUS_TPM_NEEDS_SELFTEST: NTSTATUS = 0xC0290801; +pub const STATUS_TPM_DOING_SELFTEST: NTSTATUS = 0xC0290802; +pub const STATUS_TPM_DEFEND_LOCK_RUNNING: NTSTATUS = 0xC0290803; +pub const STATUS_TPM_COMMAND_CANCELED: NTSTATUS = 0xC0291001; +pub const STATUS_TPM_TOO_MANY_CONTEXTS: NTSTATUS = 0xC0291002; +pub const STATUS_TPM_NOT_FOUND: NTSTATUS = 0xC0291003; +pub const STATUS_TPM_ACCESS_DENIED: NTSTATUS = 0xC0291004; +pub const STATUS_TPM_INSUFFICIENT_BUFFER: NTSTATUS = 0xC0291005; +pub const STATUS_TPM_PPI_FUNCTION_UNSUPPORTED: NTSTATUS = 0xC0291006; +pub const STATUS_PCP_ERROR_MASK: NTSTATUS = 0xC0292000; +pub const STATUS_PCP_DEVICE_NOT_READY: NTSTATUS = 0xC0292001; +pub const STATUS_PCP_INVALID_HANDLE: NTSTATUS = 0xC0292002; +pub const STATUS_PCP_INVALID_PARAMETER: NTSTATUS = 0xC0292003; +pub const STATUS_PCP_FLAG_NOT_SUPPORTED: NTSTATUS = 0xC0292004; +pub const STATUS_PCP_NOT_SUPPORTED: NTSTATUS = 0xC0292005; +pub const STATUS_PCP_BUFFER_TOO_SMALL: NTSTATUS = 0xC0292006; +pub const STATUS_PCP_INTERNAL_ERROR: NTSTATUS = 0xC0292007; +pub const STATUS_PCP_AUTHENTICATION_FAILED: NTSTATUS = 0xC0292008; +pub const STATUS_PCP_AUTHENTICATION_IGNORED: NTSTATUS = 0xC0292009; +pub const STATUS_PCP_POLICY_NOT_FOUND: NTSTATUS = 0xC029200A; +pub const STATUS_PCP_PROFILE_NOT_FOUND: NTSTATUS = 0xC029200B; +pub const STATUS_PCP_VALIDATION_FAILED: NTSTATUS = 0xC029200C; +pub const STATUS_PCP_DEVICE_NOT_FOUND: NTSTATUS = 0xC029200D; +pub const STATUS_RTPM_CONTEXT_CONTINUE: NTSTATUS = 0x00293000; +pub const STATUS_RTPM_CONTEXT_COMPLETE: NTSTATUS = 0x00293001; +pub const STATUS_RTPM_NO_RESULT: NTSTATUS = 0xC0293002; +pub const STATUS_RTPM_PCR_READ_INCOMPLETE: NTSTATUS = 0xC0293003; +pub const STATUS_RTPM_INVALID_CONTEXT: NTSTATUS = 0xC0293004; +pub const STATUS_RTPM_UNSUPPORTED_CMD: NTSTATUS = 0xC0293005; +pub const STATUS_HV_INVALID_HYPERCALL_CODE: NTSTATUS = 0xC0350002; +pub const STATUS_HV_INVALID_HYPERCALL_INPUT: NTSTATUS = 0xC0350003; +pub const STATUS_HV_INVALID_ALIGNMENT: NTSTATUS = 0xC0350004; +pub const STATUS_HV_INVALID_PARAMETER: NTSTATUS = 0xC0350005; +pub const STATUS_HV_ACCESS_DENIED: NTSTATUS = 0xC0350006; +pub const STATUS_HV_INVALID_PARTITION_STATE: NTSTATUS = 0xC0350007; +pub const STATUS_HV_OPERATION_DENIED: NTSTATUS = 0xC0350008; +pub const STATUS_HV_UNKNOWN_PROPERTY: NTSTATUS = 0xC0350009; +pub const STATUS_HV_PROPERTY_VALUE_OUT_OF_RANGE: NTSTATUS = 0xC035000A; +pub const STATUS_HV_INSUFFICIENT_MEMORY: NTSTATUS = 0xC035000B; +pub const STATUS_HV_PARTITION_TOO_DEEP: NTSTATUS = 0xC035000C; +pub const STATUS_HV_INVALID_PARTITION_ID: NTSTATUS = 0xC035000D; +pub const STATUS_HV_INVALID_VP_INDEX: NTSTATUS = 0xC035000E; +pub const STATUS_HV_INVALID_PORT_ID: NTSTATUS = 0xC0350011; +pub const STATUS_HV_INVALID_CONNECTION_ID: NTSTATUS = 0xC0350012; +pub const STATUS_HV_INSUFFICIENT_BUFFERS: NTSTATUS = 0xC0350013; +pub const STATUS_HV_NOT_ACKNOWLEDGED: NTSTATUS = 0xC0350014; +pub const STATUS_HV_INVALID_VP_STATE: NTSTATUS = 0xC0350015; +pub const STATUS_HV_ACKNOWLEDGED: NTSTATUS = 0xC0350016; +pub const STATUS_HV_INVALID_SAVE_RESTORE_STATE: NTSTATUS = 0xC0350017; +pub const STATUS_HV_INVALID_SYNIC_STATE: NTSTATUS = 0xC0350018; +pub const STATUS_HV_OBJECT_IN_USE: NTSTATUS = 0xC0350019; +pub const STATUS_HV_INVALID_PROXIMITY_DOMAIN_INFO: NTSTATUS = 0xC035001A; +pub const STATUS_HV_NO_DATA: NTSTATUS = 0xC035001B; +pub const STATUS_HV_INACTIVE: NTSTATUS = 0xC035001C; +pub const STATUS_HV_NO_RESOURCES: NTSTATUS = 0xC035001D; +pub const STATUS_HV_FEATURE_UNAVAILABLE: NTSTATUS = 0xC035001E; +pub const STATUS_HV_INSUFFICIENT_BUFFER: NTSTATUS = 0xC0350033; +pub const STATUS_HV_INSUFFICIENT_DEVICE_DOMAINS: NTSTATUS = 0xC0350038; +pub const STATUS_HV_CPUID_FEATURE_VALIDATION_ERROR: NTSTATUS = 0xC035003C; +pub const STATUS_HV_CPUID_XSAVE_FEATURE_VALIDATION_ERROR: NTSTATUS = 0xC035003D; +pub const STATUS_HV_PROCESSOR_STARTUP_TIMEOUT: NTSTATUS = 0xC035003E; +pub const STATUS_HV_SMX_ENABLED: NTSTATUS = 0xC035003F; +pub const STATUS_HV_INVALID_LP_INDEX: NTSTATUS = 0xC0350041; +pub const STATUS_HV_INVALID_REGISTER_VALUE: NTSTATUS = 0xC0350050; +pub const STATUS_HV_INVALID_VTL_STATE: NTSTATUS = 0xC0350051; +pub const STATUS_HV_NX_NOT_DETECTED: NTSTATUS = 0xC0350055; +pub const STATUS_HV_INVALID_DEVICE_ID: NTSTATUS = 0xC0350057; +pub const STATUS_HV_INVALID_DEVICE_STATE: NTSTATUS = 0xC0350058; +pub const STATUS_HV_PENDING_PAGE_REQUESTS: NTSTATUS = 0x00350059; +pub const STATUS_HV_PAGE_REQUEST_INVALID: NTSTATUS = 0xC0350060; +pub const STATUS_HV_INVALID_CPU_GROUP_ID: NTSTATUS = 0xC035006F; +pub const STATUS_HV_INVALID_CPU_GROUP_STATE: NTSTATUS = 0xC0350070; +pub const STATUS_HV_NOT_ALLOWED_WITH_NESTED_VIRT_ACTIVE: NTSTATUS = 0xC0350071; +pub const STATUS_HV_NOT_PRESENT: NTSTATUS = 0xC0351000; +pub const STATUS_VID_DUPLICATE_HANDLER: NTSTATUS = 0xC0370001; +pub const STATUS_VID_TOO_MANY_HANDLERS: NTSTATUS = 0xC0370002; +pub const STATUS_VID_QUEUE_FULL: NTSTATUS = 0xC0370003; +pub const STATUS_VID_HANDLER_NOT_PRESENT: NTSTATUS = 0xC0370004; +pub const STATUS_VID_INVALID_OBJECT_NAME: NTSTATUS = 0xC0370005; +pub const STATUS_VID_PARTITION_NAME_TOO_LONG: NTSTATUS = 0xC0370006; +pub const STATUS_VID_MESSAGE_QUEUE_NAME_TOO_LONG: NTSTATUS = 0xC0370007; +pub const STATUS_VID_PARTITION_ALREADY_EXISTS: NTSTATUS = 0xC0370008; +pub const STATUS_VID_PARTITION_DOES_NOT_EXIST: NTSTATUS = 0xC0370009; +pub const STATUS_VID_PARTITION_NAME_NOT_FOUND: NTSTATUS = 0xC037000A; +pub const STATUS_VID_MESSAGE_QUEUE_ALREADY_EXISTS: NTSTATUS = 0xC037000B; +pub const STATUS_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT: NTSTATUS = 0xC037000C; +pub const STATUS_VID_MB_STILL_REFERENCED: NTSTATUS = 0xC037000D; +pub const STATUS_VID_CHILD_GPA_PAGE_SET_CORRUPTED: NTSTATUS = 0xC037000E; +pub const STATUS_VID_INVALID_NUMA_SETTINGS: NTSTATUS = 0xC037000F; +pub const STATUS_VID_INVALID_NUMA_NODE_INDEX: NTSTATUS = 0xC0370010; +pub const STATUS_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED: NTSTATUS = 0xC0370011; +pub const STATUS_VID_INVALID_MEMORY_BLOCK_HANDLE: NTSTATUS = 0xC0370012; +pub const STATUS_VID_PAGE_RANGE_OVERFLOW: NTSTATUS = 0xC0370013; +pub const STATUS_VID_INVALID_MESSAGE_QUEUE_HANDLE: NTSTATUS = 0xC0370014; +pub const STATUS_VID_INVALID_GPA_RANGE_HANDLE: NTSTATUS = 0xC0370015; +pub const STATUS_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE: NTSTATUS = 0xC0370016; +pub const STATUS_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED: NTSTATUS = 0xC0370017; +pub const STATUS_VID_INVALID_PPM_HANDLE: NTSTATUS = 0xC0370018; +pub const STATUS_VID_MBPS_ARE_LOCKED: NTSTATUS = 0xC0370019; +pub const STATUS_VID_MESSAGE_QUEUE_CLOSED: NTSTATUS = 0xC037001A; +pub const STATUS_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED: NTSTATUS = 0xC037001B; +pub const STATUS_VID_STOP_PENDING: NTSTATUS = 0xC037001C; +pub const STATUS_VID_INVALID_PROCESSOR_STATE: NTSTATUS = 0xC037001D; +pub const STATUS_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT: NTSTATUS = 0xC037001E; +pub const STATUS_VID_KM_INTERFACE_ALREADY_INITIALIZED: NTSTATUS = 0xC037001F; +pub const STATUS_VID_MB_PROPERTY_ALREADY_SET_RESET: NTSTATUS = 0xC0370020; +pub const STATUS_VID_MMIO_RANGE_DESTROYED: NTSTATUS = 0xC0370021; +pub const STATUS_VID_INVALID_CHILD_GPA_PAGE_SET: NTSTATUS = 0xC0370022; +pub const STATUS_VID_RESERVE_PAGE_SET_IS_BEING_USED: NTSTATUS = 0xC0370023; +pub const STATUS_VID_RESERVE_PAGE_SET_TOO_SMALL: NTSTATUS = 0xC0370024; +pub const STATUS_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE: NTSTATUS = 0xC0370025; +pub const STATUS_VID_MBP_COUNT_EXCEEDED_LIMIT: NTSTATUS = 0xC0370026; +pub const STATUS_VID_SAVED_STATE_CORRUPT: NTSTATUS = 0xC0370027; +pub const STATUS_VID_SAVED_STATE_UNRECOGNIZED_ITEM: NTSTATUS = 0xC0370028; +pub const STATUS_VID_SAVED_STATE_INCOMPATIBLE: NTSTATUS = 0xC0370029; +pub const STATUS_VID_VTL_ACCESS_DENIED: NTSTATUS = 0xC037002A; +pub const STATUS_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED: NTSTATUS = 0x80370001; +pub const STATUS_IPSEC_BAD_SPI: NTSTATUS = 0xC0360001; +pub const STATUS_IPSEC_SA_LIFETIME_EXPIRED: NTSTATUS = 0xC0360002; +pub const STATUS_IPSEC_WRONG_SA: NTSTATUS = 0xC0360003; +pub const STATUS_IPSEC_REPLAY_CHECK_FAILED: NTSTATUS = 0xC0360004; +pub const STATUS_IPSEC_INVALID_PACKET: NTSTATUS = 0xC0360005; +pub const STATUS_IPSEC_INTEGRITY_CHECK_FAILED: NTSTATUS = 0xC0360006; +pub const STATUS_IPSEC_CLEAR_TEXT_DROP: NTSTATUS = 0xC0360007; +pub const STATUS_IPSEC_AUTH_FIREWALL_DROP: NTSTATUS = 0xC0360008; +pub const STATUS_IPSEC_THROTTLE_DROP: NTSTATUS = 0xC0360009; +pub const STATUS_IPSEC_DOSP_BLOCK: NTSTATUS = 0xC0368000; +pub const STATUS_IPSEC_DOSP_RECEIVED_MULTICAST: NTSTATUS = 0xC0368001; +pub const STATUS_IPSEC_DOSP_INVALID_PACKET: NTSTATUS = 0xC0368002; +pub const STATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED: NTSTATUS = 0xC0368003; +pub const STATUS_IPSEC_DOSP_MAX_ENTRIES: NTSTATUS = 0xC0368004; +pub const STATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: NTSTATUS = 0xC0368005; +pub const STATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: NTSTATUS = 0xC0368006; +pub const STATUS_VOLMGR_INCOMPLETE_REGENERATION: NTSTATUS = 0x80380001; +pub const STATUS_VOLMGR_INCOMPLETE_DISK_MIGRATION: NTSTATUS = 0x80380002; +pub const STATUS_VOLMGR_DATABASE_FULL: NTSTATUS = 0xC0380001; +pub const STATUS_VOLMGR_DISK_CONFIGURATION_CORRUPTED: NTSTATUS = 0xC0380002; +pub const STATUS_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC: NTSTATUS = 0xC0380003; +pub const STATUS_VOLMGR_PACK_CONFIG_UPDATE_FAILED: NTSTATUS = 0xC0380004; +pub const STATUS_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME: NTSTATUS = 0xC0380005; +pub const STATUS_VOLMGR_DISK_DUPLICATE: NTSTATUS = 0xC0380006; +pub const STATUS_VOLMGR_DISK_DYNAMIC: NTSTATUS = 0xC0380007; +pub const STATUS_VOLMGR_DISK_ID_INVALID: NTSTATUS = 0xC0380008; +pub const STATUS_VOLMGR_DISK_INVALID: NTSTATUS = 0xC0380009; +pub const STATUS_VOLMGR_DISK_LAST_VOTER: NTSTATUS = 0xC038000A; +pub const STATUS_VOLMGR_DISK_LAYOUT_INVALID: NTSTATUS = 0xC038000B; +pub const STATUS_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS: NTSTATUS + = 0xC038000C; +pub const STATUS_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED: NTSTATUS = 0xC038000D; +pub const STATUS_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL: NTSTATUS = 0xC038000E; +pub const STATUS_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS: NTSTATUS + = 0xC038000F; +pub const STATUS_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS: NTSTATUS = 0xC0380010; +pub const STATUS_VOLMGR_DISK_MISSING: NTSTATUS = 0xC0380011; +pub const STATUS_VOLMGR_DISK_NOT_EMPTY: NTSTATUS = 0xC0380012; +pub const STATUS_VOLMGR_DISK_NOT_ENOUGH_SPACE: NTSTATUS = 0xC0380013; +pub const STATUS_VOLMGR_DISK_REVECTORING_FAILED: NTSTATUS = 0xC0380014; +pub const STATUS_VOLMGR_DISK_SECTOR_SIZE_INVALID: NTSTATUS = 0xC0380015; +pub const STATUS_VOLMGR_DISK_SET_NOT_CONTAINED: NTSTATUS = 0xC0380016; +pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS: NTSTATUS = 0xC0380017; +pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES: NTSTATUS = 0xC0380018; +pub const STATUS_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED: NTSTATUS = 0xC0380019; +pub const STATUS_VOLMGR_EXTENT_ALREADY_USED: NTSTATUS = 0xC038001A; +pub const STATUS_VOLMGR_EXTENT_NOT_CONTIGUOUS: NTSTATUS = 0xC038001B; +pub const STATUS_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION: NTSTATUS = 0xC038001C; +pub const STATUS_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED: NTSTATUS = 0xC038001D; +pub const STATUS_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION: NTSTATUS = 0xC038001E; +pub const STATUS_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH: NTSTATUS = 0xC038001F; +pub const STATUS_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED: NTSTATUS = 0xC0380020; +pub const STATUS_VOLMGR_INTERLEAVE_LENGTH_INVALID: NTSTATUS = 0xC0380021; +pub const STATUS_VOLMGR_MAXIMUM_REGISTERED_USERS: NTSTATUS = 0xC0380022; +pub const STATUS_VOLMGR_MEMBER_IN_SYNC: NTSTATUS = 0xC0380023; +pub const STATUS_VOLMGR_MEMBER_INDEX_DUPLICATE: NTSTATUS = 0xC0380024; +pub const STATUS_VOLMGR_MEMBER_INDEX_INVALID: NTSTATUS = 0xC0380025; +pub const STATUS_VOLMGR_MEMBER_MISSING: NTSTATUS = 0xC0380026; +pub const STATUS_VOLMGR_MEMBER_NOT_DETACHED: NTSTATUS = 0xC0380027; +pub const STATUS_VOLMGR_MEMBER_REGENERATING: NTSTATUS = 0xC0380028; +pub const STATUS_VOLMGR_ALL_DISKS_FAILED: NTSTATUS = 0xC0380029; +pub const STATUS_VOLMGR_NO_REGISTERED_USERS: NTSTATUS = 0xC038002A; +pub const STATUS_VOLMGR_NO_SUCH_USER: NTSTATUS = 0xC038002B; +pub const STATUS_VOLMGR_NOTIFICATION_RESET: NTSTATUS = 0xC038002C; +pub const STATUS_VOLMGR_NUMBER_OF_MEMBERS_INVALID: NTSTATUS = 0xC038002D; +pub const STATUS_VOLMGR_NUMBER_OF_PLEXES_INVALID: NTSTATUS = 0xC038002E; +pub const STATUS_VOLMGR_PACK_DUPLICATE: NTSTATUS = 0xC038002F; +pub const STATUS_VOLMGR_PACK_ID_INVALID: NTSTATUS = 0xC0380030; +pub const STATUS_VOLMGR_PACK_INVALID: NTSTATUS = 0xC0380031; +pub const STATUS_VOLMGR_PACK_NAME_INVALID: NTSTATUS = 0xC0380032; +pub const STATUS_VOLMGR_PACK_OFFLINE: NTSTATUS = 0xC0380033; +pub const STATUS_VOLMGR_PACK_HAS_QUORUM: NTSTATUS = 0xC0380034; +pub const STATUS_VOLMGR_PACK_WITHOUT_QUORUM: NTSTATUS = 0xC0380035; +pub const STATUS_VOLMGR_PARTITION_STYLE_INVALID: NTSTATUS = 0xC0380036; +pub const STATUS_VOLMGR_PARTITION_UPDATE_FAILED: NTSTATUS = 0xC0380037; +pub const STATUS_VOLMGR_PLEX_IN_SYNC: NTSTATUS = 0xC0380038; +pub const STATUS_VOLMGR_PLEX_INDEX_DUPLICATE: NTSTATUS = 0xC0380039; +pub const STATUS_VOLMGR_PLEX_INDEX_INVALID: NTSTATUS = 0xC038003A; +pub const STATUS_VOLMGR_PLEX_LAST_ACTIVE: NTSTATUS = 0xC038003B; +pub const STATUS_VOLMGR_PLEX_MISSING: NTSTATUS = 0xC038003C; +pub const STATUS_VOLMGR_PLEX_REGENERATING: NTSTATUS = 0xC038003D; +pub const STATUS_VOLMGR_PLEX_TYPE_INVALID: NTSTATUS = 0xC038003E; +pub const STATUS_VOLMGR_PLEX_NOT_RAID5: NTSTATUS = 0xC038003F; +pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE: NTSTATUS = 0xC0380040; +pub const STATUS_VOLMGR_STRUCTURE_SIZE_INVALID: NTSTATUS = 0xC0380041; +pub const STATUS_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS: NTSTATUS = 0xC0380042; +pub const STATUS_VOLMGR_TRANSACTION_IN_PROGRESS: NTSTATUS = 0xC0380043; +pub const STATUS_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE: NTSTATUS = 0xC0380044; +pub const STATUS_VOLMGR_VOLUME_CONTAINS_MISSING_DISK: NTSTATUS = 0xC0380045; +pub const STATUS_VOLMGR_VOLUME_ID_INVALID: NTSTATUS = 0xC0380046; +pub const STATUS_VOLMGR_VOLUME_LENGTH_INVALID: NTSTATUS = 0xC0380047; +pub const STATUS_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE: NTSTATUS = 0xC0380048; +pub const STATUS_VOLMGR_VOLUME_NOT_MIRRORED: NTSTATUS = 0xC0380049; +pub const STATUS_VOLMGR_VOLUME_NOT_RETAINED: NTSTATUS = 0xC038004A; +pub const STATUS_VOLMGR_VOLUME_OFFLINE: NTSTATUS = 0xC038004B; +pub const STATUS_VOLMGR_VOLUME_RETAINED: NTSTATUS = 0xC038004C; +pub const STATUS_VOLMGR_NUMBER_OF_EXTENTS_INVALID: NTSTATUS = 0xC038004D; +pub const STATUS_VOLMGR_DIFFERENT_SECTOR_SIZE: NTSTATUS = 0xC038004E; +pub const STATUS_VOLMGR_BAD_BOOT_DISK: NTSTATUS = 0xC038004F; +pub const STATUS_VOLMGR_PACK_CONFIG_OFFLINE: NTSTATUS = 0xC0380050; +pub const STATUS_VOLMGR_PACK_CONFIG_ONLINE: NTSTATUS = 0xC0380051; +pub const STATUS_VOLMGR_NOT_PRIMARY_PACK: NTSTATUS = 0xC0380052; +pub const STATUS_VOLMGR_PACK_LOG_UPDATE_FAILED: NTSTATUS = 0xC0380053; +pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID: NTSTATUS = 0xC0380054; +pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID: NTSTATUS = 0xC0380055; +pub const STATUS_VOLMGR_VOLUME_MIRRORED: NTSTATUS = 0xC0380056; +pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE_SPANNED: NTSTATUS = 0xC0380057; +pub const STATUS_VOLMGR_NO_VALID_LOG_COPIES: NTSTATUS = 0xC0380058; +pub const STATUS_VOLMGR_PRIMARY_PACK_PRESENT: NTSTATUS = 0xC0380059; +pub const STATUS_VOLMGR_NUMBER_OF_DISKS_INVALID: NTSTATUS = 0xC038005A; +pub const STATUS_VOLMGR_MIRROR_NOT_SUPPORTED: NTSTATUS = 0xC038005B; +pub const STATUS_VOLMGR_RAID5_NOT_SUPPORTED: NTSTATUS = 0xC038005C; +pub const STATUS_BCD_NOT_ALL_ENTRIES_IMPORTED: NTSTATUS = 0x80390001; +pub const STATUS_BCD_TOO_MANY_ELEMENTS: NTSTATUS = 0xC0390002; +pub const STATUS_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED: NTSTATUS = 0x80390003; +pub const STATUS_VHD_DRIVE_FOOTER_MISSING: NTSTATUS = 0xC03A0001; +pub const STATUS_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH: NTSTATUS = 0xC03A0002; +pub const STATUS_VHD_DRIVE_FOOTER_CORRUPT: NTSTATUS = 0xC03A0003; +pub const STATUS_VHD_FORMAT_UNKNOWN: NTSTATUS = 0xC03A0004; +pub const STATUS_VHD_FORMAT_UNSUPPORTED_VERSION: NTSTATUS = 0xC03A0005; +pub const STATUS_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH: NTSTATUS = 0xC03A0006; +pub const STATUS_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION: NTSTATUS = 0xC03A0007; +pub const STATUS_VHD_SPARSE_HEADER_CORRUPT: NTSTATUS = 0xC03A0008; +pub const STATUS_VHD_BLOCK_ALLOCATION_FAILURE: NTSTATUS = 0xC03A0009; +pub const STATUS_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT: NTSTATUS = 0xC03A000A; +pub const STATUS_VHD_INVALID_BLOCK_SIZE: NTSTATUS = 0xC03A000B; +pub const STATUS_VHD_BITMAP_MISMATCH: NTSTATUS = 0xC03A000C; +pub const STATUS_VHD_PARENT_VHD_NOT_FOUND: NTSTATUS = 0xC03A000D; +pub const STATUS_VHD_CHILD_PARENT_ID_MISMATCH: NTSTATUS = 0xC03A000E; +pub const STATUS_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH: NTSTATUS = 0xC03A000F; +pub const STATUS_VHD_METADATA_READ_FAILURE: NTSTATUS = 0xC03A0010; +pub const STATUS_VHD_METADATA_WRITE_FAILURE: NTSTATUS = 0xC03A0011; +pub const STATUS_VHD_INVALID_SIZE: NTSTATUS = 0xC03A0012; +pub const STATUS_VHD_INVALID_FILE_SIZE: NTSTATUS = 0xC03A0013; +pub const STATUS_VIRTDISK_PROVIDER_NOT_FOUND: NTSTATUS = 0xC03A0014; +pub const STATUS_VIRTDISK_NOT_VIRTUAL_DISK: NTSTATUS = 0xC03A0015; +pub const STATUS_VHD_PARENT_VHD_ACCESS_DENIED: NTSTATUS = 0xC03A0016; +pub const STATUS_VHD_CHILD_PARENT_SIZE_MISMATCH: NTSTATUS = 0xC03A0017; +pub const STATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: NTSTATUS = 0xC03A0018; +pub const STATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: NTSTATUS = 0xC03A0019; +pub const STATUS_VIRTUAL_DISK_LIMITATION: NTSTATUS = 0xC03A001A; +pub const STATUS_VHD_INVALID_TYPE: NTSTATUS = 0xC03A001B; +pub const STATUS_VHD_INVALID_STATE: NTSTATUS = 0xC03A001C; +pub const STATUS_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE: NTSTATUS = 0xC03A001D; +pub const STATUS_VIRTDISK_DISK_ALREADY_OWNED: NTSTATUS = 0xC03A001E; +pub const STATUS_VIRTDISK_DISK_ONLINE_AND_WRITABLE: NTSTATUS = 0xC03A001F; +pub const STATUS_CTLOG_TRACKING_NOT_INITIALIZED: NTSTATUS = 0xC03A0020; +pub const STATUS_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE: NTSTATUS = 0xC03A0021; +pub const STATUS_CTLOG_VHD_CHANGED_OFFLINE: NTSTATUS = 0xC03A0022; +pub const STATUS_CTLOG_INVALID_TRACKING_STATE: NTSTATUS = 0xC03A0023; +pub const STATUS_CTLOG_INCONSISTENT_TRACKING_FILE: NTSTATUS = 0xC03A0024; +pub const STATUS_VHD_METADATA_FULL: NTSTATUS = 0xC03A0028; +pub const STATUS_VHD_INVALID_CHANGE_TRACKING_ID: NTSTATUS = 0xC03A0029; +pub const STATUS_VHD_CHANGE_TRACKING_DISABLED: NTSTATUS = 0xC03A002A; +pub const STATUS_VHD_MISSING_CHANGE_TRACKING_INFORMATION: NTSTATUS = 0xC03A0030; +pub const STATUS_VHD_RESIZE_WOULD_TRUNCATE_DATA: NTSTATUS = 0xC03A0031; +pub const STATUS_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE: NTSTATUS = 0xC03A0032; +pub const STATUS_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE: NTSTATUS = 0xC03A0033; +pub const STATUS_QUERY_STORAGE_ERROR: NTSTATUS = 0x803A0001; +pub const STATUS_RKF_KEY_NOT_FOUND: NTSTATUS = 0xC0400001; +pub const STATUS_RKF_DUPLICATE_KEY: NTSTATUS = 0xC0400002; +pub const STATUS_RKF_BLOB_FULL: NTSTATUS = 0xC0400003; +pub const STATUS_RKF_STORE_FULL: NTSTATUS = 0xC0400004; +pub const STATUS_RKF_FILE_BLOCKED: NTSTATUS = 0xC0400005; +pub const STATUS_RKF_ACTIVE_KEY: NTSTATUS = 0xC0400006; +pub const STATUS_RDBSS_RESTART_OPERATION: NTSTATUS = 0xC0410001; +pub const STATUS_RDBSS_CONTINUE_OPERATION: NTSTATUS = 0xC0410002; +pub const STATUS_RDBSS_POST_OPERATION: NTSTATUS = 0xC0410003; +pub const STATUS_BTH_ATT_INVALID_HANDLE: NTSTATUS = 0xC0420001; +pub const STATUS_BTH_ATT_READ_NOT_PERMITTED: NTSTATUS = 0xC0420002; +pub const STATUS_BTH_ATT_WRITE_NOT_PERMITTED: NTSTATUS = 0xC0420003; +pub const STATUS_BTH_ATT_INVALID_PDU: NTSTATUS = 0xC0420004; +pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHENTICATION: NTSTATUS = 0xC0420005; +pub const STATUS_BTH_ATT_REQUEST_NOT_SUPPORTED: NTSTATUS = 0xC0420006; +pub const STATUS_BTH_ATT_INVALID_OFFSET: NTSTATUS = 0xC0420007; +pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHORIZATION: NTSTATUS = 0xC0420008; +pub const STATUS_BTH_ATT_PREPARE_QUEUE_FULL: NTSTATUS = 0xC0420009; +pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_FOUND: NTSTATUS = 0xC042000A; +pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_LONG: NTSTATUS = 0xC042000B; +pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE: NTSTATUS = 0xC042000C; +pub const STATUS_BTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH: NTSTATUS = 0xC042000D; +pub const STATUS_BTH_ATT_UNLIKELY: NTSTATUS = 0xC042000E; +pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION: NTSTATUS = 0xC042000F; +pub const STATUS_BTH_ATT_UNSUPPORTED_GROUP_TYPE: NTSTATUS = 0xC0420010; +pub const STATUS_BTH_ATT_INSUFFICIENT_RESOURCES: NTSTATUS = 0xC0420011; +pub const STATUS_BTH_ATT_UNKNOWN_ERROR: NTSTATUS = 0xC0421000; +pub const STATUS_SECUREBOOT_ROLLBACK_DETECTED: NTSTATUS = 0xC0430001; +pub const STATUS_SECUREBOOT_POLICY_VIOLATION: NTSTATUS = 0xC0430002; +pub const STATUS_SECUREBOOT_INVALID_POLICY: NTSTATUS = 0xC0430003; +pub const STATUS_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND: NTSTATUS = 0xC0430004; +pub const STATUS_SECUREBOOT_POLICY_NOT_SIGNED: NTSTATUS = 0xC0430005; +pub const STATUS_SECUREBOOT_NOT_ENABLED: NTSTATUS = 0x80430006; +pub const STATUS_SECUREBOOT_FILE_REPLACED: NTSTATUS = 0xC0430007; +pub const STATUS_SECUREBOOT_POLICY_NOT_AUTHORIZED: NTSTATUS = 0xC0430008; +pub const STATUS_SECUREBOOT_POLICY_UNKNOWN: NTSTATUS = 0xC0430009; +pub const STATUS_SECUREBOOT_POLICY_MISSING_ANTIROLLBACKVERSION: NTSTATUS = 0xC043000A; +pub const STATUS_SECUREBOOT_PLATFORM_ID_MISMATCH: NTSTATUS = 0xC043000B; +pub const STATUS_SECUREBOOT_POLICY_ROLLBACK_DETECTED: NTSTATUS = 0xC043000C; +pub const STATUS_SECUREBOOT_POLICY_UPGRADE_MISMATCH: NTSTATUS = 0xC043000D; +pub const STATUS_SECUREBOOT_REQUIRED_POLICY_FILE_MISSING: NTSTATUS = 0xC043000E; +pub const STATUS_SECUREBOOT_NOT_BASE_POLICY: NTSTATUS = 0xC043000F; +pub const STATUS_SECUREBOOT_NOT_SUPPLEMENTAL_POLICY: NTSTATUS = 0xC0430010; +pub const STATUS_PLATFORM_MANIFEST_NOT_AUTHORIZED: NTSTATUS = 0xC0EB0001; +pub const STATUS_PLATFORM_MANIFEST_INVALID: NTSTATUS = 0xC0EB0002; +pub const STATUS_PLATFORM_MANIFEST_FILE_NOT_AUTHORIZED: NTSTATUS = 0xC0EB0003; +pub const STATUS_PLATFORM_MANIFEST_CATALOG_NOT_AUTHORIZED: NTSTATUS = 0xC0EB0004; +pub const STATUS_PLATFORM_MANIFEST_BINARY_ID_NOT_FOUND: NTSTATUS = 0xC0EB0005; +pub const STATUS_PLATFORM_MANIFEST_NOT_ACTIVE: NTSTATUS = 0xC0EB0006; +pub const STATUS_PLATFORM_MANIFEST_NOT_SIGNED: NTSTATUS = 0xC0EB0007; +pub const STATUS_SYSTEM_INTEGRITY_ROLLBACK_DETECTED: NTSTATUS = 0xC0E90001; +pub const STATUS_SYSTEM_INTEGRITY_POLICY_VIOLATION: NTSTATUS = 0xC0E90002; +pub const STATUS_SYSTEM_INTEGRITY_INVALID_POLICY: NTSTATUS = 0xC0E90003; +pub const STATUS_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED: NTSTATUS = 0xC0E90004; +pub const STATUS_NO_APPLICABLE_APP_LICENSES_FOUND: NTSTATUS = 0xC0EA0001; +pub const STATUS_CLIP_LICENSE_NOT_FOUND: NTSTATUS = 0xC0EA0002; +pub const STATUS_CLIP_DEVICE_LICENSE_MISSING: NTSTATUS = 0xC0EA0003; +pub const STATUS_CLIP_LICENSE_INVALID_SIGNATURE: NTSTATUS = 0xC0EA0004; +pub const STATUS_CLIP_KEYHOLDER_LICENSE_MISSING_OR_INVALID: NTSTATUS = 0xC0EA0005; +pub const STATUS_CLIP_LICENSE_EXPIRED: NTSTATUS = 0xC0EA0006; +pub const STATUS_CLIP_LICENSE_SIGNED_BY_UNKNOWN_SOURCE: NTSTATUS = 0xC0EA0007; +pub const STATUS_CLIP_LICENSE_NOT_SIGNED: NTSTATUS = 0xC0EA0008; +pub const STATUS_CLIP_LICENSE_HARDWARE_ID_OUT_OF_TOLERANCE: NTSTATUS = 0xC0EA0009; +pub const STATUS_CLIP_LICENSE_DEVICE_ID_MISMATCH: NTSTATUS = 0xC0EA000A; +pub const STATUS_AUDIO_ENGINE_NODE_NOT_FOUND: NTSTATUS = 0xC0440001; +pub const STATUS_HDAUDIO_EMPTY_CONNECTION_LIST: NTSTATUS = 0xC0440002; +pub const STATUS_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED: NTSTATUS = 0xC0440003; +pub const STATUS_HDAUDIO_NO_LOGICAL_DEVICES_CREATED: NTSTATUS = 0xC0440004; +pub const STATUS_HDAUDIO_NULL_LINKED_LIST_ENTRY: NTSTATUS = 0xC0440005; +pub const STATUS_SPACES_REPAIRED: NTSTATUS = 0x00E70000; +pub const STATUS_SPACES_PAUSE: NTSTATUS = 0x00E70001; +pub const STATUS_SPACES_COMPLETE: NTSTATUS = 0x00E70002; +pub const STATUS_SPACES_FAULT_DOMAIN_TYPE_INVALID: NTSTATUS = 0xC0E70001; +pub const STATUS_SPACES_RESILIENCY_TYPE_INVALID: NTSTATUS = 0xC0E70003; +pub const STATUS_SPACES_DRIVE_SECTOR_SIZE_INVALID: NTSTATUS = 0xC0E70004; +pub const STATUS_SPACES_DRIVE_REDUNDANCY_INVALID: NTSTATUS = 0xC0E70006; +pub const STATUS_SPACES_NUMBER_OF_DATA_COPIES_INVALID: NTSTATUS = 0xC0E70007; +pub const STATUS_SPACES_INTERLEAVE_LENGTH_INVALID: NTSTATUS = 0xC0E70009; +pub const STATUS_SPACES_NUMBER_OF_COLUMNS_INVALID: NTSTATUS = 0xC0E7000A; +pub const STATUS_SPACES_NOT_ENOUGH_DRIVES: NTSTATUS = 0xC0E7000B; +pub const STATUS_SPACES_EXTENDED_ERROR: NTSTATUS = 0xC0E7000C; +pub const STATUS_SPACES_PROVISIONING_TYPE_INVALID: NTSTATUS = 0xC0E7000D; +pub const STATUS_SPACES_ALLOCATION_SIZE_INVALID: NTSTATUS = 0xC0E7000E; +pub const STATUS_SPACES_ENCLOSURE_AWARE_INVALID: NTSTATUS = 0xC0E7000F; +pub const STATUS_SPACES_WRITE_CACHE_SIZE_INVALID: NTSTATUS = 0xC0E70010; +pub const STATUS_SPACES_NUMBER_OF_GROUPS_INVALID: NTSTATUS = 0xC0E70011; +pub const STATUS_SPACES_DRIVE_OPERATIONAL_STATE_INVALID: NTSTATUS = 0xC0E70012; +pub const STATUS_SPACES_UPDATE_COLUMN_STATE: NTSTATUS = 0xC0E70013; +pub const STATUS_SPACES_MAP_REQUIRED: NTSTATUS = 0xC0E70014; +pub const STATUS_SPACES_UNSUPPORTED_VERSION: NTSTATUS = 0xC0E70015; +pub const STATUS_SPACES_CORRUPT_METADATA: NTSTATUS = 0xC0E70016; +pub const STATUS_SPACES_DRT_FULL: NTSTATUS = 0xC0E70017; +pub const STATUS_SPACES_INCONSISTENCY: NTSTATUS = 0xC0E70018; +pub const STATUS_SPACES_LOG_NOT_READY: NTSTATUS = 0xC0E70019; +pub const STATUS_SPACES_NO_REDUNDANCY: NTSTATUS = 0xC0E7001A; +pub const STATUS_SPACES_DRIVE_NOT_READY: NTSTATUS = 0xC0E7001B; +pub const STATUS_SPACES_DRIVE_SPLIT: NTSTATUS = 0xC0E7001C; +pub const STATUS_SPACES_DRIVE_LOST_DATA: NTSTATUS = 0xC0E7001D; +pub const STATUS_VOLSNAP_BOOTFILE_NOT_VALID: NTSTATUS = 0xC0500003; +pub const STATUS_VOLSNAP_ACTIVATION_TIMEOUT: NTSTATUS = 0xC0500004; +pub const STATUS_IO_PREEMPTED: NTSTATUS = 0xC0510001; +pub const STATUS_SVHDX_ERROR_STORED: NTSTATUS = 0xC05C0000; +pub const STATUS_SVHDX_ERROR_NOT_AVAILABLE: NTSTATUS = 0xC05CFF00; +pub const STATUS_SVHDX_UNIT_ATTENTION_AVAILABLE: NTSTATUS = 0xC05CFF01; +pub const STATUS_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED: NTSTATUS = 0xC05CFF02; +pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED: NTSTATUS = 0xC05CFF03; +pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED: NTSTATUS = 0xC05CFF04; +pub const STATUS_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED: NTSTATUS = 0xC05CFF05; +pub const STATUS_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED: NTSTATUS + = 0xC05CFF06; +pub const STATUS_SVHDX_RESERVATION_CONFLICT: NTSTATUS = 0xC05CFF07; +pub const STATUS_SVHDX_WRONG_FILE_TYPE: NTSTATUS = 0xC05CFF08; +pub const STATUS_SVHDX_VERSION_MISMATCH: NTSTATUS = 0xC05CFF09; +pub const STATUS_VHD_SHARED: NTSTATUS = 0xC05CFF0A; +pub const STATUS_SVHDX_NO_INITIATOR: NTSTATUS = 0xC05CFF0B; +pub const STATUS_VHDSET_BACKING_STORAGE_NOT_FOUND: NTSTATUS = 0xC05CFF0C; +pub const STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP: NTSTATUS = 0xC05D0000; +pub const STATUS_SMB_BAD_CLUSTER_DIALECT: NTSTATUS = 0xC05D0001; +pub const STATUS_SMB_GUEST_LOGON_BLOCKED: NTSTATUS = 0xC05D0002; +pub const STATUS_SECCORE_INVALID_COMMAND: NTSTATUS = 0xC0E80000; +pub const STATUS_VSM_NOT_INITIALIZED: NTSTATUS = 0xC0450000; +pub const STATUS_VSM_DMA_PROTECTION_NOT_IN_USE: NTSTATUS = 0xC0450001; diff --git a/src/vendor/winapi/src/shared/qos.rs b/src/vendor/winapi/src/shared/qos.rs new file mode 100644 index 0000000000..bfa2e362f1 --- /dev/null +++ b/src/vendor/winapi/src/shared/qos.rs @@ -0,0 +1,21 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! QoS definitions for NDIS components. +use shared::minwindef::ULONG; +pub type SERVICETYPE = ULONG; +STRUCT!{struct FLOWSPEC { + TokenRate: ULONG, + TokenBucketSize: ULONG, + PeakBandwidth: ULONG, + Latency: ULONG, + DelayVariation: ULONG, + ServiceType: SERVICETYPE, + MaxSduSize: ULONG, + MinimumPolicedSize: ULONG, +}} +pub type PFLOWSPEC = *mut FLOWSPEC; +pub type LPFLOWSPEC = *mut FLOWSPEC; diff --git a/src/vendor/winapi/src/shared/rpc.rs b/src/vendor/winapi/src/shared/rpc.rs new file mode 100644 index 0000000000..e3b6975d9d --- /dev/null +++ b/src/vendor/winapi/src/shared/rpc.rs @@ -0,0 +1,12 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Master include file for RPC applications. + +use ctypes::{c_long, c_void}; + +pub type I_RPC_HANDLE = *mut c_void; +pub type RPC_STATUS = c_long; diff --git a/src/vendor/winapi/src/shared/rpcdce.rs b/src/vendor/winapi/src/shared/rpcdce.rs new file mode 100644 index 0000000000..8937be5fc0 --- /dev/null +++ b/src/vendor/winapi/src/shared/rpcdce.rs @@ -0,0 +1,566 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module contains the DCE RPC runtime APIs. + +use ctypes::{c_int, c_uchar, c_uint, c_ulong, c_ushort, c_void, wchar_t}; +use shared::guiddef::GUID; +use shared::minwindef::DWORD; +use shared::rpc::{I_RPC_HANDLE, RPC_STATUS}; + +pub type RPC_CSTR = *mut c_uchar; +pub type RPC_WSTR = *mut wchar_t; +pub type RPC_CWSTR = *const wchar_t; +pub type RPC_BINDING_HANDLE = I_RPC_HANDLE; +pub type handle_t = RPC_BINDING_HANDLE; +pub type rpc_binding_handle_t = RPC_BINDING_HANDLE; +pub type UUID = GUID; +pub type uuid_t = UUID; +STRUCT!{struct RPC_BINDING_VECTOR { + Count: c_ulong, + BindingH: [RPC_BINDING_HANDLE; 1], +}} +pub type rpc_binding_vector_t = RPC_BINDING_VECTOR; +STRUCT!{struct UUID_VECTOR { + Count: c_ulong, + Uuid: [*mut UUID; 1], +}} +pub type uuid_vector_t = UUID_VECTOR; +pub type RPC_IF_HANDLE = *mut c_void; +STRUCT!{struct RPC_IF_ID { + Uuid: UUID, + VersMajor: c_ushort, + VersMinor: c_ushort, +}} +pub const RPC_C_BINDING_INFINITE_TIMEOUT: DWORD = 10; +pub const RPC_C_BINDING_MIN_TIMEOUT: DWORD = 0; +pub const RPC_C_BINDING_DEFAULT_TIMEOUT: DWORD = 5; +pub const RPC_C_BINDING_MAX_TIMEOUT: DWORD = 9; +pub const RPC_C_CANCEL_INFINITE_TIMEOUT: c_int = -1; +pub const RPC_C_LISTEN_MAX_CALLS_DEFAULT: DWORD = 1234; +pub const RPC_C_PROTSEQ_MAX_REQS_DEFAULT: DWORD = 10; +pub const RPC_C_BIND_TO_ALL_NICS: DWORD = 1; +pub const RPC_C_USE_INTERNET_PORT: DWORD = 0x1; +pub const RPC_C_USE_INTRANET_PORT: DWORD = 0x2; +pub const RPC_C_DONT_FAIL: DWORD = 0x4; +pub const RPC_C_RPCHTTP_USE_LOAD_BALANCE: DWORD = 0x8; +pub const RPC_C_MQ_TEMPORARY: DWORD = 0x0000; +pub const RPC_C_MQ_PERMANENT: DWORD = 0x0001; +pub const RPC_C_MQ_CLEAR_ON_OPEN: DWORD = 0x0002; +pub const RPC_C_MQ_USE_EXISTING_SECURITY: DWORD = 0x0004; +pub const RPC_C_MQ_AUTHN_LEVEL_NONE: DWORD = 0x0000; +pub const RPC_C_MQ_AUTHN_LEVEL_PKT_INTEGRITY: DWORD = 0x0008; +pub const RPC_C_MQ_AUTHN_LEVEL_PKT_PRIVACY: DWORD = 0x0010; +pub const RPC_C_OPT_MQ_DELIVERY: DWORD = 1; +pub const RPC_C_OPT_MQ_PRIORITY: DWORD = 2; +pub const RPC_C_OPT_MQ_JOURNAL: DWORD = 3; +pub const RPC_C_OPT_MQ_ACKNOWLEDGE: DWORD = 4; +pub const RPC_C_OPT_MQ_AUTHN_SERVICE: DWORD = 5; +pub const RPC_C_OPT_MQ_AUTHN_LEVEL: DWORD = 6; +pub const RPC_C_OPT_MQ_TIME_TO_REACH_QUEUE: DWORD = 7; +pub const RPC_C_OPT_MQ_TIME_TO_BE_RECEIVED: DWORD = 8; +pub const RPC_C_OPT_BINDING_NONCAUSAL: DWORD = 9; +pub const RPC_C_OPT_SECURITY_CALLBACK: DWORD = 10; +pub const RPC_C_OPT_UNIQUE_BINDING: DWORD = 11; +pub const RPC_C_OPT_CALL_TIMEOUT: DWORD = 12; +pub const RPC_C_OPT_DONT_LINGER: DWORD = 13; +pub const RPC_C_OPT_TRUST_PEER: DWORD = 14; +pub const RPC_C_OPT_ASYNC_BLOCK: DWORD = 15; +pub const RPC_C_OPT_OPTIMIZE_TIME: DWORD = 16; +pub const RPC_C_OPT_MAX_OPTIONS: DWORD = 17; +pub const RPC_C_MQ_EXPRESS: DWORD = 0; +pub const RPC_C_MQ_RECOVERABLE: DWORD = 1; +pub const RPC_C_MQ_JOURNAL_NONE: DWORD = 0; +pub const RPC_C_MQ_JOURNAL_DEADLETTER: DWORD = 1; +pub const RPC_C_MQ_JOURNAL_ALWAYS: DWORD = 2; +pub const RPC_C_FULL_CERT_CHAIN: DWORD = 0x0001; +STRUCT!{struct RPC_PROTSEQ_VECTORA { + Count: c_uint, + Protseq: [*mut c_uchar; 1], +}} +STRUCT!{struct RPC_PROTSEQ_VECTORW { + Count: c_uint, + Protseq: [*mut c_ushort; 1], +}} +STRUCT!{struct RPC_POLICY { + Length: c_uint, + EndpointFlags: c_ulong, + NICFlags: c_ulong, +}} +pub type PRPC_POLICY = *mut RPC_POLICY; +FN!{stdcall RPC_OBJECT_INQ_FN( + ObjectUuid: *mut UUID, + TypeUuid: *mut UUID, + Status: *mut RPC_STATUS, +) -> ()} +FN!{stdcall RPC_IF_CALLBACK_FN( + InterfaceUuid: RPC_IF_HANDLE, + Context: *mut c_void, +) -> RPC_STATUS} +FN!{stdcall RPC_SECURITY_CALLBACK_FN( + Context: *mut c_void, +) -> ()} +pub type RPC_MGR_EPV = c_void; +STRUCT!{struct RPC_STATS_VECTOR { + Count: c_uint, + Stats: [c_ulong; 1], +}} +pub const RPC_C_STATS_CALLS_IN: c_ulong = 0; +pub const RPC_C_STATS_CALLS_OUT: c_ulong = 1; +pub const RPC_C_STATS_PKTS_IN: c_ulong = 2; +pub const RPC_C_STATS_PKTS_OUT: c_ulong = 3; +STRUCT!{struct RPC_IF_ID_VECTOR { + Count: c_ulong, + IfId: [*mut RPC_IF_ID; 1], +}} +pub type RPC_AUTH_IDENTITY_HANDLE = *mut c_void; +pub type RPC_AUTHZ_HANDLE = *mut c_void; +pub const RPC_C_AUTHN_LEVEL_DEFAULT: DWORD = 0; +pub const RPC_C_AUTHN_LEVEL_NONE: DWORD = 1; +pub const RPC_C_AUTHN_LEVEL_CONNECT: DWORD = 2; +pub const RPC_C_AUTHN_LEVEL_CALL: DWORD = 3; +pub const RPC_C_AUTHN_LEVEL_PKT: DWORD = 4; +pub const RPC_C_AUTHN_LEVEL_PKT_INTEGRITY: DWORD = 5; +pub const RPC_C_AUTHN_LEVEL_PKT_PRIVACY: DWORD = 6; +pub const RPC_C_IMP_LEVEL_DEFAULT: DWORD = 0; +pub const RPC_C_IMP_LEVEL_ANONYMOUS: DWORD = 1; +pub const RPC_C_IMP_LEVEL_IDENTIFY: DWORD = 2; +pub const RPC_C_IMP_LEVEL_IMPERSONATE: DWORD = 3; +pub const RPC_C_IMP_LEVEL_DELEGATE: DWORD = 4; +pub const RPC_C_QOS_IDENTITY_STATIC: DWORD = 0; +pub const RPC_C_QOS_IDENTITY_DYNAMIC: DWORD = 1; +pub const RPC_C_QOS_CAPABILITIES_DEFAULT: DWORD = 0x0; +pub const RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH: DWORD = 0x1; +pub const RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC: DWORD = 0x2; +pub const RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY: DWORD = 0x4; +pub const RPC_C_QOS_CAPABILITIES_IGNORE_DELEGATE_FAILURE: DWORD = 0x8; +pub const RPC_C_QOS_CAPABILITIES_LOCAL_MA_HINT: DWORD = 0x10; +pub const RPC_C_QOS_CAPABILITIES_SCHANNEL_FULL_AUTH_IDENTITY: DWORD = 0x20; +pub const RPC_C_PROTECT_LEVEL_DEFAULT: DWORD = RPC_C_AUTHN_LEVEL_DEFAULT; +pub const RPC_C_PROTECT_LEVEL_NONE: DWORD = RPC_C_AUTHN_LEVEL_NONE; +pub const RPC_C_PROTECT_LEVEL_CONNECT: DWORD = RPC_C_AUTHN_LEVEL_CONNECT; +pub const RPC_C_PROTECT_LEVEL_CALL: DWORD = RPC_C_AUTHN_LEVEL_CALL; +pub const RPC_C_PROTECT_LEVEL_PKT: DWORD = RPC_C_AUTHN_LEVEL_PKT; +pub const RPC_C_PROTECT_LEVEL_PKT_INTEGRITY: DWORD = RPC_C_AUTHN_LEVEL_PKT_INTEGRITY; +pub const RPC_C_PROTECT_LEVEL_PKT_PRIVACY: DWORD = RPC_C_AUTHN_LEVEL_PKT_PRIVACY; +pub const RPC_C_AUTHN_NONE: DWORD = 0; +pub const RPC_C_AUTHN_DCE_PRIVATE: DWORD = 1; +pub const RPC_C_AUTHN_DCE_PUBLIC: DWORD = 2; +pub const RPC_C_AUTHN_DEC_PUBLIC: DWORD = 4; +pub const RPC_C_AUTHN_GSS_NEGOTIATE: DWORD = 9; +pub const RPC_C_AUTHN_WINNT: DWORD = 10; +pub const RPC_C_AUTHN_GSS_SCHANNEL: DWORD = 14; +pub const RPC_C_AUTHN_GSS_KERBEROS: DWORD = 16; +pub const RPC_C_AUTHN_DPA: DWORD = 17; +pub const RPC_C_AUTHN_MSN: DWORD = 18; +pub const RPC_C_AUTHN_DIGEST: DWORD = 21; +pub const RPC_C_AUTHN_KERNEL: DWORD = 20; +pub const RPC_C_AUTHN_NEGO_EXTENDER: DWORD = 30; +pub const RPC_C_AUTHN_PKU2U: DWORD = 31; +pub const RPC_C_AUTHN_LIVE_SSP: DWORD = 32; +pub const RPC_C_AUTHN_LIVEXP_SSP: DWORD = 35; +pub const RPC_C_AUTHN_MSONLINE: DWORD = 82; +pub const RPC_C_AUTHN_MQ: DWORD = 100; +pub const RPC_C_AUTHN_DEFAULT: DWORD = 0xFFFFFFFF; +pub const RPC_C_NO_CREDENTIALS: DWORD = 0xFFFFFFFF; +pub const RPC_C_SECURITY_QOS_VERSION: DWORD = 1; +pub const RPC_C_SECURITY_QOS_VERSION_1: DWORD = 1; +STRUCT!{struct RPC_SECURITY_QOS { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, +}} +pub type PRPC_SECURITY_QOS = *mut RPC_SECURITY_QOS; +STRUCT!{struct SEC_WINNT_AUTH_IDENTITY_W { + User: *mut c_ushort, + UserLength: c_ulong, + Domain: *mut c_ushort, + DomainLength: c_ulong, + Password: *mut c_ushort, + PasswordLength: c_ulong, + Flags: c_ulong, +}} +pub type PSEC_WINNT_AUTH_IDENTITY_W = *mut SEC_WINNT_AUTH_IDENTITY_W; +STRUCT!{struct SEC_WINNT_AUTH_IDENTITY_A { + User: *mut c_uchar, + UserLength: c_ulong, + Domain: *mut c_uchar, + DomainLength: c_ulong, + Password: *mut c_uchar, + PasswordLength: c_ulong, + Flags: c_ulong, +}} +pub type PSEC_WINNT_AUTH_IDENTITY_A = *mut SEC_WINNT_AUTH_IDENTITY_A; +pub const RPC_C_AUTHN_INFO_TYPE_HTTP: c_ulong = 1; +pub const RPC_C_HTTP_AUTHN_TARGET_SERVER: c_ulong = 1; +pub const RPC_C_HTTP_AUTHN_TARGET_PROXY: c_ulong = 2; +pub const RPC_C_HTTP_AUTHN_SCHEME_BASIC: c_ulong = 0x00000001; +pub const RPC_C_HTTP_AUTHN_SCHEME_NTLM: c_ulong = 0x00000002; +pub const RPC_C_HTTP_AUTHN_SCHEME_PASSPORT: c_ulong = 0x00000004; +pub const RPC_C_HTTP_AUTHN_SCHEME_DIGEST: c_ulong = 0x00000008; +pub const RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE: c_ulong = 0x00000010; +pub const RPC_C_HTTP_AUTHN_SCHEME_CERT: c_ulong = 0x00010000; +pub const RPC_C_HTTP_FLAG_USE_SSL: c_ulong = 1; +pub const RPC_C_HTTP_FLAG_USE_FIRST_AUTH_SCHEME: c_ulong = 2; +pub const RPC_C_HTTP_FLAG_IGNORE_CERT_CN_INVALID: c_ulong = 8; +pub const RPC_C_HTTP_FLAG_ENABLE_CERT_REVOCATION_CHECK: c_ulong = 16; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_W { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, + Flags: c_ulong, + AuthenticationTarget: c_ulong, + NumberOfAuthnSchemes: c_ulong, + AuthnSchemes: *mut c_ulong, + ServerCertificateSubject: *mut c_ushort, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_A { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, + Flags: c_ulong, + AuthenticationTarget: c_ulong, + NumberOfAuthnSchemes: c_ulong, + AuthnSchemes: *mut c_ulong, + ServerCertificateSubject: *mut c_uchar, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, + Flags: c_ulong, + AuthenticationTarget: c_ulong, + NumberOfAuthnSchemes: c_ulong, + AuthnSchemes: *mut c_ulong, + ServerCertificateSubject: *mut c_ushort, + ProxyCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, + NumberOfProxyAuthnSchemes: c_ulong, + ProxyAuthnSchemes: *mut c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A { + TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, + Flags: c_ulong, + AuthenticationTarget: c_ulong, + NumberOfAuthnSchemes: c_ulong, + AuthnSchemes: *mut c_ulong, + ServerCertificateSubject: *mut c_uchar, + ProxyCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, + NumberOfProxyAuthnSchemes: c_ulong, + ProxyAuthnSchemes: *mut c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W { + TransportCredentials: RPC_AUTH_IDENTITY_HANDLE, + Flags: c_ulong, + AuthenticationTarget: c_ulong, + NumberOfAuthnSchemes: c_ulong, + AuthnSchemes: *mut c_ulong, + ServerCertificateSubject: *mut c_ushort, + ProxyCredentials: *mut RPC_AUTH_IDENTITY_HANDLE, + NumberOfProxyAuthnSchemes: c_ulong, + ProxyAuthnSchemes: *mut c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W; +STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A { + TransportCredentials: RPC_AUTH_IDENTITY_HANDLE, + Flags: c_ulong, + AuthenticationTarget: c_ulong, + NumberOfAuthnSchemes: c_ulong, + AuthnSchemes: *mut c_ulong, + ServerCertificateSubject: *mut c_uchar, + ProxyCredentials: *mut RPC_AUTH_IDENTITY_HANDLE, + NumberOfProxyAuthnSchemes: c_ulong, + ProxyAuthnSchemes: *mut c_ulong, +}} +pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A; +STRUCT!{struct RPC_SECURITY_QOS_V2_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V2_W { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V2_W_union, +}} +pub type PRPC_SECURITY_QOS_V2_W = *mut RPC_SECURITY_QOS_V2_W; +STRUCT!{struct RPC_SECURITY_QOS_V2_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V2_A { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V2_A_union, +}} +pub type PRPC_SECURITY_QOS_V2_A = *mut RPC_SECURITY_QOS_V2_A; +STRUCT!{struct RPC_SECURITY_QOS_V3_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V3_W { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V3_W_union, + Sid: *mut c_void, +}} +pub type PRPC_SECURITY_QOS_V3_W = *mut RPC_SECURITY_QOS_V3_W; +STRUCT!{struct RPC_SECURITY_QOS_V3_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V3_A { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V3_A_union, + Sid: *mut c_void, +}} +pub type PRPC_SECURITY_QOS_V3_A = *mut RPC_SECURITY_QOS_V3_A; +STRUCT!{struct RPC_SECURITY_QOS_V4_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V4_W { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V4_W_union, + Sid: *mut c_void, + EffectiveOnly: c_uint, +}} +pub type PRPC_SECURITY_QOS_V4_W = *mut RPC_SECURITY_QOS_V4_W; +STRUCT!{struct RPC_SECURITY_QOS_V4_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V4_A { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V4_A_union, + Sid: *mut c_void, + EffectiveOnly: c_uint, +}} +pub type PRPC_SECURITY_QOS_V4_A = *mut RPC_SECURITY_QOS_V4_A; +STRUCT!{struct RPC_SECURITY_QOS_V5_W_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, +}} +STRUCT!{struct RPC_SECURITY_QOS_V5_W { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V5_W_union, + Sid: *mut c_void, + EffectiveOnly: c_uint, + ServerSecurityDescriptor: *mut c_void, +}} +pub type PRPC_SECURITY_QOS_V5_W = *mut RPC_SECURITY_QOS_V5_W; +STRUCT!{struct RPC_SECURITY_QOS_V5_A_union { + HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, +}} +STRUCT!{struct RPC_SECURITY_QOS_V5_A { + Version: c_ulong, + Capabilities: c_ulong, + IdentityTracking: c_ulong, + ImpersonationType: c_ulong, + AdditionalSecurityInfoType: c_ulong, + u: RPC_SECURITY_QOS_V5_A_union, + Sid: *mut c_void, + EffectiveOnly: c_uint, + ServerSecurityDescriptor: *mut c_void, +}} +pub type PRPC_SECURITY_QOS_V5_A = *mut RPC_SECURITY_QOS_V5_A; +pub const RPC_PROTSEQ_TCP: c_ulong = 0x1; +pub const RPC_PROTSEQ_NMP: c_ulong = 0x2; +pub const RPC_PROTSEQ_LRPC: c_ulong = 0x3; +pub const RPC_PROTSEQ_HTTP: c_ulong = 0x4; +pub const RPC_BHT_OBJECT_UUID_VALID: c_ulong = 0x1; +pub const RPC_BHO_NONCAUSAL: c_ulong = 0x1; +pub const RPC_BHO_DONTLINGER: c_ulong = 0x2; +pub const RPC_BHO_EXCLUSIVE_AND_GUARANTEED: c_ulong = 0x4; +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_W_union { + Reserved: *mut c_ushort, +}} +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_W { + Version: c_ulong, + Flags: c_ulong, + ProtocolSequence: c_ulong, + NetworkAddress: *mut c_ushort, + StringEndpoint: *mut c_ushort, + u1: RPC_BINDING_HANDLE_TEMPLATE_V1_W_union, + ObjectUuid: UUID, +}} +pub type PRPC_BINDING_HANDLE_TEMPLATE_V1_W = *mut RPC_BINDING_HANDLE_TEMPLATE_V1_W; +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_A_union { + Reserved: *mut c_uchar, +}} +STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_A { + Version: c_ulong, + Flags: c_ulong, + ProtocolSequence: c_ulong, + NetworkAddress: *mut c_uchar, + StringEndpoint: *mut c_uchar, + u1: RPC_BINDING_HANDLE_TEMPLATE_V1_A_union, + ObjectUuid: UUID, +}} +pub type PRPC_BINDING_HANDLE_TEMPLATE_V1_A = *mut RPC_BINDING_HANDLE_TEMPLATE_V1_A; +STRUCT!{struct RPC_BINDING_HANDLE_SECURITY_V1_W { + Version: c_ulong, + ServerPrincName: *mut c_ushort, + AuthnLevel: c_ulong, + AuthnSvc: c_ulong, + AuthIdentity: *mut SEC_WINNT_AUTH_IDENTITY_W, + SecurityQos: *mut RPC_SECURITY_QOS, +}} +pub type PRPC_BINDING_HANDLE_SECURITY_V1_W = *mut RPC_BINDING_HANDLE_SECURITY_V1_W; +STRUCT!{struct RPC_BINDING_HANDLE_SECURITY_V1_A { + Version: c_ulong, + ServerPrincName: *mut c_uchar, + AuthnLevel: c_ulong, + AuthnSvc: c_ulong, + AuthIdentity: *mut SEC_WINNT_AUTH_IDENTITY_A, + SecurityQos: *mut RPC_SECURITY_QOS, +}} +pub type PRPC_BINDING_HANDLE_SECURITY_V1_A = *mut RPC_BINDING_HANDLE_SECURITY_V1_A; +STRUCT!{struct RPC_BINDING_HANDLE_OPTIONS_V1 { + Version: c_ulong, + Flags: c_ulong, + ComTimeout: c_ulong, + CallTimeout: c_ulong, +}} +pub type PRPC_BINDING_HANDLE_OPTIONS_V1 = *mut RPC_BINDING_HANDLE_OPTIONS_V1; +ENUM!{enum RPC_HTTP_REDIRECTOR_STAGE { + RPCHTTP_RS_REDIRECT = 1, + RPCHTTP_RS_ACCESS_1, + RPCHTTP_RS_SESSION, + RPCHTTP_RS_ACCESS_2, + RPCHTTP_RS_INTERFACE, +}} +FN!{stdcall RPC_NEW_HTTP_PROXY_CHANNEL( + RedirectorStage: RPC_HTTP_REDIRECTOR_STAGE, + ServerName: RPC_WSTR, + ServerPort: RPC_WSTR, + RemoteUser: RPC_WSTR, + AuthType: RPC_WSTR, + ResourceUuid: *mut c_void, + SessionId: *mut c_void, + Interface: *mut c_void, + Reserved: *mut c_void, + Flags: c_ulong, + NewServerName: *mut RPC_WSTR, + NewServerPort: *mut RPC_WSTR, +) -> RPC_STATUS} +FN!{stdcall RPC_HTTP_PROXY_FREE_STRING( + String: RPC_WSTR, +) -> ()} +pub const RPC_C_AUTHZ_NONE: DWORD = 0; +pub const RPC_C_AUTHZ_NAME: DWORD = 1; +pub const RPC_C_AUTHZ_DCE: DWORD = 2; +pub const RPC_C_AUTHZ_DEFAULT: DWORD = 0xffffffff; +FN!{stdcall RPC_AUTH_KEY_RETRIEVAL_FN( + Arg: *mut c_void, + ServerPrincName: RPC_WSTR, + KeyVer: c_ulong, + Key: *mut *mut c_void, + Status: *mut RPC_STATUS, +) -> ()} +STRUCT!{struct RPC_CLIENT_INFORMATION1 { + UserName: *mut c_uchar, + ComputerName: *mut c_uchar, + Privilege: c_ushort, + AuthFlags: c_ulong, +}} +pub type PRPC_CLIENT_INFORMATION1 = *mut RPC_CLIENT_INFORMATION1; +pub type RPC_EP_INQ_HANDLE = *mut I_RPC_HANDLE; +pub const RPC_C_EP_ALL_ELTS: c_ulong = 0; +pub const RPC_C_EP_MATCH_BY_IF: c_ulong = 1; +pub const RPC_C_EP_MATCH_BY_OBJ: c_ulong = 2; +pub const RPC_C_EP_MATCH_BY_BOTH: c_ulong = 3; +pub const RPC_C_VERS_ALL: c_ulong = 1; +pub const RPC_C_VERS_COMPATIBLE: c_ulong = 2; +pub const RPC_C_VERS_EXACT: c_ulong = 3; +pub const RPC_C_VERS_MAJOR_ONLY: c_ulong = 4; +pub const RPC_C_VERS_UPTO: c_ulong = 5; +FN!{stdcall RPC_MGMT_AUTHORIZATION_FN( + ClientBinding: RPC_BINDING_HANDLE, + RequestedMgmtOperation: c_ulong, + Status: *mut RPC_STATUS, +) -> c_int} +pub const RPC_C_MGMT_INQ_IF_IDS: c_ulong = 0; +pub const RPC_C_MGMT_INQ_PRINC_NAME: c_ulong = 1; +pub const RPC_C_MGMT_INQ_STATS: c_ulong = 2; +pub const RPC_C_MGMT_IS_SERVER_LISTEN: c_ulong = 3; +pub const RPC_C_MGMT_STOP_SERVER_LISTEN: c_ulong = 4; +pub const RPC_IF_AUTOLISTEN: c_uint = 0x0001; +pub const RPC_IF_OLE: c_uint = 0x0002; +pub const RPC_IF_ALLOW_UNKNOWN_AUTHORITY: c_uint = 0x0004; +pub const RPC_IF_ALLOW_SECURE_ONLY: c_uint = 0x0008; +pub const RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH: c_uint = 0x0010; +pub const RPC_IF_ALLOW_LOCAL_ONLY: c_uint = 0x0020; +pub const RPC_IF_SEC_NO_CACHE: c_uint = 0x0040; +pub const RPC_IF_SEC_CACHE_PER_PROC: c_uint = 0x0080; +pub const RPC_IF_ASYNC_CALLBACK: c_uint = 0x0100; +pub const RPC_FW_IF_FLAG_DCOM: c_uint = 0x0001; +pub type RPC_INTERFACE_GROUP = *mut c_void; +pub type PRPC_INTERFACE_GROUP = *mut *mut c_void; +STRUCT!{struct RPC_ENDPOINT_TEMPLATEW { + Version: c_ulong, + ProtSeq: RPC_WSTR, + Endpoint: RPC_WSTR, + SecurityDescriptor: *mut c_void, + Backlog: c_ulong, +}} +pub type PRPC_ENDPOINT_TEMPLATEW = *mut RPC_ENDPOINT_TEMPLATEW; +STRUCT!{struct RPC_ENDPOINT_TEMPLATEA { + Version: c_ulong, + ProtSeq: RPC_CSTR, + Endpoint: RPC_CSTR, + SecurityDescriptor: *mut c_void, + Backlog: c_ulong, +}} +pub type PRPC_ENDPOINT_TEMPLATEA = *mut RPC_ENDPOINT_TEMPLATEA; +STRUCT!{struct RPC_INTERFACE_TEMPLATEA { + Version: c_ulong, + IfSpec: RPC_IF_HANDLE, + MgrTypeUuid: *mut UUID, + MgrEpv: *mut RPC_MGR_EPV, + Flags: c_uint, + MaxCalls: c_uint, + MaxRpcSize: c_uint, + IfCallback: *mut RPC_IF_CALLBACK_FN, + UuidVector: *mut UUID_VECTOR, + Annotation: RPC_CSTR, + SecurityDescriptor: *mut c_void, +}} +pub type PRPC_INTERFACE_TEMPLATEA = *mut RPC_INTERFACE_TEMPLATEA; +STRUCT!{struct RPC_INTERFACE_TEMPLATEW { + Version: c_ulong, + IfSpec: RPC_IF_HANDLE, + MgrTypeUuid: *mut UUID, + MgrEpv: *mut RPC_MGR_EPV, + Flags: c_uint, + MaxCalls: c_uint, + MaxRpcSize: c_uint, + IfCallback: *mut RPC_IF_CALLBACK_FN, + UuidVector: *mut UUID_VECTOR, + Annotation: RPC_WSTR, + SecurityDescriptor: *mut c_void, +}} +pub type PRPC_INTERFACE_TEMPLATEW = *mut RPC_INTERFACE_TEMPLATEW; +FN!{stdcall RPC_INTERFACE_GROUP_IDLE_CALLBACK_FN( + IfGroup: RPC_INTERFACE_GROUP, + IdleCallbackContext: *mut c_void, + IsGroupIdle: c_ulong, +) -> ()} diff --git a/src/vendor/winapi/src/shared/rpcndr.rs b/src/vendor/winapi/src/shared/rpcndr.rs new file mode 100644 index 0000000000..5ecb14b49d --- /dev/null +++ b/src/vendor/winapi/src/shared/rpcndr.rs @@ -0,0 +1,26 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{__int64, __uint64, c_char, c_uchar, c_ulong}; +pub const NDR_CHAR_REP_MASK: c_ulong = 0x0000000F; +pub const NDR_INT_REP_MASK: c_ulong = 0x000000F0; +pub const NDR_FLOAT_REP_MASK: c_ulong = 0x0000FF00; +pub const NDR_LITTLE_ENDIAN: c_ulong = 0x00000010; +pub const NDR_BIG_ENDIAN: c_ulong = 0x00000000; +pub const NDR_IEEE_FLOAT: c_ulong = 0x00000000; +pub const NDR_VAX_FLOAT: c_ulong = 0x00000100; +pub const NDR_IBM_FLOAT: c_ulong = 0x00000300; +pub const NDR_ASCII_CHAR: c_ulong = 0x00000000; +pub const NDR_EBCDIC_CHAR: c_ulong = 0x00000001; +pub const NDR_LOCAL_DATA_REPRESENTATION: c_ulong = 0x00000010; +pub const NDR_LOCAL_ENDIAN: c_ulong = NDR_LITTLE_ENDIAN; +pub type small = c_char; +pub type byte = c_uchar; +pub type cs_byte = byte; +pub type boolean = c_uchar; +pub type hyper = __int64; +pub type MIDL_uhyper = __uint64; +// TODO Finish the rest diff --git a/src/vendor/winapi/src/shared/sspi.rs b/src/vendor/winapi/src/shared/sspi.rs new file mode 100644 index 0000000000..1e7cba4fa5 --- /dev/null +++ b/src/vendor/winapi/src/shared/sspi.rs @@ -0,0 +1,1076 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Security Support Provider Interface Prototypes and structure definitions + +use ctypes::{c_char, c_int, c_uchar, c_ulong, c_ushort, c_void}; +use shared::basetsd::{ULONG_PTR}; +use shared::guiddef::GUID; +use shared::minwindef::{PUCHAR, ULONG, USHORT}; +use um::subauth::PUNICODE_STRING; +use um::wincred::{PCREDUI_INFOA, PCREDUI_INFOW}; +use um::winnt::{ + BOOLEAN, CHAR, HANDLE, LARGE_INTEGER, LONG, LPSTR, LPWSTR, LUID, PCSTR, PCWSTR, PVOID, WCHAR +}; + +pub type SEC_WCHAR = WCHAR; +pub type SEC_CHAR = CHAR; +pub type SECURITY_STATUS = LONG; +STRUCT!{struct SecHandle { + dwLower: ULONG_PTR, + dwUpper: ULONG_PTR, +}} +pub type PSecHandle = *mut SecHandle; +pub const SEC_DELETED_HANDLE: ULONG_PTR = 2; +pub type CredHandle = SecHandle; +pub type PCredHandle = PSecHandle; +pub type CtxtHandle = SecHandle; +pub type PCtxtHandle = PSecHandle; +pub type SECURITY_INTEGER = LARGE_INTEGER; +pub type PSECURITY_INTEGER = *mut LARGE_INTEGER; +pub type TimeStamp = SECURITY_INTEGER; +pub type PTimeStamp = *mut SECURITY_INTEGER; +STRUCT!{struct SECURITY_STRING { + Length: c_ushort, + MaximumLength: c_ushort, + Buffer: *mut c_ushort, +}} +pub type PSECURITY_STRING = *mut SECURITY_STRING; +STRUCT!{struct SecPkgInfoW { + fCapabilities: c_ulong, + wVersion: c_ushort, + wRPCID: c_ushort, + cbMaxToken: c_ulong, + Name: *mut SEC_WCHAR, + Comment: *mut SEC_WCHAR, +}} +pub type PSecPkgInfoW = *mut SecPkgInfoW; +STRUCT!{struct SecPkgInfoA { + fCapabilities: c_ulong, + wVersion: c_ushort, + wRPCID: c_ushort, + cbMaxToken: c_ulong, + Name: *mut SEC_CHAR, + Comment: *mut SEC_CHAR, +}} +pub type PSecPkgInfoA = *mut SecPkgInfoA; +pub const SECPKG_FLAG_INTEGRITY: c_ulong = 0x00000001; +pub const SECPKG_FLAG_PRIVACY: c_ulong = 0x00000002; +pub const SECPKG_FLAG_TOKEN_ONLY: c_ulong = 0x00000004; +pub const SECPKG_FLAG_DATAGRAM: c_ulong = 0x00000008; +pub const SECPKG_FLAG_CONNECTION: c_ulong = 0x00000010; +pub const SECPKG_FLAG_MULTI_REQUIRED: c_ulong = 0x00000020; +pub const SECPKG_FLAG_CLIENT_ONLY: c_ulong = 0x00000040; +pub const SECPKG_FLAG_EXTENDED_ERROR: c_ulong = 0x00000080; +pub const SECPKG_FLAG_IMPERSONATION: c_ulong = 0x00000100; +pub const SECPKG_FLAG_ACCEPT_WIN32_NAME: c_ulong = 0x00000200; +pub const SECPKG_FLAG_STREAM: c_ulong = 0x00000400; +pub const SECPKG_FLAG_NEGOTIABLE: c_ulong = 0x00000800; +pub const SECPKG_FLAG_GSS_COMPATIBLE: c_ulong = 0x00001000; +pub const SECPKG_FLAG_LOGON: c_ulong = 0x00002000; +pub const SECPKG_FLAG_ASCII_BUFFERS: c_ulong = 0x00004000; +pub const SECPKG_FLAG_FRAGMENT: c_ulong = 0x00008000; +pub const SECPKG_FLAG_MUTUAL_AUTH: c_ulong = 0x00010000; +pub const SECPKG_FLAG_DELEGATION: c_ulong = 0x00020000; +pub const SECPKG_FLAG_READONLY_WITH_CHECKSUM: c_ulong = 0x00040000; +pub const SECPKG_FLAG_RESTRICTED_TOKENS: c_ulong = 0x00080000; +pub const SECPKG_FLAG_NEGO_EXTENDER: c_ulong = 0x00100000; +pub const SECPKG_FLAG_NEGOTIABLE2: c_ulong = 0x00200000; +pub const SECPKG_FLAG_APPCONTAINER_PASSTHROUGH: c_ulong = 0x00400000; +pub const SECPKG_FLAG_APPCONTAINER_CHECKS: c_ulong = 0x00800000; +pub const SECPKG_ID_NONE: c_ulong = 0xFFFF; +pub const SECPKG_CALLFLAGS_APPCONTAINER: c_ulong = 0x00000001; +pub const SECPKG_CALLFLAGS_APPCONTAINER_AUTHCAPABLE: c_ulong = 0x00000002; +pub const SECPKG_CALLFLAGS_FORCE_SUPPLIED: c_ulong = 0x00000004; +STRUCT!{struct SecBuffer { + cbBuffer: c_ulong, + BufferType: c_ulong, + pvBuffer: *mut c_void, +}} +pub type PSecBuffer = *mut SecBuffer; +STRUCT!{struct SecBufferDesc { + ulVersion: c_ulong, + cBuffers: c_ulong, + pBuffers: PSecBuffer, +}} +pub type PSecBufferDesc = *mut SecBufferDesc; +pub const SECBUFFER_VERSION: c_ulong = 0; +pub const SECBUFFER_EMPTY: c_ulong = 0; +pub const SECBUFFER_DATA: c_ulong = 1; +pub const SECBUFFER_TOKEN: c_ulong = 2; +pub const SECBUFFER_PKG_PARAMS: c_ulong = 3; +pub const SECBUFFER_MISSING: c_ulong = 4; +pub const SECBUFFER_EXTRA: c_ulong = 5; +pub const SECBUFFER_STREAM_TRAILER: c_ulong = 6; +pub const SECBUFFER_STREAM_HEADER: c_ulong = 7; +pub const SECBUFFER_NEGOTIATION_INFO: c_ulong = 8; +pub const SECBUFFER_PADDING: c_ulong = 9; +pub const SECBUFFER_STREAM: c_ulong = 10; +pub const SECBUFFER_MECHLIST: c_ulong = 11; +pub const SECBUFFER_MECHLIST_SIGNATURE: c_ulong = 12; +pub const SECBUFFER_TARGET: c_ulong = 13; +pub const SECBUFFER_CHANNEL_BINDINGS: c_ulong = 14; +pub const SECBUFFER_CHANGE_PASS_RESPONSE: c_ulong = 15; +pub const SECBUFFER_TARGET_HOST: c_ulong = 16; +pub const SECBUFFER_ALERT: c_ulong = 17; +pub const SECBUFFER_APPLICATION_PROTOCOLS: c_ulong = 18; +pub const SECBUFFER_ATTRMASK: c_ulong = 0xF0000000; +pub const SECBUFFER_READONLY: c_ulong = 0x80000000; +pub const SECBUFFER_READONLY_WITH_CHECKSUM: c_ulong = 0x10000000; +pub const SECBUFFER_RESERVED: c_ulong = 0x60000000; +STRUCT!{struct SEC_NEGOTIATION_INFO { + Size: c_ulong, + NameLength: c_ulong, + Name: *mut SEC_WCHAR, + Reserved: *mut c_void, +}} +pub type PSEC_NEGOTIATION_INFO = *mut SEC_NEGOTIATION_INFO; +STRUCT!{struct SEC_CHANNEL_BINDINGS { + dwInitiatorAddrType: c_ulong, + cbInitiatorLength: c_ulong, + dwInitiatorOffset: c_ulong, + dwAcceptorAddrType: c_ulong, + cbAcceptorLength: c_ulong, + dwAcceptorOffset: c_ulong, + cbApplicationDataLength: c_ulong, + dwApplicationDataOffset: c_ulong, +}} +pub type PSEC_CHANNEL_BINDINGS = *mut SEC_CHANNEL_BINDINGS; +ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT { + SecApplicationProtocolNegotiationExt_None, + SecApplicationProtocolNegotiationExt_NPN, + SecApplicationProtocolNegotiationExt_ALPN, +}} +pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT = *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT; +STRUCT!{struct SEC_APPLICATION_PROTOCOL_LIST { + ProtoNegoExt: SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT, + ProtocolListSize: c_ushort, + ProtocolList: [c_uchar; 0], +}} +pub type PSEC_APPLICATION_PROTOCOL_LIST = *mut SEC_APPLICATION_PROTOCOL_LIST; +STRUCT!{struct SEC_APPLICATION_PROTOCOLS { + ProtocolListsSize: c_ulong, + ProtocolLists: [SEC_APPLICATION_PROTOCOL_LIST; 0], +}} +pub type PSEC_APPLICATION_PROTOCOLS = *mut SEC_APPLICATION_PROTOCOLS; +pub const SECURITY_NATIVE_DREP: c_ulong = 0x00000010; +pub const SECURITY_NETWORK_DREP: c_ulong = 0x00000000; +pub const SECPKG_CRED_INBOUND: c_ulong = 0x00000001; +pub const SECPKG_CRED_OUTBOUND: c_ulong = 0x00000002; +pub const SECPKG_CRED_BOTH: c_ulong = 0x00000003; +pub const SECPKG_CRED_DEFAULT: c_ulong = 0x00000004; +pub const SECPKG_CRED_RESERVED: c_ulong = 0xF0000000; +pub const SECPKG_CRED_AUTOLOGON_RESTRICTED: c_ulong = 0x00000010; +pub const SECPKG_CRED_PROCESS_POLICY_ONLY: c_ulong = 0x00000020; +pub const ISC_REQ_DELEGATE: c_ulong = 0x00000001; +pub const ISC_REQ_MUTUAL_AUTH: c_ulong = 0x00000002; +pub const ISC_REQ_REPLAY_DETECT: c_ulong = 0x00000004; +pub const ISC_REQ_SEQUENCE_DETECT: c_ulong = 0x00000008; +pub const ISC_REQ_CONFIDENTIALITY: c_ulong = 0x00000010; +pub const ISC_REQ_USE_SESSION_KEY: c_ulong = 0x00000020; +pub const ISC_REQ_PROMPT_FOR_CREDS: c_ulong = 0x00000040; +pub const ISC_REQ_USE_SUPPLIED_CREDS: c_ulong = 0x00000080; +pub const ISC_REQ_ALLOCATE_MEMORY: c_ulong = 0x00000100; +pub const ISC_REQ_USE_DCE_STYLE: c_ulong = 0x00000200; +pub const ISC_REQ_DATAGRAM: c_ulong = 0x00000400; +pub const ISC_REQ_CONNECTION: c_ulong = 0x00000800; +pub const ISC_REQ_CALL_LEVEL: c_ulong = 0x00001000; +pub const ISC_REQ_FRAGMENT_SUPPLIED: c_ulong = 0x00002000; +pub const ISC_REQ_EXTENDED_ERROR: c_ulong = 0x00004000; +pub const ISC_REQ_STREAM: c_ulong = 0x00008000; +pub const ISC_REQ_INTEGRITY: c_ulong = 0x00010000; +pub const ISC_REQ_IDENTIFY: c_ulong = 0x00020000; +pub const ISC_REQ_NULL_SESSION: c_ulong = 0x00040000; +pub const ISC_REQ_MANUAL_CRED_VALIDATION: c_ulong = 0x00080000; +pub const ISC_REQ_RESERVED1: c_ulong = 0x00100000; +pub const ISC_REQ_FRAGMENT_TO_FIT: c_ulong = 0x00200000; +pub const ISC_REQ_FORWARD_CREDENTIALS: c_ulong = 0x00400000; +pub const ISC_REQ_NO_INTEGRITY: c_ulong = 0x00800000; +pub const ISC_REQ_USE_HTTP_STYLE: c_ulong = 0x01000000; +pub const ISC_REQ_UNVERIFIED_TARGET_NAME: c_ulong = 0x20000000; +pub const ISC_REQ_CONFIDENTIALITY_ONLY: c_ulong = 0x40000000; +pub const ISC_RET_DELEGATE: c_ulong = 0x00000001; +pub const ISC_RET_MUTUAL_AUTH: c_ulong = 0x00000002; +pub const ISC_RET_REPLAY_DETECT: c_ulong = 0x00000004; +pub const ISC_RET_SEQUENCE_DETECT: c_ulong = 0x00000008; +pub const ISC_RET_CONFIDENTIALITY: c_ulong = 0x00000010; +pub const ISC_RET_USE_SESSION_KEY: c_ulong = 0x00000020; +pub const ISC_RET_USED_COLLECTED_CREDS: c_ulong = 0x00000040; +pub const ISC_RET_USED_SUPPLIED_CREDS: c_ulong = 0x00000080; +pub const ISC_RET_ALLOCATED_MEMORY: c_ulong = 0x00000100; +pub const ISC_RET_USED_DCE_STYLE: c_ulong = 0x00000200; +pub const ISC_RET_DATAGRAM: c_ulong = 0x00000400; +pub const ISC_RET_CONNECTION: c_ulong = 0x00000800; +pub const ISC_RET_INTERMEDIATE_RETURN: c_ulong = 0x00001000; +pub const ISC_RET_CALL_LEVEL: c_ulong = 0x00002000; +pub const ISC_RET_EXTENDED_ERROR: c_ulong = 0x00004000; +pub const ISC_RET_STREAM: c_ulong = 0x00008000; +pub const ISC_RET_INTEGRITY: c_ulong = 0x00010000; +pub const ISC_RET_IDENTIFY: c_ulong = 0x00020000; +pub const ISC_RET_NULL_SESSION: c_ulong = 0x00040000; +pub const ISC_RET_MANUAL_CRED_VALIDATION: c_ulong = 0x00080000; +pub const ISC_RET_RESERVED1: c_ulong = 0x00100000; +pub const ISC_RET_FRAGMENT_ONLY: c_ulong = 0x00200000; +pub const ISC_RET_FORWARD_CREDENTIALS: c_ulong = 0x00400000; +pub const ISC_RET_USED_HTTP_STYLE: c_ulong = 0x01000000; +pub const ISC_RET_NO_ADDITIONAL_TOKEN: c_ulong = 0x02000000; +pub const ISC_RET_REAUTHENTICATION: c_ulong = 0x08000000; +pub const ISC_RET_CONFIDENTIALITY_ONLY: c_ulong = 0x40000000; +pub const ASC_REQ_DELEGATE: c_ulong = 0x00000001; +pub const ASC_REQ_MUTUAL_AUTH: c_ulong = 0x00000002; +pub const ASC_REQ_REPLAY_DETECT: c_ulong = 0x00000004; +pub const ASC_REQ_SEQUENCE_DETECT: c_ulong = 0x00000008; +pub const ASC_REQ_CONFIDENTIALITY: c_ulong = 0x00000010; +pub const ASC_REQ_USE_SESSION_KEY: c_ulong = 0x00000020; +pub const ASC_REQ_SESSION_TICKET: c_ulong = 0x00000040; +pub const ASC_REQ_ALLOCATE_MEMORY: c_ulong = 0x00000100; +pub const ASC_REQ_USE_DCE_STYLE: c_ulong = 0x00000200; +pub const ASC_REQ_DATAGRAM: c_ulong = 0x00000400; +pub const ASC_REQ_CONNECTION: c_ulong = 0x00000800; +pub const ASC_REQ_CALL_LEVEL: c_ulong = 0x00001000; +pub const ASC_REQ_EXTENDED_ERROR: c_ulong = 0x00008000; +pub const ASC_REQ_STREAM: c_ulong = 0x00010000; +pub const ASC_REQ_INTEGRITY: c_ulong = 0x00020000; +pub const ASC_REQ_LICENSING: c_ulong = 0x00040000; +pub const ASC_REQ_IDENTIFY: c_ulong = 0x00080000; +pub const ASC_REQ_ALLOW_NULL_SESSION: c_ulong = 0x00100000; +pub const ASC_REQ_ALLOW_NON_USER_LOGONS: c_ulong = 0x00200000; +pub const ASC_REQ_ALLOW_CONTEXT_REPLAY: c_ulong = 0x00400000; +pub const ASC_REQ_FRAGMENT_TO_FIT: c_ulong = 0x00800000; +pub const ASC_REQ_FRAGMENT_SUPPLIED: c_ulong = 0x00002000; +pub const ASC_REQ_NO_TOKEN: c_ulong = 0x01000000; +pub const ASC_REQ_PROXY_BINDINGS: c_ulong = 0x04000000; +pub const ASC_REQ_ALLOW_MISSING_BINDINGS: c_ulong = 0x10000000; +pub const ASC_RET_DELEGATE: c_ulong = 0x00000001; +pub const ASC_RET_MUTUAL_AUTH: c_ulong = 0x00000002; +pub const ASC_RET_REPLAY_DETECT: c_ulong = 0x00000004; +pub const ASC_RET_SEQUENCE_DETECT: c_ulong = 0x00000008; +pub const ASC_RET_CONFIDENTIALITY: c_ulong = 0x00000010; +pub const ASC_RET_USE_SESSION_KEY: c_ulong = 0x00000020; +pub const ASC_RET_SESSION_TICKET: c_ulong = 0x00000040; +pub const ASC_RET_ALLOCATED_MEMORY: c_ulong = 0x00000100; +pub const ASC_RET_USED_DCE_STYLE: c_ulong = 0x00000200; +pub const ASC_RET_DATAGRAM: c_ulong = 0x00000400; +pub const ASC_RET_CONNECTION: c_ulong = 0x00000800; +pub const ASC_RET_CALL_LEVEL: c_ulong = 0x00002000; +pub const ASC_RET_THIRD_LEG_FAILED: c_ulong = 0x00004000; +pub const ASC_RET_EXTENDED_ERROR: c_ulong = 0x00008000; +pub const ASC_RET_STREAM: c_ulong = 0x00010000; +pub const ASC_RET_INTEGRITY: c_ulong = 0x00020000; +pub const ASC_RET_LICENSING: c_ulong = 0x00040000; +pub const ASC_RET_IDENTIFY: c_ulong = 0x00080000; +pub const ASC_RET_NULL_SESSION: c_ulong = 0x00100000; +pub const ASC_RET_ALLOW_NON_USER_LOGONS: c_ulong = 0x00200000; +pub const ASC_RET_ALLOW_CONTEXT_REPLAY: c_ulong = 0x00400000; +pub const ASC_RET_FRAGMENT_ONLY: c_ulong = 0x00800000; +pub const ASC_RET_NO_TOKEN: c_ulong = 0x01000000; +pub const ASC_RET_NO_ADDITIONAL_TOKEN: c_ulong = 0x02000000; +pub const SECPKG_CRED_ATTR_NAMES: c_ulong = 1; +pub const SECPKG_CRED_ATTR_SSI_PROVIDER: c_ulong = 2; +pub const SECPKG_CRED_ATTR_KDC_PROXY_SETTINGS: c_ulong = 3; +pub const SECPKG_CRED_ATTR_CERT: c_ulong = 4; +STRUCT!{struct SecPkgCredentials_NamesW { + sUserName: *mut SEC_WCHAR, +}} +pub type PSecPkgCredentials_NamesW = *mut SecPkgCredentials_NamesW; +STRUCT!{struct SecPkgCredentials_NamesA { + sUserName: *mut SEC_CHAR, +}} +pub type PSecPkgCredentials_NamesA = *mut SecPkgCredentials_NamesA; +STRUCT!{struct SecPkgCredentials_SSIProviderW { + sProviderName: *mut SEC_WCHAR, + ProviderInfoLength: c_ulong, + ProviderInfo: *mut c_char, +}} +pub type PSecPkgCredentials_SSIProviderW = *mut SecPkgCredentials_SSIProviderW; +STRUCT!{struct SecPkgCredentials_SSIProviderA { + sProviderName: *mut SEC_CHAR, + ProviderInfoLength: c_ulong, + ProviderInfo: *mut c_char, +}} +pub type PSecPkgCredentials_SSIProviderA = *mut SecPkgCredentials_SSIProviderA; +pub const KDC_PROXY_SETTINGS_V1: ULONG = 1; +pub const KDC_PROXY_SETTINGS_FLAGS_FORCEPROXY: ULONG = 0x1; +STRUCT!{struct SecPkgCredentials_KdcProxySettingsW { + Version: ULONG, + Flags: ULONG, + ProxyServerOffset: USHORT, + ProxyServerLength: USHORT, + ClientTlsCredOffset: USHORT, + ClientTlsCredLength: USHORT, +}} +pub type PSecPkgCredentials_KdcProxySettingsW = *mut SecPkgCredentials_KdcProxySettingsW; +STRUCT!{struct SecPkgCredentials_Cert { + EncodedCertSize: c_ulong, + EncodedCert: *mut c_uchar, +}} +pub type PSecPkgCredentials_Cert = *mut SecPkgCredentials_Cert; +pub const SECPKG_ATTR_SIZES: c_ulong = 0; +pub const SECPKG_ATTR_NAMES: c_ulong = 1; +pub const SECPKG_ATTR_LIFESPAN: c_ulong = 2; +pub const SECPKG_ATTR_DCE_INFO: c_ulong = 3; +pub const SECPKG_ATTR_STREAM_SIZES: c_ulong = 4; +pub const SECPKG_ATTR_KEY_INFO: c_ulong = 5; +pub const SECPKG_ATTR_AUTHORITY: c_ulong = 6; +pub const SECPKG_ATTR_PROTO_INFO: c_ulong = 7; +pub const SECPKG_ATTR_PASSWORD_EXPIRY: c_ulong = 8; +pub const SECPKG_ATTR_SESSION_KEY: c_ulong = 9; +pub const SECPKG_ATTR_PACKAGE_INFO: c_ulong = 10; +pub const SECPKG_ATTR_USER_FLAGS: c_ulong = 11; +pub const SECPKG_ATTR_NEGOTIATION_INFO: c_ulong = 12; +pub const SECPKG_ATTR_NATIVE_NAMES: c_ulong = 13; +pub const SECPKG_ATTR_FLAGS: c_ulong = 14; +pub const SECPKG_ATTR_USE_VALIDATED: c_ulong = 15; +pub const SECPKG_ATTR_CREDENTIAL_NAME: c_ulong = 16; +pub const SECPKG_ATTR_TARGET_INFORMATION: c_ulong = 17; +pub const SECPKG_ATTR_ACCESS_TOKEN: c_ulong = 18; +pub const SECPKG_ATTR_TARGET: c_ulong = 19; +pub const SECPKG_ATTR_AUTHENTICATION_ID: c_ulong = 20; +pub const SECPKG_ATTR_LOGOFF_TIME: c_ulong = 21; +pub const SECPKG_ATTR_NEGO_KEYS: c_ulong = 22; +pub const SECPKG_ATTR_PROMPTING_NEEDED: c_ulong = 24; +pub const SECPKG_ATTR_UNIQUE_BINDINGS: c_ulong = 25; +pub const SECPKG_ATTR_ENDPOINT_BINDINGS: c_ulong = 26; +pub const SECPKG_ATTR_CLIENT_SPECIFIED_TARGET: c_ulong = 27; +pub const SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS: c_ulong = 30; +pub const SECPKG_ATTR_NEGO_PKG_INFO: c_ulong = 31; +pub const SECPKG_ATTR_NEGO_STATUS: c_ulong = 32; +pub const SECPKG_ATTR_CONTEXT_DELETED: c_ulong = 33; +pub const SECPKG_ATTR_DTLS_MTU: c_ulong = 34; +pub const SECPKG_ATTR_DATAGRAM_SIZES: c_ulong = SECPKG_ATTR_STREAM_SIZES; +pub const SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES: c_ulong = 128; +pub const SECPKG_ATTR_APPLICATION_PROTOCOL: c_ulong = 35; +STRUCT!{struct SecPkgContext_SubjectAttributes { + AttributeInfo: *mut c_void, +}} +pub type PSecPkgContext_SubjectAttributes = *mut SecPkgContext_SubjectAttributes; +pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS: c_ulong = 0x1; +pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM: c_ulong = 0x2; +ENUM!{enum SECPKG_CRED_CLASS { + SecPkgCredClass_None = 0, + SecPkgCredClass_Ephemeral = 10, + SecPkgCredClass_PersistedGeneric = 20, + SecPkgCredClass_PersistedSpecific = 30, + SecPkgCredClass_Explicit = 40, +}} +pub type PSECPKG_CRED_CLASS = *mut SECPKG_CRED_CLASS; +STRUCT!{struct SecPkgContext_CredInfo { + CredClass: SECPKG_CRED_CLASS, + IsPromptingNeeded: c_ulong, +}} +pub type PSecPkgContext_CredInfo = *mut SecPkgContext_CredInfo; +STRUCT!{struct SecPkgContext_NegoPackageInfo { + PackageMask: c_ulong, +}} +pub type PSecPkgContext_NegoPackageInfo = *mut SecPkgContext_NegoPackageInfo; +STRUCT!{struct SecPkgContext_NegoStatus { + LastStatus: c_ulong, +}} +pub type PSecPkgContext_NegoStatus = *mut SecPkgContext_NegoStatus; +STRUCT!{struct SecPkgContext_Sizes { + cbMaxToken: c_ulong, + cbMaxSignature: c_ulong, + cbBlockSize: c_ulong, + cbSecurityTrailer: c_ulong, +}} +pub type PSecPkgContext_Sizes = *mut SecPkgContext_Sizes; +STRUCT!{struct SecPkgContext_StreamSizes { + cbHeader: c_ulong, + cbTrailer: c_ulong, + cbMaximumMessage: c_ulong, + cBuffers: c_ulong, + cbBlockSize: c_ulong, +}} +pub type PSecPkgContext_StreamSizes = *mut SecPkgContext_StreamSizes; +pub type SecPkgContext_DatagramSizes = SecPkgContext_StreamSizes; +pub type PSecPkgContext_DatagramSizes = PSecPkgContext_StreamSizes; +STRUCT!{struct SecPkgContext_NamesW { + sUserName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_NamesW = *mut SecPkgContext_NamesW; +ENUM!{enum SECPKG_ATTR_LCT_STATUS { + SecPkgAttrLastClientTokenYes, + SecPkgAttrLastClientTokenNo, + SecPkgAttrLastClientTokenMaybe, +}} +pub type PSECPKG_ATTR_LCT_STATUS = *mut SECPKG_ATTR_LCT_STATUS; +STRUCT!{struct SecPkgContext_LastClientTokenStatus { + LastClientTokenStatus: SECPKG_ATTR_LCT_STATUS, +}} +pub type PSecPkgContext_LastClientTokenStatus = *mut SecPkgContext_LastClientTokenStatus; +STRUCT!{struct SecPkgContext_NamesA { + sUserName: *mut SEC_CHAR, +}} +pub type PSecPkgContext_NamesA = *mut SecPkgContext_NamesA; +STRUCT!{struct SecPkgContext_Lifespan { + tsStart: TimeStamp, + tsExpiry: TimeStamp, +}} +pub type PSecPkgContext_Lifespan = *mut SecPkgContext_Lifespan; +STRUCT!{struct SecPkgContext_DceInfo { + AuthzSvc: c_ulong, + pPac: *mut c_void, +}} +pub type PSecPkgContext_DceInfo = *mut SecPkgContext_DceInfo; +STRUCT!{struct SecPkgContext_KeyInfoA { + sSignatureAlgorithmName: *mut SEC_CHAR, + sEncryptAlgorithmName: *mut SEC_CHAR, + KeySize: c_ulong, + SignatureAlgorithm: c_ulong, + EncryptAlgorithm: c_ulong, +}} +pub type PSecPkgContext_KeyInfoA = *mut SecPkgContext_KeyInfoA; +STRUCT!{struct SecPkgContext_KeyInfoW { + sSignatureAlgorithmName: *mut SEC_WCHAR, + sEncryptAlgorithmName: *mut SEC_WCHAR, + KeySize: c_ulong, + SignatureAlgorithm: c_ulong, + EncryptAlgorithm: c_ulong, +}} +pub type PSecPkgContext_KeyInfoW = *mut SecPkgContext_KeyInfoW; +STRUCT!{struct SecPkgContext_AuthorityA { + sAuthorityName: *mut SEC_CHAR, +}} +pub type PSecPkgContext_AuthorityA = *mut SecPkgContext_AuthorityA; +STRUCT!{struct SecPkgContext_AuthorityW { + sAuthorityName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_AuthorityW = *mut SecPkgContext_AuthorityW; +STRUCT!{struct SecPkgContext_ProtoInfoA { + sProtocolName: *mut SEC_CHAR, + majorVersion: c_ulong, + minorVersion: c_ulong, +}} +pub type PSecPkgContext_ProtoInfoA = *mut SecPkgContext_ProtoInfoA; +STRUCT!{struct SecPkgContext_ProtoInfoW { + sProtocolName: *mut SEC_WCHAR, + majorVersion: c_ulong, + minorVersion: c_ulong, +}} +pub type PSecPkgContext_ProtoInfoW = *mut SecPkgContext_ProtoInfoW; +STRUCT!{struct SecPkgContext_PasswordExpiry { + tsPasswordExpires: TimeStamp, +}} +pub type PSecPkgContext_PasswordExpiry = *mut SecPkgContext_PasswordExpiry; +STRUCT!{struct SecPkgContext_LogoffTime { + tsLogoffTime: TimeStamp, +}} +pub type PSecPkgContext_LogoffTime = *mut SecPkgContext_LogoffTime; +STRUCT!{struct SecPkgContext_SessionKey { + SessionKeyLength: c_ulong, + SessionKey: *mut c_uchar, +}} +pub type PSecPkgContext_SessionKey = *mut SecPkgContext_SessionKey; +STRUCT!{struct SecPkgContext_NegoKeys { + KeyType: c_ulong, + KeyLength: c_ushort, + KeyValue: *mut c_uchar, + VerifyKeyType: c_ulong, + VerifyKeyLength: c_ushort, + VerifyKeyValue: *mut c_uchar, +}} +pub type PSecPkgContext_NegoKeys = *mut SecPkgContext_NegoKeys; +STRUCT!{struct SecPkgContext_PackageInfoW { + PackageInfo: PSecPkgInfoW, +}} +pub type PSecPkgContext_PackageInfoW = *mut SecPkgContext_PackageInfoW; +STRUCT!{struct SecPkgContext_PackageInfoA { + PackageInfo: PSecPkgInfoA, +}} +pub type PSecPkgContext_PackageInfoA = *mut SecPkgContext_PackageInfoA; +STRUCT!{struct SecPkgContext_UserFlags { + UserFlags: c_ulong, +}} +pub type PSecPkgContext_UserFlags = *mut SecPkgContext_UserFlags; +STRUCT!{struct SecPkgContext_Flags { + Flags: c_ulong, +}} +pub type PSecPkgContext_Flags = *mut SecPkgContext_Flags; +STRUCT!{struct SecPkgContext_NegotiationInfoA { + PackageInfo: PSecPkgInfoA, + NegotiationState: c_ulong, +}} +pub type PSecPkgContext_NegotiationInfoA = *mut SecPkgContext_NegotiationInfoA; +STRUCT!{struct SecPkgContext_NegotiationInfoW { + PackageInfo: PSecPkgInfoW, + NegotiationState: c_ulong, +}} +pub type PSecPkgContext_NegotiationInfoW = *mut SecPkgContext_NegotiationInfoW; +pub const SECPKG_NEGOTIATION_COMPLETE: c_ulong = 0; +pub const SECPKG_NEGOTIATION_OPTIMISTIC: c_ulong = 1; +pub const SECPKG_NEGOTIATION_IN_PROGRESS: c_ulong = 2; +pub const SECPKG_NEGOTIATION_DIRECT: c_ulong = 3; +pub const SECPKG_NEGOTIATION_TRY_MULTICRED: c_ulong = 4; +STRUCT!{struct SecPkgContext_NativeNamesW { + sClientName: SEC_WCHAR, + sServerName: SEC_WCHAR, +}} +pub type PSecPkgContext_NativeNamesW = *mut SecPkgContext_NativeNamesW; +STRUCT!{struct SecPkgContext_NativeNamesA { + sClientName: SEC_CHAR, + sServerName: SEC_CHAR, +}} +pub type PSecPkgContext_NativeNamesA = *mut SecPkgContext_NativeNamesA; +STRUCT!{struct SecPkgContext_CredentialNameW { + CredentialType: c_ulong, + sCredentialName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_CredentialNameW = *mut SecPkgContext_CredentialNameW; +STRUCT!{struct SecPkgContext_CredentialNameA { + CredentialType: c_ulong, + sCredentialName: *mut SEC_CHAR, +}} +pub type PSecPkgContext_CredentialNameA = *mut SecPkgContext_CredentialNameA; +STRUCT!{struct SecPkgContext_AccessToken { + AccessToken: *mut c_void, +}} +pub type PSecPkgContext_AccessToken = *mut SecPkgContext_AccessToken; +STRUCT!{struct SecPkgContext_TargetInformation { + MarshalledTargetInfoLength: c_ulong, + MarshalledTargetInfo: *mut c_uchar, +}} +pub type PSecPkgContext_TargetInformation = *mut SecPkgContext_TargetInformation; +STRUCT!{struct SecPkgContext_AuthzID { + AuthzIDLength: c_ulong, + AuthzID: *mut c_char, +}} +pub type PSecPkgContext_AuthzID = *mut SecPkgContext_AuthzID; +STRUCT!{struct SecPkgContext_Target { + TargetLength: c_ulong, + Target: *mut c_char, +}} +pub type PSecPkgContext_Target = *mut SecPkgContext_Target; +STRUCT!{struct SecPkgContext_ClientSpecifiedTarget { + sTargetName: *mut SEC_WCHAR, +}} +pub type PSecPkgContext_ClientSpecifiedTarget = *mut SecPkgContext_ClientSpecifiedTarget; +STRUCT!{struct SecPkgContext_Bindings { + BindingsLength: c_ulong, + Bindings: *mut SEC_CHANNEL_BINDINGS, +}} +pub type PSecPkgContext_Bindings = *mut SecPkgContext_Bindings; +ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS { + SecApplicationProtocolNegotiationStatus_None, + SecApplicationProtocolNegotiationStatus_Success, + SecApplicationProtocolNegotiationStatus_SelectedClientOnly, +}} +pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS = + *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS; +pub const MAX_PROTOCOL_ID_SIZE: usize = 0xff; +STRUCT!{struct SecPkgContext_ApplicationProtocol { + ProtoNegoStatus: SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS, + ProtoNegoExt: SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT, + ProtocolIdSize: c_uchar, + ProtocolId: [c_uchar; MAX_PROTOCOL_ID_SIZE], +}} +pub type PSecPkgContext_ApplicationProtocol = *mut SecPkgContext_ApplicationProtocol; +FN!{stdcall SEC_GET_KEY_FN( + Arg: *mut c_void, + Principal: *mut c_void, + KeyVer: c_ulong, + Key: *mut *mut c_void, + Status: *mut SECURITY_STATUS, +) -> ()} +pub const SECPKG_CONTEXT_EXPORT_RESET_NEW: c_ulong = 0x00000001; +pub const SECPKG_CONTEXT_EXPORT_DELETE_OLD: c_ulong = 0x00000002; +pub const SECPKG_CONTEXT_EXPORT_TO_KERNEL: c_ulong = 0x00000004; +extern "system" { + pub fn AcquireCredentialsHandleW( + pszPrincipal: LPWSTR, + pszPackage: LPWSTR, + fCredentialUse: c_ulong, + pvLogonId: *mut c_void, + pAuthData: *mut c_void, + pGetKeyFn: SEC_GET_KEY_FN, + pvGetKeyArgument: *mut c_void, + phCredential: PCredHandle, + ptsExpiry: PTimeStamp, + ) -> SECURITY_STATUS; +} +FN!{stdcall ACQUIRE_CREDENTIALS_HANDLE_FN_W( + *mut SEC_WCHAR, + *mut SEC_WCHAR, + c_ulong, + *mut c_void, + *mut c_void, + SEC_GET_KEY_FN, + *mut c_void, + PCredHandle, + PTimeStamp, +) -> SECURITY_STATUS} +extern "system" { + pub fn AcquireCredentialsHandleA( + pszPrincipal: LPSTR, + pszPackage: LPSTR, + fCredentialUse: c_ulong, + pvLogonId: *mut c_void, + pAuthData: *mut c_void, + pGetKeyFn: SEC_GET_KEY_FN, + pvGetKeyArgument: *mut c_void, + phCredential: PCredHandle, + ptsExpiry: PTimeStamp, + ) -> SECURITY_STATUS; +} +FN!{stdcall ACQUIRE_CREDENTIALS_HANDLE_FN_A( + *mut SEC_CHAR, + *mut SEC_CHAR, + c_ulong, + *mut c_void, + *mut c_void, + SEC_GET_KEY_FN, + *mut c_void, + PCredHandle, + PTimeStamp, +) -> SECURITY_STATUS} +extern "system" { + pub fn FreeCredentialsHandle( + phCredential: PCredHandle, + ) -> SECURITY_STATUS; +} +FN!{stdcall FREE_CREDENTIALS_HANDLE_FN( + PCredHandle, +) -> SECURITY_STATUS} +extern "system" { + pub fn AddCredentialsW( + hCredentials: PCredHandle, + pszPrincipal: LPWSTR, + pszPackage: LPWSTR, + fCredentialUse: c_ulong, + pAuthData: *mut c_void, + pGetKeyFn: SEC_GET_KEY_FN, + pvGetKeyArgument: *mut c_void, + ptsExpiry: PTimeStamp, + ) -> SECURITY_STATUS; +} +FN!{stdcall ADD_CREDENTIALS_FN_W( + PCredHandle, + *mut SEC_WCHAR, + *mut SEC_WCHAR, + c_ulong, + *mut c_void, + SEC_GET_KEY_FN, + *mut c_void, + PTimeStamp, +) -> SECURITY_STATUS} +extern "system" { + pub fn AddCredentialsA( + hCredentials: PCredHandle, + pszPrincipal: LPSTR, + pszPackage: LPSTR, + fCredentialUse: c_ulong, + pAuthData: *mut c_void, + pGetKeyFn: SEC_GET_KEY_FN, + pvGetKeyArgument: *mut c_void, + ptsExpiry: PTimeStamp, + ) -> SECURITY_STATUS; +} +FN!{stdcall ADD_CREDENTIALS_FN_A( + PCredHandle, + *mut SEC_CHAR, + *mut SEC_CHAR, + c_ulong, + *mut c_void, + SEC_GET_KEY_FN, + *mut c_void, + PTimeStamp, +) -> SECURITY_STATUS} +extern "system" { + // pub fn spiCreateAsyncContext(); + // pub fn SspiFreeAsyncContext(); + // pub fn SspiReinitAsyncContext(); + // pub fn SspiSetAsyncNotifyCallback(); + // pub fn SspiAsyncContextRequiresNotify(); + // pub fn SspiGetAsyncCallStatus(); + // pub fn SspiAcquireCredentialsHandleAsyncW(); + // pub fn SspiAcquireCredentialsHandleAsyncA(); + // pub fn SspiInitializeSecurityContextAsyncW(); + // pub fn SspiInitializeSecurityContextAsyncA(); + // pub fn SspiAcceptSecurityContextAsync(); + // pub fn SspiFreeCredentialsHandleAsync(); + // pub fn SspiDeleteSecurityContextAsync(); + pub fn ChangeAccountPasswordW( + pszPackageName: *mut SEC_WCHAR, + pszDomainName: *mut SEC_WCHAR, + pszAccountName: *mut SEC_WCHAR, + pszOldPassword: *mut SEC_WCHAR, + pszNewPassword: *mut SEC_WCHAR, + bImpersonating: BOOLEAN, + dwReserved: c_ulong, + pOutput: PSecBufferDesc, + ) -> SECURITY_STATUS; +} +FN!{stdcall CHANGE_PASSWORD_FN_W( + *mut SEC_WCHAR, + *mut SEC_WCHAR, + *mut SEC_WCHAR, + *mut SEC_WCHAR, + *mut SEC_WCHAR, + BOOLEAN, + c_ulong, + PSecBufferDesc, +) -> SECURITY_STATUS} +extern "system" { + pub fn ChangeAccountPasswordA( + pszPackageName: *mut SEC_CHAR, + pszDomainName: *mut SEC_CHAR, + pszAccountName: *mut SEC_CHAR, + pszOldPassword: *mut SEC_CHAR, + pszNewPassword: *mut SEC_CHAR, + bImpersonating: BOOLEAN, + dwReserved: c_ulong, + pOutput: PSecBufferDesc, + ) -> SECURITY_STATUS; +} +FN!{stdcall CHANGE_PASSWORD_FN_A( + *mut SEC_CHAR, + *mut SEC_CHAR, + *mut SEC_CHAR, + *mut SEC_CHAR, + *mut SEC_CHAR, + BOOLEAN, + c_ulong, + PSecBufferDesc, +) -> SECURITY_STATUS} +extern "system" { + pub fn InitializeSecurityContextW( + phCredential: PCredHandle, + phContext: PCtxtHandle, + pszTargetName: *mut SEC_WCHAR, + fContextReq: c_ulong, + Reserved1: c_ulong, + TargetDataRep: c_ulong, + pInput: PSecBufferDesc, + Reserved2: c_ulong, + phNewContext: PCtxtHandle, + pOutput: PSecBufferDesc, + pfContextAttr: *mut c_ulong, + ptsExpiry: PTimeStamp, + ) -> SECURITY_STATUS; +} +// INITIALIZE_SECURITY_CONTEXT_FN_W +extern "system" { + pub fn InitializeSecurityContextA( + phCredential: PCredHandle, + phContext: PCtxtHandle, + pszTargetName: *mut SEC_CHAR, + fContextReq: c_ulong, + Reserved1: c_ulong, + TargetDataRep: c_ulong, + pInput: PSecBufferDesc, + Reserved2: c_ulong, + phNewContext: PCtxtHandle, + pOutput: PSecBufferDesc, + pfContextAttr: *mut c_ulong, + ptsExpiry: PTimeStamp, + ) -> SECURITY_STATUS; + pub fn AcceptSecurityContext( + phCredential: PCredHandle, + phContext: PCtxtHandle, + pInput: PSecBufferDesc, + fContextReq: c_ulong, + TargetDataRep: c_ulong, + phNewContext: PCtxtHandle, + pOutput: PSecBufferDesc, + pfContextAttr: *mut c_ulong, + ptsExpiry: PTimeStamp, + ) -> SECURITY_STATUS; + pub fn CompleteAuthToken( + phContext: PCtxtHandle, + pToken: PSecBufferDesc, + ) -> SECURITY_STATUS; + pub fn ImpersonateSecurityContext( + phContext: PCtxtHandle, + ) -> SECURITY_STATUS; + pub fn RevertSecurityContext( + phContext: PCtxtHandle, + ) -> SECURITY_STATUS; + pub fn QuerySecurityContextToken( + phContext: PCtxtHandle, + Token: *mut *mut c_void, + ) -> SECURITY_STATUS; + pub fn DeleteSecurityContext( + phContext: PCtxtHandle, + ) -> SECURITY_STATUS; + pub fn ApplyControlToken( + phContext: PCtxtHandle, + pInput: PSecBufferDesc, + ) -> SECURITY_STATUS; + pub fn QueryContextAttributesW( + phContext: PCtxtHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + ) -> SECURITY_STATUS; + // pub fn QueryContextAttributesExW(); + pub fn QueryContextAttributesA( + phContext: PCtxtHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + ) -> SECURITY_STATUS; + // pub fn QueryContextAttributesExA(); + pub fn SetContextAttributesW( + phContext: PCtxtHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + cbBuffer: c_ulong, + ) -> SECURITY_STATUS; + pub fn SetContextAttributesA( + phContext: PCtxtHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + cbBuffer: c_ulong, + ) -> SECURITY_STATUS; + pub fn QueryCredentialsAttributesW( + phCredential: PCredHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + ) -> SECURITY_STATUS; + // pub fn QueryCredentialsAttributesExW(); + pub fn QueryCredentialsAttributesA( + phCredential: PCredHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + ) -> SECURITY_STATUS; + // pub fn QueryCredentialsAttributesExA(); + pub fn SetCredentialsAttributesW( + phCredential: PCredHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + cbBuffer: c_ulong, + ) -> SECURITY_STATUS; + pub fn SetCredentialsAttributesA( + phCredential: PCredHandle, + ulAttribute: c_ulong, + pBuffer: *mut c_void, + cbBuffer: c_ulong, + ) -> SECURITY_STATUS; + pub fn FreeContextBuffer( + pvContextBuffer: PVOID, + ) -> SECURITY_STATUS; + pub fn MakeSignature( + phContext: PCtxtHandle, + fQOP: c_ulong, + pMessage: PSecBufferDesc, + MessageSeqNo: c_ulong, + ) -> SECURITY_STATUS; + pub fn VerifySignature( + phContext: PCtxtHandle, + pMessage: PSecBufferDesc, + MessageSeqNo: c_ulong, + pfQOP: *mut c_ulong, + ) -> SECURITY_STATUS; + pub fn EncryptMessage( + phContext: PCtxtHandle, + fQOP: c_ulong, + pMessage: PSecBufferDesc, + MessageSeqNo: c_ulong, + ) -> SECURITY_STATUS; + pub fn DecryptMessage( + phContext: PCtxtHandle, + pMessage: PSecBufferDesc, + MessageSeqNo: c_ulong, + pfQOP: *mut c_ulong, + ) -> SECURITY_STATUS; + pub fn EnumerateSecurityPackagesW( + pcPackages: *mut c_ulong, + ppPackageInfo: *mut PSecPkgInfoW, + ) -> SECURITY_STATUS; + pub fn EnumerateSecurityPackagesA( + pcPackages: *mut c_ulong, + ppPackageInfo: *mut PSecPkgInfoA, + ) -> SECURITY_STATUS; + pub fn QuerySecurityPackageInfoW( + pszPackageName: LPWSTR, + ppPackageInfo: *mut PSecPkgInfoW, + ) -> SECURITY_STATUS; + pub fn QuerySecurityPackageInfoA( + pszPackageName: LPSTR, + ppPackageInfo: *mut PSecPkgInfoA, + ) -> SECURITY_STATUS; +} +ENUM!{enum SecDelegationType { + SecFull, + SecService, + SecTree, + SecDirectory, + SecObject, +}} +pub type PSecDelegationType = *mut SecDelegationType; +extern "system" { + // pub fn DelegateSecurityContext(); + pub fn ExportSecurityContext( + phContext: PCtxtHandle, + fFlags: ULONG, + pPackedContext: PSecBuffer, + pToken: *mut *mut c_void, + ) -> SECURITY_STATUS; + pub fn ImportSecurityContextW( + pszPackage: LPWSTR, + pPackedContext: PSecBuffer, + Token: *mut c_void, + phContext: PCtxtHandle, + ) -> SECURITY_STATUS; + pub fn ImportSecurityContextA( + pszPackage: LPSTR, + pPackedContext: PSecBuffer, + Token: *mut c_void, + phContext: PCtxtHandle, + ) -> SECURITY_STATUS; +// pub fn SecMakeSPN(); +// pub fn SecMakeSPNEx(); +// pub fn SecMakeSPNEx2(); +// pub fn SecLookupAccountSid(); +// pub fn SecLookupAccountName(); +// pub fn SecLookupWellKnownSid(); +} +extern "system" { + // pub fn InitSecurityInterfaceA(); + // pub fn InitSecurityInterfaceW(); + // pub fn SaslEnumerateProfilesA(); + // pub fn SaslEnumerateProfilesW(); + // pub fn SaslGetProfilePackageA(); + // pub fn SaslGetProfilePackageW(); + // pub fn SaslIdentifyPackageA(); + // pub fn SaslIdentifyPackageW(); + // pub fn SaslInitializeSecurityContextW(); + // pub fn SaslInitializeSecurityContextA(); + // pub fn SaslAcceptSecurityContext(); + // pub fn SaslSetContextOption(); + // pub fn SaslGetContextOption(); +} +pub type PSEC_WINNT_AUTH_IDENTITY_OPAQUE = PVOID; +extern "system" { + pub fn SspiPromptForCredentialsW( + pszTargetName: PCWSTR, + pUiInfo: PCREDUI_INFOW, + dwAuthError: c_ulong, + pszPackage: PCWSTR, + pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE, + ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE, + pfSave: *mut c_int, + dwFlags: c_ulong, + ) -> c_ulong; + pub fn SspiPromptForCredentialsA( + pszTargetName: PCSTR, + pUiInfo: PCREDUI_INFOA, + dwAuthError: c_ulong, + pszPackage: PCSTR, + pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE, + ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE, + pfSave: *mut c_int, + dwFlags: c_ulong, + ) -> c_ulong; +} +STRUCT!{struct SEC_WINNT_AUTH_BYTE_VECTOR { + ByteArrayOffset: c_ulong, + ByteArrayLength: c_ushort, +}} +pub type PSEC_WINNT_AUTH_BYTE_VECTOR = *mut SEC_WINNT_AUTH_BYTE_VECTOR; +STRUCT!{struct SEC_WINNT_AUTH_DATA { + CredType: GUID, + CredData: SEC_WINNT_AUTH_BYTE_VECTOR, +}} +pub type PSEC_WINNT_AUTH_DATA = *mut SEC_WINNT_AUTH_DATA; +STRUCT!{struct SEC_WINNT_AUTH_PACKED_CREDENTIALS { + cbHeaderLength: c_ushort, + cbStructureLength: c_ushort, + AuthData: SEC_WINNT_AUTH_DATA, +}} +pub type PSEC_WINNT_AUTH_PACKED_CREDENTIALS = *mut SEC_WINNT_AUTH_PACKED_CREDENTIALS; +DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_PASSWORD, + 0x28bfc32f, 0x10f6, 0x4738, 0x98, 0xd1, 0x1a, 0xc0, 0x61, 0xdf, 0x71, 0x6a); +DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_CERT, + 0x235f69ad, 0x73fb, 0x4dbc, 0x82, 0x3, 0x6, 0x29, 0xe7, 0x39, 0x33, 0x9b); +STRUCT!{struct SEC_WINNT_AUTH_DATA_PASSWORD { + UnicodePassword: SEC_WINNT_AUTH_BYTE_VECTOR, +}} +pub type PSEC_WINNT_AUTH_DATA_PASSWORD = *mut SEC_WINNT_AUTH_DATA_PASSWORD; +DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_CSP_DATA, + 0x68fd9879, 0x79c, 0x4dfe, 0x82, 0x81, 0x57, 0x8a, 0xad, 0xc1, 0xc1, 0x0); +// GUID SEC_WINNT_AUTH_DATA_TYPE_SMARTCARD_CONTEXTS +STRUCT!{struct SEC_WINNT_AUTH_CERTIFICATE_DATA { + cbHeaderLength: c_ushort, + cbStructureLength: c_ushort, + Certificate: SEC_WINNT_AUTH_BYTE_VECTOR, +}} +pub type PSEC_WINNT_AUTH_CERTIFICATE_DATA = *mut SEC_WINNT_AUTH_CERTIFICATE_DATA; +STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT_VECTOR { + CredUIContextArrayOffset: ULONG, + CredUIContextCount: USHORT, +}} +pub type PSEC_WINNT_CREDUI_CONTEXT_VECTOR = *mut SEC_WINNT_CREDUI_CONTEXT_VECTOR; +STRUCT!{struct SEC_WINNT_AUTH_SHORT_VECTOR { + ShortArrayOffset: ULONG, + ShortArrayCount: USHORT, +}} +pub type PSEC_WINNT_AUTH_SHORT_VECTOR = *mut SEC_WINNT_AUTH_SHORT_VECTOR; +extern "system" { + pub fn SspiGetCredUIContext( + ContextHandle: HANDLE, + CredType: *mut GUID, + LogonId: *mut LUID, + CredUIContexts: *mut PSEC_WINNT_CREDUI_CONTEXT_VECTOR, + TokenHandle: *mut HANDLE, + ) -> SECURITY_STATUS; + pub fn SspiUpdateCredentials( + ContextHandle: HANDLE, + CredType: *mut GUID, + FlatCredUIContextLength: ULONG, + FlatCredUIContext: PUCHAR, + ) -> SECURITY_STATUS; +} +STRUCT!{struct CREDUIWIN_MARSHALED_CONTEXT { + StructureType: GUID, + cbHeaderLength: USHORT, + LogonId: LUID, + MarshaledDataType: GUID, + MarshaledDataOffset: ULONG, + MarshaledDataLength: USHORT, +}} +pub type PCREDUIWIN_MARSHALED_CONTEXT = *mut CREDUIWIN_MARSHALED_CONTEXT; +STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT { + cbHeaderLength: USHORT, + CredUIContextHandle: HANDLE, + UIInfo: PCREDUI_INFOW, + dwAuthError: ULONG, + pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE, + TargetName: PUNICODE_STRING, +}} +pub type PSEC_WINNT_CREDUI_CONTEXT = *mut SEC_WINNT_CREDUI_CONTEXT; +// GUID CREDUIWIN_STRUCTURE_TYPE_SSPIPFC +// GUID SSPIPFC_STRUCTURE_TYPE_CREDUI_CONTEXT +extern "system" { + pub fn SspiUnmarshalCredUIContext( + MarshaledCredUIContext: PUCHAR, + MarshaledCredUIContextLength: ULONG, + CredUIContext: *mut PSEC_WINNT_CREDUI_CONTEXT, + ) -> SECURITY_STATUS; + // pub fn SspiPrepareForCredRead(); + // pub fn SspiPrepareForCredWrite(); + // pub fn SspiEncryptAuthIdentity(); + // pub fn SspiEncryptAuthIdentityEx(); + // pub fn SspiDecryptAuthIdentity(); + // pub fn SspiDecryptAuthIdentityEx(); + // pub fn SspiIsAuthIdentityEncrypted(); + // pub fn SspiEncodeAuthIdentityAsStrings(); + // pub fn SspiValidateAuthIdentity(); + // pub fn SspiCopyAuthIdentity(); + // pub fn SspiFreeAuthIdentity(); + // pub fn SspiZeroAuthIdentity(); + // pub fn SspiLocalFree(); + // pub fn SspiEncodeStringsAsAuthIdentity(); + // pub fn SspiCompareAuthIdentities(); + // pub fn SspiMarshalAuthIdentity(); + // pub fn SspiUnmarshalAuthIdentity(); + pub fn SspiIsPromptingNeeded( + ErrorOrNtStatus: c_ulong, + ) -> BOOLEAN; + // pub fn SspiGetTargetHostName(); + // pub fn SspiExcludePackage(); + // pub fn AddSecurityPackageA(); + // pub fn AddSecurityPackageW(); + // pub fn DeleteSecurityPackageA(); + // pub fn DeleteSecurityPackageW(); +} diff --git a/src/vendor/winapi/src/shared/stralign.rs b/src/vendor/winapi/src/shared/stralign.rs new file mode 100644 index 0000000000..8ef3b1d6d4 --- /dev/null +++ b/src/vendor/winapi/src/shared/stralign.rs @@ -0,0 +1,41 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_int; +use um::winnt::{LPCUWSTR, PCUWSTR, PUWSTR, WCHAR}; +use vc::vcruntime::size_t; +extern "system" { + pub fn uaw_lstrcmpW( + String1: PCUWSTR, + String2: PCUWSTR, + ) -> c_int; + pub fn uaw_lstrcmpiW( + String1: PCUWSTR, + String2: PCUWSTR, + ) -> c_int; + pub fn uaw_lstrlenW( + String: LPCUWSTR, + ) -> c_int; + pub fn uaw_wcschr( + String: PCUWSTR, + Character: WCHAR, + ) -> PUWSTR; + pub fn uaw_wcscpy( + Destination: PUWSTR, + Source: PCUWSTR, + ) -> PUWSTR; + pub fn uaw_wcsicmp( + String1: PCUWSTR, + String2: PCUWSTR, + ) -> c_int; + pub fn uaw_wcslen( + String: PCUWSTR, + ) -> size_t; + pub fn uaw_wcsrchr( + String: PCUWSTR, + Character: WCHAR, + ) -> PUWSTR; +} diff --git a/src/vendor/winapi/src/shared/usb.rs b/src/vendor/winapi/src/shared/usb.rs new file mode 100644 index 0000000000..8538d7fb17 --- /dev/null +++ b/src/vendor/winapi/src/shared/usb.rs @@ -0,0 +1,524 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! USB Definitions. +use shared::minwindef::{UCHAR, ULONG, USHORT}; +use shared::usbspec::{ + PUSB_CONFIGURATION_DESCRIPTOR, USB_DEVICE_DESCRIPTOR, USB_ENDPOINT_DIRECTION_MASK, +}; +use um::winnt::{LONG, PVOID, WCHAR}; +pub type PRIP = PVOID; +pub type PMDL = PVOID; +pub const USBDI_VERSION: ULONG = 0x00000600; +pub const USB_PORTATTR_NO_CONNECTOR: ULONG = 0x00000001; +pub const USB_PORTATTR_SHARED_USB2: ULONG = 0x00000002; +pub const USB_PORTATTR_MINI_CONNECTOR: ULONG = 0x00000004; +pub const USB_PORTATTR_OEM_CONNECTOR: ULONG = 0x00000008; +pub const USB_PORTATTR_OWNED_BY_CC: ULONG = 0x01000000; +pub const USB_PORTATTR_NO_OVERCURRENT_UI: ULONG = 0x02000000; +ENUM!{enum USB_CONTROLLER_FLAVOR { + USB_HcGeneric = 0, + OHCI_Generic = 100, + OHCI_Hydra, + OHCI_NEC, + UHCI_Generic = 200, + UHCI_Piix4 = 201, + UHCI_Piix3 = 202, + UHCI_Ich2 = 203, + UHCI_Reserved204 = 204, + UHCI_Ich1 = 205, + UHCI_Ich3m = 206, + UHCI_Ich4 = 207, + UHCI_Ich5 = 208, + UHCI_Ich6 = 209, + UHCI_Intel = 249, + UHCI_VIA = 250, + UHCI_VIA_x01 = 251, + UHCI_VIA_x02 = 252, + UHCI_VIA_x03 = 253, + UHCI_VIA_x04 = 254, + UHCI_VIA_x0E_FIFO = 264, + EHCI_Generic = 1000, + EHCI_NEC = 2000, + EHCI_Lucent = 3000, + EHCI_NVIDIA_Tegra2 = 4000, + EHCI_NVIDIA_Tegra3 = 4001, + EHCI_Intel_Medfield = 5001, +}} +pub const USB_DEFAULT_DEVICE_ADDRESS: UCHAR = 0; +pub const USB_DEFAULT_ENDPOINT_ADDRESS: UCHAR = 0; +pub const USB_DEFAULT_MAX_PACKET: USHORT = 64; +pub const URB_FUNCTION_SELECT_CONFIGURATION: USHORT = 0x0000; +pub const URB_FUNCTION_SELECT_INTERFACE: USHORT = 0x0001; +pub const URB_FUNCTION_ABORT_PIPE: USHORT = 0x0002; +pub const URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL: USHORT = 0x0003; +pub const URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL: USHORT = 0x0004; +pub const URB_FUNCTION_GET_FRAME_LENGTH: USHORT = 0x0005; +pub const URB_FUNCTION_SET_FRAME_LENGTH: USHORT = 0x0006; +pub const URB_FUNCTION_GET_CURRENT_FRAME_NUMBER: USHORT = 0x0007; +pub const URB_FUNCTION_CONTROL_TRANSFER: USHORT = 0x0008; +pub const URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: USHORT = 0x0009; +pub const URB_FUNCTION_ISOCH_TRANSFER: USHORT = 0x000A; +pub const URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE: USHORT = 0x000B; +pub const URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE: USHORT = 0x000C; +pub const URB_FUNCTION_SET_FEATURE_TO_DEVICE: USHORT = 0x000D; +pub const URB_FUNCTION_SET_FEATURE_TO_INTERFACE: USHORT = 0x000E; +pub const URB_FUNCTION_SET_FEATURE_TO_ENDPOINT: USHORT = 0x000F; +pub const URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE: USHORT = 0x0010; +pub const URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE: USHORT = 0x0011; +pub const URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT: USHORT = 0x0012; +pub const URB_FUNCTION_GET_STATUS_FROM_DEVICE: USHORT = 0x0013; +pub const URB_FUNCTION_GET_STATUS_FROM_INTERFACE: USHORT = 0x0014; +pub const URB_FUNCTION_GET_STATUS_FROM_ENDPOINT: USHORT = 0x0015; +pub const URB_FUNCTION_RESERVED_0X0016: USHORT = 0x0016; +pub const URB_FUNCTION_VENDOR_DEVICE: USHORT = 0x0017; +pub const URB_FUNCTION_VENDOR_INTERFACE: USHORT = 0x0018; +pub const URB_FUNCTION_VENDOR_ENDPOINT: USHORT = 0x0019; +pub const URB_FUNCTION_CLASS_DEVICE: USHORT = 0x001A; +pub const URB_FUNCTION_CLASS_INTERFACE: USHORT = 0x001B; +pub const URB_FUNCTION_CLASS_ENDPOINT: USHORT = 0x001C; +pub const URB_FUNCTION_RESERVE_0X001D: USHORT = 0x001D; +pub const URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL: USHORT = 0x001E; +pub const URB_FUNCTION_CLASS_OTHER: USHORT = 0x001F; +pub const URB_FUNCTION_VENDOR_OTHER: USHORT = 0x0020; +pub const URB_FUNCTION_GET_STATUS_FROM_OTHER: USHORT = 0x0021; +pub const URB_FUNCTION_CLEAR_FEATURE_TO_OTHER: USHORT = 0x0022; +pub const URB_FUNCTION_SET_FEATURE_TO_OTHER: USHORT = 0x0023; +pub const URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT: USHORT = 0x0024; +pub const URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT: USHORT = 0x0025; +pub const URB_FUNCTION_GET_CONFIGURATION: USHORT = 0x0026; +pub const URB_FUNCTION_GET_INTERFACE: USHORT = 0x0027; +pub const URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE: USHORT = 0x0028; +pub const URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE: USHORT = 0x0029; +pub const URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR: USHORT = 0x002A; +pub const URB_FUNCTION_SYNC_RESET_PIPE: USHORT = 0x0030; +pub const URB_FUNCTION_SYNC_CLEAR_STALL: USHORT = 0x0031; +pub const URB_FUNCTION_CONTROL_TRANSFER_EX: USHORT = 0x0032; +pub const URB_FUNCTION_RESERVE_0X0033: USHORT = 0x0033; +pub const URB_FUNCTION_RESERVE_0X0034: USHORT = 0x0034; +pub const URB_FUNCTION_OPEN_STATIC_STREAMS: USHORT = 0x0035; +pub const URB_FUNCTION_CLOSE_STATIC_STREAMS: USHORT = 0x0036; +pub const URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER_USING_CHAINED_MDL: USHORT = 0x0037; +pub const URB_FUNCTION_ISOCH_TRANSFER_USING_CHAINED_MDL: USHORT = 0x0038; +pub const URB_FUNCTION_RESERVE_0X002B: USHORT = 0x002B; +pub const URB_FUNCTION_RESERVE_0X002C: USHORT = 0x002C; +pub const URB_FUNCTION_RESERVE_0X002D: USHORT = 0x002D; +pub const URB_FUNCTION_RESERVE_0X002E: USHORT = 0x002E; +pub const URB_FUNCTION_RESERVE_0X002F: USHORT = 0x002F; +pub const URB_FUNCTION_RESET_PIPE: USHORT = URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL; +pub const USBD_SHORT_TRANSFER_OK: ULONG = 0x00000002; +pub const USBD_START_ISO_TRANSFER_ASAP: ULONG = 0x00000004; +pub const USBD_DEFAULT_PIPE_TRANSFER: ULONG = 0x00000008; +pub const USBD_TRANSFER_DIRECTION_OUT: ULONG = 0; +pub const USBD_TRANSFER_DIRECTION_IN: ULONG = 1; +pub const USBD_TRANSFER_DIRECTION: ULONG = USBD_TRANSFER_DIRECTION_IN; +#[inline] +pub fn USBD_TRANSFER_DIRECTION_FLAG(flags: ULONG) -> ULONG { + flags & USBD_TRANSFER_DIRECTION +} +pub const VALID_TRANSFER_FLAGS_MASK: ULONG = USBD_SHORT_TRANSFER_OK | USBD_TRANSFER_DIRECTION + | USBD_START_ISO_TRANSFER_ASAP | USBD_DEFAULT_PIPE_TRANSFER; +pub const USBD_ISO_START_FRAME_RANGE: ULONG = 1024; +pub type USBD_STATUS = LONG; +#[inline] +pub fn USBD_SUCCESS(Status: USBD_STATUS) -> bool { + Status >= 0 +} +#[inline] +pub fn USBD_PENDING(Status: ULONG) -> bool { + (Status >> 30) == 1 +} +pub const USBD_STATUS_SUCCESS: USBD_STATUS = 0x00000000; +pub const USBD_STATUS_PORT_OPERATION_PENDING: USBD_STATUS = 0x00000001; +pub const USBD_STATUS_PENDING: USBD_STATUS = 0x40000000; +pub const USBD_STATUS_CRC: USBD_STATUS = 0xC0000001; +pub const USBD_STATUS_BTSTUFF: USBD_STATUS = 0xC0000002; +pub const USBD_STATUS_DATA_TOGGLE_MISMATCH: USBD_STATUS = 0xC0000003; +pub const USBD_STATUS_STALL_PID: USBD_STATUS = 0xC0000004; +pub const USBD_STATUS_DEV_NOT_RESPONDING: USBD_STATUS = 0xC0000005; +pub const USBD_STATUS_PID_CHECK_FAILURE: USBD_STATUS = 0xC0000006; +pub const USBD_STATUS_UNEXPECTED_PID: USBD_STATUS = 0xC0000007; +pub const USBD_STATUS_DATA_OVERRUN: USBD_STATUS = 0xC0000008; +pub const USBD_STATUS_DATA_UNDERRUN: USBD_STATUS = 0xC0000009; +pub const USBD_STATUS_RESERVED1: USBD_STATUS = 0xC000000A; +pub const USBD_STATUS_RESERVED2: USBD_STATUS = 0xC000000B; +pub const USBD_STATUS_BUFFER_OVERRUN: USBD_STATUS = 0xC000000C; +pub const USBD_STATUS_BUFFER_UNDERRUN: USBD_STATUS = 0xC000000D; +pub const USBD_STATUS_NOT_ACCESSED: USBD_STATUS = 0xC000000F; +pub const USBD_STATUS_FIFO: USBD_STATUS = 0xC0000010; +pub const USBD_STATUS_XACT_ERROR: USBD_STATUS = 0xC0000011; +pub const USBD_STATUS_BABBLE_DETECTED: USBD_STATUS = 0xC0000012; +pub const USBD_STATUS_DATA_BUFFER_ERROR: USBD_STATUS = 0xC0000013; +pub const USBD_STATUS_NO_PING_RESPONSE: USBD_STATUS = 0xC0000014; +pub const USBD_STATUS_INVALID_STREAM_TYPE: USBD_STATUS = 0xC0000015; +pub const USBD_STATUS_INVALID_STREAM_ID: USBD_STATUS = 0xC0000016; +pub const USBD_STATUS_ENDPOINT_HALTED: USBD_STATUS = 0xC0000030; +pub const USBD_STATUS_INVALID_URB_FUNCTION: USBD_STATUS = 0x80000200; +pub const USBD_STATUS_INVALID_PARAMETER: USBD_STATUS = 0x80000300; +pub const USBD_STATUS_ERROR_BUSY: USBD_STATUS = 0x80000400; +pub const USBD_STATUS_INVALID_PIPE_HANDLE: USBD_STATUS = 0x80000600; +pub const USBD_STATUS_NO_BANDWIDTH: USBD_STATUS = 0x80000700; +pub const USBD_STATUS_INTERNAL_HC_ERROR: USBD_STATUS = 0x80000800; +pub const USBD_STATUS_ERROR_SHORT_TRANSFER: USBD_STATUS = 0x80000900; +pub const USBD_STATUS_BAD_START_FRAME: USBD_STATUS = 0xC0000A00; +pub const USBD_STATUS_ISOCH_REQUEST_FAILED: USBD_STATUS = 0xC0000B00; +pub const USBD_STATUS_FRAME_CONTROL_OWNED: USBD_STATUS = 0xC0000C00; +pub const USBD_STATUS_FRAME_CONTROL_NOT_OWNED: USBD_STATUS = 0xC0000D00; +pub const USBD_STATUS_NOT_SUPPORTED: USBD_STATUS = 0xC0000E00; +pub const USBD_STATUS_INAVLID_CONFIGURATION_DESCRIPTOR: USBD_STATUS = 0xC0000F00; +pub const USBD_STATUS_INVALID_CONFIGURATION_DESCRIPTOR: USBD_STATUS = 0xC0000F00; +pub const USBD_STATUS_INSUFFICIENT_RESOURCES: USBD_STATUS = 0xC0001000; +pub const USBD_STATUS_SET_CONFIG_FAILED: USBD_STATUS = 0xC0002000; +pub const USBD_STATUS_BUFFER_TOO_SMALL: USBD_STATUS = 0xC0003000; +pub const USBD_STATUS_INTERFACE_NOT_FOUND: USBD_STATUS = 0xC0004000; +pub const USBD_STATUS_INAVLID_PIPE_FLAGS: USBD_STATUS = 0xC0005000; +pub const USBD_STATUS_TIMEOUT: USBD_STATUS = 0xC0006000; +pub const USBD_STATUS_DEVICE_GONE: USBD_STATUS = 0xC0007000; +pub const USBD_STATUS_STATUS_NOT_MAPPED: USBD_STATUS = 0xC0008000; +pub const USBD_STATUS_HUB_INTERNAL_ERROR: USBD_STATUS = 0xC0009000; +pub const USBD_STATUS_CANCELED: USBD_STATUS = 0xC0010000; +pub const USBD_STATUS_ISO_NOT_ACCESSED_BY_HW: USBD_STATUS = 0xC0020000; +pub const USBD_STATUS_ISO_TD_ERROR: USBD_STATUS = 0xC0030000; +pub const USBD_STATUS_ISO_NA_LATE_USBPORT: USBD_STATUS = 0xC0040000; +pub const USBD_STATUS_ISO_NOT_ACCESSED_LATE: USBD_STATUS = 0xC0050000; +pub const USBD_STATUS_BAD_DESCRIPTOR: USBD_STATUS = 0xC0100000; +pub const USBD_STATUS_BAD_DESCRIPTOR_BLEN: USBD_STATUS = 0xC0100001; +pub const USBD_STATUS_BAD_DESCRIPTOR_TYPE: USBD_STATUS = 0xC0100002; +pub const USBD_STATUS_BAD_INTERFACE_DESCRIPTOR: USBD_STATUS = 0xC0100003; +pub const USBD_STATUS_BAD_ENDPOINT_DESCRIPTOR: USBD_STATUS = 0xC0100004; +pub const USBD_STATUS_BAD_INTERFACE_ASSOC_DESCRIPTOR: USBD_STATUS = 0xC0100005; +pub const USBD_STATUS_BAD_CONFIG_DESC_LENGTH: USBD_STATUS = 0xC0100006; +pub const USBD_STATUS_BAD_NUMBER_OF_INTERFACES: USBD_STATUS = 0xC0100007; +pub const USBD_STATUS_BAD_NUMBER_OF_ENDPOINTS: USBD_STATUS = 0xC0100008; +pub const USBD_STATUS_BAD_ENDPOINT_ADDRESS: USBD_STATUS = 0xC0100009; +pub type USBD_PIPE_HANDLE = PVOID; +pub type USBD_CONFIGURATION_HANDLE = PVOID; +pub type USBD_INTERFACE_HANDLE = PVOID; +pub const USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE: ULONG = 0xFFFFFFFF; +STRUCT!{struct USBD_VERSION_INFORMATION { + USBDI_Version: ULONG, + Supported_USB_Version: ULONG, +}} +pub type PUSBD_VERSION_INFORMATION = *mut USBD_VERSION_INFORMATION; +ENUM!{enum USBD_PIPE_TYPE { + UsbdPipeTypeControl, + UsbdPipeTypeIsochronous, + UsbdPipeTypeBulk, + UsbdPipeTypeInterrupt, +}} +#[inline] +pub fn USBD_PIPE_DIRECTION_IN(pipeInformation: &USBD_PIPE_INFORMATION) -> UCHAR { + pipeInformation.EndpointAddress & USB_ENDPOINT_DIRECTION_MASK +} +STRUCT!{struct USBD_DEVICE_INFORMATION { + OffsetNext: ULONG, + UsbdDeviceHandle: PVOID, + DeviceDescriptor: USB_DEVICE_DESCRIPTOR, +}} +pub type PUSBD_DEVICE_INFORMATION = *mut USBD_DEVICE_INFORMATION; +STRUCT!{struct USBD_PIPE_INFORMATION { + MaximumPacketSize: USHORT, + EndpointAddress: UCHAR, + Interval: UCHAR, + PipeType: USBD_PIPE_TYPE, + PipeHandle: USBD_PIPE_HANDLE, + MaximumTransferSize: ULONG, + PipeFlags: ULONG, +}} +pub type PUSBD_PIPE_INFORMATION = *mut USBD_PIPE_INFORMATION; +pub const USBD_PF_CHANGE_MAX_PACKET: ULONG = 0x00000001; +pub const USBD_PF_SHORT_PACKET_OPT: ULONG = 0x00000002; +pub const USBD_PF_ENABLE_RT_THREAD_ACCESS: ULONG = 0x00000004; +pub const USBD_PF_MAP_ADD_TRANSFERS: ULONG = 0x00000008; +pub const USBD_PF_VALID_MASK: ULONG = USBD_PF_CHANGE_MAX_PACKET | USBD_PF_SHORT_PACKET_OPT + | USBD_PF_ENABLE_RT_THREAD_ACCESS | USBD_PF_MAP_ADD_TRANSFERS; +STRUCT!{struct USBD_INTERFACE_INFORMATION { + Length: USHORT, + InterfaceNumber: UCHAR, + AlternateSetting: UCHAR, + Class: UCHAR, + SubClass: UCHAR, + Protocol: UCHAR, + Reserved: UCHAR, + InterfaceHandle: USBD_INTERFACE_HANDLE, + NumberOfPipes: ULONG, + Pipes: [USBD_PIPE_INFORMATION; 1], +}} +pub type PUSBD_INTERFACE_INFORMATION = *mut USBD_INTERFACE_INFORMATION; +STRUCT!{struct URB_HCD_AREA { + Reserved8: [PVOID; 8], +}} +STRUCT!{struct URB_HEADER { + Length: USHORT, + Function: USHORT, + Status: USBD_STATUS, + UsbdDeviceHandle: PVOID, + UsbdFlags: ULONG, +}} +STRUCT!{struct URB_SELECT_INTERFACE { + Hdr: URB_HEADER, + ConfigurationHandle: USBD_CONFIGURATION_HANDLE, + Interface: USBD_INTERFACE_INFORMATION, +}} +STRUCT!{struct URB_SELECT_CONFIGURATION { + Hdr: URB_HEADER, + ConfigurationDescriptor: PUSB_CONFIGURATION_DESCRIPTOR, + ConfigurationHandle: USBD_CONFIGURATION_HANDLE, + Interface: USBD_INTERFACE_INFORMATION, +}} +STRUCT!{struct URB_PIPE_REQUEST { + Hdr: URB_HEADER, + PipeHandle: USBD_PIPE_HANDLE, + Reserved: ULONG, +}} +STRUCT!{struct URB_FRAME_LENGTH_CONTROL { + Hdr: URB_HEADER, +}} +STRUCT!{struct URB_GET_FRAME_LENGTH { + Hdr: URB_HEADER, + FrameLength: ULONG, + FrameNumber: ULONG, +}} +STRUCT!{struct URB_SET_FRAME_LENGTH { + Hdr: URB_HEADER, + FrameLengthDelta: LONG, +}} +STRUCT!{struct URB_GET_CURRENT_FRAME_NUMBER { + Hdr: URB_HEADER, + FrameNumber: ULONG, +}} +STRUCT!{struct URB_CONTROL_DESCRIPTOR_REQUEST { + Hdr: URB_HEADER, + Reserved: PVOID, + Reserved0: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + Reserved1: USHORT, + Index: UCHAR, + DescriptorType: UCHAR, + LanguageId: USHORT, + Reserved2: USHORT, +}} +STRUCT!{struct URB_CONTROL_GET_STATUS_REQUEST { + Hdr: URB_HEADER, + Reserved: PVOID, + Reserved0: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + Reserved1: [UCHAR; 4], + Index: USHORT, + Reserved2: USHORT, +}} +STRUCT!{struct URB_CONTROL_FEATURE_REQUEST { + Hdr: URB_HEADER, + Reserved: PVOID, + Reserved2: ULONG, + Reserved3: ULONG, + Reserved4: PVOID, + Reserved5: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + Reserved0: USHORT, + FeatureSelector: USHORT, + Index: USHORT, + Reserved1: USHORT, +}} +STRUCT!{struct URB_CONTROL_VENDOR_OR_CLASS_REQUEST { + Hdr: URB_HEADER, + Reserved: PVOID, + TransferFlags: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + RequestTypeReservedBits: UCHAR, + Request: UCHAR, + Value: USHORT, + Index: USHORT, + Reserved1: USHORT, +}} +STRUCT!{struct URB_CONTROL_GET_INTERFACE_REQUEST { + Hdr: URB_HEADER, + Reserved: PVOID, + Reserved0: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + Reserved1: [UCHAR; 4], + Interface: USHORT, + Reserved2: USHORT, +}} +STRUCT!{struct URB_CONTROL_GET_CONFIGURATION_REQUEST { + Hdr: URB_HEADER, + Reserved: PVOID, + Reserved0: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + Reserved1: [UCHAR; 8], +}} +pub const OS_STRING_DESCRIPTOR_INDEX: UCHAR = 0xEE; +pub const MS_GENRE_DESCRIPTOR_INDEX: USHORT = 0x0001; +pub const MS_POWER_DESCRIPTOR_INDEX: USHORT = 0x0002; +pub const MS_OS_STRING_SIGNATURE: &'static str = "MSFT100"; +pub const MS_OS_FLAGS_CONTAINERID: UCHAR = 0x02; +UNION!{union OS_STRING_u { + [u8; 1], + bPad bPad_mut: UCHAR, + bFlags bFlags_mut: UCHAR, +}} +STRUCT!{struct OS_STRING { + bLength: UCHAR, + bDescriptorType: UCHAR, + MicrosoftString: [WCHAR; 7], + bVendorCode: UCHAR, + u: OS_STRING_u, +}} +pub type POS_STRING = *mut OS_STRING; +STRUCT!{struct URB_OS_FEATURE_DESCRIPTOR_REQUEST { + Hdr: URB_HEADER, + Reserved: PVOID, + Reserved0: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + BitField: UCHAR, + Reserved2: UCHAR, + InterfaceNumber: UCHAR, + MS_PageIndex: UCHAR, + MS_FeatureDescriptorIndex: USHORT, + Reserved3: USHORT, +}} +BITFIELD!{URB_OS_FEATURE_DESCRIPTOR_REQUEST BitField: UCHAR [ + Recipient set_Recipient[0..5], + Reserved1 set_Reserved1[5..8], +]} +STRUCT!{struct URB_CONTROL_TRANSFER { + Hdr: URB_HEADER, + PipeHandle: USBD_PIPE_HANDLE, + TransferFlags: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + SetupPacket: [UCHAR; 8], +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct URB_CONTROL_TRANSFER_EX { + Hdr: URB_HEADER, + PipeHandle: USBD_PIPE_HANDLE, + TransferFlags: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + Timeout: ULONG, + Pad: ULONG, + hca: URB_HCD_AREA, + SetupPacket: [UCHAR; 8], +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct URB_CONTROL_TRANSFER_EX { + Hdr: URB_HEADER, + PipeHandle: USBD_PIPE_HANDLE, + TransferFlags: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + Timeout: ULONG, + hca: URB_HCD_AREA, + SetupPacket: [UCHAR; 8], +}} +STRUCT!{struct URB_BULK_OR_INTERRUPT_TRANSFER { + Hdr: URB_HEADER, + PipeHandle: USBD_PIPE_HANDLE, + TransferFlags: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, +}} +STRUCT!{struct USBD_ISO_PACKET_DESCRIPTOR { + Offset: ULONG, + Length: ULONG, + Status: USBD_STATUS, +}} +pub type PUSBD_ISO_PACKET_DESCRIPTOR = *mut USBD_ISO_PACKET_DESCRIPTOR; +STRUCT!{struct URB_ISOCH_TRANSFER { + Hdr: URB_HEADER, + PipeHandle: USBD_PIPE_HANDLE, + TransferFlags: ULONG, + TransferBufferLength: ULONG, + TransferBuffer: PVOID, + TransferBufferMDL: PMDL, + UrbLink: *mut URB, + hca: URB_HCD_AREA, + StartFrame: ULONG, + NumberOfPackets: ULONG, + ErrorCount: ULONG, + IsoPacket: [USBD_ISO_PACKET_DESCRIPTOR; 1], +}} +pub const URB_OPEN_STATIC_STREAMS_VERSION_100: USHORT = 0x100; +STRUCT!{struct USBD_STREAM_INFORMATION { + PipeHandle: USBD_PIPE_HANDLE, + StreamID: ULONG, + MaximumTransferSize: ULONG, + PipeFlags: ULONG, +}} +pub type PUSBD_STREAM_INFORMATION = *mut USBD_STREAM_INFORMATION; +STRUCT!{struct URB_OPEN_STATIC_STREAMS { + Hdr: URB_HEADER, + PipeHandle: USBD_PIPE_HANDLE, + NumberOfStreams: ULONG, + StreamInfoVersion: USHORT, + StreamInfoSize: USHORT, + Streams: PUSBD_STREAM_INFORMATION, +}} +UNION!{union URB_u { + [u32; 24] [u64; 19], + UrbHeader UrbHeader_mut: URB_HEADER, + UrbSelectInterface UrbSelectInterface_mut: URB_SELECT_INTERFACE, + UrbSelectConfiguration UrbSelectConfiguration_mut: URB_SELECT_CONFIGURATION, + UrbPipeRequest UrbPipeRequest_mut: URB_PIPE_REQUEST, + UrbFrameLengthControl UrbFrameLengthControl_mut: URB_FRAME_LENGTH_CONTROL, + UrbGetFrameLength UrbGetFrameLength_mut: URB_GET_FRAME_LENGTH, + UrbSetFrameLength UrbSetFrameLength_mut: URB_SET_FRAME_LENGTH, + UrbGetCurrentFrameNumber UrbGetCurrentFrameNumber_mut: URB_GET_CURRENT_FRAME_NUMBER, + UrbControlTransfer UrbControlTransfer_mut: URB_CONTROL_TRANSFER, + UrbControlTransferEx UrbControlTransferEx_mut: URB_CONTROL_TRANSFER_EX, + UrbBulkOrInterruptTransfer UrbBulkOrInterruptTransfer_mut: URB_BULK_OR_INTERRUPT_TRANSFER, + UrbIsochronousTransfer UrbIsochronousTransfer_mut: URB_ISOCH_TRANSFER, + UrbControlDescriptorRequest UrbControlDescriptorRequest_mut: URB_CONTROL_DESCRIPTOR_REQUEST, + UrbControlGetStatusRequest UrbControlGetStatusRequest_mut: URB_CONTROL_GET_STATUS_REQUEST, + UrbControlFeatureRequest UrbControlFeatureRequest_mut: URB_CONTROL_FEATURE_REQUEST, + UrbControlVendorClassRequest UrbControlVendorClassRequest_mut: + URB_CONTROL_VENDOR_OR_CLASS_REQUEST, + UrbControlGetInterfaceRequest UrbControlGetInterfaceRequest_mut: + URB_CONTROL_GET_INTERFACE_REQUEST, + UrbControlGetConfigurationRequest UrbControlGetConfigurationRequest_mut: + URB_CONTROL_GET_CONFIGURATION_REQUEST, + UrbOSFeatureDescriptorRequest UrbOSFeatureDescriptorRequest_mut: + URB_OS_FEATURE_DESCRIPTOR_REQUEST, + UrbOpenStaticStreams UrbOpenStaticStreams_mut: URB_OPEN_STATIC_STREAMS, +}} +STRUCT!{struct URB { + u: URB_u, +}} +pub type PURB = *mut URB; diff --git a/src/vendor/winapi/src/shared/usbiodef.rs b/src/vendor/winapi/src/shared/usbiodef.rs new file mode 100644 index 0000000000..b314e03148 --- /dev/null +++ b/src/vendor/winapi/src/shared/usbiodef.rs @@ -0,0 +1,113 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! Common header file for all USB IOCTLs defined for +//! the core stack. We define them in this single header file +//! so that we can maintain backward compatibilty with older +//! versions of the stack. +use shared::guiddef::GUID; +use shared::minwindef::ULONG; +use um::winioctl::{FILE_ANY_ACCESS, FILE_DEVICE_UNKNOWN, METHOD_BUFFERED, METHOD_NEITHER}; +use um::winnt::PVOID; +pub const USB_SUBMIT_URB: ULONG = 0; +pub const USB_RESET_PORT: ULONG = 1; +pub const USB_GET_ROOTHUB_PDO: ULONG = 3; +pub const USB_GET_PORT_STATUS: ULONG = 4; +pub const USB_ENABLE_PORT: ULONG = 5; +pub const USB_GET_HUB_COUNT: ULONG = 6; +pub const USB_CYCLE_PORT: ULONG = 7; +pub const USB_GET_HUB_NAME: ULONG = 8; +pub const USB_IDLE_NOTIFICATION: ULONG = 9; +pub const USB_RECORD_FAILURE: ULONG = 10; +pub const USB_GET_BUS_INFO: ULONG = 264; +pub const USB_GET_CONTROLLER_NAME: ULONG = 265; +pub const USB_GET_BUSGUID_INFO: ULONG = 266; +pub const USB_GET_PARENT_HUB_INFO: ULONG = 267; +pub const USB_GET_DEVICE_HANDLE: ULONG = 268; +pub const USB_GET_DEVICE_HANDLE_EX: ULONG = 269; +pub const USB_GET_TT_DEVICE_HANDLE: ULONG = 270; +pub const USB_GET_TOPOLOGY_ADDRESS: ULONG = 271; +pub const USB_IDLE_NOTIFICATION_EX: ULONG = 272; +pub const USB_REQ_GLOBAL_SUSPEND: ULONG = 273; +pub const USB_REQ_GLOBAL_RESUME: ULONG = 274; +pub const USB_GET_HUB_CONFIG_INFO: ULONG = 275; +pub const USB_FAIL_GET_STATUS: ULONG = 280; +pub const USB_REGISTER_COMPOSITE_DEVICE: ULONG = 0; +pub const USB_UNREGISTER_COMPOSITE_DEVICE: ULONG = 1; +pub const USB_REQUEST_REMOTE_WAKE_NOTIFICATION: ULONG = 2; +pub const HCD_GET_STATS_1: ULONG = 255; +pub const HCD_DIAGNOSTIC_MODE_ON: ULONG = 256; +pub const HCD_DIAGNOSTIC_MODE_OFF: ULONG = 257; +pub const HCD_GET_ROOT_HUB_NAME: ULONG = 258; +pub const HCD_GET_DRIVERKEY_NAME: ULONG = 265; +pub const HCD_GET_STATS_2: ULONG = 266; +pub const HCD_DISABLE_PORT: ULONG = 268; +pub const HCD_ENABLE_PORT: ULONG = 269; +pub const HCD_USER_REQUEST: ULONG = 270; +pub const HCD_TRACE_READ_REQUEST: ULONG = 275; +pub const USB_GET_NODE_INFORMATION: ULONG = 258; +pub const USB_GET_NODE_CONNECTION_INFORMATION: ULONG = 259; +pub const USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION: ULONG = 260; +pub const USB_GET_NODE_CONNECTION_NAME: ULONG = 261; +pub const USB_DIAG_IGNORE_HUBS_ON: ULONG = 262; +pub const USB_DIAG_IGNORE_HUBS_OFF: ULONG = 263; +pub const USB_GET_NODE_CONNECTION_DRIVERKEY_NAME: ULONG = 264; +pub const USB_GET_HUB_CAPABILITIES: ULONG = 271; +pub const USB_GET_NODE_CONNECTION_ATTRIBUTES: ULONG = 272; +pub const USB_HUB_CYCLE_PORT: ULONG = 273; +pub const USB_GET_NODE_CONNECTION_INFORMATION_EX: ULONG = 274; +pub const USB_RESET_HUB: ULONG = 275; +pub const USB_GET_HUB_CAPABILITIES_EX: ULONG = 276; +pub const USB_GET_HUB_INFORMATION_EX: ULONG = 277; +pub const USB_GET_PORT_CONNECTOR_PROPERTIES: ULONG = 278; +pub const USB_GET_NODE_CONNECTION_INFORMATION_EX_V2: ULONG = 279; +DEFINE_GUID!{GUID_DEVINTERFACE_USB_HUB, + 0xf18a0e88, 0xc30c, 0x11d0, 0x88, 0x15, 0x00, 0xa0, 0xc9, 0x06, 0xbe, 0xd8} +DEFINE_GUID!{GUID_DEVINTERFACE_USB_DEVICE, + 0xA5DCBF10, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED} +DEFINE_GUID!{GUID_DEVINTERFACE_USB_HOST_CONTROLLER, + 0x3abf6f2d, 0x71c4, 0x462a, 0x8a, 0x92, 0x1e, 0x68, 0x61, 0xe6, 0xaf, 0x27} +DEFINE_GUID!{GUID_USB_WMI_STD_DATA, + 0x4E623B20, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2} +DEFINE_GUID!{GUID_USB_WMI_STD_NOTIFICATION, + 0x4E623B20, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2} +DEFINE_GUID!{GUID_USB_WMI_DEVICE_PERF_INFO, + 0x66c1aa3c, 0x499f, 0x49a0, 0xa9, 0xa5, 0x61, 0xe2, 0x35, 0x9f, 0x64, 0x7} +DEFINE_GUID!{GUID_USB_WMI_NODE_INFO, + 0x9c179357, 0xdc7a, 0x4f41, 0xb6, 0x6b, 0x32, 0x3b, 0x9d, 0xdc, 0xb5, 0xb1} +DEFINE_GUID!{GUID_USB_WMI_TRACING, + 0x3a61881b, 0xb4e6, 0x4bf9, 0xae, 0xf, 0x3c, 0xd8, 0xf3, 0x94, 0xe5, 0x2f} +DEFINE_GUID!{GUID_USB_TRANSFER_TRACING, + 0x681eb8aa, 0x403d, 0x452c, 0x9f, 0x8a, 0xf0, 0x61, 0x6f, 0xac, 0x95, 0x40} +DEFINE_GUID!{GUID_USB_PERFORMANCE_TRACING, + 0xd5de77a6, 0x6ae9, 0x425c, 0xb1, 0xe2, 0xf5, 0x61, 0x5f, 0xd3, 0x48, 0xa9} +DEFINE_GUID!{GUID_USB_WMI_SURPRISE_REMOVAL_NOTIFICATION, + 0x9bbbf831, 0xa2f2, 0x43b4, 0x96, 0xd1, 0x86, 0x94, 0x4b, 0x59, 0x14, 0xb3} +pub const GUID_CLASS_USBHUB: GUID = GUID_DEVINTERFACE_USB_HUB; +pub const GUID_CLASS_USB_DEVICE: GUID = GUID_DEVINTERFACE_USB_DEVICE; +pub const GUID_CLASS_USB_HOST_CONTROLLER: GUID = GUID_DEVINTERFACE_USB_HOST_CONTROLLER; +pub const FILE_DEVICE_USB: ULONG = FILE_DEVICE_UNKNOWN; +#[inline] +pub fn USB_CTL(id: ULONG) -> ULONG { + CTL_CODE!(FILE_DEVICE_USB, id, METHOD_BUFFERED, FILE_ANY_ACCESS) +} +#[inline] +pub fn USB_KERNEL_CTL(id: ULONG) -> ULONG { + CTL_CODE!(FILE_DEVICE_USB, id, METHOD_NEITHER, FILE_ANY_ACCESS) +} +#[inline] +pub fn USB_KERNEL_CTL_BUFFERED(id: ULONG) -> ULONG { + CTL_CODE!(FILE_DEVICE_USB, id, METHOD_BUFFERED, FILE_ANY_ACCESS) +} +// No calling convention was specified in the code +FN!{stdcall USB_IDLE_CALLBACK( + Context: PVOID, +) -> ()} +STRUCT!{struct USB_IDLE_CALLBACK_INFO { + IdleCallback: USB_IDLE_CALLBACK, + IdleContext: PVOID, +}} +pub type PUSB_IDLE_CALLBACK_INFO = *mut USB_IDLE_CALLBACK_INFO; diff --git a/src/vendor/winapi/src/shared/usbspec.rs b/src/vendor/winapi/src/shared/usbspec.rs new file mode 100644 index 0000000000..8571de7bb9 --- /dev/null +++ b/src/vendor/winapi/src/shared/usbspec.rs @@ -0,0 +1,861 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! USB Spec Definitions. +use shared::basetsd::ULONG64; +use shared::guiddef::GUID; +use shared::minwindef::{UCHAR, ULONG, USHORT}; +use um::winnt::WCHAR; +ENUM!{enum USB_DEVICE_SPEED { + UsbLowSpeed = 0, + UsbFullSpeed, + UsbHighSpeed, + UsbSuperSpeed, +}} +ENUM!{enum USB_DEVICE_TYPE { + Usb11Device = 0, + Usb20Device, +}} +STRUCT!{#[repr(packed)] struct BM_REQUEST_TYPE { + B: UCHAR, +}} +BITFIELD!{BM_REQUEST_TYPE B: UCHAR [ + Recipient set_Recipient[0..2], + Reserved set_Reserved[2..5], + Type set_Type[5..7], + Dir set_Dir[7..8], +]} +pub type PBM_REQUEST_TYPE = *mut BM_REQUEST_TYPE; +STRUCT!{#[repr(packed)] struct USB_DEFAULT_PIPE_SETUP_PACKET_wValue_s { + LowByte: UCHAR, + HiByte: UCHAR, +}} +UNION!{#[repr(packed)] union USB_DEFAULT_PIPE_SETUP_PACKET_wValue { + [u16; 1], + s s_mut: USB_DEFAULT_PIPE_SETUP_PACKET_wValue_s, + W W_mut: USHORT, +}} +STRUCT!{#[repr(packed)] struct USB_DEFAULT_PIPE_SETUP_PACKET_wIndex_s { + LowByte: UCHAR, + HiByte: UCHAR, +}} +UNION!{#[repr(packed)] union USB_DEFAULT_PIPE_SETUP_PACKET_wIndex { + [u16; 1], + s s_mut: USB_DEFAULT_PIPE_SETUP_PACKET_wIndex_s, + W W_mut: USHORT, +}} +STRUCT!{#[repr(packed)] struct USB_DEFAULT_PIPE_SETUP_PACKET { + bmRequestType: BM_REQUEST_TYPE, + bRequest: UCHAR, + wValue: USB_DEFAULT_PIPE_SETUP_PACKET_wValue, + wIndex: USB_DEFAULT_PIPE_SETUP_PACKET_wIndex, + wLength: USHORT, +}} +pub type PUSB_DEFAULT_PIPE_SETUP_PACKET = *mut USB_DEFAULT_PIPE_SETUP_PACKET; +pub const BMREQUEST_HOST_TO_DEVICE: UCHAR = 0; +pub const BMREQUEST_DEVICE_TO_HOST: UCHAR = 1; +pub const BMREQUEST_STANDARD: UCHAR = 0; +pub const BMREQUEST_CLASS: UCHAR = 1; +pub const BMREQUEST_VENDOR: UCHAR = 2; +pub const BMREQUEST_TO_DEVICE: UCHAR = 0; +pub const BMREQUEST_TO_INTERFACE: UCHAR = 1; +pub const BMREQUEST_TO_ENDPOINT: UCHAR = 2; +pub const BMREQUEST_TO_OTHER: UCHAR = 3; +#[inline] +pub fn USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d: UCHAR, i: UCHAR) -> USHORT { + (d as USHORT) << 8 | (i as USHORT) +} +pub const USB_REQUEST_GET_STATUS: UCHAR = 0x00; +pub const USB_REQUEST_CLEAR_FEATURE: UCHAR = 0x01; +pub const USB_REQUEST_SET_FEATURE: UCHAR = 0x03; +pub const USB_REQUEST_SET_ADDRESS: UCHAR = 0x05; +pub const USB_REQUEST_GET_DESCRIPTOR: UCHAR = 0x06; +pub const USB_REQUEST_SET_DESCRIPTOR: UCHAR = 0x07; +pub const USB_REQUEST_GET_CONFIGURATION: UCHAR = 0x08; +pub const USB_REQUEST_SET_CONFIGURATION: UCHAR = 0x09; +pub const USB_REQUEST_GET_INTERFACE: UCHAR = 0x0A; +pub const USB_REQUEST_SET_INTERFACE: UCHAR = 0x0B; +pub const USB_REQUEST_SYNC_FRAME: UCHAR = 0x0C; +pub const USB_REQUEST_SET_SEL: UCHAR = 0x30; +pub const USB_REQUEST_ISOCH_DELAY: UCHAR = 0x31; +pub const USB_DEVICE_DESCRIPTOR_TYPE: UCHAR = 0x01; +pub const USB_CONFIGURATION_DESCRIPTOR_TYPE: UCHAR = 0x02; +pub const USB_STRING_DESCRIPTOR_TYPE: UCHAR = 0x03; +pub const USB_INTERFACE_DESCRIPTOR_TYPE: UCHAR = 0x04; +pub const USB_ENDPOINT_DESCRIPTOR_TYPE: UCHAR = 0x05; +pub const USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE: UCHAR = 0x06; +pub const USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE: UCHAR = 0x07; +pub const USB_INTERFACE_POWER_DESCRIPTOR_TYPE: UCHAR = 0x08; +pub const USB_OTG_DESCRIPTOR_TYPE: UCHAR = 0x09; +pub const USB_DEBUG_DESCRIPTOR_TYPE: UCHAR = 0x0A; +pub const USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE: UCHAR = 0x0B; +pub const USB_BOS_DESCRIPTOR_TYPE: UCHAR = 0x0F; +pub const USB_DEVICE_CAPABILITY_DESCRIPTOR_TYPE: UCHAR = 0x10; +pub const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_TYPE: UCHAR = 0x30; +pub const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR_TYPE: UCHAR = 0x31; +pub const USB_RESERVED_DESCRIPTOR_TYPE: UCHAR = 0x06; +pub const USB_CONFIG_POWER_DESCRIPTOR_TYPE: UCHAR = 0x07; +pub const USB_FEATURE_ENDPOINT_STALL: UCHAR = 0x00; +pub const USB_FEATURE_REMOTE_WAKEUP: UCHAR = 0x01; +pub const USB_FEATURE_TEST_MODE: UCHAR = 0x02; +pub const USB_FEATURE_FUNCTION_SUSPEND: UCHAR = 0x00; +pub const USB_FEATURE_U1_ENABLE: UCHAR = 0x30; +pub const USB_FEATURE_U2_ENABLE: UCHAR = 0x31; +pub const USB_FEATURE_LTM_ENABLE: UCHAR = 0x32; +pub const USB_FEATURE_LDM_ENABLE: UCHAR = 0x35; +pub const USB_FEATURE_BATTERY_WAKE_MASK: UCHAR = 0x28; +pub const USB_FEATURE_OS_IS_PD_AWARE: UCHAR = 0x29; +pub const USB_FEATURE_POLICY_MODE: UCHAR = 0x2A; +pub const USB_FEATURE_CHARGING_POLICY: UCHAR = 0x36; +pub const USB_CHARGING_POLICY_DEFAULT: UCHAR = 0x00; +pub const USB_CHARGING_POLICY_ICCHPF: UCHAR = 0x01; +pub const USB_CHARGING_POLICY_ICCLPF: UCHAR = 0x02; +pub const USB_CHARGING_POLICY_NO_POWER: UCHAR = 0x03; +pub const USB_STATUS_PORT_STATUS: UCHAR = 0x00; +pub const USB_STATUS_PD_STATUS: UCHAR = 0x01; +pub const USB_STATUS_EXT_PORT_STATUS: UCHAR = 0x02; +pub const USB_GETSTATUS_SELF_POWERED: UCHAR = 0x01; +pub const USB_GETSTATUS_REMOTE_WAKEUP_ENABLED: UCHAR = 0x02; +pub const USB_GETSTATUS_U1_ENABLE: UCHAR = 0x04; +pub const USB_GETSTATUS_U2_ENABLE: UCHAR = 0x08; +pub const USB_GETSTATUS_LTM_ENABLE: UCHAR = 0x10; +STRUCT!{#[repr(packed)] struct USB_DEVICE_STATUS { + AsUshort16: USHORT, +}} +BITFIELD!{USB_DEVICE_STATUS AsUshort16: USHORT [ + SelfPowered set_SelfPowered[0..1], + RemoteWakeup set_RemoteWakeup[1..2], + U1Enable set_U1Enable[2..3], + U2Enable set_U2Enable[3..4], + LtmEnable set_LtmEnable[4..5], + Reserved set_Reserved[5..16], +]} +pub type PUSB_DEVICE_STATUS = *mut USB_DEVICE_STATUS; +STRUCT!{#[repr(packed)] struct USB_INTERFACE_STATUS { + AsUshort16: USHORT, +}} +BITFIELD!{USB_INTERFACE_STATUS AsUshort16: USHORT [ + RemoteWakeupCapable set_RemoteWakeupCapable[0..1], + RemoteWakeupEnabled set_RemoteWakeupEnabled[1..2], + Reserved set_Reserved[2..16], +]} +pub type PUSB_INTERFACE_STATUS = *mut USB_INTERFACE_STATUS; +STRUCT!{#[repr(packed)] struct USB_ENDPOINT_STATUS { + AsUshort16: USHORT, +}} +BITFIELD!{USB_ENDPOINT_STATUS AsUshort16: USHORT [ + Halt set_Halt[0..1], + Reserved set_Reserved[1..16], +]} +pub type PUSB_ENDPOINT_STATUS = *mut USB_ENDPOINT_STATUS; +STRUCT!{#[repr(packed)] struct USB_COMMON_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, +}} +pub type PUSB_COMMON_DESCRIPTOR = *mut USB_COMMON_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_DEVICE_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bcdUSB: USHORT, + bDeviceClass: UCHAR, + bDeviceSubClass: UCHAR, + bDeviceProtocol: UCHAR, + bMaxPacketSize0: UCHAR, + idVendor: USHORT, + idProduct: USHORT, + bcdDevice: USHORT, + iManufacturer: UCHAR, + iProduct: UCHAR, + iSerialNumber: UCHAR, + bNumConfigurations: UCHAR, +}} +pub type PUSB_DEVICE_DESCRIPTOR = *mut USB_DEVICE_DESCRIPTOR; +pub const USB_DEVICE_CLASS_RESERVED: UCHAR = 0x00; +pub const USB_DEVICE_CLASS_AUDIO: UCHAR = 0x01; +pub const USB_DEVICE_CLASS_COMMUNICATIONS: UCHAR = 0x02; +pub const USB_DEVICE_CLASS_HUMAN_INTERFACE: UCHAR = 0x03; +pub const USB_DEVICE_CLASS_MONITOR: UCHAR = 0x04; +pub const USB_DEVICE_CLASS_PHYSICAL_INTERFACE: UCHAR = 0x05; +pub const USB_DEVICE_CLASS_POWER: UCHAR = 0x06; +pub const USB_DEVICE_CLASS_IMAGE: UCHAR = 0x06; +pub const USB_DEVICE_CLASS_PRINTER: UCHAR = 0x07; +pub const USB_DEVICE_CLASS_STORAGE: UCHAR = 0x08; +pub const USB_DEVICE_CLASS_HUB: UCHAR = 0x09; +pub const USB_DEVICE_CLASS_CDC_DATA: UCHAR = 0x0A; +pub const USB_DEVICE_CLASS_SMART_CARD: UCHAR = 0x0B; +pub const USB_DEVICE_CLASS_CONTENT_SECURITY: UCHAR = 0x0D; +pub const USB_DEVICE_CLASS_VIDEO: UCHAR = 0x0E; +pub const USB_DEVICE_CLASS_PERSONAL_HEALTHCARE: UCHAR = 0x0F; +pub const USB_DEVICE_CLASS_AUDIO_VIDEO: UCHAR = 0x10; +pub const USB_DEVICE_CLASS_BILLBOARD: UCHAR = 0x11; +pub const USB_DEVICE_CLASS_DIAGNOSTIC_DEVICE: UCHAR = 0xDC; +pub const USB_DEVICE_CLASS_WIRELESS_CONTROLLER: UCHAR = 0xE0; +pub const USB_DEVICE_CLASS_MISCELLANEOUS: UCHAR = 0xEF; +pub const USB_DEVICE_CLASS_APPLICATION_SPECIFIC: UCHAR = 0xFE; +pub const USB_DEVICE_CLASS_VENDOR_SPECIFIC: UCHAR = 0xFF; +STRUCT!{#[repr(packed)] struct USB_DEVICE_QUALIFIER_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bcdUSB: USHORT, + bDeviceClass: UCHAR, + bDeviceSubClass: UCHAR, + bDeviceProtocol: UCHAR, + bMaxPacketSize0: UCHAR, + bNumConfigurations: UCHAR, + bReserved: UCHAR, +}} +pub type PUSB_DEVICE_QUALIFIER_DESCRIPTOR = *mut USB_DEVICE_QUALIFIER_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_BOS_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + wTotalLength: USHORT, + bNumDeviceCaps: UCHAR, +}} +pub type PUSB_BOS_DESCRIPTOR = *mut USB_BOS_DESCRIPTOR; +pub const USB_DEVICE_CAPABILITY_WIRELESS_USB: UCHAR = 0x01; +pub const USB_DEVICE_CAPABILITY_USB20_EXTENSION: UCHAR = 0x02; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_USB: UCHAR = 0x03; +pub const USB_DEVICE_CAPABILITY_CONTAINER_ID: UCHAR = 0x04; +pub const USB_DEVICE_CAPABILITY_PLATFORM: UCHAR = 0x05; +pub const USB_DEVICE_CAPABILITY_POWER_DELIVERY: UCHAR = 0x06; +pub const USB_DEVICE_CAPABILITY_BATTERY_INFO: UCHAR = 0x07; +pub const USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT: UCHAR = 0x08; +pub const USB_DEVICE_CAPABILITY_PD_PROVIDER_PORT: UCHAR = 0x09; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB: UCHAR = 0x0A; +pub const USB_DEVICE_CAPABILITY_PRECISION_TIME_MEASUREMENT: UCHAR = 0x0B; +pub const USB_DEVICE_CAPABILITY_BILLBOARD: UCHAR = 0x0D; +pub const USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY: UCHAR = 0x10; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes { + AsUlong: ULONG, +}} +BITFIELD!{USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes AsUlong: ULONG [ + Reserved set_Reserved[0..1], + LPMCapable set_LPMCapable[1..2], + BESLAndAlternateHIRDSupported set_BESLAndAlternateHIRDSupported[2..3], + BaselineBESLValid set_BaselineBESLValid[3..4], + DeepBESLValid set_DeepBESLValid[4..5], + Reserved1 set_Reserved1[5..8], + BaselineBESL set_BaselineBESL[8..12], + DeepBESL set_DeepBESL[12..16], + Reserved2 set_Reserved2[16..32], +]} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bmAttributes: USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes, +}} +pub type PUSB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR; +pub const USB_DEVICE_CAPABILITY_USB20_EXTENSION_BMATTRIBUTES_RESERVED_MASK: ULONG = 0xFFFF00E1; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes { + AsUlong: ULONG, +}} +BITFIELD!{USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes AsUlong: ULONG [ + Reserved set_Reserved[0..1], + BatteryCharging set_BatteryCharging[1..2], + USBPowerDelivery set_USBPowerDelivery[2..3], + Provider set_Provider[3..4], + Consumer set_Consumer[4..5], + ChargingPolicy set_ChargingPolicy[5..6], + TypeCCurrent set_TypeCCurrent[6..7], + Reserved2 set_Reserved2[7..8], + ACSupply set_ACSupply[8..9], + Battery set_Battery[9..10], + Other set_Other[10..11], + NumBatteries set_NumBatteries[11..14], + UsesVbus set_UsesVbus[14..15], + Reserved3 set_Reserved3[15..32], +]} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bReserved: UCHAR, + bmAttributes: USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes, + bmProviderPorts: USHORT, + bmConsumerPorts: USHORT, + bcdBCVersion: USHORT, + bcdPDVersion: USHORT, + bcdUSBTypeCVersion: USHORT, +}} +pub type PUSB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities { + AsUshort: USHORT, +}} +BITFIELD!{USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities AsUshort: USHORT [ + BatteryCharging set_BatteryCharging[0..1], + USBPowerDelivery set_USBPowerDelivery[1..2], + USBTypeCCurrent set_USBTypeCCurrent[2..3], + Reserved set_Reserved[3..16], +]} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bReserved: UCHAR, + bmCapabilities: USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities, + wMinVoltage: USHORT, + wMaxVoltage: USHORT, + wReserved: USHORT, + dwMaxOperatingPower: ULONG, + dwMaxPeakPower: ULONG, + dwMaxPeakPowerTime: ULONG, +}} +pub type PUSB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bmAttributes: UCHAR, + wSpeedsSupported: USHORT, + bFunctionalitySupport: UCHAR, + bU1DevExitLat: UCHAR, + wU2DevExitLat: USHORT, +}} +pub type PUSB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_RESERVED_MASK: UCHAR = 0xFD; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_LTM_CAPABLE: UCHAR = 0x02; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_RESERVED_MASK: USHORT = 0xFFF0; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_LOW: USHORT = 0x0001; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_FULL: USHORT = 0x0002; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_HIGH: USHORT = 0x0004; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_SUPER: USHORT = 0x0008; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_U1_DEVICE_EXIT_MAX_VALUE: UCHAR = 0x0A; +pub const USB_DEVICE_CAPABILITY_SUPERSPEED_U2_DEVICE_EXIT_MAX_VALUE: USHORT = 0x07FF; +pub const USB_DEVICE_CAPABILITY_MAX_U1_LATENCY: UCHAR = 0x0A; +pub const USB_DEVICE_CAPABILITY_MAX_U2_LATENCY: USHORT = 0x07FF; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_BPS: ULONG = 0; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_KBPS: ULONG = 1; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_MBPS: ULONG = 2; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_GBPS: ULONG = 3; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_SYMMETRIC: ULONG = 0; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_ASYMMETRIC: ULONG = 1; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_RX: ULONG = 0; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_TX: ULONG = 1; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SS: ULONG = 0; +pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SSP: ULONG = 1; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED { + AsUlong32: ULONG, +}} +BITFIELD!{USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED AsUlong32: ULONG [ + SublinkSpeedAttrID set_SublinkSpeedAttrID[0..4], + LaneSpeedExponent set_LaneSpeedExponent[4..6], + SublinkTypeMode set_SublinkTypeMode[6..7], + SublinkTypeDir set_SublinkTypeDir[7..8], + Reserved set_Reserved[8..14], + LinkProtocol set_LinkProtocol[14..16], + LaneSpeedMantissa set_LaneSpeedMantissa[16..32], +]} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes { + AsUlong32: ULONG, +}} +BITFIELD!{USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes AsUlong32: ULONG [ + SublinkSpeedAttrCount set_SublinkSpeedAttrCount[0..5], + SublinkSpeedIDCount set_SublinkSpeedIDCount[5..9], + Reserved set_Reserved[9..32], +]} +STRUCT!{#[repr(packed)] + struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport { + AsUshort: USHORT, +}} +BITFIELD!{ + USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport AsUshort: USHORT [ + SublinkSpeedAttrID set_SublinkSpeedAttrID[0..4], + Reserved set_Reserved[4..8], + MinRxLaneCount set_MinRxLaneCount[8..12], + MinTxLaneCount set_MinTxLaneCount[12..16], +]} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bReserved: UCHAR, + bmAttributes: USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes, + wFunctionalitySupport: + USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport, + wReserved: USHORT, + bmSublinkSpeedAttr: [USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED; 1], +}} +pub type PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bReserved: UCHAR, + ContainerID: [UCHAR; 16], +}} +pub type PUSB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR_Function { + bClass: UCHAR, + bSubClass: UCHAR, + bProtocol: UCHAR, +}} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bcdVersion: USHORT, + bConfigurationValue: UCHAR, + bMaxPower: UCHAR, + bNumFunctions: UCHAR, + Function: [USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR_Function; 1], +}} +pub type PUSB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + bReserved: UCHAR, + PlatformCapabilityUuid: GUID, + CapabililityData: [UCHAR; 1], +}} +pub type PUSB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower { + AsUshort: USHORT, +}} +BITFIELD!{USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower AsUshort: USHORT [ + VConnPowerNeededForFullFunctionality set_VConnPowerNeededForFullFunctionality[0..3], + Reserved set_Reserved[3..15], + NoVconnPowerRequired set_NoVconnPowerRequired[15..16], +]} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_AlternateMode { + wSVID: USHORT, + bAlternateMode: UCHAR, + iAlternateModeSetting: UCHAR, +}} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, + iAddtionalInfoURL: UCHAR, + bNumberOfAlternateModes: UCHAR, + bPreferredAlternateMode: UCHAR, + VconnPower: USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower, + bmConfigured: [UCHAR; 32], + bReserved: ULONG, + AlternateMode: [USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_AlternateMode; 1], +}} +pub type PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR + = *mut USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR; +DEFINE_GUID!{GUID_USB_MSOS20_PLATFORM_CAPABILITY_ID, + 0xd8dd60df, 0x4589, 0x4cc7, 0x9c, 0xd2, 0x65, 0x9d, 0x9e, 0x64, 0x8a, 0x9f} +STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bDevCapabilityType: UCHAR, +}} +pub type PUSB_DEVICE_CAPABILITY_DESCRIPTOR = *mut USB_DEVICE_CAPABILITY_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_CONFIGURATION_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + wTotalLength: USHORT, + bNumInterfaces: UCHAR, + bConfigurationValue: UCHAR, + iConfiguration: UCHAR, + bmAttributes: UCHAR, + MaxPower: UCHAR, +}} +pub type PUSB_CONFIGURATION_DESCRIPTOR = *mut USB_CONFIGURATION_DESCRIPTOR; +pub const USB_CONFIG_POWERED_MASK: UCHAR = 0xC0; +pub const USB_CONFIG_BUS_POWERED: UCHAR = 0x80; +pub const USB_CONFIG_SELF_POWERED: UCHAR = 0x40; +pub const USB_CONFIG_REMOTE_WAKEUP: UCHAR = 0x20; +pub const USB_CONFIG_RESERVED: UCHAR = 0x1F; +STRUCT!{#[repr(packed)] struct USB_INTERFACE_ASSOCIATION_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bFirstInterface: UCHAR, + bInterfaceCount: UCHAR, + bFunctionClass: UCHAR, + bFunctionSubClass: UCHAR, + bFunctionProtocol: UCHAR, + iFunction: UCHAR, +}} +pub type PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR = *mut USB_INTERFACE_ASSOCIATION_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_INTERFACE_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bInterfaceNumber: UCHAR, + bAlternateSetting: UCHAR, + bNumEndpoints: UCHAR, + bInterfaceClass: UCHAR, + bInterfaceSubClass: UCHAR, + bInterfaceProtocol: UCHAR, + iInterface: UCHAR, +}} +pub type PUSB_INTERFACE_DESCRIPTOR = *mut USB_INTERFACE_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_ENDPOINT_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bEndpointAddress: UCHAR, + bmAttributes: UCHAR, + wMaxPacketSize: USHORT, + bInterval: UCHAR, +}} +pub type PUSB_ENDPOINT_DESCRIPTOR = *mut USB_ENDPOINT_DESCRIPTOR; +pub const USB_ENDPOINT_DIRECTION_MASK: UCHAR = 0x80; +#[inline] +pub fn USB_ENDPOINT_DIRECTION_OUT(addr: UCHAR) -> UCHAR { + !(addr & USB_ENDPOINT_DIRECTION_MASK) +} +#[inline] +pub fn USB_ENDPOINT_DIRECTION_IN(addr: UCHAR) -> UCHAR { + addr & USB_ENDPOINT_DIRECTION_MASK +} +pub const USB_ENDPOINT_ADDRESS_MASK: UCHAR = 0x0F; +pub const USB_ENDPOINT_TYPE_MASK: UCHAR = 0x03; +pub const USB_ENDPOINT_TYPE_CONTROL: UCHAR = 0x00; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS: UCHAR = 0x01; +pub const USB_ENDPOINT_TYPE_BULK: UCHAR = 0x02; +pub const USB_ENDPOINT_TYPE_INTERRUPT: UCHAR = 0x03; +pub const USB_ENDPOINT_TYPE_BULK_RESERVED_MASK: UCHAR = 0xFC; +pub const USB_ENDPOINT_TYPE_CONTROL_RESERVED_MASK: UCHAR = 0xFC; +pub const USB_20_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK: UCHAR = 0xFC; +pub const USB_30_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK: UCHAR = 0xCC; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_RESERVED_MASK: UCHAR = 0xC0; +pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK: UCHAR = 0x30; +pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_PERIODIC: UCHAR = 0x00; +pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_NOTIFICATION: UCHAR = 0x10; +pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED10: UCHAR = 0x20; +pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED11: UCHAR = 0x30; +#[inline] +pub fn USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE(bmAttr: UCHAR) -> UCHAR { + bmAttr & USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK +} +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK: UCHAR = 0x0C; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_NO_SYNCHRONIZATION: UCHAR = 0x00; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ASYNCHRONOUS: UCHAR = 0x04; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ADAPTIVE: UCHAR = 0x08; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_SYNCHRONOUS: UCHAR = 0x0C; +#[inline] +pub fn USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION(bmAttr: UCHAR) -> UCHAR { + bmAttr & USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK +} +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK: UCHAR = 0x30; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_DATA_ENDOINT: UCHAR = 0x00; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_FEEDBACK_ENDPOINT: UCHAR = 0x10; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_IMPLICIT_FEEDBACK_DATA_ENDPOINT: UCHAR = 0x20; +pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_RESERVED: UCHAR = 0x30; +#[inline] +pub fn USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE(bmAttr: UCHAR) -> UCHAR { + bmAttr & USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK +} +STRUCT!{#[repr(packed)] struct USB_HIGH_SPEED_MAXPACKET { + us: USHORT, +}} +BITFIELD!{USB_HIGH_SPEED_MAXPACKET us: USHORT [ + MaxPacket set_MaxPacket[0..11], + HSmux set_HSmux[11..13], + Reserved set_Reserved[13..16], +]} +pub type PUSB_HIGH_SPEED_MAXPACKET = *mut USB_HIGH_SPEED_MAXPACKET; +pub const USB_ENDPOINT_SUPERSPEED_BULK_MAX_PACKET_SIZE: USHORT = 1024; +pub const USB_ENDPOINT_SUPERSPEED_CONTROL_MAX_PACKET_SIZE: USHORT = 512; +pub const USB_ENDPOINT_SUPERSPEED_ISO_MAX_PACKET_SIZE: USHORT = 1024; +pub const USB_ENDPOINT_SUPERSPEED_INTERRUPT_MAX_PACKET_SIZE: USHORT = 1024; +STRUCT!{#[repr(packed)] struct USB_STRING_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bString: [WCHAR; 1], +}} +pub type PUSB_STRING_DESCRIPTOR = *mut USB_STRING_DESCRIPTOR; +pub const MAXIMUM_USB_STRING_LENGTH: UCHAR = 255; +STRUCT!{#[repr(packed)] struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk { + BitField: UCHAR, +}} +BITFIELD!{USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk BitField: UCHAR [ + MaxStreams set_MaxStreams[0..5], + Reserved1 set_Reserved1[5..8], +]} +STRUCT!{#[repr(packed)] + struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous { + BitField: UCHAR, +}} +BITFIELD!{USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous BitField: UCHAR [ + Mult set_Mult[0..2], + Reserved2 set_Reserved2[2..7], + SspCompanion set_SspCompanion[7..8], +]} +UNION!{#[repr(packed)] union USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes { + [u8; 1], + AsUchar AsUchar_mut: UCHAR, + Bulk Bulk_mut: USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk, + Isochronous Isochronous_mut: + USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous, +}} +STRUCT!{#[repr(packed)] struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bMaxBurst: UCHAR, + bmAttributes: USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes, + wBytesPerInterval: USHORT, +}} +pub type PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR + = *mut USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR; +pub const USB_SUPERSPEED_ISOCHRONOUS_MAX_MULTIPLIER: UCHAR = 2; +STRUCT!{#[repr(packed)] struct USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + wReserved: USHORT, + dwBytesPerInterval: ULONG, +}} +pub type PUSB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR + = *mut USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR; +pub const USB_SUPERSPEEDPLUS_ISOCHRONOUS_MIN_BYTESPERINTERVAL: ULONG = 0xC001; +pub const USB_SUPERSPEEDPLUS_ISOCHRONOUS_MAX_BYTESPERINTERVAL: ULONG = 0xFFFFFF; +STRUCT!{#[repr(packed)] struct USB_HUB_DESCRIPTOR { + bDescriptorLength: UCHAR, + bDescriptorType: UCHAR, + bNumberOfPorts: UCHAR, + wHubCharacteristics: USHORT, + bPowerOnToPowerGood: UCHAR, + bHubControlCurrent: UCHAR, + bRemoveAndPowerMask: [UCHAR; 64], +}} +pub type PUSB_HUB_DESCRIPTOR = *mut USB_HUB_DESCRIPTOR; +pub const USB_20_HUB_DESCRIPTOR_TYPE: UCHAR = 0x29; +STRUCT!{#[repr(packed)] struct USB_30_HUB_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bNumberOfPorts: UCHAR, + wHubCharacteristics: USHORT, + bPowerOnToPowerGood: UCHAR, + bHubControlCurrent: UCHAR, + bHubHdrDecLat: UCHAR, + wHubDelay: USHORT, + DeviceRemovable: USHORT, +}} +pub type PUSB_30_HUB_DESCRIPTOR = *mut USB_30_HUB_DESCRIPTOR; +pub const USB_30_HUB_DESCRIPTOR_TYPE: UCHAR = 0x2A; +pub const USB_REQUEST_GET_STATE: UCHAR = 0x02; +pub const USB_REQUEST_CLEAR_TT_BUFFER: UCHAR = 0x08; +pub const USB_REQUEST_RESET_TT: UCHAR = 0x09; +pub const USB_REQUEST_GET_TT_STATE: UCHAR = 0x0A; +pub const USB_REQUEST_STOP_TT: UCHAR = 0x0B; +pub const USB_REQUEST_SET_HUB_DEPTH: UCHAR = 0x0C; +pub const USB_REQUEST_GET_PORT_ERR_COUNT: UCHAR = 0x0D; +STRUCT!{#[repr(packed)] struct USB_HUB_STATUS { + AsUshort16: USHORT, +}} +BITFIELD!{USB_HUB_STATUS AsUshort16: USHORT [ + LocalPowerLost set_LocalPowerLost[0..1], + OverCurrent set_OverCurrent[1..2], + Reserved set_Reserved[2..16], +]} +pub type PUSB_HUB_STATUS = *mut USB_HUB_STATUS; +STRUCT!{#[repr(packed)] struct USB_HUB_CHANGE { + AsUshort16: USHORT, +}} +BITFIELD!{USB_HUB_CHANGE AsUshort16: USHORT [ + LocalPowerChange set_LocalPowerChange[0..1], + OverCurrentChange set_OverCurrentChange[1..2], + Reserved set_Reserved[2..16], +]} +pub type PUSB_HUB_CHANGE = *mut USB_HUB_CHANGE; +STRUCT!{#[repr(packed)] struct USB_HUB_STATUS_AND_CHANGE_s { + HubStatus: USB_HUB_STATUS, + HubChange: USB_HUB_CHANGE, +}} +UNION!{#[repr(packed)] union USB_HUB_STATUS_AND_CHANGE { + [u32; 1], + AsUlong32 AsUlong32_mut: ULONG, + s s_mut: USB_HUB_STATUS_AND_CHANGE_s, +}} +pub type PUSB_HUB_STATUS_AND_CHANGE = *mut USB_HUB_STATUS_AND_CHANGE; +STRUCT!{#[repr(packed)] struct USB_20_PORT_STATUS { + AsUshort16: USHORT, +}} +BITFIELD!{USB_20_PORT_STATUS AsUshort16: USHORT [ + CurrentConnectStatus set_CurrentConnectStatus[0..1], + PortEnabledDisabled set_PortEnabledDisabled[1..2], + Suspend set_Suspend[2..3], + OverCurrent set_OverCurrent[3..4], + Reset set_Reset[4..5], + L1 set_L1[5..6], + Reserved0 set_Reserved0[6..8], + PortPower set_PortPower[8..9], + LowSpeedDeviceAttached set_LowSpeedDeviceAttached[9..10], + HighSpeedDeviceAttached set_HighSpeedDeviceAttached[10..11], + PortTestMode set_PortTestMode[11..12], + PortIndicatorControl set_PortIndicatorControl[12..13], + Reserved1 set_Reserved1[13..16], +]} +pub type PUSB_20_PORT_STATUS = *mut USB_20_PORT_STATUS; +pub const USB_PORT_STATUS_CONNECT: USHORT = 0x0001; +pub const USB_PORT_STATUS_ENABLE: USHORT = 0x0002; +pub const USB_PORT_STATUS_SUSPEND: USHORT = 0x0004; +pub const USB_PORT_STATUS_OVER_CURRENT: USHORT = 0x0008; +pub const USB_PORT_STATUS_RESET: USHORT = 0x0010; +pub const USB_PORT_STATUS_POWER: USHORT = 0x0100; +pub const USB_PORT_STATUS_LOW_SPEED: USHORT = 0x0200; +pub const USB_PORT_STATUS_HIGH_SPEED: USHORT = 0x0400; +STRUCT!{#[repr(packed)] struct USB_20_PORT_CHANGE { + AsUshort16: USHORT, +}} +BITFIELD!{USB_20_PORT_CHANGE AsUshort16: USHORT [ + ConnectStatusChange set_ConnectStatusChange[0..1], + PortEnableDisableChange set_PortEnableDisableChange[1..2], + SuspendChange set_SuspendChange[2..3], + OverCurrentIndicatorChange set_OverCurrentIndicatorChange[3..4], + ResetChange set_ResetChange[4..5], + Reserved2 set_Reserved2[5..16], +]} +pub type PUSB_20_PORT_CHANGE = *mut USB_20_PORT_CHANGE; +STRUCT!{#[repr(packed)] struct USB_30_PORT_STATUS { + AsUshort16: USHORT, +}} +BITFIELD!{USB_30_PORT_STATUS AsUshort16: USHORT [ + CurrentConnectStatus set_CurrentConnectStatus[0..1], + PortEnabledDisabled set_PortEnabledDisabled[1..2], + Reserved0 set_Reserved0[2..3], + OverCurrent set_OverCurrent[3..4], + Reset set_Reset[4..5], + PortLinkState set_PortLinkState[5..9], + PortPower set_PortPower[9..10], + NegotiatedDeviceSpeed set_NegotiatedDeviceSpeed[10..13], + Reserved1 set_Reserved1[13..16], +]} +pub type PUSB_30_PORT_STATUS = *mut USB_30_PORT_STATUS; +pub const PORT_LINK_STATE_U0: USHORT = 0; +pub const PORT_LINK_STATE_U1: USHORT = 1; +pub const PORT_LINK_STATE_U2: USHORT = 2; +pub const PORT_LINK_STATE_U3: USHORT = 3; +pub const PORT_LINK_STATE_DISABLED: USHORT = 4; +pub const PORT_LINK_STATE_RX_DETECT: USHORT = 5; +pub const PORT_LINK_STATE_INACTIVE: USHORT = 6; +pub const PORT_LINK_STATE_POLLING: USHORT = 7; +pub const PORT_LINK_STATE_RECOVERY: USHORT = 8; +pub const PORT_LINK_STATE_HOT_RESET: USHORT = 9; +pub const PORT_LINK_STATE_COMPLIANCE_MODE: USHORT = 10; +pub const PORT_LINK_STATE_LOOPBACK: USHORT = 11; +pub const PORT_LINK_STATE_TEST_MODE: USHORT = 11; +STRUCT!{#[repr(packed)] struct USB_30_PORT_CHANGE { + AsUshort16: USHORT, +}} +BITFIELD!{USB_30_PORT_CHANGE AsUshort16: USHORT [ + ConnectStatusChange set_ConnectStatusChange[0..1], + Reserved2 set_Reserved2[1..3], + OverCurrentIndicatorChange set_OverCurrentIndicatorChange[3..4], + ResetChange set_ResetChange[4..5], + BHResetChange set_BHResetChange[5..6], + PortLinkStateChange set_PortLinkStateChange[6..7], + PortConfigErrorChange set_PortConfigErrorChange[7..8], + Reserved3 set_Reserved3[8..16], +]} +pub type PUSB_30_PORT_CHANGE = *mut USB_30_PORT_CHANGE; +UNION!{#[repr(packed)] union USB_PORT_STATUS { + [u16; 1], + AsUshort16 AsUshort16_mut: USHORT, + Usb20PortStatus Usb20PortStatus_mut: USB_20_PORT_STATUS, + Usb30PortStatus Usb30PortStatus_mut: USB_30_PORT_STATUS, +}} +pub type PUSB_PORT_STATUS = *mut USB_PORT_STATUS; +UNION!{#[repr(packed)] union USB_PORT_CHANGE { + [u16; 1], + AsUshort16 AsUshort16_mut: USHORT, + Usb20PortChange Usb20PortChange_mut: USB_20_PORT_CHANGE, + Usb30PortChange Usb30PortChange_mut: USB_30_PORT_CHANGE, +}} +pub type PUSB_PORT_CHANGE = *mut USB_PORT_CHANGE; +STRUCT!{#[repr(packed)] struct USB_PORT_EXT_STATUS { + AsUlong32: ULONG, +}} +BITFIELD!{USB_PORT_EXT_STATUS AsUlong32: ULONG [ + RxSublinkSpeedID set_RxSublinkSpeedID[0..4], + TxSublinkSpeedID set_TxSublinkSpeedID[4..8], + RxLaneCount set_RxLaneCount[8..12], + TxLaneCount set_TxLaneCount[12..16], + Reserved set_Reserved[16..32], +]} +pub type PUSB_PORT_EXT_STATUS = *mut USB_PORT_EXT_STATUS; +STRUCT!{#[repr(packed)] struct USB_PORT_STATUS_AND_CHANGE_s { + PortStatus: USB_PORT_STATUS, + PortChange: USB_PORT_CHANGE, +}} +UNION!{#[repr(packed)] union USB_PORT_STATUS_AND_CHANGE { + [u32; 1], + AsUlong32 AsUlong32_mut: ULONG, + s s_mut: USB_PORT_STATUS_AND_CHANGE_s, +}} +pub type PUSB_PORT_STATUS_AND_CHANGE = *mut USB_PORT_STATUS_AND_CHANGE; +STRUCT!{#[repr(packed)] struct USB_PORT_EXT_STATUS_AND_CHANGE_s { + PortStatusChange: USB_PORT_STATUS_AND_CHANGE, + PortExtStatus: USB_PORT_EXT_STATUS, +}} +UNION!{#[repr(packed)] union USB_PORT_EXT_STATUS_AND_CHANGE { + [u64; 1], + AsUlong64 AsUlong64_mut: ULONG64, + s s_mut: USB_PORT_EXT_STATUS_AND_CHANGE_s, +}} +pub type PUSB_PORT_EXT_STATUS_AND_CHANGE = *mut USB_PORT_EXT_STATUS_AND_CHANGE; +STRUCT!{#[repr(packed)] struct USB_HUB_30_PORT_REMOTE_WAKE_MASK { + AsUchar8: UCHAR, +}} +BITFIELD!{USB_HUB_30_PORT_REMOTE_WAKE_MASK AsUchar8: UCHAR [ + ConnectRemoteWakeEnable set_ConnectRemoteWakeEnable[0..1], + DisconnectRemoteWakeEnable set_DisconnectRemoteWakeEnable[1..2], + OverCurrentRemoteWakeEnable set_OverCurrentRemoteWakeEnable[2..3], + Reserved0 set_Reserved0[3..8], +]} +pub type PUSB_HUB_30_PORT_REMOTE_WAKE_MASK = *mut USB_HUB_30_PORT_REMOTE_WAKE_MASK; +STRUCT!{#[repr(packed)] struct USB_FUNCTION_SUSPEND_OPTIONS { + AsUchar: UCHAR, +}} +BITFIELD!{USB_FUNCTION_SUSPEND_OPTIONS AsUchar: UCHAR [ + PowerState set_PowerState[0..1], + RemoteWakeEnabled set_RemoteWakeEnabled[1..2], + Reserved0 set_Reserved0[2..8], +]} +pub type PUSB_FUNCTION_SUSPEND_OPTIONS = *mut USB_FUNCTION_SUSPEND_OPTIONS; +pub const USB_FEATURE_INTERFACE_POWER_D0: USHORT = 0x0002; +pub const USB_FEATURE_INTERFACE_POWER_D1: USHORT = 0x0003; +pub const USB_FEATURE_INTERFACE_POWER_D2: USHORT = 0x0004; +pub const USB_FEATURE_INTERFACE_POWER_D3: USHORT = 0x0005; +pub const USB_SUPPORT_D0_COMMAND: UCHAR = 0x01; +pub const USB_SUPPORT_D1_COMMAND: UCHAR = 0x02; +pub const USB_SUPPORT_D2_COMMAND: UCHAR = 0x04; +pub const USB_SUPPORT_D3_COMMAND: UCHAR = 0x08; +pub const USB_SUPPORT_D1_WAKEUP: UCHAR = 0x10; +pub const USB_SUPPORT_D2_WAKEUP: UCHAR = 0x20; +STRUCT!{#[repr(packed)] struct USB_CONFIGURATION_POWER_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + SelfPowerConsumedD0: [UCHAR; 3], + bPowerSummaryId: UCHAR, + bBusPowerSavingD1: UCHAR, + bSelfPowerSavingD1: UCHAR, + bBusPowerSavingD2: UCHAR, + bSelfPowerSavingD2: UCHAR, + bBusPowerSavingD3: UCHAR, + bSelfPowerSavingD3: UCHAR, + TransitionTimeFromD1: USHORT, + TransitionTimeFromD2: USHORT, + TransitionTimeFromD3: USHORT, +}} +pub type PUSB_CONFIGURATION_POWER_DESCRIPTOR = *mut USB_CONFIGURATION_POWER_DESCRIPTOR; +STRUCT!{#[repr(packed)] struct USB_INTERFACE_POWER_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bmCapabilitiesFlags: UCHAR, + bBusPowerSavingD1: UCHAR, + bSelfPowerSavingD1: UCHAR, + bBusPowerSavingD2: UCHAR, + bSelfPowerSavingD2: UCHAR, + bBusPowerSavingD3: UCHAR, + bSelfPowerSavingD3: UCHAR, + TransitionTimeFromD1: USHORT, + TransitionTimeFromD2: USHORT, + TransitionTimeFromD3: USHORT, +}} +pub type PUSB_INTERFACE_POWER_DESCRIPTOR = *mut USB_INTERFACE_POWER_DESCRIPTOR; diff --git a/src/vendor/winapi/src/shared/windef.rs b/src/vendor/winapi/src/shared/windef.rs new file mode 100644 index 0000000000..3d8b5412bc --- /dev/null +++ b/src/vendor/winapi/src/shared/windef.rs @@ -0,0 +1,117 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Basic Windows Type Definitions +use ctypes::c_void; +use shared::minwindef::{DWORD, HFILE, WORD}; +use um::winnt::{LONG, SHORT}; +DECLARE_HANDLE!(HWND, HWND__); +DECLARE_HANDLE!(HHOOK, HHOOK__); +pub type HGDIOBJ = *mut c_void; +DECLARE_HANDLE!(HACCEL, HACCEL__); +DECLARE_HANDLE!(HBITMAP, HBITMAP__); +DECLARE_HANDLE!(HBRUSH, HBRUSH__); +DECLARE_HANDLE!(HCOLORSPACE, HCOLORSPACE__); +DECLARE_HANDLE!(HDC, HDC__); +DECLARE_HANDLE!(HGLRC, HGLRC__); +DECLARE_HANDLE!(HDESK, HDESK__); +DECLARE_HANDLE!(HENHMETAFILE, HENHMETAFILE__); +DECLARE_HANDLE!(HFONT, HFONT__); +DECLARE_HANDLE!(HICON, HICON__); +DECLARE_HANDLE!(HMENU, HMENU__); +DECLARE_HANDLE!(HPALETTE, HPALETTE__); +DECLARE_HANDLE!(HPEN, HPEN__); +DECLARE_HANDLE!(HWINEVENTHOOK, HWINEVENTHOOK__); +DECLARE_HANDLE!(HMONITOR, HMONITOR__); +DECLARE_HANDLE!(HUMPD, HUMPD__); +pub type HCURSOR = HICON; +pub type COLORREF = DWORD; +pub type LPCOLORREF = *mut DWORD; +pub const HFILE_ERROR: HFILE = -1; +STRUCT!{struct RECT { + left: LONG, + top: LONG, + right: LONG, + bottom: LONG, +}} +pub type PRECT = *mut RECT; +pub type NPRECT = *mut RECT; +pub type LPRECT = *mut RECT; +pub type LPCRECT = *const RECT; +STRUCT!{struct RECTL { + left: LONG, + top: LONG, + right: LONG, + bottom: LONG, +}} +pub type PRECTL = *mut RECTL; +pub type LPRECTL = *mut RECTL; +pub type LPCRECTL = *const RECTL; +STRUCT!{struct POINT { + x: LONG, + y: LONG, +}} +pub type PPOINT = *mut POINT; +pub type NPPOINT = *mut POINT; +pub type LPPOINT = *mut POINT; +STRUCT!{struct POINTL { + x: LONG, + y: LONG, +}} +pub type PPOINTL = *mut POINTL; +STRUCT!{struct SIZE { + cx: LONG, + cy: LONG, +}} +pub type PSIZE = *mut SIZE; +pub type LPSIZE = *mut SIZE; +pub type SIZEL = SIZE; +pub type PSIZEL = *mut SIZE; +pub type LPSIZEL = *mut SIZE; +STRUCT!{struct POINTS { + x: SHORT, + y: SHORT, +}} +pub type PPOINTS = *mut POINTS; +pub type LPPOINTS = *mut POINTS; +pub const DM_UPDATE: WORD = 1; +pub const DM_COPY: WORD = 2; +pub const DM_PROMPT: WORD = 4; +pub const DM_MODIFY: WORD = 8; +pub const DM_IN_BUFFER: WORD = DM_MODIFY; +pub const DM_IN_PROMPT: WORD = DM_PROMPT; +pub const DM_OUT_BUFFER: WORD = DM_COPY; +pub const DM_OUT_DEFAULT: WORD = DM_UPDATE; +pub const DC_FIELDS: DWORD = 1; +pub const DC_PAPERS: DWORD = 2; +pub const DC_PAPERSIZE: DWORD = 3; +pub const DC_MINEXTENT: DWORD = 4; +pub const DC_MAXEXTENT: DWORD = 5; +pub const DC_BINS: DWORD = 6; +pub const DC_DUPLEX: DWORD = 7; +pub const DC_SIZE: DWORD = 8; +pub const DC_EXTRA: DWORD = 9; +pub const DC_VERSION: DWORD = 10; +pub const DC_DRIVER: DWORD = 11; +pub const DC_BINNAMES: DWORD = 12; +pub const DC_ENUMRESOLUTIONS: DWORD = 13; +pub const DC_FILEDEPENDENCIES: DWORD = 14; +pub const DC_TRUETYPE: DWORD = 15; +pub const DC_PAPERNAMES: DWORD = 16; +pub const DC_ORIENTATION: DWORD = 17; +pub const DC_COPIES: DWORD = 18; +DECLARE_HANDLE!(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT__); +ENUM!{enum DPI_AWARENESS { + DPI_AWARENESS_INVALID = -1i32 as u32, + DPI_AWARENESS_UNAWARE = 0, + DPI_AWARENESS_SYSTEM_AWARE = 1, + DPI_AWARENESS_PER_MONITOR_AWARE = 2, +}} +pub const DPI_AWARENESS_CONTEXT_UNAWARE: DPI_AWARENESS_CONTEXT = -1isize as DPI_AWARENESS_CONTEXT; +pub const DPI_AWARENESS_CONTEXT_SYSTEM_AWARE: DPI_AWARENESS_CONTEXT + = -2isize as DPI_AWARENESS_CONTEXT; +pub const DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE: DPI_AWARENESS_CONTEXT + = -3isize as DPI_AWARENESS_CONTEXT; diff --git a/src/vendor/winapi/src/shared/windowsx.rs b/src/vendor/winapi/src/shared/windowsx.rs new file mode 100644 index 0000000000..06c18b1eb4 --- /dev/null +++ b/src/vendor/winapi/src/shared/windowsx.rs @@ -0,0 +1,18 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Macro APIs, window message crackers, and control APIs +use ctypes::{c_int, c_short}; +use shared::minwindef::{DWORD, HIWORD, LOWORD, LPARAM}; +//1233 +#[inline] +pub fn GET_X_LPARAM(lp: LPARAM) -> c_int { + LOWORD(lp as DWORD) as c_short as c_int +} +#[inline] +pub fn GET_Y_LPARAM(lp: LPARAM) -> c_int { + HIWORD(lp as DWORD) as c_short as c_int +} diff --git a/src/vendor/winapi/src/shared/winerror.rs b/src/vendor/winapi/src/shared/winerror.rs new file mode 100644 index 0000000000..4e6924b281 --- /dev/null +++ b/src/vendor/winapi/src/shared/winerror.rs @@ -0,0 +1,6114 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! error code definitions for the Win32 API functions +use ctypes::{c_long, c_ulong}; +use shared::minwindef::DWORD; +#[inline] +pub fn SUCCEEDED(hr: HRESULT) -> bool { + hr >= 0 +} +pub const FACILITY_XPS: HRESULT = 82; +pub const FACILITY_XAML: HRESULT = 43; +pub const FACILITY_USN: HRESULT = 129; +pub const FACILITY_BLBUI: HRESULT = 128; +pub const FACILITY_SPP: HRESULT = 256; +pub const FACILITY_WSB_ONLINE: HRESULT = 133; +pub const FACILITY_DLS: HRESULT = 153; +pub const FACILITY_BLB_CLI: HRESULT = 121; +pub const FACILITY_BLB: HRESULT = 120; +pub const FACILITY_WSBAPP: HRESULT = 122; +pub const FACILITY_WPN: HRESULT = 62; +pub const FACILITY_WMAAECMA: HRESULT = 1996; +pub const FACILITY_WINRM: HRESULT = 51; +pub const FACILITY_WINPE: HRESULT = 61; +pub const FACILITY_WINDOWSUPDATE: HRESULT = 36; +pub const FACILITY_WINDOWS_STORE: HRESULT = 63; +pub const FACILITY_WINDOWS_SETUP: HRESULT = 48; +pub const FACILITY_WINDOWS_DEFENDER: HRESULT = 80; +pub const FACILITY_WINDOWS_CE: HRESULT = 24; +pub const FACILITY_WINDOWS: HRESULT = 8; +pub const FACILITY_WINCODEC_DWRITE_DWM: HRESULT = 2200; +pub const FACILITY_WIA: HRESULT = 33; +pub const FACILITY_WER: HRESULT = 27; +pub const FACILITY_WEP: HRESULT = 2049; +pub const FACILITY_WEB_SOCKET: HRESULT = 886; +pub const FACILITY_WEB: HRESULT = 885; +pub const FACILITY_USERMODE_VOLSNAP: HRESULT = 130; +pub const FACILITY_USERMODE_VOLMGR: HRESULT = 56; +pub const FACILITY_VISUALCPP: HRESULT = 109; +pub const FACILITY_USERMODE_VIRTUALIZATION: HRESULT = 55; +pub const FACILITY_USERMODE_VHD: HRESULT = 58; +pub const FACILITY_URT: HRESULT = 19; +pub const FACILITY_UMI: HRESULT = 22; +pub const FACILITY_UI: HRESULT = 42; +pub const FACILITY_TPM_SOFTWARE: HRESULT = 41; +pub const FACILITY_TPM_SERVICES: HRESULT = 40; +pub const FACILITY_TIERING: HRESULT = 131; +pub const FACILITY_SYNCENGINE: HRESULT = 2050; +pub const FACILITY_SXS: HRESULT = 23; +pub const FACILITY_STORAGE: HRESULT = 3; +pub const FACILITY_STATE_MANAGEMENT: HRESULT = 34; +pub const FACILITY_SSPI: HRESULT = 9; +pub const FACILITY_USERMODE_SPACES: HRESULT = 231; +pub const FACILITY_SOS: HRESULT = 160; +pub const FACILITY_SCARD: HRESULT = 16; +pub const FACILITY_SHELL: HRESULT = 39; +pub const FACILITY_SETUPAPI: HRESULT = 15; +pub const FACILITY_SECURITY: HRESULT = 9; +pub const FACILITY_SDIAG: HRESULT = 60; +pub const FACILITY_USERMODE_SDBUS: HRESULT = 2305; +pub const FACILITY_RPC: HRESULT = 1; +pub const FACILITY_RESTORE: HRESULT = 256; +pub const FACILITY_SCRIPT: HRESULT = 112; +pub const FACILITY_PARSE: HRESULT = 113; +pub const FACILITY_RAS: HRESULT = 83; +pub const FACILITY_POWERSHELL: HRESULT = 84; +pub const FACILITY_PLA: HRESULT = 48; +pub const FACILITY_PIDGENX: HRESULT = 2561; +pub const FACILITY_P2P_INT: HRESULT = 98; +pub const FACILITY_P2P: HRESULT = 99; +pub const FACILITY_OPC: HRESULT = 81; +pub const FACILITY_ONLINE_ID: HRESULT = 134; +pub const FACILITY_WIN32: HRESULT = 7; +pub const FACILITY_CONTROL: HRESULT = 10; +pub const FACILITY_WEBSERVICES: HRESULT = 61; +pub const FACILITY_NULL: HRESULT = 0; +pub const FACILITY_NDIS: HRESULT = 52; +pub const FACILITY_NAP: HRESULT = 39; +pub const FACILITY_MOBILE: HRESULT = 1793; +pub const FACILITY_METADIRECTORY: HRESULT = 35; +pub const FACILITY_MSMQ: HRESULT = 14; +pub const FACILITY_MEDIASERVER: HRESULT = 13; +pub const FACILITY_MBN: HRESULT = 84; +pub const FACILITY_LINGUISTIC_SERVICES: HRESULT = 305; +pub const FACILITY_LEAP: HRESULT = 2184; +pub const FACILITY_JSCRIPT: HRESULT = 2306; +pub const FACILITY_INTERNET: HRESULT = 12; +pub const FACILITY_ITF: HRESULT = 4; +pub const FACILITY_INPUT: HRESULT = 64; +pub const FACILITY_USERMODE_HYPERVISOR: HRESULT = 53; +pub const FACILITY_ACCELERATOR: HRESULT = 1536; +pub const FACILITY_HTTP: HRESULT = 25; +pub const FACILITY_GRAPHICS: HRESULT = 38; +pub const FACILITY_FWP: HRESULT = 50; +pub const FACILITY_FVE: HRESULT = 49; +pub const FACILITY_USERMODE_FILTER_MANAGER: HRESULT = 31; +pub const FACILITY_EAS: HRESULT = 85; +pub const FACILITY_EAP: HRESULT = 66; +pub const FACILITY_DXGI_DDI: HRESULT = 2171; +pub const FACILITY_DXGI: HRESULT = 2170; +pub const FACILITY_DPLAY: HRESULT = 21; +pub const FACILITY_DMSERVER: HRESULT = 256; +pub const FACILITY_DISPATCH: HRESULT = 2; +pub const FACILITY_DIRECTORYSERVICE: HRESULT = 37; +pub const FACILITY_DIRECTMUSIC: HRESULT = 2168; +pub const FACILITY_DIRECT3D11: HRESULT = 2172; +pub const FACILITY_DIRECT3D10: HRESULT = 2169; +pub const FACILITY_DIRECT2D: HRESULT = 2201; +pub const FACILITY_DAF: HRESULT = 100; +pub const FACILITY_DEPLOYMENT_SERVICES_UTIL: HRESULT = 260; +pub const FACILITY_DEPLOYMENT_SERVICES_TRANSPORT_MANAGEMENT: HRESULT = 272; +pub const FACILITY_DEPLOYMENT_SERVICES_TFTP: HRESULT = 264; +pub const FACILITY_DEPLOYMENT_SERVICES_PXE: HRESULT = 263; +pub const FACILITY_DEPLOYMENT_SERVICES_MULTICAST_SERVER: HRESULT = 289; +pub const FACILITY_DEPLOYMENT_SERVICES_MULTICAST_CLIENT: HRESULT = 290; +pub const FACILITY_DEPLOYMENT_SERVICES_MANAGEMENT: HRESULT = 259; +pub const FACILITY_DEPLOYMENT_SERVICES_IMAGING: HRESULT = 258; +pub const FACILITY_DEPLOYMENT_SERVICES_DRIVER_PROVISIONING: HRESULT = 278; +pub const FACILITY_DEPLOYMENT_SERVICES_SERVER: HRESULT = 257; +pub const FACILITY_DEPLOYMENT_SERVICES_CONTENT_PROVIDER: HRESULT = 293; +pub const FACILITY_DEPLOYMENT_SERVICES_BINLSVC: HRESULT = 261; +pub const FACILITY_DEFRAG: HRESULT = 2304; +pub const FACILITY_DEBUGGERS: HRESULT = 176; +pub const FACILITY_CONFIGURATION: HRESULT = 33; +pub const FACILITY_COMPLUS: HRESULT = 17; +pub const FACILITY_USERMODE_COMMONLOG: HRESULT = 26; +pub const FACILITY_CMI: HRESULT = 54; +pub const FACILITY_CERT: HRESULT = 11; +pub const FACILITY_BLUETOOTH_ATT: HRESULT = 101; +pub const FACILITY_BCD: HRESULT = 57; +pub const FACILITY_BACKGROUNDCOPY: HRESULT = 32; +pub const FACILITY_AUDIOSTREAMING: HRESULT = 1094; +pub const FACILITY_AUDCLNT: HRESULT = 2185; +pub const FACILITY_AUDIO: HRESULT = 102; +pub const FACILITY_ACTION_QUEUE: HRESULT = 44; +pub const FACILITY_ACS: HRESULT = 20; +pub const FACILITY_AAF: HRESULT = 18; +pub const ERROR_SUCCESS: DWORD = 0; +pub const NO_ERROR: DWORD = 0; +pub const SEC_E_OK: HRESULT = 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_DEVICE_SUPPORT_IN_PROGRESS: DWORD = 171; +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_VIRUS_INFECTED: DWORD = 225; +pub const ERROR_VIRUS_DELETED: DWORD = 226; +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 WAIT_TIMEOUT: DWORD = 258; +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_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: DWORD = 304; +pub const ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: DWORD = 305; +pub const ERROR_SECURITY_STREAM_IS_INCONSISTENT: DWORD = 306; +pub const ERROR_INVALID_LOCK_RANGE: DWORD = 307; +pub const ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT: DWORD = 308; +pub const ERROR_NOTIFICATION_GUID_ALREADY_DEFINED: DWORD = 309; +pub const ERROR_INVALID_EXCEPTION_HANDLER: DWORD = 310; +pub const ERROR_DUPLICATE_PRIVILEGES: DWORD = 311; +pub const ERROR_NO_RANGES_PROCESSED: DWORD = 312; +pub const ERROR_NOT_ALLOWED_ON_SYSTEM_FILE: DWORD = 313; +pub const ERROR_DISK_RESOURCES_EXHAUSTED: DWORD = 314; +pub const ERROR_INVALID_TOKEN: DWORD = 315; +pub const ERROR_DEVICE_FEATURE_NOT_SUPPORTED: DWORD = 316; +pub const ERROR_MR_MID_NOT_FOUND: DWORD = 317; +pub const ERROR_SCOPE_NOT_FOUND: DWORD = 318; +pub const ERROR_UNDEFINED_SCOPE: DWORD = 319; +pub const ERROR_INVALID_CAP: DWORD = 320; +pub const ERROR_DEVICE_UNREACHABLE: DWORD = 321; +pub const ERROR_DEVICE_NO_RESOURCES: DWORD = 322; +pub const ERROR_DATA_CHECKSUM_ERROR: DWORD = 323; +pub const ERROR_INTERMIXED_KERNEL_EA_OPERATION: DWORD = 324; +pub const ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED: DWORD = 326; +pub const ERROR_OFFSET_ALIGNMENT_VIOLATION: DWORD = 327; +pub const ERROR_INVALID_FIELD_IN_PARAMETER_LIST: DWORD = 328; +pub const ERROR_OPERATION_IN_PROGRESS: DWORD = 329; +pub const ERROR_BAD_DEVICE_PATH: DWORD = 330; +pub const ERROR_TOO_MANY_DESCRIPTORS: DWORD = 331; +pub const ERROR_SCRUB_DATA_DISABLED: DWORD = 332; +pub const ERROR_NOT_REDUNDANT_STORAGE: DWORD = 333; +pub const ERROR_RESIDENT_FILE_NOT_SUPPORTED: DWORD = 334; +pub const ERROR_COMPRESSED_FILE_NOT_SUPPORTED: DWORD = 335; +pub const ERROR_DIRECTORY_NOT_SUPPORTED: DWORD = 336; +pub const ERROR_NOT_READ_FROM_COPY: DWORD = 337; +pub const ERROR_FT_WRITE_FAILURE: DWORD = 338; +pub const ERROR_FT_DI_SCAN_REQUIRED: DWORD = 339; +pub const ERROR_INVALID_KERNEL_INFO_VERSION: DWORD = 340; +pub const ERROR_INVALID_PEP_INFO_VERSION: DWORD = 341; +pub const ERROR_OBJECT_NOT_EXTERNALLY_BACKED: DWORD = 342; +pub const ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN: DWORD = 343; +pub const ERROR_FAIL_NOACTION_REBOOT: DWORD = 350; +pub const ERROR_FAIL_SHUTDOWN: DWORD = 351; +pub const ERROR_FAIL_RESTART: DWORD = 352; +pub const ERROR_MAX_SESSIONS_REACHED: DWORD = 353; +pub const ERROR_THREAD_MODE_ALREADY_BACKGROUND: DWORD = 400; +pub const ERROR_THREAD_MODE_NOT_BACKGROUND: DWORD = 401; +pub const ERROR_PROCESS_MODE_ALREADY_BACKGROUND: DWORD = 402; +pub const ERROR_PROCESS_MODE_NOT_BACKGROUND: DWORD = 403; +pub const ERROR_DEVICE_HARDWARE_ERROR: DWORD = 483; +pub const ERROR_INVALID_ADDRESS: DWORD = 487; +pub const ERROR_USER_PROFILE_LOAD: DWORD = 500; +pub const ERROR_ARITHMETIC_OVERFLOW: DWORD = 534; +pub const ERROR_PIPE_CONNECTED: DWORD = 535; +pub const ERROR_PIPE_LISTENING: DWORD = 536; +pub const ERROR_VERIFIER_STOP: DWORD = 537; +pub const ERROR_ABIOS_ERROR: DWORD = 538; +pub const ERROR_WX86_WARNING: DWORD = 539; +pub const ERROR_WX86_ERROR: DWORD = 540; +pub const ERROR_TIMER_NOT_CANCELED: DWORD = 541; +pub const ERROR_UNWIND: DWORD = 542; +pub const ERROR_BAD_STACK: DWORD = 543; +pub const ERROR_INVALID_UNWIND_TARGET: DWORD = 544; +pub const ERROR_INVALID_PORT_ATTRIBUTES: DWORD = 545; +pub const ERROR_PORT_MESSAGE_TOO_LONG: DWORD = 546; +pub const ERROR_INVALID_QUOTA_LOWER: DWORD = 547; +pub const ERROR_DEVICE_ALREADY_ATTACHED: DWORD = 548; +pub const ERROR_INSTRUCTION_MISALIGNMENT: DWORD = 549; +pub const ERROR_PROFILING_NOT_STARTED: DWORD = 550; +pub const ERROR_PROFILING_NOT_STOPPED: DWORD = 551; +pub const ERROR_COULD_NOT_INTERPRET: DWORD = 552; +pub const ERROR_PROFILING_AT_LIMIT: DWORD = 553; +pub const ERROR_CANT_WAIT: DWORD = 554; +pub const ERROR_CANT_TERMINATE_SELF: DWORD = 555; +pub const ERROR_UNEXPECTED_MM_CREATE_ERR: DWORD = 556; +pub const ERROR_UNEXPECTED_MM_MAP_ERROR: DWORD = 557; +pub const ERROR_UNEXPECTED_MM_EXTEND_ERR: DWORD = 558; +pub const ERROR_BAD_FUNCTION_TABLE: DWORD = 559; +pub const ERROR_NO_GUID_TRANSLATION: DWORD = 560; +pub const ERROR_INVALID_LDT_SIZE: DWORD = 561; +pub const ERROR_INVALID_LDT_OFFSET: DWORD = 563; +pub const ERROR_INVALID_LDT_DESCRIPTOR: DWORD = 564; +pub const ERROR_TOO_MANY_THREADS: DWORD = 565; +pub const ERROR_THREAD_NOT_IN_PROCESS: DWORD = 566; +pub const ERROR_PAGEFILE_QUOTA_EXCEEDED: DWORD = 567; +pub const ERROR_LOGON_SERVER_CONFLICT: DWORD = 568; +pub const ERROR_SYNCHRONIZATION_REQUIRED: DWORD = 569; +pub const ERROR_NET_OPEN_FAILED: DWORD = 570; +pub const ERROR_IO_PRIVILEGE_FAILED: DWORD = 571; +pub const ERROR_CONTROL_C_EXIT: DWORD = 572; +pub const ERROR_MISSING_SYSTEMFILE: DWORD = 573; +pub const ERROR_UNHANDLED_EXCEPTION: DWORD = 574; +pub const ERROR_APP_INIT_FAILURE: DWORD = 575; +pub const ERROR_PAGEFILE_CREATE_FAILED: DWORD = 576; +pub const ERROR_INVALID_IMAGE_HASH: DWORD = 577; +pub const ERROR_NO_PAGEFILE: DWORD = 578; +pub const ERROR_ILLEGAL_FLOAT_CONTEXT: DWORD = 579; +pub const ERROR_NO_EVENT_PAIR: DWORD = 580; +pub const ERROR_DOMAIN_CTRLR_CONFIG_ERROR: DWORD = 581; +pub const ERROR_ILLEGAL_CHARACTER: DWORD = 582; +pub const ERROR_UNDEFINED_CHARACTER: DWORD = 583; +pub const ERROR_FLOPPY_VOLUME: DWORD = 584; +pub const ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT: DWORD = 585; +pub const ERROR_BACKUP_CONTROLLER: DWORD = 586; +pub const ERROR_MUTANT_LIMIT_EXCEEDED: DWORD = 587; +pub const ERROR_FS_DRIVER_REQUIRED: DWORD = 588; +pub const ERROR_CANNOT_LOAD_REGISTRY_FILE: DWORD = 589; +pub const ERROR_DEBUG_ATTACH_FAILED: DWORD = 590; +pub const ERROR_SYSTEM_PROCESS_TERMINATED: DWORD = 591; +pub const ERROR_DATA_NOT_ACCEPTED: DWORD = 592; +pub const ERROR_VDM_HARD_ERROR: DWORD = 593; +pub const ERROR_DRIVER_CANCEL_TIMEOUT: DWORD = 594; +pub const ERROR_REPLY_MESSAGE_MISMATCH: DWORD = 595; +pub const ERROR_LOST_WRITEBEHIND_DATA: DWORD = 596; +pub const ERROR_CLIENT_SERVER_PARAMETERS_INVALID: DWORD = 597; +pub const ERROR_NOT_TINY_STREAM: DWORD = 598; +pub const ERROR_STACK_OVERFLOW_READ: DWORD = 599; +pub const ERROR_CONVERT_TO_LARGE: DWORD = 600; +pub const ERROR_FOUND_OUT_OF_SCOPE: DWORD = 601; +pub const ERROR_ALLOCATE_BUCKET: DWORD = 602; +pub const ERROR_MARSHALL_OVERFLOW: DWORD = 603; +pub const ERROR_INVALID_VARIANT: DWORD = 604; +pub const ERROR_BAD_COMPRESSION_BUFFER: DWORD = 605; +pub const ERROR_AUDIT_FAILED: DWORD = 606; +pub const ERROR_TIMER_RESOLUTION_NOT_SET: DWORD = 607; +pub const ERROR_INSUFFICIENT_LOGON_INFO: DWORD = 608; +pub const ERROR_BAD_DLL_ENTRYPOINT: DWORD = 609; +pub const ERROR_BAD_SERVICE_ENTRYPOINT: DWORD = 610; +pub const ERROR_IP_ADDRESS_CONFLICT1: DWORD = 611; +pub const ERROR_IP_ADDRESS_CONFLICT2: DWORD = 612; +pub const ERROR_REGISTRY_QUOTA_LIMIT: DWORD = 613; +pub const ERROR_NO_CALLBACK_ACTIVE: DWORD = 614; +pub const ERROR_PWD_TOO_SHORT: DWORD = 615; +pub const ERROR_PWD_TOO_RECENT: DWORD = 616; +pub const ERROR_PWD_HISTORY_CONFLICT: DWORD = 617; +pub const ERROR_UNSUPPORTED_COMPRESSION: DWORD = 618; +pub const ERROR_INVALID_HW_PROFILE: DWORD = 619; +pub const ERROR_INVALID_PLUGPLAY_DEVICE_PATH: DWORD = 620; +pub const ERROR_QUOTA_LIST_INCONSISTENT: DWORD = 621; +pub const ERROR_EVALUATION_EXPIRATION: DWORD = 622; +pub const ERROR_ILLEGAL_DLL_RELOCATION: DWORD = 623; +pub const ERROR_DLL_INIT_FAILED_LOGOFF: DWORD = 624; +pub const ERROR_VALIDATE_CONTINUE: DWORD = 625; +pub const ERROR_NO_MORE_MATCHES: DWORD = 626; +pub const ERROR_RANGE_LIST_CONFLICT: DWORD = 627; +pub const ERROR_SERVER_SID_MISMATCH: DWORD = 628; +pub const ERROR_CANT_ENABLE_DENY_ONLY: DWORD = 629; +pub const ERROR_FLOAT_MULTIPLE_FAULTS: DWORD = 630; +pub const ERROR_FLOAT_MULTIPLE_TRAPS: DWORD = 631; +pub const ERROR_NOINTERFACE: DWORD = 632; +pub const ERROR_DRIVER_FAILED_SLEEP: DWORD = 633; +pub const ERROR_CORRUPT_SYSTEM_FILE: DWORD = 634; +pub const ERROR_COMMITMENT_MINIMUM: DWORD = 635; +pub const ERROR_PNP_RESTART_ENUMERATION: DWORD = 636; +pub const ERROR_SYSTEM_IMAGE_BAD_SIGNATURE: DWORD = 637; +pub const ERROR_PNP_REBOOT_REQUIRED: DWORD = 638; +pub const ERROR_INSUFFICIENT_POWER: DWORD = 639; +pub const ERROR_MULTIPLE_FAULT_VIOLATION: DWORD = 640; +pub const ERROR_SYSTEM_SHUTDOWN: DWORD = 641; +pub const ERROR_PORT_NOT_SET: DWORD = 642; +pub const ERROR_DS_VERSION_CHECK_FAILURE: DWORD = 643; +pub const ERROR_RANGE_NOT_FOUND: DWORD = 644; +pub const ERROR_NOT_SAFE_MODE_DRIVER: DWORD = 646; +pub const ERROR_FAILED_DRIVER_ENTRY: DWORD = 647; +pub const ERROR_DEVICE_ENUMERATION_ERROR: DWORD = 648; +pub const ERROR_MOUNT_POINT_NOT_RESOLVED: DWORD = 649; +pub const ERROR_INVALID_DEVICE_OBJECT_PARAMETER: DWORD = 650; +pub const ERROR_MCA_OCCURED: DWORD = 651; +pub const ERROR_DRIVER_DATABASE_ERROR: DWORD = 652; +pub const ERROR_SYSTEM_HIVE_TOO_LARGE: DWORD = 653; +pub const ERROR_DRIVER_FAILED_PRIOR_UNLOAD: DWORD = 654; +pub const ERROR_VOLSNAP_PREPARE_HIBERNATE: DWORD = 655; +pub const ERROR_HIBERNATION_FAILURE: DWORD = 656; +pub const ERROR_PWD_TOO_LONG: DWORD = 657; +pub const ERROR_FILE_SYSTEM_LIMITATION: DWORD = 665; +pub const ERROR_ASSERTION_FAILURE: DWORD = 668; +pub const ERROR_ACPI_ERROR: DWORD = 669; +pub const ERROR_WOW_ASSERTION: DWORD = 670; +pub const ERROR_PNP_BAD_MPS_TABLE: DWORD = 671; +pub const ERROR_PNP_TRANSLATION_FAILED: DWORD = 672; +pub const ERROR_PNP_IRQ_TRANSLATION_FAILED: DWORD = 673; +pub const ERROR_PNP_INVALID_ID: DWORD = 674; +pub const ERROR_WAKE_SYSTEM_DEBUGGER: DWORD = 675; +pub const ERROR_HANDLES_CLOSED: DWORD = 676; +pub const ERROR_EXTRANEOUS_INFORMATION: DWORD = 677; +pub const ERROR_RXACT_COMMIT_NECESSARY: DWORD = 678; +pub const ERROR_MEDIA_CHECK: DWORD = 679; +pub const ERROR_GUID_SUBSTITUTION_MADE: DWORD = 680; +pub const ERROR_STOPPED_ON_SYMLINK: DWORD = 681; +pub const ERROR_LONGJUMP: DWORD = 682; +pub const ERROR_PLUGPLAY_QUERY_VETOED: DWORD = 683; +pub const ERROR_UNWIND_CONSOLIDATE: DWORD = 684; +pub const ERROR_REGISTRY_HIVE_RECOVERED: DWORD = 685; +pub const ERROR_DLL_MIGHT_BE_INSECURE: DWORD = 686; +pub const ERROR_DLL_MIGHT_BE_INCOMPATIBLE: DWORD = 687; +pub const ERROR_DBG_EXCEPTION_NOT_HANDLED: DWORD = 688; +pub const ERROR_DBG_REPLY_LATER: DWORD = 689; +pub const ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE: DWORD = 690; +pub const ERROR_DBG_TERMINATE_THREAD: DWORD = 691; +pub const ERROR_DBG_TERMINATE_PROCESS: DWORD = 692; +pub const ERROR_DBG_CONTROL_C: DWORD = 693; +pub const ERROR_DBG_PRINTEXCEPTION_C: DWORD = 694; +pub const ERROR_DBG_RIPEXCEPTION: DWORD = 695; +pub const ERROR_DBG_CONTROL_BREAK: DWORD = 696; +pub const ERROR_DBG_COMMAND_EXCEPTION: DWORD = 697; +pub const ERROR_OBJECT_NAME_EXISTS: DWORD = 698; +pub const ERROR_THREAD_WAS_SUSPENDED: DWORD = 699; +pub const ERROR_IMAGE_NOT_AT_BASE: DWORD = 700; +pub const ERROR_RXACT_STATE_CREATED: DWORD = 701; +pub const ERROR_SEGMENT_NOTIFICATION: DWORD = 702; +pub const ERROR_BAD_CURRENT_DIRECTORY: DWORD = 703; +pub const ERROR_FT_READ_RECOVERY_FROM_BACKUP: DWORD = 704; +pub const ERROR_FT_WRITE_RECOVERY: DWORD = 705; +pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH: DWORD = 706; +pub const ERROR_RECEIVE_PARTIAL: DWORD = 707; +pub const ERROR_RECEIVE_EXPEDITED: DWORD = 708; +pub const ERROR_RECEIVE_PARTIAL_EXPEDITED: DWORD = 709; +pub const ERROR_EVENT_DONE: DWORD = 710; +pub const ERROR_EVENT_PENDING: DWORD = 711; +pub const ERROR_CHECKING_FILE_SYSTEM: DWORD = 712; +pub const ERROR_FATAL_APP_EXIT: DWORD = 713; +pub const ERROR_PREDEFINED_HANDLE: DWORD = 714; +pub const ERROR_WAS_UNLOCKED: DWORD = 715; +pub const ERROR_SERVICE_NOTIFICATION: DWORD = 716; +pub const ERROR_WAS_LOCKED: DWORD = 717; +pub const ERROR_LOG_HARD_ERROR: DWORD = 718; +pub const ERROR_ALREADY_WIN32: DWORD = 719; +pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE: DWORD = 720; +pub const ERROR_NO_YIELD_PERFORMED: DWORD = 721; +pub const ERROR_TIMER_RESUME_IGNORED: DWORD = 722; +pub const ERROR_ARBITRATION_UNHANDLED: DWORD = 723; +pub const ERROR_CARDBUS_NOT_SUPPORTED: DWORD = 724; +pub const ERROR_MP_PROCESSOR_MISMATCH: DWORD = 725; +pub const ERROR_HIBERNATED: DWORD = 726; +pub const ERROR_RESUME_HIBERNATION: DWORD = 727; +pub const ERROR_FIRMWARE_UPDATED: DWORD = 728; +pub const ERROR_DRIVERS_LEAKING_LOCKED_PAGES: DWORD = 729; +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_ELEVATION_REQUIRED: DWORD = 740; +pub const ERROR_REPARSE: DWORD = 741; +pub const ERROR_OPLOCK_BREAK_IN_PROGRESS: DWORD = 742; +pub const ERROR_VOLUME_MOUNTED: DWORD = 743; +pub const ERROR_RXACT_COMMITTED: DWORD = 744; +pub const ERROR_NOTIFY_CLEANUP: DWORD = 745; +pub const ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED: DWORD = 746; +pub const ERROR_PAGE_FAULT_TRANSITION: DWORD = 747; +pub const ERROR_PAGE_FAULT_DEMAND_ZERO: DWORD = 748; +pub const ERROR_PAGE_FAULT_COPY_ON_WRITE: DWORD = 749; +pub const ERROR_PAGE_FAULT_GUARD_PAGE: DWORD = 750; +pub const ERROR_PAGE_FAULT_PAGING_FILE: DWORD = 751; +pub const ERROR_CACHE_PAGE_LOCKED: DWORD = 752; +pub const ERROR_CRASH_DUMP: DWORD = 753; +pub const ERROR_BUFFER_ALL_ZEROS: DWORD = 754; +pub const ERROR_REPARSE_OBJECT: DWORD = 755; +pub const ERROR_RESOURCE_REQUIREMENTS_CHANGED: DWORD = 756; +pub const ERROR_TRANSLATION_COMPLETE: DWORD = 757; +pub const ERROR_NOTHING_TO_TERMINATE: DWORD = 758; +pub const ERROR_PROCESS_NOT_IN_JOB: DWORD = 759; +pub const ERROR_PROCESS_IN_JOB: DWORD = 760; +pub const ERROR_VOLSNAP_HIBERNATE_READY: DWORD = 761; +pub const ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY: DWORD = 762; +pub const ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED: DWORD = 763; +pub const ERROR_INTERRUPT_STILL_CONNECTED: DWORD = 764; +pub const ERROR_WAIT_FOR_OPLOCK: DWORD = 765; +pub const ERROR_DBG_EXCEPTION_HANDLED: DWORD = 766; +pub const ERROR_DBG_CONTINUE: DWORD = 767; +pub const ERROR_CALLBACK_POP_STACK: DWORD = 768; +pub const ERROR_COMPRESSION_DISABLED: DWORD = 769; +pub const ERROR_CANTFETCHBACKWARDS: DWORD = 770; +pub const ERROR_CANTSCROLLBACKWARDS: DWORD = 771; +pub const ERROR_ROWSNOTRELEASED: DWORD = 772; +pub const ERROR_BAD_ACCESSOR_FLAGS: DWORD = 773; +pub const ERROR_ERRORS_ENCOUNTERED: DWORD = 774; +pub const ERROR_NOT_CAPABLE: DWORD = 775; +pub const ERROR_REQUEST_OUT_OF_SEQUENCE: DWORD = 776; +pub const ERROR_VERSION_PARSE_ERROR: DWORD = 777; +pub const ERROR_BADSTARTPOSITION: DWORD = 778; +pub const ERROR_MEMORY_HARDWARE: DWORD = 779; +pub const ERROR_DISK_REPAIR_DISABLED: DWORD = 780; +pub const ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: DWORD = 781; +pub const ERROR_SYSTEM_POWERSTATE_TRANSITION: DWORD = 782; +pub const ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: DWORD = 783; +pub const ERROR_MCA_EXCEPTION: DWORD = 784; +pub const ERROR_ACCESS_AUDIT_BY_POLICY: DWORD = 785; +pub const ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: DWORD = 786; +pub const ERROR_ABANDON_HIBERFILE: DWORD = 787; +pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: DWORD = 788; +pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: DWORD = 789; +pub const ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: DWORD = 790; +pub const ERROR_BAD_MCFG_TABLE: DWORD = 791; +pub const ERROR_DISK_REPAIR_REDIRECTED: DWORD = 792; +pub const ERROR_DISK_REPAIR_UNSUCCESSFUL: DWORD = 793; +pub const ERROR_CORRUPT_LOG_OVERFULL: DWORD = 794; +pub const ERROR_CORRUPT_LOG_CORRUPTED: DWORD = 795; +pub const ERROR_CORRUPT_LOG_UNAVAILABLE: DWORD = 796; +pub const ERROR_CORRUPT_LOG_DELETED_FULL: DWORD = 797; +pub const ERROR_CORRUPT_LOG_CLEARED: DWORD = 798; +pub const ERROR_ORPHAN_NAME_EXHAUSTED: DWORD = 799; +pub const ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE: DWORD = 800; +pub const ERROR_CANNOT_GRANT_REQUESTED_OPLOCK: DWORD = 801; +pub const ERROR_CANNOT_BREAK_OPLOCK: DWORD = 802; +pub const ERROR_OPLOCK_HANDLE_CLOSED: DWORD = 803; +pub const ERROR_NO_ACE_CONDITION: DWORD = 804; +pub const ERROR_INVALID_ACE_CONDITION: DWORD = 805; +pub const ERROR_FILE_HANDLE_REVOKED: DWORD = 806; +pub const ERROR_IMAGE_AT_DIFFERENT_BASE: DWORD = 807; +pub const ERROR_ENCRYPTED_IO_NOT_POSSIBLE: DWORD = 808; +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_SHUTDOWN_IS_SCHEDULED: DWORD = 1190; +pub const ERROR_SHUTDOWN_USERS_LOGGED_ON: DWORD = 1191; +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_INVALID_CRUNTIME_PARAMETER: DWORD = 1288; +pub const ERROR_BEYOND_VDL: DWORD = 1289; +pub const ERROR_INCOMPATIBLE_SERVICE_SID_TYPE: DWORD = 1290; +pub const ERROR_DRIVER_PROCESS_TERMINATED: DWORD = 1291; +pub const ERROR_IMPLEMENTATION_LIMIT: DWORD = 1292; +pub const ERROR_PROCESS_IS_PROTECTED: DWORD = 1293; +pub const ERROR_SERVICE_NOTIFY_CLIENT_LAGGING: DWORD = 1294; +pub const ERROR_DISK_QUOTA_EXCEEDED: DWORD = 1295; +pub const ERROR_CONTENT_BLOCKED: DWORD = 1296; +pub const ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE: DWORD = 1297; +pub const ERROR_APP_HANG: DWORD = 1298; +pub const ERROR_INVALID_LABEL: DWORD = 1299; +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_INVALID_TASK_NAME: DWORD = 1550; +pub const ERROR_INVALID_TASK_INDEX: DWORD = 1551; +pub const ERROR_THREAD_ALREADY_IN_TASK: DWORD = 1552; +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_PATCH_REMOVAL_UNSUPPORTED: DWORD = 1646; +pub const ERROR_UNKNOWN_PATCH: DWORD = 1647; +pub const ERROR_PATCH_NO_SEQUENCE: DWORD = 1648; +pub const ERROR_PATCH_REMOVAL_DISALLOWED: DWORD = 1649; +pub const ERROR_INVALID_PATCH_XML: DWORD = 1650; +pub const ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT: DWORD = 1651; +pub const ERROR_INSTALL_SERVICE_SAFEBOOT: DWORD = 1652; +pub const ERROR_FAIL_FAST_EXCEPTION: DWORD = 1653; +pub const ERROR_INSTALL_REJECTED: DWORD = 1654; +pub const ERROR_DYNAMIC_CODE_BLOCKED: DWORD = 1655; +pub const RPC_S_INVALID_STRING_BINDING: DWORD = 1700; +pub const RPC_S_WRONG_KIND_OF_BINDING: DWORD = 1701; +pub const RPC_S_INVALID_BINDING: DWORD = 1702; +pub const RPC_S_PROTSEQ_NOT_SUPPORTED: DWORD = 1703; +pub const RPC_S_INVALID_RPC_PROTSEQ: DWORD = 1704; +pub const RPC_S_INVALID_STRING_UUID: DWORD = 1705; +pub const RPC_S_INVALID_ENDPOINT_FORMAT: DWORD = 1706; +pub const RPC_S_INVALID_NET_ADDR: DWORD = 1707; +pub const RPC_S_NO_ENDPOINT_FOUND: DWORD = 1708; +pub const RPC_S_INVALID_TIMEOUT: DWORD = 1709; +pub const RPC_S_OBJECT_NOT_FOUND: DWORD = 1710; +pub const RPC_S_ALREADY_REGISTERED: DWORD = 1711; +pub const RPC_S_TYPE_ALREADY_REGISTERED: DWORD = 1712; +pub const RPC_S_ALREADY_LISTENING: DWORD = 1713; +pub const RPC_S_NO_PROTSEQS_REGISTERED: DWORD = 1714; +pub const RPC_S_NOT_LISTENING: DWORD = 1715; +pub const RPC_S_UNKNOWN_MGR_TYPE: DWORD = 1716; +pub const RPC_S_UNKNOWN_IF: DWORD = 1717; +pub const RPC_S_NO_BINDINGS: DWORD = 1718; +pub const RPC_S_NO_PROTSEQS: DWORD = 1719; +pub const RPC_S_CANT_CREATE_ENDPOINT: DWORD = 1720; +pub const RPC_S_OUT_OF_RESOURCES: DWORD = 1721; +pub const RPC_S_SERVER_UNAVAILABLE: DWORD = 1722; +pub const RPC_S_SERVER_TOO_BUSY: DWORD = 1723; +pub const RPC_S_INVALID_NETWORK_OPTIONS: DWORD = 1724; +pub const RPC_S_NO_CALL_ACTIVE: DWORD = 1725; +pub const RPC_S_CALL_FAILED: DWORD = 1726; +pub const RPC_S_CALL_FAILED_DNE: DWORD = 1727; +pub const RPC_S_PROTOCOL_ERROR: DWORD = 1728; +pub const RPC_S_PROXY_ACCESS_DENIED: DWORD = 1729; +pub const RPC_S_UNSUPPORTED_TRANS_SYN: DWORD = 1730; +pub const RPC_S_UNSUPPORTED_TYPE: DWORD = 1732; +pub const RPC_S_INVALID_TAG: DWORD = 1733; +pub const RPC_S_INVALID_BOUND: DWORD = 1734; +pub const RPC_S_NO_ENTRY_NAME: DWORD = 1735; +pub const RPC_S_INVALID_NAME_SYNTAX: DWORD = 1736; +pub const RPC_S_UNSUPPORTED_NAME_SYNTAX: DWORD = 1737; +pub const RPC_S_UUID_NO_ADDRESS: DWORD = 1739; +pub const RPC_S_DUPLICATE_ENDPOINT: DWORD = 1740; +pub const RPC_S_UNKNOWN_AUTHN_TYPE: DWORD = 1741; +pub const RPC_S_MAX_CALLS_TOO_SMALL: DWORD = 1742; +pub const RPC_S_STRING_TOO_LONG: DWORD = 1743; +pub const RPC_S_PROTSEQ_NOT_FOUND: DWORD = 1744; +pub const RPC_S_PROCNUM_OUT_OF_RANGE: DWORD = 1745; +pub const RPC_S_BINDING_HAS_NO_AUTH: DWORD = 1746; +pub const RPC_S_UNKNOWN_AUTHN_SERVICE: DWORD = 1747; +pub const RPC_S_UNKNOWN_AUTHN_LEVEL: DWORD = 1748; +pub const RPC_S_INVALID_AUTH_IDENTITY: DWORD = 1749; +pub const RPC_S_UNKNOWN_AUTHZ_SERVICE: DWORD = 1750; +pub const EPT_S_INVALID_ENTRY: DWORD = 1751; +pub const EPT_S_CANT_PERFORM_OP: DWORD = 1752; +pub const EPT_S_NOT_REGISTERED: DWORD = 1753; +pub const RPC_S_NOTHING_TO_EXPORT: DWORD = 1754; +pub const RPC_S_INCOMPLETE_NAME: DWORD = 1755; +pub const RPC_S_INVALID_VERS_OPTION: DWORD = 1756; +pub const RPC_S_NO_MORE_MEMBERS: DWORD = 1757; +pub const RPC_S_NOT_ALL_OBJS_UNEXPORTED: DWORD = 1758; +pub const RPC_S_INTERFACE_NOT_FOUND: DWORD = 1759; +pub const RPC_S_ENTRY_ALREADY_EXISTS: DWORD = 1760; +pub const RPC_S_ENTRY_NOT_FOUND: DWORD = 1761; +pub const RPC_S_NAME_SERVICE_UNAVAILABLE: DWORD = 1762; +pub const RPC_S_INVALID_NAF_ID: DWORD = 1763; +pub const RPC_S_CANNOT_SUPPORT: DWORD = 1764; +pub const RPC_S_NO_CONTEXT_AVAILABLE: DWORD = 1765; +pub const RPC_S_INTERNAL_ERROR: DWORD = 1766; +pub const RPC_S_ZERO_DIVIDE: DWORD = 1767; +pub const RPC_S_ADDRESS_ERROR: DWORD = 1768; +pub const RPC_S_FP_DIV_ZERO: DWORD = 1769; +pub const RPC_S_FP_UNDERFLOW: DWORD = 1770; +pub const RPC_S_FP_OVERFLOW: DWORD = 1771; +pub const RPC_X_NO_MORE_ENTRIES: DWORD = 1772; +pub const RPC_X_SS_CHAR_TRANS_OPEN_FAIL: DWORD = 1773; +pub const RPC_X_SS_CHAR_TRANS_SHORT_FILE: DWORD = 1774; +pub const RPC_X_SS_IN_NULL_CONTEXT: DWORD = 1775; +pub const RPC_X_SS_CONTEXT_DAMAGED: DWORD = 1777; +pub const RPC_X_SS_HANDLES_MISMATCH: DWORD = 1778; +pub const RPC_X_SS_CANNOT_GET_CALL_HANDLE: DWORD = 1779; +pub const RPC_X_NULL_REF_POINTER: DWORD = 1780; +pub const RPC_X_ENUM_VALUE_OUT_OF_RANGE: DWORD = 1781; +pub const RPC_X_BYTE_COUNT_TOO_SMALL: DWORD = 1782; +pub const RPC_X_BAD_STUB_DATA: DWORD = 1783; +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 RPC_S_CALL_IN_PROGRESS: DWORD = 1791; +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 RPC_S_NO_MORE_BINDINGS: DWORD = 1806; +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 RPC_S_NO_INTERFACES: DWORD = 1817; +pub const RPC_S_CALL_CANCELLED: DWORD = 1818; +pub const RPC_S_BINDING_INCOMPLETE: DWORD = 1819; +pub const RPC_S_COMM_FAILURE: DWORD = 1820; +pub const RPC_S_UNSUPPORTED_AUTHN_LEVEL: DWORD = 1821; +pub const RPC_S_NO_PRINC_NAME: DWORD = 1822; +pub const RPC_S_NOT_RPC_ERROR: DWORD = 1823; +pub const RPC_S_UUID_LOCAL_ONLY: DWORD = 1824; +pub const RPC_S_SEC_PKG_ERROR: DWORD = 1825; +pub const RPC_S_NOT_CANCELLED: DWORD = 1826; +pub const RPC_X_INVALID_ES_ACTION: DWORD = 1827; +pub const RPC_X_WRONG_ES_VERSION: DWORD = 1828; +pub const RPC_X_WRONG_STUB_VERSION: DWORD = 1829; +pub const RPC_X_INVALID_PIPE_OBJECT: DWORD = 1830; +pub const RPC_X_WRONG_PIPE_ORDER: DWORD = 1831; +pub const RPC_X_WRONG_PIPE_VERSION: DWORD = 1832; +pub const RPC_S_COOKIE_AUTH_FAILED: DWORD = 1833; +pub const RPC_S_GROUP_MEMBER_NOT_FOUND: DWORD = 1898; +pub const EPT_S_CANT_CREATE: DWORD = 1899; +pub const RPC_S_INVALID_OBJECT: DWORD = 1900; +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 OR_INVALID_OXID: DWORD = 1910; +pub const OR_INVALID_OID: DWORD = 1911; +pub const OR_INVALID_SET: DWORD = 1912; +pub const RPC_S_SEND_INCOMPLETE: DWORD = 1913; +pub const RPC_S_INVALID_ASYNC_HANDLE: DWORD = 1914; +pub const RPC_S_INVALID_ASYNC_CALL: DWORD = 1915; +pub const RPC_X_PIPE_CLOSED: DWORD = 1916; +pub const RPC_X_PIPE_DISCIPLINE_ERROR: DWORD = 1917; +pub const RPC_X_PIPE_EMPTY: DWORD = 1918; +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 RPC_S_ENTRY_TYPE_MISMATCH: DWORD = 1922; +pub const RPC_S_NOT_ALL_OBJS_EXPORTED: DWORD = 1923; +pub const RPC_S_INTERFACE_NOT_EXPORTED: DWORD = 1924; +pub const RPC_S_PROFILE_NOT_ADDED: DWORD = 1925; +pub const RPC_S_PRF_ELT_NOT_ADDED: DWORD = 1926; +pub const RPC_S_PRF_ELT_NOT_REMOVED: DWORD = 1927; +pub const RPC_S_GRP_ELT_NOT_ADDED: DWORD = 1928; +pub const RPC_S_GRP_ELT_NOT_REMOVED: DWORD = 1929; +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_NTLM_BLOCKED: DWORD = 1937; +pub const ERROR_PASSWORD_CHANGE_REQUIRED: DWORD = 1938; +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_PROFILE_DOES_NOT_MATCH_DEVICE: DWORD = 2023; +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_PRINTER_DRIVER_PACKAGE_IN_USE: DWORD = 3015; +pub const ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND: DWORD = 3016; +pub const ERROR_FAIL_REBOOT_REQUIRED: DWORD = 3017; +pub const ERROR_FAIL_REBOOT_INITIATED: DWORD = 3018; +pub const ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED: DWORD = 3019; +pub const ERROR_PRINT_JOB_RESTART_REQUIRED: DWORD = 3020; +pub const ERROR_INVALID_PRINTER_DRIVER_MANIFEST: DWORD = 3021; +pub const ERROR_PRINTER_NOT_SHAREABLE: DWORD = 3022; +pub const ERROR_REQUEST_PAUSED: DWORD = 3050; +pub const ERROR_IO_REISSUE_AS_CACHED: DWORD = 3950; +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 PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED: DWORD = 4050; +pub const PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO: DWORD = 4051; +pub const PEERDIST_ERROR_MISSING_DATA: DWORD = 4052; +pub const PEERDIST_ERROR_NO_MORE: DWORD = 4053; +pub const PEERDIST_ERROR_NOT_INITIALIZED: DWORD = 4054; +pub const PEERDIST_ERROR_ALREADY_INITIALIZED: DWORD = 4055; +pub const PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS: DWORD = 4056; +pub const PEERDIST_ERROR_INVALIDATED: DWORD = 4057; +pub const PEERDIST_ERROR_ALREADY_EXISTS: DWORD = 4058; +pub const PEERDIST_ERROR_OPERATION_NOTFOUND: DWORD = 4059; +pub const PEERDIST_ERROR_ALREADY_COMPLETED: DWORD = 4060; +pub const PEERDIST_ERROR_OUT_OF_BOUNDS: DWORD = 4061; +pub const PEERDIST_ERROR_VERSION_UNSUPPORTED: DWORD = 4062; +pub const PEERDIST_ERROR_INVALID_CONFIGURATION: DWORD = 4063; +pub const PEERDIST_ERROR_NOT_LICENSED: DWORD = 4064; +pub const PEERDIST_ERROR_SERVICE_UNAVAILABLE: DWORD = 4065; +pub const PEERDIST_ERROR_TRUST_FAILURE: DWORD = 4066; +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_NOT_APPCONTAINER: DWORD = 4250; +pub const ERROR_APPCONTAINER_REQUIRED: DWORD = 4251; +pub const ERROR_NOT_SUPPORTED_IN_APPCONTAINER: DWORD = 4252; +pub const ERROR_INVALID_PACKAGE_SID_LENGTH: DWORD = 4253; +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_APP_DATA_NOT_FOUND: DWORD = 4400; +pub const ERROR_APP_DATA_EXPIRED: DWORD = 4401; +pub const ERROR_APP_DATA_CORRUPT: DWORD = 4402; +pub const ERROR_APP_DATA_LIMIT_EXCEEDED: DWORD = 4403; +pub const ERROR_APP_DATA_REBOOT_REQUIRED: DWORD = 4404; +pub const ERROR_SECUREBOOT_ROLLBACK_DETECTED: DWORD = 4420; +pub const ERROR_SECUREBOOT_POLICY_VIOLATION: DWORD = 4421; +pub const ERROR_SECUREBOOT_INVALID_POLICY: DWORD = 4422; +pub const ERROR_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND: DWORD = 4423; +pub const ERROR_SECUREBOOT_POLICY_NOT_SIGNED: DWORD = 4424; +pub const ERROR_SECUREBOOT_NOT_ENABLED: DWORD = 4425; +pub const ERROR_SECUREBOOT_FILE_REPLACED: DWORD = 4426; +pub const ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED: DWORD = 4440; +pub const ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: DWORD = 4441; +pub const ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED: DWORD = 4442; +pub const ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: DWORD = 4443; +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_NO_ADMIN_ACCESS_POINT: DWORD = 5090; +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_CLUSTER_NO_NET_ADAPTERS: DWORD = 5906; +pub const ERROR_CLUSTER_POISONED: DWORD = 5907; +pub const ERROR_CLUSTER_GROUP_MOVING: DWORD = 5908; +pub const ERROR_CLUSTER_RESOURCE_TYPE_BUSY: DWORD = 5909; +pub const ERROR_RESOURCE_CALL_TIMED_OUT: DWORD = 5910; +pub const ERROR_INVALID_CLUSTER_IPV6_ADDRESS: DWORD = 5911; +pub const ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION: DWORD = 5912; +pub const ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS: DWORD = 5913; +pub const ERROR_CLUSTER_PARTIAL_SEND: DWORD = 5914; +pub const ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION: DWORD = 5915; +pub const ERROR_CLUSTER_INVALID_STRING_TERMINATION: DWORD = 5916; +pub const ERROR_CLUSTER_INVALID_STRING_FORMAT: DWORD = 5917; +pub const ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS: DWORD = 5918; +pub const ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS: DWORD = 5919; +pub const ERROR_CLUSTER_NULL_DATA: DWORD = 5920; +pub const ERROR_CLUSTER_PARTIAL_READ: DWORD = 5921; +pub const ERROR_CLUSTER_PARTIAL_WRITE: DWORD = 5922; +pub const ERROR_CLUSTER_CANT_DESERIALIZE_DATA: DWORD = 5923; +pub const ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT: DWORD = 5924; +pub const ERROR_CLUSTER_NO_QUORUM: DWORD = 5925; +pub const ERROR_CLUSTER_INVALID_IPV6_NETWORK: DWORD = 5926; +pub const ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK: DWORD = 5927; +pub const ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP: DWORD = 5928; +pub const ERROR_DEPENDENCY_TREE_TOO_COMPLEX: DWORD = 5929; +pub const ERROR_EXCEPTION_IN_RESOURCE_CALL: DWORD = 5930; +pub const ERROR_CLUSTER_RHS_FAILED_INITIALIZATION: DWORD = 5931; +pub const ERROR_CLUSTER_NOT_INSTALLED: DWORD = 5932; +pub const ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE: DWORD = 5933; +pub const ERROR_CLUSTER_MAX_NODES_IN_CLUSTER: DWORD = 5934; +pub const ERROR_CLUSTER_TOO_MANY_NODES: DWORD = 5935; +pub const ERROR_CLUSTER_OBJECT_ALREADY_USED: DWORD = 5936; +pub const ERROR_NONCORE_GROUPS_FOUND: DWORD = 5937; +pub const ERROR_FILE_SHARE_RESOURCE_CONFLICT: DWORD = 5938; +pub const ERROR_CLUSTER_EVICT_INVALID_REQUEST: DWORD = 5939; +pub const ERROR_CLUSTER_SINGLETON_RESOURCE: DWORD = 5940; +pub const ERROR_CLUSTER_GROUP_SINGLETON_RESOURCE: DWORD = 5941; +pub const ERROR_CLUSTER_RESOURCE_PROVIDER_FAILED: DWORD = 5942; +pub const ERROR_CLUSTER_RESOURCE_CONFIGURATION_ERROR: DWORD = 5943; +pub const ERROR_CLUSTER_GROUP_BUSY: DWORD = 5944; +pub const ERROR_CLUSTER_NOT_SHARED_VOLUME: DWORD = 5945; +pub const ERROR_CLUSTER_INVALID_SECURITY_DESCRIPTOR: DWORD = 5946; +pub const ERROR_CLUSTER_SHARED_VOLUMES_IN_USE: DWORD = 5947; +pub const ERROR_CLUSTER_USE_SHARED_VOLUMES_API: DWORD = 5948; +pub const ERROR_CLUSTER_BACKUP_IN_PROGRESS: DWORD = 5949; +pub const ERROR_NON_CSV_PATH: DWORD = 5950; +pub const ERROR_CSV_VOLUME_NOT_LOCAL: DWORD = 5951; +pub const ERROR_CLUSTER_WATCHDOG_TERMINATING: DWORD = 5952; +pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_INCOMPATIBLE_NODES: DWORD = 5953; +pub const ERROR_CLUSTER_INVALID_NODE_WEIGHT: DWORD = 5954; +pub const ERROR_CLUSTER_RESOURCE_VETOED_CALL: DWORD = 5955; +pub const ERROR_RESMON_SYSTEM_RESOURCES_LACKING: DWORD = 5956; +pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_DESTINATION: DWORD = 5957; +pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_SOURCE: DWORD = 5958; +pub const ERROR_CLUSTER_GROUP_QUEUED: DWORD = 5959; +pub const ERROR_CLUSTER_RESOURCE_LOCKED_STATUS: DWORD = 5960; +pub const ERROR_CLUSTER_SHARED_VOLUME_FAILOVER_NOT_ALLOWED: DWORD = 5961; +pub const ERROR_CLUSTER_NODE_DRAIN_IN_PROGRESS: DWORD = 5962; +pub const ERROR_CLUSTER_DISK_NOT_CONNECTED: DWORD = 5963; +pub const ERROR_DISK_NOT_CSV_CAPABLE: DWORD = 5964; +pub const ERROR_RESOURCE_NOT_IN_AVAILABLE_STORAGE: DWORD = 5965; +pub const ERROR_CLUSTER_SHARED_VOLUME_REDIRECTED: DWORD = 5966; +pub const ERROR_CLUSTER_SHARED_VOLUME_NOT_REDIRECTED: DWORD = 5967; +pub const ERROR_CLUSTER_CANNOT_RETURN_PROPERTIES: DWORD = 5968; +pub const ERROR_CLUSTER_RESOURCE_CONTAINS_UNSUPPORTED_DIFF_AREA_FOR_SHARED_VOLUMES: DWORD = 5969; +pub const ERROR_CLUSTER_RESOURCE_IS_IN_MAINTENANCE_MODE: DWORD = 5970; +pub const ERROR_CLUSTER_AFFINITY_CONFLICT: DWORD = 5971; +pub const ERROR_CLUSTER_RESOURCE_IS_REPLICA_VIRTUAL_MACHINE: DWORD = 5972; +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_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: DWORD = 6017; +pub const ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER: DWORD = 6018; +pub const ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: DWORD = 6019; +pub const ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: DWORD = 6020; +pub const ERROR_CS_ENCRYPTION_FILE_NOT_CSE: DWORD = 6021; +pub const ERROR_ENCRYPTION_POLICY_DENIES_OPERATION: DWORD = 6022; +pub const ERROR_NO_BROWSER_SERVERS_FOUND: DWORD = 6118; +pub const SCHED_E_SERVICE_NOT_LOCALSYSTEM: DWORD = 6200; +pub const ERROR_LOG_SECTOR_INVALID: DWORD = 6600; +pub const ERROR_LOG_SECTOR_PARITY_INVALID: DWORD = 6601; +pub const ERROR_LOG_SECTOR_REMAPPED: DWORD = 6602; +pub const ERROR_LOG_BLOCK_INCOMPLETE: DWORD = 6603; +pub const ERROR_LOG_INVALID_RANGE: DWORD = 6604; +pub const ERROR_LOG_BLOCKS_EXHAUSTED: DWORD = 6605; +pub const ERROR_LOG_READ_CONTEXT_INVALID: DWORD = 6606; +pub const ERROR_LOG_RESTART_INVALID: DWORD = 6607; +pub const ERROR_LOG_BLOCK_VERSION: DWORD = 6608; +pub const ERROR_LOG_BLOCK_INVALID: DWORD = 6609; +pub const ERROR_LOG_READ_MODE_INVALID: DWORD = 6610; +pub const ERROR_LOG_NO_RESTART: DWORD = 6611; +pub const ERROR_LOG_METADATA_CORRUPT: DWORD = 6612; +pub const ERROR_LOG_METADATA_INVALID: DWORD = 6613; +pub const ERROR_LOG_METADATA_INCONSISTENT: DWORD = 6614; +pub const ERROR_LOG_RESERVATION_INVALID: DWORD = 6615; +pub const ERROR_LOG_CANT_DELETE: DWORD = 6616; +pub const ERROR_LOG_CONTAINER_LIMIT_EXCEEDED: DWORD = 6617; +pub const ERROR_LOG_START_OF_LOG: DWORD = 6618; +pub const ERROR_LOG_POLICY_ALREADY_INSTALLED: DWORD = 6619; +pub const ERROR_LOG_POLICY_NOT_INSTALLED: DWORD = 6620; +pub const ERROR_LOG_POLICY_INVALID: DWORD = 6621; +pub const ERROR_LOG_POLICY_CONFLICT: DWORD = 6622; +pub const ERROR_LOG_PINNED_ARCHIVE_TAIL: DWORD = 6623; +pub const ERROR_LOG_RECORD_NONEXISTENT: DWORD = 6624; +pub const ERROR_LOG_RECORDS_RESERVED_INVALID: DWORD = 6625; +pub const ERROR_LOG_SPACE_RESERVED_INVALID: DWORD = 6626; +pub const ERROR_LOG_TAIL_INVALID: DWORD = 6627; +pub const ERROR_LOG_FULL: DWORD = 6628; +pub const ERROR_COULD_NOT_RESIZE_LOG: DWORD = 6629; +pub const ERROR_LOG_MULTIPLEXED: DWORD = 6630; +pub const ERROR_LOG_DEDICATED: DWORD = 6631; +pub const ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS: DWORD = 6632; +pub const ERROR_LOG_ARCHIVE_IN_PROGRESS: DWORD = 6633; +pub const ERROR_LOG_EPHEMERAL: DWORD = 6634; +pub const ERROR_LOG_NOT_ENOUGH_CONTAINERS: DWORD = 6635; +pub const ERROR_LOG_CLIENT_ALREADY_REGISTERED: DWORD = 6636; +pub const ERROR_LOG_CLIENT_NOT_REGISTERED: DWORD = 6637; +pub const ERROR_LOG_FULL_HANDLER_IN_PROGRESS: DWORD = 6638; +pub const ERROR_LOG_CONTAINER_READ_FAILED: DWORD = 6639; +pub const ERROR_LOG_CONTAINER_WRITE_FAILED: DWORD = 6640; +pub const ERROR_LOG_CONTAINER_OPEN_FAILED: DWORD = 6641; +pub const ERROR_LOG_CONTAINER_STATE_INVALID: DWORD = 6642; +pub const ERROR_LOG_STATE_INVALID: DWORD = 6643; +pub const ERROR_LOG_PINNED: DWORD = 6644; +pub const ERROR_LOG_METADATA_FLUSH_FAILED: DWORD = 6645; +pub const ERROR_LOG_INCONSISTENT_SECURITY: DWORD = 6646; +pub const ERROR_LOG_APPENDED_FLUSH_FAILED: DWORD = 6647; +pub const ERROR_LOG_PINNED_RESERVATION: DWORD = 6648; +pub const ERROR_INVALID_TRANSACTION: DWORD = 6700; +pub const ERROR_TRANSACTION_NOT_ACTIVE: DWORD = 6701; +pub const ERROR_TRANSACTION_REQUEST_NOT_VALID: DWORD = 6702; +pub const ERROR_TRANSACTION_NOT_REQUESTED: DWORD = 6703; +pub const ERROR_TRANSACTION_ALREADY_ABORTED: DWORD = 6704; +pub const ERROR_TRANSACTION_ALREADY_COMMITTED: DWORD = 6705; +pub const ERROR_TM_INITIALIZATION_FAILED: DWORD = 6706; +pub const ERROR_RESOURCEMANAGER_READ_ONLY: DWORD = 6707; +pub const ERROR_TRANSACTION_NOT_JOINED: DWORD = 6708; +pub const ERROR_TRANSACTION_SUPERIOR_EXISTS: DWORD = 6709; +pub const ERROR_CRM_PROTOCOL_ALREADY_EXISTS: DWORD = 6710; +pub const ERROR_TRANSACTION_PROPAGATION_FAILED: DWORD = 6711; +pub const ERROR_CRM_PROTOCOL_NOT_FOUND: DWORD = 6712; +pub const ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER: DWORD = 6713; +pub const ERROR_CURRENT_TRANSACTION_NOT_VALID: DWORD = 6714; +pub const ERROR_TRANSACTION_NOT_FOUND: DWORD = 6715; +pub const ERROR_RESOURCEMANAGER_NOT_FOUND: DWORD = 6716; +pub const ERROR_ENLISTMENT_NOT_FOUND: DWORD = 6717; +pub const ERROR_TRANSACTIONMANAGER_NOT_FOUND: DWORD = 6718; +pub const ERROR_TRANSACTIONMANAGER_NOT_ONLINE: DWORD = 6719; +pub const ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: DWORD = 6720; +pub const ERROR_TRANSACTION_NOT_ROOT: DWORD = 6721; +pub const ERROR_TRANSACTION_OBJECT_EXPIRED: DWORD = 6722; +pub const ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED: DWORD = 6723; +pub const ERROR_TRANSACTION_RECORD_TOO_LONG: DWORD = 6724; +pub const ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED: DWORD = 6725; +pub const ERROR_TRANSACTION_INTEGRITY_VIOLATED: DWORD = 6726; +pub const ERROR_TRANSACTIONMANAGER_IDENTITY_MISMATCH: DWORD = 6727; +pub const ERROR_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT: DWORD = 6728; +pub const ERROR_TRANSACTION_MUST_WRITETHROUGH: DWORD = 6729; +pub const ERROR_TRANSACTION_NO_SUPERIOR: DWORD = 6730; +pub const ERROR_HEURISTIC_DAMAGE_POSSIBLE: DWORD = 6731; +pub const ERROR_TRANSACTIONAL_CONFLICT: DWORD = 6800; +pub const ERROR_RM_NOT_ACTIVE: DWORD = 6801; +pub const ERROR_RM_METADATA_CORRUPT: DWORD = 6802; +pub const ERROR_DIRECTORY_NOT_RM: DWORD = 6803; +pub const ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE: DWORD = 6805; +pub const ERROR_LOG_RESIZE_INVALID_SIZE: DWORD = 6806; +pub const ERROR_OBJECT_NO_LONGER_EXISTS: DWORD = 6807; +pub const ERROR_STREAM_MINIVERSION_NOT_FOUND: DWORD = 6808; +pub const ERROR_STREAM_MINIVERSION_NOT_VALID: DWORD = 6809; +pub const ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: DWORD = 6810; +pub const ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: DWORD = 6811; +pub const ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS: DWORD = 6812; +pub const ERROR_REMOTE_FILE_VERSION_MISMATCH: DWORD = 6814; +pub const ERROR_HANDLE_NO_LONGER_VALID: DWORD = 6815; +pub const ERROR_NO_TXF_METADATA: DWORD = 6816; +pub const ERROR_LOG_CORRUPTION_DETECTED: DWORD = 6817; +pub const ERROR_CANT_RECOVER_WITH_HANDLE_OPEN: DWORD = 6818; +pub const ERROR_RM_DISCONNECTED: DWORD = 6819; +pub const ERROR_ENLISTMENT_NOT_SUPERIOR: DWORD = 6820; +pub const ERROR_RECOVERY_NOT_NEEDED: DWORD = 6821; +pub const ERROR_RM_ALREADY_STARTED: DWORD = 6822; +pub const ERROR_FILE_IDENTITY_NOT_PERSISTENT: DWORD = 6823; +pub const ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: DWORD = 6824; +pub const ERROR_CANT_CROSS_RM_BOUNDARY: DWORD = 6825; +pub const ERROR_TXF_DIR_NOT_EMPTY: DWORD = 6826; +pub const ERROR_INDOUBT_TRANSACTIONS_EXIST: DWORD = 6827; +pub const ERROR_TM_VOLATILE: DWORD = 6828; +pub const ERROR_ROLLBACK_TIMER_EXPIRED: DWORD = 6829; +pub const ERROR_TXF_ATTRIBUTE_CORRUPT: DWORD = 6830; +pub const ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION: DWORD = 6831; +pub const ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED: DWORD = 6832; +pub const ERROR_LOG_GROWTH_FAILED: DWORD = 6833; +pub const ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: DWORD = 6834; +pub const ERROR_TXF_METADATA_ALREADY_PRESENT: DWORD = 6835; +pub const ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: DWORD = 6836; +pub const ERROR_TRANSACTION_REQUIRED_PROMOTION: DWORD = 6837; +pub const ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION: DWORD = 6838; +pub const ERROR_TRANSACTIONS_NOT_FROZEN: DWORD = 6839; +pub const ERROR_TRANSACTION_FREEZE_IN_PROGRESS: DWORD = 6840; +pub const ERROR_NOT_SNAPSHOT_VOLUME: DWORD = 6841; +pub const ERROR_NO_SAVEPOINT_WITH_OPEN_FILES: DWORD = 6842; +pub const ERROR_DATA_LOST_REPAIR: DWORD = 6843; +pub const ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION: DWORD = 6844; +pub const ERROR_TM_IDENTITY_MISMATCH: DWORD = 6845; +pub const ERROR_FLOATED_SECTION: DWORD = 6846; +pub const ERROR_CANNOT_ACCEPT_TRANSACTED_WORK: DWORD = 6847; +pub const ERROR_CANNOT_ABORT_TRANSACTIONS: DWORD = 6848; +pub const ERROR_BAD_CLUSTERS: DWORD = 6849; +pub const ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: DWORD = 6850; +pub const ERROR_VOLUME_DIRTY: DWORD = 6851; +pub const ERROR_NO_LINK_TRACKING_IN_TRANSACTION: DWORD = 6852; +pub const ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: DWORD = 6853; +pub const ERROR_EXPIRED_HANDLE: DWORD = 6854; +pub const ERROR_TRANSACTION_NOT_ENLISTED: DWORD = 6855; +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_CTX_WINSTATIONS_DISABLED: DWORD = 7060; +pub const ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED: DWORD = 7061; +pub const ERROR_CTX_SESSION_IN_USE: DWORD = 7062; +pub const ERROR_CTX_NO_FORCE_LOGOFF: DWORD = 7063; +pub const ERROR_CTX_ACCOUNT_RESTRICTION: DWORD = 7064; +pub const ERROR_RDP_PROTOCOL_ERROR: DWORD = 7065; +pub const ERROR_CTX_CDM_CONNECT: DWORD = 7066; +pub const ERROR_CTX_CDM_DISCONNECT: DWORD = 7067; +pub const ERROR_CTX_SECURITY_LAYER_ERROR: DWORD = 7068; +pub const ERROR_TS_INCOMPATIBLE_SESSIONS: DWORD = 7069; +pub const ERROR_TS_VIDEO_SUBSYSTEM_ERROR: DWORD = 7070; +pub const FRS_ERR_INVALID_API_SEQUENCE: DWORD = 8001; +pub const FRS_ERR_STARTING_SERVICE: DWORD = 8002; +pub const FRS_ERR_STOPPING_SERVICE: DWORD = 8003; +pub const FRS_ERR_INTERNAL_API: DWORD = 8004; +pub const FRS_ERR_INTERNAL: DWORD = 8005; +pub const FRS_ERR_SERVICE_COMM: DWORD = 8006; +pub const FRS_ERR_INSUFFICIENT_PRIV: DWORD = 8007; +pub const FRS_ERR_AUTHENTICATION: DWORD = 8008; +pub const FRS_ERR_PARENT_INSUFFICIENT_PRIV: DWORD = 8009; +pub const FRS_ERR_PARENT_AUTHENTICATION: DWORD = 8010; +pub const FRS_ERR_CHILD_TO_PARENT_COMM: DWORD = 8011; +pub const FRS_ERR_PARENT_TO_CHILD_COMM: DWORD = 8012; +pub const FRS_ERR_SYSVOL_POPULATE: DWORD = 8013; +pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: DWORD = 8014; +pub const FRS_ERR_SYSVOL_IS_BUSY: DWORD = 8015; +pub const FRS_ERR_SYSVOL_DEMOTE: DWORD = 8016; +pub const FRS_ERR_INVALID_SERVICE_PARAMETER: DWORD = 8017; +pub const DS_S_SUCCESS: DWORD = NO_ERROR; +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_RIDMGR_DISABLED: DWORD = 8263; +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_DS_POLICY_NOT_KNOWN: DWORD = 8618; +pub const ERROR_NO_SITE_SETTINGS_OBJECT: DWORD = 8619; +pub const ERROR_NO_SECRETS: DWORD = 8620; +pub const ERROR_NO_WRITABLE_DC_FOUND: DWORD = 8621; +pub const ERROR_DS_NO_SERVER_OBJECT: DWORD = 8622; +pub const ERROR_DS_NO_NTDSA_OBJECT: DWORD = 8623; +pub const ERROR_DS_NON_ASQ_SEARCH: DWORD = 8624; +pub const ERROR_DS_AUDIT_FAILURE: DWORD = 8625; +pub const ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE: DWORD = 8626; +pub const ERROR_DS_INVALID_SEARCH_FLAG_TUPLE: DWORD = 8627; +pub const ERROR_DS_HIERARCHY_TABLE_TOO_DEEP: DWORD = 8628; +pub const ERROR_DS_DRA_CORRUPT_UTD_VECTOR: DWORD = 8629; +pub const ERROR_DS_DRA_SECRETS_DENIED: DWORD = 8630; +pub const ERROR_DS_RESERVED_MAPI_ID: DWORD = 8631; +pub const ERROR_DS_MAPI_ID_NOT_AVAILABLE: DWORD = 8632; +pub const ERROR_DS_DRA_MISSING_KRBTGT_SECRET: DWORD = 8633; +pub const ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST: DWORD = 8634; +pub const ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST: DWORD = 8635; +pub const ERROR_INVALID_USER_PRINCIPAL_NAME: DWORD = 8636; +pub const ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: DWORD = 8637; +pub const ERROR_DS_OID_NOT_FOUND: DWORD = 8638; +pub const ERROR_DS_DRA_RECYCLED_TARGET: DWORD = 8639; +pub const ERROR_DS_DISALLOWED_NC_REDIRECT: DWORD = 8640; +pub const ERROR_DS_HIGH_ADLDS_FFL: DWORD = 8641; +pub const ERROR_DS_HIGH_DSA_VERSION: DWORD = 8642; +pub const ERROR_DS_LOW_ADLDS_FFL: DWORD = 8643; +pub const ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION: DWORD = 8644; +pub const ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED: DWORD = 8645; +pub const ERROR_INCORRECT_ACCOUNT_TYPE: DWORD = 8646; +pub const ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST: DWORD = 8647; +pub const ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST: DWORD = 8648; +pub const DNS_ERROR_RESPONSE_CODES_BASE: DWORD = 9000; +pub const DNS_ERROR_RCODE_NO_ERROR: DWORD = NO_ERROR; +pub const DNS_ERROR_MASK: DWORD = 0x00002328; +pub const DNS_ERROR_RCODE_FORMAT_ERROR: DWORD = 9001; +pub const DNS_ERROR_RCODE_SERVER_FAILURE: DWORD = 9002; +pub const DNS_ERROR_RCODE_NAME_ERROR: DWORD = 9003; +pub const DNS_ERROR_RCODE_NOT_IMPLEMENTED: DWORD = 9004; +pub const DNS_ERROR_RCODE_REFUSED: DWORD = 9005; +pub const DNS_ERROR_RCODE_YXDOMAIN: DWORD = 9006; +pub const DNS_ERROR_RCODE_YXRRSET: DWORD = 9007; +pub const DNS_ERROR_RCODE_NXRRSET: DWORD = 9008; +pub const DNS_ERROR_RCODE_NOTAUTH: DWORD = 9009; +pub const DNS_ERROR_RCODE_NOTZONE: DWORD = 9010; +pub const DNS_ERROR_RCODE_BADSIG: DWORD = 9016; +pub const DNS_ERROR_RCODE_BADKEY: DWORD = 9017; +pub const DNS_ERROR_RCODE_BADTIME: DWORD = 9018; +pub const DNS_ERROR_RCODE_LAST: DWORD = DNS_ERROR_RCODE_BADTIME; +pub const DNS_ERROR_DNSSEC_BASE: DWORD = 9100; +pub const DNS_ERROR_KEYMASTER_REQUIRED: DWORD = 9101; +pub const DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE: DWORD = 9102; +pub const DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1: DWORD = 9103; +pub const DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS: DWORD = 9104; +pub const DNS_ERROR_UNSUPPORTED_ALGORITHM: DWORD = 9105; +pub const DNS_ERROR_INVALID_KEY_SIZE: DWORD = 9106; +pub const DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE: DWORD = 9107; +pub const DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION: DWORD = 9108; +pub const DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR: DWORD = 9109; +pub const DNS_ERROR_UNEXPECTED_CNG_ERROR: DWORD = 9110; +pub const DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION: DWORD = 9111; +pub const DNS_ERROR_KSP_NOT_ACCESSIBLE: DWORD = 9112; +pub const DNS_ERROR_TOO_MANY_SKDS: DWORD = 9113; +pub const DNS_ERROR_INVALID_ROLLOVER_PERIOD: DWORD = 9114; +pub const DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET: DWORD = 9115; +pub const DNS_ERROR_ROLLOVER_IN_PROGRESS: DWORD = 9116; +pub const DNS_ERROR_STANDBY_KEY_NOT_PRESENT: DWORD = 9117; +pub const DNS_ERROR_NOT_ALLOWED_ON_ZSK: DWORD = 9118; +pub const DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD: DWORD = 9119; +pub const DNS_ERROR_ROLLOVER_ALREADY_QUEUED: DWORD = 9120; +pub const DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE: DWORD = 9121; +pub const DNS_ERROR_BAD_KEYMASTER: DWORD = 9122; +pub const DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD: DWORD = 9123; +pub const DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT: DWORD = 9124; +pub const DNS_ERROR_DNSSEC_IS_DISABLED: DWORD = 9125; +pub const DNS_ERROR_INVALID_XML: DWORD = 9126; +pub const DNS_ERROR_NO_VALID_TRUST_ANCHORS: DWORD = 9127; +pub const DNS_ERROR_ROLLOVER_NOT_POKEABLE: DWORD = 9128; +pub const DNS_ERROR_NSEC3_NAME_COLLISION: DWORD = 9129; +pub const DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1: DWORD = 9130; +pub const DNS_ERROR_PACKET_FMT_BASE: DWORD = 9500; +pub const DNS_INFO_NO_RECORDS: DWORD = 9501; +pub const DNS_ERROR_BAD_PACKET: DWORD = 9502; +pub const DNS_ERROR_NO_PACKET: DWORD = 9503; +pub const DNS_ERROR_RCODE: DWORD = 9504; +pub const DNS_ERROR_UNSECURE_PACKET: DWORD = 9505; +pub const DNS_STATUS_PACKET_UNSECURE: DWORD = DNS_ERROR_UNSECURE_PACKET; +pub const DNS_REQUEST_PENDING: DWORD = 9506; +pub const DNS_ERROR_NO_MEMORY: DWORD = ERROR_OUTOFMEMORY; +pub const DNS_ERROR_INVALID_NAME: DWORD = ERROR_INVALID_NAME; +pub const DNS_ERROR_INVALID_DATA: DWORD = ERROR_INVALID_DATA; +pub const DNS_ERROR_GENERAL_API_BASE: DWORD = 9550; +pub const DNS_ERROR_INVALID_TYPE: DWORD = 9551; +pub const DNS_ERROR_INVALID_IP_ADDRESS: DWORD = 9552; +pub const DNS_ERROR_INVALID_PROPERTY: DWORD = 9553; +pub const DNS_ERROR_TRY_AGAIN_LATER: DWORD = 9554; +pub const DNS_ERROR_NOT_UNIQUE: DWORD = 9555; +pub const DNS_ERROR_NON_RFC_NAME: DWORD = 9556; +pub const DNS_STATUS_FQDN: DWORD = 9557; +pub const DNS_STATUS_DOTTED_NAME: DWORD = 9558; +pub const DNS_STATUS_SINGLE_PART_NAME: DWORD = 9559; +pub const DNS_ERROR_INVALID_NAME_CHAR: DWORD = 9560; +pub const DNS_ERROR_NUMERIC_NAME: DWORD = 9561; +pub const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER: DWORD = 9562; +pub const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION: DWORD = 9563; +pub const DNS_ERROR_CANNOT_FIND_ROOT_HINTS: DWORD = 9564; +pub const DNS_ERROR_INCONSISTENT_ROOT_HINTS: DWORD = 9565; +pub const DNS_ERROR_DWORD_VALUE_TOO_SMALL: DWORD = 9566; +pub const DNS_ERROR_DWORD_VALUE_TOO_LARGE: DWORD = 9567; +pub const DNS_ERROR_BACKGROUND_LOADING: DWORD = 9568; +pub const DNS_ERROR_NOT_ALLOWED_ON_RODC: DWORD = 9569; +pub const DNS_ERROR_NOT_ALLOWED_UNDER_DNAME: DWORD = 9570; +pub const DNS_ERROR_DELEGATION_REQUIRED: DWORD = 9571; +pub const DNS_ERROR_INVALID_POLICY_TABLE: DWORD = 9572; +pub const DNS_ERROR_ZONE_BASE: DWORD = 9600; +pub const DNS_ERROR_ZONE_DOES_NOT_EXIST: DWORD = 9601; +pub const DNS_ERROR_NO_ZONE_INFO: DWORD = 9602; +pub const DNS_ERROR_INVALID_ZONE_OPERATION: DWORD = 9603; +pub const DNS_ERROR_ZONE_CONFIGURATION_ERROR: DWORD = 9604; +pub const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD: DWORD = 9605; +pub const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS: DWORD = 9606; +pub const DNS_ERROR_ZONE_LOCKED: DWORD = 9607; +pub const DNS_ERROR_ZONE_CREATION_FAILED: DWORD = 9608; +pub const DNS_ERROR_ZONE_ALREADY_EXISTS: DWORD = 9609; +pub const DNS_ERROR_AUTOZONE_ALREADY_EXISTS: DWORD = 9610; +pub const DNS_ERROR_INVALID_ZONE_TYPE: DWORD = 9611; +pub const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP: DWORD = 9612; +pub const DNS_ERROR_ZONE_NOT_SECONDARY: DWORD = 9613; +pub const DNS_ERROR_NEED_SECONDARY_ADDRESSES: DWORD = 9614; +pub const DNS_ERROR_WINS_INIT_FAILED: DWORD = 9615; +pub const DNS_ERROR_NEED_WINS_SERVERS: DWORD = 9616; +pub const DNS_ERROR_NBSTAT_INIT_FAILED: DWORD = 9617; +pub const DNS_ERROR_SOA_DELETE_INVALID: DWORD = 9618; +pub const DNS_ERROR_FORWARDER_ALREADY_EXISTS: DWORD = 9619; +pub const DNS_ERROR_ZONE_REQUIRES_MASTER_IP: DWORD = 9620; +pub const DNS_ERROR_ZONE_IS_SHUTDOWN: DWORD = 9621; +pub const DNS_ERROR_ZONE_LOCKED_FOR_SIGNING: DWORD = 9622; +pub const DNS_ERROR_DATAFILE_BASE: DWORD = 9650; +pub const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE: DWORD = 9651; +pub const DNS_ERROR_INVALID_DATAFILE_NAME: DWORD = 9652; +pub const DNS_ERROR_DATAFILE_OPEN_FAILURE: DWORD = 9653; +pub const DNS_ERROR_FILE_WRITEBACK_FAILED: DWORD = 9654; +pub const DNS_ERROR_DATAFILE_PARSING: DWORD = 9655; +pub const DNS_ERROR_DATABASE_BASE: DWORD = 9700; +pub const DNS_ERROR_RECORD_DOES_NOT_EXIST: DWORD = 9701; +pub const DNS_ERROR_RECORD_FORMAT: DWORD = 9702; +pub const DNS_ERROR_NODE_CREATION_FAILED: DWORD = 9703; +pub const DNS_ERROR_UNKNOWN_RECORD_TYPE: DWORD = 9704; +pub const DNS_ERROR_RECORD_TIMED_OUT: DWORD = 9705; +pub const DNS_ERROR_NAME_NOT_IN_ZONE: DWORD = 9706; +pub const DNS_ERROR_CNAME_LOOP: DWORD = 9707; +pub const DNS_ERROR_NODE_IS_CNAME: DWORD = 9708; +pub const DNS_ERROR_CNAME_COLLISION: DWORD = 9709; +pub const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT: DWORD = 9710; +pub const DNS_ERROR_RECORD_ALREADY_EXISTS: DWORD = 9711; +pub const DNS_ERROR_SECONDARY_DATA: DWORD = 9712; +pub const DNS_ERROR_NO_CREATE_CACHE_DATA: DWORD = 9713; +pub const DNS_ERROR_NAME_DOES_NOT_EXIST: DWORD = 9714; +pub const DNS_WARNING_PTR_CREATE_FAILED: DWORD = 9715; +pub const DNS_WARNING_DOMAIN_UNDELETED: DWORD = 9716; +pub const DNS_ERROR_DS_UNAVAILABLE: DWORD = 9717; +pub const DNS_ERROR_DS_ZONE_ALREADY_EXISTS: DWORD = 9718; +pub const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE: DWORD = 9719; +pub const DNS_ERROR_NODE_IS_DNAME: DWORD = 9720; +pub const DNS_ERROR_DNAME_COLLISION: DWORD = 9721; +pub const DNS_ERROR_ALIAS_LOOP: DWORD = 9722; +pub const DNS_ERROR_OPERATION_BASE: DWORD = 9750; +pub const DNS_INFO_AXFR_COMPLETE: DWORD = 9751; +pub const DNS_ERROR_AXFR: DWORD = 9752; +pub const DNS_INFO_ADDED_LOCAL_WINS: DWORD = 9753; +pub const DNS_ERROR_SECURE_BASE: DWORD = 9800; +pub const DNS_STATUS_CONTINUE_NEEDED: DWORD = 9801; +pub const DNS_ERROR_SETUP_BASE: DWORD = 9850; +pub const DNS_ERROR_NO_TCPIP: DWORD = 9851; +pub const DNS_ERROR_NO_DNS_SERVERS: DWORD = 9852; +pub const DNS_ERROR_DP_BASE: DWORD = 9900; +pub const DNS_ERROR_DP_DOES_NOT_EXIST: DWORD = 9901; +pub const DNS_ERROR_DP_ALREADY_EXISTS: DWORD = 9902; +pub const DNS_ERROR_DP_NOT_ENLISTED: DWORD = 9903; +pub const DNS_ERROR_DP_ALREADY_ENLISTED: DWORD = 9904; +pub const DNS_ERROR_DP_NOT_AVAILABLE: DWORD = 9905; +pub const DNS_ERROR_DP_FSMO_ERROR: DWORD = 9906; +pub const DNS_ERROR_ZONESCOPE_ALREADY_EXISTS: DWORD = 9951; +pub const DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST: DWORD = 9952; +pub const DNS_ERROR_DEFAULT_ZONESCOPE: DWORD = 9953; +pub const DNS_ERROR_INVALID_ZONESCOPE_NAME: DWORD = 9954; +pub const DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES: DWORD = 9955; +pub const DNS_ERROR_LOAD_ZONESCOPE_FAILED: DWORD = 9956; +pub const DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED: DWORD = 9957; +pub const DNS_ERROR_INVALID_SCOPE_NAME: DWORD = 9958; +pub const DNS_ERROR_SCOPE_DOES_NOT_EXIST: DWORD = 9959; +pub const DNS_ERROR_DEFAULT_SCOPE: DWORD = 9960; +pub const DNS_ERROR_INVALID_SCOPE_OPERATION: DWORD = 9961; +pub const DNS_ERROR_SCOPE_LOCKED: DWORD = 9962; +pub const DNS_ERROR_SCOPE_ALREADY_EXISTS: DWORD = 9963; +pub const WSABASEERR: DWORD = 10000; +pub const WSAEINTR: DWORD = 10004; +pub const WSAEBADF: DWORD = 10009; +pub const WSAEACCES: DWORD = 10013; +pub const WSAEFAULT: DWORD = 10014; +pub const WSAEINVAL: DWORD = 10022; +pub const WSAEMFILE: DWORD = 10024; +pub const WSAEWOULDBLOCK: DWORD = 10035; +pub const WSAEINPROGRESS: DWORD = 10036; +pub const WSAEALREADY: DWORD = 10037; +pub const WSAENOTSOCK: DWORD = 10038; +pub const WSAEDESTADDRREQ: DWORD = 10039; +pub const WSAEMSGSIZE: DWORD = 10040; +pub const WSAEPROTOTYPE: DWORD = 10041; +pub const WSAENOPROTOOPT: DWORD = 10042; +pub const WSAEPROTONOSUPPORT: DWORD = 10043; +pub const WSAESOCKTNOSUPPORT: DWORD = 10044; +pub const WSAEOPNOTSUPP: DWORD = 10045; +pub const WSAEPFNOSUPPORT: DWORD = 10046; +pub const WSAEAFNOSUPPORT: DWORD = 10047; +pub const WSAEADDRINUSE: DWORD = 10048; +pub const WSAEADDRNOTAVAIL: DWORD = 10049; +pub const WSAENETDOWN: DWORD = 10050; +pub const WSAENETUNREACH: DWORD = 10051; +pub const WSAENETRESET: DWORD = 10052; +pub const WSAECONNABORTED: DWORD = 10053; +pub const WSAECONNRESET: DWORD = 10054; +pub const WSAENOBUFS: DWORD = 10055; +pub const WSAEISCONN: DWORD = 10056; +pub const WSAENOTCONN: DWORD = 10057; +pub const WSAESHUTDOWN: DWORD = 10058; +pub const WSAETOOMANYREFS: DWORD = 10059; +pub const WSAETIMEDOUT: DWORD = 10060; +pub const WSAECONNREFUSED: DWORD = 10061; +pub const WSAELOOP: DWORD = 10062; +pub const WSAENAMETOOLONG: DWORD = 10063; +pub const WSAEHOSTDOWN: DWORD = 10064; +pub const WSAEHOSTUNREACH: DWORD = 10065; +pub const WSAENOTEMPTY: DWORD = 10066; +pub const WSAEPROCLIM: DWORD = 10067; +pub const WSAEUSERS: DWORD = 10068; +pub const WSAEDQUOT: DWORD = 10069; +pub const WSAESTALE: DWORD = 10070; +pub const WSAEREMOTE: DWORD = 10071; +pub const WSASYSNOTREADY: DWORD = 10091; +pub const WSAVERNOTSUPPORTED: DWORD = 10092; +pub const WSANOTINITIALISED: DWORD = 10093; +pub const WSAEDISCON: DWORD = 10101; +pub const WSAENOMORE: DWORD = 10102; +pub const WSAECANCELLED: DWORD = 10103; +pub const WSAEINVALIDPROCTABLE: DWORD = 10104; +pub const WSAEINVALIDPROVIDER: DWORD = 10105; +pub const WSAEPROVIDERFAILEDINIT: DWORD = 10106; +pub const WSASYSCALLFAILURE: DWORD = 10107; +pub const WSASERVICE_NOT_FOUND: DWORD = 10108; +pub const WSATYPE_NOT_FOUND: DWORD = 10109; +pub const WSA_E_NO_MORE: DWORD = 10110; +pub const WSA_E_CANCELLED: DWORD = 10111; +pub const WSAEREFUSED: DWORD = 10112; +pub const WSAHOST_NOT_FOUND: DWORD = 11001; +pub const WSATRY_AGAIN: DWORD = 11002; +pub const WSANO_RECOVERY: DWORD = 11003; +pub const WSANO_DATA: DWORD = 11004; +pub const WSA_QOS_RECEIVERS: DWORD = 11005; +pub const WSA_QOS_SENDERS: DWORD = 11006; +pub const WSA_QOS_NO_SENDERS: DWORD = 11007; +pub const WSA_QOS_NO_RECEIVERS: DWORD = 11008; +pub const WSA_QOS_REQUEST_CONFIRMED: DWORD = 11009; +pub const WSA_QOS_ADMISSION_FAILURE: DWORD = 11010; +pub const WSA_QOS_POLICY_FAILURE: DWORD = 11011; +pub const WSA_QOS_BAD_STYLE: DWORD = 11012; +pub const WSA_QOS_BAD_OBJECT: DWORD = 11013; +pub const WSA_QOS_TRAFFIC_CTRL_ERROR: DWORD = 11014; +pub const WSA_QOS_GENERIC_ERROR: DWORD = 11015; +pub const WSA_QOS_ESERVICETYPE: DWORD = 11016; +pub const WSA_QOS_EFLOWSPEC: DWORD = 11017; +pub const WSA_QOS_EPROVSPECBUF: DWORD = 11018; +pub const WSA_QOS_EFILTERSTYLE: DWORD = 11019; +pub const WSA_QOS_EFILTERTYPE: DWORD = 11020; +pub const WSA_QOS_EFILTERCOUNT: DWORD = 11021; +pub const WSA_QOS_EOBJLENGTH: DWORD = 11022; +pub const WSA_QOS_EFLOWCOUNT: DWORD = 11023; +pub const WSA_QOS_EUNKOWNPSOBJ: DWORD = 11024; +pub const WSA_QOS_EPOLICYOBJ: DWORD = 11025; +pub const WSA_QOS_EFLOWDESC: DWORD = 11026; +pub const WSA_QOS_EPSFLOWSPEC: DWORD = 11027; +pub const WSA_QOS_EPSFILTERSPEC: DWORD = 11028; +pub const WSA_QOS_ESDMODEOBJ: DWORD = 11029; +pub const WSA_QOS_ESHAPERATEOBJ: DWORD = 11030; +pub const WSA_QOS_RESERVED_PETYPE: DWORD = 11031; +pub const WSA_SECURE_HOST_NOT_FOUND: DWORD = 11032; +pub const WSA_IPSEC_NAME_POLICY_ERROR: DWORD = 11033; +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 WARNING_IPSEC_MM_POLICY_PRUNED: DWORD = 13024; +pub const WARNING_IPSEC_QM_POLICY_PRUNED: DWORD = 13025; +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_SIMULTANEOUS_REKEY: DWORD = 13821; +pub const ERROR_IPSEC_IKE_DH_FAIL: DWORD = 13822; +pub const ERROR_IPSEC_IKE_CRITICAL_PAYLOAD_NOT_RECOGNIZED: DWORD = 13823; +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_MAJOR_VERSION: DWORD = 13880; +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_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_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_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_MRM_UNSUPPORTED_FILE_TYPE_FOR_MERGE: DWORD = 15141; +pub const ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_LOAD_UNLOAD_PRI_FILE: DWORD = 15142; +pub const ERROR_MRM_NO_CURRENT_VIEW_ON_THREAD: DWORD = 15143; +pub const ERROR_DIFFERENT_PROFILE_RESOURCE_MANAGER_EXIST: DWORD = 15144; +pub const ERROR_OPERATION_NOT_ALLOWED_FROM_SYSTEM_COMPONENT: DWORD = 15145; +pub const ERROR_MRM_DIRECT_REF_TO_NON_DEFAULT_RESOURCE: DWORD = 15146; +pub const ERROR_MRM_GENERATION_COUNT_MISMATCH: DWORD = 15147; +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 APPMODEL_ERROR_NO_PACKAGE: DWORD = 15700; +pub const APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT: DWORD = 15701; +pub const APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT: DWORD = 15702; +pub const APPMODEL_ERROR_NO_APPLICATION: DWORD = 15703; +pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_READ_FAILED: DWORD = 15704; +pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_INVALID: DWORD = 15705; +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 STORE_ERROR_UNLICENSED: DWORD = 15861; +pub const STORE_ERROR_UNLICENSED_USER: DWORD = 15862; +pub const STORE_ERROR_PENDING_COM_TRANSACTION: DWORD = 15863; +pub const STORE_ERROR_LICENSE_REVOKED: DWORD = 15864; +pub const SEVERITY_SUCCESS: HRESULT = 0; +pub const SEVERITY_ERROR: HRESULT = 1; +#[inline] +pub fn MAKE_HRESULT(sev: HRESULT, fac: HRESULT, code: HRESULT) -> HRESULT { + (sev << 31) | (fac << 16) | code +} +pub const FACILITY_NT_BIT: HRESULT = 0x10000000; +#[inline] +pub fn HRESULT_FROM_WIN32(x: c_ulong) -> HRESULT { + let hr = x as HRESULT; + if hr <= 0 { + hr + } else { + ((x & 0x0000FFFF) | ((FACILITY_WIN32 as u32) << 16) | 0x80000000) as HRESULT + } +} +#[inline] +pub fn HRESULT_FROM_NT(x: c_ulong) -> HRESULT { + (x | FACILITY_NT_BIT as u32) as HRESULT +} +pub type HRESULT = c_long; +pub const NOERROR: HRESULT = 0; +pub const E_UNEXPECTED: HRESULT = 0x8000FFFF; +pub const E_NOTIMPL: HRESULT = 0x80004001; +pub const E_OUTOFMEMORY: HRESULT = 0x8007000E; +pub const E_INVALIDARG: HRESULT = 0x80070057; +pub const E_NOINTERFACE: HRESULT = 0x80004002; +pub const E_POINTER: HRESULT = 0x80004003; +pub const E_HANDLE: HRESULT = 0x80070006; +pub const E_ABORT: HRESULT = 0x80004004; +pub const E_FAIL: HRESULT = 0x80004005; +pub const E_ACCESSDENIED: HRESULT = 0x80070005; +pub const E_PENDING: HRESULT = 0x8000000A; +pub const E_BOUNDS: HRESULT = 0x8000000B; +pub const E_CHANGED_STATE: HRESULT = 0x8000000C; +pub const E_ILLEGAL_STATE_CHANGE: HRESULT = 0x8000000D; +pub const E_ILLEGAL_METHOD_CALL: HRESULT = 0x8000000E; +pub const RO_E_METADATA_NAME_NOT_FOUND: HRESULT = 0x8000000F; +pub const RO_E_METADATA_NAME_IS_NAMESPACE: HRESULT = 0x80000010; +pub const RO_E_METADATA_INVALID_TYPE_FORMAT: HRESULT = 0x80000011; +pub const RO_E_INVALID_METADATA_FILE: HRESULT = 0x80000012; +pub const RO_E_CLOSED: HRESULT = 0x80000013; +pub const RO_E_EXCLUSIVE_WRITE: HRESULT = 0x80000014; +pub const RO_E_CHANGE_NOTIFICATION_IN_PROGRESS: HRESULT = 0x80000015; +pub const RO_E_ERROR_STRING_NOT_FOUND: HRESULT = 0x80000016; +pub const E_STRING_NOT_NULL_TERMINATED: HRESULT = 0x80000017; +pub const E_ILLEGAL_DELEGATE_ASSIGNMENT: HRESULT = 0x80000018; +pub const E_ASYNC_OPERATION_NOT_STARTED: HRESULT = 0x80000019; +pub const E_APPLICATION_EXITING: HRESULT = 0x8000001A; +pub const E_APPLICATION_VIEW_EXITING: HRESULT = 0x8000001B; +pub const RO_E_MUST_BE_AGILE: HRESULT = 0x8000001C; +pub const RO_E_UNSUPPORTED_FROM_MTA: HRESULT = 0x8000001D; +pub const RO_E_COMMITTED: HRESULT = 0x8000001E; +pub const RO_E_BLOCKED_CROSS_ASTA_CALL: HRESULT = 0x8000001F; +pub const CO_E_INIT_TLS: HRESULT = 0x80004006; +pub const CO_E_INIT_SHARED_ALLOCATOR: HRESULT = 0x80004007; +pub const CO_E_INIT_MEMORY_ALLOCATOR: HRESULT = 0x80004008; +pub const CO_E_INIT_CLASS_CACHE: HRESULT = 0x80004009; +pub const CO_E_INIT_RPC_CHANNEL: HRESULT = 0x8000400A; +pub const CO_E_INIT_TLS_SET_CHANNEL_CONTROL: HRESULT = 0x8000400B; +pub const CO_E_INIT_TLS_CHANNEL_CONTROL: HRESULT = 0x8000400C; +pub const CO_E_INIT_UNACCEPTED_USER_ALLOCATOR: HRESULT = 0x8000400D; +pub const CO_E_INIT_SCM_MUTEX_EXISTS: HRESULT = 0x8000400E; +pub const CO_E_INIT_SCM_FILE_MAPPING_EXISTS: HRESULT = 0x8000400F; +pub const CO_E_INIT_SCM_MAP_VIEW_OF_FILE: HRESULT = 0x80004010; +pub const CO_E_INIT_SCM_EXEC_FAILURE: HRESULT = 0x80004011; +pub const CO_E_INIT_ONLY_SINGLE_THREADED: HRESULT = 0x80004012; +pub const CO_E_CANT_REMOTE: HRESULT = 0x80004013; +pub const CO_E_BAD_SERVER_NAME: HRESULT = 0x80004014; +pub const CO_E_WRONG_SERVER_IDENTITY: HRESULT = 0x80004015; +pub const CO_E_OLE1DDE_DISABLED: HRESULT = 0x80004016; +pub const CO_E_RUNAS_SYNTAX: HRESULT = 0x80004017; +pub const CO_E_CREATEPROCESS_FAILURE: HRESULT = 0x80004018; +pub const CO_E_RUNAS_CREATEPROCESS_FAILURE: HRESULT = 0x80004019; +pub const CO_E_RUNAS_LOGON_FAILURE: HRESULT = 0x8000401A; +pub const CO_E_LAUNCH_PERMSSION_DENIED: HRESULT = 0x8000401B; +pub const CO_E_START_SERVICE_FAILURE: HRESULT = 0x8000401C; +pub const CO_E_REMOTE_COMMUNICATION_FAILURE: HRESULT = 0x8000401D; +pub const CO_E_SERVER_START_TIMEOUT: HRESULT = 0x8000401E; +pub const CO_E_CLSREG_INCONSISTENT: HRESULT = 0x8000401F; +pub const CO_E_IIDREG_INCONSISTENT: HRESULT = 0x80004020; +pub const CO_E_NOT_SUPPORTED: HRESULT = 0x80004021; +pub const CO_E_RELOAD_DLL: HRESULT = 0x80004022; +pub const CO_E_MSI_ERROR: HRESULT = 0x80004023; +pub const CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT: HRESULT = 0x80004024; +pub const CO_E_SERVER_PAUSED: HRESULT = 0x80004025; +pub const CO_E_SERVER_NOT_PAUSED: HRESULT = 0x80004026; +pub const CO_E_CLASS_DISABLED: HRESULT = 0x80004027; +pub const CO_E_CLRNOTAVAILABLE: HRESULT = 0x80004028; +pub const CO_E_ASYNC_WORK_REJECTED: HRESULT = 0x80004029; +pub const CO_E_SERVER_INIT_TIMEOUT: HRESULT = 0x8000402A; +pub const CO_E_NO_SECCTX_IN_ACTIVATE: HRESULT = 0x8000402B; +pub const CO_E_TRACKER_CONFIG: HRESULT = 0x80004030; +pub const CO_E_THREADPOOL_CONFIG: HRESULT = 0x80004031; +pub const CO_E_SXS_CONFIG: HRESULT = 0x80004032; +pub const CO_E_MALFORMED_SPN: HRESULT = 0x80004033; +pub const CO_E_UNREVOKED_REGISTRATION_ON_APARTMENT_SHUTDOWN: HRESULT = 0x80004034; +pub const CO_E_PREMATURE_STUB_RUNDOWN: HRESULT = 0x80004035; +pub const S_OK: HRESULT = 0; +pub const S_FALSE: HRESULT = 1; +pub const OLE_E_FIRST: HRESULT = 0x80040000; +pub const OLE_E_LAST: HRESULT = 0x800400FF; +pub const OLE_S_FIRST: HRESULT = 0x00040000; +pub const OLE_S_LAST: HRESULT = 0x000400FF; +pub const OLE_E_OLEVERB: HRESULT = 0x80040000; +pub const OLE_E_ADVF: HRESULT = 0x80040001; +pub const OLE_E_ENUM_NOMORE: HRESULT = 0x80040002; +pub const OLE_E_ADVISENOTSUPPORTED: HRESULT = 0x80040003; +pub const OLE_E_NOCONNECTION: HRESULT = 0x80040004; +pub const OLE_E_NOTRUNNING: HRESULT = 0x80040005; +pub const OLE_E_NOCACHE: HRESULT = 0x80040006; +pub const OLE_E_BLANK: HRESULT = 0x80040007; +pub const OLE_E_CLASSDIFF: HRESULT = 0x80040008; +pub const OLE_E_CANT_GETMONIKER: HRESULT = 0x80040009; +pub const OLE_E_CANT_BINDTOSOURCE: HRESULT = 0x8004000A; +pub const OLE_E_STATIC: HRESULT = 0x8004000B; +pub const OLE_E_PROMPTSAVECANCELLED: HRESULT = 0x8004000C; +pub const OLE_E_INVALIDRECT: HRESULT = 0x8004000D; +pub const OLE_E_WRONGCOMPOBJ: HRESULT = 0x8004000E; +pub const OLE_E_INVALIDHWND: HRESULT = 0x8004000F; +pub const OLE_E_NOT_INPLACEACTIVE: HRESULT = 0x80040010; +pub const OLE_E_CANTCONVERT: HRESULT = 0x80040011; +pub const OLE_E_NOSTORAGE: HRESULT = 0x80040012; +pub const DV_E_FORMATETC: HRESULT = 0x80040064; +pub const DV_E_DVTARGETDEVICE: HRESULT = 0x80040065; +pub const DV_E_STGMEDIUM: HRESULT = 0x80040066; +pub const DV_E_STATDATA: HRESULT = 0x80040067; +pub const DV_E_LINDEX: HRESULT = 0x80040068; +pub const DV_E_TYMED: HRESULT = 0x80040069; +pub const DV_E_CLIPFORMAT: HRESULT = 0x8004006A; +pub const DV_E_DVASPECT: HRESULT = 0x8004006B; +pub const DV_E_DVTARGETDEVICE_SIZE: HRESULT = 0x8004006C; +pub const DV_E_NOIVIEWOBJECT: HRESULT = 0x8004006D; +pub const DRAGDROP_E_FIRST: HRESULT = 0x80040100; +pub const DRAGDROP_E_LAST: HRESULT = 0x8004010F; +pub const DRAGDROP_S_FIRST: HRESULT = 0x00040100; +pub const DRAGDROP_S_LAST: HRESULT = 0x0004010F; +pub const DRAGDROP_E_NOTREGISTERED: HRESULT = 0x80040100; +pub const DRAGDROP_E_ALREADYREGISTERED: HRESULT = 0x80040101; +pub const DRAGDROP_E_INVALIDHWND: HRESULT = 0x80040102; +pub const DRAGDROP_E_CONCURRENT_DRAG_ATTEMPTED: HRESULT = 0x80040103; +pub const CLASSFACTORY_E_FIRST: HRESULT = 0x80040110; +pub const CLASSFACTORY_E_LAST: HRESULT = 0x8004011F; +pub const CLASSFACTORY_S_FIRST: HRESULT = 0x00040110; +pub const CLASSFACTORY_S_LAST: HRESULT = 0x0004011F; +pub const CLASS_E_NOAGGREGATION: HRESULT = 0x80040110; +pub const CLASS_E_CLASSNOTAVAILABLE: HRESULT = 0x80040111; +pub const CLASS_E_NOTLICENSED: HRESULT = 0x80040112; +pub const MARSHAL_E_FIRST: HRESULT = 0x80040120; +pub const MARSHAL_E_LAST: HRESULT = 0x8004012F; +pub const MARSHAL_S_FIRST: HRESULT = 0x00040120; +pub const MARSHAL_S_LAST: HRESULT = 0x0004012F; +pub const DATA_E_FIRST: HRESULT = 0x80040130; +pub const DATA_E_LAST: HRESULT = 0x8004013F; +pub const DATA_S_FIRST: HRESULT = 0x00040130; +pub const DATA_S_LAST: HRESULT = 0x0004013F; +pub const VIEW_E_FIRST: HRESULT = 0x80040140; +pub const VIEW_E_LAST: HRESULT = 0x8004014F; +pub const VIEW_S_FIRST: HRESULT = 0x00040140; +pub const VIEW_S_LAST: HRESULT = 0x0004014F; +pub const VIEW_E_DRAW: HRESULT = 0x80040140; +pub const REGDB_E_FIRST: HRESULT = 0x80040150; +pub const REGDB_E_LAST: HRESULT = 0x8004015F; +pub const REGDB_S_FIRST: HRESULT = 0x00040150; +pub const REGDB_S_LAST: HRESULT = 0x0004015F; +pub const REGDB_E_READREGDB: HRESULT = 0x80040150; +pub const REGDB_E_WRITEREGDB: HRESULT = 0x80040151; +pub const REGDB_E_KEYMISSING: HRESULT = 0x80040152; +pub const REGDB_E_INVALIDVALUE: HRESULT = 0x80040153; +pub const REGDB_E_CLASSNOTREG: HRESULT = 0x80040154; +pub const REGDB_E_IIDNOTREG: HRESULT = 0x80040155; +pub const REGDB_E_BADTHREADINGMODEL: HRESULT = 0x80040156; +pub const CAT_E_FIRST: HRESULT = 0x80040160; +pub const CAT_E_LAST: HRESULT = 0x80040161; +pub const CAT_E_CATIDNOEXIST: HRESULT = 0x80040160; +pub const CAT_E_NODESCRIPTION: HRESULT = 0x80040161; +pub const CS_E_FIRST: HRESULT = 0x80040164; +pub const CS_E_LAST: HRESULT = 0x8004016F; +pub const CS_E_PACKAGE_NOTFOUND: HRESULT = 0x80040164; +pub const CS_E_NOT_DELETABLE: HRESULT = 0x80040165; +pub const CS_E_CLASS_NOTFOUND: HRESULT = 0x80040166; +pub const CS_E_INVALID_VERSION: HRESULT = 0x80040167; +pub const CS_E_NO_CLASSSTORE: HRESULT = 0x80040168; +pub const CS_E_OBJECT_NOTFOUND: HRESULT = 0x80040169; +pub const CS_E_OBJECT_ALREADY_EXISTS: HRESULT = 0x8004016A; +pub const CS_E_INVALID_PATH: HRESULT = 0x8004016B; +pub const CS_E_NETWORK_ERROR: HRESULT = 0x8004016C; +pub const CS_E_ADMIN_LIMIT_EXCEEDED: HRESULT = 0x8004016D; +pub const CS_E_SCHEMA_MISMATCH: HRESULT = 0x8004016E; +pub const CS_E_INTERNAL_ERROR: HRESULT = 0x8004016F; +pub const CACHE_E_FIRST: HRESULT = 0x80040170; +pub const CACHE_E_LAST: HRESULT = 0x8004017F; +pub const CACHE_S_FIRST: HRESULT = 0x00040170; +pub const CACHE_S_LAST: HRESULT = 0x0004017F; +pub const CACHE_E_NOCACHE_UPDATED: HRESULT = 0x80040170; +pub const OLEOBJ_E_FIRST: HRESULT = 0x80040180; +pub const OLEOBJ_E_LAST: HRESULT = 0x8004018F; +pub const OLEOBJ_S_FIRST: HRESULT = 0x00040180; +pub const OLEOBJ_S_LAST: HRESULT = 0x0004018F; +pub const OLEOBJ_E_NOVERBS: HRESULT = 0x80040180; +pub const OLEOBJ_E_INVALIDVERB: HRESULT = 0x80040181; +pub const CLIENTSITE_E_FIRST: HRESULT = 0x80040190; +pub const CLIENTSITE_E_LAST: HRESULT = 0x8004019F; +pub const CLIENTSITE_S_FIRST: HRESULT = 0x00040190; +pub const CLIENTSITE_S_LAST: HRESULT = 0x0004019F; +pub const INPLACE_E_NOTUNDOABLE: HRESULT = 0x800401A0; +pub const INPLACE_E_NOTOOLSPACE: HRESULT = 0x800401A1; +pub const INPLACE_E_FIRST: HRESULT = 0x800401A0; +pub const INPLACE_E_LAST: HRESULT = 0x800401AF; +pub const INPLACE_S_FIRST: HRESULT = 0x000401A0; +pub const INPLACE_S_LAST: HRESULT = 0x000401AF; +pub const ENUM_E_FIRST: HRESULT = 0x800401B0; +pub const ENUM_E_LAST: HRESULT = 0x800401BF; +pub const ENUM_S_FIRST: HRESULT = 0x000401B0; +pub const ENUM_S_LAST: HRESULT = 0x000401BF; +pub const CONVERT10_E_FIRST: HRESULT = 0x800401C0; +pub const CONVERT10_E_LAST: HRESULT = 0x800401CF; +pub const CONVERT10_S_FIRST: HRESULT = 0x000401C0; +pub const CONVERT10_S_LAST: HRESULT = 0x000401CF; +pub const CONVERT10_E_OLESTREAM_GET: HRESULT = 0x800401C0; +pub const CONVERT10_E_OLESTREAM_PUT: HRESULT = 0x800401C1; +pub const CONVERT10_E_OLESTREAM_FMT: HRESULT = 0x800401C2; +pub const CONVERT10_E_OLESTREAM_BITMAP_TO_DIB: HRESULT = 0x800401C3; +pub const CONVERT10_E_STG_FMT: HRESULT = 0x800401C4; +pub const CONVERT10_E_STG_NO_STD_STREAM: HRESULT = 0x800401C5; +pub const CONVERT10_E_STG_DIB_TO_BITMAP: HRESULT = 0x800401C6; +pub const CLIPBRD_E_FIRST: HRESULT = 0x800401D0; +pub const CLIPBRD_E_LAST: HRESULT = 0x800401DF; +pub const CLIPBRD_S_FIRST: HRESULT = 0x000401D0; +pub const CLIPBRD_S_LAST: HRESULT = 0x000401DF; +pub const CLIPBRD_E_CANT_OPEN: HRESULT = 0x800401D0; +pub const CLIPBRD_E_CANT_EMPTY: HRESULT = 0x800401D1; +pub const CLIPBRD_E_CANT_SET: HRESULT = 0x800401D2; +pub const CLIPBRD_E_BAD_DATA: HRESULT = 0x800401D3; +pub const CLIPBRD_E_CANT_CLOSE: HRESULT = 0x800401D4; +pub const MK_E_FIRST: HRESULT = 0x800401E0; +pub const MK_E_LAST: HRESULT = 0x800401EF; +pub const MK_S_FIRST: HRESULT = 0x000401E0; +pub const MK_S_LAST: HRESULT = 0x000401EF; +pub const MK_E_CONNECTMANUALLY: HRESULT = 0x800401E0; +pub const MK_E_EXCEEDEDDEADLINE: HRESULT = 0x800401E1; +pub const MK_E_NEEDGENERIC: HRESULT = 0x800401E2; +pub const MK_E_UNAVAILABLE: HRESULT = 0x800401E3; +pub const MK_E_SYNTAX: HRESULT = 0x800401E4; +pub const MK_E_NOOBJECT: HRESULT = 0x800401E5; +pub const MK_E_INVALIDEXTENSION: HRESULT = 0x800401E6; +pub const MK_E_INTERMEDIATEINTERFACENOTSUPPORTED: HRESULT = 0x800401E7; +pub const MK_E_NOTBINDABLE: HRESULT = 0x800401E8; +pub const MK_E_NOTBOUND: HRESULT = 0x800401E9; +pub const MK_E_CANTOPENFILE: HRESULT = 0x800401EA; +pub const MK_E_MUSTBOTHERUSER: HRESULT = 0x800401EB; +pub const MK_E_NOINVERSE: HRESULT = 0x800401EC; +pub const MK_E_NOSTORAGE: HRESULT = 0x800401ED; +pub const MK_E_NOPREFIX: HRESULT = 0x800401EE; +pub const MK_E_ENUMERATION_FAILED: HRESULT = 0x800401EF; +pub const CO_E_FIRST: HRESULT = 0x800401F0; +pub const CO_E_LAST: HRESULT = 0x800401FF; +pub const CO_S_FIRST: HRESULT = 0x000401F0; +pub const CO_S_LAST: HRESULT = 0x000401FF; +pub const CO_E_NOTINITIALIZED: HRESULT = 0x800401F0; +pub const CO_E_ALREADYINITIALIZED: HRESULT = 0x800401F1; +pub const CO_E_CANTDETERMINECLASS: HRESULT = 0x800401F2; +pub const CO_E_CLASSSTRING: HRESULT = 0x800401F3; +pub const CO_E_IIDSTRING: HRESULT = 0x800401F4; +pub const CO_E_APPNOTFOUND: HRESULT = 0x800401F5; +pub const CO_E_APPSINGLEUSE: HRESULT = 0x800401F6; +pub const CO_E_ERRORINAPP: HRESULT = 0x800401F7; +pub const CO_E_DLLNOTFOUND: HRESULT = 0x800401F8; +pub const CO_E_ERRORINDLL: HRESULT = 0x800401F9; +pub const CO_E_WRONGOSFORAPP: HRESULT = 0x800401FA; +pub const CO_E_OBJNOTREG: HRESULT = 0x800401FB; +pub const CO_E_OBJISREG: HRESULT = 0x800401FC; +pub const CO_E_OBJNOTCONNECTED: HRESULT = 0x800401FD; +pub const CO_E_APPDIDNTREG: HRESULT = 0x800401FE; +pub const CO_E_RELEASED: HRESULT = 0x800401FF; +pub const EVENT_E_FIRST: HRESULT = 0x80040200; +pub const EVENT_E_LAST: HRESULT = 0x8004021F; +pub const EVENT_S_FIRST: HRESULT = 0x00040200; +pub const EVENT_S_LAST: HRESULT = 0x0004021F; +pub const EVENT_S_SOME_SUBSCRIBERS_FAILED: HRESULT = 0x00040200; +pub const EVENT_E_ALL_SUBSCRIBERS_FAILED: HRESULT = 0x80040201; +pub const EVENT_S_NOSUBSCRIBERS: HRESULT = 0x00040202; +pub const EVENT_E_QUERYSYNTAX: HRESULT = 0x80040203; +pub const EVENT_E_QUERYFIELD: HRESULT = 0x80040204; +pub const EVENT_E_INTERNALEXCEPTION: HRESULT = 0x80040205; +pub const EVENT_E_INTERNALERROR: HRESULT = 0x80040206; +pub const EVENT_E_INVALID_PER_USER_SID: HRESULT = 0x80040207; +pub const EVENT_E_USER_EXCEPTION: HRESULT = 0x80040208; +pub const EVENT_E_TOO_MANY_METHODS: HRESULT = 0x80040209; +pub const EVENT_E_MISSING_EVENTCLASS: HRESULT = 0x8004020A; +pub const EVENT_E_NOT_ALL_REMOVED: HRESULT = 0x8004020B; +pub const EVENT_E_COMPLUS_NOT_INSTALLED: HRESULT = 0x8004020C; +pub const EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT: HRESULT = 0x8004020D; +pub const EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT: HRESULT = 0x8004020E; +pub const EVENT_E_INVALID_EVENT_CLASS_PARTITION: HRESULT = 0x8004020F; +pub const EVENT_E_PER_USER_SID_NOT_LOGGED_ON: HRESULT = 0x80040210; +pub const TPC_E_INVALID_PROPERTY: HRESULT = 0x80040241; +pub const TPC_E_NO_DEFAULT_TABLET: HRESULT = 0x80040212; +pub const TPC_E_UNKNOWN_PROPERTY: HRESULT = 0x8004021B; +pub const TPC_E_INVALID_INPUT_RECT: HRESULT = 0x80040219; +pub const TPC_E_INVALID_STROKE: HRESULT = 0x80040222; +pub const TPC_E_INITIALIZE_FAIL: HRESULT = 0x80040223; +pub const TPC_E_NOT_RELEVANT: HRESULT = 0x80040232; +pub const TPC_E_INVALID_PACKET_DESCRIPTION: HRESULT = 0x80040233; +pub const TPC_E_RECOGNIZER_NOT_REGISTERED: HRESULT = 0x80040235; +pub const TPC_E_INVALID_RIGHTS: HRESULT = 0x80040236; +pub const TPC_E_OUT_OF_ORDER_CALL: HRESULT = 0x80040237; +pub const TPC_E_QUEUE_FULL: HRESULT = 0x80040238; +pub const TPC_E_INVALID_CONFIGURATION: HRESULT = 0x80040239; +pub const TPC_E_INVALID_DATA_FROM_RECOGNIZER: HRESULT = 0x8004023A; +pub const TPC_S_TRUNCATED: HRESULT = 0x00040252; +pub const TPC_S_INTERRUPTED: HRESULT = 0x00040253; +pub const TPC_S_NO_DATA_TO_PROCESS: HRESULT = 0x00040254; +pub const XACT_E_FIRST: HRESULT = 0x8004D000; +pub const XACT_E_LAST: HRESULT = 0x8004D02B; +pub const XACT_S_FIRST: HRESULT = 0x0004D000; +pub const XACT_S_LAST: HRESULT = 0x0004D010; +pub const XACT_E_ALREADYOTHERSINGLEPHASE: HRESULT = 0x8004D000; +pub const XACT_E_CANTRETAIN: HRESULT = 0x8004D001; +pub const XACT_E_COMMITFAILED: HRESULT = 0x8004D002; +pub const XACT_E_COMMITPREVENTED: HRESULT = 0x8004D003; +pub const XACT_E_HEURISTICABORT: HRESULT = 0x8004D004; +pub const XACT_E_HEURISTICCOMMIT: HRESULT = 0x8004D005; +pub const XACT_E_HEURISTICDAMAGE: HRESULT = 0x8004D006; +pub const XACT_E_HEURISTICDANGER: HRESULT = 0x8004D007; +pub const XACT_E_ISOLATIONLEVEL: HRESULT = 0x8004D008; +pub const XACT_E_NOASYNC: HRESULT = 0x8004D009; +pub const XACT_E_NOENLIST: HRESULT = 0x8004D00A; +pub const XACT_E_NOISORETAIN: HRESULT = 0x8004D00B; +pub const XACT_E_NORESOURCE: HRESULT = 0x8004D00C; +pub const XACT_E_NOTCURRENT: HRESULT = 0x8004D00D; +pub const XACT_E_NOTRANSACTION: HRESULT = 0x8004D00E; +pub const XACT_E_NOTSUPPORTED: HRESULT = 0x8004D00F; +pub const XACT_E_UNKNOWNRMGRID: HRESULT = 0x8004D010; +pub const XACT_E_WRONGSTATE: HRESULT = 0x8004D011; +pub const XACT_E_WRONGUOW: HRESULT = 0x8004D012; +pub const XACT_E_XTIONEXISTS: HRESULT = 0x8004D013; +pub const XACT_E_NOIMPORTOBJECT: HRESULT = 0x8004D014; +pub const XACT_E_INVALIDCOOKIE: HRESULT = 0x8004D015; +pub const XACT_E_INDOUBT: HRESULT = 0x8004D016; +pub const XACT_E_NOTIMEOUT: HRESULT = 0x8004D017; +pub const XACT_E_ALREADYINPROGRESS: HRESULT = 0x8004D018; +pub const XACT_E_ABORTED: HRESULT = 0x8004D019; +pub const XACT_E_LOGFULL: HRESULT = 0x8004D01A; +pub const XACT_E_TMNOTAVAILABLE: HRESULT = 0x8004D01B; +pub const XACT_E_CONNECTION_DOWN: HRESULT = 0x8004D01C; +pub const XACT_E_CONNECTION_DENIED: HRESULT = 0x8004D01D; +pub const XACT_E_REENLISTTIMEOUT: HRESULT = 0x8004D01E; +pub const XACT_E_TIP_CONNECT_FAILED: HRESULT = 0x8004D01F; +pub const XACT_E_TIP_PROTOCOL_ERROR: HRESULT = 0x8004D020; +pub const XACT_E_TIP_PULL_FAILED: HRESULT = 0x8004D021; +pub const XACT_E_DEST_TMNOTAVAILABLE: HRESULT = 0x8004D022; +pub const XACT_E_TIP_DISABLED: HRESULT = 0x8004D023; +pub const XACT_E_NETWORK_TX_DISABLED: HRESULT = 0x8004D024; +pub const XACT_E_PARTNER_NETWORK_TX_DISABLED: HRESULT = 0x8004D025; +pub const XACT_E_XA_TX_DISABLED: HRESULT = 0x8004D026; +pub const XACT_E_UNABLE_TO_READ_DTC_CONFIG: HRESULT = 0x8004D027; +pub const XACT_E_UNABLE_TO_LOAD_DTC_PROXY: HRESULT = 0x8004D028; +pub const XACT_E_ABORTING: HRESULT = 0x8004D029; +pub const XACT_E_PUSH_COMM_FAILURE: HRESULT = 0x8004D02A; +pub const XACT_E_PULL_COMM_FAILURE: HRESULT = 0x8004D02B; +pub const XACT_E_LU_TX_DISABLED: HRESULT = 0x8004D02C; +pub const XACT_E_CLERKNOTFOUND: HRESULT = 0x8004D080; +pub const XACT_E_CLERKEXISTS: HRESULT = 0x8004D081; +pub const XACT_E_RECOVERYINPROGRESS: HRESULT = 0x8004D082; +pub const XACT_E_TRANSACTIONCLOSED: HRESULT = 0x8004D083; +pub const XACT_E_INVALIDLSN: HRESULT = 0x8004D084; +pub const XACT_E_REPLAYREQUEST: HRESULT = 0x8004D085; +pub const XACT_S_ASYNC: HRESULT = 0x0004D000; +pub const XACT_S_DEFECT: HRESULT = 0x0004D001; +pub const XACT_S_READONLY: HRESULT = 0x0004D002; +pub const XACT_S_SOMENORETAIN: HRESULT = 0x0004D003; +pub const XACT_S_OKINFORM: HRESULT = 0x0004D004; +pub const XACT_S_MADECHANGESCONTENT: HRESULT = 0x0004D005; +pub const XACT_S_MADECHANGESINFORM: HRESULT = 0x0004D006; +pub const XACT_S_ALLNORETAIN: HRESULT = 0x0004D007; +pub const XACT_S_ABORTING: HRESULT = 0x0004D008; +pub const XACT_S_SINGLEPHASE: HRESULT = 0x0004D009; +pub const XACT_S_LOCALLY_OK: HRESULT = 0x0004D00A; +pub const XACT_S_LASTRESOURCEMANAGER: HRESULT = 0x0004D010; +pub const CONTEXT_E_FIRST: HRESULT = 0x8004E000; +pub const CONTEXT_E_LAST: HRESULT = 0x8004E02F; +pub const CONTEXT_S_FIRST: HRESULT = 0x0004E000; +pub const CONTEXT_S_LAST: HRESULT = 0x0004E02F; +pub const CONTEXT_E_ABORTED: HRESULT = 0x8004E002; +pub const CONTEXT_E_ABORTING: HRESULT = 0x8004E003; +pub const CONTEXT_E_NOCONTEXT: HRESULT = 0x8004E004; +pub const CONTEXT_E_WOULD_DEADLOCK: HRESULT = 0x8004E005; +pub const CONTEXT_E_SYNCH_TIMEOUT: HRESULT = 0x8004E006; +pub const CONTEXT_E_OLDREF: HRESULT = 0x8004E007; +pub const CONTEXT_E_ROLENOTFOUND: HRESULT = 0x8004E00C; +pub const CONTEXT_E_TMNOTAVAILABLE: HRESULT = 0x8004E00F; +pub const CO_E_ACTIVATIONFAILED: HRESULT = 0x8004E021; +pub const CO_E_ACTIVATIONFAILED_EVENTLOGGED: HRESULT = 0x8004E022; +pub const CO_E_ACTIVATIONFAILED_CATALOGERROR: HRESULT = 0x8004E023; +pub const CO_E_ACTIVATIONFAILED_TIMEOUT: HRESULT = 0x8004E024; +pub const CO_E_INITIALIZATIONFAILED: HRESULT = 0x8004E025; +pub const CONTEXT_E_NOJIT: HRESULT = 0x8004E026; +pub const CONTEXT_E_NOTRANSACTION: HRESULT = 0x8004E027; +pub const CO_E_THREADINGMODEL_CHANGED: HRESULT = 0x8004E028; +pub const CO_E_NOIISINTRINSICS: HRESULT = 0x8004E029; +pub const CO_E_NOCOOKIES: HRESULT = 0x8004E02A; +pub const CO_E_DBERROR: HRESULT = 0x8004E02B; +pub const CO_E_NOTPOOLED: HRESULT = 0x8004E02C; +pub const CO_E_NOTCONSTRUCTED: HRESULT = 0x8004E02D; +pub const CO_E_NOSYNCHRONIZATION: HRESULT = 0x8004E02E; +pub const CO_E_ISOLEVELMISMATCH: HRESULT = 0x8004E02F; +pub const CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED: HRESULT = 0x8004E030; +pub const CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED: HRESULT = 0x8004E031; +pub const OLE_S_USEREG: HRESULT = 0x00040000; +pub const OLE_S_STATIC: HRESULT = 0x00040001; +pub const OLE_S_MAC_CLIPFORMAT: HRESULT = 0x00040002; +pub const DRAGDROP_S_DROP: HRESULT = 0x00040100; +pub const DRAGDROP_S_CANCEL: HRESULT = 0x00040101; +pub const DRAGDROP_S_USEDEFAULTCURSORS: HRESULT = 0x00040102; +pub const DATA_S_SAMEFORMATETC: HRESULT = 0x00040130; +pub const VIEW_S_ALREADY_FROZEN: HRESULT = 0x00040140; +pub const CACHE_S_FORMATETC_NOTSUPPORTED: HRESULT = 0x00040170; +pub const CACHE_S_SAMECACHE: HRESULT = 0x00040171; +pub const CACHE_S_SOMECACHES_NOTUPDATED: HRESULT = 0x00040172; +pub const OLEOBJ_S_INVALIDVERB: HRESULT = 0x00040180; +pub const OLEOBJ_S_CANNOT_DOVERB_NOW: HRESULT = 0x00040181; +pub const OLEOBJ_S_INVALIDHWND: HRESULT = 0x00040182; +pub const INPLACE_S_TRUNCATED: HRESULT = 0x000401A0; +pub const CONVERT10_S_NO_PRESENTATION: HRESULT = 0x000401C0; +pub const MK_S_REDUCED_TO_SELF: HRESULT = 0x000401E2; +pub const MK_S_ME: HRESULT = 0x000401E4; +pub const MK_S_HIM: HRESULT = 0x000401E5; +pub const MK_S_US: HRESULT = 0x000401E6; +pub const MK_S_MONIKERALREADYREGISTERED: HRESULT = 0x000401E7; +pub const SCHED_S_TASK_READY: HRESULT = 0x00041300; +pub const SCHED_S_TASK_RUNNING: HRESULT = 0x00041301; +pub const SCHED_S_TASK_DISABLED: HRESULT = 0x00041302; +pub const SCHED_S_TASK_HAS_NOT_RUN: HRESULT = 0x00041303; +pub const SCHED_S_TASK_NO_MORE_RUNS: HRESULT = 0x00041304; +pub const SCHED_S_TASK_NOT_SCHEDULED: HRESULT = 0x00041305; +pub const SCHED_S_TASK_TERMINATED: HRESULT = 0x00041306; +pub const SCHED_S_TASK_NO_VALID_TRIGGERS: HRESULT = 0x00041307; +pub const SCHED_S_EVENT_TRIGGER: HRESULT = 0x00041308; +pub const SCHED_E_TRIGGER_NOT_FOUND: HRESULT = 0x80041309; +pub const SCHED_E_TASK_NOT_READY: HRESULT = 0x8004130A; +pub const SCHED_E_TASK_NOT_RUNNING: HRESULT = 0x8004130B; +pub const SCHED_E_SERVICE_NOT_INSTALLED: HRESULT = 0x8004130C; +pub const SCHED_E_CANNOT_OPEN_TASK: HRESULT = 0x8004130D; +pub const SCHED_E_INVALID_TASK: HRESULT = 0x8004130E; +pub const SCHED_E_ACCOUNT_INFORMATION_NOT_SET: HRESULT = 0x8004130F; +pub const SCHED_E_ACCOUNT_NAME_NOT_FOUND: HRESULT = 0x80041310; +pub const SCHED_E_ACCOUNT_DBASE_CORRUPT: HRESULT = 0x80041311; +pub const SCHED_E_NO_SECURITY_SERVICES: HRESULT = 0x80041312; +pub const SCHED_E_UNKNOWN_OBJECT_VERSION: HRESULT = 0x80041313; +pub const SCHED_E_UNSUPPORTED_ACCOUNT_OPTION: HRESULT = 0x80041314; +pub const SCHED_E_SERVICE_NOT_RUNNING: HRESULT = 0x80041315; +pub const SCHED_E_UNEXPECTEDNODE: HRESULT = 0x80041316; +pub const SCHED_E_NAMESPACE: HRESULT = 0x80041317; +pub const SCHED_E_INVALIDVALUE: HRESULT = 0x80041318; +pub const SCHED_E_MISSINGNODE: HRESULT = 0x80041319; +pub const SCHED_E_MALFORMEDXML: HRESULT = 0x8004131A; +pub const SCHED_S_SOME_TRIGGERS_FAILED: HRESULT = 0x0004131B; +pub const SCHED_S_BATCH_LOGON_PROBLEM: HRESULT = 0x0004131C; +pub const SCHED_E_TOO_MANY_NODES: HRESULT = 0x8004131D; +pub const SCHED_E_PAST_END_BOUNDARY: HRESULT = 0x8004131E; +pub const SCHED_E_ALREADY_RUNNING: HRESULT = 0x8004131F; +pub const SCHED_E_USER_NOT_LOGGED_ON: HRESULT = 0x80041320; +pub const SCHED_E_INVALID_TASK_HASH: HRESULT = 0x80041321; +pub const SCHED_E_SERVICE_NOT_AVAILABLE: HRESULT = 0x80041322; +pub const SCHED_E_SERVICE_TOO_BUSY: HRESULT = 0x80041323; +pub const SCHED_E_TASK_ATTEMPTED: HRESULT = 0x80041324; +pub const SCHED_S_TASK_QUEUED: HRESULT = 0x00041325; +pub const SCHED_E_TASK_DISABLED: HRESULT = 0x80041326; +pub const SCHED_E_TASK_NOT_V1_COMPAT: HRESULT = 0x80041327; +pub const SCHED_E_START_ON_DEMAND: HRESULT = 0x80041328; +pub const SCHED_E_TASK_NOT_UBPM_COMPAT: HRESULT = 0x80041329; +pub const SCHED_E_DEPRECATED_FEATURE_USED: HRESULT = 0x80041330; +pub const CO_E_CLASS_CREATE_FAILED: HRESULT = 0x80080001; +pub const CO_E_SCM_ERROR: HRESULT = 0x80080002; +pub const CO_E_SCM_RPC_FAILURE: HRESULT = 0x80080003; +pub const CO_E_BAD_PATH: HRESULT = 0x80080004; +pub const CO_E_SERVER_EXEC_FAILURE: HRESULT = 0x80080005; +pub const CO_E_OBJSRV_RPC_FAILURE: HRESULT = 0x80080006; +pub const MK_E_NO_NORMALIZED: HRESULT = 0x80080007; +pub const CO_E_SERVER_STOPPING: HRESULT = 0x80080008; +pub const MEM_E_INVALID_ROOT: HRESULT = 0x80080009; +pub const MEM_E_INVALID_LINK: HRESULT = 0x80080010; +pub const MEM_E_INVALID_SIZE: HRESULT = 0x80080011; +pub const CO_S_NOTALLINTERFACES: HRESULT = 0x00080012; +pub const CO_S_MACHINENAMENOTFOUND: HRESULT = 0x00080013; +pub const CO_E_MISSING_DISPLAYNAME: HRESULT = 0x80080015; +pub const CO_E_RUNAS_VALUE_MUST_BE_AAA: HRESULT = 0x80080016; +pub const CO_E_ELEVATION_DISABLED: HRESULT = 0x80080017; +pub const APPX_E_PACKAGING_INTERNAL: HRESULT = 0x80080200; +pub const APPX_E_INTERLEAVING_NOT_ALLOWED: HRESULT = 0x80080201; +pub const APPX_E_RELATIONSHIPS_NOT_ALLOWED: HRESULT = 0x80080202; +pub const APPX_E_MISSING_REQUIRED_FILE: HRESULT = 0x80080203; +pub const APPX_E_INVALID_MANIFEST: HRESULT = 0x80080204; +pub const APPX_E_INVALID_BLOCKMAP: HRESULT = 0x80080205; +pub const APPX_E_CORRUPT_CONTENT: HRESULT = 0x80080206; +pub const APPX_E_BLOCK_HASH_INVALID: HRESULT = 0x80080207; +pub const APPX_E_REQUESTED_RANGE_TOO_LARGE: HRESULT = 0x80080208; +pub const APPX_E_INVALID_SIP_CLIENT_DATA: HRESULT = 0x80080209; +pub const BT_E_SPURIOUS_ACTIVATION: HRESULT = 0x80080300; +pub const DISP_E_UNKNOWNINTERFACE: HRESULT = 0x80020001; +pub const DISP_E_MEMBERNOTFOUND: HRESULT = 0x80020003; +pub const DISP_E_PARAMNOTFOUND: HRESULT = 0x80020004; +pub const DISP_E_TYPEMISMATCH: HRESULT = 0x80020005; +pub const DISP_E_UNKNOWNNAME: HRESULT = 0x80020006; +pub const DISP_E_NONAMEDARGS: HRESULT = 0x80020007; +pub const DISP_E_BADVARTYPE: HRESULT = 0x80020008; +pub const DISP_E_EXCEPTION: HRESULT = 0x80020009; +pub const DISP_E_OVERFLOW: HRESULT = 0x8002000A; +pub const DISP_E_BADINDEX: HRESULT = 0x8002000B; +pub const DISP_E_UNKNOWNLCID: HRESULT = 0x8002000C; +pub const DISP_E_ARRAYISLOCKED: HRESULT = 0x8002000D; +pub const DISP_E_BADPARAMCOUNT: HRESULT = 0x8002000E; +pub const DISP_E_PARAMNOTOPTIONAL: HRESULT = 0x8002000F; +pub const DISP_E_BADCALLEE: HRESULT = 0x80020010; +pub const DISP_E_NOTACOLLECTION: HRESULT = 0x80020011; +pub const DISP_E_DIVBYZERO: HRESULT = 0x80020012; +pub const DISP_E_BUFFERTOOSMALL: HRESULT = 0x80020013; +pub const TYPE_E_BUFFERTOOSMALL: HRESULT = 0x80028016; +pub const TYPE_E_FIELDNOTFOUND: HRESULT = 0x80028017; +pub const TYPE_E_INVDATAREAD: HRESULT = 0x80028018; +pub const TYPE_E_UNSUPFORMAT: HRESULT = 0x80028019; +pub const TYPE_E_REGISTRYACCESS: HRESULT = 0x8002801C; +pub const TYPE_E_LIBNOTREGISTERED: HRESULT = 0x8002801D; +pub const TYPE_E_UNDEFINEDTYPE: HRESULT = 0x80028027; +pub const TYPE_E_QUALIFIEDNAMEDISALLOWED: HRESULT = 0x80028028; +pub const TYPE_E_INVALIDSTATE: HRESULT = 0x80028029; +pub const TYPE_E_WRONGTYPEKIND: HRESULT = 0x8002802A; +pub const TYPE_E_ELEMENTNOTFOUND: HRESULT = 0x8002802B; +pub const TYPE_E_AMBIGUOUSNAME: HRESULT = 0x8002802C; +pub const TYPE_E_NAMECONFLICT: HRESULT = 0x8002802D; +pub const TYPE_E_UNKNOWNLCID: HRESULT = 0x8002802E; +pub const TYPE_E_DLLFUNCTIONNOTFOUND: HRESULT = 0x8002802F; +pub const TYPE_E_BADMODULEKIND: HRESULT = 0x800288BD; +pub const TYPE_E_SIZETOOBIG: HRESULT = 0x800288C5; +pub const TYPE_E_DUPLICATEID: HRESULT = 0x800288C6; +pub const TYPE_E_INVALIDID: HRESULT = 0x800288CF; +pub const TYPE_E_TYPEMISMATCH: HRESULT = 0x80028CA0; +pub const TYPE_E_OUTOFBOUNDS: HRESULT = 0x80028CA1; +pub const TYPE_E_IOERROR: HRESULT = 0x80028CA2; +pub const TYPE_E_CANTCREATETMPFILE: HRESULT = 0x80028CA3; +pub const TYPE_E_CANTLOADLIBRARY: HRESULT = 0x80029C4A; +pub const TYPE_E_INCONSISTENTPROPFUNCS: HRESULT = 0x80029C83; +pub const TYPE_E_CIRCULARTYPE: HRESULT = 0x80029C84; +pub const STG_E_INVALIDFUNCTION: HRESULT = 0x80030001; +pub const STG_E_FILENOTFOUND: HRESULT = 0x80030002; +pub const STG_E_PATHNOTFOUND: HRESULT = 0x80030003; +pub const STG_E_TOOMANYOPENFILES: HRESULT = 0x80030004; +pub const STG_E_ACCESSDENIED: HRESULT = 0x80030005; +pub const STG_E_INVALIDHANDLE: HRESULT = 0x80030006; +pub const STG_E_INSUFFICIENTMEMORY: HRESULT = 0x80030008; +pub const STG_E_INVALIDPOINTER: HRESULT = 0x80030009; +pub const STG_E_NOMOREFILES: HRESULT = 0x80030012; +pub const STG_E_DISKISWRITEPROTECTED: HRESULT = 0x80030013; +pub const STG_E_SEEKERROR: HRESULT = 0x80030019; +pub const STG_E_WRITEFAULT: HRESULT = 0x8003001D; +pub const STG_E_READFAULT: HRESULT = 0x8003001E; +pub const STG_E_SHAREVIOLATION: HRESULT = 0x80030020; +pub const STG_E_LOCKVIOLATION: HRESULT = 0x80030021; +pub const STG_E_FILEALREADYEXISTS: HRESULT = 0x80030050; +pub const STG_E_INVALIDPARAMETER: HRESULT = 0x80030057; +pub const STG_E_MEDIUMFULL: HRESULT = 0x80030070; +pub const STG_E_PROPSETMISMATCHED: HRESULT = 0x800300F0; +pub const STG_E_ABNORMALAPIEXIT: HRESULT = 0x800300FA; +pub const STG_E_INVALIDHEADER: HRESULT = 0x800300FB; +pub const STG_E_INVALIDNAME: HRESULT = 0x800300FC; +pub const STG_E_UNKNOWN: HRESULT = 0x800300FD; +pub const STG_E_UNIMPLEMENTEDFUNCTION: HRESULT = 0x800300FE; +pub const STG_E_INVALIDFLAG: HRESULT = 0x800300FF; +pub const STG_E_INUSE: HRESULT = 0x80030100; +pub const STG_E_NOTCURRENT: HRESULT = 0x80030101; +pub const STG_E_REVERTED: HRESULT = 0x80030102; +pub const STG_E_CANTSAVE: HRESULT = 0x80030103; +pub const STG_E_OLDFORMAT: HRESULT = 0x80030104; +pub const STG_E_OLDDLL: HRESULT = 0x80030105; +pub const STG_E_SHAREREQUIRED: HRESULT = 0x80030106; +pub const STG_E_NOTFILEBASEDSTORAGE: HRESULT = 0x80030107; +pub const STG_E_EXTANTMARSHALLINGS: HRESULT = 0x80030108; +pub const STG_E_DOCFILECORRUPT: HRESULT = 0x80030109; +pub const STG_E_BADBASEADDRESS: HRESULT = 0x80030110; +pub const STG_E_DOCFILETOOLARGE: HRESULT = 0x80030111; +pub const STG_E_NOTSIMPLEFORMAT: HRESULT = 0x80030112; +pub const STG_E_INCOMPLETE: HRESULT = 0x80030201; +pub const STG_E_TERMINATED: HRESULT = 0x80030202; +pub const STG_S_CONVERTED: HRESULT = 0x00030200; +pub const STG_S_BLOCK: HRESULT = 0x00030201; +pub const STG_S_RETRYNOW: HRESULT = 0x00030202; +pub const STG_S_MONITORING: HRESULT = 0x00030203; +pub const STG_S_MULTIPLEOPENS: HRESULT = 0x00030204; +pub const STG_S_CONSOLIDATIONFAILED: HRESULT = 0x00030205; +pub const STG_S_CANNOTCONSOLIDATE: HRESULT = 0x00030206; +pub const STG_E_STATUS_COPY_PROTECTION_FAILURE: HRESULT = 0x80030305; +pub const STG_E_CSS_AUTHENTICATION_FAILURE: HRESULT = 0x80030306; +pub const STG_E_CSS_KEY_NOT_PRESENT: HRESULT = 0x80030307; +pub const STG_E_CSS_KEY_NOT_ESTABLISHED: HRESULT = 0x80030308; +pub const STG_E_CSS_SCRAMBLED_SECTOR: HRESULT = 0x80030309; +pub const STG_E_CSS_REGION_MISMATCH: HRESULT = 0x8003030A; +pub const STG_E_RESETS_EXHAUSTED: HRESULT = 0x8003030B; +pub const RPC_E_CALL_REJECTED: HRESULT = 0x80010001; +pub const RPC_E_CALL_CANCELED: HRESULT = 0x80010002; +pub const RPC_E_CANTPOST_INSENDCALL: HRESULT = 0x80010003; +pub const RPC_E_CANTCALLOUT_INASYNCCALL: HRESULT = 0x80010004; +pub const RPC_E_CANTCALLOUT_INEXTERNALCALL: HRESULT = 0x80010005; +pub const RPC_E_CONNECTION_TERMINATED: HRESULT = 0x80010006; +pub const RPC_E_SERVER_DIED: HRESULT = 0x80010007; +pub const RPC_E_CLIENT_DIED: HRESULT = 0x80010008; +pub const RPC_E_INVALID_DATAPACKET: HRESULT = 0x80010009; +pub const RPC_E_CANTTRANSMIT_CALL: HRESULT = 0x8001000A; +pub const RPC_E_CLIENT_CANTMARSHAL_DATA: HRESULT = 0x8001000B; +pub const RPC_E_CLIENT_CANTUNMARSHAL_DATA: HRESULT = 0x8001000C; +pub const RPC_E_SERVER_CANTMARSHAL_DATA: HRESULT = 0x8001000D; +pub const RPC_E_SERVER_CANTUNMARSHAL_DATA: HRESULT = 0x8001000E; +pub const RPC_E_INVALID_DATA: HRESULT = 0x8001000F; +pub const RPC_E_INVALID_PARAMETER: HRESULT = 0x80010010; +pub const RPC_E_CANTCALLOUT_AGAIN: HRESULT = 0x80010011; +pub const RPC_E_SERVER_DIED_DNE: HRESULT = 0x80010012; +pub const RPC_E_SYS_CALL_FAILED: HRESULT = 0x80010100; +pub const RPC_E_OUT_OF_RESOURCES: HRESULT = 0x80010101; +pub const RPC_E_ATTEMPTED_MULTITHREAD: HRESULT = 0x80010102; +pub const RPC_E_NOT_REGISTERED: HRESULT = 0x80010103; +pub const RPC_E_FAULT: HRESULT = 0x80010104; +pub const RPC_E_SERVERFAULT: HRESULT = 0x80010105; +pub const RPC_E_CHANGED_MODE: HRESULT = 0x80010106; +pub const RPC_E_INVALIDMETHOD: HRESULT = 0x80010107; +pub const RPC_E_DISCONNECTED: HRESULT = 0x80010108; +pub const RPC_E_RETRY: HRESULT = 0x80010109; +pub const RPC_E_SERVERCALL_RETRYLATER: HRESULT = 0x8001010A; +pub const RPC_E_SERVERCALL_REJECTED: HRESULT = 0x8001010B; +pub const RPC_E_INVALID_CALLDATA: HRESULT = 0x8001010C; +pub const RPC_E_CANTCALLOUT_ININPUTSYNCCALL: HRESULT = 0x8001010D; +pub const RPC_E_WRONG_THREAD: HRESULT = 0x8001010E; +pub const RPC_E_THREAD_NOT_INIT: HRESULT = 0x8001010F; +pub const RPC_E_VERSION_MISMATCH: HRESULT = 0x80010110; +pub const RPC_E_INVALID_HEADER: HRESULT = 0x80010111; +pub const RPC_E_INVALID_EXTENSION: HRESULT = 0x80010112; +pub const RPC_E_INVALID_IPID: HRESULT = 0x80010113; +pub const RPC_E_INVALID_OBJECT: HRESULT = 0x80010114; +pub const RPC_S_CALLPENDING: HRESULT = 0x80010115; +pub const RPC_S_WAITONTIMER: HRESULT = 0x80010116; +pub const RPC_E_CALL_COMPLETE: HRESULT = 0x80010117; +pub const RPC_E_UNSECURE_CALL: HRESULT = 0x80010118; +pub const RPC_E_TOO_LATE: HRESULT = 0x80010119; +pub const RPC_E_NO_GOOD_SECURITY_PACKAGES: HRESULT = 0x8001011A; +pub const RPC_E_ACCESS_DENIED: HRESULT = 0x8001011B; +pub const RPC_E_REMOTE_DISABLED: HRESULT = 0x8001011C; +pub const RPC_E_INVALID_OBJREF: HRESULT = 0x8001011D; +pub const RPC_E_NO_CONTEXT: HRESULT = 0x8001011E; +pub const RPC_E_TIMEOUT: HRESULT = 0x8001011F; +pub const RPC_E_NO_SYNC: HRESULT = 0x80010120; +pub const RPC_E_FULLSIC_REQUIRED: HRESULT = 0x80010121; +pub const RPC_E_INVALID_STD_NAME: HRESULT = 0x80010122; +pub const CO_E_FAILEDTOIMPERSONATE: HRESULT = 0x80010123; +pub const CO_E_FAILEDTOGETSECCTX: HRESULT = 0x80010124; +pub const CO_E_FAILEDTOOPENTHREADTOKEN: HRESULT = 0x80010125; +pub const CO_E_FAILEDTOGETTOKENINFO: HRESULT = 0x80010126; +pub const CO_E_TRUSTEEDOESNTMATCHCLIENT: HRESULT = 0x80010127; +pub const CO_E_FAILEDTOQUERYCLIENTBLANKET: HRESULT = 0x80010128; +pub const CO_E_FAILEDTOSETDACL: HRESULT = 0x80010129; +pub const CO_E_ACCESSCHECKFAILED: HRESULT = 0x8001012A; +pub const CO_E_NETACCESSAPIFAILED: HRESULT = 0x8001012B; +pub const CO_E_WRONGTRUSTEENAMESYNTAX: HRESULT = 0x8001012C; +pub const CO_E_INVALIDSID: HRESULT = 0x8001012D; +pub const CO_E_CONVERSIONFAILED: HRESULT = 0x8001012E; +pub const CO_E_NOMATCHINGSIDFOUND: HRESULT = 0x8001012F; +pub const CO_E_LOOKUPACCSIDFAILED: HRESULT = 0x80010130; +pub const CO_E_NOMATCHINGNAMEFOUND: HRESULT = 0x80010131; +pub const CO_E_LOOKUPACCNAMEFAILED: HRESULT = 0x80010132; +pub const CO_E_SETSERLHNDLFAILED: HRESULT = 0x80010133; +pub const CO_E_FAILEDTOGETWINDIR: HRESULT = 0x80010134; +pub const CO_E_PATHTOOLONG: HRESULT = 0x80010135; +pub const CO_E_FAILEDTOGENUUID: HRESULT = 0x80010136; +pub const CO_E_FAILEDTOCREATEFILE: HRESULT = 0x80010137; +pub const CO_E_FAILEDTOCLOSEHANDLE: HRESULT = 0x80010138; +pub const CO_E_EXCEEDSYSACLLIMIT: HRESULT = 0x80010139; +pub const CO_E_ACESINWRONGORDER: HRESULT = 0x8001013A; +pub const CO_E_INCOMPATIBLESTREAMVERSION: HRESULT = 0x8001013B; +pub const CO_E_FAILEDTOOPENPROCESSTOKEN: HRESULT = 0x8001013C; +pub const CO_E_DECODEFAILED: HRESULT = 0x8001013D; +pub const CO_E_ACNOTINITIALIZED: HRESULT = 0x8001013F; +pub const CO_E_CANCEL_DISABLED: HRESULT = 0x80010140; +pub const RPC_E_UNEXPECTED: HRESULT = 0x8001FFFF; +pub const ERROR_AUDITING_DISABLED: HRESULT = 0xC0090001; +pub const ERROR_ALL_SIDS_FILTERED: HRESULT = 0xC0090002; +pub const ERROR_BIZRULES_NOT_ENABLED: HRESULT = 0xC0090003; +pub const NTE_BAD_UID: HRESULT = 0x80090001; +pub const NTE_BAD_HASH: HRESULT = 0x80090002; +pub const NTE_BAD_KEY: HRESULT = 0x80090003; +pub const NTE_BAD_LEN: HRESULT = 0x80090004; +pub const NTE_BAD_DATA: HRESULT = 0x80090005; +pub const NTE_BAD_SIGNATURE: HRESULT = 0x80090006; +pub const NTE_BAD_VER: HRESULT = 0x80090007; +pub const NTE_BAD_ALGID: HRESULT = 0x80090008; +pub const NTE_BAD_FLAGS: HRESULT = 0x80090009; +pub const NTE_BAD_TYPE: HRESULT = 0x8009000A; +pub const NTE_BAD_KEY_STATE: HRESULT = 0x8009000B; +pub const NTE_BAD_HASH_STATE: HRESULT = 0x8009000C; +pub const NTE_NO_KEY: HRESULT = 0x8009000D; +pub const NTE_NO_MEMORY: HRESULT = 0x8009000E; +pub const NTE_EXISTS: HRESULT = 0x8009000F; +pub const NTE_PERM: HRESULT = 0x80090010; +pub const NTE_NOT_FOUND: HRESULT = 0x80090011; +pub const NTE_DOUBLE_ENCRYPT: HRESULT = 0x80090012; +pub const NTE_BAD_PROVIDER: HRESULT = 0x80090013; +pub const NTE_BAD_PROV_TYPE: HRESULT = 0x80090014; +pub const NTE_BAD_PUBLIC_KEY: HRESULT = 0x80090015; +pub const NTE_BAD_KEYSET: HRESULT = 0x80090016; +pub const NTE_PROV_TYPE_NOT_DEF: HRESULT = 0x80090017; +pub const NTE_PROV_TYPE_ENTRY_BAD: HRESULT = 0x80090018; +pub const NTE_KEYSET_NOT_DEF: HRESULT = 0x80090019; +pub const NTE_KEYSET_ENTRY_BAD: HRESULT = 0x8009001A; +pub const NTE_PROV_TYPE_NO_MATCH: HRESULT = 0x8009001B; +pub const NTE_SIGNATURE_FILE_BAD: HRESULT = 0x8009001C; +pub const NTE_PROVIDER_DLL_FAIL: HRESULT = 0x8009001D; +pub const NTE_PROV_DLL_NOT_FOUND: HRESULT = 0x8009001E; +pub const NTE_BAD_KEYSET_PARAM: HRESULT = 0x8009001F; +pub const NTE_FAIL: HRESULT = 0x80090020; +pub const NTE_SYS_ERR: HRESULT = 0x80090021; +pub const NTE_SILENT_CONTEXT: HRESULT = 0x80090022; +pub const NTE_TOKEN_KEYSET_STORAGE_FULL: HRESULT = 0x80090023; +pub const NTE_TEMPORARY_PROFILE: HRESULT = 0x80090024; +pub const NTE_FIXEDPARAMETER: HRESULT = 0x80090025; +pub const NTE_INVALID_HANDLE: HRESULT = 0x80090026; +pub const NTE_INVALID_PARAMETER: HRESULT = 0x80090027; +pub const NTE_BUFFER_TOO_SMALL: HRESULT = 0x80090028; +pub const NTE_NOT_SUPPORTED: HRESULT = 0x80090029; +pub const NTE_NO_MORE_ITEMS: HRESULT = 0x8009002A; +pub const NTE_BUFFERS_OVERLAP: HRESULT = 0x8009002B; +pub const NTE_DECRYPTION_FAILURE: HRESULT = 0x8009002C; +pub const NTE_INTERNAL_ERROR: HRESULT = 0x8009002D; +pub const NTE_UI_REQUIRED: HRESULT = 0x8009002E; +pub const NTE_HMAC_NOT_SUPPORTED: HRESULT = 0x8009002F; +pub const NTE_DEVICE_NOT_READY: HRESULT = 0x80090030; +pub const NTE_AUTHENTICATION_IGNORED: HRESULT = 0x80090031; +pub const NTE_VALIDATION_FAILED: HRESULT = 0x80090032; +pub const NTE_INCORRECT_PASSWORD: HRESULT = 0x80090033; +pub const NTE_ENCRYPTION_FAILURE: HRESULT = 0x80090034; +pub const NTE_DEVICE_NOT_FOUND: HRESULT = 0x80090035; +pub const SEC_E_INSUFFICIENT_MEMORY: HRESULT = 0x80090300; +pub const SEC_E_INVALID_HANDLE: HRESULT = 0x80090301; +pub const SEC_E_UNSUPPORTED_FUNCTION: HRESULT = 0x80090302; +pub const SEC_E_TARGET_UNKNOWN: HRESULT = 0x80090303; +pub const SEC_E_INTERNAL_ERROR: HRESULT = 0x80090304; +pub const SEC_E_SECPKG_NOT_FOUND: HRESULT = 0x80090305; +pub const SEC_E_NOT_OWNER: HRESULT = 0x80090306; +pub const SEC_E_CANNOT_INSTALL: HRESULT = 0x80090307; +pub const SEC_E_INVALID_TOKEN: HRESULT = 0x80090308; +pub const SEC_E_CANNOT_PACK: HRESULT = 0x80090309; +pub const SEC_E_QOP_NOT_SUPPORTED: HRESULT = 0x8009030A; +pub const SEC_E_NO_IMPERSONATION: HRESULT = 0x8009030B; +pub const SEC_E_LOGON_DENIED: HRESULT = 0x8009030C; +pub const SEC_E_UNKNOWN_CREDENTIALS: HRESULT = 0x8009030D; +pub const SEC_E_NO_CREDENTIALS: HRESULT = 0x8009030E; +pub const SEC_E_MESSAGE_ALTERED: HRESULT = 0x8009030F; +pub const SEC_E_OUT_OF_SEQUENCE: HRESULT = 0x80090310; +pub const SEC_E_NO_AUTHENTICATING_AUTHORITY: HRESULT = 0x80090311; +pub const SEC_I_CONTINUE_NEEDED: HRESULT = 0x00090312; +pub const SEC_I_COMPLETE_NEEDED: HRESULT = 0x00090313; +pub const SEC_I_COMPLETE_AND_CONTINUE: HRESULT = 0x00090314; +pub const SEC_I_LOCAL_LOGON: HRESULT = 0x00090315; +pub const SEC_E_BAD_PKGID: HRESULT = 0x80090316; +pub const SEC_E_CONTEXT_EXPIRED: HRESULT = 0x80090317; +pub const SEC_I_CONTEXT_EXPIRED: HRESULT = 0x00090317; +pub const SEC_E_INCOMPLETE_MESSAGE: HRESULT = 0x80090318; +pub const SEC_E_INCOMPLETE_CREDENTIALS: HRESULT = 0x80090320; +pub const SEC_E_BUFFER_TOO_SMALL: HRESULT = 0x80090321; +pub const SEC_I_INCOMPLETE_CREDENTIALS: HRESULT = 0x00090320; +pub const SEC_I_RENEGOTIATE: HRESULT = 0x00090321; +pub const SEC_E_WRONG_PRINCIPAL: HRESULT = 0x80090322; +pub const SEC_I_NO_LSA_CONTEXT: HRESULT = 0x00090323; +pub const SEC_E_TIME_SKEW: HRESULT = 0x80090324; +pub const SEC_E_UNTRUSTED_ROOT: HRESULT = 0x80090325; +pub const SEC_E_ILLEGAL_MESSAGE: HRESULT = 0x80090326; +pub const SEC_E_CERT_UNKNOWN: HRESULT = 0x80090327; +pub const SEC_E_CERT_EXPIRED: HRESULT = 0x80090328; +pub const SEC_E_ENCRYPT_FAILURE: HRESULT = 0x80090329; +pub const SEC_E_DECRYPT_FAILURE: HRESULT = 0x80090330; +pub const SEC_E_ALGORITHM_MISMATCH: HRESULT = 0x80090331; +pub const SEC_E_SECURITY_QOS_FAILED: HRESULT = 0x80090332; +pub const SEC_E_UNFINISHED_CONTEXT_DELETED: HRESULT = 0x80090333; +pub const SEC_E_NO_TGT_REPLY: HRESULT = 0x80090334; +pub const SEC_E_NO_IP_ADDRESSES: HRESULT = 0x80090335; +pub const SEC_E_WRONG_CREDENTIAL_HANDLE: HRESULT = 0x80090336; +pub const SEC_E_CRYPTO_SYSTEM_INVALID: HRESULT = 0x80090337; +pub const SEC_E_MAX_REFERRALS_EXCEEDED: HRESULT = 0x80090338; +pub const SEC_E_MUST_BE_KDC: HRESULT = 0x80090339; +pub const SEC_E_STRONG_CRYPTO_NOT_SUPPORTED: HRESULT = 0x8009033A; +pub const SEC_E_TOO_MANY_PRINCIPALS: HRESULT = 0x8009033B; +pub const SEC_E_NO_PA_DATA: HRESULT = 0x8009033C; +pub const SEC_E_PKINIT_NAME_MISMATCH: HRESULT = 0x8009033D; +pub const SEC_E_SMARTCARD_LOGON_REQUIRED: HRESULT = 0x8009033E; +pub const SEC_E_SHUTDOWN_IN_PROGRESS: HRESULT = 0x8009033F; +pub const SEC_E_KDC_INVALID_REQUEST: HRESULT = 0x80090340; +pub const SEC_E_KDC_UNABLE_TO_REFER: HRESULT = 0x80090341; +pub const SEC_E_KDC_UNKNOWN_ETYPE: HRESULT = 0x80090342; +pub const SEC_E_UNSUPPORTED_PREAUTH: HRESULT = 0x80090343; +pub const SEC_E_DELEGATION_REQUIRED: HRESULT = 0x80090345; +pub const SEC_E_BAD_BINDINGS: HRESULT = 0x80090346; +pub const SEC_E_MULTIPLE_ACCOUNTS: HRESULT = 0x80090347; +pub const SEC_E_NO_KERB_KEY: HRESULT = 0x80090348; +pub const SEC_E_CERT_WRONG_USAGE: HRESULT = 0x80090349; +pub const SEC_E_DOWNGRADE_DETECTED: HRESULT = 0x80090350; +pub const SEC_E_SMARTCARD_CERT_REVOKED: HRESULT = 0x80090351; +pub const SEC_E_ISSUING_CA_UNTRUSTED: HRESULT = 0x80090352; +pub const SEC_E_REVOCATION_OFFLINE_C: HRESULT = 0x80090353; +pub const SEC_E_PKINIT_CLIENT_FAILURE: HRESULT = 0x80090354; +pub const SEC_E_SMARTCARD_CERT_EXPIRED: HRESULT = 0x80090355; +pub const SEC_E_NO_S4U_PROT_SUPPORT: HRESULT = 0x80090356; +pub const SEC_E_CROSSREALM_DELEGATION_FAILURE: HRESULT = 0x80090357; +pub const SEC_E_REVOCATION_OFFLINE_KDC: HRESULT = 0x80090358; +pub const SEC_E_ISSUING_CA_UNTRUSTED_KDC: HRESULT = 0x80090359; +pub const SEC_E_KDC_CERT_EXPIRED: HRESULT = 0x8009035A; +pub const SEC_E_KDC_CERT_REVOKED: HRESULT = 0x8009035B; +pub const SEC_I_SIGNATURE_NEEDED: HRESULT = 0x0009035C; +pub const SEC_E_INVALID_PARAMETER: HRESULT = 0x8009035D; +pub const SEC_E_DELEGATION_POLICY: HRESULT = 0x8009035E; +pub const SEC_E_POLICY_NLTM_ONLY: HRESULT = 0x8009035F; +pub const SEC_I_NO_RENEGOTIATION: HRESULT = 0x00090360; +pub const SEC_E_NO_CONTEXT: HRESULT = 0x80090361; +pub const SEC_E_PKU2U_CERT_FAILURE: HRESULT = 0x80090362; +pub const SEC_E_MUTUAL_AUTH_FAILED: HRESULT = 0x80090363; +pub const SEC_I_MESSAGE_FRAGMENT: HRESULT = 0x00090364; +pub const SEC_E_ONLY_HTTPS_ALLOWED: HRESULT = 0x80090365; +pub const SEC_I_CONTINUE_NEEDED_MESSAGE_OK: HRESULT = 0x00090366; +pub const SEC_E_APPLICATION_PROTOCOL_MISMATCH: HRESULT = 0x80090367; +pub const SEC_E_NO_SPM: HRESULT = SEC_E_INTERNAL_ERROR; +pub const SEC_E_NOT_SUPPORTED: HRESULT = SEC_E_UNSUPPORTED_FUNCTION; +pub const CRYPT_E_MSG_ERROR: HRESULT = 0x80091001; +pub const CRYPT_E_UNKNOWN_ALGO: HRESULT = 0x80091002; +pub const CRYPT_E_OID_FORMAT: HRESULT = 0x80091003; +pub const CRYPT_E_INVALID_MSG_TYPE: HRESULT = 0x80091004; +pub const CRYPT_E_UNEXPECTED_ENCODING: HRESULT = 0x80091005; +pub const CRYPT_E_AUTH_ATTR_MISSING: HRESULT = 0x80091006; +pub const CRYPT_E_HASH_VALUE: HRESULT = 0x80091007; +pub const CRYPT_E_INVALID_INDEX: HRESULT = 0x80091008; +pub const CRYPT_E_ALREADY_DECRYPTED: HRESULT = 0x80091009; +pub const CRYPT_E_NOT_DECRYPTED: HRESULT = 0x8009100A; +pub const CRYPT_E_RECIPIENT_NOT_FOUND: HRESULT = 0x8009100B; +pub const CRYPT_E_CONTROL_TYPE: HRESULT = 0x8009100C; +pub const CRYPT_E_ISSUER_SERIALNUMBER: HRESULT = 0x8009100D; +pub const CRYPT_E_SIGNER_NOT_FOUND: HRESULT = 0x8009100E; +pub const CRYPT_E_ATTRIBUTES_MISSING: HRESULT = 0x8009100F; +pub const CRYPT_E_STREAM_MSG_NOT_READY: HRESULT = 0x80091010; +pub const CRYPT_E_STREAM_INSUFFICIENT_DATA: HRESULT = 0x80091011; +pub const CRYPT_I_NEW_PROTECTION_REQUIRED: HRESULT = 0x00091012; +pub const CRYPT_E_BAD_LEN: HRESULT = 0x80092001; +pub const CRYPT_E_BAD_ENCODE: HRESULT = 0x80092002; +pub const CRYPT_E_FILE_ERROR: HRESULT = 0x80092003; +pub const CRYPT_E_NOT_FOUND: HRESULT = 0x80092004; +pub const CRYPT_E_EXISTS: HRESULT = 0x80092005; +pub const CRYPT_E_NO_PROVIDER: HRESULT = 0x80092006; +pub const CRYPT_E_SELF_SIGNED: HRESULT = 0x80092007; +pub const CRYPT_E_DELETED_PREV: HRESULT = 0x80092008; +pub const CRYPT_E_NO_MATCH: HRESULT = 0x80092009; +pub const CRYPT_E_UNEXPECTED_MSG_TYPE: HRESULT = 0x8009200A; +pub const CRYPT_E_NO_KEY_PROPERTY: HRESULT = 0x8009200B; +pub const CRYPT_E_NO_DECRYPT_CERT: HRESULT = 0x8009200C; +pub const CRYPT_E_BAD_MSG: HRESULT = 0x8009200D; +pub const CRYPT_E_NO_SIGNER: HRESULT = 0x8009200E; +pub const CRYPT_E_PENDING_CLOSE: HRESULT = 0x8009200F; +pub const CRYPT_E_REVOKED: HRESULT = 0x80092010; +pub const CRYPT_E_NO_REVOCATION_DLL: HRESULT = 0x80092011; +pub const CRYPT_E_NO_REVOCATION_CHECK: HRESULT = 0x80092012; +pub const CRYPT_E_REVOCATION_OFFLINE: HRESULT = 0x80092013; +pub const CRYPT_E_NOT_IN_REVOCATION_DATABASE: HRESULT = 0x80092014; +pub const CRYPT_E_INVALID_NUMERIC_STRING: HRESULT = 0x80092020; +pub const CRYPT_E_INVALID_PRINTABLE_STRING: HRESULT = 0x80092021; +pub const CRYPT_E_INVALID_IA5_STRING: HRESULT = 0x80092022; +pub const CRYPT_E_INVALID_X500_STRING: HRESULT = 0x80092023; +pub const CRYPT_E_NOT_CHAR_STRING: HRESULT = 0x80092024; +pub const CRYPT_E_FILERESIZED: HRESULT = 0x80092025; +pub const CRYPT_E_SECURITY_SETTINGS: HRESULT = 0x80092026; +pub const CRYPT_E_NO_VERIFY_USAGE_DLL: HRESULT = 0x80092027; +pub const CRYPT_E_NO_VERIFY_USAGE_CHECK: HRESULT = 0x80092028; +pub const CRYPT_E_VERIFY_USAGE_OFFLINE: HRESULT = 0x80092029; +pub const CRYPT_E_NOT_IN_CTL: HRESULT = 0x8009202A; +pub const CRYPT_E_NO_TRUSTED_SIGNER: HRESULT = 0x8009202B; +pub const CRYPT_E_MISSING_PUBKEY_PARA: HRESULT = 0x8009202C; +pub const CRYPT_E_OBJECT_LOCATOR_OBJECT_NOT_FOUND: HRESULT = 0x8009202D; +pub const CRYPT_E_OSS_ERROR: HRESULT = 0x80093000; +pub const OSS_MORE_BUF: HRESULT = 0x80093001; +pub const OSS_NEGATIVE_UINTEGER: HRESULT = 0x80093002; +pub const OSS_PDU_RANGE: HRESULT = 0x80093003; +pub const OSS_MORE_INPUT: HRESULT = 0x80093004; +pub const OSS_DATA_ERROR: HRESULT = 0x80093005; +pub const OSS_BAD_ARG: HRESULT = 0x80093006; +pub const OSS_BAD_VERSION: HRESULT = 0x80093007; +pub const OSS_OUT_MEMORY: HRESULT = 0x80093008; +pub const OSS_PDU_MISMATCH: HRESULT = 0x80093009; +pub const OSS_LIMITED: HRESULT = 0x8009300A; +pub const OSS_BAD_PTR: HRESULT = 0x8009300B; +pub const OSS_BAD_TIME: HRESULT = 0x8009300C; +pub const OSS_INDEFINITE_NOT_SUPPORTED: HRESULT = 0x8009300D; +pub const OSS_MEM_ERROR: HRESULT = 0x8009300E; +pub const OSS_BAD_TABLE: HRESULT = 0x8009300F; +pub const OSS_TOO_LONG: HRESULT = 0x80093010; +pub const OSS_CONSTRAINT_VIOLATED: HRESULT = 0x80093011; +pub const OSS_FATAL_ERROR: HRESULT = 0x80093012; +pub const OSS_ACCESS_SERIALIZATION_ERROR: HRESULT = 0x80093013; +pub const OSS_NULL_TBL: HRESULT = 0x80093014; +pub const OSS_NULL_FCN: HRESULT = 0x80093015; +pub const OSS_BAD_ENCRULES: HRESULT = 0x80093016; +pub const OSS_UNAVAIL_ENCRULES: HRESULT = 0x80093017; +pub const OSS_CANT_OPEN_TRACE_WINDOW: HRESULT = 0x80093018; +pub const OSS_UNIMPLEMENTED: HRESULT = 0x80093019; +pub const OSS_OID_DLL_NOT_LINKED: HRESULT = 0x8009301A; +pub const OSS_CANT_OPEN_TRACE_FILE: HRESULT = 0x8009301B; +pub const OSS_TRACE_FILE_ALREADY_OPEN: HRESULT = 0x8009301C; +pub const OSS_TABLE_MISMATCH: HRESULT = 0x8009301D; +pub const OSS_TYPE_NOT_SUPPORTED: HRESULT = 0x8009301E; +pub const OSS_REAL_DLL_NOT_LINKED: HRESULT = 0x8009301F; +pub const OSS_REAL_CODE_NOT_LINKED: HRESULT = 0x80093020; +pub const OSS_OUT_OF_RANGE: HRESULT = 0x80093021; +pub const OSS_COPIER_DLL_NOT_LINKED: HRESULT = 0x80093022; +pub const OSS_CONSTRAINT_DLL_NOT_LINKED: HRESULT = 0x80093023; +pub const OSS_COMPARATOR_DLL_NOT_LINKED: HRESULT = 0x80093024; +pub const OSS_COMPARATOR_CODE_NOT_LINKED: HRESULT = 0x80093025; +pub const OSS_MEM_MGR_DLL_NOT_LINKED: HRESULT = 0x80093026; +pub const OSS_PDV_DLL_NOT_LINKED: HRESULT = 0x80093027; +pub const OSS_PDV_CODE_NOT_LINKED: HRESULT = 0x80093028; +pub const OSS_API_DLL_NOT_LINKED: HRESULT = 0x80093029; +pub const OSS_BERDER_DLL_NOT_LINKED: HRESULT = 0x8009302A; +pub const OSS_PER_DLL_NOT_LINKED: HRESULT = 0x8009302B; +pub const OSS_OPEN_TYPE_ERROR: HRESULT = 0x8009302C; +pub const OSS_MUTEX_NOT_CREATED: HRESULT = 0x8009302D; +pub const OSS_CANT_CLOSE_TRACE_FILE: HRESULT = 0x8009302E; +pub const CRYPT_E_ASN1_ERROR: HRESULT = 0x80093100; +pub const CRYPT_E_ASN1_INTERNAL: HRESULT = 0x80093101; +pub const CRYPT_E_ASN1_EOD: HRESULT = 0x80093102; +pub const CRYPT_E_ASN1_CORRUPT: HRESULT = 0x80093103; +pub const CRYPT_E_ASN1_LARGE: HRESULT = 0x80093104; +pub const CRYPT_E_ASN1_CONSTRAINT: HRESULT = 0x80093105; +pub const CRYPT_E_ASN1_MEMORY: HRESULT = 0x80093106; +pub const CRYPT_E_ASN1_OVERFLOW: HRESULT = 0x80093107; +pub const CRYPT_E_ASN1_BADPDU: HRESULT = 0x80093108; +pub const CRYPT_E_ASN1_BADARGS: HRESULT = 0x80093109; +pub const CRYPT_E_ASN1_BADREAL: HRESULT = 0x8009310A; +pub const CRYPT_E_ASN1_BADTAG: HRESULT = 0x8009310B; +pub const CRYPT_E_ASN1_CHOICE: HRESULT = 0x8009310C; +pub const CRYPT_E_ASN1_RULE: HRESULT = 0x8009310D; +pub const CRYPT_E_ASN1_UTF8: HRESULT = 0x8009310E; +pub const CRYPT_E_ASN1_PDU_TYPE: HRESULT = 0x80093133; +pub const CRYPT_E_ASN1_NYI: HRESULT = 0x80093134; +pub const CRYPT_E_ASN1_EXTENDED: HRESULT = 0x80093201; +pub const CRYPT_E_ASN1_NOEOD: HRESULT = 0x80093202; +pub const CERTSRV_E_BAD_REQUESTSUBJECT: HRESULT = 0x80094001; +pub const CERTSRV_E_NO_REQUEST: HRESULT = 0x80094002; +pub const CERTSRV_E_BAD_REQUESTSTATUS: HRESULT = 0x80094003; +pub const CERTSRV_E_PROPERTY_EMPTY: HRESULT = 0x80094004; +pub const CERTSRV_E_INVALID_CA_CERTIFICATE: HRESULT = 0x80094005; +pub const CERTSRV_E_SERVER_SUSPENDED: HRESULT = 0x80094006; +pub const CERTSRV_E_ENCODING_LENGTH: HRESULT = 0x80094007; +pub const CERTSRV_E_ROLECONFLICT: HRESULT = 0x80094008; +pub const CERTSRV_E_RESTRICTEDOFFICER: HRESULT = 0x80094009; +pub const CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED: HRESULT = 0x8009400A; +pub const CERTSRV_E_NO_VALID_KRA: HRESULT = 0x8009400B; +pub const CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL: HRESULT = 0x8009400C; +pub const CERTSRV_E_NO_CAADMIN_DEFINED: HRESULT = 0x8009400D; +pub const CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE: HRESULT = 0x8009400E; +pub const CERTSRV_E_NO_DB_SESSIONS: HRESULT = 0x8009400F; +pub const CERTSRV_E_ALIGNMENT_FAULT: HRESULT = 0x80094010; +pub const CERTSRV_E_ENROLL_DENIED: HRESULT = 0x80094011; +pub const CERTSRV_E_TEMPLATE_DENIED: HRESULT = 0x80094012; +pub const CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE: HRESULT = 0x80094013; +pub const CERTSRV_E_ADMIN_DENIED_REQUEST: HRESULT = 0x80094014; +pub const CERTSRV_E_NO_POLICY_SERVER: HRESULT = 0x80094015; +pub const CERTSRV_E_WEAK_SIGNATURE_OR_KEY: HRESULT = 0x80094016; +pub const CERTSRV_E_KEY_ATTESTATION_NOT_SUPPORTED: HRESULT = 0x80094017; +pub const CERTSRV_E_ENCRYPTION_CERT_REQUIRED: HRESULT = 0x80094018; +pub const CERTSRV_E_UNSUPPORTED_CERT_TYPE: HRESULT = 0x80094800; +pub const CERTSRV_E_NO_CERT_TYPE: HRESULT = 0x80094801; +pub const CERTSRV_E_TEMPLATE_CONFLICT: HRESULT = 0x80094802; +pub const CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED: HRESULT = 0x80094803; +pub const CERTSRV_E_ARCHIVED_KEY_REQUIRED: HRESULT = 0x80094804; +pub const CERTSRV_E_SMIME_REQUIRED: HRESULT = 0x80094805; +pub const CERTSRV_E_BAD_RENEWAL_SUBJECT: HRESULT = 0x80094806; +pub const CERTSRV_E_BAD_TEMPLATE_VERSION: HRESULT = 0x80094807; +pub const CERTSRV_E_TEMPLATE_POLICY_REQUIRED: HRESULT = 0x80094808; +pub const CERTSRV_E_SIGNATURE_POLICY_REQUIRED: HRESULT = 0x80094809; +pub const CERTSRV_E_SIGNATURE_COUNT: HRESULT = 0x8009480A; +pub const CERTSRV_E_SIGNATURE_REJECTED: HRESULT = 0x8009480B; +pub const CERTSRV_E_ISSUANCE_POLICY_REQUIRED: HRESULT = 0x8009480C; +pub const CERTSRV_E_SUBJECT_UPN_REQUIRED: HRESULT = 0x8009480D; +pub const CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED: HRESULT = 0x8009480E; +pub const CERTSRV_E_SUBJECT_DNS_REQUIRED: HRESULT = 0x8009480F; +pub const CERTSRV_E_ARCHIVED_KEY_UNEXPECTED: HRESULT = 0x80094810; +pub const CERTSRV_E_KEY_LENGTH: HRESULT = 0x80094811; +pub const CERTSRV_E_SUBJECT_EMAIL_REQUIRED: HRESULT = 0x80094812; +pub const CERTSRV_E_UNKNOWN_CERT_TYPE: HRESULT = 0x80094813; +pub const CERTSRV_E_CERT_TYPE_OVERLAP: HRESULT = 0x80094814; +pub const CERTSRV_E_TOO_MANY_SIGNATURES: HRESULT = 0x80094815; +pub const CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY: HRESULT = 0x80094816; +pub const CERTSRV_E_INVALID_EK: HRESULT = 0x80094817; +pub const CERTSRV_E_INVALID_IDBINDING: HRESULT = 0x80094818; +pub const CERTSRV_E_INVALID_ATTESTATION: HRESULT = 0x80094819; +pub const CERTSRV_E_KEY_ATTESTATION: HRESULT = 0x8009481A; +pub const CERTSRV_E_CORRUPT_KEY_ATTESTATION: HRESULT = 0x8009481B; +pub const CERTSRV_E_EXPIRED_CHALLENGE: HRESULT = 0x8009481C; +pub const CERTSRV_E_INVALID_RESPONSE: HRESULT = 0x8009481D; +pub const CERTSRV_E_INVALID_REQUESTID: HRESULT = 0x8009481E; +pub const XENROLL_E_KEY_NOT_EXPORTABLE: HRESULT = 0x80095000; +pub const XENROLL_E_CANNOT_ADD_ROOT_CERT: HRESULT = 0x80095001; +pub const XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND: HRESULT = 0x80095002; +pub const XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH: HRESULT = 0x80095003; +pub const XENROLL_E_RESPONSE_KA_HASH_MISMATCH: HRESULT = 0x80095004; +pub const XENROLL_E_KEYSPEC_SMIME_MISMATCH: HRESULT = 0x80095005; +pub const TRUST_E_SYSTEM_ERROR: HRESULT = 0x80096001; +pub const TRUST_E_NO_SIGNER_CERT: HRESULT = 0x80096002; +pub const TRUST_E_COUNTER_SIGNER: HRESULT = 0x80096003; +pub const TRUST_E_CERT_SIGNATURE: HRESULT = 0x80096004; +pub const TRUST_E_TIME_STAMP: HRESULT = 0x80096005; +pub const TRUST_E_BAD_DIGEST: HRESULT = 0x80096010; +pub const TRUST_E_BASIC_CONSTRAINTS: HRESULT = 0x80096019; +pub const TRUST_E_FINANCIAL_CRITERIA: HRESULT = 0x8009601E; +pub const MSSIPOTF_E_OUTOFMEMRANGE: HRESULT = 0x80097001; +pub const MSSIPOTF_E_CANTGETOBJECT: HRESULT = 0x80097002; +pub const MSSIPOTF_E_NOHEADTABLE: HRESULT = 0x80097003; +pub const MSSIPOTF_E_BAD_MAGICNUMBER: HRESULT = 0x80097004; +pub const MSSIPOTF_E_BAD_OFFSET_TABLE: HRESULT = 0x80097005; +pub const MSSIPOTF_E_TABLE_TAGORDER: HRESULT = 0x80097006; +pub const MSSIPOTF_E_TABLE_LONGWORD: HRESULT = 0x80097007; +pub const MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT: HRESULT = 0x80097008; +pub const MSSIPOTF_E_TABLES_OVERLAP: HRESULT = 0x80097009; +pub const MSSIPOTF_E_TABLE_PADBYTES: HRESULT = 0x8009700A; +pub const MSSIPOTF_E_FILETOOSMALL: HRESULT = 0x8009700B; +pub const MSSIPOTF_E_TABLE_CHECKSUM: HRESULT = 0x8009700C; +pub const MSSIPOTF_E_FILE_CHECKSUM: HRESULT = 0x8009700D; +pub const MSSIPOTF_E_FAILED_POLICY: HRESULT = 0x80097010; +pub const MSSIPOTF_E_FAILED_HINTS_CHECK: HRESULT = 0x80097011; +pub const MSSIPOTF_E_NOT_OPENTYPE: HRESULT = 0x80097012; +pub const MSSIPOTF_E_FILE: HRESULT = 0x80097013; +pub const MSSIPOTF_E_CRYPT: HRESULT = 0x80097014; +pub const MSSIPOTF_E_BADVERSION: HRESULT = 0x80097015; +pub const MSSIPOTF_E_DSIG_STRUCTURE: HRESULT = 0x80097016; +pub const MSSIPOTF_E_PCONST_CHECK: HRESULT = 0x80097017; +pub const MSSIPOTF_E_STRUCTURE: HRESULT = 0x80097018; +pub const ERROR_CRED_REQUIRES_CONFIRMATION: HRESULT = 0x80097019; +pub const NTE_OP_OK: HRESULT = 0; +pub const TRUST_E_PROVIDER_UNKNOWN: HRESULT = 0x800B0001; +pub const TRUST_E_ACTION_UNKNOWN: HRESULT = 0x800B0002; +pub const TRUST_E_SUBJECT_FORM_UNKNOWN: HRESULT = 0x800B0003; +pub const TRUST_E_SUBJECT_NOT_TRUSTED: HRESULT = 0x800B0004; +pub const DIGSIG_E_ENCODE: HRESULT = 0x800B0005; +pub const DIGSIG_E_DECODE: HRESULT = 0x800B0006; +pub const DIGSIG_E_EXTENSIBILITY: HRESULT = 0x800B0007; +pub const DIGSIG_E_CRYPTO: HRESULT = 0x800B0008; +pub const PERSIST_E_SIZEDEFINITE: HRESULT = 0x800B0009; +pub const PERSIST_E_SIZEINDEFINITE: HRESULT = 0x800B000A; +pub const PERSIST_E_NOTSELFSIZING: HRESULT = 0x800B000B; +pub const TRUST_E_NOSIGNATURE: HRESULT = 0x800B0100; +pub const CERT_E_EXPIRED: HRESULT = 0x800B0101; +pub const CERT_E_VALIDITYPERIODNESTING: HRESULT = 0x800B0102; +pub const CERT_E_ROLE: HRESULT = 0x800B0103; +pub const CERT_E_PATHLENCONST: HRESULT = 0x800B0104; +pub const CERT_E_CRITICAL: HRESULT = 0x800B0105; +pub const CERT_E_PURPOSE: HRESULT = 0x800B0106; +pub const CERT_E_ISSUERCHAINING: HRESULT = 0x800B0107; +pub const CERT_E_MALFORMED: HRESULT = 0x800B0108; +pub const CERT_E_UNTRUSTEDROOT: HRESULT = 0x800B0109; +pub const CERT_E_CHAINING: HRESULT = 0x800B010A; +pub const TRUST_E_FAIL: HRESULT = 0x800B010B; +pub const CERT_E_REVOKED: HRESULT = 0x800B010C; +pub const CERT_E_UNTRUSTEDTESTROOT: HRESULT = 0x800B010D; +pub const CERT_E_REVOCATION_FAILURE: HRESULT = 0x800B010E; +pub const CERT_E_CN_NO_MATCH: HRESULT = 0x800B010F; +pub const CERT_E_WRONG_USAGE: HRESULT = 0x800B0110; +pub const TRUST_E_EXPLICIT_DISTRUST: HRESULT = 0x800B0111; +pub const CERT_E_UNTRUSTEDCA: HRESULT = 0x800B0112; +pub const CERT_E_INVALID_POLICY: HRESULT = 0x800B0113; +pub const CERT_E_INVALID_NAME: HRESULT = 0x800B0114; +pub const SPAPI_E_EXPECTED_SECTION_NAME: HRESULT = 0x800F0000; +pub const SPAPI_E_BAD_SECTION_NAME_LINE: HRESULT = 0x800F0001; +pub const SPAPI_E_SECTION_NAME_TOO_LONG: HRESULT = 0x800F0002; +pub const SPAPI_E_GENERAL_SYNTAX: HRESULT = 0x800F0003; +pub const SPAPI_E_WRONG_INF_STYLE: HRESULT = 0x800F0100; +pub const SPAPI_E_SECTION_NOT_FOUND: HRESULT = 0x800F0101; +pub const SPAPI_E_LINE_NOT_FOUND: HRESULT = 0x800F0102; +pub const SPAPI_E_NO_BACKUP: HRESULT = 0x800F0103; +pub const SPAPI_E_NO_ASSOCIATED_CLASS: HRESULT = 0x800F0200; +pub const SPAPI_E_CLASS_MISMATCH: HRESULT = 0x800F0201; +pub const SPAPI_E_DUPLICATE_FOUND: HRESULT = 0x800F0202; +pub const SPAPI_E_NO_DRIVER_SELECTED: HRESULT = 0x800F0203; +pub const SPAPI_E_KEY_DOES_NOT_EXIST: HRESULT = 0x800F0204; +pub const SPAPI_E_INVALID_DEVINST_NAME: HRESULT = 0x800F0205; +pub const SPAPI_E_INVALID_CLASS: HRESULT = 0x800F0206; +pub const SPAPI_E_DEVINST_ALREADY_EXISTS: HRESULT = 0x800F0207; +pub const SPAPI_E_DEVINFO_NOT_REGISTERED: HRESULT = 0x800F0208; +pub const SPAPI_E_INVALID_REG_PROPERTY: HRESULT = 0x800F0209; +pub const SPAPI_E_NO_INF: HRESULT = 0x800F020A; +pub const SPAPI_E_NO_SUCH_DEVINST: HRESULT = 0x800F020B; +pub const SPAPI_E_CANT_LOAD_CLASS_ICON: HRESULT = 0x800F020C; +pub const SPAPI_E_INVALID_CLASS_INSTALLER: HRESULT = 0x800F020D; +pub const SPAPI_E_DI_DO_DEFAULT: HRESULT = 0x800F020E; +pub const SPAPI_E_DI_NOFILECOPY: HRESULT = 0x800F020F; +pub const SPAPI_E_INVALID_HWPROFILE: HRESULT = 0x800F0210; +pub const SPAPI_E_NO_DEVICE_SELECTED: HRESULT = 0x800F0211; +pub const SPAPI_E_DEVINFO_LIST_LOCKED: HRESULT = 0x800F0212; +pub const SPAPI_E_DEVINFO_DATA_LOCKED: HRESULT = 0x800F0213; +pub const SPAPI_E_DI_BAD_PATH: HRESULT = 0x800F0214; +pub const SPAPI_E_NO_CLASSINSTALL_PARAMS: HRESULT = 0x800F0215; +pub const SPAPI_E_FILEQUEUE_LOCKED: HRESULT = 0x800F0216; +pub const SPAPI_E_BAD_SERVICE_INSTALLSECT: HRESULT = 0x800F0217; +pub const SPAPI_E_NO_CLASS_DRIVER_LIST: HRESULT = 0x800F0218; +pub const SPAPI_E_NO_ASSOCIATED_SERVICE: HRESULT = 0x800F0219; +pub const SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE: HRESULT = 0x800F021A; +pub const SPAPI_E_DEVICE_INTERFACE_ACTIVE: HRESULT = 0x800F021B; +pub const SPAPI_E_DEVICE_INTERFACE_REMOVED: HRESULT = 0x800F021C; +pub const SPAPI_E_BAD_INTERFACE_INSTALLSECT: HRESULT = 0x800F021D; +pub const SPAPI_E_NO_SUCH_INTERFACE_CLASS: HRESULT = 0x800F021E; +pub const SPAPI_E_INVALID_REFERENCE_STRING: HRESULT = 0x800F021F; +pub const SPAPI_E_INVALID_MACHINENAME: HRESULT = 0x800F0220; +pub const SPAPI_E_REMOTE_COMM_FAILURE: HRESULT = 0x800F0221; +pub const SPAPI_E_MACHINE_UNAVAILABLE: HRESULT = 0x800F0222; +pub const SPAPI_E_NO_CONFIGMGR_SERVICES: HRESULT = 0x800F0223; +pub const SPAPI_E_INVALID_PROPPAGE_PROVIDER: HRESULT = 0x800F0224; +pub const SPAPI_E_NO_SUCH_DEVICE_INTERFACE: HRESULT = 0x800F0225; +pub const SPAPI_E_DI_POSTPROCESSING_REQUIRED: HRESULT = 0x800F0226; +pub const SPAPI_E_INVALID_COINSTALLER: HRESULT = 0x800F0227; +pub const SPAPI_E_NO_COMPAT_DRIVERS: HRESULT = 0x800F0228; +pub const SPAPI_E_NO_DEVICE_ICON: HRESULT = 0x800F0229; +pub const SPAPI_E_INVALID_INF_LOGCONFIG: HRESULT = 0x800F022A; +pub const SPAPI_E_DI_DONT_INSTALL: HRESULT = 0x800F022B; +pub const SPAPI_E_INVALID_FILTER_DRIVER: HRESULT = 0x800F022C; +pub const SPAPI_E_NON_WINDOWS_NT_DRIVER: HRESULT = 0x800F022D; +pub const SPAPI_E_NON_WINDOWS_DRIVER: HRESULT = 0x800F022E; +pub const SPAPI_E_NO_CATALOG_FOR_OEM_INF: HRESULT = 0x800F022F; +pub const SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE: HRESULT = 0x800F0230; +pub const SPAPI_E_NOT_DISABLEABLE: HRESULT = 0x800F0231; +pub const SPAPI_E_CANT_REMOVE_DEVINST: HRESULT = 0x800F0232; +pub const SPAPI_E_INVALID_TARGET: HRESULT = 0x800F0233; +pub const SPAPI_E_DRIVER_NONNATIVE: HRESULT = 0x800F0234; +pub const SPAPI_E_IN_WOW64: HRESULT = 0x800F0235; +pub const SPAPI_E_SET_SYSTEM_RESTORE_POINT: HRESULT = 0x800F0236; +pub const SPAPI_E_INCORRECTLY_COPIED_INF: HRESULT = 0x800F0237; +pub const SPAPI_E_SCE_DISABLED: HRESULT = 0x800F0238; +pub const SPAPI_E_UNKNOWN_EXCEPTION: HRESULT = 0x800F0239; +pub const SPAPI_E_PNP_REGISTRY_ERROR: HRESULT = 0x800F023A; +pub const SPAPI_E_REMOTE_REQUEST_UNSUPPORTED: HRESULT = 0x800F023B; +pub const SPAPI_E_NOT_AN_INSTALLED_OEM_INF: HRESULT = 0x800F023C; +pub const SPAPI_E_INF_IN_USE_BY_DEVICES: HRESULT = 0x800F023D; +pub const SPAPI_E_DI_FUNCTION_OBSOLETE: HRESULT = 0x800F023E; +pub const SPAPI_E_NO_AUTHENTICODE_CATALOG: HRESULT = 0x800F023F; +pub const SPAPI_E_AUTHENTICODE_DISALLOWED: HRESULT = 0x800F0240; +pub const SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER: HRESULT = 0x800F0241; +pub const SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED: HRESULT = 0x800F0242; +pub const SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED: HRESULT = 0x800F0243; +pub const SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH: HRESULT = 0x800F0244; +pub const SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE: HRESULT = 0x800F0245; +pub const SPAPI_E_DEVICE_INSTALLER_NOT_READY: HRESULT = 0x800F0246; +pub const SPAPI_E_DRIVER_STORE_ADD_FAILED: HRESULT = 0x800F0247; +pub const SPAPI_E_DEVICE_INSTALL_BLOCKED: HRESULT = 0x800F0248; +pub const SPAPI_E_DRIVER_INSTALL_BLOCKED: HRESULT = 0x800F0249; +pub const SPAPI_E_WRONG_INF_TYPE: HRESULT = 0x800F024A; +pub const SPAPI_E_FILE_HASH_NOT_IN_CATALOG: HRESULT = 0x800F024B; +pub const SPAPI_E_DRIVER_STORE_DELETE_FAILED: HRESULT = 0x800F024C; +pub const SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW: HRESULT = 0x800F0300; +pub const SPAPI_E_ERROR_NOT_INSTALLED: HRESULT = 0x800F1000; +pub const SCARD_S_SUCCESS: HRESULT = NO_ERROR as i32; +pub const SCARD_F_INTERNAL_ERROR: HRESULT = 0x80100001; +pub const SCARD_E_CANCELLED: HRESULT = 0x80100002; +pub const SCARD_E_INVALID_HANDLE: HRESULT = 0x80100003; +pub const SCARD_E_INVALID_PARAMETER: HRESULT = 0x80100004; +pub const SCARD_E_INVALID_TARGET: HRESULT = 0x80100005; +pub const SCARD_E_NO_MEMORY: HRESULT = 0x80100006; +pub const SCARD_F_WAITED_TOO_LONG: HRESULT = 0x80100007; +pub const SCARD_E_INSUFFICIENT_BUFFER: HRESULT = 0x80100008; +pub const SCARD_E_UNKNOWN_READER: HRESULT = 0x80100009; +pub const SCARD_E_TIMEOUT: HRESULT = 0x8010000A; +pub const SCARD_E_SHARING_VIOLATION: HRESULT = 0x8010000B; +pub const SCARD_E_NO_SMARTCARD: HRESULT = 0x8010000C; +pub const SCARD_E_UNKNOWN_CARD: HRESULT = 0x8010000D; +pub const SCARD_E_CANT_DISPOSE: HRESULT = 0x8010000E; +pub const SCARD_E_PROTO_MISMATCH: HRESULT = 0x8010000F; +pub const SCARD_E_NOT_READY: HRESULT = 0x80100010; +pub const SCARD_E_INVALID_VALUE: HRESULT = 0x80100011; +pub const SCARD_E_SYSTEM_CANCELLED: HRESULT = 0x80100012; +pub const SCARD_F_COMM_ERROR: HRESULT = 0x80100013; +pub const SCARD_F_UNKNOWN_ERROR: HRESULT = 0x80100014; +pub const SCARD_E_INVALID_ATR: HRESULT = 0x80100015; +pub const SCARD_E_NOT_TRANSACTED: HRESULT = 0x80100016; +pub const SCARD_E_READER_UNAVAILABLE: HRESULT = 0x80100017; +pub const SCARD_P_SHUTDOWN: HRESULT = 0x80100018; +pub const SCARD_E_PCI_TOO_SMALL: HRESULT = 0x80100019; +pub const SCARD_E_READER_UNSUPPORTED: HRESULT = 0x8010001A; +pub const SCARD_E_DUPLICATE_READER: HRESULT = 0x8010001B; +pub const SCARD_E_CARD_UNSUPPORTED: HRESULT = 0x8010001C; +pub const SCARD_E_NO_SERVICE: HRESULT = 0x8010001D; +pub const SCARD_E_SERVICE_STOPPED: HRESULT = 0x8010001E; +pub const SCARD_E_UNEXPECTED: HRESULT = 0x8010001F; +pub const SCARD_E_ICC_INSTALLATION: HRESULT = 0x80100020; +pub const SCARD_E_ICC_CREATEORDER: HRESULT = 0x80100021; +pub const SCARD_E_UNSUPPORTED_FEATURE: HRESULT = 0x80100022; +pub const SCARD_E_DIR_NOT_FOUND: HRESULT = 0x80100023; +pub const SCARD_E_FILE_NOT_FOUND: HRESULT = 0x80100024; +pub const SCARD_E_NO_DIR: HRESULT = 0x80100025; +pub const SCARD_E_NO_FILE: HRESULT = 0x80100026; +pub const SCARD_E_NO_ACCESS: HRESULT = 0x80100027; +pub const SCARD_E_WRITE_TOO_MANY: HRESULT = 0x80100028; +pub const SCARD_E_BAD_SEEK: HRESULT = 0x80100029; +pub const SCARD_E_INVALID_CHV: HRESULT = 0x8010002A; +pub const SCARD_E_UNKNOWN_RES_MNG: HRESULT = 0x8010002B; +pub const SCARD_E_NO_SUCH_CERTIFICATE: HRESULT = 0x8010002C; +pub const SCARD_E_CERTIFICATE_UNAVAILABLE: HRESULT = 0x8010002D; +pub const SCARD_E_NO_READERS_AVAILABLE: HRESULT = 0x8010002E; +pub const SCARD_E_COMM_DATA_LOST: HRESULT = 0x8010002F; +pub const SCARD_E_NO_KEY_CONTAINER: HRESULT = 0x80100030; +pub const SCARD_E_SERVER_TOO_BUSY: HRESULT = 0x80100031; +pub const SCARD_E_PIN_CACHE_EXPIRED: HRESULT = 0x80100032; +pub const SCARD_E_NO_PIN_CACHE: HRESULT = 0x80100033; +pub const SCARD_E_READ_ONLY_CARD: HRESULT = 0x80100034; +pub const SCARD_W_UNSUPPORTED_CARD: HRESULT = 0x80100065; +pub const SCARD_W_UNRESPONSIVE_CARD: HRESULT = 0x80100066; +pub const SCARD_W_UNPOWERED_CARD: HRESULT = 0x80100067; +pub const SCARD_W_RESET_CARD: HRESULT = 0x80100068; +pub const SCARD_W_REMOVED_CARD: HRESULT = 0x80100069; +pub const SCARD_W_SECURITY_VIOLATION: HRESULT = 0x8010006A; +pub const SCARD_W_WRONG_CHV: HRESULT = 0x8010006B; +pub const SCARD_W_CHV_BLOCKED: HRESULT = 0x8010006C; +pub const SCARD_W_EOF: HRESULT = 0x8010006D; +pub const SCARD_W_CANCELLED_BY_USER: HRESULT = 0x8010006E; +pub const SCARD_W_CARD_NOT_AUTHENTICATED: HRESULT = 0x8010006F; +pub const SCARD_W_CACHE_ITEM_NOT_FOUND: HRESULT = 0x80100070; +pub const SCARD_W_CACHE_ITEM_STALE: HRESULT = 0x80100071; +pub const SCARD_W_CACHE_ITEM_TOO_BIG: HRESULT = 0x80100072; +pub const COMADMIN_E_OBJECTERRORS: HRESULT = 0x80110401; +pub const COMADMIN_E_OBJECTINVALID: HRESULT = 0x80110402; +pub const COMADMIN_E_KEYMISSING: HRESULT = 0x80110403; +pub const COMADMIN_E_ALREADYINSTALLED: HRESULT = 0x80110404; +pub const COMADMIN_E_APP_FILE_WRITEFAIL: HRESULT = 0x80110407; +pub const COMADMIN_E_APP_FILE_READFAIL: HRESULT = 0x80110408; +pub const COMADMIN_E_APP_FILE_VERSION: HRESULT = 0x80110409; +pub const COMADMIN_E_BADPATH: HRESULT = 0x8011040A; +pub const COMADMIN_E_APPLICATIONEXISTS: HRESULT = 0x8011040B; +pub const COMADMIN_E_ROLEEXISTS: HRESULT = 0x8011040C; +pub const COMADMIN_E_CANTCOPYFILE: HRESULT = 0x8011040D; +pub const COMADMIN_E_NOUSER: HRESULT = 0x8011040F; +pub const COMADMIN_E_INVALIDUSERIDS: HRESULT = 0x80110410; +pub const COMADMIN_E_NOREGISTRYCLSID: HRESULT = 0x80110411; +pub const COMADMIN_E_BADREGISTRYPROGID: HRESULT = 0x80110412; +pub const COMADMIN_E_AUTHENTICATIONLEVEL: HRESULT = 0x80110413; +pub const COMADMIN_E_USERPASSWDNOTVALID: HRESULT = 0x80110414; +pub const COMADMIN_E_CLSIDORIIDMISMATCH: HRESULT = 0x80110418; +pub const COMADMIN_E_REMOTEINTERFACE: HRESULT = 0x80110419; +pub const COMADMIN_E_DLLREGISTERSERVER: HRESULT = 0x8011041A; +pub const COMADMIN_E_NOSERVERSHARE: HRESULT = 0x8011041B; +pub const COMADMIN_E_DLLLOADFAILED: HRESULT = 0x8011041D; +pub const COMADMIN_E_BADREGISTRYLIBID: HRESULT = 0x8011041E; +pub const COMADMIN_E_APPDIRNOTFOUND: HRESULT = 0x8011041F; +pub const COMADMIN_E_REGISTRARFAILED: HRESULT = 0x80110423; +pub const COMADMIN_E_COMPFILE_DOESNOTEXIST: HRESULT = 0x80110424; +pub const COMADMIN_E_COMPFILE_LOADDLLFAIL: HRESULT = 0x80110425; +pub const COMADMIN_E_COMPFILE_GETCLASSOBJ: HRESULT = 0x80110426; +pub const COMADMIN_E_COMPFILE_CLASSNOTAVAIL: HRESULT = 0x80110427; +pub const COMADMIN_E_COMPFILE_BADTLB: HRESULT = 0x80110428; +pub const COMADMIN_E_COMPFILE_NOTINSTALLABLE: HRESULT = 0x80110429; +pub const COMADMIN_E_NOTCHANGEABLE: HRESULT = 0x8011042A; +pub const COMADMIN_E_NOTDELETEABLE: HRESULT = 0x8011042B; +pub const COMADMIN_E_SESSION: HRESULT = 0x8011042C; +pub const COMADMIN_E_COMP_MOVE_LOCKED: HRESULT = 0x8011042D; +pub const COMADMIN_E_COMP_MOVE_BAD_DEST: HRESULT = 0x8011042E; +pub const COMADMIN_E_REGISTERTLB: HRESULT = 0x80110430; +pub const COMADMIN_E_SYSTEMAPP: HRESULT = 0x80110433; +pub const COMADMIN_E_COMPFILE_NOREGISTRAR: HRESULT = 0x80110434; +pub const COMADMIN_E_COREQCOMPINSTALLED: HRESULT = 0x80110435; +pub const COMADMIN_E_SERVICENOTINSTALLED: HRESULT = 0x80110436; +pub const COMADMIN_E_PROPERTYSAVEFAILED: HRESULT = 0x80110437; +pub const COMADMIN_E_OBJECTEXISTS: HRESULT = 0x80110438; +pub const COMADMIN_E_COMPONENTEXISTS: HRESULT = 0x80110439; +pub const COMADMIN_E_REGFILE_CORRUPT: HRESULT = 0x8011043B; +pub const COMADMIN_E_PROPERTY_OVERFLOW: HRESULT = 0x8011043C; +pub const COMADMIN_E_NOTINREGISTRY: HRESULT = 0x8011043E; +pub const COMADMIN_E_OBJECTNOTPOOLABLE: HRESULT = 0x8011043F; +pub const COMADMIN_E_APPLID_MATCHES_CLSID: HRESULT = 0x80110446; +pub const COMADMIN_E_ROLE_DOES_NOT_EXIST: HRESULT = 0x80110447; +pub const COMADMIN_E_START_APP_NEEDS_COMPONENTS: HRESULT = 0x80110448; +pub const COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM: HRESULT = 0x80110449; +pub const COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY: HRESULT = 0x8011044A; +pub const COMADMIN_E_CAN_NOT_START_APP: HRESULT = 0x8011044B; +pub const COMADMIN_E_CAN_NOT_EXPORT_SYS_APP: HRESULT = 0x8011044C; +pub const COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT: HRESULT = 0x8011044D; +pub const COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER: HRESULT = 0x8011044E; +pub const COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE: HRESULT = 0x8011044F; +pub const COMADMIN_E_BASE_PARTITION_ONLY: HRESULT = 0x80110450; +pub const COMADMIN_E_START_APP_DISABLED: HRESULT = 0x80110451; +pub const COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME: HRESULT = 0x80110457; +pub const COMADMIN_E_CAT_INVALID_PARTITION_NAME: HRESULT = 0x80110458; +pub const COMADMIN_E_CAT_PARTITION_IN_USE: HRESULT = 0x80110459; +pub const COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES: HRESULT = 0x8011045A; +pub const COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED: HRESULT = 0x8011045B; +pub const COMADMIN_E_AMBIGUOUS_APPLICATION_NAME: HRESULT = 0x8011045C; +pub const COMADMIN_E_AMBIGUOUS_PARTITION_NAME: HRESULT = 0x8011045D; +pub const COMADMIN_E_REGDB_NOTINITIALIZED: HRESULT = 0x80110472; +pub const COMADMIN_E_REGDB_NOTOPEN: HRESULT = 0x80110473; +pub const COMADMIN_E_REGDB_SYSTEMERR: HRESULT = 0x80110474; +pub const COMADMIN_E_REGDB_ALREADYRUNNING: HRESULT = 0x80110475; +pub const COMADMIN_E_MIG_VERSIONNOTSUPPORTED: HRESULT = 0x80110480; +pub const COMADMIN_E_MIG_SCHEMANOTFOUND: HRESULT = 0x80110481; +pub const COMADMIN_E_CAT_BITNESSMISMATCH: HRESULT = 0x80110482; +pub const COMADMIN_E_CAT_UNACCEPTABLEBITNESS: HRESULT = 0x80110483; +pub const COMADMIN_E_CAT_WRONGAPPBITNESS: HRESULT = 0x80110484; +pub const COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED: HRESULT = 0x80110485; +pub const COMADMIN_E_CAT_SERVERFAULT: HRESULT = 0x80110486; +pub const COMQC_E_APPLICATION_NOT_QUEUED: HRESULT = 0x80110600; +pub const COMQC_E_NO_QUEUEABLE_INTERFACES: HRESULT = 0x80110601; +pub const COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE: HRESULT = 0x80110602; +pub const COMQC_E_NO_IPERSISTSTREAM: HRESULT = 0x80110603; +pub const COMQC_E_BAD_MESSAGE: HRESULT = 0x80110604; +pub const COMQC_E_UNAUTHENTICATED: HRESULT = 0x80110605; +pub const COMQC_E_UNTRUSTED_ENQUEUER: HRESULT = 0x80110606; +pub const MSDTC_E_DUPLICATE_RESOURCE: HRESULT = 0x80110701; +pub const COMADMIN_E_OBJECT_PARENT_MISSING: HRESULT = 0x80110808; +pub const COMADMIN_E_OBJECT_DOES_NOT_EXIST: HRESULT = 0x80110809; +pub const COMADMIN_E_APP_NOT_RUNNING: HRESULT = 0x8011080A; +pub const COMADMIN_E_INVALID_PARTITION: HRESULT = 0x8011080B; +pub const COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE: HRESULT = 0x8011080D; +pub const COMADMIN_E_USER_IN_SET: HRESULT = 0x8011080E; +pub const COMADMIN_E_CANTRECYCLELIBRARYAPPS: HRESULT = 0x8011080F; +pub const COMADMIN_E_CANTRECYCLESERVICEAPPS: HRESULT = 0x80110811; +pub const COMADMIN_E_PROCESSALREADYRECYCLED: HRESULT = 0x80110812; +pub const COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED: HRESULT = 0x80110813; +pub const COMADMIN_E_CANTMAKEINPROCSERVICE: HRESULT = 0x80110814; +pub const COMADMIN_E_PROGIDINUSEBYCLSID: HRESULT = 0x80110815; +pub const COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET: HRESULT = 0x80110816; +pub const COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED: HRESULT = 0x80110817; +pub const COMADMIN_E_PARTITION_ACCESSDENIED: HRESULT = 0x80110818; +pub const COMADMIN_E_PARTITION_MSI_ONLY: HRESULT = 0x80110819; +pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT: HRESULT = 0x8011081A; +pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS: HRESULT + = 0x8011081B; +pub const COMADMIN_E_COMP_MOVE_SOURCE: HRESULT = 0x8011081C; +pub const COMADMIN_E_COMP_MOVE_DEST: HRESULT = 0x8011081D; +pub const COMADMIN_E_COMP_MOVE_PRIVATE: HRESULT = 0x8011081E; +pub const COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET: HRESULT = 0x8011081F; +pub const COMADMIN_E_CANNOT_ALIAS_EVENTCLASS: HRESULT = 0x80110820; +pub const COMADMIN_E_PRIVATE_ACCESSDENIED: HRESULT = 0x80110821; +pub const COMADMIN_E_SAFERINVALID: HRESULT = 0x80110822; +pub const COMADMIN_E_REGISTRY_ACCESSDENIED: HRESULT = 0x80110823; +pub const COMADMIN_E_PARTITIONS_DISABLED: HRESULT = 0x80110824; +pub const WER_S_REPORT_DEBUG: HRESULT = 0x001B0000; +pub const WER_S_REPORT_UPLOADED: HRESULT = 0x001B0001; +pub const WER_S_REPORT_QUEUED: HRESULT = 0x001B0002; +pub const WER_S_DISABLED: HRESULT = 0x001B0003; +pub const WER_S_SUSPENDED_UPLOAD: HRESULT = 0x001B0004; +pub const WER_S_DISABLED_QUEUE: HRESULT = 0x001B0005; +pub const WER_S_DISABLED_ARCHIVE: HRESULT = 0x001B0006; +pub const WER_S_REPORT_ASYNC: HRESULT = 0x001B0007; +pub const WER_S_IGNORE_ASSERT_INSTANCE: HRESULT = 0x001B0008; +pub const WER_S_IGNORE_ALL_ASSERTS: HRESULT = 0x001B0009; +pub const WER_S_ASSERT_CONTINUE: HRESULT = 0x001B000A; +pub const WER_S_THROTTLED: HRESULT = 0x001B000B; +pub const WER_E_CRASH_FAILURE: HRESULT = 0x801B8000; +pub const WER_E_CANCELED: HRESULT = 0x801B8001; +pub const WER_E_NETWORK_FAILURE: HRESULT = 0x801B8002; +pub const WER_E_NOT_INITIALIZED: HRESULT = 0x801B8003; +pub const WER_E_ALREADY_REPORTING: HRESULT = 0x801B8004; +pub const WER_E_DUMP_THROTTLED: HRESULT = 0x801B8005; +pub const ERROR_FLT_IO_COMPLETE: HRESULT = 0x001F0001; +pub const ERROR_FLT_NO_HANDLER_DEFINED: HRESULT = 0x801F0001; +pub const ERROR_FLT_CONTEXT_ALREADY_DEFINED: HRESULT = 0x801F0002; +pub const ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST: HRESULT = 0x801F0003; +pub const ERROR_FLT_DISALLOW_FAST_IO: HRESULT = 0x801F0004; +pub const ERROR_FLT_INVALID_NAME_REQUEST: HRESULT = 0x801F0005; +pub const ERROR_FLT_NOT_SAFE_TO_POST_OPERATION: HRESULT = 0x801F0006; +pub const ERROR_FLT_NOT_INITIALIZED: HRESULT = 0x801F0007; +pub const ERROR_FLT_FILTER_NOT_READY: HRESULT = 0x801F0008; +pub const ERROR_FLT_POST_OPERATION_CLEANUP: HRESULT = 0x801F0009; +pub const ERROR_FLT_INTERNAL_ERROR: HRESULT = 0x801F000A; +pub const ERROR_FLT_DELETING_OBJECT: HRESULT = 0x801F000B; +pub const ERROR_FLT_MUST_BE_NONPAGED_POOL: HRESULT = 0x801F000C; +pub const ERROR_FLT_DUPLICATE_ENTRY: HRESULT = 0x801F000D; +pub const ERROR_FLT_CBDQ_DISABLED: HRESULT = 0x801F000E; +pub const ERROR_FLT_DO_NOT_ATTACH: HRESULT = 0x801F000F; +pub const ERROR_FLT_DO_NOT_DETACH: HRESULT = 0x801F0010; +pub const ERROR_FLT_INSTANCE_ALTITUDE_COLLISION: HRESULT = 0x801F0011; +pub const ERROR_FLT_INSTANCE_NAME_COLLISION: HRESULT = 0x801F0012; +pub const ERROR_FLT_FILTER_NOT_FOUND: HRESULT = 0x801F0013; +pub const ERROR_FLT_VOLUME_NOT_FOUND: HRESULT = 0x801F0014; +pub const ERROR_FLT_INSTANCE_NOT_FOUND: HRESULT = 0x801F0015; +pub const ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND: HRESULT = 0x801F0016; +pub const ERROR_FLT_INVALID_CONTEXT_REGISTRATION: HRESULT = 0x801F0017; +pub const ERROR_FLT_NAME_CACHE_MISS: HRESULT = 0x801F0018; +pub const ERROR_FLT_NO_DEVICE_OBJECT: HRESULT = 0x801F0019; +pub const ERROR_FLT_VOLUME_ALREADY_MOUNTED: HRESULT = 0x801F001A; +pub const ERROR_FLT_ALREADY_ENLISTED: HRESULT = 0x801F001B; +pub const ERROR_FLT_CONTEXT_ALREADY_LINKED: HRESULT = 0x801F001C; +pub const ERROR_FLT_NO_WAITER_FOR_REPLY: HRESULT = 0x801F0020; +pub const ERROR_FLT_REGISTRATION_BUSY: HRESULT = 0x801F0023; +pub const ERROR_HUNG_DISPLAY_DRIVER_THREAD: HRESULT = 0x80260001; +pub const DWM_E_COMPOSITIONDISABLED: HRESULT = 0x80263001; +pub const DWM_E_REMOTING_NOT_SUPPORTED: HRESULT = 0x80263002; +pub const DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE: HRESULT = 0x80263003; +pub const DWM_E_NOT_QUEUING_PRESENTS: HRESULT = 0x80263004; +pub const DWM_E_ADAPTER_NOT_FOUND: HRESULT = 0x80263005; +pub const DWM_S_GDI_REDIRECTION_SURFACE: HRESULT = 0x00263005; +pub const DWM_E_TEXTURE_TOO_LARGE: HRESULT = 0x80263007; +pub const ERROR_MONITOR_NO_DESCRIPTOR: HRESULT = 0x80261001; +pub const ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: HRESULT = 0x80261002; +pub const ERROR_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: HRESULT = 0xC0261003; +pub const ERROR_MONITOR_INVALID_STANDARD_TIMING_BLOCK: HRESULT = 0xC0261004; +pub const ERROR_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: HRESULT = 0xC0261005; +pub const ERROR_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: HRESULT = 0xC0261006; +pub const ERROR_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: HRESULT = 0xC0261007; +pub const ERROR_MONITOR_NO_MORE_DESCRIPTOR_DATA: HRESULT = 0xC0261008; +pub const ERROR_MONITOR_INVALID_DETAILED_TIMING_BLOCK: HRESULT = 0xC0261009; +pub const ERROR_MONITOR_INVALID_MANUFACTURE_DATE: HRESULT = 0xC026100A; +pub const ERROR_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: HRESULT = 0xC0262000; +pub const ERROR_GRAPHICS_INSUFFICIENT_DMA_BUFFER: HRESULT = 0xC0262001; +pub const ERROR_GRAPHICS_INVALID_DISPLAY_ADAPTER: HRESULT = 0xC0262002; +pub const ERROR_GRAPHICS_ADAPTER_WAS_RESET: HRESULT = 0xC0262003; +pub const ERROR_GRAPHICS_INVALID_DRIVER_MODEL: HRESULT = 0xC0262004; +pub const ERROR_GRAPHICS_PRESENT_MODE_CHANGED: HRESULT = 0xC0262005; +pub const ERROR_GRAPHICS_PRESENT_OCCLUDED: HRESULT = 0xC0262006; +pub const ERROR_GRAPHICS_PRESENT_DENIED: HRESULT = 0xC0262007; +pub const ERROR_GRAPHICS_CANNOTCOLORCONVERT: HRESULT = 0xC0262008; +pub const ERROR_GRAPHICS_DRIVER_MISMATCH: HRESULT = 0xC0262009; +pub const ERROR_GRAPHICS_PARTIAL_DATA_POPULATED: HRESULT = 0x4026200A; +pub const ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED: HRESULT = 0xC026200B; +pub const ERROR_GRAPHICS_PRESENT_UNOCCLUDED: HRESULT = 0xC026200C; +pub const ERROR_GRAPHICS_WINDOWDC_NOT_AVAILABLE: HRESULT = 0xC026200D; +pub const ERROR_GRAPHICS_WINDOWLESS_PRESENT_DISABLED: HRESULT = 0xC026200E; +pub const ERROR_GRAPHICS_NO_VIDEO_MEMORY: HRESULT = 0xC0262100; +pub const ERROR_GRAPHICS_CANT_LOCK_MEMORY: HRESULT = 0xC0262101; +pub const ERROR_GRAPHICS_ALLOCATION_BUSY: HRESULT = 0xC0262102; +pub const ERROR_GRAPHICS_TOO_MANY_REFERENCES: HRESULT = 0xC0262103; +pub const ERROR_GRAPHICS_TRY_AGAIN_LATER: HRESULT = 0xC0262104; +pub const ERROR_GRAPHICS_TRY_AGAIN_NOW: HRESULT = 0xC0262105; +pub const ERROR_GRAPHICS_ALLOCATION_INVALID: HRESULT = 0xC0262106; +pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: HRESULT = 0xC0262107; +pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: HRESULT = 0xC0262108; +pub const ERROR_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: HRESULT = 0xC0262109; +pub const ERROR_GRAPHICS_INVALID_ALLOCATION_USAGE: HRESULT = 0xC0262110; +pub const ERROR_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: HRESULT = 0xC0262111; +pub const ERROR_GRAPHICS_ALLOCATION_CLOSED: HRESULT = 0xC0262112; +pub const ERROR_GRAPHICS_INVALID_ALLOCATION_INSTANCE: HRESULT = 0xC0262113; +pub const ERROR_GRAPHICS_INVALID_ALLOCATION_HANDLE: HRESULT = 0xC0262114; +pub const ERROR_GRAPHICS_WRONG_ALLOCATION_DEVICE: HRESULT = 0xC0262115; +pub const ERROR_GRAPHICS_ALLOCATION_CONTENT_LOST: HRESULT = 0xC0262116; +pub const ERROR_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: HRESULT = 0xC0262200; +pub const ERROR_GRAPHICS_SKIP_ALLOCATION_PREPARATION: HRESULT = 0x40262201; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY: HRESULT = 0xC0262300; +pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: HRESULT = 0xC0262301; +pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: HRESULT + = 0xC0262302; +pub const ERROR_GRAPHICS_INVALID_VIDPN: HRESULT = 0xC0262303; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: HRESULT = 0xC0262304; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: HRESULT = 0xC0262305; +pub const ERROR_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: HRESULT = 0xC0262306; +pub const ERROR_GRAPHICS_MODE_NOT_PINNED: HRESULT = 0x00262307; +pub const ERROR_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: HRESULT = 0xC0262308; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGETMODESET: HRESULT = 0xC0262309; +pub const ERROR_GRAPHICS_INVALID_FREQUENCY: HRESULT = 0xC026230A; +pub const ERROR_GRAPHICS_INVALID_ACTIVE_REGION: HRESULT = 0xC026230B; +pub const ERROR_GRAPHICS_INVALID_TOTAL_REGION: HRESULT = 0xC026230C; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: HRESULT = 0xC0262310; +pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: HRESULT = 0xC0262311; +pub const ERROR_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: HRESULT = 0xC0262312; +pub const ERROR_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: HRESULT = 0xC0262313; +pub const ERROR_GRAPHICS_MODE_ALREADY_IN_MODESET: HRESULT = 0xC0262314; +pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: HRESULT = 0xC0262315; +pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: HRESULT = 0xC0262316; +pub const ERROR_GRAPHICS_SOURCE_ALREADY_IN_SET: HRESULT = 0xC0262317; +pub const ERROR_GRAPHICS_TARGET_ALREADY_IN_SET: HRESULT = 0xC0262318; +pub const ERROR_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: HRESULT = 0xC0262319; +pub const ERROR_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: HRESULT = 0xC026231A; +pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: HRESULT = 0xC026231B; +pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: HRESULT = 0xC026231C; +pub const ERROR_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: HRESULT = 0xC026231D; +pub const ERROR_GRAPHICS_NO_PREFERRED_MODE: HRESULT = 0x0026231E; +pub const ERROR_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: HRESULT = 0xC026231F; +pub const ERROR_GRAPHICS_STALE_MODESET: HRESULT = 0xC0262320; +pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: HRESULT = 0xC0262321; +pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: HRESULT = 0xC0262322; +pub const ERROR_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: HRESULT = 0xC0262323; +pub const ERROR_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262324; +pub const ERROR_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: HRESULT + = 0xC0262325; +pub const ERROR_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: HRESULT + = 0xC0262326; +pub const ERROR_GRAPHICS_PATH_NOT_IN_TOPOLOGY: HRESULT = 0xC0262327; +pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: HRESULT = 0xC0262328; +pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: HRESULT = 0xC0262329; +pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTORSET: HRESULT = 0xC026232A; +pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTOR: HRESULT = 0xC026232B; +pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: HRESULT = 0xC026232C; +pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: HRESULT = 0xC026232D; +pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: HRESULT = 0xC026232E; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: HRESULT = 0xC026232F; +pub const ERROR_GRAPHICS_RESOURCES_NOT_RELATED: HRESULT = 0xC0262330; +pub const ERROR_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262331; +pub const ERROR_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262332; +pub const ERROR_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: HRESULT = 0xC0262333; +pub const ERROR_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: HRESULT + = 0xC0262334; +pub const ERROR_GRAPHICS_NO_VIDPNMGR: HRESULT = 0xC0262335; +pub const ERROR_GRAPHICS_NO_ACTIVE_VIDPN: HRESULT = 0xC0262336; +pub const ERROR_GRAPHICS_STALE_VIDPN_TOPOLOGY: HRESULT = 0xC0262337; +pub const ERROR_GRAPHICS_MONITOR_NOT_CONNECTED: HRESULT = 0xC0262338; +pub const ERROR_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: HRESULT = 0xC0262339; +pub const ERROR_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: HRESULT = 0xC026233A; +pub const ERROR_GRAPHICS_INVALID_VISIBLEREGION_SIZE: HRESULT = 0xC026233B; +pub const ERROR_GRAPHICS_INVALID_STRIDE: HRESULT = 0xC026233C; +pub const ERROR_GRAPHICS_INVALID_PIXELFORMAT: HRESULT = 0xC026233D; +pub const ERROR_GRAPHICS_INVALID_COLORBASIS: HRESULT = 0xC026233E; +pub const ERROR_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: HRESULT = 0xC026233F; +pub const ERROR_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: HRESULT = 0xC0262340; +pub const ERROR_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: HRESULT = 0xC0262341; +pub const ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0xC0262342; +pub const ERROR_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: HRESULT = 0xC0262343; +pub const ERROR_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: HRESULT = 0xC0262344; +pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: HRESULT + = 0xC0262345; +pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: HRESULT + = 0xC0262346; +pub const ERROR_GRAPHICS_INVALID_GAMMA_RAMP: HRESULT = 0xC0262347; +pub const ERROR_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: HRESULT = 0xC0262348; +pub const ERROR_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: HRESULT = 0xC0262349; +pub const ERROR_GRAPHICS_MODE_NOT_IN_MODESET: HRESULT = 0xC026234A; +pub const ERROR_GRAPHICS_DATASET_IS_EMPTY: HRESULT = 0x0026234B; +pub const ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: HRESULT = 0x0026234C; +pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: HRESULT + = 0xC026234D; +pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_TYPE: HRESULT = 0xC026234E; +pub const ERROR_GRAPHICS_INVALID_COPYPROTECTION_TYPE: HRESULT = 0xC026234F; +pub const ERROR_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: HRESULT = 0xC0262350; +pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: HRESULT = 0x00262351; +pub const ERROR_GRAPHICS_INVALID_SCANLINE_ORDERING: HRESULT = 0xC0262352; +pub const ERROR_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: HRESULT = 0xC0262353; +pub const ERROR_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: HRESULT = 0xC0262354; +pub const ERROR_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: HRESULT = 0xC0262355; +pub const ERROR_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: HRESULT = 0xC0262356; +pub const ERROR_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: HRESULT = 0xC0262357; +pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: HRESULT + = 0xC0262358; +pub const ERROR_GRAPHICS_MAX_NUM_PATHS_REACHED: HRESULT = 0xC0262359; +pub const ERROR_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: HRESULT = 0xC026235A; +pub const ERROR_GRAPHICS_INVALID_CLIENT_TYPE: HRESULT = 0xC026235B; +pub const ERROR_GRAPHICS_CLIENTVIDPN_NOT_SET: HRESULT = 0xC026235C; +pub const ERROR_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: HRESULT = 0xC0262400; +pub const ERROR_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: HRESULT = 0xC0262401; +pub const ERROR_GRAPHICS_UNKNOWN_CHILD_STATUS: HRESULT = 0x4026242F; +pub const ERROR_GRAPHICS_NOT_A_LINKED_ADAPTER: HRESULT = 0xC0262430; +pub const ERROR_GRAPHICS_LEADLINK_NOT_ENUMERATED: HRESULT = 0xC0262431; +pub const ERROR_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: HRESULT = 0xC0262432; +pub const ERROR_GRAPHICS_ADAPTER_CHAIN_NOT_READY: HRESULT = 0xC0262433; +pub const ERROR_GRAPHICS_CHAINLINKS_NOT_STARTED: HRESULT = 0xC0262434; +pub const ERROR_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: HRESULT = 0xC0262435; +pub const ERROR_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: HRESULT = 0xC0262436; +pub const ERROR_GRAPHICS_LEADLINK_START_DEFERRED: HRESULT = 0x40262437; +pub const ERROR_GRAPHICS_NOT_POST_DEVICE_DRIVER: HRESULT = 0xC0262438; +pub const ERROR_GRAPHICS_POLLING_TOO_FREQUENTLY: HRESULT = 0x40262439; +pub const ERROR_GRAPHICS_START_DEFERRED: HRESULT = 0x4026243A; +pub const ERROR_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: HRESULT = 0xC026243B; +pub const ERROR_GRAPHICS_OPM_NOT_SUPPORTED: HRESULT = 0xC0262500; +pub const ERROR_GRAPHICS_COPP_NOT_SUPPORTED: HRESULT = 0xC0262501; +pub const ERROR_GRAPHICS_UAB_NOT_SUPPORTED: HRESULT = 0xC0262502; +pub const ERROR_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: HRESULT = 0xC0262503; +pub const ERROR_GRAPHICS_OPM_NO_VIDEO_OUTPUTS_EXIST: HRESULT = 0xC0262505; +pub const ERROR_GRAPHICS_OPM_INTERNAL_ERROR: HRESULT = 0xC026250B; +pub const ERROR_GRAPHICS_OPM_INVALID_HANDLE: HRESULT = 0xC026250C; +pub const ERROR_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: HRESULT = 0xC026250E; +pub const ERROR_GRAPHICS_OPM_SPANNING_MODE_ENABLED: HRESULT = 0xC026250F; +pub const ERROR_GRAPHICS_OPM_THEATER_MODE_ENABLED: HRESULT = 0xC0262510; +pub const ERROR_GRAPHICS_PVP_HFS_FAILED: HRESULT = 0xC0262511; +pub const ERROR_GRAPHICS_OPM_INVALID_SRM: HRESULT = 0xC0262512; +pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: HRESULT = 0xC0262513; +pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: HRESULT = 0xC0262514; +pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: HRESULT = 0xC0262515; +pub const ERROR_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: HRESULT = 0xC0262516; +pub const ERROR_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: HRESULT = 0xC0262517; +pub const ERROR_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: HRESULT = 0xC0262518; +pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_NO_LONGER_EXISTS: HRESULT = 0xC026251A; +pub const ERROR_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS: HRESULT = 0xC026251B; +pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: HRESULT + = 0xC026251C; +pub const ERROR_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: HRESULT = 0xC026251D; +pub const ERROR_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: HRESULT = 0xC026251E; +pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: HRESULT + = 0xC026251F; +pub const ERROR_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: HRESULT = 0xC0262520; +pub const ERROR_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: HRESULT = 0xC0262521; +pub const ERROR_GRAPHICS_I2C_NOT_SUPPORTED: HRESULT = 0xC0262580; +pub const ERROR_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: HRESULT = 0xC0262581; +pub const ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: HRESULT = 0xC0262582; +pub const ERROR_GRAPHICS_I2C_ERROR_RECEIVING_DATA: HRESULT = 0xC0262583; +pub const ERROR_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: HRESULT = 0xC0262584; +pub const ERROR_GRAPHICS_DDCCI_INVALID_DATA: HRESULT = 0xC0262585; +pub const ERROR_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: HRESULT + = 0xC0262586; +pub const ERROR_GRAPHICS_MCA_INVALID_CAPABILITIES_STRING: HRESULT = 0xC0262587; +pub const ERROR_GRAPHICS_MCA_INTERNAL_ERROR: HRESULT = 0xC0262588; +pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: HRESULT = 0xC0262589; +pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: HRESULT = 0xC026258A; +pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: HRESULT = 0xC026258B; +pub const ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: HRESULT = 0xC026258C; +pub const ERROR_GRAPHICS_MONITOR_NO_LONGER_EXISTS: HRESULT = 0xC026258D; +pub const ERROR_GRAPHICS_DDCCI_CURRENT_CURRENT_VALUE_GREATER_THAN_MAXIMUM_VALUE: HRESULT + = 0xC02625D8; +pub const ERROR_GRAPHICS_MCA_INVALID_VCP_VERSION: HRESULT = 0xC02625D9; +pub const ERROR_GRAPHICS_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION: HRESULT + = 0xC02625DA; +pub const ERROR_GRAPHICS_MCA_MCCS_VERSION_MISMATCH: HRESULT = 0xC02625DB; +pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_MCCS_VERSION: HRESULT = 0xC02625DC; +pub const ERROR_GRAPHICS_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED: HRESULT = 0xC02625DE; +pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_COLOR_TEMPERATURE: HRESULT = 0xC02625DF; +pub const ERROR_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: HRESULT = 0xC02625E0; +pub const ERROR_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: HRESULT = 0xC02625E1; +pub const ERROR_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: HRESULT + = 0xC02625E2; +pub const ERROR_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: HRESULT = 0xC02625E3; +pub const ERROR_GRAPHICS_INVALID_POINTER: HRESULT = 0xC02625E4; +pub const ERROR_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: HRESULT + = 0xC02625E5; +pub const ERROR_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: HRESULT = 0xC02625E6; +pub const ERROR_GRAPHICS_INTERNAL_ERROR: HRESULT = 0xC02625E7; +pub const ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: HRESULT = 0xC02605E8; +pub const NAP_E_INVALID_PACKET: HRESULT = 0x80270001; +pub const NAP_E_MISSING_SOH: HRESULT = 0x80270002; +pub const NAP_E_CONFLICTING_ID: HRESULT = 0x80270003; +pub const NAP_E_NO_CACHED_SOH: HRESULT = 0x80270004; +pub const NAP_E_STILL_BOUND: HRESULT = 0x80270005; +pub const NAP_E_NOT_REGISTERED: HRESULT = 0x80270006; +pub const NAP_E_NOT_INITIALIZED: HRESULT = 0x80270007; +pub const NAP_E_MISMATCHED_ID: HRESULT = 0x80270008; +pub const NAP_E_NOT_PENDING: HRESULT = 0x80270009; +pub const NAP_E_ID_NOT_FOUND: HRESULT = 0x8027000A; +pub const NAP_E_MAXSIZE_TOO_SMALL: HRESULT = 0x8027000B; +pub const NAP_E_SERVICE_NOT_RUNNING: HRESULT = 0x8027000C; +pub const NAP_S_CERT_ALREADY_PRESENT: HRESULT = 0x0027000D; +pub const NAP_E_ENTITY_DISABLED: HRESULT = 0x8027000E; +pub const NAP_E_NETSH_GROUPPOLICY_ERROR: HRESULT = 0x8027000F; +pub const NAP_E_TOO_MANY_CALLS: HRESULT = 0x80270010; +pub const NAP_E_SHV_CONFIG_EXISTED: HRESULT = 0x80270011; +pub const NAP_E_SHV_CONFIG_NOT_FOUND: HRESULT = 0x80270012; +pub const NAP_E_SHV_TIMEOUT: HRESULT = 0x80270013; +pub const TPM_E_ERROR_MASK: HRESULT = 0x80280000; +pub const TPM_E_AUTHFAIL: HRESULT = 0x80280001; +pub const TPM_E_BADINDEX: HRESULT = 0x80280002; +pub const TPM_E_BAD_PARAMETER: HRESULT = 0x80280003; +pub const TPM_E_AUDITFAILURE: HRESULT = 0x80280004; +pub const TPM_E_CLEAR_DISABLED: HRESULT = 0x80280005; +pub const TPM_E_DEACTIVATED: HRESULT = 0x80280006; +pub const TPM_E_DISABLED: HRESULT = 0x80280007; +pub const TPM_E_DISABLED_CMD: HRESULT = 0x80280008; +pub const TPM_E_FAIL: HRESULT = 0x80280009; +pub const TPM_E_BAD_ORDINAL: HRESULT = 0x8028000A; +pub const TPM_E_INSTALL_DISABLED: HRESULT = 0x8028000B; +pub const TPM_E_INVALID_KEYHANDLE: HRESULT = 0x8028000C; +pub const TPM_E_KEYNOTFOUND: HRESULT = 0x8028000D; +pub const TPM_E_INAPPROPRIATE_ENC: HRESULT = 0x8028000E; +pub const TPM_E_MIGRATEFAIL: HRESULT = 0x8028000F; +pub const TPM_E_INVALID_PCR_INFO: HRESULT = 0x80280010; +pub const TPM_E_NOSPACE: HRESULT = 0x80280011; +pub const TPM_E_NOSRK: HRESULT = 0x80280012; +pub const TPM_E_NOTSEALED_BLOB: HRESULT = 0x80280013; +pub const TPM_E_OWNER_SET: HRESULT = 0x80280014; +pub const TPM_E_RESOURCES: HRESULT = 0x80280015; +pub const TPM_E_SHORTRANDOM: HRESULT = 0x80280016; +pub const TPM_E_SIZE: HRESULT = 0x80280017; +pub const TPM_E_WRONGPCRVAL: HRESULT = 0x80280018; +pub const TPM_E_BAD_PARAM_SIZE: HRESULT = 0x80280019; +pub const TPM_E_SHA_THREAD: HRESULT = 0x8028001A; +pub const TPM_E_SHA_ERROR: HRESULT = 0x8028001B; +pub const TPM_E_FAILEDSELFTEST: HRESULT = 0x8028001C; +pub const TPM_E_AUTH2FAIL: HRESULT = 0x8028001D; +pub const TPM_E_BADTAG: HRESULT = 0x8028001E; +pub const TPM_E_IOERROR: HRESULT = 0x8028001F; +pub const TPM_E_ENCRYPT_ERROR: HRESULT = 0x80280020; +pub const TPM_E_DECRYPT_ERROR: HRESULT = 0x80280021; +pub const TPM_E_INVALID_AUTHHANDLE: HRESULT = 0x80280022; +pub const TPM_E_NO_ENDORSEMENT: HRESULT = 0x80280023; +pub const TPM_E_INVALID_KEYUSAGE: HRESULT = 0x80280024; +pub const TPM_E_WRONG_ENTITYTYPE: HRESULT = 0x80280025; +pub const TPM_E_INVALID_POSTINIT: HRESULT = 0x80280026; +pub const TPM_E_INAPPROPRIATE_SIG: HRESULT = 0x80280027; +pub const TPM_E_BAD_KEY_PROPERTY: HRESULT = 0x80280028; +pub const TPM_E_BAD_MIGRATION: HRESULT = 0x80280029; +pub const TPM_E_BAD_SCHEME: HRESULT = 0x8028002A; +pub const TPM_E_BAD_DATASIZE: HRESULT = 0x8028002B; +pub const TPM_E_BAD_MODE: HRESULT = 0x8028002C; +pub const TPM_E_BAD_PRESENCE: HRESULT = 0x8028002D; +pub const TPM_E_BAD_VERSION: HRESULT = 0x8028002E; +pub const TPM_E_NO_WRAP_TRANSPORT: HRESULT = 0x8028002F; +pub const TPM_E_AUDITFAIL_UNSUCCESSFUL: HRESULT = 0x80280030; +pub const TPM_E_AUDITFAIL_SUCCESSFUL: HRESULT = 0x80280031; +pub const TPM_E_NOTRESETABLE: HRESULT = 0x80280032; +pub const TPM_E_NOTLOCAL: HRESULT = 0x80280033; +pub const TPM_E_BAD_TYPE: HRESULT = 0x80280034; +pub const TPM_E_INVALID_RESOURCE: HRESULT = 0x80280035; +pub const TPM_E_NOTFIPS: HRESULT = 0x80280036; +pub const TPM_E_INVALID_FAMILY: HRESULT = 0x80280037; +pub const TPM_E_NO_NV_PERMISSION: HRESULT = 0x80280038; +pub const TPM_E_REQUIRES_SIGN: HRESULT = 0x80280039; +pub const TPM_E_KEY_NOTSUPPORTED: HRESULT = 0x8028003A; +pub const TPM_E_AUTH_CONFLICT: HRESULT = 0x8028003B; +pub const TPM_E_AREA_LOCKED: HRESULT = 0x8028003C; +pub const TPM_E_BAD_LOCALITY: HRESULT = 0x8028003D; +pub const TPM_E_READ_ONLY: HRESULT = 0x8028003E; +pub const TPM_E_PER_NOWRITE: HRESULT = 0x8028003F; +pub const TPM_E_FAMILYCOUNT: HRESULT = 0x80280040; +pub const TPM_E_WRITE_LOCKED: HRESULT = 0x80280041; +pub const TPM_E_BAD_ATTRIBUTES: HRESULT = 0x80280042; +pub const TPM_E_INVALID_STRUCTURE: HRESULT = 0x80280043; +pub const TPM_E_KEY_OWNER_CONTROL: HRESULT = 0x80280044; +pub const TPM_E_BAD_COUNTER: HRESULT = 0x80280045; +pub const TPM_E_NOT_FULLWRITE: HRESULT = 0x80280046; +pub const TPM_E_CONTEXT_GAP: HRESULT = 0x80280047; +pub const TPM_E_MAXNVWRITES: HRESULT = 0x80280048; +pub const TPM_E_NOOPERATOR: HRESULT = 0x80280049; +pub const TPM_E_RESOURCEMISSING: HRESULT = 0x8028004A; +pub const TPM_E_DELEGATE_LOCK: HRESULT = 0x8028004B; +pub const TPM_E_DELEGATE_FAMILY: HRESULT = 0x8028004C; +pub const TPM_E_DELEGATE_ADMIN: HRESULT = 0x8028004D; +pub const TPM_E_TRANSPORT_NOTEXCLUSIVE: HRESULT = 0x8028004E; +pub const TPM_E_OWNER_CONTROL: HRESULT = 0x8028004F; +pub const TPM_E_DAA_RESOURCES: HRESULT = 0x80280050; +pub const TPM_E_DAA_INPUT_DATA0: HRESULT = 0x80280051; +pub const TPM_E_DAA_INPUT_DATA1: HRESULT = 0x80280052; +pub const TPM_E_DAA_ISSUER_SETTINGS: HRESULT = 0x80280053; +pub const TPM_E_DAA_TPM_SETTINGS: HRESULT = 0x80280054; +pub const TPM_E_DAA_STAGE: HRESULT = 0x80280055; +pub const TPM_E_DAA_ISSUER_VALIDITY: HRESULT = 0x80280056; +pub const TPM_E_DAA_WRONG_W: HRESULT = 0x80280057; +pub const TPM_E_BAD_HANDLE: HRESULT = 0x80280058; +pub const TPM_E_BAD_DELEGATE: HRESULT = 0x80280059; +pub const TPM_E_BADCONTEXT: HRESULT = 0x8028005A; +pub const TPM_E_TOOMANYCONTEXTS: HRESULT = 0x8028005B; +pub const TPM_E_MA_TICKET_SIGNATURE: HRESULT = 0x8028005C; +pub const TPM_E_MA_DESTINATION: HRESULT = 0x8028005D; +pub const TPM_E_MA_SOURCE: HRESULT = 0x8028005E; +pub const TPM_E_MA_AUTHORITY: HRESULT = 0x8028005F; +pub const TPM_E_PERMANENTEK: HRESULT = 0x80280061; +pub const TPM_E_BAD_SIGNATURE: HRESULT = 0x80280062; +pub const TPM_E_NOCONTEXTSPACE: HRESULT = 0x80280063; +pub const TPM_E_COMMAND_BLOCKED: HRESULT = 0x80280400; +pub const TPM_E_INVALID_HANDLE: HRESULT = 0x80280401; +pub const TPM_E_DUPLICATE_VHANDLE: HRESULT = 0x80280402; +pub const TPM_E_EMBEDDED_COMMAND_BLOCKED: HRESULT = 0x80280403; +pub const TPM_E_EMBEDDED_COMMAND_UNSUPPORTED: HRESULT = 0x80280404; +pub const TPM_E_RETRY: HRESULT = 0x80280800; +pub const TPM_E_NEEDS_SELFTEST: HRESULT = 0x80280801; +pub const TPM_E_DOING_SELFTEST: HRESULT = 0x80280802; +pub const TPM_E_DEFEND_LOCK_RUNNING: HRESULT = 0x80280803; +pub const TBS_E_INTERNAL_ERROR: HRESULT = 0x80284001; +pub const TBS_E_BAD_PARAMETER: HRESULT = 0x80284002; +pub const TBS_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80284003; +pub const TBS_E_INVALID_CONTEXT: HRESULT = 0x80284004; +pub const TBS_E_INSUFFICIENT_BUFFER: HRESULT = 0x80284005; +pub const TBS_E_IOERROR: HRESULT = 0x80284006; +pub const TBS_E_INVALID_CONTEXT_PARAM: HRESULT = 0x80284007; +pub const TBS_E_SERVICE_NOT_RUNNING: HRESULT = 0x80284008; +pub const TBS_E_TOO_MANY_TBS_CONTEXTS: HRESULT = 0x80284009; +pub const TBS_E_TOO_MANY_RESOURCES: HRESULT = 0x8028400A; +pub const TBS_E_SERVICE_START_PENDING: HRESULT = 0x8028400B; +pub const TBS_E_PPI_NOT_SUPPORTED: HRESULT = 0x8028400C; +pub const TBS_E_COMMAND_CANCELED: HRESULT = 0x8028400D; +pub const TBS_E_BUFFER_TOO_LARGE: HRESULT = 0x8028400E; +pub const TBS_E_TPM_NOT_FOUND: HRESULT = 0x8028400F; +pub const TBS_E_SERVICE_DISABLED: HRESULT = 0x80284010; +pub const TBS_E_NO_EVENT_LOG: HRESULT = 0x80284011; +pub const TBS_E_ACCESS_DENIED: HRESULT = 0x80284012; +pub const TBS_E_PROVISIONING_NOT_ALLOWED: HRESULT = 0x80284013; +pub const TBS_E_PPI_FUNCTION_UNSUPPORTED: HRESULT = 0x80284014; +pub const TBS_E_OWNERAUTH_NOT_FOUND: HRESULT = 0x80284015; +pub const TBS_E_PROVISIONING_INCOMPLETE: HRESULT = 0x80284016; +pub const TPMAPI_E_INVALID_STATE: HRESULT = 0x80290100; +pub const TPMAPI_E_NOT_ENOUGH_DATA: HRESULT = 0x80290101; +pub const TPMAPI_E_TOO_MUCH_DATA: HRESULT = 0x80290102; +pub const TPMAPI_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80290103; +pub const TPMAPI_E_INVALID_PARAMETER: HRESULT = 0x80290104; +pub const TPMAPI_E_OUT_OF_MEMORY: HRESULT = 0x80290105; +pub const TPMAPI_E_BUFFER_TOO_SMALL: HRESULT = 0x80290106; +pub const TPMAPI_E_INTERNAL_ERROR: HRESULT = 0x80290107; +pub const TPMAPI_E_ACCESS_DENIED: HRESULT = 0x80290108; +pub const TPMAPI_E_AUTHORIZATION_FAILED: HRESULT = 0x80290109; +pub const TPMAPI_E_INVALID_CONTEXT_HANDLE: HRESULT = 0x8029010A; +pub const TPMAPI_E_TBS_COMMUNICATION_ERROR: HRESULT = 0x8029010B; +pub const TPMAPI_E_TPM_COMMAND_ERROR: HRESULT = 0x8029010C; +pub const TPMAPI_E_MESSAGE_TOO_LARGE: HRESULT = 0x8029010D; +pub const TPMAPI_E_INVALID_ENCODING: HRESULT = 0x8029010E; +pub const TPMAPI_E_INVALID_KEY_SIZE: HRESULT = 0x8029010F; +pub const TPMAPI_E_ENCRYPTION_FAILED: HRESULT = 0x80290110; +pub const TPMAPI_E_INVALID_KEY_PARAMS: HRESULT = 0x80290111; +pub const TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB: HRESULT = 0x80290112; +pub const TPMAPI_E_INVALID_PCR_INDEX: HRESULT = 0x80290113; +pub const TPMAPI_E_INVALID_DELEGATE_BLOB: HRESULT = 0x80290114; +pub const TPMAPI_E_INVALID_CONTEXT_PARAMS: HRESULT = 0x80290115; +pub const TPMAPI_E_INVALID_KEY_BLOB: HRESULT = 0x80290116; +pub const TPMAPI_E_INVALID_PCR_DATA: HRESULT = 0x80290117; +pub const TPMAPI_E_INVALID_OWNER_AUTH: HRESULT = 0x80290118; +pub const TPMAPI_E_FIPS_RNG_CHECK_FAILED: HRESULT = 0x80290119; +pub const TPMAPI_E_EMPTY_TCG_LOG: HRESULT = 0x8029011A; +pub const TPMAPI_E_INVALID_TCG_LOG_ENTRY: HRESULT = 0x8029011B; +pub const TPMAPI_E_TCG_SEPARATOR_ABSENT: HRESULT = 0x8029011C; +pub const TPMAPI_E_TCG_INVALID_DIGEST_ENTRY: HRESULT = 0x8029011D; +pub const TPMAPI_E_POLICY_DENIES_OPERATION: HRESULT = 0x8029011E; +pub const TBSIMP_E_BUFFER_TOO_SMALL: HRESULT = 0x80290200; +pub const TBSIMP_E_CLEANUP_FAILED: HRESULT = 0x80290201; +pub const TBSIMP_E_INVALID_CONTEXT_HANDLE: HRESULT = 0x80290202; +pub const TBSIMP_E_INVALID_CONTEXT_PARAM: HRESULT = 0x80290203; +pub const TBSIMP_E_TPM_ERROR: HRESULT = 0x80290204; +pub const TBSIMP_E_HASH_BAD_KEY: HRESULT = 0x80290205; +pub const TBSIMP_E_DUPLICATE_VHANDLE: HRESULT = 0x80290206; +pub const TBSIMP_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80290207; +pub const TBSIMP_E_INVALID_PARAMETER: HRESULT = 0x80290208; +pub const TBSIMP_E_RPC_INIT_FAILED: HRESULT = 0x80290209; +pub const TBSIMP_E_SCHEDULER_NOT_RUNNING: HRESULT = 0x8029020A; +pub const TBSIMP_E_COMMAND_CANCELED: HRESULT = 0x8029020B; +pub const TBSIMP_E_OUT_OF_MEMORY: HRESULT = 0x8029020C; +pub const TBSIMP_E_LIST_NO_MORE_ITEMS: HRESULT = 0x8029020D; +pub const TBSIMP_E_LIST_NOT_FOUND: HRESULT = 0x8029020E; +pub const TBSIMP_E_NOT_ENOUGH_SPACE: HRESULT = 0x8029020F; +pub const TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS: HRESULT = 0x80290210; +pub const TBSIMP_E_COMMAND_FAILED: HRESULT = 0x80290211; +pub const TBSIMP_E_UNKNOWN_ORDINAL: HRESULT = 0x80290212; +pub const TBSIMP_E_RESOURCE_EXPIRED: HRESULT = 0x80290213; +pub const TBSIMP_E_INVALID_RESOURCE: HRESULT = 0x80290214; +pub const TBSIMP_E_NOTHING_TO_UNLOAD: HRESULT = 0x80290215; +pub const TBSIMP_E_HASH_TABLE_FULL: HRESULT = 0x80290216; +pub const TBSIMP_E_TOO_MANY_TBS_CONTEXTS: HRESULT = 0x80290217; +pub const TBSIMP_E_TOO_MANY_RESOURCES: HRESULT = 0x80290218; +pub const TBSIMP_E_PPI_NOT_SUPPORTED: HRESULT = 0x80290219; +pub const TBSIMP_E_TPM_INCOMPATIBLE: HRESULT = 0x8029021A; +pub const TBSIMP_E_NO_EVENT_LOG: HRESULT = 0x8029021B; +pub const TPM_E_PPI_ACPI_FAILURE: HRESULT = 0x80290300; +pub const TPM_E_PPI_USER_ABORT: HRESULT = 0x80290301; +pub const TPM_E_PPI_BIOS_FAILURE: HRESULT = 0x80290302; +pub const TPM_E_PPI_NOT_SUPPORTED: HRESULT = 0x80290303; +pub const TPM_E_PPI_BLOCKED_IN_BIOS: HRESULT = 0x80290304; +pub const TPM_E_PCP_ERROR_MASK: HRESULT = 0x80290400; +pub const TPM_E_PCP_DEVICE_NOT_READY: HRESULT = 0x80290401; +pub const TPM_E_PCP_INVALID_HANDLE: HRESULT = 0x80290402; +pub const TPM_E_PCP_INVALID_PARAMETER: HRESULT = 0x80290403; +pub const TPM_E_PCP_FLAG_NOT_SUPPORTED: HRESULT = 0x80290404; +pub const TPM_E_PCP_NOT_SUPPORTED: HRESULT = 0x80290405; +pub const TPM_E_PCP_BUFFER_TOO_SMALL: HRESULT = 0x80290406; +pub const TPM_E_PCP_INTERNAL_ERROR: HRESULT = 0x80290407; +pub const TPM_E_PCP_AUTHENTICATION_FAILED: HRESULT = 0x80290408; +pub const TPM_E_PCP_AUTHENTICATION_IGNORED: HRESULT = 0x80290409; +pub const TPM_E_PCP_POLICY_NOT_FOUND: HRESULT = 0x8029040A; +pub const TPM_E_PCP_PROFILE_NOT_FOUND: HRESULT = 0x8029040B; +pub const TPM_E_PCP_VALIDATION_FAILED: HRESULT = 0x8029040C; +pub const PLA_E_DCS_NOT_FOUND: HRESULT = 0x80300002; +pub const PLA_E_DCS_IN_USE: HRESULT = 0x803000AA; +pub const PLA_E_TOO_MANY_FOLDERS: HRESULT = 0x80300045; +pub const PLA_E_NO_MIN_DISK: HRESULT = 0x80300070; +pub const PLA_E_DCS_ALREADY_EXISTS: HRESULT = 0x803000B7; +pub const PLA_S_PROPERTY_IGNORED: HRESULT = 0x00300100; +pub const PLA_E_PROPERTY_CONFLICT: HRESULT = 0x80300101; +pub const PLA_E_DCS_SINGLETON_REQUIRED: HRESULT = 0x80300102; +pub const PLA_E_CREDENTIALS_REQUIRED: HRESULT = 0x80300103; +pub const PLA_E_DCS_NOT_RUNNING: HRESULT = 0x80300104; +pub const PLA_E_CONFLICT_INCL_EXCL_API: HRESULT = 0x80300105; +pub const PLA_E_NETWORK_EXE_NOT_VALID: HRESULT = 0x80300106; +pub const PLA_E_EXE_ALREADY_CONFIGURED: HRESULT = 0x80300107; +pub const PLA_E_EXE_PATH_NOT_VALID: HRESULT = 0x80300108; +pub const PLA_E_DC_ALREADY_EXISTS: HRESULT = 0x80300109; +pub const PLA_E_DCS_START_WAIT_TIMEOUT: HRESULT = 0x8030010A; +pub const PLA_E_DC_START_WAIT_TIMEOUT: HRESULT = 0x8030010B; +pub const PLA_E_REPORT_WAIT_TIMEOUT: HRESULT = 0x8030010C; +pub const PLA_E_NO_DUPLICATES: HRESULT = 0x8030010D; +pub const PLA_E_EXE_FULL_PATH_REQUIRED: HRESULT = 0x8030010E; +pub const PLA_E_INVALID_SESSION_NAME: HRESULT = 0x8030010F; +pub const PLA_E_PLA_CHANNEL_NOT_ENABLED: HRESULT = 0x80300110; +pub const PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED: HRESULT = 0x80300111; +pub const PLA_E_RULES_MANAGER_FAILED: HRESULT = 0x80300112; +pub const PLA_E_CABAPI_FAILURE: HRESULT = 0x80300113; +pub const FVE_E_LOCKED_VOLUME: HRESULT = 0x80310000; +pub const FVE_E_NOT_ENCRYPTED: HRESULT = 0x80310001; +pub const FVE_E_NO_TPM_BIOS: HRESULT = 0x80310002; +pub const FVE_E_NO_MBR_METRIC: HRESULT = 0x80310003; +pub const FVE_E_NO_BOOTSECTOR_METRIC: HRESULT = 0x80310004; +pub const FVE_E_NO_BOOTMGR_METRIC: HRESULT = 0x80310005; +pub const FVE_E_WRONG_BOOTMGR: HRESULT = 0x80310006; +pub const FVE_E_SECURE_KEY_REQUIRED: HRESULT = 0x80310007; +pub const FVE_E_NOT_ACTIVATED: HRESULT = 0x80310008; +pub const FVE_E_ACTION_NOT_ALLOWED: HRESULT = 0x80310009; +pub const FVE_E_AD_SCHEMA_NOT_INSTALLED: HRESULT = 0x8031000A; +pub const FVE_E_AD_INVALID_DATATYPE: HRESULT = 0x8031000B; +pub const FVE_E_AD_INVALID_DATASIZE: HRESULT = 0x8031000C; +pub const FVE_E_AD_NO_VALUES: HRESULT = 0x8031000D; +pub const FVE_E_AD_ATTR_NOT_SET: HRESULT = 0x8031000E; +pub const FVE_E_AD_GUID_NOT_FOUND: HRESULT = 0x8031000F; +pub const FVE_E_BAD_INFORMATION: HRESULT = 0x80310010; +pub const FVE_E_TOO_SMALL: HRESULT = 0x80310011; +pub const FVE_E_SYSTEM_VOLUME: HRESULT = 0x80310012; +pub const FVE_E_FAILED_WRONG_FS: HRESULT = 0x80310013; +pub const FVE_E_BAD_PARTITION_SIZE: HRESULT = 0x80310014; +pub const FVE_E_NOT_SUPPORTED: HRESULT = 0x80310015; +pub const FVE_E_BAD_DATA: HRESULT = 0x80310016; +pub const FVE_E_VOLUME_NOT_BOUND: HRESULT = 0x80310017; +pub const FVE_E_TPM_NOT_OWNED: HRESULT = 0x80310018; +pub const FVE_E_NOT_DATA_VOLUME: HRESULT = 0x80310019; +pub const FVE_E_AD_INSUFFICIENT_BUFFER: HRESULT = 0x8031001A; +pub const FVE_E_CONV_READ: HRESULT = 0x8031001B; +pub const FVE_E_CONV_WRITE: HRESULT = 0x8031001C; +pub const FVE_E_KEY_REQUIRED: HRESULT = 0x8031001D; +pub const FVE_E_CLUSTERING_NOT_SUPPORTED: HRESULT = 0x8031001E; +pub const FVE_E_VOLUME_BOUND_ALREADY: HRESULT = 0x8031001F; +pub const FVE_E_OS_NOT_PROTECTED: HRESULT = 0x80310020; +pub const FVE_E_PROTECTION_DISABLED: HRESULT = 0x80310021; +pub const FVE_E_RECOVERY_KEY_REQUIRED: HRESULT = 0x80310022; +pub const FVE_E_FOREIGN_VOLUME: HRESULT = 0x80310023; +pub const FVE_E_OVERLAPPED_UPDATE: HRESULT = 0x80310024; +pub const FVE_E_TPM_SRK_AUTH_NOT_ZERO: HRESULT = 0x80310025; +pub const FVE_E_FAILED_SECTOR_SIZE: HRESULT = 0x80310026; +pub const FVE_E_FAILED_AUTHENTICATION: HRESULT = 0x80310027; +pub const FVE_E_NOT_OS_VOLUME: HRESULT = 0x80310028; +pub const FVE_E_AUTOUNLOCK_ENABLED: HRESULT = 0x80310029; +pub const FVE_E_WRONG_BOOTSECTOR: HRESULT = 0x8031002A; +pub const FVE_E_WRONG_SYSTEM_FS: HRESULT = 0x8031002B; +pub const FVE_E_POLICY_PASSWORD_REQUIRED: HRESULT = 0x8031002C; +pub const FVE_E_CANNOT_SET_FVEK_ENCRYPTED: HRESULT = 0x8031002D; +pub const FVE_E_CANNOT_ENCRYPT_NO_KEY: HRESULT = 0x8031002E; +pub const FVE_E_BOOTABLE_CDDVD: HRESULT = 0x80310030; +pub const FVE_E_PROTECTOR_EXISTS: HRESULT = 0x80310031; +pub const FVE_E_RELATIVE_PATH: HRESULT = 0x80310032; +pub const FVE_E_PROTECTOR_NOT_FOUND: HRESULT = 0x80310033; +pub const FVE_E_INVALID_KEY_FORMAT: HRESULT = 0x80310034; +pub const FVE_E_INVALID_PASSWORD_FORMAT: HRESULT = 0x80310035; +pub const FVE_E_FIPS_RNG_CHECK_FAILED: HRESULT = 0x80310036; +pub const FVE_E_FIPS_PREVENTS_RECOVERY_PASSWORD: HRESULT = 0x80310037; +pub const FVE_E_FIPS_PREVENTS_EXTERNAL_KEY_EXPORT: HRESULT = 0x80310038; +pub const FVE_E_NOT_DECRYPTED: HRESULT = 0x80310039; +pub const FVE_E_INVALID_PROTECTOR_TYPE: HRESULT = 0x8031003A; +pub const FVE_E_NO_PROTECTORS_TO_TEST: HRESULT = 0x8031003B; +pub const FVE_E_KEYFILE_NOT_FOUND: HRESULT = 0x8031003C; +pub const FVE_E_KEYFILE_INVALID: HRESULT = 0x8031003D; +pub const FVE_E_KEYFILE_NO_VMK: HRESULT = 0x8031003E; +pub const FVE_E_TPM_DISABLED: HRESULT = 0x8031003F; +pub const FVE_E_NOT_ALLOWED_IN_SAFE_MODE: HRESULT = 0x80310040; +pub const FVE_E_TPM_INVALID_PCR: HRESULT = 0x80310041; +pub const FVE_E_TPM_NO_VMK: HRESULT = 0x80310042; +pub const FVE_E_PIN_INVALID: HRESULT = 0x80310043; +pub const FVE_E_AUTH_INVALID_APPLICATION: HRESULT = 0x80310044; +pub const FVE_E_AUTH_INVALID_CONFIG: HRESULT = 0x80310045; +pub const FVE_E_FIPS_DISABLE_PROTECTION_NOT_ALLOWED: HRESULT = 0x80310046; +pub const FVE_E_FS_NOT_EXTENDED: HRESULT = 0x80310047; +pub const FVE_E_FIRMWARE_TYPE_NOT_SUPPORTED: HRESULT = 0x80310048; +pub const FVE_E_NO_LICENSE: HRESULT = 0x80310049; +pub const FVE_E_NOT_ON_STACK: HRESULT = 0x8031004A; +pub const FVE_E_FS_MOUNTED: HRESULT = 0x8031004B; +pub const FVE_E_TOKEN_NOT_IMPERSONATED: HRESULT = 0x8031004C; +pub const FVE_E_DRY_RUN_FAILED: HRESULT = 0x8031004D; +pub const FVE_E_REBOOT_REQUIRED: HRESULT = 0x8031004E; +pub const FVE_E_DEBUGGER_ENABLED: HRESULT = 0x8031004F; +pub const FVE_E_RAW_ACCESS: HRESULT = 0x80310050; +pub const FVE_E_RAW_BLOCKED: HRESULT = 0x80310051; +pub const FVE_E_BCD_APPLICATIONS_PATH_INCORRECT: HRESULT = 0x80310052; +pub const FVE_E_NOT_ALLOWED_IN_VERSION: HRESULT = 0x80310053; +pub const FVE_E_NO_AUTOUNLOCK_MASTER_KEY: HRESULT = 0x80310054; +pub const FVE_E_MOR_FAILED: HRESULT = 0x80310055; +pub const FVE_E_HIDDEN_VOLUME: HRESULT = 0x80310056; +pub const FVE_E_TRANSIENT_STATE: HRESULT = 0x80310057; +pub const FVE_E_PUBKEY_NOT_ALLOWED: HRESULT = 0x80310058; +pub const FVE_E_VOLUME_HANDLE_OPEN: HRESULT = 0x80310059; +pub const FVE_E_NO_FEATURE_LICENSE: HRESULT = 0x8031005A; +pub const FVE_E_INVALID_STARTUP_OPTIONS: HRESULT = 0x8031005B; +pub const FVE_E_POLICY_RECOVERY_PASSWORD_NOT_ALLOWED: HRESULT = 0x8031005C; +pub const FVE_E_POLICY_RECOVERY_PASSWORD_REQUIRED: HRESULT = 0x8031005D; +pub const FVE_E_POLICY_RECOVERY_KEY_NOT_ALLOWED: HRESULT = 0x8031005E; +pub const FVE_E_POLICY_RECOVERY_KEY_REQUIRED: HRESULT = 0x8031005F; +pub const FVE_E_POLICY_STARTUP_PIN_NOT_ALLOWED: HRESULT = 0x80310060; +pub const FVE_E_POLICY_STARTUP_PIN_REQUIRED: HRESULT = 0x80310061; +pub const FVE_E_POLICY_STARTUP_KEY_NOT_ALLOWED: HRESULT = 0x80310062; +pub const FVE_E_POLICY_STARTUP_KEY_REQUIRED: HRESULT = 0x80310063; +pub const FVE_E_POLICY_STARTUP_PIN_KEY_NOT_ALLOWED: HRESULT = 0x80310064; +pub const FVE_E_POLICY_STARTUP_PIN_KEY_REQUIRED: HRESULT = 0x80310065; +pub const FVE_E_POLICY_STARTUP_TPM_NOT_ALLOWED: HRESULT = 0x80310066; +pub const FVE_E_POLICY_STARTUP_TPM_REQUIRED: HRESULT = 0x80310067; +pub const FVE_E_POLICY_INVALID_PIN_LENGTH: HRESULT = 0x80310068; +pub const FVE_E_KEY_PROTECTOR_NOT_SUPPORTED: HRESULT = 0x80310069; +pub const FVE_E_POLICY_PASSPHRASE_NOT_ALLOWED: HRESULT = 0x8031006A; +pub const FVE_E_POLICY_PASSPHRASE_REQUIRED: HRESULT = 0x8031006B; +pub const FVE_E_FIPS_PREVENTS_PASSPHRASE: HRESULT = 0x8031006C; +pub const FVE_E_OS_VOLUME_PASSPHRASE_NOT_ALLOWED: HRESULT = 0x8031006D; +pub const FVE_E_INVALID_BITLOCKER_OID: HRESULT = 0x8031006E; +pub const FVE_E_VOLUME_TOO_SMALL: HRESULT = 0x8031006F; +pub const FVE_E_DV_NOT_SUPPORTED_ON_FS: HRESULT = 0x80310070; +pub const FVE_E_DV_NOT_ALLOWED_BY_GP: HRESULT = 0x80310071; +pub const FVE_E_POLICY_USER_CERTIFICATE_NOT_ALLOWED: HRESULT = 0x80310072; +pub const FVE_E_POLICY_USER_CERTIFICATE_REQUIRED: HRESULT = 0x80310073; +pub const FVE_E_POLICY_USER_CERT_MUST_BE_HW: HRESULT = 0x80310074; +pub const FVE_E_POLICY_USER_CONFIGURE_FDV_AUTOUNLOCK_NOT_ALLOWED: HRESULT + = 0x80310075; +pub const FVE_E_POLICY_USER_CONFIGURE_RDV_AUTOUNLOCK_NOT_ALLOWED: HRESULT + = 0x80310076; +pub const FVE_E_POLICY_USER_CONFIGURE_RDV_NOT_ALLOWED: HRESULT = 0x80310077; +pub const FVE_E_POLICY_USER_ENABLE_RDV_NOT_ALLOWED: HRESULT = 0x80310078; +pub const FVE_E_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: HRESULT = 0x80310079; +pub const FVE_E_POLICY_INVALID_PASSPHRASE_LENGTH: HRESULT = 0x80310080; +pub const FVE_E_POLICY_PASSPHRASE_TOO_SIMPLE: HRESULT = 0x80310081; +pub const FVE_E_RECOVERY_PARTITION: HRESULT = 0x80310082; +pub const FVE_E_POLICY_CONFLICT_FDV_RK_OFF_AUK_ON: HRESULT = 0x80310083; +pub const FVE_E_POLICY_CONFLICT_RDV_RK_OFF_AUK_ON: HRESULT = 0x80310084; +pub const FVE_E_NON_BITLOCKER_OID: HRESULT = 0x80310085; +pub const FVE_E_POLICY_PROHIBITS_SELFSIGNED: HRESULT = 0x80310086; +pub const FVE_E_POLICY_CONFLICT_RO_AND_STARTUP_KEY_REQUIRED: HRESULT = 0x80310087; +pub const FVE_E_CONV_RECOVERY_FAILED: HRESULT = 0x80310088; +pub const FVE_E_VIRTUALIZED_SPACE_TOO_BIG: HRESULT = 0x80310089; +pub const FVE_E_POLICY_CONFLICT_OSV_RP_OFF_ADB_ON: HRESULT = 0x80310090; +pub const FVE_E_POLICY_CONFLICT_FDV_RP_OFF_ADB_ON: HRESULT = 0x80310091; +pub const FVE_E_POLICY_CONFLICT_RDV_RP_OFF_ADB_ON: HRESULT = 0x80310092; +pub const FVE_E_NON_BITLOCKER_KU: HRESULT = 0x80310093; +pub const FVE_E_PRIVATEKEY_AUTH_FAILED: HRESULT = 0x80310094; +pub const FVE_E_REMOVAL_OF_DRA_FAILED: HRESULT = 0x80310095; +pub const FVE_E_OPERATION_NOT_SUPPORTED_ON_VISTA_VOLUME: HRESULT = 0x80310096; +pub const FVE_E_CANT_LOCK_AUTOUNLOCK_ENABLED_VOLUME: HRESULT = 0x80310097; +pub const FVE_E_FIPS_HASH_KDF_NOT_ALLOWED: HRESULT = 0x80310098; +pub const FVE_E_ENH_PIN_INVALID: HRESULT = 0x80310099; +pub const FVE_E_INVALID_PIN_CHARS: HRESULT = 0x8031009A; +pub const FVE_E_INVALID_DATUM_TYPE: HRESULT = 0x8031009B; +pub const FVE_E_EFI_ONLY: HRESULT = 0x8031009C; +pub const FVE_E_MULTIPLE_NKP_CERTS: HRESULT = 0x8031009D; +pub const FVE_E_REMOVAL_OF_NKP_FAILED: HRESULT = 0x8031009E; +pub const FVE_E_INVALID_NKP_CERT: HRESULT = 0x8031009F; +pub const FVE_E_NO_EXISTING_PIN: HRESULT = 0x803100A0; +pub const FVE_E_PROTECTOR_CHANGE_PIN_MISMATCH: HRESULT = 0x803100A1; +pub const FVE_E_PIN_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED: HRESULT = 0x803100A2; +pub const FVE_E_PROTECTOR_CHANGE_MAX_PIN_CHANGE_ATTEMPTS_REACHED: HRESULT + = 0x803100A3; +pub const FVE_E_POLICY_PASSPHRASE_REQUIRES_ASCII: HRESULT = 0x803100A4; +pub const FVE_E_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE: HRESULT = 0x803100A5; +pub const FVE_E_WIPE_NOT_ALLOWED_ON_TP_STORAGE: HRESULT = 0x803100A6; +pub const FVE_E_KEY_LENGTH_NOT_SUPPORTED_BY_EDRIVE: HRESULT = 0x803100A7; +pub const FVE_E_NO_EXISTING_PASSPHRASE: HRESULT = 0x803100A8; +pub const FVE_E_PROTECTOR_CHANGE_PASSPHRASE_MISMATCH: HRESULT = 0x803100A9; +pub const FVE_E_PASSPHRASE_TOO_LONG: HRESULT = 0x803100AA; +pub const FVE_E_NO_PASSPHRASE_WITH_TPM: HRESULT = 0x803100AB; +pub const FVE_E_NO_TPM_WITH_PASSPHRASE: HRESULT = 0x803100AC; +pub const FVE_E_NOT_ALLOWED_ON_CSV_STACK: HRESULT = 0x803100AD; +pub const FVE_E_NOT_ALLOWED_ON_CLUSTER: HRESULT = 0x803100AE; +pub const FVE_E_EDRIVE_NO_FAILOVER_TO_SW: HRESULT = 0x803100AF; +pub const FVE_E_EDRIVE_BAND_IN_USE: HRESULT = 0x803100B0; +pub const FVE_E_EDRIVE_DISALLOWED_BY_GP: HRESULT = 0x803100B1; +pub const FVE_E_EDRIVE_INCOMPATIBLE_VOLUME: HRESULT = 0x803100B2; +pub const FVE_E_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING: HRESULT = 0x803100B3; +pub const FVE_E_EDRIVE_DV_NOT_SUPPORTED: HRESULT = 0x803100B4; +pub const FVE_E_NO_PREBOOT_KEYBOARD_DETECTED: HRESULT = 0x803100B5; +pub const FVE_E_NO_PREBOOT_KEYBOARD_OR_WINRE_DETECTED: HRESULT = 0x803100B6; +pub const FVE_E_POLICY_REQUIRES_STARTUP_PIN_ON_TOUCH_DEVICE: HRESULT = 0x803100B7; +pub const FVE_E_POLICY_REQUIRES_RECOVERY_PASSWORD_ON_TOUCH_DEVICE: HRESULT + = 0x803100B8; +pub const FVE_E_WIPE_CANCEL_NOT_APPLICABLE: HRESULT = 0x803100B9; +pub const FVE_E_SECUREBOOT_DISABLED: HRESULT = 0x803100BA; +pub const FVE_E_SECUREBOOT_CONFIGURATION_INVALID: HRESULT = 0x803100BB; +pub const FVE_E_EDRIVE_DRY_RUN_FAILED: HRESULT = 0x803100BC; +pub const FVE_E_SHADOW_COPY_PRESENT: HRESULT = 0x803100BD; +pub const FVE_E_POLICY_INVALID_ENHANCED_BCD_SETTINGS: HRESULT = 0x803100BE; +pub const FVE_E_EDRIVE_INCOMPATIBLE_FIRMWARE: HRESULT = 0x803100BF; +pub const FVE_E_PROTECTOR_CHANGE_MAX_PASSPHRASE_CHANGE_ATTEMPTS_REACHED: HRESULT + = 0x803100C0; +pub const FVE_E_PASSPHRASE_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED: HRESULT + = 0x803100C1; +pub const FVE_E_LIVEID_ACCOUNT_SUSPENDED: HRESULT = 0x803100C2; +pub const FVE_E_LIVEID_ACCOUNT_BLOCKED: HRESULT = 0x803100C3; +pub const FVE_E_NOT_PROVISIONED_ON_ALL_VOLUMES: HRESULT = 0x803100C4; +pub const FVE_E_DE_FIXED_DATA_NOT_SUPPORTED: HRESULT = 0x803100C5; +pub const FVE_E_DE_HARDWARE_NOT_COMPLIANT: HRESULT = 0x803100C6; +pub const FVE_E_DE_WINRE_NOT_CONFIGURED: HRESULT = 0x803100C7; +pub const FVE_E_DE_PROTECTION_SUSPENDED: HRESULT = 0x803100C8; +pub const FVE_E_DE_OS_VOLUME_NOT_PROTECTED: HRESULT = 0x803100C9; +pub const FVE_E_DE_DEVICE_LOCKEDOUT: HRESULT = 0x803100CA; +pub const FVE_E_DE_PROTECTION_NOT_YET_ENABLED: HRESULT = 0x803100CB; +pub const FVE_E_INVALID_PIN_CHARS_DETAILED: HRESULT = 0x803100CC; +pub const FVE_E_DEVICE_LOCKOUT_COUNTER_UNAVAILABLE: HRESULT = 0x803100CD; +pub const FVE_E_DEVICELOCKOUT_COUNTER_MISMATCH: HRESULT = 0x803100CE; +pub const FVE_E_BUFFER_TOO_LARGE: HRESULT = 0x803100CF; +pub const FVE_E_NO_SUCH_CAPABILITY_ON_TARGET: HRESULT = 0x803100D0; +pub const FVE_E_DE_PREVENTED_FOR_OS: HRESULT = 0x803100D1; +pub const FVE_E_DE_VOLUME_OPTED_OUT: HRESULT = 0x803100D2; +pub const FVE_E_DE_VOLUME_NOT_SUPPORTED: HRESULT = 0x803100D3; +pub const FVE_E_EOW_NOT_SUPPORTED_IN_VERSION: HRESULT = 0x803100D4; +pub const FVE_E_ADBACKUP_NOT_ENABLED: HRESULT = 0x803100D5; +pub const FVE_E_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT: HRESULT = 0x803100D6; +pub const FVE_E_NOT_DE_VOLUME: HRESULT = 0x803100D7; +pub const FVE_E_PROTECTION_CANNOT_BE_DISABLED: HRESULT = 0x803100D8; +pub const FWP_E_CALLOUT_NOT_FOUND: HRESULT = 0x80320001; +pub const FWP_E_CONDITION_NOT_FOUND: HRESULT = 0x80320002; +pub const FWP_E_FILTER_NOT_FOUND: HRESULT = 0x80320003; +pub const FWP_E_LAYER_NOT_FOUND: HRESULT = 0x80320004; +pub const FWP_E_PROVIDER_NOT_FOUND: HRESULT = 0x80320005; +pub const FWP_E_PROVIDER_CONTEXT_NOT_FOUND: HRESULT = 0x80320006; +pub const FWP_E_SUBLAYER_NOT_FOUND: HRESULT = 0x80320007; +pub const FWP_E_NOT_FOUND: HRESULT = 0x80320008; +pub const FWP_E_ALREADY_EXISTS: HRESULT = 0x80320009; +pub const FWP_E_IN_USE: HRESULT = 0x8032000A; +pub const FWP_E_DYNAMIC_SESSION_IN_PROGRESS: HRESULT = 0x8032000B; +pub const FWP_E_WRONG_SESSION: HRESULT = 0x8032000C; +pub const FWP_E_NO_TXN_IN_PROGRESS: HRESULT = 0x8032000D; +pub const FWP_E_TXN_IN_PROGRESS: HRESULT = 0x8032000E; +pub const FWP_E_TXN_ABORTED: HRESULT = 0x8032000F; +pub const FWP_E_SESSION_ABORTED: HRESULT = 0x80320010; +pub const FWP_E_INCOMPATIBLE_TXN: HRESULT = 0x80320011; +pub const FWP_E_TIMEOUT: HRESULT = 0x80320012; +pub const FWP_E_NET_EVENTS_DISABLED: HRESULT = 0x80320013; +pub const FWP_E_INCOMPATIBLE_LAYER: HRESULT = 0x80320014; +pub const FWP_E_KM_CLIENTS_ONLY: HRESULT = 0x80320015; +pub const FWP_E_LIFETIME_MISMATCH: HRESULT = 0x80320016; +pub const FWP_E_BUILTIN_OBJECT: HRESULT = 0x80320017; +pub const FWP_E_TOO_MANY_CALLOUTS: HRESULT = 0x80320018; +pub const FWP_E_NOTIFICATION_DROPPED: HRESULT = 0x80320019; +pub const FWP_E_TRAFFIC_MISMATCH: HRESULT = 0x8032001A; +pub const FWP_E_INCOMPATIBLE_SA_STATE: HRESULT = 0x8032001B; +pub const FWP_E_NULL_POINTER: HRESULT = 0x8032001C; +pub const FWP_E_INVALID_ENUMERATOR: HRESULT = 0x8032001D; +pub const FWP_E_INVALID_FLAGS: HRESULT = 0x8032001E; +pub const FWP_E_INVALID_NET_MASK: HRESULT = 0x8032001F; +pub const FWP_E_INVALID_RANGE: HRESULT = 0x80320020; +pub const FWP_E_INVALID_INTERVAL: HRESULT = 0x80320021; +pub const FWP_E_ZERO_LENGTH_ARRAY: HRESULT = 0x80320022; +pub const FWP_E_NULL_DISPLAY_NAME: HRESULT = 0x80320023; +pub const FWP_E_INVALID_ACTION_TYPE: HRESULT = 0x80320024; +pub const FWP_E_INVALID_WEIGHT: HRESULT = 0x80320025; +pub const FWP_E_MATCH_TYPE_MISMATCH: HRESULT = 0x80320026; +pub const FWP_E_TYPE_MISMATCH: HRESULT = 0x80320027; +pub const FWP_E_OUT_OF_BOUNDS: HRESULT = 0x80320028; +pub const FWP_E_RESERVED: HRESULT = 0x80320029; +pub const FWP_E_DUPLICATE_CONDITION: HRESULT = 0x8032002A; +pub const FWP_E_DUPLICATE_KEYMOD: HRESULT = 0x8032002B; +pub const FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER: HRESULT = 0x8032002C; +pub const FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER: HRESULT = 0x8032002D; +pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER: HRESULT = 0x8032002E; +pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: HRESULT = 0x8032002F; +pub const FWP_E_INCOMPATIBLE_AUTH_METHOD: HRESULT = 0x80320030; +pub const FWP_E_INCOMPATIBLE_DH_GROUP: HRESULT = 0x80320031; +pub const FWP_E_EM_NOT_SUPPORTED: HRESULT = 0x80320032; +pub const FWP_E_NEVER_MATCH: HRESULT = 0x80320033; +pub const FWP_E_PROVIDER_CONTEXT_MISMATCH: HRESULT = 0x80320034; +pub const FWP_E_INVALID_PARAMETER: HRESULT = 0x80320035; +pub const FWP_E_TOO_MANY_SUBLAYERS: HRESULT = 0x80320036; +pub const FWP_E_CALLOUT_NOTIFICATION_FAILED: HRESULT = 0x80320037; +pub const FWP_E_INVALID_AUTH_TRANSFORM: HRESULT = 0x80320038; +pub const FWP_E_INVALID_CIPHER_TRANSFORM: HRESULT = 0x80320039; +pub const FWP_E_INCOMPATIBLE_CIPHER_TRANSFORM: HRESULT = 0x8032003A; +pub const FWP_E_INVALID_TRANSFORM_COMBINATION: HRESULT = 0x8032003B; +pub const FWP_E_DUPLICATE_AUTH_METHOD: HRESULT = 0x8032003C; +pub const FWP_E_INVALID_TUNNEL_ENDPOINT: HRESULT = 0x8032003D; +pub const FWP_E_L2_DRIVER_NOT_READY: HRESULT = 0x8032003E; +pub const FWP_E_KEY_DICTATOR_ALREADY_REGISTERED: HRESULT = 0x8032003F; +pub const FWP_E_KEY_DICTATION_INVALID_KEYING_MATERIAL: HRESULT = 0x80320040; +pub const FWP_E_CONNECTIONS_DISABLED: HRESULT = 0x80320041; +pub const FWP_E_INVALID_DNS_NAME: HRESULT = 0x80320042; +pub const FWP_E_STILL_ON: HRESULT = 0x80320043; +pub const FWP_E_IKEEXT_NOT_RUNNING: HRESULT = 0x80320044; +pub const FWP_E_DROP_NOICMP: HRESULT = 0x80320104; +pub const WS_S_ASYNC: HRESULT = 0x003D0000; +pub const WS_S_END: HRESULT = 0x003D0001; +pub const WS_E_INVALID_FORMAT: HRESULT = 0x803D0000; +pub const WS_E_OBJECT_FAULTED: HRESULT = 0x803D0001; +pub const WS_E_NUMERIC_OVERFLOW: HRESULT = 0x803D0002; +pub const WS_E_INVALID_OPERATION: HRESULT = 0x803D0003; +pub const WS_E_OPERATION_ABORTED: HRESULT = 0x803D0004; +pub const WS_E_ENDPOINT_ACCESS_DENIED: HRESULT = 0x803D0005; +pub const WS_E_OPERATION_TIMED_OUT: HRESULT = 0x803D0006; +pub const WS_E_OPERATION_ABANDONED: HRESULT = 0x803D0007; +pub const WS_E_QUOTA_EXCEEDED: HRESULT = 0x803D0008; +pub const WS_E_NO_TRANSLATION_AVAILABLE: HRESULT = 0x803D0009; +pub const WS_E_SECURITY_VERIFICATION_FAILURE: HRESULT = 0x803D000A; +pub const WS_E_ADDRESS_IN_USE: HRESULT = 0x803D000B; +pub const WS_E_ADDRESS_NOT_AVAILABLE: HRESULT = 0x803D000C; +pub const WS_E_ENDPOINT_NOT_FOUND: HRESULT = 0x803D000D; +pub const WS_E_ENDPOINT_NOT_AVAILABLE: HRESULT = 0x803D000E; +pub const WS_E_ENDPOINT_FAILURE: HRESULT = 0x803D000F; +pub const WS_E_ENDPOINT_UNREACHABLE: HRESULT = 0x803D0010; +pub const WS_E_ENDPOINT_ACTION_NOT_SUPPORTED: HRESULT = 0x803D0011; +pub const WS_E_ENDPOINT_TOO_BUSY: HRESULT = 0x803D0012; +pub const WS_E_ENDPOINT_FAULT_RECEIVED: HRESULT = 0x803D0013; +pub const WS_E_ENDPOINT_DISCONNECTED: HRESULT = 0x803D0014; +pub const WS_E_PROXY_FAILURE: HRESULT = 0x803D0015; +pub const WS_E_PROXY_ACCESS_DENIED: HRESULT = 0x803D0016; +pub const WS_E_NOT_SUPPORTED: HRESULT = 0x803D0017; +pub const WS_E_PROXY_REQUIRES_BASIC_AUTH: HRESULT = 0x803D0018; +pub const WS_E_PROXY_REQUIRES_DIGEST_AUTH: HRESULT = 0x803D0019; +pub const WS_E_PROXY_REQUIRES_NTLM_AUTH: HRESULT = 0x803D001A; +pub const WS_E_PROXY_REQUIRES_NEGOTIATE_AUTH: HRESULT = 0x803D001B; +pub const WS_E_SERVER_REQUIRES_BASIC_AUTH: HRESULT = 0x803D001C; +pub const WS_E_SERVER_REQUIRES_DIGEST_AUTH: HRESULT = 0x803D001D; +pub const WS_E_SERVER_REQUIRES_NTLM_AUTH: HRESULT = 0x803D001E; +pub const WS_E_SERVER_REQUIRES_NEGOTIATE_AUTH: HRESULT = 0x803D001F; +pub const WS_E_INVALID_ENDPOINT_URL: HRESULT = 0x803D0020; +pub const WS_E_OTHER: HRESULT = 0x803D0021; +pub const WS_E_SECURITY_TOKEN_EXPIRED: HRESULT = 0x803D0022; +pub const WS_E_SECURITY_SYSTEM_FAILURE: HRESULT = 0x803D0023; +pub const ERROR_NDIS_INTERFACE_CLOSING: HRESULT = 0x80340002; +pub const ERROR_NDIS_BAD_VERSION: HRESULT = 0x80340004; +pub const ERROR_NDIS_BAD_CHARACTERISTICS: HRESULT = 0x80340005; +pub const ERROR_NDIS_ADAPTER_NOT_FOUND: HRESULT = 0x80340006; +pub const ERROR_NDIS_OPEN_FAILED: HRESULT = 0x80340007; +pub const ERROR_NDIS_DEVICE_FAILED: HRESULT = 0x80340008; +pub const ERROR_NDIS_MULTICAST_FULL: HRESULT = 0x80340009; +pub const ERROR_NDIS_MULTICAST_EXISTS: HRESULT = 0x8034000A; +pub const ERROR_NDIS_MULTICAST_NOT_FOUND: HRESULT = 0x8034000B; +pub const ERROR_NDIS_REQUEST_ABORTED: HRESULT = 0x8034000C; +pub const ERROR_NDIS_RESET_IN_PROGRESS: HRESULT = 0x8034000D; +pub const ERROR_NDIS_NOT_SUPPORTED: HRESULT = 0x803400BB; +pub const ERROR_NDIS_INVALID_PACKET: HRESULT = 0x8034000F; +pub const ERROR_NDIS_ADAPTER_NOT_READY: HRESULT = 0x80340011; +pub const ERROR_NDIS_INVALID_LENGTH: HRESULT = 0x80340014; +pub const ERROR_NDIS_INVALID_DATA: HRESULT = 0x80340015; +pub const ERROR_NDIS_BUFFER_TOO_SHORT: HRESULT = 0x80340016; +pub const ERROR_NDIS_INVALID_OID: HRESULT = 0x80340017; +pub const ERROR_NDIS_ADAPTER_REMOVED: HRESULT = 0x80340018; +pub const ERROR_NDIS_UNSUPPORTED_MEDIA: HRESULT = 0x80340019; +pub const ERROR_NDIS_GROUP_ADDRESS_IN_USE: HRESULT = 0x8034001A; +pub const ERROR_NDIS_FILE_NOT_FOUND: HRESULT = 0x8034001B; +pub const ERROR_NDIS_ERROR_READING_FILE: HRESULT = 0x8034001C; +pub const ERROR_NDIS_ALREADY_MAPPED: HRESULT = 0x8034001D; +pub const ERROR_NDIS_RESOURCE_CONFLICT: HRESULT = 0x8034001E; +pub const ERROR_NDIS_MEDIA_DISCONNECTED: HRESULT = 0x8034001F; +pub const ERROR_NDIS_INVALID_ADDRESS: HRESULT = 0x80340022; +pub const ERROR_NDIS_INVALID_DEVICE_REQUEST: HRESULT = 0x80340010; +pub const ERROR_NDIS_PAUSED: HRESULT = 0x8034002A; +pub const ERROR_NDIS_INTERFACE_NOT_FOUND: HRESULT = 0x8034002B; +pub const ERROR_NDIS_UNSUPPORTED_REVISION: HRESULT = 0x8034002C; +pub const ERROR_NDIS_INVALID_PORT: HRESULT = 0x8034002D; +pub const ERROR_NDIS_INVALID_PORT_STATE: HRESULT = 0x8034002E; +pub const ERROR_NDIS_LOW_POWER_STATE: HRESULT = 0x8034002F; +pub const ERROR_NDIS_REINIT_REQUIRED: HRESULT = 0x80340030; +pub const ERROR_NDIS_DOT11_AUTO_CONFIG_ENABLED: HRESULT = 0x80342000; +pub const ERROR_NDIS_DOT11_MEDIA_IN_USE: HRESULT = 0x80342001; +pub const ERROR_NDIS_DOT11_POWER_STATE_INVALID: HRESULT = 0x80342002; +pub const ERROR_NDIS_PM_WOL_PATTERN_LIST_FULL: HRESULT = 0x80342003; +pub const ERROR_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: HRESULT = 0x80342004; +pub const ERROR_NDIS_INDICATION_REQUIRED: HRESULT = 0x00340001; +pub const ERROR_NDIS_OFFLOAD_POLICY: HRESULT = 0xC034100F; +pub const ERROR_NDIS_OFFLOAD_CONNECTION_REJECTED: HRESULT = 0xC0341012; +pub const ERROR_NDIS_OFFLOAD_PATH_REJECTED: HRESULT = 0xC0341013; +pub const ERROR_HV_INVALID_HYPERCALL_CODE: HRESULT = 0xC0350002; +pub const ERROR_HV_INVALID_HYPERCALL_INPUT: HRESULT = 0xC0350003; +pub const ERROR_HV_INVALID_ALIGNMENT: HRESULT = 0xC0350004; +pub const ERROR_HV_INVALID_PARAMETER: HRESULT = 0xC0350005; +pub const ERROR_HV_ACCESS_DENIED: HRESULT = 0xC0350006; +pub const ERROR_HV_INVALID_PARTITION_STATE: HRESULT = 0xC0350007; +pub const ERROR_HV_OPERATION_DENIED: HRESULT = 0xC0350008; +pub const ERROR_HV_UNKNOWN_PROPERTY: HRESULT = 0xC0350009; +pub const ERROR_HV_PROPERTY_VALUE_OUT_OF_RANGE: HRESULT = 0xC035000A; +pub const ERROR_HV_INSUFFICIENT_MEMORY: HRESULT = 0xC035000B; +pub const ERROR_HV_PARTITION_TOO_DEEP: HRESULT = 0xC035000C; +pub const ERROR_HV_INVALID_PARTITION_ID: HRESULT = 0xC035000D; +pub const ERROR_HV_INVALID_VP_INDEX: HRESULT = 0xC035000E; +pub const ERROR_HV_INVALID_PORT_ID: HRESULT = 0xC0350011; +pub const ERROR_HV_INVALID_CONNECTION_ID: HRESULT = 0xC0350012; +pub const ERROR_HV_INSUFFICIENT_BUFFERS: HRESULT = 0xC0350013; +pub const ERROR_HV_NOT_ACKNOWLEDGED: HRESULT = 0xC0350014; +pub const ERROR_HV_ACKNOWLEDGED: HRESULT = 0xC0350016; +pub const ERROR_HV_INVALID_SAVE_RESTORE_STATE: HRESULT = 0xC0350017; +pub const ERROR_HV_INVALID_SYNIC_STATE: HRESULT = 0xC0350018; +pub const ERROR_HV_OBJECT_IN_USE: HRESULT = 0xC0350019; +pub const ERROR_HV_INVALID_PROXIMITY_DOMAIN_INFO: HRESULT = 0xC035001A; +pub const ERROR_HV_NO_DATA: HRESULT = 0xC035001B; +pub const ERROR_HV_INACTIVE: HRESULT = 0xC035001C; +pub const ERROR_HV_NO_RESOURCES: HRESULT = 0xC035001D; +pub const ERROR_HV_FEATURE_UNAVAILABLE: HRESULT = 0xC035001E; +pub const ERROR_HV_INSUFFICIENT_BUFFER: HRESULT = 0xC0350033; +pub const ERROR_HV_INSUFFICIENT_DEVICE_DOMAINS: HRESULT = 0xC0350038; +pub const ERROR_HV_INVALID_LP_INDEX: HRESULT = 0xC0350041; +pub const ERROR_HV_NOT_PRESENT: HRESULT = 0xC0351000; +pub const ERROR_VID_DUPLICATE_HANDLER: HRESULT = 0xC0370001; +pub const ERROR_VID_TOO_MANY_HANDLERS: HRESULT = 0xC0370002; +pub const ERROR_VID_QUEUE_FULL: HRESULT = 0xC0370003; +pub const ERROR_VID_HANDLER_NOT_PRESENT: HRESULT = 0xC0370004; +pub const ERROR_VID_INVALID_OBJECT_NAME: HRESULT = 0xC0370005; +pub const ERROR_VID_PARTITION_NAME_TOO_LONG: HRESULT = 0xC0370006; +pub const ERROR_VID_MESSAGE_QUEUE_NAME_TOO_LONG: HRESULT = 0xC0370007; +pub const ERROR_VID_PARTITION_ALREADY_EXISTS: HRESULT = 0xC0370008; +pub const ERROR_VID_PARTITION_DOES_NOT_EXIST: HRESULT = 0xC0370009; +pub const ERROR_VID_PARTITION_NAME_NOT_FOUND: HRESULT = 0xC037000A; +pub const ERROR_VID_MESSAGE_QUEUE_ALREADY_EXISTS: HRESULT = 0xC037000B; +pub const ERROR_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT: HRESULT = 0xC037000C; +pub const ERROR_VID_MB_STILL_REFERENCED: HRESULT = 0xC037000D; +pub const ERROR_VID_CHILD_GPA_PAGE_SET_CORRUPTED: HRESULT = 0xC037000E; +pub const ERROR_VID_INVALID_NUMA_SETTINGS: HRESULT = 0xC037000F; +pub const ERROR_VID_INVALID_NUMA_NODE_INDEX: HRESULT = 0xC0370010; +pub const ERROR_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED: HRESULT = 0xC0370011; +pub const ERROR_VID_INVALID_MEMORY_BLOCK_HANDLE: HRESULT = 0xC0370012; +pub const ERROR_VID_PAGE_RANGE_OVERFLOW: HRESULT = 0xC0370013; +pub const ERROR_VID_INVALID_MESSAGE_QUEUE_HANDLE: HRESULT = 0xC0370014; +pub const ERROR_VID_INVALID_GPA_RANGE_HANDLE: HRESULT = 0xC0370015; +pub const ERROR_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE: HRESULT = 0xC0370016; +pub const ERROR_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED: HRESULT = 0xC0370017; +pub const ERROR_VID_INVALID_PPM_HANDLE: HRESULT = 0xC0370018; +pub const ERROR_VID_MBPS_ARE_LOCKED: HRESULT = 0xC0370019; +pub const ERROR_VID_MESSAGE_QUEUE_CLOSED: HRESULT = 0xC037001A; +pub const ERROR_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED: HRESULT = 0xC037001B; +pub const ERROR_VID_STOP_PENDING: HRESULT = 0xC037001C; +pub const ERROR_VID_INVALID_PROCESSOR_STATE: HRESULT = 0xC037001D; +pub const ERROR_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT: HRESULT = 0xC037001E; +pub const ERROR_VID_KM_INTERFACE_ALREADY_INITIALIZED: HRESULT = 0xC037001F; +pub const ERROR_VID_MB_PROPERTY_ALREADY_SET_RESET: HRESULT = 0xC0370020; +pub const ERROR_VID_MMIO_RANGE_DESTROYED: HRESULT = 0xC0370021; +pub const ERROR_VID_INVALID_CHILD_GPA_PAGE_SET: HRESULT = 0xC0370022; +pub const ERROR_VID_RESERVE_PAGE_SET_IS_BEING_USED: HRESULT = 0xC0370023; +pub const ERROR_VID_RESERVE_PAGE_SET_TOO_SMALL: HRESULT = 0xC0370024; +pub const ERROR_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE: HRESULT = 0xC0370025; +pub const ERROR_VID_MBP_COUNT_EXCEEDED_LIMIT: HRESULT = 0xC0370026; +pub const ERROR_VID_SAVED_STATE_CORRUPT: HRESULT = 0xC0370027; +pub const ERROR_VID_SAVED_STATE_UNRECOGNIZED_ITEM: HRESULT = 0xC0370028; +pub const ERROR_VID_SAVED_STATE_INCOMPATIBLE: HRESULT = 0xC0370029; +pub const ERROR_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED: HRESULT = 0x80370001; +pub const ERROR_VOLMGR_INCOMPLETE_REGENERATION: HRESULT = 0x80380001; +pub const ERROR_VOLMGR_INCOMPLETE_DISK_MIGRATION: HRESULT = 0x80380002; +pub const ERROR_VOLMGR_DATABASE_FULL: HRESULT = 0xC0380001; +pub const ERROR_VOLMGR_DISK_CONFIGURATION_CORRUPTED: HRESULT = 0xC0380002; +pub const ERROR_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC: HRESULT = 0xC0380003; +pub const ERROR_VOLMGR_PACK_CONFIG_UPDATE_FAILED: HRESULT = 0xC0380004; +pub const ERROR_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME: HRESULT = 0xC0380005; +pub const ERROR_VOLMGR_DISK_DUPLICATE: HRESULT = 0xC0380006; +pub const ERROR_VOLMGR_DISK_DYNAMIC: HRESULT = 0xC0380007; +pub const ERROR_VOLMGR_DISK_ID_INVALID: HRESULT = 0xC0380008; +pub const ERROR_VOLMGR_DISK_INVALID: HRESULT = 0xC0380009; +pub const ERROR_VOLMGR_DISK_LAST_VOTER: HRESULT = 0xC038000A; +pub const ERROR_VOLMGR_DISK_LAYOUT_INVALID: HRESULT = 0xC038000B; +pub const ERROR_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS: HRESULT + = 0xC038000C; +pub const ERROR_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED: HRESULT = 0xC038000D; +pub const ERROR_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL: HRESULT = 0xC038000E; +pub const ERROR_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS: HRESULT + = 0xC038000F; +pub const ERROR_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS: HRESULT = 0xC0380010; +pub const ERROR_VOLMGR_DISK_MISSING: HRESULT = 0xC0380011; +pub const ERROR_VOLMGR_DISK_NOT_EMPTY: HRESULT = 0xC0380012; +pub const ERROR_VOLMGR_DISK_NOT_ENOUGH_SPACE: HRESULT = 0xC0380013; +pub const ERROR_VOLMGR_DISK_REVECTORING_FAILED: HRESULT = 0xC0380014; +pub const ERROR_VOLMGR_DISK_SECTOR_SIZE_INVALID: HRESULT = 0xC0380015; +pub const ERROR_VOLMGR_DISK_SET_NOT_CONTAINED: HRESULT = 0xC0380016; +pub const ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS: HRESULT = 0xC0380017; +pub const ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES: HRESULT = 0xC0380018; +pub const ERROR_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED: HRESULT = 0xC0380019; +pub const ERROR_VOLMGR_EXTENT_ALREADY_USED: HRESULT = 0xC038001A; +pub const ERROR_VOLMGR_EXTENT_NOT_CONTIGUOUS: HRESULT = 0xC038001B; +pub const ERROR_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION: HRESULT = 0xC038001C; +pub const ERROR_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED: HRESULT = 0xC038001D; +pub const ERROR_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION: HRESULT = 0xC038001E; +pub const ERROR_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH: HRESULT = 0xC038001F; +pub const ERROR_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED: HRESULT = 0xC0380020; +pub const ERROR_VOLMGR_INTERLEAVE_LENGTH_INVALID: HRESULT = 0xC0380021; +pub const ERROR_VOLMGR_MAXIMUM_REGISTERED_USERS: HRESULT = 0xC0380022; +pub const ERROR_VOLMGR_MEMBER_IN_SYNC: HRESULT = 0xC0380023; +pub const ERROR_VOLMGR_MEMBER_INDEX_DUPLICATE: HRESULT = 0xC0380024; +pub const ERROR_VOLMGR_MEMBER_INDEX_INVALID: HRESULT = 0xC0380025; +pub const ERROR_VOLMGR_MEMBER_MISSING: HRESULT = 0xC0380026; +pub const ERROR_VOLMGR_MEMBER_NOT_DETACHED: HRESULT = 0xC0380027; +pub const ERROR_VOLMGR_MEMBER_REGENERATING: HRESULT = 0xC0380028; +pub const ERROR_VOLMGR_ALL_DISKS_FAILED: HRESULT = 0xC0380029; +pub const ERROR_VOLMGR_NO_REGISTERED_USERS: HRESULT = 0xC038002A; +pub const ERROR_VOLMGR_NO_SUCH_USER: HRESULT = 0xC038002B; +pub const ERROR_VOLMGR_NOTIFICATION_RESET: HRESULT = 0xC038002C; +pub const ERROR_VOLMGR_NUMBER_OF_MEMBERS_INVALID: HRESULT = 0xC038002D; +pub const ERROR_VOLMGR_NUMBER_OF_PLEXES_INVALID: HRESULT = 0xC038002E; +pub const ERROR_VOLMGR_PACK_DUPLICATE: HRESULT = 0xC038002F; +pub const ERROR_VOLMGR_PACK_ID_INVALID: HRESULT = 0xC0380030; +pub const ERROR_VOLMGR_PACK_INVALID: HRESULT = 0xC0380031; +pub const ERROR_VOLMGR_PACK_NAME_INVALID: HRESULT = 0xC0380032; +pub const ERROR_VOLMGR_PACK_OFFLINE: HRESULT = 0xC0380033; +pub const ERROR_VOLMGR_PACK_HAS_QUORUM: HRESULT = 0xC0380034; +pub const ERROR_VOLMGR_PACK_WITHOUT_QUORUM: HRESULT = 0xC0380035; +pub const ERROR_VOLMGR_PARTITION_STYLE_INVALID: HRESULT = 0xC0380036; +pub const ERROR_VOLMGR_PARTITION_UPDATE_FAILED: HRESULT = 0xC0380037; +pub const ERROR_VOLMGR_PLEX_IN_SYNC: HRESULT = 0xC0380038; +pub const ERROR_VOLMGR_PLEX_INDEX_DUPLICATE: HRESULT = 0xC0380039; +pub const ERROR_VOLMGR_PLEX_INDEX_INVALID: HRESULT = 0xC038003A; +pub const ERROR_VOLMGR_PLEX_LAST_ACTIVE: HRESULT = 0xC038003B; +pub const ERROR_VOLMGR_PLEX_MISSING: HRESULT = 0xC038003C; +pub const ERROR_VOLMGR_PLEX_REGENERATING: HRESULT = 0xC038003D; +pub const ERROR_VOLMGR_PLEX_TYPE_INVALID: HRESULT = 0xC038003E; +pub const ERROR_VOLMGR_PLEX_NOT_RAID5: HRESULT = 0xC038003F; +pub const ERROR_VOLMGR_PLEX_NOT_SIMPLE: HRESULT = 0xC0380040; +pub const ERROR_VOLMGR_STRUCTURE_SIZE_INVALID: HRESULT = 0xC0380041; +pub const ERROR_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS: HRESULT = 0xC0380042; +pub const ERROR_VOLMGR_TRANSACTION_IN_PROGRESS: HRESULT = 0xC0380043; +pub const ERROR_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE: HRESULT = 0xC0380044; +pub const ERROR_VOLMGR_VOLUME_CONTAINS_MISSING_DISK: HRESULT = 0xC0380045; +pub const ERROR_VOLMGR_VOLUME_ID_INVALID: HRESULT = 0xC0380046; +pub const ERROR_VOLMGR_VOLUME_LENGTH_INVALID: HRESULT = 0xC0380047; +pub const ERROR_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE: HRESULT = 0xC0380048; +pub const ERROR_VOLMGR_VOLUME_NOT_MIRRORED: HRESULT = 0xC0380049; +pub const ERROR_VOLMGR_VOLUME_NOT_RETAINED: HRESULT = 0xC038004A; +pub const ERROR_VOLMGR_VOLUME_OFFLINE: HRESULT = 0xC038004B; +pub const ERROR_VOLMGR_VOLUME_RETAINED: HRESULT = 0xC038004C; +pub const ERROR_VOLMGR_NUMBER_OF_EXTENTS_INVALID: HRESULT = 0xC038004D; +pub const ERROR_VOLMGR_DIFFERENT_SECTOR_SIZE: HRESULT = 0xC038004E; +pub const ERROR_VOLMGR_BAD_BOOT_DISK: HRESULT = 0xC038004F; +pub const ERROR_VOLMGR_PACK_CONFIG_OFFLINE: HRESULT = 0xC0380050; +pub const ERROR_VOLMGR_PACK_CONFIG_ONLINE: HRESULT = 0xC0380051; +pub const ERROR_VOLMGR_NOT_PRIMARY_PACK: HRESULT = 0xC0380052; +pub const ERROR_VOLMGR_PACK_LOG_UPDATE_FAILED: HRESULT = 0xC0380053; +pub const ERROR_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID: HRESULT = 0xC0380054; +pub const ERROR_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID: HRESULT = 0xC0380055; +pub const ERROR_VOLMGR_VOLUME_MIRRORED: HRESULT = 0xC0380056; +pub const ERROR_VOLMGR_PLEX_NOT_SIMPLE_SPANNED: HRESULT = 0xC0380057; +pub const ERROR_VOLMGR_NO_VALID_LOG_COPIES: HRESULT = 0xC0380058; +pub const ERROR_VOLMGR_PRIMARY_PACK_PRESENT: HRESULT = 0xC0380059; +pub const ERROR_VOLMGR_NUMBER_OF_DISKS_INVALID: HRESULT = 0xC038005A; +pub const ERROR_VOLMGR_MIRROR_NOT_SUPPORTED: HRESULT = 0xC038005B; +pub const ERROR_VOLMGR_RAID5_NOT_SUPPORTED: HRESULT = 0xC038005C; +pub const ERROR_BCD_NOT_ALL_ENTRIES_IMPORTED: HRESULT = 0x80390001; +pub const ERROR_BCD_TOO_MANY_ELEMENTS: HRESULT = 0xC0390002; +pub const ERROR_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED: HRESULT = 0x80390003; +pub const ERROR_VHD_DRIVE_FOOTER_MISSING: HRESULT = 0xC03A0001; +pub const ERROR_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH: HRESULT = 0xC03A0002; +pub const ERROR_VHD_DRIVE_FOOTER_CORRUPT: HRESULT = 0xC03A0003; +pub const ERROR_VHD_FORMAT_UNKNOWN: HRESULT = 0xC03A0004; +pub const ERROR_VHD_FORMAT_UNSUPPORTED_VERSION: HRESULT = 0xC03A0005; +pub const ERROR_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH: HRESULT = 0xC03A0006; +pub const ERROR_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION: HRESULT = 0xC03A0007; +pub const ERROR_VHD_SPARSE_HEADER_CORRUPT: HRESULT = 0xC03A0008; +pub const ERROR_VHD_BLOCK_ALLOCATION_FAILURE: HRESULT = 0xC03A0009; +pub const ERROR_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT: HRESULT = 0xC03A000A; +pub const ERROR_VHD_INVALID_BLOCK_SIZE: HRESULT = 0xC03A000B; +pub const ERROR_VHD_BITMAP_MISMATCH: HRESULT = 0xC03A000C; +pub const ERROR_VHD_PARENT_VHD_NOT_FOUND: HRESULT = 0xC03A000D; +pub const ERROR_VHD_CHILD_PARENT_ID_MISMATCH: HRESULT = 0xC03A000E; +pub const ERROR_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH: HRESULT = 0xC03A000F; +pub const ERROR_VHD_METADATA_READ_FAILURE: HRESULT = 0xC03A0010; +pub const ERROR_VHD_METADATA_WRITE_FAILURE: HRESULT = 0xC03A0011; +pub const ERROR_VHD_INVALID_SIZE: HRESULT = 0xC03A0012; +pub const ERROR_VHD_INVALID_FILE_SIZE: HRESULT = 0xC03A0013; +pub const ERROR_VIRTDISK_PROVIDER_NOT_FOUND: HRESULT = 0xC03A0014; +pub const ERROR_VIRTDISK_NOT_VIRTUAL_DISK: HRESULT = 0xC03A0015; +pub const ERROR_VHD_PARENT_VHD_ACCESS_DENIED: HRESULT = 0xC03A0016; +pub const ERROR_VHD_CHILD_PARENT_SIZE_MISMATCH: HRESULT = 0xC03A0017; +pub const ERROR_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: HRESULT = 0xC03A0018; +pub const ERROR_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: HRESULT = 0xC03A0019; +pub const ERROR_VIRTUAL_DISK_LIMITATION: HRESULT = 0xC03A001A; +pub const ERROR_VHD_INVALID_TYPE: HRESULT = 0xC03A001B; +pub const ERROR_VHD_INVALID_STATE: HRESULT = 0xC03A001C; +pub const ERROR_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE: HRESULT = 0xC03A001D; +pub const ERROR_VIRTDISK_DISK_ALREADY_OWNED: HRESULT = 0xC03A001E; +pub const ERROR_VIRTDISK_DISK_ONLINE_AND_WRITABLE: HRESULT = 0xC03A001F; +pub const ERROR_CTLOG_TRACKING_NOT_INITIALIZED: HRESULT = 0xC03A0020; +pub const ERROR_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE: HRESULT = 0xC03A0021; +pub const ERROR_CTLOG_VHD_CHANGED_OFFLINE: HRESULT = 0xC03A0022; +pub const ERROR_CTLOG_INVALID_TRACKING_STATE: HRESULT = 0xC03A0023; +pub const ERROR_CTLOG_INCONSISTENT_TRACKING_FILE: HRESULT = 0xC03A0024; +pub const ERROR_VHD_RESIZE_WOULD_TRUNCATE_DATA: HRESULT = 0xC03A0025; +pub const ERROR_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE: HRESULT = 0xC03A0026; +pub const ERROR_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE: HRESULT = 0xC03A0027; +pub const ERROR_VHD_METADATA_FULL: HRESULT = 0xC03A0028; +pub const ERROR_QUERY_STORAGE_ERROR: HRESULT = 0x803A0001; +pub const SDIAG_E_CANCELLED: HRESULT = 0x803C0100; +pub const SDIAG_E_SCRIPT: HRESULT = 0x803C0101; +pub const SDIAG_E_POWERSHELL: HRESULT = 0x803C0102; +pub const SDIAG_E_MANAGEDHOST: HRESULT = 0x803C0103; +pub const SDIAG_E_NOVERIFIER: HRESULT = 0x803C0104; +pub const SDIAG_S_CANNOTRUN: HRESULT = 0x003C0105; +pub const SDIAG_E_DISABLED: HRESULT = 0x803C0106; +pub const SDIAG_E_TRUST: HRESULT = 0x803C0107; +pub const SDIAG_E_CANNOTRUN: HRESULT = 0x803C0108; +pub const SDIAG_E_VERSION: HRESULT = 0x803C0109; +pub const SDIAG_E_RESOURCE: HRESULT = 0x803C010A; +pub const SDIAG_E_ROOTCAUSE: HRESULT = 0x803C010B; +pub const WPN_E_CHANNEL_CLOSED: HRESULT = 0x803E0100; +pub const WPN_E_CHANNEL_REQUEST_NOT_COMPLETE: HRESULT = 0x803E0101; +pub const WPN_E_INVALID_APP: HRESULT = 0x803E0102; +pub const WPN_E_OUTSTANDING_CHANNEL_REQUEST: HRESULT = 0x803E0103; +pub const WPN_E_DUPLICATE_CHANNEL: HRESULT = 0x803E0104; +pub const WPN_E_PLATFORM_UNAVAILABLE: HRESULT = 0x803E0105; +pub const WPN_E_NOTIFICATION_POSTED: HRESULT = 0x803E0106; +pub const WPN_E_NOTIFICATION_HIDDEN: HRESULT = 0x803E0107; +pub const WPN_E_NOTIFICATION_NOT_POSTED: HRESULT = 0x803E0108; +pub const WPN_E_CLOUD_DISABLED: HRESULT = 0x803E0109; +pub const WPN_E_CLOUD_INCAPABLE: HRESULT = 0x803E0110; +pub const WPN_E_CLOUD_AUTH_UNAVAILABLE: HRESULT = 0x803E011A; +pub const WPN_E_CLOUD_SERVICE_UNAVAILABLE: HRESULT = 0x803E011B; +pub const WPN_E_FAILED_LOCK_SCREEN_UPDATE_INTIALIZATION: HRESULT = 0x803E011C; +pub const WPN_E_NOTIFICATION_DISABLED: HRESULT = 0x803E0111; +pub const WPN_E_NOTIFICATION_INCAPABLE: HRESULT = 0x803E0112; +pub const WPN_E_INTERNET_INCAPABLE: HRESULT = 0x803E0113; +pub const WPN_E_NOTIFICATION_TYPE_DISABLED: HRESULT = 0x803E0114; +pub const WPN_E_NOTIFICATION_SIZE: HRESULT = 0x803E0115; +pub const WPN_E_TAG_SIZE: HRESULT = 0x803E0116; +pub const WPN_E_ACCESS_DENIED: HRESULT = 0x803E0117; +pub const WPN_E_DUPLICATE_REGISTRATION: HRESULT = 0x803E0118; +pub const WPN_E_PUSH_NOTIFICATION_INCAPABLE: HRESULT = 0x803E0119; +pub const WPN_E_DEV_ID_SIZE: HRESULT = 0x803E0120; +pub const WPN_E_TAG_ALPHANUMERIC: HRESULT = 0x803E012A; +pub const WPN_E_INVALID_HTTP_STATUS_CODE: HRESULT = 0x803E012B; +pub const WPN_E_OUT_OF_SESSION: HRESULT = 0x803E0200; +pub const WPN_E_POWER_SAVE: HRESULT = 0x803E0201; +pub const WPN_E_IMAGE_NOT_FOUND_IN_CACHE: HRESULT = 0x803E0202; +pub const WPN_E_ALL_URL_NOT_COMPLETED: HRESULT = 0x803E0203; +pub const WPN_E_INVALID_CLOUD_IMAGE: HRESULT = 0x803E0204; +pub const WPN_E_NOTIFICATION_ID_MATCHED: HRESULT = 0x803E0205; +pub const WPN_E_CALLBACK_ALREADY_REGISTERED: HRESULT = 0x803E0206; +pub const WPN_E_TOAST_NOTIFICATION_DROPPED: HRESULT = 0x803E0207; +pub const WPN_E_STORAGE_LOCKED: HRESULT = 0x803E0208; +pub const E_MBN_CONTEXT_NOT_ACTIVATED: HRESULT = 0x80548201; +pub const E_MBN_BAD_SIM: HRESULT = 0x80548202; +pub const E_MBN_DATA_CLASS_NOT_AVAILABLE: HRESULT = 0x80548203; +pub const E_MBN_INVALID_ACCESS_STRING: HRESULT = 0x80548204; +pub const E_MBN_MAX_ACTIVATED_CONTEXTS: HRESULT = 0x80548205; +pub const E_MBN_PACKET_SVC_DETACHED: HRESULT = 0x80548206; +pub const E_MBN_PROVIDER_NOT_VISIBLE: HRESULT = 0x80548207; +pub const E_MBN_RADIO_POWER_OFF: HRESULT = 0x80548208; +pub const E_MBN_SERVICE_NOT_ACTIVATED: HRESULT = 0x80548209; +pub const E_MBN_SIM_NOT_INSERTED: HRESULT = 0x8054820A; +pub const E_MBN_VOICE_CALL_IN_PROGRESS: HRESULT = 0x8054820B; +pub const E_MBN_INVALID_CACHE: HRESULT = 0x8054820C; +pub const E_MBN_NOT_REGISTERED: HRESULT = 0x8054820D; +pub const E_MBN_PROVIDERS_NOT_FOUND: HRESULT = 0x8054820E; +pub const E_MBN_PIN_NOT_SUPPORTED: HRESULT = 0x8054820F; +pub const E_MBN_PIN_REQUIRED: HRESULT = 0x80548210; +pub const E_MBN_PIN_DISABLED: HRESULT = 0x80548211; +pub const E_MBN_FAILURE: HRESULT = 0x80548212; +pub const E_MBN_INVALID_PROFILE: HRESULT = 0x80548218; +pub const E_MBN_DEFAULT_PROFILE_EXIST: HRESULT = 0x80548219; +pub const E_MBN_SMS_ENCODING_NOT_SUPPORTED: HRESULT = 0x80548220; +pub const E_MBN_SMS_FILTER_NOT_SUPPORTED: HRESULT = 0x80548221; +pub const E_MBN_SMS_INVALID_MEMORY_INDEX: HRESULT = 0x80548222; +pub const E_MBN_SMS_LANG_NOT_SUPPORTED: HRESULT = 0x80548223; +pub const E_MBN_SMS_MEMORY_FAILURE: HRESULT = 0x80548224; +pub const E_MBN_SMS_NETWORK_TIMEOUT: HRESULT = 0x80548225; +pub const E_MBN_SMS_UNKNOWN_SMSC_ADDRESS: HRESULT = 0x80548226; +pub const E_MBN_SMS_FORMAT_NOT_SUPPORTED: HRESULT = 0x80548227; +pub const E_MBN_SMS_OPERATION_NOT_ALLOWED: HRESULT = 0x80548228; +pub const E_MBN_SMS_MEMORY_FULL: HRESULT = 0x80548229; +pub const PEER_E_IPV6_NOT_INSTALLED: HRESULT = 0x80630001; +pub const PEER_E_NOT_INITIALIZED: HRESULT = 0x80630002; +pub const PEER_E_CANNOT_START_SERVICE: HRESULT = 0x80630003; +pub const PEER_E_NOT_LICENSED: HRESULT = 0x80630004; +pub const PEER_E_INVALID_GRAPH: HRESULT = 0x80630010; +pub const PEER_E_DBNAME_CHANGED: HRESULT = 0x80630011; +pub const PEER_E_DUPLICATE_GRAPH: HRESULT = 0x80630012; +pub const PEER_E_GRAPH_NOT_READY: HRESULT = 0x80630013; +pub const PEER_E_GRAPH_SHUTTING_DOWN: HRESULT = 0x80630014; +pub const PEER_E_GRAPH_IN_USE: HRESULT = 0x80630015; +pub const PEER_E_INVALID_DATABASE: HRESULT = 0x80630016; +pub const PEER_E_TOO_MANY_ATTRIBUTES: HRESULT = 0x80630017; +pub const PEER_E_CONNECTION_NOT_FOUND: HRESULT = 0x80630103; +pub const PEER_E_CONNECT_SELF: HRESULT = 0x80630106; +pub const PEER_E_ALREADY_LISTENING: HRESULT = 0x80630107; +pub const PEER_E_NODE_NOT_FOUND: HRESULT = 0x80630108; +pub const PEER_E_CONNECTION_FAILED: HRESULT = 0x80630109; +pub const PEER_E_CONNECTION_NOT_AUTHENTICATED: HRESULT = 0x8063010A; +pub const PEER_E_CONNECTION_REFUSED: HRESULT = 0x8063010B; +pub const PEER_E_CLASSIFIER_TOO_LONG: HRESULT = 0x80630201; +pub const PEER_E_TOO_MANY_IDENTITIES: HRESULT = 0x80630202; +pub const PEER_E_NO_KEY_ACCESS: HRESULT = 0x80630203; +pub const PEER_E_GROUPS_EXIST: HRESULT = 0x80630204; +pub const PEER_E_RECORD_NOT_FOUND: HRESULT = 0x80630301; +pub const PEER_E_DATABASE_ACCESSDENIED: HRESULT = 0x80630302; +pub const PEER_E_DBINITIALIZATION_FAILED: HRESULT = 0x80630303; +pub const PEER_E_MAX_RECORD_SIZE_EXCEEDED: HRESULT = 0x80630304; +pub const PEER_E_DATABASE_ALREADY_PRESENT: HRESULT = 0x80630305; +pub const PEER_E_DATABASE_NOT_PRESENT: HRESULT = 0x80630306; +pub const PEER_E_IDENTITY_NOT_FOUND: HRESULT = 0x80630401; +pub const PEER_E_EVENT_HANDLE_NOT_FOUND: HRESULT = 0x80630501; +pub const PEER_E_INVALID_SEARCH: HRESULT = 0x80630601; +pub const PEER_E_INVALID_ATTRIBUTES: HRESULT = 0x80630602; +pub const PEER_E_INVITATION_NOT_TRUSTED: HRESULT = 0x80630701; +pub const PEER_E_CHAIN_TOO_LONG: HRESULT = 0x80630703; +pub const PEER_E_INVALID_TIME_PERIOD: HRESULT = 0x80630705; +pub const PEER_E_CIRCULAR_CHAIN_DETECTED: HRESULT = 0x80630706; +pub const PEER_E_CERT_STORE_CORRUPTED: HRESULT = 0x80630801; +pub const PEER_E_NO_CLOUD: HRESULT = 0x80631001; +pub const PEER_E_CLOUD_NAME_AMBIGUOUS: HRESULT = 0x80631005; +pub const PEER_E_INVALID_RECORD: HRESULT = 0x80632010; +pub const PEER_E_NOT_AUTHORIZED: HRESULT = 0x80632020; +pub const PEER_E_PASSWORD_DOES_NOT_MEET_POLICY: HRESULT = 0x80632021; +pub const PEER_E_DEFERRED_VALIDATION: HRESULT = 0x80632030; +pub const PEER_E_INVALID_GROUP_PROPERTIES: HRESULT = 0x80632040; +pub const PEER_E_INVALID_PEER_NAME: HRESULT = 0x80632050; +pub const PEER_E_INVALID_CLASSIFIER: HRESULT = 0x80632060; +pub const PEER_E_INVALID_FRIENDLY_NAME: HRESULT = 0x80632070; +pub const PEER_E_INVALID_ROLE_PROPERTY: HRESULT = 0x80632071; +pub const PEER_E_INVALID_CLASSIFIER_PROPERTY: HRESULT = 0x80632072; +pub const PEER_E_INVALID_RECORD_EXPIRATION: HRESULT = 0x80632080; +pub const PEER_E_INVALID_CREDENTIAL_INFO: HRESULT = 0x80632081; +pub const PEER_E_INVALID_CREDENTIAL: HRESULT = 0x80632082; +pub const PEER_E_INVALID_RECORD_SIZE: HRESULT = 0x80632083; +pub const PEER_E_UNSUPPORTED_VERSION: HRESULT = 0x80632090; +pub const PEER_E_GROUP_NOT_READY: HRESULT = 0x80632091; +pub const PEER_E_GROUP_IN_USE: HRESULT = 0x80632092; +pub const PEER_E_INVALID_GROUP: HRESULT = 0x80632093; +pub const PEER_E_NO_MEMBERS_FOUND: HRESULT = 0x80632094; +pub const PEER_E_NO_MEMBER_CONNECTIONS: HRESULT = 0x80632095; +pub const PEER_E_UNABLE_TO_LISTEN: HRESULT = 0x80632096; +pub const PEER_E_IDENTITY_DELETED: HRESULT = 0x806320A0; +pub const PEER_E_SERVICE_NOT_AVAILABLE: HRESULT = 0x806320A1; +pub const PEER_E_CONTACT_NOT_FOUND: HRESULT = 0x80636001; +pub const PEER_S_GRAPH_DATA_CREATED: HRESULT = 0x00630001; +pub const PEER_S_NO_EVENT_DATA: HRESULT = 0x00630002; +pub const PEER_S_ALREADY_CONNECTED: HRESULT = 0x00632000; +pub const PEER_S_SUBSCRIPTION_EXISTS: HRESULT = 0x00636000; +pub const PEER_S_NO_CONNECTIVITY: HRESULT = 0x00630005; +pub const PEER_S_ALREADY_A_MEMBER: HRESULT = 0x00630006; +pub const PEER_E_CANNOT_CONVERT_PEER_NAME: HRESULT = 0x80634001; +pub const PEER_E_INVALID_PEER_HOST_NAME: HRESULT = 0x80634002; +pub const PEER_E_NO_MORE: HRESULT = 0x80634003; +pub const PEER_E_PNRP_DUPLICATE_PEER_NAME: HRESULT = 0x80634005; +pub const PEER_E_INVITE_CANCELLED: HRESULT = 0x80637000; +pub const PEER_E_INVITE_RESPONSE_NOT_AVAILABLE: HRESULT = 0x80637001; +pub const PEER_E_NOT_SIGNED_IN: HRESULT = 0x80637003; +pub const PEER_E_PRIVACY_DECLINED: HRESULT = 0x80637004; +pub const PEER_E_TIMEOUT: HRESULT = 0x80637005; +pub const PEER_E_INVALID_ADDRESS: HRESULT = 0x80637007; +pub const PEER_E_FW_EXCEPTION_DISABLED: HRESULT = 0x80637008; +pub const PEER_E_FW_BLOCKED_BY_POLICY: HRESULT = 0x80637009; +pub const PEER_E_FW_BLOCKED_BY_SHIELDS_UP: HRESULT = 0x8063700A; +pub const PEER_E_FW_DECLINED: HRESULT = 0x8063700B; +pub const UI_E_CREATE_FAILED: HRESULT = 0x802A0001; +pub const UI_E_SHUTDOWN_CALLED: HRESULT = 0x802A0002; +pub const UI_E_ILLEGAL_REENTRANCY: HRESULT = 0x802A0003; +pub const UI_E_OBJECT_SEALED: HRESULT = 0x802A0004; +pub const UI_E_VALUE_NOT_SET: HRESULT = 0x802A0005; +pub const UI_E_VALUE_NOT_DETERMINED: HRESULT = 0x802A0006; +pub const UI_E_INVALID_OUTPUT: HRESULT = 0x802A0007; +pub const UI_E_BOOLEAN_EXPECTED: HRESULT = 0x802A0008; +pub const UI_E_DIFFERENT_OWNER: HRESULT = 0x802A0009; +pub const UI_E_AMBIGUOUS_MATCH: HRESULT = 0x802A000A; +pub const UI_E_FP_OVERFLOW: HRESULT = 0x802A000B; +pub const UI_E_WRONG_THREAD: HRESULT = 0x802A000C; +pub const UI_E_STORYBOARD_ACTIVE: HRESULT = 0x802A0101; +pub const UI_E_STORYBOARD_NOT_PLAYING: HRESULT = 0x802A0102; +pub const UI_E_START_KEYFRAME_AFTER_END: HRESULT = 0x802A0103; +pub const UI_E_END_KEYFRAME_NOT_DETERMINED: HRESULT = 0x802A0104; +pub const UI_E_LOOPS_OVERLAP: HRESULT = 0x802A0105; +pub const UI_E_TRANSITION_ALREADY_USED: HRESULT = 0x802A0106; +pub const UI_E_TRANSITION_NOT_IN_STORYBOARD: HRESULT = 0x802A0107; +pub const UI_E_TRANSITION_ECLIPSED: HRESULT = 0x802A0108; +pub const UI_E_TIME_BEFORE_LAST_UPDATE: HRESULT = 0x802A0109; +pub const UI_E_TIMER_CLIENT_ALREADY_CONNECTED: HRESULT = 0x802A010A; +pub const UI_E_INVALID_DIMENSION: HRESULT = 0x802A010B; +pub const UI_E_PRIMITIVE_OUT_OF_BOUNDS: HRESULT = 0x802A010C; +pub const UI_E_WINDOW_CLOSED: HRESULT = 0x802A0201; +pub const E_BLUETOOTH_ATT_INVALID_HANDLE: HRESULT = 0x80650001; +pub const E_BLUETOOTH_ATT_READ_NOT_PERMITTED: HRESULT = 0x80650002; +pub const E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED: HRESULT = 0x80650003; +pub const E_BLUETOOTH_ATT_INVALID_PDU: HRESULT = 0x80650004; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHENTICATION: HRESULT = 0x80650005; +pub const E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED: HRESULT = 0x80650006; +pub const E_BLUETOOTH_ATT_INVALID_OFFSET: HRESULT = 0x80650007; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHORIZATION: HRESULT = 0x80650008; +pub const E_BLUETOOTH_ATT_PREPARE_QUEUE_FULL: HRESULT = 0x80650009; +pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_FOUND: HRESULT = 0x8065000A; +pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_LONG: HRESULT = 0x8065000B; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE: HRESULT = 0x8065000C; +pub const E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH: HRESULT = 0x8065000D; +pub const E_BLUETOOTH_ATT_UNLIKELY: HRESULT = 0x8065000E; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION: HRESULT = 0x8065000F; +pub const E_BLUETOOTH_ATT_UNSUPPORTED_GROUP_TYPE: HRESULT = 0x80650010; +pub const E_BLUETOOTH_ATT_INSUFFICIENT_RESOURCES: HRESULT = 0x80650011; +pub const E_BLUETOOTH_ATT_UNKNOWN_ERROR: HRESULT = 0x80651000; +pub const E_AUDIO_ENGINE_NODE_NOT_FOUND: HRESULT = 0x80660001; +pub const E_HDAUDIO_EMPTY_CONNECTION_LIST: HRESULT = 0x80660002; +pub const E_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED: HRESULT = 0x80660003; +pub const E_HDAUDIO_NO_LOGICAL_DEVICES_CREATED: HRESULT = 0x80660004; +pub const E_HDAUDIO_NULL_LINKED_LIST_ENTRY: HRESULT = 0x80660005; +pub const ERROR_SPACES_POOL_WAS_DELETED: HRESULT = 0x00E70001; +pub const ERROR_SPACES_RESILIENCY_TYPE_INVALID: HRESULT = 0x80E70003; +pub const ERROR_SPACES_DRIVE_SECTOR_SIZE_INVALID: HRESULT = 0x80E70004; +pub const ERROR_SPACES_DRIVE_REDUNDANCY_INVALID: HRESULT = 0x80E70006; +pub const ERROR_SPACES_NUMBER_OF_DATA_COPIES_INVALID: HRESULT = 0x80E70007; +pub const ERROR_SPACES_PARITY_LAYOUT_INVALID: HRESULT = 0x80E70008; +pub const ERROR_SPACES_INTERLEAVE_LENGTH_INVALID: HRESULT = 0x80E70009; +pub const ERROR_SPACES_NUMBER_OF_COLUMNS_INVALID: HRESULT = 0x80E7000A; +pub const ERROR_SPACES_NOT_ENOUGH_DRIVES: HRESULT = 0x80E7000B; +pub const ERROR_VOLSNAP_BOOTFILE_NOT_VALID: HRESULT = 0x80820001; +pub const ERROR_TIERING_NOT_SUPPORTED_ON_VOLUME: HRESULT = 0x80830001; +pub const ERROR_TIERING_VOLUME_DISMOUNT_IN_PROGRESS: HRESULT = 0x80830002; +pub const ERROR_TIERING_STORAGE_TIER_NOT_FOUND: HRESULT = 0x80830003; +pub const ERROR_TIERING_INVALID_FILE_ID: HRESULT = 0x80830004; +pub const ERROR_TIERING_WRONG_CLUSTER_NODE: HRESULT = 0x80830005; +pub const ERROR_TIERING_ALREADY_PROCESSING: HRESULT = 0x80830006; +pub const ERROR_TIERING_CANNOT_PIN_OBJECT: HRESULT = 0x80830007; +pub const DXGI_STATUS_OCCLUDED: HRESULT = 0x087A0001; +pub const DXGI_STATUS_CLIPPED: HRESULT = 0x087A0002; +pub const DXGI_STATUS_NO_REDIRECTION: HRESULT = 0x087A0004; +pub const DXGI_STATUS_NO_DESKTOP_ACCESS: HRESULT = 0x087A0005; +pub const DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0x087A0006; +pub const DXGI_STATUS_MODE_CHANGED: HRESULT = 0x087A0007; +pub const DXGI_STATUS_MODE_CHANGE_IN_PROGRESS: HRESULT = 0x087A0008; +pub const DXGI_ERROR_INVALID_CALL: HRESULT = 0x887A0001; +pub const DXGI_ERROR_NOT_FOUND: HRESULT = 0x887A0002; +pub const DXGI_ERROR_MORE_DATA: HRESULT = 0x887A0003; +pub const DXGI_ERROR_UNSUPPORTED: HRESULT = 0x887A0004; +pub const DXGI_ERROR_DEVICE_REMOVED: HRESULT = 0x887A0005; +pub const DXGI_ERROR_DEVICE_HUNG: HRESULT = 0x887A0006; +pub const DXGI_ERROR_DEVICE_RESET: HRESULT = 0x887A0007; +pub const DXGI_ERROR_WAS_STILL_DRAWING: HRESULT = 0x887A000A; +pub const DXGI_ERROR_FRAME_STATISTICS_DISJOINT: HRESULT = 0x887A000B; +pub const DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0x887A000C; +pub const DXGI_ERROR_DRIVER_INTERNAL_ERROR: HRESULT = 0x887A0020; +pub const DXGI_ERROR_NONEXCLUSIVE: HRESULT = 0x887A0021; +pub const DXGI_ERROR_NOT_CURRENTLY_AVAILABLE: HRESULT = 0x887A0022; +pub const DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED: HRESULT = 0x887A0023; +pub const DXGI_ERROR_REMOTE_OUTOFMEMORY: HRESULT = 0x887A0024; +pub const DXGI_ERROR_ACCESS_LOST: HRESULT = 0x887A0026; +pub const DXGI_ERROR_WAIT_TIMEOUT: HRESULT = 0x887A0027; +pub const DXGI_ERROR_SESSION_DISCONNECTED: HRESULT = 0x887A0028; +pub const DXGI_ERROR_RESTRICT_TO_OUTPUT_STALE: HRESULT = 0x887A0029; +pub const DXGI_ERROR_CANNOT_PROTECT_CONTENT: HRESULT = 0x887A002A; +pub const DXGI_ERROR_ACCESS_DENIED: HRESULT = 0x887A002B; +pub const DXGI_ERROR_NAME_ALREADY_EXISTS: HRESULT = 0x887A002C; +pub const DXGI_ERROR_SDK_COMPONENT_MISSING: HRESULT = 0x887A002D; +pub const DXGI_STATUS_UNOCCLUDED: HRESULT = 0x087A0009; +pub const DXGI_STATUS_DDA_WAS_STILL_DRAWING: HRESULT = 0x087A000A; +pub const DXGI_ERROR_MODE_CHANGE_IN_PROGRESS: HRESULT = 0x887A0025; +pub const DXGI_DDI_ERR_WASSTILLDRAWING: HRESULT = 0x887B0001; +pub const DXGI_DDI_ERR_UNSUPPORTED: HRESULT = 0x887B0002; +pub const DXGI_DDI_ERR_NONEXCLUSIVE: HRESULT = 0x887B0003; +pub const D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: HRESULT = 0x88790001; +pub const D3D10_ERROR_FILE_NOT_FOUND: HRESULT = 0x88790002; +pub const D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: HRESULT = 0x887C0001; +pub const D3D11_ERROR_FILE_NOT_FOUND: HRESULT = 0x887C0002; +pub const D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS: HRESULT = 0x887C0003; +pub const D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD: HRESULT + = 0x887C0004; +pub const D2DERR_WRONG_STATE: HRESULT = 0x88990001; +pub const D2DERR_NOT_INITIALIZED: HRESULT = 0x88990002; +pub const D2DERR_UNSUPPORTED_OPERATION: HRESULT = 0x88990003; +pub const D2DERR_SCANNER_FAILED: HRESULT = 0x88990004; +pub const D2DERR_SCREEN_ACCESS_DENIED: HRESULT = 0x88990005; +pub const D2DERR_DISPLAY_STATE_INVALID: HRESULT = 0x88990006; +pub const D2DERR_ZERO_VECTOR: HRESULT = 0x88990007; +pub const D2DERR_INTERNAL_ERROR: HRESULT = 0x88990008; +pub const D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED: HRESULT = 0x88990009; +pub const D2DERR_INVALID_CALL: HRESULT = 0x8899000A; +pub const D2DERR_NO_HARDWARE_DEVICE: HRESULT = 0x8899000B; +pub const D2DERR_RECREATE_TARGET: HRESULT = 0x8899000C; +pub const D2DERR_TOO_MANY_SHADER_ELEMENTS: HRESULT = 0x8899000D; +pub const D2DERR_SHADER_COMPILE_FAILED: HRESULT = 0x8899000E; +pub const D2DERR_MAX_TEXTURE_SIZE_EXCEEDED: HRESULT = 0x8899000F; +pub const D2DERR_UNSUPPORTED_VERSION: HRESULT = 0x88990010; +pub const D2DERR_BAD_NUMBER: HRESULT = 0x88990011; +pub const D2DERR_WRONG_FACTORY: HRESULT = 0x88990012; +pub const D2DERR_LAYER_ALREADY_IN_USE: HRESULT = 0x88990013; +pub const D2DERR_POP_CALL_DID_NOT_MATCH_PUSH: HRESULT = 0x88990014; +pub const D2DERR_WRONG_RESOURCE_DOMAIN: HRESULT = 0x88990015; +pub const D2DERR_PUSH_POP_UNBALANCED: HRESULT = 0x88990016; +pub const D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT: HRESULT = 0x88990017; +pub const D2DERR_INCOMPATIBLE_BRUSH_TYPES: HRESULT = 0x88990018; +pub const D2DERR_WIN32_ERROR: HRESULT = 0x88990019; +pub const D2DERR_TARGET_NOT_GDI_COMPATIBLE: HRESULT = 0x8899001A; +pub const D2DERR_TEXT_EFFECT_IS_WRONG_TYPE: HRESULT = 0x8899001B; +pub const D2DERR_TEXT_RENDERER_NOT_RELEASED: HRESULT = 0x8899001C; +pub const D2DERR_EXCEEDS_MAX_BITMAP_SIZE: HRESULT = 0x8899001D; +pub const D2DERR_INVALID_GRAPH_CONFIGURATION: HRESULT = 0x8899001E; +pub const D2DERR_INVALID_INTERNAL_GRAPH_CONFIGURATION: HRESULT = 0x8899001F; +pub const D2DERR_CYCLIC_GRAPH: HRESULT = 0x88990020; +pub const D2DERR_BITMAP_CANNOT_DRAW: HRESULT = 0x88990021; +pub const D2DERR_OUTSTANDING_BITMAP_REFERENCES: HRESULT = 0x88990022; +pub const D2DERR_ORIGINAL_TARGET_NOT_BOUND: HRESULT = 0x88990023; +pub const D2DERR_INVALID_TARGET: HRESULT = 0x88990024; +pub const D2DERR_BITMAP_BOUND_AS_TARGET: HRESULT = 0x88990025; +pub const D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES: HRESULT = 0x88990026; +pub const D2DERR_INTERMEDIATE_TOO_LARGE: HRESULT = 0x88990027; +pub const D2DERR_EFFECT_IS_NOT_REGISTERED: HRESULT = 0x88990028; +pub const D2DERR_INVALID_PROPERTY: HRESULT = 0x88990029; +pub const D2DERR_NO_SUBPROPERTIES: HRESULT = 0x8899002A; +pub const D2DERR_PRINT_JOB_CLOSED: HRESULT = 0x8899002B; +pub const D2DERR_PRINT_FORMAT_NOT_SUPPORTED: HRESULT = 0x8899002C; +pub const D2DERR_TOO_MANY_TRANSFORM_INPUTS: HRESULT = 0x8899002D; +pub const DWRITE_E_FILEFORMAT: HRESULT = 0x88985000; +pub const DWRITE_E_UNEXPECTED: HRESULT = 0x88985001; +pub const DWRITE_E_NOFONT: HRESULT = 0x88985002; +pub const DWRITE_E_FILENOTFOUND: HRESULT = 0x88985003; +pub const DWRITE_E_FILEACCESS: HRESULT = 0x88985004; +pub const DWRITE_E_FONTCOLLECTIONOBSOLETE: HRESULT = 0x88985005; +pub const DWRITE_E_ALREADYREGISTERED: HRESULT = 0x88985006; +pub const DWRITE_E_CACHEFORMAT: HRESULT = 0x88985007; +pub const DWRITE_E_CACHEVERSION: HRESULT = 0x88985008; +pub const DWRITE_E_UNSUPPORTEDOPERATION: HRESULT = 0x88985009; +pub const DWRITE_E_TEXTRENDERERINCOMPATIBLE: HRESULT = 0x8898500A; +pub const DWRITE_E_FLOWDIRECTIONCONFLICTS: HRESULT = 0x8898500B; +pub const DWRITE_E_NOCOLOR: HRESULT = 0x8898500C; +pub const WINCODEC_ERR_WRONGSTATE: HRESULT = 0x88982F04; +pub const WINCODEC_ERR_VALUEOUTOFRANGE: HRESULT = 0x88982F05; +pub const WINCODEC_ERR_UNKNOWNIMAGEFORMAT: HRESULT = 0x88982F07; +pub const WINCODEC_ERR_UNSUPPORTEDVERSION: HRESULT = 0x88982F0B; +pub const WINCODEC_ERR_NOTINITIALIZED: HRESULT = 0x88982F0C; +pub const WINCODEC_ERR_ALREADYLOCKED: HRESULT = 0x88982F0D; +pub const WINCODEC_ERR_PROPERTYNOTFOUND: HRESULT = 0x88982F40; +pub const WINCODEC_ERR_PROPERTYNOTSUPPORTED: HRESULT = 0x88982F41; +pub const WINCODEC_ERR_PROPERTYSIZE: HRESULT = 0x88982F42; +pub const WINCODEC_ERR_CODECPRESENT: HRESULT = 0x88982F43; +pub const WINCODEC_ERR_CODECNOTHUMBNAIL: HRESULT = 0x88982F44; +pub const WINCODEC_ERR_PALETTEUNAVAILABLE: HRESULT = 0x88982F45; +pub const WINCODEC_ERR_CODECTOOMANYSCANLINES: HRESULT = 0x88982F46; +pub const WINCODEC_ERR_INTERNALERROR: HRESULT = 0x88982F48; +pub const WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS: HRESULT = 0x88982F49; +pub const WINCODEC_ERR_COMPONENTNOTFOUND: HRESULT = 0x88982F50; +pub const WINCODEC_ERR_IMAGESIZEOUTOFRANGE: HRESULT = 0x88982F51; +pub const WINCODEC_ERR_TOOMUCHMETADATA: HRESULT = 0x88982F52; +pub const WINCODEC_ERR_BADIMAGE: HRESULT = 0x88982F60; +pub const WINCODEC_ERR_BADHEADER: HRESULT = 0x88982F61; +pub const WINCODEC_ERR_FRAMEMISSING: HRESULT = 0x88982F62; +pub const WINCODEC_ERR_BADMETADATAHEADER: HRESULT = 0x88982F63; +pub const WINCODEC_ERR_BADSTREAMDATA: HRESULT = 0x88982F70; +pub const WINCODEC_ERR_STREAMWRITE: HRESULT = 0x88982F71; +pub const WINCODEC_ERR_STREAMREAD: HRESULT = 0x88982F72; +pub const WINCODEC_ERR_STREAMNOTAVAILABLE: HRESULT = 0x88982F73; +pub const WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT: HRESULT = 0x88982F80; +pub const WINCODEC_ERR_UNSUPPORTEDOPERATION: HRESULT = 0x88982F81; +pub const WINCODEC_ERR_INVALIDREGISTRATION: HRESULT = 0x88982F8A; +pub const WINCODEC_ERR_COMPONENTINITIALIZEFAILURE: HRESULT = 0x88982F8B; +pub const WINCODEC_ERR_INSUFFICIENTBUFFER: HRESULT = 0x88982F8C; +pub const WINCODEC_ERR_DUPLICATEMETADATAPRESENT: HRESULT = 0x88982F8D; +pub const WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE: HRESULT = 0x88982F8E; +pub const WINCODEC_ERR_UNEXPECTEDSIZE: HRESULT = 0x88982F8F; +pub const WINCODEC_ERR_INVALIDQUERYREQUEST: HRESULT = 0x88982F90; +pub const WINCODEC_ERR_UNEXPECTEDMETADATATYPE: HRESULT = 0x88982F91; +pub const WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT: HRESULT = 0x88982F92; +pub const WINCODEC_ERR_INVALIDQUERYCHARACTER: HRESULT = 0x88982F93; +pub const WINCODEC_ERR_WIN32ERROR: HRESULT = 0x88982F94; +pub const WINCODEC_ERR_INVALIDPROGRESSIVELEVEL: HRESULT = 0x88982F95; +pub const MILERR_OBJECTBUSY: HRESULT = 0x88980001; +pub const MILERR_INSUFFICIENTBUFFER: HRESULT = 0x88980002; +pub const MILERR_WIN32ERROR: HRESULT = 0x88980003; +pub const MILERR_SCANNER_FAILED: HRESULT = 0x88980004; +pub const MILERR_SCREENACCESSDENIED: HRESULT = 0x88980005; +pub const MILERR_DISPLAYSTATEINVALID: HRESULT = 0x88980006; +pub const MILERR_NONINVERTIBLEMATRIX: HRESULT = 0x88980007; +pub const MILERR_ZEROVECTOR: HRESULT = 0x88980008; +pub const MILERR_TERMINATED: HRESULT = 0x88980009; +pub const MILERR_BADNUMBER: HRESULT = 0x8898000A; +pub const MILERR_INTERNALERROR: HRESULT = 0x88980080; +pub const MILERR_DISPLAYFORMATNOTSUPPORTED: HRESULT = 0x88980084; +pub const MILERR_INVALIDCALL: HRESULT = 0x88980085; +pub const MILERR_ALREADYLOCKED: HRESULT = 0x88980086; +pub const MILERR_NOTLOCKED: HRESULT = 0x88980087; +pub const MILERR_DEVICECANNOTRENDERTEXT: HRESULT = 0x88980088; +pub const MILERR_GLYPHBITMAPMISSED: HRESULT = 0x88980089; +pub const MILERR_MALFORMEDGLYPHCACHE: HRESULT = 0x8898008A; +pub const MILERR_GENERIC_IGNORE: HRESULT = 0x8898008B; +pub const MILERR_MALFORMED_GUIDELINE_DATA: HRESULT = 0x8898008C; +pub const MILERR_NO_HARDWARE_DEVICE: HRESULT = 0x8898008D; +pub const MILERR_NEED_RECREATE_AND_PRESENT: HRESULT = 0x8898008E; +pub const MILERR_ALREADY_INITIALIZED: HRESULT = 0x8898008F; +pub const MILERR_MISMATCHED_SIZE: HRESULT = 0x88980090; +pub const MILERR_NO_REDIRECTION_SURFACE_AVAILABLE: HRESULT = 0x88980091; +pub const MILERR_REMOTING_NOT_SUPPORTED: HRESULT = 0x88980092; +pub const MILERR_QUEUED_PRESENT_NOT_SUPPORTED: HRESULT = 0x88980093; +pub const MILERR_NOT_QUEUING_PRESENTS: HRESULT = 0x88980094; +pub const MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER: HRESULT = 0x88980095; +pub const MILERR_TOOMANYSHADERELEMNTS: HRESULT = 0x88980096; +pub const MILERR_MROW_READLOCK_FAILED: HRESULT = 0x88980097; +pub const MILERR_MROW_UPDATE_FAILED: HRESULT = 0x88980098; +pub const MILERR_SHADER_COMPILE_FAILED: HRESULT = 0x88980099; +pub const MILERR_MAX_TEXTURE_SIZE_EXCEEDED: HRESULT = 0x8898009A; +pub const MILERR_QPC_TIME_WENT_BACKWARD: HRESULT = 0x8898009B; +pub const MILERR_DXGI_ENUMERATION_OUT_OF_SYNC: HRESULT = 0x8898009D; +pub const MILERR_ADAPTER_NOT_FOUND: HRESULT = 0x8898009E; +pub const MILERR_COLORSPACE_NOT_SUPPORTED: HRESULT = 0x8898009F; +pub const MILERR_PREFILTER_NOT_SUPPORTED: HRESULT = 0x889800A0; +pub const MILERR_DISPLAYID_ACCESS_DENIED: HRESULT = 0x889800A1; +pub const UCEERR_INVALIDPACKETHEADER: HRESULT = 0x88980400; +pub const UCEERR_UNKNOWNPACKET: HRESULT = 0x88980401; +pub const UCEERR_ILLEGALPACKET: HRESULT = 0x88980402; +pub const UCEERR_MALFORMEDPACKET: HRESULT = 0x88980403; +pub const UCEERR_ILLEGALHANDLE: HRESULT = 0x88980404; +pub const UCEERR_HANDLELOOKUPFAILED: HRESULT = 0x88980405; +pub const UCEERR_RENDERTHREADFAILURE: HRESULT = 0x88980406; +pub const UCEERR_CTXSTACKFRSTTARGETNULL: HRESULT = 0x88980407; +pub const UCEERR_CONNECTIONIDLOOKUPFAILED: HRESULT = 0x88980408; +pub const UCEERR_BLOCKSFULL: HRESULT = 0x88980409; +pub const UCEERR_MEMORYFAILURE: HRESULT = 0x8898040A; +pub const UCEERR_PACKETRECORDOUTOFRANGE: HRESULT = 0x8898040B; +pub const UCEERR_ILLEGALRECORDTYPE: HRESULT = 0x8898040C; +pub const UCEERR_OUTOFHANDLES: HRESULT = 0x8898040D; +pub const UCEERR_UNCHANGABLE_UPDATE_ATTEMPTED: HRESULT = 0x8898040E; +pub const UCEERR_NO_MULTIPLE_WORKER_THREADS: HRESULT = 0x8898040F; +pub const UCEERR_REMOTINGNOTSUPPORTED: HRESULT = 0x88980410; +pub const UCEERR_MISSINGENDCOMMAND: HRESULT = 0x88980411; +pub const UCEERR_MISSINGBEGINCOMMAND: HRESULT = 0x88980412; +pub const UCEERR_CHANNELSYNCTIMEDOUT: HRESULT = 0x88980413; +pub const UCEERR_CHANNELSYNCABANDONED: HRESULT = 0x88980414; +pub const UCEERR_UNSUPPORTEDTRANSPORTVERSION: HRESULT = 0x88980415; +pub const UCEERR_TRANSPORTUNAVAILABLE: HRESULT = 0x88980416; +pub const UCEERR_FEEDBACK_UNSUPPORTED: HRESULT = 0x88980417; +pub const UCEERR_COMMANDTRANSPORTDENIED: HRESULT = 0x88980418; +pub const UCEERR_GRAPHICSSTREAMUNAVAILABLE: HRESULT = 0x88980419; +pub const UCEERR_GRAPHICSSTREAMALREADYOPEN: HRESULT = 0x88980420; +pub const UCEERR_TRANSPORTDISCONNECTED: HRESULT = 0x88980421; +pub const UCEERR_TRANSPORTOVERLOADED: HRESULT = 0x88980422; +pub const UCEERR_PARTITION_ZOMBIED: HRESULT = 0x88980423; +pub const MILAVERR_NOCLOCK: HRESULT = 0x88980500; +pub const MILAVERR_NOMEDIATYPE: HRESULT = 0x88980501; +pub const MILAVERR_NOVIDEOMIXER: HRESULT = 0x88980502; +pub const MILAVERR_NOVIDEOPRESENTER: HRESULT = 0x88980503; +pub const MILAVERR_NOREADYFRAMES: HRESULT = 0x88980504; +pub const MILAVERR_MODULENOTLOADED: HRESULT = 0x88980505; +pub const MILAVERR_WMPFACTORYNOTREGISTERED: HRESULT = 0x88980506; +pub const MILAVERR_INVALIDWMPVERSION: HRESULT = 0x88980507; +pub const MILAVERR_INSUFFICIENTVIDEORESOURCES: HRESULT = 0x88980508; +pub const MILAVERR_VIDEOACCELERATIONNOTAVAILABLE: HRESULT = 0x88980509; +pub const MILAVERR_REQUESTEDTEXTURETOOBIG: HRESULT = 0x8898050A; +pub const MILAVERR_SEEKFAILED: HRESULT = 0x8898050B; +pub const MILAVERR_UNEXPECTEDWMPFAILURE: HRESULT = 0x8898050C; +pub const MILAVERR_MEDIAPLAYERCLOSED: HRESULT = 0x8898050D; +pub const MILAVERR_UNKNOWNHARDWAREERROR: HRESULT = 0x8898050E; +pub const MILEFFECTSERR_UNKNOWNPROPERTY: HRESULT = 0x8898060E; +pub const MILEFFECTSERR_EFFECTNOTPARTOFGROUP: HRESULT = 0x8898060F; +pub const MILEFFECTSERR_NOINPUTSOURCEATTACHED: HRESULT = 0x88980610; +pub const MILEFFECTSERR_CONNECTORNOTCONNECTED: HRESULT = 0x88980611; +pub const MILEFFECTSERR_CONNECTORNOTASSOCIATEDWITHEFFECT: HRESULT = 0x88980612; +pub const MILEFFECTSERR_RESERVED: HRESULT = 0x88980613; +pub const MILEFFECTSERR_CYCLEDETECTED: HRESULT = 0x88980614; +pub const MILEFFECTSERR_EFFECTINMORETHANONEGRAPH: HRESULT = 0x88980615; +pub const MILEFFECTSERR_EFFECTALREADYINAGRAPH: HRESULT = 0x88980616; +pub const MILEFFECTSERR_EFFECTHASNOCHILDREN: HRESULT = 0x88980617; +pub const MILEFFECTSERR_ALREADYATTACHEDTOLISTENER: HRESULT = 0x88980618; +pub const MILEFFECTSERR_NOTAFFINETRANSFORM: HRESULT = 0x88980619; +pub const MILEFFECTSERR_EMPTYBOUNDS: HRESULT = 0x8898061A; +pub const MILEFFECTSERR_OUTPUTSIZETOOLARGE: HRESULT = 0x8898061B; +pub const DWMERR_STATE_TRANSITION_FAILED: HRESULT = 0x88980700; +pub const DWMERR_THEME_FAILED: HRESULT = 0x88980701; +pub const DWMERR_CATASTROPHIC_FAILURE: HRESULT = 0x88980702; +pub const DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED: HRESULT = 0x88980800; +pub const DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED: HRESULT = 0x88980801; +pub const DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED: HRESULT = 0x88980802; +pub const ONL_E_INVALID_AUTHENTICATION_TARGET: HRESULT = 0x80860001; +pub const ONL_E_ACCESS_DENIED_BY_TOU: HRESULT = 0x80860002; +pub const ONL_E_INVALID_APPLICATION: HRESULT = 0x80860003; +pub const ONL_E_PASSWORD_UPDATE_REQUIRED: HRESULT = 0x80860004; +pub const ONL_E_ACCOUNT_UPDATE_REQUIRED: HRESULT = 0x80860005; +pub const ONL_E_FORCESIGNIN: HRESULT = 0x80860006; +pub const ONL_E_ACCOUNT_LOCKED: HRESULT = 0x80860007; +pub const ONL_E_PARENTAL_CONSENT_REQUIRED: HRESULT = 0x80860008; +pub const ONL_E_EMAIL_VERIFICATION_REQUIRED: HRESULT = 0x80860009; +pub const ONL_E_ACCOUNT_SUSPENDED_COMPROIMISE: HRESULT = 0x8086000A; +pub const ONL_E_ACCOUNT_SUSPENDED_ABUSE: HRESULT = 0x8086000B; +pub const ONL_E_ACTION_REQUIRED: HRESULT = 0x8086000C; +pub const ONL_CONNECTION_COUNT_LIMIT: HRESULT = 0x8086000D; +pub const ONL_E_CONNECTED_ACCOUNT_CAN_NOT_SIGNOUT: HRESULT = 0x8086000E; +pub const ONL_E_USER_AUTHENTICATION_REQUIRED: HRESULT = 0x8086000F; +pub const ONL_E_REQUEST_THROTTLED: HRESULT = 0x80860010; +pub const FA_E_MAX_PERSISTED_ITEMS_REACHED: HRESULT = 0x80270220; +pub const FA_E_HOMEGROUP_NOT_AVAILABLE: HRESULT = 0x80270222; +pub const E_MONITOR_RESOLUTION_TOO_LOW: HRESULT = 0x80270250; +pub const E_ELEVATED_ACTIVATION_NOT_SUPPORTED: HRESULT = 0x80270251; +pub const E_UAC_DISABLED: HRESULT = 0x80270252; +pub const E_FULL_ADMIN_NOT_SUPPORTED: HRESULT = 0x80270253; +pub const E_APPLICATION_NOT_REGISTERED: HRESULT = 0x80270254; +pub const E_MULTIPLE_EXTENSIONS_FOR_APPLICATION: HRESULT = 0x80270255; +pub const E_MULTIPLE_PACKAGES_FOR_FAMILY: HRESULT = 0x80270256; +pub const E_APPLICATION_MANAGER_NOT_RUNNING: HRESULT = 0x80270257; +pub const S_STORE_LAUNCHED_FOR_REMEDIATION: HRESULT = 0x00270258; +pub const S_APPLICATION_ACTIVATION_ERROR_HANDLED_BY_DIALOG: HRESULT = 0x00270259; +pub const E_APPLICATION_ACTIVATION_TIMED_OUT: HRESULT = 0x8027025A; +pub const E_APPLICATION_ACTIVATION_EXEC_FAILURE: HRESULT = 0x8027025B; +pub const E_APPLICATION_TEMPORARY_LICENSE_ERROR: HRESULT = 0x8027025C; +pub const E_APPLICATION_TRIAL_LICENSE_EXPIRED: HRESULT = 0x8027025D; +pub const E_SKYDRIVE_ROOT_TARGET_FILE_SYSTEM_NOT_SUPPORTED: HRESULT = 0x80270260; +pub const E_SKYDRIVE_ROOT_TARGET_OVERLAP: HRESULT = 0x80270261; +pub const E_SKYDRIVE_ROOT_TARGET_CANNOT_INDEX: HRESULT = 0x80270262; +pub const E_SKYDRIVE_FILE_NOT_UPLOADED: HRESULT = 0x80270263; +pub const E_SKYDRIVE_UPDATE_AVAILABILITY_FAIL: HRESULT = 0x80270264; +pub const E_SKYDRIVE_ROOT_TARGET_VOLUME_ROOT_NOT_SUPPORTED: HRESULT = 0x80270265; +pub const E_SYNCENGINE_FILE_SIZE_OVER_LIMIT: HRESULT = 0x8802B001; +pub const E_SYNCENGINE_FILE_SIZE_EXCEEDS_REMAINING_QUOTA: HRESULT = 0x8802B002; +pub const E_SYNCENGINE_UNSUPPORTED_FILE_NAME: HRESULT = 0x8802B003; +pub const E_SYNCENGINE_FOLDER_ITEM_COUNT_LIMIT_EXCEEDED: HRESULT = 0x8802B004; +pub const E_SYNCENGINE_FILE_SYNC_PARTNER_ERROR: HRESULT = 0x8802B005; +pub const E_SYNCENGINE_SYNC_PAUSED_BY_SERVICE: HRESULT = 0x8802B006; +pub const E_SYNCENGINE_FILE_IDENTIFIER_UNKNOWN: HRESULT = 0x8802C002; +pub const E_SYNCENGINE_SERVICE_AUTHENTICATION_FAILED: HRESULT = 0x8802C003; +pub const E_SYNCENGINE_UNKNOWN_SERVICE_ERROR: HRESULT = 0x8802C004; +pub const E_SYNCENGINE_SERVICE_RETURNED_UNEXPECTED_SIZE: HRESULT = 0x8802C005; +pub const E_SYNCENGINE_REQUEST_BLOCKED_BY_SERVICE: HRESULT = 0x8802C006; +pub const E_SYNCENGINE_REQUEST_BLOCKED_DUE_TO_CLIENT_ERROR: HRESULT = 0x8802C007; +pub const E_SYNCENGINE_FOLDER_INACCESSIBLE: HRESULT = 0x8802D001; +pub const E_SYNCENGINE_UNSUPPORTED_FOLDER_NAME: HRESULT = 0x8802D002; +pub const E_SYNCENGINE_UNSUPPORTED_MARKET: HRESULT = 0x8802D003; +pub const E_SYNCENGINE_PATH_LENGTH_LIMIT_EXCEEDED: HRESULT = 0x8802D004; +pub const E_SYNCENGINE_REMOTE_PATH_LENGTH_LIMIT_EXCEEDED: HRESULT = 0x8802D005; +pub const E_SYNCENGINE_CLIENT_UPDATE_NEEDED: HRESULT = 0x8802D006; +pub const E_SYNCENGINE_PROXY_AUTHENTICATION_REQUIRED: HRESULT = 0x8802D007; +pub const E_SYNCENGINE_STORAGE_SERVICE_PROVISIONING_FAILED: HRESULT = 0x8802D008; +pub const E_SYNCENGINE_UNSUPPORTED_REPARSE_POINT: HRESULT = 0x8802D009; +pub const E_SYNCENGINE_STORAGE_SERVICE_BLOCKED: HRESULT = 0x8802D00A; +pub const E_SYNCENGINE_FOLDER_IN_REDIRECTION: HRESULT = 0x8802D00B; +pub const EAS_E_POLICY_NOT_MANAGED_BY_OS: HRESULT = 0x80550001; +pub const EAS_E_POLICY_COMPLIANT_WITH_ACTIONS: HRESULT = 0x80550002; +pub const EAS_E_REQUESTED_POLICY_NOT_ENFORCEABLE: HRESULT = 0x80550003; +pub const EAS_E_CURRENT_USER_HAS_BLANK_PASSWORD: HRESULT = 0x80550004; +pub const EAS_E_REQUESTED_POLICY_PASSWORD_EXPIRATION_INCOMPATIBLE: HRESULT + = 0x80550005; +pub const EAS_E_USER_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550006; +pub const EAS_E_ADMINS_HAVE_BLANK_PASSWORD: HRESULT = 0x80550007; +pub const EAS_E_ADMINS_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550008; +pub const EAS_E_LOCAL_CONTROLLED_USERS_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550009; +pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CONNECTED_ADMINS: HRESULT + = 0x8055000A; +pub const EAS_E_CONNECTED_ADMINS_NEED_TO_CHANGE_PASSWORD: HRESULT = 0x8055000B; +pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CURRENT_CONNECTED_USER: HRESULT + = 0x8055000C; +pub const EAS_E_CURRENT_CONNECTED_USER_NEED_TO_CHANGE_PASSWORD: HRESULT = 0x8055000D; +pub const WEB_E_UNSUPPORTED_FORMAT: HRESULT = 0x83750001; +pub const WEB_E_INVALID_XML: HRESULT = 0x83750002; +pub const WEB_E_MISSING_REQUIRED_ELEMENT: HRESULT = 0x83750003; +pub const WEB_E_MISSING_REQUIRED_ATTRIBUTE: HRESULT = 0x83750004; +pub const WEB_E_UNEXPECTED_CONTENT: HRESULT = 0x83750005; +pub const WEB_E_RESOURCE_TOO_LARGE: HRESULT = 0x83750006; +pub const WEB_E_INVALID_JSON_STRING: HRESULT = 0x83750007; +pub const WEB_E_INVALID_JSON_NUMBER: HRESULT = 0x83750008; +pub const WEB_E_JSON_VALUE_NOT_FOUND: HRESULT = 0x83750009; +pub const HTTP_E_STATUS_UNEXPECTED: HRESULT = 0x80190001; +pub const HTTP_E_STATUS_UNEXPECTED_REDIRECTION: HRESULT = 0x80190003; +pub const HTTP_E_STATUS_UNEXPECTED_CLIENT_ERROR: HRESULT = 0x80190004; +pub const HTTP_E_STATUS_UNEXPECTED_SERVER_ERROR: HRESULT = 0x80190005; +pub const HTTP_E_STATUS_AMBIGUOUS: HRESULT = 0x8019012C; +pub const HTTP_E_STATUS_MOVED: HRESULT = 0x8019012D; +pub const HTTP_E_STATUS_REDIRECT: HRESULT = 0x8019012E; +pub const HTTP_E_STATUS_REDIRECT_METHOD: HRESULT = 0x8019012F; +pub const HTTP_E_STATUS_NOT_MODIFIED: HRESULT = 0x80190130; +pub const HTTP_E_STATUS_USE_PROXY: HRESULT = 0x80190131; +pub const HTTP_E_STATUS_REDIRECT_KEEP_VERB: HRESULT = 0x80190133; +pub const HTTP_E_STATUS_BAD_REQUEST: HRESULT = 0x80190190; +pub const HTTP_E_STATUS_DENIED: HRESULT = 0x80190191; +pub const HTTP_E_STATUS_PAYMENT_REQ: HRESULT = 0x80190192; +pub const HTTP_E_STATUS_FORBIDDEN: HRESULT = 0x80190193; +pub const HTTP_E_STATUS_NOT_FOUND: HRESULT = 0x80190194; +pub const HTTP_E_STATUS_BAD_METHOD: HRESULT = 0x80190195; +pub const HTTP_E_STATUS_NONE_ACCEPTABLE: HRESULT = 0x80190196; +pub const HTTP_E_STATUS_PROXY_AUTH_REQ: HRESULT = 0x80190197; +pub const HTTP_E_STATUS_REQUEST_TIMEOUT: HRESULT = 0x80190198; +pub const HTTP_E_STATUS_CONFLICT: HRESULT = 0x80190199; +pub const HTTP_E_STATUS_GONE: HRESULT = 0x8019019A; +pub const HTTP_E_STATUS_LENGTH_REQUIRED: HRESULT = 0x8019019B; +pub const HTTP_E_STATUS_PRECOND_FAILED: HRESULT = 0x8019019C; +pub const HTTP_E_STATUS_REQUEST_TOO_LARGE: HRESULT = 0x8019019D; +pub const HTTP_E_STATUS_URI_TOO_LONG: HRESULT = 0x8019019E; +pub const HTTP_E_STATUS_UNSUPPORTED_MEDIA: HRESULT = 0x8019019F; +pub const HTTP_E_STATUS_RANGE_NOT_SATISFIABLE: HRESULT = 0x801901A0; +pub const HTTP_E_STATUS_EXPECTATION_FAILED: HRESULT = 0x801901A1; +pub const HTTP_E_STATUS_SERVER_ERROR: HRESULT = 0x801901F4; +pub const HTTP_E_STATUS_NOT_SUPPORTED: HRESULT = 0x801901F5; +pub const HTTP_E_STATUS_BAD_GATEWAY: HRESULT = 0x801901F6; +pub const HTTP_E_STATUS_SERVICE_UNAVAIL: HRESULT = 0x801901F7; +pub const HTTP_E_STATUS_GATEWAY_TIMEOUT: HRESULT = 0x801901F8; +pub const HTTP_E_STATUS_VERSION_NOT_SUP: HRESULT = 0x801901F9; +pub const E_INVALID_PROTOCOL_OPERATION: HRESULT = 0x83760001; +pub const E_INVALID_PROTOCOL_FORMAT: HRESULT = 0x83760002; +pub const E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED: HRESULT = 0x83760003; +pub const E_SUBPROTOCOL_NOT_SUPPORTED: HRESULT = 0x83760004; +pub const E_PROTOCOL_VERSION_NOT_SUPPORTED: HRESULT = 0x83760005; +pub const INPUT_E_OUT_OF_ORDER: HRESULT = 0x80400000; +pub const INPUT_E_REENTRANCY: HRESULT = 0x80400001; +pub const INPUT_E_MULTIMODAL: HRESULT = 0x80400002; +pub const INPUT_E_PACKET: HRESULT = 0x80400003; +pub const INPUT_E_FRAME: HRESULT = 0x80400004; +pub const INPUT_E_HISTORY: HRESULT = 0x80400005; +pub const INPUT_E_DEVICE_INFO: HRESULT = 0x80400006; +pub const INPUT_E_TRANSFORM: HRESULT = 0x80400007; +pub const INPUT_E_DEVICE_PROPERTY: HRESULT = 0x80400008; +pub const INET_E_INVALID_URL: HRESULT = 0x800C0002; +pub const INET_E_NO_SESSION: HRESULT = 0x800C0003; +pub const INET_E_CANNOT_CONNECT: HRESULT = 0x800C0004; +pub const INET_E_RESOURCE_NOT_FOUND: HRESULT = 0x800C0005; +pub const INET_E_OBJECT_NOT_FOUND: HRESULT = 0x800C0006; +pub const INET_E_DATA_NOT_AVAILABLE: HRESULT = 0x800C0007; +pub const INET_E_DOWNLOAD_FAILURE: HRESULT = 0x800C0008; +pub const INET_E_AUTHENTICATION_REQUIRED: HRESULT = 0x800C0009; +pub const INET_E_NO_VALID_MEDIA: HRESULT = 0x800C000A; +pub const INET_E_CONNECTION_TIMEOUT: HRESULT = 0x800C000B; +pub const INET_E_INVALID_REQUEST: HRESULT = 0x800C000C; +pub const INET_E_UNKNOWN_PROTOCOL: HRESULT = 0x800C000D; +pub const INET_E_SECURITY_PROBLEM: HRESULT = 0x800C000E; +pub const INET_E_CANNOT_LOAD_DATA: HRESULT = 0x800C000F; +pub const INET_E_CANNOT_INSTANTIATE_OBJECT: HRESULT = 0x800C0010; +pub const INET_E_INVALID_CERTIFICATE: HRESULT = 0x800C0019; +pub const INET_E_REDIRECT_FAILED: HRESULT = 0x800C0014; +pub const INET_E_REDIRECT_TO_DIR: HRESULT = 0x800C0015; +pub const ERROR_DBG_CREATE_PROCESS_FAILURE_LOCKDOWN: HRESULT = 0x80B00001; +pub const ERROR_DBG_ATTACH_PROCESS_FAILURE_LOCKDOWN: HRESULT = 0x80B00002; +pub const ERROR_DBG_CONNECT_SERVER_FAILURE_LOCKDOWN: HRESULT = 0x80B00003; +pub const ERROR_DBG_START_SERVER_FAILURE_LOCKDOWN: HRESULT = 0x80B00004; +pub const ERROR_IO_PREEMPTED: HRESULT = 0x89010001; +pub const JSCRIPT_E_CANTEXECUTE: HRESULT = 0x89020001; +pub const WEP_E_NOT_PROVISIONED_ON_ALL_VOLUMES: HRESULT = 0x88010001; +pub const WEP_E_FIXED_DATA_NOT_SUPPORTED: HRESULT = 0x88010002; +pub const WEP_E_HARDWARE_NOT_COMPLIANT: HRESULT = 0x88010003; +pub const WEP_E_LOCK_NOT_CONFIGURED: HRESULT = 0x88010004; +pub const WEP_E_PROTECTION_SUSPENDED: HRESULT = 0x88010005; +pub const WEP_E_NO_LICENSE: HRESULT = 0x88010006; +pub const WEP_E_OS_NOT_PROTECTED: HRESULT = 0x88010007; +pub const WEP_E_UNEXPECTED_FAIL: HRESULT = 0x88010008; +pub const WEP_E_BUFFER_TOO_LARGE: HRESULT = 0x88010009; +pub const ERROR_SVHDX_ERROR_STORED: HRESULT = 0xC05C0000; +pub const ERROR_SVHDX_ERROR_NOT_AVAILABLE: HRESULT = 0xC05CFF00; +pub const ERROR_SVHDX_UNIT_ATTENTION_AVAILABLE: HRESULT = 0xC05CFF01; +pub const ERROR_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED: HRESULT = 0xC05CFF02; +pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED: HRESULT = 0xC05CFF03; +pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED: HRESULT = 0xC05CFF04; +pub const ERROR_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED: HRESULT = 0xC05CFF05; +pub const ERROR_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED: HRESULT + = 0xC05CFF06; +pub const ERROR_SVHDX_RESERVATION_CONFLICT: HRESULT = 0xC05CFF07; +pub const ERROR_SVHDX_WRONG_FILE_TYPE: HRESULT = 0xC05CFF08; +pub const ERROR_SVHDX_VERSION_MISMATCH: HRESULT = 0xC05CFF09; +pub const ERROR_VHD_SHARED: HRESULT = 0xC05CFF0A; +pub const WININET_E_OUT_OF_HANDLES: HRESULT = 0x80072EE1; +pub const WININET_E_TIMEOUT: HRESULT = 0x80072EE2; +pub const WININET_E_EXTENDED_ERROR: HRESULT = 0x80072EE3; +pub const WININET_E_INTERNAL_ERROR: HRESULT = 0x80072EE4; +pub const WININET_E_INVALID_URL: HRESULT = 0x80072EE5; +pub const WININET_E_UNRECOGNIZED_SCHEME: HRESULT = 0x80072EE6; +pub const WININET_E_NAME_NOT_RESOLVED: HRESULT = 0x80072EE7; +pub const WININET_E_PROTOCOL_NOT_FOUND: HRESULT = 0x80072EE8; +pub const WININET_E_INVALID_OPTION: HRESULT = 0x80072EE9; +pub const WININET_E_BAD_OPTION_LENGTH: HRESULT = 0x80072EEA; +pub const WININET_E_OPTION_NOT_SETTABLE: HRESULT = 0x80072EEB; +pub const WININET_E_SHUTDOWN: HRESULT = 0x80072EEC; +pub const WININET_E_INCORRECT_USER_NAME: HRESULT = 0x80072EED; +pub const WININET_E_INCORRECT_PASSWORD: HRESULT = 0x80072EEE; +pub const WININET_E_LOGIN_FAILURE: HRESULT = 0x80072EEF; +pub const WININET_E_INVALID_OPERATION: HRESULT = 0x80072EF0; +pub const WININET_E_OPERATION_CANCELLED: HRESULT = 0x80072EF1; +pub const WININET_E_INCORRECT_HANDLE_TYPE: HRESULT = 0x80072EF2; +pub const WININET_E_INCORRECT_HANDLE_STATE: HRESULT = 0x80072EF3; +pub const WININET_E_NOT_PROXY_REQUEST: HRESULT = 0x80072EF4; +pub const WININET_E_REGISTRY_VALUE_NOT_FOUND: HRESULT = 0x80072EF5; +pub const WININET_E_BAD_REGISTRY_PARAMETER: HRESULT = 0x80072EF6; +pub const WININET_E_NO_DIRECT_ACCESS: HRESULT = 0x80072EF7; +pub const WININET_E_NO_CONTEXT: HRESULT = 0x80072EF8; +pub const WININET_E_NO_CALLBACK: HRESULT = 0x80072EF9; +pub const WININET_E_REQUEST_PENDING: HRESULT = 0x80072EFA; +pub const WININET_E_INCORRECT_FORMAT: HRESULT = 0x80072EFB; +pub const WININET_E_ITEM_NOT_FOUND: HRESULT = 0x80072EFC; +pub const WININET_E_CANNOT_CONNECT: HRESULT = 0x80072EFD; +pub const WININET_E_CONNECTION_ABORTED: HRESULT = 0x80072EFE; +pub const WININET_E_CONNECTION_RESET: HRESULT = 0x80072EFF; +pub const WININET_E_FORCE_RETRY: HRESULT = 0x80072F00; +pub const WININET_E_INVALID_PROXY_REQUEST: HRESULT = 0x80072F01; +pub const WININET_E_NEED_UI: HRESULT = 0x80072F02; +pub const WININET_E_HANDLE_EXISTS: HRESULT = 0x80072F04; +pub const WININET_E_SEC_CERT_DATE_INVALID: HRESULT = 0x80072F05; +pub const WININET_E_SEC_CERT_CN_INVALID: HRESULT = 0x80072F06; +pub const WININET_E_HTTP_TO_HTTPS_ON_REDIR: HRESULT = 0x80072F07; +pub const WININET_E_HTTPS_TO_HTTP_ON_REDIR: HRESULT = 0x80072F08; +pub const WININET_E_MIXED_SECURITY: HRESULT = 0x80072F09; +pub const WININET_E_CHG_POST_IS_NON_SECURE: HRESULT = 0x80072F0A; +pub const WININET_E_POST_IS_NON_SECURE: HRESULT = 0x80072F0B; +pub const WININET_E_CLIENT_AUTH_CERT_NEEDED: HRESULT = 0x80072F0C; +pub const WININET_E_INVALID_CA: HRESULT = 0x80072F0D; +pub const WININET_E_CLIENT_AUTH_NOT_SETUP: HRESULT = 0x80072F0E; +pub const WININET_E_ASYNC_THREAD_FAILED: HRESULT = 0x80072F0F; +pub const WININET_E_REDIRECT_SCHEME_CHANGE: HRESULT = 0x80072F10; +pub const WININET_E_DIALOG_PENDING: HRESULT = 0x80072F11; +pub const WININET_E_RETRY_DIALOG: HRESULT = 0x80072F12; +pub const WININET_E_NO_NEW_CONTAINERS: HRESULT = 0x80072F13; +pub const WININET_E_HTTPS_HTTP_SUBMIT_REDIR: HRESULT = 0x80072F14; +pub const WININET_E_SEC_CERT_ERRORS: HRESULT = 0x80072F17; +pub const WININET_E_SEC_CERT_REV_FAILED: HRESULT = 0x80072F19; +pub const WININET_E_HEADER_NOT_FOUND: HRESULT = 0x80072F76; +pub const WININET_E_DOWNLEVEL_SERVER: HRESULT = 0x80072F77; +pub const WININET_E_INVALID_SERVER_RESPONSE: HRESULT = 0x80072F78; +pub const WININET_E_INVALID_HEADER: HRESULT = 0x80072F79; +pub const WININET_E_INVALID_QUERY_REQUEST: HRESULT = 0x80072F7A; +pub const WININET_E_HEADER_ALREADY_EXISTS: HRESULT = 0x80072F7B; +pub const WININET_E_REDIRECT_FAILED: HRESULT = 0x80072F7C; +pub const WININET_E_SECURITY_CHANNEL_ERROR: HRESULT = 0x80072F7D; +pub const WININET_E_UNABLE_TO_CACHE_FILE: HRESULT = 0x80072F7E; +pub const WININET_E_TCPIP_NOT_INSTALLED: HRESULT = 0x80072F7F; +pub const WININET_E_DISCONNECTED: HRESULT = 0x80072F83; +pub const WININET_E_SERVER_UNREACHABLE: HRESULT = 0x80072F84; +pub const WININET_E_PROXY_SERVER_UNREACHABLE: HRESULT = 0x80072F85; +pub const WININET_E_BAD_AUTO_PROXY_SCRIPT: HRESULT = 0x80072F86; +pub const WININET_E_UNABLE_TO_DOWNLOAD_SCRIPT: HRESULT = 0x80072F87; +pub const WININET_E_SEC_INVALID_CERT: HRESULT = 0x80072F89; +pub const WININET_E_SEC_CERT_REVOKED: HRESULT = 0x80072F8A; +pub const WININET_E_FAILED_DUETOSECURITYCHECK: HRESULT = 0x80072F8B; +pub const WININET_E_NOT_INITIALIZED: HRESULT = 0x80072F8C; +pub const WININET_E_LOGIN_FAILURE_DISPLAY_ENTITY_BODY: HRESULT = 0x80072F8E; +pub const WININET_E_DECODING_FAILED: HRESULT = 0x80072F8F; +pub const WININET_E_NOT_REDIRECTED: HRESULT = 0x80072F80; +pub const WININET_E_COOKIE_NEEDS_CONFIRMATION: HRESULT = 0x80072F81; +pub const WININET_E_COOKIE_DECLINED: HRESULT = 0x80072F82; +pub const WININET_E_REDIRECT_NEEDS_CONFIRMATION: HRESULT = 0x80072F88; diff --git a/src/vendor/winapi/src/shared/winusbio.rs b/src/vendor/winapi/src/shared/winusbio.rs new file mode 100644 index 0000000000..27132be5d5 --- /dev/null +++ b/src/vendor/winapi/src/shared/winusbio.rs @@ -0,0 +1,39 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Public header for WINUSB +use shared::minwindef::{UCHAR, ULONG, USHORT}; +use shared::usb::USBD_PIPE_TYPE; +pub const SHORT_PACKET_TERMINATE: ULONG = 0x01; +pub const AUTO_CLEAR_STALL: ULONG = 0x02; +pub const PIPE_TRANSFER_TIMEOUT: ULONG = 0x03; +pub const IGNORE_SHORT_PACKETS: ULONG = 0x04; +pub const ALLOW_PARTIAL_READS: ULONG = 0x05; +pub const AUTO_FLUSH: ULONG = 0x06; +pub const RAW_IO: ULONG = 0x07; +pub const MAXIMUM_TRANSFER_SIZE: ULONG = 0x08; +pub const RESET_PIPE_ON_RESUME: ULONG = 0x09; +pub const DEVICE_SPEED: ULONG = 0x01; +pub const LowSpeed: ULONG = 0x01; +pub const FullSpeed: ULONG = 0x02; +pub const HighSpeed: ULONG = 0x03; +DEFINE_GUID!{WinUSB_TestGuid, + 0xda812bff, 0x12c3, 0x46a2, 0x8e, 0x2b, 0xdb, 0xd3, 0xb7, 0x83, 0x4c, 0x43} +STRUCT!{struct WINUSB_PIPE_INFORMATION { + PipeType: USBD_PIPE_TYPE, + PipeId: UCHAR, + MaximumPacketSize: USHORT, + Interval: UCHAR, +}} +pub type PWINUSB_PIPE_INFORMATION = *mut WINUSB_PIPE_INFORMATION; +STRUCT!{struct WINUSB_PIPE_INFORMATION_EX { + PipeType: USBD_PIPE_TYPE, + PipeId: UCHAR, + MaximumPacketSize: USHORT, + Interval: UCHAR, + MaximumBytesPerInterval: ULONG, +}} +pub type PWINUSB_PIPE_INFORMATION_EX = *mut WINUSB_PIPE_INFORMATION_EX; diff --git a/src/vendor/winapi/src/shared/wnnc.rs b/src/vendor/winapi/src/shared/wnnc.rs new file mode 100644 index 0000000000..b4fc185dd4 --- /dev/null +++ b/src/vendor/winapi/src/shared/wnnc.rs @@ -0,0 +1,80 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Provides the Windows Networking WNNC_NET definitions to winnetwk.h and the IFS Kit. + +use shared::minwindef::DWORD; + +pub const WNNC_NET_MSNET: DWORD = 0x00010000; +pub const WNNC_NET_SMB: DWORD = 0x00020000; +pub const WNNC_NET_NETWARE: DWORD = 0x00030000; +pub const WNNC_NET_VINES: DWORD = 0x00040000; +pub const WNNC_NET_10NET: DWORD = 0x00050000; +pub const WNNC_NET_LOCUS: DWORD = 0x00060000; +pub const WNNC_NET_SUN_PC_NFS: DWORD = 0x00070000; +pub const WNNC_NET_LANSTEP: DWORD = 0x00080000; +pub const WNNC_NET_9TILES: DWORD = 0x00090000; +pub const WNNC_NET_LANTASTIC: DWORD = 0x000A0000; +pub const WNNC_NET_AS400: DWORD = 0x000B0000; +pub const WNNC_NET_FTP_NFS: DWORD = 0x000C0000; +pub const WNNC_NET_PATHWORKS: DWORD = 0x000D0000; +pub const WNNC_NET_LIFENET: DWORD = 0x000E0000; +pub const WNNC_NET_POWERLAN: DWORD = 0x000F0000; +pub const WNNC_NET_BWNFS: DWORD = 0x00100000; +pub const WNNC_NET_COGENT: DWORD = 0x00110000; +pub const WNNC_NET_FARALLON: DWORD = 0x00120000; +pub const WNNC_NET_APPLETALK: DWORD = 0x00130000; +pub const WNNC_NET_INTERGRAPH: DWORD = 0x00140000; +pub const WNNC_NET_SYMFONET: DWORD = 0x00150000; +pub const WNNC_NET_CLEARCASE: DWORD = 0x00160000; +pub const WNNC_NET_FRONTIER: DWORD = 0x00170000; +pub const WNNC_NET_BMC: DWORD = 0x00180000; +pub const WNNC_NET_DCE: DWORD = 0x00190000; +pub const WNNC_NET_AVID: DWORD = 0x001A0000; +pub const WNNC_NET_DOCUSPACE: DWORD = 0x001B0000; +pub const WNNC_NET_MANGOSOFT: DWORD = 0x001C0000; +pub const WNNC_NET_SERNET: DWORD = 0x001D0000; +pub const WNNC_NET_RIVERFRONT1: DWORD = 0x001E0000; +pub const WNNC_NET_RIVERFRONT2: DWORD = 0x001F0000; +pub const WNNC_NET_DECORB: DWORD = 0x00200000; +pub const WNNC_NET_PROTSTOR: DWORD = 0x00210000; +pub const WNNC_NET_FJ_REDIR: DWORD = 0x00220000; +pub const WNNC_NET_DISTINCT: DWORD = 0x00230000; +pub const WNNC_NET_TWINS: DWORD = 0x00240000; +pub const WNNC_NET_RDR2SAMPLE: DWORD = 0x00250000; +pub const WNNC_NET_CSC: DWORD = 0x00260000; +pub const WNNC_NET_3IN1: DWORD = 0x00270000; +pub const WNNC_NET_EXTENDNET: DWORD = 0x00290000; +pub const WNNC_NET_STAC: DWORD = 0x002A0000; +pub const WNNC_NET_FOXBAT: DWORD = 0x002B0000; +pub const WNNC_NET_YAHOO: DWORD = 0x002C0000; +pub const WNNC_NET_EXIFS: DWORD = 0x002D0000; +pub const WNNC_NET_DAV: DWORD = 0x002E0000; +pub const WNNC_NET_KNOWARE: DWORD = 0x002F0000; +pub const WNNC_NET_OBJECT_DIRE: DWORD = 0x00300000; +pub const WNNC_NET_MASFAX: DWORD = 0x00310000; +pub const WNNC_NET_HOB_NFS: DWORD = 0x00320000; +pub const WNNC_NET_SHIVA: DWORD = 0x00330000; +pub const WNNC_NET_IBMAL: DWORD = 0x00340000; +pub const WNNC_NET_LOCK: DWORD = 0x00350000; +pub const WNNC_NET_TERMSRV: DWORD = 0x00360000; +pub const WNNC_NET_SRT: DWORD = 0x00370000; +pub const WNNC_NET_QUINCY: DWORD = 0x00380000; +pub const WNNC_NET_OPENAFS: DWORD = 0x00390000; +pub const WNNC_NET_AVID1: DWORD = 0x003A0000; +pub const WNNC_NET_DFS: DWORD = 0x003B0000; +pub const WNNC_NET_KWNP: DWORD = 0x003C0000; +pub const WNNC_NET_ZENWORKS: DWORD = 0x003D0000; +pub const WNNC_NET_DRIVEONWEB: DWORD = 0x003E0000; +pub const WNNC_NET_VMWARE: DWORD = 0x003F0000; +pub const WNNC_NET_RSFX: DWORD = 0x00400000; +pub const WNNC_NET_MFILES: DWORD = 0x00410000; +pub const WNNC_NET_MS_NFS: DWORD = 0x00420000; +pub const WNNC_NET_GOOGLE: DWORD = 0x00430000; +pub const WNNC_NET_NDFS: DWORD = 0x00440000; +pub const WNNC_NET_DOCUSHARE: DWORD = 0x00450000; +pub const WNNC_CRED_MANAGER: DWORD = 0xFFFF0000; +pub const WNNC_NET_LANMAN: DWORD = WNNC_NET_SMB; diff --git a/src/vendor/winapi/src/shared/ws2def.rs b/src/vendor/winapi/src/shared/ws2def.rs new file mode 100644 index 0000000000..ff7e4e4143 --- /dev/null +++ b/src/vendor/winapi/src/shared/ws2def.rs @@ -0,0 +1,561 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Core definitions for the Winsock2 specification +use ctypes::{__int64, c_char, c_int, c_long, c_short, c_void}; +use shared::basetsd::SIZE_T; +use shared::guiddef::LPGUID; +use shared::inaddr::IN_ADDR; +use shared::minwindef::{DWORD, INT, UCHAR, ULONG, USHORT}; +use um::winnt::{CHAR, HANDLE, LONG, PROCESSOR_NUMBER, PWSTR}; +use vc::vcruntime::size_t; +pub type ADDRESS_FAMILY = USHORT; +pub const AF_UNSPEC: c_int = 0; +pub const AF_UNIX: c_int = 1; +pub const AF_INET: c_int = 2; +pub const AF_IMPLINK: c_int = 3; +pub const AF_PUP: c_int = 4; +pub const AF_CHAOS: c_int = 5; +pub const AF_NS: c_int = 6; +pub const AF_IPX: c_int = AF_NS; +pub const AF_ISO: c_int = 7; +pub const AF_OSI: c_int = AF_ISO; +pub const AF_ECMA: c_int = 8; +pub const AF_DATAKIT: c_int = 9; +pub const AF_CCITT: c_int = 10; +pub const AF_SNA: c_int = 11; +pub const AF_DECnet: c_int = 12; +pub const AF_DLI: c_int = 13; +pub const AF_LAT: c_int = 14; +pub const AF_HYLINK: c_int = 15; +pub const AF_APPLETALK: c_int = 16; +pub const AF_NETBIOS: c_int = 17; +pub const AF_VOICEVIEW: c_int = 18; +pub const AF_FIREFOX: c_int = 19; +pub const AF_UNKNOWN1: c_int = 20; +pub const AF_BAN: c_int = 21; +pub const AF_ATM: c_int = 22; +pub const AF_INET6: c_int = 23; +pub const AF_CLUSTER: c_int = 24; +pub const AF_12844: c_int = 25; +pub const AF_IRDA: c_int = 26; +pub const AF_NETDES: c_int = 28; +pub const AF_TCNPROCESS: c_int = 29; +pub const AF_TCNMESSAGE: c_int = 30; +pub const AF_ICLFXBM: c_int = 31; +pub const AF_BTH: c_int = 32; +pub const AF_LINK: c_int = 33; +pub const AF_HYPERV: c_int = 34; +pub const AF_MAX: c_int = 35; +pub const SOCK_STREAM: c_int = 1; +pub const SOCK_DGRAM: c_int = 2; +pub const SOCK_RAW: c_int = 3; +pub const SOCK_RDM: c_int = 4; +pub const SOCK_SEQPACKET: c_int = 5; +pub const SOL_SOCKET: c_int = 0xffff; +pub const SO_DEBUG: c_int = 0x0001; +pub const SO_ACCEPTCONN: c_int = 0x0002; +pub const SO_REUSEADDR: c_int = 0x0004; +pub const SO_KEEPALIVE: c_int = 0x0008; +pub const SO_DONTROUTE: c_int = 0x0010; +pub const SO_BROADCAST: c_int = 0x0020; +pub const SO_USELOOPBACK: c_int = 0x0040; +pub const SO_LINGER: c_int = 0x0080; +pub const SO_OOBINLINE: c_int = 0x0100; +pub const SO_DONTLINGER: c_int = !SO_LINGER; +pub const SO_EXCLUSIVEADDRUSE: c_int = !SO_REUSEADDR; +pub const SO_SNDBUF: c_int = 0x1001; +pub const SO_RCVBUF: c_int = 0x1002; +pub const SO_SNDLOWAT: c_int = 0x1003; +pub const SO_RCVLOWAT: c_int = 0x1004; +pub const SO_SNDTIMEO: c_int = 0x1005; +pub const SO_RCVTIMEO: c_int = 0x1006; +pub const SO_ERROR: c_int = 0x1007; +pub const SO_TYPE: c_int = 0x1008; +pub const SO_BSP_STATE: c_int = 0x1009; +pub const SO_GROUP_ID: c_int = 0x2001; +pub const SO_GROUP_PRIORITY: c_int = 0x2002; +pub const SO_MAX_MSG_SIZE: c_int = 0x2003; +pub const SO_CONDITIONAL_ACCEPT: c_int = 0x3002; +pub const SO_PAUSE_ACCEPT: c_int = 0x3003; +pub const SO_COMPARTMENT_ID: c_int = 0x3004; +pub const SO_RANDOMIZE_PORT: c_int = 0x3005; +pub const SO_PORT_SCALABILITY: c_int = 0x3006; +pub const SO_REUSE_UNICASTPORT: c_int = 0x3007; +pub const SO_REUSE_MULTICASTPORT: c_int = 0x3008; +pub const WSK_SO_BASE: c_int = 0x4000; +pub const TCP_NODELAY: c_int = 0x0001; +STRUCT!{struct SOCKADDR { + sa_family: ADDRESS_FAMILY, + sa_data: [CHAR; 14], +}} +pub type PSOCKADDR = *mut SOCKADDR; +pub type LPSOCKADDR = *mut SOCKADDR; +STRUCT!{struct SOCKET_ADDRESS { + lpSockaddr: LPSOCKADDR, + iSockaddrLength: INT, +}} +pub type PSOCKET_ADDRESS = *mut SOCKET_ADDRESS; +pub type LPSOCKET_ADDRESS = *mut SOCKET_ADDRESS; +STRUCT!{struct SOCKET_ADDRESS_LIST { + iAddressCount: INT, + Address: [SOCKET_ADDRESS; 0], +}} +pub type PSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; +pub type LPSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; +STRUCT!{struct CSADDR_INFO { + LocalAddr: SOCKET_ADDRESS, + RemoteAddr: SOCKET_ADDRESS, + iSocketType: INT, + iProtocol: INT, +}} +pub type PCSADDR_INFO = *mut CSADDR_INFO; +pub type LPCSADDR_INFO = *mut CSADDR_INFO; +STRUCT!{struct SOCKADDR_STORAGE_LH { + ss_family: ADDRESS_FAMILY, + __ss_pad1: [CHAR; 6], + __ss_align: __int64, + __ss_pad2: [CHAR; 112], +}} +pub type PSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; +pub type LPSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; +STRUCT!{struct SOCKADDR_STORAGE_XP { + ss_family: c_short, + __ss_pad1: [CHAR; 6], + __ss_align: __int64, + __ss_pad2: [CHAR; 112], +}} +pub type PSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; +pub type LPSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; +pub type SOCKADDR_STORAGE = SOCKADDR_STORAGE_LH; +pub type PSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; +pub type LPSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; +STRUCT!{struct SOCKET_PROCESSOR_AFFINITY { + Processor: PROCESSOR_NUMBER, + NumaNodeId: USHORT, + Reserved: USHORT, +}} +pub type PSOCKET_PROCESSOR_AFFINITY = *mut SOCKET_PROCESSOR_AFFINITY; +pub const IOC_UNIX: DWORD = 0x00000000; +pub const IOC_WS2: DWORD = 0x08000000; +pub const IOC_PROTOCOL: DWORD = 0x10000000; +pub const IOC_VENDOR: DWORD = 0x18000000; +pub const IOC_WSK: DWORD = IOC_WS2 | 0x07000000; +macro_rules! _WSAIO { ($x:expr, $y:expr) => { IOC_VOID | $x | $y } } +macro_rules! _WSAIOR { ($x:expr, $y:expr) => { IOC_OUT | $x | $y } } +macro_rules! _WSAIOW { ($x:expr, $y:expr) => { IOC_IN | $x | $y } } +macro_rules! _WSAIORW { ($x:expr, $y:expr) => { IOC_INOUT | $x | $y } } +pub const SIO_ASSOCIATE_HANDLE: DWORD = _WSAIOW!(IOC_WS2, 1); +pub const SIO_ENABLE_CIRCULAR_QUEUEING: DWORD = _WSAIO!(IOC_WS2, 2); +pub const SIO_FIND_ROUTE: DWORD = _WSAIOR!(IOC_WS2, 3); +pub const SIO_FLUSH: DWORD = _WSAIO!(IOC_WS2, 4); +pub const SIO_GET_BROADCAST_ADDRESS: DWORD = _WSAIOR!(IOC_WS2, 5); +pub const SIO_GET_EXTENSION_FUNCTION_POINTER: DWORD = _WSAIORW!(IOC_WS2, 6); +pub const SIO_GET_QOS: DWORD = _WSAIORW!(IOC_WS2, 7); +pub const SIO_GET_GROUP_QOS: DWORD = _WSAIORW!(IOC_WS2, 8); +pub const SIO_MULTIPOINT_LOOPBACK: DWORD = _WSAIOW!(IOC_WS2, 9); +pub const SIO_MULTICAST_SCOPE: DWORD = _WSAIOW!(IOC_WS2, 10); +pub const SIO_SET_QOS: DWORD = _WSAIOW!(IOC_WS2, 11); +pub const SIO_SET_GROUP_QOS: DWORD = _WSAIOW!(IOC_WS2, 12); +pub const SIO_TRANSLATE_HANDLE: DWORD = _WSAIORW!(IOC_WS2, 13); +pub const SIO_ROUTING_INTERFACE_QUERY: DWORD = _WSAIORW!(IOC_WS2, 20); +pub const SIO_ROUTING_INTERFACE_CHANGE: DWORD = _WSAIOW!(IOC_WS2, 21); +pub const SIO_ADDRESS_LIST_QUERY: DWORD = _WSAIOR!(IOC_WS2, 22); +pub const SIO_ADDRESS_LIST_CHANGE: DWORD = _WSAIO!(IOC_WS2, 23); +pub const SIO_QUERY_TARGET_PNP_HANDLE: DWORD = _WSAIOR!(IOC_WS2, 24); +pub const SIO_QUERY_RSS_PROCESSOR_INFO: DWORD = _WSAIOR!(IOC_WS2, 37); +pub const SIO_ADDRESS_LIST_SORT: DWORD = _WSAIORW!(IOC_WS2, 25); +pub const SIO_RESERVED_1: DWORD = _WSAIOW!(IOC_WS2, 26); +pub const SIO_RESERVED_2: DWORD = _WSAIOW!(IOC_WS2, 33); +pub const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER: DWORD = _WSAIORW!(IOC_WS2, 36); +pub const IPPROTO_IP: c_int = 0; +ENUM!{enum IPPROTO { + IPPROTO_HOPOPTS = 0, // IPv6 Hop-by-Hop options + IPPROTO_ICMP = 1, + IPPROTO_IGMP = 2, + IPPROTO_GGP = 3, + IPPROTO_IPV4 = 4, + IPPROTO_ST = 5, + IPPROTO_TCP = 6, + IPPROTO_CBT = 7, + IPPROTO_EGP = 8, + IPPROTO_IGP = 9, + IPPROTO_PUP = 12, + IPPROTO_UDP = 17, + IPPROTO_IDP = 22, + IPPROTO_RDP = 27, + IPPROTO_IPV6 = 41, // IPv6 header + IPPROTO_ROUTING = 43, // IPv6 Routing header + IPPROTO_FRAGMENT = 44, // IPv6 fragmentation header + IPPROTO_ESP = 50, // encapsulating security payload + IPPROTO_AH = 51, // authentication header + IPPROTO_ICMPV6 = 58, // ICMPv6 + IPPROTO_NONE = 59, // IPv6 no next header + IPPROTO_DSTOPTS = 60, // IPv6 Destination options + IPPROTO_ND = 77, + IPPROTO_ICLFXBM = 78, + IPPROTO_PIM = 103, + IPPROTO_PGM = 113, + IPPROTO_L2TP = 115, + IPPROTO_SCTP = 132, + IPPROTO_RAW = 255, + IPPROTO_MAX = 256, + IPPROTO_RESERVED_RAW = 257, + IPPROTO_RESERVED_IPSEC = 258, + IPPROTO_RESERVED_IPSECOFFLOAD = 259, + IPPROTO_RESERVED_WNV = 260, + IPPROTO_RESERVED_MAX = 261, +}} +pub type PIPPROTO = *mut IPPROTO; +pub const IPPORT_TCPMUX: USHORT = 1; +pub const IPPORT_ECHO: USHORT = 7; +pub const IPPORT_DISCARD: USHORT = 9; +pub const IPPORT_SYSTAT: USHORT = 11; +pub const IPPORT_DAYTIME: USHORT = 13; +pub const IPPORT_NETSTAT: USHORT = 15; +pub const IPPORT_QOTD: USHORT = 17; +pub const IPPORT_MSP: USHORT = 18; +pub const IPPORT_CHARGEN: USHORT = 19; +pub const IPPORT_FTP_DATA: USHORT = 20; +pub const IPPORT_FTP: USHORT = 21; +pub const IPPORT_TELNET: USHORT = 23; +pub const IPPORT_SMTP: USHORT = 25; +pub const IPPORT_TIMESERVER: USHORT = 37; +pub const IPPORT_NAMESERVER: USHORT = 42; +pub const IPPORT_WHOIS: USHORT = 43; +pub const IPPORT_MTP: USHORT = 57; +pub const IPPORT_TFTP: USHORT = 69; +pub const IPPORT_RJE: USHORT = 77; +pub const IPPORT_FINGER: USHORT = 79; +pub const IPPORT_TTYLINK: USHORT = 87; +pub const IPPORT_SUPDUP: USHORT = 95; +pub const IPPORT_POP3: USHORT = 110; +pub const IPPORT_NTP: USHORT = 123; +pub const IPPORT_EPMAP: USHORT = 135; +pub const IPPORT_NETBIOS_NS: USHORT = 137; +pub const IPPORT_NETBIOS_DGM: USHORT = 138; +pub const IPPORT_NETBIOS_SSN: USHORT = 139; +pub const IPPORT_IMAP: USHORT = 143; +pub const IPPORT_SNMP: USHORT = 161; +pub const IPPORT_SNMP_TRAP: USHORT = 162; +pub const IPPORT_IMAP3: USHORT = 220; +pub const IPPORT_LDAP: USHORT = 389; +pub const IPPORT_HTTPS: USHORT = 443; +pub const IPPORT_MICROSOFT_DS: USHORT = 445; +pub const IPPORT_EXECSERVER: USHORT = 512; +pub const IPPORT_LOGINSERVER: USHORT = 513; +pub const IPPORT_CMDSERVER: USHORT = 514; +pub const IPPORT_EFSSERVER: USHORT = 520; +pub const IPPORT_BIFFUDP: USHORT = 512; +pub const IPPORT_WHOSERVER: USHORT = 513; +pub const IPPORT_ROUTESERVER: USHORT = 520; +pub const IPPORT_RESERVED: USHORT = 1024; +pub const IPPORT_REGISTERED_MIN: USHORT = IPPORT_RESERVED; +pub const IPPORT_REGISTERED_MAX: USHORT = 0xbfff; +pub const IPPORT_DYNAMIC_MIN: USHORT = 0xc000; +pub const IPPORT_DYNAMIC_MAX: USHORT = 0xffff; +#[inline] +pub fn IN_CLASSA(i: LONG) -> bool { + (i & 0x80000000) == 0 +} +pub const IN_CLASSA_NET: LONG = 0xff000000; +pub const IN_CLASSA_NSHIFT: LONG = 24; +pub const IN_CLASSA_HOST: LONG = 0x00ffffff; +pub const IN_CLASSA_MAX: LONG = 128; +#[inline] +pub fn IN_CLASSB(i: LONG) -> bool { + (i as u32 & 0xc0000000) == 0x80000000 +} +pub const IN_CLASSB_NET: LONG = 0xffff0000; +pub const IN_CLASSB_NSHIFT: LONG = 16; +pub const IN_CLASSB_HOST: LONG = 0x0000ffff; +pub const IN_CLASSB_MAX: LONG = 65536; +#[inline] +pub fn IN_CLASSC(i: LONG) -> bool { + (i as u32 & 0xe0000000) == 0xc0000000 +} +pub const IN_CLASSC_NET: LONG = 0xffffff00; +pub const IN_CLASSC_NSHIFT: LONG = 8; +pub const IN_CLASSC_HOST: LONG = 0x000000ff; +#[inline] +pub fn IN_CLASSD(i: c_long) -> bool { + (i as u32 & 0xf0000000) == 0xe0000000 +} +pub const IN_CLASSD_NET: LONG = 0xf0000000; +pub const IN_CLASSD_NSHIFT: LONG = 28; +pub const IN_CLASSD_HOST: LONG = 0x0fffffff; +#[inline] +pub fn IN_MULTICAST(i: c_long) -> bool { + IN_CLASSD(i) +} +pub const INADDR_ANY: ULONG = 0x00000000; +pub const INADDR_LOOPBACK: ULONG = 0x7f000001; +pub const INADDR_BROADCAST: ULONG = 0xffffffff; +pub const INADDR_NONE: ULONG = 0xffffffff; +ENUM!{enum SCOPE_LEVEL { + ScopeLevelInterface = 1, + ScopeLevelLink = 2, + ScopeLevelSubnet = 3, + ScopeLevelAdmin = 4, + ScopeLevelSite = 5, + ScopeLevelOrganization = 8, + ScopeLevelGlobal = 14, + ScopeLevelCount = 16, +}} +STRUCT!{struct SCOPE_ID_u_s { + bitfield: ULONG, +}} +BITFIELD!{SCOPE_ID_u_s bitfield: ULONG [ + Zone set_Zone[0..28], + Level set_Level[28..32], +]} +UNION!{union SCOPE_ID_u { + [u32; 1], + s s_mut: SCOPE_ID_u_s, + Value Value_mut: ULONG, +}} +STRUCT!{struct SCOPE_ID { + u: SCOPE_ID_u, +}} +pub type PSCOPE_ID = *mut SCOPE_ID; +STRUCT!{struct SOCKADDR_IN { + sin_family: ADDRESS_FAMILY, + sin_port: USHORT, + sin_addr: IN_ADDR, + sin_zero: [CHAR; 8], +}} +pub type PSOCKADDR_IN = *mut SOCKADDR_IN; +STRUCT!{struct SOCKADDR_DL { + sdl_family: ADDRESS_FAMILY, + sdl_data: [UCHAR; 8], + sdl_zero: [UCHAR; 4], +}} +pub type PSOCKADDR_DL = *mut SOCKADDR_DL; +pub const IOCPARM_MASK: DWORD = 0x7f; +pub const IOC_VOID: DWORD = 0x20000000; +pub const IOC_OUT: DWORD = 0x40000000; +pub const IOC_IN: DWORD = 0x80000000; +pub const IOC_INOUT: DWORD = IOC_IN | IOC_OUT; +STRUCT!{struct WSABUF { + len: ULONG, + buf: *mut CHAR, +}} +pub type LPWSABUF = *mut WSABUF; +STRUCT!{struct WSAMSG { + name: LPSOCKADDR, + namelen: INT, + lpBuffers: LPWSABUF, + dwBufferCount: ULONG, + Control: WSABUF, + dwFlags: ULONG, +}} +pub type PWSAMSG = *mut WSAMSG; +pub type LPWSAMSG = *mut WSAMSG; +STRUCT!{struct WSACMSGHDR { + cmsg_len: SIZE_T, + cmsg_level: INT, + cmsg_type: INT, +}} +pub type PWSACMSGHDR = *mut WSACMSGHDR; +pub type LPWSACMSGHDR = *mut WSACMSGHDR; +pub type CMSGHDR = WSACMSGHDR; +pub type PCMSGHDR = *mut WSACMSGHDR; +pub const MSG_TRUNC: ULONG = 0x0100; +pub const MSG_CTRUNC: ULONG = 0x0200; +pub const MSG_BCAST: ULONG = 0x0400; +pub const MSG_MCAST: ULONG = 0x0800; +pub const AI_PASSIVE: c_int = 0x00000001; +pub const AI_CANONNAME: c_int = 0x00000002; +pub const AI_NUMERICHOST: c_int = 0x00000004; +pub const AI_NUMERICSERV: c_int = 0x00000008; +pub const AI_DNS_ONLY: c_int = 0x00000010; +pub const AI_ALL: c_int = 0x00000100; +pub const AI_ADDRCONFIG: c_int = 0x00000400; +pub const AI_V4MAPPED: c_int = 0x00000800; +pub const AI_NON_AUTHORITATIVE: c_int = 0x00004000; +pub const AI_SECURE: c_int = 0x00008000; +pub const AI_RETURN_PREFERRED_NAMES: c_int = 0x00010000; +pub const AI_FQDN: c_int = 0x00020000; +pub const AI_FILESERVER: c_int = 0x00040000; +pub const AI_DISABLE_IDN_ENCODING: c_int = 0x00080000; +pub const AI_EXTENDED: c_int = 0x80000000; +pub const AI_RESOLUTION_HANDLE: c_int = 0x40000000; +STRUCT!{struct ADDRINFOA { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: *mut c_char, + ai_addr: *mut SOCKADDR, + ai_next: *mut ADDRINFOA, +}} +pub type PADDRINFOA = *mut ADDRINFOA; +STRUCT!{struct ADDRINFOW { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: PWSTR, + ai_addr: *mut SOCKADDR, + ai_next: *mut ADDRINFOW, +}} +pub type PADDRINFOW = *mut ADDRINFOW; +STRUCT!{struct ADDRINFOEXA { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: *mut c_char, + ai_addr: *mut SOCKADDR, + ai_blob: *mut c_void, + ai_bloblen: size_t, + ai_provider: LPGUID, + ai_next: *mut ADDRINFOEXA, +}} +pub type PADDRINFOEXA = *mut ADDRINFOEXA; +pub type LPADDRINFOEXA = *mut ADDRINFOEXA; +STRUCT!{struct ADDRINFOEXW { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: PWSTR, + ai_addr: *mut SOCKADDR, + ai_blob: *mut c_void, + ai_bloblen: size_t, + ai_provider: LPGUID, + ai_next: *mut ADDRINFOEXW, +}} +pub type PADDRINFOEXW = *mut ADDRINFOEXW; +pub type LPADDRINFOEXW = *mut ADDRINFOEXW; +pub const ADDRINFOEX_VERSION_2: c_int = 2; +pub const ADDRINFOEX_VERSION_3: c_int = 3; +pub const ADDRINFOEX_VERSION_4: c_int = 4; +STRUCT!{struct ADDRINFOEX2A { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: *mut c_char, + ai_addr: *mut SOCKADDR, + ai_blob: *mut c_void, + ai_bloblen: size_t, + ai_provider: LPGUID, + ai_next: *mut ADDRINFOEX2W, + ai_version: c_int, + ai_fqdn: *mut c_char, +}} +pub type PADDRINFOEX2A = *mut ADDRINFOEX2A; +pub type LPADDRINFOEX2A = *mut ADDRINFOEX2A; +STRUCT!{struct ADDRINFOEX2W { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: PWSTR, + ai_addr: *mut SOCKADDR, + ai_blob: *mut c_void, + ai_bloblen: size_t, + ai_provider: LPGUID, + ai_next: *mut ADDRINFOEX2W, + ai_version: c_int, + ai_fqdn: PWSTR, +}} +pub type PADDRINFOEX2W = *mut ADDRINFOEX2W; +pub type LPADDRINFOEX2W = *mut ADDRINFOEX2W; +STRUCT!{struct ADDRINFOEX3A { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: *mut c_char, + ai_addr: *mut SOCKADDR, + ai_blob: *mut c_void, + ai_bloblen: size_t, + ai_provider: LPGUID, + ai_next: *mut ADDRINFOEX3W, + ai_version: c_int, + ai_fqdn: *mut c_char, + ai_interfaceindex: c_int, +}} +pub type PADDRINFOEX3A = *mut ADDRINFOEX3A; +pub type LPADDRINFOEX3A = *mut ADDRINFOEX3A; +STRUCT!{struct ADDRINFOEX3W { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: PWSTR, + ai_addr: *mut SOCKADDR, + ai_blob: *mut c_void, + ai_bloblen: size_t, + ai_provider: LPGUID, + ai_next: *mut ADDRINFOEX3W, + ai_version: c_int, + ai_fqdn: PWSTR, + ai_interfaceindex: c_int, +}} +pub type PADDRINFOEX3W = *mut ADDRINFOEX3W; +pub type LPADDRINFOEX3W = *mut ADDRINFOEX3W; +STRUCT!{struct ADDRINFOEX4 { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: PWSTR, + ai_addr: *mut SOCKADDR, + ai_blob: *mut c_void, + ai_bloblen: size_t, + ai_provider: LPGUID, + ai_next: *mut ADDRINFOEX4, + ai_version: c_int, + ai_fqdn: PWSTR, + ai_interfaceindex: c_int, + ai_resolutionhandle: HANDLE, +}} +pub type PADDRINFOEX4 = *mut ADDRINFOEX4; +pub type LPADDRINFOEX4 = *mut ADDRINFOEX4; +pub const NS_ALL: DWORD = 0; +pub const NS_SAP: DWORD = 1; +pub const NS_NDS: DWORD = 2; +pub const NS_PEER_BROWSE: DWORD = 3; +pub const NS_SLP: DWORD = 5; +pub const NS_DHCP: DWORD = 6; +pub const NS_TCPIP_LOCAL: DWORD = 10; +pub const NS_TCPIP_HOSTS: DWORD = 11; +pub const NS_DNS: DWORD = 12; +pub const NS_NETBT: DWORD = 13; +pub const NS_WINS: DWORD = 14; +pub const NS_NLA: DWORD = 15; +pub const NS_BTH: DWORD = 16; +pub const NS_NBP: DWORD = 20; +pub const NS_MS: DWORD = 30; +pub const NS_STDA: DWORD = 31; +pub const NS_NTDS: DWORD = 32; +pub const NS_EMAIL: DWORD = 37; +pub const NS_PNRPNAME: DWORD = 38; +pub const NS_PNRPCLOUD: DWORD = 39; +pub const NS_X500: DWORD = 40; +pub const NS_NIS: DWORD = 41; +pub const NS_NISPLUS: DWORD = 42; +pub const NS_WRQ: DWORD = 50; +pub const NS_NETDES: DWORD = 60; +pub const NI_NOFQDN: c_int = 0x01; +pub const NI_NUMERICHOST: c_int = 0x02; +pub const NI_NAMEREQD: c_int = 0x04; +pub const NI_NUMERICSERV: c_int = 0x08; +pub const NI_DGRAM: c_int = 0x10; +pub const NI_MAXHOST: c_int = 1025; +pub const NI_MAXSERV: c_int = 32; diff --git a/src/vendor/winapi/src/shared/ws2ipdef.rs b/src/vendor/winapi/src/shared/ws2ipdef.rs new file mode 100644 index 0000000000..8b7963864c --- /dev/null +++ b/src/vendor/winapi/src/shared/ws2ipdef.rs @@ -0,0 +1,79 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! TCP/IP specific information for use by WinSock2 compatible applications. + +use ctypes::c_int; +use shared::in6addr::IN6_ADDR; +use shared::inaddr::IN_ADDR; +use shared::minwindef::{ULONG, USHORT}; +use shared::ws2def::{ADDRESS_FAMILY, SCOPE_ID}; + +pub const IP_OPTIONS: c_int = 1; +pub const IP_HDRINCL: c_int = 2; +pub const IP_TOS: c_int = 3; +pub const IP_TTL: c_int = 4; +pub const IP_MULTICAST_IF: c_int = 9; +pub const IP_MULTICAST_TTL: c_int = 10; +pub const IP_MULTICAST_LOOP: c_int = 11; +pub const IP_ADD_MEMBERSHIP: c_int = 12; +pub const IP_DROP_MEMBERSHIP: c_int = 13; +pub const IP_DONTFRAGMENT: c_int = 14; +pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 15; +pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 16; +pub const IP_BLOCK_SOURCE: c_int = 17; +pub const IP_UNBLOCK_SOURCE: c_int = 18; +pub const IP_PKTINFO: c_int = 19; +pub const IP_RECEIVE_BROADCAST: c_int = 22; +STRUCT!{struct IP_MREQ { + imr_multiaddr: IN_ADDR, + imr_interface: IN_ADDR, +}} +pub type PIP_MREQ = *mut IP_MREQ; +pub const IPV6_HOPOPTS: c_int = 1; +pub const IPV6_HDRINCL: c_int = 2; +pub const IPV6_UNICAST_HOPS: c_int = 4; +pub const IPV6_MULTICAST_IF: c_int = 9; +pub const IPV6_MULTICAST_HOPS: c_int = 10; +pub const IPV6_MULTICAST_LOOP: c_int = 11; +pub const IPV6_ADD_MEMBERSHIP: c_int = 12; +pub const IPV6_JOIN_GROUP: c_int = IPV6_ADD_MEMBERSHIP; +pub const IPV6_DROP_MEMBERSHIP: c_int = 13; +pub const IPV6_LEAVE_GROUP: c_int = IPV6_DROP_MEMBERSHIP; +pub const IPV6_DONTFRAG: c_int = 14; +pub const IPV6_PKTINFO: c_int = 19; +pub const IPV6_HOPLIMIT: c_int = 21; +pub const IPV6_PROTECTION_LEVEL: c_int = 23; +pub const IPV6_RECVIF: c_int = 24; +pub const IPV6_RECVDSTADDR: c_int = 25; +pub const IPV6_CHECKSUM: c_int = 26; +pub const IPV6_V6ONLY: c_int = 27; +pub const IPV6_IFLIST: c_int = 28; +pub const IPV6_ADD_IFLIST: c_int = 29; +pub const IPV6_DEL_IFLIST: c_int = 30; +pub const IPV6_UNICAST_IF: c_int = 31; +pub const IPV6_RTHDR: c_int = 32; +pub const IPV6_RECVRTHDR: c_int = 38; +pub const IPV6_TCLASS: c_int = 39; +pub const IPV6_RECVTCLASS: c_int = 40; +STRUCT!{struct IPV6_MREQ { + ipv6mr_multiaddr: IN6_ADDR, + ipv6mr_interface: ULONG, +}} +pub type PIPV6_MREQ = *mut IPV6_MREQ; +UNION!{union SOCKADDR_IN6_LH_u { + [u32; 1], + sin6_scope_id sin6_scope_id_mut: ULONG, + sin6_scope_struct sin6_scope_struct_mut: SCOPE_ID, +}} +STRUCT!{struct SOCKADDR_IN6_LH { + sin6_family: ADDRESS_FAMILY, + sin6_port: USHORT, + sin6_flowinfo: ULONG, + sin6_addr: IN6_ADDR, + u: SOCKADDR_IN6_LH_u, +}} +pub type PSOCKADDR_IN6_LH = *mut SOCKADDR_IN6_LH; diff --git a/src/vendor/winapi/src/shared/wtypes.rs b/src/vendor/winapi/src/shared/wtypes.rs new file mode 100644 index 0000000000..4f6bfe7db1 --- /dev/null +++ b/src/vendor/winapi/src/shared/wtypes.rs @@ -0,0 +1,100 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of wstypes.h +use ctypes::{c_double, c_short, c_ushort, wchar_t}; +use shared::guiddef::{GUID}; +use shared::minwindef::{BYTE, DWORD, ULONG, USHORT, WORD}; +use shared::ntdef::{LONG, LONGLONG, ULONGLONG}; +use shared::wtypesbase::{FLAGGED_WORD_BLOB, OLECHAR}; +ENUM!{enum VARENUM { + VT_EMPTY = 0, + VT_NULL = 1, + VT_I2 = 2, + VT_I4 = 3, + VT_R4 = 4, + VT_R8 = 5, + VT_CY = 6, + VT_DATE = 7, + VT_BSTR = 8, + VT_DISPATCH = 9, + VT_ERROR = 10, + VT_BOOL = 11, + VT_VARIANT = 12, + VT_UNKNOWN = 13, + VT_DECIMAL = 14, + VT_I1 = 16, + VT_UI1 = 17, + VT_UI2 = 18, + VT_UI4 = 19, + VT_I8 = 20, + VT_UI8 = 21, + VT_INT = 22, + VT_UINT = 23, + VT_VOID = 24, + VT_HRESULT = 25, + VT_PTR = 26, + VT_SAFEARRAY = 27, + VT_CARRAY = 28, + VT_USERDEFINED = 29, + VT_LPSTR = 30, + VT_LPWSTR = 31, + VT_RECORD = 36, + VT_INT_PTR = 37, + VT_UINT_PTR = 38, + VT_FILETIME = 64, + VT_BLOB = 65, + VT_STREAM = 66, + VT_STORAGE = 67, + VT_STREAMED_OBJECT = 68, + VT_STORED_OBJECT = 69, + VT_BLOB_OBJECT = 70, + VT_CF = 71, + VT_CLSID = 72, + VT_VERSIONED_STREAM = 73, + VT_BSTR_BLOB = 0xfff, + VT_VECTOR = 0x1000, + VT_ARRAY = 0x2000, + VT_BYREF = 0x4000, + VT_RESERVED = 0x8000, + VT_ILLEGAL = 0xffff, +}} +pub const VT_ILLEGALMASKED: VARENUM = VT_BSTR_BLOB; +pub const VT_TYPEMASK: VARENUM = VT_BSTR_BLOB; +pub type PROPID = ULONG; +STRUCT!{struct PROPERTYKEY { + fmtid: GUID, + pid: DWORD, +}} +pub type DATE = c_double; +STRUCT!{struct CY { + int64: LONGLONG, +}} +STRUCT!{struct DECIMAL { + wReserved: USHORT, + scale: BYTE, + sign: BYTE, + Hi32: ULONG, + Lo64: ULONGLONG, +}} +pub const DECIMAL_NEG: BYTE = 0x80; +pub type LPDECIMAL = *mut DECIMAL; +pub type VARTYPE = c_ushort; +pub type wireBSTR = *mut FLAGGED_WORD_BLOB; +pub type BSTR = *mut OLECHAR; +pub type LPBSTR = *mut BSTR; +pub type VARIANT_BOOL = c_short; +UNION!{union __MIDL_IWinTypes_0001 { + [usize; 1], + dwValue dwValue_mut: DWORD, + pwszName pwszName_mut: *mut wchar_t, +}} +STRUCT!{struct userCLIPFORMAT { + fContext: LONG, + u: __MIDL_IWinTypes_0001, +}} +pub type wireCLIPFORMAT = *const userCLIPFORMAT; +pub type CLIPFORMAT = WORD; diff --git a/src/vendor/winapi/src/shared/wtypesbase.rs b/src/vendor/winapi/src/shared/wtypesbase.rs new file mode 100644 index 0000000000..bd52a322bd --- /dev/null +++ b/src/vendor/winapi/src/shared/wtypesbase.rs @@ -0,0 +1,162 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_double, c_short, c_uchar, c_ushort}; +use shared::minwindef::{BYTE, DWORD}; +use shared::rpcndr::{boolean, byte, hyper}; +use um::winnt::{LONG, LPWSTR, WCHAR}; +pub type OLECHAR = WCHAR; +pub type LPOLESTR = *mut OLECHAR; +pub type LPCOLESTR = *const OLECHAR; +pub type UCHAR = c_uchar; +pub type SHORT = c_short; +pub type USHORT = c_ushort; +pub type ULONG = DWORD; +pub type DOUBLE = c_double; +STRUCT!{struct COAUTHIDENTITY { + User: *mut USHORT, + UserLength: ULONG, + Domain: *mut USHORT, + DomainLength: ULONG, + Password: *mut USHORT, + PasswordLength: ULONG, + Flags: ULONG, +}} +STRUCT!{struct COAUTHINFO { + dwAuthnSvc: DWORD, + dwAuthzSvc: DWORD, + pwszServerPrincName: LPWSTR, + dwAuthnLevel: DWORD, + dwImpersonationLevel: DWORD, + pAuthIdentityData: *mut COAUTHIDENTITY, + dwCapabilities: DWORD, +}} +pub type SCODE = LONG; +pub type PSCODE = *mut SCODE; +ENUM!{enum MEMCTX { + MEMCTX_TASK = 1, + MEMCTX_SHARED = 2, + MEMCTX_MACSYSTEM = 3, + MEMCTX_UNKNOWN = -1i32 as u32, + MEMCTX_SAME = -2i32 as u32, +}} +pub const ROTREGFLAGS_ALLOWANYCLIENT: DWORD = 0x1; +pub const APPIDREGFLAGS_ACTIVATE_IUSERVER_INDESKTOP: DWORD = 0x1; +pub const APPIDREGFLAGS_SECURE_SERVER_PROCESS_SD_AND_BIND: DWORD = 0x2; +pub const APPIDREGFLAGS_ISSUE_ACTIVATION_RPC_AT_IDENTIFY: DWORD = 0x4; +pub const APPIDREGFLAGS_IUSERVER_UNMODIFIED_LOGON_TOKEN: DWORD = 0x8; +pub const APPIDREGFLAGS_IUSERVER_SELF_SID_IN_LAUNCH_PERMISSION: DWORD = 0x10; +pub const APPIDREGFLAGS_IUSERVER_ACTIVATE_IN_CLIENT_SESSION_ONLY: DWORD = 0x20; +pub const APPIDREGFLAGS_RESERVED1: DWORD = 0x40; +pub const APPIDREGFLAGS_RESERVED2: DWORD = 0x80; +pub const APPIDREGFLAGS_RESERVED3: DWORD = 0x100; +pub const APPIDREGFLAGS_RESERVED4: DWORD = 0x200; +pub const APPIDREGFLAGS_RESERVED5: DWORD = 0x400; +pub const APPIDREGFLAGS_RESERVED6: DWORD = 0x800; +pub const DCOMSCM_ACTIVATION_USE_ALL_AUTHNSERVICES: DWORD = 0x1; +pub const DCOMSCM_ACTIVATION_DISALLOW_UNSECURE_CALL: DWORD = 0x2; +pub const DCOMSCM_RESOLVE_USE_ALL_AUTHNSERVICES: DWORD = 0x4; +pub const DCOMSCM_RESOLVE_DISALLOW_UNSECURE_CALL: DWORD = 0x8; +pub const DCOMSCM_PING_USE_MID_AUTHNSERVICE: DWORD = 0x10; +pub const DCOMSCM_PING_DISALLOW_UNSECURE_CALL: DWORD = 0x20; +ENUM!{enum CLSCTX { + CLSCTX_INPROC_SERVER = 0x1, + CLSCTX_INPROC_HANDLER = 0x2, + CLSCTX_LOCAL_SERVER = 0x4, + CLSCTX_INPROC_SERVER16 = 0x8, + CLSCTX_REMOTE_SERVER = 0x10, + CLSCTX_INPROC_HANDLER16 = 0x20, + CLSCTX_RESERVED1 = 0x40, + CLSCTX_RESERVED2 = 0x80, + CLSCTX_RESERVED3 = 0x100, + CLSCTX_RESERVED4 = 0x200, + CLSCTX_NO_CODE_DOWNLOAD = 0x400, + CLSCTX_RESERVED5 = 0x800, + CLSCTX_NO_CUSTOM_MARSHAL = 0x1000, + CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000, + CLSCTX_NO_FAILURE_LOG = 0x4000, + CLSCTX_DISABLE_AAA = 0x8000, + CLSCTX_ENABLE_AAA = 0x10000, + CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000, + CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000, + CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000, + CLSCTX_ENABLE_CLOAKING = 0x100000, + CLSCTX_APPCONTAINER = 0x400000, + CLSCTX_ACTIVATE_AAA_AS_IU = 0x800000, + CLSCTX_PS_DLL = 0x80000000, +}} +pub const CLSCTX_VALID_MASK: CLSCTX = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER + | CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER16 | CLSCTX_REMOTE_SERVER + | CLSCTX_NO_CODE_DOWNLOAD | CLSCTX_NO_CUSTOM_MARSHAL | CLSCTX_ENABLE_CODE_DOWNLOAD + | CLSCTX_NO_FAILURE_LOG | CLSCTX_DISABLE_AAA | CLSCTX_ENABLE_AAA | CLSCTX_FROM_DEFAULT_CONTEXT + | CLSCTX_ACTIVATE_32_BIT_SERVER | CLSCTX_ACTIVATE_64_BIT_SERVER | CLSCTX_ENABLE_CLOAKING + | CLSCTX_APPCONTAINER | CLSCTX_ACTIVATE_AAA_AS_IU | CLSCTX_PS_DLL; +ENUM!{enum MSHLFLAGS { + MSHLFLAGS_NORMAL = 0, + MSHLFLAGS_TABLESTRONG = 1, + MSHLFLAGS_TABLEWEAK = 2, + MSHLFLAGS_NOPING = 4, + MSHLFLAGS_RESERVED1 = 8, + MSHLFLAGS_RESERVED2 = 16, + MSHLFLAGS_RESERVED3 = 32, + MSHLFLAGS_RESERVED4 = 64, +}} +ENUM!{enum MSHCTX { + MSHCTX_LOCAL = 0, + MSHCTX_NOSHAREDMEM = 1, + MSHCTX_DIFFERENTMACHINE = 2, + MSHCTX_INPROC = 3, + MSHCTX_CROSSCTX = 4, +}} +STRUCT!{struct BYTE_BLOB { + clSize: ULONG, + abData: [byte; 1], +}} +pub type UP_BYTE_BLOB = *mut BYTE_BLOB; +STRUCT!{struct WORD_BLOB { + clSize: ULONG, + asData: [c_ushort; 1], +}} +pub type UP_WORD_BLOB = *mut WORD_BLOB; +STRUCT!{struct DWORD_BLOB { + clSize: ULONG, + alData: [ULONG; 1], +}} +pub type UP_DWORD_BLOB = *mut DWORD_BLOB; +STRUCT!{struct FLAGGED_BYTE_BLOB { + fFlags: ULONG, + clSize: ULONG, + abData: [byte; 1], +}} +pub type UP_FLAGGED_BYTE_BLOB = *mut FLAGGED_BYTE_BLOB; +STRUCT!{struct FLAGGED_WORD_BLOB { + fFlags: ULONG, + clSize: ULONG, + alData: [ULONG; 1], +}} +pub type UP_FLAGGED_WORD_BLOB = *mut FLAGGED_WORD_BLOB; +STRUCT!{struct BYTE_SIZEDARR { + clSize: ULONG, + pData: *mut byte, +}} +STRUCT!{struct WORD_SIZEDARR { + clSize: ULONG, + pData: *mut c_ushort, +}} +STRUCT!{struct DWORD_SIZEDARR { + clSize: ULONG, + pData: *mut ULONG, +}} +STRUCT!{struct HYPER_SIZEDARR { + clSize: ULONG, + pData: *mut hyper, +}} +pub type BOOLEAN = boolean; +STRUCT!{struct BLOB { + cbSize: ULONG, + pBlobData: *mut BYTE, +}} +pub type LPBLOB = *mut BLOB; diff --git a/src/vendor/winapi/src/um/audioclient.rs b/src/vendor/winapi/src/um/audioclient.rs new file mode 100644 index 0000000000..62c264ca42 --- /dev/null +++ b/src/vendor/winapi/src/um/audioclient.rs @@ -0,0 +1,173 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! this ALWAYS GENERATED file contains the definitions for the interfaces +use ctypes::c_float; +use shared::basetsd::{UINT32, UINT64}; +use shared::guiddef::{LPCGUID, REFIID}; +use shared::minwindef::{BYTE, DWORD, LPVOID}; +use shared::mmreg::WAVEFORMATEX; +use shared::winerror::{FACILITY_AUDCLNT, SEVERITY_ERROR, SEVERITY_SUCCESS}; +use shared::wtypesbase::SCODE; +use um::audiosessiontypes::AUDCLNT_SHAREMODE; +use um::strmif::REFERENCE_TIME; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT}; +//1627 +pub const AUDCLNT_E_NOT_INITIALIZED: HRESULT = AUDCLNT_ERR!(0x001); +pub const AUDCLNT_E_ALREADY_INITIALIZED: HRESULT = AUDCLNT_ERR!(0x002); +pub const AUDCLNT_E_WRONG_ENDPOINT_TYPE: HRESULT = AUDCLNT_ERR!(0x003); +pub const AUDCLNT_E_DEVICE_INVALIDATED: HRESULT = AUDCLNT_ERR!(0x004); +pub const AUDCLNT_E_NOT_STOPPED: HRESULT = AUDCLNT_ERR!(0x005); +pub const AUDCLNT_E_BUFFER_TOO_LARGE: HRESULT = AUDCLNT_ERR!(0x006); +pub const AUDCLNT_E_OUT_OF_ORDER: HRESULT = AUDCLNT_ERR!(0x007); +pub const AUDCLNT_E_UNSUPPORTED_FORMAT: HRESULT = AUDCLNT_ERR!(0x008); +pub const AUDCLNT_E_INVALID_SIZE: HRESULT = AUDCLNT_ERR!(0x009); +pub const AUDCLNT_E_DEVICE_IN_USE: HRESULT = AUDCLNT_ERR!(0x00a); +pub const AUDCLNT_E_BUFFER_OPERATION_PENDING: HRESULT = AUDCLNT_ERR!(0x00b); +pub const AUDCLNT_E_THREAD_NOT_REGISTERED: HRESULT = AUDCLNT_ERR!(0x00c); +pub const AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED: HRESULT = AUDCLNT_ERR!(0x00e); +pub const AUDCLNT_E_ENDPOINT_CREATE_FAILED: HRESULT = AUDCLNT_ERR!(0x00f); +pub const AUDCLNT_E_SERVICE_NOT_RUNNING: HRESULT = AUDCLNT_ERR!(0x010); +pub const AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED: HRESULT = AUDCLNT_ERR!(0x011); +pub const AUDCLNT_E_EXCLUSIVE_MODE_ONLY: HRESULT = AUDCLNT_ERR!(0x012); +pub const AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL: HRESULT = AUDCLNT_ERR!(0x013); +pub const AUDCLNT_E_EVENTHANDLE_NOT_SET: HRESULT = AUDCLNT_ERR!(0x014); +pub const AUDCLNT_E_INCORRECT_BUFFER_SIZE: HRESULT = AUDCLNT_ERR!(0x015); +pub const AUDCLNT_E_BUFFER_SIZE_ERROR: HRESULT = AUDCLNT_ERR!(0x016); +pub const AUDCLNT_E_CPUUSAGE_EXCEEDED: HRESULT = AUDCLNT_ERR!(0x017); +pub const AUDCLNT_E_BUFFER_ERROR: HRESULT = AUDCLNT_ERR!(0x018); +pub const AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED: HRESULT = AUDCLNT_ERR!(0x019); +pub const AUDCLNT_E_INVALID_DEVICE_PERIOD: HRESULT = AUDCLNT_ERR!(0x020); +pub const AUDCLNT_E_INVALID_STREAM_FLAG: HRESULT = AUDCLNT_ERR!(0x021); +pub const AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE: HRESULT = AUDCLNT_ERR!(0x022); +pub const AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES: HRESULT = AUDCLNT_ERR!(0x023); +pub const AUDCLNT_E_OFFLOAD_MODE_ONLY: HRESULT = AUDCLNT_ERR!(0x024); +pub const AUDCLNT_E_NONOFFLOAD_MODE_ONLY: HRESULT = AUDCLNT_ERR!(0x025); +pub const AUDCLNT_E_RESOURCES_INVALIDATED: HRESULT = AUDCLNT_ERR!(0x026); +pub const AUDCLNT_E_RAW_MODE_UNSUPPORTED: HRESULT = AUDCLNT_ERR!(0x027); +pub const AUDCLNT_S_BUFFER_EMPTY: SCODE = AUDCLNT_SUCCESS!(0x001); +pub const AUDCLNT_S_THREAD_ALREADY_REGISTERED: SCODE = AUDCLNT_SUCCESS!(0x002); +pub const AUDCLNT_S_POSITION_STALLED: SCODE = AUDCLNT_SUCCESS!(0x003); +ENUM!{enum AUDCLNT_BUFFERFLAGS { + AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = 0x1, + AUDCLNT_BUFFERFLAGS_SILENT = 0x2, + AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = 0x4, +}} +DEFINE_GUID!{IID_IAudioClient, + 0x1CB9AD4C, 0xDBFA, 0x4c32, 0xB1, 0x78, 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2} +DEFINE_GUID!{IID_IAudioRenderClient, + 0xF294ACFC, 0x3146, 0x4483, 0xA7, 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2} +DEFINE_GUID!{IID_IAudioCaptureClient, + 0xc8adbd64, 0xe71e, 0x48a0, 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17} +DEFINE_GUID!{IID_IAudioClock, + 0xcd63314f, 0x3fba, 0x4a1b, 0x81, 0x2c, 0xef, 0x96, 0x35, 0x87, 0x28, 0xe7} +DEFINE_GUID!{IID_IAudioStreamVolume, + 0x93014887, 0x242d, 0x4068, 0x8a, 0x15, 0xcf, 0x5e, 0x93, 0xb9, 0x0f, 0xe3} +RIDL!{#[uuid(0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2)] +interface IAudioClient(IAudioClientVtbl): IUnknown(IUnknownVtbl) { + fn Initialize( + ShareMode: AUDCLNT_SHAREMODE, + StreamFlags: DWORD, + hnsBufferDuration: REFERENCE_TIME, + hnsPeriodicity: REFERENCE_TIME, + pFormat: *const WAVEFORMATEX, + AudioSessionGuid: LPCGUID, + ) -> HRESULT, + fn GetBufferSize( + pNumBufferFrames: *mut UINT32, + ) -> HRESULT, + fn GetStreamLatency( + phnsLatency: *mut REFERENCE_TIME, + ) -> HRESULT, + fn GetCurrentPadding( + pNumPaddingFrames: *mut UINT32, + ) -> HRESULT, + fn IsFormatSupported( + ShareMode: AUDCLNT_SHAREMODE, + pFormat: *const WAVEFORMATEX, + ppClosestMatch: *mut *mut WAVEFORMATEX, + ) -> HRESULT, + fn GetMixFormat( + ppDeviceFormat: *mut *mut WAVEFORMATEX, + ) -> HRESULT, + fn GetDevicePeriod( + phnsDefaultDevicePeriod: *mut REFERENCE_TIME, + phnsMinimumDevicePeriod: *mut REFERENCE_TIME, + ) -> HRESULT, + fn Start() -> HRESULT, + fn Stop() -> HRESULT, + fn Reset() -> HRESULT, + fn SetEventHandle( + eventHandle: HANDLE, + ) -> HRESULT, + fn GetService( + riid: REFIID, + ppv: *mut LPVOID, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xf294acfc, 0x3146, 0x4483, 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2)] +interface IAudioRenderClient(IAudioRenderClientVtbl): IUnknown(IUnknownVtbl) { + fn GetBuffer( + NumFramesRequested: UINT32, + ppData: *mut *mut BYTE, + ) -> HRESULT, + fn ReleaseBuffer( + NumFramesWritten: UINT32, + dwFlags: DWORD, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xc8adbd64, 0xe71e, 0x48a0, 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17)] +interface IAudioCaptureClient(IAudioCaptureClientVtbl): IUnknown(IUnknownVtbl) { + fn GetBuffer( + ppData: *mut *mut BYTE, + pNumFramesToRead: *mut UINT32, + pdwFlags: *mut DWORD, + pu64DevicePosition: *mut UINT64, + pu64QPCPosition: *mut UINT64, + ) -> HRESULT, + fn ReleaseBuffer( + NumFramesRead: UINT32, + ) -> HRESULT, + fn GetNextPacketSize( + pNumFramesInNextPacket: *mut UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xcd63314f, 0x3fba, 0x4a1b, 0x81, 0x2c, 0xef, 0x96, 0x35, 0x87, 0x28, 0xe7)] +interface IAudioClock(IAudioClockVtbl): IUnknown(IUnknownVtbl) { + fn GetFrequency( + pu64Frequency: *mut UINT64, + ) -> HRESULT, + fn GetPosition( + pu64Position: *mut UINT64, + pu64QPCPosition: *mut UINT64, + ) -> HRESULT, + fn GetCharacteristics( + pdwCharacteristics: *mut DWORD, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x93014887, 0x242d, 0x4068, 0x8a, 0x15, 0xcf, 0x5e, 0x93, 0xb9, 0x0f, 0xe3)] +interface IAudioStreamVolume(IAudioStreamVolumeVtbl): IUnknown(IUnknownVtbl) { + fn GetChannelCount( + pdwCount: *mut UINT32, + ) -> HRESULT, + fn SetChannelVolume( + dwIndex: UINT32, + fLevel: c_float, + ) -> HRESULT, + fn GetChannelVolume( + dwIndex: UINT32, + pfLevel: *mut c_float, + ) -> HRESULT, + fn SetAllVolumes( + dwCount: UINT32, + pfVolumes: *const c_float, + ) -> HRESULT, + fn GetAllVolumes( + dwCount: UINT32, + pfVolumes: *mut c_float, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/audiosessiontypes.rs b/src/vendor/winapi/src/um/audiosessiontypes.rs new file mode 100644 index 0000000000..135c769c54 --- /dev/null +++ b/src/vendor/winapi/src/um/audiosessiontypes.rs @@ -0,0 +1,38 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::DWORD; +ENUM!{enum AUDCLNT_SHAREMODE { + AUDCLNT_SHAREMODE_SHARED, + AUDCLNT_SHAREMODE_EXCLUSIVE, +}} +ENUM!{enum AUDIO_STREAM_CATEGORY { + AudioCategory_Other = 0, + AudioCategory_ForegroundOnlyMedia = 1, + AudioCategory_BackgroundCapableMedia = 2, + AudioCategory_Communications = 3, + AudioCategory_Alerts = 4, + AudioCategory_SoundEffects = 5, + AudioCategory_GameEffects = 6, + AudioCategory_GameMedia = 7, + AudioCategory_GameChat = 8, + AudioCategory_Speech = 9, + AudioCategory_Movie = 10, + AudioCategory_Media = 11, +}} +pub const AUDCLNT_STREAMFLAGS_CROSSPROCESS: DWORD = 0x00010000; +pub const AUDCLNT_STREAMFLAGS_LOOPBACK: DWORD = 0x00020000; +pub const AUDCLNT_STREAMFLAGS_EVENTCALLBACK: DWORD = 0x00040000; +pub const AUDCLNT_STREAMFLAGS_NOPERSIST: DWORD = 0x00080000; +pub const AUDCLNT_STREAMFLAGS_RATEADJUST: DWORD = 0x00100000; +pub const AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED: DWORD = 0x10000000; +pub const AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE: DWORD = 0x20000000; +pub const AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED: DWORD = 0x40000000; +ENUM!{enum AudioSessionState { + AudioSessionStateInactive = 0, + AudioSessionStateActive = 1, + AudioSessionStateExpired = 2, +}} diff --git a/src/vendor/winapi/src/um/avrt.rs b/src/vendor/winapi/src/um/avrt.rs new file mode 100644 index 0000000000..01e131db27 --- /dev/null +++ b/src/vendor/winapi/src/um/avrt.rs @@ -0,0 +1,83 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_longlong; +use shared::guiddef::GUID; +use shared::minwindef::{BOOL, LPDWORD, PULONG}; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR, PHANDLE, PLARGE_INTEGER}; +ENUM!{enum AVRT_PRIORITY { + AVRT_PRIORITY_VERYLOW = -2i32 as u32, + AVRT_PRIORITY_LOW, + AVRT_PRIORITY_NORMAL = 0, + AVRT_PRIORITY_HIGH, + AVRT_PRIORITY_CRITICAL, +}} +pub const THREAD_ORDER_GROUP_INFINITE_TIMEOUT: c_longlong = -1; +extern "system" { + pub fn AvSetMmThreadCharacteristicsA( + TaskName: LPCSTR, + TaskIndex: LPDWORD, + ) -> HANDLE; + pub fn AvSetMmThreadCharacteristicsW( + TaskName: LPCWSTR, + TaskIndex: LPDWORD, + ) -> HANDLE; + pub fn AvSetMmMaxThreadCharacteristicsA( + FirstTask: LPCSTR, + SecondTask: LPCSTR, + TaskIndex: LPDWORD, + ) -> HANDLE; + pub fn AvSetMmMaxThreadCharacteristicsW( + FirstTask: LPCWSTR, + SecondTask: LPCWSTR, + TaskIndex: LPDWORD, + ) -> HANDLE; + pub fn AvRevertMmThreadCharacteristics( + avrt_handle: HANDLE, + ) -> BOOL; + pub fn AvSetMmThreadPriority( + AvrtHandle: HANDLE, + Priority: AVRT_PRIORITY, + ) -> BOOL; + pub fn AvRtCreateThreadOrderingGroup( + Context: PHANDLE, + Period: PLARGE_INTEGER, + ThreadOrderingGuid: *mut GUID, + Timeout: PLARGE_INTEGER, + ) -> BOOL; + pub fn AvRtCreateThreadOrderingGroupExA( + Context: PHANDLE, + Period: PLARGE_INTEGER, + ThreadOrderingGuid: *mut GUID, + Timeout: PLARGE_INTEGER, + TaskName: LPCSTR, + )-> BOOL; + pub fn AvRtCreateThreadOrderingGroupExW( + Context: PHANDLE, + Period: PLARGE_INTEGER, + ThreadOrderingGuid: *mut GUID, + Timeout: PLARGE_INTEGER, + TaskName: LPCWSTR, + ) -> BOOL; + pub fn AvRtJoinThreadOrderingGroup( + Context: PHANDLE, + ThreadOrderingGuid: *mut GUID, + Before: BOOL, + ) -> BOOL; + pub fn AvRtWaitOnThreadOrderingGroup( + Context: HANDLE, + ) -> BOOL; + pub fn AvRtLeaveThreadOrderingGroup( + Context: HANDLE, + ) -> BOOL; + pub fn AvRtDeleteThreadOrderingGroup( + Context: HANDLE, + ) -> BOOL; + pub fn AvQuerySystemResponsiveness( + AvrtHandle: HANDLE, + SystemResponsivenessValue: PULONG, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/cfgmgr32.rs b/src/vendor/winapi/src/um/cfgmgr32.rs new file mode 100644 index 0000000000..4b1d017de7 --- /dev/null +++ b/src/vendor/winapi/src/um/cfgmgr32.rs @@ -0,0 +1,2043 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! user APIs for the Configuration Manager +use shared::basetsd::{DWORD_PTR, ULONG32, ULONG64, ULONG_PTR}; +use shared::cfg::PPNP_VETO_TYPE; +use shared::guiddef::{GUID, LPGUID}; +use shared::minwindef::{BOOL, BYTE, DWORD, MAX_PATH, PBOOL, PHKEY, PULONG, ULONG, WORD}; +use um::winnt::{ + ANYSIZE_ARRAY, CHAR, DWORDLONG, HANDLE, LARGE_INTEGER, LONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, + PCHAR, PCSTR, PCWSTR, PDWORDLONG, PSTR, PVOID, PWCHAR, PWSTR, ULONGLONG, VOID, WCHAR +}; +use um::winreg::REGSAM; +pub type PCVOID = *const VOID; +pub const MAX_DEVICE_ID_LEN: usize = 200; +pub const MAX_DEVNODE_ID_LEN: usize = MAX_DEVICE_ID_LEN; +pub const MAX_GUID_STRING_LEN: usize = 39; +pub const MAX_CLASS_NAME_LEN: usize = 32; +pub const MAX_PROFILE_LEN: usize = 80; +pub const MAX_CONFIG_VALUE: DWORD = 9999; +pub const MAX_INSTANCE_VALUE: DWORD = 9999; +pub const MAX_MEM_REGISTERS: DWORD = 9; +pub const MAX_IO_PORTS: DWORD = 20; +pub const MAX_IRQS: DWORD = 7; +pub const MAX_DMA_CHANNELS: DWORD = 7; +pub const DWORD_MAX: DWORD = 0xffffffff; +pub const DWORDLONG_MAX: DWORDLONG = 0xffffffffffffffff; +pub const CONFIGMG_VERSION: DWORD = 0x0400; +pub type RETURN_TYPE = DWORD; +pub type CONFIGRET = RETURN_TYPE; +pub type DEVNODE = DWORD; +pub type DEVINST = DWORD; +pub type PDEVNODE = *mut DEVNODE; +pub type PDEVINST = *mut DEVNODE; +pub type DEVNODEID_A = *mut CHAR; +pub type DEVINSTID_A = *mut CHAR; +pub type DEVNODEID_W = *mut WCHAR; +pub type DEVINSTID_W = *mut WCHAR; +pub type LOG_CONF = DWORD_PTR; +pub type PLOG_CONF = *mut LOG_CONF; +pub type RES_DES = DWORD_PTR; +pub type PRES_DES = *mut RES_DES; +pub type RESOURCEID = ULONG; +pub type PRESOURCEID = *mut RESOURCEID; +pub type PRIORITY = ULONG; +pub type PPRIORITY = *mut PRIORITY; +pub type RANGE_LIST = DWORD_PTR; +pub type PRANGE_LIST = *mut RANGE_LIST; +pub type RANGE_ELEMENT = DWORD_PTR; +pub type PRANGE_ELEMENT = *mut RANGE_ELEMENT; +pub type HMACHINE = HANDLE; +pub type PHMACHINE = *mut HMACHINE; +pub type CONFLICT_LIST = ULONG_PTR; +pub type PCONFLICT_LIST = *mut CONFLICT_LIST; +STRUCT!{struct CONFLICT_DETAILS_A { + CD_ulSize: ULONG, + CD_ulMask: ULONG, + CD_dnDevInst: DEVINST, + CD_rdResDes: RES_DES, + CD_ulFlags: ULONG, + CD_szDescription: [CHAR; MAX_PATH], +}} +pub type PCONFLICT_DETAILS_A = *mut CONFLICT_DETAILS_A; +STRUCT!{struct CONFLICT_DETAILS_W { + CD_ulSize: ULONG, + CD_ulMask: ULONG, + CD_dnDevInst: DEVINST, + CD_rdResDes: RES_DES, + CD_ulFlags: ULONG, + CD_szDescription: [WCHAR; MAX_PATH], +}} +pub type PCONFLICT_DETAILS_W = *mut CONFLICT_DETAILS_W; +pub const CM_CDMASK_DEVINST: ULONG = 0x00000001; +pub const CM_CDMASK_RESDES: ULONG = 0x00000002; +pub const CM_CDMASK_FLAGS: ULONG = 0x00000004; +pub const CM_CDMASK_DESCRIPTION: ULONG = 0x00000008; +pub const CM_CDMASK_VALID: ULONG = 0x0000000F; +pub const CM_CDFLAGS_DRIVER: ULONG = 0x00000001; +pub const CM_CDFLAGS_ROOT_OWNED: ULONG = 0x00000002; +pub const CM_CDFLAGS_RESERVED: ULONG = 0x00000004; +pub type REGDISPOSITION = ULONG; +pub const mMD_MemoryType: DWORD = 0x1; +pub const fMD_MemoryType: DWORD = mMD_MemoryType; +pub const fMD_ROM: DWORD = 0x0; +pub const fMD_RAM: DWORD = 0x1; +pub const mMD_32_24: DWORD = 0x2; +pub const fMD_32_24: DWORD = mMD_32_24; +pub const fMD_24: DWORD = 0x0; +pub const fMD_32: DWORD = 0x2; +pub const mMD_Prefetchable: DWORD = 0x4; +pub const fMD_Prefetchable: DWORD = mMD_Prefetchable; +pub const fMD_Pref: DWORD = mMD_Prefetchable; +pub const fMD_PrefetchDisallowed: DWORD = 0x0; +pub const fMD_PrefetchAllowed: DWORD = 0x4; +pub const mMD_Readable: DWORD = 0x8; +pub const fMD_Readable: DWORD = mMD_Readable; +pub const fMD_ReadAllowed: DWORD = 0x0; +pub const fMD_ReadDisallowed: DWORD = 0x8; +pub const mMD_CombinedWrite: DWORD = 0x10; +pub const fMD_CombinedWrite: DWORD = mMD_CombinedWrite; +pub const fMD_CombinedWriteDisallowed: DWORD = 0x0; +pub const fMD_CombinedWriteAllowed: DWORD = 0x10; +pub const mMD_Cacheable: DWORD = 0x20; +pub const fMD_NonCacheable: DWORD = 0x0; +pub const fMD_Cacheable: DWORD = 0x20; +pub const fMD_WINDOW_DECODE: DWORD = 0x40; +pub const fMD_MEMORY_BAR: DWORD = 0x80; +STRUCT!{struct MEM_RANGE { + MR_Align: DWORDLONG, + MR_nBytes: ULONG, + MR_Min: DWORDLONG, + MR_Max: DWORDLONG, + MR_Flags: DWORD, + MR_Reserved: DWORD, +}} +pub type PMEM_RANGE = *mut MEM_RANGE; +STRUCT!{struct MEM_DES { + MD_Count: DWORD, + MD_Type: DWORD, + MD_Alloc_Base: DWORDLONG, + MD_Alloc_End: DWORDLONG, + MD_Flags: DWORD, + MD_Reserved: DWORD, +}} +pub type PMEM_DES = *mut MEM_DES; +STRUCT!{struct MEM_RESOURCE { + MEM_Header: MEM_DES, + MEM_Data: [MEM_RANGE; ANYSIZE_ARRAY], +}} +pub type PMEM_RESOURCE = *mut MEM_RESOURCE; +STRUCT!{struct MEM_LARGE_RANGE { + MLR_Align: DWORDLONG, + MLR_nBytes: ULONGLONG, + MLR_Min: DWORDLONG, + MLR_Max: DWORDLONG, + MLR_Flags: DWORD, + MLR_Reserved: DWORD, +}} +pub type PMEM_LARGE_RANGE = *mut MEM_LARGE_RANGE; +STRUCT!{struct MEM_LARGE_DES { + MLD_Count: DWORD, + MLD_Type: DWORD, + MLD_Alloc_Base: DWORDLONG, + MLD_Alloc_End: DWORDLONG, + MLD_Flags: DWORD, + MLD_Reserved: DWORD, +}} +pub type PMEM_LARGE_DES = *mut MEM_LARGE_DES; +STRUCT!{struct MEM_LARGE_RESOURCE { + MEM_LARGE_Header: MEM_LARGE_DES, + MEM_LARGE_Data: [MEM_LARGE_RANGE; ANYSIZE_ARRAY], +}} +pub type PMEM_LARGE_RESOURCE = *mut MEM_LARGE_RESOURCE; +pub const fIOD_PortType: DWORD = 0x1; +pub const fIOD_Memory: DWORD = 0x0; +pub const fIOD_IO: DWORD = 0x1; +pub const fIOD_DECODE: DWORD = 0x00fc; +pub const fIOD_10_BIT_DECODE: DWORD = 0x0004; +pub const fIOD_12_BIT_DECODE: DWORD = 0x0008; +pub const fIOD_16_BIT_DECODE: DWORD = 0x0010; +pub const fIOD_POSITIVE_DECODE: DWORD = 0x0020; +pub const fIOD_PASSIVE_DECODE: DWORD = 0x0040; +pub const fIOD_WINDOW_DECODE: DWORD = 0x0080; +pub const fIOD_PORT_BAR: DWORD = 0x0100; +pub const IO_ALIAS_10_BIT_DECODE: DWORDLONG = 0x00000004; +pub const IO_ALIAS_12_BIT_DECODE: DWORDLONG = 0x00000010; +pub const IO_ALIAS_16_BIT_DECODE: DWORDLONG = 0x00000000; +pub const IO_ALIAS_POSITIVE_DECODE: DWORDLONG = 0x000000FF; +STRUCT!{struct IO_RANGE { + IOR_Align: DWORDLONG, + IOR_nPorts: DWORD, + IOR_Min: DWORDLONG, + IOR_Max: DWORDLONG, + IOR_RangeFlags: DWORD, + IOR_Alias: DWORDLONG, +}} +pub type PIO_RANGE = *mut IO_RANGE; +STRUCT!{struct IO_DES { + IOD_Count: DWORD, + IOD_Type: DWORD, + IOD_Alloc_Base: DWORDLONG, + IOD_Alloc_End: DWORDLONG, + IOD_DesFlags: DWORD, +}} +pub type PIO_DES = *mut IO_DES; +STRUCT!{struct IO_RESOURCE { + IO_Header: IO_DES, + IO_Data: [IO_RANGE; ANYSIZE_ARRAY], +}} +pub type PIO_RESOURCE = *mut IO_RESOURCE; +pub const mDD_Width: ULONG = 0x3; +pub const fDD_BYTE: ULONG = 0x0; +pub const fDD_WORD: ULONG = 0x1; +pub const fDD_DWORD: ULONG = 0x2; +pub const fDD_BYTE_AND_WORD: ULONG = 0x3; +pub const mDD_BusMaster: ULONG = 0x4; +pub const fDD_NoBusMaster: ULONG = 0x0; +pub const fDD_BusMaster: ULONG = 0x4; +pub const mDD_Type: ULONG = 0x18; +pub const fDD_TypeStandard: ULONG = 0x00; +pub const fDD_TypeA: ULONG = 0x08; +pub const fDD_TypeB: ULONG = 0x10; +pub const fDD_TypeF: ULONG = 0x18; +STRUCT!{struct DMA_RANGE { + DR_Min: ULONG, + DR_Max: ULONG, + DR_Flags: ULONG, +}} +pub type PDMA_RANGE = *mut DMA_RANGE; +STRUCT!{struct DMA_DES { + DD_Count: DWORD, + DD_Type: DWORD, + DD_Flags: DWORD, + DD_Alloc_Chan: ULONG, +}} +pub type PDMA_DES = *mut DMA_DES; +STRUCT!{struct DMA_RESOURCE { + DMA_Header: DMA_DES, + DMA_Data: [DMA_RANGE; ANYSIZE_ARRAY], +}} +pub type PDMA_RESOURCE = *mut DMA_RESOURCE; +pub const mIRQD_Share: ULONG = 0x1; +pub const fIRQD_Exclusive: ULONG = 0x0; +pub const fIRQD_Share: ULONG = 0x1; +pub const fIRQD_Share_Bit: ULONG = 0; +pub const fIRQD_Level_Bit: ULONG = 1; +pub const mIRQD_Edge_Level: ULONG = 0x2; +pub const fIRQD_Level: ULONG = 0x0; +pub const fIRQD_Edge: ULONG = 0x2; +STRUCT!{struct IRQ_RANGE { + IRQR_Min: ULONG, + IRQR_Max: ULONG, + IRQR_Flags: ULONG, +}} +pub type PIRQ_RANGE = *mut IRQ_RANGE; +STRUCT!{struct IRQ_DES_32 { + IRQD_Count: DWORD, + IRQD_Type: DWORD, + IRQD_Flags: DWORD, + IRQD_Alloc_Num: ULONG, + IRQD_Affinity: ULONG32, +}} +pub type PIRQ_DES_32 = *mut IRQ_DES_32; +STRUCT!{struct IRQ_DES_64 { + IRQD_Count: DWORD, + IRQD_Type: DWORD, + IRQD_Flags: DWORD, + IRQD_Alloc_Num: ULONG, + IRQD_Affinity: ULONG64, +}} +pub type PIRQ_DES_64 = *mut IRQ_DES_64; +STRUCT!{struct IRQ_RESOURCE_32 { + IRQ_Header: IRQ_DES_32, + IRQ_Data: [IRQ_RANGE; ANYSIZE_ARRAY], +}} +pub type PIRQ_RESOURCE_32 = *mut IRQ_RESOURCE_32; +STRUCT!{struct IRQ_RESOURCE_64 { + IRQ_Header: IRQ_DES_64, + IRQ_Data: [IRQ_RANGE; ANYSIZE_ARRAY], +}} +pub type PIRQ_RESOURCE_64 = *mut IRQ_RESOURCE_64; +STRUCT!{struct DEVPRIVATE_RANGE { + PR_Data1: DWORD, + PR_Data2: DWORD, + PR_Data3: DWORD, +}} +pub type PDEVPRIVATE_RANGE = *mut DEVPRIVATE_RANGE; +STRUCT!{struct DEVPRIVATE_DES { + PD_Count: DWORD, + PD_Type: DWORD, + PD_Data1: DWORD, + PD_Data2: DWORD, + PD_Data3: DWORD, + PD_Flags: DWORD, +}} +pub type PDEVPRIVATE_DES = *mut DEVPRIVATE_DES; +STRUCT!{struct DEVPRIVATE_RESOURCE { + PRV_Header: DEVPRIVATE_DES, + PRV_Data: [DEVPRIVATE_RANGE; ANYSIZE_ARRAY], +}} +pub type PDEVPRIVATE_RESOURCE = *mut DEVPRIVATE_RESOURCE; +STRUCT!{struct CS_DES { + CSD_SignatureLength: DWORD, + CSD_LegacyDataOffset: DWORD, + CSD_LegacyDataSize: DWORD, + CSD_Flags: DWORD, + CSD_ClassGuid: GUID, + CSD_Signature: [BYTE; ANYSIZE_ARRAY], +}} +pub type PCS_DES = *mut CS_DES; +STRUCT!{struct CS_RESOURCE { + CS_Header: CS_DES, +}} +pub type PCS_RESOURCE = *mut CS_RESOURCE; +pub const mPCD_IO_8_16: DWORD = 0x1; +pub const fPCD_IO_8: DWORD = 0x0; +pub const fPCD_IO_16: DWORD = 0x1; +pub const mPCD_MEM_8_16: DWORD = 0x2; +pub const fPCD_MEM_8: DWORD = 0x0; +pub const fPCD_MEM_16: DWORD = 0x2; +pub const mPCD_MEM_A_C: DWORD = 0xC; +pub const fPCD_MEM1_A: DWORD = 0x4; +pub const fPCD_MEM2_A: DWORD = 0x8; +pub const fPCD_IO_ZW_8: DWORD = 0x10; +pub const fPCD_IO_SRC_16: DWORD = 0x20; +pub const fPCD_IO_WS_16: DWORD = 0x40; +pub const mPCD_MEM_WS: DWORD = 0x300; +pub const fPCD_MEM_WS_ONE: DWORD = 0x100; +pub const fPCD_MEM_WS_TWO: DWORD = 0x200; +pub const fPCD_MEM_WS_THREE: DWORD = 0x300; +pub const fPCD_MEM_A: DWORD = 0x4; +pub const fPCD_ATTRIBUTES_PER_WINDOW: DWORD = 0x8000; +pub const fPCD_IO1_16: DWORD = 0x00010000; +pub const fPCD_IO1_ZW_8: DWORD = 0x00020000; +pub const fPCD_IO1_SRC_16: DWORD = 0x00040000; +pub const fPCD_IO1_WS_16: DWORD = 0x00080000; +pub const fPCD_IO2_16: DWORD = 0x00100000; +pub const fPCD_IO2_ZW_8: DWORD = 0x00200000; +pub const fPCD_IO2_SRC_16: DWORD = 0x00400000; +pub const fPCD_IO2_WS_16: DWORD = 0x00800000; +pub const mPCD_MEM1_WS: DWORD = 0x03000000; +pub const fPCD_MEM1_WS_TWO: DWORD = 0x02000000; +pub const fPCD_MEM1_WS_THREE: DWORD = 0x03000000; +pub const fPCD_MEM1_16: DWORD = 0x04000000; +pub const mPCD_MEM2_WS: DWORD = 0x30000000; +pub const fPCD_MEM2_WS_ONE: DWORD = 0x10000000; +pub const fPCD_MEM2_WS_TWO: DWORD = 0x20000000; +pub const fPCD_MEM2_WS_THREE: DWORD = 0x30000000; +pub const fPCD_MEM2_16: DWORD = 0x40000000; +pub const PCD_MAX_MEMORY: usize = 2; +pub const PCD_MAX_IO: usize = 2; +STRUCT!{struct PCCARD_DES { + PCD_Count: DWORD, + PCD_Type: DWORD, + PCD_Flags: DWORD, + PCD_ConfigIndex: BYTE, + PCD_Reserved: [BYTE; 3], + PCD_MemoryCardBase1: DWORD, + PCD_MemoryCardBase2: DWORD, + PCD_MemoryCardBase: [DWORD; PCD_MAX_MEMORY], + PCD_MemoryFlags: [WORD; PCD_MAX_MEMORY], + PCD_IoFlags: [BYTE; PCD_MAX_IO], +}} +pub type PPCCARD_DES = *mut PCCARD_DES; +STRUCT!{struct PCCARD_RESOURCE { + PcCard_Header: PCCARD_DES, +}} +pub type PPCCARD_RESOURCE = *mut PCCARD_RESOURCE; +pub const mPMF_AUDIO_ENABLE: DWORD = 0x8; +pub const fPMF_AUDIO_ENABLE: DWORD = 0x8; +STRUCT!{struct MFCARD_DES { + PMF_Count: DWORD, + PMF_Type: DWORD, + PMF_Flags: DWORD, + PMF_ConfigOptions: BYTE, + PMF_IoResourceIndex: BYTE, + PMF_Reserved: [BYTE; 2], + PMF_ConfigRegisterBase: DWORD, +}} +pub type PMFCARD_DES = *mut MFCARD_DES; +STRUCT!{struct MFCARD_RESOURCE { + MfCard_Header: MFCARD_DES, +}} +pub type PMFCARD_RESOURCE = *mut MFCARD_RESOURCE; +STRUCT!{struct BUSNUMBER_RANGE { + BUSR_Min: ULONG, + BUSR_Max: ULONG, + BUSR_nBusNumbers: ULONG, + BUSR_Flags: ULONG, +}} +pub type PBUSNUMBER_RANGE = *mut BUSNUMBER_RANGE; +STRUCT!{struct BUSNUMBER_DES { + BUSD_Count: DWORD, + BUSD_Type: DWORD, + BUSD_Flags: DWORD, + BUSD_Alloc_Base: ULONG, + BUSD_Alloc_End: ULONG, +}} +pub type PBUSNUMBER_DES = *mut BUSNUMBER_DES; +STRUCT!{struct BUSNUMBER_RESOURCE { + BusNumber_Header: BUSNUMBER_DES, + BusNumber_Data: [BUSNUMBER_RANGE; ANYSIZE_ARRAY], +}} +pub type PBUSNUMBER_RESOURCE = *mut BUSNUMBER_RESOURCE; +STRUCT!{struct CONNECTION_DES { + COND_Type: DWORD, + COND_Flags: DWORD, + COND_Class: BYTE, + COND_ClassType: BYTE, + COND_Reserved1: BYTE, + COND_Reserved2: BYTE, + COND_Id: LARGE_INTEGER, +}} +pub type PCONNECTION_DES = *mut CONNECTION_DES; +STRUCT!{struct CONNECTION_RESOURCE { + Connection_Header: CONNECTION_DES, +}} +pub type PCONNECTION_RESOURCE = *mut CONNECTION_RESOURCE; +pub const CM_HWPI_NOT_DOCKABLE: DWORD = 0x00000000; +pub const CM_HWPI_UNDOCKED: DWORD = 0x00000001; +pub const CM_HWPI_DOCKED: DWORD = 0x00000002; +STRUCT!{struct HWPROFILEINFO_A { + HWPI_ulHWProfile: ULONG, + HWPI_szFriendlyName: [CHAR; MAX_PROFILE_LEN], + HWPI_dwFlags: DWORD, +}} +pub type PHWPROFILEINFO_A = *mut HWPROFILEINFO_A; +STRUCT!{struct HWPROFILEINFO_W { + HWPI_ulHWProfile: ULONG, + HWPI_szFriendlyName: [WCHAR; MAX_PROFILE_LEN], + HWPI_dwFlags: DWORD, +}} +pub type PHWPROFILEINFO_W = *mut HWPROFILEINFO_W; +pub const ResType_All: RESOURCEID = 0x00000000; +pub const ResType_None: RESOURCEID = 0x00000000; +pub const ResType_Mem: RESOURCEID = 0x00000001; +pub const ResType_IO: RESOURCEID = 0x00000002; +pub const ResType_DMA: RESOURCEID = 0x00000003; +pub const ResType_IRQ: RESOURCEID = 0x00000004; +pub const ResType_DoNotUse: RESOURCEID = 0x00000005; +pub const ResType_BusNumber: RESOURCEID = 0x00000006; +pub const ResType_MemLarge: RESOURCEID = 0x00000007; +pub const ResType_MAX: RESOURCEID = 0x00000007; +pub const ResType_Ignored_Bit: RESOURCEID = 0x00008000; +pub const ResType_ClassSpecific: RESOURCEID = 0x0000FFFF; +pub const ResType_Reserved: RESOURCEID = 0x00008000; +pub const ResType_DevicePrivate: RESOURCEID = 0x00008001; +pub const ResType_PcCardConfig: RESOURCEID = 0x00008002; +pub const ResType_MfCardConfig: RESOURCEID = 0x00008003; +pub const ResType_Connection: RESOURCEID = 0x00008004; +pub const CM_ADD_RANGE_ADDIFCONFLICT: ULONG = 0x00000000; +pub const CM_ADD_RANGE_DONOTADDIFCONFLICT: ULONG = 0x00000001; +pub const CM_ADD_RANGE_BITS: ULONG = 0x00000001; +pub const BASIC_LOG_CONF: ULONG = 0x00000000; +pub const FILTERED_LOG_CONF: ULONG = 0x00000001; +pub const ALLOC_LOG_CONF: ULONG = 0x00000002; +pub const BOOT_LOG_CONF: ULONG = 0x00000003; +pub const FORCED_LOG_CONF: ULONG = 0x00000004; +pub const OVERRIDE_LOG_CONF: ULONG = 0x00000005; +pub const NUM_LOG_CONF: ULONG = 0x00000006; +pub const LOG_CONF_BITS: ULONG = 0x00000007; +pub const PRIORITY_EQUAL_FIRST: ULONG = 0x00000008; +pub const PRIORITY_EQUAL_LAST: ULONG = 0x00000000; +pub const PRIORITY_BIT: ULONG = 0x00000008; +pub const RegDisposition_OpenAlways: REGDISPOSITION = 0x00000000; +pub const RegDisposition_OpenExisting: REGDISPOSITION = 0x00000001; +pub const RegDisposition_Bits: REGDISPOSITION = 0x00000001; +pub const CM_ADD_ID_HARDWARE: ULONG = 0x00000000; +pub const CM_ADD_ID_COMPATIBLE: ULONG = 0x00000001; +pub const CM_ADD_ID_BITS: ULONG = 0x00000001; +pub const CM_CREATE_DEVNODE_NORMAL: ULONG = 0x00000000; +pub const CM_CREATE_DEVNODE_NO_WAIT_INSTALL: ULONG = 0x00000001; +pub const CM_CREATE_DEVNODE_PHANTOM: ULONG = 0x00000002; +pub const CM_CREATE_DEVNODE_GENERATE_ID: ULONG = 0x00000004; +pub const CM_CREATE_DEVNODE_DO_NOT_INSTALL: ULONG = 0x00000008; +pub const CM_CREATE_DEVNODE_BITS: ULONG = 0x0000000F; +pub const CM_CREATE_DEVINST_NORMAL: ULONG = CM_CREATE_DEVNODE_NORMAL; +pub const CM_CREATE_DEVINST_NO_WAIT_INSTALL: ULONG = CM_CREATE_DEVNODE_NO_WAIT_INSTALL; +pub const CM_CREATE_DEVINST_PHANTOM: ULONG = CM_CREATE_DEVNODE_PHANTOM; +pub const CM_CREATE_DEVINST_GENERATE_ID: ULONG = CM_CREATE_DEVNODE_GENERATE_ID; +pub const CM_CREATE_DEVINST_DO_NOT_INSTALL: ULONG = CM_CREATE_DEVNODE_DO_NOT_INSTALL; +pub const CM_CREATE_DEVINST_BITS: ULONG = CM_CREATE_DEVNODE_BITS; +pub const CM_DELETE_CLASS_ONLY: ULONG = 0x00000000; +pub const CM_DELETE_CLASS_SUBKEYS: ULONG = 0x00000001; +pub const CM_DELETE_CLASS_INTERFACE: ULONG = 0x00000002; +pub const CM_DELETE_CLASS_BITS: ULONG = 0x00000003; +pub const CM_ENUMERATE_CLASSES_INSTALLER: ULONG = 0x00000000; +pub const CM_ENUMERATE_CLASSES_INTERFACE: ULONG = 0x00000001; +pub const CM_ENUMERATE_CLASSES_BITS: ULONG = 0x00000001; +pub const CM_DETECT_NEW_PROFILE: ULONG = 0x00000001; +pub const CM_DETECT_CRASHED: ULONG = 0x00000002; +pub const CM_DETECT_HWPROF_FIRST_BOOT: ULONG = 0x00000004; +pub const CM_DETECT_RUN: ULONG = 0x80000000; +pub const CM_DETECT_BITS: ULONG = 0x80000007; +pub const CM_DISABLE_POLITE: ULONG = 0x00000000; +pub const CM_DISABLE_ABSOLUTE: ULONG = 0x00000001; +pub const CM_DISABLE_HARDWARE: ULONG = 0x00000002; +pub const CM_DISABLE_UI_NOT_OK: ULONG = 0x00000004; +pub const CM_DISABLE_BITS: ULONG = 0x00000007; +pub const CM_GETIDLIST_FILTER_NONE: ULONG = 0x00000000; +pub const CM_GETIDLIST_FILTER_ENUMERATOR: ULONG = 0x00000001; +pub const CM_GETIDLIST_FILTER_SERVICE: ULONG = 0x00000002; +pub const CM_GETIDLIST_FILTER_EJECTRELATIONS: ULONG = 0x00000004; +pub const CM_GETIDLIST_FILTER_REMOVALRELATIONS: ULONG = 0x00000008; +pub const CM_GETIDLIST_FILTER_POWERRELATIONS: ULONG = 0x00000010; +pub const CM_GETIDLIST_FILTER_BUSRELATIONS: ULONG = 0x00000020; +pub const CM_GETIDLIST_DONOTGENERATE: ULONG = 0x10000040; +pub const CM_GETIDLIST_FILTER_TRANSPORTRELATIONS: ULONG = 0x00000080; +pub const CM_GETIDLIST_FILTER_PRESENT: ULONG = 0x00000100; +pub const CM_GETIDLIST_FILTER_CLASS: ULONG = 0x00000200; +pub const CM_GETIDLIST_FILTER_BITS: ULONG = 0x100003FF; +pub const CM_GET_DEVICE_INTERFACE_LIST_PRESENT: ULONG = 0x00000000; +pub const CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES: ULONG = 0x00000001; +pub const CM_GET_DEVICE_INTERFACE_LIST_BITS: ULONG = 0x00000001; +pub const CM_DRP_DEVICEDESC: ULONG = 0x00000001; +pub const CM_DRP_HARDWAREID: ULONG = 0x00000002; +pub const CM_DRP_COMPATIBLEIDS: ULONG = 0x00000003; +pub const CM_DRP_UNUSED0: ULONG = 0x00000004; +pub const CM_DRP_SERVICE: ULONG = 0x00000005; +pub const CM_DRP_UNUSED1: ULONG = 0x00000006; +pub const CM_DRP_UNUSED2: ULONG = 0x00000007; +pub const CM_DRP_CLASS: ULONG = 0x00000008; +pub const CM_DRP_CLASSGUID: ULONG = 0x00000009; +pub const CM_DRP_DRIVER: ULONG = 0x0000000A; +pub const CM_DRP_CONFIGFLAGS: ULONG = 0x0000000B; +pub const CM_DRP_MFG: ULONG = 0x0000000C; +pub const CM_DRP_FRIENDLYNAME: ULONG = 0x0000000D; +pub const CM_DRP_LOCATION_INFORMATION: ULONG = 0x0000000E; +pub const CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME: ULONG = 0x0000000F; +pub const CM_DRP_CAPABILITIES: ULONG = 0x00000010; +pub const CM_DRP_UI_NUMBER: ULONG = 0x00000011; +pub const CM_DRP_UPPERFILTERS: ULONG = 0x00000012; +pub const CM_CRP_UPPERFILTERS: ULONG = CM_DRP_UPPERFILTERS; +pub const CM_DRP_LOWERFILTERS: ULONG = 0x00000013; +pub const CM_CRP_LOWERFILTERS: ULONG = CM_DRP_LOWERFILTERS; +pub const CM_DRP_BUSTYPEGUID: ULONG = 0x00000014; +pub const CM_DRP_LEGACYBUSTYPE: ULONG = 0x00000015; +pub const CM_DRP_BUSNUMBER: ULONG = 0x00000016; +pub const CM_DRP_ENUMERATOR_NAME: ULONG = 0x00000017; +pub const CM_DRP_SECURITY: ULONG = 0x00000018; +pub const CM_CRP_SECURITY: ULONG = CM_DRP_SECURITY; +pub const CM_DRP_SECURITY_SDS: ULONG = 0x00000019; +pub const CM_CRP_SECURITY_SDS: ULONG = CM_DRP_SECURITY_SDS; +pub const CM_DRP_DEVTYPE: ULONG = 0x0000001A; +pub const CM_CRP_DEVTYPE: ULONG = CM_DRP_DEVTYPE; +pub const CM_DRP_EXCLUSIVE: ULONG = 0x0000001B; +pub const CM_CRP_EXCLUSIVE: ULONG = CM_DRP_EXCLUSIVE; +pub const CM_DRP_CHARACTERISTICS: ULONG = 0x0000001C; +pub const CM_CRP_CHARACTERISTICS: ULONG = CM_DRP_CHARACTERISTICS; +pub const CM_DRP_ADDRESS: ULONG = 0x0000001D; +pub const CM_DRP_UI_NUMBER_DESC_FORMAT: ULONG = 0x0000001E; +pub const CM_DRP_DEVICE_POWER_DATA: ULONG = 0x0000001F; +pub const CM_DRP_REMOVAL_POLICY: ULONG = 0x00000020; +pub const CM_DRP_REMOVAL_POLICY_HW_DEFAULT: ULONG = 0x00000021; +pub const CM_DRP_REMOVAL_POLICY_OVERRIDE: ULONG = 0x00000022; +pub const CM_DRP_INSTALL_STATE: ULONG = 0x00000023; +pub const CM_DRP_LOCATION_PATHS: ULONG = 0x00000024; +pub const CM_DRP_BASE_CONTAINERID: ULONG = 0x00000025; +pub const CM_DRP_MIN: ULONG = 0x00000001; +pub const CM_CRP_MIN: ULONG = CM_DRP_MIN; +pub const CM_DRP_MAX: ULONG = 0x00000025; +pub const CM_CRP_MAX: ULONG = CM_DRP_MAX; +pub const CM_DEVCAP_LOCKSUPPORTED: ULONG = 0x00000001; +pub const CM_DEVCAP_EJECTSUPPORTED: ULONG = 0x00000002; +pub const CM_DEVCAP_REMOVABLE: ULONG = 0x00000004; +pub const CM_DEVCAP_DOCKDEVICE: ULONG = 0x00000008; +pub const CM_DEVCAP_UNIQUEID: ULONG = 0x00000010; +pub const CM_DEVCAP_SILENTINSTALL: ULONG = 0x00000020; +pub const CM_DEVCAP_RAWDEVICEOK: ULONG = 0x00000040; +pub const CM_DEVCAP_SURPRISEREMOVALOK: ULONG = 0x00000080; +pub const CM_DEVCAP_HARDWAREDISABLED: ULONG = 0x00000100; +pub const CM_DEVCAP_NONDYNAMIC: ULONG = 0x00000200; +pub const CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL: ULONG = 1; +pub const CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL: ULONG = 2; +pub const CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL: ULONG = 3; +pub const CM_INSTALL_STATE_INSTALLED: ULONG = 0; +pub const CM_INSTALL_STATE_NEEDS_REINSTALL: ULONG = 1; +pub const CM_INSTALL_STATE_FAILED_INSTALL: ULONG = 2; +pub const CM_INSTALL_STATE_FINISH_INSTALL: ULONG = 3; +pub const CM_LOCATE_DEVNODE_NORMAL: ULONG = 0x00000000; +pub const CM_LOCATE_DEVNODE_PHANTOM: ULONG = 0x00000001; +pub const CM_LOCATE_DEVNODE_CANCELREMOVE: ULONG = 0x00000002; +pub const CM_LOCATE_DEVNODE_NOVALIDATION: ULONG = 0x00000004; +pub const CM_LOCATE_DEVNODE_BITS: ULONG = 0x00000007; +pub const CM_LOCATE_DEVINST_NORMAL: ULONG = CM_LOCATE_DEVNODE_NORMAL; +pub const CM_LOCATE_DEVINST_PHANTOM: ULONG = CM_LOCATE_DEVNODE_PHANTOM; +pub const CM_LOCATE_DEVINST_CANCELREMOVE: ULONG = CM_LOCATE_DEVNODE_CANCELREMOVE; +pub const CM_LOCATE_DEVINST_NOVALIDATION: ULONG = CM_LOCATE_DEVNODE_NOVALIDATION; +pub const CM_LOCATE_DEVINST_BITS: ULONG = CM_LOCATE_DEVNODE_BITS; +pub const CM_OPEN_CLASS_KEY_INSTALLER: ULONG = 0x00000000; +pub const CM_OPEN_CLASS_KEY_INTERFACE: ULONG = 0x00000001; +pub const CM_OPEN_CLASS_KEY_BITS: ULONG = 0x00000001; +pub const CM_REMOVE_UI_OK: ULONG = 0x00000000; +pub const CM_REMOVE_UI_NOT_OK: ULONG = 0x00000001; +pub const CM_REMOVE_NO_RESTART: ULONG = 0x00000002; +pub const CM_REMOVE_BITS: ULONG = 0x00000003; +pub const CM_QUERY_REMOVE_UI_OK: ULONG = CM_REMOVE_UI_OK; +pub const CM_QUERY_REMOVE_UI_NOT_OK: ULONG = CM_REMOVE_UI_NOT_OK; +pub const CM_QUERY_REMOVE_BITS: ULONG = CM_QUERY_REMOVE_UI_OK | CM_QUERY_REMOVE_UI_NOT_OK; +pub const CM_REENUMERATE_NORMAL: ULONG = 0x00000000; +pub const CM_REENUMERATE_SYNCHRONOUS: ULONG = 0x00000001; +pub const CM_REENUMERATE_RETRY_INSTALLATION: ULONG = 0x00000002; +pub const CM_REENUMERATE_ASYNCHRONOUS: ULONG = 0x00000004; +pub const CM_REENUMERATE_BITS: ULONG = 0x00000007; +pub const CM_REGISTER_DEVICE_DRIVER_STATIC: ULONG = 0x00000000; +pub const CM_REGISTER_DEVICE_DRIVER_DISABLEABLE: ULONG = 0x00000001; +pub const CM_REGISTER_DEVICE_DRIVER_REMOVABLE: ULONG = 0x00000002; +pub const CM_REGISTER_DEVICE_DRIVER_BITS: ULONG = 0x00000003; +pub const CM_REGISTRY_HARDWARE: ULONG = 0x00000000; +pub const CM_REGISTRY_SOFTWARE: ULONG = 0x00000001; +pub const CM_REGISTRY_USER: ULONG = 0x00000100; +pub const CM_REGISTRY_CONFIG: ULONG = 0x00000200; +pub const CM_REGISTRY_BITS: ULONG = 0x00000301; +pub const CM_SET_DEVNODE_PROBLEM_NORMAL: ULONG = 0x00000000; +pub const CM_SET_DEVNODE_PROBLEM_OVERRIDE: ULONG = 0x00000001; +pub const CM_SET_DEVNODE_PROBLEM_BITS: ULONG = 0x00000001; +pub const CM_SET_DEVINST_PROBLEM_NORMAL: ULONG = CM_SET_DEVNODE_PROBLEM_NORMAL; +pub const CM_SET_DEVINST_PROBLEM_OVERRIDE: ULONG = CM_SET_DEVNODE_PROBLEM_OVERRIDE; +pub const CM_SET_DEVINST_PROBLEM_BITS: ULONG = CM_SET_DEVNODE_PROBLEM_BITS; +pub const CM_SET_HW_PROF_FLAGS_UI_NOT_OK: ULONG = 0x00000001; +pub const CM_SET_HW_PROF_FLAGS_BITS: ULONG = 0x00000001; +pub const CM_SETUP_DEVNODE_READY: ULONG = 0x00000000; +pub const CM_SETUP_DEVINST_READY: ULONG = CM_SETUP_DEVNODE_READY; +pub const CM_SETUP_DOWNLOAD: ULONG = 0x00000001; +pub const CM_SETUP_WRITE_LOG_CONFS: ULONG = 0x00000002; +pub const CM_SETUP_PROP_CHANGE: ULONG = 0x00000003; +pub const CM_SETUP_DEVNODE_RESET: ULONG = 0x00000004; +pub const CM_SETUP_DEVINST_RESET: ULONG = CM_SETUP_DEVNODE_RESET; +pub const CM_SETUP_DEVNODE_CONFIG: ULONG = 0x00000005; +pub const CM_SETUP_DEVINST_CONFIG: ULONG = CM_SETUP_DEVNODE_CONFIG; +pub const CM_SETUP_DEVNODE_CONFIG_CLASS: ULONG = 0x00000006; +pub const CM_SETUP_DEVINST_CONFIG_CLASS: ULONG = CM_SETUP_DEVNODE_CONFIG_CLASS; +pub const CM_SETUP_DEVNODE_CONFIG_EXTENSIONS: ULONG = 0x00000007; +pub const CM_SETUP_DEVINST_CONFIG_EXTENSIONS: ULONG = CM_SETUP_DEVNODE_CONFIG_EXTENSIONS; +pub const CM_SETUP_BITS: ULONG = 0x00000007; +pub const CM_QUERY_ARBITRATOR_RAW: ULONG = 0x00000000; +pub const CM_QUERY_ARBITRATOR_TRANSLATED: ULONG = 0x00000001; +pub const CM_QUERY_ARBITRATOR_BITS: ULONG = 0x00000001; +pub const CM_CUSTOMDEVPROP_MERGE_MULTISZ: ULONG = 0x00000001; +pub const CM_CUSTOMDEVPROP_BITS: ULONG = 0x00000001; +pub const CM_NAME_ATTRIBUTE_NAME_RETRIEVED_FROM_DEVICE: ULONG = 0x1; +pub const CM_NAME_ATTRIBUTE_USER_ASSIGNED_NAME: ULONG = 0x2; +pub const CM_CLASS_PROPERTY_INSTALLER: ULONG = 0x00000000; +pub const CM_CLASS_PROPERTY_INTERFACE: ULONG = 0x00000001; +pub const CM_CLASS_PROPERTY_BITS: ULONG = 0x00000001; +DECLARE_HANDLE!(HCMNOTIFICATION, HCMNOTIFICATION__); +pub type PHCMNOTIFICATION = *mut HCMNOTIFICATION; +pub const CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES: ULONG = 0x00000001; +pub const CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES: ULONG = 0x00000002; +pub const CM_NOTIFY_FILTER_VALID_FLAGS: ULONG = CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES + | CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES; +ENUM!{enum CM_NOTIFY_FILTER_TYPE { + CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE = 0, + CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE, + CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE, + CM_NOTIFY_FILTER_TYPE_MAX, +}} +pub type PCM_NOTIFY_FILTER_TYPE = *mut CM_NOTIFY_FILTER_TYPE; +STRUCT!{struct CM_NOTIFY_FILTER_DeviceInterface { + ClassGuid: GUID, +}} +STRUCT!{struct CM_NOTIFY_FILTER_DeviceHandle { + hTarget: HANDLE, +}} +STRUCT!{struct CM_NOTIFY_FILTER_DeviceInstance { + InstanceId: [WCHAR; MAX_DEVICE_ID_LEN], +}} +UNION!{union CM_NOTIFY_FILTER_u { + [u32; 100] [u64; 50], + DeviceInterface DeviceInterface_mut: CM_NOTIFY_FILTER_DeviceInterface, + DeviceHandle DeviceHandle_mut: CM_NOTIFY_FILTER_DeviceHandle, + DeviceInstance DeviceInstance_mut: CM_NOTIFY_FILTER_DeviceInstance, +}} +STRUCT!{struct CM_NOTIFY_FILTER { + cbSize: DWORD, + Flags: DWORD, + FilterType: CM_NOTIFY_FILTER_TYPE, + Reserved: DWORD, + u: CM_NOTIFY_FILTER_u, +}} +pub type PCM_NOTIFY_FILTER = *mut CM_NOTIFY_FILTER; +ENUM!{enum CM_NOTIFY_ACTION { + CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL = 0, + CM_NOTIFY_ACTION_DEVICEINTERFACEREMOVAL, + CM_NOTIFY_ACTION_DEVICEQUERYREMOVE, + CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED, + CM_NOTIFY_ACTION_DEVICEREMOVEPENDING, + CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE, + CM_NOTIFY_ACTION_DEVICECUSTOMEVENT, + CM_NOTIFY_ACTION_DEVICEINSTANCEENUMERATED, + CM_NOTIFY_ACTION_DEVICEINSTANCESTARTED, + CM_NOTIFY_ACTION_DEVICEINSTANCEREMOVED, + CM_NOTIFY_ACTION_MAX, +}} +pub type PCM_NOTIFY_ACTION = *mut CM_NOTIFY_ACTION; +STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceInterface { + ClassGuid: GUID, + SymbolicLink: [WCHAR; ANYSIZE_ARRAY], +}} +STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceHandle { + EventGuid: GUID, + NameOffset: LONG, + DataSize: DWORD, + Data: [BYTE; ANYSIZE_ARRAY], +}} +STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceInstance { + InstanceId: [WCHAR; ANYSIZE_ARRAY], +}} +UNION!{union CM_NOTIFY_EVENT_DATA_u { + [u32; 7], + DeviceInterface DeviceInterface_mut: CM_NOTIFY_EVENT_DATA_DeviceInterface, + DeviceHandle DeviceHandle_mut: CM_NOTIFY_EVENT_DATA_DeviceHandle, + DeviceInstance DeviceInstance_mut: CM_NOTIFY_EVENT_DATA_DeviceInstance, +}} +STRUCT!{struct CM_NOTIFY_EVENT_DATA { + FilterType: CM_NOTIFY_FILTER_TYPE, + Reserved: DWORD, + u: CM_NOTIFY_EVENT_DATA_u, +}} +pub type PCM_NOTIFY_EVENT_DATA = *mut CM_NOTIFY_EVENT_DATA; +FN!{stdcall PCM_NOTIFY_CALLBACK( + hNotify: HCMNOTIFICATION, + Context: PVOID, + Action: CM_NOTIFY_ACTION, + EventData: PCM_NOTIFY_EVENT_DATA, + EventDataSize: DWORD, +) -> DWORD} +extern "system" { + pub fn CM_Add_Empty_Log_Conf( + plcLogConf: PLOG_CONF, + dnDevInst: DEVINST, + Priority: PRIORITY, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Add_Empty_Log_Conf_Ex( + plcLogConf: PLOG_CONF, + dnDevInst: DEVINST, + Priority: PRIORITY, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Add_IDA( + dnDevInst: DEVINST, + pszID: PSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Add_IDW( + dnDevInst: DEVINST, + pszID: PWSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Add_ID_ExA( + dnDevInst: DEVINST, + pszID: PSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Add_ID_ExW( + dnDevInst: DEVINST, + pszID: PWSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Add_Range( + ullStartValue: DWORDLONG, + ullEndValue: DWORDLONG, + rlh: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Add_Res_Des( + prdResDes: PRES_DES, + lcLogConf: LOG_CONF, + ResourceID: RESOURCEID, + ResourceData: PCVOID, + ResourceLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Add_Res_Des_Ex( + prdResDes: PRES_DES, + lcLogConf: LOG_CONF, + ResourceID: RESOURCEID, + ResourceData: PCVOID, + ResourceLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Connect_MachineA( + UNCServerName: PCSTR, + phMachine: PHMACHINE, + ) -> CONFIGRET; + pub fn CM_Connect_MachineW( + UNCServerName: PCWSTR, + phMachine: PHMACHINE, + ) -> CONFIGRET; + pub fn CM_Create_DevNodeA( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_A, + dnParent: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Create_DevNodeW( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_W, + dnParent: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Create_DevNode_ExA( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_A, + dnParent: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Create_DevNode_ExW( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_W, + dnParent: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Create_Range_List( + prlh: PRANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Delete_Class_Key( + ClassGuid: LPGUID, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Delete_Class_Key_Ex( + ClassGuid: LPGUID, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Delete_DevNode_Key( + dnDevNode: DEVNODE, + ulHardwareProfile: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Delete_DevNode_Key_Ex( + dnDevNode: DEVNODE, + ulHardwareProfile: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Delete_Range( + ullStartValue: DWORDLONG, + ullEndValue: DWORDLONG, + rlh: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Detect_Resource_Conflict( + dnDevInst: DEVINST, + ResourceID: RESOURCEID, + ResourceData: PCVOID, + ResourceLen: ULONG, + pbConflictDetected: PBOOL, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Detect_Resource_Conflict_Ex( + dnDevInst: DEVINST, + ResourceID: RESOURCEID, + ResourceData: PCVOID, + ResourceLen: ULONG, + pbConflictDetected: PBOOL, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Disable_DevNode( + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Disable_DevNode_Ex( + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Disconnect_Machine( + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Dup_Range_List( + rlhOld: RANGE_LIST, + rlhNew: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Enable_DevNode( + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Enable_DevNode_Ex( + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Enumerate_Classes( + ulClassIndex: ULONG, + ClassGuid: LPGUID, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Enumerate_Classes_Ex( + ulClassIndex: ULONG, + ClassGuid: LPGUID, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Enumerate_EnumeratorsA( + ulEnumIndex: ULONG, + Buffer: PSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Enumerate_EnumeratorsW( + ulEnumIndex: ULONG, + Buffer: PWSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Enumerate_Enumerators_ExA( + ulEnumIndex: ULONG, + Buffer: PSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Enumerate_Enumerators_ExW( + ulEnumIndex: ULONG, + Buffer: PWSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Find_Range( + pullStart: PDWORDLONG, + ullStart: DWORDLONG, + ulLength: ULONG, + ullAlignment: DWORDLONG, + ullEnd: DWORDLONG, + rlh: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_First_Range( + rlh: RANGE_LIST, + pullStart: PDWORDLONG, + pullEnd: PDWORDLONG, + preElement: PRANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Free_Log_Conf( + lcLogConfToBeFreed: LOG_CONF, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Free_Log_Conf_Ex( + lcLogConfToBeFreed: LOG_CONF, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Free_Log_Conf_Handle( + lcLogConf: LOG_CONF, + ) -> CONFIGRET; + pub fn CM_Free_Range_List( + rlh: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Free_Res_Des( + prdResDes: PRES_DES, + rdResDes: RES_DES, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Free_Res_Des_Ex( + prdResDes: PRES_DES, + rdResDes: RES_DES, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Free_Res_Des_Handle( + rdResDes: RES_DES, + ) -> CONFIGRET; + pub fn CM_Get_Child( + pdnDevInst: PDEVINST, + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Child_Ex( + pdnDevInst: PDEVINST, + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Class_Key_NameA( + ClassGuid: LPGUID, + pszKeyName: LPSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Class_Key_NameW( + ClassGuid: LPGUID, + pszKeyName: LPWSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Class_Key_Name_ExA( + ClassGuid: LPGUID, + pszKeyName: LPSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Class_Key_Name_ExW( + ClassGuid: LPGUID, + pszKeyName: LPWSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Class_NameA( + ClassGuid: LPGUID, + Buffer: PSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Class_NameW( + ClassGuid: LPGUID, + Buffer: PWSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Class_Name_ExA( + ClassGuid: LPGUID, + Buffer: PSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Class_Name_ExW( + ClassGuid: LPGUID, + Buffer: PWSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Depth( + pulDepth: PULONG, + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Depth_Ex( + pulDepth: PULONG, + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_IDA( + dnDevInst: DEVINST, + Buffer: PSTR, + BufferLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_IDW( + dnDevInst: DEVINST, + Buffer: PWSTR, + BufferLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_ExA( + dnDevInst: DEVINST, + Buffer: PSTR, + BufferLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_ExW( + dnDevInst: DEVINST, + Buffer: PWSTR, + BufferLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_ListA( + pszFilter: PCSTR, + Buffer: PCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_ListW( + pszFilter: PCWSTR, + Buffer: PWCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_List_ExA( + pszFilter: PCSTR, + Buffer: PCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_List_ExW( + pszFilter: PCWSTR, + Buffer: PWCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_List_SizeA( + pulLen: PULONG, + pszFilter: PCSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_List_SizeW( + pulLen: PULONG, + pszFilter: PCWSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_List_Size_ExA( + pulLen: PULONG, + pszFilter: PCSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_List_Size_ExW( + pulLen: PULONG, + pszFilter: PCWSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_Size( + pulLen: PULONG, + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_ID_Size_Ex( + pulLen: PULONG, + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Registry_PropertyA( + dnDevInst: DEVINST, + ulProperty: ULONG, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Registry_PropertyW( + dnDevInst: DEVINST, + ulProperty: ULONG, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Registry_Property_ExA( + dnDevInst: DEVINST, + ulProperty: ULONG, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Registry_Property_ExW( + dnDevInst: DEVINST, + ulProperty: ULONG, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Custom_PropertyA( + dnDevInst: DEVINST, + pszCustomPropertyName: PCSTR, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Custom_PropertyW( + dnDevInst: DEVINST, + pszCustomPropertyName: PCWSTR, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Custom_Property_ExA( + dnDevInst: DEVINST, + pszCustomPropertyName: PCSTR, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Custom_Property_ExW( + dnDevInst: DEVINST, + pszCustomPropertyName: PCWSTR, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Status( + pulStatus: PULONG, + pulProblemNumber: PULONG, + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_DevNode_Status_Ex( + pulStatus: PULONG, + pulProblemNumber: PULONG, + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_First_Log_Conf( + plcLogConf: PLOG_CONF, + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_First_Log_Conf_Ex( + plcLogConf: PLOG_CONF, + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Global_State( + pulState: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Global_State_Ex( + pulState: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Hardware_Profile_InfoA( + ulIndex: ULONG, + pHWProfileInfo: PHWPROFILEINFO_A, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Hardware_Profile_Info_ExA( + ulIndex: ULONG, + pHWProfileInfo: PHWPROFILEINFO_A, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Hardware_Profile_InfoW( + ulIndex: ULONG, + pHWProfileInfo: PHWPROFILEINFO_W, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Hardware_Profile_Info_ExW( + ulIndex: ULONG, + pHWProfileInfo: PHWPROFILEINFO_W, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_HW_Prof_FlagsA( + pDeviceID: DEVINSTID_A, + ulHardwareProfile: ULONG, + pulValue: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_HW_Prof_FlagsW( + pDeviceID: DEVINSTID_W, + ulHardwareProfile: ULONG, + pulValue: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_HW_Prof_Flags_ExA( + pDeviceID: DEVINSTID_A, + ulHardwareProfile: ULONG, + pulValue: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_HW_Prof_Flags_ExW( + pDeviceID: DEVINSTID_W, + ulHardwareProfile: ULONG, + pulValue: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_AliasA( + pszDeviceInterface: LPCSTR, + AliasInterfaceGuid: LPGUID, + pszAliasDeviceInterface: LPSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_AliasW( + pszDeviceInterface: LPCWSTR, + AliasInterfaceGuid: LPGUID, + pszAliasDeviceInterface: LPWSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_Alias_ExA( + pszDeviceInterface: LPCSTR, + AliasInterfaceGuid: LPGUID, + pszAliasDeviceInterface: LPSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_Alias_ExW( + pszDeviceInterface: LPCWSTR, + AliasInterfaceGuid: LPGUID, + pszAliasDeviceInterface: LPWSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_ListA( + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_A, + Buffer: PCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_ListW( + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_W, + Buffer: PWCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_List_ExA( + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_A, + Buffer: PCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_List_ExW( + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_W, + Buffer: PWCHAR, + BufferLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_List_SizeA( + pulLen: PULONG, + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_A, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_List_SizeW( + pulLen: PULONG, + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_W, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_List_Size_ExA( + pulLen: PULONG, + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_A, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Device_Interface_List_Size_ExW( + pulLen: PULONG, + InterfaceClassGuid: LPGUID, + pDeviceID: DEVINSTID_W, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Log_Conf_Priority( + lcLogConf: LOG_CONF, + pPriority: PRIORITY, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Log_Conf_Priority_Ex( + lcLogConf: LOG_CONF, + pPriority: PRIORITY, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Next_Log_Conf( + plcLogConf: PLOG_CONF, + lcLogConf: LOG_CONF, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Next_Log_Conf_Ex( + plcLogConf: PLOG_CONF, + lcLogConf: LOG_CONF, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Parent( + pdnDevInst: PDEVINST, + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Parent_Ex( + pdnDevInst: PDEVINST, + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Res_Des_Data( + rdResDes: RES_DES, + Buffer: PVOID, + BufferLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Res_Des_Data_Ex( + rdResDes: RES_DES, + Buffer: PVOID, + BufferLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Res_Des_Data_Size( + pulSize: PULONG, + rdResDes: RES_DES, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Res_Des_Data_Size_Ex( + pulSize: PULONG, + rdResDes: RES_DES, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Sibling( + pdnDevInst: PDEVINST, + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Sibling_Ex( + pdnDevInst: PDEVINST, + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Version() -> WORD; + pub fn CM_Get_Version_Ex( + hMachine: HMACHINE, + ) -> WORD; + pub fn CM_Is_Version_Available( + wVersion: WORD, + ) -> BOOL; + pub fn CM_Is_Version_Available_Ex( + wVersion: WORD, + hMachine: HMACHINE, + ) -> BOOL; + pub fn CM_Intersect_Range_List( + rlhOld1: RANGE_LIST, + rlhOld2: RANGE_LIST, + rlhNew: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Invert_Range_List( + rlhOld: RANGE_LIST, + rlhNew: RANGE_LIST, + ullMaxValue: DWORDLONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Locate_DevNodeA( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_A, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Locate_DevNodeW( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_W, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Locate_DevNode_ExA( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_A, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Locate_DevNode_ExW( + pdnDevInst: PDEVINST, + pDeviceID: DEVINSTID_W, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Merge_Range_List( + rlhOld1: RANGE_LIST, + rlhOld2: RANGE_LIST, + rlhNew: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Modify_Res_Des( + prdResDes: PRES_DES, + rdResDes: RES_DES, + ResourceID: RESOURCEID, + ResourceData: PCVOID, + ResourceLen: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Modify_Res_Des_Ex( + prdResDes: PRES_DES, + rdResDes: RES_DES, + ResourceID: RESOURCEID, + ResourceData: PCVOID, + ResourceLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Move_DevNode( + dnFromDevInst: DEVINST, + dnToDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Move_DevNode_Ex( + dnFromDevInst: DEVINST, + dnToDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Next_Range( + preElement: PRANGE_LIST, + pullStart: PDWORDLONG, + pullEnd: PDWORDLONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Next_Res_Des( + prdResDes: PRES_DES, + rdResDes: RES_DES, + ForResource: RESOURCEID, + pResourceID: PRESOURCEID, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Get_Next_Res_Des_Ex( + prdResDes: PRES_DES, + rdResDes: RES_DES, + ForResource: RESOURCEID, + pResourceID: PRESOURCEID, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Open_Class_KeyA( + ClassGuid: LPGUID, + pszClassName: LPCSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkClass: PHKEY, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Open_Class_KeyW( + ClassGuid: LPGUID, + pszClassName: LPCWSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkClass: PHKEY, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Open_Class_Key_ExA( + ClassGuid: LPGUID, + pszClassName: LPCSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkClass: PHKEY, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Open_Class_Key_ExW( + ClassGuid: LPGUID, + pszClassName: LPCWSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkClass: PHKEY, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Open_DevNode_Key( + dnDevNode: DEVINST, + samDesired: REGSAM, + ulHardwareProfile: ULONG, + Disposition: REGDISPOSITION, + phkDevice: PHKEY, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Open_DevNode_Key_Ex( + dnDevNode: DEVINST, + samDesired: REGSAM, + ulHardwareProfile: ULONG, + Disposition: REGDISPOSITION, + phkDevice: PHKEY, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Open_Device_Interface_KeyA( + pszDeviceInterface: LPCSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkDeviceInterface: PHKEY, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Open_Device_Interface_KeyW( + pszDeviceInterface: LPCWSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkDeviceInterface: PHKEY, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Open_Device_Interface_Key_ExA( + pszDeviceInterface: LPCSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkDeviceInterface: PHKEY, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Open_Device_Interface_Key_ExW( + pszDeviceInterface: LPCWSTR, + samDesired: REGSAM, + Disposition: REGDISPOSITION, + phkDeviceInterface: PHKEY, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Delete_Device_Interface_KeyA( + pszDeviceInterface: LPCSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Delete_Device_Interface_KeyW( + pszDeviceInterface: LPCWSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Delete_Device_Interface_Key_ExA( + pszDeviceInterface: LPCSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Delete_Device_Interface_Key_ExW( + pszDeviceInterface: LPCWSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Query_Arbitrator_Free_Data( + pData: PVOID, + DataLen: ULONG, + dnDevInst: DEVINST, + ResourceID: RESOURCEID, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Query_Arbitrator_Free_Data_Ex( + pData: PVOID, + DataLen: ULONG, + dnDevInst: DEVINST, + ResourceID: RESOURCEID, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Query_Arbitrator_Free_Size( + pulSize: PULONG, + dnDevInst: DEVINST, + ResourceID: RESOURCEID, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Query_Arbitrator_Free_Size_Ex( + pulSize: PULONG, + dnDevInst: DEVINST, + ResourceID: RESOURCEID, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Query_Remove_SubTree( + dnAncestor: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Query_Remove_SubTree_Ex( + dnAncestor: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Query_And_Remove_SubTreeA( + dnAncestor: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Query_And_Remove_SubTree_ExA( + dnAncestor: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Query_And_Remove_SubTreeW( + dnAncestor: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPWSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Query_And_Remove_SubTree_ExW( + dnAncestor: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPWSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Request_Device_EjectA( + dnDevInst: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Request_Device_Eject_ExA( + dnDevInst: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Request_Device_EjectW( + dnDevInst: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPWSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Request_Device_Eject_ExW( + dnDevInst: DEVINST, + pVetoType: PPNP_VETO_TYPE, + pszVetoName: LPWSTR, + ulNameLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Reenumerate_DevNode( + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Reenumerate_DevNode_Ex( + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Register_Device_InterfaceA( + dnDevInst: DEVINST, + InterfaceClassGuid: LPGUID, + pszReference: LPCSTR, + pszDeviceInterface: LPSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Register_Device_InterfaceW( + dnDevInst: DEVINST, + InterfaceClassGuid: LPGUID, + pszReference: LPCWSTR, + pszDeviceInterface: LPWSTR, + pulLength: PULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Register_Device_Interface_ExA( + dnDevInst: DEVINST, + InterfaceClassGuid: LPGUID, + pszReference: LPCSTR, + pszDeviceInterface: LPSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Register_Device_Interface_ExW( + dnDevInst: DEVINST, + InterfaceClassGuid: LPGUID, + pszReference: LPCWSTR, + pszDeviceInterface: LPWSTR, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_DevNode_Problem_Ex( + dnDevInst: DEVINST, + ulProblem: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_DevNode_Problem( + dnDevInst: DEVINST, + ulProblem: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Unregister_Device_InterfaceA( + pszDeviceInterface: LPCSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Unregister_Device_InterfaceW( + pszDeviceInterface: LPCWSTR, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Unregister_Device_Interface_ExA( + pszDeviceInterface: LPCSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Unregister_Device_Interface_ExW( + pszDeviceInterface: LPCWSTR, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Register_Device_Driver( + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Register_Device_Driver_Ex( + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Remove_SubTree( + dnAncestor: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Remove_SubTree_Ex( + dnAncestor: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_DevNode_Registry_PropertyA( + dnDevInst: DEVINST, + ulProperty: ULONG, + Buffer: PCVOID, + ulLength: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Set_DevNode_Registry_PropertyW( + dnDevInst: DEVINST, + ulProperty: ULONG, + Buffer: PCVOID, + ulLength: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Set_DevNode_Registry_Property_ExA( + dnDevInst: DEVINST, + ulProperty: ULONG, + Buffer: PCVOID, + ulLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_DevNode_Registry_Property_ExW( + dnDevInst: DEVINST, + ulProperty: ULONG, + Buffer: PCVOID, + ulLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Is_Dock_Station_Present( + pbPresent: PBOOL, + ) -> CONFIGRET; + pub fn CM_Is_Dock_Station_Present_Ex( + pbPresent: PBOOL, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Request_Eject_PC() -> CONFIGRET; + pub fn CM_Request_Eject_PC_Ex( + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_HW_Prof_FlagsA( + pDeviceID: DEVINSTID_A, + ulConfig: ULONG, + ulValue: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Set_HW_Prof_FlagsW( + pDeviceID: DEVINSTID_W, + ulConfig: ULONG, + ulValue: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Set_HW_Prof_Flags_ExA( + pDeviceID: DEVINSTID_A, + ulConfig: ULONG, + ulValue: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_HW_Prof_Flags_ExW( + pDeviceID: DEVINSTID_A, + ulConfig: ULONG, + ulValue: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Setup_DevNode( + dnDevInst: DEVINST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Setup_DevNode_Ex( + dnDevInst: DEVINST, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Test_Range_Available( + ullStartValue: DWORDLONG, + ullEndValue: DWORDLONG, + rlh: RANGE_LIST, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Uninstall_DevNode( + dnDevInst: DEVNODE, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Uninstall_DevNode_Ex( + dnDevInst: DEVNODE, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Run_Detection( + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Run_Detection_Ex( + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_HW_Prof( + ulHardwareProfile: ULONG, + ulFlags: ULONG, + ) -> CONFIGRET; + pub fn CM_Set_HW_Prof_Ex( + ulHardwareProfile: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Query_Resource_Conflict_List( + pclConflictList: PCONFLICT_LIST, + dnDevInst: DEVINST, + ResourceID: RESOURCEID, + ResourceData: PCVOID, + ResourceLen: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Free_Resource_Conflict_Handle( + clConflictList: CONFLICT_LIST, + ) -> CONFIGRET; + pub fn CM_Get_Resource_Conflict_Count( + clConflictList: CONFLICT_LIST, + pulCount: PULONG, + ) -> CONFIGRET; + pub fn CM_Get_Resource_Conflict_DetailsA( + clConflictList: CONFLICT_LIST, + ulIndex: ULONG, + pConflictDetails: PCONFLICT_DETAILS_A, + ) -> CONFIGRET; + pub fn CM_Get_Resource_Conflict_DetailsW( + clConflictList: CONFLICT_LIST, + ulIndex: ULONG, + pConflictDetails: PCONFLICT_DETAILS_W, + ) -> CONFIGRET; + pub fn CM_Get_Class_Registry_PropertyW( + ClassGuid: LPGUID, + ulProperty: ULONG, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_Class_Registry_PropertyW( + ClassGuid: LPGUID, + ulProperty: ULONG, + Buffer: PCVOID, + ulLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Get_Class_Registry_PropertyA( + ClassGuid: LPGUID, + ulProperty: ULONG, + pulRegDataType: PULONG, + Buffer: PVOID, + pulLength: PULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CM_Set_Class_Registry_PropertyA( + ClassGuid: LPGUID, + ulProperty: ULONG, + Buffer: PCVOID, + ulLength: ULONG, + ulFlags: ULONG, + hMachine: HMACHINE, + ) -> CONFIGRET; + pub fn CMP_WaitNoPendingInstallEvents( + dwTimeout: DWORD, + ) -> DWORD; +} +pub const CR_SUCCESS: CONFIGRET = 0x00000000; +pub const CR_DEFAULT: CONFIGRET = 0x00000001; +pub const CR_OUT_OF_MEMORY: CONFIGRET = 0x00000002; +pub const CR_INVALID_POINTER: CONFIGRET = 0x00000003; +pub const CR_INVALID_FLAG: CONFIGRET = 0x00000004; +pub const CR_INVALID_DEVNODE: CONFIGRET = 0x00000005; +pub const CR_INVALID_DEVINST: CONFIGRET = CR_INVALID_DEVNODE; +pub const CR_INVALID_RES_DES: CONFIGRET = 0x00000006; +pub const CR_INVALID_LOG_CONF: CONFIGRET = 0x00000007; +pub const CR_INVALID_ARBITRATOR: CONFIGRET = 0x00000008; +pub const CR_INVALID_NODELIST: CONFIGRET = 0x00000009; +pub const CR_DEVNODE_HAS_REQS: CONFIGRET = 0x0000000A; +pub const CR_DEVINST_HAS_REQS: CONFIGRET = CR_DEVNODE_HAS_REQS; +pub const CR_INVALID_RESOURCEID: CONFIGRET = 0x0000000B; +pub const CR_DLVXD_NOT_FOUND: CONFIGRET = 0x0000000C; +pub const CR_NO_SUCH_DEVNODE: CONFIGRET = 0x0000000D; +pub const CR_NO_SUCH_DEVINST: CONFIGRET = CR_NO_SUCH_DEVNODE; +pub const CR_NO_MORE_LOG_CONF: CONFIGRET = 0x0000000E; +pub const CR_NO_MORE_RES_DES: CONFIGRET = 0x0000000F; +pub const CR_ALREADY_SUCH_DEVNODE: CONFIGRET = 0x00000010; +pub const CR_ALREADY_SUCH_DEVINST: CONFIGRET = CR_ALREADY_SUCH_DEVNODE; +pub const CR_INVALID_RANGE_LIST: CONFIGRET = 0x00000011; +pub const CR_INVALID_RANGE: CONFIGRET = 0x00000012; +pub const CR_FAILURE: CONFIGRET = 0x00000013; +pub const CR_NO_SUCH_LOGICAL_DEV: CONFIGRET = 0x00000014; +pub const CR_CREATE_BLOCKED: CONFIGRET = 0x00000015; +pub const CR_NOT_SYSTEM_VM: CONFIGRET = 0x00000016; +pub const CR_REMOVE_VETOED: CONFIGRET = 0x00000017; +pub const CR_APM_VETOED: CONFIGRET = 0x00000018; +pub const CR_INVALID_LOAD_TYPE: CONFIGRET = 0x00000019; +pub const CR_BUFFER_SMALL: CONFIGRET = 0x0000001A; +pub const CR_NO_ARBITRATOR: CONFIGRET = 0x0000001B; +pub const CR_NO_REGISTRY_HANDLE: CONFIGRET = 0x0000001C; +pub const CR_REGISTRY_ERROR: CONFIGRET = 0x0000001D; +pub const CR_INVALID_DEVICE_ID: CONFIGRET = 0x0000001E; +pub const CR_INVALID_DATA: CONFIGRET = 0x0000001F; +pub const CR_INVALID_API: CONFIGRET = 0x00000020; +pub const CR_DEVLOADER_NOT_READY: CONFIGRET = 0x00000021; +pub const CR_NEED_RESTART: CONFIGRET = 0x00000022; +pub const CR_NO_MORE_HW_PROFILES: CONFIGRET = 0x00000023; +pub const CR_DEVICE_NOT_THERE: CONFIGRET = 0x00000024; +pub const CR_NO_SUCH_VALUE: CONFIGRET = 0x00000025; +pub const CR_WRONG_TYPE: CONFIGRET = 0x00000026; +pub const CR_INVALID_PRIORITY: CONFIGRET = 0x00000027; +pub const CR_NOT_DISABLEABLE: CONFIGRET = 0x00000028; +pub const CR_FREE_RESOURCES: CONFIGRET = 0x00000029; +pub const CR_QUERY_VETOED: CONFIGRET = 0x0000002A; +pub const CR_CANT_SHARE_IRQ: CONFIGRET = 0x0000002B; +pub const CR_NO_DEPENDENT: CONFIGRET = 0x0000002C; +pub const CR_SAME_RESOURCES: CONFIGRET = 0x0000002D; +pub const CR_NO_SUCH_REGISTRY_KEY: CONFIGRET = 0x0000002E; +pub const CR_INVALID_MACHINENAME: CONFIGRET = 0x0000002F; +pub const CR_REMOTE_COMM_FAILURE: CONFIGRET = 0x00000030; +pub const CR_MACHINE_UNAVAILABLE: CONFIGRET = 0x00000031; +pub const CR_NO_CM_SERVICES: CONFIGRET = 0x00000032; +pub const CR_ACCESS_DENIED: CONFIGRET = 0x00000033; +pub const CR_CALL_NOT_IMPLEMENTED: CONFIGRET = 0x00000034; +pub const CR_INVALID_PROPERTY: CONFIGRET = 0x00000035; +pub const CR_DEVICE_INTERFACE_ACTIVE: CONFIGRET = 0x00000036; +pub const CR_NO_SUCH_DEVICE_INTERFACE: CONFIGRET = 0x00000037; +pub const CR_INVALID_REFERENCE_STRING: CONFIGRET = 0x00000038; +pub const CR_INVALID_CONFLICT_LIST: CONFIGRET = 0x00000039; +pub const CR_INVALID_INDEX: CONFIGRET = 0x0000003A; +pub const CR_INVALID_STRUCTURE_SIZE: CONFIGRET = 0x0000003B; +pub const NUM_CR_RESULTS: CONFIGRET = 0x0000003C; diff --git a/src/vendor/winapi/src/um/cguid.rs b/src/vendor/winapi/src/um/cguid.rs new file mode 100644 index 0000000000..4b48b4c214 --- /dev/null +++ b/src/vendor/winapi/src/um/cguid.rs @@ -0,0 +1,135 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +// Some of these definitions are commented out because I could not find their value +DEFINE_GUID!{GUID_NULL, + 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} +DEFINE_GUID!{CATID_MARSHALER, + 0x00000003, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IRpcChannel, + 0x00000004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IRpcStub, + 0x00000005, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IStubManager, + 0x00000006, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IRpcProxy, + 0x00000007, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IProxyManager, + 0x00000008, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IPSFactory, + 0x00000009, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IInternalMoniker, + 0x00000011, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IDfReserved1, + 0x00000013, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IDfReserved2, + 0x00000014, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IDfReserved3, + 0x00000015, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_StdMarshal, + 0x00000017, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +// extern const CLSID CLSID_AggStdMarshal; +DEFINE_GUID!{CLSID_StdAsyncActManager, + 0x00000329, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IStub, + 0x00000026, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IProxy, + 0x00000027, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IEnumGeneric, + 0x00000106, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IEnumHolder, + 0x00000107, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IEnumCallback, + 0x00000108, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IOleManager, + 0x0000011f, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IOlePresObj, + 0x00000120, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IDebug, + 0x00000123, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{IID_IDebugStream, + 0x00000124, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSGenObject, + 0x0000030c, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSClientSite, + 0x0000030d, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSClassObject, + 0x0000030e, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSInPlaceActive, + 0x0000030f, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSInPlaceFrame, + 0x00000310, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSDragDrop, + 0x00000311, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSBindCtx, + 0x00000312, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_PSEnumerators, + 0x00000313, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_StaticMetafile, + 0x00000315, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_StaticDib, + 0x00000316, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +// extern const CLSID CID_CDfsVolume; +DEFINE_GUID!{CLSID_DCOMAccessControl, + 0x0000031d, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_GlobalOptions, + 0x0000034b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_StdGlobalInterfaceTable, + 0x00000323, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_ComBinding, + 0x00000328, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_StdEvent, + 0x0000032b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_ManualResetEvent, + 0x0000032c, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_SynchronizeContainer, + 0x0000032d, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_AddrControl, + 0x00000348, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_ContextSwitcher, + 0x0000034e, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +// extern const CLSID CLSID_CCDFormKrnl; +// extern const CLSID CLSID_CCDPropertyPage; +// extern const CLSID CLSID_CCDFormDialog; +// extern const CLSID CLSID_CCDCommandButton; +// extern const CLSID CLSID_CCDComboBox; +// extern const CLSID CLSID_CCDTextBox; +// extern const CLSID CLSID_CCDCheckBox; +// extern const CLSID CLSID_CCDLabel; +// extern const CLSID CLSID_CCDOptionButton; +// extern const CLSID CLSID_CCDListBox; +// extern const CLSID CLSID_CCDScrollBar; +// extern const CLSID CLSID_CCDGroupBox; +// extern const CLSID CLSID_CCDGeneralPropertyPage; +// extern const CLSID CLSID_CCDGenericPropertyPage; +// extern const CLSID CLSID_CCDFontPropertyPage; +// extern const CLSID CLSID_CCDColorPropertyPage; +// extern const CLSID CLSID_CCDLabelPropertyPage; +// extern const CLSID CLSID_CCDCheckBoxPropertyPage; +// extern const CLSID CLSID_CCDTextBoxPropertyPage; +// extern const CLSID CLSID_CCDOptionButtonPropertyPage; +// extern const CLSID CLSID_CCDListBoxPropertyPage; +// extern const CLSID CLSID_CCDCommandButtonPropertyPage; +// extern const CLSID CLSID_CCDComboBoxPropertyPage; +// extern const CLSID CLSID_CCDScrollBarPropertyPage; +// extern const CLSID CLSID_CCDGroupBoxPropertyPage; +// extern const CLSID CLSID_CCDXObjectPropertyPage; +// extern const CLSID CLSID_CStdPropertyFrame; +// extern const CLSID CLSID_CFormPropertyPage; +// extern const CLSID CLSID_CGridPropertyPage; +// extern const CLSID CLSID_CWSJArticlePage; +// extern const CLSID CLSID_CSystemPage; +// extern const CLSID CLSID_IdentityUnmarshal; +DEFINE_GUID!{CLSID_InProcFreeMarshaler, + 0x0000033a, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_Picture_Metafile, + 0x00000315, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_Picture_EnhMetafile, + 0x00000319, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{CLSID_Picture_Dib, + 0x00000316, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} +DEFINE_GUID!{GUID_TRISTATE, + 0x6650430a, 0xbe0f, 0x101a, 0x8b, 0xbb, 0x00, 0xaa, 0x00, 0x30, 0x0c, 0xab} diff --git a/src/vendor/winapi/src/um/combaseapi.rs b/src/vendor/winapi/src/um/combaseapi.rs new file mode 100644 index 0000000000..4c3b46ac5b --- /dev/null +++ b/src/vendor/winapi/src/um/combaseapi.rs @@ -0,0 +1,478 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Base Component Object Model defintions. +use ctypes::{c_int, c_void}; +use shared::basetsd::{SIZE_T, UINT64, ULONG_PTR}; +use shared::guiddef::{CLSID, GUID, LPCLSID, LPIID, REFCLSID, REFGUID, REFIID}; +use shared::minwindef::{BOOL, DWORD, FILETIME, HGLOBAL, LPDWORD, LPHANDLE, LPVOID, ULONG}; +use shared::rpcdce::{RPC_AUTHZ_HANDLE, RPC_AUTH_IDENTITY_HANDLE}; +use shared::wtypesbase::{ + CLSCTX, CLSCTX_INPROC_HANDLER, CLSCTX_INPROC_SERVER, CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER, + LPCOLESTR, LPOLESTR, OLECHAR, +}; +use um::objidl::SOLE_AUTHENTICATION_SERVICE; +use um::objidlbase::{ + APTTYPE, APTTYPEQUALIFIER, COSERVERINFO, IActivationFilter, IAgileReference, LPMALLOC, + LPMARSHAL, LPSTREAM, LPSURROGATE, MULTI_QI, +}; +use um::propidl::PROPVARIANT; +use um::unknwnbase::{IUnknown, LPUNKNOWN}; +use um::winnt::{HANDLE, HRESULT, LARGE_INTEGER, LONG, PSECURITY_DESCRIPTOR, PVOID, ULARGE_INTEGER}; +#[inline] +pub fn LISet32(li: &mut LARGE_INTEGER, v: DWORD) { + unsafe { + li.u_mut().HighPart = if (v as LONG) < 0 { + -1 + } else { + 0 + }; + li.u_mut().LowPart = v; + } +} +#[inline] +pub fn ULISet32(li: &mut ULARGE_INTEGER, v: DWORD) { + unsafe { + li.u_mut().HighPart = 0; + li.u_mut().LowPart = v; + } +} +pub const CLSCTX_INPROC: CLSCTX = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER; +pub const CLSCTX_ALL: CLSCTX = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER + | CLSCTX_REMOTE_SERVER; +pub const CLSCTX_SERVER: CLSCTX = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER + | CLSCTX_REMOTE_SERVER; +ENUM!{enum REGCLS { + REGCLS_SINGLEUSE = 0, + REGCLS_MULTIPLEUSE = 1, + REGCLS_MULTI_SEPARATE = 2, + REGCLS_SUSPENDED = 4, + REGCLS_SURROGATE = 8, + REGCLS_AGILE = 0x10, +}} +ENUM!{enum COINITBASE { + COINITBASE_MULTITHREADED = 0x0, +}} +extern "system" { + pub fn CoGetMalloc( + dwMemContext: DWORD, + ppMalloc: *mut LPMALLOC, + ) -> HRESULT; + pub fn CreateStreamOnHGlobal( + hGlobal: HGLOBAL, + fDeleteOnRelease: BOOL, + ppstm: *mut LPSTREAM, + ) -> HRESULT; + pub fn GetHGlobalFromStream( + pstm: LPSTREAM, + phglobal: *mut HGLOBAL, + ) -> HRESULT; + pub fn CoUninitialize() -> (); + pub fn CoGetCurrentProcess() -> DWORD; + pub fn CoInitializeEx( + pvReserved: LPVOID, + dwCoInit: DWORD, + ) -> HRESULT; + pub fn CoGetCallerTID( + lpdwTID: LPDWORD, + ) -> HRESULT; + pub fn CoGetCurrentLogicalThreadId( + pguid: *mut GUID, + ) -> HRESULT; + pub fn CoGetContextToken( + pToken: *mut ULONG_PTR, + ) -> HRESULT; + pub fn CoGetDefaultContext( + aptType: APTTYPE, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT; + pub fn CoGetApartmentType( + pAptType: *mut APTTYPE, + pAptQualifier: *mut APTTYPEQUALIFIER, + ) -> HRESULT; +} +STRUCT!{struct ServerInformation { + dwServerPid: DWORD, + dwServerTid: DWORD, + ui64ServerAddress: UINT64, +}} +pub type PServerInformation = *mut ServerInformation; +extern "system" { + pub fn CoDecodeProxy( + dwClientPid: DWORD, + ui64ProxyAddress: UINT64, + pServerInformation: PServerInformation, + ) -> HRESULT; +} +DECLARE_HANDLE!(CO_MTA_USAGE_COOKIE, CO_MTA_USAGE_COOKIE__); +extern "system" { + pub fn CoIncrementMTAUsage( + pCookie: *mut CO_MTA_USAGE_COOKIE, + ) -> HRESULT; + pub fn CoDecrementMTAUsage( + Cookie: CO_MTA_USAGE_COOKIE, + ) -> HRESULT; + pub fn CoAllowUnmarshalerCLSID( + clsid: REFCLSID, + ) -> HRESULT; + pub fn CoGetObjectContext( + riid: REFIID, + ppv: *mut LPVOID, + ) -> HRESULT; + pub fn CoGetClassObject( + rclsid: REFCLSID, + dwClsContext: DWORD, + pvReserved: LPVOID, + riid: REFIID, + ppv: *mut LPVOID, + ) -> HRESULT; + pub fn CoRegisterClassObject( + rclsid: REFCLSID, + pUnk: LPUNKNOWN, + dwClsContext: DWORD, + flags: DWORD, + lpdwRegister: LPDWORD, + ) -> HRESULT; + pub fn CoRevokeClassObject( + dwRegister: DWORD, + ) -> HRESULT; + pub fn CoResumeClassObjects() -> HRESULT; + pub fn CoSuspendClassObjects() -> HRESULT; + pub fn CoAddRefServerProcess() -> ULONG; + pub fn CoReleaseServerProcess() -> ULONG; + pub fn CoGetPSClsid( + riid: REFIID, + pClsid: *mut CLSID, + ) -> HRESULT; + pub fn CoRegisterPSClsid( + riid: REFIID, + rclsid: REFCLSID, + ) -> HRESULT; + pub fn CoRegisterSurrogate( + pSurrogate: LPSURROGATE, + ) -> HRESULT; + pub fn CoGetMarshalSizeMax( + pulSize: *mut ULONG, + riid: REFIID, + pUnk: LPUNKNOWN, + dwDestContext: DWORD, + pvDestContext: LPVOID, + mshlflags: DWORD, + ) -> HRESULT; + pub fn CoMarshalInterface( + pStm: LPSTREAM, + riid: REFIID, + pUnk: LPUNKNOWN, + dwDestContext: DWORD, + pvDestContext: LPVOID, + mshlflags: DWORD, + ) -> HRESULT; + pub fn CoUnmarshalInterface( + pStm: LPSTREAM, + riid: REFIID, + ppv: *mut LPVOID, + ) -> HRESULT; + pub fn CoMarshalHresult( + pstm: LPSTREAM, + hresult: HRESULT, + ) -> HRESULT; + pub fn CoUnmarshalHresult( + pstm: LPSTREAM, + phresult: *mut HRESULT, + ) -> HRESULT; + pub fn CoReleaseMarshalData( + pstm: LPSTREAM, + ) -> HRESULT; + pub fn CoDisconnectObject( + pUnk: LPUNKNOWN, + dwReserved: DWORD, + ) -> HRESULT; + pub fn CoLockObjectExternal( + pUnk: LPUNKNOWN, + fLock: BOOL, + fLastUnlockReleases: BOOL, + ) -> HRESULT; + pub fn CoGetStandardMarshal( + riid: REFIID, + pUnk: LPUNKNOWN, + dwDestContext: DWORD, + pvDestContext: LPVOID, + mshlflags: DWORD, + ppMarshal: *mut LPMARSHAL, + ) -> HRESULT; + pub fn CoGetStdMarshalEx( + pUnkOuter: LPUNKNOWN, + smexflags: DWORD, + ppUnkInner: *mut LPUNKNOWN, + ) -> HRESULT; +} +ENUM!{enum STDMSHLFLAGS { + SMEXF_SERVER = 0x01, + SMEXF_HANDLER = 0x02, +}} +extern "system" { + pub fn CoIsHandlerConnected( + pUnk: LPUNKNOWN, + ) -> BOOL; + pub fn CoMarshalInterThreadInterfaceInStream( + riid: REFIID, + pUnk: LPUNKNOWN, + ppStm: *mut LPSTREAM, + ) -> HRESULT; + pub fn CoGetInterfaceAndReleaseStream( + pStm: LPSTREAM, + iid: REFIID, + ppv: *mut LPVOID, + ) -> HRESULT; + pub fn CoCreateFreeThreadedMarshaler( + punkOuter: LPUNKNOWN, + ppunkMarshal: *mut LPUNKNOWN, + ) -> HRESULT; + pub fn CoFreeUnusedLibraries(); + pub fn CoFreeUnusedLibrariesEx( + dwUnloadDelay: DWORD, + dwReserved: DWORD, + ); + pub fn CoDisconnectContext( + dwTimeout: DWORD, + )-> HRESULT; + pub fn CoInitializeSecurity( + pSecDesc: PSECURITY_DESCRIPTOR, + cAuthSvc: LONG, + asAuthSvc: *mut SOLE_AUTHENTICATION_SERVICE, + pReserved1: *mut c_void, + dwAuthnLevel: DWORD, + dwImpLevel: DWORD, + pAuthList: *mut c_void, + dwCapabilities: DWORD, + pReserved3: *mut c_void, + ) -> HRESULT; + pub fn CoGetCallContext( + riid: REFIID, + ppInterface: *mut *mut c_void, + ) -> HRESULT; + pub fn CoQueryProxyBlanket( + pProxy: *mut IUnknown, + pwAuthnSvc: *mut DWORD, + pAuthzSvc: *mut DWORD, + pServerPrincName: *mut LPOLESTR, + pAuthnLevel: *mut DWORD, + pImpLevel: *mut DWORD, + pAuthInfo: *mut RPC_AUTH_IDENTITY_HANDLE, + pCapabilites: *mut DWORD, + ) -> HRESULT; + pub fn CoSetProxyBlanket( + pProxy: *mut IUnknown, + dwAuthnSvc: DWORD, + dwAuthzSvc: DWORD, + pServerPrincName: *mut OLECHAR, + dwAuthnLevel: DWORD, + dwImpLevel: DWORD, + pAuthInfo: RPC_AUTH_IDENTITY_HANDLE, + dwCapabilities: DWORD, + ) -> HRESULT; + pub fn CoCopyProxy( + pProxy: *mut IUnknown, + ppCopy: *mut *mut IUnknown, + ) -> HRESULT; + pub fn CoQueryClientBlanket( + pAuthnSvc: *mut DWORD, + pAuthzSvc: *mut DWORD, + pServerPrincName: *mut LPOLESTR, + pAuthnLevel: *mut DWORD, + pImpLevel: *mut DWORD, + pPrivs: *mut RPC_AUTHZ_HANDLE, + pCapabilities: *mut DWORD, + ) -> HRESULT; + pub fn CoImpersonateClient() -> HRESULT; + pub fn CoRevertToSelf() -> HRESULT; + pub fn CoQueryAuthenticationServices( + pcAuthSvc: *mut DWORD, + asAuthSvc: *mut *mut SOLE_AUTHENTICATION_SERVICE, + ) -> HRESULT; + pub fn CoSwitchCallContext( + pNewObject: *mut IUnknown, + ppOldObject: *mut *mut IUnknown, + ) -> HRESULT; +} +pub const COM_RIGHTS_EXECUTE: DWORD = 1; +pub const COM_RIGHTS_EXECUTE_LOCAL: DWORD = 2; +pub const COM_RIGHTS_EXECUTE_REMOTE: DWORD = 4; +pub const COM_RIGHTS_ACTIVATE_LOCAL: DWORD = 8; +pub const COM_RIGHTS_ACTIVATE_REMOTE: DWORD = 16; +extern "system" { + pub fn CoCreateInstance( + rclsid: REFCLSID, + pUnkOuter: LPUNKNOWN, + dwClsContext: DWORD, + riid: REFIID, + ppv: *mut LPVOID, + ) -> HRESULT; + pub fn CoCreateInstanceEx( + Clsid: REFCLSID, + punkOuter: *mut IUnknown, + dwClsCtx: DWORD, + pServerInfo: *mut COSERVERINFO, + dwCount: DWORD, + pResults: *mut MULTI_QI, + ) -> HRESULT; + pub fn CoRegisterActivationFilter( + pActivationFilter: *mut IActivationFilter, + ) -> HRESULT; + pub fn CoCreateInstanceFromApp( + Clsid: REFCLSID, + punkOuter: *mut IUnknown, + dwClsCtx: DWORD, + reserved: PVOID, + dwCount: DWORD, + pResults: *mut MULTI_QI, + ) -> HRESULT; + pub fn CoGetCancelObject( + dwThreadId: DWORD, + iid: REFIID, + ppUnk: *mut *mut c_void, + ) -> HRESULT; + pub fn CoSetCancelObject( + pUnk: *mut *mut IUnknown, + ) -> HRESULT; + pub fn CoCancelCall( + dwThreadId: DWORD, + ulTimeout: ULONG, + ) -> HRESULT; + pub fn CoTestCancel() -> HRESULT; + pub fn CoEnableCallCancellation( + pReserved: LPVOID, + ) -> HRESULT; + pub fn CoDisableCallCancellation( + pReserved: LPVOID, + ) -> HRESULT; + pub fn StringFromCLSID( + rclsid: REFCLSID, + lplpsz: *mut LPOLESTR, + ) -> HRESULT; + pub fn CLSIDFromString( + lpsz: LPCOLESTR, + pclsid: LPCLSID, + ) -> HRESULT; + pub fn StringFromIID( + rclsid: REFIID, + lplpsz: *mut LPOLESTR, + ) -> HRESULT; + pub fn IIDFromString( + lpsz: LPCOLESTR, + lpiid: LPIID, + ) -> HRESULT; + pub fn ProgIDFromCLSID( + clsid: REFCLSID, + lplpszProgID: *mut LPOLESTR, + ) -> HRESULT; + pub fn CLSIDFromProgID( + lpszProgID: LPCOLESTR, + lpclsid: LPCLSID, + ) -> HRESULT; + pub fn StringFromGUID2( + rguid: REFGUID, + lpsz: LPOLESTR, + cchMax: c_int, + ) -> c_int; + pub fn CoCreateGuid( + pguid: *mut GUID, + ) -> HRESULT; + pub fn PropVariantCopy( + pvarDest: *mut PROPVARIANT, + pvarSrc: *const PROPVARIANT, + ) -> HRESULT; + pub fn PropVariantClear( + pvar: *mut PROPVARIANT, + ) -> HRESULT; + pub fn FreePropVariantArray( + cVariants: ULONG, + rgvars: *mut PROPVARIANT, + ) -> HRESULT; + pub fn CoWaitForMultipleHandles( + dwFlags: DWORD, + dwTimeout: DWORD, + cHandles: ULONG, + pHandles: LPHANDLE, + lpdwindex: LPDWORD, + ) -> HRESULT; +} +ENUM!{enum COWAIT_FLAGS { + COWAIT_DEFAULT = 0, + COWAIT_WAITALL = 1, + COWAIT_ALERTABLE = 2, + COWAIT_INPUTAVAILABLE = 4, + COWAIT_DISPATCH_CALLS = 8, + COWAIT_DISPATCH_WINDOW_MESSAGES = 0x10, +}} +ENUM!{enum CWMO_FLAGS { + CWMO_DEFAULT = 0, + CWMO_DISPATCH_CALLS = 1, + CWMO_DISPATCH_WINDOW_MESSAGES = 2, +}} +extern "system" { + pub fn CoWaitForMultipleObjects( + dwFlags: DWORD, + dwTimeout: DWORD, + cHandles: ULONG, + pHandles: *const HANDLE, + lpdwindex: LPDWORD, + ) -> HRESULT; +} +pub const CWMO_MAX_HANDLES: ULONG = 56; +extern "system" { + pub fn CoGetTreatAsClass( + clsidOld: REFCLSID, + pClsidNew: LPCLSID, + ) -> HRESULT; + pub fn CoInvalidateRemoteMachineBindings( + pszMachineName: LPOLESTR, + ) -> HRESULT; +} +ENUM!{enum AgileReferenceOptions { + AGILEREFERENCE_DEFAULT = 0, + AGILEREFERENCE_DELAYEDMARSHAL = 1, +}} +extern "system" { + pub fn RoGetAgileReference( + options: AgileReferenceOptions, + riid: REFIID, + pUnk: *mut IUnknown, + ppAgileReference: *mut *mut IAgileReference, + ) -> HRESULT; +} +FN!{stdcall LPFNGETCLASSOBJECT( + REFCLSID, + REFIID, + *mut LPVOID, +) -> HRESULT} +FN!{stdcall LPFNCANUNLOADNOW() -> HRESULT} +extern "system" { + pub fn DllGetClassObject( + rclsid: REFCLSID, + riid: REFIID, + ppv: *mut LPVOID, + ) -> HRESULT; + pub fn DllCanUnloadNow() -> HRESULT; + pub fn CoTaskMemAlloc( + cb: SIZE_T, + ) -> LPVOID; + pub fn CoTaskMemRealloc( + pv: LPVOID, + cb: SIZE_T, + ) -> LPVOID; + pub fn CoTaskMemFree( + pv: LPVOID, + ); + pub fn CoFileTimeNow( + lpFileTime: *mut FILETIME, + ) -> HRESULT; + pub fn CLSIDFromProgIDEx( + lpszProgID: LPCOLESTR, + lpclsid: LPCLSID, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/coml2api.rs b/src/vendor/winapi/src/um/coml2api.rs new file mode 100644 index 0000000000..80db091694 --- /dev/null +++ b/src/vendor/winapi/src/um/coml2api.rs @@ -0,0 +1,11 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! Structured storage, property sets, and related APIs. +use shared::minwindef::DWORD; +pub const STGM_READ: DWORD = 0x00000000; +pub const STGM_WRITE: DWORD = 0x00000001; +pub const STGM_READWRITE: DWORD = 0x00000002; diff --git a/src/vendor/winapi/src/um/commapi.rs b/src/vendor/winapi/src/um/commapi.rs new file mode 100644 index 0000000000..42d147cd04 --- /dev/null +++ b/src/vendor/winapi/src/um/commapi.rs @@ -0,0 +1,88 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_char; +use shared::minwindef::{BOOL, DWORD, LPDWORD}; +use um::minwinbase::LPOVERLAPPED; +use um::winbase::{LPCOMMCONFIG, LPCOMMPROP, LPCOMMTIMEOUTS, LPCOMSTAT, LPDCB}; +use um::winnt::{HANDLE}; +extern "system" { + pub fn ClearCommBreak( + hFile: HANDLE + ) -> BOOL; + pub fn ClearCommError( + hFile: HANDLE, + lpErrors: LPDWORD, + lpStat: LPCOMSTAT + ) -> BOOL; + pub fn SetupComm( + hFile: HANDLE, + dwInQueue: DWORD, + dwOutQueue: DWORD + ) -> BOOL; + pub fn EscapeCommFunction( + hFile: HANDLE, + dwFunc: DWORD + ) -> BOOL; + pub fn GetCommConfig( + hCommDev: HANDLE, + lpCC: LPCOMMCONFIG, + lpdwSize: LPDWORD + ) -> BOOL; + pub fn GetCommMask( + hFile: HANDLE, + lpEvtMask: LPDWORD + ) -> BOOL; + pub fn GetCommModemStatus( + hFile: HANDLE, + lpModemStat: LPDWORD + ) -> BOOL; + pub fn GetCommProperties( + hFile: HANDLE, + lpCommProp: LPCOMMPROP + ) -> BOOL; + pub fn GetCommState( + hFile: HANDLE, + lpDCB: LPDCB + ) -> BOOL; + pub fn GetCommTimeouts( + hFile: HANDLE, + lpCommTimeouts: LPCOMMTIMEOUTS + ) -> BOOL; + pub fn PurgeComm( + hFile: HANDLE, + dwFlags: DWORD + ) -> BOOL; + pub fn SetCommBreak( + hFile: HANDLE + ) -> BOOL; + pub fn SetCommConfig( + hCommDev: HANDLE, + lpCC: LPCOMMCONFIG, + dwSize: DWORD + ) -> BOOL; + pub fn SetCommMask( + hFile: HANDLE, + dwEvtMask: DWORD + ) -> BOOL; + pub fn SetCommState( + hFile: HANDLE, + lpDCB: LPDCB + ) -> BOOL; + pub fn SetCommTimeouts( + hFile: HANDLE, + lpCommTimeouts: LPCOMMTIMEOUTS + ) -> BOOL; + pub fn TransmitCommChar( + hFile: HANDLE, + cChar: c_char + ) -> BOOL; + pub fn WaitCommEvent( + hFile: HANDLE, + lpEvtMask: LPDWORD, + lpOverlapped: LPOVERLAPPED + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/commctrl.rs b/src/vendor/winapi/src/um/commctrl.rs new file mode 100644 index 0000000000..f19b160030 --- /dev/null +++ b/src/vendor/winapi/src/um/commctrl.rs @@ -0,0 +1,4142 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_char, c_int, c_long, c_short, c_void}; +use shared::basetsd::{DWORD_PTR, INT_PTR, LONG_PTR, UINT_PTR}; +#[cfg(target_arch = "x86_64")] use shared::basetsd::PINT_PTR; +use shared::guiddef::{IID, REFIID}; +use shared::minwindef::{ + BOOL, BYTE, DWORD, HINSTANCE, HKEY, INT, LPARAM, LPINT, LRESULT, PUINT, UINT, ULONG, WORD, + WPARAM, +}; +use shared::windef::{ + COLORREF, HBITMAP, HBRUSH, HDC, HICON, HMENU, HPEN, HWND, LPCRECT, LPRECT, POINT, RECT, SIZE, +}; +use um::commoncontrols::IImageList; +use um::minwinbase::SYSTEMTIME; +use um::winnt::{CHAR, LANGID, LONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCWSTR, PVOID, PWSTR, WCHAR}; +use um::winuser::{ + CB_DELETESTRING, IMAGE_BITMAP, LPSCROLLINFO, LPTRACKMOUSEEVENT, NMHDR, + WINDOWPOS, WM_USER, +}; +use vc::vcruntime::size_t; +pub type HRESULT = c_long; +extern "system" { + pub fn InitCommonControls(); +} +//138 +STRUCT!{struct INITCOMMONCONTROLSEX { + dwSize: DWORD, + dwICC: DWORD, +}} +pub type LPINITCOMMONCONTROLSEX = *mut INITCOMMONCONTROLSEX; +pub const ICC_LISTVIEW_CLASSES: DWORD = 0x1; +pub const ICC_TREEVIEW_CLASSES: DWORD = 0x2; +pub const ICC_BAR_CLASSES: DWORD = 0x4; +pub const ICC_TAB_CLASSES: DWORD = 0x8; +pub const ICC_UPDOWN_CLASS: DWORD = 0x10; +pub const ICC_PROGRESS_CLASS: DWORD = 0x20; +pub const ICC_HOTKEY_CLASS: DWORD = 0x40; +pub const ICC_ANIMATE_CLASS: DWORD = 0x80; +pub const ICC_WIN95_CLASSES: DWORD = 0xFF; +pub const ICC_DATE_CLASSES: DWORD = 0x100; +pub const ICC_USEREX_CLASSES: DWORD = 0x200; +pub const ICC_COOL_CLASSES: DWORD = 0x400; +pub const ICC_INTERNET_CLASSES: DWORD = 0x800; +pub const ICC_PAGESCROLLER_CLASS: DWORD = 0x1000; +pub const ICC_NATIVEFNTCTL_CLASS: DWORD = 0x2000; +pub const ICC_STANDARD_CLASSES: DWORD = 0x4000; +pub const ICC_LINK_CLASS: DWORD = 0x8000; + +extern "system" { + pub fn InitCommonControlsEx( + lpInitCtrls: *const INITCOMMONCONTROLSEX, + ) -> BOOL; +} + +pub const ODT_HEADER: UINT = 100; +pub const ODT_TAB: UINT = 101; +pub const ODT_LISTVIEW: UINT = 102; +pub const LVM_FIRST: UINT = 0x1000; +pub const TV_FIRST: UINT = 0x1100; +pub const HDM_FIRST: UINT = 0x1200; +pub const TCM_FIRST: UINT = 0x1300; +pub const PGM_FIRST: UINT = 0x1400; +pub const ECM_FIRST: UINT = 0x1500; +pub const BCM_FIRST: UINT = 0x1600; +pub const CBM_FIRST: UINT = 0x1700; +pub const CCM_FIRST: UINT = 0x2000; +pub const CCM_LAST: UINT = CCM_FIRST + 0x200; +pub const CCM_SETBKCOLOR: UINT = CCM_FIRST + 1; +STRUCT!{struct COLORSCHEME { + dwSize: DWORD, + clrBtnHighlight: COLORREF, + clrBtnShadow: COLORREF, +}} +pub type LPCOLORSCHEME = *mut COLORSCHEME; +pub const CCM_SETCOLORSCHEME: UINT = CCM_FIRST + 2; +pub const CCM_GETCOLORSCHEME: UINT = CCM_FIRST + 3; +pub const CCM_GETDROPTARGET: UINT = CCM_FIRST + 4; +pub const CCM_SETUNICODEFORMAT: UINT = CCM_FIRST + 5; +pub const CCM_GETUNICODEFORMAT: UINT = CCM_FIRST + 6; +pub const CCM_SETVERSION: UINT = CCM_FIRST + 7; +pub const CCM_GETVERSION: UINT = CCM_FIRST + 8; +pub const CCM_SETNOTIFYWINDOW: UINT = CCM_FIRST + 9; +pub const CCM_SETWINDOWTHEME: UINT = CCM_FIRST + 0xb; +pub const CCM_DPISCALE: UINT = CCM_FIRST + 0xc; +pub const INFOTIPSIZE: c_int = 1024; +pub const NM_OUTOFMEMORY: UINT = (NM_FIRST as i32 - 1) as u32; +pub const NM_CLICK: UINT = (NM_FIRST as i32 - 2) as u32; +pub const NM_DBLCLK: UINT = (NM_FIRST as i32 - 3) as u32; +pub const NM_RETURN: UINT = (NM_FIRST as i32 - 4) as u32; +pub const NM_RCLICK: UINT = (NM_FIRST as i32 - 5) as u32; +pub const NM_RDBLCLK: UINT = (NM_FIRST as i32 - 6) as u32; +pub const NM_SETFOCUS: UINT = (NM_FIRST as i32 - 7) as u32; +pub const NM_KILLFOCUS: UINT = (NM_FIRST as i32 - 8) as u32; +pub const NM_CUSTOMDRAW: UINT = (NM_FIRST as i32 - 12) as u32; +pub const NM_HOVER: UINT = (NM_FIRST as i32 - 13) as u32; +pub const NM_NCHITTEST: UINT = (NM_FIRST as i32 - 14) as u32; +pub const NM_KEYDOWN: UINT = (NM_FIRST as i32 - 15) as u32; +pub const NM_RELEASEDCAPTURE: UINT = (NM_FIRST as i32 - 16) as u32; +pub const NM_SETCURSOR: UINT = (NM_FIRST as i32 - 17) as u32; +pub const NM_CHAR: UINT = (NM_FIRST as i32 - 18) as u32; +pub const NM_TOOLTIPSCREATED: UINT = (NM_FIRST as i32 - 19) as u32; +pub const NM_LDOWN: UINT = (NM_FIRST as i32 - 20) as u32; +pub const NM_RDOWN: UINT = (NM_FIRST as i32 - 21) as u32; +pub const NM_THEMECHANGED: UINT = (NM_FIRST as i32 - 22) as u32; +pub const NM_FONTCHANGED: UINT = (NM_FIRST as i32 - 23) as u32; +pub const NM_CUSTOMTEXT: UINT = (NM_FIRST as i32 - 24) as u32; +pub const NM_TVSTATEIMAGECHANGING: UINT = (NM_FIRST as i32 - 24) as u32; +STRUCT!{struct NMTOOLTIPSCREATED { + hdr: NMHDR, + hwndToolTips: HWND, +}} +pub type LPNMTOOLTIPSCREATED = *mut NMTOOLTIPSCREATED; +STRUCT!{struct NMMOUSE { + hdr: NMHDR, + dwItemSpec: DWORD_PTR, + dwItemData: DWORD_PTR, + pt: POINT, + dwHitInfo: LPARAM, +}} +pub type LPNMMOUSE = *mut NMMOUSE; +pub type NMCLICK = NMMOUSE; +pub type LPNMCLICK = LPNMMOUSE; +STRUCT!{struct NMOBJECTNOTIFY { + hdr: NMHDR, + iItem: c_int, + piid: *const IID, + pObject: *mut c_void, + hResult: HRESULT, + dwFlags: DWORD, +}} +pub type LPNMOBJECTNOTIFY = *mut NMOBJECTNOTIFY; +STRUCT!{struct NMKEY { + hdr: NMHDR, + nVKey: UINT, + uFlags: UINT, +}} +pub type LPNMKEY = *mut NMKEY; +STRUCT!{struct NMCHAR { + hdr: NMHDR, + ch: UINT, + dwItemPrev: DWORD, + dwItemNext: DWORD, +}} +pub type LPNMCHAR = *mut NMCHAR; +STRUCT!{struct NMCUSTOMTEXT { + hdr: NMHDR, + hDC: HDC, + lpString: LPCWSTR, + nCount: c_int, + lpRect: LPRECT, + uFormat: UINT, + fLink: BOOL, +}} +pub type LPNMCUSTOMTEXT = *mut NMCUSTOMTEXT; +pub const NM_FIRST: UINT = 0; +pub const NM_LAST: UINT = -99i32 as u32; +pub const LVN_FIRST: UINT = -100i32 as u32; +pub const LVN_LAST: UINT = -199i32 as u32; +pub const HDN_FIRST: UINT = -300i32 as u32; +pub const HDN_LAST: UINT = -399i32 as u32; +pub const TVN_FIRST: UINT = -400i32 as u32; +pub const TVN_LAST: UINT = -499i32 as u32; +pub const TTN_FIRST: UINT = -520i32 as u32; +pub const TTN_LAST: UINT = -549i32 as u32; +pub const TCN_FIRST: UINT = -550i32 as u32; +pub const TCN_LAST: UINT = -580i32 as u32; +pub const CDN_FIRST: UINT = -601i32 as u32; +pub const CDN_LAST: UINT = -699i32 as u32; +pub const TBN_FIRST: UINT = -700i32 as u32; +pub const TBN_LAST: UINT = -720i32 as u32; +pub const UDN_FIRST: UINT = -721i32 as u32; +pub const UDN_LAST: UINT = -729i32 as u32; +pub const DTN_FIRST: UINT = -740i32 as u32; +pub const DTN_LAST: UINT = -745i32 as u32; +pub const MCN_FIRST: UINT = -746i32 as u32; +pub const MCN_LAST: UINT = -752i32 as u32; +pub const DTN_FIRST2: UINT = -753i32 as u32; +pub const DTN_LAST2: UINT = -799i32 as u32; +pub const CBEN_FIRST: UINT = -800i32 as u32; +pub const CBEN_LAST: UINT = -830i32 as u32; +pub const RBN_FIRST: UINT = -831i32 as u32; +pub const RBN_LAST: UINT = -859i32 as u32; +pub const IPN_FIRST: UINT = -860i32 as u32; +pub const IPN_LAST: UINT = -879i32 as u32; +pub const SBN_FIRST: UINT = -880i32 as u32; +pub const SBN_LAST: UINT = -899i32 as u32; +pub const PGN_FIRST: UINT = -900i32 as u32; +pub const PGN_LAST: UINT = -950i32 as u32; +pub const WMN_FIRST: UINT = -1000i32 as u32; +pub const WMN_LAST: UINT = -1200i32 as u32; +pub const BCN_FIRST: UINT = -1250i32 as u32; +pub const BCN_LAST: UINT = -1350i32 as u32; +pub const TRBN_FIRST: UINT = -1501i32 as u32; +pub const TRBN_LAST: UINT = -1519i32 as u32; +pub const MSGF_COMMCTRL_BEGINDRAG: c_int = 0x4200; +pub const MSGF_COMMCTRL_SIZEHEADER: c_int = 0x4201; +pub const MSGF_COMMCTRL_DRAGSELECT: c_int = 0x4202; +pub const MSGF_COMMCTRL_TOOLBARCUST: c_int = 0x4203; +pub const CDRF_DODEFAULT: LRESULT = 0x00000000; +pub const CDRF_NEWFONT: LRESULT = 0x00000002; +pub const CDRF_SKIPDEFAULT: LRESULT = 0x00000004; +pub const CDRF_DOERASE: LRESULT = 0x00000008; +pub const CDRF_SKIPPOSTPAINT: LRESULT = 0x00000100; +pub const CDRF_NOTIFYPOSTPAINT: LRESULT = 0x00000010; +pub const CDRF_NOTIFYITEMDRAW: LRESULT = 0x00000020; +pub const CDRF_NOTIFYSUBITEMDRAW: LRESULT = 0x00000020; +pub const CDRF_NOTIFYPOSTERASE: LRESULT = 0x00000040; +pub const CDDS_PREPAINT: DWORD = 0x00000001; +pub const CDDS_POSTPAINT: DWORD = 0x00000002; +pub const CDDS_PREERASE: DWORD = 0x00000003; +pub const CDDS_POSTERASE: DWORD = 0x00000004; +pub const CDDS_ITEM: DWORD = 0x00010000; +pub const CDDS_ITEMPREPAINT: DWORD = CDDS_ITEM | CDDS_PREPAINT; +pub const CDDS_ITEMPOSTPAINT: DWORD = CDDS_ITEM | CDDS_POSTPAINT; +pub const CDDS_ITEMPREERASE: DWORD = CDDS_ITEM | CDDS_PREERASE; +pub const CDDS_ITEMPOSTERASE: DWORD = CDDS_ITEM | CDDS_POSTERASE; +pub const CDDS_SUBITEM: DWORD = 0x00020000; +pub const CDIS_SELECTED: UINT = 0x0001; +pub const CDIS_GRAYED: UINT = 0x0002; +pub const CDIS_DISABLED: UINT = 0x0004; +pub const CDIS_CHECKED: UINT = 0x0008; +pub const CDIS_FOCUS: UINT = 0x0010; +pub const CDIS_DEFAULT: UINT = 0x0020; +pub const CDIS_HOT: UINT = 0x0040; +pub const CDIS_MARKED: UINT = 0x0080; +pub const CDIS_INDETERMINATE: UINT = 0x0100; +pub const CDIS_SHOWKEYBOARDCUES: UINT = 0x0200; +pub const CDIS_NEARHOT: UINT = 0x0400; +pub const CDIS_OTHERSIDEHOT: UINT = 0x0800; +pub const CDIS_DROPHILITED: UINT = 0x1000; +STRUCT!{struct NMCUSTOMDRAW { + hdr: NMHDR, + dwDrawStage: DWORD, + hdc: HDC, + rc: RECT, + dwItemSpec: DWORD_PTR, + uItemState: UINT, + lItemlParam: LPARAM, +}} +pub type LPNMCUSTOMDRAW = *mut NMCUSTOMDRAW; +STRUCT!{struct NMTTCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + uDrawFlags: UINT, +}} +pub type LPNMTTCUSTOMDRAW = *mut NMTTCUSTOMDRAW; +STRUCT!{struct NMCUSTOMSPLITRECTINFO { + hdr: NMHDR, + rcClient: RECT, + rcButton: RECT, + rcSplit: RECT, +}} +pub type LPNMCUSTOMSPLITRECTINFO = *mut NMCUSTOMSPLITRECTINFO; +pub const NM_GETCUSTOMSPLITRECT: UINT = BCN_FIRST + 0x0003; +pub const CLR_NONE: DWORD = 0xFFFFFFFF; +pub const CLR_DEFAULT: DWORD = 0xFF000000; +pub enum IMAGELIST {} +pub type HIMAGELIST = *mut IMAGELIST; +STRUCT!{struct IMAGELISTDRAWPARAMS { + cbSize: DWORD, + himl: HIMAGELIST, + i: c_int, + hdcDst: HDC, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + xBitmap: c_int, + yBitmap: c_int, + rgbBk: COLORREF, + rgbFg: COLORREF, + fStyle: UINT, + dwRop: DWORD, + fState: DWORD, + Frame: DWORD, + crEffect: COLORREF, +}} +pub type LPIMAGELISTDRAWPARAMS = *mut IMAGELISTDRAWPARAMS; +pub const ILC_MASK: UINT = 0x00000001; +pub const ILC_COLOR: UINT = 0x00000000; +pub const ILC_COLORDDB: UINT = 0x000000FE; +pub const ILC_COLOR4: UINT = 0x00000004; +pub const ILC_COLOR8: UINT = 0x00000008; +pub const ILC_COLOR16: UINT = 0x00000010; +pub const ILC_COLOR24: UINT = 0x00000018; +pub const ILC_COLOR32: UINT = 0x00000020; +pub const ILC_PALETTE: UINT = 0x00000800; +pub const ILC_MIRROR: UINT = 0x00002000; +pub const ILC_PERITEMMIRROR: UINT = 0x00008000; +pub const ILC_ORIGINALSIZE: UINT = 0x00010000; +pub const ILC_HIGHQUALITYSCALE: UINT = 0x00020000; + +extern "system" { + pub fn ImageList_Create( + cx: c_int, + cy: c_int, + flags: UINT, + cInitial: c_int, + cGrow: c_int, + ) -> HIMAGELIST; + pub fn ImageList_Destroy( + himl: HIMAGELIST, + ) -> BOOL; + pub fn ImageList_GetImageCount( + himl: HIMAGELIST, + ) -> c_int; + pub fn ImageList_SetImageCount( + himl: HIMAGELIST, + uNewCount: UINT, + ) -> BOOL; + pub fn ImageList_Add( + himl: HIMAGELIST, + hbmImage: HBITMAP, + hbmMask: HBITMAP, + ) -> c_int; + pub fn ImageList_ReplaceIcon( + himl: HIMAGELIST, + i: c_int, + hicon: HICON, + ) -> c_int; + pub fn ImageList_SetBkColor( + himl: HIMAGELIST, + clrBk: COLORREF, + ) -> COLORREF; + pub fn ImageList_GetBkColor( + himl: HIMAGELIST, + ) -> COLORREF; + pub fn ImageList_SetOverlayImage( + himl: HIMAGELIST, + iImage: c_int, + iOverlay: c_int, + ) -> BOOL; +} +#[inline] +pub unsafe fn ImageList_AddIcon(himl: HIMAGELIST, hicon: HICON) -> c_int { + ImageList_ReplaceIcon(himl, -1, hicon) +} +pub const ILD_NORMAL: UINT = 0x00000000; +pub const ILD_TRANSPARENT: UINT = 0x00000001; +pub const ILD_MASK: UINT = 0x00000010; +pub const ILD_IMAGE: UINT = 0x00000020; +pub const ILD_ROP: UINT = 0x00000040; +pub const ILD_BLEND25: UINT = 0x00000002; +pub const ILD_BLEND50: UINT = 0x00000004; +pub const ILD_OVERLAYMASK: UINT = 0x00000F00; +#[inline] +pub fn INDEXTOOVERLAYMASK(i: UINT) -> UINT { + i << 8 +} +pub const ILD_PRESERVEALPHA: UINT = 0x00001000; +pub const ILD_SCALE: UINT = 0x00002000; +pub const ILD_DPISCALE: UINT = 0x00004000; +pub const ILD_ASYNC: UINT = 0x00008000; +pub const ILD_SELECTED: UINT = ILD_BLEND50; +pub const ILD_FOCUS: UINT = ILD_BLEND25; +pub const ILD_BLEND: UINT = ILD_BLEND50; +pub const CLR_HILIGHT: DWORD = CLR_DEFAULT; +pub const ILS_NORMAL: DWORD = 0x00000000; +pub const ILS_GLOW: DWORD = 0x00000001; +pub const ILS_SHADOW: DWORD = 0x00000002; +pub const ILS_SATURATE: DWORD = 0x00000004; +pub const ILS_ALPHA: DWORD = 0x00000008; +pub const ILGT_NORMAL: DWORD = 0x00000000; +pub const ILGT_ASYNC : DWORD = 0x00000001; + +extern "system" { + pub fn ImageList_Draw( + himl: HIMAGELIST, + i: c_int, + hdcDst: HDC, + x: c_int, + y: c_int, + fStyle: UINT, + ) -> BOOL; +} +pub const HBITMAP_CALLBACK: HBITMAP = -1isize as HBITMAP; + +extern "system" { + pub fn ImageList_Replace( + himl: HIMAGELIST, + i: c_int, + hbmImage: HBITMAP, + hbmMask: HBITMAP, + ) -> BOOL; + pub fn ImageList_AddMasked( + himl: HIMAGELIST, + hbmImage: HBITMAP, + crMask: COLORREF, + ) -> c_int; + pub fn ImageList_DrawEx( + himl: HIMAGELIST, + i: c_int, + hdcDst: HDC, + x: c_int, + y: c_int, + dx: c_int, + dy: c_int, + rgbBk: COLORREF, + rgbFg: COLORREF, + fStyle: UINT, + ) -> BOOL; + pub fn ImageList_DrawIndirect( + pimldp: *mut IMAGELISTDRAWPARAMS, + ) -> BOOL; + pub fn ImageList_Remove( + himl: HIMAGELIST, + i: c_int, + ) -> BOOL; + pub fn ImageList_GetIcon( + himl: HIMAGELIST, + i: c_int, + flags: UINT, + ) -> HICON; + pub fn ImageList_LoadImageA( + hi: HINSTANCE, + lpbmp: LPCSTR, + cx: c_int, + cGrow: c_int, + crMask: COLORREF, + uType: UINT, + uFlags: UINT, + ) -> HIMAGELIST; + pub fn ImageList_LoadImageW( + hi: HINSTANCE, + lpbmp: LPCWSTR, + cx: c_int, + cGrow: c_int, + crMask: COLORREF, + uType: UINT, + uFlags: UINT, + ) -> HIMAGELIST; +} +pub const ILCF_MOVE: UINT = 0x00000000; +pub const ILCF_SWAP: UINT = 0x00000001; + +extern "system" { + pub fn ImageList_Copy( + himlDst: HIMAGELIST, + iDst: c_int, + himlSrc: HIMAGELIST, + iSrc: c_int, + uFlags: UINT, + ) -> BOOL; + pub fn ImageList_BeginDrag( + himlTrack: HIMAGELIST, + iTrack: c_int, + dxHotspot: c_int, + dyHotspot: c_int, + ) -> BOOL; + pub fn ImageList_EndDrag(); + pub fn ImageList_DragEnter( + hwndLock: HWND, + x: c_int, + y: c_int, + ) -> BOOL; + pub fn ImageList_DragLeave( + hwndLock: HWND, + ) -> BOOL; + pub fn ImageList_DragMove( + x: c_int, + y: c_int, + ) -> BOOL; + pub fn ImageList_SetDragCursorImage( + himlDrag: HIMAGELIST, + iDrag: c_int, + dxHotspot: c_int, + dyHotspot: c_int, + ) -> BOOL; + pub fn ImageList_DragShowNolock( + fShow: BOOL, + ) -> BOOL; + pub fn ImageList_GetDragImage( + ppt: *mut POINT, + pptHotspot: *mut POINT, + ) -> HIMAGELIST; +} +#[inline] +pub unsafe fn ImageList_RemoveAll(himl: HIMAGELIST) -> BOOL { + ImageList_Remove(himl, -1) +} +#[inline] +pub unsafe fn ImageList_ExtractIcon(_: HINSTANCE, himl: HIMAGELIST, i: c_int) -> HICON { + ImageList_GetIcon(himl, i, 0) +} +#[inline] +pub unsafe fn ImageList_LoadBitmap( + hi: HINSTANCE, + lpbmp: LPCWSTR, + cx: c_int, + cGrow: c_int, + crMask: COLORREF, +) -> HIMAGELIST { + ImageList_LoadImageW(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0) +} +pub enum IStream {} +extern "system" { + pub fn ImageList_Read( + pstm: *mut IStream, + ) -> HIMAGELIST; + pub fn ImageList_Write( + himl: HIMAGELIST, + pstm: *mut IStream, + ) -> BOOL; +} +pub const ILP_NORMAL: DWORD = 0; +pub const ILP_DOWNLEVEL: DWORD = 0; +extern "system" { + pub fn ImageList_ReadEx( + dwFlags: DWORD, + pstm: *mut IStream, + riid: REFIID, + ppv: *mut PVOID, + ) -> HRESULT; + pub fn ImageList_WriteEx( + himl: HIMAGELIST, + dwFlags: DWORD, + pstm: *mut IStream, + ) -> HRESULT; +} +STRUCT!{struct IMAGEINFO { + hbmImage: HBITMAP, + hbmMask: HBITMAP, + Unused1: c_int, + Unused2: c_int, + rcImage: RECT, +}} +pub type LPIMAGEINFO = *mut IMAGEINFO; +extern "system" { + pub fn ImageList_GetIconSize( + himl: HIMAGELIST, + cx: *mut c_int, + cy: *mut c_int, + ) -> BOOL; + pub fn ImageList_SetIconSize( + himl: HIMAGELIST, + cx: c_int, + cy: c_int, + ) -> BOOL; + pub fn ImageList_GetImageInfo( + himl: HIMAGELIST, + i: c_int, + pImageInfo: *mut IMAGEINFO, + ) -> BOOL; + pub fn ImageList_Merge( + himl1: HIMAGELIST, + i1: c_int, + himl2: HIMAGELIST, + i2: c_int, + dx: c_int, + dy: c_int, + ) -> HIMAGELIST; + pub fn ImageList_Duplicate( + himl: HIMAGELIST, + ) -> HIMAGELIST; + pub fn HIMAGELIST_QueryInterface( + himl: HIMAGELIST, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT; +} +#[inline] +pub fn IImageListToHIMAGELIST(himl: *mut IImageList) -> HIMAGELIST { + himl as HIMAGELIST +} +pub const WC_HEADER: &'static str = "SysHeader32"; +pub const HDS_HORZ: DWORD = 0x0000; +pub const HDS_BUTTONS: DWORD = 0x0002; +pub const HDS_HOTTRACK: DWORD = 0x0004; +pub const HDS_HIDDEN: DWORD = 0x0008; +pub const HDS_DRAGDROP: DWORD = 0x0040; +pub const HDS_FULLDRAG: DWORD = 0x0080; +pub const HDS_FILTERBAR: DWORD = 0x0100; +pub const HDS_FLAT: DWORD = 0x0200; +pub const HDS_CHECKBOXES: DWORD = 0x0400; +pub const HDS_NOSIZING: DWORD = 0x0800; +pub const HDS_OVERFLOW: DWORD = 0x1000; +pub const HDFT_ISSTRING: UINT = 0x0000; +pub const HDFT_ISNUMBER: UINT = 0x0001; +pub const HDFT_ISDATE: UINT = 0x0002; +pub const HDFT_HASNOVALUE: UINT = 0x8000; +STRUCT!{struct HD_TEXTFILTERA { + pszText: LPSTR, + cchTextMax: INT, +}} +pub type LPHD_TEXTFILTERA = *mut HD_TEXTFILTERA; +STRUCT!{struct HD_TEXTFILTERW { + pszText: LPWSTR, + cchTextMax: INT, +}} +pub type LPHD_TEXTFILTERW = *mut HD_TEXTFILTERW; +STRUCT!{struct HDITEMA { + mask: UINT, + cxy: c_int, + pszText: LPSTR, + hbm: HBITMAP, + cchTextMax: c_int, + fmt: c_int, + lParam: LPARAM, + iImage: c_int, + iOrder: c_int, + _type: UINT, + pvFilter: *mut c_void, + state: UINT, +}} +pub type LPHDITEMA = *mut HDITEMA; +STRUCT!{struct HDITEMW { + mask: UINT, + cxy: c_int, + pszText: LPWSTR, + hbm: HBITMAP, + cchTextMax: c_int, + fmt: c_int, + lParam: LPARAM, + iImage: c_int, + iOrder: c_int, + _type: UINT, + pvFilter: *mut c_void, + state: UINT, +}} +pub type LPHDITEMW = *mut HDITEMW; +pub const HDI_WIDTH: UINT = 0x0001; +pub const HDI_HEIGHT: UINT = HDI_WIDTH; +pub const HDI_TEXT: UINT = 0x0002; +pub const HDI_FORMAT: UINT = 0x0004; +pub const HDI_LPARAM: UINT = 0x0008; +pub const HDI_BITMAP: UINT = 0x0010; +pub const HDI_IMAGE: UINT = 0x0020; +pub const HDI_DI_SETITEM: UINT = 0x0040; +pub const HDI_ORDER: UINT = 0x0080; +pub const HDI_FILTER: UINT = 0x0100; +pub const HDI_STATE: UINT = 0x0200; +pub const HDF_LEFT: c_int = 0x0000; +pub const HDF_RIGHT: c_int = 0x0001; +pub const HDF_CENTER: c_int = 0x0002; +pub const HDF_JUSTIFYMASK: c_int = 0x0003; +pub const HDF_RTLREADING: c_int = 0x0004; +pub const HDF_BITMAP: c_int = 0x2000; +pub const HDF_STRING: c_int = 0x4000; +pub const HDF_OWNERDRAW: c_int = 0x8000; +pub const HDF_IMAGE: c_int = 0x0800; +pub const HDF_BITMAP_ON_RIGHT: c_int = 0x1000; +pub const HDF_SORTUP: c_int = 0x0400; +pub const HDF_SORTDOWN: c_int = 0x0200; +pub const HDF_CHECKBOX: c_int = 0x0040; +pub const HDF_CHECKED: c_int = 0x0080; +pub const HDF_FIXEDWIDTH: c_int = 0x0100; +pub const HDF_SPLITBUTTON: c_int = 0x1000000; +pub const HDIS_FOCUSED: UINT = 0x00000001; +pub const HDM_GETITEMCOUNT: UINT = HDM_FIRST + 0; +pub const HDM_INSERTITEMA: UINT = HDM_FIRST + 1; +pub const HDM_INSERTITEMW: UINT = HDM_FIRST + 10; +pub const HDM_DELETEITEM: UINT = HDM_FIRST + 2; +pub const HDM_GETITEMA: UINT = HDM_FIRST + 3; +pub const HDM_GETITEMW: UINT = HDM_FIRST + 11; +pub const HDM_SETITEMA: UINT = HDM_FIRST + 4; +pub const HDM_SETITEMW: UINT = HDM_FIRST + 12; +STRUCT!{struct HDLAYOUT { + prc: *mut RECT, + pwpos: *mut WINDOWPOS, +}} +pub type LPHDLAYOUT = *mut HDLAYOUT; +pub const HDM_LAYOUT: UINT = HDM_FIRST + 5; +pub const HHT_NOWHERE: UINT = 0x0001; +pub const HHT_ONHEADER: UINT = 0x0002; +pub const HHT_ONDIVIDER: UINT = 0x0004; +pub const HHT_ONDIVOPEN: UINT = 0x0008; +pub const HHT_ONFILTER: UINT = 0x0010; +pub const HHT_ONFILTERBUTTON: UINT = 0x0020; +pub const HHT_ABOVE: UINT = 0x0100; +pub const HHT_BELOW: UINT = 0x0200; +pub const HHT_TORIGHT: UINT = 0x0400; +pub const HHT_TOLEFT: UINT = 0x0800; +pub const HHT_ONITEMSTATEICON: UINT = 0x1000; +pub const HHT_ONDROPDOWN: UINT = 0x2000; +pub const HHT_ONOVERFLOW: UINT = 0x4000; +STRUCT!{struct HDHITTESTINFO { + pt: POINT, + flags: UINT, + iItem: c_int, +}} +pub type LPHDHITTESTINFO = *mut HDHITTESTINFO; +pub type HD_HITTESTINFO = HDHITTESTINFO; +pub const HDSIL_NORMAL: WPARAM = 0; +pub const HDSIL_STATE: WPARAM = 1; +pub const HDM_HITTEST: UINT = HDM_FIRST + 6; +pub const HDM_GETITEMRECT: UINT = HDM_FIRST + 7; +pub const HDM_SETIMAGELIST: UINT = HDM_FIRST + 8; +pub const HDM_GETIMAGELIST: UINT = HDM_FIRST + 9; +pub const HDM_ORDERTOINDEX: UINT = HDM_FIRST + 15; +pub const HDM_CREATEDRAGIMAGE: UINT = HDM_FIRST + 16; +pub const HDM_GETORDERARRAY: UINT = HDM_FIRST + 17; +pub const HDM_SETORDERARRAY: UINT = HDM_FIRST + 18; +pub const HDM_SETHOTDIVIDER: UINT = HDM_FIRST + 19; +pub const HDM_SETBITMAPMARGIN: UINT = HDM_FIRST + 20; +pub const HDM_GETBITMAPMARGIN: UINT = HDM_FIRST + 21; +pub const HDM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const HDM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const HDM_SETFILTERCHANGETIMEOUT: UINT = HDM_FIRST + 22; +pub const HDM_EDITFILTER: UINT = HDM_FIRST + 23; +pub const HDM_CLEARFILTER: UINT = HDM_FIRST + 24; +pub const HDM_GETITEMDROPDOWNRECT: UINT = HDM_FIRST + 25; +pub const HDM_GETOVERFLOWRECT: UINT = HDM_FIRST + 26; +pub const HDM_GETFOCUSEDITEM: UINT = HDM_FIRST + 27; +pub const HDM_SETFOCUSEDITEM: UINT = HDM_FIRST + 28; +pub const HDN_ITEMCHANGINGA: UINT = HDN_FIRST - 0; +pub const HDN_ITEMCHANGINGW: UINT = HDN_FIRST - 20; +pub const HDN_ITEMCHANGEDA: UINT = HDN_FIRST - 1; +pub const HDN_ITEMCHANGEDW: UINT = HDN_FIRST - 21; +pub const HDN_ITEMCLICKA: UINT = HDN_FIRST - 2; +pub const HDN_ITEMCLICKW: UINT = HDN_FIRST - 22; +pub const HDN_ITEMDBLCLICKA: UINT = HDN_FIRST - 3; +pub const HDN_ITEMDBLCLICKW: UINT = HDN_FIRST - 23; +pub const HDN_DIVIDERDBLCLICKA: UINT = HDN_FIRST - 5; +pub const HDN_DIVIDERDBLCLICKW: UINT = HDN_FIRST - 25; +pub const HDN_BEGINTRACKA: UINT = HDN_FIRST - 6; +pub const HDN_BEGINTRACKW: UINT = HDN_FIRST - 26; +pub const HDN_ENDTRACKA: UINT = HDN_FIRST - 7; +pub const HDN_ENDTRACKW: UINT = HDN_FIRST - 27; +pub const HDN_TRACKA: UINT = HDN_FIRST - 8; +pub const HDN_TRACKW: UINT = HDN_FIRST - 28; +pub const HDN_GETDISPINFOA: UINT = HDN_FIRST - 9; +pub const HDN_GETDISPINFOW: UINT = HDN_FIRST - 29; +pub const HDN_BEGINDRAG: UINT = HDN_FIRST - 10; +pub const HDN_ENDDRAG: UINT = HDN_FIRST - 11; +pub const HDN_FILTERCHANGE: UINT = HDN_FIRST - 12; +pub const HDN_FILTERBTNCLICK: UINT = HDN_FIRST - 13; +pub const HDN_BEGINFILTEREDIT: UINT = HDN_FIRST - 14; +pub const HDN_ENDFILTEREDIT: UINT = HDN_FIRST - 15; +pub const HDN_ITEMSTATEICONCLICK: UINT = HDN_FIRST - 16; +pub const HDN_ITEMKEYDOWN: UINT = HDN_FIRST - 17; +pub const HDN_DROPDOWN: UINT = HDN_FIRST - 18; +pub const HDN_OVERFLOWCLICK: UINT = HDN_FIRST - 19; +STRUCT!{struct NMHEADERA { + hdr: NMHDR, + iItem: c_int, + iButton: c_int, + pitem: *mut HDITEMA, +}} +pub type LPNMHEADERA = *mut NMHEADERA; +pub type HD_NOTIFYA = NMHEADERA; +STRUCT!{struct NMHEADERW { + hdr: NMHDR, + iItem: c_int, + iButton: c_int, + pitem: *mut HDITEMW, +}} +pub type LPNMHEADERW = *mut NMHEADERW; +pub type HD_NOTIFYW = NMHEADERW; +STRUCT!{struct NMHDDISPINFOW { + hdr: NMHDR, + iItem: c_int, + mask: UINT, + pszText: LPWSTR, + cchTextMax: c_int, + iImage: c_int, + lParam: LPARAM, +}} +pub type LPNMHDDISPINFOW = *mut NMHDDISPINFOW; +STRUCT!{struct NMHDDISPINFOA { + hdr: NMHDR, + iItem: c_int, + mask: UINT, + pszText: LPSTR, + cchTextMax: c_int, + iImage: c_int, + lParam: LPARAM, +}} +pub type LPNMHDDISPINFOA = *mut NMHDDISPINFOA; +STRUCT!{struct NMHDFILTERBTNCLICK { + hdr: NMHDR, + iItem: INT, + rc: RECT, +}} +pub type LPNMHDFILTERBTNCLICK = *mut NMHDFILTERBTNCLICK; +pub const TOOLBARCLASSNAME: &'static str = "ToolbarWindow32"; +#[cfg(target_arch = "x86")] +STRUCT!{struct TBBUTTON { + iBitmap: c_int, + idCommand: c_int, + fsState: BYTE, + fsStyle: BYTE, + bReserved: [BYTE; 2], + dwData: DWORD_PTR, + iString: INT_PTR, +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct TBBUTTON { + iBitmap: c_int, + idCommand: c_int, + fsState: BYTE, + fsStyle: BYTE, + bReserved: [BYTE; 6], + dwData: DWORD_PTR, + iString: INT_PTR, +}} +pub type PTBBUTTON = *mut TBBUTTON; +pub type LPTBBUTTON = *mut TBBUTTON; +pub type LPCTBBUTTON = *const TBBUTTON; +STRUCT!{struct COLORMAP { + from: COLORREF, + to: COLORREF, +}} +pub type LPCOLORMAP = *mut COLORMAP; +extern "system" { + pub fn CreateToolbarEx( + hwnd: HWND, + ws: DWORD, + wID: UINT, + nBitmaps: c_int, + hBMInst: HINSTANCE, + wBMID: UINT_PTR, + lpButtons: LPCTBBUTTON, + iNumButtons: c_int, + dxButton: c_int, + dyButton: c_int, + dxBitmap: c_int, + dyBitmap: c_int, + uStructSize: UINT, + ) -> HWND; + pub fn CreateMappedBitmap( + hInstance: HINSTANCE, + idBitmap: INT_PTR, + wFlags: UINT, + lpColorMap: LPCOLORMAP, + iNumMaps: c_int, + ) -> HBITMAP; +} +pub const CMB_MASKED: UINT = 0x02; +pub const TBSTATE_CHECKED: BYTE = 0x01; +pub const TBSTATE_PRESSED: BYTE = 0x02; +pub const TBSTATE_ENABLED: BYTE = 0x04; +pub const TBSTATE_HIDDEN: BYTE = 0x08; +pub const TBSTATE_INDETERMINATE: BYTE = 0x10; +pub const TBSTATE_WRAP: BYTE = 0x20; +pub const TBSTATE_ELLIPSES: BYTE = 0x40; +pub const TBSTATE_MARKED: BYTE = 0x80; +pub const TBSTYLE_BUTTON: DWORD = 0x0000; +pub const TBSTYLE_SEP: DWORD = 0x0001; +pub const TBSTYLE_CHECK: DWORD = 0x0002; +pub const TBSTYLE_GROUP: DWORD = 0x0004; +pub const TBSTYLE_CHECKGROUP: DWORD = TBSTYLE_GROUP | TBSTYLE_CHECK; +pub const TBSTYLE_DROPDOWN: DWORD = 0x0008; +pub const TBSTYLE_AUTOSIZE: DWORD = 0x0010; +pub const TBSTYLE_NOPREFIX: DWORD = 0x0020; +pub const TBSTYLE_TOOLTIPS: DWORD = 0x0100; +pub const TBSTYLE_WRAPABLE: DWORD = 0x0200; +pub const TBSTYLE_ALTDRAG: DWORD = 0x0400; +pub const TBSTYLE_FLAT: DWORD = 0x0800; +pub const TBSTYLE_LIST: DWORD = 0x1000; +pub const TBSTYLE_CUSTOMERASE: DWORD = 0x2000; +pub const TBSTYLE_REGISTERDROP: DWORD = 0x4000; +pub const TBSTYLE_TRANSPARENT: DWORD = 0x8000; +pub const TBSTYLE_EX_DRAWDDARROWS: DWORD = 0x00000001; +pub const BTNS_BUTTON: DWORD = TBSTYLE_BUTTON; +pub const BTNS_SEP: DWORD = TBSTYLE_SEP; +pub const BTNS_CHECK: DWORD = TBSTYLE_CHECK; +pub const BTNS_GROUP: DWORD = TBSTYLE_GROUP; +pub const BTNS_CHECKGROUP: DWORD = TBSTYLE_CHECKGROUP; +pub const BTNS_DROPDOWN: DWORD = TBSTYLE_DROPDOWN; +pub const BTNS_AUTOSIZE: DWORD = TBSTYLE_AUTOSIZE; +pub const BTNS_NOPREFIX: DWORD = TBSTYLE_NOPREFIX; +pub const BTNS_SHOWTEXT: DWORD = 0x0040; +pub const BTNS_WHOLEDROPDOWN: DWORD = 0x0080; +pub const TBSTYLE_EX_MIXEDBUTTONS: DWORD = 0x00000008; +pub const TBSTYLE_EX_HIDECLIPPEDBUTTONS: DWORD = 0x00000010; +pub const TBSTYLE_EX_MULTICOLUMN: DWORD = 0x00000002; +pub const TBSTYLE_EX_VERTICAL: DWORD = 0x00000004; +pub const TBSTYLE_EX_DOUBLEBUFFER: DWORD = 0x00000080; +STRUCT!{struct NMTBCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + hbrMonoDither: HBRUSH, + hbrLines: HBRUSH, + hpenLines: HPEN, + clrText: COLORREF, + clrMark: COLORREF, + clrTextHighlight: COLORREF, + clrBtnFace: COLORREF, + clrBtnHighlight: COLORREF, + clrHighlightHotTrack: COLORREF, + rcText: RECT, + nStringBkMode: c_int, + nHLStringBkMode: c_int, + iListGap: c_int, +}} +pub type LPNMTBCUSTOMDRAW = *mut NMTBCUSTOMDRAW; +pub const TBCDRF_NOEDGES: LRESULT = 0x00010000; +pub const TBCDRF_HILITEHOTTRACK: LRESULT = 0x00020000; +pub const TBCDRF_NOOFFSET: LRESULT = 0x00040000; +pub const TBCDRF_NOMARK: LRESULT = 0x00080000; +pub const TBCDRF_NOETCHEDEFFECT: LRESULT = 0x00100000; +pub const TBCDRF_BLENDICON: LRESULT = 0x00200000; +pub const TBCDRF_NOBACKGROUND: LRESULT = 0x00400000; +pub const TBCDRF_USECDCOLORS: LRESULT = 0x00800000; +pub const TB_ENABLEBUTTON: UINT = WM_USER + 1; +pub const TB_CHECKBUTTON: UINT = WM_USER + 2; +pub const TB_PRESSBUTTON: UINT = WM_USER + 3; +pub const TB_HIDEBUTTON: UINT = WM_USER + 4; +pub const TB_INDETERMINATE: UINT = WM_USER + 5; +pub const TB_MARKBUTTON: UINT = WM_USER + 6; +pub const TB_ISBUTTONENABLED: UINT = WM_USER + 9; +pub const TB_ISBUTTONCHECKED: UINT = WM_USER + 10; +pub const TB_ISBUTTONPRESSED: UINT = WM_USER + 11; +pub const TB_ISBUTTONHIDDEN: UINT = WM_USER + 12; +pub const TB_ISBUTTONINDETERMINATE: UINT = WM_USER + 13; +pub const TB_ISBUTTONHIGHLIGHTED: UINT = WM_USER + 14; +pub const TB_SETSTATE: UINT = WM_USER + 17; +pub const TB_GETSTATE: UINT = WM_USER + 18; +pub const TB_ADDBITMAP: UINT = WM_USER + 19; +STRUCT!{struct TBADDBITMAP { + hInst: HINSTANCE, + nID: UINT_PTR, +}} +pub type LPTBADDBITMAP = *mut TBADDBITMAP; +pub const HINST_COMMCTRL: HINSTANCE = -1isize as HINSTANCE; +pub const IDB_STD_SMALL_COLOR: WPARAM = 0; +pub const IDB_STD_LARGE_COLOR: WPARAM = 1; +pub const IDB_VIEW_SMALL_COLOR: WPARAM = 4; +pub const IDB_VIEW_LARGE_COLOR: WPARAM = 5; +pub const IDB_HIST_SMALL_COLOR: WPARAM = 8; +pub const IDB_HIST_LARGE_COLOR: WPARAM = 9; +pub const IDB_HIST_NORMAL: WPARAM = 12; +pub const IDB_HIST_HOT: WPARAM = 13; +pub const IDB_HIST_DISABLED: WPARAM = 14; +pub const IDB_HIST_PRESSED: WPARAM = 15; +pub const STD_CUT: c_int = 0; +pub const STD_COPY: c_int = 1; +pub const STD_PASTE: c_int = 2; +pub const STD_UNDO: c_int = 3; +pub const STD_REDOW: c_int = 4; +pub const STD_DELETE: c_int = 5; +pub const STD_FILENEW: c_int = 6; +pub const STD_FILEOPEN: c_int = 7; +pub const STD_FILESAVE: c_int = 8; +pub const STD_PRINTPRE: c_int = 9; +pub const STD_PROPERTIES: c_int = 10; +pub const STD_HELP: c_int = 11; +pub const STD_FIND: c_int = 12; +pub const STD_REPLACE: c_int = 13; +pub const STD_PRINT: c_int = 14; +pub const VIEW_LARGEICONS: c_int = 0; +pub const VIEW_SMALLICONS: c_int = 1; +pub const VIEW_LIST: c_int = 2; +pub const VIEW_DETAILS: c_int = 3; +pub const VIEW_SORTNAME: c_int = 4; +pub const VIEW_SORTSIZE: c_int = 5; +pub const VIEW_SORTDATE: c_int = 6; +pub const VIEW_SORTTYPE: c_int = 7; +pub const VIEW_PARENTFOLDER: c_int = 8; +pub const VIEW_NETCONNECT: c_int = 9; +pub const VIEW_NETDISCONNECT: c_int = 10; +pub const VIEW_NEWFOLDER: c_int = 11; +pub const VIEW_VIEWMENU: c_int = 12; +pub const HIST_BACK: c_int = 0; +pub const HIST_FORWARD: c_int = 1; +pub const HIST_FAVORITES: c_int = 2; +pub const HIST_ADDTOFAVORITES: c_int = 3; +pub const HIST_VIEWTREE: c_int = 4; +pub const TB_ADDBUTTONSA: UINT = WM_USER + 20; +pub const TB_INSERTBUTTONA: UINT = WM_USER + 21; +pub const TB_DELETEBUTTON: UINT = WM_USER + 22; +pub const TB_GETBUTTON: UINT = WM_USER + 23; +pub const TB_BUTTONCOUNT: UINT = WM_USER + 24; +pub const TB_COMMANDTOINDEX: UINT = WM_USER + 25; +STRUCT!{struct TBSAVEPARAMSA { + hkr: HKEY, + pszSubKey: LPCSTR, + pszValueName: LPCSTR, +}} +pub type LPTBSAVEPARAMSA = *mut TBSAVEPARAMSA; +STRUCT!{struct TBSAVEPARAMSW { + hkr: HKEY, + pszSubKey: LPCWSTR, + pszValueName: LPCWSTR, +}} +pub type LPTBSAVEPARAMSW = *mut TBSAVEPARAMSW; +pub const TB_SAVERESTOREA: UINT = WM_USER + 26; +pub const TB_SAVERESTOREW: UINT = WM_USER + 76; +pub const TB_CUSTOMIZE: UINT = WM_USER + 27; +pub const TB_ADDSTRINGA: UINT = WM_USER + 28; +pub const TB_ADDSTRINGW: UINT = WM_USER + 77; +pub const TB_GETITEMRECT: UINT = WM_USER + 29; +pub const TB_BUTTONSTRUCTSIZE: UINT = WM_USER + 30; +pub const TB_SETBUTTONSIZE: UINT = WM_USER + 31; +pub const TB_SETBITMAPSIZE: UINT = WM_USER + 32; +pub const TB_AUTOSIZE: UINT = WM_USER + 33; +pub const TB_GETTOOLTIPS: UINT = WM_USER + 35; +pub const TB_SETTOOLTIPS: UINT = WM_USER + 36; +pub const TB_SETPARENT: UINT = WM_USER + 37; +pub const TB_SETROWS: UINT = WM_USER + 39; +pub const TB_GETROWS: UINT = WM_USER + 40; +pub const TB_SETCMDID: UINT = WM_USER + 42; +pub const TB_CHANGEBITMAP: UINT = WM_USER + 43; +pub const TB_GETBITMAP: UINT = WM_USER + 44; +pub const TB_GETBUTTONTEXTA: UINT = WM_USER + 45; +pub const TB_GETBUTTONTEXTW: UINT = WM_USER + 75; +pub const TB_REPLACEBITMAP: UINT = WM_USER + 46; +pub const TB_SETINDENT: UINT = WM_USER + 47; +pub const TB_SETIMAGELIST: UINT = WM_USER + 48; +pub const TB_GETIMAGELIST: UINT = WM_USER + 49; +pub const TB_LOADIMAGES: UINT = WM_USER + 50; +pub const TB_GETRECT: UINT = WM_USER + 51; +pub const TB_SETHOTIMAGELIST: UINT = WM_USER + 52; +pub const TB_GETHOTIMAGELIST: UINT = WM_USER + 53; +pub const TB_SETDISABLEDIMAGELIST: UINT = WM_USER + 54; +pub const TB_GETDISABLEDIMAGELIST: UINT = WM_USER + 55; +pub const TB_SETSTYLE: UINT = WM_USER + 56; +pub const TB_GETSTYLE: UINT = WM_USER + 57; +pub const TB_GETBUTTONSIZE: UINT = WM_USER + 58; +pub const TB_SETBUTTONWIDTH: UINT = WM_USER + 59; +pub const TB_SETMAXTEXTROWS: UINT = WM_USER + 60; +pub const TB_GETTEXTROWS: UINT = WM_USER + 61; +pub const TB_GETOBJECT: UINT = WM_USER + 62; +pub const TB_GETHOTITEM: UINT = WM_USER + 71; +pub const TB_SETHOTITEM: UINT = WM_USER + 72; +pub const TB_SETANCHORHIGHLIGHT: UINT = WM_USER + 73; +pub const TB_GETANCHORHIGHLIGHT: UINT = WM_USER + 74; +pub const TB_MAPACCELERATORA: UINT = WM_USER + 78; +STRUCT!{struct TBINSERTMARK { + iButton: c_int, + dwFlags: DWORD, +}} +pub type LPTBINSERTMARK = *mut TBINSERTMARK; +pub const TBIMHT_AFTER: DWORD = 0x00000001; +pub const TBIMHT_BACKGROUND: DWORD = 0x00000002; +pub const TB_GETINSERTMARK: UINT = WM_USER + 79; +pub const TB_SETINSERTMARK: UINT = WM_USER + 80; +pub const TB_INSERTMARKHITTEST: UINT = WM_USER + 81; +pub const TB_MOVEBUTTON: UINT = WM_USER + 82; +pub const TB_GETMAXSIZE: UINT = WM_USER + 83; +pub const TB_SETEXTENDEDSTYLE: UINT = WM_USER + 84; +pub const TB_GETEXTENDEDSTYLE: UINT = WM_USER + 85; +pub const TB_GETPADDING: UINT = WM_USER + 86; +pub const TB_SETPADDING: UINT = WM_USER + 87; +pub const TB_SETINSERTMARKCOLOR: UINT = WM_USER + 88; +pub const TB_GETINSERTMARKCOLOR: UINT = WM_USER + 89; +pub const TB_SETCOLORSCHEME: UINT = CCM_SETCOLORSCHEME; +pub const TB_GETCOLORSCHEME: UINT = CCM_GETCOLORSCHEME; +pub const TB_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const TB_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const TB_MAPACCELERATORW: UINT = WM_USER + 90; +STRUCT!{struct TBREPLACEBITMAP { + hInstOld: HINSTANCE, + nIDOld: UINT_PTR, + hInstNew: HINSTANCE, + nIDNew: UINT_PTR, + nButtons: c_int, +}} +pub type LPTBREPLACEBITMAP = *mut TBREPLACEBITMAP; +pub const TBBF_LARGE: DWORD = 0x0001; +pub const TB_GETBITMAPFLAGS: UINT = WM_USER + 41; +pub const TBIF_IMAGE: DWORD = 0x00000001; +pub const TBIF_TEXT: DWORD = 0x00000002; +pub const TBIF_STATE: DWORD = 0x00000004; +pub const TBIF_STYLE: DWORD = 0x00000008; +pub const TBIF_LPARAM: DWORD = 0x00000010; +pub const TBIF_COMMAND: DWORD = 0x00000020; +pub const TBIF_SIZE: DWORD = 0x00000040; +pub const TBIF_BYINDEX: DWORD = 0x80000000; +STRUCT!{struct TBBUTTONINFOA { + cbSize: UINT, + dwMask: DWORD, + idCommand: c_int, + iImage: c_int, + fsState: BYTE, + fsStyle: BYTE, + cx: WORD, + lParam: DWORD_PTR, + pszText: LPSTR, + cchText: c_int, +}} +pub type LPTBBUTTONINFOA = *mut TBBUTTONINFOA; +STRUCT!{struct TBBUTTONINFOW { + cbSize: UINT, + dwMask: DWORD, + idCommand: c_int, + iImage: c_int, + fsState: BYTE, + fsStyle: BYTE, + cx: WORD, + lParam: DWORD_PTR, + pszText: LPWSTR, + cchText: c_int, +}} +pub type LPTBBUTTONINFOW = *mut TBBUTTONINFOW; +pub const TB_GETBUTTONINFOW: UINT = WM_USER + 63; +pub const TB_SETBUTTONINFOW: UINT = WM_USER + 64; +pub const TB_GETBUTTONINFOA: UINT = WM_USER + 65; +pub const TB_SETBUTTONINFOA: UINT = WM_USER + 66; +pub const TB_INSERTBUTTONW: UINT = WM_USER + 67; +pub const TB_ADDBUTTONSW: UINT = WM_USER + 68; +pub const TB_HITTEST: UINT = WM_USER + 69; +pub const TB_SETDRAWTEXTFLAGS: UINT = WM_USER + 70; +pub const TB_GETSTRINGW: UINT = WM_USER + 91; +pub const TB_GETSTRINGA: UINT = WM_USER + 92; +pub const TB_SETBOUNDINGSIZE: UINT = WM_USER + 93; +pub const TB_SETHOTITEM2: UINT = WM_USER + 94; +pub const TB_HASACCELERATOR: UINT = WM_USER + 95; +pub const TB_SETLISTGAP: UINT = WM_USER + 96; +pub const TB_GETIMAGELISTCOUNT: UINT = WM_USER + 98; +pub const TB_GETIDEALSIZE: UINT = WM_USER + 99; +pub const TBMF_PAD: DWORD = 0x00000001; +pub const TBMF_BARPAD: DWORD = 0x00000002; +pub const TBMF_BUTTONSPACING: DWORD = 0x00000004; +STRUCT!{struct TBMETRICS { + cbSize: UINT, + dwMask: DWORD, + cxPad: c_int, + cyPad: c_int, + cxBarPad: c_int, + cyBarPad: c_int, + cxButtonSpacing: c_int, + cyButtonSpacing: c_int, +}} +pub type LPTBMETRICS = *mut TBMETRICS; +pub const TB_GETMETRICS: UINT = WM_USER + 101; +pub const TB_SETMETRICS: UINT = WM_USER + 102; +pub const TB_GETITEMDROPDOWNRECT: UINT = WM_USER + 103; +pub const TB_SETPRESSEDIMAGELIST: UINT = WM_USER + 104; +pub const TB_GETPRESSEDIMAGELIST: UINT = WM_USER + 105; +pub const TB_SETWINDOWTHEME: UINT = CCM_SETWINDOWTHEME; +pub const TBN_GETBUTTONINFOA: UINT = TBN_FIRST - 0; +pub const TBN_BEGINDRAG: UINT = TBN_FIRST - 1; +pub const TBN_ENDDRAG: UINT = TBN_FIRST - 2; +pub const TBN_BEGINADJUST: UINT = TBN_FIRST - 3; +pub const TBN_ENDADJUST: UINT = TBN_FIRST - 4; +pub const TBN_RESET: UINT = TBN_FIRST - 5; +pub const TBN_QUERYINSERT: UINT = TBN_FIRST - 6; +pub const TBN_QUERYDELETE: UINT = TBN_FIRST - 7; +pub const TBN_TOOLBARCHANGE: UINT = TBN_FIRST - 8; +pub const TBN_CUSTHELP: UINT = TBN_FIRST - 9; +pub const TBN_DROPDOWN: UINT = TBN_FIRST - 10; +pub const TBN_GETOBJECT: UINT = TBN_FIRST - 12; +STRUCT!{struct NMTBHOTITEM { + hdr: NMHDR, + idOld: c_int, + idNew: c_int, + dwFlags: DWORD, +}} +pub type LPNMTBHOTITEM = *mut NMTBHOTITEM; +pub const HICF_OTHER: DWORD = 0x00000000; +pub const HICF_MOUSE: DWORD = 0x00000001; +pub const HICF_ARROWKEYS: DWORD = 0x00000002; +pub const HICF_ACCELERATOR: DWORD = 0x00000004; +pub const HICF_DUPACCEL: DWORD = 0x00000008; +pub const HICF_ENTERING: DWORD = 0x00000010; +pub const HICF_LEAVING: DWORD = 0x00000020; +pub const HICF_RESELECT: DWORD = 0x00000040; +pub const HICF_LMOUSE: DWORD = 0x00000080; +pub const HICF_TOGGLEDROPDOWN: DWORD = 0x00000100; +pub const TBN_HOTITEMCHANGE: UINT = TBN_FIRST - 13; +pub const TBN_DRAGOUT: UINT = TBN_FIRST - 14; +pub const TBN_DELETINGBUTTON: UINT = TBN_FIRST - 15; +pub const TBN_GETDISPINFOA: UINT = TBN_FIRST - 16; +pub const TBN_GETDISPINFOW: UINT = TBN_FIRST - 17; +pub const TBN_GETINFOTIPA: UINT = TBN_FIRST - 18; +pub const TBN_GETINFOTIPW: UINT = TBN_FIRST - 19; +pub const TBN_GETBUTTONINFOW: UINT = TBN_FIRST - 20; +pub const TBN_RESTORE: UINT = TBN_FIRST - 21; +pub const TBN_SAVE: UINT = TBN_FIRST - 22; +pub const TBN_INITCUSTOMIZE: UINT = TBN_FIRST - 23; +pub const TBNRF_HIDEHELP: LRESULT = 0x00000001; +pub const TBNRF_ENDCUSTOMIZE: LRESULT = 0x00000002; +pub const TBN_WRAPHOTITEM: UINT = TBN_FIRST - 24; +pub const TBN_DUPACCELERATOR: UINT = TBN_FIRST - 25; +pub const TBN_WRAPACCELERATOR: UINT = TBN_FIRST - 26; +pub const TBN_DRAGOVER: UINT = TBN_FIRST - 27; +pub const TBN_MAPACCELERATOR: UINT = TBN_FIRST - 28; +STRUCT!{struct NMTBSAVE { + hdr: NMHDR, + pData: *mut DWORD, + pCurrent: *mut DWORD, + cbData: UINT, + iItem: c_int, + cButtons: c_int, + tbButton: TBBUTTON, +}} +pub type LPNMTBSAVE = *mut NMTBSAVE; +STRUCT!{struct NMTBRESTORE { + hdr: NMHDR, + pData: *mut DWORD, + pCurrent: *mut DWORD, + cbData: UINT, + iItem: c_int, + cButtons: c_int, + cbBytesPerRecord: c_int, + tbButton: TBBUTTON, +}} +pub type LPNMTBRESTORE = *mut NMTBRESTORE; +STRUCT!{struct NMTBGETINFOTIPA { + hdr: NMHDR, + pszText: LPSTR, + cchTextMax: c_int, + iItem: c_int, + lParal: LPARAM, +}} +pub type LPNMTBGETINFOTIPA = *mut NMTBGETINFOTIPA; +STRUCT!{struct NMTBGETINFOTIPW { + hdr: NMHDR, + pszText: LPWSTR, + cchTextMax: c_int, + iItem: c_int, + lParal: LPARAM, +}} +pub type LPNMTBGETINFOTIPW = *mut NMTBGETINFOTIPW; +pub const TBNF_IMAGE: DWORD = 0x00000001; +pub const TBNF_TEXT: DWORD = 0x00000002; +pub const TBNF_DI_SETITEM: DWORD = 0x10000000; +STRUCT!{struct NMTBDISPINFOA { + hdr: NMHDR, + dwMask: DWORD, + idCommand: c_int, + lParam: DWORD_PTR, + iImage: c_int, + pszText: LPSTR, + cchText: c_int, +}} +pub type LPNMTBDISPINFOA = *mut NMTBDISPINFOA; +STRUCT!{struct NMTBDISPINFOW { + hdr: NMHDR, + dwMask: DWORD, + idCommand: c_int, + lParam: DWORD_PTR, + iImage: c_int, + pszText: LPWSTR, + cchText: c_int, +}} +pub type LPNMTBDISPINFOW = *mut NMTBDISPINFOW; +pub const TBDDRET_DEFAULT: LRESULT = 0; +pub const TBDDRET_NODEFAULT: LRESULT = 1; +pub const TBDDRET_TREATPRESSED: LRESULT = 2; +pub type TBNOTIFYA = NMTOOLBARA; +pub type TBNOTIFYW = NMTOOLBARW; +pub type LPTBNOTIFYA = LPNMTOOLBARA; +pub type LPTBNOTIFYW = LPNMTOOLBARW; +STRUCT!{struct NMTOOLBARA { + hdr: NMHDR, + iItem: c_int, + tbButton: TBBUTTON, + cchText: c_int, + pszText: LPSTR, + rcButton: RECT, +}} +pub type LPNMTOOLBARA = *mut NMTOOLBARA; +STRUCT!{struct NMTOOLBARW { + hdr: NMHDR, + iItem: c_int, + tbButton: TBBUTTON, + cchText: c_int, + pszText: LPWSTR, + rcButton: RECT, +}} +pub type LPNMTOOLBARW = *mut NMTOOLBARW; +pub const REBARCLASSNAME: &'static str = "ReBarWindow32"; +pub const RBIM_IMAGELIST: UINT = 0x00000001; +pub const RBS_TOOLTIPS: DWORD = 0x00000100; +pub const RBS_VARHEIGHT: DWORD = 0x00000200; +pub const RBS_BANDBORDERS: DWORD = 0x00000400; +pub const RBS_FIXEDORDER: DWORD = 0x00000800; +pub const RBS_REGISTERDROP: DWORD = 0x00001000; +pub const RBS_AUTOSIZE: DWORD = 0x00002000; +pub const RBS_VERTICALGRIPPER: DWORD = 0x00004000; +pub const RBS_DBLCLKTOGGLE: DWORD = 0x00008000; +STRUCT!{struct REBARINFO { + cbSize: UINT, + fMask: UINT, + himl: HIMAGELIST, +}} +pub type LPREBARINFO = *mut REBARINFO; +pub const RBBS_BREAK: UINT = 0x00000001; +pub const RBBS_FIXEDSIZE: UINT = 0x00000002; +pub const RBBS_CHILDEDGE: UINT = 0x00000004; +pub const RBBS_HIDDEN: UINT = 0x00000008; +pub const RBBS_NOVERT: UINT = 0x00000010; +pub const RBBS_FIXEDBMP: UINT = 0x00000020; +pub const RBBS_VARIABLEHEIGHT: UINT = 0x00000040; +pub const RBBS_GRIPPERALWAYS: UINT = 0x00000080; +pub const RBBS_NOGRIPPER: UINT = 0x00000100; +pub const RBBS_USECHEVRON: UINT = 0x00000200; +pub const RBBS_HIDETITLE: UINT = 0x00000400; +pub const RBBS_TOPALIGN: UINT = 0x00000800; +pub const RBBIM_STYLE: UINT = 0x00000001; +pub const RBBIM_COLORS: UINT = 0x00000002; +pub const RBBIM_TEXT: UINT = 0x00000004; +pub const RBBIM_IMAGE: UINT = 0x00000008; +pub const RBBIM_CHILD: UINT = 0x00000010; +pub const RBBIM_CHILDSIZE: UINT = 0x00000020; +pub const RBBIM_SIZE: UINT = 0x00000040; +pub const RBBIM_BACKGROUND: UINT = 0x00000080; +pub const RBBIM_ID: UINT = 0x00000100; +pub const RBBIM_IDEALSIZE: UINT = 0x00000200; +pub const RBBIM_LPARAM: UINT = 0x00000400; +pub const RBBIM_HEADERSIZE: UINT = 0x00000800; +pub const RBBIM_CHEVRONLOCATION: UINT = 0x00001000; +pub const RBBIM_CHEVRONSTATE: UINT = 0x00002000; +STRUCT!{struct REBARBANDINFOA { + cbSize: UINT, + fMask: UINT, + fStyle: UINT, + clrFore: COLORREF, + clrBack: COLORREF, + lpText: LPSTR, + cch: UINT, + iImage: c_int, + hwndChild: HWND, + cxMinChild: UINT, + cyMinChild: UINT, + cx: UINT, + hbmBack: HBITMAP, + wID: UINT, + cyChild: UINT, + cyMaxChild: UINT, + cyIntegral: UINT, + cxIdeal: UINT, + lParam: LPARAM, + cxHeader: UINT, + rcChevronLocation: RECT, + uChevronState: UINT, +}} +pub type LPREBARBANDINFOA = *mut REBARBANDINFOA; +pub type LPCREBARBANDINFOA = *const REBARBANDINFOA; +STRUCT!{struct REBARBANDINFOW { + cbSize: UINT, + fMask: UINT, + fStyle: UINT, + clrFore: COLORREF, + clrBack: COLORREF, + lpText: LPWSTR, + cch: UINT, + iImage: c_int, + hwndChild: HWND, + cxMinChild: UINT, + cyMinChild: UINT, + cx: UINT, + hbmBack: HBITMAP, + wID: UINT, + cyChild: UINT, + cyMaxChild: UINT, + cyIntegral: UINT, + cxIdeal: UINT, + lParam: LPARAM, + cxHeader: UINT, + rcChevronLocation: RECT, + uChevronState: UINT, +}} +pub type LPREBARBANDINFOW = *mut REBARBANDINFOW; +pub type LPCREBARBANDINFOW = *const REBARBANDINFOW; +pub const RB_INSERTBANDA: UINT = WM_USER + 1; +pub const RB_DELETEBAND: UINT = WM_USER + 2; +pub const RB_GETBARINFO: UINT = WM_USER + 3; +pub const RB_SETBARINFO: UINT = WM_USER + 4; +pub const RB_SETBANDINFOA: UINT = WM_USER + 6; +pub const RB_SETPARENT: UINT = WM_USER + 7; +pub const RB_HITTEST: UINT = WM_USER + 8; +pub const RB_GETRECT: UINT = WM_USER + 9; +pub const RB_INSERTBANDW: UINT = WM_USER + 10; +pub const RB_SETBANDINFOW: UINT = WM_USER + 11; +pub const RB_GETBANDCOUNT: UINT = WM_USER + 12; +pub const RB_GETROWCOUNT: UINT = WM_USER + 13; +pub const RB_GETROWHEIGHT: UINT = WM_USER + 14; +pub const RB_IDTOINDEX: UINT = WM_USER + 16; +pub const RB_GETTOOLTIPS: UINT = WM_USER + 17; +pub const RB_SETTOOLTIPS: UINT = WM_USER + 18; +pub const RB_SETBKCOLOR: UINT = WM_USER + 19; +pub const RB_GETBKCOLOR: UINT = WM_USER + 20; +pub const RB_SETTEXTCOLOR: UINT = WM_USER + 21; +pub const RB_GETTEXTCOLOR: UINT = WM_USER + 22; +pub const RBSTR_CHANGERECT: WPARAM = 0x0001; +pub const RB_SIZETORECT: UINT = WM_USER + 23; +pub const RB_SETCOLORSCHEME: UINT = CCM_SETCOLORSCHEME; +pub const RB_GETCOLORSCHEME: UINT = CCM_GETCOLORSCHEME; +pub const RB_BEGINDRAG: UINT = WM_USER + 24; +pub const RB_ENDDRAG: UINT = WM_USER + 25; +pub const RB_DRAGMOVE: UINT = WM_USER + 26; +pub const RB_GETBARHEIGHT: UINT = WM_USER + 27; +pub const RB_GETBANDINFOW: UINT = WM_USER + 28; +pub const RB_GETBANDINFOA: UINT = WM_USER + 29; +pub const RB_MINIMIZEBAND: UINT = WM_USER + 30; +pub const RB_MAXIMIZEBAND: UINT = WM_USER + 31; +pub const RB_GETDROPTARGET: UINT = CCM_GETDROPTARGET; +pub const RB_GETBANDBORDERS: UINT = WM_USER + 34; +pub const RB_SHOWBAND: UINT = WM_USER + 35; +pub const RB_SETPALETTE: UINT = WM_USER + 37; +pub const RB_GETPALETTE: UINT = WM_USER + 38; +pub const RB_MOVEBAND: UINT = WM_USER + 39; +pub const RB_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const RB_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const RB_GETBANDMARGINS: UINT = WM_USER + 40; +pub const RB_SETWINDOWTHEME: UINT = CCM_SETWINDOWTHEME; +pub const RB_SETEXTENDEDSTYLE: UINT = WM_USER + 41; +pub const RB_GETEXTENDEDSTYLE: UINT = WM_USER + 42; +pub const RB_PUSHCHEVRON: UINT = WM_USER + 43; +pub const RB_SETBANDWIDTH: UINT = WM_USER + 44; +pub const RBN_HEIGHTCHANGE: UINT = RBN_FIRST - 0; +pub const RBN_GETOBJECT: UINT = RBN_FIRST - 1; +pub const RBN_LAYOUTCHANGED: UINT = RBN_FIRST - 2; +pub const RBN_AUTOSIZE: UINT = RBN_FIRST - 3; +pub const RBN_BEGINDRAG: UINT = RBN_FIRST - 4; +pub const RBN_ENDDRAG: UINT = RBN_FIRST - 5; +pub const RBN_DELETINGBAND: UINT = RBN_FIRST - 6; +pub const RBN_DELETEDBAND: UINT = RBN_FIRST - 7; +pub const RBN_CHILDSIZE: UINT = RBN_FIRST - 8; +pub const RBN_CHEVRONPUSHED: UINT = RBN_FIRST - 10; +pub const RBN_SPLITTERDRAG: UINT = RBN_FIRST - 11; +pub const RBN_MINMAX: UINT = RBN_FIRST - 21; +pub const RBN_AUTOBREAK: UINT = RBN_FIRST - 22; +STRUCT!{struct NMREBARCHILDSIZE { + hdr: NMHDR, + uBand: UINT, + wID: UINT, + rcChild: RECT, + rcBand: RECT, +}} +pub type LPNMREBARCHILDSIZE = *mut NMREBARCHILDSIZE; +STRUCT!{struct NMREBAR { + hdr: NMHDR, + dwMask: DWORD, + uBand: UINT, + fStyle: UINT, + wID: UINT, + lParam: LPARAM, +}} +pub type LPNMREBAR = *mut NMREBAR; +pub const RBNM_ID: DWORD = 0x00000001; +pub const RBNM_STYLE: DWORD = 0x00000002; +pub const RBNM_LPARAM: DWORD = 0x00000004; +STRUCT!{struct NMRBAUTOSIZE { + hdr: NMHDR, + fChanged: BOOL, + rcTarget: RECT, + rcActual: RECT, +}} +pub type LPNMRBAUTOSIZE = *mut NMRBAUTOSIZE; +STRUCT!{struct NMREBARCHEVRON { + hdr: NMHDR, + uBand: UINT, + wID: UINT, + lParam: LPARAM, + rc: RECT, + lParamNM: LPARAM, +}} +pub type LPNMREBARCHEVRON = *mut NMREBARCHEVRON; +STRUCT!{struct NMREBARSPLITTER { + hdr: NMHDR, + rcSizing: RECT, +}} +pub type LPNMREBARSPLITTER = *mut NMREBARSPLITTER; +pub const RBAB_AUTOSIZE: UINT = 0x0001; +pub const RBAB_ADDBAND: UINT = 0x0002; +STRUCT!{struct NMREBARAUTOBREAK { + hdr: NMHDR, + uBand: UINT, + wID: UINT, + lParam: LPARAM, + uMsg: UINT, + fStyleCurrent: UINT, + fAutoBreak: UINT, +}} +pub type LPNMREBARAUTOBREAK = *mut NMREBARAUTOBREAK; +pub const RBHT_NOWHERE: UINT = 0x0001; +pub const RBHT_CAPTION: UINT = 0x0002; +pub const RBHT_CLIENT: UINT = 0x0003; +pub const RBHT_GRABBER: UINT = 0x0004; +pub const RBHT_CHEVRON: UINT = 0x0008; +pub const RBHT_SPLITTER: UINT = 0x0010; +STRUCT!{struct RBHITTESTINFO { + pt: POINT, + flags: UINT, + iBand: c_int, +}} +pub type LPRBHITTESTINFO = *mut RBHITTESTINFO; +pub const TOOLTIPS_CLASS: &'static str = "tooltips_class32"; +pub type LPTOOLINFOA = LPTTTOOLINFOA; +pub type LPTOOLINFOW = LPTTTOOLINFOW; +pub type TOOLINFOA = TTTOOLINFOA; +pub type TOOLINFOW = TTTOOLINFOW; +STRUCT!{struct TTTOOLINFOA { + cbSize: UINT, + uFlags: UINT, + hwnd: HWND, + uId: UINT_PTR, + rect: RECT, + hinst: HINSTANCE, + lpszText: LPSTR, + lParam: LPARAM, + lpReserved: *mut c_void, +}} +pub type PTTTOOLINFOA = *mut TTTOOLINFOA; +pub type LPTTTOOLINFOA = *mut TTTOOLINFOA; +STRUCT!{struct TTTOOLINFOW { + cbSize: UINT, + uFlags: UINT, + hwnd: HWND, + uId: UINT_PTR, + rect: RECT, + hinst: HINSTANCE, + lpszText: LPSTR, + lParam: LPARAM, + lpReserved: *mut c_void, +}} +pub type PTTTOOLINFOW = *mut TTTOOLINFOW; +pub type LPTTTOOLINFOW = *mut TTTOOLINFOW; +pub const TTS_ALWAYSTIP: DWORD = 0x01; +pub const TTS_NOPREFIX: DWORD = 0x02; +pub const TTS_NOANIMATE: DWORD = 0x10; +pub const TTS_NOFADE: DWORD = 0x20; +pub const TTS_BALLOON: DWORD = 0x40; +pub const TTS_CLOSE: DWORD = 0x80; +pub const TTS_USEVISUALSTYLE: DWORD = 0x100; +pub const TTF_IDISHWND: UINT = 0x0001; +pub const TTF_CENTERTIP: UINT = 0x0002; +pub const TTF_RTLREADING: UINT = 0x0004; +pub const TTF_SUBCLASS: UINT = 0x0010; +pub const TTF_TRACK: UINT = 0x0020; +pub const TTF_ABSOLUTE: UINT = 0x0080; +pub const TTF_TRANSPARENT: UINT = 0x0100; +pub const TTF_PARSELINKS: UINT = 0x1000; +pub const TTF_DI_SETITEM: UINT = 0x8000; +pub const TTDT_AUTOMATIC: WPARAM = 0; +pub const TTDT_RESHOW: WPARAM = 1; +pub const TTDT_AUTOPOP: WPARAM = 2; +pub const TTDT_INITIAL: WPARAM = 3; +pub const TTI_NONE: WPARAM = 0; +pub const TTI_INFO: WPARAM = 1; +pub const TTI_WARNING: WPARAM = 2; +pub const TTI_ERROR: WPARAM = 3; +pub const TTI_INFO_LARGE: WPARAM = 4; +pub const TTI_WARNING_LARGE: WPARAM = 5; +pub const TTI_ERROR_LARGE: WPARAM = 6; +pub const TTM_ACTIVATE: UINT = WM_USER + 1; +pub const TTM_SETDELAYTIME: UINT = WM_USER + 3; +pub const TTM_ADDTOOLA: UINT = WM_USER + 4; +pub const TTM_ADDTOOLW: UINT = WM_USER + 50; +pub const TTM_DELTOOLA: UINT = WM_USER + 5; +pub const TTM_DELTOOLW: UINT = WM_USER + 51; +pub const TTM_NEWTOOLRECTA: UINT = WM_USER + 6; +pub const TTM_NEWTOOLRECTW: UINT = WM_USER + 52; +pub const TTM_RELAYEVENT: UINT = WM_USER + 7; +pub const TTM_GETTOOLINFOA: UINT = WM_USER + 8; +pub const TTM_GETTOOLINFOW: UINT = WM_USER + 53; +pub const TTM_SETTOOLINFOA: UINT = WM_USER + 9; +pub const TTM_SETTOOLINFOW: UINT = WM_USER + 54; +pub const TTM_HITTESTA: UINT = WM_USER + 10; +pub const TTM_HITTESTW: UINT = WM_USER + 55; +pub const TTM_GETTEXTA: UINT = WM_USER + 11; +pub const TTM_GETTEXTW: UINT = WM_USER + 56; +pub const TTM_UPDATETIPTEXTA: UINT = WM_USER + 12; +pub const TTM_UPDATETIPTEXTW: UINT = WM_USER + 57; +pub const TTM_GETTOOLCOUNT: UINT = WM_USER + 13; +pub const TTM_ENUMTOOLSA: UINT = WM_USER + 14; +pub const TTM_ENUMTOOLSW: UINT = WM_USER + 58; +pub const TTM_GETCURRENTTOOLA: UINT = WM_USER + 15; +pub const TTM_GETCURRENTTOOLW: UINT = WM_USER + 59; +pub const TTM_WINDOWFROMPOINT: UINT = WM_USER + 16; +pub const TTM_TRACKACTIVATE: UINT = WM_USER + 17; +pub const TTM_TRACKPOSITION: UINT = WM_USER + 18; +pub const TTM_SETTIPBKCOLOR: UINT = WM_USER + 19; +pub const TTM_SETTIPTEXTCOLOR: UINT = WM_USER + 20; +pub const TTM_GETDELAYTIME: UINT = WM_USER + 21; +pub const TTM_GETTIPBKCOLOR: UINT = WM_USER + 22; +pub const TTM_GETTIPTEXTCOLOR: UINT = WM_USER + 23; +pub const TTM_SETMAXTIPWIDTH: UINT = WM_USER + 24; +pub const TTM_GETMAXTIPWIDTH: UINT = WM_USER + 25; +pub const TTM_SETMARGIN: UINT = WM_USER + 26; +pub const TTM_GETMARGIN: UINT = WM_USER + 27; +pub const TTM_POP: UINT = WM_USER + 28; +pub const TTM_UPDATE: UINT = WM_USER + 29; +pub const TTM_GETBUBBLESIZE: UINT = WM_USER + 30; +pub const TTM_ADJUSTRECT: UINT = WM_USER + 31; +pub const TTM_SETTITLEA: UINT = WM_USER + 32; +pub const TTM_SETTITLEW: UINT = WM_USER + 33; +pub const TTM_POPUP: UINT = WM_USER + 34; +pub const TTM_GETTITLE: UINT = WM_USER + 35; +STRUCT!{struct TTGETTITLE { + dwSize: DWORD, + uTitleBitmap: UINT, + cch: UINT, + pszTitle: *mut WCHAR, +}} +pub type LPTTGETTITLE = *mut TTGETTITLE; +pub const TTM_SETWINDOWTHEME: UINT = CCM_SETWINDOWTHEME; +pub type LPHITTESTINFOW = LPTTHITTESTINFOW; +pub type LPHITTESTINFOA = LPTTHITTESTINFOA; +STRUCT!{struct TTHITTESTINFOA { + hwnd: HWND, + pt: POINT, + ti: TTTOOLINFOA, +}} +pub type LPTTHITTESTINFOA = *mut TTHITTESTINFOA; +STRUCT!{struct TTHITTESTINFOW { + hwnd: HWND, + pt: POINT, + ti: TTTOOLINFOW, +}} +pub type LPTTHITTESTINFOW = *mut TTHITTESTINFOW; +pub const TTN_GETDISPINFOA: UINT = TTN_FIRST - 0; +pub const TTN_GETDISPINFOW: UINT = TTN_FIRST - 10; +pub const TTN_SHOW: UINT = TTN_FIRST - 1; +pub const TTN_POP: UINT = TTN_FIRST - 2; +pub const TTN_LINKCLICK: UINT = TTN_FIRST - 3; +pub const TTN_NEEDTEXTA: UINT = TTN_GETDISPINFOA; +pub const TTN_NEEDTEXTW: UINT = TTN_GETDISPINFOW; +pub type TOOLTIPTEXTW = NMTTDISPINFOW; +pub type TOOLTIPTEXTA = NMTTDISPINFOA; +pub type LPTOOLTIPTEXTA = LPNMTTDISPINFOA; +pub type LPTOOLTIPTEXTW = LPNMTTDISPINFOW; +STRUCT!{struct NMTTDISPINFOA { + hdr: NMHDR, + lpszText: LPSTR, + szText: [c_char; 80], + hinst: HINSTANCE, + uFlags: UINT, + lParam: LPARAM, +}} +pub type LPNMTTDISPINFOA = *mut NMTTDISPINFOA; +STRUCT!{struct NMTTDISPINFOW { + hdr: NMHDR, + lpszText: LPWSTR, + szText: [WCHAR; 80], + hinst: HINSTANCE, + uFlags: UINT, + lParam: LPARAM, +}} +pub type LPNMTTDISPINFOW = *mut NMTTDISPINFOW; +pub const SBARS_SIZEGRIP: DWORD = 0x0100; +pub const SBARS_TOOLTIPS: DWORD = 0x0800; +pub const SBT_TOOLTIPS: DWORD = 0x0800; +extern "system" { + pub fn DrawStatusTextA( + hDC: HDC, + lprc: LPCRECT, + pszText: LPCSTR, + uFlags: UINT, + ); + pub fn DrawStatusTextW( + hDC: HDC, + lprc: LPCRECT, + pszText: LPCWSTR, + uFlags: UINT, + ); + pub fn CreateStatusWindowA( + style: LONG, + lpszText: LPCSTR, + hwndParent: HWND, + wID: UINT, + ) -> HWND; + pub fn CreateStatusWindowW( + style: LONG, + lpszText: LPCWSTR, + hwndParent: HWND, + wID: UINT, + ) -> HWND; +} +pub const STATUSCLASSNAME: &'static str = "msctls_statusbar32"; +pub const SB_SETTEXTA: UINT = WM_USER + 1; +pub const SB_SETTEXTW: UINT = WM_USER + 11; +pub const SB_GETTEXTA: UINT = WM_USER + 2; +pub const SB_GETTEXTW: UINT = WM_USER + 13; +pub const SB_GETTEXTLENGTHA: UINT = WM_USER + 3; +pub const SB_GETTEXTLENGTHW: UINT = WM_USER + 12; +pub const SB_SETPARTS: UINT = WM_USER + 4; +pub const SB_GETPARTS: UINT = WM_USER + 6; +pub const SB_GETBORDERS: UINT = WM_USER + 7; +pub const SB_SETMINHEIGHT: UINT = WM_USER + 8; +pub const SB_SIMPLE: UINT = WM_USER + 9; +pub const SB_GETRECT: UINT = WM_USER + 10; +pub const SB_ISSIMPLE: UINT = WM_USER + 14; +pub const SB_SETICON: UINT = WM_USER + 15; +pub const SB_SETTIPTEXTA: UINT = WM_USER + 16; +pub const SB_SETTIPTEXTW: UINT = WM_USER + 17; +pub const SB_GETTIPTEXTA: UINT = WM_USER + 18; +pub const SB_GETTIPTEXTW: UINT = WM_USER + 19; +pub const SB_GETICON: UINT = WM_USER + 20; +pub const SB_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const SB_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const SBT_OWNERDRAW: WPARAM = 0x1000; +pub const SBT_NOBORDERS: WPARAM = 0x0100; +pub const SBT_POPOUT: WPARAM = 0x0200; +pub const SBT_RTLREADING: WPARAM = 0x0400; +pub const SBT_NOTABPARSING: WPARAM = 0x0800; +pub const SB_SETBKCOLOR: UINT = CCM_SETBKCOLOR; +pub const SBN_SIMPLEMODECHANGE: UINT = SBN_FIRST - 0; +pub const SB_SIMPLEID: WPARAM = 0x00ff; +extern "system" { + pub fn MenuHelp( + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + hMainMenu: HMENU, + hInst: HINSTANCE, + hwndStatus: HWND, + lpwIDs: *mut UINT, + ); + pub fn ShowHideMenuCtl( + hWnd: HWND, + uFlags: UINT_PTR, + lpInfo: LPINT, + ) -> BOOL; + pub fn GetEffectiveClientRect( + hWnd: HWND, + lprc: LPRECT, + lpInfo: *const INT, + ); +} +pub const TRACKBAR_CLASS: &'static str = "msctls_trackbar32"; +pub const TBS_AUTOTICKS: DWORD = 0x0001; +pub const TBS_VERT: DWORD = 0x0002; +pub const TBS_HORZ: DWORD = 0x0000; +pub const TBS_TOP: DWORD = 0x0004; +pub const TBS_BOTTOM: DWORD = 0x0000; +pub const TBS_LEFT: DWORD = 0x0004; +pub const TBS_RIGHT: DWORD = 0x0000; +pub const TBS_BOTH: DWORD = 0x0008; +pub const TBS_NOTICKS: DWORD = 0x0010; +pub const TBS_ENABLESELRANGE: DWORD = 0x0020; +pub const TBS_FIXEDLENGTH: DWORD = 0x0040; +pub const TBS_NOTHUMB: DWORD = 0x0080; +pub const TBS_TOOLTIPS: DWORD = 0x0100; +pub const TBS_REVERSED: DWORD = 0x0200; +pub const TBS_DOWNISLEFT: DWORD = 0x0400; +pub const TBS_NOTIFYBEFOREMOVE: DWORD = 0x0800; +pub const TBS_TRANSPARENTBKGND: DWORD = 0x1000; +pub const TBM_GETPOS: UINT = WM_USER; +pub const TBM_GETRANGEMIN: UINT = WM_USER + 1; +pub const TBM_GETRANGEMAX: UINT = WM_USER + 2; +pub const TBM_GETTIC: UINT = WM_USER + 3; +pub const TBM_SETTIC: UINT = WM_USER + 4; +pub const TBM_SETPOS: UINT = WM_USER + 5; +pub const TBM_SETRANGE: UINT = WM_USER + 6; +pub const TBM_SETRANGEMIN: UINT = WM_USER + 7; +pub const TBM_SETRANGEMAX: UINT = WM_USER + 8; +pub const TBM_CLEARTICS: UINT = WM_USER + 9; +pub const TBM_SETSEL: UINT = WM_USER + 10; +pub const TBM_SETSELSTART: UINT = WM_USER + 11; +pub const TBM_SETSELEND: UINT = WM_USER + 12; +pub const TBM_GETPTICS: UINT = WM_USER + 14; +pub const TBM_GETTICPOS: UINT = WM_USER + 15; +pub const TBM_GETNUMTICS: UINT = WM_USER + 16; +pub const TBM_GETSELSTART: UINT = WM_USER + 17; +pub const TBM_GETSELEND: UINT = WM_USER + 18; +pub const TBM_CLEARSEL: UINT = WM_USER + 19; +pub const TBM_SETTICFREQ: UINT = WM_USER + 20; +pub const TBM_SETPAGESIZE: UINT = WM_USER + 21; +pub const TBM_GETPAGESIZE: UINT = WM_USER + 22; +pub const TBM_SETLINESIZE: UINT = WM_USER + 23; +pub const TBM_GETLINESIZE: UINT = WM_USER + 24; +pub const TBM_GETTHUMBRECT: UINT = WM_USER + 25; +pub const TBM_GETCHANNELRECT: UINT = WM_USER + 26; +pub const TBM_SETTHUMBLENGTH: UINT = WM_USER + 27; +pub const TBM_GETTHUMBLENGTH: UINT = WM_USER + 28; +pub const TBM_SETTOOLTIPS: UINT = WM_USER + 29; +pub const TBM_GETTOOLTIPS: UINT = WM_USER + 30; +pub const TBM_SETTIPSIDE: UINT = WM_USER + 31; +pub const TBTS_TOP: WPARAM = 0; +pub const TBTS_LEFT: WPARAM = 1; +pub const TBTS_BOTTOM: WPARAM = 2; +pub const TBTS_RIGHT: WPARAM = 3; +pub const TBM_SETBUDDY: UINT = WM_USER + 32; +pub const TBM_GETBUDDY: UINT = WM_USER + 33; +pub const TBM_SETPOSNOTIFY: UINT = WM_USER + 34; +pub const TBM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const TBM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const TB_LINEUP: WPARAM = 0; +pub const TB_LINEDOWN: WPARAM = 1; +pub const TB_PAGEUP: WPARAM = 2; +pub const TB_PAGEDOWN: WPARAM = 3; +pub const TB_THUMBPOSITION: WPARAM = 4; +pub const TB_THUMBTRACK: WPARAM = 5; +pub const TB_TOP: WPARAM = 6; +pub const TB_BOTTOM: WPARAM = 7; +pub const TB_ENDTRACK: WPARAM = 8; +pub const TBCD_TICS: DWORD_PTR = 0x0001; +pub const TBCD_THUMB: DWORD_PTR = 0x0001; +pub const TBCD_CHANNEL: DWORD_PTR = 0x0001; +pub const TRBN_THUMBPOSCHANGING: UINT = TRBN_FIRST - 1; +STRUCT!{struct NMTRBTHUMBPOSCHANGING { + hdr: NMHDR, + dwPos: DWORD, + nReason: c_int, +}} +STRUCT!{struct DRAGLISTINFO { + uNotification: UINT, + hWnd: HWND, + ptCursor: POINT, +}} +pub type LPDRAGLISTINFO = *mut DRAGLISTINFO; +pub const DL_BEGINDRAG: UINT = WM_USER + 133; +pub const DL_DRAGGING: UINT = WM_USER + 134; +pub const DL_DROPPED: UINT = WM_USER + 135; +pub const DL_CANCELDRAG: UINT = WM_USER + 136; +pub const DL_CURSORSET: UINT = 0; +pub const DL_STOPCURSOR: UINT = 1; +pub const DL_COPYCURSOR: UINT = 2; +pub const DL_MOVECURSOR: UINT = 3; +pub const DRAGLISTMSGSTRING: &'static str = "commctrl_DragListMsg"; +extern "system" { + pub fn MakeDragList( + hLB: HWND, + ) -> BOOL; + pub fn DrawInsert( + handParent: HWND, + hLB: HWND, + nItem: c_int, + ); + pub fn LBItemFromPt( + hLB: HWND, + pt: POINT, + bAutoScroll: BOOL, + ) -> c_int; +} +pub const UPDOWN_CLASS: &'static str = "msctls_updown32"; +STRUCT!{struct UDACCEL { + nSec: UINT, + nInc: UINT, +}} +pub type LPUDACCEL = *mut UDACCEL; +pub const UD_MAXVAL: c_short = 0x7fff; +pub const UD_MINVAL: c_short = 0 - UD_MAXVAL; +pub const UDS_WRAP: DWORD = 0x0001; +pub const UDS_SETBUDDYINT: DWORD = 0x0002; +pub const UDS_ALIGNRIGHT: DWORD = 0x0004; +pub const UDS_ALIGNLEFT: DWORD = 0x0008; +pub const UDS_AUTOBUDDY: DWORD = 0x0010; +pub const UDS_ARROWKEYS: DWORD = 0x0020; +pub const UDS_HORZ: DWORD = 0x0040; +pub const UDS_NOTHOUSANDS: DWORD = 0x0080; +pub const UDS_HOTTRACK: DWORD = 0x0100; +pub const UDM_SETRANGE: UINT = WM_USER + 101; +pub const UDM_GETRANGE: UINT = WM_USER + 102; +pub const UDM_SETPOS: UINT = WM_USER + 103; +pub const UDM_GETPOS: UINT = WM_USER + 104; +pub const UDM_SETBUDDY: UINT = WM_USER + 105; +pub const UDM_GETBUDDY: UINT = WM_USER + 106; +pub const UDM_SETACCEL: UINT = WM_USER + 107; +pub const UDM_GETACCEL: UINT = WM_USER + 108; +pub const UDM_SETBASE: UINT = WM_USER + 109; +pub const UDM_GETBASE: UINT = WM_USER + 110; +pub const UDM_SETRANGE32: UINT = WM_USER + 111; +pub const UDM_GETRANGE32: UINT = WM_USER + 112; +pub const UDM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const UDM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const UDM_SETPOS32: UINT = WM_USER + 113; +pub const UDM_GETPOS32: UINT = WM_USER + 114; +extern "system" { + pub fn CreateUpDownControl( + dwStyle: DWORD, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + hParent: HWND, + nID: c_int, + hInst: HINSTANCE, + nBuddy: HWND, + nUpper: c_int, + nLower: c_int, + nPos: c_int, + ) -> HWND; +} +pub type NM_UPDOWN = NMUPDOWN; +pub type LPNM_UPDOWN = LPNMUPDOWN; +STRUCT!{struct NMUPDOWN { + hdr: NMHDR, + iPos: c_int, + iDelta: c_int, +}} +pub type LPNMUPDOWN = *mut NMUPDOWN; +pub const UDN_DELTAPOS: UINT = UDN_FIRST - 1; +pub const PROGRESS_CLASS: &'static str = "msctls_progress32"; +pub const PBS_SMOOTH: DWORD = 0x01; +pub const PBS_VERTICAL: DWORD = 0x04; +pub const PBM_SETRANGE: UINT = WM_USER + 1; +pub const PBM_SETPOS: UINT = WM_USER + 2; +pub const PBM_DELTAPOS: UINT = WM_USER + 3; +pub const PBM_SETSTEP: UINT = WM_USER + 4; +pub const PBM_STEPIT: UINT = WM_USER + 5; +pub const PBM_SETRANGE32: UINT = WM_USER + 6; +STRUCT!{struct PBRANGE { + iLow: c_int, + iHigh: c_int, +}} +pub type LPPBRANGE = *mut PBRANGE; +pub const PBM_GETRANGE: UINT = WM_USER + 7; +pub const PBM_GETPOS: UINT = WM_USER + 8; +pub const PBM_SETBARCOLOR: UINT = WM_USER + 9; +pub const PBM_SETBKCOLOR: UINT = CCM_SETBKCOLOR; +pub const PBS_MARQUEE: DWORD = 0x08; +pub const PBM_SETMARQUEE: UINT = WM_USER + 10; +pub const PBS_SMOOTHREVERSE: DWORD = 0x10; +pub const PBM_GETSTEP: UINT = WM_USER + 13; +pub const PBM_GETBKCOLOR: UINT = WM_USER + 14; +pub const PBM_GETBARCOLOR: UINT = WM_USER + 15; +pub const PBM_SETSTATE: UINT = WM_USER + 16; +pub const PBM_GETSTATE: UINT = WM_USER + 17; +pub const PBST_NORMAL: c_int = 0x0001; +pub const PBST_ERROR: c_int = 0x0002; +pub const PBST_PAUSED: c_int = 0x0003; +pub const HOTKEYF_SHIFT: BYTE = 0x01; +pub const HOTKEYF_CONTROL: BYTE = 0x02; +pub const HOTKEYF_ALT: BYTE = 0x04; +pub const HOTKEYF_EXT: BYTE = 0x08; +pub const HKCOMB_NONE: WPARAM = 0x0001; +pub const HKCOMB_S: WPARAM = 0x0002; +pub const HKCOMB_C: WPARAM = 0x0004; +pub const HKCOMB_A: WPARAM = 0x0008; +pub const HKCOMB_SC: WPARAM = 0x0010; +pub const HKCOMB_SA: WPARAM = 0x0020; +pub const HKCOMB_CA: WPARAM = 0x0040; +pub const HKCOMB_SCA: WPARAM = 0x0080; +pub const HKM_SETHOTKEY: UINT = WM_USER + 1; +pub const HKM_GETHOTKEY: UINT = WM_USER + 2; +pub const HKM_SETRULES: UINT = WM_USER + 3; +pub const HOTKEY_CLASS: &'static str = "msctls_hotkey32"; +pub const CCS_TOP: DWORD = 0x00000001; +pub const CCS_NOMOVEY: DWORD = 0x00000002; +pub const CCS_BOTTOM: DWORD = 0x00000003; +pub const CCS_NORESIZE: DWORD = 0x00000004; +pub const CCS_NOPARENTALIGN: DWORD = 0x00000008; +pub const CCS_ADJUSTABLE: DWORD = 0x00000020; +pub const CCS_NODIVIDER: DWORD = 0x00000040; +pub const CCS_VERT: DWORD = 0x00000080; +pub const CCS_LEFT: DWORD = CCS_VERT | CCS_TOP; +pub const CCS_RIGHT: DWORD = CCS_VERT | CCS_BOTTOM; +pub const CCS_NOMOVEX: DWORD = CCS_VERT | CCS_NOMOVEY; +pub const INVALID_LINK_INDEX: c_int = -1; +pub const MAX_LINKID_TEXT: usize = 48; +pub const L_MAX_URL_LENGTH: usize = 2048 + 32 + 4; +pub const WC_LINK: &'static str = "SysLink"; +pub const LWS_TRANSPARENT: DWORD = 0x0001; +pub const LWS_IGNORERETURN: DWORD = 0x0002; +pub const LWS_NOPREFIX: DWORD = 0x0004; +pub const LWS_USEVISUALSTYLE: DWORD = 0x0008; +pub const LWS_USECUSTOMTEXT: DWORD = 0x0010; +pub const LWS_RIGHT: DWORD = 0x0020; +pub const LIF_ITEMINDEX: UINT = 0x00000001; +pub const LIF_STATE: UINT = 0x00000002; +pub const LIF_ITEMID: UINT = 0x00000004; +pub const LIF_URL: UINT = 0x00000008; +pub const LIS_FOCUSED: UINT = 0x00000001; +pub const LIS_ENABLED: UINT = 0x00000002; +pub const LIS_VISITED: UINT = 0x00000004; +pub const LIS_HOTTRACK: UINT = 0x00000008; +pub const LIS_DEFAULTCOLORS: UINT = 0x00000010; +STRUCT!{struct LITEM { + mask: UINT, + iLink: c_int, + state: UINT, + stateMask: UINT, + szID: [WCHAR; MAX_LINKID_TEXT], + szUrl: [WCHAR; L_MAX_URL_LENGTH], +}} +pub type PLITEM = *mut LITEM; +STRUCT!{struct LHITTESTINFO { + pt: POINT, + item: LITEM, +}} +pub type PLHITTESTINFO = *mut LHITTESTINFO; +STRUCT!{struct NMLINK { + hdr: NMHDR, + item: LITEM, +}} +pub type PNMLINK = *mut NMLINK; +pub const LM_HITTEST: UINT = WM_USER + 0x300; +pub const LM_GETIDEALHEIGHT: UINT = WM_USER + 0x301; +pub const LM_SETITEM: UINT = WM_USER + 0x302; +pub const LM_GETITEM: UINT = WM_USER + 0x303; +pub const LM_GETIDEALSIZE: UINT = LM_GETIDEALHEIGHT; +pub const WC_LISTVIEW: &'static str = "SysListView32"; +pub const LVS_ICON: DWORD = 0x0000; +pub const LVS_REPORT: DWORD = 0x0001; +pub const LVS_SMALLICON: DWORD = 0x0002; +pub const LVS_LIST: DWORD = 0x0003; +pub const LVS_TYPEMASK: DWORD = 0x0003; +pub const LVS_SINGLESEL: DWORD = 0x0004; +pub const LVS_SHOWSELALWAYS: DWORD = 0x0008; +pub const LVS_SORTASCENDING: DWORD = 0x0010; +pub const LVS_SORTDESCENDING: DWORD = 0x0020; +pub const LVS_SHAREIMAGELISTS: DWORD = 0x0040; +pub const LVS_NOLABELWRAP: DWORD = 0x0080; +pub const LVS_AUTOARRANGE: DWORD = 0x0100; +pub const LVS_EDITLABELS: DWORD = 0x0200; +pub const LVS_OWNERDATA: DWORD = 0x1000; +pub const LVS_NOSCROLL: DWORD = 0x2000; +pub const LVS_TYPESTYLEMASK: DWORD = 0xfc00; +pub const LVS_ALIGNTOP: DWORD = 0x0000; +pub const LVS_ALIGNLEFT: DWORD = 0x0800; +pub const LVS_ALIGNMASK: DWORD = 0x0c00; +pub const LVS_OWNERDRAWFIXED: DWORD = 0x0400; +pub const LVS_NOCOLUMNHEADER: DWORD = 0x4000; +pub const LVS_NOSORTHEADER: DWORD = 0x8000; +pub const LVM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const LVM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const LVM_GETBKCOLOR: UINT = LVM_FIRST + 0; +pub const LVM_SETBKCOLOR: UINT = LVM_FIRST + 1; +pub const LVM_GETIMAGELIST: UINT = LVM_FIRST + 2; +pub const LVSIL_NORMAL: c_int = 0; +pub const LVSIL_SMALL: c_int = 1; +pub const LVSIL_STATE: c_int = 2; +pub const LVSIL_GROUPHEADER: c_int = 3; +pub const LVM_SETIMAGELIST: UINT = LVM_FIRST + 3; +pub const LVM_GETITEMCOUNT: UINT = LVM_FIRST + 4; +pub const LVIF_TEXT: UINT = 0x00000001; +pub const LVIF_IMAGE: UINT = 0x00000002; +pub const LVIF_PARAM: UINT = 0x00000004; +pub const LVIF_STATE: UINT = 0x00000008; +pub const LVIF_INDENT: UINT = 0x00000010; +pub const LVIF_NORECOMPUTE: UINT = 0x00000800; +pub const LVIF_GROUPID: UINT = 0x00000100; +pub const LVIF_COLUMNS: UINT = 0x00000200; +pub const LVIF_COLFMT: UINT = 0x00010000; +pub const LVIS_FOCUSED: UINT = 0x0001; +pub const LVIS_SELECTED: UINT = 0x0002; +pub const LVIS_CUT: UINT = 0x0004; +pub const LVIS_DROPHILITED: UINT = 0x0008; +pub const LVIS_GLOW: UINT = 0x0010; +pub const LVIS_ACTIVATING: UINT = 0x0020; +pub const LVIS_OVERLAYMASK: UINT = 0x0F00; +pub const LVIS_STATEIMAGEMASK: UINT = 0xF000; +#[inline] +pub fn INDEXTOSTATEIMAGEMASK(i: UINT) -> UINT { + i << 12 +} +pub const I_INDENTCALLBACK: c_int = -1; +pub type LV_ITEMA = LVITEMA; +pub type LV_ITEMW = LVITEMW; +pub const I_GROUPIDCALLBACK: c_int = -1; +pub const I_GROUPIDNONE: c_int = -2; +STRUCT!{struct LVITEMA { + mask: UINT, + iItem: c_int, + iSubItem: c_int, + state: UINT, + stateMask: UINT, + pszText: LPSTR, + cchTextMax: c_int, + iImage: c_int, + lParam: LPARAM, + iIndent: c_int, + iGroupId: c_int, + cColumns: UINT, + puColumns: PUINT, + piColFmt: *mut c_int, + iGroup: c_int, +}} +pub type LPLVITEMA = *mut LVITEMA; +STRUCT!{struct LVITEMW { + mask: UINT, + iItem: c_int, + iSubItem: c_int, + state: UINT, + stateMask: UINT, + pszText: LPWSTR, + cchTextMax: c_int, + iImage: c_int, + lParam: LPARAM, + iIndent: c_int, + iGroupId: c_int, + cColumns: UINT, + puColumns: PUINT, + piColFmt: *mut c_int, + iGroup: c_int, +}} +pub type LPLVITEMW = *mut LVITEMW; +pub const LPSTR_TEXTCALLBACKW: LPWSTR = -1isize as LPWSTR; +pub const LPSTR_TEXTCALLBACKA: LPSTR = -1isize as LPSTR; +pub const I_IMAGECALLBACK: c_int = -1; +pub const I_IMAGENONE: c_int = -2; +pub const I_COLUMNSCALLBACK: UINT = -1i32 as UINT; +pub const LVM_GETITEMA: UINT = LVM_FIRST + 5; +pub const LVM_GETITEMW: UINT = LVM_FIRST + 75; +pub const LVM_SETITEMA: UINT = LVM_FIRST + 6; +pub const LVM_SETITEMW: UINT = LVM_FIRST + 76; +pub const LVM_INSERTITEMA: UINT = LVM_FIRST + 7; +pub const LVM_INSERTITEMW: UINT = LVM_FIRST + 77; +pub const LVM_DELETEITEM: UINT = LVM_FIRST + 8; +pub const LVM_DELETEALLITEMS: UINT = LVM_FIRST + 9; +pub const LVM_GETCALLBACKMASK: UINT = LVM_FIRST + 10; +pub const LVM_SETCALLBACKMASK: UINT = LVM_FIRST + 11; +pub const LVNI_ALL: LPARAM = 0x0000; +pub const LVNI_FOCUSED: LPARAM = 0x0001; +pub const LVNI_SELECTED: LPARAM = 0x0002; +pub const LVNI_CUT: LPARAM = 0x0004; +pub const LVNI_DROPHILITED: LPARAM = 0x0008; +pub const LVNI_STATEMASK: LPARAM = LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED; +pub const LVNI_VISIBLEORDER: LPARAM = 0x0010; +pub const LVNI_PREVIOUS: LPARAM = 0x0020; +pub const LVNI_VISIBLEONLY: LPARAM = 0x0040; +pub const LVNI_SAMEGROUPONLY: LPARAM = 0x0080; +pub const LVNI_ABOVE: LPARAM = 0x0100; +pub const LVNI_BELOW: LPARAM = 0x0200; +pub const LVNI_TOLEFT: LPARAM = 0x0400; +pub const LVNI_TORIGHT: LPARAM = 0x0800; +pub const LVNI_DIRECTIONMASK: LPARAM = LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT; +pub const LVM_GETNEXTITEM: UINT = LVM_FIRST + 12; +pub const LVFI_PARAM: UINT = 0x0001; +pub const LVFI_STRING: UINT = 0x0002; +pub const LVFI_SUBSTRING: UINT = 0x0004; +pub const LVFI_PARTIAL: UINT = 0x0008; +pub const LVFI_WRAP: UINT = 0x0020; +pub const LVFI_NEARESTXY: UINT = 0x0040; +pub type LV_FINDINFOA = LVFINDINFOA; +pub type LV_FINDINFOW = LVFINDINFOW; +STRUCT!{struct LVFINDINFOA { + flags: UINT, + psz: LPCSTR, + lParam: LPARAM, + pt: POINT, + vkDirection: UINT, +}} +pub type LPFINDINFOA = *mut LVFINDINFOA; +STRUCT!{struct LVFINDINFOW { + flags: UINT, + psz: LPCWSTR, + lParam: LPARAM, + pt: POINT, + vkDirection: UINT, +}} +pub type LPFINDINFOW = *mut LVFINDINFOW; +pub const LVM_FINDITEMA: UINT = LVM_FIRST + 13; +pub const LVM_FINDITEMW: UINT = LVM_FIRST + 83; +pub const LVIR_BOUNDS: c_int = 0; +pub const LVIR_ICON: c_int = 1; +pub const LVIR_LABEL: c_int = 2; +pub const LVIR_SELECTBOUNDS: c_int = 3; +pub const LVM_GETITEMRECT: UINT = LVM_FIRST + 14; +pub const LVM_SETITEMPOSITION: UINT = LVM_FIRST + 15; +pub const LVM_GETITEMPOSITION: UINT = LVM_FIRST + 16; +pub const LVM_GETSTRINGWIDTHA: UINT = LVM_FIRST + 17; +pub const LVM_GETSTRINGWIDTHW: UINT = LVM_FIRST + 87; +pub const LVHT_NOWHERE: UINT = 0x00000001; +pub const LVHT_ONITEMICON: UINT = 0x00000002; +pub const LVHT_ONITEMLABEL: UINT = 0x00000004; +pub const LVHT_ONITEMSTATEICON: UINT = 0x00000008; +pub const LVHT_ONITEM: UINT = LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON; +pub const LVHT_ABOVE: UINT = 0x00000008; +pub const LVHT_BELOW: UINT = 0x00000010; +pub const LVHT_TORIGHT: UINT = 0x00000020; +pub const LVHT_TOLEFT: UINT = 0x00000040; +pub const LVHT_EX_GROUP_HEADER: UINT = 0x10000000; +pub const LVHT_EX_GROUP_FOOTER: UINT = 0x20000000; +pub const LVHT_EX_GROUP_COLLAPSE: UINT = 0x40000000; +pub const LVHT_EX_GROUP_BACKGROUND: UINT = 0x80000000; +pub const LVHT_EX_GROUP_STATEICON: UINT = 0x01000000; +pub const LVHT_EX_GROUP_SUBSETLINK: UINT = 0x02000000; +pub const LVHT_EX_GROUP: UINT = LVHT_EX_GROUP_BACKGROUND | LVHT_EX_GROUP_COLLAPSE + | LVHT_EX_GROUP_FOOTER | LVHT_EX_GROUP_HEADER | LVHT_EX_GROUP_STATEICON + | LVHT_EX_GROUP_SUBSETLINK; +pub const LVHT_EX_ONCONTENTS: UINT = 0x04000000; +pub const LVHT_EX_FOOTER: UINT = 0x08000000; +pub type LV_HITTESTINFO = LVHITTESTINFO; +STRUCT!{struct LVHITTESTINFO { + pt: POINT, + flags: UINT, + iItem: c_int, + iSubItem: c_int, + iGroup: c_int, +}} +pub type LPLVHITTESTINFO = *mut LVHITTESTINFO; +pub const LVM_HITTEST: UINT = LVM_FIRST + 18; +pub const LVM_ENSUREVISIBLE: UINT = LVM_FIRST + 19; +pub const LVM_SCROLL: UINT = LVM_FIRST + 20; +pub const LVM_REDRAWITEMS: UINT = LVM_FIRST + 21; +pub const LVA_DEFAULT: WPARAM = 0x0000; +pub const LVA_ALIGNLEFT: WPARAM = 0x0001; +pub const LVA_ALIGNTOP: WPARAM = 0x0002; +pub const LVA_SNAPTOGRID: WPARAM = 0x0005; +pub const LVM_ARRANGE: UINT = LVM_FIRST + 22; +pub const LVM_EDITLABELA: UINT = LVM_FIRST + 23; +pub const LVM_EDITLABELW: UINT = LVM_FIRST + 118; +pub const LVM_GETEDITCONTROL: UINT = LVM_FIRST + 24; +pub type LV_COLUMNA = LVCOLUMNA; +pub type LV_COLUMNW = LVCOLUMNW; +STRUCT!{struct LVCOLUMNA { + mask: UINT, + fmt: c_int, + cx: c_int, + pszText: LPSTR, + cchTextMax: c_int, + iSubItem: c_int, + iImage: c_int, + iOrder: c_int, + cxMin: c_int, + cxDefault: c_int, + cxIdeal: c_int, +}} +pub type LPLVCOLUMNA = *mut LVCOLUMNA; +STRUCT!{struct LVCOLUMNW { + mask: UINT, + fmt: c_int, + cx: c_int, + pszText: LPWSTR, + cchTextMax: c_int, + iSubItem: c_int, + iImage: c_int, + iOrder: c_int, + cxMin: c_int, + cxDefault: c_int, + cxIdeal: c_int, +}} +pub type LPLVCOLUMNW = *mut LVCOLUMNW; +pub const LVCF_FMT: UINT = 0x0001; +pub const LVCF_WIDTH: UINT = 0x0002; +pub const LVCF_TEXT: UINT = 0x0004; +pub const LVCF_SUBITEM: UINT = 0x0008; +pub const LVCF_IMAGE: UINT = 0x0010; +pub const LVCF_ORDER: UINT = 0x0020; +pub const LVCF_MINWIDTH: UINT = 0x0040; +pub const LVCF_DEFAULTWIDTH: UINT = 0x0080; +pub const LVCF_IDEALWIDTH: UINT = 0x0100; +pub const LVCFMT_LEFT: c_int = 0x0000; +pub const LVCFMT_RIGHT: c_int = 0x0001; +pub const LVCFMT_CENTER: c_int = 0x0002; +pub const LVCFMT_JUSTIFYMASK: c_int = 0x0003; +pub const LVCFMT_IMAGE: c_int = 0x0800; +pub const LVCFMT_BITMAP_ON_RIGHT: c_int = 0x1000; +pub const LVCFMT_COL_HAS_IMAGES: c_int = 0x8000; +pub const LVCFMT_FIXED_WIDTH: c_int = 0x00100; +pub const LVCFMT_NO_DPI_SCALE: c_int = 0x40000; +pub const LVCFMT_FIXED_RATIO: c_int = 0x80000; +pub const LVCFMT_LINE_BREAK: c_int = 0x100000; +pub const LVCFMT_FILL: c_int = 0x200000; +pub const LVCFMT_WRAP: c_int = 0x400000; +pub const LVCFMT_NO_TITLE: c_int = 0x800000; +pub const LVCFMT_TILE_PLACEMENTMASK: c_int = LVCFMT_LINE_BREAK | LVCFMT_FILL; +pub const LVCFMT_SPLITBUTTON: c_int = 0x1000000; +pub const LVM_GETCOLUMNA: UINT = LVM_FIRST + 25; +pub const LVM_GETCOLUMNW: UINT = LVM_FIRST + 95; +pub const LVM_SETCOLUMNA: UINT = LVM_FIRST + 26; +pub const LVM_SETCOLUMNW: UINT = LVM_FIRST + 96; +pub const LVM_INSERTCOLUMNA: UINT = LVM_FIRST + 27; +pub const LVM_INSERTCOLUMNW: UINT = LVM_FIRST + 97; +pub const LVM_DELETECOLUMN: UINT = LVM_FIRST + 28; +pub const LVM_GETCOLUMNWIDTH: UINT = LVM_FIRST + 29; +pub const LVSCW_AUTOSIZE: c_int = -1; +pub const LVSCW_AUTOSIZE_USEHEADER: c_int = -2; +pub const LVM_SETCOLUMNWIDTH: UINT = LVM_FIRST + 30; +pub const LVM_GETHEADER: UINT = LVM_FIRST + 31; +pub const LVM_CREATEDRAGIMAGE: UINT = LVM_FIRST + 33; +pub const LVM_GETVIEWRECT: UINT = LVM_FIRST + 34; +pub const LVM_GETTEXTCOLOR: UINT = LVM_FIRST + 35; +pub const LVM_SETTEXTCOLOR: UINT = LVM_FIRST + 36; +pub const LVM_GETTEXTBKCOLOR: UINT = LVM_FIRST + 37; +pub const LVM_SETTEXTBKCOLOR: UINT = LVM_FIRST + 38; +pub const LVM_GETTOPINDEX: UINT = LVM_FIRST + 39; +pub const LVM_GETCOUNTPERPAGE: UINT = LVM_FIRST + 40; +pub const LVM_GETORIGIN: UINT = LVM_FIRST + 41; +pub const LVM_UPDATE: UINT = LVM_FIRST + 42; +pub const LVM_SETITEMSTATE: UINT = LVM_FIRST + 43; +pub const LVM_GETITEMSTATE: UINT = LVM_FIRST + 44; +pub const LVM_GETITEMTEXTA: UINT = LVM_FIRST + 45; +pub const LVM_GETITEMTEXTW: UINT = LVM_FIRST + 115; +pub const LVM_SETITEMTEXTA: UINT = LVM_FIRST + 46; +pub const LVM_SETITEMTEXTW: UINT = LVM_FIRST + 116; +pub const LVSICF_NOINVALIDATEALL: LPARAM = 0x00000001; +pub const LVSICF_NOSCROLL: LPARAM = 0x00000002; +pub const LVM_SETITEMCOUNT: UINT = LVM_FIRST + 47; +FN!{stdcall PFNLVCOMPARE( + LPARAM, + LPARAM, + LPARAM, +) -> c_int} +pub const LVM_SORTITEMS: UINT = LVM_FIRST + 48; +pub const LVM_SETITEMPOSITION32: UINT = LVM_FIRST + 49; +pub const LVM_GETSELECTEDCOUNT: UINT = LVM_FIRST + 50; +pub const LVM_GETITEMSPACING: UINT = LVM_FIRST + 51; +pub const LVM_GETISEARCHSTRINGA: UINT = LVM_FIRST + 52; +pub const LVM_GETISEARCHSTRINGW: UINT = LVM_FIRST + 117; +pub const LVM_SETICONSPACING: UINT = LVM_FIRST + 53; +pub const LVM_SETEXTENDEDLISTVIEWSTYLE: UINT = LVM_FIRST + 54; +pub const LVM_GETEXTENDEDLISTVIEWSTYLE: UINT = LVM_FIRST + 55; +pub const LVS_EX_GRIDLINES: DWORD = 0x00000001; +pub const LVS_EX_SUBITEMIMAGES: DWORD = 0x00000002; +pub const LVS_EX_CHECKBOXES: DWORD = 0x00000004; +pub const LVS_EX_TRACKSELECT: DWORD = 0x00000008; +pub const LVS_EX_HEADERDRAGDROP: DWORD = 0x00000010; +pub const LVS_EX_FULLROWSELECT: DWORD = 0x00000020; +pub const LVS_EX_ONECLICKACTIVATE: DWORD = 0x00000040; +pub const LVS_EX_TWOCLICKACTIVATE: DWORD = 0x00000080; +pub const LVS_EX_FLATSB: DWORD = 0x00000100; +pub const LVS_EX_REGIONAL: DWORD = 0x00000200; +pub const LVS_EX_INFOTIP: DWORD = 0x00000400; +pub const LVS_EX_UNDERLINEHOT: DWORD = 0x00000800; +pub const LVS_EX_UNDERLINECOLD: DWORD = 0x00001000; +pub const LVS_EX_MULTIWORKAREAS: DWORD = 0x00002000; +pub const LVS_EX_LABELTIP: DWORD = 0x00004000; +pub const LVS_EX_BORDERSELECT: DWORD = 0x00008000; +pub const LVS_EX_DOUBLEBUFFER: DWORD = 0x00010000; +pub const LVS_EX_HIDELABELS: DWORD = 0x00020000; +pub const LVS_EX_SINGLEROW: DWORD = 0x00040000; +pub const LVS_EX_SNAPTOGRID: DWORD = 0x00080000; +pub const LVS_EX_SIMPLESELECT: DWORD = 0x00100000; +pub const LVS_EX_JUSTIFYCOLUMNS: DWORD = 0x00200000; +pub const LVS_EX_TRANSPARENTBKGND: DWORD = 0x00400000; +pub const LVS_EX_TRANSPARENTSHADOWTEXT: DWORD = 0x00800000; +pub const LVS_EX_AUTOAUTOARRANGE: DWORD = 0x01000000; +pub const LVS_EX_HEADERINALLVIEWS: DWORD = 0x02000000; +pub const LVS_EX_AUTOCHECKSELECT: DWORD = 0x08000000; +pub const LVS_EX_AUTOSIZECOLUMNS: DWORD = 0x10000000; +pub const LVS_EX_COLUMNSNAPPOINTS: DWORD = 0x40000000; +pub const LVS_EX_COLUMNOVERFLOW: DWORD = 0x80000000; +pub const LVM_GETSUBITEMRECT: UINT = LVM_FIRST + 56; +pub const LVM_SUBITEMHITTEST: UINT = LVM_FIRST + 57; +pub const LVM_SETCOLUMNORDERARRAY: UINT = LVM_FIRST + 58; +pub const LVM_GETCOLUMNORDERARRAY: UINT = LVM_FIRST + 59; +pub const LVM_SETHOTITEM: UINT = LVM_FIRST + 60; +pub const LVM_GETHOTITEM: UINT = LVM_FIRST + 61; +pub const LVM_SETHOTCURSOR: UINT = LVM_FIRST + 62; +pub const LVM_GETHOTCURSOR: UINT = LVM_FIRST + 63; +pub const LVM_APPROXIMATEVIEWRECT: UINT = LVM_FIRST + 64; +pub const LV_MAX_WORKAREAS: WPARAM = 16; +pub const LVM_SETWORKAREAS: UINT = LVM_FIRST + 65; +pub const LVM_GETWORKAREAS: UINT = LVM_FIRST + 70; +pub const LVM_GETNUMBEROFWORKAREAS: UINT = LVM_FIRST + 73; +pub const LVM_GETSELECTIONMARK: UINT = LVM_FIRST + 66; +pub const LVM_SETSELECTIONMARK: UINT = LVM_FIRST + 67; +pub const LVM_SETHOVERTIME: UINT = LVM_FIRST + 71; +pub const LVM_GETHOVERTIME: UINT = LVM_FIRST + 72; +pub const LVM_SETTOOLTIPS: UINT = LVM_FIRST + 74; +pub const LVM_GETTOOLTIPS: UINT = LVM_FIRST + 78; +pub const LVM_SORTITEMSEX: UINT = LVM_FIRST + 81; +STRUCT!{struct LVBKIMAGEA { + ulFlags: ULONG, + hbm: HBITMAP, + pszImage: LPSTR, + cchImageMax: UINT, + xOffsetPercent: c_int, + yOffsetPercent: c_int, +}} +pub type LPLVBKIMAGEA = *mut LVBKIMAGEA; +STRUCT!{struct LVBKIMAGEW { + ulFlags: ULONG, + hbm: HBITMAP, + pszImage: LPWSTR, + cchImageMax: UINT, + xOffsetPercent: c_int, + yOffsetPercent: c_int, +}} +pub type LPLVBKIMAGEW = *mut LVBKIMAGEW; +pub const LVBKIF_SOURCE_NONE: ULONG = 0x00000000; +pub const LVBKIF_SOURCE_HBITMAP: ULONG = 0x00000001; +pub const LVBKIF_SOURCE_URL: ULONG = 0x00000002; +pub const LVBKIF_SOURCE_MASK: ULONG = 0x00000003; +pub const LVBKIF_STYLE_NORMAL: ULONG = 0x00000000; +pub const LVBKIF_STYLE_TILE: ULONG = 0x00000010; +pub const LVBKIF_STYLE_MASK: ULONG = 0x00000010; +pub const LVBKIF_FLAG_TILEOFFSET: ULONG = 0x00000100; +pub const LVBKIF_TYPE_WATERMARK: ULONG = 0x10000000; +pub const LVBKIF_FLAG_ALPHABLEND: ULONG = 0x20000000; +pub const LVM_SETBKIMAGEA: UINT = LVM_FIRST + 68; +pub const LVM_SETBKIMAGEW: UINT = LVM_FIRST + 138; +pub const LVM_GETBKIMAGEA: UINT = LVM_FIRST + 69; +pub const LVM_GETBKIMAGEW: UINT = LVM_FIRST + 139; +pub const LVM_SETSELECTEDCOLUMN: UINT = LVM_FIRST + 140; +pub const LV_VIEW_ICON: DWORD = 0x0000; +pub const LV_VIEW_DETAILS: DWORD = 0x0001; +pub const LV_VIEW_SMALLICON: DWORD = 0x0002; +pub const LV_VIEW_LIST: DWORD = 0x0003; +pub const LV_VIEW_TILE: DWORD = 0x0004; +pub const LV_VIEW_MAX: DWORD = 0x0004; +pub const LVM_SETVIEW: UINT = LVM_FIRST + 142; +pub const LVM_GETVIEW: UINT = LVM_FIRST + 143; +pub const LVGF_NONE: UINT = 0x00000000; +pub const LVGF_HEADER: UINT = 0x00000001; +pub const LVGF_FOOTER: UINT = 0x00000002; +pub const LVGF_STATE: UINT = 0x00000004; +pub const LVGF_ALIGN: UINT = 0x00000008; +pub const LVGF_GROUPID: UINT = 0x00000010; +pub const LVGF_SUBTITLE: UINT = 0x00000100; +pub const LVGF_TASK: UINT = 0x00000200; +pub const LVGF_DESCRIPTIONTOP: UINT = 0x00000400; +pub const LVGF_DESCRIPTIONBOTTOM: UINT = 0x00000800; +pub const LVGF_TITLEIMAGE: UINT = 0x00001000; +pub const LVGF_EXTENDEDIMAGE: UINT = 0x00002000; +pub const LVGF_ITEMS: UINT = 0x00004000; +pub const LVGF_SUBSET: UINT = 0x00008000; +pub const LVGF_SUBSETITEMS: UINT = 0x00010000; +pub const LVGS_NORMAL: UINT = 0x00000000; +pub const LVGS_COLLAPSED: UINT = 0x00000001; +pub const LVGS_HIDDEN: UINT = 0x00000002; +pub const LVGS_NOHEADER: UINT = 0x00000004; +pub const LVGS_COLLAPSIBLE: UINT = 0x00000008; +pub const LVGS_FOCUSED: UINT = 0x00000010; +pub const LVGS_SELECTED: UINT = 0x00000020; +pub const LVGS_SUBSETED: UINT = 0x00000040; +pub const LVGS_SUBSETLINKFOCUSED: UINT = 0x00000080; +pub const LVGA_HEADER_LEFT: UINT = 0x00000001; +pub const LVGA_HEADER_CENTER: UINT = 0x00000002; +pub const LVGA_HEADER_RIGHT: UINT = 0x00000004; +pub const LVGA_FOOTER_LEFT: UINT = 0x00000008; +pub const LVGA_FOOTER_CENTER: UINT = 0x00000010; +pub const LVGA_FOOTER_RIGHT: UINT = 0x00000020; +STRUCT!{struct LVGROUP { + cbSize: UINT, + mask: UINT, + pszHeader: LPWSTR, + cchHeader: c_int, + pszFooter: LPWSTR, + cchFooter: c_int, + iGroupId: c_int, + stateMask: UINT, + state: UINT, + uAlign: UINT, + pszSubtitle: LPWSTR, + cchSubtitle: UINT, + pszTask: LPWSTR, + cchTask: UINT, + pszDescriptionTop: LPWSTR, + cchDescriptionTop: UINT, + pszDescriptionBottom: LPWSTR, + cchDescriptionBottom: UINT, + iTitleImage: c_int, + iExtendedImage: c_int, + iFirstItem: c_int, + cItems: UINT, + pszSubsetTitle: LPWSTR, + cchSubsetTitle: UINT, +}} +pub type PLVGROUP = *mut LVGROUP; +pub const LVM_INSERTGROUP: UINT = LVM_FIRST + 145; +pub const LVM_SETGROUPINFO: UINT = LVM_FIRST + 147; +pub const LVM_GETGROUPINFO: UINT = LVM_FIRST + 149; +pub const LVM_REMOVEGROUP: UINT = LVM_FIRST + 150; +pub const LVM_MOVEGROUP: UINT = LVM_FIRST + 151; +pub const LVM_GETGROUPCOUNT: UINT = LVM_FIRST + 152; +pub const LVM_GETGROUPINFOBYINDEX: UINT = LVM_FIRST + 153; +pub const LVM_MOVEITEMTOGROUP: UINT = LVM_FIRST + 154; +pub const LVGGR_GROUP: LPARAM = 0; +pub const LVGGR_HEADER: LPARAM = 1; +pub const LVGGR_LABEL: LPARAM = 2; +pub const LVGGR_SUBSETLINK: LPARAM = 3; +pub const LVM_GETGROUPRECT: UINT = LVM_FIRST + 98; +pub const LVGMF_NONE: UINT = 0x00000000; +pub const LVGMF_BORDERSIZE: UINT = 0x00000001; +pub const LVGMF_BORDERCOLOR: UINT = 0x00000002; +pub const LVGMF_TEXTCOLOR: UINT = 0x00000004; +STRUCT!{struct LVGROUPMETRICS { + cbSize: UINT, + mask: UINT, + Left: UINT, + Top: UINT, + Right: UINT, + Bottom: UINT, + crLeft: COLORREF, + crTop: COLORREF, + crRight: COLORREF, + crBottom: COLORREF, + crHeader: COLORREF, + crFooter: COLORREF, +}} +pub type PLVGROUPMETRICS = *mut LVGROUPMETRICS; +pub const LVM_SETGROUPMETRICS: UINT = LVM_FIRST + 155; +pub const LVM_GETGROUPMETRICS: UINT = LVM_FIRST + 156; +pub const LVM_ENABLEGROUPVIEW: UINT = LVM_FIRST + 157; +FN!{stdcall PFNLVGROUPCOMPARE( + c_int, + c_int, + *mut c_void, +) -> c_int} +pub const LVM_SORTGROUPS: UINT = LVM_FIRST + 158; +STRUCT!{struct LVINSERTGROUPSORTED { + pfnGroupCompare: PFNLVGROUPCOMPARE, + pvData: *mut c_void, + lvGroup: LVGROUP, +}} +pub type PLVINSERTGROUPSORTED = *mut LVINSERTGROUPSORTED; +pub const LVM_INSERTGROUPSORTED: UINT = LVM_FIRST + 159; +pub const LVM_REMOVEALLGROUPS: UINT = LVM_FIRST + 160; +pub const LVM_HASGROUP: UINT = LVM_FIRST + 161; +pub const LVM_GETGROUPSTATE: UINT = LVM_FIRST + 92; +pub const LVM_GETFOCUSEDGROUP: UINT = LVM_FIRST + 93; +pub const LVTVIF_AUTOSIZE: DWORD = 0x00000000; +pub const LVTVIF_FIXEDWIDTH: DWORD = 0x00000001; +pub const LVTVIF_FIXEDHEIGHT: DWORD = 0x00000002; +pub const LVTVIF_FIXEDSIZE: DWORD = 0x00000003; +pub const LVTVIF_EXTENDED: DWORD = 0x00000004; +pub const LVTVIM_TILESIZE: DWORD = 0x00000001; +pub const LVTVIM_COLUMNS: DWORD = 0x00000002; +pub const LVTVIM_LABELMARGIN: DWORD = 0x00000004; +STRUCT!{struct LVTILEVIEWINFO { + cbSize: UINT, + dwMask: DWORD, + dwFlags: DWORD, + sizeTile: SIZE, + cLines: c_int, + rcLabelMargin: RECT, +}} +pub type PLVTILEVIEWINFO = *mut LVTILEVIEWINFO; +STRUCT!{struct LVTILEINFO { + cbSize: UINT, + iItem: c_int, + cColumns: UINT, + puColumns: PUINT, + piColFmt: *mut c_int, +}} +pub type PLVTILEINFO = *mut LVTILEINFO; +pub const LVM_SETTILEVIEWINFO: UINT = LVM_FIRST + 162; +pub const LVM_GETTILEVIEWINFO: UINT = LVM_FIRST + 163; +pub const LVM_SETTILEINFO: UINT = LVM_FIRST + 164; +pub const LVM_GETTILEINFO: UINT = LVM_FIRST + 165; +STRUCT!{struct LVINSERTMARK { + cbSize: UINT, + dwFlags: DWORD, + iItem: c_int, + dwReserved: DWORD, +}} +pub type LPLVINSERTMARK = *mut LVINSERTMARK; +pub const LVIM_AFTER: DWORD = 0x00000001; +pub const LVM_SETINSERTMARK: UINT = LVM_FIRST + 166; +pub const LVM_GETINSERTMARK: UINT = LVM_FIRST + 167; +pub const LVM_INSERTMARKHITTEST: UINT = LVM_FIRST + 168; +pub const LVM_GETINSERTMARKRECT: UINT = LVM_FIRST + 169; +pub const LVM_SETINSERTMARKCOLOR: UINT = LVM_FIRST + 170; +pub const LVM_GETINSERTMARKCOLOR: UINT = LVM_FIRST + 171; +STRUCT!{struct LVSETINFOTIP { + cbSize: UINT, + dwFlags: DWORD, + pszText: LPWSTR, + iItem: c_int, + iSubItem: c_int, +}} +pub type PLVSETINFOTIP = *mut LVSETINFOTIP; +pub const LVM_SETINFOTIP: UINT = LVM_FIRST + 173; +pub const LVM_GETSELECTEDCOLUMN: UINT = LVM_FIRST + 174; +pub const LVM_ISGROUPVIEWENABLED: UINT = LVM_FIRST + 175; +pub const LVM_GETOUTLINECOLOR: UINT = LVM_FIRST + 176; +pub const LVM_SETOUTLINECOLOR: UINT = LVM_FIRST + 177; +pub const LVM_CANCELEDITLABEL: UINT = LVM_FIRST + 179; +pub const LVM_MAPINDEXTOID: UINT = LVM_FIRST + 180; +pub const LVM_MAPIDTOINDEX: UINT = LVM_FIRST + 181; +pub const LVM_ISITEMVISIBLE: UINT = LVM_FIRST + 182; +pub const LVM_GETEMPTYTEXT: UINT = LVM_FIRST + 204; +pub const LVM_GETFOOTERRECT: UINT = LVM_FIRST + 205; +pub const LVFF_ITEMCOUNT: UINT = 0x00000001; +STRUCT!{struct LVFOOTERINFO { + mask: UINT, + pszText: LPWSTR, + cchTextMax: c_int, + cItems: UINT, +}} +pub type LPLVFOOTERINFO = *mut LVFOOTERINFO; +pub const LVM_GETFOOTERINFO: UINT = LVM_FIRST + 206; +pub const LVM_GETFOOTERITEMRECT: UINT = LVM_FIRST + 207; +pub const LVFIF_TEXT: UINT = 0x00000001; +pub const LVFIF_STATE: UINT = 0x00000002; +pub const LVFIS_FOCUSED: UINT = 0x0001; +STRUCT!{struct LVFOOTERITEM { + mask: UINT, + iItem: c_int, + pszText: LPWSTR, + cchTextMax: c_int, + state: UINT, + stateMask: UINT, +}} +pub type LPLVFOOTERITEM = *mut LVFOOTERITEM; +pub const LVM_GETFOOTERITEM: UINT = LVM_FIRST + 208; +STRUCT!{struct LVITEMINDEX { + iItem: c_int, + iGroup: c_int, +}} +pub type PLVITEMINDEX = *mut LVITEMINDEX; +pub const LVM_GETITEMINDEXRECT: UINT = LVM_FIRST + 209; +pub const LVM_SETITEMINDEXSTATE: UINT = LVM_FIRST + 210; +pub const LVM_GETNEXTITEMINDEX: UINT = LVM_FIRST + 211; +pub type LPNM_LISTVIEW = LPNMLISTVIEW; +pub type NM_LISTVIEW = NMLISTVIEW; +STRUCT!{struct NMLISTVIEW { + hdr: NMHDR, + iItem: c_int, + iSubItem: c_int, + uNewState: UINT, + uOldState: UINT, + uChanged: UINT, + ptAction: POINT, + lParam: LPARAM, +}} +pub type LPNMLISTVIEW = *mut NMLISTVIEW; +STRUCT!{struct NMITEMACTIVATE { + hdr: NMHDR, + iItem: c_int, + iSubItem: c_int, + uNewState: UINT, + uOldState: UINT, + uChanged: UINT, + ptAction: POINT, + lParam: LPARAM, + uKeyFlags: UINT, +}} +pub type LPNMITEMACTIVATE = *mut NMITEMACTIVATE; +pub const LVKF_ALT: UINT = 0x0001; +pub const LVKF_CONTROL: UINT = 0x0002; +pub const LVKF_SHIFT: UINT = 0x0004; +STRUCT!{struct NMLVCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + clrText: COLORREF, + clrTextBk: COLORREF, + iSubItem: c_int, + dwItemType: DWORD, + clrFace: COLORREF, + iIconEffect: c_int, + iIconPhase: c_int, + iPartId: c_int, + iStateId: c_int, + rcText: RECT, + uAlign: UINT, +}} +pub type LPNMLVCUSTOMDRAW = *mut NMLVCUSTOMDRAW; +pub const LVCDI_ITEM: DWORD = 0x00000000; +pub const LVCDI_GROUP: DWORD = 0x00000001; +pub const LVCDI_ITEMSLIST: DWORD = 0x00000002; +pub const LVCDRF_NOSELECT: LRESULT = 0x00010000; +pub const LVCDRF_NOGROUPFRAME: LRESULT = 0x00020000; +STRUCT!{struct NMLVCACHEHINT { + hdr: NMHDR, + iFrom: c_int, + iTo: c_int, +}} +pub type LPNMLVCACHEHINT = *mut NMLVCACHEHINT; +pub type LPNM_CACHEHINT = LPNMLVCACHEHINT; +pub type PNM_CACHEHINT = LPNMLVCACHEHINT; +pub type NM_CACHEHINT = NMLVCACHEHINT; +STRUCT!{struct NMLVFINDITEMA { + hdr: NMHDR, + iStart: c_int, + lvfi: LVFINDINFOA, +}} +pub type LPNMLVFINDITEMA = *mut NMLVFINDITEMA; +STRUCT!{struct NMLVFINDITEMW { + hdr: NMHDR, + iStart: c_int, + lvfi: LVFINDINFOW, +}} +pub type LPNMLVFINDITEMW = *mut NMLVFINDITEMW; +pub type PNM_FINDITEMA = LPNMLVFINDITEMA; +pub type LPNM_FINDITEMA = LPNMLVFINDITEMA; +pub type NM_FINDITEMA = NMLVFINDITEMA; +pub type PNM_FINDITEMW = LPNMLVFINDITEMW; +pub type LPNM_FINDITEMW = LPNMLVFINDITEMW; +pub type NM_FINDITEMW = NMLVFINDITEMW; +STRUCT!{struct NMLVODSTATECHANGE { + hdr: NMHDR, + iFrom: c_int, + iTo: c_int, + uNewState: UINT, + uOldState: UINT, +}} +pub type LPNMLVODSTATECHANGE = *mut NMLVODSTATECHANGE; +pub type PNM_ODSTATECHANGE = LPNMLVODSTATECHANGE; +pub type LPNM_ODSTATECHANGE = LPNMLVODSTATECHANGE; +pub type NM_ODSTATECHANGE = NMLVODSTATECHANGE; +pub const LVN_ITEMCHANGING: UINT = LVN_FIRST - 0; +pub const LVN_ITEMCHANGED: UINT = LVN_FIRST - 1; +pub const LVN_INSERTITEM: UINT = LVN_FIRST - 2; +pub const LVN_DELETEITEM: UINT = LVN_FIRST - 3; +pub const LVN_DELETEALLITEMS: UINT = LVN_FIRST - 4; +pub const LVN_BEGINLABELEDITA: UINT = LVN_FIRST - 5; +pub const LVN_BEGINLABELEDITW: UINT = LVN_FIRST - 75; +pub const LVN_ENDLABELEDITA: UINT = LVN_FIRST - 6; +pub const LVN_ENDLABELEDITW: UINT = LVN_FIRST - 76; +pub const LVN_COLUMNCLICK: UINT = LVN_FIRST - 8; +pub const LVN_BEGINDRAG: UINT = LVN_FIRST - 9; +pub const LVN_BEGINRDRAG: UINT = LVN_FIRST - 11; +pub const LVN_ODCACHEHINT: UINT = LVN_FIRST - 13; +pub const LVN_ODFINDITEMA: UINT = LVN_FIRST - 52; +pub const LVN_ODFINDITEMW: UINT = LVN_FIRST - 79; +pub const LVN_ITEMACTIVATE: UINT = LVN_FIRST - 14; +pub const LVN_ODSTATECHANGED: UINT = LVN_FIRST - 15; +pub const LVN_HOTTRACK: UINT = LVN_FIRST - 21; +pub const LVN_GETDISPINFOA: UINT = LVN_FIRST - 50; +pub const LVN_GETDISPINFOW: UINT = LVN_FIRST - 77; +pub const LVN_SETDISPINFOA: UINT = LVN_FIRST - 51; +pub const LVN_SETDISPINFOW: UINT = LVN_FIRST - 78; +pub const LVIF_DI_SETITEM: UINT = 0x1000; +pub type LV_DISPINFOA = NMLVDISPINFOA; +pub type LV_DISPINFOW = NMLVDISPINFOW; +STRUCT!{struct NMLVDISPINFOA { + hdr: NMHDR, + item: LVITEMA, +}} +pub type LPNMLVDISPINFOA = *mut NMLVDISPINFOA; +STRUCT!{struct NMLVDISPINFOW { + hdr: NMHDR, + item: LVITEMW, +}} +pub type LPNMLVDISPINFOW = *mut NMLVDISPINFOW; +pub const LVN_KEYDOWN: UINT = LVN_FIRST - 55; +pub type LV_KEYDOWN = NMLVKEYDOWN; +STRUCT!{struct NMLVKEYDOWN { + hdr: NMHDR, + wVKey: WORD, + flags: UINT, +}} +pub type LPNMLVKEYDOWN = *mut NMLVKEYDOWN; +pub const LVN_MARQUEEBEGIN: UINT = LVN_FIRST - 56; +STRUCT!{struct NMLVLINK { + hdr: NMHDR, + link: LITEM, + iItem: c_int, + iSubItem: c_int, +}} +pub type PNMLVLINK = *mut NMLVLINK; +STRUCT!{struct NMLVGETINFOTIPA { + hdr: NMHDR, + dwFlags: DWORD, + pszText: LPSTR, + cchTextMax: c_int, + iItem: c_int, + iSubItem: c_int, + lParam: LPARAM, +}} +pub type LPNMLVGETINFOTIPA = *mut NMLVGETINFOTIPA; +STRUCT!{struct NMLVGETINFOTIPW { + hdr: NMHDR, + dwFlags: DWORD, + pszText: LPWSTR, + cchTextMax: c_int, + iItem: c_int, + iSubItem: c_int, + lParam: LPARAM, +}} +pub type LPNMLVGETINFOTIPW = *mut NMLVGETINFOTIPW; +pub const LVGIT_UNFOLDED: DWORD = 0x0001; +pub const LVN_GETINFOTIPA: UINT = LVN_FIRST - 57; +pub const LVN_GETINFOTIPW: UINT = LVN_FIRST - 58; +pub const LVNSCH_DEFAULT: LPARAM = -1; +pub const LVNSCH_ERROR: LPARAM = -2; +pub const LVNSCH_IGNORE: LPARAM = -3; +pub const LVN_INCREMENTALSEARCHA: UINT = LVN_FIRST - 62; +pub const LVN_INCREMENTALSEARCHW: UINT = LVN_FIRST - 63; +pub const LVN_COLUMNDROPDOWN: UINT = LVN_FIRST - 64; +pub const LVN_COLUMNOVERFLOWCLICK: UINT = LVN_FIRST - 66; +STRUCT!{struct NMLVSCROLL { + hdr: NMHDR, + dx: c_int, + dy: c_int, +}} +pub type LPNMLVSCROLL = *mut NMLVSCROLL; +pub const LVN_BEGINSCROLL: UINT = LVN_FIRST - 80; +pub const LVN_ENDSCROLL: UINT = LVN_FIRST - 81; +pub const LVN_LINKCLICK: UINT = LVN_FIRST - 84; +pub const EMF_CENTERED: DWORD = 0x00000001; +STRUCT!{struct NMLVEMPTYMARKUP { + hdr: NMHDR, + dwFlags: DWORD, + szMarkup: [WCHAR; L_MAX_URL_LENGTH], +}} +pub const LVN_GETEMPTYMARKUP: UINT = LVN_FIRST - 87; +pub const WC_TREEVIEW: &'static str = "SysTreeView32"; +pub const TVS_HASBUTTONS: DWORD = 0x0001; +pub const TVS_HASLINES: DWORD = 0x0002; +pub const TVS_LINESATROOT: DWORD = 0x0004; +pub const TVS_EDITLABELS: DWORD = 0x0008; +pub const TVS_DISABLEDRAGDROP: DWORD = 0x0010; +pub const TVS_SHOWSELALWAYS: DWORD = 0x0020; +pub const TVS_RTLREADING: DWORD = 0x0040; +pub const TVS_NOTOOLTIPS: DWORD = 0x0080; +pub const TVS_CHECKBOXES: DWORD = 0x0100; +pub const TVS_TRACKSELECT: DWORD = 0x0200; +pub const TVS_SINGLEEXPAND: DWORD = 0x0400; +pub const TVS_INFOTIP: DWORD = 0x0800; +pub const TVS_FULLROWSELECT: DWORD = 0x1000; +pub const TVS_NOSCROLL: DWORD = 0x2000; +pub const TVS_NONEVENHEIGHT: DWORD = 0x4000; +pub const TVS_NOHSCROLL: DWORD = 0x8000; +pub const TVS_EX_NOSINGLECOLLAPSE: DWORD = 0x0001; +pub const TVS_EX_MULTISELECT: DWORD = 0x0002; +pub const TVS_EX_DOUBLEBUFFER: DWORD = 0x0004; +pub const TVS_EX_NOINDENTSTATE: DWORD = 0x0008; +pub const TVS_EX_RICHTOOLTIP: DWORD = 0x0010; +pub const TVS_EX_AUTOHSCROLL: DWORD = 0x0020; +pub const TVS_EX_FADEINOUTEXPANDOS: DWORD = 0x0040; +pub const TVS_EX_PARTIALCHECKBOXES: DWORD = 0x0080; +pub const TVS_EX_EXCLUSIONCHECKBOXES: DWORD = 0x0100; +pub const TVS_EX_DIMMEDCHECKBOXES: DWORD = 0x0200; +pub const TVS_EX_DRAWIMAGEASYNC: DWORD = 0x0400; +pub enum TREEITEM {} +pub type HTREEITEM = *mut TREEITEM; +pub const TVIF_TEXT: UINT = 0x0001; +pub const TVIF_IMAGE: UINT = 0x0002; +pub const TVIF_PARAM: UINT = 0x0004; +pub const TVIF_STATE: UINT = 0x0008; +pub const TVIF_HANDLE: UINT = 0x0010; +pub const TVIF_SELECTEDIMAGE: UINT = 0x0020; +pub const TVIF_CHILDREN: UINT = 0x0040; +pub const TVIF_INTEGRAL: UINT = 0x0080; +pub const TVIF_STATEEX: UINT = 0x0100; +pub const TVIF_EXPANDEDIMAGE: UINT = 0x0200; +pub const TVIS_SELECTED: UINT = 0x0002; +pub const TVIS_CUT: UINT = 0x0004; +pub const TVIS_DROPHILITED: UINT = 0x0008; +pub const TVIS_BOLD: UINT = 0x0010; +pub const TVIS_EXPANDED: UINT = 0x0020; +pub const TVIS_EXPANDEDONCE: UINT = 0x0040; +pub const TVIS_EXPANDPARTIAL: UINT = 0x0080; +pub const TVIS_OVERLAYMASK: UINT = 0x0F00; +pub const TVIS_STATEIMAGEMASK: UINT = 0xF000; +pub const TVIS_USERMASK: UINT = 0xF000; +pub const TVIS_EX_FLAT: UINT = 0x0001; +pub const TVIS_EX_DISABLED: UINT = 0x0002; +pub const TVIS_EX_ALL: UINT = 0x0002; +STRUCT!{struct NMTVSTATEIMAGECHANGING { + hdr: NMHDR, + hti: HTREEITEM, + iOldStateImageIndex: c_int, + iNewStateImageIndex: c_int, +}} +pub type LPNMTVSTATEIMAGECHANGING = *mut NMTVSTATEIMAGECHANGING; +pub const I_CHILDRENCALLBACK: c_int = -1; +pub const I_CHILDRENAUTO: c_int = -2; +pub type LPTV_ITEMW = LPTVITEMW; +pub type LPTV_ITEMA = LPTVITEMA; +pub type TV_ITEMW = TVITEMW; +pub type TV_ITEMA = TVITEMA; +STRUCT!{struct TVITEMA { + mask: UINT, + hItem: HTREEITEM, + state: UINT, + stateMask: UINT, + pszText: LPSTR, + cchTextMax: c_int, + iImage: c_int, + iSelectedImage: c_int, + cChildren: c_int, + lParam: LPARAM, +}} +pub type LPTVITEMA = *mut TVITEMA; +STRUCT!{struct TVITEMW { + mask: UINT, + hItem: HTREEITEM, + state: UINT, + stateMask: UINT, + pszText: LPWSTR, + cchTextMax: c_int, + iImage: c_int, + iSelectedImage: c_int, + cChildren: c_int, + lParam: LPARAM, +}} +pub type LPTVITEMW = *mut TVITEMW; +STRUCT!{struct TVITEMEXA { + mask: UINT, + hItem: HTREEITEM, + state: UINT, + stateMask: UINT, + pszText: LPSTR, + cchTextMax: c_int, + iImage: c_int, + iSelectedImage: c_int, + cChildren: c_int, + lParam: LPARAM, + iIntegral: c_int, + uStateEx: UINT, + hwnd: HWND, + iExpandedImage: c_int, + iReserved: c_int, +}} +pub type LPTVITEMEXA = *mut TVITEMEXA; +STRUCT!{struct TVITEMEXW { + mask: UINT, + hItem: HTREEITEM, + state: UINT, + stateMask: UINT, + pszText: LPWSTR, + cchTextMax: c_int, + iImage: c_int, + iSelectedImage: c_int, + cChildren: c_int, + lParam: LPARAM, + iIntegral: c_int, + uStateEx: UINT, + hwnd: HWND, + iExpandedImage: c_int, + iReserved: c_int, +}} +pub type LPTVITEMEXW = *mut TVITEMEXW; +pub const TVI_ROOT: HTREEITEM = -0x10000isize as HTREEITEM; +pub const TVI_FIRST: HTREEITEM = -0x0FFFFisize as HTREEITEM; +pub const TVI_LAST: HTREEITEM = -0x0FFFEisize as HTREEITEM; +pub const TVI_SORT: HTREEITEM = -0x0FFFDisize as HTREEITEM; +pub type LPTV_INSERTSTRUCTA = LPTVINSERTSTRUCTA; +pub type LPTV_INSERTSTRUCTW = LPTVINSERTSTRUCTW; +pub type TV_INSERTSTRUCTA = TVINSERTSTRUCTA; +pub type TV_INSERTSTRUCTW = TVINSERTSTRUCTW; +UNION!{union TVINSERTSTRUCTA_u { + [u32; 15] [u64; 10], + itemex itemex_mut: TVITEMEXA, + item item_mut: TV_ITEMA, +}} +STRUCT!{struct TVINSERTSTRUCTA { + hParent: HTREEITEM, + hInsertAfter: HTREEITEM, + u: TVINSERTSTRUCTA_u, +}} +pub type LPTVINSERTSTRUCTA = *mut TVINSERTSTRUCTA; +UNION!{union TVINSERTSTRUCTW_u { + [u32; 15] [u64; 10], + itemex itemex_mut: TVITEMEXW, + item item_mut: TV_ITEMW, +}} +STRUCT!{struct TVINSERTSTRUCTW { + hParent: HTREEITEM, + hInsertAfter: HTREEITEM, + u: TVINSERTSTRUCTW_u, +}} +pub type LPTVINSERTSTRUCTW = *mut TVINSERTSTRUCTW; +pub const TVM_INSERTITEMA: UINT = TV_FIRST + 0; +pub const TVM_INSERTITEMW: UINT = TV_FIRST + 50; +pub const TVM_DELETEITEM: UINT = TV_FIRST + 1; +pub const TVM_EXPAND: UINT = TV_FIRST + 2; +pub const TVE_COLLAPSE: WPARAM = 0x0001; +pub const TVE_EXPAND: WPARAM = 0x0002; +pub const TVE_TOGGLE: WPARAM = 0x0003; +pub const TVE_EXPANDPARTIAL: WPARAM = 0x4000; +pub const TVE_COLLAPSERESET: WPARAM = 0x8000; +pub const TVM_GETITEMRECT: UINT = TV_FIRST + 4; +pub const TVM_GETCOUNT: UINT = TV_FIRST + 5; +pub const TVM_GETINDENT: UINT = TV_FIRST + 6; +pub const TVM_SETINDENT: UINT = TV_FIRST + 7; +pub const TVM_GETIMAGELIST: UINT = TV_FIRST + 8; +pub const TVSIL_NORMAL: WPARAM = 0; +pub const TVSIL_STATE: WPARAM = 2; +pub const TVM_SETIMAGELIST: UINT = TV_FIRST + 9; +pub const TVM_GETNEXTITEM: UINT = TV_FIRST + 10; +pub const TVGN_ROOT: WPARAM = 0x0000; +pub const TVGN_NEXT: WPARAM = 0x0001; +pub const TVGN_PREVIOUS: WPARAM = 0x0002; +pub const TVGN_PARENT: WPARAM = 0x0003; +pub const TVGN_CHILD: WPARAM = 0x0004; +pub const TVGN_FIRSTVISIBLE: WPARAM = 0x0005; +pub const TVGN_NEXTVISIBLE: WPARAM = 0x0006; +pub const TVGN_PREVIOUSVISIBLE: WPARAM = 0x0007; +pub const TVGN_DROPHILITE: WPARAM = 0x0008; +pub const TVGN_CARET: WPARAM = 0x0009; +pub const TVGN_LASTVISIBLE: WPARAM = 0x000A; +pub const TVGN_NEXTSELECTED: WPARAM = 0x000B; +pub const TVSI_NOSINGLEEXPAND: WPARAM = 0x8000; +pub const TVM_SELECTITEM: UINT = TV_FIRST + 11; +pub const TVM_GETITEMA: UINT = TV_FIRST + 12; +pub const TVM_GETITEMW: UINT = TV_FIRST + 62; +pub const TVM_SETITEMA: UINT = TV_FIRST + 13; +pub const TVM_SETITEMW: UINT = TV_FIRST + 63; +pub const TVM_EDITLABELA: UINT = TV_FIRST + 14; +pub const TVM_EDITLABELW: UINT = TV_FIRST + 65; +pub const TVM_GETEDITCONTROL: UINT = TV_FIRST + 15; +pub const TVM_GETVISIBLECOUNT: UINT = TV_FIRST + 16; +pub const TVM_HITTEST: UINT = TV_FIRST + 17; +pub type LPTV_HITTESTINFO = LPTVHITTESTINFO; +pub type TV_HITTESTINFO = TVHITTESTINFO; +STRUCT!{struct TVHITTESTINFO { + pt: POINT, + flags: UINT, + hItem: HTREEITEM, +}} +pub type LPTVHITTESTINFO = *mut TVHITTESTINFO; +pub const TVHT_NOWHERE: UINT = 0x0001; +pub const TVHT_ONITEMICON: UINT = 0x0002; +pub const TVHT_ONITEMLABEL: UINT = 0x0004; +pub const TVHT_ONITEM: UINT = TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON; +pub const TVHT_ONITEMINDENT: UINT = 0x0008; +pub const TVHT_ONITEMBUTTON: UINT = 0x0010; +pub const TVHT_ONITEMRIGHT: UINT = 0x0020; +pub const TVHT_ONITEMSTATEICON: UINT = 0x0040; +pub const TVHT_ABOVE: UINT = 0x0100; +pub const TVHT_BELOW: UINT = 0x0200; +pub const TVHT_TORIGHT: UINT = 0x0400; +pub const TVHT_TOLEFT: UINT = 0x0800; +pub const TVM_CREATEDRAGIMAGE: UINT = TV_FIRST + 18; +pub const TVM_SORTCHILDREN: UINT = TV_FIRST + 19; +pub const TVM_ENSUREVISIBLE: UINT = TV_FIRST + 20; +pub const TVM_SORTCHILDRENCB: UINT = TV_FIRST + 21; +pub const TVM_ENDEDITLABELNOW: UINT = TV_FIRST + 22; +pub const TVM_GETISEARCHSTRINGA: UINT = TV_FIRST + 23; +pub const TVM_GETISEARCHSTRINGW: UINT = TV_FIRST + 64; +pub const TVM_SETTOOLTIPS: UINT = TV_FIRST + 24; +pub const TVM_GETTOOLTIPS: UINT = TV_FIRST + 25; +pub const TVM_SETINSERTMARK: UINT = TV_FIRST + 26; +pub const TVM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const TVM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const TVM_SETITEMHEIGHT: UINT = TV_FIRST + 27; +pub const TVM_GETITEMHEIGHT: UINT = TV_FIRST + 28; +pub const TVM_SETBKCOLOR: UINT = TV_FIRST + 29; +pub const TVM_SETTEXTCOLOR: UINT = TV_FIRST + 30; +pub const TVM_GETBKCOLOR: UINT = TV_FIRST + 31; +pub const TVM_GETTEXTCOLOR: UINT = TV_FIRST + 32; +pub const TVM_SETSCROLLTIME: UINT = TV_FIRST + 33; +pub const TVM_GETSCROLLTIME: UINT = TV_FIRST + 34; +pub const TVM_SETINSERTMARKCOLOR: UINT = TV_FIRST + 37; +pub const TVM_GETINSERTMARKCOLOR: UINT = TV_FIRST + 38; +pub const TVM_SETBORDER: UINT = TV_FIRST + 35; +pub const TVSBF_XBORDER: WPARAM = 0x00000001; +pub const TVSBF_YBORDER: WPARAM = 0x00000002; +pub const TVM_GETITEMSTATE: UINT = TV_FIRST + 39; +pub const TVM_SETLINECOLOR: UINT = TV_FIRST + 40; +pub const TVM_GETLINECOLOR: UINT = TV_FIRST + 41; +pub const TVM_MAPACCIDTOHTREEITEM: UINT = TV_FIRST + 42; +pub const TVM_MAPHTREEITEMTOACCID: UINT = TV_FIRST + 43; +pub const TVM_SETEXTENDEDSTYLE: UINT = TV_FIRST + 44; +pub const TVM_GETEXTENDEDSTYLE: UINT = TV_FIRST + 45; +pub const TVM_SETAUTOSCROLLINFO: UINT = TV_FIRST + 59; +pub const TVM_SETHOT: UINT = TV_FIRST + 58; +pub const TVM_GETSELECTEDCOUNT: UINT = TV_FIRST + 70; +pub const TVM_SHOWINFOTIP: UINT = TV_FIRST + 71; +ENUM!{enum TVITEMPART { + TVGIPR_BUTTON = 0x0001, +}} +STRUCT!{struct TVGETITEMPARTRECTINFO { + hti: HTREEITEM, + prc: *mut RECT, + partID: TVITEMPART, +}} +pub const TVM_GETITEMPARTRECT: UINT = TV_FIRST + 72; +FN!{stdcall PFNTVCOMPARE( + lParam1: LPARAM, + lParam2: LPARAM, + lParamSort: LPARAM, +) -> c_int} +pub type LPTV_SORTCB = LPTVSORTCB; +pub type TV_SORTCB = TVSORTCB; +STRUCT!{struct TVSORTCB { + hParent: HTREEITEM, + lpfnCompare: PFNTVCOMPARE, + lParam: LPARAM, +}} +pub type LPTVSORTCB = *mut TVSORTCB; +pub type LPNM_TREEVIEWA = LPNMTREEVIEWA; +pub type LPNM_TREEVIEWW = LPNMTREEVIEWW; +pub type NM_TREEVIEWA = NMTREEVIEWA; +pub type NM_TREEVIEWW = NMTREEVIEWW; +STRUCT!{struct NMTREEVIEWA { + hdr: NMHDR, + action: UINT, + itemOld: TVITEMA, + itemNew: TVITEMA, + ptDrag: POINT, +}} +pub type LPNMTREEVIEWA = *mut NMTREEVIEWA; +STRUCT!{struct NMTREEVIEWW { + hdr: NMHDR, + action: UINT, + itemOld: TVITEMW, + itemNew: TVITEMW, + ptDrag: POINT, +}} +pub type LPNMTREEVIEWW = *mut NMTREEVIEWW; +pub const TVN_SELCHANGINGA: UINT = TVN_FIRST - 1; +pub const TVN_SELCHANGINGW: UINT = TVN_FIRST - 50; +pub const TVN_SELCHANGEDA: UINT = TVN_FIRST - 2; +pub const TVN_SELCHANGEDW: UINT = TVN_FIRST - 51; +pub const TVC_UNKNOWN: LPARAM = 0x0000; +pub const TVC_BYMOUSE: LPARAM = 0x0001; +pub const TVC_BYKEYBOARD: LPARAM = 0x0002; +pub const TVN_GETDISPINFOA: UINT = TVN_FIRST - 3; +pub const TVN_GETDISPINFOW: UINT = TVN_FIRST - 52; +pub const TVN_SETDISPINFOA: UINT = TVN_FIRST - 4; +pub const TVN_SETDISPINFOW: UINT = TVN_FIRST - 53; +pub const TVIF_DI_SETITEM: UINT = 0x1000; +pub type TV_DISPINFOA = NMTVDISPINFOA; +pub type TV_DISPINFOW = NMTVDISPINFOW; +STRUCT!{struct NMTVDISPINFOA { + hdr: NMHDR, + item: TVITEMA, +}} +pub type LPNMTVDISPINFOA = *mut NMTVDISPINFOA; +STRUCT!{struct NMTVDISPINFOW { + hdr: NMHDR, + item: TVITEMW, +}} +pub type LPNMTVDISPINFOW = *mut NMTVDISPINFOW; +STRUCT!{struct NMTVDISPINFOEXA { + hdr: NMHDR, + item: TVITEMEXA, +}} +pub type LPNMTVDISPINFOEXA = *mut NMTVDISPINFOEXA; +STRUCT!{struct NMTVDISPINFOEXW { + hdr: NMHDR, + item: TVITEMEXW, +}} +pub type LPNMTVDISPINFOEXW = *mut NMTVDISPINFOEXW; +pub type TV_DISPINFOEXA = NMTVDISPINFOEXA; +pub type TV_DISPINFOEXW = NMTVDISPINFOEXW; +pub const TVN_ITEMEXPANDINGA: UINT = TVN_FIRST - 5; +pub const TVN_ITEMEXPANDINGW: UINT = TVN_FIRST - 54; +pub const TVN_ITEMEXPANDEDA: UINT = TVN_FIRST - 6; +pub const TVN_ITEMEXPANDEDW: UINT = TVN_FIRST - 55; +pub const TVN_BEGINDRAGA: UINT = TVN_FIRST - 7; +pub const TVN_BEGINDRAGW: UINT = TVN_FIRST - 56; +pub const TVN_BEGINRDRAGA: UINT = TVN_FIRST - 8; +pub const TVN_BEGINRDRAGW: UINT = TVN_FIRST - 57; +pub const TVN_DELETEITEMA: UINT = TVN_FIRST - 9; +pub const TVN_DELETEITEMW: UINT = TVN_FIRST - 58; +pub const TVN_BEGINLABELEDITA: UINT = TVN_FIRST - 10; +pub const TVN_BEGINLABELEDITW: UINT = TVN_FIRST - 59; +pub const TVN_ENDLABELEDITA: UINT = TVN_FIRST - 11; +pub const TVN_ENDLABELEDITW: UINT = TVN_FIRST - 60; +pub const TVN_KEYDOWN: UINT = TVN_FIRST - 12; +pub const TVN_GETINFOTIPA: UINT = TVN_FIRST - 13; +pub const TVN_GETINFOTIPW: UINT = TVN_FIRST - 14; +pub const TVN_SINGLEEXPAND: UINT = TVN_FIRST - 15; +pub const TVNRET_DEFAULT: LRESULT = 0; +pub const TVNRET_SKIPOLD: LRESULT = 1; +pub const TVNRET_SKIPNEW: LRESULT = 2; +pub const TVN_ITEMCHANGINGA: UINT = TVN_FIRST - 16; +pub const TVN_ITEMCHANGINGW: UINT = TVN_FIRST - 17; +pub const TVN_ITEMCHANGEDA: UINT = TVN_FIRST - 18; +pub const TVN_ITEMCHANGEDW: UINT = TVN_FIRST - 19; +pub const TVN_ASYNCDRAW: UINT = TVN_FIRST - 20; +pub type TV_KEYDOWN = NMTVKEYDOWN; +STRUCT!{struct NMTVKEYDOWN { + hdr: NMHDR, + wVKey: WORD, + flags: UINT, +}} +pub type LPNMTVKEYDOWN = *mut NMTVKEYDOWN; +STRUCT!{struct NMTVCUSTOMDRAW { + nmcd: NMCUSTOMDRAW, + clrText: COLORREF, + clrTextBk: COLORREF, + iLevel: c_int, +}} +pub type LPNMTVCUSTOMDRAW = *mut NMTVCUSTOMDRAW; +STRUCT!{struct NMTVGETINFOTIPA { + hdr: NMHDR, + pszText: LPSTR, + cchTextMax: c_int, + hItem: HTREEITEM, + lParam: LPARAM, +}} +pub type LPNMTVGETINFOTIPA = *mut NMTVGETINFOTIPA; +STRUCT!{struct NMTVGETINFOTIPW { + hdr: NMHDR, + pszText: LPWSTR, + cchTextMax: c_int, + hItem: HTREEITEM, + lParam: LPARAM, +}} +pub type LPNMTVGETINFOTIPW = *mut NMTVGETINFOTIPW; +pub const TVCDRF_NOIMAGES: LRESULT = 0x00010000; +STRUCT!{struct NMTVITEMCHANGE { + hdr: NMHDR, + uChanged: UINT, + hItem: HTREEITEM, + uStateNew: UINT, + uStateOld: UINT, + lParam: LPARAM, +}} +STRUCT!{struct NMTVASYNCDRAW { + hdr: NMHDR, + pimldp: *mut IMAGELISTDRAWPARAMS, + hr: HRESULT, + hItem: HTREEITEM, + lParam: LPARAM, + dwRetFlags: DWORD, + iRetImageIndex: c_int, +}} +pub const WC_COMBOBOXEX: &'static str = "ComboBoxEx32"; +pub const CBEIF_TEXT: UINT = 0x00000001; +pub const CBEIF_IMAGE: UINT = 0x00000002; +pub const CBEIF_SELECTEDIMAGE: UINT = 0x00000004; +pub const CBEIF_OVERLAY: UINT = 0x00000008; +pub const CBEIF_INDENT: UINT = 0x00000010; +pub const CBEIF_LPARAM: UINT = 0x00000020; +pub const CBEIF_DI_SETITEM: UINT = 0x10000000; +STRUCT!{struct COMBOBOXEXITEMA { + mask: UINT, + iItem: INT_PTR, + pszText: LPSTR, + cchTextMax: c_int, + iImage: c_int, + iSelectedImage: c_int, + iOverlay: c_int, + iIndent: c_int, + lParam: LPARAM, +}} +pub type PCOMBOBOXEXITEMA = *mut COMBOBOXEXITEMA; +pub type PCCOMBOBOXEXITEMA = *const COMBOBOXEXITEMA; +STRUCT!{struct COMBOBOXEXITEMW { + mask: UINT, + iItem: INT_PTR, + pszText: LPWSTR, + cchTextMax: c_int, + iImage: c_int, + iSelectedImage: c_int, + iOverlay: c_int, + iIndent: c_int, + lParam: LPARAM, +}} +pub type PCOMBOBOXEXITEMW = *mut COMBOBOXEXITEMW; +pub type PCCOMBOBOXEXITEMW = *const COMBOBOXEXITEMW; +pub const CBEM_INSERTITEMA: UINT = WM_USER + 1; +pub const CBEM_SETIMAGELIST: UINT = WM_USER + 2; +pub const CBEM_GETIMAGELIST: UINT = WM_USER + 3; +pub const CBEM_GETITEMA: UINT = WM_USER + 4; +pub const CBEM_SETITEMA: UINT = WM_USER + 5; +pub const CBEM_DELETEITEM: UINT = CB_DELETESTRING; +pub const CBEM_GETCOMBOCONTROL: UINT = WM_USER + 6; +pub const CBEM_GETEDITCONTROL: UINT = WM_USER + 7; +pub const CBEM_SETEXSTYLE: UINT = WM_USER + 8; +pub const CBEM_SETEXTENDEDSTYLE: UINT = WM_USER + 14; +pub const CBEM_GETEXSTYLE: UINT = WM_USER + 9; +pub const CBEM_GETEXTENDEDSTYLE: UINT = WM_USER + 9; +pub const CBEM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const CBEM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const CBEM_HASEDITCHANGED: UINT = WM_USER + 10; +pub const CBEM_INSERTITEMW: UINT = WM_USER + 11; +pub const CBEM_SETITEMW: UINT = WM_USER + 12; +pub const CBEM_GETITEMW: UINT = WM_USER + 13; +pub const CBEM_SETWINDOWTHEME: UINT = CCM_SETWINDOWTHEME; +pub const CBES_EX_NOEDITIMAGE: DWORD = 0x00000001; +pub const CBES_EX_NOEDITIMAGEINDENT: DWORD = 0x00000002; +pub const CBES_EX_PATHWORDBREAKPROC: DWORD = 0x00000004; +pub const CBES_EX_NOSIZELIMIT: DWORD = 0x00000008; +pub const CBES_EX_CASESENSITIVE: DWORD = 0x00000010; +pub const CBES_EX_TEXTENDELLIPSIS: DWORD = 0x00000020; +STRUCT!{struct NMCOMBOBOXEXA { + hdr: NMHDR, + ceItem: COMBOBOXEXITEMA, +}} +pub type PNMCOMBOBOXEXA = *mut NMCOMBOBOXEXA; +STRUCT!{struct NMCOMBOBOXEXW { + hdr: NMHDR, + ceItem: COMBOBOXEXITEMW, +}} +pub type PNMCOMBOBOXEXW = *mut NMCOMBOBOXEXW; +pub const CBEN_GETDISPINFOA: UINT = CBEN_FIRST - 0; +pub const CBEN_INSERTITEM: UINT = CBEN_FIRST - 1; +pub const CBEN_DELETEITEM: UINT = CBEN_FIRST - 2; +pub const CBEN_BEGINEDIT: UINT = CBEN_FIRST - 4; +pub const CBEN_ENDEDITA: UINT = CBEN_FIRST - 5; +pub const CBEN_ENDEDITW: UINT = CBEN_FIRST - 6; +pub const CBEN_GETDISPINFOW: UINT = CBEN_FIRST - 7; +pub const CBEN_DRAGBEGINA: UINT = CBEN_FIRST - 8; +pub const CBEN_DRAGBEGINW: UINT = CBEN_FIRST - 9; +pub const CBENF_KILLFOCUS: c_int = 1; +pub const CBENF_RETURN: c_int = 2; +pub const CBENF_ESCAPE: c_int = 3; +pub const CBENF_DROPDOWN: c_int = 4; +pub const CBEMAXSTRLEN: usize = 260; +STRUCT!{struct NMCBEDRAGBEGINW { + hdr: NMHDR, + iItemid: c_int, + szText: [WCHAR; CBEMAXSTRLEN], +}} +pub type PNMCBEDRAGBEGINW = *mut NMCBEDRAGBEGINW; +pub type LPNMCBEDRAGBEGINW = *mut NMCBEDRAGBEGINW; +STRUCT!{struct NMCBEDRAGBEGINA { + hdr: NMHDR, + iItemid: c_int, + szText: [c_char; CBEMAXSTRLEN], +}} +pub type PNMCBEDRAGBEGINA = *mut NMCBEDRAGBEGINA; +pub type LPNMCBEDRAGBEGINA = *mut NMCBEDRAGBEGINA; +STRUCT!{struct NMCBEENDEDITW { + hdr: NMHDR, + fChanged: BOOL, + iNewSelection: c_int, + szText: [WCHAR; CBEMAXSTRLEN], + iWhy: c_int, +}} +pub type PNMCBEENDEDITW = *mut NMCBEENDEDITW; +pub type LPNMCBEENDEDITW = *mut NMCBEENDEDITW; +STRUCT!{struct NMCBEENDEDITA { + hdr: NMHDR, + fChanged: BOOL, + iNewSelection: c_int, + szText: [c_char; CBEMAXSTRLEN], + iWhy: c_int, +}} +pub type PNMCBEENDEDITA = *mut NMCBEENDEDITA; +pub type LPNMCBEENDEDITA = *mut NMCBEENDEDITA; +pub const WC_TABCONTROL: &'static str = "SysTabControl32"; +pub const TCS_SCROLLOPPOSITE: DWORD = 0x0001; +pub const TCS_BOTTOM: DWORD = 0x0002; +pub const TCS_RIGHT: DWORD = 0x0002; +pub const TCS_MULTISELECT: DWORD = 0x0004; +pub const TCS_FLATBUTTONS: DWORD = 0x0008; +pub const TCS_FORCEICONLEFT: DWORD = 0x0010; +pub const TCS_FORCELABELLEFT: DWORD = 0x0020; +pub const TCS_HOTTRACK: DWORD = 0x0040; +pub const TCS_VERTICAL: DWORD = 0x0080; +pub const TCS_TABS: DWORD = 0x0000; +pub const TCS_BUTTONS: DWORD = 0x0100; +pub const TCS_SINGLELINE: DWORD = 0x0000; +pub const TCS_MULTILINE: DWORD = 0x0200; +pub const TCS_RIGHTJUSTIFY: DWORD = 0x0000; +pub const TCS_FIXEDWIDTH: DWORD = 0x0400; +pub const TCS_RAGGEDRIGHT: DWORD = 0x0800; +pub const TCS_FOCUSONBUTTONDOWN: DWORD = 0x1000; +pub const TCS_OWNERDRAWFIXED: DWORD = 0x2000; +pub const TCS_TOOLTIPS: DWORD = 0x4000; +pub const TCS_FOCUSNEVER: DWORD = 0x8000; +pub const TCS_EX_FLATSEPARATORS: DWORD = 0x00000001; +pub const TCS_EX_REGISTERDROP: DWORD = 0x00000002; +pub const TCM_GETIMAGELIST: UINT = TCM_FIRST + 2; +pub const TCM_SETIMAGELIST: UINT = TCM_FIRST + 3; +pub const TCM_GETITEMCOUNT: UINT = TCM_FIRST + 4; +pub const TCIF_TEXT: UINT = 0x0001; +pub const TCIF_IMAGE: UINT = 0x0002; +pub const TCIF_RTLREADING: UINT = 0x0004; +pub const TCIF_PARAM: UINT = 0x0008; +pub const TCIF_STATE: UINT = 0x0010; +pub const TCIS_BUTTONPRESSED: DWORD = 0x0001; +pub const TCIS_HIGHLIGHTED: DWORD = 0x0002; +pub type TC_ITEMHEADERA = TCITEMHEADERA; +pub type TC_ITEMHEADERW = TCITEMHEADERW; +STRUCT!{struct TCITEMHEADERA { + mask: UINT, + lpReserved1: UINT, + lpReserved2: UINT, + pszText: LPSTR, + cchTextMax: c_int, + iImage: c_int, +}} +pub type LPTCITEMHEADERA = *mut TCITEMHEADERA; +STRUCT!{struct TCITEMHEADERW { + mask: UINT, + lpReserved1: UINT, + lpReserved2: UINT, + pszText: LPWSTR, + cchTextMax: c_int, + iImage: c_int, +}} +pub type LPTCITEMHEADERW = *mut TCITEMHEADERW; +pub type TC_ITEMA = TCITEMA; +pub type TC_ITEMW = TCITEMW; +STRUCT!{struct TCITEMA { + mask: UINT, + dwState: DWORD, + dwStateMask: DWORD, + pszText: LPSTR, + cchTextMax: c_int, + iImage: c_int, + lParam: LPARAM, +}} +pub type LPTCITEMA = *mut TCITEMA; +STRUCT!{struct TCITEMW { + mask: UINT, + dwState: DWORD, + dwStateMask: DWORD, + pszText: LPWSTR, + cchTextMax: c_int, + iImage: c_int, + lParam: LPARAM, +}} +pub type LPTCITEMW = *mut TCITEMW; +pub const TCM_GETITEMA: UINT = TCM_FIRST + 5; +pub const TCM_GETITEMW: UINT = TCM_FIRST + 60; +pub const TCM_SETITEMA: UINT = TCM_FIRST + 6; +pub const TCM_SETITEMW: UINT = TCM_FIRST + 61; +pub const TCM_INSERTITEMA: UINT = TCM_FIRST + 7; +pub const TCM_INSERTITEMW: UINT = TCM_FIRST + 62; +pub const TCM_DELETEITEM: UINT = TCM_FIRST + 8; +pub const TCM_DELETEALLITEMS: UINT = TCM_FIRST + 9; +pub const TCM_GETITEMRECT: UINT = TCM_FIRST + 10; +pub const TCM_GETCURSEL: UINT = TCM_FIRST + 11; +pub const TCM_SETCURSEL: UINT = TCM_FIRST + 12; +pub const TCHT_NOWHERE: UINT = 0x0001; +pub const TCHT_ONITEMICON: UINT = 0x0002; +pub const TCHT_ONITEMLABEL: UINT = 0x0004; +pub const TCHT_ONITEM: UINT = TCHT_ONITEMICON | TCHT_ONITEMLABEL; +pub type LPTC_HITTESTINFO = LPTCHITTESTINFO; +pub type TC_HITTESTINFO = TCHITTESTINFO; +STRUCT!{struct TCHITTESTINFO { + pt: POINT, + flags: UINT, +}} +pub type LPTCHITTESTINFO = *mut TCHITTESTINFO; +pub const TCM_HITTEST: UINT = TCM_FIRST + 13; +pub const TCM_SETITEMEXTRA: UINT = TCM_FIRST + 14; +pub const TCM_ADJUSTRECT: UINT = TCM_FIRST + 40; +pub const TCM_SETITEMSIZE: UINT = TCM_FIRST + 41; +pub const TCM_REMOVEIMAGE: UINT = TCM_FIRST + 42; +pub const TCM_SETPADDING: UINT = TCM_FIRST + 43; +pub const TCM_GETROWCOUNT: UINT = TCM_FIRST + 44; +pub const TCM_GETTOOLTIPS: UINT = TCM_FIRST + 45; +pub const TCM_SETTOOLTIPS: UINT = TCM_FIRST + 46; +pub const TCM_GETCURFOCUS: UINT = TCM_FIRST + 47; +pub const TCM_SETCURFOCUS: UINT = TCM_FIRST + 48; +pub const TCM_SETMINTABWIDTH: UINT = TCM_FIRST + 49; +pub const TCM_DESELECTALL: UINT = TCM_FIRST + 50; +pub const TCM_HIGHLIGHTITEM: UINT = TCM_FIRST + 51; +pub const TCM_SETEXTENDEDSTYLE: UINT = TCM_FIRST + 52; +pub const TCM_GETEXTENDEDSTYLE: UINT = TCM_FIRST + 53; +pub const TCM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const TCM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const TCN_KEYDOWN: UINT = TCN_FIRST - 0; +pub type TC_KEYDOWN = NMTCKEYDOWN; +STRUCT!{struct NMTCKEYDOWN { + hdr: NMHDR, + wVKey: WORD, + flags: UINT, +}} +pub const TCN_SELCHANGE: UINT = TCN_FIRST - 1; +pub const TCN_SELCHANGING: UINT = TCN_FIRST - 2; +pub const TCN_GETOBJECT: UINT = TCN_FIRST - 3; +pub const TCN_FOCUSCHANGE: UINT = TCN_FIRST - 4; +pub const ANIMATE_CLASS: &'static str = "SysAnimate32"; +pub const ACS_CENTER: DWORD = 0x0001; +pub const ACS_TRANSPARENT: DWORD = 0x0002; +pub const ACS_AUTOPLAY: DWORD = 0x0004; +pub const ACS_TIMER: DWORD = 0x0008; +pub const ACM_OPENA: UINT = WM_USER + 100; +pub const ACM_OPENW: UINT = WM_USER + 103; +pub const ACM_PLAY: UINT = WM_USER + 101; +pub const ACM_STOP: UINT = WM_USER + 102; +pub const ACM_ISPLAYING: UINT = WM_USER + 104; +pub const ACN_START: WPARAM = 1; +pub const ACN_STOP: WPARAM = 2; +pub const MONTHCAL_CLASS: &'static str = "SysMonthCal32"; +pub type MONTHDAYSTATE = DWORD; +pub type LPMONTHDAYSTATE = *mut DWORD; +pub const MCM_FIRST: UINT = 0x1000; +pub const MCM_GETCURSEL: UINT = MCM_FIRST + 1; +pub const MCM_SETCURSEL: UINT = MCM_FIRST + 2; +pub const MCM_GETMAXSELCOUNT: UINT = MCM_FIRST + 3; +pub const MCM_SETMAXSELCOUNT: UINT = MCM_FIRST + 4; +pub const MCM_GETSELRANGE: UINT = MCM_FIRST + 5; +pub const MCM_SETSELRANGE: UINT = MCM_FIRST + 6; +pub const MCM_GETMONTHRANGE: UINT = MCM_FIRST + 7; +pub const MCM_SETDAYSTATE: UINT = MCM_FIRST + 8; +pub const MCM_GETMINREQRECT: UINT = MCM_FIRST + 9; +pub const MCM_SETCOLOR: UINT = MCM_FIRST + 10; +pub const MCM_GETCOLOR: UINT = MCM_FIRST + 11; +pub const MCSC_BACKGROUND: WPARAM = 0; +pub const MCSC_TEXT: WPARAM = 1; +pub const MCSC_TITLEBK: WPARAM = 2; +pub const MCSC_TITLETEXT: WPARAM = 3; +pub const MCSC_MONTHBK: WPARAM = 4; +pub const MCSC_TRAILINGTEXT: WPARAM = 5; +pub const MCM_SETTODAY: UINT = MCM_FIRST + 12; +pub const MCM_GETTODAY: UINT = MCM_FIRST + 13; +pub const MCM_HITTEST: UINT = MCM_FIRST + 14; +STRUCT!{struct MCHITTESTINFO { + cbSize: UINT, + pt: POINT, + uHit: UINT, + st: SYSTEMTIME, + rc: RECT, + iOffset: c_int, + iRow: c_int, + iCol: c_int, +}} +pub type PMCHITTESTINFO = *mut MCHITTESTINFO; +pub const MCHT_TITLE: UINT = 0x00010000; +pub const MCHT_CALENDAR: UINT = 0x00020000; +pub const MCHT_TODAYLINK: UINT = 0x00030000; +pub const MCHT_CALENDARCONTROL: UINT = 0x00100000; +pub const MCHT_NEXT: UINT = 0x01000000; +pub const MCHT_PREV: UINT = 0x02000000; +pub const MCHT_NOWHERE: UINT = 0x00000000; +pub const MCHT_TITLEBK: UINT = MCHT_TITLE; +pub const MCHT_TITLEMONTH: UINT = MCHT_TITLE | 0x0001; +pub const MCHT_TITLEYEAR: UINT = MCHT_TITLE | 0x0002; +pub const MCHT_TITLEBTNNEXT: UINT = MCHT_TITLE | MCHT_NEXT | 0x0003; +pub const MCHT_TITLEBTNPREV: UINT = MCHT_TITLE | MCHT_PREV | 0x0003; +pub const MCHT_CALENDARBK: UINT = MCHT_CALENDAR; +pub const MCHT_CALENDARDATE: UINT = MCHT_CALENDAR | 0x0001; +pub const MCHT_CALENDARDATENEXT: UINT = MCHT_CALENDARDATE | MCHT_NEXT; +pub const MCHT_CALENDARDATEPREV: UINT = MCHT_CALENDARDATE | MCHT_PREV; +pub const MCHT_CALENDARDAY: UINT = MCHT_CALENDAR | 0x0002; +pub const MCHT_CALENDARWEEKNUM: UINT = MCHT_CALENDAR | 0x0003; +pub const MCHT_CALENDARDATEMIN: UINT = MCHT_CALENDAR | 0x0004; +pub const MCHT_CALENDARDATEMAX: UINT = MCHT_CALENDAR | 0x0005; +pub const MCM_SETFIRSTDAYOFWEEK: UINT = MCM_FIRST + 15; +pub const MCM_GETFIRSTDAYOFWEEK: UINT = MCM_FIRST + 16; +pub const MCM_GETRANGE: UINT = MCM_FIRST + 17; +pub const MCM_SETRANGE: UINT = MCM_FIRST + 18; +pub const MCM_GETMONTHDELTA: UINT = MCM_FIRST + 19; +pub const MCM_SETMONTHDELTA: UINT = MCM_FIRST + 20; +pub const MCM_GETMAXTODAYWIDTH: UINT = MCM_FIRST + 21; +pub const MCM_SETUNICODEFORMAT: UINT = CCM_SETUNICODEFORMAT; +pub const MCM_GETUNICODEFORMAT: UINT = CCM_GETUNICODEFORMAT; +pub const MCMV_MONTH: DWORD = 0; +pub const MCMV_YEAR: DWORD = 1; +pub const MCMV_DECADE: DWORD = 2; +pub const MCMV_CENTURY: DWORD = 3; +pub const MCMV_MAX: DWORD = MCMV_CENTURY; +pub const MCM_GETCURRENTVIEW: UINT = MCM_FIRST + 22; +pub const MCM_GETCALENDARCOUNT: UINT = MCM_FIRST + 23; +pub const MCGIP_CALENDARCONTROL: DWORD = 0; +pub const MCGIP_NEXT: DWORD = 1; +pub const MCGIP_PREV: DWORD = 2; +pub const MCGIP_FOOTER: DWORD = 3; +pub const MCGIP_CALENDAR: DWORD = 4; +pub const MCGIP_CALENDARHEADER: DWORD = 5; +pub const MCGIP_CALENDARBODY: DWORD = 6; +pub const MCGIP_CALENDARROW: DWORD = 7; +pub const MCGIP_CALENDARCELL: DWORD = 8; +pub const MCGIF_DATE: DWORD = 0x00000001; +pub const MCGIF_RECT: DWORD = 0x00000002; +pub const MCGIF_NAME: DWORD = 0x00000004; +STRUCT!{struct MCGRIDINFO { + cbSize: UINT, + dwPart: DWORD, + dwFlags: DWORD, + iCalendar: c_int, + iRow: c_int, + iCol: c_int, + bSelected: BOOL, + stStart: SYSTEMTIME, + stEnd: SYSTEMTIME, + rc: RECT, + pszName: PWSTR, + cchName: size_t, +}} +pub type PMCGRIDINFO = *mut MCGRIDINFO; +pub const MCM_GETCALENDARGRIDINFO: UINT = MCM_FIRST + 24; +pub const MCM_GETCALID: UINT = MCM_FIRST + 27; +pub const MCM_SETCALID: UINT = MCM_FIRST + 28; +pub const MCM_SIZERECTTOMIN: UINT = MCM_FIRST + 29; +pub const MCM_SETCALENDARBORDER: UINT = MCM_FIRST + 30; +pub const MCM_GETCALENDARBORDER: UINT = MCM_FIRST + 31; +pub const MCM_SETCURRENTVIEW: UINT = MCM_FIRST + 32; +STRUCT!{struct NMSELCHANGE { + nmhdr: NMHDR, + stSelStart: SYSTEMTIME, + stSelEnd: SYSTEMTIME, +}} +pub type LPNMSELCHANGE = *mut NMSELCHANGE; +pub const MCN_SELCHANGE: UINT = MCN_FIRST - 3; +STRUCT!{struct NMDAYSTATE { + nmhdr: NMHDR, + stStart: SYSTEMTIME, + cDayState: c_int, + prgDayState: LPMONTHDAYSTATE, +}} +pub type LPNMDAYSTATE = *mut NMDAYSTATE; +pub const MCN_GETDAYSTATE: UINT = MCN_FIRST - 1; +pub type NMSELECT = NMSELCHANGE; +pub type LPNMSELECT = *mut NMSELCHANGE; +pub const MCN_SELECT: UINT = MCN_FIRST; +STRUCT!{struct NMVIEWCHANGE { + nmhdr: NMHDR, + dwOldView: DWORD, + dwNewView: DWORD, +}} +pub type LPNMVIEWCHANGE = *mut NMVIEWCHANGE; +pub const MCN_VIEWCHANGE: UINT = MCN_FIRST - 4; +pub const MCS_DAYSTATE: DWORD = 0x0001; +pub const MCS_MULTISELECT: DWORD = 0x0002; +pub const MCS_WEEKNUMBERS: DWORD = 0x0004; +pub const MCS_NOTODAYCIRCLE: DWORD = 0x0008; +pub const MCS_NOTODAY: DWORD = 0x0010; +pub const MCS_NOTRAILINGDATES: DWORD = 0x0040; +pub const MCS_SHORTDAYSOFWEEK: DWORD = 0x0080; +pub const MCS_NOSELCHANGEONNAV: DWORD = 0x0100; +pub const GMR_VISIBLE: DWORD = 0; +pub const GMR_DAYSTATE: DWORD = 1; +pub const DATETIMEPICK_CLASS: &'static str = "SysDateTimePick32"; +STRUCT!{struct DATETIMEPICKERINFO { + cbSize: UINT, + rcCheck: RECT, + stateCheck: DWORD, + rcButton: RECT, + stateButton: DWORD, + hwndEdit: HWND, + hwndUD: HWND, + hwndDropDown: HWND, +}} +pub type LPDATETIMEPICKERINFO = *mut DATETIMEPICKERINFO; +pub const DTM_FIRST: UINT = 0x1000; +pub const DTM_GETSYSTEMTIME: UINT = DTM_FIRST + 1; +pub const DTM_SETSYSTEMTIME: UINT = DTM_FIRST + 2; +pub const DTM_GETRANGE: UINT = DTM_FIRST + 3; +pub const DTM_SETRANGE: UINT = DTM_FIRST + 4; +pub const DTM_SETFORMATA: UINT = DTM_FIRST + 5; +pub const DTM_SETFORMATW: UINT = DTM_FIRST + 50; +pub const DTM_SETMCCOLOR: UINT = DTM_FIRST + 6; +pub const DTM_GETMCCOLOR: UINT = DTM_FIRST + 7; +pub const DTM_GETMONTHCAL: UINT = DTM_FIRST + 8; +pub const DTM_SETMCFONT: UINT = DTM_FIRST + 9; +pub const DTM_GETMCFONT: UINT = DTM_FIRST + 10; +pub const DTM_SETMCSTYLE: UINT = DTM_FIRST + 11; +pub const DTM_GETMCSTYLE: UINT = DTM_FIRST + 12; +pub const DTM_CLOSEMONTHCAL: UINT = DTM_FIRST + 13; +pub const DTM_GETDATETIMEPICKERINFO: UINT = DTM_FIRST + 14; +pub const DTM_GETIDEALSIZE: UINT = DTM_FIRST + 15; +pub const DTS_UPDOWN: DWORD = 0x0001; +pub const DTS_SHOWNONE: DWORD = 0x0002; +pub const DTS_SHORTDATEFORMAT: DWORD = 0x0000; +pub const DTS_LONGDATEFORMAT: DWORD = 0x0004; +pub const DTS_SHORTDATECENTURYFORMAT: DWORD = 0x000C; +pub const DTS_TIMEFORMAT: DWORD = 0x0009; +pub const DTS_APPCANPARSE: DWORD = 0x0010; +pub const DTS_RIGHTALIGN: DWORD = 0x0020; +pub const DTN_DATETIMECHANGE: UINT = DTN_FIRST2 - 6; +STRUCT!{struct NMDATETIMECHANGE { + nmhdr: NMHDR, + dwFlags: DWORD, + st: SYSTEMTIME, +}} +pub type LPNMDATETIMECHANGE = *mut NMDATETIMECHANGE; +pub const DTN_USERSTRINGA: UINT = DTN_FIRST2 - 5; +pub const DTN_USERSTRINGW: UINT = DTN_FIRST - 5; +STRUCT!{struct NMDATETIMESTRINGA { + nmhdr: NMHDR, + pszUserString: LPCSTR, + st: SYSTEMTIME, + dwFlags: DWORD, +}} +pub type LPNMDATETIMESTRINGA = *mut NMDATETIMESTRINGA; +STRUCT!{struct NMDATETIMESTRINGW { + nmhdr: NMHDR, + pszUserString: LPCWSTR, + st: SYSTEMTIME, + dwFlags: DWORD, +}} +pub type LPNMDATETIMESTRINGW = *mut NMDATETIMESTRINGW; +pub const DTN_WMKEYDOWNA: UINT = DTN_FIRST2 - 4; +pub const DTN_WMKEYDOWNW: UINT = DTN_FIRST - 4; +STRUCT!{struct NMDATETIMEWMKEYDOWNA { + nmhdr: NMHDR, + nVirtKey: c_int, + pszFormat: LPCSTR, + st: SYSTEMTIME, +}} +pub type LPNMDATETIMEWMKEYDOWNA = *mut NMDATETIMEWMKEYDOWNA; +STRUCT!{struct NMDATETIMEWMKEYDOWNW { + nmhdr: NMHDR, + nVirtKey: c_int, + pszFormat: LPCWSTR, + st: SYSTEMTIME, +}} +pub type LPNMDATETIMEWMKEYDOWNW = *mut NMDATETIMEWMKEYDOWNW; +pub const DTN_FORMATA: UINT = DTN_FIRST2 - 3; +pub const DTN_FORMATW: UINT = DTN_FIRST - 3; +STRUCT!{struct NMDATETIMEFORMATA { + nmhdr: NMHDR, + pszFormat: LPCSTR, + st: SYSTEMTIME, + pszDisplay: LPCSTR, + szDisplay: [CHAR; 64], +}} +pub type LPNMDATETIMEFORMATA = *mut NMDATETIMEFORMATA; +STRUCT!{struct NMDATETIMEFORMATW { + nmhdr: NMHDR, + pszFormat: LPCWSTR, + st: SYSTEMTIME, + pszDisplay: LPCWSTR, + szDisplay: [WCHAR; 64], +}} +pub type LPNMDATETIMEFORMATW = *mut NMDATETIMEFORMATW; +pub const DTN_FORMATQUERYA: UINT = DTN_FIRST2 - 2; +pub const DTN_FORMATQUERYW: UINT = DTN_FIRST - 2; +STRUCT!{struct NMDATETIMEFORMATQUERYA { + nmhdr: NMHDR, + pszFormat: LPCSTR, + szMax: SIZE, +}} +pub type LPNMDATETIMEFORMATQUERYA = *mut NMDATETIMEFORMATQUERYA; +STRUCT!{struct NMDATETIMEFORMATQUERYW { + nmhdr: NMHDR, + pszFormat: LPCWSTR, + szMax: SIZE, +}} +pub type LPNMDATETIMEFORMATQUERYW = *mut NMDATETIMEFORMATQUERYW; +pub const DTN_DROPDOWN: UINT = DTN_FIRST2 - 1; +pub const DTN_CLOSEUP: UINT = DTN_FIRST2; +pub const GDTR_MIN: WPARAM = 0x0001; +pub const GDTR_MAX: WPARAM = 0x0002; +pub const GDT_ERROR: LRESULT = -1; +pub const GDT_VALID: LRESULT = 0; +pub const GDT_NONE: LRESULT = 1; +pub const IPM_CLEARADDRESS: UINT = WM_USER + 100; +pub const IPM_SETADDRESS: UINT = WM_USER + 101; +pub const IPM_GETADDRESS: UINT = WM_USER + 102; +pub const IPM_SETRANGE: UINT = WM_USER + 103; +pub const IPM_SETFOCUS: UINT = WM_USER + 104; +pub const IPM_ISBLANK: UINT = WM_USER + 105; +pub const WC_IPADDRESS: &'static str = "SysIPAddress32"; +pub const IPN_FIELDCHANGED: UINT = IPN_FIRST - 0; +STRUCT!{struct NMIPADDRESS { + hdr: NMHDR, + iField: c_int, + iValue: c_int, +}} +pub type LPNMIPADDRESS = *mut NMIPADDRESS; +#[inline] +pub fn MAKEIPRANGE(low: BYTE, high: BYTE) -> LPARAM { + (high << 8 + low) as LPARAM +} +#[inline] +pub fn MAKEIPADDRESS(b1: DWORD, b2: DWORD, b3: DWORD, b4: DWORD) -> LPARAM { + ((b1 << 24) + (b2 << 16) + (b3 << 8) + b4) as LPARAM +} +#[inline] +pub fn FIRST_IPADDRESS(x: LPARAM) -> BYTE { + ((x >> 24) & 0xff) as BYTE +} +#[inline] +pub fn SECOND_IPADDRESS(x: LPARAM) -> BYTE { + ((x >> 16) & 0xff) as BYTE +} +#[inline] +pub fn THIRD_IPADDRESS(x: LPARAM) -> BYTE { + ((x >> 8) & 0xff) as BYTE +} +#[inline] +pub fn FOURTH_IPADDRESS(x: LPARAM) -> BYTE { + (x & 0xff) as BYTE +} +pub const WC_PAGESCROLLER: &'static str = "SysPager"; +pub const PGS_VERT: DWORD = 0x00000000; +pub const PGS_HORZ: DWORD = 0x00000001; +pub const PGS_AUTOSCROLL: DWORD = 0x00000002; +pub const PGS_DRAGNDROP: DWORD = 0x00000004; +pub const PGF_INVISIBLE: DWORD = 0; +pub const PGF_NORMAL: DWORD = 1; +pub const PGF_GRAYED: DWORD = 2; +pub const PGF_DEPRESSED: DWORD = 4; +pub const PGF_HOT: DWORD = 8; +pub const PGB_TOPORLEFT: c_int = 0; +pub const PGB_BOTTOMORRIGHT: c_int = 1; +pub const PGM_SETCHILD: UINT = PGM_FIRST + 1; +pub const PGM_RECALCSIZE: UINT = PGM_FIRST + 2; +pub const PGM_FORWARDMOUSE: UINT = PGM_FIRST + 3; +pub const PGM_SETBKCOLOR: UINT = PGM_FIRST + 4; +pub const PGM_GETBKCOLOR: UINT = PGM_FIRST + 5; +pub const PGM_SETBORDER: UINT = PGM_FIRST + 6; +pub const PGM_GETBORDER: UINT = PGM_FIRST + 7; +pub const PGM_SETPOS: UINT = PGM_FIRST + 8; +pub const PGM_GETPOS: UINT = PGM_FIRST + 9; +pub const PGM_SETBUTTONSIZE: UINT = PGM_FIRST + 10; +pub const PGM_GETBUTTONSIZE: UINT = PGM_FIRST + 11; +pub const PGM_GETBUTTONSTATE: UINT = PGM_FIRST + 12; +pub const PGM_GETDROPTARGET: UINT = CCM_GETDROPTARGET; +pub const PGM_SETSCROLLINFO: UINT = PGM_FIRST + 13; +pub const PGN_SCROLL: UINT = PGN_FIRST - 1; +pub const PGF_SCROLLUP: c_int = 1; +pub const PGF_SCROLLDOWN: c_int = 2; +pub const PGF_SCROLLLEFT: c_int = 4; +pub const PGF_SCROLLRIGHT: c_int = 8; +pub const PGK_SHIFT: BOOL = 1; +pub const PGK_CONTROL: BOOL = 2; +pub const PGK_MENU: BOOL = 4; +STRUCT!{struct NMPGSCROLL { + hdr: NMHDR, + fwKeys: BOOL, + rcParent: RECT, + iDir: c_int, + iXpos: c_int, + iYpos: c_int, + iScroll: c_int, +}} +pub type LPNMPGSCROLL = *mut NMPGSCROLL; +pub const PGN_CALCSIZE: UINT = PGN_FIRST - 2; +pub const PGF_CALCWIDTH: DWORD = 1; +pub const PGF_CALCHEIGHT: DWORD = 2; +STRUCT!{struct NMPGCALCSIZE { + hdr: NMHDR, + dwFlag: DWORD, + iWidth: c_int, + iHeight: c_int, +}} +pub type LPNMPGCALCSIZE = *mut NMPGCALCSIZE; +pub const PGN_HOTITEMCHANGE: UINT = PGN_FIRST - 3; +STRUCT!{struct NMPGHOTITEM { + hdr: NMHDR, + idOld: c_int, + idNew: c_int, + dwFlags: DWORD, +}} +pub type LPNMPGHOTITEM = *mut NMPGHOTITEM; +pub const WC_NATIVEFONTCTL: &'static str = "NativeFontCtl"; +pub const NFS_EDIT: DWORD = 0x0001; +pub const NFS_STATIC: DWORD = 0x0002; +pub const NFS_LISTCOMBO: DWORD = 0x0004; +pub const NFS_BUTTON: DWORD = 0x0008; +pub const NFS_ALL: DWORD = 0x0010; +pub const NFS_USEFONTASSOC: DWORD = 0x0020; +pub const WC_BUTTONA: &'static str = "Button"; +pub const BUTTON_IMAGELIST_ALIGN_LEFT: UINT = 0; +pub const BUTTON_IMAGELIST_ALIGN_RIGHT: UINT = 1; +pub const BUTTON_IMAGELIST_ALIGN_TOP: UINT = 2; +pub const BUTTON_IMAGELIST_ALIGN_BOTTOM: UINT = 3; +pub const BUTTON_IMAGELIST_ALIGN_CENTER: UINT = 4; +STRUCT!{struct BUTTON_IMAGELIST { + himl: HIMAGELIST, + margin: RECT, + uAlign: UINT, +}} +pub type PBUTTON_IMAGELIST = *mut BUTTON_IMAGELIST; +pub const BCM_GETIDEALSIZE: UINT = BCM_FIRST + 0x0001; +pub const BCM_SETIMAGELIST: UINT = BCM_FIRST + 0x0002; +pub const BCM_GETIMAGELIST: UINT = BCM_FIRST + 0x0003; +pub const BCM_SETTEXTMARGIN: UINT = BCM_FIRST + 0x0004; +pub const BCM_GETTEXTMARGIN: UINT = BCM_FIRST + 0x0005; +STRUCT!{struct NMBCHOTITEM { + hdr: NMHDR, + dwFlags: DWORD, +}} +pub type LPNMBCHOTITEM = *mut NMBCHOTITEM; +pub const BCN_HOTITEMCHANGE: UINT = BCN_FIRST + 0x0001; +pub const BS_SPLITBUTTON: UINT = 0x0000000C; +pub const BS_DEFSPLITBUTTON: UINT = 0x0000000D; +pub const BS_COMMANDLINK: UINT = 0x0000000E; +pub const BS_DEFCOMMANDLINK: UINT = 0x0000000F; +pub const BCSIF_GLYPH: UINT = 0x0001; +pub const BCSIF_IMAGE: UINT = 0x0002; +pub const BCSIF_STYLE: UINT = 0x0004; +pub const BCSIF_SIZE: UINT = 0x0008; +pub const BCSS_NOSPLIT: UINT = 0x0001; +pub const BCSS_STRETCH: UINT = 0x0002; +pub const BCSS_ALIGNLEFT: UINT = 0x0004; +pub const BCSS_IMAGE: UINT = 0x0008; +STRUCT!{struct BUTTON_SPLITINFO { + mask: UINT, + himlGlyph: HIMAGELIST, + uSplitStyle: UINT, + size: SIZE, +}} +pub type PBUTTON_SPLITINFO = *mut BUTTON_SPLITINFO; +pub const BCM_SETDROPDOWNSTATE: UINT = BCM_FIRST + 0x0006; +pub const BCM_SETSPLITINFO: UINT = BCM_FIRST + 0x0007; +pub const BCM_GETSPLITINFO: UINT = BCM_FIRST + 0x0008; +pub const BCM_SETNOTE: UINT = BCM_FIRST + 0x0009; +pub const BCM_GETNOTE: UINT = BCM_FIRST + 0x000A; +pub const BCM_GETNOTELENGTH: UINT = BCM_FIRST + 0x000B; +pub const BCM_SETSHIELD: UINT = BCM_FIRST + 0x000C; +pub const BCCL_NOGLYPH: HIMAGELIST = -1isize as HIMAGELIST; +STRUCT!{struct NMBCDROPDOWN { + hdr: NMHDR, + rcButton: RECT, +}} +pub type LPNMBCDROPDOWN = *mut NMBCDROPDOWN; +pub const BCN_DROPDOWN: UINT = BCN_FIRST + 0x0002; +pub const WC_STATIC: &'static str = "Static"; +pub const WC_EDIT: &'static str = "Edit"; +pub const EM_SETCUEBANNER: UINT = ECM_FIRST + 1; +pub const EM_GETCUEBANNER: UINT = ECM_FIRST + 2; +STRUCT!{struct EDITBALLOONTIP { + cbStruct: DWORD, + pszTitle: LPCWSTR, + pszText: LPCWSTR, + ttiIcon: INT, +}} +pub type PEDITBALLOONTIP = *mut EDITBALLOONTIP; +pub const EM_SHOWBALLOONTIP: UINT = ECM_FIRST + 3; +pub const EM_HIDEBALLOONTIP: UINT = ECM_FIRST + 4; +pub const EM_SETHILITE: UINT = ECM_FIRST + 5; +pub const EM_GETHILITE: UINT = ECM_FIRST + 6; +pub const EM_NOSETFOCUS: UINT = ECM_FIRST + 7; +pub const EM_TAKEFOCUS: UINT = ECM_FIRST + 8; +pub const WC_LISTBOX: &'static str = "ListBox"; +pub const WC_COMBOBOX: &'static str = "ComboBox"; +pub const CB_SETMINVISIBLE: UINT = CBM_FIRST + 1; +pub const CB_GETMINVISIBLE: UINT = CBM_FIRST + 2; +pub const CB_SETCUEBANNER: UINT = CBM_FIRST + 3; +pub const CB_GETCUEBANNER: UINT = CBM_FIRST + 4; +pub const WC_SCROLLBAR: &'static str = "ScrollBar"; +FN!{stdcall PFTASKDIALOGCALLBACK( + hwnd: HWND, + msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + lpRefData: LONG_PTR, +) -> HRESULT} +ENUM!{enum TASKDIALOG_FLAGS { + TDF_ENABLE_HYPERLINKS = 0x0001, + TDF_USE_HICON_MAIN = 0x0002, + TDF_USE_HICON_FOOTER = 0x0004, + TDF_ALLOW_DIALOG_CANCELLATION = 0x0008, + TDF_USE_COMMAND_LINKS = 0x0010, + TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020, + TDF_EXPAND_FOOTER_AREA = 0x0040, + TDF_EXPANDED_BY_DEFAULT = 0x0080, + TDF_VERIFICATION_FLAG_CHECKED = 0x0100, + TDF_SHOW_PROGRESS_BAR = 0x0200, + TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400, + TDF_CALLBACK_TIMER = 0x0800, + TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000, + TDF_RTL_LAYOUT = 0x2000, + TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000, + TDF_CAN_BE_MINIMIZED = 0x8000, + TDF_NO_SET_FOREGROUND = 0x00010000, + TDF_SIZE_TO_CONTENT = 0x01000000, +}} +ENUM!{enum TASKDIALOG_MESSAGES { + TDM_NAVIGATE_PAGE = WM_USER + 101, + TDM_CLICK_BUTTON = WM_USER + 102, + TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER + 103, + TDM_SET_PROGRESS_BAR_STATE = WM_USER + 104, + TDM_SET_PROGRESS_BAR_RANGE = WM_USER + 105, + TDM_SET_PROGRESS_BAR_POS = WM_USER + 106, + TDM_SET_PROGRESS_BAR_MARQUEE = WM_USER + 107, + TDM_SET_ELEMENT_TEXT = WM_USER + 108, + TDM_CLICK_RADIO_BUTTON = WM_USER + 110, + TDM_ENABLE_BUTTON = WM_USER + 111, + TDM_ENABLE_RADIO_BUTTON = WM_USER + 112, + TDM_CLICK_VERIFICATION = WM_USER + 113, + TDM_UPDATE_ELEMENT_TEXT = WM_USER + 114, + TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER + 115, + TDM_UPDATE_ICON = WM_USER + 116, +}} +ENUM!{enum TASKDIALOG_NOTIFICATIONS { + TDN_CREATED = 0, + TDN_NAVIGATED = 1, + TDN_BUTTON_CLICKED = 2, + TDN_HYPERLINK_CLICKED = 3, + TDN_TIMER = 4, + TDN_DESTROYED = 5, + TDN_RADIO_BUTTON_CLICKED = 6, + TDN_DIALOG_CONSTRUCTED = 7, + TDN_VERIFICATION_CLICKED = 8, + TDN_HELP = 9, + TDN_EXPANDO_BUTTON_CLICKED = 10, +}} +STRUCT!{struct TASKDIALOG_BUTTON { + nButtonID: c_int, + pszButtonText: PCWSTR, +}} +ENUM!{enum TASKDIALOG_ELEMENTS { + TDE_CONTENT, + TDE_EXPANDED_INFORMATION, + TDE_FOOTER, + TDE_MAIN_INSTRUCTION, +}} +ENUM!{enum TASKDIALOG_ICON_ELEMENTS { + TDIE_ICON_MAIN, + TDIE_ICON_FOOTER, +}} +pub const TD_WARNING_ICON: LPWSTR = MAKEINTRESOURCE!(-1i16); +pub const TD_ERROR_ICON: LPWSTR = MAKEINTRESOURCE!(-2i16); +pub const TD_INFORMATION_ICON: LPWSTR = MAKEINTRESOURCE!(-3i16); +pub const TD_SHIELD_ICON: LPWSTR = MAKEINTRESOURCE!(-4i16); +ENUM!{enum TASKDIALOG_COMMON_BUTTON_FLAGS { + TDCBF_OK_BUTTON = 0x0001, + TDCBF_YES_BUTTON = 0x0002, + TDCBF_NO_BUTTON = 0x0004, + TDCBF_CANCEL_BUTTON = 0x0008, + TDCBF_RETRY_BUTTON = 0x0010, + TDCBF_CLOSE_BUTTON = 0x0020, +}} +UNION!{union TASKDIALOGCONFIG_u1 { + [u8; 8], + hMainIcon hMainIcon_mut: HICON, + pszMainIcon pszMainIcon_mut: PCWSTR, +}} +UNION!{union TASKDIALOGCONFIG_u2 { + [u8; 8], + hFooterIcon hFooterIcon_mut: HICON, + pszFooterIcon pszFooterIcon_mut: PCWSTR, +}} +STRUCT!{struct TASKDIALOGCONFIG { + cbSize: UINT, + hwndParent: HWND, + hInstance: HINSTANCE, + dwFlags: TASKDIALOG_FLAGS, + dwCommonButtons: TASKDIALOG_COMMON_BUTTON_FLAGS, + pszWindowTitle: PCWSTR, + u1: TASKDIALOGCONFIG_u1, + pszMainInstruction: PCWSTR, + pszContent: PCWSTR, + cButtons: UINT, + pButtons: *const TASKDIALOG_BUTTON, + nDefaultButton: c_int, + cRadioButtons: UINT, + pRadioButtons: *const TASKDIALOG_BUTTON, + nDefaultRadioButton: c_int, + pszVerificationText: PCWSTR, + pszExpandedInformation: PCWSTR, + pszExpandedControlText: PCWSTR, + pszCollapsedControlText: PCWSTR, + u2: TASKDIALOGCONFIG_u2, + pszFooter: PCWSTR, + pfCallback: PFTASKDIALOGCALLBACK, + lpCallbackData: LONG_PTR, + cxWidth: UINT, +}} +extern "system" { + pub fn TaskDialogIndirect( + pTaskConfig: *const TASKDIALOGCONFIG, + pnButton: *mut c_int, + pnRadioButton: *mut c_int, + pfVerificationFlagChecked: *mut BOOL, + ) -> HRESULT; + pub fn TaskDialog( + hwndOwner: HWND, + hInstance: HINSTANCE, + pszWindowTitle: PCWSTR, + pszMainInstruction: PCWSTR, + pszContent: PCWSTR, + dwCommonButtons: TASKDIALOG_COMMON_BUTTON_FLAGS, + pszIcon: PCWSTR, + pnButton: *mut c_int, + ) -> HRESULT; + pub fn InitMUILanguage( + uiLang: LANGID, + ); + pub fn GetMUILanguage() -> LANGID; + pub fn _TrackMouseEvent( + lpEventTrack: LPTRACKMOUSEEVENT, + ) -> BOOL; +} +pub const WSB_PROP_CYVSCROLL: UINT = 0x00000001; +pub const WSB_PROP_CXHSCROLL: UINT = 0x00000002; +pub const WSB_PROP_CYHSCROLL: UINT = 0x00000004; +pub const WSB_PROP_CXVSCROLL: UINT = 0x00000008; +pub const WSB_PROP_CXHTHUMB: UINT = 0x00000010; +pub const WSB_PROP_CYVTHUMB: UINT = 0x00000020; +pub const WSB_PROP_VBKGCOLOR: UINT = 0x00000040; +pub const WSB_PROP_HBKGCOLOR: UINT = 0x00000080; +pub const WSB_PROP_VSTYLE: UINT = 0x00000100; +pub const WSB_PROP_HSTYLE: UINT = 0x00000200; +pub const WSB_PROP_WINSTYLE: UINT = 0x00000400; +pub const WSB_PROP_PALETTE: UINT = 0x00000800; +pub const WSB_PROP_MASK: UINT = 0x00000FFF; +pub const FSB_FLAT_MODE: INT_PTR = 2; +pub const FSB_ENCARTA_MODE: INT_PTR = 1; +pub const FSB_REGULAR_MODE: INT_PTR = 0; +extern "system" { + pub fn FlatSB_EnableScrollBar( + hWnd: HWND, + wSBflags: c_int, + wArrows: UINT, + ) -> BOOL; + pub fn FlatSB_ShowScrollBar( + hWnd: HWND, + code: c_int, + fShow: BOOL, + ) -> BOOL; + pub fn FlatSB_GetScrollRange( + hWnd: HWND, + code: c_int, + lpMinPos: LPINT, + lpMaxPos: LPINT, + ) -> BOOL; + pub fn FlatSB_GetScrollInfo( + hwnd: HWND, + code: c_int, + lpsi: LPSCROLLINFO, + ) -> BOOL; + pub fn FlatSB_GetScrollPos( + hWnd: HWND, + code: c_int, + ) -> c_int; + pub fn FlatSB_GetScrollProp(hWnd: HWND, + propIndex: c_int, + pValue: LPINT, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn FlatSB_GetScrollPropPtr( + hWnd: HWND, + propIndex: c_int, + pValue: PINT_PTR, + ) -> BOOL; + pub fn FlatSB_SetScrollPos( + hWnd: HWND, + code: c_int, + pos: c_int, + fRedraw: BOOL, + ) -> c_int; + pub fn FlatSB_SetScrollInfo( + hWnd: HWND, + code: c_int, + psi: LPSCROLLINFO, + fRedraw: BOOL, + ) -> c_int; + pub fn FlatSB_SetScrollRange( + hWnd: HWND, + code: c_int, + min: c_int, + max: c_int, + fRedraw: BOOL, + ) -> c_int; + pub fn FlatSB_SetScrollProp( + hWnd: HWND, + index: UINT, + newValue: INT_PTR, + fRedraw: BOOL, + ) -> BOOL; + pub fn InitializeFlatSB( + hWnd: HWND, + ) -> BOOL; + pub fn UninitializeFlatSB( + hWnd: HWND, + ) -> HRESULT; +} +FN!{stdcall SUBCLASSPROC( + hWnd: HWND, + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + uIdSubclass: UINT_PTR, + dwRefData: DWORD_PTR, +) -> LRESULT} +extern "system" { + pub fn SetWindowSubclass( + hWnd: HWND, + pfnSubclass: SUBCLASSPROC, + uIdSubclass: UINT_PTR, + dwRefData: DWORD_PTR, + ) -> BOOL; + pub fn GetWindowSubclass( + hWnd: HWND, + pfnSubclass: SUBCLASSPROC, + uIdSubclass: UINT_PTR, + pdwRefData: *mut DWORD_PTR, + ) -> BOOL; + pub fn RemoveWindowSubclass( + hWnd: HWND, + pfnSubclass: SUBCLASSPROC, + uIdSubclass: UINT_PTR, + ) -> BOOL; + pub fn DefSubclassProc( + hWnd: HWND, + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; +} +ENUM!{enum REGCLS { + LIM_SMALL, + LIM_LARGE, +}} +extern "system" { + pub fn LoadIconMetric( + hinst: HINSTANCE, + pszName: PCWSTR, + lims: c_int, + phico: *mut HICON, + ) -> HRESULT; + pub fn LoadIconWithScaleDown( + hinst: HINSTANCE, + pszName: PCWSTR, + cx: c_int, + cy: c_int, + phico: *mut HICON, + ) -> HRESULT; + pub fn DrawShadowText( + hdc: HDC, + pszText: LPCWSTR, + cch: UINT, + prc: *mut RECT, + dwFlags: DWORD, + crText: COLORREF, + crShadow: COLORREF, + ixOffset: c_int, + iyOffset: c_int, + ) -> c_int; +} diff --git a/src/vendor/winapi/src/um/commdlg.rs b/src/vendor/winapi/src/um/commdlg.rs new file mode 100644 index 0000000000..ca6e3a7b42 --- /dev/null +++ b/src/vendor/winapi/src/um/commdlg.rs @@ -0,0 +1,715 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! 32-Bit Common Dialog APIs +use ctypes::{c_short, c_void}; +use shared::basetsd::UINT_PTR; +use shared::minwindef::{ + BOOL, DWORD, HGLOBAL, HINSTANCE, INT, LPARAM, LPVOID, LRESULT, UINT, WORD, WPARAM, +}; +use shared::windef::{COLORREF, HDC, HWND, POINT, RECT}; +use um::prsht::HPROPSHEETPAGE; +use um::unknwnbase::{IUnknown, IUnknownVtbl, LPUNKNOWN}; +use um::wingdi::{DM_COLLATE, DM_COPIES, LPDEVMODEW, LPLOGFONTA, LPLOGFONTW}; +use um::winnt::{HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR}; +use um::winuser::{NMHDR, WM_USER}; +FN!{stdcall LPOFNHOOKPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +STRUCT!{struct OPENFILENAME_NT4A { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HINSTANCE, + lpstrFilter: LPCSTR, + lpstrCustomFilter: LPSTR, + nMaxCustFilter: DWORD, + nFilterIndex: DWORD, + lpstrFile: LPSTR, + nMaxFile: DWORD, + lpstrFileTitle: LPSTR, + nMaxFileTitle: DWORD, + lpstrInitialDir: LPCSTR, + lpstrTitle: LPCSTR, + Flags: DWORD, + nFileOffset: WORD, + nFileExtension: WORD, + lpstrDefExt: LPCSTR, + lCustData: LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: LPCSTR, +}} +pub type LPOPENFILENAME_NT4A = *mut OPENFILENAME_NT4A; +STRUCT!{struct OPENFILENAME_NT4W { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HINSTANCE, + lpstrFilter: LPCWSTR, + lpstrCustomFilter: LPWSTR, + nMaxCustFilter: DWORD, + nFilterIndex: DWORD, + lpstrFile: LPWSTR, + nMaxFile: DWORD, + lpstrFileTitle: LPWSTR, + nMaxFileTitle: DWORD, + lpstrInitialDir: LPCWSTR, + lpstrTitle: LPCWSTR, + Flags: DWORD, + nFileOffset: WORD, + nFileExtension: WORD, + lpstrDefExt: LPCWSTR, + lCustData: LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: LPCWSTR, +}} +pub type LPOPENFILENAME_NT4W = *mut OPENFILENAME_NT4W; +STRUCT!{struct OPENFILENAMEA { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HINSTANCE, + lpstrFilter: LPCSTR, + lpstrCustomFilter: LPSTR, + nMaxCustFilter: DWORD, + nFilterIndex: DWORD, + lpstrFile: LPSTR, + nMaxFile: DWORD, + lpstrFileTitle: LPSTR, + nMaxFileTitle: DWORD, + lpstrInitialDir: LPCSTR, + lpstrTitle: LPCSTR, + Flags: DWORD, + nFileOffset: WORD, + nFileExtension: WORD, + lpstrDefExt: LPCSTR, + lCustData: LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: LPCSTR, + pvReserved: *mut c_void, + dwReserved: DWORD, + FlagsEx: DWORD, +}} +pub type LPOPENFILENAMEA = *mut OPENFILENAMEA; +STRUCT!{struct OPENFILENAMEW { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HINSTANCE, + lpstrFilter: LPCWSTR, + lpstrCustomFilter: LPWSTR, + nMaxCustFilter: DWORD, + nFilterIndex: DWORD, + lpstrFile: LPWSTR, + nMaxFile: DWORD, + lpstrFileTitle: LPWSTR, + nMaxFileTitle: DWORD, + lpstrInitialDir: LPCWSTR, + lpstrTitle: LPCWSTR, + Flags: DWORD, + nFileOffset: WORD, + nFileExtension: WORD, + lpstrDefExt: LPCWSTR, + lCustData: LPARAM, + lpfnHook: LPOFNHOOKPROC, + lpTemplateName: LPCWSTR, + pvReserved: *mut c_void, + dwReserved: DWORD, + FlagsEx: DWORD, +}} +pub type LPOPENFILENAMEW = *mut OPENFILENAMEW; +extern "system" { + pub fn GetOpenFileNameA( + lpofn: LPOPENFILENAMEA, + ) -> BOOL; + pub fn GetOpenFileNameW( + lpofn: LPOPENFILENAMEW, + ) -> BOOL; + pub fn GetSaveFileNameA( + lpofn: LPOPENFILENAMEA, + ) -> BOOL; + pub fn GetSaveFileNameW( + lpofn: LPOPENFILENAMEW, + ) -> BOOL; + pub fn GetFileTitleA( + lpszFile: LPCSTR, + Buf: LPSTR, + cchSize: WORD, + ) -> c_short; + pub fn GetFileTitleW( + lpszFile: LPCWSTR, + Buf: LPWSTR, + cchSize: WORD, + ) -> c_short; +} +pub const OFN_READONLY: DWORD = 0x00000001; +pub const OFN_OVERWRITEPROMPT: DWORD = 0x00000002; +pub const OFN_HIDEREADONLY: DWORD = 0x00000004; +pub const OFN_NOCHANGEDIR: DWORD = 0x00000008; +pub const OFN_SHOWHELP: DWORD = 0x00000010; +pub const OFN_ENABLEHOOK: DWORD = 0x00000020; +pub const OFN_ENABLETEMPLATE: DWORD = 0x00000040; +pub const OFN_ENABLETEMPLATEHANDLE: DWORD = 0x00000080; +pub const OFN_NOVALIDATE: DWORD = 0x00000100; +pub const OFN_ALLOWMULTISELECT: DWORD = 0x00000200; +pub const OFN_EXTENSIONDIFFERENT: DWORD = 0x00000400; +pub const OFN_PATHMUSTEXIST: DWORD = 0x00000800; +pub const OFN_FILEMUSTEXIST: DWORD = 0x00001000; +pub const OFN_CREATEPROMPT: DWORD = 0x00002000; +pub const OFN_SHAREAWARE: DWORD = 0x00004000; +pub const OFN_NOREADONLYRETURN: DWORD = 0x00008000; +pub const OFN_NOTESTFILECREATE: DWORD = 0x00010000; +pub const OFN_NONETWORKBUTTON: DWORD = 0x00020000; +pub const OFN_NOLONGNAMES: DWORD = 0x00040000; +pub const OFN_EXPLORER: DWORD = 0x00080000; +pub const OFN_NODEREFERENCELINKS: DWORD = 0x00100000; +pub const OFN_LONGNAMES: DWORD = 0x00200000; +pub const OFN_ENABLEINCLUDENOTIFY: DWORD = 0x00400000; +pub const OFN_ENABLESIZING: DWORD = 0x00800000; +pub const OFN_DONTADDTORECENT: DWORD = 0x02000000; +pub const OFN_FORCESHOWHIDDEN: DWORD = 0x10000000; +pub const OFN_EX_NOPLACESBAR: DWORD = 0x00000001; +pub const OFN_SHAREFALLTHROUGH: UINT_PTR = 2; +pub const OFN_SHARENOWARN: UINT_PTR = 1; +pub const OFN_SHAREWARN: UINT_PTR = 0; +FN!{stdcall LPCCHOOKPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +STRUCT!{struct OFNOTIFYA { + hdr: NMHDR, + lpOFN: LPOPENFILENAMEA, + pszFile: LPSTR, +}} +pub type LPOFNOTIFYA = *mut OFNOTIFYA; +STRUCT!{struct OFNOTIFYW { + hdr: NMHDR, + lpOFN: LPOPENFILENAMEW, + pszFile: LPWSTR, +}} +pub type LPOFNOTIFYW = *mut OFNOTIFYW; +STRUCT!{struct OFNOTIFYEXA { + hdr: NMHDR, + lpOFN: LPOPENFILENAMEA, + psf: LPVOID, + pidl: LPVOID, +}} +pub type LPOFNOTIFYEXA = *mut OFNOTIFYEXA; +STRUCT!{struct OFNOTIFYEXW { + hdr: NMHDR, + lpOFN: LPOPENFILENAMEW, + psf: LPVOID, + pidl: LPVOID, +}} +pub type LPOFNOTIFYEXW = *mut OFNOTIFYEXW; +pub const CDN_FIRST: UINT = -601i32 as u32; +pub const CDN_LAST: UINT = -699i32 as u32; +pub const CDN_INITDONE: UINT = CDN_FIRST - 0x0000; +pub const CDN_SELCHANGE: UINT = CDN_FIRST - 0x0001; +pub const CDN_FOLDERCHANGE: UINT = CDN_FIRST - 0x0002; +pub const CDN_SHAREVIOLATION: UINT = CDN_FIRST - 0x0003; +pub const CDN_HELP: UINT = CDN_FIRST - 0x0004; +pub const CDN_FILEOK: UINT = CDN_FIRST - 0x0005; +pub const CDN_TYPECHANGE: UINT = CDN_FIRST - 0x0006; +pub const CDN_INCLUDEITEM: UINT = CDN_FIRST - 0x0007; +pub const CDM_FIRST: UINT = WM_USER + 100; +pub const CDM_LAST: UINT = WM_USER + 200; +pub const CDM_GETSPEC: UINT = CDM_FIRST + 0x0000; +pub const CDM_GETFILEPATH: UINT = CDM_FIRST + 0x0001; +pub const CDM_GETFOLDERPATH: UINT = CDM_FIRST + 0x0002; +pub const CDM_GETFOLDERIDLIST: UINT = CDM_FIRST + 0x0003; +pub const CDM_SETCONTROLTEXT: UINT = CDM_FIRST + 0x0004; +pub const CDM_HIDECONTROL: UINT = CDM_FIRST + 0x0005; +pub const CDM_SETDEFEXT: UINT = CDM_FIRST + 0x0006; +STRUCT!{struct CHOOSECOLORA { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HWND, + rgbResult: COLORREF, + lpCustColors: *mut COLORREF, + Flags: DWORD, + lCustData: LPARAM, + lpfnHook: LPCCHOOKPROC, + lpTemplateName: LPCSTR, +}} +pub type LPCHOOSECOLORA = *mut CHOOSECOLORA; +STRUCT!{struct CHOOSECOLORW { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HWND, + rgbResult: COLORREF, + lpCustColors: *mut COLORREF, + Flags: DWORD, + lCustData: LPARAM, + lpfnHook: LPCCHOOKPROC, + lpTemplateName: LPCWSTR, +}} +pub type LPCHOOSECOLORW = *mut CHOOSECOLORW; +extern "system" { + pub fn ChooseColorA( + lpcc: LPCHOOSECOLORA, + ) -> BOOL; + pub fn ChooseColorW( + lpcc: LPCHOOSECOLORW, + ) -> BOOL; +} +pub const CC_RGBINIT: DWORD = 0x00000001; +pub const CC_FULLOPEN: DWORD = 0x00000002; +pub const CC_PREVENTFULLOPEN: DWORD = 0x00000004; +pub const CC_SHOWHELP: DWORD = 0x00000008; +pub const CC_ENABLEHOOK: DWORD = 0x00000010; +pub const CC_ENABLETEMPLATE: DWORD = 0x00000020; +pub const CC_ENABLETEMPLATEHANDLE: DWORD = 0x00000040; +pub const CC_SOLIDCOLOR: DWORD = 0x00000080; +pub const CC_ANYCOLOR: DWORD = 0x00000100; +FN!{stdcall LPFRHOOKPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +STRUCT!{struct FINDREPLACEA { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HINSTANCE, + Flags: DWORD, + lpstrFindWhat: LPSTR, + lpstrReplaceWith: LPSTR, + wFindWhatLen: WORD, + wReplaceWithLen: WORD, + lCustData: LPARAM, + lpfnHook: LPFRHOOKPROC, + lpTemplateName: LPCSTR, +}} +pub type LPFINDREPLACEA = *mut FINDREPLACEA; +STRUCT!{struct FINDREPLACEW { + lStructSize: DWORD, + hwndOwner: HWND, + hInstance: HINSTANCE, + Flags: DWORD, + lpstrFindWhat: LPWSTR, + lpstrReplaceWith: LPWSTR, + wFindWhatLen: WORD, + wReplaceWithLen: WORD, + lCustData: LPARAM, + lpfnHook: LPFRHOOKPROC, + lpTemplateName: LPCWSTR, +}} +pub type LPFINDREPLACEW = *mut FINDREPLACEW; +pub const FR_DOWN: DWORD = 0x00000001; +pub const FR_WHOLEWORD: DWORD = 0x00000002; +pub const FR_MATCHCASE: DWORD = 0x00000004; +pub const FR_FINDNEXT: DWORD = 0x00000008; +pub const FR_REPLACE: DWORD = 0x00000010; +pub const FR_REPLACEALL: DWORD = 0x00000020; +pub const FR_DIALOGTERM: DWORD = 0x00000040; +pub const FR_SHOWHELP: DWORD = 0x00000080; +pub const FR_ENABLEHOOK: DWORD = 0x00000100; +pub const FR_ENABLETEMPLATE: DWORD = 0x00000200; +pub const FR_NOUPDOWN: DWORD = 0x00000400; +pub const FR_NOMATCHCASE: DWORD = 0x00000800; +pub const FR_NOWHOLEWORD: DWORD = 0x00001000; +pub const FR_ENABLETEMPLATEHANDLE: DWORD = 0x00002000; +pub const FR_HIDEUPDOWN: DWORD = 0x00004000; +pub const FR_HIDEMATCHCASE: DWORD = 0x00008000; +pub const FR_HIDEWHOLEWORD: DWORD = 0x00010000; +pub const FR_RAW: DWORD = 0x00020000; +pub const FR_MATCHDIAC: DWORD = 0x20000000; +pub const FR_MATCHKASHIDA: DWORD = 0x40000000; +pub const FR_MATCHALEFHAMZA: DWORD = 0x80000000; +extern "system" { + pub fn FindTextA( + lpfr: LPFINDREPLACEA, + ) -> HWND; + pub fn FindTextW( + lpfr: LPFINDREPLACEW, + ) -> HWND; + pub fn ReplaceTextA( + lpfr: LPFINDREPLACEA, + ) -> HWND; + pub fn ReplaceTextW( + lpfr: LPFINDREPLACEW, + ) -> HWND; +} +FN!{stdcall LPCFHOOKPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +STRUCT!{struct CHOOSEFONTA { + lStructSize: DWORD, + hwndOwner: HWND, + hDC: HDC, + lpLogFont: LPLOGFONTA, + iPointSize: INT, + Flags: DWORD, + rgbColors: COLORREF, + lCustData: LPARAM, + lpfnHook: LPCFHOOKPROC, + lpTemplateName: LPCSTR, + hInstance: HINSTANCE, + lpszStyle: LPSTR, + nFontType: WORD, + ___MISSING_ALIGNMENT__: WORD, + nSizeMin: INT, + nSizeMax: INT, +}} +pub type LPCHOOSEFONTA = *mut CHOOSEFONTA; +STRUCT!{struct CHOOSEFONTW { + lStructSize: DWORD, + hwndOwner: HWND, + hDC: HDC, + lpLogFont: LPLOGFONTW, + iPointSize: INT, + Flags: DWORD, + rgbColors: COLORREF, + lCustData: LPARAM, + lpfnHook: LPCFHOOKPROC, + lpTemplateName: LPCWSTR, + hInstance: HINSTANCE, + lpszStyle: LPWSTR, + nFontType: WORD, + ___MISSING_ALIGNMENT__: WORD, + nSizeMin: INT, + nSizeMax: INT, +}} +pub type LPCHOOSEFONTW = *mut CHOOSEFONTW; +extern "system" { + pub fn ChooseFontA( + lpcf: LPCHOOSEFONTA, + ) -> BOOL; + pub fn ChooseFontW( + lpcf: LPCHOOSEFONTW, + ) -> BOOL; +} +pub const CF_SCREENFONTS: DWORD = 0x00000001; +pub const CF_PRINTERFONTS: DWORD = 0x00000002; +pub const CF_BOTH: DWORD = CF_SCREENFONTS | CF_PRINTERFONTS; +pub const CF_SHOWHELP: DWORD = 0x00000004; +pub const CF_ENABLEHOOK: DWORD = 0x00000008; +pub const CF_ENABLETEMPLATE: DWORD = 0x00000010; +pub const CF_ENABLETEMPLATEHANDLE: DWORD = 0x00000020; +pub const CF_INITTOLOGFONTSTRUCT: DWORD = 0x00000040; +pub const CF_USESTYLE: DWORD = 0x00000080; +pub const CF_EFFECTS: DWORD = 0x00000100; +pub const CF_APPLY: DWORD = 0x00000200; +pub const CF_ANSIONLY: DWORD = 0x00000400; +pub const CF_SCRIPTSONLY: DWORD = CF_ANSIONLY; +pub const CF_NOVECTORFONTS: DWORD = 0x00000800; +pub const CF_NOOEMFONTS: DWORD = CF_NOVECTORFONTS; +pub const CF_NOSIMULATIONS: DWORD = 0x00001000; +pub const CF_LIMITSIZE: DWORD = 0x00002000; +pub const CF_FIXEDPITCHONLY: DWORD = 0x00004000; +pub const CF_WYSIWYG: DWORD = 0x00008000; +pub const CF_FORCEFONTEXIST: DWORD = 0x00010000; +pub const CF_SCALABLEONLY: DWORD = 0x00020000; +pub const CF_TTONLY: DWORD = 0x00040000; +pub const CF_NOFACESEL: DWORD = 0x00080000; +pub const CF_NOSTYLESEL: DWORD = 0x00100000; +pub const CF_NOSIZESEL: DWORD = 0x00200000; +pub const CF_SELECTSCRIPT: DWORD = 0x00400000; +pub const CF_NOSCRIPTSEL: DWORD = 0x00800000; +pub const CF_NOVERTFONTS: DWORD = 0x01000000; +pub const CF_INACTIVEFONTS: DWORD = 0x02000000; +pub const SIMULATED_FONTTYPE: WORD = 0x8000; +pub const PRINTER_FONTTYPE: WORD = 0x4000; +pub const SCREEN_FONTTYPE: WORD = 0x2000; +pub const BOLD_FONTTYPE: WORD = 0x0100; +pub const ITALIC_FONTTYPE: WORD = 0x0200; +pub const REGULAR_FONTTYPE: WORD = 0x0400; +pub const PS_OPENTYPE_FONTTYPE: DWORD = 0x10000; +pub const TT_OPENTYPE_FONTTYPE: DWORD = 0x20000; +pub const TYPE1_FONTTYPE: DWORD = 0x40000; +pub const SYMBOL_FONTTYPE: DWORD = 0x80000; +pub const WM_CHOOSEFONT_GETLOGFONT: UINT = WM_USER + 1; +pub const WM_CHOOSEFONT_SETLOGFONT: UINT = WM_USER + 101; +pub const WM_CHOOSEFONT_SETFLAGS: UINT = WM_USER + 102; +pub const CD_LBSELNOITEMS: WORD = -1i16 as u16; +pub const CD_LBSELCHANGE: WORD = 0; +pub const CD_LBSELSUB: WORD = 1; +pub const CD_LBSELADD: WORD = 2; +FN!{stdcall LPPRINTHOOKPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +FN!{stdcall LPSETUPHOOKPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +STRUCT!{struct PRINTDLGA { + lStructSize: DWORD, + hwndOwner: HWND, + hDevMode: HGLOBAL, + hDevNames: HGLOBAL, + hDC: HDC, + Flags: DWORD, + nFromPage: WORD, + nToPage: WORD, + nMinPage: WORD, + nMaxPage: WORD, + nCopies: WORD, + hInstance: HINSTANCE, + lCustData: LPARAM, + lpfnPrintHook: LPPRINTHOOKPROC, + lpfnSetupHook: LPSETUPHOOKPROC, + lpPrintTemplateName: LPCSTR, + lpSetupTemplateName: LPCSTR, + hPrintTemplate: HGLOBAL, + hSetupTemplate: HGLOBAL, +}} +pub type LPPRINTDLGA = *mut PRINTDLGA; +STRUCT!{struct PRINTDLGW { + lStructSize: DWORD, + hwndOwner: HWND, + hDevMode: HGLOBAL, + hDevNames: HGLOBAL, + hDC: HDC, + Flags: DWORD, + nFromPage: WORD, + nToPage: WORD, + nMinPage: WORD, + nMaxPage: WORD, + nCopies: WORD, + hInstance: HINSTANCE, + lCustData: LPARAM, + lpfnPrintHook: LPPRINTHOOKPROC, + lpfnSetupHook: LPSETUPHOOKPROC, + lpPrintTemplateName: LPCWSTR, + lpSetupTemplateName: LPCWSTR, + hPrintTemplate: HGLOBAL, + hSetupTemplate: HGLOBAL, +}} +pub type LPPRINTDLGW = *mut PRINTDLGW; +extern "system" { + pub fn PrintDlgA( + pPD: LPPRINTDLGA, + ) -> BOOL; + pub fn PrintDlgW( + pPD: LPPRINTDLGW, + ) -> BOOL; +} +RIDL!(#[uuid(0x5852a2c3, 0x6530, 0x11d1, 0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9)] +interface IPrintDialogCallback(IPrintDialogCallbackVtbl): IUnknown(IUnknownVtbl) { + fn InitDone() -> HRESULT, + fn SelectionChange() -> HRESULT, + fn HandleMessage( + hDlg: HWND, + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + pResult: *mut LRESULT, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0x509aaeda, 0x5639, 0x11d1, 0xb6, 0xa1, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9)] +interface IPrintDialogServices(IPrintDialogServicesVtbl): IUnknown(IUnknownVtbl) { + fn GetCurrentDevMode( + pDevMode: LPDEVMODEW, + pcbSize: *mut UINT, + ) -> HRESULT, + fn GetCurrentPrinterName( + pPrinterName: LPWSTR, + pcchSize: *mut UINT, + ) -> HRESULT, + fn GetCurrentPortName( + pPortName: LPWSTR, + pcchSize: *mut UINT, + ) -> HRESULT, +} +); +STRUCT!{struct PRINTPAGERANGE { + nFromPage: DWORD, + nToPage: DWORD, +}} +pub type LPPRINTPAGERANGE = *mut PRINTPAGERANGE; +pub type PCPRINTPAGERANGE = *const PRINTPAGERANGE; +STRUCT!{struct PRINTDLGEXA { + lStructSize: DWORD, + hwndOwner: HWND, + hDevMode: HGLOBAL, + hDevNames: HGLOBAL, + hDC: HDC, + Flags: DWORD, + Flags2: DWORD, + ExclusionFlags: DWORD, + nPageRanges: DWORD, + nMaxPageRanges: DWORD, + lpPageRanges: LPPRINTPAGERANGE, + nMinPage: DWORD, + nMaxPage: DWORD, + nCopies: DWORD, + hInstance: HINSTANCE, + lpPrintTemplateName: LPCSTR, + lpCallback: LPUNKNOWN, + nPropertyPages: DWORD, + lphPropertyPages: *mut HPROPSHEETPAGE, + nStartPage: DWORD, + dwResultAction: DWORD, +}} +pub type LPPRINTDLGEXA = *mut PRINTDLGEXA; +STRUCT!{struct PRINTDLGEXW { + lStructSize: DWORD, + hwndOwner: HWND, + hDevMode: HGLOBAL, + hDevNames: HGLOBAL, + hDC: HDC, + Flags: DWORD, + Flags2: DWORD, + ExclusionFlags: DWORD, + nPageRanges: DWORD, + nMaxPageRanges: DWORD, + lpPageRanges: LPPRINTPAGERANGE, + nMinPage: DWORD, + nMaxPage: DWORD, + nCopies: DWORD, + hInstance: HINSTANCE, + lpPrintTemplateName: LPCWSTR, + lpCallback: LPUNKNOWN, + nPropertyPages: DWORD, + lphPropertyPages: *mut HPROPSHEETPAGE, + nStartPage: DWORD, + dwResultAction: DWORD, +}} +pub type LPPRINTDLGEXW = *mut PRINTDLGEXW; +extern "system" { + pub fn PrintDlgExA( + pPD: LPPRINTDLGEXA, + ) -> HRESULT; + pub fn PrintDlgExW( + pPD: LPPRINTDLGEXW, + ) -> HRESULT; +} +pub const PD_ALLPAGES: DWORD = 0x00000000; +pub const PD_SELECTION: DWORD = 0x00000001; +pub const PD_PAGENUMS: DWORD = 0x00000002; +pub const PD_NOSELECTION: DWORD = 0x00000004; +pub const PD_NOPAGENUMS: DWORD = 0x00000008; +pub const PD_COLLATE: DWORD = 0x00000010; +pub const PD_PRINTTOFILE: DWORD = 0x00000020; +pub const PD_PRINTSETUP: DWORD = 0x00000040; +pub const PD_NOWARNING: DWORD = 0x00000080; +pub const PD_RETURNDC: DWORD = 0x00000100; +pub const PD_RETURNIC: DWORD = 0x00000200; +pub const PD_RETURNDEFAULT: DWORD = 0x00000400; +pub const PD_SHOWHELP: DWORD = 0x00000800; +pub const PD_ENABLEPRINTHOOK: DWORD = 0x00001000; +pub const PD_ENABLESETUPHOOK: DWORD = 0x00002000; +pub const PD_ENABLEPRINTTEMPLATE: DWORD = 0x00004000; +pub const PD_ENABLESETUPTEMPLATE: DWORD = 0x00008000; +pub const PD_ENABLEPRINTTEMPLATEHANDLE: DWORD = 0x00010000; +pub const PD_ENABLESETUPTEMPLATEHANDLE: DWORD = 0x00020000; +pub const PD_USEDEVMODECOPIES: DWORD = 0x00040000; +pub const PD_USEDEVMODECOPIESANDCOLLATE: DWORD = 0x00040000; +pub const PD_DISABLEPRINTTOFILE: DWORD = 0x00080000; +pub const PD_HIDEPRINTTOFILE: DWORD = 0x00100000; +pub const PD_NONETWORKBUTTON: DWORD = 0x00200000; +pub const PD_CURRENTPAGE: DWORD = 0x00400000; +pub const PD_NOCURRENTPAGE: DWORD = 0x00800000; +pub const PD_EXCLUSIONFLAGS: DWORD = 0x01000000; +pub const PD_USELARGETEMPLATE: DWORD = 0x10000000; +pub const PD_EXCL_COPIESANDCOLLATE: DWORD = DM_COPIES | DM_COLLATE; +pub const START_PAGE_GENERAL: DWORD = 0xffffffff; +pub const PD_RESULT_CANCEL: DWORD = 0; +pub const PD_RESULT_PRINT: DWORD = 1; +pub const PD_RESULT_APPLY: DWORD = 2; +STRUCT!{struct DEVNAMES { + wDriverOffset: WORD, + wDeviceOffset: WORD, + wOutputOffset: WORD, + wDefault: WORD, +}} +pub type LPDEVNAMES = *mut DEVNAMES; +pub type PCDEVNAMES = *const DEVNAMES; +pub const DN_DEFAULTPRN: WORD = 0x0001; +extern "system" { + pub fn CommDlgExtendedError() -> DWORD; +} +pub const WM_PSD_PAGESETUPDLG: UINT = WM_USER; +pub const WM_PSD_FULLPAGERECT: UINT = WM_USER + 1; +pub const WM_PSD_MINMARGINRECT: UINT = WM_USER + 2; +pub const WM_PSD_MARGINRECT: UINT = WM_USER + 3; +pub const WM_PSD_GREEKTEXTRECT: UINT = WM_USER + 4; +pub const WM_PSD_ENVSTAMPRECT: UINT = WM_USER + 5; +pub const WM_PSD_YAFULLPAGERECT: UINT = WM_USER + 6; +FN!{stdcall LPPAGEPAINTHOOK( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +FN!{stdcall LPPAGESETUPHOOK( + HWND, + UINT, + WPARAM, + LPARAM, +) -> UINT_PTR} +STRUCT!{struct PAGESETUPDLGA { + lStructSize: DWORD, + hwndOwner: HWND, + hDevMode: HGLOBAL, + hDevNames: HGLOBAL, + Flags: DWORD, + ptPaperSize: POINT, + rtMinMargin: RECT, + rtMargin: RECT, + hInstance: HINSTANCE, + lCustData: LPARAM, + lpfnPageSetupHook: LPPAGESETUPHOOK, + lpfnPagePaintHook: LPPAGEPAINTHOOK, + lpPageSetupTemplateName: LPCSTR, + hPageSetupTemplate: HGLOBAL, +}} +pub type LPPAGESETUPDLGA = *mut PAGESETUPDLGA; +STRUCT!{struct PAGESETUPDLGW { + lStructSize: DWORD, + hwndOwner: HWND, + hDevMode: HGLOBAL, + hDevNames: HGLOBAL, + Flags: DWORD, + ptPaperSize: POINT, + rtMinMargin: RECT, + rtMargin: RECT, + hInstance: HINSTANCE, + lCustData: LPARAM, + lpfnPageSetupHook: LPPAGESETUPHOOK, + lpfnPagePaintHook: LPPAGEPAINTHOOK, + lpPageSetupTemplateName: LPCWSTR, + hPageSetupTemplate: HGLOBAL, +}} +pub type LPPAGESETUPDLGW = *mut PAGESETUPDLGW; +extern "system" { + pub fn PageSetupDlgA( + lppsd: LPPAGESETUPDLGA, + ) -> BOOL; + pub fn PageSetupDlgW( + lppsd: LPPAGESETUPDLGW, + ) -> BOOL; +} +pub const PSD_DEFAULTMINMARGINS: DWORD = 0x00000000; +pub const PSD_INWININIINTLMEASURE: DWORD = 0x00000000; +pub const PSD_MINMARGINS: DWORD = 0x00000001; +pub const PSD_MARGINS: DWORD = 0x00000002; +pub const PSD_INTHOUSANDTHSOFINCHES: DWORD = 0x00000004; +pub const PSD_INHUNDREDTHSOFMILLIMETERS: DWORD = 0x00000008; +pub const PSD_DISABLEMARGINS: DWORD = 0x00000010; +pub const PSD_DISABLEPRINTER: DWORD = 0x00000020; +pub const PSD_NOWARNING: DWORD = 0x00000080; +pub const PSD_DISABLEORIENTATION: DWORD = 0x00000100; +pub const PSD_RETURNDEFAULT: DWORD = 0x00000400; +pub const PSD_DISABLEPAPER: DWORD = 0x00000200; +pub const PSD_SHOWHELP: DWORD = 0x00000800; +pub const PSD_ENABLEPAGESETUPHOOK: DWORD = 0x00002000; +pub const PSD_ENABLEPAGESETUPTEMPLATE: DWORD = 0x00008000; +pub const PSD_ENABLEPAGESETUPTEMPLATEHANDLE: DWORD = 0x00020000; +pub const PSD_ENABLEPAGEPAINTHOOK: DWORD = 0x00040000; +pub const PSD_DISABLEPAGEPAINTING: DWORD = 0x00080000; +pub const PSD_NONETWORKBUTTON: DWORD = 0x00200000; diff --git a/src/vendor/winapi/src/um/commoncontrols.rs b/src/vendor/winapi/src/um/commoncontrols.rs new file mode 100644 index 0000000000..1c01df2f48 --- /dev/null +++ b/src/vendor/winapi/src/um/commoncontrols.rs @@ -0,0 +1,233 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_int, c_void}; +use shared::guiddef::{REFCLSID, REFIID}; +use shared::minwindef::{BOOL, DWORD, LRESULT, UINT}; +use shared::windef::{COLORREF, HBITMAP, HICON, HWND, POINT, RECT}; +use um::commctrl::{IMAGEINFO, IMAGELISTDRAWPARAMS}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::HRESULT; +extern "system" { + pub fn ImageList_CoCreateInstance( + rclsid: REFCLSID, + punkOuter: *const IUnknown, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT; +} +pub const ILIF_ALPHA: DWORD = 0x00000001; +pub const ILIF_LOWQUALITY: DWORD = 0x00000001; +pub const ILDRF_IMAGELOWQUALITY: LRESULT = 0x00000001; +pub const ILDRF_OVERLAYLOWQUALITY: LRESULT = 0x00000010; +RIDL!{#[uuid(0x46eb5926, 0x582e, 0x4017, 0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x09, 0x50)] +interface IImageList(IImageListVtbl): IUnknown(IUnknownVtbl) { + fn Add( + hbmImage: HBITMAP, + hbmMask: HBITMAP, + pi: *mut c_int, + ) -> HRESULT, + fn ReplaceIcon( + hicon: HICON, + pi: *mut c_int, + ) -> HRESULT, + fn SetOverlayImage( + iImage: c_int, + iOverlay: c_int, + ) -> HRESULT, + fn Replace( + hbmImage: HBITMAP, + hbmMask: HBITMAP, + ) -> HRESULT, + fn AddMasked( + hbmImage: HBITMAP, + crMask: COLORREF, + pi: *mut c_int, + ) -> HRESULT, + fn Draw( + pimldp: *mut IMAGELISTDRAWPARAMS, + ) -> HRESULT, + fn Remove( + i: c_int, + ) -> HRESULT, + fn GetIcon( + i: c_int, + flags: UINT, + picon: *mut HICON, + ) -> HRESULT, + fn GetImageInfo( + i: c_int, + pImageInfo: *mut IMAGEINFO, + ) -> HRESULT, + fn Copy( + iDst: c_int, + punkSrc: *mut IUnknown, + iSrc: c_int, + uFlags: UINT, + ) -> HRESULT, + fn Merge( + i1: c_int, + punk2: *mut IUnknown, + i2: c_int, + dx: c_int, + dy: c_int, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn Clone( + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn GetImageRect( + i: c_int, + prc: *mut RECT, + ) -> HRESULT, + fn GetIconSize( + cx: *mut c_int, + cy: *mut c_int, + ) -> HRESULT, + fn SetIconSize( + cx: c_int, + cy: c_int, + ) -> HRESULT, + fn GetImageCount( + pi: *mut c_int, + ) -> HRESULT, + fn SetImageCount( + uNewCount: UINT, + ) -> HRESULT, + fn SetBkColor( + clrBk: COLORREF, + pclr: *mut COLORREF, + ) -> HRESULT, + fn GetBkColor( + pclr: *mut COLORREF, + ) -> HRESULT, + fn BeginDrag( + iTrack: c_int, + dxHotspot: c_int, + dyHotspot: c_int, + ) -> HRESULT, + fn EndDrag() -> HRESULT, + fn DragEnter( + hwndLock: HWND, + x: c_int, + y: c_int, + ) -> HRESULT, + fn DragLeave( + hwndLock: HWND, + ) -> HRESULT, + fn DragMove( + x: c_int, + y: c_int, + ) -> HRESULT, + fn SetDragCursorImage( + punk: *mut IUnknown, + iDrag: c_int, + dxHotspot: c_int, + dyHotspot: c_int, + ) -> HRESULT, + fn DragShowNolock( + fShow: BOOL, + ) -> HRESULT, + fn GetDragImage( + ppt: *mut POINT, + pptHotspot: *mut POINT, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn GetItemFlags( + dwFlags: *mut DWORD, + ) -> HRESULT, + fn GetOverlayImage( + iOverlay: c_int, + piIndex: *mut c_int, + ) -> HRESULT, +}} +pub const ILR_DEFAULT: DWORD = 0x0000; +pub const ILR_HORIZONTAL_LEFT: DWORD = 0x0000; +pub const ILR_HORIZONTAL_CENTER: DWORD = 0x0001; +pub const ILR_HORIZONTAL_RIGHT: DWORD = 0x0002; +pub const ILR_VERTICAL_TOP: DWORD = 0x0000; +pub const ILR_VERTICAL_CENTER: DWORD = 0x0010; +pub const ILR_VERTICAL_BOTTOM: DWORD = 0x0020; +pub const ILR_SCALE_CLIP: DWORD = 0x0000; +pub const ILR_SCALE_ASPECTRATIO: DWORD = 0x0100; +pub const ILGOS_ALWAYS: DWORD = 0x00000000; +pub const ILGOS_FROMSTANDBY: DWORD = 0x00000001; +pub const ILFIP_ALWAYS: DWORD = 0x00000000; +pub const ILFIP_FROMSTANDBY: DWORD = 0x00000001; +pub const ILDI_PURGE: DWORD = 0x00000001; +pub const ILDI_STANDBY: DWORD = 0x00000002; +pub const ILDI_RESETACCESS: DWORD = 0x00000004; +pub const ILDI_QUERYACCESS: DWORD = 0x00000008; +STRUCT!{struct IMAGELISTSTATS { + cbSize: DWORD, + cAlloc: c_int, + cUsed: c_int, + cStandby: c_int, +}} +RIDL!{#[uuid(0x192b9d83, 0x58fc, 0x457b, 0x90, 0xa0, 0x2b, 0x82, 0xa8, 0xb5, 0xda, 0xe1)] +interface IImageList2(IImageList2Vtbl): IImageList(IImageListVtbl) { + fn Resize( + cxNewIconSize: c_int, + cyNewIconSize: c_int, + ) -> HRESULT, + fn GetOriginalSize( + iImage: c_int, + dwFlags: DWORD, + pcx: *mut c_int, + pcy: *mut c_int, + ) -> HRESULT, + fn SetOriginalSize( + iImage: c_int, + cx: c_int, + cy: c_int, + ) -> HRESULT, + fn SetCallback( + punk: *mut IUnknown, + ) -> HRESULT, + fn GetCallback( + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn ForceImagePresent( + iImage: c_int, + dwFlags: DWORD, + ) -> HRESULT, + fn DiscardImages( + iFirstImage: c_int, + iLastImage: c_int, + dwFlags: DWORD, + ) -> HRESULT, + fn PreloadImages( + pimldp: *mut IMAGELISTDRAWPARAMS, + ) -> HRESULT, + fn GetStatistics( + pils: *mut IMAGELISTSTATS, + ) -> HRESULT, + fn Initialize( + cx: c_int, + cy: c_int, + flags: UINT, + cInitial: c_int, + cGrow: c_int, + ) -> HRESULT, + fn Replace2( + i: c_int, + hbmImage: HBITMAP, + hbmMask: HBITMAP, + punk: *mut IUnknown, + dwFlags: DWORD, + ) -> HRESULT, + fn ReplaceFromImageList( + i: c_int, + pil: *mut IImageList, + iSrc: c_int, + punk: *mut IUnknown, + dwFlags: DWORD, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/consoleapi.rs b/src/vendor/winapi/src/um/consoleapi.rs new file mode 100644 index 0000000000..273cfbf919 --- /dev/null +++ b/src/vendor/winapi/src/um/consoleapi.rs @@ -0,0 +1,77 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-console-l1 +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID, UINT}; +use um::wincon::{PCONSOLE_READCONSOLE_CONTROL, PHANDLER_ROUTINE, PINPUT_RECORD}; +use um::winnt::{HANDLE, VOID}; +extern "system" { + pub fn AllocConsole() -> BOOL; + pub fn GetConsoleCP() -> UINT; + pub fn GetConsoleMode( + hConsoleHandle: HANDLE, + lpMode: LPDWORD, + ) -> BOOL; + pub fn GetConsoleOutputCP() -> UINT; + pub fn GetNumberOfConsoleInputEvents( + hConsoleInput: HANDLE, + lpNumberOfEvents: LPDWORD, + ) -> BOOL; + pub fn PeekConsoleInputA( + hConsoleInput: HANDLE, + lpBuffer: PINPUT_RECORD, + nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleA( + hConsoleInput: HANDLE, + lpBuffer: LPVOID, + nNumberOfCharsToRead: DWORD, + lpNumberOfCharsRead: LPDWORD, + pInputControl: PCONSOLE_READCONSOLE_CONTROL, + ) -> BOOL; + pub fn ReadConsoleW( + hConsoleInput: HANDLE, + lpBuffer: LPVOID, + nNumberOfCharsToRead: DWORD, + lpNumberOfCharsRead: LPDWORD, + pInputControl: PCONSOLE_READCONSOLE_CONTROL, + ) -> BOOL; + pub fn ReadConsoleInputA( + hConsoleInput: HANDLE, + lpBuffer: PINPUT_RECORD, + nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleInputW( + hConsoleInput: HANDLE, + lpBuffer: PINPUT_RECORD, + nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn SetConsoleCtrlHandler( + HandlerRoutine: PHANDLER_ROUTINE, + Add: BOOL, + ) -> BOOL; + pub fn SetConsoleMode( + hConsoleHandle: HANDLE, + dwMode: DWORD, + ) -> BOOL; + pub fn WriteConsoleA( + hConsoleOutput: HANDLE, + lpBuffer: *const VOID, + nNumberOfCharsToWrite: DWORD, + lpNumberOfCharsWritten: LPDWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn WriteConsoleW( + hConsoleOutput: HANDLE, + lpBuffer: *const VOID, + nNumberOfCharsToWrite: DWORD, + lpNumberOfCharsWritten: LPDWORD, + lpReserved: LPVOID, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/corsym.rs b/src/vendor/winapi/src/um/corsym.rs new file mode 100644 index 0000000000..4f1aebf0ea --- /dev/null +++ b/src/vendor/winapi/src/um/corsym.rs @@ -0,0 +1,92 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! Common Language Runtime Debugging Symbol Reader/Writer/Binder Interfaces +use shared::basetsd::ULONG32; +use um::objidlbase::IStream; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, WCHAR}; +DEFINE_GUID!{CorSym_LanguageType_C, + 0x63a08714, 0xfc37, 0x11d2, 0x90, 0x4c, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1} +DEFINE_GUID!{CorSym_LanguageType_CPlusPlus, + 0x3a12d0b7, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2} +DEFINE_GUID!{CorSym_LanguageType_CSharp, + 0x3f5162f8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1} +DEFINE_GUID!{CorSym_LanguageType_Basic, + 0x3a12d0b8, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2} +DEFINE_GUID!{CorSym_LanguageType_Java, + 0x3a12d0b4, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2} +DEFINE_GUID!{CorSym_LanguageType_Cobol, + 0xaf046cd1, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc} +DEFINE_GUID!{CorSym_LanguageType_Pascal, + 0xaf046cd2, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc} +DEFINE_GUID!{CorSym_LanguageType_ILAssembly, + 0xaf046cd3, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc} +DEFINE_GUID!{CorSym_LanguageType_JScript, + 0x3a12d0b6, 0xc26c, 0x11d0, 0xb4, 0x42, 0x00, 0xa0, 0x24, 0x4a, 0x1d, 0xd2} +DEFINE_GUID!{CorSym_LanguageType_SMC, + 0xd9b9f7b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd} +DEFINE_GUID!{CorSym_LanguageType_MCPlusPlus, + 0x4b35fde8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1} +DEFINE_GUID!{CorSym_LanguageVendor_Microsoft, + 0x994b45c4, 0xe6e9, 0x11d2, 0x90, 0x3f, 0x00, 0xc0, 0x4f, 0xa3, 0x02, 0xa1} +DEFINE_GUID!{CorSym_DocumentType_Text, + 0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd} +DEFINE_GUID!{CorSym_DocumentType_MC, + 0xeb40cb65, 0x3c1f, 0x4352, 0x9d, 0x7b, 0xba, 0xf, 0xc4, 0x7a, 0x9d, 0x77} +DEFINE_GUID!{CorSym_SourceHash_MD5, + 0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99} +DEFINE_GUID!{CorSym_SourceHash_SHA1, + 0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60} +ENUM!{enum CorSymAddrKind { + ADDR_IL_OFFSET = 1, + ADDR_NATIVE_RVA = 2, + ADDR_NATIVE_REGISTER = 3, + ADDR_NATIVE_REGREL = 4, + ADDR_NATIVE_OFFSET = 5, + ADDR_NATIVE_REGREG = 6, + ADDR_NATIVE_REGSTK = 7, + ADDR_NATIVE_STKREG = 8, + ADDR_BITFIELD = 9, + ADDR_NATIVE_ISECTOFFSET = 10, +}} +ENUM!{enum CorSymVarFlag { + VAR_IS_COMP_GEN = 1, +}} +RIDL!(#[uuid(0xaa544d42, 0x28cb, 0x11d3, 0xbd, 0x22, 0x00, 0x00, 0xf8, 0x08, 0x49, 0xbd)] +interface ISymUnmanagedBinder(ISymUnmanagedBinderVtbl): IUnknown(IUnknownVtbl) { + fn GetReaderForFile( + importer: *mut IUnknown, + fileName: *const WCHAR, + searchPath: *const WCHAR, + pRetVal: *mut *mut ISymUnmanagedReader, + ) -> HRESULT, + fn GetReaderFromStream( + importer: *mut IUnknown, + pstream: *mut IStream, + pRetVal: *mut *mut ISymUnmanagedReader, + ) -> HRESULT, +} +); +ENUM!{enum CorSymSearchPolicyAttributes { + AllowRegistryAccess = 0x1, + AllowSymbolServerAccess = 0x2, + AllowOriginalPathAccess = 0x4, + AllowReferencePathAccess = 0x8, +}} +RIDL!(#[uuid(0xaccee350, 0x89af, 0x4ccb, 0x8b, 0x40, 0x1c, 0x2c, 0x4c, 0x6f, 0x94, 0x34)] +interface ISymUnmanagedBinder2(ISymUnmanagedBinder2Vtbl): + ISymUnmanagedBinder(ISymUnmanagedBinderVtbl) { + fn GetReaderForFile2( + importer: *mut IUnknown, + fileName: *const WCHAR, + searchPath: *const WCHAR, + searchPolicy: ULONG32, + pRetVal: *mut *mut ISymUnmanagedReader, + ) -> HRESULT, +} +); +pub enum ISymUnmanagedReader {} // TODO diff --git a/src/vendor/winapi/src/um/d2d1.rs b/src/vendor/winapi/src/um/d2d1.rs new file mode 100644 index 0000000000..c1c797dbeb --- /dev/null +++ b/src/vendor/winapi/src/um/d2d1.rs @@ -0,0 +1,984 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! Mappings for the contents of d2d1.h +use ctypes::c_void; +use shared::basetsd::{UINT32, UINT64}; +use shared::dxgi::IDXGISurface; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, DWORD, FLOAT}; +use shared::windef::{HDC, HWND, RECT}; +use um::d2dbasetypes::{ + D2D_COLOR_F, D2D_MATRIX_3X2_F, D2D_POINT_2F, D2D_POINT_2U, D2D_RECT_F, D2D_RECT_U, D2D_SIZE_F, + D2D_SIZE_U, +}; +use um::d3dcommon::{D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_1}; +use um::dcommon::{D2D1_PIXEL_FORMAT, DWRITE_MEASURING_MODE}; +use um::dwrite::{DWRITE_GLYPH_RUN, IDWriteRenderingParams, IDWriteTextFormat, IDWriteTextLayout}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::wincodec::{IWICBitmap, IWICBitmapSource}; +use um::winnt::{HRESULT, WCHAR}; +// Types confirmed affected by the ABI issue: +// D2D1_SIZE_F, D2D1_SIZE_U, D2D1_COLOR_F, D2D1_PIXEL_FORMAT, D2D1_POINT_2F +pub const D2D1_DEFAULT_FLATTENING_TOLERANCE: FLOAT = 0.25; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR: DWORD = 0; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR: DWORD = 1; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC: DWORD = 2; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR: DWORD = 3; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC: DWORD = 4; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC: DWORD = 5; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_FANT: DWORD = 6; +pub const D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR: DWORD = 7; +ENUM!{enum D2D1_GAMMA { + D2D1_GAMMA_2_2 = 0, + D2D1_GAMMA_1_0 = 1, +}} +ENUM!{enum D2D1_OPACITY_MASK_CONTENT { + D2D1_OPACITY_MASK_CONTENT_GRAPHICS = 0, + D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL = 1, + D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE = 2, +}} +ENUM!{enum D2D1_EXTEND_MODE { + D2D1_EXTEND_MODE_CLAMP = 0, + D2D1_EXTEND_MODE_WRAP = 1, + D2D1_EXTEND_MODE_MIRROR = 2, +}} +ENUM!{enum D2D1_ANTIALIAS_MODE { + D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0, + D2D1_ANTIALIAS_MODE_ALIASED = 1, +}} +ENUM!{enum D2D1_TEXT_ANTIALIAS_MODE { + D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0, + D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1, + D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2, + D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3, +}} +ENUM!{enum D2D1_BITMAP_INTERPOLATION_MODE { + D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = + D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, + D2D1_BITMAP_INTERPOLATION_MODE_LINEAR = + D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, +}} +ENUM!{enum D2D1_DRAW_TEXT_OPTIONS { + D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001, + D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002, + D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004, + D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000, +}} +pub type D2D1_POINT_2U = D2D_POINT_2U; +pub type D2D1_POINT_2F = D2D_POINT_2F; +pub type D2D1_RECT_F = D2D_RECT_F; +pub type D2D1_RECT_U = D2D_RECT_U; +pub type D2D1_SIZE_F = D2D_SIZE_F; +pub type D2D1_SIZE_U = D2D_SIZE_U; +pub type D2D1_COLOR_F = D2D_COLOR_F; +pub type D2D1_MATRIX_3X2_F = D2D_MATRIX_3X2_F; +pub type D2D1_TAG = UINT64; +STRUCT!{struct D2D1_BITMAP_PROPERTIES { + pixelFormat: D2D1_PIXEL_FORMAT, + dpiX: FLOAT, + dpiY: FLOAT, +}} +STRUCT!{struct D2D1_GRADIENT_STOP { + position: FLOAT, + color: D2D1_COLOR_F, +}} +STRUCT!{struct D2D1_BRUSH_PROPERTIES { + opacity: FLOAT, + transform: D2D1_MATRIX_3X2_F, +}} +STRUCT!{struct D2D1_BITMAP_BRUSH_PROPERTIES { + extendModeX: D2D1_EXTEND_MODE, + extendModeY: D2D1_EXTEND_MODE, + interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE, +}} +STRUCT!{struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES { + startPoint: D2D1_POINT_2F, + endPoint: D2D1_POINT_2F, +}} +STRUCT!{struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES { + center: D2D1_POINT_2F, + gradientOriginOffset: D2D1_POINT_2F, + radiusX: FLOAT, + radiusY: FLOAT, +}} +ENUM!{enum D2D1_ARC_SIZE { + D2D1_ARC_SIZE_SMALL = 0, + D2D1_ARC_SIZE_LARGE = 1, +}} +ENUM!{enum D2D1_CAP_STYLE { + D2D1_CAP_STYLE_FLAT = 0, + D2D1_CAP_STYLE_SQUARE = 1, + D2D1_CAP_STYLE_ROUND = 2, + D2D1_CAP_STYLE_TRIANGLE = 3, +}} +ENUM!{enum D2D1_DASH_STYLE { + D2D1_DASH_STYLE_SOLID = 0, + D2D1_DASH_STYLE_DASH = 1, + D2D1_DASH_STYLE_DOT = 2, + D2D1_DASH_STYLE_DASH_DOT = 3, + D2D1_DASH_STYLE_DASH_DOT_DOT = 4, + D2D1_DASH_STYLE_CUSTOM = 5, +}} +ENUM!{enum D2D1_LINE_JOIN { + D2D1_LINE_JOIN_MITER = 0, + D2D1_LINE_JOIN_BEVEL = 1, + D2D1_LINE_JOIN_ROUND = 2, + D2D1_LINE_JOIN_MITER_OR_BEVEL = 3, +}} +ENUM!{enum D2D1_COMBINE_MODE { + D2D1_COMBINE_MODE_UNION = 0, + D2D1_COMBINE_MODE_INTERSECT = 1, + D2D1_COMBINE_MODE_XOR = 2, + D2D1_COMBINE_MODE_EXCLUDE = 3, +}} +ENUM!{enum D2D1_GEOMETRY_RELATION { + D2D1_GEOMETRY_RELATION_UNKNOWN = 0, + D2D1_GEOMETRY_RELATION_DISJOINT = 1, + D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2, + D2D1_GEOMETRY_RELATION_CONTAINS = 3, + D2D1_GEOMETRY_RELATION_OVERLAP = 4, +}} +ENUM!{enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION { + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0, + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1, +}} +ENUM!{enum D2D1_FIGURE_BEGIN { + D2D1_FIGURE_BEGIN_FILLED = 0, + D2D1_FIGURE_BEGIN_HOLLOW = 1, +}} +ENUM!{enum D2D1_FIGURE_END { + D2D1_FIGURE_END_OPEN = 0, + D2D1_FIGURE_END_CLOSED = 1, +}} +STRUCT!{struct D2D1_BEZIER_SEGMENT { + point1: D2D1_POINT_2F, + point2: D2D1_POINT_2F, + point3: D2D1_POINT_2F, +}} +STRUCT!{struct D2D1_TRIANGLE { + point1: D2D1_POINT_2F, + point2: D2D1_POINT_2F, + point3: D2D1_POINT_2F, +}} +ENUM!{enum D2D1_PATH_SEGMENT { + D2D1_PATH_SEGMENT_NONE = 0x00000000, + D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001, + D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002, +}} +ENUM!{enum D2D1_SWEEP_DIRECTION { + D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0, + D2D1_SWEEP_DIRECTION_CLOCKWISE = 1, +}} +ENUM!{enum D2D1_FILL_MODE { + D2D1_FILL_MODE_ALTERNATE = 0, + D2D1_FILL_MODE_WINDING = 1, +}} +STRUCT!{struct D2D1_ARC_SEGMENT { + point: D2D1_POINT_2F, + size: D2D1_SIZE_F, + rotationAngle: FLOAT, + sweepDirection: D2D1_SWEEP_DIRECTION, + arcSize: D2D1_ARC_SIZE, +}} +STRUCT!{struct D2D1_QUADRATIC_BEZIER_SEGMENT { + point1: D2D1_POINT_2F, + point2: D2D1_POINT_2F, +}} +STRUCT!{struct D2D1_ELLIPSE { + point: D2D1_POINT_2F, + radiusX: FLOAT, + radiusY: FLOAT, +}} +STRUCT!{struct D2D1_ROUNDED_RECT { + rect: D2D1_RECT_F, + radiusX: FLOAT, + radiusY: FLOAT, +}} +STRUCT!{struct D2D1_STROKE_STYLE_PROPERTIES { + startCap: D2D1_CAP_STYLE, + endCap: D2D1_CAP_STYLE, + dashCap: D2D1_CAP_STYLE, + lineJoin: D2D1_LINE_JOIN, + miterLimit: FLOAT, + dashStyle: D2D1_DASH_STYLE, + dashOffset: FLOAT, +}} +ENUM!{enum D2D1_LAYER_OPTIONS { + D2D1_LAYER_OPTIONS_NONE = 0x00000000, + D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001, +}} +STRUCT!{struct D2D1_LAYER_PARAMETERS { + contentBounds: D2D1_RECT_F, + geometricMask: *mut ID2D1Geometry, + maskAntialiasMode: D2D1_ANTIALIAS_MODE, + maskTransform: D2D1_MATRIX_3X2_F, + opacity: FLOAT, + opacityBrush: *mut ID2D1Brush, + layerOptions: D2D1_LAYER_OPTIONS, +}} +ENUM!{enum D2D1_WINDOW_STATE { + D2D1_WINDOW_STATE_NONE = 0x0000000, + D2D1_WINDOW_STATE_OCCLUDED = 0x0000001, +}} +ENUM!{enum D2D1_RENDER_TARGET_TYPE { + D2D1_RENDER_TARGET_TYPE_DEFAULT = 0, + D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1, + D2D1_RENDER_TARGET_TYPE_HARDWARE = 2, +}} +ENUM!{enum D2D1_FEATURE_LEVEL { + D2D1_FEATURE_LEVEL_DEFAULT = 0, + D2D1_FEATURE_LEVEL_9 = D3D_FEATURE_LEVEL_9_1, + D2D1_FEATURE_LEVEL_10 = D3D_FEATURE_LEVEL_10_0, +}} +ENUM!{enum D2D1_RENDER_TARGET_USAGE { + D2D1_RENDER_TARGET_USAGE_NONE = 0x00000000, + D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 0x00000001, + D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 0x00000002, +}} +ENUM!{enum D2D1_PRESENT_OPTIONS { + D2D1_PRESENT_OPTIONS_NONE = 0x00000000, + D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS = 0x00000001, + D2D1_PRESENT_OPTIONS_IMMEDIATELY = 0x00000002, +}} +STRUCT!{struct D2D1_RENDER_TARGET_PROPERTIES { + _type: D2D1_RENDER_TARGET_TYPE, + pixelFormat: D2D1_PIXEL_FORMAT, + dpiX: FLOAT, + dpiY: FLOAT, + usage: D2D1_RENDER_TARGET_USAGE, + minLevel: D2D1_FEATURE_LEVEL, +}} +STRUCT!{struct D2D1_HWND_RENDER_TARGET_PROPERTIES { + hwnd: HWND, + pixelSize: D2D1_SIZE_U, + presentOptions: D2D1_PRESENT_OPTIONS, +}} +ENUM!{enum D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS { + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001, +}} +STRUCT!{struct D2D1_DRAWING_STATE_DESCRIPTION { + antialiasMode: D2D1_ANTIALIAS_MODE, + textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE, + tag1: D2D1_TAG, + tag2: D2D1_TAG, + transform: D2D1_MATRIX_3X2_F, +}} +ENUM!{enum D2D1_DC_INITIALIZE_MODE { + D2D1_DC_INITIALIZE_MODE_COPY = 0, + D2D1_DC_INITIALIZE_MODE_CLEAR = 1, +}} +ENUM!{enum D2D1_DEBUG_LEVEL { + D2D1_DEBUG_LEVEL_NONE = 0, + D2D1_DEBUG_LEVEL_ERROR = 1, + D2D1_DEBUG_LEVEL_WARNING = 2, + D2D1_DEBUG_LEVEL_INFORMATION = 3, +}} +ENUM!{enum D2D1_FACTORY_TYPE { + D2D1_FACTORY_TYPE_SINGLE_THREADED = 0, + D2D1_FACTORY_TYPE_MULTI_THREADED = 1, +}} +STRUCT!{struct D2D1_FACTORY_OPTIONS { + debugLevel: D2D1_DEBUG_LEVEL, +}} +RIDL!{#[uuid(0x2cd90691, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1Resource(ID2D1ResourceVtbl): IUnknown(IUnknownVtbl) { + fn GetFactory( + factory: *mut *mut ID2D1Factory, + ) -> (), +}} +RIDL!{#[uuid(0x65019f75, 0x8da2, 0x497c, 0xb3, 0x2c, 0xdf, 0xa3, 0x4e, 0x48, 0xed, 0xe6)] +interface ID2D1Image(ID2D1ImageVtbl): ID2D1Resource(ID2D1ResourceVtbl) { +}} +RIDL!{#[uuid(0xa2296057, 0xea42, 0x4099, 0x98, 0x3b, 0x53, 0x9f, 0xb6, 0x50, 0x54, 0x26)] +interface ID2D1Bitmap(ID2D1BitmapVtbl): ID2D1Image(ID2D1ImageVtbl) { + #[fixme] fn GetSize() -> D2D1_SIZE_F, + #[fixme] fn GetPixelSize() -> D2D1_SIZE_U, + #[fixme] fn GetPixelFormat() -> D2D1_PIXEL_FORMAT, + fn GetDpi( + dpiX: *mut FLOAT, + dpiY: *mut FLOAT, + ) -> (), + fn CopyFromBitmap( + destPoint: *const D2D1_POINT_2U, + bitmap: *mut ID2D1Bitmap, + srcRect: *const D2D1_RECT_U, + ) -> HRESULT, + fn CopyFromRenderTarget( + destPoint: *const D2D1_POINT_2U, + renderTarget: *mut ID2D1RenderTarget, + srcRect: *const D2D1_RECT_U, + ) -> HRESULT, + fn CopyFromMemory( + dstRect: *const D2D1_RECT_U, + srcData: *const c_void, + pitch: UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x2cd906a7, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1GradientStopCollection(ID2D1GradientStopCollectionVtbl): + ID2D1Resource(ID2D1ResourceVtbl) { + fn GetGradientStopCount() -> UINT32, + fn GetGradientStops( + gradientStops: *mut D2D1_GRADIENT_STOP, + gradientStopsCount: UINT32, + ) -> (), + fn GetColorInterpolationGamma() -> D2D1_GAMMA, + fn GetExtendMode() -> D2D1_EXTEND_MODE, +}} +RIDL!{#[uuid(0x2cd906a8, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1Brush(ID2D1BrushVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn SetOpacity( + opacity: FLOAT, + ) -> (), + fn SetTransform( + transform: *const D2D1_MATRIX_3X2_F, + ) -> (), + fn GetOpacity() -> FLOAT, + fn GetTransform( + transform: *mut D2D1_MATRIX_3X2_F, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906aa, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1BitmapBrush(ID2D1BitmapBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetExtendModeX( + extendModeX: D2D1_EXTEND_MODE, + ) -> (), + fn SetExtendModeY( + extendModeY: D2D1_EXTEND_MODE, + ) -> (), + fn SetInterpolationMode( + interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE, + ) -> (), + fn SetBitmap( + bitmap: *mut ID2D1Bitmap, + ) -> (), + fn GetExtendModeX() -> D2D1_EXTEND_MODE, + fn GetExtendModeY() -> D2D1_EXTEND_MODE, + fn GetInterpolationMode() -> D2D1_BITMAP_INTERPOLATION_MODE, + fn GetBitmap( + bitmap: *mut *mut ID2D1Bitmap, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906a9, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1SolidColorBrush(ID2D1SolidColorBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetColor( + color: *const D2D1_COLOR_F, + ) -> (), + #[fixme] fn GetColor() -> D2D1_COLOR_F, +}} +RIDL!{#[uuid(0x2cd906ab, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1LinearGradientBrush(ID2D1LinearGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetStartPoint( + startPoint: D2D1_POINT_2F, + ) -> (), + fn SetEndPoint( + endPoint: D2D1_POINT_2F, + ) -> (), + #[fixme] fn GetStartPoint() -> D2D1_POINT_2F, + #[fixme] fn GetEndPoint() -> D2D1_POINT_2F, + fn GetGradientStopCollection( + gradientStopCollection: *mut *mut ID2D1GradientStopCollection, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906ac, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1RadialGradientBrush(ID2D1RadialGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetCenter( + center: D2D1_POINT_2F, + ) -> (), + fn SetGradientOriginOffset( + gradientOriginOffset: D2D1_POINT_2F, + ) -> (), + fn SetRadiusX( + radiusX: FLOAT, + ) -> (), + fn SetRadiusY( + radiusY: FLOAT, + ) -> (), + #[fixme] fn GetCenter() -> D2D1_POINT_2F, + #[fixme] fn GetGradientOriginOffset() -> D2D1_POINT_2F, + fn GetRadiusX() -> FLOAT, + fn GetRadiusY() -> FLOAT, + fn GetGradientStopCollection( + gradientStopCollection: *mut *mut ID2D1GradientStopCollection, + ) -> (), +}} +RIDL!{#[uuid(0x2cd9069d, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1StrokeStyle(ID2D1StrokeStyleVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetStartCap() -> D2D1_CAP_STYLE, + fn GetEndCap() -> D2D1_CAP_STYLE, + fn GetDashCap() -> D2D1_CAP_STYLE, + fn GetMiterLimit() -> FLOAT, + fn GetLineJoin() -> D2D1_LINE_JOIN, + fn GetDashOffset() -> FLOAT, + fn GetDashStyle() -> D2D1_DASH_STYLE, + fn GetDashesCount() -> UINT32, + fn GetDashes( + dashes: *mut FLOAT, + dashesCount: UINT32, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906a1, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1Geometry(ID2D1GeometryVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetBounds( + worldTransform: *const D2D1_MATRIX_3X2_F, + bounds: *mut D2D1_RECT_F, + ) -> HRESULT, + fn GetWidenedBounds( + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + bounds: *mut D2D1_RECT_F, + ) -> HRESULT, + fn StrokeContainsPoint( + point: D2D1_POINT_2F, + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + contains: *mut BOOL, + ) -> HRESULT, + fn FillContainsPoint( + point: D2D1_POINT_2F, + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + contains: *mut BOOL, + ) -> HRESULT, + fn CompareWithGeometry( + inputGeometry: *mut ID2D1Geometry, + inputGeometryTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + relation: *mut D2D1_GEOMETRY_RELATION, + ) -> HRESULT, + fn Simplify( + simplificationOption: D2D1_GEOMETRY_SIMPLIFICATION_OPTION, + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink, + ) -> HRESULT, + fn Tessellate( + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + tessellationSink: *mut ID2D1TessellationSink, + ) -> HRESULT, + fn CombineWithGeometry( + inputGeometry: *mut ID2D1Geometry, + combineMode: D2D1_COMBINE_MODE, + inputGeometryTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink, + ) -> HRESULT, + fn Outline( + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink, + ) -> HRESULT, + fn ComputeArea( + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + area: *mut FLOAT, + ) -> HRESULT, + fn ComputeLength( + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + length: *mut FLOAT, + ) -> HRESULT, + fn ComputePointAtLength( + length: FLOAT, + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + point: *mut D2D1_POINT_2F, + unitTangentVector: *mut D2D1_POINT_2F, + ) -> HRESULT, + fn Widen( + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + geometrySink: *mut ID2D1SimplifiedGeometrySink, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x2cd906a2, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1RectangleGeometry(ID2D1RectangleGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetRect( + rect: *mut D2D1_RECT_F, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906a3, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1RoundedRectangleGeometry(ID2D1RoundedRectangleGeometryVtbl): + ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetRoundedRect( + roundedRect: *mut D2D1_ROUNDED_RECT, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906a4, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1EllipseGeometry(ID2D1EllipseGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetEllipse( + ellipse: *mut D2D1_ELLIPSE, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906a6, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1GeometryGroup(ID2D1GeometryGroupVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetFillMode() -> D2D1_FILL_MODE, + fn GetSourceGeometryCount() -> UINT32, + fn GetSourceGeometries( + geometries: *mut *mut ID2D1Geometry, + geometriesCount: UINT32, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906bb, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1TransformedGeometry(ID2D1TransformedGeometryVtbl): + ID2D1Geometry(ID2D1GeometryVtbl) { + fn GetSourceGeometry( + sourceGeometry: *mut *mut ID2D1Geometry, + ) -> (), + fn GetTransform( + transform: *mut D2D1_MATRIX_3X2_F, + ) -> (), +}} +RIDL!{#[uuid(0x2cd9069e, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl): IUnknown(IUnknownVtbl) { + fn SetFillMode( + fillMode: D2D1_FILL_MODE, + ) -> (), + fn SetSegmentFlags( + vertexFlags: D2D1_PATH_SEGMENT, + ) -> (), + fn BeginFigure( + startPoint: D2D1_POINT_2F, + figureBegin: D2D1_FIGURE_BEGIN, + ) -> (), + fn AddLines( + points: *const D2D1_POINT_2F, + pointsCount: UINT32, + ) -> (), + fn AddBeziers( + beziers: *const D2D1_BEZIER_SEGMENT, + beziersCount: UINT32, + ) -> (), + fn EndFigure( + figureEnd: D2D1_FIGURE_END, + ) -> (), + fn Close() -> HRESULT, +}} +RIDL!{#[uuid(0x2cd9069f, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1GeometrySink(ID2D1GeometrySinkVtbl): + ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl) { + fn AddLine( + point: D2D1_POINT_2F, + ) -> (), + fn AddBezier( + bezier: *const D2D1_BEZIER_SEGMENT, + ) -> (), + fn AddQuadraticBezier( + bezier: *const D2D1_QUADRATIC_BEZIER_SEGMENT, + ) -> (), + fn AddQuadraticBeziers( + beziers: *const D2D1_QUADRATIC_BEZIER_SEGMENT, + beziersCount: UINT32, + ) -> (), + fn AddArc( + arc: *const D2D1_ARC_SEGMENT, + ) -> (), +}} +RIDL!{#[uuid(0x2cd906c1, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1TessellationSink(ID2D1TessellationSinkVtbl): IUnknown(IUnknownVtbl) { + fn AddTriangles( + triangles: *const D2D1_TRIANGLE, + triangleCount: UINT32, + ) -> (), + fn Close() -> HRESULT, +}} +RIDL!{#[uuid(0x2cd906a5, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1PathGeometry(ID2D1PathGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { + fn Open( + geometrySink: *mut *mut ID2D1GeometrySink, + ) -> HRESULT, + fn Stream( + geometrySink: *mut ID2D1GeometrySink, + ) -> HRESULT, + fn GetSegmentCount( + count: *mut UINT32, + ) -> HRESULT, + fn GetFigureCount( + count: *mut UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x2cd906c2, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1Mesh(ID2D1MeshVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn Open( + tessellationSink: *mut *mut ID2D1TessellationSink, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x2cd9069b, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1Layer(ID2D1LayerVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + #[fixme] fn GetSize() -> D2D1_SIZE_F, +}} +RIDL!{#[uuid(0x28506e39, 0xebf6, 0x46a1, 0xbb, 0x47, 0xfd, 0x85, 0x56, 0x5a, 0xb9, 0x57)] +interface ID2D1DrawingStateBlock(ID2D1DrawingStateBlockVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetDescription( + stateDescription: *mut D2D1_DRAWING_STATE_DESCRIPTION, + ) -> (), + fn SetDescription( + stateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION, + ) -> (), + fn SetTextRenderingParams( + textRenderingParams: *mut IDWriteRenderingParams, + ) -> (), + fn GetTextRenderingParams( + textRenderingParams: *mut *mut IDWriteRenderingParams, + ) -> (), +}} +RIDL!{#[uuid(0x2cd90694, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1RenderTarget(ID2D1RenderTargetVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn CreateBitmap( + size: D2D1_SIZE_U, + srcData: *const c_void, + pitch: UINT32, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES, + bitmap: *mut *mut ID2D1Bitmap, + ) -> HRESULT, + fn CreateBitmapFromWicBitmap( + wicBitmapSource: *mut IWICBitmapSource, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES, + bitmap: *mut *mut ID2D1Bitmap, + ) -> HRESULT, + fn CreateSharedBitmap( + riid: REFIID, + data: *const c_void, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES, + bitmap: *mut *mut ID2D1Bitmap, + ) -> HRESULT, + fn CreateBitmapBrush( + bitmap: *mut ID2D1Bitmap, + bitmapBrushProperties: *const D2D1_BITMAP_BRUSH_PROPERTIES, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + bitmapBrush: *mut *mut ID2D1BitmapBrush, + ) -> HRESULT, + fn CreateSolidColorBrush( + color: *const D2D1_COLOR_F, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + solidColorBrush: *mut *mut ID2D1SolidColorBrush, + ) -> HRESULT, + fn CreateGradientStopCollection( + gradientStops: *const D2D1_GRADIENT_STOP, + gradientStopsCount: UINT32, + colorInterpolationGamma: D2D1_GAMMA, + extendMode: D2D1_EXTEND_MODE, + gradientStopCollection: *mut *mut ID2D1GradientStopCollection, + ) -> HRESULT, + fn CreateLinearGradientBrush( + linearGradientBrushProperties: *const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + gradientStopCollection: *mut ID2D1GradientStopCollection, + linearGradientBrush: *mut *mut ID2D1LinearGradientBrush, + ) -> HRESULT, + fn CreateRadialGradientBrush( + radialGradientBrushProperties: *const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + gradientStopCollection: *mut ID2D1GradientStopCollection, + radialGradientBrush: *mut *mut ID2D1RadialGradientBrush, + ) -> HRESULT, + fn CreateCompatibleRenderTarget( + desiredSize: *const D2D1_SIZE_F, + desiredPixelSize: *const D2D1_SIZE_U, + desiredFormat: *const D2D1_PIXEL_FORMAT, + options: D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS, + bitmapRenderTarget: *mut *mut ID2D1BitmapRenderTarget, + ) -> HRESULT, + fn CreateLayer( + size: *const D2D1_SIZE_F, + layer: *mut *mut ID2D1Layer, + ) -> HRESULT, + fn CreateMesh( + mesh: *mut *mut ID2D1Mesh, + ) -> HRESULT, + fn DrawLine( + point0: D2D1_POINT_2F, + point1: D2D1_POINT_2F, + brush: *mut ID2D1Brush, + strokeWidth: FLOAT, + strokeStype: *mut ID2D1StrokeStyle, + ) -> (), + fn DrawRectangle( + rect: *const D2D1_RECT_F, + brush: *mut ID2D1Brush, + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + ) -> (), + fn FillRectangle( + rect: *const D2D1_RECT_F, + brush: *mut ID2D1Brush, + ) -> (), + fn DrawRoundedRectangle( + roundedRect: *const D2D1_ROUNDED_RECT, + brush: *mut ID2D1Brush, + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + ) -> (), + fn FillRoundedRectangle( + roundedRect: *const D2D1_ROUNDED_RECT, + brush: *mut ID2D1Brush, + ) -> (), + fn DrawEllipse( + ellipse: *const D2D1_ELLIPSE, + brush: *mut ID2D1Brush, + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + ) -> (), + fn FillEllipse( + ellipse: *const D2D1_ELLIPSE, + brush: *mut ID2D1Brush, + ) -> (), + fn DrawGeometry( + geometry: *mut ID2D1Geometry, + brush: *mut ID2D1Brush, + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + ) -> (), + fn FillGeometry( + geometry: *mut ID2D1Geometry, + brush: *mut ID2D1Brush, + opacityBrush: *mut ID2D1Brush, + ) -> (), + fn FillMesh( + mesh: *mut ID2D1Mesh, + brush: *const ID2D1Brush, + ) -> (), + fn FillOpacityMask( + opacityMask: *mut ID2D1Bitmap, + brush: *mut ID2D1Brush, + content: D2D1_OPACITY_MASK_CONTENT, + destinationRectangle: *const D2D1_RECT_F, + sourceRectangle: *const D2D1_RECT_F, + ) -> (), + fn DrawBitmap( + bitmap: *mut ID2D1Bitmap, + destinationRectangle: *const D2D1_RECT_F, + opacity: FLOAT, + interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE, + sourceRectangle: *const D2D1_RECT_F, + ) -> (), + fn DrawText( + string: *const WCHAR, + stringLength: UINT32, + textFormat: *mut IDWriteTextFormat, + layoutRect: *const D2D1_RECT_F, + defaultForegroundBrush: *mut ID2D1Brush, + options: D2D1_DRAW_TEXT_OPTIONS, + measuringMode: DWRITE_MEASURING_MODE, + ) -> (), + fn DrawTextLayout( + origin: D2D1_POINT_2F, + textLayout: *mut IDWriteTextLayout, + defaultForegroundBrush: *mut ID2D1Brush, + options: D2D1_DRAW_TEXT_OPTIONS, + ) -> (), + fn DrawGlyphRun( + baselineOrigin: D2D1_POINT_2F, + glyphRun: *const DWRITE_GLYPH_RUN, + foregroundBrush: *mut ID2D1Brush, + measuringMode: DWRITE_MEASURING_MODE, + ) -> (), + fn SetTransform( + transform: *const D2D1_MATRIX_3X2_F, + ) -> (), + fn GetTransform( + transform: *mut D2D1_MATRIX_3X2_F, + ) -> (), + fn SetAntialiasMode( + antialiasMode: D2D1_ANTIALIAS_MODE, + ) -> (), + fn GetAntialiasMode() -> D2D1_ANTIALIAS_MODE, + fn SetTextAntialiasMode( + textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE, + ) -> (), + fn GetTextAntialiasMode() -> D2D1_TEXT_ANTIALIAS_MODE, + fn SetTextRenderingParams( + textRenderingParams: *mut IDWriteRenderingParams, + ) -> (), + fn GetTextRenderingParams( + textRenderingParams: *mut *mut IDWriteRenderingParams, + ) -> (), + fn SetTags( + tag1: D2D1_TAG, + tag2: D2D1_TAG, + ) -> (), + fn GetTags( + tag1: *mut D2D1_TAG, + tag2: *mut D2D1_TAG, + ) -> (), + fn PushLayer( + layerParameters: *const D2D1_LAYER_PARAMETERS, + layer: *mut ID2D1Layer, + ) -> (), + fn PopLayer() -> (), + fn Flush( + tag1: *mut D2D1_TAG, + tag2: *mut D2D1_TAG, + ) -> HRESULT, + fn SaveDrawingState( + drawingStateBlock: *mut ID2D1DrawingStateBlock, + ) -> (), + fn RestoreDrawingState( + drawingStateBlock: *mut ID2D1DrawingStateBlock, + ) -> (), + fn PushAxisAlignedClip( + clipRect: *const D2D1_RECT_F, + antialiasMode: D2D1_ANTIALIAS_MODE, + ) -> (), + fn PopAxisAlignedClip() -> (), + fn Clear( + clearColor: *const D2D1_COLOR_F, + ) -> (), + fn BeginDraw() -> (), + fn EndDraw( + tag1: *mut D2D1_TAG, + tag2: *mut D2D1_TAG, + ) -> HRESULT, + #[fixme] fn GetPixelFormat() -> D2D1_PIXEL_FORMAT, + fn SetDpi( + dpiX: FLOAT, + dpiY: FLOAT, + ) -> (), + fn GetDpi( + dpiX: *mut FLOAT, + dpiY: *mut FLOAT, + ) -> (), + #[fixme] fn GetSize() -> D2D1_SIZE_F, + #[fixme] fn GetPixelSize() -> D2D1_SIZE_U, + fn GetMaximumBitmapSize() -> UINT32, + fn IsSupported( + renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + ) -> BOOL, +}} +RIDL!{#[uuid(0x2cd90695, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1BitmapRenderTarget(ID2D1BitmapRenderTargetVtbl): + ID2D1RenderTarget(ID2D1RenderTargetVtbl) { + fn GetBitmap( + bitmap: *mut *mut ID2D1Bitmap, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x2cd90698, 0x12e2, 0x11dc, 0x9f, 0xed, 0x00, 0x11, 0x43, 0xa0, 0x55, 0xf9)] +interface ID2D1HwndRenderTarget(ID2D1HwndRenderTargetVtbl): + ID2D1RenderTarget(ID2D1RenderTargetVtbl) { + fn CheckWindowState() -> D2D1_WINDOW_STATE, + fn Resize( + pixelSize: *const D2D1_SIZE_U, + ) -> HRESULT, + fn GetHwnd() -> HWND, +}} +RIDL!{#[uuid(0xe0db51c3, 0x6f77, 0x4bae, 0xb3, 0xd5, 0xe4, 0x75, 0x09, 0xb3, 0x58, 0x38)] +interface ID2D1GdiInteropRenderTarget(ID2D1GdiInteropRenderTargetVtbl): IUnknown(IUnknownVtbl) { + fn GetDC( + mode: D2D1_DC_INITIALIZE_MODE, + hdc: *mut HDC, + ) -> HRESULT, + fn ReleaseDC( + update: *const RECT, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x1c51bc64, 0xde61, 0x46fd, 0x98, 0x99, 0x63, 0xa5, 0xd8, 0xf0, 0x39, 0x50)] +interface ID2D1DCRenderTarget(ID2D1DCRenderTargetVtbl): ID2D1RenderTarget(ID2D1RenderTargetVtbl) { + fn BindDC( + hDC: HDC, + pSubRect: *const RECT, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x06152247, 0x6f50, 0x465a, 0x92, 0x45, 0x11, 0x8b, 0xfd, 0x3b, 0x60, 0x07)] +interface ID2D1Factory(ID2D1FactoryVtbl): IUnknown(IUnknownVtbl) { + fn ReloadSystemMetrics() -> HRESULT, + fn GetDesktopDpi( + dpiX: *mut FLOAT, + dpiY: *mut FLOAT, + ) -> (), + fn CreateRectangleGeometry( + rectangle: *const D2D1_RECT_F, + rectangleGeometry: *mut *mut ID2D1RectangleGeometry, + ) -> HRESULT, + fn CreateRoundedRectangleGeometry( + roundedRectangle: *const D2D1_ROUNDED_RECT, + roundedRectangleGeometry: *mut *mut ID2D1RoundedRectangleGeometry, + ) -> HRESULT, + fn CreateEllipseGeometry( + ellipse: *const D2D1_ELLIPSE, + ellipseGeometry: *mut *mut ID2D1EllipseGeometry, + ) -> HRESULT, + fn CreateGeometryGroup( + fillMode: D2D1_FILL_MODE, + geometries: *mut *mut ID2D1Geometry, + geometriesCount: UINT32, + geometryGroup: *mut *mut ID2D1GeometryGroup, + ) -> HRESULT, + fn CreateTransformedGeometry( + sourceGeometry: *mut ID2D1Geometry, + transform: *const D2D1_MATRIX_3X2_F, + transformedGeometry: *mut *mut ID2D1TransformedGeometry, + ) -> HRESULT, + fn CreatePathGeometry( + pathGeometry: *mut *mut ID2D1PathGeometry, + ) -> HRESULT, + fn CreateStrokeStyle( + strokeStyleProperties: *const D2D1_STROKE_STYLE_PROPERTIES, + dashes: *const FLOAT, + dashesCount: UINT32, + strokeStyle: *mut *mut ID2D1StrokeStyle, + ) -> HRESULT, + fn CreateDrawingStateBlock( + drawingStateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION, + textRenderingParams: *mut IDWriteRenderingParams, + drawingStateBlock: *mut *mut ID2D1DrawingStateBlock, + ) -> HRESULT, + fn CreateWicBitmapRenderTarget( + target: *mut IWICBitmap, + renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + renderTarget: *mut *mut ID2D1RenderTarget, + ) -> HRESULT, + fn CreateHwndRenderTarget( + renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + hwndRenderTargetProperties: *const D2D1_HWND_RENDER_TARGET_PROPERTIES, + hwndRenderTarget: *mut *mut ID2D1HwndRenderTarget, + ) -> HRESULT, + fn CreateDxgiSurfaceRenderTarget( + dxgiSurface: *mut IDXGISurface, + renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + renderTarget: *mut *mut ID2D1RenderTarget, + ) -> HRESULT, + fn CreateDCRenderTarget( + renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, + dcRenderTarget: *mut *mut ID2D1DCRenderTarget, + ) -> HRESULT, +}} +extern "system" { + pub fn D2D1CreateFactory( + factoryType: D2D1_FACTORY_TYPE, + riid: REFIID, + pFactoryOptions: *const D2D1_FACTORY_OPTIONS, + ppIFactory: *mut *mut c_void, + ) -> HRESULT; + pub fn D2D1MakeRotateMatrix( + angle: FLOAT, + center: D2D1_POINT_2F, + matrix: *mut D2D1_MATRIX_3X2_F, + ); + pub fn D2D1MakeSkewMatrix( + angleX: FLOAT, + angleY: FLOAT, + center: D2D1_POINT_2F, + matrix: *mut D2D1_MATRIX_3X2_F, + ); + pub fn D2D1IsMatrixInvertible( + matrix: *const D2D1_MATRIX_3X2_F, + ) -> BOOL; + pub fn D2D1InvertMatrix( + matrix: *mut D2D1_MATRIX_3X2_F, + ) -> BOOL; + pub fn D2D1ComputeMaximumScaleFactor( + matrix: *const D2D1_MATRIX_3X2_F, + ) -> FLOAT; +} diff --git a/src/vendor/winapi/src/um/d2d1_1.rs b/src/vendor/winapi/src/um/d2d1_1.rs new file mode 100644 index 0000000000..3a27306156 --- /dev/null +++ b/src/vendor/winapi/src/um/d2d1_1.rs @@ -0,0 +1,848 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of d2d1_1.h +use ctypes::c_void; +use shared::basetsd::{UINT32, UINT64}; +use shared::dxgi::{IDXGIDevice, IDXGISurface}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::guiddef::{CLSID, REFCLSID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT}; +use um::d2d1::{ + D2D1_ANTIALIAS_MODE, D2D1_BRUSH_PROPERTIES, D2D1_CAP_STYLE, D2D1_COLOR_F, + D2D1_DASH_STYLE, D2D1_DEBUG_LEVEL, D2D1_EXTEND_MODE, D2D1_GRADIENT_STOP, + D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC, D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC, + D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC, + D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, + D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR, + D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, D2D1_LINE_JOIN, D2D1_MATRIX_3X2_F, + D2D1_POINT_2F, D2D1_RECT_F, D2D1_SIZE_U, D2D1_TAG, D2D1_TEXT_ANTIALIAS_MODE, ID2D1Bitmap, + ID2D1BitmapBrush, ID2D1BitmapBrushVtbl, ID2D1BitmapVtbl, ID2D1Brush, ID2D1BrushVtbl, + ID2D1DrawingStateBlock, ID2D1DrawingStateBlockVtbl, ID2D1Factory, ID2D1FactoryVtbl, + ID2D1Geometry, ID2D1GradientStopCollection, ID2D1GradientStopCollectionVtbl, ID2D1Image, + ID2D1ImageVtbl, ID2D1Layer, ID2D1Mesh, ID2D1PathGeometry, ID2D1PathGeometryVtbl, + ID2D1RenderTarget, ID2D1RenderTargetVtbl, ID2D1Resource, ID2D1ResourceVtbl, ID2D1StrokeStyle, + ID2D1StrokeStyleVtbl, +}; +use um::d2d1effectauthor::D2D1_PROPERTY_BINDING; +use um::d2dbasetypes::D2D_SIZE_F; +use um::dcommon::{D2D1_PIXEL_FORMAT, DWRITE_MEASURING_MODE}; +use um::documenttarget::IPrintDocumentPackageTarget; +use um::dwrite::{DWRITE_GLYPH_RUN, DWRITE_GLYPH_RUN_DESCRIPTION, IDWriteRenderingParams}; +use um::objidlbase::IStream; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::wincodec::{IWICBitmapSource, IWICColorContext, IWICImagingFactory}; +use um::winnt::{HRESULT, PCWSTR, PWSTR}; +FN!{stdcall PD2D1_EFFECT_FACTORY( + effectImpl: *mut *mut IUnknown, +) -> HRESULT} +pub use um::d2dbasetypes::D2D_RECT_L as D2D1_RECT_L; +pub use um::d2dbasetypes::D2D_POINT_2L as D2D1_POINT_2L; +ENUM!{enum D2D1_PROPERTY_TYPE { + D2D1_PROPERTY_TYPE_UNKNOWN = 0, + D2D1_PROPERTY_TYPE_STRING = 1, + D2D1_PROPERTY_TYPE_BOOL = 2, + D2D1_PROPERTY_TYPE_UINT32 = 3, + D2D1_PROPERTY_TYPE_INT32 = 4, + D2D1_PROPERTY_TYPE_FLOAT = 5, + D2D1_PROPERTY_TYPE_VECTOR2 = 6, + D2D1_PROPERTY_TYPE_VECTOR3 = 7, + D2D1_PROPERTY_TYPE_VECTOR4 = 8, + D2D1_PROPERTY_TYPE_BLOB = 9, + D2D1_PROPERTY_TYPE_IUNKNOWN = 10, + D2D1_PROPERTY_TYPE_ENUM = 11, + D2D1_PROPERTY_TYPE_ARRAY = 12, + D2D1_PROPERTY_TYPE_CLSID = 13, + D2D1_PROPERTY_TYPE_MATRIX_3X2 = 14, + D2D1_PROPERTY_TYPE_MATRIX_4X3 = 15, + D2D1_PROPERTY_TYPE_MATRIX_4X4 = 16, + D2D1_PROPERTY_TYPE_MATRIX_5X4 = 17, + D2D1_PROPERTY_TYPE_COLOR_CONTEXT = 18, + D2D1_PROPERTY_TYPE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_PROPERTY { + D2D1_PROPERTY_CLSID = 0x80000000, + D2D1_PROPERTY_DISPLAYNAME = 0x80000001, + D2D1_PROPERTY_AUTHOR = 0x80000002, + D2D1_PROPERTY_CATEGORY = 0x80000003, + D2D1_PROPERTY_DESCRIPTION = 0x80000004, + D2D1_PROPERTY_INPUTS = 0x80000005, + D2D1_PROPERTY_CACHED = 0x80000006, + D2D1_PROPERTY_PRECISION = 0x80000007, + D2D1_PROPERTY_MIN_INPUTS = 0x80000008, + D2D1_PROPERTY_MAX_INPUTS = 0x80000009, + D2D1_PROPERTY_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SUBPROPERTY { + D2D1_SUBPROPERTY_DISPLAYNAME = 0x80000000, + D2D1_SUBPROPERTY_ISREADONLY = 0x80000001, + D2D1_SUBPROPERTY_MIN = 0x80000002, + D2D1_SUBPROPERTY_MAX = 0x80000003, + D2D1_SUBPROPERTY_DEFAULT = 0x80000004, + D2D1_SUBPROPERTY_FIELDS = 0x80000005, + D2D1_SUBPROPERTY_INDEX = 0x80000006, + D2D1_SUBPROPERTY_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BITMAP_OPTIONS { + D2D1_BITMAP_OPTIONS_NONE = 0x00000000, + D2D1_BITMAP_OPTIONS_TARGET = 0x00000001, + D2D1_BITMAP_OPTIONS_CANNOT_DRAW = 0x00000002, + D2D1_BITMAP_OPTIONS_CPU_READ = 0x00000004, + D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE = 0x00000008, + D2D1_BITMAP_OPTIONS_FORCE_DWORD = 0xffffffff, +}} +// DEFINE_ENUM_FLAG_OPERATORS(D2D1_BITMAP_OPTIONS); +ENUM!{enum D2D1_COMPOSITE_MODE { + D2D1_COMPOSITE_MODE_SOURCE_OVER = 0, + D2D1_COMPOSITE_MODE_DESTINATION_OVER = 1, + D2D1_COMPOSITE_MODE_SOURCE_IN = 2, + D2D1_COMPOSITE_MODE_DESTINATION_IN = 3, + D2D1_COMPOSITE_MODE_SOURCE_OUT = 4, + D2D1_COMPOSITE_MODE_DESTINATION_OUT = 5, + D2D1_COMPOSITE_MODE_SOURCE_ATOP = 6, + D2D1_COMPOSITE_MODE_DESTINATION_ATOP = 7, + D2D1_COMPOSITE_MODE_XOR = 8, + D2D1_COMPOSITE_MODE_PLUS = 9, + D2D1_COMPOSITE_MODE_SOURCE_COPY = 10, + D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY = 11, + D2D1_COMPOSITE_MODE_MASK_INVERT = 12, + D2D1_COMPOSITE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BUFFER_PRECISION { + D2D1_BUFFER_PRECISION_UNKNOWN = 0, + D2D1_BUFFER_PRECISION_8BPC_UNORM = 1, + D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = 2, + D2D1_BUFFER_PRECISION_16BPC_UNORM = 3, + D2D1_BUFFER_PRECISION_16BPC_FLOAT = 4, + D2D1_BUFFER_PRECISION_32BPC_FLOAT = 5, + D2D1_BUFFER_PRECISION_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_MAP_OPTIONS { + D2D1_MAP_OPTIONS_NONE = 0, + D2D1_MAP_OPTIONS_READ = 1, + D2D1_MAP_OPTIONS_WRITE = 2, + D2D1_MAP_OPTIONS_DISCARD = 4, + D2D1_MAP_OPTIONS_FORCE_DWORD = 0xffffffff, +}} +//DEFINE_ENUM_FLAG_OPERATORS(D2D1_MAP_OPTIONS); +ENUM!{enum D2D1_INTERPOLATION_MODE { + D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR = D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, + D2D1_INTERPOLATION_MODE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, + D2D1_INTERPOLATION_MODE_CUBIC = D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC, + D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR + = D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR, + D2D1_INTERPOLATION_MODE_ANISOTROPIC = D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC, + D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC + = D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC, + D2D1_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_UNIT_MODE { + D2D1_UNIT_MODE_DIPS = 0, + D2D1_UNIT_MODE_PIXELS = 1, + D2D1_UNIT_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLOR_SPACE { + D2D1_COLOR_SPACE_CUSTOM = 0, + D2D1_COLOR_SPACE_SRGB = 1, + D2D1_COLOR_SPACE_SCRGB = 2, + D2D1_COLOR_SPACE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DEVICE_CONTEXT_OPTIONS { + D2D1_DEVICE_CONTEXT_OPTIONS_NONE = 0, + D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS = 1, + D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD = 0xffffffff, +}} +//DEFINE_ENUM_FLAG_OPERATORS(D2D1_DEVICE_CONTEXT_OPTIONS); +ENUM!{enum D2D1_STROKE_TRANSFORM_TYPE { + D2D1_STROKE_TRANSFORM_TYPE_NORMAL = 0, + D2D1_STROKE_TRANSFORM_TYPE_FIXED = 1, + D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE = 2, + D2D1_STROKE_TRANSFORM_TYPE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_PRIMITIVE_BLEND { + D2D1_PRIMITIVE_BLEND_SOURCE_OVER = 0, + D2D1_PRIMITIVE_BLEND_COPY = 1, + D2D1_PRIMITIVE_BLEND_MIN = 2, + D2D1_PRIMITIVE_BLEND_ADD = 3, + D2D1_PRIMITIVE_BLEND_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_THREADING_MODE { + D2D1_THREADING_MODE_SINGLE_THREADED = super::d2d1::D2D1_FACTORY_TYPE_SINGLE_THREADED, + D2D1_THREADING_MODE_MULTI_THREADED = super::d2d1::D2D1_FACTORY_TYPE_MULTI_THREADED, + D2D1_THREADING_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLOR_INTERPOLATION_MODE { + D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT = 0, + D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED = 1, + D2D1_COLOR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +pub use um::d2dbasetypes::D2D_VECTOR_2F as D2D1_VECTOR_2F; +pub use um::d2dbasetypes::D2D_VECTOR_3F as D2D1_VECTOR_3F; +pub use um::d2dbasetypes::D2D_VECTOR_4F as D2D1_VECTOR_4F; +STRUCT!{struct D2D1_BITMAP_PROPERTIES1 { + pixelFormat: D2D1_PIXEL_FORMAT, + dpiX: FLOAT, + dpiY: FLOAT, + bitmapOptions: D2D1_BITMAP_OPTIONS, + colorContext: *const ID2D1ColorContext, +}} +STRUCT!{struct D2D1_MAPPED_RECT { + pitch: UINT32, + bits: *const BYTE, +}} +STRUCT!{struct D2D1_RENDERING_CONTROLS { + bufferPrecision: D2D1_BUFFER_PRECISION, + tileSize: D2D1_SIZE_U, +}} +STRUCT!{struct D2D1_EFFECT_INPUT_DESCRIPTION { + effect: *const ID2D1Effect, + inputIndex: UINT32, + inputRectangle: D2D1_RECT_F, +}} +pub use um::d2dbasetypes::D2D_MATRIX_4X3_F as D2D1_MATRIX_4X3_F; +pub use um::d2dbasetypes::D2D_MATRIX_4X4_F as D2D1_MATRIX_4X4_F; +pub use um::d2dbasetypes::D2D_MATRIX_5X4_F as D2D1_MATRIX_5X4_F; +STRUCT!{struct D2D1_POINT_DESCRIPTION { + point: D2D1_POINT_2F, + unitTangentVector: D2D1_POINT_2F, + endSegment: UINT32, + endFigure: UINT32, + lengthToEndSegment: FLOAT, +}} +STRUCT!{struct D2D1_IMAGE_BRUSH_PROPERTIES { + sourceRectangle: D2D1_RECT_F, + extendModeX: D2D1_EXTEND_MODE, + extendModeY: D2D1_EXTEND_MODE, + interpolationMode: D2D1_INTERPOLATION_MODE, +}} +STRUCT!{struct D2D1_BITMAP_BRUSH_PROPERTIES1 { + extendModeX: D2D1_EXTEND_MODE, + extendModeY: D2D1_EXTEND_MODE, + interpolationMode: D2D1_INTERPOLATION_MODE, +}} +STRUCT!{struct D2D1_STROKE_STYLE_PROPERTIES1 { + startCap: D2D1_CAP_STYLE, + endCap: D2D1_CAP_STYLE, + dashCap: D2D1_CAP_STYLE, + lineJoin: D2D1_LINE_JOIN, + miterLimit: FLOAT, + dashStyle: D2D1_DASH_STYLE, + dashOffset: FLOAT, + transformType: D2D1_STROKE_TRANSFORM_TYPE, +}} +ENUM!{enum D2D1_LAYER_OPTIONS1 { + D2D1_LAYER_OPTIONS1_NONE = 0, + D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND = 1, + D2D1_LAYER_OPTIONS1_IGNORE_ALPHA = 2, + D2D1_LAYER_OPTIONS1_FORCE_DWORD = 0xffffffff, +}} +//DEFINE_ENUM_FLAG_OPERATORS(D2D1_LAYER_OPTIONS1); +STRUCT!{struct D2D1_LAYER_PARAMETERS1 { + contentBounds: D2D1_RECT_F, + geometricMask: *const ID2D1Geometry, + maskAntialiasMode: D2D1_ANTIALIAS_MODE, + maskTransform: D2D1_MATRIX_3X2_F, + opacity: FLOAT, + opacityBrush: *const ID2D1Brush, + layerOptions: D2D1_LAYER_OPTIONS1, +}} +ENUM!{enum D2D1_PRINT_FONT_SUBSET_MODE { + D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT = 0, + D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE = 1, + D2D1_PRINT_FONT_SUBSET_MODE_NONE = 2, + D2D1_PRINT_FONT_SUBSET_MODE_FORCE_DWORD = 0xffffffff, +}} +STRUCT!{struct D2D1_DRAWING_STATE_DESCRIPTION1 { + antialiasMode: D2D1_ANTIALIAS_MODE, + textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE, + tag1: D2D1_TAG, + tag2: D2D1_TAG, + transform: D2D1_MATRIX_3X2_F, + primitiveBlend: D2D1_PRIMITIVE_BLEND, + unitMode: D2D1_UNIT_MODE, +}} +STRUCT!{struct D2D1_PRINT_CONTROL_PROPERTIES { + fontSubset: D2D1_PRINT_FONT_SUBSET_MODE, + rasterDPI: FLOAT, + colorSpace: D2D1_COLOR_SPACE, +}} +STRUCT!{struct D2D1_CREATION_PROPERTIES { + threadingMode: D2D1_THREADING_MODE, + debugLevel: D2D1_DEBUG_LEVEL, + options: D2D1_DEVICE_CONTEXT_OPTIONS, +}} +RIDL!(#[uuid(0x82237326, 0x8111, 0x4f7c, 0xbc, 0xf4, 0xb5, 0xc1, 0x17, 0x55, 0x64, 0xfe)] +interface ID2D1GdiMetafileSink(ID2D1GdiMetafileSinkVtbl): IUnknown(IUnknownVtbl) { + fn ProcessRecord( + recordType: DWORD, + recordData: *const c_void, + recordDataSize: DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x2f543dc3, 0xcfc1, 0x4211, 0x86, 0x4f, 0xcf, 0xd9, 0x1c, 0x6f, 0x33, 0x95)] +interface ID2D1GdiMetafile(ID2D1GdiMetafileVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn Stream( + sink: *const ID2D1GdiMetafileSink, + ) -> HRESULT, + fn GetBounds( + bounds: *mut D2D1_RECT_F, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x54d7898a, 0xa061, 0x40a7, 0xbe, 0xc7, 0xe4, 0x65, 0xbc, 0xba, 0x2c, 0x4f)] +interface ID2D1CommandSink(ID2D1CommandSinkVtbl): IUnknown(IUnknownVtbl) { + fn BeginDraw() -> HRESULT, + fn EndDraw() -> HRESULT, + fn SetAntialiasMode( + antialiasMode: D2D1_ANTIALIAS_MODE, + ) -> HRESULT, + fn SetTags( + tag1: D2D1_TAG, + tag2: D2D1_TAG, + ) -> HRESULT, + fn SetTextAntialiasMode( + textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE, + ) -> HRESULT, + fn SetTextRenderingParams( + textRenderingParams: *const IDWriteRenderingParams, + ) -> HRESULT, + fn SetTransform( + transform: *const D2D1_MATRIX_3X2_F, + ) -> HRESULT, + fn SetPrimitiveBlend( + primitiveBlend: D2D1_PRIMITIVE_BLEND, + ) -> HRESULT, + fn SetUnitMode( + unitMode: D2D1_UNIT_MODE, + ) -> HRESULT, + fn Clear( + color: *const D2D1_COLOR_F, + ) -> HRESULT, + fn DrawGlyphRun( + baselineOrigin: D2D1_POINT_2F, + glyphRun: *const DWRITE_GLYPH_RUN, + glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, + foregroundBrush: *const ID2D1Brush, + measuringMode: DWRITE_MEASURING_MODE, + ) -> HRESULT, + fn DrawLine( + point0: D2D1_POINT_2F, + point1: D2D1_POINT_2F, + brush: *const ID2D1Brush, + strokeWidth: FLOAT, + strokeStyle: *const ID2D1StrokeStyle, + ) -> HRESULT, + fn DrawGeometry( + geometry: *const ID2D1Geometry, + brush: *const ID2D1Brush, + strokeWidth: FLOAT, + strokeStyle: *const ID2D1StrokeStyle, + ) -> HRESULT, + fn DrawRectangle( + rect: *const D2D1_RECT_F, + brush: *const ID2D1Brush, + strokeWidth: FLOAT, + strokeStyle: *const ID2D1StrokeStyle, + ) -> HRESULT, + fn DrawBitmap( + bitmap: *const ID2D1Bitmap, + destinationRectangle: *const D2D1_RECT_F, + opacity: FLOAT, + interpolationMode: D2D1_INTERPOLATION_MODE, + sourceRectangle: *const D2D1_RECT_F, + perspectiveTransform: *const D2D1_MATRIX_4X4_F, + ) -> HRESULT, + fn DrawImage( + image: *const ID2D1Image, + targetOffset: *const D2D1_POINT_2F, + imageRectangle: *const D2D1_RECT_F, + interpolationMode: D2D1_INTERPOLATION_MODE, + compositeMode: D2D1_COMPOSITE_MODE, + ) -> HRESULT, + fn DrawGdiMetafile( + gdiMetafile: *const ID2D1GdiMetafile, + targetOffset: *const D2D1_POINT_2F, + ) -> HRESULT, + fn FillMesh( + mesh: *const ID2D1Mesh, + brush: *const ID2D1Brush, + ) -> HRESULT, + fn FillOpacityMask( + opacityMask: *const ID2D1Bitmap, + brush: *const ID2D1Brush, + destinationRectangle: *const D2D1_RECT_F, + sourceRectangle: *const D2D1_RECT_F, + ) -> HRESULT, + fn FillGeometry( + geometry: *const ID2D1Geometry, + brush: *const ID2D1Brush, + opacityBrush: *const ID2D1Brush, + ) -> HRESULT, + fn FillRectangle( + rect: *const D2D1_RECT_F, + brush: *const ID2D1Brush, + ) -> HRESULT, + fn PushAxisAlignedClip( + clipRect: *const D2D1_RECT_F, + antialiasMode: D2D1_ANTIALIAS_MODE, + ) -> HRESULT, + fn PushLayer( + layerParameters1: *const D2D1_LAYER_PARAMETERS1, + layer: *const ID2D1Layer, + ) -> HRESULT, + fn PopAxisAlignedClip() -> HRESULT, + fn PopLayer() -> HRESULT, +}); +RIDL!(#[uuid(0xb4f34a19, 0x2383, 0x4d76, 0x94, 0xf6, 0xec, 0x34, 0x36, 0x57, 0xc3, 0xdc)] +interface ID2D1CommandList(ID2D1CommandListVtbl): ID2D1Image(ID2D1ImageVtbl) { + fn Stream( + sink: *const ID2D1CommandSink, + ) -> HRESULT, + fn Close() -> HRESULT, +}); +RIDL!(#[uuid(0x2c1d867d, 0xc290, 0x41c8, 0xae, 0x7e, 0x34, 0xa9, 0x87, 0x02, 0xe9, 0xa5)] +interface ID2D1PrintControl(ID2D1PrintControlVtbl): IUnknown(IUnknownVtbl) { + fn AddPage( + commandList: *const ID2D1CommandList, + pageSize: D2D_SIZE_F, + pagePrintTicketStream: *const IStream, + tag1: *mut D2D1_TAG, + tag2: *mut D2D1_TAG, + ) -> HRESULT, + fn Close() -> HRESULT, +}); +RIDL!(#[uuid(0xfe9e984d, 0x3f95, 0x407c, 0xb5, 0xdb, 0xcb, 0x94, 0xd4, 0xe8, 0xf8, 0x7c)] +interface ID2D1ImageBrush(ID2D1ImageBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { + fn SetImage( + image: *const ID2D1Image, + ) -> (), + fn SetExtendModeX( + extendModeX: D2D1_EXTEND_MODE, + ) -> (), + fn SetExtendModeY( + extendModeY: D2D1_EXTEND_MODE, + ) -> (), + fn SetInterpolationMode( + interpolationMode: D2D1_INTERPOLATION_MODE, + ) -> (), + fn SetSourceRectangle( + sourceRectangle: *const D2D1_RECT_F, + ) -> (), + fn GetImage( + image: *mut *mut ID2D1Image, + ) -> (), + fn GetExtendModeX() -> D2D1_EXTEND_MODE, + fn GetExtendModeY() -> D2D1_EXTEND_MODE, + fn GetInterpolationMode() -> D2D1_INTERPOLATION_MODE, + fn GetSourceRectangle( + sourceRectangle: *mut D2D1_RECT_F, + ) -> (), +}); +RIDL!(#[uuid(0x41343a53, 0xe41a, 0x49a2, 0x91, 0xcd, 0x21, 0x79, 0x3b, 0xbb, 0x62, 0xe5)] +interface ID2D1BitmapBrush1(ID2D1BitmapBrush1Vtbl): ID2D1BitmapBrush(ID2D1BitmapBrushVtbl) { + fn SetInterpolationMode1( + interpolationMode: D2D1_INTERPOLATION_MODE, + ) -> (), + fn GetInterpolationMode1() -> D2D1_INTERPOLATION_MODE, +}); +RIDL!(#[uuid(0x10a72a66, 0xe91c, 0x43f4, 0x99, 0x3f, 0xdd, 0xf4, 0xb8, 0x2b, 0x0b, 0x4a)] +interface ID2D1StrokeStyle1(ID2D1StrokeStyle1Vtbl): ID2D1StrokeStyle(ID2D1StrokeStyleVtbl) { + fn GetStrokeTransformType() -> D2D1_STROKE_TRANSFORM_TYPE, +}); +RIDL!(#[uuid(0x62baa2d2, 0xab54, 0x41b7, 0xb8, 0x72, 0x78, 0x7e, 0x01, 0x06, 0xa4, 0x21)] +interface ID2D1PathGeometry1(ID2D1PathGeometry1Vtbl): ID2D1PathGeometry(ID2D1PathGeometryVtbl) { + fn ComputePointAndSegmentAtLength( + length: FLOAT, + startSegment: UINT32, + worldTransform: *const D2D1_MATRIX_3X2_F, + flatteningTolerance: FLOAT, + pointDescription: *mut D2D1_POINT_DESCRIPTION, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x483473d7, 0xcd46, 0x4f9d, 0x9d, 0x3a, 0x31, 0x12, 0xaa, 0x80, 0x15, 0x9d)] +interface ID2D1Properties(ID2D1PropertiesVtbl): IUnknown(IUnknownVtbl) { + fn GetPropertyCount() -> UINT32, + fn GetPropertyName( + index: UINT32, + name: PWSTR, + nameCount: UINT32, + ) -> HRESULT, + fn GetPropertyNameLength( + index: UINT32, + ) -> UINT32, + fn GetType( + index: UINT32, + ) -> D2D1_PROPERTY_TYPE, + fn GetPropertyIndex( + name: PCWSTR, + ) -> UINT32, + fn SetValueByName( + name: PCWSTR, + prop_type: D2D1_PROPERTY_TYPE, + data: *const BYTE, + dataSize: UINT32, + ) -> HRESULT, + fn SetValue( + index: UINT32, + prop_type: D2D1_PROPERTY_TYPE, + data: *const BYTE, + dataSize: UINT32, + ) -> HRESULT, + fn GetValueByName( + name: PCWSTR, + prop_type: D2D1_PROPERTY_TYPE, + data: *mut BYTE, + dataSize: UINT32, + ) -> HRESULT, + fn GetValue( + index: UINT32, + prop_type: D2D1_PROPERTY_TYPE, + data: *mut BYTE, + dataSize: UINT32, + ) -> HRESULT, + fn GetValueSize( + index: UINT32, + ) -> UINT32, + fn GetSubProperties( + index: UINT32, + subProperties: *mut *mut ID2D1Properties, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x28211a43, 0x7d89, 0x476f, 0x81, 0x81, 0x2d, 0x61, 0x59, 0xb2, 0x20, 0xad)] +interface ID2D1Effect(ID2D1EffectVtbl): ID2D1Properties(ID2D1PropertiesVtbl) { + fn SetInput( + index: UINT32, + input: *const ID2D1Image, + invalidate: BOOL, + ) -> (), + fn SetInputCount( + inputCount: UINT32, + ) -> HRESULT, + fn GetInput( + index: UINT32, + input: *mut *mut ID2D1Image, + ) -> (), + fn GetInputCount() -> UINT32, + fn GetOutput( + outputImage: *mut *mut ID2D1Image, + ) -> (), +}); +RIDL!(#[uuid(0xa898a84c, 0x3873, 0x4588, 0xb0, 0x8b, 0xeb, 0xbf, 0x97, 0x8d, 0xf0, 0x41)] +interface ID2D1Bitmap1(ID2D1Bitmap1Vtbl): ID2D1Bitmap(ID2D1BitmapVtbl) { + fn GetColorContext( + colorContext: *mut *mut ID2D1ColorContext, + ) -> (), + fn GetOptions() -> D2D1_BITMAP_OPTIONS, + fn GetSurface( + dxgiSurface: *mut *mut IDXGISurface, + ) -> HRESULT, + fn Map( + options: D2D1_MAP_OPTIONS, + mappedRect: *mut D2D1_MAPPED_RECT, + ) -> HRESULT, + fn Unmap() -> HRESULT, +}); +RIDL!(#[uuid(0x1c4820bb, 0x5771, 0x4518, 0xa5, 0x81, 0x2f, 0xe4, 0xdd, 0x0e, 0xc6, 0x57)] +interface ID2D1ColorContext(ID2D1ColorContextVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn GetColorSpace() -> D2D1_COLOR_SPACE, + fn GetProfileSize() -> UINT32, + fn GetProfile( + profile: *mut BYTE, + profileSize: UINT32, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xae1572f4, 0x5dd0, 0x4777, 0x99, 0x8b, 0x92, 0x79, 0x47, 0x2a, 0xe6, 0x3b)] +interface ID2D1GradientStopCollection1(ID2D1GradientStopCollection1Vtbl): + ID2D1GradientStopCollection(ID2D1GradientStopCollectionVtbl) { + fn GetGradientStops1( + gradientStops: *mut D2D1_GRADIENT_STOP, + gradientStopsCount: UINT32, + ) -> (), + fn GetPreInterpolationSpace() -> D2D1_COLOR_SPACE, + fn GetPostInterpolationSpace() -> D2D1_COLOR_SPACE, + fn GetBufferPrecision() -> D2D1_BUFFER_PRECISION, + fn GetColorInterpolationMode() -> D2D1_COLOR_INTERPOLATION_MODE, +}); +RIDL!(#[uuid(0x689f1f85, 0xc72e, 0x4e33, 0x8f, 0x19, 0x85, 0x75, 0x4e, 0xfd, 0x5a, 0xce)] +interface ID2D1DrawingStateBlock1(ID2D1DrawingStateBlock1Vtbl): + ID2D1DrawingStateBlock(ID2D1DrawingStateBlockVtbl) { + fn GetDescription( + stateDescription: *mut D2D1_DRAWING_STATE_DESCRIPTION1, + ) -> (), + fn SetDescription( + stateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION1, + ) -> (), +}); +RIDL!(#[uuid(0xe8f7fe7a, 0x191c, 0x466d, 0xad, 0x95, 0x97, 0x56, 0x78, 0xbd, 0xa9, 0x98)] +interface ID2D1DeviceContext(ID2D1DeviceContextVtbl): ID2D1RenderTarget(ID2D1RenderTargetVtbl) { + fn CreateBitmap( + size: D2D1_SIZE_U, + sourceData: *const c_void, + pitch: UINT32, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES1, + bitmap: *mut *mut ID2D1Bitmap1, + ) -> HRESULT, + fn CreateBitmapFromWicBitmap( + wicBitmapSource: *const IWICBitmapSource, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES1, + bitmap: *mut *mut ID2D1Bitmap1, + ) -> HRESULT, + fn CreateColorContext( + space: D2D1_COLOR_SPACE, + profile: *const BYTE, + profileSize: UINT32, + colorContext: *mut *mut ID2D1ColorContext, + ) -> HRESULT, + fn CreateColorContextFromFilename( + filename: PCWSTR, + colorContext: *mut *mut ID2D1ColorContext, + ) -> HRESULT, + fn CreateColorContextFromWicColorContext( + wicColorContext: *const IWICColorContext, + colorContext: *mut *mut ID2D1ColorContext, + ) -> HRESULT, + fn CreateBitmapFromDxgiSurface( + surface: *const IDXGISurface, + bitmapProperties: *const D2D1_BITMAP_PROPERTIES1, + bitmap: *mut *mut ID2D1Bitmap1, + ) -> HRESULT, + fn CreateEffect( + effectId: REFCLSID, + effect: *mut *mut ID2D1Effect, + ) -> HRESULT, + fn CreateGradientStopCollection( + straightAlphaGradientStops: *const D2D1_GRADIENT_STOP, + straightAlphaGradientStopsCount: UINT32, + preInterpolationSpace: D2D1_COLOR_SPACE, + postInterpolationSpace: D2D1_COLOR_SPACE, + bufferPrecision: D2D1_BUFFER_PRECISION, + extendMode: D2D1_EXTEND_MODE, + colorInterpolationMode: D2D1_COLOR_INTERPOLATION_MODE, + gradientStopCollection1: *mut *mut ID2D1GradientStopCollection1, + ) -> HRESULT, + fn CreateImageBrush( + image: *const ID2D1Image, + imageBrushProperties: *const D2D1_IMAGE_BRUSH_PROPERTIES, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + imageBrush: *mut *mut ID2D1ImageBrush, + ) -> HRESULT, + fn CreateBitmapBrush( + bitmap: *const ID2D1Bitmap, + bitmapBrushProperties: *const D2D1_BITMAP_BRUSH_PROPERTIES1, + brushProperties: *const D2D1_BRUSH_PROPERTIES, + bitmapBrush: *mut *mut ID2D1BitmapBrush1, + ) -> HRESULT, + fn CreateCommandList( + commandList: *mut *mut ID2D1CommandList, + ) -> HRESULT, + fn IsDxgiFormatSupported( + format: DXGI_FORMAT, + ) -> BOOL, + fn IsBufferPrecisionSupported( + bufferPrecision: D2D1_BUFFER_PRECISION, + ) -> BOOL, + fn GetImageLocalBounds( + image: *const ID2D1Image, + localBounds: *mut D2D1_RECT_F, + ) -> HRESULT, + fn GetImageWorldBounds( + image: *const ID2D1Image, + worldBounds: *mut D2D1_RECT_F, + ) -> HRESULT, + fn GetGlyphRunWorldBounds( + baselineOrigin: D2D1_POINT_2F, + glyphRun: *const DWRITE_GLYPH_RUN, + measuringMode: DWRITE_MEASURING_MODE, + bounds: *mut D2D1_RECT_F, + ) -> HRESULT, + fn GetDevice( + device: *mut *mut ID2D1Device, + ) -> (), + fn SetTarget( + image: *const ID2D1Image, + ) -> (), + fn GetTarget( + image: *mut *mut ID2D1Image, + ) -> (), + fn SetRenderingControls( + renderingControls: *const D2D1_RENDERING_CONTROLS, + ) -> (), + fn GetRenderingControls( + renderingControls: *mut D2D1_RENDERING_CONTROLS, + ) -> (), + fn SetPrimitiveBlend( + primitiveBlend: D2D1_PRIMITIVE_BLEND, + ) -> (), + fn GetPrimitiveBlend() -> D2D1_PRIMITIVE_BLEND, + fn SetUnitMode( + unitMode: D2D1_UNIT_MODE, + ) -> (), + fn GetUnitMode() -> D2D1_UNIT_MODE, + fn DrawGlyphRun( + baselineOrigin: D2D1_POINT_2F, + glyphRun: *const DWRITE_GLYPH_RUN, + glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, + foregroundBrush: *const ID2D1Brush, + measuringMode: DWRITE_MEASURING_MODE, + ) -> (), + fn DrawImage( + image: *const ID2D1Image, + targetOffset: *const D2D1_POINT_2F, + imageRectangle: *const D2D1_RECT_F, + interpolationMode: D2D1_INTERPOLATION_MODE, + compositeMode: D2D1_COMPOSITE_MODE, + ) -> (), + fn DrawGdiMetafile( + gdiMetafile: *const ID2D1GdiMetafile, + targetOffset: *const D2D1_POINT_2F, + ) -> (), + fn DrawBitmap( + bitmap: *const ID2D1Bitmap, + destinationRectangle: *const D2D1_RECT_F, + opacity: FLOAT, + interpolationMode: D2D1_INTERPOLATION_MODE, + sourceRectangle: *const D2D1_RECT_F, + perspectiveTransform: *const D2D1_MATRIX_4X4_F, + ) -> (), + fn PushLayer( + layerParameters: *const D2D1_LAYER_PARAMETERS1, + layer: *const ID2D1Layer, + ) -> (), + fn InvalidateEffectInputRectangle( + effect: *const ID2D1Effect, + input: UINT32, + inputRectangle: *const D2D1_RECT_F, + ) -> HRESULT, + fn GetEffectInvalidRectangleCount( + effect: *const ID2D1Effect, + rectangleCount: *mut UINT32, + ) -> HRESULT, + fn GetEffectInvalidRectangles( + effect: *const ID2D1Effect, + rectangles: *mut D2D1_RECT_F, + rectanglesCount: UINT32, + ) -> HRESULT, + fn GetEffectRequiredInputRectangles( + renderEffect: *const ID2D1Effect, + renderImageRectangle: *const D2D1_RECT_F, + inputDescriptions: *const D2D1_EFFECT_INPUT_DESCRIPTION, + requiredInputRects: *mut D2D1_RECT_F, + inputCount: UINT32, + ) -> HRESULT, + fn FillOpacityMask( + opacityMask: *const ID2D1Bitmap, + brush: *const ID2D1Brush, + destinationRectangle: *const D2D1_RECT_F, + sourceRectangle: *const D2D1_RECT_F, + ) -> (), +}); +RIDL!(#[uuid(0x47dd575d, 0xac05, 0x4cdd, 0x80, 0x49, 0x9b, 0x02, 0xcd, 0x16, 0xf4, 0x4c)] +interface ID2D1Device(ID2D1DeviceVtbl): ID2D1Resource(ID2D1ResourceVtbl) { + fn CreateDeviceContext( + options: D2D1_DEVICE_CONTEXT_OPTIONS, + deviceContext: *mut *mut ID2D1DeviceContext, + ) -> HRESULT, + fn CreatePrintControl( + wicFactory: *const IWICImagingFactory, + documentTarget: *const IPrintDocumentPackageTarget, + printControlProperties: *const D2D1_PRINT_CONTROL_PROPERTIES, + printControl: *mut *mut ID2D1PrintControl, + ) -> HRESULT, + fn SetMaximumTextureMemory( + maximumInBytes: UINT64, + ) -> (), + fn GetMaximumTextureMemory() -> UINT64, + fn ClearResources( + millisecondsSinceUse: UINT32, + ) -> (), +}); +RIDL!(#[uuid(0xbb12d362, 0xdaee, 0x4b9a, 0xaa, 0x1d, 0x14, 0xba, 0x40, 0x1c, 0xfa, 0x1f)] +interface ID2D1Factory1(ID2D1Factory1Vtbl): ID2D1Factory(ID2D1FactoryVtbl) { + fn CreateDevice( + dxgiDevice: *const IDXGIDevice, + d2dDevice: *mut *mut ID2D1Device, + ) -> HRESULT, + fn CreateStrokeStyle( + strokeStyleProperties: *const D2D1_STROKE_STYLE_PROPERTIES1, + dashes: *const FLOAT, + dashesCount: UINT32, + strokeStyle: *mut *mut ID2D1StrokeStyle1, + ) -> HRESULT, + fn CreatePathGeometry( + pathGeometry: *mut *mut ID2D1PathGeometry1, + ) -> HRESULT, + fn CreateDrawingStateBlock( + drawingStateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION1, + textRenderingParams: *const IDWriteRenderingParams, + drawingStateBlock: *mut *mut ID2D1DrawingStateBlock1, + ) -> HRESULT, + fn CreateGdiMetafile( + metafileStream: *const IStream, + metafile: *mut *mut ID2D1GdiMetafile, + ) -> HRESULT, + fn RegisterEffectFromStream( + classId: REFCLSID, + propertyXml: *const IStream, + bindings: *const D2D1_PROPERTY_BINDING, + bindingsCount: UINT32, + effectFactory: PD2D1_EFFECT_FACTORY, + ) -> HRESULT, + fn RegisterEffectFromString( + classId: REFCLSID, + propertyXml: PCWSTR, + bindings: *const D2D1_PROPERTY_BINDING, + bindingsCount: UINT32, + effectFactory: PD2D1_EFFECT_FACTORY, + ) -> HRESULT, + fn UnregisterEffect( + classId: REFCLSID, + ) -> HRESULT, + fn GetRegisteredEffects( + effects: *mut CLSID, + effectsCount: UINT32, + effectsReturned: *mut UINT32, + effectsRegistered: *mut UINT32, + ) -> HRESULT, + fn GetEffectProperties( + effectId: REFCLSID, + properties: *mut *mut ID2D1Properties, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x31e6e7bc, 0xe0ff, 0x4d46, 0x8c, 0x64, 0xa0, 0xa8, 0xc4, 0x1c, 0x15, 0xd3)] +interface ID2D1Multithread(ID2D1MultithreadVtbl): IUnknown(IUnknownVtbl) { + fn GetMultithreadProtected() -> BOOL, + fn Enter() -> (), + fn Leave() -> (), +}); +extern "system" { + pub fn D2D1CreateDevice( + dxgiDevice: *const IDXGIDevice, + creationProperties: *const D2D1_CREATION_PROPERTIES, + d2dDevice: *mut *mut ID2D1Device + ) -> HRESULT; + pub fn D2D1CreateDeviceContext( + dxgiSurface: *const IDXGISurface, + creationProperties: *const D2D1_CREATION_PROPERTIES, + d2dDeviceContext: *mut *mut ID2D1DeviceContext + ) -> HRESULT; + pub fn D2D1ConvertColorSpace( + sourceColorSpace: D2D1_COLOR_SPACE, + destinationColorSpace: D2D1_COLOR_SPACE, + color: *const D2D1_COLOR_F + ) -> D2D1_COLOR_F; + pub fn D2D1SinCos( + angle: FLOAT, + s: *mut FLOAT, + c: *mut FLOAT + ) -> (); + pub fn D2D1Tan( + angle: FLOAT + ) -> FLOAT; + pub fn D2D1Vec3Length( + x: FLOAT, + y: FLOAT, + z: FLOAT + ) -> FLOAT; +} diff --git a/src/vendor/winapi/src/um/d2d1_2.rs b/src/vendor/winapi/src/um/d2d1_2.rs new file mode 100644 index 0000000000..6c5f563fc0 --- /dev/null +++ b/src/vendor/winapi/src/um/d2d1_2.rs @@ -0,0 +1,68 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of d2d1_2.h +use shared::dxgi::IDXGIDevice; +use shared::minwindef::FLOAT; +use um::d2d1::{ID2D1Brush, ID2D1Geometry, ID2D1StrokeStyle}; +use um::d2d1::{ID2D1Resource, ID2D1ResourceVtbl}; +use um::d2d1_1::{D2D1_DEVICE_CONTEXT_OPTIONS, D2D1_PRIMITIVE_BLEND}; +use um::d2d1_1::{ID2D1DeviceContext, ID2D1DeviceContextVtbl}; +use um::d2d1_1::{ID2D1Device, ID2D1DeviceVtbl}; +use um::d2d1_1::{ID2D1Factory1, ID2D1Factory1Vtbl}; +use um::d2d1_1::{ID2D1CommandSink, ID2D1CommandSinkVtbl}; +use um::winnt::HRESULT; +ENUM!{enum D2D1_RENDERING_PRIORITY { + D2D1_RENDERING_PRIORITY_NORMAL = 0, + D2D1_RENDERING_PRIORITY_LOW = 1, + D2D1_RENDERING_PRIORITY_FORCE_DWORD = 0xffffffff, +}} +RIDL!{#[uuid(0xa16907d7, 0xbc02, 0x4801, 0x99, 0xe8, 0x8c, 0xf7, 0xf4, 0x85, 0xf7, 0x74)] +interface ID2D1GeometryRealization(ID2D1GeometryRealizationVtbl): ID2D1Resource(ID2D1ResourceVtbl) { +}} +RIDL!{#[uuid(0xd37f57e4, 0x6908, 0x459f, 0xa1, 0x99, 0xe7, 0x2f, 0x24, 0xf7, 0x99, 0x87)] +interface ID2D1DeviceContext1(ID2D1DeviceContext1Vtbl): ID2D1DeviceContext(ID2D1DeviceContextVtbl) { + fn CreateFilledGeometryRealization( + geometry: *mut ID2D1Geometry, + flatteningTolerance: FLOAT, + geometryRealization: *mut *mut ID2D1GeometryRealization, + ) -> HRESULT, + fn CreateStrokedGeometryRealization( + geometry: *mut ID2D1Geometry, + flatteningTolerance: FLOAT, + strokeWidth: FLOAT, + strokeStyle: *mut ID2D1StrokeStyle, + geometryRealization: *mut *mut ID2D1GeometryRealization, + ) -> HRESULT, + fn DrawGeometryRealization( + geometryRealization: *mut ID2D1GeometryRealization, + brush: *mut ID2D1Brush, + ) -> (), +}} +RIDL!{#[uuid(0xd21768e1, 0x23a4, 0x4823, 0xa1, 0x4b, 0x7c, 0x3e, 0xba, 0x85, 0xd6, 0x58)] +interface ID2D1Device1(ID2D1Device1Vtbl): ID2D1Device(ID2D1DeviceVtbl) { + fn GetRenderingPriority() -> D2D1_RENDERING_PRIORITY, + fn SetRenderingPriority( + renderingPriority: D2D1_RENDERING_PRIORITY, + ) -> (), + fn CreateDeviceContext( + options: D2D1_DEVICE_CONTEXT_OPTIONS, + deviceContext1: *mut *mut ID2D1DeviceContext1, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x94f81a73, 0x9212, 0x4376, 0x9c, 0x58, 0xb1, 0x6a, 0x3a, 0x0d, 0x39, 0x92)] +interface ID2D1Factory2(ID2D1Factory2Vtbl): ID2D1Factory1(ID2D1Factory1Vtbl) { + fn CreateDevice( + dxgiDevice: *mut IDXGIDevice, + d2dDevice1: *mut *mut ID2D1Device1, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x9eb767fd, 0x4269, 0x4467, 0xb8, 0xc2, 0xeb, 0x30, 0xcb, 0x30, 0x57, 0x43)] +interface ID2D1CommandSink1(ID2D1CommandSink1Vtbl): ID2D1CommandSink(ID2D1CommandSinkVtbl) { + fn SetPrimitiveBlend1( + primitiveBlend: D2D1_PRIMITIVE_BLEND, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/d2d1effectauthor.rs b/src/vendor/winapi/src/um/d2d1effectauthor.rs new file mode 100644 index 0000000000..6790d4bff8 --- /dev/null +++ b/src/vendor/winapi/src/um/d2d1effectauthor.rs @@ -0,0 +1,27 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +// TODO:It is a minimal implementation. +use shared::basetsd::UINT32; +use shared::minwindef::BYTE; +use shared::ntdef::{HRESULT, PCWSTR}; +use um::unknwnbase::IUnknown; +FN!{stdcall PD2D1_PROPERTY_SET_FUNCTION( + effect: *const IUnknown, + data: *const BYTE, + dataSize: UINT32, +) -> HRESULT} +FN!{stdcall PD2D1_PROPERTY_GET_FUNCTION( + effect: *const IUnknown, + data: *mut BYTE, + dataSize: UINT32, + actualSize: *mut UINT32, +) -> HRESULT} +STRUCT!{struct D2D1_PROPERTY_BINDING { + propertyName: PCWSTR, + setFunction: PD2D1_PROPERTY_SET_FUNCTION, + getFunction: PD2D1_PROPERTY_GET_FUNCTION, +}} diff --git a/src/vendor/winapi/src/um/d2d1effects.rs b/src/vendor/winapi/src/um/d2d1effects.rs new file mode 100644 index 0000000000..817ea50430 --- /dev/null +++ b/src/vendor/winapi/src/um/d2d1effects.rs @@ -0,0 +1,618 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of d2d1effects.h +DEFINE_GUID!{CLSID_D2D12DAffineTransform, + 0x6AA97485, 0x6354, 0x4cfc, 0x90, 0x8C, 0xE4, 0xA7, 0x4F, 0x62, 0xC9, 0x6C} +DEFINE_GUID!{CLSID_D2D13DPerspectiveTransform, + 0xC2844D0B, 0x3D86, 0x46e7, 0x85, 0xBA, 0x52, 0x6C, 0x92, 0x40, 0xF3, 0xFB} +DEFINE_GUID!{CLSID_D2D13DTransform, + 0xe8467b04, 0xec61, 0x4b8a, 0xb5, 0xde, 0xd4, 0xd7, 0x3d, 0xeb, 0xea, 0x5a} +DEFINE_GUID!{CLSID_D2D1ArithmeticComposite, + 0xfc151437, 0x049a, 0x4784, 0xa2, 0x4a, 0xf1, 0xc4, 0xda, 0xf2, 0x09, 0x87} +DEFINE_GUID!{CLSID_D2D1Atlas, + 0x913e2be4, 0xfdcf, 0x4fe2, 0xa5, 0xf0, 0x24, 0x54, 0xf1, 0x4f, 0xf4, 0x08} +DEFINE_GUID!{CLSID_D2D1BitmapSource, + 0x5fb6c24d, 0xc6dd, 0x4231, 0x94, 0x4, 0x50, 0xf4, 0xd5, 0xc3, 0x25, 0x2d} +DEFINE_GUID!{CLSID_D2D1Blend, + 0x81c5b77b, 0x13f8, 0x4cdd, 0xad, 0x20, 0xc8, 0x90, 0x54, 0x7a, 0xc6, 0x5d} +DEFINE_GUID!{CLSID_D2D1Border, + 0x2A2D49C0, 0x4ACF, 0x43c7, 0x8C, 0x6A, 0x7C, 0x4A, 0x27, 0x87, 0x4D, 0x27} +DEFINE_GUID!{CLSID_D2D1Brightness, + 0x8cea8d1e, 0x77b0, 0x4986, 0xb3, 0xb9, 0x2f, 0x0c, 0x0e, 0xae, 0x78, 0x87} +DEFINE_GUID!{CLSID_D2D1ColorManagement, + 0x1A28524C, 0xFDD6, 0x4AA4, 0xAE, 0x8F, 0x83, 0x7E, 0xB8, 0x26, 0x7B, 0x37} +DEFINE_GUID!{CLSID_D2D1ColorMatrix, + 0x921F03D6, 0x641C, 0x47DF, 0x85, 0x2D, 0xB4, 0xBB, 0x61, 0x53, 0xAE, 0x11} +DEFINE_GUID!{CLSID_D2D1Composite, + 0x48fc9f51, 0xf6ac, 0x48f1, 0x8b, 0x58, 0x3b, 0x28, 0xac, 0x46, 0xf7, 0x6d} +DEFINE_GUID!{CLSID_D2D1ConvolveMatrix, + 0x407f8c08, 0x5533, 0x4331, 0xa3, 0x41, 0x23, 0xcc, 0x38, 0x77, 0x84, 0x3e} +DEFINE_GUID!{CLSID_D2D1Crop, + 0xE23F7110, 0x0E9A, 0x4324, 0xAF, 0x47, 0x6A, 0x2C, 0x0C, 0x46, 0xF3, 0x5B} +DEFINE_GUID!{CLSID_D2D1DirectionalBlur, + 0x174319a6, 0x58e9, 0x49b2, 0xbb, 0x63, 0xca, 0xf2, 0xc8, 0x11, 0xa3, 0xdb} +DEFINE_GUID!{CLSID_D2D1DiscreteTransfer, + 0x90866fcd, 0x488e, 0x454b, 0xaf, 0x06, 0xe5, 0x04, 0x1b, 0x66, 0xc3, 0x6c} +DEFINE_GUID!{CLSID_D2D1DisplacementMap, + 0xedc48364, 0x417, 0x4111, 0x94, 0x50, 0x43, 0x84, 0x5f, 0xa9, 0xf8, 0x90} +DEFINE_GUID!{CLSID_D2D1DistantDiffuse, + 0x3e7efd62, 0xa32d, 0x46d4, 0xa8, 0x3c, 0x52, 0x78, 0x88, 0x9a, 0xc9, 0x54} +DEFINE_GUID!{CLSID_D2D1DistantSpecular, + 0x428c1ee5, 0x77b8, 0x4450, 0x8a, 0xb5, 0x72, 0x21, 0x9c, 0x21, 0xab, 0xda} +DEFINE_GUID!{CLSID_D2D1DpiCompensation, + 0x6c26c5c7, 0x34e0, 0x46fc, 0x9c, 0xfd, 0xe5, 0x82, 0x37, 0x6, 0xe2, 0x28} +DEFINE_GUID!{CLSID_D2D1Flood, + 0x61c23c20, 0xae69, 0x4d8e, 0x94, 0xcf, 0x50, 0x07, 0x8d, 0xf6, 0x38, 0xf2} +DEFINE_GUID!{CLSID_D2D1GammaTransfer, + 0x409444c4, 0xc419, 0x41a0, 0xb0, 0xc1, 0x8c, 0xd0, 0xc0, 0xa1, 0x8e, 0x42} +DEFINE_GUID!{CLSID_D2D1GaussianBlur, + 0x1feb6d69, 0x2fe6, 0x4ac9, 0x8c, 0x58, 0x1d, 0x7f, 0x93, 0xe7, 0xa6, 0xa5} +DEFINE_GUID!{CLSID_D2D1Scale, + 0x9daf9369, 0x3846, 0x4d0e, 0xa4, 0x4e, 0xc, 0x60, 0x79, 0x34, 0xa5, 0xd7} +DEFINE_GUID!{CLSID_D2D1Histogram, + 0x881db7d0, 0xf7ee, 0x4d4d, 0xa6, 0xd2, 0x46, 0x97, 0xac, 0xc6, 0x6e, 0xe8} +DEFINE_GUID!{CLSID_D2D1HueRotation, + 0x0f4458ec, 0x4b32, 0x491b, 0x9e, 0x85, 0xbd, 0x73, 0xf4, 0x4d, 0x3e, 0xb6} +DEFINE_GUID!{CLSID_D2D1LinearTransfer, + 0xad47c8fd, 0x63ef, 0x4acc, 0x9b, 0x51, 0x67, 0x97, 0x9c, 0x03, 0x6c, 0x06} +DEFINE_GUID!{CLSID_D2D1LuminanceToAlpha, + 0x41251ab7, 0x0beb, 0x46f8, 0x9d, 0xa7, 0x59, 0xe9, 0x3f, 0xcc, 0xe5, 0xde} +DEFINE_GUID!{CLSID_D2D1Morphology, + 0xeae6c40d, 0x626a, 0x4c2d, 0xbf, 0xcb, 0x39, 0x10, 0x01, 0xab, 0xe2, 0x02} +DEFINE_GUID!{CLSID_D2D1OpacityMetadata, + 0x6c53006a, 0x4450, 0x4199, 0xaa, 0x5b, 0xad, 0x16, 0x56, 0xfe, 0xce, 0x5e} +DEFINE_GUID!{CLSID_D2D1PointDiffuse, + 0xb9e303c3, 0xc08c, 0x4f91, 0x8b, 0x7b, 0x38, 0x65, 0x6b, 0xc4, 0x8c, 0x20} +DEFINE_GUID!{CLSID_D2D1PointSpecular, + 0x09c3ca26, 0x3ae2, 0x4f09, 0x9e, 0xbc, 0xed, 0x38, 0x65, 0xd5, 0x3f, 0x22} +DEFINE_GUID!{CLSID_D2D1Premultiply, + 0x06eab419, 0xdeed, 0x4018, 0x80, 0xd2, 0x3e, 0x1d, 0x47, 0x1a, 0xde, 0xb2} +DEFINE_GUID!{CLSID_D2D1Saturation, + 0x5cb2d9cf, 0x327d, 0x459f, 0xa0, 0xce, 0x40, 0xc0, 0xb2, 0x08, 0x6b, 0xf7} +DEFINE_GUID!{CLSID_D2D1Shadow, + 0xC67EA361, 0x1863, 0x4e69, 0x89, 0xDB, 0x69, 0x5D, 0x3E, 0x9A, 0x5B, 0x6B} +DEFINE_GUID!{CLSID_D2D1SpotDiffuse, + 0x818a1105, 0x7932, 0x44f4, 0xaa, 0x86, 0x08, 0xae, 0x7b, 0x2f, 0x2c, 0x93} +DEFINE_GUID!{CLSID_D2D1SpotSpecular, + 0xedae421e, 0x7654, 0x4a37, 0x9d, 0xb8, 0x71, 0xac, 0xc1, 0xbe, 0xb3, 0xc1} +DEFINE_GUID!{CLSID_D2D1TableTransfer, + 0x5bf818c3, 0x5e43, 0x48cb, 0xb6, 0x31, 0x86, 0x83, 0x96, 0xd6, 0xa1, 0xd4} +DEFINE_GUID!{CLSID_D2D1Tile, + 0xB0784138, 0x3B76, 0x4bc5, 0xB1, 0x3B, 0x0F, 0xA2, 0xAD, 0x02, 0x65, 0x9F} +DEFINE_GUID!{CLSID_D2D1Turbulence, + 0xCF2BB6AE, 0x889A, 0x4ad7, 0xBA, 0x29, 0xA2, 0xFD, 0x73, 0x2C, 0x9F, 0xC9} +DEFINE_GUID!{CLSID_D2D1UnPremultiply, + 0xfb9ac489, 0xad8d, 0x41ed, 0x99, 0x99, 0xbb, 0x63, 0x47, 0xd1, 0x10, 0xf7} +ENUM!{enum D2D1_BORDER_MODE { + D2D1_BORDER_MODE_SOFT = 0, + D2D1_BORDER_MODE_HARD = 1, + D2D1_BORDER_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_CHANNEL_SELECTOR { + D2D1_CHANNEL_SELECTOR_R = 0, + D2D1_CHANNEL_SELECTOR_G = 1, + D2D1_CHANNEL_SELECTOR_B = 2, + D2D1_CHANNEL_SELECTOR_A = 3, + D2D1_CHANNEL_SELECTOR_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BITMAPSOURCE_ORIENTATION { + D2D1_BITMAPSOURCE_ORIENTATION_DEFAULT = 1, + D2D1_BITMAPSOURCE_ORIENTATION_FLIP_HORIZONTAL = 2, + D2D1_BITMAPSOURCE_ORIENTATION_ROTATE_CLOCKWISE180 = 3, + D2D1_BITMAPSOURCE_ORIENTATION_ROTATE_CLOCKWISE180_FLIP_HORIZONTAL = 4, + D2D1_BITMAPSOURCE_ORIENTATION_ROTATE_CLOCKWISE270_FLIP_HORIZONTAL = 5, + D2D1_BITMAPSOURCE_ORIENTATION_ROTATE_CLOCKWISE90 = 6, + D2D1_BITMAPSOURCE_ORIENTATION_ROTATE_CLOCKWISE90_FLIP_HORIZONTAL = 7, + D2D1_BITMAPSOURCE_ORIENTATION_ROTATE_CLOCKWISE270 = 8, + D2D1_BITMAPSOURCE_ORIENTATION_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_GAUSSIANBLUR_PROP { + D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION = 0, + D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION = 1, + D2D1_GAUSSIANBLUR_PROP_BORDER_MODE = 2, + D2D1_GAUSSIANBLUR_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_GAUSSIANBLUR_OPTIMIZATION { + D2D1_GAUSSIANBLUR_OPTIMIZATION_SPEED = 0, + D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED = 1, + D2D1_GAUSSIANBLUR_OPTIMIZATION_QUALITY = 2, + D2D1_GAUSSIANBLUR_OPTIMIZATION_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DIRECTIONALBLUR_PROP { + D2D1_DIRECTIONALBLUR_PROP_STANDARD_DEVIATION = 0, + D2D1_DIRECTIONALBLUR_PROP_ANGLE = 1, + D2D1_DIRECTIONALBLUR_PROP_OPTIMIZATION = 2, + D2D1_DIRECTIONALBLUR_PROP_BORDER_MODE = 3, + D2D1_DIRECTIONALBLUR_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DIRECTIONALBLUR_OPTIMIZATION { + D2D1_DIRECTIONALBLUR_OPTIMIZATION_SPEED = 0, + D2D1_DIRECTIONALBLUR_OPTIMIZATION_BALANCED = 1, + D2D1_DIRECTIONALBLUR_OPTIMIZATION_QUALITY = 2, + D2D1_DIRECTIONALBLUR_OPTIMIZATION_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SHADOW_PROP { + D2D1_SHADOW_PROP_BLUR_STANDARD_DEVIATION = 0, + D2D1_SHADOW_PROP_COLOR = 1, + D2D1_SHADOW_PROP_OPTIMIZATION = 2, + D2D1_SHADOW_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SHADOW_OPTIMIZATION { + D2D1_SHADOW_OPTIMIZATION_SPEED = 0, + D2D1_SHADOW_OPTIMIZATION_BALANCED = 1, + D2D1_SHADOW_OPTIMIZATION_QUALITY = 2, + D2D1_SHADOW_OPTIMIZATION_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BLEND_PROP { + D2D1_BLEND_PROP_MODE = 0, + D2D1_BLEND_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BLEND_MODE { + D2D1_BLEND_MODE_MULTIPLY = 0, + D2D1_BLEND_MODE_SCREEN = 1, + D2D1_BLEND_MODE_DARKEN = 2, + D2D1_BLEND_MODE_LIGHTEN = 3, + D2D1_BLEND_MODE_DISSOLVE = 4, + D2D1_BLEND_MODE_COLOR_BURN = 5, + D2D1_BLEND_MODE_LINEAR_BURN = 6, + D2D1_BLEND_MODE_DARKER_COLOR = 7, + D2D1_BLEND_MODE_LIGHTER_COLOR = 8, + D2D1_BLEND_MODE_COLOR_DODGE = 9, + D2D1_BLEND_MODE_LINEAR_DODGE = 10, + D2D1_BLEND_MODE_OVERLAY = 11, + D2D1_BLEND_MODE_SOFT_LIGHT = 12, + D2D1_BLEND_MODE_HARD_LIGHT = 13, + D2D1_BLEND_MODE_VIVID_LIGHT = 14, + D2D1_BLEND_MODE_LINEAR_LIGHT = 15, + D2D1_BLEND_MODE_PIN_LIGHT = 16, + D2D1_BLEND_MODE_HARD_MIX = 17, + D2D1_BLEND_MODE_DIFFERENCE = 18, + D2D1_BLEND_MODE_EXCLUSION = 19, + D2D1_BLEND_MODE_HUE = 20, + D2D1_BLEND_MODE_SATURATION = 21, + D2D1_BLEND_MODE_COLOR = 22, + D2D1_BLEND_MODE_LUMINOSITY = 23, + D2D1_BLEND_MODE_SUBTRACT = 24, + D2D1_BLEND_MODE_DIVISION = 25, + D2D1_BLEND_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SATURATION_PROP { + D2D1_SATURATION_PROP_SATURATION = 0, + D2D1_SATURATION_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_HUEROTATION_PROP { + D2D1_HUEROTATION_PROP_ANGLE = 0, + D2D1_HUEROTATION_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLORMATRIX_PROP { + D2D1_COLORMATRIX_PROP_COLOR_MATRIX = 0, + D2D1_COLORMATRIX_PROP_ALPHA_MODE = 1, + D2D1_COLORMATRIX_PROP_CLAMP_OUTPUT = 2, + D2D1_COLORMATRIX_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLORMATRIX_ALPHA_MODE { + D2D1_COLORMATRIX_ALPHA_MODE_PREMULTIPLIED = 1, + D2D1_COLORMATRIX_ALPHA_MODE_STRAIGHT = 2, + D2D1_COLORMATRIX_ALPHA_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BITMAPSOURCE_PROP { + D2D1_BITMAPSOURCE_PROP_WIC_BITMAP_SOURCE = 0, + D2D1_BITMAPSOURCE_PROP_SCALE = 1, + D2D1_BITMAPSOURCE_PROP_INTERPOLATION_MODE = 2, + D2D1_BITMAPSOURCE_PROP_ENABLE_DPI_CORRECTION = 3, + D2D1_BITMAPSOURCE_PROP_ALPHA_MODE = 4, + D2D1_BITMAPSOURCE_PROP_ORIENTATION = 5, + D2D1_BITMAPSOURCE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BITMAPSOURCE_INTERPOLATION_MODE { + D2D1_BITMAPSOURCE_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + D2D1_BITMAPSOURCE_INTERPOLATION_MODE_LINEAR = 1, + D2D1_BITMAPSOURCE_INTERPOLATION_MODE_CUBIC = 2, + D2D1_BITMAPSOURCE_INTERPOLATION_MODE_FANT = 6, + D2D1_BITMAPSOURCE_INTERPOLATION_MODE_MIPMAP_LINEAR = 7, + D2D1_BITMAPSOURCE_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BITMAPSOURCE_ALPHA_MODE { + D2D1_BITMAPSOURCE_ALPHA_MODE_PREMULTIPLIED = 1, + D2D1_BITMAPSOURCE_ALPHA_MODE_STRAIGHT = 2, + D2D1_BITMAPSOURCE_ALPHA_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COMPOSITE_PROP { + D2D1_COMPOSITE_PROP_MODE = 0, + D2D1_COMPOSITE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_3DTRANSFORM_PROP { + D2D1_3DTRANSFORM_PROP_INTERPOLATION_MODE = 0, + D2D1_3DTRANSFORM_PROP_BORDER_MODE = 1, + D2D1_3DTRANSFORM_PROP_TRANSFORM_MATRIX = 2, + D2D1_3DTRANSFORM_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_3DTRANSFORM_INTERPOLATION_MODE { + D2D1_3DTRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + D2D1_3DTRANSFORM_INTERPOLATION_MODE_LINEAR = 1, + D2D1_3DTRANSFORM_INTERPOLATION_MODE_CUBIC = 2, + D2D1_3DTRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_3DTRANSFORM_INTERPOLATION_MODE_ANISOTROPIC = 4, + D2D1_3DTRANSFORM_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_3DPERSPECTIVETRANSFORM_PROP { + D2D1_3DPERSPECTIVETRANSFORM_PROP_INTERPOLATION_MODE = 0, + D2D1_3DPERSPECTIVETRANSFORM_PROP_BORDER_MODE = 1, + D2D1_3DPERSPECTIVETRANSFORM_PROP_DEPTH = 2, + D2D1_3DPERSPECTIVETRANSFORM_PROP_PERSPECTIVE_ORIGIN = 3, + D2D1_3DPERSPECTIVETRANSFORM_PROP_LOCAL_OFFSET = 4, + D2D1_3DPERSPECTIVETRANSFORM_PROP_GLOBAL_OFFSET = 5, + D2D1_3DPERSPECTIVETRANSFORM_PROP_ROTATION_ORIGIN = 6, + D2D1_3DPERSPECTIVETRANSFORM_PROP_ROTATION = 7, + D2D1_3DPERSPECTIVETRANSFORM_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE { + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_LINEAR = 1, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_CUBIC = 2, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC = 4, + D2D1_3DPERSPECTIVETRANSFORM_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_2DAFFINETRANSFORM_PROP { + D2D1_2DAFFINETRANSFORM_PROP_INTERPOLATION_MODE = 0, + D2D1_2DAFFINETRANSFORM_PROP_BORDER_MODE = 1, + D2D1_2DAFFINETRANSFORM_PROP_TRANSFORM_MATRIX = 2, + D2D1_2DAFFINETRANSFORM_PROP_SHARPNESS = 3, + D2D1_2DAFFINETRANSFORM_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE { + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR = 1, + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_CUBIC = 2, + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC = 4, + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DPICOMPENSATION_PROP { + D2D1_DPICOMPENSATION_PROP_INTERPOLATION_MODE = 0, + D2D1_DPICOMPENSATION_PROP_BORDER_MODE = 1, + D2D1_DPICOMPENSATION_PROP_INPUT_DPI = 2, + D2D1_DPICOMPENSATION_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DPICOMPENSATION_INTERPOLATION_MODE { + D2D1_DPICOMPENSATION_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + D2D1_DPICOMPENSATION_INTERPOLATION_MODE_LINEAR = 1, + D2D1_DPICOMPENSATION_INTERPOLATION_MODE_CUBIC = 2, + D2D1_DPICOMPENSATION_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_DPICOMPENSATION_INTERPOLATION_MODE_ANISOTROPIC = 4, + D2D1_DPICOMPENSATION_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_DPICOMPENSATION_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SCALE_PROP { + D2D1_SCALE_PROP_SCALE = 0, + D2D1_SCALE_PROP_CENTER_POINT = 1, + D2D1_SCALE_PROP_INTERPOLATION_MODE = 2, + D2D1_SCALE_PROP_BORDER_MODE = 3, + D2D1_SCALE_PROP_SHARPNESS = 4, + D2D1_SCALE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SCALE_INTERPOLATION_MODE { + D2D1_SCALE_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + D2D1_SCALE_INTERPOLATION_MODE_LINEAR = 1, + D2D1_SCALE_INTERPOLATION_MODE_CUBIC = 2, + D2D1_SCALE_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_SCALE_INTERPOLATION_MODE_ANISOTROPIC = 4, + D2D1_SCALE_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_SCALE_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_TURBULENCE_PROP { + D2D1_TURBULENCE_PROP_OFFSET = 0, + D2D1_TURBULENCE_PROP_SIZE = 1, + D2D1_TURBULENCE_PROP_BASE_FREQUENCY = 2, + D2D1_TURBULENCE_PROP_NUM_OCTAVES = 3, + D2D1_TURBULENCE_PROP_SEED = 4, + D2D1_TURBULENCE_PROP_NOISE = 5, + D2D1_TURBULENCE_PROP_STITCHABLE = 6, + D2D1_TURBULENCE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_TURBULENCE_NOISE { + D2D1_TURBULENCE_NOISE_FRACTAL_SUM = 0, + D2D1_TURBULENCE_NOISE_TURBULENCE = 1, + D2D1_TURBULENCE_NOISE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DISPLACEMENTMAP_PROP { + D2D1_DISPLACEMENTMAP_PROP_SCALE = 0, + D2D1_DISPLACEMENTMAP_PROP_X_CHANNEL_SELECT = 1, + D2D1_DISPLACEMENTMAP_PROP_Y_CHANNEL_SELECT = 2, + D2D1_DISPLACEMENTMAP_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLORMANAGEMENT_PROP { + D2D1_COLORMANAGEMENT_PROP_SOURCE_COLOR_CONTEXT = 0, + D2D1_COLORMANAGEMENT_PROP_SOURCE_RENDERING_INTENT = 1, + D2D1_COLORMANAGEMENT_PROP_DESTINATION_COLOR_CONTEXT = 2, + D2D1_COLORMANAGEMENT_PROP_DESTINATION_RENDERING_INTENT = 3, + D2D1_COLORMANAGEMENT_PROP_ALPHA_MODE = 4, + D2D1_COLORMANAGEMENT_PROP_QUALITY = 5, + D2D1_COLORMANAGEMENT_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLORMANAGEMENT_ALPHA_MODE { + D2D1_COLORMANAGEMENT_ALPHA_MODE_PREMULTIPLIED = 1, + D2D1_COLORMANAGEMENT_ALPHA_MODE_STRAIGHT = 2, + D2D1_COLORMANAGEMENT_ALPHA_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLORMANAGEMENT_QUALITY { + D2D1_COLORMANAGEMENT_QUALITY_PROOF = 0, + D2D1_COLORMANAGEMENT_QUALITY_NORMAL = 1, + D2D1_COLORMANAGEMENT_QUALITY_BEST = 2, + D2D1_COLORMANAGEMENT_QUALITY_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_COLORMANAGEMENT_RENDERING_INTENT { + D2D1_COLORMANAGEMENT_RENDERING_INTENT_PERCEPTUAL = 0, + D2D1_COLORMANAGEMENT_RENDERING_INTENT_RELATIVE_COLORIMETRIC = 1, + D2D1_COLORMANAGEMENT_RENDERING_INTENT_SATURATION = 2, + D2D1_COLORMANAGEMENT_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC = 3, + D2D1_COLORMANAGEMENT_RENDERING_INTENT_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_HISTOGRAM_PROP { + D2D1_HISTOGRAM_PROP_NUM_BINS = 0, + D2D1_HISTOGRAM_PROP_CHANNEL_SELECT = 1, + D2D1_HISTOGRAM_PROP_HISTOGRAM_OUTPUT = 2, + D2D1_HISTOGRAM_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_POINTSPECULAR_PROP { + D2D1_POINTSPECULAR_PROP_LIGHT_POSITION = 0, + D2D1_POINTSPECULAR_PROP_SPECULAR_EXPONENT = 1, + D2D1_POINTSPECULAR_PROP_SPECULAR_CONSTANT = 2, + D2D1_POINTSPECULAR_PROP_SURFACE_SCALE = 3, + D2D1_POINTSPECULAR_PROP_COLOR = 4, + D2D1_POINTSPECULAR_PROP_KERNEL_UNIT_LENGTH = 5, + D2D1_POINTSPECULAR_PROP_SCALE_MODE = 6, + D2D1_POINTSPECULAR_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_POINTSPECULAR_SCALE_MODE { + D2D1_POINTSPECULAR_SCALE_MODE_NEAREST_NEIGHBOR = 0, + D2D1_POINTSPECULAR_SCALE_MODE_LINEAR = 1, + D2D1_POINTSPECULAR_SCALE_MODE_CUBIC = 2, + D2D1_POINTSPECULAR_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_POINTSPECULAR_SCALE_MODE_ANISOTROPIC = 4, + D2D1_POINTSPECULAR_SCALE_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_POINTSPECULAR_SCALE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SPOTSPECULAR_PROP { + D2D1_SPOTSPECULAR_PROP_LIGHT_POSITION = 0, + D2D1_SPOTSPECULAR_PROP_POINTS_AT = 1, + D2D1_SPOTSPECULAR_PROP_FOCUS = 2, + D2D1_SPOTSPECULAR_PROP_LIMITING_CONE_ANGLE = 3, + D2D1_SPOTSPECULAR_PROP_SPECULAR_EXPONENT = 4, + D2D1_SPOTSPECULAR_PROP_SPECULAR_CONSTANT = 5, + D2D1_SPOTSPECULAR_PROP_SURFACE_SCALE = 6, + D2D1_SPOTSPECULAR_PROP_COLOR = 7, + D2D1_SPOTSPECULAR_PROP_KERNEL_UNIT_LENGTH = 8, + D2D1_SPOTSPECULAR_PROP_SCALE_MODE = 9, + D2D1_SPOTSPECULAR_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SPOTSPECULAR_SCALE_MODE { + D2D1_SPOTSPECULAR_SCALE_MODE_NEAREST_NEIGHBOR = 0, + D2D1_SPOTSPECULAR_SCALE_MODE_LINEAR = 1, + D2D1_SPOTSPECULAR_SCALE_MODE_CUBIC = 2, + D2D1_SPOTSPECULAR_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_SPOTSPECULAR_SCALE_MODE_ANISOTROPIC = 4, + D2D1_SPOTSPECULAR_SCALE_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_SPOTSPECULAR_SCALE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DISTANTSPECULAR_PROP { + D2D1_DISTANTSPECULAR_PROP_AZIMUTH = 0, + D2D1_DISTANTSPECULAR_PROP_ELEVATION = 1, + D2D1_DISTANTSPECULAR_PROP_SPECULAR_EXPONENT = 2, + D2D1_DISTANTSPECULAR_PROP_SPECULAR_CONSTANT = 3, + D2D1_DISTANTSPECULAR_PROP_SURFACE_SCALE = 4, + D2D1_DISTANTSPECULAR_PROP_COLOR = 5, + D2D1_DISTANTSPECULAR_PROP_KERNEL_UNIT_LENGTH = 6, + D2D1_DISTANTSPECULAR_PROP_SCALE_MODE = 7, + D2D1_DISTANTSPECULAR_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DISTANTSPECULAR_SCALE_MODE { + D2D1_DISTANTSPECULAR_SCALE_MODE_NEAREST_NEIGHBOR = 0, + D2D1_DISTANTSPECULAR_SCALE_MODE_LINEAR = 1, + D2D1_DISTANTSPECULAR_SCALE_MODE_CUBIC = 2, + D2D1_DISTANTSPECULAR_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_DISTANTSPECULAR_SCALE_MODE_ANISOTROPIC = 4, + D2D1_DISTANTSPECULAR_SCALE_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_DISTANTSPECULAR_SCALE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_POINTDIFFUSE_PROP { + D2D1_POINTDIFFUSE_PROP_LIGHT_POSITION = 0, + D2D1_POINTDIFFUSE_PROP_DIFFUSE_CONSTANT = 1, + D2D1_POINTDIFFUSE_PROP_SURFACE_SCALE = 2, + D2D1_POINTDIFFUSE_PROP_COLOR = 3, + D2D1_POINTDIFFUSE_PROP_KERNEL_UNIT_LENGTH = 4, + D2D1_POINTDIFFUSE_PROP_SCALE_MODE = 5, + D2D1_POINTDIFFUSE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_POINTDIFFUSE_SCALE_MODE { + D2D1_POINTDIFFUSE_SCALE_MODE_NEAREST_NEIGHBOR = 0, + D2D1_POINTDIFFUSE_SCALE_MODE_LINEAR = 1, + D2D1_POINTDIFFUSE_SCALE_MODE_CUBIC = 2, + D2D1_POINTDIFFUSE_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_POINTDIFFUSE_SCALE_MODE_ANISOTROPIC = 4, + D2D1_POINTDIFFUSE_SCALE_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_POINTDIFFUSE_SCALE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SPOTDIFFUSE_PROP { + D2D1_SPOTDIFFUSE_PROP_LIGHT_POSITION = 0, + D2D1_SPOTDIFFUSE_PROP_POINTS_AT = 1, + D2D1_SPOTDIFFUSE_PROP_FOCUS = 2, + D2D1_SPOTDIFFUSE_PROP_LIMITING_CONE_ANGLE = 3, + D2D1_SPOTDIFFUSE_PROP_DIFFUSE_CONSTANT = 4, + D2D1_SPOTDIFFUSE_PROP_SURFACE_SCALE = 5, + D2D1_SPOTDIFFUSE_PROP_COLOR = 6, + D2D1_SPOTDIFFUSE_PROP_KERNEL_UNIT_LENGTH = 7, + D2D1_SPOTDIFFUSE_PROP_SCALE_MODE = 8, + D2D1_SPOTDIFFUSE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_SPOTDIFFUSE_SCALE_MODE { + D2D1_SPOTDIFFUSE_SCALE_MODE_NEAREST_NEIGHBOR = 0, + D2D1_SPOTDIFFUSE_SCALE_MODE_LINEAR = 1, + D2D1_SPOTDIFFUSE_SCALE_MODE_CUBIC = 2, + D2D1_SPOTDIFFUSE_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_SPOTDIFFUSE_SCALE_MODE_ANISOTROPIC = 4, + D2D1_SPOTDIFFUSE_SCALE_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_SPOTDIFFUSE_SCALE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DISTANTDIFFUSE_PROP { + D2D1_DISTANTDIFFUSE_PROP_AZIMUTH = 0, + D2D1_DISTANTDIFFUSE_PROP_ELEVATION = 1, + D2D1_DISTANTDIFFUSE_PROP_DIFFUSE_CONSTANT = 2, + D2D1_DISTANTDIFFUSE_PROP_SURFACE_SCALE = 3, + D2D1_DISTANTDIFFUSE_PROP_COLOR = 4, + D2D1_DISTANTDIFFUSE_PROP_KERNEL_UNIT_LENGTH = 5, + D2D1_DISTANTDIFFUSE_PROP_SCALE_MODE = 6, + D2D1_DISTANTDIFFUSE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DISTANTDIFFUSE_SCALE_MODE { + D2D1_DISTANTDIFFUSE_SCALE_MODE_NEAREST_NEIGHBOR = 0, + D2D1_DISTANTDIFFUSE_SCALE_MODE_LINEAR = 1, + D2D1_DISTANTDIFFUSE_SCALE_MODE_CUBIC = 2, + D2D1_DISTANTDIFFUSE_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_DISTANTDIFFUSE_SCALE_MODE_ANISOTROPIC = 4, + D2D1_DISTANTDIFFUSE_SCALE_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_DISTANTDIFFUSE_SCALE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_FLOOD_PROP { + D2D1_FLOOD_PROP_COLOR = 0, + D2D1_FLOOD_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_LINEARTRANSFER_PROP { + D2D1_LINEARTRANSFER_PROP_RED_Y_INTERCEPT = 0, + D2D1_LINEARTRANSFER_PROP_RED_SLOPE = 1, + D2D1_LINEARTRANSFER_PROP_RED_DISABLE = 2, + D2D1_LINEARTRANSFER_PROP_GREEN_Y_INTERCEPT = 3, + D2D1_LINEARTRANSFER_PROP_GREEN_SLOPE = 4, + D2D1_LINEARTRANSFER_PROP_GREEN_DISABLE = 5, + D2D1_LINEARTRANSFER_PROP_BLUE_Y_INTERCEPT = 6, + D2D1_LINEARTRANSFER_PROP_BLUE_SLOPE = 7, + D2D1_LINEARTRANSFER_PROP_BLUE_DISABLE = 8, + D2D1_LINEARTRANSFER_PROP_ALPHA_Y_INTERCEPT = 9, + D2D1_LINEARTRANSFER_PROP_ALPHA_SLOPE = 10, + D2D1_LINEARTRANSFER_PROP_ALPHA_DISABLE = 11, + D2D1_LINEARTRANSFER_PROP_CLAMP_OUTPUT = 12, + D2D1_LINEARTRANSFER_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_GAMMATRANSFER_PROP { + D2D1_GAMMATRANSFER_PROP_RED_AMPLITUDE = 0, + D2D1_GAMMATRANSFER_PROP_RED_EXPONENT = 1, + D2D1_GAMMATRANSFER_PROP_RED_OFFSET = 2, + D2D1_GAMMATRANSFER_PROP_RED_DISABLE = 3, + D2D1_GAMMATRANSFER_PROP_GREEN_AMPLITUDE = 4, + D2D1_GAMMATRANSFER_PROP_GREEN_EXPONENT = 5, + D2D1_GAMMATRANSFER_PROP_GREEN_OFFSET = 6, + D2D1_GAMMATRANSFER_PROP_GREEN_DISABLE = 7, + D2D1_GAMMATRANSFER_PROP_BLUE_AMPLITUDE = 8, + D2D1_GAMMATRANSFER_PROP_BLUE_EXPONENT = 9, + D2D1_GAMMATRANSFER_PROP_BLUE_OFFSET = 10, + D2D1_GAMMATRANSFER_PROP_BLUE_DISABLE = 11, + D2D1_GAMMATRANSFER_PROP_ALPHA_AMPLITUDE = 12, + D2D1_GAMMATRANSFER_PROP_ALPHA_EXPONENT = 13, + D2D1_GAMMATRANSFER_PROP_ALPHA_OFFSET = 14, + D2D1_GAMMATRANSFER_PROP_ALPHA_DISABLE = 15, + D2D1_GAMMATRANSFER_PROP_CLAMP_OUTPUT = 16, + D2D1_GAMMATRANSFER_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_TABLETRANSFER_PROP { + D2D1_TABLETRANSFER_PROP_RED_TABLE = 0, + D2D1_TABLETRANSFER_PROP_RED_DISABLE = 1, + D2D1_TABLETRANSFER_PROP_GREEN_TABLE = 2, + D2D1_TABLETRANSFER_PROP_GREEN_DISABLE = 3, + D2D1_TABLETRANSFER_PROP_BLUE_TABLE = 4, + D2D1_TABLETRANSFER_PROP_BLUE_DISABLE = 5, + D2D1_TABLETRANSFER_PROP_ALPHA_TABLE = 6, + D2D1_TABLETRANSFER_PROP_ALPHA_DISABLE = 7, + D2D1_TABLETRANSFER_PROP_CLAMP_OUTPUT = 8, + D2D1_TABLETRANSFER_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_DISCRETETRANSFER_PROP { + D2D1_DISCRETETRANSFER_PROP_RED_TABLE = 0, + D2D1_DISCRETETRANSFER_PROP_RED_DISABLE = 1, + D2D1_DISCRETETRANSFER_PROP_GREEN_TABLE = 2, + D2D1_DISCRETETRANSFER_PROP_GREEN_DISABLE = 3, + D2D1_DISCRETETRANSFER_PROP_BLUE_TABLE = 4, + D2D1_DISCRETETRANSFER_PROP_BLUE_DISABLE = 5, + D2D1_DISCRETETRANSFER_PROP_ALPHA_TABLE = 6, + D2D1_DISCRETETRANSFER_PROP_ALPHA_DISABLE = 7, + D2D1_DISCRETETRANSFER_PROP_CLAMP_OUTPUT = 8, + D2D1_DISCRETETRANSFER_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_CONVOLVEMATRIX_PROP { + D2D1_CONVOLVEMATRIX_PROP_KERNEL_UNIT_LENGTH = 0, + D2D1_CONVOLVEMATRIX_PROP_SCALE_MODE = 1, + D2D1_CONVOLVEMATRIX_PROP_KERNEL_SIZE_X = 2, + D2D1_CONVOLVEMATRIX_PROP_KERNEL_SIZE_Y = 3, + D2D1_CONVOLVEMATRIX_PROP_KERNEL_MATRIX = 4, + D2D1_CONVOLVEMATRIX_PROP_DIVISOR = 5, + D2D1_CONVOLVEMATRIX_PROP_BIAS = 6, + D2D1_CONVOLVEMATRIX_PROP_KERNEL_OFFSET = 7, + D2D1_CONVOLVEMATRIX_PROP_PRESERVE_ALPHA = 8, + D2D1_CONVOLVEMATRIX_PROP_BORDER_MODE = 9, + D2D1_CONVOLVEMATRIX_PROP_CLAMP_OUTPUT = 10, + D2D1_CONVOLVEMATRIX_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_CONVOLVEMATRIX_SCALE_MODE { + D2D1_CONVOLVEMATRIX_SCALE_MODE_NEAREST_NEIGHBOR = 0, + D2D1_CONVOLVEMATRIX_SCALE_MODE_LINEAR = 1, + D2D1_CONVOLVEMATRIX_SCALE_MODE_CUBIC = 2, + D2D1_CONVOLVEMATRIX_SCALE_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_CONVOLVEMATRIX_SCALE_MODE_ANISOTROPIC = 4, + D2D1_CONVOLVEMATRIX_SCALE_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_CONVOLVEMATRIX_SCALE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BRIGHTNESS_PROP { + D2D1_BRIGHTNESS_PROP_WHITE_POINT = 0, + D2D1_BRIGHTNESS_PROP_BLACK_POINT = 1, + D2D1_BRIGHTNESS_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_ARITHMETICCOMPOSITE_PROP { + D2D1_ARITHMETICCOMPOSITE_PROP_COEFFICIENTS = 0, + D2D1_ARITHMETICCOMPOSITE_PROP_CLAMP_OUTPUT = 1, + D2D1_ARITHMETICCOMPOSITE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_CROP_PROP { + D2D1_CROP_PROP_RECT = 0, + D2D1_CROP_PROP_BORDER_MODE = 1, + D2D1_CROP_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BORDER_PROP { + D2D1_BORDER_PROP_EDGE_MODE_X = 0, + D2D1_BORDER_PROP_EDGE_MODE_Y = 1, + D2D1_BORDER_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_BORDER_EDGE_MODE { + D2D1_BORDER_EDGE_MODE_CLAMP = 0, + D2D1_BORDER_EDGE_MODE_WRAP = 1, + D2D1_BORDER_EDGE_MODE_MIRROR = 2, + D2D1_BORDER_EDGE_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_MORPHOLOGY_PROP { + D2D1_MORPHOLOGY_PROP_MODE = 0, + D2D1_MORPHOLOGY_PROP_WIDTH = 1, + D2D1_MORPHOLOGY_PROP_HEIGHT = 2, + D2D1_MORPHOLOGY_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_MORPHOLOGY_MODE { + D2D1_MORPHOLOGY_MODE_ERODE = 0, + D2D1_MORPHOLOGY_MODE_DILATE = 1, + D2D1_MORPHOLOGY_MODE_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_TILE_PROP { + D2D1_TILE_PROP_RECT = 0, + D2D1_TILE_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_ATLAS_PROP { + D2D1_ATLAS_PROP_INPUT_RECT = 0, + D2D1_ATLAS_PROP_INPUT_PADDING_RECT = 1, + D2D1_ATLAS_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_OPACITYMETADATA_PROP { + D2D1_OPACITYMETADATA_PROP_INPUT_OPAQUE_RECT = 0, + D2D1_OPACITYMETADATA_PROP_FORCE_DWORD = 0xffffffff, +}} diff --git a/src/vendor/winapi/src/um/d2d1effects_1.rs b/src/vendor/winapi/src/um/d2d1effects_1.rs new file mode 100644 index 0000000000..f0f8042ea0 --- /dev/null +++ b/src/vendor/winapi/src/um/d2d1effects_1.rs @@ -0,0 +1,32 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +// Mappings for the contents of d2d1effects_1.h +DEFINE_GUID!{CLSID_D2D1YCbCr, + 0x99503cc1, 0x66c7, 0x45c9, 0xa8, 0x75, 0x8a, 0xd8, 0xa7, 0x91, 0x44, 0x01} +ENUM!{enum D2D1_YCBCR_PROP { + D2D1_YCBCR_PROP_CHROMA_SUBSAMPLING = 0, + D2D1_YCBCR_PROP_TRANSFORM_MATRIX = 1, + D2D1_YCBCR_PROP_INTERPOLATION_MODE = 2, + D2D1_YCBCR_PROP_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_YCBCR_CHROMA_SUBSAMPLING { + D2D1_YCBCR_CHROMA_SUBSAMPLING_AUTO = 0, + D2D1_YCBCR_CHROMA_SUBSAMPLING_420 = 1, + D2D1_YCBCR_CHROMA_SUBSAMPLING_422 = 2, + D2D1_YCBCR_CHROMA_SUBSAMPLING_444 = 3, + D2D1_YCBCR_CHROMA_SUBSAMPLING_440 = 4, + D2D1_YCBCR_CHROMA_SUBSAMPLING_FORCE_DWORD = 0xffffffff, +}} +ENUM!{enum D2D1_YCBCR_INTERPOLATION_MODE { + D2D1_YCBCR_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + D2D1_YCBCR_INTERPOLATION_MODE_LINEAR = 1, + D2D1_YCBCR_INTERPOLATION_MODE_CUBIC = 2, + D2D1_YCBCR_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = 3, + D2D1_YCBCR_INTERPOLATION_MODE_ANISOTROPIC = 4, + D2D1_YCBCR_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5, + D2D1_YCBCR_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff, +}} diff --git a/src/vendor/winapi/src/um/d2d1effects_2.rs b/src/vendor/winapi/src/um/d2d1effects_2.rs new file mode 100644 index 0000000000..f064442c41 --- /dev/null +++ b/src/vendor/winapi/src/um/d2d1effects_2.rs @@ -0,0 +1,41 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of d2d1effects_2.h +DEFINE_GUID!{CLSID_D2D1Contrast, + 0xb648a78a, 0x0ed5, 0x4f80, 0xa9, 0x4a, 0x8e, 0x82, 0x5a, 0xca, 0x6b, 0x77} +DEFINE_GUID!{CLSID_D2D1RgbToHue, + 0x23f3e5ec, 0x91e8, 0x4d3d, 0xad, 0x0a, 0xaf, 0xad, 0xc1, 0x00, 0x4a, 0xa1} +DEFINE_GUID!{CLSID_D2D1HueToRgb, + 0x7b78a6bd, 0x0141, 0x4def, 0x8a, 0x52, 0x63, 0x56, 0xee, 0x0c, 0xbd, 0xd5} +DEFINE_GUID!{CLSID_D2D1ChromaKey, + 0x74c01f5b, 0x2a0d, 0x408c, 0x88, 0xe2, 0xc7, 0xa3, 0xc7, 0x19, 0x77, 0x42} +DEFINE_GUID!{CLSID_D2D1Emboss, + 0xb1c5eb2b, 0x0348, 0x43f0, 0x81, 0x07, 0x49, 0x57, 0xca, 0xcb, 0xa2, 0xae} +DEFINE_GUID!{CLSID_D2D1Exposure, + 0xb56c8cfa, 0xf634, 0x41ee, 0xbe, 0xe0, 0xff, 0xa6, 0x17, 0x10, 0x60, 0x04} +DEFINE_GUID!{CLSID_D2D1Grayscale, + 0x36dde0eb, 0x3725, 0x42e0, 0x83, 0x6d, 0x52, 0xfb, 0x20, 0xae, 0xe6, 0x44} +DEFINE_GUID!{CLSID_D2D1Invert, + 0xe0c3784d, 0xcb39, 0x4e84, 0xb6, 0xfd, 0x6b, 0x72, 0xf0, 0x81, 0x02, 0x63} +DEFINE_GUID!{CLSID_D2D1Posterize, + 0x2188945e, 0x33a3, 0x4366, 0xb7, 0xbc, 0x08, 0x6b, 0xd0, 0x2d, 0x08, 0x84} +DEFINE_GUID!{CLSID_D2D1Sepia, + 0x3a1af410, 0x5f1d, 0x4dbe, 0x84, 0xdf, 0x91, 0x5d, 0xa7, 0x9b, 0x71, 0x53} +DEFINE_GUID!{CLSID_D2D1Sharpen, + 0xc9b887cb, 0xc5ff, 0x4dc5, 0x97, 0x79, 0x27, 0x3d, 0xcf, 0x41, 0x7c, 0x7d} +DEFINE_GUID!{CLSID_D2D1Straighten, + 0x4da47b12, 0x79a3, 0x4fb0, 0x82, 0x37, 0xbb, 0xc3, 0xb2, 0xa4, 0xde, 0x08} +DEFINE_GUID!{CLSID_D2D1TemperatureTint, + 0x89176087, 0x8af9, 0x4a08, 0xae, 0xb1, 0x89, 0x5f, 0x38, 0xdb, 0x17, 0x66} +DEFINE_GUID!{CLSID_D2D1Vignette, + 0xc00c40be, 0x5e67, 0x4ca3, 0x95, 0xb4, 0xf4, 0xb0, 0x2c, 0x11, 0x51, 0x35} +DEFINE_GUID!{CLSID_D2D1EdgeDetection, + 0xeff583ca, 0xcb07, 0x4aa9, 0xac, 0x5d, 0x2c, 0xc4, 0x4c, 0x76, 0x46, 0x0f} +DEFINE_GUID!{CLSID_D2D1HighlightsShadows, + 0xcadc8384, 0x323f, 0x4c7e, 0xa3, 0x61, 0x2e, 0x2b, 0x24, 0xdf, 0x6e, 0xe4} +DEFINE_GUID!{CLSID_D2D1LookupTable3D, + 0x349e0eda, 0x0088, 0x4a79, 0x9c, 0xa3, 0xc7, 0xe3, 0x00, 0x20, 0x20, 0x20} diff --git a/src/vendor/winapi/src/um/d2dbasetypes.rs b/src/vendor/winapi/src/um/d2dbasetypes.rs new file mode 100644 index 0000000000..730247e8e5 --- /dev/null +++ b/src/vendor/winapi/src/um/d2dbasetypes.rs @@ -0,0 +1,69 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of d2dbasetypes.h +use shared::basetsd::{UINT32}; +use shared::d3d9types::{D3DCOLORVALUE}; +use shared::minwindef::{FLOAT}; +use shared::windef::{POINT, RECT}; +STRUCT!{struct D2D_POINT_2U { + x: UINT32, + y: UINT32, +}} +STRUCT!{struct D2D_POINT_2F { + x: FLOAT, + y: FLOAT, +}} +pub type D2D_POINT_2L = POINT; +STRUCT!{struct D2D_VECTOR_2F { + x: FLOAT, + y: FLOAT, +}} +STRUCT!{struct D2D_VECTOR_3F { + x: FLOAT, + y: FLOAT, + z: FLOAT, +}} +STRUCT!{struct D2D_VECTOR_4F { + x: FLOAT, + y: FLOAT, + z: FLOAT, + w: FLOAT, +}} +STRUCT!{struct D2D_RECT_F { + left: FLOAT, + top: FLOAT, + right: FLOAT, + bottom: FLOAT, +}} +STRUCT!{struct D2D_RECT_U { + left: UINT32, + top: UINT32, + right: UINT32, + bottom: UINT32, +}} +pub type D2D_RECT_L = RECT; +STRUCT!{struct D2D_SIZE_F { + width: FLOAT, + height: FLOAT, +}} +STRUCT!{struct D2D_SIZE_U { + width: UINT32, + height: UINT32, +}} +pub type D2D_COLOR_F = D3DCOLORVALUE; +STRUCT!{struct D2D_MATRIX_3X2_F { + matrix: [[FLOAT; 2]; 3], +}} +STRUCT!{struct D2D_MATRIX_4X3_F { + matrix: [[FLOAT; 3]; 4], +}} +STRUCT!{struct D2D_MATRIX_4X4_F { + matrix: [[FLOAT; 4]; 4], +}} +STRUCT!{struct D2D_MATRIX_5X4_F { + matrix: [[FLOAT; 4]; 5], +}} diff --git a/src/vendor/winapi/src/um/d3d.rs b/src/vendor/winapi/src/um/d3d.rs new file mode 100644 index 0000000000..61e628745e --- /dev/null +++ b/src/vendor/winapi/src/um/d3d.rs @@ -0,0 +1,62 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_IDirect3D, + 0x3bba0080, 0x2421, 0x11cf, 0xa3, 0x1a, 0x00, 0xaa, 0x00, 0xb9, 0x33, 0x56} +DEFINE_GUID!{IID_IDirect3D2, + 0x6aae1ec1, 0x662a, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a} +DEFINE_GUID!{IID_IDirect3D3, + 0xbb223240, 0xe72b, 0x11d0, 0xa9, 0xb4, 0x00, 0xaa, 0x00, 0xc0, 0x99, 0x3e} +DEFINE_GUID!{IID_IDirect3D7, + 0xf5049e77, 0x4861, 0x11d2, 0xa4, 0x07, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{IID_IDirect3DRampDevice, + 0xf2086b20, 0x259f, 0x11cf, 0xa3, 0x1a, 0x00, 0xaa, 0x00, 0xb9, 0x33, 0x56} +DEFINE_GUID!{IID_IDirect3DRGBDevice, + 0xa4665c60, 0x2673, 0x11cf, 0xa3, 0x1a, 0x00, 0xaa, 0x00, 0xb9, 0x33, 0x56} +DEFINE_GUID!{IID_IDirect3DHALDevice, + 0x84e63de0, 0x46aa, 0x11cf, 0x81, 0x6f, 0x00, 0x00, 0xc0, 0x20, 0x15, 0x6e} +DEFINE_GUID!{IID_IDirect3DMMXDevice, + 0x881949a1, 0xd6f3, 0x11d0, 0x89, 0xab, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirect3DRefDevice, + 0x50936643, 0x13e9, 0x11d1, 0x89, 0xaa, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirect3DNullDevice, + 0x8767df22, 0xbacc, 0x11d1, 0x89, 0x69, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{IID_IDirect3DTnLHalDevice, + 0xf5049e78, 0x4861, 0x11d2, 0xa4, 0x07, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{IID_IDirect3DDevice, + 0x64108800, 0x957d, 0x11d0, 0x89, 0xab, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirect3DDevice2, + 0x93281501, 0x8cf8, 0x11d0, 0x89, 0xab, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirect3DDevice3, + 0xb0ab3b60, 0x33d7, 0x11d1, 0xa9, 0x81, 0x00, 0xc0, 0x4f, 0xd7, 0xb1, 0x74} +DEFINE_GUID!{IID_IDirect3DDevice7, + 0xf5049e79, 0x4861, 0x11d2, 0xa4, 0x07, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{IID_IDirect3DTexture, + 0x2cdcd9e0, 0x25a0, 0x11cf, 0xa3, 0x1a, 0x00, 0xaa, 0x00, 0xb9, 0x33, 0x56} +DEFINE_GUID!{IID_IDirect3DTexture2, + 0x93281502, 0x8cf8, 0x11d0, 0x89, 0xab, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirect3DLight, + 0x4417c142, 0x33ad, 0x11cf, 0x81, 0x6f, 0x00, 0x00, 0xc0, 0x20, 0x15, 0x6e} +DEFINE_GUID!{IID_IDirect3DMaterial, + 0x4417c144, 0x33ad, 0x11cf, 0x81, 0x6f, 0x00, 0x00, 0xc0, 0x20, 0x15, 0x6e} +DEFINE_GUID!{IID_IDirect3DIndexBuffer8, + 0x0e689c9a, 0x053d, 0x44a0, 0x9d, 0x92, 0xdb, 0x0e, 0x3d, 0x75, 0x0f, 0x86} +DEFINE_GUID!{IID_IDirect3DMaterial2, + 0x93281503, 0x8cf8, 0x11d0, 0x89, 0xab, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirect3DMaterial3, + 0xca9c46f4, 0xd3c5, 0x11d1, 0xb7, 0x5a, 0x00, 0x60, 0x08, 0x52, 0xb3, 0x12} +DEFINE_GUID!{IID_IDirect3DExecuteBuffer, + 0x4417c145, 0x33ad, 0x11cf, 0x81, 0x6f, 0x00, 0x00, 0xc0, 0x20, 0x15, 0x6e} +DEFINE_GUID!{IID_IDirect3DViewport, + 0x4417c146, 0x33ad, 0x11cf, 0x81, 0x6f, 0x00, 0x00, 0xc0, 0x20, 0x15, 0x6e} +DEFINE_GUID!{IID_IDirect3DViewport2, + 0x93281500, 0x8cf8, 0x11d0, 0x89, 0xab, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirect3DViewport3, + 0xb0ab3b61, 0x33d7, 0x11d1, 0xa9, 0x81, 0x00, 0xc0, 0x4f, 0xd7, 0xb1, 0x74} +DEFINE_GUID!{IID_IDirect3DVertexBuffer, + 0x7a503555, 0x4a83, 0x11d1, 0xa5, 0xdb, 0x00, 0xa0, 0xc9, 0x03, 0x67, 0xf8} +DEFINE_GUID!{IID_IDirect3DVertexBuffer7, + 0xf5049e7d, 0x4861, 0x11d2, 0xa4, 0x07, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} diff --git a/src/vendor/winapi/src/um/d3d10.rs b/src/vendor/winapi/src/um/d3d10.rs new file mode 100644 index 0000000000..2258276c9a --- /dev/null +++ b/src/vendor/winapi/src/um/d3d10.rs @@ -0,0 +1,58 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use um::d3dcommon::{D3D_PRIMITIVE, D3D_PRIMITIVE_TOPOLOGY, D3D_SRV_DIMENSION}; +pub type D3D10_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY; +pub type D3D10_PRIMITIVE = D3D_PRIMITIVE; +pub type D3D10_SRV_DIMENSION = D3D_SRV_DIMENSION; +DEFINE_GUID!{IID_ID3D10DeviceChild, + 0x9b7e4c00, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10DepthStencilState, + 0x2b4b1cc8, 0xa4ad, 0x41f8, 0x83, 0x22, 0xca, 0x86, 0xfc, 0x3e, 0xc6, 0x75} +DEFINE_GUID!{IID_ID3D10BlendState, + 0xedad8d19, 0x8a35, 0x4d6d, 0x85, 0x66, 0x2e, 0xa2, 0x76, 0xcd, 0xe1, 0x61} +DEFINE_GUID!{IID_ID3D10RasterizerState, + 0xa2a07292, 0x89af, 0x4345, 0xbe, 0x2e, 0xc5, 0x3d, 0x9f, 0xbb, 0x6e, 0x9f} +DEFINE_GUID!{IID_ID3D10Resource, + 0x9b7e4c01, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Buffer, + 0x9b7e4c02, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Texture1D, + 0x9b7e4c03, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Texture2D, + 0x9b7e4c04, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Texture3D, + 0x9b7e4c05, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10View, + 0xc902b03f, 0x60a7, 0x49ba, 0x99, 0x36, 0x2a, 0x3a, 0xb3, 0x7a, 0x7e, 0x33} +DEFINE_GUID!{IID_ID3D10ShaderResourceView, + 0x9b7e4c07, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10RenderTargetView, + 0x9b7e4c08, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10DepthStencilView, + 0x9b7e4c09, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10VertexShader, + 0x9b7e4c0a, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10GeometryShader, + 0x6316be88, 0x54cd, 0x4040, 0xab, 0x44, 0x20, 0x46, 0x1b, 0xc8, 0x1f, 0x68} +DEFINE_GUID!{IID_ID3D10PixelShader, + 0x4968b601, 0x9d00, 0x4cde, 0x83, 0x46, 0x8e, 0x7f, 0x67, 0x58, 0x19, 0xb6} +DEFINE_GUID!{IID_ID3D10InputLayout, + 0x9b7e4c0b, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10SamplerState, + 0x9b7e4c0c, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Asynchronous, + 0x9b7e4c0d, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Query, + 0x9b7e4c0e, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Predicate, + 0x9b7e4c10, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Counter, + 0x9b7e4c11, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Device, + 0x9b7e4c0f, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Multithread, + 0x9b7e4e00, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} diff --git a/src/vendor/winapi/src/um/d3d10_1.rs b/src/vendor/winapi/src/um/d3d10_1.rs new file mode 100644 index 0000000000..37214a871f --- /dev/null +++ b/src/vendor/winapi/src/um/d3d10_1.rs @@ -0,0 +1,12 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3D10BlendState1, + 0xedad8d99, 0x8a35, 0x4d6d, 0x85, 0x66, 0x2e, 0xa2, 0x76, 0xcd, 0xe1, 0x61} +DEFINE_GUID!{IID_ID3D10ShaderResourceView1, + 0x9b7e4c87, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10Device1, + 0x9b7e4c8f, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} diff --git a/src/vendor/winapi/src/um/d3d10_1shader.rs b/src/vendor/winapi/src/um/d3d10_1shader.rs new file mode 100644 index 0000000000..33c4041968 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d10_1shader.rs @@ -0,0 +1,8 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3D10ShaderReflection1, + 0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47} diff --git a/src/vendor/winapi/src/um/d3d10effect.rs b/src/vendor/winapi/src/um/d3d10effect.rs new file mode 100644 index 0000000000..9a999cc658 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d10effect.rs @@ -0,0 +1,46 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3D10StateBlock, + 0x0803425a, 0x57f5, 0x4dd6, 0x94, 0x65, 0xa8, 0x75, 0x70, 0x83, 0x4a, 0x08} +DEFINE_GUID!{IID_ID3D10EffectType, + 0x4e9e1ddc, 0xcd9d, 0x4772, 0xa8, 0x37, 0x00, 0x18, 0x0b, 0x9b, 0x88, 0xfd} +DEFINE_GUID!{IID_ID3D10EffectVariable, + 0xae897105, 0x00e6, 0x45bf, 0xbb, 0x8e, 0x28, 0x1d, 0xd6, 0xdb, 0x8e, 0x1b} +DEFINE_GUID!{IID_ID3D10EffectScalarVariable, + 0x00e48f7b, 0xd2c8, 0x49e8, 0xa8, 0x6c, 0x02, 0x2d, 0xee, 0x53, 0x43, 0x1f} +DEFINE_GUID!{IID_ID3D10EffectVectorVariable, + 0x62b98c44, 0x1f82, 0x4c67, 0xbc, 0xd0, 0x72, 0xcf, 0x8f, 0x21, 0x7e, 0x81} +DEFINE_GUID!{IID_ID3D10EffectMatrixVariable, + 0x50666c24, 0xb82f, 0x4eed, 0xa1, 0x72, 0x5b, 0x6e, 0x7e, 0x85, 0x22, 0xe0} +DEFINE_GUID!{IID_ID3D10EffectStringVariable, + 0x71417501, 0x8df9, 0x4e0a, 0xa7, 0x8a, 0x25, 0x5f, 0x97, 0x56, 0xba, 0xff} +DEFINE_GUID!{IID_ID3D10EffectShaderResourceVariable, + 0xc0a7157b, 0xd872, 0x4b1d, 0x80, 0x73, 0xef, 0xc2, 0xac, 0xd4, 0xb1, 0xfc} +DEFINE_GUID!{IID_ID3D10EffectRenderTargetViewVariable, + 0x28ca0cc3, 0xc2c9, 0x40bb, 0xb5, 0x7f, 0x67, 0xb7, 0x37, 0x12, 0x2b, 0x17} +DEFINE_GUID!{IID_ID3D10EffectDepthStencilViewVariable, + 0x3e02c918, 0xcc79, 0x4985, 0xb6, 0x22, 0x2d, 0x92, 0xad, 0x70, 0x16, 0x23} +DEFINE_GUID!{IID_ID3D10EffectConstantBuffer, + 0x56648f4d, 0xcc8b, 0x4444, 0xa5, 0xad, 0xb5, 0xa3, 0xd7, 0x6e, 0x91, 0xb3} +DEFINE_GUID!{IID_ID3D10EffectShaderVariable, + 0x80849279, 0xc799, 0x4797, 0x8c, 0x33, 0x04, 0x07, 0xa0, 0x7d, 0x9e, 0x06} +DEFINE_GUID!{IID_ID3D10EffectBlendVariable, + 0x1fcd2294, 0xdf6d, 0x4eae, 0x86, 0xb3, 0x0e, 0x91, 0x60, 0xcf, 0xb0, 0x7b} +DEFINE_GUID!{IID_ID3D10EffectDepthStencilVariable, + 0xaf482368, 0x330a, 0x46a5, 0x9a, 0x5c, 0x01, 0xc7, 0x1a, 0xf2, 0x4c, 0x8d} +DEFINE_GUID!{IID_ID3D10EffectRasterizerVariable, + 0x21af9f0e, 0x4d94, 0x4ea9, 0x97, 0x85, 0x2c, 0xb7, 0x6b, 0x8c, 0x0b, 0x34} +DEFINE_GUID!{IID_ID3D10EffectSamplerVariable, + 0x6530d5c7, 0x07e9, 0x4271, 0xa4, 0x18, 0xe7, 0xce, 0x4b, 0xd1, 0xe4, 0x80} +DEFINE_GUID!{IID_ID3D10EffectPass, + 0x5cfbeb89, 0x1a06, 0x46e0, 0xb2, 0x82, 0xe3, 0xf9, 0xbf, 0xa3, 0x6a, 0x54} +DEFINE_GUID!{IID_ID3D10EffectTechnique, + 0xdb122ce8, 0xd1c9, 0x4292, 0xb2, 0x37, 0x24, 0xed, 0x3d, 0xe8, 0xb1, 0x75} +DEFINE_GUID!{IID_ID3D10Effect, + 0x51b0ca8b, 0xec0b, 0x4519, 0x87, 0x0d, 0x8e, 0xe1, 0xcb, 0x50, 0x17, 0xc7} +DEFINE_GUID!{IID_ID3D10EffectPool, + 0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33} diff --git a/src/vendor/winapi/src/um/d3d10misc.rs b/src/vendor/winapi/src/um/d3d10misc.rs new file mode 100644 index 0000000000..98b3166e55 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d10misc.rs @@ -0,0 +1,8 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{GUID_DeviceType, + 0xd722fb4d, 0x7a68, 0x437a, 0xb2, 0x0c, 0x58, 0x04, 0xee, 0x24, 0x94, 0xa6} diff --git a/src/vendor/winapi/src/um/d3d10sdklayers.rs b/src/vendor/winapi/src/um/d3d10sdklayers.rs new file mode 100644 index 0000000000..14284fcdbe --- /dev/null +++ b/src/vendor/winapi/src/um/d3d10sdklayers.rs @@ -0,0 +1,14 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{DXGI_DEBUG_D3D10, + 0x243b4c52, 0x3606, 0x4d3a, 0x99, 0xd7, 0xa7, 0xe7, 0xb3, 0x3e, 0xd7, 0x06} +DEFINE_GUID!{IID_ID3D10Debug, + 0x9b7e4e01, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10SwitchToRef, + 0x9b7e4e02, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0} +DEFINE_GUID!{IID_ID3D10InfoQueue, + 0x1b940b17, 0x2642, 0x4d1f, 0xab, 0x1f, 0xb9, 0x9b, 0xad, 0x0c, 0x39, 0x5f} diff --git a/src/vendor/winapi/src/um/d3d10shader.rs b/src/vendor/winapi/src/um/d3d10shader.rs new file mode 100644 index 0000000000..b0392debe1 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d10shader.rs @@ -0,0 +1,207 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +use shared::minwindef::{BYTE, LPVOID, UINT}; +use um::d3d10::{D3D10_PRIMITIVE_TOPOLOGY, D3D10_SRV_DIMENSION}; +use um::d3dcommon::{ + D3D_CBUFFER_TYPE, D3D_INCLUDE_TYPE, D3D_NAME, D3D_REGISTER_COMPONENT_TYPE, + D3D_RESOURCE_RETURN_TYPE, D3D_SHADER_CBUFFER_FLAGS, D3D_SHADER_INPUT_FLAGS, + D3D_SHADER_INPUT_TYPE, D3D_SHADER_MACRO, D3D_SHADER_VARIABLE_CLASS, D3D_SHADER_VARIABLE_FLAGS, + D3D_SHADER_VARIABLE_TYPE, ID3DInclude, +}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCSTR}; +pub const D3D10_SHADER_DEBUG: UINT = 1 << 0; +pub const D3D10_SHADER_SKIP_VALIDATION: UINT = 1 << 1; +pub const D3D10_SHADER_SKIP_OPTIMIZATION: UINT = 1 << 2; +pub const D3D10_SHADER_PACK_MATRIX_ROW_MAJOR: UINT = 1 << 3; +pub const D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR: UINT = 1 << 4; +pub const D3D10_SHADER_PARTIAL_PRECISION: UINT = 1 << 5; +pub const D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT: UINT = 1 << 6; +pub const D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT: UINT = 1 << 7; +pub const D3D10_SHADER_NO_PRESHADER: UINT = 1 << 8; +pub const D3D10_SHADER_AVOID_FLOW_CONTROL: UINT = 1 << 9; +pub const D3D10_SHADER_PREFER_FLOW_CONTROL: UINT = 1 << 10; +pub const D3D10_SHADER_ENABLE_STRICTNESS: UINT = 1 << 11; +pub const D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY: UINT = 1 << 12; +pub const D3D10_SHADER_IEEE_STRICTNESS: UINT = 1 << 13; +pub const D3D10_SHADER_WARNINGS_ARE_ERRORS: UINT = 1 << 18; +pub const D3D10_SHADER_RESOURCES_MAY_ALIAS: UINT = 1 << 19; +pub const D3D10_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES: UINT = 1 << 20; +pub const D3D10_ALL_RESOURCES_BOUND: UINT = 1 << 21; +pub const D3D10_SHADER_OPTIMIZATION_LEVEL0: UINT = 1 << 14; +pub const D3D10_SHADER_OPTIMIZATION_LEVEL1: UINT = 0; +pub const D3D10_SHADER_OPTIMIZATION_LEVEL2: UINT = (1 << 14) | (1 << 15); +pub const D3D10_SHADER_OPTIMIZATION_LEVEL3: UINT = 1 << 15; +pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST: UINT = 0; +pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_0: UINT = 1 << 4; +pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_1: UINT = 1 << 5; +pub type D3D10_SHADER_MACRO = D3D_SHADER_MACRO; +pub type LPD3D10_SHADER_MACRO = *mut D3D10_SHADER_MACRO; +pub type D3D10_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS; +pub type LPD3D10_SHADER_VARIABLE_CLASS = *mut D3D10_SHADER_VARIABLE_CLASS; +pub type D3D10_SHADER_VARIABLE_FLAGS = D3D_SHADER_VARIABLE_FLAGS; +pub type LPD3D10_SHADER_VARIABLE_FLAGS = *mut D3D10_SHADER_VARIABLE_FLAGS; +pub type D3D10_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE; +pub type LPD3D10_SHADER_VARIABLE_TYPE = *mut D3D10_SHADER_VARIABLE_TYPE; +pub type D3D10_SHADER_INPUT_FLAGS = D3D_SHADER_INPUT_FLAGS; +pub type LPD3D10_SHADER_INPUT_FLAGS = *mut D3D10_SHADER_INPUT_FLAGS; +pub type D3D10_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE; +pub type LPD3D10_SHADER_INPUT_TYPE = *mut D3D10_SHADER_INPUT_TYPE; +pub type D3D10_SHADER_CBUFFER_FLAGS = D3D_SHADER_CBUFFER_FLAGS; +pub type LPD3D10_SHADER_CBUFFER_FLAGS = *mut D3D10_SHADER_CBUFFER_FLAGS; +pub type D3D10_CBUFFER_TYPE = D3D_CBUFFER_TYPE; +pub type LPD3D10_CBUFFER_TYPE = *mut D3D10_CBUFFER_TYPE; +pub type D3D10_NAME = D3D_NAME; +pub type D3D10_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; +pub type D3D10_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE; +pub type D3D10_INCLUDE_TYPE = D3D_INCLUDE_TYPE; +pub type ID3D10Include = ID3DInclude; +pub type LPD3D10INCLUDE = *mut ID3DInclude; +// const IID_ID3D10Include: IID = IID_ID3DInclude; +STRUCT!{struct D3D10_SHADER_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InputParameters: UINT, + OutputParameters: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + CutInstructionCount: UINT, + EmitInstructionCount: UINT, + GSOutputTopology: D3D10_PRIMITIVE_TOPOLOGY, + GSMaxOutputVertexCount: UINT, +}} +STRUCT!{struct D3D10_SHADER_BUFFER_DESC { + Name: LPCSTR, + Type: D3D10_CBUFFER_TYPE, + Variables: UINT, + Size: UINT, + uFlags: UINT, +}} +STRUCT!{struct D3D10_SHADER_VARIABLE_DESC { + Name: LPCSTR, + StartOffset: UINT, + Size: UINT, + uFlags: UINT, + DefaultValue: LPVOID, +}} +STRUCT!{struct D3D10_SHADER_TYPE_DESC { + Class: D3D10_SHADER_VARIABLE_CLASS, + Type: D3D10_SHADER_VARIABLE_TYPE, + Rows: UINT, + Columns: UINT, + Elements: UINT, + Members: UINT, + Offset: UINT, +}} +STRUCT!{struct D3D10_SHADER_INPUT_BIND_DESC { + Name: LPCSTR, + Type: D3D10_SHADER_INPUT_TYPE, + BindPoint: UINT, + BindCount: UINT, + uFlags: UINT, + ReturnType: D3D10_RESOURCE_RETURN_TYPE, + Dimension: D3D10_SRV_DIMENSION, + NumSamples: UINT, +}} +STRUCT!{struct D3D10_SIGNATURE_PARAMETER_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Register: UINT, + SystemValueType: D3D10_NAME, + ComponentType: D3D10_REGISTER_COMPONENT_TYPE, + Mask: BYTE, + ReadWriteMask: BYTE, +}} +pub type LPD3D10SHADERREFLECTIONTYPE = *mut ID3D10ShaderReflectionType; +DEFINE_GUID!{IID_ID3D10ShaderReflectionType, + 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd} +RIDL!{#[uuid(0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd)] +interface ID3D10ShaderReflectionType(ID3D10ShaderReflectionTypeVtbl) { + fn GetDesc( + pDesc: *mut D3D10_SHADER_TYPE_DESC, + ) -> HRESULT, + fn GetMemberTypeByIndex( + Index: UINT, + ) -> *mut ID3D10ShaderReflectionType, + fn GetMemberTypeByName( + Name: LPCSTR, + ) -> *mut ID3D10ShaderReflectionType, + fn GetMemberTypeName( + Index: UINT, + ) -> LPCSTR, +}} +pub type LPD3D10SHADERREFLECTIONVARIABLE = *mut ID3D10ShaderReflectionVariable; +DEFINE_GUID!{IID_ID3D10ShaderReflectionVariable, + 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1} +RIDL!{#[uuid(0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1)] +interface ID3D10ShaderReflectionVariable(ID3D10ShaderReflectionVariableVtbl) { + fn GetDesc( + pDesc: *mut D3D10_SHADER_VARIABLE_DESC, + ) -> HRESULT, + fn GetType() -> *mut ID3D10ShaderReflectionType, +}} +pub type LPD3D10SHADERREFLECTIONCONSTANTBUFFER = *mut ID3D10ShaderReflectionConstantBuffer; +DEFINE_GUID!{IID_ID3D10ShaderReflectionConstantBuffer, + 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0} +RIDL!{#[uuid(0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0)] +interface ID3D10ShaderReflectionConstantBuffer(ID3D10ShaderReflectionConstantBufferVtbl) { + fn GetDesc( + pDesc: *mut D3D10_SHADER_BUFFER_DESC, + ) -> HRESULT, + fn GetVariableByIndex( + Index: UINT, + ) -> *mut ID3D10ShaderReflectionVariable, + fn GetVariableByName( + Name: LPCSTR, + ) -> *mut ID3D10ShaderReflectionVariable, +}} +pub type LPD3D10SHADERREFLECTION = *mut ID3D10ShaderReflection; +DEFINE_GUID!{IID_ID3D10ShaderReflection, + 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa} +RIDL!{#[uuid(0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa)] +interface ID3D10ShaderReflection(ID3D10ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc( + pDesc: *mut D3D10_SHADER_DESC, + ) -> HRESULT, + fn GetConstantBufferByIndex( + Index: UINT, + ) -> *mut ID3D10ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + Name: LPCSTR, + ) -> *mut ID3D10ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + ResourceIndex: UINT, + pDesc: *mut D3D10_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetInputParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, + fn GetOutputParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, +}} +// TODO Some functions diff --git a/src/vendor/winapi/src/um/d3d11.rs b/src/vendor/winapi/src/um/d3d11.rs new file mode 100644 index 0000000000..cfaae8bc6c --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11.rs @@ -0,0 +1,3418 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_float, c_int, c_long, c_void}; +use shared::basetsd::{SIZE_T, UINT64, UINT8}; +use shared::dxgi::{DXGI_SWAP_CHAIN_DESC, IDXGIAdapter, IDXGISwapChain}; +use shared::dxgiformat::{DXGI_FORMAT}; +use shared::dxgitype::{DXGI_RATIONAL, DXGI_SAMPLE_DESC}; +use shared::guiddef::{GUID, REFGUID, REFIID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, HMODULE, INT, UINT, USHORT}; +use shared::windef::{RECT, SIZE}; +use um::d3dcommon::{D3D_DRIVER_TYPE, D3D_FEATURE_LEVEL, D3D_PRIMITIVE, D3D_PRIMITIVE_TOPOLOGY, D3D_SRV_DIMENSION}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, LPCSTR, LPSTR, ULONGLONG}; +pub const D3D11_16BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xffff; +pub const D3D11_32BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xffffffff; +pub const D3D11_8BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xff; +pub const D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT: DWORD = 9; +pub const D3D11_CLIP_OR_CULL_DISTANCE_COUNT: DWORD = 8; +pub const D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT: DWORD = 2; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT: DWORD = 14; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT: DWORD = 15; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT: DWORD = 16; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT: DWORD = 15; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT: DWORD = 64; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT: DWORD = 1; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT: DWORD = 128; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT: DWORD = 128; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT: DWORD = 16; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT: DWORD = 16; +pub const D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT: DWORD = 32; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_COUNT: DWORD = 4096; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST: DWORD = 3; +pub const D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS: DWORD = 3; +pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX: DWORD = 10; +pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN: c_long = -10; +pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE: c_long = -8; +pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE: DWORD = 7; +pub const D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 256; +pub const D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP: DWORD = 64; +pub const D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 240; +pub const D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP: DWORD = 68; +pub const D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 224; +pub const D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP: DWORD = 72; +pub const D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 208; +pub const D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP: DWORD = 76; +pub const D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 192; +pub const D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP: DWORD = 84; +pub const D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 176; +pub const D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP: DWORD = 92; +pub const D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 160; +pub const D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP: DWORD = 100; +pub const D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 144; +pub const D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP: DWORD = 112; +pub const D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 128; +pub const D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP: DWORD = 128; +pub const D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 112; +pub const D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP: DWORD = 144; +pub const D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 96; +pub const D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP: DWORD = 168; +pub const D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 80; +pub const D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP: DWORD = 204; +pub const D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 64; +pub const D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP: DWORD = 256; +pub const D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 48; +pub const D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP: DWORD = 340; +pub const D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 32; +pub const D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP: DWORD = 512; +pub const D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 16; +pub const D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP: DWORD = 768; +pub const D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION: DWORD = 1; +pub const D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT: DWORD = 256; +pub const D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP: DWORD = 768; +pub const D3D11_CS_4_X_THREAD_GROUP_MAX_X: DWORD = 768; +pub const D3D11_CS_4_X_THREAD_GROUP_MAX_Y: DWORD = 768; +pub const D3D11_CS_4_X_UAV_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION: DWORD = 65535; +pub const D3D11_CS_TGSM_REGISTER_COUNT: DWORD = 8192; +pub const D3D11_CS_TGSM_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_CS_THREADGROUPID_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_CS_THREADGROUPID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREADIDINGROUP_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_CS_THREADIDINGROUP_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREADID_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_CS_THREADID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP: DWORD = 1024; +pub const D3D11_CS_THREAD_GROUP_MAX_X: DWORD = 1024; +pub const D3D11_CS_THREAD_GROUP_MAX_Y: DWORD = 1024; +pub const D3D11_CS_THREAD_GROUP_MAX_Z: DWORD = 64; +pub const D3D11_CS_THREAD_GROUP_MIN_X: DWORD = 1; +pub const D3D11_CS_THREAD_GROUP_MIN_Y: DWORD = 1; +pub const D3D11_CS_THREAD_GROUP_MIN_Z: DWORD = 1; +pub const D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL: DWORD = 16384; +pub const D3D11_DEFAULT_BLEND_FACTOR_ALPHA: FLOAT = 1.0; +pub const D3D11_DEFAULT_BLEND_FACTOR_BLUE: FLOAT = 1.0; +pub const D3D11_DEFAULT_BLEND_FACTOR_GREEN: FLOAT = 1.0; +pub const D3D11_DEFAULT_BLEND_FACTOR_RED: FLOAT = 1.0; +pub const D3D11_DEFAULT_BORDER_COLOR_COMPONENT: FLOAT = 0.0; +pub const D3D11_DEFAULT_DEPTH_BIAS: DWORD = 0; +pub const D3D11_DEFAULT_DEPTH_BIAS_CLAMP: FLOAT = 0.0; +pub const D3D11_DEFAULT_MAX_ANISOTROPY: DWORD = 16; +pub const D3D11_DEFAULT_MIP_LOD_BIAS: FLOAT = 0.0; +pub const D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX: DWORD = 0; +pub const D3D11_DEFAULT_SAMPLE_MASK: DWORD = 0xffffffff; +pub const D3D11_DEFAULT_SCISSOR_ENDX: DWORD = 0; +pub const D3D11_DEFAULT_SCISSOR_ENDY: DWORD = 0; +pub const D3D11_DEFAULT_SCISSOR_STARTX: DWORD = 0; +pub const D3D11_DEFAULT_SCISSOR_STARTY: DWORD = 0; +pub const D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS: FLOAT = 0.0; +pub const D3D11_DEFAULT_STENCIL_READ_MASK: DWORD = 0xff; +pub const D3D11_DEFAULT_STENCIL_REFERENCE: DWORD = 0; +pub const D3D11_DEFAULT_STENCIL_WRITE_MASK: DWORD = 0xff; +pub const D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_HEIGHT: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_MAX_DEPTH: FLOAT = 0.0; +pub const D3D11_DEFAULT_VIEWPORT_MIN_DEPTH: FLOAT = 0.0; +pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTX: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTY: DWORD = 0; +pub const D3D11_DEFAULT_VIEWPORT_WIDTH: DWORD = 0; +pub const D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: DWORD = 3968; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS: DWORD = 3; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT: DWORD = 1; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_DS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_DS_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP: FLOAT = 0.6; +pub const D3D11_FLOAT32_MAX: FLOAT = 3.402823466E+38; +pub const D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP: FLOAT = 0.6; +pub const D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR: FLOAT = 2.4; +pub const D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR: FLOAT = 1.0; +pub const D3D11_FLOAT_TO_SRGB_OFFSET: FLOAT = 0.055; +pub const D3D11_FLOAT_TO_SRGB_SCALE_1: FLOAT = 12.92; +pub const D3D11_FLOAT_TO_SRGB_SCALE_2: FLOAT = 1.055; +pub const D3D11_FLOAT_TO_SRGB_THRESHOLD: FLOAT = 0.0031308; +pub const D3D11_FTOI_INSTRUCTION_MAX_INPUT: FLOAT = 2147483647.999; +pub const D3D11_FTOI_INSTRUCTION_MIN_INPUT: FLOAT = -2147483648.999; +pub const D3D11_FTOU_INSTRUCTION_MAX_INPUT: FLOAT = 4294967295.999; +pub const D3D11_FTOU_INSTRUCTION_MIN_INPUT: FLOAT = 0.0; +pub const D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST: DWORD = 2; +pub const D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS: DWORD = 1; +pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT: DWORD = 1; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_GS_INPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_GS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_GS_INPUT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_GS_INPUT_REGISTER_VERTICES: DWORD = 32; +pub const D3D11_GS_MAX_INSTANCE_COUNT: DWORD = 32; +pub const D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES: DWORD = 1024; +pub const D3D11_GS_OUTPUT_ELEMENTS: DWORD = 32; +pub const D3D11_GS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_GS_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND: DWORD = 0xffffffff; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND: DWORD = 0xffffffff; +pub const D3D11_HS_MAXTESSFACTOR_LOWER_BOUND: FLOAT = 1.0; +pub const D3D11_HS_MAXTESSFACTOR_UPPER_BOUND: FLOAT = 64.0; +pub const D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: DWORD = 3968; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT: DWORD = 1; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS: DWORD = 128; +pub const D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES: DWORD = 0; +pub const D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY: DWORD = 0; +pub const D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES: DWORD = 0; +pub const D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT: DWORD = 1; +pub const D3D11_IA_INSTANCE_ID_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT: DWORD = 32; +pub const D3D11_IA_PRIMITIVE_ID_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_VERTEX_ID_BIT_COUNT: DWORD = 32; +pub const D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT: DWORD = 32; +pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS: DWORD = 128; +pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT: DWORD = 32; +pub const D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT: DWORD = 0xffffffff; +pub const D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER: DWORD = 0xffffffff; +pub const D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL: DWORD = 0xffffffff; +pub const D3D11_KEEP_UNORDERED_ACCESS_VIEWS: DWORD = 0xffffffff; +pub const D3D11_LINEAR_GAMMA: FLOAT = 1.0; +pub const D3D11_MAJOR_VERSION: DWORD = 11; +pub const D3D11_MAX_BORDER_COLOR_COMPONENT: FLOAT = 1.0; +pub const D3D11_MAX_DEPTH: FLOAT = 1.0; +pub const D3D11_MAX_MAXANISOTROPY: DWORD = 16; +pub const D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT: DWORD = 32; +pub const D3D11_MAX_POSITION_VALUE: FLOAT = 3.402823466E+34; +pub const D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP: DWORD = 17; +pub const D3D11_MINOR_VERSION: DWORD = 0; +pub const D3D11_MIN_BORDER_COLOR_COMPONENT: FLOAT = 0.0; +pub const D3D11_MIN_DEPTH: FLOAT = 0.0; +pub const D3D11_MIN_MAXANISOTROPY: DWORD = 0; +pub const D3D11_MIP_LOD_BIAS_MAX: FLOAT = 15.99; +pub const D3D11_MIP_LOD_BIAS_MIN: FLOAT = -16.0; +pub const D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT: DWORD = 8; +pub const D3D11_MIP_LOD_RANGE_BIT_COUNT: DWORD = 8; +pub const D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH: FLOAT = 1.4; +pub const D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT: DWORD = 0; +pub const D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 15; +pub const D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 16; +pub const D3D11_PS_CS_UAV_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_PS_CS_UAV_REGISTER_COUNT: DWORD = 8; +pub const D3D11_PS_CS_UAV_REGISTER_READS_PER_INST: DWORD = 1; +pub const D3D11_PS_CS_UAV_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_PS_FRONTFACING_DEFAULT_VALUE: DWORD = 0xffffffff; +pub const D3D11_PS_FRONTFACING_FALSE_VALUE: DWORD = 0; +pub const D3D11_PS_FRONTFACING_TRUE_VALUE: DWORD = 0xffffffff; +pub const D3D11_PS_INPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_PS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_PS_INPUT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.0; +pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT: DWORD = 1; +pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS: DWORD = 1; +pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_OUTPUT_MASK_REGISTER_COUNT: DWORD = 1; +pub const D3D11_PS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_PS_OUTPUT_REGISTER_COUNT: DWORD = 8; +pub const D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.5; +pub const D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT: DWORD = 16; +pub const D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP: DWORD = 27; +pub const D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT: DWORD = 4096; +pub const D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: DWORD = 32; +pub const D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP: DWORD = 32; +pub const D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION: DWORD = 16384; +pub const D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT: DWORD = 1024; +pub const D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT: DWORD = 4096; +pub const D3D11_REQ_MAXANISOTROPY: DWORD = 16; +pub const D3D11_REQ_MIP_LEVELS: DWORD = 15; +pub const D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES: DWORD = 2048; +pub const D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH: DWORD = 16384; +pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM: DWORD = 128; +pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM: FLOAT = 0.25; +pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM: DWORD = 2048; +pub const D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP: DWORD = 20; +pub const D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; +pub const D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION: DWORD = 2048; +pub const D3D11_REQ_TEXTURE1D_U_DIMENSION: DWORD = 16384; +pub const D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION: DWORD = 2048; +pub const D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION: DWORD = 16384; +pub const D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION: DWORD = 2048; +pub const D3D11_REQ_TEXTURECUBE_DIMENSION: DWORD = 16384; +pub const D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL: DWORD = 0; +pub const D3D11_SHADER_MAJOR_VERSION: DWORD = 5; +pub const D3D11_SHADER_MAX_INSTANCES: DWORD = 65535; +pub const D3D11_SHADER_MAX_INTERFACES: DWORD = 253; +pub const D3D11_SHADER_MAX_INTERFACE_CALL_SITES: DWORD = 4096; +pub const D3D11_SHADER_MAX_TYPES: DWORD = 65535; +pub const D3D11_SHADER_MINOR_VERSION: DWORD = 0; +pub const D3D11_SHIFT_INSTRUCTION_PAD_VALUE: DWORD = 0; +pub const D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT: DWORD = 5; +pub const D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT: DWORD = 8; +pub const D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES: DWORD = 2048; +pub const D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES: DWORD = 512; +pub const D3D11_SO_BUFFER_SLOT_COUNT: DWORD = 4; +pub const D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP: DWORD = 0xffffffff; +pub const D3D11_SO_NO_RASTERIZED_STREAM: DWORD = 0xffffffff; +pub const D3D11_SO_OUTPUT_COMPONENT_COUNT: DWORD = 128; +pub const D3D11_SO_STREAM_COUNT: DWORD = 4; +pub const D3D11_SPEC_DATE_DAY: DWORD = 16; +pub const D3D11_SPEC_DATE_MONTH: DWORD = 05; +pub const D3D11_SPEC_DATE_YEAR: DWORD = 2011; +pub const D3D11_SPEC_VERSION: FLOAT = 1.07; +pub const D3D11_SRGB_GAMMA: FLOAT = 2.2; +pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_1: FLOAT = 12.92; +pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_2: FLOAT = 1.055; +pub const D3D11_SRGB_TO_FLOAT_EXPONENT: FLOAT = 2.4; +pub const D3D11_SRGB_TO_FLOAT_OFFSET: FLOAT = 0.055; +pub const D3D11_SRGB_TO_FLOAT_THRESHOLD: FLOAT = 0.04045; +pub const D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP: FLOAT = 0.5; +pub const D3D11_STANDARD_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED: DWORD = 64; +pub const D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE: DWORD = 4; +pub const D3D11_STANDARD_PIXEL_COMPONENT_COUNT: DWORD = 128; +pub const D3D11_STANDARD_PIXEL_ELEMENT_COUNT: DWORD = 32; +pub const D3D11_STANDARD_VECTOR_SIZE: DWORD = 4; +pub const D3D11_STANDARD_VERTEX_ELEMENT_COUNT: DWORD = 32; +pub const D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT: DWORD = 64; +pub const D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT: DWORD = 8; +pub const D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT: DWORD = 8; +pub const D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR: DWORD = 64; +pub const D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR: DWORD = 64; +pub const D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR: DWORD = 63; +pub const D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR: DWORD = 64; +pub const D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR: DWORD = 2; +pub const D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR: DWORD = 1; +pub const D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR: DWORD = 1; +pub const D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 16; +pub const D3D11_UNBOUND_MEMORY_ACCESS_RESULT: DWORD = 0; +pub const D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX: DWORD = 15; +pub const D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE: DWORD = 16; +pub const D3D11_VIEWPORT_BOUNDS_MAX: DWORD = 32767; +pub const D3D11_VIEWPORT_BOUNDS_MIN: c_long = -32768; +pub const D3D11_VS_INPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_VS_INPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_VS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; +pub const D3D11_VS_INPUT_REGISTER_READ_PORTS: DWORD = 1; +pub const D3D11_VS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; +pub const D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; +pub const D3D11_VS_OUTPUT_REGISTER_COUNT: DWORD = 32; +pub const D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT: DWORD = 10; +pub const D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: DWORD = 25; +pub const D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP: DWORD = 25; +pub const D3D11_1_UAV_SLOT_COUNT: DWORD = 64; +pub const D3D11_2_TILED_RESOURCE_TILE_SIZE_IN_BYTES: DWORD = 65536; +ENUM!{enum D3D11_INPUT_CLASSIFICATION { + D3D11_INPUT_PER_VERTEX_DATA = 0, + D3D11_INPUT_PER_INSTANCE_DATA = 1, +}} +pub const D3D11_APPEND_ALIGNED_ELEMENT: DWORD = 0xffffffff; +STRUCT!{struct D3D11_INPUT_ELEMENT_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Format: DXGI_FORMAT, + InputSlot: UINT, + AlignedByteOffset: UINT, + InputSlotClass: D3D11_INPUT_CLASSIFICATION, + InstanceDataStepRate: UINT, +}} +ENUM!{enum D3D11_FILL_MODE { + D3D11_FILL_WIREFRAME = 2, + D3D11_FILL_SOLID = 3, +}} +pub type D3D11_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY; +pub type D3D11_PRIMITIVE = D3D_PRIMITIVE; +ENUM!{enum D3D11_CULL_MODE { + D3D11_CULL_NONE = 1, + D3D11_CULL_FRONT = 2, + D3D11_CULL_BACK = 3, +}} +STRUCT!{struct D3D11_SO_DECLARATION_ENTRY { + Stream: UINT, + SemanticName: LPCSTR, + SemanticIndex: UINT, + StartComponent: BYTE, + ComponentCount: BYTE, + OutputSlot: BYTE, +}} +STRUCT!{struct D3D11_VIEWPORT { + TopLeftX: FLOAT, + TopLeftY: FLOAT, + Width: FLOAT, + Height: FLOAT, + MinDepth: FLOAT, + MaxDepth: FLOAT, +}} +STRUCT!{struct D3D11_DRAW_INSTANCED_INDIRECT_ARGS { + VertexCountPerInstance: UINT, + InstanceCount: UINT, + StartVertexLocation: UINT, + StartInstanceLocation: UINT, +}} +STRUCT!{struct D3D11_DRAW_INDEXED_INSTANCED_INDIRECT_ARGS { + IndexCountPerInstance: UINT, + InstanceCount: UINT, + StartIndexLocation: UINT, + BaseVertexLocation: INT, + StartInstanceLocation: UINT, +}} +ENUM!{enum D3D11_RESOURCE_DIMENSION { + D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D11_RESOURCE_DIMENSION_BUFFER = 1, + D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4, +}} +pub type D3D11_SRV_DIMENSION = D3D_SRV_DIMENSION; +ENUM!{enum D3D11_DSV_DIMENSION { + D3D11_DSV_DIMENSION_UNKNOWN = 0, + D3D11_DSV_DIMENSION_TEXTURE1D = 1, + D3D11_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D11_DSV_DIMENSION_TEXTURE2D = 3, + D3D11_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D11_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, +}} +ENUM!{enum D3D11_RTV_DIMENSION { + D3D11_RTV_DIMENSION_UNKNOWN = 0, + D3D11_RTV_DIMENSION_BUFFER = 1, + D3D11_RTV_DIMENSION_TEXTURE1D = 2, + D3D11_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D11_RTV_DIMENSION_TEXTURE2D = 4, + D3D11_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D11_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D11_RTV_DIMENSION_TEXTURE3D = 8, +}} +ENUM!{enum D3D11_UAV_DIMENSION { + D3D11_UAV_DIMENSION_UNKNOWN = 0, + D3D11_UAV_DIMENSION_BUFFER = 1, + D3D11_UAV_DIMENSION_TEXTURE1D = 2, + D3D11_UAV_DIMENSION_TEXTURE1DARRAY = 3, + D3D11_UAV_DIMENSION_TEXTURE2D = 4, + D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5, + D3D11_UAV_DIMENSION_TEXTURE3D = 8, +}} +ENUM!{enum D3D11_USAGE { + D3D11_USAGE_DEFAULT = 0, + D3D11_USAGE_IMMUTABLE = 1, + D3D11_USAGE_DYNAMIC = 2, + D3D11_USAGE_STAGING = 3, +}} +ENUM!{enum D3D11_BIND_FLAG { + D3D11_BIND_VERTEX_BUFFER = 0x1, + D3D11_BIND_INDEX_BUFFER = 0x2, + D3D11_BIND_CONSTANT_BUFFER = 0x4, + D3D11_BIND_SHADER_RESOURCE = 0x8, + D3D11_BIND_STREAM_OUTPUT = 0x10, + D3D11_BIND_RENDER_TARGET = 0x20, + D3D11_BIND_DEPTH_STENCIL = 0x40, + D3D11_BIND_UNORDERED_ACCESS = 0x80, + D3D11_BIND_DECODER = 0x200, + D3D11_BIND_VIDEO_ENCODER = 0x400, +}} +ENUM!{enum D3D11_CPU_ACCESS_FLAG { + D3D11_CPU_ACCESS_WRITE = 0x10000, + D3D11_CPU_ACCESS_READ = 0x20000, +}} +ENUM!{enum D3D11_RESOURCE_MISC_FLAG { + D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1, + D3D11_RESOURCE_MISC_SHARED = 0x2, + D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4, + D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10, + D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20, + D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40, + D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80, + D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100, + D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200, + D3D11_RESOURCE_MISC_SHARED_NTHANDLE = 0x800, + D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = 0x1000, + D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = 0x2000, + D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER = 0x4000, + D3D11_RESOURCE_MISC_GUARDED = 0x8000, + D3D11_RESOURCE_MISC_TILE_POOL = 0x20000, + D3D11_RESOURCE_MISC_TILED = 0x40000, + D3D11_RESOURCE_MISC_HW_PROTECTED = 0x80000, +}} +ENUM!{enum D3D11_MAP { + D3D11_MAP_READ = 1, + D3D11_MAP_WRITE = 2, + D3D11_MAP_READ_WRITE = 3, + D3D11_MAP_WRITE_DISCARD = 4, + D3D11_MAP_WRITE_NO_OVERWRITE = 5, +}} +ENUM!{enum D3D11_MAP_FLAG { + D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000, +}} +ENUM!{enum D3D11_RAISE_FLAG { + D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1, +}} +ENUM!{enum D3D11_CLEAR_FLAG { + D3D11_CLEAR_DEPTH = 0x1, + D3D11_CLEAR_STENCIL = 0x2, +}} +pub type D3D11_RECT = RECT; +STRUCT!{struct D3D11_BOX { + left: UINT, + top: UINT, + front: UINT, + right: UINT, + bottom: UINT, + back: UINT, +}} +RIDL!{#[uuid(0x1841e5c8, 0x16b0, 0x489b, 0xbc, 0xc8, 0x44, 0xcf, 0xb0, 0xd5, 0xde, 0xae)] +interface ID3D11DeviceChild(ID3D11DeviceChildVtbl): IUnknown(IUnknownVtbl) { + fn GetDevice( + ppDevice: *mut *mut ID3D11Device, + ) -> (), + fn GetPrivateData( + guid: REFGUID, + pDataSize: *mut UINT, + pData: *mut c_void, + ) -> HRESULT, + fn SetPrivateData( + guid: REFGUID, + DataSize: UINT, + pData: *const c_void, + ) -> HRESULT, + fn SetPrivateDataInterface( + guid: REFGUID, + pData: *const IUnknown, + ) -> HRESULT, +}} +ENUM!{enum D3D11_COMPARISON_FUNC { + D3D11_COMPARISON_NEVER = 1, + D3D11_COMPARISON_LESS = 2, + D3D11_COMPARISON_EQUAL = 3, + D3D11_COMPARISON_LESS_EQUAL = 4, + D3D11_COMPARISON_GREATER = 5, + D3D11_COMPARISON_NOT_EQUAL = 6, + D3D11_COMPARISON_GREATER_EQUAL = 7, + D3D11_COMPARISON_ALWAYS = 8, +}} +ENUM!{enum D3D11_DEPTH_WRITE_MASK { + D3D11_DEPTH_WRITE_MASK_ZERO = 0, + D3D11_DEPTH_WRITE_MASK_ALL = 1, +}} +ENUM!{enum D3D11_STENCIL_OP { + D3D11_STENCIL_OP_KEEP = 1, + D3D11_STENCIL_OP_ZERO = 2, + D3D11_STENCIL_OP_REPLACE = 3, + D3D11_STENCIL_OP_INCR_SAT = 4, + D3D11_STENCIL_OP_DECR_SAT = 5, + D3D11_STENCIL_OP_INVERT = 6, + D3D11_STENCIL_OP_INCR = 7, + D3D11_STENCIL_OP_DECR = 8, +}} +STRUCT!{struct D3D11_DEPTH_STENCILOP_DESC { + StencilFailOp: D3D11_STENCIL_OP, + StencilDepthFailOp: D3D11_STENCIL_OP, + StencilPassOp: D3D11_STENCIL_OP, + StencilFunc: D3D11_COMPARISON_FUNC, +}} +STRUCT!{struct D3D11_DEPTH_STENCIL_DESC { + DepthEnable: BOOL, + DepthWriteMask: D3D11_DEPTH_WRITE_MASK, + DepthFunc: D3D11_COMPARISON_FUNC, + StencilEnable: BOOL, + StencilReadMask: UINT8, + StencilWriteMask: UINT8, + FrontFace: D3D11_DEPTH_STENCILOP_DESC, + BackFace: D3D11_DEPTH_STENCILOP_DESC, +}} +RIDL!{#[uuid(0x03823efb, 0x8d8f, 0x4e1c, 0x9a, 0xa2, 0xf6, 0x4b, 0xb2, 0xcb, 0xfd, 0xf1)] +interface ID3D11DepthStencilState(ID3D11DepthStencilStateVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc( + pDesc: *mut D3D11_DEPTH_STENCIL_DESC, + ) -> (), +}} +ENUM!{enum D3D11_BLEND { + D3D11_BLEND_ZERO = 1, + D3D11_BLEND_ONE = 2, + D3D11_BLEND_SRC_COLOR = 3, + D3D11_BLEND_INV_SRC_COLOR = 4, + D3D11_BLEND_SRC_ALPHA = 5, + D3D11_BLEND_INV_SRC_ALPHA = 6, + D3D11_BLEND_DEST_ALPHA = 7, + D3D11_BLEND_INV_DEST_ALPHA = 8, + D3D11_BLEND_DEST_COLOR = 9, + D3D11_BLEND_INV_DEST_COLOR = 10, + D3D11_BLEND_SRC_ALPHA_SAT = 11, + D3D11_BLEND_BLEND_FACTOR = 14, + D3D11_BLEND_INV_BLEND_FACTOR = 15, + D3D11_BLEND_SRC1_COLOR = 16, + D3D11_BLEND_INV_SRC1_COLOR = 17, + D3D11_BLEND_SRC1_ALPHA = 18, + D3D11_BLEND_INV_SRC1_ALPHA = 19, +}} +ENUM!{enum D3D11_BLEND_OP { + D3D11_BLEND_OP_ADD = 1, + D3D11_BLEND_OP_SUBTRACT = 2, + D3D11_BLEND_OP_REV_SUBTRACT = 3, + D3D11_BLEND_OP_MIN = 4, + D3D11_BLEND_OP_MAX = 5, +}} +ENUM!{enum D3D11_COLOR_WRITE_ENABLE { + D3D11_COLOR_WRITE_ENABLE_RED = 1, + D3D11_COLOR_WRITE_ENABLE_GREEN = 2, + D3D11_COLOR_WRITE_ENABLE_BLUE = 4, + D3D11_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D11_COLOR_WRITE_ENABLE_ALL = D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN + | D3D11_COLOR_WRITE_ENABLE_BLUE | D3D11_COLOR_WRITE_ENABLE_ALPHA, +}} +STRUCT!{struct D3D11_RENDER_TARGET_BLEND_DESC { + BlendEnable: BOOL, + SrcBlend: D3D11_BLEND, + DestBlend: D3D11_BLEND, + BlendOp: D3D11_BLEND_OP, + SrcBlendAlpha: D3D11_BLEND, + DestBlendAlpha: D3D11_BLEND, + BlendOpAlpha: D3D11_BLEND_OP, + RenderTargetWriteMask: UINT8, +}} +STRUCT!{struct D3D11_BLEND_DESC { + AlphaToCoverageEnable: BOOL, + IndependentBlendEnable: BOOL, + RenderTarget: [D3D11_RENDER_TARGET_BLEND_DESC; 8], +}} +RIDL!{#[uuid(0x75b68faa, 0x347d, 0x4159, 0x8f, 0x45, 0xa0, 0x64, 0x0f, 0x01, 0xcd, 0x9a)] +interface ID3D11BlendState(ID3D11BlendStateVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc( + pDesc: *mut D3D11_BLEND_DESC, + ) -> (), +}} +STRUCT!{struct D3D11_RASTERIZER_DESC { + FillMode: D3D11_FILL_MODE, + CullMode: D3D11_CULL_MODE, + FrontCounterClockwise: BOOL, + DepthBias: INT, + DepthBiasClamp: FLOAT, + SlopeScaledDepthBias: FLOAT, + DepthClipEnable: BOOL, + ScissorEnable: BOOL, + MultisampleEnable: BOOL, + AntialiasedLineEnable: BOOL, +}} +RIDL!{#[uuid(0x9bb4ab81, 0xab1a, 0x4d8f, 0xb5, 0x06, 0xfc, 0x04, 0x20, 0x0b, 0x6e, 0xe7)] +interface ID3D11RasterizerState(ID3D11RasterizerStateVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc( + pDesc: *mut D3D11_RASTERIZER_DESC, + ) -> (), +}} +STRUCT!{struct D3D11_SUBRESOURCE_DATA { + pSysMem: *const c_void, + SysMemPitch: UINT, + SysMemSlicePitch: UINT, +}} +STRUCT!{struct D3D11_MAPPED_SUBRESOURCE { + pData: *mut c_void, + RowPitch: UINT, + DepthPitch: UINT, +}} +RIDL!{#[uuid(0xdc8e63f3, 0xd12b, 0x4952, 0xb4, 0x7b, 0x5e, 0x45, 0x02, 0x6a, 0x86, 0x2d)] +interface ID3D11Resource(ID3D11ResourceVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetType( + pResourceDimension: *mut D3D11_RESOURCE_DIMENSION, + ) -> (), + fn SetEvictionPriority( + EvictionPriority: UINT, + ) -> (), + fn GetEvictionPriority() -> UINT, +}} +STRUCT!{struct D3D11_BUFFER_DESC { + ByteWidth: UINT, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, + StructureByteStride: UINT, +}} +RIDL!{#[uuid(0x48570b85, 0xd1ee, 0x4fcd, 0xa2, 0x50, 0xeb, 0x35, 0x07, 0x22, 0xb0, 0x37)] +interface ID3D11Buffer(ID3D11BufferVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc( + pDesc: *mut D3D11_BUFFER_DESC, + ) -> (), +}} +STRUCT!{struct D3D11_TEXTURE1D_DESC { + Width: UINT, + MipLevels: UINT, + ArraySize: UINT, + Format: DXGI_FORMAT, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, +}} +RIDL!{#[uuid(0xf8fb5c27, 0xc6b3, 0x4f75, 0xa4, 0xc8, 0x43, 0x9a, 0xf2, 0xef, 0x56, 0x4c)] +interface ID3D11Texture1D(ID3D11Texture1DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc( + pDesc: *mut D3D11_TEXTURE1D_DESC, + ) -> (), +}} +STRUCT!{struct D3D11_TEXTURE2D_DESC { + Width: UINT, + Height: UINT, + MipLevels: UINT, + ArraySize: UINT, + Format: DXGI_FORMAT, + SampleDesc: DXGI_SAMPLE_DESC, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, +}} +RIDL!{#[uuid(0x6f15aaf2, 0xd208, 0x4e89, 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c)] +interface ID3D11Texture2D(ID3D11Texture2DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc( + pDesc: *mut D3D11_TEXTURE2D_DESC, + ) -> (), +}} +STRUCT!{struct D3D11_TEXTURE3D_DESC { + Width: UINT, + Height: UINT, + Depth: UINT, + MipLevels: UINT, + Format: DXGI_FORMAT, + Usage: D3D11_USAGE, + BindFlags: UINT, + CPUAccessFlags: UINT, + MiscFlags: UINT, +}} +RIDL!{#[uuid(0x037e866e, 0xf56d, 0x4357, 0xa8, 0xaf, 0x9d, 0xab, 0xbe, 0x6e, 0x25, 0x0e)] +interface ID3D11Texture3D(ID3D11Texture3DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { + fn GetDesc( + pDesc: *mut D3D11_TEXTURE3D_DESC, + ) -> (), +}} +ENUM!{enum D3D11_TEXTURECUBE_FACE { + D3D11_TEXTURECUBE_FACE_POSITIVE_X = 0, + D3D11_TEXTURECUBE_FACE_NEGATIVE_X = 1, + D3D11_TEXTURECUBE_FACE_POSITIVE_Y = 2, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Y = 3, + D3D11_TEXTURECUBE_FACE_POSITIVE_Z = 4, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Z = 5, +}} +RIDL!{#[uuid(0x839d1216, 0xbb2e, 0x412b, 0xb7, 0xf4, 0xa9, 0xdb, 0xeb, 0xe0, 0x8e, 0xd1)] +interface ID3D11View(ID3D11ViewVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetResource( + ppResource: *mut *mut ID3D11Resource, + ) -> (), +}} +UNION!{union D3D11_BUFFER_SRV_u1 { + [u32; 1], + FirstElement FirstElement_mut: UINT, + ElementOffset ElementOffset_mut: UINT, +}} +UNION!{union D3D11_BUFFER_SRV_u2 { + [u32; 1], + NumElements NumElements_mut: UINT, + ElementWidth ElementWidth_mut: UINT, +}} +STRUCT!{struct D3D11_BUFFER_SRV { + u1: D3D11_BUFFER_SRV_u1, + u2: D3D11_BUFFER_SRV_u2, +}} +ENUM!{enum D3D11_BUFFEREX_SRV_FLAG { + D3D11_BUFFEREX_SRV_FLAG_RAW = 0x1, +}} +STRUCT!{struct D3D11_BUFFEREX_SRV { + FirstElement: UINT, + NumElements: UINT, + Flags: UINT, +}} +STRUCT!{struct D3D11_TEX1D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX3D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEXCUBE_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, +}} +STRUCT!{struct D3D11_TEXCUBE_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + First2DArrayFace: UINT, + NumCubes: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_SRV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_ARRAY_SRV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +UNION!{union D3D11_SHADER_RESOURCE_VIEW_DESC_u { + [u32; 4], + Buffer Buffer_mut: D3D11_BUFFER_SRV, + Texture1D Texture1D_mut: D3D11_TEX1D_SRV, + Texture1DArray Texture1DArray_mut: D3D11_TEX1D_ARRAY_SRV, + Texture2D Texture2D_mut: D3D11_TEX2D_SRV, + Texture2DArray Texture2DArray_mut: D3D11_TEX2D_ARRAY_SRV, + Texture2DMS Texture2DMS_mut: D3D11_TEX2DMS_SRV, + Texture2DMSArray Texture2DMSArray_mut: D3D11_TEX2DMS_ARRAY_SRV, + Texture3D Texture3D_mut: D3D11_TEX3D_SRV, + TextureCube TextureCube_mut: D3D11_TEXCUBE_SRV, + TextureCubeArray TextureCubeArray_mut: D3D11_TEXCUBE_ARRAY_SRV, + BufferEx BufferEx_mut: D3D11_BUFFEREX_SRV, +}} +STRUCT!{struct D3D11_SHADER_RESOURCE_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_SRV_DIMENSION, + u: D3D11_SHADER_RESOURCE_VIEW_DESC_u, +}} +RIDL!{#[uuid(0xb0e06fe0, 0x8192, 0x4e1a, 0xb1, 0xca, 0x36, 0xd7, 0x41, 0x47, 0x10, 0xb2)] +interface ID3D11ShaderResourceView(ID3D11ShaderResourceViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc( + pDesc: *mut D3D11_SHADER_RESOURCE_VIEW_DESC, + ) -> (), +}} +UNION!{union D3D11_BUFFER_RTV_u1 { + [u32; 1], + FirstElement FirstElement_mut: UINT, + ElementOffset ElementOffset_mut: UINT, +}} +UNION!{union D3D11_BUFFER_RTV_u2 { + [u32; 1], + NumElements NumElements_mut: UINT, + ElementWidth ElementWidth_mut: UINT, +}} +STRUCT!{struct D3D11_BUFFER_RTV { + u1: D3D11_BUFFER_RTV_u1, + u2: D3D11_BUFFER_RTV_u2, +}} +STRUCT!{struct D3D11_TEX1D_RTV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_RTV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_RTV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_RTV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_RTV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_ARRAY_RTV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX3D_RTV { + MipSlice: UINT, + FirstWSlice: UINT, + WSize: UINT, +}} +UNION!{union D3D11_RENDER_TARGET_VIEW_DESC_u { + [u32; 3], + Buffer Buffer_mut: D3D11_BUFFER_RTV, + Texture1D Texture1D_mut: D3D11_TEX1D_RTV, + Texture1DArray Texture1DArray_mut: D3D11_TEX1D_ARRAY_RTV, + Texture2D Texture2D_mut: D3D11_TEX2D_RTV, + Texture2DArray Texture2DArray_mut: D3D11_TEX2D_ARRAY_RTV, + Texture2DMS Texture2DMS_mut: D3D11_TEX2DMS_RTV, + Texture2DMSArray Texture2DMSArray_mut: D3D11_TEX2DMS_ARRAY_RTV, + Texture3D Texture3D_mut: D3D11_TEX3D_RTV, +}} +STRUCT!{struct D3D11_RENDER_TARGET_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_RTV_DIMENSION, + u: D3D11_RENDER_TARGET_VIEW_DESC_u, +}} +RIDL!{#[uuid(0xdfdba067, 0x0b8d, 0x4865, 0x87, 0x5b, 0xd7, 0xb4, 0x51, 0x6c, 0xc1, 0x64)] +interface ID3D11RenderTargetView(ID3D11RenderTargetViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc( + pDesc: *mut D3D11_RENDER_TARGET_VIEW_DESC, + ) -> (), +}} +STRUCT!{struct D3D11_TEX1D_DSV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_DSV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_DSV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_DSV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_DSV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D11_TEX2DMS_ARRAY_DSV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +ENUM!{enum D3D11_DSV_FLAG { + D3D11_DSV_READ_ONLY_DEPTH = 0x1, + D3D11_DSV_READ_ONLY_STENCIL = 0x2, +}} +UNION!{union D3D11_DEPTH_STENCIL_VIEW_DESC_u { + [u32; 3], + Texture1D Texture1D_mut: D3D11_TEX1D_DSV, + Texture1DArray Texture1DArray_mut: D3D11_TEX1D_ARRAY_DSV, + Texture2D Texture2D_mut: D3D11_TEX2D_DSV, + Texture2DArray Texture2DArray_mut: D3D11_TEX2D_ARRAY_DSV, + Texture2DMS Texture2DMS_mut: D3D11_TEX2DMS_DSV, + Texture2DMSArray Texture2DMSArray_mut: D3D11_TEX2DMS_ARRAY_DSV, +}} +STRUCT!{struct D3D11_DEPTH_STENCIL_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_DSV_DIMENSION, + Flags: UINT, + u: D3D11_DEPTH_STENCIL_VIEW_DESC_u, +}} +RIDL!{#[uuid(0x9fdac92a, 0x1876, 0x48c3, 0xaf, 0xad, 0x25, 0xb9, 0x4f, 0x84, 0xa9, 0xb6)] +interface ID3D11DepthStencilView(ID3D11DepthStencilViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc( + pDesc: *mut D3D11_DEPTH_STENCIL_VIEW_DESC, + ) -> (), +}} +ENUM!{enum D3D11_BUFFER_UAV_FLAG { + D3D11_BUFFER_UAV_FLAG_RAW = 0x1, + D3D11_BUFFER_UAV_FLAG_APPEND = 0x2, + D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4, +}} +STRUCT!{struct D3D11_BUFFER_UAV { + FirstElement: UINT, + NumElements: UINT, + Flags: UINT, +}} +STRUCT!{struct D3D11_TEX1D_UAV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX1D_ARRAY_UAV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX2D_UAV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_UAV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D11_TEX3D_UAV { + MipSlice: UINT, + FirstWSlice: UINT, + WSize: UINT, +}} +UNION!{union D3D11_UNORDERED_ACCESS_VIEW_DESC_u { + [u32; 3], + Buffer Buffer_mut: D3D11_BUFFER_UAV, + Texture1D Texture1D_mut: D3D11_TEX1D_UAV, + Texture1DArray Texture1DArray_mut: D3D11_TEX1D_ARRAY_UAV, + Texture2D Texture2D_mut: D3D11_TEX2D_UAV, + Texture2DArray Texture2DArray_mut: D3D11_TEX2D_ARRAY_UAV, + Texture3D Texture3D_mut: D3D11_TEX3D_UAV, +}} +STRUCT!{struct D3D11_UNORDERED_ACCESS_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D11_UAV_DIMENSION, + u: D3D11_UNORDERED_ACCESS_VIEW_DESC_u, +}} +RIDL!{#[uuid(0x28acf509, 0x7f5c, 0x48f6, 0x86, 0x11, 0xf3, 0x16, 0x01, 0x0a, 0x63, 0x80)] +interface ID3D11UnorderedAccessView(ID3D11UnorderedAccessViewVtbl): ID3D11View(ID3D11ViewVtbl) { + fn GetDesc( + pDesc: *mut D3D11_UNORDERED_ACCESS_VIEW_DESC, + ) -> (), +}} +RIDL!{#[uuid(0x3b301d64, 0xd678, 0x4289, 0x88, 0x97, 0x22, 0xf8, 0x92, 0x8b, 0x72, 0xf3)] +interface ID3D11VertexShader(ID3D11VertexShaderVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{#[uuid(0x8e5c6061, 0x628a, 0x4c8e, 0x82, 0x64, 0xbb, 0xe4, 0x5c, 0xb3, 0xd5, 0xdd)] +interface ID3D11HullShader(ID3D11HullShaderVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{#[uuid(0xf582c508, 0x0f36, 0x490c, 0x99, 0x77, 0x31, 0xee, 0xce, 0x26, 0x8c, 0xfa)] +interface ID3D11DomainShader(ID3D11DomainShaderVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{#[uuid(0x38325b96, 0xeffb, 0x4022, 0xba, 0x02, 0x2e, 0x79, 0x5b, 0x70, 0x27, 0x5c)] +interface ID3D11GeometryShader(ID3D11GeometryShaderVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{#[uuid(0xea82e40d, 0x51dc, 0x4f33, 0x93, 0xd4, 0xdb, 0x7c, 0x91, 0x25, 0xae, 0x8c)] +interface ID3D11PixelShader(ID3D11PixelShaderVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{#[uuid(0x4f5b196e, 0xc2bd, 0x495e, 0xbd, 0x01, 0x1f, 0xde, 0xd3, 0x8e, 0x49, 0x69)] +interface ID3D11ComputeShader(ID3D11ComputeShaderVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +RIDL!{#[uuid(0xe4819ddc, 0x4cf0, 0x4025, 0xbd, 0x26, 0x5d, 0xe8, 0x2a, 0x3e, 0x07, 0xb7)] +interface ID3D11InputLayout(ID3D11InputLayoutVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} +ENUM!{enum D3D11_FILTER { + D3D11_FILTER_MIN_MAG_MIP_POINT = 0, + D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D11_FILTER_ANISOTROPIC = 0x55, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D11_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100, + D3D11_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101, + D3D11_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104, + D3D11_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105, + D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110, + D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111, + D3D11_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114, + D3D11_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115, + D3D11_FILTER_MINIMUM_ANISOTROPIC = 0x155, + D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180, + D3D11_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181, + D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184, + D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185, + D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190, + D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191, + D3D11_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194, + D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, + D3D11_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5, +}} +ENUM!{enum D3D11_FILTER_TYPE { + D3D11_FILTER_TYPE_POINT = 0, + D3D11_FILTER_TYPE_LINEAR = 1, +}} +ENUM!{enum D3D11_FILTER_REDUCTION_TYPE { + D3D11_FILTER_REDUCTION_TYPE_STANDARD = 0, + D3D11_FILTER_REDUCTION_TYPE_COMPARISON = 1, + D3D11_FILTER_REDUCTION_TYPE_MINIMUM = 2, + D3D11_FILTER_REDUCTION_TYPE_MAXIMUM = 3, +}} +pub const D3D11_FILTER_REDUCTION_TYPE_MASK: DWORD = 0x3; +pub const D3D11_FILTER_REDUCTION_TYPE_SHIFT: DWORD = 7; +pub const D3D11_FILTER_TYPE_MASK: DWORD = 0x3; +pub const D3D11_MIN_FILTER_SHIFT: DWORD = 4; +pub const D3D11_MAG_FILTER_SHIFT: DWORD = 2; +pub const D3D11_MIP_FILTER_SHIFT: DWORD = 0; +pub const D3D11_COMPARISON_FILTERING_BIT: DWORD = 0x80; +pub const D3D11_ANISOTROPIC_FILTERING_BIT: DWORD = 0x40; +ENUM!{enum D3D11_TEXTURE_ADDRESS_MODE { + D3D11_TEXTURE_ADDRESS_WRAP = 1, + D3D11_TEXTURE_ADDRESS_MIRROR = 2, + D3D11_TEXTURE_ADDRESS_CLAMP = 3, + D3D11_TEXTURE_ADDRESS_BORDER = 4, + D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5, +}} +STRUCT!{struct D3D11_SAMPLER_DESC { + Filter: D3D11_FILTER, + AddressU: D3D11_TEXTURE_ADDRESS_MODE, + AddressV: D3D11_TEXTURE_ADDRESS_MODE, + AddressW: D3D11_TEXTURE_ADDRESS_MODE, + MipLODBias: FLOAT, + MaxAnisotropy: UINT, + ComparisonFunc: D3D11_COMPARISON_FUNC, + BorderColor: [FLOAT; 4], + MinLOD: FLOAT, + MaxLOD: FLOAT, +}} +RIDL!{#[uuid(0xda6fea51, 0x564c, 0x4487, 0x98, 0x10, 0xf0, 0xd0, 0xf9, 0xb4, 0xe3, 0xa5)] +interface ID3D11SamplerState(ID3D11SamplerStateVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDesc( + pDesc: *mut D3D11_SAMPLER_DESC, + ) -> (), +}} +ENUM!{enum D3D11_FORMAT_SUPPORT { + D3D11_FORMAT_SUPPORT_BUFFER = 0x1, + D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, + D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, + D3D11_FORMAT_SUPPORT_SO_BUFFER = 0x8, + D3D11_FORMAT_SUPPORT_TEXTURE1D = 0x10, + D3D11_FORMAT_SUPPORT_TEXTURE2D = 0x20, + D3D11_FORMAT_SUPPORT_TEXTURE3D = 0x40, + D3D11_FORMAT_SUPPORT_TEXTURECUBE = 0x80, + D3D11_FORMAT_SUPPORT_SHADER_LOAD = 0x100, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D11_FORMAT_SUPPORT_MIP = 0x1000, + D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, + D3D11_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, + D3D11_FORMAT_SUPPORT_BLENDABLE = 0x8000, + D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, + D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, + D3D11_FORMAT_SUPPORT_DISPLAY = 0x80000, + D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, + D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000, + D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000, + D3D11_FORMAT_SUPPORT_DECODER_OUTPUT = 0x8000000, + D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT = 0x10000000, + D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT = 0x20000000, + D3D11_FORMAT_SUPPORT_VIDEO_ENCODER = 0x40000000, +}} +ENUM!{enum D3D11_FORMAT_SUPPORT2 { + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, + D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, + D3D11_FORMAT_SUPPORT2_TILED = 0x200, + D3D11_FORMAT_SUPPORT2_SHAREABLE = 0x400, + D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, +}} +RIDL!{#[uuid(0x4b35d0cd, 0x1e15, 0x4258, 0x9c, 0x98, 0x1b, 0x13, 0x33, 0xf6, 0xdd, 0x3b)] +interface ID3D11Asynchronous(ID3D11AsynchronousVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDataSize() -> UINT, +}} +ENUM!{enum D3D11_ASYNC_GETDATA_FLAG { + D3D11_ASYNC_GETDATA_DONOTFLUSH = 0x1, +}} +ENUM!{enum D3D11_QUERY { + D3D11_QUERY_EVENT = 0, + D3D11_QUERY_OCCLUSION = D3D11_QUERY_EVENT + 1u32, + D3D11_QUERY_TIMESTAMP = D3D11_QUERY_OCCLUSION + 1u32, + D3D11_QUERY_TIMESTAMP_DISJOINT = D3D11_QUERY_TIMESTAMP + 1u32, + D3D11_QUERY_PIPELINE_STATISTICS = D3D11_QUERY_TIMESTAMP_DISJOINT + 1u32, + D3D11_QUERY_OCCLUSION_PREDICATE = D3D11_QUERY_PIPELINE_STATISTICS + 1u32, + D3D11_QUERY_SO_STATISTICS = D3D11_QUERY_OCCLUSION_PREDICATE + 1u32, + D3D11_QUERY_SO_OVERFLOW_PREDICATE = D3D11_QUERY_SO_STATISTICS + 1u32, + D3D11_QUERY_SO_STATISTICS_STREAM0 = D3D11_QUERY_SO_OVERFLOW_PREDICATE + 1u32, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = D3D11_QUERY_SO_STATISTICS_STREAM0 + 1u32, + D3D11_QUERY_SO_STATISTICS_STREAM1 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 + 1u32, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = D3D11_QUERY_SO_STATISTICS_STREAM1 + 1u32, + D3D11_QUERY_SO_STATISTICS_STREAM2 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 + 1u32, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = D3D11_QUERY_SO_STATISTICS_STREAM2 + 1u32, + D3D11_QUERY_SO_STATISTICS_STREAM3 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 + 1u32, + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = D3D11_QUERY_SO_STATISTICS_STREAM3 + 1u32, +}} +ENUM!{enum D3D11_QUERY_MISC_FLAG { + D3D11_QUERY_MISC_PREDICATEHINT = 0x1, +}} +STRUCT!{struct D3D11_QUERY_DESC { + Query: D3D11_QUERY, + MiscFlags: UINT, +}} +RIDL!{#[uuid(0xd6c00747, 0x87b7, 0x425e, 0xb8, 0x4d, 0x44, 0xd1, 0x08, 0x56, 0x0a, 0xfd)] +interface ID3D11Query(ID3D11QueryVtbl): ID3D11Asynchronous(ID3D11AsynchronousVtbl) { + fn GetDesc( + pDesc: *mut D3D11_QUERY_DESC, + ) -> (), +}} +RIDL!{#[uuid(0x9eb576dd, 0x9f77, 0x4d86, 0x81, 0xaa, 0x8b, 0xab, 0x5f, 0xe4, 0x90, 0xe2)] +interface ID3D11Predicate(ID3D11PredicateVtbl): ID3D11Query(ID3D11QueryVtbl) {}} +STRUCT!{struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT { + Frequency: UINT64, + Disjoint: BOOL, +}} +STRUCT!{struct D3D11_QUERY_DATA_PIPELINE_STATISTICS { + IAVertices: UINT64, + IAPrimitives: UINT64, + VSInvocations: UINT64, + GSInvocations: UINT64, + GSPrimitives: UINT64, + CInvocations: UINT64, + CPrimitives: UINT64, + PSInvocations: UINT64, + HSInvocations: UINT64, + DSInvocations: UINT64, + CSInvocations: UINT64, +}} +STRUCT!{struct D3D11_QUERY_DATA_SO_STATISTICS { + NumPrimitivesWritten: UINT64, + PrimitivesStorageNeeded: UINT64, +}} +ENUM!{enum D3D11_COUNTER { + D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000, +}} +ENUM!{enum D3D11_COUNTER_TYPE { + D3D11_COUNTER_TYPE_FLOAT32 = 0, + D3D11_COUNTER_TYPE_UINT16 = D3D11_COUNTER_TYPE_FLOAT32 + 1u32, + D3D11_COUNTER_TYPE_UINT32 = D3D11_COUNTER_TYPE_UINT16 + 1u32, + D3D11_COUNTER_TYPE_UINT64 = D3D11_COUNTER_TYPE_UINT32 + 1u32, +}} +STRUCT!{struct D3D11_COUNTER_DESC { + Counter: D3D11_COUNTER, + MiscFlags: UINT, +}} +STRUCT!{struct D3D11_COUNTER_INFO { + LastDeviceDependentCounter: D3D11_COUNTER, + NumSimultaneousCounters: UINT, + NumDetectableParallelUnits: UINT8, +}} +RIDL!{#[uuid(0x6e8c49fb, 0xa371, 0x4770, 0xb4, 0x40, 0x29, 0x08, 0x60, 0x22, 0xb7, 0x41)] +interface ID3D11Counter(ID3D11CounterVtbl): ID3D11Asynchronous(ID3D11AsynchronousVtbl) { + fn GetDesc( + pDesc: *mut D3D11_COUNTER_DESC, + ) -> (), +}} +ENUM!{enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS { + D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D11_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe, +}} +ENUM!{enum D3D11_DEVICE_CONTEXT_TYPE { + D3D11_DEVICE_CONTEXT_IMMEDIATE = 0, + D3D11_DEVICE_CONTEXT_DEFERRED = D3D11_DEVICE_CONTEXT_IMMEDIATE + 1u32, +}} +STRUCT!{struct D3D11_CLASS_INSTANCE_DESC { + InstanceId: UINT, + InstanceIndex: UINT, + TypeId: UINT, + ConstantBuffer: UINT, + BaseConstantBufferOffset: UINT, + BaseTexture: UINT, + BaseSampler: UINT, + Created: BOOL, +}} +RIDL!{#[uuid(0xa6cd7faa, 0xb0b7, 0x4a2f, 0x94, 0x36, 0x86, 0x62, 0xa6, 0x57, 0x97, 0xcb)] +interface ID3D11ClassInstance(ID3D11ClassInstanceVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetClassLinkage( + ppLinkage: *mut *mut ID3D11ClassLinkage, + ) -> (), + fn GetDesc( + pDesc: *mut D3D11_CLASS_INSTANCE_DESC, + ) -> (), + fn GetInstanceName( + pInstanceName: LPSTR, + pBufferLength: *mut SIZE_T, + ) -> (), + fn GetTypeName( + pTypeName: LPSTR, + pBufferLength: *mut SIZE_T, + ) -> (), +}} +RIDL!{#[uuid(0xddf57cba, 0x9543, 0x46e4, 0xa1, 0x2b, 0xf2, 0x07, 0xa0, 0xfe, 0x7f, 0xed)] +interface ID3D11ClassLinkage(ID3D11ClassLinkageVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetClassInstance( + GetClassInstance: LPCSTR, + InstanceIndex: UINT, + ppInstance: *mut *mut ID3D11ClassInstance, + ) -> HRESULT, + fn CreateClassInstance( + pClassTypeName: LPCSTR, + ConstantBufferOffset: UINT, + ConstantVectorOffset: UINT, + TextureOffset: UINT, + SamplerOffset: UINT, + ppInstance: *mut *mut ID3D11ClassInstance, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xa24bc4d1, 0x769e, 0x43f7, 0x80, 0x13, 0x98, 0xff, 0x56, 0x6c, 0x18, 0xe2)] +interface ID3D11CommandList(ID3D11CommandListVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetContextFlags() -> UINT, +}} +ENUM!{enum D3D11_FEATURE { + D3D11_FEATURE_THREADING = 0, + D3D11_FEATURE_DOUBLES = D3D11_FEATURE_THREADING + 1u32, + D3D11_FEATURE_FORMAT_SUPPORT = D3D11_FEATURE_DOUBLES + 1u32, + D3D11_FEATURE_FORMAT_SUPPORT2 = D3D11_FEATURE_FORMAT_SUPPORT + 1u32, + D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = D3D11_FEATURE_FORMAT_SUPPORT2 + 1u32, + D3D11_FEATURE_D3D11_OPTIONS = D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS + 1u32, + D3D11_FEATURE_ARCHITECTURE_INFO = D3D11_FEATURE_D3D11_OPTIONS + 1u32, + D3D11_FEATURE_D3D9_OPTIONS = D3D11_FEATURE_ARCHITECTURE_INFO + 1u32, + D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT = D3D11_FEATURE_D3D9_OPTIONS + 1u32, + D3D11_FEATURE_D3D9_SHADOW_SUPPORT = D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT + 1u32, + D3D11_FEATURE_D3D11_OPTIONS1 = D3D11_FEATURE_D3D9_SHADOW_SUPPORT + 1u32, + D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT = D3D11_FEATURE_D3D11_OPTIONS1 + 1u32, + D3D11_FEATURE_MARKER_SUPPORT = D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT + 1u32, + D3D11_FEATURE_D3D9_OPTIONS1 = D3D11_FEATURE_MARKER_SUPPORT + 1u32, + D3D11_FEATURE_D3D11_OPTIONS2 = D3D11_FEATURE_D3D9_OPTIONS1 + 1u32, + D3D11_FEATURE_D3D11_OPTIONS3 = D3D11_FEATURE_D3D11_OPTIONS2 + 1u32, + D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = D3D11_FEATURE_D3D11_OPTIONS3 + 1u32, +}} +STRUCT!{struct D3D11_FEATURE_DATA_THREADING { + DriverConcurrentCreates: BOOL, + DriverCommandLists: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_DOUBLES { + DoublePrecisionFloatShaderOps: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_FORMAT_SUPPORT { + InFormat: DXGI_FORMAT, + OutFormatSupport: UINT, +}} +STRUCT!{struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 { + InFormat: DXGI_FORMAT, + OutFormatSupport2: UINT, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS { + ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS { + OutputMergerLogicOp: BOOL, + UAVOnlyRenderingForcedSampleCount: BOOL, + DiscardAPIsSeenByDriver: BOOL, + FlagsForUpdateAndCopySeenByDriver: BOOL, + ClearView: BOOL, + CopyWithOverlap: BOOL, + ConstantBufferPartialUpdate: BOOL, + ConstantBufferOffsetting: BOOL, + MapNoOverwriteOnDynamicConstantBuffer: BOOL, + MapNoOverwriteOnDynamicBufferSRV: BOOL, + MultisampleRTVWithForcedSampleCountOne: BOOL, + SAD4ShaderInstructions: BOOL, + ExtendedDoublesShaderInstructions: BOOL, + ExtendedResourceSharing: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_ARCHITECTURE_INFO { + TileBasedDeferredRenderer: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_OPTIONS { + FullNonPow2TextureSupport: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT { + SupportsDepthAsTextureWithLessEqualComparisonFilter: BOOL, +}} +ENUM!{enum D3D11_SHADER_MIN_PRECISION_SUPPORT { + D3D11_SHADER_MIN_PRECISION_10_BIT = 0x1, + D3D11_SHADER_MIN_PRECISION_16_BIT = 0x2, +}} +STRUCT!{struct D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT { + PixelShaderMinPrecision: UINT, + AllOtherShaderStagesMinPrecision: UINT, +}} +ENUM!{enum D3D11_TILED_RESOURCES_TIER { + D3D11_TILED_RESOURCES_NOT_SUPPORTED = 0, + D3D11_TILED_RESOURCES_TIER_1 = 1, + D3D11_TILED_RESOURCES_TIER_2 = 2, + D3D11_TILED_RESOURCES_TIER_3 = 3, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS1 { + TiledResourcesTier: D3D11_TILED_RESOURCES_TIER, + MinMaxFiltering: BOOL, + ClearViewAlsoSupportsDepthOnlyFormats: BOOL, + MapOnDefaultBuffers: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT { + SimpleInstancingSupported: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_MARKER_SUPPORT { + Profile: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D9_OPTIONS1 { + FullNonPow2TextureSupported: BOOL, + DepthAsTextureWithLessEqualComparisonFilterSupported: BOOL, + SimpleInstancingSupported: BOOL, + TextureCubeFaceRenderTargetWithNonCubeDepthStencilSupported: BOOL, +}} +ENUM!{enum D3D11_CONSERVATIVE_RASTERIZATION_TIER { + D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED = 0, + D3D11_CONSERVATIVE_RASTERIZATION_TIER_1 = 1, + D3D11_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, + D3D11_CONSERVATIVE_RASTERIZATION_TIER_3 = 3, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS2 { + PSSpecifiedStencilRefSupported: BOOL, + TypedUAVLoadAdditionalFormats: BOOL, + ROVsSupported: BOOL, + ConservativeRasterizationTier: D3D11_CONSERVATIVE_RASTERIZATION_TIER, + TiledResourcesTier: D3D11_TILED_RESOURCES_TIER, + MapOnDefaultTextures: BOOL, + StandardSwizzle: BOOL, + UnifiedMemoryArchitecture: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS3 { + VPAndRTArrayIndexFromAnyShaderFeedingRasterizer: BOOL, +}} +STRUCT!{struct D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT { + MaxGPUVirtualAddressBitsPerResource: UINT, + MaxGPUVirtualAddressBitsPerProcess: UINT, +}} +RIDL!{#[uuid(0xc0bfa96c, 0xe089, 0x44fb, 0x8e, 0xaf, 0x26, 0xf8, 0x79, 0x61, 0x90, 0xda)] +interface ID3D11DeviceContext(ID3D11DeviceContextVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn VSSetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *const *mut ID3D11Buffer, + ) -> (), + fn PSSetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView, + ) -> (), + fn PSSetShader( + pPixelShader: *mut ID3D11PixelShader, + ppClassInstances: *const *mut ID3D11ClassInstance, + NumClassInstances: UINT, + ) -> (), + fn PSSetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *const *mut ID3D11SamplerState, + ) -> (), + fn VSSetShader( + pVertexShader: *mut ID3D11VertexShader, + ppClassInstances: *const *mut ID3D11ClassInstance, + NumClassInstances: UINT, + ) -> (), + fn DrawIndexed( + IndexCount: UINT, + StartIndexLocation: UINT, + BaseVertexLocation: INT, + ) -> (), + fn Draw( + VertexCount: UINT, + StartVertexLocation: UINT, + ) -> (), + fn Map( + pResource: *mut ID3D11Resource, + Subresource: UINT, + MapType: D3D11_MAP, + MapFlags: UINT, + pMappedResource: *mut D3D11_MAPPED_SUBRESOURCE, + ) -> HRESULT, + fn Unmap( + pResource: *mut ID3D11Resource, + Subresource: UINT, + ) -> (), + fn PSSetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *const *mut ID3D11Buffer, + ) -> (), + fn IASetInputLayout( + pInputLayout: *mut ID3D11InputLayout, + ) -> (), + fn IASetVertexBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppVertexBuffers: *const *mut ID3D11Buffer, + pStrides: *const UINT, + pOffsets: *const UINT, + ) -> (), + fn IASetIndexBuffer( + pIndexBuffer: *mut ID3D11Buffer, + Format: DXGI_FORMAT, + Offset: UINT, + ) -> (), + fn DrawIndexedInstanced( + IndexCountPerInstance: UINT, + InstanceCount: UINT, + StartIndexLocation: UINT, + BaseVertexLocation: INT, + StartInstanceLocation: UINT, + ) -> (), + fn DrawInstanced( + VertexCountPerInstance: UINT, + InstanceCount: UINT, + StartVertexLocation: UINT, + StartInstanceLocation: UINT, + ) -> (), + fn GSSetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *const *mut ID3D11Buffer, + ) -> (), + fn GSSetShader( + pShader: *mut ID3D11GeometryShader, + ppClassInstances: *const *mut ID3D11ClassInstance, + NumClassInstances: UINT, + ) -> (), + fn IASetPrimitiveTopology( + Topology: D3D11_PRIMITIVE_TOPOLOGY, + ) -> (), + fn VSSetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView, + ) -> (), + fn VSSetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *const *mut ID3D11SamplerState, + ) -> (), + fn Begin( + pAsync: *mut ID3D11Asynchronous, + ) -> (), + fn End( + pAsync: *mut ID3D11Asynchronous, + ) -> (), + fn GetData( + pAsync: *mut ID3D11Asynchronous, + pData: *mut c_void, + DataSize: UINT, + GetDataFlags: UINT, + ) -> HRESULT, + fn SetPredication( + pPredicate: *mut ID3D11Predicate, + PredicateValue: BOOL, + ) -> (), + fn GSSetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView, + ) -> (), + fn GSSetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *const *mut ID3D11SamplerState, + ) -> (), + fn OMSetRenderTargets( + NumViews: UINT, + ppRenderTargetViews: *const *mut ID3D11RenderTargetView, + pDepthStencilView: *mut ID3D11DepthStencilView, + ) -> (), + fn OMSetRenderTargetsAndUnorderedAccessViews( + NumRTVs: UINT, + ppRenderTargetViews: *const *mut ID3D11RenderTargetView, + pDepthStencilView: *mut ID3D11DepthStencilView, + UAVStartSlot: UINT, + NumUAVs: UINT, + ppUnorderedAccessViews: *const *mut ID3D11UnorderedAccessView, + pUAVInitialCounts: *const UINT, + ) -> (), + fn OMSetBlendState( + pBlendState: *mut ID3D11BlendState, + BlendFactor: &[FLOAT; 4], + SampleMask: UINT, + ) -> (), + fn OMSetDepthStencilState( + pDepthStencilState: *mut ID3D11DepthStencilState, + StencilRef: UINT, + ) -> (), + fn SOSetTargets( + NumBuffers: UINT, + ppSOTargets: *const *mut ID3D11Buffer, + pOffsets: *const UINT, + ) -> (), + fn DrawAuto() -> (), + fn DrawIndexedInstancedIndirect( + pBufferForArgs: *mut ID3D11Buffer, + AlignedByteOffsetForArgs: UINT, + ) -> (), + fn DrawInstancedIndirect( + pBufferForArgs: *mut ID3D11Buffer, + AlignedByteOffsetForArgs: UINT, + ) -> (), + fn Dispatch( + ThreadGroupCountX: UINT, + ThreadGroupCountY: UINT, + ThreadGroupCountZ: UINT, + ) -> (), + fn DispatchIndirect( + pBufferForArgs: *mut ID3D11Buffer, + AlignedByteOffsetForArgs: UINT, + ) -> (), + fn RSSetState( + pRasterizerState: *mut ID3D11RasterizerState, + ) -> (), + fn RSSetViewports( + NumViewports: UINT, + pViewports: *const D3D11_VIEWPORT, + ) -> (), + fn RSSetScissorRects( + NumRects: UINT, + pRects: *const D3D11_RECT, + ) -> (), + fn CopySubresourceRegion( + pDstResource: *mut ID3D11Resource, + DstSubresource: UINT, + DstX: UINT, + DstY: UINT, + DstZ: UINT, + pSrcResource: *mut ID3D11Resource, + SrcSubresource: UINT, + pSrcBox: *const D3D11_BOX, + ) -> (), + fn CopyResource( + pDstResource: *mut ID3D11Resource, + pSrcResource: *mut ID3D11Resource, + ) -> (), + fn UpdateSubresource( + pDstResource: *mut ID3D11Resource, + DstSubresource: UINT, + pDstBox: *const D3D11_BOX, + pSrcData: *const c_void, + SrcRowPitch: UINT, + SrcDepthPitch: UINT, + ) -> (), + fn CopyStructureCount( + pDstBuffer: *mut ID3D11Buffer, + DstAlignedByteOffset: UINT, + pSrcView: *mut ID3D11UnorderedAccessView, + ) -> (), + fn ClearRenderTargetView( + pRenderTargetView: *mut ID3D11RenderTargetView, + ColorRGBA: &[FLOAT; 4], + ) -> (), + fn ClearUnorderedAccessViewUint( + pUnorderedAccessView: *mut ID3D11UnorderedAccessView, + Values: &[UINT; 4], + ) -> (), + fn ClearUnorderedAccessViewFloat( + pUnorderedAccessView: *mut ID3D11UnorderedAccessView, + Values: &[FLOAT; 4], + ) -> (), + fn ClearDepthStencilView( + pDepthStencilView: *mut ID3D11DepthStencilView, + ClearFlags: UINT, + Depth: FLOAT, + Stencil: UINT8, + ) -> (), + fn GenerateMips( + pShaderResourceView: *mut ID3D11ShaderResourceView, + ) -> (), + fn SetResourceMinLOD( + pResource: *mut ID3D11Resource, + MinLOD: FLOAT, + ) -> (), + fn GetResourceMinLOD( + pResource: *mut ID3D11Resource, + ) -> FLOAT, + fn ResolveSubresource( + pDstResource: *mut ID3D11Resource, + DstSubresource: UINT, + pSrcResource: *mut ID3D11Resource, + SrcSubresource: UINT, + Format: DXGI_FORMAT, + ) -> (), + fn ExecuteCommandList( + pCommandList: *mut ID3D11CommandList, + RestoreContextState: BOOL, + ) -> (), + fn HSSetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView, + ) -> (), + fn HSSetShader( + pHullShader: *mut ID3D11HullShader, + ppClassInstances: *const *mut ID3D11ClassInstance, + NumClassInstances: UINT, + ) -> (), + fn HSSetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *const *mut ID3D11SamplerState, + ) -> (), + fn HSSetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *const *mut ID3D11Buffer, + ) -> (), + fn DSSetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView, + ) -> (), + fn DSSetShader( + pDomainShader: *mut ID3D11DomainShader, + ppClassInstances: *const *mut ID3D11ClassInstance, + NumClassInstances: UINT, + ) -> (), + fn DSSetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *const *mut ID3D11SamplerState, + ) -> (), + fn DSSetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *const *mut ID3D11Buffer, + ) -> (), + fn CSSetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *const *mut ID3D11ShaderResourceView, + ) -> (), + fn CSSetUnorderedAccessViews( + StartSlot: UINT, + NumUAVs: UINT, + ppUnorderedAccessViews: *const *mut ID3D11UnorderedAccessView, + ) -> (), + fn CSSetShader( + pComputeShader: *mut ID3D11ComputeShader, + ppClassInstances: *const *mut ID3D11ClassInstance, + NumClassInstances: UINT, + ) -> (), + fn CSSetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *const *mut ID3D11SamplerState, + ) -> (), + fn CSSetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *const *mut ID3D11Buffer, + ) -> (), + fn VSGetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *mut *mut ID3D11Buffer, + ) -> (), + fn PSGetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView, + ) -> (), + fn PSGetShader( + ppPixelShader: *mut *mut ID3D11PixelShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, + pNumClassInstances: *mut UINT, + ) -> (), + fn PSGetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *mut *mut ID3D11SamplerState, + ) -> (), + fn VSGetShader( + ppVertexShader: *mut *mut ID3D11VertexShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, + pNumClassInstances: *mut UINT, + ) -> (), + fn PSGetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *mut *mut ID3D11Buffer, + ) -> (), + fn IAGetInputLayout( + ppInputLayout: *mut *mut ID3D11InputLayout, + ) -> (), + fn IAGetVertexBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppVertexBuffers: *mut *mut ID3D11Buffer, + pStrides: *mut UINT, + pOffsets: *mut UINT, + ) -> (), + fn IAGetIndexBuffer( + pIndexBuffer: *mut *mut ID3D11Buffer, + Format: *mut DXGI_FORMAT, + Offset: *mut UINT, + ) -> (), + fn GSGetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *mut *mut ID3D11Buffer, + ) -> (), + fn GSGetShader( + ppGeometryShader: *mut *mut ID3D11GeometryShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, + pNumClassInstances: *mut UINT, + ) -> (), + fn IAGetPrimitiveTopology( + pTopology: *mut D3D11_PRIMITIVE_TOPOLOGY, + ) -> (), + fn VSGetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView, + ) -> (), + fn VSGetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *mut *mut ID3D11SamplerState, + ) -> (), + fn GetPredication( + ppPredicate: *mut *mut ID3D11Predicate, + pPredicateValue: *mut BOOL, + ) -> (), + fn GSGetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView, + ) -> (), + fn GSGetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *mut *mut ID3D11SamplerState, + ) -> (), + fn OMGetRenderTargets( + NumViews: UINT, + ppRenderTargetViews: *mut *mut ID3D11RenderTargetView, + ppDepthStencilView: *mut *mut ID3D11DepthStencilView, + ) -> (), + fn OMGetRenderTargetsAndUnorderedAccessViews( + NumRTVs: UINT, + ppRenderTargetViews: *mut *mut ID3D11RenderTargetView, + ppDepthStencilView: *mut *mut ID3D11DepthStencilView, + UAVStartSlot: UINT, + ppUnorderedAccessViews: *mut *mut ID3D11UnorderedAccessView, + ) -> (), + fn OMGetBlendState( + ppBlendState: *mut *mut ID3D11BlendState, + BlendFactor: &mut [FLOAT; 4], + pSampleMask: *mut UINT, + ) -> (), + fn OMGetDepthStencilState( + ppDepthStencilState: *mut *mut ID3D11DepthStencilState, + pStencilRef: *mut UINT, + ) -> (), + fn SOGetTargets( + NumBuffers: UINT, + ppSOTargets: *mut *mut ID3D11Buffer, + ) -> (), + fn RSGetState( + ppRasterizerState: *mut *mut ID3D11RasterizerState, + ) -> (), + fn RSGetViewports( + pNumViewports: *mut UINT, + pViewports: *mut D3D11_VIEWPORT, + ) -> (), + fn RSGetScissorRects( + pNumRects: *mut UINT, + pRects: *mut D3D11_RECT, + ) -> (), + fn HSGetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView, + ) -> (), + fn HSGetShader( + ppHullShader: *mut *mut ID3D11HullShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, + pNumClassInstances: *mut UINT, + ) -> (), + fn HSGetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *mut *mut ID3D11SamplerState, + ) -> (), + fn HSGetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *mut *mut ID3D11Buffer, + ) -> (), + fn DSGetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView, + ) -> (), + fn DSGetShader( + ppDomainShader: *mut *mut ID3D11DomainShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, + pNumClassInstances: *mut UINT, + ) -> (), + fn DSGetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *mut *mut ID3D11SamplerState, + ) -> (), + fn DSGetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *mut *mut ID3D11Buffer, + ) -> (), + fn CSGetShaderResources( + StartSlot: UINT, + NumViews: UINT, + ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView, + ) -> (), + fn CSGetUnorderedAccessViews( + StartSlot: UINT, + NumUAVs: UINT, + ppUnorderedAccessViews: *mut *mut ID3D11UnorderedAccessView, + ) -> (), + fn CSGetShader( + ppComputeShader: *mut *mut ID3D11ComputeShader, + ppClassInstances: *mut *mut ID3D11ClassInstance, + pNumClassInstances: *mut UINT, + ) -> (), + fn CSGetSamplers( + StartSlot: UINT, + NumSamplers: UINT, + ppSamplers: *mut *mut ID3D11SamplerState, + ) -> (), + fn CSGetConstantBuffers( + StartSlot: UINT, + NumBuffers: UINT, + ppConstantBuffers: *mut *mut ID3D11Buffer, + ) -> (), + fn ClearState() -> (), + fn Flush() -> (), + fn GetType() -> D3D11_DEVICE_CONTEXT_TYPE, + fn GetContextFlags() -> UINT, + fn FinishCommandList( + RestoreDeferredContextState: BOOL, + ppCommandList: *mut *mut ID3D11CommandList, + ) -> HRESULT, +}} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG2_MOCOMP, + 0xe6a9f44b, 0x61b0, 0x4563, 0x9e, 0xa4, 0x63, 0xd2, 0xa3, 0xc6, 0xfe, 0x66} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG2_IDCT, + 0xbf22ad00, 0x03ea, 0x4690, 0x80, 0x77, 0x47, 0x33, 0x46, 0x20, 0x9b, 0x7e} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG2_VLD, + 0xee27417f, 0x5e28, 0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG1_VLD, + 0x6f3ec719, 0x3735, 0x42cc, 0x80, 0x63, 0x65, 0xcc, 0x3c, 0xb3, 0x66, 0x16} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG2and1_VLD, + 0x86695f12, 0x340e, 0x4f04, 0x9f, 0xd3, 0x92, 0x53, 0xdd, 0x32, 0x74, 0x60} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_MOCOMP_NOFGT, + 0x1b81be64, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_MOCOMP_FGT, + 0x1b81be65, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_IDCT_NOFGT, + 0x1b81be66, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_IDCT_FGT, + 0x1b81be67, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_VLD_NOFGT, + 0x1b81be68, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_VLD_FGT, + 0x1b81be69, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_VLD_WITHFMOASO_NOFGT, + 0xd5f04ff9, 0x3418, 0x45d8, 0x95, 0x61, 0x32, 0xa7, 0x6a, 0xae, 0x2d, 0xdd} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_VLD_STEREO_PROGRESSIVE_NOFGT, + 0xd79be8da, 0x0cf1, 0x4c81, 0xb8, 0x2a, 0x69, 0xa4, 0xe2, 0x36, 0xf4, 0x3d} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_VLD_STEREO_NOFGT, + 0xf9aaccbb, 0xc2b6, 0x4cfc, 0x87, 0x79, 0x57, 0x07, 0xb1, 0x76, 0x05, 0x52} +DEFINE_GUID!{D3D11_DECODER_PROFILE_H264_VLD_MULTIVIEW_NOFGT, + 0x705b9d82, 0x76cf, 0x49d6, 0xb7, 0xe6, 0xac, 0x88, 0x72, 0xdb, 0x01, 0x3c} +DEFINE_GUID!{D3D11_DECODER_PROFILE_WMV8_POSTPROC, + 0x1b81be80, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_WMV8_MOCOMP, + 0x1b81be81, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_WMV9_POSTPROC, + 0x1b81be90, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_WMV9_MOCOMP, + 0x1b81be91, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_WMV9_IDCT, + 0x1b81be94, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_VC1_POSTPROC, + 0x1b81bea0, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_VC1_MOCOMP, + 0x1b81bea1, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_VC1_IDCT, + 0x1b81bea2, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_VC1_VLD, + 0x1b81bea3, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_VC1_D2010, + 0x1b81bea4, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG4PT2_VLD_SIMPLE, + 0xefd64d74, 0xc9e8, 0x41d7, 0xa5, 0xe9, 0xe9, 0xb0, 0xe3, 0x9f, 0xa3, 0x19} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_NOGMC, + 0xed418a9f, 0x010d, 0x4eda, 0x9a, 0xe3, 0x9a, 0x65, 0x35, 0x8d, 0x8d, 0x2e} +DEFINE_GUID!{D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_GMC, + 0xab998b5b, 0x4258, 0x44a9, 0x9f, 0xeb, 0x94, 0xe5, 0x97, 0xa6, 0xba, 0xae} +DEFINE_GUID!{D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, + 0x5b11d51b, 0x2f4c, 0x4452, 0xbc, 0xc3, 0x09, 0xf2, 0xa1, 0x16, 0x0c, 0xc0} +DEFINE_GUID!{D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10, + 0x107af0e0, 0xef1a, 0x4d19, 0xab, 0xa8, 0x67, 0xa1, 0x63, 0x07, 0x3d, 0x13} +DEFINE_GUID!{D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0, + 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e} +DEFINE_GUID!{D3D11_DECODER_PROFILE_VP8_VLD, + 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7} +STRUCT!{struct D3D11_VIDEO_DECODER_DESC { + Guid: GUID, + SampleWidth: UINT, + SampleHeight: UINT, + OutputFormat: DXGI_FORMAT, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_CONFIG { + guidConfigBitstreamEncryption: GUID, + guidConfigMBcontrolEncryption: GUID, + guidConfigResidDiffEncryption: GUID, + ConfigBitstreamRaw: UINT, + ConfigMBcontrolRasterOrder: UINT, + ConfigResidDiffHost: UINT, + ConfigSpatialResid8: UINT, + ConfigResid8Subtraction: UINT, + ConfigSpatialHost8or9Clipping: UINT, + ConfigSpatialResidInterleaved: UINT, + ConfigIntraResidUnsigned: UINT, + ConfigResidDiffAccelerator: UINT, + ConfigHostInverseScan: UINT, + ConfigSpecificIDCT: UINT, + Config4GroupedCoefs: UINT, + ConfigMinRenderTargetBuffCount: USHORT, + ConfigDecoderSpecific: USHORT, +}} +ENUM!{enum D3D11_VIDEO_DECODER_BUFFER_TYPE { + D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS = 0, + D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL = 1, + D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE = 2, + D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL = 3, + D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX = 4, + D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL = 5, + D3D11_VIDEO_DECODER_BUFFER_BITSTREAM = 6, + D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR = 7, + D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN = 8, +}} +STRUCT!{struct D3D11_AES_CTR_IV { + IV: UINT64, + Count: UINT64, +}} +STRUCT!{struct D3D11_ENCRYPTED_BLOCK_INFO { + NumEncryptedBytesAtBeginning: UINT, + NumBytesInSkipPattern: UINT, + NumBytesInEncryptPattern: UINT, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_BUFFER_DESC { + BufferType: D3D11_VIDEO_DECODER_BUFFER_TYPE, + BufferIndex: UINT, + DataOffset: UINT, + DataSize: UINT, + FirstMBaddress: UINT, + NumMBsInBuffer: UINT, + Width: UINT, + Height: UINT, + Stride: UINT, + ReservedBits: UINT, + pIV: *mut c_void, + IVSize: UINT, + PartialEncryption: BOOL, + EncryptedBlockInfo: D3D11_ENCRYPTED_BLOCK_INFO, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_EXTENSION { + Function: UINT, + pPrivateInputData: *mut c_void, + PrivateInputDataSize: UINT, + pPrivateOutputData: *mut c_void, + PrivateOutputDataSize: UINT, + ResourceCount: UINT, + ppResourceList: *mut *mut ID3D11Resource, +}} +RIDL!{#[uuid(0x3c9c5b51, 0x995d, 0x48d1, 0x9b, 0x8d, 0xfa, 0x5c, 0xae, 0xde, 0xd6, 0x5c)] +interface ID3D11VideoDecoder(ID3D11VideoDecoderVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetCreationParameters( + pVideoDesc: *mut D3D11_VIDEO_DECODER_DESC, + pConfig: *mut D3D11_VIDEO_DECODER_CONFIG, + ) -> HRESULT, + fn GetDriverHandle( + pDriverHandle: *mut HANDLE, + ) -> HRESULT, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT { + D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT = 0x1, + D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT = 0x2, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_DEVICE_CAPS { + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_LINEAR_SPACE = 0x1, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_xvYCC = 0x2, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x4, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x8, + D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_NOMINAL_RANGE = 0x10, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_FEATURE_CAPS { + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_FILL = 0x1, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_CONSTRICTION = 0x2, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LUMA_KEY = 0x4, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_PALETTE = 0x8, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LEGACY = 0x10, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_STEREO = 0x20, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ROTATION = 0x40, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = 0x80, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = 0x100, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = 0x200, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_FILTER_CAPS { + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_BRIGHTNESS = 0x1, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_CONTRAST = 0x2, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_HUE = 0x4, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_SATURATION = 0x8, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_NOISE_REDUCTION = 0x10, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40, + D3D11_VIDEO_PROCESSOR_FILTER_CAPS_STEREO_ADJUSTMENT = 0x80, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_FORMAT_CAPS { + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_INTERLACED = 0x1, + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_PROCAMP = 0x2, + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_LUMA_KEY = 0x4, + D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_PALETTE_INTERLACED = 0x8, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS { + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DENOISE = 0x1, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DERINGING = 0x2, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_EDGE_ENHANCEMENT = 0x4, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_COLOR_CORRECTION = 0x8, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_FLESH_TONE_MAPPING = 0x10, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_IMAGE_STABILIZATION = 0x20, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_SUPER_RESOLUTION = 0x40, + D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_ANAMORPHIC_SCALING = 0x80, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_STEREO_CAPS { + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_MONO_OFFSET = 0x1, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_ROW_INTERLEAVED = 0x2, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_COLUMN_INTERLEAVED = 0x4, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_CHECKERBOARD = 0x8, + D3D11_VIDEO_PROCESSOR_STEREO_CAPS_FLIP_MODE = 0x10, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_CAPS { + DeviceCaps: UINT, + FeatureCaps: UINT, + FilterCaps: UINT, + InputFormatCaps: UINT, + AutoStreamCaps: UINT, + StereoCaps: UINT, + RateConversionCapsCount: UINT, + MaxInputStreams: UINT, + MaxStreamStates: UINT, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS { + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND = 0x1, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB = 0x2, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = 0x4, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = 0x8, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE = 0x10, + D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = 0x20, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS { + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32 = 0x1, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_22 = 0x2, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2224 = 0x4, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2332 = 0x8, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32322 = 0x10, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_55 = 0x20, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_64 = 0x40, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_87 = 0x80, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_222222222223 = 0x100, + D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_OTHER = 0x80000000, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS { + PastFrames: UINT, + FutureFrames: UINT, + ProcessorCaps: UINT, + ITelecineCaps: UINT, + CustomRateCount: UINT, +}} +ENUM!{enum D3D11_CONTENT_PROTECTION_CAPS { + D3D11_CONTENT_PROTECTION_CAPS_SOFTWARE = 0x1, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE = 0x2, + D3D11_CONTENT_PROTECTION_CAPS_PROTECTION_ALWAYS_ON = 0x4, + D3D11_CONTENT_PROTECTION_CAPS_PARTIAL_DECRYPTION = 0x8, + D3D11_CONTENT_PROTECTION_CAPS_CONTENT_KEY = 0x10, + D3D11_CONTENT_PROTECTION_CAPS_FRESHEN_SESSION_KEY = 0x20, + D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK = 0x40, + D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK_KEY = 0x80, + D3D11_CONTENT_PROTECTION_CAPS_SEQUENTIAL_CTR_IV = 0x100, + D3D11_CONTENT_PROTECTION_CAPS_ENCRYPT_SLICEDATA_ONLY = 0x200, + D3D11_CONTENT_PROTECTION_CAPS_DECRYPTION_BLT = 0x400, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECT_UNCOMPRESSED = 0x800, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECTED_MEMORY_PAGEABLE = 0x1000, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_TEARDOWN = 0x2000, + D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION = 0x4000, +}} +DEFINE_GUID!{D3D11_CRYPTO_TYPE_AES128_CTR, + 0x9b6bd711, 0x4f74, 0x41c9, 0x9e, 0x7b, 0x0b, 0xe2, 0xd7, 0xd9, 0x3b, 0x4f} +DEFINE_GUID!{D3D11_DECODER_ENCRYPTION_HW_CENC, + 0x89d6ac4f, 0x09f2, 0x4229, 0xb2, 0xcd, 0x37, 0x74, 0x0a, 0x6d, 0xfd, 0x81} +DEFINE_GUID!{D3D11_KEY_EXCHANGE_HW_PROTECTION, + 0xb1170d8a, 0x628d, 0x4da3, 0xad, 0x3b, 0x82, 0xdd, 0xb0, 0x8b, 0x49, 0x70} +STRUCT!{struct D3D11_VIDEO_CONTENT_PROTECTION_CAPS { + Caps: UINT, + KeyExchangeTypeCount: UINT, + BlockAlignmentSize: UINT, + ProtectedMemorySize: ULONGLONG, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE { + CustomRate: DXGI_RATIONAL, + OutputFrames: UINT, + InputInterlaced: BOOL, + InputFramesOrFields: UINT, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_FILTER { + D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS = 0, + D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST = 1, + D3D11_VIDEO_PROCESSOR_FILTER_HUE = 2, + D3D11_VIDEO_PROCESSOR_FILTER_SATURATION = 3, + D3D11_VIDEO_PROCESSOR_FILTER_NOISE_REDUCTION = 4, + D3D11_VIDEO_PROCESSOR_FILTER_EDGE_ENHANCEMENT = 5, + D3D11_VIDEO_PROCESSOR_FILTER_ANAMORPHIC_SCALING = 6, + D3D11_VIDEO_PROCESSOR_FILTER_STEREO_ADJUSTMENT = 7, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_FILTER_RANGE { + Minimum: c_int, + Maximum: c_int, + Default: c_int, + Multiplier: c_float, +}} +ENUM!{enum D3D11_VIDEO_FRAME_FORMAT { + D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0, + D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1, + D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2, +}} +ENUM!{enum D3D11_VIDEO_USAGE { + D3D11_VIDEO_USAGE_PLAYBACK_NORMAL = 0, + D3D11_VIDEO_USAGE_OPTIMAL_SPEED = 1, + D3D11_VIDEO_USAGE_OPTIMAL_QUALITY = 2, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_CONTENT_DESC { + InputFrameFormat: D3D11_VIDEO_FRAME_FORMAT, + InputFrameRate: DXGI_RATIONAL, + InputWidth: UINT, + InputHeight: UINT, + OutputFrameRate: DXGI_RATIONAL, + OutputWidth: UINT, + OutputHeight: UINT, + Usage: D3D11_VIDEO_USAGE, +}} +RIDL!{#[uuid(0x31627037, 0x53ab, 0x4200, 0x90, 0x61, 0x05, 0xfa, 0xa9, 0xab, 0x45, 0xf9)] +interface ID3D11VideoProcessorEnumerator(ID3D11VideoProcessorEnumeratorVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetVideoProcessorContentDesc( + pContentDesc: *mut D3D11_VIDEO_PROCESSOR_CONTENT_DESC, + ) -> HRESULT, + fn CheckVideoProcessorFormat( + Format: DXGI_FORMAT, + pFlags: *mut UINT, + ) -> HRESULT, + fn GetVideoProcessorCaps( + pCaps: *mut D3D11_VIDEO_PROCESSOR_CAPS, + ) -> HRESULT, + fn GetVideoProcessorRateConversionCaps( + TypeIndex: UINT, + pCaps: *mut D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS, + ) -> HRESULT, + fn GetVideoProcessorCustomRate( + TypeIndex: UINT, + CustomRateIndex: UINT, + pRate: *mut D3D11_VIDEO_PROCESSOR_CUSTOM_RATE, + ) -> HRESULT, + fn GetVideoProcessorFilterRange( + Filter: D3D11_VIDEO_PROCESSOR_FILTER, + Range: *mut D3D11_VIDEO_PROCESSOR_FILTER_RANGE, + ) -> HRESULT, +}} +STRUCT!{struct D3D11_VIDEO_COLOR_RGBA { + R: c_float, + G: c_float, + B: c_float, + A: c_float, +}} +STRUCT!{struct D3D11_VIDEO_COLOR_YCbCrA { + Y: c_float, + Cb: c_float, + Cr: c_float, + A: c_float, +}} +UNION!{union D3D11_VIDEO_COLOR { + [f32; 4], + YCbCr YCbCr_mut: D3D11_VIDEO_COLOR_YCbCrA, + RGBA RGBA_mut: D3D11_VIDEO_COLOR_RGBA, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE { + D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_UNDEFINED = 0, + D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_16_235 = 1, + D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255 = 2, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_COLOR_SPACE { + bitfield: UINT, +}} +BITFIELD!{D3D11_VIDEO_PROCESSOR_COLOR_SPACE bitfield: UINT [ + Usage set_Usage[0..1], + RGB_Range set_RGB_Range[1..2], + YCbCr_Matrix set_YCbCr_Matrix[2..3], + YCbCr_xvYCC set_YCbCr_xvYCC[3..4], + Nominal_Range set_Nominal_Range[4..6], +]} +ENUM!{enum D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE { + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_OPAQUE = 0, + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_BACKGROUND = 1, + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_DESTINATION = 2, + D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_SOURCE_STREAM = 3, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_OUTPUT_RATE { + D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_NORMAL = 0, + D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_HALF = 1, + D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_CUSTOM = 2, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_STEREO_FORMAT { + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO = 0, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_HORIZONTAL = 1, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_VERTICAL = 2, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_SEPARATE = 3, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO_OFFSET = 4, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_ROW_INTERLEAVED = 5, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_COLUMN_INTERLEAVED = 6, + D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_CHECKERBOARD = 7, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE { + D3D11_VIDEO_PROCESSOR_STEREO_FLIP_NONE = 0, + D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME0 = 1, + D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME1 = 2, +}} +ENUM!{enum D3D11_VIDEO_PROCESSOR_ROTATION { + D3D11_VIDEO_PROCESSOR_ROTATION_IDENTITY = 0, + D3D11_VIDEO_PROCESSOR_ROTATION_90 = 1, + D3D11_VIDEO_PROCESSOR_ROTATION_180 = 2, + D3D11_VIDEO_PROCESSOR_ROTATION_270 = 3, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_STREAM { + Enable: BOOL, + OutputIndex: UINT, + InputFrameOrField: UINT, + PastFrames: UINT, + FutureFrames: UINT, + ppPastSurfaces: *mut *mut ID3D11VideoProcessorInputView, + pInputSurface: *mut ID3D11VideoProcessorInputView, + ppFutureSurfaces: *mut *mut ID3D11VideoProcessorInputView, + ppPastSurfacesRight: *mut *mut ID3D11VideoProcessorInputView, + pInputSurfaceRight: *mut ID3D11VideoProcessorInputView, + ppFutureSurfacesRight: *mut *mut ID3D11VideoProcessorInputView, +}} +RIDL!{#[uuid(0x1d7b0652, 0x185f, 0x41c6, 0x85, 0xce, 0x0c, 0x5b, 0xe3, 0xd4, 0xae, 0x6c)] +interface ID3D11VideoProcessor(ID3D11VideoProcessorVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetContentDesc( + pDesc: *mut D3D11_VIDEO_PROCESSOR_CONTENT_DESC, + ) -> (), + fn GetRateConversionCaps( + pCaps: *mut D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS, + ) -> (), +}} +STRUCT!{struct D3D11_OMAC { + Omac: [BYTE; 16], +}} +ENUM!{enum D3D11_AUTHENTICATED_CHANNEL_TYPE { + D3D11_AUTHENTICATED_CHANNEL_D3D11 = 1, + D3D11_AUTHENTICATED_CHANNEL_DRIVER_SOFTWARE = 2, + D3D11_AUTHENTICATED_CHANNEL_DRIVER_HARDWARE = 3, +}} +RIDL!{#[uuid(0x3015a308, 0xdcbd, 0x47aa, 0xa7, 0x47, 0x19, 0x24, 0x86, 0xd1, 0x4d, 0x4a)] +interface ID3D11AuthenticatedChannel(ID3D11AuthenticatedChannelVtbl): + ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetCertificateSize( + pCertificateSize: *mut UINT, + ) -> HRESULT, + fn GetCertificate( + CertificateSize: UINT, + pCertificate: *mut BYTE, + ) -> HRESULT, + fn GetChannelHandle( + pChannelHandle: *mut HANDLE, + ) -> (), +}} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_PROTECTION, + 0xa84eb584, 0xc495, 0x48aa, 0xb9, 0x4d, 0x8b, 0xd2, 0xd6, 0xfb, 0xce, 0x05} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_CHANNEL_TYPE, + 0xbc1b18a5, 0xb1fb, 0x42ab, 0xbd, 0x94, 0xb5, 0x82, 0x8b, 0x4b, 0xf7, 0xbe} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_DEVICE_HANDLE, + 0xec1c539d, 0x8cff, 0x4e2a, 0xbc, 0xc4, 0xf5, 0x69, 0x2f, 0x99, 0xf4, 0x80} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION, + 0x2634499e, 0xd018, 0x4d74, 0xac, 0x17, 0x7f, 0x72, 0x40, 0x59, 0x52, 0x8d} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_COUNT, + 0x0db207b3, 0x9450, 0x46a6, 0x82, 0xde, 0x1b, 0x96, 0xd4, 0x4f, 0x9c, 0xf2} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS, + 0x649bbadb, 0xf0f4, 0x4639, 0xa1, 0x5b, 0x24, 0x39, 0x3f, 0xc3, 0xab, 0xac} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_UNRESTRICTED_PROTECTED_SHARED_RESOURCE_COUNT, + 0x012f0bd6, 0xe662, 0x4474, 0xbe, 0xfd, 0xaa, 0x53, 0xe5, 0x14, 0x3c, 0x6d} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT, + 0x2c042b5e, 0x8c07, 0x46d5, 0xaa, 0xbe, 0x8f, 0x75, 0xcb, 0xad, 0x4c, 0x31} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_OUTPUT_ID, + 0x839ddca3, 0x9b4e, 0x41e4, 0xb0, 0x53, 0x89, 0x2b, 0xd2, 0xa1, 0x1e, 0xe7} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ATTRIBUTES, + 0x6214d9d2, 0x432c, 0x4abb, 0x9f, 0xce, 0x21, 0x6e, 0xea, 0x26, 0x9e, 0x3b} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_ENCRYPTION_WHEN_ACCESSIBLE_GUID_COUNT, + 0xb30f7066, 0x203c, 0x4b07, 0x93, 0xfc, 0xce, 0xaa, 0xfd, 0x61, 0x24, 0x1e} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_ENCRYPTION_WHEN_ACCESSIBLE_GUID, + 0xf83a5958, 0xe986, 0x4bda, 0xbe, 0xb0, 0x41, 0x1f, 0x6a, 0x7a, 0x01, 0xb7} +DEFINE_GUID!{D3D11_AUTHENTICATED_QUERY_CURRENT_ENCRYPTION_WHEN_ACCESSIBLE, + 0xec1791c7, 0xdad3, 0x4f15, 0x9e, 0xc3, 0xfa, 0xa9, 0x3d, 0x60, 0xd4, 0xf0} +DEFINE_GUID!{D3D11_AUTHENTICATED_CONFIGURE_INITIALIZE, + 0x06114bdb, 0x3523, 0x470a, 0x8d, 0xca, 0xfb, 0xc2, 0x84, 0x51, 0x54, 0xf0} +DEFINE_GUID!{D3D11_AUTHENTICATED_CONFIGURE_PROTECTION, + 0x50455658, 0x3f47, 0x4362, 0xbf, 0x99, 0xbf, 0xdf, 0xcd, 0xe9, 0xed, 0x29} +DEFINE_GUID!{D3D11_AUTHENTICATED_CONFIGURE_CRYPTO_SESSION, + 0x6346cc54, 0x2cfc, 0x4ad4, 0x82, 0x24, 0xd1, 0x58, 0x37, 0xde, 0x77, 0x00} +DEFINE_GUID!{D3D11_AUTHENTICATED_CONFIGURE_SHARED_RESOURCE, + 0x0772d047, 0x1b40, 0x48e8, 0x9c, 0xa6, 0xb5, 0xf5, 0x10, 0xde, 0x9f, 0x01} +DEFINE_GUID!{D3D11_AUTHENTICATED_CONFIGURE_ENCRYPTION_WHEN_ACCESSIBLE, + 0x41fff286, 0x6ae0, 0x4d43, 0x9d, 0x55, 0xa4, 0x6e, 0x9e, 0xfd, 0x15, 0x8a} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_INPUT { + QueryType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT { + omac: D3D11_OMAC, + QueryType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, + ReturnCode: HRESULT, +}} +//FIXME bitfield +STRUCT!{struct D3D11_AUTHENTICATED_PROTECTION_FLAGS { + u: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_PROTECTION_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + ProtectionFlags: D3D11_AUTHENTICATED_PROTECTION_FLAGS, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CHANNEL_TYPE_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_DEVICE_HANDLE_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DeviceHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + DecoderHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DecoderHandle: HANDLE, + CryptoSessionHandle: HANDLE, + DeviceHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + RestrictedSharedResourceProcessCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + ProcessIndex: UINT, +}} +ENUM!{enum D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE { + DD3D11_PROCESSIDTYPE_UNKNOWN = 0, + DD3D11_PROCESSIDTYPE_DWM = 1, + DD3D11_PROCESSIDTYPE_HANDLE = 2, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + ProcessIndex: UINT, + ProcessIdentifier: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE, + ProcessHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_UNRESTRICTED_PROTECTED_SHARED_RESOURCE_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + UnrestrictedProtectedSharedResourceCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDIndex: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + DeviceHandle: HANDLE, + CryptoSessionHandle: HANDLE, + OutputIDIndex: UINT, + OutputID: UINT64, +}} +ENUM!{enum D3D11_BUS_TYPE { + D3D11_BUS_TYPE_OTHER = 0, + D3D11_BUS_TYPE_PCI = 0x1, + D3D11_BUS_TYPE_PCIX = 0x2, + D3D11_BUS_TYPE_PCIEXPRESS = 0x3, + D3D11_BUS_TYPE_AGP = 0x4, + D3D11_BUS_IMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x10000, + D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x20000, + D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x30000, + D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x40000, + D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x50000, + D3D11_BUS_IMPL_MODIFIER_NON_STANDARD = 0x80000000, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACESSIBILITY_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + BusType: D3D11_BUS_TYPE, + AccessibleInContiguousBlocks: BOOL, + AccessibleInNonContiguousBlocks: BOOL, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_COUNT_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + EncryptionGuidCount: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_INPUT { + Input: D3D11_AUTHENTICATED_QUERY_INPUT, + EncryptionGuidIndex: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + EncryptionGuidIndex: UINT, + EncryptionGuid: GUID, +}} +STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CURRENT_ACCESSIBILITY_ENCRYPTION_OUTPUT { + Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, + EncryptionGuid: GUID, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_INPUT { + omac: D3D11_OMAC, + ConfigureType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_OUTPUT { + omac: D3D11_OMAC, + ConfigureType: GUID, + hChannel: HANDLE, + SequenceNumber: UINT, + ReturnCode: HRESULT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_INITIALIZE_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + StartSequenceQuery: UINT, + StartSequenceConfigure: UINT, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_PROTECTION_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + Protections: D3D11_AUTHENTICATED_PROTECTION_FLAGS, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_CRYPTO_SESSION_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + DecoderHandle: HANDLE, + CryptoSessionHandle: HANDLE, + DeviceHandle: HANDLE, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_SHARED_RESOURCE_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + ProcessType: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE, + ProcessHandle: HANDLE, + AllowAccess: BOOL, +}} +STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_ACCESSIBLE_ENCRYPTION_INPUT { + Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, + EncryptionGuid: GUID, +}} +DEFINE_GUID!{D3D11_KEY_EXCHANGE_RSAES_OAEP, + 0xc1949895, 0xd72a, 0x4a1d, 0x8e, 0x5d, 0xed, 0x85, 0x7d, 0x17, 0x15, 0x20} +RIDL!{#[uuid(0x9b32f9ad, 0xbdcc, 0x40a6, 0xa3, 0x9d, 0xd5, 0xc8, 0x65, 0x84, 0x57, 0x20)] +interface ID3D11CryptoSession(ID3D11CryptoSessionVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetCryptoType( + pCryptoType: *mut GUID, + ) -> (), + fn GetDecoderProfile( + pDecoderProfile: *mut GUID, + ) -> (), + fn GetCertificateSize( + pCertificateSize: *mut UINT, + ) -> HRESULT, + fn GetCertificate( + CertificateSize: UINT, + pCertificate: *mut BYTE, + ) -> HRESULT, + fn GetCryptoSessionHandle( + pCertificate: *mut HANDLE, + ) -> (), +}} +ENUM!{enum D3D11_VDOV_DIMENSION { + D3D11_VDOV_DIMENSION_UNKNOWN = 0, + D3D11_VDOV_DIMENSION_TEXTURE2D = 1, +}} +STRUCT!{struct D3D11_TEX2D_VDOV { + ArraySlice: UINT, +}} +STRUCT!{struct D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC { + DecodeProfile: GUID, + ViewDimension: D3D11_VDOV_DIMENSION, + Texture2D: D3D11_TEX2D_VDOV, +}} +RIDL!{#[uuid(0xc2931aea, 0x2a85, 0x4f20, 0x86, 0x0f, 0xfb, 0xa1, 0xfd, 0x25, 0x6e, 0x18)] +interface ID3D11VideoDecoderOutputView(ID3D11VideoDecoderOutputViewVtbl): + ID3D11View(ID3D11ViewVtbl) { + fn GetDesc( + pDesc: *mut D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC, + ) -> (), +}} +ENUM!{enum D3D11_VPIV_DIMENSION { + D3D11_VPIV_DIMENSION_UNKNOWN = 0, + D3D11_VPIV_DIMENSION_TEXTURE2D = 1, +}} +STRUCT!{struct D3D11_TEX2D_VPIV { + MipSlice: UINT, + ArraySlice: UINT, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC { + FourCC: UINT, + ViewDimension: D3D11_VPIV_DIMENSION, + Texture2D: D3D11_TEX2D_VPIV, +}} +RIDL!{#[uuid(0x11ec5a5f, 0x51dc, 0x4945, 0xab, 0x34, 0x6e, 0x8c, 0x21, 0x30, 0x0e, 0xa5)] +interface ID3D11VideoProcessorInputView(ID3D11VideoProcessorInputViewVtbl): + ID3D11View(ID3D11ViewVtbl) { + fn GetDesc( + pDesc: *mut D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC, + ) -> (), +}} +ENUM!{enum D3D11_VPOV_DIMENSION { + D3D11_VPOV_DIMENSION_UNKNOWN = 0, + D3D11_VPOV_DIMENSION_TEXTURE2D = 1, + D3D11_VPOV_DIMENSION_TEXTURE2DARRAY = 2, +}} +STRUCT!{struct D3D11_TEX2D_VPOV { + MipSlice: UINT, +}} +STRUCT!{struct D3D11_TEX2D_ARRAY_VPOV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +UNION!{union D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC_u { + [u32; 3], + Texture2D Texture2D_mut: D3D11_TEX2D_VPOV, + Texture2DArray Texture2DArray_mut: D3D11_TEX2D_ARRAY_VPOV, +}} +STRUCT!{struct D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC { + ViewDimension: D3D11_VPOV_DIMENSION, + u: D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC_u, +}} +RIDL!{#[uuid(0xa048285e, 0x25a9, 0x4527, 0xbd, 0x93, 0xd6, 0x8b, 0x68, 0xc4, 0x42, 0x54)] +interface ID3D11VideoProcessorOutputView(ID3D11VideoProcessorOutputViewVtbl): + ID3D11View(ID3D11ViewVtbl) { + fn GetDesc( + pDesc: *mut D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, + ) -> (), +}} +RIDL!{#[uuid(0x61f21c45, 0x3c0e, 0x4a74, 0x9c, 0xea, 0x67, 0x10, 0x0d, 0x9a, 0xd5, 0xe4)] +interface ID3D11VideoContext(ID3D11VideoContextVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { + fn GetDecoderBuffer( + pDecoder: *mut ID3D11VideoDecoder, + Type: D3D11_VIDEO_DECODER_BUFFER_TYPE, + pBufferSize: *mut UINT, + ppBuffer: *mut *mut c_void, + ) -> HRESULT, + fn ReleaseDecoderBuffer( + pDecoder: *mut ID3D11VideoDecoder, + Type: D3D11_VIDEO_DECODER_BUFFER_TYPE, + ) -> HRESULT, + fn DecoderBeginFrame( + pDecoder: *mut ID3D11VideoDecoder, + pView: *mut ID3D11VideoDecoderOutputView, + ContentKeySize: UINT, + pContentKey: *const c_void, + ) -> HRESULT, + fn DecoderEndFrame( + pDecoder: *mut ID3D11VideoDecoder, + ) -> HRESULT, + fn SubmitDecoderBuffers( + pDecoder: *mut ID3D11VideoDecoder, + NumBuffers: UINT, + pBufferDesc: *const D3D11_VIDEO_DECODER_BUFFER_DESC, + ) -> HRESULT, + fn DecoderExtension( + pDecoder: *mut ID3D11VideoDecoder, + pExtensionData: *const D3D11_VIDEO_DECODER_EXTENSION, + ) -> HRESULT, + fn VideoProcessorSetOutputTargetRect( + pVideoProcessor: *mut ID3D11VideoProcessor, + Enable: BOOL, + pRect: *const RECT, + ) -> (), + fn VideoProcessorSetOutputBackgroundColor( + pVideoProcessor: *mut ID3D11VideoProcessor, + YCbCr: BOOL, + pRect: *const RECT, + ) -> (), + fn VideoProcessorSetOutputColorSpace( + pVideoProcessor: *mut ID3D11VideoProcessor, + pColorSpace: *const D3D11_VIDEO_PROCESSOR_COLOR_SPACE, + ) -> HRESULT, + fn VideoProcessorSetOutputAlphaFillMode( + pVideoProcessor: *mut ID3D11VideoProcessor, + AlphaFillMode: D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, + StreamIndex: UINT, + ) -> (), + fn VideoProcessorSetOutputConstriction( + pVideoProcessor: *mut ID3D11VideoProcessor, + Enable: BOOL, + Size: SIZE, + ) -> (), + fn VideoProcessorSetOutputStereoMode( + pVideoProcessor: *mut ID3D11VideoProcessor, + Enable: BOOL, + ) -> (), + fn VideoProcessorSetOutputExtension( + pVideoProcessor: *mut ID3D11VideoProcessor, + pExtensionGuid: *const GUID, + DataSize: UINT, + pData: *mut c_void, + ) -> HRESULT, + fn VideoProcessorGetOutputTargetRect( + pVideoProcessor: *mut ID3D11VideoProcessor, + Enabled: *mut BOOL, + pRect: *mut RECT, + ) -> (), + fn VideoProcessorGetOutputBackgroundColor( + pVideoProcessor: *mut ID3D11VideoProcessor, + pYCbCr: *mut BOOL, + pColor: *mut D3D11_VIDEO_COLOR, + ) -> (), + fn VideoProcessorGetOutputColorSpace( + pVideoProcessor: *mut ID3D11VideoProcessor, + pColorSpace: *mut D3D11_VIDEO_PROCESSOR_COLOR_SPACE, + ) -> (), + fn VideoProcessorGetOutputAlphaFillMode( + pVideoProcessor: *mut ID3D11VideoProcessor, + pAlphaFillMode: *mut D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, + pStreamIndex: *mut UINT, + ) -> (), + fn VideoProcessorGetOutputConstriction( + pVideoProcessor: *mut ID3D11VideoProcessor, + pEnabled: *mut BOOL, + pSize: *mut SIZE, + ) -> (), + fn VideoProcessorGetOutputStereoMode( + pVideoProcessor: *mut ID3D11VideoProcessor, + pEnabled: *mut BOOL, + ) -> (), + fn VideoProcessorGetOutputExtension( + pVideoProcessor: *mut ID3D11VideoProcessor, + pExtensionGuid: *const GUID, + DataSize: UINT, + pData: *mut c_void, + ) -> HRESULT, + fn VideoProcessorSetStreamFrameFormat( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + FrameFormat: D3D11_VIDEO_FRAME_FORMAT, + ) -> (), + fn VideoProcessorSetStreamColorSpace( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pColorSpace: *const D3D11_VIDEO_PROCESSOR_COLOR_SPACE, + ) -> (), + fn VideoProcessorSetStreamOutputRate( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + OutputRate: D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, + RepeatFrame: BOOL, + pCustomRate: *const DXGI_RATIONAL, + ) -> (), + fn VideoProcessorSetStreamSourceRect( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + pRect: *const RECT, + ) -> (), + fn VideoProcessorSetStreamDestRect( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + pRect: *const RECT, + ) -> (), + fn VideoProcessorSetStreamAlpha( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + Alpha: FLOAT, + ) -> (), + fn VideoProcessorSetStreamPalette( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Count: UINT, + pEntries: *const UINT, + ) -> (), + fn VideoProcessorSetStreamPixelAspectRatio( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + pSourceAspectRatio: *const DXGI_RATIONAL, + pDestinationAspectRatio: *const DXGI_RATIONAL, + ) -> (), + fn VideoProcessorSetStreamLumaKey( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + Lower: FLOAT, + Upper: FLOAT, + ) -> (), + fn VideoProcessorSetStreamStereoFormat( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + Format: D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, + LeftViewFrame0: BOOL, + BaseViewFrame0: BOOL, + FlipMode: D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE, + ) -> (), + fn VideoProcessorSetStreamAutoProcessingMode( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + ) -> (), + fn VideoProcessorSetStreamFilter( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Filter: D3D11_VIDEO_PROCESSOR_FILTER, + Enable: BOOL, + Level: c_int, + ) -> (), + fn VideoProcessorSetStreamExtension( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pExtensionGuid: *const GUID, + DataSize: UINT, + pData: *mut c_void, + ) -> HRESULT, + fn VideoProcessorGetStreamFrameFormat( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pFrameFormat: *mut D3D11_VIDEO_FRAME_FORMAT, + ) -> (), + fn VideoProcessorGetStreamColorSpace( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pColorSpace: *mut D3D11_VIDEO_PROCESSOR_COLOR_SPACE, + ) -> (), + fn VideoProcessorGetStreamOutputRate( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pOutputRate: *mut D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, + pRepeatFrame: *mut BOOL, + pCustomRate: *mut DXGI_RATIONAL, + ) -> (), + fn VideoProcessorGetStreamSourceRect( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnabled: *mut BOOL, + pRect: *mut RECT, + ) -> (), + fn VideoProcessorGetStreamDestRect( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnabled: *mut BOOL, + pRect: *mut RECT, + ) -> (), + fn VideoProcessorGetStreamAlpha( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnabled: *mut BOOL, + pAlpha: *mut FLOAT, + ) -> (), + fn VideoProcessorGetStreamPalette( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Count: UINT, + pEntries: *mut UINT, + ) -> (), + fn VideoProcessorGetStreamPixelAspectRatio( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnabled: *mut BOOL, + pSourceAspectRatio: *mut DXGI_RATIONAL, + pDestinationAspectRatio: *mut DXGI_RATIONAL, + ) -> (), + fn VideoProcessorGetStreamLumaKey( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnabled: *mut BOOL, + pLower: *mut FLOAT, + pUpper: *mut FLOAT, + ) -> (), + fn VideoProcessorGetStreamStereoFormat( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnabled: *mut BOOL, + pFormat: *mut D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, + pLeftViewFrame0: *mut BOOL, + pBaseViewFrame0: *mut BOOL, + pFlipMode: *mut D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE, + MonoOffset: *mut c_int, + ) -> (), + fn VideoProcessorGetStreamAutoProcessingMode( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnabled: *mut BOOL, + ) -> (), + fn VideoProcessorGetStreamFilter( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Filter: D3D11_VIDEO_PROCESSOR_FILTER, + pEnabled: *mut BOOL, + pLevel: *mut c_int, + ) -> (), + fn VideoProcessorGetStreamExtension( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pExtensionGuid: *const GUID, + DataSize: UINT, + pData: *mut c_void, + ) -> HRESULT, + fn VideoProcessorBlt( + pVideoProcessor: *mut ID3D11VideoProcessor, + pView: *mut ID3D11VideoProcessorOutputView, + OutputFrame: UINT, + StreamCount: UINT, + pStreams: *const D3D11_VIDEO_PROCESSOR_STREAM, + ) -> HRESULT, + fn NegotiateCryptoSessionKeyExchange( + pCryptoSession: *mut ID3D11CryptoSession, + DataSize: UINT, + pData: *mut c_void, + ) -> HRESULT, + fn EncryptionBlt( + pCryptoSession: *mut ID3D11CryptoSession, + pSrcSurface: *mut ID3D11Texture2D, + pDstSurface: *mut ID3D11Texture2D, + IVSize: UINT, + pIV: *mut c_void, + ) -> HRESULT, + fn DecryptionBlt( + pCryptoSession: *mut ID3D11CryptoSession, + pSrcSurface: *mut ID3D11Texture2D, + pDstSurface: *mut ID3D11Texture2D, + pEncryptedBlockInfo: *mut D3D11_ENCRYPTED_BLOCK_INFO, + ContentKeySize: UINT, + pContentKey: *const c_void, + IVSize: UINT, + pIV: *mut c_void, + ) -> HRESULT, + fn StartSessionKeyRefresh( + pCryptoSession: *mut ID3D11CryptoSession, + RandomNumberSize: UINT, + pRandomNumber: *mut c_void, + ) -> HRESULT, + fn FinishSessionKeyRefresh( + pCryptoSession: *mut ID3D11CryptoSession, + ) -> HRESULT, + fn GetEncryptionBltKey( + pCryptoSession: *mut ID3D11CryptoSession, + KeySize: UINT, + pReadbackKey: *mut c_void, + ) -> HRESULT, + fn NegotiateAuthenticatedChannelKeyExchange( + pChannel: *mut ID3D11AuthenticatedChannel, + DataSize: UINT, + pData: *mut c_void, + ) -> HRESULT, + fn QueryAuthenticatedChannel( + pChannel: *mut ID3D11AuthenticatedChannel, + InputSize: UINT, + pInput: *const c_void, + OutputSize: UINT, + pOutput: *mut c_void, + ) -> HRESULT, + fn ConfigureAuthenticatedChannel( + pChannel: *mut ID3D11AuthenticatedChannel, + InputSize: UINT, + pInput: *const c_void, + pOutput: *mut D3D11_AUTHENTICATED_CONFIGURE_OUTPUT, + ) -> HRESULT, + fn VideoProcessorSetStreamRotation( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + Enable: BOOL, + Rotation: D3D11_VIDEO_PROCESSOR_ROTATION, + ) -> HRESULT, + fn VideoProcessorGetStreamRotation( + pVideoProcessor: *mut ID3D11VideoProcessor, + StreamIndex: UINT, + pEnable: *mut BOOL, + pRotation: *mut D3D11_VIDEO_PROCESSOR_ROTATION, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x10ec4d5b, 0x975a, 0x4689, 0xb9, 0xe4, 0xd0, 0xaa, 0xc3, 0x0f, 0xe3, 0x33)] +interface ID3D11VideoDevice(ID3D11VideoDeviceVtbl): IUnknown(IUnknownVtbl) { + fn CreateVideoDecoder( + pVideoDesc: *const D3D11_VIDEO_DECODER_DESC, + pConfig: *const D3D11_VIDEO_DECODER_CONFIG, + ppDecoder: *mut *mut ID3D11VideoDecoder, + ) -> HRESULT, + fn CreateVideoProcessor( + pEnum: *mut ID3D11VideoProcessorEnumerator, + RateConversionIndex: UINT, + ppVideoProcessor: *mut *mut ID3D11VideoProcessor, + ) -> HRESULT, + fn CreateAuthenticatedChannel( + ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE, + ppAuthenticatedChannel: *mut *mut ID3D11AuthenticatedChannel, + ) -> HRESULT, + fn CreateCryptoSession( + pCryptoType: *const GUID, + pDecoderProfile: *const GUID, + pKeyExchangeType: *const GUID, + ppCryptoSession: *mut *mut ID3D11CryptoSession, + ) -> HRESULT, + fn CreateVideoDecoderOutputView( + pResource: *mut ID3D11Resource, + pDesc: *const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC, + ppVDOVView: *mut *mut ID3D11VideoDecoderOutputView, + ) -> HRESULT, + fn CreateVideoProcessorInputView( + pResource: *mut ID3D11Resource, + pEnum: *mut ID3D11VideoProcessorEnumerator, + pDesc: *const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC, + ppVPIView: *mut *mut ID3D11VideoProcessorInputView, + ) -> HRESULT, + fn CreateVideoProcessorOutputView( + pResource: *mut ID3D11Resource, + pEnum: *mut ID3D11VideoProcessorEnumerator, + pDesc: *const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, + ppVPOView: *mut *mut ID3D11VideoProcessorOutputView, + ) -> HRESULT, + fn CreateVideoProcessorEnumerator( + pDesc: *const D3D11_VIDEO_PROCESSOR_CONTENT_DESC, + ppEnum: *mut *mut ID3D11VideoProcessorEnumerator, + ) -> HRESULT, + fn GetVideoDecoderProfileCount() -> UINT, + fn GetVideoDecoderProfile( + Index: UINT, + pDecoderProfile: *mut GUID, + ) -> HRESULT, + fn CheckVideoDecoderFormat( + pDecoderProfile: *const GUID, + Format: DXGI_FORMAT, + pSupported: *mut BOOL, + ) -> HRESULT, + fn GetVideoDecoderConfigCount( + pDesc: *const D3D11_VIDEO_DECODER_DESC, + pCount: *mut UINT, + ) -> HRESULT, + fn GetVideoDecoderConfig( + pDesc: *const D3D11_VIDEO_DECODER_DESC, + Index: UINT, + pConfig: *mut D3D11_VIDEO_DECODER_CONFIG, + ) -> HRESULT, + fn GetContentProtectionCaps( + pCryptoType: *const GUID, + pDecoderProfile: *const GUID, + pCaps: *mut D3D11_VIDEO_CONTENT_PROTECTION_CAPS, + ) -> HRESULT, + fn CheckCryptoKeyExchange( + pCryptoType: *const GUID, + pDecoderProfile: *const GUID, + Index: UINT, + pKeyExchangeType: *mut GUID, + ) -> HRESULT, + fn SetPrivateData( + guid: REFGUID, + DataSize: UINT, + pData: *const c_void, + ) -> HRESULT, + fn SetPrivateDataInterface( + guid: REFGUID, + pData: *const IUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xdb6f6ddb, 0xac77, 0x4e88, 0x82, 0x53, 0x81, 0x9d, 0xf9, 0xbb, 0xf1, 0x40)] +interface ID3D11Device(ID3D11DeviceVtbl): IUnknown(IUnknownVtbl) { + fn CreateBuffer( + pDesc: *const D3D11_BUFFER_DESC, + pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppBuffer: *mut *mut ID3D11Buffer, + ) -> HRESULT, + fn CreateTexture1D( + pDesc: *const D3D11_TEXTURE1D_DESC, + pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppTexture1D: *mut *mut ID3D11Texture1D, + ) -> HRESULT, + fn CreateTexture2D( + pDesc: *const D3D11_TEXTURE2D_DESC, + pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppTexture2D: *mut *mut ID3D11Texture2D, + ) -> HRESULT, + fn CreateTexture3D( + pDesc: *const D3D11_TEXTURE3D_DESC, + pInitialData: *const D3D11_SUBRESOURCE_DATA, + ppTexture3D: *mut *mut ID3D11Texture3D, + ) -> HRESULT, + fn CreateShaderResourceView( + pResource: *mut ID3D11Resource, + pDesc: *const D3D11_SHADER_RESOURCE_VIEW_DESC, + ppSRView: *mut *mut ID3D11ShaderResourceView, + ) -> HRESULT, + fn CreateUnorderedAccessView( + pResource: *mut ID3D11Resource, + pDesc: *const D3D11_UNORDERED_ACCESS_VIEW_DESC, + ppUAView: *mut *mut ID3D11UnorderedAccessView, + ) -> HRESULT, + fn CreateRenderTargetView( + pResource: *mut ID3D11Resource, + pDesc: *const D3D11_RENDER_TARGET_VIEW_DESC, + ppRTView: *mut *mut ID3D11RenderTargetView, + ) -> HRESULT, + fn CreateDepthStencilView( + pResource: *mut ID3D11Resource, + pDesc: *const D3D11_DEPTH_STENCIL_VIEW_DESC, + ppDepthStencilView: *mut *mut ID3D11DepthStencilView, + ) -> HRESULT, + fn CreateInputLayout( + pInputElementDescs: *const D3D11_INPUT_ELEMENT_DESC, + NumElements: UINT, + pShaderBytecodeWithInputSignature: *const c_void, + BytecodeLength: SIZE_T, + ppInputLayout: *mut *mut ID3D11InputLayout, + ) -> HRESULT, + fn CreateVertexShader( + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, + ppVertexShader: *mut *mut ID3D11VertexShader, + ) -> HRESULT, + fn CreateGeometryShader( + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, + ppGeometryShader: *mut *mut ID3D11GeometryShader, + ) -> HRESULT, + fn CreateGeometryShaderWithStreamOutput( + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, + pSODeclaration: *const D3D11_SO_DECLARATION_ENTRY, + NumEntries: UINT, + pBufferStrides: *const UINT, + NumStrides: UINT, + RasterizedStream: UINT, + pClassLinkage: *mut ID3D11ClassLinkage, + ppGeometryShader: *mut *mut ID3D11GeometryShader, + ) -> HRESULT, + fn CreatePixelShader( + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, + ppPixelShader: *mut *mut ID3D11PixelShader, + ) -> HRESULT, + fn CreateHullShader( + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, + ppHullShader: *mut *mut ID3D11HullShader, + ) -> HRESULT, + fn CreateDomainShader( + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, + ppDomainShader: *mut *mut ID3D11DomainShader, + ) -> HRESULT, + fn CreateComputeShader( + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, + pClassLinkage: *mut ID3D11ClassLinkage, + ppComputeShader: *mut *mut ID3D11ComputeShader, + ) -> HRESULT, + fn CreateClassLinkage( + ppLinkage: *mut *mut ID3D11ClassLinkage, + ) -> HRESULT, + fn CreateBlendState( + pBlendStateDesc: *const D3D11_BLEND_DESC, + ppBlendState: *mut *mut ID3D11BlendState, + ) -> HRESULT, + fn CreateDepthStencilState( + pDepthStencilDesc: *const D3D11_DEPTH_STENCIL_DESC, + ppDepthStencilState: *mut *mut ID3D11DepthStencilState, + ) -> HRESULT, + fn CreateRasterizerState( + pRasterizerDesc: *const D3D11_RASTERIZER_DESC, + ppRasterizerState: *mut *mut ID3D11RasterizerState, + ) -> HRESULT, + fn CreateSamplerState( + pSamplerDesc: *const D3D11_SAMPLER_DESC, + ppSamplerState: *mut *mut ID3D11SamplerState, + ) -> HRESULT, + fn CreateQuery( + pQueryDesc: *const D3D11_QUERY_DESC, + ppQuery: *mut *mut ID3D11Query, + ) -> HRESULT, + fn CreatePredicate( + pPredicateDesc: *const D3D11_QUERY_DESC, + ppPredicate: *mut *mut ID3D11Predicate, + ) -> HRESULT, + fn CreateCounter( + pCounterDesc: *const D3D11_COUNTER_DESC, + ppCounter: *mut *mut ID3D11Counter, + ) -> HRESULT, + fn CreateDeferredContext( + ContextFlags: UINT, + ppDeferredContext: *mut *mut ID3D11DeviceContext, + ) -> HRESULT, + fn OpenSharedResource( + hResource: HANDLE, + ReturnedInterface: REFIID, + ppResource: *mut *mut c_void, + ) -> HRESULT, + fn CheckFormatSupport( + Format: DXGI_FORMAT, + pFormatSupport: *mut UINT, + ) -> HRESULT, + fn CheckMultisampleQualityLevels( + Format: DXGI_FORMAT, + SampleCount: UINT, + pNumQualityLevels: *mut UINT, + ) -> HRESULT, + fn CheckCounterInfo( + pCounterInfo: *mut D3D11_COUNTER_INFO, + ) -> (), + fn CheckCounter( + pDesc: *const D3D11_COUNTER_DESC, + pType: *mut D3D11_COUNTER_TYPE, + pActiveCounters: *mut UINT, + szName: LPSTR, + pNameLength: *mut UINT, + szUnits: LPSTR, + pUnitsLength: *mut UINT, + szDescription: LPSTR, + pDescriptionLength: *mut UINT, + ) -> HRESULT, + fn CheckFeatureSupport( + Feature: D3D11_FEATURE, + pFeatureSupportData: *mut c_void, + FeatureSupportDataSize: UINT, + ) -> HRESULT, + fn GetPrivateData( + guid: REFGUID, + pDataSize: *mut UINT, + pData: *mut c_void, + ) -> HRESULT, + fn SetPrivateData( + guid: REFGUID, + DataSize: UINT, + pData: *const c_void, + ) -> HRESULT, + fn SetPrivateDataInterface( + guid: REFGUID, + pData: *const IUnknown, + ) -> HRESULT, + fn GetFeatureLevel() -> D3D_FEATURE_LEVEL, + fn GetCreationFlags() -> UINT, + fn GetDeviceRemovedReason() -> HRESULT, + fn GetImmediateContext( + ppImmediateContext: *mut *mut ID3D11DeviceContext, + ) -> (), + fn SetExceptionMode( + RaiseFlags: UINT, + ) -> HRESULT, + fn GetExceptionMode() -> UINT, +}} +ENUM!{enum D3D11_CREATE_DEVICE_FLAG { + D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1, + D3D11_CREATE_DEVICE_DEBUG = 0x2, + D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4, + D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, + D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20, + D3D11_CREATE_DEVICE_DEBUGGABLE = 0x40, + D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 0x80, + D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = 0x100, + D3D11_CREATE_DEVICE_VIDEO_SUPPORT = 0x800, +}} +pub const D3D11_SDK_VERSION: DWORD = 7; +#[inline] +pub fn D3D11CalcSubresource(MipSlice: UINT, ArraySlice: UINT, MipLevels: UINT) -> UINT { + MipSlice + ArraySlice * MipLevels +} +extern "system" { + pub fn D3D11CreateDevice( + pAdapter: *mut IDXGIAdapter, + DriverType: D3D_DRIVER_TYPE, + Software: HMODULE, + Flags: UINT, + pFeatureLevels: *const D3D_FEATURE_LEVEL, + FeatureLevels: UINT, + SDKVersion: UINT, + ppDevice: *mut *mut ID3D11Device, + pFeatureLevel: *mut D3D_FEATURE_LEVEL, + ppImmediateContext: *mut *mut ID3D11DeviceContext, + ) -> HRESULT; + pub fn D3D11CreateDeviceAndSwapChain( + pAdapter: *mut IDXGIAdapter, + DriverType: D3D_DRIVER_TYPE, + Software: HMODULE, + Flags: UINT, + pFeatureLevels: *const D3D_FEATURE_LEVEL, + FeatureLevels: UINT, + SDKVersion: UINT, + pSwapChainDesc: *const DXGI_SWAP_CHAIN_DESC, + ppSwapChain: *mut *mut IDXGISwapChain, + ppDevice: *mut *mut ID3D11Device, + pFeatureLevel: *mut D3D_FEATURE_LEVEL, + ppImmediateContext: *mut *mut ID3D11DeviceContext, + ) -> HRESULT; +} +DEFINE_GUID!{IID_ID3D11DeviceChild, + 0x1841e5c8, 0x16b0, 0x489b, 0xbc, 0xc8, 0x44, 0xcf, 0xb0, 0xd5, 0xde, 0xae} +DEFINE_GUID!{IID_ID3D11DepthStencilState, + 0x03823efb, 0x8d8f, 0x4e1c, 0x9a, 0xa2, 0xf6, 0x4b, 0xb2, 0xcb, 0xfd, 0xf1} +DEFINE_GUID!{IID_ID3D11BlendState, + 0x75b68faa, 0x347d, 0x4159, 0x8f, 0x45, 0xa0, 0x64, 0x0f, 0x01, 0xcd, 0x9a} +DEFINE_GUID!{IID_ID3D11RasterizerState, + 0x9bb4ab81, 0xab1a, 0x4d8f, 0xb5, 0x06, 0xfc, 0x04, 0x20, 0x0b, 0x6e, 0xe7} +DEFINE_GUID!{IID_ID3D11Resource, + 0xdc8e63f3, 0xd12b, 0x4952, 0xb4, 0x7b, 0x5e, 0x45, 0x02, 0x6a, 0x86, 0x2d} +DEFINE_GUID!{IID_ID3D11Buffer, + 0x48570b85, 0xd1ee, 0x4fcd, 0xa2, 0x50, 0xeb, 0x35, 0x07, 0x22, 0xb0, 0x37} +DEFINE_GUID!{IID_ID3D11Texture1D, + 0xf8fb5c27, 0xc6b3, 0x4f75, 0xa4, 0xc8, 0x43, 0x9a, 0xf2, 0xef, 0x56, 0x4c} +DEFINE_GUID!{IID_ID3D11Texture2D, + 0x6f15aaf2, 0xd208, 0x4e89, 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c} +DEFINE_GUID!{IID_ID3D11Texture3D, + 0x037e866e, 0xf56d, 0x4357, 0xa8, 0xaf, 0x9d, 0xab, 0xbe, 0x6e, 0x25, 0x0e} +DEFINE_GUID!{IID_ID3D11View, + 0x839d1216, 0xbb2e, 0x412b, 0xb7, 0xf4, 0xa9, 0xdb, 0xeb, 0xe0, 0x8e, 0xd1} +DEFINE_GUID!{IID_ID3D11ShaderResourceView, + 0xb0e06fe0, 0x8192, 0x4e1a, 0xb1, 0xca, 0x36, 0xd7, 0x41, 0x47, 0x10, 0xb2} +DEFINE_GUID!{IID_ID3D11RenderTargetView, + 0xdfdba067, 0x0b8d, 0x4865, 0x87, 0x5b, 0xd7, 0xb4, 0x51, 0x6c, 0xc1, 0x64} +DEFINE_GUID!{IID_ID3D11DepthStencilView, + 0x9fdac92a, 0x1876, 0x48c3, 0xaf, 0xad, 0x25, 0xb9, 0x4f, 0x84, 0xa9, 0xb6} +DEFINE_GUID!{IID_ID3D11UnorderedAccessView, + 0x28acf509, 0x7f5c, 0x48f6, 0x86, 0x11, 0xf3, 0x16, 0x01, 0x0a, 0x63, 0x80} +DEFINE_GUID!{IID_ID3D11VertexShader, + 0x3b301d64, 0xd678, 0x4289, 0x88, 0x97, 0x22, 0xf8, 0x92, 0x8b, 0x72, 0xf3} +DEFINE_GUID!{IID_ID3D11HullShader, + 0x8e5c6061, 0x628a, 0x4c8e, 0x82, 0x64, 0xbb, 0xe4, 0x5c, 0xb3, 0xd5, 0xdd} +DEFINE_GUID!{IID_ID3D11DomainShader, + 0xf582c508, 0x0f36, 0x490c, 0x99, 0x77, 0x31, 0xee, 0xce, 0x26, 0x8c, 0xfa} +DEFINE_GUID!{IID_ID3D11GeometryShader, + 0x38325b96, 0xeffb, 0x4022, 0xba, 0x02, 0x2e, 0x79, 0x5b, 0x70, 0x27, 0x5c} +DEFINE_GUID!{IID_ID3D11PixelShader, + 0xea82e40d, 0x51dc, 0x4f33, 0x93, 0xd4, 0xdb, 0x7c, 0x91, 0x25, 0xae, 0x8c} +DEFINE_GUID!{IID_ID3D11ComputeShader, + 0x4f5b196e, 0xc2bd, 0x495e, 0xbd, 0x01, 0x1f, 0xde, 0xd3, 0x8e, 0x49, 0x69} +DEFINE_GUID!{IID_ID3D11InputLayout, + 0xe4819ddc, 0x4cf0, 0x4025, 0xbd, 0x26, 0x5d, 0xe8, 0x2a, 0x3e, 0x07, 0xb7} +DEFINE_GUID!{IID_ID3D11SamplerState, + 0xda6fea51, 0x564c, 0x4487, 0x98, 0x10, 0xf0, 0xd0, 0xf9, 0xb4, 0xe3, 0xa5} +DEFINE_GUID!{IID_ID3D11Asynchronous, + 0x4b35d0cd, 0x1e15, 0x4258, 0x9c, 0x98, 0x1b, 0x13, 0x33, 0xf6, 0xdd, 0x3b} +DEFINE_GUID!{IID_ID3D11Query, + 0xd6c00747, 0x87b7, 0x425e, 0xb8, 0x4d, 0x44, 0xd1, 0x08, 0x56, 0x0a, 0xfd} +DEFINE_GUID!{IID_ID3D11Predicate, + 0x9eb576dd, 0x9f77, 0x4d86, 0x81, 0xaa, 0x8b, 0xab, 0x5f, 0xe4, 0x90, 0xe2} +DEFINE_GUID!{IID_ID3D11Counter, + 0x6e8c49fb, 0xa371, 0x4770, 0xb4, 0x40, 0x29, 0x08, 0x60, 0x22, 0xb7, 0x41} +DEFINE_GUID!{IID_ID3D11ClassInstance, + 0xa6cd7faa, 0xb0b7, 0x4a2f, 0x94, 0x36, 0x86, 0x62, 0xa6, 0x57, 0x97, 0xcb} +DEFINE_GUID!{IID_ID3D11ClassLinkage, + 0xddf57cba, 0x9543, 0x46e4, 0xa1, 0x2b, 0xf2, 0x07, 0xa0, 0xfe, 0x7f, 0xed} +DEFINE_GUID!{IID_ID3D11CommandList, + 0xa24bc4d1, 0x769e, 0x43f7, 0x80, 0x13, 0x98, 0xff, 0x56, 0x6c, 0x18, 0xe2} +DEFINE_GUID!{IID_ID3D11DeviceContext, + 0xc0bfa96c, 0xe089, 0x44fb, 0x8e, 0xaf, 0x26, 0xf8, 0x79, 0x61, 0x90, 0xda} +DEFINE_GUID!{IID_ID3D11VideoDecoder, + 0x3c9c5b51, 0x995d, 0x48d1, 0x9b, 0x8d, 0xfa, 0x5c, 0xae, 0xde, 0xd6, 0x5c} +DEFINE_GUID!{IID_ID3D11VideoProcessorEnumerator, + 0x31627037, 0x53ab, 0x4200, 0x90, 0x61, 0x05, 0xfa, 0xa9, 0xab, 0x45, 0xf9} +DEFINE_GUID!{IID_ID3D11VideoProcessor, + 0x1d7b0652, 0x185f, 0x41c6, 0x85, 0xce, 0x0c, 0x5b, 0xe3, 0xd4, 0xae, 0x6c} +DEFINE_GUID!{IID_ID3D11AuthenticatedChannel, + 0x3015a308, 0xdcbd, 0x47aa, 0xa7, 0x47, 0x19, 0x24, 0x86, 0xd1, 0x4d, 0x4a} +DEFINE_GUID!{IID_ID3D11CryptoSession, + 0x9b32f9ad, 0xbdcc, 0x40a6, 0xa3, 0x9d, 0xd5, 0xc8, 0x65, 0x84, 0x57, 0x20} +DEFINE_GUID!{IID_ID3D11VideoDecoderOutputView, + 0xc2931aea, 0x2a85, 0x4f20, 0x86, 0x0f, 0xfb, 0xa1, 0xfd, 0x25, 0x6e, 0x18} +DEFINE_GUID!{IID_ID3D11VideoProcessorInputView, + 0x11ec5a5f, 0x51dc, 0x4945, 0xab, 0x34, 0x6e, 0x8c, 0x21, 0x30, 0x0e, 0xa5} +DEFINE_GUID!{IID_ID3D11VideoProcessorOutputView, + 0xa048285e, 0x25a9, 0x4527, 0xbd, 0x93, 0xd6, 0x8b, 0x68, 0xc4, 0x42, 0x54} +DEFINE_GUID!{IID_ID3D11VideoContext, + 0x61f21c45, 0x3c0e, 0x4a74, 0x9c, 0xea, 0x67, 0x10, 0x0d, 0x9a, 0xd5, 0xe4} +DEFINE_GUID!{IID_ID3D11VideoDevice, + 0x10ec4d5b, 0x975a, 0x4689, 0xb9, 0xe4, 0xd0, 0xaa, 0xc3, 0x0f, 0xe3, 0x33} +DEFINE_GUID!{IID_ID3D11Device, + 0xdb6f6ddb, 0xac77, 0x4e88, 0x82, 0x53, 0x81, 0x9d, 0xf9, 0xbb, 0xf1, 0x40} diff --git a/src/vendor/winapi/src/um/d3d11_1.rs b/src/vendor/winapi/src/um/d3d11_1.rs new file mode 100644 index 0000000000..58d85df574 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11_1.rs @@ -0,0 +1,24 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3D11BlendState1, + 0xcc86fabe, 0xda55, 0x401d, 0x85, 0xe7, 0xe3, 0xc9, 0xde, 0x28, 0x77, 0xe9} +DEFINE_GUID!{IID_ID3D11RasterizerState1, + 0x1217d7a6, 0x5039, 0x418c, 0xb0, 0x42, 0x9c, 0xbe, 0x25, 0x6a, 0xfd, 0x6e} +DEFINE_GUID!{IID_ID3DDeviceContextState, + 0x5c1e0d8a, 0x7c23, 0x48f9, 0x8c, 0x59, 0xa9, 0x29, 0x58, 0xce, 0xff, 0x11} +DEFINE_GUID!{IID_ID3D11DeviceContext1, + 0xbb2c6faa, 0xb5fb, 0x4082, 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1} +DEFINE_GUID!{IID_ID3D11VideoContext1, + 0xa7f026da, 0xa5f8, 0x4487, 0xa5, 0x64, 0x15, 0xe3, 0x43, 0x57, 0x65, 0x1e} +DEFINE_GUID!{IID_ID3D11VideoDevice1, + 0x29da1d51, 0x1321, 0x4454, 0x80, 0x4b, 0xf5, 0xfc, 0x9f, 0x86, 0x1f, 0x0f} +DEFINE_GUID!{IID_ID3D11VideoProcessorEnumerator1, + 0x465217f2, 0x5568, 0x43cf, 0xb5, 0xb9, 0xf6, 0x1d, 0x54, 0x53, 0x1c, 0xa1} +DEFINE_GUID!{IID_ID3D11Device1, + 0xa04bfb29, 0x08ef, 0x43d6, 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86} +DEFINE_GUID!{IID_ID3DUserDefinedAnnotation, + 0xb2daad8b, 0x03d4, 0x4dbf, 0x95, 0xeb, 0x32, 0xab, 0x4b, 0x63, 0xd0, 0xab} diff --git a/src/vendor/winapi/src/um/d3d11_2.rs b/src/vendor/winapi/src/um/d3d11_2.rs new file mode 100644 index 0000000000..4b9630348d --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11_2.rs @@ -0,0 +1,10 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3D11DeviceContext2, + 0x420d5b32, 0xb90c, 0x4da4, 0xbe, 0xf0, 0x35, 0x9f, 0x6a, 0x24, 0xa8, 0x3a} +DEFINE_GUID!{IID_ID3D11Device2, + 0x9d06dffa, 0xd1e5, 0x4d07, 0x83, 0xa8, 0x1b, 0xb1, 0x23, 0xf2, 0xf8, 0x41} diff --git a/src/vendor/winapi/src/um/d3d11_3.rs b/src/vendor/winapi/src/um/d3d11_3.rs new file mode 100644 index 0000000000..a8c6f33cb8 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11_3.rs @@ -0,0 +1,24 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3D11Texture2D1, + 0x51218251, 0x1e33, 0x4617, 0x9c, 0xcb, 0x4d, 0x3a, 0x43, 0x67, 0xe7, 0xbb} +DEFINE_GUID!{IID_ID3D11Texture3D1, + 0x0c711683, 0x2853, 0x4846, 0x9b, 0xb0, 0xf3, 0xe6, 0x06, 0x39, 0xe4, 0x6a} +DEFINE_GUID!{IID_ID3D11RasterizerState2, + 0x6fbd02fb, 0x209f, 0x46c4, 0xb0, 0x59, 0x2e, 0xd1, 0x55, 0x86, 0xa6, 0xac} +DEFINE_GUID!{IID_ID3D11ShaderResourceView1, + 0x91308b87, 0x9040, 0x411d, 0x8c, 0x67, 0xc3, 0x92, 0x53, 0xce, 0x38, 0x02} +DEFINE_GUID!{IID_ID3D11RenderTargetView1, + 0xffbe2e23, 0xf011, 0x418a, 0xac, 0x56, 0x5c, 0xee, 0xd7, 0xc5, 0xb9, 0x4b} +DEFINE_GUID!{IID_ID3D11UnorderedAccessView1, + 0x7b3b6153, 0xa886, 0x4544, 0xab, 0x37, 0x65, 0x37, 0xc8, 0x50, 0x04, 0x03} +DEFINE_GUID!{IID_ID3D11Query1, + 0x631b4766, 0x36dc, 0x461d, 0x8d, 0xb6, 0xc4, 0x7e, 0x13, 0xe6, 0x09, 0x16} +DEFINE_GUID!{IID_ID3D11DeviceContext3, + 0xb4e3c01d, 0xe79e, 0x4637, 0x91, 0xb2, 0x51, 0x0e, 0x9f, 0x4c, 0x9b, 0x8f} +DEFINE_GUID!{IID_ID3D11Device3, + 0xa05c8c37, 0xd2c6, 0x4732, 0xb3, 0xa0, 0x9c, 0xe0, 0xb0, 0xdc, 0x9a, 0xe6} diff --git a/src/vendor/winapi/src/um/d3d11_4.rs b/src/vendor/winapi/src/um/d3d11_4.rs new file mode 100644 index 0000000000..03f18f89fd --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11_4.rs @@ -0,0 +1,8 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3D11Device4, + 0x8992ab71, 0x02e6, 0x4b8d, 0xba, 0x48, 0xb0, 0x56, 0xdc, 0xda, 0x42, 0xc4} diff --git a/src/vendor/winapi/src/um/d3d11on12.rs b/src/vendor/winapi/src/um/d3d11on12.rs new file mode 100644 index 0000000000..5ed7070c4b --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11on12.rs @@ -0,0 +1,68 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the content of d3d11on12.h +use ctypes::c_void; +use shared::guiddef::IID; +use shared::minwindef::UINT; +use um::d3d11::{ID3D11Device, ID3D11DeviceContext, ID3D11Resource}; +use um::d3d12::D3D12_RESOURCE_STATES; +use um::d3dcommon::D3D_FEATURE_LEVEL; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::HRESULT; +FN!{stdcall PFN_D3D11ON12_CREATE_DEVICE( + *mut IUnknown, + UINT, + *const D3D_FEATURE_LEVEL, + UINT, + *mut *mut IUnknown, + UINT, + UINT, + *mut *mut ID3D11Device, + *mut *mut ID3D11DeviceContext, + *mut D3D_FEATURE_LEVEL, +) -> HRESULT} +extern "system" { + pub fn D3D11On12CreateDevice( + pDevice: *mut IUnknown, + Flags: UINT, + pFeatureLevels: *const D3D_FEATURE_LEVEL, + FeatureLevels: UINT, + ppCommandQueues: *mut *mut IUnknown, + NumQueues: UINT, + NodeMask: UINT, + ppDevice: *mut *mut ID3D11Device, + ppImmediateContext: *mut *mut ID3D11DeviceContext, + pChosenFeatureLevel: *mut D3D_FEATURE_LEVEL + ) -> HRESULT; +} +STRUCT!{struct D3D11_RESOURCE_FLAGS { + BindFlags: UINT, + MiscFlags: UINT, + CPUAccessFlags: UINT, + StructureByteStride: UINT, +}} +RIDL!{#[uuid(0x85611e73, 0x70a9, 0x490e, 0x96, 0x14, 0xa9, 0xe3, 0x02, 0x77, 0x79, 0x04)] +interface ID3D11On12Device(ID3D11On12DeviceVtbl): IUnknown(IUnknownVtbl) { + fn CreateWrappedResource( + pResource12: *mut IUnknown, + pFlags11: *const D3D11_RESOURCE_FLAGS, + InState: D3D12_RESOURCE_STATES, + OutState: D3D12_RESOURCE_STATES, + riid: *const IID, + ppResource11: *mut *mut c_void, + ) -> HRESULT, + fn ReleaseWrappedResources( + ppResources: *mut *mut ID3D11Resource, + NumResources: UINT, + ) -> (), + fn AcquireWrappedResources( + ppResources: *mut *mut ID3D11Resource, + NumResources: UINT, + ) -> (), +}} +DEFINE_GUID!{IID_ID3D11On12Device, + 0x85611e73, 0x70a9, 0x490e, 0x96, 0x14, 0xa9, 0xe3, 0x02, 0x77, 0x79, 0x04} diff --git a/src/vendor/winapi/src/um/d3d11sdklayers.rs b/src/vendor/winapi/src/um/d3d11sdklayers.rs new file mode 100644 index 0000000000..c3ec919aa8 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11sdklayers.rs @@ -0,0 +1,20 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{DXGI_DEBUG_D3D11, + 0x4b99317b, 0xac39, 0x4aa6, 0xbb, 0x0b, 0xba, 0xa0, 0x47, 0x84, 0x79, 0x8f} +DEFINE_GUID!{IID_ID3D11Debug, + 0x79cf2233, 0x7536, 0x4948, 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60} +DEFINE_GUID!{IID_ID3D11SwitchToRef, + 0x1ef337e3, 0x58e7, 0x4f83, 0xa6, 0x92, 0xdb, 0x22, 0x1f, 0x5e, 0xd4, 0x7e} +DEFINE_GUID!{IID_ID3D11TracingDevice, + 0x1911c771, 0x1587, 0x413e, 0xa7, 0xe0, 0xfb, 0x26, 0xc3, 0xde, 0x02, 0x68} +DEFINE_GUID!{IID_ID3D11RefTrackingOptions, + 0x193dacdf, 0x0db2, 0x4c05, 0xa5, 0x5c, 0xef, 0x06, 0xca, 0xc5, 0x6f, 0xd9} +DEFINE_GUID!{IID_ID3D11RefDefaultTrackingOptions, + 0x03916615, 0xc644, 0x418c, 0x9b, 0xf4, 0x75, 0xdb, 0x5b, 0xe6, 0x3c, 0xa0} +DEFINE_GUID!{IID_ID3D11InfoQueue, + 0x6543dbb6, 0x1b48, 0x42f5, 0xab, 0x82, 0xe9, 0x7e, 0xc7, 0x43, 0x26, 0xf6} diff --git a/src/vendor/winapi/src/um/d3d11shader.rs b/src/vendor/winapi/src/um/d3d11shader.rs new file mode 100644 index 0000000000..63062b33b8 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d11shader.rs @@ -0,0 +1,478 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_int; +use shared::basetsd::UINT64; +use shared::minwindef::{BOOL, BYTE, INT, LPVOID, UINT}; +use um::d3dcommon::{ + D3D_CBUFFER_TYPE, D3D_FEATURE_LEVEL, D3D_INTERPOLATION_MODE, D3D_MIN_PRECISION, D3D_NAME, + D3D_PARAMETER_FLAGS, D3D_PRIMITIVE, D3D_PRIMITIVE_TOPOLOGY, D3D_REGISTER_COMPONENT_TYPE, + D3D_RESOURCE_RETURN_TYPE, D3D_SHADER_INPUT_TYPE, D3D_SHADER_VARIABLE_CLASS, + D3D_SHADER_VARIABLE_TYPE, D3D_SRV_DIMENSION, D3D_TESSELLATOR_DOMAIN, + D3D_TESSELLATOR_OUTPUT_PRIMITIVE, D3D_TESSELLATOR_PARTITIONING, ID3DBlob, +}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCSTR}; +ENUM!{enum D3D11_SHADER_VERSION_TYPE { + D3D11_SHVER_PIXEL_SHADER = 0, + D3D11_SHVER_VERTEX_SHADER = 1, + D3D11_SHVER_GEOMETRY_SHADER = 2, + D3D11_SHVER_HULL_SHADER = 3, + D3D11_SHVER_DOMAIN_SHADER = 4, + D3D11_SHVER_COMPUTE_SHADER = 5, + D3D11_SHVER_RESERVED0 = 0xFFF0, +}} +pub const D3D_RETURN_PARAMETER_INDEX: c_int = -1; +pub type D3D11_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; +pub type D3D11_CBUFFER_TYPE = D3D_CBUFFER_TYPE; +STRUCT!{struct D3D11_SIGNATURE_PARAMETER_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Register: UINT, + SystemValueType: D3D_NAME, + ComponentType: D3D_REGISTER_COMPONENT_TYPE, + Mask: BYTE, + ReadWriteMask: BYTE, + Stream: UINT, + MinPrecision: D3D_MIN_PRECISION, +}} +STRUCT!{struct D3D11_SHADER_BUFFER_DESC { + Name: LPCSTR, + Type: D3D_CBUFFER_TYPE, + Variables: UINT, + Size: UINT, + uFlags: UINT, +}} +STRUCT!{struct D3D11_SHADER_VARIABLE_DESC { + Name: LPCSTR, + StartOffset: UINT, + Size: UINT, + uFlags: UINT, + DefaultValue: LPVOID, + StartTexture: UINT, + TextureSize: UINT, + StartSampler: UINT, + SamplerSize: UINT, +}} +STRUCT!{struct D3D11_SHADER_TYPE_DESC { + Class: D3D_SHADER_VARIABLE_CLASS, + Type: D3D_SHADER_VARIABLE_TYPE, + Rows: UINT, + Columns: UINT, + Elements: UINT, + Members: UINT, + Offset: UINT, + Name: LPCSTR, +}} +pub type D3D11_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN; +pub type D3D11_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING; +pub type D3D11_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE; +STRUCT!{struct D3D11_SHADER_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InputParameters: UINT, + OutputParameters: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + CutInstructionCount: UINT, + EmitInstructionCount: UINT, + GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, + GSMaxOutputVertexCount: UINT, + InputPrimitive: D3D_PRIMITIVE, + PatchConstantParameters: UINT, + cGSInstanceCount: UINT, + cControlPoints: UINT, + HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE, + HSPartitioning: D3D_TESSELLATOR_PARTITIONING, + TessellatorDomain: D3D_TESSELLATOR_DOMAIN, + cBarrierInstructions: UINT, + cInterlockedInstructions: UINT, + cTextureStoreInstructions: UINT, +}} +STRUCT!{struct D3D11_SHADER_INPUT_BIND_DESC { + Name: LPCSTR, + Type: D3D_SHADER_INPUT_TYPE, + BindPoint: UINT, + BindCount: UINT, + uFlags: UINT, + ReturnType: D3D_RESOURCE_RETURN_TYPE, + Dimension: D3D_SRV_DIMENSION, + NumSamples: UINT, +}} +pub const D3D_SHADER_REQUIRES_DOUBLES: UINT64 = 0x00000001; +pub const D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL: UINT64 = 0x00000002; +pub const D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE: UINT64 = 0x00000004; +pub const D3D_SHADER_REQUIRES_64_UAVS: UINT64 = 0x00000008; +pub const D3D_SHADER_REQUIRES_MINIMUM_PRECISION: UINT64 = 0x00000010; +pub const D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS: UINT64 = 0x00000020; +pub const D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS: UINT64 = 0x00000040; +pub const D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING: UINT64 = 0x00000080; +pub const D3D_SHADER_REQUIRES_TILED_RESOURCES: UINT64 = 0x00000100; +STRUCT!{struct D3D11_LIBRARY_DESC { + Creator: LPCSTR, + Flags: UINT, + FunctionCount: UINT, +}} +STRUCT!{struct D3D11_FUNCTION_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + MovInstructionCount: UINT, + MovcInstructionCount: UINT, + ConversionInstructionCount: UINT, + BitwiseInstructionCount: UINT, + MinFeatureLevel: D3D_FEATURE_LEVEL, + RequiredFeatureFlags: UINT64, + Name: LPCSTR, + FunctionParameterCount: INT, + HasReturn: BOOL, + Has10Level9VertexShader: BOOL, + Has10Level9PixelShader: BOOL, +}} +STRUCT!{struct D3D11_PARAMETER_DESC { + Name: LPCSTR, + SemanticName: LPCSTR, + Type: D3D_SHADER_VARIABLE_TYPE, + Class: D3D_SHADER_VARIABLE_CLASS, + Rows: UINT, + Columns: UINT, + InterpolationMode: D3D_INTERPOLATION_MODE, + Flags: D3D_PARAMETER_FLAGS, + FirstInRegister: UINT, + FirstInComponent: UINT, + FirstOutRegister: UINT, + FirstOutComponent: UINT, +}} +DEFINE_GUID!{IID_ID3D11ShaderReflectionType, + 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21} +RIDL!{#[uuid(0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21)] +interface ID3D11ShaderReflectionType(ID3D11ShaderReflectionTypeVtbl) { + fn GetDesc( + pDesc: *mut D3D11_SHADER_TYPE_DESC, + ) -> HRESULT, + fn GetMemberTypeByIndex( + Index: UINT, + ) -> *mut ID3D11ShaderReflectionType, + fn GetMemberTypeByName( + Name: LPCSTR, + ) -> *mut ID3D11ShaderReflectionType, + fn GetMemberTypeName( + Index: UINT, + ) -> LPCSTR, + fn IsEqual( + pType: *mut ID3D11ShaderReflectionType, + ) -> HRESULT, + fn GetSubType() -> *mut ID3D11ShaderReflectionType, + fn GetBaseClass() -> *mut ID3D11ShaderReflectionType, + fn GetNumInterfaces() -> UINT, + fn GetInterfaceByIndex( + uIndex: UINT, + ) -> *mut ID3D11ShaderReflectionType, + fn IsOfType( + pType: *mut ID3D11ShaderReflectionType, + ) -> HRESULT, + fn ImplementsInterface( + pBase: *mut ID3D11ShaderReflectionType, + ) -> HRESULT, +}} +DEFINE_GUID!{IID_ID3D11ShaderReflectionVariable, + 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c} +RIDL!{#[uuid(0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c)] +interface ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariableVtbl) { + fn GetDesc( + pDesc: *mut D3D11_SHADER_VARIABLE_DESC, + ) -> HRESULT, + fn GetType() -> *mut ID3D11ShaderReflectionType, + fn GetBuffer() -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetInterfaceSlot( + uArrayIndex: UINT, + ) -> UINT, +}} +DEFINE_GUID!{IID_ID3D11ShaderReflectionConstantBuffer, + 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8} +RIDL!{#[uuid(0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8)] +interface ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBufferVtbl) { + fn GetDesc( + pDesc: *mut D3D11_SHADER_BUFFER_DESC, + ) -> HRESULT, + fn GetVariableByIndex( + Index: UINT, + ) -> *mut ID3D11ShaderReflectionVariable, + fn GetVariableByName( + Name: LPCSTR, + ) -> *mut ID3D11ShaderReflectionVariable, +}} +DEFINE_GUID!{IID_ID3D11ShaderReflection, + 0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84} +RIDL!{#[uuid(0x8d536ca1, 0x0cca, 0x4956, 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84)] +interface ID3D11ShaderReflection(ID3D11ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc( + pDesc: *mut D3D11_SHADER_DESC, + ) -> HRESULT, + fn GetConstantBufferByIndex( + Index: UINT, + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + Name: LPCSTR, + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + ResourceIndex: UINT, + pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetInputParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, + fn GetOutputParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, + fn GetPatchConstantParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, + fn GetVariableByName( + Name: LPCSTR, + ) -> *mut ID3D11ShaderReflectionVariable, + fn GetResourceBindingDescByName( + Name: LPCSTR, + pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetMovInstructionCount() -> UINT, + fn GetMovcInstructionCount() -> UINT, + fn GetConversionInstructionCount() -> UINT, + fn GetBitwiseInstructionCount() -> UINT, + fn GetGSInputPrimitive() -> D3D_PRIMITIVE, + fn IsSampleFrequencyShader() -> BOOL, + fn GetNumInterfaceSlots() -> UINT, + fn GetMinFeatureLevel( + pLevel: *mut D3D_FEATURE_LEVEL, + ) -> HRESULT, + fn GetThreadGroupSize( + pSizeX: *mut UINT, + pSizeY: *mut UINT, + pSizeZ: *mut UINT, + ) -> UINT, + fn GetRequiresFlags() -> UINT64, +}} +DEFINE_GUID!{IID_ID3D11LibraryReflection, + 0x54384f1b, 0x5b3e, 0x4bb7, 0xae, 0x01, 0x60, 0xba, 0x30, 0x97, 0xcb, 0xb6} +RIDL!{#[uuid(0x54384f1b, 0x5b3e, 0x4bb7, 0xae, 0x01, 0x60, 0xba, 0x30, 0x97, 0xcb, 0xb6)] +interface ID3D11LibraryReflection(ID3D11LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc( + pDesc: *mut D3D11_LIBRARY_DESC, + ) -> HRESULT, + fn GetFunctionByIndex( + FunctionIndex: INT, + ) -> *mut ID3D11FunctionReflection, +}} +DEFINE_GUID!{IID_ID3D11FunctionReflection, + 0x207bcecb, 0xd683, 0x4a06, 0xa8, 0xa3, 0x9b, 0x14, 0x9b, 0x9f, 0x73, 0xa4} +RIDL!{#[uuid(0x207bcecb, 0xd683, 0x4a06, 0xa8, 0xa3, 0x9b, 0x14, 0x9b, 0x9f, 0x73, 0xa4)] +interface ID3D11FunctionReflection(ID3D11FunctionReflectionVtbl) { + fn GetDesc( + pDesc: *mut D3D11_FUNCTION_DESC, + ) -> HRESULT, + fn GetConstantBufferByIndex( + BufferIndex: UINT, + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + Name: LPCSTR, + ) -> *mut ID3D11ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + ResourceIndex: UINT, + pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetVariableByName( + Name: LPCSTR, + ) -> *mut ID3D11ShaderReflectionVariable, + fn GetResourceBindingDescByName( + Name: LPCSTR, + pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetFunctionParameter( + ParameterIndex: INT, + ) -> *mut ID3D11FunctionParameterReflection, +}} +DEFINE_GUID!{IID_ID3D11FunctionParameterReflection, + 0x42757488, 0x334f, 0x47fe, 0x98, 0x2e, 0x1a, 0x65, 0xd0, 0x8c, 0xc4, 0x62} +RIDL!{#[uuid(0x42757488, 0x334f, 0x47fe, 0x98, 0x2e, 0x1a, 0x65, 0xd0, 0x8c, 0xc4, 0x62)] +interface ID3D11FunctionParameterReflection(ID3D11FunctionParameterReflectionVtbl) { + fn GetDesc( + pDesc: *mut D3D11_PARAMETER_DESC, + ) -> HRESULT, +}} +DEFINE_GUID!{IID_ID3D11Module, + 0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34} +RIDL!{#[uuid(0xcac701ee, 0x80fc, 0x4122, 0x82, 0x42, 0x10, 0xb3, 0x9c, 0x8c, 0xec, 0x34)] +interface ID3D11Module(ID3D11ModuleVtbl): IUnknown(IUnknownVtbl) { + fn CreateInstance( + pNamespace: LPCSTR, + ppModuleInstance: *mut *mut ID3D11ModuleInstance, + ) -> HRESULT, +}} +DEFINE_GUID!{IID_ID3D11ModuleInstance, + 0x469e07f7, 0x045a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d} +RIDL!{#[uuid(0x469e07f7, 0x045a, 0x48d5, 0xaa, 0x12, 0x68, 0xa4, 0x78, 0xcd, 0xf7, 0x5d)] +interface ID3D11ModuleInstance(ID3D11ModuleInstanceVtbl): IUnknown(IUnknownVtbl) { + fn BindConstantBuffer( + uSrcSlot: UINT, + uDstSlot: UINT, + cbDstOffset: UINT, + ) -> HRESULT, + fn BindConstantBufferByName( + pName: LPCSTR, + uDstSlot: UINT, + cbDstOffset: UINT, + ) -> HRESULT, + fn BindResource( + uSrcSlot: UINT, + uDstSlot: UINT, + uCount: UINT, + ) -> HRESULT, + fn BindResourceByName( + pName: LPCSTR, + uDstSlot: UINT, + uCount: UINT, + ) -> HRESULT, + fn BindSampler( + uSrcSlot: UINT, + uDstSlot: UINT, + uCount: UINT, + ) -> HRESULT, + fn BindSamplerByName( + pName: LPCSTR, + uDstSlot: UINT, + uCount: UINT, + ) -> HRESULT, + fn BindUnorderedAccessView( + uSrcSlot: UINT, + uDstSlot: UINT, + uCount: UINT, + ) -> HRESULT, + fn BindUnorderedAccessViewByName( + pName: LPCSTR, + uDstSlot: UINT, + uCount: UINT, + ) -> HRESULT, + fn BindResourceAsUnorderedAccessView( + uSrcSrvSlot: UINT, + uDstUavSlot: UINT, + uCount: UINT, + ) -> HRESULT, + fn BindResourceAsUnorderedAccessViewByName( + pSrvName: LPCSTR, + uDstUavSlot: UINT, + uCount: UINT, + ) -> HRESULT, +}} +DEFINE_GUID!{IID_ID3D11Linker, + 0x59a6cd0e, 0xe10d, 0x4c1f, 0x88, 0xc0, 0x63, 0xab, 0xa1, 0xda, 0xf3, 0x0e} +RIDL!{#[uuid(0x59a6cd0e, 0xe10d, 0x4c1f, 0x88, 0xc0, 0x63, 0xab, 0xa1, 0xda, 0xf3, 0x0e)] +interface ID3D11Linker(ID3D11LinkerVtbl): IUnknown(IUnknownVtbl) { + fn Link( + pEntry: *mut ID3D11ModuleInstance, + pEntryName: LPCSTR, + pTargetName: LPCSTR, + uFlags: UINT, + ppShaderBlob: *mut *mut ID3DBlob, + ppErrorBuffer: *mut *mut ID3DBlob, + ) -> HRESULT, + fn UseLibrary( + pLibraryMI: *mut ID3D11ModuleInstance, + ) -> HRESULT, + fn AddClipPlaneFromCBuffer( + uCBufferSlot: UINT, + uCBufferEntry: UINT, + ) -> HRESULT, +}} +DEFINE_GUID!{IID_ID3D11LinkingNode, + 0xd80dd70c, 0x8d2f, 0x4751, 0x94, 0xa1, 0x03, 0xc7, 0x9b, 0x35, 0x56, 0xdb} +RIDL!{#[uuid(0xd80dd70c, 0x8d2f, 0x4751, 0x94, 0xa1, 0x03, 0xc7, 0x9b, 0x35, 0x56, 0xdb)] +interface ID3D11LinkingNode(ID3D11LinkingNodeVtbl): IUnknown(IUnknownVtbl) {}} +DEFINE_GUID!{IID_ID3D11FunctionLinkingGraph, + 0x54133220, 0x1ce8, 0x43d3, 0x82, 0x36, 0x98, 0x55, 0xc5, 0xce, 0xec, 0xff} +RIDL!{#[uuid(0x54133220, 0x1ce8, 0x43d3, 0x82, 0x36, 0x98, 0x55, 0xc5, 0xce, 0xec, 0xff)] +interface ID3D11FunctionLinkingGraph(ID3D11FunctionLinkingGraphVtbl): IUnknown(IUnknownVtbl) { + fn CreateModuleInstance( + ppModuleInstance: *mut *mut ID3D11ModuleInstance, + ppErrorBuffer: *mut *mut ID3DBlob, + ) -> HRESULT, + fn SetInputSignature( + pInputParameters: *const D3D11_PARAMETER_DESC, + cInputParameters: UINT, + ppInputNode: *mut *mut ID3D11LinkingNode, + ) -> HRESULT, + fn SetOutputSignature( + pOutputParameters: *const D3D11_PARAMETER_DESC, + cOutputParameters: UINT, + ppOutputNode: *mut *mut ID3D11LinkingNode, + ) -> HRESULT, + fn CallFunction( + pModuleInstanceNamespace: LPCSTR, + pModuleWithFunctionPrototype: *mut ID3D11Module, + pFunctionName: LPCSTR, + ppCallNode: *mut *mut ID3D11LinkingNode, + ) -> HRESULT, + fn PassValue( + pSrcNode: *mut ID3D11LinkingNode, + SrcParameterIndex: INT, + pDstNode: *mut ID3D11LinkingNode, + DstParameterIndex: INT, + ) -> HRESULT, + fn PassValueWithSwizzle( + pSrcNode: *mut ID3D11LinkingNode, + SrcParameterIndex: INT, + pSrcSwizzle: LPCSTR, + pDstNode: *mut ID3D11LinkingNode, + DstParameterIndex: INT, + pDstSwizzle: LPCSTR, + ) -> HRESULT, + fn GetLastError( + ppErrorBuffer: *mut *mut ID3DBlob, + ) -> HRESULT, + fn GenerateHlsl( + uFlags: UINT, + ppBuffer: *mut *mut ID3DBlob, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/d3d12.rs b/src/vendor/winapi/src/um/d3d12.rs new file mode 100644 index 0000000000..2a41c9e1fd --- /dev/null +++ b/src/vendor/winapi/src/um/d3d12.rs @@ -0,0 +1,2721 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_void; +use shared::basetsd::{INT8, LONG_PTR, SIZE_T, UINT16, UINT64, UINT8}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::dxgitype::DXGI_SAMPLE_DESC; +use shared::guiddef::{IID, REFGUID, REFIID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, INT, LPCVOID, UINT}; +use shared::windef::RECT; +use um::d3dcommon::{D3D_FEATURE_LEVEL, D3D_PRIMITIVE, D3D_PRIMITIVE_TOPOLOGY, ID3DBlob}; +use um::minwinbase::SECURITY_ATTRIBUTES; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, LPCSTR, LPCWSTR, LUID}; +pub const D3D12_16BIT_INDEX_STRIP_CUT_VALUE: UINT = 0xffff; +pub const D3D12_32BIT_INDEX_STRIP_CUT_VALUE: UINT = 0xffffffff; +pub const D3D12_8BIT_INDEX_STRIP_CUT_VALUE: UINT = 0xff; +pub const D3D12_APPEND_ALIGNED_ELEMENT: UINT = 0xffffffff; +pub const D3D12_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT: UINT = 9; +pub const D3D12_CLIP_OR_CULL_DISTANCE_COUNT: UINT = 8; +pub const D3D12_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT: UINT = 2; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT: UINT = 14; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS: UINT = 4; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT: UINT = 15; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT: UINT = 16; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT: UINT = 15; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST: UINT = 1; +pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT: UINT = 64; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT: UINT = 1; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST: UINT = 1; +pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT: UINT = 128; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST: UINT = 1; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT: UINT = 128; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_COUNT: UINT = 16; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST: UINT = 1; +pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_COMMONSHADER_SAMPLER_SLOT_COUNT: UINT = 16; +pub const D3D12_COMMONSHADER_SUBROUTINE_NESTING_LIMIT: UINT = 32; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_COUNT: UINT = 4096; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_READS_PER_INST: UINT = 3; +pub const D3D12_COMMONSHADER_TEMP_REGISTER_READ_PORTS: UINT = 3; +pub const D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX: INT = 10; +pub const D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN: INT = -10; +pub const D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE: INT = -8; +pub const D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE: INT = 7; +pub const D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT: UINT = 256; +pub const D3D12_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 256; +pub const D3D12_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP: UINT = 64; +pub const D3D12_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 240; +pub const D3D12_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP: UINT = 68; +pub const D3D12_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 224; +pub const D3D12_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP: UINT = 72; +pub const D3D12_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 208; +pub const D3D12_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP: UINT = 76; +pub const D3D12_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 192; +pub const D3D12_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP: UINT = 84; +pub const D3D12_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 176; +pub const D3D12_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP: UINT = 92; +pub const D3D12_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 160; +pub const D3D12_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP: UINT = 100; +pub const D3D12_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 144; +pub const D3D12_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP: UINT = 112; +pub const D3D12_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 128; +pub const D3D12_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP: UINT = 128; +pub const D3D12_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 112; +pub const D3D12_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP: UINT = 144; +pub const D3D12_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 96; +pub const D3D12_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP: UINT = 168; +pub const D3D12_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 80; +pub const D3D12_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP: UINT = 204; +pub const D3D12_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 64; +pub const D3D12_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP: UINT = 256; +pub const D3D12_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 48; +pub const D3D12_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP: UINT = 340; +pub const D3D12_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 32; +pub const D3D12_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP: UINT = 512; +pub const D3D12_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: UINT = 16; +pub const D3D12_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP: UINT = 768; +pub const D3D12_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION: UINT = 1; +pub const D3D12_CS_4_X_RAW_UAV_BYTE_ALIGNMENT: UINT = 256; +pub const D3D12_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP: UINT = 768; +pub const D3D12_CS_4_X_THREAD_GROUP_MAX_X: UINT = 768; +pub const D3D12_CS_4_X_THREAD_GROUP_MAX_Y: UINT = 768; +pub const D3D12_CS_4_X_UAV_REGISTER_COUNT: UINT = 1; +pub const D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION: UINT = 65535; +pub const D3D12_CS_TGSM_REGISTER_COUNT: UINT = 8192; +pub const D3D12_CS_TGSM_REGISTER_READS_PER_INST: UINT = 1; +pub const D3D12_CS_TGSM_RESOURCE_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_CS_TGSM_RESOURCE_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_CS_THREADGROUPID_REGISTER_COMPONENTS: UINT = 3; +pub const D3D12_CS_THREADGROUPID_REGISTER_COUNT: UINT = 1; +pub const D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT: UINT = 1; +pub const D3D12_CS_THREADIDINGROUP_REGISTER_COMPONENTS: UINT = 3; +pub const D3D12_CS_THREADIDINGROUP_REGISTER_COUNT: UINT = 1; +pub const D3D12_CS_THREADID_REGISTER_COMPONENTS: UINT = 3; +pub const D3D12_CS_THREADID_REGISTER_COUNT: UINT = 1; +pub const D3D12_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP: UINT = 1024; +pub const D3D12_CS_THREAD_GROUP_MAX_X: UINT = 1024; +pub const D3D12_CS_THREAD_GROUP_MAX_Y: UINT = 1024; +pub const D3D12_CS_THREAD_GROUP_MAX_Z: UINT = 64; +pub const D3D12_CS_THREAD_GROUP_MIN_X: UINT = 1; +pub const D3D12_CS_THREAD_GROUP_MIN_Y: UINT = 1; +pub const D3D12_CS_THREAD_GROUP_MIN_Z: UINT = 1; +pub const D3D12_CS_THREAD_LOCAL_TEMP_REGISTER_POOL: UINT = 16384; +pub const D3D12_DEFAULT_BLEND_FACTOR_ALPHA: FLOAT = 1.0; +pub const D3D12_DEFAULT_BLEND_FACTOR_BLUE: FLOAT = 1.0; +pub const D3D12_DEFAULT_BLEND_FACTOR_GREEN: FLOAT = 1.0; +pub const D3D12_DEFAULT_BLEND_FACTOR_RED: FLOAT = 1.0; +pub const D3D12_DEFAULT_BORDER_COLOR_COMPONENT: FLOAT = 0.0; +pub const D3D12_DEFAULT_DEPTH_BIAS: UINT = 0; +pub const D3D12_DEFAULT_DEPTH_BIAS_CLAMP: FLOAT = 0.0; +pub const D3D12_DEFAULT_MAX_ANISOTROPY: UINT = 16; +pub const D3D12_DEFAULT_MIP_LOD_BIAS: FLOAT = 0.0; +pub const D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT: UINT = 4194304; +pub const D3D12_DEFAULT_RENDER_TARGET_ARRAY_INDEX: UINT = 0; +pub const D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT: UINT = 65536; +pub const D3D12_DEFAULT_SAMPLE_MASK: UINT = 0xffffffff; +pub const D3D12_DEFAULT_SCISSOR_ENDX: UINT = 0; +pub const D3D12_DEFAULT_SCISSOR_ENDY: UINT = 0; +pub const D3D12_DEFAULT_SCISSOR_STARTX: UINT = 0; +pub const D3D12_DEFAULT_SCISSOR_STARTY: UINT = 0; +pub const D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS: FLOAT = 0.0; +pub const D3D12_DEFAULT_STENCIL_READ_MASK: UINT = 0xff; +pub const D3D12_DEFAULT_STENCIL_REFERENCE: UINT = 0; +pub const D3D12_DEFAULT_STENCIL_WRITE_MASK: UINT = 0xff; +pub const D3D12_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX: UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_HEIGHT: UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_MAX_DEPTH: FLOAT = 0.0; +pub const D3D12_DEFAULT_VIEWPORT_MIN_DEPTH: FLOAT = 0.0; +pub const D3D12_DEFAULT_VIEWPORT_TOPLEFTX: UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_TOPLEFTY: UINT = 0; +pub const D3D12_DEFAULT_VIEWPORT_WIDTH: UINT = 0; +pub const D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND: UINT = 0xffffffff; +pub const D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_END: UINT = 0xfffffff7; +pub const D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_START: UINT = 0xfffffff0; +pub const D3D12_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: UINT = 3968; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COUNT: UINT = 32; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS: UINT = 3; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT: UINT = 1; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT: UINT = 32; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: UINT = 1; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_DS_OUTPUT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_DS_OUTPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_FLOAT16_FUSED_TOLERANCE_IN_ULP: FLOAT = 0.6; +pub const D3D12_FLOAT32_MAX: FLOAT = 3.402823466e+38; +pub const D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP: FLOAT = 0.6; +pub const D3D12_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR: FLOAT = 2.4; +pub const D3D12_FLOAT_TO_SRGB_EXPONENT_NUMERATOR: FLOAT = 1.0; +pub const D3D12_FLOAT_TO_SRGB_OFFSET: FLOAT = 0.055; +pub const D3D12_FLOAT_TO_SRGB_SCALE_1: FLOAT = 12.92; +pub const D3D12_FLOAT_TO_SRGB_SCALE_2: FLOAT = 1.055; +pub const D3D12_FLOAT_TO_SRGB_THRESHOLD: FLOAT = 0.0031308; +pub const D3D12_FTOI_INSTRUCTION_MAX_INPUT: FLOAT = 2147483647.999; +pub const D3D12_FTOI_INSTRUCTION_MIN_INPUT: FLOAT = -2147483648.999; +pub const D3D12_FTOU_INSTRUCTION_MAX_INPUT: FLOAT = 4294967295.999; +pub const D3D12_FTOU_INSTRUCTION_MIN_INPUT: FLOAT = 0.0; +pub const D3D12_GS_INPUT_INSTANCE_ID_READS_PER_INST: UINT = 2; +pub const D3D12_GS_INPUT_INSTANCE_ID_READ_PORTS: UINT = 1; +pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COUNT: UINT = 1; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COUNT: UINT = 1; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_GS_INPUT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_GS_INPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_GS_INPUT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_GS_INPUT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_GS_INPUT_REGISTER_VERTICES: UINT = 32; +pub const D3D12_GS_MAX_INSTANCE_COUNT: UINT = 32; +pub const D3D12_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES: UINT = 1024; +pub const D3D12_GS_OUTPUT_ELEMENTS: UINT = 32; +pub const D3D12_GS_OUTPUT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_GS_OUTPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_HS_CONTROL_POINT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_HS_CONTROL_POINT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_HS_CONTROL_POINT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND: UINT = 0xffffffff; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT: UINT = 1; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT: UINT = 1; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: UINT = 1; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND: UINT = 0xffffffff; +pub const D3D12_HS_MAXTESSFACTOR_LOWER_BOUND: FLOAT = 1.0; +pub const D3D12_HS_MAXTESSFACTOR_UPPER_BOUND: FLOAT = 64.0; +pub const D3D12_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: UINT = 3968; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT: UINT = 1; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT: UINT = 32; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS: UINT = 128; +pub const D3D12_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES: UINT = 0; +pub const D3D12_IA_DEFAULT_PRIMITIVE_TOPOLOGY: UINT = 0; +pub const D3D12_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES: UINT = 0; +pub const D3D12_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT: UINT = 1; +pub const D3D12_IA_INSTANCE_ID_BIT_COUNT: UINT = 32; +pub const D3D12_IA_INTEGER_ARITHMETIC_BIT_COUNT: UINT = 32; +pub const D3D12_IA_PATCH_MAX_CONTROL_POINT_COUNT: UINT = 32; +pub const D3D12_IA_PRIMITIVE_ID_BIT_COUNT: UINT = 32; +pub const D3D12_IA_VERTEX_ID_BIT_COUNT: UINT = 32; +pub const D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT: UINT = 32; +pub const D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS: UINT = 128; +pub const D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT: UINT = 32; +pub const D3D12_INTEGER_DIVIDE_BY_ZERO_QUOTIENT: UINT = 0xffffffff; +pub const D3D12_INTEGER_DIVIDE_BY_ZERO_REMAINDER: UINT = 0xffffffff; +pub const D3D12_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL: UINT = 0xffffffff; +pub const D3D12_KEEP_UNORDERED_ACCESS_VIEWS: UINT = 0xffffffff; +pub const D3D12_LINEAR_GAMMA: FLOAT = 1.0; +pub const D3D12_MAJOR_VERSION: UINT = 12; +pub const D3D12_MAX_BORDER_COLOR_COMPONENT: FLOAT = 1.0; +pub const D3D12_MAX_DEPTH: FLOAT = 1.0; +pub const D3D12_MAX_LIVE_STATIC_SAMPLERS: UINT = 2032; +pub const D3D12_MAX_MAXANISOTROPY: UINT = 16; +pub const D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT: UINT = 32; +pub const D3D12_MAX_POSITION_VALUE: FLOAT = 3.402823466e+34; +pub const D3D12_MAX_ROOT_COST: UINT = 64; +pub const D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1: UINT = 1000000; +pub const D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2: UINT = 1000000; +pub const D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE: UINT = 2048; +pub const D3D12_MAX_TEXTURE_DIMENSION_2_TO_EXP: UINT = 17; +pub const D3D12_MINOR_VERSION: UINT = 0; +pub const D3D12_MIN_BORDER_COLOR_COMPONENT: FLOAT = 0.0; +pub const D3D12_MIN_DEPTH: FLOAT = 0.0; +pub const D3D12_MIN_MAXANISOTROPY: UINT = 0; +pub const D3D12_MIP_LOD_BIAS_MAX: FLOAT = 15.99; +pub const D3D12_MIP_LOD_BIAS_MIN: FLOAT = -16.0; +pub const D3D12_MIP_LOD_FRACTIONAL_BIT_COUNT: UINT = 8; +pub const D3D12_MIP_LOD_RANGE_BIT_COUNT: UINT = 8; +pub const D3D12_MULTISAMPLE_ANTIALIAS_LINE_WIDTH: FLOAT = 1.4; +pub const D3D12_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT: UINT = 0; +pub const D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_END: UINT = 0xffffffff; +pub const D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_START: UINT = 0xfffffff8; +pub const D3D12_PACKED_TILE: UINT = 0xffffffff; +pub const D3D12_PIXEL_ADDRESS_RANGE_BIT_COUNT: UINT = 15; +pub const D3D12_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT: UINT = 16; +pub const D3D12_PS_CS_UAV_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_PS_CS_UAV_REGISTER_COUNT: UINT = 8; +pub const D3D12_PS_CS_UAV_REGISTER_READS_PER_INST: UINT = 1; +pub const D3D12_PS_CS_UAV_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_PS_FRONTFACING_DEFAULT_VALUE: UINT = 0xffffffff; +pub const D3D12_PS_FRONTFACING_FALSE_VALUE: UINT = 0; +pub const D3D12_PS_FRONTFACING_TRUE_VALUE: UINT = 0xffffffff; +pub const D3D12_PS_INPUT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_PS_INPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_PS_INPUT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_PS_INPUT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.0; +pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COUNT: UINT = 1; +pub const D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENTS: UINT = 1; +pub const D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_PS_OUTPUT_MASK_REGISTER_COUNT: UINT = 1; +pub const D3D12_PS_OUTPUT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_PS_OUTPUT_REGISTER_COUNT: UINT = 8; +pub const D3D12_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.5; +pub const D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT: UINT = 16; +pub const D3D12_REQ_BLEND_OBJECT_COUNT_PER_DEVICE: UINT = 4096; +pub const D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP: UINT = 27; +pub const D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT: UINT = 4096; +pub const D3D12_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE: UINT = 4096; +pub const D3D12_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: UINT = 32; +pub const D3D12_REQ_DRAW_VERTEX_COUNT_2_TO_EXP: UINT = 32; +pub const D3D12_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION: UINT = 16384; +pub const D3D12_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT: UINT = 1024; +pub const D3D12_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT: UINT = 4096; +pub const D3D12_REQ_MAXANISOTROPY: UINT = 16; +pub const D3D12_REQ_MIP_LEVELS: UINT = 15; +pub const D3D12_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES: UINT = 2048; +pub const D3D12_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE: UINT = 4096; +pub const D3D12_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH: UINT = 16384; +pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM: UINT = 128; +pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM: FLOAT = 0.25; +pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM: UINT = 2048; +pub const D3D12_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP: UINT = 20; +pub const D3D12_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE: UINT = 4096; +pub const D3D12_REQ_SUBRESOURCES: UINT = 30720; +pub const D3D12_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION: UINT = 2048; +pub const D3D12_REQ_TEXTURE1D_U_DIMENSION: UINT = 16384; +pub const D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION: UINT = 2048; +pub const D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION: UINT = 16384; +pub const D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION: UINT = 2048; +pub const D3D12_REQ_TEXTURECUBE_DIMENSION: UINT = 16384; +pub const D3D12_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL: UINT = 0; +pub const D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES: UINT = 0xffffffff; +pub const D3D12_SHADER_MAJOR_VERSION: UINT = 5; +pub const D3D12_SHADER_MAX_INSTANCES: UINT = 65535; +pub const D3D12_SHADER_MAX_INTERFACES: UINT = 253; +pub const D3D12_SHADER_MAX_INTERFACE_CALL_SITES: UINT = 4096; +pub const D3D12_SHADER_MAX_TYPES: UINT = 65535; +pub const D3D12_SHADER_MINOR_VERSION: UINT = 1; +pub const D3D12_SHIFT_INSTRUCTION_PAD_VALUE: UINT = 0; +pub const D3D12_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT: UINT = 5; +pub const D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT: UINT = 8; +pub const D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT: UINT = 65536; +pub const D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT: UINT = 4096; +pub const D3D12_SO_BUFFER_MAX_STRIDE_IN_BYTES: UINT = 2048; +pub const D3D12_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES: UINT = 512; +pub const D3D12_SO_BUFFER_SLOT_COUNT: UINT = 4; +pub const D3D12_SO_DDI_REGISTER_INDEX_DENOTING_GAP: UINT = 0xffffffff; +pub const D3D12_SO_NO_RASTERIZED_STREAM: UINT = 0xffffffff; +pub const D3D12_SO_OUTPUT_COMPONENT_COUNT: UINT = 128; +pub const D3D12_SO_STREAM_COUNT: UINT = 4; +pub const D3D12_SPEC_DATE_DAY: UINT = 14; +pub const D3D12_SPEC_DATE_MONTH: UINT = 11; +pub const D3D12_SPEC_DATE_YEAR: UINT = 2014; +pub const D3D12_SPEC_VERSION: FLOAT = 1.16; +pub const D3D12_SRGB_GAMMA: FLOAT = 2.2; +pub const D3D12_SRGB_TO_FLOAT_DENOMINATOR_1: FLOAT = 12.92; +pub const D3D12_SRGB_TO_FLOAT_DENOMINATOR_2: FLOAT = 1.055; +pub const D3D12_SRGB_TO_FLOAT_EXPONENT: FLOAT = 2.4; +pub const D3D12_SRGB_TO_FLOAT_OFFSET: FLOAT = 0.055; +pub const D3D12_SRGB_TO_FLOAT_THRESHOLD: FLOAT = 0.04045; +pub const D3D12_SRGB_TO_FLOAT_TOLERANCE_IN_ULP: FLOAT = 0.5; +pub const D3D12_STANDARD_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_STANDARD_COMPONENT_BIT_COUNT_DOUBLED: UINT = 64; +pub const D3D12_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE: UINT = 4; +pub const D3D12_STANDARD_PIXEL_COMPONENT_COUNT: UINT = 128; +pub const D3D12_STANDARD_PIXEL_ELEMENT_COUNT: UINT = 32; +pub const D3D12_STANDARD_VECTOR_SIZE: UINT = 4; +pub const D3D12_STANDARD_VERTEX_ELEMENT_COUNT: UINT = 32; +pub const D3D12_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT: UINT = 64; +pub const D3D12_SUBPIXEL_FRACTIONAL_BIT_COUNT: UINT = 8; +pub const D3D12_SUBTEXEL_FRACTIONAL_BIT_COUNT: UINT = 8; +pub const D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_END: UINT = 0xffffffff; +pub const D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_START: UINT = 0xfffffff0; +pub const D3D12_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR: UINT = 64; +pub const D3D12_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR: UINT = 64; +pub const D3D12_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR: UINT = 63; +pub const D3D12_TESSELLATOR_MAX_TESSELLATION_FACTOR: UINT = 64; +pub const D3D12_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR: UINT = 2; +pub const D3D12_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR: UINT = 1; +pub const D3D12_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR: UINT = 1; +pub const D3D12_TEXEL_ADDRESS_RANGE_BIT_COUNT: UINT = 16; +pub const D3D12_TEXTURE_DATA_PITCH_ALIGNMENT: UINT = 256; +pub const D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT: UINT = 512; +pub const D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES: UINT = 65536; +pub const D3D12_UAV_COUNTER_PLACEMENT_ALIGNMENT: UINT = 4096; +pub const D3D12_UAV_SLOT_COUNT: UINT = 64; +pub const D3D12_UNBOUND_MEMORY_ACCESS_RESULT: UINT = 0; +pub const D3D12_VIEWPORT_AND_SCISSORRECT_MAX_INDEX: UINT = 15; +pub const D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE: UINT = 16; +pub const D3D12_VIEWPORT_BOUNDS_MAX: INT = 32767; +pub const D3D12_VIEWPORT_BOUNDS_MIN: INT = -32768; +pub const D3D12_VS_INPUT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_VS_INPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_VS_INPUT_REGISTER_READS_PER_INST: UINT = 2; +pub const D3D12_VS_INPUT_REGISTER_READ_PORTS: UINT = 1; +pub const D3D12_VS_OUTPUT_REGISTER_COMPONENTS: UINT = 4; +pub const D3D12_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: UINT = 32; +pub const D3D12_VS_OUTPUT_REGISTER_COUNT: UINT = 32; +pub const D3D12_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT: UINT = 10; +pub const D3D12_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: UINT = 25; +pub const D3D12_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP: UINT = 25; +pub type D3D12_GPU_VIRTUAL_ADDRESS = UINT64; +ENUM!{enum D3D12_COMMAND_LIST_TYPE { + D3D12_COMMAND_LIST_TYPE_DIRECT = 0, + D3D12_COMMAND_LIST_TYPE_BUNDLE = 1, + D3D12_COMMAND_LIST_TYPE_COMPUTE = 2, + D3D12_COMMAND_LIST_TYPE_COPY = 3, +}} +ENUM!{enum D3D12_COMMAND_QUEUE_FLAGS { + D3D12_COMMAND_QUEUE_FLAG_NONE = 0x0, + D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT = 0x1, +}} +ENUM!{enum D3D12_COMMAND_QUEUE_PRIORITY { + D3D12_COMMAND_QUEUE_PRIORITY_NORMAL = 0, + D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100, + D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME = 10000, +}} +STRUCT!{struct D3D12_COMMAND_QUEUE_DESC { + Type: D3D12_COMMAND_LIST_TYPE, + Priority: INT, + Flags: D3D12_COMMAND_QUEUE_FLAGS, + NodeMask: UINT, +}} +ENUM!{enum D3D12_PRIMITIVE_TOPOLOGY_TYPE { + D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED = 0, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT = 1, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE = 2, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE = 3, + D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH = 4, +}} +ENUM!{enum D3D12_INPUT_CLASSIFICATION { + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA = 0, + D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA = 1, +}} +STRUCT!{struct D3D12_INPUT_ELEMENT_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Format: DXGI_FORMAT, + InputSlot: UINT, + AlignedByteOffset: UINT, + InputSlotClass: D3D12_INPUT_CLASSIFICATION, + InstanceDataStepRate: UINT, +}} +ENUM!{enum D3D12_FILL_MODE { + D3D12_FILL_MODE_WIREFRAME = 2, + D3D12_FILL_MODE_SOLID = 3, +}} +pub type D3D12_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY; +pub type D3D12_PRIMITIVE = D3D_PRIMITIVE; +ENUM!{enum D3D12_CULL_MODE { + D3D12_CULL_MODE_NONE = 1, + D3D12_CULL_MODE_FRONT = 2, + D3D12_CULL_MODE_BACK = 3, +}} +STRUCT!{struct D3D12_SO_DECLARATION_ENTRY { + Stream: UINT, + SemanticName: LPCSTR, + SemanticIndex: UINT, + StartComponent: BYTE, + ComponentCount: BYTE, + OutputSlot: BYTE, +}} +STRUCT!{struct D3D12_VIEWPORT { + TopLeftX: FLOAT, + TopLeftY: FLOAT, + Width: FLOAT, + Height: FLOAT, + MinDepth: FLOAT, + MaxDepth: FLOAT, +}} +pub type D3D12_RECT = RECT; +STRUCT!{struct D3D12_BOX { + left: UINT, + top: UINT, + front: UINT, + right: UINT, + bottom: UINT, + back: UINT, +}} +ENUM!{enum D3D12_COMPARISON_FUNC { + D3D12_COMPARISON_FUNC_NEVER = 1, + D3D12_COMPARISON_FUNC_LESS = 2, + D3D12_COMPARISON_FUNC_EQUAL = 3, + D3D12_COMPARISON_FUNC_LESS_EQUAL = 4, + D3D12_COMPARISON_FUNC_GREATER = 5, + D3D12_COMPARISON_FUNC_NOT_EQUAL = 6, + D3D12_COMPARISON_FUNC_GREATER_EQUAL = 7, + D3D12_COMPARISON_FUNC_ALWAYS = 8, +}} +ENUM!{enum D3D12_DEPTH_WRITE_MASK { + D3D12_DEPTH_WRITE_MASK_ZERO = 0, + D3D12_DEPTH_WRITE_MASK_ALL = 1, +}} +ENUM!{enum D3D12_STENCIL_OP { + D3D12_STENCIL_OP_KEEP = 1, + D3D12_STENCIL_OP_ZERO = 2, + D3D12_STENCIL_OP_REPLACE = 3, + D3D12_STENCIL_OP_INCR_SAT = 4, + D3D12_STENCIL_OP_DECR_SAT = 5, + D3D12_STENCIL_OP_INVERT = 6, + D3D12_STENCIL_OP_INCR = 7, + D3D12_STENCIL_OP_DECR = 8, +}} +STRUCT!{struct D3D12_DEPTH_STENCILOP_DESC { + StencilFailOp: D3D12_STENCIL_OP, + StencilDepthFailOp: D3D12_STENCIL_OP, + StencilPassOp: D3D12_STENCIL_OP, + StencilFunc: D3D12_COMPARISON_FUNC, +}} +STRUCT!{struct D3D12_DEPTH_STENCIL_DESC { + DepthEnable: BOOL, + DepthWriteMask: D3D12_DEPTH_WRITE_MASK, + DepthFunc: D3D12_COMPARISON_FUNC, + StencilEnable: BOOL, + StencilReadMask: UINT8, + StencilWriteMask: UINT8, + FrontFace: D3D12_DEPTH_STENCILOP_DESC, + BackFace: D3D12_DEPTH_STENCILOP_DESC, +}} +STRUCT!{struct D3D12_DEPTH_STENCIL_DESC1 { + DepthEnable: BOOL, + DepthWriteMask: D3D12_DEPTH_WRITE_MASK, + DepthFunc: D3D12_COMPARISON_FUNC, + StencilEnable: BOOL, + StencilReadMask: UINT8, + StencilWriteMask: UINT8, + FrontFace: D3D12_DEPTH_STENCILOP_DESC, + BackFace: D3D12_DEPTH_STENCILOP_DESC, + DepthBoundsTestEnable: BOOL, +}} +ENUM!{enum D3D12_BLEND { + D3D12_BLEND_ZERO = 1, + D3D12_BLEND_ONE = 2, + D3D12_BLEND_SRC_COLOR = 3, + D3D12_BLEND_INV_SRC_COLOR = 4, + D3D12_BLEND_SRC_ALPHA = 5, + D3D12_BLEND_INV_SRC_ALPHA = 6, + D3D12_BLEND_DEST_ALPHA = 7, + D3D12_BLEND_INV_DEST_ALPHA = 8, + D3D12_BLEND_DEST_COLOR = 9, + D3D12_BLEND_INV_DEST_COLOR = 10, + D3D12_BLEND_SRC_ALPHA_SAT = 11, + D3D12_BLEND_BLEND_FACTOR = 14, + D3D12_BLEND_INV_BLEND_FACTOR = 15, + D3D12_BLEND_SRC1_COLOR = 16, + D3D12_BLEND_INV_SRC1_COLOR = 17, + D3D12_BLEND_SRC1_ALPHA = 18, + D3D12_BLEND_INV_SRC1_ALPHA = 19, +}} +ENUM!{enum D3D12_BLEND_OP { + D3D12_BLEND_OP_ADD = 1, + D3D12_BLEND_OP_SUBTRACT = 2, + D3D12_BLEND_OP_REV_SUBTRACT = 3, + D3D12_BLEND_OP_MIN = 4, + D3D12_BLEND_OP_MAX = 5, +}} +ENUM!{enum D3D12_COLOR_WRITE_ENABLE { + D3D12_COLOR_WRITE_ENABLE_RED = 1, + D3D12_COLOR_WRITE_ENABLE_GREEN = 2, + D3D12_COLOR_WRITE_ENABLE_BLUE = 4, + D3D12_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D12_COLOR_WRITE_ENABLE_ALL = D3D12_COLOR_WRITE_ENABLE_RED | D3D12_COLOR_WRITE_ENABLE_GREEN + | D3D12_COLOR_WRITE_ENABLE_BLUE | D3D12_COLOR_WRITE_ENABLE_ALPHA, +}} +ENUM!{enum D3D12_LOGIC_OP { + D3D12_LOGIC_OP_CLEAR = 0, + D3D12_LOGIC_OP_SET = 1, + D3D12_LOGIC_OP_COPY = 2, + D3D12_LOGIC_OP_COPY_INVERTED = 3, + D3D12_LOGIC_OP_NOOP = 4, + D3D12_LOGIC_OP_INVERT = 5, + D3D12_LOGIC_OP_AND = 6, + D3D12_LOGIC_OP_NAND = 7, + D3D12_LOGIC_OP_OR = 8, + D3D12_LOGIC_OP_NOR = 9, + D3D12_LOGIC_OP_XOR = 10, + D3D12_LOGIC_OP_EQUIV = 11, + D3D12_LOGIC_OP_AND_REVERSE = 12, + D3D12_LOGIC_OP_AND_INVERTED = 13, + D3D12_LOGIC_OP_OR_REVERSE = 14, + D3D12_LOGIC_OP_OR_INVERTED = 15, +}} +STRUCT!{struct D3D12_RENDER_TARGET_BLEND_DESC { + BlendEnable: BOOL, + LogicOpEnable: BOOL, + SrcBlend: D3D12_BLEND, + DestBlend: D3D12_BLEND, + BlendOp: D3D12_BLEND_OP, + SrcBlendAlpha: D3D12_BLEND, + DestBlendAlpha: D3D12_BLEND, + BlendOpAlpha: D3D12_BLEND_OP, + LogicOp: D3D12_LOGIC_OP, + RenderTargetWriteMask: UINT8, +}} +STRUCT!{struct D3D12_BLEND_DESC { + AlphaToCoverageEnable: BOOL, + IndependentBlendEnable: BOOL, + RenderTarget: [D3D12_RENDER_TARGET_BLEND_DESC; 8], +}} +ENUM!{enum D3D12_CONSERVATIVE_RASTERIZATION_MODE { + D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF = 0, + D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON = 1, +}} +STRUCT!{struct D3D12_RASTERIZER_DESC { + FillMode: D3D12_FILL_MODE, + CullMode: D3D12_CULL_MODE, + FrontCounterClockwise: BOOL, + DepthBias: INT, + DepthBiasClamp: FLOAT, + SlopeScaledDepthBias: FLOAT, + DepthClipEnable: BOOL, + MultisampleEnable: BOOL, + AntialiasedLineEnable: BOOL, + ForcedSampleCount: UINT, + ConservativeRaster: D3D12_CONSERVATIVE_RASTERIZATION_MODE, +}} +RIDL!{#[uuid(0xc54a6b66, 0x72df, 0x4ee8, 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14)] +interface ID3D12RootSignature(ID3D12RootSignatureVtbl): + ID3D12DeviceChild(ID3D12DeviceChildVtbl) {}} +STRUCT!{struct D3D12_SHADER_BYTECODE { + pShaderBytecode: *const c_void, + BytecodeLength: SIZE_T, +}} +STRUCT!{struct D3D12_STREAM_OUTPUT_DESC { + pSODeclaration: *const D3D12_SO_DECLARATION_ENTRY, + NumEntries: UINT, + pBufferStrides: *const UINT, + NumStrides: UINT, + RasterizedStream: UINT, +}} +STRUCT!{struct D3D12_INPUT_LAYOUT_DESC { + pInputElementDescs: *const D3D12_INPUT_ELEMENT_DESC, + NumElements: UINT, +}} +ENUM!{enum D3D12_INDEX_BUFFER_STRIP_CUT_VALUE { + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED = 0, + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF = 1, + D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF = 2, +}} +STRUCT!{struct D3D12_CACHED_PIPELINE_STATE { + pCachedBlob: *const c_void, + CachedBlobSizeInBytes: SIZE_T, +}} +ENUM!{enum D3D12_PIPELINE_STATE_FLAGS { + D3D12_PIPELINE_STATE_FLAG_NONE = 0, + D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG = 0x1, +}} +STRUCT!{struct D3D12_GRAPHICS_PIPELINE_STATE_DESC { + pRootSignature: *mut ID3D12RootSignature, + VS: D3D12_SHADER_BYTECODE, + PS: D3D12_SHADER_BYTECODE, + DS: D3D12_SHADER_BYTECODE, + HS: D3D12_SHADER_BYTECODE, + GS: D3D12_SHADER_BYTECODE, + StreamOutput: D3D12_STREAM_OUTPUT_DESC, + BlendState: D3D12_BLEND_DESC, + SampleMask: UINT, + RasterizerState: D3D12_RASTERIZER_DESC, + DepthStencilState: D3D12_DEPTH_STENCIL_DESC, + InputLayout: D3D12_INPUT_LAYOUT_DESC, + IBStripCutValue: D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, + PrimitiveTopologyType: D3D12_PRIMITIVE_TOPOLOGY_TYPE, + NumRenderTargets: UINT, + RTVFormats: [DXGI_FORMAT; 8], + DSVFormat: DXGI_FORMAT, + SampleDesc: DXGI_SAMPLE_DESC, + NodeMask: UINT, + CachedPSO: D3D12_CACHED_PIPELINE_STATE, + Flags: D3D12_PIPELINE_STATE_FLAGS, +}} +STRUCT!{struct D3D12_COMPUTE_PIPELINE_STATE_DESC { + pRootSignature: *mut ID3D12RootSignature, + CS: D3D12_SHADER_BYTECODE, + NodeMask: UINT, + CachedPSO: D3D12_CACHED_PIPELINE_STATE, + Flags: D3D12_PIPELINE_STATE_FLAGS, +}} +STRUCT!{struct D3D12_RT_FORMAT_ARRAY { + RTFormats: [DXGI_FORMAT; 8], + NumRenderTargets: UINT, +}} +STRUCT!{struct D3D12_PIPELINE_STATE_STREAM_DESC { + SizeInBytes: SIZE_T, + pPipelineStateSubobjectStream: *mut c_void, +}} +ENUM!{enum D3D12_PIPELINE_STATE_SUBOBJECT_TYPE { + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE = 0, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS = 1, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS = 2, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS = 3, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS = 4, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS = 5, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS = 6, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT = 7, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND = 8, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK = 9, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER = 10, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL = 11, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT = 12, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE = 13, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY = 14, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS = 15, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT = 16, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC = 17, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK = 18, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO = 19, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS = 20, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1 = 21, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MAX_VALID = 22, +}} +ENUM!{enum D3D12_FEATURE { + D3D12_FEATURE_D3D12_OPTIONS = 0, + D3D12_FEATURE_ARCHITECTURE = 1, + D3D12_FEATURE_FEATURE_LEVELS = 2, + D3D12_FEATURE_FORMAT_SUPPORT = 3, + D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS = 4, + D3D12_FEATURE_FORMAT_INFO = 5, + D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = 6, + D3D12_FEATURE_SHADER_MODEL = 7, + D3D12_FEATURE_D3D12_OPTIONS1 = 8, + D3D12_FEATURE_ROOT_SIGNATURE = 12, + D3D12_FEATURE_ARCHITECTURE1 = 16, + D3D12_FEATURE_D3D12_OPTIONS2 = 18, + D3D12_FEATURE_SHADER_CACHE = 19, + D3D12_FEATURE_COMMAND_QUEUE_PRIORITY = 20, +}} +ENUM!{enum D3D12_SHADER_MIN_PRECISION_SUPPORT { + D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE = 0, + D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT = 0x1, + D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT = 0x2, +}} +ENUM!{enum D3D12_TILED_RESOURCES_TIER { + D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED = 0, + D3D12_TILED_RESOURCES_TIER_1 = 1, + D3D12_TILED_RESOURCES_TIER_2 = 2, + D3D12_TILED_RESOURCES_TIER_3 = 3, +}} +ENUM!{enum D3D12_RESOURCE_BINDING_TIER { + D3D12_RESOURCE_BINDING_TIER_1 = 1, + D3D12_RESOURCE_BINDING_TIER_2 = 2, + D3D12_RESOURCE_BINDING_TIER_3 = 3, +}} +ENUM!{enum D3D12_CONSERVATIVE_RASTERIZATION_TIER { + D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED = 0, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_1 = 1, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, + D3D12_CONSERVATIVE_RASTERIZATION_TIER_3 = 3, +}} +ENUM!{enum D3D12_FORMAT_SUPPORT1 { + D3D12_FORMAT_SUPPORT1_NONE = 0, + D3D12_FORMAT_SUPPORT1_BUFFER = 0x1, + D3D12_FORMAT_SUPPORT1_IA_VERTEX_BUFFER = 0x2, + D3D12_FORMAT_SUPPORT1_IA_INDEX_BUFFER = 0x4, + D3D12_FORMAT_SUPPORT1_SO_BUFFER = 0x8, + D3D12_FORMAT_SUPPORT1_TEXTURE1D = 0x10, + D3D12_FORMAT_SUPPORT1_TEXTURE2D = 0x20, + D3D12_FORMAT_SUPPORT1_TEXTURE3D = 0x40, + D3D12_FORMAT_SUPPORT1_TEXTURECUBE = 0x80, + D3D12_FORMAT_SUPPORT1_SHADER_LOAD = 0x100, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE = 0x200, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON = 0x400, + D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D12_FORMAT_SUPPORT1_MIP = 0x1000, + D3D12_FORMAT_SUPPORT1_RENDER_TARGET = 0x4000, + D3D12_FORMAT_SUPPORT1_BLENDABLE = 0x8000, + D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL = 0x10000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE = 0x40000, + D3D12_FORMAT_SUPPORT1_DISPLAY = 0x80000, + D3D12_FORMAT_SUPPORT1_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D12_FORMAT_SUPPORT1_MULTISAMPLE_LOAD = 0x400000, + D3D12_FORMAT_SUPPORT1_SHADER_GATHER = 0x800000, + D3D12_FORMAT_SUPPORT1_BACK_BUFFER_CAST = 0x1000000, + D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, + D3D12_FORMAT_SUPPORT1_SHADER_GATHER_COMPARISON = 0x4000000, + D3D12_FORMAT_SUPPORT1_DECODER_OUTPUT = 0x8000000, + D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_OUTPUT = 0x10000000, + D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_INPUT = 0x20000000, + D3D12_FORMAT_SUPPORT1_VIDEO_ENCODER = 0x40000000, +}} +ENUM!{enum D3D12_FORMAT_SUPPORT2 { + D3D12_FORMAT_SUPPORT2_NONE = 0, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, + D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, + D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, + D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, + D3D12_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, + D3D12_FORMAT_SUPPORT2_TILED = 0x200, + D3D12_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, +}} +ENUM!{enum D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS { + D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE = 0, + D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_TILED_RESOURCE = 0x1, +}} +ENUM!{enum D3D12_CROSS_NODE_SHARING_TIER { + D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED = 0, + D3D12_CROSS_NODE_SHARING_TIER_1_EMULATED = 1, + D3D12_CROSS_NODE_SHARING_TIER_1 = 2, + D3D12_CROSS_NODE_SHARING_TIER_2 = 3, +}} +ENUM!{enum D3D12_RESOURCE_HEAP_TIER { + D3D12_RESOURCE_HEAP_TIER_1 = 1, + D3D12_RESOURCE_HEAP_TIER_2 = 2, +}} +ENUM!{enum D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER { + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED = 0, + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_1 = 1, + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2 = 2, +}} +STRUCT!{struct D3D12_FEATURE_DATA_D3D12_OPTIONS { + DoublePrecisionFloatShaderOps: BOOL, + OutputMergerLogicOp: BOOL, + MinPrecisionSupport: D3D12_SHADER_MIN_PRECISION_SUPPORT, + TiledResourcesTier: D3D12_TILED_RESOURCES_TIER, + ResourceBindingTier: D3D12_RESOURCE_BINDING_TIER, + PSSpecifiedStencilRefSupported: BOOL, + TypedUAVLoadAdditionalFormats: BOOL, + ROVsSupported: BOOL, + ConservativeRasterizationTier: D3D12_CONSERVATIVE_RASTERIZATION_TIER, + MaxGPUVirtualAddressBitsPerResource: UINT, + StandardSwizzle64KBSupported: BOOL, + CrossNodeSharingTier: D3D12_CROSS_NODE_SHARING_TIER, + CrossAdapterRowMajorTextureSupported: BOOL, + VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation: BOOL, + ResourceHeapTier: D3D12_RESOURCE_HEAP_TIER, +}} +STRUCT!{struct D3D12_FEATURE_DATA_D3D12_OPTIONS1 { + WaveOps: BOOL, + WaveLaneCountMin: UINT, + WaveLaneCountMax: UINT, + TotalLaneCount: UINT, + ExpandedComputeResourceStates: BOOL, + Int64ShaderOps: BOOL, +}} +STRUCT!{struct D3D12_FEATURE_DATA_D3D12_OPTIONS2 { + DepthBoundsTestSupported: BOOL, + ProgrammableSamplePositionsTier: D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER, +}} +ENUM!{enum D3D_ROOT_SIGNATURE_VERSION { + D3D_ROOT_SIGNATURE_VERSION_1 = 0x1, + D3D_ROOT_SIGNATURE_VERSION_1_0 = 0x1, + D3D_ROOT_SIGNATURE_VERSION_1_1 = 0x2, +}} +STRUCT!{struct D3D12_FEATURE_DATA_ROOT_SIGNATURE { + HighestVersion: D3D_ROOT_SIGNATURE_VERSION, +}} +STRUCT!{struct D3D12_FEATURE_DATA_ARCHITECTURE { + NodeIndex: UINT, + TileBasedRenderer: BOOL, + UMA: BOOL, + CacheCoherentUMA: BOOL, +}} +STRUCT!{struct D3D12_FEATURE_DATA_ARCHITECTURE1 { + NodeIndex: UINT, + TileBasedRenderer: BOOL, + UMA: BOOL, + CacheCoherentUMA: BOOL, + IsolatedMMU: BOOL, +}} +STRUCT!{struct D3D12_FEATURE_DATA_FEATURE_LEVELS { + NumFeatureLevels: UINT, + pFeatureLevelsRequested: *const D3D_FEATURE_LEVEL, + MaxSupportedFeatureLevel: D3D_FEATURE_LEVEL, +}} +ENUM!{enum D3D_SHADER_MODEL { + D3D_SHADER_MODEL_5_1 = 0x51, + D3D_SHADER_MODEL_6_0 = 0x60, +}} +STRUCT!{struct D3D12_FEATURE_DATA_SHADER_MODEL { + HighestShaderModel: D3D_SHADER_MODEL, +}} +STRUCT!{struct D3D12_FEATURE_DATA_FORMAT_SUPPORT { + Format: DXGI_FORMAT, + Support1: D3D12_FORMAT_SUPPORT1, + Support2: D3D12_FORMAT_SUPPORT2, +}} +STRUCT!{struct D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS { + Format: DXGI_FORMAT, + SampleCount: UINT, + Flags: D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS, + NumQualityLevels: UINT, +}} +STRUCT!{struct D3D12_FEATURE_DATA_FORMAT_INFO { + Format: DXGI_FORMAT, + PlaneCount: UINT8, +}} +STRUCT!{struct D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT { + MaxGPUVirtualAddressBitsPerResource: UINT, + MaxGPUVirtualAddressBitsPerProcess: UINT, +}} +ENUM!{enum D3D12_SHADER_CACHE_SUPPORT_FLAGS { + D3D12_SHADER_CACHE_SUPPORT_NONE = 0, + D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO = 0x1, + D3D12_SHADER_CACHE_SUPPORT_LIBRARY = 0x2, + D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE = 0x4, + D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE = 0x8, +}} +STRUCT!{struct D3D12_FEATURE_DATA_SHADER_CACHE { + SupportFlags: D3D12_SHADER_CACHE_SUPPORT_FLAGS, +}} +STRUCT!{struct D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY { + CommandListType: D3D12_COMMAND_LIST_TYPE, + Priority: UINT, + PriorityForTypeIsSupported: BOOL, +}} +STRUCT!{struct D3D12_RESOURCE_ALLOCATION_INFO { + SizeInBytes: UINT64, + Alignment: UINT64, +}} +ENUM!{enum D3D12_HEAP_TYPE { + D3D12_HEAP_TYPE_DEFAULT = 1, + D3D12_HEAP_TYPE_UPLOAD = 2, + D3D12_HEAP_TYPE_READBACK = 3, + D3D12_HEAP_TYPE_CUSTOM = 4, +}} +ENUM!{enum D3D12_CPU_PAGE_PROPERTY { + D3D12_CPU_PAGE_PROPERTY_UNKNOWN = 0, + D3D12_CPU_PAGE_PROPERTY_NOT_AVAILABLE = 1, + D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE = 2, + D3D12_CPU_PAGE_PROPERTY_WRITE_BACK = 3, +}} +ENUM!{enum D3D12_MEMORY_POOL { + D3D12_MEMORY_POOL_UNKNOWN = 0, + D3D12_MEMORY_POOL_L0 = 1, + D3D12_MEMORY_POOL_L1 = 2, +}} +STRUCT!{struct D3D12_HEAP_PROPERTIES { + Type: D3D12_HEAP_TYPE, + CPUPageProperty: D3D12_CPU_PAGE_PROPERTY, + MemoryPoolPreference: D3D12_MEMORY_POOL, + CreationNodeMask: UINT, + VisibleNodeMask: UINT, +}} +ENUM!{enum D3D12_HEAP_FLAGS { + D3D12_HEAP_FLAG_NONE = 0, + D3D12_HEAP_FLAG_SHARED = 0x1, + D3D12_HEAP_FLAG_DENY_BUFFERS = 0x4, + D3D12_HEAP_FLAG_ALLOW_DISPLAY = 0x8, + D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER = 0x20, + D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES = 0x40, + D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES = 0x80, + D3D12_HEAP_FLAG_HARDWARE_PROTECTED = 0x100, + D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH = 0x200, + D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES = 0, + D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS = 0xc0, + D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = 0x44, + D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES = 0x84, +}} +STRUCT!{struct D3D12_HEAP_DESC { + SizeInBytes: UINT64, + Properties: D3D12_HEAP_PROPERTIES, + Alignment: UINT64, + Flags: D3D12_HEAP_FLAGS, +}} +ENUM!{enum D3D12_RESOURCE_DIMENSION { + D3D12_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D12_RESOURCE_DIMENSION_BUFFER = 1, + D3D12_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D12_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D12_RESOURCE_DIMENSION_TEXTURE3D = 4, +}} +ENUM!{enum D3D12_TEXTURE_LAYOUT { + D3D12_TEXTURE_LAYOUT_UNKNOWN = 0, + D3D12_TEXTURE_LAYOUT_ROW_MAJOR = 1, + D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE = 2, + D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE = 3, +}} +ENUM!{enum D3D12_RESOURCE_FLAGS { + D3D12_RESOURCE_FLAG_NONE = 0, + D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET = 0x1, + D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL = 0x2, + D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS = 0x4, + D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE = 0x8, + D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER = 0x10, + D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS = 0x20, +}} +STRUCT!{struct D3D12_RESOURCE_DESC { + Dimension: D3D12_RESOURCE_DIMENSION, + Alignment: UINT64, + Width: UINT64, + Height: UINT, + DepthOrArraySize: UINT16, + MipLevels: UINT16, + Format: DXGI_FORMAT, + SampleDesc: DXGI_SAMPLE_DESC, + Layout: D3D12_TEXTURE_LAYOUT, + Flags: D3D12_RESOURCE_FLAGS, +}} +STRUCT!{struct D3D12_DEPTH_STENCIL_VALUE { + Depth: FLOAT, + Stencil: UINT8, +}} +UNION!{union D3D12_CLEAR_VALUE_u { + [u32; 4], + Color Color_mut: [FLOAT; 4], + DepthStencil DepthStencil_mut: D3D12_DEPTH_STENCIL_VALUE, +}} +STRUCT!{struct D3D12_CLEAR_VALUE { + Format: DXGI_FORMAT, + u: D3D12_CLEAR_VALUE_u, +}} +STRUCT!{struct D3D12_RANGE { + Begin: SIZE_T, + End: SIZE_T, +}} +STRUCT!{struct D3D12_RANGE_UINT64 { + Begin: UINT64, + End: UINT64, +}} +STRUCT!{struct D3D12_SUBRESOURCE_RANGE_UINT64 { + Subresource: UINT, + Range: D3D12_RANGE_UINT64, +}} +STRUCT!{struct D3D12_SUBRESOURCE_INFO { + Offset: UINT64, + RowPitch: UINT, + DepthPitch: UINT, +}} +STRUCT!{struct D3D12_TILED_RESOURCE_COORDINATE { + X: UINT, + Y: UINT, + Z: UINT, + Subresource: UINT, +}} +STRUCT!{struct D3D12_TILE_REGION_SIZE { + NumTiles: UINT, + UseBox: BOOL, + Width: UINT, + Height: UINT16, + Depth: UINT16, +}} +ENUM!{enum D3D12_TILE_RANGE_FLAGS { + D3D12_TILE_RANGE_FLAG_NONE = 0, + D3D12_TILE_RANGE_FLAG_NULL = 1, + D3D12_TILE_RANGE_FLAG_SKIP = 2, + D3D12_TILE_RANGE_FLAG_REUSE_SINGLE_TILE = 4, +}} +STRUCT!{struct D3D12_SUBRESOURCE_TILING { + WidthInTiles: UINT, + HeightInTiles: UINT16, + DepthInTiles: UINT16, + StartTileIndexInOverallResource: UINT, +}} +STRUCT!{struct D3D12_TILE_SHAPE { + WidthInTexels: UINT, + HeightInTexels: UINT, + DepthInTexels: UINT, +}} +STRUCT!{struct D3D12_PACKED_MIP_INFO { + NumStandardMips: UINT8, + NumPackedMips: UINT8, + NumTilesForPackedMips: UINT, + StartTileIndexInOverallResource: UINT, +}} +ENUM!{enum D3D12_TILE_MAPPING_FLAGS { + D3D12_TILE_MAPPING_FLAG_NONE = 0, + D3D12_TILE_MAPPING_FLAG_NO_HAZARD = 0x1, +}} +ENUM!{enum D3D12_TILE_COPY_FLAGS { + D3D12_TILE_COPY_FLAG_NONE = 0, + D3D12_TILE_COPY_FLAG_NO_HAZARD = 0x1, + D3D12_TILE_COPY_FLAG_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 0x2, + D3D12_TILE_COPY_FLAG_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 0x4, +}} +ENUM!{enum D3D12_RESOURCE_STATES { + D3D12_RESOURCE_STATE_COMMON = 0, + D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER = 0x1, + D3D12_RESOURCE_STATE_INDEX_BUFFER = 0x2, + D3D12_RESOURCE_STATE_RENDER_TARGET = 0x4, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS = 0x8, + D3D12_RESOURCE_STATE_DEPTH_WRITE = 0x10, + D3D12_RESOURCE_STATE_DEPTH_READ = 0x20, + D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE = 0x40, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE = 0x80, + D3D12_RESOURCE_STATE_STREAM_OUT = 0x100, + D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT = 0x200, + D3D12_RESOURCE_STATE_COPY_DEST = 0x400, + D3D12_RESOURCE_STATE_COPY_SOURCE = 0x800, + D3D12_RESOURCE_STATE_RESOLVE_DEST = 0x1000, + D3D12_RESOURCE_STATE_RESOLVE_SOURCE = 0x2000, + D3D12_RESOURCE_STATE_GENERIC_READ = 0x1 | 0x2 | 0x40 | 0x80 | 0x200 | 0x800, + D3D12_RESOURCE_STATE_PRESENT = 0, + D3D12_RESOURCE_STATE_PREDICATION = 0x200, +}} +ENUM!{enum D3D12_RESOURCE_BARRIER_TYPE { + D3D12_RESOURCE_BARRIER_TYPE_TRANSITION = 0, + D3D12_RESOURCE_BARRIER_TYPE_ALIASING = 1, + D3D12_RESOURCE_BARRIER_TYPE_UAV = 2, +}} +STRUCT!{struct D3D12_RESOURCE_TRANSITION_BARRIER { + pResource: *mut ID3D12Resource, + Subresource: UINT, + StateBefore: D3D12_RESOURCE_STATES, + StateAfter: D3D12_RESOURCE_STATES, +}} +STRUCT!{struct D3D12_RESOURCE_ALIASING_BARRIER { + pResourceBefore: *mut ID3D12Resource, + pResourceAfter: *mut ID3D12Resource, +}} +STRUCT!{struct D3D12_RESOURCE_UAV_BARRIER { + pResource: *mut ID3D12Resource, +}} +ENUM!{enum D3D12_RESOURCE_BARRIER_FLAGS { + D3D12_RESOURCE_BARRIER_FLAG_NONE = 0x0, + D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY = 0x1, + D3D12_RESOURCE_BARRIER_FLAG_END_ONLY = 0x2, +}} +UNION!{union D3D12_RESOURCE_BARRIER_u { + [u32; 4] [u64; 3], + Transition Transition_mut: D3D12_RESOURCE_TRANSITION_BARRIER, + Aliasing Aliasing_mut: D3D12_RESOURCE_ALIASING_BARRIER, + UAV UAV_mut: D3D12_RESOURCE_UAV_BARRIER, +}} +STRUCT!{struct D3D12_RESOURCE_BARRIER { + Type: D3D12_RESOURCE_BARRIER_TYPE, + Flags: D3D12_RESOURCE_BARRIER_FLAGS, + u: D3D12_RESOURCE_BARRIER_u, +}} +STRUCT!{struct D3D12_SUBRESOURCE_FOOTPRINT { + Format: DXGI_FORMAT, + Width: UINT, + Height: UINT, + Depth: UINT, + RowPitch: UINT, +}} +STRUCT!{struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT { + Offset: UINT64, + Footprint: D3D12_SUBRESOURCE_FOOTPRINT, +}} +ENUM!{enum D3D12_TEXTURE_COPY_TYPE { + D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX = 0, + D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT = 1, +}} +UNION!{union D3D12_TEXTURE_COPY_LOCATION_u { + [u64; 4], + PlacedFootprint PlacedFootprint_mut: D3D12_PLACED_SUBRESOURCE_FOOTPRINT, + SubresourceIndex SubresourceIndex_mut: UINT, +}} +STRUCT!{struct D3D12_TEXTURE_COPY_LOCATION { + pResource: *mut ID3D12Resource, + Type: D3D12_TEXTURE_COPY_TYPE, + u: D3D12_TEXTURE_COPY_LOCATION_u, +}} +ENUM!{enum D3D12_RESOLVE_MODE { + D3D12_RESOLVE_MODE_DECOMPRESS = 0, + D3D12_RESOLVE_MODE_MIN = 1, + D3D12_RESOLVE_MODE_MAX = 2, + D3D12_RESOLVE_MODE_AVERAGE = 3, +}} +STRUCT!{struct D3D12_SAMPLE_POSITION { + X: INT8, + Y: INT8, +}} +ENUM!{enum D3D12_SHADER_COMPONENT_MAPPING { + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0 = 0, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1 = 1, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2 = 2, + D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3 = 3, + D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0 = 4, + D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1 = 5, +}} +pub const D3D12_SHADER_COMPONENT_MAPPING_MASK: UINT = 0x7; +pub const D3D12_SHADER_COMPONENT_MAPPING_SHIFT: UINT = 3; +pub const D3D12_SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES: UINT = 1 + << (D3D12_SHADER_COMPONENT_MAPPING_SHIFT * 4); +// D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING +// D3D12_DECODE_SHADER_4_COMPONENT_MAPPING +// D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING +ENUM!{enum D3D12_BUFFER_SRV_FLAGS { + D3D12_BUFFER_SRV_FLAG_NONE = 0x0, + D3D12_BUFFER_SRV_FLAG_RAW = 0x1, +}} +STRUCT!{struct D3D12_BUFFER_SRV { + FirstElement: UINT64, + NumElements: UINT, + StructureByteStride: UINT, + Flags: D3D12_BUFFER_SRV_FLAGS, +}} +STRUCT!{struct D3D12_TEX1D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + ResourceMinLODClamp: FLOAT, +}} +STRUCT!{struct D3D12_TEX1D_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, + ResourceMinLODClamp: FLOAT, +}} +STRUCT!{struct D3D12_TEX2D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + PlaneSlice: UINT, + ResourceMinLODClamp: FLOAT, +}} +STRUCT!{struct D3D12_TEX2D_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, + PlaneSlice: UINT, + ResourceMinLODClamp: FLOAT, +}} +STRUCT!{struct D3D12_TEX3D_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + ResourceMinLODClamp: FLOAT, +}} +STRUCT!{struct D3D12_TEXCUBE_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + ResourceMinLODClamp: FLOAT, +}} +STRUCT!{struct D3D12_TEXCUBE_ARRAY_SRV { + MostDetailedMip: UINT, + MipLevels: UINT, + First2DArrayFace: UINT, + NumCubes: UINT, + ResourceMinLODClamp: FLOAT, +}} +STRUCT!{struct D3D12_TEX2DMS_SRV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D12_TEX2DMS_ARRAY_SRV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +ENUM!{enum D3D12_SRV_DIMENSION { + D3D12_SRV_DIMENSION_UNKNOWN = 0, + D3D12_SRV_DIMENSION_BUFFER = 1, + D3D12_SRV_DIMENSION_TEXTURE1D = 2, + D3D12_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_SRV_DIMENSION_TEXTURE2D = 4, + D3D12_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D12_SRV_DIMENSION_TEXTURE3D = 8, + D3D12_SRV_DIMENSION_TEXTURECUBE = 9, + D3D12_SRV_DIMENSION_TEXTURECUBEARRAY = 10, +}} +UNION!{union D3D12_SHADER_RESOURCE_VIEW_DESC_u { + [u64; 3], + Buffer Buffer_mut: D3D12_BUFFER_SRV, + Texture1D Texture1D_mut: D3D12_TEX1D_SRV, + Texture1DArray Texture1DArray_mut: D3D12_TEX1D_ARRAY_SRV, + Texture2D Texture2D_mut: D3D12_TEX2D_SRV, + Texture2DArray Texture2DArray_mut: D3D12_TEX2D_ARRAY_SRV, + Texture2DMS Texture2DMS_mut: D3D12_TEX2DMS_SRV, + Texture2DMSArray Texture2DMSArray_mut: D3D12_TEX2DMS_ARRAY_SRV, + Texture3D Texture3D_mut: D3D12_TEX3D_SRV, + TextureCube TextureCube_mut: D3D12_TEXCUBE_SRV, + TextureCubeArray TextureCubeArray_mut: D3D12_TEXCUBE_ARRAY_SRV, +}} +STRUCT!{struct D3D12_SHADER_RESOURCE_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D12_SRV_DIMENSION, + Shader4ComponentMapping: UINT, + u: D3D12_SHADER_RESOURCE_VIEW_DESC_u, +}} +STRUCT!{struct D3D12_CONSTANT_BUFFER_VIEW_DESC { + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: UINT, +}} +ENUM!{enum D3D12_FILTER { + D3D12_FILTER_MIN_MAG_MIP_POINT = 0, + D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D12_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D12_FILTER_ANISOTROPIC = 0x55, + D3D12_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D12_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D12_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D12_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D12_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D12_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D12_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D12_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100, + D3D12_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101, + D3D12_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104, + D3D12_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105, + D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110, + D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111, + D3D12_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114, + D3D12_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115, + D3D12_FILTER_MINIMUM_ANISOTROPIC = 0x155, + D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180, + D3D12_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181, + D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184, + D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185, + D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190, + D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191, + D3D12_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194, + D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, + D3D12_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5, +}} +ENUM!{enum D3D12_FILTER_TYPE { + D3D12_FILTER_TYPE_POINT = 0, + D3D12_FILTER_TYPE_LINEAR = 1, +}} +ENUM!{enum D3D12_FILTER_REDUCTION_TYPE { + D3D12_FILTER_REDUCTION_TYPE_STANDARD = 0, + D3D12_FILTER_REDUCTION_TYPE_COMPARISON = 1, + D3D12_FILTER_REDUCTION_TYPE_MINIMUM = 2, + D3D12_FILTER_REDUCTION_TYPE_MAXIMUM = 3, +}} +pub const D3D12_FILTER_REDUCTION_TYPE_MASK: UINT = 0x3; +pub const D3D12_FILTER_REDUCTION_TYPE_SHIFT: UINT = 7; +pub const D3D12_FILTER_TYPE_MASK: UINT = 0x3; +pub const D3D12_MIN_FILTER_SHIFT: UINT = 4; +pub const D3D12_MAG_FILTER_SHIFT: UINT = 2; +pub const D3D12_MIP_FILTER_SHIFT: UINT = 0; +pub const D3D12_ANISOTROPIC_FILTERING_BIT: UINT = 0x40; +// D3D12_ENCODE_BASIC_FILTER +// D3D12_ENCODE_ANISOTROPIC_FILTER +// D3D12_DECODE_MIN_FILTER +// D3D12_DECODE_MAG_FILTER +// D3D12_DECODE_MIP_FILTER +// D3D12_DECODE_FILTER_REDUCTION +// D3D12_DECODE_IS_COMPARISON_FILTER +// D3D12_DECODE_IS_ANISOTROPIC_FILTER +ENUM!{enum D3D12_TEXTURE_ADDRESS_MODE { + D3D12_TEXTURE_ADDRESS_MODE_WRAP = 1, + D3D12_TEXTURE_ADDRESS_MODE_MIRROR = 2, + D3D12_TEXTURE_ADDRESS_MODE_CLAMP = 3, + D3D12_TEXTURE_ADDRESS_MODE_BORDER = 4, + D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 5, +}} +STRUCT!{struct D3D12_SAMPLER_DESC { + Filter: D3D12_FILTER, + AddressU: D3D12_TEXTURE_ADDRESS_MODE, + AddressV: D3D12_TEXTURE_ADDRESS_MODE, + AddressW: D3D12_TEXTURE_ADDRESS_MODE, + MipLODBias: FLOAT, + MaxAnisotropy: UINT, + ComparisonFunc: D3D12_COMPARISON_FUNC, + BorderColor: [FLOAT; 4], + MinLOD: FLOAT, + MaxLOD: FLOAT, +}} +ENUM!{enum D3D12_BUFFER_UAV_FLAGS { + D3D12_BUFFER_UAV_FLAG_NONE = 0, + D3D12_BUFFER_UAV_FLAG_RAW = 0x1, +}} +STRUCT!{struct D3D12_BUFFER_UAV { + FirstElement: UINT64, + NumElements: UINT, + StructureByteStride: UINT, + CounterOffsetInBytes: UINT64, + Flags: D3D12_BUFFER_UAV_FLAGS, +}} +STRUCT!{struct D3D12_TEX1D_UAV { + MipSlice: UINT, +}} +STRUCT!{struct D3D12_TEX1D_ARRAY_UAV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D12_TEX2D_UAV { + MipSlice: UINT, + PlaneSlice: UINT, +}} +STRUCT!{struct D3D12_TEX2D_ARRAY_UAV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, + PlaneSlice: UINT, +}} +STRUCT!{struct D3D12_TEX3D_UAV { + MipSlice: UINT, + FirstWSlice: UINT, + WSize: UINT, +}} +ENUM!{enum D3D12_UAV_DIMENSION { + D3D12_UAV_DIMENSION_UNKNOWN = 0, + D3D12_UAV_DIMENSION_BUFFER = 1, + D3D12_UAV_DIMENSION_TEXTURE1D = 2, + D3D12_UAV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_UAV_DIMENSION_TEXTURE2D = 4, + D3D12_UAV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_UAV_DIMENSION_TEXTURE3D = 8, +}} +UNION!{union D3D12_UNORDERED_ACCESS_VIEW_DESC_u { + [u64; 4], + Buffer Buffer_mut: D3D12_BUFFER_UAV, + Texture1D Texture1D_mut: D3D12_TEX1D_UAV, + Texture1DArray Texture1DArray_mut: D3D12_TEX1D_ARRAY_UAV, + Texture2D Texture2D_mut: D3D12_TEX2D_UAV, + Texture2DArray Texture2DArray_mut: D3D12_TEX2D_ARRAY_UAV, + Texture3D Texture3D_mut: D3D12_TEX3D_UAV, +}} +STRUCT!{struct D3D12_UNORDERED_ACCESS_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D12_UAV_DIMENSION, + u: D3D12_UNORDERED_ACCESS_VIEW_DESC_u, +}} +STRUCT!{struct D3D12_BUFFER_RTV { + FirstElement: UINT64, + NumElements: UINT, +}} +STRUCT!{struct D3D12_TEX1D_RTV { + MipSlice: UINT, +}} +STRUCT!{struct D3D12_TEX1D_ARRAY_RTV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D12_TEX2D_RTV { + MipSlice: UINT, + PlaneSlice: UINT, +}} +STRUCT!{struct D3D12_TEX2DMS_RTV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D12_TEX2D_ARRAY_RTV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, + PlaneSlice: UINT, +}} +STRUCT!{struct D3D12_TEX2DMS_ARRAY_RTV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D12_TEX3D_RTV { + MipSlice: UINT, + FirstWSlice: UINT, + WSize: UINT, +}} +ENUM!{enum D3D12_RTV_DIMENSION { + D3D12_RTV_DIMENSION_UNKNOWN = 0, + D3D12_RTV_DIMENSION_BUFFER = 1, + D3D12_RTV_DIMENSION_TEXTURE1D = 2, + D3D12_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D12_RTV_DIMENSION_TEXTURE2D = 4, + D3D12_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D12_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D12_RTV_DIMENSION_TEXTURE3D = 8, +}} +UNION!{union D3D12_RENDER_TARGET_VIEW_DESC_u { + [u64; 2], + Buffer Buffer_mut: D3D12_BUFFER_RTV, + Texture1D Texture1D_mut: D3D12_TEX1D_RTV, + Texture1DArray Texture1DArray_mut: D3D12_TEX1D_ARRAY_RTV, + Texture2D Texture2D_mut: D3D12_TEX2D_RTV, + Texture2DArray Texture2DArray_mut: D3D12_TEX2D_ARRAY_RTV, + Texture2DMS Texture2DMS_mut: D3D12_TEX2DMS_RTV, + Texture2DMSArray Texture2DMSArray_mut: D3D12_TEX2DMS_ARRAY_RTV, + Texture3D Texture3D_mut: D3D12_TEX3D_RTV, +}} +STRUCT!{struct D3D12_RENDER_TARGET_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D12_RTV_DIMENSION, + u: D3D12_RENDER_TARGET_VIEW_DESC_u, +}} +STRUCT!{struct D3D12_TEX1D_DSV { + MipSlice: UINT, +}} +STRUCT!{struct D3D12_TEX1D_ARRAY_DSV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D12_TEX2D_DSV { + MipSlice: UINT, +}} +STRUCT!{struct D3D12_TEX2D_ARRAY_DSV { + MipSlice: UINT, + FirstArraySlice: UINT, + ArraySize: UINT, +}} +STRUCT!{struct D3D12_TEX2DMS_DSV { + UnusedField_NothingToDefine: UINT, +}} +STRUCT!{struct D3D12_TEX2DMS_ARRAY_DSV { + FirstArraySlice: UINT, + ArraySize: UINT, +}} +ENUM!{enum D3D12_DSV_FLAGS { + D3D12_DSV_FLAG_NONE = 0x0, + D3D12_DSV_FLAG_READ_ONLY_DEPTH = 0x1, + D3D12_DSV_FLAG_READ_ONLY_STENCIL = 0x2, +}} +ENUM!{enum D3D12_DSV_DIMENSION { + D3D12_DSV_DIMENSION_UNKNOWN = 0, + D3D12_DSV_DIMENSION_TEXTURE1D = 1, + D3D12_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D12_DSV_DIMENSION_TEXTURE2D = 3, + D3D12_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D12_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, +}} +UNION!{union D3D12_DEPTH_STENCIL_VIEW_DESC_u { + [u32; 3], + Texture1D Texture1D_mut: D3D12_TEX1D_DSV, + Texture1DArray Texture1DArray_mut: D3D12_TEX1D_ARRAY_DSV, + Texture2D Texture2D_mut: D3D12_TEX2D_DSV, + Texture2DArray Texture2DArray_mut: D3D12_TEX2D_ARRAY_DSV, + Texture2DMS Texture2DMS_mut: D3D12_TEX2DMS_DSV, + Texture2DMSArray Texture2DMSArray_mut: D3D12_TEX2DMS_ARRAY_DSV, +}} +STRUCT!{struct D3D12_DEPTH_STENCIL_VIEW_DESC { + Format: DXGI_FORMAT, + ViewDimension: D3D12_DSV_DIMENSION, + Flags: D3D12_DSV_FLAGS, + u: D3D12_DEPTH_STENCIL_VIEW_DESC_u, +}} +ENUM!{enum D3D12_CLEAR_FLAGS { + D3D12_CLEAR_FLAG_DEPTH = 0x1, + D3D12_CLEAR_FLAG_STENCIL = 0x2, +}} +ENUM!{enum D3D12_FENCE_FLAGS { + D3D12_FENCE_FLAG_NONE = 0x0, + D3D12_FENCE_FLAG_SHARED = 0x1, + D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x2, +}} +ENUM!{enum D3D12_DESCRIPTOR_HEAP_TYPE { + D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV = 0, + D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER = 1, + D3D12_DESCRIPTOR_HEAP_TYPE_RTV = 2, + D3D12_DESCRIPTOR_HEAP_TYPE_DSV = 3, + D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES = 4, +}} +ENUM!{enum D3D12_DESCRIPTOR_HEAP_FLAGS { + D3D12_DESCRIPTOR_HEAP_FLAG_NONE = 0x0, + D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE = 0x1, +}} +STRUCT!{struct D3D12_DESCRIPTOR_HEAP_DESC { + Type: D3D12_DESCRIPTOR_HEAP_TYPE, + NumDescriptors: UINT, + Flags: D3D12_DESCRIPTOR_HEAP_FLAGS, + NodeMask: UINT, +}} +ENUM!{enum D3D12_DESCRIPTOR_RANGE_TYPE { + D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, + D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1, + D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2, + D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER = 3, +}} +STRUCT!{struct D3D12_DESCRIPTOR_RANGE { + RangeType: D3D12_DESCRIPTOR_RANGE_TYPE, + NumDescriptors: UINT, + BaseShaderRegister: UINT, + RegisterSpace: UINT, + OffsetInDescriptorsFromTableStart: UINT, +}} +STRUCT!{struct D3D12_ROOT_DESCRIPTOR_TABLE { + NumDescriptorRanges: UINT, + pDescriptorRanges: *const D3D12_DESCRIPTOR_RANGE, +}} +STRUCT!{struct D3D12_ROOT_CONSTANTS { + ShaderRegister: UINT, + RegisterSpace: UINT, + Num32BitValues: UINT, +}} +STRUCT!{struct D3D12_ROOT_DESCRIPTOR { + ShaderRegister: UINT, + RegisterSpace: UINT, +}} +ENUM!{enum D3D12_SHADER_VISIBILITY { + D3D12_SHADER_VISIBILITY_ALL = 0, + D3D12_SHADER_VISIBILITY_VERTEX = 1, + D3D12_SHADER_VISIBILITY_HULL = 2, + D3D12_SHADER_VISIBILITY_DOMAIN = 3, + D3D12_SHADER_VISIBILITY_GEOMETRY = 4, + D3D12_SHADER_VISIBILITY_PIXEL = 5, +}} +ENUM!{enum D3D12_ROOT_PARAMETER_TYPE { + D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0, + D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 1, + D3D12_ROOT_PARAMETER_TYPE_CBV = 2, + D3D12_ROOT_PARAMETER_TYPE_SRV = 3, + D3D12_ROOT_PARAMETER_TYPE_UAV = 4, +}} +UNION!{union D3D12_ROOT_PARAMETER_u { + [u32; 3] [u64; 2], + DescriptorTable DescriptorTable_mut: D3D12_ROOT_DESCRIPTOR_TABLE, + Constants Constants_mut: D3D12_ROOT_CONSTANTS, + Descriptor Descriptor_mut: D3D12_ROOT_DESCRIPTOR, +}} +STRUCT!{struct D3D12_ROOT_PARAMETER { + ParameterType: D3D12_ROOT_PARAMETER_TYPE, + u: D3D12_ROOT_PARAMETER_u, + ShaderVisibility: D3D12_SHADER_VISIBILITY, +}} +ENUM!{enum D3D12_ROOT_SIGNATURE_FLAGS { + D3D12_ROOT_SIGNATURE_FLAG_NONE = 0x0, + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT = 0x1, + D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS = 0x2, + D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS = 0x4, + D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS = 0x8, + D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS = 0x10, + D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS = 0x20, + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40, +}} +ENUM!{enum D3D12_STATIC_BORDER_COLOR { + D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK = 0, + D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK = 1, + D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE = 2, +}} +STRUCT!{struct D3D12_STATIC_SAMPLER_DESC { + Filter: D3D12_FILTER, + AddressU: D3D12_TEXTURE_ADDRESS_MODE, + AddressV: D3D12_TEXTURE_ADDRESS_MODE, + AddressW: D3D12_TEXTURE_ADDRESS_MODE, + MipLODBias: FLOAT, + MaxAnisotropy: UINT, + ComparisonFunc: D3D12_COMPARISON_FUNC, + BorderColor: D3D12_STATIC_BORDER_COLOR, + MinLOD: FLOAT, + MaxLOD: FLOAT, + ShaderRegister: UINT, + RegisterSpace: UINT, + ShaderVisibility: D3D12_SHADER_VISIBILITY, +}} +STRUCT!{struct D3D12_ROOT_SIGNATURE_DESC { + NumParameters: UINT, + pParameters: *const D3D12_ROOT_PARAMETER, + NumStaticSamplers: UINT, + pStaticSamplers: *const D3D12_STATIC_SAMPLER_DESC, + Flags: D3D12_ROOT_SIGNATURE_FLAGS, +}} +ENUM!{enum D3D12_DESCRIPTOR_RANGE_FLAGS { + D3D12_DESCRIPTOR_RANGE_FLAG_NONE = 0, + D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE = 0x1, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE = 0x2, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC = 0x8, +}} +STRUCT!{struct D3D12_DESCRIPTOR_RANGE1 { + RangeType: D3D12_DESCRIPTOR_RANGE_TYPE, + NumDescriptors: UINT, + BaseShaderRegister: UINT, + RegisterSpace: UINT, + Flags: D3D12_DESCRIPTOR_RANGE_FLAGS, + OffsetInDescriptorsFromTableStart: UINT, +}} +STRUCT!{struct D3D12_ROOT_DESCRIPTOR_TABLE1 { + NumDescriptorRanges: UINT, + pDescriptorRanges: *const D3D12_DESCRIPTOR_RANGE1, +}} +ENUM!{enum D3D12_ROOT_DESCRIPTOR_FLAGS { + D3D12_ROOT_DESCRIPTOR_FLAG_NONE = 0, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_VOLATILE = 0x2, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC = 0x8, +}} +STRUCT!{struct D3D12_ROOT_DESCRIPTOR1 { + ShaderRegister: UINT, + RegisterSpace: UINT, + Flags: D3D12_ROOT_DESCRIPTOR_FLAGS, +}} +UNION!{union D3D12_ROOT_PARAMETER1_u { + [u32; 3] [u64; 2], + DescriptorTable DescriptorTable_mut: D3D12_ROOT_DESCRIPTOR_TABLE1, + Constants Constants_mut: D3D12_ROOT_CONSTANTS, + Descriptor Descriptor_mut: D3D12_ROOT_DESCRIPTOR1, +}} +STRUCT!{struct D3D12_ROOT_PARAMETER1 { + ParameterType: D3D12_ROOT_PARAMETER_TYPE, + u: D3D12_ROOT_PARAMETER1_u, + ShaderVisibility: D3D12_SHADER_VISIBILITY, +}} +STRUCT!{struct D3D12_ROOT_SIGNATURE_DESC1 { + NumParameters: UINT, + pParameters: *const D3D12_ROOT_PARAMETER1, + NumStaticSamplers: UINT, + pStaticSamplers: *const D3D12_STATIC_SAMPLER_DESC, + Flags: D3D12_ROOT_SIGNATURE_FLAGS, +}} +UNION!{union D3D12_VERSIONED_ROOT_SIGNATURE_DESC_u { + [u32; 5] [u64; 5], + Desc_1_0 Desc_1_0_mut: D3D12_ROOT_SIGNATURE_DESC, + Desc_1_1 Desc_1_1_mut: D3D12_ROOT_SIGNATURE_DESC1, +}} +STRUCT!{struct D3D12_VERSIONED_ROOT_SIGNATURE_DESC { + Version: UINT, + u: D3D12_VERSIONED_ROOT_SIGNATURE_DESC_u, +}} +RIDL!{#[uuid(0x34ab647b, 0x3cc8, 0x46ac, 0x84, 0x1b, 0xc0, 0x96, 0x56, 0x45, 0xc0, 0x46)] +interface ID3D12RootSignatureDeserializer(ID3D12RootSignatureDeserializerVtbl): + IUnknown(IUnknownVtbl) { + fn GetRootSignatureDesc() -> *const D3D12_ROOT_SIGNATURE_DESC, +}} +RIDL!{#[uuid(0x7f91ce67, 0x090c, 0x4bb7, 0xb7, 0x8e, 0xed, 0x8f, 0xf2, 0xe3, 0x1d, 0xa0)] +interface ID3D12VersionedRootSignatureDeserializer(ID3D12VersionedRootSignatureDeserializerVtbl): + IUnknown(IUnknownVtbl) { + fn GetRootSignatureDescAtVersion( + convertToVersion: D3D_ROOT_SIGNATURE_VERSION, + ppDesc: *mut *mut D3D12_VERSIONED_ROOT_SIGNATURE_DESC, + ) -> HRESULT, + fn GetUnconvertedRootSignatureDesc() -> *const D3D12_VERSIONED_ROOT_SIGNATURE_DESC, +}} +FN!{stdcall PFN_D3D12_SERIALIZE_ROOT_SIGNATURE( + pRootSignature: *const D3D12_ROOT_SIGNATURE_DESC, + Version: D3D_ROOT_SIGNATURE_VERSION, + ppBlob: *mut *mut ID3DBlob, + ppErrorBlob: *mut *mut ID3DBlob, +) -> HRESULT} +extern "system" { + pub fn D3D12SerializeRootSignature( + pRootSignature: *const D3D12_ROOT_SIGNATURE_DESC, + Version: D3D_ROOT_SIGNATURE_VERSION, + ppBlob: *mut *mut ID3DBlob, + ppErrorBlob: *mut *mut ID3DBlob, + ) -> HRESULT; +} +FN!{stdcall PFN_D3D12_CREATE_ROOT_SIGNATURE_DESERIALIZER( + pSrcData: LPCVOID, + SrcDataSizeInBytes: SIZE_T, + pRootSignatureDeserializerInterface: REFIID, + ppRootSignatureDeserializer: *mut *mut c_void, +) -> HRESULT} +extern "system" { + pub fn D3D12CreateRootSignatureDeserializer( + pSrcData: LPCVOID, + SrcDataSizeInBytes: SIZE_T, + pRootSignatureDeserializerInterface: REFGUID, + ppRootSignatureDeserializer: *mut *mut c_void, + ) -> HRESULT; +} +FN!{stdcall PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE( + pRootSignature: *const D3D12_VERSIONED_ROOT_SIGNATURE_DESC, + ppBlob: *mut *mut ID3DBlob, + ppErrorBlob: *mut *mut ID3DBlob, +) -> HRESULT} +extern "system" { + pub fn D3D12SerializeVersionedRootSignature( + pRootSignature: *const D3D12_VERSIONED_ROOT_SIGNATURE_DESC, + ppBlob: *mut *mut ID3DBlob, + ppErrorBlob: *mut *mut ID3DBlob, + ) -> HRESULT; +} +FN!{stdcall PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER( + pSrcData: LPCVOID, + SrcDataSizeInBytes: SIZE_T, + pRootSignatureDeserializerInterface: REFIID, + ppRootSignatureDeserializer: *mut *mut c_void, +) -> HRESULT} +extern "system" { + pub fn D3D12CreateVersionedRootSignatureDeserializer( + pSrcData: LPCVOID, + SrcDataSizeInBytes: SIZE_T, + pRootSignatureDeserializerInterface: REFIID, + ppRootSignatureDeserializer: *mut *mut c_void, + ) -> HRESULT; +} +STRUCT!{struct D3D12_CPU_DESCRIPTOR_HANDLE { + ptr: SIZE_T, +}} +STRUCT!{struct D3D12_GPU_DESCRIPTOR_HANDLE { + ptr: UINT64, +}} +STRUCT!{struct D3D12_DISCARD_REGION { + NumRects: UINT, + pRects: *const D3D12_RECT, + FirstSubresource: UINT, + NumSubresources: UINT, +}} +ENUM!{enum D3D12_QUERY_HEAP_TYPE { + D3D12_QUERY_HEAP_TYPE_OCCLUSION = 0, + D3D12_QUERY_HEAP_TYPE_TIMESTAMP = 1, + D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS = 2, + D3D12_QUERY_HEAP_TYPE_SO_STATISTICS = 3, +}} +STRUCT!{struct D3D12_QUERY_HEAP_DESC { + Type: D3D12_QUERY_HEAP_TYPE, + Count: UINT, + NodeMask: UINT, +}} +ENUM!{enum D3D12_QUERY_TYPE { + D3D12_QUERY_TYPE_OCCLUSION = 0, + D3D12_QUERY_TYPE_BINARY_OCCLUSION = 1, + D3D12_QUERY_TYPE_TIMESTAMP = 2, + D3D12_QUERY_TYPE_PIPELINE_STATISTICS = 3, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 = 4, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM1 = 5, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM2 = 6, + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3 = 7, +}} +ENUM!{enum D3D12_PREDICATION_OP { + D3D12_PREDICATION_OP_EQUAL_ZERO = 0, + D3D12_PREDICATION_OP_NOT_EQUAL_ZERO = 1, +}} +STRUCT!{struct D3D12_QUERY_DATA_PIPELINE_STATISTICS { + IAVertices: UINT64, + IAPrimitives: UINT64, + VSInvocations: UINT64, + GSInvocations: UINT64, + GSPrimitives: UINT64, + CInvocations: UINT64, + CPrimitives: UINT64, + PSInvocations: UINT64, + HSInvocations: UINT64, + DSInvocations: UINT64, + CSInvocations: UINT64, +}} +STRUCT!{struct D3D12_QUERY_DATA_SO_STATISTICS { + NumPrimitivesWritten: UINT64, + PrimitivesStorageNeeded: UINT64, +}} +STRUCT!{struct D3D12_STREAM_OUTPUT_BUFFER_VIEW { + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: UINT64, + BufferFilledSizeLocation: D3D12_GPU_VIRTUAL_ADDRESS, +}} +STRUCT!{struct D3D12_DRAW_ARGUMENTS { + VertexCountPerInstance: UINT, + InstanceCount: UINT, + StartVertexLocation: UINT, + StartInstanceLocation: UINT, +}} +STRUCT!{struct D3D12_DRAW_INDEXED_ARGUMENTS { + IndexCountPerInstance: UINT, + InstanceCount: UINT, + StartIndexLocation: UINT, + BaseVertexLocation: INT, + StartInstanceLocation: UINT, +}} +STRUCT!{struct D3D12_DISPATCH_ARGUMENTS { + ThreadGroupCountX: UINT, + ThreadGroupCountY: UINT, + ThreadGroupCountZ: UINT, +}} +STRUCT!{struct D3D12_VERTEX_BUFFER_VIEW { + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: UINT, + StrideInBytes: UINT, +}} +STRUCT!{struct D3D12_INDEX_BUFFER_VIEW { + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + SizeInBytes: UINT, + Format: DXGI_FORMAT, +}} +ENUM!{enum D3D12_INDIRECT_ARGUMENT_TYPE { + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW = 0, + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED = 1, + D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH = 2, + D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW = 3, + D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW = 4, + D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT = 5, + D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW = 6, + D3D12_INDIRECT_ARGUMENT_TYPE_SHADER_RESOURCE_VIEW = 7, + D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW = 8, +}} +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_VertexBuffer { + Slot: UINT, +}} +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_Constant { + RootParameterIndex: UINT, + DestOffsetIn32BitValues: UINT, + Num32BitValuesToSet: UINT, +}} +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_ConstantBufferView { + RootParameterIndex: UINT, +}} +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_ShaderResourceView { + RootParameterIndex: UINT, +}} +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_UnorderedAccessView { + RootParameterIndex: UINT, +}} +UNION!{union D3D12_INDIRECT_ARGUMENT_DESC_u { + [u32; 3], + VertexBuffer VertexBuffer_mut: D3D12_INDIRECT_ARGUMENT_DESC_VertexBuffer, + Constant Constant_mut: D3D12_INDIRECT_ARGUMENT_DESC_Constant, + ConstantBufferView ConstantBufferView_mut: D3D12_INDIRECT_ARGUMENT_DESC_ConstantBufferView, + ShaderResourceView ShaderResourceView_mut: D3D12_INDIRECT_ARGUMENT_DESC_ShaderResourceView, + UnorderedAccessView UnorderedAccessView_mut: D3D12_INDIRECT_ARGUMENT_DESC_UnorderedAccessView, +}} +STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC { + Type: D3D12_INDIRECT_ARGUMENT_TYPE, + u: D3D12_INDIRECT_ARGUMENT_DESC_u, +}} +STRUCT!{struct D3D12_COMMAND_SIGNATURE_DESC { + ByteStride: UINT, + NumArgumentDescs: UINT, + pArgumentDescs: *const D3D12_INDIRECT_ARGUMENT_DESC, + NodeMask: UINT, +}} +RIDL!{#[uuid(0xc4fec28f, 0x7966, 0x4e95, 0x9f, 0x94, 0xf4, 0x31, 0xcb, 0x56, 0xc3, 0xb8)] +interface ID3D12Object(ID3D12ObjectVtbl): IUnknown(IUnknownVtbl) { + fn GetPrivateData( + guid: REFGUID, + pDataSize: *mut UINT, + pData: *mut c_void, + ) -> HRESULT, + fn SetPrivateData( + guid: REFGUID, + DataSize: UINT, + pData: *const c_void, + ) -> HRESULT, + fn SetPrivateDataInterface( + guid: REFGUID, + pData: *const IUnknown, + ) -> HRESULT, + fn SetName( + Name: LPCWSTR, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x905db94b, 0xa00c, 0x4140, 0x9d, 0xf5, 0x2b, 0x64, 0xca, 0x9e, 0xa3, 0x57)] +interface ID3D12DeviceChild(ID3D12DeviceChildVtbl): ID3D12Object(ID3D12ObjectVtbl) { + fn GetDevice( + riid: REFIID, + ppvDevice: *mut *mut c_void, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x63ee58fb, 0x1268, 0x4835, 0x86, 0xda, 0xf0, 0x08, 0xce, 0x62, 0xf0, 0xd6)] +interface ID3D12Pageable(ID3D12PageableVtbl): ID3D12DeviceChild(ID3D12DeviceChildVtbl) {}} +RIDL!(#[uuid(0x6b3b2502, 0x6e51, 0x45b3, 0x90, 0xee, 0x98, 0x84, 0x26, 0x5e, 0x8d, 0xf3)] +interface ID3D12Heap(ID3D12HeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + #[fixme] fn GetDesc() -> D3D12_HEAP_DESC, +}); +RIDL!(#[uuid(0x696442be, 0xa72e, 0x4059, 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad)] +interface ID3D12Resource(ID3D12ResourceVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn Map( + Subresource: UINT, + pReadRange: *const D3D12_RANGE, + ppData: *mut *mut c_void, + ) -> HRESULT, + fn Unmap( + Subresource: UINT, + pWrittenRange: *const D3D12_RANGE, + ) -> (), + #[fixme] fn GetDesc() -> D3D12_RESOURCE_DESC, + fn GetGPUVirtualAddress() -> D3D12_GPU_VIRTUAL_ADDRESS, + fn WriteToSubresource( + DstSubresource: UINT, + pDstBox: *const D3D12_BOX, + pSrcData: *const c_void, + SrcRowPitch: UINT, + SrcDepthPitch: UINT, + ) -> HRESULT, + fn ReadFromSubresource( + pDstData: *mut c_void, + DstRowPitch: UINT, + DstDepthPitch: UINT, + SrcSubresource: UINT, + pSrcBox: *const D3D12_BOX, + ) -> HRESULT, + fn GetHeapProperties( + pHeapProperties: *mut D3D12_HEAP_PROPERTIES, + pHeapFlags: *mut D3D12_HEAP_FLAGS, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x6102dee4, 0xaf59, 0x4b09, 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24)] +interface ID3D12CommandAllocator(ID3D12CommandAllocatorVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn Reset() -> HRESULT, +}); +RIDL!(#[uuid(0x0a753dcf, 0xc4d8, 0x4b91, 0xad, 0xf6, 0xbe, 0x5a, 0x60, 0xd9, 0x5a, 0x76)] +interface ID3D12Fence(ID3D12FenceVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn GetCompletedValue() -> UINT64, + fn SetEventOnCompletion( + Value: UINT64, + hEvent: HANDLE, + ) -> HRESULT, + fn Signal( + Value: UINT64, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x765a30f3, 0xf624, 0x4c6f, 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45)] +interface ID3D12PipelineState(ID3D12PipelineStateVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn GetCachedBlob( + ppBlob: *mut *mut ID3DBlob, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8efb471d, 0x616c, 0x4f49, 0x90, 0xf7, 0x12, 0x7b, 0xb7, 0x63, 0xfa, 0x51)] +interface ID3D12DescriptorHeap(ID3D12DescriptorHeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + #[fixme] fn GetDesc() -> D3D12_DESCRIPTOR_HEAP_DESC, + #[fixme] fn GetCPUDescriptorHandleForHeapStart() -> D3D12_CPU_DESCRIPTOR_HANDLE, + #[fixme] fn GetGPUDescriptorHandleForHeapStart() -> D3D12_GPU_DESCRIPTOR_HANDLE, +}); +RIDL!{#[uuid(0x0d9658ae, 0xed45, 0x469e, 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4)] +interface ID3D12QueryHeap(ID3D12QueryHeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) {}} +RIDL!{#[uuid(0xc36a797c, 0xec80, 0x4f0a, 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1)] +interface ID3D12CommandSignature(ID3D12CommandSignatureVtbl): + ID3D12Pageable(ID3D12PageableVtbl) {}} +RIDL!(#[uuid(0x7116d91c, 0xe7e4, 0x47ce, 0xb8, 0xc6, 0xec, 0x81, 0x68, 0xf4, 0x37, 0xe5)] +interface ID3D12CommandList(ID3D12CommandListVtbl): ID3D12DeviceChild(ID3D12DeviceChildVtbl) { + fn GetType() -> D3D12_COMMAND_LIST_TYPE, +}); +RIDL!{#[uuid(0x5b160d0f, 0xac1b, 0x4185, 0x8b, 0xa8, 0xb3, 0xae, 0x42, 0xa5, 0xa4, 0x55)] +interface ID3D12GraphicsCommandList(ID3D12GraphicsCommandListVtbl): + ID3D12CommandList(ID3D12CommandListVtbl) { + fn Close() -> HRESULT, + fn Reset( + pAllocator: *mut ID3D12CommandAllocator, + pInitialState: *mut ID3D12PipelineState, + ) -> HRESULT, + fn ClearState( + pPipelineState: *mut ID3D12PipelineState, + ) -> (), + fn DrawInstanced( + VertexCountPerInstance: UINT, + InstanceCount: UINT, + StartVertexLocation: UINT, + StartInstanceLocation: UINT, + ) -> (), + fn DrawIndexedInstanced( + IndexCountPerInstance: UINT, + InstanceCount: UINT, + StartIndexLocation: UINT, + BaseVertexLocation: INT, + StartInstanceLocation: UINT, + ) -> (), + fn Dispatch( + ThreadGroupCountX: UINT, + ThreadGroupCountY: UINT, + ThreadGroupCountZ: UINT, + ) -> (), + fn CopyBufferRegion( + pDstBuffer: *mut ID3D12Resource, + DstOffset: UINT64, + pSrcBuffer: *mut ID3D12Resource, + SrcOffset: UINT64, + NumBytes: UINT64, + ) -> (), + fn CopyTextureRegion( + pDst: *const D3D12_TEXTURE_COPY_LOCATION, + DstX: UINT, + DstY: UINT, + DstZ: UINT, + pSrc: *const D3D12_TEXTURE_COPY_LOCATION, + pSrcBox: *const D3D12_BOX, + ) -> (), + fn CopyResource( + pDstResource: *mut ID3D12Resource, + pSrcResource: *mut ID3D12Resource, + ) -> (), + fn CopyTiles( + pTiledResource: *mut ID3D12Resource, + pTileRegionStartCoordinate: *const D3D12_TILED_RESOURCE_COORDINATE, + pTileRegionSize: *const D3D12_TILE_REGION_SIZE, + pBuffer: *mut ID3D12Resource, + BufferStartOffsetInBytes: UINT64, + Flags: D3D12_TILE_COPY_FLAGS, + ) -> (), + fn ResolveSubresource( + pDstResource: *mut ID3D12Resource, + DstSubresource: UINT, + pSrcResource: *mut ID3D12Resource, + SrcSubresource: UINT, + Format: DXGI_FORMAT, + ) -> (), + fn IASetPrimitiveTopology( + PrimitiveTopology: D3D12_PRIMITIVE_TOPOLOGY, + ) -> (), + fn RSSetViewports( + NumViewports: UINT, + pViewports: *const D3D12_VIEWPORT, + ) -> (), + fn RSSetScissorRects( + NumRects: UINT, + pRects: *const D3D12_RECT, + ) -> (), + fn OMSetBlendFactor( + BlendFactor: *const [FLOAT; 4], + ) -> (), + fn OMSetStencilRef( + StencilRef: UINT, + ) -> (), + fn SetPipelineState( + pPipelineState: *mut ID3D12PipelineState, + ) -> (), + fn ResourceBarrier( + NumBarriers: UINT, + pBarriers: *const D3D12_RESOURCE_BARRIER, + ) -> (), + fn ExecuteBundle( + pCommandList: *mut ID3D12GraphicsCommandList, + ) -> (), + fn SetDescriptorHeaps( + NumDescriptorHeaps: UINT, + ppDescriptorHeaps: *mut *mut ID3D12DescriptorHeap, + ) -> (), + fn SetComputeRootSignature( + pRootSignature: *mut ID3D12RootSignature, + ) -> (), + fn SetGraphicsRootSignature( + pRootSignature: *mut ID3D12RootSignature, + ) -> (), + fn SetComputeRootDescriptorTable( + RootParameterIndex: UINT, + BaseDescriptor: D3D12_GPU_DESCRIPTOR_HANDLE, + ) -> (), + fn SetGraphicsRootDescriptorTable( + RootParameterIndex: UINT, + BaseDescriptor: D3D12_GPU_DESCRIPTOR_HANDLE, + ) -> (), + fn SetComputeRoot32BitConstant( + RootParameterIndex: UINT, + SrcData: UINT, + DestOffsetIn32BitValues: UINT, + ) -> (), + fn SetGraphicsRoot32BitConstant( + RootParameterIndex: UINT, + SrcData: UINT, + DestOffsetIn32BitValues: UINT, + ) -> (), + fn SetComputeRoot32BitConstants( + RootParameterIndex: UINT, + Num32BitValuesToSet: UINT, + pSrcData: *const c_void, + DestOffsetIn32BitValues: UINT, + ) -> (), + fn SetGraphicsRoot32BitConstants( + RootParameterIndex: UINT, + Num32BitValuesToSet: UINT, + pSrcData: *const c_void, + DestOffsetIn32BitValues: UINT, + ) -> (), + fn SetComputeRootConstantBufferView( + RootParameterIndex: UINT, + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + ) -> (), + fn SetGraphicsRootConstantBufferView( + RootParameterIndex: UINT, + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + ) -> (), + fn SetComputeRootShaderResourceView( + RootParameterIndex: UINT, + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + ) -> (), + fn SetGraphicsRootShaderResourceView( + RootParameterIndex: UINT, + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + ) -> (), + fn SetComputeRootUnorderedAccessView( + RootParameterIndex: UINT, + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + ) -> (), + fn SetGraphicsRootUnorderedAccessView( + RootParameterIndex: UINT, + BufferLocation: D3D12_GPU_VIRTUAL_ADDRESS, + ) -> (), + fn IASetIndexBuffer( + pView: *const D3D12_INDEX_BUFFER_VIEW, + ) -> (), + fn IASetVertexBuffers( + StartSlot: UINT, + NumViews: UINT, + pViews: *const D3D12_VERTEX_BUFFER_VIEW, + ) -> (), + fn SOSetTargets( + StartSlot: UINT, + NumViews: UINT, + pViews: *const D3D12_STREAM_OUTPUT_BUFFER_VIEW, + ) -> (), + fn OMSetRenderTargets( + NumRenderTargetDescriptors: UINT, + pRenderTargetDescriptors: *const D3D12_CPU_DESCRIPTOR_HANDLE, + RTsSingleHandleToDescriptorRange: BOOL, + pDepthStencilDescriptor: *const D3D12_CPU_DESCRIPTOR_HANDLE, + ) -> (), + fn ClearDepthStencilView( + DepthStencilView: D3D12_CPU_DESCRIPTOR_HANDLE, + ClearFlags: D3D12_CLEAR_FLAGS, + Depth: FLOAT, + Stencil: UINT8, + NumRects: UINT, + pRects: *const D3D12_RECT, + ) -> (), + fn ClearRenderTargetView( + RenderTargetView: D3D12_CPU_DESCRIPTOR_HANDLE, + ColorRGBA: *const [FLOAT; 4], + NumRects: UINT, + pRects: *const D3D12_RECT, + ) -> (), + fn ClearUnorderedAccessViewUint( + ViewGPUHandleInCurrentHeap: D3D12_GPU_DESCRIPTOR_HANDLE, + ViewCPUHandle: D3D12_CPU_DESCRIPTOR_HANDLE, + pResource: *mut ID3D12Resource, + Values: *const [UINT; 4], + NumRects: UINT, + pRects: *const D3D12_RECT, + ) -> (), + fn ClearUnorderedAccessViewFloat( + ViewGPUHandleInCurrentHeap: D3D12_GPU_DESCRIPTOR_HANDLE, + ViewCPUHandle: D3D12_CPU_DESCRIPTOR_HANDLE, + pResource: *mut ID3D12Resource, + Values: *const [FLOAT; 4], + NumRects: UINT, + pRects: *const D3D12_RECT, + ) -> (), + fn DiscardResource( + pResource: *mut ID3D12Resource, + pRegion: *const D3D12_DISCARD_REGION, + ) -> (), + fn BeginQuery( + pQueryHeap: *mut ID3D12QueryHeap, + Type: D3D12_QUERY_TYPE, + Index: UINT, + ) -> (), + fn EndQuery( + pQueryHeap: *mut ID3D12QueryHeap, + Type: D3D12_QUERY_TYPE, + Index: UINT, + ) -> (), + fn ResolveQueryData( + pQueryHeap: *mut ID3D12QueryHeap, + Type: D3D12_QUERY_TYPE, + StartIndex: UINT, + NumQueries: UINT, + pDestinationBuffer: *mut ID3D12Resource, + AlignedDestinationBufferOffset: UINT64, + ) -> (), + fn SetPredication( + pBuffer: *mut ID3D12Resource, + AlignedBufferOffset: UINT64, + Operation: D3D12_PREDICATION_OP, + ) -> (), + fn SetMarker( + Metadata: UINT, + pData: *const c_void, + Size: UINT, + ) -> (), + fn BeginEvent( + Metadata: UINT, + pData: *const c_void, + Size: UINT, + ) -> (), + fn EndEvent() -> (), + fn ExecuteIndirect( + pCommandSignature: *mut ID3D12CommandSignature, + MaxCommandCount: UINT, + pArgumentBuffer: *mut ID3D12Resource, + ArgumentBufferOffset: UINT64, + pCountBuffer: *mut ID3D12Resource, + CountBufferOffset: UINT64, + ) -> (), +}} +RIDL!{#[uuid(0x553103fb, 0x1fe7, 0x4557, 0xbb, 0x38, 0x94, 0x6d, 0x7d, 0x0e, 0x7c, 0xa7)] +interface ID3D12GraphicsCommandList1(ID3D12GraphicsCommandList1Vtbl): + ID3D12GraphicsCommandList(ID3D12GraphicsCommandListVtbl) { + fn AtomicCopyBufferUINT( + pDstBuffer: *mut ID3D12Resource, + DstOffset: UINT64, + pSrcBuffer: *mut ID3D12Resource, + SrcOffset: UINT64, + Dependencies: UINT, + ppDependentResources: *const *mut ID3D12Resource, + pDependentSubresourceRanges: *mut D3D12_SUBRESOURCE_RANGE_UINT64, + ) -> (), + fn AtomicCopyBufferUINT64( + pDstBuffer: *mut ID3D12Resource, + DstOffset: UINT64, + pSrcBuffer: *mut ID3D12Resource, + SrcOffset: UINT64, + Dependencies: UINT, + ppDependentResources: *const *mut ID3D12Resource, + pDependentSubresourceRanges: *mut D3D12_SUBRESOURCE_RANGE_UINT64, + ) -> (), + fn OMSetDepthBounds( + Min: FLOAT, + Max: FLOAT, + ) -> (), + fn SetSamplePositions( + NumSamplesPerPixel: UINT, + NumPixels: UINT, + pSamplePositions: *mut D3D12_SAMPLE_POSITION, + ) -> (), + fn ResolveSubresourceRegion( + pDstResource: *mut ID3D12Resource, + DstSubresource: UINT, + DstX: UINT, + DstY: UINT, + pSrcResource: *mut ID3D12Resource, + SrcSubresource: UINT, + pSrcRect: *mut D3D12_RECT, + Format: DXGI_FORMAT, + ResolveMode: D3D12_RESOLVE_MODE, + ) -> (), +}} +RIDL!(#[uuid(0x0ec870a6, 0x5d7e, 0x4c22, 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed)] +interface ID3D12CommandQueue(ID3D12CommandQueueVtbl): ID3D12Pageable(ID3D12PageableVtbl) { + fn UpdateTileMappings( + pResource: *mut ID3D12Resource, + NumResourceRegions: UINT, + pResourceRegionStartCoordinates: *const D3D12_TILED_RESOURCE_COORDINATE, + pResourceRegionSizes: *const D3D12_TILE_REGION_SIZE, + pHeap: *mut ID3D12Heap, + NumRanges: UINT, + pRangeFlags: *const D3D12_TILE_RANGE_FLAGS, + pHeapRangeStartOffsets: *const UINT, + pRangeTileCounts: *const UINT, + Flags: D3D12_TILE_MAPPING_FLAGS, + ) -> (), + fn CopyTileMappings( + pDstResource: *mut ID3D12Resource, + pDstRegionStartCoordinate: *const D3D12_TILED_RESOURCE_COORDINATE, + pSrcResource: *mut ID3D12Resource, + pSrcRegionStartCoordinate: *const D3D12_TILED_RESOURCE_COORDINATE, + pRegionSize: *const D3D12_TILE_REGION_SIZE, + Flags: D3D12_TILE_MAPPING_FLAGS, + ) -> (), + fn ExecuteCommandLists( + NumCommandLists: UINT, + ppCommandLists: *const *mut ID3D12CommandList, + ) -> (), + fn SetMarker( + Metadata: UINT, + pData: *const c_void, + Size: UINT, + ) -> (), + fn BeginEvent( + Metadata: UINT, + pData: *const c_void, + Size: UINT, + ) -> (), + fn EndEvent() -> (), + fn Signal( + pFence: *mut ID3D12Fence, + Value: UINT64, + ) -> HRESULT, + fn Wait( + pFence: *mut ID3D12Fence, + Value: UINT64, + ) -> HRESULT, + fn GetTimestampFrequency( + pFrequency: *mut UINT64, + ) -> HRESULT, + fn GetClockCalibration( + pGpuTimestamp: *mut UINT64, + pCpuTimestamp: *mut UINT64, + ) -> HRESULT, + #[fixme] fn GetDesc() -> D3D12_COMMAND_QUEUE_DESC, +}); +RIDL!(#[uuid(0x189819f1, 0x1db6, 0x4b57, 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7)] +interface ID3D12Device(ID3D12DeviceVtbl): ID3D12Object(ID3D12ObjectVtbl) { + fn GetNodeCount() -> UINT, + fn CreateCommandQueue( + pDesc: *const D3D12_COMMAND_QUEUE_DESC, + riid: REFGUID, + ppCommandQueue: *mut *mut c_void, + ) -> HRESULT, + fn CreateCommandAllocator( + type_: D3D12_COMMAND_LIST_TYPE, + riid: REFGUID, + ppCommandAllocator: *mut *mut c_void, + ) -> HRESULT, + fn CreateGraphicsPipelineState( + pDesc: *const D3D12_GRAPHICS_PIPELINE_STATE_DESC, + riid: REFGUID, + ppPipelineState: *mut *mut c_void, + ) -> HRESULT, + fn CreateComputePipelineState( + pDesc: *const D3D12_COMPUTE_PIPELINE_STATE_DESC, + riid: REFGUID, + ppPipelineState: *mut *mut c_void, + ) -> HRESULT, + fn CreateCommandList( + nodeMask: UINT, + type_: D3D12_COMMAND_LIST_TYPE, + pCommandAllocator: *mut ID3D12CommandAllocator, + pInitialState: *mut ID3D12PipelineState, + riid: REFGUID, + ppCommandList: *mut *mut c_void, + ) -> HRESULT, + fn CheckFeatureSupport( + Feature: D3D12_FEATURE, + pFeatureSupportData: *mut c_void, + FeatureSupportDataSize: UINT, + ) -> HRESULT, + fn CreateDescriptorHeap( + pDescriptorHeapDesc: *const D3D12_DESCRIPTOR_HEAP_DESC, + riid: REFGUID, + ppvHeap: *mut *mut c_void, + ) -> HRESULT, + fn GetDescriptorHandleIncrementSize( + DescriptorHeapType: D3D12_DESCRIPTOR_HEAP_TYPE, + ) -> UINT, + fn CreateRootSignature( + nodeMask: UINT, + pBlobWithRootSignature: *const c_void, + blobLengthInBytes: SIZE_T, + riid: REFGUID, + ppvRootSignature: *mut *mut c_void, + ) -> HRESULT, + fn CreateConstantBufferView( + pDesc: *const D3D12_CONSTANT_BUFFER_VIEW_DESC, + DestDescriptor: D3D12_CPU_DESCRIPTOR_HANDLE, + ) -> (), + fn CreateShaderResourceView( + pResource: *mut ID3D12Resource, + pDesc: *const D3D12_SHADER_RESOURCE_VIEW_DESC, + DestDescriptor: D3D12_CPU_DESCRIPTOR_HANDLE, + ) -> (), + fn CreateUnorderedAccessView( + pResource: *mut ID3D12Resource, + pCounterResource: *mut ID3D12Resource, + pDesc: *const D3D12_UNORDERED_ACCESS_VIEW_DESC, + DestDescriptor: D3D12_CPU_DESCRIPTOR_HANDLE, + ) -> (), + fn CreateRenderTargetView( + pResource: *mut ID3D12Resource, + pDesc: *const D3D12_RENDER_TARGET_VIEW_DESC, + DestDescriptor: D3D12_CPU_DESCRIPTOR_HANDLE, + ) -> (), + fn CreateDepthStencilView( + pResource: *mut ID3D12Resource, + pDesc: *const D3D12_DEPTH_STENCIL_VIEW_DESC, + DestDescriptor: D3D12_CPU_DESCRIPTOR_HANDLE, + ) -> (), + fn CreateSampler( + pDesc: *const D3D12_SAMPLER_DESC, + DestDescriptor: D3D12_CPU_DESCRIPTOR_HANDLE, + ) -> (), + fn CopyDescriptors( + NumDestDescriptorRanges: UINT, + pDestDescriptorRangeStarts: *const D3D12_CPU_DESCRIPTOR_HANDLE, + pDestDescriptorRangeSizes: *const UINT, + NumSrcDescriptorRanges: UINT, + pSrcDescriptorRangeStarts: *const D3D12_CPU_DESCRIPTOR_HANDLE, + pSrcDescriptorRangeSizes: *const UINT, + DescriptorHeapsType: D3D12_DESCRIPTOR_HEAP_TYPE, + ) -> (), + fn CopyDescriptorsSimple( + NumDescriptors: UINT, + DestDescriptorRangeStart: D3D12_CPU_DESCRIPTOR_HANDLE, + SrcDescriptorRangeStart: D3D12_CPU_DESCRIPTOR_HANDLE, + DescriptorHeapsType: D3D12_DESCRIPTOR_HEAP_TYPE, + ) -> (), + #[fixme] fn GetResourceAllocationInfo( + visibleMask: UINT, + numResourceDescs: UINT, + pResourceDescs: *const D3D12_RESOURCE_DESC, + ) -> D3D12_RESOURCE_ALLOCATION_INFO, + #[fixme] fn GetCustomHeapProperties( + nodeMask: UINT, + heapType: D3D12_HEAP_TYPE, + ) -> D3D12_HEAP_PROPERTIES, + fn CreateCommittedResource( + pHeapProperties: *const D3D12_HEAP_PROPERTIES, + HeapFlags: D3D12_HEAP_FLAGS, + pResourceDesc: *const D3D12_RESOURCE_DESC, + InitialResourceState: D3D12_RESOURCE_STATES, + pOptimizedClearValue: *const D3D12_CLEAR_VALUE, + riidResource: REFGUID, + ppvResource: *mut *mut c_void, + ) -> HRESULT, + fn CreateHeap( + pDesc: *const D3D12_HEAP_DESC, + riid: REFGUID, + ppvHeap: *mut *mut c_void, + ) -> HRESULT, + fn CreatePlacedResource( + pHeap: *mut ID3D12Heap, + HeapOffset: UINT64, + pDesc: *const D3D12_RESOURCE_DESC, + InitialState: D3D12_RESOURCE_STATES, + pOptimizedClearValue: *const D3D12_CLEAR_VALUE, + riid: REFGUID, + ppvResource: *mut *mut c_void, + ) -> HRESULT, + fn CreateReservedResource( + pDesc: *const D3D12_RESOURCE_DESC, + InitialState: D3D12_RESOURCE_STATES, + pOptimizedClearValue: *const D3D12_CLEAR_VALUE, + riid: REFGUID, + ppvResource: *mut *mut c_void, + ) -> HRESULT, + fn CreateSharedHandle( + pObject: *mut ID3D12DeviceChild, + pAttributes: *const SECURITY_ATTRIBUTES, + Access: DWORD, + Name: LPCWSTR, + pHandle: *mut HANDLE, + ) -> HRESULT, + fn OpenSharedHandle( + NTHandle: HANDLE, + riid: REFGUID, + ppvObj: *mut *mut c_void, + ) -> HRESULT, + fn OpenSharedHandleByName( + Name: LPCWSTR, + Access: DWORD, + pNTHandle: *mut HANDLE, + ) -> HRESULT, + fn MakeResident( + NumObjects: UINT, + ppObjects: *mut *mut ID3D12Pageable, + ) -> HRESULT, + fn Evict( + NumObjects: UINT, + ppObjects: *mut *mut ID3D12Pageable, + ) -> HRESULT, + fn CreateFence( + InitialValue: UINT64, + Flags: D3D12_FENCE_FLAGS, + riid: REFGUID, + ppFence: *mut *mut c_void, + ) -> HRESULT, + fn GetDeviceRemovedReason() -> HRESULT, + fn GetCopyableFootprints( + pResourceDesc: *const D3D12_RESOURCE_DESC, + FirstSubresource: UINT, + NumSubresources: UINT, + BaseOffset: UINT64, + pLayouts: *mut D3D12_PLACED_SUBRESOURCE_FOOTPRINT, + pNumRows: *mut UINT, + pRowSizeInBytes: *mut UINT64, + pTotalBytes: *mut UINT64, + ) -> (), + fn CreateQueryHeap( + pDesc: *const D3D12_QUERY_HEAP_DESC, + riid: REFGUID, + ppvHeap: *mut *mut c_void, + ) -> HRESULT, + fn SetStablePowerState( + Enable: BOOL, + ) -> HRESULT, + fn CreateCommandSignature( + pDesc: *const D3D12_COMMAND_SIGNATURE_DESC, + pRootSignature: *mut ID3D12RootSignature, + riid: REFGUID, + ppvCommandSignature: *mut *mut c_void, + ) -> HRESULT, + fn GetResourceTiling( + pTiledResource: *mut ID3D12Resource, + pNumTilesForEntireResource: *mut UINT, + pPackedMipDesc: *mut D3D12_PACKED_MIP_INFO, + pStandardTileShapeForNonPackedMips: *mut D3D12_TILE_SHAPE, + pNumSubresourceTilings: *mut UINT, + FirstSubresourceTilingToGet: UINT, + pSubresourceTilingsForNonPackedMips: *mut D3D12_SUBRESOURCE_TILING, + ) -> (), + #[fixme] fn GetAdapterLuid() -> LUID, +}); +RIDL!(#[uuid(0xc64226a8, 0x9201, 0x46af, 0xb4, 0xcc, 0x53, 0xfb, 0x9f, 0xf7, 0x41, 0x4f)] +interface ID3D12PipelineLibrary(ID3D12PipelineLibraryVtbl): ID3D12DeviceChild(ID3D12DeviceChildVtbl) { + fn StorePipeline( + pName: LPCWSTR, + pPipeline: *mut ID3D12PipelineState, + ) -> HRESULT, + fn LoadGraphicsPipeline( + pName: LPCWSTR, + pDesc: *const D3D12_GRAPHICS_PIPELINE_STATE_DESC, + riid: REFIID, + ppPipelineState: *mut *mut c_void, + ) -> HRESULT, + fn LoadComputePipeline( + pName: LPCWSTR, + pDesc: *const D3D12_COMPUTE_PIPELINE_STATE_DESC, + riid: REFIID, + ppPipelineState: *mut *mut c_void, + ) -> HRESULT, + fn GetSerializedSize() -> SIZE_T, + fn Serialize( + pData: *mut c_void, + DataSizeInBytes: SIZE_T, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x80eabf42, 0x2568, 0x4e5e, 0xbd, 0x82, 0xc3, 0x7f, 0x86, 0x96, 0x1d, 0xc3)] +interface ID3D12PipelineLibrary1(ID3D12PipelineLibrary1Vtbl): ID3D12PipelineLibrary(ID3D12PipelineLibraryVtbl) { + fn LoadPipeline( + pName: LPCWSTR, + pDesc: *const D3D12_PIPELINE_STATE_STREAM_DESC, + riid: REFIID, + ppPipelineState: *mut *mut c_void, + ) -> HRESULT, +}); +ENUM!{enum D3D12_MULTIPLE_FENCE_WAIT_FLAGS { + D3D12_MULTIPLE_FENCE_WAIT_FLAG_NONE = 0, + D3D12_MULTIPLE_FENCE_WAIT_FLAG_ANY = 0x1, + D3D12_MULTIPLE_FENCE_WAIT_FLAG_ALL = 0, +}} +ENUM!{enum D3D12_RESIDENCY_PRIORITY { + D3D12_RESIDENCY_PRIORITY_MINIMUM = 0x28000000, + D3D12_RESIDENCY_PRIORITY_LOW = 0x50000000, + D3D12_RESIDENCY_PRIORITY_NORMAL = 0x78000000, + D3D12_RESIDENCY_PRIORITY_HIGH = 0xa0010000, + D3D12_RESIDENCY_PRIORITY_MAXIMUM = 0xc8000000, +}} +RIDL!(#[uuid(0x77acce80, 0x638e, 0x4e65, 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e)] +interface ID3D12Device1(ID3D12Device1Vtbl): ID3D12Device(ID3D12DeviceVtbl) { + fn CreatePipelineLibrary( + pLibraryBlob: *const c_void, + BlobLength: SIZE_T, + riid: REFIID, + ppPipelineLibrary: *mut *mut c_void, + ) -> HRESULT, + fn SetEventOnMultipleFenceCompletion( + ppFences: *const *mut ID3D12Fence, + pFenceValues: *const UINT64, + NumFences: UINT, + Flags: D3D12_MULTIPLE_FENCE_WAIT_FLAGS, + hEvent: HANDLE, + ) -> HRESULT, + fn SetResidencyPriority( + NumObjects: UINT, + ppObjects: *const *mut ID3D12Pageable, + pPriorities: *const D3D12_RESIDENCY_PRIORITY, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x30baa41e, 0xb15b, 0x475c, 0xa0, 0xbb, 0x1a, 0xf5, 0xc5, 0xb6, 0x43, 0x28)] +interface ID3D12Device2(ID3D12Device2Vtbl): ID3D12Device1(ID3D12Device1Vtbl) { + fn CreatePipelineState( + pDesc: *const D3D12_PIPELINE_STATE_STREAM_DESC, + riid: REFIID, + ppPipelineState: *mut *mut c_void, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x7071e1f0, 0xe84b, 0x4b33, 0x97, 0x4f, 0x12, 0xfa, 0x49, 0xde, 0x65, 0xc5)] +interface ID3D12Tools(ID3D12ToolsVtbl): IUnknown(IUnknownVtbl) { + fn EnableShaderInstrumentation( + bEnable: BOOL, + ) -> (), + fn ShaderInstrumentationEnabled() -> BOOL, +}); +STRUCT!{struct D3D12_SUBRESOURCE_DATA { + pData: *const c_void, + RowPitch: LONG_PTR, + SlicePitch: LONG_PTR, +}} +STRUCT!{struct D3D12_MEMCPY_DEST { + pData: *mut c_void, + RowPitch: SIZE_T, + SlicePitch: SIZE_T, +}} +FN!{stdcall PFN_D3D12_CREATE_DEVICE( + *mut IUnknown, + D3D_FEATURE_LEVEL, + REFIID, + *mut *mut c_void, +) -> HRESULT} +extern "system" { + pub fn D3D12CreateDevice( + pAdapter: *mut IUnknown, + MinimumFeatureLevel: D3D_FEATURE_LEVEL, + riid: REFGUID, + ppDevice: *mut *mut c_void, + ) -> HRESULT; +} +FN!{stdcall PFN_D3D12_GET_DEBUG_INTERFACE( + REFIID, + *mut *mut c_void, +) -> HRESULT} +extern "system" { + pub fn D3D12GetDebugInterface( + riid: REFGUID, + ppvDebug: *mut *mut c_void + ) -> HRESULT; + pub fn D3D12EnableExperimentalFeatures( + NumFeatures: UINT, + pIIDs: *const IID, + pConfigurationStructs: *mut c_void, + pConfigurationStructSizes: *mut UINT, + ) -> HRESULT; +} +DEFINE_GUID!{IID_ID3D12Object, + 0xc4fec28f, 0x7966, 0x4e95, 0x9f, 0x94, 0xf4, 0x31, 0xcb, 0x56, 0xc3, 0xb8} +DEFINE_GUID!{IID_ID3D12DeviceChild, + 0x905db94b, 0xa00c, 0x4140, 0x9d, 0xf5, 0x2b, 0x64, 0xca, 0x9e, 0xa3, 0x57} +DEFINE_GUID!{IID_ID3D12RootSignature, + 0xc54a6b66, 0x72df, 0x4ee8, 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14} +DEFINE_GUID!{IID_ID3D12RootSignatureDeserializer, + 0x34AB647B, 0x3CC8, 0x46AC, 0x84, 0x1B, 0xC0, 0x96, 0x56, 0x45, 0xC0, 0x46} +DEFINE_GUID!{IID_ID3D12VersionedRootSignatureDeserializer, + 0x7F91CE67, 0x090C, 0x4BB7, 0xB7, 0x8E, 0xED, 0x8F, 0xF2, 0xE3, 0x1D, 0xA0} +DEFINE_GUID!{IID_ID3D12Pageable, + 0x63ee58fb, 0x1268, 0x4835, 0x86, 0xda, 0xf0, 0x08, 0xce, 0x62, 0xf0, 0xd6} +DEFINE_GUID!{IID_ID3D12Heap, + 0x6b3b2502, 0x6e51, 0x45b3, 0x90, 0xee, 0x98, 0x84, 0x26, 0x5e, 0x8d, 0xf3} +DEFINE_GUID!{IID_ID3D12Resource, + 0x696442be, 0xa72e, 0x4059, 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad} +DEFINE_GUID!{IID_ID3D12CommandAllocator, + 0x6102dee4, 0xaf59, 0x4b09, 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24} +DEFINE_GUID!{IID_ID3D12Fence, + 0x0a753dcf, 0xc4d8, 0x4b91, 0xad, 0xf6, 0xbe, 0x5a, 0x60, 0xd9, 0x5a, 0x76} +DEFINE_GUID!{IID_ID3D12PipelineState, + 0x765a30f3, 0xf624, 0x4c6f, 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45} +DEFINE_GUID!{IID_ID3D12DescriptorHeap, + 0x8efb471d, 0x616c, 0x4f49, 0x90, 0xf7, 0x12, 0x7b, 0xb7, 0x63, 0xfa, 0x51} +DEFINE_GUID!{IID_ID3D12QueryHeap, + 0x0d9658ae, 0xed45, 0x469e, 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4} +DEFINE_GUID!{IID_ID3D12CommandSignature, + 0xc36a797c, 0xec80, 0x4f0a, 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1} +DEFINE_GUID!{IID_ID3D12CommandList, + 0x7116d91c, 0xe7e4, 0x47ce, 0xb8, 0xc6, 0xec, 0x81, 0x68, 0xf4, 0x37, 0xe5} +DEFINE_GUID!{IID_ID3D12GraphicsCommandList, + 0x5b160d0f, 0xac1b, 0x4185, 0x8b, 0xa8, 0xb3, 0xae, 0x42, 0xa5, 0xa4, 0x55} +DEFINE_GUID!{IID_ID3D12GraphicsCommandList1, + 0x553103fb, 0x1fe7, 0x4557, 0xbb, 0x38, 0x94, 0x6d, 0x7d, 0x0e, 0x7c, 0xa7} +DEFINE_GUID!{IID_ID3D12CommandQueue, + 0x0ec870a6, 0x5d7e, 0x4c22, 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed} +DEFINE_GUID!{IID_ID3D12Device, + 0x189819f1, 0x1db6, 0x4b57, 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7} +DEFINE_GUID!{IID_ID3D12PipelineLibrary, + 0xc64226a8, 0x9201, 0x46af, 0xb4, 0xcc, 0x53, 0xfb, 0x9f, 0xf7, 0x41, 0x4f} +DEFINE_GUID!{IID_ID3D12PipelineLibrary1, + 0x80eabf42, 0x2568, 0x4e5e, 0xbd, 0x82, 0xc3, 0x7f, 0x86, 0x96, 0x1d, 0xc3} +DEFINE_GUID!{IID_ID3D12Device1, + 0x77acce80, 0x638e, 0x4e65, 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e} +DEFINE_GUID!{IID_ID3D12Device2, + 0x30baa41e, 0xb15b, 0x475c, 0xa0, 0xbb, 0x1a, 0xf5, 0xc5, 0xb6, 0x43, 0x28} +DEFINE_GUID!{IID_ID3D12Tools, + 0x7071e1f0, 0xe84b, 0x4b33, 0x97, 0x4f, 0x12, 0xfa, 0x49, 0xde, 0x65, 0xc5} diff --git a/src/vendor/winapi/src/um/d3d12sdklayers.rs b/src/vendor/winapi/src/um/d3d12sdklayers.rs new file mode 100644 index 0000000000..ba5cf13f34 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d12sdklayers.rs @@ -0,0 +1,1364 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_char, c_void}; +use shared::basetsd::{SIZE_T, UINT64}; +use shared::minwindef::{BOOL, FLOAT, UINT}; +use um::d3d12::ID3D12Resource; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCSTR}; +RIDL!{#[uuid(0x344488b7, 0x6846, 0x474b, 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0)] +interface ID3D12Debug(ID3D12DebugVtbl): IUnknown(IUnknownVtbl) { + fn EnableDebugLayer() -> (), +}} +RIDL!{#[uuid(0xaffaa4ca, 0x63fe, 0x4d8e, 0xb8, 0xad, 0x15, 0x90, 0x00, 0xaf, 0x43, 0x04)] +interface ID3D12Debug1(ID3D12Debug1Vtbl): IUnknown(IUnknownVtbl) { + fn EnableDebugLayer() -> (), + fn SetEnableGPUBasedValidation( + Enable: BOOL, + ) -> (), + fn SetEnableSynchronizedCommandQueueValidation( + Enable: BOOL, + ) -> (), +}} +ENUM!{enum D3D12_GPU_BASED_VALIDATION_FLAGS { + D3D12_GPU_BASED_VALIDATION_FLAGS_NONE = 0, + D3D12_GPU_BASED_VALIDATION_FLAGS_DISABLE_STATE_TRACKING = 0x01, +}} +RIDL!{#[uuid(0x93a665c4, 0xa3b2, 0x4e5d, 0xb6, 0x92, 0xa2, 0x6a, 0xe1, 0x4e, 0x33, 0x74)] +interface ID3D12Debug2(ID3D12Debug2Vtbl): IUnknown(IUnknownVtbl) { + fn SetGPUBasedValidationFlags( + Flags: D3D12_GPU_BASED_VALIDATION_FLAGS, + ) -> (), +}} +ENUM!{enum D3D12_RLDO_FLAGS { + D3D12_RLDO_NONE = 0, + D3D12_RLDO_SUMMARY = 0x1, + D3D12_RLDO_DETAIL = 0x2, + D3D12_RLDO_IGNORE_INTERNAL = 0x4, +}} +ENUM!{enum D3D12_DEBUG_DEVICE_PARAMETER_TYPE { + D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS = 0, + D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS = 1, + D3D12_DEBUG_DEVICE_PARAMETER_GPU_SLOWDOWN_PERFORMANCE_FACTOR = 2, +}} +ENUM!{enum D3D12_DEBUG_FEATURE { + D3D12_DEBUG_FEATURE_NONE = 0, + D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DRAW = 0x1, + D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DISPATCH = 0x2, + D3D12_DEBUG_FEATURE_DISABLE_VIRTUALIZED_BUNDLES_VALIDATION = 0x04, + D3D12_DEBUG_FEATURE_VALID_MASK = 0x7, +}} +ENUM!{enum D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE { + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_NONE = 0, + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_STATE_TRACKING_ONLY = 1, + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_UNGUARDED_VALIDATION = 2, + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_GUARDED_VALIDATION = 3, + NUM_D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODES = 4, +}} +ENUM!{enum D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS { + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_NONE = 0, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_TRACKING_ONLY_SHADERS = 0x01, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_UNGUARDED_VALIDATION_SHADERS = 0x02, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_GUARDED_VALIDATION_SHADERS = 0x04, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS_VALID_MASK = 0x07, +}} +STRUCT!{struct D3D12_DEBUG_DEVICE_GPU_BASED_VALIDATION_SETTINGS { + MaxMessagesPerCommandList: UINT, + DefaultShaderPatchMode: D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE, + PipelineStateCreateFlags: D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS, +}} +STRUCT!{struct D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR { + SlowdownFactor: FLOAT, +}} +RIDL!{#[uuid(0x3febd6dd, 0x4973, 0x4787, 0x81, 0x94, 0xe4, 0x5f, 0x9e, 0x28, 0x92, 0x3e)] +interface ID3D12DebugDevice1(ID3D12DebugDevice1Vtbl): IUnknown(IUnknownVtbl) { + fn SetDebugParameter( + Type: D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE, + pData: *const c_void, + DataSize: UINT, + ) -> HRESULT, + fn GetDebugParameter( + Type: D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE, + pData: *mut c_void, + DataSize: UINT, + ) -> HRESULT, + fn ReportLiveDeviceObjects( + Flags: D3D12_RLDO_FLAGS, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x3febd6dd, 0x4973, 0x4787, 0x81, 0x94, 0xe4, 0x5f, 0x9e, 0x28, 0x92, 0x3e)] +interface ID3D12DebugDevice(ID3D12DebugDeviceVtbl): IUnknown(IUnknownVtbl) { + fn SetFeatureMask( + Mask: D3D12_DEBUG_FEATURE, + ) -> HRESULT, + fn GetFeatureMask() -> D3D12_DEBUG_FEATURE, + fn ReportLiveDeviceObjects( + Flags: D3D12_RLDO_FLAGS, + ) -> HRESULT, +}} +DEFINE_GUID!{DXGI_DEBUG_D3D12, + 0xcf59a98c, 0xa950, 0x4326, 0x91, 0xef, 0x9b, 0xba, 0xa1, 0x7b, 0xfd, 0x95} +RIDL!{#[uuid(0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3a)] +interface ID3D12DebugCommandQueue(ID3D12DebugCommandQueueVtbl): IUnknown(IUnknownVtbl) { + fn AssertResourceState( + pResource: *mut ID3D12Resource, + Subresource: UINT, + State: UINT, + ) -> BOOL, +}} +ENUM!{enum D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE { + D3D12_DEBUG_COMMAND_LIST_PARAMETER_GPU_BASED_VALIDATION_SETTINGS = 0, +}} +STRUCT!{struct D3D12_DEBUG_COMMAND_LIST_GPU_BASED_VALIDATION_SETTINGS { + ShaderPatchMode: D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE, +}} +RIDL!{#[uuid(0x102ca951, 0x311b, 0x4b01, 0xb1, 0x1f, 0xec, 0xb8, 0x3e, 0x06, 0x1b, 0x37)] +interface ID3D12DebugCommandList1(ID3D12DebugCommandList1Vtbl): IUnknown(IUnknownVtbl) { + fn AssertResourceState( + pResource: *mut ID3D12Resource, + Subresource: UINT, + State: UINT, + ) -> BOOL, + fn SetDebugParameter( + Type: D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE, + pData: *const c_void, + DataSize: UINT, + ) -> HRESULT, + fn GetDebugParameter( + Type: D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE, + pData: *mut c_void, + DataSize: UINT, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3f)] +interface ID3D12DebugCommandList(ID3D12DebugCommandListVtbl): IUnknown(IUnknownVtbl) { + fn AssertResourceState( + pResource: *mut ID3D12Resource, + Subresource: UINT, + State: UINT, + ) -> BOOL, + fn SetFeatureMask( + Mask: D3D12_DEBUG_FEATURE, + ) -> HRESULT, + fn GetFeatureMask() -> D3D12_DEBUG_FEATURE, +}} +ENUM!{enum D3D12_MESSAGE_CATEGORY { + D3D12_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, + D3D12_MESSAGE_CATEGORY_MISCELLANEOUS = 1, + D3D12_MESSAGE_CATEGORY_INITIALIZATION = 2, + D3D12_MESSAGE_CATEGORY_CLEANUP = 3, + D3D12_MESSAGE_CATEGORY_COMPILATION = 4, + D3D12_MESSAGE_CATEGORY_STATE_CREATION = 5, + D3D12_MESSAGE_CATEGORY_STATE_SETTING = 6, + D3D12_MESSAGE_CATEGORY_STATE_GETTING = 7, + D3D12_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = 8, + D3D12_MESSAGE_CATEGORY_EXECUTION = 9, + D3D12_MESSAGE_CATEGORY_SHADER = 10, +}} +ENUM!{enum D3D12_MESSAGE_SEVERITY { + D3D12_MESSAGE_SEVERITY_CORRUPTION = 0, + D3D12_MESSAGE_SEVERITY_ERROR = 1, + D3D12_MESSAGE_SEVERITY_WARNING = 2, + D3D12_MESSAGE_SEVERITY_INFO = 3, + D3D12_MESSAGE_SEVERITY_MESSAGE = 4, +}} +ENUM!{enum D3D12_MESSAGE_ID { + D3D12_MESSAGE_ID_UNKNOWN = 0, + D3D12_MESSAGE_ID_STRING_FROM_APPLICATION = 1, + D3D12_MESSAGE_ID_CORRUPTED_THIS = 2, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER1 = 3, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER2 = 4, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER3 = 5, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER4 = 6, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER5 = 7, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER6 = 8, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER7 = 9, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER8 = 10, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER9 = 11, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER10 = 12, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER11 = 13, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER12 = 14, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER13 = 15, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER14 = 16, + D3D12_MESSAGE_ID_CORRUPTED_PARAMETER15 = 17, + D3D12_MESSAGE_ID_CORRUPTED_MULTITHREADING = 18, + D3D12_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = 19, + D3D12_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = 20, + D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = 21, + D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = 22, + D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = 23, + D3D12_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = 24, + D3D12_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = 25, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = 26, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = 27, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = 28, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANESLICE = 29, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANESLICE = 30, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = 31, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = 32, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = 33, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = 34, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = 35, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = 36, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = 37, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = 38, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANESLICE = 39, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANESLICE = 40, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = 41, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = 42, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = 43, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = 44, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = 45, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = 46, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = 47, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = 48, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = 49, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = 50, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = 51, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = 52, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = 53, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = 54, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = 55, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = 56, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = 57, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = 58, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = 59, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = 60, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = 61, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = 62, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = 63, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = 64, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = 65, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = 66, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = 67, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = 68, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = 69, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = 70, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = 71, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = 72, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = 73, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 74, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = 75, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = 76, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = 77, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = 78, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = 79, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = 80, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = 81, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = 82, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT + = 83, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = 84, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = 85, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = 86, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = 87, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = 88, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = 89, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = 90, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = 91, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = 92, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = 93, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = 94, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = 95, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = 96, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = 97, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = 98, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = 99, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = 100, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = 101, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = 102, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = 103, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = 104, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = 105, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = 106, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = 107, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = 108, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = 109, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = 110, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = 111, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = 112, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = 113, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = 114, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = 115, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = 116, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = 117, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = 118, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = 119, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = 120, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = 121, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = 122, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = 123, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = 124, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = 125, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = 126, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = 127, + D3D12_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = 128, + D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = 129, + D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = 130, + D3D12_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = 131, + D3D12_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = 132, + D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = 133, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = 134, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = 135, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = 136, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = 137, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = 138, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = 139, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = 140, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = 141, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = 142, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = 143, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = 144, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = 145, + D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = 146, + D3D12_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = 147, + D3D12_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = 148, + D3D12_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = 149, + D3D12_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = 150, + D3D12_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = 151, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = 152, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = 153, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = 154, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = 155, + D3D12_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = 156, + D3D12_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = 157, + D3D12_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = 158, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = 159, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = 160, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = 161, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = 162, + D3D12_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = 163, + D3D12_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = 164, + D3D12_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = 165, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = 166, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = 167, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = 168, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = 169, + D3D12_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = 170, + D3D12_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = 171, + D3D12_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = 172, + D3D12_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = 173, + D3D12_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = 174, + D3D12_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = 175, + D3D12_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = 176, + D3D12_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = 177, + D3D12_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = 178, + D3D12_MESSAGE_ID_REF_THREADING_MODE = 179, + D3D12_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = 180, + D3D12_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = 181, + D3D12_MESSAGE_ID_REF_HARDWARE_EXCEPTION = 182, + D3D12_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = 183, + D3D12_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = 184, + D3D12_MESSAGE_ID_REF_OUT_OF_MEMORY = 185, + D3D12_MESSAGE_ID_REF_INFO = 186, + D3D12_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = 187, + D3D12_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = 188, + D3D12_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = 189, + D3D12_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = 190, + D3D12_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = 191, + D3D12_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = 192, + D3D12_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = 193, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 194, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = 195, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = 196, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = 197, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = 198, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 199, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_NOT_SET = 200, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_MISMATCH = 201, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_NOT_SET = 202, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INPUTLAYOUT_NOT_SET = 203, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_CONSTANT_BUFFER_NOT_SET = 204, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_CONSTANT_BUFFER_TOO_SMALL = 205, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SAMPLER_NOT_SET = 206, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SHADERRESOURCEVIEW_NOT_SET = 207, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VIEW_DIMENSION_MISMATCH = 208, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = 209, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_TOO_SMALL = 210, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_NOT_SET = 211, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_FORMAT_INVALID = 212, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_TOO_SMALL = 213, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = 214, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = 215, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_POSITION_NOT_PRESENT = 216, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OUTPUT_STREAM_NOT_SET = 217, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_BOUND_RESOURCE_MAPPED = 218, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INVALID_PRIMITIVETOPOLOGY = 219, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_OFFSET_UNALIGNED = 220, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_STRIDE_UNALIGNED = 221, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_OFFSET_UNALIGNED = 222, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = 223, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = 224, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = 225, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = 226, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = 227, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = 228, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = 229, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 230, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 231, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = 232, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = 233, + D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = 234, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = 235, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = 236, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = 237, + D3D12_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = 238, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = 239, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = 240, + D3D12_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = 241, + D3D12_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = 242, + D3D12_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = 243, + D3D12_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = 244, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = 245, + D3D12_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = 246, + D3D12_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = 247, + D3D12_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = 248, + D3D12_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = 249, + D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 250, + D3D12_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = 251, + D3D12_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = 252, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = 253, + D3D12_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = 254, + D3D12_MESSAGE_ID_LIVE_OBJECT_SUMMARY = 255, + D3D12_MESSAGE_ID_LIVE_BUFFER = 256, + D3D12_MESSAGE_ID_LIVE_TEXTURE1D = 257, + D3D12_MESSAGE_ID_LIVE_TEXTURE2D = 258, + D3D12_MESSAGE_ID_LIVE_TEXTURE3D = 259, + D3D12_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW = 260, + D3D12_MESSAGE_ID_LIVE_RENDERTARGETVIEW = 261, + D3D12_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW = 262, + D3D12_MESSAGE_ID_LIVE_VERTEXSHADER = 263, + D3D12_MESSAGE_ID_LIVE_GEOMETRYSHADER = 264, + D3D12_MESSAGE_ID_LIVE_PIXELSHADER = 265, + D3D12_MESSAGE_ID_LIVE_INPUTLAYOUT = 266, + D3D12_MESSAGE_ID_LIVE_SAMPLER = 267, + D3D12_MESSAGE_ID_LIVE_BLENDSTATE = 268, + D3D12_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE = 269, + D3D12_MESSAGE_ID_LIVE_RASTERIZERSTATE = 270, + D3D12_MESSAGE_ID_LIVE_QUERY = 271, + D3D12_MESSAGE_ID_LIVE_PREDICATE = 272, + D3D12_MESSAGE_ID_LIVE_COUNTER = 273, + D3D12_MESSAGE_ID_LIVE_DEVICE = 274, + D3D12_MESSAGE_ID_LIVE_SWAPCHAIN = 275, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = 276, + D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = 277, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = 278, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS = 279, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = 280, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS = 281, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE = 282, + D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDCLASSLINKAGE = 283, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = 284, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = 285, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = 286, + D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = 287, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDCALL = 288, + D3D12_MESSAGE_ID_CREATEHULLSHADER_OUTOFMEMORY = 289, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERBYTECODE = 290, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERTYPE = 291, + D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDCLASSLINKAGE = 292, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCALL = 293, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_OUTOFMEMORY = 294, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = 295, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERTYPE = 296, + D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = 297, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_XOR_DS_MISMATCH = 298, + D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER = 299, + D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED = 300, + D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW = 301, + D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDMAPTYPE = 302, + D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDSUBRESOURCE = 303, + D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDFLAGS = 304, + D3D12_MESSAGE_ID_RESOURCE_MAP_ALREADYMAPPED = 305, + D3D12_MESSAGE_ID_RESOURCE_MAP_DEVICEREMOVED_RETURN = 306, + D3D12_MESSAGE_ID_RESOURCE_MAP_OUTOFMEMORY_RETURN = 307, + D3D12_MESSAGE_ID_RESOURCE_MAP_WITHOUT_INITIAL_DISCARD = 308, + D3D12_MESSAGE_ID_RESOURCE_UNMAP_INVALIDSUBRESOURCE = 309, + D3D12_MESSAGE_ID_RESOURCE_UNMAP_NOTMAPPED = 310, + D3D12_MESSAGE_ID_DEVICE_DRAW_RASTERIZING_CONTROL_POINTS = 311, + D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED = 312, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH = 313, + D3D12_MESSAGE_ID_DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 314, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 315, + D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 316, + D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE = 317, + D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = 318, + D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN = 319, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCALL = 320, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_OUTOFMEMORY = 321, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = 322, + D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = 323, + D3D12_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY = 324, + D3D12_MESSAGE_ID_CSSETCONSTANTBUFFERS_INVALIDBUFFER = 325, + D3D12_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 326, + D3D12_MESSAGE_ID_DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY = 327, + D3D12_MESSAGE_ID_DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY = 328, + D3D12_MESSAGE_ID_DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 329, + D3D12_MESSAGE_ID_DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY = 330, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 331, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 332, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 333, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 334, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = 335, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 336, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = 337, + D3D12_MESSAGE_ID_CREATEBUFFER_INVALIDSTRUCTURESTRIDE = 338, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFLAGS = 339, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = 340, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDESC = 341, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = 342, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANESLICE = 343, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE = 344, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = 345, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = 346, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS = 347, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP = 348, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN = 349, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN = 350, + D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_DENORMFLUSH = 351, + D3D12_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY = 352, + D3D12_MESSAGE_ID_DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY = 353, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = 354, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER = 355, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED = 356, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW = 357, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DEPTH_READONLY = 358, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_STENCIL_READONLY = 359, + D3D12_MESSAGE_ID_CHECKFEATURESUPPORT_FORMAT_DEPRECATED = 360, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH = 361, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET = 362, + D3D12_MESSAGE_ID_DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP = 363, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH = 364, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED = 365, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED = 366, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH = 367, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH = 368, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED = 369, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED = 370, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED = 371, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED = 372, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED = 373, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED = 374, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED = 375, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED = 376, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED = 377, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED = 378, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW = 379, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO = 380, + D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH = 381, + D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH = 382, + D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED = 383, + D3D12_MESSAGE_ID_DEVICE_DISPATCH_UNSUPPORTED = 384, + D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_UNSUPPORTED = 385, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDOFFSET = 386, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_LARGEOFFSET = 387, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE = 388, + D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDSOURCESTATE = 389, + D3D12_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED = 390, + D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT = 391, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED = 392, + D3D12_MESSAGE_ID_DEVICE_DRAW_PIXEL_SHADER_WITHOUT_RTV_OR_DSV = 393, + D3D12_MESSAGE_ID_SHADER_ABORT = 394, + D3D12_MESSAGE_ID_SHADER_MESSAGE = 395, + D3D12_MESSAGE_ID_SHADER_ERROR = 396, + D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDRESOURCE = 397, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_INVALIDARG_RETURN = 398, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_OUTOFMEMORY_RETURN = 399, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_ACCESSDENIED_RETURN = 400, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = 401, + D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 402, + D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS = 403, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER = 404, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER = 405, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER = 406, + D3D12_MESSAGE_ID_DEVICE_LOCKEDOUT_INTERFACE = 407, + D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDPRIORITY = 408, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDVIEW = 409, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 410, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_SHADEREXTENSIONSNOTSUPPORTED = 411, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 412, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_SHADEREXTENSIONSNOTSUPPORTED = 413, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 414, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_SHADEREXTENSIONSNOTSUPPORTED = 415, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 416, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_SHADEREXTENSIONSNOTSUPPORTED = 417, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED + = 418, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_SHADEREXTENSIONSNOTSUPPORTED + = 419, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 420, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_SHADEREXTENSIONSNOTSUPPORTED = 421, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 422, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_SHADEREXTENSIONSNOTSUPPORTED = 423, + D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_MINPRECISION = 424, + D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED = 425, + D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED = 426, + D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED = 427, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED = 428, + D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED = 429, + D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED = 430, + D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED = 431, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_INVALIDOFFSET = 432, + D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_TOOMANYVIEWS = 433, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_NOTSUPPORTED = 434, + D3D12_MESSAGE_ID_SWAPDEVICECONTEXTSTATE_NOTSUPPORTED = 435, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1 = 436, + D3D12_MESSAGE_ID_GETDC_INACCESSIBLE = 437, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDRECT = 438, + D3D12_MESSAGE_ID_DEVICE_DRAW_SAMPLE_MASK_IGNORED_ON_FL9 = 439, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE1_NOT_SUPPORTED = 440, + D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BY_NAME_NOT_SUPPORTED = 441, + D3D12_MESSAGE_ID_ENQUEUESETEVENT_NOT_SUPPORTED = 442, + D3D12_MESSAGE_ID_OFFERRELEASE_NOT_SUPPORTED = 443, + D3D12_MESSAGE_ID_OFFERRESOURCES_INACCESSIBLE = 444, + D3D12_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMSAA = 445, + D3D12_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMSAA = 446, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDSOURCERECT = 447, + D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_EMPTYRECT = 448, + D3D12_MESSAGE_ID_UPDATESUBRESOURCE_EMPTYDESTBOX = 449, + D3D12_MESSAGE_ID_COPYSUBRESOURCEREGION_EMPTYSOURCEBOX = 450, + D3D12_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 451, + D3D12_MESSAGE_ID_DEVICE_DRAW_DEPTHSTENCILVIEW_NOT_SET = 452, + D3D12_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET = 453, + D3D12_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 454, + D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 455, + D3D12_MESSAGE_ID_GETDATAFORNEWHARDWAREKEY_NULLPARAM = 456, + D3D12_MESSAGE_ID_CHECKCRYPTOSESSIONSTATUS_NULLPARAM = 457, + D3D12_MESSAGE_ID_SETEVENTONHARDWARECONTENTPROTECTIONTILT_NULLPARAM = 458, + D3D12_MESSAGE_ID_GETVIDEODECODERCAPS_NULLPARAM = 459, + D3D12_MESSAGE_ID_GETVIDEODECODERCAPS_ZEROWIDTHHEIGHT = 460, + D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_NULLPARAM = 461, + D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 462, + D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 463, + D3D12_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_NULLPARAM = 464, + D3D12_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_UNSUPPORTED = 465, + D3D12_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_NULLPARAM = 466, + D3D12_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_UNSUPPORTED = 467, + D3D12_MESSAGE_ID_CHECKVIDEOPROCESSORFORMATCONVERSION_NULLPARAM = 468, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCOLORSPACE1_NULLPARAM = 469, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTCOLORSPACE1_NULLPARAM = 470, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_NULLPARAM = 471, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_INVALIDSTREAM = 472, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_NULLPARAM = 473, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_INVALIDSTREAM = 474, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_UNSUPPORTED = 475, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE1_NULLPARAM = 476, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETSTREAMMIRROR_NULLPARAM = 477, + D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_NULLPARAM = 478, + D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 479, + D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 480, + D3D12_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTSHADERUSAGE_NULLPARAM = 481, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTSHADERUSAGE_NULLPARAM = 482, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_NULLPARAM = 483, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT = 484, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT = 485, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT = 486, + D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT = 487, + D3D12_MESSAGE_ID_CREATEBUFFER_INVALIDUSAGE = 488, + D3D12_MESSAGE_ID_CREATETEXTURE1D_INVALIDUSAGE = 489, + D3D12_MESSAGE_ID_CREATETEXTURE2D_INVALIDUSAGE = 490, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_STEPRATE_NOT_1 = 491, + D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_INSTANCING_NOT_SUPPORTED = 492, + D3D12_MESSAGE_ID_UPDATETILEMAPPINGS_INVALID_PARAMETER = 493, + D3D12_MESSAGE_ID_COPYTILEMAPPINGS_INVALID_PARAMETER = 494, + D3D12_MESSAGE_ID_COPYTILES_INVALID_PARAMETER = 495, + D3D12_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_WARNING = 496, + D3D12_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_ERROR = 497, + D3D12_MESSAGE_ID_DIRTY_TILE_MAPPING_ACCESS = 498, + D3D12_MESSAGE_ID_DUPLICATE_TILE_MAPPINGS_IN_COVERED_AREA = 499, + D3D12_MESSAGE_ID_TILE_MAPPINGS_IN_COVERED_AREA_DUPLICATED_OUTSIDE = 500, + D3D12_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INCOMPATIBLE_RESOURCES = 501, + D3D12_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INPUT_AND_OUTPUT = 502, + D3D12_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_INVALIDFLAGS = 503, + D3D12_MESSAGE_ID_GETRESOURCETILING_NONTILED_RESOURCE = 504, + D3D12_MESSAGE_ID_NEED_TO_CALL_TILEDRESOURCEBARRIER = 505, + D3D12_MESSAGE_ID_CREATEDEVICE_INVALIDARGS = 506, + D3D12_MESSAGE_ID_CREATEDEVICE_WARNING = 507, + D3D12_MESSAGE_ID_TILED_RESOURCE_TIER_1_BUFFER_TEXTURE_MISMATCH = 508, + D3D12_MESSAGE_ID_CREATE_CRYPTOSESSION = 509, + D3D12_MESSAGE_ID_CREATE_AUTHENTICATEDCHANNEL = 510, + D3D12_MESSAGE_ID_LIVE_CRYPTOSESSION = 511, + D3D12_MESSAGE_ID_LIVE_AUTHENTICATEDCHANNEL = 512, + D3D12_MESSAGE_ID_DESTROY_CRYPTOSESSION = 513, + D3D12_MESSAGE_ID_DESTROY_AUTHENTICATEDCHANNEL = 514, + D3D12_MESSAGE_ID_MAP_INVALID_SUBRESOURCE = 515, + D3D12_MESSAGE_ID_MAP_INVALID_TYPE = 516, + D3D12_MESSAGE_ID_MAP_UNSUPPORTED_TYPE = 517, + D3D12_MESSAGE_ID_UNMAP_INVALID_SUBRESOURCE = 518, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_TYPE = 519, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_NULL_POINTER = 520, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SUBRESOURCE = 521, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_RESERVED_BITS = 522, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISSING_BIND_FLAGS = 523, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_MISC_FLAGS = 524, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MATCHING_STATES = 525, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINATION = 526, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH = 527, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_RESOURCE = 528, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_SAMPLE_COUNT = 529, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS = 530, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINED_FLAGS = 531, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS_FOR_FORMAT = 532, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SPLIT_BARRIER = 533, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_END = 534, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_BEGIN = 535, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAG = 536, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMMAND_LIST_TYPE = 537, + D3D12_MESSAGE_ID_INVALID_SUBRESOURCE_STATE = 538, + D3D12_MESSAGE_ID_INEFFICIENT_PRESENT = 539, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CONTENTION = 540, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET = 541, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET_BUNDLE = 542, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CANNOT_RESET = 543, + D3D12_MESSAGE_ID_COMMAND_LIST_OPEN = 544, + D3D12_MESSAGE_ID_QUERY_STATE_MISMATCH = 545, + D3D12_MESSAGE_ID_INVALID_BUNDLE_API = 546, + D3D12_MESSAGE_ID_COMMAND_LIST_CLOSED = 547, + D3D12_MESSAGE_ID_COMMAND_LIST_CLOSED_WITH_INVALID_RESOURCE = 548, + D3D12_MESSAGE_ID_WRONG_COMMAND_ALLOCATOR_TYPE = 549, + D3D12_MESSAGE_ID_INVALID_INDIRECT_ARGUMENT_BUFFER = 550, + D3D12_MESSAGE_ID_COMPUTE_AND_GRAPHICS_PIPELINE = 551, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_SYNC = 552, + D3D12_MESSAGE_ID_COMMAND_LIST_SYNC = 553, + D3D12_MESSAGE_ID_SET_DESCRIPTOR_HEAP_INVALID = 554, + D3D12_MESSAGE_ID_CREATE_QUEUE_IMAGE_NOT_SUPPORTED = 555, + D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_IMAGE_NOT_SUPPORTED = 556, + D3D12_MESSAGE_ID_CREATE_COMMANDQUEUE = 557, + D3D12_MESSAGE_ID_CREATE_COMMANDALLOCATOR = 558, + D3D12_MESSAGE_ID_CREATE_PIPELINESTATE = 559, + D3D12_MESSAGE_ID_CREATE_COMMANDLIST12 = 560, + D3D12_MESSAGE_ID_CREATE_IMAGECOMMANDLIST = 561, + D3D12_MESSAGE_ID_CREATE_RESOURCE = 562, + D3D12_MESSAGE_ID_CREATE_DESCRIPTORHEAP = 563, + D3D12_MESSAGE_ID_CREATE_ROOTSIGNATURE = 564, + D3D12_MESSAGE_ID_CREATE_LIBRARY = 565, + D3D12_MESSAGE_ID_CREATE_HEAP = 566, + D3D12_MESSAGE_ID_CREATE_MONITOREDFENCE = 567, + D3D12_MESSAGE_ID_CREATE_QUERYHEAP = 568, + D3D12_MESSAGE_ID_CREATE_COMMANDSIGNATURE = 569, + D3D12_MESSAGE_ID_LIVE_COMMANDQUEUE = 570, + D3D12_MESSAGE_ID_LIVE_COMMANDALLOCATOR = 571, + D3D12_MESSAGE_ID_LIVE_PIPELINESTATE = 572, + D3D12_MESSAGE_ID_LIVE_COMMANDLIST12 = 573, + D3D12_MESSAGE_ID_LIVE_IMAGECOMMANDLIST = 574, + D3D12_MESSAGE_ID_LIVE_RESOURCE = 575, + D3D12_MESSAGE_ID_LIVE_DESCRIPTORHEAP = 576, + D3D12_MESSAGE_ID_LIVE_ROOTSIGNATURE = 577, + D3D12_MESSAGE_ID_LIVE_LIBRARY = 578, + D3D12_MESSAGE_ID_LIVE_HEAP = 579, + D3D12_MESSAGE_ID_LIVE_MONITOREDFENCE = 580, + D3D12_MESSAGE_ID_LIVE_QUERYHEAP = 581, + D3D12_MESSAGE_ID_LIVE_COMMANDSIGNATURE = 582, + D3D12_MESSAGE_ID_DESTROY_COMMANDQUEUE = 583, + D3D12_MESSAGE_ID_DESTROY_COMMANDALLOCATOR = 584, + D3D12_MESSAGE_ID_DESTROY_PIPELINESTATE = 585, + D3D12_MESSAGE_ID_DESTROY_COMMANDLIST12 = 586, + D3D12_MESSAGE_ID_DESTROY_IMAGECOMMANDLIST = 587, + D3D12_MESSAGE_ID_DESTROY_RESOURCE = 588, + D3D12_MESSAGE_ID_DESTROY_DESCRIPTORHEAP = 589, + D3D12_MESSAGE_ID_DESTROY_ROOTSIGNATURE = 590, + D3D12_MESSAGE_ID_DESTROY_LIBRARY = 591, + D3D12_MESSAGE_ID_DESTROY_HEAP = 592, + D3D12_MESSAGE_ID_DESTROY_MONITOREDFENCE = 593, + D3D12_MESSAGE_ID_DESTROY_QUERYHEAP = 594, + D3D12_MESSAGE_ID_DESTROY_COMMANDSIGNATURE = 595, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDHEAPTYPE = 596, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONS = 597, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDMISCFLAGS = 598, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMISCFLAGS = 599, + D3D12_MESSAGE_ID_CREATERESOURCE_LARGEALLOCATION = 600, + D3D12_MESSAGE_ID_CREATERESOURCE_SMALLALLOCATION = 601, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDARG_RETURN = 602, + D3D12_MESSAGE_ID_CREATERESOURCE_OUTOFMEMORY_RETURN = 603, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDESC = 604, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDINITIALSTATE = 605, + D3D12_MESSAGE_ID_RESOURCE_HAS_PENDING_INITIAL_DATA = 606, + D3D12_MESSAGE_ID_POSSIBLY_INVALID_SUBRESOURCE_STATE = 607, + D3D12_MESSAGE_ID_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 608, + D3D12_MESSAGE_ID_POSSIBLE_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 609, + D3D12_MESSAGE_ID_BUNDLE_PIPELINE_STATE_MISMATCH = 610, + D3D12_MESSAGE_ID_PRIMITIVE_TOPOLOGY_MISMATCH_PIPELINE_STATE = 611, + D3D12_MESSAGE_ID_RENDER_TARGET_NUMBER_MISMATCH_PIPELINE_STATE = 612, + D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_PIPELINE_STATE = 613, + D3D12_MESSAGE_ID_RENDER_TARGET_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 614, + D3D12_MESSAGE_ID_DEPTH_STENCIL_FORMAT_MISMATCH_PIPELINE_STATE = 615, + D3D12_MESSAGE_ID_DEPTH_STENCIL_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 616, + D3D12_MESSAGE_ID_RENDER_TARGET_NUMBER_MISMATCH_BUNDLE_PIPELINE_STATE = 617, + D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_BUNDLE_PIPELINE_STATE = 618, + D3D12_MESSAGE_ID_RENDER_TARGET_SAMPLE_DESC_MISMATCH_BUNDLE_PIPELINE_STATE = 619, + D3D12_MESSAGE_ID_DEPTH_STENCIL_FORMAT_MISMATCH_BUNDLE_PIPELINE_STATE = 620, + D3D12_MESSAGE_ID_DEPTH_STENCIL_SAMPLE_DESC_MISMATCH_BUNDLE_PIPELINE_STATE = 621, + D3D12_MESSAGE_ID_CREATESHADER_INVALIDBYTECODE = 622, + D3D12_MESSAGE_ID_CREATEHEAP_NULLDESC = 623, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDSIZE = 624, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDHEAPTYPE = 625, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 626, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMEMORYPOOL = 627, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDPROPERTIES = 628, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDALIGNMENT = 629, + D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMISCFLAGS = 630, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDMISCFLAGS = 631, + D3D12_MESSAGE_ID_CREATEHEAP_INVALIDARG_RETURN = 632, + D3D12_MESSAGE_ID_CREATEHEAP_OUTOFMEMORY_RETURN = 633, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAPPROPERTIES = 634, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPTYPE = 635, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 636, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDMEMORYPOOL = 637, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPPROPERTIES = 638, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPMISCFLAGS = 639, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPMISCFLAGS = 640, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDARG_RETURN = 641, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_OUTOFMEMORY_RETURN = 642, + D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_UNRECOGNIZEDHEAPTYPE = 643, + D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_INVALIDHEAPTYPE = 644, + D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_INVALID_DESC = 645, + D3D12_MESSAGE_ID_INVALID_DESCRIPTOR_HANDLE = 646, + D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE = 647, + D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_SYSTEMVALUE = 648, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_RESOURCE = 649, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_DESC = 650, + D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_LARGE_OFFSET = 651, + D3D12_MESSAGE_ID_CREATE_UNORDEREDACCESS_VIEW_INVALID_COUNTER_USAGE = 652, + D3D12_MESSAGE_ID_COPY_DESCRIPTORS_INVALID_RANGES = 653, + D3D12_MESSAGE_ID_COPY_DESCRIPTORS_WRITE_ONLY_DESCRIPTOR = 654, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RTV_FORMAT_NOT_UNKNOWN = 655, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_RENDER_TARGET_COUNT = 656, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VERTEX_SHADER_NOT_SET = 657, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INPUTLAYOUT_NOT_SET = 658, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_HS_DS_SIGNATURE_MISMATCH = 659, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERINDEX = 660, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_COMPONENTTYPE = 661, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERMASK = 662, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SYSTEMVALUE = 663, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 664, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_MINPRECISION = 665, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 666, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_XOR_DS_MISMATCH = 667, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 668, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 669, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 670, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 671, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 672, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_PRIMITIVETOPOLOGY = 673, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SYSTEMVALUE = 674, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 + = 675, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 676, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_TYPE_MISMATCH = 677, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 678, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDERTARGETVIEW_NOT_SET = 679, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DEPTHSTENCILVIEW_NOT_SET = 680, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_INPUT_PRIMITIVE_MISMATCH = 681, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_POSITION_NOT_PRESENT = 682, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE_FLAGS = 683, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_INDEX_BUFFER_PROPERTIES = 684, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SAMPLE_DESC = 685, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_ROOT_SIGNATURE_MISMATCH = 686, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DS_ROOT_SIGNATURE_MISMATCH = 687, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VS_ROOT_SIGNATURE_MISMATCH = 688, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_ROOT_SIGNATURE_MISMATCH = 689, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_ROOT_SIGNATURE_MISMATCH = 690, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE = 691, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_OPEN_BUNDLE = 692, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_DESCRIPTOR_HEAP_MISMATCH = 693, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_TYPE = 694, + D3D12_MESSAGE_ID_DRAW_EMPTY_SCISSOR_RECTANGLE = 695, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_BLOB_NOT_FOUND = 696, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_DESERIALIZE_FAILED = 697, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_INVALID_CONFIGURATION = 698, + D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_NOT_SUPPORTED_ON_DEVICE = 699, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLRESOURCEPROPERTIES = 700, + D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAP = 701, + D3D12_MESSAGE_ID_GETRESOURCEALLOCATIONINFO_INVALIDRDESCS = 702, + D3D12_MESSAGE_ID_MAKERESIDENT_NULLOBJECTARRAY = 703, + D3D12_MESSAGE_ID_MAKERESIDENT_INVALIDOBJECT = 704, + D3D12_MESSAGE_ID_EVICT_NULLOBJECTARRAY = 705, + D3D12_MESSAGE_ID_EVICT_INVALIDOBJECT = 706, + D3D12_MESSAGE_ID_HEAPS_UNSUPPORTED = 707, + D3D12_MESSAGE_ID_SET_DESCRIPTOR_TABLE_INVALID = 708, + D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_INVALID = 709, + D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_BUFFER_VIEW_INVALID = 710, + D3D12_MESSAGE_ID_SET_ROOT_SHADER_RESOURCE_VIEW_INVALID = 711, + D3D12_MESSAGE_ID_SET_ROOT_UNORDERED_ACCESS_VIEW_INVALID = 712, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID_DESC = 713, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_LARGE_OFFSET = 714, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID_DESC = 715, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_LARGE_OFFSET = 716, + D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID_DESC = 717, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDDIMENSIONALITY = 718, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDLAYOUT = 719, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONALITY = 720, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT = 721, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMIPLEVELS = 722, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDSAMPLEDESC = 723, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDLAYOUT = 724, + D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID = 725, + D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID = 726, + D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID = 727, + D3D12_MESSAGE_ID_SET_RENDER_TARGETS_INVALID = 728, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_INVALID_PARAMETERS = 729, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_JPEG_NOT_SUPPORTED = 730, + D3D12_MESSAGE_ID_BEGIN_END_QUERY_INVALID_PARAMETERS = 731, + D3D12_MESSAGE_ID_CLOSE_COMMAND_LIST_OPEN_QUERY = 732, + D3D12_MESSAGE_ID_RESOLVE_QUERY_DATA_INVALID_PARAMETERS = 733, + D3D12_MESSAGE_ID_SET_PREDICATION_INVALID_PARAMETERS = 734, + D3D12_MESSAGE_ID_TIMESTAMPS_NOT_SUPPORTED = 735, + D3D12_MESSAGE_ID_UNSTABLE_POWER_STATE = 736, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDFORMAT = 737, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDFORMAT = 738, + D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDSUBRESOURCERANGE = 739, + D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDBASEOFFSET = 740, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_HEAP = 741, + D3D12_MESSAGE_ID_CREATE_SAMPLER_INVALID = 742, + D3D12_MESSAGE_ID_CREATECOMMANDSIGNATURE_INVALID = 743, + D3D12_MESSAGE_ID_EXECUTE_INDIRECT_INVALID_PARAMETERS = 744, + D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_RESOURCE_DIMENSION = 745, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE = 746, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_DECODENOTSUPPORTED = 747, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED = 748, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = 749, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX = 750, + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX = 751, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANEINDEX = 752, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANEINDEX = 753, + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_AMBIGUOUSVIDEOPLANEINDEX = 754, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANEINDEX = 755, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANEINDEX = 756, + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_AMBIGUOUSVIDEOPLANEINDEX = 757, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSCANDATAOFFSET = 758, + D3D12_MESSAGE_ID_JPEGDECODE_NOTSUPPORTED = 759, + D3D12_MESSAGE_ID_JPEGDECODE_DIMENSIONSTOOLARGE = 760, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDCOMPONENTS = 761, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDCOMPONENTS = 762, + D3D12_MESSAGE_ID_JPEGDECODE_DESTINATIONNOT2D = 763, + D3D12_MESSAGE_ID_JPEGDECODE_TILEDRESOURCESUNSUPPORTED = 764, + D3D12_MESSAGE_ID_JPEGDECODE_GUARDRECTSUNSUPPORTED = 765, + D3D12_MESSAGE_ID_JPEGDECODE_FORMATUNSUPPORTED = 766, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSUBRESOURCE = 767, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDMIPLEVEL = 768, + D3D12_MESSAGE_ID_JPEGDECODE_EMPTYDESTBOX = 769, + D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXNOT2D = 770, + D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXNOTSUB = 771, + D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXESINTERSECT = 772, + D3D12_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEMISMATCH = 773, + D3D12_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEMISMATCH = 774, + D3D12_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEODD = 775, + D3D12_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEODD = 776, + D3D12_MESSAGE_ID_JPEGDECODE_UPSCALEUNSUPPORTED = 777, + D3D12_MESSAGE_ID_JPEGDECODE_TIER4DOWNSCALETOLARGE = 778, + D3D12_MESSAGE_ID_JPEGDECODE_TIER3DOWNSCALEUNSUPPORTED = 779, + D3D12_MESSAGE_ID_JPEGDECODE_CHROMASIZEMISMATCH = 780, + D3D12_MESSAGE_ID_JPEGDECODE_LUMACHROMASIZEMISMATCH = 781, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDNUMDESTINATIONS = 782, + D3D12_MESSAGE_ID_JPEGDECODE_SUBBOXUNSUPPORTED = 783, + D3D12_MESSAGE_ID_JPEGDECODE_1DESTUNSUPPORTEDFORMAT = 784, + D3D12_MESSAGE_ID_JPEGDECODE_3DESTUNSUPPORTEDFORMAT = 785, + D3D12_MESSAGE_ID_JPEGDECODE_SCALEUNSUPPORTED = 786, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSOURCESIZE = 787, + D3D12_MESSAGE_ID_JPEGDECODE_INVALIDCOPYFLAGS = 788, + D3D12_MESSAGE_ID_JPEGDECODE_HAZARD = 789, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE = 790, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS = 791, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE = 792, + D3D12_MESSAGE_ID_JPEGDECODE_BACKBUFFERNOTSUPPORTED = 793, + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPRTEDCOPYFLAGS = 794, + D3D12_MESSAGE_ID_JPEGENCODE_NOTSUPPORTED = 795, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSCANDATAOFFSET = 796, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDCOMPONENTS = 797, + D3D12_MESSAGE_ID_JPEGENCODE_SOURCENOT2D = 798, + D3D12_MESSAGE_ID_JPEGENCODE_TILEDRESOURCESUNSUPPORTED = 799, + D3D12_MESSAGE_ID_JPEGENCODE_GUARDRECTSUNSUPPORTED = 800, + D3D12_MESSAGE_ID_JPEGENCODE_XSUBSAMPLEMISMATCH = 801, + D3D12_MESSAGE_ID_JPEGENCODE_YSUBSAMPLEMISMATCH = 802, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDCOMPONENTS = 803, + D3D12_MESSAGE_ID_JPEGENCODE_FORMATUNSUPPORTED = 804, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSUBRESOURCE = 805, + D3D12_MESSAGE_ID_JPEGENCODE_INVALIDMIPLEVEL = 806, + D3D12_MESSAGE_ID_JPEGENCODE_DIMENSIONSTOOLARGE = 807, + D3D12_MESSAGE_ID_JPEGENCODE_HAZARD = 808, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE = 809, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS = 810, + D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE = 811, + D3D12_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED = 812, + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = 813, + D3D12_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE = 814, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUE = 815, + D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDCLEARVALUEFORMAT = 816, + D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUEFORMAT = 817, + D3D12_MESSAGE_ID_CREATERESOURCE_CLEARVALUEDENORMFLUSH = 818, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALIDDEPTH = 819, + D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE = 820, + D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE = 821, + D3D12_MESSAGE_ID_MAP_INVALIDHEAP = 822, + D3D12_MESSAGE_ID_UNMAP_INVALIDHEAP = 823, + D3D12_MESSAGE_ID_MAP_INVALIDRESOURCE = 824, + D3D12_MESSAGE_ID_UNMAP_INVALIDRESOURCE = 825, + D3D12_MESSAGE_ID_MAP_INVALIDSUBRESOURCE = 826, + D3D12_MESSAGE_ID_UNMAP_INVALIDSUBRESOURCE = 827, + D3D12_MESSAGE_ID_MAP_INVALIDRANGE = 828, + D3D12_MESSAGE_ID_UNMAP_INVALIDRANGE = 829, + D3D12_MESSAGE_ID_MAP_NULLRANGE = 830, + D3D12_MESSAGE_ID_UNMAP_NULLRANGE = 831, + D3D12_MESSAGE_ID_MAP_INVALIDDATAPOINTER = 832, + D3D12_MESSAGE_ID_MAP_INVALIDARG_RETURN = 833, + D3D12_MESSAGE_ID_MAP_OUTOFMEMORY_RETURN = 834, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_BUNDLENOTSUPPORTED = 835, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_COMMANDLISTMISMATCH = 836, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_OPENCOMMANDLIST = 837, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_FAILEDCOMMANDLIST = 838, + D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLDST = 839, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDDSTRESOURCEDIMENSION = 840, + D3D12_MESSAGE_ID_COPYBUFFERREGION_DSTRANGEOUTOFBOUNDS = 841, + D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLSRC = 842, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDSRCRESOURCEDIMENSION = 843, + D3D12_MESSAGE_ID_COPYBUFFERREGION_SRCRANGEOUTOFBOUNDS = 844, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDCOPYFLAGS = 845, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLDST = 846, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTTYPE = 847, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCEDIMENSION = 848, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCE = 849, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTSUBRESOURCE = 850, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTOFFSET = 851, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTFORMAT = 852, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTFORMAT = 853, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDIMENSIONS = 854, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTROWPITCH = 855, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTPLACEMENT = 856, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDSPLACEDFOOTPRINTFORMAT = 857, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_DSTREGIONOUTOFBOUNDS = 858, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLSRC = 859, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCTYPE = 860, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCEDIMENSION = 861, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCE = 862, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCSUBRESOURCE = 863, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCOFFSET = 864, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCFORMAT = 865, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCFORMAT = 866, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDIMENSIONS = 867, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCROWPITCH = 868, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCPLACEMENT = 869, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDSPLACEDFOOTPRINTFORMAT = 870, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_SRCREGIONOUTOFBOUNDS = 871, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTCOORDINATES = 872, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCBOX = 873, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_FORMATMISMATCH = 874, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_EMPTYBOX = 875, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDCOPYFLAGS = 876, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SUBRESOURCE_INDEX = 877, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_FORMAT = 878, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_MISMATCH = 879, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SAMPLE_COUNT = 880, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_INVALID_SHADER = 881, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_CS_ROOT_SIGNATURE_MISMATCH = 882, + D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_MISSING_ROOT_SIGNATURE = 883, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALIDCACHEDBLOB = 884, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBADAPTERMISMATCH = 885, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDRIVERVERSIONMISMATCH = 886, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDESCMISMATCH = 887, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBIGNORED = 888, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDHEAP = 889, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDRESOURCE = 890, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDBOX = 891, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDSUBRESOURCE = 892, + D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_EMPTYBOX = 893, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDHEAP = 894, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDRESOURCE = 895, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDBOX = 896, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDSUBRESOURCE = 897, + D3D12_MESSAGE_ID_READFROMSUBRESOURCE_EMPTYBOX = 898, + D3D12_MESSAGE_ID_TOO_MANY_NODES_SPECIFIED = 899, + D3D12_MESSAGE_ID_INVALID_NODE_INDEX = 900, + D3D12_MESSAGE_ID_GETHEAPPROPERTIES_INVALIDRESOURCE = 901, + D3D12_MESSAGE_ID_NODE_MASK_MISMATCH = 902, + D3D12_MESSAGE_ID_COMMAND_LIST_OUTOFMEMORY = 903, + D3D12_MESSAGE_ID_COMMAND_LIST_MULTIPLE_SWAPCHAIN_BUFFER_REFERENCES = 904, + D3D12_MESSAGE_ID_COMMAND_LIST_TOO_MANY_SWAPCHAIN_REFERENCES = 905, + D3D12_MESSAGE_ID_COMMAND_QUEUE_TOO_MANY_SWAPCHAIN_REFERENCES = 906, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_WRONGSWAPCHAINBUFFERREFERENCE = 907, + D3D12_MESSAGE_ID_COMMAND_LIST_SETRENDERTARGETS_INVALIDNUMRENDERTARGETS = 908, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_TYPE = 909, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_FLAGS = 910, + D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFLAGS = 911, + D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFORMAT = 912, + D3D12_MESSAGE_ID_CREATESHAREDHEAP_INVALIDFLAGS = 913, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_UNRECOGNIZEDPROPERTIES = 914, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDSIZE = 915, + D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDOBJECT = 916, + D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDOBJECT = 917, + D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDKEY = 918, + D3D12_MESSAGE_ID_KEYEDMUTEX_WRONGSTATE = 919, + D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_PRIORITY = 920, + D3D12_MESSAGE_ID_OBJECT_DELETED_WHILE_STILL_IN_USE = 921, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_FLAGS = 922, + D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_HAS_NO_RESOURCE = 923, + D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RENDER_TARGET_DELETED = 924, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_ALL_RENDER_TARGETS_HAVE_UNKNOWN_FORMAT = 925, + D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS = 926, + D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_GPU_WRITTEN_READBACK_RESOURCE_MAPPED = 927, + D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_NEEDED = 928, + D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_EMPTY = 929, + D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE = 930, + D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE = 931, + D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT = 932, + D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT = 933, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_FLAGS_NOT_SUPPORTED = 934, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_ARGUMENT_UNINITIALIZED = 935, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_HEAP_INDEX_OUT_OF_BOUNDS = 936, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TABLE_REGISTER_INDEX_OUT_OF_BOUNDS = 937, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_UNINITIALIZED = 938, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TYPE_MISMATCH = 939, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SRV_RESOURCE_DIMENSION_MISMATCH = 940, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UAV_RESOURCE_DIMENSION_MISMATCH = 941, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE = 942, + D3D12_MESSAGE_ID_COPYRESOURCE_NULLDST = 943, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDSTRESOURCE = 944, + D3D12_MESSAGE_ID_COPYRESOURCE_NULLSRC = 945, + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSRCRESOURCE = 946, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLDST = 947, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDDSTRESOURCE = 948, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLSRC = 949, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDSRCRESOURCE = 950, + D3D12_MESSAGE_ID_PIPELINE_STATE_TYPE_MISMATCH = 951, + D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_NOT_SET = 952, + D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_MISMATCH = 953, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_ZERO_BARRIERS = 954, + D3D12_MESSAGE_ID_BEGIN_END_EVENT_MISMATCH = 955, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_POSSIBLE_BEFORE_AFTER_MISMATCH = 956, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_BEGIN_END = 957, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INVALID_RESOURCE = 958, + D3D12_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT = 959, + D3D12_MESSAGE_ID_OBJECT_EVICTED_WHILE_STILL_IN_USE = 960, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_DESCRIPTOR_ACCESS_OUT_OF_BOUNDS = 961, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_INVALIDLIBRARYBLOB = 962, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_DRIVERVERSIONMISMATCH = 963, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_ADAPTERVERSIONMISMATCH = 964, + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_UNSUPPORTED = 965, + D3D12_MESSAGE_ID_CREATE_PIPELINELIBRARY = 966, + D3D12_MESSAGE_ID_LIVE_PIPELINELIBRARY = 967, + D3D12_MESSAGE_ID_DESTROY_PIPELINELIBRARY = 968, + D3D12_MESSAGE_ID_STOREPIPELINE_NONAME = 969, + D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME = 970, + D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND = 971, + D3D12_MESSAGE_ID_LOADPIPELINE_INVALIDDESC = 972, + D3D12_MESSAGE_ID_PIPELINELIBRARY_SERIALIZE_NOTENOUGHMEMORY = 973, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_RT_OUTPUT_MISMATCH = 974, + D3D12_MESSAGE_ID_SETEVENTONMULTIPLEFENCECOMPLETION_INVALIDFLAGS = 975, + D3D12_MESSAGE_ID_CREATE_QUEUE_VIDEO_NOT_SUPPORTED = 976, + D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_VIDEO_NOT_SUPPORTED = 977, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_VIDEO_DECODE_STATISTICS_NOT_SUPPORTED = 978, + D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDLIST = 979, + D3D12_MESSAGE_ID_CREATE_VIDEODECODER = 980, + D3D12_MESSAGE_ID_CREATE_VIDEODECODESTREAM = 981, + D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDLIST = 982, + D3D12_MESSAGE_ID_LIVE_VIDEODECODER = 983, + D3D12_MESSAGE_ID_LIVE_VIDEODECODESTREAM = 984, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDLIST = 985, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODER = 986, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODESTREAM = 987, + D3D12_MESSAGE_ID_DECODE_FRAME_INVALID_PARAMETERS = 988, + D3D12_MESSAGE_ID_DEPRECATED_API = 989, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_COMMAND_LIST_TYPE = 990, + D3D12_MESSAGE_ID_COMMAND_LIST_DESCRIPTOR_TABLE_NOT_SET = 991, + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_CONSTANT_BUFFER_VIEW_NOT_SET = 992, + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_SHADER_RESOURCE_VIEW_NOT_SET = 993, + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_UNORDERED_ACCESS_VIEW_NOT_SET = 994, + D3D12_MESSAGE_ID_DISCARD_INVALID_SUBRESOURCE_RANGE = 995, + D3D12_MESSAGE_ID_DISCARD_ONE_SUBRESOURCE_FOR_MIPS_WITH_RECTS = 996, + D3D12_MESSAGE_ID_DISCARD_NO_RECTS_FOR_NON_TEXTURE2D = 997, + D3D12_MESSAGE_ID_COPY_ON_SAME_SUBRESOURCE = 998, + D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PAGEABLE = 999, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UNSUPPORTED = 1000, + D3D12_MESSAGE_ID_STATIC_DESCRIPTOR_INVALID_DESCRIPTOR_CHANGE = 1001, + D3D12_MESSAGE_ID_DATA_STATIC_DESCRIPTOR_INVALID_DATA_CHANGE = 1002, + D3D12_MESSAGE_ID_DATA_STATIC_WHILE_SET_AT_EXECUTE_DESCRIPTOR_INVALID_DATA_CHANGE = 1003, + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_STATIC_DESCRIPTOR_DATA_STATIC_NOT_SET = 1004, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_ACCESS_OUT_OF_BOUNDS = 1005, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SAMPLER_MODE_MISMATCH = 1006, + D3D12_MESSAGE_ID_CREATE_FENCE_INVALID_FLAGS = 1007, + D3D12_MESSAGE_ID_RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS = 1008, + D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PRIORITY = 1009, + D3D12_MESSAGE_ID_CREATE_PASS = 1010, + D3D12_MESSAGE_ID_DESTROY_PASS = 1011, + D3D12_MESSAGE_ID_LIVE_PASS = 1012, + D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_LARGE_NUM_DESCRIPTORS = 1013, + D3D12_MESSAGE_ID_BEGIN_EVENT = 1014, + D3D12_MESSAGE_ID_END_EVENT = 1015, + D3D12_MESSAGE_ID_CREATEDEVICE_DEBUG_LAYER_STARTUP_OPTIONS = 1016, + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_DEPTHBOUNDSTEST_UNSUPPORTED = 1017, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_DUPLICATE_SUBOBJECT = 1018, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_UNKNOWN_SUBOBJECT = 1019, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_ZERO_SIZE_STREAM = 1020, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_STREAM = 1021, + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CANNOT_DEDUCE_TYPE = 1022, + D3D12_MESSAGE_ID_COMMAND_LIST_STATIC_DESCRIPTOR_RESOURCE_DIMENSION_MISMATCH = 1023, + D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_PRIVILEGE_FOR_GLOBAL_REALTIME = 1024, + D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_HARDWARE_SUPPORT_FOR_GLOBAL_REALTIME = 1025, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_ARCHITECTURE = 1026, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DST = 1027, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DST_RESOURCE_DIMENSION = 1028, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DST_RANGE_OUT_OF_BOUNDS = 1029, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_SRC = 1030, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_SRC_RESOURCE_DIMENSION = 1031, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_SRC_RANGE_OUT_OF_BOUNDS = 1032, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_OFFSET_ALIGNMENT = 1033, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_RESOURCES = 1034, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_SUBRESOURCE_RANGES = 1035, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_RESOURCE = 1036, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_SUBRESOURCE_RANGE = 1037, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_SUBRESOURCE_OUT_OF_BOUNDS = 1038, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_RANGE_OUT_OF_BOUNDS = 1039, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_ZERO_DEPENDENCIES = 1040, + D3D12_MESSAGE_ID_DEVICE_CREATE_SHARED_HANDLE_INVALIDARG = 1041, + D3D12_MESSAGE_ID_DESCRIPTOR_HANDLE_WITH_INVALID_RESOURCE = 1042, + D3D12_MESSAGE_ID_SETDEPTHBOUNDS_INVALIDARGS = 1043, + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_STATE_IMPRECISE = 1044, + D3D12_MESSAGE_ID_COMMAND_LIST_PIPELINE_STATE_NOT_SET = 1045, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_MODEL_MISMATCH = 1046, + D3D12_MESSAGE_ID_OBJECT_ACCESSED_WHILE_STILL_IN_USE = 1047, + D3D12_MESSAGE_ID_PROGRAMMABLE_MSAA_UNSUPPORTED = 1048, + D3D12_MESSAGE_ID_SETSAMPLEPOSITIONS_INVALIDARGS = 1049, + D3D12_MESSAGE_ID_RESOLVESUBRESOURCEREGION_INVALID_RECT = 1050, + D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDQUEUE = 1051, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDLIST = 1052, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDQUEUE = 1053, + D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDQUEUE = 1054, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDLIST = 1055, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDQUEUE = 1056, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDQUEUE = 1057, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDLIST = 1058, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDQUEUE = 1059, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSOR = 1060, + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSSTREAM = 1061, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSOR = 1062, + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSSTREAM = 1063, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSOR = 1064, + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSSTREAM = 1065, + D3D12_MESSAGE_ID_PROCESS_FRAME_INVALID_PARAMETERS = 1066, + D3D12_MESSAGE_ID_COPY_INVALIDLAYOUT = 1067, + D3D12_MESSAGE_ID_D3D12_MESSAGES_END = 1068, +}} +STRUCT!{struct D3D12_MESSAGE { + Category: D3D12_MESSAGE_CATEGORY, + Severity: D3D12_MESSAGE_SEVERITY, + ID: D3D12_MESSAGE_ID, + pDescription: *const c_char, + DescriptionByteLength: SIZE_T, +}} +STRUCT!{struct D3D12_INFO_QUEUE_FILTER_DESC { + NumCategories: UINT, + pCategoryList: *mut D3D12_MESSAGE_CATEGORY, + NumSeverities: UINT, + pSeverityList: *mut D3D12_MESSAGE_SEVERITY, + NumIDs: UINT, + pIDList: *mut D3D12_MESSAGE_ID, +}} +STRUCT!{struct D3D12_INFO_QUEUE_FILTER { + AllowList: D3D12_INFO_QUEUE_FILTER_DESC, + DenyList: D3D12_INFO_QUEUE_FILTER_DESC, +}} +pub const D3D12_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT: UINT = 1024; +RIDL!{#[uuid(0x0742a90b, 0xc387, 0x483f, 0xb9, 0x46, 0x30, 0xa7, 0xe4, 0xe6, 0x14, 0x58)] +interface ID3D12InfoQueue(ID3D12InfoQueueVtbl): IUnknown(IUnknownVtbl) { + fn SetMessageCountLimit( + MessageCountLimit: UINT64, + ) -> HRESULT, + fn ClearStoredMessages() -> (), + fn GetMessage( + MessageIndex: UINT64, + pMessage: *mut D3D12_MESSAGE, + pMessageByteLength: *mut SIZE_T, + ) -> HRESULT, + fn GetNumMessagesAllowedByStorageFilter() -> UINT64, + fn GetNumMessagesDeniedByStorageFilter() -> UINT64, + fn GetNumStoredMessages() -> UINT64, + fn GetNumStoredMessagesAllowedByRetrievalFilter() -> UINT64, + fn GetNumMessagesDiscardedByMessageCountLimit() -> UINT64, + fn GetMessageCountLimit() -> UINT64, + fn AddStorageFilterEntries( + pFilter: *mut D3D12_INFO_QUEUE_FILTER, + ) -> HRESULT, + fn GetStorageFilter( + pFilter: *mut D3D12_INFO_QUEUE_FILTER, + pFilterByteLength: *mut SIZE_T, + ) -> HRESULT, + fn ClearStorageFilter() -> (), + fn PushEmptyStorageFilter() -> HRESULT, + fn PushCopyOfStorageFilter() -> HRESULT, + fn PushStorageFilter( + pFilter: *mut D3D12_INFO_QUEUE_FILTER, + ) -> HRESULT, + fn PopStorageFilter() -> (), + fn GetStorageFilterStackSize() -> UINT, + fn AddRetrievalFilterEntries( + pFilter: *mut D3D12_INFO_QUEUE_FILTER, + ) -> HRESULT, + fn GetRetrievalFilter( + pFilter: *mut D3D12_INFO_QUEUE_FILTER, + pFilterByteLength: *mut SIZE_T, + ) -> HRESULT, + fn ClearRetrievalFilter() -> (), + fn PushEmptyRetrievalFilter() -> HRESULT, + fn PushCopyOfRetrievalFilter() -> HRESULT, + fn PushRetrievalFilter( + pFilter: *mut D3D12_INFO_QUEUE_FILTER, + ) -> HRESULT, + fn PopRetrievalFilter() -> (), + fn GetRetrievalFilterStackSize() -> UINT, + fn AddMessage( + Category: D3D12_MESSAGE_CATEGORY, + Severity: D3D12_MESSAGE_SEVERITY, + ID: D3D12_MESSAGE_ID, + pDescription: LPCSTR, + ) -> HRESULT, + fn AddApplicationMessage( + Severity: D3D12_MESSAGE_SEVERITY, + pDescription: LPCSTR, + ) -> HRESULT, + fn SetBreakOnCategory( + Category: D3D12_MESSAGE_CATEGORY, + bEnable: BOOL, + ) -> HRESULT, + fn SetBreakOnSeverity( + Severity: D3D12_MESSAGE_SEVERITY, + bEnable: BOOL, + ) -> HRESULT, + fn SetBreakOnID( + ID: D3D12_MESSAGE_ID, + bEnable: BOOL, + ) -> HRESULT, + fn GetBreakOnCategory( + Category: D3D12_MESSAGE_CATEGORY, + ) -> BOOL, + fn GetBreakOnSeverity( + Severity: D3D12_MESSAGE_SEVERITY, + ) -> BOOL, + fn GetBreakOnID( + ID: D3D12_MESSAGE_ID, + ) -> BOOL, + fn SetMuteDebugOutput( + bMute: BOOL, + ) -> (), + fn GetMuteDebugOutput() -> BOOL, +}} +DEFINE_GUID!{IID_ID3D12Debug, + 0x344488b7, 0x6846, 0x474b, 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0} +DEFINE_GUID!{IID_ID3D12Debug1, + 0xaffaa4ca, 0x63fe, 0x4d8e, 0xb8, 0xad, 0x15, 0x90, 0x00, 0xaf, 0x43, 0x04} +DEFINE_GUID!{IID_ID3D12Debug2, + 0x93a665c4, 0xa3b2, 0x4e5d, 0xb6, 0x92, 0xa2, 0x6a, 0xe1, 0x4e, 0x33, 0x74} +DEFINE_GUID!{IID_ID3D12DebugDevice1, + 0xa9b71770, 0xd099, 0x4a65, 0xa6, 0x98, 0x3d, 0xee, 0x10, 0x02, 0x0f, 0x88} +DEFINE_GUID!{IID_ID3D12DebugDevice, + 0x3febd6dd, 0x4973, 0x4787, 0x81, 0x94, 0xe4, 0x5f, 0x9e, 0x28, 0x92, 0x3e} +DEFINE_GUID!{IID_ID3D12DebugCommandQueue, + 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3a} +DEFINE_GUID!{IID_ID3D12DebugCommandList1, + 0x102ca951, 0x311b, 0x4b01, 0xb1, 0x1f, 0xec, 0xb8, 0x3e, 0x06, 0x1b, 0x37} +DEFINE_GUID!{IID_ID3D12DebugCommandList, + 0x09e0bf36, 0x54ac, 0x484f, 0x88, 0x47, 0x4b, 0xae, 0xea, 0xb6, 0x05, 0x3f} +DEFINE_GUID!{IID_ID3D12InfoQueue, + 0x0742a90b, 0xc387, 0x483f, 0xb9, 0x46, 0x30, 0xa7, 0xe4, 0xe6, 0x14, 0x58} diff --git a/src/vendor/winapi/src/um/d3d12shader.rs b/src/vendor/winapi/src/um/d3d12shader.rs new file mode 100644 index 0000000000..5f31e06243 --- /dev/null +++ b/src/vendor/winapi/src/um/d3d12shader.rs @@ -0,0 +1,348 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::UINT64; +use shared::minwindef::{BOOL, BYTE, INT, LPVOID, UINT}; +use um::d3dcommon::{ + D3D_CBUFFER_TYPE, D3D_FEATURE_LEVEL, D3D_INTERPOLATION_MODE, D3D_MIN_PRECISION, D3D_NAME, + D3D_PARAMETER_FLAGS, D3D_PRIMITIVE, D3D_PRIMITIVE_TOPOLOGY, D3D_REGISTER_COMPONENT_TYPE, + D3D_RESOURCE_RETURN_TYPE, D3D_SHADER_INPUT_TYPE, D3D_SHADER_VARIABLE_CLASS, + D3D_SHADER_VARIABLE_TYPE, D3D_SRV_DIMENSION, D3D_TESSELLATOR_DOMAIN, + D3D_TESSELLATOR_OUTPUT_PRIMITIVE, D3D_TESSELLATOR_PARTITIONING, +}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCSTR}; +ENUM!{enum D3D12_SHADER_VERSION_TYPE { + D3D12_SHVER_PIXEL_SHADER = 0x0, + D3D12_SHVER_VERTEX_SHADER = 0x1, + D3D12_SHVER_GEOMETRY_SHADER = 0x2, + D3D12_SHVER_HULL_SHADER = 0x3, + D3D12_SHVER_DOMAIN_SHADER = 0x4, + D3D12_SHVER_COMPUTE_SHADER = 0x5, + D3D12_SHVER_RESERVED0 = 0xFFF0, +}} +STRUCT!{struct D3D12_FUNCTION_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + MovInstructionCount: UINT, + MovcInstructionCount: UINT, + ConversionInstructionCount: UINT, + BitwiseInstructionCount: UINT, + MinFeatureLevel: D3D_FEATURE_LEVEL, + RequiredFeatureFlags: UINT64, + Name: LPCSTR, + FunctionParameterCount: INT, + HasReturn: BOOL, + Has10Level9VertexShader: BOOL, + Has10Level9PixelShader: BOOL, +}} +STRUCT!{struct D3D12_LIBRARY_DESC { + Creator: LPCSTR, + Flags: UINT, + FunctionCount: UINT, +}} +STRUCT!{struct D3D12_PARAMETER_DESC { + Name: LPCSTR, + SemanticName: LPCSTR, + Type: D3D_SHADER_VARIABLE_TYPE, + Class: D3D_SHADER_VARIABLE_CLASS, + Rows: UINT, + Columns: UINT, + InterpolationMode: D3D_INTERPOLATION_MODE, + Flags: D3D_PARAMETER_FLAGS, + FirstInRegister: UINT, + FirstInComponent: UINT, + FirstOutRegister: UINT, + FirstOutComponent: UINT, +}} +STRUCT!{struct D3D12_SHADER_BUFFER_DESC { + Name: LPCSTR, + Type: D3D_CBUFFER_TYPE, + Variables: UINT, + Size: UINT, + uFlags: UINT, +}} +STRUCT!{struct D3D12_SHADER_DESC { + Version: UINT, + Creator: LPCSTR, + Flags: UINT, + ConstantBuffers: UINT, + BoundResources: UINT, + InputParameters: UINT, + OutputParameters: UINT, + InstructionCount: UINT, + TempRegisterCount: UINT, + TempArrayCount: UINT, + DefCount: UINT, + DclCount: UINT, + TextureNormalInstructions: UINT, + TextureLoadInstructions: UINT, + TextureCompInstructions: UINT, + TextureBiasInstructions: UINT, + TextureGradientInstructions: UINT, + FloatInstructionCount: UINT, + IntInstructionCount: UINT, + UintInstructionCount: UINT, + StaticFlowControlCount: UINT, + DynamicFlowControlCount: UINT, + MacroInstructionCount: UINT, + ArrayInstructionCount: UINT, + CutInstructionCount: UINT, + EmitInstructionCount: UINT, + GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, + GSMaxOutputVertexCount: UINT, + InputPrimitive: D3D_PRIMITIVE, + PatchConstantParameters: UINT, + cGSInstanceCount: UINT, + cControlPoints: UINT, + HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE, + HSPartitioning: D3D_TESSELLATOR_PARTITIONING, + TessellatorDomain: D3D_TESSELLATOR_DOMAIN, + cBarrierInstructions: UINT, + cInterlockedInstructions: UINT, + cTextureStoreInstructions: UINT, +}} +STRUCT!{struct D3D12_SHADER_INPUT_BIND_DESC { + Name: LPCSTR, + Type: D3D_SHADER_INPUT_TYPE, + BindPoint: UINT, + BindCount: UINT, + uFlags: UINT, + ReturnType: D3D_RESOURCE_RETURN_TYPE, + Dimension: D3D_SRV_DIMENSION, + NumSamples: UINT, + Space: UINT, + uID: UINT, +}} +STRUCT!{struct D3D12_SHADER_TYPE_DESC { + Class: D3D_SHADER_VARIABLE_CLASS, + Type: D3D_SHADER_VARIABLE_TYPE, + Rows: UINT, + Columns: UINT, + Elements: UINT, + Members: UINT, + Offset: UINT, + Name: LPCSTR, +}} +STRUCT!{struct D3D12_SHADER_VARIABLE_DESC { + Name: LPCSTR, + StartOffset: UINT, + Size: UINT, + uFlags: UINT, + DefaultValue: LPVOID, + StartTexture: UINT, + TextureSize: UINT, + StartSampler: UINT, + SamplerSize: UINT, +}} +STRUCT!{struct D3D12_SIGNATURE_PARAMETER_DESC { + SemanticName: LPCSTR, + SemanticIndex: UINT, + Register: UINT, + SystemValueType: D3D_NAME, + ComponentType: D3D_REGISTER_COMPONENT_TYPE, + Mask: BYTE, + ReadWriteMask: BYTE, + Stream: UINT, + MinPrecision: D3D_MIN_PRECISION, +}} +RIDL!{#[uuid(0xec25f42d, 0x7006, 0x4f2b, 0xb3, 0x3e, 0x02, 0xcc, 0x33, 0x75, 0x73, 0x3f)] +interface ID3D12FunctionParameterReflection(ID3D12FunctionParameterReflectionVtbl) { + fn GetDesc( + pDesc: *mut D3D12_PARAMETER_DESC, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x1108795c, 0x2772, 0x4ba9, 0xb2, 0xa8, 0xd4, 0x64, 0xdc, 0x7e, 0x27, 0x99)] +interface ID3D12FunctionReflection(ID3D12FunctionReflectionVtbl) { + fn GetDesc( + pDesc: *mut D3D12_FUNCTION_DESC, + ) -> HRESULT, + fn GetConstantBufferByIndex( + BufferIndex: UINT, + ) -> *mut ID3D12ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + Name: LPCSTR, + ) -> *mut ID3D12ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + ResourceIndex: UINT, + pDesc: *mut D3D12_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetVariableByName( + Name: LPCSTR, + ) -> *mut ID3D12ShaderReflectionVariable, + fn GetResourceBindingDescByName( + Name: LPCSTR, + pDesc: *mut D3D12_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetFunctionParameter( + ParameterIndex: INT, + ) -> *mut ID3D12FunctionParameterReflection, +}} +RIDL!(#[uuid(0x8e349d19, 0x54db, 0x4a56, 0x9d, 0xc9, 0x11, 0x9d, 0x87, 0xbd, 0xb8, 0x4)] +interface ID3D12LibraryReflection(ID3D12LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc( + pDesc: *mut D3D12_LIBRARY_DESC, + ) -> HRESULT, + fn GetFunctionByIndex( + FunctionIndex: INT, + ) -> *mut ID3D12FunctionReflection, +}); +DEFINE_GUID!{IID_ID3D12ShaderReflectionConstantBuffer, + 0xc59598b4, 0x48b3, 0x4869, 0xb9, 0xb1, 0xb1, 0x61, 0x8b, 0x14, 0xa8, 0xb7} +RIDL!{#[uuid(0xc59598b4, 0x48b3, 0x4869, 0xb9, 0xb1, 0xb1, 0x61, 0x8b, 0x14, 0xa8, 0xb7)] +interface ID3D12ShaderReflectionConstantBuffer(ID3D12ShaderReflectionConstantBufferVtbl) { + fn GetDesc( + pDesc: *mut D3D12_SHADER_BUFFER_DESC, + ) -> HRESULT, + fn GetVariableByIndex( + Index: UINT, + ) -> *mut ID3D12ShaderReflectionVariable, + fn GetVariableByName( + Name: LPCSTR, + ) -> *mut ID3D12ShaderReflectionVariable, +}} +DEFINE_GUID!{IID_ID3D12ShaderReflectionType, + 0xe913c351, 0x783d, 0x48ca, 0xa1, 0xd1, 0x4f, 0x30, 0x62, 0x84, 0xad, 0x56} +RIDL!{#[uuid(0xe913c351, 0x783d, 0x48ca, 0xa1, 0xd1, 0x4f, 0x30, 0x62, 0x84, 0xad, 0x56)] +interface ID3D12ShaderReflectionType(ID3D12ShaderReflectionTypeVtbl) { + fn GetDesc( + pDesc: *mut D3D12_SHADER_TYPE_DESC, + ) -> HRESULT, + fn GetMemberTypeByIndex( + Index: UINT, + ) -> *mut ID3D12ShaderReflectionType, + fn GetMemberTypeByName( + Name: LPCSTR, + ) -> *mut ID3D12ShaderReflectionType, + fn GetMemberTypeName( + Index: UINT, + ) -> LPCSTR, + fn IsEqual( + pType: *mut ID3D12ShaderReflectionType, + ) -> HRESULT, + fn GetSubType() -> *mut ID3D12ShaderReflectionType, + fn GetBaseClass() -> *mut ID3D12ShaderReflectionType, + fn GetNumInterfaces() -> UINT, + fn GetInterfaceByIndex( + uIndex: UINT, + ) -> *mut ID3D12ShaderReflectionType, + fn IsOfType( + pType: *mut ID3D12ShaderReflectionType, + ) -> HRESULT, + fn ImplementsInterface( + pBase: *mut ID3D12ShaderReflectionType, + ) -> HRESULT, +}} +DEFINE_GUID!{IID_ID3D12ShaderReflectionVariable, + 0x8337a8a6, 0xa216, 0x444a, 0xb2, 0xf4, 0x31, 0x47, 0x33, 0xa7, 0x3a, 0xea} +RIDL!{#[uuid(0x8337a8a6, 0xa216, 0x444a, 0xb2, 0xf4, 0x31, 0x47, 0x33, 0xa7, 0x3a, 0xea)] +interface ID3D12ShaderReflectionVariable(ID3D12ShaderReflectionVariableVtbl) { + fn GetDesc( + pDesc: *mut D3D12_SHADER_VARIABLE_DESC, + ) -> HRESULT, + fn GetType() -> *mut ID3D12ShaderReflectionType, + fn GetBuffer() -> *mut ID3D12ShaderReflectionConstantBuffer, + fn GetInterfaceSlot( + uArrayIndex: UINT, + ) -> UINT, +}} +DEFINE_GUID!{IID_ID3D12ShaderReflection, + 0x5a58797d, 0xa72c, 0x478d, 0x8b, 0xa2, 0xef, 0xc6, 0xb0, 0xef, 0xe8, 0x8e} +RIDL!(#[uuid(0x5a58797d, 0xa72c, 0x478d, 0x8b, 0xa2, 0xef, 0xc6, 0xb0, 0xef, 0xe8, 0x8e)] +interface ID3D12ShaderReflection(ID3D12ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { + fn GetDesc( + pDesc: *mut D3D12_SHADER_DESC, + ) -> HRESULT, + fn GetConstantBufferByIndex( + Index: UINT, + ) -> *mut ID3D12ShaderReflectionConstantBuffer, + fn GetConstantBufferByName( + Name: LPCSTR, + ) -> *mut ID3D12ShaderReflectionConstantBuffer, + fn GetResourceBindingDesc( + ResourceIndex: UINT, + pDesc: *mut D3D12_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetInputParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D12_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, + fn GetOutputParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D12_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, + fn GetPatchConstantParameterDesc( + ParameterIndex: UINT, + pDesc: *mut D3D12_SIGNATURE_PARAMETER_DESC, + ) -> HRESULT, + fn GetVariableByName( + Name: LPCSTR, + ) -> *mut ID3D12ShaderReflectionVariable, + fn GetResourceBindingDescByName( + Name: LPCSTR, + pDesc: *mut D3D12_SHADER_INPUT_BIND_DESC, + ) -> HRESULT, + fn GetMovInstructionCount() -> UINT, + fn GetMovcInstructionCount() -> UINT, + fn GetConversionInstructionCount() -> UINT, + fn GetBitwiseInstructionCount() -> UINT, + fn GetGSInputPrimitive() -> D3D_PRIMITIVE, + fn IsSampleFrequencyShader() -> BOOL, + fn GetNumInterfaceSlots() -> UINT, + fn GetMinFeatureLevel( + pLevel: *mut D3D_FEATURE_LEVEL, + ) -> HRESULT, + fn GetThreadGroupSize( + pSizeX: *mut UINT, + pSizeY: *mut UINT, + pSizeZ: *mut UINT, + ) -> UINT, + fn GetRequiresFlags() -> UINT64, +}); +DEFINE_GUID!{IID_ID3D12LibraryReflection, + 0x8e349d19, 0x54db, 0x4a56, 0x9d, 0xc9, 0x11, 0x9d, 0x87, 0xbd, 0xb8, 0x04} +DEFINE_GUID!{IID_ID3D12FunctionReflection, + 0x1108795c, 0x2772, 0x4ba9, 0xb2, 0xa8, 0xd4, 0x64, 0xdc, 0x7e, 0x27, 0x99} +DEFINE_GUID!{IID_ID3D12FunctionParameterReflection, + 0xec25f42d, 0x7006, 0x4f2b, 0xb3, 0x3e, 0x02, 0xcc, 0x33, 0x75, 0x73, 0x3f} +pub type D3D12_CBUFFER_TYPE = D3D_CBUFFER_TYPE; +pub type D3D12_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; +pub type D3D12_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN; +pub type D3D12_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE; +pub type D3D12_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING; +pub type LPD3D12FUNCTIONPARAMETERREFLECTION = *mut ID3D12FunctionParameterReflection; +pub type LPD3D12FUNCTIONREFLECTION = *mut ID3D12FunctionReflection; +pub type LPD3D12LIBRARYREFLECTION = *mut ID3D12LibraryReflection; +pub type LPD3D12SHADERREFLECTION = *mut ID3D12ShaderReflection; +pub type LPD3D12SHADERREFLECTIONCONSTANTBUFFER = *mut ID3D12ShaderReflectionConstantBuffer; +pub type LPD3D12SHADERREFLECTIONTYPE = *mut ID3D12ShaderReflectionType; +pub type LPD3D12SHADERREFLECTIONVARIABLE = *mut ID3D12ShaderReflectionVariable; +pub const D3D_SHADER_REQUIRES_INNER_COVERAGE: UINT64 = 0x00000400; +pub const D3D_SHADER_REQUIRES_ROVS: UINT64 = 0x00001000; +pub const D3D_SHADER_REQUIRES_STENCIL_REF: UINT64 = 0x00000200; +pub const D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS: UINT64 = 0x00000800; +pub const D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER: + UINT64 = 0x00002000; diff --git a/src/vendor/winapi/src/um/d3dcommon.rs b/src/vendor/winapi/src/um/d3dcommon.rs new file mode 100644 index 0000000000..59ff651bfe --- /dev/null +++ b/src/vendor/winapi/src/um/d3dcommon.rs @@ -0,0 +1,746 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of d3dcommon.h +use shared::basetsd::SIZE_T; +use shared::minwindef::{LPCVOID, LPVOID, UINT}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCSTR}; +ENUM!{enum D3D_DRIVER_TYPE { + D3D_DRIVER_TYPE_UNKNOWN, + D3D_DRIVER_TYPE_HARDWARE, + D3D_DRIVER_TYPE_REFERENCE, + D3D_DRIVER_TYPE_NULL, + D3D_DRIVER_TYPE_SOFTWARE, + D3D_DRIVER_TYPE_WARP, +}} +ENUM!{enum D3D_FEATURE_LEVEL { + D3D_FEATURE_LEVEL_9_1 = 0x9100, + D3D_FEATURE_LEVEL_9_2 = 0x9200, + D3D_FEATURE_LEVEL_9_3 = 0x9300, + D3D_FEATURE_LEVEL_10_0 = 0xa000, + D3D_FEATURE_LEVEL_10_1 = 0xa100, + D3D_FEATURE_LEVEL_11_0 = 0xb000, + D3D_FEATURE_LEVEL_11_1 = 0xb100, + D3D_FEATURE_LEVEL_12_0 = 0xc000, + D3D_FEATURE_LEVEL_12_1 = 0xc100, +}} +ENUM!{enum D3D_PRIMITIVE_TOPOLOGY { + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1, + D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13, + D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, + D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34, + D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35, + D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36, + D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37, + D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38, + D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39, + D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40, + D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41, + D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42, + D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43, + D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44, + D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45, + D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46, + D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47, + D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48, + D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49, + D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50, + D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51, + D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52, + D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53, + D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54, + D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55, + D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56, + D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57, + D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58, + D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59, + D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60, + D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61, + D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62, + D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63, + D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64, +}} +pub const D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; +pub const D3D10_PRIMITIVE_TOPOLOGY_POINTLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_POINTLIST; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; +pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; +pub const D3D11_PRIMITIVE_TOPOLOGY_POINTLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_POINTLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; +pub const D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST; +pub const D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = + D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST; +ENUM!{enum D3D_PRIMITIVE { + D3D_PRIMITIVE_UNDEFINED = 0, + D3D_PRIMITIVE_POINT = 1, + D3D_PRIMITIVE_LINE = 2, + D3D_PRIMITIVE_TRIANGLE = 3, + D3D_PRIMITIVE_LINE_ADJ = 6, + D3D_PRIMITIVE_TRIANGLE_ADJ = 7, + D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, + D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9, + D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10, + D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11, + D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12, + D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13, + D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14, + D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15, + D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16, + D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17, + D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18, + D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19, + D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20, + D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21, + D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22, + D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23, + D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24, + D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25, + D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26, + D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 28, + D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 29, + D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 30, + D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 31, + D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 32, + D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 33, + D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 34, + D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 35, + D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 36, + D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 37, + D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 38, + D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 39, + D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 40, +}} +pub const D3D10_PRIMITIVE_UNDEFINED: D3D_PRIMITIVE = D3D_PRIMITIVE_UNDEFINED; +pub const D3D10_PRIMITIVE_POINT: D3D_PRIMITIVE = D3D_PRIMITIVE_POINT; +pub const D3D10_PRIMITIVE_LINE: D3D_PRIMITIVE = D3D_PRIMITIVE_LINE; +pub const D3D10_PRIMITIVE_TRIANGLE: D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE; +pub const D3D10_PRIMITIVE_LINE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE_LINE_ADJ; +pub const D3D10_PRIMITIVE_TRIANGLE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE_ADJ; +pub const D3D11_PRIMITIVE_UNDEFINED: D3D_PRIMITIVE = D3D_PRIMITIVE_UNDEFINED; +pub const D3D11_PRIMITIVE_POINT: D3D_PRIMITIVE = D3D_PRIMITIVE_POINT; +pub const D3D11_PRIMITIVE_LINE: D3D_PRIMITIVE = D3D_PRIMITIVE_LINE; +pub const D3D11_PRIMITIVE_TRIANGLE: D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE; +pub const D3D11_PRIMITIVE_LINE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE_LINE_ADJ; +pub const D3D11_PRIMITIVE_TRIANGLE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE_ADJ; +pub const D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_1_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_2_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_3_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_4_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_5_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_6_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_7_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_8_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_9_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_10_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_11_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_12_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_13_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_14_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_15_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_16_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_17_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_18_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_19_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_20_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_21_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_22_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_23_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_24_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_25_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_26_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_27_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_28_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_29_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_30_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_31_CONTROL_POINT_PATCH; +pub const D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH: D3D_PRIMITIVE = + D3D_PRIMITIVE_32_CONTROL_POINT_PATCH; +ENUM!{enum D3D_SRV_DIMENSION { + D3D_SRV_DIMENSION_UNKNOWN = 0, + D3D_SRV_DIMENSION_BUFFER = 1, + D3D_SRV_DIMENSION_TEXTURE1D = 2, + D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D_SRV_DIMENSION_TEXTURE2D = 4, + D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D_SRV_DIMENSION_TEXTURE3D = 8, + D3D_SRV_DIMENSION_TEXTURECUBE = 9, + D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10, + D3D_SRV_DIMENSION_BUFFEREX = 11, +}} +pub const D3D10_SRV_DIMENSION_UNKNOWN: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_UNKNOWN; +pub const D3D10_SRV_DIMENSION_BUFFER: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_BUFFER; +pub const D3D10_SRV_DIMENSION_TEXTURE1D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE1D; +pub const D3D10_SRV_DIMENSION_TEXTURE1DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE1DARRAY; +pub const D3D10_SRV_DIMENSION_TEXTURE2D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2D; +pub const D3D10_SRV_DIMENSION_TEXTURE2DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2DARRAY; +pub const D3D10_SRV_DIMENSION_TEXTURE2DMS: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2DMS; +pub const D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY: D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; +pub const D3D10_SRV_DIMENSION_TEXTURE3D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE3D; +pub const D3D10_SRV_DIMENSION_TEXTURECUBE: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURECUBE; +pub const D3D10_1_SRV_DIMENSION_UNKNOWN: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_UNKNOWN; +pub const D3D10_1_SRV_DIMENSION_BUFFER: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_BUFFER; +pub const D3D10_1_SRV_DIMENSION_TEXTURE1D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE1D; +pub const D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY: D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE1DARRAY; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2D; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY: D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DARRAY; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMS: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2DMS; +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY: D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; +pub const D3D10_1_SRV_DIMENSION_TEXTURE3D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE3D; +pub const D3D10_1_SRV_DIMENSION_TEXTURECUBE: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURECUBE; +pub const D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY: D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURECUBEARRAY; +pub const D3D11_SRV_DIMENSION_UNKNOWN: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_UNKNOWN; +pub const D3D11_SRV_DIMENSION_BUFFER: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_BUFFER; +pub const D3D11_SRV_DIMENSION_TEXTURE1D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE1D; +pub const D3D11_SRV_DIMENSION_TEXTURE1DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE1DARRAY; +pub const D3D11_SRV_DIMENSION_TEXTURE2D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2D; +pub const D3D11_SRV_DIMENSION_TEXTURE2DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2DARRAY; +pub const D3D11_SRV_DIMENSION_TEXTURE2DMS: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE2DMS; +pub const D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY: D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; +pub const D3D11_SRV_DIMENSION_TEXTURE3D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURE3D; +pub const D3D11_SRV_DIMENSION_TEXTURECUBE: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_TEXTURECUBE; +pub const D3D11_SRV_DIMENSION_TEXTURECUBEARRAY: D3D_SRV_DIMENSION = + D3D_SRV_DIMENSION_TEXTURECUBEARRAY; +pub const D3D11_SRV_DIMENSION_BUFFEREX: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION_BUFFEREX; +STRUCT!{struct D3D_SHADER_MACRO { + Name: LPCSTR, + Definition: LPCSTR, +}} +pub type LPD3D_SHADER_MACRO = *mut D3D_SHADER_MACRO; +DEFINE_GUID!{IID_ID3D10Blob, + 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0x0d, 0x98, 0x9c, 0x3a, 0x01, 0x02} +RIDL!(#[uuid(0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2)] +interface ID3D10Blob(ID3D10BlobVtbl): IUnknown(IUnknownVtbl) { + fn GetBufferPointer() -> LPVOID, + fn GetBufferSize() -> SIZE_T, +} +); +pub type LPD3D10BLOB = *mut ID3D10Blob; +pub type ID3DBlob = ID3D10Blob; +pub type LPD3DBLOB = *mut ID3DBlob; +ENUM!{enum D3D_INCLUDE_TYPE { + D3D_INCLUDE_LOCAL = 0, + D3D_INCLUDE_SYSTEM, +}} +pub const D3D10_INCLUDE_LOCAL: D3D_INCLUDE_TYPE = D3D_INCLUDE_LOCAL; +pub const D3D10_INCLUDE_SYSTEM: D3D_INCLUDE_TYPE = D3D_INCLUDE_SYSTEM; +RIDL!{#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] +interface ID3DInclude(ID3DIncludeVtbl) { + fn Open( + IncludeType: D3D_INCLUDE_TYPE, + pFileName: LPCSTR, + pParentData: LPCVOID, + ppData: *mut LPCVOID, + pBytes: *mut UINT, + ) -> HRESULT, + fn Close( + pData: LPCVOID, + ) -> HRESULT, +}} +pub type LPD3DINCLUDE = *mut ID3DInclude; +ENUM!{enum D3D_SHADER_VARIABLE_CLASS { + D3D_SVC_SCALAR = 0, + D3D_SVC_VECTOR, + D3D_SVC_MATRIX_ROWS, + D3D_SVC_MATRIX_COLUMNS, + D3D_SVC_OBJECT, + D3D_SVC_STRUCT, + D3D_SVC_INTERFACE_CLASS, + D3D_SVC_INTERFACE_POINTER, +}} +pub const D3D10_SVC_SCALAR: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_SCALAR; +pub const D3D10_SVC_VECTOR: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_VECTOR; +pub const D3D10_SVC_MATRIX_ROWS: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_MATRIX_ROWS; +pub const D3D10_SVC_MATRIX_COLUMNS: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_MATRIX_COLUMNS; +pub const D3D10_SVC_OBJECT: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_OBJECT; +pub const D3D10_SVC_STRUCT: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_STRUCT; +pub const D3D11_SVC_INTERFACE_CLASS: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_INTERFACE_CLASS; +pub const D3D11_SVC_INTERFACE_POINTER: D3D_SHADER_VARIABLE_CLASS = D3D_SVC_INTERFACE_POINTER; +ENUM!{enum D3D_SHADER_VARIABLE_FLAGS { + D3D_SVF_USERPACKED = 1, + D3D_SVF_USED = 2, + D3D_SVF_INTERFACE_POINTER = 4, + D3D_SVF_INTERFACE_PARAMETER = 8, +}} +pub const D3D10_SVF_USERPACKED: D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_USERPACKED; +pub const D3D10_SVF_USED: D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_USED; +pub const D3D11_SVF_INTERFACE_POINTER: D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_INTERFACE_POINTER; +pub const D3D11_SVF_INTERFACE_PARAMETER: D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_INTERFACE_PARAMETER; +ENUM!{enum D3D_SHADER_VARIABLE_TYPE { + D3D_SVT_VOID = 0, + D3D_SVT_BOOL = 1, + D3D_SVT_INT = 2, + D3D_SVT_FLOAT = 3, + D3D_SVT_STRING = 4, + D3D_SVT_TEXTURE = 5, + D3D_SVT_TEXTURE1D = 6, + D3D_SVT_TEXTURE2D = 7, + D3D_SVT_TEXTURE3D = 8, + D3D_SVT_TEXTURECUBE = 9, + D3D_SVT_SAMPLER = 10, + D3D_SVT_SAMPLER1D = 11, + D3D_SVT_SAMPLER2D = 12, + D3D_SVT_SAMPLER3D = 13, + D3D_SVT_SAMPLERCUBE = 14, + D3D_SVT_PIXELSHADER = 15, + D3D_SVT_VERTEXSHADER = 16, + D3D_SVT_PIXELFRAGMENT = 17, + D3D_SVT_VERTEXFRAGMENT = 18, + D3D_SVT_UINT = 19, + D3D_SVT_UINT8 = 20, + D3D_SVT_GEOMETRYSHADER = 21, + D3D_SVT_RASTERIZER = 22, + D3D_SVT_DEPTHSTENCIL = 23, + D3D_SVT_BLEND = 24, + D3D_SVT_BUFFER = 25, + D3D_SVT_CBUFFER = 26, + D3D_SVT_TBUFFER = 27, + D3D_SVT_TEXTURE1DARRAY = 28, + D3D_SVT_TEXTURE2DARRAY = 29, + D3D_SVT_RENDERTARGETVIEW = 30, + D3D_SVT_DEPTHSTENCILVIEW = 31, + D3D_SVT_TEXTURE2DMS = 32, + D3D_SVT_TEXTURE2DMSARRAY = 33, + D3D_SVT_TEXTURECUBEARRAY = 34, + D3D_SVT_HULLSHADER = 35, + D3D_SVT_DOMAINSHADER = 36, + D3D_SVT_INTERFACE_POINTER = 37, + D3D_SVT_COMPUTESHADER = 38, + D3D_SVT_DOUBLE = 39, + D3D_SVT_RWTEXTURE1D = 40, + D3D_SVT_RWTEXTURE1DARRAY = 41, + D3D_SVT_RWTEXTURE2D = 42, + D3D_SVT_RWTEXTURE2DARRAY = 43, + D3D_SVT_RWTEXTURE3D = 44, + D3D_SVT_RWBUFFER = 45, + D3D_SVT_BYTEADDRESS_BUFFER = 46, + D3D_SVT_RWBYTEADDRESS_BUFFER = 47, + D3D_SVT_STRUCTURED_BUFFER = 48, + D3D_SVT_RWSTRUCTURED_BUFFER = 49, + D3D_SVT_APPEND_STRUCTURED_BUFFER = 50, + D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51, + D3D_SVT_MIN8FLOAT = 52, + D3D_SVT_MIN10FLOAT = 53, + D3D_SVT_MIN16FLOAT = 54, + D3D_SVT_MIN12INT = 55, + D3D_SVT_MIN16INT = 56, + D3D_SVT_MIN16UINT = 57, +}} +pub const D3D10_SVT_VOID: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VOID; +pub const D3D10_SVT_BOOL: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BOOL; +pub const D3D10_SVT_INT: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_INT; +pub const D3D10_SVT_FLOAT: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_FLOAT; +pub const D3D10_SVT_STRING: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_STRING; +pub const D3D10_SVT_TEXTURE: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE; +pub const D3D10_SVT_TEXTURE1D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE1D; +pub const D3D10_SVT_TEXTURE2D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2D; +pub const D3D10_SVT_TEXTURE3D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE3D; +pub const D3D10_SVT_TEXTURECUBE: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURECUBE; +pub const D3D10_SVT_SAMPLER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER; +pub const D3D10_SVT_SAMPLER1D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER1D; +pub const D3D10_SVT_SAMPLER2D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER2D; +pub const D3D10_SVT_SAMPLER3D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER3D; +pub const D3D10_SVT_SAMPLERCUBE: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLERCUBE; +pub const D3D10_SVT_PIXELSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_PIXELSHADER; +pub const D3D10_SVT_VERTEXSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VERTEXSHADER; +pub const D3D10_SVT_PIXELFRAGMENT: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_PIXELFRAGMENT; +pub const D3D10_SVT_VERTEXFRAGMENT: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VERTEXFRAGMENT; +pub const D3D10_SVT_UINT: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_UINT; +pub const D3D10_SVT_UINT8: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_UINT8; +pub const D3D10_SVT_GEOMETRYSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_GEOMETRYSHADER; +pub const D3D10_SVT_RASTERIZER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RASTERIZER; +pub const D3D10_SVT_DEPTHSTENCIL: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DEPTHSTENCIL; +pub const D3D10_SVT_BLEND: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BLEND; +pub const D3D10_SVT_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BUFFER; +pub const D3D10_SVT_CBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_CBUFFER; +pub const D3D10_SVT_TBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TBUFFER; +pub const D3D10_SVT_TEXTURE1DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE1DARRAY; +pub const D3D10_SVT_TEXTURE2DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DARRAY; +pub const D3D10_SVT_RENDERTARGETVIEW: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RENDERTARGETVIEW; +pub const D3D10_SVT_DEPTHSTENCILVIEW: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DEPTHSTENCILVIEW; +pub const D3D10_SVT_TEXTURE2DMS: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DMS; +pub const D3D10_SVT_TEXTURE2DMSARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DMSARRAY; +pub const D3D10_SVT_TEXTURECUBEARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURECUBEARRAY; +pub const D3D11_SVT_HULLSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_HULLSHADER; +pub const D3D11_SVT_DOMAINSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DOMAINSHADER; +pub const D3D11_SVT_INTERFACE_POINTER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_INTERFACE_POINTER; +pub const D3D11_SVT_COMPUTESHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_COMPUTESHADER; +pub const D3D11_SVT_DOUBLE: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DOUBLE; +pub const D3D11_SVT_RWTEXTURE1D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE1D; +pub const D3D11_SVT_RWTEXTURE1DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE1DARRAY; +pub const D3D11_SVT_RWTEXTURE2D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE2D; +pub const D3D11_SVT_RWTEXTURE2DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE2DARRAY; +pub const D3D11_SVT_RWTEXTURE3D: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE3D; +pub const D3D11_SVT_RWBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWBUFFER; +pub const D3D11_SVT_BYTEADDRESS_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BYTEADDRESS_BUFFER; +pub const D3D11_SVT_RWBYTEADDRESS_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWBYTEADDRESS_BUFFER; +pub const D3D11_SVT_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_STRUCTURED_BUFFER; +pub const D3D11_SVT_RWSTRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWSTRUCTURED_BUFFER; +pub const D3D11_SVT_APPEND_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = + D3D_SVT_APPEND_STRUCTURED_BUFFER; +pub const D3D11_SVT_CONSUME_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = + D3D_SVT_CONSUME_STRUCTURED_BUFFER; +ENUM!{enum D3D_SHADER_INPUT_FLAGS { + D3D_SIF_USERPACKED = 0x1, + D3D_SIF_COMPARISON_SAMPLER = 0x2, + D3D_SIF_TEXTURE_COMPONENT_0 = 0x4, + D3D_SIF_TEXTURE_COMPONENT_1 = 0x8, + D3D_SIF_TEXTURE_COMPONENTS = 0xc, + D3D_SIF_UNUSED = 0x10, +}} +pub const D3D10_SIF_USERPACKED: D3D_SHADER_INPUT_FLAGS = D3D_SIF_USERPACKED; +pub const D3D10_SIF_COMPARISON_SAMPLER: D3D_SHADER_INPUT_FLAGS = D3D_SIF_COMPARISON_SAMPLER; +pub const D3D10_SIF_TEXTURE_COMPONENT_0: D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENT_0; +pub const D3D10_SIF_TEXTURE_COMPONENT_1: D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENT_1; +pub const D3D10_SIF_TEXTURE_COMPONENTS: D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENTS; +ENUM!{enum D3D_SHADER_INPUT_TYPE { + D3D_SIT_CBUFFER, + D3D_SIT_TBUFFER, + D3D_SIT_TEXTURE, + D3D_SIT_SAMPLER, + D3D_SIT_UAV_RWTYPED, + D3D_SIT_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED, + D3D_SIT_BYTEADDRESS, + D3D_SIT_UAV_RWBYTEADDRESS, + D3D_SIT_UAV_APPEND_STRUCTURED, + D3D_SIT_UAV_CONSUME_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, +}} +pub const D3D10_SIT_CBUFFER: D3D_SHADER_INPUT_TYPE = D3D_SIT_CBUFFER; +pub const D3D10_SIT_TBUFFER: D3D_SHADER_INPUT_TYPE = D3D_SIT_TBUFFER; +pub const D3D10_SIT_TEXTURE: D3D_SHADER_INPUT_TYPE = D3D_SIT_TEXTURE; +pub const D3D10_SIT_SAMPLER: D3D_SHADER_INPUT_TYPE = D3D_SIT_SAMPLER; +pub const D3D11_SIT_UAV_RWTYPED: D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWTYPED; +pub const D3D11_SIT_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SIT_STRUCTURED; +pub const D3D11_SIT_UAV_RWSTRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWSTRUCTURED; +pub const D3D11_SIT_BYTEADDRESS: D3D_SHADER_INPUT_TYPE = D3D_SIT_BYTEADDRESS; +pub const D3D11_SIT_UAV_RWBYTEADDRESS: D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWBYTEADDRESS; +pub const D3D11_SIT_UAV_APPEND_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_APPEND_STRUCTURED; +pub const D3D11_SIT_UAV_CONSUME_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_CONSUME_STRUCTURED; +pub const D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER: D3D_SHADER_INPUT_TYPE = + D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER; +ENUM!{enum D3D_SHADER_CBUFFER_FLAGS { + D3D_CBF_USERPACKED = 1, +}} +pub const D3D10_CBF_USERPACKED: D3D_SHADER_CBUFFER_FLAGS = D3D_CBF_USERPACKED; +ENUM!{enum D3D_CBUFFER_TYPE { + D3D_CT_CBUFFER, + D3D_CT_TBUFFER, + D3D_CT_INTERFACE_POINTERS, + D3D_CT_RESOURCE_BIND_INFO, +}} +pub const D3D10_CT_CBUFFER: D3D_CBUFFER_TYPE = D3D_CT_CBUFFER; +pub const D3D10_CT_TBUFFER: D3D_CBUFFER_TYPE = D3D_CT_TBUFFER; +pub const D3D11_CT_CBUFFER: D3D_CBUFFER_TYPE = D3D_CT_CBUFFER; +pub const D3D11_CT_TBUFFER: D3D_CBUFFER_TYPE = D3D_CT_TBUFFER; +pub const D3D11_CT_INTERFACE_POINTERS: D3D_CBUFFER_TYPE = D3D_CT_INTERFACE_POINTERS; +pub const D3D11_CT_RESOURCE_BIND_INFO: D3D_CBUFFER_TYPE = D3D_CT_RESOURCE_BIND_INFO; +ENUM!{enum D3D_NAME { + D3D_NAME_UNDEFINED = 0, + D3D_NAME_POSITION = 1, + D3D_NAME_CLIP_DISTANCE = 2, + D3D_NAME_CULL_DISTANCE = 3, + D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, + D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, + D3D_NAME_VERTEX_ID = 6, + D3D_NAME_PRIMITIVE_ID = 7, + D3D_NAME_INSTANCE_ID = 8, + D3D_NAME_IS_FRONT_FACE = 9, + D3D_NAME_SAMPLE_INDEX = 10, + D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11, + D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12, + D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13, + D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14, + D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15, + D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16, + D3D_NAME_TARGET = 64, + D3D_NAME_DEPTH = 65, + D3D_NAME_COVERAGE = 66, + D3D_NAME_DEPTH_GREATER_EQUAL = 67, + D3D_NAME_DEPTH_LESS_EQUAL = 68, +}} +pub const D3D10_NAME_UNDEFINED: D3D_NAME = D3D_NAME_UNDEFINED; +pub const D3D10_NAME_POSITION: D3D_NAME = D3D_NAME_POSITION; +pub const D3D10_NAME_CLIP_DISTANCE: D3D_NAME = D3D_NAME_CLIP_DISTANCE; +pub const D3D10_NAME_CULL_DISTANCE: D3D_NAME = D3D_NAME_CULL_DISTANCE; +pub const D3D10_NAME_RENDER_TARGET_ARRAY_INDEX: D3D_NAME = D3D_NAME_RENDER_TARGET_ARRAY_INDEX; +pub const D3D10_NAME_VIEWPORT_ARRAY_INDEX: D3D_NAME = D3D_NAME_VIEWPORT_ARRAY_INDEX; +pub const D3D10_NAME_VERTEX_ID: D3D_NAME = D3D_NAME_VERTEX_ID; +pub const D3D10_NAME_PRIMITIVE_ID: D3D_NAME = D3D_NAME_PRIMITIVE_ID; +pub const D3D10_NAME_INSTANCE_ID: D3D_NAME = D3D_NAME_INSTANCE_ID; +pub const D3D10_NAME_IS_FRONT_FACE: D3D_NAME = D3D_NAME_IS_FRONT_FACE; +pub const D3D10_NAME_SAMPLE_INDEX: D3D_NAME = D3D_NAME_SAMPLE_INDEX; +pub const D3D10_NAME_TARGET: D3D_NAME = D3D_NAME_TARGET; +pub const D3D10_NAME_DEPTH: D3D_NAME = D3D_NAME_DEPTH; +pub const D3D10_NAME_COVERAGE: D3D_NAME = D3D_NAME_COVERAGE; +pub const D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR; +pub const D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR: D3D_NAME + = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR; +pub const D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR; +pub const D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR; +pub const D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR: D3D_NAME + = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR; +pub const D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR: D3D_NAME + = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR; +pub const D3D11_NAME_DEPTH_GREATER_EQUAL: D3D_NAME = D3D_NAME_DEPTH_GREATER_EQUAL; +pub const D3D11_NAME_DEPTH_LESS_EQUAL: D3D_NAME = D3D_NAME_DEPTH_LESS_EQUAL; +ENUM!{enum D3D_RESOURCE_RETURN_TYPE { + D3D_RETURN_TYPE_UNORM = 1, + D3D_RETURN_TYPE_SNORM = 2, + D3D_RETURN_TYPE_SINT = 3, + D3D_RETURN_TYPE_UINT = 4, + D3D_RETURN_TYPE_FLOAT = 5, + D3D_RETURN_TYPE_MIXED = 6, + D3D_RETURN_TYPE_DOUBLE = 7, + D3D_RETURN_TYPE_CONTINUED = 8, +}} +pub const D3D10_RETURN_TYPE_UNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UNORM; +pub const D3D10_RETURN_TYPE_SNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SNORM; +pub const D3D10_RETURN_TYPE_SINT: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SINT; +pub const D3D10_RETURN_TYPE_UINT: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UINT; +pub const D3D10_RETURN_TYPE_FLOAT: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_FLOAT; +pub const D3D10_RETURN_TYPE_MIXED: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_MIXED; +pub const D3D11_RETURN_TYPE_UNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UNORM; +pub const D3D11_RETURN_TYPE_SNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SNORM; +pub const D3D11_RETURN_TYPE_SINT: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SINT; +pub const D3D11_RETURN_TYPE_UINT: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UINT; +pub const D3D11_RETURN_TYPE_FLOAT: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_FLOAT; +pub const D3D11_RETURN_TYPE_MIXED: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_MIXED; +pub const D3D11_RETURN_TYPE_DOUBLE: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_DOUBLE; +pub const D3D11_RETURN_TYPE_CONTINUED: D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_CONTINUED; +ENUM!{enum D3D_REGISTER_COMPONENT_TYPE { + D3D_REGISTER_COMPONENT_UNKNOWN = 0, + D3D_REGISTER_COMPONENT_UINT32 = 1, + D3D_REGISTER_COMPONENT_SINT32 = 2, + D3D_REGISTER_COMPONENT_FLOAT32 = 3, +}} +pub const D3D10_REGISTER_COMPONENT_UNKNOWN: D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_UNKNOWN; +pub const D3D10_REGISTER_COMPONENT_UINT32: D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_UINT32; +pub const D3D10_REGISTER_COMPONENT_SINT32: D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_SINT32; +pub const D3D10_REGISTER_COMPONENT_FLOAT32: D3D_REGISTER_COMPONENT_TYPE = + D3D_REGISTER_COMPONENT_FLOAT32; +ENUM!{enum D3D_TESSELLATOR_DOMAIN { + D3D_TESSELLATOR_DOMAIN_UNDEFINED, + D3D_TESSELLATOR_DOMAIN_ISOLINE, + D3D_TESSELLATOR_DOMAIN_TRI, + D3D_TESSELLATOR_DOMAIN_QUAD, +}} +pub const D3D11_TESSELLATOR_DOMAIN_UNDEFINED: D3D_TESSELLATOR_DOMAIN = + D3D_TESSELLATOR_DOMAIN_UNDEFINED; +pub const D3D11_TESSELLATOR_DOMAIN_ISOLINE: D3D_TESSELLATOR_DOMAIN = + D3D_TESSELLATOR_DOMAIN_ISOLINE; +pub const D3D11_TESSELLATOR_DOMAIN_TRI: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN_TRI; +pub const D3D11_TESSELLATOR_DOMAIN_QUAD: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN_QUAD; +ENUM!{enum D3D_TESSELLATOR_PARTITIONING { + D3D_TESSELLATOR_PARTITIONING_UNDEFINED, + D3D_TESSELLATOR_PARTITIONING_INTEGER, + D3D_TESSELLATOR_PARTITIONING_POW2, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, +}} +pub const D3D11_TESSELLATOR_PARTITIONING_UNDEFINED: D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_UNDEFINED; +pub const D3D11_TESSELLATOR_PARTITIONING_INTEGER: D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_INTEGER; +pub const D3D11_TESSELLATOR_PARTITIONING_POW2: D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_POW2; +pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD: D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD; +pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN: D3D_TESSELLATOR_PARTITIONING = + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN; +ENUM!{enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE { + D3D_TESSELLATOR_OUTPUT_UNDEFINED, + D3D_TESSELLATOR_OUTPUT_POINT, + D3D_TESSELLATOR_OUTPUT_LINE, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, +}} +pub const D3D11_TESSELLATOR_OUTPUT_UNDEFINED: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_UNDEFINED; +pub const D3D11_TESSELLATOR_OUTPUT_POINT: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_POINT; +pub const D3D11_TESSELLATOR_OUTPUT_LINE: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_LINE; +pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW; +pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW; +ENUM!{enum D3D_MIN_PRECISION { + D3D_MIN_PRECISION_DEFAULT, + D3D_MIN_PRECISION_FLOAT_16, + D3D_MIN_PRECISION_FLOAT_2_8, + D3D_MIN_PRECISION_RESERVED, + D3D_MIN_PRECISION_SINT_16, + D3D_MIN_PRECISION_UINT_16, + D3D_MIN_PRECISION_ANY_16 = 0xf0, + D3D_MIN_PRECISION_ANY_10 = 0xf1, +}} +ENUM!{enum D3D_INTERPOLATION_MODE { + D3D_INTERPOLATION_UNDEFINED, + D3D_INTERPOLATION_CONSTANT, + D3D_INTERPOLATION_LINEAR, + D3D_INTERPOLATION_LINEAR_CENTROID, + D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE, + D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID, + D3D_INTERPOLATION_LINEAR_SAMPLE, + D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE, +}} +ENUM!{enum D3D_PARAMETER_FLAGS { + D3D_PF_NONE = 0, + D3D_PF_IN = 0x1, + D3D_PF_OUT = 0x2, +}} +DEFINE_GUID!{WKPDID_D3DDebugObjectName, + 0x429b8c22, 0x9188, 0x4b0c, 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00} +DEFINE_GUID!{WKPDID_D3DDebugObjectNameW, + 0x4cca5fd8, 0x921f, 0x42c8, 0x85, 0x66, 0x70, 0xca, 0xf2, 0xa9, 0xb7, 0x41} +DEFINE_GUID!{WKPDID_CommentStringW, + 0xd0149dc0, 0x90e8, 0x4ec8, 0x81, 0x44, 0xe9, 0x00, 0xad, 0x26, 0x6b, 0xb2} diff --git a/src/vendor/winapi/src/um/d3dcompiler.rs b/src/vendor/winapi/src/um/d3dcompiler.rs new file mode 100644 index 0000000000..1a844474a4 --- /dev/null +++ b/src/vendor/winapi/src/um/d3dcompiler.rs @@ -0,0 +1,275 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_void; +use shared::basetsd::SIZE_T; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, DWORD, LPCVOID, LPVOID, UINT}; +use um::d3d11shader::{ID3D11FunctionLinkingGraph, ID3D11Linker, ID3D11Module}; +use um::d3dcommon::{D3D_SHADER_MACRO, ID3DBlob, ID3DInclude}; +use um::winnt::{HRESULT, LPCSTR, LPCWSTR}; +pub const D3DCOMPILER_DLL: &'static str = "d3dcompiler_47.dll"; +pub const D3D_COMPILER_VERSION: DWORD = 47; +extern "system" { + pub fn D3DReadFileToBlob( + pFileName: LPCWSTR, + ppContents: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DWriteBlobToFile( + pBlob: *mut ID3DBlob, + pFileName: LPCWSTR, + bOverwrite: BOOL, + ) -> HRESULT; +} +pub const D3DCOMPILE_DEBUG: DWORD = 1 << 0; +pub const D3DCOMPILE_SKIP_VALIDATION: DWORD = 1 << 1; +pub const D3DCOMPILE_SKIP_OPTIMIZATION: DWORD = 1 << 2; +pub const D3DCOMPILE_PACK_MATRIX_ROW_MAJOR: DWORD = 1 << 3; +pub const D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR: DWORD = 1 << 4; +pub const D3DCOMPILE_PARTIAL_PRECISION: DWORD = 1 << 5; +pub const D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT: DWORD = 1 << 6; +pub const D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT: DWORD = 1 << 7; +pub const D3DCOMPILE_NO_PRESHADER: DWORD = 1 << 8; +pub const D3DCOMPILE_AVOID_FLOW_CONTROL: DWORD = 1 << 9; +pub const D3DCOMPILE_PREFER_FLOW_CONTROL: DWORD = 1 << 10; +pub const D3DCOMPILE_ENABLE_STRICTNESS: DWORD = 1 << 11; +pub const D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY: DWORD = 1 << 12; +pub const D3DCOMPILE_IEEE_STRICTNESS: DWORD = 1 << 13; +pub const D3DCOMPILE_OPTIMIZATION_LEVEL0: DWORD = 1 << 14; +pub const D3DCOMPILE_OPTIMIZATION_LEVEL1: DWORD = 0; +pub const D3DCOMPILE_OPTIMIZATION_LEVEL2: DWORD = (1 << 14) | (1 << 15); +pub const D3DCOMPILE_OPTIMIZATION_LEVEL3: DWORD = 1 << 15; +pub const D3DCOMPILE_RESERVED16: DWORD = 1 << 16; +pub const D3DCOMPILE_RESERVED17: DWORD = 1 << 17; +pub const D3DCOMPILE_WARNINGS_ARE_ERRORS: DWORD = 1 << 18; +pub const D3DCOMPILE_RESOURCES_MAY_ALIAS: DWORD = 1 << 19; +pub const D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES: DWORD = 1 << 20; +pub const D3DCOMPILE_ALL_RESOURCES_BOUND: DWORD = 1 << 21; +pub const D3DCOMPILE_EFFECT_CHILD_EFFECT: DWORD = 1 << 0; +pub const D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS: DWORD = 1 << 1; +pub const D3D_COMPILE_STANDARD_FILE_INCLUDE: *mut ID3DInclude = 1 as *mut ID3DInclude; +extern "system" { + pub fn D3DCompile( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + pSourceName: LPCSTR, + pDefines: *const D3D_SHADER_MACRO, + pInclude: *mut ID3DInclude, + pEntrypoint: LPCSTR, + pTarget: LPCSTR, + Flags1: UINT, + Flags2: UINT, + ppCode: *mut *mut ID3DBlob, + ppErrorMsgs: *mut *mut ID3DBlob, + ) -> HRESULT; +} +pub const D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS: DWORD = 0x00000001; +pub const D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS: DWORD = 0x00000002; +pub const D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH: DWORD = 0x00000004; +extern "system" { + pub fn D3DCompile2( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + pSourceName: LPCSTR, + pDefines: *const D3D_SHADER_MACRO, + pInclude: *mut ID3DInclude, + pEntrypoint: LPCSTR, + pTarget: LPCSTR, + Flags1: UINT, + Flags2: UINT, + SecondaryDataFlags: UINT, + pSecondaryData: LPCVOID, + SecondaryDataSize: SIZE_T, + ppCode: *mut *mut ID3DBlob, + ppErrorMsgs: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DCompileFromFile( + pFileName: LPCWSTR, + pDefines: *const D3D_SHADER_MACRO, + pInclude: *mut ID3DInclude, + pEntrypoint: LPCSTR, + pTarget: LPCSTR, + Flags1: UINT, + Flags2: UINT, + ppCode: *mut *mut ID3DBlob, + ppErrorMsgs: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DPreprocess( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + pSourceName: LPCSTR, + pDefines: *const D3D_SHADER_MACRO, + pInclude: *mut ID3DInclude, + ppCodeText: *mut *mut ID3DBlob, + ppErrorMsgs: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DGetDebugInfo( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + ppDebugInfo: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DReflect( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + pInterface: REFIID, + ppReflector: *mut *mut c_void, + ) -> HRESULT; + pub fn D3DReflectLibrary( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + riid: REFIID, + ppReflector: *mut LPVOID, + ) -> HRESULT; +} +pub const D3D_DISASM_ENABLE_COLOR_CODE: DWORD = 0x00000001; +pub const D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS: DWORD = 0x00000002; +pub const D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING: DWORD = 0x00000004; +pub const D3D_DISASM_ENABLE_INSTRUCTION_CYCLE: DWORD = 0x00000008; +pub const D3D_DISASM_DISABLE_DEBUG_INFO: DWORD = 0x00000010; +pub const D3D_DISASM_ENABLE_INSTRUCTION_OFFSET: DWORD = 0x00000020; +pub const D3D_DISASM_INSTRUCTION_ONLY: DWORD = 0x00000040; +pub const D3D_DISASM_PRINT_HEX_LITERALS: DWORD = 0x00000080; +extern "system" { + pub fn D3DDisassemble( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + Flags: UINT, + szComments: LPCSTR, + ppDisassembly: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DDisassembleRegion( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + Flags: UINT, + szComments: LPCSTR, + StartByteOffset: SIZE_T, + NumInsts: SIZE_T, + pFinishByteOffset: *mut SIZE_T, + ppDisassembly: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DCreateLinker( + ppLinker: *mut *mut ID3D11Linker, + ) -> HRESULT; + pub fn D3DLoadModule( + pSrcData: LPCVOID, + cbSrcDataSize: SIZE_T, + ppModule: *mut *mut ID3D11Module, + ) -> HRESULT; + pub fn D3DCreateFunctionLinkingGraph( + uFlags: UINT, + ppFunctionLinkingGraph: *mut *mut ID3D11FunctionLinkingGraph, + ) -> HRESULT; +} +pub const D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE: DWORD = 0x00000001; +extern "system" { + pub fn D3DGetTraceInstructionOffsets( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + Flags: UINT, + StartInstIndex: SIZE_T, + NumInsts: SIZE_T, + pOffsets: *mut SIZE_T, + pTotalInsts: *mut SIZE_T, + ) -> HRESULT; + pub fn D3DGetInputSignatureBlob( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + ppSignatureBlob: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DGetOutputSignatureBlob( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + ppSignatureBlob: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DGetInputAndOutputSignatureBlob( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + ppSignatureBlob: *mut *mut ID3DBlob, + ) -> HRESULT; +} +ENUM!{enum D3DCOMPILER_STRIP_FLAGS { + D3DCOMPILER_STRIP_REFLECTION_DATA = 0x00000001, + D3DCOMPILER_STRIP_DEBUG_INFO = 0x00000002, + D3DCOMPILER_STRIP_TEST_BLOBS = 0x00000004, + D3DCOMPILER_STRIP_PRIVATE_DATA = 0x00000008, + D3DCOMPILER_STRIP_ROOT_SIGNATURE = 0x00000010, + D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff, +}} +extern "system" { + pub fn D3DStripShader( + pShaderBytecode: LPCVOID, + BytecodeLength: SIZE_T, + uStripFlags: UINT, + ppStrippedBlob: *mut *mut ID3DBlob, + ) -> HRESULT; +} +ENUM!{enum D3D_BLOB_PART { + D3D_BLOB_INPUT_SIGNATURE_BLOB, + D3D_BLOB_OUTPUT_SIGNATURE_BLOB, + D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, + D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, + D3D_BLOB_ALL_SIGNATURE_BLOB, + D3D_BLOB_DEBUG_INFO, + D3D_BLOB_LEGACY_SHADER, + D3D_BLOB_XNA_PREPASS_SHADER, + D3D_BLOB_XNA_SHADER, + D3D_BLOB_PDB, + D3D_BLOB_PRIVATE_DATA, + D3D_BLOB_ROOT_SIGNATURE, + D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000, + D3D_BLOB_TEST_COMPILE_DETAILS, + D3D_BLOB_TEST_COMPILE_PERF, + D3D_BLOB_TEST_COMPILE_REPORT, +}} +extern "system" { + pub fn D3DGetBlobPart( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + Part: D3D_BLOB_PART, + Flags: UINT, + ppPart: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DSetBlobPart( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + Part: D3D_BLOB_PART, + Flags: UINT, + pPart: LPCVOID, + PartSize: SIZE_T, + ppNewShader: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DCreateBlob( + Size: SIZE_T, + ppBlob: *mut *mut ID3DBlob, + ) -> HRESULT; +} +STRUCT!{struct D3D_SHADER_DATA { + pBytecode: LPCVOID, + BytecodeLength: SIZE_T, +}} +extern "system" { + pub fn D3DCompressShaders( + uNumShaders: UINT, + pShaderData: *mut D3D_SHADER_DATA, + uFlags: UINT, + ppCompressedData: *mut *mut ID3DBlob, + ) -> HRESULT; + pub fn D3DDecompressShaders( + pSrcData: LPCVOID, + SrcDataSize: SIZE_T, + uNumShaders: UINT, + uStartIndex: UINT, + pIndices: *mut UINT, + uFlags: UINT, + ppShaders: *mut *mut ID3DBlob, + pTotalShaders: *mut UINT, + ) -> HRESULT; + // pub fn D3DDisassemble10Effect( + // pEffect: *mut ID3D10Effect, + // Flags: UINT, + // ppDisassembly: *mut *mut ID3DBlob, + // ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/d3dcsx.rs b/src/vendor/winapi/src/um/d3dcsx.rs new file mode 100644 index 0000000000..b7099048c7 --- /dev/null +++ b/src/vendor/winapi/src/um/d3dcsx.rs @@ -0,0 +1,12 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3DX11Scan, + 0x5089b68f, 0xe71d, 0x4d38, 0xbe, 0x8e, 0xf3, 0x63, 0xb9, 0x5a, 0x94, 0x05} +DEFINE_GUID!{IID_ID3DX11SegmentedScan, + 0xa915128c, 0xd954, 0x4c79, 0xbf, 0xe1, 0x64, 0xdb, 0x92, 0x31, 0x94, 0xd6} +DEFINE_GUID!{IID_ID3DX11FFT, + 0xb3f7a938, 0x4c93, 0x4310, 0xa6, 0x75, 0xb3, 0x0d, 0x6d, 0xe5, 0x05, 0x53} diff --git a/src/vendor/winapi/src/um/d3dx10core.rs b/src/vendor/winapi/src/um/d3dx10core.rs new file mode 100644 index 0000000000..7fa9577a47 --- /dev/null +++ b/src/vendor/winapi/src/um/d3dx10core.rs @@ -0,0 +1,12 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3DX10Sprite, + 0xba0b762d, 0x8d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x06, 0x14} +DEFINE_GUID!{IID_ID3DX10ThreadPump, + 0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb} +DEFINE_GUID!{IID_ID3DX10Font, + 0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc} diff --git a/src/vendor/winapi/src/um/d3dx10math.rs b/src/vendor/winapi/src/um/d3dx10math.rs new file mode 100644 index 0000000000..9d01f3ef35 --- /dev/null +++ b/src/vendor/winapi/src/um/d3dx10math.rs @@ -0,0 +1,8 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3DXMatrixStack, + 0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85} diff --git a/src/vendor/winapi/src/um/d3dx10mesh.rs b/src/vendor/winapi/src/um/d3dx10mesh.rs new file mode 100644 index 0000000000..43cf4bd45e --- /dev/null +++ b/src/vendor/winapi/src/um/d3dx10mesh.rs @@ -0,0 +1,20 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ID3DX10BaseMesh, + 0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30} +DEFINE_GUID!{IID_ID3DX10MeshBuffer, + 0x04b0d117, 0x1041, 0x46b1, 0xaa, 0x8a, 0x39, 0x52, 0x84, 0x8b, 0xa2, 0x2e} +DEFINE_GUID!{IID_ID3DX10Mesh, + 0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95} +DEFINE_GUID!{IID_ID3DX10PMesh, + 0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96} +DEFINE_GUID!{IID_ID3DX10SPMesh, + 0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x02, 0x90, 0xb8, 0x3c, 0xc5} +DEFINE_GUID!{IID_ID3DX10PatchMesh, + 0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39} +DEFINE_GUID!{IID_ID3DX10SkinInfo, + 0x420bd604, 0x1c76, 0x4a34, 0xa4, 0x66, 0xe4, 0x5d, 0x06, 0x58, 0xa3, 0x2c} diff --git a/src/vendor/winapi/src/um/datetimeapi.rs b/src/vendor/winapi/src/um/datetimeapi.rs new file mode 100644 index 0000000000..e22aa5d301 --- /dev/null +++ b/src/vendor/winapi/src/um/datetimeapi.rs @@ -0,0 +1,61 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_int; +use shared::minwindef::DWORD; +use um::minwinbase::SYSTEMTIME; +use um::winnt::{LCID, LPCSTR, LPCWSTR, LPSTR, LPWSTR}; +extern "system" { + pub fn GetDateFormatA( + Locale: LCID, + dwFlags: DWORD, + lpDate: *const SYSTEMTIME, + lpFormat: LPCSTR, + lpDateStr: LPSTR, + cchDate: c_int, + ) -> c_int; + pub fn GetDateFormatW( + Locale: LCID, + dwFlags: DWORD, + lpDate: *const SYSTEMTIME, + lpFormat: LPCWSTR, + lpDateStr: LPWSTR, + cchDate: c_int, + ) -> c_int; + pub fn GetTimeFormatA( + Locale: LCID, + dwFlags: DWORD, + lpTime: *const SYSTEMTIME, + lpFormat: LPCSTR, + lpTimeStr: LPSTR, + cchTime: c_int, + ) -> c_int; + pub fn GetTimeFormatW( + Locale: LCID, + dwFlags: DWORD, + lpTime: *const SYSTEMTIME, + lpFormat: LPCWSTR, + lpTimeStr: LPWSTR, + cchTime: c_int, + ) -> c_int; + pub fn GetTimeFormatEx( + lpLocaleName: LPCWSTR, + dwFlags: DWORD, + lpTime: *const SYSTEMTIME, + lpFormat: LPCWSTR, + lpTimeStr: LPWSTR, + cchTime: c_int, + ) -> c_int; + pub fn GetDateFormatEx( + lpLocaleName: LPCWSTR, + dwFlags: DWORD, + lpDate: *const SYSTEMTIME, + lpFormat: LPCWSTR, + lpDateStr: LPWSTR, + cchDate: c_int, + lpCalendar: LPCWSTR, + ) -> c_int; +} diff --git a/src/vendor/winapi/src/um/davclnt.rs b/src/vendor/winapi/src/um/davclnt.rs new file mode 100644 index 0000000000..b9b0cd390a --- /dev/null +++ b/src/vendor/winapi/src/um/davclnt.rs @@ -0,0 +1,105 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! This module defines the DAV specific functions that are exposed to the user +use shared::minwindef::{BOOL, DWORD, LPDWORD, PBYTE, PULONG, ULONG}; +use um::winnt::{HANDLE, LPCWSTR, LPWSTR, PVOID, PWSTR}; +pub type OPAQUE_HANDLE = DWORD; +STRUCT!{struct DAV_CALLBACK_AUTH_BLOB { + pBuffer: PVOID, + ulSize: ULONG, + ulType: ULONG, +}} +pub type PDAV_CALLBACK_AUTH_BLOB = *mut DAV_CALLBACK_AUTH_BLOB; +STRUCT!{struct DAV_CALLBACK_AUTH_UNP { + pszUserName: LPWSTR, + ulUserNameLength: ULONG, + pszPassword: LPWSTR, + ulPasswordLength: ULONG, +}} +pub type PDAV_CALLBACK_AUTH_UNP = *mut DAV_CALLBACK_AUTH_UNP; +STRUCT!{struct DAV_CALLBACK_CRED { + AuthBlob: DAV_CALLBACK_AUTH_BLOB, + UNPBlob: DAV_CALLBACK_AUTH_UNP, + bAuthBlobValid: BOOL, + bSave: BOOL, +}} +pub type PDAV_CALLBACK_CRED = *mut DAV_CALLBACK_CRED; +pub const DAV_AUTHN_SCHEME_BASIC: DWORD = 0x00000001; +pub const DAV_AUTHN_SCHEME_NTLM: DWORD = 0x00000002; +pub const DAV_AUTHN_SCHEME_PASSPORT: DWORD = 0x00000004; +pub const DAV_AUTHN_SCHEME_DIGEST: DWORD = 0x00000008; +pub const DAV_AUTHN_SCHEME_NEGOTIATE: DWORD = 0x00000010; +pub const DAV_AUTHN_SCHEME_CERT: DWORD = 0x00010000; +pub const DAV_AUTHN_SCHEME_FBA: DWORD = 0x00100000; +ENUM!{enum AUTHNEXTSTEP { + DefaultBehavior, + RetryRequest, + CancelRequest, +}} +FN!{stdcall PFNDAVAUTHCALLBACK_FREECRED( + pbuffer: PVOID, +) -> DWORD} +FN!{stdcall PFNDAVAUTHCALLBACK( + lpwzServerName: LPWSTR, + lpwzRemoteName: LPWSTR, + dwAuthScheme: DWORD, + dwFlags: DWORD, + pCallbackCred: PDAV_CALLBACK_CRED, + NextStep: *mut AUTHNEXTSTEP, + pFreeCred: *mut PFNDAVAUTHCALLBACK_FREECRED, +) -> DWORD} +extern "system" { + pub fn DavAddConnection( + ConnectionHandle: *mut HANDLE, + RemoteName: LPCWSTR, + UserName: LPCWSTR, + Password: LPCWSTR, + ClientCert: PBYTE, + CertSize: DWORD, + ) -> DWORD; + pub fn DavDeleteConnection( + ConnectionHandle: HANDLE, + ) -> DWORD; + pub fn DavGetUNCFromHTTPPath( + HttpPath: LPCWSTR, + UncPath: LPWSTR, + lpSize: LPDWORD, + ) -> DWORD; + pub fn DavGetHTTPFromUNCPath( + UncPath: LPCWSTR, + HttpPath: LPWSTR, + lpSize: LPDWORD, + ) -> DWORD; + pub fn DavGetTheLockOwnerOfTheFile( + FileName: LPCWSTR, + LockOwnerName: PWSTR, + LockOwnerNameLengthInBytes: PULONG, + ) -> DWORD; + pub fn DavGetExtendedError( + hFile: HANDLE, + ExtError: *mut DWORD, + ExtErrorString: LPWSTR, + cChSize: *mut DWORD, + ) -> DWORD; + pub fn DavFlushFile( + hFile: HANDLE, + ) -> DWORD; + pub fn DavInvalidateCache( + URLName: LPWSTR, + ) -> DWORD; + pub fn DavCancelConnectionsToServer( + URLName: LPWSTR, + fForce: BOOL, + ) -> DWORD; + pub fn DavRegisterAuthCallback( + CallBack: PFNDAVAUTHCALLBACK, + Version: ULONG, + ) -> OPAQUE_HANDLE; + pub fn DavUnregisterAuthCallback( + hCallback: OPAQUE_HANDLE, + ); +} diff --git a/src/vendor/winapi/src/um/dbghelp.rs b/src/vendor/winapi/src/um/dbghelp.rs new file mode 100644 index 0000000000..2e29f4c1f1 --- /dev/null +++ b/src/vendor/winapi/src/um/dbghelp.rs @@ -0,0 +1,633 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! DbgHelp include file +use shared::basetsd::{DWORD64, PDWORD64, ULONG64}; +use shared::guiddef::GUID; +use shared::minwindef::{ + BOOL, DWORD, HMODULE, LPDWORD, PDWORD, PUCHAR, PULONG, UCHAR, ULONG, USHORT, WORD, +}; +use um::winnt::{ + BOOLEAN, CHAR, HANDLE, LIST_ENTRY, PCSTR, PCWSTR, PIMAGE_NT_HEADERS, PIMAGE_SECTION_HEADER, + PSTR, PVOID, PWSTR, WCHAR, +}; +#[cfg(target_arch = "x86")] +use um::winnt::{ + PFPO_DATA, PIMAGE_COFF_SYMBOLS_HEADER, PIMAGE_DEBUG_DIRECTORY, PIMAGE_FUNCTION_ENTRY, + PIMAGE_NT_HEADERS32, +}; +#[cfg(target_arch = "x86_64")] +use um::winnt::PIMAGE_NT_HEADERS64; +use vc::vcruntime::size_t; +#[cfg(target_arch = "x86_64")] +STRUCT!{struct LOADED_IMAGE { + ModuleName: PSTR, + hFile: HANDLE, + MappedAddress: PUCHAR, + FileHeader: PIMAGE_NT_HEADERS64, + LastRvaSection: PIMAGE_SECTION_HEADER, + NumberOfSections: ULONG, + Sections: PIMAGE_SECTION_HEADER, + Characteristics: ULONG, + fSystemImage: BOOLEAN, + fDOSImage: BOOLEAN, + fReadOnly: BOOLEAN, + Version: UCHAR, + Links: LIST_ENTRY, + SizeOfImage: ULONG, +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct LOADED_IMAGE { + ModuleName: PSTR, + hFile: HANDLE, + MappedAddress: PUCHAR, + FileHeader: PIMAGE_NT_HEADERS32, + LastRvaSection: PIMAGE_SECTION_HEADER, + NumberOfSections: ULONG, + Sections: PIMAGE_SECTION_HEADER, + Characteristics: ULONG, + fSystemImage: BOOLEAN, + fDOSImage: BOOLEAN, + fReadOnly: BOOLEAN, + Version: UCHAR, + Links: LIST_ENTRY, + SizeOfImage: ULONG, +}} +pub const MAX_SYM_NAME: usize = 2000; +pub const ERROR_IMAGE_NOT_STRIPPED: DWORD = 0x8800; +pub const ERROR_NO_DBG_POINTER: DWORD = 0x8801; +pub const ERROR_NO_PDB_POINTER: DWORD = 0x8802; +FN!{stdcall PFIND_DEBUG_FILE_CALLBACK( + FileHandle: HANDLE, + FileName: PCSTR, + CallerData: PVOID, +) -> BOOL} +FN!{stdcall PFIND_DEBUG_FILE_CALLBACKW( + FileHandle: HANDLE, + FileName: PCWSTR, + CallerData: PVOID, +) -> BOOL} +FN!{stdcall PFINDFILEINPATHCALLBACK( + filename: PCSTR, + context: PVOID, +) -> BOOL} +FN!{stdcall PFINDFILEINPATHCALLBACKW( + filename: PCWSTR, + context: PVOID, +) -> BOOL} +FN!{stdcall PFIND_EXE_FILE_CALLBACK( + FileHandle: HANDLE, + FileName: PCSTR, + CallerData: PVOID, +) -> BOOL} +FN!{stdcall PFIND_EXE_FILE_CALLBACKW( + FileHandle: HANDLE, + FileName: PCWSTR, + CallerData: PVOID, +) -> BOOL} +#[cfg(target_arch = "x86")] +STRUCT!{struct IMAGE_DEBUG_INFORMATION { + List: LIST_ENTRY, + ReservedSize: DWORD, + ReservedMappedBase: PVOID, + ReservedMachine: USHORT, + ReservedCharacteristics: USHORT, + ReservedCheckSum: DWORD, + ImageBase: DWORD, + SizeOfImage: DWORD, + ReservedNumberOfSections: DWORD, + ReservedSections: PIMAGE_SECTION_HEADER, + ReservedExportedNamesSize: DWORD, + ReservedExportedNames: PSTR, + ReservedNumberOfFunctionTableEntries: DWORD, + ReservedFunctionTableEntries: PIMAGE_FUNCTION_ENTRY, + ReservedLowestFunctionStartingAddress: DWORD, + ReservedHighestFunctionEndingAddress: DWORD, + ReservedNumberOfFpoTableEntries: DWORD, + ReservedFpoTableEntries: PFPO_DATA, + SizeOfCoffSymbols: DWORD, + CoffSymbols: PIMAGE_COFF_SYMBOLS_HEADER, + ReservedSizeOfCodeViewSymbols: DWORD, + ReservedCodeViewSymbols: PVOID, + ImageFilePath: PSTR, + ImageFileName: PSTR, + ReservedDebugFilePath: PSTR, + ReservedTimeDateStamp: DWORD, + ReservedRomImage: BOOL, + ReservedDebugDirectory: PIMAGE_DEBUG_DIRECTORY, + ReservedNumberOfDebugDirectories: DWORD, + ReservedOriginalFunctionTableBaseAddress: DWORD, + Reserved: [DWORD; 2], +}} +#[cfg(target_arch = "x86")] +pub type PIMAGE_DEBUG_INFORMATION = *mut IMAGE_DEBUG_INFORMATION; +FN!{stdcall PENUMDIRTREE_CALLBACK( + FilePath: PCSTR, + CallerData: PVOID, +) -> BOOL} +FN!{stdcall PENUMDIRTREE_CALLBACKW( + FilePath: PCWSTR, + CallerData: PVOID, +) -> BOOL} +pub const UNDNAME_COMPLETE: DWORD = 0x0000; +pub const UNDNAME_NO_LEADING_UNDERSCORES: DWORD = 0x0001; +pub const UNDNAME_NO_MS_KEYWORDS: DWORD = 0x0002; +pub const UNDNAME_NO_FUNCTION_RETURNS: DWORD = 0x0004; +pub const UNDNAME_NO_ALLOCATION_MODEL: DWORD = 0x0008; +pub const UNDNAME_NO_ALLOCATION_LANGUAGE: DWORD = 0x0010; +pub const UNDNAME_NO_MS_THISTYPE: DWORD = 0x0020; +pub const UNDNAME_NO_CV_THISTYPE: DWORD = 0x0040; +pub const UNDNAME_NO_THISTYPE: DWORD = 0x0060; +pub const UNDNAME_NO_ACCESS_SPECIFIERS: DWORD = 0x0080; +pub const UNDNAME_NO_THROW_SIGNATURES: DWORD = 0x0100; +pub const UNDNAME_NO_MEMBER_TYPE: DWORD = 0x0200; +pub const UNDNAME_NO_RETURN_UDT_MODEL: DWORD = 0x0400; +pub const UNDNAME_32_BIT_DECODE: DWORD = 0x0800; +pub const UNDNAME_NAME_ONLY: DWORD = 0x1000; +pub const UNDNAME_NO_ARGUMENTS: DWORD = 0x2000; +pub const UNDNAME_NO_SPECIAL_SYMS: DWORD = 0x4000; +pub const DBHHEADER_DEBUGDIRS: DWORD = 0x1; +pub const DBHHEADER_CVMISC: DWORD = 0x2; +pub const DBHHEADER_PDBGUID: DWORD = 0x3; +STRUCT!{struct MODLOAD_DATA { + ssize: DWORD, + ssig: DWORD, + data: PVOID, + size: DWORD, + flags: DWORD, +}} +pub type PMODLOAD_DATA = *mut MODLOAD_DATA; +STRUCT!{struct MODLOAD_CVMISC { + oCV: DWORD, + cCV: size_t, + oMisc: DWORD, + cMisc: size_t, + dtImage: DWORD, + cImage: DWORD, +}} +pub type PMODLOAD_CVMISC = *mut MODLOAD_CVMISC; +STRUCT!{struct MODLOAD_PDBGUID_PDBAGE { + PdbGuid: GUID, + PdbAge: DWORD, +}} +pub type PMODLOAD_PDBGUID_PDBAGE = *mut MODLOAD_PDBGUID_PDBAGE; +ENUM!{enum ADDRESS_MODE { + AddrMode1616, + AddrMode1632, + AddrModeReal, + AddrModeFlat, +}} +STRUCT!{struct ADDRESS64 { + Offset: DWORD64, + Segment: WORD, + Mode: ADDRESS_MODE, +}} +pub type LPADDRESS64 = *mut ADDRESS64; +#[cfg(target_arch = "x86_64")] +pub type ADDRESS = ADDRESS64; +#[cfg(target_arch = "x86_64")] +pub type LPADDRESS = LPADDRESS64; +#[cfg(target_arch = "x86")] +STRUCT!{struct ADDRESS { + Offset: DWORD, + Segment: WORD, + Mode: ADDRESS_MODE, +}} +#[cfg(target_arch = "x86")] +pub type LPADDRESS = *mut ADDRESS; +STRUCT!{struct KDHELP64 { + Thread: DWORD64, + ThCallbackStack: DWORD, + ThCallbackBStore: DWORD, + NextCallback: DWORD, + FramePointer: DWORD, + KiCallUserMode: DWORD64, + KeUserCallbackDispatcher: DWORD64, + SystemRangeStart: DWORD64, + KiUserExceptionDispatcher: DWORD64, + StackBase: DWORD64, + StackLimit: DWORD64, + BuildVersion: DWORD, + Reserved0: DWORD, + Reserved1: [DWORD64; 4], +}} +pub type PKDHELP64 = *mut KDHELP64; +#[cfg(target_arch = "x86_64")] +pub type KDHELP = KDHELP64; +#[cfg(target_arch = "x86_64")] +pub type PKDHELP = PKDHELP64; +#[cfg(target_arch = "x86")] +STRUCT!{struct KDHELP { + Thread: DWORD, + ThCallbackStack: DWORD, + NextCallback: DWORD, + FramePointer: DWORD, + KiCallUserMode: DWORD, + KeUserCallbackDispatcher: DWORD, + SystemRangeStart: DWORD, + ThCallbackBStore: DWORD, + KiUserExceptionDispatcher: DWORD, + StackBase: DWORD, + StackLimit: DWORD, + Reserved: [DWORD; 5], +}} +#[cfg(target_arch = "x86")] +pub type PKDHELP = *mut KDHELP; +STRUCT!{struct STACKFRAME64 { + AddrPC: ADDRESS64, + AddrReturn: ADDRESS64, + AddrFrame: ADDRESS64, + AddrStack: ADDRESS64, + AddrBStore: ADDRESS64, + FuncTableEntry: PVOID, + Params: [DWORD64; 4], + Far: BOOL, + Virtual: BOOL, + Reserved: [DWORD64; 3], + KdHelp: KDHELP64, +}} +pub type LPSTACKFRAME64 = *mut STACKFRAME64; +pub const INLINE_FRAME_CONTEXT_INIT: DWORD = 0; +pub const INLINE_FRAME_CONTEXT_IGNORE: DWORD = 0xFFFFFFFF; +STRUCT!{struct STACKFRAME_EX { + AddrPC: ADDRESS64, + AddrReturn: ADDRESS64, + AddrFrame: ADDRESS64, + AddrStack: ADDRESS64, + AddrBStore: ADDRESS64, + FuncTableEntry: PVOID, + Params: [DWORD64; 4], + Far: BOOL, + Virtual: BOOL, + Reserved: [DWORD64; 3], + KdHelp: KDHELP64, + StackFrameSize: DWORD, + InlineFrameContext: DWORD, +}} +pub type LPSTACKFRAME_EX = *mut STACKFRAME_EX; +#[cfg(target_arch = "x86_64")] +pub type STACKFRAME = STACKFRAME64; +#[cfg(target_arch = "x86_64")] +pub type LPSTACKFRAME = LPSTACKFRAME64; +#[cfg(target_arch = "x86")] +STRUCT!{struct STACKFRAME { + AddrPC: ADDRESS, + AddrReturn: ADDRESS, + AddrFrame: ADDRESS, + AddrStack: ADDRESS, + FuncTableEntry: PVOID, + Params: [DWORD; 4], + Far: BOOL, + Virtual: BOOL, + Reserved: [DWORD; 3], + KdHelp: KDHELP, + AddrBStore: ADDRESS, +}} +#[cfg(target_arch = "x86")] +pub type LPSTACKFRAME = *mut STACKFRAME; +FN!{stdcall PREAD_PROCESS_MEMORY_ROUTINE64( + hProcess: HANDLE, + qwBaseAddress: DWORD64, + lpBuffer: PVOID, + nSize: DWORD, + lpNumberOfBytesRead: LPDWORD, +) -> BOOL} +FN!{stdcall PFUNCTION_TABLE_ACCESS_ROUTINE64( + ahProcess: HANDLE, + AddrBase: DWORD64, +) -> PVOID} +FN!{stdcall PGET_MODULE_BASE_ROUTINE64( + hProcess: HANDLE, + Address: DWORD64, +) -> DWORD64} +FN!{stdcall PTRANSLATE_ADDRESS_ROUTINE64( + hProcess: HANDLE, + hThread: HANDLE, + lpaddr: LPADDRESS64, +) -> DWORD64} +pub const SYM_STKWALK_DEFAULT: DWORD = 0x00000000; +pub const SYM_STKWALK_FORCE_FRAMEPTR: DWORD = 0x00000001; +#[cfg(target_arch = "x86_64")] +pub type PREAD_PROCESS_MEMORY_ROUTINE = PREAD_PROCESS_MEMORY_ROUTINE64; +#[cfg(target_arch = "x86_64")] +pub type PFUNCTION_TABLE_ACCESS_ROUTINE = PFUNCTION_TABLE_ACCESS_ROUTINE64; +#[cfg(target_arch = "x86_64")] +pub type PGET_MODULE_BASE_ROUTINE = PGET_MODULE_BASE_ROUTINE64; +#[cfg(target_arch = "x86_64")] +pub type PTRANSLATE_ADDRESS_ROUTINE = PTRANSLATE_ADDRESS_ROUTINE64; +#[cfg(target_arch = "x86")] +FN!{stdcall PREAD_PROCESS_MEMORY_ROUTINE( + hProcess: HANDLE, + qwBaseAddress: DWORD, + lpBuffer: PVOID, + nSize: DWORD, + lpNumberOfBytesRead: PDWORD, +) -> BOOL} +#[cfg(target_arch = "x86")] +FN!{stdcall PFUNCTION_TABLE_ACCESS_ROUTINE( + ahProcess: HANDLE, + AddrBase: DWORD, +) -> PVOID} +#[cfg(target_arch = "x86")] +FN!{stdcall PGET_MODULE_BASE_ROUTINE( + hProcess: HANDLE, + Address: DWORD, +) -> DWORD} +#[cfg(target_arch = "x86")] +FN!{stdcall PTRANSLATE_ADDRESS_ROUTINE( + hProcess: HANDLE, + hThread: HANDLE, + lpaddr: LPADDRESS, +) -> DWORD} +pub const API_VERSION_NUMBER: USHORT = 12; +STRUCT!{struct API_VERSION { + MajorVersion: USHORT, + MinorVersion: USHORT, + Revision: USHORT, + Reserved: USHORT, +}} +pub type LPAPI_VERSION = *mut API_VERSION; +STRUCT!{struct SYMBOL_INFOW { + SizeOfStruct: ULONG, + TypeIndex: ULONG, + Reserved: [ULONG64; 2], + Index: ULONG, + Size: ULONG, + ModBase: ULONG64, + Flags: ULONG, + Value: ULONG64, + Address: ULONG64, + Register: ULONG, + Scope: ULONG, + Tag: ULONG, + NameLen: ULONG, + MaxNameLen: ULONG, + Name: [WCHAR; 1], +}} +pub type PSYMBOL_INFOW = *mut SYMBOL_INFOW; +STRUCT!{struct IMAGEHLP_SYMBOL64 { + SizeOfStruct: DWORD, + Address: DWORD64, + Size: DWORD, + Flags: DWORD, + MaxNameLength: DWORD, + Name: [CHAR; 1], +}} +pub type PIMAGEHLP_SYMBOL64 = *mut IMAGEHLP_SYMBOL64; +STRUCT!{struct IMAGEHLP_LINEW64 { + SizeOfStruct: DWORD, + Key: PVOID, + LineNumber: DWORD, + FileName: PWSTR, + Address: DWORD64, +}} +pub type PIMAGEHLP_LINEW64 = *mut IMAGEHLP_LINEW64; +extern "system" { + pub fn EnumDirTree( + hProcess: HANDLE, + RootPath: PCSTR, + InputPathName: PCSTR, + OutputPathBuffer: PSTR, + cb: PENUMDIRTREE_CALLBACK, + data: PVOID, + ) -> BOOL; + pub fn EnumDirTreeW( + hProcess: HANDLE, + RootPath: PCWSTR, + InputPathName: PCWSTR, + OutputPathBuffer: PWSTR, + cb: PENUMDIRTREE_CALLBACKW, + data: PVOID, + ) -> BOOL; + pub fn ImagehlpApiVersion() -> LPAPI_VERSION; + pub fn ImagehlpApiVersionEx( + AppVersion: LPAPI_VERSION, + ) -> LPAPI_VERSION; + pub fn MakeSureDirectoryPathExists( + DirPath: PCSTR, + ) -> BOOL; + pub fn SearchTreeForFile( + RootPath: PCSTR, + InputPathName: PCSTR, + OutputPathBuffer: PSTR, + ) -> BOOL; + pub fn SearchTreeForFileW( + RootPath: PCWSTR, + InputPathName: PCWSTR, + OutputPathBuffer: PWSTR, + ) -> BOOL; + pub fn FindDebugInfoFile( + FileName: PCSTR, + SymbolPath: PCSTR, + DebugFilePath: PSTR + ) -> HANDLE; + pub fn FindDebugInfoFileEx( + FileName: PCSTR, + SymbolPath: PCSTR, + DebugFilePath: PSTR, + Callback: PFIND_DEBUG_FILE_CALLBACK, + CallerData: PVOID, + ) -> HANDLE; + pub fn FindDebugInfoFileExW( + FileName: PCWSTR, + SymbolPath: PCWSTR, + DebugFilePath: PWSTR, + Callback: PFIND_DEBUG_FILE_CALLBACKW, + CallerData: PVOID, + ) -> HANDLE; + pub fn FindExecutableImage( + FileName: PCSTR, + SymbolPath: PCSTR, + ImageFilePath: PSTR + ) -> HANDLE; + pub fn FindExecutableImageEx( + FileName: PCSTR, + SymbolPath: PCSTR, + ImageFilePath: PSTR, + Callback: PFIND_EXE_FILE_CALLBACK, + CallerData: PVOID, + ) -> HANDLE; + pub fn FindExecutableImageExW( + FileName: PCWSTR, + SymbolPath: PCWSTR, + ImageFilePath: PWSTR, + Callback: PFIND_EXE_FILE_CALLBACKW, + CallerData: PVOID, + ) -> HANDLE; + pub fn StackWalk( + MachineType: DWORD, + hProcess: HANDLE, + hThread: HANDLE, + StackFrame: LPSTACKFRAME, + ContextRecord: PVOID, + ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE, + FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE, + GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE, + TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE, + ) -> BOOL; + pub fn StackWalkEx( + MachineType: DWORD, + hProcess: HANDLE, + hThread: HANDLE, + StackFrame: LPSTACKFRAME64, + ContextRecord: PVOID, + ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE64, + FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE64, + GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE64, + TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE64, + Flags: DWORD, + ) -> BOOL; + pub fn StackWalk64( + MachineType: DWORD, + hProcess: HANDLE, + hThread: HANDLE, + StackFrame: LPSTACKFRAME64, + ContextRecord: PVOID, + ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE64, + FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE64, + GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE64, + TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE64, + ) -> BOOL; + pub fn UnDecorateSymbolName( + name: PCSTR, + outputString: PSTR, + maxStringLength: DWORD, + flags: DWORD, + ) -> DWORD; + pub fn UnDecorateSymbolNameW( + name: PCWSTR, + outputString: PWSTR, + maxStringLength: DWORD, + flags: DWORD, + ) -> DWORD; + pub fn GetTimestampForLoadedLibrary( + Module: HMODULE, + ) -> DWORD; + pub fn ImageDirectoryEntryToData( + Base: PVOID, + MappedAsImage: BOOLEAN, + DirectoryEntry: USHORT, + Size: PULONG, + ) -> PVOID; + pub fn ImageDirectoryEntryToDataEx( + Base: PVOID, + MappedAsImage: BOOLEAN, + DirectoryEntry: USHORT, + Size: PULONG, + FoundHeader: *mut PIMAGE_SECTION_HEADER, + ) -> PVOID; + pub fn ImageNtHeader( + Base: PVOID, + ) -> PIMAGE_NT_HEADERS; + pub fn ImageRvaToSection( + NtHeaders: PIMAGE_NT_HEADERS, + Base: PVOID, + Rva: ULONG, + ) -> PIMAGE_SECTION_HEADER; + pub fn ImageRvaToVa( + NtHeaders: PIMAGE_NT_HEADERS, + Base: PVOID, + Rva: ULONG, + LastRvaSection: *mut PIMAGE_SECTION_HEADER, + ) -> PVOID; + pub fn SymCleanup( + hProcess: HANDLE + ) -> BOOL; + pub fn SymFindDebugInfoFile( + hProcess: HANDLE, + FileName: PCSTR, + DebugFilePath: PSTR, + Callback: PFIND_DEBUG_FILE_CALLBACK, + CallerData: PVOID, + ) -> HANDLE; + pub fn SymFindDebugInfoFileW( + hProcess: HANDLE, + FileName: PCWSTR, + DebugFilePath: PWSTR, + Callback: PFIND_DEBUG_FILE_CALLBACKW, + CallerData: PVOID, + ) -> HANDLE; + pub fn SymFindExecutableImage( + hProcess: HANDLE, + FileName: PCSTR, + ImageFilePath: PSTR, + Callback: PFIND_EXE_FILE_CALLBACK, + CallerData: PVOID, + ) -> HANDLE; + pub fn SymFindExecutableImageW( + hProcess: HANDLE, + FileName: PCWSTR, + ImageFilePath: PWSTR, + Callback: PFIND_EXE_FILE_CALLBACKW, + CallerData: PVOID, + ) -> HANDLE; + pub fn SymFindFileInPath( + hprocess: HANDLE, + SearchPath: PCSTR, + FileName: PCSTR, + id: PVOID, + two: DWORD, + three: DWORD, + flags: DWORD, + FoundFile: PSTR, + callback: PFINDFILEINPATHCALLBACK, + context: PVOID, + ) -> BOOL; + pub fn SymFindFileInPathW( + hprocess: HANDLE, + SearchPath: PCWSTR, + FileName: PCWSTR, + id: PVOID, + two: DWORD, + three: DWORD, + flags: DWORD, + FoundFile: PWSTR, + callback: PFINDFILEINPATHCALLBACKW, + context: PVOID, + ) -> BOOL; + pub fn SymFromAddrW( + hProcess: HANDLE, + Address: DWORD64, + Displacement: PDWORD64, + Symbol: PSYMBOL_INFOW, + ) -> BOOL; + pub fn SymFunctionTableAccess64( + hProcess: HANDLE, + AddrBase: DWORD64, + ) -> PVOID; + pub fn SymGetLineFromAddrW64( + hProcess: HANDLE, + dwAddr: DWORD64, + pdwDisplacement: PDWORD, + Line: PIMAGEHLP_LINEW64, + ) -> BOOL; + pub fn SymGetModuleBase64( + hProcess: HANDLE, + AddrBase: DWORD64, + ) -> DWORD64; + pub fn SymGetSymFromAddr64( + hProcess: HANDLE, + Address: DWORD64, + Displacement: PDWORD64, + Symbol: PIMAGEHLP_SYMBOL64, + ) -> BOOL; + pub fn SymInitializeW( + hProcess: HANDLE, + UserSearchPath: PCWSTR, + fInvadeProcess: BOOL, + ) -> BOOL; + #[cfg(any(target_arch = "x86", target_arch = "arm"))] + pub fn MapDebugInformation( + FileHandle: HANDLE, + FileName: PCSTR, + SymbolPath: PCSTR, + ImageBase: ULONG, + ) -> PIMAGE_DEBUG_INFORMATION; + #[cfg(any(target_arch = "x86", target_arch = "arm"))] + pub fn UnmapDebugInformation( + DebugInfo: PIMAGE_DEBUG_INFORMATION, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/dcommon.rs b/src/vendor/winapi/src/um/dcommon.rs new file mode 100644 index 0000000000..b3dfe9a026 --- /dev/null +++ b/src/vendor/winapi/src/um/dcommon.rs @@ -0,0 +1,23 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dcommon.h +use shared::dxgiformat::DXGI_FORMAT; +ENUM!{enum DWRITE_MEASURING_MODE { + DWRITE_MEASURING_MODE_NATURAL = 0, + DWRITE_MEASURING_MODE_GDI_CLASSIC = 1, + DWRITE_MEASURING_MODE_GDI_NATURAL = 2, +}} +ENUM!{enum D2D1_ALPHA_MODE { + D2D1_ALPHA_MODE_UNKNOWN = 0, + D2D1_ALPHA_MODE_PREMULTIPLIED = 1, + D2D1_ALPHA_MODE_STRAIGHT = 2, + D2D1_ALPHA_MODE_IGNORE = 3, +}} +STRUCT!{struct D2D1_PIXEL_FORMAT { + format: DXGI_FORMAT, + alphaMode: D2D1_ALPHA_MODE, +}} diff --git a/src/vendor/winapi/src/um/dcomp.rs b/src/vendor/winapi/src/um/dcomp.rs new file mode 100644 index 0000000000..8927cd851c --- /dev/null +++ b/src/vendor/winapi/src/um/dcomp.rs @@ -0,0 +1,1165 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dcomp.h +use ctypes::{c_float, c_int, c_void}; +use shared::d3d9types::D3DMATRIX; +use shared::dcomptypes::{ + DCOMPOSITION_BACKFACE_VISIBILITY, DCOMPOSITION_BITMAP_INTERPOLATION_MODE, + DCOMPOSITION_BORDER_MODE, DCOMPOSITION_COMPOSITE_MODE, DCOMPOSITION_DEPTH_MODE, + DCOMPOSITION_FRAME_STATISTICS, DCOMPOSITION_OPACITY_MODE +}; +use shared::dxgi::IDXGIDevice; +use shared::dxgi1_2::DXGI_ALPHA_MODE; +use shared::dxgiformat::DXGI_FORMAT; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, DWORD, UINT}; +use shared::ntdef::{HANDLE, HRESULT}; +use shared::windef::{HWND, POINT, RECT}; +use um::d2d1::{D2D1_COLOR_F, D2D1_MATRIX_3X2_F}; +use um::d2d1_1::{D2D1_COMPOSITE_MODE, D2D1_MATRIX_5X4_F, D2D1_VECTOR_2F, D2D1_VECTOR_4F}; +use um::d2d1effects::{ + D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE, D2D1_BLEND_MODE, D2D1_BORDER_MODE, + D2D1_COLORMATRIX_ALPHA_MODE, D2D1_TURBULENCE_NOISE +}; +use um::d2dbasetypes::{D2D_MATRIX_3X2_F, D2D_MATRIX_4X4_F, D2D_RECT_F}; +use um::d3dcommon::D3D_FEATURE_LEVEL; +use um::dcompanimation::IDCompositionAnimation; +use um::minwinbase::SECURITY_ATTRIBUTES; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +extern "system" { + pub fn DCompositionCreateDevice( + dxgiDevice: *const IDXGIDevice, + iid: REFIID, + dcompositionDevice: *mut *mut c_void, + ) -> HRESULT; + pub fn DCompositionCreateDevice2( + renderingDevice: *const IUnknown, + iid: REFIID, + dcompositionDevice: *mut *mut c_void, + ) -> HRESULT; + pub fn DCompositionCreateDevice3( + renderingDevice: *const IUnknown, + iid: REFIID, + dcompositionDevice: *mut *mut c_void, + ) -> HRESULT; + pub fn DCompositionGetFrameStatistics( + statistics: *const DCOMPOSITION_FRAME_STATISTICS, + minSafeFeaturelLevel: *const D3D_FEATURE_LEVEL, + maxHardwareFeaturelLevel: *const D3D_FEATURE_LEVEL, + ) -> HRESULT; + pub fn DCompositionCreateSurfaceHandle( + desiredAccess: DWORD, + securityAttributes: *const SECURITY_ATTRIBUTES, + surfaceHandle: *mut HANDLE, + ) -> HRESULT; + pub fn DCompositionAttachMouseWheelToHwnd( + visual: *const IDCompositionVisual, + hwnd: HWND, + enable: BOOL, + ) -> HRESULT; + pub fn DCompositionAttachMouseDragToHwnd( + visual: *const IDCompositionVisual, + hwnd: HWND, + enable: BOOL, + ) -> HRESULT; +} +RIDL!(#[uuid(0xc37ea93a, 0xe7aa, 0x450d, 0xb1, 0x6f, 0x97, 0x46, 0xcb, 0x04, 0x07, 0xf3)] +interface IDCompositionDevice(IDCompositionDeviceVtbl): IUnknown(IUnknownVtbl) { + fn Commit() -> HRESULT, + fn WaitForCommitCompletion() -> HRESULT, + fn GetFrameStatistics( + statistics: *mut DCOMPOSITION_FRAME_STATISTICS, + ) -> HRESULT, + fn CreateTargetForHwnd( + hwnd: HWND, + topmost: BOOL, + target: *mut *mut IDCompositionTarget, + ) -> HRESULT, + fn CreateVisual( + visual: *mut *mut IDCompositionVisual, + ) -> HRESULT, + fn CreateSurface( + width: UINT, + height: UINT, + pixelFormat: DXGI_FORMAT, + alphaMode: DXGI_ALPHA_MODE, + surface: *mut *mut IDCompositionSurface, + ) -> HRESULT, + fn CreateVirtualSurface( + initialWidth: UINT, + initialHeight: UINT, + pixelFormat: DXGI_FORMAT, + alphaMode: DXGI_ALPHA_MODE, + virtualSurface: *mut *mut IDCompositionVirtualSurface, + ) -> HRESULT, + fn CreateSurfaceFromHandle( + handle: HANDLE, + mutsurface: *mut *mut IUnknown, + ) -> HRESULT, + fn CreateSurfaceFromHwnd( + hwnd: HWND, + mutsurface: *mut *mut IUnknown, + ) -> HRESULT, + fn CreateTranslateTransform( + translateTransform: *mut *mut IDCompositionTranslateTransform, + ) -> HRESULT, + fn CreateScaleTransform( + scaleTransform: *mut *mut IDCompositionScaleTransform, + ) -> HRESULT, + fn CreateRotateTransform( + rotateTransform: *mut *mut IDCompositionRotateTransform, + ) -> HRESULT, + fn CreateSkewTransform( + skewTransform: *mut *mut IDCompositionSkewTransform, + ) -> HRESULT, + fn CreateMatrixTransform( + matrixTransform: *mut *mut IDCompositionMatrixTransform, + ) -> HRESULT, + fn CreateTransformGroup( + transforms: *const *const IDCompositionTransform, + elements: UINT, + transformGroup: *mut *mut IDCompositionTransform, + ) -> HRESULT, + fn CreateTranslateTransform3D( + translateTransform3D: *mut *mut IDCompositionTranslateTransform3D, + ) -> HRESULT, + fn CreateScaleTransform3D( + scaleTransform3D: *mut *mut IDCompositionScaleTransform3D, + ) -> HRESULT, + fn CreateRotateTransform3D( + rotateTransform3D: *mut *mut IDCompositionRotateTransform3D, + ) -> HRESULT, + fn CreateMatrixTransform3D( + matrixTransform3D: *mut *mut IDCompositionMatrixTransform3D, + ) -> HRESULT, + fn CreateTransform3DGroup( + transforms3D: *const *const IDCompositionTransform3D, + elements: UINT, + transform3DGroup: *mut *mut IDCompositionTransform3D, + ) -> HRESULT, + fn CreateEffectGroup( + effectGroup: *mut *mut IDCompositionEffectGroup, + ) -> HRESULT, + fn CreateRectangleClip( + clip: *mut *mut IDCompositionRectangleClip, + ) -> HRESULT, + fn CreateAnimation( + animation: *mut *mut IDCompositionAnimation, + ) -> HRESULT, + fn CheckDeviceState( + pfValid: *mut BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xeacdd04c, 0x117e, 0x4e17, 0x88, 0xf4, 0xd1, 0xb1, 0x2b, 0x0e, 0x3d, 0x89)] +interface IDCompositionTarget(IDCompositionTargetVtbl): IUnknown(IUnknownVtbl) { + fn SetRoot( + visual: *const IDCompositionVisual, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x4d93059d, 0x097b, 0x4651, 0x9a, 0x60, 0xf0, 0xf2, 0x51, 0x16, 0xe2, 0xf3)] +interface IDCompositionVisual(IDCompositionVisualVtbl): IUnknown(IUnknownVtbl) { + fn SetOffsetX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetX_1( + offsetX: c_float, + ) -> HRESULT, + fn SetOffsetY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetY_1( + offsetY: c_float, + ) -> HRESULT, + fn SetTransform_2( + transform: *const IDCompositionTransform, + ) -> HRESULT, + fn SetTransform_1( + matrix: *const D2D_MATRIX_3X2_F, + ) -> HRESULT, + fn SetTransformParent( + visual: *const IDCompositionVisual, + ) -> HRESULT, + fn SetEffect( + effect: *const IDCompositionEffect, + ) -> HRESULT, + fn SetBitmapInterpolationMode( + interpolationMode: DCOMPOSITION_BITMAP_INTERPOLATION_MODE, + ) -> HRESULT, + fn SetBorderMode( + borderMode: DCOMPOSITION_BORDER_MODE, + ) -> HRESULT, + fn SetClip_2( + clip: *const IDCompositionClip, + ) -> HRESULT, + fn SetClip_1( + rect: *const D2D_RECT_F, + ) -> HRESULT, + fn SetContent( + content: *const IUnknown, + ) -> HRESULT, + fn AddVisual( + visual: *const IDCompositionVisual, + insertAbove: BOOL, + referenceVisual: *const IDCompositionVisual, + ) -> HRESULT, + fn RemoveVisual( + visual: *const IDCompositionVisual, + ) -> HRESULT, + fn RemoveAllVisuals( + ) -> HRESULT, + fn SetCompositeMode( + compositeMode: DCOMPOSITION_COMPOSITE_MODE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xec81b08f, 0xbfcb, 0x4e8d, 0xb1, 0x93, 0xa9, 0x15, 0x58, 0x79, 0x99, 0xe8)] +interface IDCompositionEffect(IDCompositionEffectVtbl): IUnknown(IUnknownVtbl) { +}); +RIDL!(#[uuid(0x71185722, 0x246b, 0x41f2, 0xaa, 0xd1, 0x04, 0x43, 0xf7, 0xf4, 0xbf, 0xc2)] +interface IDCompositionTransform3D(IDCompositionTransform3DVtbl): + IDCompositionEffect(IDCompositionEffectVtbl) { +}); +RIDL!(#[uuid(0xfd55faa7, 0x37e0, 0x4c20, 0x95, 0xd2, 0x9b, 0xe4, 0x5b, 0xc3, 0x3f, 0x55)] +interface IDCompositionTransform(IDCompositionTransformVtbl): + IDCompositionTransform3D(IDCompositionTransform3DVtbl) { +}); +RIDL!(#[uuid(0x06791122, 0xc6f0, 0x417d, 0x83, 0x23, 0x26, 0x9e, 0x98, 0x7f, 0x59, 0x54)] +interface IDCompositionTranslateTransform(IDCompositionTranslateTransformVtbl): + IDCompositionTransform(IDCompositionTransformVtbl) { + fn SetOffsetX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetX_1( + offsetX: c_float, + ) -> HRESULT, + fn SetOffsetY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetY_1( + offsetY: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x71fde914, 0x40ef, 0x45ef, 0xbd, 0x51, 0x68, 0xb0, 0x37, 0xc3, 0x39, 0xf9)] +interface IDCompositionScaleTransform(IDCompositionScaleTransformVtbl): + IDCompositionTransform(IDCompositionTransformVtbl) { + fn SetScaleX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetScaleX_1( + scaleX: c_float, + ) -> HRESULT, + fn SetScaleY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetScaleY_1( + scaleY: c_float, + ) -> HRESULT, + fn SetCenterX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterX_1( + centerX: c_float, + ) -> HRESULT, + fn SetCenterY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterY_1( + centerY: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x641ed83c, 0xae96, 0x46c5, 0x90, 0xdc, 0x32, 0x77, 0x4c, 0xc5, 0xc6, 0xd5)] +interface IDCompositionRotateTransform(IDCompositionRotateTransformVtbl): + IDCompositionTransform(IDCompositionTransformVtbl) { + fn SetAngle_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAngle_1( + angle: c_float, + ) -> HRESULT, + fn SetCenterX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterX_1( + centerX: c_float, + ) -> HRESULT, + fn SetCenterY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterY_1( + centerY: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xe57aa735, 0xdcdb, 0x4c72, 0x9c, 0x61, 0x05, 0x91, 0xf5, 0x88, 0x89, 0xee)] +interface IDCompositionSkewTransform(IDCompositionSkewTransformVtbl): + IDCompositionTransform(IDCompositionTransformVtbl) { + fn SetAngleX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAngleX_1( + angleX: c_float, + ) -> HRESULT, + fn SetAngleY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAngleY_1( + angleY: c_float, + ) -> HRESULT, + fn SetCenterX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterX_1( + centerX: c_float, + ) -> HRESULT, + fn SetCenterY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterY_1( + centerY: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x16cdff07, 0xc503, 0x419c, 0x83, 0xf2, 0x09, 0x65, 0xc7, 0xaf, 0x1f, 0xa6)] +interface IDCompositionMatrixTransform(IDCompositionMatrixTransformVtbl): + IDCompositionTransform(IDCompositionTransformVtbl) { + fn SetMatrix( + matrix: *const D2D_MATRIX_3X2_F, + ) -> HRESULT, + fn SetMatrixElement_2( + row: c_int, + column: c_int, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetMatrixElement_1( + row: c_int, + column: c_int, + value: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa7929a74, 0xe6b2, 0x4bd6, 0x8b, 0x95, 0x40, 0x40, 0x11, 0x9c, 0xa3, 0x4d)] +interface IDCompositionEffectGroup(IDCompositionEffectGroupVtbl): + IDCompositionEffect(IDCompositionEffectVtbl) { + fn SetOpacity_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOpacity_1( + opacity: c_float, + ) -> HRESULT, + fn SetTransform3D( + transform3D: *const IDCompositionTransform3D, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x91636d4b, 0x9ba1, 0x4532, 0xaa, 0xf7, 0xe3, 0x34, 0x49, 0x94, 0xd7, 0x88)] +interface IDCompositionTranslateTransform3D(IDCompositionTranslateTransform3DVtbl): + IDCompositionTransform3D(IDCompositionTransform3DVtbl) { + fn SetOffsetX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetX_1( + offsetX: c_float, + ) -> HRESULT, + fn SetOffsetY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetY_1( + offsetY: c_float, + ) -> HRESULT, + fn SetOffsetZ_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetZ_1( + offsetZ: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x2a9e9ead, 0x364b, 0x4b15, 0xa7, 0xc4, 0xa1, 0x99, 0x7f, 0x78, 0xb3, 0x89)] +interface IDCompositionScaleTransform3D(IDCompositionScaleTransform3DVtbl): + IDCompositionTransform3D(IDCompositionTransform3DVtbl) { + fn SetScaleX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetScaleX_1( + scaleX: c_float, + ) -> HRESULT, + fn SetScaleY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetScaleY_1( + scaleY: c_float, + ) -> HRESULT, + fn SetScaleZ_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetScaleZ_1( + scaleZ: c_float, + ) -> HRESULT, + fn SetCenterX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterX_1( + centerX: c_float, + ) -> HRESULT, + fn SetCenterY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterY_1( + centerY: c_float, + ) -> HRESULT, + fn SetCenterZ_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterZ_1( + centerZ: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xd8f5b23f, 0xd429, 0x4a91, 0xb5, 0x5a, 0xd2, 0xf4, 0x5f, 0xd7, 0x5b, 0x18)] +interface IDCompositionRotateTransform3D(IDCompositionRotateTransform3DVtbl): + IDCompositionTransform3D(IDCompositionTransform3DVtbl) { + fn SetAngle_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAngle_1( + angle: c_float, + ) -> HRESULT, + fn SetAxisX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAxisX_1( + axisX: c_float, + ) -> HRESULT, + fn SetAxisY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAxisY_1( + axisY: c_float, + ) -> HRESULT, + fn SetAxisZ_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAxisZ_1( + axisZ: c_float, + ) -> HRESULT, + fn SetCenterX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterX_1( + centerX: c_float, + ) -> HRESULT, + fn SetCenterY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterY_1( + centerY: c_float, + ) -> HRESULT, + fn SetCenterZ_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCenterZ_1( + centerZ: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x4b3363f0, 0x643b, 0x41b7, 0xb6, 0xe0, 0xcc, 0xf2, 0x2d, 0x34, 0x46, 0x7c)] +interface IDCompositionMatrixTransform3D(IDCompositionMatrixTransform3DVtbl): + IDCompositionTransform3D(IDCompositionTransform3DVtbl) { + fn SetMatrix( + matrix: *const D3DMATRIX, + ) -> HRESULT, + fn SetMatrixElement_2( + row: c_int, + column: c_int, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetMatrixElement_1( + row: c_int, + column: c_int, + value: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x64ac3703, 0x9d3f, 0x45ec, 0xa1, 0x09, 0x7c, 0xac, 0x0e, 0x7a, 0x13, 0xa7)] +interface IDCompositionClip(IDCompositionClipVtbl): IUnknown(IUnknownVtbl) { +}); +RIDL!(#[uuid(0x9842ad7d, 0xd9cf, 0x4908, 0xae, 0xd7, 0x48, 0xb5, 0x1d, 0xa5, 0xe7, 0xc2)] +interface IDCompositionRectangleClip(IDCompositionRectangleClipVtbl): + IDCompositionClip(IDCompositionClipVtbl) { + fn SetLeft_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetLeft_1( + left: c_float, + ) -> HRESULT, + fn SetTop_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetTop_1( + top: c_float, + ) -> HRESULT, + fn SetRight_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetRight_1( + right: c_float, + ) -> HRESULT, + fn SetBottom_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBottom_1( + bottom: c_float, + ) -> HRESULT, + fn SetTopLeftRadiusX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetTopLeftRadiusX_1( + radius: c_float, + ) -> HRESULT, + fn SetTopLeftRadiusY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetTopLeftRadiusY_1( + radius: c_float, + ) -> HRESULT, + fn SetTopRightRadiusX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetTopRightRadiusX_1( + radius: c_float, + ) -> HRESULT, + fn SetTopRightRadiusY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetTopRightRadiusY_1( + radius: c_float, + ) -> HRESULT, + fn SetBottomLeftRadiusX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBottomLeftRadiusX_1( + radius: c_float, + ) -> HRESULT, + fn SetBottomLeftRadiusY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBottomLeftRadiusY_1( + radius: c_float, + ) -> HRESULT, + fn SetBottomRightRadiusX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBottomRightRadiusX_1( + radius: c_float, + ) -> HRESULT, + fn SetBottomRightRadiusY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBottomRightRadiusY_1( + radius: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xbb8a4953, 0x2c99, 0x4f5a, 0x96, 0xf5, 0x48, 0x19, 0x02, 0x7f, 0xa3, 0xac)] +interface IDCompositionSurface(IDCompositionSurfaceVtbl): IUnknown(IUnknownVtbl) { + fn BeginDraw( + updateRect: *const RECT, + iid: REFIID, + updateObject: *mut *mut c_void, + updateOffset: *mut POINT, + ) -> HRESULT, + fn EndDraw() -> HRESULT, + fn SuspendDraw() -> HRESULT, + fn ResumeDraw() -> HRESULT, + fn Scroll( + scrollRect: *const RECT, + clipRect: *const RECT, + offsetX: c_int, + offsetY: c_int, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xae471c51, 0x5f53, 0x4a24, 0x8d, 0x3e, 0xd0, 0xc3, 0x9c, 0x30, 0xb3, 0xf0)] +interface IDCompositionVirtualSurface(IDCompositionVirtualSurfaceVtbl): + IDCompositionSurface(IDCompositionSurfaceVtbl) { + fn Resize( + width: UINT, + height: UINT, + ) -> HRESULT, + fn Trim( + rectangles: *const RECT, + count: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x75f6468d, 0x1b8e, 0x447c, 0x9b, 0xc6, 0x75, 0xfe, 0xa8, 0x0b, 0x5b, 0x25)] +interface IDCompositionDevice2(IDCompositionDevice2Vtbl): IUnknown(IUnknownVtbl) { + fn Commit() -> HRESULT, + fn WaitForCommitCompletion() -> HRESULT, + fn GetFrameStatistics( + statistics: *mut DCOMPOSITION_FRAME_STATISTICS, + ) -> HRESULT, + fn CreateVisual( + visual: *mut *mut IDCompositionVisual2, + ) -> HRESULT, + fn CreateSurfaceFactory( + renderingDevice: *const IUnknown, + surfaceFactory: *mut *mut IDCompositionSurfaceFactory, + ) -> HRESULT, + fn CreateSurface( + width: UINT, + height: UINT, + pixelFormat: DXGI_FORMAT, + alphaMode: DXGI_ALPHA_MODE, + surface: *mut *mut IDCompositionSurface, + ) -> HRESULT, + fn CreateVirtualSurface( + initialWidth: UINT, + initialHeight: UINT, + pixelFormat: DXGI_FORMAT, + alphaMode: DXGI_ALPHA_MODE, + virtualSurface: *mut *mut IDCompositionVirtualSurface, + ) -> HRESULT, + fn CreateTranslateTransform( + translateTransform: *mut *mut IDCompositionTranslateTransform, + ) -> HRESULT, + fn CreateScaleTransform( + scaleTransform: *mut *mut IDCompositionScaleTransform, + ) -> HRESULT, + fn CreateRotateTransform( + rotateTransform: *mut *mut IDCompositionRotateTransform, + ) -> HRESULT, + fn CreateSkewTransform( + skewTransform: *mut *mut IDCompositionSkewTransform, + ) -> HRESULT, + fn CreateMatrixTransform( + matrixTransform: *mut *mut IDCompositionMatrixTransform, + ) -> HRESULT, + fn CreateTransformGroup( + transforms: *const *const IDCompositionTransform, + elements: UINT, + transformGroup: *mut *mut IDCompositionTransform, + ) -> HRESULT, + fn CreateTranslateTransform3D( + translateTransform3D: *mut *mut IDCompositionTranslateTransform3D, + ) -> HRESULT, + fn CreateScaleTransform3D( + scaleTransform3D: *mut *mut IDCompositionScaleTransform3D, + ) -> HRESULT, + fn CreateRotateTransform3D( + rotateTransform3D: *mut *mut IDCompositionRotateTransform3D, + ) -> HRESULT, + fn CreateMatrixTransform3D( + matrixTransform3D: *mut *mut IDCompositionMatrixTransform3D, + ) -> HRESULT, + fn CreateTransform3DGroup( + transforms3D: *const *const IDCompositionTransform3D, + elements: UINT, + transform3DGroup: *mut *mut IDCompositionTransform3D, + ) -> HRESULT, + fn CreateEffectGroup( + effectGroup: *mut *mut IDCompositionEffectGroup, + ) -> HRESULT, + fn CreateRectangleClip( + clip: *mut *mut IDCompositionRectangleClip, + ) -> HRESULT, + fn CreateAnimation( + animation: *mut *mut IDCompositionAnimation, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x5f4633fe, 0x1e08, 0x4cb8, 0x8c, 0x75, 0xce, 0x24, 0x33, 0x3f, 0x56, 0x02)] +interface IDCompositionDesktopDevice(IDCompositionDesktopDeviceVtbl): + IDCompositionDevice2(IDCompositionDevice2Vtbl) { + fn CreateTargetForHwnd( + hwnd: HWND, + topmost: BOOL, + target: *mut *mut IDCompositionTarget, + ) -> HRESULT, + fn CreateSurfaceFromHandle( + handle: HANDLE, + surface: *mut *mut IUnknown, + ) -> HRESULT, + fn CreateSurfaceFromHwnd( + hwnd: HWND, + surface: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa1a3c64a, 0x224f, 0x4a81, 0x97, 0x73, 0x4f, 0x03, 0xa8, 0x9d, 0x3c, 0x6c)] +interface IDCompositionDeviceDebug(IDCompositionDeviceDebugVtbl): IUnknown(IUnknownVtbl) { + fn EnableDebugCounters() -> HRESULT, + fn DisableDebugCounters() -> HRESULT, +}); +RIDL!(#[uuid(0xe334bc12, 0x3937, 0x4e02, 0x85, 0xeb, 0xfc, 0xf4, 0xeb, 0x30, 0xd2, 0xc8)] +interface IDCompositionSurfaceFactory(IDCompositionSurfaceFactoryVtbl): IUnknown(IUnknownVtbl) { + fn CreateSurface( + width: UINT, + height: UINT, + pixelFormat: DXGI_FORMAT, + alphaMode: DXGI_ALPHA_MODE, + surface: *mut *mut IDCompositionSurface, + ) -> HRESULT, + fn CreateVirtualSurface( + initialWidth: UINT, + initialHeight: UINT, + pixelFormat: DXGI_FORMAT, + alphaMode: DXGI_ALPHA_MODE, + virtualSurface: *mut *mut IDCompositionVirtualSurface, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xe8de1639, 0x4331, 0x4b26, 0xbc, 0x5f, 0x6a, 0x32, 0x1d, 0x34, 0x7a, 0x85)] +interface IDCompositionVisual2(IDCompositionVisual2Vtbl): + IDCompositionVisual(IDCompositionVisualVtbl) { + fn SetOpacityMode( + mode: DCOMPOSITION_OPACITY_MODE, + ) -> HRESULT, + fn SetBackFaceVisibility( + visibility: DCOMPOSITION_BACKFACE_VISIBILITY, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xfed2b808, 0x5eb4, 0x43a0, 0xae, 0xa3, 0x35, 0xf6, 0x52, 0x80, 0xf9, 0x1b)] +interface IDCompositionVisualDebug(IDCompositionVisualDebugVtbl): + IDCompositionVisual2(IDCompositionVisual2Vtbl) { + fn EnableHeatMap( + color: *const D2D1_COLOR_F, + ) -> HRESULT, + fn DisableHeatMap() -> HRESULT, + fn EnableRedrawRegions() -> HRESULT, + fn DisableRedrawRegions() -> HRESULT, +}); +RIDL!(#[uuid(0x2775f462, 0xb6c1, 0x4015, 0xb0, 0xbe, 0xb3, 0xe7, 0xd6, 0xa4, 0x97, 0x6d)] +interface IDCompositionVisual3(IDCompositionVisual3Vtbl): + IDCompositionVisualDebug(IDCompositionVisualDebugVtbl) { + fn SetDepthMode( + mode: DCOMPOSITION_DEPTH_MODE, + ) -> HRESULT, + fn SetOffsetZ_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOffsetZ_1( + offsetZ: c_float, + ) -> HRESULT, + fn SetOpacity_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetOpacity_1( + opacity: c_float, + ) -> HRESULT, + fn SetTransform_2( + transform: *const IDCompositionTransform3D, + ) -> HRESULT, + fn SetTransform_1( + matrix: *const D2D_MATRIX_4X4_F, + ) -> HRESULT, + fn SetVisible( + visible: BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x0987cb06, 0xf916, 0x48bf, 0x8d, 0x35, 0xce, 0x76, 0x41, 0x78, 0x1b, 0xd9)] +interface IDCompositionDevice3(IDCompositionDevice3Vtbl): + IDCompositionDevice2(IDCompositionDevice2Vtbl) { + fn CreateGaussianBlurEffect( + gaussianBlurEffect: *mut *mut IDCompositionGaussianBlurEffect, + ) -> HRESULT, + fn CreateBrightnessEffect( + brightnessEffect: *mut *mut IDCompositionBrightnessEffect, + ) -> HRESULT, + fn CreateColorMatrixEffect( + colorMatrixEffect: *mut *mut IDCompositionColorMatrixEffect, + ) -> HRESULT, + fn CreateShadowEffect( + shadowEffect: *mut *mut IDCompositionShadowEffect, + ) -> HRESULT, + fn CreateHueRotationEffect( + hueRotationEffect: *mut *mut IDCompositionHueRotationEffect, + ) -> HRESULT, + fn CreateSaturationEffect( + saturationEffect: *mut *mut IDCompositionSaturationEffect, + ) -> HRESULT, + fn CreateTurbulenceEffect( + turbulenceEffect: *mut *mut IDCompositionTurbulenceEffect, + ) -> HRESULT, + fn CreateLinearTransferEffect( + linearTransferEffect: *mut *mut IDCompositionLinearTransferEffect, + ) -> HRESULT, + fn CreateTableTransferEffect( + tableTransferEffect: *mut *mut IDCompositionTableTransferEffect, + ) -> HRESULT, + fn CreateCompositeEffect( + compositeEffect: *mut *mut IDCompositionCompositeEffect, + ) -> HRESULT, + fn CreateBlendEffect( + blendEffect: *mut *mut IDCompositionBlendEffect, + ) -> HRESULT, + fn CreateArithmeticCompositeEffect( + arithmeticCompositeEffect: *mut *mut IDCompositionArithmeticCompositeEffect, + ) -> HRESULT, + fn CreateAffineTransform2DEffect( + affineTransform2dEffect: *mut *mut IDCompositionAffineTransform2DEffect, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x30c421d5, 0x8cb2, 0x4e9f, 0xb1, 0x33, 0x37, 0xbe, 0x27, 0x0d, 0x4a, 0xc2)] +interface IDCompositionFilterEffect(IDCompositionFilterEffectVtbl): + IDCompositionEffect(IDCompositionEffectVtbl) { + fn SetInput( + index: UINT, + input: *const IUnknown, + flags: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x45d4d0b7, 0x1bd4, 0x454e, 0x88, 0x94, 0x2b, 0xfa, 0x68, 0x44, 0x30, 0x33)] +interface IDCompositionGaussianBlurEffect(IDCompositionGaussianBlurEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetStandardDeviation_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetStandardDeviation_1( + amount: c_float, + ) -> HRESULT, + fn SetBorderMode( + mode: D2D1_BORDER_MODE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x6027496e, 0xcb3a, 0x49ab, 0x93, 0x4f, 0xd7, 0x98, 0xda, 0x4f, 0x7d, 0xa6)] +interface IDCompositionBrightnessEffect(IDCompositionBrightnessEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetWhitePoint( + whitePoint: *const D2D1_VECTOR_2F, + ) -> HRESULT, + fn SetBlackPoint( + blackPoint: *const D2D1_VECTOR_2F, + ) -> HRESULT, + fn SetWhitePointX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetWhitePointX_1( + whitePointX: c_float, + ) -> HRESULT, + fn SetWhitePointY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetWhitePointY_1( + whitePointY: c_float, + ) -> HRESULT, + fn SetBlackPointX_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBlackPointX_1( + blackPointX: c_float, + ) -> HRESULT, + fn SetBlackPointY_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBlackPointY_1( + blackPointY: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xc1170a22, 0x3ce2, 0x4966, 0x90, 0xd4, 0x55, 0x40, 0x8b, 0xfc, 0x84, 0xc4)] +interface IDCompositionColorMatrixEffect(IDCompositionColorMatrixEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetMatrix( + matrix: *const D2D1_MATRIX_5X4_F, + ) -> HRESULT, + fn SetMatrixElement_2( + row: c_int, + column: c_int, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetMatrixElement_1( + row: c_int, + column: c_int, + value: c_float, + ) -> HRESULT, + fn SetAlphaMode( + mode: D2D1_COLORMATRIX_ALPHA_MODE, + ) -> HRESULT, + fn SetClampOutput( + clamp: BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x4ad18ac0, 0xcfd2, 0x4c2f, 0xbb, 0x62, 0x96, 0xe5, 0x4f, 0xdb, 0x68, 0x79)] +interface IDCompositionShadowEffect(IDCompositionShadowEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetStandardDeviation_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetStandardDeviation_1( + amount: c_float, + ) -> HRESULT, + fn SetColor( + color: *const D2D1_VECTOR_4F, + ) -> HRESULT, + fn SetRed_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetRed_1( + amount: c_float, + ) -> HRESULT, + fn SetGreen_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetGreen_1( + amount: c_float, + ) -> HRESULT, + fn SetBlue_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBlue_1( + amount: c_float, + ) -> HRESULT, + fn SetAlpha_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAlpha_1( + amount: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x6db9f920, 0x0770, 0x4781, 0xb0, 0xc6, 0x38, 0x19, 0x12, 0xf9, 0xd1, 0x67)] +interface IDCompositionHueRotationEffect(IDCompositionHueRotationEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + // Changes the angle of rotation + fn SetAngle_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAngle_1( + amountDegrees: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa08debda, 0x3258, 0x4fa4, 0x9f, 0x16, 0x91, 0x74, 0xd3, 0xfe, 0x93, 0xb1)] +interface IDCompositionSaturationEffect(IDCompositionSaturationEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + // Changes the amount of saturation to be applied. + fn SetSaturation_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetSaturation_1( + ratio: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa6a55bda, 0xc09c, 0x49f3, 0x91, 0x93, 0xa4, 0x19, 0x22, 0xc8, 0x97, 0x15)] +interface IDCompositionTurbulenceEffect(IDCompositionTurbulenceEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetOffset( + offset: *const D2D1_VECTOR_2F, + ) -> HRESULT, + fn SetBaseFrequency( + frequency: *const D2D1_VECTOR_2F, + ) -> HRESULT, + fn SetSize( + size: *const D2D1_VECTOR_2F, + ) -> HRESULT, + fn SetNumOctaves( + numOctaves: UINT, + ) -> HRESULT, + fn SetSeed( + seed: UINT, + ) -> HRESULT, + fn SetNoise( + noise: D2D1_TURBULENCE_NOISE, + ) -> HRESULT, + fn SetStitchable( + stitchable: BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x4305ee5b, 0xc4a0, 0x4c88, 0x93, 0x85, 0x67, 0x12, 0x4e, 0x01, 0x76, 0x83)] +interface IDCompositionLinearTransferEffect(IDCompositionLinearTransferEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetRedYIntercept_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetRedYIntercept_1( + redYIntercept: c_float, + ) -> HRESULT, + fn SetRedSlope_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetRedSlope_1( + redSlope: c_float, + ) -> HRESULT, + fn SetRedDisable( + redDisable: BOOL, + ) -> HRESULT, + fn SetGreenYIntercept_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetGreenYIntercept_1( + greenYIntercept: c_float, + ) -> HRESULT, + fn SetGreenSlope_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetGreenSlope_1( + greenSlope: c_float, + ) -> HRESULT, + fn SetGreenDisable( + greenDisable: BOOL, + ) -> HRESULT, + fn SetBlueYIntercept_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBlueYIntercept_1( + blueYIntercept: c_float, + ) -> HRESULT, + fn SetBlueSlope_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBlueSlope_1( + blueSlope: c_float, + ) -> HRESULT, + fn SetBlueDisable( + blueDisable: BOOL, + ) -> HRESULT, + fn SetAlphaYIntercept_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAlphaYIntercept_1( + alphaYIntercept: c_float, + ) -> HRESULT, + fn SetAlphaSlope_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAlphaSlope_1( + alphaSlope: c_float, + ) -> HRESULT, + fn SetAlphaDisable( + alphaDisable: BOOL, + ) -> HRESULT, + fn SetClampOutput( + clampOutput: BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x9b7e82e2, 0x69c5, 0x4eb4, 0xa5, 0xf5, 0xa7, 0x03, 0x3f, 0x51, 0x32, 0xcd)] +interface IDCompositionTableTransferEffect(IDCompositionTableTransferEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetRedTable( + tableValues: *const c_float, + count: UINT, + ) -> HRESULT, + fn SetGreenTable( + tableValues: *const c_float, + count: UINT, + ) -> HRESULT, + fn SetBlueTable( + tableValues: *const c_float, + count: UINT, + ) -> HRESULT, + fn SetAlphaTable( + tableValues: *const c_float, + count: UINT, + ) -> HRESULT, + fn SetRedDisable( + redDisable: BOOL, + ) -> HRESULT, + fn SetGreenDisable( + greenDisable: BOOL, + ) -> HRESULT, + fn SetBlueDisable( + blueDisable: BOOL, + ) -> HRESULT, + fn SetAlphaDisable( + alphaDisable: BOOL, + ) -> HRESULT, + fn SetClampOutput( + clampOutput: BOOL, + ) -> HRESULT, + fn SetRedTableValue_2( + index: UINT, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetRedTableValue_1( + index: UINT, + value: c_float, + ) -> HRESULT, + fn SetGreenTableValue_2( + index: UINT, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetGreenTableValue_1( + index: UINT, + value: c_float, + ) -> HRESULT, + fn SetBlueTableValue_2( + index: UINT, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetBlueTableValue_1( + index: UINT, + value: c_float, + ) -> HRESULT, + fn SetAlphaTableValue_2( + index: UINT, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetAlphaTableValue_1( + index: UINT, + value: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x576616c0, 0xa231, 0x494d, 0xa3, 0x8d, 0x00, 0xfd, 0x5e, 0xc4, 0xdb, 0x46)] +interface IDCompositionCompositeEffect(IDCompositionCompositeEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetMode( + mode: D2D1_COMPOSITE_MODE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x33ecdc0a, 0x578a, 0x4a11, 0x9c, 0x14, 0x0c, 0xb9, 0x05, 0x17, 0xf9, 0xc5)] +interface IDCompositionBlendEffect(IDCompositionBlendEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetMode( + mode: D2D1_BLEND_MODE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3b67dfa8, 0xe3dd, 0x4e61, 0xb6, 0x40, 0x46, 0xc2, 0xf3, 0xd7, 0x39, 0xdc)] +interface IDCompositionArithmeticCompositeEffect(IDCompositionArithmeticCompositeEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetCoefficients( + coefficients: *const D2D1_VECTOR_4F, + ) -> HRESULT, + fn SetClampOutput( + clampoutput: BOOL, + ) -> HRESULT, + fn SetCoefficient1_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCoefficient1_1( + Coeffcient1: c_float, + ) -> HRESULT, + fn SetCoefficient2_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCoefficient2_1( + Coefficient2: c_float, + ) -> HRESULT, + fn SetCoefficient3_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCoefficient3_1( + Coefficient3: c_float, + ) -> HRESULT, + fn SetCoefficient4_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetCoefficient4_1( + Coefficient4: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x0b74b9e8, 0xcdd6, 0x492f, 0xbb, 0xbc, 0x5e, 0xd3, 0x21, 0x57, 0x02, 0x6d)] +interface IDCompositionAffineTransform2DEffect(IDCompositionAffineTransform2DEffectVtbl): + IDCompositionFilterEffect(IDCompositionFilterEffectVtbl) { + fn SetInterpolationMode( + interpolationMode: D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE, + ) -> HRESULT, + fn SetBorderMode( + borderMode: D2D1_BORDER_MODE, + ) -> HRESULT, + fn SetTransformMatrix( + transformMatrix: *const D2D1_MATRIX_3X2_F, + ) -> HRESULT, + fn SetTransformMatrixElement_2( + row: c_int, + column: c_int, + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetTransformMatrixElement_1( + row: c_int, + column: c_int, + value: c_float, + ) -> HRESULT, + fn SetSharpness_2( + animation: *const IDCompositionAnimation, + ) -> HRESULT, + fn SetSharpness_1( + sharpness: c_float, + ) -> HRESULT, +}); diff --git a/src/vendor/winapi/src/um/dcompanimation.rs b/src/vendor/winapi/src/um/dcompanimation.rs new file mode 100644 index 0000000000..46a1cb5a0a --- /dev/null +++ b/src/vendor/winapi/src/um/dcompanimation.rs @@ -0,0 +1,39 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of dcompanimation.h +use ctypes::{c_double, c_float}; +use shared::ntdef::{HRESULT, LARGE_INTEGER}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +RIDL!(#[uuid(0xcbfd91d9, 0x51b2, 0x45e4, 0xb3, 0xde, 0xd1, 0x9c, 0xcf, 0xb8, 0x63, 0xc5)] +interface IDCompositionAnimation(IDCompositionAnimationVtbl): IUnknown(IUnknownVtbl) { + fn Reset() -> HRESULT, + fn SetAbsoluteBeginTime( + beginTime: LARGE_INTEGER, + ) -> HRESULT, + fn AddCubic( + beginOffset: c_double, + constantCoefficient: c_float, + linearCoefficient: c_float, + quadraticCoefficient: c_float, + cubicCoefficient: c_float, + )-> HRESULT, + fn AddSinusoidal( + beginOffset: c_double, + bias: c_float, + amplitude: c_float, + frequency: c_float, + phase: c_float, + )-> HRESULT, + fn AddRepeat( + beginOffset: c_double, + durationToRepeat: c_double, + )-> HRESULT, + fn End( + endOffset: c_double, + endValue: c_float, + ) -> HRESULT, +}); diff --git a/src/vendor/winapi/src/um/dde.rs b/src/vendor/winapi/src/um/dde.rs new file mode 100644 index 0000000000..89e144c740 --- /dev/null +++ b/src/vendor/winapi/src/um/dde.rs @@ -0,0 +1,21 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::{PUINT_PTR, UINT_PTR}; +use shared::minwindef::{BOOL, LPARAM, UINT}; +extern "system" { + pub fn PackDDElParam( + msg: UINT, + uiLo: UINT_PTR, + uiHi: UINT_PTR, + ) -> LPARAM; + pub fn UnpackDDElParam( + msg: UINT, + lParam: LPARAM, + puiLo: PUINT_PTR, + puiHi: PUINT_PTR, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/ddraw.rs b/src/vendor/winapi/src/um/ddraw.rs new file mode 100644 index 0000000000..4b71cebb03 --- /dev/null +++ b/src/vendor/winapi/src/um/ddraw.rs @@ -0,0 +1,38 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{CLSID_DirectDraw, + 0xd7b70ee0, 0x4340, 0x11cf, 0xb0, 0x63, 0x00, 0x20, 0xaf, 0xc2, 0xcd, 0x35} +DEFINE_GUID!{CLSID_DirectDraw7, + 0x3c305196, 0x50db, 0x11d3, 0x9c, 0xfe, 0x00, 0xc0, 0x4f, 0xd9, 0x30, 0xc5} +DEFINE_GUID!{CLSID_DirectDrawClipper, + 0x593817a0, 0x7db3, 0x11cf, 0xa2, 0xde, 0x00, 0xaa, 0x00, 0xb9, 0x33, 0x56} +DEFINE_GUID!{IID_IDirectDraw, + 0x6c14db80, 0xa733, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectDraw2, + 0xb3a6f3e0, 0x2b43, 0x11cf, 0xa2, 0xde, 0x00, 0xaa, 0x00, 0xb9, 0x33, 0x56} +DEFINE_GUID!{IID_IDirectDraw4, + 0x9c59509a, 0x39bd, 0x11d1, 0x8c, 0x4a, 0x00, 0xc0, 0x4f, 0xd9, 0x30, 0xc5} +DEFINE_GUID!{IID_IDirectDraw7, + 0x15e65ec0, 0x3b9c, 0x11d2, 0xb9, 0x2f, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b} +DEFINE_GUID!{IID_IDirectDrawSurface, + 0x6c14db81, 0xa733, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectDrawSurface2, + 0x57805885, 0x6eec, 0x11cf, 0x94, 0x41, 0xa8, 0x23, 0x03, 0xc1, 0x0e, 0x27} +DEFINE_GUID!{IID_IDirectDrawSurface3, + 0xda044e00, 0x69b2, 0x11d0, 0xa1, 0xd5, 0x00, 0xaa, 0x00, 0xb8, 0xdf, 0xbb} +DEFINE_GUID!{IID_IDirectDrawSurface4, + 0x0b2b8630, 0xad35, 0x11d0, 0x8e, 0xa6, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b} +DEFINE_GUID!{IID_IDirectDrawSurface7, + 0x06675a80, 0x3b9b, 0x11d2, 0xb9, 0x2f, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b} +DEFINE_GUID!{IID_IDirectDrawPalette, + 0x6c14db84, 0xa733, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectDrawClipper, + 0x6c14db85, 0xa733, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectDrawColorControl, + 0x4b9f0ee0, 0x0d7e, 0x11d0, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{IID_IDirectDrawGammaControl, + 0x69c11c3e, 0xb46b, 0x11d1, 0xad, 0x7a, 0x00, 0xc0, 0x4f, 0xc2, 0x9b, 0x4e} diff --git a/src/vendor/winapi/src/um/ddrawi.rs b/src/vendor/winapi/src/um/ddrawi.rs new file mode 100644 index 0000000000..0af03de781 --- /dev/null +++ b/src/vendor/winapi/src/um/ddrawi.rs @@ -0,0 +1,14 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{GUID_OptSurfaceKmodeInfo, + 0xe05c8472, 0x51d4, 0x11d1, 0x8c, 0xce, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{GUID_OptSurfaceUmodeInfo, + 0x9d792804, 0x5fa8, 0x11d1, 0x8c, 0xd0, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{GUID_UserModeDriverInfo, + 0xf0b0e8e2, 0x5f97, 0x11d1, 0x8c, 0xd0, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{GUID_UserModeDriverPassword, + 0x97f861b6, 0x60a1, 0x11d1, 0x8c, 0xd0, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} diff --git a/src/vendor/winapi/src/um/ddrawint.rs b/src/vendor/winapi/src/um/ddrawint.rs new file mode 100644 index 0000000000..db36964cdf --- /dev/null +++ b/src/vendor/winapi/src/um/ddrawint.rs @@ -0,0 +1,42 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{GUID_MiscellaneousCallbacks, + 0xefd60cc0, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a} +DEFINE_GUID!{GUID_Miscellaneous2Callbacks, + 0x406b2f00, 0x3e5a, 0x11d1, 0xb6, 0x40, 0x00, 0xaa, 0x00, 0xa1, 0xf9, 0x6a} +DEFINE_GUID!{GUID_VideoPortCallbacks, + 0xefd60cc1, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a} +DEFINE_GUID!{GUID_ColorControlCallbacks, + 0xefd60cc2, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a} +DEFINE_GUID!{GUID_MotionCompCallbacks, + 0xb1122b40, 0x5da5, 0x11d1, 0x8f, 0xcf, 0x00, 0xc0, 0x4f, 0xc2, 0x9b, 0x4e} +DEFINE_GUID!{GUID_VideoPortCaps, + 0xefd60cc3, 0x49e7, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a} +DEFINE_GUID!{GUID_D3DExtendedCaps, + 0x7de41f80, 0x9d93, 0x11d0, 0x89, 0xab, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{GUID_D3DCallbacks2, + 0x0ba584e1, 0x70b6, 0x11d0, 0x88, 0x9d, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x6a} +DEFINE_GUID!{GUID_D3DCallbacks3, + 0xddf41230, 0xec0a, 0x11d0, 0xa9, 0xb6, 0x00, 0xaa, 0x00, 0xc0, 0x99, 0x3e} +DEFINE_GUID!{GUID_NonLocalVidMemCaps, + 0x86c4fa80, 0x8d84, 0x11d0, 0x94, 0xe8, 0x00, 0xc0, 0x4f, 0xc3, 0x41, 0x37} +DEFINE_GUID!{GUID_KernelCallbacks, + 0x80863800, 0x6b06, 0x11d0, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{GUID_KernelCaps, + 0xffaa7540, 0x7aa8, 0x11d0, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{GUID_ZPixelFormats, + 0x93869880, 0x36cf, 0x11d1, 0x9b, 0x1b, 0x00, 0xaa, 0x00, 0xbb, 0xb8, 0xae} +DEFINE_GUID!{GUID_DDMoreCaps, + 0x880baf30, 0xb030, 0x11d0, 0x8e, 0xa7, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b} +DEFINE_GUID!{GUID_D3DParseUnknownCommandCallback, + 0x2e04ffa0, 0x98e4, 0x11d1, 0x8c, 0xe1, 0x00, 0xa0, 0xc9, 0x06, 0x29, 0xa8} +DEFINE_GUID!{GUID_NTCallbacks, + 0x6fe9ecde, 0xdf89, 0x11d1, 0x9d, 0xb0, 0x00, 0x60, 0x08, 0x27, 0x71, 0xba} +DEFINE_GUID!{GUID_DDMoreSurfaceCaps, + 0x3b8a0466, 0xf269, 0x11d1, 0x88, 0x0b, 0x00, 0xc0, 0x4f, 0xd9, 0x30, 0xc5} +DEFINE_GUID!{GUID_DDStereoMode, + 0xf828169c, 0xa8e8, 0x11d2, 0xa1, 0xf2, 0x00, 0xa0, 0xc9, 0x83, 0xea, 0xf6} diff --git a/src/vendor/winapi/src/um/debugapi.rs b/src/vendor/winapi/src/um/debugapi.rs new file mode 100644 index 0000000000..026090a504 --- /dev/null +++ b/src/vendor/winapi/src/um/debugapi.rs @@ -0,0 +1,42 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, DWORD, PBOOL}; +use um::minwinbase::LPDEBUG_EVENT; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR}; +extern "system" { + pub fn IsDebuggerPresent() -> BOOL; + pub fn DebugBreak(); + pub fn OutputDebugStringA( + lpOutputString: LPCSTR, + ); + pub fn OutputDebugStringW( + lpOutputString: LPCWSTR, + ); + pub fn ContinueDebugEvent( + dwProcessId: DWORD, + dwThreadId: DWORD, + dwContinueStatus: DWORD, + ) -> BOOL; + pub fn WaitForDebugEvent( + lpDebugEvent: LPDEBUG_EVENT, + dwMilliseconds: DWORD, + ) -> BOOL; + pub fn DebugActiveProcess( + dwProcessId: DWORD, + ) -> BOOL; + pub fn DebugActiveProcessStop( + dwProcessId: DWORD, + ) -> BOOL; + pub fn CheckRemoteDebuggerPresent( + hProcess: HANDLE, + pbDebuggerPresent: PBOOL, + ) -> BOOL; + pub fn WaitForDebugEventEx( + lpDebugEvent: LPDEBUG_EVENT, + dwMilliseconds: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/dinput.rs b/src/vendor/winapi/src/um/dinput.rs new file mode 100644 index 0000000000..4957f88085 --- /dev/null +++ b/src/vendor/winapi/src/um/dinput.rs @@ -0,0 +1,108 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{CLSID_DirectInput, + 0x25e609e0, 0xb259, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{CLSID_DirectInputDevice, + 0x25e609e1, 0xb259, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{CLSID_DirectInput8, + 0x25e609e4, 0xb259, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{CLSID_DirectInputDevice8, + 0x25e609e5, 0xb259, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInputA, + 0x89521360, 0xaa8a, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInputW, + 0x89521361, 0xaa8a, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInput2A, + 0x5944e662, 0xaa8a, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInput2W, + 0x5944e663, 0xaa8a, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInput7A, + 0x9a4cb684, 0x236d, 0x11d3, 0x8e, 0x9d, 0x00, 0xc0, 0x4f, 0x68, 0x44, 0xae} +DEFINE_GUID!{IID_IDirectInput7W, + 0x9a4cb685, 0x236d, 0x11d3, 0x8e, 0x9d, 0x00, 0xc0, 0x4f, 0x68, 0x44, 0xae} +DEFINE_GUID!{IID_IDirectInput8A, + 0xbf798030, 0x483a, 0x4da2, 0xaa, 0x99, 0x5d, 0x64, 0xed, 0x36, 0x97, 0x00} +DEFINE_GUID!{IID_IDirectInput8W, + 0xbf798031, 0x483a, 0x4da2, 0xaa, 0x99, 0x5d, 0x64, 0xed, 0x36, 0x97, 0x00} +DEFINE_GUID!{IID_IDirectInputDeviceA, + 0x5944e680, 0xc92e, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInputDeviceW, + 0x5944e681, 0xc92e, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInputDevice2A, + 0x5944e682, 0xc92e, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInputDevice2W, + 0x5944e683, 0xc92e, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{IID_IDirectInputDevice7A, + 0x57d7c6bc, 0x2356, 0x11d3, 0x8e, 0x9d, 0x00, 0xc0, 0x4f, 0x68, 0x44, 0xae} +DEFINE_GUID!{IID_IDirectInputDevice7W, + 0x57d7c6bd, 0x2356, 0x11d3, 0x8e, 0x9d, 0x00, 0xc0, 0x4f, 0x68, 0x44, 0xae} +DEFINE_GUID!{IID_IDirectInputDevice8A, + 0x54d41080, 0xdc15, 0x4833, 0xa4, 0x1b, 0x74, 0x8f, 0x73, 0xa3, 0x81, 0x79} +DEFINE_GUID!{IID_IDirectInputDevice8W, + 0x54d41081, 0xdc15, 0x4833, 0xa4, 0x1b, 0x74, 0x8f, 0x73, 0xa3, 0x81, 0x79} +DEFINE_GUID!{IID_IDirectInputEffect, + 0xe7e1f7c0, 0x88d2, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_XAxis, + 0xa36d02e0, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_YAxis, + 0xa36d02e1, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_ZAxis, + 0xa36d02e2, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_RxAxis, + 0xa36d02f4, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_RyAxis, + 0xa36d02f5, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_RzAxis, + 0xa36d02e3, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_Slider, + 0xa36d02e4, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_Button, + 0xa36d02f0, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_Key, + 0x55728220, 0xd33c, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_POV, + 0xa36d02f2, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_Unknown, + 0xa36d02f3, 0xc9f3, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_SysMouse, + 0x6f1d2b60, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_SysKeyboard, + 0x6f1d2b61, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_Joystick, + 0x6f1d2b70, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_SysMouseEm, + 0x6f1d2b80, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_SysMouseEm2, + 0x6f1d2b81, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_SysKeyboardEm, + 0x6f1d2b82, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_SysKeyboardEm2, + 0x6f1d2b83, 0xd5a0, 0x11cf, 0xbf, 0xc7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{GUID_ConstantForce, + 0x13541c20, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_RampForce, + 0x13541c21, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_Square, + 0x13541c22, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_Sine, + 0x13541c23, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_Triangle, + 0x13541c24, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_SawtoothUp, + 0x13541c25, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_SawtoothDown, + 0x13541c26, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_Spring, + 0x13541c27, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_Damper, + 0x13541c28, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_Inertia, + 0x13541c29, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_Friction, + 0x13541c2a, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} +DEFINE_GUID!{GUID_CustomForce, + 0x13541c2b, 0x8e33, 0x11d0, 0x9a, 0xd0, 0x00, 0xa0, 0xc9, 0xa0, 0x6e, 0x35} diff --git a/src/vendor/winapi/src/um/dmksctl.rs b/src/vendor/winapi/src/um/dmksctl.rs new file mode 100644 index 0000000000..61302343af --- /dev/null +++ b/src/vendor/winapi/src/um/dmksctl.rs @@ -0,0 +1,12 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_IKsControl, + 0x28f54685, 0x06fd, 0x11d2, 0xb2, 0x7a, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_MIDI, + 0x1d262760, 0xe957, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00} +DEFINE_GUID!{KSDATAFORMAT_SUBTYPE_DIRECTMUSIC, + 0x1a82f8bc, 0x3f8b, 0x11d2, 0xb7, 0x74, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1} diff --git a/src/vendor/winapi/src/um/dmusicc.rs b/src/vendor/winapi/src/um/dmusicc.rs new file mode 100644 index 0000000000..18fba40b59 --- /dev/null +++ b/src/vendor/winapi/src/um/dmusicc.rs @@ -0,0 +1,72 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{CLSID_DirectMusic, + 0x636b9f10, 0x0c7d, 0x11d1, 0x95, 0xb2, 0x00, 0x20, 0xaf, 0xdc, 0x74, 0x21} +DEFINE_GUID!{CLSID_DirectMusicCollection, + 0x480ff4b0, 0x28b2, 0x11d1, 0xbe, 0xf7, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef} +DEFINE_GUID!{CLSID_DirectMusicSynth, + 0x58c2b4d0, 0x46e7, 0x11d1, 0x89, 0xac, 0x00, 0xa0, 0xc9, 0x05, 0x41, 0x29} +DEFINE_GUID!{IID_IDirectMusic, + 0x6536115a, 0x7b2d, 0x11d2, 0xba, 0x18, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{IID_IDirectMusicBuffer, + 0xd2ac2878, 0xb39b, 0x11d1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{IID_IDirectMusicPort, + 0x08f2d8c9, 0x37c2, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{IID_IDirectMusicThru, + 0xced153e7, 0x3606, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{IID_IDirectMusicPortDownload, + 0xd2ac287a, 0xb39b, 0x11d1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{IID_IDirectMusicDownload, + 0xd2ac287b, 0xb39b, 0x11d1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{IID_IDirectMusicCollection, + 0xd2ac287c, 0xb39b, 0x11d1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{IID_IDirectMusicInstrument, + 0xd2ac287d, 0xb39b, 0x11d1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{IID_IDirectMusicDownloadedInstrument, + 0xd2ac287e, 0xb39b, 0x11d1, 0x87, 0x04, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{IID_IDirectMusic2, + 0x6fc2cae1, 0xbc78, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6} +DEFINE_GUID!{IID_IDirectMusic8, + 0x2d3629f7, 0x813d, 0x4939, 0x85, 0x08, 0xf0, 0x5c, 0x6b, 0x75, 0xfd, 0x97} +DEFINE_GUID!{GUID_DMUS_PROP_GM_Hardware, + 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{GUID_DMUS_PROP_GS_Hardware, + 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{GUID_DMUS_PROP_XG_Hardware, + 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{GUID_DMUS_PROP_XG_Capable, + 0x6496aba1, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6} +DEFINE_GUID!{GUID_DMUS_PROP_GS_Capable, + 0x6496aba2, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6} +DEFINE_GUID!{GUID_DMUS_PROP_DLS1, + 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{GUID_DMUS_PROP_DLS2, + 0xf14599e5, 0x4689, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6} +DEFINE_GUID!{GUID_DMUS_PROP_INSTRUMENT2, + 0x865fd372, 0x9f67, 0x11d2, 0x87, 0x2a, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{GUID_DMUS_PROP_SynthSink_DSOUND, + 0x0aa97844, 0xc877, 0x11d1, 0x87, 0x0c, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{GUID_DMUS_PROP_SynthSink_WAVE, + 0x0aa97845, 0xc877, 0x11d1, 0x87, 0x0c, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{GUID_DMUS_PROP_SampleMemorySize, + 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{GUID_DMUS_PROP_SamplePlaybackRate, + 0x2a91f713, 0xa4bf, 0x11d2, 0xbb, 0xdf, 0x00, 0x60, 0x08, 0x33, 0xdb, 0xd8} +DEFINE_GUID!{GUID_DMUS_PROP_WriteLatency, + 0x268a0fa0, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6} +DEFINE_GUID!{GUID_DMUS_PROP_WritePeriod, + 0x268a0fa1, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6} +DEFINE_GUID!{GUID_DMUS_PROP_MemorySize, + 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{GUID_DMUS_PROP_WavesReverb, + 0x04cb5622, 0x32e5, 0x11d2, 0xaf, 0xa6, 0x00, 0xaa, 0x00, 0x24, 0xd8, 0xb6} +DEFINE_GUID!{GUID_DMUS_PROP_Effects, + 0xcda8d611, 0x684a, 0x11d2, 0x87, 0x1e, 0x00, 0x60, 0x08, 0x93, 0xb1, 0xbd} +DEFINE_GUID!{GUID_DMUS_PROP_LegacyCaps, + 0xcfa7cdc2, 0x00a1, 0x11d2, 0xaa, 0xd5, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} +DEFINE_GUID!{GUID_DMUS_PROP_Volume, + 0xfedfae25, 0xe46e, 0x11d1, 0xaa, 0xce, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12} diff --git a/src/vendor/winapi/src/um/docobj.rs b/src/vendor/winapi/src/um/docobj.rs new file mode 100644 index 0000000000..39c272168f --- /dev/null +++ b/src/vendor/winapi/src/um/docobj.rs @@ -0,0 +1,38 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::wchar_t; +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, ULONG}; +use um::oaidl::VARIANT; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::HRESULT; +STRUCT!{struct OLECMD { + cmdID: ULONG, + cmdf: DWORD, +}} +STRUCT!{struct OLECMDTEXT { + cmdtextf: DWORD, + cwActual: ULONG, + cwBuf: ULONG, + rgwz: [wchar_t; 0], +}} +RIDL!{#[uuid(0xb722bccb, 0x4e68, 0x101b, 0xa2, 0xbc, 0x00, 0xaa, 0x00, 0x40, 0x47, 0x70)] +interface IOleCommandTarget(IOleCommandTargetVtbl): IUnknown(IUnknownVtbl) { + fn QueryStatus( + pguidCmdGroup: *const GUID, + cCmds: ULONG, + prgCmds: *mut OLECMD, + pCmdText: *mut OLECMDTEXT, + ) -> HRESULT, + fn Exec( + pguidCmdGroup: *const GUID, + nCmdID: DWORD, + nCmdexecopt: DWORD, + pvaIn: *mut VARIANT, + pvaOut: *mut VARIANT, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/documenttarget.rs b/src/vendor/winapi/src/um/documenttarget.rs new file mode 100644 index 0000000000..37608b3d51 --- /dev/null +++ b/src/vendor/winapi/src/um/documenttarget.rs @@ -0,0 +1,25 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +// TODO:It is a minimal implementation. +use ctypes::c_void; +use shared::basetsd::UINT32; +use shared::guiddef::{GUID, REFGUID, REFIID}; +use shared::ntdef::HRESULT; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +RIDL!{#[uuid(0x1b8efec4, 0x3019, 0x4c27, 0x96, 0x4e, 0x36, 0x72, 0x02, 0x15, 0x69, 0x06)] +interface IPrintDocumentPackageTarget(IPrintDocumentPackageTargetVtbl): IUnknown(IUnknownVtbl) { + fn GetPackageTargetTypes( + targetCount: *mut UINT32, + targetTypes: *mut *mut GUID, + ) -> HRESULT, + fn GetPackageTarget( + guidTargetType: REFGUID, + riid: REFIID, + ppvTarget: *mut *mut c_void, + ) -> HRESULT, + fn Cancel() -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/dpa_dsa.rs b/src/vendor/winapi/src/um/dpa_dsa.rs new file mode 100644 index 0000000000..25864b523c --- /dev/null +++ b/src/vendor/winapi/src/um/dpa_dsa.rs @@ -0,0 +1,284 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_int, c_void}; +use shared::basetsd::INT_PTR; +use shared::minwindef::{BOOL, DWORD, LPARAM, UINT}; +use um::winnt::{HANDLE, HRESULT, LPCWSTR, LPWSTR, PVOID, ULONGLONG}; +pub const DA_LAST: c_int = 0x7FFFFFFF; +pub const DA_ERR: c_int = -1; +FN!{stdcall PFNDAENUMCALLBACK( + p: *mut c_void, + pData: *mut c_void, +) -> c_int} +FN!{stdcall PFNDAENUMCALLBACKCONST( + p: *const c_void, + pData: *mut c_void, +) -> c_int} +FN!{stdcall PFNDACOMPARE( + p1: *mut c_void, + p2: *mut c_void, + lParam: LPARAM, +) -> c_int} +FN!{stdcall PFNDACOMPARECONST( + p1: *const c_void, + p2: *const c_void, + lParam: LPARAM, +) -> c_int} +pub enum DSA {} +pub type HDSA = *mut DSA; +extern "system" { + pub fn DSA_Create( + cbItem: c_int, + cItemGrow: c_int, + ) -> HDSA; + pub fn DSA_Destroy( + hdsa: HDSA, + ) -> BOOL; + pub fn DSA_DestroyCallback( + hdsa: HDSA, + pfnCB: PFNDAENUMCALLBACK, + pData: *mut c_void, + ); + pub fn DSA_DeleteItem( + hdsa: HDSA, + i: c_int, + ) -> BOOL; + pub fn DSA_DeleteAllItems( + hdsa: HDSA, + ) -> BOOL; + pub fn DSA_EnumCallback( + hdsa: HDSA, + pfnCB: PFNDAENUMCALLBACK, + pData: *mut c_void, + ); + pub fn DSA_InsertItem( + hdsa: HDSA, + i: c_int, + pitem: *const c_void, + ) -> c_int; + pub fn DSA_GetItemPtr( + hdsa: HDSA, + i: c_int, + ) -> PVOID; + pub fn DSA_GetItem( + hdsa: HDSA, + i: c_int, + pitem: *mut c_void, + ) -> BOOL; + pub fn DSA_SetItem( + hdsa: HDSA, + i: c_int, + pitem: *const c_void, + ) -> BOOL; +} +#[inline] +pub unsafe fn DSA_GetItemCount(hdsa: HDSA) -> c_int { + *(hdsa as *mut c_int) +} +#[inline] +pub unsafe fn DSA_AppendItem(hdsa: HDSA, pitem: *const c_void) -> c_int { + DSA_InsertItem(hdsa, DA_LAST, pitem) +} +extern "system" { + pub fn DSA_Clone( + hdsa: HDSA, + ) -> HDSA; + pub fn DSA_GetSize( + hdsa: HDSA, + ) -> ULONGLONG; + pub fn DSA_Sort( + pdsa: HDSA, + pfnCompare: PFNDACOMPARE, + lParam: LPARAM, + ) -> BOOL; +} +pub const DSA_APPEND: c_int = DA_LAST; +pub const DSA_ERR: c_int = DA_ERR; +pub type PFNDSAENUMCALLBACK = PFNDAENUMCALLBACK; +pub type PFNDSAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; +pub type PFNDSACOMPARE = PFNDACOMPARE; +pub type PFNDSACOMPARECONST = PFNDACOMPARECONST; +pub enum DPA {} +pub type HDPA = *mut DPA; +extern "system" { + pub fn DPA_Create( + cItemGrow: c_int, + ) -> HDPA; + pub fn DPA_CreateEx( + cpGrow: c_int, + hheap: HANDLE, + ) -> HDPA; + pub fn DPA_Clone( + hdpa: HDPA, + hdpaNew: HDPA, + ) -> HDPA; + pub fn DPA_Destroy( + hdpa: HDPA, + ) -> BOOL; + pub fn DPA_DestroyCallback( + hdpa: HDPA, + pfnCB: PFNDAENUMCALLBACK, + pData: *mut c_void, + ); + pub fn DPA_DeletePtr( + hdpa: HDPA, + i: c_int, + ) -> PVOID; + pub fn DPA_DeleteAllPtrs( + hdpa: HDPA, + ) -> BOOL; + pub fn DPA_EnumCallback( + hdpa: HDPA, + pfnCB: PFNDAENUMCALLBACK, + pData: *mut c_void, + ); + pub fn DPA_Grow( + hdpa: HDPA, + cp: c_int, + ) -> BOOL; + pub fn DPA_InsertPtr( + hdpa: HDPA, + i: c_int, + p: *mut c_void, + ) -> c_int; + pub fn DPA_SetPtr( + hdpa: HDPA, + i: c_int, + p: *mut c_void, + ) -> BOOL; + pub fn DPA_GetPtr( + hdpa: HDPA, + i: INT_PTR, + ) -> PVOID; + pub fn DPA_GetPtrIndex( + hdpa: HDPA, + p: *const c_void, + ) -> c_int; +} +#[inline] +pub unsafe fn DPA_GetPtrCount(hdpa: HDPA) -> c_int { + *(hdpa as *mut c_int) +} +#[inline] +pub unsafe fn DPA_SetPtrCount(hdpa: HDPA, cItems: c_int) { + *(hdpa as *mut c_int) = cItems; +} +#[inline] +pub unsafe fn DPA_FastDeleteLastPtr(hdpa: HDPA) -> c_int { + *(hdpa as *mut c_int) -= 1; + *(hdpa as *mut c_int) +} +#[inline] +pub unsafe fn DPA_AppendPtr(hdpa: HDPA, pitem: *mut c_void) -> c_int { + DPA_InsertPtr(hdpa, DA_LAST, pitem) +} +extern "system" { + pub fn DPA_GetSize( + hdpa: HDPA, + ) -> ULONGLONG; + pub fn DPA_Sort( + hdpa: HDPA, + pfnCompare: PFNDACOMPARE, + lParam: LPARAM, + ) -> BOOL; +} +STRUCT!{struct DPASTREAMINFO { + iPos: c_int, + pvItem: *mut c_void, +}} +pub enum IStream {} +FN!{stdcall PFNDPASTREAM( + pinfo: *mut DPASTREAMINFO, + pstream: *mut IStream, + pvInstData: *mut c_void, +) -> HRESULT} +extern "system" { + pub fn DPA_LoadStream( + phdpa: *mut HDPA, + pfn: PFNDPASTREAM, + pstream: *mut IStream, + pvInstData: *mut c_void, + ) -> HRESULT; + pub fn DPA_SaveStream( + hdpa: HDPA, + pfn: PFNDPASTREAM, + pstream: *mut IStream, + pvInstData: *mut c_void, + ) -> HRESULT; +} +pub const DPAM_SORTED: DWORD = 0x00000001; +pub const DPAM_NORMAL: DWORD = 0x00000002; +pub const DPAM_UNION: DWORD = 0x00000004; +pub const DPAM_INTERSECT: DWORD = 0x00000008; +FN!{stdcall PFNDPAMERGE( + uMsg: UINT, + pvDest: *mut c_void, + pvSrc: *mut c_void, + lParam: LPARAM, +) -> *mut c_void} +FN!{stdcall PFNDPAMERGECONST( + uMsg: UINT, + pvDest: *const c_void, + pvSrc: *const c_void, + lParam: LPARAM, +) -> *const c_void} +pub const DPAMM_MERGE: UINT = 1; +pub const DPAMM_DELETE: UINT = 2; +pub const DPAMM_INSERT: UINT = 3; +extern "system" { + pub fn DPA_Merge( + hdpaDest: HDPA, + hdpaSrc: HDPA, + dwFlags: DWORD, + pfnCompare: PFNDACOMPARE, + pfnMerge: PFNDPAMERGE, + lParam: LPARAM, + ) -> BOOL; +} +pub const DPAS_SORTED: UINT = 0x0001; +pub const DPAS_INSERTBEFORE: UINT = 0x0002; +pub const DPAS_INSERTAFTER: UINT = 0x0004; +extern "system" { + pub fn DPA_Search( + hdpa: HDPA, + pFind: *mut c_void, + iStart: c_int, + pfnCompare: PFNDACOMPARE, + lParam: LPARAM, + options: UINT, + ) -> c_int; +} +#[inline] +pub unsafe fn DPA_SortedInsertPtr( + hdpa: HDPA, + pFind: *mut c_void, + iStart: c_int, + pfnCompare: PFNDACOMPARE, + lParam: LPARAM, + options: UINT, + pitem: *mut c_void, +) -> c_int { + DPA_InsertPtr( + hdpa, + DPA_Search( + hdpa, pFind, iStart, pfnCompare, lParam, DPAS_SORTED | options + ), + pitem + ) +} +pub const DPA_APPEND: c_int = DA_LAST; +pub const DPA_ERR: c_int = DA_ERR; +pub type PFNDPAENUMCALLBACK = PFNDAENUMCALLBACK; +pub type PFNDPAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; +pub type PFNDPACOMPARE = PFNDACOMPARE; +pub type PFNDPACOMPARECONST = PFNDACOMPARECONST; +extern "system" { + pub fn Str_SetPtrW( + ppsz: *mut LPWSTR, + psz: LPCWSTR, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/dpapi.rs b/src/vendor/winapi/src/um/dpapi.rs new file mode 100644 index 0000000000..8e3aa22510 --- /dev/null +++ b/src/vendor/winapi/src/um/dpapi.rs @@ -0,0 +1,101 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Data Protection API Prototypes and Definitions +use shared::minwindef::{BOOL, BYTE, DWORD, LPVOID}; +use shared::windef::HWND; +use um::wincrypt::DATA_BLOB; +use um::winnt::{LPCWSTR, LPWSTR, PSID, PVOID}; +pub const szFORCE_KEY_PROTECTION: &'static str = "ForceKeyProtection"; +pub const dwFORCE_KEY_PROTECTION_DISABLED: DWORD = 0x0; +pub const dwFORCE_KEY_PROTECTION_USER_SELECT: DWORD = 0x1; +pub const dwFORCE_KEY_PROTECTION_HIGH: DWORD = 0x2; +STRUCT!{struct CRYPTPROTECT_PROMPTSTRUCT { + cbSize: DWORD, + dwPromptFlags: DWORD, + hwndApp: HWND, + szPrompt: LPCWSTR, +}} +pub type PCRYPTPROTECT_PROMPTSTRUCT = *mut CRYPTPROTECT_PROMPTSTRUCT; +pub const CRYPTPROTECT_PROMPT_ON_UNPROTECT: DWORD = 0x1; +pub const CRYPTPROTECT_PROMPT_ON_PROTECT: DWORD = 0x2; +pub const CRYPTPROTECT_PROMPT_RESERVED: DWORD = 0x04; +pub const CRYPTPROTECT_PROMPT_STRONG: DWORD = 0x08; +pub const CRYPTPROTECT_PROMPT_REQUIRE_STRONG: DWORD = 0x10; +pub const CRYPTPROTECT_UI_FORBIDDEN: DWORD = 0x1; +pub const CRYPTPROTECT_LOCAL_MACHINE: DWORD = 0x4; +pub const CRYPTPROTECT_CRED_SYNC: DWORD = 0x8; +pub const CRYPTPROTECT_AUDIT: DWORD = 0x10; +pub const CRYPTPROTECT_NO_RECOVERY: DWORD = 0x20; +pub const CRYPTPROTECT_VERIFY_PROTECTION: DWORD = 0x40; +pub const CRYPTPROTECT_CRED_REGENERATE: DWORD = 0x80; +pub const CRYPTPROTECT_FIRST_RESERVED_FLAGVAL: DWORD = 0x0FFFFFFF; +pub const CRYPTPROTECT_LAST_RESERVED_FLAGVAL: DWORD = 0xFFFFFFFF; +extern "system" { + pub fn CryptProtectData( + pDataIn: *mut DATA_BLOB, + szDataDescr: LPCWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptUnprotectData( + pDataIn: *mut DATA_BLOB, + ppszDataDescr: *mut LPWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptProtectDataNoUI( + pDataIn: *mut DATA_BLOB, + szDataDescr: LPCWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pbOptionalPassword: *const BYTE, + cbOptionalPassword: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptUnprotectDataNoUI( + pDataIn: *mut DATA_BLOB, + ppszDataDescr: *mut LPWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pbOptionalPassword: *const BYTE, + cbOptionalPassword: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptUpdateProtectedState( + pOldSid: PSID, + pwszOldPassword: LPCWSTR, + dwFlags: DWORD, + pdwSuccessCount: *mut DWORD, + pdwFailureCount: *mut DWORD, + ) -> BOOL; +} +pub const CRYPTPROTECTMEMORY_BLOCK_SIZE: DWORD = 16; +pub const CRYPTPROTECTMEMORY_SAME_PROCESS: DWORD = 0x00; +pub const CRYPTPROTECTMEMORY_CROSS_PROCESS: DWORD = 0x01; +pub const CRYPTPROTECTMEMORY_SAME_LOGON: DWORD = 0x02; +extern "system" { + pub fn CryptProtectMemory( + pDataIn: LPVOID, + cbDataIn: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptUnprotectMemory( + pDataIn: LPVOID, + cbDataIn: DWORD, + dwFlags: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/dsgetdc.rs b/src/vendor/winapi/src/um/dsgetdc.rs new file mode 100644 index 0000000000..51132d74c1 --- /dev/null +++ b/src/vendor/winapi/src/um/dsgetdc.rs @@ -0,0 +1,268 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains structures, function prototypes, and definitions for the DsGetDcName API. +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, PULONG, ULONG}; +use shared::ws2def::{LPSOCKET_ADDRESS, PSOCKET_ADDRESS}; +use um::ntsecapi::PLSA_FOREST_TRUST_INFORMATION; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PHANDLE, PSID}; +pub const DS_FORCE_REDISCOVERY: ULONG = 0x00000001; +pub const DS_DIRECTORY_SERVICE_REQUIRED: ULONG = 0x00000010; +pub const DS_DIRECTORY_SERVICE_PREFERRED: ULONG = 0x00000020; +pub const DS_GC_SERVER_REQUIRED: ULONG = 0x00000040; +pub const DS_PDC_REQUIRED: ULONG = 0x00000080; +pub const DS_BACKGROUND_ONLY: ULONG = 0x00000100; +pub const DS_IP_REQUIRED: ULONG = 0x00000200; +pub const DS_KDC_REQUIRED: ULONG = 0x00000400; +pub const DS_TIMESERV_REQUIRED: ULONG = 0x00000800; +pub const DS_WRITABLE_REQUIRED: ULONG = 0x00001000; +pub const DS_GOOD_TIMESERV_PREFERRED: ULONG = 0x00002000; +pub const DS_AVOID_SELF: ULONG = 0x00004000; +pub const DS_ONLY_LDAP_NEEDED: ULONG = 0x00008000; +pub const DS_IS_FLAT_NAME: ULONG = 0x00010000; +pub const DS_IS_DNS_NAME: ULONG = 0x00020000; +pub const DS_TRY_NEXTCLOSEST_SITE: ULONG = 0x00040000; +pub const DS_DIRECTORY_SERVICE_6_REQUIRED: ULONG = 0x00080000; +pub const DS_WEB_SERVICE_REQUIRED: ULONG = 0x00100000; +pub const DS_DIRECTORY_SERVICE_8_REQUIRED: ULONG = 0x00200000; +pub const DS_DIRECTORY_SERVICE_9_REQUIRED: ULONG = 0x00400000; +pub const DS_DIRECTORY_SERVICE_10_REQUIRED: ULONG = 0x00800000; +pub const DS_RETURN_DNS_NAME: ULONG = 0x40000000; +pub const DS_RETURN_FLAT_NAME: ULONG = 0x80000000; +pub const DSGETDC_VALID_FLAGS: ULONG = DS_FORCE_REDISCOVERY | DS_DIRECTORY_SERVICE_REQUIRED + | DS_DIRECTORY_SERVICE_PREFERRED | DS_GC_SERVER_REQUIRED | DS_PDC_REQUIRED | DS_BACKGROUND_ONLY + | DS_IP_REQUIRED | DS_KDC_REQUIRED | DS_TIMESERV_REQUIRED | DS_WRITABLE_REQUIRED + | DS_GOOD_TIMESERV_PREFERRED | DS_AVOID_SELF | DS_ONLY_LDAP_NEEDED | DS_IS_FLAT_NAME + | DS_IS_DNS_NAME | DS_TRY_NEXTCLOSEST_SITE | DS_DIRECTORY_SERVICE_6_REQUIRED + | DS_DIRECTORY_SERVICE_8_REQUIRED | DS_DIRECTORY_SERVICE_9_REQUIRED + | DS_DIRECTORY_SERVICE_10_REQUIRED | DS_WEB_SERVICE_REQUIRED | DS_RETURN_FLAT_NAME + | DS_RETURN_DNS_NAME; +STRUCT!{struct DOMAIN_CONTROLLER_INFOA { + DomainControllerName: LPSTR, + DomainControllerAddress: LPSTR, + DomainControllerAddressType: ULONG, + DomainGuid: GUID, + DomainName: LPSTR, + DnsForestName: LPSTR, + Flags: ULONG, + DcSiteName: LPSTR, + ClientSiteName: LPSTR, +}} +pub type PDOMAIN_CONTROLLER_INFOA = *mut DOMAIN_CONTROLLER_INFOA; +STRUCT!{struct DOMAIN_CONTROLLER_INFOW { + DomainControllerName: LPWSTR, + DomainControllerAddress: LPWSTR, + DomainControllerAddressType: ULONG, + DomainGuid: GUID, + DomainName: LPWSTR, + DnsForestName: LPWSTR, + Flags: ULONG, + DcSiteName: LPWSTR, + ClientSiteName: LPWSTR, +}} +pub type PDOMAIN_CONTROLLER_INFOW = *mut DOMAIN_CONTROLLER_INFOW; +pub const DS_INET_ADDRESS: ULONG = 1; +pub const DS_NETBIOS_ADDRESS: ULONG = 2; +pub const DS_PDC_FLAG: ULONG = 0x00000001; +pub const DS_GC_FLAG: ULONG = 0x00000004; +pub const DS_LDAP_FLAG: ULONG = 0x00000008; +pub const DS_DS_FLAG: ULONG = 0x00000010; +pub const DS_KDC_FLAG: ULONG = 0x00000020; +pub const DS_TIMESERV_FLAG: ULONG = 0x00000040; +pub const DS_CLOSEST_FLAG: ULONG = 0x00000080; +pub const DS_WRITABLE_FLAG: ULONG = 0x00000100; +pub const DS_GOOD_TIMESERV_FLAG: ULONG = 0x00000200; +pub const DS_NDNC_FLAG: ULONG = 0x00000400; +pub const DS_SELECT_SECRET_DOMAIN_6_FLAG: ULONG = 0x00000800; +pub const DS_FULL_SECRET_DOMAIN_6_FLAG: ULONG = 0x00001000; +pub const DS_WS_FLAG: ULONG = 0x00002000; +pub const DS_DS_8_FLAG: ULONG = 0x00004000; +pub const DS_DS_9_FLAG: ULONG = 0x00008000; +pub const DS_DS_10_FLAG: ULONG = 0x00010000; +pub const DS_PING_FLAGS: ULONG = 0x000FFFFF; +pub const DS_DNS_CONTROLLER_FLAG: ULONG = 0x20000000; +pub const DS_DNS_DOMAIN_FLAG: ULONG = 0x40000000; +pub const DS_DNS_FOREST_FLAG: ULONG = 0x80000000; +extern "system" { + pub fn DsGetDcNameA( + ComputerName: LPCSTR, + DomainName: LPCSTR, + DomainGuid: *mut GUID, + SiteName: LPCSTR, + Flags: ULONG, + DomainControllerInfo: *mut PDOMAIN_CONTROLLER_INFOA, + ) -> DWORD; + pub fn DsGetDcNameW( + ComputerName: LPCWSTR, + DomainName: LPCWSTR, + DomainGuid: *mut GUID, + SiteName: LPCWSTR, + Flags: ULONG, + DomainControllerInfo: *mut PDOMAIN_CONTROLLER_INFOW, + ) -> DWORD; + pub fn DsGetSiteNameA( + ComputerName: LPCSTR, + SiteName: *mut LPSTR, + ) -> DWORD; + pub fn DsGetSiteNameW( + ComputerName: LPCWSTR, + SiteName: *mut LPWSTR, + ) -> DWORD; + pub fn DsValidateSubnetNameW( + SubnetName: LPCWSTR, + ) -> DWORD; + pub fn DsValidateSubnetNameA( + SubnetName: LPCSTR, + ) -> DWORD; + pub fn DsAddressToSiteNamesW( + ComputerName: LPCWSTR, + EntryCount: DWORD, + SocketAddresses: PSOCKET_ADDRESS, + SiteNames: *mut *mut LPWSTR, + ) -> DWORD; + pub fn DsAddressToSiteNamesA( + ComputerName: LPCSTR, + EntryCount: DWORD, + SocketAddresses: PSOCKET_ADDRESS, + SiteNames: *mut *mut LPSTR, + ) -> DWORD; + pub fn DsAddressToSiteNamesExW( + ComputerName: LPCWSTR, + EntryCount: DWORD, + SocketAddresses: PSOCKET_ADDRESS, + SiteNames: *mut *mut LPWSTR, + SubnetNames: *mut *mut LPWSTR, + ) -> DWORD; + pub fn DsAddressToSiteNamesExA( + ComputerName: LPCSTR, + EntryCount: DWORD, + SocketAddresses: PSOCKET_ADDRESS, + SiteNames: *mut *mut LPSTR, + SubnetNames: *mut *mut LPSTR, + ) -> DWORD; +} +pub const DS_DOMAIN_IN_FOREST: ULONG = 0x0001; +pub const DS_DOMAIN_DIRECT_OUTBOUND: ULONG = 0x0002; +pub const DS_DOMAIN_TREE_ROOT: ULONG = 0x0004; +pub const DS_DOMAIN_PRIMARY: ULONG = 0x0008; +pub const DS_DOMAIN_NATIVE_MODE: ULONG = 0x0010; +pub const DS_DOMAIN_DIRECT_INBOUND: ULONG = 0x0020; +pub const DS_DOMAIN_VALID_FLAGS: ULONG = DS_DOMAIN_IN_FOREST | DS_DOMAIN_DIRECT_OUTBOUND + | DS_DOMAIN_TREE_ROOT | DS_DOMAIN_PRIMARY | DS_DOMAIN_NATIVE_MODE | DS_DOMAIN_DIRECT_INBOUND; +STRUCT!{struct DS_DOMAIN_TRUSTSW { + NetbiosDomainName: LPWSTR, + DnsDomainName: LPWSTR, + Flags: ULONG, + ParentIndex: ULONG, + TrustType: ULONG, + TrustAttributes: ULONG, + DomainSid: PSID, + DomainGuid: GUID, +}} +pub type PDS_DOMAIN_TRUSTSW = *mut DS_DOMAIN_TRUSTSW; +STRUCT!{struct DS_DOMAIN_TRUSTSA { + NetbiosDomainName: LPSTR, + DnsDomainName: LPSTR, + Flags: ULONG, + ParentIndex: ULONG, + TrustType: ULONG, + TrustAttributes: ULONG, + DomainSid: PSID, + DomainGuid: GUID, +}} +pub type PDS_DOMAIN_TRUSTSA = *mut DS_DOMAIN_TRUSTSA; +extern "system" { + pub fn DsEnumerateDomainTrustsW( + ServerName: LPWSTR, + Flags: ULONG, + Domains: *mut PDS_DOMAIN_TRUSTSW, + DomainCount: PULONG, + ) -> DWORD; + pub fn DsEnumerateDomainTrustsA( + ServerName: LPSTR, + Flags: ULONG, + Domains: *mut PDS_DOMAIN_TRUSTSA, + DomainCount: PULONG, + ) -> DWORD; + pub fn DsGetForestTrustInformationW( + ServerName: LPCWSTR, + TrustedDomainName: LPCWSTR, + Flags: DWORD, + ForestTrustInfo: *mut PLSA_FOREST_TRUST_INFORMATION, + ) -> DWORD; + pub fn DsMergeForestTrustInformationW( + DomainName: LPCWSTR, + NewForestTrustInfo: PLSA_FOREST_TRUST_INFORMATION, + OldForestTrustInfo: PLSA_FOREST_TRUST_INFORMATION, + MergedForestTrustInfo: *mut PLSA_FOREST_TRUST_INFORMATION, + ) -> DWORD; + pub fn DsGetDcSiteCoverageW( + ServerName: LPCWSTR, + EntryCount: PULONG, + SiteNames: *mut *mut LPWSTR, + ) -> DWORD; + pub fn DsGetDcSiteCoverageA( + ServerName: LPCSTR, + EntryCount: PULONG, + SiteNames: *mut *mut LPSTR, + ) -> DWORD; + pub fn DsDeregisterDnsHostRecordsW( + ServerName: LPWSTR, + DnsDomainName: LPWSTR, + DomainGuid: *mut GUID, + DsaGuid: *mut GUID, + DnsHostName: LPWSTR, + ) -> DWORD; + pub fn DsDeregisterDnsHostRecordsA( + ServerName: LPSTR, + DnsDomainName: LPSTR, + DomainGuid: *mut GUID, + DsaGuid: *mut GUID, + DnsHostName: LPSTR, + ) -> DWORD; +} +pub const DS_ONLY_DO_SITE_NAME: ULONG = 0x01; +pub const DS_NOTIFY_AFTER_SITE_RECORDS: ULONG = 0x02; +pub const DS_OPEN_VALID_OPTION_FLAGS: ULONG = DS_ONLY_DO_SITE_NAME + | DS_NOTIFY_AFTER_SITE_RECORDS; +pub const DS_OPEN_VALID_FLAGS: ULONG = DS_FORCE_REDISCOVERY | DS_ONLY_LDAP_NEEDED + | DS_KDC_REQUIRED | DS_PDC_REQUIRED | DS_GC_SERVER_REQUIRED | DS_WRITABLE_REQUIRED; +extern "system" { + pub fn DsGetDcOpenW( + DnsName: LPCWSTR, + OptionFlags: ULONG, + SiteName: LPCWSTR, + DomainGuid: *mut GUID, + DnsForestName: LPCWSTR, + DcFlags: ULONG, + RetGetDcContext: PHANDLE, + ) -> DWORD; + pub fn DsGetDcOpenA( + DnsName: LPCSTR, + OptionFlags: ULONG, + SiteName: LPCSTR, + DomainGuid: *mut GUID, + DnsForestName: LPCSTR, + DcFlags: ULONG, + RetGetDcContext: PHANDLE, + ) -> DWORD; + pub fn DsGetDcNextA( + GetDcContextHandle: HANDLE, + SockAddressCount: PULONG, + SockAddresses: *mut LPSOCKET_ADDRESS, + DnsHostName: *mut LPSTR, + ) -> DWORD; + pub fn DsGetDcNextW( + GetDcContextHandle: HANDLE, + SockAddressCount: PULONG, + SockAddresses: *mut LPSOCKET_ADDRESS, + DnsHostName: *mut LPWSTR, + ) -> DWORD; + pub fn DsGetDcCloseW( + GetDcContextHandle: HANDLE, + ); +} diff --git a/src/vendor/winapi/src/um/dsound.rs b/src/vendor/winapi/src/um/dsound.rs new file mode 100644 index 0000000000..ead3b2c626 --- /dev/null +++ b/src/vendor/winapi/src/um/dsound.rs @@ -0,0 +1,345 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! DSound procedure declarations, constant definitions and macros +use shared::guiddef::{GUID, LPCGUID, LPGUID}; +use shared::minwindef::{DWORD, LPDWORD, LPLONG, LPVOID}; +use shared::windef::HWND; +use shared::winerror::{E_FAIL, S_OK}; +use um::mmsystem::{LPCWAVEFORMATEX, LPWAVEFORMATEX}; +use um::unknwnbase::{IUnknown, IUnknownVtbl, LPUNKNOWN}; +use um::winnt::{HRESULT, LONG}; +DEFINE_GUID!{CLSID_DirectSound, + 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} +DEFINE_GUID!{CLSID_DirectSound8, + 0x3901cc3f, 0x84b5, 0x4fa4, 0xba, 0x35, 0xaa, 0x81, 0x72, 0xb8, 0xa0, 0x9b} +DEFINE_GUID!{CLSID_DirectSoundCapture, + 0xb0210780, 0x89cd, 0x11d0, 0xaf, 0x08, 0x00, 0xa0, 0xc9, 0x25, 0xcd, 0x16} +DEFINE_GUID!{CLSID_DirectSoundCapture8, + 0xe4bcac13, 0x7f99, 0x4908, 0x9a, 0x8e, 0x74, 0xe3, 0xbf, 0x24, 0xb6, 0xe1} +DEFINE_GUID!{CLSID_DirectSoundFullDuplex, + 0xfea4300c, 0x7959, 0x4147, 0xb2, 0x6a, 0x23, 0x77, 0xb9, 0xe7, 0xa9, 0x1d} +DEFINE_GUID!{DSDEVID_DefaultPlayback, + 0xdef00000, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03} +DEFINE_GUID!{DSDEVID_DefaultCapture, + 0xdef00001, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03} +DEFINE_GUID!{DSDEVID_DefaultVoicePlayback, + 0xdef00002, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03} +DEFINE_GUID!{DSDEVID_DefaultVoiceCapture, + 0xdef00003, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03} +STRUCT!{struct DSCAPS { + dwSize: DWORD, + dwFlags: DWORD, + dwMinSecondarySampleRate: DWORD, + dwMaxSecondarySampleRate: DWORD, + dwPrimaryBuffers: DWORD, + dwMaxHwMixingAllBuffers: DWORD, + dwMaxHwMixingStaticBuffers: DWORD, + dwMaxHwMixingStreamingBuffers: DWORD, + dwFreeHwMixingAllBuffers: DWORD, + dwFreeHwMixingStaticBuffers: DWORD, + dwFreeHwMixingStreamingBuffers: DWORD, + dwMaxHw3DAllBuffers: DWORD, + dwMaxHw3DStaticBuffers: DWORD, + dwMaxHw3DStreamingBuffers: DWORD, + dwFreeHw3DAllBuffers: DWORD, + dwFreeHw3DStaticBuffers: DWORD, + dwFreeHw3DStreamingBuffers: DWORD, + dwTotalHwMemBytes: DWORD, + dwFreeHwMemBytes: DWORD, + dwMaxContigFreeHwMemBytes: DWORD, + dwUnlockTransferRateHwBuffers: DWORD, + dwPlayCpuOverheadSwBuffers: DWORD, + dwReserved1: DWORD, + dwReserved2: DWORD, +}} +pub type LPDSCAPS = *mut DSCAPS; +STRUCT!{struct DSBCAPS { + dwSize: DWORD, + dwFlags: DWORD, + dwBufferBytes: DWORD, + dwUnlockTransferRate: DWORD, + dwPlayCpuOverhead: DWORD, +}} +pub type LPDSBCAPS = *mut DSBCAPS; +STRUCT!{struct DSBUFFERDESC { + dwSize: DWORD, + dwFlags: DWORD, + dwBufferBytes: DWORD, + dwReserved: DWORD, + lpwfxFormat: LPWAVEFORMATEX, + guid3DAlgorithm: GUID, +}} +pub type LPCDSBUFFERDESC = *const DSBUFFERDESC; +RIDL!(#[uuid(0x279afa85, 0x4981, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60)] +interface IDirectSoundBuffer(IDirectSoundBufferVtbl): IUnknown(IUnknownVtbl) { + fn GetCaps( + pDSBufferCaps: LPDSBCAPS, + ) -> HRESULT, + fn GetCurrentPosition( + pdwCurrentPlayCursor: LPDWORD, + pdwCurrentWriteCursor: LPDWORD, + ) -> HRESULT, + fn GetFormat( + pwfxFormat: LPWAVEFORMATEX, + dwSizeAllocated: DWORD, + pdwSizeWritten: LPDWORD, + ) -> HRESULT, + fn GetVolume( + plVolume: LPLONG, + ) -> HRESULT, + fn GetPan( + plPan: LPLONG, + ) -> HRESULT, + fn GetFrequency( + pdwFrequency: LPDWORD, + ) -> HRESULT, + fn GetStatus( + pdwStatus: LPDWORD, + ) -> HRESULT, + fn Initialize( + pDirectSound: LPDIRECTSOUND, + pcDSBufferDesc: LPCDSBUFFERDESC, + ) -> HRESULT, + fn Lock( + dwOffset: DWORD, + dwBytes: DWORD, + ppvAudioPtr1: *mut LPVOID, + pdwAudioBytes1: LPDWORD, + ppvAudioPtr2: *mut LPVOID, + pdwAudioBytes2: LPDWORD, + dwFlags: DWORD, + ) -> HRESULT, + fn Play( + dwReserved1: DWORD, + dwPriority: DWORD, + dwFlags: DWORD, + ) -> HRESULT, + fn SetCurrentPosition( + dwNewPosition: DWORD, + ) -> HRESULT, + fn SetFormat( + pcfxFormat: LPCWAVEFORMATEX, + ) -> HRESULT, + fn SetVolume( + lVolume: LONG, + ) -> HRESULT, + fn SetPan( + lPan: LONG, + ) -> HRESULT, + fn SetFrequency( + dwFrequency: DWORD, + ) -> HRESULT, + fn Stop() -> HRESULT, + fn Unlock( + pvAudioPtr1: LPVOID, + dwAudioBytes1: DWORD, + pvAudioPtr2: LPVOID, + dwAudioBytes2: DWORD, + ) -> HRESULT, + fn Restore() -> HRESULT, +} +); +pub type LPDIRECTSOUNDBUFFER = *mut IDirectSoundBuffer; +DEFINE_GUID!{IID_IReferenceClock, + 0x56a86897, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} +DEFINE_GUID!{IID_IDirectSound, + 0x279afa83, 0x4981, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +RIDL!(#[uuid(0x279afa83, 0x4981, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60)] +interface IDirectSound(IDirectSoundVtbl): IUnknown(IUnknownVtbl) { + fn CreateSoundBuffer( + pcDSBufferDesc: LPCDSBUFFERDESC, + ppDSBuffer: *mut LPDIRECTSOUNDBUFFER, + pUnkOuter: LPUNKNOWN, + ) -> HRESULT, + fn GetCaps( + pDSCaps: LPDSCAPS, + ) -> HRESULT, + fn DuplicateSoundBuffer( + pDSBufferOriginal: LPDIRECTSOUNDBUFFER, + ppDSBufferDuplicate: *mut LPDIRECTSOUNDBUFFER, + ) -> HRESULT, + fn SetCooperativeLevel( + hWnd: HWND, + dwLevel: DWORD, + ) -> HRESULT, + fn Compact() -> HRESULT, + fn GetSpeakerConfig( + pdwSpeakerConfig: LPDWORD, + ) -> HRESULT, + fn SetSpeakerConfig( + dwSpeakerConfig: DWORD, + ) -> HRESULT, + fn Initialize( + pcGuidDevice: LPCGUID, + ) -> HRESULT, +} +); +pub type LPDIRECTSOUND = *mut IDirectSound; +DEFINE_GUID!{IID_IDirectSound8, + 0xc50a7e93, 0xf395, 0x4834, 0x9e, 0xf6, 0x7f, 0xa9, 0x9d, 0xe5, 0x09, 0x66} +DEFINE_GUID!{IID_IDirectSoundBuffer, + 0x279afa85, 0x4981, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectSoundBuffer8, + 0x6825a449, 0x7524, 0x4d82, 0x92, 0x0f, 0x50, 0xe3, 0x6a, 0xb3, 0xab, 0x1e} +DEFINE_GUID!{GUID_All_Objects, + 0xaa114de5, 0xc262, 0x4169, 0xa1, 0xc8, 0x23, 0xd6, 0x98, 0xcc, 0x73, 0xb5} +DEFINE_GUID!{IID_IDirectSound3DListener, + 0x279afa84, 0x4981, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectSound3DBuffer, + 0x279afa86, 0x4981, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectSoundCapture, + 0xb0210781, 0x89cd, 0x11d0, 0xaf, 0x08, 0x00, 0xa0, 0xc9, 0x25, 0xcd, 0x16} +DEFINE_GUID!{IID_IDirectSoundCaptureBuffer, + 0xb0210782, 0x89cd, 0x11d0, 0xaf, 0x08, 0x00, 0xa0, 0xc9, 0x25, 0xcd, 0x16} +DEFINE_GUID!{IID_IDirectSoundCaptureBuffer8, + 0x00990df4, 0x0dbb, 0x4872, 0x83, 0x3e, 0x6d, 0x30, 0x3e, 0x80, 0xae, 0xb6} +DEFINE_GUID!{IID_IDirectSoundNotify, + 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x08, 0x00, 0xa0, 0xc9, 0x25, 0xcd, 0x16} +DEFINE_GUID!{IID_IKsPropertySet, + 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93} +DEFINE_GUID!{IID_IDirectSoundFXGargle, + 0xd616f352, 0xd622, 0x11ce, 0xaa, 0xc5, 0x00, 0x20, 0xaf, 0x0b, 0x99, 0xa3} +DEFINE_GUID!{IID_IDirectSoundFXChorus, + 0x880842e3, 0x145f, 0x43e6, 0xa9, 0x34, 0xa7, 0x18, 0x06, 0xe5, 0x05, 0x47} +DEFINE_GUID!{IID_IDirectSoundFXFlanger, + 0x903e9878, 0x2c92, 0x4072, 0x9b, 0x2c, 0xea, 0x68, 0xf5, 0x39, 0x67, 0x83} +DEFINE_GUID!{IID_IDirectSoundFXEcho, + 0x8bd28edf, 0x50db, 0x4e92, 0xa2, 0xbd, 0x44, 0x54, 0x88, 0xd1, 0xed, 0x42} +DEFINE_GUID!{IID_IDirectSoundFXDistortion, + 0x8ecf4326, 0x455f, 0x4d8b, 0xbd, 0xa9, 0x8d, 0x5d, 0x3e, 0x9e, 0x3e, 0x0b} +DEFINE_GUID!{IID_IDirectSoundFXCompressor, + 0x4bbd1154, 0x62f6, 0x4e2c, 0xa1, 0x5c, 0xd3, 0xb6, 0xc4, 0x17, 0xf7, 0xa0} +DEFINE_GUID!{IID_IDirectSoundFXParamEq, + 0xc03ca9fe, 0xfe90, 0x4204, 0x80, 0x78, 0x82, 0x33, 0x4c, 0xd1, 0x77, 0xda} +DEFINE_GUID!{IID_IDirectSoundFXI3DL2Reverb, + 0x4b166a6a, 0x0d66, 0x43f3, 0x80, 0xe3, 0xee, 0x62, 0x80, 0xde, 0xe1, 0xa4} +DEFINE_GUID!{IID_IDirectSoundFXWavesReverb, + 0x46858c3a, 0x0dc6, 0x45e3, 0xb7, 0x60, 0xd4, 0xee, 0xf1, 0x6c, 0xb3, 0x25} +DEFINE_GUID!{IID_IDirectSoundCaptureFXAec, + 0xad74143d, 0x903d, 0x4ab7, 0x80, 0x66, 0x28, 0xd3, 0x63, 0x03, 0x6d, 0x65} +DEFINE_GUID!{IID_IDirectSoundCaptureFXNoiseSuppress, + 0xed311e41, 0xfbae, 0x4175, 0x96, 0x25, 0xcd, 0x08, 0x54, 0xf6, 0x93, 0xca} +DEFINE_GUID!{IID_IDirectSoundFullDuplex, + 0xedcb4c7a, 0xdaab, 0x4216, 0xa4, 0x2e, 0x6c, 0x50, 0x59, 0x6d, 0xdc, 0x1d} +pub const DS_OK: HRESULT = S_OK; +pub const DSERR_GENERIC: HRESULT = E_FAIL; +pub const DSSCL_NORMAL: DWORD = 0x00000001; +pub const DSSCL_PRIORITY: DWORD = 0x00000002; +pub const DSSCL_EXCLUSIVE: DWORD = 0x00000003; +pub const DSSCL_WRITEPRIMARY: DWORD = 0x00000004; +pub const DSBCAPS_PRIMARYBUFFER: DWORD = 0x00000001; +pub const DSBCAPS_STATIC: DWORD = 0x00000002; +pub const DSBCAPS_LOCHARDWARE: DWORD = 0x00000004; +pub const DSBCAPS_LOCSOFTWARE: DWORD = 0x00000008; +pub const DSBCAPS_CTRL3D: DWORD = 0x00000010; +pub const DSBCAPS_CTRLFREQUENCY: DWORD = 0x00000020; +pub const DSBCAPS_CTRLPAN: DWORD = 0x00000040; +pub const DSBCAPS_CTRLVOLUME: DWORD = 0x00000080; +pub const DSBCAPS_CTRLPOSITIONNOTIFY: DWORD = 0x00000100; +pub const DSBCAPS_CTRLFX: DWORD = 0x00000200; +pub const DSBCAPS_STICKYFOCUS: DWORD = 0x00004000; +pub const DSBCAPS_GLOBALFOCUS: DWORD = 0x00008000; +pub const DSBCAPS_GETCURRENTPOSITION2: DWORD = 0x00010000; +pub const DSBCAPS_MUTE3DATMAXDISTANCE: DWORD = 0x00020000; +pub const DSBCAPS_LOCDEFER: DWORD = 0x00040000; +pub const DSBCAPS_TRUEPLAYPOSITION: DWORD = 0x00080000; +pub const DSBPLAY_LOOPING: DWORD = 0x00000001; +pub const DSBPLAY_LOCHARDWARE: DWORD = 0x00000002; +pub const DSBPLAY_LOCSOFTWARE: DWORD = 0x00000004; +pub const DSBPLAY_TERMINATEBY_TIME: DWORD = 0x00000008; +pub const DSBPLAY_TERMINATEBY_DISTANCE: DWORD = 0x000000010; +pub const DSBPLAY_TERMINATEBY_PRIORITY: DWORD = 0x000000020; +extern "system" { + pub fn DirectSoundCreate( + pcGuidDevice: LPCGUID, + ppDS: *mut LPDIRECTSOUND, + pUnkOuter: LPUNKNOWN, + ) -> HRESULT; + // pub fn DirectSoundEnumerateA( + // pDSEnumCallback: LPDSENUMCALLBACKA, + // pContext: LPVOID, + // ) -> HRESULT; + // pub fn DirectSoundEnumerateW( + // pDSEnumCallback: LPDSENUMCALLBACKW, + // pContext: LPVOID, + // ) -> HRESULT; + // pub fn DirectSoundCaptureCreate( + // pcGuidDevice: LPCGUID, + // ppDSC: *mut LPDIRECTSOUNDCAPTURE, + // pUnkOuter: LPUNKNOWN, + // ) -> HRESULT; + // pub fn DirectSoundCaptureEnumerateA( + // pDSEnumCallback: LPDSENUMCALLBACKA, + // pContext: LPVOID, + // ) -> HRESULT; + // pub fn DirectSoundCaptureEnumerateW( + // pDSEnumCallback: LPDSENUMCALLBACKW, + // pContext: LPVOID, + // ) -> HRESULT; + // pub fn DirectSoundCreate8( + // pcGuidDevice: LPCGUID, + // ppDS8: *mut LPDIRECTSOUND8, + // pUnkOuter: LPUNKNOWN, + // ) -> HRESULT; + // pub fn DirectSoundCaptureCreate8( + // pcGuidDevice: LPCGUID, + // ppDSC8: *mut LPDIRECTSOUNDCAPTURE8, + // pUnkOuter: LPUNKNOWN, + // ) -> HRESULT; + // pub fn DirectSoundFullDuplexCreate( + // pcGuidCaptureDevice: LPCGUID, + // pcGuidRenderDevice: LPCGUID, + // pcDSCBufferDesc: LPCDSCBUFFERDESC, + // pcDSBufferDesc: LPCDSBUFFERDESC, + // hWnd: HWND, + // dwLevel: DWORD, + // ppDSFD: *mut LPDIRECTSOUNDFULLDUPLEX, + // ppDSCBuffer8: *mut LPDIRECTSOUNDCAPTUREBUFFER8, + // ppDSBuffer8: *mut LPDIRECTSOUNDBUFFER8, + // pUnkOuter: LPUNKNOWN, + // ) -> HRESULT; + pub fn GetDeviceID( + pGuidSrc: LPCGUID, + pGuidDest: LPGUID, + ) -> HRESULT; +} +DEFINE_GUID!{DS3DALG_NO_VIRTUALIZATION, + 0xc241333f, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x00, 0xc0, 0x4f, 0xc2, 0x8a, 0xca} +DEFINE_GUID!{DS3DALG_HRTF_FULL, + 0xc2413340, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x00, 0xc0, 0x4f, 0xc2, 0x8a, 0xca} +DEFINE_GUID!{DS3DALG_HRTF_LIGHT, + 0xc2413342, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x00, 0xc0, 0x4f, 0xc2, 0x8a, 0xca} +DEFINE_GUID!{GUID_DSFX_STANDARD_GARGLE, + 0xdafd8210, 0x5711, 0x4b91, 0x9f, 0xe3, 0xf7, 0x5b, 0x7a, 0xe2, 0x79, 0xbf} +DEFINE_GUID!{GUID_DSFX_STANDARD_CHORUS, + 0xefe6629c, 0x81f7, 0x4281, 0xbd, 0x91, 0xc9, 0xd6, 0x04, 0xa9, 0x5a, 0xf6} +DEFINE_GUID!{GUID_DSFX_STANDARD_FLANGER, + 0xefca3d92, 0xdfd8, 0x4672, 0xa6, 0x03, 0x74, 0x20, 0x89, 0x4b, 0xad, 0x98} +DEFINE_GUID!{GUID_DSFX_STANDARD_ECHO, + 0xef3e932c, 0xd40b, 0x4f51, 0x8c, 0xcf, 0x3f, 0x98, 0xf1, 0xb2, 0x9d, 0x5d} +DEFINE_GUID!{GUID_DSFX_STANDARD_DISTORTION, + 0xef114c90, 0xcd1d, 0x484e, 0x96, 0xe5, 0x09, 0xcf, 0xaf, 0x91, 0x2a, 0x21} +DEFINE_GUID!{GUID_DSFX_STANDARD_COMPRESSOR, + 0xef011f79, 0x4000, 0x406d, 0x87, 0xaf, 0xbf, 0xfb, 0x3f, 0xc3, 0x9d, 0x57} +DEFINE_GUID!{GUID_DSFX_STANDARD_PARAMEQ, + 0x120ced89, 0x3bf4, 0x4173, 0xa1, 0x32, 0x3c, 0xb4, 0x06, 0xcf, 0x32, 0x31} +DEFINE_GUID!{GUID_DSFX_STANDARD_I3DL2REVERB, + 0xef985e71, 0xd5c7, 0x42d4, 0xba, 0x4d, 0x2d, 0x07, 0x3e, 0x2e, 0x96, 0xf4} +DEFINE_GUID!{GUID_DSFX_WAVES_REVERB, + 0x87fc0268, 0x9a55, 0x4360, 0x95, 0xaa, 0x00, 0x4a, 0x1d, 0x9d, 0xe2, 0x6c} +DEFINE_GUID!{GUID_DSCFX_CLASS_AEC, + 0xbf963d80, 0xc559, 0x11d0, 0x8a, 0x2b, 0x00, 0xa0, 0xc9, 0x25, 0x5a, 0xc1} +DEFINE_GUID!{GUID_DSCFX_MS_AEC, + 0xcdebb919, 0x379a, 0x488a, 0x87, 0x65, 0xf5, 0x3c, 0xfd, 0x36, 0xde, 0x40} +DEFINE_GUID!{GUID_DSCFX_SYSTEM_AEC, + 0x1c22c56d, 0x9879, 0x4f5b, 0xa3, 0x89, 0x27, 0x99, 0x6d, 0xdc, 0x28, 0x10} +DEFINE_GUID!{GUID_DSCFX_CLASS_NS, + 0xe07f903f, 0x62fd, 0x4e60, 0x8c, 0xdd, 0xde, 0xa7, 0x23, 0x66, 0x65, 0xb5} +DEFINE_GUID!{GUID_DSCFX_MS_NS, + 0x11c5c73b, 0x66e9, 0x4ba1, 0xa0, 0xba, 0xe8, 0x14, 0xc6, 0xee, 0xd9, 0x2d} +DEFINE_GUID!{GUID_DSCFX_SYSTEM_NS, + 0x5ab0882e, 0x7274, 0x4516, 0x87, 0x7d, 0x4e, 0xee, 0x99, 0xba, 0x4f, 0xd0} diff --git a/src/vendor/winapi/src/um/dsrole.rs b/src/vendor/winapi/src/um/dsrole.rs new file mode 100644 index 0000000000..855d2a454d --- /dev/null +++ b/src/vendor/winapi/src/um/dsrole.rs @@ -0,0 +1,67 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Contains public interfaces to query the network roles of workstations, servers, and DCs +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, PBYTE, ULONG}; +use um::winnt::{LPCWSTR, LPWSTR, PVOID}; +ENUM!{enum DSROLE_MACHINE_ROLE { + DsRole_RoleStandaloneWorkstation, + DsRole_RoleMemberWorkstation, + DsRole_RoleStandaloneServer, + DsRole_RoleMemberServer, + DsRole_RoleBackupDomainController, + DsRole_RolePrimaryDomainController, +}} +ENUM!{enum DSROLE_SERVER_STATE { + DsRoleServerUnknown = 0, + DsRoleServerPrimary, + DsRoleServerBackup, +}} +pub type PDSROLE_SERVER_STATE = *mut DSROLE_SERVER_STATE; +ENUM!{enum DSROLE_PRIMARY_DOMAIN_INFO_LEVEL { + DsRolePrimaryDomainInfoBasic = 1, + DsRoleUpgradeStatus, + DsRoleOperationState, +}} +pub const DSROLE_PRIMARY_DS_RUNNING: ULONG = 0x00000001; +pub const DSROLE_PRIMARY_DS_MIXED_MODE: ULONG = 0x00000002; +pub const DSROLE_UPGRADE_IN_PROGRESS: ULONG = 0x00000004; +pub const DSROLE_PRIMARY_DS_READONLY: ULONG = 0x00000008; +pub const DSROLE_PRIMARY_DOMAIN_GUID_PRESENT: ULONG = 0x01000000; +STRUCT!{struct DSROLE_PRIMARY_DOMAIN_INFO_BASIC { + MachineRole: DSROLE_MACHINE_ROLE, + Flags: ULONG, + DomainNameFlat: LPWSTR, + DomainNameDns: LPWSTR, + DomainForestName: LPWSTR, + DomainGuid: GUID, +}} +pub type PDSROLE_PRIMARY_DOMAIN_INFO_BASIC = *mut DSROLE_PRIMARY_DOMAIN_INFO_BASIC; +STRUCT!{struct DSROLE_UPGRADE_STATUS_INFO { + OperationState: ULONG, + PreviousServerState: DSROLE_SERVER_STATE, +}} +pub type PDSROLE_UPGRADE_STATUS_INFO = *mut DSROLE_UPGRADE_STATUS_INFO; +ENUM!{enum DSROLE_OPERATION_STATE { + DsRoleOperationIdle = 0, + DsRoleOperationActive, + DsRoleOperationNeedReboot, +}} +STRUCT!{struct DSROLE_OPERATION_STATE_INFO { + OperationState: DSROLE_OPERATION_STATE, +}} +pub type PDSROLE_OPERATION_STATE_INFO = *mut DSROLE_OPERATION_STATE_INFO; +extern "system" { + pub fn DsRoleGetPrimaryDomainInformation( + lpServer: LPCWSTR, + InfoLevel: DSROLE_PRIMARY_DOMAIN_INFO_LEVEL, + Buffer: *mut PBYTE, + ) -> DWORD; + pub fn DsRoleFreeMemory( + Buffer: PVOID, + ); +} diff --git a/src/vendor/winapi/src/um/dvp.rs b/src/vendor/winapi/src/um/dvp.rs new file mode 100644 index 0000000000..b5d126dc73 --- /dev/null +++ b/src/vendor/winapi/src/um/dvp.rs @@ -0,0 +1,26 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_IDDVideoPortContainer, + 0x6c142760, 0xa733, 0x11ce, 0xa5, 0x21, 0x00, 0x20, 0xaf, 0x0b, 0xe5, 0x60} +DEFINE_GUID!{IID_IDirectDrawVideoPort, + 0xb36d93e0, 0x2b43, 0x11cf, 0xa2, 0xde, 0x00, 0xaa, 0x00, 0xb9, 0x33, 0x56} +DEFINE_GUID!{IID_IDirectDrawVideoPortNotify, + 0xa655fb94, 0x0589, 0x4e57, 0xb3, 0x33, 0x56, 0x7a, 0x89, 0x46, 0x8c, 0x88} +DEFINE_GUID!{DDVPTYPE_E_HREFH_VREFH, + 0x54f39980, 0xda60, 0x11cf, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{DDVPTYPE_E_HREFH_VREFL, + 0x92783220, 0xda60, 0x11cf, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{DDVPTYPE_E_HREFL_VREFH, + 0xa07a02e0, 0xda60, 0x11cf, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{DDVPTYPE_E_HREFL_VREFL, + 0xe09c77e0, 0xda60, 0x11cf, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{DDVPTYPE_CCIR656, + 0xfca326a0, 0xda60, 0x11cf, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{DDVPTYPE_BROOKTREE, + 0x1352a560, 0xda61, 0x11cf, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} +DEFINE_GUID!{DDVPTYPE_PHILIPS, + 0x332cf160, 0xda61, 0x11cf, 0x9b, 0x06, 0x00, 0xa0, 0xc9, 0x03, 0xa3, 0xb8} diff --git a/src/vendor/winapi/src/um/dwmapi.rs b/src/vendor/winapi/src/um/dwmapi.rs new file mode 100644 index 0000000000..1f4314ce50 --- /dev/null +++ b/src/vendor/winapi/src/um/dwmapi.rs @@ -0,0 +1,72 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Procedure declarations, constant definitions, and macros for the NLS component. +use shared::minwindef::{BOOL, DWORD, HRGN, LPVOID}; +use shared::windef::HWND; +use um::winnt::HRESULT; +STRUCT!{struct DWM_BLURBEHIND { + dwFlags: DWORD, + fEnable: BOOL, + hRgnBlur: HRGN, + fTransitionOnMaximized: BOOL, +}} +pub const DWMWA_NCRENDERING_ENABLED: DWORD = 1; +pub const DWMWA_NCRENDERING_POLICY: DWORD = 2; +pub const DWMWA_TRANSITIONS_FORCEDISABLED: DWORD = 2; +pub const DWMWA_ALLOW_NCPAINT: DWORD = 4; +pub const DWMWA_CAPTION_BUTTON_BOUNDS: DWORD = 5; +pub const DWMWA_NONCLIENT_RTL_LAYOUT: DWORD = 6; +pub const DWMWA_FORCE_ICONIC_REPRESENTATION: DWORD = 7; +pub const DWMWA_FLIP3D_POLICY: DWORD = 8; +pub const DWMWA_EXTENDED_FRAME_BOUNDS: DWORD = 9; +pub const DWMWA_HAS_ICONIC_BITMAP: DWORD = 10; +pub const DWMWA_DISALLOW_PEEK: DWORD = 11; +pub const DWMWA_EXCLUDED_FROM_PEEK: DWORD = 12; +pub const DWMWA_CLOAK: DWORD = 13; +pub const DWMWA_CLOAKED: DWORD = 14; +pub const DWMWA_FREEZE_REPRESENTATION: DWORD = 15; +pub const DWMWA_LAST: DWORD = 16; +extern "system" { + // pub fn DwmDefWindowProc(); + pub fn DwmEnableBlurBehindWindow( + hWnd: HWND, + pBlurBehind: *const DWM_BLURBEHIND, + ) -> HRESULT; + // pub fn DwmEnableComposition(); + // pub fn DwmEnableMMCSS(); + // pub fn DwmExtendFrameIntoClientArea(); + // pub fn DwmGetColorizationColor(); + // pub fn DwmGetCompositionTimingInfo(); + pub fn DwmGetWindowAttribute( + hWnd: HWND, + dwAttribute: DWORD, + pvAttribute: LPVOID, + cbAttribute: DWORD, + ) -> HRESULT; + // pub fn DwmIsCompositionEnabled(); + // pub fn DwmModifyPreviousDxFrameDuration(); + // pub fn DwmQueryThumbnailSourceSize(); + // pub fn DwmRegisterThumbnail(); + // pub fn DwmSetDxFrameDuration(); + // pub fn DwmSetPresentParameters(); + // pub fn DwmSetWindowAttribute(); + // pub fn DwmUnregisterThumbnail(); + // pub fn DwmUpdateThumbnailProperties(); + // pub fn DwmSetIconicThumbnail(); + // pub fn DwmSetIconicLivePreviewBitmap(); + // pub fn DwmInvalidateIconicBitmaps(); + // pub fn DwmAttachMilContent(); + // pub fn DwmDetachMilContent(); + // pub fn DwmFlush(); + // pub fn DwmGetGraphicsStreamTransformHint(); + // pub fn DwmGetGraphicsStreamClient(); + // pub fn DwmGetTransportAttributes(); + // pub fn DwmTransitionOwnedWindow(); + // pub fn DwmRenderGesture(); + // pub fn DwmTetherContact(); + // pub fn DwmShowContact(); +} diff --git a/src/vendor/winapi/src/um/dwrite.rs b/src/vendor/winapi/src/um/dwrite.rs new file mode 100644 index 0000000000..25fc62a91a --- /dev/null +++ b/src/vendor/winapi/src/um/dwrite.rs @@ -0,0 +1,1478 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! DirectX Typography Services public API definitions. +use ctypes::c_void; +use shared::basetsd::{INT16, INT32, UINT16, UINT32, UINT64, UINT8}; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, BYTE, FILETIME, FLOAT}; +use shared::windef::{COLORREF, HDC, HMONITOR, RECT, SIZE}; +use shared::winerror::SEVERITY_ERROR; +use um::d2d1::ID2D1SimplifiedGeometrySink; +use um::dcommon::DWRITE_MEASURING_MODE; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::wingdi::LOGFONTW; +use um::winnt::{HRESULT, WCHAR}; +ENUM!{enum DWRITE_FONT_FILE_TYPE { + DWRITE_FONT_FILE_TYPE_UNKNOWN, + DWRITE_FONT_FILE_TYPE_CFF, + DWRITE_FONT_FILE_TYPE_TRUETYPE, + DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION, + DWRITE_FONT_FILE_TYPE_TYPE1_PFM, + DWRITE_FONT_FILE_TYPE_TYPE1_PFB, + DWRITE_FONT_FILE_TYPE_VECTOR, + DWRITE_FONT_FILE_TYPE_BITMAP, + DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION, +}} +ENUM!{enum DWRITE_FONT_FACE_TYPE { + DWRITE_FONT_FACE_TYPE_CFF, + DWRITE_FONT_FACE_TYPE_TRUETYPE, + DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION, + DWRITE_FONT_FACE_TYPE_TYPE1, + DWRITE_FONT_FACE_TYPE_VECTOR, + DWRITE_FONT_FACE_TYPE_BITMAP, + DWRITE_FONT_FACE_TYPE_UNKNOWN, + DWRITE_FONT_FACE_TYPE_RAW_CFF, + DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION, +}} +ENUM!{enum DWRITE_FONT_SIMULATIONS { + DWRITE_FONT_SIMULATIONS_NONE = 0x0000, + DWRITE_FONT_SIMULATIONS_BOLD = 0x0001, + DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002, +}} +ENUM!{enum DWRITE_FONT_WEIGHT { + DWRITE_FONT_WEIGHT_THIN = 100, + DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200, + DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200, + DWRITE_FONT_WEIGHT_LIGHT = 300, + DWRITE_FONT_WEIGHT_SEMI_LIGHT = 350, + DWRITE_FONT_WEIGHT_NORMAL = 400, + DWRITE_FONT_WEIGHT_REGULAR = 400, + DWRITE_FONT_WEIGHT_MEDIUM = 500, + DWRITE_FONT_WEIGHT_DEMI_BOLD = 600, + DWRITE_FONT_WEIGHT_SEMI_BOLD = 600, + DWRITE_FONT_WEIGHT_BOLD = 700, + DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800, + DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800, + DWRITE_FONT_WEIGHT_BLACK = 900, + DWRITE_FONT_WEIGHT_HEAVY = 900, + DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950, + DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950, +}} +ENUM!{enum DWRITE_FONT_STRETCH { + DWRITE_FONT_STRETCH_UNDEFINED = 0, + DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1, + DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2, + DWRITE_FONT_STRETCH_CONDENSED = 3, + DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4, + DWRITE_FONT_STRETCH_NORMAL = 5, + DWRITE_FONT_STRETCH_MEDIUM = 5, + DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6, + DWRITE_FONT_STRETCH_EXPANDED = 7, + DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8, + DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9, +}} +ENUM!{enum DWRITE_FONT_STYLE { + DWRITE_FONT_STYLE_NORMAL, + DWRITE_FONT_STYLE_OBLIQUE, + DWRITE_FONT_STYLE_ITALIC, +}} +ENUM!{enum DWRITE_INFORMATIONAL_STRING_ID { + DWRITE_INFORMATIONAL_STRING_NONE, + DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, + DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, + DWRITE_INFORMATIONAL_STRING_TRADEMARK, + DWRITE_INFORMATIONAL_STRING_MANUFACTURER, + DWRITE_INFORMATIONAL_STRING_DESIGNER, + DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, + DWRITE_INFORMATIONAL_STRING_DESCRIPTION, + DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, + DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, + DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, + DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, + DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT, + DWRITE_INFORMATIONAL_STRING_FULL_NAME, + DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME, + DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME, + DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME, + DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG, + DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG, +}} +STRUCT!{struct DWRITE_FONT_METRICS { + designUnitsPerEm: UINT16, + ascent: UINT16, + descent: UINT16, + lineGap: INT16, + capHeight: UINT16, + xHeight: UINT16, + underlinePosition: INT16, + underlineThickness: UINT16, + strikethroughPosition: INT16, + strikethroughThickness: UINT16, +}} +STRUCT!{struct DWRITE_GLYPH_METRICS { + leftSideBearing: INT32, + advanceWidth: UINT32, + rightSideBearing: INT32, + topSideBearing: INT32, + advanceHeight: UINT32, + bottomSideBearing: INT32, + verticalOriginY: INT32, +}} +STRUCT!{struct DWRITE_GLYPH_OFFSET { + advanceOffset: FLOAT, + ascenderOffset: FLOAT, +}} +ENUM!{enum DWRITE_FACTORY_TYPE { + DWRITE_FACTORY_TYPE_SHARED, + DWRITE_FACTORY_TYPE_ISOLATED, +}} +RIDL!{#[uuid(0x727cad4e, 0xd6af, 0x4c9e, 0x8a, 0x08, 0xd6, 0x95, 0xb1, 0x1c, 0xaa, 0x49)] +interface IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl): IUnknown(IUnknownVtbl) { + fn CreateStreamFromKey( + fontFileReferenceKey: *const c_void, + fontFileReferenceKeySize: UINT32, + fontFileStream: *mut *mut IDWriteFontFileStream, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xb2d9f3ec, 0xc9fe, 0x4a11, 0xa2, 0xec, 0xd8, 0x62, 0x08, 0xf7, 0xc0, 0xa2)] +interface IDWriteLocalFontFileLoader(IDWriteLocalFontFileLoaderVtbl): + IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl) { + fn GetFilePathLengthFromKey( + fontFileReferenceKey: *const c_void, + fontFileReferenceKeySize: UINT32, + filePathLength: *mut UINT32, + ) -> HRESULT, + fn GetFilePathFromKey( + fontFileReferenceKey: *const c_void, + fontFileReferenceKeySize: UINT32, + filePath: *mut WCHAR, + filePathSize: UINT32, + ) -> HRESULT, + fn GetLastWriteTimeFromKey( + fontFileReferenceKey: *const c_void, + fontFileReferenceKeySize: UINT32, + lastWriteTime: *mut FILETIME, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x6d4865fe, 0x0ab8, 0x4d91, 0x8f, 0x62, 0x5d, 0xd6, 0xbe, 0x34, 0xa3, 0xe0)] +interface IDWriteFontFileStream(IDWriteFontFileStreamVtbl): IUnknown(IUnknownVtbl) { + fn ReadFileFragment( + fragmentStart: *mut *const c_void, + fileOffset: UINT64, + fragmentSize: UINT64, + fragmentContext: *mut *mut c_void, + ) -> HRESULT, + fn ReleaseFileFragment( + fragmentContext: *mut c_void, + ) -> (), + fn GetFileSize( + fileSize: *mut UINT64, + ) -> HRESULT, + fn GetLastWriteTime( + lastWriteTime: *mut UINT64, + ) -> HRESULT, +}} +ENUM!{enum DWRITE_OUTLINE_THRESHOLD { + DWRITE_OUTLINE_THRESHOLD_ANTIALIASED, + DWRITE_OUTLINE_THRESHOLD_ALIASED, +}} +STRUCT!{struct DWRITE_FONT_METRICS1 { + designUnitsPerEm: UINT16, + ascent: UINT16, + descent: UINT16, + lineGap: INT16, + capHeight: UINT16, + xHeight: UINT16, + underlinePosition: INT16, + underlineThickness: UINT16, + strikethroughPosition: INT16, + strikethroughThickness: UINT16, + glyphBoxLeft: INT16, + glyphBoxTop: INT16, + glyphBoxRight: INT16, + glyphBoxBottom: INT16, + subscriptPositionX: INT16, + subscriptPositionY: INT16, + subscriptSizeX: INT16, + subscriptSizeY: INT16, + superscriptPositionX: INT16, + superscriptPositionY: INT16, + superscriptSizeX: INT16, + superscriptSizeY: INT16, + hasTypographicMetrics: BOOL, +}} +STRUCT!{struct DWRITE_UNICODE_RANGE { + first: UINT32, + last: UINT32, +}} +STRUCT!{struct DWRITE_CARET_METRICS { + slopeRise: INT16, + slopeRun: INT16, + offset: INT16, +}} +#[inline] +pub fn DWRITE_MAKE_OPENTYPE_TAG(a: u8, b: u8, c: u8, d: u8) -> u32 { + ((d as u32) << 24) | ((c as u32) << 16) | ((b as u32) << 8) | (a as u32) +} +RIDL!{#[uuid(0x739d886a, 0xcef5, 0x47dc, 0x87, 0x69, 0x1a, 0x8b, 0x41, 0xbe, 0xbb, 0xb0)] +interface IDWriteFontFile(IDWriteFontFileVtbl): IUnknown(IUnknownVtbl) { + fn GetReferenceKey( + fontFileReferenceKey: *mut *const c_void, + fontFileReferenceKeySize: *mut UINT32, + ) -> HRESULT, + fn GetLoader( + fontFileLoader: *mut *mut IDWriteFontFileLoader, + ) -> HRESULT, + fn Analyze( + isSupportedFontType: *mut BOOL, + fontFileType: *mut DWRITE_FONT_FILE_TYPE, + fontFaceType: *mut DWRITE_FONT_FACE_TYPE, + numberOfFaces: *mut UINT32, + ) -> HRESULT, +}} +ENUM!{enum DWRITE_PIXEL_GEOMETRY { + DWRITE_PIXEL_GEOMETRY_FLAT, + DWRITE_PIXEL_GEOMETRY_RGB, + DWRITE_PIXEL_GEOMETRY_BGR, +}} +ENUM!{enum DWRITE_RENDERING_MODE { + DWRITE_RENDERING_MODE_DEFAULT, + DWRITE_RENDERING_MODE_ALIASED, + DWRITE_RENDERING_MODE_GDI_CLASSIC, + DWRITE_RENDERING_MODE_GDI_NATURAL, + DWRITE_RENDERING_MODE_NATURAL, + DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + DWRITE_RENDERING_MODE_OUTLINE, + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC, + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, +}} +STRUCT!{struct DWRITE_MATRIX { + m11: FLOAT, + m12: FLOAT, + m21: FLOAT, + m22: FLOAT, + dx: FLOAT, + dy: FLOAT, +}} +RIDL!{#[uuid(0x2f0da53a, 0x2add, 0x47cd, 0x82, 0xee, 0xd9, 0xec, 0x34, 0x68, 0x8e, 0x75)] +interface IDWriteRenderingParams(IDWriteRenderingParamsVtbl): IUnknown(IUnknownVtbl) { + fn GetGamma() -> FLOAT, + fn GetEnhancedContrast() -> FLOAT, + fn GetClearTypeLevel() -> FLOAT, + fn GetPixelGeometry() -> DWRITE_PIXEL_GEOMETRY, + fn GetRenderingMode() -> DWRITE_RENDERING_MODE, +}} +pub type IDWriteGeometrySink = ID2D1SimplifiedGeometrySink; +RIDL!{#[uuid(0x5f49804d, 0x7024, 0x4d43, 0xbf, 0xa9, 0xd2, 0x59, 0x84, 0xf5, 0x38, 0x49)] +interface IDWriteFontFace(IDWriteFontFaceVtbl): IUnknown(IUnknownVtbl) { + fn GetType() -> DWRITE_FONT_FACE_TYPE, + fn GetFiles( + numberOfFiles: *mut UINT32, + fontFiles: *mut *mut IDWriteFontFile, + ) -> HRESULT, + fn GetIndex() -> UINT32, + fn GetSimulations() -> DWRITE_FONT_SIMULATIONS, + fn IsSymbolFont() -> BOOL, + fn GetMetrics( + fontFaceMetrics: *mut DWRITE_FONT_METRICS, + ) -> (), + fn GetGlyphCount() -> UINT16, + fn GetDesignGlyphMetrics( + glyphIndices: *const UINT16, + glyphCount: UINT32, + glyphMetrics: *mut DWRITE_GLYPH_METRICS, + isSideways: BOOL, + ) -> HRESULT, + fn GetGlyphIndices( + codePoints: *const UINT32, + codePointCount: UINT32, + glyphIndices: *mut UINT16, + ) -> HRESULT, + fn TryGetFontTable( + openTypeTableTag: UINT32, + tableData: *mut *const c_void, + tableSize: *mut UINT32, + tableContext: *mut *mut c_void, + exists: *mut BOOL, + ) -> HRESULT, + fn ReleaseFontTable( + tableContext: *mut c_void, + ) -> HRESULT, + fn GetGlyphRunOutline( + emSize: FLOAT, + glyphIndices: *const UINT16, + glyphAdvances: *const FLOAT, + glyphOffsets: *const DWRITE_GLYPH_OFFSET, + glyphCount: UINT32, + isSideways: BOOL, + isRightToLeft: BOOL, + geometrySink: *mut IDWriteGeometrySink, + ) -> HRESULT, + fn GetRecommendedRenderingMode( + emSize: FLOAT, + pixelsPerDip: FLOAT, + measuringMode: DWRITE_MEASURING_MODE, + renderingParams: *mut IDWriteRenderingParams, + renderingMode: *mut DWRITE_RENDERING_MODE, + ) -> HRESULT, + fn GetGdiCompatibleMetrics( + emSize: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + fontFaceMetrics: *mut DWRITE_FONT_METRICS, + ) -> HRESULT, + fn GetGdiCompatibleGlyphMetrics( + enSize: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + useGdiNatrual: BOOL, + glyphIndices: *const UINT16, + glyphCount: UINT32, + glyphMetrics: *mut DWRITE_GLYPH_METRICS, + isSideways: BOOL, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xa71efdb4, 0x9fdb, 0x4838, 0xad, 0x90, 0xcf, 0xc3, 0xbe, 0x8c, 0x3d, 0xaf)] +interface IDWriteFontFace1(IDWriteFontFace1Vtbl): IDWriteFontFace(IDWriteFontFaceVtbl) { + fn GetMetrics( + fontFaceMetrics: *mut DWRITE_FONT_METRICS1, + ) -> (), + fn GetGdiCompatibleMetrics( + emSize: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + fontFaceMetrics: *mut DWRITE_FONT_METRICS1, + ) -> HRESULT, + fn GetCaretMetrics( + caretMetrics: *mut DWRITE_CARET_METRICS, + ) -> (), + fn GetUnicodeRanges( + maxRangeCount: UINT32, + unicodeRanges: *mut DWRITE_UNICODE_RANGE, + actualRangeCount: *mut UINT32, + ) -> HRESULT, + fn IsMonoSpacedFont() -> BOOL, + fn GetDesignGlyphAdvances( + glyphCount: UINT32, + glyphIndices: *const UINT16, + glyphAdvances: *mut INT32, + isSideways: BOOL, + ) -> HRESULT, + fn GetGdiCompatibleGlyphAdvance( + emSize: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + useGdiNatural: BOOL, + isSideways: BOOL, + glyphCount: UINT32, + glyphIndices: *const UINT16, + glyphAdvances: *mut INT32, + ) -> HRESULT, + fn GetKerningPairAdjustments( + glyphCount: UINT32, + glyphIndices: *const UINT16, + glyphAdvanceAdjustments: *mut INT32, + ) -> HRESULT, + fn HasKerningPairs() -> BOOL, + fn GetRecommendedRenderingMode( + fontEmSize: FLOAT, + dpiX: FLOAT, + dpiY: FLOAT, + transform: *const DWRITE_MATRIX, + isSideways: BOOL, + outlineThreshold: DWRITE_OUTLINE_THRESHOLD, + measuringMode: DWRITE_MEASURING_MODE, + renderingMode: *mut DWRITE_RENDERING_MODE, + ) -> HRESULT, + fn GetVerticalGlyphVariants( + nominalGlyphIndices: *const UINT16, + verticalGlyphIndices: *mut UINT16, + ) -> HRESULT, + fn HasVerticalGlyphVariants() -> BOOL, +}} +RIDL!{#[uuid(0xcca920e4, 0x52f0, 0x492b, 0xbf, 0xa8, 0x29, 0xc7, 0x2e, 0xe0, 0xa4, 0x68)] +interface IDWriteFontCollectionLoader(IDWriteFontCollectionLoaderVtbl): + IUnknown(IUnknownVtbl) { + fn CreateEnumeratorFromKey( + factory: *mut IDWriteFactory, + collectionKey: *const c_void, + collectionKeySize: UINT32, + fontFileEnumerator: *mut *mut IDWriteFontFileEnumerator, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x72755049, 0x5ff7, 0x435d, 0x83, 0x48, 0x4b, 0xe9, 0x7c, 0xfa, 0x6c, 0x7c)] +interface IDWriteFontFileEnumerator(IDWriteFontFileEnumeratorVtbl): IUnknown(IUnknownVtbl) { + fn MoveNext( + hasCurrentFile: *mut BOOL, + ) -> HRESULT, + fn GetCurrentFontFile( + fontFile: *mut *mut IDWriteFontFile, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x08256209, 0x099a, 0x4b34, 0xb8, 0x6d, 0xc2, 0x2b, 0x11, 0x0e, 0x77, 0x71)] +interface IDWriteLocalizedStrings(IDWriteLocalizedStringsVtbl): IUnknown(IUnknownVtbl) { + fn GetCount() -> UINT32, + fn FindLocaleName( + localeName: *const WCHAR, + index: *mut UINT32, + exists: *mut BOOL, + ) -> HRESULT, + fn GetLocaleNameLength( + index: UINT32, + length: *mut UINT32, + ) -> HRESULT, + fn GetLocaleName( + index: UINT32, + localeName: *mut WCHAR, + size: UINT32, + ) -> HRESULT, + fn GetStringLength( + index: UINT32, + length: *mut UINT32, + ) -> HRESULT, + fn GetString( + index: UINT32, + stringBuffer: *mut WCHAR, + size: UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xa84cee02, 0x3eea, 0x4eee, 0xa8, 0x27, 0x87, 0xc1, 0xa0, 0x2a, 0x0f, 0xcc)] +interface IDWriteFontCollection(IDWriteFontCollectionVtbl): IUnknown(IUnknownVtbl) { + fn GetFontFamilyCount() -> UINT32, + fn GetFontFamily( + index: UINT32, + fontFamily: *mut *mut IDWriteFontFamily, + ) -> HRESULT, + fn FindFamilyName( + familyName: *const WCHAR, + index: *mut UINT32, + exists: *mut BOOL, + ) -> HRESULT, + fn GetFontFromFontFace( + fontFace: *mut IDWriteFontFace, + font: *mut *mut IDWriteFont, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x1a0d8438, 0x1d97, 0x4ec1, 0xae, 0xf9, 0xa2, 0xfb, 0x86, 0xed, 0x6a, 0xcb)] +interface IDWriteFontList(IDWriteFontListVtbl): IUnknown(IUnknownVtbl) { + fn GetFontCollection( + fontCollection: *mut *mut IDWriteFontCollection, + ) -> HRESULT, + fn GetFontCount() -> UINT32, + fn GetFont( + index: UINT32, + font: *mut *mut IDWriteFont, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xda20d8ef, 0x812a, 0x4c43, 0x98, 0x02, 0x62, 0xec, 0x4a, 0xbd, 0x7a, 0xdd)] +interface IDWriteFontFamily(IDWriteFontFamilyVtbl): IDWriteFontList(IDWriteFontListVtbl) { + fn GetFamilyNames( + names: *mut *mut IDWriteLocalizedStrings, + ) -> HRESULT, + fn GetFirstMatchingFont( + weight: DWRITE_FONT_WEIGHT, + stretch: DWRITE_FONT_STRETCH, + style: DWRITE_FONT_STYLE, + matchingFont: *mut *mut IDWriteFont, + ) -> HRESULT, + fn GetMatchingFonts( + weight: DWRITE_FONT_WEIGHT, + stretch: DWRITE_FONT_STRETCH, + style: DWRITE_FONT_STYLE, + matchingFonts: *mut *mut IDWriteFontList, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xacd16696, 0x8c14, 0x4f5d, 0x87, 0x7e, 0xfe, 0x3f, 0xc1, 0xd3, 0x27, 0x37)] +interface IDWriteFont(IDWriteFontVtbl): IUnknown(IUnknownVtbl) { + fn GetFontFamily( + fontFamily: *mut *mut IDWriteFontFamily, + ) -> HRESULT, + fn GetWeight() -> DWRITE_FONT_WEIGHT, + fn GetStretch() -> DWRITE_FONT_STRETCH, + fn GetStyle() -> DWRITE_FONT_STYLE, + fn IsSymbolFont() -> BOOL, + fn GetFaceNames( + names: *mut *mut IDWriteLocalizedStrings, + ) -> HRESULT, + fn GetInformationalStrings( + informationalStringId: DWRITE_INFORMATIONAL_STRING_ID, + informationalStrings: *mut *mut IDWriteLocalizedStrings, + exists: *mut BOOL, + ) -> HRESULT, + fn GetSimulations() -> DWRITE_FONT_SIMULATIONS, + fn GetMetrics( + fontMetrics: *mut DWRITE_FONT_METRICS, + ) -> (), + fn HasCharacter( + unicodeValue: UINT32, + exists: *mut BOOL, + ) -> HRESULT, + fn CreateFontFace( + fontFace: *mut *mut IDWriteFontFace, + ) -> HRESULT, +}} +ENUM!{enum DWRITE_READING_DIRECTION { + DWRITE_READING_DIRECTION_LEFT_TO_RIGHT = 0, + DWRITE_READING_DIRECTION_RIGHT_TO_LEFT = 1, + DWRITE_READING_DIRECTION_TOP_TO_BOTTOM = 2, + DWRITE_READING_DIRECTION_BOTTOM_TO_TOP = 3, +}} +ENUM!{enum DWRITE_FLOW_DIRECTION { + DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM = 0, + DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP = 1, + DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT = 2, + DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT = 3, +}} +ENUM!{enum DWRITE_TEXT_ALIGNMENT { + DWRITE_TEXT_ALIGNMENT_LEADING, + DWRITE_TEXT_ALIGNMENT_TRAILING, + DWRITE_TEXT_ALIGNMENT_CENTER, + DWRITE_TEXT_ALIGNMENT_JUSTIFIED, +}} +ENUM!{enum DWRITE_PARAGRAPH_ALIGNMENT { + DWRITE_PARAGRAPH_ALIGNMENT_NEAR, + DWRITE_PARAGRAPH_ALIGNMENT_FAR, + DWRITE_PARAGRAPH_ALIGNMENT_CENTER, +}} +ENUM!{enum DWRITE_WORD_WRAPPING { + DWRITE_WORD_WRAPPING_WRAP = 0, + DWRITE_WORD_WRAPPING_NO_WRAP = 1, + DWRITE_WORD_WRAPPING_EMERGENCY_BREAK = 2, + DWRITE_WORD_WRAPPING_WHOLE_WORD = 3, + DWRITE_WORD_WRAPPING_CHARACTER = 4, +}} +ENUM!{enum DWRITE_LINE_SPACING_METHOD { + DWRITE_LINE_SPACING_METHOD_DEFAULT, + DWRITE_LINE_SPACING_METHOD_UNIFORM, + DWRITE_LINE_SPACING_METHOD_PROPORTIONAL, +}} +ENUM!{enum DWRITE_TRIMMING_GRANULARITY { + DWRITE_TRIMMING_GRANULARITY_NONE, + DWRITE_TRIMMING_GRANULARITY_CHARACTER, + DWRITE_TRIMMING_GRANULARITY_WORD, +}} +ENUM!{enum DWRITE_FONT_FEATURE_TAG { + DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt' + DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case' + DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig' + DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh' + DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs' + DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt' + DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig' + DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt' + DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac' + DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid' + DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half' + DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist' + DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig' + DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid' + DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo' + DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04' + DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78' + DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83' + DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90' + DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern' + DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga' + DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum' + DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl' + DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark' + DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk' + DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt' + DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck' + DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum' + DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid' + DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid' + DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig' + DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt' + DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp' + DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20' + DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs' + DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups' + DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh' + DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam' + DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad' + DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid' + DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic' + DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING = 0x74726576, // 'vert' + DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION = 0x32747276, // 'vrt2' + DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero' +}} +STRUCT!{struct DWRITE_TEXT_RANGE { + startPosition: UINT32, + length: UINT32, +}} +STRUCT!{struct DWRITE_FONT_FEATURE { + nameTag: DWRITE_FONT_FEATURE_TAG, + parameter: UINT32, +}} +STRUCT!{struct DWRITE_TYPOGRAPHIC_FEATURES { + features: *mut DWRITE_FONT_FEATURE, + featureCount: UINT32, +}} +STRUCT!{struct DWRITE_TRIMMING { + granularity: DWRITE_TRIMMING_GRANULARITY, + delimiter: UINT32, + delimiterCount: UINT32, +}} +RIDL!{#[uuid(0x9c906818, 0x31d7, 0x4fd3, 0xa1, 0x51, 0x7c, 0x5e, 0x22, 0x5d, 0xb5, 0x5a)] +interface IDWriteTextFormat(IDWriteTextFormatVtbl): IUnknown(IUnknownVtbl) { + fn SetTextAlignment( + textAlignment: DWRITE_TEXT_ALIGNMENT, + ) -> HRESULT, + fn SetParagraphAlignment( + paragraphAlignment: DWRITE_PARAGRAPH_ALIGNMENT, + ) -> HRESULT, + fn SetWordWrapping( + wordWrapping: DWRITE_WORD_WRAPPING, + ) -> HRESULT, + fn SetReadingDirection( + readingDirection: DWRITE_READING_DIRECTION, + ) -> HRESULT, + fn SetFlowDirection( + flowDirection: DWRITE_FLOW_DIRECTION, + ) -> HRESULT, + fn SetIncrementalTabStop( + incrementalTabStop: FLOAT, + ) -> HRESULT, + fn SetTrimming( + trimmingOptions: *const DWRITE_TRIMMING, + trimmingSign: *mut IDWriteInlineObject, + ) -> HRESULT, + fn SetLineSpacing( + lineSpacingMethod: DWRITE_LINE_SPACING_METHOD, + lineSpacing: FLOAT, + baseLine: FLOAT, + ) -> HRESULT, + fn GetTextAlignment() -> DWRITE_TEXT_ALIGNMENT, + fn GetParagraphAlignment() -> DWRITE_PARAGRAPH_ALIGNMENT, + fn GetWordWrapping() -> DWRITE_WORD_WRAPPING, + fn GetReadingDirection() -> DWRITE_READING_DIRECTION, + fn GetFlowDirection() -> DWRITE_FLOW_DIRECTION, + fn GetIncrementalTabStop() -> FLOAT, + fn GetTrimming( + trimmingOptions: *mut DWRITE_TRIMMING, + trimmingSign: *mut *mut IDWriteInlineObject, + ) -> HRESULT, + fn GetLineSpacing( + lineSpacingMethod: *mut DWRITE_LINE_SPACING_METHOD, + lineSpacing: *mut FLOAT, + baseline: *mut FLOAT, + ) -> HRESULT, + fn GetFontCollection( + fontCollection: *mut *mut IDWriteFontCollection, + ) -> HRESULT, + fn GetFontFamilyNameLength() -> UINT32, + fn GetFontFamilyName( + fontFamilyName: *mut WCHAR, + nameSize: UINT32, + ) -> HRESULT, + fn GetFontWeight() -> DWRITE_FONT_WEIGHT, + fn GetFontStyle() -> DWRITE_FONT_STYLE, + fn GetFontStretch() -> DWRITE_FONT_STRETCH, + fn GetFontSize() -> FLOAT, + fn GetLocaleNameLength() -> UINT32, + fn GetLocaleName( + localeName: *mut WCHAR, + nameSize: UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x55f1112b, 0x1dc2, 0x4b3c, 0x95, 0x41, 0xf4, 0x68, 0x94, 0xed, 0x85, 0xb6)] +interface IDWriteTypography(IDWriteTypographyVtbl): IUnknown(IUnknownVtbl) { + fn AddFontFeature( + fontFeature: DWRITE_FONT_FEATURE, + ) -> HRESULT, + fn GetFontFeatureCount() -> UINT32, + fn GetFontFeature( + fontFeatureIndex: UINT32, + fontFeature: *mut DWRITE_FONT_FEATURE, + ) -> HRESULT, +}} +ENUM!{enum DWRITE_SCRIPT_SHAPES { + DWRITE_SCRIPT_SHAPES_DEFAULT = 0, + DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1, +}} +STRUCT!{struct DWRITE_SCRIPT_ANALYSIS { + script: UINT16, + shapes: DWRITE_SCRIPT_SHAPES, +}} +ENUM!{enum DWRITE_BREAK_CONDITION { + DWRITE_BREAK_CONDITION_NEUTRAL, + DWRITE_BREAK_CONDITION_CAN_BREAK, + DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, + DWRITE_BREAK_CONDITION_MUST_BREAK, +}} +STRUCT!{struct DWRITE_LINE_BREAKPOINT { + bit_fields: UINT8, +}} +BITFIELD!{DWRITE_LINE_BREAKPOINT bit_fields: UINT8 [ + breakConditionBefore set_breakConditionBefore[0..2], + breakConditionAfter set_breakConditionAfter[2..4], + isWhitespace set_isWhitespace[4..5], + isSoftHyphen set_isSoftHyphen[5..6], + padding set_padding[6..8], +]} +ENUM!{enum DWRITE_NUMBER_SUBSTITUTION_METHOD { + DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, + DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, + DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, + DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, + DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL, +}} +RIDL!{#[uuid(0x14885cc9, 0xbab0, 0x4f90, 0xb6, 0xed, 0x5c, 0x36, 0x6a, 0x2c, 0xd0, 0x3d)] +interface IDWriteNumberSubstitution(IDWriteNumberSubstitutionVtbl): IUnknown(IUnknownVtbl) {}} +STRUCT!{struct DWRITE_SHAPING_TEXT_PROPERTIES { + bit_fields: UINT16, +}} +BITFIELD!{DWRITE_SHAPING_TEXT_PROPERTIES bit_fields: UINT16 [ + isShapedAlone set_isShapedAlone[0..1], + reserved set_reserved[1..16], +]} +STRUCT!{struct DWRITE_SHAPING_GLYPH_PROPERTIES { + bit_fields: UINT16, +}} +BITFIELD!{DWRITE_SHAPING_GLYPH_PROPERTIES bit_fields: UINT16 [ + justification set_justification[0..4], + isClusterStart set_isClusterStart[4..5], + isDiacritic set_isDiacritic[5..6], + isZeroWidthSpace set_isZeroWidthSpace[6..7], + reserved set_reserved[7..16], +]} +RIDL!{#[uuid(0x688e1a58, 0x5094, 0x47c8, 0xad, 0xc8, 0xfb, 0xce, 0xa6, 0x0a, 0xe9, 0x2b)] +interface IDWriteTextAnalysisSource(IDWriteTextAnalysisSourceVtbl): IUnknown(IUnknownVtbl) { + fn GetTextAtPosition( + textPosition: UINT32, + textString: *mut *const WCHAR, + textLength: *mut UINT32, + ) -> HRESULT, + fn GetTextBeforePosition( + textPosition: UINT32, + textString: *mut *const WCHAR, + textLength: *mut UINT32, + ) -> HRESULT, + fn GetParagraphReadingDirection() -> DWRITE_READING_DIRECTION, + fn GetLocaleName( + textPosition: UINT32, + textLength: *mut UINT32, + localeName: *mut *const WCHAR, + ) -> HRESULT, + fn GetNumberSubstitution( + textPosition: UINT32, + textLength: *mut UINT32, + numberSubstitution: *mut *mut IDWriteNumberSubstitution, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x5810cd44, 0x0ca0, 0x4701, 0xb3, 0xfa, 0xbe, 0xc5, 0x18, 0x2a, 0xe4, 0xf6)] +interface IDWriteTextAnalysisSink(IDWriteTextAnalysisSinkVtbl): IUnknown(IUnknownVtbl) { + fn SetScriptAnalysis( + textPosition: UINT32, + textLength: UINT32, + scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, + ) -> HRESULT, + fn SetLineBreakpoints( + textPosition: UINT32, + textLength: UINT32, + lineBreakpoints: *const DWRITE_LINE_BREAKPOINT, + ) -> HRESULT, + fn SetBidiLevel( + textPosition: UINT32, + textLength: UINT32, + explicitLevel: UINT8, + resolvedLevel: UINT8, + ) -> HRESULT, + fn SetNumberSubstitution( + textPosition: UINT32, + textLength: UINT32, + numberSubstitution: *mut IDWriteNumberSubstitution, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xb7e6163e, 0x7f46, 0x43b4, 0x84, 0xb3, 0xe4, 0xe6, 0x24, 0x9c, 0x36, 0x5d)] +interface IDWriteTextAnalyzer(IDWriteTextAnalyzerVtbl): IUnknown(IUnknownVtbl) { + fn AnalyzeScript( + analysisSource: *mut IDWriteTextAnalysisSource, + textPosition: UINT32, + textLength: UINT32, + analysisSink: *mut IDWriteTextAnalysisSink, + ) -> HRESULT, + fn AnalyzeBidi( + analysisSource: *mut IDWriteTextAnalysisSource, + textPosition: UINT32, + textLength: UINT32, + analysisSink: *mut IDWriteTextAnalysisSink, + ) -> HRESULT, + fn AnalyzeNumberSubstitution( + analysisSource: *mut IDWriteTextAnalysisSource, + textPosition: UINT32, + textLength: UINT32, + analysisSink: *mut IDWriteTextAnalysisSink, + ) -> HRESULT, + fn AnalyzeLineBreakpoints( + analysisSource: *mut IDWriteTextAnalysisSource, + textPosition: UINT32, + textLength: UINT32, + analysisSink: *mut IDWriteTextAnalysisSink, + ) -> HRESULT, + fn GetGlyphs( + textString: *const WCHAR, + textLength: UINT32, + fontFace: *mut IDWriteFontFace, + isSideways: BOOL, + isRightToLeft: BOOL, + scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, + localeName: *const WCHAR, + numberSubstitution: *mut IDWriteNumberSubstitution, + features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, + featureRangeLengths: *const UINT32, + featureRanges: UINT32, + maxGlyphCount: UINT32, + clusterMap: *mut UINT16, + textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, + glyphIndices: *mut UINT16, + glyphProps: *mut DWRITE_SHAPING_GLYPH_PROPERTIES, + actualGlyphCount: *mut UINT32, + ) -> HRESULT, + fn GetGlyphPlacements( + textString: *const WCHAR, + clusterMap: *const UINT16, + textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, + textLength: UINT32, + glyphIndices: *const UINT16, + glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES, + glyphCount: UINT32, + fontFace: *mut IDWriteFontFace, + fontEmSize: FLOAT, + isSideways: BOOL, + isRightToLeft: BOOL, + scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, + localeName: *const WCHAR, + features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, + featureRangeLengths: *const UINT32, + featureRanges: UINT32, + glyphAdvances: *mut FLOAT, + glyphOffsets: *mut DWRITE_GLYPH_OFFSET, + ) -> HRESULT, + fn GetGdiCompatibleGlyphPlacements( + textString: *const WCHAR, + clusterMap: *const UINT16, + textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, + textLength: UINT32, + glyphIndices: *const UINT16, + glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES, + glyphCount: UINT32, + fontFace: *mut IDWriteFontFace, + fontEmSize: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + useGdiNatrual: BOOL, + isSideways: BOOL, + isRightToLeft: BOOL, + scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, + localeName: *const WCHAR, + features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, + featureRangeLengths: *const UINT32, + featureRanges: UINT32, + glyphAdvances: *mut FLOAT, + glyphOffsets: *mut DWRITE_GLYPH_OFFSET, + ) -> HRESULT, +}} +STRUCT!{struct DWRITE_GLYPH_RUN { + fontFace: *mut IDWriteFontFace, + fontEmSize: FLOAT, + glyphCount: UINT32, + glyphIndices: *const UINT16, + glyphAdvances: *const FLOAT, + glyphOffsets: *const DWRITE_GLYPH_OFFSET, + isSideways: BOOL, + bidiLevel: UINT32, +}} +STRUCT!{struct DWRITE_GLYPH_RUN_DESCRIPTION { + localeName: *const WCHAR, + string: *const WCHAR, + stringLength: UINT32, + clusterMap: *const UINT16, + textPosition: UINT32, +}} +STRUCT!{struct DWRITE_UNDERLINE { + width: FLOAT, + thickness: FLOAT, + offset: FLOAT, + runHeight: FLOAT, + readingDirection: DWRITE_READING_DIRECTION, + flowDirection: DWRITE_FLOW_DIRECTION, + localeName: *const WCHAR, + measuringMode: DWRITE_MEASURING_MODE, +}} +STRUCT!{struct DWRITE_STRIKETHROUGH { + width: FLOAT, + thickness: FLOAT, + offset: FLOAT, + readingDirection: DWRITE_READING_DIRECTION, + flowDirection: DWRITE_FLOW_DIRECTION, + localeName: *const WCHAR, + measuringMode: DWRITE_MEASURING_MODE, +}} +STRUCT!{struct DWRITE_LINE_METRICS { + length: UINT32, + trailingWhitespaceLength: UINT32, + newlineLength: UINT32, + height: FLOAT, + baseline: FLOAT, + isTrimmed: BOOL, +}} +STRUCT!{struct DWRITE_CLUSTER_METRICS { + width: FLOAT, + length: UINT16, + bit_fields: UINT16, +}} +BITFIELD!{DWRITE_CLUSTER_METRICS bit_fields: UINT16 [ + canWrapLineAfter set_canWrapLineAfter[0..1], + isWhitespace set_isWhitespace[1..2], + isNewline set_isNewline[2..3], + isSoftHyphen set_isSoftHyphen[3..4], + isRightToLeft set_isRightToLeft[4..5], + padding set_padding[5..16], +]} +STRUCT!{struct DWRITE_TEXT_METRICS { + left: FLOAT, + top: FLOAT, + width: FLOAT, + widthIncludingTrailingWhitespace: FLOAT, + height: FLOAT, + layoutWidth: FLOAT, + layoutHeight: FLOAT, + maxBidiReorderingDepth: UINT32, + lineCount: UINT32, +}} +STRUCT!{struct DWRITE_INLINE_OBJECT_METRICS { + width: FLOAT, + height: FLOAT, + baseline: FLOAT, + supportsSideways: BOOL, +}} +STRUCT!{struct DWRITE_OVERHANG_METRICS { + left: FLOAT, + top: FLOAT, + right: FLOAT, + bottom: FLOAT, +}} +STRUCT!{struct DWRITE_HIT_TEST_METRICS { + textPosition: UINT32, + length: UINT32, + left: FLOAT, + top: FLOAT, + width: FLOAT, + height: FLOAT, + bidiLevel: UINT32, + isText: BOOL, + isTrimmed: BOOL, +}} +RIDL!{#[uuid(0x8339fde3, 0x106f, 0x47ab, 0x83, 0x73, 0x1c, 0x62, 0x95, 0xeb, 0x10, 0xb3)] +interface IDWriteInlineObject(IDWriteInlineObjectVtbl): IUnknown(IUnknownVtbl) { + fn Draw( + clientDrawingContext: *mut c_void, + renderer: *mut IDWriteTextRenderer, + originX: FLOAT, + originY: FLOAT, + isSideways: BOOL, + isRightToLeft: BOOL, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, + fn GetMetrics( + metrics: *mut DWRITE_INLINE_OBJECT_METRICS, + ) -> HRESULT, + fn GetOverhangMetrics( + overhangs: *mut DWRITE_OVERHANG_METRICS, + ) -> HRESULT, + fn GetBreakConditions( + breakConditionBefore: *mut DWRITE_BREAK_CONDITION, + breakConditionAfter: *mut DWRITE_BREAK_CONDITION, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xeaf3a2da, 0xecf4, 0x4d24, 0xb6, 0x44, 0xb3, 0x4f, 0x68, 0x42, 0x02, 0x4b)] +interface IDWritePixelSnapping(IDWritePixelSnappingVtbl): IUnknown(IUnknownVtbl) { + fn IsPixelSnappingDisabled( + clientDrawingContext: *mut c_void, + isDisabled: *mut BOOL, + ) -> HRESULT, + fn GetCurrentTransform( + clientDrawingContext: *mut c_void, + transform: *mut DWRITE_MATRIX, + ) -> HRESULT, + fn GetPixelsPerDip( + clientDrawingContext: *mut c_void, + pixelsPerDip: *mut FLOAT, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xef8a8135, 0x5cc6, 0x45fe, 0x88, 0x25, 0xc5, 0xa0, 0x72, 0x4e, 0xb8, 0x19)] +interface IDWriteTextRenderer(IDWriteTextRendererVtbl): + IDWritePixelSnapping(IDWritePixelSnappingVtbl) { + fn DrawGlyphRun( + clientDrawingContext: *mut c_void, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + measuringMode: DWRITE_MEASURING_MODE, + glyphRun: *const DWRITE_GLYPH_RUN, + glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, + fn DrawUnderline( + clientDrawingContext: *mut c_void, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + underline: *const DWRITE_UNDERLINE, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, + fn DrawStrikethrough( + clientDrawingContext: *mut c_void, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + strikethrough: *const DWRITE_STRIKETHROUGH, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, + fn DrawInlineObject( + clientDrawingContext: *mut c_void, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + inlineObject: *mut IDWriteInlineObject, + isSideways: BOOL, + isRightToLeft: BOOL, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x53737037, 0x6d14, 0x410b, 0x9b, 0xfe, 0x0b, 0x18, 0x2b, 0xb7, 0x09, 0x61)] +interface IDWriteTextLayout(IDWriteTextLayoutVtbl): + IDWriteTextFormat(IDWriteTextFormatVtbl) { + fn SetMaxWidth( + maxWidth: FLOAT, + ) -> HRESULT, + fn SetMaxHeight( + maxHeight: FLOAT, + ) -> HRESULT, + fn SetFontCollection( + fontCollection: *mut IDWriteFontCollection, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetFontFamilyName( + fontFamilyName: *const WCHAR, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetFontWeight( + fontWeight: DWRITE_FONT_WEIGHT, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetFontStyle( + fontStyle: DWRITE_FONT_STYLE, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetFontStretch( + fontStretch: DWRITE_FONT_STRETCH, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetFontSize( + fontSize: FLOAT, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetUnderline( + hasUnderline: BOOL, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetStrikethrough( + hasStrikethrough: BOOL, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetDrawingEffect( + drawingEffect: *mut IUnknown, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetInlineObject( + inlineObject: *mut IDWriteInlineObject, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetTypography( + typography: *mut IDWriteTypography, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetLocaleName( + localeName: *const WCHAR, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetMaxWidth() -> FLOAT, + fn GetMaxHeight() -> FLOAT, + fn GetFontCollection( + currentPosition: UINT32, + fontCollection: *mut *mut IDWriteFontCollection, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetFontFamilyNameLength( + currentPosition: UINT32, + nameLength: *mut UINT32, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetFontFamilyName( + currentPosition: UINT32, + fontFamilyName: *mut WCHAR, + nameSize: UINT32, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetFontWeight( + currentPosition: UINT32, + fontWeight: *mut DWRITE_FONT_WEIGHT, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetFontStyle( + currentPosition: UINT32, + fontStyle: *mut DWRITE_FONT_STYLE, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetFontStretch( + currentPosition: UINT32, + fontStretch: *mut DWRITE_FONT_STRETCH, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetFontSize( + currentPosition: UINT32, + fontSize: *mut FLOAT, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetUnderline( + currentPosition: UINT32, + hasUnderline: *mut BOOL, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetStrikethrough( + currentPosition: UINT32, + hasStrikethrough: *mut BOOL, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetDrawingEffect( + currentPosition: UINT32, + drawingEffect: *mut *mut IUnknown, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetInlineObject( + currentPosition: UINT32, + inlineObject: *mut *mut IDWriteInlineObject, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetTypography( + currentPosition: UINT32, + typography: *mut *mut IDWriteTypography, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetLocaleNameLength( + currentPosition: UINT32, + nameLength: *mut UINT32, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetLocaleName( + currentPosition: UINT32, + localeName: *mut WCHAR, + nameSize: UINT32, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn Draw( + clientDrawingContext: *mut c_void, + renderer: *mut IDWriteTextRenderer, + originX: FLOAT, + originY: FLOAT, + ) -> HRESULT, + fn GetLineMetrics( + lineMetrics: *mut DWRITE_LINE_METRICS, + maxLineCount: UINT32, + actualLineCount: *mut UINT32, + ) -> HRESULT, + fn GetMetrics( + textMetrics: *mut DWRITE_TEXT_METRICS, + ) -> HRESULT, + fn GetOverhangMetrics( + overhangs: *mut DWRITE_OVERHANG_METRICS, + ) -> HRESULT, + fn GetClusterMetrics( + clusterMetrics: *mut DWRITE_CLUSTER_METRICS, + maxClusterCount: UINT32, + actualClusterCount: *mut UINT32, + ) -> HRESULT, + fn DetermineMinWidth( + minWidth: *mut FLOAT, + ) -> HRESULT, + fn HitTestPoint( + pointX: FLOAT, + pointY: FLOAT, + isTrailingHit: *mut BOOL, + isInside: *mut BOOL, + hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS, + ) -> HRESULT, + fn HitTestTextPosition( + textPosition: UINT32, + isTrailingHit: BOOL, + pointX: *mut FLOAT, + pointY: *mut FLOAT, + hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS, + ) -> HRESULT, + fn HitTestTextRange( + textPosition: UINT32, + textLength: UINT32, + originX: FLOAT, + originY: FLOAT, + hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS, + maxHitTestMetricsCount: UINT32, + actualHitTestMetricsCount: *mut UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x5e5a32a3, 0x8dff, 0x4773, 0x9f, 0xf6, 0x06, 0x96, 0xea, 0xb7, 0x72, 0x67)] +interface IDWriteBitmapRenderTarget(IDWriteBitmapRenderTargetVtbl): IUnknown(IUnknownVtbl) { + fn DrawGlyphRun( + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + measuringMode: DWRITE_MEASURING_MODE, + glyphRun: *const DWRITE_GLYPH_RUN, + renderingParams: *mut IDWriteRenderingParams, + textColor: COLORREF, + blackBoxRect: *mut RECT, + ) -> HRESULT, + fn GetMemoryDC() -> HDC, + fn GetPixelsPerDip() -> FLOAT, + fn SetPixelsPerDip( + pixelsPerDip: FLOAT, + ) -> HRESULT, + fn GetCurrentTransform( + transform: *mut DWRITE_MATRIX, + ) -> HRESULT, + fn SetCurrentTransform( + transform: *const DWRITE_MATRIX, + ) -> HRESULT, + fn GetSize( + size: *mut SIZE, + ) -> HRESULT, + fn Resize( + width: UINT32, + height: UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x1edd9491, 0x9853, 0x4299, 0x89, 0x8f, 0x64, 0x32, 0x98, 0x3b, 0x6f, 0x3a)] +interface IDWriteGdiInterop(IDWriteGdiInteropVtbl): IUnknown(IUnknownVtbl) { + fn CreateFontFromLOGFONT( + logFont: *const LOGFONTW, + font: *mut *mut IDWriteFont, + ) -> HRESULT, + fn ConvertFontToLOGFONT( + font: *mut IDWriteFont, + logFont: *mut LOGFONTW, + isSystemFont: *mut BOOL, + ) -> HRESULT, + fn ConvertFontFaceToLOGFONT( + font: *mut IDWriteFontFace, + logFont: *mut LOGFONTW, + ) -> HRESULT, + fn CreateFontFaceFromHdc( + hdc: HDC, + fontFace: *mut *mut IDWriteFontFace, + ) -> HRESULT, + fn CreateBitmapRenderTarget( + hdc: HDC, + width: UINT32, + height: UINT32, + renderTarget: *mut *mut IDWriteBitmapRenderTarget, + ) -> HRESULT, +}} +ENUM!{enum DWRITE_TEXTURE_TYPE { + DWRITE_TEXTURE_ALIASED_1x1 = 0, + DWRITE_TEXTURE_CLEARTYPE_3x1 = 1, +}} +pub const DWRITE_ALPHA_MAX: BYTE = 255; +RIDL!{#[uuid(0x7d97dbf7, 0xe085, 0x42d4, 0x81, 0xe3, 0x6a, 0x88, 0x3b, 0xde, 0xd1, 0x18)] +interface IDWriteGlyphRunAnalysis(IDWriteGlyphRunAnalysisVtbl): IUnknown(IUnknownVtbl) { + fn GetAlphaTextureBounds( + textureType: DWRITE_TEXTURE_TYPE, + textureBounds: *mut RECT, + ) -> HRESULT, + fn CreateAlphaTexture( + textureType: DWRITE_TEXTURE_TYPE, + textureBounds: *const RECT, + alphaValues: *mut BYTE, + bufferSize: UINT32, + ) -> HRESULT, + fn GetAlphaBlendParams( + renderingParams: *mut IDWriteRenderingParams, + blendGamma: *mut FLOAT, + blendEnhancedContrast: *mut FLOAT, + blendClearTypeLevel: *mut FLOAT, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xb859ee5a, 0xd838, 0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48)] +interface IDWriteFactory(IDWriteFactoryVtbl): IUnknown(IUnknownVtbl) { + fn GetSystemFontCollection( + fontCollection: *mut *mut IDWriteFontCollection, + checkForUpdates: BOOL, + ) -> HRESULT, + fn CreateCustomFontCollection( + collectionLoader: *mut IDWriteFontCollectionLoader, + collectionKey: *const c_void, + collectionKeySize: UINT32, + fontCollection: *mut *mut IDWriteFontCollection, + ) -> HRESULT, + fn RegisterFontCollectionLoader( + fontCollectionLoader: *mut IDWriteFontCollectionLoader, + ) -> HRESULT, + fn UnregisterFontCollectionLoader( + fontCollectionLoader: *mut IDWriteFontCollectionLoader, + ) -> HRESULT, + fn CreateFontFileReference( + filePath: *const WCHAR, + lastWriteTime: *const FILETIME, + fontFile: *mut *mut IDWriteFontFile, + ) -> HRESULT, + fn CreateCustomFontFileReference( + fontFileReferenceKey: *const c_void, + fontFileReferenceKeySize: UINT32, + fontFileLoader: *mut IDWriteFontFileLoader, + fontFile: *mut *mut IDWriteFontFile, + ) -> HRESULT, + fn CreateFontFace( + fontFaceType: DWRITE_FONT_FACE_TYPE, + numberOfFiles: UINT32, + fontFiles: *const *mut IDWriteFontFile, + faceIndex: UINT32, + fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS, + fontFace: *mut *mut IDWriteFontFace, + ) -> HRESULT, + fn CreateRenderingParams( + renderingParams: *mut *mut IDWriteRenderingParams, + ) -> HRESULT, + fn CreateMonitorRenderingParams( + monitor: HMONITOR, + renderingParams: *mut *mut IDWriteRenderingParams, + ) -> HRESULT, + fn CreateCustomRenderingParams( + gamma: FLOAT, + enhancedContrast: FLOAT, + clearTypeLevel: FLOAT, + pixelGeometry: DWRITE_PIXEL_GEOMETRY, + renderingMode: DWRITE_RENDERING_MODE, + renderingParams: *mut *mut IDWriteRenderingParams, + ) -> HRESULT, + fn RegisterFontFileLoader( + fontFileLoader: *mut IDWriteFontFileLoader, + ) -> HRESULT, + fn UnregisterFontFileLoader( + fontFileLoader: *mut IDWriteFontFileLoader, + ) -> HRESULT, + fn CreateTextFormat( + fontFamilyName: *const WCHAR, + fontCollection: *mut IDWriteFontCollection, + fontWeight: DWRITE_FONT_WEIGHT, + fontStyle: DWRITE_FONT_STYLE, + fontStretch: DWRITE_FONT_STRETCH, + fontSize: FLOAT, + localeName: *const WCHAR, + textFormat: *mut *mut IDWriteTextFormat, + ) -> HRESULT, + fn CreateTypography( + typography: *mut *mut IDWriteTypography, + ) -> HRESULT, + fn GetGdiInterop( + gdiInterop: *mut *mut IDWriteGdiInterop, + ) -> HRESULT, + fn CreateTextLayout( + string: *const WCHAR, + stringLength: UINT32, + textFormat: *mut IDWriteTextFormat, + maxWidth: FLOAT, + maxHeight: FLOAT, + textLayout: *mut *mut IDWriteTextLayout, + ) -> HRESULT, + fn CreateGdiCompatibleTextLayout( + string: *const WCHAR, + stringLength: UINT32, + textFormat: *mut IDWriteTextFormat, + layoutWidth: FLOAT, + layoutHeight: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + useGdiNatrual: BOOL, + textLayout: *mut *mut IDWriteTextLayout, + ) -> HRESULT, + fn CreateEllipsisTrimmingSign( + textFormat: *mut IDWriteTextFormat, + trimmingSign: *mut *mut IDWriteInlineObject, + ) -> HRESULT, + fn CreateTextAnalyzer( + textAnalyzer: *mut *mut IDWriteTextAnalyzer, + ) -> HRESULT, + fn CreateNumberSubstitution( + substitutionMethod: DWRITE_NUMBER_SUBSTITUTION_METHOD, + localeName: *const WCHAR, + ignoreUserOverride: BOOL, + numberSubstitution: *mut *mut IDWriteNumberSubstitution, + ) -> HRESULT, + fn CreateGlyphRunAnalysis( + glyphRun: *const DWRITE_GLYPH_RUN, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + renderingMode: DWRITE_RENDERING_MODE, + measuringMode: DWRITE_MEASURING_MODE, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis, + ) -> HRESULT, +}} +pub const FACILITY_DWRITE: HRESULT = 0x898; +pub const DWRITE_ERR_BASE: HRESULT = 0x5000; +#[inline] +pub fn MAKE_DWRITE_HR(severity: HRESULT, code: HRESULT) -> HRESULT { + MAKE_HRESULT!(severity, FACILITY_DWRITE, DWRITE_ERR_BASE + code) +} +#[inline] +pub fn MAKE_DWRITE_HR_ERR(code: HRESULT) -> HRESULT { + MAKE_DWRITE_HR(SEVERITY_ERROR, code) +} +extern "system" { + pub fn DWriteCreateFactory( + factoryType: DWRITE_FACTORY_TYPE, iid: REFIID, factory: *mut *mut IUnknown, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/dwrite_1.rs b/src/vendor/winapi/src/um/dwrite_1.rs new file mode 100644 index 0000000000..06fa48c964 --- /dev/null +++ b/src/vendor/winapi/src/um/dwrite_1.rs @@ -0,0 +1,747 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the content of dwrite_1.h +use shared::basetsd::{INT16, INT32, UINT16, UINT32, UINT8}; +use shared::minwindef::{BOOL, FLOAT}; +use um::dcommon::DWRITE_MEASURING_MODE; +use um::dwrite::{ + DWRITE_GLYPH_OFFSET, DWRITE_MATRIX, DWRITE_PIXEL_GEOMETRY, DWRITE_RENDERING_MODE, + DWRITE_SCRIPT_ANALYSIS, DWRITE_SHAPING_GLYPH_PROPERTIES, DWRITE_TEXT_RANGE, + IDWriteBitmapRenderTarget, IDWriteBitmapRenderTargetVtbl, IDWriteFactory, IDWriteFactoryVtbl, + IDWriteFont, IDWriteFontCollection, IDWriteFontFace, IDWriteFontFaceVtbl, IDWriteFontVtbl, + IDWriteRenderingParams, IDWriteRenderingParamsVtbl, IDWriteTextAnalysisSink, + IDWriteTextAnalysisSinkVtbl, IDWriteTextAnalysisSource, IDWriteTextAnalysisSourceVtbl, + IDWriteTextAnalyzer, IDWriteTextAnalyzerVtbl, IDWriteTextLayout, IDWriteTextLayoutVtbl, +}; +use um::winnt::{HRESULT, WCHAR}; +ENUM!{enum DWRITE_PANOSE_FAMILY { + DWRITE_PANOSE_FAMILY_ANY = 0x0, // 0 + DWRITE_PANOSE_FAMILY_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_FAMILY_TEXT_DISPLAY = 0x2, // 2 + DWRITE_PANOSE_FAMILY_SCRIPT = 0x3, // 3 + DWRITE_PANOSE_FAMILY_DECORATIVE = 0x4, // 4 + DWRITE_PANOSE_FAMILY_SYMBOL = 0x5, // 5 + DWRITE_PANOSE_FAMILY_PICTORIAL = 0x5, // 5 +}} +ENUM!{enum DWRITE_PANOSE_SERIF_STYLE { + DWRITE_PANOSE_SERIF_STYLE_ANY = 0x0, // 0 + DWRITE_PANOSE_SERIF_STYLE_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_SERIF_STYLE_COVE = 0x2, // 2 + DWRITE_PANOSE_SERIF_STYLE_OBTUSE_COVE = 0x3, // 3 + DWRITE_PANOSE_SERIF_STYLE_SQUARE_COVE = 0x4, // 4 + DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SQUARE_COVE = 0x5, // 5 + DWRITE_PANOSE_SERIF_STYLE_SQUARE = 0x6, // 6 + DWRITE_PANOSE_SERIF_STYLE_THIN = 0x7, // 7 + DWRITE_PANOSE_SERIF_STYLE_OVAL = 0x8, // 8 + DWRITE_PANOSE_SERIF_STYLE_EXAGGERATED = 0x9, // 9 + DWRITE_PANOSE_SERIF_STYLE_TRIANGLE = 0xA, // 10 + DWRITE_PANOSE_SERIF_STYLE_NORMAL_SANS = 0xB, // 11 + DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SANS = 0xC, // 12 + DWRITE_PANOSE_SERIF_STYLE_PERPENDICULAR_SANS = 0xD, // 13 + DWRITE_PANOSE_SERIF_STYLE_FLARED = 0xE, // 14 + DWRITE_PANOSE_SERIF_STYLE_ROUNDED = 0xF, // 15 + DWRITE_PANOSE_SERIF_STYLE_SCRIPT = 0x10, // 16 + DWRITE_PANOSE_SERIF_STYLE_PERP_SANS = 0xD, // 13 + DWRITE_PANOSE_SERIF_STYLE_BONE = 0x8, // 8 +}} +ENUM!{enum DWRITE_PANOSE_WEIGHT { + DWRITE_PANOSE_WEIGHT_ANY = 0x0, // 0 + DWRITE_PANOSE_WEIGHT_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_WEIGHT_VERY_LIGHT = 0x2, // 2 + DWRITE_PANOSE_WEIGHT_LIGHT = 0x3, // 3 + DWRITE_PANOSE_WEIGHT_THIN = 0x4, // 4 + DWRITE_PANOSE_WEIGHT_BOOK = 0x5, // 5 + DWRITE_PANOSE_WEIGHT_MEDIUM = 0x6, // 6 + DWRITE_PANOSE_WEIGHT_DEMI = 0x7, // 7 + DWRITE_PANOSE_WEIGHT_BOLD = 0x8, // 8 + DWRITE_PANOSE_WEIGHT_HEAVY = 0x9, // 9 + DWRITE_PANOSE_WEIGHT_BLACK = 0xA, // 10 + DWRITE_PANOSE_WEIGHT_EXTRA_BLACK = 0xB, // 11 + DWRITE_PANOSE_WEIGHT_NORD = 0xB, // 11 +}} +ENUM!{enum DWRITE_PANOSE_PROPORTION { + DWRITE_PANOSE_PROPORTION_ANY = 0x0, // 0 + DWRITE_PANOSE_PROPORTION_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_PROPORTION_OLD_STYLE = 0x2, // 2 + DWRITE_PANOSE_PROPORTION_MODERN = 0x3, // 3 + DWRITE_PANOSE_PROPORTION_EVEN_WIDTH = 0x4, // 4 + DWRITE_PANOSE_PROPORTION_EXPANDED = 0x5, // 5 + DWRITE_PANOSE_PROPORTION_CONDENSED = 0x6, // 6 + DWRITE_PANOSE_PROPORTION_VERY_EXPANDED = 0x7, // 7 + DWRITE_PANOSE_PROPORTION_VERY_CONDENSED = 0x8, // 8 + DWRITE_PANOSE_PROPORTION_MONOSPACED = 0x9, // 9 +}} +ENUM!{enum DWRITE_PANOSE_CONTRAST { + DWRITE_PANOSE_CONTRAST_ANY = 0x0, // 0 + DWRITE_PANOSE_CONTRAST_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_CONTRAST_NONE = 0x2, // 2 + DWRITE_PANOSE_CONTRAST_VERY_LOW = 0x3, // 3 + DWRITE_PANOSE_CONTRAST_LOW = 0x4, // 4 + DWRITE_PANOSE_CONTRAST_MEDIUM_LOW = 0x5, // 5 + DWRITE_PANOSE_CONTRAST_MEDIUM = 0x6, // 6 + DWRITE_PANOSE_CONTRAST_MEDIUM_HIGH = 0x7, // 7 + DWRITE_PANOSE_CONTRAST_HIGH = 0x8, // 8 + DWRITE_PANOSE_CONTRAST_VERY_HIGH = 0x9, // 9 + DWRITE_PANOSE_CONTRAST_HORIZONTAL_LOW = 0xA, // 10 + DWRITE_PANOSE_CONTRAST_HORIZONTAL_MEDIUM = 0xB, // 11 + DWRITE_PANOSE_CONTRAST_HORIZONTAL_HIGH = 0xC, // 12 + DWRITE_PANOSE_CONTRAST_BROKEN = 0xD, // 13 +}} +ENUM!{enum DWRITE_PANOSE_STROKE_VARIATION { + DWRITE_PANOSE_STROKE_VARIATION_ANY = 0x0, // 0 + DWRITE_PANOSE_STROKE_VARIATION_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_STROKE_VARIATION_NO_VARIATION = 0x2, // 2 + DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_DIAGONAL = 0x3, // 3 + DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_TRANSITIONAL = 0x4, // 4 + DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_VERTICAL = 0x5, // 5 + DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_HORIZONTAL = 0x6, // 6 + DWRITE_PANOSE_STROKE_VARIATION_RAPID_VERTICAL = 0x7, // 7 + DWRITE_PANOSE_STROKE_VARIATION_RAPID_HORIZONTAL = 0x8, // 8 + DWRITE_PANOSE_STROKE_VARIATION_INSTANT_VERTICAL = 0x9, // 9 + DWRITE_PANOSE_STROKE_VARIATION_INSTANT_HORIZONTAL = 0xA, // 10 +}} +ENUM!{enum DWRITE_PANOSE_ARM_STYLE { + DWRITE_PANOSE_ARM_STYLE_ANY = 0x0, // 0 + DWRITE_PANOSE_ARM_STYLE_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORIZONTAL = 0x2, // 2 + DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_WEDGE = 0x3, // 3 + DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL = 0x4, // 4 + DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_SINGLE_SERIF = 0x5, // 5 + DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_DOUBLE_SERIF = 0x6, // 6 + DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_HORIZONTAL = 0x7, // 7 + DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_WEDGE = 0x8, // 8 + DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_VERTICAL = 0x9, // 9 + DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_SINGLE_SERIF = 0xA, // 10 + DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_DOUBLE_SERIF = 0xB, // 11 + DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORZ = 0x2, // 2 + DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERT = 0x4, // 4 + DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_HORZ = 0x7, // 7 + DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_WEDGE = 0x8, // 8 + DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_VERT = 0x9, // 9 + DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_SINGLE_SERIF = 0xA, // 10 + DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_DOUBLE_SERIF = 0xB, // 11 +}} +ENUM!{enum DWRITE_PANOSE_LETTERFORM { + DWRITE_PANOSE_LETTERFORM_ANY = 0x0, // 0 + DWRITE_PANOSE_LETTERFORM_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_LETTERFORM_NORMAL_CONTACT = 0x2, // 2 + DWRITE_PANOSE_LETTERFORM_NORMAL_WEIGHTED = 0x3, // 3 + DWRITE_PANOSE_LETTERFORM_NORMAL_BOXED = 0x4, // 4 + DWRITE_PANOSE_LETTERFORM_NORMAL_FLATTENED = 0x5, // 5 + DWRITE_PANOSE_LETTERFORM_NORMAL_ROUNDED = 0x6, // 6 + DWRITE_PANOSE_LETTERFORM_NORMAL_OFF_CENTER = 0x7, // 7 + DWRITE_PANOSE_LETTERFORM_NORMAL_SQUARE = 0x8, // 8 + DWRITE_PANOSE_LETTERFORM_OBLIQUE_CONTACT = 0x9, // 9 + DWRITE_PANOSE_LETTERFORM_OBLIQUE_WEIGHTED = 0xA, // 10 + DWRITE_PANOSE_LETTERFORM_OBLIQUE_BOXED = 0xB, // 11 + DWRITE_PANOSE_LETTERFORM_OBLIQUE_FLATTENED = 0xC, // 12 + DWRITE_PANOSE_LETTERFORM_OBLIQUE_ROUNDED = 0xD, // 13 + DWRITE_PANOSE_LETTERFORM_OBLIQUE_OFF_CENTER = 0xE, // 14 + DWRITE_PANOSE_LETTERFORM_OBLIQUE_SQUARE = 0xF, // 15 +}} +ENUM!{enum DWRITE_PANOSE_MIDLINE { + DWRITE_PANOSE_MIDLINE_ANY = 0x0, // 0 + DWRITE_PANOSE_MIDLINE_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_MIDLINE_STANDARD_TRIMMED = 0x2, // 2 + DWRITE_PANOSE_MIDLINE_STANDARD_POINTED = 0x3, // 3 + DWRITE_PANOSE_MIDLINE_STANDARD_SERIFED = 0x4, // 4 + DWRITE_PANOSE_MIDLINE_HIGH_TRIMMED = 0x5, // 5 + DWRITE_PANOSE_MIDLINE_HIGH_POINTED = 0x6, // 6 + DWRITE_PANOSE_MIDLINE_HIGH_SERIFED = 0x7, // 7 + DWRITE_PANOSE_MIDLINE_CONSTANT_TRIMMED = 0x8, // 8 + DWRITE_PANOSE_MIDLINE_CONSTANT_POINTED = 0x9, // 9 + DWRITE_PANOSE_MIDLINE_CONSTANT_SERIFED = 0xA, // 10 + DWRITE_PANOSE_MIDLINE_LOW_TRIMMED = 0xB, // 11 + DWRITE_PANOSE_MIDLINE_LOW_POINTED = 0xC, // 12 + DWRITE_PANOSE_MIDLINE_LOW_SERIFED = 0xD, // 13 +}} +ENUM!{enum DWRITE_PANOSE_XHEIGHT { + DWRITE_PANOSE_XHEIGHT_ANY = 0x0, // 0 + DWRITE_PANOSE_XHEIGHT_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_XHEIGHT_CONSTANT_SMALL = 0x2, // 2 + DWRITE_PANOSE_XHEIGHT_CONSTANT_STANDARD = 0x3, // 3 + DWRITE_PANOSE_XHEIGHT_CONSTANT_LARGE = 0x4, // 4 + DWRITE_PANOSE_XHEIGHT_DUCKING_SMALL = 0x5, // 5 + DWRITE_PANOSE_XHEIGHT_DUCKING_STANDARD = 0x6, // 6 + DWRITE_PANOSE_XHEIGHT_DUCKING_LARGE = 0x7, // 7 + DWRITE_PANOSE_XHEIGHT_CONSTANT_STD = 0x3, // 3 + DWRITE_PANOSE_XHEIGHT_DUCKING_STD = 0x6, // 6 +}} +ENUM!{enum DWRITE_PANOSE_TOOL_KIND { + DWRITE_PANOSE_TOOL_KIND_ANY = 0x0, // 0 + DWRITE_PANOSE_TOOL_KIND_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_TOOL_KIND_FLAT_NIB = 0x2, // 2 + DWRITE_PANOSE_TOOL_KIND_PRESSURE_POINT = 0x3, // 3 + DWRITE_PANOSE_TOOL_KIND_ENGRAVED = 0x4, // 4 + DWRITE_PANOSE_TOOL_KIND_BALL = 0x5, // 5 + DWRITE_PANOSE_TOOL_KIND_BRUSH = 0x6, // 6 + DWRITE_PANOSE_TOOL_KIND_ROUGH = 0x7, // 7 + DWRITE_PANOSE_TOOL_KIND_FELT_PEN_BRUSH_TIP = 0x8, // 8 + DWRITE_PANOSE_TOOL_KIND_WILD_BRUSH = 0x9, // 9 +}} +ENUM!{enum DWRITE_PANOSE_SPACING { + DWRITE_PANOSE_SPACING_ANY = 0x0, // 0 + DWRITE_PANOSE_SPACING_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_SPACING_PROPORTIONAL_SPACED = 0x2, // 2 + DWRITE_PANOSE_SPACING_MONOSPACED = 0x3, // 3 +}} +ENUM!{enum DWRITE_PANOSE_ASPECT_RATIO { + DWRITE_PANOSE_ASPECT_RATIO_ANY = 0x0, // 0 + DWRITE_PANOSE_ASPECT_RATIO_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_ASPECT_RATIO_VERY_CONDENSED = 0x2, // 2 + DWRITE_PANOSE_ASPECT_RATIO_CONDENSED = 0x3, // 3 + DWRITE_PANOSE_ASPECT_RATIO_NORMAL = 0x4, // 4 + DWRITE_PANOSE_ASPECT_RATIO_EXPANDED = 0x5, // 5 + DWRITE_PANOSE_ASPECT_RATIO_VERY_EXPANDED = 0x6, // 6 +}} +ENUM!{enum DWRITE_PANOSE_SCRIPT_TOPOLOGY { + DWRITE_PANOSE_SCRIPT_TOPOLOGY_ANY = 0x0, // 0 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_DISCONNECTED = 0x2, // 2 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_TRAILING = 0x3, // 3 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_CONNECTED = 0x4, // 4 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_DISCONNECTED = 0x5, // 5 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_TRAILING = 0x6, // 6 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_CONNECTED = 0x7, // 7 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_DISCONNECTED = 0x8, // 8 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_TRAILING = 0x9, // 9 + DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_CONNECTED = 0xA, // 10 +}} +ENUM!{enum DWRITE_PANOSE_SCRIPT_FORM { + DWRITE_PANOSE_SCRIPT_FORM_ANY = 0x0, // 0 + DWRITE_PANOSE_SCRIPT_FORM_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_NO_WRAPPING = 0x2, // 2 + DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_SOME_WRAPPING = 0x3, // 3 + DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_MORE_WRAPPING = 0x4, // 4 + DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_EXTREME_WRAPPING = 0x5, // 5 + DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_NO_WRAPPING = 0x6, // 6 + DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_SOME_WRAPPING = 0x7, // 7 + DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_MORE_WRAPPING = 0x8, // 8 + DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_EXTREME_WRAPPING = 0x9, // 9 + DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_NO_WRAPPING = 0xA, // 10 + DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_SOME_WRAPPING = 0xB, // 11 + DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_MORE_WRAPPING = 0xC, // 12 + DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_EXTREME_WRAPPING = 0xD, // 13 +}} +ENUM!{enum DWRITE_PANOSE_FINIALS { + DWRITE_PANOSE_FINIALS_ANY = 0x0, // 0 + DWRITE_PANOSE_FINIALS_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_FINIALS_NONE_NO_LOOPS = 0x2, // 2 + DWRITE_PANOSE_FINIALS_NONE_CLOSED_LOOPS = 0x3, // 3 + DWRITE_PANOSE_FINIALS_NONE_OPEN_LOOPS = 0x4, // 4 + DWRITE_PANOSE_FINIALS_SHARP_NO_LOOPS = 0x5, // 5 + DWRITE_PANOSE_FINIALS_SHARP_CLOSED_LOOPS = 0x6, // 6 + DWRITE_PANOSE_FINIALS_SHARP_OPEN_LOOPS = 0x7, // 7 + DWRITE_PANOSE_FINIALS_TAPERED_NO_LOOPS = 0x8, // 8 + DWRITE_PANOSE_FINIALS_TAPERED_CLOSED_LOOPS = 0x9, // 9 + DWRITE_PANOSE_FINIALS_TAPERED_OPEN_LOOPS = 0xA, // 10 + DWRITE_PANOSE_FINIALS_ROUND_NO_LOOPS = 0xB, // 11 + DWRITE_PANOSE_FINIALS_ROUND_CLOSED_LOOPS = 0xC, // 12 + DWRITE_PANOSE_FINIALS_ROUND_OPEN_LOOPS = 0xD, // 13 +}} +ENUM!{enum DWRITE_PANOSE_XASCENT { + DWRITE_PANOSE_XASCENT_ANY = 0x0, // 0 + DWRITE_PANOSE_XASCENT_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_XASCENT_VERY_LOW = 0x2, // 2 + DWRITE_PANOSE_XASCENT_LOW = 0x3, // 3 + DWRITE_PANOSE_XASCENT_MEDIUM = 0x4, // 4 + DWRITE_PANOSE_XASCENT_HIGH = 0x5, // 5 + DWRITE_PANOSE_XASCENT_VERY_HIGH = 0x6, // 6 +}} +ENUM!{enum DWRITE_PANOSE_DECORATIVE_CLASS { + DWRITE_PANOSE_DECORATIVE_CLASS_ANY = 0x0, // 0 + DWRITE_PANOSE_DECORATIVE_CLASS_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_DECORATIVE_CLASS_DERIVATIVE = 0x2, // 2 + DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_TOPOLOGY = 0x3, // 3 + DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ELEMENTS = 0x4, // 4 + DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ASPECT = 0x5, // 5 + DWRITE_PANOSE_DECORATIVE_CLASS_INITIALS = 0x6, // 6 + DWRITE_PANOSE_DECORATIVE_CLASS_CARTOON = 0x7, // 7 + DWRITE_PANOSE_DECORATIVE_CLASS_PICTURE_STEMS = 0x8, // 8 + DWRITE_PANOSE_DECORATIVE_CLASS_ORNAMENTED = 0x9, // 9 + DWRITE_PANOSE_DECORATIVE_CLASS_TEXT_AND_BACKGROUND = 0xA, // 10 + DWRITE_PANOSE_DECORATIVE_CLASS_COLLAGE = 0xB, // 11 + DWRITE_PANOSE_DECORATIVE_CLASS_MONTAGE = 0xC, // 12 +}} +ENUM!{enum DWRITE_PANOSE_ASPECT { + DWRITE_PANOSE_ASPECT_ANY = 0x0, // 0 + DWRITE_PANOSE_ASPECT_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_ASPECT_SUPER_CONDENSED = 0x2, // 2 + DWRITE_PANOSE_ASPECT_VERY_CONDENSED = 0x3, // 3 + DWRITE_PANOSE_ASPECT_CONDENSED = 0x4, // 4 + DWRITE_PANOSE_ASPECT_NORMAL = 0x5, // 5 + DWRITE_PANOSE_ASPECT_EXTENDED = 0x6, // 6 + DWRITE_PANOSE_ASPECT_VERY_EXTENDED = 0x7, // 7 + DWRITE_PANOSE_ASPECT_SUPER_EXTENDED = 0x8, // 8 + DWRITE_PANOSE_ASPECT_MONOSPACED = 0x9, // 9 +}} +ENUM!{enum DWRITE_PANOSE_FILL { + DWRITE_PANOSE_FILL_ANY = 0x0, // 0 + DWRITE_PANOSE_FILL_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_FILL_STANDARD_SOLID_FILL = 0x2, // 2 + DWRITE_PANOSE_FILL_NO_FILL = 0x3, // 3 + DWRITE_PANOSE_FILL_PATTERNED_FILL = 0x4, // 4 + DWRITE_PANOSE_FILL_COMPLEX_FILL = 0x5, // 5 + DWRITE_PANOSE_FILL_SHAPED_FILL = 0x6, // 6 + DWRITE_PANOSE_FILL_DRAWN_DISTRESSED = 0x7, // 7 +}} +ENUM!{enum DWRITE_PANOSE_LINING { + DWRITE_PANOSE_LINING_ANY = 0x0, // 0 + DWRITE_PANOSE_LINING_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_LINING_NONE = 0x2, // 2 + DWRITE_PANOSE_LINING_INLINE = 0x3, // 3 + DWRITE_PANOSE_LINING_OUTLINE = 0x4, // 4 + DWRITE_PANOSE_LINING_ENGRAVED = 0x5, // 5 + DWRITE_PANOSE_LINING_SHADOW = 0x6, // 6 + DWRITE_PANOSE_LINING_RELIEF = 0x7, // 7 + DWRITE_PANOSE_LINING_BACKDROP = 0x8, // 8 +}} +ENUM!{enum DWRITE_PANOSE_DECORATIVE_TOPOLOGY { + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ANY = 0x0, // 0 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_STANDARD = 0x2, // 2 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SQUARE = 0x3, // 3 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_MULTIPLE_SEGMENT = 0x4, // 4 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ART_DECO = 0x5, // 5 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UNEVEN_WEIGHTING = 0x6, // 6 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_ARMS = 0x7, // 7 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_FORMS = 0x8, // 8 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_LOMBARDIC_FORMS = 0x9, // 9 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UPPER_CASE_IN_LOWER_CASE = 0xA, // 10 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_IMPLIED_TOPOLOGY = 0xB, // 11 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_HORSESHOE_E_AND_A = 0xC, // 12 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_CURSIVE = 0xD, // 13 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_BLACKLETTER = 0xE, // 14 + DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SWASH_VARIANCE = 0xF, // 15 +}} +ENUM!{enum DWRITE_PANOSE_CHARACTER_RANGES { + DWRITE_PANOSE_CHARACTER_RANGES_ANY = 0x0, // 0 + DWRITE_PANOSE_CHARACTER_RANGES_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_CHARACTER_RANGES_EXTENDED_COLLECTION = 0x2, // 2 + DWRITE_PANOSE_CHARACTER_RANGES_LITERALS = 0x3, // 3 + DWRITE_PANOSE_CHARACTER_RANGES_NO_LOWER_CASE = 0x4, // 4 + DWRITE_PANOSE_CHARACTER_RANGES_SMALL_CAPS = 0x5, // 5 +}} +ENUM!{enum DWRITE_PANOSE_SYMBOL_KIND { + DWRITE_PANOSE_SYMBOL_KIND_ANY = 0x0, // 0 + DWRITE_PANOSE_SYMBOL_KIND_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_SYMBOL_KIND_MONTAGES = 0x2, // 2 + DWRITE_PANOSE_SYMBOL_KIND_PICTURES = 0x3, // 3 + DWRITE_PANOSE_SYMBOL_KIND_SHAPES = 0x4, // 4 + DWRITE_PANOSE_SYMBOL_KIND_SCIENTIFIC = 0x5, // 5 + DWRITE_PANOSE_SYMBOL_KIND_MUSIC = 0x6, // 6 + DWRITE_PANOSE_SYMBOL_KIND_EXPERT = 0x7, // 7 + DWRITE_PANOSE_SYMBOL_KIND_PATTERNS = 0x8, // 8 + DWRITE_PANOSE_SYMBOL_KIND_BOARDERS = 0x9, // 9 + DWRITE_PANOSE_SYMBOL_KIND_ICONS = 0xA, // 10 + DWRITE_PANOSE_SYMBOL_KIND_LOGOS = 0xB, // 11 + DWRITE_PANOSE_SYMBOL_KIND_INDUSTRY_SPECIFIC = 0xC, // 12 +}} +ENUM!{enum DWRITE_PANOSE_SYMBOL_ASPECT_RATIO { + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_ANY = 0x0, // 0 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_FIT = 0x1, // 1 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_WIDTH = 0x2, // 2 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_EXCEPTIONALLY_WIDE = 0x3, // 3 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_SUPER_WIDE = 0x4, // 4 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_WIDE = 0x5, // 5 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_WIDE = 0x6, // 6 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NORMAL = 0x7, // 7 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NARROW = 0x8, // 8 + DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_NARROW = 0x9, // 9 +}} +ENUM!{enum DWRITE_OUTLINE_THRESHOLD { + DWRITE_OUTLINE_THRESHOLD_ANTIALIASED = 0x0, // 0 + DWRITE_OUTLINE_THRESHOLD_ALIASED = 0x1, // 1 +}} +ENUM!{enum DWRITE_BASELINE { + DWRITE_BASELINE_DEFAULT = 0x0, // 0 + DWRITE_BASELINE_ROMAN = 0x1, // 1 + DWRITE_BASELINE_CENTRAL = 0x2, // 2 + DWRITE_BASELINE_MATH = 0x3, // 3 + DWRITE_BASELINE_HANGING = 0x4, // 4 + DWRITE_BASELINE_IDEOGRAPHIC_BOTTOM = 0x5, // 5 + DWRITE_BASELINE_IDEOGRAPHIC_TOP = 0x6, // 6 + DWRITE_BASELINE_MINIMUM = 0x7, // 7 + DWRITE_BASELINE_MAXIMUM = 0x8, // 8 +}} +ENUM!{enum DWRITE_VERTICAL_GLYPH_ORIENTATION { + DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT = 0x0, // 0 + DWRITE_VERTICAL_GLYPH_ORIENTATION_STACKED = 0x1, // 1 +}} +ENUM!{enum DWRITE_GLYPH_ORIENTATION_ANGLE { + DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES = 0x0, // 0 + DWRITE_GLYPH_ORIENTATION_ANGLE_90_DEGREES = 0x1, // 1 + DWRITE_GLYPH_ORIENTATION_ANGLE_180_DEGREES = 0x2, // 2 + DWRITE_GLYPH_ORIENTATION_ANGLE_270_DEGREES = 0x3, // 3 +}} +STRUCT!{struct DWRITE_FONT_METRICS1 { + designUnitsPerEm: UINT16, + ascent: UINT16, + descent: UINT16, + lineGap: INT16, + capHeight: UINT16, + xHeight: UINT16, + underlinePosition: INT16, + underlineThickness: UINT16, + strikethroughPosition: INT16, + strikethroughThickness: UINT16, + glyphBoxLeft: INT16, + glyphBoxTop: INT16, + glyphBoxRight: INT16, + glyphBoxBottom: INT16, + subscriptPositionX: INT16, + subscriptPositionY: INT16, + subscriptSizeX: INT16, + subscriptSizeY: INT16, + superscriptPositionX: INT16, + superscriptPositionY: INT16, + superscriptSizeX: INT16, + superscriptSizeY: INT16, + hasTypographicMetrics: BOOL, +}} +STRUCT!{struct DWRITE_CARET_METRICS { + slopeRise: INT16, + slopeRun: INT16, + offset: INT16, +}} +STRUCT!{struct DWRITE_PANOSE_text { + familyKind: UINT8, + serifStyle: UINT8, + weight: UINT8, + proportion: UINT8, + contrast: UINT8, + strokeVariation: UINT8, + armStyle: UINT8, + letterform: UINT8, + midline: UINT8, + xHeight: UINT8, +}} +STRUCT!{struct DWRITE_PANOSE_script { + familyKind: UINT8, + toolKind: UINT8, + weight: UINT8, + spacing: UINT8, + aspectRatio: UINT8, + contrast: UINT8, + scriptTopology: UINT8, + scriptForm: UINT8, + finials: UINT8, + xAscent: UINT8, +}} +STRUCT!{struct DWRITE_PANOSE_decorative { + familyKind: UINT8, + decorativeClass: UINT8, + weight: UINT8, + aspect: UINT8, + contrast: UINT8, + serifVariant: UINT8, + fill: UINT8, + lining: UINT8, + decorativeTopology: UINT8, + characterRange: UINT8, +}} +STRUCT!{struct DWRITE_PANOSE_symbol { + familyKind: UINT8, + symbolKind: UINT8, + weight: UINT8, + spacing: UINT8, + aspectRatioAndContrast: UINT8, + aspectRatio94: UINT8, + aspectRatio119: UINT8, + aspectRatio157: UINT8, + aspectRatio163: UINT8, + aspectRatio211: UINT8, +}} +UNION!{union DWRITE_PANOSE { + [u8; 10], + values values_mut: [UINT8; 10], + familyKind familyKind_mut: UINT8, + text text_mut: DWRITE_PANOSE_text, + script script_mut: DWRITE_PANOSE_script, + decorative decorative_mut: DWRITE_PANOSE_decorative, + symbol symbol_mut: DWRITE_PANOSE_symbol, +}} +STRUCT!{struct DWRITE_UNICODE_RANGE { + first: UINT32, + last: UINT32, +}} +STRUCT!{struct DWRITE_SCRIPT_PROPERTIES { + isoScriptCode: UINT32, + isoScriptNumber: UINT32, + clusterLookahead: UINT32, + justificationCharacter: UINT32, + bitfield0: UINT32, +}} +BITFIELD!{DWRITE_SCRIPT_PROPERTIES bitfield0: UINT32 [ + restrictCaretToClusters set_restrictCaretToClusters[0..1], + usesWordDividers set_usesWordDividers[1..2], + isDiscreteWriting set_isDiscreteWriting[2..3], + isBlockWriting set_isBlockWriting[3..4], + isDistributedWithinCluster set_isDistributedWithinCluster[4..5], + isConnectedWriting set_isConnectedWriting[5..6], + isCursiveWriting set_isCursiveWriting[6..7], + reserved set_reserved[7..32], +]} +STRUCT!{struct DWRITE_JUSTIFICATION_OPPORTUNITY { + expansionMinimum: FLOAT, + expansionMaximum: FLOAT, + compressionMaximum: FLOAT, + bitfield0: UINT32, +}} +BITFIELD!{DWRITE_JUSTIFICATION_OPPORTUNITY bitfield0: UINT32 [ + expansionPriority set_expansionPriority[0..8], + compressionPriority set_compressionPriority[8..16], + allowResidualExpansion set_allowResidualExpansion[16..17], + allowResidualCompression set_allowResidualCompression[17..18], + applyToLeadingEdge set_applyToLeadingEdge[18..19], + applyToTrailingEdge set_applyToTrailingEdge[19..20], + reserved set_reserved[20..32], +]} +RIDL!{#[uuid(0x30572f99, 0xdac6, 0x41db, 0xa1, 0x6e, 0x04, 0x86, 0x30, 0x7e, 0x60, 0x6a)] +interface IDWriteFactory1(IDWriteFactory1Vtbl): IDWriteFactory(IDWriteFactoryVtbl) { + fn GetEudcFontCollection( + fontCollection: *mut *mut IDWriteFontCollection, + checkForUpdates: BOOL, + ) -> HRESULT, + fn CreateCustomRenderingParams( + gamma: FLOAT, + enhancedContrast: FLOAT, + enhancedContrastGrayscale: FLOAT, + clearTypeLevel: FLOAT, + pixelGeometry: DWRITE_PIXEL_GEOMETRY, + renderingMode: DWRITE_RENDERING_MODE, + renderingParams: *mut *mut IDWriteRenderingParams1, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xa71efdb4, 0x9fdb, 0x4838, 0xad, 0x90, 0xcf, 0xc3, 0xbe, 0x8c, 0x3d, 0xaf)] +interface IDWriteFontFace1(IDWriteFontFace1Vtbl): IDWriteFontFace(IDWriteFontFaceVtbl) { + fn GetMetrics( + fontMetrics: *mut DWRITE_FONT_METRICS1, + ) -> (), + fn GetGdiCompatibleMetrics( + emSize: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + fontMetrics: *mut DWRITE_FONT_METRICS1, + ) -> HRESULT, + fn GetCaretMetrics( + caretMetrics: *mut DWRITE_CARET_METRICS, + ) -> (), + fn GetUnicodeRanges( + maxRangeCount: UINT32, + unicodeRanges: *mut DWRITE_UNICODE_RANGE, + actualRangeCount: *mut UINT32, + ) -> HRESULT, + fn IsMonospacedFont() -> BOOL, + fn GetDesignGlyphAdvances( + glyphCount: UINT32, + glyphIndices: *const UINT16, + glyphAdvances: *mut INT32, + isSideways: BOOL, + ) -> HRESULT, + fn GetGdiCompatibleGlyphAdvances( + emSize: FLOAT, + pixelsPerDip: FLOAT, + transform: *const DWRITE_MATRIX, + useGdiNatural: BOOL, + isSideways: BOOL, + glyphCount: UINT32, + glyphIndices: *const UINT16, + glyphAdvances: *mut INT32, + ) -> HRESULT, + fn GetKerningPairAdjustments( + glyphCount: UINT32, + glyphIndices: *const UINT16, + glyphAdvanceAdjustments: *mut INT32, + ) -> HRESULT, + fn HasKerningPairs() -> BOOL, + fn GetRecommendedRenderingMode( + fontEmSize: FLOAT, + dpiX: FLOAT, + dpiY: FLOAT, + transform: *const DWRITE_MATRIX, + isSideways: BOOL, + outlineThreshold: DWRITE_OUTLINE_THRESHOLD, + measuringMode: DWRITE_MEASURING_MODE, + renderingMode: *mut DWRITE_RENDERING_MODE, + ) -> HRESULT, + fn GetVerticalGlyphVariants( + glyphCount: UINT32, + nominalGlyphIndices: *const UINT16, + verticalGlyphIndices: *mut UINT16, + ) -> HRESULT, + fn HasVerticalGlyphVariants() -> BOOL, +}} +RIDL!{#[uuid(0xacd16696, 0x8c14, 0x4f5d, 0x87, 0x7e, 0xfe, 0x3f, 0xc1, 0xd3, 0x27, 0x38)] +interface IDWriteFont1(IDWriteFont1Vtbl): IDWriteFont(IDWriteFontVtbl) { + fn GetMetrics( + fontMetrics: *mut DWRITE_FONT_METRICS1, + ) -> (), + fn GetPanose( + panose: *mut DWRITE_PANOSE, + ) -> (), + fn GetUnicodeRanges( + maxRangeCount: UINT32, + unicodeRanges: *mut DWRITE_UNICODE_RANGE, + actualRangeCount: *mut UINT32, + ) -> HRESULT, + fn IsMonospacedFont() -> BOOL, +}} +RIDL!{#[uuid(0x94413cf4, 0xa6fc, 0x4248, 0x8b, 0x50, 0x66, 0x74, 0x34, 0x8f, 0xca, 0xd3)] +interface IDWriteRenderingParams1(IDWriteRenderingParams1Vtbl): + IDWriteRenderingParams(IDWriteRenderingParamsVtbl) { + fn GetGrayscaleEnhancedContrast() -> FLOAT, +}} +RIDL!{#[uuid(0x80dad800, 0xe21f, 0x4e83, 0x96, 0xce, 0xbf, 0xcc, 0xe5, 0x00, 0xdb, 0x7c)] +interface IDWriteTextAnalyzer1(IDWriteTextAnalyzer1Vtbl): + IDWriteTextAnalyzer(IDWriteTextAnalyzerVtbl) { + fn ApplyCharacterSpacing( + leadingSpacing: FLOAT, + trailingSpacing: FLOAT, + minimumAdvanceWidth: FLOAT, + textLength: UINT32, + glyphCount: UINT32, + clusterMap: *const UINT16, + glyphAdvances: *const FLOAT, + glyphOffsets: *const DWRITE_GLYPH_OFFSET, + glyphProperties: *const DWRITE_SHAPING_GLYPH_PROPERTIES, + modifiedGlyphAdvances: *mut FLOAT, + modifiedGlyphOffsets: *mut DWRITE_GLYPH_OFFSET, + ) -> HRESULT, + fn GetBaseline( + fontFace: *mut IDWriteFontFace, + baseline: DWRITE_BASELINE, + isVertical: BOOL, + isSimulationAllowed: BOOL, + scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, + localeName: *const WCHAR, + baselineCoordinate: *mut INT32, + exists: *mut BOOL, + ) -> HRESULT, + fn AnalyzeVerticalGlyphOrientation( + analysisSource: *mut IDWriteTextAnalysisSource1, + textPosition: UINT32, + textLength: UINT32, + analysisSink: *mut IDWriteTextAnalysisSink1, + ) -> HRESULT, + fn GetGlyphOrientationTransform( + glyphOrientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, + isSideways: BOOL, + transform: *mut DWRITE_MATRIX, + ) -> HRESULT, + fn GetScriptProperties( + scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, + scriptProperties: *mut DWRITE_SCRIPT_PROPERTIES, + ) -> HRESULT, + fn GetTextComplexity( + textString: *const WCHAR, + textLength: UINT32, + fontFace: *mut IDWriteFontFace, + isTextSimple: *mut BOOL, + textLengthRead: *mut UINT32, + glyphIndices: *mut UINT16, + ) -> HRESULT, + fn GetJustificationOpportunities( + fontFace: *mut IDWriteFontFace, + fontEmSize: FLOAT, + scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, + textLength: UINT32, + glyphCount: UINT32, + textString: *const WCHAR, + clusterMap: *const UINT16, + glyphProperties: *const DWRITE_SHAPING_GLYPH_PROPERTIES, + justificationOpportunities: *mut DWRITE_JUSTIFICATION_OPPORTUNITY, + ) -> HRESULT, + fn JustifyGlyphAdvances( + lineWidth: FLOAT, + glyphCount: UINT32, + justificationOpportunities: *const DWRITE_JUSTIFICATION_OPPORTUNITY, + glyphAdvances: *const FLOAT, + glyphOffsets: *const DWRITE_GLYPH_OFFSET, + justifiedGlyphAdvances: *mut FLOAT, + justifiedGlyphOffsets: *mut DWRITE_GLYPH_OFFSET, + ) -> HRESULT, + fn GetJustifiedGlyphs( + fontFace: *mut IDWriteFontFace, + fontEmSize: FLOAT, + scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, + textLength: UINT32, + glyphCount: UINT32, + maxGlyphCount: UINT32, + clusterMap: *const UINT16, + glyphIndices: *const UINT16, + glyphAdvances: *const FLOAT, + justifiedGlyphAdvances: *const FLOAT, + justifiedGlyphOffsets: *const DWRITE_GLYPH_OFFSET, + glyphProperties: *const DWRITE_SHAPING_GLYPH_PROPERTIES, + actualGlyphCount: *mut UINT32, + modifiedClusterMap: *mut UINT16, + modifiedGlyphIndices: *mut UINT16, + modifiedGlyphAdvances: *mut FLOAT, + modifiedGlyphOffsets: *mut DWRITE_GLYPH_OFFSET, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x639cfad8, 0x0fb4, 0x4b21, 0xa5, 0x8a, 0x06, 0x79, 0x20, 0x12, 0x00, 0x09)] +interface IDWriteTextAnalysisSource1(IDWriteTextAnalysisSource1Vtbl): + IDWriteTextAnalysisSource(IDWriteTextAnalysisSourceVtbl) { + fn GetVerticalGlyphOrientation( + textPosition: UINT32, + textLength: *mut UINT32, + glyphOrientation: *mut DWRITE_VERTICAL_GLYPH_ORIENTATION, + bidiLevel: *mut UINT8, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xb0d941a0, 0x85e7, 0x4d8b, 0x9f, 0xd3, 0x5c, 0xed, 0x99, 0x34, 0x48, 0x2a)] +interface IDWriteTextAnalysisSink1(IDWriteTextAnalysisSink1Vtbl): + IDWriteTextAnalysisSink(IDWriteTextAnalysisSinkVtbl) { + fn SetGlyphOrientation( + textPosition: UINT32, + textLength: UINT32, + glyphOrientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, + adjustedBidiLevel: UINT8, + isSideways: BOOL, + isRightToLeft: BOOL, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x9064d822, 0x80a7, 0x465c, 0xa9, 0x86, 0xdf, 0x65, 0xf7, 0x8b, 0x8f, 0xeb)] +interface IDWriteTextLayout1(IDWriteTextLayout1Vtbl): + IDWriteTextLayout(IDWriteTextLayoutVtbl) { + fn SetPairKerning( + isPairKerningEnabled: BOOL, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetPairKerning( + currentPosition: UINT32, + isPairKerningEnabled: *mut BOOL, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn SetCharacterSpacing( + leadingSpacing: FLOAT, + trailingSpacing: FLOAT, + minimumAdvanceWidth: FLOAT, + textRange: DWRITE_TEXT_RANGE, + ) -> HRESULT, + fn GetCharacterSpacing( + currentPosition: UINT32, + leadingSpacing: *mut FLOAT, + trailingSpacing: *mut FLOAT, + minimumAdvanceWidth: *mut FLOAT, + textRange: *mut DWRITE_TEXT_RANGE, + ) -> HRESULT, +}} +ENUM!{enum DWRITE_TEXT_ANTIALIAS_MODE { + DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE = 0x0, // 0 + DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE = 0x1, // 1 +}} +RIDL!{#[uuid(0x791e8298, 0x3ef3, 0x4230, 0x98, 0x80, 0xc9, 0xbd, 0xec, 0xc4, 0x20, 0x64)] +interface IDWriteBitmapRenderTarget1(IDWriteBitmapRenderTarget1Vtbl): + IDWriteBitmapRenderTarget(IDWriteBitmapRenderTargetVtbl) { + fn GetTextAntialiasMode() -> DWRITE_TEXT_ANTIALIAS_MODE, + fn SetTextAntialiasMode( + antialiasMode: DWRITE_TEXT_ANTIALIAS_MODE, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/dwrite_2.rs b/src/vendor/winapi/src/um/dwrite_2.rs new file mode 100644 index 0000000000..e283570cfb --- /dev/null +++ b/src/vendor/winapi/src/um/dwrite_2.rs @@ -0,0 +1,294 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the content of dwrite_2.h +use ctypes::{c_void, wchar_t}; +use shared::basetsd::{UINT16, UINT32, UINT8}; +use shared::d3d9types::D3DCOLORVALUE; +use shared::minwindef::{BOOL, FLOAT}; +use um::dcommon::DWRITE_MEASURING_MODE; +use um::dwrite::{ + DWRITE_FONT_FEATURE_TAG, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, DWRITE_FONT_WEIGHT, + DWRITE_GLYPH_RUN, DWRITE_GLYPH_RUN_DESCRIPTION, DWRITE_MATRIX, DWRITE_PIXEL_GEOMETRY, + DWRITE_RENDERING_MODE, DWRITE_SCRIPT_ANALYSIS, DWRITE_STRIKETHROUGH, DWRITE_UNDERLINE, + IDWriteFont, IDWriteFontCollection, IDWriteFontFace, IDWriteGlyphRunAnalysis, + IDWriteInlineObject, IDWriteRenderingParams, IDWriteTextAnalysisSource, IDWriteTextFormat, + IDWriteTextFormatVtbl, IDWriteTextRenderer, IDWriteTextRendererVtbl, +}; +use um::dwrite_1::{ + DWRITE_GLYPH_ORIENTATION_ANGLE, DWRITE_OUTLINE_THRESHOLD, DWRITE_TEXT_ANTIALIAS_MODE, + DWRITE_UNICODE_RANGE, DWRITE_VERTICAL_GLYPH_ORIENTATION, IDWriteFactory1, + IDWriteFactory1Vtbl, IDWriteFont1, IDWriteFont1Vtbl, IDWriteFontFace1, IDWriteFontFace1Vtbl, + IDWriteRenderingParams1, IDWriteRenderingParams1Vtbl, IDWriteTextAnalyzer1, + IDWriteTextAnalyzer1Vtbl, IDWriteTextLayout1, IDWriteTextLayout1Vtbl, +}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, WCHAR}; +ENUM!{enum DWRITE_OPTICAL_ALIGNMENT { + DWRITE_OPTICAL_ALIGNMENT_NONE = 0x0, // 0 + DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS = 0x1, // 1 +}} +ENUM!{enum DWRITE_GRID_FIT_MODE { + DWRITE_GRID_FIT_MODE_DEFAULT = 0x0, // 0 + DWRITE_GRID_FIT_MODE_DISABLED = 0x1, // 1 + DWRITE_GRID_FIT_MODE_ENABLED = 0x2, // 2 +}} +STRUCT!{struct DWRITE_TEXT_METRICS1 { + left: FLOAT, + top: FLOAT, + width: FLOAT, + widthIncludingTrailingWhitespace: FLOAT, + height: FLOAT, + layoutWidth: FLOAT, + layoutHeight: FLOAT, + maxBidiReorderingDepth: UINT32, + lineCount: UINT32, + heightIncludingTrailingWhitespace: FLOAT, +}} +RIDL!{#[uuid(0xd3e0e934, 0x22a0, 0x427e, 0xaa, 0xe4, 0x7d, 0x95, 0x74, 0xb5, 0x9d, 0xb1)] +interface IDWriteTextRenderer1(IDWriteTextRenderer1Vtbl): + IDWriteTextRenderer(IDWriteTextRendererVtbl) { + fn DrawGlyphRun( + clientDrawingContext: *mut c_void, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, + measuringMode: DWRITE_MEASURING_MODE, + glyphRun: *const DWRITE_GLYPH_RUN, + glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, + fn DrawUnderline( + clientDrawingContext: *mut c_void, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, + underline: *const DWRITE_UNDERLINE, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, + fn DrawStrikethrough( + clientDrawingContext: *mut c_void, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, + strikethrough: *const DWRITE_STRIKETHROUGH, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, + fn DrawInlineObject( + clientDrawingContext: *mut c_void, + originX: FLOAT, + originY: FLOAT, + orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, + inlineObject: *mut IDWriteInlineObject, + isSideways: BOOL, + isRightToLeft: BOOL, + clientDrawingEffect: *mut IUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x5f174b49, 0x0d8b, 0x4cfb, 0x8b, 0xca, 0xf1, 0xcc, 0xe9, 0xd0, 0x6c, 0x67)] +interface IDWriteTextFormat1(IDWriteTextFormat1Vtbl): + IDWriteTextFormat(IDWriteTextFormatVtbl) { + fn SetVerticalGlyphOrientation( + glyphOrientation: DWRITE_VERTICAL_GLYPH_ORIENTATION, + ) -> HRESULT, + fn GetVerticalGlyphOrientation() -> DWRITE_VERTICAL_GLYPH_ORIENTATION, + fn SetLastLineWrapping( + isLastLineWrappingEnabled: BOOL, + ) -> HRESULT, + fn GetLastLineWrapping() -> BOOL, + fn SetOpticalAlignment( + opticalAlignment: DWRITE_OPTICAL_ALIGNMENT, + ) -> HRESULT, + fn GetOpticalAlignment() -> DWRITE_OPTICAL_ALIGNMENT, + fn SetFontFallback( + fontFallback: *mut IDWriteFontFallback, + ) -> HRESULT, + fn GetFontFallback( + fontFallback: *mut *mut IDWriteFontFallback, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x1093c18f, 0x8d5e, 0x43f0, 0xb0, 0x64, 0x09, 0x17, 0x31, 0x1b, 0x52, 0x5e)] +interface IDWriteTextLayout2(IDWriteTextLayout2Vtbl): + IDWriteTextLayout1(IDWriteTextLayout1Vtbl) { + fn GetMetrics( + textMetrics: *mut DWRITE_TEXT_METRICS1, + ) -> HRESULT, + fn SetVerticalGlyphOrientation( + glyphOrientation: DWRITE_VERTICAL_GLYPH_ORIENTATION, + ) -> HRESULT, + fn GetVerticalGlyphOrientation() -> DWRITE_VERTICAL_GLYPH_ORIENTATION, + fn SetLastLineWrapping( + isLastLineWrappingEnabled: BOOL, + ) -> HRESULT, + fn GetLastLineWrapping() -> BOOL, + fn SetOpticalAlignment( + opticalAlignment: DWRITE_OPTICAL_ALIGNMENT, + ) -> HRESULT, + fn GetOpticalAlignment() -> DWRITE_OPTICAL_ALIGNMENT, + fn SetFontFallback( + fontFallback: *mut IDWriteFontFallback, + ) -> HRESULT, + fn GetFontFallback( + fontFallback: *mut *mut IDWriteFontFallback, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x553a9ff3, 0x5693, 0x4df7, 0xb5, 0x2b, 0x74, 0x80, 0x6f, 0x7f, 0x2e, 0xb9)] +interface IDWriteTextAnalyzer2(IDWriteTextAnalyzer2Vtbl): + IDWriteTextAnalyzer1(IDWriteTextAnalyzer1Vtbl) { + fn GetGlyphOrientationTransform( + glyphOrientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, + isSideways: BOOL, + originX: FLOAT, + originY: FLOAT, + transform: *mut DWRITE_MATRIX, + ) -> HRESULT, + fn GetTypographicFeatures( + fontFace: *mut IDWriteFontFace, + scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, + localeName: *const WCHAR, + maxTagCount: UINT32, + actualTagCount: *mut UINT32, + tags: *mut DWRITE_FONT_FEATURE_TAG, + ) -> HRESULT, + fn CheckTypographicFeature( + fontFace: *mut IDWriteFontFace, + scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, + localeName: *const WCHAR, + featureTag: DWRITE_FONT_FEATURE_TAG, + glyphCount: UINT32, + glyphIndices: *const UINT16, + featureApplies: *mut UINT8, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xefa008f9, 0xf7a1, 0x48bf, 0xb0, 0x5c, 0xf2, 0x24, 0x71, 0x3c, 0xc0, 0xff)] +interface IDWriteFontFallback(IDWriteFontFallbackVtbl): IUnknown(IUnknownVtbl) { + fn MapCharacters( + analysisSource: *mut IDWriteTextAnalysisSource, + textPosition: UINT32, + textLength: UINT32, + baseFontCollection: *mut IDWriteFontCollection, + baseFamilyName: *mut wchar_t, + baseWeight: DWRITE_FONT_WEIGHT, + baseStyle: DWRITE_FONT_STYLE, + baseStretch: DWRITE_FONT_STRETCH, + mappedLength: *mut UINT32, + mappedFont: *mut *mut IDWriteFont, + scale: *mut FLOAT, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xfd882d06, 0x8aba, 0x4fb8, 0xb8, 0x49, 0x8b, 0xe8, 0xb7, 0x3e, 0x14, 0xde)] +interface IDWriteFontFallbackBuilder(IDWriteFontFallbackBuilderVtbl): + IUnknown(IUnknownVtbl) { + fn AddMapping( + ranges: *const DWRITE_UNICODE_RANGE, + rangesCount: UINT32, + targetFamilyNames: *mut *const WCHAR, + targetFamilyNamesCount: UINT32, + fontCollection: *mut IDWriteFontCollection, + localeName: *const WCHAR, + baseFamilyName: *const WCHAR, + scale: FLOAT, + ) -> HRESULT, + fn AddMappings( + fontFallback: *mut IDWriteFontFallback, + ) -> HRESULT, + fn CreateFontFallback( + fontFallback: *mut *mut IDWriteFontFallback, + ) -> HRESULT, +}} +pub type DWRITE_COLOR_F = D3DCOLORVALUE; +RIDL!{#[uuid(0x29748ed6, 0x8c9c, 0x4a6a, 0xbe, 0x0b, 0xd9, 0x12, 0xe8, 0x53, 0x89, 0x44)] +interface IDWriteFont2(IDWriteFont2Vtbl): IDWriteFont1(IDWriteFont1Vtbl) { + fn IsColorFont() -> BOOL, +}} +RIDL!{#[uuid(0xd8b768ff, 0x64bc, 0x4e66, 0x98, 0x2b, 0xec, 0x8e, 0x87, 0xf6, 0x93, 0xf7)] +interface IDWriteFontFace2(IDWriteFontFace2Vtbl): + IDWriteFontFace1(IDWriteFontFace1Vtbl) { + fn IsColorFont() -> BOOL, + fn GetColorPaletteCount() -> UINT32, + fn GetPaletteEntryCount() -> UINT32, + fn GetPaletteEntries( + colorPaletteIndex: UINT32, + firstEntryIndex: UINT32, + entryCount: UINT32, + paletteEntries: *mut DWRITE_COLOR_F, + ) -> HRESULT, + fn GetRecommendedRenderingMode( + fontEmSize: FLOAT, + dpiX: FLOAT, + dpiY: FLOAT, + transform: *const DWRITE_MATRIX, + isSideways: BOOL, + outlineThreshold: DWRITE_OUTLINE_THRESHOLD, + measuringMode: DWRITE_MEASURING_MODE, + renderingParams: *mut IDWriteRenderingParams, + renderingMode: *mut DWRITE_RENDERING_MODE, + gridFitMode: *mut DWRITE_GRID_FIT_MODE, + ) -> HRESULT, +}} +STRUCT!{struct DWRITE_COLOR_GLYPH_RUN { + glyphRun: DWRITE_GLYPH_RUN, + glyphRunDescription: *mut DWRITE_GLYPH_RUN_DESCRIPTION, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + runColor: DWRITE_COLOR_F, + paletteIndex: UINT16, +}} +RIDL!{#[uuid(0xd31fbe17, 0xf157, 0x41a2, 0x8d, 0x24, 0xcb, 0x77, 0x9e, 0x05, 0x60, 0xe8)] +interface IDWriteColorGlyphRunEnumerator(IDWriteColorGlyphRunEnumeratorVtbl): + IUnknown(IUnknownVtbl) { + fn MoveNext( + hasRun: *mut BOOL, + ) -> HRESULT, + fn GetCurrentRun( + colorGlyphRun: *mut *const DWRITE_COLOR_GLYPH_RUN, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xf9d711c3, 0x9777, 0x40ae, 0x87, 0xe8, 0x3e, 0x5a, 0xf9, 0xbf, 0x09, 0x48)] +interface IDWriteRenderingParams2(IDWriteRenderingParams2Vtbl): + IDWriteRenderingParams1(IDWriteRenderingParams1Vtbl) { + fn GetGridFitMode() -> DWRITE_GRID_FIT_MODE, +}} +RIDL!{#[uuid(0x0439fc60, 0xca44, 0x4994, 0x8d, 0xee, 0x3a, 0x9a, 0xf7, 0xb7, 0x32, 0xec)] +interface IDWriteFactory2(IDWriteFactory2Vtbl): IDWriteFactory1(IDWriteFactory1Vtbl) { + fn GetSystemFontFallback( + fontFallback: *mut *mut IDWriteFontFallback, + ) -> HRESULT, + fn CreateFontFallbackBuilder( + fontFallbackBuilder: *mut *mut IDWriteFontFallbackBuilder, + ) -> HRESULT, + fn TranslateColorGlyphRun( + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + glyphRun: *const DWRITE_GLYPH_RUN, + glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, + measuringMode: DWRITE_MEASURING_MODE, + worldToDeviceTransform: *const DWRITE_MATRIX, + colorPaletteIndex: UINT32, + colorLayers: *mut *mut IDWriteColorGlyphRunEnumerator, + ) -> HRESULT, + fn CreateCustomRenderingParams( + gamma: FLOAT, + enhancedContrast: FLOAT, + grayscaleEnhancedContrast: FLOAT, + clearTypeLevel: FLOAT, + pixelGeometry: DWRITE_PIXEL_GEOMETRY, + renderingMode: DWRITE_RENDERING_MODE, + gridFitMode: DWRITE_GRID_FIT_MODE, + renderingParams: *mut *mut IDWriteRenderingParams2, + ) -> HRESULT, + fn CreateGlyphRunAnalysis( + glyphRun: *const DWRITE_GLYPH_RUN, + transform: *const DWRITE_MATRIX, + renderingMode: DWRITE_RENDERING_MODE, + measuringMode: DWRITE_MEASURING_MODE, + gridFitMode: DWRITE_GRID_FIT_MODE, + antialiasMode: DWRITE_TEXT_ANTIALIAS_MODE, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/dwrite_3.rs b/src/vendor/winapi/src/um/dwrite_3.rs new file mode 100644 index 0000000000..6715f7e505 --- /dev/null +++ b/src/vendor/winapi/src/um/dwrite_3.rs @@ -0,0 +1,465 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the content of dwrite_3.h +use shared::basetsd::{UINT16, UINT32, UINT64}; +use shared::minwindef::{BOOL, FILETIME, FLOAT}; +use um::dcommon::DWRITE_MEASURING_MODE; +use um::dwrite::{ + DWRITE_FONT_SIMULATIONS, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, DWRITE_FONT_WEIGHT, + DWRITE_GLYPH_RUN, DWRITE_INFORMATIONAL_STRING_ID, DWRITE_LINE_SPACING_METHOD, DWRITE_MATRIX, + DWRITE_PIXEL_GEOMETRY, DWRITE_RENDERING_MODE_ALIASED, DWRITE_RENDERING_MODE_DEFAULT, + DWRITE_RENDERING_MODE_GDI_CLASSIC, DWRITE_RENDERING_MODE_GDI_NATURAL, + DWRITE_RENDERING_MODE_NATURAL, DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + DWRITE_RENDERING_MODE_OUTLINE, IDWriteFont, IDWriteFontCollection, IDWriteFontCollectionVtbl, + IDWriteFontFace, IDWriteFontFamily, IDWriteFontFamilyVtbl, IDWriteFontFile, IDWriteFontList, + IDWriteFontListVtbl, IDWriteGdiInterop, IDWriteGdiInteropVtbl, IDWriteGlyphRunAnalysis, + IDWriteLocalizedStrings, IDWriteRenderingParams, +}; +use um::dwrite_1::{DWRITE_OUTLINE_THRESHOLD, DWRITE_PANOSE, DWRITE_TEXT_ANTIALIAS_MODE}; +use um::dwrite_2::{ + DWRITE_GRID_FIT_MODE, IDWriteFactory2, IDWriteFactory2Vtbl, IDWriteFont2, IDWriteFont2Vtbl, + IDWriteFontFace2, IDWriteFontFace2Vtbl, IDWriteRenderingParams2, IDWriteRenderingParams2Vtbl, + IDWriteTextFormat1, IDWriteTextFormat1Vtbl, IDWriteTextLayout2, IDWriteTextLayout2Vtbl, +}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::wingdi::{FONTSIGNATURE, LOGFONTW}; +use um::winnt::{HRESULT, WCHAR}; +pub const DWRITE_E_REMOTEFONT: HRESULT = 0x8898500D; +pub const DWRITE_E_DOWNLOADCANCELLED: HRESULT = 0x8898500E; +pub const DWRITE_E_DOWNLOADFAILED: HRESULT = 0x8898500F; +pub const DWRITE_E_TOOMANYDOWNLOADS: HRESULT = 0x88985010; +ENUM!{enum DWRITE_FONT_PROPERTY_ID { + DWRITE_FONT_PROPERTY_ID_NONE, + DWRITE_FONT_PROPERTY_ID_FAMILY_NAME, + DWRITE_FONT_PROPERTY_ID_PREFERRED_FAMILY_NAME, + DWRITE_FONT_PROPERTY_ID_FACE_NAME, + DWRITE_FONT_PROPERTY_ID_FULL_NAME, + DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME, + DWRITE_FONT_PROPERTY_ID_POSTSCRIPT_NAME, + DWRITE_FONT_PROPERTY_ID_DESIGN_SCRIPT_LANGUAGE_TAG, + DWRITE_FONT_PROPERTY_ID_SUPPORTED_SCRIPT_LANGUAGE_TAG, + DWRITE_FONT_PROPERTY_ID_SEMANTIC_TAG, + DWRITE_FONT_PROPERTY_ID_WEIGHT , + DWRITE_FONT_PROPERTY_ID_STRETCH, + DWRITE_FONT_PROPERTY_ID_STYLE, + DWRITE_FONT_PROPERTY_ID_TOTAL, +}} +STRUCT!{struct DWRITE_FONT_PROPERTY { + propertyId: DWRITE_FONT_PROPERTY_ID, + propertyValue: *const WCHAR, + localeName: *const WCHAR, +}} +ENUM!{enum DWRITE_LOCALITY { + DWRITE_LOCALITY_REMOTE, + DWRITE_LOCALITY_PARTIAL, + DWRITE_LOCALITY_LOCAL, +}} +ENUM!{enum DWRITE_RENDERING_MODE1 { + DWRITE_RENDERING_MODE1_DEFAULT = DWRITE_RENDERING_MODE_DEFAULT, + DWRITE_RENDERING_MODE1_ALIASED = DWRITE_RENDERING_MODE_ALIASED, + DWRITE_RENDERING_MODE1_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC, + DWRITE_RENDERING_MODE1_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL, + DWRITE_RENDERING_MODE1_NATURAL = DWRITE_RENDERING_MODE_NATURAL, + DWRITE_RENDERING_MODE1_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + DWRITE_RENDERING_MODE1_OUTLINE = DWRITE_RENDERING_MODE_OUTLINE, + DWRITE_RENDERING_MODE1_NATURAL_SYMMETRIC_DOWNSAMPLED, +}} +RIDL!{#[uuid(0xb7924baa, 0x391b, 0x412a, 0x8c, 0x5c, 0xe4, 0x4c, 0xc2, 0xd8, 0x67, 0xdc)] +interface IDWriteRenderingParams3(IDWriteRenderingParams3Vtbl): + IDWriteRenderingParams2(IDWriteRenderingParams2Vtbl) { + fn GetRenderingMode1() -> DWRITE_RENDERING_MODE1, +}} +RIDL!{#[uuid(0x9a1b41c3, 0xd3bb, 0x466a, 0x87, 0xfc, 0xfe, 0x67, 0x55, 0x6a, 0x3b, 0x65)] +interface IDWriteFactory3(IDWriteFactory3Vtbl): IDWriteFactory2(IDWriteFactory2Vtbl) { + fn CreateGlyphRunAnalysis( + glyphRun: *const DWRITE_GLYPH_RUN, + transform: *const DWRITE_MATRIX, + renderingMode: DWRITE_RENDERING_MODE1, + measuringMode: DWRITE_MEASURING_MODE, + gridFitMode: DWRITE_GRID_FIT_MODE, + antialiasMode: DWRITE_TEXT_ANTIALIAS_MODE, + baselineOriginX: FLOAT, + baselineOriginY: FLOAT, + glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis, + ) -> HRESULT, + fn CreateCustomRenderingParams( + gamma: FLOAT, + enhancedContrast: FLOAT, + grayscaleEnhancedContrast: FLOAT, + clearTypeLevel: FLOAT, + pixelGeometry: DWRITE_PIXEL_GEOMETRY, + renderingMode: DWRITE_RENDERING_MODE1, + gridFitMode: DWRITE_GRID_FIT_MODE, + renderingParams: *mut *mut IDWriteRenderingParams3, + ) -> HRESULT, + fn CreateFontFaceReference_2( + fontFile: *mut IDWriteFontFile, + faceIndex: UINT32, + fontSimulations: DWRITE_FONT_SIMULATIONS, + fontFaceReference: *mut *mut IDWriteFontFaceReference, + ) -> HRESULT, + fn CreateFontFaceReference_1( + filePath: *const WCHAR, + lastWriteTime: *const FILETIME, + faceIndex: UINT32, + fontSimulations: DWRITE_FONT_SIMULATIONS, + fontFaceReference: *mut *mut IDWriteFontFaceReference, + ) -> HRESULT, + fn GetSystemFontSet( + fontSet: *mut *mut IDWriteFontSet, + ) -> HRESULT, + fn CreateFontSetBuilder( + fontSetBuilder: *mut *mut IDWriteFontSetBuilder, + ) -> HRESULT, + fn CreateFontCollectionFromFontSet( + fontSet: *mut IDWriteFontSet, + fontCollection: *mut *mut IDWriteFontCollection1, + ) -> HRESULT, + fn GetSystemFontCollection( + includeDownloadableFonts: BOOL, + fontCollection: *mut *mut IDWriteFontCollection1, + checkForUpdates: BOOL, + ) -> HRESULT, + fn GetFontDownloadQueue( + fontDownloadQueue: *mut *mut IDWriteFontDownloadQueue, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x53585141, 0xd9f8, 0x4095, 0x83, 0x21, 0xd7, 0x3c, 0xf6, 0xbd, 0x11, 0x6b)] +interface IDWriteFontSet(IDWriteFontSetVtbl): IUnknown(IUnknownVtbl) { + fn GetFontCount() -> UINT32, + fn GetFontFaceReference( + listIndex: UINT32, + fontFaceReference: *mut *mut IDWriteFontFaceReference, + ) -> HRESULT, + fn FindFontFaceReference( + fontFaceReference: *mut IDWriteFontFaceReference, + listIndex: *mut UINT32, + exists: *mut BOOL, + ) -> HRESULT, + fn FindFontFace( + fontFace: *mut IDWriteFontFace, + listIndex: *mut UINT32, + exists: *mut BOOL, + ) -> HRESULT, + fn GetPropertyValues_3( + propertyID: DWRITE_FONT_PROPERTY_ID, + values: *mut *mut IDWriteStringList, + ) -> HRESULT, + fn GetPropertyValues_2( + propertyID: DWRITE_FONT_PROPERTY_ID, + preferredLocaleNames: *const WCHAR, + values: *mut *mut IDWriteStringList, + ) -> HRESULT, + fn GetPropertyValues_1( + listIndex: UINT32, + propertyId: DWRITE_FONT_PROPERTY_ID, + exists: *mut BOOL, + values: *mut *mut IDWriteLocalizedStrings, + ) -> HRESULT, + fn GetPropertyOccurrenceCount( + property: *const DWRITE_FONT_PROPERTY, + propertyOccurrenceCount: *mut UINT32, + ) -> HRESULT, + fn GetMatchingFonts_2( + familyName: *const WCHAR, + fontWeight: DWRITE_FONT_WEIGHT, + fontStretch: DWRITE_FONT_STRETCH, + fontStyle: DWRITE_FONT_STYLE, + filteredSet: *mut *mut IDWriteFontSet, + ) -> HRESULT, + fn GetMatchingFonts_1( + properties: *const DWRITE_FONT_PROPERTY, + propertyCount: UINT32, + filteredSet: *mut *mut IDWriteFontSet, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x2f642afe, 0x9c68, 0x4f40, 0xb8, 0xbe, 0x45, 0x74, 0x01, 0xaf, 0xcb, 0x3d)] +interface IDWriteFontSetBuilder(IDWriteFontSetBuilderVtbl): IUnknown(IUnknownVtbl) { + fn AddFontFaceReference_2( + fontFaceReference: *mut IDWriteFontFaceReference, + properties: *const DWRITE_FONT_PROPERTY, + propertyCount: UINT32, + ) -> HRESULT, + fn AddFontFaceReference_1( + fontFaceReference: *mut IDWriteFontFaceReference, + ) -> HRESULT, + fn AddFontSet( + fontSet: *mut IDWriteFontSet, + ) -> HRESULT, + fn CreateFontSet( + fontSet: *mut *mut IDWriteFontSet, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x53585141, 0xd9f8, 0x4095, 0x83, 0x21, 0xd7, 0x3c, 0xf6, 0xbd, 0x11, 0x6c)] +interface IDWriteFontCollection1(IDWriteFontCollection1Vtbl): + IDWriteFontCollection(IDWriteFontCollectionVtbl) { + fn GetFontSet( + fontSet: *mut *mut IDWriteFontSet, + ) -> HRESULT, + fn GetFontFamily( + index: UINT32, + fontFamily: *mut *mut IDWriteFontFamily1, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xda20d8ef, 0x812a, 0x4c43, 0x98, 0x02, 0x62, 0xec, 0x4a, 0xbd, 0x7a, 0xdf)] +interface IDWriteFontFamily1(IDWriteFontFamily1Vtbl): + IDWriteFontFamily(IDWriteFontFamilyVtbl) { + fn GetFontLocality( + listIndex: UINT32, + ) -> DWRITE_LOCALITY, + fn GetFont( + listIndex: UINT32, + font: *mut *mut IDWriteFont3, + ) -> HRESULT, + fn GetFontFaceReference( + listIndex: UINT32, + fontFaceReference: *mut *mut IDWriteFontFaceReference, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xda20d8ef, 0x812a, 0x4c43, 0x98, 0x02, 0x62, 0xec, 0x4a, 0xbd, 0x7a, 0xde)] +interface IDWriteFontList1(IDWriteFontList1Vtbl): IDWriteFontList(IDWriteFontListVtbl) { + fn GetFontLocality( + listIndex: UINT32, + ) -> DWRITE_LOCALITY, + fn GetFont( + listIndex: UINT32, + font: *mut *mut IDWriteFont3, + ) -> HRESULT, + fn GetFontFaceReference( + listIndex: UINT32, + fontFaceReference: *mut *mut IDWriteFontFaceReference, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x5e7fa7ca, 0xdde3, 0x424c, 0x89, 0xf0, 0x9f, 0xcd, 0x6f, 0xed, 0x58, 0xcd)] +interface IDWriteFontFaceReference(IDWriteFontFaceReferenceVtbl): + IUnknown(IUnknownVtbl) { + fn CreateFontFace( + fontFace: *mut *mut IDWriteFontFace3, + ) -> HRESULT, + fn CreateFontFaceWithSimulations( + fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS, + fontFace: *mut *mut IDWriteFontFace3, + ) -> HRESULT, + fn Equals( + fontFaceReference: *mut IDWriteFontFaceReference, + ) -> BOOL, + fn GetFontFaceIndex() -> UINT32, + fn GetSimulations() -> DWRITE_FONT_SIMULATIONS, + fn GetFontFile( + fontFile: *mut *mut IDWriteFontFile, + ) -> HRESULT, + fn GetLocalFileSize() -> UINT64, + fn GetFileSize() -> UINT64, + fn GetFileTime( + lastWriteTime: *mut FILETIME, + ) -> HRESULT, + fn GetLocality() -> DWRITE_LOCALITY, + fn EnqueueFontDownloadRequest() -> HRESULT, + fn EnqueueCharacterDownloadRequest( + characters: *const WCHAR, + characterCount: UINT32, + ) -> HRESULT, + fn EnqueueGlyphDownloadRequest( + glyphIndices: *const UINT16, + glyphCount: UINT32, + ) -> HRESULT, + fn EnqueueFileFragmentDownloadRequest( + fileOffset: UINT64, + fragmentSize: UINT64, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x29748ed6, 0x8c9c, 0x4a6a, 0xbe, 0x0b, 0xd9, 0x12, 0xe8, 0x53, 0x89, 0x44)] +interface IDWriteFont3(IDWriteFont3Vtbl): IDWriteFont2(IDWriteFont2Vtbl) { + fn CreateFontFace( + fontFace: *mut *mut IDWriteFontFace3, + ) -> HRESULT, + fn Equals( + font: *mut IDWriteFont, + ) -> BOOL, + fn GetFontFaceReference( + fontFaceReference: *mut *mut IDWriteFontFaceReference, + ) -> HRESULT, + fn HasCharacter( + unicodeValue: UINT32, + ) -> BOOL, + fn GetLocality() -> DWRITE_LOCALITY, +}} +RIDL!{#[uuid(0xd37d7598, 0x09be, 0x4222, 0xa2, 0x36, 0x20, 0x81, 0x34, 0x1c, 0xc1, 0xf2)] +interface IDWriteFontFace3(IDWriteFontFace3Vtbl): + IDWriteFontFace2(IDWriteFontFace2Vtbl) { + fn GetFontFaceReference( + fontFaceReference: *mut *mut IDWriteFontFaceReference, + ) -> HRESULT, + fn GetPanose( + panose: *mut DWRITE_PANOSE, + ) -> (), + fn GetWeight() -> DWRITE_FONT_WEIGHT, + fn GetStretch() -> DWRITE_FONT_STRETCH, + fn GetStyle() -> DWRITE_FONT_STYLE, + fn GetFamilyNames( + names: *mut *mut IDWriteLocalizedStrings, + ) -> HRESULT, + fn GetFaceNames( + names: *mut *mut IDWriteLocalizedStrings, + ) -> HRESULT, + fn GetInformationalStrings( + informationalStringID: DWRITE_INFORMATIONAL_STRING_ID, + informationalStrings: *mut *mut IDWriteLocalizedStrings, + exists: *mut BOOL, + ) -> HRESULT, + fn HasCharacter( + unicodeValue: UINT32, + ) -> BOOL, + fn GetRecommendedRenderingMode( + fontEmSize: FLOAT, + dpiX: FLOAT, + dpiY: FLOAT, + transform: *const DWRITE_MATRIX, + isSideways: BOOL, + outlineThreshold: DWRITE_OUTLINE_THRESHOLD, + measuringMode: DWRITE_MEASURING_MODE, + renderingParams: *mut IDWriteRenderingParams, + renderingMode: *mut DWRITE_RENDERING_MODE1, + gridFitMode: *mut DWRITE_GRID_FIT_MODE, + ) -> HRESULT, + fn IsCharacterLocal( + unicodeValue: UINT32, + ) -> BOOL, + fn IsGlyphLocal( + glyphId: UINT16, + ) -> BOOL, + fn AreCharactersLocal( + characters: *const WCHAR, + characterCount: UINT32, + enqueueIfNotLocal: BOOL, + isLocal: *mut BOOL, + ) -> HRESULT, + fn AreGlyphsLocal( + glyphIndices: *const UINT16, + glyphCount: UINT32, + enqueueIfNotLocal: BOOL, + isLocal: *mut BOOL, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xcfee3140, 0x1157, 0x47ca, 0x8b, 0x85, 0x31, 0xbf, 0xcf, 0x3f, 0x2d, 0x0e)] +interface IDWriteStringList(IDWriteStringListVtbl): IUnknown(IUnknownVtbl) { + fn GetCount() -> UINT32, + fn GetLocaleNameLength( + listIndex: UINT32, + length: *mut UINT32, + ) -> HRESULT, + fn GetLocaleName( + listIndex: UINT32, + localeName: *mut WCHAR, + size: UINT32, + ) -> HRESULT, + fn GetStringLength( + listIndex: UINT32, + length: *mut UINT32, + ) -> HRESULT, + fn GetString( + listIndex: UINT32, + stringBuffer: *mut WCHAR, + stringBufferSize: UINT32, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xb06fe5b9, 0x43ec, 0x4393, 0x88, 0x1b, 0xdb, 0xe4, 0xdc, 0x72, 0xfd, 0xa7)] +interface IDWriteFontDownloadListener(IDWriteFontDownloadListenerVtbl): + IUnknown(IUnknownVtbl) { + fn DownloadCompleted( + downloadQueue: *mut IDWriteFontDownloadQueue, + context: *mut IUnknown, + downloadResult: HRESULT, + ) -> (), +}} +RIDL!{#[uuid(0xb71e6052, 0x5aea, 0x4fa3, 0x83, 0x2e, 0xf6, 0x0d, 0x43, 0x1f, 0x7e, 0x91)] +interface IDWriteFontDownloadQueue(IDWriteFontDownloadQueueVtbl): + IUnknown(IUnknownVtbl) { + fn AddListener( + listener: *mut IDWriteFontDownloadListener, + token: *mut UINT32, + ) -> HRESULT, + fn RemoveListener( + token: UINT32, + ) -> HRESULT, + fn IsEmpty() -> BOOL, + fn BeginDownload( + context: *mut IUnknown, + ) -> HRESULT, + fn CancelDownload() -> HRESULT, + fn GetGenerationCount() -> UINT64, +}} +RIDL!{#[uuid(0x4556be70, 0x3abd, 0x4f70, 0x90, 0xbe, 0x42, 0x17, 0x80, 0xa6, 0xf5, 0x15)] +interface IDWriteGdiInterop1(IDWriteGdiInterop1Vtbl): + IDWriteGdiInterop(IDWriteGdiInteropVtbl) { + fn CreateFontFromLOGFONT( + logFont: *const LOGFONTW, + fontCollection: *mut IDWriteFontCollection, + font: *mut *mut IDWriteFont, + ) -> HRESULT, + fn GetFontSignature_2( + fontFace: *mut IDWriteFontFace, + fontSignature: *mut FONTSIGNATURE, + ) -> HRESULT, + fn GetFontSignature_1( + font: *mut IDWriteFont, + fontSignature: *mut FONTSIGNATURE, + ) -> HRESULT, + fn GetMatchingFontsByLOGFONT( + logFont: *const LOGFONTW, + fontSet: *mut IDWriteFontSet, + filteredSet: *mut *mut IDWriteFontSet, + ) -> HRESULT, +}} +STRUCT!{struct DWRITE_LINE_METRICS1 { + length: UINT32, + trailingWhitespaceLength: UINT32, + newlineLength: UINT32, + height: FLOAT, + baseline: FLOAT, + isTrimmed: BOOL, + leadingBefore: FLOAT, + leadingAfter: FLOAT, +}} +ENUM!{enum DWRITE_FONT_LINE_GAP_USAGE { + DWRITE_FONT_LINE_GAP_USAGE_DEFAULT, + DWRITE_FONT_LINE_GAP_USAGE_DISABLED, + DWRITE_FONT_LINE_GAP_USAGE_ENABLED, +}} +STRUCT!{struct DWRITE_LINE_SPACING { + method: DWRITE_LINE_SPACING_METHOD, + height: FLOAT, + baseline: FLOAT, + leadingBefore: FLOAT, + fontLineGapUsage: DWRITE_FONT_LINE_GAP_USAGE, +}} +RIDL!{#[uuid(0xf67e0edd, 0x9e3d, 0x4ecc, 0x8c, 0x32, 0x41, 0x83, 0x25, 0x3d, 0xfe, 0x70)] +interface IDWriteTextFormat2(IDWriteTextFormat2Vtbl): + IDWriteTextFormat1(IDWriteTextFormat1Vtbl) { + fn SetLineSpacing( + lineSpacingOptions: *const DWRITE_LINE_SPACING, + ) -> HRESULT, + fn GetLineSpacing( + lineSpacingOptions: *mut DWRITE_LINE_SPACING, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x07ddcd52, 0x020e, 0x4de8, 0xac, 0x33, 0x6c, 0x95, 0x3d, 0x83, 0xf9, 0x2d)] +interface IDWriteTextLayout3(IDWriteTextLayout3Vtbl): + IDWriteTextLayout2(IDWriteTextLayout2Vtbl) { + fn InvalidateLayout() -> HRESULT, + fn SetLineSpacing( + lineSpacingOptions: *const DWRITE_LINE_SPACING, + ) -> HRESULT, + fn GetLineSpacing( + lineSpacingOptions: *mut DWRITE_LINE_SPACING, + ) -> HRESULT, + fn GetLineMetrics( + lineMetrics: *mut DWRITE_LINE_METRICS1, + maxLineCount: UINT32, + actualLineCount: *mut UINT32, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/dxdiag.rs b/src/vendor/winapi/src/um/dxdiag.rs new file mode 100644 index 0000000000..354ed93196 --- /dev/null +++ b/src/vendor/winapi/src/um/dxdiag.rs @@ -0,0 +1,12 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{CLSID_DxDiagProvider, + 0xa65b8071, 0x3bfe, 0x4213, 0x9a, 0x5b, 0x49, 0x1d, 0xa4, 0x46, 0x1c, 0xa7} +DEFINE_GUID!{IID_IDxDiagProvider, + 0x9c6b4cb0, 0x23f8, 0x49cc, 0xa3, 0xed, 0x45, 0xa5, 0x50, 0x00, 0xa6, 0xd2} +DEFINE_GUID!{IID_IDxDiagContainer, + 0x7d0f462f, 0x4064, 0x4862, 0xbc, 0x7f, 0x93, 0x3e, 0x50, 0x58, 0xc1, 0x0f} diff --git a/src/vendor/winapi/src/um/dxfile.rs b/src/vendor/winapi/src/um/dxfile.rs new file mode 100644 index 0000000000..68d610bdae --- /dev/null +++ b/src/vendor/winapi/src/um/dxfile.rs @@ -0,0 +1,24 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{CLSID_CDirectXFile, + 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3} +DEFINE_GUID!{IID_IDirectXFile, + 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{IID_IDirectXFileEnumObject, + 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{IID_IDirectXFileSaveObject, + 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{IID_IDirectXFileObject, + 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{IID_IDirectXFileData, + 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{IID_IDirectXFileDataReference, + 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{IID_IDirectXFileBinary, + 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_DXFILEHeader, + 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} diff --git a/src/vendor/winapi/src/um/dxgidebug.rs b/src/vendor/winapi/src/um/dxgidebug.rs new file mode 100644 index 0000000000..2c75a01a50 --- /dev/null +++ b/src/vendor/winapi/src/um/dxgidebug.rs @@ -0,0 +1,20 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{DXGI_DEBUG_ALL, + 0xe48ae283, 0xda80, 0x490b, 0x87, 0xe6, 0x43, 0xe9, 0xa9, 0xcf, 0xda, 0x08} +DEFINE_GUID!{DXGI_DEBUG_DX, + 0x35cdd7fc, 0x13b2, 0x421d, 0xa5, 0xd7, 0x7e, 0x44, 0x51, 0x28, 0x7d, 0x64} +DEFINE_GUID!{DXGI_DEBUG_DXGI, + 0x25cddaa4, 0xb1c6, 0x47e1, 0xac, 0x3e, 0x98, 0x87, 0x5b, 0x5a, 0x2e, 0x2a} +DEFINE_GUID!{DXGI_DEBUG_APP, + 0x06cd6e01, 0x4219, 0x4ebd, 0x87, 0x09, 0x27, 0xed, 0x23, 0x36, 0x0c, 0x62} +DEFINE_GUID!{IID_IDXGIInfoQueue, + 0xd67441c7, 0x672a, 0x476f, 0x9e, 0x82, 0xcd, 0x55, 0xb4, 0x49, 0x49, 0xce} +DEFINE_GUID!{IID_IDXGIDebug, + 0x119e7452, 0xde9e, 0x40fe, 0x88, 0x06, 0x88, 0xf9, 0x0c, 0x12, 0xb4, 0x41} +DEFINE_GUID!{IID_IDXGIDebug1, + 0xc5a05f0c, 0x16f2, 0x4adf, 0x9f, 0x4d, 0xa8, 0xc4, 0xd5, 0x8a, 0xc5, 0x50} diff --git a/src/vendor/winapi/src/um/errhandlingapi.rs b/src/vendor/winapi/src/um/errhandlingapi.rs new file mode 100644 index 0000000000..833196d9e4 --- /dev/null +++ b/src/vendor/winapi/src/um/errhandlingapi.rs @@ -0,0 +1,76 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-errorhandling-l1 +use shared::basetsd::ULONG_PTR; +use shared::minwindef::{BOOL, DWORD, LPDWORD, UINT, ULONG}; +use um::winnt::{ + EXCEPTION_POINTERS, LONG, LPCSTR, LPCWSTR, PCONTEXT, PEXCEPTION_RECORD, + PVECTORED_EXCEPTION_HANDLER, PVOID, +}; +FN!{stdcall PTOP_LEVEL_EXCEPTION_FILTER( + ExceptionInfo: *mut EXCEPTION_POINTERS, +) -> LONG} +pub type LPTOP_LEVEL_EXCEPTION_FILTER = PTOP_LEVEL_EXCEPTION_FILTER; +extern "system" { + pub fn RaiseException( + dwExceptionCode: DWORD, + dwExceptionFlags: DWORD, + nNumberOfArguments: DWORD, + lpArguments: *const ULONG_PTR, + ); + pub fn UnhandledExceptionFilter( + ExceptionInfo: *mut EXCEPTION_POINTERS, + ) -> LONG; + pub fn SetUnhandledExceptionFilter( + lpTopLevelExceptionFilter: LPTOP_LEVEL_EXCEPTION_FILTER, + ) -> LPTOP_LEVEL_EXCEPTION_FILTER; + pub fn GetLastError() -> DWORD; + pub fn SetLastError( + dwErrCode: DWORD, + ); + pub fn GetErrorMode() -> UINT; + pub fn SetErrorMode( + uMode: UINT, + ) -> UINT; + pub fn AddVectoredExceptionHandler( + First: ULONG, + Handler: PVECTORED_EXCEPTION_HANDLER, + ) -> PVOID; + pub fn RemoveVectoredExceptionHandler( + Handle: PVOID, + ) -> ULONG; + pub fn AddVectoredContinueHandler( + First: ULONG, + Handler: PVECTORED_EXCEPTION_HANDLER, + ) -> PVOID; + pub fn RemoveVectoredContinueHandler( + Handle: PVOID, + ) -> ULONG; +} +// RestoreLastError +extern "system" { + pub fn RaiseFailFastException( + pExceptionRecord: PEXCEPTION_RECORD, + pContextRecord: PCONTEXT, + dwFlags: DWORD, + ); + pub fn FatalAppExitA( + uAction: UINT, + lpMessageText: LPCSTR, + ); + pub fn FatalAppExitW( + uAction: UINT, + lpMessageText: LPCWSTR, + ); + pub fn GetThreadErrorMode() -> DWORD; + pub fn SetThreadErrorMode( + dwNewMode: DWORD, + lpOldMode: LPDWORD, + ) -> BOOL; +} +// What library provides this function? +// TerminateProcessOnMemoryExhaustion diff --git a/src/vendor/winapi/src/um/fibersapi.rs b/src/vendor/winapi/src/um/fibersapi.rs new file mode 100644 index 0000000000..733b0da434 --- /dev/null +++ b/src/vendor/winapi/src/um/fibersapi.rs @@ -0,0 +1,25 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, DWORD}; +use um::winnt::{PFLS_CALLBACK_FUNCTION, PVOID}; +extern "system" { + pub fn FlsAlloc( + lpCallback: PFLS_CALLBACK_FUNCTION, + ) -> DWORD; + pub fn FlsGetValue( + dwFlsIndex: DWORD, + ) -> PVOID; + pub fn FlsSetValue( + dwFlsIndex: DWORD, + lpFlsData: PVOID, + ) -> BOOL; + pub fn FlsFree( + dwFlsIndex: DWORD, + ) -> BOOL; + pub fn IsThreadAFiber() -> BOOL; +} + diff --git a/src/vendor/winapi/src/um/fileapi.rs b/src/vendor/winapi/src/um/fileapi.rs new file mode 100644 index 0000000000..e651e6a408 --- /dev/null +++ b/src/vendor/winapi/src/um/fileapi.rs @@ -0,0 +1,640 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-file-l1 +use shared::minwindef::{ + BOOL, DWORD, FILETIME, LPCVOID, LPDWORD, LPFILETIME, LPVOID, PDWORD, PUCHAR, UCHAR, UINT, + ULONG, WORD, +}; +use um::minwinbase::{ + FILE_INFO_BY_HANDLE_CLASS, FINDEX_INFO_LEVELS, FINDEX_SEARCH_OPS, GET_FILEEX_INFO_LEVELS, + LPOVERLAPPED, LPOVERLAPPED_COMPLETION_ROUTINE, LPSECURITY_ATTRIBUTES, LPWIN32_FIND_DATAA, + LPWIN32_FIND_DATAW +}; +use um::winnt::{ + BOOLEAN, CCHAR, FILE_ID_128, FILE_SEGMENT_ELEMENT, HANDLE, LARGE_INTEGER, LONG, LONGLONG, + LPCSTR, LPCWSTR, LPSTR, LPWCH, LPWSTR, PLARGE_INTEGER, PLONG, PULARGE_INTEGER, PWSTR, + ULONGLONG, WCHAR, +}; +pub const CREATE_NEW: DWORD = 1; +pub const CREATE_ALWAYS: DWORD = 2; +pub const OPEN_EXISTING: DWORD = 3; +pub const OPEN_ALWAYS: DWORD = 4; +pub const TRUNCATE_EXISTING: DWORD = 5; +pub const INVALID_FILE_SIZE: DWORD = 0xFFFFFFFF; +pub const INVALID_SET_FILE_POINTER: DWORD = 0xFFFFFFFF; +pub const INVALID_FILE_ATTRIBUTES: DWORD = 0xFFFFFFFF; +STRUCT!{struct WIN32_FILE_ATTRIBUTE_DATA { + dwFileAttributes: DWORD, + ftCreationTime: FILETIME, + ftLastAccessTime: FILETIME, + ftLastWriteTime: FILETIME, + nFileSizeHigh: DWORD, + nFileSizeLow: DWORD, +}} +pub type LPWIN32_FILE_ATTRIBUTE_DATA = *mut WIN32_FILE_ATTRIBUTE_DATA; +STRUCT!{struct BY_HANDLE_FILE_INFORMATION { + dwFileAttributes: DWORD, + ftCreationTime: FILETIME, + ftLastAccessTime: FILETIME, + ftLastWriteTime: FILETIME, + dwVolumeSerialNumber: DWORD, + nFileSizeHigh: DWORD, + nFileSizeLow: DWORD, + nNumberOfLinks: DWORD, + nFileIndexHigh: DWORD, + nFileIndexLow: DWORD, +}} +pub type PBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION; +pub type LPBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION; +STRUCT!{struct CREATEFILE2_EXTENDED_PARAMETERS { + dwSize: DWORD, + dwFileAttributes: DWORD, + dwFileFlags: DWORD, + dwSecurityQosFlags: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + hTemplateFile: HANDLE, +}} +pub type PCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS; +pub type LPCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS; +ENUM!{enum PRIORITY_HINT { + IoPriorityHintVeryLow = 0, + IoPriorityHintLow = 1, + IoPriorityHintNormal = 2, + MaximumIoPriorityHintType = 3, +}} +STRUCT!{struct FILE_BASIC_INFO { + CreationTime: LARGE_INTEGER, + LastAccessTime: LARGE_INTEGER, + LastWriteTime: LARGE_INTEGER, + ChangeTime: LARGE_INTEGER, + FileAttributes: DWORD, +}} +STRUCT!{struct FILE_STANDARD_INFO { + AllocationSize: LARGE_INTEGER, + EndOfFile: LARGE_INTEGER, + NumberOfLinks: DWORD, + DeletePending: BOOLEAN, + Directory: BOOLEAN, +}} +STRUCT!{struct FILE_NAME_INFO { + FileNameLength: DWORD, + FileName: [WCHAR; 0], +}} +STRUCT!{struct FILE_RENAME_INFO { + ReplaceIfExists: BOOL, + RootDirectory: HANDLE, + FileNameLength: DWORD, + FileName: [WCHAR; 0], +}} +STRUCT!{struct FILE_DISPOSITION_INFO { + DeleteFile: BOOL, +}} +STRUCT!{struct FILE_ALLOCATION_INFO { + AllocationSize: LARGE_INTEGER, +}} +STRUCT!{struct FILE_END_OF_FILE_INFO { + EndOfFile: LARGE_INTEGER, +}} +STRUCT!{struct FILE_STREAM_INFO { + NextEntryOffset: DWORD, + StreamNameLength: DWORD, + StreamSize: DWORD, + StreamAllocationSize: DWORD, + StreamName: [WCHAR; 0], +}} +STRUCT!{struct FILE_COMPRESSION_INFO { + CompressedFileSize: LARGE_INTEGER, + CompressionFormat: WORD, + CompressionUnitShift: UCHAR, + ChunkShift: UCHAR, + ClusterShift: UCHAR, + Reserved: [UCHAR; 3], +}} +STRUCT!{struct FILE_ATTRIBUTE_TAG_INFO { + NextEntryOffset: DWORD, + ReparseTag: DWORD, +}} +STRUCT!{struct FILE_ID_BOTH_DIR_INFO { + NextEntryOffset: DWORD, + FileIndex: DWORD, + CreationTime: LARGE_INTEGER, + LastAccessTime: LARGE_INTEGER, + LastWriteTime: LARGE_INTEGER, + ChangeTime: LARGE_INTEGER, + EndOfFile: LARGE_INTEGER, + AllocationSize: LARGE_INTEGER, + FileAttributes: DWORD, + FileNameLength: DWORD, + EaSize: DWORD, + ShortNameLength: CCHAR, + ShortName: [WCHAR; 12], + FileId: LARGE_INTEGER, + FileName: [WCHAR; 0], +}} +STRUCT!{struct FILE_IO_PRIORITY_HINT_INFO { + PriorityHint: PRIORITY_HINT, +}} +STRUCT!{struct FILE_FULL_DIR_INFO { + NextEntryOffset: ULONG, + FileIndex: ULONG, + CreationTime: LARGE_INTEGER, + LastAccessTime: LARGE_INTEGER, + LastWriteTime: LARGE_INTEGER, + ChangeTime: LARGE_INTEGER, + EndOfFile: LARGE_INTEGER, + AllocationSize: LARGE_INTEGER, + FileAttributes: ULONG, + FileNameLength: ULONG, + EaSize: ULONG, + FileName: [WCHAR; 0], +}} +STRUCT!{struct FILE_STORAGE_INFO { + LogicalBytesPerSector: ULONG, + PhysicalBytesPerSectorForAtomicity: ULONG, + PhysicalBytesPerSectorForPerformance: ULONG, + FileSystemEffectivePhysicalBytesPerSectorForAtomicity: ULONG, + Flags: ULONG, + ByteOffsetForSectorAlignment: ULONG, + ByteOffsetForPartitionAlignment: ULONG, +}} +STRUCT!{struct FILE_ALIGNMENT_INFO { + AlignmentRequirement: ULONG, +}} +STRUCT!{struct FILE_ID_INFO { + VolumeSerialNumber: ULONGLONG, + FileId: FILE_ID_128, +}} +extern "system" { + pub fn CompareFileTime( + lpFileTime1: *const FILETIME, + lpFileTime2: *const FILETIME + ) -> LONG; + pub fn CreateDirectoryA( + lpPathName: LPCSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateDirectoryW( + lpPathName: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateFileA( + lpFileName: LPCSTR, + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, + hTemplateFile: HANDLE, + ) -> HANDLE; + pub fn CreateFileW( + lpFileName: LPCWSTR, + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, + hTemplateFile: HANDLE, + ) -> HANDLE; + pub fn DefineDosDeviceW( + dwFlags: DWORD, + lpDeviceName: LPCWSTR, + lpTargetPath: LPCWSTR + ) -> BOOL; + pub fn DeleteFileA( + lpFileName: LPCSTR + ) -> BOOL; + pub fn DeleteFileW( + lpFileName: LPCWSTR + ) -> BOOL; + pub fn DeleteVolumeMountPointW( + lpszVolumeMountPoint: LPCWSTR + ) -> BOOL; + pub fn FileTimeToLocalFileTime( + lpFileTime: *const FILETIME, + lpLocalFileTime: LPFILETIME, + ) -> BOOL; + pub fn FindClose( + hFindFile: HANDLE + ) -> BOOL; + pub fn FindCloseChangeNotification( + hChangeHandle: HANDLE + ) -> BOOL; + pub fn FindFirstChangeNotificationA( + lpPathName: LPCSTR, + bWatchSubtree: BOOL, + dwNotifyFilter: DWORD, + ) -> HANDLE; + pub fn FindFirstChangeNotificationW( + lpPathName: LPCWSTR, + bWatchSubtree: BOOL, + dwNotifyFilter: DWORD, + ) -> HANDLE; + pub fn FindFirstFileA( + lpFileName: LPCSTR, + lpFindFileData: LPWIN32_FIND_DATAA + ) -> HANDLE; + pub fn FindFirstFileW( + lpFileName: LPCWSTR, + lpFindFileData: LPWIN32_FIND_DATAW + ) -> HANDLE; + pub fn FindFirstFileExA( + lpFileName: LPCSTR, + fInfoLevelId: FINDEX_INFO_LEVELS, + lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, + lpSearchFilter: LPVOID, + dwAdditionalFlags: DWORD, + ) -> HANDLE; + pub fn FindFirstFileExW( + lpFileName: LPCWSTR, + fInfoLevelId: FINDEX_INFO_LEVELS, + lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, + lpSearchFilter: LPVOID, + dwAdditionalFlags: DWORD, + ) -> HANDLE; + pub fn FindFirstVolumeW( + lpszVolumeName: LPWSTR, + cchBufferLength: DWORD + ) -> HANDLE; + pub fn FindNextChangeNotification( + hChangeHandle: HANDLE + ) -> BOOL; + pub fn FindNextFileA( + hFindFile: HANDLE, + lpFindFileData: LPWIN32_FIND_DATAA + ) -> BOOL; + pub fn FindNextFileW( + hFindFile: HANDLE, + lpFindFileData: LPWIN32_FIND_DATAW + ) -> BOOL; + pub fn FindNextVolumeW( + hFindVolume: HANDLE, + lpszVolumeName: LPWSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn FindVolumeClose( + hFindVolume: HANDLE + ) -> BOOL; + pub fn FlushFileBuffers( + hFile: HANDLE + ) -> BOOL; + pub fn GetDiskFreeSpaceA( + lpRootPathName: LPCSTR, + lpSectorsPerCluster: LPDWORD, + lpBytesPerSector: LPDWORD, + lpNumberOfFreeClusters: LPDWORD, + lpTotalNumberOfClusters: LPDWORD, + ) -> BOOL; + pub fn GetDiskFreeSpaceW( + lpRootPathName: LPCWSTR, + lpSectorsPerCluster: LPDWORD, + lpBytesPerSector: LPDWORD, + lpNumberOfFreeClusters: LPDWORD, + lpTotalNumberOfClusters: LPDWORD, + ) -> BOOL; + pub fn GetDiskFreeSpaceExA( + lpDirectoryName: LPCSTR, + lpFreeBytesAvailableToCaller: PULARGE_INTEGER, + lpTotalNumberOfBytes: PULARGE_INTEGER, + lpTotalNumberOfFreeBytes: PULARGE_INTEGER, + ) -> BOOL; + pub fn GetDiskFreeSpaceExW( + lpDirectoryName: LPCWSTR, + lpFreeBytesAvailableToCaller: PULARGE_INTEGER, + lpTotalNumberOfBytes: PULARGE_INTEGER, + lpTotalNumberOfFreeBytes: PULARGE_INTEGER, + ) -> BOOL; + pub fn GetDriveTypeA( + lpRootPathName: LPCSTR + ) -> UINT; + pub fn GetDriveTypeW( + lpRootPathName: LPCWSTR + ) -> UINT; + pub fn GetFileAttributesA( + lpFileName: LPCSTR + ) -> DWORD; + pub fn GetFileAttributesW( + lpFileName: LPCWSTR + ) -> DWORD; + pub fn GetFileAttributesExA( + lpFileName: LPCSTR, + fInfoLevelId: GET_FILEEX_INFO_LEVELS, + lpFileInformation: LPVOID, + ) -> BOOL; + pub fn GetFileAttributesExW( + lpFileName: LPCWSTR, + fInfoLevelId: GET_FILEEX_INFO_LEVELS, + lpFileInformation: LPVOID, + ) -> BOOL; + pub fn GetFileInformationByHandle( + hFile: HANDLE, + lpFileInformation: LPBY_HANDLE_FILE_INFORMATION, + ) -> BOOL; + pub fn GetFileSize( + hFile: HANDLE, + lpFileSizeHigh: LPDWORD + ) -> DWORD; + pub fn GetFileSizeEx( + hFile: HANDLE, + lpFileSize: PLARGE_INTEGER + ) -> BOOL; + pub fn GetFileType( + hFile: HANDLE + ) -> DWORD; + pub fn GetFinalPathNameByHandleA( + hFile: HANDLE, + lpszFilePath: LPSTR, + cchFilePath: DWORD, + dwFlags: DWORD, + ) -> DWORD; + pub fn GetFinalPathNameByHandleW( + hFile: HANDLE, + lpszFilePath: LPWSTR, + cchFilePath: DWORD, + dwFlags: DWORD, + ) -> DWORD; + pub fn GetFileTime( + hFile: HANDLE, + lpCreationTime: LPFILETIME, + lpLastAccessTime: LPFILETIME, + lpLastWriteTime: LPFILETIME, + ) -> BOOL; + pub fn GetFullPathNameW( + lpFileName: LPCWSTR, + nBufferLength: DWORD, + lpBuffer: LPWSTR, + lpFilePart: *mut LPWSTR, + ) -> DWORD; + pub fn GetFullPathNameA( + lpFileName: LPCSTR, + nBufferLength: DWORD, + lpBuffer: LPSTR, + lpFilePart: *mut LPSTR, + ) -> DWORD; + pub fn GetLogicalDrives() -> DWORD; + pub fn GetLogicalDriveStringsW( + nBufferLength: DWORD, + lpBuffer: LPWSTR + ) -> DWORD; + pub fn GetLongPathNameA( + lpszShortPath: LPCSTR, + lpszLongPath: LPSTR, + cchBuffer: DWORD + ) -> DWORD; + pub fn GetLongPathNameW( + lpszShortPath: LPCWSTR, + lpszLongPath: LPWSTR, + cchBuffer: DWORD, + ) -> DWORD; + pub fn GetShortPathNameW( + lpszLongPath: LPCWSTR, + lpszShortPath: LPWSTR, + cchBuffer: DWORD, + ) -> DWORD; + pub fn GetTempFileNameW( + lpPathName: LPCWSTR, + lpPrefixString: LPCWSTR, + uUnique: UINT, + lpTempFileName: LPWSTR, + ) -> UINT; + pub fn GetVolumeInformationByHandleW( + hFile: HANDLE, + lpVolumeNameBuffer: LPWSTR, + nVolumeNameSize: DWORD, + lpVolumeSerialNumber: LPDWORD, + lpMaximumComponentLength: LPDWORD, + lpFileSystemFlags: LPDWORD, + lpFileSystemNameBuffer: LPWSTR, + nFileSystemNameSize: DWORD, + ) -> BOOL; + pub fn GetVolumeInformationW( + lpRootPathName: LPCWSTR, + lpVolumeNameBuffer: LPWSTR, + nVolumeNameSize: DWORD, + lpVolumeSerialNumber: LPDWORD, + lpMaximumComponentLength: LPDWORD, + lpFileSystemFlags: LPDWORD, + lpFileSystemNameBuffer: LPWSTR, + nFileSystemNameSize: DWORD, + ) -> BOOL; + pub fn GetVolumePathNameW( + lpszFileName: LPCWSTR, + lpszVolumePathName: LPWSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn LocalFileTimeToFileTime( + lpLocalFileTime: *const FILETIME, + lpFileTime: LPFILETIME, + ) -> BOOL; + pub fn LockFile( + hFile: HANDLE, + dwFileOffsetLow: DWORD, + dwFileOffsetHigh: DWORD, + nNumberOfBytesToLockLow: DWORD, + nNumberOfBytesToLockHigh: DWORD, + ) -> BOOL; + pub fn LockFileEx( + hFile: HANDLE, + dwFlags: DWORD, + dwReserved: DWORD, + nNumberOfBytesToLockLow: DWORD, + nNumberOfBytesToLockHigh: DWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn QueryDosDeviceW( + lpDeviceName: LPCWSTR, + lpTargetPath: LPWSTR, + ucchMax: DWORD + ) -> DWORD; + pub fn ReadFile( + hFile: HANDLE, + lpBuffer: LPVOID, + nNumberOfBytesToRead: DWORD, + lpNumberOfBytesRead: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn ReadFileEx( + hFile: HANDLE, + lpBuffer: LPVOID, + nNumberOfBytesToRead: DWORD, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; + pub fn ReadFileScatter( + hFile: HANDLE, + aSegmentArray: *mut FILE_SEGMENT_ELEMENT, + nNumberOfBytesToRead: DWORD, + lpReserved: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn RemoveDirectoryA( + lpPathName: LPCSTR + ) -> BOOL; + pub fn RemoveDirectoryW( + lpPathName: LPCWSTR + ) -> BOOL; + pub fn SetEndOfFile( + hFile: HANDLE + ) -> BOOL; + pub fn SetFileAttributesA( + lpFileName: LPCSTR, + dwFileAttributes: DWORD + ) -> BOOL; + pub fn SetFileAttributesW( + lpFileName: LPCWSTR, + dwFileAttributes: DWORD + ) -> BOOL; + pub fn SetFileInformationByHandle( + hFile: HANDLE, + FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, + lpFileInformation: LPVOID, + dwBufferSize: DWORD, + ) -> BOOL; + pub fn SetFilePointer( + hFile: HANDLE, + lDistanceToMove: LONG, + lpDistanceToMoveHigh: PLONG, + dwMoveMethod: DWORD, + ) -> DWORD; + pub fn SetFilePointerEx( + hFile: HANDLE, + liDistanceToMove: LARGE_INTEGER, + lpNewFilePointer: PLARGE_INTEGER, + dwMoveMethod: DWORD, + ) -> BOOL; + pub fn SetFileTime( + hFile: HANDLE, + lpCreationTime: *const FILETIME, + lpLastAccessTime: *const FILETIME, + lpLastWriteTime: *const FILETIME, + ) -> BOOL; + pub fn SetFileValidData( + hFile: HANDLE, + ValidDataLength: LONGLONG + ) -> BOOL; + pub fn UnlockFile( + hFile: HANDLE, + dwFileOffsetLow: DWORD, + dwFileOffsetHigh: DWORD, + nNumberOfBytesToUnlockLow: DWORD, + nNumberOfBytesToUnlockHigh: DWORD, + ) -> BOOL; + pub fn UnlockFileEx( + hFile: HANDLE, + dwReserved: DWORD, + nNumberOfBytesToUnlockLow: DWORD, + nNumberOfBytesToUnlockHigh: DWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WriteFile( + hFile: HANDLE, + lpBuffer: LPCVOID, + nNumberOfBytesToWrite: DWORD, + lpNumberOfBytesWritten: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WriteFileEx( + hFile: HANDLE, + lpBuffer: LPCVOID, + nNumberOfBytesToWrite: DWORD, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; + pub fn WriteFileGather( + hFile: HANDLE, + aSegmentArray: *mut FILE_SEGMENT_ELEMENT, + nNumberOfBytesToWrite: DWORD, + lpReserved: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn GetTempPathW( + nBufferLength: DWORD, + lpBuffer: LPWSTR + ) -> DWORD; + pub fn GetVolumeNameForVolumeMountPointW( + lpszVolumeMountPoint: LPCWSTR, + lpszVolumeName: LPWSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn GetVolumePathNamesForVolumeNameW( + lpszVolumeName: LPCWSTR, + lpszVolumePathNames: LPWCH, + cchBufferLength: DWORD, + lpcchReturnLength: PDWORD, + ) -> BOOL; + pub fn CreateFile2( + lpFileName: LPCWSTR, + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + dwCreationDisposition: DWORD, + pCreateExParams: LPCREATEFILE2_EXTENDED_PARAMETERS, + ) -> HANDLE; + pub fn SetFileIoOverlappedRange( + FileHandle: HANDLE, + OverlappedRangeStart: PUCHAR, + Length: ULONG, + ) -> BOOL; + pub fn GetCompressedFileSizeA( + lpFileName: LPCSTR, + lpFileSizeHigh: LPDWORD + ) -> DWORD; + pub fn GetCompressedFileSizeW( + lpFileName: LPCWSTR, + lpFileSizeHigh: LPDWORD + ) -> DWORD; +} +ENUM!{enum STREAM_INFO_LEVELS { + FindStreamInfoStandard, + FindStreamInfoMaxInfoLevel, +}} +extern "system" { + pub fn FindFirstStreamW( + lpFileName: LPCWSTR, + InfoLevel: STREAM_INFO_LEVELS, + lpFindStreamData: LPVOID, + dwFlags: DWORD, + ) -> HANDLE; + pub fn FindNextStreamW( + hFindStream: HANDLE, + lpFindStreamData: LPVOID + ) -> BOOL; + pub fn AreFileApisANSI() -> BOOL; + pub fn GetTempPathA( + nBufferLength: DWORD, + lpBuffer: LPSTR + ) -> DWORD; + pub fn FindFirstFileNameW( + lpFileName: LPCWSTR, + dwFlags: DWORD, + StringLength: LPDWORD, + LinkName: PWSTR, + ) -> HANDLE; + pub fn FindNextFileNameW( + hFindStream: HANDLE, + StringLength: LPDWORD, + LinkName: PWSTR + ) -> BOOL; + pub fn GetVolumeInformationA( + lpRootPathName: LPCSTR, + lpVolumeNameBuffer: LPSTR, + nVolumeNameSize: DWORD, + lpVolumeSerialNumber: LPDWORD, + lpMaximumComponentLength: LPDWORD, + lpFileSystemFlags: LPDWORD, + lpFileSystemNameBuffer: LPSTR, + nFileSystemNameSize: DWORD, + ) -> BOOL; + pub fn GetTempFileNameA( + lpPathName: LPCSTR, + lpPrefixString: LPCSTR, + uUnique: UINT, + lpTempFileName: LPSTR, + ) -> UINT; + pub fn SetFileApisToOEM(); + pub fn SetFileApisToANSI(); +} diff --git a/src/vendor/winapi/src/um/gl/gl.rs b/src/vendor/winapi/src/um/gl/gl.rs new file mode 100644 index 0000000000..f08c8987ab --- /dev/null +++ b/src/vendor/winapi/src/um/gl/gl.rs @@ -0,0 +1,53 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_double, c_float, c_int, c_schar, c_short, c_uchar, c_uint, c_ushort, c_void}; +//48 +pub type GLenum = c_uint; +pub type GLboolean = c_uchar; +pub type GLbitfield = c_uint; +pub type GLbyte = c_schar; +pub type GLshort = c_short; +pub type GLint = c_int; +pub type GLsizei = c_int; +pub type GLubyte = c_uchar; +pub type GLushort = c_ushort; +pub type GLuint = c_uint; +pub type GLfloat = c_float; +pub type GLclampf = c_float; +pub type GLdouble = c_double; +pub type GLclampd = c_double; +pub type GLvoid = c_void; +//63 +//68 +//AccumOp +pub const GL_ACCUM: GLenum = 0x0100; +pub const GL_LOAD: GLenum = 0x0101; +pub const GL_RETURN: GLenum = 0x0102; +pub const GL_MULT: GLenum = 0x0103; +pub const GL_ADD: GLenum = 0x0104; +//AlphaFunction +pub const GL_NEVER: GLenum = 0x0200; +pub const GL_LESS: GLenum = 0x0201; +pub const GL_EQUAL: GLenum = 0x0202; +pub const GL_LEQUAL: GLenum = 0x0203; +pub const GL_GREATER: GLenum = 0x0204; +pub const GL_NOTEQUAL: GLenum = 0x0205; +pub const GL_GEQUAL: GLenum = 0x0206; +pub const GL_ALWAYS: GLenum = 0x0207; +// TODO: we're missing about 1500 lines of defines and methods +// until that time, you can use the excellent GL crate +// https://github.com/brendanzab/gl-rs +extern "system" { + pub fn glAccum( + op: GLenum, + value: GLfloat, + ); + pub fn glAlphaFunc( + func: GLenum, + reference: GLclampf, + ); +} diff --git a/src/vendor/winapi/src/um/gl/mod.rs b/src/vendor/winapi/src/um/gl/mod.rs new file mode 100644 index 0000000000..a5152f76cd --- /dev/null +++ b/src/vendor/winapi/src/um/gl/mod.rs @@ -0,0 +1,8 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Headers for user mode only +#[cfg(feature = "gl-gl")] pub mod gl; diff --git a/src/vendor/winapi/src/um/handleapi.rs b/src/vendor/winapi/src/um/handleapi.rs new file mode 100644 index 0000000000..93e1510fa0 --- /dev/null +++ b/src/vendor/winapi/src/um/handleapi.rs @@ -0,0 +1,37 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! handleapi include file +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPHANDLE}; +use um::winnt::HANDLE; +pub const INVALID_HANDLE_VALUE: HANDLE = -1isize as HANDLE; +extern "system" { + pub fn CloseHandle( + hObject: HANDLE, + ) -> BOOL; + pub fn DuplicateHandle( + hSourceProcessHandle: HANDLE, + hSourceHandle: HANDLE, + hTargetProcessHandle: HANDLE, + lpTargetHandle: LPHANDLE, + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + dwOptions: DWORD, + ) -> BOOL; + pub fn CompareObjectHandles( + hFirstObjectHandle: HANDLE, + hSecondObjectHandle: HANDLE, + ) -> BOOL; + pub fn GetHandleInformation( + hObject: HANDLE, + lpdwFlags: LPDWORD, + ) -> BOOL; + pub fn SetHandleInformation( + hObject: HANDLE, + dwMask: DWORD, + dwFlags: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/heapapi.rs b/src/vendor/winapi/src/um/heapapi.rs new file mode 100644 index 0000000000..0f9d6d34f9 --- /dev/null +++ b/src/vendor/winapi/src/um/heapapi.rs @@ -0,0 +1,93 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-heap-l1 +use shared::basetsd::{PSIZE_T, SIZE_T}; +use shared::minwindef::{BOOL, DWORD, LPCVOID, LPVOID}; +use um::minwinbase::LPPROCESS_HEAP_ENTRY; +use um::winnt::{HANDLE, HEAP_INFORMATION_CLASS, PHANDLE, PVOID}; +STRUCT!{struct HEAP_SUMMARY { + cb: DWORD, + cbAllocated: SIZE_T, + cbCommitted: SIZE_T, + cbReserved: SIZE_T, + cbMaxReserve: SIZE_T, +}} +pub type PHEAP_SUMMARY = *mut HEAP_SUMMARY; +pub type LPHEAP_SUMMARY = PHEAP_SUMMARY; +extern "system" { + pub fn HeapCreate( + flOptions: DWORD, + dwInitialSize: SIZE_T, + dwMaximumSize: SIZE_T, + ) -> HANDLE; + pub fn HeapDestroy( + hHeap: HANDLE, + ) -> BOOL; + pub fn HeapAlloc( + hHeap: HANDLE, + dwFlags: DWORD, + dwBytes: SIZE_T, + ) -> LPVOID; + pub fn HeapReAlloc( + hHeap: HANDLE, + dwFlags: DWORD, + lpMem: LPVOID, + dwBytes: SIZE_T, + ) -> LPVOID; + pub fn HeapFree( + hHeap: HANDLE, + dwFlags: DWORD, + lpMem: LPVOID, + ) -> BOOL; + pub fn HeapSize( + hHeap: HANDLE, + dwFlags: DWORD, + lpMem: LPCVOID, + ) -> SIZE_T; + pub fn GetProcessHeap() -> HANDLE; + pub fn HeapCompact( + hHeap: HANDLE, + dwFlags: DWORD, + ) -> SIZE_T; + pub fn HeapSetInformation( + HeapHandle: HANDLE, + HeapInformationClass: HEAP_INFORMATION_CLASS, + HeapInformation: PVOID, + HeapInformationLength: SIZE_T, + ) -> BOOL; + pub fn HeapValidate( + hHeap: HANDLE, + dwFlags: DWORD, + lpMem: LPCVOID, + ) -> BOOL; + pub fn HeapSummary( + hHeap: HANDLE, + dwFlags: DWORD, + lpSummary: LPHEAP_SUMMARY, + ) -> BOOL; + pub fn GetProcessHeaps( + NumberOfHeaps: DWORD, + ProcessHeaps: PHANDLE, + ) -> DWORD; + pub fn HeapLock( + hHeap: HANDLE, + ) -> BOOL; + pub fn HeapUnlock( + hHeap: HANDLE, + ) -> BOOL; + pub fn HeapWalk( + hHeap: HANDLE, + lpEntry: LPPROCESS_HEAP_ENTRY, + ) -> BOOL; + pub fn HeapQueryInformation( + HeapHandle: HANDLE, + HeapInformationClass: HEAP_INFORMATION_CLASS, + HeapInformation: PVOID, + HeapInformationLength: SIZE_T, + ReturnLength: PSIZE_T, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/http.rs b/src/vendor/winapi/src/um/http.rs new file mode 100644 index 0000000000..e84050a75c --- /dev/null +++ b/src/vendor/winapi/src/um/http.rs @@ -0,0 +1,1073 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! HTTP API specification +use shared::guiddef::GUID; +use shared::minwindef::{DWORD, PUCHAR, PULONG, UCHAR, ULONG, USHORT}; +use shared::sspi::SECURITY_STATUS; +use shared::ws2def::{PSOCKADDR, SOCKADDR_STORAGE}; +use um::minwinbase::{LPOVERLAPPED, PSECURITY_ATTRIBUTES}; +use um::winnt::{ + ANYSIZE_ARRAY, BOOLEAN, HANDLE, PCHAR, PCSTR, PCWSTR, PHANDLE, PSECURITY_DESCRIPTOR, PVOID, + PWCHAR, PWSTR, ULARGE_INTEGER, ULONGLONG, +}; +pub const HTTP_INITIALIZE_SERVER: ULONG = 0x00000001; +pub const HTTP_INITIALIZE_CONFIG: ULONG = 0x00000002; +pub const HTTP_DEMAND_CBT: ULONG = 0x00000004; +ENUM!{enum HTTP_SERVER_PROPERTY { + HttpServerAuthenticationProperty, + HttpServerLoggingProperty, + HttpServerQosProperty, + HttpServerTimeoutsProperty, + HttpServerQueueLengthProperty, + HttpServerStateProperty, + HttpServer503VerbosityProperty, + HttpServerBindingProperty, + HttpServerExtendedAuthenticationProperty, + HttpServerListenEndpointProperty, + HttpServerChannelBindProperty, + HttpServerProtectionLevelProperty, +}} +pub type PHTTP_SERVER_PROPERTY = *mut HTTP_SERVER_PROPERTY; +STRUCT!{struct HTTP_PROPERTY_FLAGS { + BitFields: ULONG, +}} +BITFIELD!(HTTP_PROPERTY_FLAGS BitFields: ULONG [ + Present set_Present[0..1], +]); +pub type PHTTP_PROPERTY_FLAGS = *mut HTTP_PROPERTY_FLAGS; +ENUM!{enum HTTP_ENABLED_STATE { + HttpEnabledStateActive, + HttpEnabledStateInactive, +}} +pub type PHTTP_ENABLED_STATE = *mut HTTP_ENABLED_STATE; +STRUCT!{struct HTTP_STATE_INFO { + Flags: HTTP_PROPERTY_FLAGS, + State: HTTP_ENABLED_STATE, +}} +pub type PHTTP_STATE_INFO = *mut HTTP_STATE_INFO; +ENUM!{enum HTTP_503_RESPONSE_VERBOSITY { + Http503ResponseVerbosityBasic, + Http503ResponseVerbosityLimited, + Http503ResponseVerbosityFull, +}} +pub type PHTTP_503_RESPONSE_VERBOSITY = *mut HTTP_503_RESPONSE_VERBOSITY; +ENUM!{enum HTTP_QOS_SETTING_TYPE { + HttpQosSettingTypeBandwidth, + HttpQosSettingTypeConnectionLimit, + HttpQosSettingTypeFlowRate, +}} +pub type PHTTP_QOS_SETTING_TYPE = *mut HTTP_QOS_SETTING_TYPE; +STRUCT!{struct HTTP_QOS_SETTING_INFO { + QosType: HTTP_QOS_SETTING_TYPE, + QosSetting: PVOID, +}} +pub type PHTTP_QOS_SETTING_INFO = *mut HTTP_QOS_SETTING_INFO; +STRUCT!{struct HTTP_CONNECTION_LIMIT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + MaxConnections: ULONG, +}} +pub type PHTTP_CONNECTION_LIMIT_INFO = *mut HTTP_CONNECTION_LIMIT_INFO; +STRUCT!{struct HTTP_BANDWIDTH_LIMIT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + MaxBandwidth: ULONG, +}} +pub type PHTTP_BANDWIDTH_LIMIT_INFO = *mut HTTP_BANDWIDTH_LIMIT_INFO; +STRUCT!{struct HTTP_FLOWRATE_INFO { + Flags: HTTP_PROPERTY_FLAGS, + MaxBandwidth: ULONG, + MaxPeakBandwidth: ULONG, + BurstSize: ULONG, +}} +pub type PHTTP_FLOWRATE_INFO = *mut HTTP_FLOWRATE_INFO; +pub const HTTP_MIN_ALLOWED_BANDWIDTH_THROTTLING_RATE: ULONG = 1024; +pub const HTTP_LIMIT_INFINITE: ULONG = !0; +ENUM!{enum HTTP_SERVICE_CONFIG_TIMEOUT_KEY { + IdleConnectionTimeout = 0, + HeaderWaitTimeout, +}} +pub type PHTTP_SERVICE_CONFIG_TIMEOUT_KEY = *mut HTTP_SERVICE_CONFIG_TIMEOUT_KEY; +pub type HTTP_SERVICE_CONFIG_TIMEOUT_PARAM = USHORT; +pub type PHTTP_SERVICE_CONFIG_TIMEOUT_PARAM = *mut USHORT; +STRUCT!{struct HTTP_SERVICE_CONFIG_TIMEOUT_SET { + KeyDesc: HTTP_SERVICE_CONFIG_TIMEOUT_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_TIMEOUT_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_TIMEOUT_SET = *mut HTTP_SERVICE_CONFIG_TIMEOUT_SET; +STRUCT!{struct HTTP_TIMEOUT_LIMIT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + EntityBody: USHORT, + DrainEntityBody: USHORT, + RequestQueue: USHORT, + IdleConnection: USHORT, + HeaderWait: USHORT, + MinSendRate: ULONG, +}} +pub type PHTTP_TIMEOUT_LIMIT_INFO = *mut HTTP_TIMEOUT_LIMIT_INFO; +STRUCT!{struct HTTP_LISTEN_ENDPOINT_INFO { + Flags: HTTP_PROPERTY_FLAGS, + EnableSharing: BOOLEAN, +}} +pub type PHTTP_LISTEN_ENDPOINT_INFO = *mut HTTP_LISTEN_ENDPOINT_INFO; +STRUCT!{struct HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS { + DomainNameLength: USHORT, + DomainName: PWSTR, + RealmLength: USHORT, + Realm: PWSTR, +}} +pub type PHTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS = *mut HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS; +STRUCT!{struct HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS { + RealmLength: USHORT, + Realm: PWSTR, +}} +pub type PHTTP_SERVER_AUTHENTICATION_BASIC_PARAMS = *mut HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS; +pub const HTTP_AUTH_ENABLE_BASIC: ULONG = 0x00000001; +pub const HTTP_AUTH_ENABLE_DIGEST: ULONG = 0x00000002; +pub const HTTP_AUTH_ENABLE_NTLM: ULONG = 0x00000004; +pub const HTTP_AUTH_ENABLE_NEGOTIATE: ULONG = 0x00000008; +pub const HTTP_AUTH_ENABLE_KERBEROS: ULONG = 0x00000010; +pub const HTTP_AUTH_ENABLE_ALL: ULONG = HTTP_AUTH_ENABLE_BASIC | HTTP_AUTH_ENABLE_DIGEST | + HTTP_AUTH_ENABLE_NTLM | HTTP_AUTH_ENABLE_NEGOTIATE | HTTP_AUTH_ENABLE_KERBEROS; +pub const HTTP_AUTH_EX_FLAG_ENABLE_KERBEROS_CREDENTIAL_CACHING: UCHAR = 0x01; +pub const HTTP_AUTH_EX_FLAG_CAPTURE_CREDENTIAL: UCHAR = 0x02; +STRUCT!{struct HTTP_SERVER_AUTHENTICATION_INFO { + Flags: HTTP_PROPERTY_FLAGS, + AuthSchemes: ULONG, + ReceiveMutualAuth: BOOLEAN, + ReceiveContextHandle: BOOLEAN, + DisableNTLMCredentialCaching: BOOLEAN, + ExFlags: UCHAR, + DigestParams: HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS, + BasicParams: HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS, +}} +pub type PHTTP_SERVER_AUTHENTICATION_INFO = *mut HTTP_SERVER_AUTHENTICATION_INFO; +ENUM!{enum HTTP_SERVICE_BINDING_TYPE { + HttpServiceBindingTypeNone = 0, + HttpServiceBindingTypeW, + HttpServiceBindingTypeA, +}} +STRUCT!{struct HTTP_SERVICE_BINDING_BASE { + Type: HTTP_SERVICE_BINDING_TYPE, +}} +pub type PHTTP_SERVICE_BINDING_BASE = *mut HTTP_SERVICE_BINDING_BASE; +STRUCT!{struct HTTP_SERVICE_BINDING_A { + Base: HTTP_SERVICE_BINDING_BASE, + Buffer: PCHAR, + BufferSize: ULONG, +}} +pub type PHTTP_SERVICE_BINDING_A = *mut HTTP_SERVICE_BINDING_A; +STRUCT!{struct HTTP_SERVICE_BINDING_W { + Base: HTTP_SERVICE_BINDING_BASE, + Buffer: PWCHAR, + BufferSize: ULONG, +}} +pub type PHTTP_SERVICE_BINDING_W = *mut HTTP_SERVICE_BINDING_W; +ENUM!{enum HTTP_AUTHENTICATION_HARDENING_LEVELS { + HttpAuthenticationHardeningLegacy = 0, + HttpAuthenticationHardeningMedium, + HttpAuthenticationHardeningStrict, +}} +pub const HTTP_CHANNEL_BIND_PROXY: ULONG = 0x1; +pub const HTTP_CHANNEL_BIND_PROXY_COHOSTING: ULONG = 0x20; +pub const HTTP_CHANNEL_BIND_NO_SERVICE_NAME_CHECK: ULONG = 0x2; +pub const HTTP_CHANNEL_BIND_DOTLESS_SERVICE: ULONG = 0x4; +pub const HTTP_CHANNEL_BIND_SECURE_CHANNEL_TOKEN: ULONG = 0x8; +pub const HTTP_CHANNEL_BIND_CLIENT_SERVICE: ULONG = 0x10; +STRUCT!{struct HTTP_CHANNEL_BIND_INFO { + Hardening: HTTP_AUTHENTICATION_HARDENING_LEVELS, + Flags: ULONG, + ServiceNames: *mut PHTTP_SERVICE_BINDING_BASE, + NumberOfServiceNames: ULONG, +}} +pub type PHTTP_CHANNEL_BIND_INFO = *mut HTTP_CHANNEL_BIND_INFO; +STRUCT!{struct HTTP_REQUEST_CHANNEL_BIND_STATUS { + ServiceName: PHTTP_SERVICE_BINDING_BASE, + ChannelToken: PUCHAR, + ChannelTokenSize: ULONG, + Flags: ULONG, +}} +pub type PHTTP_REQUEST_CHANNEL_BIND_STATUS = *mut HTTP_REQUEST_CHANNEL_BIND_STATUS; +pub const HTTP_LOG_FIELD_DATE: ULONG = 0x00000001; +pub const HTTP_LOG_FIELD_TIME: ULONG = 0x00000002; +pub const HTTP_LOG_FIELD_CLIENT_IP: ULONG = 0x00000004; +pub const HTTP_LOG_FIELD_USER_NAME: ULONG = 0x00000008; +pub const HTTP_LOG_FIELD_SITE_NAME: ULONG = 0x00000010; +pub const HTTP_LOG_FIELD_COMPUTER_NAME: ULONG = 0x00000020; +pub const HTTP_LOG_FIELD_SERVER_IP: ULONG = 0x00000040; +pub const HTTP_LOG_FIELD_METHOD: ULONG = 0x00000080; +pub const HTTP_LOG_FIELD_URI_STEM: ULONG = 0x00000100; +pub const HTTP_LOG_FIELD_URI_QUERY: ULONG = 0x00000200; +pub const HTTP_LOG_FIELD_STATUS: ULONG = 0x00000400; +pub const HTTP_LOG_FIELD_WIN32_STATUS: ULONG = 0x00000800; +pub const HTTP_LOG_FIELD_BYTES_SENT: ULONG = 0x00001000; +pub const HTTP_LOG_FIELD_BYTES_RECV: ULONG = 0x00002000; +pub const HTTP_LOG_FIELD_TIME_TAKEN: ULONG = 0x00004000; +pub const HTTP_LOG_FIELD_SERVER_PORT: ULONG = 0x00008000; +pub const HTTP_LOG_FIELD_USER_AGENT: ULONG = 0x00010000; +pub const HTTP_LOG_FIELD_COOKIE: ULONG = 0x00020000; +pub const HTTP_LOG_FIELD_REFERER: ULONG = 0x00040000; +pub const HTTP_LOG_FIELD_VERSION: ULONG = 0x00080000; +pub const HTTP_LOG_FIELD_HOST: ULONG = 0x00100000; +pub const HTTP_LOG_FIELD_SUB_STATUS: ULONG = 0x00200000; +pub const HTTP_LOG_FIELD_CLIENT_PORT: ULONG = 0x00400000; +pub const HTTP_LOG_FIELD_URI: ULONG = 0x00800000; +pub const HTTP_LOG_FIELD_SITE_ID: ULONG = 0x01000000; +pub const HTTP_LOG_FIELD_REASON: ULONG = 0x02000000; +pub const HTTP_LOG_FIELD_QUEUE_NAME: ULONG = 0x04000000; +ENUM!{enum HTTP_LOGGING_TYPE { + HttpLoggingTypeW3C, + HttpLoggingTypeIIS, + HttpLoggingTypeNCSA, + HttpLoggingTypeRaw, +}} +ENUM!{enum HTTP_LOGGING_ROLLOVER_TYPE { + HttpLoggingRolloverSize, + HttpLoggingRolloverDaily, + HttpLoggingRolloverWeekly, + HttpLoggingRolloverMonthly, + HttpLoggingRolloverHourly, +}} +pub const HTTP_MIN_ALLOWED_LOG_FILE_ROLLOVER_SIZE: ULONG = 1 * 1024 * 1024; +pub const HTTP_LOGGING_FLAG_LOCAL_TIME_ROLLOVER: ULONG = 0x00000001; +pub const HTTP_LOGGING_FLAG_USE_UTF8_CONVERSION: ULONG = 0x00000002; +pub const HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY: ULONG = 0x00000004; +pub const HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY: ULONG = 0x00000008; +STRUCT!{struct HTTP_LOGGING_INFO { + Flags: HTTP_PROPERTY_FLAGS, + LoggingFlags: ULONG, + SoftwareName: PCWSTR, + SoftwareNameLength: USHORT, + DirectoryNameLength: USHORT, + DirectoryName: PCWSTR, + Format: HTTP_LOGGING_TYPE, + Fields: ULONG, + pExtFields: PVOID, + NumOfExtFields: USHORT, + MaxRecordSize: USHORT, + RolloverType: HTTP_LOGGING_ROLLOVER_TYPE, + RolloverSize: ULONG, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, +}} +pub type PHTTP_LOGGING_INFO = *mut HTTP_LOGGING_INFO; +STRUCT!{struct HTTP_BINDING_INFO { + Flags: HTTP_PROPERTY_FLAGS, + RequestQueueHandle: HANDLE, +}} +pub type PHTTP_BINDING_INFO = *mut HTTP_BINDING_INFO; +ENUM!{enum HTTP_PROTECTION_LEVEL_TYPE { + HttpProtectionLevelUnrestricted, + HttpProtectionLevelEdgeRestricted, + HttpProtectionLevelRestricted, +}} +pub type PHTTP_PROTECTION_LEVEL_TYPE = *mut HTTP_PROTECTION_LEVEL_TYPE; +STRUCT!{struct HTTP_PROTECTION_LEVEL_INFO { + Flags: HTTP_PROPERTY_FLAGS, + Level: HTTP_PROTECTION_LEVEL_TYPE, +}} +pub type PHTTP_PROTECTION_LEVEL_INFO = *mut HTTP_PROTECTION_LEVEL_INFO; +pub const HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING: ULONG = 0x00000001; +pub const HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER: ULONG = 0x00000002; +pub const HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY: ULONG = 0x00000001; +pub const HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY: ULONG = 0x00000002; +pub const HTTP_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER: ULONG = 0x00000001; +pub const HTTP_SEND_RESPONSE_FLAG_DISCONNECT: ULONG = 0x00000001; +pub const HTTP_SEND_RESPONSE_FLAG_MORE_DATA: ULONG = 0x00000002; +pub const HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA: ULONG = 0x00000004; +pub const HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING: ULONG = 0x00000008; +pub const HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES: ULONG = 0x00000020; +pub const HTTP_SEND_RESPONSE_FLAG_OPAQUE: ULONG = 0x00000040; +pub const HTTP_FLUSH_RESPONSE_FLAG_RECURSIVE: ULONG = 0x00000001; +pub type HTTP_OPAQUE_ID = ULONGLONG; +pub type PHTTP_OPAQUE_ID = *mut ULONGLONG; +pub type HTTP_REQUEST_ID = HTTP_OPAQUE_ID; +pub type PHTTP_REQUEST_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_CONNECTION_ID = HTTP_OPAQUE_ID; +pub type PHTTP_CONNECTION_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_RAW_CONNECTION_ID = HTTP_OPAQUE_ID; +pub type PHTTP_RAW_CONNECTION_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_URL_GROUP_ID = HTTP_OPAQUE_ID; +pub type PHTTP_URL_GROUP_ID = *mut HTTP_OPAQUE_ID; +pub type HTTP_SERVER_SESSION_ID = HTTP_OPAQUE_ID; +pub type PHTTP_SERVER_SESSION_ID = *mut HTTP_OPAQUE_ID; +pub const HTTP_BYTE_RANGE_TO_EOF: ULONGLONG = !0; +STRUCT!{struct HTTP_BYTE_RANGE { + StartingOffset: ULARGE_INTEGER, + Length: ULARGE_INTEGER, +}} +pub type PHTTP_BYTE_RANGE = *mut HTTP_BYTE_RANGE; +STRUCT!{struct HTTP_VERSION { + MajorVersion: USHORT, + MinorVersion: USHORT, +}} +pub type PHTTP_VERSION = *mut HTTP_VERSION; +pub const HTTP_VERSION_UNKNOWN: HTTP_VERSION = HTTP_VERSION { MajorVersion: 0, MinorVersion: 0 }; +pub const HTTP_VERSION_0_9: HTTP_VERSION = HTTP_VERSION { MajorVersion: 0, MinorVersion: 9 }; +pub const HTTP_VERSION_1_0: HTTP_VERSION = HTTP_VERSION { MajorVersion: 1, MinorVersion: 0 }; +pub const HTTP_VERSION_1_1: HTTP_VERSION = HTTP_VERSION { MajorVersion: 1, MinorVersion: 1 }; +#[inline] +pub fn HTTP_SET_VERSION(mut version: HTTP_VERSION, major: USHORT, minor: USHORT) { + version.MajorVersion = major; + version.MinorVersion = minor; +} +#[inline] +pub fn HTTP_EQUAL_VERSION(version: HTTP_VERSION, major: USHORT, minor: USHORT) -> bool { + version.MajorVersion == major && version.MinorVersion == minor +} +#[inline] +pub fn HTTP_GREATER_VERSION(version: HTTP_VERSION, major: USHORT, minor: USHORT) -> bool { + version.MajorVersion > major || (version.MajorVersion == major && version.MinorVersion > minor) +} +#[inline] +pub fn HTTP_LESS_VERSION(version: HTTP_VERSION, major: USHORT, minor: USHORT) -> bool { + version.MajorVersion < major || (version.MajorVersion == major && version.MinorVersion < minor) +} +#[inline] +pub fn HTTP_NOT_EQUAL_VERSION(version: HTTP_VERSION, major: USHORT, minor: USHORT) -> bool { + !HTTP_EQUAL_VERSION(version, major, minor) +} +#[inline] +pub fn HTTP_GREATER_EQUAL_VERSION(version: HTTP_VERSION, major: USHORT, minor: USHORT) -> bool { + !HTTP_LESS_VERSION(version, major, minor) +} +#[inline] +pub fn HTTP_LESS_EQUAL_VERSION(version: HTTP_VERSION, major: USHORT, minor: USHORT) -> bool { + !HTTP_GREATER_VERSION(version, major, minor) +} +ENUM!{enum HTTP_VERB { + HttpVerbUnparsed, + HttpVerbUnknown, + HttpVerbInvalid, + HttpVerbOPTIONS, + HttpVerbGET, + HttpVerbHEAD, + HttpVerbPOST, + HttpVerbPUT, + HttpVerbDELETE, + HttpVerbTRACE, + HttpVerbCONNECT, + HttpVerbTRACK, + HttpVerbMOVE, + HttpVerbCOPY, + HttpVerbPROPFIND, + HttpVerbPROPPATCH, + HttpVerbMKCOL, + HttpVerbLOCK, + HttpVerbUNLOCK, + HttpVerbSEARCH, + HttpVerbMaximum, +}} +pub type PHTTP_VERB = *mut HTTP_VERB; +ENUM!{enum HTTP_HEADER_ID { + HttpHeaderCacheControl = 0, + HttpHeaderConnection = 1, + HttpHeaderDate = 2, + HttpHeaderKeepAlive = 3, + HttpHeaderPragma = 4, + HttpHeaderTrailer = 5, + HttpHeaderTransferEncoding = 6, + HttpHeaderUpgrade = 7, + HttpHeaderVia = 8, + HttpHeaderWarning = 9, + HttpHeaderAllow = 10, + HttpHeaderContentLength = 11, + HttpHeaderContentType = 12, + HttpHeaderContentEncoding = 13, + HttpHeaderContentLanguage = 14, + HttpHeaderContentLocation = 15, + HttpHeaderContentMd5 = 16, + HttpHeaderContentRange = 17, + HttpHeaderExpires = 18, + HttpHeaderLastModified = 19, + HttpHeaderAccept = 20, + HttpHeaderAcceptCharset = 21, + HttpHeaderAcceptEncoding = 22, + HttpHeaderAcceptLanguage = 23, + HttpHeaderAuthorization = 24, + HttpHeaderCookie = 25, + HttpHeaderExpect = 26, + HttpHeaderFrom = 27, + HttpHeaderHost = 28, + HttpHeaderIfMatch = 29, + HttpHeaderIfModifiedSince = 30, + HttpHeaderIfNoneMatch = 31, + HttpHeaderIfRange = 32, + HttpHeaderIfUnmodifiedSince = 33, + HttpHeaderMaxForwards = 34, + HttpHeaderProxyAuthorization = 35, + HttpHeaderReferer = 36, + HttpHeaderRange = 37, + HttpHeaderTe = 38, + HttpHeaderTranslate = 39, + HttpHeaderUserAgent = 40, + HttpHeaderRequestMaximum = 41, + HttpHeaderAcceptRanges = 20, + HttpHeaderAge = 21, + HttpHeaderEtag = 22, + HttpHeaderLocation = 23, + HttpHeaderProxyAuthenticate = 24, + HttpHeaderRetryAfter = 25, + HttpHeaderServer = 26, + HttpHeaderSetCookie = 27, + HttpHeaderVary = 28, + HttpHeaderWwwAuthenticate = 29, + HttpHeaderResponseMaximum = 30, + HttpHeaderMaximum = 41, +}} +pub type PHTTP_HEADER_ID = *mut HTTP_HEADER_ID; +STRUCT!{struct HTTP_KNOWN_HEADER { + RawValueLength: USHORT, + pRawValue: PCSTR, +}} +pub type PHTTP_KNOWN_HEADER = *mut HTTP_KNOWN_HEADER; +STRUCT!{struct HTTP_UNKNOWN_HEADER { + NameLength: USHORT, + RawValueLength: USHORT, + pName: PCSTR, + pRawValue: PCSTR, +}} +pub type PHTTP_UNKNOWN_HEADER = *mut HTTP_UNKNOWN_HEADER; +ENUM!{enum HTTP_LOG_DATA_TYPE { + HttpLogDataTypeFields = 0, +}} +pub type PHTTP_LOG_DATA_TYPE = *mut HTTP_LOG_DATA_TYPE; +STRUCT!{struct HTTP_LOG_DATA { + Type: HTTP_LOG_DATA_TYPE, +}} +pub type PHTTP_LOG_DATA = *mut HTTP_LOG_DATA; +STRUCT!{struct HTTP_LOG_FIELDS_DATA { + Base: HTTP_LOG_DATA, + UserNameLength: USHORT, + UriStemLength: USHORT, + ClientIpLength: USHORT, + ServerNameLength: USHORT, + ServiceNameLength: USHORT, + ServerIpLength: USHORT, + MethodLength: USHORT, + UriQueryLength: USHORT, + HostLength: USHORT, + UserAgentLength: USHORT, + CookieLength: USHORT, + ReferrerLength: USHORT, + UserName: PWCHAR, + UriStem: PWCHAR, + ClientIp: PCHAR, + ServerName: PCHAR, + ServiceName: PCHAR, + ServerIp: PCHAR, + Method: PCHAR, + UriQuery: PCHAR, + Host: PCHAR, + UserAgent: PCHAR, + Cookie: PCHAR, + Referrer: PCHAR, + ServerPort: USHORT, + ProtocolStatus: USHORT, + Win32Status: ULONG, + MethodNum: HTTP_VERB, + SubStatus: USHORT, +}} +pub type PHTTP_LOG_FIELDS_DATA = *mut HTTP_LOG_FIELDS_DATA; +ENUM!{enum HTTP_DATA_CHUNK_TYPE { + HttpDataChunkFromMemory, + HttpDataChunkFromFileHandle, + HttpDataChunkFromFragmentCache, + HttpDataChunkFromFragmentCacheEx, + HttpDataChunkMaximum, +}} +pub type PHTTP_DATA_CHUNK_TYPE = *mut HTTP_DATA_CHUNK_TYPE; +STRUCT!{struct HTTP_DATA_CHUNK_FromMemory { + pBuffer: PVOID, + BufferLength: ULONG, +}} +STRUCT!{struct HTTP_DATA_CHUNK_FromFileHandle { + ByteRange: HTTP_BYTE_RANGE, + FileHandle: HANDLE, +}} +STRUCT!{struct HTTP_DATA_CHUNK_FromFragmentCache { + FragmentNameLength: USHORT, + pFragmentName: PCWSTR, +}} +STRUCT!{struct HTTP_DATA_CHUNK_FromFragmentCacheEx { + ByteRange: HTTP_BYTE_RANGE, + pFragmentName: PCWSTR, +}} +UNION!{union HTTP_DATA_CHUNK_u { + [u64; 3], + FromMemory FromMemory_mut: HTTP_DATA_CHUNK_FromMemory, + FromFileHandle FromFileHandle_mut: HTTP_DATA_CHUNK_FromFileHandle, + FromFragmentCache FromFragmentCache_mut: HTTP_DATA_CHUNK_FromFragmentCache, + FromFragmentCacheEx FromFragmentCacheEx_mut: HTTP_DATA_CHUNK_FromFragmentCacheEx, +}} +STRUCT!{struct HTTP_DATA_CHUNK { + DataChunkType: HTTP_DATA_CHUNK_TYPE, + u: HTTP_DATA_CHUNK_u, +}} +pub type PHTTP_DATA_CHUNK = *mut HTTP_DATA_CHUNK; +STRUCT!{struct HTTP_REQUEST_HEADERS { + UnknownHeaderCount: USHORT, + pUnknownHeaders: PHTTP_UNKNOWN_HEADER, + TrailerCount: USHORT, + pTrailers: PHTTP_UNKNOWN_HEADER, + KnownHeaders: [HTTP_KNOWN_HEADER; 41], // FIXME HttpHeaderRequestMaximum +}} +pub type PHTTP_REQUEST_HEADERS = *mut HTTP_REQUEST_HEADERS; +STRUCT!{struct HTTP_RESPONSE_HEADERS { + UnknownHeaderCount: USHORT, + pUnknownHeaders: PHTTP_UNKNOWN_HEADER, + TrailerCount: USHORT, + pTrailers: PHTTP_UNKNOWN_HEADER, + KnownHeaders: [HTTP_KNOWN_HEADER; 30], // FIXME HttpHeaderResponseMaximum +}} +pub type PHTTP_RESPONSE_HEADERS = *mut HTTP_RESPONSE_HEADERS; +STRUCT!{struct HTTP_TRANSPORT_ADDRESS { + pRemoteAddress: PSOCKADDR, + pLocalAddress: PSOCKADDR, +}} +pub type PHTTP_TRANSPORT_ADDRESS = *mut HTTP_TRANSPORT_ADDRESS; +STRUCT!{struct HTTP_COOKED_URL { + FullUrlLength: USHORT, + HostLength: USHORT, + AbsPathLength: USHORT, + QueryStringLength: USHORT, + pFullUrl: PCWSTR, + pHost: PCWSTR, + pAbsPath: PCWSTR, + pQueryString: PCWSTR, +}} +pub type PHTTP_COOKED_URL = *mut HTTP_COOKED_URL; +pub type HTTP_URL_CONTEXT = ULONGLONG; +pub const HTTP_URL_FLAG_REMOVE_ALL: ULONG = 0x00000001; +ENUM!{enum HTTP_AUTH_STATUS { + HttpAuthStatusSuccess, + HttpAuthStatusNotAuthenticated, + HttpAuthStatusFailure, +}} +pub type PHTTP_AUTH_STATUS = *mut HTTP_AUTH_STATUS; +ENUM!{enum HTTP_REQUEST_AUTH_TYPE { + HttpRequestAuthTypeNone = 0, + HttpRequestAuthTypeBasic, + HttpRequestAuthTypeDigest, + HttpRequestAuthTypeNTLM, + HttpRequestAuthTypeNegotiate, + HttpRequestAuthTypeKerberos, +}} +pub type PHTTP_REQUEST_AUTH_TYPE = *mut HTTP_REQUEST_AUTH_TYPE; +STRUCT!{struct HTTP_SSL_CLIENT_CERT_INFO { + CertFlags: ULONG, + CertEncodedSize: ULONG, + pCertEncoded: PUCHAR, + Token: HANDLE, + CertDeniedByMapper: BOOLEAN, +}} +pub type PHTTP_SSL_CLIENT_CERT_INFO = *mut HTTP_SSL_CLIENT_CERT_INFO; +pub const HTTP_RECEIVE_SECURE_CHANNEL_TOKEN: ULONG = 0x1; +STRUCT!{struct HTTP_SSL_INFO { + ServerCertKeySize: USHORT, + ConnectionKeySize: USHORT, + ServerCertIssuerSize: ULONG, + ServerCertSubjectSize: ULONG, + pServerCertIssuer: PCSTR, + pServerCertSubject: PCSTR, + pClientCertInfo: PHTTP_SSL_CLIENT_CERT_INFO, + SslClientCertNegotiated: ULONG, +}} +pub type PHTTP_SSL_INFO = *mut HTTP_SSL_INFO; +ENUM!{enum HTTP_REQUEST_INFO_TYPE { + HttpRequestInfoTypeAuth, + HttpRequestInfoTypeChannelBind, +}} +STRUCT!{struct HTTP_REQUEST_INFO { + InfoType: HTTP_REQUEST_INFO_TYPE, + InfoLength: ULONG, + pInfo: PVOID, +}} +pub type PHTTP_REQUEST_INFO = *mut HTTP_REQUEST_INFO; +pub const HTTP_REQUEST_AUTH_FLAG_TOKEN_FOR_CACHED_CRED: ULONG = 0x00000001; +STRUCT!{struct HTTP_REQUEST_AUTH_INFO { + AuthStatus: HTTP_AUTH_STATUS, + SecStatus: SECURITY_STATUS, + Flags: ULONG, + AuthType: HTTP_REQUEST_AUTH_TYPE, + AccessToken: HANDLE, + ContextAttributes: ULONG, + PackedContextLength: ULONG, + PackedContextType: ULONG, + PackedContext: PVOID, + MutualAuthDataLength: ULONG, + pMutualAuthData: PCHAR, + PackageNameLength: USHORT, + pPackageName: PWSTR, +}} +pub type PHTTP_REQUEST_AUTH_INFO = *mut HTTP_REQUEST_AUTH_INFO; +STRUCT!{struct HTTP_REQUEST_V1 { + Flags: ULONG, + ConnectionId: HTTP_CONNECTION_ID, + RequestId: HTTP_REQUEST_ID, + UrlContext: HTTP_URL_CONTEXT, + Version: HTTP_VERSION, + Verb: HTTP_VERB, + UnknownVerbLength: USHORT, + RawUrlLength: USHORT, + pUnknownVerb: PCSTR, + pRawUrl: PCSTR, + CookedUrl: HTTP_COOKED_URL, + Address: HTTP_TRANSPORT_ADDRESS, + Headers: HTTP_REQUEST_HEADERS, + BytesReceived: ULONGLONG, + EntityChunkCount: USHORT, + pEntityChunks: PHTTP_DATA_CHUNK, + RawConnectionId: HTTP_RAW_CONNECTION_ID, + pSslInfo: PHTTP_SSL_INFO, +}} +pub type PHTTP_REQUEST_V1 = *mut HTTP_REQUEST_V1; +STRUCT!{struct HTTP_REQUEST_V2 { + Base: HTTP_REQUEST_V1, + RequestInfoCount: USHORT, + pRequestInfo: PHTTP_REQUEST_INFO, +}} +pub type PHTTP_REQUEST_V2 = *mut HTTP_REQUEST_V2; +pub type HTTP_REQUEST = HTTP_REQUEST_V2; +pub type PHTTP_REQUEST = *mut HTTP_REQUEST; +pub const HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS: ULONG = 0x00000001; +pub const HTTP_REQUEST_FLAG_IP_ROUTED: ULONG = 0x00000002; +STRUCT!{struct HTTP_RESPONSE_V1 { + Flags: ULONG, + Version: HTTP_VERSION, + StatusCode: USHORT, + ReasonLength: USHORT, + pReason: PCSTR, + Headers: HTTP_RESPONSE_HEADERS, + EntityChunkCount: USHORT, + pEntityChunks: PHTTP_DATA_CHUNK, +}} +pub type PHTTP_RESPONSE_V1 = *mut HTTP_RESPONSE_V1; +pub const HTTP_RESPONSE_FLAG_MULTIPLE_ENCODINGS_AVAILABLE: ULONG = 0x00000001; +ENUM!{enum HTTP_RESPONSE_INFO_TYPE { + HttpResponseInfoTypeMultipleKnownHeaders, + HttpResponseInfoTypeAuthenticationProperty, + HttpResponseInfoTypeQoSProperty, + HttpResponseInfoTypeChannelBind, +}} +pub type PHTTP_RESPONSE_INFO_TYPE = *mut HTTP_RESPONSE_INFO_TYPE; +STRUCT!{struct HTTP_RESPONSE_INFO { + Type: HTTP_RESPONSE_INFO_TYPE, + Length: ULONG, + pInfo: PVOID, +}} +pub type PHTTP_RESPONSE_INFO = *mut HTTP_RESPONSE_INFO; +pub const HTTP_RESPONSE_INFO_FLAGS_PRESERVE_ORDER: ULONG = 0x00000001; +STRUCT!{struct HTTP_MULTIPLE_KNOWN_HEADERS { + HeaderId: HTTP_HEADER_ID, + Flags: ULONG, + KnownHeaderCount: USHORT, + KnownHeaders: PHTTP_KNOWN_HEADER, +}} +pub type PHTTP_MULTIPLE_KNOWN_HEADERS = *mut HTTP_MULTIPLE_KNOWN_HEADERS; +STRUCT!{struct HTTP_RESPONSE_V2 { + Base: HTTP_RESPONSE_V1, + ResponseInfoCount: USHORT, + pResponseInfo: PHTTP_RESPONSE_INFO, +}} +pub type PHTTP_RESPONSE_V2 = *mut HTTP_RESPONSE_V2; +pub type HTTP_RESPONSE = HTTP_RESPONSE_V2; +pub type PHTTP_RESPONSE = *mut HTTP_RESPONSE; +STRUCT!{struct HTTPAPI_VERSION { + HttpApiMajorVersion: USHORT, + HttpApiMinorVersion: USHORT, +}} +pub type PHTTPAPI_VERSION = *mut HTTPAPI_VERSION; +pub const HTTPAPI_VERSION_2: HTTPAPI_VERSION = HTTPAPI_VERSION { + HttpApiMajorVersion: 2, + HttpApiMinorVersion: 0, +}; +pub const HTTPAPI_VERSION_1: HTTPAPI_VERSION = HTTPAPI_VERSION { + HttpApiMajorVersion: 1, + HttpApiMinorVersion: 0, +}; +#[inline] +pub fn HTTPAPI_EQUAL_VERSION(version: HTTPAPI_VERSION, major: USHORT, minor: USHORT) -> bool { + version.HttpApiMajorVersion == major && version.HttpApiMinorVersion == minor +} +#[inline] +pub fn HTTPAPI_GREATER_VERSION(version: HTTPAPI_VERSION, major: USHORT, minor: USHORT) -> bool { + version.HttpApiMajorVersion > major || + (version.HttpApiMajorVersion == major && version.HttpApiMinorVersion > minor) +} +#[inline] +pub fn HTTPAPI_LESS_VERSION(version: HTTPAPI_VERSION, major: USHORT, minor: USHORT) -> bool { + version.HttpApiMajorVersion < major || + (version.HttpApiMajorVersion == major && version.HttpApiMinorVersion < minor) +} +#[inline] +pub fn HTTPAPI_VERSION_GREATER_OR_EQUAL( + version: HTTPAPI_VERSION, + major: USHORT, + minor: USHORT +) -> bool { + !HTTPAPI_LESS_VERSION(version, major, minor) +} +ENUM!{enum HTTP_CACHE_POLICY_TYPE { + HttpCachePolicyNocache, + HttpCachePolicyUserInvalidates, + HttpCachePolicyTimeToLive, + HttpCachePolicyMaximum, +}} +pub type PHTTP_CACHE_POLICY_TYPE = *mut HTTP_CACHE_POLICY_TYPE; +STRUCT!{struct HTTP_CACHE_POLICY { + Policy: HTTP_CACHE_POLICY_TYPE, + SecondsToLive: ULONG, +}} +pub type PHTTP_CACHE_POLICY = *mut HTTP_CACHE_POLICY; +ENUM!{enum HTTP_SERVICE_CONFIG_ID { + HttpServiceConfigIPListenList, + HttpServiceConfigSSLCertInfo, + HttpServiceConfigUrlAclInfo, + HttpServiceConfigTimeout, + HttpServiceConfigCache, + HttpServiceConfigSslSniCertInfo, + HttpServiceConfigSslCcsCertInfo, + HttpServiceConfigMax, +}} +pub type PHTTP_SERVICE_CONFIG_ID = *mut HTTP_SERVICE_CONFIG_ID; +ENUM!{enum HTTP_SERVICE_CONFIG_QUERY_TYPE { + HttpServiceConfigQueryExact, + HttpServiceConfigQueryNext, + HttpServiceConfigQueryMax, +}} +pub type PHTTP_SERVICE_CONFIG_QUERY_TYPE = *mut HTTP_SERVICE_CONFIG_QUERY_TYPE; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_KEY { + pIpPort: PSOCKADDR, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_KEY = *mut HTTP_SERVICE_CONFIG_SSL_KEY; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_SNI_KEY { + IpPort: SOCKADDR_STORAGE, + Host: PWSTR, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SNI_KEY = *mut HTTP_SERVICE_CONFIG_SSL_SNI_KEY; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_CCS_KEY { + LocalAddress: SOCKADDR_STORAGE, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_CCS_KEY = *mut HTTP_SERVICE_CONFIG_SSL_CCS_KEY; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_PARAM { + SslHashLength: ULONG, + pSslHash: PVOID, + AppId: GUID, + pSslCertStoreName: PWSTR, + DefaultCertCheckMode: DWORD, + DefaultRevocationFreshnessTime: DWORD, + DefaultRevocationUrlRetrievalTimeout: DWORD, + pDefaultSslCtlIdentifier: PWSTR, + pDefaultSslCtlStoreName: PWSTR, + DefaultFlags: DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_PARAM = *mut HTTP_SERVICE_CONFIG_SSL_PARAM; +pub const HTTP_SERVICE_CONFIG_SSL_FLAG_USE_DS_MAPPER: DWORD = 0x00000001; +pub const HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT: DWORD = 0x00000002; +pub const HTTP_SERVICE_CONFIG_SSL_FLAG_NO_RAW_FILTER: DWORD = 0x00000004; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_SET { + KeyDesc: HTTP_SERVICE_CONFIG_SSL_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SET = *mut HTTP_SERVICE_CONFIG_SSL_SET; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_SNI_SET { + KeyDesc: HTTP_SERVICE_CONFIG_SSL_SNI_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SNI_SET = *mut HTTP_SERVICE_CONFIG_SSL_SNI_SET; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_CCS_SET { + KeyDesc: HTTP_SERVICE_CONFIG_SSL_CCS_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_CCS_SET = *mut HTTP_SERVICE_CONFIG_SSL_CCS_SET; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_SSL_KEY, + dwToken: DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_QUERY; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_SNI_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_SSL_SNI_KEY, + dwToken: DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_SNI_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_SNI_QUERY; +STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_CCS_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_SSL_CCS_KEY, + dwToken: DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_SSL_CCS_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_CCS_QUERY; +STRUCT!{struct HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM { + AddrLength: USHORT, + pAddress: PSOCKADDR, +}} +pub type PHTTP_SERVICE_CONFIG_IP_LISTEN_PARAM = *mut HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM; +STRUCT!{struct HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY { + AddrCount: ULONG, + AddrList: [SOCKADDR_STORAGE; ANYSIZE_ARRAY], +}} +pub type PHTTP_SERVICE_CONFIG_IP_LISTEN_QUERY = *mut HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_KEY { + pUrlPrefix: PWSTR, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_KEY = *mut HTTP_SERVICE_CONFIG_URLACL_KEY; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_PARAM { + pStringSecurityDescriptor: PWSTR, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_PARAM = *mut HTTP_SERVICE_CONFIG_URLACL_PARAM; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_SET { + KeyDesc: HTTP_SERVICE_CONFIG_URLACL_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_URLACL_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_SET = *mut HTTP_SERVICE_CONFIG_URLACL_SET; +STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_QUERY { + QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, + KeyDesc: HTTP_SERVICE_CONFIG_URLACL_KEY, + dwToken: DWORD, +}} +pub type PHTTP_SERVICE_CONFIG_URLACL_QUERY = *mut HTTP_SERVICE_CONFIG_URLACL_QUERY; +ENUM!{enum HTTP_SERVICE_CONFIG_CACHE_KEY { + MaxCacheResponseSize = 0, + CacheRangeChunkSize, +}} +pub type PHTTP_SERVICE_CONFIG_CACHE_KEY = *mut HTTP_SERVICE_CONFIG_CACHE_KEY; +pub type HTTP_SERVICE_CONFIG_CACHE_PARAM = ULONG; +pub type PHTTP_SERVICE_CONFIG_CACHE_PARAM = *mut ULONG; +STRUCT!{struct HTTP_SERVICE_CONFIG_CACHE_SET { + KeyDesc: HTTP_SERVICE_CONFIG_CACHE_KEY, + ParamDesc: HTTP_SERVICE_CONFIG_CACHE_PARAM, +}} +pub type PHTTP_SERVICE_CONFIG_CACHE_SET = *mut HTTP_SERVICE_CONFIG_CACHE_SET; +extern "system" { + pub fn HttpInitialize( + Version: HTTPAPI_VERSION, + Flags: ULONG, + pReserved: PVOID, + ) -> ULONG; + pub fn HttpTerminate( + Flags: ULONG, + pReserved: PVOID, + ) -> ULONG; + pub fn HttpCreateHttpHandle( + pReqQueueHandle: HANDLE, + Reserved: ULONG, + ) -> ULONG; + pub fn HttpCreateRequestQueue( + Version: HTTPAPI_VERSION, + pName: PCWSTR, + pSecurityAttributes: PSECURITY_ATTRIBUTES, + Flags: ULONG, + pReqQueueHandle: PHANDLE, + ) -> ULONG; + pub fn HttpCloseRequestQueue( + ReqQueueHandle: HANDLE, + ) -> ULONG; + pub fn HttpSetRequestQueueProperty( + Handle: HANDLE, + Property: HTTP_SERVER_PROPERTY, + pPropertyInformation: PVOID, + PropertyInformationLength: ULONG, + Reserved: ULONG, + pReserved: PVOID, + ) -> ULONG; + pub fn HttpQueryRequestQueueProperty( + Handle: HANDLE, + Property: HTTP_SERVER_PROPERTY, + pPropertyInformation: PVOID, + PropertyInformationLength: ULONG, + Reserved: ULONG, + pReturnLength: PULONG, + pReserved: PVOID, + ) -> ULONG; + pub fn HttpShutdownRequestQueue( + ReqQueueHandle: HANDLE + ) -> ULONG; + pub fn HttpReceiveClientCertificate( + ReqQueueHandle: HANDLE, + ConnectionId: HTTP_CONNECTION_ID, + Flags: ULONG, + pSslClientCertInfo: PHTTP_SSL_CLIENT_CERT_INFO, + SslClientCertInfoSize: ULONG, + pBytesReceived: PULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpCreateServerSession( + Version: HTTPAPI_VERSION, + pServerSessionId: PHTTP_SERVER_SESSION_ID, + Reserved: ULONG, + ) -> ULONG; + pub fn HttpCloseServerSession( + ServerSessionId: HTTP_SERVER_SESSION_ID, + ) -> ULONG; + pub fn HttpQueryServerSessionProperty( + ServerSessionId: HTTP_SERVER_SESSION_ID, + Property: HTTP_SERVER_PROPERTY, + pPropertyInformation: PVOID, + PropertyInformationLength: ULONG, + pReturnLength: PULONG, + ) -> ULONG; + pub fn HttpSetServerSessionProperty( + ServerSessionId: HTTP_SERVER_SESSION_ID, + Property: HTTP_SERVER_PROPERTY, + pPropertyInformation: PVOID, + PropertyInformationLength: ULONG, + ) -> ULONG; + pub fn HttpAddUrl( + ReqQueueHandle: HANDLE, + pFullyQualifiedUrl: PCWSTR, + pReserved: PVOID, + ) -> ULONG; + pub fn HttpRemoveUrl( + ReqQueueHandle: HANDLE, + pFullyQualifiedUrl: PCWSTR, + ) -> ULONG; + pub fn HttpCreateUrlGroup( + ServerSessionId: HTTP_SERVER_SESSION_ID, + pUrlGroupId: PHTTP_URL_GROUP_ID, + Reserved: ULONG, + ) -> ULONG; + pub fn HttpCloseUrlGroup( + UrlGroupId: HTTP_URL_GROUP_ID, + ) -> ULONG; + pub fn HttpAddUrlToUrlGroup( + UrlGroupId: HTTP_URL_GROUP_ID, + pFullyQualifiedUrl: PCWSTR, + UrlContext: HTTP_URL_CONTEXT, + Reserved: ULONG, + ) -> ULONG; + pub fn HttpRemoveUrlFromUrlGroup( + UrlGroupId: HTTP_URL_GROUP_ID, + pFullyQualifiedUrl: PCWSTR, + Flags: ULONG, + ) -> ULONG; + pub fn HttpSetUrlGroupProperty( + UrlGroupId: HTTP_URL_GROUP_ID, + Property: HTTP_SERVER_PROPERTY, + pPropertyInformation: PVOID, + PropertyInformationLength: ULONG, + ) -> ULONG; + pub fn HttpQueryUrlGroupProperty( + UrlGroupId: HTTP_URL_GROUP_ID, + Property: HTTP_SERVER_PROPERTY, + pPropertyInformation: PVOID, + PropertyInformationLength: ULONG, + pReturnLength: PULONG, + ) -> ULONG; + pub fn HttpPrepareUrl( + Reserved: PVOID, + Flags: ULONG, + Url: PCWSTR, + PreparedUrl: *mut PWSTR, + ) -> ULONG; + pub fn HttpReceiveHttpRequest( + ReqQueueHandle: HANDLE, + RequestId: HTTP_REQUEST_ID, + Flags: ULONG, + pRequestBuffer: PHTTP_REQUEST, + RequestBufferLength: ULONG, + pBytesReturned: PULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpReceiveRequestEntityBody( + ReqQueueHandle: HANDLE, + RequestId: HTTP_REQUEST_ID, + Flags: ULONG, + pBuffer: PVOID, + EntityBufferLength: ULONG, + pBytesReturned: PULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpSendHttpResponse( + ReqQueueHandle: HANDLE, + RequestId: HTTP_REQUEST_ID, + Flags: ULONG, + pHttpResponse: PHTTP_RESPONSE, + pCachePolicy: PHTTP_CACHE_POLICY, + pBytesSent: PULONG, + pReserved1: PVOID, + Reserved2: ULONG, + pOverlapped: LPOVERLAPPED, + pLogData: PHTTP_LOG_DATA, + ) -> ULONG; + pub fn HttpSendResponseEntityBody( + ReqQueueHandle: HANDLE, + RequestId: HTTP_REQUEST_ID, + Flags: ULONG, + EntityChunkCount: USHORT, + pEntityChunks: PHTTP_DATA_CHUNK, + pBytesSent: PULONG, + pReserved1: PVOID, + Reserved2: ULONG, + pOverlapped: LPOVERLAPPED, + pLogData: PHTTP_LOG_DATA, + ) -> ULONG; + pub fn HttpWaitForDisconnect( + ReqQueueHandle: HANDLE, + ConnectionId: HTTP_CONNECTION_ID, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpWaitForDisconnectEx( + ReqQueueHandle: HANDLE, + ConnectionId: HTTP_CONNECTION_ID, + Reserved: ULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpCancelHttpRequest( + ReqQueueHandle: HANDLE, + RequestId: HTTP_REQUEST_ID, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpWaitForDemandStart( + ReqQueueHandle: HANDLE, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpFlushResponseCache( + ReqQueueHandle: HANDLE, + pUrlPrefix: PCWSTR, + Flags: ULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpAddFragmentToCache( + ReqQueueHandle: HANDLE, + pUrlPrefix: PCWSTR, + pDataChunk: PHTTP_DATA_CHUNK, + pCachePolicy: PHTTP_CACHE_POLICY, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpReadFragmentFromCache( + ReqQueueHandle: HANDLE, + pUrlPrefix: PCWSTR, + pByteRange: PHTTP_BYTE_RANGE, + pBuffer: PVOID, + BufferLength: ULONG, + pBytesRead: PULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpSetServiceConfiguration( + ServiceHandle: HANDLE, + ConfigId: HTTP_SERVICE_CONFIG_ID, + pConfigInformation: PVOID, + ConfigInformationLength: ULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpDeleteServiceConfiguration( + ServiceHandle: HANDLE, + ConfigId: HTTP_SERVICE_CONFIG_ID, + pConfigInformation: PVOID, + ConfigInformationLength: ULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; + pub fn HttpQueryServiceConfiguration( + ServiceHandle: HANDLE, + ConfigId: HTTP_SERVICE_CONFIG_ID, + pInput: PVOID, + InputLength: ULONG, + pOutput: PVOID, + OutputLength: ULONG, + pReturnLength: PULONG, + pOverlapped: LPOVERLAPPED, + ) -> ULONG; +} diff --git a/src/vendor/winapi/src/um/imm.rs b/src/vendor/winapi/src/um/imm.rs new file mode 100644 index 0000000000..8f3cc1ddde --- /dev/null +++ b/src/vendor/winapi/src/um/imm.rs @@ -0,0 +1,8 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_uint; +pub type LPUINT = *mut c_uint; diff --git a/src/vendor/winapi/src/um/interlockedapi.rs b/src/vendor/winapi/src/um/interlockedapi.rs new file mode 100644 index 0000000000..a945f1c7b4 --- /dev/null +++ b/src/vendor/winapi/src/um/interlockedapi.rs @@ -0,0 +1,32 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{ULONG, USHORT}; +use um::winnt::{PSLIST_ENTRY, PSLIST_HEADER}; +extern "system" { + pub fn InitializeSListHead( + ListHead: PSLIST_HEADER, + ); + pub fn InterlockedPopEntrySList( + ListHead: PSLIST_HEADER, + ) -> PSLIST_ENTRY; + pub fn InterlockedPushEntrySList( + ListHead: PSLIST_HEADER, + ListEntry: PSLIST_ENTRY, + ) -> PSLIST_ENTRY; + pub fn InterlockedPushListSListEx( + ListHead: PSLIST_HEADER, + List: PSLIST_ENTRY, + ListEnd: PSLIST_ENTRY, + Count: ULONG, + ) -> PSLIST_ENTRY; + pub fn InterlockedFlushSList( + ListHead: PSLIST_HEADER, + ) -> PSLIST_ENTRY; + pub fn QueryDepthSList( + ListHead: PSLIST_HEADER, + ) -> USHORT; +} diff --git a/src/vendor/winapi/src/um/ioapiset.rs b/src/vendor/winapi/src/um/ioapiset.rs new file mode 100644 index 0000000000..0b2c6e1d78 --- /dev/null +++ b/src/vendor/winapi/src/um/ioapiset.rs @@ -0,0 +1,72 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::{PULONG_PTR, ULONG_PTR}; +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID, PULONG, ULONG}; +use um::minwinbase::{LPOVERLAPPED, LPOVERLAPPED_ENTRY}; +use um::winnt::{HANDLE}; +extern "system" { + pub fn CreateIoCompletionPort( + FileHandle: HANDLE, + ExistingCompletionPort: HANDLE, + CompletionKey: ULONG_PTR, + NumberOfConcurrentThreads: DWORD, + ) -> HANDLE; + pub fn GetQueuedCompletionStatus( + CompletionPort: HANDLE, + lpNumberOfBytesTransferred: LPDWORD, + lpCompletionKey: PULONG_PTR, + lpOverlapped: *mut LPOVERLAPPED, + dwMilliseconds: DWORD, + ) -> BOOL; + pub fn GetQueuedCompletionStatusEx( + CompletionPort: HANDLE, + lpCompletionPortEntries: LPOVERLAPPED_ENTRY, + ulCount: ULONG, + ulNumEntriesRemoved: PULONG, + dwMilliseconds: DWORD, + fAlertable: BOOL, + ) -> BOOL; + pub fn PostQueuedCompletionStatus( + CompletionPort: HANDLE, + dwNumberOfBytesTransferred: DWORD, + dwCompletionKey: ULONG_PTR, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn DeviceIoControl( + hDevice: HANDLE, + dwIoControlCode: DWORD, + lpInBuffer: LPVOID, + nInBufferSize: DWORD, + lpOutBuffer: LPVOID, + nOutBufferSize: DWORD, + lpBytesReturned: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn GetOverlappedResult( + hFile: HANDLE, + lpOverlapped: LPOVERLAPPED, + lpNumberOfBytesTransferred: LPDWORD, + bWait: BOOL, + ) -> BOOL; + pub fn CancelIoEx( + hFile: HANDLE, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn CancelIo( + hFile: HANDLE, + ) -> BOOL; + pub fn GetOverlappedResultEx( + hFile: HANDLE, + lpOverlapped: LPOVERLAPPED, + lpNumberOfBytesTransferred: LPDWORD, + dwMilliseconds: DWORD, + bAlertable: BOOL, + ) -> BOOL; + pub fn CancelSynchronousIo( + hThread: HANDLE, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/jobapi.rs b/src/vendor/winapi/src/um/jobapi.rs new file mode 100644 index 0000000000..10370252db --- /dev/null +++ b/src/vendor/winapi/src/um/jobapi.rs @@ -0,0 +1,16 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, PBOOL}; +use um::winnt::HANDLE; +extern "system" { + pub fn IsProcessInJob( + ProcessHandle: HANDLE, + JobHandle: HANDLE, + Result: PBOOL, + ) -> BOOL; +} + diff --git a/src/vendor/winapi/src/um/jobapi2.rs b/src/vendor/winapi/src/um/jobapi2.rs new file mode 100644 index 0000000000..316406ecf6 --- /dev/null +++ b/src/vendor/winapi/src/um/jobapi2.rs @@ -0,0 +1,64 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::LONG64; +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID, UINT, ULONG}; +use shared::ntdef::{HANDLE, LPCWSTR, PCWSTR, VOID}; +use um::minwinbase::LPSECURITY_ATTRIBUTES; +use um::winnt::JOBOBJECTINFOCLASS; +STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION { + MaxIops: LONG64, + MaxBandwidth: LONG64, + ReservationIops: LONG64, + VolumeName: PCWSTR, + BaseIoSize: ULONG, + ControlFlags: ULONG, +}} +extern "system" { + pub fn CreateJobObjectW( + lpJobAttributes: LPSECURITY_ATTRIBUTES, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn FreeMemoryJobObject( + Buffer: *mut VOID, + ) -> (); + pub fn OpenJobObjectW( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn AssignProcessToJobObject( + hJob: HANDLE, + hProcess: HANDLE, + ) -> BOOL; + pub fn TerminateJobObject( + hJob: HANDLE, + uExitCode: UINT, + ) -> BOOL; + pub fn SetInformationJobObject( + hJob: HANDLE, + JobObjectInformationClass: JOBOBJECTINFOCLASS, + lpJobObjectInformation: LPVOID, + cbJovObjectInformationLength: DWORD, + ) -> BOOL; + pub fn SetIoRateControlInformationJobObject( + hJob: HANDLE, + IoRateControlInfo: *mut JOBOBJECT_IO_RATE_CONTROL_INFORMATION, + ) -> DWORD; + pub fn QueryInformationJobObject( + hJob: HANDLE, + JobObjectInformationClass: JOBOBJECTINFOCLASS, + lpJobObjectInformation: LPVOID, + cbJovObjectInformationLength: DWORD, + lpReturnLength: LPDWORD, + ) -> BOOL; + pub fn QueryIoRateControlInformationJobObject( + hJob: HANDLE, + VolumeName: PCWSTR, + InfoBlocks: *mut *mut JOBOBJECT_IO_RATE_CONTROL_INFORMATION, + InfoBlockCount: *mut ULONG, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/knownfolders.rs b/src/vendor/winapi/src/um/knownfolders.rs new file mode 100644 index 0000000000..4e018dbfb1 --- /dev/null +++ b/src/vendor/winapi/src/um/knownfolders.rs @@ -0,0 +1,288 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{FOLDERID_NetworkFolder, + 0xD20BEEC4, 0x5CA8, 0x4905, 0xAE, 0x3B, 0xBF, 0x25, 0x1E, 0xA0, 0x9B, 0x53} +DEFINE_GUID!{FOLDERID_ComputerFolder, + 0x0AC0837C, 0xBBF8, 0x452A, 0x85, 0x0D, 0x79, 0xD0, 0x8E, 0x66, 0x7C, 0xA7} +DEFINE_GUID!{FOLDERID_InternetFolder, + 0x4D9F7874, 0x4E0C, 0x4904, 0x96, 0x7B, 0x40, 0xB0, 0xD2, 0x0C, 0x3E, 0x4B} +DEFINE_GUID!{FOLDERID_ControlPanelFolder, + 0x82A74AEB, 0xAEB4, 0x465C, 0xA0, 0x14, 0xD0, 0x97, 0xEE, 0x34, 0x6D, 0x63} +DEFINE_GUID!{FOLDERID_PrintersFolder, + 0x76FC4E2D, 0xD6AD, 0x4519, 0xA6, 0x63, 0x37, 0xBD, 0x56, 0x06, 0x81, 0x85} +DEFINE_GUID!{FOLDERID_SyncManagerFolder, + 0x43668BF8, 0xC14E, 0x49B2, 0x97, 0xC9, 0x74, 0x77, 0x84, 0xD7, 0x84, 0xB7} +DEFINE_GUID!{FOLDERID_SyncSetupFolder, + 0x0f214138, 0xb1d3, 0x4a90, 0xbb, 0xa9, 0x27, 0xcb, 0xc0, 0xc5, 0x38, 0x9a} +DEFINE_GUID!{FOLDERID_ConflictFolder, + 0x4bfefb45, 0x347d, 0x4006, 0xa5, 0xbe, 0xac, 0x0c, 0xb0, 0x56, 0x71, 0x92} +DEFINE_GUID!{FOLDERID_SyncResultsFolder, + 0x289a9a43, 0xbe44, 0x4057, 0xa4, 0x1b, 0x58, 0x7a, 0x76, 0xd7, 0xe7, 0xf9} +DEFINE_GUID!{FOLDERID_RecycleBinFolder, + 0xB7534046, 0x3ECB, 0x4C18, 0xBE, 0x4E, 0x64, 0xCD, 0x4C, 0xB7, 0xD6, 0xAC} +DEFINE_GUID!{FOLDERID_ConnectionsFolder, + 0x6F0CD92B, 0x2E97, 0x45D1, 0x88, 0xFF, 0xB0, 0xD1, 0x86, 0xB8, 0xDE, 0xDD} +DEFINE_GUID!{FOLDERID_Fonts, + 0xFD228CB7, 0xAE11, 0x4AE3, 0x86, 0x4C, 0x16, 0xF3, 0x91, 0x0A, 0xB8, 0xFE} +DEFINE_GUID!{FOLDERID_Desktop, + 0xB4BFCC3A, 0xDB2C, 0x424C, 0xB0, 0x29, 0x7F, 0xE9, 0x9A, 0x87, 0xC6, 0x41} +DEFINE_GUID!{FOLDERID_Startup, + 0xB97D20BB, 0xF46A, 0x4C97, 0xBA, 0x10, 0x5E, 0x36, 0x08, 0x43, 0x08, 0x54} +DEFINE_GUID!{FOLDERID_Programs, + 0xA77F5D77, 0x2E2B, 0x44C3, 0xA6, 0xA2, 0xAB, 0xA6, 0x01, 0x05, 0x4A, 0x51} +DEFINE_GUID!{FOLDERID_StartMenu, + 0x625B53C3, 0xAB48, 0x4EC1, 0xBA, 0x1F, 0xA1, 0xEF, 0x41, 0x46, 0xFC, 0x19} +DEFINE_GUID!{FOLDERID_Recent, + 0xAE50C081, 0xEBD2, 0x438A, 0x86, 0x55, 0x8A, 0x09, 0x2E, 0x34, 0x98, 0x7A} +DEFINE_GUID!{FOLDERID_SendTo, + 0x8983036C, 0x27C0, 0x404B, 0x8F, 0x08, 0x10, 0x2D, 0x10, 0xDC, 0xFD, 0x74} +DEFINE_GUID!{FOLDERID_Documents, + 0xFDD39AD0, 0x238F, 0x46AF, 0xAD, 0xB4, 0x6C, 0x85, 0x48, 0x03, 0x69, 0xC7} +DEFINE_GUID!{FOLDERID_Favorites, + 0x1777F761, 0x68AD, 0x4D8A, 0x87, 0xBD, 0x30, 0xB7, 0x59, 0xFA, 0x33, 0xDD} +DEFINE_GUID!{FOLDERID_NetHood, + 0xC5ABBF53, 0xE17F, 0x4121, 0x89, 0x00, 0x86, 0x62, 0x6F, 0xC2, 0xC9, 0x73} +DEFINE_GUID!{FOLDERID_PrintHood, + 0x9274BD8D, 0xCFD1, 0x41C3, 0xB3, 0x5E, 0xB1, 0x3F, 0x55, 0xA7, 0x58, 0xF4} +DEFINE_GUID!{FOLDERID_Templates, + 0xA63293E8, 0x664E, 0x48DB, 0xA0, 0x79, 0xDF, 0x75, 0x9E, 0x05, 0x09, 0xF7} +DEFINE_GUID!{FOLDERID_CommonStartup, + 0x82A5EA35, 0xD9CD, 0x47C5, 0x96, 0x29, 0xE1, 0x5D, 0x2F, 0x71, 0x4E, 0x6E} +DEFINE_GUID!{FOLDERID_CommonPrograms, + 0x0139D44E, 0x6AFE, 0x49F2, 0x86, 0x90, 0x3D, 0xAF, 0xCA, 0xE6, 0xFF, 0xB8} +DEFINE_GUID!{FOLDERID_CommonStartMenu, + 0xA4115719, 0xD62E, 0x491D, 0xAA, 0x7C, 0xE7, 0x4B, 0x8B, 0xE3, 0xB0, 0x67} +DEFINE_GUID!{FOLDERID_PublicDesktop, + 0xC4AA340D, 0xF20F, 0x4863, 0xAF, 0xEF, 0xF8, 0x7E, 0xF2, 0xE6, 0xBA, 0x25} +DEFINE_GUID!{FOLDERID_ProgramData, + 0x62AB5D82, 0xFDC1, 0x4DC3, 0xA9, 0xDD, 0x07, 0x0D, 0x1D, 0x49, 0x5D, 0x97} +DEFINE_GUID!{FOLDERID_CommonTemplates, + 0xB94237E7, 0x57AC, 0x4347, 0x91, 0x51, 0xB0, 0x8C, 0x6C, 0x32, 0xD1, 0xF7} +DEFINE_GUID!{FOLDERID_PublicDocuments, + 0xED4824AF, 0xDCE4, 0x45A8, 0x81, 0xE2, 0xFC, 0x79, 0x65, 0x08, 0x36, 0x34} +DEFINE_GUID!{FOLDERID_RoamingAppData, + 0x3EB685DB, 0x65F9, 0x4CF6, 0xA0, 0x3A, 0xE3, 0xEF, 0x65, 0x72, 0x9F, 0x3D} +DEFINE_GUID!{FOLDERID_LocalAppData, + 0xF1B32785, 0x6FBA, 0x4FCF, 0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91} +DEFINE_GUID!{FOLDERID_LocalAppDataLow, + 0xA520A1A4, 0x1780, 0x4FF6, 0xBD, 0x18, 0x16, 0x73, 0x43, 0xC5, 0xAF, 0x16} +DEFINE_GUID!{FOLDERID_InternetCache, + 0x352481E8, 0x33BE, 0x4251, 0xBA, 0x85, 0x60, 0x07, 0xCA, 0xED, 0xCF, 0x9D} +DEFINE_GUID!{FOLDERID_Cookies, + 0x2B0F765D, 0xC0E9, 0x4171, 0x90, 0x8E, 0x08, 0xA6, 0x11, 0xB8, 0x4F, 0xF6} +DEFINE_GUID!{FOLDERID_History, + 0xD9DC8A3B, 0xB784, 0x432E, 0xA7, 0x81, 0x5A, 0x11, 0x30, 0xA7, 0x59, 0x63} +DEFINE_GUID!{FOLDERID_System, + 0x1AC14E77, 0x02E7, 0x4E5D, 0xB7, 0x44, 0x2E, 0xB1, 0xAE, 0x51, 0x98, 0xB7} +DEFINE_GUID!{FOLDERID_SystemX86, + 0xD65231B0, 0xB2F1, 0x4857, 0xA4, 0xCE, 0xA8, 0xE7, 0xC6, 0xEA, 0x7D, 0x27} +DEFINE_GUID!{FOLDERID_Windows, + 0xF38BF404, 0x1D43, 0x42F2, 0x93, 0x05, 0x67, 0xDE, 0x0B, 0x28, 0xFC, 0x23} +DEFINE_GUID!{FOLDERID_Profile, + 0x5E6C858F, 0x0E22, 0x4760, 0x9A, 0xFE, 0xEA, 0x33, 0x17, 0xB6, 0x71, 0x73} +DEFINE_GUID!{FOLDERID_Pictures, + 0x33E28130, 0x4E1E, 0x4676, 0x83, 0x5A, 0x98, 0x39, 0x5C, 0x3B, 0xC3, 0xBB} +DEFINE_GUID!{FOLDERID_ProgramFilesX86, + 0x7C5A40EF, 0xA0FB, 0x4BFC, 0x87, 0x4A, 0xC0, 0xF2, 0xE0, 0xB9, 0xFA, 0x8E} +DEFINE_GUID!{FOLDERID_ProgramFilesCommonX86, + 0xDE974D24, 0xD9C6, 0x4D3E, 0xBF, 0x91, 0xF4, 0x45, 0x51, 0x20, 0xB9, 0x17} +DEFINE_GUID!{FOLDERID_ProgramFilesX64, + 0x6d809377, 0x6af0, 0x444b, 0x89, 0x57, 0xa3, 0x77, 0x3f, 0x02, 0x20, 0x0e} +DEFINE_GUID!{FOLDERID_ProgramFilesCommonX64, + 0x6365d5a7, 0x0f0d, 0x45e5, 0x87, 0xf6, 0x0d, 0xa5, 0x6b, 0x6a, 0x4f, 0x7d} +DEFINE_GUID!{FOLDERID_ProgramFiles, + 0x905e63b6, 0xc1bf, 0x494e, 0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a} +DEFINE_GUID!{FOLDERID_ProgramFilesCommon, + 0xF7F1ED05, 0x9F6D, 0x47A2, 0xAA, 0xAE, 0x29, 0xD3, 0x17, 0xC6, 0xF0, 0x66} +DEFINE_GUID!{FOLDERID_UserProgramFiles, + 0x5cd7aee2, 0x2219, 0x4a67, 0xb8, 0x5d, 0x6c, 0x9c, 0xe1, 0x56, 0x60, 0xcb} +DEFINE_GUID!{FOLDERID_UserProgramFilesCommon, + 0xbcbd3057, 0xca5c, 0x4622, 0xb4, 0x2d, 0xbc, 0x56, 0xdb, 0x0a, 0xe5, 0x16} +DEFINE_GUID!{FOLDERID_AdminTools, + 0x724EF170, 0xA42D, 0x4FEF, 0x9F, 0x26, 0xB6, 0x0E, 0x84, 0x6F, 0xBA, 0x4F} +DEFINE_GUID!{FOLDERID_CommonAdminTools, + 0xD0384E7D, 0xBAC3, 0x4797, 0x8F, 0x14, 0xCB, 0xA2, 0x29, 0xB3, 0x92, 0xB5} +DEFINE_GUID!{FOLDERID_Music, + 0x4BD8D571, 0x6D19, 0x48D3, 0xBE, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0E, 0x43} +DEFINE_GUID!{FOLDERID_Videos, + 0x18989B1D, 0x99B5, 0x455B, 0x84, 0x1C, 0xAB, 0x7C, 0x74, 0xE4, 0xDD, 0xFC} +DEFINE_GUID!{FOLDERID_Ringtones, + 0xC870044B, 0xF49E, 0x4126, 0xA9, 0xC3, 0xB5, 0x2A, 0x1F, 0xF4, 0x11, 0xE8} +DEFINE_GUID!{FOLDERID_PublicPictures, + 0xB6EBFB86, 0x6907, 0x413C, 0x9A, 0xF7, 0x4F, 0xC2, 0xAB, 0xF0, 0x7C, 0xC5} +DEFINE_GUID!{FOLDERID_PublicMusic, + 0x3214FAB5, 0x9757, 0x4298, 0xBB, 0x61, 0x92, 0xA9, 0xDE, 0xAA, 0x44, 0xFF} +DEFINE_GUID!{FOLDERID_PublicVideos, + 0x2400183A, 0x6185, 0x49FB, 0xA2, 0xD8, 0x4A, 0x39, 0x2A, 0x60, 0x2B, 0xA3} +DEFINE_GUID!{FOLDERID_PublicRingtones, + 0xE555AB60, 0x153B, 0x4D17, 0x9F, 0x04, 0xA5, 0xFE, 0x99, 0xFC, 0x15, 0xEC} +DEFINE_GUID!{FOLDERID_ResourceDir, + 0x8AD10C31, 0x2ADB, 0x4296, 0xA8, 0xF7, 0xE4, 0x70, 0x12, 0x32, 0xC9, 0x72} +DEFINE_GUID!{FOLDERID_LocalizedResourcesDir, + 0x2A00375E, 0x224C, 0x49DE, 0xB8, 0xD1, 0x44, 0x0D, 0xF7, 0xEF, 0x3D, 0xDC} +DEFINE_GUID!{FOLDERID_CommonOEMLinks, + 0xC1BAE2D0, 0x10DF, 0x4334, 0xBE, 0xDD, 0x7A, 0xA2, 0x0B, 0x22, 0x7A, 0x9D} +DEFINE_GUID!{FOLDERID_CDBurning, + 0x9E52AB10, 0xF80D, 0x49DF, 0xAC, 0xB8, 0x43, 0x30, 0xF5, 0x68, 0x78, 0x55} +DEFINE_GUID!{FOLDERID_UserProfiles, + 0x0762D272, 0xC50A, 0x4BB0, 0xA3, 0x82, 0x69, 0x7D, 0xCD, 0x72, 0x9B, 0x80} +DEFINE_GUID!{FOLDERID_Playlists, + 0xDE92C1C7, 0x837F, 0x4F69, 0xA3, 0xBB, 0x86, 0xE6, 0x31, 0x20, 0x4A, 0x23} +DEFINE_GUID!{FOLDERID_SamplePlaylists, + 0x15CA69B3, 0x30EE, 0x49C1, 0xAC, 0xE1, 0x6B, 0x5E, 0xC3, 0x72, 0xAF, 0xB5} +DEFINE_GUID!{FOLDERID_SampleMusic, + 0xB250C668, 0xF57D, 0x4EE1, 0xA6, 0x3C, 0x29, 0x0E, 0xE7, 0xD1, 0xAA, 0x1F} +DEFINE_GUID!{FOLDERID_SamplePictures, + 0xC4900540, 0x2379, 0x4C75, 0x84, 0x4B, 0x64, 0xE6, 0xFA, 0xF8, 0x71, 0x6B} +DEFINE_GUID!{FOLDERID_SampleVideos, + 0x859EAD94, 0x2E85, 0x48AD, 0xA7, 0x1A, 0x09, 0x69, 0xCB, 0x56, 0xA6, 0xCD} +DEFINE_GUID!{FOLDERID_PhotoAlbums, + 0x69D2CF90, 0xFC33, 0x4FB7, 0x9A, 0x0C, 0xEB, 0xB0, 0xF0, 0xFC, 0xB4, 0x3C} +DEFINE_GUID!{FOLDERID_Public, + 0xDFDF76A2, 0xC82A, 0x4D63, 0x90, 0x6A, 0x56, 0x44, 0xAC, 0x45, 0x73, 0x85} +DEFINE_GUID!{FOLDERID_ChangeRemovePrograms, + 0xdf7266ac, 0x9274, 0x4867, 0x8d, 0x55, 0x3b, 0xd6, 0x61, 0xde, 0x87, 0x2d} +DEFINE_GUID!{FOLDERID_AppUpdates, + 0xa305ce99, 0xf527, 0x492b, 0x8b, 0x1a, 0x7e, 0x76, 0xfa, 0x98, 0xd6, 0xe4} +DEFINE_GUID!{FOLDERID_AddNewPrograms, + 0xde61d971, 0x5ebc, 0x4f02, 0xa3, 0xa9, 0x6c, 0x82, 0x89, 0x5e, 0x5c, 0x04} +DEFINE_GUID!{FOLDERID_Downloads, + 0x374de290, 0x123f, 0x4565, 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b} +DEFINE_GUID!{FOLDERID_PublicDownloads, + 0x3d644c9b, 0x1fb8, 0x4f30, 0x9b, 0x45, 0xf6, 0x70, 0x23, 0x5f, 0x79, 0xc0} +DEFINE_GUID!{FOLDERID_SavedSearches, + 0x7d1d3a04, 0xdebb, 0x4115, 0x95, 0xcf, 0x2f, 0x29, 0xda, 0x29, 0x20, 0xda} +DEFINE_GUID!{FOLDERID_QuickLaunch, + 0x52a4f021, 0x7b75, 0x48a9, 0x9f, 0x6b, 0x4b, 0x87, 0xa2, 0x10, 0xbc, 0x8f} +DEFINE_GUID!{FOLDERID_Contacts, + 0x56784854, 0xc6cb, 0x462b, 0x81, 0x69, 0x88, 0xe3, 0x50, 0xac, 0xb8, 0x82} +DEFINE_GUID!{FOLDERID_SidebarParts, + 0xa75d362e, 0x50fc, 0x4fb7, 0xac, 0x2c, 0xa8, 0xbe, 0xaa, 0x31, 0x44, 0x93} +DEFINE_GUID!{FOLDERID_SidebarDefaultParts, + 0x7b396e54, 0x9ec5, 0x4300, 0xbe, 0x0a, 0x24, 0x82, 0xeb, 0xae, 0x1a, 0x26} +DEFINE_GUID!{FOLDERID_PublicGameTasks, + 0xdebf2536, 0xe1a8, 0x4c59, 0xb6, 0xa2, 0x41, 0x45, 0x86, 0x47, 0x6a, 0xea} +DEFINE_GUID!{FOLDERID_GameTasks, + 0x054fae61, 0x4dd8, 0x4787, 0x80, 0xb6, 0x09, 0x02, 0x20, 0xc4, 0xb7, 0x0} +DEFINE_GUID!{FOLDERID_SavedGames, + 0x4c5c32ff, 0xbb9d, 0x43b0, 0xb5, 0xb4, 0x2d, 0x72, 0xe5, 0x4e, 0xaa, 0xa4} +DEFINE_GUID!{FOLDERID_Games, + 0xcac52c1a, 0xb53d, 0x4edc, 0x92, 0xd7, 0x6b, 0x2e, 0x8a, 0xc1, 0x94, 0x34} +DEFINE_GUID!{FOLDERID_SEARCH_MAPI, + 0x98ec0e18, 0x2098, 0x4d44, 0x86, 0x44, 0x66, 0x97, 0x93, 0x15, 0xa2, 0x81} +DEFINE_GUID!{FOLDERID_SEARCH_CSC, + 0xee32e446, 0x31ca, 0x4aba, 0x81, 0x4f, 0xa5, 0xeb, 0xd2, 0xfd, 0x6d, 0x5e} +DEFINE_GUID!{FOLDERID_Links, + 0xbfb9d5e0, 0xc6a9, 0x404c, 0xb2, 0xb2, 0xae, 0x6d, 0xb6, 0xaf, 0x49, 0x68} +DEFINE_GUID!{FOLDERID_UsersFiles, + 0xf3ce0f7c, 0x4901, 0x4acc, 0x86, 0x48, 0xd5, 0xd4, 0x4b, 0x04, 0xef, 0x8f} +DEFINE_GUID!{FOLDERID_UsersLibraries, + 0xa302545d, 0xdeff, 0x464b, 0xab, 0xe8, 0x61, 0xc8, 0x64, 0x8d, 0x93, 0x9b} +DEFINE_GUID!{FOLDERID_SearchHome, + 0x190337d1, 0xb8ca, 0x4121, 0xa6, 0x39, 0x6d, 0x47, 0x2d, 0x16, 0x97, 0x2a} +DEFINE_GUID!{FOLDERID_OriginalImages, + 0x2C36C0AA, 0x5812, 0x4b87, 0xbf, 0xd0, 0x4c, 0xd0, 0xdf, 0xb1, 0x9b, 0x39} +DEFINE_GUID!{FOLDERID_DocumentsLibrary, + 0x7b0db17d, 0x9cd2, 0x4a93, 0x97, 0x33, 0x46, 0xcc, 0x89, 0x02, 0x2e, 0x7c} +DEFINE_GUID!{FOLDERID_MusicLibrary, + 0x2112ab0a, 0xc86a, 0x4ffe, 0xa3, 0x68, 0x0d, 0xe9, 0x6e, 0x47, 0x01, 0x2e} +DEFINE_GUID!{FOLDERID_PicturesLibrary, + 0xa990ae9f, 0xa03b, 0x4e80, 0x94, 0xbc, 0x99, 0x12, 0xd7, 0x50, 0x41, 0x4} +DEFINE_GUID!{FOLDERID_VideosLibrary, + 0x491e922f, 0x5643, 0x4af4, 0xa7, 0xeb, 0x4e, 0x7a, 0x13, 0x8d, 0x81, 0x74} +DEFINE_GUID!{FOLDERID_RecordedTVLibrary, + 0x1a6fdba2, 0xf42d, 0x4358, 0xa7, 0x98, 0xb7, 0x4d, 0x74, 0x59, 0x26, 0xc5} +DEFINE_GUID!{FOLDERID_HomeGroup, + 0x52528a6b, 0xb9e3, 0x4add, 0xb6, 0x0d, 0x58, 0x8c, 0x2d, 0xba, 0x84, 0x2d} +DEFINE_GUID!{FOLDERID_HomeGroupCurrentUser, + 0x9b74b6a3, 0x0dfd, 0x4f11, 0x9e, 0x78, 0x5f, 0x78, 0x00, 0xf2, 0xe7, 0x72} +DEFINE_GUID!{FOLDERID_DeviceMetadataStore, + 0x5ce4a5e9, 0xe4eb, 0x479d, 0xb8, 0x9f, 0x13, 0x0c, 0x02, 0x88, 0x61, 0x55} +DEFINE_GUID!{FOLDERID_Libraries, + 0x1b3ea5dc, 0xb587, 0x4786, 0xb4, 0xef, 0xbd, 0x1d, 0xc3, 0x32, 0xae, 0xae} +DEFINE_GUID!{FOLDERID_PublicLibraries, + 0x48daf80b, 0xe6cf, 0x4f4e, 0xb8, 0x00, 0x0e, 0x69, 0xd8, 0x4e, 0xe3, 0x84} +DEFINE_GUID!{FOLDERID_UserPinned, + 0x9e3995ab, 0x1f9c, 0x4f13, 0xb8, 0x27, 0x48, 0xb2, 0x4b, 0x6c, 0x71, 0x74} +DEFINE_GUID!{FOLDERID_ImplicitAppShortcuts, + 0xbcb5256f, 0x79f6, 0x4cee, 0xb7, 0x25, 0xdc, 0x34, 0xe4, 0x02, 0xfd, 0x46} +DEFINE_GUID!{FOLDERID_AccountPictures, + 0x008ca0b1, 0x55b4, 0x4c56, 0xb8, 0xa8, 0x4d, 0xe4, 0xb2, 0x99, 0xd3, 0xbe} +DEFINE_GUID!{FOLDERID_PublicUserTiles, + 0x0482af6c, 0x08f1, 0x4c34, 0x8c, 0x90, 0xe1, 0x7e, 0xc9, 0x8b, 0x1e, 0x17} +DEFINE_GUID!{FOLDERID_AppsFolder, + 0x1e87508d, 0x89c2, 0x42f0, 0x8a, 0x7e, 0x64, 0x5a, 0x0f, 0x50, 0xca, 0x58} +DEFINE_GUID!{FOLDERID_StartMenuAllPrograms, + 0xf26305ef, 0x6948, 0x40b9, 0xb2, 0x55, 0x81, 0x45, 0x3d, 0x09, 0xc7, 0x85} +DEFINE_GUID!{FOLDERID_CommonStartMenuPlaces, + 0xa440879f, 0x87a0, 0x4f7d, 0xb7, 0x00, 0x02, 0x07, 0xb9, 0x66, 0x19, 0x4a} +DEFINE_GUID!{FOLDERID_ApplicationShortcuts, + 0xa3918781, 0xe5f2, 0x4890, 0xb3, 0xd9, 0xa7, 0xe5, 0x43, 0x32, 0x32, 0x8c} +DEFINE_GUID!{FOLDERID_RoamingTiles, + 0x00bcfc5a, 0xed94, 0x4e48, 0x96, 0xa1, 0x3f, 0x62, 0x17, 0xf2, 0x19, 0x90} +DEFINE_GUID!{FOLDERID_RoamedTileImages, + 0xaaa8d5a5, 0xf1d6, 0x4259, 0xba, 0xa8, 0x78, 0xe7, 0xef, 0x60, 0x83, 0x5e} +DEFINE_GUID!{FOLDERID_Screenshots, + 0xb7bede81, 0xdf94, 0x4682, 0xa7, 0xd8, 0x57, 0xa5, 0x26, 0x20, 0xb8, 0x6f} +DEFINE_GUID!{FOLDERID_CameraRoll, + 0xab5fb87b, 0x7ce2, 0x4f83, 0x91, 0x5d, 0x55, 0x08, 0x46, 0xc9, 0x53, 0x7b} +DEFINE_GUID!{FOLDERID_SkyDrive, + 0xa52bba46, 0xe9e1, 0x435f, 0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6} +DEFINE_GUID!{FOLDERID_OneDrive, + 0xa52bba46, 0xe9e1, 0x435f, 0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6} +DEFINE_GUID!{FOLDERID_SkyDriveDocuments, + 0x24d89e24, 0x2f19, 0x4534, 0x9d, 0xde, 0x6a, 0x66, 0x71, 0xfb, 0xb8, 0xfe} +DEFINE_GUID!{FOLDERID_SkyDrivePictures, + 0x339719b5, 0x8c47, 0x4894, 0x94, 0xc2, 0xd8, 0xf7, 0x7a, 0xdd, 0x44, 0xa6} +DEFINE_GUID!{FOLDERID_SkyDriveMusic, + 0xc3f2459e, 0x80d6, 0x45dc, 0xbf, 0xef, 0x1f, 0x76, 0x9f, 0x2b, 0xe7, 0x30} +DEFINE_GUID!{FOLDERID_SkyDriveCameraRoll, + 0x767e6811, 0x49cb, 0x4273, 0x87, 0xc2, 0x20, 0xf3, 0x55, 0xe1, 0x08, 0x5b} +DEFINE_GUID!{FOLDERID_SearchHistory, + 0x0d4c3db6, 0x03a3, 0x462f, 0xa0, 0xe6, 0x08, 0x92, 0x4c, 0x41, 0xb5, 0xd4} +DEFINE_GUID!{FOLDERID_SearchTemplates, + 0x7e636bfe, 0xdfa9, 0x4d5e, 0xb4, 0x56, 0xd7, 0xb3, 0x98, 0x51, 0xd8, 0xa9} +DEFINE_GUID!{FOLDERID_CameraRollLibrary, + 0x2b20df75, 0x1eda, 0x4039, 0x80, 0x97, 0x38, 0x79, 0x82, 0x27, 0xd5, 0xb7} +DEFINE_GUID!{FOLDERID_SavedPictures, + 0x3b193882, 0xd3ad, 0x4eab, 0x96, 0x5a, 0x69, 0x82, 0x9d, 0x1f, 0xb5, 0x9f} +DEFINE_GUID!{FOLDERID_SavedPicturesLibrary, + 0xe25b5812, 0xbe88, 0x4bd9, 0x94, 0xb0, 0x29, 0x23, 0x34, 0x77, 0xb6, 0xc3} +DEFINE_GUID!{FOLDERID_RetailDemo, + 0x12d4c69e, 0x24ad, 0x4923, 0xbe, 0x19, 0x31, 0x32, 0x1c, 0x43, 0xa7, 0x67} +DEFINE_GUID!{FOLDERID_Device, + 0x1C2AC1DC, 0x4358, 0x4B6C, 0x97, 0x33, 0xAF, 0x21, 0x15, 0x65, 0x76, 0xF0} +DEFINE_GUID!{FOLDERID_DevelopmentFiles, + 0xdbe8e08e, 0x3053, 0x4bbc, 0xb1, 0x83, 0x2a, 0x7b, 0x2b, 0x19, 0x1e, 0x59} +DEFINE_GUID!{FOLDERID_Objects3D, + 0x31c0dd25, 0x9439, 0x4f12, 0xbf, 0x41, 0x7f, 0xf4, 0xed, 0xa3, 0x87, 0x22} +DEFINE_GUID!{FOLDERID_AppCaptures, + 0xedc0fe71, 0x98d8, 0x4f4a, 0xb9, 0x20, 0xc8, 0xdc, 0x13, 0x3c, 0xb1, 0x65} +DEFINE_GUID!{FOLDERID_LocalDocuments, + 0xf42ee2d3, 0x909f, 0x4907, 0x88, 0x71, 0x4c, 0x22, 0xfc, 0x0b, 0xf7, 0x56} +DEFINE_GUID!{FOLDERID_LocalPictures, + 0x0ddd015d, 0xb06c, 0x45d5, 0x8c, 0x4c, 0xf5, 0x97, 0x13, 0x85, 0x46, 0x39} +DEFINE_GUID!{FOLDERID_LocalVideos, + 0x35286a68, 0x3c57, 0x41a1, 0xbb, 0xb1, 0x0e, 0xae, 0x73, 0xd7, 0x6c, 0x95} +DEFINE_GUID!{FOLDERID_LocalMusic, + 0xa0c69a99, 0x21c8, 0x4671, 0x87, 0x03, 0x79, 0x34, 0x16, 0x2f, 0xcf, 0x1d} +DEFINE_GUID!{FOLDERID_LocalDownloads, + 0x7d83ee9b, 0x2244, 0x4e70, 0xb1, 0xf5, 0x53, 0x93, 0x04, 0x2a, 0xf1, 0xe4} +DEFINE_GUID!{FOLDERID_RecordedCalls, + 0x2f8b40c2, 0x83ed, 0x48ee, 0xb3, 0x83, 0xa1, 0xf1, 0x57, 0xec, 0x6f, 0x9a} +DEFINE_GUID!{FOLDERID_AllAppMods, + 0x7ad67899, 0x66af, 0x43ba, 0x91, 0x56, 0x6a, 0xad, 0x42, 0xe6, 0xc5, 0x96} +DEFINE_GUID!{FOLDERID_CurrentAppMods, + 0x3db40b20, 0x2a30, 0x4dbe, 0x91, 0x7e, 0x77, 0x1d, 0xd2, 0x1d, 0xd0, 0x99} +DEFINE_GUID!{FOLDERID_AppDataDesktop, + 0xb2c5e279, 0x7add, 0x439f, 0xb2, 0x8c, 0xc4, 0x1f, 0xe1, 0xbb, 0xf6, 0x72} +DEFINE_GUID!{FOLDERID_AppDataDocuments, + 0x7be16610, 0x1f7f, 0x44ac, 0xbf, 0xf0, 0x83, 0xe1, 0x5f, 0x2f, 0xfc, 0xa1} +DEFINE_GUID!{FOLDERID_AppDataFavorites, + 0x7cfbefbc, 0xde1f, 0x45aa, 0xb8, 0x43, 0xa5, 0x42, 0xac, 0x53, 0x6c, 0xc9} +DEFINE_GUID!{FOLDERID_AppDataProgramData, + 0x559d40a3, 0xa036, 0x40fa, 0xaf, 0x61, 0x84, 0xcb, 0x43, 0x0a, 0x4d, 0x34} diff --git a/src/vendor/winapi/src/um/ktmw32.rs b/src/vendor/winapi/src/um/ktmw32.rs new file mode 100644 index 0000000000..91429ee7fd --- /dev/null +++ b/src/vendor/winapi/src/um/ktmw32.rs @@ -0,0 +1,64 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! FFI bindings to ktmw32. +use shared::guiddef::LPGUID; +use shared::minwindef::{BOOL, DWORD}; +use um::minwinbase::LPSECURITY_ATTRIBUTES; +use um::winnt::{HANDLE, LPWSTR}; +extern "system" { + pub fn CreateTransaction( + lpTransactionAttributes: LPSECURITY_ATTRIBUTES, + UOW: LPGUID, + CreateOptions: DWORD, + IsolationLevel: DWORD, + IsolationFlags: DWORD, + Timeout: DWORD, + Description: LPWSTR, + ) -> HANDLE; + // pub fn OpenTransaction(); + pub fn CommitTransaction( + TransactionHandle: HANDLE, + ) -> BOOL; + // pub fn CommitTransactionAsync(); + pub fn RollbackTransaction( + TransactionHandle: HANDLE, + ) -> BOOL; + // pub fn RollbackTransactionAsync(); + // pub fn GetTransactionId(); + // pub fn GetTransactionInformation(); + // pub fn SetTransactionInformation(); + // pub fn CreateTransactionManager(); + // pub fn OpenTransactionManager(); + // pub fn OpenTransactionManagerById(); + // pub fn RenameTransactionManager(); + // pub fn RollforwardTransactionManager(); + // pub fn RecoverTransactionManager(); + // pub fn GetCurrentClockTransactionManager(); + // pub fn GetTransactionManagerId(); + // pub fn CreateResourceManager(); + // pub fn OpenResourceManager(); + // pub fn RecoverResourceManager(); + // pub fn GetNotificationResourceManager(); + // pub fn GetNotificationResourceManagerAsync(); + // pub fn SetResourceManagerCompletionPort(); + // pub fn CreateEnlistment(); + // pub fn OpenEnlistment(); + // pub fn RecoverEnlistment(); + // pub fn GetEnlistmentRecoveryInformation(); + // pub fn GetEnlistmentId(); + // pub fn SetEnlistmentRecoveryInformation(); + // pub fn PrepareEnlistment(); + // pub fn PrePrepareEnlistment(); + // pub fn CommitEnlistment(); + // pub fn RollbackEnlistment(); + // pub fn PrePrepareComplete(); + // pub fn PrepareComplete(); + // pub fn ReadOnlyEnlistment(); + // pub fn CommitComplete(); + // pub fn RollbackComplete(); + // pub fn SinglePhaseReject(); +} diff --git a/src/vendor/winapi/src/um/libloaderapi.rs b/src/vendor/winapi/src/um/libloaderapi.rs new file mode 100644 index 0000000000..897858b474 --- /dev/null +++ b/src/vendor/winapi/src/um/libloaderapi.rs @@ -0,0 +1,237 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-libraryloader-l1 +use ctypes::c_int; +use shared::basetsd::LONG_PTR; +use shared::minwindef::{ + BOOL, DWORD, FARPROC, HGLOBAL, HINSTANCE, HMODULE, HRSRC, LPVOID, UINT, WORD +}; +use um::winnt::{HANDLE, LANGID, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCWSTR, PVOID}; +pub const GET_MODULE_HANDLE_EX_FLAG_PIN: DWORD = 0x00000001; +pub const GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT: DWORD = 0x00000002; +pub const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS: DWORD = 0x00000004; +pub const DONT_RESOLVE_DLL_REFERENCES: DWORD = 0x00000001; +pub const LOAD_LIBRARY_AS_DATAFILE: DWORD = 0x00000002; +pub const LOAD_WITH_ALTERED_SEARCH_PATH: DWORD = 0x00000008; +pub const LOAD_IGNORE_CODE_AUTHZ_LEVEL: DWORD = 0x00000010; +pub const LOAD_LIBRARY_AS_IMAGE_RESOURCE: DWORD = 0x00000020; +pub const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: DWORD = 0x00000040; +pub const LOAD_LIBRARY_REQUIRE_SIGNED_TARGET: DWORD = 0x00000080; +pub const LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: DWORD = 0x00000100; +pub const LOAD_LIBRARY_SEARCH_APPLICATION_DIR: DWORD = 0x00000200; +pub const LOAD_LIBRARY_SEARCH_USER_DIRS: DWORD = 0x00000400; +pub const LOAD_LIBRARY_SEARCH_SYSTEM32: DWORD = 0x00000800; +pub const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: DWORD = 0x00001000; +pub const LOAD_LIBRARY_SAFE_CURRENT_DIRS: DWORD = 0x00002000; +pub const LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER: DWORD = 0x00004000; +pub const LOAD_LIBRARY_OS_INTEGRITY_CONTINUITY: DWORD = 0x00008000; +FN!{stdcall ENUMRESLANGPROCA( + hModule: HMODULE, + lpType: LPCSTR, + lpName: LPCSTR, + wLanguage: WORD, + lParam: LONG_PTR, +) -> BOOL} +FN!{stdcall ENUMRESLANGPROCW( + hModule: HMODULE, + lpType: LPCWSTR, + lpName: LPCWSTR, + wLanguage: WORD, + lParam: LONG_PTR, +) -> BOOL} +FN!{stdcall ENUMRESNAMEPROCA( + hModule: HMODULE, + lpType: LPCSTR, + lpName: LPSTR, + lParam: LONG_PTR, +) -> BOOL} +FN!{stdcall ENUMRESNAMEPROCW( + hModule: HMODULE, + lpType: LPCWSTR, + lpName: LPWSTR, + lParam: LONG_PTR, +) -> BOOL} +FN!{stdcall ENUMRESTYPEPROCA( + hModule: HMODULE, + lpType: LPSTR, + lParam: LONG_PTR, +) -> BOOL} +FN!{stdcall ENUMRESTYPEPROCW( + hModule: HMODULE, + lpType: LPWSTR, + lParam: LONG_PTR, +) -> BOOL} +extern "system" { + pub fn DisableThreadLibraryCalls( + hLibModule: HMODULE, + ) -> BOOL; + pub fn FindResourceExW( + hModule: HMODULE, + lpName: LPCWSTR, + lpType: LPCWSTR, + wLanguage: WORD, + ) -> HRSRC; + pub fn FindStringOrdinal( + dwFindStringOrdinalFlags: DWORD, + lpStringSource: LPCWSTR, + cchSource: c_int, + lpStringValue: LPCWSTR, + cchValue: c_int, + bIgnoreCase: BOOL, + ) -> c_int; + pub fn FreeLibrary( + hLibModule: HMODULE, + ) -> BOOL; + pub fn FreeLibraryAndExitThread( + hLibModule: HMODULE, + dwExitCode: DWORD, + ); + pub fn FreeResource( + hResData: HGLOBAL, + ) -> BOOL; + pub fn GetModuleFileNameA( + hModule: HMODULE, + lpFilename: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetModuleFileNameW( + hModule: HMODULE, + lpFilename: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetModuleHandleA( + lpModuleName: LPCSTR, + ) -> HMODULE; + pub fn GetModuleHandleW( + lpModuleName: LPCWSTR, + ) -> HMODULE; + pub fn GetModuleHandleExA( + dwFlags: DWORD, + lpModuleName: LPCSTR, + phModule: *mut HMODULE, + ) -> BOOL; + pub fn GetModuleHandleExW( + dwFlags: DWORD, + lpModuleName: LPCWSTR, + phModule: *mut HMODULE, + ) -> BOOL; + pub fn GetProcAddress( + hModule: HMODULE, + lpProcName: LPCSTR, + ) -> FARPROC; + pub fn LoadLibraryExA( + lpLibFileName: LPCSTR, + hFile: HANDLE, + dwFlags: DWORD, + ) -> HMODULE; + pub fn LoadLibraryExW( + lpLibFileName: LPCWSTR, + hFile: HANDLE, + dwFlags: DWORD, + ) -> HMODULE; + pub fn LoadResource( + hModule: HMODULE, + hResInfo: HRSRC, + ) -> HGLOBAL; + pub fn LoadStringA( + hInstance: HINSTANCE, + uID: UINT, + lpBuffer: LPSTR, + cchBufferMax: c_int, + ) -> c_int; + pub fn LoadStringW( + hInstance: HINSTANCE, + uID: UINT, + lpBuffer: LPWSTR, + cchBufferMax: c_int, + ) -> c_int; + pub fn LockResource( + hResData: HGLOBAL, + ) -> LPVOID; + pub fn SizeofResource( + hModule: HMODULE, + hResInfo: HRSRC, + ) -> DWORD; +} +pub type DLL_DIRECTORY_COOKIE = PVOID; +pub type PDLL_DIRECTORY_COOKIE = *mut PVOID; +extern "system" { + pub fn AddDllDirectory( + NewDirectory: PCWSTR, + ) -> DLL_DIRECTORY_COOKIE; + pub fn RemoveDllDirectory( + Cookie: DLL_DIRECTORY_COOKIE, + ) -> BOOL; + pub fn SetDefaultDllDirectories( + DirectoryFlags: DWORD, + ) -> BOOL; + pub fn EnumResourceLanguagesExA( + hModule: HMODULE, + lpType: LPCSTR, + lpName: LPCSTR, + lpEnumFunc: ENUMRESLANGPROCA, + lParam: LONG_PTR, + dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceLanguagesExW( + hModule: HMODULE, + lpType: LPCWSTR, + lpName: LPCWSTR, + lpEnumFunc: ENUMRESLANGPROCW, + lParam: LONG_PTR, + dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceNamesExA( + hModule: HMODULE, + lpType: LPCSTR, + lpEnumFunc: ENUMRESNAMEPROCA, + lParam: LONG_PTR, + dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceNamesExW( + hModule: HMODULE, + lpType: LPCWSTR, + lpEnumFunc: ENUMRESNAMEPROCW, + lParam: LONG_PTR, + dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceTypesExA( + hModule: HMODULE, + lpEnumFunc: ENUMRESTYPEPROCA, + lParam: LONG_PTR, + dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn EnumResourceTypesExW( + hModule: HMODULE, + lpEnumFunc: ENUMRESTYPEPROCW, + lParam: LONG_PTR, + dwFlags: DWORD, + LangId: LANGID, + ) -> BOOL; + pub fn FindResourceW( + hModule: HMODULE, + lpName: LPCWSTR, + lpType: LPCWSTR, + ) -> HRSRC; + pub fn LoadLibraryA( + lpFileName: LPCSTR, + ) -> HMODULE; + pub fn LoadLibraryW( + lpFileName: LPCWSTR, + ) -> HMODULE; + pub fn EnumResourceNamesW( + hModule: HMODULE, + lpType: LPCWSTR, + lpEnumFunc: ENUMRESNAMEPROCW, + lParam: LONG_PTR, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/lmaccess.rs b/src/vendor/winapi/src/um/lmaccess.rs new file mode 100644 index 0000000000..e17826a348 --- /dev/null +++ b/src/vendor/winapi/src/um/lmaccess.rs @@ -0,0 +1,1215 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +// This file contains structures, function prototypes, and definitions +// for the NetUser, NetUserModals, NetGroup, NetAccess, and NetLogon API. +use shared::basetsd::PDWORD_PTR; +use shared::lmcons::{ENCRYPTED_PWLEN, NET_API_STATUS, PARMNUM_BASE_INFOLEVEL, PWLEN}; +use shared::minwindef::{BOOL, BYTE, DWORD, FILETIME, LPBYTE, LPDWORD, LPVOID, PBYTE, ULONG}; +use um::winnt::{BOOLEAN, LONG, LPCWSTR, LPWSTR, PSID, PVOID, PZPWSTR, SID_NAME_USE}; +extern "system" { + pub fn NetUserAdd( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUserEnum( + servername: LPCWSTR, + level: DWORD, + filter: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUserGetInfo( + servername: LPCWSTR, + username: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetUserSetInfo( + servername: LPCWSTR, + username: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUserDel( + servername: LPCWSTR, + username: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetUserGetGroups( + servername: LPCWSTR, + username: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUserSetGroups( + servername: LPCWSTR, + username: LPCWSTR, + level: DWORD, + buf: LPBYTE, + num_entries: DWORD, + ) -> NET_API_STATUS; + pub fn NetUserGetLocalGroups( + servername: LPCWSTR, + level: DWORD, + flags: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUserModalsGet( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetUserModalsSet( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUserChangePassword( + domainname: LPCWSTR, + username: LPCWSTR, + oldpassword: LPCWSTR, + newpassword: LPCWSTR, + ) -> NET_API_STATUS; +} +STRUCT!{struct USER_INFO_0 { + usri0_name: LPWSTR, +}} +pub type PUSER_INFO_0 = *mut USER_INFO_0; +pub type LPUSER_INFO_0 = *mut USER_INFO_0; +STRUCT!{struct USER_INFO_1 { + usri1_name: LPWSTR, + usri1_password: LPWSTR, + usri1_password_age: DWORD, + usri1_priv: DWORD, + usri1_home_dir: LPWSTR, + usri1_comment: LPWSTR, + usri1_flags: DWORD, + usri1_script_path: LPWSTR, +}} +pub type PUSER_INFO_1 = *mut USER_INFO_1; +pub type LPUSER_INFO_1 = *mut USER_INFO_1; +STRUCT!{struct USER_INFO_2 { + usri2_name: LPWSTR, + usri2_password: LPWSTR, + usri2_password_age: DWORD, + usri2_priv: DWORD, + usri2_home_dir: LPWSTR, + usri2_comment: LPWSTR, + usri2_flags: DWORD, + usri2_script_path: LPWSTR, + usri2_auth_flags: DWORD, + usri2_full_name: LPWSTR, + usri2_usr_comment: LPWSTR, + usri2_parms: LPWSTR, + usri2_workstations: LPWSTR, + usri2_last_logon: DWORD, + usri2_last_logoff: DWORD, + usri2_acct_expires: DWORD, + usri2_max_storage: DWORD, + usri2_units_per_week: DWORD, + usri2_logon_hours: PBYTE, + usri2_bad_pw_count: DWORD, + usri2_num_logons: DWORD, + usri2_logon_server: LPWSTR, + usri2_country_code: DWORD, + usri2_code_page: DWORD, +}} +pub type PUSER_INFO_2 = *mut USER_INFO_2; +pub type LPUSER_INFO_2 = *mut USER_INFO_2; +STRUCT!{struct USER_INFO_3 { + usri3_name: LPWSTR, + usri3_password: LPWSTR, + usri3_password_age: DWORD, + usri3_priv: DWORD, + usri3_home_dir: LPWSTR, + usri3_comment: LPWSTR, + usri3_flags: DWORD, + usri3_script_path: LPWSTR, + usri3_auth_flags: DWORD, + usri3_full_name: LPWSTR, + usri3_usr_comment: LPWSTR, + usri3_parms: LPWSTR, + usri3_workstations: LPWSTR, + usri3_last_logon: DWORD, + usri3_last_logoff: DWORD, + usri3_acct_expires: DWORD, + usri3_max_storage: DWORD, + usri3_units_per_week: DWORD, + usri3_logon_hours: PBYTE, + usri3_bad_pw_count: DWORD, + usri3_num_logons: DWORD, + usri3_logon_server: LPWSTR, + usri3_country_code: DWORD, + usri3_code_page: DWORD, + usri3_user_id: DWORD, + usri3_primary_group_id: DWORD, + usri3_profile: LPWSTR, + usri3_home_dir_drive: LPWSTR, + usri3_password_expired: DWORD, +}} +pub type PUSER_INFO_3 = *mut USER_INFO_3; +pub type LPUSER_INFO_3 = *mut USER_INFO_3; +STRUCT!{struct USER_INFO_4 { + usri4_name: LPWSTR, + usri4_password: LPWSTR, + usri4_password_age: DWORD, + usri4_priv: DWORD, + usri4_home_dir: LPWSTR, + usri4_comment: LPWSTR, + usri4_flags: DWORD, + usri4_script_path: LPWSTR, + usri4_auth_flags: DWORD, + usri4_full_name: LPWSTR, + usri4_usr_comment: LPWSTR, + usri4_parms: LPWSTR, + usri4_workstations: LPWSTR, + usri4_last_logon: DWORD, + usri4_last_logoff: DWORD, + usri4_acct_expires: DWORD, + usri4_max_storage: DWORD, + usri4_units_per_week: DWORD, + usri4_logon_hours: PBYTE, + usri4_bad_pw_count: DWORD, + usri4_num_logons: DWORD, + usri4_logon_server: LPWSTR, + usri4_country_code: DWORD, + usri4_code_page: DWORD, + usri4_user_sid: PSID, + usri4_primary_group_id: DWORD, + usri4_profile: LPWSTR, + usri4_home_dir_drive: LPWSTR, + usri4_password_expired: DWORD, +}} +pub type PUSER_INFO_4 = *mut USER_INFO_4; +pub type LPUSER_INFO_4 = *mut USER_INFO_4; +STRUCT!{struct USER_INFO_10 { + usri10_name: LPWSTR, + usri10_comment: LPWSTR, + usri10_usr_comment: LPWSTR, + usri10_full_name: LPWSTR, +}} +pub type PUSER_INFO_10 = *mut USER_INFO_10; +pub type LPUSER_INFO_10 = *mut USER_INFO_10; +STRUCT!{struct USER_INFO_11 { + usri11_name: LPWSTR, + usri11_comment: LPWSTR, + usri11_usr_comment: LPWSTR, + usri11_full_name: LPWSTR, + usri11_priv: DWORD, + usri11_auth_flags: DWORD, + usri11_password_age: DWORD, + usri11_home_dir: LPWSTR, + usri11_parms: LPWSTR, + usri11_last_logon: DWORD, + usri11_last_logoff: DWORD, + usri11_bad_pw_count: DWORD, + usri11_num_logons: DWORD, + usri11_logon_server: LPWSTR, + usri11_country_code: DWORD, + usri11_workstations: LPWSTR, + usri11_max_storage: DWORD, + usri11_units_per_week: DWORD, + usri11_logon_hours: PBYTE, + usri11_code_page: DWORD, +}} +pub type PUSER_INFO_11 = *mut USER_INFO_11; +pub type LPUSER_INFO_11 = *mut USER_INFO_11; +STRUCT!{struct USER_INFO_20 { + usri20_name: LPWSTR, + usri20_full_name: LPWSTR, + usri20_comment: LPWSTR, + usri20_flags: DWORD, + usri20_user_id: DWORD, +}} +pub type PUSER_INFO_20 = *mut USER_INFO_20; +pub type LPUSER_INFO_20 = *mut USER_INFO_20; +STRUCT!{struct USER_INFO_21 { + usri21_password: [BYTE; ENCRYPTED_PWLEN], +}} +pub type PUSER_INFO_21 = *mut USER_INFO_21; +pub type LPUSER_INFO_21 = *mut USER_INFO_21; +STRUCT!{struct USER_INFO_22 { + usri22_name: LPWSTR, + usri22_password: [BYTE; ENCRYPTED_PWLEN], + usri22_password_age: DWORD, + usri22_priv: DWORD, + usri22_home_dir: LPWSTR, + usri22_comment: LPWSTR, + usri22_flags: DWORD, + usri22_script_path: LPWSTR, + usri22_auth_flags: DWORD, + usri22_full_name: LPWSTR, + usri22_usr_comment: LPWSTR, + usri22_parms: LPWSTR, + usri22_workstations: LPWSTR, + usri22_last_logon: DWORD, + usri22_last_logoff: DWORD, + usri22_acct_expires: DWORD, + usri22_max_storage: DWORD, + usri22_units_per_week: DWORD, + usri22_logon_hours: PBYTE, + usri22_bad_pw_count: DWORD, + usri22_num_logons: DWORD, + usri22_logon_server: LPWSTR, + usri22_country_code: DWORD, + usri22_code_page: DWORD, +}} +pub type PUSER_INFO_22 = *mut USER_INFO_22; +pub type LPUSER_INFO_22 = *mut USER_INFO_22; +STRUCT!{struct USER_INFO_23 { + usri23_name: LPWSTR, + usri23_full_name: LPWSTR, + usri23_comment: LPWSTR, + usri23_flags: DWORD, + usri23_user_sid: PSID, +}} +pub type PUSER_INFO_23 = *mut USER_INFO_23; +pub type LPUSER_INFO_23 = *mut USER_INFO_23; +STRUCT!{struct USER_INFO_24 { + usri24_internet_identity: BOOL, + usri24_flags: DWORD, + usri24_internet_provider_name: LPWSTR, + usri24_internet_principal_name: LPWSTR, + usri24_user_sid: PSID, +}} +pub type PUSER_INFO_24 = *mut USER_INFO_24; +pub type LPUSER_INFO_24 = *mut USER_INFO_24; +STRUCT!{struct USER_INFO_1003 { + usri1003_password: LPWSTR, +}} +pub type PUSER_INFO_1003 = *mut USER_INFO_1003; +pub type LPUSER_INFO_1003 = *mut USER_INFO_1003; +STRUCT!{struct USER_INFO_1005 { + usri1005_priv: DWORD, +}} +pub type PUSER_INFO_1005 = *mut USER_INFO_1005; +pub type LPUSER_INFO_1005 = *mut USER_INFO_1005; +STRUCT!{struct USER_INFO_1006 { + usri1006_home_dir: LPWSTR, +}} +pub type PUSER_INFO_1006 = *mut USER_INFO_1006; +pub type LPUSER_INFO_1006 = *mut USER_INFO_1006; +STRUCT!{struct USER_INFO_1007 { + usri1007_comment: LPWSTR, +}} +pub type PUSER_INFO_1007 = *mut USER_INFO_1007; +pub type LPUSER_INFO_1007 = *mut USER_INFO_1007; +STRUCT!{struct USER_INFO_1008 { + usri1008_flags: DWORD, +}} +pub type PUSER_INFO_1008 = *mut USER_INFO_1008; +pub type LPUSER_INFO_1008 = *mut USER_INFO_1008; +STRUCT!{struct USER_INFO_1009 { + usri1009_script_path: LPWSTR, +}} +pub type PUSER_INFO_1009 = *mut USER_INFO_1009; +pub type LPUSER_INFO_1009 = *mut USER_INFO_1009; +STRUCT!{struct USER_INFO_1010 { + usri1010_auth_flags: DWORD, +}} +pub type PUSER_INFO_1010 = *mut USER_INFO_1010; +pub type LPUSER_INFO_1010 = *mut USER_INFO_1010; +STRUCT!{struct USER_INFO_1011 { + usri1011_full_name: LPWSTR, +}} +pub type PUSER_INFO_1011 = *mut USER_INFO_1011; +pub type LPUSER_INFO_1011 = *mut USER_INFO_1011; +STRUCT!{struct USER_INFO_1012 { + usri1012_usr_comment: LPWSTR, +}} +pub type PUSER_INFO_1012 = *mut USER_INFO_1012; +pub type LPUSER_INFO_1012 = *mut USER_INFO_1012; +STRUCT!{struct USER_INFO_1013 { + usri1013_parms: LPWSTR, +}} +pub type PUSER_INFO_1013 = *mut USER_INFO_1013; +pub type LPUSER_INFO_1013 = *mut USER_INFO_1013; +STRUCT!{struct USER_INFO_1014 { + usri1014_workstations: LPWSTR, +}} +pub type PUSER_INFO_1014 = *mut USER_INFO_1014; +pub type LPUSER_INFO_1014 = *mut USER_INFO_1014; +STRUCT!{struct USER_INFO_1017 { + usri1017_acct_expires: DWORD, +}} +pub type PUSER_INFO_1017 = *mut USER_INFO_1017; +pub type LPUSER_INFO_1017 = *mut USER_INFO_1017; +STRUCT!{struct USER_INFO_1018 { + usri1018_max_storage: DWORD, +}} +pub type PUSER_INFO_1018 = *mut USER_INFO_1018; +pub type LPUSER_INFO_1018 = *mut USER_INFO_1018; +STRUCT!{struct USER_INFO_1020 { + usri1020_units_per_week: DWORD, + usri1020_logon_hours: LPBYTE, +}} +pub type PUSER_INFO_1020 = *mut USER_INFO_1020; +pub type LPUSER_INFO_1020 = *mut USER_INFO_1020; +STRUCT!{struct USER_INFO_1023 { + usri1023_logon_server: LPWSTR, +}} +pub type PUSER_INFO_1023 = *mut USER_INFO_1023; +pub type LPUSER_INFO_1023 = *mut USER_INFO_1023; +STRUCT!{struct USER_INFO_1024 { + usri1024_country_code: DWORD, +}} +pub type PUSER_INFO_1024 = *mut USER_INFO_1024; +pub type LPUSER_INFO_1024 = *mut USER_INFO_1024; +STRUCT!{struct USER_INFO_1025 { + usri1025_code_page: DWORD, +}} +pub type PUSER_INFO_1025 = *mut USER_INFO_1025; +pub type LPUSER_INFO_1025 = *mut USER_INFO_1025; +STRUCT!{struct USER_INFO_1051 { + usri1051_primary_group_id: DWORD, +}} +pub type PUSER_INFO_1051 = *mut USER_INFO_1051; +pub type LPUSER_INFO_1051 = *mut USER_INFO_1051; +STRUCT!{struct USER_INFO_1052 { + usri1052_profile: LPWSTR, +}} +pub type PUSER_INFO_1052 = *mut USER_INFO_1052; +pub type LPUSER_INFO_1052 = *mut USER_INFO_1052; +STRUCT!{struct USER_INFO_1053 { + usri1053_home_dir_drive: LPWSTR, +}} +pub type PUSER_INFO_1053 = *mut USER_INFO_1053; +pub type LPUSER_INFO_1053 = *mut USER_INFO_1053; +STRUCT!{struct USER_MODALS_INFO_0 { + usrmod0_min_passwd_len: DWORD, + usrmod0_max_passwd_age: DWORD, + usrmod0_min_passwd_age: DWORD, + usrmod0_force_logoff: DWORD, + usrmod0_password_hist_len: DWORD, +}} +pub type PUSER_MODALS_INFO_0 = *mut USER_MODALS_INFO_0; +pub type LPUSER_MODALS_INFO_0 = *mut USER_MODALS_INFO_0; +STRUCT!{struct USER_MODALS_INFO_1 { + usrmod1_role: DWORD, + usrmod1_primary: LPWSTR, +}} +pub type PUSER_MODALS_INFO_1 = *mut USER_MODALS_INFO_1; +pub type LPUSER_MODALS_INFO_1 = *mut USER_MODALS_INFO_1; +STRUCT!{struct USER_MODALS_INFO_2 { + usrmod2_domain_name: LPWSTR, + usrmod2_domain_id: PSID, +}} +pub type PUSER_MODALS_INFO_2 = *mut USER_MODALS_INFO_2; +pub type LPUSER_MODALS_INFO_2 = *mut USER_MODALS_INFO_2; +STRUCT!{struct USER_MODALS_INFO_3 { + usrmod3_lockout_duration: DWORD, + usrmod3_lockout_observation_window: DWORD, + usrmod3_lockout_threshold: DWORD, +}} +pub type PUSER_MODALS_INFO_3 = *mut USER_MODALS_INFO_3; +pub type LPUSER_MODALS_INFO_3 = *mut USER_MODALS_INFO_3; +STRUCT!{struct USER_MODALS_INFO_1001 { + usrmod1001_min_passwd_len: DWORD, +}} +pub type PUSER_MODALS_INFO_1001 = *mut USER_MODALS_INFO_1001; +pub type LPUSER_MODALS_INFO_1001 = *mut USER_MODALS_INFO_1001; +STRUCT!{struct USER_MODALS_INFO_1002 { + usrmod1002_max_passwd_age: DWORD, +}} +pub type PUSER_MODALS_INFO_1002 = *mut USER_MODALS_INFO_1002; +pub type LPUSER_MODALS_INFO_1002 = *mut USER_MODALS_INFO_1002; +STRUCT!{struct USER_MODALS_INFO_1003 { + usrmod1003_min_passwd_age: DWORD, +}} +pub type PUSER_MODALS_INFO_1003 = *mut USER_MODALS_INFO_1003; +pub type LPUSER_MODALS_INFO_1003 = *mut USER_MODALS_INFO_1003; +STRUCT!{struct USER_MODALS_INFO_1004 { + usrmod1004_force_logoff: DWORD, +}} +pub type PUSER_MODALS_INFO_1004 = *mut USER_MODALS_INFO_1004; +pub type LPUSER_MODALS_INFO_1004 = *mut USER_MODALS_INFO_1004; +STRUCT!{struct USER_MODALS_INFO_1005 { + usrmod1005_password_hist_len: DWORD, +}} +pub type PUSER_MODALS_INFO_1005 = *mut USER_MODALS_INFO_1005; +pub type LPUSER_MODALS_INFO_1005 = *mut USER_MODALS_INFO_1005; +STRUCT!{struct USER_MODALS_INFO_1006 { + usrmod1006_role: DWORD, +}} +pub type PUSER_MODALS_INFO_1006 = *mut USER_MODALS_INFO_1006; +pub type LPUSER_MODALS_INFO_1006 = *mut USER_MODALS_INFO_1006; +STRUCT!{struct USER_MODALS_INFO_1007 { + usrmod1007_primary: LPWSTR, +}} +pub type PUSER_MODALS_INFO_1007 = *mut USER_MODALS_INFO_1007; +pub type LPUSER_MODALS_INFO_1007 = *mut USER_MODALS_INFO_1007; +pub const UF_SCRIPT: DWORD = 0x0001; +pub const UF_ACCOUNTDISABLE: DWORD = 0x0002; +pub const UF_HOMEDIR_REQUIRED: DWORD = 0x0008; +pub const UF_LOCKOUT: DWORD = 0x0010; +pub const UF_PASSWD_NOTREQD: DWORD = 0x0020; +pub const UF_PASSWD_CANT_CHANGE: DWORD = 0x0040; +pub const UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED: DWORD = 0x0080; +pub const UF_TEMP_DUPLICATE_ACCOUNT: DWORD = 0x0100; +pub const UF_NORMAL_ACCOUNT: DWORD = 0x0200; +pub const UF_INTERDOMAIN_TRUST_ACCOUNT: DWORD = 0x0800; +pub const UF_WORKSTATION_TRUST_ACCOUNT: DWORD = 0x1000; +pub const UF_SERVER_TRUST_ACCOUNT: DWORD = 0x2000; +pub const UF_MACHINE_ACCOUNT_MASK: DWORD = UF_INTERDOMAIN_TRUST_ACCOUNT + | UF_WORKSTATION_TRUST_ACCOUNT | UF_SERVER_TRUST_ACCOUNT; +pub const UF_ACCOUNT_TYPE_MASK: DWORD = UF_TEMP_DUPLICATE_ACCOUNT | UF_NORMAL_ACCOUNT + | UF_INTERDOMAIN_TRUST_ACCOUNT | UF_WORKSTATION_TRUST_ACCOUNT | UF_SERVER_TRUST_ACCOUNT; +pub const UF_DONT_EXPIRE_PASSWD: DWORD = 0x10000; +pub const UF_MNS_LOGON_ACCOUNT: DWORD = 0x20000; +pub const UF_SMARTCARD_REQUIRED: DWORD = 0x40000; +pub const UF_TRUSTED_FOR_DELEGATION: DWORD = 0x80000; +pub const UF_NOT_DELEGATED: DWORD = 0x100000; +pub const UF_USE_DES_KEY_ONLY: DWORD = 0x200000; +pub const UF_DONT_REQUIRE_PREAUTH: DWORD = 0x400000; +pub const UF_PASSWORD_EXPIRED: DWORD = 0x800000; +pub const UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: DWORD = 0x1000000; +pub const UF_NO_AUTH_DATA_REQUIRED: DWORD = 0x2000000; +pub const UF_PARTIAL_SECRETS_ACCOUNT: DWORD = 0x4000000; +pub const UF_USE_AES_KEYS: DWORD = 0x8000000; +pub const UF_SETTABLE_BITS: DWORD = UF_SCRIPT | UF_ACCOUNTDISABLE | UF_LOCKOUT + | UF_HOMEDIR_REQUIRED | UF_PASSWD_NOTREQD | UF_PASSWD_CANT_CHANGE | UF_ACCOUNT_TYPE_MASK + | UF_DONT_EXPIRE_PASSWD | UF_MNS_LOGON_ACCOUNT | UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED + | UF_SMARTCARD_REQUIRED | UF_TRUSTED_FOR_DELEGATION | UF_NOT_DELEGATED | UF_USE_DES_KEY_ONLY + | UF_DONT_REQUIRE_PREAUTH | UF_PASSWORD_EXPIRED | UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION + | UF_NO_AUTH_DATA_REQUIRED | UF_USE_AES_KEYS | UF_PARTIAL_SECRETS_ACCOUNT; +pub const FILTER_TEMP_DUPLICATE_ACCOUNT: DWORD = 0x0001; +pub const FILTER_NORMAL_ACCOUNT: DWORD = 0x0002; +pub const FILTER_INTERDOMAIN_TRUST_ACCOUNT: DWORD = 0x0008; +pub const FILTER_WORKSTATION_TRUST_ACCOUNT: DWORD = 0x0010; +pub const FILTER_SERVER_TRUST_ACCOUNT: DWORD = 0x0020; +pub const LG_INCLUDE_INDIRECT: DWORD = 0x0001; +pub const AF_OP_PRINT: DWORD = 0x1; +pub const AF_OP_COMM: DWORD = 0x2; +pub const AF_OP_SERVER: DWORD = 0x4; +pub const AF_OP_ACCOUNTS: DWORD = 0x8; +pub const AF_SETTABLE_BITS: DWORD = AF_OP_PRINT | AF_OP_COMM | AF_OP_SERVER | AF_OP_ACCOUNTS; +pub const UAS_ROLE_STANDALONE: DWORD = 0; +pub const UAS_ROLE_MEMBER: DWORD = 1; +pub const UAS_ROLE_BACKUP: DWORD = 2; +pub const UAS_ROLE_PRIMARY: DWORD = 3; +pub const USER_NAME_PARMNUM: DWORD = 1; +pub const USER_PASSWORD_PARMNUM: DWORD = 3; +pub const USER_PASSWORD_AGE_PARMNUM: DWORD = 4; +pub const USER_PRIV_PARMNUM: DWORD = 5; +pub const USER_HOME_DIR_PARMNUM: DWORD = 6; +pub const USER_COMMENT_PARMNUM: DWORD = 7; +pub const USER_FLAGS_PARMNUM: DWORD = 8; +pub const USER_SCRIPT_PATH_PARMNUM: DWORD = 9; +pub const USER_AUTH_FLAGS_PARMNUM: DWORD = 10; +pub const USER_FULL_NAME_PARMNUM: DWORD = 11; +pub const USER_USR_COMMENT_PARMNUM: DWORD = 12; +pub const USER_PARMS_PARMNUM: DWORD = 13; +pub const USER_WORKSTATIONS_PARMNUM: DWORD = 14; +pub const USER_LAST_LOGON_PARMNUM: DWORD = 15; +pub const USER_LAST_LOGOFF_PARMNUM: DWORD = 16; +pub const USER_ACCT_EXPIRES_PARMNUM: DWORD = 17; +pub const USER_MAX_STORAGE_PARMNUM: DWORD = 18; +pub const USER_UNITS_PER_WEEK_PARMNUM: DWORD = 19; +pub const USER_LOGON_HOURS_PARMNUM: DWORD = 20; +pub const USER_PAD_PW_COUNT_PARMNUM: DWORD = 21; +pub const USER_NUM_LOGONS_PARMNUM: DWORD = 22; +pub const USER_LOGON_SERVER_PARMNUM: DWORD = 23; +pub const USER_COUNTRY_CODE_PARMNUM: DWORD = 24; +pub const USER_CODE_PAGE_PARMNUM: DWORD = 25; +pub const USER_PRIMARY_GROUP_PARMNUM: DWORD = 51; +pub const USER_PROFILE: DWORD = 52; +pub const USER_PROFILE_PARMNUM: DWORD = 52; +pub const USER_HOME_DIR_DRIVE_PARMNUM: DWORD = 53; +pub const USER_NAME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_NAME_PARMNUM; +pub const USER_PASSWORD_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_PARMNUM; +pub const USER_PASSWORD_AGE_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_AGE_PARMNUM; +pub const USER_PRIV_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_PRIV_PARMNUM; +pub const USER_HOME_DIR_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_PARMNUM; +pub const USER_COMMENT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_COMMENT_PARMNUM; +pub const USER_FLAGS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_FLAGS_PARMNUM; +pub const USER_SCRIPT_PATH_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_SCRIPT_PATH_PARMNUM; +pub const USER_AUTH_FLAGS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_AUTH_FLAGS_PARMNUM; +pub const USER_FULL_NAME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_FULL_NAME_PARMNUM; +pub const USER_USR_COMMENT_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_USR_COMMENT_PARMNUM; +pub const USER_PARMS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_PARMS_PARMNUM; +pub const USER_WORKSTATIONS_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_WORKSTATIONS_PARMNUM; +pub const USER_LAST_LOGON_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGON_PARMNUM; +pub const USER_LAST_LOGOFF_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGOFF_PARMNUM; +pub const USER_ACCT_EXPIRES_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_ACCT_EXPIRES_PARMNUM; +pub const USER_MAX_STORAGE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_MAX_STORAGE_PARMNUM; +pub const USER_UNITS_PER_WEEK_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_UNITS_PER_WEEK_PARMNUM; +pub const USER_LOGON_HOURS_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_LOGON_HOURS_PARMNUM; +pub const USER_PAD_PW_COUNT_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_PAD_PW_COUNT_PARMNUM; +pub const USER_NUM_LOGONS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_NUM_LOGONS_PARMNUM; +pub const USER_LOGON_SERVER_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_LOGON_SERVER_PARMNUM; +pub const USER_COUNTRY_CODE_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_COUNTRY_CODE_PARMNUM; +pub const USER_CODE_PAGE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + USER_CODE_PAGE_PARMNUM; +pub const USER_PRIMARY_GROUP_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_PRIMARY_GROUP_PARMNUM; +pub const USER_HOME_DIR_DRIVE_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_DRIVE_PARMNUM; +pub const NULL_USERSETINFO_PASSWD: &'static str = " "; +pub const TIMEQ_FOREVER: DWORD = -1i32 as u32; +pub const USER_MAXSTORAGE_UNLIMITED: DWORD = -1i32 as u32; +pub const USER_NO_LOGOFF: DWORD = -1i32 as u32; +pub const UNITS_PER_DAY: DWORD = 24; +pub const UNITS_PER_WEEK: DWORD = UNITS_PER_DAY * 7; +pub const USER_PRIV_MASK: DWORD = 0x3; +pub const USER_PRIV_GUEST: DWORD = 0; +pub const USER_PRIV_USER: DWORD = 1; +pub const USER_PRIV_ADMIN: DWORD = 2; +pub const MAX_PASSWD_LEN: DWORD = PWLEN; +pub const DEF_MIN_PWLEN: DWORD = 6; +pub const DEF_PWUNIQUENESS: DWORD = 5; +pub const DEF_MAX_PWHIST: DWORD = 8; +pub const DEF_MAX_PWAGE: DWORD = TIMEQ_FOREVER; +pub const DEF_MIN_PWAGE: DWORD = 0; +pub const DEF_FORCE_LOGOFF: DWORD = 0xffffffff; +pub const DEF_MAX_BADPW: DWORD = 0; +pub const ONE_DAY: DWORD = 1 * 24 * 3600; +pub const VALIDATED_LOGON: DWORD = 0; +pub const PASSWORD_EXPIRED: DWORD = 2; +pub const NON_VALIDATED_LOGON: DWORD = 3; +pub const VALID_LOGOFF: DWORD = 1; +pub const MODALS_MIN_PASSWD_LEN_PARMNUM: DWORD = 1; +pub const MODALS_MAX_PASSWD_AGE_PARMNUM: DWORD = 2; +pub const MODALS_MIN_PASSWD_AGE_PARMNUM: DWORD = 3; +pub const MODALS_FORCE_LOGOFF_PARMNUM: DWORD = 4; +pub const MODALS_PASSWD_HIST_LEN_PARMNUM: DWORD = 5; +pub const MODALS_ROLE_PARMNUM: DWORD = 6; +pub const MODALS_PRIMARY_PARMNUM: DWORD = 7; +pub const MODALS_DOMAIN_NAME_PARMNUM: DWORD = 8; +pub const MODALS_DOMAIN_ID_PARMNUM: DWORD = 9; +pub const MODALS_LOCKOUT_DURATION_PARMNUM: DWORD = 10; +pub const MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM: DWORD = 11; +pub const MODALS_LOCKOUT_THRESHOLD_PARMNUM: DWORD = 12; +pub const MODALS_MIN_PASSWD_LEN_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_LEN_PARMNUM; +pub const MODALS_MAX_PASSWD_AGE_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + MODALS_MAX_PASSWD_AGE_PARMNUM; +pub const MODALS_MIN_PASSWD_AGE_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_AGE_PARMNUM; +pub const MODALS_FORCE_LOGOFF_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + MODALS_FORCE_LOGOFF_PARMNUM; +pub const MODALS_PASSWD_HIST_LEN_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + MODALS_PASSWD_HIST_LEN_PARMNUM; +pub const MODALS_ROLE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + MODALS_ROLE_PARMNUM; +pub const MODALS_PRIMARY_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + MODALS_PRIMARY_PARMNUM; +pub const MODALS_DOMAIN_NAME_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_NAME_PARMNUM; +pub const MODALS_DOMAIN_ID_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_ID_PARMNUM; +extern "system" { + pub fn NetGroupAdd( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetGroupAddUser( + servername: LPCWSTR, + GroupName: LPCWSTR, + username: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetGroupEnum( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resume_handle: PDWORD_PTR, + ) -> NET_API_STATUS; + pub fn NetGroupGetInfo( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetGroupSetInfo( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetGroupDel( + servername: LPCWSTR, + groupname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetGroupDelUser( + servername: LPCWSTR, + GroupName: LPCWSTR, + Username: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetGroupGetUsers( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + ResumeHandle: PDWORD_PTR, + ) -> NET_API_STATUS; + pub fn NetGroupSetUsers( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + buf: LPBYTE, + totalentries: DWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct GROUP_INFO_0 { + grpi0_name: LPWSTR, +}} +pub type PGROUP_INFO_0 = *mut GROUP_INFO_0; +pub type LPGROUP_INFO_0 = *mut GROUP_INFO_0; +STRUCT!{struct GROUP_INFO_1 { + grpi1_name: LPWSTR, + grpi1_comment: LPWSTR, +}} +pub type PGROUP_INFO_1 = *mut GROUP_INFO_1; +pub type LPGROUP_INFO_1 = *mut GROUP_INFO_1; +STRUCT!{struct GROUP_INFO_2 { + grpi2_name: LPWSTR, + grpi2_comment: LPWSTR, + grpi2_group_id: DWORD, + grpi2_attributes: DWORD, +}} +pub type PGROUP_INFO_2 = *mut GROUP_INFO_2; +STRUCT!{struct GROUP_INFO_3 { + grpi3_name: LPWSTR, + grpi3_comment: LPWSTR, + grpi3_group_sid: PSID, + grpi3_attributes: DWORD, +}} +pub type PGROUP_INFO_3 = *mut GROUP_INFO_3; +STRUCT!{struct GROUP_INFO_1002 { + grpi1002_comment: LPWSTR, +}} +pub type PGROUP_INFO_1002 = *mut GROUP_INFO_1002; +pub type LPGROUP_INFO_1002 = *mut GROUP_INFO_1002; +STRUCT!{struct GROUP_INFO_1005 { + grpi1005_attributes: DWORD, +}} +pub type PGROUP_INFO_1005 = *mut GROUP_INFO_1005; +pub type LPGROUP_INFO_1005 = *mut GROUP_INFO_1005; +STRUCT!{struct GROUP_USERS_INFO_0 { + grui0_name: LPWSTR, +}} +pub type PGROUP_USERS_INFO_0 = *mut GROUP_USERS_INFO_0; +pub type LPGROUP_USERS_INFO_0 = *mut GROUP_USERS_INFO_0; +STRUCT!{struct GROUP_USERS_INFO_1 { + grui1_name: LPWSTR, + grui1_attributes: DWORD, +}} +pub type PGROUP_USERS_INFO_1 = *mut GROUP_USERS_INFO_1; +pub type LPGROUP_USERS_INFO_1 = *mut GROUP_USERS_INFO_1; +pub const GROUPIDMASK: DWORD = 0x8000; +pub const GROUP_SPECIALGRP_USERS: &'static str = "USERS"; +pub const GROUP_SPECIALGRP_ADMINS: &'static str = "ADMINS"; +pub const GROUP_SPECIALGRP_GUESTS: &'static str = "GUESTS"; +pub const GROUP_SPECIALGRP_LOCAL: &'static str = "LOCAL"; +pub const GROUP_ALL_PARMNUM: DWORD = 0; +pub const GROUP_NAME_PARMNUM: DWORD = 1; +pub const GROUP_COMMENT_PARMNUM: DWORD = 2; +pub const GROUP_ATTRIBUTES_PARMNUM: DWORD = 3; +pub const GROUP_ALL_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + GROUP_ALL_PARMNUM; +pub const GROUP_NAME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + GROUP_NAME_PARMNUM; +pub const GROUP_COMMENT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + GROUP_COMMENT_PARMNUM; +pub const GROUP_ATTRIBUTES_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + GROUP_ATTRIBUTES_PARMNUM; +extern "system" { + pub fn NetLocalGroupAdd( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetLocalGroupAddMember( + servername: LPCWSTR, + groupname: LPCWSTR, + membersid: PSID, + ) -> NET_API_STATUS; + pub fn NetLocalGroupEnum( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: PDWORD_PTR, + ) -> NET_API_STATUS; + pub fn NetLocalGroupGetInfo( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetLocalGroupSetInfo( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetLocalGroupDel( + servername: LPCWSTR, + groupname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetLocalGroupDelMember( + servername: LPCWSTR, + groupname: LPCWSTR, + membersid: PSID, + ) -> NET_API_STATUS; + pub fn NetLocalGroupGetMembers( + servername: LPCWSTR, + localgroupname: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: PDWORD_PTR, + ) -> NET_API_STATUS; + pub fn NetLocalGroupSetMembers( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + buf: LPBYTE, + totalentries: DWORD, + ) -> NET_API_STATUS; + pub fn NetLocalGroupAddMembers( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + buf: LPBYTE, + totalentries: DWORD, + ) -> NET_API_STATUS; + pub fn NetLocalGroupDelMembers( + servername: LPCWSTR, + groupname: LPCWSTR, + level: DWORD, + buf: LPBYTE, + totalentries: DWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct LOCALGROUP_INFO_0 { + lgrpi0_name: LPWSTR, +}} +pub type PLOCALGROUP_INFO_0 = *mut LOCALGROUP_INFO_0; +pub type LPLOCALGROUP_INFO_0 = *mut LOCALGROUP_INFO_0; +STRUCT!{struct LOCALGROUP_INFO_1 { + lgrpi1_name: LPWSTR, + lgrpi1_comment: LPWSTR, +}} +pub type PLOCALGROUP_INFO_1 = *mut LOCALGROUP_INFO_1; +pub type LPLOCALGROUP_INFO_1 = *mut LOCALGROUP_INFO_1; +STRUCT!{struct LOCALGROUP_INFO_1002 { + lgrpi1002_comment: LPWSTR, +}} +pub type PLOCALGROUP_INFO_1002 = *mut LOCALGROUP_INFO_1002; +pub type LPLOCALGROUP_INFO_1002 = *mut LOCALGROUP_INFO_1002; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_0 { + lgrmi0_sid: PSID, +}} +pub type PLOCALGROUP_MEMBERS_INFO_0 = *mut LOCALGROUP_MEMBERS_INFO_0; +pub type LPLOCALGROUP_MEMBERS_INFO_0 = *mut LOCALGROUP_MEMBERS_INFO_0; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_1 { + lgrmi1_sid: PSID, + lgrmi1_sidusage: SID_NAME_USE, + lgrmi1_name: LPWSTR, +}} +pub type PLOCALGROUP_MEMBERS_INFO_1 = *mut LOCALGROUP_MEMBERS_INFO_1; +pub type LPLOCALGROUP_MEMBERS_INFO_1 = *mut LOCALGROUP_MEMBERS_INFO_1; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_2 { + lgrmi2_sid: PSID, + lgrmi2_sidusage: SID_NAME_USE, + lgrmi2_domainandname: LPWSTR, +}} +pub type PLOCALGROUP_MEMBERS_INFO_2 = *mut LOCALGROUP_MEMBERS_INFO_2; +pub type LPLOCALGROUP_MEMBERS_INFO_2 = *mut LOCALGROUP_MEMBERS_INFO_2; +STRUCT!{struct LOCALGROUP_MEMBERS_INFO_3 { + lgrmi3_domainandname: LPWSTR, +}} +pub type PLOCALGROUP_MEMBERS_INFO_3 = *mut LOCALGROUP_MEMBERS_INFO_3; +pub type LPLOCALGROUP_MEMBERS_INFO_3 = *mut LOCALGROUP_MEMBERS_INFO_3; +STRUCT!{struct LOCALGROUP_USERS_INFO_0 { + lgrui0_name: LPWSTR, +}} +pub type PLOCALGROUP_USERS_INFO_0 = *mut LOCALGROUP_USERS_INFO_0; +pub type LPLOCALGROUP_USERS_INFO_0 = *mut LOCALGROUP_USERS_INFO_0; +pub const LOCALGROUP_NAME_PARMNUM: DWORD = 1; +pub const LOCALGROUP_COMMENT_PARMNUM: DWORD = 2; +extern "system" { + pub fn NetQueryDisplayInformation( + ServerName: LPCWSTR, + Level: DWORD, + Index: DWORD, + EntriesRequested: DWORD, + PreferredMaximumLength: DWORD, + ReturnedEntryCount: LPDWORD, + SortedBuffer: *mut PVOID, + ) -> NET_API_STATUS; + pub fn NetGetDisplayInformationIndex( + ServerName: LPCWSTR, + Level: DWORD, + Prefix: LPCWSTR, + Index: LPDWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct NET_DISPLAY_USER { + usri1_name: LPWSTR, + usri1_comment: LPWSTR, + usri1_flags: DWORD, + usri1_full_name: LPWSTR, + usri1_user_id: DWORD, + usri1_next_index: DWORD, +}} +pub type PNET_DISPLAY_USER = *mut NET_DISPLAY_USER; +STRUCT!{struct NET_DISPLAY_MACHINE { + usri2_name: LPWSTR, + usri2_comment: LPWSTR, + usri2_flags: DWORD, + usri2_user_id: DWORD, + usri2_next_index: DWORD, +}} +pub type PNET_DISPLAY_MACHINE = *mut NET_DISPLAY_MACHINE; +STRUCT!{struct NET_DISPLAY_GROUP { + usri3_name: LPWSTR, + usri3_comment: LPWSTR, + grpi3_group_id: DWORD, + grpi3_attributes: DWORD, + grpi3_next_index: DWORD, +}} +pub type PNET_DISPLAY_GROUP = *mut NET_DISPLAY_GROUP; +extern "system" { + pub fn NetAccessAdd( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetAccessEnum( + servername: LPCWSTR, + BasePath: LPCWSTR, + Recursive: DWORD, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resume_handle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetAccessGetInfo( + servername: LPCWSTR, + resource: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetAccessSetInfo( + servername: LPCWSTR, + resource: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetAccessDel( + servername: LPCWSTR, + resource: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetAccessGetUserPerms( + servername: LPCWSTR, + UGname: LPCWSTR, + resource: LPCWSTR, + Perms: LPDWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct ACCESS_INFO_0 { + acc0_resource_name: LPWSTR, +}} +pub type PACCESS_INFO_0 = *mut ACCESS_INFO_0; +pub type LPACCESS_INFO_0 = *mut ACCESS_INFO_0; +STRUCT!{struct ACCESS_INFO_1 { + acc1_resource_name: LPWSTR, + acc1_attr: DWORD, + acc1_count: DWORD, +}} +pub type PACCESS_INFO_1 = *mut ACCESS_INFO_1; +pub type LPACCESS_INFO_1 = *mut ACCESS_INFO_1; +STRUCT!{struct ACCESS_INFO_1002 { + acc1002_attr: DWORD, +}} +pub type PACCESS_INFO_1002 = *mut ACCESS_INFO_1002; +pub type LPACCESS_INFO_1002 = *mut ACCESS_INFO_1002; +STRUCT!{struct ACCESS_LIST { + acl_ugname: LPWSTR, + acl_access: DWORD, +}} +pub type PACCESS_LIST = *mut ACCESS_LIST; +pub type LPACCESS_LIST = *mut ACCESS_LIST; +pub const MAXPERMENTRIES: DWORD = 64; +pub const ACCESS_NONE: DWORD = 0; +pub const ACCESS_ALL: DWORD = ACCESS_READ | ACCESS_WRITE | ACCESS_CREATE | ACCESS_EXEC + | ACCESS_DELETE | ACCESS_ATRIB | ACCESS_PERM; +pub const ACCESS_READ: DWORD = 0x01; +pub const ACCESS_WRITE: DWORD = 0x02; +pub const ACCESS_CREATE: DWORD = 0x04; +pub const ACCESS_EXEC: DWORD = 0x08; +pub const ACCESS_DELETE: DWORD = 0x10; +pub const ACCESS_ATRIB: DWORD = 0x20; +pub const ACCESS_PERM: DWORD = 0x40; +pub const ACCESS_GROUP: DWORD = 0x8000; +pub const ACCESS_AUDIT: DWORD = 0x1; +pub const ACCESS_SUCCESS_OPEN: DWORD = 0x10; +pub const ACCESS_SUCCESS_WRITE: DWORD = 0x20; +pub const ACCESS_SUCCESS_DELETE: DWORD = 0x40; +pub const ACCESS_SUCCESS_ACL: DWORD = 0x80; +pub const ACCESS_SUCCESS_MASK: DWORD = 0xF0; +pub const ACCESS_FAIL_OPEN: DWORD = 0x100; +pub const ACCESS_FAIL_WRITE: DWORD = 0x200; +pub const ACCESS_FAIL_DELETE: DWORD = 0x400; +pub const ACCESS_FAIL_ACL: DWORD = 0x800; +pub const ACCESS_FAIL_MASK: DWORD = 0xF00; +pub const ACCESS_FAIL_SHIFT: DWORD = 4; +pub const ACCESS_RESOURCE_NAME_PARMNUM: DWORD = 1; +pub const ACCESS_ATTR_PARMNUM: DWORD = 2; +pub const ACCESS_COUNT_PARMNUM: DWORD = 3; +pub const ACCESS_ACCESS_LIST_PARMNUM: DWORD = 4; +pub const ACCESS_RESOURCE_NAME_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + ACCESS_RESOURCE_NAME_PARMNUM; +pub const ACCESS_ATTR_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + ACCESS_ATTR_PARMNUM; +pub const ACCESS_COUNT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + ACCESS_COUNT_PARMNUM; +pub const ACCESS_ACCESS_LIST_INFOLEVEL: DWORD = + PARMNUM_BASE_INFOLEVEL + ACCESS_ACCESS_LIST_PARMNUM; +pub const ACCESS_LETTERS: &'static str = "RWCXDAP "; +ENUM!{enum NET_VALIDATE_PASSWORD_TYPE { + NetValidateAuthentication = 1, + NetValidatePasswordChange, + NetValidatePasswordReset, +}} +pub type PNET_VALIDATE_PASSWORD_TYPE = *mut NET_VALIDATE_PASSWORD_TYPE; +STRUCT!{struct NET_VALIDATE_PASSWORD_HASH { + Length: ULONG, + Hash: LPBYTE, +}} +pub type PNET_VALIDATE_PASSWORD_HASH = *mut NET_VALIDATE_PASSWORD_HASH; +pub const NET_VALIDATE_PASSWORD_LAST_SET: ULONG = 0x00000001; +pub const NET_VALIDATE_BAD_PASSWORD_TIME: ULONG = 0x00000002; +pub const NET_VALIDATE_LOCKOUT_TIME: ULONG = 0x00000004; +pub const NET_VALIDATE_BAD_PASSWORD_COUNT: ULONG = 0x00000008; +pub const NET_VALIDATE_PASSWORD_HISTORY_LENGTH: ULONG = 0x00000010; +pub const NET_VALIDATE_PASSWORD_HISTORY: ULONG = 0x00000020; +STRUCT!{struct NET_VALIDATE_PERSISTED_FIELDS { + PresentFields: ULONG, + PasswordLastSet: FILETIME, + BadPasswordTime: FILETIME, + LockoutTime: FILETIME, + BadPasswordCount: ULONG, + PasswordHistoryLength: ULONG, + PasswordHistory: PNET_VALIDATE_PASSWORD_HASH, +}} +pub type PNET_VALIDATE_PERSISTED_FIELDS = *mut NET_VALIDATE_PERSISTED_FIELDS; +STRUCT!{struct NET_VALIDATE_OUTPUT_ARG { + ChangedPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + ValidationStatus: NET_API_STATUS, +}} +pub type PNET_VALIDATE_OUTPUT_ARG = *mut NET_VALIDATE_OUTPUT_ARG; +STRUCT!{struct NET_VALIDATE_AUTHENTICATION_INPUT_ARG { + InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + PasswordMatched: BOOLEAN, +}} +pub type PNET_VALIDATE_AUTHENTICATION_INPUT_ARG = *mut NET_VALIDATE_AUTHENTICATION_INPUT_ARG; +STRUCT!{struct NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG { + InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + ClearPassword: LPWSTR, + UserAccountName: LPWSTR, + HashedPassword: NET_VALIDATE_PASSWORD_HASH, + PasswordMatch: BOOLEAN, +}} +pub type PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG = *mut NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG; +STRUCT!{struct NET_VALIDATE_PASSWORD_RESET_INPUT_ARG { + InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, + ClearPassword: LPWSTR, + UserAccountName: LPWSTR, + HashedPassword: NET_VALIDATE_PASSWORD_HASH, + PasswordMustChangeAtNextLogon: BOOLEAN, + ClearLockout: BOOLEAN, +}} +pub type PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG = *mut NET_VALIDATE_PASSWORD_RESET_INPUT_ARG; +extern "system" { + pub fn NetValidatePasswordPolicy( + ServerName: LPCWSTR, + Qualifier: LPVOID, + ValidationType: NET_VALIDATE_PASSWORD_TYPE, + InputArg: LPVOID, + OutputArg: *mut LPVOID, + ) -> NET_API_STATUS; + pub fn NetValidatePasswordPolicyFree( + OutputArg: *mut LPVOID, + ) -> NET_API_STATUS; + pub fn NetGetDCName( + servername: LPCWSTR, + domainname: LPCWSTR, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetGetAnyDCName( + servername: LPCWSTR, + domainname: LPCWSTR, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn I_NetLogonControl( + ServerName: LPCWSTR, + FunctionCode: DWORD, + QueryLevel: DWORD, + Buffer: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn I_NetLogonControl2( + ServerName: LPCWSTR, + FunctionCode: DWORD, + QueryLevel: DWORD, + Data: LPBYTE, + Buffer: *mut LPBYTE, + ) -> NET_API_STATUS; +} +pub type NTSTATUS = LONG; +pub type PNTSTATUS = *mut LONG; +extern "system" { + pub fn NetEnumerateTrustedDomains( + ServerName: LPWSTR, + DomainNames: *mut LPWSTR, + ) -> NTSTATUS; +} +pub const NETLOGON_CONTROL_QUERY: DWORD = 1; +pub const NETLOGON_CONTROL_REPLICATE: DWORD = 2; +pub const NETLOGON_CONTROL_SYNCHRONIZE: DWORD = 3; +pub const NETLOGON_CONTROL_PDC_REPLICATE: DWORD = 4; +pub const NETLOGON_CONTROL_REDISCOVER: DWORD = 5; +pub const NETLOGON_CONTROL_TC_QUERY: DWORD = 6; +pub const NETLOGON_CONTROL_TRANSPORT_NOTIFY: DWORD = 7; +pub const NETLOGON_CONTROL_FIND_USER: DWORD = 8; +pub const NETLOGON_CONTROL_CHANGE_PASSWORD: DWORD = 9; +pub const NETLOGON_CONTROL_TC_VERIFY: DWORD = 10; +pub const NETLOGON_CONTROL_FORCE_DNS_REG: DWORD = 11; +pub const NETLOGON_CONTROL_QUERY_DNS_REG: DWORD = 12; +pub const NETLOGON_CONTROL_QUERY_ENC_TYPES: DWORD = 13; +pub const NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL: DWORD = 0xFFFB; +pub const NETLOGON_CONTROL_BACKUP_CHANGE_LOG: DWORD = 0xFFFC; +pub const NETLOGON_CONTROL_TRUNCATE_LOG: DWORD = 0xFFFD; +pub const NETLOGON_CONTROL_SET_DBFLAG: DWORD = 0xFFFE; +pub const NETLOGON_CONTROL_BREAKPOINT: DWORD = 0xFFFF; +STRUCT!{struct NETLOGON_INFO_1 { + netlog1_flags: DWORD, + netlog1_pdc_connection_status: NET_API_STATUS, +}} +pub type PNETLOGON_INFO_1 = *mut NETLOGON_INFO_1; +STRUCT!{struct NETLOGON_INFO_2 { + netlog2_flags: DWORD, + netlog2_pdc_connection_status: NET_API_STATUS, + netlog2_trusted_dc_name: LPWSTR, + netlog2_tc_connection_status: NET_API_STATUS, +}} +pub type PNETLOGON_INFO_2 = *mut NETLOGON_INFO_2; +STRUCT!{struct NETLOGON_INFO_3 { + netlog3_flags: DWORD, + netlog3_logon_attempts: DWORD, + netlog3_reserved1: DWORD, + netlog3_reserved2: DWORD, + netlog3_reserved3: DWORD, + netlog3_reserved4: DWORD, + netlog3_reserved5: DWORD, +}} +pub type PNETLOGON_INFO_3 = *mut NETLOGON_INFO_3; +STRUCT!{struct NETLOGON_INFO_4 { + netlog4_trusted_dc_name: LPWSTR, + netlog4_trusted_domain_name: LPWSTR, +}} +pub type PNETLOGON_INFO_4 = *mut NETLOGON_INFO_4; +pub const NETLOGON_REPLICATION_NEEDED: DWORD = 0x01; +pub const NETLOGON_REPLICATION_IN_PROGRESS: DWORD = 0x02; +pub const NETLOGON_FULL_SYNC_REPLICATION: DWORD = 0x04; +pub const NETLOGON_REDO_NEEDED: DWORD = 0x08; +pub const NETLOGON_HAS_IP: DWORD = 0x10; +pub const NETLOGON_HAS_TIMESERV: DWORD = 0x20; +pub const NETLOGON_DNS_UPDATE_FAILURE: DWORD = 0x40; +pub const NETLOGON_VERIFY_STATUS_RETURNED: DWORD = 0x80; +pub const SERVICE_ACCOUNT_PASSWORD: &'static str = "_SA_{262E99C9-6160-4871-ACEC-4E61736B6F21}"; +pub const SERVICE_ACCOUNT_SECRET_PREFIX: &'static str + = "_SC_{262E99C9-6160-4871-ACEC-4E61736B6F21}_"; +DEFINE_GUID!(ServiceAccountPasswordGUID, + 0x262E99C9, 0x6160, 0x4871, 0xAC, 0xEC, 0x4E, 0x61, 0x73, 0x6B, 0x6F, 0x21); +extern "system" { + pub fn NetAddServiceAccount( + ServerName: LPWSTR, + AccountName: LPWSTR, + Password: LPWSTR, + Flags: DWORD, + ) -> NTSTATUS; +} +pub const SERVICE_ACCOUNT_FLAG_LINK_TO_HOST_ONLY: DWORD = 0x00000001; +pub const SERVICE_ACCOUNT_FLAG_ADD_AGAINST_RODC: DWORD = 0x00000002; +pub const SERVICE_ACCOUNT_FLAG_UNLINK_FROM_HOST_ONLY: DWORD = 0x00000001; +pub const SERVICE_ACCOUNT_FLAG_REMOVE_OFFLINE: DWORD = 0x00000002; +extern "system" { + pub fn NetRemoveServiceAccount( + ServerName: LPWSTR, + AccountName: LPWSTR, + Flags: DWORD, + ) -> NTSTATUS; + pub fn NetEnumerateServiceAccounts( + ServerName: LPWSTR, + Flags: DWORD, + AccountsCount: *mut DWORD, + Accounts: *mut PZPWSTR, + ) -> NTSTATUS; + pub fn NetIsServiceAccount( + ServerName: LPWSTR, + AccountName: LPWSTR, + IsService: *mut BOOL, + ) -> NTSTATUS; + pub fn NetQueryServiceAccount( + ServerName: LPWSTR, + AccountName: LPWSTR, + InfoLevel: DWORD, + Buffer: *mut PBYTE, + ) -> NTSTATUS; +} +ENUM!{enum MSA_INFO_LEVEL { + MsaInfoLevel0 = 0, + MsaInfoLevelMax, +}} +pub type PMSA_INFO_LEVEL = *mut MSA_INFO_LEVEL; +ENUM!{enum MSA_INFO_STATE { + MsaInfoNotExist = 1, + MsaInfoNotService, + MsaInfoCannotInstall, + MsaInfoCanInstall, + MsaInfoInstalled, +}} +pub type PMSA_INFO_STATE = *mut MSA_INFO_STATE; +STRUCT!{struct MSA_INFO_0 { + State: MSA_INFO_STATE, +}} +pub type PMSA_INFO_0 = *mut MSA_INFO_0; +pub type LPMSA_INFO_0 = *mut MSA_INFO_0; diff --git a/src/vendor/winapi/src/um/lmalert.rs b/src/vendor/winapi/src/um/lmalert.rs new file mode 100644 index 0000000000..d987a0db3e --- /dev/null +++ b/src/vendor/winapi/src/um/lmalert.rs @@ -0,0 +1,76 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains structures for communication with the Alerter service +use shared::lmcons::{EVLEN, NET_API_STATUS, SNLEN}; +use shared::minwindef::{DWORD, LPVOID}; +use um::winnt::{LPCWSTR, WCHAR}; +extern "system" { + pub fn NetAlertRaise( + AlertType: LPCWSTR, + Buffer: LPVOID, + BufferSize: DWORD, + ) -> NET_API_STATUS; + pub fn NetAlertRaiseEx( + AlertType: LPCWSTR, + VariableInfo: LPVOID, + VariableInfoSize: DWORD, + ServiceName: LPCWSTR, + ) -> NET_API_STATUS; +} +STRUCT!{struct STD_ALERT { + alrt_timestamp: DWORD, + alrt_eventname: [WCHAR; EVLEN + 1], + alrt_servicename: [WCHAR; SNLEN + 1], +}} +pub type PSTD_ALERT = *mut STD_ALERT; +pub type LPSTD_ALERT = *mut STD_ALERT; +STRUCT!{struct ADMIN_OTHER_INFO { + alrtad_errcode: DWORD, + alrtad_numstrings: DWORD, +}} +pub type PADMIN_OTHER_INFO = *mut ADMIN_OTHER_INFO; +pub type LPADMIN_OTHER_INFO = *mut ADMIN_OTHER_INFO; +STRUCT!{struct ERRLOG_OTHER_INFO { + alrter_errcode: DWORD, + alrter_offset: DWORD, +}} +pub type PERRLOG_OTHER_INFO = *mut ERRLOG_OTHER_INFO; +pub type LPERRLOG_OTHER_INFO = *mut ERRLOG_OTHER_INFO; +STRUCT!{struct PRINT_OTHER_INFO { + alrtpr_jobid: DWORD, + alrtpr_status: DWORD, + alrtpr_submitted: DWORD, + alrtpr_size: DWORD, +}} +pub type PPRINT_OTHER_INFO = *mut PRINT_OTHER_INFO; +pub type LPPRINT_OTHER_INFO = *mut PRINT_OTHER_INFO; +STRUCT!{struct USER_OTHER_INFO { + alrtus_errcode: DWORD, + alrtus_numstrings: DWORD, +}} +pub type PUSER_OTHER_INFO = *mut USER_OTHER_INFO; +pub type LPUSER_OTHER_INFO = *mut USER_OTHER_INFO; +pub const ALERTER_MAILSLOT: &'static str = "\\\\.\\MAILSLOT\\Alerter"; +pub const ALERT_PRINT_EVENT: &'static str = "PRINTING"; +pub const ALERT_MESSAGE_EVENT: &'static str = "MESSAGE"; +pub const ALERT_ERRORLOG_EVENT: &'static str = "ERRORLOG"; +pub const ALERT_ADMIN_EVENT: &'static str = "ADMIN"; +pub const ALERT_USER_EVENT: &'static str = "USER"; +pub const PRJOB_QSTATUS: DWORD = 0x3; +pub const PRJOB_DEVSTATUS: DWORD = 0x1fc; +pub const PRJOB_COMPLETE: DWORD = 0x4; +pub const PRJOB_INTERV: DWORD = 0x8; +pub const PRJOB_ERROR: DWORD = 0x10; +pub const PRJOB_DESTOFFLINE: DWORD = 0x20; +pub const PRJOB_DESTPAUSED: DWORD = 0x40; +pub const PRJOB_NOTIFY: DWORD = 0x80; +pub const PRJOB_DESTNOPAPER: DWORD = 0x100; +pub const PRJOB_DELETED: DWORD = 0x8000; +pub const PRJOB_QS_QUEUED: DWORD = 0; +pub const PRJOB_QS_PAUSED: DWORD = 1; +pub const PRJOB_QS_SPOOLING: DWORD = 2; +pub const PRJOB_QS_PRINTING: DWORD = 3; diff --git a/src/vendor/winapi/src/um/lmapibuf.rs b/src/vendor/winapi/src/um/lmapibuf.rs new file mode 100644 index 0000000000..fe9e20f1e9 --- /dev/null +++ b/src/vendor/winapi/src/um/lmapibuf.rs @@ -0,0 +1,31 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains information about NetApiBuffer APIs +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{DWORD, LPDWORD, LPVOID}; +extern "system" { + pub fn NetApiBufferAllocate( + ByteCount: DWORD, + Buffer: *mut LPVOID, + ) -> NET_API_STATUS; + pub fn NetApiBufferFree( + Buffer: LPVOID, + ) -> NET_API_STATUS; + pub fn NetApiBufferReallocate( + OldBuffer: LPVOID, + NewByteCount: DWORD, + NewBuffer: *mut LPVOID, + ) -> NET_API_STATUS; + pub fn NetApiBufferSize( + Buffer: LPVOID, + ByteCount: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetapipBufferAllocate( + ByteCount: DWORD, + Buffer: *mut LPVOID, + ) -> NET_API_STATUS; +} diff --git a/src/vendor/winapi/src/um/lmat.rs b/src/vendor/winapi/src/um/lmat.rs new file mode 100644 index 0000000000..3522c83653 --- /dev/null +++ b/src/vendor/winapi/src/um/lmat.rs @@ -0,0 +1,63 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::DWORD_PTR; +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD, UCHAR}; +use um::winnt::{LPCWSTR, LPWSTR}; +pub const JOB_RUN_PERIODICALLY: UCHAR = 0x01; +pub const JOB_EXEC_ERROR: UCHAR = 0x02; +pub const JOB_RUNS_TODAY: UCHAR = 0x04; +pub const JOB_ADD_CURRENT_DATE: UCHAR = 0x08; +pub const JOB_NONINTERACTIVE: UCHAR = 0x10; +pub const JOB_INPUT_FLAGS: UCHAR = JOB_RUN_PERIODICALLY | JOB_ADD_CURRENT_DATE + | JOB_NONINTERACTIVE; +pub const JOB_OUTPUT_FLAGS: UCHAR = JOB_RUN_PERIODICALLY | JOB_EXEC_ERROR | JOB_RUNS_TODAY + | JOB_NONINTERACTIVE; +STRUCT!{struct AT_INFO { + JobTime: DWORD_PTR, + DaysOfMonth: DWORD, + DaysOfWeek: UCHAR, + Flags: UCHAR, + Command: LPWSTR, +}} +pub type PAT_INFO = *mut AT_INFO; +pub type LPAT_INFO = *mut AT_INFO; +STRUCT!{struct AT_ENUM { + JobId: DWORD, + JobTime: DWORD_PTR, + DaysOfMonth: DWORD, + DaysOfWeek: UCHAR, + Flags: UCHAR, + Command: LPWSTR, +}} +pub type PAT_ENUM = *mut AT_ENUM; +pub type LPAT_ENUM = *mut AT_ENUM; +extern "system" { + pub fn NetScheduleJobAdd( + Servername: LPCWSTR, + Buffer: LPBYTE, + JobId: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetScheduleJobDel( + Servername: LPCWSTR, + MinJobId: DWORD, + MaxJobId: DWORD, + ) -> NET_API_STATUS; + pub fn NetScheduleJobEnum( + Servername: LPCWSTR, + PointerToBuffer: *mut LPBYTE, + PointerToBuffer: DWORD, + EntriesRead: LPDWORD, + TotalEntries: LPDWORD, + ResumeHandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetScheduleJobGetInfo( + Servername: LPCWSTR, + JobId: DWORD, + PointerToBuffer: *mut LPBYTE, + ) -> NET_API_STATUS; +} diff --git a/src/vendor/winapi/src/um/lmdfs.rs b/src/vendor/winapi/src/um/lmdfs.rs new file mode 100644 index 0000000000..4b5f866431 --- /dev/null +++ b/src/vendor/winapi/src/um/lmdfs.rs @@ -0,0 +1,484 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +// This file contains structures, function prototypes, and definitions for the NetDfs API +use shared::guiddef::GUID; +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD, ULONG, USHORT}; +use um::winnt::{LPWSTR, PSECURITY_DESCRIPTOR, PWSTR, SECURITY_INFORMATION, ULONGLONG, WCHAR}; +pub const DFS_VOLUME_STATES: DWORD = 0xF; +pub const DFS_VOLUME_STATE_OK: DWORD = 1; +pub const DFS_VOLUME_STATE_INCONSISTENT: DWORD = 2; +pub const DFS_VOLUME_STATE_OFFLINE: DWORD = 3; +pub const DFS_VOLUME_STATE_ONLINE: DWORD = 4; +pub const DFS_VOLUME_STATE_RESYNCHRONIZE: DWORD = 0x10; +pub const DFS_VOLUME_STATE_STANDBY: DWORD = 0x20; +pub const DFS_VOLUME_STATE_FORCE_SYNC: DWORD = 0x40; +pub const DFS_VOLUME_FLAVORS: DWORD = 0x0300; +pub const DFS_VOLUME_FLAVOR_UNUSED1: DWORD = 0x0000; +pub const DFS_VOLUME_FLAVOR_STANDALONE: DWORD = 0x0100; +pub const DFS_VOLUME_FLAVOR_AD_BLOB: DWORD = 0x0200; +pub const DFS_STORAGE_FLAVOR_UNUSED2: DWORD = 0x0300; +pub const DFS_STORAGE_STATES: ULONG = 0xF; +pub const DFS_STORAGE_STATE_OFFLINE: ULONG = 1; +pub const DFS_STORAGE_STATE_ONLINE: ULONG = 2; +pub const DFS_STORAGE_STATE_ACTIVE: ULONG = 4; +ENUM!{enum DFS_TARGET_PRIORITY_CLASS { + DfsInvalidPriorityClass = -1i32 as u32, + DfsSiteCostNormalPriorityClass = 0, + DfsGlobalHighPriorityClass, + DfsSiteCostHighPriorityClass, + DfsSiteCostLowPriorityClass, + DfsGlobalLowPriorityClass, +}} +STRUCT!{struct DFS_TARGET_PRIORITY { + TargetPriorityClass: DFS_TARGET_PRIORITY_CLASS, + TargetPriorityRank: USHORT, + Reserved: USHORT, +}} +pub type PDFS_TARGET_PRIORITY = *mut DFS_TARGET_PRIORITY; +STRUCT!{struct DFS_INFO_1 { + EntryPath: LPWSTR, +}} +pub type PDFS_INFO_1 = *mut DFS_INFO_1; +pub type LPDFS_INFO_1 = *mut DFS_INFO_1; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +STRUCT!{struct DFS_INFO_1_32 { + EntryPath: ULONG, +}} +pub type PDFS_INFO_1_32 = *mut DFS_INFO_1_32; +pub type LPDFS_INFO_1_32 = *mut DFS_INFO_1_32; +} +STRUCT!{struct DFS_INFO_2 { + EntryPath: LPWSTR, + Comment: LPWSTR, + State: DWORD, + NumberOfStorages: DWORD, +}} +pub type PDFS_INFO_2 = *mut DFS_INFO_2; +pub type LPDFS_INFO_2 = *mut DFS_INFO_2; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +STRUCT!{struct DFS_INFO_2_32 { + EntryPath: ULONG, + Comment: ULONG, + State: DWORD, + NumberOfStorages: DWORD, +}} +pub type PDFS_INFO_2_32 = *mut DFS_INFO_2_32; +pub type LPDFS_INFO_2_32 = *mut DFS_INFO_2_32; +} +STRUCT!{struct DFS_STORAGE_INFO { + State: ULONG, + ServerName: LPWSTR, + ShareName: LPWSTR, +}} +pub type PDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO; +pub type LPDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +STRUCT!{struct DFS_STORAGE_INFO_0_32 { + State: ULONG, + ServerName: ULONG, + ShareName: ULONG, +}} +pub type PDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32; +pub type LPDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32; +} +STRUCT!{struct DFS_STORAGE_INFO_1 { + State: ULONG, + ServerName: LPWSTR, + ShareName: LPWSTR, + TargetPriority: DFS_TARGET_PRIORITY, +}} +pub type PDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1; +pub type LPDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1; +STRUCT!{struct DFS_INFO_3 { + EntryPath: LPWSTR, + Comment: LPWSTR, + State: DWORD, + NumberOfStorages: DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_3 = *mut DFS_INFO_3; +pub type LPDFS_INFO_3 = *mut DFS_INFO_3; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +STRUCT!{struct DFS_INFO_3_32 { + EntryPath: ULONG, + Comment: ULONG, + State: DWORD, + NumberOfStorages: DWORD, + Storage: ULONG, +}} +pub type PDFS_INFO_3_32 = *mut DFS_INFO_3_32; +pub type LPDFS_INFO_3_32 = *mut DFS_INFO_3_32; +} +STRUCT!{struct DFS_INFO_4 { + EntryPath: LPWSTR, + Comment: LPWSTR, + State: DWORD, + Timeout: ULONG, + Guid: GUID, + NumberOfStorages: DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_4 = *mut DFS_INFO_4; +pub type LPDFS_INFO_4 = *mut DFS_INFO_4; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +STRUCT!{struct DFS_INFO_4_32 { + EntryPath: ULONG, + Comment: ULONG, + State: DWORD, + Timeout: ULONG, + Guid: GUID, + NumberOfStorages: DWORD, + Storage: ULONG, +}} +pub type PDFS_INFO_4_32 = *mut DFS_INFO_4_32; +pub type LPDFS_INFO_4_32 = *mut DFS_INFO_4_32; +} +STRUCT!{struct DFS_INFO_5 { + EntryPath: LPWSTR, + Comment: LPWSTR, + State: DWORD, + Timeout: ULONG, + Guid: GUID, + PropertyFlags: ULONG, + MetadataSize: ULONG, + NumberOfStorages: DWORD, +}} +pub type PDFS_INFO_5 = *mut DFS_INFO_5; +pub type LPDFS_INFO_5 = *mut DFS_INFO_5; +STRUCT!{struct DFS_INFO_6 { + EntryPath: LPWSTR, + Comment: LPWSTR, + State: DWORD, + Timeout: ULONG, + Guid: GUID, + PropertyFlags: ULONG, + MetadataSize: ULONG, + NumberOfStorages: DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_6 = *mut DFS_INFO_6; +pub type LPDFS_INFO_6 = *mut DFS_INFO_6; +STRUCT!{struct DFS_INFO_7 { + GenerationGuid: GUID, +}} +pub type PDFS_INFO_7 = *mut DFS_INFO_7; +pub type LPDFS_INFO_7 = *mut DFS_INFO_7; +STRUCT!{struct DFS_INFO_8 { + EntryPath: LPWSTR, + Comment: LPWSTR, + State: DWORD, + Timeout: ULONG, + Guid: GUID, + PropertyFlags: ULONG, + MetadataSize: ULONG, + SdLengthReserved: ULONG, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + NumberOfStorages: DWORD, +}} +pub type PDFS_INFO_8 = *mut DFS_INFO_8; +pub type LPDFS_INFO_8 = *mut DFS_INFO_8; +STRUCT!{struct DFS_INFO_9 { + EntryPath: LPWSTR, + Comment: LPWSTR, + State: DWORD, + Timeout: ULONG, + Guid: GUID, + PropertyFlags: ULONG, + MetadataSize: ULONG, + SdLengthReserved: ULONG, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + NumberOfStorages: DWORD, + Storage: LPDFS_STORAGE_INFO, +}} +pub type PDFS_INFO_9 = *mut DFS_INFO_9; +pub type LPDFS_INFO_9 = *mut DFS_INFO_9; +pub const DFS_VALID_PROPERTY_FLAGS: ULONG = DFS_PROPERTY_FLAG_INSITE_REFERRALS + | DFS_PROPERTY_FLAG_ROOT_SCALABILITY | DFS_PROPERTY_FLAG_SITE_COSTING + | DFS_PROPERTY_FLAG_TARGET_FAILBACK | DFS_PROPERTY_FLAG_CLUSTER_ENABLED + | DFS_PROPERTY_FLAG_ABDE; +pub const DFS_PROPERTY_FLAG_INSITE_REFERRALS: ULONG = 0x00000001; +pub const DFS_PROPERTY_FLAG_ROOT_SCALABILITY: ULONG = 0x00000002; +pub const DFS_PROPERTY_FLAG_SITE_COSTING: ULONG = 0x00000004; +pub const DFS_PROPERTY_FLAG_TARGET_FAILBACK: ULONG = 0x00000008; +pub const DFS_PROPERTY_FLAG_CLUSTER_ENABLED: ULONG = 0x00000010; +pub const DFS_PROPERTY_FLAG_ABDE: ULONG = 0x00000020; +STRUCT!{struct DFS_INFO_50 { + NamespaceMajorVersion: ULONG, + NamespaceMinorVersion: ULONG, + NamespaceCapabilities: ULONGLONG, +}} +pub type PDFS_INFO_50 = *mut DFS_INFO_50; +pub type LPDFS_INFO_50 = *mut DFS_INFO_50; +STRUCT!{struct DFS_INFO_100 { + Comment: LPWSTR, +}} +pub type PDFS_INFO_100 = *mut DFS_INFO_100; +pub type LPDFS_INFO_100 = *mut DFS_INFO_100; +STRUCT!{struct DFS_INFO_101 { + State: DWORD, +}} +pub type PDFS_INFO_101 = *mut DFS_INFO_101; +pub type LPDFS_INFO_101 = *mut DFS_INFO_101; +STRUCT!{struct DFS_INFO_102 { + Timeout: ULONG, +}} +pub type PDFS_INFO_102 = *mut DFS_INFO_102; +pub type LPDFS_INFO_102 = *mut DFS_INFO_102; +STRUCT!{struct DFS_INFO_103 { + PropertyFlagMask: ULONG, + PropertyFlags: ULONG, +}} +pub type PDFS_INFO_103 = *mut DFS_INFO_103; +pub type LPDFS_INFO_103 = *mut DFS_INFO_103; +STRUCT!{struct DFS_INFO_104 { + TargetPriority: DFS_TARGET_PRIORITY, +}} +pub type PDFS_INFO_104 = *mut DFS_INFO_104; +pub type LPDFS_INFO_104 = *mut DFS_INFO_104; +STRUCT!{struct DFS_INFO_105 { + Comment: LPWSTR, + State: DWORD, + Timeout: ULONG, + PropertyFlagMask: ULONG, + PropertyFlags: ULONG, +}} +pub type PDFS_INFO_105 = *mut DFS_INFO_105; +pub type LPDFS_INFO_105 = *mut DFS_INFO_105; +STRUCT!{struct DFS_INFO_106 { + State: DWORD, + TargetPriority: DFS_TARGET_PRIORITY, +}} +pub type PDFS_INFO_106 = *mut DFS_INFO_106; +pub type LPDFS_INFO_106 = *mut DFS_INFO_106; +STRUCT!{struct DFS_INFO_107 { + Comment: LPWSTR, + State: DWORD, + Timeout: ULONG, + PropertyFlagMask: ULONG, + PropertyFlags: ULONG, + SdLengthReserved: ULONG, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, +}} +pub type PDFS_INFO_107 = *mut DFS_INFO_107; +pub type LPDFS_INFO_107 = *mut DFS_INFO_107; +STRUCT!{struct DFS_INFO_150 { + SdLengthReserved: ULONG, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, +}} +pub type PDFS_INFO_150 = *mut DFS_INFO_150; +pub type LPDFS_INFO_150 = *mut DFS_INFO_150; +STRUCT!{struct DFS_INFO_200 { + FtDfsName: LPWSTR, +}} +pub type PDFS_INFO_200 = *mut DFS_INFO_200; +pub type LPDFS_INFO_200 = *mut DFS_INFO_200; +STRUCT!{struct DFS_INFO_300 { + Flags: DWORD, + DfsName: LPWSTR, +}} +pub type PDFS_INFO_300 = *mut DFS_INFO_300; +pub type LPDFS_INFO_300 = *mut DFS_INFO_300; +extern "system" { + pub fn NetDfsAdd( + DfsEntryPath: LPWSTR, + ServerName: LPWSTR, + ShareName: LPWSTR, + Comment: LPWSTR, + Flags: DWORD, + ) -> NET_API_STATUS; +} +pub const DFS_ADD_VOLUME: DWORD = 1; +pub const DFS_RESTORE_VOLUME: DWORD = 2; +extern "system" { + pub fn NetDfsAddStdRoot( + ServerName: LPWSTR, + RootShare: LPWSTR, + Comment: LPWSTR, + Flags: DWORD, + ) -> NET_API_STATUS; + pub fn NetDfsRemoveStdRoot( + ServerName: LPWSTR, + RootShare: LPWSTR, + Flags: DWORD, + ) -> NET_API_STATUS; + pub fn NetDfsAddFtRoot( + ServerName: LPWSTR, + RootShare: LPWSTR, + FtDfsName: LPWSTR, + Comment: LPWSTR, + Flags: DWORD, + ) -> NET_API_STATUS; + pub fn NetDfsRemoveFtRoot( + ServerName: LPWSTR, + RootShare: LPWSTR, + FtDfsName: LPWSTR, + Flags: DWORD, + ) -> NET_API_STATUS; + pub fn NetDfsRemoveFtRootForced( + DomainName: LPWSTR, + ServerName: LPWSTR, + RootShare: LPWSTR, + FtDfsName: LPWSTR, + Flags: DWORD, + ) -> NET_API_STATUS; +} +pub const NET_DFS_SETDC_FLAGS: DWORD = 0x00000000; +pub const NET_DFS_SETDC_TIMEOUT: DWORD = 0x00000001; +pub const NET_DFS_SETDC_INITPKT: DWORD = 0x00000002; +STRUCT!{struct DFS_SITENAME_INFO { + SiteFlags: ULONG, + SiteName: LPWSTR, +}} +pub type PDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO; +pub type LPDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO; +pub const DFS_SITE_PRIMARY: ULONG = 0x1; +STRUCT!{struct DFS_SITELIST_INFO { + cSites: ULONG, + Site: [DFS_SITENAME_INFO; 1], +}} +pub type PDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO; +pub type LPDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO; +extern "system" { + pub fn NetDfsRemove( + DfsEntryPath: LPWSTR, + ServerName: LPWSTR, + ShareName: LPWSTR, + ) -> NET_API_STATUS; + pub fn NetDfsEnum( + DfsName: LPWSTR, + Level: DWORD, + PrefMaxLen: DWORD, + Buffer: *mut LPBYTE, + EntriesRead: LPDWORD, + ResumeHandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetDfsGetInfo( + DfsEntryPath: LPWSTR, + ServerName: LPWSTR, + ShareName: LPWSTR, + Level: DWORD, + Buffer: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetDfsSetInfo( + DfsEntryPath: LPWSTR, + ServerName: LPWSTR, + ShareName: LPWSTR, + Level: DWORD, + Buffer: LPBYTE, + ) -> NET_API_STATUS; + pub fn NetDfsGetClientInfo( + DfsEntryPath: LPWSTR, + ServerName: LPWSTR, + ShareName: LPWSTR, + Level: DWORD, + Buffer: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetDfsSetClientInfo( + DfsEntryPath: LPWSTR, + ServerName: LPWSTR, + ShareName: LPWSTR, + Level: DWORD, + Buffer: LPBYTE, + ) -> NET_API_STATUS; + pub fn NetDfsMove( + OldDfsEntryPath: LPWSTR, + NewDfsEntryPath: LPWSTR, + Flags: ULONG, + ) -> NET_API_STATUS; +} +pub const DFS_MOVE_FLAG_REPLACE_IF_EXISTS: ULONG = 0x00000001; +extern "system" { + pub fn NetDfsRename( + Path: LPWSTR, + NewPath: LPWSTR, + ) -> NET_API_STATUS; + pub fn NetDfsAddRootTarget( + pDfsPath: LPWSTR, + pTargetPath: LPWSTR, + MajorVersion: ULONG, + pComment: LPWSTR, + Flags: ULONG, + ) -> NET_API_STATUS; +} +pub const DFS_FORCE_REMOVE: ULONG = 0x80000000; +extern "system" { + pub fn NetDfsRemoveRootTarget( + pDfsPath: LPWSTR, + pTargetPath: LPWSTR, + Flags: DWORD, + ) -> NET_API_STATUS; + pub fn NetDfsGetSecurity( + DfsEntryPath: LPWSTR, + SecurityInformation: SECURITY_INFORMATION, + ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR, + lpcbSecurityDescriptor: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetDfsSetSecurity( + DfsEntryPath: LPWSTR, + SecurityInformation: SECURITY_INFORMATION, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + ) -> NET_API_STATUS; + pub fn NetDfsGetStdContainerSecurity( + MachineName: LPWSTR, + SecurityInformation: SECURITY_INFORMATION, + ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR, + lpcbSecurityDescriptor: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetDfsSetStdContainerSecurity( + MachineName: LPWSTR, + SecurityInformation: SECURITY_INFORMATION, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + ) -> NET_API_STATUS; + pub fn NetDfsGetFtContainerSecurity( + DomainName: LPWSTR, + SecurityInformation: SECURITY_INFORMATION, + ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR, + lpcbSecurityDescriptor: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetDfsSetFtContainerSecurity( + DomainName: LPWSTR, + SecurityInformation: SECURITY_INFORMATION, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + ) -> NET_API_STATUS; +} +ENUM!{enum DFS_NAMESPACE_VERSION_ORIGIN { + DFS_NAMESPACE_VERSION_ORIGIN_COMBINED = 0, + DFS_NAMESPACE_VERSION_ORIGIN_SERVER, + DFS_NAMESPACE_VERSION_ORIGIN_DOMAIN, +}} +pub type PDFS_NAMESPACE_VERSION_ORIGIN = *mut DFS_NAMESPACE_VERSION_ORIGIN; +pub const DFS_NAMESPACE_CAPABILITY_ABDE: ULONGLONG = 0x0000000000000001; +STRUCT!{struct DFS_SUPPORTED_NAMESPACE_VERSION_INFO { + DomainDfsMajorVersion: ULONG, + DomainDfsMinorVersion: ULONG, + DomainDfsCapabilities: ULONGLONG, + StandaloneDfsMajorVersion: ULONG, + StandaloneDfsMinorVersion: ULONG, + StandaloneDfsCapabilities: ULONGLONG, +}} +pub type PDFS_SUPPORTED_NAMESPACE_VERSION_INFO = *mut DFS_SUPPORTED_NAMESPACE_VERSION_INFO; +extern "system" { + pub fn NetDfsGetSupportedNamespaceVersion( + Origin: DFS_NAMESPACE_VERSION_ORIGIN, + pName: PWSTR, + ppVersionInfo: *mut PDFS_SUPPORTED_NAMESPACE_VERSION_INFO, + ) -> NET_API_STATUS; +} +STRUCT!{struct DFS_GET_PKT_ENTRY_STATE_ARG { + DfsEntryPathLen: USHORT, + ServerNameLen: USHORT, + ShareNameLen: USHORT, + Level: ULONG, + Buffer: [WCHAR; 1], +}} +pub type PDFS_GET_PKT_ENTRY_STATE_ARG = *mut DFS_GET_PKT_ENTRY_STATE_ARG; diff --git a/src/vendor/winapi/src/um/lmerrlog.rs b/src/vendor/winapi/src/um/lmerrlog.rs new file mode 100644 index 0000000000..f91389b300 --- /dev/null +++ b/src/vendor/winapi/src/um/lmerrlog.rs @@ -0,0 +1,269 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{DWORD, LPBYTE}; +use um::winnt::LPWSTR; +STRUCT!{struct ERROR_LOG { + el_len: DWORD, + el_reserved: DWORD, + el_time: DWORD, + el_error: DWORD, + el_name: LPWSTR, + el_text: LPWSTR, + el_data: LPBYTE, + el_data_size: DWORD, + el_nstrings: DWORD, +}} +pub type PERROR_LOG = *mut ERROR_LOG; +pub type LPERROR_LOG = *mut ERROR_LOG; +STRUCT!{struct HLOG { + time: DWORD, + last_flags: DWORD, + offset: DWORD, + rec_offset: DWORD, +}} +pub type PHLOG = *mut HLOG; +pub type LPHLOG = *mut HLOG; +pub const LOGFLAGS_FORWARD: DWORD = 0; +pub const LOGFLAGS_BACKWARD: DWORD = 0x1; +pub const LOGFLAGS_SEEK: DWORD = 0x2; +pub const ERRLOG_BASE: DWORD = 3100; +pub const NELOG_Internal_Error: DWORD = ERRLOG_BASE + 0; +pub const NELOG_Resource_Shortage: DWORD = ERRLOG_BASE + 1; +pub const NELOG_Unable_To_Lock_Segment: DWORD = ERRLOG_BASE + 2; +pub const NELOG_Unable_To_Unlock_Segment: DWORD = ERRLOG_BASE + 3; +pub const NELOG_Uninstall_Service: DWORD = ERRLOG_BASE + 4; +pub const NELOG_Init_Exec_Fail: DWORD = ERRLOG_BASE + 5; +pub const NELOG_Ncb_Error: DWORD = ERRLOG_BASE + 6; +pub const NELOG_Net_Not_Started: DWORD = ERRLOG_BASE + 7; +pub const NELOG_Ioctl_Error: DWORD = ERRLOG_BASE + 8; +pub const NELOG_System_Semaphore: DWORD = ERRLOG_BASE + 9; +pub const NELOG_Init_OpenCreate_Err: DWORD = ERRLOG_BASE + 10; +pub const NELOG_NetBios: DWORD = ERRLOG_BASE + 11; +pub const NELOG_SMB_Illegal: DWORD = ERRLOG_BASE + 12; +pub const NELOG_Service_Fail: DWORD = ERRLOG_BASE + 13; +pub const NELOG_Entries_Lost: DWORD = ERRLOG_BASE + 14; +pub const NELOG_Init_Seg_Overflow: DWORD = ERRLOG_BASE + 20; +pub const NELOG_Srv_No_Mem_Grow: DWORD = ERRLOG_BASE + 21; +pub const NELOG_Access_File_Bad: DWORD = ERRLOG_BASE + 22; +pub const NELOG_Srvnet_Not_Started: DWORD = ERRLOG_BASE + 23; +pub const NELOG_Init_Chardev_Err: DWORD = ERRLOG_BASE + 24; +pub const NELOG_Remote_API: DWORD = ERRLOG_BASE + 25; +pub const NELOG_Ncb_TooManyErr: DWORD = ERRLOG_BASE + 26; +pub const NELOG_Mailslot_err: DWORD = ERRLOG_BASE + 27; +pub const NELOG_ReleaseMem_Alert: DWORD = ERRLOG_BASE + 28; +pub const NELOG_AT_cannot_write: DWORD = ERRLOG_BASE + 29; +pub const NELOG_Cant_Make_Msg_File: DWORD = ERRLOG_BASE + 30; +pub const NELOG_Exec_Netservr_NoMem: DWORD = ERRLOG_BASE + 31; +pub const NELOG_Server_Lock_Failure: DWORD = ERRLOG_BASE + 32; +pub const NELOG_Msg_Shutdown: DWORD = ERRLOG_BASE + 40; +pub const NELOG_Msg_Sem_Shutdown: DWORD = ERRLOG_BASE + 41; +pub const NELOG_Msg_Log_Err: DWORD = ERRLOG_BASE + 50; +pub const NELOG_VIO_POPUP_ERR: DWORD = ERRLOG_BASE + 51; +pub const NELOG_Msg_Unexpected_SMB_Type: DWORD = ERRLOG_BASE + 52; +pub const NELOG_Wksta_Infoseg: DWORD = ERRLOG_BASE + 60; +pub const NELOG_Wksta_Compname: DWORD = ERRLOG_BASE + 61; +pub const NELOG_Wksta_BiosThreadFailure: DWORD = ERRLOG_BASE + 62; +pub const NELOG_Wksta_IniSeg: DWORD = ERRLOG_BASE + 63; +pub const NELOG_Wksta_HostTab_Full: DWORD = ERRLOG_BASE + 64; +pub const NELOG_Wksta_Bad_Mailslot_SMB: DWORD = ERRLOG_BASE + 65; +pub const NELOG_Wksta_UASInit: DWORD = ERRLOG_BASE + 66; +pub const NELOG_Wksta_SSIRelogon: DWORD = ERRLOG_BASE + 67; +pub const NELOG_Build_Name: DWORD = ERRLOG_BASE + 70; +pub const NELOG_Name_Expansion: DWORD = ERRLOG_BASE + 71; +pub const NELOG_Message_Send: DWORD = ERRLOG_BASE + 72; +pub const NELOG_Mail_Slt_Err: DWORD = ERRLOG_BASE + 73; +pub const NELOG_AT_cannot_read: DWORD = ERRLOG_BASE + 74; +pub const NELOG_AT_sched_err: DWORD = ERRLOG_BASE + 75; +pub const NELOG_AT_schedule_file_created: DWORD = ERRLOG_BASE + 76; +pub const NELOG_Srvnet_NB_Open: DWORD = ERRLOG_BASE + 77; +pub const NELOG_AT_Exec_Err: DWORD = ERRLOG_BASE + 78; +pub const NELOG_Lazy_Write_Err: DWORD = ERRLOG_BASE + 80; +pub const NELOG_HotFix: DWORD = ERRLOG_BASE + 81; +pub const NELOG_HardErr_From_Server: DWORD = ERRLOG_BASE + 82; +pub const NELOG_LocalSecFail1: DWORD = ERRLOG_BASE + 83; +pub const NELOG_LocalSecFail2: DWORD = ERRLOG_BASE + 84; +pub const NELOG_LocalSecFail3: DWORD = ERRLOG_BASE + 85; +pub const NELOG_LocalSecGeneralFail: DWORD = ERRLOG_BASE + 86; +pub const NELOG_NetWkSta_Internal_Error: DWORD = ERRLOG_BASE + 90; +pub const NELOG_NetWkSta_No_Resource: DWORD = ERRLOG_BASE + 91; +pub const NELOG_NetWkSta_SMB_Err: DWORD = ERRLOG_BASE + 92; +pub const NELOG_NetWkSta_VC_Err: DWORD = ERRLOG_BASE + 93; +pub const NELOG_NetWkSta_Stuck_VC_Err: DWORD = ERRLOG_BASE + 94; +pub const NELOG_NetWkSta_NCB_Err: DWORD = ERRLOG_BASE + 95; +pub const NELOG_NetWkSta_Write_Behind_Err: DWORD = ERRLOG_BASE + 96; +pub const NELOG_NetWkSta_Reset_Err: DWORD = ERRLOG_BASE + 97; +pub const NELOG_NetWkSta_Too_Many: DWORD = ERRLOG_BASE + 98; +pub const NELOG_Srv_Thread_Failure: DWORD = ERRLOG_BASE + 104; +pub const NELOG_Srv_Close_Failure: DWORD = ERRLOG_BASE + 105; +pub const NELOG_ReplUserCurDir: DWORD = ERRLOG_BASE + 106; +pub const NELOG_ReplCannotMasterDir: DWORD = ERRLOG_BASE + 107; +pub const NELOG_ReplUpdateError: DWORD = ERRLOG_BASE + 108; +pub const NELOG_ReplLostMaster: DWORD = ERRLOG_BASE + 109; +pub const NELOG_NetlogonAuthDCFail: DWORD = ERRLOG_BASE + 110; +pub const NELOG_ReplLogonFailed: DWORD = ERRLOG_BASE + 111; +pub const NELOG_ReplNetErr: DWORD = ERRLOG_BASE + 112; +pub const NELOG_ReplMaxFiles: DWORD = ERRLOG_BASE + 113; +pub const NELOG_ReplMaxTreeDepth: DWORD = ERRLOG_BASE + 114; +pub const NELOG_ReplBadMsg: DWORD = ERRLOG_BASE + 115; +pub const NELOG_ReplSysErr: DWORD = ERRLOG_BASE + 116; +pub const NELOG_ReplUserLoged: DWORD = ERRLOG_BASE + 117; +pub const NELOG_ReplBadImport: DWORD = ERRLOG_BASE + 118; +pub const NELOG_ReplBadExport: DWORD = ERRLOG_BASE + 119; +pub const NELOG_ReplSignalFileErr: DWORD = ERRLOG_BASE + 120; +pub const NELOG_DiskFT: DWORD = ERRLOG_BASE + 121; +pub const NELOG_ReplAccessDenied: DWORD = ERRLOG_BASE + 122; +pub const NELOG_NetlogonFailedPrimary: DWORD = ERRLOG_BASE + 123; +pub const NELOG_NetlogonPasswdSetFailed: DWORD = ERRLOG_BASE + 124; +pub const NELOG_NetlogonTrackingError: DWORD = ERRLOG_BASE + 125; +pub const NELOG_NetlogonSyncError: DWORD = ERRLOG_BASE + 126; +pub const NELOG_NetlogonRequireSignOrSealError: DWORD = ERRLOG_BASE + 127; +pub const NELOG_UPS_PowerOut: DWORD = ERRLOG_BASE + 130; +pub const NELOG_UPS_Shutdown: DWORD = ERRLOG_BASE + 131; +pub const NELOG_UPS_CmdFileError: DWORD = ERRLOG_BASE + 132; +pub const NELOG_UPS_CannotOpenDriver: DWORD = ERRLOG_BASE + 133; +pub const NELOG_UPS_PowerBack: DWORD = ERRLOG_BASE + 134; +pub const NELOG_UPS_CmdFileConfig: DWORD = ERRLOG_BASE + 135; +pub const NELOG_UPS_CmdFileExec: DWORD = ERRLOG_BASE + 136; +pub const NELOG_Missing_Parameter: DWORD = ERRLOG_BASE + 150; +pub const NELOG_Invalid_Config_Line: DWORD = ERRLOG_BASE + 151; +pub const NELOG_Invalid_Config_File: DWORD = ERRLOG_BASE + 152; +pub const NELOG_File_Changed: DWORD = ERRLOG_BASE + 153; +pub const NELOG_Files_Dont_Fit: DWORD = ERRLOG_BASE + 154; +pub const NELOG_Wrong_DLL_Version: DWORD = ERRLOG_BASE + 155; +pub const NELOG_Error_in_DLL: DWORD = ERRLOG_BASE + 156; +pub const NELOG_System_Error: DWORD = ERRLOG_BASE + 157; +pub const NELOG_FT_ErrLog_Too_Large: DWORD = ERRLOG_BASE + 158; +pub const NELOG_FT_Update_In_Progress: DWORD = ERRLOG_BASE + 159; +pub const NELOG_Joined_Domain: DWORD = ERRLOG_BASE + 160; +pub const NELOG_Joined_Workgroup: DWORD = ERRLOG_BASE + 161; +pub const NELOG_OEM_Code: DWORD = ERRLOG_BASE + 199; +pub const ERRLOG2_BASE: DWORD = 5700; +pub const NELOG_NetlogonSSIInitError: DWORD = ERRLOG2_BASE + 0; +pub const NELOG_NetlogonFailedToUpdateTrustList: DWORD = ERRLOG2_BASE + 1; +pub const NELOG_NetlogonFailedToAddRpcInterface: DWORD = ERRLOG2_BASE + 2; +pub const NELOG_NetlogonFailedToReadMailslot: DWORD = ERRLOG2_BASE + 3; +pub const NELOG_NetlogonFailedToRegisterSC: DWORD = ERRLOG2_BASE + 4; +pub const NELOG_NetlogonChangeLogCorrupt: DWORD = ERRLOG2_BASE + 5; +pub const NELOG_NetlogonFailedToCreateShare: DWORD = ERRLOG2_BASE + 6; +pub const NELOG_NetlogonDownLevelLogonFailed: DWORD = ERRLOG2_BASE + 7; +pub const NELOG_NetlogonDownLevelLogoffFailed: DWORD = ERRLOG2_BASE + 8; +pub const NELOG_NetlogonNTLogonFailed: DWORD = ERRLOG2_BASE + 9; +pub const NELOG_NetlogonNTLogoffFailed: DWORD = ERRLOG2_BASE + 10; +pub const NELOG_NetlogonPartialSyncCallSuccess: DWORD = ERRLOG2_BASE + 11; +pub const NELOG_NetlogonPartialSyncCallFailed: DWORD = ERRLOG2_BASE + 12; +pub const NELOG_NetlogonFullSyncCallSuccess: DWORD = ERRLOG2_BASE + 13; +pub const NELOG_NetlogonFullSyncCallFailed: DWORD = ERRLOG2_BASE + 14; +pub const NELOG_NetlogonPartialSyncSuccess: DWORD = ERRLOG2_BASE + 15; +pub const NELOG_NetlogonPartialSyncFailed: DWORD = ERRLOG2_BASE + 16; +pub const NELOG_NetlogonFullSyncSuccess: DWORD = ERRLOG2_BASE + 17; +pub const NELOG_NetlogonFullSyncFailed: DWORD = ERRLOG2_BASE + 18; +pub const NELOG_NetlogonAuthNoDomainController: DWORD = ERRLOG2_BASE + 19; +pub const NELOG_NetlogonAuthNoTrustLsaSecret: DWORD = ERRLOG2_BASE + 20; +pub const NELOG_NetlogonAuthNoTrustSamAccount: DWORD = ERRLOG2_BASE + 21; +pub const NELOG_NetlogonServerAuthFailed: DWORD = ERRLOG2_BASE + 22; +pub const NELOG_NetlogonServerAuthNoTrustSamAccount: DWORD = ERRLOG2_BASE + 23; +pub const NELOG_FailedToRegisterSC: DWORD = ERRLOG2_BASE + 24; +pub const NELOG_FailedToSetServiceStatus: DWORD = ERRLOG2_BASE + 25; +pub const NELOG_FailedToGetComputerName: DWORD = ERRLOG2_BASE + 26; +pub const NELOG_DriverNotLoaded: DWORD = ERRLOG2_BASE + 27; +pub const NELOG_NoTranportLoaded: DWORD = ERRLOG2_BASE + 28; +pub const NELOG_NetlogonFailedDomainDelta: DWORD = ERRLOG2_BASE + 29; +pub const NELOG_NetlogonFailedGlobalGroupDelta: DWORD = ERRLOG2_BASE + 30; +pub const NELOG_NetlogonFailedLocalGroupDelta: DWORD = ERRLOG2_BASE + 31; +pub const NELOG_NetlogonFailedUserDelta: DWORD = ERRLOG2_BASE + 32; +pub const NELOG_NetlogonFailedPolicyDelta: DWORD = ERRLOG2_BASE + 33; +pub const NELOG_NetlogonFailedTrustedDomainDelta: DWORD = ERRLOG2_BASE + 34; +pub const NELOG_NetlogonFailedAccountDelta: DWORD = ERRLOG2_BASE + 35; +pub const NELOG_NetlogonFailedSecretDelta: DWORD = ERRLOG2_BASE + 36; +pub const NELOG_NetlogonSystemError: DWORD = ERRLOG2_BASE + 37; +pub const NELOG_NetlogonDuplicateMachineAccounts: DWORD = ERRLOG2_BASE + 38; +pub const NELOG_NetlogonTooManyGlobalGroups: DWORD = ERRLOG2_BASE + 39; +pub const NELOG_NetlogonBrowserDriver: DWORD = ERRLOG2_BASE + 40; +pub const NELOG_NetlogonAddNameFailure: DWORD = ERRLOG2_BASE + 41; +pub const NELOG_RplMessages: DWORD = ERRLOG2_BASE + 42; +pub const NELOG_RplXnsBoot: DWORD = ERRLOG2_BASE + 43; +pub const NELOG_RplSystem: DWORD = ERRLOG2_BASE + 44; +pub const NELOG_RplWkstaTimeout: DWORD = ERRLOG2_BASE + 45; +pub const NELOG_RplWkstaFileOpen: DWORD = ERRLOG2_BASE + 46; +pub const NELOG_RplWkstaFileRead: DWORD = ERRLOG2_BASE + 47; +pub const NELOG_RplWkstaMemory: DWORD = ERRLOG2_BASE + 48; +pub const NELOG_RplWkstaFileChecksum: DWORD = ERRLOG2_BASE + 49; +pub const NELOG_RplWkstaFileLineCount: DWORD = ERRLOG2_BASE + 50; +pub const NELOG_RplWkstaBbcFile: DWORD = ERRLOG2_BASE + 51; +pub const NELOG_RplWkstaFileSize: DWORD = ERRLOG2_BASE + 52; +pub const NELOG_RplWkstaInternal: DWORD = ERRLOG2_BASE + 53; +pub const NELOG_RplWkstaWrongVersion: DWORD = ERRLOG2_BASE + 54; +pub const NELOG_RplWkstaNetwork: DWORD = ERRLOG2_BASE + 55; +pub const NELOG_RplAdapterResource: DWORD = ERRLOG2_BASE + 56; +pub const NELOG_RplFileCopy: DWORD = ERRLOG2_BASE + 57; +pub const NELOG_RplFileDelete: DWORD = ERRLOG2_BASE + 58; +pub const NELOG_RplFilePerms: DWORD = ERRLOG2_BASE + 59; +pub const NELOG_RplCheckConfigs: DWORD = ERRLOG2_BASE + 60; +pub const NELOG_RplCreateProfiles: DWORD = ERRLOG2_BASE + 61; +pub const NELOG_RplRegistry: DWORD = ERRLOG2_BASE + 62; +pub const NELOG_RplReplaceRPLDISK: DWORD = ERRLOG2_BASE + 63; +pub const NELOG_RplCheckSecurity: DWORD = ERRLOG2_BASE + 64; +pub const NELOG_RplBackupDatabase: DWORD = ERRLOG2_BASE + 65; +pub const NELOG_RplInitDatabase: DWORD = ERRLOG2_BASE + 66; +pub const NELOG_RplRestoreDatabaseFailure: DWORD = ERRLOG2_BASE + 67; +pub const NELOG_RplRestoreDatabaseSuccess: DWORD = ERRLOG2_BASE + 68; +pub const NELOG_RplInitRestoredDatabase: DWORD = ERRLOG2_BASE + 69; +pub const NELOG_NetlogonSessionTypeWrong: DWORD = ERRLOG2_BASE + 70; +pub const NELOG_RplUpgradeDBTo40: DWORD = ERRLOG2_BASE + 71; +pub const NELOG_NetlogonLanmanBdcsNotAllowed: DWORD = ERRLOG2_BASE + 72; +pub const NELOG_NetlogonNoDynamicDns: DWORD = ERRLOG2_BASE + 73; +pub const NELOG_NetlogonDynamicDnsRegisterFailure: DWORD = ERRLOG2_BASE + 74; +pub const NELOG_NetlogonDynamicDnsDeregisterFailure: DWORD = ERRLOG2_BASE + 75; +pub const NELOG_NetlogonFailedFileCreate: DWORD = ERRLOG2_BASE + 76; +pub const NELOG_NetlogonGetSubnetToSite: DWORD = ERRLOG2_BASE + 77; +pub const NELOG_NetlogonNoSiteForClient: DWORD = ERRLOG2_BASE + 78; +pub const NELOG_NetlogonBadSiteName: DWORD = ERRLOG2_BASE + 79; +pub const NELOG_NetlogonBadSubnetName: DWORD = ERRLOG2_BASE + 80; +pub const NELOG_NetlogonDynamicDnsServerFailure: DWORD = ERRLOG2_BASE + 81; +pub const NELOG_NetlogonDynamicDnsFailure: DWORD = ERRLOG2_BASE + 82; +pub const NELOG_NetlogonRpcCallCancelled: DWORD = ERRLOG2_BASE + 83; +pub const NELOG_NetlogonDcSiteCovered: DWORD = ERRLOG2_BASE + 84; +pub const NELOG_NetlogonDcSiteNotCovered: DWORD = ERRLOG2_BASE + 85; +pub const NELOG_NetlogonGcSiteCovered: DWORD = ERRLOG2_BASE + 86; +pub const NELOG_NetlogonGcSiteNotCovered: DWORD = ERRLOG2_BASE + 87; +pub const NELOG_NetlogonFailedSpnUpdate: DWORD = ERRLOG2_BASE + 88; +pub const NELOG_NetlogonFailedDnsHostNameUpdate: DWORD = ERRLOG2_BASE + 89; +pub const NELOG_NetlogonAuthNoUplevelDomainController: DWORD = ERRLOG2_BASE + 90; +pub const NELOG_NetlogonAuthDomainDowngraded: DWORD = ERRLOG2_BASE + 91; +pub const NELOG_NetlogonNdncSiteCovered: DWORD = ERRLOG2_BASE + 92; +pub const NELOG_NetlogonNdncSiteNotCovered: DWORD = ERRLOG2_BASE + 93; +pub const NELOG_NetlogonDcOldSiteCovered: DWORD = ERRLOG2_BASE + 94; +pub const NELOG_NetlogonDcSiteNotCoveredAuto: DWORD = ERRLOG2_BASE + 95; +pub const NELOG_NetlogonGcOldSiteCovered: DWORD = ERRLOG2_BASE + 96; +pub const NELOG_NetlogonGcSiteNotCoveredAuto: DWORD = ERRLOG2_BASE + 97; +pub const NELOG_NetlogonNdncOldSiteCovered: DWORD = ERRLOG2_BASE + 98; +pub const NELOG_NetlogonNdncSiteNotCoveredAuto: DWORD = ERRLOG2_BASE + 99; +pub const NELOG_NetlogonSpnMultipleSamAccountNames: DWORD = ERRLOG2_BASE + 100; +pub const NELOG_NetlogonSpnCrackNamesFailure: DWORD = ERRLOG2_BASE + 101; +pub const NELOG_NetlogonNoAddressToSiteMapping: DWORD = ERRLOG2_BASE + 102; +pub const NELOG_NetlogonInvalidGenericParameterValue: DWORD = ERRLOG2_BASE + 103; +pub const NELOG_NetlogonInvalidDwordParameterValue: DWORD = ERRLOG2_BASE + 104; +pub const NELOG_NetlogonServerAuthFailedNoAccount: DWORD = ERRLOG2_BASE + 105; +pub const NELOG_NetlogonNoDynamicDnsManual: DWORD = ERRLOG2_BASE + 106; +pub const NELOG_NetlogonNoSiteForClients: DWORD = ERRLOG2_BASE + 107; +pub const NELOG_NetlogonDnsDeregAborted: DWORD = ERRLOG2_BASE + 108; +pub const NELOG_NetlogonRpcPortRequestFailure: DWORD = ERRLOG2_BASE + 109; +pub const NELOG_NetlogonPartialSiteMappingForClients: DWORD = ERRLOG2_BASE + 110; +pub const NELOG_NetlogonRemoteDynamicDnsRegisterFailure: DWORD = ERRLOG2_BASE + 111; +pub const NELOG_NetlogonRemoteDynamicDnsDeregisterFailure: DWORD = ERRLOG2_BASE + 112; +pub const NELOG_NetlogonRejectedRemoteDynamicDnsRegister: DWORD = ERRLOG2_BASE + 113; +pub const NELOG_NetlogonRejectedRemoteDynamicDnsDeregister: DWORD = ERRLOG2_BASE + 114; +pub const NELOG_NetlogonRemoteDynamicDnsUpdateRequestFailure: DWORD = ERRLOG2_BASE + 115; +pub const NELOG_NetlogonUserValidationReqInitialTimeOut: DWORD = ERRLOG2_BASE + 116; +pub const NELOG_NetlogonUserValidationReqRecurringTimeOut: DWORD = ERRLOG2_BASE + 117; +pub const NELOG_NetlogonUserValidationReqWaitInitialWarning: DWORD = ERRLOG2_BASE + 118; +pub const NELOG_NetlogonUserValidationReqWaitRecurringWarning: DWORD = ERRLOG2_BASE + 119; +pub const NELOG_NetlogonFailedToAddAuthzRpcInterface: DWORD = ERRLOG2_BASE + 120; +pub const NELOG_NetLogonFailedToInitializeAuthzRm: DWORD = ERRLOG2_BASE + 121; +pub const NELOG_NetLogonFailedToInitializeRPCSD: DWORD = ERRLOG2_BASE + 122; +pub const NELOG_NetlogonMachinePasswdSetSucceeded: DWORD = ERRLOG2_BASE + 123; +pub const NELOG_NetlogonMsaPasswdSetSucceeded: DWORD = ERRLOG2_BASE + 124; diff --git a/src/vendor/winapi/src/um/lmjoin.rs b/src/vendor/winapi/src/um/lmjoin.rs new file mode 100644 index 0000000000..4e731c05dc --- /dev/null +++ b/src/vendor/winapi/src/um/lmjoin.rs @@ -0,0 +1,233 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +// Definitions and prototypes for the Net setup apis +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{BYTE, DWORD, PBYTE, PDWORD, ULONG}; +use um::wincrypt::PCCERT_CONTEXT; +use um::winnt::{HRESULT, LPCWSTR, LPWSTR, PVOID}; +ENUM!{enum NETSETUP_NAME_TYPE { + NetSetupUnknown = 0, + NetSetupMachine, + NetSetupWorkgroup, + NetSetupDomain, + NetSetupNonExistentDomain, + NetSetupDnsMachine, +}} +pub type PNETSETUP_NAME_TYPE = *mut NETSETUP_NAME_TYPE; +ENUM!{enum DSREG_JOIN_TYPE { + DSREG_UNKNOWN_JOIN = 0, + DSREG_DEVICE_JOIN = 1, + DSREG_WORKPLACE_JOIN = 2, +}} +pub type PDSREG_JOIN_TYPE = *mut DSREG_JOIN_TYPE; +STRUCT!{struct DSREG_USER_INFO { + pszUserEmail: LPWSTR, + pszUserKeyId: LPWSTR, + pszUserKeyName: LPWSTR, +}} +pub type PDSREG_USER_INFO = *mut DSREG_USER_INFO; +STRUCT!{struct DSREG_JOIN_INFO { + joinType: DSREG_JOIN_TYPE, + pJoinCertificate: PCCERT_CONTEXT, + pszDeviceId: LPWSTR, + pszIdpDomain: LPWSTR, + pszTenantId: LPWSTR, + pszJoinUserEmail: LPWSTR, + pszTenantDisplayName: LPWSTR, + pszMdmEnrollmentUrl: LPWSTR, + pszMdmTermsOfUseUrl: LPWSTR, + pszMdmComplianceUrl: LPWSTR, + pszUserSettingSyncUrl: LPWSTR, + pUserInfo: *mut DSREG_USER_INFO, +}} +pub type PDSREG_JOIN_INFO = *mut DSREG_JOIN_INFO; +pub const NETSETUP_JOIN_DOMAIN: DWORD = 0x00000001; +pub const NETSETUP_ACCT_CREATE: DWORD = 0x00000002; +pub const NETSETUP_ACCT_DELETE: DWORD = 0x00000004; +pub const NETSETUP_WIN9X_UPGRADE: DWORD = 0x00000010; +pub const NETSETUP_DOMAIN_JOIN_IF_JOINED: DWORD = 0x00000020; +pub const NETSETUP_JOIN_UNSECURE: DWORD = 0x00000040; +pub const NETSETUP_MACHINE_PWD_PASSED: DWORD = 0x00000080; +pub const NETSETUP_DEFER_SPN_SET: DWORD = 0x00000100; +pub const NETSETUP_JOIN_DC_ACCOUNT: DWORD = 0x00000200; +pub const NETSETUP_JOIN_WITH_NEW_NAME: DWORD = 0x00000400; +pub const NETSETUP_JOIN_READONLY: DWORD = 0x00000800; +pub const NETSETUP_DNS_NAME_CHANGES_ONLY: DWORD = 0x00001000; +pub const NETSETUP_INSTALL_INVOCATION: DWORD = 0x00040000; +pub const NETSETUP_AMBIGUOUS_DC: DWORD = 0x00001000; +pub const NETSETUP_NO_NETLOGON_CACHE: DWORD = 0x00002000; +pub const NETSETUP_DONT_CONTROL_SERVICES: DWORD = 0x00004000; +pub const NETSETUP_SET_MACHINE_NAME: DWORD = 0x00008000; +pub const NETSETUP_FORCE_SPN_SET: DWORD = 0x00010000; +pub const NETSETUP_NO_ACCT_REUSE: DWORD = 0x00020000; +pub const NETSETUP_ALT_SAMACCOUNTNAME: DWORD = 0x00020000; +pub const NETSETUP_IGNORE_UNSUPPORTED_FLAGS: DWORD = 0x10000000; +pub const NETSETUP_VALID_UNJOIN_FLAGS: DWORD = NETSETUP_ACCT_DELETE + | NETSETUP_IGNORE_UNSUPPORTED_FLAGS | NETSETUP_JOIN_DC_ACCOUNT; +pub const NETSETUP_PROCESS_OFFLINE_FLAGS: DWORD = NETSETUP_JOIN_DOMAIN + | NETSETUP_DOMAIN_JOIN_IF_JOINED | NETSETUP_JOIN_WITH_NEW_NAME | NETSETUP_DONT_CONTROL_SERVICES + | NETSETUP_MACHINE_PWD_PASSED; +extern "system" { + pub fn NetJoinDomain( + lpServer: LPCWSTR, + lpDomain: LPCWSTR, + lpMachineAccountOU: LPCWSTR, + lpAccount: LPCWSTR, + lpPassword: LPCWSTR, + fJoinOptions: DWORD, + ) -> NET_API_STATUS; + pub fn NetUnjoinDomain( + lpServer: LPCWSTR, + lpAccount: LPCWSTR, + lpPassword: LPCWSTR, + fUnjoinOptions: DWORD, + ) -> NET_API_STATUS; + pub fn NetRenameMachineInDomain( + lpServer: LPCWSTR, + lpNewMachineName: LPCWSTR, + lpAccount: LPCWSTR, + lpPassword: LPCWSTR, + fRenameOptions: DWORD, + ) -> NET_API_STATUS; + pub fn NetValidateName( + lpServer: LPCWSTR, + lpName: LPCWSTR, + lpAccount: LPCWSTR, + lpPassword: LPCWSTR, + NameType: NETSETUP_NAME_TYPE, + ) -> NET_API_STATUS; + pub fn NetGetJoinableOUs( + lpServer: LPCWSTR, + lpDomain: LPCWSTR, + lpAccount: LPCWSTR, + lpPassword: LPCWSTR, + OUCount: *mut DWORD, + OUs: *mut *mut LPWSTR, + ) -> NET_API_STATUS; +} +pub const NET_IGNORE_UNSUPPORTED_FLAGS: DWORD = 0x01; +extern "system" { + pub fn NetAddAlternateComputerName( + Server: LPCWSTR, + AlternateName: LPCWSTR, + DomainAccount: LPCWSTR, + DomainAccountPassword: LPCWSTR, + Reserved: ULONG, + ) -> NET_API_STATUS; + pub fn NetRemoveAlternateComputerName( + Server: LPCWSTR, + AlternateName: LPCWSTR, + DomainAccount: LPCWSTR, + DomainAccountPassword: LPCWSTR, + Reserved: ULONG, + ) -> NET_API_STATUS; + pub fn NetSetPrimaryComputerName( + Server: LPCWSTR, + PrimaryName: LPCWSTR, + DomainAccount: LPCWSTR, + DomainAccountPassword: LPCWSTR, + Reserved: ULONG, + ) -> NET_API_STATUS; +} +ENUM!{enum NET_COMPUTER_NAME_TYPE { + NetPrimaryComputerName, + NetAlternateComputerNames, + NetAllComputerNames, + NetComputerNameTypeMax, +}} +pub type PNET_COMPUTER_NAME_TYPE = *mut NET_COMPUTER_NAME_TYPE; +extern "system" { + pub fn NetEnumerateComputerNames( + Server: LPCWSTR, + NameType: NET_COMPUTER_NAME_TYPE, + Reserved: ULONG, + EntryCount: PDWORD, + ComputerNames: *mut *mut LPWSTR, + ) -> NET_API_STATUS; +} +pub const NETSETUP_PROVISION_DOWNLEVEL_PRIV_SUPPORT: DWORD = 0x00000001; +pub const NETSETUP_PROVISION_REUSE_ACCOUNT: DWORD = 0x00000002; +pub const NETSETUP_PROVISION_USE_DEFAULT_PASSWORD: DWORD = 0x00000004; +pub const NETSETUP_PROVISION_SKIP_ACCOUNT_SEARCH: DWORD = 0x00000008; +pub const NETSETUP_PROVISION_ROOT_CA_CERTS: DWORD = 0x00000010; +pub const NETSETUP_PROVISION_PERSISTENTSITE: DWORD = 0x00000020; +pub const NETSETUP_PROVISION_ONLINE_CALLER: DWORD = 0x40000000; +pub const NETSETUP_PROVISION_CHECK_PWD_ONLY: DWORD = 0x80000000; +extern "system" { + pub fn NetProvisionComputerAccount( + lpDomain: LPCWSTR, + lpMachineName: LPCWSTR, + lpMachineAccountOU: LPCWSTR, + lpDcName: LPCWSTR, + dwOptions: DWORD, + pProvisionBinData: *mut PBYTE, + pdwProvisionBinDataSize: *mut DWORD, + pProvisionTextData: *mut LPWSTR, + ) -> NET_API_STATUS; + pub fn NetRequestOfflineDomainJoin( + pProvisionBinData: *mut BYTE, + cbProvisionBinDataSize: DWORD, + dwOptions: DWORD, + lpWindowsPath: LPCWSTR, + ) -> NET_API_STATUS; +} +pub const NETSETUP_PROVISIONING_PARAMS_WIN8_VERSION: DWORD = 0x00000001; +pub const NETSETUP_PROVISIONING_PARAMS_CURRENT_VERSION: DWORD = 0x00000002; +STRUCT!{struct NETSETUP_PROVISIONING_PARAMS { + dwVersion: DWORD, + lpDomain: LPCWSTR, + lpHostName: LPCWSTR, + lpMachineAccountOU: LPCWSTR, + lpDcName: LPCWSTR, + dwProvisionOptions: DWORD, + aCertTemplateNames: *mut LPCWSTR, + cCertTemplateNames: DWORD, + aMachinePolicyNames: *mut LPCWSTR, + cMachinePolicyNames: DWORD, + aMachinePolicyPaths: *mut LPCWSTR, + cMachinePolicyPaths: DWORD, + lpNetbiosName: LPWSTR, + lpSiteName: LPWSTR, + lpPrimaryDNSDomain: LPWSTR, +}} +pub type PNETSETUP_PROVISIONING_PARAMS = *mut NETSETUP_PROVISIONING_PARAMS; +extern "system" { + pub fn NetCreateProvisioningPackage( + pProvisioningParams: PNETSETUP_PROVISIONING_PARAMS, + ppPackageBinData: *mut PBYTE, + pdwPackageBinDataSize: *mut DWORD, + ppPackageTextData: *mut LPWSTR, + ) -> NET_API_STATUS; + pub fn NetRequestProvisioningPackageInstall( + pPackageBinData: *mut BYTE, + dwPackageBinDataSize: DWORD, + dwProvisionOptions: DWORD, + lpWindowsPath: LPCWSTR, + pvReserved: PVOID, + ) -> NET_API_STATUS; + pub fn NetGetAadJoinInformation( + pcszTenantId: LPCWSTR, + ppJoinInfo: *mut PDSREG_JOIN_INFO, + ) -> HRESULT; + pub fn NetFreeAadJoinInformation( + pJoinInfo: PDSREG_JOIN_INFO, + ); +} +ENUM!{enum NETSETUP_JOIN_STATUS { + NetSetupUnknownStatus = 0, + NetSetupUnjoined, + NetSetupWorkgroupName, + NetSetupDomainName, +}} +pub type PNETSETUP_JOIN_STATUS = *mut NETSETUP_JOIN_STATUS; +extern "system" { + pub fn NetGetJoinInformation( + lpServer: LPCWSTR, + lpNameBuffer: *mut LPWSTR, + BufferType: PNETSETUP_JOIN_STATUS, + ) -> NET_API_STATUS; +} diff --git a/src/vendor/winapi/src/um/lmmsg.rs b/src/vendor/winapi/src/um/lmmsg.rs new file mode 100644 index 0000000000..0d4b5ba29e --- /dev/null +++ b/src/vendor/winapi/src/um/lmmsg.rs @@ -0,0 +1,57 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains structures, function prototypes, and definitions for the NetMessage API +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD}; +use um::winnt::{LPCWSTR, LPWSTR}; +extern "system" { + pub fn NetMessageNameAdd( + servername: LPCWSTR, + msgname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetMessageNameEnum( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetMessageNameGetInfo( + servername: LPCWSTR, + msgname: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetMessageNameDel( + servername: LPCWSTR, + msgname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetMessageBufferSend( + servername: LPCWSTR, + msgname: LPCWSTR, + fromname: LPCWSTR, + buf: LPBYTE, + buflen: DWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct MSG_INFO_0 { + msgi0_name: LPWSTR, +}} +pub type PMSG_INFO_0 = *mut MSG_INFO_0; +pub type LPMSG_INFO_0 = *mut MSG_INFO_0; +STRUCT!{struct MSG_INFO_1 { + msgi1_name: LPWSTR, + msgi1_forward_flag: DWORD, + msgi1_forward: LPWSTR, +}} +pub type PMSG_INFO_1 = *mut MSG_INFO_1; +pub type LPMSG_INFO_1 = *mut MSG_INFO_1; +pub const MSGNAME_NOT_FORWARDED: DWORD = 0; +pub const MSGNAME_FORWARDED_TO: DWORD = 0x04; +pub const MSGNAME_FORWARDED_FROM: DWORD = 0x10; diff --git a/src/vendor/winapi/src/um/lmremutl.rs b/src/vendor/winapi/src/um/lmremutl.rs new file mode 100644 index 0000000000..3ce42c50e3 --- /dev/null +++ b/src/vendor/winapi/src/um/lmremutl.rs @@ -0,0 +1,62 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains structures, function prototypes, and definitions for the NetRemote API +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD}; +use um::winnt::{CHAR, LONG, LPCWSTR, LPSTR}; +pub type DESC_CHAR = CHAR; +pub type LPDESC = LPSTR; +extern "system" { + pub fn NetRemoteTOD( + UncServerName: LPCWSTR, + BufferPtr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetRemoteComputerSupports( + UncServerName: LPCWSTR, + OptionsWanted: DWORD, + OptionsSupported: LPDWORD, + ) -> NET_API_STATUS; +} +extern "C" { + pub fn RxRemoteApi( + ApiNumber: DWORD, + UncServerName: LPCWSTR, + ParmDescString: LPDESC, + DataDesc16: LPDESC, + DataDesc32: LPDESC, + DataDescSmb: LPDESC, + AuxDesc16: LPDESC, + AuxDesc32: LPDESC, + AuxDescSmb: LPDESC, + Flags: DWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct TIME_OF_DAY_INFO { + tod_elapsedt: DWORD, + tod_msecs: DWORD, + tod_hours: DWORD, + tod_mins: DWORD, + tod_secs: DWORD, + tod_hunds: DWORD, + tod_timezone: LONG, + tod_tinterval: DWORD, + tod_day: DWORD, + tod_month: DWORD, + tod_year: DWORD, + tod_weekday: DWORD, +}} +pub type PTIME_OF_DAY_INFO = *mut TIME_OF_DAY_INFO; +pub type LPTIME_OF_DAY_INFO = *mut TIME_OF_DAY_INFO; +pub const SUPPORTS_REMOTE_ADMIN_PROTOCOL: DWORD = 0x00000002; +pub const SUPPORTS_RPC: DWORD = 0x00000004; +pub const SUPPORTS_SAM_PROTOCOL: DWORD = 0x00000008; +pub const SUPPORTS_UNICODE: DWORD = 0x00000010; +pub const SUPPORTS_LOCAL: DWORD = 0x00000020; +pub const SUPPORTS_ANY: DWORD = 0xFFFFFFFF; +pub const NO_PERMISSION_REQUIRED: DWORD = 0x00000001; +pub const ALLOCATE_RESPONSE: DWORD = 0x00000002; +pub const USE_SPECIFIC_TRANSPORT: DWORD = 0x80000000; diff --git a/src/vendor/winapi/src/um/lmrepl.rs b/src/vendor/winapi/src/um/lmrepl.rs new file mode 100644 index 0000000000..b837954782 --- /dev/null +++ b/src/vendor/winapi/src/um/lmrepl.rs @@ -0,0 +1,201 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains structures, function prototypes, and definitions for the replicator APIs +use shared::lmcons::{NET_API_STATUS, PARMNUM_BASE_INFOLEVEL}; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD}; +use um::winnt::{LPCWSTR, LPWSTR}; +pub const REPL_ROLE_EXPORT: DWORD = 1; +pub const REPL_ROLE_IMPORT: DWORD = 2; +pub const REPL_ROLE_BOTH: DWORD = 3; +pub const REPL_INTERVAL_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 0; +pub const REPL_PULSE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 1; +pub const REPL_GUARDTIME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 2; +pub const REPL_RANDOM_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 3; +STRUCT!{struct REPL_INFO_0 { + rp0_role: DWORD, + rp0_exportpath: LPWSTR, + rp0_exportlist: LPWSTR, + rp0_importpath: LPWSTR, + rp0_importlist: LPWSTR, + rp0_logonusername: LPWSTR, + rp0_interval: DWORD, + rp0_pulse: DWORD, + rp0_guardtime: DWORD, + rp0_random: DWORD, +}} +pub type PREPL_INFO_0 = *mut REPL_INFO_0; +pub type LPREPL_INFO_0 = *mut REPL_INFO_0; +STRUCT!{struct REPL_INFO_1000 { + rp1000_interval: DWORD, +}} +pub type PREPL_INFO_1000 = *mut REPL_INFO_1000; +pub type LPREPL_INFO_1000 = *mut REPL_INFO_1000; +STRUCT!{struct REPL_INFO_1001 { + rp1001_pulse: DWORD, +}} +pub type PREPL_INFO_1001 = *mut REPL_INFO_1001; +pub type LPREPL_INFO_1001 = *mut REPL_INFO_1001; +STRUCT!{struct REPL_INFO_1002 { + rp1002_guardtime: DWORD, +}} +pub type PREPL_INFO_1002 = *mut REPL_INFO_1002; +pub type LPREPL_INFO_1002 = *mut REPL_INFO_1002; +STRUCT!{struct REPL_INFO_1003 { + rp1003_random: DWORD, +}} +pub type PREPL_INFO_1003 = *mut REPL_INFO_1003; +pub type LPREPL_INFO_1003 = *mut REPL_INFO_1003; +extern "system" { + pub fn NetReplGetInfo( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetReplSetInfo( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; +} +pub const REPL_INTEGRITY_FILE: DWORD = 1; +pub const REPL_INTEGRITY_TREE: DWORD = 2; +pub const REPL_EXTENT_FILE: DWORD = 1; +pub const REPL_EXTENT_TREE: DWORD = 2; +pub const REPL_EXPORT_INTEGRITY_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 0; +pub const REPL_EXPORT_EXTENT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + 1; +STRUCT!{struct REPL_EDIR_INFO_0 { + rped0_dirname: LPWSTR, +}} +pub type PREPL_EDIR_INFO_0 = *mut REPL_EDIR_INFO_0; +pub type LPREPL_EDIR_INFO_0 = *mut REPL_EDIR_INFO_0; +STRUCT!{struct REPL_EDIR_INFO_1 { + rped1_dirname: LPWSTR, + rped1_integrity: DWORD, + rped1_extent: DWORD, +}} +pub type PREPL_EDIR_INFO_1 = *mut REPL_EDIR_INFO_1; +pub type LPREPL_EDIR_INFO_1 = *mut REPL_EDIR_INFO_1; +STRUCT!{struct REPL_EDIR_INFO_2 { + rped2_dirname: LPWSTR, + rped2_integrity: DWORD, + rped2_extent: DWORD, + rped2_lockcount: DWORD, + rped2_locktime: DWORD, +}} +pub type PREPL_EDIR_INFO_2 = *mut REPL_EDIR_INFO_2; +pub type LPREPL_EDIR_INFO_2 = *mut REPL_EDIR_INFO_2; +STRUCT!{struct REPL_EDIR_INFO_1000 { + rped1000_integrity: DWORD, +}} +pub type PREPL_EDIR_INFO_1000 = *mut REPL_EDIR_INFO_1000; +pub type LPREPL_EDIR_INFO_1000 = *mut REPL_EDIR_INFO_1000; +STRUCT!{struct REPL_EDIR_INFO_1001 { + rped1001_extent: DWORD, +}} +pub type PREPL_EDIR_INFO_1001 = *mut REPL_EDIR_INFO_1001; +pub type LPREPL_EDIR_INFO_1001 = *mut REPL_EDIR_INFO_1001; +extern "system" { + pub fn NetReplExportDirAdd( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetReplExportDirDel( + servername: LPCWSTR, + dirname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetReplExportDirEnum( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetReplExportDirGetInfo( + servername: LPCWSTR, + dirname: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetReplExportDirSetInfo( + servername: LPCWSTR, + dirname: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetReplExportDirLock( + servername: LPCWSTR, + dirname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetReplExportDirUnlock( + servername: LPCWSTR, + dirname: LPCWSTR, + unlockforce: DWORD, + ) -> NET_API_STATUS; +} +pub const REPL_UNLOCK_NOFORCE: DWORD = 0; +pub const REPL_UNLOCK_FORCE: DWORD = 1; +STRUCT!{struct REPL_IDIR_INFO_0 { + rpid0_dirname: LPWSTR, +}} +pub type PREPL_IDIR_INFO_0 = *mut REPL_IDIR_INFO_0; +pub type LPREPL_IDIR_INFO_0 = *mut REPL_IDIR_INFO_0; +STRUCT!{struct REPL_IDIR_INFO_1 { + rpid1_dirname: LPWSTR, + rpid1_state: DWORD, + rpid1_mastername: LPWSTR, + rpid1_last_update_time: DWORD, + rpid1_lockcount: DWORD, + rpid1_locktime: DWORD, +}} +pub type PREPL_IDIR_INFO_1 = *mut REPL_IDIR_INFO_1; +pub type LPREPL_IDIR_INFO_1 = *mut REPL_IDIR_INFO_1; +extern "system" { + pub fn NetReplImportDirAdd( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetReplImportDirDel( + servername: LPCWSTR, + dirname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetReplImportDirEnum( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetReplImportDirGetInfo( + servername: LPCWSTR, + dirname: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetReplImportDirLock( + servername: LPCWSTR, + dirname: LPCWSTR, + ) -> NET_API_STATUS; + pub fn NetReplImportDirUnlock( + servername: LPCWSTR, + dirname: LPCWSTR, + unlockforce: DWORD, + ) -> NET_API_STATUS; +} +pub const REPL_STATE_OK: DWORD = 0; +pub const REPL_STATE_NO_MASTER: DWORD = 1; +pub const REPL_STATE_NO_SYNC: DWORD = 2; +pub const REPL_STATE_NEVER_REPLICATED: DWORD = 3; diff --git a/src/vendor/winapi/src/um/lmserver.rs b/src/vendor/winapi/src/um/lmserver.rs new file mode 100644 index 0000000000..936d964253 --- /dev/null +++ b/src/vendor/winapi/src/um/lmserver.rs @@ -0,0 +1,1256 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This file contains information about NetServer APIs +use shared::guiddef::GUID; +use shared::lmcons::{LMCSTR, LMSTR, NET_API_STATUS, PARMNUM_BASE_INFOLEVEL, PATHLEN}; +use shared::minwindef::{BOOL, BYTE, DWORD, LPBYTE, LPDWORD, ULONG}; +use um::winnt::{BOOLEAN, LONG}; +use um::winsvc::SERVICE_STATUS_HANDLE; +extern "system" { + pub fn NetServerEnum( + servername: LMCSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + servertype: DWORD, + domain: LMCSTR, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetServerEnumEx( + servername: LMCSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + servertype: DWORD, + domain: LMCSTR, + FirstNameToReturn: LMCSTR, + ) -> NET_API_STATUS; + pub fn NetServerGetInfo( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServerSetInfo( + servername: LMSTR, + level: DWORD, + buf: LPBYTE, + ParmError: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetServerDiskEnum( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetServerComputerNameAdd( + ServerName: LMSTR, + EmulatedDomainName: LMSTR, + EmulatedServerName: LMSTR, + ) -> NET_API_STATUS; + pub fn NetServerComputerNameDel( + ServerName: LMSTR, + EmulatedServerName: LMSTR, + ) -> NET_API_STATUS; + pub fn NetServerTransportAdd( + servername: LMSTR, + level: DWORD, + bufptr: LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServerTransportAddEx( + servername: LMSTR, + level: DWORD, + bufptr: LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServerTransportDel( + servername: LMSTR, + level: DWORD, + bufptr: LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServerTransportEnum( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn SetServiceBits( + hServiceStatus: SERVICE_STATUS_HANDLE, + dwServiceBits: DWORD, + bSetBitsOn: BOOL, + bUpdateImmediately: BOOL, + ) -> BOOL; +} +STRUCT!{struct SERVER_INFO_100 { + sv100_platform_id: DWORD, + sv100_name: LMSTR, +}} +pub type PSERVER_INFO_100 = *mut SERVER_INFO_100; +pub type LPSERVER_INFO_100 = *mut SERVER_INFO_100; +STRUCT!{struct SERVER_INFO_101 { + sv101_platform_id: DWORD, + sv101_name: LMSTR, + sv101_version_major: DWORD, + sv101_version_minor: DWORD, + sv101_type: DWORD, + sv101_comment: LMSTR, +}} +pub type PSERVER_INFO_101 = *mut SERVER_INFO_101; +pub type LPSERVER_INFO_101 = *mut SERVER_INFO_101; +STRUCT!{struct SERVER_INFO_102 { + sv102_platform_id: DWORD, + sv102_name: LMSTR, + sv102_version_major: DWORD, + sv102_version_minor: DWORD, + sv102_type: DWORD, + sv102_comment: LMSTR, + sv102_users: DWORD, + sv102_disc: LONG, + sv102_hidden: BOOL, + sv102_announce: DWORD, + sv102_anndelta: DWORD, + sv102_licenses: DWORD, + sv102_userpath: LMSTR, +}} +pub type PSERVER_INFO_102 = *mut SERVER_INFO_102; +pub type LPSERVER_INFO_102 = *mut SERVER_INFO_102; +STRUCT!{struct SERVER_INFO_103 { + sv103_platform_id: DWORD, + sv103_name: LMSTR, + sv103_version_major: DWORD, + sv103_version_minor: DWORD, + sv103_type: DWORD, + sv103_comment: LMSTR, + sv103_users: DWORD, + sv103_disc: LONG, + sv103_hidden: BOOL, + sv103_announce: DWORD, + sv103_anndelta: DWORD, + sv103_licenses: DWORD, + sv103_userpath: LMSTR, + sv103_capabilities: DWORD, +}} +pub type PSERVER_INFO_103 = *mut SERVER_INFO_103; +pub type LPSERVER_INFO_103 = *mut SERVER_INFO_103; +STRUCT!{struct SERVER_INFO_402 { + sv402_ulist_mtime: DWORD, + sv402_glist_mtime: DWORD, + sv402_alist_mtime: DWORD, + sv402_alerts: LMSTR, + sv402_security: DWORD, + sv402_numadmin: DWORD, + sv402_lanmask: DWORD, + sv402_guestacct: LMSTR, + sv402_chdevs: DWORD, + sv402_chdevq: DWORD, + sv402_chdevjobs: DWORD, + sv402_connections: DWORD, + sv402_shares: DWORD, + sv402_openfiles: DWORD, + sv402_sessopens: DWORD, + sv402_sessvcs: DWORD, + sv402_sessreqs: DWORD, + sv402_opensearch: DWORD, + sv402_activelocks: DWORD, + sv402_numreqbuf: DWORD, + sv402_sizreqbuf: DWORD, + sv402_numbigbuf: DWORD, + sv402_numfiletasks: DWORD, + sv402_alertsched: DWORD, + sv402_erroralert: DWORD, + sv402_logonalert: DWORD, + sv402_accessalert: DWORD, + sv402_diskalert: DWORD, + sv402_netioalert: DWORD, + sv402_maxauditsz: DWORD, + sv402_srvheuristics: LMSTR, +}} +pub type PSERVER_INFO_402 = *mut SERVER_INFO_402; +pub type LPSERVER_INFO_402 = *mut SERVER_INFO_402; +STRUCT!{struct SERVER_INFO_403 { + sv403_ulist_mtime: DWORD, + sv403_glist_mtime: DWORD, + sv403_alist_mtime: DWORD, + sv403_alerts: LMSTR, + sv403_security: DWORD, + sv403_numadmin: DWORD, + sv403_lanmask: DWORD, + sv403_guestacct: LMSTR, + sv403_chdevs: DWORD, + sv403_chdevq: DWORD, + sv403_chdevjobs: DWORD, + sv403_connections: DWORD, + sv403_shares: DWORD, + sv403_openfiles: DWORD, + sv403_sessopens: DWORD, + sv403_sessvcs: DWORD, + sv403_sessreqs: DWORD, + sv403_opensearch: DWORD, + sv403_activelocks: DWORD, + sv403_numreqbuf: DWORD, + sv403_sizreqbuf: DWORD, + sv403_numbigbuf: DWORD, + sv403_numfiletasks: DWORD, + sv403_alertsched: DWORD, + sv403_erroralert: DWORD, + sv403_logonalert: DWORD, + sv403_accessalert: DWORD, + sv403_diskalert: DWORD, + sv403_netioalert: DWORD, + sv403_maxauditsz: DWORD, + sv403_srvheuristics: LMSTR, + sv403_auditedevents: DWORD, + sv403_autoprofile: DWORD, + sv403_autopath: LMSTR, +}} +pub type PSERVER_INFO_403 = *mut SERVER_INFO_403; +pub type LPSERVER_INFO_403 = *mut SERVER_INFO_403; +STRUCT!{struct SERVER_INFO_502 { + sv502_sessopens: DWORD, + sv502_sessvcs: DWORD, + sv502_opensearch: DWORD, + sv502_sizreqbuf: DWORD, + sv502_initworkitems: DWORD, + sv502_maxworkitems: DWORD, + sv502_rawworkitems: DWORD, + sv502_irpstacksize: DWORD, + sv502_maxrawbuflen: DWORD, + sv502_sessusers: DWORD, + sv502_sessconns: DWORD, + sv502_maxpagedmemoryusage: DWORD, + sv502_maxnonpagedmemoryusage: DWORD, + sv502_enablesoftcompat: BOOL, + sv502_enableforcedlogoff: BOOL, + sv502_timesource: BOOL, + sv502_acceptdownlevelapis: BOOL, + sv502_lmannounce: BOOL, +}} +pub type PSERVER_INFO_502 = *mut SERVER_INFO_502; +pub type LPSERVER_INFO_502 = *mut SERVER_INFO_502; +STRUCT!{struct SERVER_INFO_503 { + sv503_sessopens : DWORD, + sv503_sessvcs: DWORD, + sv503_opensearch: DWORD, + sv503_sizreqbuf: DWORD, + sv503_initworkitems: DWORD, + sv503_maxworkitems: DWORD, + sv503_rawworkitems: DWORD, + sv503_irpstacksize: DWORD, + sv503_maxrawbuflen: DWORD, + sv503_sessusers: DWORD, + sv503_sessconns: DWORD, + sv503_maxpagedmemoryusage: DWORD, + sv503_maxnonpagedmemoryusage: DWORD, + sv503_enablesoftcompat: BOOL, + sv503_enableforcedlogoff: BOOL, + sv503_timesource: BOOL, + sv503_acceptdownlevelapis: BOOL, + sv503_lmannounce: BOOL, + sv503_domain: LMSTR, + sv503_maxcopyreadlen: DWORD, + sv503_maxcopywritelen: DWORD, + sv503_minkeepsearch: DWORD, + sv503_maxkeepsearch: DWORD, + sv503_minkeepcomplsearch: DWORD, + sv503_maxkeepcomplsearch: DWORD, + sv503_threadcountadd: DWORD, + sv503_numblockthreads: DWORD, + sv503_scavtimeout: DWORD, + sv503_minrcvqueue: DWORD, + sv503_minfreeworkitems: DWORD, + sv503_xactmemsize: DWORD, + sv503_threadpriority: DWORD, + sv503_maxmpxct: DWORD, + sv503_oplockbreakwait: DWORD, + sv503_oplockbreakresponsewait: DWORD, + sv503_enableoplocks: BOOL, + sv503_enableoplockforceclose: BOOL, + sv503_enablefcbopens: BOOL, + sv503_enableraw: BOOL, + sv503_enablesharednetdrives: BOOL, + sv503_minfreeconnections: DWORD, + sv503_maxfreeconnections: DWORD, +}} +pub type PSERVER_INFO_503 = *mut SERVER_INFO_503; +pub type LPSERVER_INFO_503 = *mut SERVER_INFO_503; +STRUCT!{struct SERVER_INFO_599 { + sv599_sessopens: DWORD, + sv599_sessvcs: DWORD, + sv599_opensearch: DWORD, + sv599_sizreqbuf: DWORD, + sv599_initworkitems: DWORD, + sv599_maxworkitems: DWORD, + sv599_rawworkitems: DWORD, + sv599_irpstacksize: DWORD, + sv599_maxrawbuflen: DWORD, + sv599_sessusers: DWORD, + sv599_sessconns: DWORD, + sv599_maxpagedmemoryusage: DWORD, + sv599_maxnonpagedmemoryusage: DWORD, + sv599_enablesoftcompat: BOOL, + sv599_enableforcedlogoff: BOOL, + sv599_timesource: BOOL, + sv599_acceptdownlevelapis: BOOL, + sv599_lmannounce: BOOL, + sv599_domain: LMSTR, + sv599_maxcopyreadlen: DWORD, + sv599_maxcopywritelen: DWORD, + sv599_minkeepsearch: DWORD, + sv599_maxkeepsearch: DWORD, + sv599_minkeepcomplsearch: DWORD, + sv599_maxkeepcomplsearch: DWORD, + sv599_threadcountadd: DWORD, + sv599_numblockthreads: DWORD, + sv599_scavtimeout: DWORD, + sv599_minrcvqueue: DWORD, + sv599_minfreeworkitems: DWORD, + sv599_xactmemsize: DWORD, + sv599_threadpriority: DWORD, + sv599_maxmpxct: DWORD, + sv599_oplockbreakwait: DWORD, + sv599_oplockbreakresponsewait: DWORD, + sv599_enableoplocks: BOOL, + sv599_enableoplockforceclose: BOOL, + sv599_enablefcbopens: BOOL, + sv599_enableraw: BOOL, + sv599_enablesharednetdrives: BOOL, + sv599_minfreeconnections: DWORD, + sv599_maxfreeconnections: DWORD, + sv599_initsesstable: DWORD, + sv599_initconntable: DWORD, + sv599_initfiletable: DWORD, + sv599_initsearchtable: DWORD, + sv599_alertschedule: DWORD, + sv599_errorthreshold: DWORD, + sv599_networkerrorthreshold: DWORD, + sv599_diskspacethreshold: DWORD, + sv599_reserved: DWORD, + sv599_maxlinkdelay: DWORD, + sv599_minlinkthroughput: DWORD, + sv599_linkinfovalidtime: DWORD, + sv599_scavqosinfoupdatetime: DWORD, + sv599_maxworkitemidletime: DWORD, +}} +pub type PSERVER_INFO_599 = *mut SERVER_INFO_599; +pub type LPSERVER_INFO_599 = *mut SERVER_INFO_599; +STRUCT!{struct SERVER_INFO_598 { + sv598_maxrawworkitems: DWORD, + sv598_maxthreadsperqueue: DWORD, + sv598_producttype: DWORD, + sv598_serversize: DWORD, + sv598_connectionlessautodisc: DWORD, + sv598_sharingviolationretries: DWORD, + sv598_sharingviolationdelay: DWORD, + sv598_maxglobalopensearch: DWORD, + sv598_removeduplicatesearches: DWORD, + sv598_lockviolationoffset: DWORD, + sv598_lockviolationdelay: DWORD, + sv598_mdlreadswitchover: DWORD, + sv598_cachedopenlimit: DWORD, + sv598_otherqueueaffinity: DWORD, + sv598_restrictnullsessaccess: BOOL, + sv598_enablewfw311directipx: BOOL, + sv598_queuesamplesecs: DWORD, + sv598_balancecount: DWORD, + sv598_preferredaffinity: DWORD, + sv598_maxfreerfcbs: DWORD, + sv598_maxfreemfcbs: DWORD, + sv598_maxfreelfcbs: DWORD, + sv598_maxfreepagedpoolchunks: DWORD, + sv598_minpagedpoolchunksize: DWORD, + sv598_maxpagedpoolchunksize: DWORD, + sv598_sendsfrompreferredprocessor: BOOL, + sv598_cacheddirectorylimit: DWORD, + sv598_maxcopylength: DWORD, + sv598_enablecompression: BOOL, + sv598_autosharewks: BOOL, + sv598_autoshareserver: BOOL, + sv598_enablesecuritysignature: BOOL, + sv598_requiresecuritysignature: BOOL, + sv598_minclientbuffersize: DWORD, + sv598_serverguid: GUID, + sv598_ConnectionNoSessionsTimeout: DWORD, + sv598_IdleThreadTimeOut: DWORD, + sv598_enableW9xsecuritysignature: BOOL, + sv598_enforcekerberosreauthentication: BOOL, + sv598_disabledos: BOOL, + sv598_lowdiskspaceminimum: DWORD, + sv598_disablestrictnamechecking: BOOL, + sv598_enableauthenticateusersharing: BOOL, +}} +pub type PSERVER_INFO_598 = *mut SERVER_INFO_598; +pub type LPSERVER_INFO_598 = *mut SERVER_INFO_598; +STRUCT!{struct SERVER_INFO_1005 { + sv1005_comment: LMSTR, +}} +pub type PSERVER_INFO_1005 = *mut SERVER_INFO_1005; +pub type LPSERVER_INFO_1005 = *mut SERVER_INFO_1005; +STRUCT!{struct SERVER_INFO_1107 { + sv1107_users: DWORD, +}} +pub type PSERVER_INFO_1107 = *mut SERVER_INFO_1107; +pub type LPSERVER_INFO_1107 = *mut SERVER_INFO_1107; +STRUCT!{struct SERVER_INFO_1010 { + sv1010_disc: LONG, +}} +pub type PSERVER_INFO_1010 = *mut SERVER_INFO_1010; +pub type LPSERVER_INFO_1010 = *mut SERVER_INFO_1010; +STRUCT!{struct SERVER_INFO_1016 { + sv1016_hidden: BOOL, +}} +pub type PSERVER_INFO_1016 = *mut SERVER_INFO_1016; +pub type LPSERVER_INFO_1016 = *mut SERVER_INFO_1016; +STRUCT!{struct SERVER_INFO_1017 { + sv1017_announce: DWORD, +}} +pub type PSERVER_INFO_1017 = *mut SERVER_INFO_1017; +pub type LPSERVER_INFO_1017 = *mut SERVER_INFO_1017; +STRUCT!{struct SERVER_INFO_1018 { + sv1018_anndelta: DWORD, +}} +pub type PSERVER_INFO_1018 = *mut SERVER_INFO_1018; +pub type LPSERVER_INFO_1018 = *mut SERVER_INFO_1018; +STRUCT!{struct SERVER_INFO_1501 { + sv1501_sessopens: DWORD, +}} +pub type PSERVER_INFO_1501 = *mut SERVER_INFO_1501; +pub type LPSERVER_INFO_1501 = *mut SERVER_INFO_1501; +STRUCT!{struct SERVER_INFO_1502 { + sv1502_sessvcs: DWORD, +}} +pub type PSERVER_INFO_1502 = *mut SERVER_INFO_1502; +pub type LPSERVER_INFO_1502 = *mut SERVER_INFO_1502; +STRUCT!{struct SERVER_INFO_1503 { + sv1503_opensearch: DWORD, +}} +pub type PSERVER_INFO_1503 = *mut SERVER_INFO_1503; +pub type LPSERVER_INFO_1503 = *mut SERVER_INFO_1503; +STRUCT!{struct SERVER_INFO_1506 { + sv1506_maxworkitems: DWORD, +}} +pub type PSERVER_INFO_1506 = *mut SERVER_INFO_1506; +pub type LPSERVER_INFO_1506 = *mut SERVER_INFO_1506; +STRUCT!{struct SERVER_INFO_1509 { + sv1509_maxrawbuflen: DWORD, +}} +pub type PSERVER_INFO_1509 = *mut SERVER_INFO_1509; +pub type LPSERVER_INFO_1509 = *mut SERVER_INFO_1509; +STRUCT!{struct SERVER_INFO_1510 { + sv1510_sessusers: DWORD, +}} +pub type PSERVER_INFO_1510 = *mut SERVER_INFO_1510; +pub type LPSERVER_INFO_1510 = *mut SERVER_INFO_1510; +STRUCT!{struct SERVER_INFO_1511 { + sv1511_sessconns: DWORD, +}} +pub type PSERVER_INFO_1511 = *mut SERVER_INFO_1511; +pub type LPSERVER_INFO_1511 = *mut SERVER_INFO_1511; +STRUCT!{struct SERVER_INFO_1512 { + sv1512_maxnonpagedmemoryusage: DWORD, +}} +pub type PSERVER_INFO_1512 = *mut SERVER_INFO_1512; +pub type LPSERVER_INFO_1512 = *mut SERVER_INFO_1512; +STRUCT!{struct SERVER_INFO_1513 { + sv1513_maxpagedmemoryusage: DWORD, +}} +pub type PSERVER_INFO_1513 = *mut SERVER_INFO_1513; +pub type LPSERVER_INFO_1513 = *mut SERVER_INFO_1513; +STRUCT!{struct SERVER_INFO_1514 { + sv1514_enablesoftcompat: BOOL, +}} +pub type PSERVER_INFO_1514 = *mut SERVER_INFO_1514; +pub type LPSERVER_INFO_1514 = *mut SERVER_INFO_1514; +STRUCT!{struct SERVER_INFO_1515 { + sv1515_enableforcedlogoff: BOOL, +}} +pub type PSERVER_INFO_1515 = *mut SERVER_INFO_1515; +pub type LPSERVER_INFO_1515 = *mut SERVER_INFO_1515; +STRUCT!{struct SERVER_INFO_1516 { + sv1516_timesource: BOOL, +}} +pub type PSERVER_INFO_1516 = *mut SERVER_INFO_1516; +pub type LPSERVER_INFO_1516 = *mut SERVER_INFO_1516; +STRUCT!{struct SERVER_INFO_1518 { + sv1518_lmannounce: BOOL, +}} +pub type PSERVER_INFO_1518 = *mut SERVER_INFO_1518; +pub type LPSERVER_INFO_1518 = *mut SERVER_INFO_1518; +STRUCT!{struct SERVER_INFO_1520 { + sv1520_maxcopyreadlen: DWORD, +}} +pub type PSERVER_INFO_1520 = *mut SERVER_INFO_1520; +pub type LPSERVER_INFO_1520 = *mut SERVER_INFO_1520; +STRUCT!{struct SERVER_INFO_1521 { + sv1521_maxcopywritelen: DWORD, +}} +pub type PSERVER_INFO_1521 = *mut SERVER_INFO_1521; +pub type LPSERVER_INFO_1521 = *mut SERVER_INFO_1521; +STRUCT!{struct SERVER_INFO_1522 { + sv1522_minkeepsearch: DWORD, +}} +pub type PSERVER_INFO_1522 = *mut SERVER_INFO_1522; +pub type LPSERVER_INFO_1522 = *mut SERVER_INFO_1522; +STRUCT!{struct SERVER_INFO_1523 { + sv1523_maxkeepsearch: DWORD, +}} +pub type PSERVER_INFO_1523 = *mut SERVER_INFO_1523; +pub type LPSERVER_INFO_1523 = *mut SERVER_INFO_1523; +STRUCT!{struct SERVER_INFO_1524 { + sv1524_minkeepcomplsearch: DWORD, +}} +pub type PSERVER_INFO_1524 = *mut SERVER_INFO_1524; +pub type LPSERVER_INFO_1524 = *mut SERVER_INFO_1524; +STRUCT!{struct SERVER_INFO_1525 { + sv1525_maxkeepcomplsearch: DWORD, +}} +pub type PSERVER_INFO_1525 = *mut SERVER_INFO_1525; +pub type LPSERVER_INFO_1525 = *mut SERVER_INFO_1525; +STRUCT!{struct SERVER_INFO_1528 { + sv1528_scavtimeout: DWORD, +}} +pub type PSERVER_INFO_1528 = *mut SERVER_INFO_1528; +pub type LPSERVER_INFO_1528 = *mut SERVER_INFO_1528; +STRUCT!{struct SERVER_INFO_1529 { + sv1529_minrcvqueue: DWORD, +}} +pub type PSERVER_INFO_1529 = *mut SERVER_INFO_1529; +pub type LPSERVER_INFO_1529 = *mut SERVER_INFO_1529; +STRUCT!{struct SERVER_INFO_1530 { + sv1530_minfreeworkitems: DWORD, +}} +pub type PSERVER_INFO_1530 = *mut SERVER_INFO_1530; +pub type LPSERVER_INFO_1530 = *mut SERVER_INFO_1530; +STRUCT!{struct SERVER_INFO_1533 { + sv1533_maxmpxct: DWORD, +}} +pub type PSERVER_INFO_1533 = *mut SERVER_INFO_1533; +pub type LPSERVER_INFO_1533 = *mut SERVER_INFO_1533; +STRUCT!{struct SERVER_INFO_1534 { + sv1534_oplockbreakwait: DWORD, +}} +pub type PSERVER_INFO_1534 = *mut SERVER_INFO_1534; +pub type LPSERVER_INFO_1534 = *mut SERVER_INFO_1534; +STRUCT!{struct SERVER_INFO_1535 { + sv1535_oplockbreakresponsewait: DWORD, +}} +pub type PSERVER_INFO_1535 = *mut SERVER_INFO_1535; +pub type LPSERVER_INFO_1535 = *mut SERVER_INFO_1535; +STRUCT!{struct SERVER_INFO_1536 { + sv1536_enableoplocks: BOOL, +}} +pub type PSERVER_INFO_1536 = *mut SERVER_INFO_1536; +pub type LPSERVER_INFO_1536 = *mut SERVER_INFO_1536; +STRUCT!{struct SERVER_INFO_1537 { + sv1537_enableoplockforceclose: BOOL, +}} +pub type PSERVER_INFO_1537 = *mut SERVER_INFO_1537; +pub type LPSERVER_INFO_1537 = *mut SERVER_INFO_1537; +STRUCT!{struct SERVER_INFO_1538 { + sv1538_enablefcbopens: BOOL, +}} +pub type PSERVER_INFO_1538 = *mut SERVER_INFO_1538; +pub type LPSERVER_INFO_1538 = *mut SERVER_INFO_1538; +STRUCT!{struct SERVER_INFO_1539 { + sv1539_enableraw: BOOL, +}} +pub type PSERVER_INFO_1539 = *mut SERVER_INFO_1539; +pub type LPSERVER_INFO_1539 = *mut SERVER_INFO_1539; +STRUCT!{struct SERVER_INFO_1540 { + sv1540_enablesharednetdrives: BOOL, +}} +pub type PSERVER_INFO_1540 = *mut SERVER_INFO_1540; +pub type LPSERVER_INFO_1540 = *mut SERVER_INFO_1540; +STRUCT!{struct SERVER_INFO_1541 { + sv1541_minfreeconnections: BOOL, +}} +pub type PSERVER_INFO_1541 = *mut SERVER_INFO_1541; +pub type LPSERVER_INFO_1541 = *mut SERVER_INFO_1541; +STRUCT!{struct SERVER_INFO_1542 { + sv1542_maxfreeconnections: BOOL, +}} +pub type PSERVER_INFO_1542 = *mut SERVER_INFO_1542; +pub type LPSERVER_INFO_1542 = *mut SERVER_INFO_1542; +STRUCT!{struct SERVER_INFO_1543 { + sv1543_initsesstable: DWORD, +}} +pub type PSERVER_INFO_1543 = *mut SERVER_INFO_1543; +pub type LPSERVER_INFO_1543 = *mut SERVER_INFO_1543; +STRUCT!{struct SERVER_INFO_1544 { + sv1544_initconntable: DWORD, +}} +pub type PSERVER_INFO_1544 = *mut SERVER_INFO_1544; +pub type LPSERVER_INFO_1544 = *mut SERVER_INFO_1544; +STRUCT!{struct SERVER_INFO_1545 { + sv1545_initfiletable: DWORD, +}} +pub type PSERVER_INFO_1545 = *mut SERVER_INFO_1545; +pub type LPSERVER_INFO_1545 = *mut SERVER_INFO_1545; +STRUCT!{struct SERVER_INFO_1546 { + sv1546_initsearchtable: DWORD, +}} +pub type PSERVER_INFO_1546 = *mut SERVER_INFO_1546; +pub type LPSERVER_INFO_1546 = *mut SERVER_INFO_1546; +STRUCT!{struct SERVER_INFO_1547 { + sv1547_alertschedule: DWORD, +}} +pub type PSERVER_INFO_1547 = *mut SERVER_INFO_1547; +pub type LPSERVER_INFO_1547 = *mut SERVER_INFO_1547; +STRUCT!{struct SERVER_INFO_1548 { + sv1548_errorthreshold: DWORD, +}} +pub type PSERVER_INFO_1548 = *mut SERVER_INFO_1548; +pub type LPSERVER_INFO_1548 = *mut SERVER_INFO_1548; +STRUCT!{struct SERVER_INFO_1549 { + sv1549_networkerrorthreshold: DWORD, +}} +pub type PSERVER_INFO_1549 = *mut SERVER_INFO_1549; +pub type LPSERVER_INFO_1549 = *mut SERVER_INFO_1549; +STRUCT!{struct SERVER_INFO_1550 { + sv1550_diskspacethreshold: DWORD, +}} +pub type PSERVER_INFO_1550 = *mut SERVER_INFO_1550; +pub type LPSERVER_INFO_1550 = *mut SERVER_INFO_1550; +STRUCT!{struct SERVER_INFO_1552 { + sv1552_maxlinkdelay: DWORD, +}} +pub type PSERVER_INFO_1552 = *mut SERVER_INFO_1552; +pub type LPSERVER_INFO_1552 = *mut SERVER_INFO_1552; +STRUCT!{struct SERVER_INFO_1553 { + sv1553_minlinkthroughput: DWORD, +}} +pub type PSERVER_INFO_1553 = *mut SERVER_INFO_1553; +pub type LPSERVER_INFO_1553 = *mut SERVER_INFO_1553; +STRUCT!{struct SERVER_INFO_1554 { + sv1554_linkinfovalidtime: DWORD, +}} +pub type PSERVER_INFO_1554 = *mut SERVER_INFO_1554; +pub type LPSERVER_INFO_1554 = *mut SERVER_INFO_1554; +STRUCT!{struct SERVER_INFO_1555 { + sv1555_scavqosinfoupdatetime: DWORD, +}} +pub type PSERVER_INFO_1555 = *mut SERVER_INFO_1555; +pub type LPSERVER_INFO_1555 = *mut SERVER_INFO_1555; +STRUCT!{struct SERVER_INFO_1556 { + sv1556_maxworkitemidletime: DWORD, +}} +pub type PSERVER_INFO_1556 = *mut SERVER_INFO_1556; +pub type LPSERVER_INFO_1556 = *mut SERVER_INFO_1556; +STRUCT!{struct SERVER_INFO_1557 { + sv1557_maxrawworkitems: DWORD, +}} +pub type PSERVER_INFO_1557 = *mut SERVER_INFO_1557; +pub type LPSERVER_INFO_1557 = *mut SERVER_INFO_1557; +STRUCT!{struct SERVER_INFO_1560 { + sv1560_producttype: DWORD, +}} +pub type PSERVER_INFO_1560 = *mut SERVER_INFO_1560; +pub type LPSERVER_INFO_1560 = *mut SERVER_INFO_1560; +STRUCT!{struct SERVER_INFO_1561 { + sv1561_serversize: DWORD, +}} +pub type PSERVER_INFO_1561 = *mut SERVER_INFO_1561; +pub type LPSERVER_INFO_1561 = *mut SERVER_INFO_1561; +STRUCT!{struct SERVER_INFO_1562 { + sv1562_connectionlessautodisc: DWORD, +}} +pub type PSERVER_INFO_1562 = *mut SERVER_INFO_1562; +pub type LPSERVER_INFO_1562 = *mut SERVER_INFO_1562; +STRUCT!{struct SERVER_INFO_1563 { + sv1563_sharingviolationretries: DWORD, +}} +pub type PSERVER_INFO_1563 = *mut SERVER_INFO_1563; +pub type LPSERVER_INFO_1563 = *mut SERVER_INFO_1563; +STRUCT!{struct SERVER_INFO_1564 { + sv1564_sharingviolationdelay: DWORD, +}} +pub type PSERVER_INFO_1564 = *mut SERVER_INFO_1564; +pub type LPSERVER_INFO_1564 = *mut SERVER_INFO_1564; +STRUCT!{struct SERVER_INFO_1565 { + sv1565_maxglobalopensearch: DWORD, +}} +pub type PSERVER_INFO_1565 = *mut SERVER_INFO_1565; +pub type LPSERVER_INFO_1565 = *mut SERVER_INFO_1565; +STRUCT!{struct SERVER_INFO_1566 { + sv1566_removeduplicatesearches: BOOL, +}} +pub type PSERVER_INFO_1566 = *mut SERVER_INFO_1566; +pub type LPSERVER_INFO_1566 = *mut SERVER_INFO_1566; +STRUCT!{struct SERVER_INFO_1567 { + sv1567_lockviolationretries: DWORD, +}} +pub type PSERVER_INFO_1567 = *mut SERVER_INFO_1567; +pub type LPSERVER_INFO_1567 = *mut SERVER_INFO_1567; +STRUCT!{struct SERVER_INFO_1568 { + sv1568_lockviolationoffset: DWORD, +}} +pub type PSERVER_INFO_1568 = *mut SERVER_INFO_1568; +pub type LPSERVER_INFO_1568 = *mut SERVER_INFO_1568; +STRUCT!{struct SERVER_INFO_1569 { + sv1569_lockviolationdelay: DWORD, +}} +pub type PSERVER_INFO_1569 = *mut SERVER_INFO_1569; +pub type LPSERVER_INFO_1569 = *mut SERVER_INFO_1569; +STRUCT!{struct SERVER_INFO_1570 { + sv1570_mdlreadswitchover: DWORD, +}} +pub type PSERVER_INFO_1570 = *mut SERVER_INFO_1570; +pub type LPSERVER_INFO_1570 = *mut SERVER_INFO_1570; +STRUCT!{struct SERVER_INFO_1571 { + sv1571_cachedopenlimit: DWORD, +}} +pub type PSERVER_INFO_1571 = *mut SERVER_INFO_1571; +pub type LPSERVER_INFO_1571 = *mut SERVER_INFO_1571; +STRUCT!{struct SERVER_INFO_1572 { + sv1572_criticalthreads: DWORD, +}} +pub type PSERVER_INFO_1572 = *mut SERVER_INFO_1572; +pub type LPSERVER_INFO_1572 = *mut SERVER_INFO_1572; +STRUCT!{struct SERVER_INFO_1573 { + sv1573_restrictnullsessaccess: DWORD, +}} +pub type PSERVER_INFO_1573 = *mut SERVER_INFO_1573; +pub type LPSERVER_INFO_1573 = *mut SERVER_INFO_1573; +STRUCT!{struct SERVER_INFO_1574 { + sv1574_enablewfw311directipx: DWORD, +}} +pub type PSERVER_INFO_1574 = *mut SERVER_INFO_1574; +pub type LPSERVER_INFO_1574 = *mut SERVER_INFO_1574; +STRUCT!{struct SERVER_INFO_1575 { + sv1575_otherqueueaffinity: DWORD, +}} +pub type PSERVER_INFO_1575 = *mut SERVER_INFO_1575; +pub type LPSERVER_INFO_1575 = *mut SERVER_INFO_1575; +STRUCT!{struct SERVER_INFO_1576 { + sv1576_queuesamplesecs: DWORD, +}} +pub type PSERVER_INFO_1576 = *mut SERVER_INFO_1576; +pub type LPSERVER_INFO_1576 = *mut SERVER_INFO_1576; +STRUCT!{struct SERVER_INFO_1577 { + sv1577_balancecount: DWORD, +}} +pub type PSERVER_INFO_1577 = *mut SERVER_INFO_1577; +pub type LPSERVER_INFO_1577 = *mut SERVER_INFO_1577; +STRUCT!{struct SERVER_INFO_1578 { + sv1578_preferredaffinity: DWORD, +}} +pub type PSERVER_INFO_1578 = *mut SERVER_INFO_1578; +pub type LPSERVER_INFO_1578 = *mut SERVER_INFO_1578; +STRUCT!{struct SERVER_INFO_1579 { + sv1579_maxfreerfcbs: DWORD, +}} +pub type PSERVER_INFO_1579 = *mut SERVER_INFO_1579; +pub type LPSERVER_INFO_1579 = *mut SERVER_INFO_1579; +STRUCT!{struct SERVER_INFO_1580 { + sv1580_maxfreemfcbs: DWORD, +}} +pub type PSERVER_INFO_1580 = *mut SERVER_INFO_1580; +pub type LPSERVER_INFO_1580 = *mut SERVER_INFO_1580; +STRUCT!{struct SERVER_INFO_1581 { + sv1581_maxfreemlcbs: DWORD, +}} +pub type PSERVER_INFO_1581 = *mut SERVER_INFO_1581; +pub type LPSERVER_INFO_1581 = *mut SERVER_INFO_1581; +STRUCT!{struct SERVER_INFO_1582 { + sv1582_maxfreepagedpoolchunks: DWORD, +}} +pub type PSERVER_INFO_1582 = *mut SERVER_INFO_1582; +pub type LPSERVER_INFO_1582 = *mut SERVER_INFO_1582; +STRUCT!{struct SERVER_INFO_1583 { + sv1583_minpagedpoolchunksize: DWORD, +}} +pub type PSERVER_INFO_1583 = *mut SERVER_INFO_1583; +pub type LPSERVER_INFO_1583 = *mut SERVER_INFO_1583; +STRUCT!{struct SERVER_INFO_1584 { + sv1584_maxpagedpoolchunksize: DWORD, +}} +pub type PSERVER_INFO_1584 = *mut SERVER_INFO_1584; +pub type LPSERVER_INFO_1584 = *mut SERVER_INFO_1584; +STRUCT!{struct SERVER_INFO_1585 { + sv1585_sendsfrompreferredprocessor: BOOL, +}} +pub type PSERVER_INFO_1585 = *mut SERVER_INFO_1585; +pub type LPSERVER_INFO_1585 = *mut SERVER_INFO_1585; +STRUCT!{struct SERVER_INFO_1586 { + sv1586_maxthreadsperqueue: DWORD, +}} +pub type PSERVER_INFO_1586 = *mut SERVER_INFO_1586; +pub type LPSERVER_INFO_1586 = *mut SERVER_INFO_1586; +STRUCT!{struct SERVER_INFO_1587 { + sv1587_cacheddirectorylimit: DWORD, +}} +pub type PSERVER_INFO_1587 = *mut SERVER_INFO_1587; +pub type LPSERVER_INFO_1587 = *mut SERVER_INFO_1587; +STRUCT!{struct SERVER_INFO_1588 { + sv1588_maxcopylength: DWORD, +}} +pub type PSERVER_INFO_1588 = *mut SERVER_INFO_1588; +pub type LPSERVER_INFO_1588 = *mut SERVER_INFO_1588; +STRUCT!{struct SERVER_INFO_1590 { + sv1590_enablecompression: DWORD, +}} +pub type PSERVER_INFO_1590 = *mut SERVER_INFO_1590; +pub type LPSERVER_INFO_1590 = *mut SERVER_INFO_1590; +STRUCT!{struct SERVER_INFO_1591 { + sv1591_autosharewks: DWORD, +}} +pub type PSERVER_INFO_1591 = *mut SERVER_INFO_1591; +pub type LPSERVER_INFO_1591 = *mut SERVER_INFO_1591; +STRUCT!{struct SERVER_INFO_1592 { + sv1592_autosharewks: DWORD, +}} +pub type PSERVER_INFO_1592 = *mut SERVER_INFO_1592; +pub type LPSERVER_INFO_1592 = *mut SERVER_INFO_1592; +STRUCT!{struct SERVER_INFO_1593 { + sv1593_enablesecuritysignature: DWORD, +}} +pub type PSERVER_INFO_1593 = *mut SERVER_INFO_1593; +pub type LPSERVER_INFO_1593 = *mut SERVER_INFO_1593; +STRUCT!{struct SERVER_INFO_1594 { + sv1594_requiresecuritysignature: DWORD, +}} +pub type PSERVER_INFO_1594 = *mut SERVER_INFO_1594; +pub type LPSERVER_INFO_1594 = *mut SERVER_INFO_1594; +STRUCT!{struct SERVER_INFO_1595 { + sv1595_minclientbuffersize: DWORD, +}} +pub type PSERVER_INFO_1595 = *mut SERVER_INFO_1595; +pub type LPSERVER_INFO_1595 = *mut SERVER_INFO_1595; +STRUCT!{struct SERVER_INFO_1596 { + sv1596_ConnectionNoSessionsTimeout: DWORD, +}} +pub type PSERVER_INFO_1596 = *mut SERVER_INFO_1596; +pub type LPSERVER_INFO_1596 = *mut SERVER_INFO_1596; +STRUCT!{struct SERVER_INFO_1597 { + sv1597_IdleThreadTimeOut: DWORD, +}} +pub type PSERVER_INFO_1597 = *mut SERVER_INFO_1597; +pub type LPSERVER_INFO_1597 = *mut SERVER_INFO_1597; +STRUCT!{struct SERVER_INFO_1598 { + sv1598_enableW9xsecuritysignature: DWORD, +}} +pub type PSERVER_INFO_1598 = *mut SERVER_INFO_1598; +pub type LPSERVER_INFO_1598 = *mut SERVER_INFO_1598; +STRUCT!{struct SERVER_INFO_1599 { + sv1598_enforcekerberosreauthentication: BOOLEAN, +}} +pub type PSERVER_INFO_1599 = *mut SERVER_INFO_1599; +pub type LPSERVER_INFO_1599 = *mut SERVER_INFO_1599; +STRUCT!{struct SERVER_INFO_1600 { + sv1598_disabledos: BOOLEAN, +}} +pub type PSERVER_INFO_1600 = *mut SERVER_INFO_1600; +pub type LPSERVER_INFO_1600 = *mut SERVER_INFO_1600; +STRUCT!{struct SERVER_INFO_1601 { + sv1598_lowdiskspaceminimum: DWORD, +}} +pub type PSERVER_INFO_1601 = *mut SERVER_INFO_1601; +pub type LPSERVER_INFO_1601 = *mut SERVER_INFO_1601; +STRUCT!{struct SERVER_INFO_1602 { + sv_1598_disablestrictnamechecking: BOOL, +}} +pub type PSERVER_INFO_1602 = *mut SERVER_INFO_1602; +pub type LPSERVER_INFO_1602 = *mut SERVER_INFO_1602; +STRUCT!{struct SERVER_TRANSPORT_INFO_0 { + svti0_numberofvcs: DWORD, + svti0_transportname: LMSTR, + svti0_transportaddress: LPBYTE, + svti0_transportaddresslength: DWORD, + svti0_networkaddress: LMSTR, +}} +pub type PSERVER_TRANSPORT_INFO_0 = *mut SERVER_TRANSPORT_INFO_0; +pub type LPSERVER_TRANSPORT_INFO_0 = *mut SERVER_TRANSPORT_INFO_0; +STRUCT!{struct SERVER_TRANSPORT_INFO_1 { + svti1_numberofvcs: DWORD, + svti1_transportname: LMSTR, + svti1_transportaddress: LPBYTE, + svti1_transportaddresslength: DWORD, + svti1_networkaddress: LMSTR, + svti1_domain: LMSTR, +}} +pub type PSERVER_TRANSPORT_INFO_1 = *mut SERVER_TRANSPORT_INFO_1; +pub type LPSERVER_TRANSPORT_INFO_1 = *mut SERVER_TRANSPORT_INFO_1; +STRUCT!{struct SERVER_TRANSPORT_INFO_2 { + svti2_numberofvcs: DWORD, + svti2_transportname: LMSTR, + svti2_transportaddress: LPBYTE, + svti2_transportaddresslength: DWORD, + svti2_networkaddress: LMSTR, + svti2_domain: LMSTR, + svti2_flags: ULONG, +}} +pub type PSERVER_TRANSPORT_INFO_2 = *mut SERVER_TRANSPORT_INFO_2; +pub type LPSERVER_TRANSPORT_INFO_2 = *mut SERVER_TRANSPORT_INFO_2; +STRUCT!{struct SERVER_TRANSPORT_INFO_3 { + svti3_numberofvcs: DWORD, + svti3_transportname: LMSTR, + svti3_transportaddress: LPBYTE, + svti3_transportaddresslength: DWORD, + svti3_networkaddress: LMSTR, + svti3_domain: LMSTR, + svti3_flags: ULONG, + svti3_passwordlength: DWORD, + svti3_password: [BYTE; 256], +}} +pub type PSERVER_TRANSPORT_INFO_3 = *mut SERVER_TRANSPORT_INFO_3; +pub type LPSERVER_TRANSPORT_INFO_3 = *mut SERVER_TRANSPORT_INFO_3; +pub const SV_PLATFORM_ID_OS2: DWORD = 400; +pub const SV_PLATFORM_ID_NT: DWORD = 500; +pub const MAJOR_VERSION_MASK: DWORD = 0x0F; +pub const SV_TYPE_WORKSTATION: DWORD = 0x00000001; +pub const SV_TYPE_SERVER: DWORD = 0x00000002; +pub const SV_TYPE_SQLSERVER: DWORD = 0x00000004; +pub const SV_TYPE_DOMAIN_CTRL: DWORD = 0x00000008; +pub const SV_TYPE_DOMAIN_BAKCTRL: DWORD = 0x00000010; +pub const SV_TYPE_TIME_SOURCE: DWORD = 0x00000020; +pub const SV_TYPE_AFP: DWORD = 0x00000040; +pub const SV_TYPE_NOVELL: DWORD = 0x00000080; +pub const SV_TYPE_DOMAIN_MEMBER: DWORD = 0x00000100; +pub const SV_TYPE_PRINTQ_SERVER: DWORD = 0x00000200; +pub const SV_TYPE_DIALIN_SERVER: DWORD = 0x00000400; +pub const SV_TYPE_XENIX_SERVER: DWORD = 0x00000800; +pub const SV_TYPE_SERVER_UNIX: DWORD = SV_TYPE_XENIX_SERVER; +pub const SV_TYPE_NT: DWORD = 0x00001000; +pub const SV_TYPE_WFW: DWORD = 0x00002000; +pub const SV_TYPE_SERVER_MFPN: DWORD = 0x00004000; +pub const SV_TYPE_SERVER_NT: DWORD = 0x00008000; +pub const SV_TYPE_POTENTIAL_BROWSER: DWORD = 0x00010000; +pub const SV_TYPE_BACKUP_BROWSER: DWORD = 0x00020000; +pub const SV_TYPE_MASTER_BROWSER: DWORD = 0x00040000; +pub const SV_TYPE_DOMAIN_MASTER: DWORD = 0x00080000; +pub const SV_TYPE_SERVER_OSF: DWORD = 0x00100000; +pub const SV_TYPE_SERVER_VMS: DWORD = 0x00200000; +pub const SV_TYPE_WINDOWS: DWORD = 0x00400000; +pub const SV_TYPE_DFS: DWORD = 0x00800000; +pub const SV_TYPE_CLUSTER_NT: DWORD = 0x01000000; +pub const SV_TYPE_TERMINALSERVER: DWORD = 0x02000000; +pub const SV_TYPE_CLUSTER_VS_NT: DWORD = 0x04000000; +pub const SV_TYPE_DCE: DWORD = 0x10000000; +pub const SV_TYPE_ALTERNATE_XPORT: DWORD = 0x20000000; +pub const SV_TYPE_LOCAL_LIST_ONLY: DWORD = 0x40000000; +pub const SV_TYPE_DOMAIN_ENUM: DWORD = 0x80000000; +pub const SV_TYPE_ALL: DWORD = 0xFFFFFFFF; +pub const SV_NODISC: DWORD = -1i32 as u32; +pub const SV_USERSECURITY: DWORD = 1; +pub const SV_SHARESECURITY: DWORD = 0; +pub const SV_HIDDEN: DWORD = 1; +pub const SV_VISIBLE: DWORD = 0; +pub const SV_PLATFORM_ID_PARMNUM: DWORD = 101; +pub const SV_NAME_PARMNUM: DWORD = 102; +pub const SV_VERSION_MAJOR_PARMNUM: DWORD = 103; +pub const SV_VERSION_MINOR_PARMNUM: DWORD = 104; +pub const SV_TYPE_PARMNUM: DWORD = 105; +pub const SV_COMMENT_PARMNUM: DWORD = 5; +pub const SV_USERS_PARMNUM: DWORD = 107; +pub const SV_DISC_PARMNUM: DWORD = 10; +pub const SV_HIDDEN_PARMNUM: DWORD = 16; +pub const SV_ANNOUNCE_PARMNUM: DWORD = 17; +pub const SV_ANNDELTA_PARMNUM: DWORD = 18; +pub const SV_USERPATH_PARMNUM: DWORD = 112; +pub const SV_ULIST_MTIME_PARMNUM: DWORD = 401; +pub const SV_GLIST_MTIME_PARMNUM: DWORD = 402; +pub const SV_ALIST_MTIME_PARMNUM: DWORD = 403; +pub const SV_ALERTS_PARMNUM: DWORD = 11; +pub const SV_SECURITY_PARMNUM: DWORD = 405; +pub const SV_NUMADMIN_PARMNUM: DWORD = 406; +pub const SV_LANMASK_PARMNUM: DWORD = 407; +pub const SV_GUESTACC_PARMNUM: DWORD = 408; +pub const SV_CHDEVQ_PARMNUM: DWORD = 410; +pub const SV_CHDEVJOBS_PARMNUM: DWORD = 411; +pub const SV_CONNECTIONS_PARMNUM: DWORD = 412; +pub const SV_SHARES_PARMNUM: DWORD = 413; +pub const SV_OPENFILES_PARMNUM: DWORD = 414; +pub const SV_SESSREQS_PARMNUM: DWORD = 417; +pub const SV_ACTIVELOCKS_PARMNUM: DWORD = 419; +pub const SV_NUMREQBUF_PARMNUM: DWORD = 420; +pub const SV_NUMBIGBUF_PARMNUM: DWORD = 422; +pub const SV_NUMFILETASKS_PARMNUM: DWORD = 423; +pub const SV_ALERTSCHED_PARMNUM: DWORD = 37; +pub const SV_ERRORALERT_PARMNUM: DWORD = 38; +pub const SV_LOGONALERT_PARMNUM: DWORD = 39; +pub const SV_ACCESSALERT_PARMNUM: DWORD = 40; +pub const SV_DISKALERT_PARMNUM: DWORD = 41; +pub const SV_NETIOALERT_PARMNUM: DWORD = 42; +pub const SV_MAXAUDITSZ_PARMNUM: DWORD = 43; +pub const SV_SRVHEURISTICS_PARMNUM: DWORD = 431; +pub const SV_SESSOPENS_PARMNUM: DWORD = 501; +pub const SV_SESSVCS_PARMNUM: DWORD = 502; +pub const SV_OPENSEARCH_PARMNUM: DWORD = 503; +pub const SV_SIZREQBUF_PARMNUM: DWORD = 504; +pub const SV_INITWORKITEMS_PARMNUM: DWORD = 505; +pub const SV_MAXWORKITEMS_PARMNUM: DWORD = 506; +pub const SV_RAWWORKITEMS_PARMNUM: DWORD = 507; +pub const SV_IRPSTACKSIZE_PARMNUM: DWORD = 508; +pub const SV_MAXRAWBUFLEN_PARMNUM: DWORD = 509; +pub const SV_SESSUSERS_PARMNUM: DWORD = 510; +pub const SV_SESSCONNS_PARMNUM: DWORD = 511; +pub const SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM: DWORD = 512; +pub const SV_MAXPAGEDMEMORYUSAGE_PARMNUM: DWORD = 513; +pub const SV_ENABLESOFTCOMPAT_PARMNUM: DWORD = 514; +pub const SV_ENABLEFORCEDLOGOFF_PARMNUM: DWORD = 515; +pub const SV_TIMESOURCE_PARMNUM: DWORD = 516; +pub const SV_ACCEPTDOWNLEVELAPIS_PARMNUM: DWORD = 517; +pub const SV_LMANNOUNCE_PARMNUM: DWORD = 518; +pub const SV_DOMAIN_PARMNUM: DWORD = 519; +pub const SV_MAXCOPYREADLEN_PARMNUM: DWORD = 520; +pub const SV_MAXCOPYWRITELEN_PARMNUM: DWORD = 521; +pub const SV_MINKEEPSEARCH_PARMNUM: DWORD = 522; +pub const SV_MAXKEEPSEARCH_PARMNUM: DWORD = 523; +pub const SV_MINKEEPCOMPLSEARCH_PARMNUM: DWORD = 524; +pub const SV_MAXKEEPCOMPLSEARCH_PARMNUM: DWORD = 525; +pub const SV_THREADCOUNTADD_PARMNUM: DWORD = 526; +pub const SV_NUMBLOCKTHREADS_PARMNUM: DWORD = 527; +pub const SV_SCAVTIMEOUT_PARMNUM: DWORD = 528; +pub const SV_MINRCVQUEUE_PARMNUM: DWORD = 529; +pub const SV_MINFREEWORKITEMS_PARMNUM: DWORD = 530; +pub const SV_XACTMEMSIZE_PARMNUM: DWORD = 531; +pub const SV_THREADPRIORITY_PARMNUM: DWORD = 532; +pub const SV_MAXMPXCT_PARMNUM: DWORD = 533; +pub const SV_OPLOCKBREAKWAIT_PARMNUM: DWORD = 534; +pub const SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM: DWORD = 535; +pub const SV_ENABLEOPLOCKS_PARMNUM: DWORD = 536; +pub const SV_ENABLEOPLOCKFORCECLOSE_PARMNUM: DWORD = 537; +pub const SV_ENABLEFCBOPENS_PARMNUM: DWORD = 538; +pub const SV_ENABLERAW_PARMNUM: DWORD = 539; +pub const SV_ENABLESHAREDNETDRIVES_PARMNUM: DWORD = 540; +pub const SV_MINFREECONNECTIONS_PARMNUM: DWORD = 541; +pub const SV_MAXFREECONNECTIONS_PARMNUM: DWORD = 542; +pub const SV_INITSESSTABLE_PARMNUM: DWORD = 543; +pub const SV_INITCONNTABLE_PARMNUM: DWORD = 544; +pub const SV_INITFILETABLE_PARMNUM: DWORD = 545; +pub const SV_INITSEARCHTABLE_PARMNUM: DWORD = 546; +pub const SV_ALERTSCHEDULE_PARMNUM: DWORD = 547; +pub const SV_ERRORTHRESHOLD_PARMNUM: DWORD = 548; +pub const SV_NETWORKERRORTHRESHOLD_PARMNUM: DWORD = 549; +pub const SV_DISKSPACETHRESHOLD_PARMNUM: DWORD = 550; +pub const SV_MAXLINKDELAY_PARMNUM: DWORD = 552; +pub const SV_MINLINKTHROUGHPUT_PARMNUM: DWORD = 553; +pub const SV_LINKINFOVALIDTIME_PARMNUM: DWORD = 554; +pub const SV_SCAVQOSINFOUPDATETIME_PARMNUM: DWORD = 555; +pub const SV_MAXWORKITEMIDLETIME_PARMNUM: DWORD = 556; +pub const SV_MAXRAWWORKITEMS_PARMNUM: DWORD = 557; +pub const SV_PRODUCTTYPE_PARMNUM: DWORD = 560; +pub const SV_SERVERSIZE_PARMNUM: DWORD = 561; +pub const SV_CONNECTIONLESSAUTODISC_PARMNUM: DWORD = 562; +pub const SV_SHARINGVIOLATIONRETRIES_PARMNUM: DWORD = 563; +pub const SV_SHARINGVIOLATIONDELAY_PARMNUM: DWORD = 564; +pub const SV_MAXGLOBALOPENSEARCH_PARMNUM: DWORD = 565; +pub const SV_REMOVEDUPLICATESEARCHES_PARMNUM: DWORD = 566; +pub const SV_LOCKVIOLATIONRETRIES_PARMNUM: DWORD = 567; +pub const SV_LOCKVIOLATIONOFFSET_PARMNUM: DWORD = 568; +pub const SV_LOCKVIOLATIONDELAY_PARMNUM: DWORD = 569; +pub const SV_MDLREADSWITCHOVER_PARMNUM: DWORD = 570; +pub const SV_CACHEDOPENLIMIT_PARMNUM: DWORD = 571; +pub const SV_CRITICALTHREADS_PARMNUM: DWORD = 572; +pub const SV_RESTRICTNULLSESSACCESS_PARMNUM: DWORD = 573; +pub const SV_ENABLEWFW311DIRECTIPX_PARMNUM: DWORD = 574; +pub const SV_OTHERQUEUEAFFINITY_PARMNUM: DWORD = 575; +pub const SV_QUEUESAMPLESECS_PARMNUM: DWORD = 576; +pub const SV_BALANCECOUNT_PARMNUM: DWORD = 577; +pub const SV_PREFERREDAFFINITY_PARMNUM: DWORD = 578; +pub const SV_MAXFREERFCBS_PARMNUM: DWORD = 579; +pub const SV_MAXFREEMFCBS_PARMNUM: DWORD = 580; +pub const SV_MAXFREELFCBS_PARMNUM: DWORD = 581; +pub const SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM: DWORD = 582; +pub const SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM: DWORD = 583; +pub const SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM: DWORD = 584; +pub const SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM: DWORD = 585; +pub const SV_MAXTHREADSPERQUEUE_PARMNUM: DWORD = 586; +pub const SV_CACHEDDIRECTORYLIMIT_PARMNUM: DWORD = 587; +pub const SV_MAXCOPYLENGTH_PARMNUM: DWORD = 588; +pub const SV_ENABLECOMPRESSION_PARMNUM: DWORD = 590; +pub const SV_AUTOSHAREWKS_PARMNUM: DWORD = 591; +pub const SV_AUTOSHARESERVER_PARMNUM: DWORD = 592; +pub const SV_ENABLESECURITYSIGNATURE_PARMNUM: DWORD = 593; +pub const SV_REQUIRESECURITYSIGNATURE_PARMNUM: DWORD = 594; +pub const SV_MINCLIENTBUFFERSIZE_PARMNUM: DWORD = 595; +pub const SV_CONNECTIONNOSESSIONSTIMEOUT_PARMNUM: DWORD = 596; +pub const SV_IDLETHREADTIMEOUT_PARMNUM: DWORD = 597; +pub const SV_ENABLEW9XSECURITYSIGNATURE_PARMNUM: DWORD = 598; +pub const SV_ENFORCEKERBEROSREAUTHENTICATION_PARMNUM: DWORD = 599; +pub const SV_DISABLEDOS_PARMNUM: DWORD = 600; +pub const SV_LOWDISKSPACEMINIMUM_PARMNUM: DWORD = 601; +pub const SV_DISABLESTRICTNAMECHECKING_PARMNUM: DWORD = 602; +pub const SV_ENABLEAUTHENTICATEUSERSHARING_PARMNUM: DWORD = 603; +pub const SV_COMMENT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_COMMENT_PARMNUM; +pub const SV_USERS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_USERS_PARMNUM; +pub const SV_DISC_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_DISC_PARMNUM; +pub const SV_HIDDEN_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_HIDDEN_PARMNUM; +pub const SV_ANNOUNCE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_ANNOUNCE_PARMNUM; +pub const SV_ANNDELTA_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_ANNDELTA_PARMNUM; +pub const SV_SESSOPENS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_SESSOPENS_PARMNUM; +pub const SV_SESSVCS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_SESSVCS_PARMNUM; +pub const SV_OPENSEARCH_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_OPENSEARCH_PARMNUM; +pub const SV_MAXWORKITEMS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXWORKITEMS_PARMNUM; +pub const SV_MAXRAWBUFLEN_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXRAWBUFLEN_PARMNUM; +pub const SV_SESSUSERS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_SESSUSERS_PARMNUM; +pub const SV_SESSCONNS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_SESSCONNS_PARMNUM; +pub const SV_MAXNONPAGEDMEMORYUSAGE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM; +pub const SV_MAXPAGEDMEMORYUSAGE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXPAGEDMEMORYUSAGE_PARMNUM; +pub const SV_ENABLESOFTCOMPAT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLESOFTCOMPAT_PARMNUM; +pub const SV_ENABLEFORCEDLOGOFF_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLEFORCEDLOGOFF_PARMNUM; +pub const SV_TIMESOURCE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_TIMESOURCE_PARMNUM; +pub const SV_LMANNOUNCE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_LMANNOUNCE_PARMNUM; +pub const SV_MAXCOPYREADLEN_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYREADLEN_PARMNUM; +pub const SV_MAXCOPYWRITELEN_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXCOPYWRITELEN_PARMNUM; +pub const SV_MINKEEPSEARCH_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MINKEEPSEARCH_PARMNUM; +pub const SV_MAXKEEPSEARCH_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXKEEPSEARCH_PARMNUM; +pub const SV_MINKEEPCOMPLSEARCH_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MINKEEPCOMPLSEARCH_PARMNUM; +pub const SV_MAXKEEPCOMPLSEARCH_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXKEEPCOMPLSEARCH_PARMNUM; +pub const SV_SCAVTIMEOUT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_SCAVTIMEOUT_PARMNUM; +pub const SV_MINRCVQUEUE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MINRCVQUEUE_PARMNUM; +pub const SV_MINFREEWORKITEMS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MINFREEWORKITEMS_PARMNUM; +pub const SV_MAXMPXCT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXMPXCT_PARMNUM; +pub const SV_OPLOCKBREAKWAIT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_OPLOCKBREAKWAIT_PARMNUM; +pub const SV_OPLOCKBREAKRESPONSEWAIT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM; +pub const SV_ENABLEOPLOCKS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_ENABLEOPLOCKS_PARMNUM; +pub const SV_ENABLEOPLOCKFORCECLOSE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLEOPLOCKFORCECLOSE_PARMNUM; +pub const SV_ENABLEFCBOPENS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_ENABLEFCBOPENS_PARMNUM; +pub const SV_ENABLERAW_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_ENABLERAW_PARMNUM; +pub const SV_ENABLESHAREDNETDRIVES_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLESHAREDNETDRIVES_PARMNUM; +pub const SV_MINFREECONNECTIONS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MINFREECONNECTIONS_PARMNUM; +pub const SV_MAXFREECONNECTIONS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXFREECONNECTIONS_PARMNUM; +pub const SV_INITSESSTABLE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_INITSESSTABLE_PARMNUM; +pub const SV_INITCONNTABLE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_INITCONNTABLE_PARMNUM; +pub const SV_INITFILETABLE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_INITFILETABLE_PARMNUM; +pub const SV_INITSEARCHTABLE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_INITSEARCHTABLE_PARMNUM; +pub const SV_ALERTSCHEDULE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_ALERTSCHEDULE_PARMNUM; +pub const SV_ERRORTHRESHOLD_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_ERRORTHRESHOLD_PARMNUM; +pub const SV_NETWORKERRORTHRESHOLD_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_NETWORKERRORTHRESHOLD_PARMNUM; +pub const SV_DISKSPACETHRESHOLD_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_DISKSPACETHRESHOLD_PARMNUM; +pub const SV_MAXLINKDELAY_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXLINKDELAY_PARMNUM; +pub const SV_MINLINKTHROUGHPUT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MINLINKTHROUGHPUT_PARMNUM; +pub const SV_LINKINFOVALIDTIME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_LINKINFOVALIDTIME_PARMNUM; +pub const SV_SCAVQOSINFOUPDATETIME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_SCAVQOSINFOUPDATETIME_PARMNUM; +pub const SV_MAXWORKITEMIDLETIME_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXWORKITEMIDLETIME_PARMNUM; +pub const SV_MAXRAWWORKITEMS_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXRAWWORKITEMS_PARMNUM; +pub const SV_PRODUCTTYPE_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_PRODUCTTYPE_PARMNUM; +pub const SV_SERVERSIZE_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_SERVERSIZE_PARMNUM; +pub const SV_CONNECTIONLESSAUTODISC_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_CONNECTIONLESSAUTODISC_PARMNUM; +pub const SV_SHARINGVIOLATIONRETRIES_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_SHARINGVIOLATIONRETRIES_PARMNUM; +pub const SV_SHARINGVIOLATIONDELAY_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_SHARINGVIOLATIONDELAY_PARMNUM; +pub const SV_MAXGLOBALOPENSEARCH_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXGLOBALOPENSEARCH_PARMNUM; +pub const SV_REMOVEDUPLICATESEARCHES_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_REMOVEDUPLICATESEARCHES_PARMNUM; +pub const SV_LOCKVIOLATIONRETRIES_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_LOCKVIOLATIONRETRIES_PARMNUM; +pub const SV_LOCKVIOLATIONOFFSET_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_LOCKVIOLATIONOFFSET_PARMNUM; +pub const SV_LOCKVIOLATIONDELAY_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_LOCKVIOLATIONDELAY_PARMNUM; +pub const SV_MDLREADSWITCHOVER_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MDLREADSWITCHOVER_PARMNUM; +pub const SV_CACHEDOPENLIMIT_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_CACHEDOPENLIMIT_PARMNUM; +pub const SV_CRITICALTHREADS_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_CRITICALTHREADS_PARMNUM; +pub const SV_RESTRICTNULLSESSACCESS_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_RESTRICTNULLSESSACCESS_PARMNUM; +pub const SV_ENABLEWFW311DIRECTIPX_INFOLOEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLEWFW311DIRECTIPX_PARMNUM; +pub const SV_OTHERQUEUEAFFINITY_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_OTHERQUEUEAFFINITY_PARMNUM; +pub const SV_QUEUESAMPLESECS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_QUEUESAMPLESECS_PARMNUM; +pub const SV_BALANCECOUNT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_BALANCECOUNT_PARMNUM; +pub const SV_PREFERREDAFFINITY_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_PREFERREDAFFINITY_PARMNUM; +pub const SV_MAXFREERFCBS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXFREERFCBS_PARMNUM; +pub const SV_MAXFREEMFCBS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXFREEMFCBS_PARMNUM; +pub const SV_MAXFREELFCBS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXFREELFCBS_PARMNUM; +pub const SV_MAXFREEPAGEDPOOLCHUNKS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM; +pub const SV_MINPAGEDPOOLCHUNKSIZE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM; +pub const SV_MAXPAGEDPOOLCHUNKSIZE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM; +pub const SV_SENDSFROMPREFERREDPROCESSOR_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM; +pub const SV_MAXTHREADSPERQUEUE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MAXTHREADSPERQUEUE_PARMNUM; +pub const SV_CACHEDDIRECTORYLIMIT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_CACHEDDIRECTORYLIMIT_PARMNUM; +pub const SV_MAXCOPYLENGTH_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYLENGTH_PARMNUM; +pub const SV_ENABLECOMPRESSION_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLECOMPRESSION_PARMNUM; +pub const SV_AUTOSHAREWKS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_AUTOSHAREWKS_PARMNUM; +pub const SV_AUTOSHARESERVER_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_AUTOSHARESERVER_PARMNUM; +pub const SV_ENABLESECURITYSIGNATURE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLESECURITYSIGNATURE_PARMNUM; +pub const SV_REQUIRESECURITYSIGNATURE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_REQUIRESECURITYSIGNATURE_PARMNUM; +pub const SV_MINCLIENTBUFFERSIZE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_MINCLIENTBUFFERSIZE_PARMNUM; +pub const SV_CONNECTIONNOSESSIONSTIMEOUT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_CONNECTIONNOSESSIONSTIMEOUT_PARMNUM; +pub const SV_IDLETHREADTIMEOUT_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_IDLETHREADTIMEOUT_PARMNUM; +pub const SV_ENABLEW9XSECURITYSIGNATURE_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLEW9XSECURITYSIGNATURE_PARMNUM; +pub const SV_ENFORCEKERBEROSREAUTHENTICATION_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENFORCEKERBEROSREAUTHENTICATION_PARMNUM; +pub const SV_DISABLEDOS_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SV_DISABLEDOS_PARMNUM; +pub const SV_LOWDISKSPACEMINIMUM_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_LOWDISKSPACEMINIMUM_PARMNUM; +pub const SV_DISABLESTRICTNAMECHECKING_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_DISABLESTRICTNAMECHECKING_PARMNUM; +pub const SV_ENABLEAUTHENTICATEUSERSHARING_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + + SV_ENABLEAUTHENTICATEUSERSHARING_PARMNUM; +pub const SVI1_NUM_ELEMENTS: DWORD = 5; +pub const SVI2_NUM_ELEMENTS: DWORD = 40; +pub const SVI3_NUM_ELEMENTS: DWORD = 44; +pub const SV_MAX_CMD_LEN: DWORD = PATHLEN; +pub const SW_AUTOPROF_LOAD_MASK: DWORD = 0x1; +pub const SW_AUTOPROF_SAVE_MASK: DWORD = 0x2; +pub const SV_MAX_SRV_HEUR_LEN: DWORD = 32; +pub const SV_USERS_PER_LICENSE: DWORD = 5; +pub const SVTI2_REMAP_PIPE_NAMES: DWORD = 0x02; +pub const SVTI2_SCOPED_NAME: DWORD = 0x04; +pub const SVTI2_CLUSTER_NAME: DWORD = 0x08; +pub const SVTI2_CLUSTER_DNN_NAME: DWORD = 0x10; +pub const SVTI2_UNICODE_TRANSPORT_ADDRESS: DWORD = 0x20; +pub const SVTI2_RESERVED1: DWORD = 0x1000; +pub const SVTI2_RESERVED2: DWORD = 0x2000; +pub const SVTI2_RESERVED3: DWORD = 0x4000; +pub const SVTI2_VALID_FLAGS: DWORD = SVTI2_REMAP_PIPE_NAMES | SVTI2_SCOPED_NAME + | SVTI2_CLUSTER_NAME | SVTI2_CLUSTER_DNN_NAME | SVTI2_UNICODE_TRANSPORT_ADDRESS; +pub const SRV_SUPPORT_HASH_GENERATION: DWORD = 0x0001; +pub const SRV_HASH_GENERATION_ACTIVE: DWORD = 0x0002; diff --git a/src/vendor/winapi/src/um/lmshare.rs b/src/vendor/winapi/src/um/lmshare.rs new file mode 100644 index 0000000000..b60e02863b --- /dev/null +++ b/src/vendor/winapi/src/um/lmshare.rs @@ -0,0 +1,380 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the API function prototypes and data structures +use shared::basetsd::PDWORD_PTR; +use shared::guiddef::GUID; +use shared::lmcons::{LMSTR, NET_API_STATUS, PARMNUM_BASE_INFOLEVEL}; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD, ULONG}; +use um::winnt::{BOOLEAN, PSECURITY_DESCRIPTOR}; +extern "system" { + pub fn NetShareAdd( + servername: LMSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetShareEnum( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetShareEnumSticky( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetShareGetInfo( + servername: LMSTR, + netname: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetShareSetInfo( + servername: LMSTR, + netname: LMSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetShareDel( + servername: LMSTR, + netname: LMSTR, + reserved: DWORD, + ) -> NET_API_STATUS; + pub fn NetShareDelSticky( + servername: LMSTR, + netname: LMSTR, + reserved: DWORD, + ) -> NET_API_STATUS; + pub fn NetShareCheck( + servername: LMSTR, + device: LMSTR, + _type: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetShareDelEx( + servername: LMSTR, + level: DWORD, + buf: LPBYTE, + ) -> NET_API_STATUS; +} +STRUCT!{struct SHARE_INFO_0 { + shi0_netname: LMSTR, +}} +pub type PSHARE_INFO_0 = *mut SHARE_INFO_0; +pub type LPSHARE_INFO_0 = *mut SHARE_INFO_0; +STRUCT!{struct SHARE_INFO_1 { + shi1_netname: LMSTR, + shi1_type: DWORD, + shi1_remark: LMSTR, +}} +pub type PSHARE_INFO_1 = *mut SHARE_INFO_1; +pub type LPSHARE_INFO_1 = *mut SHARE_INFO_1; +STRUCT!{struct SHARE_INFO_2 { + shi2_netname: LMSTR, + shi2_type: DWORD, + shi2_remark: LMSTR, + shi2_permissions: DWORD, + shi2_max_uses: DWORD, + shi2_current_uses: DWORD, + shi2_path: LMSTR, + shi2_passwd: LMSTR, +}} +pub type PSHARE_INFO_2 = *mut SHARE_INFO_2; +pub type LPSHARE_INFO_2 = *mut SHARE_INFO_2; +STRUCT!{struct SHARE_INFO_501 { + shi501_netname: LMSTR, + shi501_type: DWORD, + shi501_remark: LMSTR, + shi501_flags: DWORD, +}} +pub type PSHARE_INFO_501 = *mut SHARE_INFO_501; +pub type LPSHARE_INFO_501 = *mut SHARE_INFO_501; +STRUCT!{struct SHARE_INFO_502 { + shi502_netname: LMSTR, + shi502_type: DWORD, + shi502_remark: LMSTR, + shi502_permissions: DWORD, + shi502_max_uses: DWORD, + shi502_current_uses: DWORD, + shi502_path: LMSTR, + shi502_passwd: LMSTR, + shi502_reserved: DWORD, + shi502_security_descriptor: PSECURITY_DESCRIPTOR, +}} +pub type PSHARE_INFO_502 = *mut SHARE_INFO_502; +pub type LPSHARE_INFO_502 = *mut SHARE_INFO_502; +STRUCT!{struct SHARE_INFO_503 { + shi503_netname: LMSTR, + shi503_type: DWORD, + shi503_remark: LMSTR, + shi503_permissions: DWORD, + shi503_max_uses: DWORD, + shi503_current_uses: DWORD, + shi503_path: LMSTR, + shi503_passwd: LMSTR, + shi503_servername: LMSTR, + shi503_reserved: DWORD, + shi503_security_descriptor: PSECURITY_DESCRIPTOR, +}} +pub type PSHARE_INFO_503 = *mut SHARE_INFO_503; +pub type LPSHARE_INFO_503 = *mut SHARE_INFO_503; +STRUCT!{struct SHARE_INFO_1004 { + shi1004_remark: LMSTR, +}} +pub type PSHARE_INFO_1004 = *mut SHARE_INFO_1004; +pub type LPSHARE_INFO_1004 = *mut SHARE_INFO_1004; +STRUCT!{struct SHARE_INFO_1005 { + shi1005_flags: DWORD, +}} +pub type PSHARE_INFO_1005 = *mut SHARE_INFO_1005; +pub type LPSHARE_INFO_1005 = *mut SHARE_INFO_1005; +STRUCT!{struct SHARE_INFO_1006 { + shi1006_max_uses: DWORD, +}} +pub type PSHARE_INFO_1006 = *mut SHARE_INFO_1006; +pub type LPSHARE_INFO_1006 = *mut SHARE_INFO_1006; +STRUCT!{struct SHARE_INFO_1501 { + shi1501_reserved: DWORD, + shi1501_security_descriptor: PSECURITY_DESCRIPTOR, +}} +pub type PSHARE_INFO_1501 = *mut SHARE_INFO_1501; +pub type LPSHARE_INFO_1501 = *mut SHARE_INFO_1501; +STRUCT!{struct SHARE_INFO_1503 { + shi1503_sharefilter: GUID, +}} +pub type PSHARE_INFO_1503 = *mut SHARE_INFO_1503; +pub type LPSHARE_INFO_1503 = *mut SHARE_INFO_1503; +extern "system" { + pub fn NetServerAliasAdd( + servername: LMSTR, + level: DWORD, + buf: LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServerAliasDel( + servername: LMSTR, + level: DWORD, + buf: LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServerAliasEnum( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct SERVER_ALIAS_INFO_0 { + srvai0_alias: LMSTR, + srvai0_target: LMSTR, + srvai0_default: BOOLEAN, + srvai0_reserved: ULONG, +}} +pub type PSERVER_ALIAS_INFO_0 = *mut SERVER_ALIAS_INFO_0; +pub type LPSERVER_ALIAS_INFO_0 = *mut SERVER_ALIAS_INFO_0; +pub const SHARE_NETNAME_PARMNUM: DWORD = 1; +pub const SHARE_TYPE_PARMNUM: DWORD = 3; +pub const SHARE_REMARK_PARMNUM: DWORD = 4; +pub const SHARE_PERMISSIONS_PARMNUM: DWORD = 5; +pub const SHARE_MAX_USES_PARMNUM: DWORD = 6; +pub const SHARE_CURRENT_USES_PARMNUM: DWORD = 7; +pub const SHARE_PATH_PARMNUM: DWORD = 8; +pub const SHARE_PASSWD_PARMNUM: DWORD = 9; +pub const SHARE_FILE_SD_PARMNUM: DWORD = 501; +pub const SHARE_SERVER_PARMNUM: DWORD = 503; +pub const SHARE_REMARK_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SHARE_REMARK_PARMNUM; +pub const SHARE_MAX_USES_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SHARE_MAX_USES_PARMNUM; +pub const SHARE_FILE_SD_INFOLEVEL: DWORD = PARMNUM_BASE_INFOLEVEL + SHARE_FILE_SD_PARMNUM; +pub const SHI1_NUM_ELEMENTS: DWORD = 4; +pub const SHI2_NUM_ELEMENTS: DWORD = 10; +pub const STYPE_DISKTREE: DWORD = 0; +pub const STYPE_PRINTQ: DWORD = 1; +pub const STYPE_DEVICE: DWORD = 2; +pub const STYPE_IPC: DWORD = 3; +pub const STYPE_MASK: DWORD = 0x000000FF; +pub const STYPE_RESERVED1: DWORD = 0x01000000; +pub const STYPE_RESERVED2: DWORD = 0x02000000; +pub const STYPE_RESERVED3: DWORD = 0x04000000; +pub const STYPE_RESERVED4: DWORD = 0x08000000; +pub const STYPE_RESERVED_ALL: DWORD = 0x3FFFFF00; +pub const STYPE_TEMPORARY: DWORD = 0x40000000; +pub const STYPE_SPECIAL: DWORD = 0x80000000; +pub const SHI_USES_UNLIMITED: DWORD = -1i32 as u32; +pub const SHI1005_FLAGS_DFS: DWORD = 0x0001; +pub const SHI1005_FLAGS_DFS_ROOT: DWORD = 0x0002; +pub const CSC_MASK_EXT: DWORD = 0x2030; +pub const CSC_MASK: DWORD = 0x0030; +pub const CSC_CACHE_MANUAL_REINT: DWORD = 0x0000; +pub const CSC_CACHE_AUTO_REINT: DWORD = 0x0010; +pub const CSC_CACHE_VDO: DWORD = 0x0020; +pub const CSC_CACHE_NONE: DWORD = 0x0030; +pub const SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS: DWORD = 0x00100; +pub const SHI1005_FLAGS_FORCE_SHARED_DELETE: DWORD = 0x00200; +pub const SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING: DWORD = 0x00400; +pub const SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM: DWORD = 0x00800; +pub const SHI1005_FLAGS_FORCE_LEVELII_OPLOCK: DWORD = 0x01000; +pub const SHI1005_FLAGS_ENABLE_HASH: DWORD = 0x02000; +pub const SHI1005_FLAGS_ENABLE_CA: DWORD = 0x04000; +pub const SHI1005_FLAGS_ENCRYPT_DATA: DWORD = 0x08000; +pub const SHI1005_FLAGS_RESERVED: DWORD = 0x10000; +pub const SHI1005_VALID_FLAGS_SET: DWORD = CSC_MASK | SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS + | SHI1005_FLAGS_FORCE_SHARED_DELETE | SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING + | SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM | SHI1005_FLAGS_FORCE_LEVELII_OPLOCK + | SHI1005_FLAGS_ENABLE_HASH | SHI1005_FLAGS_ENABLE_CA | SHI1005_FLAGS_ENCRYPT_DATA + | SHI1005_FLAGS_RESERVED; +extern "system" { + pub fn NetSessionEnum( + servername: LMSTR, + UncClientName: LMSTR, + username: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetSessionDel( + servername: LMSTR, + UncClientName: LMSTR, + username: LMSTR, + ) -> NET_API_STATUS; + pub fn NetSessionGetInfo( + servername: LMSTR, + UncClientName: LMSTR, + username: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; +} +STRUCT!{struct SESSION_INFO_0 { + sesi0_cname: LMSTR, +}} +pub type PSESSION_INFO_0 = *mut SESSION_INFO_0; +pub type LPSESSION_INFO_0 = *mut SESSION_INFO_0; +STRUCT!{struct SESSION_INFO_1 { + sesi1_cname: LMSTR, + sesi1_username: LMSTR, + sesi1_num_opens: DWORD, + sesi1_time: DWORD, + sesi1_idle_time: DWORD, + sesi1_user_flags: DWORD, +}} +pub type PSESSION_INFO_1 = *mut SESSION_INFO_1; +pub type LPSESSION_INFO_1 = *mut SESSION_INFO_1; +STRUCT!{struct SESSION_INFO_2 { + sesi2_cname: LMSTR, + sesi2_username: LMSTR, + sesi2_num_opens: DWORD, + sesi2_time: DWORD, + sesi2_idle_time: DWORD, + sesi2_user_flags: DWORD, + sesi2_cltype_name: LMSTR, +}} +pub type PSESSION_INFO_2 = *mut SESSION_INFO_2; +pub type LPSESSION_INFO_2 = *mut SESSION_INFO_2; +STRUCT!{struct SESSION_INFO_10 { + sesi10_cname: LMSTR, + sesi10_username: LMSTR, + sesi10_time: DWORD, + sesi10_idle_time: DWORD, +}} +pub type PSESSION_INFO_10 = *mut SESSION_INFO_10; +pub type LPSESSION_INFO_10 = *mut SESSION_INFO_10; +STRUCT!{struct SESSION_INFO_502 { + sesi502_cname: LMSTR, + sesi502_username: LMSTR, + sesi502_num_opens: DWORD, + sesi502_time: DWORD, + sesi502_idle_time: DWORD, + sesi502_user_flags: DWORD, + sesi502_cltype_name: LMSTR, + sesi502_transport: LMSTR, +}} +pub type PSESSION_INFO_502 = *mut SESSION_INFO_502; +pub type LPSESSION_INFO_502 = *mut SESSION_INFO_502; +pub const SESS_GUEST: DWORD = 0x00000001; +pub const SESS_NOENCRYPTION: DWORD = 0x00000002; +pub const SESI1_NUM_ELEMENTS: DWORD = 8; +pub const SESI2_NUM_ELEMENTS: DWORD = 9; +extern "system" { + pub fn NetConnectionEnum( + servername: LMSTR, + qualifier: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resume_handle: LPDWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct CONNECTION_INFO_0 { + coni0_id: DWORD, +}} +pub type PCONNECTION_INFO_0 = *mut CONNECTION_INFO_0; +pub type LPCONNECTION_INFO_0 = *mut CONNECTION_INFO_0; +STRUCT!{struct CONNECTION_INFO_1 { + coni1_id: DWORD, + coni1_type: DWORD, + coni1_num_opens: DWORD, + coni1_num_users: DWORD, + coni1_time: DWORD, + coni1_username: LMSTR, + coni1_netname: LMSTR, +}} +pub type PCONNECTION_INFO_1 = *mut CONNECTION_INFO_1; +pub type LPCONNECTION_INFO_1 = *mut CONNECTION_INFO_1; +extern "system" { + pub fn NetFileClose( + servername: LMSTR, + fileid: DWORD, + ) -> NET_API_STATUS; + pub fn NetFileEnum( + servername: LMSTR, + basepath: LMSTR, + username: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resume_handle: PDWORD_PTR, + ) -> NET_API_STATUS; + pub fn NetFileGetInfo( + servername: LMSTR, + fileid: DWORD, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; +} +STRUCT!{struct FILE_INFO_2 { + fi2_id: DWORD, +}} +pub type PFILE_INFO_2 = *mut FILE_INFO_2; +pub type LPFILE_INFO_2 = *mut FILE_INFO_2; +STRUCT!{struct FILE_INFO_3 { + fi3_id: DWORD, + fi3_permissions: DWORD, + fi3_num_locks: DWORD, + fi3_pathname: LMSTR, + fi3_username: LMSTR, +}} +pub type PFILE_INFO_3 = *mut FILE_INFO_3; +pub type LPFILE_INFO_3 = *mut FILE_INFO_3; +pub const PERM_FILE_READ: DWORD = 0x1; +pub const PERM_FILE_WRITE: DWORD = 0x2; +pub const PERM_FILE_CREATE: DWORD = 0x4; diff --git a/src/vendor/winapi/src/um/lmstats.rs b/src/vendor/winapi/src/um/lmstats.rs new file mode 100644 index 0000000000..6ccd853d36 --- /dev/null +++ b/src/vendor/winapi/src/um/lmstats.rs @@ -0,0 +1,86 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{DWORD, LPBYTE}; +use um::winnt::{LARGE_INTEGER, LPCWSTR}; +extern "system" { + pub fn NetStatisticsGet( + ServerName: LPCWSTR, + Service: LPCWSTR, + Level: DWORD, + Options: DWORD, + Buffer: *mut LPBYTE, + ) -> NET_API_STATUS; +} +STRUCT!{struct STAT_WORKSTATION_0 { + StatisticsStartTime: LARGE_INTEGER, + BytesReceived: LARGE_INTEGER, + SmbsReceived: LARGE_INTEGER, + PagingReadBytesRequested: LARGE_INTEGER, + NonPagingReadBytesRequested: LARGE_INTEGER, + CacheReadBytesRequested: LARGE_INTEGER, + NetworkReadBytesRequested: LARGE_INTEGER, + BytesTransmitted: LARGE_INTEGER, + SmbsTransmitted: LARGE_INTEGER, + PagingWriteBytesRequested: LARGE_INTEGER, + NonPagingWriteBytesRequested: LARGE_INTEGER, + CacheWriteBytesRequested: LARGE_INTEGER, + NetworkWriteBytesRequested: LARGE_INTEGER, + InitiallyFailedOperations: DWORD, + FailedCompletionOperations: DWORD, + ReadOperations: DWORD, + RandomReadOperations: DWORD, + ReadSmbs: DWORD, + LargeReadSmbs: DWORD, + SmallReadSmbs: DWORD, + WriteOperations: DWORD, + RandomWriteOperations: DWORD, + WriteSmbs: DWORD, + LargeWriteSmbs: DWORD, + SmallWriteSmbs: DWORD, + RawReadsDenied: DWORD, + RawWritesDenied: DWORD, + NetworkErrors: DWORD, + Sessions: DWORD, + FailedSessions: DWORD, + Reconnects: DWORD, + CoreConnects: DWORD, + Lanman20Connects: DWORD, + Lanman21Connects: DWORD, + LanmanNtConnects: DWORD, + ServerDisconnects: DWORD, + HungSessions: DWORD, + UseCount: DWORD, + FailedUseCount: DWORD, + CurrentCommands: DWORD, +}} +pub type PSTAT_WORKSTATION_0 = *mut STAT_WORKSTATION_0; +pub type LPSTAT_WORKSTATION_0 = *mut STAT_WORKSTATION_0; +STRUCT!{struct STAT_SERVER_0 { + sts0_start: DWORD, + sts0_fopens: DWORD, + sts0_devopens: DWORD, + sts0_jobsqueued: DWORD, + sts0_sopens: DWORD, + sts0_stimedout: DWORD, + sts0_serrorout: DWORD, + sts0_pwerrors: DWORD, + sts0_permerrors: DWORD, + sts0_syserrors: DWORD, + sts0_bytessent_low: DWORD, + sts0_bytessent_high: DWORD, + sts0_bytesrcvd_low: DWORD, + sts0_bytesrcvd_high: DWORD, + sts0_avresponse: DWORD, + sts0_reqbufneed: DWORD, + sts0_bigbufneed: DWORD, +}} +pub type PSTAT_SERVER_0 = *mut STAT_SERVER_0; +pub type LPSTAT_SERVER_0 = *mut STAT_SERVER_0; +pub const STATSOPT_CLR: DWORD = 1; +pub const STATS_NO_VALUE: DWORD = -1i32 as u32; +pub const STATS_OVERFLOW: DWORD = -2i32 as u32; diff --git a/src/vendor/winapi/src/um/lmsvc.rs b/src/vendor/winapi/src/um/lmsvc.rs new file mode 100644 index 0000000000..7ec8dd396d --- /dev/null +++ b/src/vendor/winapi/src/um/lmsvc.rs @@ -0,0 +1,181 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! This file contains structures, function prototypes, and definitions for the NetService API +use ctypes::{c_long}; +use shared::lmcons::NET_API_STATUS; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD}; +use um::winnt::{LPCWSTR, LPWSTR}; +STRUCT!{struct SERVICE_INFO_0 { + svci0_name: LPWSTR, +}} +pub type PSERVICE_INFO_0 = *mut SERVICE_INFO_0; +pub type LPSERVICE_INFO_0 = *mut SERVICE_INFO_0; +STRUCT!{struct SERVICE_INFO_1 { + svci1_name: LPWSTR, + svci1_status: DWORD, + svci1_code: DWORD, + svci1_pid: DWORD, +}} +pub type PSERVICE_INFO_1 = *mut SERVICE_INFO_1; +pub type LPSERVICE_INFO_1 = *mut SERVICE_INFO_1; +STRUCT!{struct SERVICE_INFO_2 { + svci2_name: LPWSTR, + svci2_status: DWORD, + svci2_code: DWORD, + svci2_pid: DWORD, + svci2_text: LPWSTR, + svci2_specific_error: DWORD, + svci2_display_name: LPWSTR, +}} +pub type PSERVICE_INFO_2 = *mut SERVICE_INFO_2; +pub type LPSERVICE_INFO_2 = *mut SERVICE_INFO_2; +extern "system" { + pub fn NetServiceControl( + servername: LPCWSTR, + service: LPCWSTR, + opcode: DWORD, + arg: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServiceEnum( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetServiceGetInfo( + servername: LPCWSTR, + service: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetServiceInstall( + servername: LPCWSTR, + service: LPCWSTR, + argc: DWORD, + argv: *mut LPCWSTR, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; +} +pub const SERVICE_INSTALL_STATE: DWORD = 0x03; +pub const SERVICE_UNINSTALLED: DWORD = 0x00; +pub const SERVICE_INSTALL_PENDING: DWORD = 0x01; +pub const SERVICE_UNINSTALL_PENDING: DWORD = 0x02; +pub const SERVICE_INSTALLED: DWORD = 0x03; +pub const SERVICE_PAUSE_STATE: DWORD = 0x0C; +pub const LM20_SERVICE_ACTIVE: DWORD = 0x00; +pub const LM20_SERVICE_CONTINUE_PENDING: DWORD = 0x04; +pub const LM20_SERVICE_PAUSE_PENDING: DWORD = 0x08; +pub const LM20_SERVICE_PAUSED: DWORD = 0x0C; +pub const SERVICE_NOT_UNINSTALLABLE: DWORD = 0x00; +pub const SERVICE_UNINSTALLABLE: DWORD = 0x10; +pub const SERVICE_NOT_PAUSABLE: DWORD = 0x00; +pub const SERVICE_PAUSABLE: DWORD = 0x20; +pub const SERVICE_REDIR_PAUSED: DWORD = 0x700; +pub const SERVICE_REDIR_DISK_PAUSED: DWORD = 0x100; +pub const SERVICE_REDIR_PRINT_PAUSED: DWORD = 0x200; +pub const SERVICE_REDIR_COMM_PAUSED: DWORD = 0x400; +pub const SERVICE_DOS_ENCRYPTION: &'static str = "ENCRYPT"; +pub const SERVICE_CTRL_INTERROGATE: DWORD = 0; +pub const SERVICE_CTRL_PAUSE: DWORD = 1; +pub const SERVICE_CTRL_CONTINUE: DWORD = 2; +pub const SERVICE_CTRL_UNINSTALL: DWORD = 3; +pub const SERVICE_CTRL_REDIR_DISK: DWORD = 0x1; +pub const SERVICE_CTRL_REDIR_PRINT: DWORD = 0x2; +pub const SERVICE_CTRL_REDIR_COMM: DWORD = 0x4; +pub const SERVICE_IP_NO_HINT: DWORD = 0x0; +pub const SERVICE_CCP_NO_HINT: DWORD = 0x0; +pub const SERVICE_IP_QUERY_HINT: DWORD = 0x10000; +pub const SERVICE_CCP_QUERY_HINT: DWORD = 0x10000; +pub const SERVICE_IP_CHKPT_NUM: DWORD = 0x0FF; +pub const SERVICE_CCP_CHKPT_NUM: DWORD = 0x0FF; +pub const SERVICE_IP_WAIT_TIME: DWORD = 0x0FF00; +pub const SERVICE_CCP_WAIT_TIME: DWORD = 0x0FF00; +pub const SERVICE_IP_WAITTIME_SHIFT: DWORD = 8; +pub const SERVICE_NTIP_WAITTIME_SHIFT: DWORD = 12; +pub const UPPER_HINT_MASK: DWORD = 0x0000FF00; +pub const LOWER_HINT_MASK: DWORD = 0x000000FF; +pub const UPPER_GET_HINT_MASK: DWORD = 0x0FF00000; +pub const LOWER_GET_HINT_MASK: DWORD = 0x0000FF00; +pub const SERVICE_NT_MAXTIME: DWORD = 0x0000FFFF; +pub const SERVICE_RESRV_MASK: DWORD = 0x0001FFFF; +pub const SERVICE_MAXTIME: DWORD = 0x000000FF; +pub const SERVICE_BASE: DWORD = 3050; +pub const SERVICE_UIC_NORMAL: DWORD = 0; +pub const SERVICE_UIC_BADPARMVAL: DWORD = SERVICE_BASE + 1; +pub const SERVICE_UIC_MISSPARM: DWORD = SERVICE_BASE + 2; +pub const SERVICE_UIC_UNKPARM: DWORD = SERVICE_BASE + 3; +pub const SERVICE_UIC_RESOURCE: DWORD = SERVICE_BASE + 4; +pub const SERVICE_UIC_CONFIG: DWORD = SERVICE_BASE + 5; +pub const SERVICE_UIC_SYSTEM: DWORD = SERVICE_BASE + 6; +pub const SERVICE_UIC_INTERNAL: DWORD = SERVICE_BASE + 7; +pub const SERVICE_UIC_AMBIGPARM: DWORD = SERVICE_BASE + 8; +pub const SERVICE_UIC_DUPPARM: DWORD = SERVICE_BASE + 9; +pub const SERVICE_UIC_KILL: DWORD = SERVICE_BASE + 10; +pub const SERVICE_UIC_EXEC: DWORD = SERVICE_BASE + 11; +pub const SERVICE_UIC_SUBSERV: DWORD = SERVICE_BASE + 12; +pub const SERVICE_UIC_CONFLPARM: DWORD = SERVICE_BASE + 13; +pub const SERVICE_UIC_FILE: DWORD = SERVICE_BASE + 14; +pub const SERVICE_UIC_M_NULL: DWORD = 0; +pub const SERVICE_UIC_M_MEMORY: DWORD = SERVICE_BASE + 20; +pub const SERVICE_UIC_M_DISK: DWORD = SERVICE_BASE + 21; +pub const SERVICE_UIC_M_THREADS: DWORD = SERVICE_BASE + 22; +pub const SERVICE_UIC_M_PROCESSES: DWORD = SERVICE_BASE + 23; +pub const SERVICE_UIC_M_SECURITY: DWORD = SERVICE_BASE + 24; +pub const SERVICE_UIC_M_LANROOT: DWORD = SERVICE_BASE + 25; +pub const SERVICE_UIC_M_REDIR: DWORD = SERVICE_BASE + 26; +pub const SERVICE_UIC_M_SERVER: DWORD = SERVICE_BASE + 27; +pub const SERVICE_UIC_M_SEC_FILE_ERR: DWORD = SERVICE_BASE + 28; +pub const SERVICE_UIC_M_FILES: DWORD = SERVICE_BASE + 29; +pub const SERVICE_UIC_M_LOGS: DWORD = SERVICE_BASE + 30; +pub const SERVICE_UIC_M_LANGROUP: DWORD = SERVICE_BASE + 31; +pub const SERVICE_UIC_M_MSGNAME: DWORD = SERVICE_BASE + 32; +pub const SERVICE_UIC_M_ANNOUNCE: DWORD = SERVICE_BASE + 33; +pub const SERVICE_UIC_M_UAS: DWORD = SERVICE_BASE + 34; +pub const SERVICE_UIC_M_SERVER_SEC_ERR: DWORD = SERVICE_BASE + 35; +pub const SERVICE_UIC_M_WKSTA: DWORD = SERVICE_BASE + 37; +pub const SERVICE_UIC_M_ERRLOG: DWORD = SERVICE_BASE + 38; +pub const SERVICE_UIC_M_FILE_UW: DWORD = SERVICE_BASE + 39; +pub const SERVICE_UIC_M_ADDPAK: DWORD = SERVICE_BASE + 40; +pub const SERVICE_UIC_M_LAZY: DWORD = SERVICE_BASE + 41; +pub const SERVICE_UIC_M_UAS_MACHINE_ACCT: DWORD = SERVICE_BASE + 42; +pub const SERVICE_UIC_M_UAS_SERVERS_NMEMB: DWORD = SERVICE_BASE + 43; +pub const SERVICE_UIC_M_UAS_SERVERS_NOGRP: DWORD = SERVICE_BASE + 44; +pub const SERVICE_UIC_M_UAS_INVALID_ROLE: DWORD = SERVICE_BASE + 45; +pub const SERVICE_UIC_M_NETLOGON_NO_DC: DWORD = SERVICE_BASE + 46; +pub const SERVICE_UIC_M_NETLOGON_DC_CFLCT: DWORD = SERVICE_BASE + 47; +pub const SERVICE_UIC_M_NETLOGON_AUTH: DWORD = SERVICE_BASE + 48; +pub const SERVICE_UIC_M_UAS_PROLOG: DWORD = SERVICE_BASE + 49; +pub const SERVICE2_BASE: DWORD = 5600; +pub const SERVICE_UIC_M_NETLOGON_MPATH: DWORD = SERVICE2_BASE + 0; +pub const SERVICE_UIC_M_LSA_MACHINE_ACCT: DWORD = SERVICE2_BASE + 1; +pub const SERVICE_UIC_M_DATABASE_ERROR: DWORD = SERVICE2_BASE + 2; +#[inline] +pub fn SERVICE_IP_CODE(tt: DWORD, nn: DWORD) -> c_long { + (SERVICE_IP_QUERY_HINT | (nn | (tt << SERVICE_IP_WAITTIME_SHIFT))) as c_long +} +#[inline] +pub fn SERVICE_CCP_CODE(tt: DWORD, nn: DWORD) -> c_long { + (SERVICE_CCP_QUERY_HINT | (nn | (tt << SERVICE_IP_WAITTIME_SHIFT))) as c_long +} +#[inline] +pub fn SERVICE_UIC_CODE(cc: DWORD, mm: DWORD) -> c_long { + ((cc << 16) | mm) as c_long +} +#[inline] +pub fn SERVICE_NT_CCP_CODE(tt: DWORD, nn: DWORD) -> c_long { + (SERVICE_CCP_QUERY_HINT | nn | ((tt & LOWER_HINT_MASK) << SERVICE_IP_WAITTIME_SHIFT) + | ((tt & UPPER_HINT_MASK) << SERVICE_NTIP_WAITTIME_SHIFT)) as c_long +} +#[inline] +pub fn SERVICE_NT_WAIT_GET(code: DWORD) -> DWORD { + ((code & UPPER_GET_HINT_MASK) >> SERVICE_NTIP_WAITTIME_SHIFT) + | ((code & LOWER_GET_HINT_MASK) >> SERVICE_IP_WAITTIME_SHIFT) +} diff --git a/src/vendor/winapi/src/um/lmuse.rs b/src/vendor/winapi/src/um/lmuse.rs new file mode 100644 index 0000000000..98e56aac5a --- /dev/null +++ b/src/vendor/winapi/src/um/lmuse.rs @@ -0,0 +1,102 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! This file contains structures, function prototypes, and definitions for the NetUse API +use shared::lmcons::{LMSTR, NET_API_STATUS}; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD, PBYTE, ULONG}; +use um::winnt::LPWSTR; +extern "system" { + pub fn NetUseAdd( + servername: LPWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUseDel( + UncServerName: LMSTR, + UseName: LMSTR, + ForceCond: DWORD, + ) -> NET_API_STATUS; + pub fn NetUseEnum( + UncServerName: LMSTR, + Level: DWORD, + BufPtr: *mut LPBYTE, + PreferedMaximumSize: DWORD, + EntriesRead: LPDWORD, + TotalEntries: LPDWORD, + ResumeHandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetUseGetInfo( + UncServerName: LMSTR, + UseName: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; +} +STRUCT!{struct USE_INFO_0 { + ui0_local: LMSTR, + ui0_remote: LMSTR, +}} +pub type PUSE_INFO_0 = *mut USE_INFO_0; +pub type LPUSE_INFO_0 = *mut USE_INFO_0; +STRUCT!{struct USE_INFO_1 { + ui1_local: LMSTR, + ui1_remote: LMSTR, + ui1_password: LMSTR, + ui1_status: DWORD, + ui1_asg_type: DWORD, + ui1_refcount: DWORD, + ui1_usecount: DWORD, +}} +pub type PUSE_INFO_1 = *mut USE_INFO_1; +pub type LPUSE_INFO_1 = *mut USE_INFO_1; +STRUCT!{struct USE_INFO_2 { + ui2_local: LMSTR, + ui2_remote: LMSTR, + ui2_password: LMSTR, + ui2_status: DWORD, + ui2_asg_type: DWORD, + ui2_refcount: DWORD, + ui2_usecount: DWORD, + ui2_username: LMSTR, + ui2_domainname: LMSTR, +}} +pub type PUSE_INFO_2 = *mut USE_INFO_2; +pub type LPUSE_INFO_2 = *mut USE_INFO_2; +STRUCT!{struct USE_INFO_3 { + ui3_ui2: USE_INFO_2, + ui3_flags: ULONG, +}} +pub type PUSE_INFO_3 = *mut USE_INFO_3; +STRUCT!{struct USE_INFO_4 { + ui4_ui3: USE_INFO_3, + ui4_auth_identity_length: DWORD, + ui4_auth_identity: PBYTE, +}} +pub type PUSE_INFO_4 = *mut USE_INFO_4; +pub type LPUSE_INFO_4 = *mut USE_INFO_4; +pub const USE_LOCAL_PARMNUM: DWORD = 1; +pub const USE_REMOTE_PARMNUM: DWORD = 2; +pub const USE_PASSWORD_PARMNUM: DWORD = 3; +pub const USE_ASGTYPE_PARMNUM: DWORD = 4; +pub const USE_USERNAME_PARMNUM: DWORD = 5; +pub const USE_DOMAINNAME_PARMNUM: DWORD = 6; +pub const USE_OK: DWORD = 0; +pub const USE_PAUSED: DWORD = 1; +pub const USE_SESSLOST: DWORD = 2; +pub const USE_DISCONN: DWORD = 2; +pub const USE_NETERR: DWORD = 3; +pub const USE_CONN: DWORD = 4; +pub const USE_RECONN: DWORD = 5; +pub const USE_WILDCARD: DWORD = -1i32 as u32; +pub const USE_DISKDEV: DWORD = 0; +pub const USE_SPOOLDEV: DWORD = 1; +pub const USE_CHARDEV: DWORD = 2; +pub const USE_IPC: DWORD = 3; +pub const CREATE_NO_CONNECT: ULONG = 0x1; +pub const CREATE_BYPASS_CSC: ULONG = 0x2; +pub const CREATE_CRED_RESET: ULONG = 0x4; +pub const USE_DEFAULT_CREDENTIALS: ULONG = 0x4; diff --git a/src/vendor/winapi/src/um/lmwksta.rs b/src/vendor/winapi/src/um/lmwksta.rs new file mode 100644 index 0000000000..128d622eae --- /dev/null +++ b/src/vendor/winapi/src/um/lmwksta.rs @@ -0,0 +1,422 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +use shared::lmcons::{LMSTR, NET_API_STATUS}; +use shared::minwindef::{BOOL, DWORD, LPBYTE, LPDWORD}; +use um::winnt::LPCWSTR; +extern "system" { + pub fn NetWkstaGetInfo( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetWkstaSetInfo( + servername: LMSTR, + level: DWORD, + buffer: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetWkstaUserGetInfo( + reserved: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + ) -> NET_API_STATUS; + pub fn NetWkstaUserSetInfo( + reserved: LMSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetWkstaUserEnum( + servername: LMSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetWkstaTransportAdd( + servername: LPCWSTR, + level: DWORD, + buf: LPBYTE, + parm_err: LPDWORD, + ) -> NET_API_STATUS; + pub fn NetWkstaTransportDel( + servername: LMSTR, + transportname: LMSTR, + ucond: DWORD, + ) -> NET_API_STATUS; + pub fn NetWkstaTransportEnum( + servername: LPCWSTR, + level: DWORD, + bufptr: *mut LPBYTE, + prefmaxlen: DWORD, + entriesread: LPDWORD, + totalentries: LPDWORD, + resumehandle: LPDWORD, + ) -> NET_API_STATUS; +} +STRUCT!{struct WKSTA_INFO_100 { + wki100_platform_id: DWORD, + wki100_computername: LMSTR, + wki100_langroup: LMSTR, + wki100_ver_major: DWORD, + wki100_ver_minor: DWORD, +}} +pub type PWKSTA_INFO_100 = *mut WKSTA_INFO_100; +pub type LPWKSTA_INFO_100 = *mut WKSTA_INFO_100; +STRUCT!{struct WKSTA_INFO_101 { + wki101_platform_id: DWORD, + wki101_computername: LMSTR, + wki101_langroup: LMSTR, + wki101_ver_major: DWORD, + wki101_ver_minor: DWORD, + wki101_lanroot: LMSTR, +}} +pub type PWKSTA_INFO_101 = *mut WKSTA_INFO_101; +pub type LPWKSTA_INFO_101 = *mut WKSTA_INFO_101; +STRUCT!{struct WKSTA_INFO_102 { + wki102_platform_id: DWORD, + wki102_computername: LMSTR, + wki102_langroup: LMSTR, + wki102_ver_major: DWORD, + wki102_ver_minor: DWORD, + wki102_lanroot: LMSTR, + wki102_logged_on_users: DWORD, +}} +pub type PWKSTA_INFO_102 = *mut WKSTA_INFO_102; +pub type LPWKSTA_INFO_102 = *mut WKSTA_INFO_102; +STRUCT!{struct WKSTA_INFO_302 { + wki302_char_wait: DWORD, + wki302_collection_time: DWORD, + wki302_maximum_collection_count: DWORD, + wki302_keep_conn: DWORD, + wki302_keep_search: DWORD, + wki302_max_cmds: DWORD, + wki302_num_work_buf: DWORD, + wki302_siz_work_buf: DWORD, + wki302_max_wrk_cache: DWORD, + wki302_sess_timeout: DWORD, + wki302_siz_error: DWORD, + wki302_num_alerts: DWORD, + wki302_num_services: DWORD, + wki302_errlog_sz: DWORD, + wki302_print_buf_time: DWORD, + wki302_num_char_buf: DWORD, + wki302_siz_char_buf: DWORD, + wki302_wrk_heuristics: LMSTR, + wki302_mailslots: DWORD, + wki302_num_dgram_buf: DWORD, +}} +pub type PWKSTA_INFO_302 = *mut WKSTA_INFO_302; +pub type LPWKSTA_INFO_302 = *mut WKSTA_INFO_302; +STRUCT!{struct WKSTA_INFO_402 { + wki402_char_wait: DWORD, + wki402_collection_time: DWORD, + wki402_maximum_collection_count: DWORD, + wki402_keep_conn: DWORD, + wki402_keep_search: DWORD, + wki402_max_cmds: DWORD, + wki402_num_work_buf: DWORD, + wki402_siz_work_buf: DWORD, + wki402_max_wrk_cache: DWORD, + wki402_sess_timeout: DWORD, + wki402_siz_error: DWORD, + wki402_num_alerts: DWORD, + wki402_num_services: DWORD, + wki402_errlog_sz: DWORD, + wki402_print_buf_time: DWORD, + wki402_num_char_buf: DWORD, + wki402_siz_char_buf: DWORD, + wki402_wrk_heuristics: LMSTR, + wki402_mailslots: DWORD, + wki402_num_dgram_buf: DWORD, + wki402_max_threads: DWORD, +}} +pub type PWKSTA_INFO_402 = *mut WKSTA_INFO_402; +pub type LPWKSTA_INFO_402 = *mut WKSTA_INFO_402; +STRUCT!{struct WKSTA_INFO_502 { + wki502_char_wait: DWORD, + wki502_collection_time: DWORD, + wki502_maximum_collection_count: DWORD, + wki502_keep_conn: DWORD, + wki502_max_cmds: DWORD, + wki502_sess_timeout: DWORD, + wki502_siz_char_buf: DWORD, + wki502_max_threads: DWORD, + wki502_lock_quota: DWORD, + wki502_lock_increment: DWORD, + wki502_lock_maximum: DWORD, + wki502_pipe_increment: DWORD, + wki502_pipe_maximum: DWORD, + wki502_cache_file_timeout: DWORD, + wki502_dormant_file_limit: DWORD, + wki502_read_ahead_throughput: DWORD, + wki502_num_mailslot_buffers: DWORD, + wki502_num_srv_announce_buffers: DWORD, + wki502_max_illegal_datagram_events: DWORD, + wki502_illegal_datagram_event_reset_frequency: DWORD, + wki502_log_election_packets: BOOL, + wki502_use_opportunistic_locking: BOOL, + wki502_use_unlock_behind: BOOL, + wki502_use_close_behind: BOOL, + wki502_buf_named_pipes: BOOL, + wki502_use_lock_read_unlock: BOOL, + wki502_utilize_nt_caching: BOOL, + wki502_use_raw_read: BOOL, + wki502_use_raw_write: BOOL, + wki502_use_write_raw_data: BOOL, + wki502_use_encryption: BOOL, + wki502_buf_files_deny_write: BOOL, + wki502_buf_read_only_files: BOOL, + wki502_force_core_create_mode: BOOL, + wki502_use_512_byte_max_transfer: BOOL, +}} +pub type PWKSTA_INFO_502 = *mut WKSTA_INFO_502; +pub type LPWKSTA_INFO_502 = *mut WKSTA_INFO_502; +STRUCT!{struct WKSTA_INFO_1010 { + wki1010_char_wait: DWORD, +}} +pub type PWKSTA_INFO_1010 = *mut WKSTA_INFO_1010; +pub type LPWKSTA_INFO_1010 = *mut WKSTA_INFO_1010; +STRUCT!{struct WKSTA_INFO_1011 { + wki1011_collection_time: DWORD, +}} +pub type PWKSTA_INFO_1011 = *mut WKSTA_INFO_1011; +pub type LPWKSTA_INFO_1011 = *mut WKSTA_INFO_1011; +STRUCT!{struct WKSTA_INFO_1012 { + wki1012_maximum_collection_count: DWORD, +}} +pub type PWKSTA_INFO_1012 = *mut WKSTA_INFO_1012; +pub type LPWKSTA_INFO_1012 = *mut WKSTA_INFO_1012; +STRUCT!{struct WKSTA_INFO_1027 { + wki1027_errlog_sz: DWORD, +}} +pub type PWKSTA_INFO_1027 = *mut WKSTA_INFO_1027; +pub type LPWKSTA_INFO_1027 = *mut WKSTA_INFO_1027; +STRUCT!{struct WKSTA_INFO_1028 { + wki1028_print_buf_time: DWORD, +}} +pub type PWKSTA_INFO_1028 = *mut WKSTA_INFO_1028; +pub type LPWKSTA_INFO_1028 = *mut WKSTA_INFO_1028; +STRUCT!{struct WKSTA_INFO_1032 { + wki1032_wrk_heuristics: DWORD, +}} +pub type PWKSTA_INFO_1032 = *mut WKSTA_INFO_1032; +pub type LPWKSTA_INFO_1032 = *mut WKSTA_INFO_1032; +STRUCT!{struct WKSTA_INFO_1013 { + wki1013_keep_conn: DWORD, +}} +pub type PWKSTA_INFO_1013 = *mut WKSTA_INFO_1013; +pub type LPWKSTA_INFO_1013 = *mut WKSTA_INFO_1013; +STRUCT!{struct WKSTA_INFO_1018 { + wki1018_sess_timeout: DWORD, +}} +pub type PWKSTA_INFO_1018 = *mut WKSTA_INFO_1018; +pub type LPWKSTA_INFO_1018 = *mut WKSTA_INFO_1018; +STRUCT!{struct WKSTA_INFO_1023 { + wki1023_siz_char_buf: DWORD, +}} +pub type PWKSTA_INFO_1023 = *mut WKSTA_INFO_1023; +pub type LPWKSTA_INFO_1023 = *mut WKSTA_INFO_1023; +STRUCT!{struct WKSTA_INFO_1033 { + wki1033_max_threads: DWORD, +}} +pub type PWKSTA_INFO_1033 = *mut WKSTA_INFO_1033; +pub type LPWKSTA_INFO_1033 = *mut WKSTA_INFO_1033; +STRUCT!{struct WKSTA_INFO_1041 { + wki1041_lock_quota: DWORD, +}} +pub type PWKSTA_INFO_1041 = *mut WKSTA_INFO_1041; +pub type LPWKSTA_INFO_1041 = *mut WKSTA_INFO_1041; +STRUCT!{struct WKSTA_INFO_1042 { + wki1042_lock_increment: DWORD, +}} +pub type PWKSTA_INFO_1042 = *mut WKSTA_INFO_1042; +pub type LPWKSTA_INFO_1042 = *mut WKSTA_INFO_1042; +STRUCT!{struct WKSTA_INFO_1043 { + wki1043_lock_maximum: DWORD, +}} +pub type PWKSTA_INFO_1043 = *mut WKSTA_INFO_1043; +pub type LPWKSTA_INFO_1043 = *mut WKSTA_INFO_1043; +STRUCT!{struct WKSTA_INFO_1044 { + wki1044_pipe_increment: DWORD, +}} +pub type PWKSTA_INFO_1044 = *mut WKSTA_INFO_1044; +pub type LPWKSTA_INFO_1044 = *mut WKSTA_INFO_1044; +STRUCT!{struct WKSTA_INFO_1045 { + wki1045_pipe_maximum: DWORD, +}} +pub type PWKSTA_INFO_1045 = *mut WKSTA_INFO_1045; +pub type LPWKSTA_INFO_1045 = *mut WKSTA_INFO_1045; +STRUCT!{struct WKSTA_INFO_1046 { + wki1046_dormant_file_limit: DWORD, +}} +pub type PWKSTA_INFO_1046 = *mut WKSTA_INFO_1046; +pub type LPWKSTA_INFO_1046 = *mut WKSTA_INFO_1046; +STRUCT!{struct WKSTA_INFO_1047 { + wki1047_cache_file_timeout: DWORD, +}} +pub type PWKSTA_INFO_1047 = *mut WKSTA_INFO_1047; +pub type LPWKSTA_INFO_1047 = *mut WKSTA_INFO_1047; +STRUCT!{struct WKSTA_INFO_1048 { + wki1048_use_opportunistic_locking: BOOL, +}} +pub type PWKSTA_INFO_1048 = *mut WKSTA_INFO_1048; +pub type LPWKSTA_INFO_1048 = *mut WKSTA_INFO_1048; +STRUCT!{struct WKSTA_INFO_1049 { + wki1049_use_unlock_behind: BOOL, +}} +pub type PWKSTA_INFO_1049 = *mut WKSTA_INFO_1049; +pub type LPWKSTA_INFO_1049 = *mut WKSTA_INFO_1049; +STRUCT!{struct WKSTA_INFO_1050 { + wki1050_use_close_behind: BOOL, +}} +pub type PWKSTA_INFO_1050 = *mut WKSTA_INFO_1050; +pub type LPWKSTA_INFO_1050 = *mut WKSTA_INFO_1050; +STRUCT!{struct WKSTA_INFO_1051 { + wki1051_buf_named_pipes: BOOL, +}} +pub type PWKSTA_INFO_1051 = *mut WKSTA_INFO_1051; +pub type LPWKSTA_INFO_1051 = *mut WKSTA_INFO_1051; +STRUCT!{struct WKSTA_INFO_1052 { + wki1052_use_lock_read_unlock: BOOL, +}} +pub type PWKSTA_INFO_1052 = *mut WKSTA_INFO_1052; +pub type LPWKSTA_INFO_1052 = *mut WKSTA_INFO_1052; +STRUCT!{struct WKSTA_INFO_1053 { + wki1053_utilize_nt_caching: BOOL, +}} +pub type PWKSTA_INFO_1053 = *mut WKSTA_INFO_1053; +pub type LPWKSTA_INFO_1053 = *mut WKSTA_INFO_1053; +STRUCT!{struct WKSTA_INFO_1054 { + wki1054_use_raw_read: BOOL, +}} +pub type PWKSTA_INFO_1054 = *mut WKSTA_INFO_1054; +pub type LPWKSTA_INFO_1054 = *mut WKSTA_INFO_1054; +STRUCT!{struct WKSTA_INFO_1055 { + wki1055_use_raw_write: BOOL, +}} +pub type PWKSTA_INFO_1055 = *mut WKSTA_INFO_1055; +pub type LPWKSTA_INFO_1055 = *mut WKSTA_INFO_1055; +STRUCT!{struct WKSTA_INFO_1056 { + wki1056_use_write_raw_data: BOOL, +}} +pub type PWKSTA_INFO_1056 = *mut WKSTA_INFO_1056; +pub type LPWKSTA_INFO_1056 = *mut WKSTA_INFO_1056; +STRUCT!{struct WKSTA_INFO_1057 { + wki1057_use_encryption: BOOL, +}} +pub type PWKSTA_INFO_1057 = *mut WKSTA_INFO_1057; +pub type LPWKSTA_INFO_1057 = *mut WKSTA_INFO_1057; +STRUCT!{struct WKSTA_INFO_1058 { + wki1058_buf_files_deny_write: BOOL, +}} +pub type PWKSTA_INFO_1058 = *mut WKSTA_INFO_1058; +pub type LPWKSTA_INFO_1058 = *mut WKSTA_INFO_1058; +STRUCT!{struct WKSTA_INFO_1059 { + wki1059_buf_read_only_files: BOOL, +}} +pub type PWKSTA_INFO_1059 = *mut WKSTA_INFO_1059; +pub type LPWKSTA_INFO_1059 = *mut WKSTA_INFO_1059; +STRUCT!{struct WKSTA_INFO_1060 { + wki1060_force_core_create_mode: BOOL, +}} +pub type PWKSTA_INFO_1060 = *mut WKSTA_INFO_1060; +pub type LPWKSTA_INFO_1060 = *mut WKSTA_INFO_1060; +STRUCT!{struct WKSTA_INFO_1061 { + wki1061_use_512_byte_max_transfer: BOOL, +}} +pub type PWKSTA_INFO_1061 = *mut WKSTA_INFO_1061; +pub type LPWKSTA_INFO_1061 = *mut WKSTA_INFO_1061; +STRUCT!{struct WKSTA_INFO_1062 { + wki1062_read_ahead_throughput: DWORD, +}} +pub type PWKSTA_INFO_1062 = *mut WKSTA_INFO_1062; +pub type LPWKSTA_INFO_1062 = *mut WKSTA_INFO_1062; +STRUCT!{struct WKSTA_USER_INFO_0 { + wkui0_username: LMSTR, +}} +pub type PWKSTA_USER_INFO_0 = *mut WKSTA_USER_INFO_0; +pub type LPWKSTA_USER_INFO_0 = *mut WKSTA_USER_INFO_0; +STRUCT!{struct WKSTA_USER_INFO_1 { + wkui1_username: LMSTR, + wkui1_logon_domain: LMSTR, + wkui1_oth_domains: LMSTR, + wkui1_logon_server: LMSTR, +}} +pub type PWKSTA_USER_INFO_1 = *mut WKSTA_USER_INFO_1; +pub type LPWKSTA_USER_INFO_1 = *mut WKSTA_USER_INFO_1; +STRUCT!{struct WKSTA_USER_INFO_1101 { + wkui1101_oth_domains: LMSTR, +}} +pub type PWKSTA_USER_INFO_1101 = *mut WKSTA_USER_INFO_1101; +pub type LPWKSTA_USER_INFO_1101 = *mut WKSTA_USER_INFO_1101; +STRUCT!{struct WKSTA_TRANSPORT_INFO_0 { + wkti0_quality_of_service: DWORD, + wkti0_number_of_vcs: DWORD, + wkti0_transport_name: LMSTR, + wkti0_transport_address: LMSTR, + wkti0_wan_ish: BOOL, +}} +pub type PWKSTA_TRANSPORT_INFO_0 = *mut WKSTA_TRANSPORT_INFO_0; +pub type LPWKSTA_TRANSPORT_INFO_0 = *mut WKSTA_TRANSPORT_INFO_0; +pub const WKSTA_PLATFORM_ID_PARMNUM: DWORD = 100; +pub const WKSTA_COMPUTERNAME_PARMNUM: DWORD = 1; +pub const WKSTA_LANGROUP_PARMNUM: DWORD = 2; +pub const WKSTA_VER_MAJOR_PARMNUM: DWORD = 4; +pub const WKSTA_VER_MINOR_PARMNUM: DWORD = 5; +pub const WKSTA_LOGGED_ON_USERS_PARMNUM: DWORD = 6; +pub const WKSTA_LANROOT_PARMNUM: DWORD = 7; +pub const WKSTA_LOGON_DOMAIN_PARMNUM: DWORD = 8; +pub const WKSTA_LOGON_SERVER_PARMNUM: DWORD = 9; +pub const WKSTA_CHARWAIT_PARMNUM: DWORD = 10; +pub const WKSTA_CHARTIME_PARMNUM: DWORD = 11; +pub const WKSTA_CHARCOUNT_PARMNUM: DWORD = 12; +pub const WKSTA_KEEPCONN_PARMNUM: DWORD = 13; +pub const WKSTA_KEEPSEARCH_PARMNUM: DWORD = 14; +pub const WKSTA_MAXCMDS_PARMNUM: DWORD = 15; +pub const WKSTA_NUMWORKBUF_PARMNUM: DWORD = 16; +pub const WKSTA_MAXWRKCACHE_PARMNUM: DWORD = 17; +pub const WKSTA_SESSTIMEOUT_PARMNUM: DWORD = 18; +pub const WKSTA_SIZERROR_PARMNUM: DWORD = 19; +pub const WKSTA_NUMALERTS_PARMNUM: DWORD = 20; +pub const WKSTA_NUMSERVICES_PARMNUM: DWORD = 21; +pub const WKSTA_NUMCHARBUF_PARMNUM: DWORD = 22; +pub const WKSTA_SIZCHARBUF_PARMNUM: DWORD = 23; +pub const WKSTA_ERRLOGSZ_PARMNUM: DWORD = 27; +pub const WKSTA_PRINTBUFTIME_PARMNUM: DWORD = 28; +pub const WKSTA_SIZWORKBUF_PARMNUM: DWORD = 29; +pub const WKSTA_MAILSLOTS_PARMNUM: DWORD = 30; +pub const WKSTA_NUMDGRAMBUF_PARMNUM: DWORD = 31; +pub const WKSTA_WRKHEURISTICS_PARMNUM: DWORD = 32; +pub const WKSTA_MAXTHREADS_PARMNUM: DWORD = 33; +pub const WKSTA_LOCKQUOTA_PARMNUM: DWORD = 41; +pub const WKSTA_LOCKINCREMENT_PARMNUM: DWORD = 42; +pub const WKSTA_LOCKMAXIMUM_PARMNUM: DWORD = 43; +pub const WKSTA_PIPEINCREMENT_PARMNUM: DWORD = 44; +pub const WKSTA_PIPEMAXIMUM_PARMNUM: DWORD = 45; +pub const WKSTA_DORMANTFILELIMIT_PARMNUM: DWORD = 46; +pub const WKSTA_CACHEFILETIMEOUT_PARMNUM: DWORD = 47; +pub const WKSTA_USEOPPORTUNISTICLOCKING_PARMNUM: DWORD = 48; +pub const WKSTA_USEUNLOCKBEHIND_PARMNUM: DWORD = 49; +pub const WKSTA_USECLOSEBEHIND_PARMNUM: DWORD = 50; +pub const WKSTA_BUFFERNAMEDPIPES_PARMNUM: DWORD = 51; +pub const WKSTA_USELOCKANDREADANDUNLOCK_PARMNUM: DWORD = 52; +pub const WKSTA_UTILIZENTCACHING_PARMNUM: DWORD = 53; +pub const WKSTA_USERAWREAD_PARMNUM: DWORD = 54; +pub const WKSTA_USERAWWRITE_PARMNUM: DWORD = 55; +pub const WKSTA_USEWRITERAWWITHDATA_PARMNUM: DWORD = 56; +pub const WKSTA_USEENCRYPTION_PARMNUM: DWORD = 57; +pub const WKSTA_BUFFILESWITHDENYWRITE_PARMNUM: DWORD = 58; +pub const WKSTA_BUFFERREADONLYFILES_PARMNUM: DWORD = 59; +pub const WKSTA_FORCECORECREATEMODE_PARMNUM: DWORD = 60; +pub const WKSTA_USE512BYTESMAXTRANSFER_PARMNUM: DWORD = 61; +pub const WKSTA_READAHEADTHRUPUT_PARMNUM: DWORD = 62; +pub const WKSTA_OTH_DOMAINS_PARMNUM: DWORD = 101; +pub const TRANSPORT_QUALITYOFSERVICE_PARMNUM: DWORD = 201; +pub const TRANSPORT_NAME_PARMNUM: DWORD = 202; diff --git a/src/vendor/winapi/src/um/lsalookup.rs b/src/vendor/winapi/src/um/lsalookup.rs new file mode 100644 index 0000000000..635e8af694 --- /dev/null +++ b/src/vendor/winapi/src/um/lsalookup.rs @@ -0,0 +1,76 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! LSA Policy Lookup API +use shared::guiddef::{GUID}; +use shared::minwindef::{ULONG, USHORT}; +use um::winnt::{ACCESS_MASK, HANDLE, LONG, PCHAR, PSID, PVOID, PWSTR, SID_NAME_USE}; +STRUCT!{struct LSA_UNICODE_STRING { + Length: USHORT, + MaximumLength: USHORT, + Buffer: PWSTR, +}} +pub type PLSA_UNICODE_STRING = *mut LSA_UNICODE_STRING; +STRUCT!{struct LSA_STRING { + Length: USHORT, + MaximumLength: USHORT, + Buffer: PCHAR, +}} +pub type PLSA_STRING = *mut LSA_STRING; +STRUCT!{struct LSA_OBJECT_ATTRIBUTES { + Length: ULONG, + RootDirectory: HANDLE, + ObjectName: PLSA_UNICODE_STRING, + Attributes: ULONG, + SecurityDescriptor: PVOID, + SecurityQualityOfService: PVOID, +}} +pub type PLSA_OBJECT_ATTRIBUTES = *mut LSA_OBJECT_ATTRIBUTES; +STRUCT!{struct LSA_TRUST_INFORMATION { + Name: LSA_UNICODE_STRING, + Sid: PSID, +}} +pub type PLSA_TRUST_INFORMATION = *mut LSA_TRUST_INFORMATION; +STRUCT!{struct LSA_REFERENCED_DOMAIN_LIST { + Entries: ULONG, + Domains: PLSA_TRUST_INFORMATION, +}} +pub type PLSA_REFERENCED_DOMAIN_LIST = *mut LSA_REFERENCED_DOMAIN_LIST; +STRUCT!{struct LSA_TRANSLATED_SID2 { + Use: SID_NAME_USE, + Sid: PSID, + DomainIndex: LONG, + Flags: ULONG, +}} +pub type PLSA_TRANSLATED_SID2 = *mut LSA_TRANSLATED_SID2; +STRUCT!{struct LSA_TRANSLATED_NAME { + Use: SID_NAME_USE, + Name: LSA_UNICODE_STRING, + DomainIndex: LONG, +}} +pub type PLSA_TRANSLATED_NAME = *mut LSA_TRANSLATED_NAME; +STRUCT!{struct POLICY_ACCOUNT_DOMAIN_INFO { + DomainName: LSA_UNICODE_STRING, + DomainSid: PSID, +}} +pub type PPOLICY_ACCOUNT_DOMAIN_INFO = *mut POLICY_ACCOUNT_DOMAIN_INFO; +STRUCT!{struct POLICY_DNS_DOMAIN_INFO { + Name: LSA_UNICODE_STRING, + DnsDomainName: LSA_UNICODE_STRING, + DnsForestName: LSA_UNICODE_STRING, + DomainGuid: GUID, + Sid: PSID, +}} +pub type PPOLICY_DNS_DOMAIN_INFO = *mut POLICY_DNS_DOMAIN_INFO; +pub const LOOKUP_VIEW_LOCAL_INFORMATION: ACCESS_MASK = 0x00000001; +pub const LOOKUP_TRANSLATE_NAMES: ACCESS_MASK = 0x00000800; +ENUM!{enum LSA_LOOKUP_DOMAIN_INFO_CLASS { + AccountDomainInformation = 5, + DnsDomainInformation = 12, +}} +pub type PLSA_LOOKUP_DOMAIN_INFO_CLASS = *mut LSA_LOOKUP_DOMAIN_INFO_CLASS; +pub type LSA_LOOKUP_HANDLE = PVOID; +pub type PLSA_LOOKUP_HANDLE = *mut PVOID; diff --git a/src/vendor/winapi/src/um/memoryapi.rs b/src/vendor/winapi/src/um/memoryapi.rs new file mode 100644 index 0000000000..993418e127 --- /dev/null +++ b/src/vendor/winapi/src/um/memoryapi.rs @@ -0,0 +1,391 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-memory-l1-1-0 +use ctypes::c_void; +use shared::basetsd::{PSIZE_T, PULONG_PTR, SIZE_T, ULONG64, ULONG_PTR}; +use shared::minwindef::{ + BOOL, DWORD, LPCVOID, LPDWORD, LPVOID, PBOOL, PDWORD, PULONG, UINT, ULONG, +}; +use um::minwinbase::{LPSECURITY_ATTRIBUTES, PSECURITY_ATTRIBUTES}; +use um::winnt::{ + HANDLE, LPCWSTR, PCWSTR, PMEMORY_BASIC_INFORMATION, PVOID, SECTION_ALL_ACCESS, + SECTION_MAP_EXECUTE_EXPLICIT, SECTION_MAP_READ, SECTION_MAP_WRITE, +}; +pub const FILE_MAP_WRITE: DWORD = SECTION_MAP_WRITE; +pub const FILE_MAP_READ: DWORD = SECTION_MAP_READ; +pub const FILE_MAP_ALL_ACCESS: DWORD = SECTION_ALL_ACCESS; +pub const FILE_MAP_EXECUTE: DWORD = SECTION_MAP_EXECUTE_EXPLICIT; +pub const FILE_MAP_COPY: DWORD = 0x00000001; +pub const FILE_MAP_RESERVE: DWORD = 0x80000000; +pub const FILE_MAP_TARGETS_INVALID: DWORD = 0x40000000; +pub const FILE_MAP_LARGE_PAGES: DWORD = 0x20000000; +extern "system" { + pub fn VirtualAlloc( + lpAddress: LPVOID, + dwSize: SIZE_T, + flAllocationType: DWORD, + flProtect: DWORD, + ) -> LPVOID; + pub fn VirtualProtect( + lpAddress: LPVOID, + dwSize: SIZE_T, + flNewProtect: DWORD, + lpflOldProtect: PDWORD, + ) -> BOOL; + pub fn VirtualFree( + lpAddress: LPVOID, + dwSize: SIZE_T, + dwFreeType: DWORD, + ) -> BOOL; + pub fn VirtualQuery( + lpAddress: LPCVOID, + lpBuffer: PMEMORY_BASIC_INFORMATION, + dwLength: SIZE_T, + ) -> SIZE_T; + pub fn VirtualAllocEx( + hProcess: HANDLE, + lpAddress: LPVOID, + dwSize: SIZE_T, + flAllocationType: DWORD, + flProtect: DWORD, + ) -> LPVOID; + pub fn VirtualFreeEx( + hProcess: HANDLE, + lpAddress: LPVOID, + dwSize: SIZE_T, + dwFreeType: DWORD, + ) -> BOOL; + pub fn VirtualProtectEx( + hProcess: HANDLE, + lpAddress: LPVOID, + dwSize: SIZE_T, + flNewProtect: DWORD, + lpflOldProtect: PDWORD, + ) -> BOOL; + pub fn VirtualQueryEx( + hProcess: HANDLE, + lpAddress: LPCVOID, + lpBuffer: PMEMORY_BASIC_INFORMATION, + dwLength: SIZE_T, + ) -> SIZE_T; + pub fn ReadProcessMemory( + hProcess: HANDLE, + lpBaseAddress: LPCVOID, + lpBuffer: LPVOID, + nSize: SIZE_T, + lpNumberOfBytesRead: *mut SIZE_T, + ) -> BOOL; + pub fn WriteProcessMemory( + hProcess: HANDLE, + lpBaseAddress: LPVOID, + lpBuffer: LPCVOID, + nSize: SIZE_T, + lpNumberOfBytesWritten: *mut SIZE_T, + ) -> BOOL; + pub fn CreateFileMappingW( + hFile: HANDLE, + lpFileMappingAttributes: LPSECURITY_ATTRIBUTES, + flProtect: DWORD, + dwMaximumSizeHigh: DWORD, + dwMaximumSizeLow: DWORD, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn OpenFileMappingW( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn MapViewOfFile( + hFileMappingObject: HANDLE, + dwDesiredAccess: DWORD, + dwFileOffsetHigh: DWORD, + dwFileOffsetLow: DWORD, + dwNumberOfBytesToMap: SIZE_T, + ) -> LPVOID; + pub fn MapViewOfFileEx( + hFileMappingObject: HANDLE, + dwDesiredAccess: DWORD, + dwFileOffsetHigh: DWORD, + dwFileOffsetLow: DWORD, + dwNumberOfBytesToMap: SIZE_T, + lpBaseAddress: LPVOID, + ) -> LPVOID; + pub fn FlushViewOfFile( + lpBaseAddress: LPCVOID, + dwNumberOfBytesToFlush: SIZE_T, + ) -> BOOL; + pub fn UnmapViewOfFile( + lpBaseAddress: LPCVOID, + ) -> BOOL; + pub fn GetLargePageMinimum() -> SIZE_T; + pub fn GetProcessWorkingSetSizeEx( + hProcess: HANDLE, + lpMinimumWorkingSetSize: PSIZE_T, + lpMaximumWorkingSetSize: PSIZE_T, + Flags: PDWORD, + ) -> BOOL; + pub fn SetProcessWorkingSetSizeEx( + hProcess: HANDLE, + dwMinimumWorkingSetSize: SIZE_T, + dwMaximumWorkingSetSize: SIZE_T, + Flags: DWORD, + ) -> BOOL; + pub fn VirtualLock( + lpAddress: LPVOID, + dwSize: SIZE_T, + ) -> BOOL; + pub fn VirtualUnlock( + lpAddress: LPVOID, + dwSize: SIZE_T, + ) -> BOOL; + pub fn GetWriteWatch( + dwFlags: DWORD, + lpBaseAddress: PVOID, + dwRegionSize: SIZE_T, + lpAddresses: *mut PVOID, + lpdwCount: *mut ULONG_PTR, + lpdwGranularity: LPDWORD, + ) -> UINT; + pub fn ResetWriteWatch( + lpBaseAddress: LPVOID, + dwRegionSize: SIZE_T, + ) -> UINT; +} +ENUM!{enum MEMORY_RESOURCE_NOTIFICATION_TYPE { + LowMemoryResourceNotification, + HighMemoryResourceNotification, +}} +extern "system" { + pub fn CreateMemoryResourceNotification( + NotificationType: MEMORY_RESOURCE_NOTIFICATION_TYPE, + ) -> HANDLE; + pub fn QueryMemoryResourceNotification( + ResourceNotificationHandle: HANDLE, + ResourceState: PBOOL, + ) -> BOOL; +} +pub const FILE_CACHE_MAX_HARD_ENABLE: DWORD = 0x00000001; +pub const FILE_CACHE_MAX_HARD_DISABLE: DWORD = 0x00000002; +pub const FILE_CACHE_MIN_HARD_ENABLE: DWORD = 0x00000004; +pub const FILE_CACHE_MIN_HARD_DISABLE: DWORD = 0x00000008; +extern "system" { + pub fn GetSystemFileCacheSize( + lpMinimumFileCacheSize: PSIZE_T, + lpMaximumFileCacheSize: PSIZE_T, + lpFlags: PDWORD, + ) -> BOOL; + pub fn SetSystemFileCacheSize( + MinimumFileCacheSize: SIZE_T, + MaximumFileCacheSize: SIZE_T, + Flags: DWORD, + ) -> BOOL; + pub fn CreateFileMappingNumaW( + hFile: HANDLE, + lpFileMappingAttributes: LPSECURITY_ATTRIBUTES, + flProtect: DWORD, + dwMaximumSizeHigh: DWORD, + dwMaximumSizeLow: DWORD, + lpName: LPCWSTR, + nndPreferred: DWORD, + ) -> HANDLE; +} +STRUCT!{struct WIN32_MEMORY_RANGE_ENTRY { + VirtualAddress: PVOID, + NumberOfBytes: SIZE_T, +}} +pub type PWIN32_MEMORY_RANGE_ENTRY = *mut WIN32_MEMORY_RANGE_ENTRY; +extern "system" { + pub fn PrefetchVirtualMemory( + hProcess: HANDLE, + NumberOfEntries: ULONG_PTR, + VirtualAddresses: PWIN32_MEMORY_RANGE_ENTRY, + Flags: ULONG, + ) -> BOOL; + pub fn CreateFileMappingFromApp( + hFile: HANDLE, + SecurityAttributes: PSECURITY_ATTRIBUTES, + PageProtection: ULONG, + MaximumSize: ULONG64, + Name: PCWSTR, + ) -> HANDLE; + pub fn MapViewOfFileFromApp( + hFileMappingObject: HANDLE, + DesiredAccess: ULONG, + FileOffset: ULONG64, + NumberOfBytesToMap: SIZE_T, + ) -> PVOID; + pub fn UnmapViewOfFileEx( + BaseAddress: PVOID, + UnmapFlags: ULONG, + ) -> BOOL; + pub fn AllocateUserPhysicalPages( + hProcess: HANDLE, + NumberOfPages: PULONG_PTR, + PageArray: PULONG_PTR, + ) -> BOOL; + pub fn FreeUserPhysicalPages( + hProcess: HANDLE, + NumberOfPages: PULONG_PTR, + PageArray: PULONG_PTR, + ) -> BOOL; + pub fn MapUserPhysicalPages( + VirtualAddress: PVOID, + NumberOfPages: ULONG_PTR, + PageArray: PULONG_PTR, + ) -> BOOL; + pub fn AllocateUserPhysicalPagesNuma( + hProcess: HANDLE, + NumberOfPages: PULONG_PTR, + PageArray: PULONG_PTR, + nndPreferred: DWORD, + ) -> BOOL; + pub fn VirtualAllocExNuma( + hProcess: HANDLE, + lpAddress: LPVOID, + dwSize: SIZE_T, + flAllocationType: DWORD, + flProtect: DWORD, + nndPreferred: DWORD, + ) -> LPVOID; +} +pub const MEHC_PATROL_SCRUBBER_PRESENT: ULONG = 0x1; +extern "system" { + pub fn GetMemoryErrorHandlingCapabilities( + Capabilities: PULONG, + ) -> BOOL; +} +FN!{stdcall PBAD_MEMORY_CALLBACK_ROUTINE() -> ()} +extern "system" { + pub fn RegisterBadMemoryNotification( + Callback: PBAD_MEMORY_CALLBACK_ROUTINE, + ) -> PVOID; + pub fn UnregisterBadMemoryNotification( + RegistrationHandle: PVOID, + ) -> BOOL; +} +ENUM!{enum OFFER_PRIORITY { + VmOfferPriorityVeryLow = 1, + VmOfferPriorityLow, + VmOfferPriorityBelowNormal, + VmOfferPriorityNormal, +}} +extern "system" { + pub fn OfferVirtualMemory( + VirtualAddress: PVOID, + Size: SIZE_T, + Priority: OFFER_PRIORITY, + ) -> DWORD; + pub fn ReclaimVirtualMemory( + VirtualAddress: *const c_void, + Size: SIZE_T, + ) -> DWORD; + pub fn DiscardVirtualMemory( + VirtualAddress: PVOID, + Size: SIZE_T, + ) -> DWORD; +// TODO: Needs winnt::PCFG_CALL_TARGET_INFO. +/* pub fn SetProcessValidCallTargets( + hProcess: HANDLE, + VirtualAddress: PVOID, + RegionSize: SIZE_T, + NumberOfOffsets: ULONG, + OffsetInformation: PCFG_CALL_TARGET_INFO, + ) -> BOOL; */ + pub fn VirtualAllocFromApp( + BaseAddress: PVOID, + Size: SIZE_T, + AllocationType: ULONG, + Protection: ULONG, + ) -> PVOID; + pub fn VirtualProtectFromApp( + Address: PVOID, + Size: SIZE_T, + NewProtection: ULONG, + OldProtection: PULONG, + ) -> BOOL; + pub fn OpenFileMappingFromApp( + DesiredAccess: ULONG, + InheritHandle: BOOL, + Name: PCWSTR, + ) -> HANDLE; +} +// TODO: Under WINAPI_PARTITION_APP, define CreateFileMappingW, MapViewOfFile, VirtualAlloc, +// VirtualProtect, and OpenFileMappingW as wrappers around the *FromApp functions. +ENUM!{enum WIN32_MEMORY_INFORMATION_CLASS { + MemoryRegionInfo, +}} +STRUCT!{struct WIN32_MEMORY_REGION_INFORMATION { + AllocationBase: PVOID, + AllocationProtect: ULONG, + u: WIN32_MEMORY_REGION_INFORMATION_u, + RegionSize: SIZE_T, + CommitSize: SIZE_T, +}} +UNION!{union WIN32_MEMORY_REGION_INFORMATION_u { + [u32; 1], + Flags Flags_mut: ULONG, + s s_mut: WIN32_MEMORY_REGION_INFORMATION_u_s, +}} +STRUCT!{struct WIN32_MEMORY_REGION_INFORMATION_u_s { + Bitfield: ULONG, +}} +BITFIELD!{WIN32_MEMORY_REGION_INFORMATION_u_s Bitfield: ULONG [ + Private set_Private[0..1], + MappedDataFile set_MappedDataFile[1..2], + MappedImage set_MappedImage[2..3], + MappedPageFile set_MappedPageFile[3..4], + MappedPhysical set_MappedPhysical[4..5], + DirectMapped set_DirectMapped[5..6], + Reserved set_Reserved[6..32], +]} +// TODO: Need to resolve issue #323 first. +/*extern "system" { + pub fn QueryVirtualMemoryInformation( + Process: HANDLE, + VirtualAddress: *const VOID, + MemoryInformationClass: WIN32_MEMORY_INFORMATION_CLASS, + MemoryInformation: PVOID, + MemoryInformationSize: SIZE_T, + ReturnSize: PSIZE_T, + ) -> BOOL; + pub fn MapViewOfFileNuma2( + FileMappingHandle: HANDLE, + ProcessHandle: HANDLE, + Offset: ULONG64, + BaseAddress: PVOID, + ViewSize: SIZE_T, + AllocationType: ULONG, + PageProtection: ULONG, + PreferredNode: ULONG, + ) -> PVOID; +} +#[inline] +pub unsafe fn MapViewOfFile2( + FileMappingHandle: HANDLE, + ProcessHandle: HANDLE, + Offset: ULONG64, + BaseAddress: PVOID, + ViewSize: SIZE_T, + AllocationType: ULONG, + PageProtection: ULONG, +) -> PVOID { + MapViewOfFileNuma2(FileMappingHandle, + ProcessHandle, + Offset, + BaseAddress, + ViewSize, + AllocationType, + PageProtection, + NUMA_NO_PREFERRED_NODE) +}*/ +extern "system" { + pub fn UnmapViewOfFile2( + ProcessHandle: HANDLE, + BaseAddress: PVOID, + UnmapFlags: ULONG, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/minschannel.rs b/src/vendor/winapi/src/um/minschannel.rs new file mode 100644 index 0000000000..1294b6e6a6 --- /dev/null +++ b/src/vendor/winapi/src/um/minschannel.rs @@ -0,0 +1,59 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Public Definitions for MIN SCHANNEL Security Provider +use shared::guiddef::GUID; +use shared::minwindef::{BOOL, DWORD}; +use um::wincrypt::ALG_ID; +use um::winnt::LPWSTR; +pub const SECPKG_ATTR_ISSUER_LIST: DWORD = 0x50; +pub const SECPKG_ATTR_REMOTE_CRED: DWORD = 0x51; +pub const SECPKG_ATTR_LOCAL_CRED: DWORD = 0x52; +pub const SECPKG_ATTR_REMOTE_CERT_CONTEXT: DWORD = 0x53; +pub const SECPKG_ATTR_LOCAL_CERT_CONTEXT: DWORD = 0x54; +pub const SECPKG_ATTR_ROOT_STORE: DWORD = 0x55; +pub const SECPKG_ATTR_SUPPORTED_ALGS: DWORD = 0x56; +pub const SECPKG_ATTR_CIPHER_STRENGTHS: DWORD = 0x57; +pub const SECPKG_ATTR_SUPPORTED_PROTOCOLS: DWORD = 0x58; +pub const SECPKG_ATTR_ISSUER_LIST_EX: DWORD = 0x59; +pub const SECPKG_ATTR_CONNECTION_INFO: DWORD = 0x5a; +pub const SECPKG_ATTR_EAP_KEY_BLOCK: DWORD = 0x5b; +pub const SECPKG_ATTR_MAPPED_CRED_ATTR: DWORD = 0x5c; +pub const SECPKG_ATTR_SESSION_INFO: DWORD = 0x5d; +pub const SECPKG_ATTR_APP_DATA: DWORD = 0x5e; +pub const SECPKG_ATTR_REMOTE_CERTIFICATES: DWORD = 0x5F; +pub const SECPKG_ATTR_CLIENT_CERT_POLICY: DWORD = 0x60; +pub const SECPKG_ATTR_CC_POLICY_RESULT: DWORD = 0x61; +pub const SECPKG_ATTR_USE_NCRYPT: DWORD = 0x62; +pub const SECPKG_ATTR_LOCAL_CERT_INFO: DWORD = 0x63; +pub const SECPKG_ATTR_CIPHER_INFO: DWORD = 0x64; +pub const SECPKG_ATTR_EAP_PRF_INFO: DWORD = 0x65; +pub const SECPKG_ATTR_SUPPORTED_SIGNATURES: DWORD = 0x66; +pub const SECPKG_ATTR_REMOTE_CERT_CHAIN: DWORD = 0x67; +pub const SECPKG_ATTR_UI_INFO: DWORD = 0x68; +pub const SECPKG_ATTR_EARLY_START: DWORD = 0x69; +STRUCT!{struct SecPkgCred_SupportedAlgs { + cSupportedAlgs: DWORD, + palgSupportedAlgs: ALG_ID, +}} +STRUCT!{struct SecPkgCred_CipherStrengths { + dwMinimumCipherStrength: DWORD, + dwMaximumCipherStrength: DWORD, +}} +STRUCT!{struct SecPkgCred_SupportedProtocols { + grbitProtocol: DWORD, +}} +STRUCT!{struct SecPkgCred_ClientCertPolicy { + dwFlags: DWORD, + guidPolicyId: GUID, + dwCertFlags: DWORD, + dwUrlRetrievalTimeout: DWORD, + fCheckRevocationFreshnessTime: BOOL, + dwRevocationFreshnessTime: DWORD, + fOmitUsageCheck: BOOL, + pwszSslCtlStoreName: LPWSTR, + pwszSslCtlIdentifier: LPWSTR, +}} diff --git a/src/vendor/winapi/src/um/minwinbase.rs b/src/vendor/winapi/src/um/minwinbase.rs new file mode 100644 index 0000000000..85328a6765 --- /dev/null +++ b/src/vendor/winapi/src/um/minwinbase.rs @@ -0,0 +1,334 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! This module defines the 32-Bit Windows Base APIs +use shared::basetsd::ULONG_PTR; +use shared::minwindef::{BOOL, BYTE, DWORD, FILETIME, HMODULE, LPVOID, MAX_PATH, UINT, ULONG, WORD}; +use shared::ntstatus::{ + STATUS_ACCESS_VIOLATION, STATUS_ARRAY_BOUNDS_EXCEEDED, STATUS_BREAKPOINT, + STATUS_CONTROL_C_EXIT, STATUS_DATATYPE_MISALIGNMENT, STATUS_FLOAT_DENORMAL_OPERAND, + STATUS_FLOAT_DIVIDE_BY_ZERO, STATUS_FLOAT_INEXACT_RESULT, STATUS_FLOAT_INVALID_OPERATION, + STATUS_FLOAT_OVERFLOW, STATUS_FLOAT_STACK_CHECK, STATUS_FLOAT_UNDERFLOW, + STATUS_GUARD_PAGE_VIOLATION, STATUS_ILLEGAL_INSTRUCTION, STATUS_INTEGER_DIVIDE_BY_ZERO, + STATUS_INTEGER_OVERFLOW, STATUS_INVALID_DISPOSITION, STATUS_INVALID_HANDLE, + STATUS_IN_PAGE_ERROR, STATUS_NONCONTINUABLE_EXCEPTION, STATUS_PENDING, + STATUS_POSSIBLE_DEADLOCK, STATUS_PRIVILEGED_INSTRUCTION, STATUS_SINGLE_STEP, + STATUS_STACK_OVERFLOW, +}; +use um::winnt::{ + CHAR, EXCEPTION_RECORD, HANDLE, LPSTR, LPWSTR, PCONTEXT, PRTL_CRITICAL_SECTION, + PRTL_CRITICAL_SECTION_DEBUG, PVOID, RTL_CRITICAL_SECTION, RTL_CRITICAL_SECTION_DEBUG, WCHAR, +}; +//MoveMemory +//CopyMemory +//FillMemory +//ZeroMemory +STRUCT!{struct SECURITY_ATTRIBUTES { + nLength: DWORD, + lpSecurityDescriptor: LPVOID, + bInheritHandle: BOOL, +}} +pub type PSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; +pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; +STRUCT!{struct OVERLAPPED_u_s { + Offset: DWORD, + OffsetHigh: DWORD, +}} +UNION!{union OVERLAPPED_u { + [u32; 2] [u64; 1], + s s_mut: OVERLAPPED_u_s, + Pointer Pointer_mut: PVOID, +}} +STRUCT!{struct OVERLAPPED { + Internal: ULONG_PTR, + InternalHigh: ULONG_PTR, + u: OVERLAPPED_u, + hEvent: HANDLE, +}} +pub type LPOVERLAPPED = *mut OVERLAPPED; +STRUCT!{struct OVERLAPPED_ENTRY { + lpCompletionKey: ULONG_PTR, + lpOverlapped: LPOVERLAPPED, + Internal: ULONG_PTR, + dwNumberOfBytesTransferred: DWORD, +}} +pub type LPOVERLAPPED_ENTRY = *mut OVERLAPPED_ENTRY; +STRUCT!{struct SYSTEMTIME { + wYear: WORD, + wMonth: WORD, + wDayOfWeek: WORD, + wDay: WORD, + wHour: WORD, + wMinute: WORD, + wSecond: WORD, + wMilliseconds: WORD, +}} +pub type PSYSTEMTIME = *mut SYSTEMTIME; +pub type LPSYSTEMTIME = *mut SYSTEMTIME; +STRUCT!{struct WIN32_FIND_DATAA { + dwFileAttributes: DWORD, + ftCreationTime: FILETIME, + ftLastAccessTime: FILETIME, + ftLastWriteTime: FILETIME, + nFileSizeHigh: DWORD, + nFileSizeLow: DWORD, + dwReserved0: DWORD, + dwReserved1: DWORD, + cFileName: [CHAR; MAX_PATH], + cAlternateFileName: [CHAR; 14], +}} +pub type PWIN32_FIND_DATAA = *mut WIN32_FIND_DATAA; +pub type LPWIN32_FIND_DATAA = *mut WIN32_FIND_DATAA; +STRUCT!{struct WIN32_FIND_DATAW { + dwFileAttributes: DWORD, + ftCreationTime: FILETIME, + ftLastAccessTime: FILETIME, + ftLastWriteTime: FILETIME, + nFileSizeHigh: DWORD, + nFileSizeLow: DWORD, + dwReserved0: DWORD, + dwReserved1: DWORD, + cFileName: [WCHAR; MAX_PATH], + cAlternateFileName: [WCHAR; 14], +}} +pub type PWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; +pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; +ENUM!{enum FINDEX_INFO_LEVELS { + FindExInfoStandard, + FindExInfoBasic, + FindExInfoMaxInfoLevel, +}} +pub const FIND_FIRST_EX_CASE_SENSITIVE: DWORD = 0x00000001; +pub const FIND_FIRST_EX_LARGE_FETCH: DWORD = 0x00000002; +ENUM!{enum FINDEX_SEARCH_OPS { + FindExSearchNameMatch, + FindExSearchLimitToDirectories, + FindExSearchLimitToDevices, + FindExSearchMaxSearchOp, +}} +ENUM!{enum GET_FILEEX_INFO_LEVELS { + GetFileExInfoStandard, + GetFileExMaxInfoLevel, +}} +ENUM!{enum FILE_INFO_BY_HANDLE_CLASS { + FileBasicInfo, + FileStandardInfo, + FileNameInfo, + FileRenameInfo, + FileDispositionInfo, + FileAllocationInfo, + FileEndOfFileInfo, + FileStreamInfo, + FileCompressionInfo, + FileAttributeTagInfo, + FileIdBothDirectoryInfo, + FileIdBothDirectoryRestartInfo, + FileIoPriorityHintInfo, + FileRemoteProtocolInfo, + FileFullDirectoryInfo, + FileFullDirectoryRestartInfo, + FileStorageInfo, + FileAlignmentInfo, + FileIdInfo, + FileIdExtdDirectoryInfo, + FileIdExtdDirectoryRestartInfo, + FileDispositionInfoEx, + FileRenameInfoEx, + MaximumFileInfoByHandleClass, +}} +pub type PFILE_INFO_BY_HANDLE_CLASS = *mut FILE_INFO_BY_HANDLE_CLASS; +pub type CRITICAL_SECTION = RTL_CRITICAL_SECTION; +pub type PCRITICAL_SECTION = PRTL_CRITICAL_SECTION; +pub type LPCRITICAL_SECTION = PRTL_CRITICAL_SECTION; +pub type CRITICAL_SECTION_DEBUG = RTL_CRITICAL_SECTION_DEBUG; +pub type PCRITICAL_SECTION_DEBUG = PRTL_CRITICAL_SECTION_DEBUG; +pub type LPCRITICAL_SECTION_DEBUG = PRTL_CRITICAL_SECTION_DEBUG; +FN!{stdcall LPOVERLAPPED_COMPLETION_ROUTINE( + dwErrorCode: DWORD, + dwNumberOfBytesTransfered: DWORD, + lpOverlapped: LPOVERLAPPED, +) -> ()} +pub const LOCKFILE_FAIL_IMMEDIATELY: DWORD = 0x00000001; +pub const LOCKFILE_EXCLUSIVE_LOCK: DWORD = 0x00000002; +STRUCT!{struct PROCESS_HEAP_ENTRY_Block { + hMem: HANDLE, + dwReserved: [DWORD; 3], +}} +STRUCT!{struct PROCESS_HEAP_ENTRY_Region { + dwCommittedSize: DWORD, + dwUnCommittedSize: DWORD, + lpFirstBlock: LPVOID, + lpLastBlock: LPVOID, +}} +UNION!{union PROCESS_HEAP_ENTRY_u { + [u32; 4] [u64; 3], + Block Block_mut: PROCESS_HEAP_ENTRY_Block, + Region Region_mut: PROCESS_HEAP_ENTRY_Region, +}} +STRUCT!{struct PROCESS_HEAP_ENTRY { + lpData: PVOID, + cbData: DWORD, + cbOverhead: BYTE, + iRegionIndex: BYTE, + wFlags: WORD, + u: PROCESS_HEAP_ENTRY_u, +}} +pub type LPPROCESS_HEAP_ENTRY = *mut PROCESS_HEAP_ENTRY; +pub type PPROCESS_HEAP_ENTRY = *mut PROCESS_HEAP_ENTRY; +pub const PROCESS_HEAP_REGION: WORD = 0x0001; +pub const PROCESS_HEAP_UNCOMMITTED_RANGE: WORD = 0x0002; +pub const PROCESS_HEAP_ENTRY_BUSY: WORD = 0x0004; +pub const PROCESS_HEAP_SEG_ALLOC: WORD = 0x0008; +pub const PROCESS_HEAP_ENTRY_MOVEABLE: WORD = 0x0010; +pub const PROCESS_HEAP_ENTRY_DDESHARE: WORD = 0x0020; +STRUCT!{struct REASON_CONTEXT_Detailed { + LocalizedReasonModule: HMODULE, + LocalizedReasonId: ULONG, + ReasonStringCount: ULONG, + ReasonStrings: *mut LPWSTR, +}} +UNION!{union REASON_CONTEXT_Reason { + [u32; 4] [u64; 3], + Detailed Detailed_mut: REASON_CONTEXT_Detailed, + SimpleReasonString SimpleReasonString_mut: LPWSTR, +}} +STRUCT!{struct REASON_CONTEXT { + Version: ULONG, + Flags: DWORD, + Reason: REASON_CONTEXT_Reason, +}} +pub type PREASON_CONTEXT = *mut REASON_CONTEXT; +pub const EXCEPTION_DEBUG_EVENT: DWORD = 1; +pub const CREATE_THREAD_DEBUG_EVENT: DWORD = 2; +pub const CREATE_PROCESS_DEBUG_EVENT: DWORD = 3; +pub const EXIT_THREAD_DEBUG_EVENT: DWORD = 4; +pub const EXIT_PROCESS_DEBUG_EVENT: DWORD = 5; +pub const LOAD_DLL_DEBUG_EVENT: DWORD = 6; +pub const UNLOAD_DLL_DEBUG_EVENT: DWORD = 7; +pub const OUTPUT_DEBUG_STRING_EVENT: DWORD = 8; +pub const RIP_EVENT: DWORD = 9; +FN!{stdcall PTHREAD_START_ROUTINE( + lpThreadParameter: LPVOID, +) -> DWORD} +pub type LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE; +STRUCT!{struct EXCEPTION_DEBUG_INFO { + ExceptionRecord: EXCEPTION_RECORD, + dwFirstChance: DWORD, +}} +pub type LPEXCEPTION_DEBUG_INFO = *mut EXCEPTION_DEBUG_INFO; +STRUCT!{struct CREATE_THREAD_DEBUG_INFO { + hThread: HANDLE, + lpThreadLocalBase: LPVOID, + lpStartAddress: LPTHREAD_START_ROUTINE, +}} +pub type LPCREATE_THREAD_DEBUG_INFO = *mut CREATE_THREAD_DEBUG_INFO; +STRUCT!{struct CREATE_PROCESS_DEBUG_INFO { + hFile: HANDLE, + hProcess: HANDLE, + hThread: HANDLE, + lpBaseOfImage: LPVOID, + dwDebugInfoFileOffset: DWORD, + nDebugInfoSize: DWORD, + lpThreadLocalBase: LPVOID, + lpStartAddress: LPTHREAD_START_ROUTINE, + lpImageName: LPVOID, + fUnicode: WORD, +}} +pub type LPCREATE_PROCESS_DEBUG_INFO = *mut CREATE_PROCESS_DEBUG_INFO; +STRUCT!{struct EXIT_THREAD_DEBUG_INFO { + dwExitCode: DWORD, +}} +pub type LPEXIT_THREAD_DEBUG_INFO = *mut EXIT_THREAD_DEBUG_INFO; +STRUCT!{struct EXIT_PROCESS_DEBUG_INFO { + dwExitCode: DWORD, +}} +pub type LPEXIT_PROCESS_DEBUG_INFO = *mut EXIT_PROCESS_DEBUG_INFO; +STRUCT!{struct LOAD_DLL_DEBUG_INFO { + hFile: HANDLE, + lpBaseOfDll: LPVOID, + dwDebugInfoFileOffset: DWORD, + nDebugInfoSize: DWORD, + lpImageName: LPVOID, + fUnicode: WORD, +}} +pub type LPLOAD_DLL_DEBUG_INFO = *mut LOAD_DLL_DEBUG_INFO; +STRUCT!{struct UNLOAD_DLL_DEBUG_INFO { + lpBaseOfDll: LPVOID, +}} +pub type LPUNLOAD_DLL_DEBUG_INFO = *mut UNLOAD_DLL_DEBUG_INFO; +STRUCT!{struct OUTPUT_DEBUG_STRING_INFO { + lpDebugStringData: LPSTR, + fUnicode: WORD, + nDebugStringLength: WORD, +}} +pub type LPOUTPUT_DEBUG_STRING_INFO = *mut OUTPUT_DEBUG_STRING_INFO; +STRUCT!{struct RIP_INFO { + dwError: DWORD, + dwType: DWORD, +}} +pub type LPRIP_INFO = *mut RIP_INFO; +UNION!{union DEBUG_EVENT_u { + [u32; 21] [u64; 20], + Exception Exception_mut: EXCEPTION_DEBUG_INFO, + CreateThread CreateThread_mut: CREATE_THREAD_DEBUG_INFO, + CreateProcessInfo CreateProcessInfo_mut: CREATE_PROCESS_DEBUG_INFO, + ExitThread ExitThread_mut: EXIT_THREAD_DEBUG_INFO, + ExitProcess ExitProcess_mut: EXIT_PROCESS_DEBUG_INFO, + LoadDll LoadDll_mut: LOAD_DLL_DEBUG_INFO, + UnloadDll UnloadDll_mut: UNLOAD_DLL_DEBUG_INFO, + DebugString DebugString_mut: OUTPUT_DEBUG_STRING_INFO, + RipInfo RipInfo_mut: RIP_INFO, +}} +STRUCT!{struct DEBUG_EVENT { + dwDebugEventCode: DWORD, + dwProcessId: DWORD, + dwThreadId: DWORD, + u: DEBUG_EVENT_u, +}} +pub type LPDEBUG_EVENT = *mut DEBUG_EVENT; +pub type LPCONTEXT = PCONTEXT; +pub const STILL_ACTIVE: DWORD = STATUS_PENDING as u32; +pub const EXCEPTION_ACCESS_VIOLATION: DWORD = STATUS_ACCESS_VIOLATION as u32; +pub const EXCEPTION_DATATYPE_MISALIGNMENT: DWORD = STATUS_DATATYPE_MISALIGNMENT as u32; +pub const EXCEPTION_BREAKPOINT: DWORD = STATUS_BREAKPOINT as u32; +pub const EXCEPTION_SINGLE_STEP: DWORD = STATUS_SINGLE_STEP as u32; +pub const EXCEPTION_ARRAY_BOUNDS_EXCEEDED: DWORD = STATUS_ARRAY_BOUNDS_EXCEEDED as u32; +pub const EXCEPTION_FLT_DENORMAL_OPERAND: DWORD = STATUS_FLOAT_DENORMAL_OPERAND as u32; +pub const EXCEPTION_FLT_DIVIDE_BY_ZERO: DWORD = STATUS_FLOAT_DIVIDE_BY_ZERO as u32; +pub const EXCEPTION_FLT_INEXACT_RESULT: DWORD = STATUS_FLOAT_INEXACT_RESULT as u32; +pub const EXCEPTION_FLT_INVALID_OPERATION: DWORD = STATUS_FLOAT_INVALID_OPERATION as u32; +pub const EXCEPTION_FLT_OVERFLOW: DWORD = STATUS_FLOAT_OVERFLOW as u32; +pub const EXCEPTION_FLT_STACK_CHECK: DWORD = STATUS_FLOAT_STACK_CHECK as u32; +pub const EXCEPTION_FLT_UNDERFLOW: DWORD = STATUS_FLOAT_UNDERFLOW as u32; +pub const EXCEPTION_INT_DIVIDE_BY_ZERO: DWORD = STATUS_INTEGER_DIVIDE_BY_ZERO as u32; +pub const EXCEPTION_INT_OVERFLOW: DWORD = STATUS_INTEGER_OVERFLOW as u32; +pub const EXCEPTION_PRIV_INSTRUCTION: DWORD = STATUS_PRIVILEGED_INSTRUCTION as u32; +pub const EXCEPTION_IN_PAGE_ERROR: DWORD = STATUS_IN_PAGE_ERROR as u32; +pub const EXCEPTION_ILLEGAL_INSTRUCTION: DWORD = STATUS_ILLEGAL_INSTRUCTION as u32; +pub const EXCEPTION_NONCONTINUABLE_EXCEPTION: DWORD = STATUS_NONCONTINUABLE_EXCEPTION as u32; +pub const EXCEPTION_STACK_OVERFLOW: DWORD = STATUS_STACK_OVERFLOW as u32; +pub const EXCEPTION_INVALID_DISPOSITION: DWORD = STATUS_INVALID_DISPOSITION as u32; +pub const EXCEPTION_GUARD_PAGE: DWORD = STATUS_GUARD_PAGE_VIOLATION as u32; +pub const EXCEPTION_INVALID_HANDLE: DWORD = STATUS_INVALID_HANDLE as u32; +pub const EXCEPTION_POSSIBLE_DEADLOCK: DWORD = STATUS_POSSIBLE_DEADLOCK as u32; +pub const CONTROL_C_EXIT: DWORD = STATUS_CONTROL_C_EXIT as u32; +pub const LMEM_FIXED: UINT = 0x0000; +pub const LMEM_MOVEABLE: UINT = 0x0002; +pub const LMEM_NOCOMPACT: UINT = 0x0010; +pub const LMEM_NODISCARD: UINT = 0x0020; +pub const LMEM_ZEROINIT: UINT = 0x0040; +pub const LMEM_MODIFY: UINT = 0x0080; +pub const LMEM_DISCARDABLE: UINT = 0x0F00; +pub const LMEM_VALID_FLAGS: UINT = 0x0F72; +pub const LMEM_INVALID_HANDLE: UINT = 0x8000; +pub const LHND: UINT = LMEM_MOVEABLE | LMEM_ZEROINIT; +pub const LPTR: UINT = LMEM_FIXED | LMEM_ZEROINIT; +pub const NONZEROLHND: UINT = LMEM_MOVEABLE; +pub const NONZEROLPTR: UINT = LMEM_FIXED; +//LocalDiscard +pub const LMEM_DISCARDED: UINT = 0x4000; +pub const LMEM_LOCKCOUNT: UINT = 0x00FF; +pub const NUMA_NO_PREFERRED_NODE: DWORD = -1i32 as DWORD; diff --git a/src/vendor/winapi/src/um/mmdeviceapi.rs b/src/vendor/winapi/src/um/mmdeviceapi.rs new file mode 100644 index 0000000000..4e93b9efe7 --- /dev/null +++ b/src/vendor/winapi/src/um/mmdeviceapi.rs @@ -0,0 +1,227 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! this ALWAYS GENERATED file contains the definitions for the interfaces +use ctypes::c_void; +use shared::guiddef::{GUID, REFIID}; +use shared::minwindef::{DWORD, LPARAM, LPVOID, UINT}; +// use shared::winerror::{ERROR_NOT_FOUND, ERROR_UNSUPPORTED_TYPE, HRESULT_FROM_WIN32}; +use shared::wtypes::PROPERTYKEY; +use um::propidl::PROPVARIANT; +use um::propsys::IPropertyStore; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCWSTR, LPWSTR}; +// pub const E_NOTFOUND: HRESULT = HRESULT_FROM_WIN32(ERROR_NOT_FOUND); +// pub const E_UNSUPPORTED_TYPE: HRESULT = HRESULT_FROM_WIN32(ERROR_UNSUPPORTED_TYPE); +pub const DEVICE_STATE_ACTIVE: DWORD = 0x00000001; +pub const DEVICE_STATE_DISABLED: DWORD = 0x00000002; +pub const DEVICE_STATE_NOTPRESENT: DWORD = 0x00000004; +pub const DEVICE_STATE_UNPLUGGED: DWORD = 0x00000008; +pub const DEVICE_STATEMASK_ALL: DWORD = 0x0000000F; +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_FormFactor, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 0); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_ControlPanelPageProvider, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 1); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_Association, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 2); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_PhysicalSpeakers, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 3); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_GUID, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 4); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_Disable_SysFx, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 5); +pub const ENDPOINT_SYSFX_ENABLED: DWORD = 0x00000000; +pub const ENDPOINT_SYSFX_DISABLED: DWORD = 0x00000001; +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_FullRangeSpeakers, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 6); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_Supports_EventDriven_Mode, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 7); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_JackSubType, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 8); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpoint_Default_VolumeInDb, + 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 9); +DEFINE_PROPERTYKEY!(PKEY_AudioEngine_DeviceFormat, + 0xf19f064d, 0x82c, 0x4e27, 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c, 0); +DEFINE_PROPERTYKEY!(PKEY_AudioEngine_OEMFormat, + 0xe4870e26, 0x3cc5, 0x4cd2, 0xba, 0x46, 0xca, 0xa, 0x9a, 0x70, 0xed, 0x4, 3); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpointLogo_IconEffects, + 0xf1ab780d, 0x2010, 0x4ed3, 0xa3, 0xa6, 0x8b, 0x87, 0xf0, 0xf0, 0xc4, 0x76, 0); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpointLogo_IconPath, + 0xf1ab780d, 0x2010, 0x4ed3, 0xa3, 0xa6, 0x8b, 0x87, 0xf0, 0xf0, 0xc4, 0x76, 1); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpointSettings_MenuText, + 0x14242002, 0x0320, 0x4de4, 0x95, 0x55, 0xa7, 0xd8, 0x2b, 0x73, 0xc2, 0x86, 0); +DEFINE_PROPERTYKEY!(PKEY_AudioEndpointSettings_LaunchContract, + 0x14242002, 0x0320, 0x4de4, 0x95, 0x55, 0xa7, 0xd8, 0x2b, 0x73, 0xc2, 0x86, 1); +STRUCT!{struct DIRECTX_AUDIO_ACTIVATION_PARAMS { + cbDirectXAudioActivationParams: DWORD, + guidAudioSession: GUID, + dwAudioStreamFlags: DWORD, +}} +pub type PDIRECTX_AUDIO_ACTIVATION_PARAMS = *mut DIRECTX_AUDIO_ACTIVATION_PARAMS; +ENUM!{enum EDataFlow { + eRender, + eCapture, + eAll, + EDataFlow_enum_count, +}} +ENUM!{enum ERole { + eConsole, + eMultimedia, + eCommunications, + ERole_enum_count, +}} +ENUM!{enum EndpointFormFactor { + RemoteNetworkDevice, + Speakers, + LineLevel, + Headphones, + Microphone, + Headset, + Handset, + UnknownDigitalPassthrough, + SPDIF, + DigitalAudioDisplayDevice, + UnknownFormFactor, + EndpointFormFactor_enum_count, +}} +pub const HDMI: EndpointFormFactor = DigitalAudioDisplayDevice; +DEFINE_GUID!(DEVINTERFACE_AUDIO_RENDER, + 0xe6327cad, 0xdcec, 0x4949, 0xae, 0x8a, 0x99, 0x1e, 0x97, 0x6a, 0x79, 0xd2); +DEFINE_GUID!(DEVINTERFACE_AUDIO_CAPTURE, + 0x2eef81be, 0x33fa, 0x4800, 0x96, 0x70, 0x1c, 0xd4, 0x74, 0x97, 0x2c, 0x3f); +DEFINE_GUID!(DEVINTERFACE_MIDI_OUTPUT, + 0x6dc23320, 0xab33, 0x4ce4, 0x80, 0xd4, 0xbb, 0xb3, 0xeb, 0xbf, 0x28, 0x14); +DEFINE_GUID!(DEVINTERFACE_MIDI_INPUT, + 0x504be32c, 0xccf6, 0x4d2c, 0xb7, 0x3f, 0x6f, 0x8b, 0x37, 0x47, 0xe2, 0x2b); +RIDL!(#[uuid(0x7991eec9, 0x7e89, 0x4d85, 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0)] +interface IMMNotificationClient(IMMNotificationClientVtbl): IUnknown(IUnknownVtbl) { + fn OnDeviceStateChanged( + pwstrDeviceId: LPCWSTR, + dwNewState: DWORD, + ) -> HRESULT, + fn OnDeviceAdded( + pwstrDeviceId: LPCWSTR, + ) -> HRESULT, + fn OnDeviceRemoved( + pwstrDeviceId: LPCWSTR, + ) -> HRESULT, + fn OnDefaultDeviceChanged( + flow: EDataFlow, + role: ERole, + pwstrDefaultDeviceId: LPCWSTR, + ) -> HRESULT, + fn OnPropertyValueChanged( + pwstrDeviceId: LPCWSTR, + key: PROPERTYKEY, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0xd666063f, 0x1587, 0x4e43, 0x81, 0xf1, 0xb9, 0x48, 0xe8, 0x07, 0x36, 0x3f)] +interface IMMDevice(IMMDeviceVtbl): IUnknown(IUnknownVtbl) { + fn Activate( + iid: REFIID, + dwClsCtx: DWORD, + pActivationParams: *mut PROPVARIANT, + ppInterface: *mut LPVOID, + ) -> HRESULT, + fn OpenPropertyStore( + stgmAccess: DWORD, + ppProperties: *mut *mut IPropertyStore, + ) -> HRESULT, + fn GetId( + ppstrId: *mut LPWSTR, + ) -> HRESULT, + fn GetState( + pdwState: *mut DWORD, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0x0bd7a1be, 0x7a1a, 0x44db, 0x83, 0x97, 0xcc, 0x53, 0x92, 0x38, 0x7b, 0x5e)] +interface IMMDeviceCollection(IMMDeviceCollectionVtbl): IUnknown(IUnknownVtbl) { + fn GetCount( + pcDevices: *const UINT, + ) -> HRESULT, + fn Item( + nDevice: UINT, + ppDevice: *mut *mut IMMDevice, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0x1be09788, 0x6894, 0x4089, 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5)] +interface IMMEndpoint(IMMEndpointVtbl): IUnknown(IUnknownVtbl) { + fn GetDataFlow( + pDataFlow: *mut EDataFlow, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0xa95664d2, 0x9614, 0x4f35, 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6)] +interface IMMDeviceEnumerator(IMMDeviceEnumeratorVtbl): IUnknown(IUnknownVtbl) { + fn EnumAudioEndpoints( + dataFlow: EDataFlow, + dwStateMask: DWORD, + ppDevices: *mut *mut IMMDeviceCollection, + ) -> HRESULT, + fn GetDefaultAudioEndpoint( + dataFlow: EDataFlow, + role: ERole, + ppEndpoint: *mut *mut IMMDevice, + ) -> HRESULT, + fn GetDevice( + pwstrId: LPCWSTR, + ppDevices: *mut *mut IMMDevice, + ) -> HRESULT, + fn RegisterEndpointNotificationCallback( + pClient: *mut IMMNotificationClient, + ) -> HRESULT, + fn UnregisterEndpointNotificationCallback( + pClient: *mut IMMNotificationClient, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0x3b0d0ea4, 0xd0a9, 0x4b0e, 0x93, 0x5b, 0x09, 0x51, 0x67, 0x46, 0xfa, 0xc0)] +interface IMMDeviceActivator(IMMDeviceActivatorVtbl): IUnknown(IUnknownVtbl) { + fn Activate( + iid: REFIID, + pDevice: *mut IMMDevice, + pActivationParams: *mut PROPVARIANT, + ppInterface: *mut *mut c_void, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0x41d949ab, 0x9862, 0x444a, 0x80, 0xf6, 0xc2, 0x61, 0x33, 0x4d, 0xa5, 0xeb)] +interface IActivateAudioInterfaceCompletionHandler(IActivateAudioInterfaceCompletionHandlerVtbl): + IUnknown(IUnknownVtbl) { + fn ActivateCompleted( + activateOperation: *mut IActivateAudioInterfaceAsyncOperation, + ) -> HRESULT, +} +); +RIDL!(#[uuid(0x72a22d78, 0xcde4, 0x431d, 0xb8, 0xcc, 0x84, 0x3a, 0x71, 0x19, 0x9b, 0x6d)] +interface IActivateAudioInterfaceAsyncOperation(IActivateAudioInterfaceAsyncOperationVtbl): + IUnknown(IUnknownVtbl) { + fn GetActivateResult( + activateResult: *mut HRESULT, + activatedInterface: *mut *mut IUnknown, + ) -> HRESULT, +} +); +extern "system" { + pub fn ActivateAudioInterfaceAsync( + deviceInterfacePath: LPCWSTR, + riid: REFIID, + activationParams: *mut PROPVARIANT, + completionHandler: *mut IActivateAudioInterfaceCompletionHandler, + activationOperation: *mut *mut IActivateAudioInterfaceAsyncOperation, + ) -> HRESULT; +} +STRUCT!{struct AudioExtensionParams { + AddPageParam: LPARAM, + pEndpoint: *mut IMMDevice, + pPnpInterface: *mut IMMDevice, + pPnpDevnode: *mut IMMDevice, +}} +DEFINE_GUID!(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, + 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); diff --git a/src/vendor/winapi/src/um/mmeapi.rs b/src/vendor/winapi/src/um/mmeapi.rs new file mode 100644 index 0000000000..7ebed76c2c --- /dev/null +++ b/src/vendor/winapi/src/um/mmeapi.rs @@ -0,0 +1,337 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::{DWORD_PTR, UINT_PTR}; +use shared::minwindef::{DWORD, LPBYTE, LPDWORD, LPWORD, PDWORD, UINT}; +use um::imm::LPUINT; +use um::mmsystem::{ + HMIDI, HMIDIIN, HMIDIOUT, HMIDISTRM, HWAVEIN, HWAVEOUT, LPCWAVEFORMATEX, LPHMIDIIN, LPHMIDIOUT, + LPHMIDISTRM, LPHWAVEIN, LPHWAVEOUT, LPMIDIHDR, LPMIDIINCAPSW, LPMIDIOUTCAPSW, LPMMTIME, + LPWAVEHDR, LPWAVEINCAPSW, LPWAVEOUTCAPSW, MMRESULT +}; +use um::winnt::{LPWSTR, PVOID}; +extern "system" { + pub fn waveOutGetNumDevs() -> UINT; + // pub fn waveOutGetDevCapsA(); + pub fn waveOutGetDevCapsW( + uDeviceID: UINT_PTR, + pwoc: LPWAVEOUTCAPSW, + cbwoc: UINT, + ) -> MMRESULT; + pub fn waveOutGetVolume( + hwo: HWAVEOUT, + pdwVolume: LPDWORD, + ) -> MMRESULT; + pub fn waveOutSetVolume( + hwo: HWAVEOUT, + dwVolume: DWORD, + ) -> MMRESULT; + // pub fn waveOutGetErrorTextA(); + pub fn waveOutGetErrorTextW( + mmrError: MMRESULT, + pszText: LPWSTR, + cchText: UINT, + ) -> MMRESULT; + pub fn waveOutOpen( + phwo: LPHWAVEOUT, + uDeviceID: UINT, + pwfx: LPCWAVEFORMATEX, + dwCallback: DWORD_PTR, + dwInstance: DWORD_PTR, + fdwOpen: DWORD, + ) -> MMRESULT; + pub fn waveOutClose( + hwo: HWAVEOUT, + ) -> MMRESULT; + pub fn waveOutPrepareHeader( + hwo: HWAVEOUT, + pwh: LPWAVEHDR, + cbwh: UINT, + ) -> MMRESULT; + pub fn waveOutUnprepareHeader( + hwo: HWAVEOUT, + pwh: LPWAVEHDR, + cbwh: UINT, + ) -> MMRESULT; + pub fn waveOutWrite( + hwo: HWAVEOUT, + pwh: LPWAVEHDR, + cbwh: UINT, + ) -> MMRESULT; + pub fn waveOutPause( + hwo: HWAVEOUT, + ) -> MMRESULT; + pub fn waveOutRestart( + hwo: HWAVEOUT, + ) -> MMRESULT; + pub fn waveOutReset( + hwo: HWAVEOUT, + ) -> MMRESULT; + pub fn waveOutBreakLoop( + hwo: HWAVEOUT, + ) -> MMRESULT; + pub fn waveOutGetPosition( + hwo: HWAVEOUT, + pmmt: LPMMTIME, + cbmmt: UINT, + ) -> MMRESULT; + pub fn waveOutGetPitch( + hwo: HWAVEOUT, + pdwPitch: LPDWORD, + ) -> MMRESULT; + pub fn waveOutSetPitch( + hwo: HWAVEOUT, + dwPitch: DWORD, + ) -> MMRESULT; + pub fn waveOutGetPlaybackRate( + hwo: HWAVEOUT, + pdwRate: LPDWORD, + ) -> MMRESULT; + pub fn waveOutSetPlaybackRate( + hwo: HWAVEOUT, + dwRate: DWORD, + ) -> MMRESULT; + // pub fn waveOutGetID(); + pub fn waveOutMessage( + hwo: HWAVEOUT, + uMsg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR, + ) -> MMRESULT; + pub fn waveInGetNumDevs() -> UINT; + // pub fn waveInGetDevCapsA(); + pub fn waveInGetDevCapsW( + uDeviceID: UINT_PTR, + pwic: LPWAVEINCAPSW, + cbwic: UINT, + ) -> MMRESULT; + // pub fn waveInGetErrorTextA(); + pub fn waveInGetErrorTextW( + mmrError: MMRESULT, + pszText: LPWSTR, + cchText: UINT, + ) -> MMRESULT; + pub fn waveInOpen( + phwi: LPHWAVEIN, + uDeviceID: UINT, + pwfx: LPCWAVEFORMATEX, + dwCallback: DWORD_PTR, + dwInstance: DWORD_PTR, + fdwOpen: DWORD, + ) -> MMRESULT; + pub fn waveInClose( + hwi: HWAVEIN, + ) -> MMRESULT; + pub fn waveInPrepareHeader( + hwi: HWAVEIN, + pwh: LPWAVEHDR, + cbwh: UINT, + ) -> MMRESULT; + pub fn waveInUnprepareHeader( + hwi: HWAVEIN, + pwh: LPWAVEHDR, + cbwh: UINT, + ) -> MMRESULT; + pub fn waveInAddBuffer( + hwi: HWAVEIN, + pwh: LPWAVEHDR, + cbwh: UINT, + ) -> MMRESULT; + pub fn waveInStart( + hwi: HWAVEIN, + ) -> MMRESULT; + pub fn waveInStop( + hwi: HWAVEIN, + ) -> MMRESULT; + pub fn waveInReset( + hwi: HWAVEIN, + ) -> MMRESULT; + pub fn waveInGetPosition( + hwi: HWAVEIN, + pmmt: LPMMTIME, + cbmmt: UINT, + ) -> MMRESULT; + // pub fn waveInGetID(); + pub fn waveInMessage( + hwi: HWAVEIN, + uMsg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR, + ) -> MMRESULT; + pub fn midiOutGetNumDevs() -> UINT; + pub fn midiStreamOpen( + lphStream: LPHMIDISTRM, + puDeviceID: LPUINT, + cMidi: DWORD, + dwCallback: DWORD_PTR, + dwInstance: DWORD_PTR, + fdwOpen: DWORD, + ) -> MMRESULT; + pub fn midiStreamClose( + hStream: HMIDISTRM, + ) -> MMRESULT; + pub fn midiStreamProperty( + hm: HMIDISTRM, + lppropdata: LPBYTE, + dwProperty: DWORD, + ) -> MMRESULT; + pub fn midiStreamPosition( + hms: HMIDISTRM, + pmmt: LPMMTIME, + cbmmt: UINT, + ) -> MMRESULT; + pub fn midiStreamOut( + hMidiStream: HMIDISTRM, + lpMidiHdr: LPMIDIHDR, + cbMidiHdr: UINT, + ) -> MMRESULT; + pub fn midiStreamPause( + hms: HMIDISTRM, + ) -> MMRESULT; + pub fn midiStreamRestart( + hms: HMIDISTRM, + ) -> MMRESULT; + pub fn midiStreamStop( + hms: HMIDISTRM, + ) -> MMRESULT; + pub fn midiConnect( + hMidi: HMIDI, + hmo: HMIDIOUT, + pReserved: PVOID, + ) -> MMRESULT; + pub fn midiDisconnect( + hMidi: HMIDI, + hmo: HMIDIOUT, + pReserved: PVOID, + ) -> MMRESULT; + pub fn midiOutGetDevCapsW( + uDeviceID: UINT_PTR, + lpMidiOutCaps: LPMIDIOUTCAPSW, + cbMidiOutCaps: UINT, + ) -> MMRESULT; + pub fn midiOutGetVolume( + hmo: HMIDIOUT, + lpdwVolume: PDWORD, + ) -> MMRESULT; + pub fn midiOutSetVolume( + hmo: HMIDIOUT, + dwVolume: DWORD, + ) -> MMRESULT; + pub fn midiOutGetErrorTextW( + mmrError: MMRESULT, + lpText: LPWSTR, + cchText: UINT, + ) -> MMRESULT; + pub fn midiOutOpen( + lphmo: LPHMIDIOUT, + uDeviceID: UINT, + dwCallback: DWORD_PTR, + dwCallbackInstance: DWORD_PTR, + dwFlags: DWORD, + ) -> MMRESULT; + pub fn midiOutClose( + hmo: HMIDIOUT, + ) -> MMRESULT; + pub fn midiOutPrepareHeader( + hmo: HMIDIOUT, + lpMidiOutHdr: LPMIDIHDR, + cbMidiOutHdr: UINT, + ) -> MMRESULT; + pub fn midiOutUnprepareHeader( + hmo: HMIDIOUT, + lpMidiOutHdr: LPMIDIHDR, + cbMidiOutHdr: UINT, + ) -> MMRESULT; + pub fn midiOutShortMsg( + hmo: HMIDIOUT, + dwMsg: DWORD, + ) -> MMRESULT; + pub fn midiOutLongMsg( + hmo: HMIDIOUT, + lpMidiOutHdr: LPMIDIHDR, + cbMidiOutHdr: UINT, + ) -> MMRESULT; + pub fn midiOutReset( + hmo: HMIDIOUT, + ) -> MMRESULT; + pub fn midiOutCachePatches( + hmo: HMIDIOUT, + wBank: UINT, + lpPatchArray: LPWORD, + wFlags: UINT, + ) -> MMRESULT; + pub fn midiOutCacheDrumPatches( + hmo: HMIDIOUT, + wPatch: UINT, + lpKeyArray: LPWORD, + wFlags: UINT, + ) -> MMRESULT; + pub fn midiOutGetID( + hmo: HMIDIOUT, + puDeviceID: LPUINT, + ) -> MMRESULT; + pub fn midiOutMessage( + deviceID: HMIDIOUT, + msg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR, + ) -> MMRESULT; + pub fn midiInGetNumDevs() -> UINT; + pub fn midiInGetDevCapsW( + uDeviceID: UINT_PTR, + lpMidiInCaps: LPMIDIINCAPSW, + cbMidiInCaps: UINT, + ) -> MMRESULT; + pub fn midiInGetErrorTextW( + wError: MMRESULT, + lpText: LPWSTR, + cchText: UINT, + ) -> MMRESULT; + pub fn midiInOpen( + lphMidiIn: LPHMIDIIN, + uDeviceID: UINT, + dwCallback: DWORD_PTR, + dwCallbackInstance: DWORD_PTR, + dwFlags: DWORD, + ) -> MMRESULT; + pub fn midiInClose( + hMidiIn: HMIDIIN, + ) -> MMRESULT; + pub fn midiInPrepareHeader( + hMidiIn: HMIDIIN, + lpMidiInHdr: LPMIDIHDR, + cbMidiInHdr: UINT, + ) -> MMRESULT; + pub fn midiInUnprepareHeader( + hMidiIn: HMIDIIN, + lpMidiInHdr: LPMIDIHDR, + cbMidiInHdr: UINT, + ) -> MMRESULT; + pub fn midiInAddBuffer( + hMidiIn: HMIDIIN, + lpMidiInHdr: LPMIDIHDR, + cbMidiInHdr: UINT, + ) -> MMRESULT; + pub fn midiInStart( + hMidiIn: HMIDIIN, + ) -> MMRESULT; + pub fn midiInStop( + hMidiIn: HMIDIIN, + ) -> MMRESULT; + pub fn midiInReset( + hMidiIn: HMIDIIN, + ) -> MMRESULT; + pub fn midiInGetID( + hmi: HMIDIIN, + puDeviceID: LPUINT, + ) -> MMRESULT; + pub fn midiInMessage( + deviceID: HMIDIIN, + msg: UINT, + dw1: DWORD_PTR, + dw2: DWORD_PTR, + ) -> MMRESULT; +} diff --git a/src/vendor/winapi/src/um/mmsystem.rs b/src/vendor/winapi/src/um/mmsystem.rs new file mode 100644 index 0000000000..0db668d09d --- /dev/null +++ b/src/vendor/winapi/src/um/mmsystem.rs @@ -0,0 +1,267 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! MM procedure declarations, constant definitions and macros +use shared::basetsd::DWORD_PTR; +use shared::minwindef::{BYTE, DWORD, UINT, WORD}; +use shared::mmreg::WAVEFORMATEX; +use um::winnt::{LPSTR, WCHAR}; +//109 (Win 7 SDK) +pub type MMVERSION = UINT; +pub type MMRESULT = UINT; +STRUCT!{struct MMTIME_smpte { + hour: BYTE, + min: BYTE, + sec: BYTE, + frame: BYTE, + fps: BYTE, + dummy: BYTE, + pad: [BYTE; 2], +}} +STRUCT!{struct MMTIME_midi { + songptrpos: DWORD, +}} +UNION!{union MMTIME_u { + [u8; 8], + ms ms_mut: DWORD, + sample sample_mut: DWORD, + cb cb_mut: DWORD, + ticks ticks_mut: DWORD, + smpte smpte_mut: MMTIME_smpte, + midi midi_mut: MMTIME_midi, +}} +STRUCT!{struct MMTIME { + wType: UINT, + u: MMTIME_u, +}} +pub type PMMTIME = *mut MMTIME; +pub type NPMMTIME = *mut MMTIME; +pub type LPMMTIME = *mut MMTIME; +pub const TIME_MS: UINT = 0x0001; +pub const TIME_SAMPLES: UINT = 0x0002; +pub const TIME_BYTES: UINT = 0x0004; +pub const TIME_SMPTE: UINT = 0x0008; +pub const TIME_MIDI: UINT = 0x0010; +pub const TIME_TICKS: UINT = 0x0020; +pub const MM_JOY1MOVE: UINT = 0x3A0; +pub const MM_JOY2MOVE: UINT = 0x3A1; +pub const MM_JOY1ZMOVE: UINT = 0x3A2; +pub const MM_JOY2ZMOVE: UINT = 0x3A3; +pub const MM_JOY1BUTTONDOWN: UINT = 0x3B5; +pub const MM_JOY2BUTTONDOWN: UINT = 0x3B6; +pub const MM_JOY1BUTTONUP: UINT = 0x3B7; +pub const MM_JOY2BUTTONUP: UINT = 0x3B8; +pub const MM_MCINOTIFY: UINT = 0x3B9; +pub const MM_WOM_OPEN: UINT = 0x3BB; +pub const MM_WOM_CLOSE: UINT = 0x3BC; +pub const MM_WOM_DONE: UINT = 0x3BD; +pub const MM_WIM_OPEN: UINT = 0x3BE; +pub const MM_WIM_CLOSE: UINT = 0x3BF; +pub const MM_WIM_DATA: UINT = 0x3C0; +pub const MM_MIM_OPEN: UINT = 0x3C1; +pub const MM_MIM_CLOSE: UINT = 0x3C2; +pub const MM_MIM_DATA: UINT = 0x3C3; +pub const MM_MIM_LONGDATA: UINT = 0x3C4; +pub const MM_MIM_ERROR: UINT = 0x3C5; +pub const MM_MIM_LONGERROR: UINT = 0x3C6; +pub const MM_MOM_OPEN: UINT = 0x3C7; +pub const MM_MOM_CLOSE: UINT = 0x3C8; +pub const MM_MOM_DONE: UINT = 0x3C9; +pub const MMSYSERR_BASE: MMRESULT = 0; +pub const WAVERR_BASE: MMRESULT = 32; +pub const MIDIERR_BASE: MMRESULT = 64; +pub const TIMERR_BASE: MMRESULT = 96; +pub const JOYERR_BASE: MMRESULT = 160; +pub const MCIERR_BASE: MMRESULT = 256; +pub const MIXERR_BASE: MMRESULT = 1024; +pub const MMSYSERR_NOERROR: MMRESULT = 0; +pub const MMSYSERR_ERROR: MMRESULT = MMSYSERR_BASE + 1; +pub const MMSYSERR_BADDEVICEID: MMRESULT = MMSYSERR_BASE + 2; +pub const MMSYSERR_NOTENABLED: MMRESULT = MMSYSERR_BASE + 3; +pub const MMSYSERR_ALLOCATED: MMRESULT = MMSYSERR_BASE + 4; +pub const MMSYSERR_INVALHANDLE: MMRESULT = MMSYSERR_BASE + 5; +pub const MMSYSERR_NODRIVER: MMRESULT = MMSYSERR_BASE + 6; +pub const MMSYSERR_NOMEM: MMRESULT = MMSYSERR_BASE + 7; +pub const MMSYSERR_NOTSUPPORTED: MMRESULT = MMSYSERR_BASE + 8; +pub const MMSYSERR_BADERRNUM: MMRESULT = MMSYSERR_BASE + 9; +pub const MMSYSERR_INVALFLAG: MMRESULT = MMSYSERR_BASE + 10; +pub const MMSYSERR_INVALPARAM: MMRESULT = MMSYSERR_BASE + 11; +pub const MMSYSERR_HANDLEBUSY: MMRESULT = MMSYSERR_BASE + 12; +pub const MMSYSERR_INVALIDALIAS: MMRESULT = MMSYSERR_BASE + 13; +pub const MMSYSERR_BADDB: MMRESULT = MMSYSERR_BASE + 14; +pub const MMSYSERR_KEYNOTFOUND: MMRESULT = MMSYSERR_BASE + 15; +pub const MMSYSERR_READERROR: MMRESULT = MMSYSERR_BASE + 16; +pub const MMSYSERR_WRITEERROR: MMRESULT = MMSYSERR_BASE + 17; +pub const MMSYSERR_DELETEERROR: MMRESULT = MMSYSERR_BASE + 18; +pub const MMSYSERR_VALNOTFOUND: MMRESULT = MMSYSERR_BASE + 19; +pub const MMSYSERR_NODRIVERCB: MMRESULT = MMSYSERR_BASE + 20; +pub const MMSYSERR_MOREDATA: MMRESULT = MMSYSERR_BASE + 21; +pub const MMSYSERR_LASTERROR: MMRESULT = MMSYSERR_BASE + 21; +pub const MIDIERR_UNPREPARED: MMRESULT = MIDIERR_BASE + 0; +pub const MIDIERR_STILLPLAYING: MMRESULT = MIDIERR_BASE + 1; +pub const MIDIERR_NOMAP: MMRESULT = MIDIERR_BASE + 2; +pub const MIDIERR_NOTREADY: MMRESULT = MIDIERR_BASE + 3; +pub const MIDIERR_NODEVICE: MMRESULT = MIDIERR_BASE + 4; +pub const MIDIERR_INVALIDSETUP: MMRESULT = MIDIERR_BASE + 5; +pub const MIDIERR_BADOPENMODE: MMRESULT = MIDIERR_BASE + 6; +pub const MIDIERR_DONT_CONTINUE: MMRESULT = MIDIERR_BASE + 7; +pub const MIDIERR_LASTERROR: MMRESULT = MIDIERR_BASE + 7; +pub const CALLBACK_TYPEMASK: DWORD = 0x00070000; +pub const CALLBACK_NULL: DWORD = 0x00000000; +pub const CALLBACK_WINDOW: DWORD = 0x00010000; +pub const CALLBACK_TASK: DWORD = 0x00020000; +pub const CALLBACK_FUNCTION: DWORD = 0x00030000; +pub const CALLBACK_THREAD: DWORD = CALLBACK_TASK; +pub const CALLBACK_EVENT: DWORD = 0x00050000; +//497 (Win 7 SDK) +pub const WAVERR_BADFORMAT: MMRESULT = WAVERR_BASE + 0; +pub const WAVERR_STILLPLAYING: MMRESULT = WAVERR_BASE + 1; +pub const WAVERR_UNPREPARED: MMRESULT = WAVERR_BASE + 2; +pub const WAVERR_SYNC: MMRESULT = WAVERR_BASE + 3; +pub const WAVERR_LASTERROR: MMRESULT = WAVERR_BASE + 3; +DECLARE_HANDLE!(HWAVEIN, HWAVEIN__); +DECLARE_HANDLE!(HWAVEOUT, HWAVEOUT__); +pub type LPHWAVEIN = *mut HWAVEIN; +pub type LPHWAVEOUT = *mut HWAVEOUT; +pub const WOM_OPEN: UINT = MM_WOM_OPEN; +pub const WOM_CLOSE: UINT = MM_WOM_CLOSE; +pub const WOM_DONE: UINT = MM_WOM_DONE; +pub const WIM_OPEN: UINT = MM_WIM_OPEN; +pub const WIM_CLOSE: UINT = MM_WIM_CLOSE; +pub const WIM_DATA: UINT = MM_WIM_DATA; +pub const WAVE_MAPPER: UINT = 0xFFFFFFFF; +pub const WAVE_FORMAT_QUERY: DWORD = 0x0001; +pub const WAVE_ALLOWSYNC: DWORD = 0x0002; +pub const WAVE_MAPPED: DWORD = 0x0004; +pub const WAVE_FORMAT_DIRECT: DWORD = 0x0008; +pub const WAVE_FORMAT_DIRECT_QUERY: DWORD = WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT; +pub const WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE: DWORD = 0x0010; +STRUCT!{struct WAVEHDR { + lpData: LPSTR, + dwBufferLength: DWORD, + dwBytesRecorded: DWORD, + dwUser: DWORD_PTR, + dwFlags: DWORD, + dwLoops: DWORD, + lpNext: *mut WAVEHDR, + reserved: DWORD_PTR, +}} +pub type PWAVEHDR = *mut WAVEHDR; +pub type NPWAVEHDR = *mut WAVEHDR; +pub type LPWAVEHDR = *mut WAVEHDR; +STRUCT!{struct WAVEOUTCAPSW { + wMid: WORD, + wPid: WORD, + vDriverVersion: MMVERSION, + szPname: [WCHAR; 32], + dwFormats: DWORD, + wChannels: WORD, + wReserved1: WORD, + dwSupport: DWORD, +}} +pub type PWAVEOUTCAPSW = *mut WAVEOUTCAPSW; +pub type NPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; +pub type LPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; +STRUCT!{struct WAVEINCAPSW { + wMid: WORD, + wPid: WORD, + vDriverVersion: MMVERSION, + szPname: [WCHAR; 32], + dwFormats: DWORD, + wChannels: WORD, + wReserved1: WORD, +}} +pub type PWAVEINCAPSW = *mut WAVEINCAPSW; +pub type NPWAVEINCAPSW = *mut WAVEINCAPSW; +pub type LPWAVEINCAPSW = *mut WAVEINCAPSW; +pub const WAVE_INVALIDFORMAT: DWORD = 0x00000000; +pub const WAVE_FORMAT_1M08: DWORD = 0x00000001; +pub const WAVE_FORMAT_1S08: DWORD = 0x00000002; +pub const WAVE_FORMAT_1M16: DWORD = 0x00000004; +pub const WAVE_FORMAT_1S16: DWORD = 0x00000008; +pub const WAVE_FORMAT_2M08: DWORD = 0x00000010; +pub const WAVE_FORMAT_2S08: DWORD = 0x00000020; +pub const WAVE_FORMAT_2M16: DWORD = 0x00000040; +pub const WAVE_FORMAT_2S16: DWORD = 0x00000080; +pub const WAVE_FORMAT_4M08: DWORD = 0x00000100; +pub const WAVE_FORMAT_4S08: DWORD = 0x00000200; +pub const WAVE_FORMAT_4M16: DWORD = 0x00000400; +pub const WAVE_FORMAT_4S16: DWORD = 0x00000800; +pub const WAVE_FORMAT_44M08: DWORD = 0x00000100; +pub const WAVE_FORMAT_44S08: DWORD = 0x00000200; +pub const WAVE_FORMAT_44M16: DWORD = 0x00000400; +pub const WAVE_FORMAT_44S16: DWORD = 0x00000800; +pub const WAVE_FORMAT_48M08: DWORD = 0x00001000; +pub const WAVE_FORMAT_48S08: DWORD = 0x00002000; +pub const WAVE_FORMAT_48M16: DWORD = 0x00004000; +pub const WAVE_FORMAT_48S16: DWORD = 0x00008000; +pub const WAVE_FORMAT_96M08: DWORD = 0x00010000; +pub const WAVE_FORMAT_96S08: DWORD = 0x00020000; +pub const WAVE_FORMAT_96M16: DWORD = 0x00040000; +pub const WAVE_FORMAT_96S16: DWORD = 0x00080000; +//782 (Win 7 SDK) +pub type PWAVEFORMATEX = *mut WAVEFORMATEX; +pub type NPWAVEFORMATEX = *mut WAVEFORMATEX; +pub type LPWAVEFORMATEX = *mut WAVEFORMATEX; +pub type LPCWAVEFORMATEX = *const WAVEFORMATEX; +//2170 (Win 7 SDK) +pub const TIMERR_NOERROR: MMRESULT = 0; +pub const TIMERR_NOCANDO: MMRESULT = TIMERR_BASE + 1; +pub const TIMERR_STRUCT: MMRESULT = TIMERR_BASE + 33; +//2198 (Win 7 SDK) +STRUCT!{struct TIMECAPS { + wPeriodMin: UINT, + wPeriodMax: UINT, +}} +pub type PTIMECAPS = *mut TIMECAPS; +pub type NPTIMECAPS = *mut TIMECAPS; +pub type LPTIMECAPS = *mut TIMECAPS; +STRUCT!{struct MIDIHDR { + lpData: LPSTR, + dwBufferLength: DWORD, + dwBytesRecorded: DWORD, + dwUser: DWORD_PTR, + dwFlags: DWORD, + lpNext: *mut MIDIHDR, + reserved: DWORD_PTR, + dwOffset: DWORD, + dwReserved: [DWORD_PTR; 4], +}} +pub type PMIDIHDR = *mut MIDIHDR; +pub type NPMIDIHDR = *mut MIDIHDR; +pub type LPMIDIHDR = *mut MIDIHDR; +STRUCT!{struct MIDIINCAPSW { + wMid: WORD, + wPid: WORD, + vDriverVersion: MMVERSION, + szPname: [WCHAR; 32], + dwSupport: DWORD, +}} +pub type PMIDIINCAPSW = *mut MIDIINCAPSW; +pub type NPMIDIINCAPSW = *mut MIDIINCAPSW; +pub type LPMIDIINCAPSW = *mut MIDIINCAPSW; +STRUCT!{struct MIDIOUTCAPSW { + wMid: WORD, + wPid: WORD, + vDriverVersion: MMVERSION, + szPname: [WCHAR; 32], + wTechnology: WORD, + wVoices: WORD, + wNotes: WORD, + wChannelMask: WORD, + dwSupport: DWORD, +}} +pub type PMIDIOUTCAPSW = *mut MIDIOUTCAPSW; +pub type NPMIDIOUTCAPSW = *mut MIDIOUTCAPSW; +pub type LPMIDIOUTCAPSW = *mut MIDIOUTCAPSW; +DECLARE_HANDLE!(HMIDIIN, HMIDIIN__); +DECLARE_HANDLE!(HMIDIOUT, HMIDIOUT__); +pub type LPHMIDIIN = *mut HMIDIIN; +pub type LPHMIDIOUT = *mut HMIDIOUT; +DECLARE_HANDLE!(HMIDISTRM, HMIDISTRM__); +DECLARE_HANDLE!(HMIDI, HMIDI__); +pub type LPHMIDISTRM = *mut HMIDISTRM; +pub type LPHMIDI = *mut HMIDI; diff --git a/src/vendor/winapi/src/um/mod.rs b/src/vendor/winapi/src/um/mod.rs new file mode 100644 index 0000000000..bc38e3588d --- /dev/null +++ b/src/vendor/winapi/src/um/mod.rs @@ -0,0 +1,229 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Headers for user mode only +pub mod gl; +#[cfg(feature = "audioclient")] pub mod audioclient; +#[cfg(feature = "audiosessiontypes")] pub mod audiosessiontypes; +#[cfg(feature = "avrt")] pub mod avrt; +#[cfg(feature = "cfgmgr32")] pub mod cfgmgr32; +#[cfg(feature = "cguid")] pub mod cguid; +#[cfg(feature = "combaseapi")] pub mod combaseapi; +#[cfg(feature = "coml2api")] pub mod coml2api; +#[cfg(feature = "commapi")] pub mod commapi; +#[cfg(feature = "commctrl")] pub mod commctrl; +#[cfg(feature = "commdlg")] pub mod commdlg; +#[cfg(feature = "commoncontrols")] pub mod commoncontrols; +#[cfg(feature = "consoleapi")] pub mod consoleapi; +#[cfg(feature = "corsym")] pub mod corsym; +#[cfg(feature = "d2d1")] pub mod d2d1; +#[cfg(feature = "d2d1_1")] pub mod d2d1_1; +#[cfg(feature = "d2d1_2")] pub mod d2d1_2; +#[cfg(feature = "d2d1effectauthor")] pub mod d2d1effectauthor; +#[cfg(feature = "d2d1effects")] pub mod d2d1effects; +#[cfg(feature = "d2d1effects_1")] pub mod d2d1effects_1; +#[cfg(feature = "d2d1effects_2")] pub mod d2d1effects_2; +#[cfg(feature = "d2dbasetypes")] pub mod d2dbasetypes; +#[cfg(feature = "d3d")] pub mod d3d; +#[cfg(feature = "d3d10")] pub mod d3d10; +#[cfg(feature = "d3d10_1")] pub mod d3d10_1; +#[cfg(feature = "d3d10_1shader")] pub mod d3d10_1shader; +#[cfg(feature = "d3d10effect")] pub mod d3d10effect; +#[cfg(feature = "d3d10misc")] pub mod d3d10misc; +#[cfg(feature = "d3d10sdklayers")] pub mod d3d10sdklayers; +#[cfg(feature = "d3d10shader")] pub mod d3d10shader; +#[cfg(feature = "d3d11")] pub mod d3d11; +#[cfg(feature = "d3d11_1")] pub mod d3d11_1; +#[cfg(feature = "d3d11_2")] pub mod d3d11_2; +#[cfg(feature = "d3d11_3")] pub mod d3d11_3; +#[cfg(feature = "d3d11_4")] pub mod d3d11_4; +#[cfg(feature = "d3d11on12")] pub mod d3d11on12; +#[cfg(feature = "d3d11sdklayers")] pub mod d3d11sdklayers; +#[cfg(feature = "d3d11shader")] pub mod d3d11shader; +#[cfg(feature = "d3d12")] pub mod d3d12; +#[cfg(feature = "d3d12sdklayers")] pub mod d3d12sdklayers; +#[cfg(feature = "d3d12shader")] pub mod d3d12shader; +#[cfg(feature = "d3dcommon")] pub mod d3dcommon; +#[cfg(feature = "d3dcompiler")] pub mod d3dcompiler; +#[cfg(feature = "d3dcsx")] pub mod d3dcsx; +#[cfg(feature = "d3dx10core")] pub mod d3dx10core; +#[cfg(feature = "d3dx10math")] pub mod d3dx10math; +#[cfg(feature = "d3dx10mesh")] pub mod d3dx10mesh; +#[cfg(feature = "datetimeapi")] pub mod datetimeapi; +#[cfg(feature = "davclnt")] pub mod davclnt; +#[cfg(feature = "dbghelp")] pub mod dbghelp; +#[cfg(feature = "dcommon")] pub mod dcommon; +#[cfg(feature = "dcomp")] pub mod dcomp; +#[cfg(feature = "dcompanimation")] pub mod dcompanimation; +#[cfg(feature = "dde")] pub mod dde; +#[cfg(feature = "ddraw")] pub mod ddraw; +#[cfg(feature = "ddrawi")] pub mod ddrawi; +#[cfg(feature = "ddrawint")] pub mod ddrawint; +#[cfg(feature = "debugapi")] pub mod debugapi; +#[cfg(feature = "dinput")] pub mod dinput; +#[cfg(feature = "dmksctl")] pub mod dmksctl; +#[cfg(feature = "dmusicc")] pub mod dmusicc; +#[cfg(feature = "docobj")] pub mod docobj; +#[cfg(feature = "documenttarget")] pub mod documenttarget; +#[cfg(feature = "dpa_dsa")] pub mod dpa_dsa; +#[cfg(feature = "dpapi")] pub mod dpapi; +#[cfg(feature = "dsgetdc")] pub mod dsgetdc; +#[cfg(feature = "dsound")] pub mod dsound; +#[cfg(feature = "dsrole")] pub mod dsrole; +#[cfg(feature = "dvp")] pub mod dvp; +#[cfg(feature = "dwmapi")] pub mod dwmapi; +#[cfg(feature = "dwrite")] pub mod dwrite; +#[cfg(feature = "dwrite_1")] pub mod dwrite_1; +#[cfg(feature = "dwrite_2")] pub mod dwrite_2; +#[cfg(feature = "dwrite_3")] pub mod dwrite_3; +#[cfg(feature = "dxdiag")] pub mod dxdiag; +#[cfg(feature = "dxfile")] pub mod dxfile; +#[cfg(feature = "dxgidebug")] pub mod dxgidebug; +#[cfg(feature = "errhandlingapi")] pub mod errhandlingapi; +#[cfg(feature = "fibersapi")] pub mod fibersapi; +#[cfg(feature = "fileapi")] pub mod fileapi; +#[cfg(feature = "handleapi")] pub mod handleapi; +#[cfg(feature = "heapapi")] pub mod heapapi; +#[cfg(feature = "http")] pub mod http; +#[cfg(feature = "imm")] pub mod imm; +#[cfg(feature = "interlockedapi")] pub mod interlockedapi; +#[cfg(feature = "ioapiset")] pub mod ioapiset; +#[cfg(feature = "jobapi")] pub mod jobapi; +#[cfg(feature = "jobapi2")] pub mod jobapi2; +#[cfg(feature = "knownfolders")] pub mod knownfolders; +#[cfg(feature = "ktmw32")] pub mod ktmw32; +#[cfg(feature = "libloaderapi")] pub mod libloaderapi; +#[cfg(feature = "lmaccess")] pub mod lmaccess; +#[cfg(feature = "lmalert")] pub mod lmalert; +#[cfg(feature = "lmapibuf")] pub mod lmapibuf; +#[cfg(feature = "lmat")] pub mod lmat; +#[cfg(feature = "lmdfs")] pub mod lmdfs; +#[cfg(feature = "lmerrlog")] pub mod lmerrlog; +#[cfg(feature = "lmjoin")] pub mod lmjoin; +#[cfg(feature = "lmmsg")] pub mod lmmsg; +#[cfg(feature = "lmremutl")] pub mod lmremutl; +#[cfg(feature = "lmrepl")] pub mod lmrepl; +#[cfg(feature = "lmserver")] pub mod lmserver; +#[cfg(feature = "lmshare")] pub mod lmshare; +#[cfg(feature = "lmstats")] pub mod lmstats; +#[cfg(feature = "lmsvc")] pub mod lmsvc; +#[cfg(feature = "lmuse")] pub mod lmuse; +#[cfg(feature = "lmwksta")] pub mod lmwksta; +#[cfg(feature = "lsalookup")] pub mod lsalookup; +#[cfg(feature = "memoryapi")] pub mod memoryapi; +#[cfg(feature = "minschannel")] pub mod minschannel; +#[cfg(feature = "minwinbase")] pub mod minwinbase; +#[cfg(feature = "mmdeviceapi")] pub mod mmdeviceapi; +#[cfg(feature = "mmeapi")] pub mod mmeapi; +#[cfg(feature = "mmsystem")] pub mod mmsystem; +#[cfg(feature = "msaatext")] pub mod msaatext; +#[cfg(feature = "mscat")] pub mod mscat; +#[cfg(feature = "mssip")] pub mod mssip; +#[cfg(feature = "namedpipeapi")] pub mod namedpipeapi; +#[cfg(feature = "namespaceapi")] pub mod namespaceapi; +#[cfg(feature = "nb30")] pub mod nb30; +#[cfg(feature = "ncrypt")] pub mod ncrypt; +#[cfg(feature = "ntsecapi")] pub mod ntsecapi; +#[cfg(feature = "oaidl")] pub mod oaidl; +#[cfg(feature = "objbase")] pub mod objbase; +#[cfg(feature = "objidl")] pub mod objidl; +#[cfg(feature = "objidlbase")] pub mod objidlbase; +#[cfg(feature = "ocidl")] pub mod ocidl; +#[cfg(feature = "oleauto")] pub mod oleauto; +#[cfg(feature = "olectl")] pub mod olectl; +#[cfg(feature = "pdh")] pub mod pdh; +#[cfg(feature = "playsoundapi")] pub mod playsoundapi; +#[cfg(feature = "powerbase")] pub mod powerbase; +#[cfg(feature = "powersetting")] pub mod powersetting; +#[cfg(feature = "powrprof")] pub mod powrprof; +#[cfg(feature = "processenv")] pub mod processenv; +#[cfg(feature = "processsnapshot")] pub mod processsnapshot; +#[cfg(feature = "processthreadsapi")] pub mod processthreadsapi; +#[cfg(feature = "processtopologyapi")] pub mod processtopologyapi; +#[cfg(feature = "profileapi")] pub mod profileapi; +#[cfg(feature = "propidl")] pub mod propidl; +#[cfg(feature = "propkeydef")] pub mod propkeydef; +#[cfg(feature = "propsys")] pub mod propsys; +#[cfg(feature = "prsht")] pub mod prsht; +#[cfg(feature = "psapi")] pub mod psapi; +#[cfg(feature = "realtimeapiset")] pub mod realtimeapiset; +#[cfg(feature = "reason")] pub mod reason; +#[cfg(feature = "restrictederrorinfo")] pub mod restrictederrorinfo; +#[cfg(feature = "rmxfguid")] pub mod rmxfguid; +#[cfg(feature = "sapi")] pub mod sapi; +#[cfg(feature = "sapi51")] pub mod sapi51; +#[cfg(feature = "sapi53")] pub mod sapi53; +#[cfg(feature = "sapiddk")] pub mod sapiddk; +#[cfg(feature = "sapiddk51")] pub mod sapiddk51; +#[cfg(feature = "schannel")] pub mod schannel; +#[cfg(feature = "securityappcontainer")] pub mod securityappcontainer; +#[cfg(feature = "servprov")] pub mod servprov; +#[cfg(feature = "setupapi")] pub mod setupapi; +#[cfg(feature = "shellapi")] pub mod shellapi; +#[cfg(feature = "shellscalingapi")] pub mod shellscalingapi; +#[cfg(feature = "shlobj")] pub mod shlobj; +#[cfg(feature = "shobjidl")] pub mod shobjidl; +#[cfg(feature = "shobjidl_core")] pub mod shobjidl_core; +#[cfg(feature = "shtypes")] pub mod shtypes; +#[cfg(feature = "spapidef")] pub mod spapidef; +#[cfg(feature = "sporder")] pub mod sporder; +#[cfg(feature = "sql")] pub mod sql; +#[cfg(feature = "sqlext")] pub mod sqlext; +#[cfg(feature = "sqltypes")] pub mod sqltypes; +#[cfg(feature = "sqlucode")] pub mod sqlucode; +#[cfg(feature = "sspi")] pub mod sspi; +#[cfg(feature = "stringapiset")] pub mod stringapiset; +#[cfg(feature = "strmif")] pub mod strmif; +#[cfg(feature = "subauth")] pub mod subauth; +#[cfg(feature = "synchapi")] pub mod synchapi; +#[cfg(feature = "sysinfoapi")] pub mod sysinfoapi; +#[cfg(feature = "systemtopologyapi")] pub mod systemtopologyapi; +#[cfg(feature = "textstor")] pub mod textstor; +#[cfg(feature = "threadpoolapiset")] pub mod threadpoolapiset; +#[cfg(feature = "threadpoollegacyapiset")] pub mod threadpoollegacyapiset; +#[cfg(feature = "timeapi")] pub mod timeapi; +#[cfg(feature = "timezoneapi")] pub mod timezoneapi; +#[cfg(feature = "tlhelp32")] pub mod tlhelp32; +#[cfg(feature = "unknwnbase")] pub mod unknwnbase; +#[cfg(feature = "urlhist")] pub mod urlhist; +#[cfg(feature = "urlmon")] pub mod urlmon; +#[cfg(feature = "userenv")] pub mod userenv; +#[cfg(feature = "usp10")] pub mod usp10; +#[cfg(feature = "utilapiset")] pub mod utilapiset; +#[cfg(feature = "vsbackup")] pub mod vsbackup; +#[cfg(feature = "vss")] pub mod vss; +#[cfg(feature = "vsserror")] pub mod vsserror; +#[cfg(feature = "vswriter")] pub mod vswriter; +#[cfg(feature = "werapi")] pub mod werapi; +#[cfg(feature = "winbase")] pub mod winbase; +#[cfg(feature = "wincodec")] pub mod wincodec; +#[cfg(feature = "wincodecsdk")] pub mod wincodecsdk; +#[cfg(feature = "wincon")] pub mod wincon; +#[cfg(feature = "wincred")] pub mod wincred; +#[cfg(feature = "wincrypt")] pub mod wincrypt; +#[cfg(feature = "windowsceip")] pub mod windowsceip; +#[cfg(feature = "winevt")] pub mod winevt; +#[cfg(feature = "wingdi")] pub mod wingdi; +#[cfg(feature = "winhttp")] pub mod winhttp; +#[cfg(feature = "wininet")] pub mod wininet; +#[cfg(feature = "winineti")] pub mod winineti; +#[cfg(feature = "winioctl")] pub mod winioctl; +#[cfg(feature = "winnetwk")] pub mod winnetwk; +#[cfg(feature = "winnls")] pub mod winnls; +#[cfg(feature = "winnt")] pub mod winnt; +#[cfg(feature = "winreg")] pub mod winreg; +#[cfg(feature = "winscard")] pub mod winscard; +#[cfg(feature = "winsmcrd")] pub mod winsmcrd; +#[cfg(feature = "winsock2")] pub mod winsock2; +#[cfg(feature = "winspool")] pub mod winspool; +#[cfg(feature = "winsvc")] pub mod winsvc; +#[cfg(feature = "winusb")] pub mod winusb; +#[cfg(feature = "winuser")] pub mod winuser; +#[cfg(feature = "winver")] pub mod winver; +#[cfg(feature = "wow64apiset")] pub mod wow64apiset; +#[cfg(feature = "ws2spi")] pub mod ws2spi; +#[cfg(feature = "ws2tcpip")] pub mod ws2tcpip; +#[cfg(feature = "xinput")] pub mod xinput; diff --git a/src/vendor/winapi/src/um/msaatext.rs b/src/vendor/winapi/src/um/msaatext.rs new file mode 100644 index 0000000000..e4b90cfe5d --- /dev/null +++ b/src/vendor/winapi/src/um/msaatext.rs @@ -0,0 +1,60 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{IID_ITfMSAAControl, + 0xb5f8fb3b, 0x393f, 0x4f7c, 0x84, 0xcb, 0x50, 0x49, 0x24, 0xc2, 0x70, 0x5a} +DEFINE_GUID!{IID_IInternalDocWrap, + 0xe1aa6466, 0x9db4, 0x40ba, 0xbe, 0x03, 0x77, 0xc3, 0x8e, 0x8e, 0x60, 0xb2} +DEFINE_GUID!{IID_ITextStoreACPEx, + 0xa2de3bc2, 0x3d8e, 0x11d3, 0x81, 0xa9, 0xf7, 0x53, 0xfb, 0xe6, 0x1a, 0x00} +DEFINE_GUID!{IID_ITextStoreAnchorEx, + 0xa2de3bc1, 0x3d8e, 0x11d3, 0x81, 0xa9, 0xf7, 0x53, 0xfb, 0xe6, 0x1a, 0x00} +DEFINE_GUID!{IID_ITextStoreACPSinkEx, + 0x2bdf9464, 0x41e2, 0x43e3, 0x95, 0x0c, 0xa6, 0x86, 0x5b, 0xa2, 0x5c, 0xd4} +DEFINE_GUID!{IID_ITextStoreSinkAnchorEx, + 0x25642426, 0x028d, 0x4474, 0x97, 0x7b, 0x11, 0x1b, 0xb1, 0x14, 0xfe, 0x3e} +DEFINE_GUID!{IID_IAccDictionary, + 0x1dc4cb5f, 0xd737, 0x474d, 0xad, 0xe9, 0x5c, 0xcf, 0xc9, 0xbc, 0x1c, 0xc9} +DEFINE_GUID!{IID_IVersionInfo, + 0x401518ec, 0xdb00, 0x4611, 0x9b, 0x29, 0x2a, 0x0e, 0x4b, 0x9a, 0xfa, 0x85} +DEFINE_GUID!{IID_ICoCreateLocally, + 0x03de00aa, 0xf272, 0x41e3, 0x99, 0xcb, 0x03, 0xc5, 0xe8, 0x11, 0x4e, 0xa0} +DEFINE_GUID!{IID_ICoCreatedLocally, + 0x0a53eb6c, 0x1908, 0x4742, 0x8c, 0xff, 0x2c, 0xee, 0x2e, 0x93, 0xf9, 0x4c} +DEFINE_GUID!{IID_IAccStore, + 0xe2cd4a63, 0x2b72, 0x4d48, 0xb7, 0x39, 0x95, 0xe4, 0x76, 0x51, 0x95, 0xba} +DEFINE_GUID!{IID_IAccServerDocMgr, + 0xad7c73cf, 0x6dd5, 0x4855, 0xab, 0xc2, 0xb0, 0x4b, 0xad, 0x5b, 0x91, 0x53} +DEFINE_GUID!{IID_IAccClientDocMgr, + 0x4c896039, 0x7b6d, 0x49e6, 0xa8, 0xc1, 0x45, 0x11, 0x6a, 0x98, 0x29, 0x2b} +DEFINE_GUID!{IID_IDocWrap, + 0xdcd285fe, 0x0be0, 0x43bd, 0x99, 0xc9, 0xaa, 0xae, 0xc5, 0x13, 0xc5, 0x55} +DEFINE_GUID!{IID_IClonableWrapper, + 0xb33e75ff, 0xe84c, 0x4dca, 0xa2, 0x5c, 0x33, 0xb8, 0xdc, 0x00, 0x33, 0x74} +DEFINE_GUID!{LIBID_MSAATEXTLib, + 0x150e2d7a, 0xdac1, 0x4582, 0x94, 0x7d, 0x2a, 0x8f, 0xd7, 0x8b, 0x82, 0xcd} +DEFINE_GUID!{CLSID_MSAAControl, + 0x08cd963f, 0x7a3e, 0x4f5c, 0x9b, 0xd8, 0xd6, 0x92, 0xbb, 0x04, 0x3c, 0x5b} +DEFINE_GUID!{CLSID_AccStore, + 0x5440837f, 0x4bff, 0x4ae5, 0xa1, 0xb1, 0x77, 0x22, 0xec, 0xc6, 0x33, 0x2a} +DEFINE_GUID!{CLSID_AccDictionary, + 0x6572ee16, 0x5fe5, 0x4331, 0xbb, 0x6d, 0x76, 0xa4, 0x9c, 0x56, 0xe4, 0x23} +DEFINE_GUID!{CLSID_AccServerDocMgr, + 0x6089a37e, 0xeb8a, 0x482d, 0xbd, 0x6f, 0xf9, 0xf4, 0x69, 0x04, 0xd1, 0x6d} +DEFINE_GUID!{CLSID_AccClientDocMgr, + 0xfc48cc30, 0x4f3e, 0x4fa1, 0x80, 0x3b, 0xad, 0x0e, 0x19, 0x6a, 0x83, 0xb1} +DEFINE_GUID!{CLSID_DocWrap, + 0xbf426f7e, 0x7a5e, 0x44d6, 0x83, 0x0c, 0xa3, 0x90, 0xea, 0x94, 0x62, 0xa3} +DEFINE_GUID!{IID_ITextStoreACP, + 0x28888fe3, 0xc2a0, 0x483a, 0xa3, 0xea, 0x8c, 0xb1, 0xce, 0x51, 0xff, 0x3d} +DEFINE_GUID!{IID_ITextStoreAnchor, + 0x9b2077b0, 0x5f18, 0x4dec, 0xbe, 0xe9, 0x3c, 0xc7, 0x22, 0xf5, 0xdf, 0xe0} +DEFINE_GUID!{IID_IAnchor, + 0x0feb7e34, 0x5a60, 0x4356, 0x8e, 0xf7, 0xab, 0xde, 0xc2, 0xff, 0x7c, 0xf8} +DEFINE_GUID!{IID_ITextStoreAnchorSink, + 0xaa80e905, 0x2021, 0x11d2, 0x93, 0xe0, 0x00, 0x60, 0xb0, 0x67, 0xb8, 0x6e} +DEFINE_GUID!{IID_ITextStoreACPSink, + 0x22d44c94, 0xa419, 0x4542, 0xa2, 0x72, 0xae, 0x26, 0x09, 0x3e, 0xce, 0xcf} diff --git a/src/vendor/winapi/src/um/mscat.rs b/src/vendor/winapi/src/um/mscat.rs new file mode 100644 index 0000000000..ba162e23a8 --- /dev/null +++ b/src/vendor/winapi/src/um/mscat.rs @@ -0,0 +1,37 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Microsoft Internet Security Catalog API Prototypes and Definitions +use shared::guiddef::GUID; +use shared::minwindef::DWORD; +use um::mssip::SIP_INDIRECT_DATA; +use um::wincrypt::{CRYPT_ATTR_BLOB, HCRYPTMSG, HCRYPTPROV}; +use um::winnt::{HANDLE, LPWSTR}; +STRUCT!{struct CRYPTCATSTORE { + cbStruct: DWORD, + dwPublicVersion: DWORD, + pwszP7File: LPWSTR, + hProv: HCRYPTPROV, + dwEncodingType: DWORD, + fdwStoreFlags: DWORD, + hReserved: HANDLE, + hAttrs: HANDLE, + hCryptMsg: HCRYPTMSG, + hSorted: HANDLE, +}} +STRUCT!{struct CRYPTCATMEMBER { + cbStruct: DWORD, + pwszReferenceTag: LPWSTR, + pwszFileName: LPWSTR, + gSubjectType: GUID, + fdwMemberFlags: DWORD, + pIndirectData: *mut SIP_INDIRECT_DATA, + dwCertVersion: DWORD, + dwReserved: DWORD, + hReserved: HANDLE, + sEncodedIndirectData: CRYPT_ATTR_BLOB, + sEncodedMemberInfo: CRYPT_ATTR_BLOB, +}} diff --git a/src/vendor/winapi/src/um/mssip.rs b/src/vendor/winapi/src/um/mssip.rs new file mode 100644 index 0000000000..185521fc0b --- /dev/null +++ b/src/vendor/winapi/src/um/mssip.rs @@ -0,0 +1,256 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Microsoft SIP Provider Prototypes and Definitions +use shared::guiddef::GUID; +use shared::minwindef::{BOOL, BYTE, DWORD, LPVOID}; +use um::mscat::{CRYPTCATMEMBER, CRYPTCATSTORE}; +use um::wincrypt::{ + CRYPT_ALGORITHM_IDENTIFIER, CRYPT_ATTRIBUTE_TYPE_VALUE, CRYPT_HASH_BLOB, HCRYPTPROV, +}; +use um::winnt::{HANDLE, LPCWSTR, PWSTR, WCHAR}; +pub type CRYPT_DIGEST_DATA = CRYPT_HASH_BLOB; +pub const MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE: DWORD = 0x00010000; +pub const MSSIP_FLAGS_USE_CATALOG: DWORD = 0x00020000; +pub const MSSIP_FLAGS_MULTI_HASH: DWORD = 0x00040000; +pub const SPC_INC_PE_RESOURCES_FLAG: DWORD = 0x80; +pub const SPC_INC_PE_DEBUG_INFO_FLAG: DWORD = 0x40; +pub const SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG: DWORD = 0x20; +pub const SPC_EXC_PE_PAGE_HASHES_FLAG: DWORD = 0x10; +pub const SPC_INC_PE_PAGE_HASHES_FLAG: DWORD = 0x100; +pub const SPC_DIGEST_GENERATE_FLAG: DWORD = 0x200; +pub const SPC_DIGEST_SIGN_FLAG: DWORD = 0x400; +pub const SPC_RELAXED_PE_MARKER_CHECK: DWORD = 0x800; +pub const SPC_MARKER_CHECK_SKIP_SIP_INDIRECT_DATA_FLAG: DWORD = 0x00000001; +pub const SPC_MARKER_CHECK_CURRENTLY_SUPPORTED_FLAGS: DWORD + = SPC_MARKER_CHECK_SKIP_SIP_INDIRECT_DATA_FLAG; +pub const MSSIP_ADDINFO_NONE: DWORD = 0; +pub const MSSIP_ADDINFO_FLAT: DWORD = 1; +pub const MSSIP_ADDINFO_CATMEMBER: DWORD = 2; +pub const MSSIP_ADDINFO_BLOB: DWORD = 3; +pub const MSSIP_ADDINFO_NONMSSIP: DWORD = 500; +UNION!{union SIP_SUBJECTINFO_u { + [usize; 1], + psFlat psFlat_mut: *mut MS_ADDINFO_FLAT, + psCatMember psCatMember_mut: *mut MS_ADDINFO_CATALOGMEMBER, + psBlob psBlob_mut: *mut MS_ADDINFO_BLOB, +}} +STRUCT!{struct SIP_SUBJECTINFO { + cbSize: DWORD, + pgSubjectType: *mut GUID, + hFile: HANDLE, + pwsFileName: LPCWSTR, + pwsDisplayName: LPCWSTR, + dwReserved1: DWORD, + dwIntVersion: DWORD, + hProv: HCRYPTPROV, + DigestAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + dwFlags: DWORD, + dwEncodingType: DWORD, + dwReserved2: DWORD, + fdwCAPISettings: DWORD, + fdwSecuritySettings: DWORD, + dwIndex: DWORD, + dwUnionChoice: DWORD, + u: SIP_SUBJECTINFO_u, + pClientData: LPVOID, +}} +pub type LPSIP_SUBJECTINFO = *mut SIP_SUBJECTINFO; +STRUCT!{struct MS_ADDINFO_FLAT { + cbStruct: DWORD, + pIndirectData: *mut SIP_INDIRECT_DATA, +}} +pub type PMS_ADDINFO_FLAT = *mut MS_ADDINFO_FLAT; +STRUCT!{struct MS_ADDINFO_CATALOGMEMBER { + cbStruct: DWORD, + pStore: *mut CRYPTCATSTORE, + pMember: *mut CRYPTCATMEMBER, +}} +pub type PMS_ADDINFO_CATALOGMEMBER = *mut MS_ADDINFO_CATALOGMEMBER; +STRUCT!{struct MS_ADDINFO_BLOB { + cbStruct: DWORD, + cbMemObject: DWORD, + pbMemObject: *mut BYTE, + cbMemSignedMsg: DWORD, + pbMemSignedMsg: *mut BYTE, +}} +pub type PMS_ADDINFO_BLOB = *mut MS_ADDINFO_BLOB; +STRUCT!{struct SIP_CAP_SET_V2 { + cbSize: DWORD, + dwVersion: DWORD, + isMultiSign: BOOL, + dwReserved: DWORD, +}} +pub type PSIP_CAP_SET_V2 = *mut SIP_CAP_SET_V2; +UNION!{union SIP_CAP_SET_V3_u { + [u32; 1], + dwFlags dwFlags_mut: DWORD, + dwReserved dwReserved_mut: DWORD, +}} +STRUCT!{struct SIP_CAP_SET_V3 { + cbSize: DWORD, + dwVersion: DWORD, + isMultiSign: BOOL, + u: SIP_CAP_SET_V3_u, +}} +pub type PSIP_CAP_SET_V3 = *mut SIP_CAP_SET_V3; +pub type SIP_CAP_SET = SIP_CAP_SET_V3; +pub type PSIP_CAP_SET = PSIP_CAP_SET_V3; +pub const SIP_CAP_SET_VERSION_2: DWORD = 2; +pub const SIP_CAP_SET_VERSION_3: DWORD = 3; +pub const SIP_CAP_SET_CUR_VER: DWORD = 3; +pub const SIP_CAP_FLAG_SEALING: DWORD = 0x00000001; +STRUCT!{struct SIP_INDIRECT_DATA { + Data: CRYPT_ATTRIBUTE_TYPE_VALUE, + DigestAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Digest: CRYPT_HASH_BLOB, +}} +pub type PSIP_INDIRECT_DATA = *mut SIP_INDIRECT_DATA; +extern "system" { + pub fn CryptSIPGetSignedDataMsg( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pdwEncodingType: *mut DWORD, + dwIndex: DWORD, + pcbSignedDataMsg: *mut DWORD, + pbSignedDataMsg: *mut BYTE, + ) -> BOOL; +} +FN!{stdcall pCryptSIPGetSignedDataMsg( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pdwEncodingType: *mut DWORD, + dwIndex: DWORD, + pcbSignedDataMsg: *mut DWORD, + pbSignedDataMsg: *mut BYTE, +) -> BOOL} +extern "system" { + pub fn CryptSIPPutSignedDataMsg( + pSubjectInfo: *mut SIP_SUBJECTINFO, + dwEncodingType: DWORD, + pdwIndex: *mut DWORD, + cbSignedDataMsg: DWORD, + pbSignedDataMsg: *mut BYTE, + ) -> BOOL; +} +FN!{stdcall pCryptSIPPutSignedDataMsg( + pSubjectInfo: *mut SIP_SUBJECTINFO, + dwEncodingType: DWORD, + pdwIndex: *mut DWORD, + cbSignedDataMsg: DWORD, + pbSignedDataMsg: *mut BYTE, +) -> BOOL} +extern "system" { + pub fn CryptSIPCreateIndirectData( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pcbIndirectData: *mut DWORD, + pIndirectData: *mut SIP_INDIRECT_DATA, + ) -> BOOL; +} +FN!{stdcall pCryptSIPCreateIndirectData( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pcbIndirectData: *mut DWORD, + pIndirectData: *mut SIP_INDIRECT_DATA, +) -> BOOL} +extern "system" { + pub fn CryptSIPVerifyIndirectData( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pIndirectData: *mut SIP_INDIRECT_DATA, + ) -> BOOL; +} +FN!{stdcall pCryptSIPVerifyIndirectData( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pIndirectData: *mut SIP_INDIRECT_DATA, +) -> BOOL} +extern "system" { + pub fn CryptSIPRemoveSignedDataMsg( + pSubjectInfo: *mut SIP_SUBJECTINFO, + dwIndex: DWORD, + ) -> BOOL; +} +FN!{stdcall pCryptSIPRemoveSignedDataMsg( + pSubjectInfo: *mut SIP_SUBJECTINFO, + dwIndex: DWORD, +) -> BOOL} +STRUCT!{struct SIP_DISPATCH_INFO { + cbSize: DWORD, + hSIP: HANDLE, + pfGet: pCryptSIPGetSignedDataMsg, + pfPut: pCryptSIPPutSignedDataMsg, + pfCreate: pCryptSIPCreateIndirectData, + pfVerify: pCryptSIPVerifyIndirectData, + pfRemove: pCryptSIPRemoveSignedDataMsg, +}} +pub type LPSIP_DISPATCH_INFO = *mut SIP_DISPATCH_INFO; +FN!{stdcall pfnIsFileSupported( + hFile: HANDLE, + pgSubject: *mut GUID, +) -> BOOL} +FN!{stdcall pfnIsFileSupportedName( + pwszFileName: *mut WCHAR, + pgSubject: *mut GUID, +) -> BOOL} +STRUCT!{struct SIP_ADD_NEWPROVIDER { + cbStruct: DWORD, + pgSubject: *mut GUID, + pwszDLLFileName: *mut WCHAR, + pwszMagicNumber: *mut WCHAR, + pwszIsFunctionName: *mut WCHAR, + pwszGetFuncName: *mut WCHAR, + pwszPutFuncName: *mut WCHAR, + pwszCreateFuncName: *mut WCHAR, + pwszVerifyFuncName: *mut WCHAR, + pwszRemoveFuncName: *mut WCHAR, + pwszIsFunctionNameFmt2: *mut WCHAR, + pwszGetCapFuncName: PWSTR, +}} +pub type PSIP_ADD_NEWPROVIDER = *mut SIP_ADD_NEWPROVIDER; +pub const SIP_MAX_MAGIC_NUMBER: DWORD = 4; +extern "system" { + pub fn CryptSIPLoad( + pgSubject: *const GUID, + dwFlags: DWORD, + pSipDispatch: *mut SIP_DISPATCH_INFO, + ) -> BOOL; + pub fn CryptSIPRetrieveSubjectGuid( + FileName: LPCWSTR, + hFileIn: HANDLE, + pgSubject: *mut GUID, + ) -> BOOL; + pub fn CryptSIPRetrieveSubjectGuidForCatalogFile( + FileName: LPCWSTR, + hFileIn: HANDLE, + pgSubject: *mut GUID, + ) -> BOOL; + pub fn CryptSIPAddProvider( + psNewProv: *mut SIP_ADD_NEWPROVIDER, + ) -> BOOL; + pub fn CryptSIPRemoveProvider( + pgProv: *mut GUID, + ) -> BOOL; + pub fn CryptSIPGetCaps( + pSubjInfo: *mut SIP_SUBJECTINFO, + pCaps: *mut SIP_CAP_SET, + ) -> BOOL; +} +FN!{stdcall pCryptSIPGetCaps( + pSubjInfo: *mut SIP_SUBJECTINFO, + pCaps: *mut SIP_CAP_SET, +) -> BOOL} +extern "system" { + pub fn CryptSIPGetSealedDigest( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pSig: *const BYTE, + dwSig: DWORD, + pbDigest: *mut BYTE, + pcbDigest: *mut DWORD, + ) -> BOOL; +} +FN!{stdcall pCryptSIPGetSealedDigest( + pSubjectInfo: *mut SIP_SUBJECTINFO, + pSig: *const BYTE, + dwSig: DWORD, + pbDigest: *mut BYTE, + pcbDigest: *mut DWORD, +) -> BOOL} diff --git a/src/vendor/winapi/src/um/namedpipeapi.rs b/src/vendor/winapi/src/um/namedpipeapi.rs new file mode 100644 index 0000000000..39f8af6d2f --- /dev/null +++ b/src/vendor/winapi/src/um/namedpipeapi.rs @@ -0,0 +1,91 @@ +// Copyright © 202017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID, ULONG}; +use um::minwinbase::{LPOVERLAPPED, LPSECURITY_ATTRIBUTES}; +use um::winnt::{HANDLE, LPCWSTR, LPWSTR, PHANDLE}; +extern "system" { + pub fn CreatePipe( + hReadPipe: PHANDLE, + hWritePipe: PHANDLE, + lpPipeAttributes: LPSECURITY_ATTRIBUTES, + nSize: DWORD, + ) -> BOOL; + pub fn ConnectNamedPipe( + hNamedPipe: HANDLE, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn DisconnectNamedPipe( + hNamedPipe: HANDLE, + ) -> BOOL; + pub fn SetNamedPipeHandleState( + hNamedPipe: HANDLE, + lpMode: LPDWORD, + lpMaxCollectionCount: LPDWORD, + lpCollectDataTimeout: LPDWORD, + ) -> BOOL; + pub fn PeekNamedPipe( + hNamedPipe: HANDLE, + lpBuffer: LPVOID, + nBufferSize: DWORD, + lpBytesRead: LPDWORD, + lpTotalBytesAvail: LPDWORD, + lpBytesLeftThisMessage: LPDWORD, + ) -> BOOL; + pub fn TransactNamedPipe( + hNamedPipe: HANDLE, + lpInBuffer: LPVOID, + nInBufferSize: DWORD, + lpOutBuffer: LPVOID, + nOutBufferSize: DWORD, + lpBytesRead: LPDWORD, + lpOverlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn CreateNamedPipeW( + lpName: LPCWSTR, + dwOpenMode: DWORD, + dwPipeMode: DWORD, + nMaxInstances: DWORD, + nOutBufferSize: DWORD, + nInBufferSize: DWORD, + nDefaultTimeOut: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn WaitNamedPipeW( + lpNamedPipeName: LPCWSTR, + nTimeOut: DWORD, + ) -> BOOL; + pub fn GetNamedPipeClientComputerNameW( + Pipe: HANDLE, + ClientComputerName: LPWSTR, + ClientComputerNameLength: ULONG, + ) -> BOOL; + pub fn GetNamedPipeInfo( + hNamedPipe: HANDLE, + lpFlags: LPDWORD, + lpOutBufferSize: LPDWORD, + lpInBufferSize: LPDWORD, + lpMaxInstances: LPDWORD, + ) -> BOOL; + pub fn GetNamedPipeHandleStateW( + hNamedPipe: HANDLE, + lpState: LPDWORD, + lpCurInstances: LPDWORD, + lpMaxCollectionCount: LPDWORD, + lpCollectDataTimeout: LPDWORD, + lpUserName: LPWSTR, + nMaxUserNameSize: DWORD, + ) -> BOOL; + pub fn CallNamedPipeW( + lpNamedPipeName: LPCWSTR, + lpInBuffer: LPVOID, + nInBufferSize: DWORD, + lpOutBuffer: LPVOID, + nOutBufferSize: DWORD, + lpBytesRead: LPDWORD, + nTimeOut: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/namespaceapi.rs b/src/vendor/winapi/src/um/namespaceapi.rs new file mode 100644 index 0000000000..622290699f --- /dev/null +++ b/src/vendor/winapi/src/um/namespaceapi.rs @@ -0,0 +1,37 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +use shared::minwindef::{BOOL, LPVOID, ULONG}; +use shared::ntdef::{BOOLEAN, HANDLE, LPCWSTR}; +use um::minwinbase::LPSECURITY_ATTRIBUTES; +use um::winnt::PSID; +pub const PRIVATE_NAMESPACE_FLAG_DESTROY: ULONG = 0x00000001; +extern "system" { + pub fn CreatePrivateNamespaceW( + lpPrivateNamespaceAttributes: LPSECURITY_ATTRIBUTES, + lpBoundaryDescriptor: LPVOID, + lpAliasPrefix: LPCWSTR, + ) -> HANDLE; + pub fn OpenPrivateNamespaceW( + lpBoundaryDescriptor: LPVOID, + lpAliasPrefix: LPCWSTR, + ) -> HANDLE; + pub fn ClosePrivateNamespace( + Handle: HANDLE, + Flags: ULONG, + ) -> BOOLEAN; + pub fn CreateBoundaryDescriptorW( + Name: LPCWSTR, + Flags: ULONG, + ) -> HANDLE; + pub fn AddSIDToBoundaryDescriptor( + BoundaryDescriptor: *mut HANDLE, + RequiredSid: PSID, + ) -> BOOL; + pub fn DeleteBoundaryDescriptor( + BoundaryDescriptor: HANDLE, + ) -> (); +} diff --git a/src/vendor/winapi/src/um/nb30.rs b/src/vendor/winapi/src/um/nb30.rs new file mode 100644 index 0000000000..e7c3138416 --- /dev/null +++ b/src/vendor/winapi/src/um/nb30.rs @@ -0,0 +1,215 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module contains the definitions for portable NetBIOS 3.0 support. +use shared::minwindef::{DWORD, PUCHAR, UCHAR, ULONG, USHORT, WORD}; +use um::winnt::HANDLE; +pub const NCBNAMSZ: usize = 16; +pub const MAX_LANA: usize = 254; +FN!{stdcall PFPOST( + *mut NCB, +) -> ()} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct NCB { + ncb_command: UCHAR, + ncb_retcode: UCHAR, + ncb_lsn: UCHAR, + ncb_num: UCHAR, + ncb_buffer: PUCHAR, + ncb_length: WORD, + ncb_callname: [UCHAR; NCBNAMSZ], + ncb_name: [UCHAR; NCBNAMSZ], + ncb_rto: UCHAR, + ncb_sto: UCHAR, + ncb_post: PFPOST, + ncb_lana_num: UCHAR, + ncb_cmd_cplt: UCHAR, + ncb_reserve: [UCHAR; 18], + ncb_event: HANDLE, +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct NCB { + ncb_command: UCHAR, + ncb_retcode: UCHAR, + ncb_lsn: UCHAR, + ncb_num: UCHAR, + ncb_buffer: PUCHAR, + ncb_length: WORD, + ncb_callname: [UCHAR; NCBNAMSZ], + ncb_name: [UCHAR; NCBNAMSZ], + ncb_rto: UCHAR, + ncb_sto: UCHAR, + ncb_post: PFPOST, + ncb_lana_num: UCHAR, + ncb_cmd_cplt: UCHAR, + ncb_reserve: [UCHAR; 10], + ncb_event: HANDLE, +}} +pub type PNCB = *mut NCB; +STRUCT!{struct ADAPTER_STATUS { + adapter_address: [UCHAR; 6], + rev_major: UCHAR, + reserved0: UCHAR, + adapter_type: UCHAR, + rev_minor: UCHAR, + duration: WORD, + frmr_recv: WORD, + frmr_xmit: WORD, + iframe_recv_err: WORD, + xmit_aborts: WORD, + xmit_success: DWORD, + recv_success: DWORD, + iframe_xmit_err: WORD, + recv_buff_unavail: WORD, + t1_timeouts: WORD, + ti_timeouts: WORD, + reserved1: DWORD, + free_ncbs: WORD, + max_cfg_ncbs: WORD, + max_ncbs: WORD, + xmit_buf_unavail: WORD, + max_dgram_size: WORD, + pending_sess: WORD, + max_cfg_sess: WORD, + max_sess: WORD, + max_sess_pkt_size: WORD, + name_count: WORD, +}} +pub type PADAPTER_STATUS = *mut ADAPTER_STATUS; +STRUCT!{struct NAME_BUFFER { + name: [UCHAR; NCBNAMSZ], + name_num: UCHAR, + name_flags: UCHAR, +}} +pub type PNAME_BUFFER = *mut NAME_BUFFER; +pub const NAME_FLAGS_MASK: UCHAR = 0x87; +pub const GROUP_NAME: UCHAR = 0x80; +pub const UNIQUE_NAME: UCHAR = 0x00; +pub const REGISTERING: UCHAR = 0x00; +pub const REGISTERED: UCHAR = 0x04; +pub const DEREGISTERED: UCHAR = 0x05; +pub const DUPLICATE: UCHAR = 0x06; +pub const DUPLICATE_DEREG: UCHAR = 0x07; +STRUCT!{struct SESSION_HEADER { + sess_name: UCHAR, + num_sess: UCHAR, + rcv_dg_outstanding: UCHAR, + rcv_any_outstanding: UCHAR, +}} +pub type PSESSION_HEADER = *mut SESSION_HEADER; +STRUCT!{struct SESSION_BUFFER { + lsn: UCHAR, + state: UCHAR, + local_name: [UCHAR; NCBNAMSZ], + remote_name: [UCHAR; NCBNAMSZ], + rcvs_outstanding: UCHAR, + sends_outstanding: UCHAR, +}} +pub type PSESSION_BUFFER = *mut SESSION_BUFFER; +pub const LISTEN_OUTSTANDING: UCHAR = 0x01; +pub const CALL_PENDING: UCHAR = 0x02; +pub const SESSION_ESTABLISHED: UCHAR = 0x03; +pub const HANGUP_PENDING: UCHAR = 0x04; +pub const HANGUP_COMPLETE: UCHAR = 0x05; +pub const SESSION_ABORTED: UCHAR = 0x06; +STRUCT!{struct LANA_ENUM { + length: UCHAR, + lana: [UCHAR; MAX_LANA + 1], +}} +pub type PLANA_ENUM = *mut LANA_ENUM; +STRUCT!{struct FIND_NAME_HEADER { + node_count: WORD, + reserved: UCHAR, + unique_group: UCHAR, +}} +pub type PFIND_NAME_HEADER = *mut FIND_NAME_HEADER; +STRUCT!{struct FIND_NAME_BUFFER { + length: UCHAR, + access_control: UCHAR, + frame_control: UCHAR, + destination_addr: [UCHAR; 6], + source_addr: [UCHAR; 6], + routing_info: [UCHAR; 18], +}} +pub type PFIND_NAME_BUFFER = *mut FIND_NAME_BUFFER; +STRUCT!{struct ACTION_HEADER { + transport_id: ULONG, + action_code: USHORT, + reserved: USHORT, +}} +pub type PACTION_HEADER = *mut ACTION_HEADER; +pub const ALL_TRANSPORTS: ULONG = 0x0000004d; +pub const MS_NBF: ULONG = 0x46424e4d; +pub const NCBCALL: UCHAR = 0x10; +pub const NCBLISTEN: UCHAR = 0x11; +pub const NCBHANGUP: UCHAR = 0x12; +pub const NCBSEND: UCHAR = 0x14; +pub const NCBRECV: UCHAR = 0x15; +pub const NCBRECVANY: UCHAR = 0x16; +pub const NCBCHAINSEND: UCHAR = 0x17; +pub const NCBDGSEND: UCHAR = 0x20; +pub const NCBDGRECV: UCHAR = 0x21; +pub const NCBDGSENDBC: UCHAR = 0x22; +pub const NCBADDNAME: UCHAR = 0x30; +pub const NCBDELNAME: UCHAR = 0x31; +pub const NCBRESET: UCHAR = 0x32; +pub const NCBASTAT: UCHAR = 0x33; +pub const NCBSSTAT: UCHAR = 0x34; +pub const NCBCANCEL: UCHAR = 0x35; +pub const NCBADDGRNAME: UCHAR = 0x36; +pub const NCBENUM: UCHAR = 0x37; +pub const NCBUNLINK: UCHAR = 0x70; +pub const NCBSENDNA: UCHAR = 0x71; +pub const NCBCHAINSENDNA: UCHAR = 0x72; +pub const NCBLANSTALERT: UCHAR = 0x73; +pub const NCBACTION: UCHAR = 0x77; +pub const NCBFINDNAME: UCHAR = 0x78; +pub const NCBTRACE: UCHAR = 0x79; +pub const ASYNCH: UCHAR = 0x80; +pub const NRC_GOODRET: UCHAR = 0x00; +pub const NRC_BUFLEN: UCHAR = 0x01; +pub const NRC_ILLCMD: UCHAR = 0x03; +pub const NRC_CMDTMO: UCHAR = 0x05; +pub const NRC_INCOMP: UCHAR = 0x06; +pub const NRC_BADDR: UCHAR = 0x07; +pub const NRC_SNUMOUT: UCHAR = 0x08; +pub const NRC_NORES: UCHAR = 0x09; +pub const NRC_SCLOSED: UCHAR = 0x0a; +pub const NRC_CMDCAN: UCHAR = 0x0b; +pub const NRC_DUPNAME: UCHAR = 0x0d; +pub const NRC_NAMTFUL: UCHAR = 0x0e; +pub const NRC_ACTSES: UCHAR = 0x0f; +pub const NRC_LOCTFUL: UCHAR = 0x11; +pub const NRC_REMTFUL: UCHAR = 0x12; +pub const NRC_ILLNN: UCHAR = 0x13; +pub const NRC_NOCALL: UCHAR = 0x14; +pub const NRC_NOWILD: UCHAR = 0x15; +pub const NRC_INUSE: UCHAR = 0x16; +pub const NRC_NAMERR: UCHAR = 0x17; +pub const NRC_SABORT: UCHAR = 0x18; +pub const NRC_NAMCONF: UCHAR = 0x19; +pub const NRC_IFBUSY: UCHAR = 0x21; +pub const NRC_TOOMANY: UCHAR = 0x22; +pub const NRC_BRIDGE: UCHAR = 0x23; +pub const NRC_CANOCCR: UCHAR = 0x24; +pub const NRC_CANCEL: UCHAR = 0x26; +pub const NRC_DUPENV: UCHAR = 0x30; +pub const NRC_ENVNOTDEF: UCHAR = 0x34; +pub const NRC_OSRESNOTAV: UCHAR = 0x35; +pub const NRC_MAXAPPS: UCHAR = 0x36; +pub const NRC_NOSAPS: UCHAR = 0x37; +pub const NRC_NORESOURCES: UCHAR = 0x38; +pub const NRC_INVADDRESS: UCHAR = 0x39; +pub const NRC_INVDDID: UCHAR = 0x3B; +pub const NRC_LOCKFAIL: UCHAR = 0x3C; +pub const NRC_OPENERR: UCHAR = 0x3f; +pub const NRC_SYSTEM: UCHAR = 0x40; +pub const NRC_PENDING: UCHAR = 0xff; +extern "system" { + pub fn Netbios( + pncb: PNCB, + ) -> UCHAR; +} diff --git a/src/vendor/winapi/src/um/ncrypt.rs b/src/vendor/winapi/src/um/ncrypt.rs new file mode 100644 index 0000000000..7c7129e048 --- /dev/null +++ b/src/vendor/winapi/src/um/ncrypt.rs @@ -0,0 +1,18 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::ULONG_PTR; +use shared::sspi::SECURITY_STATUS; +pub type NCRYPT_HANDLE = ULONG_PTR; +pub type NCRYPT_PROV_HANDLE = ULONG_PTR; +pub type NCRYPT_KEY_HANDLE = ULONG_PTR; +pub type NCRYPT_HASH_HANDLE = ULONG_PTR; +pub type NCRYPT_SECRET_HANDLE = ULONG_PTR; +extern "system" { + pub fn NCryptFreeObject( + hObject: NCRYPT_HANDLE, + ) -> SECURITY_STATUS; +} diff --git a/src/vendor/winapi/src/um/ntsecapi.rs b/src/vendor/winapi/src/um/ntsecapi.rs new file mode 100644 index 0000000000..ed89c06a31 --- /dev/null +++ b/src/vendor/winapi/src/um/ntsecapi.rs @@ -0,0 +1,1658 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the Local Security Authority APIs. + +use shared::basetsd::{ULONG64, ULONG_PTR}; +use shared::guiddef::GUID; +use shared::minwindef::{PUCHAR, UCHAR, ULONG, USHORT}; +use shared::ntdef::NTSTATUS; +use shared::sspi::SecHandle; +use um::lsalookup::{ + LSA_TRUST_INFORMATION, LSA_UNICODE_STRING, PLSA_TRUST_INFORMATION, PLSA_UNICODE_STRING +}; +use um::subauth::{PUNICODE_STRING, STRING, UNICODE_STRING}; +use um::winnt::{ + ACCESS_MASK, ANYSIZE_ARRAY, BOOLEAN, LARGE_INTEGER, LONG, LUID, PSECURITY_DESCRIPTOR, PSID, + PVOID, PWSTR, QUOTA_LIMITS, SHORT, SID_NAME_USE, STANDARD_RIGHTS_EXECUTE, STANDARD_RIGHTS_READ, + STANDARD_RIGHTS_REQUIRED, STANDARD_RIGHTS_WRITE, ULONGLONG +}; + +DEFINE_GUID!(Audit_System_SecurityStateChange, + 0x0cce9210, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_SecuritySubsystemExtension, + 0x0cce9211, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_Integrity, + 0x0cce9212, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_IPSecDriverEvents, + 0x0cce9213, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System_Others, + 0x0cce9214, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Logon, + 0x0cce9215, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Logoff, + 0x0cce9216, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_AccountLockout, + 0x0cce9217, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_IPSecMainMode, + 0x0cce9218, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_IPSecQuickMode, + 0x0cce9219, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_IPSecUserMode, + 0x0cce921a, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_SpecialLogon, + 0x0cce921b, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Others, + 0x0cce921c, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_FileSystem, + 0x0cce921d, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Registry, + 0x0cce921e, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Kernel, + 0x0cce921f, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Sam, + 0x0cce9220, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_CertificationServices, + 0x0cce9221, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_ApplicationGenerated, + 0x0cce9222, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Handle, + 0x0cce9223, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Share, + 0x0cce9224, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_FirewallPacketDrops, + 0x0cce9225, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_FirewallConnection, + 0x0cce9226, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_Other, + 0x0cce9227, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse_Sensitive, + 0x0cce9228, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse_NonSensitive, + 0x0cce9229, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse_Others, + 0x0cce922a, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_ProcessCreation, + 0x0cce922b, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_ProcessTermination, + 0x0cce922c, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_DpapiActivity, + 0x0cce922d, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking_RpcCall, + 0x0cce922e, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_AuditPolicy, + 0x0cce922f, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_AuthenticationPolicy, + 0x0cce9230, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_AuthorizationPolicy, + 0x0cce9231, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_MpsscvRulePolicy, + 0x0cce9232, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_WfpIPSecPolicy, + 0x0cce9233, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange_Others, + 0x0cce9234, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_UserAccount, + 0x0cce9235, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_ComputerAccount, + 0x0cce9236, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_SecurityGroup, + 0x0cce9237, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_DistributionGroup, + 0x0cce9238, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_ApplicationGroup, + 0x0cce9239, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement_Others, + 0x0cce923a, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DSAccess_DSAccess, + 0x0cce923b, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DsAccess_AdAuditChanges, + 0x0cce923c, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Ds_Replication, + 0x0cce923d, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Ds_DetailedReplication, + 0x0cce923e, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_CredentialValidation, + 0x0cce923f, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_Kerberos, + 0x0cce9240, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_Others, + 0x0cce9241, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon_KerbCredentialValidation, + 0x0cce9242, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_NPS, + 0x0cce9243, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_DetailedFileShare, + 0x0cce9244, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_RemovableStorage, + 0x0cce9245, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess_CbacStaging, + 0x0cce9246, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon_Claims, + 0x0cce9247, 0x69ae, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_System, + 0x69979848, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_Logon, + 0x69979849, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_ObjectAccess, + 0x6997984a, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PrivilegeUse, + 0x6997984b, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DetailedTracking, + 0x6997984c, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_PolicyChange, + 0x6997984d, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountManagement, + 0x6997984e, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_DirectoryServiceAccess, + 0x6997984f, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +DEFINE_GUID!(Audit_AccountLogon, + 0x69979850, 0x797a, 0x11d9, 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); +ENUM!{enum POLICY_AUDIT_EVENT_TYPE { + AuditCategorySystem = 0, + AuditCategoryLogon, + AuditCategoryObjectAccess, + AuditCategoryPrivilegeUse, + AuditCategoryDetailedTracking, + AuditCategoryPolicyChange, + AuditCategoryAccountManagement, + AuditCategoryDirectoryServiceAccess, + AuditCategoryAccountLogon, +}} +pub type PPOLICY_AUDIT_EVENT_TYPE = *mut POLICY_AUDIT_EVENT_TYPE; +pub const POLICY_AUDIT_EVENT_UNCHANGED: POLICY_AUDIT_EVENT_OPTIONS = 0x00000000; +pub const POLICY_AUDIT_EVENT_SUCCESS: POLICY_AUDIT_EVENT_OPTIONS = 0x00000001; +pub const POLICY_AUDIT_EVENT_FAILURE: POLICY_AUDIT_EVENT_OPTIONS = 0x00000002; +pub const POLICY_AUDIT_EVENT_NONE: POLICY_AUDIT_EVENT_OPTIONS = 0x00000004; +pub const POLICY_AUDIT_EVENT_MASK: POLICY_AUDIT_EVENT_OPTIONS = POLICY_AUDIT_EVENT_SUCCESS + | POLICY_AUDIT_EVENT_FAILURE | POLICY_AUDIT_EVENT_UNCHANGED | POLICY_AUDIT_EVENT_NONE; +pub const POLICY_VIEW_LOCAL_INFORMATION: ACCESS_MASK = 0x00000001; +pub const POLICY_VIEW_AUDIT_INFORMATION: ACCESS_MASK = 0x00000002; +pub const POLICY_GET_PRIVATE_INFORMATION: ACCESS_MASK = 0x00000004; +pub const POLICY_TRUST_ADMIN: ACCESS_MASK = 0x00000008; +pub const POLICY_CREATE_ACCOUNT: ACCESS_MASK = 0x00000010; +pub const POLICY_CREATE_SECRET: ACCESS_MASK = 0x00000020; +pub const POLICY_CREATE_PRIVILEGE: ACCESS_MASK = 0x00000040; +pub const POLICY_SET_DEFAULT_QUOTA_LIMITS: ACCESS_MASK = 0x00000080; +pub const POLICY_SET_AUDIT_REQUIREMENTS: ACCESS_MASK = 0x00000100; +pub const POLICY_AUDIT_LOG_ADMIN: ACCESS_MASK = 0x00000200; +pub const POLICY_SERVER_ADMIN: ACCESS_MASK = 0x00000400; +pub const POLICY_LOOKUP_NAMES: ACCESS_MASK = 0x00000800; +pub const POLICY_NOTIFICATION: ACCESS_MASK = 0x00001000; +pub const POLICY_ALL_ACCESS: ACCESS_MASK = STANDARD_RIGHTS_REQUIRED + | POLICY_VIEW_LOCAL_INFORMATION | POLICY_VIEW_AUDIT_INFORMATION + | POLICY_GET_PRIVATE_INFORMATION | POLICY_TRUST_ADMIN | POLICY_CREATE_ACCOUNT + | POLICY_CREATE_SECRET | POLICY_CREATE_PRIVILEGE | POLICY_SET_DEFAULT_QUOTA_LIMITS + | POLICY_SET_AUDIT_REQUIREMENTS | POLICY_AUDIT_LOG_ADMIN | POLICY_SERVER_ADMIN + | POLICY_LOOKUP_NAMES; +pub const POLICY_READ: ACCESS_MASK = STANDARD_RIGHTS_READ | POLICY_VIEW_AUDIT_INFORMATION + | POLICY_GET_PRIVATE_INFORMATION; +pub const POLICY_WRITE: ACCESS_MASK = STANDARD_RIGHTS_WRITE | POLICY_TRUST_ADMIN + | POLICY_CREATE_ACCOUNT | POLICY_CREATE_SECRET | POLICY_CREATE_PRIVILEGE + | POLICY_SET_DEFAULT_QUOTA_LIMITS | POLICY_SET_AUDIT_REQUIREMENTS | POLICY_AUDIT_LOG_ADMIN + | POLICY_SERVER_ADMIN; +pub const POLICY_EXECUTE: ACCESS_MASK = STANDARD_RIGHTS_EXECUTE + | POLICY_VIEW_LOCAL_INFORMATION | POLICY_LOOKUP_NAMES; +STRUCT!{struct LSA_TRANSLATED_SID { + Use: SID_NAME_USE, + RelativeId: ULONG, + DomainIndex: LONG, +}} +pub type PLSA_TRANSLATED_SID = *mut LSA_TRANSLATED_SID; +ENUM!{enum POLICY_LSA_SERVER_ROLE { + PolicyServerRoleBackup = 2, + PolicyServerRolePrimary, +}} +pub type PPOLICY_LSA_SERVER_ROLE = *mut POLICY_LSA_SERVER_ROLE; +pub type POLICY_AUDIT_EVENT_OPTIONS = ULONG; +pub type PPOLICY_AUDIT_EVENT_OPTIONS = *mut ULONG; +ENUM!{enum POLICY_INFORMATION_CLASS { + PolicyAuditLogInformation = 1, + PolicyAuditEventsInformation, + PolicyPrimaryDomainInformation, + PolicyPdAccountInformation, + PolicyAccountDomainInformation, + PolicyLsaServerRoleInformation, + PolicyReplicaSourceInformation, + PolicyDefaultQuotaInformation, + PolicyModificationInformation, + PolicyAuditFullSetInformation, + PolicyAuditFullQueryInformation, + PolicyDnsDomainInformation, + PolicyDnsDomainInformationInt, + PolicyLocalAccountDomainInformation, + PolicyLastEntry, +}} +pub type PPOLICY_INFORMATION_CLASS = *mut POLICY_INFORMATION_CLASS; +STRUCT!{struct POLICY_AUDIT_LOG_INFO { + AuditLogPercentFull: ULONG, + MaximumLogSize: ULONG, + AuditRetentionPeriod: LARGE_INTEGER, + AuditLogFullShutdownInProgress: BOOLEAN, + TimeToShutdown: LARGE_INTEGER, + NextAuditRecordId: ULONG, +}} +pub type PPOLICY_AUDIT_LOG_INFO = *mut POLICY_AUDIT_LOG_INFO; +STRUCT!{struct POLICY_AUDIT_EVENTS_INFO { + AuditingMode: BOOLEAN, + EventAuditingOptions: PPOLICY_AUDIT_EVENT_OPTIONS, + MaximumAuditEventCount: ULONG, +}} +pub type PPOLICY_AUDIT_EVENTS_INFO = *mut POLICY_AUDIT_EVENTS_INFO; +STRUCT!{struct POLICY_AUDIT_SUBCATEGORIES_INFO { + MaximumSubCategoryCount: ULONG, + EventAuditingOptions: PPOLICY_AUDIT_EVENT_OPTIONS, +}} +pub type PPOLICY_AUDIT_SUBCATEGORIES_INFO = *mut POLICY_AUDIT_SUBCATEGORIES_INFO; +STRUCT!{struct POLICY_AUDIT_CATEGORIES_INFO { + MaximumSubCategoryCount: ULONG, + SubCategoriesInfo: PPOLICY_AUDIT_SUBCATEGORIES_INFO, +}} +pub type PPOLICY_AUDIT_CATEGORIES_INFO = *mut POLICY_AUDIT_CATEGORIES_INFO; +pub const PER_USER_POLICY_UNCHANGED: ULONG = 0x00; +pub const PER_USER_AUDIT_SUCCESS_INCLUDE: ULONG = 0x01; +pub const PER_USER_AUDIT_SUCCESS_EXCLUDE: ULONG = 0x02; +pub const PER_USER_AUDIT_FAILURE_INCLUDE: ULONG = 0x04; +pub const PER_USER_AUDIT_FAILURE_EXCLUDE: ULONG = 0x08; +pub const PER_USER_AUDIT_NONE: ULONG = 0x10; +pub const VALID_PER_USER_AUDIT_POLICY_FLAG: ULONG = PER_USER_AUDIT_SUCCESS_INCLUDE + | PER_USER_AUDIT_SUCCESS_EXCLUDE | PER_USER_AUDIT_FAILURE_INCLUDE + | PER_USER_AUDIT_FAILURE_EXCLUDE | PER_USER_AUDIT_NONE; +STRUCT!{struct POLICY_PRIMARY_DOMAIN_INFO { + Name: LSA_UNICODE_STRING, + Sid: PSID, +}} +pub type PPOLICY_PRIMARY_DOMAIN_INFO = *mut POLICY_PRIMARY_DOMAIN_INFO; +STRUCT!{struct POLICY_PD_ACCOUNT_INFO { + Name: LSA_UNICODE_STRING, +}} +pub type PPOLICY_PD_ACCOUNT_INFO = *mut POLICY_PD_ACCOUNT_INFO; +STRUCT!{struct POLICY_LSA_SERVER_ROLE_INFO { + LsaServerRole: POLICY_LSA_SERVER_ROLE, +}} +pub type PPOLICY_LSA_SERVER_ROLE_INFO = *mut POLICY_LSA_SERVER_ROLE_INFO; +STRUCT!{struct POLICY_REPLICA_SOURCE_INFO { + ReplicaSource: LSA_UNICODE_STRING, + ReplicaAccountName: LSA_UNICODE_STRING, +}} +pub type PPOLICY_REPLICA_SOURCE_INFO = *mut POLICY_REPLICA_SOURCE_INFO; +STRUCT!{struct POLICY_DEFAULT_QUOTA_INFO { + QuotaLimits: QUOTA_LIMITS, +}} +pub type PPOLICY_DEFAULT_QUOTA_INFO = *mut POLICY_DEFAULT_QUOTA_INFO; +STRUCT!{struct POLICY_MODIFICATION_INFO { + ModifiedId: LARGE_INTEGER, + DatabaseCreationTime: LARGE_INTEGER, +}} +pub type PPOLICY_MODIFICATION_INFO = *mut POLICY_MODIFICATION_INFO; +STRUCT!{struct POLICY_AUDIT_FULL_SET_INFO { + ShutDownOnFull: BOOLEAN, +}} +pub type PPOLICY_AUDIT_FULL_SET_INFO = *mut POLICY_AUDIT_FULL_SET_INFO; +STRUCT!{struct POLICY_AUDIT_FULL_QUERY_INFO { + ShutDownOnFull: BOOLEAN, + LogIsFull: BOOLEAN, +}} +pub type PPOLICY_AUDIT_FULL_QUERY_INFO = *mut POLICY_AUDIT_FULL_QUERY_INFO; +ENUM!{enum POLICY_DOMAIN_INFORMATION_CLASS { + PolicyDomainEfsInformation = 2, + PolicyDomainKerberosTicketInformation, +}} +pub type PPOLICY_DOMAIN_INFORMATION_CLASS = *mut POLICY_DOMAIN_INFORMATION_CLASS; +STRUCT!{struct POLICY_DOMAIN_EFS_INFO { + InfoLength: ULONG, + EfsBlob: PUCHAR, +}} +pub type PPOLICY_DOMAIN_EFS_INFO = *mut POLICY_DOMAIN_EFS_INFO; +STRUCT!{struct POLICY_DOMAIN_KERBEROS_TICKET_INFO { + AuthenticationOptions: ULONG, + MaxServiceTicketAge: LARGE_INTEGER, + MaxTicketAge: LARGE_INTEGER, + MaxRenewAge: LARGE_INTEGER, + MaxClockSkew: LARGE_INTEGER, + Reserved: LARGE_INTEGER, +}} +pub type PPOLICY_DOMAIN_KERBEROS_TICKET_INFO = *mut POLICY_DOMAIN_KERBEROS_TICKET_INFO; +ENUM!{enum POLICY_NOTIFICATION_INFORMATION_CLASS { + PolicyNotifyAuditEventsInformation = 1, + PolicyNotifyAccountDomainInformation, + PolicyNotifyServerRoleInformation, + PolicyNotifyDnsDomainInformation, + PolicyNotifyDomainEfsInformation, + PolicyNotifyDomainKerberosTicketInformation, + PolicyNotifyMachineAccountPasswordInformation, + PolicyNotifyGlobalSaclInformation, + PolicyNotifyMax, +}} +pub type PPOLICY_NOTIFICATION_INFORMATION_CLASS = *mut POLICY_NOTIFICATION_INFORMATION_CLASS; +pub type LSA_HANDLE = PVOID; +pub type PLSA_HANDLE = *mut PVOID; +ENUM!{enum TRUSTED_INFORMATION_CLASS { + TrustedDomainNameInformation = 1, + TrustedControllersInformation, + TrustedPosixOffsetInformation, + TrustedPasswordInformation, + TrustedDomainInformationBasic, + TrustedDomainInformationEx, + TrustedDomainAuthInformation, + TrustedDomainFullInformation, + TrustedDomainAuthInformationInternal, + TrustedDomainFullInformationInternal, + TrustedDomainInformationEx2Internal, + TrustedDomainFullInformation2Internal, + TrustedDomainSupportedEncryptionTypes, +}} +pub type PTRUSTED_INFORMATION_CLASS = *mut TRUSTED_INFORMATION_CLASS; +STRUCT!{struct TRUSTED_DOMAIN_NAME_INFO { + Name: LSA_UNICODE_STRING, +}} +pub type PTRUSTED_DOMAIN_NAME_INFO = *mut TRUSTED_DOMAIN_NAME_INFO; +STRUCT!{struct TRUSTED_CONTROLLERS_INFO { + Entries: ULONG, + Names: PLSA_UNICODE_STRING, +}} +pub type PTRUSTED_CONTROLLERS_INFO = *mut TRUSTED_CONTROLLERS_INFO; +STRUCT!{struct TRUSTED_POSIX_OFFSET_INFO { + Offset: ULONG, +}} +pub type PTRUSTED_POSIX_OFFSET_INFO = *mut TRUSTED_POSIX_OFFSET_INFO; +STRUCT!{struct TRUSTED_PASSWORD_INFO { + Password: LSA_UNICODE_STRING, + OldPassword: LSA_UNICODE_STRING, +}} +pub type PTRUSTED_PASSWORD_INFO = *mut TRUSTED_PASSWORD_INFO; +pub type TRUSTED_DOMAIN_INFORMATION_BASIC = LSA_TRUST_INFORMATION; +pub type PTRUSTED_DOMAIN_INFORMATION_BASIC = PLSA_TRUST_INFORMATION; +pub const TRUST_DIRECTION_DISABLED: ULONG = 0x00000000; +pub const TRUST_DIRECTION_INBOUND: ULONG = 0x00000001; +pub const TRUST_DIRECTION_OUTBOUND: ULONG = 0x00000002; +pub const TRUST_DIRECTION_BIDIRECTIONAL: ULONG = TRUST_DIRECTION_INBOUND + | TRUST_DIRECTION_OUTBOUND; +pub const TRUST_TYPE_DOWNLEVEL: ULONG = 0x00000001; +pub const TRUST_TYPE_UPLEVEL: ULONG = 0x00000002; +pub const TRUST_TYPE_MIT: ULONG = 0x00000003; +pub const TRUST_ATTRIBUTE_NON_TRANSITIVE: ULONG = 0x00000001; +pub const TRUST_ATTRIBUTE_UPLEVEL_ONLY: ULONG = 0x00000002; +pub const TRUST_ATTRIBUTE_QUARANTINED_DOMAIN: ULONG = 0x00000004; +pub const TRUST_ATTRIBUTE_FOREST_TRANSITIVE: ULONG = 0x00000008; +pub const TRUST_ATTRIBUTE_CROSS_ORGANIZATION: ULONG = 0x00000010; +pub const TRUST_ATTRIBUTE_WITHIN_FOREST: ULONG = 0x00000020; +pub const TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL: ULONG = 0x00000040; +pub const TRUST_ATTRIBUTE_TRUST_USES_RC4_ENCRYPTION: ULONG = 0x00000080; +pub const TRUST_ATTRIBUTE_TRUST_USES_AES_KEYS: ULONG = 0x00000100; +pub const TRUST_ATTRIBUTE_CROSS_ORGANIZATION_NO_TGT_DELEGATION: ULONG = 0x00000200; +pub const TRUST_ATTRIBUTES_VALID: ULONG = 0xFF03FFFF; +pub const TRUST_ATTRIBUTES_USER: ULONG = 0xFF000000; +STRUCT!{struct TRUSTED_DOMAIN_INFORMATION_EX { + Name: LSA_UNICODE_STRING, + FlatName: LSA_UNICODE_STRING, + Sid: PSID, + TrustDirection: ULONG, + TrustType: ULONG, + TrustAttributes: ULONG, +}} +pub type PTRUSTED_DOMAIN_INFORMATION_EX = *mut TRUSTED_DOMAIN_INFORMATION_EX; +STRUCT!{struct TRUSTED_DOMAIN_INFORMATION_EX2 { + Name: LSA_UNICODE_STRING, + FlatName: LSA_UNICODE_STRING, + Sid: PSID, + TrustDirection: ULONG, + TrustType: ULONG, + TrustAttributes: ULONG, + ForestTrustLength: ULONG, + ForestTrustInfo: PUCHAR, +}} +pub type PTRUSTED_DOMAIN_INFORMATION_EX2 = *mut TRUSTED_DOMAIN_INFORMATION_EX2; +pub const TRUST_AUTH_TYPE_NONE: ULONG = 0; +pub const TRUST_AUTH_TYPE_NT4OWF: ULONG = 1; +pub const TRUST_AUTH_TYPE_CLEAR: ULONG = 2; +pub const TRUST_AUTH_TYPE_VERSION: ULONG = 3; +STRUCT!{struct LSA_AUTH_INFORMATION { + LastUpdateTime: LARGE_INTEGER, + AuthType: ULONG, + AuthInfoLength: ULONG, + AuthInfo: PUCHAR, +}} +pub type PLSA_AUTH_INFORMATION = *mut LSA_AUTH_INFORMATION; +STRUCT!{struct TRUSTED_DOMAIN_AUTH_INFORMATION { + IncomingAuthInfos: ULONG, + IncomingAuthenticationInformation: PLSA_AUTH_INFORMATION, + IncomingPreviousAuthenticationInformation: PLSA_AUTH_INFORMATION, + OutgoingAuthInfos: ULONG, + OutgoingAuthenticationInformation: PLSA_AUTH_INFORMATION, + OutgoingPreviousAuthenticationInformation: PLSA_AUTH_INFORMATION, +}} +pub type PTRUSTED_DOMAIN_AUTH_INFORMATION = *mut TRUSTED_DOMAIN_AUTH_INFORMATION; +STRUCT!{struct TRUSTED_DOMAIN_FULL_INFORMATION { + Information: TRUSTED_DOMAIN_INFORMATION_EX, + PosixOffset: TRUSTED_POSIX_OFFSET_INFO, + AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION, +}} +pub type PTRUSTED_DOMAIN_FULL_INFORMATION = *mut TRUSTED_DOMAIN_FULL_INFORMATION; +STRUCT!{struct TRUSTED_DOMAIN_FULL_INFORMATION2 { + Information: TRUSTED_DOMAIN_INFORMATION_EX2, + PosixOffset: TRUSTED_POSIX_OFFSET_INFO, + AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION, +}} +pub type PTRUSTED_DOMAIN_FULL_INFORMATION2 = *mut TRUSTED_DOMAIN_FULL_INFORMATION2; +STRUCT!{struct TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES { + SupportedEncryptionTypes: ULONG, +}} +pub type PTRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES = + *mut TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES; +ENUM!{enum LSA_FOREST_TRUST_RECORD_TYPE { + ForestTrustTopLevelName, + ForestTrustTopLevelNameEx, + ForestTrustDomainInfo, + ForestTrustRecordTypeLast, // = ForestTrustDomainInfo, +}} +pub const LSA_FTRECORD_DISABLED_REASONS: ULONG = 0x0000FFFF; +pub const LSA_TLN_DISABLED_NEW: ULONG = 0x00000001; +pub const LSA_TLN_DISABLED_ADMIN: ULONG = 0x00000002; +pub const LSA_TLN_DISABLED_CONFLICT: ULONG = 0x00000004; +pub const LSA_SID_DISABLED_ADMIN: ULONG = 0x00000001; +pub const LSA_SID_DISABLED_CONFLICT: ULONG = 0x00000002; +pub const LSA_NB_DISABLED_ADMIN: ULONG = 0x00000004; +pub const LSA_NB_DISABLED_CONFLICT: ULONG = 0x00000008; +STRUCT!{struct LSA_FOREST_TRUST_DOMAIN_INFO { + Sid: PSID, + DnsName: LSA_UNICODE_STRING, + NetbiosName: LSA_UNICODE_STRING, +}} +pub type PLSA_FOREST_TRUST_DOMAIN_INFO = *mut LSA_FOREST_TRUST_DOMAIN_INFO; +pub const MAX_FOREST_TRUST_BINARY_DATA_SIZE: ULONG = 128 * 1024; +STRUCT!{struct LSA_FOREST_TRUST_BINARY_DATA { + Length: ULONG, + Buffer: PUCHAR, +}} +pub type PLSA_FOREST_TRUST_BINARY_DATA = *mut LSA_FOREST_TRUST_BINARY_DATA; +UNION!{union LSA_FOREST_TRUST_RECORD_ForestTrustData { + [usize; 5], + TopLevelName TopLevelName_mut: LSA_UNICODE_STRING, + DomainInfo DomainInfo_mut: LSA_FOREST_TRUST_DOMAIN_INFO, + Data Data_mut: LSA_FOREST_TRUST_BINARY_DATA, +}} +STRUCT!{struct LSA_FOREST_TRUST_RECORD { + Flags: ULONG, + ForestTrustType: LSA_FOREST_TRUST_RECORD_TYPE, + Time: LARGE_INTEGER, + ForestTrustData: LSA_FOREST_TRUST_RECORD_ForestTrustData, +}} +pub type PLSA_FOREST_TRUST_RECORD = *mut LSA_FOREST_TRUST_RECORD; +pub const MAX_RECORDS_IN_FOREST_TRUST_INFO: ULONG = 4000; +STRUCT!{struct LSA_FOREST_TRUST_INFORMATION { + RecordCount: ULONG, + Entries: *mut PLSA_FOREST_TRUST_RECORD, +}} +pub type PLSA_FOREST_TRUST_INFORMATION = *mut LSA_FOREST_TRUST_INFORMATION; +ENUM!{enum LSA_FOREST_TRUST_COLLISION_RECORD_TYPE { + CollisionTdo, + CollisionXref, + CollisionOther, +}} +STRUCT!{struct LSA_FOREST_TRUST_COLLISION_RECORD { + Index: ULONG, + Type: LSA_FOREST_TRUST_COLLISION_RECORD_TYPE, + Flags: ULONG, + Name: LSA_UNICODE_STRING, +}} +pub type PLSA_FOREST_TRUST_COLLISION_RECORD = *mut LSA_FOREST_TRUST_COLLISION_RECORD; +STRUCT!{struct LSA_FOREST_TRUST_COLLISION_INFORMATION { + RecordCount: ULONG, + Entries: *mut PLSA_FOREST_TRUST_COLLISION_RECORD, +}} +pub type PLSA_FOREST_TRUST_COLLISION_INFORMATION = *mut LSA_FOREST_TRUST_COLLISION_INFORMATION; +pub type LSA_ENUMERATION_HANDLE = ULONG; +pub type PLSA_ENUMERATION_HANDLE = *mut ULONG; +STRUCT!{struct LSA_ENUMERATION_INFORMATION { + Sid: PSID, +}} +pub type PLSA_ENUMERATION_INFORMATION = *mut LSA_ENUMERATION_INFORMATION; +STRUCT!{struct LSA_LAST_INTER_LOGON_INFO { + LastSuccessfulLogon: LARGE_INTEGER, + LastFailedLogon: LARGE_INTEGER, + FailedAttemptCountSinceLastSuccessfulLogon: ULONG, +}} +pub type PLSA_LAST_INTER_LOGON_INFO = *mut LSA_LAST_INTER_LOGON_INFO; +STRUCT!{struct SECURITY_LOGON_SESSION_DATA { + Size: ULONG, + LogonId: LUID, + UserName: LSA_UNICODE_STRING, + LogonDomain: LSA_UNICODE_STRING, + AuthenticationPackage: LSA_UNICODE_STRING, + LogonType: ULONG, + Session: ULONG, + Sid: PSID, + LogonTime: LARGE_INTEGER, + LogonServer: LSA_UNICODE_STRING, + DnsDomainName: LSA_UNICODE_STRING, + Upn: LSA_UNICODE_STRING, + UserFlags: ULONG, + LastLogonInfo: LSA_LAST_INTER_LOGON_INFO, + LogonScript: LSA_UNICODE_STRING, + ProfilePath: LSA_UNICODE_STRING, + HomeDirectory: LSA_UNICODE_STRING, + HomeDirectoryDrive: LSA_UNICODE_STRING, + LogoffTime: LARGE_INTEGER, + KickOffTime: LARGE_INTEGER, + PasswordLastSet: LARGE_INTEGER, + PasswordCanChange: LARGE_INTEGER, + PasswordMustChange: LARGE_INTEGER, +}} +pub type PSECURITY_LOGON_SESSION_DATA = *mut SECURITY_LOGON_SESSION_DATA; +pub const CENTRAL_ACCESS_POLICY_OWNER_RIGHTS_PRESENT_FLAG: ULONG = 0x00000001; +pub const CENTRAL_ACCESS_POLICY_STAGED_OWNER_RIGHTS_PRESENT_FLAG: ULONG = 0x00000100; +pub const CENTRAL_ACCESS_POLICY_STAGED_FLAG: ULONG = 0x00010000; +pub const CENTRAL_ACCESS_POLICY_VALID_FLAG_MASK: ULONG = + CENTRAL_ACCESS_POLICY_OWNER_RIGHTS_PRESENT_FLAG + | CENTRAL_ACCESS_POLICY_STAGED_OWNER_RIGHTS_PRESENT_FLAG + | CENTRAL_ACCESS_POLICY_STAGED_FLAG; +pub const LSASETCAPS_RELOAD_FLAG: ULONG = 0x00000001; +pub const LSASETCAPS_VALID_FLAG_MASK: ULONG = LSASETCAPS_RELOAD_FLAG; +STRUCT!{struct CENTRAL_ACCESS_POLICY_ENTRY { + Name: LSA_UNICODE_STRING, + Description: LSA_UNICODE_STRING, + ChangeId: LSA_UNICODE_STRING, + LengthAppliesTo: ULONG, + AppliesTo: PUCHAR, + LengthSD: ULONG, + SD: PSECURITY_DESCRIPTOR, + LengthStagedSD: ULONG, + StagedSD: PSECURITY_DESCRIPTOR, + Flags: ULONG, +}} +pub type PCENTRAL_ACCESS_POLICY_ENTRY = *mut CENTRAL_ACCESS_POLICY_ENTRY; +pub type PCCENTRAL_ACCESS_POLICY_ENTRY = *const CENTRAL_ACCESS_POLICY_ENTRY; +STRUCT!{struct CENTRAL_ACCESS_POLICY { + CAPID: PSID, + Name: LSA_UNICODE_STRING, + Description: LSA_UNICODE_STRING, + ChangeId: LSA_UNICODE_STRING, + Flags: ULONG, + CAPECount: ULONG, + CAPEs: *mut PCENTRAL_ACCESS_POLICY_ENTRY, +}} +pub type PCENTRAL_ACCESS_POLICY = *mut CENTRAL_ACCESS_POLICY; +pub type PCCENTRAL_ACCESS_POLICY = *const CENTRAL_ACCESS_POLICY; +ENUM!{enum NEGOTIATE_MESSAGES { + NegEnumPackagePrefixes = 0, + NegGetCallerName = 1, + NegTransferCredentials = 2, + NegCallPackageMax, +}} +pub const NEGOTIATE_MAX_PREFIX: usize = 32; +STRUCT!{struct NEGOTIATE_PACKAGE_PREFIX { + PackageId: ULONG_PTR, + PackageDataA: PVOID, + PackageDataW: PVOID, + PrefixLen: ULONG_PTR, + Prefix: [UCHAR; NEGOTIATE_MAX_PREFIX], +}} +pub type PNEGOTIATE_PACKAGE_PREFIX = *mut NEGOTIATE_PACKAGE_PREFIX; +STRUCT!{struct NEGOTIATE_PACKAGE_PREFIXES { + MessageType: ULONG, + PrefixCount: ULONG, + Offset: ULONG, + Pad: ULONG, +}} +pub type PNEGOTIATE_PACKAGE_PREFIXES = *mut NEGOTIATE_PACKAGE_PREFIXES; +STRUCT!{struct NEGOTIATE_CALLER_NAME_REQUEST { + MessageType: ULONG, + LogonId: LUID, +}} +pub type PNEGOTIATE_CALLER_NAME_REQUEST = *mut NEGOTIATE_CALLER_NAME_REQUEST; +STRUCT!{struct NEGOTIATE_CALLER_NAME_RESPONSE { + MessageType: ULONG, + CallerName: PWSTR, +}} +pub type PNEGOTIATE_CALLER_NAME_RESPONSE = *mut NEGOTIATE_CALLER_NAME_RESPONSE; +STRUCT!{struct DOMAIN_PASSWORD_INFORMATION { + MinPasswordLength: USHORT, + PasswordHistoryLength: USHORT, + PasswordProperties: ULONG, + MaxPasswordAge: LARGE_INTEGER, + MinPasswordAge: LARGE_INTEGER, +}} +pub type PDOMAIN_PASSWORD_INFORMATION = *mut DOMAIN_PASSWORD_INFORMATION; +pub const DOMAIN_PASSWORD_COMPLEX: ULONG = 0x00000001; +pub const DOMAIN_PASSWORD_NO_ANON_CHANGE: ULONG = 0x00000002; +pub const DOMAIN_PASSWORD_NO_CLEAR_CHANGE: ULONG = 0x00000004; +pub const DOMAIN_LOCKOUT_ADMINS: ULONG = 0x00000008; +pub const DOMAIN_PASSWORD_STORE_CLEARTEXT: ULONG = 0x00000010; +pub const DOMAIN_REFUSE_PASSWORD_CHANGE: ULONG = 0x00000020; +pub const DOMAIN_NO_LM_OWF_CHANGE: ULONG = 0x00000040; +FN!{stdcall PSAM_PASSWORD_NOTIFICATION_ROUTINE( + UserName: PUNICODE_STRING, + RelativeId: ULONG, + NewPassword: PUNICODE_STRING, +) -> NTSTATUS} +FN!{stdcall PSAM_INIT_NOTIFICATION_ROUTINE() -> BOOLEAN} +FN!{stdcall PSAM_PASSWORD_FILTER_ROUTINE( + AccountName: PUNICODE_STRING, + FullName: PUNICODE_STRING, + Password: PUNICODE_STRING, + SetOperation: BOOLEAN, +) -> BOOLEAN} +ENUM!{enum MSV1_0_LOGON_SUBMIT_TYPE { + MsV1_0InteractiveLogon = 2, + MsV1_0Lm20Logon, + MsV1_0NetworkLogon, + MsV1_0SubAuthLogon, + MsV1_0WorkstationUnlockLogon = 7, + MsV1_0S4ULogon = 12, + MsV1_0VirtualLogon = 82, + MsV1_0NoElevationLogon = 83, + MsV1_0LuidLogon = 84, +}} +pub type PMSV1_0_LOGON_SUBMIT_TYPE = *mut MSV1_0_LOGON_SUBMIT_TYPE; +ENUM!{enum MSV1_0_PROFILE_BUFFER_TYPE { + MsV1_0InteractiveProfile = 2, + MsV1_0Lm20LogonProfile, + MsV1_0SmartCardProfile, +}} +pub type PMSV1_0_PROFILE_BUFFER_TYPE = *mut MSV1_0_PROFILE_BUFFER_TYPE; +STRUCT!{struct MSV1_0_INTERACTIVE_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + LogonDomainName: UNICODE_STRING, + UserName: UNICODE_STRING, + Password: UNICODE_STRING, +}} +pub type PMSV1_0_INTERACTIVE_LOGON = *mut MSV1_0_INTERACTIVE_LOGON; +STRUCT!{struct MSV1_0_INTERACTIVE_PROFILE { + MessageType: MSV1_0_PROFILE_BUFFER_TYPE, + LogonCount: USHORT, + BadPasswordCount: USHORT, + LogonTime: LARGE_INTEGER, + LogoffTime: LARGE_INTEGER, + KickOffTime: LARGE_INTEGER, + PasswordLastSet: LARGE_INTEGER, + PasswordCanChange: LARGE_INTEGER, + PasswordMustChange: LARGE_INTEGER, + LogonScript: UNICODE_STRING, + HomeDirectory: UNICODE_STRING, + FullName: UNICODE_STRING, + ProfilePath: UNICODE_STRING, + HomeDirectoryDrive: UNICODE_STRING, + LogonServer: UNICODE_STRING, + UserFlags: ULONG, +}} +pub type PMSV1_0_INTERACTIVE_PROFILE = *mut MSV1_0_INTERACTIVE_PROFILE; +pub const MSV1_0_CHALLENGE_LENGTH: usize = 8; +pub const MSV1_0_USER_SESSION_KEY_LENGTH: usize = 16; +pub const MSV1_0_LANMAN_SESSION_KEY_LENGTH: usize = 8; +pub const MSV1_0_CLEARTEXT_PASSWORD_ALLOWED: ULONG = 0x02; +pub const MSV1_0_UPDATE_LOGON_STATISTICS: ULONG = 0x04; +pub const MSV1_0_RETURN_USER_PARAMETERS: ULONG = 0x08; +pub const MSV1_0_DONT_TRY_GUEST_ACCOUNT: ULONG = 0x10; +pub const MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT: ULONG = 0x20; +pub const MSV1_0_RETURN_PASSWORD_EXPIRY: ULONG = 0x40; +pub const MSV1_0_USE_CLIENT_CHALLENGE: ULONG = 0x80; +pub const MSV1_0_TRY_GUEST_ACCOUNT_ONLY: ULONG = 0x100; +pub const MSV1_0_RETURN_PROFILE_PATH: ULONG = 0x200; +pub const MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY: ULONG = 0x400; +pub const MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT: ULONG = 0x800; +pub const MSV1_0_DISABLE_PERSONAL_FALLBACK: ULONG = 0x00001000; +pub const MSV1_0_ALLOW_FORCE_GUEST: ULONG = 0x00002000; +pub const MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED: ULONG = 0x00004000; +pub const MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY: ULONG = 0x00008000; +pub const MSV1_0_SUBAUTHENTICATION_DLL_EX: ULONG = 0x00100000; +pub const MSV1_0_ALLOW_MSVCHAPV2: ULONG = 0x00010000; +pub const MSV1_0_S4U2SELF: ULONG = 0x00020000; +pub const MSV1_0_CHECK_LOGONHOURS_FOR_S4U: ULONG = 0x00040000; +pub const MSV1_0_INTERNET_DOMAIN: ULONG = 0x00080000; +pub const MSV1_0_SUBAUTHENTICATION_DLL: ULONG = 0xFF000000; +pub const MSV1_0_SUBAUTHENTICATION_DLL_SHIFT: ULONG = 24; +pub const MSV1_0_MNS_LOGON: ULONG = 0x01000000; +pub const MSV1_0_SUBAUTHENTICATION_DLL_RAS: ULONG = 2; +pub const MSV1_0_SUBAUTHENTICATION_DLL_IIS: ULONG = 132; +STRUCT!{struct MSV1_0_LM20_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + LogonDomainName: UNICODE_STRING, + UserName: UNICODE_STRING, + Workstation: UNICODE_STRING, + ChallengeToClient: [UCHAR; MSV1_0_CHALLENGE_LENGTH], + CaseSensitiveChallengeResponse: STRING, + CaseInsensitiveChallengeResponse: STRING, + ParameterControl: ULONG, +}} +pub type PMSV1_0_LM20_LOGON = *mut MSV1_0_LM20_LOGON; +STRUCT!{struct MSV1_0_SUBAUTH_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + LogonDomainName: UNICODE_STRING, + UserName: UNICODE_STRING, + Workstation: UNICODE_STRING, + ChallengeToClient: [UCHAR; MSV1_0_CHALLENGE_LENGTH], + AuthenticationInfo1: STRING, + AuthenticationInfo2: STRING, + ParameterControl: ULONG, + SubAuthPackageId: ULONG, +}} +pub type PMSV1_0_SUBAUTH_LOGON = *mut MSV1_0_SUBAUTH_LOGON; +STRUCT!{struct MSV1_0_S4U_LOGON { + MessageType: MSV1_0_LOGON_SUBMIT_TYPE, + MSV1_0_LOGON_SUBMIT_TYPE: ULONG, + UserPrincipalName: UNICODE_STRING, + DomainName: UNICODE_STRING, +}} +pub type PMSV1_0_S4U_LOGON = *mut MSV1_0_S4U_LOGON; +pub const LOGON_GUEST: ULONG = 0x01; +pub const LOGON_NOENCRYPTION: ULONG = 0x02; +pub const LOGON_CACHED_ACCOUNT: ULONG = 0x04; +pub const LOGON_USED_LM_PASSWORD: ULONG = 0x08; +pub const LOGON_EXTRA_SIDS: ULONG = 0x20; +pub const LOGON_SUBAUTH_SESSION_KEY: ULONG = 0x40; +pub const LOGON_SERVER_TRUST_ACCOUNT: ULONG = 0x80; +pub const LOGON_NTLMV2_ENABLED: ULONG = 0x100; +pub const LOGON_RESOURCE_GROUPS: ULONG = 0x200; +pub const LOGON_PROFILE_PATH_RETURNED: ULONG = 0x400; +pub const LOGON_NT_V2: ULONG = 0x800; +pub const LOGON_LM_V2: ULONG = 0x1000; +pub const LOGON_NTLM_V2: ULONG = 0x2000; +pub const LOGON_OPTIMIZED: ULONG = 0x4000; +pub const LOGON_WINLOGON: ULONG = 0x8000; +pub const LOGON_PKINIT: ULONG = 0x10000; +pub const LOGON_NO_OPTIMIZED: ULONG = 0x20000; +pub const LOGON_NO_ELEVATION: ULONG = 0x40000; +pub const LOGON_MANAGED_SERVICE: ULONG = 0x80000; +pub const LOGON_GRACE_LOGON: ULONG = 0x01000000; +STRUCT!{struct MSV1_0_LM20_LOGON_PROFILE { + MessageType: MSV1_0_PROFILE_BUFFER_TYPE, + KickOffTime: LARGE_INTEGER, + LogoffTime: LARGE_INTEGER, + UserFlags: ULONG, + UserSessionKey: [UCHAR; MSV1_0_USER_SESSION_KEY_LENGTH], + LogonDomainName: UNICODE_STRING, + LanmanSessionKey: [UCHAR; MSV1_0_LANMAN_SESSION_KEY_LENGTH], + LogonServer: UNICODE_STRING, + UserParameters: UNICODE_STRING, +}} +pub type PMSV1_0_LM20_LOGON_PROFILE = *mut MSV1_0_LM20_LOGON_PROFILE; +pub const MSV1_0_OWF_PASSWORD_LENGTH: usize = 16; +STRUCT!{struct MSV1_0_SUPPLEMENTAL_CREDENTIAL { + Version: ULONG, + Flags: ULONG, + LmPassword: [UCHAR; MSV1_0_OWF_PASSWORD_LENGTH], + NtPassword: [UCHAR; MSV1_0_OWF_PASSWORD_LENGTH], +}} +pub type PMSV1_0_SUPPLEMENTAL_CREDENTIAL = *mut MSV1_0_SUPPLEMENTAL_CREDENTIAL; +pub const MSV1_0_NTLM3_RESPONSE_LENGTH: usize = 16; +pub const MSV1_0_NTLM3_OWF_LENGTH: usize = 16; +STRUCT!{struct MSV1_0_NTLM3_RESPONSE { + Response: [UCHAR; MSV1_0_NTLM3_RESPONSE_LENGTH], + RespType: UCHAR, + HiRespType: UCHAR, + Flags: USHORT, + MsgWord: ULONG, + TimeStamp: ULONGLONG, + ChallengeFromClient: [UCHAR; MSV1_0_CHALLENGE_LENGTH], + AvPairsOff: ULONG, + Buffer: [UCHAR; 1], +}} +pub type PMSV1_0_NTLM3_RESPONSE = *mut MSV1_0_NTLM3_RESPONSE; +ENUM!{enum MSV1_0_AVID { + MsvAvEOL, + MsvAvNbComputerName, + MsvAvNbDomainName, + MsvAvDnsComputerName, + MsvAvDnsDomainName, + MsvAvDnsTreeName, + MsvAvFlags, + MsvAvTimestamp, + MsvAvRestrictions, + MsvAvTargetName, + MsvAvChannelBindings, +}} +STRUCT!{struct MSV1_0_AV_PAIR { + AvId: USHORT, + AvLen: USHORT, +}} +pub type PMSV1_0_AV_PAIR = *mut MSV1_0_AV_PAIR; +ENUM!{enum MSV1_0_PROTOCOL_MESSAGE_TYPE { + MsV1_0Lm20ChallengeRequest = 0, + MsV1_0Lm20GetChallengeResponse, + MsV1_0EnumerateUsers, + MsV1_0GetUserInfo, + MsV1_0ReLogonUsers, + MsV1_0ChangePassword, + MsV1_0ChangeCachedPassword, + MsV1_0GenericPassthrough, + MsV1_0CacheLogon, + MsV1_0SubAuth, + MsV1_0DeriveCredential, + MsV1_0CacheLookup, + MsV1_0SetProcessOption, + MsV1_0ConfigLocalAliases, + MsV1_0ClearCachedCredentials, + MsV1_0LookupToken, + MsV1_0ValidateAuth, + MsV1_0CacheLookupEx, + MsV1_0GetCredentialKey, + MsV1_0SetThreadOption, +}} +pub type PMSV1_0_PROTOCOL_MESSAGE_TYPE = *mut MSV1_0_PROTOCOL_MESSAGE_TYPE; +STRUCT!{struct MSV1_0_CHANGEPASSWORD_REQUEST { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + DomainName: UNICODE_STRING, + AccountName: UNICODE_STRING, + OldPassword: UNICODE_STRING, + NewPassword: UNICODE_STRING, + Impersonating: BOOLEAN, +}} +pub type PMSV1_0_CHANGEPASSWORD_REQUEST = *mut MSV1_0_CHANGEPASSWORD_REQUEST; +STRUCT!{struct MSV1_0_CHANGEPASSWORD_RESPONSE { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + PasswordInfoValid: BOOLEAN, + DomainPasswordInfo: DOMAIN_PASSWORD_INFORMATION, +}} +pub type PMSV1_0_CHANGEPASSWORD_RESPONSE = *mut MSV1_0_CHANGEPASSWORD_RESPONSE; +STRUCT!{struct MSV1_0_PASSTHROUGH_REQUEST { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + DomainName: UNICODE_STRING, + PackageName: UNICODE_STRING, + DataLength: ULONG, + LogonData: PUCHAR, + Pad: ULONG, +}} +pub type PMSV1_0_PASSTHROUGH_REQUEST = *mut MSV1_0_PASSTHROUGH_REQUEST; +STRUCT!{struct MSV1_0_PASSTHROUGH_RESPONSE { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + Pad: ULONG, + DataLength: ULONG, + ValidationData: PUCHAR, +}} +pub type PMSV1_0_PASSTHROUGH_RESPONSE = *mut MSV1_0_PASSTHROUGH_RESPONSE; +STRUCT!{struct MSV1_0_SUBAUTH_REQUEST { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + SubAuthPackageId: ULONG, + SubAuthInfoLength: ULONG, + SubAuthSubmitBuffer: PUCHAR, +}} +pub type PMSV1_0_SUBAUTH_REQUEST = *mut MSV1_0_SUBAUTH_REQUEST; +STRUCT!{struct MSV1_0_SUBAUTH_RESPONSE { + MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, + SubAuthInfoLength: ULONG, + SubAuthReturnBuffer: PUCHAR, +}} +pub type PMSV1_0_SUBAUTH_RESPONSE = *mut MSV1_0_SUBAUTH_RESPONSE; +pub use self::SystemFunction036 as RtlGenRandom; +pub use self::SystemFunction040 as RtlEncryptMemory; +pub use self::SystemFunction041 as RtlDecryptMemory; +extern "system" { + pub fn SystemFunction036( + RandomBuffer: PVOID, + RandomBufferLength: ULONG, + ) -> BOOLEAN; +} +pub const RTL_ENCRYPT_MEMORY_SIZE: ULONG = 8; +pub const RTL_ENCRYPT_OPTION_CROSS_PROCESS: ULONG = 0x01; +pub const RTL_ENCRYPT_OPTION_SAME_LOGON: ULONG = 0x02; +extern "system" { + pub fn SystemFunction040( + Memory: PVOID, + MemorySize: ULONG, + OptionFlags: ULONG, + ) -> NTSTATUS; + pub fn SystemFunction041( + Memory: PVOID, + MemorySize: ULONG, + OptionFlags: ULONG, + ) -> NTSTATUS; +} +pub const KERBEROS_VERSION: ULONG = 5; +pub const KERBEROS_REVISION: ULONG = 6; +pub const KERB_ETYPE_NULL: LONG = 0; +pub const KERB_ETYPE_DES_CBC_CRC: LONG = 1; +pub const KERB_ETYPE_DES_CBC_MD4: LONG = 2; +pub const KERB_ETYPE_DES_CBC_MD5: LONG = 3; +pub const KERB_ETYPE_AES128_CTS_HMAC_SHA1_96: LONG = 17; +pub const KERB_ETYPE_AES256_CTS_HMAC_SHA1_96: LONG = 18; +pub const KERB_ETYPE_RC4_MD4: LONG = -128; +pub const KERB_ETYPE_RC4_PLAIN2: LONG = -129; +pub const KERB_ETYPE_RC4_LM: LONG = -130; +pub const KERB_ETYPE_RC4_SHA: LONG = -131; +pub const KERB_ETYPE_DES_PLAIN: LONG = -132; +pub const KERB_ETYPE_RC4_HMAC_OLD: LONG = -133; +pub const KERB_ETYPE_RC4_PLAIN_OLD: LONG = -134; +pub const KERB_ETYPE_RC4_HMAC_OLD_EXP: LONG = -135; +pub const KERB_ETYPE_RC4_PLAIN_OLD_EXP: LONG = -136; +pub const KERB_ETYPE_RC4_PLAIN: LONG = -140; +pub const KERB_ETYPE_RC4_PLAIN_EXP: LONG = -141; +pub const KERB_ETYPE_AES128_CTS_HMAC_SHA1_96_PLAIN: LONG = -148; +pub const KERB_ETYPE_AES256_CTS_HMAC_SHA1_96_PLAIN: LONG = -149; +pub const KERB_ETYPE_DSA_SHA1_CMS: LONG = 9; +pub const KERB_ETYPE_RSA_MD5_CMS: LONG = 10; +pub const KERB_ETYPE_RSA_SHA1_CMS: LONG = 11; +pub const KERB_ETYPE_RC2_CBC_ENV: LONG = 12; +pub const KERB_ETYPE_RSA_ENV: LONG = 13; +pub const KERB_ETYPE_RSA_ES_OEAP_ENV: LONG = 14; +pub const KERB_ETYPE_DES_EDE3_CBC_ENV: LONG = 15; +pub const KERB_ETYPE_DSA_SIGN: LONG = 8; +pub const KERB_ETYPE_RSA_PRIV: LONG = 9; +pub const KERB_ETYPE_RSA_PUB: LONG = 10; +pub const KERB_ETYPE_RSA_PUB_MD5: LONG = 11; +pub const KERB_ETYPE_RSA_PUB_SHA1: LONG = 12; +pub const KERB_ETYPE_PKCS7_PUB: LONG = 13; +pub const KERB_ETYPE_DES3_CBC_MD5: LONG = 5; +pub const KERB_ETYPE_DES3_CBC_SHA1: LONG = 7; +pub const KERB_ETYPE_DES3_CBC_SHA1_KD: LONG = 16; +pub const KERB_ETYPE_DES_CBC_MD5_NT: LONG = 20; +pub const KERB_ETYPE_RC4_HMAC_NT: LONG = 23; +pub const KERB_ETYPE_RC4_HMAC_NT_EXP: LONG = 24; +pub const KERB_CHECKSUM_NONE: LONG = 0; +pub const KERB_CHECKSUM_CRC32: LONG = 1; +pub const KERB_CHECKSUM_MD4: LONG = 2; +pub const KERB_CHECKSUM_KRB_DES_MAC: LONG = 4; +pub const KERB_CHECKSUM_KRB_DES_MAC_K: LONG = 5; +pub const KERB_CHECKSUM_MD5: LONG = 7; +pub const KERB_CHECKSUM_MD5_DES: LONG = 8; +pub const KERB_CHECKSUM_SHA1_NEW: LONG = 14; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES128: LONG = 15; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES256: LONG = 16; +pub const KERB_CHECKSUM_LM: LONG = -130; +pub const KERB_CHECKSUM_SHA1: LONG = -131; +pub const KERB_CHECKSUM_REAL_CRC32: LONG = -132; +pub const KERB_CHECKSUM_DES_MAC: LONG = -133; +pub const KERB_CHECKSUM_DES_MAC_MD5: LONG = -134; +pub const KERB_CHECKSUM_MD25: LONG = -135; +pub const KERB_CHECKSUM_RC4_MD5: LONG = -136; +pub const KERB_CHECKSUM_MD5_HMAC: LONG = -137; +pub const KERB_CHECKSUM_HMAC_MD5: LONG = -138; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES128_Ki: LONG = -150; +pub const KERB_CHECKSUM_HMAC_SHA1_96_AES256_Ki: LONG = -151; +pub const KERB_TICKET_FLAGS_reserved: ULONG = 0x80000000; +pub const KERB_TICKET_FLAGS_forwardable: ULONG = 0x40000000; +pub const KERB_TICKET_FLAGS_forwarded: ULONG = 0x20000000; +pub const KERB_TICKET_FLAGS_proxiable: ULONG = 0x10000000; +pub const KERB_TICKET_FLAGS_proxy: ULONG = 0x08000000; +pub const KERB_TICKET_FLAGS_may_postdate: ULONG = 0x04000000; +pub const KERB_TICKET_FLAGS_postdated: ULONG = 0x02000000; +pub const KERB_TICKET_FLAGS_invalid: ULONG = 0x01000000; +pub const KERB_TICKET_FLAGS_renewable: ULONG = 0x00800000; +pub const KERB_TICKET_FLAGS_initial: ULONG = 0x00400000; +pub const KERB_TICKET_FLAGS_pre_authent: ULONG = 0x00200000; +pub const KERB_TICKET_FLAGS_hw_authent: ULONG = 0x00100000; +pub const KERB_TICKET_FLAGS_ok_as_delegate: ULONG = 0x00040000; +pub const KERB_TICKET_FLAGS_name_canonicalize: ULONG = 0x00010000; +pub const KERB_TICKET_FLAGS_cname_in_pa_data: ULONG = 0x00040000; +pub const KERB_TICKET_FLAGS_enc_pa_rep: ULONG = 0x00010000; +pub const KERB_TICKET_FLAGS_reserved1: ULONG = 0x00000001; +pub const KRB_NT_UNKNOWN: LONG = 0; +pub const KRB_NT_PRINCIPAL: LONG = 1; +pub const KRB_NT_PRINCIPAL_AND_ID: LONG = -131; +pub const KRB_NT_SRV_INST: LONG = 2; +pub const KRB_NT_SRV_INST_AND_ID: LONG = -132; +pub const KRB_NT_SRV_HST: LONG = 3; +pub const KRB_NT_SRV_XHST: LONG = 4; +pub const KRB_NT_UID: LONG = 5; +pub const KRB_NT_ENTERPRISE_PRINCIPAL: LONG = 10; +pub const KRB_NT_WELLKNOWN: LONG = 11; +pub const KRB_NT_ENT_PRINCIPAL_AND_ID: LONG = -130; +pub const KRB_NT_MS_PRINCIPAL: LONG = -128; +pub const KRB_NT_MS_PRINCIPAL_AND_ID: LONG = -129; +pub const KRB_NT_MS_BRANCH_ID: LONG = -133; +pub const KRB_NT_X500_PRINCIPAL: LONG = 6; +pub const KERB_WRAP_NO_ENCRYPT: ULONG = 0x80000001; +ENUM!{enum KERB_LOGON_SUBMIT_TYPE { + KerbInteractiveLogon = 2, + KerbSmartCardLogon = 6, + KerbWorkstationUnlockLogon = 7, + KerbSmartCardUnlockLogon = 8, + KerbProxyLogon = 9, + KerbTicketLogon = 10, + KerbTicketUnlockLogon = 11, + KerbS4ULogon = 12, + KerbCertificateLogon = 13, + KerbCertificateS4ULogon = 14, + KerbCertificateUnlockLogon = 15, + KerbNoElevationLogon = 83, + KerbLuidLogon = 84, +}} +pub type PKERB_LOGON_SUBMIT_TYPE = *mut KERB_LOGON_SUBMIT_TYPE; +STRUCT!{struct KERB_INTERACTIVE_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + LogonDomainName: UNICODE_STRING, + UserName: UNICODE_STRING, + Password: UNICODE_STRING, +}} +pub type PKERB_INTERACTIVE_LOGON = *mut KERB_INTERACTIVE_LOGON; +STRUCT!{struct KERB_INTERACTIVE_UNLOCK_LOGON { + Logon: KERB_INTERACTIVE_LOGON, + LogonId: LUID, +}} +pub type PKERB_INTERACTIVE_UNLOCK_LOGON = *mut KERB_INTERACTIVE_UNLOCK_LOGON; +STRUCT!{struct KERB_SMART_CARD_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Pin: UNICODE_STRING, + CspDataLength: ULONG, + CspData: PUCHAR, +}} +pub type PKERB_SMART_CARD_LOGON = *mut KERB_SMART_CARD_LOGON; +STRUCT!{struct KERB_SMART_CARD_UNLOCK_LOGON { + Logon: KERB_SMART_CARD_LOGON, + LogonId: LUID, +}} +pub type PKERB_SMART_CARD_UNLOCK_LOGON = *mut KERB_SMART_CARD_UNLOCK_LOGON; +pub const KERB_CERTIFICATE_LOGON_FLAG_CHECK_DUPLICATES: ULONG = 0x1; +pub const KERB_CERTIFICATE_LOGON_FLAG_USE_CERTIFICATE_INFO: ULONG = 0x2; +STRUCT!{struct KERB_CERTIFICATE_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + DomainName: UNICODE_STRING, + UserName: UNICODE_STRING, + Pin: UNICODE_STRING, + Flags: ULONG, + CspDataLength: ULONG, + CspData: PUCHAR, +}} +pub type PKERB_CERTIFICATE_LOGON = *mut KERB_CERTIFICATE_LOGON; +STRUCT!{struct KERB_CERTIFICATE_UNLOCK_LOGON { + Logon: KERB_CERTIFICATE_LOGON, + LogonId: LUID, +}} +pub type PKERB_CERTIFICATE_UNLOCK_LOGON = *mut KERB_CERTIFICATE_UNLOCK_LOGON; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_CHECK_DUPLICATES: ULONG = 0x1; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_CHECK_LOGONHOURS: ULONG = 0x2; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_FAIL_IF_NT_AUTH_POLICY_REQUIRED: ULONG = 0x4; +pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_IDENTIFY: ULONG = 0x8; +STRUCT!{struct KERB_CERTIFICATE_S4U_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Flags: ULONG, + UserPrincipalName: UNICODE_STRING, + DomainName: UNICODE_STRING, + CertificateLength: ULONG, + Certificate: PUCHAR, +}} +pub type PKERB_CERTIFICATE_S4U_LOGON = *mut KERB_CERTIFICATE_S4U_LOGON; +STRUCT!{struct KERB_TICKET_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Flags: ULONG, + ServiceTicketLength: ULONG, + TicketGrantingTicketLength: ULONG, + ServiceTicket: PUCHAR, + TicketGrantingTicket: PUCHAR, +}} +pub type PKERB_TICKET_LOGON = *mut KERB_TICKET_LOGON; +STRUCT!{struct KERB_TICKET_UNLOCK_LOGON { + Logon: KERB_TICKET_LOGON, + LogonId: LUID, +}} +pub type PKERB_TICKET_UNLOCK_LOGON = *mut KERB_TICKET_UNLOCK_LOGON; +pub const KERB_S4U_LOGON_FLAG_CHECK_LOGONHOURS: ULONG = 0x2; +pub const KERB_S4U_LOGON_FLAG_IDENTIFY: ULONG = 0x8; +STRUCT!{struct KERB_S4U_LOGON { + MessageType: KERB_LOGON_SUBMIT_TYPE, + Flags: ULONG, + ClientUpn: UNICODE_STRING, + ClientRealm: UNICODE_STRING, +}} +pub type PKERB_S4U_LOGON = *mut KERB_S4U_LOGON; +ENUM!{enum KERB_PROFILE_BUFFER_TYPE { + KerbInteractiveProfile = 2, + KerbSmartCardProfile = 4, + KerbTicketProfile = 6, +}} +pub type PKERB_PROFILE_BUFFER_TYPE = *mut KERB_PROFILE_BUFFER_TYPE; +STRUCT!{struct KERB_INTERACTIVE_PROFILE { + MessageType: KERB_PROFILE_BUFFER_TYPE, + LogonCount: USHORT, + BadPasswordCount: USHORT, + LogonTime: LARGE_INTEGER, + LogoffTime: LARGE_INTEGER, + KickOffTime: LARGE_INTEGER, + PasswordLastSet: LARGE_INTEGER, + PasswordCanChange: LARGE_INTEGER, + PasswordMustChange: LARGE_INTEGER, + LogonScript: UNICODE_STRING, + HomeDirectory: UNICODE_STRING, + FullName: UNICODE_STRING, + ProfilePath: UNICODE_STRING, + HomeDirectoryDrive: UNICODE_STRING, + LogonServer: UNICODE_STRING, + UserFlags: ULONG, +}} +pub type PKERB_INTERACTIVE_PROFILE = *mut KERB_INTERACTIVE_PROFILE; +STRUCT!{struct KERB_SMART_CARD_PROFILE { + Profile: KERB_INTERACTIVE_PROFILE, + CertificateSize: ULONG, + CertificateData: PUCHAR, +}} +pub type PKERB_SMART_CARD_PROFILE = *mut KERB_SMART_CARD_PROFILE; +STRUCT!{struct KERB_CRYPTO_KEY { + KeyType: LONG, + Length: ULONG, + Value: PUCHAR, +}} +pub type PKERB_CRYPTO_KEY = *mut KERB_CRYPTO_KEY; +STRUCT!{struct KERB_CRYPTO_KEY32 { + KeyType: LONG, + Length: ULONG, + Offset: ULONG, +}} +pub type PKERB_CRYPTO_KEY32 = *mut KERB_CRYPTO_KEY32; +STRUCT!{struct KERB_TICKET_PROFILE { + Profile: KERB_INTERACTIVE_PROFILE, + SessionKey: KERB_CRYPTO_KEY, +}} +pub type PKERB_TICKET_PROFILE = *mut KERB_TICKET_PROFILE; +ENUM!{enum KERB_PROTOCOL_MESSAGE_TYPE { + KerbDebugRequestMessage = 0, + KerbQueryTicketCacheMessage, + KerbChangeMachinePasswordMessage, + KerbVerifyPacMessage, + KerbRetrieveTicketMessage, + KerbUpdateAddressesMessage, + KerbPurgeTicketCacheMessage, + KerbChangePasswordMessage, + KerbRetrieveEncodedTicketMessage, + KerbDecryptDataMessage, + KerbAddBindingCacheEntryMessage, + KerbSetPasswordMessage, + KerbSetPasswordExMessage, + KerbVerifyCredentialsMessage, + KerbQueryTicketCacheExMessage, + KerbPurgeTicketCacheExMessage, + KerbRefreshSmartcardCredentialsMessage, + KerbAddExtraCredentialsMessage, + KerbQuerySupplementalCredentialsMessage, + KerbTransferCredentialsMessage, + KerbQueryTicketCacheEx2Message, + KerbSubmitTicketMessage, + KerbAddExtraCredentialsExMessage, + KerbQueryKdcProxyCacheMessage, + KerbPurgeKdcProxyCacheMessage, + KerbQueryTicketCacheEx3Message, + KerbCleanupMachinePkinitCredsMessage, + KerbAddBindingCacheEntryExMessage, + KerbQueryBindingCacheMessage, + KerbPurgeBindingCacheMessage, + KerbPinKdcMessage, + KerbUnpinAllKdcsMessage, + KerbQueryDomainExtendedPoliciesMessage, + KerbQueryS4U2ProxyCacheMessage, +}} +pub type PKERB_PROTOCOL_MESSAGE_TYPE = *mut KERB_PROTOCOL_MESSAGE_TYPE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, +}} +pub type PKERB_QUERY_TKT_CACHE_REQUEST = *mut KERB_QUERY_TKT_CACHE_REQUEST; +STRUCT!{struct KERB_TICKET_CACHE_INFO { + ServerName: UNICODE_STRING, + RealmName: UNICODE_STRING, + StartTime: LARGE_INTEGER, + EndTime: LARGE_INTEGER, + RenewTime: LARGE_INTEGER, + EncryptionType: LONG, + TicketFlags: ULONG, +}} +pub type PKERB_TICKET_CACHE_INFO = *mut KERB_TICKET_CACHE_INFO; +STRUCT!{struct KERB_TICKET_CACHE_INFO_EX { + ClientName: UNICODE_STRING, + ClientRealm: UNICODE_STRING, + ServerName: UNICODE_STRING, + ServerRealm: UNICODE_STRING, + StartTime: LARGE_INTEGER, + EndTime: LARGE_INTEGER, + RenewTime: LARGE_INTEGER, + EncryptionType: LONG, + TicketFlags: ULONG, +}} +pub type PKERB_TICKET_CACHE_INFO_EX = *mut KERB_TICKET_CACHE_INFO_EX; +STRUCT!{struct KERB_TICKET_CACHE_INFO_EX2 { + ClientName: UNICODE_STRING, + ClientRealm: UNICODE_STRING, + ServerName: UNICODE_STRING, + ServerRealm: UNICODE_STRING, + StartTime: LARGE_INTEGER, + EndTime: LARGE_INTEGER, + RenewTime: LARGE_INTEGER, + EncryptionType: LONG, + TicketFlags: ULONG, + SessionKeyType: ULONG, + BranchId: ULONG, +}} +pub type PKERB_TICKET_CACHE_INFO_EX2 = *mut KERB_TICKET_CACHE_INFO_EX2; +STRUCT!{struct KERB_TICKET_CACHE_INFO_EX3 { + ClientName: UNICODE_STRING, + ClientRealm: UNICODE_STRING, + ServerName: UNICODE_STRING, + ServerRealm: UNICODE_STRING, + StartTime: LARGE_INTEGER, + EndTime: LARGE_INTEGER, + RenewTime: LARGE_INTEGER, + EncryptionType: LONG, + TicketFlags: ULONG, + SessionKeyType: ULONG, + BranchId: ULONG, + CacheFlags: ULONG, + KdcCalled: UNICODE_STRING, +}} +pub type PKERB_TICKET_CACHE_INFO_EX3 = *mut KERB_TICKET_CACHE_INFO_EX3; +STRUCT!{struct KERB_QUERY_TKT_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ULONG, + Tickets: [KERB_TICKET_CACHE_INFO; ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_RESPONSE = *mut KERB_QUERY_TKT_CACHE_RESPONSE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_EX_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ULONG, + Tickets: [KERB_TICKET_CACHE_INFO_EX; ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_EX_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX_RESPONSE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_EX2_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ULONG, + Tickets: [KERB_TICKET_CACHE_INFO_EX2; ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_EX2_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX2_RESPONSE; +STRUCT!{struct KERB_QUERY_TKT_CACHE_EX3_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfTickets: ULONG, + Tickets: [KERB_TICKET_CACHE_INFO_EX3; ANYSIZE_ARRAY], +}} +pub type PKERB_QUERY_TKT_CACHE_EX3_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX3_RESPONSE; +pub const KERB_USE_DEFAULT_TICKET_FLAGS: ULONG = 0x0; +pub const KERB_RETRIEVE_TICKET_DEFAULT: ULONG = 0x0; +pub const KERB_RETRIEVE_TICKET_DONT_USE_CACHE: ULONG = 0x1; +pub const KERB_RETRIEVE_TICKET_USE_CACHE_ONLY: ULONG = 0x2; +pub const KERB_RETRIEVE_TICKET_USE_CREDHANDLE: ULONG = 0x4; +pub const KERB_RETRIEVE_TICKET_AS_KERB_CRED: ULONG = 0x8; +pub const KERB_RETRIEVE_TICKET_WITH_SEC_CRED: ULONG = 0x10; +pub const KERB_RETRIEVE_TICKET_CACHE_TICKET: ULONG = 0x20; +pub const KERB_RETRIEVE_TICKET_MAX_LIFETIME: ULONG = 0x40; +STRUCT!{struct KERB_AUTH_DATA { + Type: ULONG, + Length: ULONG, + Data: PUCHAR, +}} +pub type PKERB_AUTH_DATA = *mut KERB_AUTH_DATA; +STRUCT!{struct KERB_NET_ADDRESS { + Family: ULONG, + Length: ULONG, + Address: PUCHAR, +}} +pub type PKERB_NET_ADDRESS = *mut KERB_NET_ADDRESS; +STRUCT!{struct KERB_NET_ADDRESSES { + Number: ULONG, + Addresses: [KERB_NET_ADDRESS; ANYSIZE_ARRAY], +}} +pub type PKERB_NET_ADDRESSES = *mut KERB_NET_ADDRESSES; +STRUCT!{struct KERB_EXTERNAL_NAME { + NameType: SHORT, + NameCount: USHORT, + Names: [UNICODE_STRING; ANYSIZE_ARRAY], +}} +pub type PKERB_EXTERNAL_NAME = *mut KERB_EXTERNAL_NAME; +STRUCT!{struct KERB_EXTERNAL_TICKET { + ServiceName: PKERB_EXTERNAL_NAME, + TargetName: PKERB_EXTERNAL_NAME, + ClientName: PKERB_EXTERNAL_NAME, + DomainName: UNICODE_STRING, + TargetDomainName: UNICODE_STRING, + AltTargetDomainName: UNICODE_STRING, + SessionKey: KERB_CRYPTO_KEY, + TicketFlags: ULONG, + Flags: ULONG, + KeyExpirationTime: LARGE_INTEGER, + StartTime: LARGE_INTEGER, + EndTime: LARGE_INTEGER, + RenewUntil: LARGE_INTEGER, + TimeSkew: LARGE_INTEGER, + EncodedTicketSize: ULONG, + EncodedTicket: PUCHAR, +}} +pub type PKERB_EXTERNAL_TICKET = *mut KERB_EXTERNAL_TICKET; +STRUCT!{struct KERB_RETRIEVE_TKT_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, + TargetName: UNICODE_STRING, + TicketFlags: ULONG, + CacheOptions: ULONG, + EncryptionType: LONG, + CredentialsHandle: SecHandle, +}} +pub type PKERB_RETRIEVE_TKT_REQUEST = *mut KERB_RETRIEVE_TKT_REQUEST; +STRUCT!{struct KERB_RETRIEVE_TKT_RESPONSE { + Ticket: KERB_EXTERNAL_TICKET, +}} +pub type PKERB_RETRIEVE_TKT_RESPONSE = *mut KERB_RETRIEVE_TKT_RESPONSE; +STRUCT!{struct KERB_PURGE_TKT_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, + ServerName: UNICODE_STRING, + RealmName: UNICODE_STRING, +}} +pub type PKERB_PURGE_TKT_CACHE_REQUEST = *mut KERB_PURGE_TKT_CACHE_REQUEST; +pub const KERB_PURGE_ALL_TICKETS: ULONG = 1; +STRUCT!{struct KERB_PURGE_TKT_CACHE_EX_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, + Flags: ULONG, + TicketTemplate: KERB_TICKET_CACHE_INFO_EX, +}} +pub type PKERB_PURGE_TKT_CACHE_EX_REQUEST = *mut KERB_PURGE_TKT_CACHE_EX_REQUEST; +STRUCT!{struct KERB_SUBMIT_TKT_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, + Flags: ULONG, + Key: KERB_CRYPTO_KEY32, + KerbCredSize: ULONG, + KerbCredOffset: ULONG, +}} +pub type PKERB_SUBMIT_TKT_REQUEST = *mut KERB_SUBMIT_TKT_REQUEST; +STRUCT!{struct KERB_QUERY_KDC_PROXY_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ULONG, + LogonId: LUID, +}} +pub type PKERB_QUERY_KDC_PROXY_CACHE_REQUEST = *mut KERB_QUERY_KDC_PROXY_CACHE_REQUEST; +STRUCT!{struct KDC_PROXY_CACHE_ENTRY_DATA { + SinceLastUsed: ULONG64, + DomainName: UNICODE_STRING, + ProxyServerName: UNICODE_STRING, + ProxyServerVdir: UNICODE_STRING, + ProxyServerPort: USHORT, + LogonId: LUID, + CredUserName: UNICODE_STRING, + CredDomainName: UNICODE_STRING, + GlobalCache: BOOLEAN, +}} +pub type PKDC_PROXY_CACHE_ENTRY_DATA = *mut KDC_PROXY_CACHE_ENTRY_DATA; +STRUCT!{struct KERB_QUERY_KDC_PROXY_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfEntries: ULONG, + Entries: PKDC_PROXY_CACHE_ENTRY_DATA, +}} +pub type PKERB_QUERY_KDC_PROXY_CACHE_RESPONSE = *mut KERB_QUERY_KDC_PROXY_CACHE_RESPONSE; +STRUCT!{struct KERB_PURGE_KDC_PROXY_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ULONG, + LogonId: LUID, +}} +pub type PKERB_PURGE_KDC_PROXY_CACHE_REQUEST = *mut KERB_PURGE_KDC_PROXY_CACHE_REQUEST; +STRUCT!{struct KERB_PURGE_KDC_PROXY_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfPurged: ULONG, +}} +pub type PKERB_PURGE_KDC_PROXY_CACHE_RESPONSE = *mut KERB_PURGE_KDC_PROXY_CACHE_RESPONSE; +pub const KERB_S4U2PROXY_CACHE_ENTRY_INFO_FLAG_NEGATIVE: ULONG = 0x1; +STRUCT!{struct KERB_S4U2PROXY_CACHE_ENTRY_INFO { + ServerName: UNICODE_STRING, + Flags: ULONG, + LastStatus: NTSTATUS, + Expiry: LARGE_INTEGER, +}} +pub type PKERB_S4U2PROXY_CACHE_ENTRY_INFO = *mut KERB_S4U2PROXY_CACHE_ENTRY_INFO; +pub const KERB_S4U2PROXY_CRED_FLAG_NEGATIVE: ULONG = 0x1; +STRUCT!{struct KERB_S4U2PROXY_CRED { + UserName: UNICODE_STRING, + DomainName: UNICODE_STRING, + Flags: ULONG, + LastStatus: NTSTATUS, + Expiry: LARGE_INTEGER, + CountOfEntries: ULONG, + Entries: PKERB_S4U2PROXY_CACHE_ENTRY_INFO, +}} +pub type PKERB_S4U2PROXY_CRED = *mut KERB_S4U2PROXY_CRED; +STRUCT!{struct KERB_QUERY_S4U2PROXY_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ULONG, + LogonId: LUID, +}} +pub type PKERB_QUERY_S4U2PROXY_CACHE_REQUEST = *mut KERB_QUERY_S4U2PROXY_CACHE_REQUEST; +STRUCT!{struct KERB_QUERY_S4U2PROXY_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfCreds: ULONG, + Creds: PKERB_S4U2PROXY_CRED, +}} +pub type PKERB_QUERY_S4U2PROXY_CACHE_RESPONSE = *mut KERB_QUERY_S4U2PROXY_CACHE_RESPONSE; +STRUCT!{struct KERB_CHANGEPASSWORD_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + DomainName: UNICODE_STRING, + AccountName: UNICODE_STRING, + OldPassword: UNICODE_STRING, + NewPassword: UNICODE_STRING, + Impersonating: BOOLEAN, +}} +pub type PKERB_CHANGEPASSWORD_REQUEST = *mut KERB_CHANGEPASSWORD_REQUEST; +STRUCT!{struct KERB_SETPASSWORD_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, + CredentialsHandle: SecHandle, + Flags: ULONG, + DomainName: UNICODE_STRING, + AccountName: UNICODE_STRING, + Password: UNICODE_STRING, +}} +pub type PKERB_SETPASSWORD_REQUEST = *mut KERB_SETPASSWORD_REQUEST; +STRUCT!{struct KERB_SETPASSWORD_EX_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, + CredentialsHandle: SecHandle, + Flags: ULONG, + AccountRealm: UNICODE_STRING, + AccountName: UNICODE_STRING, + Password: UNICODE_STRING, + ClientRealm: UNICODE_STRING, + ClientName: UNICODE_STRING, + Impersonating: BOOLEAN, + KdcAddress: UNICODE_STRING, + KdcAddressType: ULONG, +}} +pub type PKERB_SETPASSWORD_EX_REQUEST = *mut KERB_SETPASSWORD_EX_REQUEST; +pub const DS_UNKNOWN_ADDRESS_TYPE: ULONG = 0; +pub const KERB_SETPASS_USE_LOGONID: ULONG = 1; +pub const KERB_SETPASS_USE_CREDHANDLE: ULONG = 2; +STRUCT!{struct KERB_DECRYPT_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, + Flags: ULONG, + CryptoType: LONG, + KeyUsage: LONG, + Key: KERB_CRYPTO_KEY, + EncryptedDataSize: ULONG, + InitialVectorSize: ULONG, + InitialVector: PUCHAR, + EncryptedData: PUCHAR, +}} +pub type PKERB_DECRYPT_REQUEST = *mut KERB_DECRYPT_REQUEST; +pub const KERB_DECRYPT_FLAG_DEFAULT_KEY: ULONG = 0x00000001; +STRUCT!{struct KERB_DECRYPT_RESPONSE { + DecryptedData: [UCHAR; ANYSIZE_ARRAY], +}} +pub type PKERB_DECRYPT_RESPONSE = *mut KERB_DECRYPT_RESPONSE; +STRUCT!{struct KERB_ADD_BINDING_CACHE_ENTRY_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + RealmName: UNICODE_STRING, + KdcAddress: UNICODE_STRING, + AddressType: ULONG, +}} +pub type PKERB_ADD_BINDING_CACHE_ENTRY_REQUEST = *mut KERB_ADD_BINDING_CACHE_ENTRY_REQUEST; +STRUCT!{struct KERB_REFRESH_SCCRED_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CredentialBlob: UNICODE_STRING, + LogonId: LUID, + Flags: ULONG, +}} +pub type PKERB_REFRESH_SCCRED_REQUEST = *mut KERB_REFRESH_SCCRED_REQUEST; +pub const KERB_REFRESH_SCCRED_RELEASE: ULONG = 0x0; +pub const KERB_REFRESH_SCCRED_GETTGT: ULONG = 0x1; +STRUCT!{struct KERB_ADD_CREDENTIALS_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + UserName: UNICODE_STRING, + DomainName: UNICODE_STRING, + Password: UNICODE_STRING, + LogonId: LUID, + Flags: ULONG, +}} +pub type PKERB_ADD_CREDENTIALS_REQUEST = *mut KERB_ADD_CREDENTIALS_REQUEST; +pub const KERB_REQUEST_ADD_CREDENTIAL: ULONG = 1; +pub const KERB_REQUEST_REPLACE_CREDENTIAL: ULONG = 2; +pub const KERB_REQUEST_REMOVE_CREDENTIAL: ULONG = 4; +STRUCT!{struct KERB_ADD_CREDENTIALS_REQUEST_EX { + Credentials: KERB_ADD_CREDENTIALS_REQUEST, + PrincipalNameCount: ULONG, + PrincipalNames: [UNICODE_STRING; ANYSIZE_ARRAY], +}} +pub type PKERB_ADD_CREDENTIALS_REQUEST_EX = *mut KERB_ADD_CREDENTIALS_REQUEST_EX; +STRUCT!{struct KERB_TRANSFER_CRED_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + OriginLogonId: LUID, + DestinationLogonId: LUID, + Flags: ULONG, +}} +pub type PKERB_TRANSFER_CRED_REQUEST = *mut KERB_TRANSFER_CRED_REQUEST; +pub const KERB_TRANSFER_CRED_WITH_TICKETS: ULONG = 0x1; +pub const KERB_TRANSFER_CRED_CLEANUP_CREDENTIALS: ULONG = 0x2; +STRUCT!{struct KERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + LogonId: LUID, +}} +pub type PKERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST = + *mut KERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST; +STRUCT!{struct KERB_BINDING_CACHE_ENTRY_DATA { + DiscoveryTime: ULONG64, + RealmName: UNICODE_STRING, + KdcAddress: UNICODE_STRING, + AddressType: ULONG, + Flags: ULONG, + DcFlags: ULONG, + CacheFlags: ULONG, + KdcName: UNICODE_STRING, +}} +pub type PKERB_BINDING_CACHE_ENTRY_DATA = *mut KERB_BINDING_CACHE_ENTRY_DATA; +STRUCT!{struct KERB_QUERY_BINDING_CACHE_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + CountOfEntries: ULONG, + Entries: PKERB_BINDING_CACHE_ENTRY_DATA, +}} +pub type PKERB_QUERY_BINDING_CACHE_RESPONSE = *mut KERB_QUERY_BINDING_CACHE_RESPONSE; +STRUCT!{struct KERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + RealmName: UNICODE_STRING, + KdcAddress: UNICODE_STRING, + AddressType: ULONG, + DcFlags: ULONG, +}} +pub type PKERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST = *mut KERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST; +STRUCT!{struct KERB_QUERY_BINDING_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, +}} +pub type PKERB_QUERY_BINDING_CACHE_REQUEST = *mut KERB_QUERY_BINDING_CACHE_REQUEST; +STRUCT!{struct KERB_PURGE_BINDING_CACHE_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, +}} +pub type PKERB_PURGE_BINDING_CACHE_REQUEST = *mut KERB_PURGE_BINDING_CACHE_REQUEST; +STRUCT!{struct KERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ULONG, + DomainName: UNICODE_STRING, +}} +pub type PKERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST = + *mut KERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST; +STRUCT!{struct KERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE { + MessageType: KERB_PROTOCOL_MESSAGE_TYPE, + Flags: ULONG, + ExtendedPolicies: ULONG, + DsFlags: ULONG, +}} +pub type PKERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE = + *mut KERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE; +ENUM!{enum KERB_CERTIFICATE_INFO_TYPE { + CertHashInfo = 1, +}} +pub type PKERB_CERTIFICATE_INFO_TYPE = *mut KERB_CERTIFICATE_INFO_TYPE; +STRUCT!{struct KERB_CERTIFICATE_HASHINFO { + StoreNameLength: USHORT, + HashLength: USHORT, +}} +pub type PKERB_CERTIFICATE_HASHINFO = *mut KERB_CERTIFICATE_HASHINFO; +STRUCT!{struct KERB_CERTIFICATE_INFO { + CertInfoSize: ULONG, + InfoType: ULONG, +}} +pub type PKERB_CERTIFICATE_INFO = *mut KERB_CERTIFICATE_INFO; +STRUCT!{struct POLICY_AUDIT_SID_ARRAY { + UsersCount: ULONG, + UserSidArray: *mut PSID, +}} +pub type PPOLICY_AUDIT_SID_ARRAY = *mut POLICY_AUDIT_SID_ARRAY; +STRUCT!{struct AUDIT_POLICY_INFORMATION { + AuditSubCategoryGuid: GUID, + AuditingInformation: ULONG, + AuditCategoryGuid: GUID, +}} +pub type PAUDIT_POLICY_INFORMATION = *mut AUDIT_POLICY_INFORMATION; +pub type LPAUDIT_POLICY_INFORMATION = PAUDIT_POLICY_INFORMATION; +pub type PCAUDIT_POLICY_INFORMATION = *const AUDIT_POLICY_INFORMATION; +pub const AUDIT_SET_SYSTEM_POLICY: ULONG = 0x0001; +pub const AUDIT_QUERY_SYSTEM_POLICY: ULONG = 0x0002; +pub const AUDIT_SET_USER_POLICY: ULONG = 0x0004; +pub const AUDIT_QUERY_USER_POLICY: ULONG = 0x0008; +pub const AUDIT_ENUMERATE_USERS: ULONG = 0x0010; +pub const AUDIT_SET_MISC_POLICY: ULONG = 0x0020; +pub const AUDIT_QUERY_MISC_POLICY: ULONG = 0x0040; +pub const AUDIT_GENERIC_ALL: ULONG = STANDARD_RIGHTS_REQUIRED | AUDIT_SET_SYSTEM_POLICY + | AUDIT_QUERY_SYSTEM_POLICY | AUDIT_SET_USER_POLICY | AUDIT_QUERY_USER_POLICY + | AUDIT_ENUMERATE_USERS | AUDIT_SET_MISC_POLICY | AUDIT_QUERY_MISC_POLICY; +pub const AUDIT_GENERIC_READ: ULONG = STANDARD_RIGHTS_READ | AUDIT_QUERY_SYSTEM_POLICY + | AUDIT_QUERY_USER_POLICY | AUDIT_ENUMERATE_USERS | AUDIT_QUERY_MISC_POLICY; +pub const AUDIT_GENERIC_WRITE: ULONG = STANDARD_RIGHTS_WRITE | AUDIT_SET_USER_POLICY + | AUDIT_SET_MISC_POLICY | AUDIT_SET_SYSTEM_POLICY; +pub const AUDIT_GENERIC_EXECUTE: ULONG = STANDARD_RIGHTS_EXECUTE; +extern "system" { + // pub fn AuditSetSystemPolicy(); + // pub fn AuditSetPerUserPolicy(); + // pub fn AuditQuerySystemPolicy(); + // pub fn AuditQueryPerUserPolicy(); + // pub fn AuditEnumeratePerUserPolicy(); + // pub fn AuditComputeEffectivePolicyBySid(); + // pub fn AuditComputeEffectivePolicyByToken(); + // pub fn AuditEnumerateCategories(); + // pub fn AuditEnumerateSubCategories(); + // pub fn AuditLookupCategoryNameW(); + // pub fn AuditLookupCategoryNameA(); + // pub fn AuditLookupSubCategoryNameW(); + // pub fn AuditLookupSubCategoryNameA(); + // pub fn AuditLookupCategoryIdFromCategoryGuid(); + // pub fn AuditLookupCategoryGuidFromCategoryId(); + // pub fn AuditSetSecurity(); + // pub fn AuditQuerySecurity(); + // pub fn AuditSetGlobalSaclW(); + // pub fn AuditSetGlobalSaclA(); + // pub fn AuditQueryGlobalSaclW(); + // pub fn AuditQueryGlobalSaclA(); + pub fn AuditFree( + Buffer: PVOID, + ); +} +STRUCT!{struct PKU2U_CERT_BLOB { + CertOffset: ULONG, + CertLength: USHORT, +}} +pub type PPKU2U_CERT_BLOB = *mut PKU2U_CERT_BLOB; +pub const PKU2U_CREDUI_CONTEXT_VERSION: ULONG64 = 0x4154414454524543; +STRUCT!{struct PKU2U_CREDUI_CONTEXT { + Version: ULONG64, + cbHeaderLength: USHORT, + cbStructureLength: ULONG, + CertArrayCount: USHORT, + CertArrayOffset: ULONG, +}} +pub type PPKU2U_CREDUI_CONTEXT = *mut PKU2U_CREDUI_CONTEXT; +ENUM!{enum PKU2U_LOGON_SUBMIT_TYPE { + Pku2uCertificateS4ULogon = 14, +}} +pub type PPKU2U_LOGON_SUBMIT_TYPE = *mut PKU2U_LOGON_SUBMIT_TYPE; +STRUCT!{struct PKU2U_CERTIFICATE_S4U_LOGON { + MessageType: PKU2U_LOGON_SUBMIT_TYPE, + Flags: ULONG, + UserPrincipalName: UNICODE_STRING, + DomainName: UNICODE_STRING, + CertificateLength: ULONG, + Certificate: PUCHAR, +}} +pub type PPKU2U_CERTIFICATE_S4U_LOGON = *mut PKU2U_CERTIFICATE_S4U_LOGON; diff --git a/src/vendor/winapi/src/um/oaidl.rs b/src/vendor/winapi/src/um/oaidl.rs new file mode 100644 index 0000000000..c9a04c4ac1 --- /dev/null +++ b/src/vendor/winapi/src/um/oaidl.rs @@ -0,0 +1,787 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of OAIdl.h +use shared::basetsd::ULONG_PTR; +use shared::guiddef::{GUID, IID, REFGUID, REFIID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, INT, UINT, ULONG, USHORT, WORD}; +use shared::rpcndr::byte; +use shared::wtypes::{ + BSTR, CY, DATE, DECIMAL, VARIANT_BOOL, VARTYPE, VT_BSTR, VT_DISPATCH, VT_ERROR, + VT_I1, VT_I2, VT_I4, VT_I8, VT_RECORD, VT_RESERVED, VT_UNKNOWN, VT_VARIANT, + wireBSTR +}; +use shared::wtypesbase::{ + BYTE_SIZEDARR, DOUBLE, DWORD_SIZEDARR, HYPER_SIZEDARR, LPCOLESTR, LPOLESTR, SCODE, + WORD_SIZEDARR +}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{CHAR, HRESULT, LCID, LONG, LONGLONG, PVOID, SHORT, ULONGLONG}; +pub type CURRENCY = CY; +STRUCT!{struct SAFEARRAYBOUND { + cElements: ULONG, + lLbound: LONG, +}} +pub type LPSAFEARRAYBOUND = *mut SAFEARRAYBOUND; +pub type wireBRECORD = *mut _wireBRECORD; +pub type wireVARIANT = *mut _wireVARIANT; +STRUCT!{struct SAFEARR_BSTR { + Size: ULONG, + aBstr: *mut wireBSTR, +}} +STRUCT!{struct SAFEARR_UNKNOWN { + Size: ULONG, + apUnknown: *mut *mut IUnknown, +}} +STRUCT!{struct SAFEARR_DISPATCH { + Size: ULONG, + apDispatch: *mut *mut IDispatch, +}} +STRUCT!{struct SAFEARR_VARIANT { + Size: ULONG, + aVariant: *mut wireVARIANT, +}} +STRUCT!{struct SAFEARR_BRECORD { + Size: ULONG, + aRecord: *mut wireBRECORD, +}} +STRUCT!{struct SAFEARR_HAVEIID { + Size: ULONG, + apUnknown: *mut *mut IUnknown, + iid: IID, +}} +ENUM!{enum SF_TYPE { + SF_ERROR = VT_ERROR, + SF_I1 = VT_I1, + SF_I2 = VT_I2, + SF_I4 = VT_I4, + SF_I8 = VT_I8, + SF_BSTR = VT_BSTR, + SF_UNKNOWN = VT_UNKNOWN, + SF_DISPATCH = VT_DISPATCH, + SF_VARIANT = VT_VARIANT, + SF_RECORD = VT_RECORD, + SF_HAVEIID = VT_UNKNOWN | VT_RESERVED, +}} +#[cfg(target_arch = "x86")] +UNION!{union __MIDL_IOleAutomationTypes_0001 { + [u32; 6], + BstrStr BstrStr_mut: SAFEARR_BSTR, + UnknownStr UnknownStr_mut: SAFEARR_UNKNOWN, + DispatchStr DispatchStr_mut: SAFEARR_DISPATCH, + VariantStr VariantStr_mut: SAFEARR_VARIANT, + RecordStr RecordStr_mut: SAFEARR_BRECORD, + HaveIidStr HaveIidStr_mut: SAFEARR_HAVEIID, + ByteStr ByteStr_mut: BYTE_SIZEDARR, + WordStr WordStr_mut: WORD_SIZEDARR, + LongStr LongStr_mut: DWORD_SIZEDARR, + HyperStr HyperStr_mut: HYPER_SIZEDARR, +}} +#[cfg(target_arch = "x86_64")] +UNION!{union __MIDL_IOleAutomationTypes_0001 { + [u64; 4], + BstrStr BstrStr_mut: SAFEARR_BSTR, + UnknownStr UnknownStr_mut: SAFEARR_UNKNOWN, + DispatchStr DispatchStr_mut: SAFEARR_DISPATCH, + VariantStr VariantStr_mut: SAFEARR_VARIANT, + RecordStr RecordStr_mut: SAFEARR_BRECORD, + HaveIidStr HaveIidStr_mut: SAFEARR_HAVEIID, + ByteStr ByteStr_mut: BYTE_SIZEDARR, + WordStr WordStr_mut: WORD_SIZEDARR, + LongStr LongStr_mut: DWORD_SIZEDARR, + HyperStr HyperStr_mut: HYPER_SIZEDARR, +}} +STRUCT!{struct SAFEARRAYUNION { + sfType: ULONG, + u: __MIDL_IOleAutomationTypes_0001, +}} +STRUCT!{struct _wireSAFEARRAY { + cDims: USHORT, + fFeatures: USHORT, + cbElements: ULONG, + cLocks: ULONG, + uArrayStructs: SAFEARRAYUNION, + rgsaBound: [SAFEARRAYBOUND; 1], +}} +pub type wireSAFEARRAY = *mut _wireSAFEARRAY; +pub type wirePSAFEARRAY = *mut wireSAFEARRAY; +STRUCT!{struct SAFEARRAY { + cDims: USHORT, + fFeatures: USHORT, + cbElements: ULONG, + cLocks: ULONG, + pvData: PVOID, + rgsabound: [SAFEARRAYBOUND; 1], +}} +pub type LPSAFEARRAY = *mut SAFEARRAY; +pub const FADF_AUTO: DWORD = 0x1; +pub const FADF_STATIC: DWORD = 0x2; +pub const FADF_EMBEDDED: DWORD = 0x4; +pub const FADF_FIXEDSIZE: DWORD = 0x10; +pub const FADF_RECORD: DWORD = 0x20; +pub const FADF_HAVEIID: DWORD = 0x40; +pub const FADF_HAVEVARTYPE: DWORD = 0x80; +pub const FADF_BSTR: DWORD = 0x100; +pub const FADF_UNKNOWN: DWORD = 0x200; +pub const FADF_DISPATCH: DWORD = 0x400; +pub const FADF_VARIANT: DWORD = 0x800; +pub const FADF_RESERVED: DWORD = 0xf008; +STRUCT!{struct __tagBRECORD { + pvRecord: PVOID, + pRecInfo: *mut IRecordInfo, +}} +UNION!{union VARIANT_n3 { + [u64; 1] [u64; 2], + llVal llVal_mut: LONGLONG, + lVal lVal_mut: LONG, + bVal bVal_mut: BYTE, + iVal iVal_mut: SHORT, + fltVal fltVal_mut: FLOAT, + dblVal dblVal_mut: DOUBLE, + boolVal boolVal_mut: VARIANT_BOOL, + scode scode_mut: SCODE, + cyVal cyVal_mut: CY, + date date_mut: DATE, + bstrVal bstrVal_mut: BSTR, + punkVal punkVal_mut: *mut IUnknown, + pdispVal pdispVal_mut: *mut IDispatch, + parray parray_mut: *mut SAFEARRAY, + pbVal pbVal_mut: *mut BYTE, + piVal piVal_mut: *mut SHORT, + plVal plVal_mut: *mut LONG, + pllVal pllVal_mut: *mut LONGLONG, + pfltVal pfltVal_mut: *mut FLOAT, + pdblVal pdblVal_mut: *mut DOUBLE, + pboolVal pboolVal_mut: *mut VARIANT_BOOL, + pscode pscode_mut: *mut SCODE, + pcyVal pcyVal_mut: *mut CY, + pdate pdate_mut: *mut DATE, + pbstrVal pbstrVal_mut: *mut BSTR, + ppunkVal ppunkVal_mut: *mut *mut IUnknown, + ppdispVal ppdispVal_mut: *mut *mut IDispatch, + pparray pparray_mut: *mut *mut SAFEARRAY, + pvarVal pvarVal_mut: *mut VARIANT, + byref byref_mut: PVOID, + cVal cVal_mut: CHAR, + uiVal uiVal_mut: USHORT, + ulVal ulVal_mut: ULONG, + ullVal ullVal_mut: ULONGLONG, + intVal intVal_mut: INT, + uintVal uintVal_mut: UINT, + pdecVal pdecVal_mut: *mut DECIMAL, + pcVal pcVal_mut: *mut CHAR, + puiVal puiVal_mut: *mut USHORT, + pulVal pulVal_mut: *mut ULONG, + pullVal pullVal_mut: *mut ULONGLONG, + pintVal pintVal_mut: *mut INT, + puintVal puintVal_mut: *mut UINT, + n4 n4_mut: __tagBRECORD, +}} +STRUCT!{struct __tagVARIANT { + vt: VARTYPE, + wReserved1: WORD, + wReserved2: WORD, + wReserved3: WORD, + n3: VARIANT_n3, +}} +UNION!{union VARIANT_n1 { + [u64; 2] [u64; 3], + n2 n2_mut: __tagVARIANT, + decVal decVal_mut: DECIMAL, +}} +STRUCT!{struct VARIANT { + n1: VARIANT_n1, +}} +pub type LPVARIANT = *mut VARIANT; +pub type VARIANTARG = VARIANT; +pub type LPVARIANTARG = *mut VARIANT; +pub type REFVARIANT = *const VARIANT; +STRUCT!{struct _wireBRECORD { + fFlags: ULONG, + clSize: ULONG, + pRecInfo: *mut IRecordInfo, + pRecord: *mut byte, +}} +UNION!{union _wireVARIANT_u { + [u64; 2], + llVal llVal_mut: LONGLONG, + lVal lVal_mut: LONG, + bVal bVal_mut: BYTE, + iVal iVal_mut: SHORT, + fltVal fltVal_mut: FLOAT, + dblVal dblVal_mut: DOUBLE, + boolVal boolVal_mut: VARIANT_BOOL, + scode scode_mut: SCODE, + cyVal cyVal_mut: CY, + date date_mut: DATE, + bstrVal bstrVal_mut: wireBSTR, + punkVal punkVal_mut: *mut IUnknown, + pdispVal pdispVal_mut: *mut IDispatch, + parray parray_mut: wirePSAFEARRAY, + brecVal brecVal_mut: wireBRECORD, + pbVal pbVal_mut: *mut BYTE, + piVal piVal_mut: *mut SHORT, + plVal plVal_mut: *mut LONG, + pllVal pllVal_mut: *mut LONGLONG, + pfltVal pfltVal_mut: *mut FLOAT, + pdblVal pdblVal_mut: *mut DOUBLE, + pboolVal pboolVal_mut: *mut VARIANT_BOOL, + pscode pscode_mut: *mut SCODE, + pcyVal pcyVal_mut: *mut CY, + pdate pdate_mut: *mut DATE, + pbstrVal pbstrVal_mut: *mut wireBSTR, + ppunkVal ppunkVal_mut: *mut *mut IUnknown, + ppdispVal ppdispVal_mut: *mut *mut IDispatch, + pparray pparray_mut: *mut wirePSAFEARRAY, + pvarVal pvarVal_mut: *mut wireVARIANT, + cVal cVal_mut: CHAR, + uiVal uiVal_mut: USHORT, + ulVal ulVal_mut: ULONG, + ullVal ullVal_mut: ULONGLONG, + intVal intVal_mut: INT, + uintVal uintVal_mut: UINT, + decVal decVal_mut: DECIMAL, + pdecVal pdecVal_mut: *mut DECIMAL, + pcVal pcVal_mut: *mut CHAR, + puiVal puiVal_mut: *mut USHORT, + pulVal pulVal_mut: *mut ULONG, + pullVal pullVal_mut: *mut ULONGLONG, + pintVal pintVal_mut: *mut INT, + puintVal puintVal_mut: *mut UINT, +}} +STRUCT!{struct _wireVARIANT { + clSize: DWORD, + rpcReserved: DWORD, + vt: USHORT, + wReserved1: USHORT, + wReserved2: USHORT, + wReserved3: USHORT, + u: _wireVARIANT_u, +}} +pub type DISPID = LONG; +pub type MEMBERID = DISPID; +pub type HREFTYPE = DWORD; +ENUM!{enum TYPEKIND { + TKIND_ENUM = 0, + TKIND_RECORD, + TKIND_MODULE, + TKIND_INTERFACE, + TKIND_DISPATCH, + TKIND_COCLASS, + TKIND_ALIAS, + TKIND_UNION, + TKIND_MAX, +}} +UNION!{union TYPEDESC_u { + [usize; 1], + lptdesc lptdesc_mut: *mut TYPEDESC, + lpadesc lpadesc_mut: *mut ARRAYDESC, + hreftype hreftype_mut: HREFTYPE, +}} +STRUCT!{struct TYPEDESC { + u: TYPEDESC_u, + vt: VARTYPE, +}} +STRUCT!{struct ARRAYDESC { + tdescElem: TYPEDESC, + cDims: USHORT, + rgbounds: [SAFEARRAYBOUND; 1], +}} +STRUCT!{struct PARAMDESCEX { + cBytes: ULONG, + varDefaultValue: VARIANTARG, +}} +pub type LPPARAMDESCEX = *mut PARAMDESCEX; +STRUCT!{struct PARAMDESC { + pparamdescex: LPPARAMDESCEX, + wParamFlags: USHORT, +}} +pub type LPPARAMDESC = *mut PARAMDESC; +pub const PARAMFLAG_NONE: DWORD = 0; +pub const PARAMFLAG_FIN: DWORD = 0x1; +pub const PARAMFLAG_FOUT: DWORD = 0x2; +pub const PARAMFLAG_FLCID: DWORD = 0x4; +pub const PARAMFLAG_FRETVAL: DWORD = 0x8; +pub const PARAMFLAG_FOPT: DWORD = 0x10; +pub const PARAMFLAG_FHASDEFAULT: DWORD = 0x20; +pub const PARAMFLAG_FHASCUSTDATA: DWORD = 0x40; +STRUCT!{struct IDLDESC { + dwReserved: ULONG_PTR, + wIDLFlags: USHORT, +}} +pub type LPIDLDESC = *mut IDLDESC; +pub const IDLFLAG_NONE: DWORD = PARAMFLAG_NONE; +pub const IDLFLAG_FIN: DWORD = PARAMFLAG_FIN; +pub const IDLFLAG_FOUT: DWORD = PARAMFLAG_FOUT; +pub const IDLFLAG_FLCID: DWORD = PARAMFLAG_FLCID; +pub const IDLFLAG_FRETVAL: DWORD = PARAMFLAG_FRETVAL; +UNION!{union ELEMDESC_u { + [usize; 2], + idldesc idldesc_mut: IDLDESC, + paramdesc paramdesc_mut: PARAMDESC, +}} +STRUCT!{struct ELEMDESC { + tdesc: TYPEDESC, + u: ELEMDESC_u, +}} +pub type LPELEMDESC = *mut ELEMDESC; +STRUCT!{struct TYPEATTR { + guid: GUID, + lcid: LCID, + dwReserved: DWORD, + memidConstructor: MEMBERID, + memidDestructor: MEMBERID, + lpstrSchema: LPOLESTR, + cbSizeInstance: ULONG, + typekind: TYPEKIND, + cFuncs: WORD, + cVars: WORD, + cImplTypes: WORD, + cbSizeVft: WORD, + cbAlignment: WORD, + wTypeFlags: WORD, + wMajorVerNum: WORD, + wMinorVerNum: WORD, + tdescAlias: TYPEDESC, + idldescType: IDLDESC, +}} +pub type LPTYPEATTR = *mut TYPEATTR; +STRUCT!{struct DISPPARAMS { + rgvarg: *mut VARIANTARG, + rgdispidNamedArgs: *mut DISPID, + cArgs: UINT, + cNamedArgs: UINT, +}} +STRUCT!{struct EXCEPINFO { + wCode: WORD, + wReserved: WORD, + bstrSource: BSTR, + bstrDescription: BSTR, + bstrHelpFile: BSTR, + dwHelpContext: DWORD, + pvReserved: PVOID, + pfnDeferredFillIn: Option HRESULT>, + scode: SCODE, +}} +ENUM!{enum CALLCONV { + CC_FASTCALL = 0, + CC_CDECL = 1, + CC_MSCPASCAL, + CC_PASCAL, + CC_MACPASCAL, + CC_STDCALL, + CC_FPFASTCALL, + CC_SYSCALL, + CC_MPWCDECL, + CC_MPWPASCAL, + CC_MAX, +}} +ENUM!{enum FUNCKIND { + FUNC_VIRTUAL = 0, + FUNC_PUREVIRTUAL, + FUNC_NONVIRTUAL, + FUNC_STATIC, + FUNC_DISPATCH, +}} +ENUM!{enum INVOKEKIND { + INVOKE_FUNC = 1, + INVOKE_PROPERTYGET = 2, + INVOKE_PROPERTYPUT = 4, + INVOKE_PROPERTYPUTREF = 8, +}} +STRUCT!{struct FUNCDESC { + memid: MEMBERID, + lprgscode: *mut SCODE, + lprgelemdescParam: *mut ELEMDESC, + funckind: FUNCKIND, + invkind: INVOKEKIND, + callconv: CALLCONV, + cParams: SHORT, + cParamsOpt: SHORT, + oVft: SHORT, + cScodes: SHORT, + elemdescFunc: ELEMDESC, + wFuncFlags: WORD, +}} +pub type LPFUNCDESC = *mut FUNCDESC; +ENUM!{enum VARKIND { + VAR_PERINSTANCE = 0, + VAR_STATIC, + VAR_CONST, + VAR_DISPATCH, +}} +pub const IMPLTYPEFLAG_FDEFAULT: DWORD = 0x1; +pub const IMPLTYPEFLAG_FSOURCE: DWORD = 0x2; +pub const IMPLTYPEFLAG_FRESTRICTED: DWORD = 0x4; +pub const IMPLTYPEFLAG_FDEFAULTVTABLE: DWORD = 0x8; +UNION!{union VARDESC_u { + [usize; 1], + oInst oInst_mut: ULONG, + lpvarValue lpvarValue_mut: *mut VARIANT, +}} +STRUCT!{struct VARDESC { + memid: MEMBERID, + lpstrSchema: LPOLESTR, + u: VARDESC_u, + elemdescVar: ELEMDESC, + wVarFlags: WORD, + varkind: VARKIND, +}} +pub type LPVARDESC = *mut VARDESC; +ENUM!{enum TYPEFLAGS { + TYPEFLAG_FAPPOBJECT = 0x1, + TYPEFLAG_FCANCREATE = 0x2, + TYPEFLAG_FLICENSED = 0x4, + TYPEFLAG_FPREDECLID = 0x8, + TYPEFLAG_FHIDDEN = 0x10, + TYPEFLAG_FCONTROL = 0x20, + TYPEFLAG_FDUAL = 0x40, + TYPEFLAG_FNONEXTENSIBLE = 0x80, + TYPEFLAG_FOLEAUTOMATION = 0x100, + TYPEFLAG_FRESTRICTED = 0x200, + TYPEFLAG_FAGGREGATABLE = 0x400, + TYPEFLAG_FREPLACEABLE = 0x800, + TYPEFLAG_FDISPATCHABLE = 0x1000, + TYPEFLAG_FREVERSEBIND = 0x2000, + TYPEFLAG_FPROXY = 0x4000, +}} +ENUM!{enum FUNCFLAGS { + FUNCFLAG_FRESTRICTED = 0x1, + FUNCFLAG_FSOURCE = 0x2, + FUNCFLAG_FBINDABLE = 0x4, + FUNCFLAG_FREQUESTEDIT = 0x8, + FUNCFLAG_FDISPLAYBIND = 0x10, + FUNCFLAG_FDEFAULTBIND = 0x20, + FUNCFLAG_FHIDDEN = 0x40, + FUNCFLAG_FUSESGETLASTERROR = 0x80, + FUNCFLAG_FDEFAULTCOLLELEM = 0x100, + FUNCFLAG_FUIDEFAULT = 0x200, + FUNCFLAG_FNONBROWSABLE = 0x400, + FUNCFLAG_FREPLACEABLE = 0x800, + FUNCFLAG_FIMMEDIATEBIND = 0x1000, +}} +ENUM!{enum VARFLAGS { + VARFLAG_FREADONLY = 0x1, + VARFLAG_FSOURCE = 0x2, + VARFLAG_FBINDABLE = 0x4, + VARFLAG_FREQUESTEDIT = 0x8, + VARFLAG_FDISPLAYBIND = 0x10, + VARFLAG_FDEFAULTBIND = 0x20, + VARFLAG_FHIDDEN = 0x40, + VARFLAG_FRESTRICTED = 0x80, + VARFLAG_FDEFAULTCOLLELEM = 0x100, + VARFLAG_FUIDEFAULT = 0x200, + VARFLAG_FNONBROWSABLE = 0x400, + VARFLAG_FREPLACEABLE = 0x800, + VARFLAG_FIMMEDIATEBIND = 0x1000, +}} +STRUCT!{struct CLEANLOCALSTORAGE { + pInterface: *mut IUnknown, + pStorage: PVOID, + flags: DWORD, +}} +STRUCT!{struct CUSTDATAITEM { + guid: GUID, + varValue: VARIANTARG, +}} +pub type LPCUSTDATAITEM = *mut CUSTDATAITEM; +STRUCT!{struct CUSTDATA { + cCustData: DWORD, + prgCustData: LPCUSTDATAITEM, +}} +pub type LPCUSTDATA = *mut CUSTDATA; +pub type LPCREATETYPEINFO = *mut ICreateTypeInfo; +RIDL!{#[uuid(0x00020405, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ICreateTypeInfo(ICreateTypeInfoVtbl): IUnknown(IUnknownVtbl) { + fn SetGuid( + guid: REFGUID, + ) -> HRESULT, + fn SetTypeFlags( + uTypeFlags: UINT, + ) -> HRESULT, + fn SetDocString( + pStrDoc: LPOLESTR, + ) -> HRESULT, + fn SetHelpContext( + dwHelpContext: DWORD, + ) -> HRESULT, + fn SetVersion( + wMajorVerNum: WORD, + wMinorVerNum: WORD, + ) -> HRESULT, + fn AddRefTypeInfo( + pTInfo: *mut ITypeInfo, + ) -> HRESULT, + fn AddFuncDesc( + index: UINT, + pFuncDesc: *mut FUNCDESC, + ) -> HRESULT, + fn SetImplTypeFlags( + index: UINT, + implTypeFlags: INT, + ) -> HRESULT, + fn SetAlignment( + cbAlignment: WORD, + ) -> HRESULT, + fn SetSchema( + pStrSchema: LPOLESTR, + ) -> HRESULT, + fn AddVarDesc( + index: UINT, + pVarDesc: *mut VARDESC, + ) -> HRESULT, + fn SetFuncAndParamNames( + index: UINT, + rgszNames: *mut LPOLESTR, + cNames: UINT, + ) -> HRESULT, + fn SetVarName( + index: UINT, + szName: LPOLESTR, + ) -> HRESULT, + fn SetTypeDescAlias( + pTDescAlias: *mut TYPEDESC, + ) -> HRESULT, + fn DefineFuncAsDllEntry( + index: UINT, + szDllName: LPOLESTR, + szProcName: LPOLESTR, + ) -> HRESULT, + fn SetFuncDocString( + index: UINT, + szDocString: LPOLESTR, + ) -> HRESULT, + fn SetVarDocString( + index: UINT, + szDocString: LPOLESTR, + ) -> HRESULT, + fn SetFuncHelpContext( + index: UINT, + dwHelpContext: DWORD, + ) -> HRESULT, + fn SetVarHelpContext( + index: UINT, + dwHelpContext: DWORD, + ) -> HRESULT, + fn SetMops( + index: UINT, + bstrMops: BSTR, + ) -> HRESULT, + fn SetTypeIdldesc( + pIdlDesc: *mut IDLDESC, + ) -> HRESULT, + fn LayOut() -> HRESULT, +}} +// LPCREATETYPEINFO2 +// ICreateTypeInfo2 +// LPCREATETYPELIB +// ICreateTypeLib +// LPCREATETYPELIB2 +// ICreateTypeLib2 +pub type LPDISPATCH = *mut IDispatch; +pub const DISPID_UNKNOWN: INT = -1; +pub const DISPID_VALUE: INT = 0; +pub const DISPID_PROPERTYPUT: INT = -3; +pub const DISPID_NEWENUM: INT = -4; +pub const DISPID_EVALUATE: INT = -5; +pub const DISPID_CONSTRUCTOR: INT = -6; +pub const DISPID_DESTRUCTOR: INT = -7; +pub const DISPID_COLLECT: INT = -8; +RIDL!{#[uuid(0x00020400, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IDispatch(IDispatchVtbl): IUnknown(IUnknownVtbl) { + fn GetTypeInfoCount( + pctinfo: *mut UINT, + ) -> HRESULT, + fn GetTypeInfo( + iTInfo: UINT, + lcid: LCID, + ppTInfo: *mut *mut ITypeInfo, + ) -> HRESULT, + fn GetIDsOfNames( + riid: REFIID, + rgszNames: *mut LPOLESTR, + cNames: UINT, + lcid: LCID, + rgDispId: *mut DISPID, + ) -> HRESULT, + fn Invoke( + dispIdMember: DISPID, + riid: REFIID, + lcid: LCID, + wFlags: WORD, + pDispParams: *mut DISPPARAMS, + pVarResult: *mut VARIANT, + pExcepInfo: *mut EXCEPINFO, + puArgErr: *mut UINT, + ) -> HRESULT, +}} +// IDispatch_RemoteInvoke_Proxy +// IDispatch_RemoteInvoke_Stub +// LPENUMVARIANT +// IEnumVARIANT +// IEnumVARIANT_RemoteNext_Proxy +// IEnumVARIANT_RemoteNext_Stub +pub enum IRecordInfo {} // FIXME +pub enum ITypeComp {} // FIXME +ENUM!{enum SYSKIND { + SYS_WIN16 = 0, + SYS_WIN32, + SYS_MAC, + SYS_WIN64, +}} +STRUCT!{struct TLIBATTR { + guid: GUID, + lcid: LCID, + syskind: SYSKIND, + wMajorVerNum: WORD, + wMinorVerNum: WORD, + wLibFlags: WORD, +}} +RIDL!{#[uuid(0x00020402, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ITypeLib(ITypeLibVtbl): IUnknown(IUnknownVtbl) { + fn GetTypeInfoCount() -> UINT, + fn GetTypeInfo( + index: UINT, + ppTInfo: *mut *mut ITypeInfo, + ) -> HRESULT, + fn GetTypeInfoType( + index: UINT, + pTKind: *mut TYPEKIND, + ) -> HRESULT, + fn GetTypeInfoOfGuid( + guid: REFGUID, + ppTInfo: *mut *mut ITypeInfo, + ) -> HRESULT, + fn GetLibAttr( + ppTLibAttr: *mut *mut TLIBATTR, + ) -> HRESULT, + fn GetTypeComp( + ppTComp: *mut *mut ITypeComp, + ) -> HRESULT, + fn GetDocumentation( + index: INT, + pbstrName: *mut BSTR, + pBstrDocString: *mut BSTR, + pdwHelpContext: *mut DWORD, + pBstrHelpFile: *mut BSTR, + ) -> HRESULT, + fn IsName( + szNameBuf: LPOLESTR, + lHashVal: ULONG, + pfName: *mut BOOL, + ) -> HRESULT, + fn FindName( + szNameBuf: LPOLESTR, + lHashVal: ULONG, + ppTInfo: *mut *mut ITypeInfo, + rgMemId: *mut MEMBERID, + pcFound: *mut USHORT, + ) -> HRESULT, + fn ReleaseTLibAttr( + pTLibAttr: *const TLIBATTR, + ) -> HRESULT, +}} +RIDL!(#[uuid(0x00020401, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ITypeInfo(ITypeInfoVtbl): IUnknown(IUnknownVtbl) { + fn GetTypeAttr( + ppTypeAttr: *mut *mut TYPEATTR, + ) -> HRESULT, + fn GetTypeComp( + ppTComp: *mut *mut ITypeComp, + ) -> HRESULT, + fn GetFuncDesc( + index: UINT, + ppFunDesc: *mut *mut FUNCDESC, + ) -> HRESULT, + fn GetVarDesc( + index: UINT, + pPVarDesc: *mut *mut VARDESC, + ) -> HRESULT, + fn GetNames( + memid: MEMBERID, + rgBstrNames: *mut BSTR, + cMaxNames: UINT, + pcNames: *mut UINT, + ) -> HRESULT, + fn GetRefTypeOfImplType( + index: UINT, + pRefType: *mut HREFTYPE, + ) -> HRESULT, + fn GetImplTypeFlags( + index: UINT, + pImplTypeFlags: *mut INT, + ) -> HRESULT, + fn GetIDsOfNames( + rgszNames: *mut LPOLESTR, + cNames: UINT, + pMemId: *mut MEMBERID, + ) -> HRESULT, + fn Invoke( + pvInstance: PVOID, + memid: MEMBERID, + wFlags: WORD, + pDispParams: *mut DISPPARAMS, + pVarResult: *mut VARIANT, + pExcepInfo: *mut EXCEPINFO, + puArgErr: *mut UINT, + ) -> HRESULT, + fn GetDocumentation( + memid: MEMBERID, + pBstrName: *mut BSTR, + pBstrDocString: *mut BSTR, + pdwHelpContext: *mut DWORD, + pBstrHelpFile: *mut BSTR, + ) -> HRESULT, + fn GetDllEntry( + memid: MEMBERID, + invKind: INVOKEKIND, + pBstrDllName: *mut BSTR, + pBstrName: *mut BSTR, + pwOrdinal: *mut WORD, + ) -> HRESULT, + fn GetRefTypeInfo( + hRefType: HREFTYPE, + ppTInfo: *mut *mut ITypeInfo, + ) -> HRESULT, + fn AddressOfMember( + memid: MEMBERID, + invKind: INVOKEKIND, + ppv: *mut PVOID, + ) -> HRESULT, + fn CreateInstance( + pUnkOuter: *mut IUnknown, + riid: REFIID, + ppvObj: *mut PVOID, + ) -> HRESULT, + fn GetMops( + memid: MEMBERID, + pBstrMops: *mut BSTR, + ) -> HRESULT, + fn GetContainingTypeLib( + ppTLib: *mut *mut ITypeLib, + pIndex: *mut UINT, + ) -> HRESULT, + fn ReleaseTypeAttr( + pTypeAttr: *mut TYPEATTR, + ) -> (), + fn ReleaseFuncDesc( + pFuncDesc: *mut FUNCDESC, + ) -> (), + fn ReleaseVarDesc( + pVarDesc: *mut VARDESC, + ) -> (), +} +); +RIDL!(#[uuid(0x3127ca40, 0x446e, 0x11ce, 0x81, 0x35, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51)] +interface IErrorLog(IErrorLogVtbl): IUnknown(IUnknownVtbl) { + fn AddError( + pszPropName: LPCOLESTR, + pExcepInfo: *const EXCEPINFO, + ) -> HRESULT, +}); +pub type LPERRORLOG = *mut IErrorLog; diff --git a/src/vendor/winapi/src/um/objbase.rs b/src/vendor/winapi/src/um/objbase.rs new file mode 100644 index 0000000000..202f762664 --- /dev/null +++ b/src/vendor/winapi/src/um/objbase.rs @@ -0,0 +1,65 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Component object model defintions +use shared::minwindef::LPVOID; +use um::combaseapi::COINITBASE_MULTITHREADED; +use um::winnt::HRESULT; +ENUM!{enum COINIT { + COINIT_APARTMENTTHREADED = 0x2, + COINIT_MULTITHREADED = COINITBASE_MULTITHREADED, + COINIT_DISABLE_OLE1DDE = 0x4, + COINIT_SPEED_OVER_MEMORY = 0x8, +}} + // pub fn CoBuildVersion(); +extern "system" { + pub fn CoInitialize( + pvReserved: LPVOID, + ) -> HRESULT; +} + // pub fn CoRegisterMallocSpy(); + // pub fn CoRevokeMallocSpy(); + // pub fn CoRegisterInitializeSpy(); + // pub fn CoRevokeInitializeSpy(); + // pub fn CoGetSystemSecurityPermissions(); + // pub fn CoLoadLibrary(); + // pub fn CoFreeLibrary(); + // pub fn CoFreeAllLibraries(); + // pub fn CoGetInstanceFromFile(); + // pub fn CoGetInstanceFromIStorage(); + // pub fn CoAllowSetForegroundWindow(); + // pub fn DcomChannelSetHResult(); + // pub fn CoIsOle1Class(); + // pub fn CLSIDFromProgIDEx(); + // pub fn CoFileTimeToDosDateTime(); + // pub fn CoDosDateTimeToFileTime(); + // pub fn CoFileTimeNow(); + // pub fn CoRegisterMessageFilter(); + // pub fn CoRegisterChannelHook(); + // pub fn CoTreatAsClass(); + // pub fn CreateDataAdviseHolder(); + // pub fn CreateDataCache(); + // pub fn StgOpenAsyncDocfileOnIFillLockBytes(); + // pub fn StgGetIFillLockBytesOnILockBytes(); + // pub fn StgGetIFillLockBytesOnFile(); + // pub fn StgOpenLayoutDocfile(); + // pub fn CoInstall(); + // pub fn BindMoniker(); + // pub fn CoGetObject(); + // pub fn MkParseDisplayName(); + // pub fn MonikerRelativePathTo(); + // pub fn MonikerCommonPrefixWith(); + // pub fn CreateBindCtx(); + // pub fn CreateGenericComposite(); + // pub fn GetClassFile(); + // pub fn CreateClassMoniker(); + // pub fn CreateFileMoniker(); + // pub fn CreateItemMoniker(); + // pub fn CreateAntiMoniker(); + // pub fn CreatePointerMoniker(); + // pub fn CreateObjrefMoniker(); + // pub fn GetRunningObjectTable(); + // pub fn CreateStdProgressIndicator(); diff --git a/src/vendor/winapi/src/um/objidl.rs b/src/vendor/winapi/src/um/objidl.rs new file mode 100644 index 0000000000..3b6258eb05 --- /dev/null +++ b/src/vendor/winapi/src/um/objidl.rs @@ -0,0 +1,282 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! this ALWAYS GENERATED file contains the definitions for the interfaces +use ctypes::c_void; +use shared::basetsd::UINT64; +use shared::guiddef::{CLSID, REFIID}; +use shared::minwindef::{BOOL, DWORD, FILETIME, ULONG}; +use shared::wtypesbase::{LPOLESTR, OLECHAR}; +use um::objidlbase::{IEnumString, IStream}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, ULARGE_INTEGER}; +//8402 +STRUCT!{struct BIND_OPTS { + cbStruct: DWORD, + grfFlags: DWORD, + grfMode: DWORD, + dwTickCountDeadline: DWORD, +}} +pub type LPBIND_OPTS = *mut BIND_OPTS; +//8479 +RIDL!( +#[uuid(0x0000000e, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IBindCtx(IBindCtxVtbl): IUnknown(IUnknownVtbl) { + fn RegisterObjectBound( + punk: *mut IUnknown, + ) -> HRESULT, + fn RevokeObjectBound( + punk: *mut IUnknown, + ) -> HRESULT, + fn ReleaseBoundObjects() -> HRESULT, + fn SetBindOptions( + pbindopts: *mut BIND_OPTS, + ) -> HRESULT, + fn GetBindOptions( + pbindopts: *mut BIND_OPTS, + ) -> HRESULT, + fn GetRunningObjectTable( + pprot: *mut *mut IRunningObjectTable, + ) -> HRESULT, + fn RegisterObjectParam( + pszKey: LPOLESTR, + punk: *mut IUnknown, + ) -> HRESULT, + fn GetObjectParam( + pszKey: LPOLESTR, + ppunk: *mut *mut IUnknown, + ) -> HRESULT, + fn EnumObjectParam( + ppenum: *mut *mut IEnumString, + ) -> HRESULT, + fn RevokeObjectParam( + pszKey: LPOLESTR, + ) -> HRESULT, +} +); +//8681 +RIDL!( +#[uuid(0x00000102, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IEnumMoniker(IEnumMonikerVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + rgelt: *mut *mut IMoniker, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppenum: *mut *mut IEnumMoniker, + ) -> HRESULT, +} +); +//8958 +RIDL!( +#[uuid(0x00000010, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IRunningObjectTable(IRunningObjectTableVtbl): IUnknown(IUnknownVtbl) { + fn Register( + grfFlags: DWORD, + punkObject: *mut IUnknown, + pmkObjectName: *mut IMoniker, + pdwRegister: *mut DWORD, + ) -> HRESULT, + fn Revoke( + dwRegister: DWORD, + ) -> HRESULT, + fn IsRunning( + pmkObjectName: *mut IMoniker, + ) -> HRESULT, + fn GetObject( + pmkObjectName: *mut IMoniker, + ppunkObject: *mut *mut IUnknown, + ) -> HRESULT, + fn NoteChangeTime( + dwRegister: DWORD, + pfiletime: *mut FILETIME, + ) -> HRESULT, + fn GetTimeOfLastChange( + pmkObjectName: *mut IMoniker, + pfiletime: *mut FILETIME, + ) -> HRESULT, + fn EnumRunning( + ppenumMoniker: *mut *mut IEnumMoniker, + ) -> HRESULT, +} +); +//9125 +RIDL!( +#[uuid(0x0000010c, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IPersist(IPersistVtbl): IUnknown(IUnknownVtbl) { + fn GetClassID( + pClassID: *mut CLSID, + ) -> HRESULT, +} +); +//9207 +RIDL!( +#[uuid(0x00000109, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IPersistStream(IPersistStreamVtbl): IPersist(IPersistVtbl) { + fn IsDirty() -> HRESULT, + fn Load( + pStm: *mut IStream, + ) -> HRESULT, + fn Save( + pStm: *mut IStream, + fClearDirty: BOOL, + ) -> HRESULT, + fn GetSizeMax( + pcbSize: *mut ULARGE_INTEGER, + ) -> HRESULT, +} +); +//9350 +RIDL!( +#[uuid(0x0000000f, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IMoniker(IMonikerVtbl): IPersistStream(IPersistStreamVtbl) { + fn BindToObject( + pbc: *mut IBindCtx, + pmkToLeft: *mut IMoniker, + riidResult: REFIID, + ppvResult: *mut *mut c_void, + ) -> HRESULT, + fn BindToStorage( + pbc: *mut IBindCtx, + pmkToLeft: *mut IMoniker, + riid: REFIID, + ppvObj: *mut *mut c_void, + ) -> HRESULT, + fn Reduce( + pbc: *mut IBindCtx, + dwReduceHowFar: DWORD, + ppmkToLeft: *mut *mut IMoniker, + ppmkReduced: *mut *mut IMoniker, + ) -> HRESULT, + fn ComposeWith( + pmkRight: *mut IMoniker, + fOnlyIfNotGeneric: BOOL, + ppmkComposite: *mut *mut IMoniker, + ) -> HRESULT, + fn Enum( + fForward: BOOL, + ppenumMoniker: *mut *mut IEnumMoniker, + ) -> HRESULT, + fn IsEqual( + pmkOtherMoniker: *mut IMoniker, + ) -> HRESULT, + fn Hash( + pdwHash: *mut DWORD, + ) -> HRESULT, + fn IsRunning( + pbc: *mut IBindCtx, + pmkToLeft: *mut IMoniker, + pmkNewlyRunning: *mut IMoniker, + ) -> HRESULT, + fn GetTimeOfLastChange( + pbc: *mut IBindCtx, + pmkToLeft: *mut IMoniker, + pFileTime: *mut FILETIME, + ) -> HRESULT, + fn Inverse( + ppmk: *mut *mut IMoniker, + ) -> HRESULT, + fn CommonPrefixWith( + pmkOther: *mut IMoniker, + ppmkPrefix: *mut *mut IMoniker, + ) -> HRESULT, + fn RelativePathTo( + pmkOther: *mut IMoniker, + ppmkRelPath: *mut *mut IMoniker, + ) -> HRESULT, + fn GetDisplayName( + pbc: *mut IBindCtx, + pmkToLeft: *mut IMoniker, + ppszDisplayName: *mut LPOLESTR, + ) -> HRESULT, + fn ParseDisplayName( + pbc: *mut IBindCtx, + pmkToLeft: *mut IMoniker, + pszDisplayName: LPOLESTR, + pchEaten: *mut ULONG, + ppmkOut: *mut *mut IMoniker, + ) -> HRESULT, + fn IsSystemMoniker( + pdwMksys: *mut DWORD, + ) -> HRESULT, +} +); +ENUM!{enum EOLE_AUTHENTICATION_CAPABILITIES { + EOAC_NONE = 0, + EOAC_MUTUAL_AUTH = 0x1, + EOAC_STATIC_CLOAKING = 0x20, + EOAC_DYNAMIC_CLOAKING = 0x40, + EOAC_ANY_AUTHORITY = 0x80, + EOAC_MAKE_FULLSIC = 0x100, + EOAC_DEFAULT = 0x800, + EOAC_SECURE_REFS = 0x2, + EOAC_ACCESS_CONTROL = 0x4, + EOAC_APPID = 0x8, + EOAC_DYNAMIC = 0x10, + EOAC_REQUIRE_FULLSIC = 0x200, + EOAC_AUTO_IMPERSONATE = 0x400, + EOAC_NO_CUSTOM_MARSHAL = 0x2000, + EOAC_DISABLE_AAA = 0x1000, +}} +STRUCT!{struct SOLE_AUTHENTICATION_SERVICE { + dwAuthnSvc: DWORD, + dwAuthzSvc: DWORD, + pPrincipalName: *mut OLECHAR, + hr: HRESULT, +}} +RIDL!( +#[uuid(0xa2f05a09, 0x27a2, 0x42b5, 0xbc, 0x0e, 0xac, 0x16, 0x3e, 0xf4, 0x9d, 0x9b)] +interface IApartmentShutdown(IApartmentShutdownVtbl): IUnknown(IUnknownVtbl) { + fn OnUninitialize( + ui64ApartmentIdentifier: UINT64, + ) -> (), +} +); +RIDL!( +#[uuid(0x00000003, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IMarshal(IMarshalVtbl): IUnknown(IUnknownVtbl) { + fn GetUnmarshalClass( + riid: REFIID, + pv: *mut c_void, + dwDestContext: DWORD, + pvDestContext: *mut c_void, + mshlflags: DWORD, + pCid: *mut CLSID, + ) -> HRESULT, + fn GetMarshalSizeMax( + riid: REFIID, + pv: *mut c_void, + dwDestContext: DWORD, + pvDestContext: *mut c_void, + mshlflags: DWORD, + pSize: *mut DWORD, + ) -> HRESULT, + fn MarshalInterface( + pStm: *mut IStream, + riid: REFIID, + pv: *mut c_void, + dwDestContext: DWORD, + pvDestContext: *mut c_void, + mshlflags: DWORD, + ) -> HRESULT, + fn UnmarshalInterface( + pStm: *mut IStream, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn ReleaseMarshalData( + pStm: *mut IStream, + ) -> HRESULT, + fn DisconnectObject( + dwReserved: DWORD, + ) -> HRESULT, +} +); diff --git a/src/vendor/winapi/src/um/objidlbase.rs b/src/vendor/winapi/src/um/objidlbase.rs new file mode 100644 index 0000000000..1fc5937ecb --- /dev/null +++ b/src/vendor/winapi/src/um/objidlbase.rs @@ -0,0 +1,957 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_int, c_void}; +use shared::basetsd::{SIZE_T, ULONG_PTR}; +use shared::guiddef::{CLSID, GUID, IID, REFCLSID, REFGUID, REFIID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FILETIME, ULONG}; +use shared::wtypesbase::{COAUTHINFO, DOUBLE, LPOLESTR, OLECHAR}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, LARGE_INTEGER, LONG, LPWSTR, ULARGE_INTEGER}; +STRUCT!{struct COSERVERINFO { + dwReserved1: DWORD, + pwszName: LPWSTR, + pAuthInfo: *mut COAUTHINFO, + dwReserved2: DWORD, +}} +pub type LPMARSHAL = *mut IMarshal; +RIDL!{#[uuid(0x00000003, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IMarshal(IMarshalVtbl): IUnknown(IUnknownVtbl) { + fn GetUnmarshalClass( + riid: REFIID, + pv: *mut c_void, + dwDestContext: DWORD, + pvDestContext: *mut c_void, + mshlflags: DWORD, + pCid: *mut CLSID, + ) -> HRESULT, + fn GetMarshalSizeMax( + riid: REFIID, + pv: *mut c_void, + dwDestContext: DWORD, + pvDestContext: *mut c_void, + mshlflags: DWORD, + pSize: *mut DWORD, + ) -> HRESULT, + fn MarshalInterface( + pStm: *mut IStream, + riid: REFIID, + pv: *mut c_void, + dwDestContext: DWORD, + pvDestContext: *mut c_void, + mshlflags: DWORD, + ) -> HRESULT, + fn UnmarshalInterface( + pStm: *mut IStream, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn ReleaseMarshalData( + pStm: *mut IStream, + ) -> HRESULT, + fn DisconnectObject( + dwReserved: DWORD, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xecc8691b, 0xc1db, 0x4dc0, 0x85, 0x5e, 0x65, 0xf6, 0xc5, 0x51, 0xaf, 0x49)] +interface INoMarshal(INoMarshalVtbl): IUnknown(IUnknownVtbl) { +}} +RIDL!{#[uuid(0x94ea2b94, 0xe9cc, 0x49e0, 0xc0, 0xff, 0xee, 0x64, 0xca, 0x8f, 0x5b, 0x90)] +interface IAgileObject(IAgileObjectVtbl): IUnknown(IUnknownVtbl) { +}} +ENUM!{enum ACTIVATIONTYPE { + ACTIVATIONTYPE_UNCATEGORIZED = 0, + ACTIVATIONTYPE_FROM_MONIKER = 0x1, + ACTIVATIONTYPE_FROM_DATA = 0x2, + ACTIVATIONTYPE_FROM_STORAGE = 0x4, + ACTIVATIONTYPE_FROM_STREAM = 0x8, + ACTIVATIONTYPE_FROM_FILE = 0x10, +}} +RIDL!{#[uuid(0x00000017, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IActivationFilter(IActivationFilterVtbl): IUnknown(IUnknownVtbl) { + fn HandleActivation( + dwActivationType: DWORD, + rclsid: REFCLSID, + pReplacementClsId: *mut CLSID, + ) -> HRESULT, +}} +pub type LPMARSHAL2 = *mut IMarshal2; +RIDL!{#[uuid(0x000001cf, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IMarshal2(IMarshal2Vtbl): IMarshal(IMarshalVtbl) { +}} +pub type LPMALLOC = *mut IMalloc; +RIDL!{#[uuid(0x00000002, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IMalloc(IMallocVtbl): IUnknown(IUnknownVtbl) { + fn Alloc( + cb: SIZE_T, + ) -> *mut c_void, + fn Realloc( + pv: *mut c_void, + cb: SIZE_T, + ) -> *mut c_void, + fn Free( + pv: *mut c_void, + ) -> (), + fn GetSize( + pv: *mut c_void, + ) -> SIZE_T, + fn DidAlloc( + pv: *mut c_void, + ) -> c_int, + fn HeapMinimize() -> (), +}} +pub type LPSTDMARSHALINFO = IStdMarshalInfo; +RIDL!{#[uuid(0x00000018, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IStdMarshalInfo(IStdMarshalInfoVtbl): IUnknown(IUnknownVtbl) { + fn GetClassForHandler( + dwDestContext: DWORD, + pvDestContext: *mut c_void, + pClsid: *mut CLSID, + ) -> HRESULT, +}} +ENUM!{enum EXTCONN { + EXTCONN_STRONG = 0x1, + EXTCONN_WEAK = 0x2, + EXTCONN_CALLABLE = 0x4, +}} +RIDL!{#[uuid(0x00000019, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IExternalConnection(IExternalConnectionVtbl): IUnknown(IUnknownVtbl) { + fn AddConnection( + extconn: DWORD, + reserved: DWORD, + ) -> DWORD, + fn ReleaseConnection( + extconn: DWORD, + reserved: DWORD, + fLastReleaseCloses: BOOL, + ) -> DWORD, +}} +pub type LPMULTIQI = *mut IMultiQI; +STRUCT!{struct MULTI_QI { + pIID: *const IID, + pItf: *mut IUnknown, + hr: HRESULT, +}} +RIDL!{#[uuid(0x00000020, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IMultiQI(IMultiQIVtbl): IUnknown(IUnknownVtbl) { + fn QueryMultipleInterfaces( + cMQIs: ULONG, + pMQIs: *mut MULTI_QI, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x000e0020, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface AsyncIMultiQI(AsyncIMultiQIVtbl): IUnknown(IUnknownVtbl) { + fn Begin_QueryMultipleInterfaces( + cMQIs: ULONG, + pMQIs: *mut MULTI_QI, + ) -> HRESULT, + fn Finish_QueryMultipleInterfaces( + pMQIs: *mut MULTI_QI, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000021, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IInternalUnknown(IInternalUnknownVtbl): IUnknown(IUnknownVtbl) { + fn QueryInternalInterface( + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000100, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IEnumUnknown(IEnumUnknownVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + rgelt: *mut *mut IUnknown, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppenum: *mut *mut IEnumUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000101, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IEnumString(IEnumStringVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + rgelt: *mut LPOLESTR, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppenum: *mut *mut IEnumString, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x0c733a30, 0x2a1c, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d)] +interface ISequentialStream(ISequentialStreamVtbl): IUnknown(IUnknownVtbl) { + fn Read( + pv: *mut c_void, + cb: ULONG, + pcbRead: *mut ULONG, + ) -> HRESULT, + fn Write( + pv: *const c_void, + cb: ULONG, + pcbWritten: *mut ULONG, + ) -> HRESULT, +}} +STRUCT!{struct STATSTG { + pwcsName: LPOLESTR, + type_: DWORD, + cbSize: ULARGE_INTEGER, + mtime: FILETIME, + ctime: FILETIME, + atime: FILETIME, + grfMode: DWORD, + grfLocksSupported: DWORD, + clsid: CLSID, + grfStateBits: DWORD, + reserved: DWORD, +}} +ENUM!{enum STGTY { + STGTY_STORAGE = 1, + STGTY_STREAM = 2, + STGTY_LOCKBYTES = 3, + STGTY_PROPERTY = 4, +}} +ENUM!{enum STREAM_SEEK { + STREAM_SEEK_SET = 0, + STREAM_SEEK_CUR = 1, + STREAM_SEEK_END = 2, +}} +ENUM!{enum LOCKTYPE { + LOCK_WRITE = 1, + LOCK_EXCLUSIVE = 2, + LOCK_ONLYONCE = 4, +}} +pub type LPSTREAM = *mut IStream; +RIDL!{#[uuid(0x0000000c, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IStream(IStreamVtbl): ISequentialStream(ISequentialStreamVtbl) { + fn Seek( + dlibMove: LARGE_INTEGER, + dwOrigin: DWORD, + plibNewPosition: *mut ULARGE_INTEGER, + ) -> HRESULT, + fn SetSize( + libNewSize: ULARGE_INTEGER, + ) -> HRESULT, + fn CopyTo( + pstm: *mut IStream, + cb: ULARGE_INTEGER, + pcbRead: *mut ULARGE_INTEGER, + pcbWritten: *mut ULARGE_INTEGER, + ) -> HRESULT, + fn Commit( + grfCommitFlags: DWORD, + ) -> HRESULT, + fn Revert() -> HRESULT, + fn LockRegion( + libOffset: ULARGE_INTEGER, + cb: ULARGE_INTEGER, + dwLockType: DWORD, + ) -> HRESULT, + fn UnlockRegion( + libOffset: ULARGE_INTEGER, + cb: ULARGE_INTEGER, + dwLockType: DWORD, + ) -> HRESULT, + fn Stat( + pstatstg: *mut STATSTG, + grfStatFlag: DWORD, + ) -> HRESULT, + fn Clone( + ppstm: *mut *mut IStream, + ) -> HRESULT, +}} +pub type RPCOLEDATAREP = ULONG; +STRUCT!{struct RPCOLEMESSAGE { + reserved1: *mut c_void, + dataRepresentation: RPCOLEDATAREP, + Buffer: *mut c_void, + cbBuffer: ULONG, + iMethod: ULONG, + reserved2: [*mut c_void; 5], + rpcFlags: ULONG, +}} +pub type PRPCOLEMESSAGE = *mut RPCOLEMESSAGE; +RIDL!{#[uuid(0xd5f56b60, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a)] +interface IRpcChannelBuffer(IRpcChannelBufferVtbl): IUnknown(IUnknownVtbl) { + fn GetBuffer( + pMessage: *mut RPCOLEMESSAGE, + riid: REFIID, + ) -> HRESULT, + fn SendReceive( + pMessage: *mut RPCOLEMESSAGE, + pStatus: *mut ULONG, + ) -> HRESULT, + fn FreeBuffer( + pMessage: *mut RPCOLEMESSAGE, + ) -> HRESULT, + fn GetDestCtx( + pdwDestContext: *mut DWORD, + ppvDestContext: *mut *mut c_void, + ) -> HRESULT, + fn IsConnected() -> HRESULT, +}} +RIDL!{#[uuid(0x594f31d0, 0x7f19, 0x11d0, 0xb1, 0x94, 0x00, 0xa0, 0xc9, 0x0d, 0xc8, 0xbf)] +interface IRpcChannelBuffer2(IRpcChannelBuffer2Vtbl): IRpcChannelBuffer(IRpcChannelBufferVtbl) { + fn GetProtocolVersion( + pdwVersion: *mut DWORD, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xa5029fb6, 0x3c34, 0x11d1, 0x9c, 0x99, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0xaa)] +interface IAsyncRpcChannelBuffer(IAsyncRpcChannelBufferVtbl): + IRpcChannelBuffer2(IRpcChannelBuffer2Vtbl) { + fn Send( + pMsg: *mut RPCOLEMESSAGE, + pSync: *mut ISynchronize, + pulStatus: *mut ULONG, + ) -> HRESULT, + fn Receive( + pMsg: *mut RPCOLEMESSAGE, + pulStatus: *mut ULONG, + ) -> HRESULT, + fn GetDestCtxEx( + pMsg: *mut RPCOLEMESSAGE, + pdwDestContext: *mut DWORD, + ppvDestContext: *mut *mut c_void, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x25b15600, 0x0115, 0x11d0, 0xbf, 0x0d, 0x00, 0xaa, 0x00, 0xb8, 0xdf, 0xd2)] +interface IRpcChannelBuffer3(IRpcChannelBuffer3Vtbl): IRpcChannelBuffer2(IRpcChannelBuffer2Vtbl) { + fn Send( + pMsg: *mut RPCOLEMESSAGE, + pulStatus: *mut ULONG, + ) -> HRESULT, + fn Receive( + pMsg: *mut RPCOLEMESSAGE, + ulSize: ULONG, + pulStatus: *mut ULONG, + ) -> HRESULT, + fn Cancel( + pMsg: *mut RPCOLEMESSAGE, + ) -> HRESULT, + fn GetCallContext( + pMsg: *mut RPCOLEMESSAGE, + riid: REFIID, + pInterface: *mut *mut c_void, + ) -> HRESULT, + fn GetDestCtxEx( + pMsg: *mut RPCOLEMESSAGE, + pdwDestContext: *mut DWORD, + ppvDestContext: *mut *mut c_void, + ) -> HRESULT, + fn GetState( + pMsg: *mut RPCOLEMESSAGE, + pState: *mut DWORD, + ) -> HRESULT, + fn RegisterAsync( + pMsg: *mut RPCOLEMESSAGE, + pAsyncMgr: *mut IAsyncManager, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x58a08519, 0x24c8, 0x4935, 0xb4, 0x82, 0x3f, 0xd8, 0x23, 0x33, 0x3a, 0x4f)] +interface IRpcSyntaxNegotiate(IRpcSyntaxNegotiateVtbl): IUnknown(IUnknownVtbl) { + fn NegotiateSyntax( + pMsg: *mut RPCOLEMESSAGE, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xd5f56a34, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a)] +interface IRpcProxyBuffer(IRpcProxyBufferVtbl): IUnknown(IUnknownVtbl) { + fn Connect( + pRpcChannelBuffer: *mut IRpcChannelBuffer, + ) -> HRESULT, + fn Disconnect() -> (), +}} +RIDL!{#[uuid(0xd5f56afc, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a)] +interface IRpcStubBuffer(IRpcStubBufferVtbl): IUnknown(IUnknownVtbl) { + fn Connect( + pUnkServer: *mut IUnknown, + ) -> HRESULT, + fn Disconnect() -> (), + fn Invoke( + _prpcmsg: *mut RPCOLEMESSAGE, + _pRpcChannelBuffer: *mut IRpcChannelBuffer, + ) -> HRESULT, + fn IsIIDSupported( + riid: REFIID, + ) -> *mut IRpcStubBuffer, + fn CountRefs() -> ULONG, + fn DebugServerQueryInterface( + ppv: *mut *mut c_void, + ) -> HRESULT, + fn DebugServerRelease( + pv: *mut c_void, + ) -> (), +}} +RIDL!{#[uuid(0xd5f569d0, 0x593b, 0x101a, 0xb5, 0x69, 0x08, 0x00, 0x2b, 0x2d, 0xbf, 0x7a)] +interface IPSFactoryBuffer(IPSFactoryBufferVtbl): IUnknown(IUnknownVtbl) { + fn CreateProxy( + pUnkOuter: *mut IUnknown, + riid: REFIID, + ppProxy: *mut *mut IRpcProxyBuffer, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn CreateStub( + riid: REFIID, + pUnkServer: *mut *mut IUnknown, + ppStub: *mut *mut IRpcStubBuffer, + ) -> HRESULT, +}} +STRUCT!{struct SChannelHookCallInfo { + iid: IID, + cbSize: DWORD, + uCausality: GUID, + dwServerPid: DWORD, + iMethod: DWORD, + pObject: *mut c_void, +}} +RIDL!{#[uuid(0x1008c4a0, 0x7613, 0x11cf, 0x9a, 0xf1, 0x00, 0x20, 0xaf, 0x6e, 0x72, 0xf4)] +interface IChannelHook(IChannelHookVtbl): IUnknown(IUnknownVtbl) { + fn ClientGetSize( + uExtent: REFGUID, + riid: REFIID, + pDataSize: *mut ULONG, + ) -> (), + fn ClientFillBuffer( + uExtent: REFGUID, + riid: REFIID, + pDataSize: *mut ULONG, + pDataBuffer: *mut c_void, + ) -> (), + fn ClientNotify( + uExtent: REFGUID, + riid: REFIID, + cbDataSize: ULONG, + pDataBuffer: *mut c_void, + lDataRep: DWORD, + hrFault: HRESULT, + ) -> (), + fn ServerNotify( + uExtent: REFGUID, + riid: REFIID, + cbDataSize: ULONG, + pDataBuffer: *mut c_void, + lDataRep: DWORD, + ) -> (), + fn ServerGetSize( + uExtent: REFGUID, + riid: REFIID, + hrFault: HRESULT, + pDataSize: *mut ULONG, + ) -> (), + fn ServerFillBuffer( + uExtent: REFGUID, + riid: REFIID, + pDataSize: *mut ULONG, + pDataBuffer: *mut c_void, + hrFault: HRESULT, + ) -> (), +}} +STRUCT!{struct SOLE_AUTHENTICATION_SERVICE { + dwAuthnSvc: DWORD, + dwAuthzSvc: DWORD, + pPrincipalName: *mut OLECHAR, + hr: HRESULT, +}} +pub type PSOLE_AUTHENTICATION_SERVICE = *mut SOLE_AUTHENTICATION_SERVICE; +ENUM!{enum EOLE_AUTHENTICATION_CAPABILITIES { + EOAC_NONE = 0, + EOAC_MUTUAL_AUTH = 0x1, + EOAC_STATIC_CLOAKING = 0x20, + EOAC_DYNAMIC_CLOAKING = 0x40, + EOAC_ANY_AUTHORITY = 0x80, + EOAC_MAKE_FULLSIC = 0x100, + EOAC_DEFAULT = 0x800, + EOAC_SECURE_REFS = 0x2, + EOAC_ACCESS_CONTROL = 0x4, + EOAC_APPID = 0x8, + EOAC_DYNAMIC = 0x10, + EOAC_REQUIRE_FULLSIC = 0x200, + EOAC_AUTO_IMPERSONATE = 0x400, + EOAC_DISABLE_AAA = 0x1000, + EOAC_NO_CUSTOM_MARSHAL = 0x2000, + EOAC_RESERVED1 = 0x4000, +}} +pub const COLE_DEFAULT_PRINCIPAL: *mut OLECHAR = -1isize as *mut OLECHAR; +pub const COLE_DEFAULT_AUTHINFO: *mut c_void = -1isize as *mut c_void; +STRUCT!{struct SOLE_AUTHENTICATION_INFO { + dwAuthnSvc: DWORD, + dwAuthzSvc: DWORD, + pAuthInfo: *mut c_void, +}} +pub type PSOLE_AUTHENTICATION_INFO = *mut SOLE_AUTHENTICATION_INFO; +STRUCT!{struct SOLE_AUTHENTICATION_LIST { + cAuthInfo: DWORD, + aAuthInfo: *mut SOLE_AUTHENTICATION_INFO, +}} +pub type PSOLE_AUTHENTICATION_LIST = *mut SOLE_AUTHENTICATION_LIST; +RIDL!{#[uuid(0x0000013d, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IClientSecurity(IClientSecurityVtbl): IUnknown(IUnknownVtbl) { + fn QueryBlanket( + pProxy: *mut IUnknown, + pAuthnSvc: *mut DWORD, + pAuthzSvc: *mut DWORD, + pServerPrincName: *mut *mut OLECHAR, + pAuthnLevel: *mut DWORD, + pImpLevel: *mut DWORD, + pAuthInfo: *mut *mut c_void, + pCapabilities: *mut DWORD, + ) -> HRESULT, + fn SetBlanket( + pProxy: *mut IUnknown, + dwAuthnSvc: DWORD, + dwAuthzSvc: DWORD, + pServerPrincName: *mut OLECHAR, + dwAuthnLevel: DWORD, + dwImpLevel: DWORD, + pAuthInfo: *mut c_void, + dwCapabilities: DWORD, + ) -> HRESULT, + fn CopyProxy( + pProxy: *mut IUnknown, + ppCopy: *mut *mut IUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x0000013e, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IServerSecurity(IServerSecurityVtbl): IUnknown(IUnknownVtbl) { + fn QueryBlanket( + pAuthnSvc: *mut DWORD, + pAuthzSvc: *mut DWORD, + pServerPrincName: *mut *mut OLECHAR, + pAuthnLevel: *mut DWORD, + pImpLevel: *mut DWORD, + pPrivs: *mut *mut c_void, + pCapabilities: *mut DWORD, + ) -> HRESULT, + fn ImpersonateClient() -> HRESULT, + fn RevertToSelf() -> HRESULT, + fn IsImpersonating() -> BOOL, +}} +ENUM!{enum RPCOPT_PROPERTIES { + COMBND_RPCTIMEOUT = 0x1, + COMBND_SERVER_LOCALITY = 0x2, + COMBND_RESERVED1 = 0x4, + COMBND_RESERVED2 = 0x5, + COMBND_RESERVED3 = 0x8, + COMBND_RESERVED4 = 0x10, +}} +ENUM!{enum RPCOPT_SERVER_LOCALITY_VALUES { + SERVER_LOCALITY_PROCESS_LOCAL = 0, + SERVER_LOCALITY_MACHINE_LOCAL = 1, + SERVER_LOCALITY_REMOTE = 2, +}} +RIDL!{#[uuid(0x00000144, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IRpcOptions(IRpcOptionsVtbl): IUnknown(IUnknownVtbl) { + fn Set( + pPrx: *mut IUnknown, + dwProperty: RPCOPT_PROPERTIES, + dwValue: ULONG_PTR, + ) -> HRESULT, + fn Query( + pPrx: *mut IUnknown, + dwProperty: RPCOPT_PROPERTIES, + pdwValue: *mut ULONG_PTR, + ) -> HRESULT, +}} +ENUM!{enum GLOBALOPT_PROPERTIES { + COMGLB_EXCEPTION_HANDLING = 1, + COMGLB_APPID = 2, + COMGLB_RPC_THREADPOOL_SETTING = 3, + COMGLB_RO_SETTINGS = 4, + COMGLB_UNMARSHALING_POLICY = 5, + COMGLB_PROPERTIES_RESERVED1 = 6, +}} +ENUM!{enum GLOBALOPT_EH_VALUES { + COMGLB_EXCEPTION_HANDLE = 0, + COMGLB_EXCEPTION_DONOT_HANDLE_FATAL = 1, + COMGLB_EXCEPTION_DONOT_HANDLE = COMGLB_EXCEPTION_DONOT_HANDLE_FATAL, + COMGLB_EXCEPTION_DONOT_HANDLE_ANY = 2, +}} +ENUM!{enum GLOBALOPT_RPCTP_VALUES { + COMGLB_RPC_THREADPOOL_SETTING_DEFAULT_POOL = 0, + COMGLB_RPC_THREADPOOL_SETTING_PRIVATE_POOL = 1, +}} +ENUM!{enum GLOBALOPT_RO_FLAGS { + COMGLB_STA_MODALLOOP_REMOVE_TOUCH_MESSAGES = 0x1, + COMGLB_STA_MODALLOOP_SHARED_QUEUE_REMOVE_INPUT_MESSAGES = 0x2, + COMGLB_STA_MODALLOOP_SHARED_QUEUE_DONOT_REMOVE_INPUT_MESSAGES = 0x4, + COMGLB_FAST_RUNDOWN = 0x8, + COMGLB_RESERVED1 = 0x10, + COMGLB_RESERVED2 = 0x20, + COMGLB_RESERVED3 = 0x40, + COMGLB_STA_MODALLOOP_SHARED_QUEUE_REORDER_POINTER_MESSAGES = 0x80, + COMGLB_RESERVED4 = 0x100, + COMGLB_RESERVED5 = 0x200, + COMGLB_RESERVED6 = 0x400, +}} +ENUM!{enum GLOBALOPT_UNMARSHALING_POLICY_VALUES { + COMGLB_UNMARSHALING_POLICY_NORMAL = 0, + COMGLB_UNMARSHALING_POLICY_STRONG = 1, + COMGLB_UNMARSHALING_POLICY_HYBRID = 2, +}} +RIDL!{#[uuid(0x0000015b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IGlobalOptions(IGlobalOptionsVtbl): IUnknown(IUnknownVtbl) { + fn Set( + dwProperty: GLOBALOPT_PROPERTIES, + dwValue: ULONG_PTR, + ) -> HRESULT, + fn Query( + dwProperty: GLOBALOPT_PROPERTIES, + pdwValue: *mut ULONG_PTR, + ) -> HRESULT, +}} +pub type LPSURROGATE = *mut ISurrogate; +RIDL!{#[uuid(0x00000022, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ISurrogate(ISurrogateVtbl): IUnknown(IUnknownVtbl) { + fn LoadDllServer( + Clsid: REFCLSID, + ) -> HRESULT, + fn FreeSurrogate() -> HRESULT, +}} +pub type LPGLOBALINTERFACETABLE = *mut IGlobalInterfaceTable; +RIDL!{#[uuid(0x00000146, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IGlobalInterfaceTable(IGlobalInterfaceTableVtbl): IUnknown(IUnknownVtbl) { + fn RegisterInterfaceInGlobal( + pUnk: *mut IUnknown, + riid: REFIID, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn RevokeInterfaceFromGlobal( + dwCookie: DWORD, + ) -> HRESULT, + fn GetInterfaceFromGlobal( + dwCookie: DWORD, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000030, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ISynchronize(ISynchronizeVtbl): IUnknown(IUnknownVtbl) { + fn Wait( + dwFlags: DWORD, + dwMilliseconds: DWORD, + ) -> HRESULT, + fn Signal() -> HRESULT, + fn Reset() -> HRESULT, +}} +RIDL!{#[uuid(0x00000031, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ISynchronizeHandle(ISynchronizeHandleVtbl): IUnknown(IUnknownVtbl) { + fn GetHandle( + ph: *mut HANDLE, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000032, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ISynchronizeEvent(ISynchronizeEventVtbl): ISynchronizeHandle(ISynchronizeHandleVtbl) { + fn SetEventHandle( + ph: *mut HANDLE, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000033, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ISynchronizeContainer(ISynchronizeContainerVtbl): IUnknown(IUnknownVtbl) { + fn AddSynchronize( + pSync: *mut ISynchronize, + ) -> HRESULT, + fn WaitMultiple( + dwFlags: DWORD, + dwTimeOut: DWORD, + ppSync: *mut *mut ISynchronize, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000025, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ISynchronizeMutex(ISynchronizeMutexVtbl): ISynchronize(ISynchronizeVtbl) { + fn ReleaseMutex() -> HRESULT, +}} +pub type LPCANCELMETHODCALLS = *mut ICancelMethodCalls; +RIDL!{#[uuid(0x00000029, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface ICancelMethodCalls(ICancelMethodCallsVtbl): IUnknown(IUnknownVtbl) { + fn Cancel( + ulSeconds: ULONG, + ) -> HRESULT, + fn TestCancel() -> HRESULT, +}} +ENUM!{enum DCOM_CALL_STATE { + DCOM_NONE = 0, + DCOM_CALL_COMPLETE = 0x1, + DCOM_CALL_CANCELED = 0x2, +}} +RIDL!{#[uuid(0x0000002a, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IAsyncManager(IAsyncManagerVtbl): IUnknown(IUnknownVtbl) { + fn CompleteCall( + Result: HRESULT, + ) -> HRESULT, + fn GetCallContext( + riid: REFIID, + pInterface: *mut *mut c_void, + ) -> HRESULT, + fn GetState( + pulStateFlags: *mut ULONG, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x1c733a30, 0x2a1c, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d)] +interface ICallFactory(ICallFactoryVtbl): IUnknown(IUnknownVtbl) { + fn CreateCall( + riid: REFIID, + pCtrlUnk: *mut IUnknown, + riid2: REFIID, + ppv: *mut *mut IUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000149, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IRpcHelper(IRpcHelperVtbl): IUnknown(IUnknownVtbl) { + fn GetDCOMProtocolVersion( + pComVersion: *mut DWORD, + ) -> HRESULT, + fn GetIIDFromOBJREF( + pObjRef: *mut c_void, + piid: *mut *mut IID, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xeb0cb9e8, 0x7996, 0x11d2, 0x87, 0x2e, 0x00, 0x00, 0xf8, 0x08, 0x08, 0x59)] +interface IReleaseMarshalBuffers(IReleaseMarshalBuffersVtbl): IUnknown(IUnknownVtbl) { + fn ReleaseMarshalBuffer( + pMsg: *mut RPCOLEMESSAGE, + dwFlags: DWORD, + pChnl: *mut IUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x0000002b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IWaitMultiple(IWaitMultipleVtbl): IUnknown(IUnknownVtbl) { + fn WaitMultiple( + timeout: DWORD, + pSync: *mut *mut ISynchronize, + ) -> HRESULT, + fn AddSynchronize( + pSync: *mut ISynchronize, + ) -> HRESULT, +}} +pub type LPADDRTRACKINGCONTROL = *mut IAddrTrackingControl; +RIDL!{#[uuid(0x00000147, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IAddrTrackingControl(IAddrTrackingControlVtbl): IUnknown(IUnknownVtbl) { + fn EnableCOMDynamicAddrTracking() -> HRESULT, + fn DisableCOMDynamicAddrTracking() -> HRESULT, +}} +pub type LPADDREXCLUSIONCONTROL = *mut IAddrExclusionControl; +RIDL!{#[uuid(0x00000148, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IAddrExclusionControl(IAddrExclusionControlVtbl): IUnknown(IUnknownVtbl) { + fn GetCurrentAddrExclusionList( + riid: REFIID, + ppEnumerator: *mut *mut c_void, + ) -> HRESULT, + fn UpdateAddrExclusionList( + pEnumerator: *mut IUnknown, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xdb2f3aca, 0x2f86, 0x11d1, 0x8e, 0x04, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0x9a)] +interface IPipeByte(IPipeByteVtbl): IUnknown(IUnknownVtbl) { + fn Pull( + buf: *mut BYTE, + cRequest: ULONG, + pcReturned: *mut ULONG, + ) -> HRESULT, + fn Push( + buf: *mut BYTE, + cSent: ULONG, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xdb2f3acb, 0x2f86, 0x11d1, 0x8e, 0x04, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0x9a)] +interface AsyncIPipeByte(AsyncIPipeByteVtbl): IUnknown(IUnknownVtbl) { + fn Begin_Pull( + cRequest: ULONG, + ) -> HRESULT, + fn Finish_Pull( + buf: *mut BYTE, + pcReturned: *mut ULONG, + ) -> HRESULT, + fn Begin_Push( + buf: *mut BYTE, + cSent: ULONG, + ) -> HRESULT, + fn Finish_Push() -> HRESULT, +}} +RIDL!{#[uuid(0xdb2f3acc, 0x2f86, 0x11d1, 0x8e, 0x04, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0x9a)] +interface IPipeLong(IPipeLongVtbl): IUnknown(IUnknownVtbl) { + fn Pull( + buf: *mut LONG, + cRequest: ULONG, + pcReturned: *mut ULONG, + ) -> HRESULT, + fn Push( + buf: *mut LONG, + cSent: ULONG, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xdb2f3acd, 0x2f86, 0x11d1, 0x8e, 0x04, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0x9a)] +interface AsyncIPipeLong(AsyncIPipeLongVtbl): IUnknown(IUnknownVtbl) { + fn Begin_Pull( + cRequest: ULONG, + ) -> HRESULT, + fn Finish_Pull( + buf: *mut LONG, + pcReturned: *mut ULONG, + ) -> HRESULT, + fn Begin_Push( + buf: *mut LONG, + cSent: ULONG, + ) -> HRESULT, + fn Finish_Push() -> HRESULT, +}} +RIDL!{#[uuid(0xdb2f3ace, 0x2f86, 0x11d1, 0x8e, 0x04, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0x9a)] +interface IPipeDouble(IPipeDoubleVtbl): IUnknown(IUnknownVtbl) { + fn Pull( + buf: *mut DOUBLE, + cRequest: ULONG, + pcReturned: *mut ULONG, + ) -> HRESULT, + fn Push( + buf: *mut DOUBLE, + cSent: ULONG, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xdb2f3acf, 0x2f86, 0x11d1, 0x8e, 0x04, 0x00, 0xc0, 0x4f, 0xb9, 0x98, 0x9a)] +interface AsyncIPipeDouble(AsyncIPipeDoubleVtbl): IUnknown(IUnknownVtbl) { + fn Begin_Pull( + cRequest: ULONG, + ) -> HRESULT, + fn Finish_Pull( + buf: *mut DOUBLE, + pcReturned: *mut ULONG, + ) -> HRESULT, + fn Begin_Push( + buf: *mut DOUBLE, + cSent: ULONG, + ) -> HRESULT, + fn Finish_Push() -> HRESULT, +}} +pub type CPFLAGS = DWORD; +STRUCT!{struct ContextProperty { + policyId: GUID, + flags: CPFLAGS, + pUnk: *mut IUnknown, +}} +pub type LPENUMCONTEXTPROPS = *mut IEnumContextProps; +RIDL!{#[uuid(0x000001c1, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IEnumContextProps(IEnumContextPropsVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + pContextProperties: *mut ContextProperty, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppEnumContextProps: *mut *mut IEnumContextProps, + ) -> HRESULT, + fn Count( + pcelt: *mut ULONG, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x000001c0, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IContext(IContextVtbl): IUnknown(IUnknownVtbl) { + fn SetProperty( + rpolicyId: REFGUID, + flags: CPFLAGS, + pUnk: *mut IUnknown, + ) -> HRESULT, + fn RemoveProperty( + rPolicyId: REFGUID, + ) -> HRESULT, + fn GetProperty( + policyId: REFGUID, + pFlags: *mut CPFLAGS, + ppUnk: *mut *mut IUnknown, + ) -> HRESULT, + fn EnumContextProps( + ppEnumContextProps: *mut *mut IEnumContextProps, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x000001c6, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IObjContext(IObjContextVtbl): IContext(IContextVtbl) { + fn Reserved1() -> (), + fn Reserved2() -> (), + fn Reserved3() -> (), + fn Reserved4() -> (), + fn Reserved5() -> (), + fn Reserved6() -> (), + fn Reserved7() -> (), +}} +ENUM!{enum APTTYPEQUALIFIER { + APTTYPEQUALIFIER_NONE = 0, + APTTYPEQUALIFIER_IMPLICIT_MTA = 1, + APTTYPEQUALIFIER_NA_ON_MTA = 2, + APTTYPEQUALIFIER_NA_ON_STA = 3, + APTTYPEQUALIFIER_NA_ON_IMPLICIT_MTA = 4, + APTTYPEQUALIFIER_NA_ON_MAINSTA = 5, + APTTYPEQUALIFIER_APPLICATION_STA= 6, +}} +ENUM!{enum APTTYPE { + APTTYPE_CURRENT = -1i32 as u32, + APTTYPE_STA = 0, + APTTYPE_MTA = 1, + APTTYPE_NA = 2, + APTTYPE_MAINSTA = 3, +}} +ENUM!{enum THDTYPE { + THDTYPE_BLOCKMESSAGES = 0, + THDTYPE_PROCESSMESSAGES = 1, +}} +pub type APARTMENTID = DWORD; +RIDL!{#[uuid(0x000001ce, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IComThreadingInfo(IComThreadingInfoVtbl): IUnknown(IUnknownVtbl) { + fn GetCurrentApartmentType( + pAptType: *mut APTTYPE, + ) -> HRESULT, + fn GetCurrentThreadType( + pThreadType: *mut THDTYPE, + ) -> HRESULT, + fn GetCurrentLogicalThreadId( + pguidLogicalThreadId: *mut GUID, + ) -> HRESULT, + fn SetCurrentLogicalThreadId( + rguid: REFGUID, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x72380d55, 0x8d2b, 0x43a3, 0x85, 0x13, 0x2b, 0x6e, 0xf3, 0x14, 0x34, 0xe9)] +interface IProcessInitControl(IProcessInitControlVtbl): IUnknown(IUnknownVtbl) { + fn ResetInitializerTimeout( + dwSecondsRemaining: DWORD, + ) -> HRESULT, +}} +RIDL!{#[uuid(0x00000040, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IFastRundown(IFastRundownVtbl): IUnknown(IUnknownVtbl) { +}} +ENUM!{enum CO_MARSHALING_CONTEXT_ATTRIBUTES { + CO_MARSHALING_SOURCE_IS_APP_CONTAINER = 0, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_1 = 0x80000000, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_2 = 0x80000001, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_3 = 0x80000002, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_4 = 0x80000003, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_5 = 0x80000004, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_6 = 0x80000005, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_7 = 0x80000006, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_8 = 0x80000007, + CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_9 = 0x80000008, +}} +RIDL!{#[uuid(0xd8f2f5e6, 0x6102, 0x4863, 0x9f, 0x26, 0x38, 0x9a, 0x46, 0x76, 0xef, 0xde)] +interface IMarshalingStream(IMarshalingStreamVtbl): IStream(IStreamVtbl) { + fn GetMarshalingContextAttribute( + attribute: CO_MARSHALING_CONTEXT_ATTRIBUTES, + pAttributeValue: *mut ULONG_PTR, + ) -> HRESULT, +}} +RIDL!{#[uuid(0xc03f6a43, 0x65a4, 0x9818, 0x98, 0x7e, 0xe0, 0xb8, 0x10, 0xd2, 0xa6, 0xf2)] +interface IAgileReference(IAgileReferenceVtbl): IUnknown(IUnknownVtbl) { + fn Resolve( + riid: REFIID, + ppvObjectReference: *mut *mut c_void, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/ocidl.rs b/src/vendor/winapi/src/um/ocidl.rs new file mode 100644 index 0000000000..022e9c0286 --- /dev/null +++ b/src/vendor/winapi/src/um/ocidl.rs @@ -0,0 +1,62 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +// TODO:It is a minimal implementation. +use shared::guiddef::CLSID; +use shared::minwindef::{DWORD, ULONG}; +use shared::ntdef::HRESULT; +use shared::wtypes::{CLIPFORMAT, VARTYPE}; +use shared::wtypesbase::{LPCOLESTR, LPOLESTR}; +use um::oaidl::{IErrorLog, VARIANT}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +ENUM!{enum PROPBAG2_TYPE { + PROPBAG2_TYPE_UNDEFINED = 0, + PROPBAG2_TYPE_DATA = 1, + PROPBAG2_TYPE_URL = 2, + PROPBAG2_TYPE_OBJECT = 3, + PROPBAG2_TYPE_STREAM = 4, + PROPBAG2_TYPE_STORAGE = 5, + PROPBAG2_TYPE_MONIKER = 6, +}} +STRUCT!{struct PROPBAG2 { + dwType: DWORD, + vt: VARTYPE, + cfType: CLIPFORMAT, + dwHint: DWORD, + pstrName: LPOLESTR, + clsid: CLSID, +}} +RIDL!(#[uuid(0x22f55882, 0x280b, 0x11d0, 0xa8, 0xa9, 0x00, 0xa0, 0xc9, 0x0c, 0x20, 0x04)] +interface IPropertyBag2(IPropertyBag2Vtbl): IUnknown(IUnknownVtbl) { + fn Read( + cProperties: ULONG, + pPropBag: *const PROPBAG2, + pErrLog: *const IErrorLog, + pvarValue: *mut VARIANT, + phrError: *mut HRESULT, + ) -> HRESULT, + fn Write( + cProperties: ULONG, + pPropBag: *const PROPBAG2, + pvarValue: *const VARIANT, + ) -> HRESULT, + fn CountProperties( + pcProperties: *mut ULONG, + ) -> HRESULT, + fn GetPropertyInfo( + iProperty: ULONG, + cProperties: ULONG, + pPropBag: *mut PROPBAG2, + pcProperties: *mut ULONG, + ) -> HRESULT, + fn LoadObject( + pstrName: LPCOLESTR, + dwHint: DWORD, + pUnkObject: *const IUnknown, + pErrLog: *const IErrorLog, + ) -> HRESULT, +}); +pub type LPPROPERTYBAG2 = *mut IPropertyBag2; diff --git a/src/vendor/winapi/src/um/oleauto.rs b/src/vendor/winapi/src/um/oleauto.rs new file mode 100644 index 0000000000..3af9707d4b --- /dev/null +++ b/src/vendor/winapi/src/um/oleauto.rs @@ -0,0 +1,812 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of OleAuto.h +use ctypes::{c_double, c_float, c_int, c_uint, c_void}; +use shared::basetsd::{LONG64, ULONG64}; +use shared::minwindef::{BYTE, DWORD, FLOAT, UINT, ULONG, USHORT, WORD}; +use shared::wtypes::{BSTR, DATE, DECIMAL, LPBSTR, LPDECIMAL, VARTYPE}; +use shared::wtypesbase::{DOUBLE, LPCOLESTR, LPOLESTR, OLECHAR}; +use um::minwinbase::LPSYSTEMTIME; +use um::oaidl::{DISPID_UNKNOWN, ITypeLib, VARIANT, VARIANTARG}; +use um::winnt::{CHAR, HRESULT, INT, LCID, LONG, LPCSTR, SHORT}; +extern "system" { + pub fn SysAllocString( + psz: *const OLECHAR, + ) -> BSTR; + pub fn SysReAllocString( + pbstr: *mut BSTR, + psz: *const OLECHAR, + ) -> INT; + pub fn SysAllocStringLen( + strIn: *const OLECHAR, + ui: UINT, + ) -> BSTR; + pub fn SysReAllocStringLen( + pbstr: *mut BSTR, + psz: *const OLECHAR, + len: c_uint, + ) -> INT; + pub fn SysFreeString( + bstrString: BSTR, + ); + pub fn SysStringLen( + pbstr: BSTR, + ) -> UINT; + pub fn SysStringByteLen( + bstr: BSTR, + ) -> UINT; + pub fn SysAllocStringByteLen( + psz: LPCSTR, + len: UINT, + ) -> BSTR; + pub fn DosDateTimeToVariantTime( + wDosDate: USHORT, + wDosTime: USHORT, + pvtime: *mut DOUBLE, + ) -> INT; + pub fn VariantTimeToDosDateTime( + vtime: DOUBLE, + pwDosDate: *mut USHORT, + pwDosTime: *mut USHORT, + ) -> INT; + pub fn SystemTimeToVariantTime( + lpSystemTime: LPSYSTEMTIME, + pvtime: *mut DOUBLE, + ) -> INT; + pub fn VariantTimeToSystemTime( + vtime: DOUBLE, + lpSystemTime: LPSYSTEMTIME, + ) -> INT; + pub fn VariantInit( + pvarg: *mut VARIANTARG, + ); + pub fn VariantClear( + pvarg: *mut VARIANTARG, + ) -> HRESULT; + pub fn VariantCopy( + pvargDest: *mut VARIANTARG, + pvargSrc: *const VARIANTARG, + ) -> HRESULT; + pub fn VariantCopyInd( + pvarDest: *mut VARIANT, + pvargSrc: *const VARIANTARG, + ) -> HRESULT; + pub fn VariantChangeType( + pvargDest: *mut VARIANTARG, + pvarSrc: *const VARIANTARG, + wFlags: USHORT, + vt: VARTYPE, + ) -> HRESULT; + pub fn VariantChangeTypeEx( + pvargDest: *mut VARIANTARG, + pvarSrc: *const VARIANTARG, + lcid: LCID, + wFlags: USHORT, + vt: VARTYPE, + ) -> HRESULT; + pub fn VarUI1FromI2( + sIn: SHORT, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromI4( + lIn: LONG, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromI8( + i64In: LONG64, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromR4( + fltIn: FLOAT, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromR8( + dblIn: DOUBLE, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromDate( + dateIn: DATE, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromI1( + cIn: CHAR, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromUI2( + uiIn: USHORT, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromUI4( + ulIn: ULONG, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromUI8( + ui64In: ULONG64, + pbOut: *mut BYTE, + ); + pub fn VarUI1FromDec( + pdecIn: *const DECIMAL, + pbOut: *mut BYTE, + ); + pub fn VarI2FromUI1( + bIn: BYTE, + psOut: *mut SHORT, + ); + pub fn VarI2FromI4( + lIn: LONG, + psOut: *mut SHORT, + ); + pub fn VarI2FromI8( + i64In: LONG64, + psOut: *mut SHORT, + ); + pub fn VarI2FromR4( + fltIn: FLOAT, + psOut: *mut SHORT, + ); + pub fn VarI2FromR8( + dblIn: DOUBLE, + psOut: *mut SHORT, + ); + pub fn VarI2FromDate( + dateIn: DATE, + psOut: *mut SHORT, + ); + pub fn VarI2FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + psOut: *mut SHORT, + ); + pub fn VarI2FromI1( + cIn: CHAR, + psOut: *mut SHORT, + ); + pub fn VarI2FromUI2( + uiIn: USHORT, + psOut: *mut SHORT, + ); + pub fn VarI2FromUI4( + ulIn: ULONG, + psOut: *mut SHORT, + ); + pub fn VarI2FromUI8( + ui64In: ULONG64, + psOut: *mut SHORT, + ); + pub fn VarI2FromDec( + pdecIn: *const DECIMAL, + psOut: *mut SHORT, + ); + pub fn VarI4FromUI1( + bIn: BYTE, + plOut: *mut LONG, + ); + pub fn VarI4FromI2( + sIn: SHORT, + plOut: *mut LONG, + ); + pub fn VarI4FromI8( + i64In: LONG64, + plOut: *mut LONG, + ); + pub fn VarI4FromR4( + fltIn: FLOAT, + plOut: *mut LONG, + ); + pub fn VarI4FromR8( + dblIn: DOUBLE, + plOut: *mut LONG, + ); + pub fn VarI4FromDate( + dateIn: DATE, + plOut: *mut LONG, + ); + pub fn VarI4FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + plOut: *mut LONG, + ); + pub fn VarI4FromI1( + cIn: CHAR, + plOut: *mut LONG, + ); + pub fn VarI4FromUI2( + uiIn: USHORT, + plOut: *mut LONG, + ); + pub fn VarI4FromUI4( + ulIn: ULONG, + plOut: *mut LONG, + ); + pub fn VarI4FromUI8( + ui64In: ULONG64, + plOut: *mut LONG, + ); + pub fn VarI4FromDec( + pdecIn: *const DECIMAL, + plOut: *mut LONG, + ); + pub fn VarI8FromUI1( + bIn: BYTE, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromI2( + sIn: SHORT, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromR4( + fltIn: FLOAT, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromR8( + dblIn: DOUBLE, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromDate( + dateIn: DATE, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromI1( + cIn: CHAR, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromUI2( + uiIn: USHORT, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromUI4( + ulIn: ULONG, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromUI8( + ui64In: ULONG64, + pi64Out: *mut LONG64, + ); + pub fn VarI8FromDec( + pdecIn: *const DECIMAL, + pi64Out: *mut LONG64, + ); + pub fn VarR4FromUI1( + bIn: BYTE, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromI2( + sIn: SHORT, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromI4( + lIn: LONG, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromI8( + i64In: LONG64, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromR8( + dblIn: DOUBLE, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromDate( + dateIn: DATE, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromI1( + cIn: CHAR, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromUI2( + uiIn: USHORT, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromUI4( + ulIn: ULONG, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromUI8( + ui64In: ULONG64, + pfltOut: *mut FLOAT, + ); + pub fn VarR4FromDec( + pdecIn: *const DECIMAL, + pfltOut: *mut FLOAT, + ); + pub fn VarR8FromUI1( + bIn: BYTE, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromI2( + sIn: SHORT, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromI4( + lIn: LONG, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromI8( + i64In: LONG64, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromR4( + fltIn: FLOAT, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromDate( + dateIn: DATE, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromI1( + cIn: CHAR, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromUI2( + uiIn: USHORT, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromUI4( + ulIn: ULONG, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromUI8( + ui64In: ULONG64, + pdblOut: *mut DOUBLE, + ); + pub fn VarR8FromDec( + pdecIn: *const DECIMAL, + pdblOut: *mut DOUBLE, + ); + pub fn VarDateFromUI1( + bIn: BYTE, + pdateOut: *mut DATE, + ); + pub fn VarDateFromI2( + sIn: SHORT, + pdateOut: *mut DATE, + ); + pub fn VarDateFromI4( + lIn: LONG, + pdateOut: *mut DATE, + ); + pub fn VarDateFromI8( + i64In: LONG64, + pdateOut: *mut DATE, + ); + pub fn VarDateFromR4( + fltIn: FLOAT, + pdateOut: *mut DATE, + ); + pub fn VarDateFromR8( + dblIn: DOUBLE, + pdateOut: *mut DATE, + ); + pub fn VarDateFromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pdateOut: *mut DATE, + ); + pub fn VarDateFromI1( + cIn: CHAR, + pdateOut: *mut DATE, + ); + pub fn VarDateFromUI2( + uiIn: USHORT, + pdateOut: *mut DATE, + ); + pub fn VarDateFromUI4( + ulIn: ULONG, + pdateOut: *mut DATE, + ); + pub fn VarDateFromUI8( + ui64In: ULONG64, + pdateOut: *mut DATE, + ); + pub fn VarDateFromDec( + pdecIn: *const DECIMAL, + pdateOut: *mut DATE, + ); + pub fn VarBstrFromUI1( + bVal: BYTE, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromI2( + iVal: SHORT, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromI4( + lIn: LONG, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromI8( + i64In: LONG64, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromR4( + fltIn: FLOAT, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromR8( + dblIn: DOUBLE, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromDate( + dateIn: DATE, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromI1( + cIn: CHAR, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromUI2( + uiIn: USHORT, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromUI4( + ulIn: ULONG, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromUI8( + ui64In: ULONG64, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarBstrFromDec( + pdecIn: *const DECIMAL, + lcid: LCID, + dwFlags: ULONG, + pbstrOut: *mut BSTR, + ); + pub fn VarUI2FromUI1( + bIn: BYTE, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromI2( + uiIn: SHORT, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromI4( + lIn: LONG, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromI8( + i64In: LONG64, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromR4( + fltIn: FLOAT, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromR8( + dblIn: DOUBLE, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromDate( + dateIn: DATE, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromI1( + cIn: CHAR, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromUI4( + ulIn: ULONG, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromUI8( + i64In: ULONG64, + puiOut: *mut USHORT, + ); + pub fn VarUI2FromDec( + pdecIn: *const DECIMAL, + puiOut: *mut USHORT, + ); + pub fn VarUI4FromUI1( + bIn: BYTE, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromI2( + uiIn: SHORT, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromI4( + lIn: LONG, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromI8( + i64In: LONG64, + plOut: *mut ULONG, + ); + pub fn VarUI4FromR4( + fltIn: FLOAT, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromR8( + dblIn: DOUBLE, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromDate( + dateIn: DATE, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromI1( + cIn: CHAR, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromUI2( + uiIn: USHORT, + pulOut: *mut ULONG, + ); + pub fn VarUI4FromUI8( + ui64In: ULONG64, + plOut: *mut ULONG, + ); + pub fn VarUI4FromDec( + pdecIn: *const DECIMAL, + pulOut: *mut ULONG, + ); + pub fn VarUI8FromUI1( + bIn: BYTE, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromI2( + sIn: SHORT, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromI4( + lIn: LONG, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromI8( + ui64In: LONG64, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromR4( + fltIn: FLOAT, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromR8( + dblIn: DOUBLE, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromDate( + dateIn: DATE, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromI1( + cIn: CHAR, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromUI2( + uiIn: USHORT, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromUI4( + ulIn: ULONG, + pi64Out: *mut ULONG64, + ); + pub fn VarUI8FromDec( + pdecIn: *const DECIMAL, + pi64Out: *mut ULONG64, + ); + pub fn VarDecFromUI1( + bIn: BYTE, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromI2( + uiIn: SHORT, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromI4( + lIn: LONG, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromI8( + i64In: LONG64, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromR4( + fltIn: FLOAT, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromR8( + dblIn: DOUBLE, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromDate( + dateIn: DATE, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromStr( + strIn: LPCOLESTR, + lcid: LCID, + dwFlags: ULONG, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromI1( + cIn: CHAR, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromUI2( + uiIn: USHORT, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromUI4( + ulIn: ULONG, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecFromUI8( + ui64In: ULONG64, + pdecOut: *mut DECIMAL, + ); + pub fn VarDecAdd( + pdecLeft: LPDECIMAL, + pdecRight: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecDiv( + pdecLeft: LPDECIMAL, + pdecRight: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecMul( + pdecLeft: LPDECIMAL, + pdecRight: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecSub( + pdecLeft: LPDECIMAL, + pdecRight: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecAbs( + pdecIn: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecFix( + pdecIn: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecInt( + pdecIn: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecNeg( + pdecIn: LPDECIMAL, + pdecResult: LPDECIMAL, + ); + pub fn VarDecRound( + pdecIn: LPDECIMAL, + cDecimals: c_int, + pdecResult: LPDECIMAL, + ); + pub fn VarDecCmp( + pdecLeft: LPDECIMAL, + pdecRight: LPDECIMAL, + ); + pub fn VarDecCmpR8( + pdecLeft: LPDECIMAL, + dblRight: c_double, + ); + pub fn VarBstrCat( + bstrLeft: BSTR, + bstrRight: BSTR, + pbstrResult: LPBSTR, + ); + pub fn VarBstrCmp( + bstrLeft: BSTR, + bstrRight: BSTR, + lcid: LCID, + dwFlags: ULONG, + ); + pub fn VarR8Pow( + dblLeft: c_double, + dblRight: c_double, + pdblResult: *mut c_double, + ); + pub fn VarR4CmpR8( + fltLeft: c_float, + dblRight: c_double, + ); + pub fn VarR8Round( + dblIn: c_double, + cDecimals: c_int, + pdblResult: *mut c_double, + ); + pub fn GetAltMonthNames( + lcid: LCID, + prgp: *mut LPOLESTR, + ); +} +pub type DISPID = LONG; +pub type MEMBERID = DISPID; +pub const MEMBERID_NIL: MEMBERID = DISPID_UNKNOWN; +pub const DISPATCH_METHOD: WORD = 0x1; +pub const DISPATCH_PROPERTYGET: WORD = 0x2; +pub const DISPATCH_PROPERTYPUT: WORD = 0x4; +pub const DISPATCH_PROPERTYPUTREF: WORD = 0x8; +ENUM!{enum REGKIND { + REGKIND_DEFAULT = 0, + REGKIND_REGISTER, + REGKIND_NONE, +}} +extern "system" { + pub fn LoadTypeLibEx( + szFile: LPCOLESTR, + regkind: REGKIND, + pptlib: *mut *mut ITypeLib, + ) -> HRESULT; + pub fn RevokeActiveObject( + dwRegister: DWORD, + pvReserved: *mut c_void, + ); + pub fn OaBuildVersion() -> ULONG; + pub fn OaEnablePerUserTLibRegistration(); +} diff --git a/src/vendor/winapi/src/um/olectl.rs b/src/vendor/winapi/src/um/olectl.rs new file mode 100644 index 0000000000..50a8da45c3 --- /dev/null +++ b/src/vendor/winapi/src/um/olectl.rs @@ -0,0 +1,15 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! OLE Control interfaces +use shared::winerror::{FACILITY_ITF, SEVERITY_ERROR, SEVERITY_SUCCESS}; +use um::winnt::HRESULT; +pub const SELFREG_E_FIRST: HRESULT = MAKE_SCODE!(SEVERITY_ERROR, FACILITY_ITF, 0x0200); +pub const SELFREG_E_LAST: HRESULT = MAKE_SCODE!(SEVERITY_ERROR, FACILITY_ITF, 0x020F); +pub const SELFREG_S_FIRST: HRESULT = MAKE_SCODE!(SEVERITY_SUCCESS, FACILITY_ITF, 0x0200); +pub const SELFREG_S_LAST: HRESULT = MAKE_SCODE!(SEVERITY_SUCCESS, FACILITY_ITF, 0x020F); +pub const SELFREG_E_TYPELIB: HRESULT = SELFREG_E_FIRST + 0; +pub const SELFREG_E_CLASS: HRESULT = SELFREG_E_FIRST + 1; diff --git a/src/vendor/winapi/src/um/pdh.rs b/src/vendor/winapi/src/um/pdh.rs new file mode 100644 index 0000000000..2a23080641 --- /dev/null +++ b/src/vendor/winapi/src/um/pdh.rs @@ -0,0 +1,807 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Common Performance Data Helper definitions +use ctypes::c_double; +use shared::basetsd::DWORD_PTR; +use shared::guiddef::GUID; +use shared::minwindef::{BOOL, DWORD, FILETIME, LPDWORD, UCHAR}; +use shared::windef::HWND; +use um::winnt::{BOOLEAN, HANDLE, LONG, LONGLONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR}; +pub const PDH_FMT_RAW: DWORD = 0x00000010; +pub const PDH_FMT_ANSI: DWORD = 0x00000020; +pub const PDH_FMT_UNICODE: DWORD = 0x00000040; +pub const PDH_FMT_LONG: DWORD = 0x00000100; +pub const PDH_FMT_DOUBLE: DWORD = 0x00000200; +pub const PDH_FMT_LARGE: DWORD = 0x00000400; +pub const PDH_FMT_NOSCALE: DWORD = 0x00001000; +pub const PDH_FMT_1000: DWORD = 0x00002000; +pub const PDH_FMT_NODATA: DWORD = 0x00004000; +pub const PDH_FMT_NOCAP100: DWORD = 0x00008000; +pub const PERF_DETAIL_COSTLY: DWORD = 0x00010000; +pub const PERF_DETAIL_STANDARD: DWORD = 0x0000FFFF; +pub type PDH_STATUS = LONG; +pub type PDH_HQUERY = HANDLE; +pub type HQUERY = PDH_HQUERY; +pub type PDH_HCOUNTER = HANDLE; +pub type HCOUNTER = PDH_HCOUNTER; +pub type PPDH_BROWSE_DLG_CONFIG_A = *mut PDH_BROWSE_DLG_CONFIG_A; +pub type PPDH_BROWSE_DLG_CONFIG_W = *mut PDH_BROWSE_DLG_CONFIG_W; +pub type PDH_HLOG = HANDLE; +pub type PPDH_RAW_LOG_RECORD = *mut PDH_RAW_LOG_RECORD; +pub type PPDH_TIME_INFO = *mut PDH_TIME_INFO; +pub type PPDH_RAW_COUNTER = *mut PDH_RAW_COUNTER; +pub type PPDH_COUNTER_INFO_A = *mut PDH_COUNTER_INFO_A; +pub type PPDH_COUNTER_INFO_W = *mut PDH_COUNTER_INFO_W; +pub type PPDH_STATISTICS = *mut PDH_STATISTICS; +pub type PPDH_FMT_COUNTERVALUE_ITEM_A = *mut PDH_FMT_COUNTERVALUE_ITEM_A; +pub type PPDH_FMT_COUNTERVALUE_ITEM_W = *mut PDH_FMT_COUNTERVALUE_ITEM_W; +pub type PPDH_DATA_ITEM_PATH_ELEMENTS_A = *mut PDH_DATA_ITEM_PATH_ELEMENTS_A; +pub type PPDH_DATA_ITEM_PATH_ELEMENTS_W = *mut PDH_DATA_ITEM_PATH_ELEMENTS_W; +pub type PPDH_FMT_COUNTERVALUE = *mut PDH_FMT_COUNTERVALUE; +FN!{stdcall CounterPathCallBack( + DWORD_PTR, +) -> PDH_STATUS} +pub type PPDH_COUNTER_PATH_ELEMENTS_A = *mut PDH_COUNTER_PATH_ELEMENTS_A; +pub type PPDH_COUNTER_PATH_ELEMENTS_W = *mut PDH_COUNTER_PATH_ELEMENTS_W; +pub type PPDH_BROWSE_DLG_CONFIG_HA = *mut PDH_BROWSE_DLG_CONFIG_HA; +pub type PPDH_BROWSE_DLG_CONFIG_HW = *mut PDH_BROWSE_DLG_CONFIG_HW; +UNION!{union PDH_FMT_COUNTERVALUE_u { + [u64; 1], + longValue longValue_mut: LONG, + doubleValue doubleValue_mut: c_double, + largeValue largeValue_mut: LONGLONG, + AnsiStringValue AnsiStringValue_mut: LPCSTR, + WideStringValue WideStringValue_mut: LPCWSTR, +}} +STRUCT!{struct PDH_FMT_COUNTERVALUE { + CStatus: DWORD, + u: PDH_FMT_COUNTERVALUE_u, +}} +STRUCT!{struct PDH_RAW_LOG_RECORD { + dwStructureSize: DWORD, + dwRecordType: DWORD, + dwItems: DWORD, + RawBytes: UCHAR, +}} +STRUCT!{struct PDH_TIME_INFO { + StartTime: LONGLONG, + EndTime: LONGLONG, + SampleCount: DWORD, +}} +STRUCT!{struct PDH_RAW_COUNTER { + CStatus: DWORD, + TimeStamp: FILETIME, + FirstValue: LONGLONG, + SecondValue: LONGLONG, + MultiCount: DWORD, +}} +STRUCT!{struct PDH_STATISTICS { + dwFormat: DWORD, + count: DWORD, + min: PDH_FMT_COUNTERVALUE, + max: PDH_FMT_COUNTERVALUE, + mean: PDH_FMT_COUNTERVALUE, +}} +STRUCT!{struct PDH_FMT_COUNTERVALUE_ITEM_A { + szName: LPSTR, + FmtValue: PDH_FMT_COUNTERVALUE, +}} +STRUCT!{struct PDH_FMT_COUNTERVALUE_ITEM_W { + szName: LPWSTR, + FmtValue: PDH_FMT_COUNTERVALUE, +}} +STRUCT!{struct PDH_BROWSE_DLG_CONFIG_A { + flags: DWORD, + hWndOwner: HWND, + szDataSource: LPSTR, + szReturnPathBuffer: LPSTR, + cchReturnPathLength: DWORD, + pCallBack: CounterPathCallBack, + dwCallBackArg: DWORD_PTR, + CallBackStatus: PDH_STATUS, + dwDefaultDetailLevel: DWORD, + szDialogBoxCaption: LPSTR, +}} +BITFIELD!(PDH_BROWSE_DLG_CONFIG_A flags: DWORD [ + IncludeInstanceIndex set_IncludeInstanceIndex[0..1], + SingleCounterPerAdd set_SingleCounterPerAdd[1..2], + SingleCounterPerDialog set_SingleCounterPerDialog[2..3], + LocalCountersOnly set_LocalCountersOnly[3..4], + WildCardInstances set_WildCardInstances[4..5], + HideDetailBox set_HideDetailBox[5..6], + InitializePath set_InitializePath[6..7], + DisableMachineSelection set_DisableMachineSelection[7..8], + IncludeCostlyObjects set_IncludeCostlyObjects[8..9], + ShowObjectBrowser set_ShowObjectBrowser[9..10], +]); +STRUCT!{struct PDH_BROWSE_DLG_CONFIG_W { + flags: DWORD, + hWndOwner: HWND, + szDataSource: LPWSTR, + szReturnPathBuffer: LPWSTR, + cchReturnPathLength: DWORD, + pCallBack: CounterPathCallBack, + dwCallBackArg: DWORD_PTR, + CallBackStatus: PDH_STATUS, + dwDefaultDetailLevel: DWORD, + szDialogBoxCaption: LPWSTR, +}} +BITFIELD!(PDH_BROWSE_DLG_CONFIG_W flags: DWORD [ + IncludeInstanceIndex set_IncludeInstanceIndex[0..1], + SingleCounterPerAdd set_SingleCounterPerAdd[1..2], + SingleCounterPerDialog set_SingleCounterPerDialog[2..3], + LocalCountersOnly set_LocalCountersOnly[3..4], + WildCardInstances set_WildCardInstances[4..5], + HideDetailBox set_HideDetailBox[5..6], + InitializePath set_InitializePath[6..7], + DisableMachineSelection set_DisableMachineSelection[7..8], + IncludeCostlyObjects set_IncludeCostlyObjects[8..9], + ShowObjectBrowser set_ShowObjectBrowser[9..10], +]); +STRUCT!{struct PDH_COUNTER_PATH_ELEMENTS_A { + szMachineName: LPSTR, + szObjectName: LPSTR, + szInstanceName: LPSTR, + szParentInstance: LPSTR, + dwInstanceIndex: DWORD, + szCounterName: LPSTR, +}} +STRUCT!{struct PDH_COUNTER_PATH_ELEMENTS_W { + szMachineName: LPWSTR, + szObjectName: LPWSTR, + szInstanceName: LPWSTR, + szParentInstance: LPWSTR, + dwInstanceIndex: DWORD, + szCounterName: LPWSTR, +}} +STRUCT!{struct PDH_DATA_ITEM_PATH_ELEMENTS_A { + szMachineName: LPSTR, + ObjectGUID: GUID, + dwItemId: DWORD, + szInstanceName: LPSTR, +}} +STRUCT!{struct PDH_DATA_ITEM_PATH_ELEMENTS_W { + szMachineName: LPWSTR, + ObjectGUID: GUID, + dwItemId: DWORD, + szInstanceName: LPWSTR, +}} +STRUCT!{struct PDH_COUNTER_INFO_A_u_s { + szMachineName: LPSTR, + szObjectName: LPSTR, + szInstanceName: LPSTR, + szParentInstance: LPSTR, + dwInstanceIndex: DWORD, + szCounterName: LPSTR, +}} +UNION!{union PDH_COUNTER_INFO_A_u { + [u32; 7] [u64; 6], + DataItemPath DataItemPath_mut: PDH_DATA_ITEM_PATH_ELEMENTS_A, + CounterPath CounterPath_mut: PDH_COUNTER_PATH_ELEMENTS_A, + s s_mut: PDH_COUNTER_INFO_A_u_s, +}} +STRUCT!{struct PDH_COUNTER_INFO_A { + dwLength: DWORD, + dwType: DWORD, + CVersion: DWORD, + CStatus: DWORD, + lScale: LONG, + lDefaultScale: LONG, + dwUserData: DWORD_PTR, + dwQueryUserData: DWORD_PTR, + szFullPath: LPSTR, + u: PDH_COUNTER_INFO_A_u, + szExplainText: LPSTR, + DataBuffer: [DWORD; 1], +}} +STRUCT!{struct PDH_COUNTER_INFO_W_u_s { + szMachineName: LPWSTR, + szObjectName: LPWSTR, + szInstanceName: LPWSTR, + szParentInstance: LPWSTR, + dwInstanceIndex: DWORD, + szCounterName: LPWSTR, +}} +UNION!{union PDH_COUNTER_INFO_W_u { + [u32; 7] [u64; 6], + DataItemPath DataItemPath_mut: PDH_DATA_ITEM_PATH_ELEMENTS_W, + CounterPath CounterPath_mut: PDH_COUNTER_PATH_ELEMENTS_W, + s s_mut: PDH_COUNTER_INFO_W_u_s, +}} +STRUCT!{struct PDH_COUNTER_INFO_W { + dwLength: DWORD, + dwType: DWORD, + CVersion: DWORD, + CStatus: DWORD, + lScale: LONG, + lDefaultScale: LONG, + dwUserData: DWORD_PTR, + dwQueryUserData: DWORD_PTR, + szFullPath: LPWSTR, + u: PDH_COUNTER_INFO_W_u, + szExplainText: LPWSTR, + DataBuffer: [DWORD; 1], +}} +STRUCT!{struct PDH_BROWSE_DLG_CONFIG_HA { + flags: DWORD, + hWndOwner: HWND, + hDataSource: PDH_HLOG, + szReturnPathBuffer: LPSTR, + cchReturnPathLength: DWORD, + pCallBack: CounterPathCallBack, + dwCallBackArg: DWORD_PTR, + CallBackStatus: PDH_STATUS, + dwDefaultDetailLevel: DWORD, + szDialogBoxCaption: LPSTR, +}} +BITFIELD!(PDH_BROWSE_DLG_CONFIG_HA flags: DWORD [ + IncludeInstanceIndex set_IncludeInstanceIndex[0..1], + SingleCounterPerAdd set_SingleCounterPerAdd[1..2], + SingleCounterPerDialog set_SingleCounterPerDialog[2..3], + LocalCountersOnly set_LocalCountersOnly[3..4], + WildCardInstances set_WildCardInstances[4..5], + HideDetailBox set_HideDetailBox[5..6], + InitializePath set_InitializePath[6..7], + DisableMachineSelection set_DisableMachineSelection[7..8], + IncludeCostlyObjects set_IncludeCostlyObjects[8..9], + ShowObjectBrowser set_ShowObjectBrowser[9..10], +]); +STRUCT!{struct PDH_BROWSE_DLG_CONFIG_HW { + flags: DWORD, + hWndOwner: HWND, + hDataSource: PDH_HLOG, + szReturnPathBuffer: LPWSTR, + cchReturnPathLength: DWORD, + pCallBack: CounterPathCallBack, + dwCallBackArg: DWORD_PTR, + CallBackStatus: PDH_STATUS, + dwDefaultDetailLevel: DWORD, + szDialogBoxCaption: LPWSTR, +}} +BITFIELD!(PDH_BROWSE_DLG_CONFIG_HW flags: DWORD [ + IncludeInstanceIndex set_IncludeInstanceIndex[0..1], + SingleCounterPerAdd set_SingleCounterPerAdd[1..2], + SingleCounterPerDialog set_SingleCounterPerDialog[2..3], + LocalCountersOnly set_LocalCountersOnly[3..4], + WildCardInstances set_WildCardInstances[4..5], + HideDetailBox set_HideDetailBox[5..6], + InitializePath set_InitializePath[6..7], + DisableMachineSelection set_DisableMachineSelection[7..8], + IncludeCostlyObjects set_IncludeCostlyObjects[8..9], + ShowObjectBrowser set_ShowObjectBrowser[9..10], +]); +extern "system" { + pub fn PdhGetDllVersion( + lpdwVersion: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhOpenQueryW( + szDataSource: LPCWSTR, + dwUserData: DWORD_PTR, + phQuery: *mut PDH_HQUERY, + ) -> PDH_STATUS; + pub fn PdhOpenQueryA( + szDataSource: LPCSTR, + dwUserData: DWORD_PTR, + phQuery: *mut PDH_HQUERY, + ) -> PDH_STATUS; + pub fn PdhAddCounterW( + hQuery: PDH_HQUERY, + szFullCounterPath: LPCWSTR, + dwUserData: DWORD_PTR, + phCounter: *mut PDH_HCOUNTER, + ) -> PDH_STATUS; + pub fn PdhAddCounterA( + hQuery: PDH_HQUERY, + szFullCounterPath: LPCSTR, + dwUserData: DWORD_PTR, + phCounter: *mut PDH_HCOUNTER, + ) -> PDH_STATUS; + pub fn PdhAddEnglishCounterW( + hQuery: PDH_HQUERY, + szFullCounterPath: LPCWSTR, + dwUserData: DWORD_PTR, + phCounter: *mut PDH_HCOUNTER, + ) -> PDH_STATUS; + pub fn PdhAddEnglishCounterA( + hQuery: PDH_HQUERY, + szFullCounterPath: LPCSTR, + dwUserData: DWORD_PTR, + phCounter: *mut PDH_HCOUNTER, + ) -> PDH_STATUS; + pub fn PdhCollectQueryDataWithTime( + hQuery: PDH_HQUERY, + pllTimeStamp: *mut LONGLONG, + ) -> PDH_STATUS; + pub fn PdhValidatePathExW( + hDataSource: PDH_HLOG, + szFullPathBuffer: LPCWSTR, + ) -> PDH_STATUS; + pub fn PdhValidatePathExA( + hDataSource: PDH_HLOG, + szFullPathBuffer: LPCSTR, + ) -> PDH_STATUS; + pub fn PdhRemoveCounter( + hCounter: PDH_HCOUNTER, + ) -> PDH_STATUS; + pub fn PdhCollectQueryData( + hQuery: PDH_HQUERY, + ) -> PDH_STATUS; + pub fn PdhCloseQuery( + hQuery: PDH_HQUERY, + ) -> PDH_STATUS; + pub fn PdhGetFormattedCounterValue( + hCounter: PDH_HCOUNTER, + dwFormat: DWORD, + lpdwType: LPDWORD, + pValue: PPDH_FMT_COUNTERVALUE, + ) -> PDH_STATUS; + pub fn PdhGetFormattedCounterArrayA( + hCounter: PDH_HCOUNTER, + dwFormat: DWORD, + lpdwBufferSize: LPDWORD, + lpdwBufferCount: LPDWORD, + ItemBuffer: PPDH_FMT_COUNTERVALUE_ITEM_A, + ) -> PDH_STATUS; + pub fn PdhGetFormattedCounterArrayW( + hCounter: PDH_HCOUNTER, + dwFormat: DWORD, + lpdwBufferSize: LPDWORD, + lpdwBufferCount: LPDWORD, + ItemBuffer: PPDH_FMT_COUNTERVALUE_ITEM_W, + ) -> PDH_STATUS; + pub fn PdhGetRawCounterValue( + hCounter: PDH_HCOUNTER, + lpdwType: LPDWORD, + pValue: PPDH_RAW_COUNTER, + ) -> PDH_STATUS; + pub fn PdhGetRawCounterArrayA( + hCounter: PDH_HCOUNTER, + dwFormat: DWORD, + lpdwBufferSize: LPDWORD, + lpdwBufferCount: LPDWORD, + ItemBuffer: PPDH_FMT_COUNTERVALUE_ITEM_A, + ) -> PDH_STATUS; + pub fn PdhGetRawCounterArrayW( + hCounter: PDH_HCOUNTER, + dwFormat: DWORD, + lpdwBufferSize: LPDWORD, + lpdwBufferCount: LPDWORD, + ItemBuffer: PPDH_FMT_COUNTERVALUE_ITEM_W, + ) -> PDH_STATUS; + pub fn PdhCalculateCounterFromRawValue( + hCounter: PDH_HCOUNTER, + dwFormat: DWORD, + rawValue1: PPDH_RAW_COUNTER, + rawValue2: PPDH_RAW_COUNTER, + fmtValue: PPDH_FMT_COUNTERVALUE, + ) -> PDH_STATUS; + pub fn PdhComputeCounterStatistics( + hCounter: PDH_HCOUNTER, + dwFormat: DWORD, + dwFirstEntry: DWORD, + dwNumEntries: DWORD, + lpRawValueArray: PPDH_RAW_COUNTER, + data: PPDH_STATISTICS, + ) -> PDH_STATUS; + pub fn PdhGetCounterInfoW( + hCounter: PDH_HCOUNTER, + bRetrieveExplainText: BOOLEAN, + pdwBufferSize: LPDWORD, + lpBuffer: PPDH_COUNTER_INFO_W, + ) -> PDH_STATUS; + pub fn PdhGetCounterInfoA( + hCounter: PDH_HCOUNTER, + bRetrieveExplainText: BOOLEAN, + pdwBufferSize: LPDWORD, + lpBuffer: PPDH_COUNTER_INFO_A, + ) -> PDH_STATUS; + pub fn PdhSetCounterScaleFactor( + hCounter: PDH_HCOUNTER, + lFactor: LONG, + ) -> PDH_STATUS; + pub fn PdhConnectMachineW( + szMachineName: LPCWSTR, + ) -> PDH_STATUS; + pub fn PdhConnectMachineA( + szMachineName: LPCSTR, + ) -> PDH_STATUS; + pub fn PdhEnumMachinesW( + szDataSource: LPCWSTR, + mszMachineNameList: LPWSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhEnumMachinesA( + szDataSource: LPCSTR, + mszMachineNameList: LPSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhEnumObjectsW( + szDataSource: LPCWSTR, + szMachineName: LPCWSTR, + mszObjectList: LPWSTR, + pcchBufferLength: LPDWORD, + dwDetailLevel: DWORD, + bRefresh: BOOL, + ) -> PDH_STATUS; + pub fn PdhEnumObjectsA( + szDataSource: LPCSTR, + szMachineName: LPCSTR, + mszObjectList: LPSTR, + pcchBufferLength: LPDWORD, + dwDetailLevel: DWORD, + bRefresh: BOOL, + ) -> PDH_STATUS; + pub fn PdhEnumObjectItemsW( + szDataSource: LPCWSTR, + szMachineName: LPCWSTR, + szObjectName: LPCWSTR, + mszCounterList: LPWSTR, + pcchCounterListLength: LPDWORD, + mszInstanceList: LPWSTR, + pcchInstanceListLength: LPDWORD, + dwDetailLevel: DWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhEnumObjectItemsA( + szDataSource: LPCSTR, + szMachineName: LPCSTR, + szObjectName: LPCSTR, + mszCounterList: LPSTR, + pcchCounterListLength: LPDWORD, + mszInstanceList: LPSTR, + pcchInstanceListLength: LPDWORD, + dwDetailLevel: DWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhMakeCounterPathW( + pCounterPathElements: PPDH_COUNTER_PATH_ELEMENTS_W, + szFullPathBuffer: LPWSTR, + pcchBufferSize: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhMakeCounterPathA( + pCounterPathElements: PPDH_COUNTER_PATH_ELEMENTS_A, + szFullPathBuffer: LPSTR, + pcchBufferSize: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhParseCounterPathW( + szFullPathBuffer: LPCWSTR, + pCounterPathElements: *mut PDH_COUNTER_PATH_ELEMENTS_W, + pcchBufferSize: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhParseCounterPathA( + szFullPathBuffer: LPCSTR, + pCounterPathElements: *mut PDH_COUNTER_PATH_ELEMENTS_A, + pcchBufferSize: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhParseInstanceNameW( + szInstanceString: LPCWSTR, + szInstanceName: LPWSTR, + pcchInstanceNameLength: LPDWORD, + szParentName: LPWSTR, + pcchParentNameLength: LPDWORD, + lpIndex: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhParseInstanceNameA( + szInstanceString: LPCSTR, + szInstanceName: LPSTR, + pcchInstanceNameLength: LPDWORD, + szParentName: LPSTR, + pcchParentNameLength: LPDWORD, + lpIndex: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhValidatePathW( + szFullCounterPath: LPCWSTR, + ) -> PDH_STATUS; + pub fn PdhValidatePathA( + szFullCounterPath: LPCSTR, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfObjectW( + szDataSource: LPCWSTR, + szMachineName: LPCWSTR, + szDefaultObjectName: LPWSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfObjectA( + szDataSource: LPCSTR, + szMachineName: LPCSTR, + szDefaultObjectName: LPSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfCounterW( + szDataSource: LPCWSTR, + szMachineName: LPCWSTR, + szObjectName: LPCWSTR, + szDefaultCounterName: LPWSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfCounterA( + szDataSource: LPCSTR, + szMachineName: LPCSTR, + szObjectName: LPCSTR, + szDefaultCounterName: LPSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhBrowseCountersW( + pBrowseDlgData: PPDH_BROWSE_DLG_CONFIG_W, + ) -> PDH_STATUS; + pub fn PdhBrowseCountersA( + pBrowseDlgData: PPDH_BROWSE_DLG_CONFIG_A, + ) -> PDH_STATUS; + pub fn PdhExpandCounterPathW( + szWildCardPath: LPCWSTR, + mszExpandedPathList: LPWSTR, + pcchPathListLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhExpandCounterPathA( + szWildCardPath: LPCSTR, + mszExpandedPathList: LPSTR, + pcchPathListLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhLookupPerfNameByIndexW( + szMachineName: LPCWSTR, + dwNameIndex: DWORD, + szNameBuffer: LPWSTR, + pcchNameBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhLookupPerfNameByIndexA( + szMachineName: LPCSTR, + dwNameIndex: DWORD, + szNameBuffer: LPSTR, + pcchNameBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhLookupPerfIndexByNameW( + szMachineName: LPCWSTR, + szNameBuffer: LPCWSTR, + pdwIndex: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhLookupPerfIndexByNameA( + szMachineName: LPCSTR, + szNameBuffer: LPCSTR, + pdwIndex: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhExpandWildCardPathW( + szDataSource: LPCWSTR, + szWildCardPath: LPCWSTR, + mszExpandedPathList: LPWSTR, + pcchPathListLength: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhExpandWildCardPathA( + szDataSource: LPCSTR, + szWildCardPath: LPCSTR, + mszExpandedPathList: LPSTR, + pcchPathListLength: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhOpenLogW( + szLogFileName: LPCWSTR, + dwAccessFlags: DWORD, + lpdwLogType: LPDWORD, + hQuery: PDH_HQUERY, + dwMaxSize: DWORD, + szUserCaption: LPCWSTR, + phLog: *mut PDH_HLOG, + ) -> PDH_STATUS; + pub fn PdhOpenLogA( + szLogFileName: LPCSTR, + dwAccessFlags: DWORD, + lpdwLogType: LPDWORD, + hQuery: PDH_HQUERY, + dwMaxSize: DWORD, + szUserCaption: LPCSTR, + phLog: *mut PDH_HLOG, + ) -> PDH_STATUS; + pub fn PdhUpdateLogW( + hLog: PDH_HLOG, + szUserString: LPCWSTR, + ) -> PDH_STATUS; + pub fn PdhUpdateLogA( + hLog: PDH_HLOG, + szUserString: LPCSTR, + ) -> PDH_STATUS; + pub fn PdhUpdateLogFileCatalog( + hLog: PDH_HLOG, + ) -> PDH_STATUS; + pub fn PdhGetLogFileSize( + hLog: PDH_HLOG, + llSize: *mut LONGLONG, + ) -> PDH_STATUS; + pub fn PdhCloseLog( + hLog: PDH_HLOG, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhSelectDataSourceW( + hWndOwner: HWND, + dwFlags: DWORD, + szDataSource: LPWSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhSelectDataSourceA( + hWndOwner: HWND, + dwFlags: DWORD, + szDataSource: LPSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhIsRealTimeQuery( + hQuery: PDH_HQUERY, + ) -> PDH_STATUS; + pub fn PdhSetQueryTimeRange( + hQuery: PDH_HQUERY, + pInfo: PPDH_TIME_INFO, + ) -> PDH_STATUS; + pub fn PdhGetDataSourceTimeRangeW( + szDataSource: LPCWSTR, + pdwNumEntries: LPDWORD, + pInfo: PPDH_TIME_INFO, + pdwBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDataSourceTimeRangeA( + szDataSource: LPCSTR, + pdwNumEntries: LPDWORD, + pInfo: PPDH_TIME_INFO, + pdwBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhCollectQueryDataEx( + hQuery: PDH_HQUERY, + dwIntervalTime: DWORD, + hNewDataEvent: HANDLE, + ) -> PDH_STATUS; + pub fn PdhFormatFromRawValue( + dwCounterType: DWORD, + dwFormat: DWORD, + pTimeBase: *mut LONGLONG, + rawValue1: PPDH_RAW_COUNTER, + rawValue2: PPDH_RAW_COUNTER, + fmtValue: PPDH_FMT_COUNTERVALUE, + ) -> PDH_STATUS; + pub fn PdhGetCounterTimeBase( + hCounter: PDH_HCOUNTER, + pTimeBase: *mut LONGLONG, + ) -> PDH_STATUS; + pub fn PdhReadRawLogRecord( + hLog: PDH_HLOG, + ftRecord: FILETIME, + pRawLogRecord: PPDH_RAW_LOG_RECORD, + pdwBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhSetDefaultRealTimeDataSource( + dwDataSourceId: DWORD, + ) -> PDH_STATUS; + pub fn PdhBindInputDataSourceW( + phDataSource: *mut PDH_HLOG, + szLogFileNameList: LPCWSTR, + ) -> PDH_STATUS; + pub fn PdhBindInputDataSourceA( + phDataSource: *mut PDH_HLOG, + szLogFileNameList: LPCSTR, + ) -> PDH_STATUS; + pub fn PdhOpenQueryH( + hDataSource: PDH_HLOG, + dwUserData: DWORD_PTR, + phQuery: *mut PDH_HQUERY, + ) -> PDH_STATUS; + pub fn PdhEnumMachinesHW( + hDataSource: PDH_HLOG, + mszMachineNameList: LPWSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhEnumMachinesHA( + hDataSource: PDH_HLOG, + mszMachineNameList: LPSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhEnumObjectsHW( + hDataSource: PDH_HLOG, + szMachineName: LPCWSTR, + mszObjectList: LPWSTR, + pcchBufferLength: LPDWORD, + dwDetailLevel: DWORD, + bRefresh: BOOL, + ) -> PDH_STATUS; + pub fn PdhEnumObjectsHA( + hDataSource: PDH_HLOG, + szMachineName: LPCSTR, + mszObjectList: LPSTR, + pcchBufferLength: LPDWORD, + dwDetailLevel: DWORD, + bRefresh: BOOL, + ) -> PDH_STATUS; + pub fn PdhEnumObjectItemsHW( + hDataSource: PDH_HLOG, + szMachineName: LPCWSTR, + szObjectName: LPCWSTR, + mszCounterList: LPWSTR, + pcchCounterListLength: LPDWORD, + mszInstanceList: LPWSTR, + pcchInstanceListLength: LPDWORD, + dwDetailLevel: DWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhEnumObjectItemsHA( + hDataSource: PDH_HLOG, + szMachineName: LPCSTR, + szObjectName: LPCSTR, + mszCounterList: LPSTR, + pcchCounterListLength: LPDWORD, + mszInstanceList: LPSTR, + pcchInstanceListLength: LPDWORD, + dwDetailLevel: DWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhExpandWildCardPathHW( + hDataSource: PDH_HLOG, + szWildCardPath: LPCWSTR, + mszExpandedPathList: LPWSTR, + pcchPathListLength: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhExpandWildCardPathHA( + hDataSource: PDH_HLOG, + szWildCardPath: LPCSTR, + mszExpandedPathList: LPSTR, + pcchPathListLength: LPDWORD, + dwFlags: DWORD, + ) -> PDH_STATUS; + pub fn PdhGetDataSourceTimeRangeH( + hDataSource: PDH_HLOG, + pdwNumEntries: LPDWORD, + pInfo: PPDH_TIME_INFO, + pdwBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfObjectHW( + hDataSource: PDH_HLOG, + szMachineName: LPCWSTR, + szDefaultObjectName: LPWSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfObjectHA( + hDataSource: PDH_HLOG, + szMachineName: LPCSTR, + szDefaultObjectName: LPSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfCounterHW( + hDataSource: PDH_HLOG, + szMachineName: LPCWSTR, + szObjectName: LPCWSTR, + szDefaultCounterName: LPWSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhGetDefaultPerfCounterHA( + hDataSource: PDH_HLOG, + szMachineName: LPCSTR, + szObjectName: LPCSTR, + szDefaultCounterName: LPSTR, + pcchBufferSize: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhBrowseCountersHW( + pBrowseDlgData: PPDH_BROWSE_DLG_CONFIG_HW, + ) -> PDH_STATUS; + pub fn PdhBrowseCountersHA( + pBrowseDlgData: PPDH_BROWSE_DLG_CONFIG_HA, + ) -> PDH_STATUS; + pub fn PdhEnumLogSetNamesW( + szDataSource: LPCWSTR, + mszLogSetNameList: LPWSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; + pub fn PdhEnumLogSetNamesA( + szDataSource: LPCSTR, + mszLogSetNameList: LPSTR, + pcchBufferLength: LPDWORD, + ) -> PDH_STATUS; +} +// pub fn PdhVerifySQLDBW() -> PDH_STATUS; +// pub fn PdhVerifySQLDBA() -> PDH_STATUS; +// pub fn PdhCreateSQLTablesW() -> PDH_STATUS; +// pub fn PdhCreateSQLTablesA() -> PDH_STATUS; +//pub fn PdhGetLogSetGUID() -> PDH_STATUS; +// pub fn PdhSetLogSetRunID() -> PDH_STATUS; diff --git a/src/vendor/winapi/src/um/playsoundapi.rs b/src/vendor/winapi/src/um/playsoundapi.rs new file mode 100644 index 0000000000..4fed32f522 --- /dev/null +++ b/src/vendor/winapi/src/um/playsoundapi.rs @@ -0,0 +1,47 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-mm-playsound-l1-1-0 +use shared::minwindef::{BOOL, DWORD, HMODULE, UINT}; +use um::winnt::{LPCSTR, LPCWSTR}; +extern "system" { + pub fn sndPlaySoundA( + pszSound: LPCSTR, + fuSound: UINT, + ) -> BOOL; + pub fn sndPlaySoundW( + pszSound: LPCWSTR, + fuSound: UINT, + ) -> BOOL; +} +pub const SND_SYNC: DWORD = 0x0000; +pub const SND_ASYNC: DWORD = 0x0001; +pub const SND_NODEFAULT: DWORD = 0x0002; +pub const SND_MEMORY: DWORD = 0x0004; +pub const SND_LOOP: DWORD = 0x0008; +pub const SND_NOSTOP: DWORD = 0x0010; +pub const SND_NOWAIT: DWORD = 0x00002000; +pub const SND_ALIAS: DWORD = 0x00010000; +pub const SND_ALIAS_ID: DWORD = 0x00110000; +pub const SND_FILENAME: DWORD = 0x00020000; +pub const SND_RESOURCE: DWORD = 0x00040004; +pub const SND_PURGE: DWORD = 0x0040; +pub const SND_APPLICATION: DWORD = 0x0080; +pub const SND_SENTRY: DWORD = 0x00080000; +pub const SND_RING: DWORD = 0x00100000; +pub const SND_SYSTEM: DWORD = 0x00200000; +extern "system" { + pub fn PlaySoundA( + pszSound: LPCSTR, + hmod: HMODULE, + fdwSound: DWORD, + ) -> BOOL; + pub fn PlaySoundW( + pszSound: LPCWSTR, + hmod: HMODULE, + fdwSound: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/powerbase.rs b/src/vendor/winapi/src/um/powerbase.rs new file mode 100644 index 0000000000..a4ddca9ea6 --- /dev/null +++ b/src/vendor/winapi/src/um/powerbase.rs @@ -0,0 +1,36 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{DWORD, ULONG}; +use um::winnt::{ + BOOLEAN, HANDLE, LONG, POWER_INFORMATION_LEVEL, POWER_PLATFORM_ROLE, + PSYSTEM_POWER_CAPABILITIES, PVOID, +}; +use um::winuser::{HPOWERNOTIFY, PHPOWERNOTIFY}; +pub type NTSTATUS = LONG; +extern "system" { + pub fn CallNtPowerInformation( + InformationLevel: POWER_INFORMATION_LEVEL, + InputBuffer: PVOID, + InputBufferLength: ULONG, + OutputBuffer: PVOID, + OutputBufferLength: ULONG, + ) -> NTSTATUS; + pub fn GetPwrCapabilities( + lpspc: PSYSTEM_POWER_CAPABILITIES, + ) -> BOOLEAN; + pub fn PowerDeterminePlatformRoleEx( + Version: ULONG, + ) -> POWER_PLATFORM_ROLE; + pub fn PowerRegisterSuspendResumeNotification( + Flags: DWORD, + Recipient: HANDLE, + RegistrationHandle: PHPOWERNOTIFY, + ) -> DWORD; + pub fn PowerUnregisterSuspendResumeNotification( + RegistrationHandle: HPOWERNOTIFY, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/powersetting.rs b/src/vendor/winapi/src/um/powersetting.rs new file mode 100644 index 0000000000..1c2aaa6a5e --- /dev/null +++ b/src/vendor/winapi/src/um/powersetting.rs @@ -0,0 +1,61 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::guiddef::{GUID, LPCGUID}; +use shared::minwindef::{DWORD, HKEY, LPBYTE, LPDWORD, PUCHAR, PULONG}; +use um::winnt::{HANDLE}; +use um::winuser::{HPOWERNOTIFY, PHPOWERNOTIFY}; +extern "system" { + pub fn PowerReadACValue( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Type: PULONG, + Buffer: LPBYTE, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadDCValue( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Type: PULONG, + Buffer: PUCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerWriteACValueIndex( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + AcValueIndex: DWORD, + ) -> DWORD; + pub fn PowerWriteDCValueIndex( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + DcValueIndex: DWORD, + ) -> DWORD; + pub fn PowerGetActiveScheme( + UserRootPowerKey: HKEY, + ActivePolicyGuid: *mut *mut GUID, + ) -> DWORD; + pub fn PowerSetActiveScheme( + UserRootPowerKey: HKEY, + SchemeGuid: *const GUID, + ) -> DWORD; + pub fn PowerSettingRegisterNotification( + SettingGuid: LPCGUID, + Flags: DWORD, + Recipient: HANDLE, + RegistrationHandle: PHPOWERNOTIFY, + ) -> DWORD; + pub fn PowerSettingUnregisterNotification( + RegistrationHandle: HPOWERNOTIFY, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/powrprof.rs b/src/vendor/winapi/src/um/powrprof.rs new file mode 100644 index 0000000000..d032be1ca1 --- /dev/null +++ b/src/vendor/winapi/src/um/powrprof.rs @@ -0,0 +1,551 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Interface for powrprof.dll, the power policy applicator +use shared::guiddef::GUID; +use shared::minwindef::{ + BOOL, DWORD, HKEY, LPARAM, LPDWORD, PBYTE, PUCHAR, PUINT, PULONG, UCHAR, UINT, ULONG, +}; +use um::winnt::{ + BOOLEAN, LPCWSTR, LPWSTR, NUM_DISCHARGE_POLICIES, PADMINISTRATOR_POWER_POLICY, + POWER_ACTION_POLICY, POWER_PLATFORM_ROLE, PROCESSOR_POWER_POLICY, PVOID, SYSTEM_POWER_LEVEL, + SYSTEM_POWER_STATE, +}; +use um::winreg::REGSAM; +STRUCT!{struct GLOBAL_MACHINE_POWER_POLICY { + Revision: ULONG, + LidOpenWakeAc: SYSTEM_POWER_STATE, + LidOpenWakeDc: SYSTEM_POWER_STATE, + BroadcastCapacityResolution: ULONG, +}} +pub type PGLOBAL_MACHINE_POWER_POLICY = *mut GLOBAL_MACHINE_POWER_POLICY; +STRUCT!{struct GLOBAL_USER_POWER_POLICY { + Revision: ULONG, + PowerButtonAc: POWER_ACTION_POLICY, + PowerButtonDc: POWER_ACTION_POLICY, + SleepButtonAc: POWER_ACTION_POLICY, + SleepButtonDc: POWER_ACTION_POLICY, + LidCloseAc: POWER_ACTION_POLICY, + LidCloseDc: POWER_ACTION_POLICY, + DischargePolicy: [SYSTEM_POWER_LEVEL; NUM_DISCHARGE_POLICIES], + GlobalFlags: ULONG, +}} +pub type PGLOBAL_USER_POWER_POLICY = *mut GLOBAL_USER_POWER_POLICY; +STRUCT!{struct GLOBAL_POWER_POLICY { + user: GLOBAL_USER_POWER_POLICY, + mach: GLOBAL_MACHINE_POWER_POLICY, +}} +pub type PGLOBAL_POWER_POLICY = *mut GLOBAL_POWER_POLICY; +STRUCT!{struct MACHINE_POWER_POLICY { + Revision: ULONG, + MinSleepAc: SYSTEM_POWER_STATE, + MinSleepDc: SYSTEM_POWER_STATE, + ReducedLatencySleepAc: SYSTEM_POWER_STATE, + ReducedLatencySleepDc: SYSTEM_POWER_STATE, + DozeTimeoutAc: ULONG, + DozeTimeoutDc: ULONG, + DozeS4TimeoutAc: ULONG, + DozeS4TimeoutDc: ULONG, + MinThrottleAc: UCHAR, + MinThrottleDc: UCHAR, + pad1: [UCHAR; 2], + OverThrottledAc: POWER_ACTION_POLICY, + OverThrottledDc: POWER_ACTION_POLICY, +}} +pub type PMACHINE_POWER_POLICY = *mut MACHINE_POWER_POLICY; +STRUCT!{struct MACHINE_PROCESSOR_POWER_POLICY { + Revision: ULONG, + ProcessorPolicyAc: PROCESSOR_POWER_POLICY, + ProcessorPolicyDc: PROCESSOR_POWER_POLICY, +}} +pub type PMACHINE_PROCESSOR_POWER_POLICY = *mut MACHINE_PROCESSOR_POWER_POLICY; +STRUCT!{struct USER_POWER_POLICY { + Revision: ULONG, + IdleAc: POWER_ACTION_POLICY, + IdleDc: POWER_ACTION_POLICY, + IdleTimeoutAc: ULONG, + IdleTimeoutDc: ULONG, + IdleSensitivityAc: UCHAR, + IdleSensitivityDc: UCHAR, + ThrottlePolicyAc: UCHAR, + ThrottlePolicyDc: UCHAR, + MaxSleepAc: SYSTEM_POWER_STATE, + MaxSleepDc: SYSTEM_POWER_STATE, + Reserved: [ULONG; 2], + VideoTimeoutAc: ULONG, + VideoTimeoutDc: ULONG, + SpindownTimeoutAc: ULONG, + SpindownTimeoutDc: ULONG, + OptimizeForPowerAc: BOOLEAN, + OptimizeForPowerDc: BOOLEAN, + FanThrottleToleranceAc: UCHAR, + FanThrottleToleranceDc: UCHAR, + ForcedThrottleAc: UCHAR, + ForcedThrottleDc: UCHAR, +}} +pub type PUSER_POWER_POLICY = *mut USER_POWER_POLICY; +STRUCT!{struct POWER_POLICY { + user: USER_POWER_POLICY, + mach: MACHINE_POWER_POLICY, +}} +pub type PPOWER_POLICY = *mut POWER_POLICY; +pub const EnableSysTrayBatteryMeter: ULONG = 0x01; +pub const EnableMultiBatteryDisplay: ULONG = 0x02; +pub const EnablePasswordLogon: ULONG = 0x04; +pub const EnableWakeOnRing: ULONG = 0x08; +pub const EnableVideoDimDisplay: ULONG = 0x10; +pub const POWER_ATTRIBUTE_HIDE: ULONG = 0x00000001; +pub const POWER_ATTRIBUTE_SHOW_AOAC: ULONG = 0x00000002; +pub const NEWSCHEME: UINT = -1i32 as u32; +FN!{stdcall PWRSCHEMESENUMPROC_V1( + Index: UINT, + NameSize: DWORD, + Name: LPWSTR, + DescriptionSize: DWORD, + Description: LPWSTR, + Policy: PPOWER_POLICY, + Context: LPARAM, +) -> BOOLEAN} +FN!{stdcall PWRSCHEMESENUMPROC_V2( + Index: UINT, + NameSize: DWORD, + Name: LPWSTR, + DescriptionSize: DWORD, + Description: LPWSTR, + Policy: PPOWER_POLICY, + Context: LPARAM, +) -> BOOLEAN} +pub type PWRSCHEMESENUMPROC = *mut PWRSCHEMESENUMPROC_V2; +extern "system" { + pub fn GetPwrDiskSpindownRange( + puiMax: PUINT, + puiMin: PUINT, + ) -> BOOLEAN; + pub fn EnumPwrSchemes( + lpfn: PWRSCHEMESENUMPROC, + lParam: LPARAM, + ) -> BOOLEAN; + pub fn ReadGlobalPwrPolicy( + pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, + ) -> BOOLEAN; + pub fn ReadPwrScheme( + uiID: UINT, + pPowerPolicy: PPOWER_POLICY, + ) -> BOOLEAN; + pub fn WritePwrScheme( + puiID: PUINT, + lpszSchemeName: LPCWSTR, + lpszDescription: LPCWSTR, + lpScheme: PPOWER_POLICY, + ) -> BOOLEAN; + pub fn WriteGlobalPwrPolicy( + pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, + ) -> BOOLEAN; + pub fn DeletePwrScheme( + uiID: UINT, + ) -> BOOLEAN; + pub fn GetActivePwrScheme( + puiID: PUINT, + ) -> BOOLEAN; + pub fn SetActivePwrScheme( + uiID: UINT, + pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, + pPowerPolicy: PPOWER_POLICY, + ) -> BOOLEAN; + pub fn IsPwrSuspendAllowed() -> BOOLEAN; + pub fn IsPwrHibernateAllowed() -> BOOLEAN; + pub fn IsPwrShutdownAllowed() -> BOOLEAN; + pub fn IsAdminOverrideActive( + papp: PADMINISTRATOR_POWER_POLICY, + ) -> BOOLEAN; + pub fn SetSuspendState( + bHibernate: BOOLEAN, + bForce: BOOLEAN, + bWakeupEventsDisabled: BOOLEAN, + ) -> BOOLEAN; + pub fn GetCurrentPowerPolicies( + pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, + pPowerPolicy: PPOWER_POLICY, + ) -> BOOLEAN; + pub fn CanUserWritePwrScheme() -> BOOLEAN; + pub fn ReadProcessorPwrScheme( + uiID: UINT, + pMachineProcessorPowerPolicy: PMACHINE_PROCESSOR_POWER_POLICY, + ) -> BOOLEAN; + pub fn WriteProcessorPwrScheme( + uiID: UINT, + pMachineProcessorPowerPolicy: PMACHINE_PROCESSOR_POWER_POLICY, + ) -> BOOLEAN; + pub fn ValidatePowerPolicies( + pGlobalPowerPolicy: PGLOBAL_POWER_POLICY, + pPowerPolicy: PPOWER_POLICY, + ) -> BOOLEAN; +} +ENUM!{enum POWER_DATA_ACCESSOR { + ACCESS_AC_POWER_SETTING_INDEX = 0, + ACCESS_DC_POWER_SETTING_INDEX, + ACCESS_FRIENDLY_NAME, + ACCESS_DESCRIPTION, + ACCESS_POSSIBLE_POWER_SETTING, + ACCESS_POSSIBLE_POWER_SETTING_FRIENDLY_NAME, + ACCESS_POSSIBLE_POWER_SETTING_DESCRIPTION, + ACCESS_DEFAULT_AC_POWER_SETTING, + ACCESS_DEFAULT_DC_POWER_SETTING, + ACCESS_POSSIBLE_VALUE_MIN, + ACCESS_POSSIBLE_VALUE_MAX, + ACCESS_POSSIBLE_VALUE_INCREMENT, + ACCESS_POSSIBLE_VALUE_UNITS, + ACCESS_ICON_RESOURCE, + ACCESS_DEFAULT_SECURITY_DESCRIPTOR, + ACCESS_ATTRIBUTES, + ACCESS_SCHEME, + ACCESS_SUBGROUP, + ACCESS_INDIVIDUAL_SETTING, + ACCESS_ACTIVE_SCHEME, + ACCESS_CREATE_SCHEME, + ACCESS_AC_POWER_SETTING_MAX, + ACCESS_DC_POWER_SETTING_MAX, + ACCESS_AC_POWER_SETTING_MIN, + ACCESS_DC_POWER_SETTING_MIN, + ACCESS_PROFILE, + ACCESS_OVERLAY_SCHEME, + ACCESS_ACTIVE_OVERLAY_SCHEME, +}} +pub type PPOWER_DATA_ACCESSOR = *mut POWER_DATA_ACCESSOR; +pub const DEVICE_NOTIFY_CALLBACK: ULONG = 2; +FN!{stdcall DEVICE_NOTIFY_CALLBACK_ROUTINE( + Context: PVOID, + Type: ULONG, + Setting: PVOID, +) -> ULONG} +pub type PDEVICE_NOTIFY_CALLBACK_ROUTINE = *mut DEVICE_NOTIFY_CALLBACK_ROUTINE; +STRUCT!{struct DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS { + Callback: PDEVICE_NOTIFY_CALLBACK_ROUTINE, + Context: PVOID, +}} +pub type PDEVICE_NOTIFY_SUBSCRIBE_PARAMETERS = *mut DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS; +extern "system" { + pub fn PowerIsSettingRangeDefined( + SubKeyGuid: *const GUID, + SettingGuid: *const GUID, + ) -> BOOLEAN; + pub fn PowerSettingAccessCheckEx( + AccessFlags: POWER_DATA_ACCESSOR, + PowerGuid: *const GUID, + AccessType: REGSAM, + ) -> DWORD; + pub fn PowerSettingAccessCheck( + AccessFlags: POWER_DATA_ACCESSOR, + PowerGuid: *const GUID, + ) -> DWORD; + pub fn PowerReadACValueIndex( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + AcValueIndex: LPDWORD, + ) -> DWORD; + pub fn PowerReadDCValueIndex( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + DcValueIndex: LPDWORD, + ) -> DWORD; + pub fn PowerReadFriendlyName( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: PUCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadDescription( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: PUCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadPossibleValue( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Type: PULONG, + PossibleSettingIndex: ULONG, + Buffer: PUCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadPossibleFriendlyName( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + PossibleSettingIndex: ULONG, + Buffer: PUCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadPossibleDescription( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + PossibleSettingIndex: ULONG, + Buffer: PUCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadValueMin( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + ValueMinimum: LPDWORD, + ) -> DWORD; + pub fn PowerReadValueMax( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + ValueMaximum: LPDWORD, + ) -> DWORD; + pub fn PowerReadValueIncrement( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + ValueIncrement: LPDWORD, + ) -> DWORD; + pub fn PowerReadValueUnitsSpecifier( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: *mut UCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadACDefaultIndex( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + AcDefaultIndex: LPDWORD, + ) -> DWORD; + pub fn PowerReadDCDefaultIndex( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + DcDefaultIndex: LPDWORD, + ) -> DWORD; + pub fn PowerReadIconResourceSpecifier( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: PUCHAR, + BufferSize: LPDWORD, + ) -> DWORD; + pub fn PowerReadSettingAttributes( + SubGroupGuid: *const GUID, + PowerSettingGuid: *const GUID, + ) -> DWORD; + pub fn PowerWriteFriendlyName( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: *mut UCHAR, + BufferSize: DWORD, + ) -> DWORD; + pub fn PowerWriteDescription( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: *mut UCHAR, + BufferSize: DWORD, + ) -> DWORD; + pub fn PowerWritePossibleValue( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Type: ULONG, + PossibleSettingIndex: ULONG, + Buffer: *mut UCHAR, + BufferSize: DWORD, + ) -> DWORD; + pub fn PowerWritePossibleFriendlyName( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + PossibleSettingIndex: ULONG, + Buffer: *mut UCHAR, + BufferSize: DWORD, + ) -> DWORD; + pub fn PowerWritePossibleDescription( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + PossibleSettingIndex: ULONG, + Buffer: *mut UCHAR, + BufferSize: DWORD, + ) -> DWORD; + pub fn PowerWriteValueMin( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + ValueMinimum: DWORD, + ) -> DWORD; + pub fn PowerWriteValueMax( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + ValueMaximum: DWORD, + ) -> DWORD; + pub fn PowerWriteValueIncrement( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + ValueIncrement: DWORD, + ) -> DWORD; + pub fn PowerWriteValueUnitsSpecifier( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: *mut UCHAR, + BufferSize: DWORD, + ) -> DWORD; + pub fn PowerWriteACDefaultIndex( + RootSystemPowerKey: HKEY, + SchemePersonalityGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + DefaultAcIndex: DWORD, + ) -> DWORD; + pub fn PowerWriteDCDefaultIndex( + RootSystemPowerKey: HKEY, + SchemePersonalityGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + DefaultDcIndex: DWORD, + ) -> DWORD; + pub fn PowerWriteIconResourceSpecifier( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + Buffer: *mut UCHAR, + BufferSize: DWORD, + ) -> DWORD; + pub fn PowerWriteSettingAttributes( + SubGroupGuid: *const GUID, + PowerSettingGuid: *const GUID, + Attributes: DWORD, + ) -> DWORD; + pub fn PowerDuplicateScheme( + RootPowerKey: HKEY, + SourceSchemeGuid: *const GUID, + DestinationSchemeGuid: *mut *mut GUID, + ) -> DWORD; + pub fn PowerImportPowerScheme( + RootPowerKey: HKEY, + ImportFileNamePath: LPCWSTR, + DestinationSchemeGuid: *mut *mut GUID, + ) -> DWORD; + pub fn PowerDeleteScheme( + RootPowerKey: HKEY, + SchemeGuid: *mut GUID, + ) -> DWORD; + pub fn PowerRemovePowerSetting( + PowerSettingSubKeyGuid: *const GUID, + PowerSettingGuid: *const GUID, + ) -> DWORD; + pub fn PowerCreateSetting( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + ) -> DWORD; + pub fn PowerCreatePossibleSetting( + RootPowerKey: HKEY, + SubGroupOfPowerSettingsGuid: *const GUID, + PowerSettingGuid: *const GUID, + PossibleSettingIndex: ULONG, + ) -> DWORD; + pub fn PowerEnumerate( + RootPowerKey: HKEY, + SchemeGuid: *const GUID, + SubGroupOfPowerSettingsGuid: *const GUID, + AccessFlags: POWER_DATA_ACCESSOR, + Index: ULONG, + Buffer: *mut UCHAR, + BufferSize: *mut DWORD, + ) -> DWORD; + pub fn PowerOpenUserPowerKey( + phUserPowerKey: *mut HKEY, + Access: REGSAM, + OpenExisting: BOOL, + ) -> DWORD; + pub fn PowerOpenSystemPowerKey( + phSystemPowerKey: *mut HKEY, + Access: REGSAM, + OpenExisting: BOOL, + ) -> DWORD; + pub fn PowerCanRestoreIndividualDefaultPowerScheme( + SchemeGuid: *const GUID, + ) -> DWORD; + pub fn PowerRestoreIndividualDefaultPowerScheme( + SchemeGuid: *const GUID, + ) -> DWORD; + pub fn PowerRestoreDefaultPowerSchemes() -> DWORD; + pub fn PowerReplaceDefaultPowerSchemes() -> DWORD; + pub fn PowerDeterminePlatformRole() -> POWER_PLATFORM_ROLE; +} +pub const DEVICEPOWER_HARDWAREID: ULONG = 0x80000000; +pub const DEVICEPOWER_AND_OPERATION: ULONG = 0x40000000; +pub const DEVICEPOWER_FILTER_DEVICES_PRESENT: ULONG = 0x20000000; +pub const DEVICEPOWER_FILTER_HARDWARE: ULONG = 0x10000000; +pub const DEVICEPOWER_FILTER_WAKEENABLED: ULONG = 0x08000000; +pub const DEVICEPOWER_FILTER_WAKEPROGRAMMABLE: ULONG = 0x04000000; +pub const DEVICEPOWER_FILTER_ON_NAME: ULONG = 0x02000000; +pub const DEVICEPOWER_SET_WAKEENABLED: ULONG = 0x00000001; +pub const DEVICEPOWER_CLEAR_WAKEENABLED: ULONG = 0x00000002; +pub const PDCAP_S0_SUPPORTED: ULONG = 0x00010000; +pub const PDCAP_S1_SUPPORTED: ULONG = 0x00020000; +pub const PDCAP_S2_SUPPORTED: ULONG = 0x00040000; +pub const PDCAP_S3_SUPPORTED: ULONG = 0x00080000; +pub const PDCAP_WAKE_FROM_S0_SUPPORTED: ULONG = 0x00100000; +pub const PDCAP_WAKE_FROM_S1_SUPPORTED: ULONG = 0x00200000; +pub const PDCAP_WAKE_FROM_S2_SUPPORTED: ULONG = 0x00400000; +pub const PDCAP_WAKE_FROM_S3_SUPPORTED: ULONG = 0x00800000; +pub const PDCAP_S4_SUPPORTED: ULONG = 0x01000000; +pub const PDCAP_S5_SUPPORTED: ULONG = 0x02000000; +extern "system" { + pub fn DevicePowerEnumDevices( + QueryIndex: ULONG, + QueryInterpretationFlags: ULONG, + QueryFlags: ULONG, + pReturnBuffer: PBYTE, + pBufferSize: PULONG, + ) -> BOOLEAN; + pub fn DevicePowerSetDeviceState( + DeviceDescription: LPCWSTR, + SetFlags: ULONG, + SetData: PVOID, + ) -> DWORD; + pub fn DevicePowerOpen( + DebugMask: ULONG, + ) -> BOOLEAN; + pub fn DevicePowerClose() -> BOOLEAN; +} +STRUCT!{struct THERMAL_EVENT { + Version: ULONG, + Size: ULONG, + Type: ULONG, + Temperature: ULONG, + TripPointTemperature: ULONG, + Initiator: LPWSTR, +}} +pub type PTHERMAL_EVENT = *mut THERMAL_EVENT; +extern "system" { + pub fn PowerReportThermalEvent( + Event: PTHERMAL_EVENT, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/processenv.rs b/src/vendor/winapi/src/um/processenv.rs new file mode 100644 index 0000000000..e2dc01d7ef --- /dev/null +++ b/src/vendor/winapi/src/um/processenv.rs @@ -0,0 +1,99 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, DWORD}; +use um::winnt::{HANDLE, LPCH, LPCSTR, LPCWSTR, LPSTR, LPWCH, LPWSTR, PHANDLE}; +extern "system" { + pub fn GetEnvironmentStrings() -> LPCH; + pub fn GetEnvironmentStringsW() -> LPWCH; + pub fn SetEnvironmentStringsW( + NewEnvironment: LPWCH, + ) -> BOOL; + pub fn FreeEnvironmentStringsA( + penv: LPCH, + ) -> BOOL; + pub fn FreeEnvironmentStringsW( + penv: LPWCH, + ) -> BOOL; + pub fn GetStdHandle( + nStdHandle: DWORD, + ) -> HANDLE; + pub fn SetStdHandle( + nStdHandle: DWORD, + hHandle: HANDLE, + ) -> BOOL; + pub fn SetStdHandleEx( + nStdHandle: DWORD, + hHandle: HANDLE, + phPrevValue: PHANDLE, + ) -> BOOL; + pub fn GetCommandLineA() -> LPSTR; + pub fn GetCommandLineW() -> LPWSTR; + pub fn GetEnvironmentVariableA( + lpName: LPCSTR, + lpBuffer: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetEnvironmentVariableW( + lpName: LPCWSTR, + lpBuffer: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn SetEnvironmentVariableA( + lpName: LPCSTR, + lpValue: LPCSTR, + ) -> BOOL; + pub fn SetEnvironmentVariableW( + lpName: LPCWSTR, + lpValue: LPCWSTR, + ) -> BOOL; + pub fn ExpandEnvironmentStringsA( + lpSrc: LPCSTR, + lpDst: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn ExpandEnvironmentStringsW( + lpSrc: LPCWSTR, + lpDst: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn SetCurrentDirectoryA( + lpPathName: LPCSTR, + ) -> BOOL; + pub fn SetCurrentDirectoryW( + lpPathName: LPCWSTR, + ) -> BOOL; + pub fn GetCurrentDirectoryA( + nBufferLength: DWORD, + lpBuffer: LPSTR, + ) -> DWORD; + pub fn GetCurrentDirectoryW( + nBufferLength: DWORD, + lpBuffer: LPWSTR, + ) -> DWORD; + pub fn SearchPathW( + lpPath: LPCWSTR, + lpFileName: LPCWSTR, + lpExtension: LPCWSTR, + nBufferLength: DWORD, + lpBuffer: LPWSTR, + lpFilePart: *mut LPWSTR, + ) -> DWORD; + pub fn SearchPathA( + lpPath: LPCSTR, + lpFileName: LPCSTR, + lpExtension: LPCSTR, + nBufferLength: DWORD, + lpBuffer: LPSTR, + lpFilePart: *mut LPSTR, + ) -> DWORD; + pub fn NeedCurrentDirectoryForExePathA( + ExeName: LPCSTR, + ) -> BOOL; + pub fn NeedCurrentDirectoryForExePathW( + ExeName: LPCWSTR, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/processsnapshot.rs b/src/vendor/winapi/src/um/processsnapshot.rs new file mode 100644 index 0000000000..6026b27a06 --- /dev/null +++ b/src/vendor/winapi/src/um/processsnapshot.rs @@ -0,0 +1,121 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Defines the process snapshot API +use ctypes::c_void; +use shared::basetsd::ULONG_PTR; +use shared::minwindef::DWORD; +use um::winnt::HANDLE; +ENUM!{enum PSS_CAPTURE_FLAGS { + PSS_CAPTURE_NONE = 0x00000000, + PSS_CAPTURE_VA_CLONE = 0x00000001, + PSS_CAPTURE_RESERVED_00000002 = 0x00000002, + PSS_CAPTURE_HANDLES = 0x00000004, + PSS_CAPTURE_HANDLE_NAME_INFORMATION = 0x00000008, + PSS_CAPTURE_HANDLE_BASIC_INFORMATION = 0x00000010, + PSS_CAPTURE_HANDLE_TYPE_SPECIFIC_INFORMATION = 0x00000020, + PSS_CAPTURE_HANDLE_TRACE = 0x00000040, + PSS_CAPTURE_THREADS = 0x00000080, + PSS_CAPTURE_THREAD_CONTEXT = 0x00000100, + PSS_CAPTURE_THREAD_CONTEXT_EXTENDED = 0x00000200, + PSS_CAPTURE_RESERVED_00000400 = 0x00000400, + PSS_CAPTURE_VA_SPACE = 0x00000800, + PSS_CAPTURE_VA_SPACE_SECTION_INFORMATION = 0x00001000, + PSS_CREATE_BREAKAWAY_OPTIONAL = 0x04000000, + PSS_CREATE_BREAKAWAY = 0x08000000, + PSS_CREATE_FORCE_BREAKAWAY = 0x10000000, + PSS_CREATE_USE_VM_ALLOCATIONS = 0x20000000, + PSS_CREATE_MEASURE_PERFORMANCE = 0x40000000, + PSS_CREATE_RELEASE_SECTION = -2147483648i32 as u32, +}} +ENUM!{enum PSS_QUERY_INFORMATION_CLASS { + PSS_QUERY_PROCESS_INFORMATION = 0, + PSS_QUERY_VA_CLONE_INFORMATION = 1, + PSS_QUERY_AUXILIARY_PAGES_INFORMATION = 2, + PSS_QUERY_VA_SPACE_INFORMATION = 3, + PSS_QUERY_HANDLE_INFORMATION = 4, + PSS_QUERY_THREAD_INFORMATION = 5, + PSS_QUERY_HANDLE_TRACE_INFORMATION = 6, + PSS_QUERY_PERFORMANCE_COUNTERS = 7, +}} +ENUM!{enum PSS_WALK_INFORMATION_CLASS { + PSS_WALK_AUXILIARY_PAGES = 0, + PSS_WALK_VA_SPACE = 1, + PSS_WALK_HANDLES = 2, + PSS_WALK_THREADS = 3, +}} +ENUM!{enum PSS_DUPLICATE_FLAGS { + PSS_DUPLICATE_NONE = 0x00, + PSS_DUPLICATE_CLOSE_SOURCE = 0x01, +}} +DECLARE_HANDLE!(HPSS, HPSS__); +DECLARE_HANDLE!(HPSSWALK, HPSSWALK__); +FN!{stdcall pAllocRoutine( + Context: *mut c_void, + Size: DWORD, +) -> *mut c_void} +FN!{stdcall pFreeRoutine( + Context: *mut c_void, + Address: *mut c_void, +) -> ()} +STRUCT!{struct PSS_ALLOCATOR { + Context: *mut c_void, + AllocRoutine: pAllocRoutine, + FreeRoutine: pFreeRoutine, +}} +extern "system" { + pub fn PssCaptureSnapshot( + ProcessHandle: HANDLE, + CaptureFlags: PSS_CAPTURE_FLAGS, + ThreadContextFlags: DWORD, + SnapshotHandle: *mut HPSS, + ) -> DWORD; + pub fn PssDuplicateSnapshot( + SourceProcessHandle: HANDLE, + SnapshotHandle: HPSS, + TargetProcessHandle: HANDLE, + TargetSnapshotHandle: *mut HPSS, + Flags: PSS_DUPLICATE_FLAGS, + ) -> DWORD; + pub fn PssFreeSnapshot( + ProcessHandle: HANDLE, + SnapshotHandle: HPSS + ) -> DWORD; + pub fn PssQuerySnapshot( + SnapshotHandle: HPSS, + InformationClass: PSS_QUERY_INFORMATION_CLASS, + Buffer: *mut c_void, + BufferLength: DWORD, + ) -> DWORD; + pub fn PssWalkMarkerCreate( + Allocator: *const PSS_ALLOCATOR, + WalkMarkerHandle: *mut HPSSWALK, + ) -> DWORD; + pub fn PssWalkMarkerFree( + WalkMarkerHandle: HPSSWALK + ) -> DWORD; + pub fn PssWalkMarkerGetPosition( + WalkMarkerHandle: HPSSWALK, + Position: *mut ULONG_PTR + ) -> DWORD; + // pub fn PssWalkMarkerRewind(); + // pub fn PssWalkMarkerSeek(); + pub fn PssWalkMarkerSeekToBeginning( + WalkMarkerHandle: HPSS + ) -> DWORD; + pub fn PssWalkMarkerSetPosition( + WalkMarkerHandle: HPSSWALK, + Position: ULONG_PTR + ) -> DWORD; + // pub fn PssWalkMarkerTell(); + pub fn PssWalkSnapshot( + SnapshotHandle: HPSS, + InformationClass: PSS_WALK_INFORMATION_CLASS, + WalkMarkerHandle: HPSSWALK, + Buffer: *mut c_void, + BufferLength: DWORD, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/processthreadsapi.rs b/src/vendor/winapi/src/um/processthreadsapi.rs new file mode 100644 index 0000000000..3c0e7761fc --- /dev/null +++ b/src/vendor/winapi/src/um/processthreadsapi.rs @@ -0,0 +1,424 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! ApiSet Contract for api-ms-win-core-processthreads-l1 + +use ctypes::{c_int, c_void}; +use shared::basetsd::{DWORD_PTR, PSIZE_T, PULONG_PTR, SIZE_T, ULONG_PTR}; +use shared::guiddef::LPCGUID; +use shared::minwindef::{ + BOOL, DWORD, LPBYTE, LPCVOID, LPDWORD, LPFILETIME, LPVOID, PBOOL, PDWORD, PULONG, UINT, WORD +}; +use um::minwinbase::{LPCONTEXT, LPSECURITY_ATTRIBUTES, LPTHREAD_START_ROUTINE}; +use um::winnt::{ + CONTEXT, HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PAPCFUNC, PHANDLE, PPROCESSOR_NUMBER, + PROCESS_MITIGATION_POLICY, PVOID +}; + +STRUCT!{struct PROCESS_INFORMATION { + hProcess: HANDLE, + hThread: HANDLE, + dwProcessId: DWORD, + dwThreadId: DWORD, +}} +pub type PPROCESS_INFORMATION = *mut PROCESS_INFORMATION; +pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION; +STRUCT!{struct STARTUPINFOA { + cb: DWORD, + lpReserved: LPSTR, + lpDesktop: LPSTR, + lpTitle: LPSTR, + dwX: DWORD, + dwY: DWORD, + dwXSize: DWORD, + dwYSize: DWORD, + dwXCountChars: DWORD, + dwYCountChars: DWORD, + dwFillAttribute: DWORD, + dwFlags: DWORD, + wShowWindow: WORD, + cbReserved2: WORD, + lpReserved2: LPBYTE, + hStdInput: HANDLE, + hStdOutput: HANDLE, + hStdError: HANDLE, +}} +pub type LPSTARTUPINFOA = *mut STARTUPINFOA; +STRUCT!{struct STARTUPINFOW { + cb: DWORD, + lpReserved: LPWSTR, + lpDesktop: LPWSTR, + lpTitle: LPWSTR, + dwX: DWORD, + dwY: DWORD, + dwXSize: DWORD, + dwYSize: DWORD, + dwXCountChars: DWORD, + dwYCountChars: DWORD, + dwFillAttribute: DWORD, + dwFlags: DWORD, + wShowWindow: WORD, + cbReserved2: WORD, + lpReserved2: LPBYTE, + hStdInput: HANDLE, + hStdOutput: HANDLE, + hStdError: HANDLE, +}} +pub type LPSTARTUPINFOW = *mut STARTUPINFOW; +extern "system" { + pub fn QueueUserAPC( + pfnAPC: PAPCFUNC, + hThread: HANDLE, + dwData: ULONG_PTR, + ) -> DWORD; + pub fn GetProcessTimes( + hProcess: HANDLE, + lpCreationTime: LPFILETIME, + lpExitTime: LPFILETIME, + lpKernelTime: LPFILETIME, + lpUserTime: LPFILETIME, + ) -> BOOL; + pub fn GetCurrentProcess() -> HANDLE; + pub fn GetCurrentProcessId() -> DWORD; + pub fn ExitProcess( + uExitCode: UINT, + ); + pub fn TerminateProcess( + hProcess: HANDLE, + uExitCode: UINT, + ) -> BOOL; + pub fn GetExitCodeProcess( + hProcess: HANDLE, + lpExitCode: LPDWORD, + ) -> BOOL; + pub fn SwitchToThread() -> BOOL; + pub fn CreateThread( + lpThreadAttributes: LPSECURITY_ATTRIBUTES, + dwStackSize: SIZE_T, + lpStartAddress: LPTHREAD_START_ROUTINE, + lpParameter: LPVOID, + dwCreationFlags: DWORD, + lpThreadId: LPDWORD, + ) -> HANDLE; + pub fn CreateRemoteThread( + hProcess: HANDLE, + lpThreadAttributes: LPSECURITY_ATTRIBUTES, + dwStackSize: SIZE_T, + lpStartAddress: LPTHREAD_START_ROUTINE, + lpParameter: LPVOID, + dwCreationFlags: DWORD, + lpThreadId: LPDWORD, + ) -> HANDLE; + pub fn GetCurrentThread() -> HANDLE; + pub fn GetCurrentThreadId() -> DWORD; + pub fn OpenThread( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + dwThreadId: DWORD, + ) -> HANDLE; + pub fn SetThreadPriority( + hThread: HANDLE, + nPriority: c_int, + ) -> BOOL; + pub fn SetThreadPriorityBoost( + hThread: HANDLE, + bDisablePriorityBoost: BOOL, + ) -> BOOL; + pub fn GetThreadPriorityBoost( + hThread: HANDLE, + pDisablePriorityBoost: PBOOL, + ) -> BOOL; + pub fn GetThreadPriority( + hThread: HANDLE, + ) -> c_int; + pub fn ExitThread( + dwExitCode: DWORD, + ); + pub fn TerminateThread( + hThread: HANDLE, + dwExitCode: DWORD, + ) -> BOOL; + pub fn GetExitCodeThread( + hThread: HANDLE, + lpExitCode: LPDWORD, + ) -> BOOL; + pub fn SuspendThread( + hThread: HANDLE, + ) -> DWORD; + pub fn ResumeThread( + hThread: HANDLE, + ) -> DWORD; +} +pub const TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF; +extern "system" { + 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 CreateProcessA( + lpApplicationName: LPCSTR, + lpCommandLine: LPSTR, + lpProcessAttributes: LPSECURITY_ATTRIBUTES, + lpThreadAttributes: LPSECURITY_ATTRIBUTES, + bInheritHandles: BOOL, + dwCreationFlags: DWORD, + lpEnvironment: LPVOID, + lpCurrentDirectory: LPCSTR, + lpStartupInfo: LPSTARTUPINFOA, + lpProcessInformation: LPPROCESS_INFORMATION, + ) -> BOOL; + pub fn CreateProcessW( + lpApplicationName: LPCWSTR, + lpCommandLine: LPWSTR, + lpProcessAttributes: LPSECURITY_ATTRIBUTES, + lpThreadAttributes: LPSECURITY_ATTRIBUTES, + bInheritHandles: BOOL, + dwCreationFlags: DWORD, + lpEnvironment: LPVOID, + lpCurrentDirectory: LPCWSTR, + lpStartupInfo: LPSTARTUPINFOW, + lpProcessInformation: LPPROCESS_INFORMATION, + ) -> BOOL; + pub fn SetProcessShutdownParameters( + dwLevel: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn GetProcessVersion( + ProcessId: DWORD, + ) -> DWORD; + pub fn GetStartupInfoW( + lpStartupInfo: LPSTARTUPINFOW, + ); + // pub fn CreateProcessAsUserW(); + // pub fn GetCurrentProcessToken(); + // pub fn GetCurrentThreadToken(); + // pub fn GetCurrentThreadEffectiveToken(); + // pub fn SetThreadToken(); + pub fn OpenProcessToken( + ProcessHandle: HANDLE, + DesiredAccess: DWORD, + TokenHandle: PHANDLE, + ) -> BOOL; + // pub fn OpenThreadToken(); + pub fn SetPriorityClass( + hProcess: HANDLE, + dwPriorityClass: DWORD, + ) -> BOOL; + pub fn SetThreadStackGuarantee( + StackSizeInBytes: PULONG, + ) -> BOOL; + pub fn GetPriorityClass( + hProcess: HANDLE, + ) -> DWORD; + pub fn ProcessIdToSessionId( + dwProcessId: DWORD, + pSessionId: *mut DWORD, + ) -> BOOL; + pub fn GetProcessId( + Process: HANDLE, + ) -> DWORD; +} +STRUCT!{struct PROC_THREAD_ATTRIBUTE_LIST { + dummy: *mut c_void, +}} +pub type PPROC_THREAD_ATTRIBUTE_LIST = *mut PROC_THREAD_ATTRIBUTE_LIST; +pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut PROC_THREAD_ATTRIBUTE_LIST; +extern "system" { + pub fn GetThreadId( + Thread: HANDLE, + ) -> DWORD; + pub fn FlushProcessWriteBuffers(); + pub fn GetProcessIdOfThread( + Thread: HANDLE, + ) -> DWORD; + pub fn InitializeProcThreadAttributeList( + lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, + dwAttributeCount: DWORD, + dwFlags: DWORD, + lpSize: PSIZE_T, + ) -> BOOL; + pub fn DeleteProcThreadAttributeList( + lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, + ); + pub fn SetProcessAffinityUpdateMode( + hProcess: HANDLE, + dwFlags: DWORD, + ) -> BOOL; + pub fn QueryProcessAffinityUpdateMode( + hProcess: HANDLE, + lpdwFlags: LPDWORD, + ) -> BOOL; + pub fn UpdateProcThreadAttribute( + lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, + dwFlags: DWORD, + Attribute: DWORD_PTR, + lpValue: PVOID, + cbSize: SIZE_T, + lpPreviousValue: PVOID, + lpReturnSize: PSIZE_T, + ) -> BOOL; + pub fn CreateRemoteThreadEx( + hProcess: HANDLE, + lpThreadAttributes: LPSECURITY_ATTRIBUTES, + dwStackSize: SIZE_T, + lpStartAddress: LPTHREAD_START_ROUTINE, + lpParameter: LPVOID, + dwCreationFlags: DWORD, + lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, + lpThreadId: LPDWORD, + ) -> HANDLE; + pub fn GetCurrentThreadStackLimits( + LowLimit: PULONG_PTR, + HighLimit: PULONG_PTR, + ); + pub fn GetThreadContext( + hThread: HANDLE, + lpContext: LPCONTEXT, + ) -> BOOL; + pub fn SetThreadContext( + hThread: HANDLE, + lpContext: *const CONTEXT, + ) -> BOOL; + pub fn SetProcessMitigationPolicy( + MitigationPolicy: PROCESS_MITIGATION_POLICY, + lpBuffer: PVOID, + dwLength: SIZE_T, + ) -> BOOL; + pub fn GetProcessMitigationPolicy( + hProcess: HANDLE, + MitigationPolicy: PROCESS_MITIGATION_POLICY, + lpBuffer: PVOID, + dwLength: SIZE_T, + ) -> BOOL; + pub fn FlushInstructionCache( + hProcess: HANDLE, + lpBaseAddress: LPCVOID, + dwSize: SIZE_T, + ) -> BOOL; + pub fn GetThreadTimes( + hThread: HANDLE, + lpCreationTime: LPFILETIME, + lpExitTime: LPFILETIME, + lpKernelTime: LPFILETIME, + lpUserTime: LPFILETIME, + ) -> BOOL; + pub fn OpenProcess( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + dwProcessId: DWORD, + ) -> HANDLE; + pub fn IsProcessorFeaturePresent( + ProcessorFeature: DWORD, + ) -> BOOL; + pub fn GetProcessHandleCount( + hProcess: HANDLE, + pdwHandleCount: PDWORD, + ) -> BOOL; + pub fn GetCurrentProcessorNumber() -> DWORD; + pub fn SetThreadIdealProcessorEx( + hThread: HANDLE, + lpIdealProcessor: PPROCESSOR_NUMBER, + lpPreviousIdealProcessor: PPROCESSOR_NUMBER, + ) -> BOOL; + pub fn GetThreadIdealProcessorEx( + hThread: HANDLE, + lpIdealProcessor: PPROCESSOR_NUMBER, + ) -> BOOL; + pub fn GetCurrentProcessorNumberEx( + ProcNumber: PPROCESSOR_NUMBER, + ); + pub fn GetProcessPriorityBoost( + hProcess: HANDLE, + pDisablePriorityBoost: PBOOL, + ) -> BOOL; + pub fn SetProcessPriorityBoost( + hProcess: HANDLE, + bDisablePriorityBoost: BOOL, + ) -> BOOL; + pub fn GetThreadIOPendingFlag( + hThread: HANDLE, + lpIOIsPending: PBOOL, + ) -> BOOL; + pub fn GetSystemTimes( + lpIdleTime: LPFILETIME, + lpKernelTime: LPFILETIME, + lpUserTime: LPFILETIME, + ) -> BOOL; +} +ENUM!{enum THREAD_INFORMATION_CLASS { + ThreadMemoryPriority, + ThreadAbsoluteCpuPriority, + ThreadInformationClassMax, +}} +// MEMORY_PRIORITY_INFORMATION +extern "system" { + pub fn GetThreadInformation( + hThread: HANDLE, + ThreadInformationClass: THREAD_INFORMATION_CLASS, + ThreadInformation: LPVOID, + ThreadInformationSize: DWORD, + ) -> BOOL; + pub fn SetThreadInformation( + hThread: HANDLE, + ThreadInformationClass: THREAD_INFORMATION_CLASS, + ThreadInformation: LPVOID, + ThreadInformationSize: DWORD, + ); + pub fn IsProcessCritical( + hProcess: HANDLE, + Critical: PBOOL, + ) -> BOOL; + pub fn SetProtectedPolicy( + PolicyGuid: LPCGUID, + PolicyValue: ULONG_PTR, + OldPolicyValue: PULONG_PTR, + ) -> BOOL; + pub fn QueryProtectedPolicy( + PolicyGuid: LPCGUID, + PolicyValue: PULONG_PTR, + ) -> BOOL; + pub fn SetThreadIdealProcessor( + hThread: HANDLE, + dwIdealProcessor: DWORD, + ) -> DWORD; +} +ENUM!{enum PROCESS_INFORMATION_CLASS { + ProcessMemoryPriority, + ProcessInformationClassMax, +}} +extern "system" { + pub fn SetProcessInformation( + hProcess: HANDLE, + ProcessInformationClass: PROCESS_INFORMATION_CLASS, + ProcessInformation: LPVOID, + ProcessInformationSize: DWORD, + ) -> BOOL; + pub fn GetProcessInformation( + hProcess: HANDLE, + ProcessInformationClass: PROCESS_INFORMATION_CLASS, + ProcessInformation: LPVOID, + ProcessInformationSize: DWORD, + ) -> BOOL; + // pub fn GetSystemCpuSetInformation(); + // pub fn GetProcessDefaultCpuSets(); + // pub fn SetProcessDefaultCpuSets(); + // pub fn GetThreadSelectedCpuSets(); + // pub fn SetThreadSelectedCpuSets(); + // pub fn CreateProcessAsUserA(); + pub fn GetProcessShutdownParameters( + lpdwLevel: LPDWORD, + lpdwFlags: LPDWORD, + ) -> BOOL; + // pub fn SetThreadDescription(); + // pub fn GetThreadDescription(); +} diff --git a/src/vendor/winapi/src/um/processtopologyapi.rs b/src/vendor/winapi/src/um/processtopologyapi.rs new file mode 100644 index 0000000000..d91551f697 --- /dev/null +++ b/src/vendor/winapi/src/um/processtopologyapi.rs @@ -0,0 +1,25 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, PUSHORT}; +use um::winnt::{GROUP_AFFINITY, HANDLE, PGROUP_AFFINITY}; +extern "system" { + pub fn GetProcessGroupAffinity( + hProcess: HANDLE, + GroupCount: PUSHORT, + GroupArray: PUSHORT, + ) -> BOOL; + pub fn GetThreadGroupAffinity( + hThread: HANDLE, + GroupAffinity: PGROUP_AFFINITY, + ) -> BOOL; + pub fn SetThreadGroupAffinity( + hThread: HANDLE, + GroupAffinity: *const GROUP_AFFINITY, + PreviousGroupAffinity: PGROUP_AFFINITY, + ) -> BOOL; +} + diff --git a/src/vendor/winapi/src/um/profileapi.rs b/src/vendor/winapi/src/um/profileapi.rs new file mode 100644 index 0000000000..2176189e45 --- /dev/null +++ b/src/vendor/winapi/src/um/profileapi.rs @@ -0,0 +1,17 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::BOOL; +use um::winnt::LARGE_INTEGER; +extern "system" { + pub fn QueryPerformanceCounter( + lpPerformanceCount: *mut LARGE_INTEGER, + ) -> BOOL; + pub fn QueryPerformanceFrequency( + lpFrequency: *mut LARGE_INTEGER, + ) -> BOOL; +} + diff --git a/src/vendor/winapi/src/um/propidl.rs b/src/vendor/winapi/src/um/propidl.rs new file mode 100644 index 0000000000..b0635afca5 --- /dev/null +++ b/src/vendor/winapi/src/um/propidl.rs @@ -0,0 +1,16 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::WORD; +use shared::wtypes::VARTYPE; +STRUCT!{struct PROPVARIANT { + vt: VARTYPE, + wReserved1: WORD, + wReserved2: WORD, + wReserved3: WORD, + data: [u8; 16], +}} +pub type REFPROPVARIANT = *const PROPVARIANT; diff --git a/src/vendor/winapi/src/um/propkeydef.rs b/src/vendor/winapi/src/um/propkeydef.rs new file mode 100644 index 0000000000..94226dfed4 --- /dev/null +++ b/src/vendor/winapi/src/um/propkeydef.rs @@ -0,0 +1,14 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +use shared::guiddef::{IsEqualIID}; +use shared::wtypes::{PROPERTYKEY, PROPID}; +pub const PID_FIRST_USABLE: PROPID = 2; +pub type REFPROPERTYKEY = *const PROPERTYKEY; +#[inline] +pub fn IsEqualPropertyKey(a: &PROPERTYKEY, b: &PROPERTYKEY) -> bool { + (a.pid == b.pid) && IsEqualIID(&a.fmtid, &b.fmtid) +} diff --git a/src/vendor/winapi/src/um/propsys.rs b/src/vendor/winapi/src/um/propsys.rs new file mode 100644 index 0000000000..18d3025709 --- /dev/null +++ b/src/vendor/winapi/src/um/propsys.rs @@ -0,0 +1,48 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::DWORD; +use shared::wtypes::PROPERTYKEY; +use um::propidl::{PROPVARIANT, REFPROPVARIANT}; +use um::propkeydef::REFPROPERTYKEY; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::HRESULT; +pub type IPropertyDescriptionList = IUnknown; // TODO +RIDL!(#[uuid(0x886d8eeb, 0x8cf2, 0x4446, 0x8d, 0x02, 0xcd, 0xba, 0x1d, 0xbd, 0xcf, 0x99)] +interface IPropertyStore(IPropertyStoreVtbl): IUnknown(IUnknownVtbl) { + fn GetCount( + cProps: *mut DWORD, + ) -> HRESULT, + fn GetAt( + iProp: DWORD, + pkey: *mut PROPERTYKEY, + ) -> HRESULT, + fn GetValue( + key: REFPROPERTYKEY, + pv: *mut PROPVARIANT, + ) -> HRESULT, + fn SetValue( + key: REFPROPERTYKEY, + propvar: REFPROPVARIANT, + ) -> HRESULT, + fn Commit() -> HRESULT, +} +); +ENUM!{enum GETPROPERTYSTOREFLAGS { + GPS_DEFAULT = 0, + GPS_HANDLERPROPERTIESONLY = 0x1, + GPS_READWRITE = 0x2, + GPS_TEMPORARY = 0x4, + GPS_FASTPROPERTIESONLY = 0x8, + GPS_OPENSLOWITEM = 0x10, + GPS_DELAYCREATION = 0x20, + GPS_BESTEFFORT = 0x40, + GPS_NO_OPLOCK = 0x80, + GPS_PREFERQUERYPROPERTIES = 0x100, + GPS_EXTRINSICPROPERTIES = 0x200, + GPS_EXTRINSICPROPERTIESONLY = 0x400, + GPS_MASK_VALID = 0x7ff, +}} diff --git a/src/vendor/winapi/src/um/prsht.rs b/src/vendor/winapi/src/um/prsht.rs new file mode 100644 index 0000000000..057c515d2d --- /dev/null +++ b/src/vendor/winapi/src/um/prsht.rs @@ -0,0 +1,362 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Interface for the Windows Property Sheet Pages +use ctypes::{c_int, c_short}; +use shared::basetsd::INT_PTR; +use shared::minwindef::{BOOL, DWORD, HINSTANCE, LPARAM, LPVOID, LRESULT, UINT, WPARAM}; +use shared::windef::{HBITMAP, HICON, HPALETTE, HWND}; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR}; +use um::winuser::{DLGPROC, LPCDLGTEMPLATEA, NMHDR, WM_USER}; +pub enum PSP {} +pub type HPROPSHEETPAGE = *mut PSP; +FN!{stdcall LPFNPSPCALLBACKA( + hwnd: HWND, + uMsg: UINT, + ppsp: *mut PROPSHEETPAGEA, +) -> UINT} +FN!{stdcall LPFNPSPCALLBACKW( + hwnd: HWND, + uMsg: UINT, + ppsp: *mut PROPSHEETPAGEW, +) -> UINT} +pub const PSP_DEFAULT: DWORD = 0x00000000; +pub const PSP_DLGINDIRECT: DWORD = 0x00000001; +pub const PSP_USEHICON: DWORD = 0x00000002; +pub const PSP_USEICONID: DWORD = 0x00000004; +pub const PSP_USETITLE: DWORD = 0x00000008; +pub const PSP_RTLREADING: DWORD = 0x00000010; +pub const PSP_HASHELP: DWORD = 0x00000020; +pub const PSP_USEREFPARENT: DWORD = 0x00000040; +pub const PSP_USECALLBACK: DWORD = 0x00000080; +pub const PSP_PREMATURE: DWORD = 0x00000400; +pub const PSP_HIDEHEADER: DWORD = 0x00000800; +pub const PSP_USEHEADERTITLE: DWORD = 0x00001000; +pub const PSP_USEHEADERSUBTITLE: DWORD = 0x00002000; +pub const PSP_USEFUSIONCONTEXT: DWORD = 0x00004000; +pub const PSPCB_ADDREF: UINT = 0; +pub const PSPCB_RELEASE: UINT = 1; +pub const PSPCB_CREATE: UINT = 2; +pub type PROPSHEETPAGE_RESOURCE = LPCDLGTEMPLATEA; +UNION!{union PROPSHEETPAGEA_V1_u1 { + [usize; 1], + pszTemplate pszTemplate_mut: LPCSTR, + pResource pResource_mut: PROPSHEETPAGE_RESOURCE, +}} +UNION!{union PROPSHEETPAGEA_V1_u2 { + [usize; 1], + hIcon hIcon_mut: HICON, + pszIcon pszIcon_mut: LPCSTR, +}} +UNION!{union PROPSHEETPAGEA_V4_u3 { + [usize; 1], + hbmHeader hbmHeader_mut: HBITMAP, + pszbmHeader pszbmHeader_mut: LPCSTR, +}} +STRUCT!{struct PROPSHEETPAGEA_V4 { + dwSize: DWORD, + dwFlags: DWORD, + hInstance: HINSTANCE, + u1: PROPSHEETPAGEA_V1_u1, + u2: PROPSHEETPAGEA_V1_u2, + pszTitle: LPCSTR, + pfnDlgProc: DLGPROC, + lParam: LPARAM, + pfnCallback: LPFNPSPCALLBACKA, + pcRefParent: *mut UINT, + pszHeaderTitle: LPCSTR, + pszHeaderSubTitle: LPCSTR, + hActCtx: HANDLE, + u3: PROPSHEETPAGEA_V4_u3, +}} +pub type LPPROPSHEETPAGEA_V4 = *mut PROPSHEETPAGEA_V4; +pub type LPCPROPSHEETPAGEA_V4 = *const PROPSHEETPAGEA_V4; +UNION!{union PROPSHEETPAGEW_V1_u1 { + [usize; 1], + pszTemplate pszTemplate_mut: LPCWSTR, + pResource pResource_mut: PROPSHEETPAGE_RESOURCE, +}} +UNION!{union PROPSHEETPAGEW_V1_u2 { + [usize; 1], + hIcon hIcon_mut: HICON, + pszIcon pszIcon_mut: LPCWSTR, +}} +UNION!{union PROPSHEETPAGEW_V4_u3 { + [usize; 1], + hbmHeader hbmHeader_mut: HBITMAP, + pszbmHeader pszbmHeader_mut: LPCWSTR, +}} +STRUCT!{struct PROPSHEETPAGEW_V4 { + dwSize: DWORD, + dwFlags: DWORD, + hInstance: HINSTANCE, + u1: PROPSHEETPAGEW_V1_u1, + u2: PROPSHEETPAGEW_V1_u2, + pszTitle: LPCWSTR, + pfnDlgProc: DLGPROC, + lParam: LPARAM, + pfnCallback: LPFNPSPCALLBACKW, + pcRefParent: *mut UINT, + pszHeaderTitle: LPCWSTR, + pszHeaderSubTitle: LPCWSTR, + hActCtx: HANDLE, + u3: PROPSHEETPAGEW_V4_u3, +}} +pub type LPPROPSHEETPAGEW_V4 = *mut PROPSHEETPAGEW_V4; +pub type LPCPROPSHEETPAGEW_V4 = *const PROPSHEETPAGEW_V4; +pub type PROPSHEETPAGEA_LATEST = PROPSHEETPAGEA_V4; +pub type PROPSHEETPAGEW_LATEST = PROPSHEETPAGEW_V4; +pub type LPPROPSHEETPAGEA_LATEST = LPPROPSHEETPAGEA_V4; +pub type LPPROPSHEETPAGEW_LATEST = LPPROPSHEETPAGEW_V4; +pub type LPCPROPSHEETPAGEA_LATEST = LPCPROPSHEETPAGEA_V4; +pub type LPCPROPSHEETPAGEW_LATEST = LPCPROPSHEETPAGEW_V4; +pub type PROPSHEETPAGEA = PROPSHEETPAGEA_V4; +pub type PROPSHEETPAGEW = PROPSHEETPAGEW_V4; +pub type LPPROPSHEETPAGEA = LPPROPSHEETPAGEA_V4; +pub type LPPROPSHEETPAGEW = LPPROPSHEETPAGEW_V4; +pub type LPCPROPSHEETPAGEA = LPCPROPSHEETPAGEA_V4; +pub type LPCPROPSHEETPAGEW = LPCPROPSHEETPAGEW_V4; +pub const PSH_DEFAULT: DWORD = 0x00000000; +pub const PSH_PROPTITLE: DWORD = 0x00000001; +pub const PSH_USEHICON: DWORD = 0x00000002; +pub const PSH_USEICONID: DWORD = 0x00000004; +pub const PSH_PROPSHEETPAGE: DWORD = 0x00000008; +pub const PSH_WIZARDHASFINISH: DWORD = 0x00000010; +pub const PSH_WIZARD: DWORD = 0x00000020; +pub const PSH_USEPSTARTPAGE: DWORD = 0x00000040; +pub const PSH_NOAPPLYNOW: DWORD = 0x00000080; +pub const PSH_USECALLBACK: DWORD = 0x00000100; +pub const PSH_HASHELP: DWORD = 0x00000200; +pub const PSH_MODELESS: DWORD = 0x00000400; +pub const PSH_RTLREADING: DWORD = 0x00000800; +pub const PSH_WIZARDCONTEXTHELP: DWORD = 0x00001000; +pub const PSH_WIZARD97: DWORD = 0x01000000; +pub const PSH_WATERMARK: DWORD = 0x00008000; +pub const PSH_USEHBMWATERMARK: DWORD = 0x00010000; +pub const PSH_USEHPLWATERMARK: DWORD = 0x00020000; +pub const PSH_STRETCHWATERMARK: DWORD = 0x00040000; +pub const PSH_HEADER: DWORD = 0x00080000; +pub const PSH_USEHBMHEADER: DWORD = 0x00100000; +pub const PSH_USEPAGELANG: DWORD = 0x00200000; +pub const PSH_WIZARD_LITE: DWORD = 0x00400000; +pub const PSH_NOCONTEXTHELP: DWORD = 0x02000000; +pub const PSH_AEROWIZARD: DWORD = 0x00004000; +pub const PSH_RESIZABLE: DWORD = 0x04000000; +pub const PSH_HEADERBITMAP: DWORD = 0x08000000; +pub const PSH_NOMARGIN: DWORD = 0x10000000; +FN!{stdcall PFNPROPSHEETCALLBACK( + HWND, + UINT, + LPARAM, +) -> c_int} +UNION!{union PROPSHEETHEADERA_V1_u1 { + [usize; 1], + hIcon hIcon_mut: HICON, + pszIcon pszIcon_mut: LPCSTR, +}} +UNION!{union PROPSHEETHEADERA_V1_u2 { + [usize; 1], + nStartPage nStartPage_mut: UINT, + pStartPage pStartPage_mut: LPCSTR, +}} +UNION!{union PROPSHEETHEADERA_V1_u3 { + [usize; 1], + ppsp ppsp_mut: LPCPROPSHEETPAGEA, + phpage phpage_mut: *mut HPROPSHEETPAGE, +}} +UNION!{union PROPSHEETHEADERA_V2_u4 { + [usize; 1], + hbmWatermark hbmWatermark_mut: HBITMAP, + pszbmWatermark pszbmWatermark_mut: LPCSTR, +}} +UNION!{union PROPSHEETHEADERA_V2_u5 { + [usize; 1], + hbmHeader hbmHeader_mut: HBITMAP, + pszbmHeader pszbmHeader_mut: LPCSTR, +}} +STRUCT!{struct PROPSHEETHEADERA_V2 { + dwSize: DWORD, + dwFlags: DWORD, + hwndParent: HWND, + hInstance: HINSTANCE, + u1: PROPSHEETHEADERA_V1_u1, + pszCaption: LPCSTR, + nPages: UINT, + u2: PROPSHEETHEADERA_V1_u2, + u3: PROPSHEETHEADERA_V1_u3, + pfnCallback: PFNPROPSHEETCALLBACK, + u4: PROPSHEETHEADERA_V2_u4, + hplWatermark: HPALETTE, + u5: PROPSHEETHEADERA_V2_u5, +}} +pub type LPPROPSHEETHEADERA_V2 = *mut PROPSHEETHEADERA_V2; +pub type LPCPROPSHEETHEADERA_V2 = *const PROPSHEETHEADERA_V2; +UNION!{union PROPSHEETHEADERW_V1_u1 { + [usize; 1], + hIcon hIcon_mut: HICON, + pszIcon pszIcon_mut: LPCWSTR, +}} +UNION!{union PROPSHEETHEADERW_V1_u2 { + [usize; 1], + nStartPage nStartPage_mut: UINT, + pStartPage pStartPage_mut: LPCWSTR, +}} +UNION!{union PROPSHEETHEADERW_V1_u3 { + [usize; 1], + ppsp ppsp_mut: LPCPROPSHEETPAGEW, + phpage phpage_mut: *mut HPROPSHEETPAGE, +}} +UNION!{union PROPSHEETHEADERW_V2_u4 { + [usize; 1], + hbmWatermark hbmWatermark_mut: HBITMAP, + pszbmWatermark pszbmWatermark_mut: LPCWSTR, +}} +UNION!{union PROPSHEETHEADERW_V2_u5 { + [usize; 1], + hbmHeader hbmHeader_mut: HBITMAP, + pszbmHeader pszbmHeader_mut: LPCWSTR, +}} +STRUCT!{struct PROPSHEETHEADERW_V2 { + dwSize: DWORD, + dwFlags: DWORD, + hwndParent: HWND, + hInstance: HINSTANCE, + u1: PROPSHEETHEADERW_V1_u1, + pszCaption: LPCWSTR, + nPages: UINT, + u2: PROPSHEETHEADERW_V1_u2, + u3: PROPSHEETHEADERW_V1_u3, + pfnCallback: PFNPROPSHEETCALLBACK, + u4: PROPSHEETHEADERW_V2_u4, + hplWatermark: HPALETTE, + u5: PROPSHEETHEADERW_V2_u5, +}} +pub type LPPROPSHEETHEADERW_V2 = *mut PROPSHEETHEADERW_V2; +pub type LPCPROPSHEETHEADERW_V2 = *const PROPSHEETHEADERW_V2; +pub type PROPSHEETHEADERA = PROPSHEETHEADERA_V2; +pub type PROPSHEETHEADERW = PROPSHEETHEADERW_V2; +pub type LPPROPSHEETHEADERA = LPPROPSHEETHEADERA_V2; +pub type LPPROPSHEETHEADERW = LPPROPSHEETHEADERW_V2; +pub type LPCPROPSHEETHEADERA = LPCPROPSHEETHEADERA_V2; +pub type LPCPROPSHEETHEADERW = LPCPROPSHEETHEADERW_V2; +pub const PSCB_INITIALIZED: UINT = 1; +pub const PSCB_PRECREATE: UINT = 2; +pub const PSCB_BUTTONPRESSED: UINT = 3; +extern "system" { + pub fn CreatePropertySheetPageA( + constPropSheetPagePointer: LPCPROPSHEETPAGEA, + ) -> HPROPSHEETPAGE; + pub fn CreatePropertySheetPageW( + constPropSheetPagePointer: LPCPROPSHEETPAGEW, + ) -> HPROPSHEETPAGE; + pub fn DestroyPropertySheetPage( + hPSPage: HPROPSHEETPAGE, + ) -> BOOL; + pub fn PropertySheetA( + lppsph: LPCPROPSHEETHEADERA, + ) -> INT_PTR; + pub fn PropertySheetW( + lppsph: LPCPROPSHEETHEADERW, + ) -> INT_PTR; +} +FN!{stdcall LPFNADDPROPSHEETPAGE( + HPROPSHEETPAGE, + LPARAM, +) -> BOOL} +FN!{stdcall LPFNADDPROPSHEETPAGES( + LPVOID, + LPFNADDPROPSHEETPAGE, + LPARAM, +) -> BOOL} +STRUCT!{struct PSHNOTIFY { + hdr: NMHDR, + lParam: LPARAM, +}} +pub type LPPSHNOTIFY = *mut PSHNOTIFY; +pub const PSN_FIRST: UINT = -200i32 as u32; +pub const PSN_LAST: UINT = -299i32 as u32; +pub const PSN_SETACTIVE: UINT = PSN_FIRST - 0; +pub const PSN_KILLACTIVE: UINT = PSN_FIRST - 1; +pub const PSN_APPLY: UINT = PSN_FIRST - 2; +pub const PSN_RESET: UINT = PSN_FIRST - 3; +pub const PSN_HELP: UINT = PSN_FIRST - 5; +pub const PSN_WIZBACK: UINT = PSN_FIRST - 6; +pub const PSN_WIZNEXT: UINT = PSN_FIRST - 7; +pub const PSN_WIZFINISH: UINT = PSN_FIRST - 8; +pub const PSN_QUERYCANCEL: UINT = PSN_FIRST - 9; +pub const PSN_GETOBJECT: UINT = PSN_FIRST - 10; +pub const PSN_TRANSLATEACCELERATOR: UINT = PSN_FIRST - 12; +pub const PSN_QUERYINITIALFOCUS: UINT = PSN_FIRST - 13; +pub const PSNRET_NOERROR: LRESULT = 0; +pub const PSNRET_INVALID: LRESULT = 1; +pub const PSNRET_INVALID_NOCHANGEPAGE: LRESULT = 2; +pub const PSNRET_MESSAGEHANDLED: LRESULT = 3; +pub const PSM_SETCURSEL: UINT = WM_USER + 101; +pub const PSM_REMOVEPAGE: UINT = WM_USER + 102; +pub const PSM_ADDPAGE: UINT = WM_USER + 103; +pub const PSM_CHANGED: UINT = WM_USER + 104; +pub const PSM_RESTARTWINDOWS: UINT = WM_USER + 105; +pub const PSM_REBOOTSYSTEM: UINT = WM_USER + 106; +pub const PSM_CANCELTOCLOSE: UINT = WM_USER + 107; +pub const PSM_QUERYSIBLINGS: UINT = WM_USER + 108; +pub const PSM_UNCHANGED: UINT = WM_USER + 109; +pub const PSM_APPLY: UINT = WM_USER + 110; +pub const PSM_SETTITLEA: UINT = WM_USER + 111; +pub const PSM_SETTITLEW: UINT = WM_USER + 120; +pub const PSM_SETWIZBUTTONS: UINT = WM_USER + 112; +pub const PSWIZB_BACK: DWORD = 0x00000001; +pub const PSWIZB_NEXT: DWORD = 0x00000002; +pub const PSWIZB_FINISH: DWORD = 0x00000004; +pub const PSWIZB_DISABLEDFINISH: DWORD = 0x00000008; +pub const PSWIZBF_ELEVATIONREQUIRED: WPARAM = 0x00000001; +pub const PSWIZB_CANCEL: DWORD = 0x00000010; +pub const PSM_PRESSBUTTON: UINT = WM_USER + 113; +pub const PSBTN_BACK: c_int = 0; +pub const PSBTN_NEXT: c_int = 1; +pub const PSBTN_FINISH: c_int = 2; +pub const PSBTN_OK: c_int = 3; +pub const PSBTN_APPLYNOW: c_int = 4; +pub const PSBTN_CANCEL: c_int = 5; +pub const PSBTN_HELP: c_int = 6; +pub const PSBTN_MAX: c_int = 6; +pub const PSM_SETCURSELID: UINT = WM_USER + 114; +pub const PSM_SETFINISHTEXTA: UINT = WM_USER + 115; +pub const PSM_SETFINISHTEXTW: UINT = WM_USER + 121; +pub const PSM_GETTABCONTROL: UINT = WM_USER + 116; +pub const PSM_ISDIALOGMESSAGE: UINT = WM_USER + 117; +pub const PSM_GETCURRENTPAGEHWND: UINT = WM_USER + 118; +pub const PSM_INSERTPAGE: UINT = WM_USER + 119; +pub const PSM_SETHEADERTITLEA: UINT = WM_USER + 125; +pub const PSM_SETHEADERTITLEW: UINT = WM_USER + 126; +pub const PSWIZF_SETCOLOR: UINT = -1i32 as u32; +pub const PSM_SETHEADERSUBTITLEA: UINT = WM_USER + 127; +pub const PSM_SETHEADERSUBTITLEW: UINT = WM_USER + 128; +pub const PSM_HWNDTOINDEX: UINT = WM_USER + 129; +pub const PSM_INDEXTOHWND: UINT = WM_USER + 130; +pub const PSM_PAGETOINDEX: UINT = WM_USER + 131; +pub const PSM_INDEXTOPAGE: UINT = WM_USER + 132; +pub const PSM_IDTOINDEX: UINT = WM_USER + 133; +pub const PSM_INDEXTOID: UINT = WM_USER + 134; +pub const PSM_GETRESULT: UINT = WM_USER + 135; +pub const PSM_RECALCPAGESIZES: UINT = WM_USER + 136; +pub const PSM_SETNEXTTEXTW: UINT = WM_USER + 137; +pub const PSM_SHOWWIZBUTTONS: UINT = WM_USER + 138; +pub const PSM_ENABLEWIZBUTTONS: UINT = WM_USER + 139; +pub const PSM_SETBUTTONTEXTW: UINT = WM_USER + 140; +pub const PSM_SETBUTTONTEXT: UINT = PSM_SETBUTTONTEXTW; +pub const ID_PSRESTARTWINDOWS: INT_PTR = 0x2; +pub const ID_PSREBOOTSYSTEM: INT_PTR = ID_PSRESTARTWINDOWS | 0x1; +pub const WIZ_CXDLG: DWORD = 276; +pub const WIZ_CYDLG: DWORD = 140; +pub const WIZ_CXBMP: DWORD = 80; +pub const WIZ_BODYX: DWORD = 92; +pub const WIZ_BODYCX: DWORD = 184; +pub const PROP_SM_CXDLG: c_short = 212; +pub const PROP_SM_CYDLG: c_short = 188; +pub const PROP_MED_CXDLG: c_short = 227; +pub const PROP_MED_CYDLG: c_short = 215; +pub const PROP_LG_CXDLG: c_short = 252; +pub const PROP_LG_CYDLG: c_short = 218; diff --git a/src/vendor/winapi/src/um/psapi.rs b/src/vendor/winapi/src/um/psapi.rs new file mode 100644 index 0000000000..36aadec12c --- /dev/null +++ b/src/vendor/winapi/src/um/psapi.rs @@ -0,0 +1,353 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! FFI bindings to psapi. +use shared::basetsd::{SIZE_T, ULONG_PTR}; +use shared::minwindef::{BOOL, DWORD, HMODULE, LPDWORD, LPVOID, PDWORD}; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID}; +pub const LIST_MODULES_DEFAULT: DWORD = 0x0; +pub const LIST_MODULES_32BIT: DWORD = 0x01; +pub const LIST_MODULES_64BIT: DWORD = 0x02; +pub const LIST_MODULES_ALL: DWORD = LIST_MODULES_32BIT | LIST_MODULES_64BIT; +extern "system" { + pub fn K32EnumProcesses( + lpidProcess: *mut DWORD, cb: DWORD, lpcbNeeded: LPDWORD, + ) -> BOOL; + pub fn K32EnumProcessModules( + hProcess: HANDLE, lphModule: *mut HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, + ) -> BOOL; + pub fn K32EnumProcessModulesEx( + hProcess: HANDLE, lphModule: *mut HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, + dwFilterFlag: DWORD, + ) -> BOOL; + pub fn K32GetModuleBaseNameA( + hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleBaseNameW( + hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleFileNameExA( + hProcess: HANDLE, hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetModuleFileNameExW( + hProcess: HANDLE, hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32EmptyWorkingSet(hProcess: HANDLE) -> BOOL; + pub fn K32QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) -> BOOL; + pub fn K32QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) -> BOOL; + pub fn K32InitializeProcessForWsWatch(hProcess: HANDLE) -> BOOL; + pub fn K32GetWsChanges( + hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD, + ) -> BOOL; + pub fn K32GetWsChangesEx( + hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: PDWORD, + ) -> BOOL; + pub fn K32GetMappedFileNameW( + hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetMappedFileNameA( + hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32EnumDeviceDrivers(lpImageBase: *mut LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) -> BOOL; + pub fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) -> DWORD; + pub fn K32GetDeviceDriverBaseNameW( + ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) -> DWORD; + pub fn K32GetDeviceDriverFileNameW( + ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetPerformanceInfo( + pPerformanceInformation: PPERFORMANCE_INFORMATION, cb: DWORD, + ) -> BOOL; + pub fn K32EnumPageFilesW( + pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID, + ) -> BOOL; + pub fn K32EnumPageFilesA( + pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID, + ) -> BOOL; + pub fn K32GetProcessImageFileNameA( + hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD, + ) -> DWORD; + pub fn K32GetProcessImageFileNameW( + hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD, + ) -> DWORD; + pub fn EnumProcesses( + lpidProcess: *mut DWORD, + cb: DWORD, + lpcbNeeded: LPDWORD, + ) -> BOOL; + pub fn K32GetProcessMemoryInfo( + Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD, + ) -> BOOL; + pub fn K32GetModuleInformation( + hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD, + ) -> BOOL; +} +pub type LPMODULEINFO = *mut MODULEINFO; +pub type PPSAPI_WORKING_SET_INFORMATION = *mut PSAPI_WORKING_SET_INFORMATION; +pub type PPSAPI_WORKING_SET_EX_INFORMATION = *mut PSAPI_WORKING_SET_EX_INFORMATION; +pub type PPSAPI_WS_WATCH_INFORMATION = *mut PSAPI_WS_WATCH_INFORMATION; +pub type PPSAPI_WS_WATCH_INFORMATION_EX = *mut PSAPI_WS_WATCH_INFORMATION_EX; +pub type PENUM_PAGE_FILE_INFORMATION = *mut ENUM_PAGE_FILE_INFORMATION; +pub type PPERFORMANCE_INFORMATION = *mut PERFORMANCE_INFORMATION; +pub type PPROCESS_MEMORY_COUNTERS = *mut PROCESS_MEMORY_COUNTERS; +pub type PPROCESS_MEMORY_COUNTERS_EX = *mut PROCESS_MEMORY_COUNTERS_EX; +FN!{stdcall PENUM_PAGE_FILE_CALLBACKA( + pContext: LPVOID, + pPageFileInfo: PENUM_PAGE_FILE_INFORMATION, + lpFilename: LPCSTR, +) -> BOOL} +FN!{stdcall PENUM_PAGE_FILE_CALLBACKW( + pContext: LPVOID, + pPageFileInfo: PENUM_PAGE_FILE_INFORMATION, + lpFilename: LPCWSTR, +) -> BOOL} +STRUCT!{struct MODULEINFO { + lpBaseOfDll: LPVOID, + SizeOfImage: DWORD, + EntryPoint: LPVOID, +}} +STRUCT!{struct ENUM_PAGE_FILE_INFORMATION { + cb: DWORD, + Reserved: DWORD, + TotalSize: SIZE_T, + TotalInUse: SIZE_T, + PeakUsage: SIZE_T, +}} +STRUCT!{struct PERFORMANCE_INFORMATION { + cb: DWORD, + CommitTotal: SIZE_T, + CommitLimit: SIZE_T, + CommitPeak: SIZE_T, + PhysicalTotal: SIZE_T, + PhysicalAvailable: SIZE_T, + SystemCache: SIZE_T, + KernelTotal: SIZE_T, + KernelPaged: SIZE_T, + KernelNonpaged: SIZE_T, + PageSize: SIZE_T, + HandleCount: DWORD, + ProcessCount: DWORD, + ThreadCount: DWORD, +}} +STRUCT!{struct PROCESS_MEMORY_COUNTERS { + cb: DWORD, + PageFaultCount: DWORD, + PeakWorkingSetSize: SIZE_T, + WorkingSetSize: SIZE_T, + QuotaPeakPagedPoolUsage: SIZE_T, + QuotaPagedPoolUsage: SIZE_T, + QuotaPeakNonPagedPoolUsage: SIZE_T, + QuotaNonPagedPoolUsage: SIZE_T, + PagefileUsage: SIZE_T, + PeakPagefileUsage: SIZE_T, +}} +STRUCT!{struct PROCESS_MEMORY_COUNTERS_EX { + cb: DWORD, + PageFaultCount: DWORD, + PeakWorkingSetSize: SIZE_T, + WorkingSetSize: SIZE_T, + QuotaPeakPagedPoolUsage: SIZE_T, + QuotaPagedPoolUsage: SIZE_T, + QuotaPeakNonPagedPoolUsage: SIZE_T, + QuotaNonPagedPoolUsage: SIZE_T, + PagefileUsage: SIZE_T, + PeakPagefileUsage: SIZE_T, + PrivateUsage: SIZE_T, +}} +STRUCT!{struct PSAPI_WORKING_SET_BLOCK { + Flags: ULONG_PTR, +}} +BITFIELD!{PSAPI_WORKING_SET_BLOCK Flags: ULONG_PTR [ + Protection set_Protection[0..5], + ShareCount set_ShareCount[5..8], + Shared set_Shared[8..9], + Reserved set_Reserved[9..12], + VirtualPage set_VirtualPage[12..32], +]} +pub type PPSAPI_WORKING_SET_BLOCK = *mut PSAPI_WORKING_SET_BLOCK; +STRUCT!{struct PSAPI_WORKING_SET_EX_BLOCK { + Flags: ULONG_PTR, +}} +#[cfg(not(target_arch="x86_64"))] +BITFIELD!{PSAPI_WORKING_SET_EX_BLOCK Flags: ULONG_PTR [ + Valid set_Valid[0..1], + ShareCount set_ShareCount[1..4], + Win32Protection set_Win32Protection[4..15], + Shared set_Shared[15..16], + Node set_Node[16..22], + Locked set_Locked[22..23], + LargePage set_LargePage[23..24], + Reserved set_Reserved[24..31], + Bad set_Bad[31..32], +]} +#[cfg(target_arch="x86_64")] +BITFIELD!{PSAPI_WORKING_SET_EX_BLOCK Flags: ULONG_PTR [ + Valid set_Valid[0..1], + ShareCount set_ShareCount[1..4], + Win32Protection set_Win32Protection[4..15], + Shared set_Shared[15..16], + Node set_Node[16..22], + Locked set_Locked[22..23], + LargePage set_LargePage[23..24], + Reserved set_Reserved[24..31], + Bad set_Bad[31..32], + ReservedUlong set_ReservedULong[32..64], +]} +pub type PPSAPI_WORKING_SET_EX_BLOCK = *mut PSAPI_WORKING_SET_EX_BLOCK; +STRUCT!{struct PSAPI_WORKING_SET_INFORMATION { + NumberOfEntries: ULONG_PTR, + WorkingSetInfo: [PSAPI_WORKING_SET_BLOCK; 1], +}} +STRUCT!{struct PSAPI_WORKING_SET_EX_INFORMATION { + VirtualAddress: PVOID, + VirtualAttributes: PSAPI_WORKING_SET_EX_BLOCK, +}} +STRUCT!{struct PSAPI_WS_WATCH_INFORMATION { + FaultingPc: LPVOID, + FaultingVa: LPVOID, +}} +STRUCT!{struct PSAPI_WS_WATCH_INFORMATION_EX { + BasicInfo: PSAPI_WS_WATCH_INFORMATION, + FaultingThreadId: ULONG_PTR, + Flags: ULONG_PTR, +}} +extern "system" { + pub fn EmptyWorkingSet( + hProcess: HANDLE, + ) -> BOOL; + pub fn EnumDeviceDrivers( + lpImageBase: *mut LPVOID, + cb: DWORD, + lpcbNeeded: LPDWORD, + ) -> BOOL; + pub fn EnumPageFilesA( + pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, + pContext: LPVOID, + ) -> BOOL; + pub fn EnumPageFilesW( + pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, + pContext: LPVOID, + ) -> BOOL; + pub fn EnumProcessModules( + hProcess: HANDLE, + lphModule: *mut HMODULE, + cb: DWORD, + lpcbNeeded: LPDWORD, + ) -> BOOL; + pub fn EnumProcessModulesEx( + hProcess: HANDLE, + lphModule: *mut HMODULE, + cb: DWORD, + lpcbNeeded: LPDWORD, + dwFilterFlag: DWORD, + ) -> BOOL; + pub fn GetDeviceDriverBaseNameA( + ImageBase: LPVOID, + lpFilename: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetDeviceDriverBaseNameW( + ImageBase: LPVOID, + lpFilename: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetDeviceDriverFileNameA( + ImageBase: LPVOID, + lpFilename: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetDeviceDriverFileNameW( + ImageBase: LPVOID, + lpFilename: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetMappedFileNameA( + hProcess: HANDLE, + lpv: LPVOID, + lpFilename: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetMappedFileNameW( + hProcess: HANDLE, + lpv: LPVOID, + lpFilename: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetModuleBaseNameA( + hProcess: HANDLE, + hModule: HMODULE, + lpBaseName: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetModuleBaseNameW( + hProcess: HANDLE, + hModule: HMODULE, + lpBaseName: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetModuleFileNameExA( + hProcess: HANDLE, + hModule: HMODULE, + lpFilename: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetModuleFileNameExW( + hProcess: HANDLE, + hModule: HMODULE, + lpFilename: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetModuleInformation( + hProcess: HANDLE, + hModule: HMODULE, + lpmodinfo: LPMODULEINFO, + cb: DWORD, + ) -> BOOL; + pub fn GetPerformanceInfo( + pPerformanceInformation: PPERFORMANCE_INFORMATION, + cb: DWORD, + ) -> BOOL; + pub fn GetProcessImageFileNameA( + hProcess: HANDLE, + lpImageFileName: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetProcessImageFileNameW( + hProcess: HANDLE, + lpImageFileName: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetProcessMemoryInfo( + hProcess: HANDLE, + ppsmemCounters: PPROCESS_MEMORY_COUNTERS, + cb: DWORD, + ) -> BOOL; + pub fn GetWsChanges( + hProcess: HANDLE, + lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, + cb: DWORD, + ) -> BOOL; + pub fn GetWsChangesEx( + hProcess: HANDLE, + lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, + cb: PDWORD, + ) -> BOOL; + pub fn InitializeProcessForWsWatch( + hProcess: HANDLE, + ) -> BOOL; + pub fn QueryWorkingSet( + hProcess: HANDLE, + pv: PVOID, + cb: DWORD, + ) -> BOOL; + pub fn QueryWorkingSetEx( + hProcess: HANDLE, + pv: PVOID, + cb: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/realtimeapiset.rs b/src/vendor/winapi/src/um/realtimeapiset.rs new file mode 100644 index 0000000000..a24570ebff --- /dev/null +++ b/src/vendor/winapi/src/um/realtimeapiset.rs @@ -0,0 +1,31 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::PULONG64; +use shared::minwindef::{BOOL, PULONG, USHORT}; +use um::winnt::{HANDLE, PULONGLONG}; +extern "system" { + pub fn QueryThreadCycleTime( + ThreadHandle: HANDLE, + CycleTime: PULONG64, + ) -> BOOL; + pub fn QueryProcessCycleTime( + ProcessHandle: HANDLE, + CycleTime: PULONG64, + ) -> BOOL; + pub fn QueryIdleProcessorCycleTime( + BufferLength: PULONG, + ProcessorIdleCycleTime: PULONG64, + ) -> BOOL; + pub fn QueryIdleProcessorCycleTimeEx( + Group: USHORT, + BufferLength: PULONG, + ProcessorIdleCycleTime: PULONG64, + ) -> BOOL; + pub fn QueryUnbiasedInterruptTime( + UnbiasedTime: PULONGLONG, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/reason.rs b/src/vendor/winapi/src/um/reason.rs new file mode 100644 index 0000000000..5c87696c35 --- /dev/null +++ b/src/vendor/winapi/src/um/reason.rs @@ -0,0 +1,63 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. + +use shared::minwindef::DWORD; + +pub const SHTDN_REASON_FLAG_COMMENT_REQUIRED: DWORD = 0x01000000; +pub const SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED: DWORD = 0x02000000; +pub const SHTDN_REASON_FLAG_CLEAN_UI: DWORD = 0x04000000; +pub const SHTDN_REASON_FLAG_DIRTY_UI: DWORD = 0x08000000; +pub const SHTDN_REASON_FLAG_USER_DEFINED: DWORD = 0x40000000; +pub const SHTDN_REASON_FLAG_PLANNED: DWORD = 0x80000000; +pub const SHTDN_REASON_MAJOR_OTHER: DWORD = 0x00000000; +pub const SHTDN_REASON_MAJOR_NONE: DWORD = 0x00000000; +pub const SHTDN_REASON_MAJOR_HARDWARE: DWORD = 0x00010000; +pub const SHTDN_REASON_MAJOR_OPERATINGSYSTEM: DWORD = 0x00020000; +pub const SHTDN_REASON_MAJOR_SOFTWARE: DWORD = 0x00030000; +pub const SHTDN_REASON_MAJOR_APPLICATION: DWORD = 0x00040000; +pub const SHTDN_REASON_MAJOR_SYSTEM: DWORD = 0x00050000; +pub const SHTDN_REASON_MAJOR_POWER: DWORD = 0x00060000; +pub const SHTDN_REASON_MAJOR_LEGACY_API: DWORD = 0x00070000; +pub const SHTDN_REASON_MINOR_OTHER: DWORD = 0x00000000; +pub const SHTDN_REASON_MINOR_NONE: DWORD = 0x000000ff; +pub const SHTDN_REASON_MINOR_MAINTENANCE: DWORD = 0x00000001; +pub const SHTDN_REASON_MINOR_INSTALLATION: DWORD = 0x00000002; +pub const SHTDN_REASON_MINOR_UPGRADE: DWORD = 0x00000003; +pub const SHTDN_REASON_MINOR_RECONFIG: DWORD = 0x00000004; +pub const SHTDN_REASON_MINOR_HUNG: DWORD = 0x00000005; +pub const SHTDN_REASON_MINOR_UNSTABLE: DWORD = 0x00000006; +pub const SHTDN_REASON_MINOR_DISK: DWORD = 0x00000007; +pub const SHTDN_REASON_MINOR_PROCESSOR: DWORD = 0x00000008; +pub const SHTDN_REASON_MINOR_NETWORKCARD: DWORD = 0x00000009; +pub const SHTDN_REASON_MINOR_POWER_SUPPLY: DWORD = 0x0000000a; +pub const SHTDN_REASON_MINOR_CORDUNPLUGGED: DWORD = 0x0000000b; +pub const SHTDN_REASON_MINOR_ENVIRONMENT: DWORD = 0x0000000c; +pub const SHTDN_REASON_MINOR_HARDWARE_DRIVER: DWORD = 0x0000000d; +pub const SHTDN_REASON_MINOR_OTHERDRIVER: DWORD = 0x0000000e; +pub const SHTDN_REASON_MINOR_BLUESCREEN: DWORD = 0x0000000F; +pub const SHTDN_REASON_MINOR_SERVICEPACK: DWORD = 0x00000010; +pub const SHTDN_REASON_MINOR_HOTFIX: DWORD = 0x00000011; +pub const SHTDN_REASON_MINOR_SECURITYFIX: DWORD = 0x00000012; +pub const SHTDN_REASON_MINOR_SECURITY: DWORD = 0x00000013; +pub const SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY: DWORD = 0x00000014; +pub const SHTDN_REASON_MINOR_WMI: DWORD = 0x00000015; +pub const SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL: DWORD = 0x00000016; +pub const SHTDN_REASON_MINOR_HOTFIX_UNINSTALL: DWORD = 0x00000017; +pub const SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL: DWORD = 0x00000018; +pub const SHTDN_REASON_MINOR_MMC: DWORD = 0x00000019; +pub const SHTDN_REASON_MINOR_SYSTEMRESTORE: DWORD = 0x0000001a; +pub const SHTDN_REASON_MINOR_TERMSRV: DWORD = 0x00000020; +pub const SHTDN_REASON_MINOR_DC_PROMOTION: DWORD = 0x00000021; +pub const SHTDN_REASON_MINOR_DC_DEMOTION: DWORD = 0x00000022; +pub const SHTDN_REASON_UNKNOWN: DWORD = SHTDN_REASON_MINOR_NONE; +pub const SHTDN_REASON_LEGACY_API: DWORD = SHTDN_REASON_MAJOR_LEGACY_API + | SHTDN_REASON_FLAG_PLANNED; +pub const SHTDN_REASON_VALID_BIT_MASK: DWORD = 0xc0ffffff; +pub const PCLEANUI: DWORD = SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_CLEAN_UI; +pub const UCLEANUI: DWORD = SHTDN_REASON_FLAG_CLEAN_UI; +pub const PDIRTYUI: DWORD = SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_DIRTY_UI; +pub const UDIRTYUI: DWORD = SHTDN_REASON_FLAG_DIRTY_UI; diff --git a/src/vendor/winapi/src/um/restrictederrorinfo.rs b/src/vendor/winapi/src/um/restrictederrorinfo.rs new file mode 100644 index 0000000000..2da7272a8e --- /dev/null +++ b/src/vendor/winapi/src/um/restrictederrorinfo.rs @@ -0,0 +1,25 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. + +use shared::wtypes::BSTR; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::HRESULT; + +RIDL!( +#[uuid(0x82ba7092, 0x4c88, 0x427d, 0xa7, 0xbc, 0x16, 0xdd, 0x93, 0xfe, 0xb6, 0x7e)] +interface IRestrictedErrorInfo(IRestrictedErrorInfoVtbl): IUnknown(IUnknownVtbl) { + fn GetErrorDetails( + description: *mut BSTR, + error: *mut HRESULT, + restrictedDescription: *mut BSTR, + capabilitySid: *mut BSTR, + ) -> HRESULT, + fn GetReference( + reference: *mut BSTR, + ) -> HRESULT, +} +); diff --git a/src/vendor/winapi/src/um/rmxfguid.rs b/src/vendor/winapi/src/um/rmxfguid.rs new file mode 100644 index 0000000000..101ddc0dec --- /dev/null +++ b/src/vendor/winapi/src/um/rmxfguid.rs @@ -0,0 +1,68 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{TID_D3DRMInfo, + 0x2b957100, 0x9e9a, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMMesh, + 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMVector, + 0x3d82ab5e, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMMeshFace, + 0x3d82ab5f, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMMaterial, + 0x3d82ab4d, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMMaterialArray, + 0x35ff44e1, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMFrame, + 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMFrameTransformMatrix, + 0xf6f23f41, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMeshMaterialList, + 0xf6f23f42, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMeshTextureCoords, + 0xf6f23f40, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMeshNormals, + 0xf6f23f43, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMCoords2d, + 0xf6f23f44, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMatrix4x4, + 0xf6f23f45, 0x7686, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMAnimation, + 0x3d82ab4f, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMAnimationSet, + 0x3d82ab50, 0x62da, 0x11cf, 0xab, 0x39, 0x00, 0x20, 0xaf, 0x71, 0xe4, 0x33} +DEFINE_GUID!{TID_D3DRMAnimationKey, + 0x10dd46a8, 0x775b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMFloatKeys, + 0x10dd46a9, 0x775b, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMaterialAmbientColor, + 0x01411840, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMaterialDiffuseColor, + 0x01411841, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMaterialSpecularColor, + 0x01411842, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMaterialEmissiveColor, + 0xd3e16e80, 0x7835, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMaterialPower, + 0x01411843, 0x7786, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMColorRGBA, + 0x35ff44e0, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMColorRGB, + 0xd3e16e81, 0x7835, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMGuid, + 0xa42790e0, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMTextureFilename, + 0xa42790e1, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMTextureReference, + 0xa42790e2, 0x7810, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMIndexedColor, + 0x1630b820, 0x7842, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMeshVertexColors, + 0x1630b821, 0x7842, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMMaterialWrap, + 0x4885ae60, 0x78e8, 0x11cf, 0x8f, 0x52, 0x00, 0x40, 0x33, 0x35, 0x94, 0xa3} +DEFINE_GUID!{TID_D3DRMBoolean, + 0x537da6a0, 0xca37, 0x11d0, 0x94, 0x1c, 0x00, 0x80, 0xc8, 0x0c, 0xfa, 0x7b} diff --git a/src/vendor/winapi/src/um/sapi.rs b/src/vendor/winapi/src/um/sapi.rs new file mode 100644 index 0000000000..8fb3132e32 --- /dev/null +++ b/src/vendor/winapi/src/um/sapi.rs @@ -0,0 +1,1389 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! SAPI 5.4 definitions +use shared::guiddef::GUID; +use shared::minwindef::{BYTE, ULONG, WORD}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPWSTR, ULONGLONG}; +pub use um::sapi53::{ + SPDATAKEYLOCATION, + SPDKL_DefaultLocation, + SPDKL_CurrentUser, + SPDKL_LocalMachine, + SPDKL_CurrentConfig, + SPDUI_EngineProperties, + SPDUI_AddRemoveWord, + SPDUI_UserTraining, + SPDUI_MicTraining, + SPDUI_RecoProfileProperties, + SPDUI_AudioProperties, + SPDUI_AudioVolume, + SPDUI_UserEnrollment, + SPDUI_ShareData, + SPDUI_Tutorial, + SPSTREAMFORMAT, + SPSF_Default, + SPSF_NoAssignedFormat, + SPSF_Text, + SPSF_NonStandardFormat, + SPSF_ExtendedAudioFormat, + SPSF_8kHz8BitMono, + SPSF_8kHz8BitStereo, + SPSF_8kHz16BitMono, + SPSF_8kHz16BitStereo, + SPSF_11kHz8BitMono, + SPSF_11kHz8BitStereo, + SPSF_11kHz16BitMono, + SPSF_11kHz16BitStereo, + SPSF_12kHz8BitMono, + SPSF_12kHz8BitStereo, + SPSF_12kHz16BitMono, + SPSF_12kHz16BitStereo, + SPSF_16kHz8BitMono, + SPSF_16kHz8BitStereo, + SPSF_16kHz16BitMono, + SPSF_16kHz16BitStereo, + SPSF_22kHz8BitMono, + SPSF_22kHz8BitStereo, + SPSF_22kHz16BitMono, + SPSF_22kHz16BitStereo, + SPSF_24kHz8BitMono, + SPSF_24kHz8BitStereo, + SPSF_24kHz16BitMono, + SPSF_24kHz16BitStereo, + SPSF_32kHz8BitMono, + SPSF_32kHz8BitStereo, + SPSF_32kHz16BitMono, + SPSF_32kHz16BitStereo, + SPSF_44kHz8BitMono, + SPSF_44kHz8BitStereo, + SPSF_44kHz16BitMono, + SPSF_44kHz16BitStereo, + SPSF_48kHz8BitMono, + SPSF_48kHz8BitStereo, + SPSF_48kHz16BitMono, + SPSF_48kHz16BitStereo, + SPSF_TrueSpeech_8kHz1BitMono, + SPSF_CCITT_ALaw_8kHzMono, + SPSF_CCITT_ALaw_8kHzStereo, + SPSF_CCITT_ALaw_11kHzMono, + SPSF_CCITT_ALaw_11kHzStereo, + SPSF_CCITT_ALaw_22kHzMono, + SPSF_CCITT_ALaw_22kHzStereo, + SPSF_CCITT_ALaw_44kHzMono, + SPSF_CCITT_ALaw_44kHzStereo, + SPSF_CCITT_uLaw_8kHzMono, + SPSF_CCITT_uLaw_8kHzStereo, + SPSF_CCITT_uLaw_11kHzMono, + SPSF_CCITT_uLaw_11kHzStereo, + SPSF_CCITT_uLaw_22kHzMono, + SPSF_CCITT_uLaw_22kHzStereo, + SPSF_CCITT_uLaw_44kHzMono, + SPSF_CCITT_uLaw_44kHzStereo, + SPSF_ADPCM_8kHzMono, + SPSF_ADPCM_8kHzStereo, + SPSF_ADPCM_11kHzMono, + SPSF_ADPCM_11kHzStereo, + SPSF_ADPCM_22kHzMono, + SPSF_ADPCM_22kHzStereo, + SPSF_ADPCM_44kHzMono, + SPSF_ADPCM_44kHzStereo, + SPSF_GSM610_8kHzMono, + SPSF_GSM610_11kHzMono, + SPSF_GSM610_22kHzMono, + SPSF_GSM610_44kHzMono, + SPSF_NUM_FORMATS, + SPDFID_Text, + SPDFID_WaveFormatEx, + SPREG_USER_ROOT, + SPREG_LOCAL_MACHINE_ROOT, + SPCAT_AUDIOOUT, + SPCAT_AUDIOIN, + SPCAT_VOICES, + SPCAT_RECOGNIZERS, + SPCAT_APPLEXICONS, + SPCAT_PHONECONVERTERS, + SPCAT_TEXTNORMALIZERS, + SPCAT_RECOPROFILES, + SPMMSYS_AUDIO_IN_TOKEN_ID, + SPMMSYS_AUDIO_OUT_TOKEN_ID, + SPCURRENT_USER_LEXICON_TOKEN_ID, + SPTOKENVALUE_CLSID, + SPTOKENKEY_FILES, + SPTOKENKEY_UI, + SPTOKENKEY_ATTRIBUTES, + SPTOKENKEY_RETAINEDAUDIO, + SPTOKENKEY_AUDIO_LATENCY_WARNING, + SPTOKENKEY_AUDIO_LATENCY_TRUNCATE, + SPTOKENKEY_AUDIO_LATENCY_UPDATE_INTERVAL, + SPVOICECATEGORY_TTSRATE, + SPPROP_RESOURCE_USAGE, + SPPROP_HIGH_CONFIDENCE_THRESHOLD, + SPPROP_NORMAL_CONFIDENCE_THRESHOLD, + SPPROP_LOW_CONFIDENCE_THRESHOLD, + SPPROP_RESPONSE_SPEED, + SPPROP_COMPLEX_RESPONSE_SPEED, + SPPROP_ADAPTATION_ON, + SPPROP_PERSISTED_BACKGROUND_ADAPTATION, + SPPROP_PERSISTED_LANGUAGE_MODEL_ADAPTATION, + SPPROP_UX_IS_LISTENING, + SPTOPIC_SPELLING, + SPWILDCARD, + SPDICTATION, + SPREG_SAFE_USER_TOKENS, + SPINFDICTATION, + SP_LOW_CONFIDENCE, + SP_NORMAL_CONFIDENCE, + SP_HIGH_CONFIDENCE, + DEFAULT_WEIGHT, + SP_MAX_WORD_LENGTH, + SP_MAX_PRON_LENGTH, + SP_EMULATE_RESULT, + ISpNotifyCallback, + SPNOTIFYCALLBACK, + ISpNotifySource, ISpNotifySourceVtbl, + ISpNotifySink, ISpNotifySinkVtbl, + ISpNotifyTranslator, ISpNotifyTranslatorVtbl, + ISpDataKey, ISpDataKeyVtbl, + ISpRegDataKey, ISpRegDataKeyVtbl, + ISpObjectTokenCategory, ISpObjectTokenCategoryVtbl, + ISpObjectToken, ISpObjectTokenVtbl, + ISpObjectTokenInit, ISpObjectTokenInitVtbl, + IEnumSpObjectTokens, IEnumSpObjectTokensVtbl, + ISpObjectWithToken, ISpObjectWithTokenVtbl, + ISpResourceManager, ISpResourceManagerVtbl, + SPEVENTLPARAMTYPE, + SPET_LPARAM_IS_UNDEFINED, + SPET_LPARAM_IS_TOKEN, + SPET_LPARAM_IS_OBJECT, + SPET_LPARAM_IS_POINTER, + SPET_LPARAM_IS_STRING, + SPEVENTENUM, + SPEI_UNDEFINED, + SPEI_START_INPUT_STREAM, + SPEI_END_INPUT_STREAM, + SPEI_VOICE_CHANGE, + SPEI_TTS_BOOKMARK, + SPEI_WORD_BOUNDARY, + SPEI_PHONEME, + SPEI_SENTENCE_BOUNDARY, + SPEI_VISEME, + SPEI_TTS_AUDIO_LEVEL, + SPEI_TTS_PRIVATE, + SPEI_MIN_TTS, + SPEI_MAX_TTS, + SPEI_END_SR_STREAM, + SPEI_SOUND_START, + SPEI_SOUND_END, + SPEI_PHRASE_START, + SPEI_RECOGNITION, + SPEI_HYPOTHESIS, + SPEI_SR_BOOKMARK, + SPEI_PROPERTY_NUM_CHANGE, + SPEI_PROPERTY_STRING_CHANGE, + SPEI_FALSE_RECOGNITION, + SPEI_INTERFERENCE, + SPEI_REQUEST_UI, + SPEI_RECO_STATE_CHANGE, + SPEI_ADAPTATION, + SPEI_START_SR_STREAM, + SPEI_RECO_OTHER_CONTEXT, + SPEI_SR_AUDIO_LEVEL, + SPEI_SR_RETAINEDAUDIO, + SPEI_SR_PRIVATE, +}; +pub const ACTIVE_CATEGORY_CHANGED: SPEVENTENUM = 53; +pub use um::sapi53::{ + SPEI_RESERVED5, + SPEI_RESERVED6, + SPEI_MIN_SR, + SPEI_MAX_SR, + SPEI_RESERVED1, + SPEI_RESERVED2, + SPEI_RESERVED3, + SPFEI_FLAGCHECK, + SPFEI_ALL_TTS_EVENTS, + SPFEI_ALL_SR_EVENTS, + SPFEI_ALL_EVENTS, + SPFEI, + SPEVENT, + SPSERIALIZEDEVENT, + SPSERIALIZEDEVENT64, + SPEVENTEX, + SPINTERFERENCE, + SPINTERFERENCE_NONE, + SPINTERFERENCE_NOISE, + SPINTERFERENCE_NOSIGNAL, + SPINTERFERENCE_TOOLOUD, + SPINTERFERENCE_TOOQUIET, + SPINTERFERENCE_TOOFAST, + SPINTERFERENCE_TOOSLOW, + SPINTERFERENCE_LATENCY_WARNING, + SPINTERFERENCE_LATENCY_TRUNCATE_BEGIN, + SPINTERFERENCE_LATENCY_TRUNCATE_END, + SPENDSRSTREAMFLAGS, + SPESF_NONE, + SPESF_STREAM_RELEASED, + SPESF_EMULATED, + SPVFEATURE, + SPVFEATURE_STRESSED, + SPVFEATURE_EMPHASIS, + SPVISEMES, + SP_VISEME_0, + SP_VISEME_1, + SP_VISEME_2, + SP_VISEME_3, + SP_VISEME_4, + SP_VISEME_5, + SP_VISEME_6, + SP_VISEME_7, + SP_VISEME_8, + SP_VISEME_9, + SP_VISEME_10, + SP_VISEME_11, + SP_VISEME_12, + SP_VISEME_13, + SP_VISEME_14, + SP_VISEME_15, + SP_VISEME_16, + SP_VISEME_17, + SP_VISEME_18, + SP_VISEME_19, + SP_VISEME_20, + SP_VISEME_21, + SPEVENTSOURCEINFO, + ISpEventSource, ISpEventSourceVtbl, + ISpEventSource2, ISpEventSource2Vtbl, + ISpEventSink, ISpEventSinkVtbl, + ISpStreamFormat, ISpStreamFormatVtbl, + SPFILEMODE, + SPFM_OPEN_READONLY, + SPFM_OPEN_READWRITE, + SPFM_CREATE, + SPFM_CREATE_ALWAYS, + SPFM_NUM_MODES, + ISpStream, ISpStreamVtbl, + ISpStreamFormatConverter, ISpStreamFormatConverterVtbl, + SPAUDIOSTATE, + SPAS_CLOSED, + SPAS_STOP, + SPAS_PAUSE, + SPAS_RUN, + SPAUDIOSTATUS, + SPAUDIOBUFFERINFO, + ISpAudio, ISpAudioVtbl, + ISpMMSysAudio, ISpMMSysAudioVtbl, + ISpTranscript, ISpTranscriptVtbl, + SPDISPLAYATTRIBUTES, + SPAF_ONE_TRAILING_SPACE, + SPAF_TWO_TRAILING_SPACES, + SPAF_CONSUME_LEADING_SPACES, + SPAF_BUFFER_POSITION, + SPAF_ALL, + SPAF_USER_SPECIFIED, + SPPHONEID, + PSPPHONEID, + PCSPPHONEID, + SPPHRASEELEMENT, + SPPHRASERULE, + SPPHRASEPROPERTYUNIONTYPE, + SPPPUT_UNUSED, + SPPPUT_ARRAY_INDEX, + SPPHRASEPROPERTY, + SPPHRASEREPLACEMENT, + SPSEMANTICERRORINFO, + SPSEMANTICFORMAT, + SPPHRASE_50, +// SPPHRASESIZE_500, +}; +pub use um::sapi53::SPPHRASE as SPPHRASE_53; +STRUCT!{struct SPPHRASE { + cbSize: ULONG, + LangID: WORD, + wHomophoneGroupId: WORD, + ullGrammarID: ULONGLONG, + ftStartTime: ULONGLONG, + ullAudioStreamPosition: ULONGLONG, + ulAudioSizeBytes: ULONG, + ulRetainedSizeBytes: ULONG, + ulAudioSizeTime: ULONG, + Rule: SPPHRASERULE, + pProperties: *const SPPHRASEPROPERTY, + pElements: *const SPPHRASEELEMENT, + cReplacements: ULONG, + pReplacements: *const SPPHRASEREPLACEMENT, + SREngineID: GUID, + ulSREnginePrivateDataSize: ULONG, + pSREnginePrivateData: *const BYTE, + pSML: LPWSTR, + pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, + SemanticTagFormat: SPSEMANTICFORMAT, +}} +pub use um::sapi53::{ + SPSERIALIZEDPHRASE, + SPRULE, + SPVALUETYPE, + SPDF_PROPERTY, + SPDF_REPLACEMENT, + SPDF_RULE, + SPDF_DISPLAYTEXT, + SPDF_LEXICALFORM , + SPDF_PRONUNCIATION, + SPDF_AUDIO, + SPDF_ALTERNATES, + SPDF_ALL, + SPBINARYGRAMMAR, + SPPHRASERNG, + SPPR_ALL_ELEMENTS, + SP_GETWHOLEPHRASE, + SPRR_ALL_ELEMENTS, + SPSTATEHANDLE, + SPRECOEVENTFLAGS, + SPREF_AutoPause, + SPREF_Emulated, + SPREF_SMLTimeout, + SPREF_ExtendableParse, + SPREF_ReSent, + SPREF_Hypothesis, + SPREF_FalseRecognition, + SPPARTOFSPEECH, + SPPS_NotOverriden, + SPPS_Unknown, + SPPS_Noun, + SPPS_Verb, + SPPS_Modifier, + SPPS_Function, + SPPS_Interjection, + SPPS_Noncontent, + SPPS_LMA, + SPPS_SuppressWord, + SPLEXICONTYPE, + eLEXTYPE_USER, + eLEXTYPE_APP, + eLEXTYPE_VENDORLEXICON, + eLEXTYPE_LETTERTOSOUND, + eLEXTYPE_MORPHOLOGY, + eLEXTYPE_RESERVED4, + eLEXTYPE_USER_SHORTCUT, + eLEXTYPE_RESERVED6, + eLEXTYPE_RESERVED7, + eLEXTYPE_RESERVED8, + eLEXTYPE_RESERVED9, + eLEXTYPE_RESERVED10, + eLEXTYPE_PRIVATE1, + eLEXTYPE_PRIVATE2, + eLEXTYPE_PRIVATE3, + eLEXTYPE_PRIVATE4, + eLEXTYPE_PRIVATE5, + eLEXTYPE_PRIVATE6, + eLEXTYPE_PRIVATE7, + eLEXTYPE_PRIVATE8, + eLEXTYPE_PRIVATE9, + eLEXTYPE_PRIVATE10, + eLEXTYPE_PRIVATE11, + eLEXTYPE_PRIVATE12, + eLEXTYPE_PRIVATE13, + eLEXTYPE_PRIVATE14, + eLEXTYPE_PRIVATE15, + eLEXTYPE_PRIVATE16, + eLEXTYPE_PRIVATE17, + eLEXTYPE_PRIVATE18, + eLEXTYPE_PRIVATE19, + eLEXTYPE_PRIVATE20, + SPWORDTYPE, + eWORDTYPE_ADDED, + eWORDTYPE_DELETED, + SPPRONUNCIATIONFLAGS, + ePRONFLAG_USED, + SPWORDPRONUNCIATION, + SPWORDPRONUNCIATIONLIST, + SPWORD, + SPWORDLIST, + ISpLexicon, ISpLexiconVtbl, + ISpContainerLexicon, ISpContainerLexiconVtbl, + SPSHORTCUTTYPE, + SPSHT_NotOverriden, + SPSHT_Unknown, + SPSHT_EMAIL, + SPSHT_OTHER, + SPPS_RESERVED1, + SPPS_RESERVED2, + SPPS_RESERVED3, + SPPS_RESERVED4, + SPSHORTCUTPAIR, + SPSHORTCUTPAIRLIST, + ISpShortcut, ISpShortcutVtbl, + ISpPhoneConverter, ISpPhoneConverterVtbl, + ISpPhoneticAlphabetConverter, ISpPhoneticAlphabetConverterVtbl, + ISpPhoneticAlphabetSelection, ISpPhoneticAlphabetSelectionVtbl, + SPVPITCH, + SPVACTIONS, + SPVA_Speak, + SPVA_Silence, + SPVA_Pronounce, + SPVA_Bookmark, + SPVA_SpellOut, + SPVA_Section, + SPVA_ParseUnknownTag, + SPVCONTEXT, + SPVSTATE, + SPRUNSTATE, + SPRS_DONE, + SPRS_IS_SPEAKING, + SPVLIMITS, + SPMIN_VOLUME, + SPMAX_VOLUME, + SPMIN_RATE, + SPMAX_RATE, + SPVPRIORITY, + SPVPRI_NORMAL, + SPVPRI_ALERT, + SPVPRI_OVER, + SPVOICESTATUS, + SPEAKFLAGS, + SPF_DEFAULT, + SPF_ASYNC, + SPF_PURGEBEFORESPEAK, + SPF_IS_FILENAME, + SPF_IS_XML, + SPF_IS_NOT_XML, + SPF_PERSIST_XML, + SPF_NLP_SPEAK_PUNC, + SPF_PARSE_SAPI, + SPF_PARSE_SSML, + SPF_PARSE_AUTODETECT, + SPF_NLP_MASK, + SPF_PARSE_MASK, + SPF_VOICE_MASK, + SPF_UNUSED_FLAGS, + ISpVoice, ISpVoiceVtbl, + ISpPhrase, ISpPhraseVtbl, + ISpPhraseAlt, ISpPhraseAltVtbl, + SPXMLRESULTOPTIONS, + SPXRO_SML, + SPXRO_Alternates_SML, + ISpPhrase2, ISpPhrase2Vtbl, + SPRECORESULTTIMES, + SPSERIALIZEDRESULT, + ISpRecoResult, ISpRecoResultVtbl, + SPCOMMITFLAGS, + SPCF_NONE, + SPCF_ADD_TO_USER_LEXICON, + SPCF_DEFINITE_CORRECTION, + ISpRecoResult2, ISpRecoResult2Vtbl, + ISpXMLRecoResult, ISpXMLRecoResultVtbl, + SPTEXTSELECTIONINFO, + SPWORDPRONOUNCEABLE, + SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE, + SPWP_KNOWN_WORD_PRONOUNCEABLE, + SPGRAMMARSTATE, + SPGS_DISABLED, + SPGS_ENABLED, + SPGS_EXCLUSIVE, + SPCONTEXTSTATE, + SPCS_DISABLED, + SPCS_ENABLED, + SPRULESTATE, + SPRS_INACTIVE, + SPRS_ACTIVE, + SPRS_ACTIVE_WITH_AUTO_PAUSE, + SPWT_LEXICAL_NO_SPECIAL_CHARS, + SPPROPERTYINFO, + SPCFGRULEATTRIBUTES, + SPRAF_TopLevel, + SPRAF_Active, + SPRAF_Export, + SPRAF_Import, + SPRAF_Interpreter, + SPRAF_Dynamic, + SPRAF_Root, + SPRAF_AutoPause, + SPRAF_UserDelimited, + ISpGrammarBuilder, ISpGrammarBuilderVtbl, + SPLOADOPTIONS, + SPLO_STATIC, + SPLO_DYNAMIC, + ISpRecoGrammar, ISpRecoGrammarVtbl, + SPMATCHINGMODE, + AllWords, + Subsequence, + OrderedSubset, + SubsequenceContentRequired, + OrderedSubsetContentRequired, + PHONETICALPHABET, + PA_Ipa, + PA_Ups, + PA_Sapi, + ISpGrammarBuilder2, ISpGrammarBuilder2Vtbl, + SPRP_NORMAL, + ISpRecoGrammar2, ISpRecoGrammar2Vtbl, + ISpeechResourceLoader, ISpeechResourceLoaderVtbl, + SPRECOCONTEXTSTATUS, + SPBOOKMARKOPTIONS, + SPBO_NONE, + SPBO_PAUSE, + SPBO_AHEAD, + SPBO_TIME_UNITS, + SPAUDIOOPTIONS, + SPAO_NONE, + SPAO_RETAIN_AUDIO, + ISpRecoContext, ISpRecoContextVtbl, + SPGRAMMAROPTIONS, + SPGO_SAPI, + SPGO_SRGS, + SPGO_UPS, + SPGO_SRGS_MS_SCRIPT, + SPGO_SRGS_W3C_SCRIPT, + SPGO_SRGS_STG_SCRIPT, + SPGO_SRGS_SCRIPT, + SPGO_FILE, + SPGO_HTTP, + SPGO_RES, + SPGO_OBJECT, + SPGO_DEFAULT, + SPGO_ALL, + SPADAPTATIONSETTINGS, + SPADS_Default, + SPADS_CurrentRecognizer, + SPADS_RecoProfile, + SPADS_Immediate, + SPADS_Reset, + SPADS_HighVolumeDataSource, + SPADAPTATIONRELEVANCE, + SPAR_Unknown, + SPAR_Low, + SPAR_Medium, + SPAR_High, + ISpRecoContext2, ISpRecoContext2Vtbl, + ISpProperties, ISpPropertiesVtbl, + SP_MAX_LANGIDS, + SPRECOGNIZERSTATUS, + SPWAVEFORMATTYPE, + SPWF_INPUT, + SPWF_SRENGINE, + SPSTREAMFORMATTYPE, + SPRECOSTATE, + SPRST_INACTIVE, + SPRST_ACTIVE, + SPRST_ACTIVE_ALWAYS, + SPRST_INACTIVE_WITH_PURGE, + SPRST_NUM_STATES, + ISpRecognizer, ISpRecognizerVtbl, + ISpSerializeState, ISpSerializeStateVtbl, + ISpRecognizer2, ISpRecognizer2Vtbl, +}; +ENUM!{enum SPCATEGORYTYPE { + SPCT_COMMAND, + SPCT_DICTATION, + SPCT_SLEEP, + SPCT_SUB_COMMAND, + SPCT_SUB_DICTATION, +}} +RIDL!(#[uuid(0xda0cd0f9, 0x14a2, 0x4f09, 0x8c, 0x2a, 0x85, 0xcc, 0x48, 0x97, 0x93, 0x45)] +interface ISpRecoCategory(ISpRecoCategoryVtbl): IUnknown(IUnknownVtbl) { + fn GetType( + peCategoryType: *mut SPCATEGORYTYPE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xdf1b943c, 0x5838, 0x4aa2, 0x87, 0x06, 0xd7, 0xcd, 0x5b, 0x33, 0x34, 0x99)] +interface ISpRecognizer3(ISpRecognizer3Vtbl): IUnknown(IUnknownVtbl) { + fn GetCategory( + categoryType: SPCATEGORYTYPE, + ppCategory: *mut *mut ISpRecoCategory, + ) -> HRESULT, + fn SetActiveCategory( + pCategory: *mut ISpRecoCategory, + ) -> HRESULT, + fn GetActiveCategory( + ppCategory: *mut *mut ISpRecoCategory, + ) -> HRESULT, +}); +pub use um::sapi53::{ + SPNORMALIZATIONLIST, + ISpEnginePronunciation, ISpEnginePronunciationVtbl, + SPDISPLAYTOKEN, + SPDISPLAYPHRASE, + ISpDisplayAlternates, ISpDisplayAlternatesVtbl, + SpeechLanguageId, + DISPID_SpeechDataKey, + DISPID_SDKSetBinaryValue, + DISPID_SDKGetBinaryValue, + DISPID_SDKSetStringValue, + DISPID_SDKGetStringValue, + DISPID_SDKSetLongValue, + DISPID_SDKGetlongValue, + DISPID_SDKOpenKey, + DISPID_SDKCreateKey, + DISPID_SDKDeleteKey, + DISPID_SDKDeleteValue, + DISPID_SDKEnumKeys, + DISPID_SDKEnumValues, + DISPID_SpeechObjectToken, + DISPID_SOTId, + DISPID_SOTDataKey, + DISPID_SOTCategory, + DISPID_SOTGetDescription, + DISPID_SOTSetId, + DISPID_SOTGetAttribute, + DISPID_SOTCreateInstance, + DISPID_SOTRemove, + DISPID_SOTGetStorageFileName, + DISPID_SOTRemoveStorageFileName, + DISPID_SOTIsUISupported, + DISPID_SOTDisplayUI, + DISPID_SOTMatchesAttributes, + SpeechDataKeyLocation, + SDKLDefaultLocation, + SDKLCurrentUser, + SDKLLocalMachine, + SDKLCurrentConfig, + SpeechTokenContext, + STCInprocServer, + STCInprocHandler , + STCLocalServer, + STCRemoteServer, + STCAll, + SpeechTokenShellFolder, + STSF_AppData, + STSF_LocalAppData, + STSF_CommonAppData, + STSF_FlagCreate, + DISPID_SpeechObjectTokens, + DISPID_SOTsCount, + DISPID_SOTsItem, + DISPID_SOTs_NewEnum, + DISPID_SpeechObjectTokenCategory, + DISPID_SOTCId, + DISPID_SOTCDefault, + DISPID_SOTCSetId, + DISPID_SOTCGetDataKey, + DISPID_SOTCEnumerateTokens, + SpeechAudioFormatType, + SAFTDefault, + SAFTNoAssignedFormat, + SAFTText, + SAFTNonStandardFormat, + SAFTExtendedAudioFormat, + SAFT8kHz8BitMono, + SAFT8kHz8BitStereo, + SAFT8kHz16BitMono, + SAFT8kHz16BitStereo, + SAFT11kHz8BitMono, + SAFT11kHz8BitStereo, + SAFT11kHz16BitMono, + SAFT11kHz16BitStereo, + SAFT12kHz8BitMono, + SAFT12kHz8BitStereo, + SAFT12kHz16BitMono, + SAFT12kHz16BitStereo, + SAFT16kHz8BitMono, + SAFT16kHz8BitStereo, + SAFT16kHz16BitMono, + SAFT16kHz16BitStereo, + SAFT22kHz8BitMono, + SAFT22kHz8BitStereo, + SAFT22kHz16BitMono, + SAFT22kHz16BitStereo, + SAFT24kHz8BitMono, + SAFT24kHz8BitStereo, + SAFT24kHz16BitMono, + SAFT24kHz16BitStereo, + SAFT32kHz8BitMono, + SAFT32kHz8BitStereo, + SAFT32kHz16BitMono, + SAFT32kHz16BitStereo, + SAFT44kHz8BitMono, + SAFT44kHz8BitStereo, + SAFT44kHz16BitMono, + SAFT44kHz16BitStereo, + SAFT48kHz8BitMono, + SAFT48kHz8BitStereo, + SAFT48kHz16BitMono, + SAFT48kHz16BitStereo, + SAFTTrueSpeech_8kHz1BitMono, + SAFTCCITT_ALaw_8kHzMono, + SAFTCCITT_ALaw_8kHzStereo, + SAFTCCITT_ALaw_11kHzMono, + SAFTCCITT_ALaw_11kHzStereo, + SAFTCCITT_ALaw_22kHzMono, + SAFTCCITT_ALaw_22kHzStereo, + SAFTCCITT_ALaw_44kHzMono, + SAFTCCITT_ALaw_44kHzStereo, + SAFTCCITT_uLaw_8kHzMono, + SAFTCCITT_uLaw_8kHzStereo, + SAFTCCITT_uLaw_11kHzMono, + SAFTCCITT_uLaw_11kHzStereo, + SAFTCCITT_uLaw_22kHzMono, + SAFTCCITT_uLaw_22kHzStereo, + SAFTCCITT_uLaw_44kHzMono, + SAFTCCITT_uLaw_44kHzStereo, + SAFTADPCM_8kHzMono, + SAFTADPCM_8kHzStereo, + SAFTADPCM_11kHzMono, + SAFTADPCM_11kHzStereo, + SAFTADPCM_22kHzMono, + SAFTADPCM_22kHzStereo, + SAFTADPCM_44kHzMono, + SAFTADPCM_44kHzStereo, + SAFTGSM610_8kHzMono, + SAFTGSM610_11kHzMono, + SAFTGSM610_22kHzMono, + SAFTGSM610_44kHzMono, + DISPID_SpeechAudioFormat, + DISPID_SAFType, + DISPID_SAFGuid, + DISPID_SAFGetWaveFormatEx, + DISPID_SAFSetWaveFormatEx, + DISPID_SpeechBaseStream, + DISPID_SBSFormat, + DISPID_SBSRead, + DISPID_SBSWrite, + DISPID_SBSSeek, + SpeechStreamSeekPositionType, + SSSPTRelativeToStart, + SSSPTRelativeToCurrentPosition, + SSSPTRelativeToEnd, + DISPID_SpeechAudio, + DISPID_SAStatus, + DISPID_SABufferInfo, + DISPID_SADefaultFormat, + DISPID_SAVolume, + DISPID_SABufferNotifySize, + DISPID_SAEventHandle, + DISPID_SASetState, + SpeechAudioState, + SASClosed, + SASStop, + SASPause, + SASRun, + DISPID_SpeechMMSysAudio, + DISPID_SMSADeviceId, + DISPID_SMSALineId, + DISPID_SMSAMMHandle, + DISPID_SpeechFileStream, + DISPID_SFSOpen, + DISPID_SFSClose, + SpeechStreamFileMode, + SSFMOpenForRead, + SSFMOpenReadWrite, + SSFMCreate, + SSFMCreateForWrite, + DISPID_SpeechCustomStream, + DISPID_SCSBaseStream, + DISPID_SpeechMemoryStream, + DISPID_SMSSetData, + DISPID_SMSGetData, + DISPID_SpeechAudioStatus, + DISPID_SASFreeBufferSpace, + DISPID_SASNonBlockingIO, + DISPID_SASState, + DISPID_SASCurrentSeekPosition, + DISPID_SASCurrentDevicePosition, + DISPID_SpeechAudioBufferInfo, + DISPID_SABIMinNotification, + DISPID_SABIBufferSize, + DISPID_SABIEventBias, + DISPID_SpeechWaveFormatEx, + DISPID_SWFEFormatTag, + DISPID_SWFEChannels, + DISPID_SWFESamplesPerSec, + DISPID_SWFEAvgBytesPerSec, + DISPID_SWFEBlockAlign, + DISPID_SWFEBitsPerSample, + DISPID_SWFEExtraData, + DISPID_SpeechVoice, + DISPID_SVStatus, + DISPID_SVVoice, + DISPID_SVAudioOutput, + DISPID_SVAudioOutputStream, + DISPID_SVRate, + DISPID_SVVolume, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet, + DISPID_SVEventInterests, + DISPID_SVPriority, + DISPID_SVAlertBoundary, + DISPID_SVSyncronousSpeakTimeout, + DISPID_SVSpeak, + DISPID_SVSpeakStream, + DISPID_SVPause, + DISPID_SVResume, + DISPID_SVSkip, + DISPID_SVGetVoices, + DISPID_SVGetAudioOutputs, + DISPID_SVWaitUntilDone, + DISPID_SVSpeakCompleteEvent, + DISPID_SVIsUISupported, + DISPID_SVDisplayUI, + SpeechVoicePriority, + SVPNormal, + SVPAlert, + SVPOver, + SpeechVoiceSpeakFlags, + SVSFDefault, + SVSFlagsAsync, + SVSFPurgeBeforeSpeak, + SVSFIsFilename, + SVSFIsXML, + SVSFIsNotXML, + SVSFPersistXML, + SVSFNLPSpeakPunc, + SVSFParseSapi, + SVSFParseSsml, + SVSFParseAutodetect, + SVSFNLPMask, + SVSFParseMask, + SVSFVoiceMask, + SVSFUnusedFlags, + SpeechVoiceEvents, + SVEStartInputStream, + SVEEndInputStream, + SVEVoiceChange, + SVEBookmark, + SVEWordBoundary, + SVEPhoneme, + SVESentenceBoundary, + SVEViseme, + SVEAudioLevel, + SVEPrivate, + SVEAllEvents, + DISPID_SpeechVoiceStatus, + DISPID_SVSCurrentStreamNumber, + DISPID_SVSLastStreamNumberQueued, + DISPID_SVSLastResult, + DISPID_SVSRunningState, + DISPID_SVSInputWordPosition, + DISPID_SVSInputWordLength, + DISPID_SVSInputSentencePosition, + DISPID_SVSInputSentenceLength, + DISPID_SVSLastBookmark, + DISPID_SVSLastBookmarkId, + DISPID_SVSPhonemeId, + DISPID_SVSVisemeId, + SpeechRunState, + SRSEDone, + SRSEIsSpeaking, + SpeechVisemeType, + SVP_0, + SVP_1, + SVP_2, + SVP_3, + SVP_4, + SVP_5, + SVP_6, + SVP_7, + SVP_8, + SVP_9, + SVP_10, + SVP_11, + SVP_12, + SVP_13, + SVP_14, + SVP_15, + SVP_16, + SVP_17, + SVP_18, + SVP_19, + SVP_20, + SVP_21, + SpeechVisemeFeature, + SVF_None, + SVF_Stressed, + SVF_Emphasis, + DISPID_SpeechVoiceEvent, + DISPID_SVEStreamStart, + DISPID_SVEStreamEnd, + DISPID_SVEVoiceChange, + DISPID_SVEBookmark, + DISPID_SVEWord, + DISPID_SVEPhoneme, + DISPID_SVESentenceBoundary, + DISPID_SVEViseme, + DISPID_SVEAudioLevel, + DISPID_SVEEnginePrivate, + DISPID_SpeechRecognizer, + DISPID_SRRecognizer, + DISPID_SRAllowAudioInputFormatChangesOnNextSet, + DISPID_SRAudioInput, + DISPID_SRAudioInputStream, + DISPID_SRIsShared, + DISPID_SRState, + DISPID_SRStatus, + DISPID_SRProfile, + DISPID_SREmulateRecognition, + DISPID_SRCreateRecoContext, + DISPID_SRGetFormat, + DISPID_SRSetPropertyNumber, + DISPID_SRGetPropertyNumber, + DISPID_SRSetPropertyString, + DISPID_SRGetPropertyString, + DISPID_SRIsUISupported, + DISPID_SRDisplayUI, + DISPID_SRGetRecognizers, + DISPID_SVGetAudioInputs, + DISPID_SVGetProfiles, + SpeechRecognizerState, + SRSInactive, + SRSActive, + SRSActiveAlways, + SRSInactiveWithPurge, + SpeechDisplayAttributes, + SDA_No_Trailing_Space, + SDA_One_Trailing_Space, + SDA_Two_Trailing_Spaces, + SDA_Consume_Leading_Spaces, + SpeechFormatType, + SFTInput, + SFTSREngine, + SpeechEmulationCompareFlags, + SECFIgnoreCase, + SECFIgnoreKanaType, + SECFIgnoreWidth, + SECFNoSpecialChars, + SECFEmulateResult, + SECFDefault, + DISPID_SpeechRecognizerStatus, + DISPID_SRSAudioStatus, + DISPID_SRSCurrentStreamPosition, + DISPID_SRSCurrentStreamNumber, + DISPID_SRSNumberOfActiveRules, + DISPID_SRSClsidEngine, + DISPID_SRSSupportedLanguages, + DISPID_SpeechRecoContext, + DISPID_SRCRecognizer, + DISPID_SRCAudioInInterferenceStatus, + DISPID_SRCRequestedUIType, + DISPID_SRCVoice, + DISPID_SRAllowVoiceFormatMatchingOnNextSet, + DISPID_SRCVoicePurgeEvent, + DISPID_SRCEventInterests, + DISPID_SRCCmdMaxAlternates, + DISPID_SRCState, + DISPID_SRCRetainedAudio, + DISPID_SRCRetainedAudioFormat, + DISPID_SRCPause, + DISPID_SRCResume, + DISPID_SRCCreateGrammar, + DISPID_SRCCreateResultFromMemory, + DISPID_SRCBookmark, + DISPID_SRCSetAdaptationData, + SpeechRetainedAudioOptions, + SRAONone, + SRAORetainAudio, + SpeechBookmarkOptions, + SBONone, + SBOPause, + SpeechInterference, + SINone, + SINoise, + SINoSignal, + SITooLoud, + SITooQuiet, + SITooFast, + SITooSlow, + SpeechRecoEvents, + SREStreamEnd, + SRESoundStart, + SRESoundEnd, + SREPhraseStart, + SRERecognition, + SREHypothesis, + SREBookmark, + SREPropertyNumChange, + SREPropertyStringChange, + SREFalseRecognition, + SREInterference, + SRERequestUI, + SREStateChange, + SREAdaptation, + SREStreamStart, + SRERecoOtherContext, + SREAudioLevel, + SREPrivate, + SREAllEvents, + SpeechRecoContextState, + SRCS_Disabled, + SRCS_Enabled, + DISPIDSPRG, + DISPID_SRGId, + DISPID_SRGRecoContext, + DISPID_SRGState, + DISPID_SRGRules, + DISPID_SRGReset, + DISPID_SRGCommit, + DISPID_SRGCmdLoadFromFile, + DISPID_SRGCmdLoadFromObject, + DISPID_SRGCmdLoadFromResource, + DISPID_SRGCmdLoadFromMemory, + DISPID_SRGCmdLoadFromProprietaryGrammar, + DISPID_SRGCmdSetRuleState, + DISPID_SRGCmdSetRuleIdState, + DISPID_SRGDictationLoad, + DISPID_SRGDictationUnload, + DISPID_SRGDictationSetState, + DISPID_SRGSetWordSequenceData, + DISPID_SRGSetTextSelection, + DISPID_SRGIsPronounceable, + SpeechLoadOption, + SLOStatic, + SLODynamic, + SpeechWordPronounceable, + SWPUnknownWordUnpronounceable, + SWPUnknownWordPronounceable, + SWPKnownWordPronounceable, + SpeechGrammarState, + SGSEnabled, + SGSDisabled, + SGSExclusive, + SpeechRuleState, + SGDSInactive, + SGDSActive, + SGDSActiveWithAutoPause, + SGDSActiveUserDelimited, + SpeechRuleAttributes, + SRATopLevel, + SRADefaultToActive, + SRAExport, + SRAImport, + SRAInterpreter, + SRADynamic, + SRARoot, + SpeechGrammarWordType, + SGDisplay, + SGLexical, + SGPronounciation, + SGLexicalNoSpecialChars, + DISPID_SpeechRecoContextEvents, + DISPID_SRCEStartStream, + DISPID_SRCEEndStream, + DISPID_SRCEBookmark, + DISPID_SRCESoundStart, + DISPID_SRCESoundEnd, + DISPID_SRCEPhraseStart, + DISPID_SRCERecognition, + DISPID_SRCEHypothesis, + DISPID_SRCEPropertyNumberChange, + DISPID_SRCEPropertyStringChange, + DISPID_SRCEFalseRecognition, + DISPID_SRCEInterference, + DISPID_SRCERequestUI, + DISPID_SRCERecognizerStateChange, + DISPID_SRCEAdaptation, + DISPID_SRCERecognitionForOtherContext, + DISPID_SRCEAudioLevel, + DISPID_SRCEEnginePrivate, + SpeechRecognitionType, + SRTStandard, + SRTAutopause, + SRTEmulated, + SRTSMLTimeout, + SRTExtendableParse, + SRTReSent, + DISPID_SpeechGrammarRule, + DISPID_SGRAttributes, + DISPID_SGRInitialState, + DISPID_SGRName, + DISPID_SGRId, + DISPID_SGRClear, + DISPID_SGRAddResource, + DISPID_SGRAddState, + DISPID_SpeechGrammarRules, + DISPID_SGRsCount, + DISPID_SGRsDynamic, + DISPID_SGRsAdd, + DISPID_SGRsCommit, + DISPID_SGRsCommitAndSave, + DISPID_SGRsFindRule, + DISPID_SGRsItem, + DISPID_SGRs_NewEnum, + DISPID_SpeechGrammarRuleState, + DISPID_SGRSRule, + DISPID_SGRSTransitions, + DISPID_SGRSAddWordTransition, + DISPID_SGRSAddRuleTransition, + DISPID_SGRSAddSpecialTransition, + SpeechSpecialTransitionType, + SSTTWildcard, + SSTTDictation, + SSTTTextBuffer, + DISPID_SpeechGrammarRuleStateTransitions, + DISPID_SGRSTsCount, + DISPID_SGRSTsItem, + DISPID_SGRSTs_NewEnum, + DISPID_SpeechGrammarRuleStateTransition, + DISPID_SGRSTType, + DISPID_SGRSTText, + DISPID_SGRSTRule, + DISPID_SGRSTWeight, + DISPID_SGRSTPropertyName, + DISPID_SGRSTPropertyId, + DISPID_SGRSTPropertyValue, + DISPID_SGRSTNextState, + SpeechGrammarRuleStateTransitionType, + SGRSTTEpsilon, + SGRSTTWord, + SGRSTTRule, + SGRSTTDictation, + SGRSTTWildcard, + SGRSTTTextBuffer, + DISPIDSPTSI, + DISPIDSPTSI_ActiveOffset, + DISPIDSPTSI_ActiveLength, + DISPIDSPTSI_SelectionOffset, + DISPIDSPTSI_SelectionLength, + DISPID_SpeechRecoResult, + DISPID_SRRRecoContext, + DISPID_SRRTimes, + DISPID_SRRAudioFormat, + DISPID_SRRPhraseInfo, + DISPID_SRRAlternates, + DISPID_SRRAudio, + DISPID_SRRSpeakAudio, + DISPID_SRRSaveToMemory, + DISPID_SRRDiscardResultInfo, + SpeechDiscardType, + SDTProperty, + SDTReplacement, + SDTRule, + SDTDisplayText, + SDTLexicalForm, + SDTPronunciation, + SDTAudio, + SDTAlternates, + SDTAll, + DISPID_SpeechXMLRecoResult, + DISPID_SRRGetXMLResult, + DISPID_SRRGetXMLErrorInfo, + DISPID_SpeechRecoResult2, + DISPID_SRRSetTextFeedback, + DISPID_SpeechPhraseBuilder, + DISPID_SPPBRestorePhraseFromMemory, + DISPID_SpeechRecoResultTimes, + DISPID_SRRTStreamTime, + DISPID_SRRTLength, + DISPID_SRRTTickCount, + DISPID_SRRTOffsetFromStart, + DISPID_SpeechPhraseAlternate, + DISPID_SPARecoResult, + DISPID_SPAStartElementInResult, + DISPID_SPANumberOfElementsInResult, + DISPID_SPAPhraseInfo, + DISPID_SPACommit, + DISPID_SpeechPhraseAlternates, + DISPID_SPAsCount, + DISPID_SPAsItem, + DISPID_SPAs_NewEnum, + DISPID_SpeechPhraseInfo, + DISPID_SPILanguageId, + DISPID_SPIGrammarId, + DISPID_SPIStartTime, + DISPID_SPIAudioStreamPosition, + DISPID_SPIAudioSizeBytes, + DISPID_SPIRetainedSizeBytes, + DISPID_SPIAudioSizeTime, + DISPID_SPIRule, + DISPID_SPIProperties, + DISPID_SPIElements, + DISPID_SPIReplacements, + DISPID_SPIEngineId, + DISPID_SPIEnginePrivateData, + DISPID_SPISaveToMemory, + DISPID_SPIGetText, + DISPID_SPIGetDisplayAttributes, + DISPID_SpeechPhraseElement, + DISPID_SPEAudioTimeOffset, + DISPID_SPEAudioSizeTime, + DISPID_SPEAudioStreamOffset, + DISPID_SPEAudioSizeBytes, + DISPID_SPERetainedStreamOffset, + DISPID_SPERetainedSizeBytes, + DISPID_SPEDisplayText, + DISPID_SPELexicalForm, + DISPID_SPEPronunciation, + DISPID_SPEDisplayAttributes, + DISPID_SPERequiredConfidence, + DISPID_SPEActualConfidence, + DISPID_SPEEngineConfidence, + SpeechEngineConfidence, + SECLowConfidence, + SECNormalConfidence, + SECHighConfidence, + DISPID_SpeechPhraseElements, + DISPID_SPEsCount, + DISPID_SPEsItem, + DISPID_SPEs_NewEnum, + DISPID_SpeechPhraseReplacement, + DISPID_SPRDisplayAttributes, + DISPID_SPRText, + DISPID_SPRFirstElement, + DISPID_SPRNumberOfElements, + DISPID_SpeechPhraseReplacements, + DISPID_SPRsCount, + DISPID_SPRsItem, + DISPID_SPRs_NewEnum, + DISPID_SpeechPhraseProperty, + DISPID_SPPName, + DISPID_SPPId, + DISPID_SPPValue, + DISPID_SPPFirstElement, + DISPID_SPPNumberOfElements, + DISPID_SPPEngineConfidence, + DISPID_SPPConfidence, + DISPID_SPPParent, + DISPID_SPPChildren, + DISPID_SpeechPhraseProperties, + DISPID_SPPsCount, + DISPID_SPPsItem, + DISPID_SPPs_NewEnum, + DISPID_SpeechPhraseRule, + DISPID_SPRuleName, + DISPID_SPRuleId, + DISPID_SPRuleFirstElement, + DISPID_SPRuleNumberOfElements, + DISPID_SPRuleParent, + DISPID_SPRuleChildren, + DISPID_SPRuleConfidence, + DISPID_SPRuleEngineConfidence, + DISPID_SpeechPhraseRules, + DISPID_SPRulesCount, + DISPID_SPRulesItem, + DISPID_SPRules_NewEnum, + DISPID_SpeechLexicon, + DISPID_SLGenerationId, + DISPID_SLGetWords, + DISPID_SLAddPronunciation, + DISPID_SLAddPronunciationByPhoneIds, + DISPID_SLRemovePronunciation, + DISPID_SLRemovePronunciationByPhoneIds, + DISPID_SLGetPronunciations, + DISPID_SLGetGenerationChange, + SpeechLexiconType, + SLTUser, + SLTApp, + SpeechPartOfSpeech, + SPSNotOverriden, + SPSUnknown, + SPSNoun, + SPSVerb, + SPSModifier, + SPSFunction, + SPSInterjection, + SPSLMA, + SPSSuppressWord, + DISPID_SpeechLexiconWords, + DISPID_SLWsCount, + DISPID_SLWsItem, + DISPID_SLWs_NewEnum, + SpeechWordType, + SWTAdded, + SWTDeleted, + DISPID_SpeechLexiconWord, + DISPID_SLWLangId, + DISPID_SLWType, + DISPID_SLWWord, + DISPID_SLWPronunciations, + DISPID_SpeechLexiconProns, + DISPID_SLPsCount, + DISPID_SLPsItem, + DISPID_SLPs_NewEnum, + DISPID_SpeechLexiconPronunciation, + DISPID_SLPType, + DISPID_SLPLangId, + DISPID_SLPPartOfSpeech, + DISPID_SLPPhoneIds, + DISPID_SLPSymbolic, + DISPID_SpeechPhoneConverter, + DISPID_SPCLangId, + DISPID_SPCPhoneToId, + DISPID_SPCIdToPhone, + LIBID_SpeechLib, + ISpeechDataKey, ISpeechDataKeyVtbl, + ISpeechObjectToken, ISpeechObjectTokenVtbl, + ISpeechObjectTokens, ISpeechObjectTokensVtbl, + ISpeechObjectTokenCategory, ISpeechObjectTokenCategoryVtbl, + ISpeechAudioBufferInfo, ISpeechAudioBufferInfoVtbl, + ISpeechAudioStatus, ISpeechAudioStatusVtbl, + ISpeechAudioFormat, ISpeechAudioFormatVtbl, + ISpeechWaveFormatEx, ISpeechWaveFormatExVtbl, + ISpeechBaseStream, ISpeechBaseStreamVtbl, + ISpeechFileStream, ISpeechFileStreamVtbl, + ISpeechMemoryStream, ISpeechMemoryStreamVtbl, + ISpeechCustomStream, ISpeechCustomStreamVtbl, + ISpeechAudio, ISpeechAudioVtbl, + ISpeechMMSysAudio, ISpeechMMSysAudioVtbl, + ISpeechVoice, ISpeechVoiceVtbl, + ISpeechVoiceStatus, ISpeechVoiceStatusVtbl, + _ISpeechVoiceEvents, _ISpeechVoiceEventsVtbl, + ISpeechRecognizer, ISpeechRecognizerVtbl, + ISpeechRecognizerStatus, ISpeechRecognizerStatusVtbl, + ISpeechRecoContext, ISpeechRecoContextVtbl, + ISpeechRecoGrammar, ISpeechRecoGrammarVtbl, + _ISpeechRecoContextEvents, _ISpeechRecoContextEventsVtbl, + ISpeechGrammarRule, ISpeechGrammarRuleVtbl, + ISpeechGrammarRules, ISpeechGrammarRulesVtbl, + ISpeechGrammarRuleState, ISpeechGrammarRuleStateVtbl, + ISpeechGrammarRuleStateTransition, ISpeechGrammarRuleStateTransitionVtbl, + ISpeechGrammarRuleStateTransitions, ISpeechGrammarRuleStateTransitionsVtbl, + ISpeechTextSelectionInformation, ISpeechTextSelectionInformationVtbl, + ISpeechRecoResult, ISpeechRecoResultVtbl, + ISpeechRecoResult2, ISpeechRecoResult2Vtbl, + ISpeechRecoResultTimes, ISpeechRecoResultTimesVtbl, + ISpeechPhraseAlternate, ISpeechPhraseAlternateVtbl, + ISpeechPhraseAlternates, ISpeechPhraseAlternatesVtbl, + ISpeechPhraseInfo, ISpeechPhraseInfoVtbl, + ISpeechPhraseElement, ISpeechPhraseElementVtbl, + ISpeechPhraseElements, ISpeechPhraseElementsVtbl, + ISpeechPhraseReplacement, ISpeechPhraseReplacementVtbl, + ISpeechPhraseReplacements, ISpeechPhraseReplacementsVtbl, + ISpeechPhraseProperty, ISpeechPhrasePropertyVtbl, + ISpeechPhraseProperties, ISpeechPhrasePropertiesVtbl, + ISpeechPhraseRule, ISpeechPhraseRuleVtbl, + ISpeechPhraseRules, ISpeechPhraseRulesVtbl, + ISpeechLexicon, ISpeechLexiconVtbl, + ISpeechLexiconWords, ISpeechLexiconWordsVtbl, + ISpeechLexiconWord, ISpeechLexiconWordVtbl, + ISpeechLexiconPronunciations, ISpeechLexiconPronunciationsVtbl, + ISpeechLexiconPronunciation, ISpeechLexiconPronunciationVtbl, + Speech_Default_Weight, + Speech_Max_Word_Length, + Speech_Max_Pron_Length, + Speech_StreamPos_Asap, + Speech_StreamPos_RealTime, + SpeechAllElements, + ISpeechXMLRecoResult, ISpeechXMLRecoResultVtbl, + ISpeechRecoResultDispatch, ISpeechRecoResultDispatchVtbl, + ISpeechPhraseInfoBuilder, ISpeechPhraseInfoBuilderVtbl, + ISpeechPhoneConverter, ISpeechPhoneConverterVtbl, + CLSID_SpNotifyTranslator, + CLSID_SpObjectTokenCategory, + CLSID_SpObjectToken, + CLSID_SpResourceManager, + CLSID_SpStreamFormatConverter, + CLSID_SpMMAudioEnum, + CLSID_SpMMAudioIn, + CLSID_SpMMAudioOut, + CLSID_SpStream, + CLSID_SpVoice, + CLSID_SpSharedRecoContext, + CLSID_SpInprocRecognizer, + CLSID_SpSharedRecognizer, + CLSID_SpLexicon, + CLSID_SpUnCompressedLexicon, + CLSID_SpCompressedLexicon, + CLSID_SpShortcut, + CLSID_SpPhoneConverter, + CLSID_SpPhoneticAlphabetConverter, + CLSID_SpNullPhoneConverter, + CLSID_SpTextSelectionInformation, + CLSID_SpPhraseInfoBuilder, + CLSID_SpAudioFormat, + CLSID_SpWaveFormatEx, + CLSID_SpInProcRecoContext, + CLSID_SpCustomStream, + CLSID_SpFileStream, + CLSID_SpMemoryStream, +}; diff --git a/src/vendor/winapi/src/um/sapi51.rs b/src/vendor/winapi/src/um/sapi51.rs new file mode 100644 index 0000000000..4e61625a8a --- /dev/null +++ b/src/vendor/winapi/src/um/sapi51.rs @@ -0,0 +1,3728 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! SAPI 5.1 definitions +use ctypes::{c_char, c_float, c_long, c_short, c_ushort, c_void}; +use shared::guiddef::{CLSID, GUID, IID, REFCLSID, REFGUID, REFIID}; +use shared::minwindef::{ + BOOL, BYTE, DWORD, FILETIME, HKEY, HMODULE, LPARAM, UINT, ULONG, USHORT, WORD, WPARAM +}; +use shared::mmreg::WAVEFORMATEX; +use shared::rpcndr::byte; +use shared::windef::HWND; +use shared::wtypes::{BSTR, VARIANT_BOOL}; +use shared::wtypesbase::{ + CLSCTX_INPROC_HANDLER, CLSCTX_INPROC_SERVER, CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER +}; +use um::oaidl::{DISPID_NEWENUM, DISPID_VALUE, IDispatch, IDispatchVtbl, VARIANT}; +use um::objidlbase::{IStream, IStreamVtbl, STREAM_SEEK_CUR, STREAM_SEEK_END, STREAM_SEEK_SET}; +use um::servprov::{IServiceProvider, IServiceProviderVtbl}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, LONG, LONGLONG, LPCWSTR, LPWSTR, ULONGLONG, WCHAR}; +ENUM!{enum SPDATAKEYLOCATION { + SPDKL_DefaultLocation = 0, + SPDKL_CurrentUser = 1, + SPDKL_LocalMachine = 2, + SPDKL_CurrentConfig = 5, +}} +pub const SPDUI_EngineProperties: &'static str = "EngineProperties"; +pub const SPDUI_AddRemoveWord: &'static str = "AddRemoveWord"; +pub const SPDUI_UserTraining: &'static str = "UserTraining"; +pub const SPDUI_MicTraining: &'static str = "MicTraining"; +pub const SPDUI_RecoProfileProperties: &'static str = "RecoProfileProperties"; +pub const SPDUI_AudioProperties: &'static str = "AudioProperties"; +pub const SPDUI_AudioVolume: &'static str = "AudioVolume"; +pub const SPDUI_UserEnrollment: &'static str = "UserEnrollment"; +pub const SPDUI_ShareData: &'static str = "ShareData"; +pub const SPDUI_Tutorial: &'static str = "Tutorial"; +ENUM!{enum SPSTREAMFORMAT { + SPSF_Default = -1i32 as u32, + SPSF_NoAssignedFormat = 0, + SPSF_Text = 1, + SPSF_NonStandardFormat = 2, + SPSF_ExtendedAudioFormat = 3, + SPSF_8kHz8BitMono = 4, + SPSF_8kHz8BitStereo = 5, + SPSF_8kHz16BitMono = 6, + SPSF_8kHz16BitStereo = 7, + SPSF_11kHz8BitMono = 8, + SPSF_11kHz8BitStereo = 9, + SPSF_11kHz16BitMono = 10, + SPSF_11kHz16BitStereo = 11, + SPSF_12kHz8BitMono = 12, + SPSF_12kHz8BitStereo = 13, + SPSF_12kHz16BitMono = 14, + SPSF_12kHz16BitStereo = 15, + SPSF_16kHz8BitMono = 16, + SPSF_16kHz8BitStereo = 17, + SPSF_16kHz16BitMono = 18, + SPSF_16kHz16BitStereo = 19, + SPSF_22kHz8BitMono = 20, + SPSF_22kHz8BitStereo = 21, + SPSF_22kHz16BitMono = 22, + SPSF_22kHz16BitStereo = 23, + SPSF_24kHz8BitMono = 24, + SPSF_24kHz8BitStereo = 25, + SPSF_24kHz16BitMono = 26, + SPSF_24kHz16BitStereo = 27, + SPSF_32kHz8BitMono = 28, + SPSF_32kHz8BitStereo = 29, + SPSF_32kHz16BitMono = 30, + SPSF_32kHz16BitStereo = 31, + SPSF_44kHz8BitMono = 32, + SPSF_44kHz8BitStereo = 33, + SPSF_44kHz16BitMono = 34, + SPSF_44kHz16BitStereo = 35, + SPSF_48kHz8BitMono = 36, + SPSF_48kHz8BitStereo = 37, + SPSF_48kHz16BitMono = 38, + SPSF_48kHz16BitStereo = 39, + SPSF_TrueSpeech_8kHz1BitMono = 40, + SPSF_CCITT_ALaw_8kHzMono = 41, + SPSF_CCITT_ALaw_8kHzStereo = 42, + SPSF_CCITT_ALaw_11kHzMono = 43, + SPSF_CCITT_ALaw_11kHzStereo = 44, + SPSF_CCITT_ALaw_22kHzMono = 45, + SPSF_CCITT_ALaw_22kHzStereo = 46, + SPSF_CCITT_ALaw_44kHzMono = 47, + SPSF_CCITT_ALaw_44kHzStereo = 48, + SPSF_CCITT_uLaw_8kHzMono = 49, + SPSF_CCITT_uLaw_8kHzStereo = 50, + SPSF_CCITT_uLaw_11kHzMono = 51, + SPSF_CCITT_uLaw_11kHzStereo = 52, + SPSF_CCITT_uLaw_22kHzMono = 53, + SPSF_CCITT_uLaw_22kHzStereo = 54, + SPSF_CCITT_uLaw_44kHzMono = 55, + SPSF_CCITT_uLaw_44kHzStereo = 56, + SPSF_ADPCM_8kHzMono = 57, + SPSF_ADPCM_8kHzStereo = 58, + SPSF_ADPCM_11kHzMono = 59, + SPSF_ADPCM_11kHzStereo = 60, + SPSF_ADPCM_22kHzMono = 61, + SPSF_ADPCM_22kHzStereo = 62, + SPSF_ADPCM_44kHzMono = 63, + SPSF_ADPCM_44kHzStereo = 64, + SPSF_GSM610_8kHzMono = 65, + SPSF_GSM610_11kHzMono = 66, + SPSF_GSM610_22kHzMono = 67, + SPSF_GSM610_44kHzMono = 68, + SPSF_NUM_FORMATS = 69, +}} +extern { + pub static SPDFID_Text: GUID; + pub static SPDFID_WaveFormatEx: GUID; +} +pub const SPREG_USER_ROOT: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech"; +pub const SPREG_LOCAL_MACHINE_ROOT: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech"; +pub const SPCAT_AUDIOOUT: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput"; +pub const SPCAT_AUDIOIN: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput"; +pub const SPCAT_VOICES: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices"; +pub const SPCAT_RECOGNIZERS: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Recognizers"; +pub const SPCAT_APPLEXICONS: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AppLexicons"; +pub const SPCAT_PHONECONVERTERS: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\PhoneConverters"; +pub const SPCAT_TEXTNORMALIZERS: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\TextNormalizers"; +pub const SPCAT_RECOPROFILES: &'static str + = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles"; +pub const SPMMSYS_AUDIO_IN_TOKEN_ID: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput\\TokenEnums\\MMAudioIn\\"; +pub const SPMMSYS_AUDIO_OUT_TOKEN_ID: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput\\TokenEnums\\MMAudioOut\\"; +pub const SPCURRENT_USER_LEXICON_TOKEN_ID: &'static str + = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserLexicon"; +pub const SPCURRENT_USER_SHORTCUT_TOKEN_ID: &'static str + = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserShortcut"; +pub const SPTOKENVALUE_CLSID: &'static str = "CLSID"; +pub const SPTOKENKEY_FILES: &'static str = "Files"; +pub const SPTOKENKEY_UI: &'static str = "UI"; +pub const SPTOKENKEY_ATTRIBUTES: &'static str = "Attributes"; +pub const SPVOICECATEGORY_TTSRATE: &'static str = "DefaultTTSRate"; +pub const SPPROP_RESOURCE_USAGE: &'static str = "ResourceUsage"; +pub const SPPROP_HIGH_CONFIDENCE_THRESHOLD: &'static str = "HighConfidenceThreshold"; +pub const SPPROP_NORMAL_CONFIDENCE_THRESHOLD: &'static str = "NormalConfidenceThreshold"; +pub const SPPROP_LOW_CONFIDENCE_THRESHOLD: &'static str = "LowConfidenceThreshold"; +pub const SPPROP_RESPONSE_SPEED: &'static str = "ResponseSpeed"; +pub const SPPROP_COMPLEX_RESPONSE_SPEED: &'static str = "ComplexResponseSpeed"; +pub const SPPROP_ADAPTATION_ON: &'static str = "AdaptationOn"; +pub const SPPROP_PERSISTED_BACKGROUND_ADAPTATION: &'static str = "PersistedBackgroundAdaptation"; +pub const SPPROP_PERSISTED_LANGUAGE_MODEL_ADAPTATION: &'static str + = "PersistedLanguageModelAdaptation"; +pub const SPPROP_UX_IS_LISTENING: &'static str = "UXIsListening"; +pub const SPTOPIC_SPELLING: &'static str = "Spelling"; +pub const SPWILDCARD: &'static str = "..."; +pub const SPDICTATION: &'static str = "*"; +pub const SPINFDICTATION: &'static str = "*+"; +pub const SP_LOW_CONFIDENCE: c_char = -1; +pub const SP_NORMAL_CONFIDENCE: c_char = 0; +pub const SP_HIGH_CONFIDENCE: c_char = 1; +pub const DEFAULT_WEIGHT: c_float = 1.0; +pub const SP_MAX_WORD_LENGTH: ULONG = 128; +pub const SP_MAX_PRON_LENGTH: ULONG = 384; +RIDL!(#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] +interface ISpNotifyCallback(ISpNotifyCallbackVtbl) { + fn NotifyCallback( + wParam: WPARAM, + lParam: LPARAM, + ) -> HRESULT, +}); +FN!( + stdcall SPNOTIFYCALLBACK(wParam: WPARAM, lParam: LPARAM, + ) -> ()); +RIDL!(#[uuid(0x5eff4aef, 0x8487, 0x11d2, 0x96, 0x1c, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0x28)] +interface ISpNotifySource(ISpNotifySourceVtbl): IUnknown(IUnknownVtbl) { + fn SetNotifySink( + pNotifySink: *mut ISpNotifySink, + ) -> HRESULT, + fn SetNotifyWindowMessage( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> HRESULT, + fn SetNotifyCallbackFunction( + pfnCallback: SPNOTIFYCALLBACK, + wParam: WPARAM, + lParam: LPARAM, + ) -> HRESULT, + fn SetNotifyCallbackInterface( + pSpCallback: *mut ISpNotifyCallback, + wParam: WPARAM, + lParam: LPARAM, + ) -> HRESULT, + fn SetNotifyWin32Event() -> HRESULT, + fn WaitForNotifyEvent( + dwMilliseconds: DWORD, + ) -> HRESULT, + fn GetNotifyEventHandle() -> HANDLE, +}); +RIDL!(#[uuid(0x259684dc, 0x37c3, 0x11d2, 0x96, 0x03, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0x28)] +interface ISpNotifySink(ISpNotifySinkVtbl): IUnknown(IUnknownVtbl) { + fn Notify() -> HRESULT, +}); +RIDL!(#[uuid(0xaca16614, 0x5d3d, 0x11d2, 0x96, 0x0e, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0x28)] +interface ISpNotifyTranslator(ISpNotifyTranslatorVtbl): ISpNotifySink(ISpNotifySinkVtbl) { + fn InitWindowMessage( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> HRESULT, + fn InitCallback( + pfnCallback: SPNOTIFYCALLBACK, + wParam: WPARAM, + lParam: LPARAM, + ) -> HRESULT, + fn InitSpNotifyCallback( + pSpCallback: *mut ISpNotifyCallback, + wParam: WPARAM, + lParam: LPARAM, + ) -> HRESULT, + fn InitWin32Event( + hEvent: HANDLE, + fCloseHandleOnRelease: BOOL, + ) -> HRESULT, + fn Wait( + dwMilliseconds: DWORD, + ) -> HRESULT, + fn GetEventHandle() -> HANDLE, +}); +RIDL!(#[uuid(0x14056581, 0xe16c, 0x11d2, 0xbb, 0x90, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0xc0)] +interface ISpDataKey(ISpDataKeyVtbl): IUnknown(IUnknownVtbl) { + fn SetData( + pszValueName: LPCWSTR, + cbData: ULONG, + pData: *const BYTE, + ) -> HRESULT, + fn GetData( + pszValueName: LPCWSTR, + pcbData: *mut ULONG, + pData: *mut BYTE, + ) -> HRESULT, + fn SetStringValue( + pszValueName: LPCWSTR, + pszValue: LPCWSTR, + ) -> HRESULT, + fn GetStringValue( + pszValueName: LPCWSTR, + ppszValue: *mut LPWSTR, + ) -> HRESULT, + fn SetDWORD( + pszValueName: LPCWSTR, + dwValue: DWORD, + ) -> HRESULT, + fn GetDWORD( + pszValueName: LPCWSTR, + pdwValue: *mut DWORD, + ) -> HRESULT, + fn OpenKey( + pszSubKeyName: LPCWSTR, + ppSubKey: *mut *mut ISpDataKey, + ) -> HRESULT, + fn CreateKey( + pszSubKey: LPCWSTR, + ppSubKey: *mut *mut ISpDataKey, + ) -> HRESULT, + fn DeleteKey( + pszSubKey: LPCWSTR, + ) -> HRESULT, + fn DeleteValue( + pszValueName: LPCWSTR, + ) -> HRESULT, + fn EnumKeys( + Index: ULONG, + ppszSubKeyName: *mut LPWSTR, + ) -> HRESULT, + fn EnumValues( + Index: ULONG, + ppszValueName: *mut LPWSTR, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x92a66e2b, 0xc830, 0x4149, 0x83, 0xdf, 0x6f, 0xc2, 0xba, 0x1e, 0x7a, 0x5b)] +interface ISpRegDataKey(ISpRegDataKeyVtbl): ISpDataKey(ISpDataKeyVtbl) { + fn SetKey( + hkey: HKEY, + fReadOnly: BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x2d3d3845, 0x39af, 0x4850, 0xbb, 0xf9, 0x40, 0xb4, 0x97, 0x80, 0x01, 0x1d)] +interface ISpObjectTokenCategory(ISpObjectTokenCategoryVtbl): ISpDataKey(ISpDataKeyVtbl) { + fn SetId( + pszCategoryId: LPCWSTR, + fCreateIfNotExist: BOOL, + ) -> HRESULT, + fn GetId( + ppszCoMemCategoryId: *mut LPWSTR, + ) -> HRESULT, + fn GetDataKey( + spdkl: SPDATAKEYLOCATION, + pppDataKey: *mut *mut ISpDataKey, + ) -> HRESULT, + fn EnumTokens( + pzsReqAttribs: LPCWSTR, + pszOptAttribs: LPCWSTR, + ppEnum: *mut *mut IEnumSpObjectTokens, + ) -> HRESULT, + fn SetDefaultTokenId( + pszTokenId: LPCWSTR, + ) -> HRESULT, + fn GetDefaultTokenId( + ppszCoMemTokenId: *mut LPWSTR, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x14056589, 0xe16c, 0x11d2, 0xbb, 0x90, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0xc0)] +interface ISpObjectToken(ISpObjectTokenVtbl): ISpDataKey(ISpDataKeyVtbl) { + fn SetId( + pszCategoryId: LPCWSTR, + pszTokenId: LPCWSTR, + fCreateIfNotExist: BOOL, + ) -> HRESULT, + fn GetId( + ppszCoMemTokenId: *mut LPWSTR, + ) -> HRESULT, + fn GetCategory( + ppTokenCategory: *mut *mut ISpObjectTokenCategory, + ) -> HRESULT, + fn CreateInstance( + pUnkOuter: *mut IUnknown, + dwClsContext: DWORD, + riid: REFIID, + ppvObject: *mut *mut c_void, + ) -> HRESULT, + fn GetStorageFileName( + clsidCaller: REFCLSID, + pszValueName: LPCWSTR, + pszFileNameSpecifier: LPCWSTR, + nFolder: ULONG, + ppszFilePath: *mut LPWSTR, + ) -> HRESULT, + fn RemoveStorageFileName( + pszKeyName: LPCWSTR, + fDeleteFile: BOOL, + ) -> HRESULT, + fn Remove( + pclsidCaller: *const CLSID, + ) -> HRESULT, + fn IsUISupported( + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + punkObject: *mut IUnknown, + pfSupported: *mut BOOL, + ) -> HRESULT, + fn DisplayUI( + hwndParent: HWND, + pszTitle: LPCWSTR, + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + punkObject: *mut IUnknown, + ) -> HRESULT, + fn MatchesAttributes( + pszAttributes: LPCWSTR, + pfMatches: *mut BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xb8aab0cf, 0x346f, 0x49d8, 0x94, 0x99, 0xc8, 0xb0, 0x3f, 0x16, 0x1d, 0x51)] +interface ISpObjectTokenInit(ISpObjectTokenInitVtbl): ISpObjectToken(ISpObjectTokenVtbl) { + fn InitFromDataKey( + pszCategoryId: LPCWSTR, + pszTokenId: LPCWSTR, + pDataKey: *mut ISpDataKey, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x06b64f9e, 0x7fda, 0x11d2, 0xb4, 0xf2, 0x00, 0xc0, 0x4f, 0x79, 0x73, 0x96)] +interface IEnumSpObjectTokens(IEnumSpObjectTokensVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + pelt: *mut *mut ISpObjectToken, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppEnum: *mut *mut IEnumSpObjectTokens, + ) -> HRESULT, + fn Item( + Index: ULONG, + ppToken: *mut *mut ISpObjectToken, + ) -> HRESULT, + fn GetCount( + pCount: *mut ULONG, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x5b559f40, 0xe952, 0x11d2, 0xbb, 0x91, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0xc0)] +interface ISpObjectWithToken(ISpObjectWithTokenVtbl): IUnknown(IUnknownVtbl) { + fn SetObjectToken( + pToken: *mut ISpObjectToken, + ) -> HRESULT, + fn GetObjectToken( + ppToken: *mut *mut ISpObjectToken, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x93384e18, 0x5014, 0x43d5, 0xad, 0xbb, 0xa7, 0x8e, 0x05, 0x59, 0x26, 0xbd)] +interface ISpResourceManager(ISpResourceManagerVtbl): IServiceProvider(IServiceProviderVtbl) { + fn SetObject( + guidServiceId: REFGUID, + pUnkObject: *mut IUnknown, + ) -> HRESULT, + fn GetObject( + guidServiceId: REFGUID, + ObjectCLSID: REFCLSID, + ObjectIID: REFIID, + fReleaseWhenLastExternalRefReleased: BOOL, + ppObject: *mut *mut c_void, + ) -> HRESULT, +}); +ENUM!{enum SPEVENTLPARAMTYPE { + SPET_LPARAM_IS_UNDEFINED = 0, + SPET_LPARAM_IS_TOKEN, + SPET_LPARAM_IS_OBJECT, + SPET_LPARAM_IS_POINTER, + SPET_LPARAM_IS_STRING, +}} +ENUM!{enum SPEVENTENUM { + SPEI_UNDEFINED = 0, + SPEI_START_INPUT_STREAM = 1, + SPEI_END_INPUT_STREAM = 2, + SPEI_VOICE_CHANGE = 3, + SPEI_TTS_BOOKMARK = 4, + SPEI_WORD_BOUNDARY = 5, + SPEI_PHONEME = 6, + SPEI_SENTENCE_BOUNDARY = 7, + SPEI_VISEME = 8, + SPEI_TTS_AUDIO_LEVEL = 9, + SPEI_TTS_PRIVATE = 15, + SPEI_MIN_TTS = 1, + SPEI_MAX_TTS = 15, + SPEI_END_SR_STREAM = 34, + SPEI_SOUND_START = 35, + SPEI_SOUND_END = 36, + SPEI_PHRASE_START = 37, + SPEI_RECOGNITION = 38, + SPEI_HYPOTHESIS = 39, + SPEI_SR_BOOKMARK = 40, + SPEI_PROPERTY_NUM_CHANGE = 41, + SPEI_PROPERTY_STRING_CHANGE = 42, + SPEI_FALSE_RECOGNITION = 43, + SPEI_INTERFERENCE = 44, + SPEI_REQUEST_UI = 45, + SPEI_RECO_STATE_CHANGE = 46, + SPEI_ADAPTATION = 47, + SPEI_START_SR_STREAM = 48, + SPEI_RECO_OTHER_CONTEXT = 49, + SPEI_SR_AUDIO_LEVEL = 50, + SPEI_SR_PRIVATE = 52, + SPEI_MIN_SR = 34, + SPEI_MAX_SR = 52, + SPEI_RESERVED1 = 30, + SPEI_RESERVED2 = 33, + SPEI_RESERVED3 = 63, +}} +pub const SPFEI_FLAGCHECK: ULONGLONG = (1 << SPEI_RESERVED1) | (1 << SPEI_RESERVED2); +pub const SPFEI_ALL_TTS_EVENTS: ULONGLONG = 0x000000000000FFFE | SPFEI_FLAGCHECK; +pub const SPFEI_ALL_SR_EVENTS: ULONGLONG = 0x003FFFFC00000000 | SPFEI_FLAGCHECK; +pub const SPFEI_ALL_EVENTS: ULONGLONG = 0xEFFFFFFFFFFFFFFF; +#[inline] +pub fn SPFEI( + SPEI_ord: SPEVENTENUM, + ) -> ULONGLONG { + (1 << SPEI_ord) | SPFEI_FLAGCHECK +} +STRUCT!{struct SPEVENT { + bitfields: DWORD, + ulStreamNum: ULONG, + ullAudioStreamOffset: ULONGLONG, + wParam: WPARAM, + lParam: LPARAM, +}} +BITFIELD!{SPEVENT bitfields: SPEVENTENUM [ eEventId set_eEventId[0..16], ]} +BITFIELD!{SPEVENT bitfields: SPEVENTLPARAMTYPE [ elParamType set_elParamType[16..32], ]} +STRUCT!{struct SPSERIALIZEDEVENT { + bitfields: DWORD, + ulStreamNum: ULONG, + ullAudioStreamOffset: ULONGLONG, + SerializedwParam: ULONG, + SerializedlParam: LONG, +}} +BITFIELD!{SPSERIALIZEDEVENT bitfields: SPEVENTENUM [ eEventId set_eEventId[0..16], ]} +BITFIELD!{SPSERIALIZEDEVENT bitfields: SPEVENTLPARAMTYPE [ elParamType set_elParamType[16..32], ]} +STRUCT!{struct SPSERIALIZEDEVENT64 { + bitfields: DWORD, + ulStreamNum: ULONG, + ullAudioStreamOffset: ULONGLONG, + SerializedwParam: ULONGLONG, + SerializedlParam: LONGLONG, +}} +BITFIELD!{SPSERIALIZEDEVENT64 bitfields: SPEVENTENUM [ + eEventId set_eEventId[0..16], +]} +BITFIELD!{SPSERIALIZEDEVENT64 bitfields: SPEVENTLPARAMTYPE [ + elParamType set_elParamType[16..32], +]} +ENUM!{enum SPINTERFERENCE { + SPINTERFERENCE_NONE = 0, + SPINTERFERENCE_NOISE, + SPINTERFERENCE_NOSIGNAL, + SPINTERFERENCE_TOOLOUD, + SPINTERFERENCE_TOOQUIET, + SPINTERFERENCE_TOOFAST, + SPINTERFERENCE_TOOSLOW, + SPINTERFERENCE_LATENCY_WARNING, + SPINTERFERENCE_LATENCY_TRUNCATE_BEGIN , + SPINTERFERENCE_LATENCY_TRUNCATE_END, +}} +ENUM!{enum SPENDSRSTREAMFLAGS { + SPESF_NONE = 0, + SPESF_STREAM_RELEASED = 1 << 0, + SPESF_EMULATED = 1 << 1, +}} +ENUM!{enum SPVFEATURE { + SPVFEATURE_STRESSED = 1 << 0, + SPVFEATURE_EMPHASIS = 1 << 1, +}} +ENUM!{enum SPVISEMES { + SP_VISEME_0 = 0, + SP_VISEME_1, + SP_VISEME_2, + SP_VISEME_3, + SP_VISEME_4, + SP_VISEME_5, + SP_VISEME_6, + SP_VISEME_7, + SP_VISEME_8, + SP_VISEME_9, + SP_VISEME_10, + SP_VISEME_11, + SP_VISEME_12, + SP_VISEME_13, + SP_VISEME_14, + SP_VISEME_15, + SP_VISEME_16, + SP_VISEME_17, + SP_VISEME_18, + SP_VISEME_19, + SP_VISEME_20, + SP_VISEME_21, +}} +STRUCT!{struct SPEVENTSOURCEINFO { + ullEventInterest: ULONGLONG, + ullQueuedInterest: ULONGLONG, + ulCount: ULONG, +}} +RIDL!(#[uuid(0xbe7a9cce, 0x5f9e, 0x11d2, 0x96, 0x0f, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0x28)] +interface ISpEventSource(ISpEventSourceVtbl): ISpNotifySource(ISpNotifySourceVtbl) { + fn SetInterest( + ullEventInterest: ULONGLONG, + ullQueuedInterest: ULONGLONG, + ) -> HRESULT, + fn GetEvents( + ulCount: ULONG, + pEventArray: *mut SPEVENT, + pulFetched: *mut ULONG, + ) -> HRESULT, + fn GetInfo( + pInfo: *mut SPEVENTSOURCEINFO, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xbe7a9cc9, 0x5f9e, 0x11d2, 0x96, 0x0f, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0x28)] +interface ISpEventSink(ISpEventSinkVtbl): IUnknown(IUnknownVtbl) { + fn AddEvents( + pEventArray: *const SPEVENT, + ulCount: ULONG, + ) -> HRESULT, + fn GetEventInterest( + pullEventInterest: *mut ULONGLONG, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xbed530be, 0x2606, 0x4f4d, 0xa1, 0xc0, 0x54, 0xc5, 0xcd, 0xa5, 0x56, 0x6f)] +interface ISpStreamFormat(ISpStreamFormatVtbl): IStream(IStreamVtbl) { + fn GetFormat( + pguidFormatId: *mut GUID, + ppCoMemWaveFormatEx: *mut *mut WAVEFORMATEX, + ) -> HRESULT, +}); +ENUM!{enum SPFILEMODE { + SPFM_OPEN_READONLY, + SPFM_OPEN_READWRITE, + SPFM_CREATE, + SPFM_CREATE_ALWAYS, + SPFM_NUM_MODES, +}} +RIDL!(#[uuid(0x12e3cca9, 0x7518, 0x44c5, 0xa5, 0xe7, 0xba, 0x5a, 0x79, 0xcb, 0x92, 0x9e)] +interface ISpStream(ISpStreamVtbl): ISpStreamFormat(ISpStreamFormatVtbl) { + fn SetBaseStream( + pStream: *mut IStream, + rguidFormat: REFGUID, + pWaveFormatEx: *const WAVEFORMATEX, + ) -> HRESULT, + fn GetBaseStream( + ppStream: *mut *mut IStream, + ) -> HRESULT, + fn BindToFile( + pszFileName: LPCWSTR, + eMode: SPFILEMODE, + pFormatId: *const GUID, + pWaveFormatEx: *const WAVEFORMATEX, + ullEventInterest: ULONGLONG, + ) -> HRESULT, + fn Close() -> HRESULT, +}); +RIDL!(#[uuid(0x678a932c, 0xea71, 0x4446, 0x9b, 0x41, 0x78, 0xfd, 0xa6, 0x28, 0x0a, 0x29)] +interface ISpStreamFormatConverter(ISpStreamFormatConverterVtbl): + ISpStreamFormat(ISpStreamFormatVtbl) { + fn SetBaseStream( + pStream: *mut ISpStreamFormat, + fSetFormatToBaseStreamFormat: BOOL, + fWriteToBaseStream: BOOL, + ) -> HRESULT, + fn GetBaseStream( + ppStream: *mut *mut ISpStreamFormat, + ) -> HRESULT, + fn SetFormat( + rguidFormatIdOfConvertedStream: REFGUID, + pWaveFormatExOfConvertedStream: *const WAVEFORMATEX, + ) -> HRESULT, + fn ResetSeekPosition() -> HRESULT, + fn ScaleConvertedToBaseOffset( + ullOffsetConvertedStream: ULONGLONG, + pullOffsetBaseStream: *mut ULONGLONG, + ) -> HRESULT, + fn ScaleBaseToConvertedOffset( + ullOffsetBaseStream: ULONGLONG, + pullOffsetConvertedStream: *mut ULONGLONG, + ) -> HRESULT, +}); +ENUM!{enum SPAUDIOSTATE { + SPAS_CLOSED, + SPAS_STOP, + SPAS_PAUSE, + SPAS_RUN, +}} +STRUCT!{struct SPAUDIOSTATUS { + cbFreeBuffSpace: c_long, + cbNonBlockingIO: ULONG, + State: SPAUDIOSTATE, + CurSeekPos: ULONGLONG, + CurDevicePos: ULONGLONG, + dwAudioLevel: DWORD, + dwReserved2: DWORD, +}} +STRUCT!{struct SPAUDIOBUFFERINFO { + ulMsMinNotification: ULONG, + ulMsBufferSize: ULONG, + ulMsEventBias: ULONG, +}} +RIDL!(#[uuid(0xc05c768f, 0xfae8, 0x4ec2, 0x8e, 0x07, 0x33, 0x83, 0x21, 0xc1, 0x24, 0x52)] +interface ISpAudio(ISpAudioVtbl): ISpStreamFormat(ISpStreamFormatVtbl) { + fn SetState( + NewState: SPAUDIOSTATE, + ullReserved: ULONGLONG, + ) -> HRESULT, + fn SetFormat( + rguidFmtId: REFGUID, + pWaveFormatEx: *const WAVEFORMATEX, + ) -> HRESULT, + fn GetStatus( + pStatus: *mut SPAUDIOSTATUS, + ) -> HRESULT, + fn SetBufferInfo( + pBuffInfo: *const SPAUDIOBUFFERINFO, + ) -> HRESULT, + fn GetBufferInfo( + pBuffInfo: *mut SPAUDIOBUFFERINFO, + ) -> HRESULT, + fn GetDefaultFormat( + pFormatId: *mut GUID, + ppCoMemWaveFormatEx: *mut *mut WAVEFORMATEX, + ) -> HRESULT, + fn EventHandle() -> HANDLE, + fn GetVolumeLevel( + pLevel: *mut ULONG, + ) -> HRESULT, + fn SetVolumeLevel( + Level: ULONG, + ) -> HRESULT, + fn GetBufferNotifySize( + pcbSize: *mut ULONG, + ) -> HRESULT, + fn SetBufferNotifySize( + cbSize: ULONG, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x15806f6e, 0x1d70, 0x4b48, 0x98, 0xe6, 0x3b, 0x1a, 0x00, 0x75, 0x09, 0xab)] +interface ISpMMSysAudio(ISpMMSysAudioVtbl): ISpAudio(ISpAudioVtbl) { + fn GetDeviceId( + puDeviceId: *mut UINT, + ) -> HRESULT, + fn SetDeviceId( + uDeviceId: UINT, + ) -> HRESULT, + fn GetMMHandle( + pHandle: *mut *mut c_void, + ) -> HRESULT, + fn GetLineId( + puLineId: *mut UINT, + ) -> HRESULT, + fn SetLineId( + uLineId: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x10f63bce, 0x201a, 0x11d3, 0xac, 0x70, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0xc0)] +interface ISpTranscript(ISpTranscriptVtbl): IUnknown(IUnknownVtbl) { + fn GetTranscript( + ppszTranscript: *mut LPWSTR, + ) -> HRESULT, + fn AppendTranscript( + pszTranscript: LPCWSTR, + ) -> HRESULT, +}); +ENUM!{enum SPDISPLAYATTRIBUTES { + SPAF_ONE_TRAILING_SPACE = 0x2, + SPAF_TWO_TRAILING_SPACES = 0x4, + SPAF_CONSUME_LEADING_SPACES = 0x8, + SPAF_ALL = 0xf, +}} +pub type SPPHONEID = WCHAR; +pub type PSPPHONEID = LPWSTR; +pub type PCSPPHONEID = LPCWSTR; +STRUCT!{struct SPPHRASEELEMENT { + ulAudioTimeOffset: ULONG, + ulAudioSizeTime: ULONG, + ulAudioStreamOffset: ULONG, + ulAudioSizeBytes: ULONG, + ulRetainedStreamOffset: ULONG, + ulRetainedSizeBytes: ULONG, + pszDisplayText: LPCWSTR, + pszLexicalForm: LPCWSTR, + pszPronunciation: *const SPPHONEID, + bDisplayAttributes: BYTE, + RequiredConfidence: c_char, + ActualConfidence: c_char, + Reserved: BYTE, + SREngineConfidence: c_float, +}} +STRUCT!{struct SPPHRASERULE { + pszName: LPCWSTR, + ulId: ULONG, + ulFirstElement: ULONG, + ulCountOfElements: ULONG, + pNextSibling: *const SPPHRASERULE, + pFirstChild: *const SPPHRASERULE, + SREngineConfidence: c_float, + Confidence: c_char, +}} +ENUM!{enum SPPHRASEPROPERTYUNIONTYPE { + SPPPUT_UNUSED = 0, + SPPPUT_ARRAY_INDEX, +}} +STRUCT!{struct SPPHRASEPROPERTY_u_s { + bType: byte, + bReserved: byte, + usArrayIndex: c_ushort, +}} +UNION!{union SPPHRASEPROPERTY_u { + [u32; 1], + ulId ulId_mut: ULONG, + s s_mut: SPPHRASEPROPERTY_u_s, +}} +STRUCT!{struct SPPHRASEPROPERTY { + pszName: LPCWSTR, + u: SPPHRASEPROPERTY_u_s, + pszValue: LPCWSTR, + vValue: VARIANT, + ulFirstElement: ULONG, + ulCountOfElements: ULONG, + pNextSibling: *const SPPHRASEPROPERTY, + pFirstChild: *const SPPHRASEPROPERTY, + SREngineConfidence: c_float, + Confidence: c_char, +}} +STRUCT!{struct SPPHRASEREPLACEMENT { + bDisplayAttributes: BYTE, + pszReplacementText: LPCWSTR, + ulFirstElement: ULONG, + ulCountOfElements: ULONG, +}} +STRUCT!{struct SPPHRASE { + cbSize: ULONG, + LangID: WORD, + wHomophoneGroupId: WORD, + ullGrammarID: ULONGLONG, + ftStartTime: ULONGLONG, + ullAudioStreamPosition: ULONGLONG, + ulAudioSizeBytes: ULONG, + ulRetainedSizeBytes: ULONG, + ulAudioSizeTime: ULONG, + Rule: SPPHRASERULE, + pProperties: *const SPPHRASEPROPERTY, + pElements: *const SPPHRASEELEMENT, + cReplacements: ULONG, + pReplacements: *const SPPHRASEREPLACEMENT, + SREngineID: GUID, + ulSREnginePrivateDataSize: ULONG, + pSREnginePrivateData: *const BYTE, +}} +STRUCT!{struct SPSERIALIZEDPHRASE { + ulSerializedSize: ULONG, +}} +ENUM!{enum SPVALUETYPE { + SPDF_PROPERTY = 0x1, + SPDF_REPLACEMENT = 0x2, + SPDF_RULE = 0x4, + SPDF_DISPLAYTEXT = 0x8, + SPDF_LEXICALFORM = 0x10, + SPDF_PRONUNCIATION = 0x20, + SPDF_AUDIO = 0x40, + SPDF_ALTERNATES = 0x80, + SPDF_ALL = 0xff, +}} +STRUCT!{struct SPBINARYGRAMMAR { + ulTotalSerializedSize: ULONG, +}} +ENUM!{enum SPPHRASERNG { + SPPR_ALL_ELEMENTS = -1i32 as u32, +}} +pub const SP_GETWHOLEPHRASE: SPPHRASERNG = SPPR_ALL_ELEMENTS; +pub const SPRR_ALL_ELEMENTS: SPPHRASERNG = SPPR_ALL_ELEMENTS; +DECLARE_HANDLE!(SPSTATEHANDLE, SPSTATEHANDLE__); +ENUM!{enum SPRECOEVENTFLAGS { + SPREF_AutoPause = 1 << 0, + SPREF_Emulated = 1 << 1, +}} +ENUM!{enum SPPARTOFSPEECH { + SPPS_NotOverriden = -1i32 as u32, + SPPS_Unknown = 0, + SPPS_Noun = 0x1000, + SPPS_Verb = 0x2000, + SPPS_Modifier = 0x3000, + SPPS_Function = 0x4000, + SPPS_Interjection = 0x5000, +}} +ENUM!{enum SPLEXICONTYPE { + eLEXTYPE_USER = 1 << 0, + eLEXTYPE_APP = 1 << 1, + eLEXTYPE_VENDORLEXICON = 1 << 2, + eLEXTYPE_LETTERTOSOUND = 1 << 3, + eLEXTYPE_MORPHOLOGY = 1 << 4, + eLEXTYPE_RESERVED4 = 1 << 5, + eLEXTYPE_USER_SHORTCUT = 1 << 6, + eLEXTYPE_RESERVED6 = 1 << 7, + eLEXTYPE_RESERVED7 = 1 << 8, + eLEXTYPE_RESERVED8 = 1 << 9, + eLEXTYPE_RESERVED9 = 1 << 10, + eLEXTYPE_RESERVED10 = 1 << 11, + eLEXTYPE_PRIVATE1 = 1 << 12, + eLEXTYPE_PRIVATE2 = 1 << 13, + eLEXTYPE_PRIVATE3 = 1 << 14, + eLEXTYPE_PRIVATE4 = 1 << 15, + eLEXTYPE_PRIVATE5 = 1 << 16, + eLEXTYPE_PRIVATE6 = 1 << 17, + eLEXTYPE_PRIVATE7 = 1 << 18, + eLEXTYPE_PRIVATE8 = 1 << 19, + eLEXTYPE_PRIVATE9 = 1 << 20, + eLEXTYPE_PRIVATE10 = 1 << 21, + eLEXTYPE_PRIVATE11 = 1 << 22, + eLEXTYPE_PRIVATE12 = 1 << 23, + eLEXTYPE_PRIVATE13 = 1 << 24, + eLEXTYPE_PRIVATE14 = 1 << 25, + eLEXTYPE_PRIVATE15 = 1 << 26, + eLEXTYPE_PRIVATE16 = 1 << 27, + eLEXTYPE_PRIVATE17 = 1 << 28, + eLEXTYPE_PRIVATE18 = 1 << 29, + eLEXTYPE_PRIVATE19 = 1 << 30, + eLEXTYPE_PRIVATE20 = 1 << 31, +}} +ENUM!{enum SPWORDTYPE { + eWORDTYPE_ADDED = 1 << 0, + eWORDTYPE_DELETED = 1 << 1, +}} +STRUCT!{struct SPWORDPRONUNCIATION { + pNextWordPronunciation: *mut SPWORDPRONUNCIATION, + eLexiconType: SPLEXICONTYPE, + LangID: WORD, + wPronunciationFlags: WORD, + ePartOfSpeech: SPPARTOFSPEECH, + szPronunciation: [SPPHONEID; 1], +}} +STRUCT!{struct SPWORDPRONUNCIATIONLIST { + ulSize: ULONG, + pvBuffer: *mut BYTE, + pFirstWordPronunciation: *mut SPWORDPRONUNCIATION, +}} +STRUCT!{struct SPWORD { + pNextWord: *mut SPWORD, + LangID: WORD, + wReserved: WORD, + eWordType: SPWORDTYPE, + pszWord: LPWSTR, + pFirstWordPronunciation: *mut SPWORDPRONUNCIATION, +}} +STRUCT!{struct SPWORDLIST { + ulSize: ULONG, + pvBuffer: *mut BYTE, + pFirstWord: *mut SPWORD, +}} +RIDL!(#[uuid(0xda41a7c2, 0x5383, 0x4db2, 0x91, 0x6b, 0x6c, 0x17, 0x19, 0xe3, 0xdb, 0x58)] +interface ISpLexicon(ISpLexiconVtbl): IUnknown(IUnknownVtbl) { + fn GetPronunciations( + pszWord: LPCWSTR, + LangID: WORD, + dwFlags: DWORD, + pWordPronunciationList: *mut SPWORDPRONUNCIATIONLIST, + ) -> HRESULT, + fn AddPronunciation( + pszWord: LPCWSTR, + LangID: WORD, + ePartOfSpeech: SPPARTOFSPEECH, + pszPronunciation: PCSPPHONEID, + ) -> HRESULT, + fn RemovePronunciation( + pszWord: LPCWSTR, + LangID: WORD, + ePartOfSpeech: SPPARTOFSPEECH, + pszPronunciation: PCSPPHONEID, + ) -> HRESULT, + fn GetGeneration( + pdwGeneration: *mut DWORD, + ) -> HRESULT, + fn GetGenerationChange( + dwFlags: DWORD, + pdwGeneration: *mut DWORD, + pWordList: *mut SPWORDLIST, + ) -> HRESULT, + fn GetWords( + dwFlags: DWORD, + pdwGeneration: *mut DWORD, + pdwCookie: *mut DWORD, + pWordList: *mut SPWORDLIST, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8565572f, 0xc094, 0x41cc, 0xb5, 0x6e, 0x10, 0xbd, 0x9c, 0x3f, 0xf0, 0x44)] +interface ISpContainerLexicon(ISpContainerLexiconVtbl): ISpLexicon(ISpLexiconVtbl) { + fn AddLexicon( + pAddLexicon: *mut ISpLexicon, + dwFlags: DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8445c581, 0x0cac, 0x4a38, 0xab, 0xfe, 0x9b, 0x2c, 0xe2, 0x82, 0x64, 0x55)] +interface ISpPhoneConverter(ISpPhoneConverterVtbl): ISpObjectWithToken(ISpObjectWithTokenVtbl) { + fn PhoneToId( + pszPhone: LPCWSTR, + pId: *mut SPPHONEID, + ) -> HRESULT, + fn IdToPhone( + pId: PCSPPHONEID, + pszPhone: *mut WCHAR, + ) -> HRESULT, +}); +STRUCT!{struct SPVPITCH { + MiddleAdj: c_long, + RangeAdj: c_long, +}} +ENUM!{enum SPVACTIONS { + SPVA_Speak = 0, + SPVA_Silence, + SPVA_Pronounce, + SPVA_Bookmark, + SPVA_SpellOut, + SPVA_Section, + SPVA_ParseUnknownTag, +}} +STRUCT!{struct SPVCONTEXT { + pCategory: LPCWSTR, + pBefore: LPCWSTR, + pAfter: LPCWSTR, +}} +STRUCT!{struct SPVSTATE { + eAction: SPVACTIONS, + LangID: WORD, + wReserved: WORD, + EmphAdj: c_long, + RateAdj: c_long, + Volume: ULONG, + PitchAdj: SPVPITCH, + SilenceMSecs: ULONG, + pPhoneIds: *mut SPPHONEID, + ePartOfSpeech: SPPARTOFSPEECH, + Context: SPVCONTEXT, +}} +ENUM!{enum SPRUNSTATE { + SPRS_DONE = 1 << 0, + SPRS_IS_SPEAKING = 1 << 1, +}} +ENUM!{enum SPVLIMITS { + SPMIN_VOLUME = 0, + SPMAX_VOLUME = 100, + SPMIN_RATE = -10i32 as u32, + SPMAX_RATE = 10, +}} +ENUM!{enum SPVPRIORITY { + SPVPRI_NORMAL = 0, + SPVPRI_ALERT = 1 << 0, + SPVPRI_OVER = 1 << 1, +}} +STRUCT!{struct SPVOICESTATUS { + ulCurrentStream: ULONG, + ulLastStreamQueued: ULONG, + hrLastResult: HRESULT, + dwRunningState: DWORD, + ulInputWordPos: ULONG, + ulInputWordLen: ULONG, + ulInputSentPos: ULONG, + ulInputSentLen: ULONG, + lBookmarkId: LONG, + PhonemeId: SPPHONEID, + VisemeId: SPVISEMES, + dwReserved1: DWORD, + dwReserved2: DWORD, +}} +ENUM!{enum SPEAKFLAGS { + SPF_DEFAULT = 0, + SPF_ASYNC = 1 << 0, + SPF_PURGEBEFORESPEAK = 1 << 1, + SPF_IS_FILENAME = 1 << 2, + SPF_IS_XML = 1 << 3, + SPF_IS_NOT_XML = 1 << 4, + SPF_PERSIST_XML = 1 << 5, + SPF_NLP_SPEAK_PUNC = 1 << 6, + SPF_NLP_MASK = SPF_NLP_SPEAK_PUNC, + SPF_VOICE_MASK = SPF_ASYNC | SPF_PURGEBEFORESPEAK + | SPF_IS_FILENAME | SPF_IS_XML | SPF_IS_NOT_XML + | SPF_NLP_MASK | SPF_PERSIST_XML, + SPF_UNUSED_FLAGS = !SPF_VOICE_MASK, +}} +RIDL!(#[uuid(0x6c44df74, 0x72b9, 0x4992, 0xa1, 0xec, 0xef, 0x99, 0x6e, 0x04, 0x22, 0xd4)] +interface ISpVoice(ISpVoiceVtbl): ISpEventSource(ISpEventSourceVtbl) { + fn SetOutput( + pUnkOutput: *mut IUnknown, + fAllowFormatChanges: BOOL, + ) -> HRESULT, + fn GetOutputObjectToken( + ppObjectToken: *mut *mut ISpObjectToken, + ) -> HRESULT, + fn GetOutputStream( + ppStream: *mut *mut ISpStreamFormat, + ) -> HRESULT, + fn Pause() -> HRESULT, + fn Resume() -> HRESULT, + fn SetVoice( + pToken: *mut ISpObjectToken, + ) -> HRESULT, + fn GetVoice( + ppToken: *mut *mut ISpObjectToken, + ) -> HRESULT, + fn Speak( + pwcs: LPCWSTR, + dwFlags: DWORD, + pulStreamNumber: *mut ULONG, + ) -> HRESULT, + fn SpeakStream( + pStream: *mut IStream, + dwFlags: DWORD, + pulStreamNumber: *mut ULONG, + ) -> HRESULT, + fn GetStatus( + pStatus: *mut SPVOICESTATUS, + ppszLastBookmark: *mut LPWSTR, + ) -> HRESULT, + fn Skip( + pItemType: LPCWSTR, + lNumItems: c_long, + pulNumSkipped: *mut ULONG, + ) -> HRESULT, + fn SetPriority( + ePriority: SPVPRIORITY, + ) -> HRESULT, + fn GetPriority( + pePriority: *mut SPVPRIORITY, + ) -> HRESULT, + fn SetAlertBoundary( + eBoundary: SPEVENTENUM, + ) -> HRESULT, + fn GetAlertBoundary( + peBoundary: *mut SPEVENTENUM, + ) -> HRESULT, + fn SetRate( + RateAdjust: c_long, + ) -> HRESULT, + fn GetRate( + pRateAdjust: *mut c_long, + ) -> HRESULT, + fn SetVolume( + usVolume: USHORT, + ) -> HRESULT, + fn GetVolume( + pusVolume: *mut USHORT, + ) -> HRESULT, + fn WaitUntilDone( + msTimeout: ULONG, + ) -> HRESULT, + fn SetSyncSpeakTimeout( + msTimeout: ULONG, + ) -> HRESULT, + fn GetSyncSpeakTimeout( + pmsTimeout: *mut ULONG, + ) -> HRESULT, + fn SpeakCompleteEvent() -> HANDLE, + fn IsUISupported( + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + pfSupported: *mut BOOL, + ) -> HRESULT, + fn DisplayUI( + hwndParent: HWND, + pszTitle: LPCWSTR, + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x1a5c0354, 0xb621, 0x4b5a, 0x87, 0x91, 0xd3, 0x06, 0xed, 0x37, 0x9e, 0x53)] +interface ISpPhrase(ISpPhraseVtbl): IUnknown(IUnknownVtbl) { + fn GetPhrase( + ppCoMemPhrase: *mut *mut SPPHRASE, + ) -> HRESULT, + fn GetSerializedPhrase( + ppCoMemPhrase: *mut *mut SPSERIALIZEDPHRASE, + ) -> HRESULT, + fn GetText( + ulStart: ULONG, + ulCount: ULONG, + fUseTextReplacements: BOOL, + ppszCoMemText: *mut LPWSTR, + pbDisplayAttributes: *mut BYTE, + ) -> HRESULT, + fn Discard( + dwValueTypes: DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8fcebc98, 0x4e49, 0x4067, 0x9c, 0x6c, 0xd8, 0x6a, 0x0e, 0x09, 0x2e, 0x3d)] +interface ISpPhraseAlt(ISpPhraseAltVtbl): ISpPhrase(ISpPhraseVtbl) { + fn GetAltInfo( + pParent: *mut *mut ISpPhrase, + pulStartElementInParent: *mut ULONG, + pcElementsInParent: *mut ULONG, + pcElementsInAlt: *mut ULONG, + ) -> HRESULT, + fn Commit() -> HRESULT, +}); +STRUCT!{struct SPRECORESULTTIMES { + ftStreamTime: FILETIME, + ullLength: ULONGLONG, + dwTickCount: DWORD, + ullStart: ULONGLONG, +}} +STRUCT!{struct SPSERIALIZEDRESULT { + ulSerializedSize: ULONG, +}} +RIDL!(#[uuid(0x20b053be, 0xe235, 0x43cd, 0x9a, 0x2a, 0x8d, 0x17, 0xa4, 0x8b, 0x78, 0x42)] +interface ISpRecoResult(ISpRecoResultVtbl): ISpPhrase(ISpPhraseVtbl) { + fn GetResultTimes( + pTimes: *mut SPRECORESULTTIMES, + ) -> HRESULT, + fn GetAlternates( + ulStartElement: ULONG, + cElements: ULONG, + ulRequestCount: ULONG, + ppPhrases: *mut *mut ISpPhraseAlt, + pcPhrasesReturned: *mut ULONG, + ) -> HRESULT, + fn GetAudio( + ulStartElement: ULONG, + cElements: ULONG, + ppStream: *mut *mut ISpStreamFormat, + ) -> HRESULT, + fn SpeakAudio( + ulStartElement: ULONG, + cElements: ULONG, + dwFlags: DWORD, + pulStreamNumber: *mut ULONG, + ) -> HRESULT, + fn Serialize( + ppCoMemSerializedResult: *mut *mut SPSERIALIZEDRESULT, + ) -> HRESULT, + fn ScaleAudio( + pAudioFormatId: *const GUID, + pWaveFormatEx: *const WAVEFORMATEX, + ) -> HRESULT, + fn GetRecoContext( + ppRecoContext: *mut *mut ISpRecoContext, + ) -> HRESULT, +}); +STRUCT!{struct SPTEXTSELECTIONINFO { + ulStartActiveOffset: ULONG, + cchActiveChars: ULONG, + ulStartSelection: ULONG, + cchSelection: ULONG, +}} +ENUM!{enum SPWORDPRONOUNCEABLE { + SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1, + SPWP_KNOWN_WORD_PRONOUNCEABLE = 2, +}} +ENUM!{enum SPGRAMMARSTATE { + SPGS_DISABLED = 0, + SPGS_ENABLED = 1, + SPGS_EXCLUSIVE = 3, +}} +ENUM!{enum SPCONTEXTSTATE { + SPCS_DISABLED = 0, + SPCS_ENABLED = 1, +}} +ENUM!{enum SPRULESTATE { + SPRS_INACTIVE = 0, + SPRS_ACTIVE = 1, + SPRS_ACTIVE_WITH_AUTO_PAUSE = 3, +}} +pub const SP_STREAMPOS_ASAP: ULONGLONG = 0; +pub const SP_STREAMPOS_REALTIME: ULONGLONG = -1i64 as u64; +pub const SPRULETRANS_TEXTBUFFER: SPSTATEHANDLE = -1isize as SPSTATEHANDLE; +pub const SPRULETRANS_WILDCARD: SPSTATEHANDLE = -2isize as SPSTATEHANDLE; +pub const SPRULETRANS_DICTATION: SPSTATEHANDLE = -3isize as SPSTATEHANDLE; +ENUM!{enum SPGRAMMARWORDTYPE { + SPWT_DISPLAY, + SPWT_LEXICAL, + SPWT_PRONUNCIATION, + SPWT_LEXICAL_NO_SPECIAL_CHARS, +}} +STRUCT!{struct SPPROPERTYINFO { + pszName: LPCWSTR, + ulId: ULONG, + pszValue: LPCWSTR, + vValue: VARIANT, +}} +ENUM!{enum SPCFGRULEATTRIBUTES { + SPRAF_TopLevel = 1 << 0, + SPRAF_Active = 1 << 1, + SPRAF_Export = 1 << 2, + SPRAF_Import = 1 << 3, + SPRAF_Interpreter = 1 << 4, + SPRAF_Dynamic = 1 << 5, + SPRAF_AutoPause = 1 << 16, +}} +RIDL!(#[uuid(0x8137828f, 0x591a, 0x4a42, 0xbe, 0x58, 0x49, 0xea, 0x7e, 0xba, 0xac, 0x68)] +interface ISpGrammarBuilder(ISpGrammarBuilderVtbl): IUnknown(IUnknownVtbl) { + fn ResetGrammar( + NewLanguage: WORD, + ) -> HRESULT, + fn GetRule( + pszRuleName: LPCWSTR, + dwRuleId: DWORD, + dwAttributes: DWORD, + fCreateIfNotExist: BOOL, + phInitialState: *mut SPSTATEHANDLE, + ) -> HRESULT, + fn ClearRule( + hState: SPSTATEHANDLE, + ) -> HRESULT, + fn CreateNewState( + hState: SPSTATEHANDLE, + phState: *mut SPSTATEHANDLE, + ) -> HRESULT, + fn AddWordTransition( + hFromState: SPSTATEHANDLE, + hToState: SPSTATEHANDLE, + psz: LPCWSTR, + pszSeparators: LPCWSTR, + eWordType: SPGRAMMARWORDTYPE, + Weight: c_float, + pPropInfo: *const SPPROPERTYINFO, + ) -> HRESULT, + fn AddRuleTransition( + hFromState: SPSTATEHANDLE, + hToState: SPSTATEHANDLE, + hRule: SPSTATEHANDLE, + Weight: c_float, + pPropInfo: *const SPPROPERTYINFO, + ) -> HRESULT, + fn AddResource( + hRuleState: SPSTATEHANDLE, + pszResourceName: LPCWSTR, + pszResourceValue: LPCWSTR, + ) -> HRESULT, + fn Commit( + dwReserved: DWORD, + ) -> HRESULT, +}); +ENUM!{enum SPLOADOPTIONS { + SPLO_STATIC = 0, + SPLO_DYNAMIC = 1, +}} +RIDL!(#[uuid(0x2177db29, 0x7f45, 0x47d0, 0x85, 0x54, 0x06, 0x7e, 0x91, 0xc8, 0x05, 0x02)] +interface ISpRecoGrammar(ISpRecoGrammarVtbl): ISpGrammarBuilder(ISpGrammarBuilderVtbl) { + fn GetGrammarId( + pullGrammarId: *mut ULONGLONG, + ) -> HRESULT, + fn GetRecoContext( + ppRecoCtxt: *mut *mut ISpRecoContext, + ) -> HRESULT, + fn LoadCmdFromFile( + pszFileName: LPCWSTR, + Options: SPLOADOPTIONS, + ) -> HRESULT, + fn LoadCmdFromObject( + rcid: REFCLSID, + pszGrammarName: LPCWSTR, + Options: SPLOADOPTIONS, + ) -> HRESULT, + fn LoadCmdFromResource( + hModule: HMODULE, + pszResourceName: LPCWSTR, + pszResourceType: LPCWSTR, + wLanguage: WORD, + Options: SPLOADOPTIONS, + ) -> HRESULT, + fn LoadCmdFromMemory( + pGrammar: *const SPBINARYGRAMMAR, + Options: SPLOADOPTIONS, + ) -> HRESULT, + fn LoadCmdFromProprietaryGrammar( + rguidParam: REFGUID, + pszStringParam: LPCWSTR, + pvDataPrarm: *const c_void, + cbDataSize: ULONG, + Options: SPLOADOPTIONS, + ) -> HRESULT, + fn SetRuleState( + pszName: LPCWSTR, + pReserved: *mut c_void, + NewState: SPRULESTATE, + ) -> HRESULT, + fn SetRuleIdState( + ulRuleId: ULONG, + NewState: SPRULESTATE, + ) -> HRESULT, + fn LoadDictation( + pszTopicName: LPCWSTR, + Options: SPLOADOPTIONS, + ) -> HRESULT, + fn UnloadDictation() -> HRESULT, + fn SetDictationState( + NewState: SPRULESTATE, + ) -> HRESULT, + fn SetWordSequenceData( + pText: *const WCHAR, + cchText: ULONG, + pInfo: *const SPTEXTSELECTIONINFO, + ) -> HRESULT, + fn SetTextSelection( + pInfo: *const SPTEXTSELECTIONINFO, + ) -> HRESULT, + fn IsPronounceable( + pszWord: LPCWSTR, + pWordPronounceable: *mut SPWORDPRONOUNCEABLE, + ) -> HRESULT, + fn SetGrammarState( + eGrammarState: SPGRAMMARSTATE, + ) -> HRESULT, + fn SaveCmd( + pStream: *mut IStream, + ppszCoMemErrorText: *mut LPWSTR, + ) -> HRESULT, + fn GetGrammarState( + peGrammarState: *mut SPGRAMMARSTATE, + ) -> HRESULT, +}); +STRUCT!{struct SPRECOCONTEXTSTATUS { + eInterference: SPINTERFERENCE, + szRequestTypeOfUI: [WCHAR; 255], + dwReserved1: DWORD, + dwReserved2: DWORD, +}} +ENUM!{enum SPBOOKMARKOPTIONS { + SPBO_NONE = 0, + SPBO_PAUSE = 1 << 0, +}} +ENUM!{enum SPAUDIOOPTIONS { + SPAO_NONE = 0, + SPAO_RETAIN_AUDIO = 1 << 0, +}} +RIDL!(#[uuid(0xf740a62f, 0x7c15, 0x489e, 0x82, 0x34, 0x94, 0x0a, 0x33, 0xd9, 0x27, 0x2d)] +interface ISpRecoContext(ISpRecoContextVtbl): ISpEventSource(ISpEventSourceVtbl) { + fn GetRecognizer( + ppRecognizer: *mut *mut ISpRecognizer, + ) -> HRESULT, + fn CreateGrammer( + ullGrammarId: ULONGLONG, + ppGrammar: *mut *mut ISpRecoGrammar, + ) -> HRESULT, + fn GetStatus( + pState: *mut SPRECOCONTEXTSTATUS, + ) -> HRESULT, + fn GetMaxAlternates( + pcAlternates: *mut ULONG, + ) -> HRESULT, + fn SetMaxAlternates( + cAlternates: ULONG, + ) -> HRESULT, + fn SetAudioOptions( + Options: SPAUDIOOPTIONS, + pAudioFormatId: *const GUID, + pWaveFormatEx: *const WAVEFORMATEX, + ) -> HRESULT, + fn GetAudioOptions( + pOptions: *mut SPAUDIOOPTIONS, + pAudioFormatId: *mut GUID, + ppCoMemWFEX: *mut *mut WAVEFORMATEX, + ) -> HRESULT, + fn DeserializeResult( + pSerializedResult: *const SPSERIALIZEDRESULT, + ppResult: *mut *mut ISpRecoResult, + ) -> HRESULT, + fn Bookmark( + Options: SPBOOKMARKOPTIONS, + ullStreamPosition: ULONGLONG, + lparamEvent: LPARAM, + ) -> HRESULT, + fn SetAdaptionData( + pAdaptionData: LPCWSTR, + cch: ULONG, + ) -> HRESULT, + fn Pause( + dwReserved: DWORD, + ) -> HRESULT, + fn Resume( + dwReserved: DWORD, + ) -> HRESULT, + fn SetVoice( + pVoice: *mut ISpVoice, + fAllowFormatChanges: BOOL, + ) -> HRESULT, + fn GetVoice( + ppVoice: *mut *mut ISpVoice, + ) -> HRESULT, + fn SetVoicePurgeEvent( + ullEventIntereset: ULONGLONG, + ) -> HRESULT, + fn GetVoicePurgeEvent( + pullEventIntereset: *mut ULONGLONG, + ) -> HRESULT, + fn SetContextState( + eContextState: SPCONTEXTSTATE, + ) -> HRESULT, + fn GetContextState( + peContextState: *mut SPCONTEXTSTATE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x5b4fb971, 0xb115, 0x4de1, 0xad, 0x97, 0xe4, 0x82, 0xe3, 0xbf, 0x6e, 0xe4)] +interface ISpProperties(ISpPropertiesVtbl): IUnknown(IUnknownVtbl) { + fn SetPropertyNum( + pName: LPCWSTR, + lValue: LONG, + ) -> HRESULT, + fn GetPropertyNum( + pName: LPCWSTR, + plValue: *mut LONG, + ) -> HRESULT, + fn SetPropertyString( + pName: LPCWSTR, + pValue: LPCWSTR, + ) -> HRESULT, + fn GetPropertyString( + pName: LPCWSTR, + ppCoMemValue: *mut LPWSTR, + ) -> HRESULT, +}); +pub const SP_MAX_LANGIDS: usize = 20; +STRUCT!{struct SPRECOGNIZERSTATUS { + AudioStatus: SPAUDIOSTATUS, + ullRecognitionStreamPos: ULONGLONG, + ulStreamNumber: ULONG, + ulNumActive: ULONG, + clsidEngine: CLSID, + cLangIDs: ULONG, + aLangID: [WORD; SP_MAX_LANGIDS], + ullRecognitionStreamTime: ULONGLONG, +}} +ENUM!{enum SPWAVEFORMATTYPE { + SPWF_INPUT, + SPWF_SRENGINE, +}} +pub type SPSTREAMFORMATTYPE = SPWAVEFORMATTYPE; +ENUM!{enum SPRECOSTATE { + SPRST_INACTIVE, + SPRST_ACTIVE, + SPRST_ACTIVE_ALWAYS, + SPRST_INACTIVE_WITH_PURGE, + SPRST_NUM_STATES, +}} +RIDL!(#[uuid(0xc2b5f241, 0xdaa0, 0x4507, 0x9e, 0x16, 0x5a, 0x1e, 0xaa, 0x2b, 0x7a, 0x5c)] +interface ISpRecognizer(ISpRecognizerVtbl): ISpProperties(ISpPropertiesVtbl) { + fn SetRecognizer( + pRecognizer: *mut ISpObjectToken, + ) -> HRESULT, + fn GetRecognizer( + ppRecognizer: *mut *mut ISpObjectToken, + ) -> HRESULT, + fn SetInput( + pUnkInput: *mut IUnknown, + fAllowFormatChanges: BOOL, + ) -> HRESULT, + fn GetInputObjectToken( + ppToken: *mut *mut ISpObjectToken, + ) -> HRESULT, + fn GetInputStream( + ppStream: *mut *mut ISpStreamFormat, + ) -> HRESULT, + fn CreateRecoContext( + ppNewCtxt: *mut *mut ISpRecoContext, + ) -> HRESULT, + fn GetRecoProfile( + ppToken: *mut *mut ISpObjectToken, + ) -> HRESULT, + fn SetRecoProfile( + pToken: *mut ISpObjectToken, + ) -> HRESULT, + fn IsSharedInstance() -> HRESULT, + fn GetRecoState( + pState: *mut SPRECOSTATE, + ) -> HRESULT, + fn SetRecoState( + NewState: SPRECOSTATE, + ) -> HRESULT, + fn GetStatus( + pStatus: *mut SPRECOGNIZERSTATUS, + ) -> HRESULT, + fn GetFormat( + WaveFormatType: SPSTREAMFORMATTYPE, + pFormatId: *mut GUID, + ppCoMemWFEX: *mut WAVEFORMATEX, + ) -> HRESULT, + fn IsUISupported( + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + pfSupported: *mut BOOL, + ) -> HRESULT, + fn DisplayUI( + hwndParent: HWND, + pszTitle: LPCWSTR, + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + ) -> HRESULT, + fn EmulateRecognition( + pPhrase: *mut ISpPhrase, + ) -> HRESULT, +}); +pub type SpeechLanguageId = c_long; +ENUM!{enum DISPID_SpeechDataKey { + DISPID_SDKSetBinaryValue = 1, + DISPID_SDKGetBinaryValue, + DISPID_SDKSetStringValue, + DISPID_SDKGetStringValue, + DISPID_SDKSetLongValue, + DISPID_SDKGetlongValue, + DISPID_SDKOpenKey, + DISPID_SDKCreateKey, + DISPID_SDKDeleteKey, + DISPID_SDKDeleteValue, + DISPID_SDKEnumKeys, + DISPID_SDKEnumValues, +}} +ENUM!{enum DISPID_SpeechObjectToken { + DISPID_SOTId = 1, + DISPID_SOTDataKey, + DISPID_SOTCategory, + DISPID_SOTGetDescription, + DISPID_SOTSetId, + DISPID_SOTGetAttribute, + DISPID_SOTCreateInstance, + DISPID_SOTRemove, + DISPID_SOTGetStorageFileName, + DISPID_SOTRemoveStorageFileName, + DISPID_SOTIsUISupported, + DISPID_SOTDisplayUI, + DISPID_SOTMatchesAttributes, +}} +ENUM!{enum SpeechDataKeyLocation { + SDKLDefaultLocation = SPDKL_DefaultLocation, + SDKLCurrentUser = SPDKL_CurrentUser, + SDKLLocalMachine = SPDKL_LocalMachine, + SDKLCurrentConfig = SPDKL_CurrentConfig, +}} +ENUM!{enum SpeechTokenContext { + STCInprocServer = CLSCTX_INPROC_SERVER, + STCInprocHandler = CLSCTX_INPROC_HANDLER, + STCLocalServer = CLSCTX_LOCAL_SERVER, + STCRemoteServer = CLSCTX_REMOTE_SERVER, + STCAll = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER + | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER, +}} +ENUM!{enum SpeechTokenShellFolder { + STSF_AppData = 0x1a, + STSF_LocalAppData = 0x1c, + STSF_CommonAppData = 0x23, + STSF_FlagCreate = 0x8000, +}} +ENUM!{enum DISPID_SpeechObjectTokens { + DISPID_SOTsCount = 1, + DISPID_SOTsItem = DISPID_VALUE as u32, + DISPID_SOTs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechObjectTokenCategory { + DISPID_SOTCId = 1, + DISPID_SOTCDefault, + DISPID_SOTCSetId, + DISPID_SOTCGetDataKey, + DISPID_SOTCEnumerateTokens, +}} +ENUM!{enum SpeechAudioFormatType { + SAFTDefault = -1i32 as u32, + SAFTNoAssignedFormat = 0, + SAFTText = 1, + SAFTNonStandardFormat = 2, + SAFTExtendedAudioFormat = 3, + SAFT8kHz8BitMono = 4, + SAFT8kHz8BitStereo = 5, + SAFT8kHz16BitMono = 6, + SAFT8kHz16BitStereo = 7, + SAFT11kHz8BitMono = 8, + SAFT11kHz8BitStereo = 9, + SAFT11kHz16BitMono = 10, + SAFT11kHz16BitStereo = 11, + SAFT12kHz8BitMono = 12, + SAFT12kHz8BitStereo = 13, + SAFT12kHz16BitMono = 14, + SAFT12kHz16BitStereo = 15, + SAFT16kHz8BitMono = 16, + SAFT16kHz8BitStereo = 17, + SAFT16kHz16BitMono = 18, + SAFT16kHz16BitStereo = 19, + SAFT22kHz8BitMono = 20, + SAFT22kHz8BitStereo = 21, + SAFT22kHz16BitMono = 22, + SAFT22kHz16BitStereo = 23, + SAFT24kHz8BitMono = 24, + SAFT24kHz8BitStereo = 25, + SAFT24kHz16BitMono = 26, + SAFT24kHz16BitStereo = 27, + SAFT32kHz8BitMono = 28, + SAFT32kHz8BitStereo = 29, + SAFT32kHz16BitMono = 30, + SAFT32kHz16BitStereo = 31, + SAFT44kHz8BitMono = 32, + SAFT44kHz8BitStereo = 33, + SAFT44kHz16BitMono = 34, + SAFT44kHz16BitStereo = 35, + SAFT48kHz8BitMono = 36, + SAFT48kHz8BitStereo = 37, + SAFT48kHz16BitMono = 38, + SAFT48kHz16BitStereo = 39, + SAFTTrueSpeech_8kHz1BitMono = 40, + SAFTCCITT_ALaw_8kHzMono = 41, + SAFTCCITT_ALaw_8kHzStereo = 42, + SAFTCCITT_ALaw_11kHzMono = 43, + SAFTCCITT_ALaw_11kHzStereo = 44, + SAFTCCITT_ALaw_22kHzMono = 45, + SAFTCCITT_ALaw_22kHzStereo = 46, + SAFTCCITT_ALaw_44kHzMono = 47, + SAFTCCITT_ALaw_44kHzStereo = 48, + SAFTCCITT_uLaw_8kHzMono = 49, + SAFTCCITT_uLaw_8kHzStereo = 50, + SAFTCCITT_uLaw_11kHzMono = 51, + SAFTCCITT_uLaw_11kHzStereo = 52, + SAFTCCITT_uLaw_22kHzMono = 53, + SAFTCCITT_uLaw_22kHzStereo = 54, + SAFTCCITT_uLaw_44kHzMono = 55, + SAFTCCITT_uLaw_44kHzStereo = 56, + SAFTADPCM_8kHzMono = 57, + SAFTADPCM_8kHzStereo = 58, + SAFTADPCM_11kHzMono = 59, + SAFTADPCM_11kHzStereo = 60, + SAFTADPCM_22kHzMono = 61, + SAFTADPCM_22kHzStereo = 62, + SAFTADPCM_44kHzMono = 63, + SAFTADPCM_44kHzStereo = 64, + SAFTGSM610_8kHzMono = 65, + SAFTGSM610_11kHzMono = 66, + SAFTGSM610_22kHzMono = 67, + SAFTGSM610_44kHzMono = 68, +}} +ENUM!{enum DISPID_SpeechAudioFormat { + DISPID_SAFType = 1, + DISPID_SAFGuid, + DISPID_SAFGetWaveFormatEx, + DISPID_SAFSetWaveFormatEx, +}} +ENUM!{enum DISPID_SpeechBaseStream { + DISPID_SBSFormat = 1, + DISPID_SBSRead, + DISPID_SBSWrite, + DISPID_SBSSeek, +}} +ENUM!{enum SpeechStreamSeekPositionType { + SSSPTRelativeToStart = STREAM_SEEK_SET, + SSSPTRelativeToCurrentPosition = STREAM_SEEK_CUR, + SSSPTRelativeToEnd = STREAM_SEEK_END, +}} +ENUM!{enum DISPID_SpeechAudio { + DISPID_SAStatus = 200, + DISPID_SABufferInfo, + DISPID_SADefaultFormat, + DISPID_SAVolume, + DISPID_SABufferNotifySize, + DISPID_SAEventHandle, + DISPID_SASetState, +}} +ENUM!{enum SpeechAudioState { + SASClosed = SPAS_CLOSED, + SASStop = SPAS_STOP, + SASPause = SPAS_PAUSE, + SASRun = SPAS_RUN, +}} +ENUM!{enum DISPID_SpeechMMSysAudio { + DISPID_SMSADeviceId = 300, + DISPID_SMSALineId, + DISPID_SMSAMMHandle, +}} +ENUM!{enum DISPID_SpeechFileStream { + DISPID_SFSOpen = 100, + DISPID_SFSClose, +}} +ENUM!{enum SpeechStreamFileMode { + SSFMOpenForRead = SPFM_OPEN_READONLY, + SSFMOpenReadWrite = SPFM_OPEN_READWRITE, + SSFMCreate = SPFM_CREATE, + SSFMCreateForWrite = SPFM_CREATE_ALWAYS, +}} +ENUM!{enum DISPID_SpeechCustomStream { + DISPID_SCSBaseStream = 100, +}} +ENUM!{enum DISPID_SpeechMemoryStream { + DISPID_SMSSetData = 100, + DISPID_SMSGetData, +}} +ENUM!{enum DISPID_SpeechAudioStatus { + DISPID_SASFreeBufferSpace = 1, + DISPID_SASNonBlockingIO, + DISPID_SASState, + DISPID_SASCurrentSeekPosition, + DISPID_SASCurrentDevicePosition, +}} +ENUM!{enum DISPID_SpeechAudioBufferInfo { + DISPID_SABIMinNotification = 1, + DISPID_SABIBufferSize, + DISPID_SABIEventBias, +}} +ENUM!{enum DISPID_SpeechWaveFormatEx { + DISPID_SWFEFormatTag = 1, + DISPID_SWFEChannels, + DISPID_SWFESamplesPerSec, + DISPID_SWFEAvgBytesPerSec, + DISPID_SWFEBlockAlign, + DISPID_SWFEBitsPerSample, + DISPID_SWFEExtraData, +}} +ENUM!{enum DISPID_SpeechVoice { + DISPID_SVStatus = 1, + DISPID_SVVoice, + DISPID_SVAudioOutput, + DISPID_SVAudioOutputStream, + DISPID_SVRate, + DISPID_SVVolume, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet, + DISPID_SVEventInterests, + DISPID_SVPriority, + DISPID_SVAlertBoundary, + DISPID_SVSyncronousSpeakTimeout, + DISPID_SVSpeak, + DISPID_SVSpeakStream, + DISPID_SVPause, + DISPID_SVResume, + DISPID_SVSkip, + DISPID_SVGetVoices, + DISPID_SVGetAudioOutputs, + DISPID_SVWaitUntilDone, + DISPID_SVSpeakCompleteEvent, + DISPID_SVIsUISupported, + DISPID_SVDisplayUI, +}} +ENUM!{enum SpeechVoicePriority { + SVPNormal = SPVPRI_NORMAL, + SVPAlert = SPVPRI_ALERT, + SVPOver = SPVPRI_OVER, +}} +ENUM!{enum SpeechVoiceSpeakFlags { + SVSFDefault = SPF_DEFAULT, + SVSFlagsAsync = SPF_ASYNC, + SVSFPurgeBeforeSpeak = SPF_PURGEBEFORESPEAK, + SVSFIsFilename = SPF_IS_FILENAME, + SVSFIsXML = SPF_IS_XML, + SVSFIsNotXML = SPF_IS_NOT_XML, + SVSFPersistXML = SPF_PERSIST_XML, + SVSFNLPSpeakPunc = SPF_NLP_SPEAK_PUNC, + SVSFNLPMask = SPF_NLP_MASK, + SVSFVoiceMask = SPF_VOICE_MASK as u32, + SVSFUnusedFlags = SPF_UNUSED_FLAGS as u32, +}} +ENUM!{enum SpeechVoiceEvents { + SVEStartInputStream = 1 << 1, + SVEEndInputStream = 1 << 2, + SVEVoiceChange = 1 << 3, + SVEBookmark = 1 << 4, + SVEWordBoundary = 1 << 5, + SVEPhoneme = 1 << 6, + SVESentenceBoundary = 1 << 7, + SVEViseme = 1 << 8, + SVEAudioLevel = 1 << 9, + SVEPrivate = 1 << 15, + SVEAllEvents = 0x83fe, +}} +ENUM!{enum DISPID_SpeechVoiceStatus { + DISPID_SVSCurrentStreamNumber = 1, + DISPID_SVSLastStreamNumberQueued, + DISPID_SVSLastResult, + DISPID_SVSRunningState, + DISPID_SVSInputWordPosition, + DISPID_SVSInputWordLength, + DISPID_SVSInputSentencePosition, + DISPID_SVSInputSentenceLength, + DISPID_SVSLastBookmark, + DISPID_SVSLastBookmarkId, + DISPID_SVSPhonemeId, + DISPID_SVSVisemeId, +}} +ENUM!{enum SpeechRunState { + SRSEDone = SPRS_DONE, + SRSEIsSpeaking = SPRS_IS_SPEAKING, +}} +ENUM!{enum SpeechVisemeType { + SVP_0 = 0, + SVP_1, + SVP_2, + SVP_3, + SVP_4, + SVP_5, + SVP_6, + SVP_7, + SVP_8, + SVP_9, + SVP_10, + SVP_11, + SVP_12, + SVP_13, + SVP_14, + SVP_15, + SVP_16, + SVP_17, + SVP_18, + SVP_19, + SVP_20, + SVP_21, +}} +ENUM!{enum SpeechVisemeFeature { + SVF_None = 0, + SVF_Stressed = SPVFEATURE_STRESSED, + SVF_Emphasis = SPVFEATURE_EMPHASIS, +}} +ENUM!{enum DISPID_SpeechVoiceEvent { + DISPID_SVEStreamStart = 1, + DISPID_SVEStreamEnd, + DISPID_SVEVoiceChange, + DISPID_SVEBookmark, + DISPID_SVEWord, + DISPID_SVEPhoneme, + DISPID_SVESentenceBoundary, + DISPID_SVEViseme, + DISPID_SVEAudioLevel, + DISPID_SVEEnginePrivate, +}} +ENUM!{enum DISPID_SpeechRecognizer { + DISPID_SRRecognizer = 1, + DISPID_SRAllowAudioInputFormatChangesOnNextSet, + DISPID_SRAudioInput, + DISPID_SRAudioInputStream, + DISPID_SRIsShared, + DISPID_SRState, + DISPID_SRStatus, + DISPID_SRProfile, + DISPID_SREmulateRecognition, + DISPID_SRCreateRecoContext, + DISPID_SRGetFormat, + DISPID_SRSetPropertyNumber, + DISPID_SRGetPropertyNumber, + DISPID_SRSetPropertyString, + DISPID_SRGetPropertyString, + DISPID_SRIsUISupported, + DISPID_SRDisplayUI, + DISPID_SRGetRecognizers, + DISPID_SVGetAudioInputs, + DISPID_SVGetProfiles, +}} +ENUM!{enum SpeechRecognizerState { + SRSInactive = SPRST_INACTIVE, + SRSActive = SPRST_ACTIVE, + SRSActiveAlways = SPRST_ACTIVE_ALWAYS, + SRSInactiveWithPurge = SPRST_INACTIVE_WITH_PURGE, +}} +ENUM!{enum SpeechDisplayAttributes { + SDA_No_Trailing_Space = 0, + SDA_One_Trailing_Space = SPAF_ONE_TRAILING_SPACE, + SDA_Two_Trailing_Spaces = SPAF_TWO_TRAILING_SPACES, + SDA_Consume_Leading_Spaces = SPAF_CONSUME_LEADING_SPACES, +}} +ENUM!{enum SpeechFormatType { + SFTInput = SPWF_INPUT, + SFTSREngine = SPWF_SRENGINE, +}} +ENUM!{enum DISPID_SpeechRecognizerStatus { + DISPID_SRSAudioStatus = 1, + DISPID_SRSCurrentStreamPosition, + DISPID_SRSCurrentStreamNumber, + DISPID_SRSNumberOfActiveRules, + DISPID_SRSClsidEngine, + DISPID_SRSSupportedLanguages, +}} +ENUM!{enum DISPID_SpeechRecoContext { + DISPID_SRCRecognizer = 1, + DISPID_SRCAudioInInterferenceStatus, + DISPID_SRCRequestedUIType, + DISPID_SRCVoice, + DISPID_SRAllowVoiceFormatMatchingOnNextSet, + DISPID_SRCVoicePurgeEvent, + DISPID_SRCEventInterests, + DISPID_SRCCmdMaxAlternates, + DISPID_SRCState, + DISPID_SRCRetainedAudio, + DISPID_SRCRetainedAudioFormat, + DISPID_SRCPause, + DISPID_SRCResume, + DISPID_SRCCreateGrammar, + DISPID_SRCCreateResultFromMemory, + DISPID_SRCBookmark, + DISPID_SRCSetAdaptationData, +}} +ENUM!{enum SpeechRetainedAudioOptions { + SRAONone = SPAO_NONE, + SRAORetainAudio = SPAO_RETAIN_AUDIO, +}} +ENUM!{enum SpeechBookmarkOptions { + SBONone = SPBO_NONE, + SBOPause = SPBO_PAUSE, +}} +ENUM!{enum SpeechInterference { + SINone = SPINTERFERENCE_NONE, + SINoise = SPINTERFERENCE_NOISE, + SINoSignal = SPINTERFERENCE_NOSIGNAL, + SITooLoud = SPINTERFERENCE_TOOLOUD, + SITooQuiet = SPINTERFERENCE_TOOQUIET, + SITooFast = SPINTERFERENCE_TOOFAST, + SITooSlow = SPINTERFERENCE_TOOSLOW, +}} +ENUM!{enum SpeechRecoEvents { + SREStreamEnd = 1 << 0, + SRESoundStart = 1 << 1, + SRESoundEnd = 1 << 2, + SREPhraseStart = 1 << 3, + SRERecognition = 1 << 4, + SREHypothesis = 1 << 5, + SREBookmark = 1 << 6, + SREPropertyNumChange = 1 << 7, + SREPropertyStringChange = 1 << 8, + SREFalseRecognition = 1 << 9, + SREInterference = 1 << 10, + SRERequestUI = 1 << 11, + SREStateChange = 1 << 12, + SREAdaptation = 1 << 13, + SREStreamStart = 1 << 14, + SRERecoOtherContext = 1 << 15, + SREAudioLevel = 1 << 16, + SREPrivate = 1 << 18, + SREAllEvents = 0x5ffff, +}} +ENUM!{enum SpeechRecoContextState { + SRCS_Disabled = SPCS_DISABLED, + SRCS_Enabled = SPCS_ENABLED, +}} +ENUM!{enum DISPIDSPRG { + DISPID_SRGId = 1, + DISPID_SRGRecoContext, + DISPID_SRGState, + DISPID_SRGRules, + DISPID_SRGReset, + DISPID_SRGCommit, + DISPID_SRGCmdLoadFromFile, + DISPID_SRGCmdLoadFromObject, + DISPID_SRGCmdLoadFromResource, + DISPID_SRGCmdLoadFromMemory, + DISPID_SRGCmdLoadFromProprietaryGrammar, + DISPID_SRGCmdSetRuleState, + DISPID_SRGCmdSetRuleIdState, + DISPID_SRGDictationLoad, + DISPID_SRGDictationUnload, + DISPID_SRGDictationSetState, + DISPID_SRGSetWordSequenceData, + DISPID_SRGSetTextSelection, + DISPID_SRGIsPronounceable, +}} +ENUM!{enum SpeechLoadOption { + SLOStatic = SPLO_STATIC, + SLODynamic = SPLO_DYNAMIC, +}} +ENUM!{enum SpeechWordPronounceable { + SWPUnknownWordUnpronounceable = SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, + SWPUnknownWordPronounceable = SPWP_UNKNOWN_WORD_PRONOUNCEABLE, + SWPKnownWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE, +}} +ENUM!{enum SpeechGrammarState { + SGSEnabled = SPGS_ENABLED, + SGSDisabled = SPGS_DISABLED, + SGSExclusive = SPGS_EXCLUSIVE, +}} +ENUM!{enum SpeechRuleState { + SGDSInactive = SPRS_INACTIVE, + SGDSActive = SPRS_ACTIVE, + SGDSActiveWithAutoPause = SPRS_ACTIVE_WITH_AUTO_PAUSE, +}} +ENUM!{enum SpeechRuleAttributes { + SRATopLevel = SPRAF_TopLevel, + SRADefaultToActive = SPRAF_Active, + SRAExport = SPRAF_Export, + SRAImport = SPRAF_Import, + SRAInterpreter = SPRAF_Interpreter, + SRADynamic = SPRAF_Dynamic, +}} +ENUM!{enum SpeechGrammarWordType { + SGDisplay = SPWT_DISPLAY, + SGLexical = SPWT_LEXICAL, + SGPronounciation = SPWT_PRONUNCIATION, +}} +ENUM!{enum DISPID_SpeechRecoContextEvents { + DISPID_SRCEStartStream = 1, + DISPID_SRCEEndStream, + DISPID_SRCEBookmark, + DISPID_SRCESoundStart, + DISPID_SRCESoundEnd, + DISPID_SRCEPhraseStart, + DISPID_SRCERecognition, + DISPID_SRCEHypothesis, + DISPID_SRCEPropertyNumberChange, + DISPID_SRCEPropertyStringChange, + DISPID_SRCEFalseRecognition, + DISPID_SRCEInterference, + DISPID_SRCERequestUI, + DISPID_SRCERecognizerStateChange, + DISPID_SRCEAdaptation, + DISPID_SRCERecognitionForOtherContext, + DISPID_SRCEAudioLevel, + DISPID_SRCEEnginePrivate, +}} +ENUM!{enum SpeechRecognitionType { + SRTStandard = 0, + SRTAutopause = SPREF_AutoPause, + SRTEmulated = SPREF_Emulated, +}} +ENUM!{enum DISPID_SpeechGrammarRule { + DISPID_SGRAttributes = 1, + DISPID_SGRInitialState, + DISPID_SGRName, + DISPID_SGRId, + DISPID_SGRClear, + DISPID_SGRAddResource, + DISPID_SGRAddState, +}} +ENUM!{enum DISPID_SpeechGrammarRules { + DISPID_SGRsCount = 1, + DISPID_SGRsDynamic, + DISPID_SGRsAdd, + DISPID_SGRsCommit, + DISPID_SGRsCommitAndSave, + DISPID_SGRsFindRule, + DISPID_SGRsItem = DISPID_VALUE as u32, + DISPID_SGRs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechGrammarRuleState { + DISPID_SGRSRule = 1, + DISPID_SGRSTransitions, + DISPID_SGRSAddWordTransition, + DISPID_SGRSAddRuleTransition, + DISPID_SGRSAddSpecialTransition, +}} +ENUM!{enum SpeechSpecialTransitionType { + SSTTWildcard = 1, + SSTTDictation, + SSTTTextBuffer, +}} +ENUM!{enum DISPID_SpeechGrammarRuleStateTransitions { + DISPID_SGRSTsCount = 1, + DISPID_SGRSTsItem = DISPID_VALUE as u32, + DISPID_SGRSTs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechGrammarRuleStateTransition { + DISPID_SGRSTType = 1, + DISPID_SGRSTText, + DISPID_SGRSTRule, + DISPID_SGRSTWeight, + DISPID_SGRSTPropertyName, + DISPID_SGRSTPropertyId, + DISPID_SGRSTPropertyValue, + DISPID_SGRSTNextState, +}} +ENUM!{enum SpeechGrammarRuleStateTransitionType { + SGRSTTEpsilon = 0, + SGRSTTWord, + SGRSTTRule, + SGRSTTDictation, + SGRSTTWildcard, + SGRSTTTextBuffer, +}} +ENUM!{enum DISPIDSPTSI { + DISPIDSPTSI_ActiveOffset = 1, + DISPIDSPTSI_ActiveLength, + DISPIDSPTSI_SelectionOffset, + DISPIDSPTSI_SelectionLength, +}} +ENUM!{enum DISPID_SpeechRecoResult { + DISPID_SRRRecoContext = 1, + DISPID_SRRTimes, + DISPID_SRRAudioFormat, + DISPID_SRRPhraseInfo, + DISPID_SRRAlternates, + DISPID_SRRAudio, + DISPID_SRRSpeakAudio, + DISPID_SRRSaveToMemory, + DISPID_SRRDiscardResultInfo, +}} +ENUM!{enum SpeechDiscardType { + SDTProperty = SPDF_PROPERTY, + SDTReplacement = SPDF_REPLACEMENT, + SDTRule = SPDF_RULE, + SDTDisplayText = SPDF_DISPLAYTEXT, + SDTLexicalForm = SPDF_LEXICALFORM, + SDTPronunciation = SPDF_PRONUNCIATION, + SDTAudio = SPDF_AUDIO, + SDTAlternates = SPDF_ALTERNATES, + SDTAll = SPDF_ALL, +}} +ENUM!{enum DISPID_SpeechPhraseBuilder { + DISPID_SPPBRestorePhraseFromMemory = 1, +}} +ENUM!{enum DISPID_SpeechRecoResultTimes { + DISPID_SRRTStreamTime = 1, + DISPID_SRRTLength, + DISPID_SRRTTickCount, + DISPID_SRRTOffsetFromStart, +}} +ENUM!{enum DISPID_SpeechPhraseAlternate { + DISPID_SPARecoResult = 1, + DISPID_SPAStartElementInResult, + DISPID_SPANumberOfElementsInResult, + DISPID_SPAPhraseInfo, + DISPID_SPACommit, +}} +ENUM!{enum DISPID_SpeechPhraseAlternates { + DISPID_SPAsCount = 1, + DISPID_SPAsItem = DISPID_VALUE as u32, + DISPID_SPAs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseInfo { + DISPID_SPILanguageId = 1, + DISPID_SPIGrammarId, + DISPID_SPIStartTime, + DISPID_SPIAudioStreamPosition, + DISPID_SPIAudioSizeBytes, + DISPID_SPIRetainedSizeBytes, + DISPID_SPIAudioSizeTime, + DISPID_SPIRule, + DISPID_SPIProperties, + DISPID_SPIElements, + DISPID_SPIReplacements, + DISPID_SPIEngineId, + DISPID_SPIEnginePrivateData, + DISPID_SPISaveToMemory, + DISPID_SPIGetText, + DISPID_SPIGetDisplayAttributes, +}} +ENUM!{enum DISPID_SpeechPhraseElement { + DISPID_SPEAudioTimeOffset = 1, + DISPID_SPEAudioSizeTime, + DISPID_SPEAudioStreamOffset, + DISPID_SPEAudioSizeBytes, + DISPID_SPERetainedStreamOffset, + DISPID_SPERetainedSizeBytes, + DISPID_SPEDisplayText, + DISPID_SPELexicalForm, + DISPID_SPEPronunciation, + DISPID_SPEDisplayAttributes, + DISPID_SPERequiredConfidence, + DISPID_SPEActualConfidence, + DISPID_SPEEngineConfidence, +}} +ENUM!{enum SpeechEngineConfidence { + SECLowConfidence = -1i32 as u32, + SECNormalConfidence = 0, + SECHighConfidence = 1, +}} +ENUM!{enum DISPID_SpeechPhraseElements { + DISPID_SPEsCount = 1, + DISPID_SPEsItem = DISPID_VALUE as u32, + DISPID_SPEs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseReplacement { + DISPID_SPRDisplayAttributes = 1, + DISPID_SPRText, + DISPID_SPRFirstElement, + DISPID_SPRNumberOfElements, +}} +ENUM!{enum DISPID_SpeechPhraseReplacements { + DISPID_SPRsCount = 1, + DISPID_SPRsItem = DISPID_VALUE as u32, + DISPID_SPRs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseProperty { + DISPID_SPPName = 1, + DISPID_SPPId, + DISPID_SPPValue, + DISPID_SPPFirstElement, + DISPID_SPPNumberOfElements, + DISPID_SPPEngineConfidence, + DISPID_SPPConfidence, + DISPID_SPPParent, + DISPID_SPPChildren, +}} +ENUM!{enum DISPID_SpeechPhraseProperties { + DISPID_SPPsCount = 1, + DISPID_SPPsItem = DISPID_VALUE as u32, + DISPID_SPPs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechPhraseRule { + DISPID_SPRuleName = 1, + DISPID_SPRuleId, + DISPID_SPRuleFirstElement, + DISPID_SPRuleNumberOfElements, + DISPID_SPRuleParent, + DISPID_SPRuleChildren, + DISPID_SPRuleConfidence, + DISPID_SPRuleEngineConfidence, +}} +ENUM!{enum DISPID_SpeechPhraseRules { + DISPID_SPRulesCount = 1, + DISPID_SPRulesItem = DISPID_VALUE as u32, + DISPID_SPRules_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechLexicon { + DISPID_SLGenerationId = 1, + DISPID_SLGetWords, + DISPID_SLAddPronunciation, + DISPID_SLAddPronunciationByPhoneIds, + DISPID_SLRemovePronunciation, + DISPID_SLRemovePronunciationByPhoneIds, + DISPID_SLGetPronunciations, + DISPID_SLGetGenerationChange, +}} +ENUM!{enum SpeechLexiconType { + SLTUser = eLEXTYPE_USER, + SLTApp = eLEXTYPE_APP, +}} +ENUM!{enum SpeechPartOfSpeech { + SPSNotOverriden = SPPS_NotOverriden, + SPSUnknown = SPPS_Unknown, + SPSNoun = SPPS_Noun, + SPSVerb = SPPS_Verb, + SPSModifier = SPPS_Modifier, + SPSFunction = SPPS_Function, + SPSInterjection = SPPS_Interjection, +}} +ENUM!{enum DISPID_SpeechLexiconWords { + DISPID_SLWsCount = 1, + DISPID_SLWsItem = DISPID_VALUE as u32, + DISPID_SLWs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum SpeechWordType { + SWTAdded = eWORDTYPE_ADDED, + SWTDeleted = eWORDTYPE_DELETED, +}} +ENUM!{enum DISPID_SpeechLexiconWord { + DISPID_SLWLangId = 1, + DISPID_SLWType, + DISPID_SLWWord, + DISPID_SLWPronunciations, +}} +ENUM!{enum DISPID_SpeechLexiconProns { + DISPID_SLPsCount = 1, + DISPID_SLPsItem = DISPID_VALUE as u32, + DISPID_SLPs_NewEnum = DISPID_NEWENUM as u32, +}} +ENUM!{enum DISPID_SpeechLexiconPronunciation { + DISPID_SLPType = 1, + DISPID_SLPLangId, + DISPID_SLPPartOfSpeech, + DISPID_SLPPhoneIds, + DISPID_SLPSymbolic, +}} +ENUM!{enum DISPID_SpeechPhoneConverter { + DISPID_SPCLangId = 1, + DISPID_SPCPhoneToId, + DISPID_SPCIdToPhone, +}} +extern { + pub static LIBID_SpeechLib: IID; +} +RIDL!(#[uuid(0xce17c09b, 0x4efa, 0x44d5, 0xa4, 0xc9, 0x59, 0xd9, 0x58, 0x5a, 0xb0, 0xcd)] +interface ISpeechDataKey(ISpeechDataKeyVtbl): IDispatch(IDispatchVtbl) { + fn SetBinaryValue( + ValueName: BSTR, + Value: VARIANT, + ) -> HRESULT, + fn GetBinaryValue( + ValueName: BSTR, + Value: *mut VARIANT, + ) -> HRESULT, + fn SetStringValue( + ValueName: BSTR, + Value: BSTR, + ) -> HRESULT, + fn GetStringValue( + ValueName: BSTR, + Value: *mut BSTR, + ) -> HRESULT, + fn SetLongValue( + ValueName: BSTR, + Value: c_long, + ) -> HRESULT, + fn GetLongValue( + ValueName: BSTR, + Value: *mut c_long, + ) -> HRESULT, + fn OpenKey( + SubKeyName: BSTR, + SubKey: *mut *mut ISpeechDataKey, + ) -> HRESULT, + fn CreateKey( + SubKeyName: BSTR, + SubKey: *mut *mut ISpeechDataKey, + ) -> HRESULT, + fn DeleteKey( + SubKeyName: BSTR, + ) -> HRESULT, + fn DeleteValue( + ValueName: BSTR, + ) -> HRESULT, + fn EnumKeys( + Index: c_long, + SubKeyName: *mut BSTR, + ) -> HRESULT, + fn EnumValues( + Index: c_long, + ValueName: *mut BSTR, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xc74a3adc, 0xb727, 0x4500, 0xa8, 0x4a, 0xb5, 0x26, 0x72, 0x1c, 0x8b, 0x8c)] +interface ISpeechObjectToken(ISpeechObjectTokenVtbl): IDispatch(IDispatchVtbl) { + fn get_Id( + ObjectId: *mut BSTR, + ) -> HRESULT, + fn get_DataKey( + DataKey: *mut *mut ISpeechDataKey, + ) -> HRESULT, + fn get_Category( + Category: *mut *mut ISpeechObjectTokenCategory, + ) -> HRESULT, + fn GetDescription( + Locale: c_long, + Description: *mut BSTR, + ) -> HRESULT, + fn SetId( + Id: BSTR, + CategoryId: BSTR, + CreateIfNotExist: VARIANT_BOOL, + ) -> HRESULT, + fn GetAttribute( + AttributeName: BSTR, + AttributeValue: *mut BSTR, + ) -> HRESULT, + fn CreateInstance( + pUnkOuter: *mut IUnknown, + ClsContext: SpeechTokenContext, + Object: *mut *mut IUnknown, + ) -> HRESULT, + fn Remove( + ObjectStorageCLSID: BSTR, + ) -> HRESULT, + fn GetStorageFileName( + ObjectStorageCLSID: BSTR, + KeyName: BSTR, + FileName: BSTR, + Folder: BSTR, + FilePath: *mut BSTR, + ) -> HRESULT, + fn RemoveStorageFileName( + ObjectStorageCLSID: BSTR, + KeyName: BSTR, + DeleteFile: VARIANT_BOOL, + ) -> HRESULT, + fn IsUISupported( + TypeOfUI: BSTR, + ExtraData: *const VARIANT, + Object: *mut IUnknown, + Supported: *mut VARIANT_BOOL, + ) -> HRESULT, + fn DisplayUI( + hWnd: c_long, + Title: BSTR, + TypeOfUI: BSTR, + ExtraData: *const VARIANT, + Object: *mut IUnknown, + ) -> HRESULT, + fn MatchesAttributes( + Attributes: BSTR, + Matches: *mut VARIANT_BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x9285b776, 0x2e7b, 0x4bc0, 0xb5, 0x3e, 0x58, 0x0e, 0xb6, 0xfa, 0x96, 0x7f)] +interface ISpeechObjectTokens(ISpeechObjectTokensVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Token: *mut *mut ISpeechObjectToken, + ) -> HRESULT, + fn get__NewEnum( + ppEnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xca7eac50, 0x2d01, 0x4145, 0x86, 0xd4, 0x5a, 0xe7, 0xd7, 0x0f, 0x44, 0x69)] +interface ISpeechObjectTokenCategory(ISpeechObjectTokenCategoryVtbl): IDispatch(IDispatchVtbl) { + fn get_Id( + Id: *mut BSTR, + ) -> HRESULT, + fn put_Default( + TokenId: BSTR, + ) -> HRESULT, + fn get_Default( + TokenId: *mut BSTR, + ) -> HRESULT, + fn SetId( + Id: BSTR, + CreateIfNotExist: VARIANT_BOOL, + ) -> HRESULT, + fn GetDataKey( + Location: SpeechDataKeyLocation, + DataKey: *mut *mut ISpeechDataKey, + ) -> HRESULT, + fn EnumerateTokens( + RequiredAttributes: BSTR, + OptionalAttributes: BSTR, + Tokens: *mut *mut ISpeechObjectTokens, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x11b103d8, 0x1142, 0x4edf, 0xa0, 0x93, 0x82, 0xfb, 0x39, 0x15, 0xf8, 0xcc)] +interface ISpeechAudioBufferInfo(ISpeechAudioBufferInfoVtbl): IDispatch(IDispatchVtbl) { + fn get_MinNotification( + MinNotification: *mut c_long, + ) -> HRESULT, + fn put_MinNotification( + MinNotification: c_long, + ) -> HRESULT, + fn get_BufferSize( + BufferSize: *mut c_long, + ) -> HRESULT, + fn put_BufferSize( + BufferSize: c_long, + ) -> HRESULT, + fn get_EventBias( + EventBias: *mut c_long, + ) -> HRESULT, + fn put_EventBias( + EventBias: c_long, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xc62d9c91, 0x7458, 0x47f6, 0x86, 0x2d, 0x1e, 0xf8, 0x6f, 0xb0, 0xb2, 0x78)] +interface ISpeechAudioStatus(ISpeechAudioStatusVtbl): IDispatch(IDispatchVtbl) { + fn get_FreeBufferSpace( + FreeBufferSpace: *mut c_long, + ) -> HRESULT, + fn get_NonBlockingIO( + NonBlockingIO: *mut c_long, + ) -> HRESULT, + fn get_State( + State: *mut SpeechAudioState, + ) -> HRESULT, + fn get_CurrentSeekPosition( + CurrentSeekPosition: *mut VARIANT, + ) -> HRESULT, + fn get_CurrentDevicePosition( + CurrentDevicePosition: *mut VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xe6e9c590, 0x3e18, 0x40e3, 0x82, 0x99, 0x06, 0x1f, 0x98, 0xbd, 0xe7, 0xc7)] +interface ISpeechAudioFormat(ISpeechAudioFormatVtbl): IDispatch(IDispatchVtbl) { + fn get_Type( + AudioFormat: *mut SpeechAudioFormatType, + ) -> HRESULT, + fn put_Type( + AudioFormat: SpeechAudioFormatType, + ) -> HRESULT, + fn get_Guid( + Guid: *mut BSTR, + ) -> HRESULT, + fn put_Guid( + Guid: BSTR, + ) -> HRESULT, + fn GetWaveFormatEx( + SpeechWaveFormatEx: *mut *mut ISpeechWaveFormatEx, + ) -> HRESULT, + fn SetWaveFormatEx( + SpeechWaveFormatEx: *mut ISpeechWaveFormatEx, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x7a1ef0d5, 0x1581, 0x4741, 0x88, 0xe4, 0x20, 0x9a, 0x49, 0xf1, 0x1a, 0x10)] +interface ISpeechWaveFormatEx(ISpeechWaveFormatExVtbl): IDispatch(IDispatchVtbl) { + fn get_FormatTag( + FormatTag: *mut c_short, + ) -> HRESULT, + fn put_FormatTag( + FormatTag: c_short, + ) -> HRESULT, + fn get_Channels( + Channels: *mut c_short, + ) -> HRESULT, + fn put_Channels( + Channels: c_short, + ) -> HRESULT, + fn get_SamplesPerSec( + SamplesPerSec: *mut c_long, + ) -> HRESULT, + fn put_SamplesPerSec( + SamplesPerSec: c_long, + ) -> HRESULT, + fn get_AvgBytesPerSec( + AvgBytesPerSec: *mut c_long, + ) -> HRESULT, + fn put_AvgBytesPerSec( + AvgBytesPerSec: c_long, + ) -> HRESULT, + fn get_BlockAlign( + BlockAlign: *mut c_short, + ) -> HRESULT, + fn put_BlockAlign( + BlockAlign: c_short, + ) -> HRESULT, + fn get_BitsPerSample( + BitsPerSample: *mut c_short, + ) -> HRESULT, + fn put_BitsPerSample( + BitsPerSample: c_short, + ) -> HRESULT, + fn get_ExtraData( + ExtraData: *mut VARIANT, + ) -> HRESULT, + fn put_ExtraData( + ExtraData: VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x6450336f, 0x7d49, 0x4ced, 0x80, 0x97, 0x49, 0xd6, 0xde, 0xe3, 0x72, 0x94)] +interface ISpeechBaseStream(ISpeechBaseStreamVtbl): IDispatch(IDispatchVtbl) { + fn get_Format( + AudioFormat: *mut *mut ISpeechAudioFormat, + ) -> HRESULT, + fn putref_Format( + AudioFormat: *mut ISpeechAudioFormat, + ) -> HRESULT, + fn Read( + Buffer: *mut VARIANT, + NumberOfBytes: c_long, + BytesRead: *mut c_long, + ) -> HRESULT, + fn Write( + Buffer: VARIANT, + BytesWritten: *mut c_long, + ) -> HRESULT, + fn Seek( + Position: VARIANT, + Origin: SpeechStreamSeekPositionType, + NewPosition: *mut VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xaf67f125, 0xab39, 0x4e93, 0xb4, 0xa2, 0xcc, 0x2e, 0x66, 0xe1, 0x82, 0xa7)] +interface ISpeechFileStream(ISpeechFileStreamVtbl): ISpeechBaseStream(ISpeechBaseStreamVtbl) { + fn Open( + FileName: BSTR, + FileMode: SpeechStreamFileMode, + DoEvents: VARIANT_BOOL, + ) -> HRESULT, + fn Close() -> HRESULT, +}); +RIDL!(#[uuid(0xeeb14b68, 0x808b, 0x4abe, 0xa5, 0xea, 0xb5, 0x1d, 0xa7, 0x58, 0x80, 0x08)] +interface ISpeechMemoryStream(ISpeechMemoryStreamVtbl): ISpeechBaseStream(ISpeechBaseStreamVtbl) { + fn SetData( + Data: VARIANT, + ) -> HRESULT, + fn GetData( + pData: *mut VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x1a9e9f4f, 0x104f, 0x4db8, 0xa1, 0x15, 0xef, 0xd7, 0xfd, 0x0c, 0x97, 0xae)] +interface ISpeechCustomStream(ISpeechCustomStreamVtbl): ISpeechBaseStream(ISpeechBaseStreamVtbl) { + fn get_BaseStream( + ppUnkStream: *mut *mut IUnknown, + ) -> HRESULT, + fn putref_BaseStream( + pUnkStream: *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xcff8e175, 0x019e, 0x11d3, 0xa0, 0x8e, 0x00, 0xc0, 0x4f, 0x8e, 0xf9, 0xb5)] +interface ISpeechAudio(ISpeechAudioVtbl): ISpeechBaseStream(ISpeechBaseStreamVtbl) { + fn get_Status( + Status: *mut *mut ISpeechAudioStatus, + ) -> HRESULT, + fn get_BufferInfo( + BufferInfo: *mut *mut ISpeechAudioBufferInfo, + ) -> HRESULT, + fn get_DefaultFormat( + StreamFormat: *mut *mut ISpeechAudioFormat, + ) -> HRESULT, + fn get_Volume( + Volume: *mut c_long, + ) -> HRESULT, + fn put_Volume( + Volume: c_long, + ) -> HRESULT, + fn get_BufferNotifySize( + BufferNotifySize: *mut c_long, + ) -> HRESULT, + fn put_BufferNotifySize( + BufferNotifySize: c_long, + ) -> HRESULT, + fn get_EventHandle( + EventHandle: *mut c_long, + ) -> HRESULT, + fn SetState( + State: SpeechAudioState, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3c76af6d, 0x1fd7, 0x4831, 0x81, 0xd1, 0x3b, 0x71, 0xd5, 0xa1, 0x3c, 0x44)] +interface ISpeechMMSysAudio(ISpeechMMSysAudioVtbl): ISpeechAudio(ISpeechAudioVtbl) { + fn get_DeviceId( + DeviceId: *mut c_long, + ) -> HRESULT, + fn put_DeviceId( + DeviceId: c_long, + ) -> HRESULT, + fn get_LineId( + LineId: *mut c_long, + ) -> HRESULT, + fn put_LineId( + LineId: c_long, + ) -> HRESULT, + fn get_MMHandle( + Handle: *mut c_long, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x269316d8, 0x57bd, 0x11d2, 0x9e, 0xee, 0x00, 0xc0, 0x4f, 0x79, 0x73, 0x96)] +interface ISpeechVoice(ISpeechVoiceVtbl): IDispatch(IDispatchVtbl) { + fn get_Status( + Status: *mut *mut ISpeechVoiceStatus, + ) -> HRESULT, + fn get_Voice( + Voice: *mut *mut ISpeechObjectToken, + ) -> HRESULT, + fn putref_Voice( + Voice: *mut ISpeechObjectToken, + ) -> HRESULT, + fn get_AudioOutput( + AudioOutput: *mut *mut ISpeechObjectToken, + ) -> HRESULT, + fn putref_AudioOutput( + AudioOutput: *mut ISpeechObjectToken, + ) -> HRESULT, + fn get_AudioOutputStream( + AudioOutputStream: *mut *mut ISpeechBaseStream, + ) -> HRESULT, + fn putref_AudioOutputStream( + AudioOutputStream: *mut ISpeechBaseStream, + ) -> HRESULT, + fn get_Rate( + Rate: *mut c_long, + ) -> HRESULT, + fn put_Rate( + Rate: c_long, + ) -> HRESULT, + fn get_Volume( + Volume: *mut c_long, + ) -> HRESULT, + fn put_Volume( + Volume: c_long, + ) -> HRESULT, + fn put_AllowAudioOutputFormatChangesOnNextSet( + Allow: VARIANT_BOOL, + ) -> HRESULT, + fn get_AllowAudioOutputFormatChangesOnNextSet( + Allow: *mut VARIANT_BOOL, + ) -> HRESULT, + fn get_EventInterests( + EventInterestFlags: *mut SpeechVoiceEvents, + ) -> HRESULT, + fn put_EventInterests( + EventInterestFlags: SpeechVoiceEvents, + ) -> HRESULT, + fn put_Priority( + Priority: SpeechVoicePriority, + ) -> HRESULT, + fn get_Priority( + Priority: *mut SpeechVoicePriority, + ) -> HRESULT, + fn put_AlertBoundary( + Boundary: SpeechVoiceEvents, + ) -> HRESULT, + fn get_AlertBoundary( + Boundary: *mut SpeechVoiceEvents, + ) -> HRESULT, + fn put_SynchronousSpeakTimeout( + msTimeout: c_long, + ) -> HRESULT, + fn get_SynchronousSpeakTimeout( + msTimeOut: *mut c_long, + ) -> HRESULT, + fn Speak( + Text: BSTR, + Flags: SpeechVoiceSpeakFlags, + StreamNumber: *mut c_long, + ) -> HRESULT, + fn SpeakStream( + Stream: *mut ISpeechBaseStream, + Flags: SpeechVoiceSpeakFlags, + StreamNumber: *mut c_long, + ) -> HRESULT, + fn Pause() -> HRESULT, + fn Resume() -> HRESULT, + fn Skip( + Type: BSTR, + NumItems: c_long, + NumSkipped: c_long, + ) -> HRESULT, + fn GetVoices( + RequiredAttributes: BSTR, + OptionalAttributes: BSTR, + ObjectTokens: *mut *mut ISpeechObjectTokens, + ) -> HRESULT, + fn GetAudioOutputs( + RequiredAttributes: BSTR, + OptionalAttributes: BSTR, + ObjectTokens: *mut *mut ISpeechObjectTokens, + ) -> HRESULT, + fn WaitUntilDone( + msTimeout: c_long, + Done: *mut VARIANT_BOOL, + ) -> HRESULT, + fn SpeakCompleteEvent( + Handle: *mut c_long, + ) -> HRESULT, + fn IsUISupported( + TypeOfUI: BSTR, + ExtraData: *const VARIANT, + Supported: *mut VARIANT_BOOL, + ) -> HRESULT, + fn DisplayUI( + hWndParent: c_long, + Title: BSTR, + TypeOfUI: BSTR, + ExtraData: *const VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8be47b07, 0x57f6, 0x11d2, 0x9e, 0xee, 0x00, 0xc0, 0x4f, 0x79, 0x73, 0x96)] +interface ISpeechVoiceStatus(ISpeechVoiceStatusVtbl): IDispatch(IDispatchVtbl) { + fn get_CurrentStreamNumber( + StreamNumber: *mut c_long, + ) -> HRESULT, + fn get_LastStreamNumberQueued( + StreamNumber: *mut c_long, + ) -> HRESULT, + fn get_LastHResult( + HResult: *mut c_long, + ) -> HRESULT, + fn get_RunningState( + State: *mut SpeechRunState, + ) -> HRESULT, + fn get_InputWordPosition( + Position: *mut c_long, + ) -> HRESULT, + fn get_InputWordLength( + Length: *mut c_long, + ) -> HRESULT, + fn get_InputSentencePosition( + Position: *mut c_long, + ) -> HRESULT, + fn get_InputSentenceLength( + Length: *mut c_long, + ) -> HRESULT, + fn get_LastBookmark( + Bookmark: *mut BSTR, + ) -> HRESULT, + fn get_LastBookmarkId( + BookmarkId: *mut c_long, + ) -> HRESULT, + fn get_PhonemeId( + PhoneId: *mut c_short, + ) -> HRESULT, + fn get_VisemeId( + VisemeId: *mut c_short, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa372acd1, 0x3bef, 0x4bbd, 0x8f, 0xfb, 0xcb, 0x3e, 0x2b, 0x41, 0x6a, 0xf8)] +interface _ISpeechVoiceEvents(_ISpeechVoiceEventsVtbl): IDispatch(IDispatchVtbl) { +}); +RIDL!(#[uuid(0x2d5f1c0c, 0xbd75, 0x4b08, 0x94, 0x78, 0x3b, 0x11, 0xfe, 0xa2, 0x58, 0x6c)] +interface ISpeechRecognizer(ISpeechRecognizerVtbl): IDispatch(IDispatchVtbl) { + fn putref_Recognizer( + Recognizer: *mut ISpeechObjectToken, + ) -> HRESULT, + fn get_Recognizer( + Recognizer: *mut *mut ISpeechObjectToken, + ) -> HRESULT, + fn put_AllowAudioInputFormatChangesOnNextSet( + Allow: VARIANT_BOOL, + ) -> HRESULT, + fn get_AllowAudioInputFormatChangesOnNextSet( + Allow: *mut VARIANT_BOOL, + ) -> HRESULT, + fn putref_AudioInput( + AudioInput: *mut ISpeechObjectToken, + ) -> HRESULT, + fn get_AudioInput( + AudioInput: *mut *mut ISpeechObjectToken, + ) -> HRESULT, + fn putref_AudioInputStream( + AudioInputStream: *mut ISpeechBaseStream, + ) -> HRESULT, + fn get_AudioInputStream( + AudioInputStream: *mut *mut ISpeechBaseStream, + ) -> HRESULT, + fn get_IsShared( + Shared: *mut VARIANT_BOOL, + ) -> HRESULT, + fn put_State( + State: SpeechRecognizerState, + ) -> HRESULT, + fn get_State( + State: *mut SpeechRecognizerState, + ) -> HRESULT, + fn get_Status( + Status: *mut *mut ISpeechRecognizerStatus, + ) -> HRESULT, + fn putref_Profile( + Profile: *mut ISpeechObjectToken, + ) -> HRESULT, + fn get_Profile( + Profile: *mut *mut ISpeechObjectToken, + ) -> HRESULT, + fn EmulateRecognition( + TextElements: VARIANT, + ElementDisplayAttributes: *mut VARIANT, + LanguageId: c_long, + ) -> HRESULT, + fn CreateRecoContext( + NewContext: *mut *mut ISpeechRecoContext, + ) -> HRESULT, + fn GetFormat( + Type: SpeechFormatType, + Format: *mut *mut ISpeechAudioFormat, + ) -> HRESULT, + fn SetPropertyNumber( + Name: BSTR, + Value: c_long, + Supported: *mut VARIANT_BOOL, + ) -> HRESULT, + fn GetPropertyNumber( + Name: BSTR, + Value: *mut c_long, + Supported: *mut VARIANT_BOOL, + ) -> HRESULT, + fn SetPropertyString( + Name: BSTR, + Value: BSTR, + Supported: *mut VARIANT_BOOL, + ) -> HRESULT, + fn GetPropertyString( + Name: BSTR, + Value: *mut BSTR, + Supported: *mut VARIANT_BOOL, + ) -> HRESULT, + fn IsUISupported( + TypeOfUI: BSTR, + ExtraData: *const VARIANT, + Supported: *mut VARIANT_BOOL, + ) -> HRESULT, + fn DisplayUI( + hWndParent: c_long, + Title: BSTR, + TypeOfUI: BSTR, + ExtraData: *const VARIANT, + ) -> HRESULT, + fn GetRecognizers( + RequiredAttributes: BSTR, + OptionalAttributes: BSTR, + ObjectTokens: *mut *mut ISpeechObjectTokens, + ) -> HRESULT, + fn GetAudioInputs( + RequiredAttributes: BSTR, + OptionalAttributes: BSTR, + ObjectTokens: *mut *mut ISpeechObjectTokens, + ) -> HRESULT, + fn GetProfiles( + RequiredAttributes: BSTR, + OptionalAttributes: BSTR, + ObjectTokens: *mut *mut ISpeechObjectTokens, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xbff9e781, 0x53ec, 0x484e, 0xbb, 0x8a, 0x0e, 0x1b, 0x55, 0x51, 0xe3, 0x5c)] +interface ISpeechRecognizerStatus(ISpeechRecognizerStatusVtbl): IDispatch(IDispatchVtbl) { + fn get_AudioStatus( + AudioStatus: *mut *mut ISpeechAudioStatus, + ) -> HRESULT, + fn get_CurrentStreamPosition( + pCurrentStreamPos: *mut VARIANT, + ) -> HRESULT, + fn get_CurrentStreamNumber( + StreamNumber: *mut c_long, + ) -> HRESULT, + fn get_NumberOfActiveRules( + NumberOfActiveRules: *mut c_long, + ) -> HRESULT, + fn get_ClsidEngine( + ClsidEngine: *mut BSTR, + ) -> HRESULT, + fn get_SupportedLanguages( + SupportedLanguages: *mut VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x580aa49d, 0x7e1e, 0x4809, 0xb8, 0xe2, 0x57, 0xda, 0x80, 0x61, 0x04, 0xb8)] +interface ISpeechRecoContext(ISpeechRecoContextVtbl): IDispatch(IDispatchVtbl) { + fn get_Recognizer( + Recognizer: *mut *mut ISpeechRecognizer, + ) -> HRESULT, + fn get_AudioInputInterferenceStatus( + Interference: *mut SpeechInterference, + ) -> HRESULT, + fn get_RequestedUIType( + UIType: *mut BSTR, + ) -> HRESULT, + fn putref_Voice( + Voice: *mut ISpeechVoice, + ) -> HRESULT, + fn get_Voice( + Voice: *mut *mut ISpeechVoice, + ) -> HRESULT, + fn put_AllowVoiceFormatMatchingOnNextSet( + Allow: VARIANT_BOOL, + ) -> HRESULT, + fn get_AllowVoiceFormatMatchingOnNextSet( + Allow: *mut VARIANT_BOOL, + ) -> HRESULT, + fn put_VoicePurgeEvent( + EventInterest: SpeechRecoEvents, + ) -> HRESULT, + fn get_VoicePurgeEvent( + EventInterest: *mut SpeechRecoEvents, + ) -> HRESULT, + fn put_EventInterests( + EventInterest: SpeechRecoEvents, + ) -> HRESULT, + fn get_EventInterests( + EventInterest: *mut SpeechRecoEvents, + ) -> HRESULT, + fn put_CmdMaxAlternates( + MaxAlternates: c_long, + ) -> HRESULT, + fn get_CmdMaxAlternates( + MaxAlternates: *mut c_long, + ) -> HRESULT, + fn put_State( + State: SpeechRecoContextState, + ) -> HRESULT, + fn get_State( + State: *mut SpeechRecoContextState, + ) -> HRESULT, + fn put_RetainedAudio( + Option: SpeechRetainedAudioOptions, + ) -> HRESULT, + fn get_RetainedAudio( + Option: *mut SpeechRetainedAudioOptions, + ) -> HRESULT, + fn putref_RetainedAudioFormat( + Format: *mut ISpeechAudioFormat, + ) -> HRESULT, + fn get_RetainedAudioFormat( + Format: *mut *mut ISpeechAudioFormat, + ) -> HRESULT, + fn Pause() -> HRESULT, + fn Resume() -> HRESULT, + fn CreateGrammar( + GrammarId: VARIANT, + Grammar: *mut *mut ISpeechRecoGrammar, + ) -> HRESULT, + fn CreateResultFromMemory( + ResultBlock: *mut VARIANT, + Result: *mut *mut ISpeechRecoResult, + ) -> HRESULT, + fn Bookmark( + Options: SpeechBookmarkOptions, + StreamPos: VARIANT, + BookmarkId: VARIANT, + ) -> HRESULT, + fn SetAdaptationData( + AdaptationString: BSTR, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xb6d6f79f, 0x2158, 0x4e50, 0xb5, 0xbc, 0x9a, 0x9c, 0xcd, 0x85, 0x2a, 0x09)] +interface ISpeechRecoGrammar(ISpeechRecoGrammarVtbl): IDispatch(IDispatchVtbl) { + fn get_Id( + Id: *mut VARIANT, + ) -> HRESULT, + fn get_RecoContext( + RecoContext: *mut *mut ISpeechRecoContext, + ) -> HRESULT, + fn put_State( + State: SpeechGrammarState, + ) -> HRESULT, + fn get_State( + State: *mut SpeechGrammarState, + ) -> HRESULT, + fn get_Rules( + Rules: *mut *mut ISpeechGrammarRules, + ) -> HRESULT, + fn Reset( + NewLanguage: SpeechLanguageId, + ) -> HRESULT, + fn CmdLoadFromFile( + FileName: BSTR, + LoadOption: SpeechLoadOption, + ) -> HRESULT, + fn CmdLoadFromObject( + ClassId: BSTR, + GrammarName: BSTR, + LoadOption: SpeechLoadOption, + ) -> HRESULT, + fn CmdLoadFromResource( + hModule: c_long, + ResourceName: VARIANT, + ResourceType: VARIANT, + LanguageId: SpeechLanguageId, + LoadOption: SpeechLoadOption, + ) -> HRESULT, + fn CmdLoadFromMemory( + GrammarData: VARIANT, + LoadOption: SpeechLoadOption, + ) -> HRESULT, + fn CmdLoadFromProprietaryGrammar( + ProprietaryGuid: BSTR, + PriorietaryString: BSTR, + ProprietaryData: VARIANT, + LoadOption: SpeechLoadOption, + ) -> HRESULT, + fn CmdSetRuleState( + Name: BSTR, + State: SpeechRuleState, + ) -> HRESULT, + fn CmdSetRuleIdState( + RuleId: c_long, + State: SpeechRuleState, + ) -> HRESULT, + fn DictationLoad( + TopicName: BSTR, + LoadOption: SpeechLoadOption, + ) -> HRESULT, + fn DictationUnload() -> HRESULT, + fn DictationSetState( + State: SpeechRuleState, + ) -> HRESULT, + fn SetWordSequenceData( + Text: BSTR, + TextLength: c_long, + Info: *mut ISpeechTextSelectionInformation, + ) -> HRESULT, + fn SetTextSelection( + Info: *mut ISpeechTextSelectionInformation, + ) -> HRESULT, + fn IsPronounceable( + Word: BSTR, + WordPronounceable: *mut SpeechWordPronounceable, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x7b8fcb42, 0x0e9d, 0x4f00, 0xa0, 0x48, 0x7b, 0x04, 0xd6, 0x17, 0x9d, 0x3d)] +interface _ISpeechRecoContextEvents(_ISpeechRecoContextEventsVtbl): IDispatch(IDispatchVtbl) { +}); +RIDL!(#[uuid(0xafe719cf, 0x5dd1, 0x44f2, 0x99, 0x9c, 0x7a, 0x39, 0x9f, 0x1c, 0xfc, 0xcc)] +interface ISpeechGrammarRule(ISpeechGrammarRuleVtbl): IDispatch(IDispatchVtbl) { + fn get_Attributes( + Attributes: *mut SpeechRuleAttributes, + ) -> HRESULT, + fn get_InitialState( + State: *mut *mut ISpeechGrammarRuleState, + ) -> HRESULT, + fn get_Name( + Name: *mut BSTR, + ) -> HRESULT, + fn get_Id( + Id: *mut c_long, + ) -> HRESULT, + fn Clear() -> HRESULT, + fn AddResource( + ResourceName: BSTR, + ResourceValue: BSTR, + ) -> HRESULT, + fn AddState( + State: *mut *mut ISpeechGrammarRuleState, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x6ffa3b44, 0xfc2d, 0x40d1, 0x8a, 0xfc, 0x32, 0x91, 0x1c, 0x7f, 0x1a, 0xd1)] +interface ISpeechGrammarRules(ISpeechGrammarRulesVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn FindRule( + RuleNameOrId: VARIANT, + Rule: *mut *mut ISpeechGrammarRule, + ) -> HRESULT, + fn Item( + Index: c_long, + Rule: *mut *mut ISpeechGrammarRule, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, + fn get_Dynamic( + Dynamic: *mut VARIANT_BOOL, + ) -> HRESULT, + fn Add( + RuleName: BSTR, + Attributes: SpeechRuleAttributes, + RuleId: c_long, + Rule: *mut *mut ISpeechGrammarRule, + ) -> HRESULT, + fn Commit() -> HRESULT, + fn CommitAndSave( + ErrorText: *mut BSTR, + SaveStream: *mut VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xd4286f2c, 0xee67, 0x45ae, 0xb9, 0x28, 0x28, 0xd6, 0x95, 0x36, 0x2e, 0xda)] +interface ISpeechGrammarRuleState(ISpeechGrammarRuleStateVtbl): IDispatch(IDispatchVtbl) { + fn get_Rule( + Rule: *mut *mut ISpeechGrammarRule, + ) -> HRESULT, + fn get_Transitions( + Transitions: *mut *mut ISpeechGrammarRuleStateTransitions, + ) -> HRESULT, + fn AddWordTransition( + DestState: *mut ISpeechGrammarRuleState, + Words: BSTR, + Separators: BSTR, + Type: SpeechGrammarWordType, + PropertyName: BSTR, + PropertyId: c_long, + PropertyValue: *mut VARIANT, + Weight: c_float, + ) -> HRESULT, + fn AddRuleTransition( + DestinationState: *mut ISpeechGrammarRuleState, + Rule: *mut ISpeechGrammarRule, + PropertyName: BSTR, + PropertyId: c_long, + PropertyValue: *mut VARIANT, + Weight: c_float, + ) -> HRESULT, + fn AddSpecialTransition( + DestinationState: *mut ISpeechGrammarRuleState, + Type: SpeechSpecialTransitionType, + PropertyName: BSTR, + PropertyId: c_long, + PropertyValue: *mut VARIANT, + Weight: c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xcafd1db1, 0x41d1, 0x4a06, 0x98, 0x63, 0xe2, 0xe8, 0x1d, 0xa1, 0x7a, 0x9a)] +interface ISpeechGrammarRuleStateTransition(ISpeechGrammarRuleStateTransitionVtbl): + IDispatch(IDispatchVtbl) { + fn get_Type( + Type: *mut SpeechGrammarRuleStateTransitionType, + ) -> HRESULT, + fn get_Text( + Text: *mut BSTR, + ) -> HRESULT, + fn get_Rule( + Rule: *mut *mut ISpeechGrammarRule, + ) -> HRESULT, + fn get_Weight( + Weight: *mut VARIANT, + ) -> HRESULT, + fn get_PropertyName( + PropertyName: *mut BSTR, + ) -> HRESULT, + fn get_PropertyId( + PropertyId: *mut c_long, + ) -> HRESULT, + fn get_PropertyValue( + PropertyValue: *mut VARIANT, + ) -> HRESULT, + fn get_NextState( + NextState: *mut *mut ISpeechGrammarRuleState, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xeabce657, 0x75bc, 0x44a2, 0xaa, 0x7f, 0xc5, 0x64, 0x76, 0x74, 0x29, 0x63)] +interface ISpeechGrammarRuleStateTransitions(ISpeechGrammarRuleStateTransitionsVtbl): + IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Transition: *mut *mut ISpeechGrammarRuleStateTransition, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3b9c7e7a, 0x6eee, 0x4ded, 0x90, 0x92, 0x11, 0x65, 0x72, 0x79, 0xad, 0xbe)] +interface ISpeechTextSelectionInformation(ISpeechTextSelectionInformationVtbl): + IDispatch(IDispatchVtbl) { + fn put_ActiveOffset( + ActiveOffset: c_long, + ) -> HRESULT, + fn get_ActiveOffset( + ActiveOffset: *mut c_long, + ) -> HRESULT, + fn put_ActiveLength( + ActiveLength: c_long, + ) -> HRESULT, + fn get_ActiveLength( + ActiveLength: *mut c_long, + ) -> HRESULT, + fn put_SelectionOffset( + SelectionOffset: c_long, + ) -> HRESULT, + fn get_SelectionOffset( + SelectionOffset: *mut c_long, + ) -> HRESULT, + fn put_SelectionLength( + SelectionLength: c_long, + ) -> HRESULT, + fn get_SelectionLength( + SelectionLength: *mut c_long, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xed2879cf, 0xced9, 0x4ee6, 0xa5, 0x34, 0xde, 0x01, 0x91, 0xd5, 0x46, 0x8d)] +interface ISpeechRecoResult(ISpeechRecoResultVtbl): IDispatch(IDispatchVtbl) { + fn get_RecoContext( + RecoContext: *mut *mut ISpeechRecoContext, + ) -> HRESULT, + fn get_Times( + Times: *mut *mut ISpeechRecoResultTimes, + ) -> HRESULT, + fn putref_AudioFormat( + Format: *mut ISpeechAudioFormat, + ) -> HRESULT, + fn get_AudioFormat( + Format: *mut *mut ISpeechAudioFormat, + ) -> HRESULT, + fn get_PhraseInfo( + PhraseInfo: *mut *mut ISpeechPhraseInfo, + ) -> HRESULT, + fn Alternates( + RequestCount: c_long, + StartElement: c_long, + Elements: c_long, + Alternates: *mut *mut ISpeechPhraseAlternates, + ) -> HRESULT, + fn Audio( + StartElement: c_long, + Elements: c_long, + Stream: *mut *mut ISpeechMemoryStream, + ) -> HRESULT, + fn SpeakAudio( + StartElement: c_long, + Elements: c_long, + Flags: SpeechVoiceSpeakFlags, + StreamNumber: *mut c_long, + ) -> HRESULT, + fn SaveToMemory( + ResultBlock: *mut VARIANT, + ) -> HRESULT, + fn DiscardResultInfo( + ValueTypes: SpeechDiscardType, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x62b3b8fb, 0xf6e7, 0x41be, 0xbd, 0xcb, 0x05, 0x6b, 0x1c, 0x29, 0xef, 0xc0)] +interface ISpeechRecoResultTimes(ISpeechRecoResultTimesVtbl): IDispatch(IDispatchVtbl) { + fn get_StreamTime( + Time: *mut VARIANT, + ) -> HRESULT, + fn get_Length( + Length: *mut VARIANT, + ) -> HRESULT, + fn get_TickCount( + TickCount: *mut c_long, + ) -> HRESULT, + fn get_OffsetFromStart( + OffsetFromStart: *mut VARIANT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x27864a2a, 0x2b9f, 0x4cb8, 0x92, 0xd3, 0x0d, 0x27, 0x22, 0xfd, 0x1e, 0x73)] +interface ISpeechPhraseAlternate(ISpeechPhraseAlternateVtbl): IDispatch(IDispatchVtbl) { + fn get_RecoResult( + RecoResult: *mut *mut ISpeechRecoResult, + ) -> HRESULT, + fn get_StartElementInResult( + StartElement: *mut c_long, + ) -> HRESULT, + fn get_NumberOfElementsInResult( + NumberOfElements: *mut c_long, + ) -> HRESULT, + fn get_PhraseInfo( + PhraseInfo: *mut *mut ISpeechPhraseInfo, + ) -> HRESULT, + fn Commit() -> HRESULT, +}); +RIDL!(#[uuid(0xb238b6d5, 0xf276, 0x4c3d, 0xa6, 0xc1, 0x29, 0x74, 0x80, 0x1c, 0x3c, 0xc2)] +interface ISpeechPhraseAlternates(ISpeechPhraseAlternatesVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + PhraseAlternate: *mut *mut ISpeechPhraseAlternate, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x961559cf, 0x4e67, 0x4662, 0x8b, 0xf0, 0xd9, 0x3f, 0x1f, 0xcd, 0x61, 0xb3)] +interface ISpeechPhraseInfo(ISpeechPhraseInfoVtbl): IDispatch(IDispatchVtbl) { + fn get_LanguageId( + LanguageId: *mut c_long, + ) -> HRESULT, + fn get_GrammarId( + GrammarId: *mut VARIANT, + ) -> HRESULT, + fn get_StartTime( + StartTime: *mut VARIANT, + ) -> HRESULT, + fn get_AudioStreamPosition( + AudioStreamPosition: *mut VARIANT, + ) -> HRESULT, + fn get_AudioSizeBytes( + pAudioSizeBytes: *mut c_long, + ) -> HRESULT, + fn get_RetainedSizeBytes( + RetainedSizeBytes: *mut c_long, + ) -> HRESULT, + fn get_AudioSizeTime( + AudioSizeTime: *mut c_long, + ) -> HRESULT, + fn get_Rule( + Rule: *mut *mut ISpeechPhraseRule, + ) -> HRESULT, + fn get_Properties( + Properties: *mut *mut ISpeechPhraseProperties, + ) -> HRESULT, + fn get_Elements( + Elements: *mut *mut ISpeechPhraseElements, + ) -> HRESULT, + fn get_Replacements( + Replacements: *mut *mut ISpeechPhraseReplacements, + ) -> HRESULT, + fn get_EngineId( + EngineIdGuid: *mut BSTR, + ) -> HRESULT, + fn get_EnginePrivateData( + PrivateData: *mut VARIANT, + ) -> HRESULT, + fn SaveToMemory( + PhraseBlock: *mut VARIANT, + ) -> HRESULT, + fn GetText( + StartElement: c_long, + Elements: c_long, + UseReplacements: VARIANT_BOOL, + Text: *mut BSTR, + ) -> HRESULT, + fn GetDisplayAttributes( + StartElement: c_long, + Elements: c_long, + UseReplacements: VARIANT_BOOL, + DisplayAttributes: *mut SpeechDisplayAttributes, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xe6176f96, 0xe373, 0x4801, 0xb2, 0x23, 0x3b, 0x62, 0xc0, 0x68, 0xc0, 0xb4)] +interface ISpeechPhraseElement(ISpeechPhraseElementVtbl): IDispatch(IDispatchVtbl) { + fn get_AudioTimeOffset( + AudioTimeOffset: *mut c_long, + ) -> HRESULT, + fn get_AudioSizeTime( + AudioSizeTime: *mut c_long, + ) -> HRESULT, + fn get_AudioStreamOffset( + AudioStreamOffset: *mut c_long, + ) -> HRESULT, + fn get_AudioSizeBytes( + AudioSizeBytes: *mut c_long, + ) -> HRESULT, + fn get_RetainedStreamOffset( + RetainedStreamOffset: *mut c_long, + ) -> HRESULT, + fn get_RetainedSizeBytes( + RetainedSizeBytes: *mut c_long, + ) -> HRESULT, + fn get_DisplayText( + DisplayText: *mut BSTR, + ) -> HRESULT, + fn get_LexicalForm( + LexicalForm: *mut BSTR, + ) -> HRESULT, + fn get_Pronunciation( + Pronunciation: *mut VARIANT, + ) -> HRESULT, + fn get_DisplayAttributes( + DisplayAttributes: *mut SpeechDisplayAttributes, + ) -> HRESULT, + fn get_RequiredConfidence( + RequiredConfidence: *mut SpeechEngineConfidence, + ) -> HRESULT, + fn get_ActualConfidence( + ActualConfidence: *mut SpeechEngineConfidence, + ) -> HRESULT, + fn get_EngineConfidence( + EngineConfident: *mut c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x0626b328, 0x3478, 0x467d, 0xa0, 0xb3, 0xd0, 0x85, 0x3b, 0x93, 0xdd, 0xa3)] +interface ISpeechPhraseElements(ISpeechPhraseElementsVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Element: *mut *mut ISpeechPhraseElement, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x2890a410, 0x53a7, 0x4fb5, 0x94, 0xec, 0x06, 0xd4, 0x99, 0x8e, 0x3d, 0x02)] +interface ISpeechPhraseReplacement(ISpeechPhraseReplacementVtbl): IDispatch(IDispatchVtbl) { + fn get_DisplayAttributes( + DisplayAttributes: *mut SpeechDisplayAttributes, + ) -> HRESULT, + fn get_Text( + Text: *mut BSTR, + ) -> HRESULT, + fn get_FirstElement( + FirstElement: *mut c_long, + ) -> HRESULT, + fn get_NumberOfElements( + NumberOfElements: *mut c_long, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x38bc662f, 0x2257, 0x4525, 0x95, 0x9e, 0x20, 0x69, 0xd2, 0x59, 0x6c, 0x05)] +interface ISpeechPhraseReplacements(ISpeechPhraseReplacementsVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Reps: *mut *mut ISpeechPhraseReplacement, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xce563d48, 0x961e, 0x4732, 0xa2, 0xe1, 0x37, 0x8a, 0x42, 0xb4, 0x30, 0xbe)] +interface ISpeechPhraseProperty(ISpeechPhrasePropertyVtbl): IDispatch(IDispatchVtbl) { + fn get_Name( + Name: *mut BSTR, + ) -> HRESULT, + fn get_Id( + Id: *mut c_long, + ) -> HRESULT, + fn get_Value( + Value: *mut VARIANT, + ) -> HRESULT, + fn get_FirstElement( + FirstElement: *mut c_long, + ) -> HRESULT, + fn get_NumberOfElements( + NumberOfElements: *mut c_long, + ) -> HRESULT, + fn get_EngineConfidence( + Confidence: *mut c_float, + ) -> HRESULT, + fn get_Confidence( + Confidence: *mut SpeechEngineConfidence, + ) -> HRESULT, + fn get_Parent( + ParentProperty: *mut *mut ISpeechPhraseProperty, + ) -> HRESULT, + fn get_Children( + Children: *mut *mut ISpeechPhraseProperties, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x08166b47, 0x102e, 0x4b23, 0xa5, 0x99, 0xbd, 0xb9, 0x8d, 0xbf, 0xd1, 0xf4)] +interface ISpeechPhraseProperties(ISpeechPhrasePropertiesVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Property: *mut *mut ISpeechPhraseProperty, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa7bfe112, 0xa4a0, 0x48d9, 0xb6, 0x02, 0xc3, 0x13, 0x84, 0x3f, 0x69, 0x64)] +interface ISpeechPhraseRule(ISpeechPhraseRuleVtbl): IDispatch(IDispatchVtbl) { + fn get_Name( + Name: *mut BSTR, + ) -> HRESULT, + fn get_Id( + Id: *mut c_long, + ) -> HRESULT, + fn get_FirstElement( + FirstElement: *mut c_long, + ) -> HRESULT, + fn get_NumberOfElements( + NumberOfElements: *mut c_long, + ) -> HRESULT, + fn get_Parent( + Parent: *mut *mut ISpeechPhraseRule, + ) -> HRESULT, + fn get_Children( + Children: *mut *mut ISpeechPhraseRules, + ) -> HRESULT, + fn get_Confidence( + ActualConfidence: *mut SpeechEngineConfidence, + ) -> HRESULT, + fn get_EngineConfidence( + Confidence: *mut c_float, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x9047d593, 0x01dd, 0x4b72, 0x81, 0xa3, 0xe4, 0xa0, 0xca, 0x69, 0xf4, 0x07)] +interface ISpeechPhraseRules(ISpeechPhraseRulesVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Rule: *mut *mut ISpeechPhraseRule, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3da7627a, 0xc7ae, 0x4b23, 0x87, 0x08, 0x63, 0x8c, 0x50, 0x36, 0x2c, 0x25)] +interface ISpeechLexicon(ISpeechLexiconVtbl): IDispatch(IDispatchVtbl) { + fn get_GenerationId( + GenerationId: *mut c_long, + ) -> HRESULT, + fn GetWords( + Flags: SpeechLexiconType, + GenerationID: *mut c_long, + Words: *mut *mut ISpeechLexiconWords, + ) -> HRESULT, + fn AddPronunciation( + bstrWord: BSTR, + LangId: SpeechLanguageId, + PartOfSpeech: SpeechPartOfSpeech, + bstrPronunciation: BSTR, + ) -> HRESULT, + fn AddPronunciationByPhoneIds( + bstrWord: BSTR, + LangId: SpeechLanguageId, + PartOfSpeech: SpeechPartOfSpeech, + PhoneIds: *mut VARIANT, + ) -> HRESULT, + fn RemovePronunciation( + bstrWord: BSTR, + LangId: SpeechLanguageId, + PartOfSpeech: SpeechPartOfSpeech, + bstrPronunciation: BSTR, + ) -> HRESULT, + fn RemovePronunciationByPhoneIds( + bstrWord: BSTR, + LangId: SpeechLanguageId, + PartOfSpeech: SpeechPartOfSpeech, + PhoneIds: *mut VARIANT, + ) -> HRESULT, + fn GetPronunciations( + bstrWord: BSTR, + LangId: SpeechLanguageId, + TypeFlags: SpeechLexiconType, + ppPronunciations: *mut *mut ISpeechLexiconPronunciations, + ) -> HRESULT, + fn GetGenerationChange( + GenerationID: *mut c_long, + ppWords: *mut *mut ISpeechLexiconWords, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8d199862, 0x415e, 0x47d5, 0xac, 0x4f, 0xfa, 0xa6, 0x08, 0xb4, 0x24, 0xe6)] +interface ISpeechLexiconWords(ISpeechLexiconWordsVtbl): IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Word: *mut *mut ISpeechLexiconWord, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x4e5b933c, 0xc9be, 0x48ed, 0x88, 0x42, 0x1e, 0xe5, 0x1b, 0xb1, 0xd4, 0xff)] +interface ISpeechLexiconWord(ISpeechLexiconWordVtbl): IDispatch(IDispatchVtbl) { + fn get_LangId( + LangId: *mut SpeechLanguageId, + ) -> HRESULT, + fn get_Type( + WordType: *mut SpeechWordType, + ) -> HRESULT, + fn get_Word( + Word: *mut BSTR, + ) -> HRESULT, + fn get_Pronunciations( + Pronunciations: *mut *mut ISpeechLexiconPronunciations, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x72829128, 0x5682, 0x4704, 0xa0, 0xd4, 0x3e, 0x2b, 0xb6, 0xf2, 0xea, 0xd3)] +interface ISpeechLexiconPronunciations(ISpeechLexiconPronunciationsVtbl): + IDispatch(IDispatchVtbl) { + fn get_Count( + Count: *mut c_long, + ) -> HRESULT, + fn Item( + Index: c_long, + Pronunciation: *mut *mut ISpeechLexiconPronunciation, + ) -> HRESULT, + fn get__NewEnum( + EnumVARIANT: *mut *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x95252c5d, 0x9e43, 0x4f4a, 0x98, 0x99, 0x48, 0xee, 0x73, 0x35, 0x2f, 0x9f)] +interface ISpeechLexiconPronunciation(ISpeechLexiconPronunciationVtbl): IDispatch(IDispatchVtbl) { + fn get_Type( + LexiconType: *mut SpeechLexiconType, + ) -> HRESULT, + fn get_LangId( + LangId: *mut SpeechLanguageId, + ) -> HRESULT, + fn get_PartOfSpeech( + PartOfSpeech: *mut SpeechPartOfSpeech, + ) -> HRESULT, + fn get_PhoneIds( + PhoneIds: *mut VARIANT, + ) -> HRESULT, + fn get_Symbolic( + Symbolic: *mut BSTR, + ) -> HRESULT, +}); +pub const Speech_Default_Weight: c_float = DEFAULT_WEIGHT; +pub const Speech_Max_Word_Length: LONG = SP_MAX_WORD_LENGTH as i32; +pub const Speech_Max_Pron_Length: LONG = SP_MAX_PRON_LENGTH as i32; +pub const Speech_StreamPos_Asap: LONG = SP_STREAMPOS_ASAP as i32; +pub const Speech_StreamPos_RealTime: LONG = SP_STREAMPOS_REALTIME as i32; +pub const SpeechAllElements: LONG = SPPR_ALL_ELEMENTS as i32; +RIDL!(#[uuid(0x3b151836, 0xdf3a, 0x4e0a, 0x84, 0x6c, 0xd2, 0xad, 0xc9, 0x33, 0x43, 0x33)] +interface ISpeechPhraseInfoBuilder(ISpeechPhraseInfoBuilderVtbl): IDispatch(IDispatchVtbl) { + fn RestorePhraseFromMemory( + PhraseInMemory: *mut VARIANT, + PhraseInfo: *mut *mut ISpeechPhraseInfo, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xc3e4f353, 0x433f, 0x43d6, 0x89, 0xa1, 0x6a, 0x62, 0xa7, 0x05, 0x4c, 0x3d)] +interface ISpeechPhoneConverter(ISpeechPhoneConverterVtbl): IDispatch(IDispatchVtbl) { + fn get_LanguageId( + LanguageId: *mut SpeechLanguageId, + ) -> HRESULT, + fn put_LanguageId( + LanguageId: SpeechLanguageId, + ) -> HRESULT, + fn PhoneToId( + Phonemes: BSTR, + IdArray: *mut VARIANT, + ) -> HRESULT, + fn IdToPhone( + IdArray: VARIANT, + Phonemes: *mut BSTR, + ) -> HRESULT, +}); +extern { + pub static CLSID_SpNotifyTranslator: CLSID; + pub static CLSID_SpObjectTokenCategory: CLSID; + pub static CLSID_SpObjectToken: CLSID; + pub static CLSID_SpResourceManager: CLSID; + pub static CLSID_SpStreamFormatConverter: CLSID; + pub static CLSID_SpMMAudioEnum: CLSID; + pub static CLSID_SpMMAudioIn: CLSID; + pub static CLSID_SpMMAudioOut: CLSID; + pub static CLSID_SpStream: CLSID; + pub static CLSID_SpVoice: CLSID; + pub static CLSID_SpSharedRecoContext: CLSID; + pub static CLSID_SpInprocRecognizer: CLSID; + pub static CLSID_SpSharedRecognizer: CLSID; + pub static CLSID_SpLexicon: CLSID; + pub static CLSID_SpUnCompressedLexicon: CLSID; + pub static CLSID_SpCompressedLexicon: CLSID; + pub static CLSID_SpPhoneConverter: CLSID; + pub static CLSID_SpNullPhoneConverter: CLSID; + pub static CLSID_SpTextSelectionInformation: CLSID; + pub static CLSID_SpPhraseInfoBuilder: CLSID; + pub static CLSID_SpAudioFormat: CLSID; + pub static CLSID_SpWaveFormatEx: CLSID; + pub static CLSID_SpInProcRecoContext: CLSID; + pub static CLSID_SpCustomStream: CLSID; + pub static CLSID_SpFileStream: CLSID; + pub static CLSID_SpMemoryStream: CLSID; +} diff --git a/src/vendor/winapi/src/um/sapi53.rs b/src/vendor/winapi/src/um/sapi53.rs new file mode 100644 index 0000000000..e687b7f46c --- /dev/null +++ b/src/vendor/winapi/src/um/sapi53.rs @@ -0,0 +1,1824 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! SAPI 5.3 definitions +use ctypes::{c_float, c_int, c_long}; +use shared::guiddef::{CLSID, GUID}; +use shared::minwindef::{BOOL, BYTE, DWORD, LPARAM, UINT, ULONG, WORD, WPARAM}; +use shared::wtypes::{BSTR, VARIANT_BOOL}; +use um::oaidl::{IDispatch, IDispatchVtbl, VARIANT}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::urlmon::IInternetSecurityManager; +use um::winnt::{HRESULT, LPCWSTR, LPWSTR, ULONGLONG, WCHAR}; +pub use um::sapi51::{ + SPDATAKEYLOCATION, + SPDKL_DefaultLocation, + SPDKL_CurrentUser, + SPDKL_LocalMachine, + SPDKL_CurrentConfig, + SPDUI_EngineProperties, + SPDUI_AddRemoveWord, + SPDUI_UserTraining, + SPDUI_MicTraining, + SPDUI_RecoProfileProperties, + SPDUI_AudioProperties, + SPDUI_AudioVolume, + SPDUI_UserEnrollment, + SPDUI_ShareData, + SPDUI_Tutorial, + SPSTREAMFORMAT, + SPSF_Default, + SPSF_NoAssignedFormat, + SPSF_Text, + SPSF_NonStandardFormat, + SPSF_ExtendedAudioFormat, + SPSF_8kHz8BitMono, + SPSF_8kHz8BitStereo, + SPSF_8kHz16BitMono, + SPSF_8kHz16BitStereo, + SPSF_11kHz8BitMono, + SPSF_11kHz8BitStereo, + SPSF_11kHz16BitMono, + SPSF_11kHz16BitStereo, + SPSF_12kHz8BitMono, + SPSF_12kHz8BitStereo, + SPSF_12kHz16BitMono, + SPSF_12kHz16BitStereo, + SPSF_16kHz8BitMono, + SPSF_16kHz8BitStereo, + SPSF_16kHz16BitMono, + SPSF_16kHz16BitStereo, + SPSF_22kHz8BitMono, + SPSF_22kHz8BitStereo, + SPSF_22kHz16BitMono, + SPSF_22kHz16BitStereo, + SPSF_24kHz8BitMono, + SPSF_24kHz8BitStereo, + SPSF_24kHz16BitMono, + SPSF_24kHz16BitStereo, + SPSF_32kHz8BitMono, + SPSF_32kHz8BitStereo, + SPSF_32kHz16BitMono, + SPSF_32kHz16BitStereo, + SPSF_44kHz8BitMono, + SPSF_44kHz8BitStereo, + SPSF_44kHz16BitMono, + SPSF_44kHz16BitStereo, + SPSF_48kHz8BitMono, + SPSF_48kHz8BitStereo, + SPSF_48kHz16BitMono, + SPSF_48kHz16BitStereo, + SPSF_TrueSpeech_8kHz1BitMono, + SPSF_CCITT_ALaw_8kHzMono, + SPSF_CCITT_ALaw_8kHzStereo, + SPSF_CCITT_ALaw_11kHzMono, + SPSF_CCITT_ALaw_11kHzStereo, + SPSF_CCITT_ALaw_22kHzMono, + SPSF_CCITT_ALaw_22kHzStereo, + SPSF_CCITT_ALaw_44kHzMono, + SPSF_CCITT_ALaw_44kHzStereo, + SPSF_CCITT_uLaw_8kHzMono, + SPSF_CCITT_uLaw_8kHzStereo, + SPSF_CCITT_uLaw_11kHzMono, + SPSF_CCITT_uLaw_11kHzStereo, + SPSF_CCITT_uLaw_22kHzMono, + SPSF_CCITT_uLaw_22kHzStereo, + SPSF_CCITT_uLaw_44kHzMono, + SPSF_CCITT_uLaw_44kHzStereo, + SPSF_ADPCM_8kHzMono, + SPSF_ADPCM_8kHzStereo, + SPSF_ADPCM_11kHzMono, + SPSF_ADPCM_11kHzStereo, + SPSF_ADPCM_22kHzMono, + SPSF_ADPCM_22kHzStereo, + SPSF_ADPCM_44kHzMono, + SPSF_ADPCM_44kHzStereo, + SPSF_GSM610_8kHzMono, + SPSF_GSM610_11kHzMono, + SPSF_GSM610_22kHzMono, + SPSF_GSM610_44kHzMono, + SPSF_NUM_FORMATS, + SPDFID_Text, + SPDFID_WaveFormatEx, + SPREG_USER_ROOT, + SPREG_LOCAL_MACHINE_ROOT, + SPCAT_AUDIOOUT, + SPCAT_AUDIOIN, + SPCAT_VOICES, + SPCAT_RECOGNIZERS, + SPCAT_APPLEXICONS, + SPCAT_PHONECONVERTERS, + SPCAT_TEXTNORMALIZERS, + SPCAT_RECOPROFILES, + SPMMSYS_AUDIO_IN_TOKEN_ID, + SPMMSYS_AUDIO_OUT_TOKEN_ID, + SPCURRENT_USER_LEXICON_TOKEN_ID, + SPTOKENVALUE_CLSID, + SPTOKENKEY_FILES, + SPTOKENKEY_UI, + SPTOKENKEY_ATTRIBUTES +}; +pub const SPTOKENKEY_RETAINEDAUDIO: &'static str = "SecondsPerRetainedAudioEvent"; +pub const SPTOKENKEY_AUDIO_LATENCY_WARNING: &'static str = "LatencyWarningThreshold"; +pub const SPTOKENKEY_AUDIO_LATENCY_TRUNCATE: &'static str = "LatencyTruncateThreshold"; +pub const SPTOKENKEY_AUDIO_LATENCY_UPDATE_INTERVAL: &'static str = "LatencyUpdateInterval"; +pub use um::sapi51::{ + SPVOICECATEGORY_TTSRATE, + SPPROP_RESOURCE_USAGE, + SPPROP_HIGH_CONFIDENCE_THRESHOLD, + SPPROP_NORMAL_CONFIDENCE_THRESHOLD, + SPPROP_LOW_CONFIDENCE_THRESHOLD, + SPPROP_RESPONSE_SPEED, + SPPROP_COMPLEX_RESPONSE_SPEED, + SPPROP_ADAPTATION_ON, + SPPROP_PERSISTED_BACKGROUND_ADAPTATION, + SPPROP_PERSISTED_LANGUAGE_MODEL_ADAPTATION, + SPPROP_UX_IS_LISTENING, + SPTOPIC_SPELLING, + SPWILDCARD, + SPDICTATION +}; +pub const SPREG_SAFE_USER_TOKENS: &'static str + = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\UserTokens"; +pub use um::sapi51::{ + SPINFDICTATION, + SP_LOW_CONFIDENCE, + SP_NORMAL_CONFIDENCE, + SP_HIGH_CONFIDENCE, + DEFAULT_WEIGHT, + SP_MAX_WORD_LENGTH, + SP_MAX_PRON_LENGTH +}; +pub const SP_EMULATE_RESULT: ULONG = 0x40000000; +pub use um::sapi51::{ + ISpNotifyCallback, + SPNOTIFYCALLBACK, + ISpNotifySource, ISpNotifySourceVtbl, + ISpNotifySink, ISpNotifySinkVtbl, + ISpNotifyTranslator, ISpNotifyTranslatorVtbl, + ISpDataKey, ISpDataKeyVtbl, + ISpRegDataKey, ISpRegDataKeyVtbl, + ISpObjectTokenCategory, ISpObjectTokenCategoryVtbl, + ISpObjectToken, ISpObjectTokenVtbl, + ISpObjectTokenInit, ISpObjectTokenInitVtbl, + IEnumSpObjectTokens, IEnumSpObjectTokensVtbl, + ISpObjectWithToken, ISpObjectWithTokenVtbl, + ISpResourceManager, ISpResourceManagerVtbl, + SPEVENTLPARAMTYPE, + SPET_LPARAM_IS_UNDEFINED, + SPET_LPARAM_IS_TOKEN, + SPET_LPARAM_IS_OBJECT, + SPET_LPARAM_IS_POINTER, + SPET_LPARAM_IS_STRING, + SPEVENTENUM, + SPEI_UNDEFINED, + SPEI_START_INPUT_STREAM, + SPEI_END_INPUT_STREAM, + SPEI_VOICE_CHANGE, + SPEI_TTS_BOOKMARK, + SPEI_WORD_BOUNDARY, + SPEI_PHONEME, + SPEI_SENTENCE_BOUNDARY, + SPEI_VISEME, + SPEI_TTS_AUDIO_LEVEL, + SPEI_TTS_PRIVATE, + SPEI_MIN_TTS, + SPEI_MAX_TTS, + SPEI_END_SR_STREAM, + SPEI_SOUND_START, + SPEI_SOUND_END, + SPEI_PHRASE_START, + SPEI_RECOGNITION, + SPEI_HYPOTHESIS, + SPEI_SR_BOOKMARK, + SPEI_PROPERTY_NUM_CHANGE, + SPEI_PROPERTY_STRING_CHANGE, + SPEI_FALSE_RECOGNITION, + SPEI_INTERFERENCE, + SPEI_REQUEST_UI, + SPEI_RECO_STATE_CHANGE, + SPEI_ADAPTATION, + SPEI_START_SR_STREAM, + SPEI_RECO_OTHER_CONTEXT, + SPEI_SR_AUDIO_LEVEL +}; +pub const SPEI_SR_RETAINEDAUDIO: SPEVENTENUM = 51; +pub use um::sapi51::SPEI_SR_PRIVATE; +pub const SPEI_RESERVED4: SPEVENTENUM = 53; +pub const SPEI_RESERVED5: SPEVENTENUM = 54; +pub const SPEI_RESERVED6: SPEVENTENUM = 55; +pub use um::sapi51::SPEI_MIN_SR; +pub const SPEI_MAX_SR: SPEVENTENUM = 55; +pub use um::sapi51::{ + SPEI_RESERVED1, + SPEI_RESERVED2, + SPEI_RESERVED3, + SPFEI_FLAGCHECK, + SPFEI_ALL_TTS_EVENTS, + SPFEI_ALL_SR_EVENTS, + SPFEI_ALL_EVENTS, + SPFEI, + SPEVENT, + SPSERIALIZEDEVENT, + SPSERIALIZEDEVENT64 +}; +STRUCT!{struct SPEVENTEX { + eEventId: WORD, + elParamType: WORD, + ulStreamNum: ULONG, + ullAudioStreamOffset: ULONGLONG, + wParam: WPARAM, + lParam: LPARAM, + ullAudioTimeOffset: ULONGLONG, +}} +pub use um::sapi51::{ + SPINTERFERENCE, + SPINTERFERENCE_NONE, + SPINTERFERENCE_NOISE, + SPINTERFERENCE_NOSIGNAL, + SPINTERFERENCE_TOOLOUD, + SPINTERFERENCE_TOOQUIET, + SPINTERFERENCE_TOOFAST, + SPINTERFERENCE_TOOSLOW, + SPINTERFERENCE_LATENCY_WARNING, + SPINTERFERENCE_LATENCY_TRUNCATE_BEGIN, + SPINTERFERENCE_LATENCY_TRUNCATE_END, + SPENDSRSTREAMFLAGS, + SPESF_NONE, + SPESF_STREAM_RELEASED +}; +pub const SPESF_EMULATED: SPENDSRSTREAMFLAGS = 1 << 1; +pub use um::sapi51::{ + SPVFEATURE, + SPVFEATURE_STRESSED, + SPVFEATURE_EMPHASIS, + SPVISEMES, + SP_VISEME_0, + SP_VISEME_1, + SP_VISEME_2, + SP_VISEME_3, + SP_VISEME_4, + SP_VISEME_5, + SP_VISEME_6, + SP_VISEME_7, + SP_VISEME_8, + SP_VISEME_9, + SP_VISEME_10, + SP_VISEME_11, + SP_VISEME_12, + SP_VISEME_13, + SP_VISEME_14, + SP_VISEME_15, + SP_VISEME_16, + SP_VISEME_17, + SP_VISEME_18, + SP_VISEME_19, + SP_VISEME_20, + SP_VISEME_21, + SPEVENTSOURCEINFO, + ISpEventSource, ISpEventSourceVtbl, +}; +RIDL!(#[uuid(0x2373a435, 0x6a4b, 0x429e, 0xa6, 0xac, 0xd4, 0x23, 0x1a, 0x61, 0x97, 0x5b)] +interface ISpEventSource2(ISpEventSource2Vtbl): ISpEventSource(ISpEventSourceVtbl) { + fn GetEventsEx( + ulCount: ULONG, + pEventArray: *mut SPEVENTEX, + pulFetched: *mut ULONG, + ) -> HRESULT, +}); +pub use um::sapi51::{ + ISpEventSink, ISpEventSinkVtbl, + ISpStreamFormat, ISpStreamFormatVtbl, + SPFILEMODE, + SPFM_OPEN_READONLY, + SPFM_OPEN_READWRITE, + SPFM_CREATE, + SPFM_CREATE_ALWAYS, + SPFM_NUM_MODES, + ISpStream, ISpStreamVtbl, + ISpStreamFormatConverter, ISpStreamFormatConverterVtbl, + SPAUDIOSTATE, + SPAS_CLOSED, + SPAS_STOP, + SPAS_PAUSE, + SPAS_RUN, + SPAUDIOSTATUS, + SPAUDIOBUFFERINFO, + ISpAudio, ISpAudioVtbl, + ISpMMSysAudio, ISpMMSysAudioVtbl, + ISpTranscript, ISpTranscriptVtbl, + SPDISPLAYATTRIBUTES, + SPAF_ONE_TRAILING_SPACE, + SPAF_TWO_TRAILING_SPACES, + SPAF_CONSUME_LEADING_SPACES +}; +pub const SPAF_BUFFER_POSITION: SPDISPLAYATTRIBUTES = 0x10; +pub const SPAF_ALL: SPDISPLAYATTRIBUTES = 0x1f; +pub const SPAF_USER_SPECIFIED: SPDISPLAYATTRIBUTES = 0x80; +pub use um::sapi51::{ + SPPHONEID, + PSPPHONEID, + PCSPPHONEID, + SPPHRASEELEMENT, + SPPHRASERULE, + SPPHRASEPROPERTYUNIONTYPE, + SPPPUT_UNUSED, + SPPPUT_ARRAY_INDEX, + SPPHRASEPROPERTY, + SPPHRASEREPLACEMENT +}; +STRUCT!{struct SPSEMANTICERRORINFO { + ulLineNumber: ULONG, + pszScriptLine: LPWSTR, + pszSource: LPWSTR, + pszDescription: LPWSTR, + hrResultCode: HRESULT, +}} +ENUM!{enum SPSEMANTICFORMAT { + SPSMF_SAPI_PROPERTIES = 0, + SPSMF_SRGS_SEMANTICINTERPRETATION_MS = 1, + SPSMF_SRGS_SAPIPROPERTIES = 2, + SPSMF_UPS = 4, + SPSMF_SRGS_SEMANTICINTERPRETATION_W3C = 8, +}} +pub use um::sapi51::SPPHRASE as SPPHRASE_50; +// TODO: pub const SP_SPPHRASESIZE_500: usize = mem::size_of::(); +STRUCT!{struct SPPHRASE { + cbSize: ULONG, + LangID: WORD, + wHomophoneGroupId: WORD, + ullGrammarID: ULONGLONG, + ftStartTime: ULONGLONG, + ullAudioStreamPosition: ULONGLONG, + ulAudioSizeBytes: ULONG, + ulRetainedSizeBytes: ULONG, + ulAudioSizeTime: ULONG, + Rule: SPPHRASERULE, + pProperties: *const SPPHRASEPROPERTY, + pElements: *const SPPHRASEELEMENT, + cReplacements: ULONG, + pReplacements: *const SPPHRASEREPLACEMENT, + SREngineID: GUID, + ulSREnginePrivateDataSize: ULONG, + pSREnginePrivateData: *const BYTE, + pSML: LPWSTR, + pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, +}} +pub use um::sapi51::SPSERIALIZEDPHRASE; +STRUCT!{struct SPRULE { + pszRuleName: LPCWSTR, + ulRuleId: ULONG, + dwAttributes: DWORD, +}} +pub use um::sapi51::{ + SPVALUETYPE, + SPDF_PROPERTY, + SPDF_REPLACEMENT, + SPDF_RULE, + SPDF_DISPLAYTEXT, + SPDF_LEXICALFORM , + SPDF_PRONUNCIATION, + SPDF_AUDIO, + SPDF_ALTERNATES, + SPDF_ALL, + SPBINARYGRAMMAR, + SPPHRASERNG, + SPPR_ALL_ELEMENTS, + SP_GETWHOLEPHRASE, + SPRR_ALL_ELEMENTS, + SPSTATEHANDLE, + SPRECOEVENTFLAGS, + SPREF_AutoPause, + SPREF_Emulated +}; +pub const SPREF_SMLTimeout: SPRECOEVENTFLAGS = 1 << 2; +pub const SPREF_ExtendableParse: SPRECOEVENTFLAGS = 1 << 3; +pub const SPREF_ReSent: SPRECOEVENTFLAGS = 1 << 4; +pub const SPREF_Hypothesis: SPRECOEVENTFLAGS = 1 << 5; +pub const SPREF_FalseRecognition: SPRECOEVENTFLAGS = 1 << 6; +pub use um::sapi51::{ + SPPARTOFSPEECH, + SPPS_NotOverriden, + SPPS_Unknown, + SPPS_Noun, + SPPS_Verb, + SPPS_Modifier, + SPPS_Function, + SPPS_Interjection +}; +pub const SPPS_Noncontent: SPPARTOFSPEECH = 0x6000; +pub const SPPS_LMA: SPPARTOFSPEECH = 0x7000; +pub const SPPS_SuppressWord: SPPARTOFSPEECH = 0xf000; +pub use um::sapi51::{ + SPLEXICONTYPE, + eLEXTYPE_USER, + eLEXTYPE_APP, + eLEXTYPE_VENDORLEXICON, + eLEXTYPE_LETTERTOSOUND, + eLEXTYPE_MORPHOLOGY, + eLEXTYPE_RESERVED4, + eLEXTYPE_USER_SHORTCUT, + eLEXTYPE_RESERVED6, + eLEXTYPE_RESERVED7, + eLEXTYPE_RESERVED8, + eLEXTYPE_RESERVED9, + eLEXTYPE_RESERVED10, + eLEXTYPE_PRIVATE1, + eLEXTYPE_PRIVATE2, + eLEXTYPE_PRIVATE3, + eLEXTYPE_PRIVATE4, + eLEXTYPE_PRIVATE5, + eLEXTYPE_PRIVATE6, + eLEXTYPE_PRIVATE7, + eLEXTYPE_PRIVATE8, + eLEXTYPE_PRIVATE9, + eLEXTYPE_PRIVATE10, + eLEXTYPE_PRIVATE11, + eLEXTYPE_PRIVATE12, + eLEXTYPE_PRIVATE13, + eLEXTYPE_PRIVATE14, + eLEXTYPE_PRIVATE15, + eLEXTYPE_PRIVATE16, + eLEXTYPE_PRIVATE17, + eLEXTYPE_PRIVATE18, + eLEXTYPE_PRIVATE19, + eLEXTYPE_PRIVATE20, + SPWORDTYPE, + eWORDTYPE_ADDED, + eWORDTYPE_DELETED +}; +ENUM!{enum SPPRONUNCIATIONFLAGS { + ePRONFLAG_USED = 1 << 0, +}} +pub use um::sapi51::{ + SPWORDPRONUNCIATION, + SPWORDPRONUNCIATIONLIST, + SPWORD, + SPWORDLIST, + ISpLexicon, ISpLexiconVtbl, + ISpContainerLexicon, ISpContainerLexiconVtbl, +}; +ENUM!{enum SPSHORTCUTTYPE { + SPSHT_NotOverriden = -1i32 as u32, + SPSHT_Unknown = 0, + SPSHT_EMAIL = 0x1000, + SPSHT_OTHER = 0x2000, + SPPS_RESERVED1 = 0x3000, + SPPS_RESERVED2 = 0x4000, + SPPS_RESERVED3 = 0x5000, + SPPS_RESERVED4 = 0xf000, +}} +STRUCT!{struct SPSHORTCUTPAIR { + pNextSHORTCUTPAIR: *mut SPSHORTCUTPAIR, + LangID: WORD, + shType: SPSHORTCUTTYPE, + pszDisplay: LPWSTR, + pszSpoken: LPWSTR, +}} +STRUCT!{struct SPSHORTCUTPAIRLIST { + ulSize: ULONG, + pvBuffer: *mut BYTE, + pFirstShortcutPair: *mut SPSHORTCUTPAIR, +}} +RIDL!(#[uuid(0x3df681e2, 0xea56, 0x11d9, 0x8b, 0xde, 0xf6, 0x6b, 0xad, 0x1e, 0x3f, 0x3a)] +interface ISpShortcut(ISpShortcutVtbl): IUnknown(IUnknownVtbl) { + fn AddShortcut( + pszDisplay: LPCWSTR, + LangID: WORD, + pszSpoken: LPCWSTR, + shType: SPSHORTCUTTYPE, + ) -> HRESULT, + fn RemoveShortcut( + pszDisplay: LPCWSTR, + LangID: WORD, + pszSpoken: LPCWSTR, + shType: SPSHORTCUTTYPE, + ) -> HRESULT, + fn GetShortcuts( + LangId: WORD, + pShortcutpairList: *mut SPSHORTCUTPAIRLIST, + ) -> HRESULT, + fn GetGeneration( + pdwGeneration: *mut DWORD, + ) -> HRESULT, + fn GetWordsFromGenerationChange( + pdwGeneration: *mut DWORD, + pWordList: *mut SPWORDLIST, + ) -> HRESULT, + fn GetWords( + pdwGeneration: *mut DWORD, + pdwCookie: *mut DWORD, + pWordList: *mut SPWORDLIST, + ) -> HRESULT, + fn GetShortcutsForGeneration( + pdwGeneration: *mut DWORD, + pdwCookie: *mut DWORD, + pShortcutpairList: *mut SPSHORTCUTPAIRLIST, + ) -> HRESULT, + fn GetGenerationChange( + pdwGeneration: *mut DWORD, + pShortcutpairList: *mut SPSHORTCUTPAIRLIST, + ) -> HRESULT, +}); +pub use um::sapi51::{ISpPhoneConverter, ISpPhoneConverterVtbl}; +RIDL!(#[uuid(0x133adcd4, 0x19b4, 0x4020, 0x9f, 0xdc, 0x84, 0x2e, 0x78, 0x25, 0x3b, 0x17)] +interface ISpPhoneticAlphabetConverter(ISpPhoneticAlphabetConverterVtbl): IUnknown(IUnknownVtbl) { + fn GetLangId( + pLangID: *mut WORD, + ) -> HRESULT, + fn SetLangId( + LangID: WORD, + ) -> HRESULT, + fn SAPI2UPS( + pszSAPIId: *const SPPHONEID, + pszUPSId: *mut SPPHONEID, + cMaxLength: DWORD, + ) -> HRESULT, + fn UPS2SAPI( + pszUPSId: *const SPPHONEID, + pszSAPIId: *mut SPPHONEID, + cMaxLength: DWORD, + ) -> HRESULT, + fn GetMaxConvertLength( + cSrcLength: DWORD, + bSAPI2UPS: BOOL, + pcMaxDestLength: *mut DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xb2745efd, 0x42ce, 0x48ca, 0x81, 0xf1, 0xa9, 0x6e, 0x02, 0x53, 0x8a, 0x90)] +interface ISpPhoneticAlphabetSelection(ISpPhoneticAlphabetSelectionVtbl): IUnknown(IUnknownVtbl) { + fn IsAlphabetUPS( + pfIsUPS: *mut BOOL, + ) -> HRESULT, + fn SetAlphabetToUPS( + fForceUPS: BOOL, + ) -> HRESULT, +}); +pub use um::sapi51::{ + SPVPITCH, + SPVACTIONS, + SPVA_Speak, + SPVA_Silence, + SPVA_Pronounce, + SPVA_Bookmark, + SPVA_SpellOut, + SPVA_Section, + SPVA_ParseUnknownTag, + SPVCONTEXT, + SPVSTATE, + SPRUNSTATE, + SPRS_DONE, + SPRS_IS_SPEAKING, + SPVLIMITS, + SPMIN_VOLUME, + SPMAX_VOLUME, + SPMIN_RATE, + SPMAX_RATE, + SPVPRIORITY, + SPVPRI_NORMAL, + SPVPRI_ALERT, + SPVPRI_OVER, + SPVOICESTATUS, + SPEAKFLAGS, + SPF_DEFAULT, + SPF_ASYNC, + SPF_PURGEBEFORESPEAK, + SPF_IS_FILENAME, + SPF_IS_XML, + SPF_IS_NOT_XML, + SPF_PERSIST_XML, + SPF_NLP_SPEAK_PUNC, +}; +pub const SPF_PARSE_SAPI: SPEAKFLAGS = 1 << 7; +pub const SPF_PARSE_SSML: SPEAKFLAGS = 1 << 8; +pub const SPF_PARSE_AUTODETECT: SPEAKFLAGS = 0; +pub use um::sapi51::SPF_NLP_MASK; +pub const SPF_PARSE_MASK: SPEAKFLAGS = SPF_PARSE_SAPI | SPF_PARSE_SSML; +pub const SPF_VOICE_MASK: SPEAKFLAGS = ::um::sapi51::SPF_VOICE_MASK | SPF_PARSE_MASK; +pub const SPF_UNUSED_FLAGS: SPEAKFLAGS = !SPF_VOICE_MASK; +pub use um::sapi51::{ + ISpVoice, ISpVoiceVtbl, + ISpPhrase, ISpPhraseVtbl, + ISpPhraseAlt, ISpPhraseAltVtbl, +}; +ENUM!{enum SPXMLRESULTOPTIONS { + SPXRO_SML = 0, + SPXRO_Alternates_SML = 1, +}} +RIDL!(#[uuid(0xf264da52, 0xe457, 0x4696, 0xb8, 0x56, 0xa7, 0x37, 0xb7, 0x17, 0xaf, 0x79)] +interface ISpPhrase2(ISpPhrase2Vtbl): ISpPhrase(ISpPhraseVtbl) { + fn GetXMLResult( + ppszCoMemXMLResult: *mut LPWSTR, + Options: SPXMLRESULTOPTIONS, + ) -> HRESULT, + fn GetXMLErrorInfo( + pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, + ) -> HRESULT, + fn GetAudio( + ulStartElement: ULONG, + cElements: ULONG, + ppStream: *mut *mut ISpStreamFormat, + ) -> HRESULT, +}); +pub use um::sapi51::{ + SPRECORESULTTIMES, + SPSERIALIZEDRESULT, + ISpRecoResult, ISpRecoResultVtbl, +}; +ENUM!{enum SPCOMMITFLAGS { + SPCF_NONE = 0, + SPCF_ADD_TO_USER_LEXICON = 1 << 0, + SPCF_DEFINITE_CORRECTION = 1 << 1, +}} +RIDL!(#[uuid(0x27cac6c4, 0x88f2, 0x41f2, 0x88, 0x17, 0x0c, 0x95, 0xe5, 0x9f, 0x1e, 0x6e)] +interface ISpRecoResult2(ISpRecoResult2Vtbl): ISpRecoResult(ISpRecoResultVtbl) { + fn CommitAlternate( + pPhraseAlt: *mut ISpPhraseAlt, + ppNewResult: *mut *mut ISpRecoResult, + ) -> HRESULT, + fn CommitText( + ulStartElement: ULONG, + cElements: ULONG, + pszCorrectedData: LPCWSTR, + eCommitFlags: DWORD, + ) -> HRESULT, + fn SetTextFeedback( + pszFeedback: LPCWSTR, + fSuccessful: BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xae39362b, 0x45a8, 0x4074, 0x9b, 0x9e, 0xcc, 0xf4, 0x9a, 0xa2, 0xd0, 0xb6)] +interface ISpXMLRecoResult(ISpXMLRecoResultVtbl): ISpRecoResult(ISpRecoResultVtbl) { + fn GetXMLResult( + ppszCoMemXMLResult: *mut LPWSTR, + Options: SPXMLRESULTOPTIONS, + ) -> HRESULT, + fn GetXMLErrorInfo( + pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, + ) -> HRESULT, +}); +pub use um::sapi51::{ + SPTEXTSELECTIONINFO, + SPWORDPRONOUNCEABLE, + SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE, + SPWP_KNOWN_WORD_PRONOUNCEABLE, + SPGRAMMARSTATE, + SPGS_DISABLED, + SPGS_ENABLED, + SPGS_EXCLUSIVE, + SPCONTEXTSTATE, + SPCS_DISABLED, + SPCS_ENABLED, + SPRULESTATE, + SPRS_INACTIVE, + SPRS_ACTIVE, + SPRS_ACTIVE_WITH_AUTO_PAUSE, +}; +pub const SPRS_ACTIVE_USER_DELIMITED: SPRULESTATE = 4; +pub use um::sapi51::{ + SP_STREAMPOS_ASAP, + SP_STREAMPOS_REALTIME, + SPRULETRANS_TEXTBUFFER, + SPRULETRANS_WILDCARD, + SPRULETRANS_DICTATION, + SPGRAMMARWORDTYPE, + SPWT_DISPLAY, + SPWT_LEXICAL, + SPWT_PRONUNCIATION, +}; +pub const SPWT_LEXICAL_NO_SPECIAL_CHARS: SPGRAMMARWORDTYPE = SPWT_PRONUNCIATION + 1; +pub use um::sapi51::{ + SPPROPERTYINFO, + SPCFGRULEATTRIBUTES, + SPRAF_TopLevel, + SPRAF_Active, + SPRAF_Export, + SPRAF_Import, + SPRAF_Interpreter, + SPRAF_Dynamic, +}; +pub const SPRAF_Root: SPCFGRULEATTRIBUTES = 1 << 6; +pub use um::sapi51::SPRAF_AutoPause; +pub const SPRAF_UserDelimited: SPCFGRULEATTRIBUTES = 1 << 17; +pub use um::sapi51::{ + ISpGrammarBuilder, ISpGrammarBuilderVtbl, + SPLOADOPTIONS, + SPLO_STATIC, + SPLO_DYNAMIC, + ISpRecoGrammar, ISpRecoGrammarVtbl, +}; +ENUM!{enum SPMATCHINGMODE { + AllWords = 0, + Subsequence = 1, + OrderedSubset = 3, + SubsequenceContentRequired = 5, + OrderedSubsetContentRequired = 7, +}} +ENUM!{enum PHONETICALPHABET { + PA_Ipa = 0, + PA_Ups = 1, + PA_Sapi = 2, +}} +RIDL!(#[uuid(0x8ab10026, 0x20cc, 0x4b20, 0x8c, 0x22, 0xa4, 0x9c, 0x9b, 0xa7, 0x8f, 0x60)] +interface ISpGrammarBuilder2(ISpGrammarBuilder2Vtbl): IUnknown(IUnknownVtbl) { + fn AddTextSubset( + hFromState: SPSTATEHANDLE, + hToState: SPSTATEHANDLE, + psz: LPCWSTR, + eMatchMode: SPMATCHINGMODE, + ) -> HRESULT, + fn SetPhoneticAlphabet( + phoneticALphabet: PHONETICALPHABET, + ) -> HRESULT, +}); +pub const SPRP_NORMAL: i32 = 0; // TODO: Unknown purpose and type +RIDL!(#[uuid(0x4b37bc9e, 0x9ed6, 0x44a3, 0x93, 0xd3, 0x18, 0xf0, 0x22, 0xb7, 0x9e, 0xc3)] +interface ISpRecoGrammar2(ISpRecoGrammar2Vtbl): IUnknown(IUnknownVtbl) { + fn GetRules( + ppCoMemRules: *mut *mut SPRULE, + puNumRules: *mut UINT, + ) -> HRESULT, + fn LoadCmdFromFile2( + pszFileName: LPCWSTR, + Options: SPLOADOPTIONS, + pszSharingUri: LPCWSTR, + pszBaseUri: LPCWSTR, + ) -> HRESULT, + fn LoadCmdFromMemory2( + pGrammar: *const SPBINARYGRAMMAR, + Options: SPLOADOPTIONS, + pszSharingUri: LPCWSTR, + pszBaseUri: LPCWSTR, + ) -> HRESULT, + fn SetRulePriority( + pszRuleName: LPCWSTR, + ulRuleId: ULONG, + nRulePriority: c_int, + ) -> HRESULT, + fn SetRuleWeight( + pszRuleName: LPCWSTR, + ulRuleId: ULONG, + flWeight: c_float, + ) -> HRESULT, + fn SetDictationWeight( + flWeight: c_float, + ) -> HRESULT, + fn SetGrammarLoader( + pLoader: *mut ISpeechResourceLoader, + ) -> HRESULT, + fn SetSMLSecurityManager( + pSMLSecurityManager: *mut IInternetSecurityManager, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xb9ac5783, 0xfcd0, 0x4b21, 0xb1, 0x19, 0xb4, 0xf8, 0xda, 0x8f, 0xd2, 0xc3)] +interface ISpeechResourceLoader(ISpeechResourceLoaderVtbl): IDispatch(IDispatchVtbl) { + fn LoadResource( + bstrResourceUri: BSTR, + fAlwaysReload: VARIANT_BOOL, + pStream: *mut *mut IUnknown, + pbstrMIMEType: *mut BSTR, + pfModified: *mut VARIANT_BOOL, + pbstrRedirectUrl: *mut BSTR, + ) -> HRESULT, + fn GetLocalCopy( + bstrResourceUri: BSTR, + pbstrLocalPath: *mut BSTR, + pbstrMIMEType: *mut BSTR, + pbstrRedirectUrl: *mut BSTR, + ) -> HRESULT, + fn ReleaseLocalCopy( + pbstrLocalPath: BSTR, + ) -> HRESULT, +}); +pub use um::sapi51::{ + SPRECOCONTEXTSTATUS, + SPBOOKMARKOPTIONS, + SPBO_NONE, + SPBO_PAUSE, +}; +pub const SPBO_AHEAD: SPBOOKMARKOPTIONS = 1 << 1; +pub const SPBO_TIME_UNITS: SPBOOKMARKOPTIONS = 1 << 2; +pub use um::sapi51::{ + SPAUDIOOPTIONS, + SPAO_NONE, + SPAO_RETAIN_AUDIO, + ISpRecoContext, ISpRecoContextVtbl, +}; +ENUM!{enum SPGRAMMAROPTIONS { + SPGO_SAPI = 0x1, + SPGO_SRGS = 0x2, + SPGO_UPS = 0x4, + SPGO_SRGS_MS_SCRIPT = 0x8, + SPGO_SRGS_W3C_SCRIPT = 0x100, + SPGO_SRGS_STG_SCRIPT = 0x200, + SPGO_SRGS_SCRIPT = SPGO_SRGS | SPGO_SRGS_MS_SCRIPT + | SPGO_SRGS_W3C_SCRIPT | SPGO_SRGS_STG_SCRIPT, + SPGO_FILE = 0x10, + SPGO_HTTP = 0x20, + SPGO_RES = 0x40, + SPGO_OBJECT = 0x80, + SPGO_DEFAULT = 0x3fb, + SPGO_ALL = 0x3ff, +}} +ENUM!{enum SPADAPTATIONSETTINGS { + SPADS_Default = 0, + SPADS_CurrentRecognizer = 0x1, + SPADS_RecoProfile = 0x2, + SPADS_Immediate = 0x4, + SPADS_Reset = 0x8, + SPADS_HighVolumeDataSource = 0x10, +}} +ENUM!{enum SPADAPTATIONRELEVANCE { + SPAR_Unknown = 0, + SPAR_Low = 1, + SPAR_Medium = 2, + SPAR_High = 3, +}} +RIDL!(#[uuid(0xbead311c, 0x52ff, 0x437f, 0x94, 0x64, 0x6b, 0x21, 0x05, 0x4c, 0xa7, 0x3d)] +interface ISpRecoContext2(ISpRecoContext2Vtbl): IUnknown(IUnknownVtbl) { + fn SetGrammarOptions( + eGrammarOptions: DWORD, + ) -> HRESULT, + fn GetGrammarOptions( + peGrammarOptions: *mut DWORD, + ) -> HRESULT, + fn SetAdaptationData2( + pAdaptationData: LPCWSTR, + cch: ULONG, + pTopicName: LPCWSTR, + eAdaptationSettings: DWORD, + eRelevance: SPADAPTATIONRELEVANCE, + ) -> HRESULT, +}); +pub use um::sapi51::{ + ISpProperties, ISpPropertiesVtbl, + SP_MAX_LANGIDS, + SPRECOGNIZERSTATUS, + SPWAVEFORMATTYPE, + SPWF_INPUT, + SPWF_SRENGINE, + SPSTREAMFORMATTYPE, + SPRECOSTATE, + SPRST_INACTIVE, + SPRST_ACTIVE, + SPRST_ACTIVE_ALWAYS, + SPRST_INACTIVE_WITH_PURGE, + SPRST_NUM_STATES, + ISpRecognizer, ISpRecognizerVtbl, +}; +RIDL!(#[uuid(0x21b501a0, 0x0ec7, 0x46c9, 0x92, 0xc3, 0xa2, 0xbc, 0x78, 0x4c, 0x54, 0xb9)] +interface ISpSerializeState(ISpSerializeStateVtbl): IUnknown(IUnknownVtbl) { + fn GetSerializedState( + ppbData: *mut *mut BYTE, + pulSize: *mut ULONG, + dwReserved: DWORD, + ) -> HRESULT, + fn SetSerializedState( + pbData: *mut BYTE, + ulSize: ULONG, + dwReserved: DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8fc6d974, 0xc81e, 0x4098, 0x93, 0xc5, 0x01, 0x47, 0xf6, 0x1e, 0xd4, 0xd3)] +interface ISpRecognizer2(ISpRecognizer2Vtbl): IUnknown(IUnknownVtbl) { + fn EmulateRecognitionEx( + pPhrase: *mut ISpPhrase, + dwCompareFlags: DWORD, + ) -> HRESULT, + fn SetTrainingState( + fDoingTraining: BOOL, + fAdaptFromTrainingData: BOOL, + ) -> HRESULT, + fn ResetAcousticModelAdaptation() -> HRESULT, +}); +STRUCT!{struct SPNORMALIZATIONLIST { + ulSize: ULONG, + ppszzNormalizedList: *mut *mut WCHAR, +}} +RIDL!(#[uuid(0xc360ce4b, 0x76d1, 0x4214, 0xad, 0x68, 0x52, 0x65, 0x7d, 0x50, 0x83, 0xda)] +interface ISpEnginePronunciation(ISpEnginePronunciationVtbl): IUnknown(IUnknownVtbl) { + fn Normalize( + pszWord: LPCWSTR, + pszLeftContext: LPCWSTR, + pszRightContext: LPCWSTR, + LangID: WORD, + pNormalizationList: *mut SPNORMALIZATIONLIST, + ) -> HRESULT, + fn GetPronunciations( + pszWord: LPCWSTR, + pszLeftContext: LPCWSTR, + pszRightContext: LPCWSTR, + LangID: WORD, + pEnginePronunciationList: *mut SPWORDPRONUNCIATIONLIST, + ) -> HRESULT, +}); +STRUCT!{struct SPDISPLAYTOKEN { + pszLexical: *const WCHAR, + pszDisplay: *const WCHAR, + bDisplayAttributes: BYTE, +}} +STRUCT!{struct SPDISPLAYPHRASE { + ulNumTokens: ULONG, + pTokens: *mut SPDISPLAYTOKEN, +}} +RIDL!(#[uuid(0xc8d7c7e2, 0x0dde, 0x44b7, 0xaf, 0xe3, 0xb0, 0xc9, 0x91, 0xfb, 0xeb, 0x5e)] +interface ISpDisplayAlternates(ISpDisplayAlternatesVtbl): IUnknown(IUnknownVtbl) { + fn GetDisplayAlternates( + pPhrase: *const SPDISPLAYPHRASE, + cRequestCount: ULONG, + ppCoMemPhrases: *mut *mut SPDISPLAYPHRASE, + pcPhrasesReturned: *mut ULONG, + ) -> HRESULT, + fn SetFullStopTrailSpace( + ulTrailSpace: ULONG, + ) -> HRESULT, +}); +pub use um::sapi51::{ + SpeechLanguageId, + DISPID_SpeechDataKey, + DISPID_SDKSetBinaryValue, + DISPID_SDKGetBinaryValue, + DISPID_SDKSetStringValue, + DISPID_SDKGetStringValue, + DISPID_SDKSetLongValue, + DISPID_SDKGetlongValue, + DISPID_SDKOpenKey, + DISPID_SDKCreateKey, + DISPID_SDKDeleteKey, + DISPID_SDKDeleteValue, + DISPID_SDKEnumKeys, + DISPID_SDKEnumValues, + DISPID_SpeechObjectToken, + DISPID_SOTId, + DISPID_SOTDataKey, + DISPID_SOTCategory, + DISPID_SOTGetDescription, + DISPID_SOTSetId, + DISPID_SOTGetAttribute, + DISPID_SOTCreateInstance, + DISPID_SOTRemove, + DISPID_SOTGetStorageFileName, + DISPID_SOTRemoveStorageFileName, + DISPID_SOTIsUISupported, + DISPID_SOTDisplayUI, + DISPID_SOTMatchesAttributes, + SpeechDataKeyLocation, + SDKLDefaultLocation, + SDKLCurrentUser, + SDKLLocalMachine, + SDKLCurrentConfig, + SpeechTokenContext, + STCInprocServer, + STCInprocHandler , + STCLocalServer, + STCRemoteServer, + STCAll, + SpeechTokenShellFolder, + STSF_AppData, + STSF_LocalAppData, + STSF_CommonAppData, + STSF_FlagCreate, + DISPID_SpeechObjectTokens, + DISPID_SOTsCount, + DISPID_SOTsItem, + DISPID_SOTs_NewEnum, + DISPID_SpeechObjectTokenCategory, + DISPID_SOTCId, + DISPID_SOTCDefault, + DISPID_SOTCSetId, + DISPID_SOTCGetDataKey, + DISPID_SOTCEnumerateTokens, + SpeechAudioFormatType, + SAFTDefault, + SAFTNoAssignedFormat, + SAFTText, + SAFTNonStandardFormat, + SAFTExtendedAudioFormat, + SAFT8kHz8BitMono, + SAFT8kHz8BitStereo, + SAFT8kHz16BitMono, + SAFT8kHz16BitStereo, + SAFT11kHz8BitMono, + SAFT11kHz8BitStereo, + SAFT11kHz16BitMono, + SAFT11kHz16BitStereo, + SAFT12kHz8BitMono, + SAFT12kHz8BitStereo, + SAFT12kHz16BitMono, + SAFT12kHz16BitStereo, + SAFT16kHz8BitMono, + SAFT16kHz8BitStereo, + SAFT16kHz16BitMono, + SAFT16kHz16BitStereo, + SAFT22kHz8BitMono, + SAFT22kHz8BitStereo, + SAFT22kHz16BitMono, + SAFT22kHz16BitStereo, + SAFT24kHz8BitMono, + SAFT24kHz8BitStereo, + SAFT24kHz16BitMono, + SAFT24kHz16BitStereo, + SAFT32kHz8BitMono, + SAFT32kHz8BitStereo, + SAFT32kHz16BitMono, + SAFT32kHz16BitStereo, + SAFT44kHz8BitMono, + SAFT44kHz8BitStereo, + SAFT44kHz16BitMono, + SAFT44kHz16BitStereo, + SAFT48kHz8BitMono, + SAFT48kHz8BitStereo, + SAFT48kHz16BitMono, + SAFT48kHz16BitStereo, + SAFTTrueSpeech_8kHz1BitMono, + SAFTCCITT_ALaw_8kHzMono, + SAFTCCITT_ALaw_8kHzStereo, + SAFTCCITT_ALaw_11kHzMono, + SAFTCCITT_ALaw_11kHzStereo, + SAFTCCITT_ALaw_22kHzMono, + SAFTCCITT_ALaw_22kHzStereo, + SAFTCCITT_ALaw_44kHzMono, + SAFTCCITT_ALaw_44kHzStereo, + SAFTCCITT_uLaw_8kHzMono, + SAFTCCITT_uLaw_8kHzStereo, + SAFTCCITT_uLaw_11kHzMono, + SAFTCCITT_uLaw_11kHzStereo, + SAFTCCITT_uLaw_22kHzMono, + SAFTCCITT_uLaw_22kHzStereo, + SAFTCCITT_uLaw_44kHzMono, + SAFTCCITT_uLaw_44kHzStereo, + SAFTADPCM_8kHzMono, + SAFTADPCM_8kHzStereo, + SAFTADPCM_11kHzMono, + SAFTADPCM_11kHzStereo, + SAFTADPCM_22kHzMono, + SAFTADPCM_22kHzStereo, + SAFTADPCM_44kHzMono, + SAFTADPCM_44kHzStereo, + SAFTGSM610_8kHzMono, + SAFTGSM610_11kHzMono, + SAFTGSM610_22kHzMono, + SAFTGSM610_44kHzMono, + DISPID_SpeechAudioFormat, + DISPID_SAFType, + DISPID_SAFGuid, + DISPID_SAFGetWaveFormatEx, + DISPID_SAFSetWaveFormatEx, + DISPID_SpeechBaseStream, + DISPID_SBSFormat, + DISPID_SBSRead, + DISPID_SBSWrite, + DISPID_SBSSeek, + SpeechStreamSeekPositionType, + SSSPTRelativeToStart, + SSSPTRelativeToCurrentPosition, + SSSPTRelativeToEnd, + DISPID_SpeechAudio, + DISPID_SAStatus, + DISPID_SABufferInfo, + DISPID_SADefaultFormat, + DISPID_SAVolume, + DISPID_SABufferNotifySize, + DISPID_SAEventHandle, + DISPID_SASetState, + SpeechAudioState, + SASClosed, + SASStop, + SASPause, + SASRun, + DISPID_SpeechMMSysAudio, + DISPID_SMSADeviceId, + DISPID_SMSALineId, + DISPID_SMSAMMHandle, + DISPID_SpeechFileStream, + DISPID_SFSOpen, + DISPID_SFSClose, + SpeechStreamFileMode, + SSFMOpenForRead, + SSFMOpenReadWrite, + SSFMCreate, + SSFMCreateForWrite, + DISPID_SpeechCustomStream, + DISPID_SCSBaseStream, + DISPID_SpeechMemoryStream, + DISPID_SMSSetData, + DISPID_SMSGetData, + DISPID_SpeechAudioStatus, + DISPID_SASFreeBufferSpace, + DISPID_SASNonBlockingIO, + DISPID_SASState, + DISPID_SASCurrentSeekPosition, + DISPID_SASCurrentDevicePosition, + DISPID_SpeechAudioBufferInfo, + DISPID_SABIMinNotification, + DISPID_SABIBufferSize, + DISPID_SABIEventBias, + DISPID_SpeechWaveFormatEx, + DISPID_SWFEFormatTag, + DISPID_SWFEChannels, + DISPID_SWFESamplesPerSec, + DISPID_SWFEAvgBytesPerSec, + DISPID_SWFEBlockAlign, + DISPID_SWFEBitsPerSample, + DISPID_SWFEExtraData, + DISPID_SpeechVoice, + DISPID_SVStatus, + DISPID_SVVoice, + DISPID_SVAudioOutput, + DISPID_SVAudioOutputStream, + DISPID_SVRate, + DISPID_SVVolume, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet, + DISPID_SVEventInterests, + DISPID_SVPriority, + DISPID_SVAlertBoundary, + DISPID_SVSyncronousSpeakTimeout, + DISPID_SVSpeak, + DISPID_SVSpeakStream, + DISPID_SVPause, + DISPID_SVResume, + DISPID_SVSkip, + DISPID_SVGetVoices, + DISPID_SVGetAudioOutputs, + DISPID_SVWaitUntilDone, + DISPID_SVSpeakCompleteEvent, + DISPID_SVIsUISupported, + DISPID_SVDisplayUI, + SpeechVoicePriority, + SVPNormal, + SVPAlert, + SVPOver, + SpeechVoiceSpeakFlags, + SVSFDefault, + SVSFlagsAsync, + SVSFPurgeBeforeSpeak, + SVSFIsFilename, + SVSFIsXML, + SVSFIsNotXML, + SVSFPersistXML, + SVSFNLPSpeakPunc, +}; +pub const SVSFParseSapi: SpeechVoiceSpeakFlags = SPF_PARSE_SAPI; +pub const SVSFParseSsml: SpeechVoiceSpeakFlags = SPF_PARSE_SSML; +pub const SVSFParseAutodetect: SpeechVoiceSpeakFlags = SPF_PARSE_AUTODETECT; +pub use um::sapi51::SVSFNLPMask; +pub const SVSFParseMask: SpeechVoiceSpeakFlags = SPF_PARSE_MASK as u32; +pub use um::sapi51::{ + SVSFVoiceMask, + SVSFUnusedFlags, + SpeechVoiceEvents, + SVEStartInputStream, + SVEEndInputStream, + SVEVoiceChange, + SVEBookmark, + SVEWordBoundary, + SVEPhoneme, + SVESentenceBoundary, + SVEViseme, + SVEAudioLevel, + SVEPrivate, + SVEAllEvents, + DISPID_SpeechVoiceStatus, + DISPID_SVSCurrentStreamNumber, + DISPID_SVSLastStreamNumberQueued, + DISPID_SVSLastResult, + DISPID_SVSRunningState, + DISPID_SVSInputWordPosition, + DISPID_SVSInputWordLength, + DISPID_SVSInputSentencePosition, + DISPID_SVSInputSentenceLength, + DISPID_SVSLastBookmark, + DISPID_SVSLastBookmarkId, + DISPID_SVSPhonemeId, + DISPID_SVSVisemeId, + SpeechRunState, + SRSEDone, + SRSEIsSpeaking, + SpeechVisemeType, + SVP_0, + SVP_1, + SVP_2, + SVP_3, + SVP_4, + SVP_5, + SVP_6, + SVP_7, + SVP_8, + SVP_9, + SVP_10, + SVP_11, + SVP_12, + SVP_13, + SVP_14, + SVP_15, + SVP_16, + SVP_17, + SVP_18, + SVP_19, + SVP_20, + SVP_21, + SpeechVisemeFeature, + SVF_None, + SVF_Stressed, + SVF_Emphasis, + DISPID_SpeechVoiceEvent, + DISPID_SVEStreamStart, + DISPID_SVEStreamEnd, + DISPID_SVEVoiceChange, + DISPID_SVEBookmark, + DISPID_SVEWord, + DISPID_SVEPhoneme, + DISPID_SVESentenceBoundary, + DISPID_SVEViseme, + DISPID_SVEAudioLevel, + DISPID_SVEEnginePrivate, + DISPID_SpeechRecognizer, + DISPID_SRRecognizer, + DISPID_SRAllowAudioInputFormatChangesOnNextSet, + DISPID_SRAudioInput, + DISPID_SRAudioInputStream, + DISPID_SRIsShared, + DISPID_SRState, + DISPID_SRStatus, + DISPID_SRProfile, + DISPID_SREmulateRecognition, + DISPID_SRCreateRecoContext, + DISPID_SRGetFormat, + DISPID_SRSetPropertyNumber, + DISPID_SRGetPropertyNumber, + DISPID_SRSetPropertyString, + DISPID_SRGetPropertyString, + DISPID_SRIsUISupported, + DISPID_SRDisplayUI, + DISPID_SRGetRecognizers, + DISPID_SVGetAudioInputs, + DISPID_SVGetProfiles, + SpeechRecognizerState, + SRSInactive, + SRSActive, + SRSActiveAlways, + SRSInactiveWithPurge, + SpeechDisplayAttributes, + SDA_No_Trailing_Space, + SDA_One_Trailing_Space, + SDA_Two_Trailing_Spaces, + SDA_Consume_Leading_Spaces, + SpeechFormatType, + SFTInput, + SFTSREngine, +}; +ENUM!{enum SpeechEmulationCompareFlags { + SECFIgnoreCase = 0x1, + SECFIgnoreKanaType = 0x10000, + SECFIgnoreWidth = 0x20000, + SECFNoSpecialChars = 0x20000000, + SECFEmulateResult = 0x40000000, + SECFDefault = SECFIgnoreCase | SECFIgnoreKanaType | SECFIgnoreWidth, +}} +pub use um::sapi51::{ + DISPID_SpeechRecognizerStatus, + DISPID_SRSAudioStatus, + DISPID_SRSCurrentStreamPosition, + DISPID_SRSCurrentStreamNumber, + DISPID_SRSNumberOfActiveRules, + DISPID_SRSClsidEngine, + DISPID_SRSSupportedLanguages, + DISPID_SpeechRecoContext, + DISPID_SRCRecognizer, + DISPID_SRCAudioInInterferenceStatus, + DISPID_SRCRequestedUIType, + DISPID_SRCVoice, + DISPID_SRAllowVoiceFormatMatchingOnNextSet, + DISPID_SRCVoicePurgeEvent, + DISPID_SRCEventInterests, + DISPID_SRCCmdMaxAlternates, + DISPID_SRCState, + DISPID_SRCRetainedAudio, + DISPID_SRCRetainedAudioFormat, + DISPID_SRCPause, + DISPID_SRCResume, + DISPID_SRCCreateGrammar, + DISPID_SRCCreateResultFromMemory, + DISPID_SRCBookmark, + DISPID_SRCSetAdaptationData, + SpeechRetainedAudioOptions, + SRAONone, + SRAORetainAudio, + SpeechBookmarkOptions, + SBONone, + SBOPause, + SpeechInterference, + SINone, + SINoise, + SINoSignal, + SITooLoud, + SITooQuiet, + SITooFast, + SITooSlow, + SpeechRecoEvents, + SREStreamEnd, + SRESoundStart, + SRESoundEnd, + SREPhraseStart, + SRERecognition, + SREHypothesis, + SREBookmark, + SREPropertyNumChange, + SREPropertyStringChange, + SREFalseRecognition, + SREInterference, + SRERequestUI, + SREStateChange, + SREAdaptation, + SREStreamStart, + SRERecoOtherContext, + SREAudioLevel, + SREPrivate, + SREAllEvents, + SpeechRecoContextState, + SRCS_Disabled, + SRCS_Enabled, + DISPIDSPRG, + DISPID_SRGId, + DISPID_SRGRecoContext, + DISPID_SRGState, + DISPID_SRGRules, + DISPID_SRGReset, + DISPID_SRGCommit, + DISPID_SRGCmdLoadFromFile, + DISPID_SRGCmdLoadFromObject, + DISPID_SRGCmdLoadFromResource, + DISPID_SRGCmdLoadFromMemory, + DISPID_SRGCmdLoadFromProprietaryGrammar, + DISPID_SRGCmdSetRuleState, + DISPID_SRGCmdSetRuleIdState, + DISPID_SRGDictationLoad, + DISPID_SRGDictationUnload, + DISPID_SRGDictationSetState, + DISPID_SRGSetWordSequenceData, + DISPID_SRGSetTextSelection, + DISPID_SRGIsPronounceable, + SpeechLoadOption, + SLOStatic, + SLODynamic, + SpeechWordPronounceable, + SWPUnknownWordUnpronounceable, + SWPUnknownWordPronounceable, + SWPKnownWordPronounceable, + SpeechGrammarState, + SGSEnabled, + SGSDisabled, + SGSExclusive, + SpeechRuleState, + SGDSInactive, + SGDSActive, + SGDSActiveWithAutoPause, +}; +pub const SGDSActiveUserDelimited: SpeechRuleState = SPRS_ACTIVE_USER_DELIMITED; +pub use um::sapi51::{ + SpeechRuleAttributes, + SRATopLevel, + SRADefaultToActive, + SRAExport, + SRAImport, + SRAInterpreter, + SRADynamic, +}; +pub const SRARoot: SpeechRuleAttributes = SPRAF_Root; +pub use um::sapi51::{ + SpeechGrammarWordType, + SGDisplay, + SGLexical, + SGPronounciation, +}; +pub const SGLexicalNoSpecialChars: SpeechGrammarWordType = SPWT_LEXICAL_NO_SPECIAL_CHARS; +pub use um::sapi51::{ + DISPID_SpeechRecoContextEvents, + DISPID_SRCEStartStream, + DISPID_SRCEEndStream, + DISPID_SRCEBookmark, + DISPID_SRCESoundStart, + DISPID_SRCESoundEnd, + DISPID_SRCEPhraseStart, + DISPID_SRCERecognition, + DISPID_SRCEHypothesis, + DISPID_SRCEPropertyNumberChange, + DISPID_SRCEPropertyStringChange, + DISPID_SRCEFalseRecognition, + DISPID_SRCEInterference, + DISPID_SRCERequestUI, + DISPID_SRCERecognizerStateChange, + DISPID_SRCEAdaptation, + DISPID_SRCERecognitionForOtherContext, + DISPID_SRCEAudioLevel, + DISPID_SRCEEnginePrivate, + SpeechRecognitionType, + SRTStandard, + SRTAutopause, + SRTEmulated, +}; +pub const SRTSMLTimeout: SpeechRecognitionType = SPREF_SMLTimeout; +pub const SRTExtendableParse: SpeechRecognitionType = SPREF_ExtendableParse; +pub const SRTReSent: SpeechRecognitionType = SPREF_ReSent; +pub use um::sapi51::{ + DISPID_SpeechGrammarRule, + DISPID_SGRAttributes, + DISPID_SGRInitialState, + DISPID_SGRName, + DISPID_SGRId, + DISPID_SGRClear, + DISPID_SGRAddResource, + DISPID_SGRAddState, + DISPID_SpeechGrammarRules, + DISPID_SGRsCount, + DISPID_SGRsDynamic, + DISPID_SGRsAdd, + DISPID_SGRsCommit, + DISPID_SGRsCommitAndSave, + DISPID_SGRsFindRule, + DISPID_SGRsItem, + DISPID_SGRs_NewEnum, + DISPID_SpeechGrammarRuleState, + DISPID_SGRSRule, + DISPID_SGRSTransitions, + DISPID_SGRSAddWordTransition, + DISPID_SGRSAddRuleTransition, + DISPID_SGRSAddSpecialTransition, + SpeechSpecialTransitionType, + SSTTWildcard, + SSTTDictation, + SSTTTextBuffer, + DISPID_SpeechGrammarRuleStateTransitions, + DISPID_SGRSTsCount, + DISPID_SGRSTsItem, + DISPID_SGRSTs_NewEnum, + DISPID_SpeechGrammarRuleStateTransition, + DISPID_SGRSTType, + DISPID_SGRSTText, + DISPID_SGRSTRule, + DISPID_SGRSTWeight, + DISPID_SGRSTPropertyName, + DISPID_SGRSTPropertyId, + DISPID_SGRSTPropertyValue, + DISPID_SGRSTNextState, + SpeechGrammarRuleStateTransitionType, + SGRSTTEpsilon, + SGRSTTWord, + SGRSTTRule, + SGRSTTDictation, + SGRSTTWildcard, + SGRSTTTextBuffer, + DISPIDSPTSI, + DISPIDSPTSI_ActiveOffset, + DISPIDSPTSI_ActiveLength, + DISPIDSPTSI_SelectionOffset, + DISPIDSPTSI_SelectionLength, + DISPID_SpeechRecoResult, + DISPID_SRRRecoContext, + DISPID_SRRTimes, + DISPID_SRRAudioFormat, + DISPID_SRRPhraseInfo, + DISPID_SRRAlternates, + DISPID_SRRAudio, + DISPID_SRRSpeakAudio, + DISPID_SRRSaveToMemory, + DISPID_SRRDiscardResultInfo, + SpeechDiscardType, + SDTProperty, + SDTReplacement, + SDTRule, + SDTDisplayText, + SDTLexicalForm, + SDTPronunciation, + SDTAudio, + SDTAlternates, + SDTAll, +}; +ENUM!{enum DISPID_SpeechXMLRecoResult { + DISPID_SRRGetXMLResult, + DISPID_SRRGetXMLErrorInfo, +}} +ENUM!{enum DISPID_SpeechRecoResult2 { + DISPID_SRRSetTextFeedback, +}} +pub use um::sapi51::{ + DISPID_SpeechPhraseBuilder, + DISPID_SPPBRestorePhraseFromMemory, + DISPID_SpeechRecoResultTimes, + DISPID_SRRTStreamTime, + DISPID_SRRTLength, + DISPID_SRRTTickCount, + DISPID_SRRTOffsetFromStart, + DISPID_SpeechPhraseAlternate, + DISPID_SPARecoResult, + DISPID_SPAStartElementInResult, + DISPID_SPANumberOfElementsInResult, + DISPID_SPAPhraseInfo, + DISPID_SPACommit, + DISPID_SpeechPhraseAlternates, + DISPID_SPAsCount, + DISPID_SPAsItem, + DISPID_SPAs_NewEnum, + DISPID_SpeechPhraseInfo, + DISPID_SPILanguageId, + DISPID_SPIGrammarId, + DISPID_SPIStartTime, + DISPID_SPIAudioStreamPosition, + DISPID_SPIAudioSizeBytes, + DISPID_SPIRetainedSizeBytes, + DISPID_SPIAudioSizeTime, + DISPID_SPIRule, + DISPID_SPIProperties, + DISPID_SPIElements, + DISPID_SPIReplacements, + DISPID_SPIEngineId, + DISPID_SPIEnginePrivateData, + DISPID_SPISaveToMemory, + DISPID_SPIGetText, + DISPID_SPIGetDisplayAttributes, + DISPID_SpeechPhraseElement, + DISPID_SPEAudioTimeOffset, + DISPID_SPEAudioSizeTime, + DISPID_SPEAudioStreamOffset, + DISPID_SPEAudioSizeBytes, + DISPID_SPERetainedStreamOffset, + DISPID_SPERetainedSizeBytes, + DISPID_SPEDisplayText, + DISPID_SPELexicalForm, + DISPID_SPEPronunciation, + DISPID_SPEDisplayAttributes, + DISPID_SPERequiredConfidence, + DISPID_SPEActualConfidence, + DISPID_SPEEngineConfidence, + SpeechEngineConfidence, + SECLowConfidence, + SECNormalConfidence, + SECHighConfidence, + DISPID_SpeechPhraseElements, + DISPID_SPEsCount, + DISPID_SPEsItem, + DISPID_SPEs_NewEnum, + DISPID_SpeechPhraseReplacement, + DISPID_SPRDisplayAttributes, + DISPID_SPRText, + DISPID_SPRFirstElement, + DISPID_SPRNumberOfElements, + DISPID_SpeechPhraseReplacements, + DISPID_SPRsCount, + DISPID_SPRsItem, + DISPID_SPRs_NewEnum, + DISPID_SpeechPhraseProperty, + DISPID_SPPName, + DISPID_SPPId, + DISPID_SPPValue, + DISPID_SPPFirstElement, + DISPID_SPPNumberOfElements, + DISPID_SPPEngineConfidence, + DISPID_SPPConfidence, + DISPID_SPPParent, + DISPID_SPPChildren, + DISPID_SpeechPhraseProperties, + DISPID_SPPsCount, + DISPID_SPPsItem, + DISPID_SPPs_NewEnum, + DISPID_SpeechPhraseRule, + DISPID_SPRuleName, + DISPID_SPRuleId, + DISPID_SPRuleFirstElement, + DISPID_SPRuleNumberOfElements, + DISPID_SPRuleParent, + DISPID_SPRuleChildren, + DISPID_SPRuleConfidence, + DISPID_SPRuleEngineConfidence, + DISPID_SpeechPhraseRules, + DISPID_SPRulesCount, + DISPID_SPRulesItem, + DISPID_SPRules_NewEnum, + DISPID_SpeechLexicon, + DISPID_SLGenerationId, + DISPID_SLGetWords, + DISPID_SLAddPronunciation, + DISPID_SLAddPronunciationByPhoneIds, + DISPID_SLRemovePronunciation, + DISPID_SLRemovePronunciationByPhoneIds, + DISPID_SLGetPronunciations, + DISPID_SLGetGenerationChange, + SpeechLexiconType, + SLTUser, + SLTApp, + SpeechPartOfSpeech, + SPSNotOverriden, + SPSUnknown, + SPSNoun, + SPSVerb, + SPSModifier, + SPSFunction, + SPSInterjection, +}; +pub const SPSLMA: SpeechPartOfSpeech = SPPS_LMA; +pub const SPSSuppressWord: SpeechPartOfSpeech = SPPS_SuppressWord; +pub use um::sapi51::{ + DISPID_SpeechLexiconWords, + DISPID_SLWsCount, + DISPID_SLWsItem, + DISPID_SLWs_NewEnum, + SpeechWordType, + SWTAdded, + SWTDeleted, + DISPID_SpeechLexiconWord, + DISPID_SLWLangId, + DISPID_SLWType, + DISPID_SLWWord, + DISPID_SLWPronunciations, + DISPID_SpeechLexiconProns, + DISPID_SLPsCount, + DISPID_SLPsItem, + DISPID_SLPs_NewEnum, + DISPID_SpeechLexiconPronunciation, + DISPID_SLPType, + DISPID_SLPLangId, + DISPID_SLPPartOfSpeech, + DISPID_SLPPhoneIds, + DISPID_SLPSymbolic, + DISPID_SpeechPhoneConverter, + DISPID_SPCLangId, + DISPID_SPCPhoneToId, + DISPID_SPCIdToPhone, + LIBID_SpeechLib, + ISpeechDataKey, ISpeechDataKeyVtbl, + ISpeechObjectToken, ISpeechObjectTokenVtbl, + ISpeechObjectTokens, ISpeechObjectTokensVtbl, + ISpeechObjectTokenCategory, ISpeechObjectTokenCategoryVtbl, + ISpeechAudioBufferInfo, ISpeechAudioBufferInfoVtbl, + ISpeechAudioStatus, ISpeechAudioStatusVtbl, + ISpeechAudioFormat, ISpeechAudioFormatVtbl, + ISpeechWaveFormatEx, ISpeechWaveFormatExVtbl, + ISpeechBaseStream, ISpeechBaseStreamVtbl, + ISpeechFileStream, ISpeechFileStreamVtbl, + ISpeechMemoryStream, ISpeechMemoryStreamVtbl, + ISpeechCustomStream, ISpeechCustomStreamVtbl, + ISpeechAudio, ISpeechAudioVtbl, + ISpeechMMSysAudio, ISpeechMMSysAudioVtbl, + ISpeechVoice, ISpeechVoiceVtbl, + ISpeechVoiceStatus, ISpeechVoiceStatusVtbl, + _ISpeechVoiceEvents, _ISpeechVoiceEventsVtbl, + ISpeechRecognizer, ISpeechRecognizerVtbl, + ISpeechRecognizerStatus, ISpeechRecognizerStatusVtbl, + ISpeechRecoContext, ISpeechRecoContextVtbl, + ISpeechRecoGrammar, ISpeechRecoGrammarVtbl, + _ISpeechRecoContextEvents, _ISpeechRecoContextEventsVtbl, + ISpeechGrammarRule, ISpeechGrammarRuleVtbl, + ISpeechGrammarRules, ISpeechGrammarRulesVtbl, + ISpeechGrammarRuleState, ISpeechGrammarRuleStateVtbl, + ISpeechGrammarRuleStateTransition, ISpeechGrammarRuleStateTransitionVtbl, + ISpeechGrammarRuleStateTransitions, ISpeechGrammarRuleStateTransitionsVtbl, + ISpeechTextSelectionInformation, ISpeechTextSelectionInformationVtbl, + ISpeechRecoResult, ISpeechRecoResultVtbl, +}; +RIDL!(#[uuid(0x8e0a246d, 0xd3c8, 0x45de, 0x86, 0x57, 0x04, 0x29, 0x0c, 0x45, 0x8c, 0x3c)] +interface ISpeechRecoResult2(ISpeechRecoResult2Vtbl): ISpeechRecoResult(ISpeechRecoResultVtbl) { + fn SetTextFeedback( + Feedback: BSTR, + WasSuccessful: VARIANT_BOOL, + ) -> HRESULT, +}); +pub use um::sapi51::{ + ISpeechRecoResultTimes, ISpeechRecoResultTimesVtbl, + ISpeechPhraseAlternate, ISpeechPhraseAlternateVtbl, + ISpeechPhraseAlternates, ISpeechPhraseAlternatesVtbl, + ISpeechPhraseInfo, ISpeechPhraseInfoVtbl, + ISpeechPhraseElement, ISpeechPhraseElementVtbl, + ISpeechPhraseElements, ISpeechPhraseElementsVtbl, + ISpeechPhraseReplacement, ISpeechPhraseReplacementVtbl, + ISpeechPhraseReplacements, ISpeechPhraseReplacementsVtbl, + ISpeechPhraseProperty, ISpeechPhrasePropertyVtbl, + ISpeechPhraseProperties, ISpeechPhrasePropertiesVtbl, + ISpeechPhraseRule, ISpeechPhraseRuleVtbl, + ISpeechPhraseRules, ISpeechPhraseRulesVtbl, + ISpeechLexicon, ISpeechLexiconVtbl, + ISpeechLexiconWords, ISpeechLexiconWordsVtbl, + ISpeechLexiconWord, ISpeechLexiconWordVtbl, + ISpeechLexiconPronunciations, ISpeechLexiconPronunciationsVtbl, + ISpeechLexiconPronunciation, ISpeechLexiconPronunciationVtbl, + Speech_Default_Weight, + Speech_Max_Word_Length, + Speech_Max_Pron_Length, + Speech_StreamPos_Asap, + Speech_StreamPos_RealTime, + SpeechAllElements, +}; +RIDL!(#[uuid(0xaaec54af, 0x8f85, 0x4924, 0x94, 0x4d, 0xb7, 0x9d, 0x39, 0xd7, 0x2e, 0x19)] +interface ISpeechXMLRecoResult(ISpeechXMLRecoResultVtbl): + ISpeechRecoResult(ISpeechRecoResultVtbl) { + fn GetXMLResult( + Options: SPXMLRESULTOPTIONS, + pResult: *mut BSTR, + ) -> HRESULT, + fn GetXMLErrorInfo( + LineNumber: *mut c_long, + ScriptLine: *mut BSTR, + Source: *mut BSTR, + Description: *mut BSTR, + ResultCode: *mut c_long, + IsError: *mut VARIANT_BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x6d60eb64, 0xaced, 0x40a6, 0xbb, 0xf3, 0x4e, 0x55, 0x7f, 0x71, 0xde, 0xe2)] +interface ISpeechRecoResultDispatch(ISpeechRecoResultDispatchVtbl): IDispatch(IDispatchVtbl) { + fn get_RecoContext( + RecoContext: *mut ISpeechRecoContext, + ) -> HRESULT, + fn get_Times( + Times: *mut ISpeechRecoResultTimes, + ) -> HRESULT, + fn putref_AudioFormat( + Format: *mut ISpeechAudioFormat, + ) -> HRESULT, + fn get_AudioFormat( + Format: *mut *mut ISpeechAudioFormat, + ) -> HRESULT, + fn get_PhraseInfo( + PhraseInfo: *mut *mut ISpeechPhraseInfo, + ) -> HRESULT, + fn Alternates( + RequestCount: c_long, + StartElement: c_long, + Elements: c_long, + Alternates: *mut *mut ISpeechPhraseAlternates, + ) -> HRESULT, + fn Audio( + StartElement: c_long, + Elements: c_long, + Stream: *mut *mut ISpeechMemoryStream, + ) -> HRESULT, + fn SpeakAudio( + StartElement: c_long, + Elements: c_long, + Flags: SpeechVoiceSpeakFlags, + StreamNumber: *mut c_long, + ) -> HRESULT, + fn SaveToMemory( + ResultBlock: *mut VARIANT, + ) -> HRESULT, + fn DiscardResultInfo( + ValueTypes: SpeechDiscardType, + ) -> HRESULT, + fn GetXMLResult( + Options: SPXMLRESULTOPTIONS, + pResult: *mut BSTR, + ) -> HRESULT, + fn GetXMLErrorInfo( + LineNumber: *mut c_long, + ScriptLine: *mut BSTR, + Source: *mut BSTR, + Description: *mut BSTR, + ResultCode: *mut HRESULT, + IsError: *mut VARIANT_BOOL, + ) -> HRESULT, + fn SetTextFeedback( + Feedback: BSTR, + WasSuccessful: VARIANT_BOOL, + ) -> HRESULT, +}); +pub use um::sapi51::{ + ISpeechPhraseInfoBuilder, ISpeechPhraseInfoBuilderVtbl, + ISpeechPhoneConverter, ISpeechPhoneConverterVtbl, + CLSID_SpNotifyTranslator, + CLSID_SpObjectTokenCategory, + CLSID_SpObjectToken, + CLSID_SpResourceManager, + CLSID_SpStreamFormatConverter, + CLSID_SpMMAudioEnum, + CLSID_SpMMAudioIn, + CLSID_SpMMAudioOut, + CLSID_SpStream, + CLSID_SpVoice, + CLSID_SpSharedRecoContext, + CLSID_SpInprocRecognizer, + CLSID_SpSharedRecognizer, + CLSID_SpLexicon, + CLSID_SpUnCompressedLexicon, + CLSID_SpCompressedLexicon, +}; +extern { + pub static CLSID_SpShortcut: CLSID; +} +pub use um::sapi51::CLSID_SpPhoneConverter; +extern { + pub static CLSID_SpPhoneticAlphabetConverter: CLSID; +} +pub use um::sapi51::{ + CLSID_SpNullPhoneConverter, + CLSID_SpTextSelectionInformation, + CLSID_SpPhraseInfoBuilder, + CLSID_SpAudioFormat, + CLSID_SpWaveFormatEx, + CLSID_SpInProcRecoContext, + CLSID_SpCustomStream, + CLSID_SpFileStream, + CLSID_SpMemoryStream, +}; diff --git a/src/vendor/winapi/src/um/sapiddk.rs b/src/vendor/winapi/src/um/sapiddk.rs new file mode 100644 index 0000000000..067c265bae --- /dev/null +++ b/src/vendor/winapi/src/um/sapiddk.rs @@ -0,0 +1,239 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_float, c_int, c_void}; +use shared::guiddef::CLSID; +use shared::minwindef::{BOOL, DWORD, ULONG}; +use um::sapi::*; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCWSTR, ULONGLONG, WCHAR}; +pub use um::sapiddk51::{ + SPRECOEXTENSION, + SPALTERNATESCLSID, +}; +pub const SR_LOCALIZED_DESCRIPTION: &'static str = "Description"; +pub use um::sapiddk51::{ + ISpTokenUI, ISpTokenUIVtbl, + ISpObjectTokenEnumBuilder, ISpObjectTokenEnumBuilderVtbl, + SPWORDHANDLE, + SPRULEHANDLE, + SPGRAMMARHANDLE, + SPRECOCONTEXTHANDLE, + SPPHRASERULEHANDLE, + SPPHRASEPROPERTYHANDLE, + SPTRANSITIONID, + ISpErrorLog, ISpErrorLogVtbl, + ISpGrammarCompiler, ISpGrammarCompilerVtbl, + ISpGramCompBackend, ISpGramCompBackendVtbl, + ISpITNProcessor, ISpITNProcessorVtbl, + ISpPhraseBuilder, ISpPhraseBuilderVtbl, + ISpTask, + ISpThreadTask, + ISpThreadControl, ISpThreadControlVtbl, + SPTMTHREADINFO, + ISpTaskManager, ISpTaskManagerVtbl, + SPVSKIPTYPE, + SPVST_SENTENCE, + SPVESACTIONS, + SPVES_CONTINUE, + SPVES_ABORT, + SPVES_SKIP, + SPVES_RATE, + SPVES_VOLUME, + ISpTTSEngineSite, ISpTTSEngineSiteVtbl, + SPVTEXTFRAG, + ISpTTSEngine, ISpTTSEngineVtbl, + SPWORDENTRY, + SPRULEENTRY, + SPTRANSITIONTYPE, + SPTRANSEPSILON, + SPTRANSWORD, + SPTRANSRULE, + SPTRANSTEXTBUF, + SPTRANSWILDCARD, + SPTRANSDICTATION, + SPTRANSITIONENTRY, + SPTRANSITIONPROPERTY, + SPSTATEINFO, + SPPATHENTRY, + ISpCFGInterpreterSite, ISpCFGInterpreterSiteVtbl, + ISpCFGInterpreter, ISpCFGInterpreterVtbl, + SPCFGNOTIFY, + SPCFGN_ADD, + SPCFGN_REMOVE, + SPCFGN_INVALIDATE, + SPCFGN_ACTIVATE, + SPCFGN_DEACTIVATE, + SPRESULTTYPE, + SPRT_CFG, + SPRT_SLM, + SPRT_PROPRIETARY, + SPRT_FALSE_RECOGNITION, +}; +pub const SPRT_TYPE_MASK: SPRESULTTYPE = 3; +pub const SPRT_EMULATED: SPRESULTTYPE = 1 << 3; +pub const SPRT_EXTENDABLE_PARSE: SPRESULTTYPE = 1 << 4; +pub use um::sapiddk51::{ + SPPHRASEALT, + SPRECORESULTINFO, +}; +STRUCT!{struct SPRECORESULTINFOEX { + cbSize: ULONG, + eResultType: SPRESULTTYPE, + fHypothesis: BOOL, + fProprietaryAutoPause: BOOL, + ullStreamPosStart: ULONGLONG, + ullStreamPosEnd: ULONGLONG, + hGrammar: SPGRAMMARHANDLE, + ulSizeEngineData: ULONG, + pvEngineData: *mut c_void, + pPhrase: *mut ISpPhraseBuilder, + aPhraseAlts: *mut SPPHRASEALT, + ulNumAlts: ULONG, + ullStreamTimeStart: ULONGLONG, + ullStreamTimeEnd: ULONGLONG, +}} +pub use um::sapiddk51::{ + SPWORDINFOOPT, + SPWIO_NONE, + SPWIO_WANT_TEXT, + SPRULEINFOOPT, + SPRIO_NONE, + SPPARSEINFO, + ISpSREngineSite, ISpSREngineSiteVtbl, +}; +RIDL!(#[uuid(0x7bc6e012, 0x684a, 0x493e, 0xbd, 0xd4, 0x2b, 0xf5, 0xfb, 0xf4, 0x8c, 0xfe)] +interface ISpSREngineSite2(ISpSREngineSite2Vtbl): ISpSREngineSite(ISpSREngineSiteVtbl) { + fn AddEventEx( + pEvent: *const SPEVENTEX, + hSAPIRecoContext: SPRECOCONTEXTHANDLE, + ) -> HRESULT, + fn UpdateRecoPosEx( + ullCurrentRecoPos: ULONGLONG, + ullCurrentRecoTime: ULONGLONG, + ) -> HRESULT, + fn GetRuleTransition( + ulGrammarID: ULONG, + RuleIndex: ULONG, + pTrans: *mut SPTRANSITIONENTRY, + ) -> HRESULT, + fn RecognitionEx( + pResultInfo: *const SPRECORESULTINFOEX, + ) -> HRESULT, +}); +pub use um::sapiddk51::{ + SPPROPSRC, + SPPROPSRC_RECO_INST, + SPPROPSRC_RECO_CTX, + SPPROPSRC_RECO_GRAMMAR, + ISpSREngine, ISpSREngineVtbl, +}; +RIDL!(#[uuid(0x7ba627d8, 0x33f9, 0x4375, 0x90, 0xc5, 0x99, 0x85, 0xae, 0xe5, 0xed, 0xe5)] +interface ISpSREngine2(ISpSREngine2Vtbl): ISpSREngine(ISpSREngineVtbl) { + fn PrivateCallImmediate( + pvEngineContext: *mut c_void, + pInCallFrame: *const c_void, + ulInCallFrameSize: ULONG, + ppvCoMemResponse: *mut *mut c_void, + pulResponseSize: *mut ULONG, + ) -> HRESULT, + fn SetAdaptationData2( + pvEngineContext: *mut c_void, + pAdaptationData: *const WCHAR, + cch: ULONG, + pTopicName: LPCWSTR, + eSettings: SPADAPTATIONSETTINGS, + eRelevance: SPADAPTATIONRELEVANCE, + ) -> HRESULT, + fn SetGrammarPrefix( + pvEngineGrammar: *mut c_void, + pszPrefix: LPCWSTR, + fIsPrefixRequired: BOOL, + ) -> HRESULT, + fn SetRulePriority( + hRule: SPRULEHANDLE, + pvClientRuleContext: *mut c_void, + nRulePriority: c_int, + ) -> HRESULT, + fn EmulateRecognition( + pPhrase: *mut ISpPhrase, + dwCompareFlags: DWORD, + ) -> HRESULT, + fn SetSLMWeight( + pvEngineGrammar: *mut c_void, + flWeight: c_float, + ) -> HRESULT, + fn SetRuleWeight( + hRule: SPRULEHANDLE, + pvClientRuleContext: *mut c_void, + flWeight: c_float, + ) -> HRESULT, + fn SetTrainingState( + fDoingTraining: BOOL, + fAdaptFromTrainingData: BOOL, + ) -> HRESULT, + fn ResetAcousticModelAdaptation() -> HRESULT, + fn OnLoadCFG( + pvEngineGrammar: *mut c_void, + pvGrammarData: *const SPBINARYGRAMMAR, + ulGrammarID: ULONG, + ) -> HRESULT, + fn OnUnloadCFG( + pvEngineGrammar: *mut c_void, + ulGrammarID: ULONG, + ) -> HRESULT, +}); +pub use um::sapiddk51::SPPHRASEALTREQUEST; +RIDL!(#[uuid(0xfece8294, 0x2be1, 0x408f, 0x8e, 0x68, 0x2d, 0xe3, 0x77, 0x09, 0x2f, 0x0e)] +interface ISpSRAlternates(ISpSRAlternatesVtbl): IUnknown(IUnknownVtbl) { + fn GetAlternates( + pAltRequest: *mut SPPHRASEALTREQUEST, + ppAlts: *mut *mut SPPHRASEALT, + pcAlts: *mut ULONG, + ) -> HRESULT, + fn Commit( + pAltRequest: *mut SPPHRASEALTREQUEST, + pAlt: *mut SPPHRASEALT, + ppvResultExtra: *mut c_void, + pcbResultExtra: *mut ULONG, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xf338f437, 0xcb33, 0x4020, 0x9c, 0xab, 0xc7, 0x1f, 0xf9, 0xce, 0x12, 0xd3)] +interface ISpSRAlternates2(ISpSRAlternates2Vtbl): ISpSRAlternates(ISpSRAlternatesVtbl) { + fn CommitText( + pAltRequest: *mut SPPHRASEALTREQUEST, + pcszNewText: LPCWSTR, + commitFlags: SPCOMMITFLAGS, + ) -> HRESULT, +}); +pub use um::sapiddk51::{_ISpPrivateEngineCall, _ISpPrivateEngineCallVtbl}; +RIDL!(#[uuid(0xdefd682a, 0xfe0a, 0x42b9, 0xbf, 0xa1, 0x56, 0xd3, 0xd6, 0xce, 0xcf, 0xaf)] +interface ISpPrivateEngineCallEx(ISpPrivateEngineCallExVtbl): IUnknown(IUnknownVtbl) { + fn CallEngineSynchronize( + pInFrame: *const c_void, + ulInFrameSize: ULONG, + ppCoMemOutFrame: *mut *mut c_void, + pulOutFrameSize: *mut ULONG, + ) -> HRESULT, + fn CallEngineImmediate( + pInFrame: *const c_void, + ulInFrameSize: ULONG, + ppCoMemOutFrame: *mut *mut c_void, + pulOutFrameSize: *mut ULONG, + ) -> HRESULT, +}); +pub use um::sapiddk51::{ + LIBID_SpeechDDKLib, + CLSID_SpDataKey, + CLSID_SpObjectTokenEnum, + CLSID_SpPhraseBuilder, + CLSID_SpITNProcessor, + CLSID_SpGrammarCompiler, +}; +extern { + pub static CLSID_SpW3CGrammarCompiler: CLSID; +} +pub use um::sapiddk51::CLSID_SpGramCompBackend; diff --git a/src/vendor/winapi/src/um/sapiddk51.rs b/src/vendor/winapi/src/um/sapiddk51.rs new file mode 100644 index 0000000000..6fcd2f92c7 --- /dev/null +++ b/src/vendor/winapi/src/um/sapiddk51.rs @@ -0,0 +1,648 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_char, c_float, c_long, c_void}; +use shared::guiddef::{CLSID, GUID, IID, REFGUID}; +use shared::minwindef::{BOOL, BYTE, DWORD, ULONG, USHORT, WORD}; +use shared::mmreg::WAVEFORMATEX; +use shared::windef::HWND; +use um::oaidl::VARIANT; +use um::objidlbase::IStream; +use um::sapi::*; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, HRESULT, LONG, LPCWSTR, LPWSTR, PVOID, ULONGLONG, WCHAR}; +pub const SPRECOEXTENSION: &'static str = "RecoExtension"; +pub const SPALTERNATESCLSID: &'static str = "AlternatesCLSID"; +RIDL!(#[uuid(0xf8e690f0, 0x39cb, 0x4843, 0xb8, 0xd7, 0xc8, 0x46, 0x96, 0xe1, 0x11, 0x9d)] +interface ISpTokenUI(ISpTokenUIVtbl): IUnknown(IUnknownVtbl) { + fn IsUISupported( + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + punkObject: *mut IUnknown, + pfSupported: *mut BOOL, + ) -> HRESULT, + fn DisplayUI( + hwndParent: HWND, + pszTitle: LPCWSTR, + pszTypeOfUI: LPCWSTR, + pvExtraData: *mut c_void, + cbExtraData: ULONG, + pToken: *mut ISpObjectToken, + punkObject: *mut IUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x06b64f9f, 0x7fda, 0x11d2, 0xb4, 0xf2, 0x00, 0xc0, 0x4f, 0x79, 0x73, 0x96)] +interface ISpObjectTokenEnumBuilder(ISpObjectTokenEnumBuilderVtbl): + IEnumSpObjectTokens(IEnumSpObjectTokensVtbl) { + fn SetAttribs( + pszReqAttribs: LPCWSTR, + pszOptAttribs: LPCWSTR, + ) -> HRESULT, + fn AddTokens( + cTokens: ULONG, + pToken: *mut *mut ISpObjectToken, + ) -> HRESULT, + fn AddTokensFromDataKey( + pDataKey: *mut ISpDataKey, + pszSubKey: LPCWSTR, + pszCategoryId: LPCWSTR, + ) -> HRESULT, + fn AddTokensFromTokenEnum( + pTokenEnum: *mut IEnumSpObjectTokens, + ) -> HRESULT, + fn Sort( + pszTokenIdToListFirst: LPCWSTR, + ) -> HRESULT, +}); +DECLARE_HANDLE!(SPWORDHANDLE, SPWORDHANDLE__); +DECLARE_HANDLE!(SPRULEHANDLE, SPRULEHANDLE__); +DECLARE_HANDLE!(SPGRAMMARHANDLE, SPGRAMMARHANDLE__); +DECLARE_HANDLE!(SPRECOCONTEXTHANDLE, SPRECOCONTEXTHANDLE__); +DECLARE_HANDLE!(SPPHRASERULEHANDLE, SPPHRASERULEHANDLE__); +DECLARE_HANDLE!(SPPHRASEPROPERTYHANDLE, SPPHRASEPROPERTYHANDLE__); +DECLARE_HANDLE!(SPTRANSITIONID, SPTRANSITIONID__); +RIDL!(#[uuid(0xf4711347, 0xe608, 0x11d2, 0xa0, 0x86, 0x00, 0xc0, 0x4f, 0x8e, 0xf9, 0xb5)] +interface ISpErrorLog(ISpErrorLogVtbl): IUnknown(IUnknownVtbl) { + fn AddError( + lLineNumber: c_long, + hr: HRESULT, + pszDescription: LPCWSTR, + pszHelpFile: LPCWSTR, + dwHelpContext: DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xb1e29d58, 0xa675, 0x11d2, 0x83, 0x02, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0xc0)] +interface ISpGrammarCompiler(ISpGrammarCompilerVtbl): IUnknown(IUnknownVtbl) { + fn CompileStream( + pSource: *mut IStream, + pDest: *mut IStream, + pHeader: *mut IStream, + pReserved: *mut IUnknown, + pErrorLog: *mut ISpErrorLog, + dwFlags: DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3ddca27c, 0x665c, 0x4786, 0x9f, 0x97, 0x8c, 0x90, 0xc3, 0x48, 0x8b, 0x61)] +interface ISpGramCompBackend(ISpGramCompBackendVtbl): ISpGrammarBuilder(ISpGrammarBuilderVtbl) { + fn SetSaveObjects( + pStream: *mut IStream, + pErrorLog: *mut ISpErrorLog, + ) -> HRESULT, + fn InitFromBinaryGrammar( + pBinaryData: *const SPBINARYGRAMMAR, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x12d7360f, 0xa1c9, 0x11d3, 0xbc, 0x90, 0x00, 0xc0, 0x4f, 0x72, 0xdf, 0x9f)] +interface ISpITNProcessor(ISpITNProcessorVtbl): IUnknown(IUnknownVtbl) { + fn LoadITNGrammar( + pszCLSID: LPWSTR, + ) -> HRESULT, + fn ITNPhrase( + pPhrase: *mut ISpPhraseBuilder, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x88a3342a, 0x0bed, 0x4834, 0x92, 0x2b, 0x88, 0xd4, 0x31, 0x73, 0x16, 0x2f)] +interface ISpPhraseBuilder(ISpPhraseBuilderVtbl): ISpPhrase(ISpPhraseVtbl) { + fn InitFromPhrase( + pPhrase: *const SPPHRASE, + ) -> HRESULT, + fn InitFromSerializedPhrase( + pPhrase: *const SPSERIALIZEDPHRASE, + ) -> HRESULT, + fn AddElements( + cElements: ULONG, + pElement: *const SPPHRASEELEMENT, + ) -> HRESULT, + fn AddRules( + hParent: SPPHRASERULEHANDLE, + pRule: *const SPPHRASERULE, + phNewRule: *mut SPPHRASERULEHANDLE, + ) -> HRESULT, + fn AddProperties( + hParent: SPPHRASEPROPERTYHANDLE, + pProperty: *const SPPHRASEPROPERTY, + phNewProperty: *mut SPPHRASEPROPERTYHANDLE, + ) -> HRESULT, + fn AddReplacements( + cReplacements: ULONG, + pReplacements: *const SPPHRASEREPLACEMENT, + ) -> HRESULT, +}); +pub type ISpTask = *mut c_void; +pub type ISpThreadTask = *mut c_void; +RIDL!(#[uuid(0xa6be4d73, 0x4403, 0x4358, 0xb2, 0x2d, 0x03, 0x46, 0xe2, 0x3b, 0x17, 0x64)] +interface ISpThreadControl(ISpThreadControlVtbl): ISpNotifySink(ISpNotifySinkVtbl) { + fn StartThread( + dwFlags: DWORD, + phwnd: *mut HWND, + ) -> HRESULT, + fn WaitForThreadDone( + fForceStop: BOOL, + phrThreadResult: *mut HRESULT, + msTimeOut: ULONG, + ) -> HRESULT, + fn TerminateThread() -> HRESULT, + fn ThreadHandle() -> HANDLE, + fn ThreadId() -> DWORD, + fn NotifyEvent() -> HANDLE, + fn WindowHandle() -> HWND, + fn ThreadCompleteEvent() -> HANDLE, + fn ExitThreadEvent() -> HANDLE, +}); +STRUCT!{struct SPTMTHREADINFO { + lPoolSize: c_long, + lPriority: c_long, + ulConcurrencyLimit: ULONG, + ulMaxQuickAllocThreads: ULONG, +}} +RIDL!(#[uuid(0x2baeef81, 0x2ca3, 0x4331, 0x98, 0xf3, 0x26, 0xec, 0x5a, 0xbe, 0xfb, 0x03)] +interface ISpTaskManager(ISpTaskManagerVtbl): IUnknown(IUnknownVtbl) { + fn SetThreadPoolInfo( + pPoolInfo: *const SPTMTHREADINFO, + ) -> HRESULT, + fn GetThreadPoolInfo( + pPoolInfo: *mut SPTMTHREADINFO, + ) -> HRESULT, + fn QueueTask( + pTask: *mut ISpTask, + pvTaskData: *mut c_void, + hCompEvent: HANDLE, + pdwGroupId: *mut DWORD, + pTaskID: *mut DWORD, + ) -> HRESULT, + fn CreateReoccurringTask( + pTask: *mut ISpTask, + pvTaskData: *mut c_void, + hCompEvent: HANDLE, + ppTaskCtrl: *mut *mut ISpNotifySink, + ) -> HRESULT, + fn CreateThreadControl( + pTask: *mut ISpThreadTask, + pvTaskData: *mut c_void, + nPriority: c_long, + ppTaskCtrl: *mut *mut ISpThreadControl, + ) -> HRESULT, + fn TerminateTask( + dwGroupId: DWORD, + ulWaitPeriod: ULONG, + ) -> HRESULT, +}); +ENUM!{enum SPVSKIPTYPE { + SPVST_SENTENCE = 1 << 0, +}} +ENUM!{enum SPVESACTIONS { + SPVES_CONTINUE = 0, + SPVES_ABORT = 1 << 0, + SPVES_SKIP = 1 << 1, + SPVES_RATE = 1 << 2, + SPVES_VOLUME = 1 << 3, +}} +RIDL!(#[uuid(0x9880499b, 0xcce9, 0x11d2, 0xb5, 0x03, 0x00, 0xc0, 0x4f, 0x79, 0x73, 0x96)] +interface ISpTTSEngineSite(ISpTTSEngineSiteVtbl): ISpEventSink(ISpEventSinkVtbl) { + fn GetActions() -> DWORD, + fn Write( + pBuff: *const c_void, + cb: ULONG, + pcbWritten: *mut ULONG, + ) -> HRESULT, + fn GetRate( + pRateAdjust: *mut c_long, + ) -> HRESULT, + fn GetVolume(pusVolume: *mut USHORT, + ) -> HRESULT, + fn GetSkipInfo( + peType: *mut SPVSKIPTYPE, + plNumItems: *mut c_long, + ) -> HRESULT, + fn CompleteSkip( + ulNumSkipped: c_long, + ) -> HRESULT, +}); +STRUCT!{struct SPVTEXTFRAG { + pNext: *mut SPVTEXTFRAG, + State: SPVSTATE, + pTextStart: LPCWSTR, + ulTextLen: ULONG, + ulTextSrcOffset: ULONG, +}} +RIDL!(#[uuid(0xa74d7c8e, 0x4cc5, 0x4f2f, 0xa6, 0xeb, 0x80, 0x4d, 0xee, 0x18, 0x50, 0x0e)] +interface ISpTTSEngine(ISpTTSEngineVtbl): IUnknown(IUnknownVtbl) { + fn Speak( + dwSpeakFlags: DWORD, + rguidFormatId: REFGUID, + pWaveFormatEx: *const WAVEFORMATEX, + pTextFragList: *const SPVTEXTFRAG, + pOutputSite: *mut ISpTTSEngineSite, + ) -> HRESULT, + fn GetOutputFormat( + pTargetFmtId: *const GUID, + pTargetWaveFormatEx: *const WAVEFORMATEX, + pOutputFormatId: *mut GUID, + ppCoMemOutputWaveFormatEx: *mut WAVEFORMATEX, + ) -> HRESULT, +}); +STRUCT!{struct SPWORDENTRY { + hWord: SPWORDHANDLE, + LangID: WORD, + pszDisplayText: *mut WCHAR, + pszLexicalForm: *mut WCHAR, + aPhoneId: *mut SPPHONEID, + pvClientContext: *mut c_void, +}} +STRUCT!{struct SPRULEENTRY { + hRule: SPRULEHANDLE, + hInitialState: SPSTATEHANDLE, + Attributes: DWORD, + pvClientRuleContext: *mut c_void, + pvClientGrammarContext: *mut c_void, +}} +ENUM!{enum SPTRANSITIONTYPE { + SPTRANSEPSILON = 0, + SPTRANSWORD, + SPTRANSRULE, + SPTRANSTEXTBUF, + SPTRANSWILDCARD, + SPTRANSDICTATION, +}} +STRUCT!{struct SPTRANSITIONENTRY_u_s1 { + hRuleInitialState: SPSTATEHANDLE, + hRule: SPRULEHANDLE, + pvClientRuleContext: *mut c_void, +}} +STRUCT!{struct SPTRANSITIONENTRY_u_s2 { + hWord: SPWORDHANDLE, + pvClientWordContext: *mut c_void, +}} +UNION!{union SPTRANSITIONENTRY_u { + [usize; 3], + s1 s1_mut: SPTRANSITIONENTRY_u_s1, + s2 s2_mut: SPTRANSITIONENTRY_u_s2, + pvGrammarCookie pvGrammarCookie_mut: *mut c_void, +}} +STRUCT!{struct SPTRANSITIONENTRY { + ID: SPTRANSITIONID, + hNextState: SPSTATEHANDLE, + Type: BYTE, + RequiredConfidence: c_char, + fHasProperty: DWORD, + Weight: c_float, + u: SPTRANSITIONENTRY_u, +}} +STRUCT!{struct SPTRANSITIONPROPERTY { + pszName: LPCWSTR, + ulId: ULONG, + pszValue: LPCWSTR, + vValue: VARIANT, +}} +STRUCT!{struct SPSTATEINFO { + cAllocatedEntries: ULONG, + pTransitions: *mut SPTRANSITIONENTRY, + cEpsilons: ULONG, + cRules: ULONG, + cWords: ULONG, + cSpecialTransitions: ULONG, +}} +STRUCT!{struct SPPATHENTRY { + hTransition: SPTRANSITIONID, + elem: SPPHRASEELEMENT, +}} +RIDL!(#[uuid(0x6a6ffad8, 0x78b6, 0x473d, 0xb8, 0x44, 0x98, 0x15, 0x2e, 0x4f, 0xb1, 0x6b)] +interface ISpCFGInterpreterSite(ISpCFGInterpreterSiteVtbl): IUnknown(IUnknownVtbl) { + fn AddTextReplacement( + pReplace: *mut SPPHRASEREPLACEMENT, + ) -> HRESULT, + fn AddProperty( + pProperty: *const SPPHRASEPROPERTY, + ) -> HRESULT, + fn GetResourceValue( + pszResourceName: LPCWSTR, + ppCoMemResource: *mut LPWSTR, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xf3d3f926, 0x11fc, 0x11d3, 0xbb, 0x97, 0x00, 0xc0, 0x4f, 0x8e, 0xe6, 0xc0)] +interface ISpCFGInterpreter(ISpCFGInterpreterVtbl): IUnknown(IUnknownVtbl) { + fn InitGrammar( + pszGrammarName: LPCWSTR, + pvGrammarData: *mut *const c_void, + ) -> HRESULT, + fn Interpret( + pPhrase: *mut ISpPhraseBuilder, + ulFirstElement: *const ULONG, + ulCountOfElements: *const ULONG, + pSite: *mut ISpCFGInterpreterSite, + ) -> HRESULT, +}); +ENUM!{enum SPCFGNOTIFY { + SPCFGN_ADD, + SPCFGN_REMOVE, + SPCFGN_INVALIDATE, + SPCFGN_ACTIVATE, + SPCFGN_DEACTIVATE, +}} +ENUM!{enum SPRESULTTYPE { + SPRT_CFG = 0, + SPRT_SLM = 1, + SPRT_PROPRIETARY = 2, + SPRT_FALSE_RECOGNITION = 1 << 2, +}} +STRUCT!{struct SPPHRASEALT { + pPhrase: *mut ISpPhraseBuilder, + ulStartElementInParent: ULONG, + cElementsInParent: ULONG, + cElementsInAlternate: ULONG, + pvAltExtra: *mut c_void, + cbAltExtra: ULONG, +}} +STRUCT!{struct SPRECORESULTINFO { + cbSize: ULONG, + eResultType: SPRESULTTYPE, + fHypothesis: BOOL, + fProprietaryAutoPause: BOOL, + ullStreamPosStart: ULONGLONG, + ullStreamPosEnd: ULONGLONG, + hGrammar: SPGRAMMARHANDLE, + ulSizeEngineData: ULONG, + pvEngineData: *mut c_void, + pPhrase: *mut ISpPhraseBuilder, + aPhraseAlts: *mut SPPHRASEALT, + ulNumAlts: ULONG, +}} +ENUM!{enum SPWORDINFOOPT { + SPWIO_NONE = 0, + SPWIO_WANT_TEXT = 1, +}} +ENUM!{enum SPRULEINFOOPT { + SPRIO_NONE = 0, +}} +STRUCT!{struct SPPARSEINFO { + cbSize: ULONG, + hRule: SPRULEHANDLE, + ullAudioStreamPosition: ULONGLONG, + ulAudioSize: ULONG, + cTransitions: ULONG, + pPath: *mut SPPATHENTRY, + SREngineID: GUID, + ulSREnginePrivateDataSize: ULONG, + pSREnginePrivateData: *const BYTE, + fHypothesis: BOOL, +}} +RIDL!(#[uuid(0x3b414aec, 0x720c, 0x4883, 0xb9, 0xef, 0x17, 0x8c, 0xd3, 0x94, 0xfb, 0x3a)] +interface ISpSREngineSite(ISpSREngineSiteVtbl): IUnknown(IUnknownVtbl) { + fn Read( + pv: *mut c_void, + cb: ULONG, + pcbRead: *mut ULONG, + ) -> HRESULT, + fn DataAvailable( + pcb: *mut ULONG, + ) -> HRESULT, + fn SetBufferNotifySize( + cbSize: ULONG, + ) -> HRESULT, + fn ParseFromTransitions( + pParseInfo: *const SPPARSEINFO, + ppNewPhrase: *mut *mut ISpPhraseBuilder, + ) -> HRESULT, + fn Recognition( + pResultInfo: *const SPRECORESULTINFO, + ) -> HRESULT, + fn AddEvent( + pEvent: *const SPEVENT, + hSAPIRecoContext: SPRECOCONTEXTHANDLE, + ) -> HRESULT, + fn Synchronize( + ullProcessedThruPos: ULONGLONG, + ) -> HRESULT, + fn GetWordInfo( + pWordEntry: *mut SPWORDENTRY, + Options: SPWORDINFOOPT, + ) -> HRESULT, + fn SetWordClientContext( + hWord: SPWORDHANDLE, + pvClientContext: *mut c_void, + ) -> HRESULT, + fn GetRuleInfo( + pRuleEntry: *mut SPRULEENTRY, + Options: SPRULEINFOOPT, + ) -> HRESULT, + fn SetRuleClientContext( + hRule: SPRULEHANDLE, + pvClientContext: *mut c_void, + ) -> HRESULT, + fn GetStateInfo( + hState: SPSTATEHANDLE, + pStateInfo: *mut SPSTATEINFO, + ) -> HRESULT, + fn GetResource( + hRule: SPRULEHANDLE, + pszResourceName: LPCWSTR, + ppCoMemResource: *mut LPWSTR, + ) -> HRESULT, + fn GetTransitionProperty( + ID: SPTRANSITIONID, + ppCoMemProperty: *mut *mut SPTRANSITIONPROPERTY, + ) -> HRESULT, + fn IsAlternate( + hRule: SPRULEHANDLE, + hAltRule: SPRULEHANDLE, + ) -> HRESULT, + fn GetMaxAlternates( + hRule: SPRULEHANDLE, + pulNumAlts: *mut ULONG, + ) -> HRESULT, + fn GetContextMaxAlternates( + hContext: SPRECOCONTEXTHANDLE, + pulNumAlts: *mut ULONG, + ) -> HRESULT, + fn UpdateRecoPos( + ullCurrentRecoPos: ULONGLONG, + ) -> HRESULT, +}); +ENUM!{enum SPPROPSRC { + SPPROPSRC_RECO_INST, + SPPROPSRC_RECO_CTX, + SPPROPSRC_RECO_GRAMMAR, +}} +RIDL!(#[uuid(0x2f472991, 0x854b, 0x4465, 0xb6, 0x13, 0xfb, 0xaf, 0xb3, 0xad, 0x8e, 0xd8)] +interface ISpSREngine(ISpSREngineVtbl): IUnknown(IUnknownVtbl) { + fn SetSite( + pSite: *mut ISpSREngineSite, + ) -> HRESULT, + fn GetInputAudioFormat( + pguidSourceFormatId: *const GUID, + pSourceWaveFormatEx: *const WAVEFORMATEX, + pguidDesiredFormatId: *mut GUID, + ppCoMemDesiredWaveFormatEx: *mut WAVEFORMATEX, + ) -> HRESULT, + fn RecognizeStream( + rguidFmtId: REFGUID, + pWaveFormatEx: *const WAVEFORMATEX, + hRequestSync: HANDLE, + hDataAvailable: HANDLE, + hExit: HANDLE, + fNewAudioStream: BOOL, + fRealTimeAudio: BOOL, + pAudioObjectToken: *mut ISpObjectToken, + ) -> HRESULT, + fn SetRecoProfile( + pProfile: *mut ISpObjectToken, + ) -> HRESULT, + fn OnCreateGrammar( + pvEngineRecoContext: *mut c_void, + hSAPIGrammar: SPGRAMMARHANDLE, + ppvEngineGrammarContext: *mut *mut c_void, + ) -> HRESULT, + fn OnDeleteGrammar( + pvEngineGrammar: *mut c_void, + ) -> HRESULT, + fn LoadProprietaryGrammar( + pvEngineGrammar: *mut c_void, + rguidParam: REFGUID, + pszStringParam: LPCWSTR, + pvDataParam: *const c_void, + ulDataSize: ULONG, + Options: SPLOADOPTIONS, + ) -> HRESULT, + fn UnloadProprietaryGrammar( + pvEngineGrammar: *mut c_void, + ) -> HRESULT, + fn SetProprietaryRuleState( + pvEngineGrammar: *mut c_void, + pszName: LPCWSTR, + pReserved: *mut c_void, + NewState: SPRULESTATE, + pcRulesChanged: *mut ULONG, + ) -> HRESULT, + fn SetProprietaryRuleIdState( + pvEngineGrammar: *mut c_void, + dwRuleId: DWORD, + NewState: SPRULESTATE, + ) -> HRESULT, + fn LoadSLM( + pvEngineGrammar: *mut c_void, + pszTopicName: LPCWSTR, + ) -> HRESULT, + fn UnloadSLM( + pvEngineGrammar: *mut c_void, + ) -> HRESULT, + fn SetSLMState( + pvEngineGrammar: *mut c_void, + NewState: SPRULESTATE, + ) -> HRESULT, + fn SetWordSequenceData( + pvEngineGrammar: *mut c_void, + pText: *const WCHAR, + cchText: ULONG, + pInfo: *const SPTEXTSELECTIONINFO, + ) -> HRESULT, + fn SetTextSelection( + pvEngineGrammar: *mut c_void, + pInfo: *const SPTEXTSELECTIONINFO, + ) -> HRESULT, + fn IsPronounceable( + pvEngineGrammar: *mut c_void, + pszWord: LPCWSTR, + pWordPronounceable: *mut SPWORDPRONOUNCEABLE, + ) -> HRESULT, + fn OnCreateRecoContext( + hSAPIRecoContext: SPRECOCONTEXTHANDLE, + ppvEngineContext: *mut *mut c_void, + ) -> HRESULT, + fn OnDeleteRecoContext( + pvEngineContext: *mut c_void, + ) -> HRESULT, + fn OnPrivateCall( + pvEngineContext: *mut c_void, + pCallFrame: PVOID, + ulCallFrameSize: ULONG, + ) -> HRESULT, + fn SetAdaptationData( + pvEngineContext: *mut c_void, + pAdaptationData: *const WCHAR, + cch: ULONG, + ) -> HRESULT, + fn SetPropertyNum( + eSrc: SPPROPSRC, + pvSrcObj: *mut c_void, + pName: *const WCHAR, + lValue: LONG, + ) -> HRESULT, + fn GetPropertyNum( + eSrc: SPPROPSRC, + pvSrcObj: *mut c_void, + pName: *const WCHAR, + lValue: *mut LONG, + ) -> HRESULT, + fn SetPropertyString( + eSrc: SPPROPSRC, + pvSrcObj: *mut c_void, + pName: LPCWSTR, + pValue: LPCWSTR, + ) -> HRESULT, + fn GetPropertyString( + eSrc: SPPROPSRC, + pvSrcObj: *mut c_void, + pName: LPCWSTR, + ppCoMemValue: *mut LPWSTR, + ) -> HRESULT, + fn SetGrammarState( + pvEngineGrammar: *mut c_void, + eGrammarState: SPGRAMMARSTATE, + ) -> HRESULT, + fn WordNotify( + Action: SPCFGNOTIFY, + cWords: ULONG, + pWords: *const SPWORDENTRY, + ) -> HRESULT, + fn RuleNotify( + Action: SPCFGNOTIFY, + cRules: ULONG, + pRules: *const SPRULEENTRY, + ) -> HRESULT, + fn PrivateCallEx( + pvEngineContext: *mut c_void, + pInCallFrame: *const c_void, + ulInCallFrameSize: ULONG, + ppvCoMemResponse: *mut *mut c_void, + pulResponseSize: *mut ULONG, + ) -> HRESULT, + fn SetContextState( + pvEngineContext: *mut c_void, + eContextState: SPCONTEXTSTATE, + ) -> HRESULT, +}); +STRUCT!{struct SPPHRASEALTREQUEST { + ulStartElement: ULONG, + cElements: ULONG, + ulRequestAltCount: ULONG, + pvResultExtra: *mut c_void, + cbResultExtra: ULONG, + pPhrase: *mut ISpPhrase, + pRecoContext: *mut ISpRecoContext, +}} +RIDL!(#[uuid(0x8e7c791e, 0x4467, 0x11d3, 0x97, 0x23, 0x00, 0xc0, 0x4f, 0x72, 0xdb, 0x08)] +interface _ISpPrivateEngineCall(_ISpPrivateEngineCallVtbl): IUnknown(IUnknownVtbl) { + fn CallEngine( + pCallFrame: *mut c_void, + ulCallFrameSize: ULONG, + ) -> HRESULT, + fn CallEngineEx( + pInFrame: *const c_void, + ulInFrameSize: ULONG, + ppCoMemOutFrame: *mut *mut c_void, + pulOutFrameSize: *mut ULONG, + ) -> HRESULT, +}); +extern { + pub static LIBID_SpeechDDKLib: IID; + pub static CLSID_SpDataKey: CLSID; + pub static CLSID_SpObjectTokenEnum: CLSID; + pub static CLSID_SpPhraseBuilder: CLSID; + pub static CLSID_SpITNProcessor: CLSID; + pub static CLSID_SpGrammarCompiler: CLSID; + pub static CLSID_SpGramCompBackend: CLSID; +} diff --git a/src/vendor/winapi/src/um/schannel.rs b/src/vendor/winapi/src/um/schannel.rs new file mode 100644 index 0000000000..71e67a0846 --- /dev/null +++ b/src/vendor/winapi/src/um/schannel.rs @@ -0,0 +1,340 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Public Definitions for SCHANNEL Security Provider +use shared::guiddef::GUID; +use shared::minwindef::{BYTE, DWORD, PBYTE, WORD}; +use shared::windef::HWND; +use um::wincrypt::{ALG_ID, HCERTSTORE, HCRYPTPROV, PCCERT_CONTEXT, PCERT_NAME_BLOB}; +use um::winnt::{HRESULT, LPWSTR, PVOID, WCHAR}; +pub const UNISP_NAME: &'static str = "Microsoft Unified Security Protocol Provider"; +pub const SSL2SP_NAME: &'static str = "Microsoft SSL 2.0"; +pub const SSL3SP_NAME: &'static str = "Microsoft SSL 3.0"; +pub const TLS1SP_NAME: &'static str = "Microsoft TLS 1.0"; +pub const PCT1SP_NAME: &'static str = "Microsoft PCT 1.0"; +pub const SCHANNEL_NAME: &'static str = "Schannel"; +ENUM!{enum eTlsSignatureAlgorithm { + TlsSignatureAlgorithm_Anonymous = 0, + TlsSignatureAlgorithm_Rsa = 1, + TlsSignatureAlgorithm_Dsa = 2, + TlsSignatureAlgorithm_Ecdsa = 3, +}} +ENUM!{enum eTlsHashAlgorithm { + TlsHashAlgorithm_None = 0, + TlsHashAlgorithm_Md5 = 1, + TlsHashAlgorithm_Sha1 = 2, + TlsHashAlgorithm_Sha224 = 3, + TlsHashAlgorithm_Sha256 = 4, + TlsHashAlgorithm_Sha384 = 5, + TlsHashAlgorithm_Sha512 = 6, +}} +pub const UNISP_RPC_ID: DWORD = 14; +STRUCT!{struct SecPkgContext_RemoteCredentialInfo { + cbCertificateChain: DWORD, + pbCertificateChain: PBYTE, + cCertificates: DWORD, + fFlags: DWORD, + dwBits: DWORD, +}} +pub type PSecPkgContext_RemoteCredentialInfo = *mut SecPkgContext_RemoteCredentialInfo; +pub type SecPkgContext_RemoteCredenitalInfo = SecPkgContext_RemoteCredentialInfo; +pub type PSecPkgContext_RemoteCredenitalInfo = *mut SecPkgContext_RemoteCredentialInfo; +pub const RCRED_STATUS_NOCRED: DWORD = 0x00000000; +pub const RCRED_CRED_EXISTS: DWORD = 0x00000001; +pub const RCRED_STATUS_UNKNOWN_ISSUER: DWORD = 0x00000002; +STRUCT!{struct SecPkgContext_LocalCredentialInfo { + cbCertificateChain: DWORD, + pbCertificateChain: PBYTE, + cCertificates: DWORD, + fFlags: DWORD, + dwBits: DWORD, +}} +pub type PSecPkgContext_LocalCredentialInfo = *mut SecPkgContext_LocalCredentialInfo; +pub type SecPkgContext_LocalCredenitalInfo = SecPkgContext_LocalCredentialInfo; +pub type PSecPkgContext_LocalCredenitalInfo = *mut SecPkgContext_LocalCredentialInfo; +pub const LCRED_STATUS_NOCRED: DWORD = 0x00000000; +pub const LCRED_CRED_EXISTS: DWORD = 0x00000001; +pub const LCRED_STATUS_UNKNOWN_ISSUER: DWORD = 0x00000002; +STRUCT!{struct SecPkgContext_ClientCertPolicyResult { + dwPolicyResult: HRESULT, + guidPolicyId: GUID, +}} +pub type PSecPkgContext_ClientCertPolicyResult = *mut SecPkgContext_ClientCertPolicyResult; +STRUCT!{struct SecPkgContext_IssuerListInfoEx { + aIssuers: PCERT_NAME_BLOB, + cIssuers: DWORD, +}} +pub type PSecPkgContext_IssuerListInfoEx = *mut SecPkgContext_IssuerListInfoEx; +STRUCT!{struct SecPkgContext_ConnectionInfo { + dwProtocol: DWORD, + aiCipher: ALG_ID, + dwCipherStrength: DWORD, + aiHash: ALG_ID, + dwHashStrength: DWORD, + aiExch: ALG_ID, + dwExchStrength: DWORD, +}} +pub type PSecPkgContext_ConnectionInfo = *mut SecPkgContext_ConnectionInfo; +pub const SZ_ALG_MAX_SIZE: usize = 64; +pub const SECPKGCONTEXT_CIPHERINFO_V1: DWORD = 1; +STRUCT!{struct SecPkgContext_CipherInfo { + dwVersion: DWORD, + dwProtocol: DWORD, + dwCipherSuite: DWORD, + dwBaseCipherSuite: DWORD, + szCipherSuite: [WCHAR; SZ_ALG_MAX_SIZE], + szCipher: [WCHAR; SZ_ALG_MAX_SIZE], + dwCipherLen: DWORD, + dwCipherBlockLen: DWORD, + szHash: [WCHAR; SZ_ALG_MAX_SIZE], + dwHashLen: DWORD, + szExchange: [WCHAR; SZ_ALG_MAX_SIZE], + dwMinExchangeLen: DWORD, + dwMaxExchangeLen: DWORD, + szCertificate: [WCHAR; SZ_ALG_MAX_SIZE], + dwKeyType: DWORD, +}} +pub type PSecPkgContext_CipherInfo = *mut SecPkgContext_CipherInfo; +STRUCT!{struct SecPkgContext_EapKeyBlock { + rgbKeys: [BYTE; 128], + rgbIVs: [BYTE; 64], +}} +pub type PSecPkgContext_EapKeyBlock = *mut SecPkgContext_EapKeyBlock; +STRUCT!{struct SecPkgContext_MappedCredAttr { + dwAttribute: DWORD, + pvBuffer: PVOID, +}} +pub type PSecPkgContext_MappedCredAttr = *mut SecPkgContext_MappedCredAttr; +pub const SSL_SESSION_RECONNECT: DWORD = 1; +STRUCT!{struct SecPkgContext_SessionInfo { + dwFlags: DWORD, + cbSessionId: DWORD, + rgbSessionId: [BYTE; 32], +}} +pub type PSecPkgContext_SessionInfo = *mut SecPkgContext_SessionInfo; +STRUCT!{struct SecPkgContext_SessionAppData { + dwFlags: DWORD, + cbAppData: DWORD, + pbAppData: PBYTE, +}} +pub type PSecPkgContext_SessionAppData = *mut SecPkgContext_SessionAppData; +STRUCT!{struct SecPkgContext_EapPrfInfo { + dwVersion: DWORD, + cbPrfData: DWORD, + pbPrfData: PBYTE, +}} +pub type PSecPkgContext_EapPrfInfo = *mut SecPkgContext_EapPrfInfo; +STRUCT!{struct SecPkgContext_SupportedSignatures { + cSignatureAndHashAlgorithms: WORD, + pSignatureAndHashAlgorithms: *mut WORD, +}} +pub type PSecPkgContext_SupportedSignatures = *mut SecPkgContext_SupportedSignatures; +STRUCT!{struct SecPkgContext_Certificates { + cCertificates: DWORD, + cbCertificateChain: DWORD, + pbCertificateChain: PBYTE, +}} +pub type PSecPkgContext_Certificates = *mut SecPkgContext_Certificates; +STRUCT!{struct SecPkgContext_CertInfo { + dwVersion: DWORD, + cbSubjectName: DWORD, + pwszSubjectName: LPWSTR, + cbIssuerName: DWORD, + pwszIssuerName: LPWSTR, + dwKeySize: DWORD, +}} +pub type PSecPkgContext_CertInfo = *mut SecPkgContext_CertInfo; +pub const KERN_CONTEXT_CERT_INFO_V1: DWORD = 0x00000000; +STRUCT!{struct SecPkgContext_UiInfo { + hParentWindow: HWND, +}} +pub type PSecPkgContext_UiInfo = *mut SecPkgContext_UiInfo; +STRUCT!{struct SecPkgContext_EarlyStart { + dwEarlyStartFlags: DWORD, +}} +pub type PSecPkgContext_EarlyStart = *mut SecPkgContext_EarlyStart; +pub const ENABLE_TLS_CLIENT_EARLY_START: DWORD = 0x00000001; +pub const SCH_CRED_V1: DWORD = 0x00000001; +pub const SCH_CRED_V2: DWORD = 0x00000002; +pub const SCH_CRED_VERSION: DWORD = 0x00000002; +pub const SCH_CRED_V3: DWORD = 0x00000003; +pub const SCHANNEL_CRED_VERSION: DWORD = 0x00000004; +pub const SCHANNEL_SECRET_TYPE_CAPI: DWORD = 0x00000001; +pub const SCHANNEL_SECRET_PRIVKEY: DWORD = 0x00000002; +pub const SCH_CRED_X509_CERTCHAIN: DWORD = 0x00000001; +pub const SCH_CRED_X509_CAPI: DWORD = 0x00000002; +pub const SCH_CRED_CERT_CONTEXT: DWORD = 0x00000003; +pub enum _HMAPPER {} +STRUCT!{struct SCHANNEL_CRED { + dwVersion: DWORD, + cCreds: DWORD, + paCred: *mut PCCERT_CONTEXT, + hRootStore: HCERTSTORE, + cMappers: DWORD, + aphMappers: *mut *mut _HMAPPER, + cSupportedAlgs: DWORD, + palgSupportedAlgs: *mut ALG_ID, + grbitEnabledProtocols: DWORD, + dwMinimumCipherStrength: DWORD, + dwMaximumCipherStrength: DWORD, + dwSessionLifespan: DWORD, + dwFlags: DWORD, + dwCredFormat: DWORD, +}} +pub type PSCHANNEL_CRED = *mut SCHANNEL_CRED; +pub const SCH_CRED_FORMAT_CERT_CONTEXT: DWORD = 0x00000000; +pub const SCH_CRED_FORMAT_CERT_HASH: DWORD = 0x00000001; +pub const SCH_CRED_FORMAT_CERT_HASH_STORE: DWORD = 0x00000002; +pub const SCH_CRED_MAX_STORE_NAME_SIZE: usize = 128; +pub const SCH_CRED_MAX_SUPPORTED_ALGS: DWORD = 256; +pub const SCH_CRED_MAX_SUPPORTED_CERTS: DWORD = 100; +STRUCT!{struct SCHANNEL_CERT_HASH { + dwLength: DWORD, + dwFlags: DWORD, + hProv: HCRYPTPROV, + ShaHash: [BYTE; 20], +}} +pub type PSCHANNEL_CERT_HASH = *mut SCHANNEL_CERT_HASH; +STRUCT!{struct SCHANNEL_CERT_HASH_STORE { + dwLength: DWORD, + dwFlags: DWORD, + hProv: HCRYPTPROV, + ShaHash: [BYTE; 20], + pwszStoreName: [WCHAR; SCH_CRED_MAX_STORE_NAME_SIZE], +}} +pub type PSCHANNEL_CERT_HASH_STORE = *mut SCHANNEL_CERT_HASH_STORE; +pub const SCH_MACHINE_CERT_HASH: DWORD = 0x00000001; +pub const SCH_CRED_NO_SYSTEM_MAPPER: DWORD = 0x00000002; +pub const SCH_CRED_NO_SERVERNAME_CHECK: DWORD = 0x00000004; +pub const SCH_CRED_MANUAL_CRED_VALIDATION: DWORD = 0x00000008; +pub const SCH_CRED_NO_DEFAULT_CREDS: DWORD = 0x00000010; +pub const SCH_CRED_AUTO_CRED_VALIDATION: DWORD = 0x00000020; +pub const SCH_CRED_USE_DEFAULT_CREDS: DWORD = 0x00000040; +pub const SCH_CRED_DISABLE_RECONNECTS: DWORD = 0x00000080; +pub const SCH_CRED_REVOCATION_CHECK_END_CERT: DWORD = 0x00000100; +pub const SCH_CRED_REVOCATION_CHECK_CHAIN: DWORD = 0x00000200; +pub const SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT: DWORD = 0x00000400; +pub const SCH_CRED_IGNORE_NO_REVOCATION_CHECK: DWORD = 0x00000800; +pub const SCH_CRED_IGNORE_REVOCATION_OFFLINE: DWORD = 0x00001000; +pub const SCH_CRED_RESTRICTED_ROOTS: DWORD = 0x00002000; +pub const SCH_CRED_REVOCATION_CHECK_CACHE_ONLY: DWORD = 0x00004000; +pub const SCH_CRED_CACHE_ONLY_URL_RETRIEVAL: DWORD = 0x00008000; +pub const SCH_CRED_MEMORY_STORE_CERT: DWORD = 0x00010000; +pub const SCH_CRED_CACHE_ONLY_URL_RETRIEVAL_ON_CREATE: DWORD = 0x00020000; +pub const SCH_SEND_ROOT_CERT: DWORD = 0x00040000; +pub const SCH_CRED_SNI_CREDENTIAL: DWORD = 0x00080000; +pub const SCH_CRED_SNI_ENABLE_OCSP: DWORD = 0x00100000; +pub const SCH_SEND_AUX_RECORD: DWORD = 0x00200000; +pub const SCH_USE_STRONG_CRYPTO: DWORD = 0x00400000; +pub const SCHANNEL_RENEGOTIATE: DWORD = 0; +pub const SCHANNEL_SHUTDOWN: DWORD = 1; +pub const SCHANNEL_ALERT: DWORD = 2; +pub const SCHANNEL_SESSION: DWORD = 3; +STRUCT!{struct SCHANNEL_ALERT_TOKEN { + dwTokenType: DWORD, + dwAlertType: DWORD, + dwAlertNumber: DWORD, +}} +pub const TLS1_ALERT_WARNING: DWORD = 1; +pub const TLS1_ALERT_FATAL: DWORD = 2; +pub const TLS1_ALERT_CLOSE_NOTIFY: DWORD = 0; +pub const TLS1_ALERT_UNEXPECTED_MESSAGE: DWORD = 10; +pub const TLS1_ALERT_BAD_RECORD_MAC: DWORD = 20; +pub const TLS1_ALERT_DECRYPTION_FAILED: DWORD = 21; +pub const TLS1_ALERT_RECORD_OVERFLOW: DWORD = 22; +pub const TLS1_ALERT_DECOMPRESSION_FAIL: DWORD = 30; +pub const TLS1_ALERT_HANDSHAKE_FAILURE: DWORD = 40; +pub const TLS1_ALERT_BAD_CERTIFICATE: DWORD = 42; +pub const TLS1_ALERT_UNSUPPORTED_CERT: DWORD = 43; +pub const TLS1_ALERT_CERTIFICATE_REVOKED: DWORD = 44; +pub const TLS1_ALERT_CERTIFICATE_EXPIRED: DWORD = 45; +pub const TLS1_ALERT_CERTIFICATE_UNKNOWN: DWORD = 46; +pub const TLS1_ALERT_ILLEGAL_PARAMETER: DWORD = 47; +pub const TLS1_ALERT_UNKNOWN_CA: DWORD = 48; +pub const TLS1_ALERT_ACCESS_DENIED: DWORD = 49; +pub const TLS1_ALERT_DECODE_ERROR: DWORD = 50; +pub const TLS1_ALERT_DECRYPT_ERROR: DWORD = 51; +pub const TLS1_ALERT_EXPORT_RESTRICTION: DWORD = 60; +pub const TLS1_ALERT_PROTOCOL_VERSION: DWORD = 70; +pub const TLS1_ALERT_INSUFFIENT_SECURITY: DWORD = 71; +pub const TLS1_ALERT_INTERNAL_ERROR: DWORD = 80; +pub const TLS1_ALERT_USER_CANCELED: DWORD = 90; +pub const TLS1_ALERT_NO_RENEGOTIATION: DWORD = 100; +pub const TLS1_ALERT_UNSUPPORTED_EXT: DWORD = 110; +pub const TLS1_ALERT_NO_APP_PROTOCOL: DWORD = 120; +pub const SSL_SESSION_ENABLE_RECONNECTS: DWORD = 1; +pub const SSL_SESSION_DISABLE_RECONNECTS: DWORD = 2; +STRUCT!{struct SCHANNEL_SESSION_TOKEN { + dwTokenType: DWORD, + dwFlags: DWORD, +}} +STRUCT!{struct SCHANNEL_CLIENT_SIGNATURE { + cbLength: DWORD, + aiHash: ALG_ID, + cbHash: DWORD, + HashValue: [BYTE; 36], + CertThumbprint: [BYTE; 20], +}} +pub type PSCHANNEL_CLIENT_SIGNATURE = *mut SCHANNEL_CLIENT_SIGNATURE; +pub const SP_PROT_PCT1_SERVER: DWORD = 0x00000001; +pub const SP_PROT_PCT1_CLIENT: DWORD = 0x00000002; +pub const SP_PROT_PCT1: DWORD = SP_PROT_PCT1_SERVER | SP_PROT_PCT1_CLIENT; +pub const SP_PROT_SSL2_SERVER: DWORD = 0x00000004; +pub const SP_PROT_SSL2_CLIENT: DWORD = 0x00000008; +pub const SP_PROT_SSL2: DWORD = SP_PROT_SSL2_SERVER | SP_PROT_SSL2_CLIENT; +pub const SP_PROT_SSL3_SERVER: DWORD = 0x00000010; +pub const SP_PROT_SSL3_CLIENT: DWORD = 0x00000020; +pub const SP_PROT_SSL3: DWORD = SP_PROT_SSL3_SERVER | SP_PROT_SSL3_CLIENT; +pub const SP_PROT_TLS1_SERVER: DWORD = 0x00000040; +pub const SP_PROT_TLS1_CLIENT: DWORD = 0x00000080; +pub const SP_PROT_TLS1: DWORD = SP_PROT_TLS1_SERVER | SP_PROT_TLS1_CLIENT; +pub const SP_PROT_SSL3TLS1_CLIENTS: DWORD = SP_PROT_TLS1_CLIENT | SP_PROT_SSL3_CLIENT; +pub const SP_PROT_SSL3TLS1_SERVERS: DWORD = SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER; +pub const SP_PROT_SSL3TLS1: DWORD = SP_PROT_SSL3 | SP_PROT_TLS1; +pub const SP_PROT_UNI_SERVER: DWORD = 0x40000000; +pub const SP_PROT_UNI_CLIENT: DWORD = 0x80000000; +pub const SP_PROT_UNI: DWORD = SP_PROT_UNI_SERVER | SP_PROT_UNI_CLIENT; +pub const SP_PROT_ALL: DWORD = 0xffffffff; +pub const SP_PROT_NONE: DWORD = 0; +pub const SP_PROT_CLIENTS: DWORD = SP_PROT_PCT1_CLIENT | SP_PROT_SSL2_CLIENT + | SP_PROT_SSL3_CLIENT | SP_PROT_UNI_CLIENT | SP_PROT_TLS1_CLIENT; +pub const SP_PROT_SERVERS: DWORD = SP_PROT_PCT1_SERVER | SP_PROT_SSL2_SERVER + | SP_PROT_SSL3_SERVER | SP_PROT_UNI_SERVER | SP_PROT_TLS1_SERVER; +pub const SP_PROT_TLS1_0_SERVER: DWORD = SP_PROT_TLS1_SERVER; +pub const SP_PROT_TLS1_0_CLIENT: DWORD = SP_PROT_TLS1_CLIENT; +pub const SP_PROT_TLS1_0: DWORD = SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_0_CLIENT; +pub const SP_PROT_TLS1_1_SERVER: DWORD = 0x00000100; +pub const SP_PROT_TLS1_1_CLIENT: DWORD = 0x00000200; +pub const SP_PROT_TLS1_1: DWORD = SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_1_CLIENT; +pub const SP_PROT_TLS1_2_SERVER: DWORD = 0x00000400; +pub const SP_PROT_TLS1_2_CLIENT: DWORD = 0x00000800; +pub const SP_PROT_TLS1_2: DWORD = SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_2_CLIENT; +pub const SP_PROT_DTLS_SERVER: DWORD = 0x00010000; +pub const SP_PROT_DTLS_CLIENT: DWORD = 0x00020000; +pub const SP_PROT_DTLS: DWORD = SP_PROT_DTLS_SERVER | SP_PROT_DTLS_CLIENT; +pub const SP_PROT_DTLS1_0_SERVER: DWORD = SP_PROT_DTLS_SERVER; +pub const SP_PROT_DTLS1_0_CLIENT: DWORD = SP_PROT_DTLS_CLIENT; +pub const SP_PROT_DTLS1_0: DWORD = SP_PROT_DTLS1_0_SERVER | SP_PROT_DTLS1_0_CLIENT; +pub const SP_PROT_DTLS1_X_SERVER: DWORD = SP_PROT_DTLS1_0_SERVER; +pub const SP_PROT_DTLS1_X_CLIENT: DWORD = SP_PROT_DTLS1_0_CLIENT; +pub const SP_PROT_DTLS1_X: DWORD = SP_PROT_DTLS1_X_SERVER | SP_PROT_DTLS1_X_CLIENT; +pub const SP_PROT_TLS1_1PLUS_SERVER: DWORD = SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER; +pub const SP_PROT_TLS1_1PLUS_CLIENT: DWORD = SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT; +pub const SP_PROT_TLS1_1PLUS: DWORD = SP_PROT_TLS1_1PLUS_SERVER | SP_PROT_TLS1_1PLUS_CLIENT; +pub const SP_PROT_TLS1_X_SERVER: DWORD = SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_1_SERVER + | SP_PROT_TLS1_2_SERVER; +pub const SP_PROT_TLS1_X_CLIENT: DWORD = SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_1_CLIENT + | SP_PROT_TLS1_2_CLIENT; +pub const SP_PROT_TLS1_X: DWORD = SP_PROT_TLS1_X_SERVER | SP_PROT_TLS1_X_CLIENT; +pub const SP_PROT_SSL3TLS1_X_CLIENTS: DWORD = SP_PROT_TLS1_X_CLIENT | SP_PROT_SSL3_CLIENT; +pub const SP_PROT_SSL3TLS1_X_SERVERS: DWORD = SP_PROT_TLS1_X_SERVER | SP_PROT_SSL3_SERVER; +pub const SP_PROT_SSL3TLS1_X: DWORD = SP_PROT_SSL3 | SP_PROT_TLS1_X; +pub const SP_PROT_X_CLIENTS: DWORD = SP_PROT_CLIENTS | SP_PROT_TLS1_X_CLIENT + | SP_PROT_DTLS1_X_CLIENT; +pub const SP_PROT_X_SERVERS: DWORD = SP_PROT_SERVERS | SP_PROT_TLS1_X_SERVER + | SP_PROT_DTLS1_X_SERVER; +pub const SSL_CRACK_CERTIFICATE_NAME: &'static str = "SslCrackCertificate"; +pub const SSL_FREE_CERTIFICATE_NAME: &'static str = "SslFreeCertificate"; diff --git a/src/vendor/winapi/src/um/securityappcontainer.rs b/src/vendor/winapi/src/um/securityappcontainer.rs new file mode 100644 index 0000000000..56f0660dca --- /dev/null +++ b/src/vendor/winapi/src/um/securityappcontainer.rs @@ -0,0 +1,17 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, PULONG, ULONG}; +use um::winnt::{HANDLE, LPWSTR, PSID}; +extern "system" { + pub fn GetAppContainerNamedObjectPath( + Token: HANDLE, + AppContainerSid: PSID, + ObjectPathLength: ULONG, + ObjectPath: LPWSTR, + ReturnLength: PULONG, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/securitybaseapi.rs b/src/vendor/winapi/src/um/securitybaseapi.rs new file mode 100644 index 0000000000..73cebb90ed --- /dev/null +++ b/src/vendor/winapi/src/um/securitybaseapi.rs @@ -0,0 +1,172 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! FFI bindings to psapi. + +use shared::minwindef::{BOOL, DWORD, PBOOL, PDWORD, PUCHAR, PULONG, ULONG} +use um::winnt::{ + HANDLE, PACL, PCLAIM_SECURITY_ATTRIBUTES_INFORMATION, PHANDLE, PSID, PTOKEN_PRIVILEGES, +} + +extern "system" { + // pub fn AccessCheck(); + // pub fn AccessCheckAndAuditAlarmW(); + // pub fn AccessCheckByType(); + // pub fn AccessCheckByTypeResultList(); + // pub fn AccessCheckByTypeAndAuditAlarmW(); + // pub fn AccessCheckByTypeResultListAndAuditAlarmW(); + // pub fn AccessCheckByTypeResultListAndAuditAlarmByHandleW(); + // pub fn AddAccessAllowedAce(); + // pub fn AddAccessAllowedAceEx(); + // pub fn AddAccessAllowedObjectAce(); + // pub fn AddAccessDeniedAce(); + // pub fn AddAccessDeniedAceEx(); + // pub fn AddAccessDeniedObjectAce(); + // pub fn AddAce(); + // pub fn AddAuditAccessAce(); + // pub fn AddAuditAccessAceEx(); + // pub fn AddAuditAccessObjectAce(); + // pub fn AddMandatoryAce(); + pub fn AddResourceAttributeAce( + pAcl: PACL, + dwAceRevision: DWORD, + AceFlags: DWORD, + AccessMask: DWORD, pSid: PSID, + pAttributeInfo: PCLAIM_SECURITY_ATTRIBUTES_INFORMATION, + pReturnLength: PDWORD, + ) -> BOOL; + pub fn AddScopedPolicyIDAce( + pAcl: PACL, + dwAceRevision: DWORD, + AceFlags: DWORD, + AccessMask: DWORD, + pSid: PSID, + ) -> BOOL; + // pub fn AdjustTokenGroups(); + pub fn AdjustTokenPrivileges( + TokenHandle: HANDLE, + DisableAllPrivileges: BOOL, + NewState: PTOKEN_PRIVILEGES, + BufferLength: DWORD, + PreviousState: PTOKEN_PRIVILEGES, + ReturnLength: PDWORD, + ) -> BOOL; + // pub fn AllocateAndInitializeSid(); + pub fn AllocateLocallyUniqueId( + Luid: PLUID, + ) -> BOOL; + pub fn AreAllAccessesGranted( + GrantedAccess: DWORD, + DesiredAccess: DWORD, + ) -> BOOL; + pub fn AreAnyAccessesGranted( + GrantedAccess: DWORD, + DesiredAccess: DWORD, + ) -> BOOL; + pub fn CheckTokenMembershipEx( + TokenHandle: HANDLE, + SidToCheck: PSID, + Flags: DWORD, + IsMember: PBOOL, + ) -> BOOL; + pub fn CheckTokenCapability( + TokenHandle: HANDLE, + CapabilitySidToCheck: PSID, + HasCapability: PBOOL, + ) -> BOOL; + pub fn GetAppContainerAce( + Acl: PACL, + StartingAceIndex: DWORD, + AppContainerAce: *mut PVOID, + AppContainerAceIndex: *mut DWORD, + ) -> BOOL; + // pub fn CheckTokenMembershipEx(); + // pub fn ConvertToAutoInheritPrivateObjectSecurity(); + // pub fn CopySid(); + // pub fn CreatePrivateObjectSecurity(); + // pub fn CreatePrivateObjectSecurityEx(); + // pub fn CreatePrivateObjectSecurityWithMultipleInheritance(); + // pub fn CreateRestrictedToken(); + // pub fn CreateWellKnownSid(); + // pub fn EqualDomainSid(); + // pub fn DeleteAce(); + // pub fn DestroyPrivateObjectSecurity(); + // pub fn DuplicateToken(); + // pub fn DuplicateTokenEx(); + // pub fn EqualPrefixSid(); + // pub fn EqualSid(); + // pub fn FindFirstFreeAce(); + // pub fn FreeSid(); + // pub fn GetAce(); + // pub fn GetAclInformation(); + // pub fn GetFileSecurityW(); + // pub fn GetKernelObjectSecurity(); + // pub fn GetLengthSid(); + // pub fn GetPrivateObjectSecurity(); + // pub fn GetSecurityDescriptorControl(); + // pub fn GetSecurityDescriptorDacl(); + // pub fn GetSecurityDescriptorGroup(); + // pub fn GetSecurityDescriptorLength(); + // pub fn GetSecurityDescriptorOwner(); + // pub fn GetSecurityDescriptorRMControl(); + // pub fn GetSecurityDescriptorSacl(); + // pub fn GetSidIdentifierAuthority(); + // pub fn GetSidLengthRequired(); + // pub fn GetSidSubAuthority(); + // pub fn GetSidSubAuthorityCount(); + // pub fn GetTokenInformation(); + // pub fn GetWindowsAccountDomainSid(); + // pub fn ImpersonateAnonymousToken(); + // pub fn ImpersonateLoggedOnUser(); + // pub fn ImpersonateSelf(); + // pub fn InitializeAcl(); + // pub fn InitializeSecurityDescriptor(); + // pub fn InitializeSid(); + // pub fn IsTokenRestricted(); + // pub fn IsValidAcl(); + // pub fn IsValidSecurityDescriptor(); + // pub fn IsValidSid(); + // pub fn IsWellKnownSid(); + // pub fn MakeAbsoluteSD(); + // pub fn MakeSelfRelativeSD(); + // pub fn MapGenericMask(); + // pub fn ObjectCloseAuditAlarmW(); + // pub fn ObjectDeleteAuditAlarmW(); + // pub fn ObjectOpenAuditAlarmW(); + // pub fn ObjectPrivilegeAuditAlarmW(); + // pub fn PrivilegeCheck(); + // pub fn PrivilegedServiceAuditAlarmW(); + // pub fn QuerySecurityAccessMask(); + // pub fn RevertToSelf(); + // pub fn SetAclInformation(); + // pub fn SetFileSecurityW(); + // pub fn SetKernelObjectSecurity(); + // pub fn SetPrivateObjectSecurity(); + // pub fn SetPrivateObjectSecurityEx(); + // pub fn SetSecurityAccessMask(); + // pub fn SetSecurityDescriptorControl(); + // pub fn SetSecurityDescriptorDacl(); + // pub fn SetSecurityDescriptorGroup(); + // pub fn SetSecurityDescriptorOwner(); + // pub fn SetSecurityDescriptorRMControl(); + // pub fn SetSecurityDescriptorSacl(); + // pub fn SetTokenInformation(); + pub fn SetCachedSigningLevel( + SourceFiles: PHANDLE, + SourceFileCount: ULONG, + Flags: ULONG, + TargetFile: HANDLE, + ) -> BOOL; + pub fn GetCachedSigningLevel( + File: HANDLE, + Flags: PULONG, + SigningLevel: PULONG, + Thumbprint: PUCHAR, + ThumbprintSize: PULONG, + ThumbprintAlgorithm: PULONG, + ) -> BOOL; + // pub fn CveEventWrite(); +} diff --git a/src/vendor/winapi/src/um/servprov.rs b/src/vendor/winapi/src/um/servprov.rs new file mode 100644 index 0000000000..0e40eeb2b0 --- /dev/null +++ b/src/vendor/winapi/src/um/servprov.rs @@ -0,0 +1,24 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_void; +use shared::guiddef::{REFGUID, REFIID}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::HRESULT; +pub type LPSERVICEPROVIDER = *mut IServiceProvider; +RIDL!(#[uuid(0x6d5140c1, 0x7436, 0x11ce, 0x80, 0x34, 0x00, 0xaa, 0x00, 0x60, 0x09, 0xfa)] +interface IServiceProvider(IServiceProviderVtbl): IUnknown(IUnknownVtbl) { + fn QueryService( + guidService: REFGUID, + riid: REFIID, + ppvObject: *mut *mut c_void, + ) -> HRESULT, + fn RemoteQueryService( + guidService: REFGUID, + riid: REFIID, + ppvObject: *mut *mut IUnknown, + ) -> HRESULT, +}); diff --git a/src/vendor/winapi/src/um/setupapi.rs b/src/vendor/winapi/src/um/setupapi.rs new file mode 100644 index 0000000000..a16de9b27b --- /dev/null +++ b/src/vendor/winapi/src/um/setupapi.rs @@ -0,0 +1,3573 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Public header file for Windows NT Setup and Device Installer services Dll. +use ctypes::c_int; +use shared::basetsd::{DWORD_PTR, UINT_PTR, ULONG_PTR}; +use shared::devpropdef::{DEVPROPKEY, DEVPROPTYPE}; +use shared::guiddef::{GUID, LPGUID}; +use shared::minwindef::{ + BOOL, BYTE, DWORD, FILETIME, HINSTANCE, HKEY, INT, LPARAM, LPCVOID, LPDWORD, MAX_PATH, PBOOL, + PBYTE, PDWORD, PINT, PUINT, UINT, USHORT, WORD, +}; +use shared::windef::{HDC, HICON, HWND, RECT}; +use um::commctrl::HIMAGELIST; +use um::prsht::{HPROPSHEETPAGE, LPPROPSHEETHEADERA, LPPROPSHEETHEADERW}; +use um::spapidef::SP_LOG_TOKEN; +use um::winnt::{ + ANYSIZE_ARRAY, APPLICATION_ERROR_MASK, CHAR, DWORDLONG, ERROR_SEVERITY_ERROR, HANDLE, LONG, + LONGLONG, LPCSTR, LPCWSTR, PCSTR, PCWSTR, PSTR, PVOID, PWSTR, WCHAR, +}; +use um::winreg::REGSAM; +pub const LINE_LEN: usize = 256; +pub const MAX_INF_STRING_LENGTH: usize = 4096; +pub const MAX_INF_SECTION_NAME_LENGTH: usize = 255; +pub const MAX_TITLE_LEN: usize = 60; +pub const MAX_INSTRUCTION_LEN: usize = 256; +pub const MAX_LABEL_LEN: usize = 30; +pub const MAX_SERVICE_NAME_LEN: usize = 256; +pub const MAX_SUBTITLE_LEN: usize = 256; +pub const SP_MAX_MACHINENAME_LENGTH: usize = MAX_PATH + 3; +pub type HINF = PVOID; +STRUCT!{struct INFCONTEXT { + Inf: PVOID, + CurrentInf: PVOID, + Section: UINT, + Line: UINT, +}} +pub type PINFCONTEXT = *mut INFCONTEXT; +STRUCT!{struct SP_INF_INFORMATION { + InfStyle: DWORD, + InfCount: DWORD, + VersionData: [BYTE; ANYSIZE_ARRAY], +}} +pub type PSP_INF_INFORMATION = *mut SP_INF_INFORMATION; +UNION!{union SP_ALTPLATFORM_INFO_V3_u { + [u16; 1], + Reserved Reserved_mut: WORD, + Flags Flags_mut: WORD, +}} +STRUCT!{struct SP_ALTPLATFORM_INFO_V3 { + cbSize: DWORD, + Platform: DWORD, + MajorVersion: DWORD, + MinorVersion: DWORD, + ProcessorArchitecture: WORD, + u: SP_ALTPLATFORM_INFO_V3_u, + FirstValidatedMajorVersion: DWORD, + FirstValidatedMinorVersion: DWORD, + ProductType: BYTE, + SuiteMask: WORD, + BuildNumber: DWORD, +}} +pub type PSP_ALTPLATFORM_INFO_V3 = *mut SP_ALTPLATFORM_INFO_V3; +UNION!{union SP_ALTPLATFORM_INFO_V2_u { + [u16; 1], + Reserved Reserved_mut: WORD, + Flags Flags_mut: WORD, +}} +STRUCT!{struct SP_ALTPLATFORM_INFO_V2 { + cbSize: DWORD, + Platform: DWORD, + MajorVersion: DWORD, + MinorVersion: DWORD, + ProcessorArchitecture: WORD, + u: SP_ALTPLATFORM_INFO_V2_u, + FirstValidatedMajorVersion: DWORD, + FirstValidatedMinorVersion: DWORD, +}} +pub type PSP_ALTPLATFORM_INFO_V2 = *mut SP_ALTPLATFORM_INFO_V2; +STRUCT!{struct SP_ALTPLATFORM_INFO_V1 { + cbSize: DWORD, + Platform: DWORD, + MajorVersion: DWORD, + MinorVersion: DWORD, + ProcessorArchitecture: WORD, + Reserved: WORD, +}} +pub type PSP_ALTPLATFORM_INFO_V1 = *mut SP_ALTPLATFORM_INFO_V1; +pub type SP_ALTPLATFORM_INFO = SP_ALTPLATFORM_INFO_V2; +pub type PSP_ALTPLATFORM_INFO = PSP_ALTPLATFORM_INFO_V2; +pub const SP_ALTPLATFORM_FLAGS_VERSION_RANGE: WORD = 0x0001; +pub const SP_ALTPLATFORM_FLAGS_SUITE_MASK: WORD = 0x0002; +STRUCT!{struct SP_ORIGINAL_FILE_INFO_A { + cbSize: DWORD, + OriginalInfName: [CHAR; MAX_PATH], + OriginalCatalogName: [CHAR; MAX_PATH], +}} +pub type PSP_ORIGINAL_FILE_INFO_A = *mut SP_ORIGINAL_FILE_INFO_A; +STRUCT!{struct SP_ORIGINAL_FILE_INFO_W { + cbSize: DWORD, + OriginalInfName: [WCHAR; MAX_PATH], + OriginalCatalogName: [WCHAR; MAX_PATH], +}} +pub type PSP_ORIGINAL_FILE_INFO_W = *mut SP_ORIGINAL_FILE_INFO_W; +pub const INF_STYLE_NONE: DWORD = 0x00000000; +pub const INF_STYLE_OLDNT: DWORD = 0x00000001; +pub const INF_STYLE_WIN4: DWORD = 0x00000002; +pub const INF_STYLE_CACHE_ENABLE: DWORD = 0x00000010; +pub const INF_STYLE_CACHE_DISABLE: DWORD = 0x00000020; +pub const INF_STYLE_CACHE_IGNORE: DWORD = 0x00000040; +pub const DIRID_ABSOLUTE: DWORD = -1i32 as u32; +pub const DIRID_ABSOLUTE_16BIT: DWORD = 0xffff; +pub const DIRID_NULL: DWORD = 0; +pub const DIRID_SRCPATH: DWORD = 1; +pub const DIRID_WINDOWS: DWORD = 10; +pub const DIRID_SYSTEM: DWORD = 11; +pub const DIRID_DRIVERS: DWORD = 12; +pub const DIRID_IOSUBSYS: DWORD = DIRID_DRIVERS; +pub const DIRID_DRIVER_STORE: DWORD = 13; +pub const DIRID_INF: DWORD = 17; +pub const DIRID_HELP: DWORD = 18; +pub const DIRID_FONTS: DWORD = 20; +pub const DIRID_VIEWERS: DWORD = 21; +pub const DIRID_COLOR: DWORD = 23; +pub const DIRID_APPS: DWORD = 24; +pub const DIRID_SHARED: DWORD = 25; +pub const DIRID_BOOT: DWORD = 30; +pub const DIRID_SYSTEM16: DWORD = 50; +pub const DIRID_SPOOL: DWORD = 51; +pub const DIRID_SPOOLDRIVERS: DWORD = 52; +pub const DIRID_USERPROFILE: DWORD = 53; +pub const DIRID_LOADER: DWORD = 54; +pub const DIRID_PRINTPROCESSOR: DWORD = 55; +pub const DIRID_DEFAULT: DWORD = DIRID_SYSTEM; +pub const DIRID_COMMON_STARTMENU: DWORD = 16406; +pub const DIRID_COMMON_PROGRAMS: DWORD = 16407; +pub const DIRID_COMMON_STARTUP: DWORD = 16408; +pub const DIRID_COMMON_DESKTOPDIRECTORY: DWORD = 16409; +pub const DIRID_COMMON_FAVORITES: DWORD = 16415; +pub const DIRID_COMMON_APPDATA: DWORD = 16419; +pub const DIRID_PROGRAM_FILES: DWORD = 16422; +pub const DIRID_SYSTEM_X86: DWORD = 16425; +pub const DIRID_PROGRAM_FILES_X86: DWORD = 16426; +pub const DIRID_PROGRAM_FILES_COMMON: DWORD = 16427; +pub const DIRID_PROGRAM_FILES_COMMONX86: DWORD = 16428; +pub const DIRID_COMMON_TEMPLATES: DWORD = 16429; +pub const DIRID_COMMON_DOCUMENTS: DWORD = 16430; +pub const DIRID_USER: DWORD = 0x8000; +FN!{stdcall PSP_FILE_CALLBACK_A( + Context: PVOID, + Notification: UINT, + Param1: UINT_PTR, + Param2: UINT_PTR, +) -> UINT} +FN!{stdcall PSP_FILE_CALLBACK_W( + Context: PVOID, + Notification: UINT, + Param1: UINT_PTR, + Param2: UINT_PTR, +) -> UINT} +pub const SPFILENOTIFY_STARTQUEUE: UINT = 0x00000001; +pub const SPFILENOTIFY_ENDQUEUE: UINT = 0x00000002; +pub const SPFILENOTIFY_STARTSUBQUEUE: UINT = 0x00000003; +pub const SPFILENOTIFY_ENDSUBQUEUE: UINT = 0x00000004; +pub const SPFILENOTIFY_STARTDELETE: UINT = 0x00000005; +pub const SPFILENOTIFY_ENDDELETE: UINT = 0x00000006; +pub const SPFILENOTIFY_DELETEERROR: UINT = 0x00000007; +pub const SPFILENOTIFY_STARTRENAME: UINT = 0x00000008; +pub const SPFILENOTIFY_ENDRENAME: UINT = 0x00000009; +pub const SPFILENOTIFY_RENAMEERROR: UINT = 0x0000000a; +pub const SPFILENOTIFY_STARTCOPY: UINT = 0x0000000b; +pub const SPFILENOTIFY_ENDCOPY: UINT = 0x0000000c; +pub const SPFILENOTIFY_COPYERROR: UINT = 0x0000000d; +pub const SPFILENOTIFY_NEEDMEDIA: UINT = 0x0000000e; +pub const SPFILENOTIFY_QUEUESCAN: UINT = 0x0000000f; +pub const SPFILENOTIFY_CABINETINFO: UINT = 0x00000010; +pub const SPFILENOTIFY_FILEINCABINET: UINT = 0x00000011; +pub const SPFILENOTIFY_NEEDNEWCABINET: UINT = 0x00000012; +pub const SPFILENOTIFY_FILEEXTRACTED: UINT = 0x00000013; +pub const SPFILENOTIFY_FILEOPDELAYED: UINT = 0x00000014; +pub const SPFILENOTIFY_STARTBACKUP: UINT = 0x00000015; +pub const SPFILENOTIFY_BACKUPERROR: UINT = 0x00000016; +pub const SPFILENOTIFY_ENDBACKUP: UINT = 0x00000017; +pub const SPFILENOTIFY_QUEUESCAN_EX: UINT = 0x00000018; +pub const SPFILENOTIFY_STARTREGISTRATION: UINT = 0x00000019; +pub const SPFILENOTIFY_ENDREGISTRATION: UINT = 0x00000020; +pub const SPFILENOTIFY_QUEUESCAN_SIGNERINFO: UINT = 0x00000040; +pub const SPFILENOTIFY_LANGMISMATCH: UINT = 0x00010000; +pub const SPFILENOTIFY_TARGETEXISTS: UINT = 0x00020000; +pub const SPFILENOTIFY_TARGETNEWER: UINT = 0x00040000; +pub const FILEOP_COPY: UINT = 0; +pub const FILEOP_RENAME: UINT = 1; +pub const FILEOP_DELETE: UINT = 2; +pub const FILEOP_BACKUP: UINT = 3; +pub const FILEOP_ABORT: UINT = 0; +pub const FILEOP_DOIT: UINT = 1; +pub const FILEOP_SKIP: UINT = 2; +pub const FILEOP_RETRY: UINT = FILEOP_DOIT; +pub const FILEOP_NEWPATH: UINT = 4; +pub const COPYFLG_WARN_IF_SKIP: UINT = 0x00000001; +pub const COPYFLG_NOSKIP: UINT = 0x00000002; +pub const COPYFLG_NOVERSIONCHECK: UINT = 0x00000004; +pub const COPYFLG_FORCE_FILE_IN_USE: UINT = 0x00000008; +pub const COPYFLG_NO_OVERWRITE: UINT = 0x00000010; +pub const COPYFLG_NO_VERSION_DIALOG: UINT = 0x00000020; +pub const COPYFLG_OVERWRITE_OLDER_ONLY: UINT = 0x00000040; +pub const COPYFLG_PROTECTED_WINDOWS_DRIVER_FILE: UINT = 0x00000100; +pub const COPYFLG_REPLACEONLY: UINT = 0x00000400; +pub const COPYFLG_NODECOMP: UINT = 0x00000800; +pub const COPYFLG_REPLACE_BOOT_FILE: UINT = 0x00001000; +pub const COPYFLG_NOPRUNE: UINT = 0x00002000; +pub const COPYFLG_IN_USE_TRY_RENAME: UINT = 0x00004000; +pub const DELFLG_IN_USE: UINT = 0x00000001; +pub const DELFLG_IN_USE1: UINT = 0x00010000; +STRUCT!{struct FILEPATHS_A { + Target: PCSTR, + Source: PCSTR, + Win32Error: UINT, + Flags: DWORD, +}} +pub type PFILEPATHS_A = *mut FILEPATHS_A; +STRUCT!{struct FILEPATHS_W { + Target: PCWSTR, + Source: PCWSTR, + Win32Error: UINT, + Flags: DWORD, +}} +pub type PFILEPATHS_W = *mut FILEPATHS_W; +STRUCT!{struct FILEPATHS_SIGNERINFO_A { + Target: PCSTR, + Source: PCSTR, + Win32Error: UINT, + Flags: DWORD, + DigitalSigner: PCSTR, + Version: PCSTR, + CatalogFile: PCSTR, +}} +pub type PFILEPATHS_SIGNERINFO_A = *mut FILEPATHS_SIGNERINFO_A; +STRUCT!{struct FILEPATHS_SIGNERINFO_W { + Target: PCWSTR, + Source: PCWSTR, + Win32Error: UINT, + Flags: DWORD, + DigitalSigner: PCWSTR, + Version: PCWSTR, + CatalogFile: PCWSTR, +}} +pub type PFILEPATHS_SIGNERINFO_W = *mut FILEPATHS_SIGNERINFO_W; +STRUCT!{struct SOURCE_MEDIA_A { + Reserved: PCSTR, + Tagfile: PCSTR, + Description: PCSTR, + SourcePath: PCSTR, + SourceFile: PCSTR, + Flags: DWORD, +}} +pub type PSOURCE_MEDIA_A = *mut SOURCE_MEDIA_A; +STRUCT!{struct SOURCE_MEDIA_W { + Reserved: PCWSTR, + Tagfile: PCWSTR, + Description: PCWSTR, + SourcePath: PCWSTR, + SourceFile: PCWSTR, + Flags: DWORD, +}} +pub type PSOURCE_MEDIA_W = *mut SOURCE_MEDIA_W; +STRUCT!{struct CABINET_INFO_A { + CabinetPath: PCSTR, + CabinetFile: PCSTR, + DiskName: PCSTR, + SetId: USHORT, + CabinetNumber: USHORT, +}} +pub type PCABINET_INFO_A = *mut CABINET_INFO_A; +STRUCT!{struct CABINET_INFO_W { + CabinetPath: PCWSTR, + CabinetFile: PCWSTR, + DiskName: PCWSTR, + SetId: USHORT, + CabinetNumber: USHORT, +}} +pub type PCABINET_INFO_W = *mut CABINET_INFO_W; +STRUCT!{struct FILE_IN_CABINET_INFO_A { + NameInCabinet: PCSTR, + FileSize: DWORD, + Win32Error: DWORD, + DosDate: WORD, + DosTime: WORD, + DosAttribs: WORD, + FullTargetName: [CHAR; MAX_PATH], +}} +pub type PFILE_IN_CABINET_INFO_A = *mut FILE_IN_CABINET_INFO_A; +STRUCT!{struct FILE_IN_CABINET_INFO_W { + NameInCabinet: PCWSTR, + FileSize: DWORD, + Win32Error: DWORD, + DosDate: WORD, + DosTime: WORD, + DosAttribs: WORD, + FullTargetName: [WCHAR; MAX_PATH], +}} +pub type PFILE_IN_CABINET_INFO_W = *mut FILE_IN_CABINET_INFO_W; +STRUCT!{struct SP_REGISTER_CONTROL_STATUSA { + cbSize: DWORD, + FileName: PCSTR, + Win32Error: DWORD, + FailureCode: DWORD, +}} +pub type PSP_REGISTER_CONTROL_STATUSA = *mut SP_REGISTER_CONTROL_STATUSA; +STRUCT!{struct SP_REGISTER_CONTROL_STATUSW { + cbSize: DWORD, + FileName: PCWSTR, + Win32Error: DWORD, + FailureCode: DWORD, +}} +pub type PSP_REGISTER_CONTROL_STATUSW = *mut SP_REGISTER_CONTROL_STATUSW; +pub const SPREG_SUCCESS: DWORD = 0x00000000; +pub const SPREG_LOADLIBRARY: DWORD = 0x00000001; +pub const SPREG_GETPROCADDR: DWORD = 0x00000002; +pub const SPREG_REGSVR: DWORD = 0x00000003; +pub const SPREG_DLLINSTALL: DWORD = 0x00000004; +pub const SPREG_TIMEOUT: DWORD = 0x00000005; +pub const SPREG_UNKNOWN: DWORD = 0xFFFFFFFF; +pub type HSPFILEQ = PVOID; +STRUCT!{struct SP_FILE_COPY_PARAMS_A { + cbSize: DWORD, + QueueHandle: HSPFILEQ, + SourceRootPath: PCSTR, + SourcePath: PCSTR, + SourceFilename: PCSTR, + SourceDescription: PCSTR, + SourceTagfile: PCSTR, + TargetDirectory: PCSTR, + TargetFilename: PCSTR, + CopyStyle: DWORD, + LayoutInf: HINF, + SecurityDescriptor: PCSTR, +}} +pub type PSP_FILE_COPY_PARAMS_A = *mut SP_FILE_COPY_PARAMS_A; +STRUCT!{struct SP_FILE_COPY_PARAMS_W { + cbSize: DWORD, + QueueHandle: HSPFILEQ, + SourceRootPath: PCWSTR, + SourcePath: PCWSTR, + SourceFilename: PCWSTR, + SourceDescription: PCWSTR, + SourceTagfile: PCWSTR, + TargetDirectory: PCWSTR, + TargetFilename: PCWSTR, + CopyStyle: DWORD, + LayoutInf: HINF, + SecurityDescriptor: PCWSTR, +}} +pub type PSP_FILE_COPY_PARAMS_W = *mut SP_FILE_COPY_PARAMS_W; +pub type HDSKSPC = PVOID; +pub type HDEVINFO = PVOID; +STRUCT!{struct SP_DEVINFO_DATA { + cbSize: DWORD, + ClassGuid: GUID, + DevInst: DWORD, + Reserved: ULONG_PTR, +}} +pub type PSP_DEVINFO_DATA = *mut SP_DEVINFO_DATA; +STRUCT!{struct SP_DEVICE_INTERFACE_DATA { + cbSize: DWORD, + InterfaceClassGuid: GUID, + Flags: DWORD, + Reserved: ULONG_PTR, +}} +pub type PSP_DEVICE_INTERFACE_DATA = *mut SP_DEVICE_INTERFACE_DATA; +pub const SPINT_ACTIVE: DWORD = 0x00000001; +pub const SPINT_DEFAULT: DWORD = 0x00000002; +pub const SPINT_REMOVED: DWORD = 0x00000004; +pub type SP_INTERFACE_DEVICE_DATA = SP_DEVICE_INTERFACE_DATA; +pub type PSP_INTERFACE_DEVICE_DATA = PSP_DEVICE_INTERFACE_DATA; +pub const SPID_ACTIVE: DWORD = SPINT_ACTIVE; +pub const SPID_DEFAULT: DWORD = SPINT_DEFAULT; +pub const SPID_REMOVED: DWORD = SPINT_REMOVED; +STRUCT!{struct SP_DEVICE_INTERFACE_DETAIL_DATA_A { + cbSize: DWORD, + DevicePath: [CHAR; ANYSIZE_ARRAY], +}} +pub type PSP_DEVICE_INTERFACE_DETAIL_DATA_A = *mut SP_DEVICE_INTERFACE_DETAIL_DATA_A; +STRUCT!{struct SP_DEVICE_INTERFACE_DETAIL_DATA_W { + cbSize: DWORD, + DevicePath: [WCHAR; ANYSIZE_ARRAY], +}} +pub type PSP_DEVICE_INTERFACE_DETAIL_DATA_W = *mut SP_DEVICE_INTERFACE_DETAIL_DATA_W; +STRUCT!{struct SP_DEVINFO_LIST_DETAIL_DATA_A { + cbSize: DWORD, + ClassGuid: GUID, + RemoteMachineHandle: HANDLE, + RemoteMachineName: [CHAR; SP_MAX_MACHINENAME_LENGTH], +}} +pub type PSP_DEVINFO_LIST_DETAIL_DATA_A = *mut SP_DEVINFO_LIST_DETAIL_DATA_A; +STRUCT!{struct SP_DEVINFO_LIST_DETAIL_DATA_W { + cbSize: DWORD, + ClassGuid: GUID, + RemoteMachineHandle: HANDLE, + RemoteMachineName: [WCHAR; SP_MAX_MACHINENAME_LENGTH], +}} +pub type PSP_DEVINFO_LIST_DETAIL_DATA_W = *mut SP_DEVINFO_LIST_DETAIL_DATA_W; +pub const DIF_SELECTDEVICE: DI_FUNCTION = 0x00000001; +pub const DIF_INSTALLDEVICE: DI_FUNCTION = 0x00000002; +pub const DIF_ASSIGNRESOURCES: DI_FUNCTION = 0x00000003; +pub const DIF_PROPERTIES: DI_FUNCTION = 0x00000004; +pub const DIF_REMOVE: DI_FUNCTION = 0x00000005; +pub const DIF_FIRSTTIMESETUP: DI_FUNCTION = 0x00000006; +pub const DIF_FOUNDDEVICE: DI_FUNCTION = 0x00000007; +pub const DIF_SELECTCLASSDRIVERS: DI_FUNCTION = 0x00000008; +pub const DIF_VALIDATECLASSDRIVERS: DI_FUNCTION = 0x00000009; +pub const DIF_INSTALLCLASSDRIVERS: DI_FUNCTION = 0x0000000A; +pub const DIF_CALCDISKSPACE: DI_FUNCTION = 0x0000000B; +pub const DIF_DESTROYPRIVATEDATA: DI_FUNCTION = 0x0000000C; +pub const DIF_VALIDATEDRIVER: DI_FUNCTION = 0x0000000D; +pub const DIF_DETECT: DI_FUNCTION = 0x0000000F; +pub const DIF_INSTALLWIZARD: DI_FUNCTION = 0x00000010; +pub const DIF_DESTROYWIZARDDATA: DI_FUNCTION = 0x00000011; +pub const DIF_PROPERTYCHANGE: DI_FUNCTION = 0x00000012; +pub const DIF_ENABLECLASS: DI_FUNCTION = 0x00000013; +pub const DIF_DETECTVERIFY: DI_FUNCTION = 0x00000014; +pub const DIF_INSTALLDEVICEFILES: DI_FUNCTION = 0x00000015; +pub const DIF_UNREMOVE: DI_FUNCTION = 0x00000016; +pub const DIF_SELECTBESTCOMPATDRV: DI_FUNCTION = 0x00000017; +pub const DIF_ALLOW_INSTALL: DI_FUNCTION = 0x00000018; +pub const DIF_REGISTERDEVICE: DI_FUNCTION = 0x00000019; +pub const DIF_NEWDEVICEWIZARD_PRESELECT: DI_FUNCTION = 0x0000001A; +pub const DIF_NEWDEVICEWIZARD_SELECT: DI_FUNCTION = 0x0000001B; +pub const DIF_NEWDEVICEWIZARD_PREANALYZE: DI_FUNCTION = 0x0000001C; +pub const DIF_NEWDEVICEWIZARD_POSTANALYZE: DI_FUNCTION = 0x0000001D; +pub const DIF_NEWDEVICEWIZARD_FINISHINSTALL: DI_FUNCTION = 0x0000001E; +pub const DIF_UNUSED1: DI_FUNCTION = 0x0000001F; +pub const DIF_INSTALLINTERFACES: DI_FUNCTION = 0x00000020; +pub const DIF_DETECTCANCEL: DI_FUNCTION = 0x00000021; +pub const DIF_REGISTER_COINSTALLERS: DI_FUNCTION = 0x00000022; +pub const DIF_ADDPROPERTYPAGE_ADVANCED: DI_FUNCTION = 0x00000023; +pub const DIF_ADDPROPERTYPAGE_BASIC: DI_FUNCTION = 0x00000024; +pub const DIF_RESERVED1: DI_FUNCTION = 0x00000025; +pub const DIF_TROUBLESHOOTER: DI_FUNCTION = 0x00000026; +pub const DIF_POWERMESSAGEWAKE: DI_FUNCTION = 0x00000027; +pub const DIF_ADDREMOTEPROPERTYPAGE_ADVANCED: DI_FUNCTION = 0x00000028; +pub const DIF_UPDATEDRIVER_UI: DI_FUNCTION = 0x00000029; +pub const DIF_FINISHINSTALL_ACTION: DI_FUNCTION = 0x0000002A; +pub const DIF_RESERVED2: DI_FUNCTION = 0x00000030; +pub const DIF_MOVEDEVICE: DI_FUNCTION = 0x0000000E; +pub type DI_FUNCTION = UINT; +STRUCT!{struct SP_DEVINSTALL_PARAMS_A { + cbSize: DWORD, + Flags: DWORD, + FlagsEx: DWORD, + hwndParent: HWND, + InstallMsgHandler: PSP_FILE_CALLBACK_A, + InstallMsgHandlerContext: PVOID, + FileQueue: HSPFILEQ, + ClassInstallReserved: ULONG_PTR, + Reserved: DWORD, + DriverPath: [CHAR; MAX_PATH], +}} +pub type PSP_DEVINSTALL_PARAMS_A = *mut SP_DEVINSTALL_PARAMS_A; +STRUCT!{struct SP_DEVINSTALL_PARAMS_W { + cbSize: DWORD, + Flags: DWORD, + FlagsEx: DWORD, + hwndParent: HWND, + InstallMsgHandler: PSP_FILE_CALLBACK_W, + InstallMsgHandlerContext: PVOID, + FileQueue: HSPFILEQ, + ClassInstallReserved: ULONG_PTR, + Reserved: DWORD, + DriverPath: [WCHAR; MAX_PATH], +}} +pub type PSP_DEVINSTALL_PARAMS_W = *mut SP_DEVINSTALL_PARAMS_W; +pub const DI_SHOWOEM: DWORD = 0x00000001; +pub const DI_SHOWCOMPAT: DWORD = 0x00000002; +pub const DI_SHOWCLASS: DWORD = 0x00000004; +pub const DI_SHOWALL: DWORD = 0x00000007; +pub const DI_NOVCP: DWORD = 0x00000008; +pub const DI_DIDCOMPAT: DWORD = 0x00000010; +pub const DI_DIDCLASS: DWORD = 0x00000020; +pub const DI_AUTOASSIGNRES: DWORD = 0x00000040; +pub const DI_NEEDRESTART: DWORD = 0x00000080; +pub const DI_NEEDREBOOT: DWORD = 0x00000100; +pub const DI_NOBROWSE: DWORD = 0x00000200; +pub const DI_MULTMFGS: DWORD = 0x00000400; +pub const DI_DISABLED: DWORD = 0x00000800; +pub const DI_GENERALPAGE_ADDED: DWORD = 0x00001000; +pub const DI_RESOURCEPAGE_ADDED: DWORD = 0x00002000; +pub const DI_PROPERTIES_CHANGE: DWORD = 0x00004000; +pub const DI_INF_IS_SORTED: DWORD = 0x00008000; +pub const DI_ENUMSINGLEINF: DWORD = 0x00010000; +pub const DI_DONOTCALLCONFIGMG: DWORD = 0x00020000; +pub const DI_INSTALLDISABLED: DWORD = 0x00040000; +pub const DI_COMPAT_FROM_CLASS: DWORD = 0x00080000; +pub const DI_CLASSINSTALLPARAMS: DWORD = 0x00100000; +pub const DI_NODI_DEFAULTACTION: DWORD = 0x00200000; +pub const DI_QUIETINSTALL: DWORD = 0x00800000; +pub const DI_NOFILECOPY: DWORD = 0x01000000; +pub const DI_FORCECOPY: DWORD = 0x02000000; +pub const DI_DRIVERPAGE_ADDED: DWORD = 0x04000000; +pub const DI_USECI_SELECTSTRINGS: DWORD = 0x08000000; +pub const DI_OVERRIDE_INFFLAGS: DWORD = 0x10000000; +pub const DI_PROPS_NOCHANGEUSAGE: DWORD = 0x20000000; +pub const DI_NOSELECTICONS: DWORD = 0x40000000; +pub const DI_NOWRITE_IDS: DWORD = 0x80000000; +pub const DI_FLAGSEX_RESERVED2: DWORD = 0x00000001; +pub const DI_FLAGSEX_RESERVED3: DWORD = 0x00000002; +pub const DI_FLAGSEX_CI_FAILED: DWORD = 0x00000004; +pub const DI_FLAGSEX_FINISHINSTALL_ACTION: DWORD = 0x00000008; +pub const DI_FLAGSEX_DIDINFOLIST: DWORD = 0x00000010; +pub const DI_FLAGSEX_DIDCOMPATINFO: DWORD = 0x00000020; +pub const DI_FLAGSEX_FILTERCLASSES: DWORD = 0x00000040; +pub const DI_FLAGSEX_SETFAILEDINSTALL: DWORD = 0x00000080; +pub const DI_FLAGSEX_DEVICECHANGE: DWORD = 0x00000100; +pub const DI_FLAGSEX_ALWAYSWRITEIDS: DWORD = 0x00000200; +pub const DI_FLAGSEX_PROPCHANGE_PENDING: DWORD = 0x00000400; +pub const DI_FLAGSEX_ALLOWEXCLUDEDDRVS: DWORD = 0x00000800; +pub const DI_FLAGSEX_NOUIONQUERYREMOVE: DWORD = 0x00001000; +pub const DI_FLAGSEX_USECLASSFORCOMPAT: DWORD = 0x00002000; +pub const DI_FLAGSEX_RESERVED4: DWORD = 0x00004000; +pub const DI_FLAGSEX_NO_DRVREG_MODIFY: DWORD = 0x00008000; +pub const DI_FLAGSEX_IN_SYSTEM_SETUP: DWORD = 0x00010000; +pub const DI_FLAGSEX_INET_DRIVER: DWORD = 0x00020000; +pub const DI_FLAGSEX_APPENDDRIVERLIST: DWORD = 0x00040000; +pub const DI_FLAGSEX_PREINSTALLBACKUP: DWORD = 0x00080000; +pub const DI_FLAGSEX_BACKUPONREPLACE: DWORD = 0x00100000; +pub const DI_FLAGSEX_DRIVERLIST_FROM_URL: DWORD = 0x00200000; +pub const DI_FLAGSEX_RESERVED1: DWORD = 0x00400000; +pub const DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS: DWORD = 0x00800000; +pub const DI_FLAGSEX_POWERPAGE_ADDED: DWORD = 0x01000000; +pub const DI_FLAGSEX_FILTERSIMILARDRIVERS: DWORD = 0x02000000; +pub const DI_FLAGSEX_INSTALLEDDRIVER: DWORD = 0x04000000; +pub const DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE: DWORD = 0x08000000; +pub const DI_FLAGSEX_ALTPLATFORM_DRVSEARCH: DWORD = 0x10000000; +pub const DI_FLAGSEX_RESTART_DEVICE_ONLY: DWORD = 0x20000000; +pub const DI_FLAGSEX_RECURSIVESEARCH: DWORD = 0x40000000; +pub const DI_FLAGSEX_SEARCH_PUBLISHED_INFS: DWORD = 0x80000000; +STRUCT!{struct SP_CLASSINSTALL_HEADER { + cbSize: DWORD, + InstallFunction: DI_FUNCTION, +}} +pub type PSP_CLASSINSTALL_HEADER = *mut SP_CLASSINSTALL_HEADER; +STRUCT!{struct SP_ENABLECLASS_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + ClassGuid: GUID, + EnableMessage: DWORD, +}} +pub type PSP_ENABLECLASS_PARAMS = *mut SP_ENABLECLASS_PARAMS; +pub const ENABLECLASS_QUERY: DWORD = 0; +pub const ENABLECLASS_SUCCESS: DWORD = 1; +pub const ENABLECLASS_FAILURE: DWORD = 2; +pub const DICS_ENABLE: DWORD = 0x00000001; +pub const DICS_DISABLE: DWORD = 0x00000002; +pub const DICS_PROPCHANGE: DWORD = 0x00000003; +pub const DICS_START: DWORD = 0x00000004; +pub const DICS_STOP: DWORD = 0x00000005; +pub const DICS_FLAG_GLOBAL: DWORD = 0x00000001; +pub const DICS_FLAG_CONFIGSPECIFIC: DWORD = 0x00000002; +pub const DICS_FLAG_CONFIGGENERAL: DWORD = 0x00000004; +STRUCT!{struct SP_PROPCHANGE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + StateChange: DWORD, + Scope: DWORD, + HwProfile: DWORD, +}} +pub type PSP_PROPCHANGE_PARAMS = *mut SP_PROPCHANGE_PARAMS; +STRUCT!{struct SP_REMOVEDEVICE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Scope: DWORD, + HwProfile: DWORD, +}} +pub type PSP_REMOVEDEVICE_PARAMS = *mut SP_REMOVEDEVICE_PARAMS; +pub const DI_REMOVEDEVICE_GLOBAL: DWORD = 0x00000001; +pub const DI_REMOVEDEVICE_CONFIGSPECIFIC: DWORD = 0x00000002; +STRUCT!{struct SP_UNREMOVEDEVICE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Scope: DWORD, + HwProfile: DWORD, +}} +pub type PSP_UNREMOVEDEVICE_PARAMS = *mut SP_UNREMOVEDEVICE_PARAMS; +pub const DI_UNREMOVEDEVICE_CONFIGSPECIFIC: DWORD = 0x00000002; +STRUCT!{struct SP_SELECTDEVICE_PARAMS_A { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Title: [CHAR; MAX_TITLE_LEN], + Instructions: [CHAR; MAX_INSTRUCTION_LEN], + ListLabel: [CHAR; MAX_LABEL_LEN], + SubTitle: [CHAR; MAX_SUBTITLE_LEN], + Reserved: [BYTE; 2], +}} +pub type PSP_SELECTDEVICE_PARAMS_A = *mut SP_SELECTDEVICE_PARAMS_A; +STRUCT!{struct SP_SELECTDEVICE_PARAMS_W { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Title: [WCHAR; MAX_TITLE_LEN], + Instructions: [WCHAR; MAX_INSTRUCTION_LEN], + ListLabel: [WCHAR; MAX_LABEL_LEN], + SubTitle: [WCHAR; MAX_SUBTITLE_LEN], +}} +pub type PSP_SELECTDEVICE_PARAMS_W = *mut SP_SELECTDEVICE_PARAMS_W; +FN!{stdcall PDETECT_PROGRESS_NOTIFY( + ProgressNotifyParam: PVOID, + DetectComplete: DWORD, +) -> BOOL} +STRUCT!{struct SP_DETECTDEVICE_PARAMS { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + DetectProgressNotify: PDETECT_PROGRESS_NOTIFY, + ProgressNotifyParam: PVOID, +}} +pub type PSP_DETECTDEVICE_PARAMS = *mut SP_DETECTDEVICE_PARAMS; +pub const MAX_INSTALLWIZARD_DYNAPAGES: usize = 20; +STRUCT!{struct SP_INSTALLWIZARD_DATA { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Flags: DWORD, + DynamicPages: [HPROPSHEETPAGE; MAX_INSTALLWIZARD_DYNAPAGES], + NumDynamicPages: DWORD, + DynamicPageFlags: DWORD, + PrivateFlags: DWORD, + PrivateData: LPARAM, + hwndWizardDlg: HWND, +}} +pub type PSP_INSTALLWIZARD_DATA = *mut SP_INSTALLWIZARD_DATA; +pub const NDW_INSTALLFLAG_DIDFACTDEFS: DWORD = 0x00000001; +pub const NDW_INSTALLFLAG_HARDWAREALLREADYIN: DWORD = 0x00000002; +pub const NDW_INSTALLFLAG_NEEDRESTART: DWORD = DI_NEEDRESTART; +pub const NDW_INSTALLFLAG_NEEDREBOOT: DWORD = DI_NEEDREBOOT; +pub const NDW_INSTALLFLAG_NEEDSHUTDOWN: DWORD = 0x00000200; +pub const NDW_INSTALLFLAG_EXPRESSINTRO: DWORD = 0x00000400; +pub const NDW_INSTALLFLAG_SKIPISDEVINSTALLED: DWORD = 0x00000800; +pub const NDW_INSTALLFLAG_NODETECTEDDEVS: DWORD = 0x00001000; +pub const NDW_INSTALLFLAG_INSTALLSPECIFIC: DWORD = 0x00002000; +pub const NDW_INSTALLFLAG_SKIPCLASSLIST: DWORD = 0x00004000; +pub const NDW_INSTALLFLAG_CI_PICKED_OEM: DWORD = 0x00008000; +pub const NDW_INSTALLFLAG_PCMCIAMODE: DWORD = 0x00010000; +pub const NDW_INSTALLFLAG_PCMCIADEVICE: DWORD = 0x00020000; +pub const NDW_INSTALLFLAG_USERCANCEL: DWORD = 0x00040000; +pub const NDW_INSTALLFLAG_KNOWNCLASS: DWORD = 0x00080000; +pub const DYNAWIZ_FLAG_PAGESADDED: DWORD = 0x00000001; +pub const DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT: DWORD = 0x00000008; +pub const DYNAWIZ_FLAG_INSTALLDET_NEXT: DWORD = 0x00000002; +pub const DYNAWIZ_FLAG_INSTALLDET_PREV: DWORD = 0x00000004; +pub const MIN_IDD_DYNAWIZ_RESOURCE_ID: c_int = 10000; +pub const MAX_IDD_DYNAWIZ_RESOURCE_ID: c_int = 11000; +pub const IDD_DYNAWIZ_FIRSTPAGE: c_int = 10000; +pub const IDD_DYNAWIZ_SELECT_PREVPAGE: c_int = 10001; +pub const IDD_DYNAWIZ_SELECT_NEXTPAGE: c_int = 10002; +pub const IDD_DYNAWIZ_ANALYZE_PREVPAGE: c_int = 10003; +pub const IDD_DYNAWIZ_ANALYZE_NEXTPAGE: c_int = 10004; +pub const IDD_DYNAWIZ_SELECTDEV_PAGE: c_int = 10009; +pub const IDD_DYNAWIZ_ANALYZEDEV_PAGE: c_int = 10010; +pub const IDD_DYNAWIZ_INSTALLDETECTEDDEVS_PAGE: c_int = 10011; +pub const IDD_DYNAWIZ_SELECTCLASS_PAGE: c_int = 10012; +pub const IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE: c_int = 10006; +pub const IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE: c_int = 10007; +pub const IDD_DYNAWIZ_INSTALLDETECTED_NODEVS: c_int = 10008; +STRUCT!{struct SP_NEWDEVICEWIZARD_DATA { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + Flags: DWORD, + DynamicPages: [HPROPSHEETPAGE; MAX_INSTALLWIZARD_DYNAPAGES], + NumDynamicPages: DWORD, + hwndWizardDlg: HWND, +}} +pub type PSP_NEWDEVICEWIZARD_DATA = *mut SP_NEWDEVICEWIZARD_DATA; +pub type SP_ADDPROPERTYPAGE_DATA = SP_NEWDEVICEWIZARD_DATA; +pub type PSP_ADDPROPERTYPAGE_DATA = PSP_NEWDEVICEWIZARD_DATA; +STRUCT!{struct SP_TROUBLESHOOTER_PARAMS_A { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + ChmFile: [CHAR; MAX_PATH], + HtmlTroubleShooter: [CHAR; MAX_PATH], +}} +pub type PSP_TROUBLESHOOTER_PARAMS_A = *mut SP_TROUBLESHOOTER_PARAMS_A; +STRUCT!{struct SP_TROUBLESHOOTER_PARAMS_W { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + ChmFile: [WCHAR; MAX_PATH], + HtmlTroubleShooter: [WCHAR; MAX_PATH], +}} +pub type PSP_TROUBLESHOOTER_PARAMS_W = *mut SP_TROUBLESHOOTER_PARAMS_W; +STRUCT!{struct SP_POWERMESSAGEWAKE_PARAMS_A { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + PowerMessageWake: [CHAR; LINE_LEN * 2], +}} +pub type PSP_POWERMESSAGEWAKE_PARAMS_A = *mut SP_POWERMESSAGEWAKE_PARAMS_A; +STRUCT!{struct SP_POWERMESSAGEWAKE_PARAMS_W { + ClassInstallHeader: SP_CLASSINSTALL_HEADER, + PowerMessageWake: [WCHAR; LINE_LEN * 2], +}} +pub type PSP_POWERMESSAGEWAKE_PARAMS_W = *mut SP_POWERMESSAGEWAKE_PARAMS_W; +STRUCT!{struct SP_DRVINFO_DATA_V2_A { + cbSize: DWORD, + DriverType: DWORD, + Reserved: ULONG_PTR, + Description: [CHAR; LINE_LEN], + MfgName: [CHAR; LINE_LEN], + ProviderName: [CHAR; LINE_LEN], + DriverDate: FILETIME, + DriverVersion: DWORDLONG, +}} +pub type PSP_DRVINFO_DATA_V2_A = *mut SP_DRVINFO_DATA_V2_A; +STRUCT!{struct SP_DRVINFO_DATA_V2_W { + cbSize: DWORD, + DriverType: DWORD, + Reserved: ULONG_PTR, + Description: [WCHAR; LINE_LEN], + MfgName: [WCHAR; LINE_LEN], + ProviderName: [WCHAR; LINE_LEN], + DriverDate: FILETIME, + DriverVersion: DWORDLONG, +}} +pub type PSP_DRVINFO_DATA_V2_W = *mut SP_DRVINFO_DATA_V2_W; +STRUCT!{struct SP_DRVINFO_DATA_V1_A { + cbSize: DWORD, + DriverType: DWORD, + Reserved: ULONG_PTR, + Description: [CHAR; LINE_LEN], + MfgName: [CHAR; LINE_LEN], + ProviderName: [CHAR; LINE_LEN], +}} +pub type PSP_DRVINFO_DATA_V1_A = *mut SP_DRVINFO_DATA_V1_A; +STRUCT!{struct SP_DRVINFO_DATA_V1_W { + cbSize: DWORD, + DriverType: DWORD, + Reserved: ULONG_PTR, + Description: [WCHAR; LINE_LEN], + MfgName: [WCHAR; LINE_LEN], + ProviderName: [WCHAR; LINE_LEN], +}} +pub type PSP_DRVINFO_DATA_V1_W = *mut SP_DRVINFO_DATA_V1_W; +pub type SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V2_A; +pub type PSP_DRVINFO_DATA_A = PSP_DRVINFO_DATA_V2_A; +pub type SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V2_W; +pub type PSP_DRVINFO_DATA_W = PSP_DRVINFO_DATA_V2_W; +STRUCT!{struct SP_DRVINFO_DETAIL_DATA_A { + cbSize: DWORD, + InfDate: FILETIME, + CompatIDsOffset: DWORD, + CompatIDsLength: DWORD, + Reserved: ULONG_PTR, + SectionName: [CHAR; LINE_LEN], + InfFileName: [CHAR; MAX_PATH], + DrvDescription: [CHAR; LINE_LEN], + HardwareID: [CHAR; ANYSIZE_ARRAY], +}} +pub type PSP_DRVINFO_DETAIL_DATA_A = *mut SP_DRVINFO_DETAIL_DATA_A; +STRUCT!{struct SP_DRVINFO_DETAIL_DATA_W { + cbSize: DWORD, + InfDate: FILETIME, + CompatIDsOffset: DWORD, + CompatIDsLength: DWORD, + Reserved: ULONG_PTR, + SectionName: [WCHAR; LINE_LEN], + InfFileName: [WCHAR; MAX_PATH], + DrvDescription: [WCHAR; LINE_LEN], + HardwareID: [WCHAR; ANYSIZE_ARRAY], +}} +pub type PSP_DRVINFO_DETAIL_DATA_W = *mut SP_DRVINFO_DETAIL_DATA_W; +STRUCT!{struct SP_DRVINSTALL_PARAMS { + cbSize: DWORD, + Rank: DWORD, + Flags: DWORD, + PrivateData: DWORD_PTR, + Reserved: DWORD, +}} +pub type PSP_DRVINSTALL_PARAMS = *mut SP_DRVINSTALL_PARAMS; +pub const DNF_DUPDESC: DWORD = 0x00000001; +pub const DNF_OLDDRIVER: DWORD = 0x00000002; +pub const DNF_EXCLUDEFROMLIST: DWORD = 0x00000004; +pub const DNF_NODRIVER: DWORD = 0x00000008; +pub const DNF_LEGACYINF: DWORD = 0x00000010; +pub const DNF_CLASS_DRIVER: DWORD = 0x00000020; +pub const DNF_COMPATIBLE_DRIVER: DWORD = 0x00000040; +pub const DNF_INET_DRIVER: DWORD = 0x00000080; +pub const DNF_UNUSED1: DWORD = 0x00000100; +pub const DNF_UNUSED2: DWORD = 0x00000200; +pub const DNF_OLD_INET_DRIVER: DWORD = 0x00000400; +pub const DNF_BAD_DRIVER: DWORD = 0x00000800; +pub const DNF_DUPPROVIDER: DWORD = 0x00001000; +pub const DNF_INF_IS_SIGNED: DWORD = 0x00002000; +pub const DNF_OEM_F6_INF: DWORD = 0x00004000; +pub const DNF_DUPDRIVERVER: DWORD = 0x00008000; +pub const DNF_BASIC_DRIVER: DWORD = 0x00010000; +pub const DNF_AUTHENTICODE_SIGNED: DWORD = 0x00020000; +pub const DNF_INSTALLEDDRIVER: DWORD = 0x00040000; +pub const DNF_ALWAYSEXCLUDEFROMLIST: DWORD = 0x00080000; +pub const DNF_INBOX_DRIVER: DWORD = 0x00100000; +pub const DNF_REQUESTADDITIONALSOFTWARE: DWORD = 0x00200000; +pub const DNF_UNUSED_22: DWORD = 0x00400000; +pub const DNF_UNUSED_23: DWORD = 0x00800000; +pub const DNF_UNUSED_24: DWORD = 0x01000000; +pub const DNF_UNUSED_25: DWORD = 0x02000000; +pub const DNF_UNUSED_26: DWORD = 0x04000000; +pub const DNF_UNUSED_27: DWORD = 0x08000000; +pub const DNF_UNUSED_28: DWORD = 0x10000000; +pub const DNF_UNUSED_29: DWORD = 0x20000000; +pub const DNF_UNUSED_30: DWORD = 0x40000000; +pub const DNF_UNUSED_31: DWORD = 0x80000000; +pub const DRIVER_HARDWAREID_RANK: DWORD = 0x00000FFF; +pub const DRIVER_HARDWAREID_MASK: DWORD = 0x80000FFF; +pub const DRIVER_UNTRUSTED_RANK: DWORD = 0x80000000; +pub const DRIVER_W9X_SUSPECT_RANK: DWORD = 0xC0000000; +FN!{stdcall PSP_DETSIG_CMPPROC( + DeviceInfoSet: HDEVINFO, + NewDeviceData: PSP_DEVINFO_DATA, + ExistingDeviceData: PSP_DEVINFO_DATA, + CompareContext: PVOID, +) -> DWORD} +STRUCT!{struct COINSTALLER_CONTEXT_DATA { + PostProcessing: BOOL, + InstallResult: DWORD, + PrivateData: PVOID, +}} +pub type PCOINSTALLER_CONTEXT_DATA = *mut COINSTALLER_CONTEXT_DATA; +STRUCT!{struct SP_CLASSIMAGELIST_DATA { + cbSize: DWORD, + ImageList: HIMAGELIST, + Reserved: ULONG_PTR, +}} +pub type PSP_CLASSIMAGELIST_DATA = *mut SP_CLASSIMAGELIST_DATA; +STRUCT!{struct SP_PROPSHEETPAGE_REQUEST { + cbSize: DWORD, + PageRequested: DWORD, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, +}} +pub type PSP_PROPSHEETPAGE_REQUEST = *mut SP_PROPSHEETPAGE_REQUEST; +pub const SPPSR_SELECT_DEVICE_RESOURCES: DWORD = 1; +pub const SPPSR_ENUM_BASIC_DEVICE_PROPERTIES: DWORD = 2; +pub const SPPSR_ENUM_ADV_DEVICE_PROPERTIES: DWORD = 3; +STRUCT!{struct SP_BACKUP_QUEUE_PARAMS_V2_A { + cbSize: DWORD, + FullInfPath: [CHAR; MAX_PATH], + FilenameOffset: INT, + ReinstallInstance: [CHAR; MAX_PATH], +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V2_A = *mut SP_BACKUP_QUEUE_PARAMS_V2_A; +STRUCT!{struct SP_BACKUP_QUEUE_PARAMS_V2_W { + cbSize: DWORD, + FullInfPath: [WCHAR; MAX_PATH], + FilenameOffset: INT, + ReinstallInstance: [WCHAR; MAX_PATH], +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V2_W = *mut SP_BACKUP_QUEUE_PARAMS_V2_W; +STRUCT!{struct SP_BACKUP_QUEUE_PARAMS_V1_A { + cbSize: DWORD, + FullInfPath: [CHAR; MAX_PATH], + FilenameOffset: INT, +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V1_A = *mut SP_BACKUP_QUEUE_PARAMS_V1_A; +STRUCT!{struct SP_BACKUP_QUEUE_PARAMS_V1_W { + cbSize: DWORD, + FullInfPath: [WCHAR; MAX_PATH], + FilenameOffset: INT, +}} +pub type PSP_BACKUP_QUEUE_PARAMS_V1_W = *mut SP_BACKUP_QUEUE_PARAMS_V1_W; +pub type SP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_V2_A; +pub type PSP_BACKUP_QUEUE_PARAMS_A = PSP_BACKUP_QUEUE_PARAMS_V2_A; +pub type SP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_V2_W; +pub type PSP_BACKUP_QUEUE_PARAMS_W = PSP_BACKUP_QUEUE_PARAMS_V2_W; +pub const ERROR_EXPECTED_SECTION_NAME: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0; +pub const ERROR_BAD_SECTION_NAME_LINE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 1; +pub const ERROR_SECTION_NAME_TOO_LONG: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 2; +pub const ERROR_GENERAL_SYNTAX: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 3; +pub const ERROR_WRONG_INF_STYLE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x100; +pub const ERROR_SECTION_NOT_FOUND: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x101; +pub const ERROR_LINE_NOT_FOUND: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x102; +pub const ERROR_NO_BACKUP: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x103; +pub const ERROR_NO_ASSOCIATED_CLASS: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x200; +pub const ERROR_CLASS_MISMATCH: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x201; +pub const ERROR_DUPLICATE_FOUND: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x202; +pub const ERROR_NO_DRIVER_SELECTED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x203; +pub const ERROR_KEY_DOES_NOT_EXIST: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x204; +pub const ERROR_INVALID_DEVINST_NAME: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x205; +pub const ERROR_INVALID_CLASS: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x206; +pub const ERROR_DEVINST_ALREADY_EXISTS: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x207; +pub const ERROR_DEVINFO_NOT_REGISTERED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x208; +pub const ERROR_INVALID_REG_PROPERTY: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x209; +pub const ERROR_NO_INF: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x20A; +pub const ERROR_NO_SUCH_DEVINST: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x20B; +pub const ERROR_CANT_LOAD_CLASS_ICON: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x20C; +pub const ERROR_INVALID_CLASS_INSTALLER: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x20D; +pub const ERROR_DI_DO_DEFAULT: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x20E; +pub const ERROR_DI_NOFILECOPY: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x20F; +pub const ERROR_INVALID_HWPROFILE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x210; +pub const ERROR_NO_DEVICE_SELECTED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x211; +pub const ERROR_DEVINFO_LIST_LOCKED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x212; +pub const ERROR_DEVINFO_DATA_LOCKED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x213; +pub const ERROR_DI_BAD_PATH: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x214; +pub const ERROR_NO_CLASSINSTALL_PARAMS: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x215; +pub const ERROR_FILEQUEUE_LOCKED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x216; +pub const ERROR_BAD_SERVICE_INSTALLSECT: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x217; +pub const ERROR_NO_CLASS_DRIVER_LIST: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x218; +pub const ERROR_NO_ASSOCIATED_SERVICE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x219; +pub const ERROR_NO_DEFAULT_DEVICE_INTERFACE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x21A; +pub const ERROR_DEVICE_INTERFACE_ACTIVE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x21B; +pub const ERROR_DEVICE_INTERFACE_REMOVED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x21C; +pub const ERROR_BAD_INTERFACE_INSTALLSECT: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x21D; +pub const ERROR_NO_SUCH_INTERFACE_CLASS: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x21E; +pub const ERROR_INVALID_REFERENCE_STRING: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x21F; +pub const ERROR_INVALID_MACHINENAME: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x220; +pub const ERROR_REMOTE_COMM_FAILURE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x221; +pub const ERROR_MACHINE_UNAVAILABLE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x222; +pub const ERROR_NO_CONFIGMGR_SERVICES: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x223; +pub const ERROR_INVALID_PROPPAGE_PROVIDER: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x224; +pub const ERROR_NO_SUCH_DEVICE_INTERFACE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x225; +pub const ERROR_DI_POSTPROCESSING_REQUIRED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x226; +pub const ERROR_INVALID_COINSTALLER: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x227; +pub const ERROR_NO_COMPAT_DRIVERS: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x228; +pub const ERROR_NO_DEVICE_ICON: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x229; +pub const ERROR_INVALID_INF_LOGCONFIG: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x22A; +pub const ERROR_DI_DONT_INSTALL: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x22B; +pub const ERROR_INVALID_FILTER_DRIVER: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x22C; +pub const ERROR_NON_WINDOWS_NT_DRIVER: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x22D; +pub const ERROR_NON_WINDOWS_DRIVER: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x22E; +pub const ERROR_NO_CATALOG_FOR_OEM_INF: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x22F; +pub const ERROR_DEVINSTALL_QUEUE_NONNATIVE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x230; +pub const ERROR_NOT_DISABLEABLE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x231; +pub const ERROR_CANT_REMOVE_DEVINST: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x232; +pub const ERROR_INVALID_TARGET: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x233; +pub const ERROR_DRIVER_NONNATIVE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x234; +pub const ERROR_IN_WOW64: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x235; +pub const ERROR_SET_SYSTEM_RESTORE_POINT: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x236; +pub const ERROR_SCE_DISABLED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x238; +pub const ERROR_UNKNOWN_EXCEPTION: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x239; +pub const ERROR_PNP_REGISTRY_ERROR: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x23A; +pub const ERROR_REMOTE_REQUEST_UNSUPPORTED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x23B; +pub const ERROR_NOT_AN_INSTALLED_OEM_INF: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x23C; +pub const ERROR_INF_IN_USE_BY_DEVICES: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x23D; +pub const ERROR_DI_FUNCTION_OBSOLETE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x23E; +pub const ERROR_NO_AUTHENTICODE_CATALOG: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x23F; +pub const ERROR_AUTHENTICODE_DISALLOWED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x240; +pub const ERROR_AUTHENTICODE_TRUSTED_PUBLISHER: DWORD = APPLICATION_ERROR_MASK + | ERROR_SEVERITY_ERROR | 0x241; +pub const ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED: DWORD = APPLICATION_ERROR_MASK + | ERROR_SEVERITY_ERROR | 0x242; +pub const ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED: DWORD = APPLICATION_ERROR_MASK + | ERROR_SEVERITY_ERROR | 0x243; +pub const ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH: DWORD = APPLICATION_ERROR_MASK + | ERROR_SEVERITY_ERROR | 0x244; +pub const ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE: DWORD = APPLICATION_ERROR_MASK + | ERROR_SEVERITY_ERROR | 0x245; +pub const ERROR_DEVICE_INSTALLER_NOT_READY: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x246; +pub const ERROR_DRIVER_STORE_ADD_FAILED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x247; +pub const ERROR_DEVICE_INSTALL_BLOCKED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x248; +pub const ERROR_DRIVER_INSTALL_BLOCKED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x249; +pub const ERROR_WRONG_INF_TYPE: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 0x24A; +pub const ERROR_FILE_HASH_NOT_IN_CATALOG: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x24B; +pub const ERROR_DRIVER_STORE_DELETE_FAILED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x24C; +pub const ERROR_UNRECOVERABLE_STACK_OVERFLOW: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x300; +pub const EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW: DWORD = ERROR_UNRECOVERABLE_STACK_OVERFLOW; +pub const ERROR_NO_DEFAULT_INTERFACE_DEVICE: DWORD = ERROR_NO_DEFAULT_DEVICE_INTERFACE; +pub const ERROR_INTERFACE_DEVICE_ACTIVE: DWORD = ERROR_DEVICE_INTERFACE_ACTIVE; +pub const ERROR_INTERFACE_DEVICE_REMOVED: DWORD = ERROR_DEVICE_INTERFACE_REMOVED; +pub const ERROR_NO_SUCH_INTERFACE_DEVICE: DWORD = ERROR_NO_SUCH_DEVICE_INTERFACE; +pub const ERROR_NOT_INSTALLED: DWORD = APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR + | 0x1000; +extern "system" { + pub fn SetupGetInfInformationA( + InfSpec: LPCVOID, + SearchControl: DWORD, + ReturnBuffer: PSP_INF_INFORMATION, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetInfInformationW( + InfSpec: LPCVOID, + SearchControl: DWORD, + ReturnBuffer: PSP_INF_INFORMATION, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; +} +pub const INFINFO_INF_SPEC_IS_HINF: DWORD = 1; +pub const INFINFO_INF_NAME_IS_ABSOLUTE: DWORD = 2; +pub const INFINFO_DEFAULT_SEARCH: DWORD = 3; +pub const INFINFO_REVERSE_DEFAULT_SEARCH: DWORD = 4; +pub const INFINFO_INF_PATH_LIST_SEARCH: DWORD = 5; +extern "system" { + pub fn SetupQueryInfFileInformationA( + InfInformation: PSP_INF_INFORMATION, + InfIndex: UINT, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupQueryInfFileInformationW( + InfInformation: PSP_INF_INFORMATION, + InfIndex: UINT, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupQueryInfOriginalFileInformationA( + InfInformation: PSP_INF_INFORMATION, + InfIndex: UINT, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + OriginalFileInfo: PSP_ORIGINAL_FILE_INFO_A, + ) -> BOOL; + pub fn SetupQueryInfOriginalFileInformationW( + InfInformation: PSP_INF_INFORMATION, + InfIndex: UINT, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + OriginalFileInfo: PSP_ORIGINAL_FILE_INFO_W, + ) -> BOOL; + pub fn SetupQueryInfVersionInformationA( + InfInformation: PSP_INF_INFORMATION, + InfIndex: UINT, + Key: PCSTR, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupQueryInfVersionInformationW( + InfInformation: PSP_INF_INFORMATION, + InfIndex: UINT, + Key: PCWSTR, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetInfDriverStoreLocationA( + FileName: PCSTR, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + LocaleName: PCSTR, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetInfDriverStoreLocationW( + FileName: PCWSTR, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + LocaleName: PCWSTR, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetInfPublishedNameA( + DriverStoreLocation: PCSTR, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetInfPublishedNameW( + DriverStoreLocation: PCWSTR, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetInfFileListA( + DirectoryPath: PCSTR, + InfStyle: DWORD, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetInfFileListW( + DirectoryPath: PCWSTR, + InfStyle: DWORD, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupOpenInfFileW( + FileName: PCWSTR, + InfClass: PCWSTR, + InfStyle: DWORD, + ErrorLine: PUINT, + ) -> HINF; + pub fn SetupOpenInfFileA( + FileName: PCSTR, + InfClass: PCSTR, + InfStyle: DWORD, + ErrorLine: PUINT, + ) -> HINF; + pub fn SetupOpenMasterInf() -> HINF; + pub fn SetupOpenAppendInfFileW( + FileName: PCWSTR, + InfHandle: HINF, + ErrorLine: PUINT, + ) -> BOOL; + pub fn SetupOpenAppendInfFileA( + FileName: PCSTR, + InfHandle: HINF, + ErrorLine: PUINT, + ) -> BOOL; + pub fn SetupCloseInfFile( + InfHandle: HINF, + ) -> (); + pub fn SetupFindFirstLineA( + InfHandle: HINF, + Section: PCSTR, + Key: PCSTR, + Context: PINFCONTEXT, + ) -> BOOL; + pub fn SetupFindFirstLineW( + InfHandle: HINF, + Section: PCWSTR, + Key: PCWSTR, + Context: PINFCONTEXT, + ) -> BOOL; + pub fn SetupFindNextLine( + ContextIn: PINFCONTEXT, + ContextOut: PINFCONTEXT, + ) -> BOOL; + pub fn SetupFindNextMatchLineA( + ContextIn: PINFCONTEXT, + Key: PCSTR, + ContextOut: PINFCONTEXT, + ) -> BOOL; + pub fn SetupFindNextMatchLineW( + ContextIn: PINFCONTEXT, + Key: PCWSTR, + ContextOut: PINFCONTEXT, + ) -> BOOL; + pub fn SetupGetLineByIndexA( + InfHandle: HINF, + Section: PCSTR, + Index: DWORD, + Context: PINFCONTEXT, + ) -> BOOL; + pub fn SetupGetLineByIndexW( + InfHandle: HINF, + Section: PCWSTR, + Index: DWORD, + Context: PINFCONTEXT, + ) -> BOOL; + pub fn SetupGetLineCountA( + InfHandle: HINF, + Section: PCSTR, + ) -> LONG; + pub fn SetupGetLineCountW( + InfHandle: HINF, + Section: PCWSTR, + ) -> LONG; + pub fn SetupGetLineTextA( + Context: PINFCONTEXT, + InfHandle: HINF, + Section: PCSTR, + Key: PCSTR, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + ReturnBufferSize: PDWORD, + ) -> BOOL; + pub fn SetupGetLineTextW( + Context: PINFCONTEXT, + InfHandle: HINF, + Section: PCWSTR, + Key: PCWSTR, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + ReturnBufferSize: PDWORD, + ) -> BOOL; + pub fn SetupGetFieldCount( + Context: PINFCONTEXT, + ) -> DWORD; + pub fn SetupGetStringFieldA( + Context: PINFCONTEXT, + FieldIndex: DWORD, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetStringFieldW( + Context: PINFCONTEXT, + FieldIndex: DWORD, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetIntField( + Context: PINFCONTEXT, + FieldIndex: DWORD, + IntegerValue: PINT, + ) -> BOOL; + pub fn SetupGetMultiSzFieldA( + Context: PINFCONTEXT, + FieldIndex: DWORD, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: LPDWORD, + ) -> BOOL; + pub fn SetupGetMultiSzFieldW( + Context: PINFCONTEXT, + FieldIndex: DWORD, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: LPDWORD, + ) -> BOOL; + pub fn SetupGetBinaryField( + Context: PINFCONTEXT, + FieldIndex: DWORD, + ReturnBuffer: PBYTE, + ReturnBufferSize: DWORD, + RequiredSize: LPDWORD, + ) -> BOOL; + pub fn SetupGetFileCompressionInfoA( + SourceFileName: PCSTR, + ActualSourceFileName: *mut PSTR, + SourceFileSize: PDWORD, + TargetFileSize: PDWORD, + CompressionType: PUINT, + ) -> DWORD; + pub fn SetupGetFileCompressionInfoW( + SourceFileName: PCWSTR, + ActualSourceFileName: *mut PWSTR, + SourceFileSize: PDWORD, + TargetFileSize: PDWORD, + CompressionType: PUINT, + ) -> DWORD; + pub fn SetupGetFileCompressionInfoExA( + SourceFileName: PCSTR, + ActualSourceFileNameBuffer: PSTR, + ActualSourceFileNameBufferLen: DWORD, + RequiredBufferLen: PDWORD, + SourceFileSize: PDWORD, + TargetFileSize: PDWORD, + CompressionType: PUINT, + ) -> BOOL; + pub fn SetupGetFileCompressionInfoExW( + SourceFileName: PCWSTR, + ActualSourceFileNameBuffer: PWSTR, + ActualSourceFileNameBufferLen: DWORD, + RequiredBufferLen: PDWORD, + SourceFileSize: PDWORD, + TargetFileSize: PDWORD, + CompressionType: PUINT, + ) -> BOOL; +} +pub const FILE_COMPRESSION_NONE: UINT = 0; +pub const FILE_COMPRESSION_WINLZA: UINT = 1; +pub const FILE_COMPRESSION_MSZIP: UINT = 2; +pub const FILE_COMPRESSION_NTCAB: UINT = 3; +extern "system" { + pub fn SetupDecompressOrCopyFileA( + SourceFileName: PCSTR, + TargetFileName: PCSTR, + CompressionType: PUINT, + ) -> DWORD; + pub fn SetupDecompressOrCopyFileW( + SourceFileName: PCWSTR, + TargetFileName: PCWSTR, + CompressionType: PUINT, + ) -> DWORD; + pub fn SetupGetSourceFileLocationA( + InfHandle: HINF, + InfContext: PINFCONTEXT, + FileName: PCSTR, + SourceId: PUINT, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetSourceFileLocationW( + InfHandle: HINF, + InfContext: PINFCONTEXT, + FileName: PCWSTR, + SourceId: PUINT, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetSourceFileSizeA( + InfHandle: HINF, + InfContext: PINFCONTEXT, + FileName: PCSTR, + Section: PCSTR, + FileSize: PDWORD, + RoundingFactor: UINT, + ) -> BOOL; + pub fn SetupGetSourceFileSizeW( + InfHandle: HINF, + InfContext: PINFCONTEXT, + FileName: PCWSTR, + Section: PCWSTR, + FileSize: PDWORD, + RoundingFactor: UINT, + ) -> BOOL; + pub fn SetupGetTargetPathA( + InfHandle: HINF, + InfContext: PINFCONTEXT, + Section: PCSTR, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetTargetPathW( + InfHandle: HINF, + InfContext: PINFCONTEXT, + Section: PCWSTR, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; +} +pub const SRCLIST_TEMPORARY: DWORD = 0x00000001; +pub const SRCLIST_NOBROWSE: DWORD = 0x00000002; +pub const SRCLIST_SYSTEM: DWORD = 0x00000010; +pub const SRCLIST_USER: DWORD = 0x00000020; +pub const SRCLIST_SYSIFADMIN: DWORD = 0x00000040; +pub const SRCLIST_SUBDIRS: DWORD = 0x00000100; +pub const SRCLIST_APPEND: DWORD = 0x00000200; +pub const SRCLIST_NOSTRIPPLATFORM: DWORD = 0x00000400; +extern "system" { + pub fn SetupSetSourceListA( + Flags: DWORD, + SourceList: *mut PCSTR, + SourceCount: UINT, + ) -> BOOL; + pub fn SetupSetSourceListW( + Flags: DWORD, + SourceList: *mut PCWSTR, + SourceCount: UINT, + ) -> BOOL; + pub fn SetupCancelTemporarySourceList() -> BOOL; + pub fn SetupAddToSourceListA( + Flags: DWORD, + Source: PCSTR, + ) -> BOOL; + pub fn SetupAddToSourceListW( + Flags: DWORD, + Source: PCWSTR, + ) -> BOOL; + pub fn SetupRemoveFromSourceListA( + Flags: DWORD, + Source: PCSTR, + ) -> BOOL; + pub fn SetupRemoveFromSourceListW( + Flags: DWORD, + Source: PCWSTR, + ) -> BOOL; + pub fn SetupQuerySourceListA( + Flags: DWORD, + List: *mut *mut PCSTR, + Count: PUINT, + ) -> BOOL; + pub fn SetupQuerySourceListW( + Flags: DWORD, + List: *mut *mut PCWSTR, + Count: PUINT, + ) -> BOOL; + pub fn SetupFreeSourceListA( + List: *mut *mut PCSTR, + Count: UINT, + ) -> BOOL; + pub fn SetupFreeSourceListW( + List: *mut *mut PCWSTR, + Count: UINT, + ) -> BOOL; + pub fn SetupPromptForDiskA( + hwndParent: HWND, + DialogTitle: PCSTR, + DiskName: PCSTR, + PathToSource: PCSTR, + FileSought: PCSTR, + TagFile: PCSTR, + DiskPromptStyle: DWORD, + PathBuffer: PSTR, + PathBufferSize: DWORD, + PathRequiredSize: PDWORD, + ) -> UINT; + pub fn SetupPromptForDiskW( + hwndParent: HWND, + DialogTitle: PCWSTR, + DiskName: PCWSTR, + PathToSource: PCWSTR, + FileSought: PCWSTR, + TagFile: PCWSTR, + DiskPromptStyle: DWORD, + PathBuffer: PWSTR, + PathBufferSize: DWORD, + PathRequiredSize: PDWORD, + ) -> UINT; + pub fn SetupCopyErrorA( + hwndParent: HWND, + DialogTitle: PCSTR, + DiskName: PCSTR, + PathToSource: PCSTR, + SourceFile: PCSTR, + TargetPathFile: PCSTR, + Win32ErrorCode: UINT, + Style: DWORD, + PathBuffer: PSTR, + PathBufferSize: DWORD, + PathRequiredSize: PDWORD, + ) -> UINT; + pub fn SetupCopyErrorW( + hwndParent: HWND, + DialogTitle: PCWSTR, + DiskName: PCWSTR, + PathToSource: PCWSTR, + SourceFile: PCWSTR, + TargetPathFile: PCWSTR, + Win32ErrorCode: UINT, + Style: DWORD, + PathBuffer: PWSTR, + PathBufferSize: DWORD, + PathRequiredSize: PDWORD, + ) -> UINT; + pub fn SetupRenameErrorA( + hwndParent: HWND, + DialogTitle: PCSTR, + SourceFile: PCSTR, + TargetFile: PCSTR, + Win32ErrorCode: UINT, + Style: DWORD, + ) -> UINT; + pub fn SetupRenameErrorW( + hwndParent: HWND, + DialogTitle: PCWSTR, + SourceFile: PCWSTR, + TargetFile: PCWSTR, + Win32ErrorCode: UINT, + Style: DWORD, + ) -> UINT; + pub fn SetupDeleteErrorA( + hwndParent: HWND, + DialogTitle: PCSTR, + File: PCSTR, + Win32ErrorCode: UINT, + Style: DWORD, + ) -> UINT; + pub fn SetupDeleteErrorW( + hwndParent: HWND, + DialogTitle: PCWSTR, + File: PCWSTR, + Win32ErrorCode: UINT, + Style: DWORD, + ) -> UINT; + pub fn SetupBackupErrorA( + hwndParent: HWND, + DialogTitle: PCSTR, + SourceFile: PCSTR, + TargetFile: PCSTR, + Win32ErrorCode: UINT, + Style: DWORD, + ) -> UINT; + pub fn SetupBackupErrorW( + hwndParent: HWND, + DialogTitle: PCWSTR, + SourceFile: PCWSTR, + TargetFile: PCWSTR, + Win32ErrorCode: UINT, + Style: DWORD, + ) -> UINT; +} +pub const IDF_NOBROWSE: DWORD = 0x00000001; +pub const IDF_NOSKIP: DWORD = 0x00000002; +pub const IDF_NODETAILS: DWORD = 0x00000004; +pub const IDF_NOCOMPRESSED: DWORD = 0x00000008; +pub const IDF_CHECKFIRST: DWORD = 0x00000100; +pub const IDF_NOBEEP: DWORD = 0x00000200; +pub const IDF_NOFOREGROUND: DWORD = 0x00000400; +pub const IDF_WARNIFSKIP: DWORD = 0x00000800; +pub const IDF_NOREMOVABLEMEDIAPROMPT: DWORD = 0x00001000; +pub const IDF_USEDISKNAMEASPROMPT: DWORD = 0x00002000; +pub const IDF_OEMDISK: DWORD = 0x80000000; +pub const DPROMPT_SUCCESS: UINT = 0; +pub const DPROMPT_CANCEL: UINT = 1; +pub const DPROMPT_SKIPFILE: UINT = 2; +pub const DPROMPT_BUFFERTOOSMALL: UINT = 3; +pub const DPROMPT_OUTOFMEMORY: UINT = 4; +extern "system" { + pub fn SetupSetDirectoryIdA( + InfHandle: HINF, + Id: DWORD, + Directory: PCSTR, + ) -> BOOL; + pub fn SetupSetDirectoryIdW( + InfHandle: HINF, + Id: DWORD, + Directory: PCWSTR, + ) -> BOOL; + pub fn SetupSetDirectoryIdExA( + InfHandle: HINF, + Id: DWORD, + Directory: PCSTR, + Flags: DWORD, + Reserved1: DWORD, + Reserved2: PVOID, + ) -> BOOL; + pub fn SetupSetDirectoryIdExW( + InfHandle: HINF, + Id: DWORD, + Directory: PCWSTR, + Flags: DWORD, + Reserved1: DWORD, + Reserved2: PVOID, + ) -> BOOL; +} +pub const SETDIRID_NOT_FULL_PATH: DWORD = 0x00000001; +extern "system" { + pub fn SetupGetSourceInfoA( + InfHandle: HINF, + SourceId: UINT, + InfoDesired: UINT, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupGetSourceInfoW( + InfHandle: HINF, + SourceId: UINT, + InfoDesired: UINT, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; +} +pub const SRCINFO_PATH: UINT = 1; +pub const SRCINFO_TAGFILE: UINT = 2; +pub const SRCINFO_DESCRIPTION: UINT = 3; +pub const SRCINFO_FLAGS: UINT = 4; +pub const SRCINFO_TAGFILE2: UINT = 4; +pub const SRC_FLAGS_CABFILE: UINT = 0x0010; +extern "system" { + pub fn SetupInstallFileA( + InfHandle: HINF, + InfContext: PINFCONTEXT, + SourceFile: PCSTR, + SourcePathRoot: PCSTR, + DestinationName: PCSTR, + CopyStyle: DWORD, + CopyMsgHandler: PSP_FILE_CALLBACK_A, + Context: PVOID, + ) -> BOOL; + pub fn SetupInstallFileW( + InfHandle: HINF, + InfContext: PINFCONTEXT, + SourceFile: PCWSTR, + SourcePathRoot: PCWSTR, + DestinationName: PCWSTR, + CopyStyle: DWORD, + CopyMsgHandler: PSP_FILE_CALLBACK_W, + Context: PVOID, + ) -> BOOL; + pub fn SetupInstallFileExA( + InfHandle: HINF, + InfContext: PINFCONTEXT, + SourceFile: PCSTR, + SourcePathRoot: PCSTR, + DestinationName: PCSTR, + CopyStyle: DWORD, + CopyMsgHandler: PSP_FILE_CALLBACK_A, + Context: PVOID, + FileWasInUse: PBOOL, + ) -> BOOL; + pub fn SetupInstallFileExW( + InfHandle: HINF, + InfContext: PINFCONTEXT, + SourceFile: PCWSTR, + SourcePathRoot: PCWSTR, + DestinationName: PCWSTR, + CopyStyle: DWORD, + CopyMsgHandler: PSP_FILE_CALLBACK_W, + Context: PVOID, + FileWasInUse: PBOOL, + ) -> BOOL; +} +pub const SP_COPY_DELETESOURCE: DWORD = 0x0000001; +pub const SP_COPY_REPLACEONLY: DWORD = 0x0000002; +pub const SP_COPY_NEWER: DWORD = 0x0000004; +pub const SP_COPY_NEWER_OR_SAME: DWORD = SP_COPY_NEWER; +pub const SP_COPY_NOOVERWRITE: DWORD = 0x0000008; +pub const SP_COPY_NODECOMP: DWORD = 0x0000010; +pub const SP_COPY_LANGUAGEAWARE: DWORD = 0x0000020; +pub const SP_COPY_SOURCE_ABSOLUTE: DWORD = 0x0000040; +pub const SP_COPY_SOURCEPATH_ABSOLUTE: DWORD = 0x0000080; +pub const SP_COPY_IN_USE_NEEDS_REBOOT: DWORD = 0x0000100; +pub const SP_COPY_FORCE_IN_USE: DWORD = 0x0000200; +pub const SP_COPY_NOSKIP: DWORD = 0x0000400; +pub const SP_FLAG_CABINETCONTINUATION: DWORD = 0x0000800; +pub const SP_COPY_FORCE_NOOVERWRITE: DWORD = 0x0001000; +pub const SP_COPY_FORCE_NEWER: DWORD = 0x0002000; +pub const SP_COPY_WARNIFSKIP: DWORD = 0x0004000; +pub const SP_COPY_NOBROWSE: DWORD = 0x0008000; +pub const SP_COPY_NEWER_ONLY: DWORD = 0x0010000; +pub const SP_COPY_RESERVED: DWORD = 0x0020000; +pub const SP_COPY_OEMINF_CATALOG_ONLY: DWORD = 0x0040000; +pub const SP_COPY_REPLACE_BOOT_FILE: DWORD = 0x0080000; +pub const SP_COPY_NOPRUNE: DWORD = 0x0100000; +pub const SP_COPY_OEM_F6_INF: DWORD = 0x0200000; +pub const SP_COPY_ALREADYDECOMP: DWORD = 0x0400000; +pub const SP_COPY_WINDOWS_SIGNED: DWORD = 0x1000000; +pub const SP_COPY_PNPLOCKED: DWORD = 0x2000000; +pub const SP_COPY_IN_USE_TRY_RENAME: DWORD = 0x4000000; +pub const SP_COPY_INBOX_INF: DWORD = 0x8000000; +pub const SP_COPY_HARDLINK: DWORD = 0x10000000; +pub const SP_BACKUP_BACKUPPASS: DWORD = 0x00000001; +pub const SP_BACKUP_DEMANDPASS: DWORD = 0x00000002; +pub const SP_BACKUP_SPECIAL: DWORD = 0x00000004; +pub const SP_BACKUP_BOOTFILE: DWORD = 0x00000008; +extern "system" { + pub fn SetupOpenFileQueue( + ) -> HSPFILEQ; + pub fn SetupCloseFileQueue( + QueueHandle: HSPFILEQ, + ) -> BOOL; + pub fn SetupSetFileQueueAlternatePlatformA( + QueueHandle: HSPFILEQ, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + AlternateDefaultCatalogFile: PCSTR, + ) -> BOOL; + pub fn SetupSetFileQueueAlternatePlatformW( + QueueHandle: HSPFILEQ, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + AlternateDefaultCatalogFile: PCWSTR, + ) -> BOOL; + pub fn SetupSetPlatformPathOverrideA( + Override: PCSTR, + ) -> BOOL; + pub fn SetupSetPlatformPathOverrideW( + Override: PCWSTR, + ) -> BOOL; + pub fn SetupQueueCopyA( + QueueHandle: HSPFILEQ, + SourceRootPath: PCSTR, + SourcePath: PCSTR, + SourceFilename: PCSTR, + SourceDescription: PCSTR, + SourceTagfile: PCSTR, + TargetDirectory: PCSTR, + TargetFilename: PCSTR, + CopyStyle: DWORD, + ) -> BOOL; + pub fn SetupQueueCopyW( + QueueHandle: HSPFILEQ, + SourceRootPath: PCWSTR, + SourcePath: PCWSTR, + SourceFilename: PCWSTR, + SourceDescription: PCWSTR, + SourceTagfile: PCWSTR, + TargetDirectory: PCWSTR, + TargetFilename: PCWSTR, + CopyStyle: DWORD, + ) -> BOOL; + pub fn SetupQueueCopyIndirectA( + CopyParams: PSP_FILE_COPY_PARAMS_A, + ) -> BOOL; + pub fn SetupQueueCopyIndirectW( + CopyParams: PSP_FILE_COPY_PARAMS_W, + ) -> BOOL; + pub fn SetupQueueDefaultCopyA( + QueueHandle: HSPFILEQ, + InfHandle: HINF, + SourceRootPath: PCSTR, + SourceFilename: PCSTR, + TargetFilename: PCSTR, + CopyStyle: DWORD, + ) -> BOOL; + pub fn SetupQueueDefaultCopyW( + QueueHandle: HSPFILEQ, + InfHandle: HINF, + SourceRootPath: PCWSTR, + SourceFilename: PCWSTR, + TargetFilename: PCWSTR, + CopyStyle: DWORD, + ) -> BOOL; + pub fn SetupQueueCopySectionA( + QueueHandle: HSPFILEQ, + SourceRootPath: PCSTR, + InfHandle: HINF, + ListInfHandle: HINF, + Section: PCSTR, + CopyStyle: DWORD, + ) -> BOOL; + pub fn SetupQueueCopySectionW( + QueueHandle: HSPFILEQ, + SourceRootPath: PCWSTR, + InfHandle: HINF, + ListInfHandle: HINF, + Section: PCWSTR, + CopyStyle: DWORD, + ) -> BOOL; + pub fn SetupQueueDeleteA( + QueueHandle: HSPFILEQ, + PathPart1: PCSTR, + PathPart2: PCSTR, + ) -> BOOL; + pub fn SetupQueueDeleteW( + QueueHandle: HSPFILEQ, + PathPart1: PCWSTR, + PathPart2: PCWSTR, + ) -> BOOL; + pub fn SetupQueueDeleteSectionA( + QueueHandle: HSPFILEQ, + InfHandle: HINF, + ListInfHandle: HINF, + Section: PCSTR, + ) -> BOOL; + pub fn SetupQueueDeleteSectionW( + QueueHandle: HSPFILEQ, + InfHandle: HINF, + ListInfHandle: HINF, + Section: PCWSTR, + ) -> BOOL; + pub fn SetupQueueRenameA( + QueueHandle: HSPFILEQ, + SourcePath: PCSTR, + SourceFilename: PCSTR, + TargetPath: PCSTR, + TargetFilename: PCSTR, + ) -> BOOL; + pub fn SetupQueueRenameW( + QueueHandle: HSPFILEQ, + SourcePath: PCWSTR, + SourceFilename: PCWSTR, + TargetPath: PCWSTR, + TargetFilename: PCWSTR, + ) -> BOOL; + pub fn SetupQueueRenameSectionA( + QueueHandle: HSPFILEQ, + InfHandle: HINF, + ListInfHandle: HINF, + Section: PCSTR, + ) -> BOOL; + pub fn SetupQueueRenameSectionW( + QueueHandle: HSPFILEQ, + InfHandle: HINF, + ListInfHandle: HINF, + Section: PCWSTR, + ) -> BOOL; + pub fn SetupCommitFileQueueA( + Owner: HWND, + QueueHandle: HSPFILEQ, + MsgHandler: PSP_FILE_CALLBACK_A, + Context: PVOID, + ) -> BOOL; + pub fn SetupCommitFileQueueW( + Owner: HWND, + QueueHandle: HSPFILEQ, + MsgHandler: PSP_FILE_CALLBACK_W, + Context: PVOID, + ) -> BOOL; + pub fn SetupScanFileQueueA( + FileQueue: HSPFILEQ, + Flags: DWORD, + Window: HWND, + CallbackRoutine: PSP_FILE_CALLBACK_A, + CallbackContext: PVOID, + Result: PDWORD, + ) -> BOOL; + pub fn SetupScanFileQueueW( + FileQueue: HSPFILEQ, + Flags: DWORD, + Window: HWND, + CallbackRoutine: PSP_FILE_CALLBACK_W, + CallbackContext: PVOID, + Result: PDWORD, + ) -> BOOL; +} +pub const SPQ_SCAN_FILE_PRESENCE: DWORD = 0x00000001; +pub const SPQ_SCAN_FILE_VALIDITY: DWORD = 0x00000002; +pub const SPQ_SCAN_USE_CALLBACK: DWORD = 0x00000004; +pub const SPQ_SCAN_USE_CALLBACKEX: DWORD = 0x00000008; +pub const SPQ_SCAN_INFORM_USER: DWORD = 0x00000010; +pub const SPQ_SCAN_PRUNE_COPY_QUEUE: DWORD = 0x00000020; +pub const SPQ_SCAN_USE_CALLBACK_SIGNERINFO: DWORD = 0x00000040; +pub const SPQ_SCAN_PRUNE_DELREN: DWORD = 0x00000080; +pub const SPQ_SCAN_FILE_PRESENCE_WITHOUT_SOURCE: DWORD = 0x00000100; +pub const SPQ_SCAN_FILE_COMPARISON: DWORD = 0x00000200; +pub const SPQ_SCAN_ACTIVATE_DRP: DWORD = 0x00000400; +pub const SPQ_DELAYED_COPY: DWORD = 0x00000001; +extern "system" { + pub fn SetupGetFileQueueCount( + FileQueue: HSPFILEQ, + SubQueueFileOp: UINT, + NumOperations: PUINT, + ) -> BOOL; + pub fn SetupGetFileQueueFlags( + FileQueue: HSPFILEQ, + Flags: PDWORD, + ) -> BOOL; + pub fn SetupSetFileQueueFlags( + FileQueue: HSPFILEQ, + FlagMask: DWORD, + Flags: DWORD, + ) -> BOOL; +} +pub const SPQ_FLAG_BACKUP_AWARE: DWORD = 0x00000001; +pub const SPQ_FLAG_ABORT_IF_UNSIGNED: DWORD = 0x00000002; +pub const SPQ_FLAG_FILES_MODIFIED: DWORD = 0x00000004; +pub const SPQ_FLAG_DO_SHUFFLEMOVE: DWORD = 0x00000008; +pub const SPQ_FLAG_VALID: DWORD = 0x0000000F; +pub const SPOST_NONE: DWORD = 0; +pub const SPOST_PATH: DWORD = 1; +pub const SPOST_URL: DWORD = 2; +pub const SPOST_MAX: DWORD = 3; +extern "system" { + pub fn SetupCopyOEMInfA( + SourceInfFileName: PCSTR, + OEMSourceMediaLocation: PCSTR, + OEMSourceMediaType: DWORD, + CopyStyle: DWORD, + DestinationInfFileName: PSTR, + DestinationInfFileNameSize: DWORD, + RequiredSize: PDWORD, + DestinationInfFileNameComponent: *mut PSTR, + ) -> BOOL; + pub fn SetupCopyOEMInfW( + SourceInfFileName: PCWSTR, + OEMSourceMediaLocation: PCWSTR, + OEMSourceMediaType: DWORD, + CopyStyle: DWORD, + DestinationInfFileName: PWSTR, + DestinationInfFileNameSize: DWORD, + RequiredSize: PDWORD, + DestinationInfFileNameComponent: *mut PWSTR, + ) -> BOOL; +} +pub const SUOI_FORCEDELETE: DWORD = 0x00000001; +pub const SUOI_INTERNAL1: DWORD = 0x00000002; +extern "system" { + pub fn SetupUninstallOEMInfA( + InfFileName: PCSTR, + Flags: DWORD, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupUninstallOEMInfW( + InfFileName: PCWSTR, + Flags: DWORD, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupUninstallNewlyCopiedInfs( + FileQueue: HSPFILEQ, + Flags: DWORD, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupCreateDiskSpaceListA( + Reserved1: PVOID, + Reserved2: DWORD, + Flags: UINT, + ) -> HDSKSPC; + pub fn SetupCreateDiskSpaceListW( + Reserved1: PVOID, + Reserved2: DWORD, + Flags: UINT, + ) -> HDSKSPC; +} +pub const SPDSL_IGNORE_DISK: UINT = 0x00000001; +pub const SPDSL_DISALLOW_NEGATIVE_ADJUST: UINT = 0x00000002; +extern "system" { + pub fn SetupDuplicateDiskSpaceListA( + DiskSpace: HDSKSPC, + Reserved1: PVOID, + Reserved2: DWORD, + Flags: UINT, + ) -> HDSKSPC; + pub fn SetupDuplicateDiskSpaceListW( + DiskSpace: HDSKSPC, + Reserved1: PVOID, + Reserved2: DWORD, + Flags: UINT, + ) -> HDSKSPC; + pub fn SetupDestroyDiskSpaceList( + DiskSpace: HDSKSPC, + ) -> BOOL; + pub fn SetupQueryDrivesInDiskSpaceListA( + DiskSpace: HDSKSPC, + ReturnBuffer: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupQueryDrivesInDiskSpaceListW( + DiskSpace: HDSKSPC, + ReturnBuffer: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupQuerySpaceRequiredOnDriveA( + DiskSpace: HDSKSPC, + DriveSpec: PCSTR, + SpaceRequired: *mut LONGLONG, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupQuerySpaceRequiredOnDriveW( + DiskSpace: HDSKSPC, + DriveSpec: PCWSTR, + SpaceRequired: *mut LONGLONG, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAdjustDiskSpaceListA( + DiskSpace: HDSKSPC, + DriveRoot: LPCSTR, + Amount: LONGLONG, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAdjustDiskSpaceListW( + DiskSpace: HDSKSPC, + DriveRoot: LPCWSTR, + Amount: LONGLONG, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAddToDiskSpaceListA( + DiskSpace: HDSKSPC, + TargetFilespec: PCSTR, + FileSize: LONGLONG, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAddToDiskSpaceListW( + DiskSpace: HDSKSPC, + TargetFilespec: PCWSTR, + FileSize: LONGLONG, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAddSectionToDiskSpaceListA( + DiskSpace: HDSKSPC, + InfHandle: HINF, + ListInfHandle: HINF, + SectionName: PCSTR, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAddSectionToDiskSpaceListW( + DiskSpace: HDSKSPC, + InfHandle: HINF, + ListInfHandle: HINF, + SectionName: PCWSTR, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAddInstallSectionToDiskSpaceListA( + DiskSpace: HDSKSPC, + InfHandle: HINF, + LayoutInfHandle: HINF, + SectionName: PCSTR, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupAddInstallSectionToDiskSpaceListW( + DiskSpace: HDSKSPC, + InfHandle: HINF, + LayoutInfHandle: HINF, + SectionName: PCWSTR, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupRemoveFromDiskSpaceListA( + DiskSpace: HDSKSPC, + TargetFilespec: PCSTR, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupRemoveFromDiskSpaceListW( + DiskSpace: HDSKSPC, + TargetFilespec: PCWSTR, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupRemoveSectionFromDiskSpaceListA( + DiskSpace: HDSKSPC, + InfHandle: HINF, + ListInfHandle: HINF, + SectionName: PCSTR, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupRemoveSectionFromDiskSpaceListW( + DiskSpace: HDSKSPC, + InfHandle: HINF, + ListInfHandle: HINF, + SectionName: PCWSTR, + Operation: UINT, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupRemoveInstallSectionFromDiskSpaceListA( + DiskSpace: HDSKSPC, + InfHandle: HINF, + LayoutInfHandle: HINF, + SectionName: PCSTR, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupRemoveInstallSectionFromDiskSpaceListW( + DiskSpace: HDSKSPC, + InfHandle: HINF, + LayoutInfHandle: HINF, + SectionName: PCWSTR, + Reserved1: PVOID, + Reserved2: UINT, + ) -> BOOL; + pub fn SetupIterateCabinetA( + CabinetFile: PCSTR, + Reserved: DWORD, + MsgHandler: PSP_FILE_CALLBACK_A, + Context: PVOID, + ) -> BOOL; + pub fn SetupIterateCabinetW( + CabinetFile: PCWSTR, + Reserved: DWORD, + MsgHandler: PSP_FILE_CALLBACK_W, + Context: PVOID, + ) -> BOOL; + pub fn SetupPromptReboot( + FileQueue: HSPFILEQ, + Owner: HWND, + ScanOnly: BOOL, + ) -> INT; +} +pub const SPFILEQ_FILE_IN_USE: INT = 0x00000001; +pub const SPFILEQ_REBOOT_RECOMMENDED: INT = 0x00000002; +pub const SPFILEQ_REBOOT_IN_PROGRESS: INT = 0x00000004; +extern "system" { + pub fn SetupInitDefaultQueueCallback( + OwnerWindow: HWND, + ) -> PVOID; + pub fn SetupInitDefaultQueueCallbackEx( + OwnerWindow: HWND, + AlternateProgressWindow: HWND, + ProgressMessage: UINT, + Reserved1: DWORD, + Reserved2: PVOID, + ) -> PVOID; + pub fn SetupTermDefaultQueueCallback( + Context: PVOID, + ) -> (); + pub fn SetupDefaultQueueCallbackA( + Context: PVOID, + Notification: UINT, + Param1: UINT_PTR, + Param2: UINT_PTR, + ) -> UINT; + pub fn SetupDefaultQueueCallbackW( + Context: PVOID, + Notification: UINT, + Param1: UINT_PTR, + Param2: UINT_PTR, + ) -> UINT; +} +pub const FLG_ADDREG_DELREG_BIT: DWORD = 0x00008000; +pub const FLG_ADDREG_BINVALUETYPE: DWORD = 0x00000001; +pub const FLG_ADDREG_NOCLOBBER: DWORD = 0x00000002; +pub const FLG_ADDREG_DELVAL: DWORD = 0x00000004; +pub const FLG_ADDREG_APPEND: DWORD = 0x00000008; +pub const FLG_ADDREG_KEYONLY: DWORD = 0x00000010; +pub const FLG_ADDREG_OVERWRITEONLY: DWORD = 0x00000020; +pub const FLG_ADDREG_64BITKEY: DWORD = 0x00001000; +pub const FLG_ADDREG_KEYONLY_COMMON: DWORD = 0x00002000; +pub const FLG_ADDREG_32BITKEY: DWORD = 0x00004000; +pub const FLG_ADDREG_TYPE_MASK: DWORD = 0xFFFF0000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_ADDREG_TYPE_SZ: DWORD = 0x00000000; +pub const FLG_ADDREG_TYPE_MULTI_SZ: DWORD = 0x00010000; +pub const FLG_ADDREG_TYPE_EXPAND_SZ: DWORD = 0x00020000; +pub const FLG_ADDREG_TYPE_BINARY: DWORD = 0x00000000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_ADDREG_TYPE_DWORD: DWORD = 0x00010000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_ADDREG_TYPE_NONE: DWORD = 0x00020000 | FLG_ADDREG_BINVALUETYPE; +pub const FLG_DELREG_VALUE: DWORD = 0x00000000; +pub const FLG_DELREG_TYPE_MASK: DWORD = FLG_ADDREG_TYPE_MASK; +pub const FLG_DELREG_TYPE_SZ: DWORD = FLG_ADDREG_TYPE_SZ; +pub const FLG_DELREG_TYPE_MULTI_SZ: DWORD = FLG_ADDREG_TYPE_MULTI_SZ; +pub const FLG_DELREG_TYPE_EXPAND_SZ: DWORD = FLG_ADDREG_TYPE_EXPAND_SZ; +pub const FLG_DELREG_TYPE_BINARY: DWORD = FLG_ADDREG_TYPE_BINARY; +pub const FLG_DELREG_TYPE_DWORD: DWORD = FLG_ADDREG_TYPE_DWORD; +pub const FLG_DELREG_TYPE_NONE: DWORD = FLG_ADDREG_TYPE_NONE; +pub const FLG_DELREG_64BITKEY: DWORD = FLG_ADDREG_64BITKEY; +pub const FLG_DELREG_KEYONLY_COMMON: DWORD = FLG_ADDREG_KEYONLY_COMMON; +pub const FLG_DELREG_32BITKEY: DWORD = FLG_ADDREG_32BITKEY; +pub const FLG_DELREG_OPERATION_MASK: DWORD = 0x000000FE; +pub const FLG_DELREG_MULTI_SZ_DELSTRING: DWORD = FLG_DELREG_TYPE_MULTI_SZ | FLG_ADDREG_DELREG_BIT + | 0x00000002; +pub const FLG_BITREG_CLEARBITS: DWORD = 0x00000000; +pub const FLG_BITREG_SETBITS: DWORD = 0x00000001; +pub const FLG_BITREG_64BITKEY: DWORD = 0x00001000; +pub const FLG_BITREG_32BITKEY: DWORD = 0x00004000; +pub const FLG_INI2REG_64BITKEY: DWORD = 0x00001000; +pub const FLG_INI2REG_32BITKEY: DWORD = 0x00004000; +pub const FLG_REGSVR_DLLREGISTER: DWORD = 0x00000001; +pub const FLG_REGSVR_DLLINSTALL: DWORD = 0x00000002; +pub const FLG_PROFITEM_CURRENTUSER: DWORD = 0x00000001; +pub const FLG_PROFITEM_DELETE: DWORD = 0x00000002; +pub const FLG_PROFITEM_GROUP: DWORD = 0x00000004; +pub const FLG_PROFITEM_CSIDL: DWORD = 0x00000008; +pub const FLG_ADDPROPERTY_NOCLOBBER: DWORD = 0x00000001; +pub const FLG_ADDPROPERTY_OVERWRITEONLY: DWORD = 0x00000002; +pub const FLG_ADDPROPERTY_APPEND: DWORD = 0x00000004; +pub const FLG_ADDPROPERTY_OR: DWORD = 0x00000008; +pub const FLG_ADDPROPERTY_AND: DWORD = 0x00000010; +pub const FLG_DELPROPERTY_MULTI_SZ_DELSTRING: DWORD = 0x00000001; +extern "system" { + pub fn SetupInstallFromInfSectionA( + Owner: HWND, + InfHandle: HINF, + SectionName: PCSTR, + Flags: UINT, + RelativeKeyRoot: HKEY, + SourceRootPath: PCSTR, + CopyFlags: UINT, + MsgHandler: PSP_FILE_CALLBACK_A, + Context: PVOID, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupInstallFromInfSectionW( + Owner: HWND, + InfHandle: HINF, + SectionName: PCWSTR, + Flags: UINT, + RelativeKeyRoot: HKEY, + SourceRootPath: PCWSTR, + CopyFlags: UINT, + MsgHandler: PSP_FILE_CALLBACK_W, + Context: PVOID, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; +} +pub const SPINST_LOGCONFIG: UINT = 0x00000001; +pub const SPINST_INIFILES: UINT = 0x00000002; +pub const SPINST_REGISTRY: UINT = 0x00000004; +pub const SPINST_INI2REG: UINT = 0x00000008; +pub const SPINST_FILES: UINT = 0x00000010; +pub const SPINST_BITREG: UINT = 0x00000020; +pub const SPINST_REGSVR: UINT = 0x00000040; +pub const SPINST_UNREGSVR: UINT = 0x00000080; +pub const SPINST_PROFILEITEMS: UINT = 0x00000100; +pub const SPINST_COPYINF: UINT = 0x00000200; +pub const SPINST_PROPERTIES: UINT = 0x00000400; +pub const SPINST_ALL: UINT = 0x000007ff; +pub const SPINST_SINGLESECTION: UINT = 0x00010000; +pub const SPINST_LOGCONFIG_IS_FORCED: UINT = 0x00020000; +pub const SPINST_LOGCONFIGS_ARE_OVERRIDES: UINT = 0x00040000; +pub const SPINST_REGISTERCALLBACKAWARE: UINT = 0x00080000; +pub const SPINST_DEVICEINSTALL: UINT = 0x00100000; +extern "system" { + pub fn SetupInstallFilesFromInfSectionA( + InfHandle: HINF, + LayoutInfHandle: HINF, + FileQueue: HSPFILEQ, + SectionName: PCSTR, + SourceRootPath: PCSTR, + CopyFlags: UINT, + ) -> BOOL; + pub fn SetupInstallFilesFromInfSectionW( + InfHandle: HINF, + LayoutInfHandle: HINF, + FileQueue: HSPFILEQ, + SectionName: PCWSTR, + SourceRootPath: PCWSTR, + CopyFlags: UINT, + ) -> BOOL; +} +pub const SPSVCINST_TAGTOFRONT: DWORD = 0x00000001; +pub const SPSVCINST_ASSOCSERVICE: DWORD = 0x00000002; +pub const SPSVCINST_DELETEEVENTLOGENTRY: DWORD = 0x00000004; +pub const SPSVCINST_NOCLOBBER_DISPLAYNAME: DWORD = 0x00000008; +pub const SPSVCINST_NOCLOBBER_STARTTYPE: DWORD = 0x00000010; +pub const SPSVCINST_NOCLOBBER_ERRORCONTROL: DWORD = 0x00000020; +pub const SPSVCINST_NOCLOBBER_LOADORDERGROUP: DWORD = 0x00000040; +pub const SPSVCINST_NOCLOBBER_DEPENDENCIES: DWORD = 0x00000080; +pub const SPSVCINST_NOCLOBBER_DESCRIPTION: DWORD = 0x00000100; +pub const SPSVCINST_STOPSERVICE: DWORD = 0x00000200; +pub const SPSVCINST_CLOBBER_SECURITY: DWORD = 0x00000400; +pub const SPSVCINST_STARTSERVICE: DWORD = 0x00000800; +pub const SPSVCINST_NOCLOBBER_REQUIREDPRIVILEGES: DWORD = 0x00001000; +extern "system" { + pub fn SetupInstallServicesFromInfSectionA( + InfHandle: HINF, + SectionName: PCSTR, + Flags: DWORD, + ) -> BOOL; + pub fn SetupInstallServicesFromInfSectionW( + InfHandle: HINF, + SectionName: PCWSTR, + Flags: DWORD, + ) -> BOOL; + pub fn SetupInstallServicesFromInfSectionExA( + InfHandle: HINF, + SectionName: PCSTR, + Flags: DWORD, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Reserved1: PVOID, + Reserved2: PVOID, + ) -> BOOL; + pub fn SetupInstallServicesFromInfSectionExW( + InfHandle: HINF, + SectionName: PCWSTR, + Flags: DWORD, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Reserved1: PVOID, + Reserved2: PVOID, + ) -> BOOL; + pub fn InstallHinfSectionA( + Window: HWND, + ModuleHandle: HINSTANCE, + CommandLine: PCSTR, + ShowCommand: INT, + ) -> (); + pub fn InstallHinfSectionW( + Window: HWND, + ModuleHandle: HINSTANCE, + CommandLine: PCWSTR, + ShowCommand: INT, + ) -> (); +} +pub type HSPFILELOG = PVOID; +extern "system" { + pub fn SetupInitializeFileLogA( + LogFileName: PCSTR, + Flags: DWORD, + ) -> HSPFILELOG; + pub fn SetupInitializeFileLogW( + LogFileName: PCWSTR, + Flags: DWORD, + ) -> HSPFILELOG; +} +pub const SPFILELOG_SYSTEMLOG: DWORD = 0x00000001; +pub const SPFILELOG_FORCENEW: DWORD = 0x00000002; +pub const SPFILELOG_QUERYONLY: DWORD = 0x00000004; +extern "system" { + pub fn SetupTerminateFileLog( + FileLogHandle: HSPFILELOG, + ) -> BOOL; + pub fn SetupLogFileA( + FileLogHandle: HSPFILELOG, + LogSectionName: PCSTR, + SourceFilename: PCSTR, + TargetFilename: PCSTR, + Checksum: DWORD, + DiskTagfile: PCSTR, + DiskDescription: PCSTR, + OtherInfo: PCSTR, + Flags: DWORD, + ) -> BOOL; + pub fn SetupLogFileW( + FileLogHandle: HSPFILELOG, + LogSectionName: PCWSTR, + SourceFilename: PCWSTR, + TargetFilename: PCWSTR, + Checksum: DWORD, + DiskTagfile: PCWSTR, + DiskDescription: PCWSTR, + OtherInfo: PCWSTR, + Flags: DWORD, + ) -> BOOL; +} +pub const SPFILELOG_OEMFILE: DWORD = 0x00000001; +extern "system" { + pub fn SetupRemoveFileLogEntryA( + FileLogHandle: HSPFILELOG, + LogSectionName: PCSTR, + TargetFilename: PCSTR, + ) -> BOOL; + pub fn SetupRemoveFileLogEntryW( + FileLogHandle: HSPFILELOG, + LogSectionName: PCWSTR, + TargetFilename: PCWSTR, + ) -> BOOL; +} +ENUM!{enum SetupFileLogInfo { + SetupFileLogSourceFilename, + SetupFileLogChecksum, + SetupFileLogDiskTagfile, + SetupFileLogDiskDescription, + SetupFileLogOtherInfo, + SetupFileLogMax, +}} +extern "system" { + pub fn SetupQueryFileLogA( + FileLogHandle: HSPFILELOG, + LogSectionName: PCSTR, + TargetFilename: PCSTR, + DesiredInfo: SetupFileLogInfo, + DataOut: PSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupQueryFileLogW( + FileLogHandle: HSPFILELOG, + LogSectionName: PCWSTR, + TargetFilename: PCWSTR, + DesiredInfo: SetupFileLogInfo, + DataOut: PWSTR, + ReturnBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; +} +pub type LogSeverity = DWORD; +pub const LogSevInformation: LogSeverity = 0x00000000; +pub const LogSevWarning: LogSeverity = 0x00000001; +pub const LogSevError: LogSeverity = 0x00000002; +pub const LogSevFatalError: LogSeverity = 0x00000003; +pub const LogSevMaximum: LogSeverity = 0x00000004; +extern "system" { + pub fn SetupOpenLog( + Erase: BOOL, + ) -> BOOL; + pub fn SetupLogErrorA( + MessageString: LPCSTR, + Severity: LogSeverity, + ) -> BOOL; + pub fn SetupLogErrorW( + MessageString: LPCWSTR, + Severity: LogSeverity, + ) -> BOOL; + pub fn SetupCloseLog() -> (); + pub fn SetupGetThreadLogToken() -> SP_LOG_TOKEN; + pub fn SetupSetThreadLogToken( + LogToken: SP_LOG_TOKEN, + ) -> (); +} +//pub fn SetupWriteTextLog() -> (); +//pub fn SetupWriteTextLogError() -> (); +extern "system" { + pub fn SetupWriteTextLogInfLine( + LogToken: SP_LOG_TOKEN, + Flags: DWORD, + InfHandle: HINF, + Context: PINFCONTEXT, + ) -> (); + pub fn SetupGetBackupInformationA( + QueueHandle: HSPFILEQ, + BackupParams: PSP_BACKUP_QUEUE_PARAMS_A, + ) -> BOOL; + pub fn SetupGetBackupInformationW( + QueueHandle: HSPFILEQ, + BackupParams: PSP_BACKUP_QUEUE_PARAMS_W, + ) -> BOOL; + pub fn SetupPrepareQueueForRestoreA( + QueueHandle: HSPFILEQ, + BackupPath: PCSTR, + RestoreFlags: DWORD, + ) -> BOOL; + pub fn SetupPrepareQueueForRestoreW( + QueueHandle: HSPFILEQ, + BackupPath: PCWSTR, + RestoreFlags: DWORD, + ) -> BOOL; + pub fn SetupSetNonInteractiveMode( + NonInteractiveFlag: BOOL, + ) -> BOOL; + pub fn SetupGetNonInteractiveMode() -> BOOL; + pub fn SetupDiCreateDeviceInfoList( + ClassGuid: *const GUID, + hwndParent: HWND, + ) -> HDEVINFO; + pub fn SetupDiCreateDeviceInfoListExA( + ClassGuid: *const GUID, + hwndParent: HWND, + MachineName: PCSTR, + Reserved: PVOID, + ) -> HDEVINFO; + pub fn SetupDiCreateDeviceInfoListExW( + ClassGuid: *const GUID, + hwndParent: HWND, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> HDEVINFO; + pub fn SetupDiGetDeviceInfoListClass( + DeviceInfoSet: HDEVINFO, + ClassGuid: LPGUID, + ) -> BOOL; + pub fn SetupDiGetDeviceInfoListDetailA( + DeviceInfoSet: HDEVINFO, + DeviceInfoSetDetailData: PSP_DEVINFO_LIST_DETAIL_DATA_A, + ) -> BOOL; + pub fn SetupDiGetDeviceInfoListDetailW( + DeviceInfoSet: HDEVINFO, + DeviceInfoSetDetailData: PSP_DEVINFO_LIST_DETAIL_DATA_W, + ) -> BOOL; +} +pub const DICD_GENERATE_ID: DWORD = 0x00000001; +pub const DICD_INHERIT_CLASSDRVS: DWORD = 0x00000002; +extern "system" { + pub fn SetupDiCreateDeviceInfoA( + DeviceInfoSet: HDEVINFO, + DeviceName: PCSTR, + ClassGuid: *const GUID, + DeviceDescription: PCSTR, + hwndParent: HWND, + CreationFlags: DWORD, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiCreateDeviceInfoW( + DeviceInfoSet: HDEVINFO, + DeviceName: PCWSTR, + ClassGuid: *const GUID, + DeviceDescription: PCWSTR, + hwndParent: HWND, + CreationFlags: DWORD, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; +} +pub const DIOD_INHERIT_CLASSDRVS: DWORD = 0x00000002; +pub const DIOD_CANCEL_REMOVE: DWORD = 0x00000004; +extern "system" { + pub fn SetupDiOpenDeviceInfoA( + DeviceInfoSet: HDEVINFO, + DeviceInstanceId: PCSTR, + hwndParent: HWND, + OpenFlags: DWORD, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiOpenDeviceInfoW( + DeviceInfoSet: HDEVINFO, + DeviceInstanceId: PCWSTR, + hwndParent: HWND, + OpenFlags: DWORD, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiGetDeviceInstanceIdA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DeviceInstanceId: PSTR, + DeviceInstanceIdSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetDeviceInstanceIdW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DeviceInstanceId: PWSTR, + DeviceInstanceIdSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiDeleteDeviceInfo( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiEnumDeviceInfo( + DeviceInfoSet: HDEVINFO, + MemberIndex: DWORD, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiDestroyDeviceInfoList( + DeviceInfoSet: HDEVINFO, + ) -> BOOL; + pub fn SetupDiEnumDeviceInterfaces( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + InterfaceClassGuid: *const GUID, + MemberIndex: DWORD, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; + pub fn SetupDiCreateDeviceInterfaceA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + InterfaceClassGuid: *const GUID, + ReferenceString: PCSTR, + CreationFlags: DWORD, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; + pub fn SetupDiCreateDeviceInterfaceW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + InterfaceClassGuid: *const GUID, + ReferenceString: PCWSTR, + CreationFlags: DWORD, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; +} +pub const DIODI_NO_ADD: DWORD = 0x00000001; +extern "system" { + pub fn SetupDiOpenDeviceInterfaceA( + DeviceInfoSet: HDEVINFO, + DevicePath: PCSTR, + OpenFlags: DWORD, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; + pub fn SetupDiOpenDeviceInterfaceW( + DeviceInfoSet: HDEVINFO, + DevicePath: PCWSTR, + OpenFlags: DWORD, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; + pub fn SetupDiGetDeviceInterfaceAlias( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + AliasInterfaceClassGuid: *const GUID, + AliasDeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; + pub fn SetupDiDeleteDeviceInterfaceData( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; + pub fn SetupDiRemoveDeviceInterface( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + ) -> BOOL; + pub fn SetupDiGetDeviceInterfaceDetailA( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + DeviceInterfaceDetailData: PSP_DEVICE_INTERFACE_DETAIL_DATA_A, + DeviceInterfaceDetailDataSize: DWORD, + RequiredSize: PDWORD, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiGetDeviceInterfaceDetailW( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + DeviceInterfaceDetailData: PSP_DEVICE_INTERFACE_DETAIL_DATA_W, + DeviceInterfaceDetailDataSize: DWORD, + RequiredSize: PDWORD, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiInstallDeviceInterfaces( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiSetDeviceInterfaceDefault( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Flags: DWORD, + Reserved: PVOID, + ) -> BOOL; +} +pub const SPRDI_FIND_DUPS: DWORD = 0x00000001; +extern "system" { + pub fn SetupDiRegisterDeviceInfo( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Flags: DWORD, + CompareProc: PSP_DETSIG_CMPPROC, + CompareContext: PVOID, + DupDeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; +} +pub const SPDIT_NODRIVER: DWORD = 0x00000000; +pub const SPDIT_CLASSDRIVER: DWORD = 0x00000001; +pub const SPDIT_COMPATDRIVER: DWORD = 0x00000002; +extern "system" { + pub fn SetupDiBuildDriverInfoList( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverType: DWORD, + ) -> BOOL; + pub fn SetupDiCancelDriverInfoSearch( + DeviceInfoSet: HDEVINFO, + ) -> BOOL; + pub fn SetupDiEnumDriverInfoA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverType: DWORD, + MemberIndex: DWORD, + DriverInfoData: PSP_DRVINFO_DATA_A, + ) -> BOOL; + pub fn SetupDiEnumDriverInfoW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverType: DWORD, + MemberIndex: DWORD, + DriverInfoData: PSP_DRVINFO_DATA_W, + ) -> BOOL; + pub fn SetupDiGetSelectedDriverA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_A, + ) -> BOOL; + pub fn SetupDiGetSelectedDriverW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_W, + ) -> BOOL; + pub fn SetupDiSetSelectedDriverA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_A, + ) -> BOOL; + pub fn SetupDiSetSelectedDriverW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_W, + ) -> BOOL; + pub fn SetupDiGetDriverInfoDetailA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_A, + DriverInfoDetailData: PSP_DRVINFO_DETAIL_DATA_A, + DriverInfoDetailDataSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetDriverInfoDetailW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_W, + DriverInfoDetailData: PSP_DRVINFO_DETAIL_DATA_W, + DriverInfoDetailDataSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiDestroyDriverInfoList( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverType: DWORD, + ) -> BOOL; +} +pub const DIGCF_DEFAULT: DWORD = 0x00000001; +pub const DIGCF_PRESENT: DWORD = 0x00000002; +pub const DIGCF_ALLCLASSES: DWORD = 0x00000004; +pub const DIGCF_PROFILE: DWORD = 0x00000008; +pub const DIGCF_DEVICEINTERFACE: DWORD = 0x00000010; +extern "system" { + pub fn SetupDiGetClassDevsA( + ClassGuid: *const GUID, + Enumerator: PCSTR, + hwndParent: HWND, + Flags: DWORD, + ) -> HDEVINFO; + pub fn SetupDiGetClassDevsW( + ClassGuid: *const GUID, + Enumerator: PCWSTR, + hwndParent: HWND, + Flags: DWORD, + ) -> HDEVINFO; + pub fn SetupDiGetClassDevsExA( + ClassGuid: *const GUID, + Enumerator: PCSTR, + hwndParent: HWND, + Flags: DWORD, + DeviceInfoSet: HDEVINFO, + MachineName: PCSTR, + Reserved: PVOID, + ) -> HDEVINFO; + pub fn SetupDiGetClassDevsExW( + ClassGuid: *const GUID, + Enumerator: PCWSTR, + hwndParent: HWND, + Flags: DWORD, + DeviceInfoSet: HDEVINFO, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> HDEVINFO; + pub fn SetupDiGetINFClassA( + InfName: PCSTR, + ClassGuid: LPGUID, + ClassName: PSTR, + ClassNameSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetINFClassW( + InfName: PCWSTR, + ClassGuid: LPGUID, + ClassName: PWSTR, + ClassNameSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; +} +pub const DIBCI_NOINSTALLCLASS: DWORD = 0x00000001; +pub const DIBCI_NODISPLAYCLASS: DWORD = 0x00000002; +extern "system" { + pub fn SetupDiBuildClassInfoList( + Flags: DWORD, + ClassGuidList: LPGUID, + ClassGuidListSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiBuildClassInfoListExA( + Flags: DWORD, + ClassGuidList: LPGUID, + ClassGuidListSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiBuildClassInfoListExW( + Flags: DWORD, + ClassGuidList: LPGUID, + ClassGuidListSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetClassDescriptionA( + ClassGuid: *const GUID, + ClassDescription: PSTR, + ClassDescriptionSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetClassDescriptionW( + ClassGuid: *const GUID, + ClassDescription: PWSTR, + ClassDescriptionSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetClassDescriptionExA( + ClassGuid: *const GUID, + ClassDescription: PSTR, + ClassDescriptionSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetClassDescriptionExW( + ClassGuid: *const GUID, + ClassDescription: PWSTR, + ClassDescriptionSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiCallClassInstaller( + InstallFunction: DI_FUNCTION, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiSelectDevice( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiSelectBestCompatDrv( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiInstallDevice( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiInstallDriverFiles( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiRegisterCoDeviceInstallers( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiRemoveDevice( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiUnremoveDevice( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiRestartDevices( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiChangeState( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiInstallClassA( + hwndParent: HWND, + InfFileName: PCSTR, + Flags: DWORD, + FileQueue: HSPFILEQ, + ) -> BOOL; + pub fn SetupDiInstallClassW( + hwndParent: HWND, + InfFileName: PCWSTR, + Flags: DWORD, + FileQueue: HSPFILEQ, + ) -> BOOL; + pub fn SetupDiInstallClassExA( + hwndParent: HWND, + InfFileName: PCSTR, + Flags: DWORD, + FileQueue: HSPFILEQ, + InterfaceClassGuid: *const GUID, + Reserved1: PVOID, + Reserved2: PVOID, + ) -> BOOL; + pub fn SetupDiInstallClassExW( + hwndParent: HWND, + InfFileName: PCWSTR, + Flags: DWORD, + FileQueue: HSPFILEQ, + InterfaceClassGuid: *const GUID, + Reserved1: PVOID, + Reserved2: PVOID, + ) -> BOOL; + pub fn SetupDiOpenClassRegKey( + ClassGuid: *const GUID, + samDesired: REGSAM, + ) -> HKEY; +} +pub const DIOCR_INSTALLER: DWORD = 0x00000001; +pub const DIOCR_INTERFACE: DWORD = 0x00000002; +extern "system" { + pub fn SetupDiOpenClassRegKeyExA( + ClassGuid: *const GUID, + samDesired: REGSAM, + Flags: DWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> HKEY; + pub fn SetupDiOpenClassRegKeyExW( + ClassGuid: *const GUID, + samDesired: REGSAM, + Flags: DWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> HKEY; + pub fn SetupDiCreateDeviceInterfaceRegKeyA( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + Reserved: DWORD, + samDesired: REGSAM, + InfHandle: HINF, + InfSectionName: PCSTR, + ) -> HKEY; + pub fn SetupDiCreateDeviceInterfaceRegKeyW( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + Reserved: DWORD, + samDesired: REGSAM, + InfHandle: HINF, + InfSectionName: PCWSTR, + ) -> HKEY; + pub fn SetupDiOpenDeviceInterfaceRegKey( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + Reserved: DWORD, + samDesired: REGSAM, + ) -> HKEY; + pub fn SetupDiDeleteDeviceInterfaceRegKey( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + Reserved: DWORD, + ) -> BOOL; +} +pub const DIREG_DEV: DWORD = 0x00000001; +pub const DIREG_DRV: DWORD = 0x00000002; +pub const DIREG_BOTH: DWORD = 0x00000004; +extern "system" { + pub fn SetupDiCreateDevRegKeyA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Scope: DWORD, + HwProfile: DWORD, + KeyType: DWORD, + InfHandle: HINF, + InfSectionName: PCSTR, + ) -> HKEY; + pub fn SetupDiCreateDevRegKeyW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Scope: DWORD, + HwProfile: DWORD, + KeyType: DWORD, + InfHandle: HINF, + InfSectionName: PCWSTR, + ) -> HKEY; + pub fn SetupDiOpenDevRegKey( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Scope: DWORD, + HwProfile: DWORD, + KeyType: DWORD, + samDesired: REGSAM, + ) -> HKEY; + pub fn SetupDiDeleteDevRegKey( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Scope: DWORD, + HwProfile: DWORD, + KeyType: DWORD, + ) -> BOOL; + pub fn SetupDiGetHwProfileList( + HwProfileList: PDWORD, + HwProfileListSize: DWORD, + RequiredSize: PDWORD, + CurrentlyActiveIndex: PDWORD, + ) -> BOOL; + pub fn SetupDiGetHwProfileListExA( + HwProfileList: PDWORD, + HwProfileListSize: DWORD, + RequiredSize: PDWORD, + CurrentlyActiveIndex: PDWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetHwProfileListExW( + HwProfileList: PDWORD, + HwProfileListSize: DWORD, + RequiredSize: PDWORD, + CurrentlyActiveIndex: PDWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetDevicePropertyKeys( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + PropertyKeyArray: *mut DEVPROPKEY, + PropertyKeyCount: DWORD, + RequiredPropertyKeyCount: PDWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiGetDevicePropertyW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + PropertyKey: *const DEVPROPKEY, + PropertyType: *mut DEVPROPTYPE, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiSetDevicePropertyW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + PropertyKey: *const DEVPROPKEY, + PropertyType: DEVPROPTYPE, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiGetDeviceInterfacePropertyKeys( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + PropertyKeyArray: *mut DEVPROPKEY, + PropertyKeyCount: DWORD, + RequiredPropertyKeyCount: PDWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiGetDeviceInterfacePropertyW( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + PropertyKey: *const DEVPROPKEY, + PropertyType: *mut DEVPROPTYPE, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiSetDeviceInterfacePropertyW( + DeviceInfoSet: HDEVINFO, + DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA, + PropertyKey: *const DEVPROPKEY, + PropertyType: DEVPROPTYPE, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + Flags: DWORD, + ) -> BOOL; +} +pub const DICLASSPROP_INSTALLER: DWORD = 0x00000001; +pub const DICLASSPROP_INTERFACE: DWORD = 0x00000002; +extern "system" { + pub fn SetupDiGetClassPropertyKeys( + ClassGuid: *const GUID, + PropertyKeyArray: *mut DEVPROPKEY, + PropertyKeyCount: DWORD, + RequiredPropertyKeyCount: PDWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiGetClassPropertyKeysExW( + ClassGuid: *const GUID, + PropertyKeyArray: *mut DEVPROPKEY, + PropertyKeyCount: DWORD, + RequiredPropertyKeyCount: PDWORD, + Flags: DWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetClassPropertyW( + ClassGuid: *const GUID, + PropertyKey: *const DEVPROPKEY, + PropertyType: *mut DEVPROPTYPE, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiGetClassPropertyExW( + ClassGuid: *const GUID, + PropertyKey: *const DEVPROPKEY, + PropertyType: *mut DEVPROPTYPE, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + Flags: DWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiSetClassPropertyW( + ClassGuid: *const GUID, + PropertyKey: *const DEVPROPKEY, + PropertyType: DEVPROPTYPE, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetupDiSetClassPropertyExW( + ClassGuid: *const GUID, + PropertyKey: *const DEVPROPKEY, + PropertyType: DEVPROPTYPE, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + Flags: DWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; +} +pub const SPDRP_DEVICEDESC: DWORD = 0x00000000; +pub const SPDRP_HARDWAREID: DWORD = 0x00000001; +pub const SPDRP_COMPATIBLEIDS: DWORD = 0x00000002; +pub const SPDRP_UNUSED0: DWORD = 0x00000003; +pub const SPDRP_SERVICE: DWORD = 0x00000004; +pub const SPDRP_UNUSED1: DWORD = 0x00000005; +pub const SPDRP_UNUSED2: DWORD = 0x00000006; +pub const SPDRP_CLASS: DWORD = 0x00000007; +pub const SPDRP_CLASSGUID: DWORD = 0x00000008; +pub const SPDRP_DRIVER: DWORD = 0x00000009; +pub const SPDRP_CONFIGFLAGS: DWORD = 0x0000000A; +pub const SPDRP_MFG: DWORD = 0x0000000B; +pub const SPDRP_FRIENDLYNAME: DWORD = 0x0000000C; +pub const SPDRP_LOCATION_INFORMATION: DWORD = 0x0000000D; +pub const SPDRP_PHYSICAL_DEVICE_OBJECT_NAME: DWORD = 0x0000000E; +pub const SPDRP_CAPABILITIES: DWORD = 0x0000000F; +pub const SPDRP_UI_NUMBER: DWORD = 0x00000010; +pub const SPDRP_UPPERFILTERS: DWORD = 0x00000011; +pub const SPDRP_LOWERFILTERS: DWORD = 0x00000012; +pub const SPDRP_BUSTYPEGUID: DWORD = 0x00000013; +pub const SPDRP_LEGACYBUSTYPE: DWORD = 0x00000014; +pub const SPDRP_BUSNUMBER: DWORD = 0x00000015; +pub const SPDRP_ENUMERATOR_NAME: DWORD = 0x00000016; +pub const SPDRP_SECURITY: DWORD = 0x00000017; +pub const SPDRP_SECURITY_SDS: DWORD = 0x00000018; +pub const SPDRP_DEVTYPE: DWORD = 0x00000019; +pub const SPDRP_EXCLUSIVE: DWORD = 0x0000001A; +pub const SPDRP_CHARACTERISTICS: DWORD = 0x0000001B; +pub const SPDRP_ADDRESS: DWORD = 0x0000001C; +pub const SPDRP_UI_NUMBER_DESC_FORMAT: DWORD = 0x0000001D; +pub const SPDRP_DEVICE_POWER_DATA: DWORD = 0x0000001E; +pub const SPDRP_REMOVAL_POLICY: DWORD = 0x0000001F; +pub const SPDRP_REMOVAL_POLICY_HW_DEFAULT: DWORD = 0x00000020; +pub const SPDRP_REMOVAL_POLICY_OVERRIDE: DWORD = 0x00000021; +pub const SPDRP_INSTALL_STATE: DWORD = 0x00000022; +pub const SPDRP_LOCATION_PATHS: DWORD = 0x00000023; +pub const SPDRP_BASE_CONTAINERID: DWORD = 0x00000024; +pub const SPDRP_MAXIMUM_PROPERTY: DWORD = 0x00000025; +pub const SPCRP_UPPERFILTERS: DWORD = 0x00000011; +pub const SPCRP_LOWERFILTERS: DWORD = 0x00000012; +pub const SPCRP_SECURITY: DWORD = 0x00000017; +pub const SPCRP_SECURITY_SDS: DWORD = 0x00000018; +pub const SPCRP_DEVTYPE: DWORD = 0x00000019; +pub const SPCRP_EXCLUSIVE: DWORD = 0x0000001A; +pub const SPCRP_CHARACTERISTICS: DWORD = 0x0000001B; +pub const SPCRP_MAXIMUM_PROPERTY: DWORD = 0x0000001C; +extern "system" { + pub fn SetupDiGetDeviceRegistryPropertyA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Property: DWORD, + PropertyRegDataType: PDWORD, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetDeviceRegistryPropertyW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Property: DWORD, + PropertyRegDataType: PDWORD, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetClassRegistryPropertyA( + ClassGuid: *const GUID, + Property: DWORD, + PropertyRegDataType: PDWORD, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetClassRegistryPropertyW( + ClassGuid: *const GUID, + Property: DWORD, + PropertyRegDataType: PDWORD, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiSetDeviceRegistryPropertyA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Property: DWORD, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + ) -> BOOL; + pub fn SetupDiSetDeviceRegistryPropertyW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + Property: DWORD, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + ) -> BOOL; + pub fn SetupDiSetClassRegistryPropertyA( + ClassGuid: *const GUID, + Property: DWORD, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiSetClassRegistryPropertyW( + ClassGuid: *const GUID, + Property: DWORD, + PropertyBuffer: *const BYTE, + PropertyBufferSize: DWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetDeviceInstallParamsA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DeviceInstallParams: PSP_DEVINSTALL_PARAMS_A, + ) -> BOOL; + pub fn SetupDiGetDeviceInstallParamsW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DeviceInstallParams: PSP_DEVINSTALL_PARAMS_W, + ) -> BOOL; + pub fn SetupDiGetClassInstallParamsA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ClassInstallParams: PSP_CLASSINSTALL_HEADER, + ClassInstallParamsSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetClassInstallParamsW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ClassInstallParams: PSP_CLASSINSTALL_HEADER, + ClassInstallParamsSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiSetDeviceInstallParamsA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DeviceInstallParams: PSP_DEVINSTALL_PARAMS_A, + ) -> BOOL; + pub fn SetupDiSetDeviceInstallParamsW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DeviceInstallParams: PSP_DEVINSTALL_PARAMS_W, + ) -> BOOL; + pub fn SetupDiSetClassInstallParamsA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ClassInstallParams: PSP_CLASSINSTALL_HEADER, + ClassInstallParamsSize: DWORD, + ) -> BOOL; + pub fn SetupDiSetClassInstallParamsW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ClassInstallParams: PSP_CLASSINSTALL_HEADER, + ClassInstallParamsSize: DWORD, + ) -> BOOL; + pub fn SetupDiGetDriverInstallParamsA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_A, + DriverInstallParams: PSP_DRVINSTALL_PARAMS, + ) -> BOOL; + pub fn SetupDiGetDriverInstallParamsW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_W, + DriverInstallParams: PSP_DRVINSTALL_PARAMS, + ) -> BOOL; + pub fn SetupDiSetDriverInstallParamsA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_A, + DriverInstallParams: PSP_DRVINSTALL_PARAMS, + ) -> BOOL; + pub fn SetupDiSetDriverInstallParamsW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + DriverInfoData: PSP_DRVINFO_DATA_W, + DriverInstallParams: PSP_DRVINSTALL_PARAMS, + ) -> BOOL; + pub fn SetupDiLoadClassIcon( + ClassGuid: *const GUID, + LargeIcon: *mut HICON, + MiniIconIndex: PINT, + ) -> BOOL; + pub fn SetupDiLoadDeviceIcon( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + cxIcon: UINT, + cyIcon: UINT, + Flags: DWORD, + hIcon: *mut HICON, + ) -> BOOL; +} +pub const DMI_MASK: DWORD = 0x00000001; +pub const DMI_BKCOLOR: DWORD = 0x00000002; +pub const DMI_USERECT: DWORD = 0x00000004; +extern "system" { + pub fn SetupDiDrawMiniIcon( + hdc: HDC, + rc: RECT, + MiniIconIndex: INT, + Flags: DWORD, + ) -> INT; + pub fn SetupDiGetClassBitmapIndex( + ClassGuid: *const GUID, + MiniIconIndex: PINT, + ) -> BOOL; + pub fn SetupDiGetClassImageList( + ClassImageListData: PSP_CLASSIMAGELIST_DATA, + ) -> BOOL; + pub fn SetupDiGetClassImageListExA( + ClassImageListData: PSP_CLASSIMAGELIST_DATA, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetClassImageListExW( + ClassImageListData: PSP_CLASSIMAGELIST_DATA, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetClassImageIndex( + ClassImageListData: PSP_CLASSIMAGELIST_DATA, + ClassGuid: *const GUID, + ImageIndex: PINT, + ) -> BOOL; + pub fn SetupDiDestroyClassImageList( + ClassImageListData: PSP_CLASSIMAGELIST_DATA, + ) -> BOOL; +} +pub const DIGCDP_FLAG_BASIC: DWORD = 0x00000001; +pub const DIGCDP_FLAG_ADVANCED: DWORD = 0x00000002; +pub const DIGCDP_FLAG_REMOTE_BASIC: DWORD = 0x00000003; +pub const DIGCDP_FLAG_REMOTE_ADVANCED: DWORD = 0x00000004; +extern "system" { + pub fn SetupDiGetClassDevPropertySheetsA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + PropertySheetHeader: LPPROPSHEETHEADERA, + PropertySheetHeaderPageListSize: DWORD, + RequiredSize: PDWORD, + PropertySheetType: DWORD, + ) -> BOOL; + pub fn SetupDiGetClassDevPropertySheetsW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + PropertySheetHeader: LPPROPSHEETHEADERW, + PropertySheetHeaderPageListSize: DWORD, + RequiredSize: PDWORD, + PropertySheetType: DWORD, + ) -> BOOL; +} +pub const IDI_RESOURCEFIRST: c_int = 159; +pub const IDI_RESOURCE: c_int = 159; +pub const IDI_RESOURCELAST: c_int = 161; +pub const IDI_RESOURCEOVERLAYFIRST: c_int = 161; +pub const IDI_RESOURCEOVERLAYLAST: c_int = 161; +pub const IDI_CONFLICT: c_int = 161; +pub const IDI_CLASSICON_OVERLAYFIRST: c_int = 500; +pub const IDI_CLASSICON_OVERLAYLAST: c_int = 502; +pub const IDI_PROBLEM_OVL: c_int = 500; +pub const IDI_DISABLED_OVL: c_int = 501; +pub const IDI_FORCED_OVL: c_int = 502; +extern "system" { + pub fn SetupDiAskForOEMDisk( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiSelectOEMDrv( + hwndParent: HWND, + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiClassNameFromGuidA( + ClassGuid: *const GUID, + ClassName: PSTR, + ClassNameSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiClassNameFromGuidW( + ClassGuid: *const GUID, + ClassName: PWSTR, + ClassNameSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiClassNameFromGuidExA( + ClassGuid: *const GUID, + ClassName: PSTR, + ClassNameSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiClassNameFromGuidExW( + ClassGuid: *const GUID, + ClassName: PWSTR, + ClassNameSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiClassGuidsFromNameA( + ClassName: PCSTR, + ClassGuidList: LPGUID, + ClassGuidListSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiClassGuidsFromNameW( + ClassName: PCWSTR, + ClassGuidList: LPGUID, + ClassGuidListSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiClassGuidsFromNameExA( + ClassName: PCSTR, + ClassGuidList: LPGUID, + ClassGuidListSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiClassGuidsFromNameExW( + ClassName: PCWSTR, + ClassGuidList: LPGUID, + ClassGuidListSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetHwProfileFriendlyNameA( + HwProfile: DWORD, + FriendlyName: PSTR, + FriendlyNameSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetHwProfileFriendlyNameW( + HwProfile: DWORD, + FriendlyName: PWSTR, + FriendlyNameSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetHwProfileFriendlyNameExA( + HwProfile: DWORD, + FriendlyName: PSTR, + FriendlyNameSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetHwProfileFriendlyNameExW( + HwProfile: DWORD, + FriendlyName: PWSTR, + FriendlyNameSize: DWORD, + RequiredSize: PDWORD, + MachineName: PCWSTR, + Reserved: PVOID, + ) -> BOOL; +} +pub const SPWPT_SELECTDEVICE: DWORD = 0x00000001; +pub const SPWP_USE_DEVINFO_DATA: DWORD = 0x00000001; +extern "system" { + pub fn SetupDiGetWizardPage( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + InstallWizardData: PSP_INSTALLWIZARD_DATA, + PageType: DWORD, + Flags: DWORD, + ) -> HPROPSHEETPAGE; + pub fn SetupDiGetSelectedDevice( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiSetSelectedDevice( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + ) -> BOOL; + pub fn SetupDiGetActualModelsSectionA( + Context: PINFCONTEXT, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + InfSectionWithExt: PSTR, + InfSectionWithExtSize: DWORD, + RequiredSize: PDWORD, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetActualModelsSectionW( + Context: PINFCONTEXT, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + InfSectionWithExt: PWSTR, + InfSectionWithExtSize: DWORD, + RequiredSize: PDWORD, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetActualSectionToInstallA( + InfHandle: HINF, + InfSectionName: PCSTR, + InfSectionWithExt: PSTR, + InfSectionWithExtSize: DWORD, + RequiredSize: PDWORD, + Extension: *mut PSTR, + ) -> BOOL; + pub fn SetupDiGetActualSectionToInstallW( + InfHandle: HINF, + InfSectionName: PCWSTR, + InfSectionWithExt: PWSTR, + InfSectionWithExtSize: DWORD, + RequiredSize: PDWORD, + Extension: *mut PWSTR, + ) -> BOOL; + pub fn SetupDiGetActualSectionToInstallExA( + InfHandle: HINF, + InfSectionName: PCSTR, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + InfSectionWithExt: PSTR, + InfSectionWithExtSize: DWORD, + RequiredSize: PDWORD, + Extension: *mut PSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupDiGetActualSectionToInstallExW( + InfHandle: HINF, + InfSectionName: PCWSTR, + AlternatePlatformInfo: PSP_ALTPLATFORM_INFO, + InfSectionWithExt: PWSTR, + InfSectionWithExtSize: DWORD, + RequiredSize: PDWORD, + Extension: *mut PWSTR, + Reserved: PVOID, + ) -> BOOL; + pub fn SetupEnumInfSectionsA( + InfHandle: HINF, + Index: UINT, + Buffer: PSTR, + Size: UINT, + SizeNeeded: *mut UINT, + ) -> BOOL; + pub fn SetupEnumInfSectionsW( + InfHandle: HINF, + Index: UINT, + Buffer: PWSTR, + Size: UINT, + SizeNeeded: *mut UINT, + ) -> BOOL; +} +STRUCT!{struct SP_INF_SIGNER_INFO_V1_A { + cbSize: DWORD, + CatalogFile: [CHAR; MAX_PATH], + DigitalSigner: [CHAR; MAX_PATH], + DigitalSignerVersion: [CHAR; MAX_PATH], +}} +pub type PSP_INF_SIGNER_INFO_V1_A = *mut SP_INF_SIGNER_INFO_V1_A; +STRUCT!{struct SP_INF_SIGNER_INFO_V1_W { + cbSize: DWORD, + CatalogFile: [WCHAR; MAX_PATH], + DigitalSigner: [WCHAR; MAX_PATH], + DigitalSignerVersion: [WCHAR; MAX_PATH], +}} +pub type PSP_INF_SIGNER_INFO_V1_W = *mut SP_INF_SIGNER_INFO_V1_W; +STRUCT!{struct SP_INF_SIGNER_INFO_V2_A { + cbSize: DWORD, + CatalogFile: [CHAR; MAX_PATH], + DigitalSigner: [CHAR; MAX_PATH], + DigitalSignerVersion: [CHAR; MAX_PATH], + SignerScore: DWORD, +}} +pub type PSP_INF_SIGNER_INFO_V2_A = *mut SP_INF_SIGNER_INFO_V2_A; +STRUCT!{struct SP_INF_SIGNER_INFO_V2_W { + cbSize: DWORD, + CatalogFile: [WCHAR; MAX_PATH], + DigitalSigner: [WCHAR; MAX_PATH], + DigitalSignerVersion: [WCHAR; MAX_PATH], + SignerScore: DWORD, +}} +pub type PSP_INF_SIGNER_INFO_V2_W = *mut SP_INF_SIGNER_INFO_V2_W; +pub const SIGNERSCORE_UNKNOWN: DWORD = 0xFF000000; +pub const SIGNERSCORE_W9X_SUSPECT: DWORD = 0xC0000000; +pub const SIGNERSCORE_UNSIGNED: DWORD = 0x80000000; +pub const SIGNERSCORE_AUTHENTICODE: DWORD = 0x0F000000; +pub const SIGNERSCORE_WHQL: DWORD = 0x0D000005; +pub const SIGNERSCORE_UNCLASSIFIED: DWORD = 0x0D000004; +pub const SIGNERSCORE_INBOX: DWORD = 0x0D000003; +pub const SIGNERSCORE_LOGO_STANDARD: DWORD = 0x0D000002; +pub const SIGNERSCORE_LOGO_PREMIUM: DWORD = 0x0D000001; +pub const SIGNERSCORE_MASK: DWORD = 0xFF000000; +pub const SIGNERSCORE_SIGNED_MASK: DWORD = 0xF0000000; +pub type SP_INF_SIGNER_INFO_A = SP_INF_SIGNER_INFO_V2_A; +pub type PSP_INF_SIGNER_INFO_A = PSP_INF_SIGNER_INFO_V2_A; +pub type SP_INF_SIGNER_INFO_W = SP_INF_SIGNER_INFO_V2_W; +pub type PSP_INF_SIGNER_INFO_W = PSP_INF_SIGNER_INFO_V2_W; +extern "system" { + pub fn SetupVerifyInfFileA( + InfName: PCSTR, + AltPlatformInfo: PSP_ALTPLATFORM_INFO, + InfSignerInfo: PSP_INF_SIGNER_INFO_A, + ) -> BOOL; + pub fn SetupVerifyInfFileW( + InfName: PCWSTR, + AltPlatformInfo: PSP_ALTPLATFORM_INFO, + InfSignerInfo: PSP_INF_SIGNER_INFO_W, + ) -> BOOL; +} +pub const DICUSTOMDEVPROP_MERGE_MULTISZ: DWORD = 0x00000001; +extern "system" { + pub fn SetupDiGetCustomDevicePropertyA( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + CustomPropertyName: PCSTR, + Flags: DWORD, + PropertyRegDataType: PDWORD, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; + pub fn SetupDiGetCustomDevicePropertyW( + DeviceInfoSet: HDEVINFO, + DeviceInfoData: PSP_DEVINFO_DATA, + CustomPropertyName: PCWSTR, + Flags: DWORD, + PropertyRegDataType: PDWORD, + PropertyBuffer: PBYTE, + PropertyBufferSize: DWORD, + RequiredSize: PDWORD, + ) -> BOOL; +} +pub const SCWMI_CLOBBER_SECURITY: DWORD = 0x00000001; +extern "system" { + pub fn SetupConfigureWmiFromInfSectionA( + InfHandle: HINF, + SectionName: PCSTR, + Flags: DWORD, + ) -> BOOL; + pub fn SetupConfigureWmiFromInfSectionW( + InfHandle: HINF, + SectionName: PCWSTR, + Flags: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/shellapi.rs b/src/vendor/winapi/src/um/shellapi.rs new file mode 100644 index 0000000000..f5716618db --- /dev/null +++ b/src/vendor/winapi/src/um/shellapi.rs @@ -0,0 +1,924 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! SHELL.DLL functions, types, and definitions +use ctypes::{__int64, c_int, c_void}; +use shared::basetsd::{DWORD_PTR, UINT_PTR}; +use shared::guiddef::{GUID, REFIID}; +use shared::minwindef::{ + BOOL, DWORD, FILETIME, HINSTANCE, HKEY, INT, LPARAM, LPVOID, MAX_PATH, UINT, ULONG, WORD, +}; +use shared::windef::{HICON, HWND, POINT, RECT}; +use um::minwinbase::LPSECURITY_ATTRIBUTES; +use um::processthreadsapi::{LPPROCESS_INFORMATION, LPSTARTUPINFOW}; +use um::winnt::{ + CHAR, HANDLE, HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCSTR, PCWSTR, PCZZSTR, PCZZWSTR, PWSTR, + PZZSTR, PZZWSTR, ULARGE_INTEGER, WCHAR, +}; +use um::winuser::WM_USER; +DECLARE_HANDLE!(HDROP, HDROP__); +extern "system" { + pub fn DragQueryFileA( + hDrop: HDROP, + iFile: UINT, + lpszFile: LPSTR, + cch: UINT, + ) -> UINT; + pub fn DragQueryFileW( + hDrop: HDROP, + iFile: UINT, + lpszFile: LPWSTR, + cch: UINT, + ) -> UINT; + pub fn DragQueryPoint( + hDrop: HDROP, + lppt: *mut POINT, + ) -> BOOL; + pub fn DragFinish( + hDrop: HDROP, + ); + pub fn DragAcceptFiles( + hWnd: HWND, + fAccept: BOOL, + ); + pub fn ShellExecuteA( + hwnd: HWND, + lpOperation: LPCSTR, + lpFile: LPCSTR, + lpParameters: LPCSTR, + lpDirectory: LPCSTR, + nShowCmd: c_int, + ) -> HINSTANCE; + pub fn ShellExecuteW( + hwnd: HWND, + lpOperation: LPCWSTR, + lpFile: LPCWSTR, + lpParameters: LPCWSTR, + lpDirectory: LPCWSTR, + nShowCmd: c_int, + ) -> HINSTANCE; + pub fn FindExecutableA( + lpFile: LPCSTR, + lpDirectory: LPCSTR, + lpResult: LPSTR, + ) -> HINSTANCE; + pub fn FindExecutableW( + lpFile: LPCWSTR, + lpDirectory: LPCWSTR, + lpResult: LPWSTR, + ) -> HINSTANCE; + pub fn CommandLineToArgvW( + lpCmdLine: LPCWSTR, + pNumArgs: *mut c_int, + ) -> *mut LPWSTR; + pub fn ShellAboutA( + hWnd: HWND, + szApp: LPCSTR, + szOtherStuff: LPCSTR, + hIcon: HICON, + ) -> INT; + pub fn ShellAboutW( + hWnd: HWND, + szApp: LPCWSTR, + szOtherStuff: LPCWSTR, + hIcon: HICON, + ) -> INT; + pub fn DuplicateIcon( + hInst: HINSTANCE, + hIcon: HICON, + ) -> HICON; + pub fn ExtractAssociatedIconA( + hInst: HINSTANCE, + pszIconPath: LPSTR, + piIcon: *mut WORD, + ) -> HICON; + pub fn ExtractAssociatedIconW( + hInst: HINSTANCE, + pszIconPath: LPWSTR, + piIcon: *mut WORD, + ) -> HICON; + pub fn ExtractAssociatedIconExA( + hInst: HINSTANCE, + pszIconPath: LPSTR, + piIconIndex: *mut WORD, + piIconId: *mut WORD, + ) -> HICON; + pub fn ExtractAssociatedIconExW( + hInst: HINSTANCE, + pszIconPath: LPWSTR, + piIconIndex: *mut WORD, + piIconId: *mut WORD, + ) -> HICON; + pub fn ExtractIconA( + hInst: HINSTANCE, + pszExeFileName: LPCSTR, + nIconIndex: UINT, + ) -> HICON; + pub fn ExtractIconW( + hInst: HINSTANCE, + pszExeFileName: LPCSTR, + nIconIndex: UINT, + ) -> HICON; +} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct DRAGINFOA { + uSize: UINT, + pt: POINT, + fNC: BOOL, + lpFileList: PZZSTR, + grfKeyState: DWORD, +}} +pub type LPDRAGINFOA = *mut DRAGINFOA; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct DRAGINFOW { + uSize: UINT, + pt: POINT, + fNC: BOOL, + lpFileList: PZZWSTR, + grfKeyState: DWORD, +}} +pub type LPDRAGINFOW = *mut DRAGINFOW; +pub const ABM_NEW: DWORD = 0x00000000; +pub const ABM_REMOVE: DWORD = 0x00000001; +pub const ABM_QUERYPOS: DWORD = 0x00000002; +pub const ABM_SETPOS: DWORD = 0x00000003; +pub const ABM_GETSTATE: DWORD = 0x00000004; +pub const ABM_GETTASKBARPOS: DWORD = 0x00000005; +pub const ABM_ACTIVATE: DWORD = 0x00000006; +pub const ABM_GETAUTOHIDEBAR: DWORD = 0x00000007; +pub const ABM_SETAUTOHIDEBAR: DWORD = 0x00000008; +pub const ABM_WINDOWPOSCHANGED: DWORD = 0x0000009; +pub const ABM_SETSTATE: DWORD = 0x0000000a; +pub const ABM_GETAUTOHIDEBAREX: DWORD = 0x0000000b; +pub const ABM_SETAUTOHIDEBAREX: DWORD = 0x0000000c; +pub const ABN_STATECHANGE: DWORD = 0x0000000; +pub const ABN_POSCHANGED: DWORD = 0x0000001; +pub const ABN_FULLSCREENAPP: DWORD = 0x0000002; +pub const ABN_WINDOWARRANGE: DWORD = 0x0000003; +pub const ABS_AUTOHIDE: UINT = 0x0000001; +pub const ABS_ALWAYSONTOP: UINT = 0x0000002; +pub const ABE_LEFT: UINT = 0; +pub const ABE_TOP: UINT = 1; +pub const ABE_RIGHT: UINT = 2; +pub const ABE_BOTTOM: UINT = 3; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct APPBARDATA { + cbSize: DWORD, + hWnd: HWND, + uCallbackMessage: UINT, + uEdge: UINT, + rc: RECT, + lParam: LPARAM, +}} +pub type PAPPBARDATA = *mut APPBARDATA; +extern "system" { + pub fn SHAppBarMessage( + dwMessage: DWORD, + pData: PAPPBARDATA, + ) -> UINT_PTR; + pub fn DoEnvironmentSubstA( + pszSrc: LPSTR, + cchSrc: UINT, + ) -> DWORD; + pub fn DoEnvironmentSubstW( + pszSrc: LPWSTR, + cchSrc: UINT, + ) -> DWORD; + pub fn ExtractIconExA( + lpszFile: LPCSTR, + nIconIndex: c_int, + phiconLarge: *mut HICON, + phiconSmall: *mut HICON, + nIcons: UINT, + ) -> UINT; + pub fn ExtractIconExW( + lpszFile: LPCWSTR, + nIconIndex: c_int, + phiconLarge: *mut HICON, + phiconSmall: *mut HICON, + nIcons: UINT, + ) -> UINT; +} +pub const FO_MOVE: WORD = 0x0001; +pub const FO_COPY: WORD = 0x0002; +pub const FO_DELETE: WORD = 0x0003; +pub const FO_RENAME: WORD = 0x0004; +pub const FOF_MULTIDESTFILES: WORD = 0x0001; +pub const FOF_CONFIRMMOUSE: WORD = 0x0002; +pub const FOF_SILENT: WORD = 0x0004; +pub const FOF_RENAMEONCOLLISION: WORD = 0x0008; +pub const FOF_NOCONFIRMATION: WORD = 0x0010; +pub const FOF_WANTMAPPINGHANDLE: WORD = 0x0020; +pub const FOF_ALLOWUNDO: WORD = 0x0040; +pub const FOF_FILESONLY: WORD = 0x0080; +pub const FOF_SIMPLEPROGRESS: WORD = 0x0100; +pub const FOF_NOCONFIRMMKDIR: WORD = 0x0200; +pub const FOF_NOERRORUI: WORD = 0x0400; +pub const FOF_NOCOPYSECURITYATTRIBS: WORD = 0x0800; +pub const FOF_NORECURSION: WORD = 0x1000; +pub const FOF_NO_CONNECTED_ELEMENTS: WORD = 0x2000; +pub const FOF_WANTNUKEWARNING: WORD = 0x4000; +pub const FOF_NORECURSEREPARSE: WORD = 0x8000; +pub const FOF_NO_UI: WORD = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR; +pub type FILEOP_FLAGS = WORD; +pub const PO_DELETE: WORD = 0x0013; +pub const PO_RENAME: WORD = 0x0014; +pub const PO_PORTCHANGE: WORD = 0x0020; +pub const PO_REN_PORT: WORD = 0x0034; +pub type PRINTEROP_FLAGS = WORD; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEOPSTRUCTA { + hwnd: HWND, + wFunc: UINT, + pFrom: PCZZSTR, + pTo: PCZZSTR, + fFlags: FILEOP_FLAGS, + fAnyOperationsAborted: BOOL, + hNameMappings: LPVOID, + lpszProgressTitle: PCSTR, +}} +pub type LPSHFILEOPSTRUCTA = *mut SHFILEOPSTRUCTA; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEOPSTRUCTW { + hwnd: HWND, + wFunc: UINT, + pFrom: PCZZWSTR, + pTo: PCZZWSTR, + fFlags: FILEOP_FLAGS, + fAnyOperationsAborted: BOOL, + hNameMappings: LPVOID, + lpszProgressTitle: PCWSTR, +}} +pub type LPSHFILEOPSTRUCTW = *mut SHFILEOPSTRUCTW; +extern "system" { + pub fn SHFileOperationA( + lpFileOp: LPSHFILEOPSTRUCTA, + ) -> c_int; + pub fn SHFileOperationW( + lpFileOp: LPSHFILEOPSTRUCTW, + ) -> c_int; + pub fn SHFreeNameMappings( + hNameMappings: HANDLE, + ); +} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHNAMEMAPPINGA { + pszOldPath: LPSTR, + pszNewPath: LPSTR, + cchOldPath: c_int, + cchNewPath: c_int, +}} +pub type LPSHNAMEMAPPINGA = *mut SHNAMEMAPPINGA; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHNAMEMAPPINGW { + pszOldPath: LPWSTR, + pszNewPath: LPWSTR, + cchOldPath: c_int, + cchNewPath: c_int, +}} +pub type LPSHNAMEMAPPINGW = *mut SHNAMEMAPPINGW; +pub const SE_ERR_FNF: DWORD = 2; +pub const SE_ERR_PNF: DWORD = 3; +pub const SE_ERR_ACCESSDENIED: DWORD = 5; +pub const SE_ERR_OOM: DWORD = 8; +pub const SE_ERR_DLLNOTFOUND: DWORD = 32; +pub const SE_ERR_SHARE: DWORD = 26; +pub const SE_ERR_ASSOCINCOMPLETE: DWORD = 27; +pub const SE_ERR_DDETIMEOUT: DWORD = 28; +pub const SE_ERR_DDEFAIL: DWORD = 29; +pub const SE_ERR_DDEBUSY: DWORD = 30; +pub const SE_ERR_NOASSOC: DWORD = 31; +pub const SEE_MASK_DEFAULT: DWORD = 0x00000000; +pub const SEE_MASK_CLASSNAME: DWORD = 0x00000001; +pub const SEE_MASK_CLASSKEY: DWORD = 0x00000003; +pub const SEE_MASK_IDLIST: DWORD = 0x00000004; +pub const SEE_MASK_INVOKEIDLIST: DWORD = 0x0000000c; +pub const SEE_MASK_ICON: DWORD = 0x00000010; +pub const SEE_MASK_HOTKEY: DWORD = 0x00000020; +pub const SEE_MASK_NOCLOSEPROCESS: DWORD = 0x00000040; +pub const SEE_MASK_CONNECTNETDRV: DWORD = 0x00000080; +pub const SEE_MASK_NOASYNC: DWORD = 0x00000100; +pub const SEE_MASK_FLAG_DDEWAIT: DWORD = SEE_MASK_NOASYNC; +pub const SEE_MASK_DOENVSUBST: DWORD = 0x00000200; +pub const SEE_MASK_FLAG_NO_UI: DWORD = 0x00000400; +pub const SEE_MASK_UNICODE: DWORD = 0x00004000; +pub const SEE_MASK_NO_CONSOLE: DWORD = 0x00008000; +pub const SEE_MASK_ASYNCOK: DWORD = 0x00100000; +pub const SEE_MASK_HMONITOR: DWORD = 0x00200000; +pub const SEE_MASK_NOZONECHECKS: DWORD = 0x00800000; +pub const SEE_MASK_NOQUERYCLASSSTORE: DWORD = 0x01000000; +pub const SEE_MASK_WAITFORINPUTIDLE: DWORD = 0x02000000; +pub const SEE_MASK_FLAG_LOG_USAGE: DWORD = 0x04000000; +pub const SEE_MASK_FLAG_HINST_IS_SITE: DWORD = 0x08000000; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHELLEXECUTEINFOA { + cbSize: DWORD, + fMask: ULONG, + hwnd: HWND, + lpVerb: LPCSTR, + lpFile: LPCSTR, + lpParameters: LPCSTR, + lpDirectory: LPCSTR, + nShow: c_int, + hInstApp: HINSTANCE, + lpIDList: *mut c_void, + lpClass: LPCSTR, + hkeyClass: HKEY, + dwHotKey: DWORD, + hMonitor: HANDLE, + hProcess: HANDLE, +}} +pub type LPSHELLEXECUTEINFOA = *mut SHELLEXECUTEINFOA; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHELLEXECUTEINFOW { + cbSize: DWORD, + fMask: ULONG, + hwnd: HWND, + lpVerb: LPCWSTR, + lpFile: LPCWSTR, + lpParameters: LPCWSTR, + lpDirectory: LPCWSTR, + nShow: c_int, + hInstApp: HINSTANCE, + lpIDList: *mut c_void, + lpClass: LPCWSTR, + hkeyClass: HKEY, + dwHotKey: DWORD, + hMonitor: HANDLE, + hProcess: HANDLE, +}} +pub type LPSHELLEXECUTEINFOW = *mut SHELLEXECUTEINFOW; +extern "system" { + pub fn ShellExecuteExA( + pExecInfo: *mut SHELLEXECUTEINFOA, + ) -> BOOL; + pub fn ShellExecuteExW( + pExecInfo: *mut SHELLEXECUTEINFOW, + ) -> BOOL; +} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHCREATEPROCESSINFOW { + cbSize: DWORD, + fMask: ULONG, + hwnd: HWND, + pszFile: LPCWSTR, + pszParameters: LPCWSTR, + pszCurrentDirectory: LPCWSTR, + hUserToken: HANDLE, + lpProcessAttributes: LPSECURITY_ATTRIBUTES, + lpThreadAttributes: LPSECURITY_ATTRIBUTES, + bInheritHandles: BOOL, + dwCreationFlags: DWORD, + lpStartupInfo: LPSTARTUPINFOW, + lpProcessInformation: LPPROCESS_INFORMATION, +}} +pub type PSHCREATEPROCESSINFOW = *mut SHCREATEPROCESSINFOW; +extern "system" { + pub fn SHCreateProcessAsUserW( + pscpi: PSHCREATEPROCESSINFOW, + ) -> BOOL; + pub fn SHEvaluateSystemCommandTemplate( + pszCmdTemplate: PCWSTR, + ppszApplication: *mut PWSTR, + ppszCommandLine: *mut PWSTR, + ppszParameters: *mut PWSTR, + ) -> HRESULT; +} +ENUM!{enum ASSOCCLASS { + ASSOCCLASS_SHELL_KEY = 0, + ASSOCCLASS_PROGID_KEY, + ASSOCCLASS_PROGID_STR, + ASSOCCLASS_CLSID_KEY, + ASSOCCLASS_CLSID_STR, + ASSOCCLASS_APP_KEY, + ASSOCCLASS_APP_STR, + ASSOCCLASS_SYSTEM_STR, + ASSOCCLASS_FOLDER, + ASSOCCLASS_STAR, + ASSOCCLASS_FIXED_PROGID_STR, + ASSOCCLASS_PROTOCOL_STR, +}} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct ASSOCIATIONELEMENT { + ac: ASSOCCLASS, + hkClass: HKEY, + pszClass: PCWSTR, +}} +extern "system" { + pub fn AssocCreateForClasses( + rgClasses: *const ASSOCIATIONELEMENT, + cClasses: ULONG, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT; +} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHQUERYRBINFO { + cbSize: DWORD, + i64Size: __int64, + i64NumItems: __int64, +}} +pub type LPSHQUERYRBINFO = *mut SHQUERYRBINFO; +pub const SHERB_NOCONFIRMATION: DWORD = 0x00000001; +pub const SHERB_NOPROGRESSUI: DWORD = 0x00000002; +pub const SHERB_NOSOUND: DWORD = 0x00000004; +extern "system" { + pub fn SHQueryRecycleBinA( + pszRootPath: LPCSTR, + pSHQueryRBInfo: LPSHQUERYRBINFO, + ) -> HRESULT; + pub fn SHQueryRecycleBinW( + pszRootPath: LPCWSTR, + pSHQueryRBInfo: LPSHQUERYRBINFO, + ) -> HRESULT; + pub fn SHEmptyRecycleBinA( + hwnd: HWND, + pszRootPath: LPCSTR, + dwFlags: DWORD, + ) -> HRESULT; + pub fn SHEmptyRecycleBinW( + hwnd: HWND, + pszRootPath: LPCWSTR, + dwFlags: DWORD, + ) -> HRESULT; +} +ENUM!{enum QUERY_USER_NOTIFICATION_STATE { + QUNS_NOT_PRESENT = 1, + QUNS_BUSY = 2, + QUNS_RUNNING_D3D_FULL_SCREEN = 3, + QUNS_PRESENTATION_MODE = 4, + QUNS_ACCEPTS_NOTIFICATIONS = 5, + QUNS_QUIET_TIME = 6, + QUNS_APP = 7, +}} +extern "system" { + pub fn SHQueryUserNotificationState( + pquns: *mut QUERY_USER_NOTIFICATION_STATE, + ) -> HRESULT; + pub fn SHGetPropertyStoreForWindow( + hwnd: HWND, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT; +} +UNION!{union NOTIFYICONDATAA_u { + [u32; 1], + uTimeout uTimeout_mut: UINT, + uVersion uVersion_mut: UINT, +}} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct NOTIFYICONDATAA { + cbSize: DWORD, + hWnd: HWND, + uID: UINT, + uFlags: UINT, + uCallbackMessage: UINT, + hIcon: HICON, + szTip: [CHAR; 128], + dwState: DWORD, + dwStateMask: DWORD, + szInfo: [CHAR; 256], + u: NOTIFYICONDATAA_u, + szInfoTitle: [CHAR; 64], + dwInfoFlags: DWORD, + guidItem: GUID, + hBalloonIcon: HICON, +}} +pub type PNOTIFYICONDATAA = *mut NOTIFYICONDATAA; +UNION!{union NOTIFYICONDATAW_u { + [u32; 1], + uTimeout uTimeout_mut: UINT, + uVersion uVersion_mut: UINT, +}} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct NOTIFYICONDATAW { + cbSize: DWORD, + hWnd: HWND, + uID: UINT, + uFlags: UINT, + uCallbackMessage: UINT, + hIcon: HICON, + szTip: [WCHAR; 128], + dwState: DWORD, + dwStateMask: DWORD, + szInfo: [WCHAR; 256], + u: NOTIFYICONDATAW_u, + szInfoTitle: [WCHAR; 64], + dwInfoFlags: DWORD, + guidItem: GUID, + hBalloonIcon: HICON, +}} +pub type PNOTIFYICONDATAW = *mut NOTIFYICONDATAW; +pub const NIN_SELECT: DWORD = WM_USER + 0; +pub const NINF_KEY: DWORD = 0x1; +pub const NIN_KEYSELECT: DWORD = NIN_SELECT | NINF_KEY; +pub const NIN_BALLOONSHOW: DWORD = WM_USER + 2; +pub const NIN_BALLOONHIDE: DWORD = WM_USER + 3; +pub const NIN_BALLOONTIMEOUT: DWORD = WM_USER + 4; +pub const NIN_BALLOONUSERCLICK: DWORD = WM_USER + 5; +pub const NIN_POPUPOPEN: DWORD = WM_USER + 6; +pub const NIN_POPUPCLOSE: DWORD = WM_USER + 7; +pub const NIM_ADD: DWORD = 0x00000000; +pub const NIM_MODIFY: DWORD = 0x00000001; +pub const NIM_DELETE: DWORD = 0x00000002; +pub const NIM_SETFOCUS: DWORD = 0x00000003; +pub const NIM_SETVERSION: DWORD = 0x00000004; +pub const NOTIFYICON_VERSION: DWORD = 3; +pub const NOTIFYICON_VERSION_4: DWORD = 4; +pub const NIF_MESSAGE: DWORD = 0x00000001; +pub const NIF_ICON: DWORD = 0x00000002; +pub const NIF_TIP: DWORD = 0x00000004; +pub const NIF_STATE: DWORD = 0x00000008; +pub const NIF_INFO: DWORD = 0x00000010; +pub const NIF_GUID: DWORD = 0x00000020; +pub const NIF_REALTIME: DWORD = 0x00000040; +pub const NIF_SHOWTIP: DWORD = 0x00000080; +pub const NIS_HIDDEN: DWORD = 0x00000001; +pub const NIS_SHAREDICON: DWORD = 0x00000002; +pub const NIIF_NONE: DWORD = 0x00000000; +pub const NIIF_INFO: DWORD = 0x00000001; +pub const NIIF_WARNING: DWORD = 0x00000002; +pub const NIIF_ERROR: DWORD = 0x00000003; +pub const NIIF_USER: DWORD = 0x00000004; +pub const NIIF_ICON_MASK: DWORD = 0x0000000F; +pub const NIIF_NOSOUND: DWORD = 0x00000010; +pub const NIIF_LARGE_ICON: DWORD = 0x00000020; +pub const NIIF_RESPECT_QUIET_TIME: DWORD = 0x00000080; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct NOTIFYICONIDENTIFIER { + cbSize: DWORD, + hWnd: HWND, + uID: UINT, + guidItem: GUID, +}} +pub type PNOTIFYICONIDENTIFIER = *mut NOTIFYICONIDENTIFIER; +extern "system" { + pub fn Shell_NotifyIconA( + dwMessage: DWORD, + lpData: PNOTIFYICONDATAA, + ) -> BOOL; + pub fn Shell_NotifyIconW( + dwMessage: DWORD, + lpData: PNOTIFYICONDATAW, + ) -> BOOL; + pub fn Shell_NotifyIconGetRect( + identifier: *const NOTIFYICONIDENTIFIER, + iconLocation: *mut RECT, + ) -> HRESULT; +} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEINFOA { + hIcon: HICON, + iIcon: c_int, + dwAttributes: DWORD, + szDisplayName: [CHAR; MAX_PATH], + szTypeName: [CHAR; 80], +}} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEINFOW { + hIcon: HICON, + iIcon: c_int, + dwAttributes: DWORD, + szDisplayName: [WCHAR; MAX_PATH], + szTypeName: [WCHAR; 80], +}} +pub const SHGFI_ICON: DWORD = 0x000000100; +pub const SHGFI_DISPLAYNAME: DWORD = 0x000000200; +pub const SHGFI_TYPENAME: DWORD = 0x000000400; +pub const SHGFI_ATTRIBUTES: DWORD = 0x000000800; +pub const SHGFI_ICONLOCATION: DWORD = 0x000001000; +pub const SHGFI_EXETYPE: DWORD = 0x000002000; +pub const SHGFI_SYSICONINDEX: DWORD = 0x000004000; +pub const SHGFI_LINKOVERLAY: DWORD = 0x000008000; +pub const SHGFI_SELECTED: DWORD = 0x000010000; +pub const SHGFI_ATTR_SPECIFIED: DWORD = 0x000020000; +pub const SHGFI_LARGEICON: DWORD = 0x000000000; +pub const SHGFI_SMALLICON: DWORD = 0x000000001; +pub const SHGFI_OPENICON: DWORD = 0x000000002; +pub const SHGFI_SHELLICONSIZE: DWORD = 0x000000004; +pub const SHGFI_PIDL: DWORD = 0x000000008; +pub const SHGFI_USEFILEATTRIBUTES: DWORD = 0x000000010; +pub const SHGFI_ADDOVERLAYS: DWORD = 0x000000020; +pub const SHGFI_OVERLAYINDEX: DWORD = 0x000000040; +extern "system" { + pub fn SHGetFileInfoA( + pszPath: LPCSTR, + dwFileAttributes: DWORD, + psfi: *mut SHFILEINFOA, + cbFileInfo: UINT, + uFlags: UINT, + ) -> DWORD_PTR; + pub fn SHGetFileInfoW( + pszPath: LPCWSTR, + dwFileAttributes: DWORD, + psfi: *mut SHFILEINFOW, + cbFileInfo: UINT, + uFlags: UINT, + ) -> DWORD_PTR; +} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHSTOCKICONINFO { + cbSize: DWORD, + hIcon: HICON, + iSysImageIndex: c_int, + iIcon: c_int, + szPath: [WCHAR; MAX_PATH], +}} +pub const SHGSI_ICONLOCATION: DWORD = 0; +pub const SHGSI_ICON: DWORD = SHGFI_ICON; +pub const SHGSI_SYSICONINDEX: DWORD = SHGFI_SYSICONINDEX; +pub const SHGSI_LINKOVERLAY: DWORD = SHGFI_LINKOVERLAY; +pub const SHGSI_SELECTED: DWORD = SHGFI_SELECTED; +pub const SHGSI_LARGEICON: DWORD = SHGFI_LARGEICON; +pub const SHGSI_SMALLICON: DWORD = SHGFI_SMALLICON; +pub const SHGSI_SHELLICONSIZE: DWORD = SHGFI_SHELLICONSIZE; +ENUM!{enum SHSTOCKICONID { + SIID_DOCNOASSOC = 0, + SIID_DOCASSOC = 1, + SIID_APPLICATION = 2, + SIID_FOLDER = 3, + SIID_FOLDEROPEN = 4, + SIID_DRIVE525 = 5, + SIID_DRIVE35 = 6, + SIID_DRIVEREMOVE = 7, + SIID_DRIVEFIXED = 8, + SIID_DRIVENET = 9, + SIID_DRIVENETDISABLED = 10, + SIID_DRIVECD = 11, + SIID_DRIVERAM = 12, + SIID_WORLD = 13, + SIID_SERVER = 15, + SIID_PRINTER = 16, + SIID_MYNETWORK = 17, + SIID_FIND = 22, + SIID_HELP = 23, + SIID_SHARE = 28, + SIID_LINK = 29, + SIID_SLOWFILE = 30, + SIID_RECYCLER = 31, + SIID_RECYCLERFULL = 32, + SIID_MEDIACDAUDIO = 40, + SIID_LOCK = 47, + SIID_AUTOLIST = 49, + SIID_PRINTERNET = 50, + SIID_SERVERSHARE = 51, + SIID_PRINTERFAX = 52, + SIID_PRINTERFAXNET = 53, + SIID_PRINTERFILE = 54, + SIID_STACK = 55, + SIID_MEDIASVCD = 56, + SIID_STUFFEDFOLDER = 57, + SIID_DRIVEUNKNOWN = 58, + SIID_DRIVEDVD = 59, + SIID_MEDIADVD = 60, + SIID_MEDIADVDRAM = 61, + SIID_MEDIADVDRW = 62, + SIID_MEDIADVDR = 63, + SIID_MEDIADVDROM = 64, + SIID_MEDIACDAUDIOPLUS = 65, + SIID_MEDIACDRW = 66, + SIID_MEDIACDR = 67, + SIID_MEDIACDBURN = 68, + SIID_MEDIABLANKCD = 69, + SIID_MEDIACDROM = 70, + SIID_AUDIOFILES = 71, + SIID_IMAGEFILES = 72, + SIID_VIDEOFILES = 73, + SIID_MIXEDFILES = 74, + SIID_FOLDERBACK = 75, + SIID_FOLDERFRONT = 76, + SIID_SHIELD = 77, + SIID_WARNING = 78, + SIID_INFO = 79, + SIID_ERROR = 80, + SIID_KEY = 81, + SIID_SOFTWARE = 82, + SIID_RENAME = 83, + SIID_DELETE = 84, + SIID_MEDIAAUDIODVD = 85, + SIID_MEDIAMOVIEDVD = 86, + SIID_MEDIAENHANCEDCD = 87, + SIID_MEDIAENHANCEDDVD = 88, + SIID_MEDIAHDDVD = 89, + SIID_MEDIABLURAY = 90, + SIID_MEDIAVCD = 91, + SIID_MEDIADVDPLUSR = 92, + SIID_MEDIADVDPLUSRW = 93, + SIID_DESKTOPPC = 94, + SIID_MOBILEPC = 95, + SIID_USERS = 96, + SIID_MEDIASMARTMEDIA = 97, + SIID_MEDIACOMPACTFLASH = 98, + SIID_DEVICECELLPHONE = 99, + SIID_DEVICECAMERA = 100, + SIID_DEVICEVIDEOCAMERA = 101, + SIID_DEVICEAUDIOPLAYER = 102, + SIID_NETWORKCONNECT = 103, + SIID_INTERNET = 104, + SIID_ZIPFILE = 105, + SIID_SETTINGS = 106, + SIID_DRIVEHDDVD = 132, + SIID_DRIVEBD = 133, + SIID_MEDIAHDDVDROM = 134, + SIID_MEDIAHDDVDR = 135, + SIID_MEDIAHDDVDRAM = 136, + SIID_MEDIABDROM = 137, + SIID_MEDIABDR = 138, + SIID_MEDIABDRE = 139, + SIID_CLUSTEREDDRIVE = 140, + SIID_MAX_ICONS = 181, +}} +pub const SIID_INVALID: SHSTOCKICONID = -1i32 as u32; +extern "system" { + pub fn SHGetStockIconInfo( + siid: SHSTOCKICONID, + uFlags: UINT, + psii: *mut SHSTOCKICONINFO, + ) -> HRESULT; + pub fn SHGetDiskFreeSpaceExA( + pszDirectoryName: LPCSTR, + pulFreeBytesAvailableToCaller: *mut ULARGE_INTEGER, + pulTotalNumberOfBytes: *mut ULARGE_INTEGER, + pulTotalNumberOfFreeBytes: *mut ULARGE_INTEGER, + ) -> BOOL; + pub fn SHGetDiskFreeSpaceExW( + pszDirectoryName: LPCWSTR, + pulFreeBytesAvailableToCaller: *mut ULARGE_INTEGER, + pulTotalNumberOfBytes: *mut ULARGE_INTEGER, + pulTotalNumberOfFreeBytes: *mut ULARGE_INTEGER, + ) -> BOOL; + pub fn SHGetNewLinkInfoA( + pszLinkTo: LPCSTR, + pszDir: LPCSTR, + pszName: LPSTR, + pfMustCopy: *mut BOOL, + uFlags: UINT, + ) -> BOOL; + pub fn SHGetNewLinkInfoW( + pszLinkTo: LPCWSTR, + pszDir: LPCWSTR, + pszName: LPWSTR, + pfMustCopy: *mut BOOL, + uFlags: UINT, + ) -> BOOL; +} +pub const SHGNLI_PIDL: DWORD = 0x000000001; +pub const SHGNLI_PREFIXNAME: DWORD = 0x000000002; +pub const SHGNLI_NOUNIQUE: DWORD = 0x000000004; +pub const SHGNLI_NOLNK: DWORD = 0x000000008; +pub const SHGNLI_NOLOCNAME: DWORD = 0x000000010; +pub const SHGNLI_USEURLEXT: DWORD = 0x000000020; +pub const PRINTACTION_OPEN: DWORD = 0; +pub const PRINTACTION_PROPERTIES: DWORD = 1; +pub const PRINTACTION_NETINSTALL: DWORD = 2; +pub const PRINTACTION_NETINSTALLLINK: DWORD = 3; +pub const PRINTACTION_TESTPAGE: DWORD = 4; +pub const PRINTACTION_OPENNETPRN: DWORD = 5; +pub const PRINTACTION_DOCUMENTDEFAULTS: DWORD = 6; +pub const PRINTACTION_SERVERPROPERTIES: DWORD = 7; +extern "system" { + pub fn SHInvokePrinterCommandA( + hwnd: HWND, + uAction: UINT, + lpBuf1: LPCSTR, + lpBuf2: LPCSTR, + fModal: BOOL, + ) -> BOOL; + pub fn SHInvokePrinterCommandW( + hwnd: HWND, + uAction: UINT, + lpBuf1: LPCWSTR, + lpBuf2: LPCWSTR, + fModal: BOOL, + ) -> BOOL; +} +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPEN_PRINTER_PROPS_INFOA { + dwSize: DWORD, + pszSheetName: LPSTR, + uSheetIndex: UINT, + dwFlags: DWORD, + bModal: BOOL, +}} +pub type POPEN_PRINTER_PROPS_INFOA = *mut OPEN_PRINTER_PROPS_INFOA; +STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPEN_PRINTER_PROPS_INFOW { + dwSize: DWORD, + pszSheetName: LPWSTR, + uSheetIndex: UINT, + dwFlags: DWORD, + bModal: BOOL, +}} +pub type POPEN_PRINTER_PROPS_INFOW = *mut OPEN_PRINTER_PROPS_INFOW; +pub const PRINT_PROP_FORCE_NAME: DWORD = 0x01; +extern "system" { + pub fn SHLoadNonloadedIconOverlayIdentifiers() -> HRESULT; + pub fn SHIsFileAvailableOffline( + pwszPath: PCWSTR, + pdwStatus: *mut DWORD, + ) -> HRESULT; +} +pub const OFFLINE_STATUS_LOCAL: DWORD = 0x0001; +pub const OFFLINE_STATUS_REMOTE: DWORD = 0x0002; +pub const OFFLINE_STATUS_INCOMPLETE: DWORD = 0x0004; +extern "system" { + pub fn SHSetLocalizedName( + pszPath: PCWSTR, + pszResModule: PCWSTR, + idsRes: c_int, + ) -> HRESULT; + pub fn SHRemoveLocalizedName( + pszPath: PCWSTR, + ) -> HRESULT; + pub fn SHGetLocalizedName( + pszPath: PCWSTR, + pszResModule: PWSTR, + cch: UINT, + pidsRes: *mut c_int, + ) -> HRESULT; +} +extern "C" { + pub fn ShellMessageBoxA( + hAppInst: HINSTANCE, + hWnd: HWND, + lpcText: LPCSTR, + lpcTitle: LPCSTR, + fuStyle: UINT, + ... + ) -> c_int; + pub fn ShellMessageBoxW( + hAppInst: HINSTANCE, + hWnd: HWND, + lpcText: LPCWSTR, + lpcTitle: LPCWSTR, + fuStyle: UINT, + ... + ) -> c_int; +} +extern "system" { + pub fn IsLFNDriveA( + pszPath: LPCSTR, + ) -> BOOL; + pub fn IsLFNDriveW( + pszPath: LPCWSTR, + ) -> BOOL; + pub fn SHEnumerateUnreadMailAccountsA( + hKeyUser: HKEY, + dwIndex: DWORD, + pszMailAddress: LPSTR, + cchMailAddress: c_int, + ) -> HRESULT; + pub fn SHEnumerateUnreadMailAccountsW( + hKeyUser: HKEY, + dwIndex: DWORD, + pszMailAddress: LPWSTR, + cchMailAddress: c_int, + ) -> HRESULT; + pub fn SHGetUnreadMailCountA( + hKeyUser: HKEY, + pszMailAddress: LPCSTR, + pdwCount: *mut DWORD, + pFileTime: *mut FILETIME, + pszShellExecuteCommand: LPSTR, + cchShellExecuteCommand: c_int, + ) -> HRESULT; + pub fn SHGetUnreadMailCountW( + hKeyUser: HKEY, + pszMailAddress: LPCWSTR, + pdwCount: *mut DWORD, + pFileTime: *mut FILETIME, + pszShellExecuteCommand: LPWSTR, + cchShellExecuteCommand: c_int, + ) -> HRESULT; + pub fn SHSetUnreadMailCountA( + pszMailAddress: LPCSTR, + dwCount: DWORD, + pszShellExecuteCommand: LPCSTR, + ) -> HRESULT; + pub fn SHSetUnreadMailCountW( + pszMailAddress: LPCWSTR, + dwCount: DWORD, + pszShellExecuteCommand: LPCWSTR, + ) -> HRESULT; + pub fn SHTestTokenMembership( + hToken: HANDLE, + ulRID: ULONG, + ) -> BOOL; + pub fn SHGetImageList( + iImageList: c_int, + riid: REFIID, + ppvObj: *mut *mut c_void, + ) -> HRESULT; +} +pub const SHIL_LARGE: DWORD = 0; +pub const SHIL_SMALL: DWORD = 1; +pub const SHIL_EXTRALARGE: DWORD = 2; +pub const SHIL_SYSSMALL: DWORD = 3; +pub const SHIL_JUMBO: DWORD = 4; +pub const SHIL_LAST: DWORD = SHIL_JUMBO; +FN!{stdcall PFNCANSHAREFOLDERW( + pszPath: PCWSTR, +) -> HRESULT} +FN!{stdcall PFNSHOWSHAREFOLDERUIW( + hwndParent: HWND, + pszPath: PCWSTR, +) -> HRESULT} +pub const WC_NETADDRESS: &'static str = "msctls_netaddress"; +extern "system" { + pub fn InitNetworkAddressControl() -> BOOL; +} +// STRUCT!{struct NC_ADDRESS { +// pAddrInfo: *mut NET_ADDRESS_INFO, +// PortNumber: USHORT, +// PrefixLength: BYTE, +// }} +// pub type PNC_ADDRESS = *mut NC_ADDRESS; +extern "system" { + pub fn SHGetDriveMedia( + pszDrive: PCWSTR, + pdwMediaContent: *mut DWORD, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/shellscalingapi.rs b/src/vendor/winapi/src/um/shellscalingapi.rs new file mode 100644 index 0000000000..4ed0e86ce4 --- /dev/null +++ b/src/vendor/winapi/src/um/shellscalingapi.rs @@ -0,0 +1,45 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::UINT; +use shared::windef::HMONITOR; +use um::winnt::{HANDLE, HRESULT}; +ENUM!{enum PROCESS_DPI_AWARENESS { + PROCESS_DPI_UNAWARE = 0, + PROCESS_SYSTEM_DPI_AWARE = 1, + PROCESS_PER_MONITOR_DPI_AWARE = 2, +}} +ENUM!{enum MONITOR_DPI_TYPE { + MDT_EFFECTIVE_DPI = 0, + MDT_ANGULAR_DPI = 1, + MDT_RAW_DPI = 2, + MDT_DEFAULT = MDT_EFFECTIVE_DPI, +}} +extern "system" { + pub fn SetProcessDpiAwareness( + value: PROCESS_DPI_AWARENESS, + ) -> HRESULT; + pub fn GetProcessDpiAwareness( + hProcess: HANDLE, + value: *mut PROCESS_DPI_AWARENESS, + ) -> HRESULT; + pub fn GetDpiForMonitor( + hmonitor: HMONITOR, + dpiType: MONITOR_DPI_TYPE, + dpiX: *mut UINT, + dpiY: *mut UINT, + ) -> HRESULT; +} +ENUM!{enum SHELL_UI_COMPONENT { + SHELL_UI_COMPONENT_TASKBARS = 0, + SHELL_UI_COMPONENT_NOTIFICATIONAREA = 1, + SHELL_UI_COMPONENT_DESKBAND = 2, +}} +extern "system" { + pub fn GetDpiForShellUIComponent( + component: SHELL_UI_COMPONENT, + ) -> UINT; +} diff --git a/src/vendor/winapi/src/um/shlobj.rs b/src/vendor/winapi/src/um/shlobj.rs new file mode 100644 index 0000000000..fc553b2429 --- /dev/null +++ b/src/vendor/winapi/src/um/shlobj.rs @@ -0,0 +1,261 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_int, c_void}; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, DWORD, UINT}; +use shared::windef::HWND; +use um::minwinbase::SECURITY_ATTRIBUTES; +use um::shtypes::{PCIDLIST_ABSOLUTE, PCUITEMID_CHILD_ARRAY, PIDLIST_ABSOLUTE, REFKNOWNFOLDERID}; +use um::winnt::{HANDLE, HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCWSTR, PWSTR}; +pub const IDO_SHGIOI_SHARE: c_int = 0x0FFFFFFF; +pub const IDO_SHGIOI_LINK: c_int = 0x0FFFFFFE; +// Yes, these values are supposed to be 9 digits +pub const IDO_SHGIOI_SLOWFILE: c_int = 0x0FFFFFFFD; +pub const IDO_SHGIOI_DEFAULT: c_int = 0x0FFFFFFFC; +extern "system" { + pub fn SHGetIconOverlayIndexA( + pszIconPath: LPCSTR, + iIconIndex: c_int, + ) -> c_int; + pub fn SHGetIconOverlayIndexW( + pszIconPath: LPCWSTR, + iIconIndex: c_int, + ) -> c_int; +} +pub const GPFIDL_DEFAULT: GPFIDL_FLAGS = 0x0000; +pub const GPFIDL_ALTNAME: GPFIDL_FLAGS = 0x0001; +pub const GPFIDL_UNCPRINTER: GPFIDL_FLAGS = 0x0002; +pub type GPFIDL_FLAGS = c_int; +extern "system" { + pub fn SHGetPathFromIDListEx( + pidl: PCIDLIST_ABSOLUTE, + pszPath: PWSTR, + cchPath: DWORD, + uOpts: GPFIDL_FLAGS, + ) -> BOOL; + pub fn SHGetPathFromIDListA( + pidl: PCIDLIST_ABSOLUTE, + pszPath: LPSTR, + ) -> BOOL; + pub fn SHGetPathFromIDListW( + pidl: PCIDLIST_ABSOLUTE, + pszPath: LPWSTR, + ) -> BOOL; + pub fn SHCreateDirectory( + hwnd: HWND, + pszPath: PCWSTR, + ) -> c_int; + pub fn SHCreateDirectoryExA( + hwnd: HWND, + pszPath: LPCSTR, + psa: *const SECURITY_ATTRIBUTES, + ) -> c_int; + pub fn SHCreateDirectoryExW( + hwnd: HWND, + pszPath: LPCWSTR, + psa: *const SECURITY_ATTRIBUTES, + ) -> c_int; +} +pub const OFASI_EDIT: DWORD = 0x0001; +pub const OFASI_OPENDESKTOP: DWORD = 0x0002; +extern "system" { + pub fn SHOpenFolderAndSelectItems( + pidlFolder: PCIDLIST_ABSOLUTE, + cidl: UINT, + apidl: PCUITEMID_CHILD_ARRAY, + dwFlags: DWORD, + ) -> HRESULT; + //pub fn SHCreateShellItem( + // pidlParent: PCIDLIST_ABSOLUTE, + // psfParent: *mut IShellFolder, + // pidl: PCUITEMID_CHILD, + // ppsi: *mut *mut IShellItem, + //) -> HRESULT; +} +pub const CSIDL_DESKTOP: c_int = 0x0000; +pub const CSIDL_INTERNET: c_int = 0x0001; +pub const CSIDL_PROGRAMS: c_int = 0x0002; +pub const CSIDL_CONTROLS: c_int = 0x0003; +pub const CSIDL_PRINTERS: c_int = 0x0004; +pub const CSIDL_PERSONAL: c_int = 0x0005; +pub const CSIDL_FAVORITES: c_int = 0x0006; +pub const CSIDL_STARTUP: c_int = 0x0007; +pub const CSIDL_RECENT: c_int = 0x0008; +pub const CSIDL_SENDTO: c_int = 0x0009; +pub const CSIDL_BITBUCKET: c_int = 0x000a; +pub const CSIDL_STARTMENU: c_int = 0x000b; +pub const CSIDL_MYDOCUMENTS: c_int = CSIDL_PERSONAL; +pub const CSIDL_MYMUSIC: c_int = 0x000d; +pub const CSIDL_MYVIDEO: c_int = 0x000e; +pub const CSIDL_DESKTOPDIRECTORY: c_int = 0x0010; +pub const CSIDL_DRIVES: c_int = 0x0011; +pub const CSIDL_NETWORK: c_int = 0x0012; +pub const CSIDL_NETHOOD: c_int = 0x0013; +pub const CSIDL_FONTS: c_int = 0x0014; +pub const CSIDL_TEMPLATES: c_int = 0x0015; +pub const CSIDL_COMMON_STARTMENU: c_int = 0x0016; +pub const CSIDL_COMMON_PROGRAMS: c_int = 0x0017; +pub const CSIDL_COMMON_STARTUP: c_int = 0x0018; +pub const CSIDL_COMMON_DESKTOPDIRECTORY: c_int = 0x0019; +pub const CSIDL_APPDATA: c_int = 0x001a; +pub const CSIDL_PRINTHOOD: c_int = 0x001b; +pub const CSIDL_LOCAL_APPDATA: c_int = 0x001c; +pub const CSIDL_ALTSTARTUP: c_int = 0x001d; +pub const CSIDL_COMMON_ALTSTARTUP: c_int = 0x001e; +pub const CSIDL_COMMON_FAVORITES: c_int = 0x001f; +pub const CSIDL_INTERNET_CACHE: c_int = 0x0020; +pub const CSIDL_COOKIES: c_int = 0x0021; +pub const CSIDL_HISTORY: c_int = 0x0022; +pub const CSIDL_COMMON_APPDATA: c_int = 0x0023; +pub const CSIDL_WINDOWS: c_int = 0x0024; +pub const CSIDL_SYSTEM: c_int = 0x0025; +pub const CSIDL_PROGRAM_FILES: c_int = 0x0026; +pub const CSIDL_MYPICTURES: c_int = 0x0027; +pub const CSIDL_PROFILE: c_int = 0x0028; +pub const CSIDL_SYSTEMX86: c_int = 0x0029; +pub const CSIDL_PROGRAM_FILESX86: c_int = 0x002a; +pub const CSIDL_PROGRAM_FILES_COMMON: c_int = 0x002b; +pub const CSIDL_PROGRAM_FILES_COMMONX86: c_int = 0x002c; +pub const CSIDL_COMMON_TEMPLATES: c_int = 0x002d; +pub const CSIDL_COMMON_DOCUMENTS: c_int = 0x002e; +pub const CSIDL_COMMON_ADMINTOOLS: c_int = 0x002f; +pub const CSIDL_ADMINTOOLS: c_int = 0x0030; +pub const CSIDL_CONNECTIONS: c_int = 0x0031; +pub const CSIDL_COMMON_MUSIC: c_int = 0x0035; +pub const CSIDL_COMMON_PICTURES: c_int = 0x0036; +pub const CSIDL_COMMON_VIDEO: c_int = 0x0037; +pub const CSIDL_RESOURCES: c_int = 0x0038; +pub const CSIDL_RESOURCES_LOCALIZED: c_int = 0x0039; +pub const CSIDL_COMMON_OEM_LINKS: c_int = 0x003a; +pub const CSIDL_CDBURN_AREA: c_int = 0x003b; +pub const CSIDL_COMPUTERSNEARME: c_int = 0x003d; +pub const CSIDL_FLAG_CREATE: c_int = 0x8000; +pub const CSIDL_FLAG_DONT_VERIFY: c_int = 0x4000; +pub const CSIDL_FLAG_DONT_UNEXPAND: c_int = 0x2000; +pub const CSIDL_FLAG_NO_ALIAS: c_int = 0x1000; +pub const CSIDL_FLAG_PER_USER_INIT: c_int = 0x0800; +pub const CSIDL_FLAG_MASK: c_int = 0xff00; +extern "system" { + pub fn SHGetSpecialFolderLocation( + hwnd: HWND, + csidl: c_int, + ppidl: *mut PIDLIST_ABSOLUTE, + ) -> HRESULT; + pub fn SHCloneSpecialIDList( + hwnd: HWND, + csidl: c_int, + fCreate: BOOL, + ) -> PIDLIST_ABSOLUTE; + pub fn SHGetSpecialFolderPathA( + hwnd: HWND, + pszPath: LPSTR, + csidl: c_int, + fCreate: BOOL, + ) -> BOOL; + pub fn SHGetSpecialFolderPathW( + hwnd: HWND, + pszPath: LPWSTR, + csidl: c_int, + fCreate: BOOL, + ) -> BOOL; + pub fn SHFlushSFCache(); +} +ENUM!{enum SHGFP_TYPE { + SHGFP_TYPE_CURRENT = 0, + SHGFP_TYPE_DEFAULT = 1, +}} +extern "system" { + pub fn SHGetFolderPathA( + hwnd: HWND, + csidl: c_int, + hToken: HANDLE, + dwFlags: DWORD, + pszPath: LPSTR, + ) -> HRESULT; + pub fn SHGetFolderPathW( + hwnd: HWND, + csidl: c_int, + hToken: HANDLE, + dwFlags: DWORD, + pszPath: LPWSTR, + ) -> HRESULT; + pub fn SHGetFolderLocation( + hwnd: HWND, + csidl: c_int, + hToken: HANDLE, + dwFlags: DWORD, + ppidl: *mut PIDLIST_ABSOLUTE, + ) -> HRESULT; + pub fn SHSetFolderPathA( + csidl: c_int, + hToken: HANDLE, + dwFlags: DWORD, + pszPath: LPCSTR, + ) -> HRESULT; + pub fn SHSetFolderPathW( + csidl: c_int, + hToken: HANDLE, + dwFlags: DWORD, + pszPath: LPCWSTR, + ) -> HRESULT; + pub fn SHGetFolderPathAndSubDirA( + hwnd: HWND, + csidl: c_int, + hToken: HANDLE, + dwFlags: DWORD, + pszSubDir: LPCSTR, + pszPath: LPSTR, + ) -> HRESULT; + pub fn SHGetFolderPathAndSubDirW( + hwnd: HWND, + csidl: c_int, + hToken: HANDLE, + dwFlags: DWORD, + pszSubDir: LPCWSTR, + pszPath: LPWSTR, + ) -> HRESULT; +} +ENUM!{enum KNOWN_FOLDER_FLAG { + KF_FLAG_DEFAULT = 0x00000000, + KF_FLAG_NO_APPCONTAINER_REDIRECTION = 0x00010000, + KF_FLAG_CREATE = 0x00008000, + KF_FLAG_DONT_VERIFY = 0x00004000, + KF_FLAG_DONT_UNEXPAND = 0x00002000, + KF_FLAG_NO_ALIAS = 0x00001000, + KF_FLAG_INIT = 0x00000800, + KF_FLAG_DEFAULT_PATH = 0x00000400, + KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200, + KF_FLAG_SIMPLE_IDLIST = 0x00000100, + KF_FLAG_ALIAS_ONLY = 0x80000000, +}} +extern "system" { + pub fn SHGetKnownFolderIDList( + rfid: REFKNOWNFOLDERID, + dwFlags: DWORD, + hToken: HANDLE, + ppidl: *mut PIDLIST_ABSOLUTE, + ) -> HRESULT; + pub fn SHSetKnownFolderPath( + rfid: REFKNOWNFOLDERID, + dwFlags: DWORD, + hToken: HANDLE, + pszPath: PCWSTR, + ) -> HRESULT; + pub fn SHGetKnownFolderPath( + rfid: REFKNOWNFOLDERID, + dwFlags: DWORD, + hToken: HANDLE, + pszPath: *mut PWSTR, + ) -> HRESULT; + pub fn SHGetKnownFolderItem( + rfid: REFKNOWNFOLDERID, + flags: KNOWN_FOLDER_FLAG, + hToken: HANDLE, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/shobjidl.rs b/src/vendor/winapi/src/um/shobjidl.rs new file mode 100644 index 0000000000..fa9bf7eef7 --- /dev/null +++ b/src/vendor/winapi/src/um/shobjidl.rs @@ -0,0 +1,384 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. + +use ctypes::c_void; +use shared::guiddef::{REFGUID, REFIID}; +use shared::minwindef::{BOOL, DWORD, UINT}; +use shared::windef::HWND; +use um::objidl::IBindCtx; +use um::propkeydef::REFPROPERTYKEY; +use um::propsys::{GETPROPERTYSTOREFLAGS, IPropertyDescriptionList, IPropertyStore}; +use um::shobjidl_core::{IModalWindow, IModalWindowVtbl, IShellItem, IShellItemFilter, SFGAOF}; +use um::shtypes::COMDLG_FILTERSPEC; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCWSTR, LPWSTR, WCHAR}; + +pub type IFileOperationProgressSink = IUnknown; // TODO +ENUM!{enum SIATTRIBFLAGS { + SIATTRIBFLAGS_AND = 0x1, + SIATTRIBFLAGS_OR = 0x2, + SIATTRIBFLAGS_APPCOMPAT = 0x3, + SIATTRIBFLAGS_MASK = 0x3, + SIATTRIBFLAGS_ALLITEMS = 0x4000, +}} +RIDL!( +#[uuid(0xb63ea76d, 0x1f85, 0x456f, 0xa1, 0x9c, 0x48, 0x15, 0x9e, 0xfa, 0x85, 0x8b)] +interface IShellItemArray(IShellItemArrayVtbl): IUnknown(IUnknownVtbl) { + fn BindToHandler( + pbc: *mut IBindCtx, + bhid: REFGUID, + riid: REFIID, + ppvOut: *mut *mut c_void, + ) -> HRESULT, + fn GetPropertyStore( + flags: GETPROPERTYSTOREFLAGS, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn GetPropertyDescriptionList( + keyType: REFPROPERTYKEY, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn GetAttributes( + AttribFlags: SIATTRIBFLAGS, + sfgaoMask: SFGAOF, + psfgaoAttribs: *mut SFGAOF, + ) -> HRESULT, + fn GetCount( + pdwNumItems: *mut DWORD, + ) -> HRESULT, + fn GetItemAt( + dwIndex: DWORD, + ppsi: *mut *mut IShellItem, + ) -> HRESULT, + // TODO: Add IEnumShellItems + //fn EnumItems( + // ppenumShellItems: *mut *mut IEnumShellItems, + //) -> HRESULT, +}); +ENUM!{enum FDE_OVERWRITE_RESPONSE { + FDEOR_DEFAULT = 0, + FDEOR_ACCEPT = 1, + FDEOR_REFUSE = 2, +}} +ENUM!{enum FDE_SHAREVIOLATION_RESPONSE { + FDESVR_DEFAULT = 0, + FDESVR_ACCEPT = 1, + FDESVR_REFUSE = 2, +}} +ENUM!{enum FDAP { + FDAP_BOTTOM = 0, + FDAP_TOP = 1, +}} +RIDL!( +#[uuid(0x973510db, 0x7d7f, 0x452b, 0x89, 0x75, 0x74, 0xa8, 0x58, 0x28, 0xd3, 0x54)] +interface IFileDialogEvents(IFileDialogEventsVtbl): IUnknown(IUnknownVtbl) { + fn OnFileOk( + pfd: *mut IFileDialog, + ) -> HRESULT, + fn OnFolderChanging( + pfd: *mut IFileDialog, + psiFolder: *mut IShellItem, + ) -> HRESULT, + fn OnFolderChange( + pfd: *mut IFileDialog, + ) -> HRESULT, + fn OnSelectionChange( + pfd: *mut IFileDialog, + ) -> HRESULT, + fn OnShareViolation( + pfd: *mut IFileDialog, + psi: *mut IShellItem, + pResponse: *mut FDE_SHAREVIOLATION_RESPONSE, + ) -> HRESULT, + fn OnTypeChange( + pfd: *mut IFileDialog, + ) -> HRESULT, + fn OnOverwrite( + pfd: *mut IFileDialog, + psi: *mut IShellItem, + pResponse: *mut FDE_OVERWRITE_RESPONSE, + ) -> HRESULT, +}); +ENUM!{enum FILEOPENDIALOGOPTIONS { + FOS_OVERWRITEPROMPT = 0x2, + FOS_STRICTFILETYPES = 0x4, + FOS_NOCHANGEDIR = 0x8, + FOS_PICKFOLDERS = 0x20, + FOS_FORCEFILESYSTEM = 0x40, + FOS_ALLNONSTORAGEITEMS = 0x80, + FOS_NOVALIDATE = 0x100, + FOS_ALLOWMULTISELECT = 0x200, + FOS_PATHMUSTEXIST = 0x800, + FOS_FILEMUSTEXIST = 0x1000, + FOS_CREATEPROMPT = 0x2000, + FOS_SHAREAWARE = 0x4000, + FOS_NOREADONLYRETURN = 0x8000, + FOS_NOTESTFILECREATE = 0x10000, + FOS_HIDEMRUPLACES = 0x20000, + FOS_HIDEPINNEDPLACES = 0x40000, + FOS_NODEREFERENCELINKS = 0x100000, + FOS_DONTADDTORECENT = 0x2000000, + FOS_FORCESHOWHIDDEN = 0x10000000, + FOS_DEFAULTNOMINIMODE = 0x20000000, + FOS_FORCEPREVIEWPANEON = 0x40000000, + FOS_SUPPORTSTREAMABLEITEMS = 0x80000000, +}} +RIDL!( +#[uuid(0x42f85136, 0xdb7e, 0x439c, 0x85, 0xf1, 0xe4, 0x07, 0x5d, 0x13, 0x5f, 0xc8)] +interface IFileDialog(IFileDialogVtbl): IModalWindow(IModalWindowVtbl) { + fn SetFileTypes( + cFileTypes: UINT, + rgFilterSpec: *const COMDLG_FILTERSPEC, + ) -> HRESULT, + fn SetFileTypeIndex( + iFileType: UINT, + ) -> HRESULT, + fn GetFileTypeIndex( + piFileType: *mut UINT, + ) -> HRESULT, + fn Advise( + pfde: *mut IFileDialogEvents, + pdwCookie: *mut DWORD, + ) -> HRESULT, + fn Unadvise( + dwCookie: DWORD, + ) -> HRESULT, + fn SetOptions( + fos: FILEOPENDIALOGOPTIONS, + ) -> HRESULT, + fn GetOptions( + pfos: *mut FILEOPENDIALOGOPTIONS, + ) -> HRESULT, + fn SetDefaultFolder( + psi: *mut IShellItem, + ) -> HRESULT, + fn SetFolder( + psi: *mut IShellItem, + ) -> HRESULT, + fn GetFolder( + ppsi: *mut *mut IShellItem, + ) -> HRESULT, + fn GetCurrentSelection( + ppsi: *mut *mut IShellItem, + ) -> HRESULT, + fn SetFileName( + pszName: LPCWSTR, + ) -> HRESULT, + fn GetFileName( + pszName: *mut LPWSTR, + ) -> HRESULT, + fn SetTitle( + pszTitle: LPCWSTR, + ) -> HRESULT, + fn SetOkButtonLabel( + pszText: LPCWSTR, + ) -> HRESULT, + fn SetFileNameLabel( + pszLabel: LPCWSTR, + ) -> HRESULT, + fn GetResult( + ppsi: *mut *mut IShellItem, + ) -> HRESULT, + fn AddPlace( + psi: *mut IShellItem, + fdap: FDAP, + ) -> HRESULT, + fn SetDefaultExtension( + pszDefaultExtension: LPCWSTR, + ) -> HRESULT, + fn Close( + hr: HRESULT, + ) -> HRESULT, + fn SetClientGuid( + guid: REFGUID, + ) -> HRESULT, + fn ClearClientData() -> HRESULT, + fn SetFilter( + pFilter: *mut IShellItemFilter, + ) -> HRESULT, +}); +RIDL!( +#[uuid(0x84bccd23, 0x5fde, 0x4cdb, 0xae, 0xa4, 0xaf, 0x64, 0xb8, 0x3d, 0x78, 0xab)] +interface IFileSaveDialog(IFileSaveDialogVtbl): IFileDialog(IFileDialogVtbl) { + fn SetSaveAsItem( + psi: *mut IShellItem, + ) -> HRESULT, + fn SetProperties( + pStore: *mut IPropertyStore, + ) -> HRESULT, + fn SetCollectedProperties( + pList: *mut IPropertyDescriptionList, + fAppendDefault: BOOL, + ) -> HRESULT, + fn GetProperties( + ppStore: *mut *mut IPropertyStore, + ) -> HRESULT, + fn ApplyProperties( + psi: *mut IShellItem, + pStore: *mut IPropertyStore, + hwnd: HWND, + pSink: *mut IFileOperationProgressSink, + ) -> HRESULT, +}); +RIDL!( +#[uuid(0xd57c7288, 0xd4ad, 0x4768, 0xbe, 0x02, 0x9d, 0x96, 0x95, 0x32, 0xd9, 0x60)] +interface IFileOpenDialog(IFileOpenDialogVtbl): IFileDialog(IFileDialogVtbl) { + fn GetResults( + ppenum: *mut *mut IShellItemArray, + ) -> HRESULT, + fn GetSelectedItems( + ppsai: *mut *mut IShellItemArray, + ) -> HRESULT, +}); +ENUM!{enum CDCONTROLSTATEF { + CDCS_INACTIVE = 0, + CDCS_ENABLED = 0x1, + CDCS_VISIBLE = 0x2, + CDCS_ENABLEDVISIBLE = 0x3, +}} +RIDL!( +#[uuid(0xe6fdd21a, 0x163f, 0x4975, 0x9c, 0x8c, 0xa6, 0x9f, 0x1b, 0xa3, 0x70, 0x34)] +interface IFileDialogCustomize(IFileDialogCustomizeVtbl): IUnknown(IUnknownVtbl) { + fn EnableOpenDropDown( + dwIDCtl: DWORD, + ) -> HRESULT, + fn AddMenu( + dwIDCtl: DWORD, + pszLabel: LPCWSTR, + ) -> HRESULT, + fn AddPushButton( + dwIDCtl: DWORD, + pszLabel: LPCWSTR, + ) -> HRESULT, + fn AddComboBox( + dwIDCtl: DWORD, + ) -> HRESULT, + fn AddRadioButtonList( + dwIDCtl: DWORD, + ) -> HRESULT, + fn AddCheckButton( + dwIDCtl: DWORD, + pszLabel: LPCWSTR, + bChecked: BOOL, + ) -> HRESULT, + fn AddEditBox( + dwIDCtl: DWORD, + pszText: LPCWSTR, + ) -> HRESULT, + fn AddSeparator( + dwIDCtl: DWORD, + ) -> HRESULT, + fn AddText( + dwIDCtl: DWORD, + pszText: LPCWSTR, + ) -> HRESULT, + fn SetControlLabel( + dwIDCtl: DWORD, + pszLabel: LPCWSTR, + ) -> HRESULT, + fn GetControlState( + dwIDCtl: DWORD, + pdwState: *mut CDCONTROLSTATEF, + ) -> HRESULT, + fn SetControlState( + dwIDCtl: DWORD, + dwState: CDCONTROLSTATEF, + ) -> HRESULT, + fn GetEditBoxText( + dwIDCtl: DWORD, + ppszText: *mut *mut WCHAR, + ) -> HRESULT, + fn SetEditBoxText( + dwIDCtl: DWORD, + pszText: LPCWSTR, + ) -> HRESULT, + fn GetCheckButtonState( + dwIDCtl: DWORD, + pbChecked: *mut BOOL, + ) -> HRESULT, + fn SetCheckButtonState( + dwIDCtl: DWORD, + bChecked: BOOL, + ) -> HRESULT, + fn AddControlItem( + dwIDCtl: DWORD, + dwIDItem: DWORD, + pszLabel: LPCWSTR, + ) -> HRESULT, + fn RemoveControlItem( + dwIDCtl: DWORD, + dwIDItem: DWORD, + ) -> HRESULT, + fn RemoveAllControlItems( + dwIDCtl: DWORD, + ) -> HRESULT, + fn GetControlItemState( + dwIDCtl: DWORD, + dwIDItem: DWORD, + pdwState: *mut CDCONTROLSTATEF, + ) -> HRESULT, + fn SetControlItemState( + dwIDCtl: DWORD, + dwIDItem: DWORD, + dwState: CDCONTROLSTATEF, + ) -> HRESULT, + fn GetSelectedControlItem( + dwIDCtl: DWORD, + pdwIDItem: *mut DWORD, + ) -> HRESULT, + fn SetSelectedControlItem( + dwIDCtl: DWORD, + dwIDItem: DWORD, + ) -> HRESULT, + fn StartVisualGroup( + dwIDCtl: DWORD, + pszLabel: LPCWSTR, + ) -> HRESULT, + fn EndVisualGroup() -> HRESULT, + fn MakeProminent( + dwIDCtl: DWORD, + ) -> HRESULT, + fn SetControlItemText( + dwIDCtl: DWORD, + dwIDItem: DWORD, + pszLabel: LPCWSTR, + ) -> HRESULT, +}); +RIDL!( +#[uuid(0x36116642, 0xd713, 0x4b97, 0x9b, 0x83, 0x74, 0x84, 0xa9, 0xd0, 0x04, 0x33)] +interface IFileDialogControlEvents(IFileDialogControlEventsVtbl): IUnknown(IUnknownVtbl) { + fn OnItemSelected( + pfdc: *mut IFileDialogCustomize, + dwIDCtl: DWORD, + dwIDItem: DWORD, + ) -> HRESULT, + fn OnButtonClicked( + pfdc: *mut IFileDialogCustomize, + dwIDCtl: DWORD, + ) -> HRESULT, + fn OnCheckButtonToggled( + pfdc: *mut IFileDialogCustomize, + dwIDCtl: DWORD, + bChecked: BOOL, + ) -> HRESULT, + fn OnControlActivating( + pfdc: *mut IFileDialogCustomize, + dwIDCtl: DWORD, + ) -> HRESULT, +}); +RIDL!( +#[uuid(0x61744fc7, 0x85b5, 0x4791, 0xa9, 0xb0, 0x27, 0x22, 0x76, 0x30, 0x9b, 0x13)] +interface IFileDialog2(IFileDialog2Vtbl): IFileDialog(IFileDialogVtbl) { + fn SetCancelButtonLabel( + pszLabel: LPCWSTR, + ) -> HRESULT, + fn SetNavigationRoot( + psi: IShellItem, + ) -> HRESULT, +}); diff --git a/src/vendor/winapi/src/um/shobjidl_core.rs b/src/vendor/winapi/src/um/shobjidl_core.rs new file mode 100644 index 0000000000..1e6c07e986 --- /dev/null +++ b/src/vendor/winapi/src/um/shobjidl_core.rs @@ -0,0 +1,73 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. + +use ctypes::{c_int, c_void}; +use shared::guiddef::{REFGUID, REFIID}; +use shared::minwindef::ULONG; +use shared::windef::HWND; +use um::objidl::IBindCtx; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPWSTR}; + +//4498 +pub type SFGAOF = ULONG; +//9466 +ENUM!{enum SIGDN { + SIGDN_NORMALDISPLAY = 0, + SIGDN_PARENTRELATIVEPARSING = 0x80018001, + SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000, + SIGDN_PARENTRELATIVEEDITING = 0x80031001, + SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000, + SIGDN_FILESYSPATH = 0x80058000, + SIGDN_URL = 0x80068000, + SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8007c001, + SIGDN_PARENTRELATIVE = 0x80080001, + SIGDN_PARENTRELATIVEFORUI = 0x80094001, +}} +ENUM!{enum SICHINTF { + SICHINT_DISPLAY = 0, + SICHINT_ALLFIELDS = 0x80000000, + SICHINT_CANONICAL = 0x10000000, + SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000, +}} +RIDL!( +#[uuid(0x43826d1e, 0xe718, 0x42ee, 0xbc, 0x55, 0xa1, 0xe2, 0x61, 0xc3, 0x7b, 0xfe)] +interface IShellItem(IShellItemVtbl): IUnknown(IUnknownVtbl) { + fn BindToHandler( + pbc: *mut IBindCtx, + bhid: REFGUID, + riid: REFIID, + ppv: *mut *mut c_void, + ) -> HRESULT, + fn GetParent( + ppsi: *mut *mut IShellItem, + ) -> HRESULT, + fn GetDisplayName( + sigdnName: SIGDN, + ppszName: *mut LPWSTR, + ) -> HRESULT, + fn GetAttributes( + sfgaoMask: SFGAOF, + psfgaoAttribs: *mut SFGAOF, + ) -> HRESULT, + fn Compare( + psi: *mut IShellItem, + hint: SICHINTF, + piOrder: *mut c_int, + ) -> HRESULT, +}); +//20869 +RIDL!( +#[uuid(0xb4db1657, 0x70d7, 0x485e, 0x8e, 0x3e, 0x6f, 0xcb, 0x5a, 0x5c, 0x18, 0x02)] +interface IModalWindow(IModalWindowVtbl): IUnknown(IUnknownVtbl) { + fn Show( + hwndOwner: HWND, + ) -> HRESULT, +}); +//22307 +//27457 +pub type IShellItemFilter = IUnknown; // TODO diff --git a/src/vendor/winapi/src/um/shtypes.rs b/src/vendor/winapi/src/um/shtypes.rs new file mode 100644 index 0000000000..364698c0a9 --- /dev/null +++ b/src/vendor/winapi/src/um/shtypes.rs @@ -0,0 +1,47 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! this ALWAYS GENERATED file contains the definitions for the interfaces + +use shared::guiddef::GUID; +use shared::minwindef::{BYTE, USHORT}; +use um::winnt::LPCWSTR; + +STRUCT!{struct SHITEMID { + cb: USHORT, + abID: [BYTE; 0], +}} +pub type LPSHITEMID = *mut SHITEMID; +pub type LPCSHITEMID = *const SHITEMID; +STRUCT!{struct ITEMIDLIST { + mkid: SHITEMID, +}} +pub type ITEMIDLIST_RELATIVE = ITEMIDLIST; +pub type ITEMID_CHILD = ITEMIDLIST; +pub type ITEMIDLIST_ABSOLUTE = ITEMIDLIST; +pub type LPITEMIDLIST = *mut ITEMIDLIST; +pub type LPCITEMIDLIST = *const ITEMIDLIST; +pub type PIDLIST_ABSOLUTE = *mut ITEMIDLIST_ABSOLUTE; +pub type PCIDLIST_ABSOLUTE = *const ITEMIDLIST_ABSOLUTE; +pub type PCUIDLIST_ABSOLUTE = *const ITEMIDLIST_ABSOLUTE; +pub type PIDLIST_RELATIVE = *mut ITEMIDLIST_RELATIVE; +pub type PCIDLIST_RELATIVE = *const ITEMIDLIST_RELATIVE; +pub type PUIDLIST_RELATIVE = *mut ITEMIDLIST_RELATIVE; +pub type PCUIDLIST_RELATIVE = *const ITEMIDLIST_RELATIVE; +pub type PITEMID_CHILD = *mut ITEMID_CHILD; +pub type PCITEMID_CHILD = *const ITEMID_CHILD; +pub type PUITEMID_CHILD = *mut ITEMID_CHILD; +pub type PCUITEMID_CHILD = *const ITEMID_CHILD; +pub type PCUITEMID_CHILD_ARRAY = *const PCUITEMID_CHILD; +pub type PCUIDLIST_RELATIVE_ARRAY = *const PCUIDLIST_RELATIVE; +pub type PCIDLIST_ABSOLUTE_ARRAY = *const PCIDLIST_ABSOLUTE; +pub type PCUIDLIST_ABSOLUTE_ARRAY = *const PCUIDLIST_ABSOLUTE; +STRUCT!{struct COMDLG_FILTERSPEC { + pszName: LPCWSTR, + pszSpec: LPCWSTR, +}} +pub type KNOWNFOLDERID = GUID; +pub type REFKNOWNFOLDERID = *const KNOWNFOLDERID; diff --git a/src/vendor/winapi/src/um/spapidef.rs b/src/vendor/winapi/src/um/spapidef.rs new file mode 100644 index 0000000000..2ba8d2efbc --- /dev/null +++ b/src/vendor/winapi/src/um/spapidef.rs @@ -0,0 +1,54 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Public header file for Windows NT Setup and Device Installer services Dlls +use shared::minwindef::DWORD; +use um::winnt::DWORDLONG; +pub type SP_LOG_TOKEN = DWORDLONG; +pub type PSP_LOG_TOKEN = *mut DWORDLONG; +pub const LOGTOKEN_TYPE_MASK: SP_LOG_TOKEN = 3; +pub const LOGTOKEN_UNSPECIFIED: SP_LOG_TOKEN = 0; +pub const LOGTOKEN_NO_LOG: SP_LOG_TOKEN = 1; +pub const LOGTOKEN_SETUPAPI_APPLOG: SP_LOG_TOKEN = 2; +pub const LOGTOKEN_SETUPAPI_DEVLOG: SP_LOG_TOKEN = 3; +pub const TXTLOG_SETUPAPI_DEVLOG: DWORD = 0x00000001; +pub const TXTLOG_SETUPAPI_CMDLINE: DWORD = 0x00000002; +pub const TXTLOG_SETUPAPI_BITS: DWORD = 0x00000003; +pub const TXTLOG_ERROR: DWORD = 0x1; +pub const TXTLOG_WARNING: DWORD = 0x2; +pub const TXTLOG_SYSTEM_STATE_CHANGE: DWORD = 0x3; +pub const TXTLOG_SUMMARY: DWORD = 0x4; +pub const TXTLOG_DETAILS: DWORD = 0x5; +pub const TXTLOG_VERBOSE: DWORD = 0x6; +pub const TXTLOG_VERY_VERBOSE: DWORD = 0x7; +pub const TXTLOG_RESERVED_FLAGS: DWORD = 0x0000FFF0; +pub const TXTLOG_TIMESTAMP: DWORD = 0x00010000; +pub const TXTLOG_DEPTH_INCR: DWORD = 0x00020000; +pub const TXTLOG_DEPTH_DECR: DWORD = 0x00040000; +pub const TXTLOG_TAB_1: DWORD = 0x00080000; +pub const TXTLOG_FLUSH_FILE: DWORD = 0x00100000; +#[inline] +pub fn TXTLOG_LEVEL(flags: DWORD) -> DWORD { + flags & 0xf +} +pub const TXTLOG_DEVINST: DWORD = 0x00000001; +pub const TXTLOG_INF: DWORD = 0x00000002; +pub const TXTLOG_FILEQ: DWORD = 0x00000004; +pub const TXTLOG_COPYFILES: DWORD = 0x00000008; +pub const TXTLOG_SIGVERIF: DWORD = 0x00000020; +pub const TXTLOG_BACKUP: DWORD = 0x00000080; +pub const TXTLOG_UI: DWORD = 0x00000100; +pub const TXTLOG_UTIL: DWORD = 0x00000200; +pub const TXTLOG_INFDB: DWORD = 0x00000400; +pub const TXTLOG_POLICY: DWORD = 0x00800000; +pub const TXTLOG_NEWDEV: DWORD = 0x01000000; +pub const TXTLOG_UMPNPMGR: DWORD = 0x02000000; +pub const TXTLOG_DRIVER_STORE: DWORD = 0x04000000; +pub const TXTLOG_SETUP: DWORD = 0x08000000; +pub const TXTLOG_CMI: DWORD = 0x10000000; +pub const TXTLOG_DEVMGR: DWORD = 0x20000000; +pub const TXTLOG_INSTALLER: DWORD = 0x40000000; +pub const TXTLOG_VENDOR: DWORD = 0x80000000; diff --git a/src/vendor/winapi/src/um/sporder.rs b/src/vendor/winapi/src/um/sporder.rs new file mode 100644 index 0000000000..9f5c1dd1aa --- /dev/null +++ b/src/vendor/winapi/src/um/sporder.rs @@ -0,0 +1,42 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! Service Provider Order +use ctypes::c_int; +use shared::guiddef::LPGUID; +use shared::minwindef::{DWORD, LPDWORD}; +extern "system" { + pub fn WSCWriteProviderOrder( + lpwdCatalogEntryId: LPDWORD, + dwNumberOfEntries: DWORD, + ) -> c_int; +} +FN!{stdcall LPWSCWRITEPROVIDERORDER( + lpwdCatalogEntryId: LPDWORD, + dwNumberOfEntries: DWORD, +) -> c_int} +#[cfg(target_arch = "x86_64")] +extern "system" { + pub fn WSCWriteProviderOrder32( + lpwdCatalogEntryId: LPDWORD, + dwNumberOfEntries: DWORD, + ) -> c_int; + pub fn WSCWriteNameSpaceOrder( + lpProviderId: LPGUID, + dwNumberOfEntries: DWORD, + ) -> c_int; +} +FN!{stdcall LPWSCWRITENAMESPACEORDER( + lpProviderId: LPGUID, + dwNumberOfEntries: DWORD, +) -> c_int} +#[cfg(target_arch = "x86_64")] +extern "system" { + pub fn WSCWriteNameSpaceOrder32( + lpProviderId: LPGUID, + dwNumberOfEntries: DWORD, + ) -> c_int; +} diff --git a/src/vendor/winapi/src/um/sql.rs b/src/vendor/winapi/src/um/sql.rs new file mode 100644 index 0000000000..dd500f2775 --- /dev/null +++ b/src/vendor/winapi/src/um/sql.rs @@ -0,0 +1,109 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use um::sqltypes::{ + SQLHANDLE, SQLHDBC, SQLHENV, SQLHSTMT, SQLINTEGER, SQLLEN, SQLPOINTER, SQLRETURN, SQLSMALLINT, + SQLUSMALLINT, +}; +pub const SQL_NULL_DATA: SQLLEN = -1; +pub const SQL_DATA_AT_EXEC: SQLLEN = -2; +pub const SQL_SUCCESS: SQLRETURN = 0; +pub const SQL_SUCCESS_WITH_INFO: SQLRETURN = 1; +pub const SQL_NO_DATA: SQLRETURN = 100; +pub const SQL_PARAM_DATA_AVAILABLE: SQLRETURN = 101; +pub const SQL_ERROR: SQLRETURN = -1; +pub const SQL_INVALID_HANDLE: SQLRETURN = -2; +pub const SQL_STILL_EXECUTING: SQLRETURN = 2; +pub const SQL_NEED_DATA: SQLRETURN = 99; +pub const SQL_NTS: SQLSMALLINT = -3; +pub const SQL_MAX_MESSAGE_LENGTH: usize = 512; +pub const SQL_DATE_LEN: usize = 10; +pub const SQL_TIME_LEN: usize = 8; +pub const SQL_TIMESTAMP_LEN: usize = 19; +pub const SQL_HANDLE_ENV: SQLSMALLINT = 1; +pub const SQL_HANDLE_DBC: SQLSMALLINT = 2; +pub const SQL_HANDLE_STMT: SQLSMALLINT = 3; +pub const SQL_HANDLE_DESC: SQLSMALLINT = 4; +pub const SQL_ATTR_OUTPUT_NTS: SQLINTEGER = 10001; +pub const SQL_ATTR_AUTO_IPD: SQLINTEGER = 10001; +pub const SQL_ATTR_METADATA_ID: SQLINTEGER = 10014; +pub const SQL_ATTR_APP_ROW_DESC: SQLINTEGER = 10010; +pub const SQL_ATTR_APP_PARAM_DESC: SQLINTEGER = 10011; +pub const SQL_ATTR_IMP_ROW_DESC: SQLINTEGER = 10012; +pub const SQL_ATTR_IMP_PARAM_DESC: SQLINTEGER = 10013; +pub const SQL_ATTR_CURSOR_SCROLLABLE: SQLINTEGER = -1; +pub const SQL_ATTR_CURSOR_SENSITIVITY: SQLINTEGER = -2; +pub const SQL_UNKNOWN_TYPE: SQLSMALLINT = 0; +pub const SQL_CHAR: SQLSMALLINT = 1; +pub const SQL_NUMERIC: SQLSMALLINT = 2; +pub const SQL_DECIMAL: SQLSMALLINT = 3; +pub const SQL_INTEGER: SQLSMALLINT = 4; +pub const SQL_SMALLINT: SQLSMALLINT = 5; +pub const SQL_FLOAT: SQLSMALLINT = 6; +pub const SQL_REAL: SQLSMALLINT = 7; +pub const SQL_DOUBLE: SQLSMALLINT = 8; +pub const SQL_DATETIME: SQLSMALLINT = 9; +pub const SQL_VARCHAR: SQLSMALLINT = 12; +pub const SQL_TYPE_DATE: SQLSMALLINT = 91; +pub const SQL_TYPE_TIME: SQLSMALLINT = 92; +pub const SQL_TYPE_TIMESTAMP: SQLSMALLINT = 93; +pub const SQL_NO_NULLS: SQLSMALLINT = 0; +pub const SQL_NULLABLE: SQLSMALLINT = 1; +pub const SQL_NULLABLE_UNKNOWN: SQLSMALLINT = 2; +pub const SQL_CLOSE: SQLUSMALLINT = 0; +pub const SQL_DROP: SQLUSMALLINT = 1; +pub const SQL_UNBIND: SQLUSMALLINT = 2; +pub const SQL_RESET_PARAMS: SQLUSMALLINT = 3; +pub const SQL_NULL_HANDLE: SQLHANDLE = 0 as SQLHANDLE; +extern "system" { + pub fn SQLAllocHandle( + handleType: SQLSMALLINT, + inputHandle: SQLHANDLE, + outputHandle: *mut SQLHANDLE, + ) -> SQLRETURN; + pub fn SQLDisconnect( + connectionHandle: SQLHDBC, + ) -> SQLRETURN; + pub fn SQLFetch( + statementHandle: SQLHSTMT, + ) -> SQLRETURN; + pub fn SQLFreeHandle( + handleType: SQLSMALLINT, + handle: SQLHANDLE, + ) -> SQLRETURN; + pub fn SQLFreeStmt( + statementHandle: SQLHSTMT, + option: SQLUSMALLINT, + ) -> SQLRETURN; + pub fn SQLGetData( + statementHandle: SQLHSTMT, + columnNumber: SQLUSMALLINT, + targetType: SQLSMALLINT, + targetValue: SQLPOINTER, + bufferLength: SQLLEN, + strLen_or_IndPtr: *mut SQLLEN, + ) -> SQLRETURN; + pub fn SQLNumResultCols( + statementHandle: SQLHSTMT, + columnCount: *mut SQLSMALLINT, + ) -> SQLRETURN; + pub fn SQLRowCount( + statementHandle: SQLHSTMT, + rowCount: *mut SQLLEN, + ) -> SQLRETURN; + pub fn SQLSetConnectAttr( + connectionHandle: SQLHDBC, + attribute: SQLINTEGER, + value: SQLPOINTER, + stringLength: SQLINTEGER, + ) -> SQLRETURN; + pub fn SQLSetEnvAttr( + environmentHandle: SQLHENV, + attribute: SQLINTEGER, + value: SQLPOINTER, + stringLength: SQLINTEGER, + ) -> SQLRETURN; +} diff --git a/src/vendor/winapi/src/um/sqlext.rs b/src/vendor/winapi/src/um/sqlext.rs new file mode 100644 index 0000000000..6cf0da9c67 --- /dev/null +++ b/src/vendor/winapi/src/um/sqlext.rs @@ -0,0 +1,96 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the SQL extension APIs +use um::sql::{ + SQL_CHAR, SQL_DOUBLE, SQL_INTEGER, SQL_NUMERIC, SQL_REAL, SQL_SMALLINT, SQL_TYPE_DATE, + SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP +}; +use um::sqltypes::{SQLINTEGER, SQLSMALLINT, SQLUSMALLINT}; +pub const SQL_ATTR_ODBC_VERSION: SQLINTEGER = 200; +pub const SQL_ATTR_CONNECTION_POOLING: SQLINTEGER = 201; +pub const SQL_ATTR_CP_MATCH: SQLINTEGER = 202; +pub const SQL_OV_ODBC2: SQLINTEGER = 2; +pub const SQL_OV_ODBC3: SQLINTEGER = 3; +pub const SQL_OV_ODBC3_80: SQLINTEGER = 380; +pub const SQL_ACCESS_MODE: SQLINTEGER = 101; +pub const SQL_AUTOCOMMIT: SQLINTEGER = 102; +pub const SQL_LOGIN_TIMEOUT: SQLINTEGER = 103; +pub const SQL_OPT_TRACE: SQLINTEGER = 104; +pub const SQL_OPT_TRACEFILE: SQLINTEGER = 105; +pub const SQL_TRANSLATE_DLL: SQLINTEGER = 106; +pub const SQL_TRANSLATE_OPTION: SQLINTEGER = 107; +pub const SQL_TXN_ISOLATION: SQLINTEGER = 108; +pub const SQL_CURRENT_QUALIFIER: SQLINTEGER = 109; +pub const SQL_ODBC_CURSORS: SQLINTEGER = 110; +pub const SQL_QUIET_MODE: SQLINTEGER = 111; +pub const SQL_PACKET_SIZE: SQLINTEGER = 112; +pub const SQL_ATTR_ACCESS_MODE: SQLINTEGER = SQL_ACCESS_MODE; +pub const SQL_ATTR_AUTOCOMMIT: SQLINTEGER = SQL_AUTOCOMMIT; +pub const SQL_ATTR_CONNECTION_TIMEOUT: SQLINTEGER = 113; +pub const SQL_ATTR_CURRENT_CATALOG: SQLINTEGER = SQL_CURRENT_QUALIFIER; +pub const SQL_ATTR_DISCONNECT_BEHAVIOR: SQLINTEGER = 114; +pub const SQL_ATTR_ENLIST_IN_DTC: SQLINTEGER = 1207; +pub const SQL_ATTR_ENLIST_IN_XA: SQLINTEGER = 1208; +pub const SQL_ATTR_LOGIN_TIMEOUT: SQLINTEGER = SQL_LOGIN_TIMEOUT; +pub const SQL_ATTR_ODBC_CURSORS: SQLINTEGER = SQL_ODBC_CURSORS; +pub const SQL_ATTR_PACKET_SIZE: SQLINTEGER = SQL_PACKET_SIZE; +pub const SQL_ATTR_QUIET_MODE: SQLINTEGER = SQL_QUIET_MODE; +pub const SQL_ATTR_TRACE: SQLINTEGER = SQL_OPT_TRACE; +pub const SQL_ATTR_TRACEFILE: SQLINTEGER = SQL_OPT_TRACEFILE; +pub const SQL_ATTR_TRANSLATE_LIB: SQLINTEGER = SQL_TRANSLATE_DLL; +pub const SQL_ATTR_TRANSLATE_OPTION: SQLINTEGER = SQL_TRANSLATE_OPTION; +pub const SQL_ATTR_TXN_ISOLATION: SQLINTEGER = SQL_TXN_ISOLATION; +pub const SQL_ATTR_CONNECTION_DEAD: SQLINTEGER = 1209; +pub const SQL_IS_POINTER: SQLINTEGER = -4; +pub const SQL_IS_UINTEGER: SQLINTEGER = -5; +pub const SQL_IS_INTEGER: SQLINTEGER = -6; +pub const SQL_IS_USMALLINT: SQLINTEGER = -7; +pub const SQL_IS_SMALLINT: SQLINTEGER = -8; +pub const SQL_DATE: SQLSMALLINT = 9; +pub const SQL_INTERVAL: SQLSMALLINT = 10; +pub const SQL_TIME: SQLSMALLINT = 10; +pub const SQL_TIMESTAMP: SQLSMALLINT = 11; +pub const SQL_LONGVARCHAR: SQLSMALLINT = -1; +pub const SQL_BINARY: SQLSMALLINT = -2; +pub const SQL_VARBINARY: SQLSMALLINT = -3; +pub const SQL_LONGVARBINARY: SQLSMALLINT = -4; +pub const SQL_BIGINT: SQLSMALLINT = -5; +pub const SQL_TINYINT: SQLSMALLINT = -6; +pub const SQL_BIT: SQLSMALLINT = -7; +pub const SQL_GUID: SQLSMALLINT = -11; +pub const SQL_C_CHAR: SQLSMALLINT = SQL_CHAR; +pub const SQL_C_LONG: SQLSMALLINT = SQL_INTEGER; +pub const SQL_C_SHORT: SQLSMALLINT = SQL_SMALLINT; +pub const SQL_C_FLOAT: SQLSMALLINT = SQL_REAL; +pub const SQL_C_DOUBLE: SQLSMALLINT = SQL_DOUBLE; +pub const SQL_C_NUMERIC: SQLSMALLINT = SQL_NUMERIC; +pub const SQL_C_DEFAULT: SQLSMALLINT = 99; +pub const SQL_SIGNED_OFFSET: SQLSMALLINT = -20; +pub const SQL_UNSIGNED_OFFSET: SQLSMALLINT = -22; +pub const SQL_C_DATE: SQLSMALLINT = SQL_DATE; +pub const SQL_C_TIME: SQLSMALLINT = SQL_TIME; +pub const SQL_C_TIMESTAMP: SQLSMALLINT = SQL_TIMESTAMP; +pub const SQL_C_TYPE_DATE: SQLSMALLINT = SQL_TYPE_DATE; +pub const SQL_C_TYPE_TIME: SQLSMALLINT = SQL_TYPE_TIME; +pub const SQL_C_TYPE_TIMESTAMP: SQLSMALLINT = SQL_TYPE_TIMESTAMP; +pub const SQL_C_BINARY: SQLSMALLINT = SQL_BINARY; +pub const SQL_C_BIT: SQLSMALLINT = SQL_BIT; +pub const SQL_C_SBIGINT: SQLSMALLINT = SQL_BIGINT + SQL_SIGNED_OFFSET; +pub const SQL_C_UBIGINT: SQLSMALLINT = SQL_BIGINT + SQL_UNSIGNED_OFFSET; +pub const SQL_C_TINYINT: SQLSMALLINT = SQL_TINYINT; +pub const SQL_C_SLONG: SQLSMALLINT = SQL_C_LONG + SQL_SIGNED_OFFSET; +pub const SQL_C_SSHORT: SQLSMALLINT = SQL_C_SHORT + SQL_SIGNED_OFFSET; +pub const SQL_C_STINYINT: SQLSMALLINT = SQL_TINYINT + SQL_SIGNED_OFFSET; +pub const SQL_C_ULONG: SQLSMALLINT = SQL_C_LONG + SQL_UNSIGNED_OFFSET; +pub const SQL_C_USHORT: SQLSMALLINT = SQL_C_SHORT + SQL_UNSIGNED_OFFSET; +pub const SQL_C_UTINYINT: SQLSMALLINT = SQL_TINYINT + SQL_UNSIGNED_OFFSET; +pub const SQL_C_GUID: SQLSMALLINT = SQL_GUID; +pub const SQL_TYPE_NULL: SQLSMALLINT = 0; +pub const SQL_DRIVER_NOPROMPT: SQLUSMALLINT = 0; +pub const SQL_DRIVER_COMPLETE: SQLUSMALLINT = 1; +pub const SQL_DRIVER_PROMPT: SQLUSMALLINT = 2; +pub const SQL_DRIVER_COMPLETE_REQUIRED: SQLUSMALLINT = 3; \ No newline at end of file diff --git a/src/vendor/winapi/src/um/sqltypes.rs b/src/vendor/winapi/src/um/sqltypes.rs new file mode 100644 index 0000000000..1a620c66bf --- /dev/null +++ b/src/vendor/winapi/src/um/sqltypes.rs @@ -0,0 +1,143 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the types used in ODBC +use ctypes::*; +#[cfg(target_arch = "x86_64")] +use shared::basetsd::{INT64, UINT64}; +use shared::guiddef::GUID; +use shared::windef::HWND; +pub type SQLCHAR = c_uchar; +pub type SQLSCHAR = c_schar; +pub type SQLDATE = c_uchar; +pub type SQLDECIMAL = c_uchar; +pub type SQLDOUBLE = c_double; +pub type SQLFLOAT = c_double; +pub type SQLINTEGER = c_long; +pub type SQLUINTEGER = c_ulong; +#[cfg(target_arch = "x86_64")] +pub type SQLLEN = INT64; +#[cfg(target_arch = "x86_64")] +pub type SQLULEN = UINT64; +#[cfg(target_arch = "x86_64")] +pub type SQLSETPOSIROW = UINT64; +#[cfg(target_arch = "x86")] +pub type SQLLEN = SQLINTEGER; +#[cfg(target_arch = "x86")] +pub type SQLULEN = SQLUINTEGER; +#[cfg(target_arch = "x86")] +pub type SQLSETPOSIROW = SQLUSMALLINT; +pub type SQLROWCOUNT = SQLULEN; +pub type SQLROWSETSIZE = SQLULEN; +pub type SQLTRANSID = SQLULEN; +pub type SQLROWOFFSET = SQLLEN; +pub type SQLNUMERIC = c_uchar; +pub type SQLPOINTER = *mut c_void; +pub type SQLREAL = c_float; +pub type SQLSMALLINT = c_short; +pub type SQLUSMALLINT = c_ushort; +pub type SQLTIME = c_uchar; +pub type SQLTIMESTAMP = c_uchar; +pub type SQLVARCHAR = c_uchar; +pub type SQLRETURN = SQLSMALLINT; +pub type SQLHANDLE = *mut c_void; +pub type SQLHENV = SQLHANDLE; +pub type SQLHDBC = SQLHANDLE; +pub type SQLHSTMT = SQLHANDLE; +pub type SQLHDESC = SQLHANDLE; +//pub type UCHAR = c_uchar; +pub type SCHAR = c_schar; +//pub type SQLSCHAR = SCHAR; +pub type SDWORD = c_long; +pub type SWORD = c_short; +pub type UDWORD = c_ulong; +//pub type UWORD = c_ushort; +//#[cfg(target_arch = "x86")] +//pub type SQLUINTEGER = UDWORD; +pub type SLONG = c_long; +pub type SSHORT = c_short; +//pub type ULONG = c_ulong; +//pub type USHORT = c_ushort; +pub type SDOUBLE = c_double; +pub type LDOUBLE = c_double; +pub type SFLOAT = c_float; +pub type PTR = *mut c_void; +pub type HENV = *mut c_void; +pub type HDBC = *mut c_void; +pub type HSTMT = *mut c_void; +pub type RETCODE = c_short; +pub type SQLHWND = HWND; +STRUCT!{struct DATE_STRUCT { + year: SQLSMALLINT, + month: SQLUSMALLINT, + day: SQLUSMALLINT, +}} +pub type SQL_DATE_STRUCT = DATE_STRUCT; +STRUCT!{struct TIME_STRUCT { + hour: SQLUSMALLINT, + minute: SQLUSMALLINT, + second: SQLUSMALLINT, +}} +pub type SQL_TIME_STRUCT = TIME_STRUCT; +STRUCT!{struct TIMESTAMP_STRUCT { + year: SQLSMALLINT, + month: SQLUSMALLINT, + day: SQLUSMALLINT, + hour: SQLUSMALLINT, + minute: SQLUSMALLINT, + second: SQLUSMALLINT, + fraction: SQLUINTEGER, +}} +pub type SQL_TIMESTAMP_STRUCT = TIMESTAMP_STRUCT; +ENUM!{enum SQLINTERVAL { + SQL_IS_YEAR = 1, + SQL_IS_MONTH = 2, + SQL_IS_DAY = 3, + SQL_IS_HOUR = 4, + SQL_IS_MINUTE = 5, + SQL_IS_SECOND = 6, + SQL_IS_YEAR_TO_MONTH = 7, + SQL_IS_DAY_TO_HOUR = 8, + SQL_IS_DAY_TO_MINUTE = 9, + SQL_IS_DAY_TO_SECOND = 10, + SQL_IS_HOUR_TO_MINUTE = 11, + SQL_IS_HOUR_TO_SECOND = 12, + SQL_IS_MINUTE_TO_SECOND = 13, +}} +STRUCT!{struct SQL_YEAR_MONTH_STRUCT { + year: SQLUINTEGER, + month: SQLUINTEGER, +}} +STRUCT!{struct SQL_DAY_SECOND_STRUCT { + day: SQLUINTEGER, + hour: SQLUINTEGER, + minute: SQLUINTEGER, + second: SQLUINTEGER, + fraction: SQLUINTEGER, +}} +UNION!{union SQL_INTERVAL_STRUCT_intval { + [u32; 5], + year_month year_month_mut: SQL_YEAR_MONTH_STRUCT, + day_second day_second_mut: SQL_DAY_SECOND_STRUCT, +}} +STRUCT!{struct SQL_INTERVAL_STRUCT { + interval_type: SQLINTERVAL, + interval_sign: SQLSMALLINT, + intval: SQL_INTERVAL_STRUCT_intval, +}} +pub type ODBCINT64 = __int64; +pub type SQLBIGINT = ODBCINT64; +pub type SQLUBIGINT = __uint64; +pub const SQL_MAX_NUMERIC_LEN: usize = 16; +STRUCT!{struct SQL_NUMERIC_STRUCT { + precision: SQLCHAR, + scale: SQLSCHAR, + sign: SQLCHAR, + val: [SQLCHAR; SQL_MAX_NUMERIC_LEN], +}} +pub type SQLGUID = GUID; +pub type BOOKMARK = SQLULEN; +pub type SQLWCHAR = wchar_t; diff --git a/src/vendor/winapi/src/um/sqlucode.rs b/src/vendor/winapi/src/um/sqlucode.rs new file mode 100644 index 0000000000..8f90ae37de --- /dev/null +++ b/src/vendor/winapi/src/um/sqlucode.rs @@ -0,0 +1,107 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the ODBC Core unicode functions +use um::sqltypes::{ + SQLCHAR, SQLHANDLE, SQLHDBC, SQLHSTMT, SQLHWND, SQLINTEGER, SQLRETURN, SQLSMALLINT, SQLULEN, + SQLUSMALLINT, SQLWCHAR +}; +pub const SQL_WCHAR: SQLSMALLINT = -8; +pub const SQL_WVARCHAR: SQLSMALLINT = -9; +pub const SQL_WLONGVARCHAR: SQLSMALLINT = -10; +pub const SQL_C_WCHAR: SQLSMALLINT = SQL_WCHAR; +extern "system" { + pub fn SQLConnectW( + connectionHandle: SQLHDBC, + serverName: *const SQLWCHAR, + nameLength1: SQLSMALLINT, + userName: *const SQLWCHAR, + nameLength2: SQLSMALLINT, + authentication: *const SQLWCHAR, + nameLength3: SQLSMALLINT, + ) -> SQLRETURN; + pub fn SQLDescribeColW( + statementHandle: SQLHSTMT, + columnNumber: SQLUSMALLINT, + columnName: *mut SQLWCHAR, + bufferLength: SQLSMALLINT, + nameLength: *mut SQLSMALLINT, + dataType: *mut SQLSMALLINT, + columnSize: *mut SQLULEN, + decimalDigits: *mut SQLSMALLINT, + nullable: *mut SQLSMALLINT, + ) -> SQLRETURN; + pub fn SQLExecDirectW( + statementHandle: SQLHSTMT, + statementText: *const SQLWCHAR, + textLength: SQLINTEGER, + ) -> SQLRETURN; + pub fn SQLGetDiagRecW( + handleType: SQLSMALLINT, + handle: SQLHANDLE, + recNumber: SQLSMALLINT, + sqlstate: *mut SQLWCHAR, + nativeError: *mut SQLINTEGER, + messageText: *mut SQLWCHAR, + bufferLength: SQLSMALLINT, + textLength: *mut SQLSMALLINT, + ) -> SQLRETURN; + pub fn SQLDriverConnectW( + hdbc: SQLHDBC, + hwnd: SQLHWND, + szConnStrIn: *const SQLWCHAR, + cchConnStrIn: SQLSMALLINT, + szConnStrOut: *mut SQLWCHAR, + cchConnStrOutMax: SQLSMALLINT, + pcchConnStrOut: *mut SQLSMALLINT, + fDriverCompletion: SQLUSMALLINT, + ) -> SQLRETURN; + pub fn SQLConnectA( + connectionHandle: SQLHDBC, + serverName: *const SQLCHAR, + nameLength1: SQLSMALLINT, + userName: *const SQLCHAR, + nameLength2: SQLSMALLINT, + authentication: *const SQLCHAR, + nameLength3: SQLSMALLINT, + ) -> SQLRETURN; + pub fn SQLDescribeColA( + statementHandle: SQLHSTMT, + columnNumber: SQLUSMALLINT, + columnName: *mut SQLCHAR, + bufferLength: SQLSMALLINT, + nameLength: *mut SQLSMALLINT, + dataType: *mut SQLSMALLINT, + columnSize: *mut SQLULEN, + decimalDigits: *mut SQLSMALLINT, + nullable: *mut SQLSMALLINT, + ) -> SQLRETURN; + pub fn SQLExecDirectA( + statementHandle: SQLHSTMT, + statementText: *const SQLCHAR, + textLength: SQLINTEGER, + ) -> SQLRETURN; + pub fn SQLGetDiagRecA( + handleType: SQLSMALLINT, + handle: SQLHANDLE, + recNumber: SQLSMALLINT, + sqlstate: *mut SQLCHAR, + nativeError: *mut SQLINTEGER, + messageText: *mut SQLCHAR, + bufferLength: SQLSMALLINT, + textLength: *mut SQLSMALLINT, + ) -> SQLRETURN; + pub fn SQLDriverConnectA( + hdbc: SQLHDBC, + hwnd: SQLHWND, + szConnStrIn: *const SQLCHAR, + cchConnStrIn: SQLSMALLINT, + szConnStrOut: *mut SQLCHAR, + cchConnStrOutMax: SQLSMALLINT, + pcchConnStrOut: *mut SQLSMALLINT, + fDriverCompletion: SQLUSMALLINT, + ) -> SQLRETURN; +} diff --git a/src/vendor/winapi/src/um/sspi.rs b/src/vendor/winapi/src/um/sspi.rs new file mode 100644 index 0000000000..703ec8a97e --- /dev/null +++ b/src/vendor/winapi/src/um/sspi.rs @@ -0,0 +1,8 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Security Support Provider Interface Prototypes and structure definitions +pub use shared::sspi::*; diff --git a/src/vendor/winapi/src/um/stringapiset.rs b/src/vendor/winapi/src/um/stringapiset.rs new file mode 100644 index 0000000000..ad175bb615 --- /dev/null +++ b/src/vendor/winapi/src/um/stringapiset.rs @@ -0,0 +1,76 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_int; +use shared::minwindef::{BOOL, DWORD, LPARAM, LPBOOL, LPVOID, LPWORD, UINT}; +use um::winnls::LPNLSVERSIONINFO; +use um::winnt::{LCID, LPCSTR, LPCWCH, LPCWSTR, LPSTR, LPWSTR, PCNZWCH}; +extern "system" { + pub fn CompareStringEx( + lpLocaleName: LPCWSTR, + dwCmpFlags: DWORD, + lpString1: LPCWCH, + cchCount1: c_int, + lpString2: LPCWCH, + cchCount2: c_int, + lpVersionInformation: LPNLSVERSIONINFO, + lpReserved: LPVOID, + lParam: LPARAM, + ) -> c_int; + pub fn CompareStringOrdinal( + lpString1: LPCWCH, + cchCount1: c_int, + lpString2: LPCWCH, + cchCount2: c_int, + bIgnoreCase: BOOL, + ) -> c_int; + pub fn CompareStringW( + Locale: LCID, + dwCmpFlags: DWORD, + lpString1: PCNZWCH, + cchCount1: c_int, + lpString2: PCNZWCH, + cchCount2: c_int, + ) -> c_int; + pub fn FoldStringW( + dwMapFlags: DWORD, + lpSrcStr: LPCWCH, + cchSrc: c_int, + lpDestStr: LPWSTR, + cchDest: c_int, + ) -> c_int; + pub fn GetStringTypeExW( + Locale: LCID, + dwInfoType: DWORD, + lpSrcStr: LPCWCH, + cchSrc: c_int, + lpCharType: LPWORD, + ) -> BOOL; + pub fn GetStringTypeW( + dwInfoType: DWORD, + lpSrcStr: LPCWCH, + cchSrc: c_int, + lpCharType: LPWORD, + ) -> BOOL; + pub fn MultiByteToWideChar( + CodePage: UINT, + dwFlags: DWORD, + lpMultiByteStr: LPCSTR, + cbMultiByte: c_int, + lpWideCharStr: LPWSTR, + cchWideChar: c_int, + ) -> c_int; + pub fn WideCharToMultiByte( + CodePage: UINT, + dwFlags: DWORD, + lpWideCharStr: LPCWSTR, + cchWideChar: c_int, + lpMultiByteStr: LPSTR, + cbMultiByte: c_int, + lpDefaultChar: LPCSTR, + lpUsedDefaultChar: LPBOOL, + ) -> c_int; +} diff --git a/src/vendor/winapi/src/um/strmif.rs b/src/vendor/winapi/src/um/strmif.rs new file mode 100644 index 0000000000..95f9009c5a --- /dev/null +++ b/src/vendor/winapi/src/um/strmif.rs @@ -0,0 +1,8 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use um::winnt::LONGLONG; +pub type REFERENCE_TIME = LONGLONG; diff --git a/src/vendor/winapi/src/um/subauth.rs b/src/vendor/winapi/src/um/subauth.rs new file mode 100644 index 0000000000..55dfecdec3 --- /dev/null +++ b/src/vendor/winapi/src/um/subauth.rs @@ -0,0 +1,207 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Types and macros for Subauthentication Packages. + +use shared::minwindef::{PUCHAR, ULONG, USHORT}; +use um::winnt::{BOOLEAN, CHAR, LARGE_INTEGER, LONG, PCHAR, PVOID, PWSTR}; + +STRUCT!{struct UNICODE_STRING { + Length: USHORT, + MaximumLength: USHORT, + Buffer: PWSTR, +}} +pub type PUNICODE_STRING = *mut UNICODE_STRING; +STRUCT!{struct STRING { + Length: USHORT, + MaximumLength: USHORT, + Buffer: PCHAR, +}} +pub type PSTRING = *mut STRING; +STRUCT!{struct OLD_LARGE_INTEGER { + LowPart: ULONG, + HighPart: LONG, +}} +pub type POLD_LARGE_INTEGER = *mut OLD_LARGE_INTEGER; +pub type SAM_HANDLE = PVOID; +pub type PSAM_HANDLE = *mut PVOID; +pub const USER_ACCOUNT_DISABLED: ULONG = 0x00000001; +pub const USER_HOME_DIRECTORY_REQUIRED: ULONG = 0x00000002; +pub const USER_PASSWORD_NOT_REQUIRED: ULONG = 0x00000004; +pub const USER_TEMP_DUPLICATE_ACCOUNT: ULONG = 0x00000008; +pub const USER_NORMAL_ACCOUNT: ULONG = 0x00000010; +pub const USER_MNS_LOGON_ACCOUNT: ULONG = 0x00000020; +pub const USER_INTERDOMAIN_TRUST_ACCOUNT: ULONG = 0x00000040; +pub const USER_WORKSTATION_TRUST_ACCOUNT: ULONG = 0x00000080; +pub const USER_SERVER_TRUST_ACCOUNT: ULONG = 0x00000100; +pub const USER_DONT_EXPIRE_PASSWORD: ULONG = 0x00000200; +pub const USER_ACCOUNT_AUTO_LOCKED: ULONG = 0x00000400; +pub const USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED: ULONG = 0x00000800; +pub const USER_SMARTCARD_REQUIRED: ULONG = 0x00001000; +pub const USER_TRUSTED_FOR_DELEGATION: ULONG = 0x00002000; +pub const USER_NOT_DELEGATED: ULONG = 0x00004000; +pub const USER_USE_DES_KEY_ONLY: ULONG = 0x00008000; +pub const USER_DONT_REQUIRE_PREAUTH: ULONG = 0x00010000; +pub const USER_PASSWORD_EXPIRED: ULONG = 0x00020000; +pub const USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: ULONG = 0x00040000; +pub const USER_NO_AUTH_DATA_REQUIRED: ULONG = 0x00080000; +pub const USER_PARTIAL_SECRETS_ACCOUNT: ULONG = 0x00100000; +pub const USER_USE_AES_KEYS: ULONG = 0x00200000; +pub const NEXT_FREE_ACCOUNT_CONTROL_BIT: ULONG = USER_USE_AES_KEYS << 1; +pub const USER_MACHINE_ACCOUNT_MASK: ULONG = USER_INTERDOMAIN_TRUST_ACCOUNT + | USER_WORKSTATION_TRUST_ACCOUNT | USER_SERVER_TRUST_ACCOUNT; +pub const USER_ACCOUNT_TYPE_MASK: ULONG = USER_TEMP_DUPLICATE_ACCOUNT | USER_NORMAL_ACCOUNT + | USER_MACHINE_ACCOUNT_MASK; +pub const USER_COMPUTED_ACCOUNT_CONTROL_BITS: ULONG = USER_ACCOUNT_AUTO_LOCKED + | USER_PASSWORD_EXPIRED; +pub const SAM_DAYS_PER_WEEK: USHORT = 7; +pub const SAM_HOURS_PER_WEEK: USHORT = 24 * SAM_DAYS_PER_WEEK; +pub const SAM_MINUTES_PER_WEEK: USHORT = 60 * SAM_HOURS_PER_WEEK; +STRUCT!{struct LOGON_HOURS { + UnitsPerWeek: USHORT, + LogonHours: PUCHAR, +}} +pub type PLOGON_HOURS = *mut LOGON_HOURS; +STRUCT!{struct SR_SECURITY_DESCRIPTOR { + Length: ULONG, + SecurityDescriptor: PUCHAR, +}} +pub type PSR_SECURITY_DESCRIPTOR = *mut SR_SECURITY_DESCRIPTOR; +STRUCT!{struct USER_ALL_INFORMATION { + LastLogon: LARGE_INTEGER, + LastLogoff: LARGE_INTEGER, + PasswordLastSet: LARGE_INTEGER, + AccountExpires: LARGE_INTEGER, + PasswordCanChange: LARGE_INTEGER, + PasswordMustChange: LARGE_INTEGER, + UserName: UNICODE_STRING, + FullName: UNICODE_STRING, + HomeDirectory: UNICODE_STRING, + HomeDirectoryDrive: UNICODE_STRING, + ScriptPath: UNICODE_STRING, + ProfilePath: UNICODE_STRING, + AdminComment: UNICODE_STRING, + WorkStations: UNICODE_STRING, + UserComment: UNICODE_STRING, + Parameters: UNICODE_STRING, + LmPassword: UNICODE_STRING, + NtPassword: UNICODE_STRING, + PrivateData: UNICODE_STRING, + SecurityDescriptor: SR_SECURITY_DESCRIPTOR, + UserId: ULONG, + PrimaryGroupId: ULONG, + UserAccountControl: ULONG, + WhichFields: ULONG, + LogonHours: LOGON_HOURS, + BadPasswordCount: USHORT, + LogonCount: USHORT, + CountryCode: USHORT, + CodePage: USHORT, + LmPasswordPresent: BOOLEAN, + NtPasswordPresent: BOOLEAN, + PasswordExpired: BOOLEAN, + PrivateDataSensitive: BOOLEAN, +}} +pub type PUSER_ALL_INFORMATION = *mut USER_ALL_INFORMATION; +pub const USER_ALL_PARAMETERS: ULONG = 0x00200000; +pub const CLEAR_BLOCK_LENGTH: usize = 8; +STRUCT!{struct CLEAR_BLOCK { + data: [CHAR; CLEAR_BLOCK_LENGTH], +}} +pub type PCLEAR_BLOCK = *mut CLEAR_BLOCK; +pub const CYPHER_BLOCK_LENGTH: usize = 8; +STRUCT!{struct CYPHER_BLOCK { + data: [CHAR; CYPHER_BLOCK_LENGTH], +}} +pub type PCYPHER_BLOCK = *mut CYPHER_BLOCK; +STRUCT!{struct LM_OWF_PASSWORD { + data: [CYPHER_BLOCK; 2], +}} +pub type PLM_OWF_PASSWORD = *mut LM_OWF_PASSWORD; +pub type LM_CHALLENGE = CLEAR_BLOCK; +pub type PLM_CHALLENGE = *mut LM_CHALLENGE; +pub type NT_OWF_PASSWORD = LM_OWF_PASSWORD; +pub type PNT_OWF_PASSWORD = *mut NT_OWF_PASSWORD; +pub type NT_CHALLENGE = LM_CHALLENGE; +pub type PNT_CHALLENGE = *mut NT_CHALLENGE; +pub const USER_SESSION_KEY_LENGTH: usize = CYPHER_BLOCK_LENGTH * 2; +STRUCT!{struct USER_SESSION_KEY { + data: [CYPHER_BLOCK; 2], +}} +pub type PUSER_SESSION_KEY = *mut USER_SESSION_KEY; +ENUM!{enum NETLOGON_LOGON_INFO_CLASS { + NetlogonInteractiveInformation = 1, + NetlogonNetworkInformation, + NetlogonServiceInformation, + NetlogonGenericInformation, + NetlogonInteractiveTransitiveInformation, + NetlogonNetworkTransitiveInformation, + NetlogonServiceTransitiveInformation, +}} +STRUCT!{struct NETLOGON_LOGON_IDENTITY_INFO { + LogonDomainName: UNICODE_STRING, + ParameterControl: ULONG, + LogonId: OLD_LARGE_INTEGER, + UserName: UNICODE_STRING, + Workstation: UNICODE_STRING, +}} +pub type PNETLOGON_LOGON_IDENTITY_INFO = *mut NETLOGON_LOGON_IDENTITY_INFO; +STRUCT!{struct NETLOGON_INTERACTIVE_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + LmOwfPassword: LM_OWF_PASSWORD, + NtOwfPassword: NT_OWF_PASSWORD, +}} +pub type PNETLOGON_INTERACTIVE_INFO = *mut NETLOGON_INTERACTIVE_INFO; +STRUCT!{struct NETLOGON_SERVICE_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + LmOwfPassword: LM_OWF_PASSWORD, + NtOwfPassword: NT_OWF_PASSWORD, +}} +pub type PNETLOGON_SERVICE_INFO = *mut NETLOGON_SERVICE_INFO; +STRUCT!{struct NETLOGON_NETWORK_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + LmChallenge: LM_CHALLENGE, + NtChallengeResponse: STRING, + LmChallengeResponse: STRING, +}} +pub type PNETLOGON_NETWORK_INFO = *mut NETLOGON_NETWORK_INFO; +STRUCT!{struct NETLOGON_GENERIC_INFO { + Identity: NETLOGON_LOGON_IDENTITY_INFO, + PackageName: UNICODE_STRING, + DataLength: ULONG, + LogonData: PUCHAR, +}} +pub type PNETLOGON_GENERIC_INFO = *mut NETLOGON_GENERIC_INFO; +pub const MSV1_0_PASSTHRU: ULONG = 0x01; +pub const MSV1_0_GUEST_LOGON: ULONG = 0x02; +STRUCT!{struct MSV1_0_VALIDATION_INFO { + LogoffTime: LARGE_INTEGER, + KickoffTime: LARGE_INTEGER, + LogonServer: UNICODE_STRING, + LogonDomainName: UNICODE_STRING, + SessionKey: USER_SESSION_KEY, + Authoritative: BOOLEAN, + UserFlags: ULONG, + WhichFields: ULONG, + UserId: ULONG, +}} +pub type PMSV1_0_VALIDATION_INFO = *mut MSV1_0_VALIDATION_INFO; +pub const MSV1_0_VALIDATION_LOGOFF_TIME: ULONG = 0x00000001; +pub const MSV1_0_VALIDATION_KICKOFF_TIME: ULONG = 0x00000002; +pub const MSV1_0_VALIDATION_LOGON_SERVER: ULONG = 0x00000004; +pub const MSV1_0_VALIDATION_LOGON_DOMAIN: ULONG = 0x00000008; +pub const MSV1_0_VALIDATION_SESSION_KEY: ULONG = 0x00000010; +pub const MSV1_0_VALIDATION_USER_FLAGS: ULONG = 0x00000020; +pub const MSV1_0_VALIDATION_USER_ID: ULONG = 0x00000040; +pub const MSV1_0_SUBAUTH_ACCOUNT_DISABLED: ULONG = 0x00000001; +pub const MSV1_0_SUBAUTH_PASSWORD: ULONG = 0x00000002; +pub const MSV1_0_SUBAUTH_WORKSTATIONS: ULONG = 0x00000004; +pub const MSV1_0_SUBAUTH_LOGON_HOURS: ULONG = 0x00000008; +pub const MSV1_0_SUBAUTH_ACCOUNT_EXPIRY: ULONG = 0x00000010; +pub const MSV1_0_SUBAUTH_PASSWORD_EXPIRY: ULONG = 0x00000020; +pub const MSV1_0_SUBAUTH_ACCOUNT_TYPE: ULONG = 0x00000040; +pub const MSV1_0_SUBAUTH_LOCKOUT: ULONG = 0x00000080; +// STATUS_* diff --git a/src/vendor/winapi/src/um/synchapi.rs b/src/vendor/winapi/src/um/synchapi.rs new file mode 100644 index 0000000000..33f3ab7722 --- /dev/null +++ b/src/vendor/winapi/src/um/synchapi.rs @@ -0,0 +1,350 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-synch-l1 +use shared::basetsd::SIZE_T; +use shared::minwindef::{BOOL, DWORD, LPLONG, LPVOID, PBOOL, ULONG}; +use um::minwinbase::{ + LPCRITICAL_SECTION, LPSECURITY_ATTRIBUTES, PCRITICAL_SECTION, PREASON_CONTEXT, +}; +use um::winnt::{ + BOOLEAN, HANDLE, LARGE_INTEGER, LONG, LPCSTR, LPCWSTR, PRTL_BARRIER, PRTL_RUN_ONCE, + PVOID, RTL_BARRIER, RTL_CONDITION_VARIABLE, RTL_CONDITION_VARIABLE_INIT, + RTL_RUN_ONCE, RTL_SRWLOCK, RTL_SRWLOCK_INIT, VOID +}; +pub const SRWLOCK_INIT: SRWLOCK = RTL_SRWLOCK_INIT; +pub type SRWLOCK = RTL_SRWLOCK; +pub type PSRWLOCK = *mut RTL_SRWLOCK; +extern "system" { + pub fn InitializeSRWLock( + SRWLock: PSRWLOCK, + ); + pub fn ReleaseSRWLockExclusive( + SRWLock: PSRWLOCK, + ); + pub fn ReleaseSRWLockShared( + SRWLock: PSRWLOCK, + ); + pub fn AcquireSRWLockExclusive( + SRWLock: PSRWLOCK, + ); + pub fn AcquireSRWLockShared( + SRWLock: PSRWLOCK, + ); + pub fn TryAcquireSRWLockExclusive( + SRWLock: PSRWLOCK, + ) -> BOOLEAN; + pub fn TryAcquireSRWLockShared( + SRWLock: PSRWLOCK, + ) -> BOOLEAN; + pub fn InitializeCriticalSection( + lpCriticalSection: LPCRITICAL_SECTION, + ); + pub fn EnterCriticalSection( + lpCriticalSection: LPCRITICAL_SECTION, + ); + pub fn LeaveCriticalSection( + lpCriticalSection: LPCRITICAL_SECTION, + ); + pub fn InitializeCriticalSectionAndSpinCount( + lpCriticalSection: LPCRITICAL_SECTION, + dwSpinCount: DWORD, + ) -> BOOL; + pub fn InitializeCriticalSectionEx( + lpCriticalSection: LPCRITICAL_SECTION, + dwSpinCount: DWORD, + Flags: DWORD, + ) -> BOOL; + pub fn SetCriticalSectionSpinCount( + lpCriticalSection: LPCRITICAL_SECTION, + dwSpinCount: DWORD, + ) -> DWORD; + pub fn TryEnterCriticalSection( + lpCriticalSection: LPCRITICAL_SECTION, + ) -> BOOL; + pub fn DeleteCriticalSection( + lpCriticalSection: LPCRITICAL_SECTION, + ); +} +pub type INIT_ONCE = RTL_RUN_ONCE; +pub type PINIT_ONCE = PRTL_RUN_ONCE; +pub type LPINIT_ONCE = PRTL_RUN_ONCE; +//pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = RTL_RUN_ONCE_INIT; +//pub const INIT_ONCE_CHECK_ONLY: ULONG = RTL_RUN_ONCE_CHECK_ONLY; +//pub const INIT_ONCE_ASYNC: ULONG = RTL_RUN_ONCE_ASYNC; +//pub const INIT_ONCE_INIT_FAILED: ULONG = RTL_RUN_ONCE_INIT_FAILED; +//pub const INIT_ONCE_CTX_RESERVED_BITS: usize = RTL_RUN_ONCE_CTX_RESERVED_BITS; +FN!{stdcall PINIT_ONCE_FN( + InitOnce: PINIT_ONCE, + Parameter: PVOID, + Context: *mut PVOID, +) -> BOOL} +extern "system" { + pub fn InitOnceInitialize( + InitOnce: PINIT_ONCE, + ); + pub fn InitOnceExecuteOnce( + InitOnce: PINIT_ONCE, + InitFn: PINIT_ONCE_FN, + Parameter: PVOID, + Context: *mut LPVOID, + ) -> BOOL; + pub fn InitOnceBeginInitialize( + lpInitOnce: LPINIT_ONCE, + dwFlags: DWORD, + fPending: PBOOL, + lpContext: *mut LPVOID, + ) -> BOOL; + pub fn InitOnceComplete( + lpInitOnce: LPINIT_ONCE, + dwFlags: DWORD, + lpContext: LPVOID, + ) -> BOOL; +} +pub type CONDITION_VARIABLE = RTL_CONDITION_VARIABLE; +pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; +pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = RTL_CONDITION_VARIABLE_INIT; +//pub const CONDITION_VARIABLE_LOCKMODE_SHARED: ULONG = RTL_CONDITION_VARIABLE_LOCKMODE_SHARED; +extern "system" { + pub fn InitializeConditionVariable( + ConditionVariable: PCONDITION_VARIABLE, + ); + pub fn WakeConditionVariable( + ConditionVariable: PCONDITION_VARIABLE, + ); + pub fn WakeAllConditionVariable( + ConditionVariable: PCONDITION_VARIABLE, + ); + pub fn SleepConditionVariableCS( + ConditionVariable: PCONDITION_VARIABLE, + CriticalSection: PCRITICAL_SECTION, + dwMilliseconds: DWORD, + ) -> BOOL; + pub fn SleepConditionVariableSRW( + ConditionVariable: PCONDITION_VARIABLE, + SRWLock: PSRWLOCK, + dwMilliseconds: DWORD, + Flags: ULONG, + ) -> BOOL; + pub fn SetEvent( + hEvent: HANDLE, + ) -> BOOL; + pub fn ResetEvent( + hEvent: HANDLE, + ) -> BOOL; + pub fn ReleaseSemaphore( + hSemaphore: HANDLE, + lReleaseCount: LONG, + lpPreviousCount: LPLONG, + ) -> BOOL; + pub fn ReleaseMutex( + hMutex: HANDLE, + ) -> BOOL; + pub fn WaitForSingleObject( + hHandle: HANDLE, + dwMilliseconds: DWORD, + ) -> DWORD; + pub fn SleepEx( + dwMilliseconds: DWORD, + bAlertable: BOOL, + ) -> DWORD; + pub fn WaitForSingleObjectEx( + hHandle: HANDLE, + dwMilliseconds: DWORD, + bAlertable: BOOL, + ) -> DWORD; + pub fn WaitForMultipleObjectsEx( + nCount: DWORD, + lpHandles: *const HANDLE, + bWaitAll: BOOL, + dwMilliseconds: DWORD, + bAlertable: BOOL, + ) -> DWORD; +} +//pub const MUTEX_MODIFY_STATE: DWORD = MUTANT_QUERY_STATE; +//pub const MUTEX_ALL_ACCESS: DWORD = MUTANT_ALL_ACCESS; +extern "system" { + pub fn CreateMutexA( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, + bInitialOwner: BOOL, + lpName: LPCSTR, + ) -> HANDLE; + pub fn CreateMutexW( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, + bInitialOwner: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn OpenMutexW( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn CreateEventA( + lpEventAttributes: LPSECURITY_ATTRIBUTES, + bManualReset: BOOL, + bInitialState: BOOL, + lpName: LPCSTR, + ) -> HANDLE; + pub fn CreateEventW( + lpEventAttributes: LPSECURITY_ATTRIBUTES, + bManualReset: BOOL, + bInitialState: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn OpenEventA( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCSTR, + ) -> HANDLE; + pub fn OpenEventW( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn OpenSemaphoreW( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCWSTR, + ) -> HANDLE; +} +FN!{stdcall PTIMERAPCROUTINE( + lpArgToCompletionRoutine: LPVOID, + dwTimerLowValue: DWORD, + dwTimerHighValue: DWORD, +) -> ()} +extern "system" { + pub fn OpenWaitableTimerW( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpTimerName: LPCWSTR, + ) -> HANDLE; + pub fn SetWaitableTimerEx( + hTimer: HANDLE, + lpDueTime: *const LARGE_INTEGER, + lPeriod: LONG, + pfnCompletionRoutine: PTIMERAPCROUTINE, + lpArgToCompletionRoutine: LPVOID, + WakeContext: PREASON_CONTEXT, + TolerableDelay: ULONG, + ) -> BOOL; + pub fn SetWaitableTimer( + hTimer: HANDLE, + lpDueTime: *const LARGE_INTEGER, + lPeriod: LONG, + pfnCompletionRoutine: PTIMERAPCROUTINE, + lpArgToCompletionRoutine: LPVOID, + fResume: BOOL, + ) -> BOOL; + pub fn CancelWaitableTimer( + hTimer: HANDLE + ) -> BOOL; +} +pub const CREATE_MUTEX_INITIAL_OWNER: DWORD = 0x00000001; +extern "system" { + pub fn CreateMutexExA( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, + lpName: LPCSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateMutexExW( + lpMutexAttributes: LPSECURITY_ATTRIBUTES, + lpName: LPCWSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; +} +pub const CREATE_EVENT_MANUAL_RESET: DWORD = 0x00000001; +pub const CREATE_EVENT_INITIAL_SET: DWORD = 0x00000002; +extern "system" { + pub fn CreateEventExA( + lpEventAttributes: LPSECURITY_ATTRIBUTES, + lpName: LPCSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateEventExW( + lpEventAttributes: LPSECURITY_ATTRIBUTES, + lpName: LPCWSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateSemaphoreExW( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, + lInitialCount: LONG, + lMaximumCount: LONG, + lpName: LPCWSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; +} +pub const CREATE_WAITABLE_TIMER_MANUAL_RESET: DWORD = 0x00000001; +extern "system" { + pub fn CreateWaitableTimerExW( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, + lpTimerName: LPCWSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; +} +pub type SYNCHRONIZATION_BARRIER = RTL_BARRIER; +pub type PSYNCHRONIZATION_BARRIER = PRTL_BARRIER; +pub type LPSYNCHRONIZATION_BARRIER = PRTL_BARRIER; +pub const SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY: DWORD = 0x01; +pub const SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY: DWORD = 0x02; +pub const SYNCHRONIZATION_BARRIER_FLAGS_NO_DELETE: DWORD = 0x04; +extern "system" { + pub fn EnterSynchronizationBarrier( + lpBarrier: LPSYNCHRONIZATION_BARRIER, + dwFlags: DWORD, + ) -> BOOL; + pub fn InitializeSynchronizationBarrier( + lpBarrier: LPSYNCHRONIZATION_BARRIER, + lTotalThreads: LONG, + lSpinCount: LONG, + ) -> BOOL; + pub fn DeleteSynchronizationBarrier( + lpBarrier: LPSYNCHRONIZATION_BARRIER, + ) -> BOOL; + pub fn Sleep( + dwMilliseconds: DWORD, + ); + pub fn WaitOnAddress( + Address: *mut VOID, + CompareAddress: PVOID, + AddressSize: SIZE_T, + dwMilliseconds: DWORD, + ) -> BOOL; + pub fn WakeByAddressSingle( + Address: PVOID, + ); + pub fn WakeByAddressAll( + Address: PVOID, + ); + pub fn SignalObjectAndWait( + hObjectToSignal: HANDLE, + hObjectToWaitOn: HANDLE, + dwMilliseconds: DWORD, + bAlertable: BOOL, + ) -> DWORD; + pub fn WaitForMultipleObjects( + nCount: DWORD, + lpHandles: *const HANDLE, + bWaitAll: BOOL, + dwMilliseconds: DWORD, + ) -> DWORD; + pub fn CreateSemaphoreW( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, + lInitialCount: LONG, + lMaximumCount: LONG, + lpName: LPCWSTR, + ) -> HANDLE; + pub fn CreateWaitableTimerW( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, + bManualReset: BOOL, + lpTimerName: LPCWSTR, + ) -> HANDLE; +} diff --git a/src/vendor/winapi/src/um/sysinfoapi.rs b/src/vendor/winapi/src/um/sysinfoapi.rs new file mode 100644 index 0000000000..1cf3579b49 --- /dev/null +++ b/src/vendor/winapi/src/um/sysinfoapi.rs @@ -0,0 +1,218 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-sysinfo-l1. +use shared::basetsd::DWORD_PTR; +use shared::minwindef::{ + BOOL, BYTE, DWORD, LPDWORD, LPFILETIME, LPVOID, PBOOL, PDWORD, UINT, USHORT, WORD, +}; +use um::minwinbase::{LPSYSTEMTIME, SYSTEMTIME}; +use um::winnt::{ + DWORDLONG, HANDLE, LOGICAL_PROCESSOR_RELATIONSHIP, LPCSTR, LPCWSTR, LPOSVERSIONINFOA, + LPOSVERSIONINFOW, LPSTR, LPWSTR, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, + PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION, PULONGLONG, PVOID, ULONGLONG, +}; +STRUCT!{struct SYSTEM_INFO_u_s { + wProcessorArchitecture: WORD, + wReserved: WORD, +}} +UNION!{union SYSTEM_INFO_u { + [u32; 1], + dwOemId dwOemId_mut: DWORD, + s s_mut: SYSTEM_INFO_u_s, +}} +STRUCT!{struct SYSTEM_INFO { + u: SYSTEM_INFO_u, + dwPageSize: DWORD, + lpMinimumApplicationAddress: LPVOID, + lpMaximumApplicationAddress: LPVOID, + dwActiveProcessorMask: DWORD_PTR, + dwNumberOfProcessors: DWORD, + dwProcessorType: DWORD, + dwAllocationGranularity: DWORD, + wProcessorLevel: WORD, + wProcessorRevision: WORD, +}} +pub type LPSYSTEM_INFO = *mut SYSTEM_INFO; +STRUCT!{struct MEMORYSTATUSEX { + dwLength: DWORD, + dwMemoryLoad: DWORD, + ullTotalPhys: DWORDLONG, + ullAvailPhys: DWORDLONG, + ullTotalPageFile: DWORDLONG, + ullAvailPageFile: DWORDLONG, + ullTotalVirtual: DWORDLONG, + ullAvailVirtual: DWORDLONG, + ullAvailExtendedVirtual: DWORDLONG, +}} +pub type LPMEMORYSTATUSEX = *mut MEMORYSTATUSEX; +extern "system" { + pub fn GlobalMemoryStatusEx( + lpBuffer: LPMEMORYSTATUSEX, + ) -> BOOL; + pub fn GetSystemInfo( + lpSystemInfo: LPSYSTEM_INFO, + ); + pub fn GetSystemTime( + lpSystemTime: LPSYSTEMTIME, + ); + pub fn GetSystemTimeAsFileTime( + lpSystemTimeAsFileTime: LPFILETIME, + ); + pub fn GetLocalTime( + lpSystemTime: LPSYSTEMTIME, + ); + pub fn GetVersion() -> DWORD; + pub fn SetLocalTime( + lpSystemTime: *const SYSTEMTIME, + ) -> BOOL; + pub fn GetTickCount() -> DWORD; + pub fn GetTickCount64() -> ULONGLONG; + pub fn GetSystemTimeAdjustment( + lpTimeAdjustment: PDWORD, + lpTimeIncrement: PDWORD, + lpTimeAdjustmentDisabled: PBOOL, + ) -> BOOL; + pub fn GetSystemDirectoryA( + lpBuffer: LPSTR, + uSize: UINT, + ) -> UINT; + pub fn GetSystemDirectoryW( + lpBuffer: LPWSTR, + uSize: UINT, + ) -> UINT; + pub fn GetWindowsDirectoryA( + lpBuffer: LPSTR, + uSize: UINT, + ) -> UINT; + pub fn GetWindowsDirectoryW( + lpBuffer: LPWSTR, + uSize: UINT, + ) -> UINT; + pub fn GetSystemWindowsDirectoryA( + lpBuffer: LPSTR, + uSize: UINT, + ) -> UINT; + pub fn GetSystemWindowsDirectoryW( + lpBuffer: LPWSTR, + uSize: UINT, + ) -> UINT; +} +ENUM!{enum COMPUTER_NAME_FORMAT { + ComputerNameNetBIOS, + ComputerNameDnsHostname, + ComputerNameDnsDomain, + ComputerNameDnsFullyQualified, + ComputerNamePhysicalNetBIOS, + ComputerNamePhysicalDnsHostname, + ComputerNamePhysicalDnsDomain, + ComputerNamePhysicalDnsFullyQualified, + ComputerNameMax, +}} +extern "system" { + pub fn GetComputerNameExA( + NameType: COMPUTER_NAME_FORMAT, + lpBuffer: LPSTR, + nSize: LPDWORD, + ) -> BOOL; + pub fn GetComputerNameExW( + NameType: COMPUTER_NAME_FORMAT, + lpBuffer: LPWSTR, + nSize: LPDWORD, + ) -> BOOL; + pub fn SetComputerNameExW( + NameType: COMPUTER_NAME_FORMAT, + lpBuffer: LPCWSTR, + ) -> BOOL; + pub fn SetSystemTime( + lpSystemTime: *const SYSTEMTIME, + ) -> BOOL; + pub fn GetVersionExA( + lpVersionInformation: LPOSVERSIONINFOA, + ) -> BOOL; + pub fn GetVersionExW( + lpVersionInformation: LPOSVERSIONINFOW, + ) -> BOOL; + pub fn GetLogicalProcessorInformation( + Buffer: PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, + ReturnedLength: PDWORD, + ) -> BOOL; + pub fn GetLogicalProcessorInformationEx( + RelationshipType: LOGICAL_PROCESSOR_RELATIONSHIP, + Buffer: PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, + ReturnedLength: PDWORD, + ) -> BOOL; + pub fn GetNativeSystemInfo( + lpSystemInfo: LPSYSTEM_INFO, + ); + pub fn GetSystemTimePreciseAsFileTime( + lpSystemTimeAsFileTime: LPFILETIME, + ); + pub fn GetProductInfo( + dwOSMajorVersion: DWORD, + dwOSMinorVersion: DWORD, + dwSpMajorVersion: DWORD, + dwSpMinorVersion: DWORD, + pdwReturnedProductType: PDWORD, + ) -> BOOL; + pub fn VerSetConditionMask( + ConditionMask: ULONGLONG, + TypeMask: DWORD, + Condition: BYTE, + ) -> ULONGLONG; + // pub fn GetOsSafeBootMode(); + pub fn EnumSystemFirmwareTables( + FirmwareTableProviderSignature: DWORD, + pFirmwareTableEnumBuffer: PVOID, + BufferSize: DWORD, + ) -> UINT; + pub fn GetSystemFirmwareTable( + FirmwareTableProviderSignature: DWORD, + FirmwareTableID: DWORD, + pFirmwareTableBuffer: PVOID, + BufferSize: DWORD, + ) -> UINT; + pub fn DnsHostnameToComputerNameExW( + Hostname: LPCWSTR, + ComputerName: LPWSTR, + nSize: LPDWORD, + ) -> BOOL; + pub fn GetPhysicallyInstalledSystemMemory( + TotalMemoryInKilobytes: PULONGLONG, + ) -> BOOL; +} +pub const SCEX2_ALT_NETBIOS_NAME: DWORD = 0x00000001; +extern "system" { + pub fn SetComputerNameEx2W( + NameType: COMPUTER_NAME_FORMAT, + Flags: DWORD, + lpBuffer: LPCWSTR, + ) -> BOOL; + pub fn SetSystemTimeAdjustment( + dwTimeAdjustment: DWORD, + bTimeAdjustmentDisabled: BOOL, + ) -> BOOL; + pub fn InstallELAMCertificateInfo( + ELAMFile: HANDLE, + ) -> BOOL; + pub fn GetProcessorSystemCycleTime( + Group: USHORT, + Buffer: PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION, + ReturnedLength: PDWORD, + ) -> BOOL; + // pub fn GetOsManufacturingMode(); + // pub fn GetIntegratedDisplaySize(); + pub fn SetComputerNameA( + lpComputerName: LPCSTR, + ) -> BOOL; + pub fn SetComputerNameW( + lpComputerName: LPCWSTR, + ) -> BOOL; + pub fn SetComputerNameExA( + NameType: COMPUTER_NAME_FORMAT, + lpBuffer: LPCSTR, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/systemtopologyapi.rs b/src/vendor/winapi/src/um/systemtopologyapi.rs new file mode 100644 index 0000000000..6f9b8ac230 --- /dev/null +++ b/src/vendor/winapi/src/um/systemtopologyapi.rs @@ -0,0 +1,22 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, PULONG, PUSHORT, ULONG, USHORT}; +use um::winnt::PGROUP_AFFINITY; +extern "system" { + pub fn GetNumaHighestNodeNumber( + HighestNodeNumber: PULONG, + ) -> BOOL; + pub fn GetNumaNodeProcessorMaskEx( + Node: USHORT, + ProcessorMask: PGROUP_AFFINITY + ) -> BOOL; + pub fn GetNumaProximityNodeEx( + ProximityId: ULONG, + NodeNumber: PUSHORT, + ) -> BOOL; +} + diff --git a/src/vendor/winapi/src/um/textstor.rs b/src/vendor/winapi/src/um/textstor.rs new file mode 100644 index 0000000000..877ae0f534 --- /dev/null +++ b/src/vendor/winapi/src/um/textstor.rs @@ -0,0 +1,12 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +DEFINE_GUID!{GUID_TS_SERVICE_DATAOBJECT, + 0x6086fbb5, 0xe225, 0x46ce, 0xa7, 0x70, 0xc1, 0xbb, 0xd3, 0xe0, 0x5d, 0x7b} +DEFINE_GUID!{GUID_TS_SERVICE_ACCESSIBLE, + 0xf9786200, 0xa5bf, 0x4a0f, 0x8c, 0x24, 0xfb, 0x16, 0xf5, 0xd1, 0xaa, 0xbb} +DEFINE_GUID!{GUID_TS_SERVICE_ACTIVEX, + 0xea937a50, 0xc9a6, 0x4b7d, 0x89, 0x4a, 0x49, 0xd9, 0x9b, 0x78, 0x48, 0x34} diff --git a/src/vendor/winapi/src/um/threadpoolapiset.rs b/src/vendor/winapi/src/um/threadpoolapiset.rs new file mode 100644 index 0000000000..80fbb42eb7 --- /dev/null +++ b/src/vendor/winapi/src/um/threadpoolapiset.rs @@ -0,0 +1,172 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-threadpool-l1. +use shared::basetsd::ULONG_PTR; +use shared::minwindef::{BOOL, DWORD, HMODULE, PFILETIME, ULONG}; +use um::minwinbase::PCRITICAL_SECTION; +use um::winnt::{ + HANDLE, PTP_CALLBACK_ENVIRON, PTP_CALLBACK_INSTANCE, PTP_CLEANUP_GROUP, PTP_IO, PTP_POOL, + PTP_POOL_STACK_INFORMATION, PTP_SIMPLE_CALLBACK, PTP_TIMER, PTP_TIMER_CALLBACK, PTP_WAIT, + PTP_WAIT_CALLBACK, PTP_WORK, PTP_WORK_CALLBACK, PVOID, +}; +FN!{stdcall PTP_WIN32_IO_CALLBACK( + Instance: PTP_CALLBACK_INSTANCE, + Context: PVOID, + Overlapped: PVOID, + IoResult: ULONG, + NumberOfBytesTransferred: ULONG_PTR, + Io: PTP_IO, +) -> ()} +extern "system" { + pub fn CreateThreadpool( + reserved: PVOID, + ) -> PTP_POOL; + pub fn SetThreadpoolThreadMaximum( + ptpp: PTP_POOL, + cthrdMost: DWORD, + ) -> (); + pub fn SetThreadpoolThreadMinimum( + ptpp: PTP_POOL, + cthrdMic: DWORD, + ) -> BOOL; + pub fn SetThreadpoolStackInformation( + ptpp: PTP_POOL, + ptpsi: PTP_POOL_STACK_INFORMATION, + ) -> BOOL; + pub fn QueryThreadpoolStackInformation( + ptpp: PTP_POOL, + ptpsi: PTP_POOL_STACK_INFORMATION, + ) -> BOOL; + pub fn CloseThreadpool( + ptpp: PTP_POOL, + ) -> (); + pub fn CreateThreadpoolCleanupGroup() -> PTP_CLEANUP_GROUP; + pub fn CloseThreadpoolCleanupGroupMembers( + ptpcg: PTP_CLEANUP_GROUP, + fCancelPendingCallbacks: BOOL, + pvCleanupContext: PVOID, + ) -> (); + pub fn CloseThreadpoolCleanupGroup( + ptpcg: PTP_CLEANUP_GROUP, + ) -> (); + pub fn SetEventWhenCallbackReturns( + pci: PTP_CALLBACK_INSTANCE, + evt: HANDLE, + ) -> (); + pub fn ReleaseSemaphoreWhenCallbackReturns( + pci: PTP_CALLBACK_INSTANCE, + sem: HANDLE, + crel: DWORD, + ) -> (); + pub fn ReleaseMutexWhenCallbackReturns( + pci: PTP_CALLBACK_INSTANCE, + mut_: HANDLE, + ) -> (); + pub fn LeaveCriticalSectionWhenCallbackReturns( + pci: PTP_CALLBACK_INSTANCE, + pcs: PCRITICAL_SECTION, + ) -> (); + pub fn FreeLibraryWhenCallbackReturns( + pci: PTP_CALLBACK_INSTANCE, + mod_: HMODULE, + ) -> (); + pub fn CallbackMayRunLong( + pci: PTP_CALLBACK_INSTANCE, + ) -> BOOL; + pub fn DisassociateCurrentThreadFromCallback( + pci: PTP_CALLBACK_INSTANCE, + ) -> (); + pub fn TrySubmitThreadpoolCallback( + pfns: PTP_SIMPLE_CALLBACK, + pv: PVOID, + pcbe: PTP_CALLBACK_ENVIRON, + ) -> BOOL; + pub fn CreateThreadpoolWork( + pfnwk: PTP_WORK_CALLBACK, + pv: PVOID, + pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_WORK; + pub fn SubmitThreadpoolWork( + pwk: PTP_WORK, + ) -> (); + pub fn WaitForThreadpoolWorkCallbacks( + pwk: PTP_WORK, + fCancelPendingCallbacks: BOOL, + ) -> (); + pub fn CloseThreadpoolWork( + pwk: PTP_WORK, + ) -> (); + pub fn CreateThreadpoolTimer( + pfnti: PTP_TIMER_CALLBACK, + pv: PVOID, + pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_TIMER; + pub fn SetThreadpoolTimer( + pti: PTP_TIMER, + pftDueTime: PFILETIME, + msPeriod: DWORD, + msWindowLength: DWORD, + ) -> (); + pub fn IsThreadpoolTimerSet( + pti: PTP_TIMER, + ) -> BOOL; + pub fn WaitForThreadpoolTimerCallbacks( + pti: PTP_TIMER, + fCancelPendingCallbacks: BOOL, + ) -> (); + pub fn CloseThreadpoolTimer( + pti: PTP_TIMER, + ) -> (); + pub fn CreateThreadpoolWait( + pfnwa: PTP_WAIT_CALLBACK, + pv: PVOID, + pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_WAIT; + pub fn SetThreadpoolWait( + pwa: PTP_WAIT, + h: HANDLE, + pftTimeout: PFILETIME, + ) -> (); + pub fn WaitForThreadpoolWaitCallbacks( + pwa: PTP_WAIT, + fCancelPendingCallbacks: BOOL, + ) -> (); + pub fn CloseThreadpoolWait( + pwa: PTP_WAIT, + ) -> (); + pub fn CreateThreadpoolIo( + fl: HANDLE, + pfnio: PTP_WIN32_IO_CALLBACK, + pv: PVOID, + pcbe: PTP_CALLBACK_ENVIRON, + ) -> PTP_IO; + pub fn StartThreadpoolIo( + pio: PTP_IO, + ) -> (); + pub fn CancelThreadpoolIo( + pio: PTP_IO, + ) -> (); + pub fn WaitForThreadpoolIoCallbacks( + pio: PTP_IO, + fCancelPendingCallbacks: BOOL, + ) -> (); + pub fn CloseThreadpoolIo( + pio: PTP_IO, + ) -> (); + pub fn SetThreadpoolTimerEx( + pti: PTP_TIMER, + pftDueTime: PFILETIME, + msPeriod: DWORD, + msWindowLength: DWORD, + ) -> BOOL; + pub fn SetThreadpoolWaitEx( + pwa: PTP_WAIT, + h: HANDLE, + pftTimeout: PFILETIME, + Reserved: PVOID, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/threadpoollegacyapiset.rs b/src/vendor/winapi/src/um/threadpoollegacyapiset.rs new file mode 100644 index 0000000000..8e4ba9d8ef --- /dev/null +++ b/src/vendor/winapi/src/um/threadpoollegacyapiset.rs @@ -0,0 +1,45 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, DWORD, ULONG}; +use um::minwinbase::LPTHREAD_START_ROUTINE; +use um::winnt::{HANDLE, PHANDLE, PVOID, WAITORTIMERCALLBACK}; +extern "system" { + pub fn QueueUserWorkItem( + Function: LPTHREAD_START_ROUTINE, + Context: PVOID, + Flags: ULONG, + ) -> BOOL; + pub fn UnregisterWaitEx( + WaitHandle: HANDLE, + CompletionEvent: HANDLE, + ) -> BOOL; + pub fn CreateTimerQueue() -> HANDLE; + pub fn CreateTimerQueueTimer( + phNewTimer: PHANDLE, + TimerQueue: HANDLE, + Callback: WAITORTIMERCALLBACK, + Parameter: PVOID, + DueTime: DWORD, + Period: DWORD, + Flags: ULONG, + ) -> BOOL; + pub fn ChangeTimerQueueTimer( + TimerQueue: HANDLE, + Timer: HANDLE, + DueTime: ULONG, + Period: ULONG, + ) -> BOOL; + pub fn DeleteTimerQueueTimer( + TimerQueue: HANDLE, + Timer: HANDLE, + CompletionEvent: HANDLE, + ) -> BOOL; + pub fn DeleteTimerQueueEx( + TimerQueue: HANDLE, + CompletionEvent: HANDLE, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/timeapi.rs b/src/vendor/winapi/src/um/timeapi.rs new file mode 100644 index 0000000000..3f974a54fb --- /dev/null +++ b/src/vendor/winapi/src/um/timeapi.rs @@ -0,0 +1,21 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{DWORD, UINT}; +use um::mmsystem::{LPTIMECAPS, MMRESULT}; +extern "system" { + pub fn timeGetTime() -> DWORD; + pub fn timeGetDevCaps( + ptc: LPTIMECAPS, + cbtc: UINT, + ) -> MMRESULT; + pub fn timeBeginPeriod( + uPeriod: UINT, + ) -> MMRESULT; + pub fn timeEndPeriod( + uPeriod: UINT, + ) -> MMRESULT; +} diff --git a/src/vendor/winapi/src/um/timezoneapi.rs b/src/vendor/winapi/src/um/timezoneapi.rs new file mode 100644 index 0000000000..81b87c2d11 --- /dev/null +++ b/src/vendor/winapi/src/um/timezoneapi.rs @@ -0,0 +1,90 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! ApiSet Contract for api-ms-win-core-timezone-l1 +use shared::minwindef::{BOOL, DWORD, FILETIME, LPDWORD, LPFILETIME, USHORT}; +use um::minwinbase::{LPSYSTEMTIME, SYSTEMTIME}; +use um::winnt::{BOOLEAN, LONG, WCHAR}; +pub const TIME_ZONE_ID_INVALID: DWORD = 0xFFFFFFFF; +STRUCT!{struct TIME_ZONE_INFORMATION { + Bias: LONG, + StandardName: [WCHAR; 32], + StandardDate: SYSTEMTIME, + StandardBias: LONG, + DaylightName: [WCHAR; 32], + DaylightDate: SYSTEMTIME, + DaylightBias: LONG, +}} +pub type PTIME_ZONE_INFORMATION = *mut TIME_ZONE_INFORMATION; +pub type LPTIME_ZONE_INFORMATION = *mut TIME_ZONE_INFORMATION; +STRUCT!{struct DYNAMIC_TIME_ZONE_INFORMATION { + Bias: LONG, + StandardName: [WCHAR; 32], + StandardDate: SYSTEMTIME, + StandardBias: LONG, + DaylightName: [WCHAR; 32], + DaylightDate: SYSTEMTIME, + DaylightBias: LONG, + TimeZoneKeyName: [WCHAR; 128], + DynamicDaylightTimeDisabled: BOOLEAN, +}} +pub type PDYNAMIC_TIME_ZONE_INFORMATION = *mut DYNAMIC_TIME_ZONE_INFORMATION; +extern "system" { + pub fn SystemTimeToTzSpecificLocalTime( + lpTimeZoneInformation: *const TIME_ZONE_INFORMATION, + lpUniversalTime: *const SYSTEMTIME, + lpLocalTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn TzSpecificLocalTimeToSystemTime( + lpTimeZoneInformation: *const TIME_ZONE_INFORMATION, + lpLocalTime: *const SYSTEMTIME, + lpUniversalTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn FileTimeToSystemTime( + lpFileTime: *const FILETIME, + lpSystemTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn SystemTimeToFileTime( + lpSystemTime: *const SYSTEMTIME, + lpFileTime: LPFILETIME, + ) -> BOOL; + pub fn GetTimeZoneInformation( + lpTimeZoneInformation: LPTIME_ZONE_INFORMATION, + ) -> DWORD; + pub fn SetTimeZoneInformation( + lpTimeZoneInformation: *const TIME_ZONE_INFORMATION, + ) -> BOOL; + pub fn SetDynamicTimeZoneInformation( + lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, + ) -> BOOL; + pub fn GetDynamicTimeZoneInformation( + pTimeZoneInformation: PDYNAMIC_TIME_ZONE_INFORMATION, + ) -> DWORD; + pub fn GetTimeZoneInformationForYear( + wYear: USHORT, + pdtzi: PDYNAMIC_TIME_ZONE_INFORMATION, + ptzi: LPTIME_ZONE_INFORMATION, + ) -> BOOL; + pub fn EnumDynamicTimeZoneInformation( + dwIndex: DWORD, + lpTimeZoneInformation: PDYNAMIC_TIME_ZONE_INFORMATION, + ) -> DWORD; + pub fn GetDynamicTimeZoneInformationEffectiveYears( + lpTimeZoneInformation: PDYNAMIC_TIME_ZONE_INFORMATION, + FirstYear: LPDWORD, + LastYear: LPDWORD, + ) -> DWORD; + pub fn SystemTimeToTzSpecificLocalTimeEx( + lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, + lpUniversalTime: *const SYSTEMTIME, + lpLocalTime: LPSYSTEMTIME, + ) -> BOOL; + pub fn TzSpecificLocalTimeToSystemTimeEx( + lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, + lpLocalTime: *const SYSTEMTIME, + lpUniversalTime: LPSYSTEMTIME, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/tlhelp32.rs b/src/vendor/winapi/src/um/tlhelp32.rs new file mode 100644 index 0000000000..ea0e33585c --- /dev/null +++ b/src/vendor/winapi/src/um/tlhelp32.rs @@ -0,0 +1,195 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! WIN32 tool help functions, types, and definitions +use shared::basetsd::{SIZE_T, ULONG_PTR}; +use shared::minwindef::{BOOL, BYTE, DWORD, HMODULE, LPCVOID, LPVOID, MAX_PATH}; +use um::winnt::{CHAR, HANDLE, LONG, WCHAR}; +pub const MAX_MODULE_NAME32: usize = 255; +extern "system" { + pub fn CreateToolhelp32Snapshot( + dwFlags: DWORD, + th32ProcessID: DWORD, + ) -> HANDLE; +} +pub const TH32CS_SNAPHEAPLIST: DWORD = 0x00000001; +pub const TH32CS_SNAPPROCESS: DWORD = 0x00000002; +pub const TH32CS_SNAPTHREAD: DWORD = 0x00000004; +pub const TH32CS_SNAPMODULE: DWORD = 0x00000008; +pub const TH32CS_SNAPMODULE32: DWORD = 0x00000010; +pub const TH32CS_SNAPALL: DWORD = + (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE); +pub const TH32CS_INHERIT: DWORD = 0x80000000; +STRUCT!{struct HEAPLIST32 { + dwSize: SIZE_T, + th32ProcessID: DWORD, + th32HeapID: ULONG_PTR, + dwFlags: DWORD, +}} +pub type PHEAPLIST32 = *mut HEAPLIST32; +pub type LPHEAPLIST32 = *mut HEAPLIST32; +pub const HF32_DEFAULT: DWORD = 1; +pub const HF32_SHARED: DWORD = 2; +extern "system" { + pub fn Heap32ListFirst( + hSnapshot: HANDLE, + lphl: LPHEAPLIST32, + ) -> BOOL; + pub fn Heap32ListNext( + hSnapshot: HANDLE, + lphl: LPHEAPLIST32, + ) -> BOOL; +} +STRUCT!{struct HEAPENTRY32 { + dwSize: SIZE_T, + hHandle: HANDLE, + dwAddress: ULONG_PTR, + dwBlockSize: SIZE_T, + dwFlags: DWORD, + dwLockCount: DWORD, + dwResvd: DWORD, + th32ProcessID: DWORD, + th32HeapID: ULONG_PTR, +}} +pub type PHEAPENTRY32 = *mut HEAPENTRY32; +pub type LPHEAPENTRY32 = *mut HEAPENTRY32; +pub const LF32_FIXED: DWORD = 0x00000001; +pub const LF32_FREE: DWORD = 0x00000002; +pub const LF32_MOVEABLE: DWORD = 0x00000004; +extern "system" { + pub fn Heap32First( + lphe: LPHEAPENTRY32, + th32ProcessID: DWORD, + th32HeapID: ULONG_PTR, + ) -> BOOL; + pub fn Heap32Next( + lphe: LPHEAPENTRY32, + ) -> BOOL; + pub fn Toolhelp32ReadProcessMemory( + th32ProcessID: DWORD, + lpBaseAddress: LPCVOID, + lpBuffer: LPVOID, + cbRead: SIZE_T, + lpNumberOfBytesRead: *mut SIZE_T, + ) -> BOOL; +} +STRUCT!{struct PROCESSENTRY32W { + dwSize: DWORD, + cntUsage: DWORD, + th32ProcessID: DWORD, + th32DefaultHeapID: ULONG_PTR, + th32ModuleID: DWORD, + cntThreads: DWORD, + th32ParentProcessID: DWORD, + pcPriClassBase: LONG, + dwFlags: DWORD, + szExeFile: [WCHAR; MAX_PATH], +}} +pub type PPROCESSENTRY32W = *mut PROCESSENTRY32W; +pub type LPPROCESSENTRY32W = *mut PROCESSENTRY32W; +extern "system" { + pub fn Process32FirstW( + hSnapshot: HANDLE, + lppe: LPPROCESSENTRY32W, + ) -> BOOL; + pub fn Process32NextW( + hSnapshot: HANDLE, + lppe: LPPROCESSENTRY32W, + ) -> BOOL; +} +STRUCT!{struct PROCESSENTRY32 { + dwSize: DWORD, + cntUsage: DWORD, + th32ProcessID: DWORD, + th32DefaultHeapID: ULONG_PTR, + th32ModuleID: DWORD, + cntThreads: DWORD, + th32ParentProcessID: DWORD, + pcPriClassBase: LONG, + dwFlags: DWORD, + szExeFile: [CHAR; MAX_PATH], +}} +pub type PPROCESSENTRY32 = *mut PROCESSENTRY32; +pub type LPPROCESSENTRY32 = *mut PROCESSENTRY32; +extern "system" { + pub fn Process32First( + hSnapshot: HANDLE, + lppe: LPPROCESSENTRY32, + ) -> BOOL; + pub fn Process32Next( + hSnapshot: HANDLE, + lppe: LPPROCESSENTRY32, + ) -> BOOL; +} +STRUCT!{struct THREADENTRY32 { + dwSize: DWORD, + cntUsage: DWORD, + th32ThreadID: DWORD, + th32OwnerProcessID: DWORD, + tpBasePri: LONG, + tpDeltaPri: LONG, + dwFlags: DWORD, +}} +pub type PTHREADENTRY32 = *mut THREADENTRY32; +pub type LPTHREADENTRY32 = *mut THREADENTRY32; +extern "system" { + pub fn Thread32First( + hSnapshot: HANDLE, + lpte: LPTHREADENTRY32, + ) -> BOOL; + pub fn Thread32Next( + hSnapshot: HANDLE, + lpte: LPTHREADENTRY32, + ) -> BOOL; +} +STRUCT!{struct MODULEENTRY32W { + dwSize: DWORD, + th32ModuleID: DWORD, + th32ProcessID: DWORD, + GlblcntUsage: DWORD, + ProccntUsage: DWORD, + modBaseAddr: *mut BYTE, + modBaseSize: DWORD, + hModule: HMODULE, + szModule: [WCHAR; MAX_MODULE_NAME32 + 1], + szExePath: [WCHAR; MAX_PATH], +}} +pub type PMODULEENTRY32W = *mut MODULEENTRY32W; +pub type LPMODULEENTRY32W = *mut MODULEENTRY32W; +extern "system" { + pub fn Module32FirstW( + hSnapshot: HANDLE, + lpme: LPMODULEENTRY32W, + ) -> BOOL; + pub fn Module32NextW( + hSnapshot: HANDLE, + lpme: LPMODULEENTRY32W, + ) -> BOOL; +} +STRUCT!{struct MODULEENTRY32 { + dwSize: DWORD, + th32ModuleID: DWORD, + th32ProcessID: DWORD, + GlblcntUsage: DWORD, + ProccntUsage: DWORD, + modBaseAddr: *mut BYTE, + modBaseSize: DWORD, + hModule: HMODULE, + szModule: [CHAR; MAX_MODULE_NAME32 + 1], + szExePath: [CHAR; MAX_PATH], +}} +pub type PMODULEENTRY32 = *mut MODULEENTRY32; +pub type LPMODULEENTRY32 = *mut MODULEENTRY32; +extern "system" { + pub fn Module32First( + hSnapshot: HANDLE, + lpme: LPMODULEENTRY32, + ) -> BOOL; + pub fn Module32Next( + hSnapshot: HANDLE, + lpme: LPMODULEENTRY32, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/unknwnbase.rs b/src/vendor/winapi/src/um/unknwnbase.rs new file mode 100644 index 0000000000..24f4f6f231 --- /dev/null +++ b/src/vendor/winapi/src/um/unknwnbase.rs @@ -0,0 +1,44 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_void; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, ULONG}; +use um::winnt::HRESULT; +RIDL!{#[uuid(0x00000000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IUnknown(IUnknownVtbl) { + fn QueryInterface( + riid: REFIID, + ppvObject: *mut *mut c_void, + ) -> HRESULT, + fn AddRef() -> ULONG, + fn Release() -> ULONG, +}} +pub type LPUNKNOWN = *mut IUnknown; +RIDL!{#[uuid(0x000e0000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface AsyncIUnknown(AsyncIUnknownVtbl): IUnknown(IUnknownVtbl) { + fn Begin_QueryInterface( + riid: REFIID, + ) -> HRESULT, + fn Finish_QueryInterface( + ppvObject: *mut *mut c_void, + ) -> HRESULT, + fn Begin_AddRef() -> HRESULT, + fn Finish_AddRef() -> ULONG, + fn Begin_Release() -> HRESULT, + fn Finish_Release() -> ULONG, +}} +RIDL!{#[uuid(0x00000001, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IClassFactory(IClassFactoryVtbl): IUnknown(IUnknownVtbl) { + fn CreateInstance( + pUnkOuter: *mut IUnknown, + riid: REFIID, + ppvObject: *mut *mut c_void, + ) -> HRESULT, + fn LockServer( + fLock: BOOL, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/um/urlhist.rs b/src/vendor/winapi/src/um/urlhist.rs new file mode 100644 index 0000000000..3f601300e7 --- /dev/null +++ b/src/vendor/winapi/src/um/urlhist.rs @@ -0,0 +1,102 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Url History Interfaces +use ctypes::c_void; +use shared::guiddef::REFIID; +use shared::minwindef::{BOOL, DWORD, FILETIME, ULONG}; +use shared::wtypesbase::LPCOLESTR; +use um::docobj::{IOleCommandTarget, IOleCommandTargetVtbl}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPWSTR}; +pub const STATURL_QUERYFLAG_ISCACHED: DWORD = 0x00010000; +pub const STATURL_QUERYFLAG_NOURL: DWORD = 0x00020000; +pub const STATURL_QUERYFLAG_NOTITLE: DWORD = 0x00040000; +pub const STATURL_QUERYFLAG_TOPLEVEL: DWORD = 0x00080000; +pub const STATURLFLAG_ISCACHED: DWORD = 0x00000001; +pub const STATURLFLAG_ISTOPLEVEL: DWORD = 0x00000002; +ENUM!{enum ADDURL_FLAG { + ADDURL_FIRST = 0, + ADDURL_ADDTOHISTORYANDCACHE = 0, + ADDURL_ADDTOCACHE = 1, + ADDURL_Max = 2147483647, +}} +pub type LPENUMSTATURL = *mut IEnumSTATURL; +STRUCT!{struct STATURL { + cbSize: DWORD, + pwcsUrl: LPWSTR, + pwcsTitle: LPWSTR, + ftLastVisited: FILETIME, + ftLastUpdated: FILETIME, + ftExpires: FILETIME, + dwFlags: DWORD, +}} +pub type LPSTATURL = *mut STATURL; +RIDL!{ +#[uuid(0x3c374a42, 0xbae4, 0x11cf, 0xbf, 0x7d, 0x00, 0xaa, 0x00, 0x69, 0x46, 0xee)] +interface IEnumSTATURL(IEnumSTATURLVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + rgelt: LPSTATURL, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppenum: *mut *mut IEnumSTATURL, + ) -> HRESULT, + fn SetFilter( + poszFilter: LPCOLESTR, + dwFlags: DWORD, + ) -> HRESULT, +}} +pub type LPURLHISTORYSTG = *mut IUrlHistoryStg; +RIDL!{ +#[uuid(0x3c374a41, 0xbae4, 0x11cf, 0xbf, 0x7d, 0x00, 0xaa, 0x00, 0x69, 0x46, 0xee)] +interface IUrlHistoryStg(IUrlHistoryStgVtbl): IUnknown(IUnknownVtbl) { + fn AddUrl( + pocsUrl: LPCOLESTR, + ) -> HRESULT, + fn DeleteUrl( + pocsUrl: LPCOLESTR, + dwFlags: DWORD, + ) -> HRESULT, + fn QueryUrl( + pocsUrl: LPCOLESTR, + dwFlags: DWORD, + lpSTATURL: LPSTATURL, + ) -> HRESULT, + fn BindToObject( + pocsUrl: LPCOLESTR, + riid: REFIID, + ppvOut: *mut *mut c_void, + ) -> HRESULT, + fn EnumUrls( + ppEnum: *mut *mut IEnumSTATURL, + ) -> HRESULT, +}} +pub type LPURLHISTORYSTG2 = *mut IUrlHistoryStg2; +RIDL!{ +#[uuid(0xafa0dc11, 0xc313, 0x11d0, 0x83, 0x1a, 0x00, 0xc0, 0x4f, 0xd5, 0xae, 0x38)] +interface IUrlHistoryStg2(IUrlHistoryStg2Vtbl): IUrlHistoryStg(IUrlHistoryStgVtbl) { + fn AddUrlAndNotify( + pocsUrl: LPCOLESTR, + pocsTitle: LPCOLESTR, + dwFlags: DWORD, + fWriteHistory: BOOL, + poctNotify: *mut IOleCommandTarget, + punkISFolder: *mut IUnknown, + ) -> HRESULT, + fn ClearHistory() -> HRESULT, +}} +pub type LPURLHISTORYNOTIFY = *mut IUrlHistoryNotify; +RIDL!{ +#[uuid(0xbc40bec1, 0xc493, 0x11d0, 0x83, 0x1b, 0x00, 0xc0, 0x4f, 0xd5, 0xae, 0x38)] +interface IUrlHistoryNotify(IUrlHistoryNotifyVtbl): + IOleCommandTarget(IOleCommandTargetVtbl) {} +} diff --git a/src/vendor/winapi/src/um/urlmon.rs b/src/vendor/winapi/src/um/urlmon.rs new file mode 100644 index 0000000000..a05dc2a5f7 --- /dev/null +++ b/src/vendor/winapi/src/um/urlmon.rs @@ -0,0 +1,22 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! URL Moniker interfaces +use shared::minwindef::DWORD; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LPCWSTR}; +RIDL!(#[uuid(0x79eac9ee, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa, 0x00, 0x4b, 0xa9, 0x0b)] +interface IInternetSecurityManager(IInternetSecurityManagerVtbl): IUnknown(IUnknownVtbl) { + fn SetSecuritySite() -> HRESULT, + fn GetSecuritySite() -> HRESULT, + fn MapUrlToZone( + pwszUrl: LPCWSTR, + pdwZone: *mut DWORD, + dwFlags: DWORD, + ) -> HRESULT, + // TODO: the rest +}); +// TODO: the rest diff --git a/src/vendor/winapi/src/um/userenv.rs b/src/vendor/winapi/src/um/userenv.rs new file mode 100644 index 0000000000..fa15f440a3 --- /dev/null +++ b/src/vendor/winapi/src/um/userenv.rs @@ -0,0 +1,135 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Definitions for the user environment API +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID}; +use um::winnt::{HANDLE, HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR}; +extern "system" { + // pub fn LoadUserProfileA( + // hToken: HANDLE, + // lpProfileInfo: LPPROFILEINFOA, + // ) -> BOOL; + // pub fn LoadUserProfileW( + // hToken: HANDLE, + // lpProfileInfo: LPPROFILEINFOW, + // ) -> BOOL; + pub fn UnloadUserProfile( + hToken: HANDLE, + hProfile: HANDLE, + ) -> BOOL; + pub fn GetProfilesDirectoryA( + lpProfileDir: LPSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn GetProfilesDirectoryW( + lpProfileDir: LPWSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn GetProfileType( + dwFlags: *mut DWORD, + ) -> BOOL; + pub fn DeleteProfileA( + lpSidString: LPCSTR, + lpProfilePath: LPCSTR, + lpComputerName: LPCSTR, + ) -> BOOL; + pub fn DeleteProfileW( + lpSidString: LPCWSTR, + lpProfilePath: LPCWSTR, + lpComputerName: LPCWSTR, + ) -> BOOL; + pub fn CreateProfile( + pszUserSid: LPCWSTR, + pszUserName: LPCWSTR, + pszProfilePath: LPWSTR, + cchProfilePath: DWORD, + ) -> HRESULT; + pub fn GetDefaultUserProfileDirectoryA( + lpProfileDir: LPSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn GetDefaultUserProfileDirectoryW( + lpProfileDir: LPWSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn GetAllUsersProfileDirectoryA( + lpProfileDir: LPSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn GetAllUsersProfileDirectoryW( + lpProfileDir: LPWSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn GetUserProfileDirectoryA( + hToken: HANDLE, + lpProfileDir: LPSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn GetUserProfileDirectoryW( + hToken: HANDLE, + lpProfileDir: LPWSTR, + lpcchSize: LPDWORD, + ) -> BOOL; + pub fn CreateEnvironmentBlock( + lpEnvironment: *mut LPVOID, + hToken: HANDLE, + bInherit: BOOL, + ) -> BOOL; + pub fn DestroyEnvironmentBlock( + lpEnvironment: LPVOID, + ) -> BOOL; + pub fn ExpandEnvironmentStringsForUserA( + hToken: HANDLE, + lpSrc: LPCSTR, + lpDest: LPSTR, + dwSize: DWORD, + ) -> BOOL; + pub fn ExpandEnvironmentStringsForUserW( + hToken: HANDLE, + lpSrc: LPCWSTR, + lpDest: LPWSTR, + dwSize: DWORD, + ) -> BOOL; + pub fn RefreshPolicy( + bMachine: BOOL, + ) -> BOOL; + pub fn RefreshPolicyEx( + bMachine: BOOL, + dwOptions: DWORD, + ) -> BOOL; + pub fn EnterCriticalPolicySection( + bMachine: BOOL, + ) -> HANDLE; + pub fn LeaveCriticalPolicySection( + hSection: HANDLE, + ) -> BOOL; + pub fn RegisterGPNotification( + hEvent: HANDLE, + bMachine: BOOL, + ) -> BOOL; + pub fn UnregisterGPNotification( + hEvent: HANDLE, + ) -> BOOL; + // pub fn GetGPOListA(); + // pub fn GetGPOListW(); + // pub fn FreeGPOListA(); + // pub fn FreeGPOListW(); + // pub fn GetAppliedGPOListA(); + // pub fn GetAppliedGPOListW(); + // pub fn ProcessGroupPolicyCompleted(); + // pub fn ProcessGroupPolicyCompletedEx(); + // pub fn RsopAccessCheckByType(); + // pub fn RsopFileAccessCheck(); + // pub fn RsopSetPolicySettingStatus(); + // pub fn RsopResetPolicySettingStatus(); + // pub fn GenerateGPNotification(); + // pub fn CreateAppContainerProfile(); + // pub fn DeleteAppContainerProfile(); + // pub fn GetAppContainerRegistryLocation(); + // pub fn GetAppContainerFolderPath(); + // pub fn DeriveAppContainerSidFromAppContainerName(); + // pub fn DeriveRestrictedAppContainerSidFromAppContainerSidAndRestrictedName(); +} diff --git a/src/vendor/winapi/src/um/usp10.rs b/src/vendor/winapi/src/um/usp10.rs new file mode 100644 index 0000000000..70e06fbe15 --- /dev/null +++ b/src/vendor/winapi/src/um/usp10.rs @@ -0,0 +1,563 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Unicode Complex Script processor API declarations +use ctypes::{c_int, c_long, c_void}; +use shared::minwindef::{BOOL, BYTE, DWORD, UINT, ULONG, WORD}; +use shared::ntdef::LCID; +use shared::windef::{HDC, RECT, SIZE}; +use shared::winerror::{FACILITY_ITF, SEVERITY_ERROR}; +use um::wingdi::ABC; +use um::winnt::{HRESULT, LONG, WCHAR}; +pub const SCRIPT_UNDEFINED: WORD = 0; +pub const USP_E_SCRIPT_NOT_IN_FONT: HRESULT = MAKE_HRESULT!( + SEVERITY_ERROR, FACILITY_ITF, 0x200 +); +DECLARE_HANDLE!(SCRIPT_CACHE, SCRIPT_CACHE__); +extern "system" { + pub fn ScriptFreeCache( + psc: *mut SCRIPT_CACHE + ) -> HRESULT; +} +STRUCT!{struct SCRIPT_CONTROL { + bit_fields: DWORD, +}} +BITFIELD!(SCRIPT_CONTROL bit_fields: DWORD [ + uDefaultLanguage set_uDefaultLanguage[0..16], + fContextDigits set_fContextDigits[16..17], + fInvertPreBoundDir set_fInvertPreBoundDir[17..18], + fInvertPostBoundDir set_fInvertPostBoundDir[18..19], + fLinkStringBefore set_fLinkStringBefore[19..20], + fLinkStringAfter set_fLinkStringAfter[20..21], + fNeutralOverride set_fNeutralOverride[21..22], + fNumericOverride set_fNumericOverride[22..23], + fLegacyBidiClass set_fLegacyBidiClass[23..24], + fMergeNeutralItems set_fMergeNeutralItems[24..25], + fReserved set_fReserved[25..32], +]); +STRUCT!{struct SCRIPT_STATE { + bit_fields: WORD, +}} +BITFIELD!(SCRIPT_STATE bit_fields: WORD [ + uBidiLevel set_uBidiLevel[0..5], + fOverrideDirection set_fOverrideDirection[5..6], + fInhibitSymSwap set_fInhibitSymSwap[6..7], + fCharShape set_fCharShape[7..8], + fDigitSubstitute set_fDigitSubstitute[8..9], + fInhibitLigate set_fInhibitLigate[9..10], + fDisplayZWG set_fDisplayZWG[10..11], + fArabicNumContext set_fArabicNumContext[11..12], + fGcpClusters set_fGcpClusters[12..13], + fReserved set_fReserved[13..14], + fEngineReserved set_fEngineReserved[14..16], +]); +STRUCT!{struct SCRIPT_ANALYSIS { + bit_fields: WORD, + s: SCRIPT_STATE, +}} +BITFIELD!(SCRIPT_ANALYSIS bit_fields: WORD [ + eScript set_eScript[0..10], + fRTL set_fRTL[10..11], + fLayoutRTL set_fLayoutRTL[11..12], + fLinkBefore set_fLinkBefore[12..13], + fLinkAfter set_fLinkAfter[13..14], + fLogicalOrder set_fLogicalOrder[14..15], + fNoGlyphIndex set_fNoGlyphIndex[15..16], +]); +STRUCT!{struct SCRIPT_ITEM { + iCharPos: c_int, + a: SCRIPT_ANALYSIS, +}} +extern "system" { + pub fn ScriptItemize( + pwcInChars: *const WCHAR, + cInChars: c_int, + cMaxItems: c_int, + psControl: *const SCRIPT_CONTROL, + psState: *const SCRIPT_STATE, + pItems: *mut SCRIPT_ITEM, + pcItems: *mut c_int, + ) -> HRESULT; + pub fn ScriptLayout( + cRuns: c_int, + pbLevel: *const BYTE, + piVisualToLogical: *mut c_int, + piLogicalToVisual: *mut c_int, + ) -> HRESULT; +} +pub const SCRIPT_JUSTIFY_NONE: WORD = 0; +pub const SCRIPT_JUSTIFY_ARABIC_BLANK: WORD = 1; +pub const SCRIPT_JUSTIFY_CHARACTER: WORD = 2; +pub const SCRIPT_JUSTIFY_RESERVED1: WORD = 3; +pub const SCRIPT_JUSTIFY_BLANK: WORD = 4; +pub const SCRIPT_JUSTIFY_RESERVED2: WORD = 5; +pub const SCRIPT_JUSTIFY_RESERVED3: WORD = 6; +pub const SCRIPT_JUSTIFY_ARABIC_NORMAL: WORD = 7; +pub const SCRIPT_JUSTIFY_ARABIC_KASHIDA: WORD = 8; +pub const SCRIPT_JUSTIFY_ARABIC_ALEF: WORD = 9; +pub const SCRIPT_JUSTIFY_ARABIC_HA: WORD = 10; +pub const SCRIPT_JUSTIFY_ARABIC_RA: WORD = 11; +pub const SCRIPT_JUSTIFY_ARABIC_BA: WORD = 12; +pub const SCRIPT_JUSTIFY_ARABIC_BARA: WORD = 13; +pub const SCRIPT_JUSTIFY_ARABIC_SEEN: WORD = 14; +pub const SCRIPT_JUSTIFY_ARABIC_SEEN_M: WORD = 15; +STRUCT!{struct SCRIPT_VISATTR { + bit_fields: WORD, +}} +BITFIELD!(SCRIPT_VISATTR bit_fields: WORD [ + uJustification set_uJustification[0..4], + fClusterStart set_fClusterStart[4..5], + fDiacritic set_fDiacritic[5..6], + fZeroWidth set_fZeroWidth[6..7], + fReserved set_fReserved[7..8], + fShapeReserved set_fShapeReserved[8..16], +]); +extern "system" { + pub fn ScriptShape( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + pwcChars: *const WCHAR, + cChars: c_int, + cMaxGlyphs: c_int, + psa: *mut SCRIPT_ANALYSIS, + pwOutGlyphs: *mut WORD, + pwLogClust: *mut WORD, + psva: *mut SCRIPT_VISATTR, + pcGlyphs: *mut c_int, + ) -> HRESULT; +} +STRUCT!{struct GOFFSET { + du: LONG, + dv: LONG, +}} +extern "system" { + pub fn ScriptPlace( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + pwGlyphs: *const WORD, + cGlyphs: c_int, + psva: *const SCRIPT_VISATTR, + psa: *mut SCRIPT_ANALYSIS, + piAdvance: *mut c_int, + pGoffset: *mut GOFFSET, + pABC: *mut ABC, + ) -> HRESULT; + pub fn ScriptTextOut( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + x: c_int, + y: c_int, + fuOptions: UINT, + lprc: *const RECT, + psa: *const SCRIPT_ANALYSIS, + pwcReserved: *const WCHAR, + iReserved: c_int, + pwGlyphs: *const WORD, + cGlyphs: c_int, + piAdvance: *const c_int, + piJustify: *const c_int, + pGoffset: *const GOFFSET, + ) -> HRESULT; + pub fn ScriptJustify( + psva: *const SCRIPT_VISATTR, + piAdvance: *const c_int, + cGlyphs: c_int, + iDx: c_int, + iMinKashida: c_int, + piJustify: *mut c_int, + ) -> HRESULT; +} +STRUCT!{struct SCRIPT_LOGATTR { + bit_fields: BYTE, +}} +BITFIELD!(SCRIPT_LOGATTR bit_fields: BYTE [ + fSoftBreak set_fSoftBreak[0..1], + fWhiteSpace set_fWhiteSpace[1..2], + fCharStop set_fCharStop[2..3], + fWordStop set_fWordStop[3..4], + fInvalid set_fInvalid[4..5], + fReserved set_fReserved[5..8], +]); +extern "system" { + pub fn ScriptBreak( + pwcChars: *const WCHAR, + cChars: c_int, + psa: *const SCRIPT_ANALYSIS, + psla: *mut SCRIPT_LOGATTR, + ) -> HRESULT; + pub fn ScriptCPtoX( + iCP: c_int, + fTrailing: BOOL, + cChars: c_int, + cGlyphs: c_int, + pwLogClust: *const WORD, + psva: *const SCRIPT_VISATTR, + piAdvance: *const c_int, + psa: *const SCRIPT_ANALYSIS, + piX: *mut c_int, + ) -> HRESULT; + pub fn ScriptXtoCP( + iX: c_int, + cChars: c_int, + cGlyphs: c_int, + pwLogClust: *const WORD, + psva: *const SCRIPT_VISATTR, + piAdvance: *const c_int, + psa: *const SCRIPT_ANALYSIS, + piCP: *mut c_int, + piTrailing: *mut c_int, + ) -> HRESULT; + pub fn ScriptGetLogicalWidths( + psa: *const SCRIPT_ANALYSIS, + cChars: c_int, + cGlyphs: c_int, + piGlyphWidth: *const c_int, + pwLogClust: *const WORD, + psva: *const SCRIPT_VISATTR, + piDx: *mut c_int, + ) -> HRESULT; + pub fn ScriptApplyLogicalWidth( + piDx: *const c_int, + cChars: c_int, + cGlyphs: c_int, + pwLogClust: *const WORD, + psva: *const SCRIPT_VISATTR, + piAdvance: *const c_int, + psa: *const SCRIPT_ANALYSIS, + pABC: *mut ABC, + piJustify: *mut c_int, + ) -> HRESULT; +} +pub const SGCM_RTL: DWORD = 0x00000001; +extern "system" { + pub fn ScriptGetCMap( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + pwcInChars: *const WCHAR, + cChars: c_int, + dwFlags: DWORD, + pwOutGlyphs: *mut WORD, + ) -> HRESULT; + pub fn ScriptGetGlyphABCWidth( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + wGlyph: WORD, + pABC: *mut ABC, + ) -> HRESULT; +} +STRUCT!{struct SCRIPT_PROPERTIES { + bit_fields1: DWORD, + bit_fields2: DWORD, +}} +BITFIELD!(SCRIPT_PROPERTIES bit_fields1: DWORD [ + langid set_langid[0..16], + fNumeric set_fNumeric[16..17], + fComplex set_fComplex[17..18], + fNeedsWordBreaking set_fNeedsWordBreaking[18..19], + fNeedsCaretInfo set_fNeedsCaretInfo[19..20], + bCharSet set_bCharSet[20..28], + fControl set_fControl[28..29], + fPrivateUseArea set_fPrivateUseArea[29..30], + fNeedsCharacterJustify set_fNeedsCharacterJustify[30..31], + fInvalidGlyph set_fInvalidGlyph[31..32], +]); +BITFIELD!(SCRIPT_PROPERTIES bit_fields2: DWORD [ + fInvalidLogAttr set_fInvalidLogAttr[0..1], + fCDM set_fCDM[1..2], + fAmbiguousCharSet set_fAmbiguousCharSet[2..3], + fClusterSizeVaries set_fClusterSizeVaries[3..4], + fRejectInvalid set_fRejectInvalid[4..5], +]); +extern "system" { + pub fn ScriptGetProperties( + ppSp: *mut *mut *const SCRIPT_PROPERTIES, + piNumScripts: *mut c_int, + ) -> HRESULT; +} +STRUCT!{struct SCRIPT_FONTPROPERTIES { + cBytes: c_int, + wgBlank: WORD, + wgDefault: WORD, + wgInvalid: WORD, + wgKashida: WORD, + iKashidaWidth: c_int, +}} +extern "system" { + pub fn ScriptGetFontProperties( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + sfp: *mut SCRIPT_FONTPROPERTIES, + ) -> HRESULT; + pub fn ScriptCacheGetHeight( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + tmHeight: *mut c_long, + ) -> HRESULT; +} +pub const SSA_PASSWORD: DWORD = 0x00000001; +pub const SSA_TAB: DWORD = 0x00000002; +pub const SSA_CLIP: DWORD = 0x00000004; +pub const SSA_FIT: DWORD = 0x00000008; +pub const SSA_DZWG: DWORD = 0x00000010; +pub const SSA_FALLBACK: DWORD = 0x00000020; +pub const SSA_BREAK: DWORD = 0x00000040; +pub const SSA_GLYPHS: DWORD = 0x00000080; +pub const SSA_RTL: DWORD = 0x00000100; +pub const SSA_GCP: DWORD = 0x00000200; +pub const SSA_HOTKEY: DWORD = 0x00000400; +pub const SSA_METAFILE: DWORD = 0x00000800; +pub const SSA_LINK: DWORD = 0x00001000; +pub const SSA_HIDEHOTKEY: DWORD = 0x00002000; +pub const SSA_HOTKEYONLY: DWORD = 0x00002400; +pub const SSA_FULLMEASURE: DWORD = 0x04000000; +pub const SSA_LPKANSIFALLBACK: DWORD = 0x08000000; +pub const SSA_PIDX: DWORD = 0x10000000; +pub const SSA_LAYOUTRTL: DWORD = 0x20000000; +pub const SSA_DONTGLYPH: DWORD = 0x40000000; +pub const SSA_NOKASHIDA: DWORD = 0x80000000; +STRUCT!{struct SCRIPT_TABDEF { + cTabStops: c_int, + iScale: c_int, + pTabStops: *mut c_int, + iTabOrigin: c_int, +}} +DECLARE_HANDLE!(SCRIPT_STRING_ANALYSIS, SCRIPT_STRING_ANALYSIS__); +extern "system" { + pub fn ScriptStringAnalyse( + hdc: HDC, + pString: *const c_void, + cString: c_int, + cGlyphs: c_int, + iCharset: c_int, + dwFlags: DWORD, + iReqWidth: c_int, + psControl: *mut SCRIPT_CONTROL, + psState: *mut SCRIPT_STATE, + piDx: *const c_int, + pTabdef: *mut SCRIPT_TABDEF, + pbInClass: *const BYTE, + pssa: *mut SCRIPT_STRING_ANALYSIS, + ) -> HRESULT; + pub fn ScriptStringFree( + pssa: *mut SCRIPT_STRING_ANALYSIS + ) -> HRESULT; + pub fn ScriptString_pSize( + ssa: SCRIPT_STRING_ANALYSIS + ) -> *const SIZE; + pub fn ScriptString_pcOutChars( + ssa: SCRIPT_STRING_ANALYSIS + ) -> *const c_int; + pub fn ScriptString_pLogAttr( + ssa: SCRIPT_STRING_ANALYSIS + ) -> *const SCRIPT_LOGATTR; + pub fn ScriptStringGetOrder( + ssa: SCRIPT_STRING_ANALYSIS, + puOrder: *mut UINT + ) -> HRESULT; + pub fn ScriptStringCPtoX( + ssa: SCRIPT_STRING_ANALYSIS, + icp: c_int, + fTrailing: BOOL, + pX: *mut c_int, + ) -> HRESULT; + pub fn ScriptStringXtoCP( + ssa: SCRIPT_STRING_ANALYSIS, + iX: c_int, + piCh: *mut c_int, + piTrailing: *mut c_int, + ) -> HRESULT; + pub fn ScriptStringGetLogicalWidths( + ssa: SCRIPT_STRING_ANALYSIS, + dpiDx: *mut c_int + ) -> HRESULT; + pub fn ScriptStringValidate( + ssa: SCRIPT_STRING_ANALYSIS + ) -> HRESULT; + pub fn ScriptStringOut( + ssa: SCRIPT_STRING_ANALYSIS, + iX: c_int, + iY: c_int, + uOptions: UINT, + prc: *const RECT, + iMinSel: c_int, + iMaxSel: c_int, + fDisabled: BOOL, + ) -> HRESULT; +} +pub const SIC_COMPLEX: DWORD = 1; +pub const SIC_ASCIIDIGIT: DWORD = 2; +pub const SIC_NEUTRAL: DWORD = 4; +extern "system" { + pub fn ScriptIsComplex( + pwcInChars: *const WCHAR, + cInChars: c_int, + dwFlags: DWORD + ) -> HRESULT; +} +STRUCT!{struct SCRIPT_DIGITSUBSTITUTE { + bit_fields1: DWORD, + bit_fields2: DWORD, + dwReserved: DWORD, +}} +BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields1: DWORD [ + NationalDigitLanguage set_NationalDigitLanguage[0..16], + TraditionalDigitLanguage set_TraditionalDigitLanguage[16..32], +]); +BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields2: DWORD [ + DigitSubstitute set_DigitSubstitute[0..8], +]); +extern "system" { + pub fn ScriptRecordDigitSubstitution( + Locale: LCID, + psds: *mut SCRIPT_DIGITSUBSTITUTE, + ) -> HRESULT; +} +pub const SCRIPT_DIGITSUBSTITUTE_CONTEXT: BYTE = 0; +pub const SCRIPT_DIGITSUBSTITUTE_NONE: BYTE = 1; +pub const SCRIPT_DIGITSUBSTITUTE_NATIONAL: BYTE = 2; +pub const SCRIPT_DIGITSUBSTITUTE_TRADITIONAL: BYTE = 3; +extern "system" { + pub fn ScriptApplyDigitSubstitution( + psds: *const SCRIPT_DIGITSUBSTITUTE, + psc: *mut SCRIPT_CONTROL, + pss: *mut SCRIPT_STATE, + ) -> HRESULT; +} +pub type OPENTYPE_TAG = ULONG; +pub const SCRIPT_TAG_UNKNOWN: OPENTYPE_TAG = 0x00000000; +STRUCT!{struct OPENTYPE_FEATURE_RECORD { + tagFeature: OPENTYPE_TAG, + lParameter: LONG, +}} +STRUCT!{struct TEXTRANGE_PROPERTIES { + potfRecords: *mut OPENTYPE_FEATURE_RECORD, + cotfRecords: c_int, +}} +STRUCT!{struct SCRIPT_CHARPROP { + bit_fields: WORD, +}} +BITFIELD!(SCRIPT_CHARPROP bit_fields: WORD [ + fCanGlyphAlone set_fCanGlyphAlone[0..1], + reserved set_reserved[1..16], +]); +STRUCT!{struct SCRIPT_GLYPHPROP { + sva: SCRIPT_VISATTR, + reserved: WORD, +}} +extern "system" { + pub fn ScriptShapeOpenType( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + tagScript: OPENTYPE_TAG, + tagLangSys: OPENTYPE_TAG, + rcRangeChars: *mut c_int, + rpRangeProperties: *mut *mut TEXTRANGE_PROPERTIES, + cRanges: c_int, + pwcChars: *const WCHAR, + cChars: c_int, + cMaxGlyphs: c_int, + pwLogClust: *mut WORD, + pCharProps: *mut SCRIPT_CHARPROP, + pwOutGlyphs: *mut WORD, + pOutGlyphProps: *mut SCRIPT_GLYPHPROP, + pcGlyphs: *mut c_int, + ) -> HRESULT; + pub fn ScriptPlaceOpenType( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + tagScript: OPENTYPE_TAG, + tagLangSys: OPENTYPE_TAG, + rcRangeChars: *mut c_int, + rpRangeProperties: *mut *mut TEXTRANGE_PROPERTIES, + cRanges: c_int, + pwcChars: *const WCHAR, + pwLogClust: *mut WORD, + pCharProps: *mut SCRIPT_CHARPROP, + cChars: c_int, + pwGlyphs: *const WORD, + pGlyphProps: *const SCRIPT_GLYPHPROP, + cGlyphs: c_int, + piAdvance: *mut c_int, + pGoffset: *mut GOFFSET, + pABC: *mut ABC, + ) -> HRESULT; + pub fn ScriptItemizeOpenType( + pwcInChars: *const WCHAR, + cInChars: c_int, + cMaxItems: c_int, + psControl: *const SCRIPT_CONTROL, + psState: *const SCRIPT_STATE, + pItems: *mut SCRIPT_ITEM, + pScriptTags: *mut OPENTYPE_TAG, + pcItems: *mut c_int, + ) -> HRESULT; + pub fn ScriptGetFontScriptTags( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + cMaxTags: c_int, + pScriptTags: *mut OPENTYPE_TAG, + pcTags: *mut c_int, + ) -> HRESULT; + pub fn ScriptGetFontLanguageTags( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + tagScript: OPENTYPE_TAG, + cMaxTags: c_int, + pLangsysTags: *mut OPENTYPE_TAG, + pcTags: *mut c_int, + ) -> HRESULT; + pub fn ScriptGetFontFeatureTags( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + tagScript: OPENTYPE_TAG, + tagLangSys: OPENTYPE_TAG, + cMaxTags: c_int, + pFeatureTags: *mut OPENTYPE_TAG, + pcTags: *mut c_int, + ) -> HRESULT; + pub fn ScriptGetFontAlternateGlyphs( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + tagScript: OPENTYPE_TAG, + tagLangSys: OPENTYPE_TAG, + tagFeature: OPENTYPE_TAG, + wGlyphId: WORD, + cMaxAlternates: c_int, + pAlternateGlyphs: *mut WORD, + pcAlternates: *mut c_int, + ) -> HRESULT; + pub fn ScriptSubstituteSingleGlyph( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + tagScript: OPENTYPE_TAG, + tagLangSys: OPENTYPE_TAG, + tagFeature: OPENTYPE_TAG, + lParameter: LONG, + wGlyphId: WORD, + pwOutGlyphId: *mut WORD, + ) -> HRESULT; + pub fn ScriptPositionSingleGlyph( + hdc: HDC, + psc: *mut SCRIPT_CACHE, + psa: *mut SCRIPT_ANALYSIS, + tagScript: OPENTYPE_TAG, + tagLangSys: OPENTYPE_TAG, + tagFeature: OPENTYPE_TAG, + lParameter: LONG, + wGlyphId: WORD, + iAdvance: c_int, + GOffset: GOFFSET, + piOutAdvance: *mut c_int, + pOutGoffset: *mut GOFFSET, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/utilapiset.rs b/src/vendor/winapi/src/um/utilapiset.rs new file mode 100644 index 0000000000..cc588801b5 --- /dev/null +++ b/src/vendor/winapi/src/um/utilapiset.rs @@ -0,0 +1,26 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, DWORD}; +use shared::ntdef::PVOID; +extern "system" { + pub fn EncodePointer( + Ptr: PVOID, + ) -> PVOID; + pub fn DecodePointer( + Ptr: PVOID, + ) -> PVOID; + pub fn EncodeSystemPointer( + Ptr: PVOID, + ) -> PVOID; + pub fn DecodeSystemPointer( + Ptr: PVOID, + ) -> PVOID; + pub fn Beep( + dwFreq: DWORD, + dwDuration: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/vsbackup.rs b/src/vendor/winapi/src/um/vsbackup.rs new file mode 100644 index 0000000000..cefda393c9 --- /dev/null +++ b/src/vendor/winapi/src/um/vsbackup.rs @@ -0,0 +1,539 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Declaration of backup interfaces. +use ctypes::c_void; +use shared::guiddef::IID; +use shared::minwindef::{BOOL, BYTE, DWORD, UINT}; +use shared::wtypes::BSTR; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::vss::{ + IVssAsync, IVssEnumObject, VSS_BACKUP_TYPE, VSS_ID, VSS_OBJECT_TYPE, VSS_PWSZ, + VSS_RESTORE_TYPE, VSS_ROLLFORWARD_TYPE, VSS_SNAPSHOT_PROP, VSS_WRITER_STATE +}; +use um::vswriter::{ + IVssWMDependency, IVssWMFiledesc, IVssWriterComponentsVtbl, VSS_COMPONENT_TYPE, + VSS_FILE_RESTORE_STATUS, VSS_RESTOREMETHOD_ENUM, VSS_SOURCE_TYPE, VSS_USAGE_TYPE, + VSS_WRITERRESTORE_ENUM +}; +use um::winnt::{HRESULT, LONG, LPCWSTR}; +DEFINE_GUID!(IID_IVssExamineWriterMetadata, + 0x902fcf7f, 0xb7fd, 0x42f8, 0x81, 0xf1, 0xb2, 0xe4, 0x00, 0xb1, 0xe5, 0xbd); +DEFINE_GUID!(IID_IVssExamineWriterMetadataEx, + 0x0c0e5ec0, 0xca44, 0x472b, 0xb7, 0x02, 0xe6, 0x52, 0xdb, 0x1c, 0x04, 0x51); +DEFINE_GUID!(IID_IVssBackupComponents, + 0x665c1d5f, 0xc218, 0x414d, 0xa0, 0x5d, 0x7f, 0xef, 0x5f, 0x9d, 0x5c, 0x86); +DEFINE_GUID!(IID_IVssBackupComponentsEx, + 0x963f03ad, 0x9e4c, 0x4a34, 0xac, 0x15, 0xe4, 0xb6, 0x17, 0x4e, 0x50, 0x36); +STRUCT!{struct VSS_COMPONENTINFO { + type_: VSS_COMPONENT_TYPE, // type is a keyword in rust + bstrLogicalPath: BSTR, + bstrComponentName: BSTR, + bstrCaption: BSTR, + pbIcon: *mut BYTE, + cbIcon: UINT, + bRestoreMetadata: bool, + bNotifyOnBackupComplete: bool, + bSelectable: bool, + bSelectableForRestore: bool, + dwComponentFlags: DWORD, + cFileCount: UINT, + cDatabases: UINT, + cLogFiles: UINT, + cDependencies: UINT, +}} +pub type PVSSCOMPONENTINFO = *const VSS_COMPONENTINFO; +RIDL!( +#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] +interface IVssWMComponent(IVssWMComponentVtbl): IUnknown(IUnknownVtbl) { + fn GetComponentInfo( + ppInfo: *mut PVSSCOMPONENTINFO, + ) -> HRESULT, + fn FreeComponentInfo( + pInfo: PVSSCOMPONENTINFO, + ) -> HRESULT, + fn GetFile( + iFile: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn GetDatabaseFile( + iDBFile: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn GetDatabaseLogFile( + iDbLogFile: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn GetDependency( + iDependency: UINT, + ppDependency: *mut *mut IVssWMDependency, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x902fcf7f, 0xb7fd, 0x42f8, 0x81, 0xf1, 0xb2, 0xe4, 0x00, 0xb1, 0xe5, 0xbd)] +interface IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl): IUnknown(IUnknownVtbl) { + fn GetIdentity( + pidInstance: *mut VSS_ID, + pidWriter: *mut VSS_ID, + pbstrWriterName: *mut BSTR, + pUsage: *mut VSS_USAGE_TYPE, + pSource: *mut VSS_SOURCE_TYPE, + ) -> HRESULT, + fn GetFileCounts( + pcIncludeFiles: *mut UINT, + pcExcludeFiles: *mut UINT, + pcComponents: *mut UINT, + ) -> HRESULT, + fn GetIncludeFile( + iFile: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn GetExcludeFile( + iFile: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn GetComponent( + iComponent: UINT, + ppComponent: *mut *mut IVssWMComponent, + ) -> HRESULT, + fn GetRestoreMethod( + pMethod: *mut VSS_RESTOREMETHOD_ENUM, + pbstrService: *mut BSTR, + pbstrUserProcedure: *mut BSTR, + pwriterRestore: *mut VSS_WRITERRESTORE_ENUM, + pbRebootRequired: *mut bool, + pcMappings: *mut UINT, + ) -> HRESULT, + fn GetAlternateLocationMapping( + iMapping: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn GetBackupSchema( + pdwSchemaMask: *mut DWORD, + ) -> HRESULT, + fn GetDocument( + pDoc: *mut c_void, + ) -> HRESULT, //TODO IXMLDOMDocument, + fn SaveAsXML( + pbstrXML: *mut BSTR, + ) -> HRESULT, + fn LoadFromXML( + pbstrXML: *mut BSTR, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x0c0e5ec0, 0xca44, 0x472b, 0xb7, 0x02, 0xe6, 0x52, 0xdb, 0x1c, 0x04, 0x51)] +interface IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl): + IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl) { + fn GetIdentityEx( + pidInstance: *mut VSS_ID, + pidWriter: *mut VSS_ID, + pbstrWriterName: *mut BSTR, + pbstrInstanceName: *mut BSTR, + pUsage: *mut VSS_USAGE_TYPE, + pSource: *mut VSS_SOURCE_TYPE, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0xce115780, 0xa611, 0x431b, 0xb5, 0x7f, 0xc3, 0x83, 0x03, 0xab, 0x6a, 0xee)] +interface IVssExamineWriterMetadataEx2(IVssExamineWriterMetadataEx2Vtbl): + IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl) { + fn GetVersion( + pdwMajorVersion: *mut DWORD, + pdwMinorVersion: *mut DWORD, + ) -> HRESULT, + fn GetExcludeFromSnapshotCount( + pcExcludedFromSnapshot: *mut UINT, + ) -> HRESULT, + fn GetExcludeFromSnapshotFile( + iFile: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, +} +); +#[repr(C)] +pub struct IVssWriterComponentsExt { + pub lpVtbl: *const IVssWriterComponentsExtVtbl, +} +#[repr(C)] +pub struct IVssWriterComponentsExtVtbl { + pub parent1: IVssWriterComponentsVtbl, + pub parent2: IUnknownVtbl, +} +RIDL!( +#[uuid(0x665c1d5f, 0xc218, 0x414d, 0xa0, 0x5d, 0x7f, 0xef, 0x5f, 0x9d, 0x5c, 0x86)] +interface IVssBackupComponents(IVssBackupComponentsVtbl): IUnknown(IUnknownVtbl) { + fn GetWriterComponentsCount( + pcComponents: *mut UINT, + ) -> HRESULT, + fn GetWriterComponents( + iWriter: UINT, + ppWriter: *mut *mut IVssWriterComponentsExt, + ) -> HRESULT, + fn InitializeForBackup( + bstrXML: BSTR, + ) -> HRESULT, + fn SetBackupState( + bSelectComponents: bool, + bBackupBootableSystemState: bool, + backupType: VSS_BACKUP_TYPE, + bPartialFileSupport: bool, + ) -> HRESULT, + fn InitializeForRestore( + bstrXML: BSTR, + ) -> HRESULT, + fn SetRestoreState( + restoreType: VSS_RESTORE_TYPE, + ) -> HRESULT, + fn GatherWriterMetadata( + pAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn GetWriterMetadataCount( + pcWriters: *mut UINT, + ) -> HRESULT, + fn GetWriterMetadata( + iWriter: UINT, + pidInstance: *mut VSS_ID, + ppMetadata: *mut *mut IVssExamineWriterMetadata, + ) -> HRESULT, + fn FreeWriterMetadata() -> HRESULT, + fn AddComponent( + instanceId: VSS_ID, + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + ) -> HRESULT, + fn PrepareForBackup( + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn AbortBackup() -> HRESULT, + fn GatherWriterStatus( + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn GetWriterStatusCount( + pcWriters: *mut UINT, + ) -> HRESULT, + fn FreeWriterStatus() -> HRESULT, + fn GetWriterStatus( + iWriter: UINT, + pidInstance: *mut VSS_ID, + pidWriter: *mut VSS_ID, + pbstrWriter: *mut BSTR, + pnStatus: *mut VSS_WRITER_STATE, + phResultFailure: *mut HRESULT, + ) -> HRESULT, + fn SetBackupSucceeded( + instanceId: VSS_ID, + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + bSucceded: bool, + ) -> HRESULT, + fn SetBackupOptions( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszBackupOptions: LPCWSTR, + ) -> HRESULT, + fn SetSelectedForRestore( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + bSelectedForRestore: bool, + ) -> HRESULT, + fn SetRestoreOptions( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszRestoreOptions: LPCWSTR, + ) -> HRESULT, + fn SetAdditionalRestores( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + bAdditionalRestores: bool, + ) -> HRESULT, + fn SetPreviousBackupStamp( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszPreviousBackupStamp: LPCWSTR, + ) -> HRESULT, + fn SaveAsXML( + pbstrXML: *mut BSTR, + ) -> HRESULT, + fn BackupComplete( + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn AddAlternativeLocationMapping( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + bRecursive: bool, + wszDestination: LPCWSTR, + ) -> HRESULT, + fn AddRestoreSubcomponent( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszSubComponentLogicalPath: LPCWSTR, + wszSubComponentName: LPCWSTR, + bRepair: bool, + ) -> HRESULT, + fn SetFileRestoreStatus( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + status: VSS_FILE_RESTORE_STATUS, + ) -> HRESULT, + fn AddNewTarget( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszPath: LPCWSTR, + wszFileName: LPCWSTR, + bRecursive: bool, + wszAlternatePath: LPCWSTR, + ) -> HRESULT, + fn SetRangesFilePath( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + iPartialFile: UINT, + wszRangesFile: LPCWSTR, + ) -> HRESULT, + fn PreRestore( + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn PostRestore( + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn SetContext( + lContext: LONG, + ) -> HRESULT, + fn StartSnapshotSet( + pSnapshotSetId: *mut VSS_ID, + ) -> HRESULT, + fn AddToSnapshotSet( + pwszVolumeName: VSS_PWSZ, + ProviderId: VSS_ID, + pidSnapshot: *mut VSS_ID, + ) -> HRESULT, + fn DoSnapshotSet( + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn DeleteSnapshots( + SourceObjectId: VSS_ID, + eSourceObjectType: VSS_OBJECT_TYPE, + bForceDelete: BOOL, + plDeletedSnapshots: *mut LONG, + pNondeletedSnapshotID: *mut VSS_ID, + ) -> HRESULT, + fn ImportSnapshots( + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn BreakSnapshotSet( + SnapshotSetId: VSS_ID, + ) -> HRESULT, + fn GetSnapshotProperties( + SnapshotId: VSS_ID, + pProp: *mut VSS_SNAPSHOT_PROP, + ) -> HRESULT, + fn Query( + QueriedObjectId: VSS_ID, + eQueriedObjectType: VSS_OBJECT_TYPE, + eReturnedObjectsType: VSS_OBJECT_TYPE, + ppEnum: *mut *mut IVssEnumObject, + ) -> HRESULT, + fn IsVolumeSupported( + ProviderId: VSS_ID, + pwszVolumeName: VSS_PWSZ, + pbSupportedByThisProvider: *mut BOOL, + ) -> HRESULT, + fn DisableWriterClasses( + rgWriterClassId: *const VSS_ID, + cClassId: UINT, + ) -> HRESULT, + fn EnableWriterClasses( + rgWriterClassId: *const VSS_ID, + cClassId: UINT, + ) -> HRESULT, + fn DisableWriterInstances( + rgWriterInstanceId: *const VSS_ID, + cInstanceId: UINT, + ) -> HRESULT, + fn ExposeSnapshot( + SnapshotId: VSS_ID, + wszPathFromRoot: VSS_PWSZ, + lAttributes: LONG, + wszExpose: VSS_PWSZ, + pwszExposed: VSS_PWSZ, + ) -> HRESULT, + fn RevertToSnapshot( + SnapshotId: VSS_ID, + bForceDismount: BOOL, + ) -> HRESULT, + fn QueryRevertStatus( + pwszVolume: VSS_PWSZ, + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x963f03ad, 0x9e4c, 0x4a34, 0xac, 0x15, 0xe4, 0xb6, 0x17, 0x4e, 0x50, 0x36)] +interface IVssBackupComponentsEx(IVssBackupComponentsExVtbl): + IVssBackupComponents(IVssBackupComponentsVtbl) { + fn GetWriterMetadataEx( + iWriter: UINT, + pidInstance: *mut VSS_ID, + ppMetadata: *mut *mut IVssExamineWriterMetadataEx, + ) -> HRESULT, + fn SetSelectedForRestoreEx( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + bSelectedForRestore: bool, + instanceId: VSS_ID, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0xacfe2b3a, 0x22c9, 0x4ef8, 0xbd, 0x03, 0x2f, 0x9c, 0xa2, 0x30, 0x08, 0x4e)] +interface IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl): + IVssBackupComponentsEx(IVssBackupComponentsExVtbl) { + fn UnexposeSnapshot( + snapshotId: VSS_ID, + ) -> HRESULT, + fn SetAuthoritativeRestore( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + bAuth: bool, + ) -> HRESULT, + fn SetRollForward( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + rollType: VSS_ROLLFORWARD_TYPE, + wszRollForwardPoint: LPCWSTR, + ) -> HRESULT, + fn SetRestoreName( + writerId: VSS_ID, + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszRestoreName: LPCWSTR, + ) -> HRESULT, + fn BreakSnapshotSetEx( + SnapshotSetID: VSS_ID, + dwBreakFlags: DWORD, + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn PreFastRecovery( + SnapshotSetID: VSS_ID, + dwPreFastRecoveryFlags: DWORD, + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn FastRecovery( + SnapshotSetID: VSS_ID, + dwFastRecoveryFlags: DWORD, + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0xc191bfbc, 0xb602, 0x4675, 0x8b, 0xd1, 0x67, 0xd6, 0x42, 0xf5, 0x29, 0xd5)] +interface IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl): + IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl) { + fn GetWriterStatusEx( + iWriter: UINT, + pidInstance: *mut VSS_ID, + pidWriter: *mut VSS_ID, + pbstrWriter: *mut BSTR, + pnStatus: *mut VSS_WRITER_STATE, + phrFailureWriter: *mut HRESULT, + phrApplication: *mut HRESULT, + pbstrApplicationMessage: *mut BSTR, + ) -> HRESULT, + fn AddSnapshotToRecoverySet( + snapshotId: VSS_ID, + dwFlags: DWORD, + pwszDestinationVolume: VSS_PWSZ, + ) -> HRESULT, + fn RecoverSet( + dwFlags: DWORD, + ppAsync: *mut *mut IVssAsync, + ) -> HRESULT, + fn GetSessionId( + idSession: *mut VSS_ID, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0xf434c2fd, 0xb553, 0x4961, 0xa9, 0xf9, 0xa8, 0xe9, 0x0b, 0x67, 0x3e, 0x53)] +interface IVssBackupComponentsEx4(IVssBackupComponentsEx4Vtbl): + IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl) { + fn GetRootAndLogicalPrefixPaths( + pwszFilePath: VSS_PWSZ, + ppwszRootPath: *mut VSS_PWSZ, + ppwszLogicalPrefix: *mut VSS_PWSZ, + bNormalizeFQDNforRootPath: BOOL, + ) -> HRESULT, +} +); +pub const VSS_SW_BOOTABLE_STATE: DWORD = 1; +extern "system" { + #[link_name="CreateVssBackupComponentsInternal"] + pub fn CreateVssBackupComponents( + ppBackup: *mut *mut IVssBackupComponents, + ) -> HRESULT; + #[link_name="CreateVssExamineWriterMetadataInternal"] + pub fn CreateVssExamineWriterMetadata( + bstrXML: BSTR, + ppMetadata: *mut *mut IVssExamineWriterMetadata, + ) -> HRESULT; + #[link_name="IsVolumeSnapshottedInternal"] + pub fn IsVolumeSnapshotted( + pwszVolumeName: VSS_PWSZ, + pbSnapshotsPresent: *mut BOOL, + plSnapshotCapability: *mut LONG, + ) -> HRESULT; + #[link_name="VssFreeSnapshotPropertiesInternal"] + pub fn VssFreeSnapshotProperties( + pProp: *mut VSS_SNAPSHOT_PROP, + ); + #[link_name="GetProviderMgmtInterfaceInternal"] + pub fn GetProviderMgmtInterface( + ProviderId: VSS_ID, + InterfaceId: IID, + ppItf: *mut *mut IUnknown, + ) -> HRESULT; + #[link_name="ShouldBlockRevertInternal"] + pub fn ShouldBlockRevert( + wszVolumeName: LPCWSTR, + pbBlock: *mut bool, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/vss.rs b/src/vendor/winapi/src/um/vss.rs new file mode 100644 index 0000000000..35ec91bbb9 --- /dev/null +++ b/src/vendor/winapi/src/um/vss.rs @@ -0,0 +1,291 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! VSS header file + +use shared::guiddef::{CLSID, GUID}; +use shared::minwindef::{DWORD, INT, ULONG}; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HRESULT, LONG, LONGLONG, WCHAR}; + +ENUM!{enum VSS_OBJECT_TYPE { + VSS_OBJECT_UNKNOWN = 0, + VSS_OBJECT_NONE = 1, + VSS_OBJECT_SNAPSHOT_SET = 2, + VSS_OBJECT_SNAPSHOT = 3, + VSS_OBJECT_PROVIDER = 4, + VSS_OBJECT_TYPE_COUNT = 5, +}} +pub type PVSS_OBJECT_TYPE = *mut VSS_OBJECT_TYPE; +ENUM!{enum VSS_SNAPSHOT_STATE { + VSS_SS_UNKNOWN = 0x00, + VSS_SS_PREPARING = 0x01, + VSS_SS_PROCESSING_PREPARE = 0x02, + VSS_SS_PREPARED = 0x03, + VSS_SS_PROCESSING_PRECOMMIT = 0x04, + VSS_SS_PRECOMMITTED = 0x05, + VSS_SS_PROCESSING_COMMIT = 0x06, + VSS_SS_COMMITTED = 0x07, + VSS_SS_PROCESSING_POSTCOMMIT = 0x08, + VSS_SS_PROCESSING_PREFINALCOMMIT = 0x09, + VSS_SS_PREFINALCOMMITTED = 0x0a, + VSS_SS_PROCESSING_POSTFINALCOMMIT = 0x0b, + VSS_SS_CREATED = 0x0c, + VSS_SS_ABORTED = 0x0d, + VSS_SS_DELETED = 0x0e, + VSS_SS_POSTCOMMITTED = 0x0f, + VSS_SS_COUNT = 0x10, +}} +pub type PVSS_SNAPSHOT_STATE = *mut VSS_SNAPSHOT_STATE; +ENUM!{enum VSS_VOLUME_SNAPSHOT_ATTRIBUTES { + VSS_VOLSNAP_ATTR_PERSISTENT = 0x00000001, + VSS_VOLSNAP_ATTR_NO_AUTORECOVERY = 0x00000002, + VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE = 0x00000004, + VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE = 0x00000008, + VSS_VOLSNAP_ATTR_NO_WRITERS = 0x00000010, + VSS_VOLSNAP_ATTR_TRANSPORTABLE = 0x00000020, + VSS_VOLSNAP_ATTR_NOT_SURFACED = 0x00000040, + VSS_VOLSNAP_ATTR_NOT_TRANSACTED = 0x00000080, + VSS_VOLSNAP_ATTR_HARDWARE_ASSISTED = 0x00010000, + VSS_VOLSNAP_ATTR_DIFFERENTIAL = 0x00020000, + VSS_VOLSNAP_ATTR_PLEX = 0x00040000, + VSS_VOLSNAP_ATTR_IMPORTED = 0x00080000, + VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY = 0x00100000, + VSS_VOLSNAP_ATTR_EXPOSED_REMOTELY = 0x00200000, + VSS_VOLSNAP_ATTR_AUTORECOVER = 0x00400000, + VSS_VOLSNAP_ATTR_ROLLBACK_RECOVERY = 0x00800000, + VSS_VOLSNAP_ATTR_DELAYED_POSTSNAPSHOT = 0x01000000, + VSS_VOLSNAP_ATTR_TXF_RECOVERY = 0x02000000, + VSS_VOLSNAP_ATTR_FILE_SHARE = 0x04000000, +}} +pub type PVSS_VOLUME_SNAPSHOT_ATTRIBUTES = *mut VSS_VOLUME_SNAPSHOT_ATTRIBUTES; +ENUM!{enum VSS_SNAPSHOT_CONTEXT { + VSS_CTX_BACKUP = 0, + VSS_CTX_FILE_SHARE_BACKUP = VSS_VOLSNAP_ATTR_NO_WRITERS, + VSS_CTX_NAS_ROLLBACK = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE | VSS_VOLSNAP_ATTR_NO_WRITERS, + VSS_CTX_APP_ROLLBACK = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE, + VSS_CTX_CLIENT_ACCESSIBLE = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE + | VSS_VOLSNAP_ATTR_NO_WRITERS, + VSS_CTX_CLIENT_ACCESSIBLE_WRITERS = VSS_VOLSNAP_ATTR_PERSISTENT + | VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE, + VSS_CTX_ALL = 0xffffffff, +}} +pub type PVSS_SNAPSHOT_CONTEXT = *mut VSS_SNAPSHOT_CONTEXT; +ENUM!{enum VSS_PROVIDER_CAPABILITIES { + VSS_PRV_CAPABILITY_LEGACY = 0x1, + VSS_PRV_CAPABILITY_COMPLIANT = 0x2, + VSS_PRV_CAPABILITY_LUN_REPOINT = 0x4, + VSS_PRV_CAPABILITY_LUN_RESYNC = 0x8, + VSS_PRV_CAPABILITY_OFFLINE_CREATION = 0x10, + VSS_PRV_CAPABILITY_MULTIPLE_IMPORT = 0x20, + VSS_PRV_CAPABILITY_RECYCLING = 0x40, + VSS_PRV_CAPABILITY_PLEX = 0x80, + VSS_PRV_CAPABILITY_DIFFERENTIAL = 0x100, + VSS_PRV_CAPABILITY_CLUSTERED = 0x200, +}} +pub type PVSS_PROVIDER_CAPABILITIES = *mut VSS_PROVIDER_CAPABILITIES; +ENUM!{enum VSS_HARDWARE_OPTIONS { + VSS_BREAKEX_FLAG_MASK_LUNS = 0x1, + VSS_BREAKEX_FLAG_MAKE_READ_WRITE = 0x2, + VSS_BREAKEX_FLAG_REVERT_IDENTITY_ALL = 0x4, + VSS_BREAKEX_FLAG_REVERT_IDENTITY_NONE = 0x8, + VSS_ONLUNSTATECHANGE_NOTIFY_READ_WRITE = 0x100, + VSS_ONLUNSTATECHANGE_NOTIFY_LUN_PRE_RECOVERY = 0x200, + VSS_ONLUNSTATECHANGE_NOTIFY_LUN_POST_RECOVERY = 0x400, + VSS_ONLUNSTATECHANGE_DO_MASK_LUNS = 0x800, +}} +pub type PVSS_HARDWARE_OPTIONS = *mut VSS_HARDWARE_OPTIONS; +ENUM!{enum VSS_RECOVERY_OPTIONS { + VSS_RECOVERY_REVERT_IDENTITY_ALL = 0x00000100, + VSS_RECOVERY_NO_VOLUME_CHECK = 0x00000200, +}} +pub type PVSS_RECOVERY_OPTIONS = *mut VSS_RECOVERY_OPTIONS; +ENUM!{enum VSS_WRITER_STATE { + VSS_WS_UNKNOWN = 0, + VSS_WS_STABLE = 1, + VSS_WS_WAITING_FOR_FREEZE = 2, + VSS_WS_WAITING_FOR_THAW = 3, + VSS_WS_WAITING_FOR_POST_SNAPSHOT = 4, + VSS_WS_WAITING_FOR_BACKUP_COMPLETE = 5, + VSS_WS_FAILED_AT_IDENTIFY = 6, + VSS_WS_FAILED_AT_PREPARE_BACKUP = 7, + VSS_WS_FAILED_AT_PREPARE_SNAPSHOT = 8, + VSS_WS_FAILED_AT_FREEZE = 9, + VSS_WS_FAILED_AT_THAW = 10, + VSS_WS_FAILED_AT_POST_SNAPSHOT = 11, + VSS_WS_FAILED_AT_BACKUP_COMPLETE = 12, + VSS_WS_FAILED_AT_PRE_RESTORE = 13, + VSS_WS_FAILED_AT_POST_RESTORE = 14, + VSS_WS_FAILED_AT_BACKUPSHUTDOWN = 15, + VSS_WS_COUNT = 16, +}} +pub type PVSS_WRITER_STATE = *mut VSS_WRITER_STATE; +ENUM!{enum VSS_BACKUP_TYPE { + VSS_BT_UNDEFINED = 0, + VSS_BT_FULL = 1, + VSS_BT_INCREMENTAL = 2, + VSS_BT_DIFFERENTIAL = 3, + VSS_BT_LOG = 4, + VSS_BT_COPY = 5, + VSS_BT_OTHER = 6, +}} +pub type PVSS_BACKUP_TYPE = *mut VSS_BACKUP_TYPE; +ENUM!{enum VSS_RESTORE_TYPE { + VSS_RTYPE_UNDEFINED = 0, + VSS_RTYPE_BY_COPY = 1, + VSS_RTYPE_IMPORT = 2, + VSS_RTYPE_OTHER = 3, +}} +pub type PVSS_RESTORE_TYPE = *mut VSS_RESTORE_TYPE; +ENUM!{enum VSS_ROLLFORWARD_TYPE { + VSS_RF_UNDEFINED = 0, + VSS_RF_NONE = 1, + VSS_RF_ALL = 2, + VSS_RF_PARTIAL = 3, +}} +pub type PVSS_ROLLFORWARD_TYPE = *mut VSS_ROLLFORWARD_TYPE; +ENUM!{enum VSS_PROVIDER_TYPE { + VSS_PROV_UNKNOWN = 0, + VSS_PROV_SYSTEM = 1, + VSS_PROV_SOFTWARE = 2, + VSS_PROV_HARDWARE = 3, + VSS_PROV_FILESHARE = 4, +}} +pub type PVSS_PROVIDER_TYPE = *mut VSS_PROVIDER_TYPE; +ENUM!{enum VSS_APPLICATION_LEVEL { + VSS_APP_UNKNOWN = 0, + VSS_APP_SYSTEM = 1, + VSS_APP_BACK_END = 2, + VSS_APP_FRONT_END = 3, + VSS_APP_SYSTEM_RM = 4, + VSS_APP_AUTO = -1i32 as u32, +}} +pub type PVSS_APPLICATION_LEVEL = *mut VSS_APPLICATION_LEVEL; +ENUM!{enum _VSS_SNAPSHOT_COMPATIBILITY { + VSS_SC_DISABLE_DEFRAG = 0x1, + VSS_SC_DISABLE_CONTENTINDEX = 0x2, +}} +ENUM!{enum VSS_SNAPSHOT_PROPERTY_ID { + VSS_SPROPID_UNKNOWN = 0, + VSS_SPROPID_SNAPSHOT_ID = 0x1, + VSS_SPROPID_SNAPSHOT_SET_ID = 0x2, + VSS_SPROPID_SNAPSHOTS_COUNT = 0x3, + VSS_SPROPID_SNAPSHOT_DEVICE = 0x4, + VSS_SPROPID_ORIGINAL_VOLUME = 0x5, + VSS_SPROPID_ORIGINATING_MACHINE = 0x6, + VSS_SPROPID_SERVICE_MACHINE = 0x7, + VSS_SPROPID_EXPOSED_NAME = 0x8, + VSS_SPROPID_EXPOSED_PATH = 0x9, + VSS_SPROPID_PROVIDER_ID = 0xa, + VSS_SPROPID_SNAPSHOT_ATTRIBUTES = 0xb, + VSS_SPROPID_CREATION_TIMESTAMP = 0xc, + VSS_SPROPID_STATUS = 0xd, +}} +pub type PVSS_SNAPSHOT_PROPERTY_ID = *mut VSS_SNAPSHOT_PROPERTY_ID; +ENUM!{enum VSS_FILE_SPEC_BACKUP_TYPE { + VSS_FSBT_FULL_BACKUP_REQUIRED = 0x1, + VSS_FSBT_DIFFERENTIAL_BACKUP_REQUIRED = 0x2, + VSS_FSBT_INCREMENTAL_BACKUP_REQUIRED = 0x4, + VSS_FSBT_LOG_BACKUP_REQUIRED = 0x8, + VSS_FSBT_FULL_SNAPSHOT_REQUIRED = 0x100, + VSS_FSBT_DIFFERENTIAL_SNAPSHOT_REQUIRED = 0x200, + VSS_FSBT_INCREMENTAL_SNAPSHOT_REQUIRED = 0x400, + VSS_FSBT_LOG_SNAPSHOT_REQUIRED = 0x800, + VSS_FSBT_CREATED_DURING_BACKUP = 0x10000, + VSS_FSBT_ALL_BACKUP_REQUIRED = 0xf, + VSS_FSBT_ALL_SNAPSHOT_REQUIRED = 0xf00, +}} +pub type PVSS_FILE_SPEC_BACKUP_TYPE = *mut VSS_FILE_SPEC_BACKUP_TYPE; +ENUM!{enum VSS_BACKUP_SCHEMA { + VSS_BS_UNDEFINED = 0, + VSS_BS_DIFFERENTIAL = 0x1, + VSS_BS_INCREMENTAL = 0x2, + VSS_BS_EXCLUSIVE_INCREMENTAL_DIFFERENTIAL = 0x4, + VSS_BS_LOG = 0x8, + VSS_BS_COPY = 0x10, + VSS_BS_TIMESTAMPED = 0x20, + VSS_BS_LAST_MODIFY = 0x40, + VSS_BS_LSN = 0x80, + VSS_BS_WRITER_SUPPORTS_NEW_TARGET = 0x100, + VSS_BS_WRITER_SUPPORTS_RESTORE_WITH_MOVE = 0x200, + VSS_BS_INDEPENDENT_SYSTEM_STATE = 0x400, + VSS_BS_ROLLFORWARD_RESTORE = 0x1000, + VSS_BS_RESTORE_RENAME = 0x2000, + VSS_BS_AUTHORITATIVE_RESTORE = 0x4000, + VSS_BS_WRITER_SUPPORTS_PARALLEL_RESTORES = 0x8000, +}} +pub type PVSS_BACKUP_SCHEMA = *mut VSS_BACKUP_SCHEMA; +pub type VSS_ID = GUID; +pub type VSS_PWSZ = *mut WCHAR; +pub type VSS_TIMESTAMP = LONGLONG; +STRUCT!{struct VSS_SNAPSHOT_PROP { + m_SnapshotId: VSS_ID, + m_SnapshotSetId: VSS_ID, + m_lSnapshotsCount: LONG, + m_pwszSnapshotDeviceObject: VSS_PWSZ, + m_pwszOriginalVolumeName: VSS_PWSZ, + m_pwszOriginatingMachine: VSS_PWSZ, + m_pwszServiceMachine: VSS_PWSZ, + m_pwszExposedName: VSS_PWSZ, + m_pwszExposedPath: VSS_PWSZ, + m_ProviderId: VSS_ID, + m_lSnapshotAttributes: LONG, + m_tsCreationTimestamp: VSS_TIMESTAMP, + m_eStatus: VSS_SNAPSHOT_STATE, +}} +pub type PVSS_SNAPSHOT_PROP = *mut VSS_SNAPSHOT_PROP; +STRUCT!{struct VSS_PROVIDER_PROP { + m_ProviderId: VSS_ID, + m_pwszProviderName: VSS_PWSZ, + m_eProviderType: VSS_PROVIDER_TYPE, + m_pwszProviderVersion: VSS_PWSZ, + m_ProviderVersionId: VSS_ID, + m_ClassId: CLSID, +}} +pub type PVSS_PROVIDER_PROP = *mut VSS_PROVIDER_PROP; +UNION!{union VSS_OBJECT_UNION { + [u64; 12] [u64; 16], + Snap Snap_mut: VSS_SNAPSHOT_PROP, + Prov Prov_mut: VSS_PROVIDER_PROP, +}} +STRUCT!{struct VSS_OBJECT_PROP { + Type: VSS_OBJECT_TYPE, + Obj: VSS_OBJECT_UNION, +}} +pub type PVSS_OBJECT_PROP = *mut VSS_OBJECT_PROP; +RIDL!( +#[uuid(0xae1c7110, 0x2f60, 0x11d3, 0x8a, 0x39, 0x00, 0xc0, 0x4f, 0x72, 0xd8, 0xe3)] +interface IVssEnumObject(IVssEnumObjectVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + rgelt: *mut VSS_OBJECT_PROP, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppenum: *mut *mut IVssEnumObject, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x507c37b4, 0xcf5b, 0x4e95, 0xb0, 0xaf, 0x14, 0xeb, 0x97, 0x67, 0x46, 0x7e)] +interface IVssAsync(IVssAsyncVtbl): IUnknown(IUnknownVtbl) { + fn Cancel() -> HRESULT, + fn Wait( + dwMilliseconds: DWORD, + ) -> HRESULT, + fn QueryStatus( + pHrResult: *mut HRESULT, + pReserved: *mut INT, + ) -> HRESULT, +} +); diff --git a/src/vendor/winapi/src/um/vsserror.rs b/src/vendor/winapi/src/um/vsserror.rs new file mode 100644 index 0000000000..26fc84cf35 --- /dev/null +++ b/src/vendor/winapi/src/um/vsserror.rs @@ -0,0 +1,90 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! VSS Error header file +use um::winnt::HRESULT; +pub const VSS_E_BAD_STATE: HRESULT = 0x80042301; +pub const VSS_E_UNEXPECTED: HRESULT = 0x80042302; +pub const VSS_E_PROVIDER_ALREADY_REGISTERED: HRESULT = 0x80042303; +pub const VSS_E_PROVIDER_NOT_REGISTERED: HRESULT = 0x80042304; +pub const VSS_E_PROVIDER_VETO: HRESULT = 0x80042306; +pub const VSS_E_PROVIDER_IN_USE: HRESULT = 0x80042307; +pub const VSS_E_OBJECT_NOT_FOUND: HRESULT = 0x80042308; +pub const VSS_S_ASYNC_PENDING: HRESULT = 0x00042309; +pub const VSS_S_ASYNC_FINISHED: HRESULT = 0x0004230A; +pub const VSS_S_ASYNC_CANCELLED: HRESULT = 0x0004230B; +pub const VSS_E_VOLUME_NOT_SUPPORTED: HRESULT = 0x8004230C; +pub const VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER: HRESULT = 0x8004230E; +pub const VSS_E_OBJECT_ALREADY_EXISTS: HRESULT = 0x8004230D; +pub const VSS_E_UNEXPECTED_PROVIDER_ERROR: HRESULT = 0x8004230F; +pub const VSS_E_CORRUPT_XML_DOCUMENT: HRESULT = 0x80042310; +pub const VSS_E_INVALID_XML_DOCUMENT: HRESULT = 0x80042311; +pub const VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED: HRESULT = 0x80042312; +pub const VSS_E_FLUSH_WRITES_TIMEOUT: HRESULT = 0x80042313; +pub const VSS_E_HOLD_WRITES_TIMEOUT: HRESULT = 0x80042314; +pub const VSS_E_UNEXPECTED_WRITER_ERROR: HRESULT = 0x80042315; +pub const VSS_E_SNAPSHOT_SET_IN_PROGRESS: HRESULT = 0x80042316; +pub const VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED: HRESULT = 0x80042317; +pub const VSS_E_WRITER_INFRASTRUCTURE: HRESULT = 0x80042318; +pub const VSS_E_WRITER_NOT_RESPONDING: HRESULT = 0x80042319; +pub const VSS_E_WRITER_ALREADY_SUBSCRIBED: HRESULT = 0x8004231A; +pub const VSS_E_UNSUPPORTED_CONTEXT: HRESULT = 0x8004231B; +pub const VSS_E_VOLUME_IN_USE: HRESULT = 0x8004231D; +pub const VSS_E_MAXIMUM_DIFFAREA_ASSOCIATIONS_REACHED: HRESULT = 0x8004231E; +pub const VSS_E_INSUFFICIENT_STORAGE: HRESULT = 0x8004231F; +pub const VSS_E_NO_SNAPSHOTS_IMPORTED: HRESULT = 0x80042320; +pub const VSS_S_SOME_SNAPSHOTS_NOT_IMPORTED: HRESULT = 0x00042321; +pub const VSS_E_SOME_SNAPSHOTS_NOT_IMPORTED: HRESULT = 0x80042321; +pub const VSS_E_MAXIMUM_NUMBER_OF_REMOTE_MACHINES_REACHED: HRESULT = 0x80042322; +pub const VSS_E_REMOTE_SERVER_UNAVAILABLE: HRESULT = 0x80042323; +pub const VSS_E_REMOTE_SERVER_UNSUPPORTED: HRESULT = 0x80042324; +pub const VSS_E_REVERT_IN_PROGRESS: HRESULT = 0x80042325; +pub const VSS_E_REVERT_VOLUME_LOST: HRESULT = 0x80042326; +pub const VSS_E_REBOOT_REQUIRED: HRESULT = 0x80042327; +pub const VSS_E_TRANSACTION_FREEZE_TIMEOUT: HRESULT = 0x80042328; +pub const VSS_E_TRANSACTION_THAW_TIMEOUT: HRESULT = 0x80042329; +pub const VSS_E_VOLUME_NOT_LOCAL: HRESULT = 0x8004232D; +pub const VSS_E_CLUSTER_TIMEOUT: HRESULT = 0x8004232E; +pub const VSS_E_WRITERERROR_INCONSISTENTSNAPSHOT: HRESULT = 0x800423F0; +pub const VSS_E_WRITERERROR_OUTOFRESOURCES: HRESULT = 0x800423F1; +pub const VSS_E_WRITERERROR_TIMEOUT: HRESULT = 0x800423F2; +pub const VSS_E_WRITERERROR_RETRYABLE: HRESULT = 0x800423F3; +pub const VSS_E_WRITERERROR_NONRETRYABLE: HRESULT = 0x800423F4; +pub const VSS_E_WRITERERROR_RECOVERY_FAILED: HRESULT = 0x800423F5; +pub const VSS_E_BREAK_REVERT_ID_FAILED: HRESULT = 0x800423F6; +pub const VSS_E_LEGACY_PROVIDER: HRESULT = 0x800423F7; +pub const VSS_E_MISSING_DISK: HRESULT = 0x800423F8; +pub const VSS_E_MISSING_HIDDEN_VOLUME: HRESULT = 0x800423F9; +pub const VSS_E_MISSING_VOLUME: HRESULT = 0x800423FA; +pub const VSS_E_AUTORECOVERY_FAILED: HRESULT = 0x800423FB; +pub const VSS_E_DYNAMIC_DISK_ERROR: HRESULT = 0x800423FC; +pub const VSS_E_NONTRANSPORTABLE_BCD: HRESULT = 0x800423FD; +pub const VSS_E_CANNOT_REVERT_DISKID: HRESULT = 0x800423FE; +pub const VSS_E_RESYNC_IN_PROGRESS: HRESULT = 0x800423FF; +pub const VSS_E_CLUSTER_ERROR: HRESULT = 0x80042400; +pub const VSS_E_UNSELECTED_VOLUME: HRESULT = 0x8004232A; +pub const VSS_E_SNAPSHOT_NOT_IN_SET: HRESULT = 0x8004232B; +pub const VSS_E_NESTED_VOLUME_LIMIT: HRESULT = 0x8004232C; +pub const VSS_E_NOT_SUPPORTED: HRESULT = 0x8004232F; +pub const VSS_E_WRITERERROR_PARTIAL_FAILURE: HRESULT = 0x80042336; +pub const VSS_E_ASRERROR_DISK_ASSIGNMENT_FAILED: HRESULT = 0x80042401; +pub const VSS_E_ASRERROR_DISK_RECREATION_FAILED: HRESULT = 0x80042402; +pub const VSS_E_ASRERROR_NO_ARCPATH: HRESULT = 0x80042403; +pub const VSS_E_ASRERROR_MISSING_DYNDISK: HRESULT = 0x80042404; +pub const VSS_E_ASRERROR_SHARED_CRIDISK: HRESULT = 0x80042405; +pub const VSS_E_ASRERROR_DATADISK_RDISK0: HRESULT = 0x80042406; +pub const VSS_E_ASRERROR_RDISK0_TOOSMALL: HRESULT = 0x80042407; +pub const VSS_E_ASRERROR_CRITICAL_DISKS_TOO_SMALL: HRESULT = 0x80042408; +pub const VSS_E_WRITER_STATUS_NOT_AVAILABLE: HRESULT = 0x80042409; +pub const VSS_E_ASRERROR_DYNAMIC_VHD_NOT_SUPPORTED: HRESULT = 0x8004240A; +pub const VSS_E_CRITICAL_VOLUME_ON_INVALID_DISK: HRESULT = 0x80042411; +pub const VSS_E_ASRERROR_RDISK_FOR_SYSTEM_DISK_NOT_FOUND: HRESULT = 0x80042412; +pub const VSS_E_ASRERROR_NO_PHYSICAL_DISK_AVAILABLE: HRESULT = 0x80042413; +pub const VSS_E_ASRERROR_FIXED_PHYSICAL_DISK_AVAILABLE_AFTER_DISK_EXCLUSION: HRESULT = + 0x80042414; +pub const VSS_E_ASRERROR_CRITICAL_DISK_CANNOT_BE_EXCLUDED: HRESULT = 0x80042415; +pub const VSS_E_ASRERROR_SYSTEM_PARTITION_HIDDEN: HRESULT = 0x80042416; +pub const VSS_E_FSS_TIMEOUT: HRESULT = 0x80042417; diff --git a/src/vendor/winapi/src/um/vswriter.rs b/src/vendor/winapi/src/um/vswriter.rs new file mode 100644 index 0000000000..49e1a43463 --- /dev/null +++ b/src/vendor/winapi/src/um/vswriter.rs @@ -0,0 +1,414 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Declaration of Writer + +use shared::minwindef::{BOOL, BYTE, DWORD, FILETIME, UINT}; +use shared::wtypes::BSTR; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::vss::{VSS_ID, VSS_ROLLFORWARD_TYPE}; +use um::winnt::{HRESULT, LPCWSTR, VOID}; + +ENUM!{enum VSS_USAGE_TYPE { + VSS_UT_UNDEFINED = 0, + VSS_UT_BOOTABLESYSTEMSTATE = 1, + VSS_UT_SYSTEMSERVICE = 2, + VSS_UT_USERDATA = 3, + VSS_UT_OTHER = 4, +}} +ENUM!{enum VSS_SOURCE_TYPE { + VSS_ST_UNDEFINED = 0, + VSS_ST_TRANSACTEDDB = 1, + VSS_ST_NONTRANSACTEDDB = 2, + VSS_ST_OTHER = 3, +}} +ENUM!{enum VSS_RESTOREMETHOD_ENUM { + VSS_RME_UNDEFINED = 0, + VSS_RME_RESTORE_IF_NOT_THERE = 1, + VSS_RME_RESTORE_IF_CAN_REPLACE = 2, + VSS_RME_STOP_RESTORE_START = 3, + VSS_RME_RESTORE_TO_ALTERNATE_LOCATION = 4, + VSS_RME_RESTORE_AT_REBOOT = 5, + VSS_RME_RESTORE_AT_REBOOT_IF_CANNOT_REPLACE = 6, + VSS_RME_CUSTOM = 7, + VSS_RME_RESTORE_STOP_START = 8, +}} +ENUM!{enum VSS_WRITERRESTORE_ENUM { + VSS_WRE_UNDEFINED = 0, + VSS_WRE_NEVER = 1, + VSS_WRE_IF_REPLACE_FAILS = 2, + VSS_WRE_ALWAYS = 3, +}} +ENUM!{enum VSS_COMPONENT_TYPE { + VSS_CT_UNDEFINED = 0, + VSS_CT_DATABASE = 1, + VSS_CT_FILEGROUP = 2, +}} +ENUM!{enum VSS_ALTERNATE_WRITER_STATE { + VSS_AWS_UNDEFINED = 0, + VSS_AWS_NO_ALTERNATE_WRITER = 1, + VSS_AWS_ALTERNATE_WRITER_EXISTS = 2, + VSS_AWS_THIS_IS_ALTERNATE_WRITER = 3, +}} +ENUM!{enum VSS_SUBSCRIBE_MASK { + VSS_SM_POST_SNAPSHOT_FLAG = 0x00000001, + VSS_SM_BACKUP_EVENTS_FLAG = 0x00000002, + VSS_SM_RESTORE_EVENTS_FLAG = 0x00000004, + VSS_SM_IO_THROTTLING_FLAG = 0x00000008, + VSS_SM_ALL_FLAGS = 0xffffffff, +}} +ENUM!{enum VSS_RESTORE_TARGET { + VSS_RT_UNDEFINED = 0, + VSS_RT_ORIGINAL = 1, + VSS_RT_ALTERNATE = 2, + VSS_RT_DIRECTED = 3, + VSS_RT_ORIGINAL_LOCATION = 4, +}} +ENUM!{enum VSS_FILE_RESTORE_STATUS { + VSS_RS_UNDEFINED = 0, + VSS_RS_NONE = 1, + VSS_RS_ALL = 2, + VSS_RS_FAILED = 3, +}} +ENUM!{enum VSS_COMPONENT_FLAGS { + VSS_CF_BACKUP_RECOVERY = 0x00000001, + VSS_CF_APP_ROLLBACK_RECOVERY = 0x00000002, + VSS_CF_NOT_SYSTEM_STATE = 0x00000004, +}} +RIDL!( +#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] +interface IVssWMFiledesc(IVssWMFiledescVtbl): IUnknown(IUnknownVtbl) { + fn GetPath( + pbstrPath: *mut BSTR, + ) -> HRESULT, + fn GetFilespec( + pbstrFilespec: *mut BSTR, + ) -> HRESULT, + fn GetRecursive( + pbRecursive: *mut bool, + ) -> HRESULT, + fn GetAlternateLocation( + pbstrAlternateLocation: *mut BSTR, + ) -> HRESULT, + fn GetBackupTypeMask( + pdwTypeMask: *mut DWORD, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] +interface IVssWMDependency(IVssWMDependencyVtbl): IUnknown(IUnknownVtbl) { + fn GetWriterId( + pWriterId: *mut VSS_ID, + ) -> HRESULT, + fn GetLogicalPath( + pbstrLogicalPath: *mut BSTR, + ) -> HRESULT, + fn GetComponentName( + pbstrComponentName: *mut BSTR, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0xd2c72c96, 0xc121, 0x4518, 0xb6, 0x27, 0xe5, 0xa9, 0x3d, 0x01, 0x0e, 0xad)] +interface IVssComponent(IVssComponentVtbl): IUnknown(IUnknownVtbl) { + fn GetLogicalPath( + pbstrPath: *mut BSTR, + ) -> HRESULT, + fn GetComponentType( + pct: *mut VSS_COMPONENT_TYPE, + ) -> HRESULT, + fn GetComponentName( + pbstrName: *mut BSTR, + ) -> HRESULT, + fn GetBackupSucceeded( + pbSucceeded: *mut bool, + ) -> HRESULT, + fn GetAlternateLocationMappingCount( + pcMappings: *mut UINT, + ) -> HRESULT, + fn GetAlternateLocationMapping( + iMapping: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn SetBackupMetadata( + wszData: LPCWSTR, + ) -> HRESULT, + fn GetBackupMetadata( + pbstrData: *mut BSTR, + ) -> HRESULT, + fn AddPartialFile( + wszPath: LPCWSTR, + wszFilename: LPCWSTR, + wszRanges: LPCWSTR, + wszMetadata: LPCWSTR, + ) -> HRESULT, + fn GetPartialFileCount( + pcPartialFiles: *mut UINT, + ) -> HRESULT, + fn GetPartialFile( + iPartialFile: UINT, + pbstrPath: *mut BSTR, + pbstrFilename: *mut BSTR, + pbstrRange: *mut BSTR, + pbstrMetadata: *mut BSTR, + ) -> HRESULT, + fn IsSelectedForRestore( + pbSelectedForRestore: *mut bool, + ) -> HRESULT, + fn GetAdditionalRestores( + pbAdditionalRestores: *mut bool, + ) -> HRESULT, + fn GetNewTargetCount( + pcNewTarget: *mut UINT, + ) -> HRESULT, + fn GetNewTarget( + iNewTarget: UINT, + ppFiledesc: *mut *mut IVssWMFiledesc, + ) -> HRESULT, + fn AddDirectedTarget( + wszSourcePath: LPCWSTR, + wszSourceFilename: LPCWSTR, + wszSourceRangeList: LPCWSTR, + wszDestinationPath: LPCWSTR, + wszDestinationFilename: LPCWSTR, + wszDestinationRangeList: LPCWSTR, + ) -> HRESULT, + fn GetDirectedTargetCount( + pcDirectedTarget: *mut UINT, + ) -> HRESULT, + fn GetDirectedTarget( + iDirectedTarget: UINT, + pbstrSourcePath: *mut BSTR, + pbstrSourceFileName: *mut BSTR, + pbstrSourceRangeList: *mut BSTR, + pbstrDestinationPath: *mut BSTR, + pbstrDestinationFilename: *mut BSTR, + pbstrDestinationRangeList: *mut BSTR, + ) -> HRESULT, + fn SetRestoreMetadata( + wszRestoreMetadata: LPCWSTR, + ) -> HRESULT, + fn GetRestoreMetadata( + pbstrRestoreMetadata: *mut BSTR, + ) -> HRESULT, + fn SetRestoreTarget( + target: VSS_RESTORE_TARGET, + ) -> HRESULT, + fn GetRestoreTarget( + pTarget: *mut VSS_RESTORE_TARGET, + ) -> HRESULT, + fn SetPreRestoreFailureMsg( + wszPreRestoreFailureMsg: LPCWSTR, + ) -> HRESULT, + fn GetPreRestoreFailureMsg( + pbstrPreRestoreFailureMsg: *mut BSTR, + ) -> HRESULT, + fn SetPostRestoreFailureMsg( + wszPostRestoreFailureMsg: LPCWSTR, + ) -> HRESULT, + fn GetPostRestoreFailureMsg( + pbstrPostRestoreFailureMsg: *mut BSTR, + ) -> HRESULT, + fn SetBackupStamp( + wszBackupStamp: LPCWSTR, + ) -> HRESULT, + fn GetBackupStamp( + pbstrBackupStamp: *mut BSTR, + ) -> HRESULT, + fn GetPreviousBackupStamp( + pbstrBackupStamp: *mut BSTR, + ) -> HRESULT, + fn GetBackupOptions( + pbstrBackupOptions: *mut BSTR, + ) -> HRESULT, + fn GetRestoreOptions( + pbstrRestoreOptions: *mut BSTR, + ) -> HRESULT, + fn GetRestoreSubcomponentCount( + pcRestoreSubcomponent: *mut UINT, + ) -> HRESULT, + fn GetRestoreSubcomponent( + iComponent: UINT, + pbstrLogicalPath: *mut BSTR, + pbstrComponentName: *mut BSTR, + pbRepair: *mut bool, + ) -> HRESULT, + fn GetFileRestoreStatus( + pStatus: *mut VSS_FILE_RESTORE_STATUS, + ) -> HRESULT, + fn AddDifferencedFilesByLastModifyTime( + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + bRecursive: BOOL, + ftLastModifyTime: FILETIME, + ) -> HRESULT, + fn AddDifferencedFilesByLastModifyLSN( + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + bRecursive: BOOL, + bstrLsnString: BSTR, + ) -> HRESULT, + fn GetDifferencedFilesCount( + pcDifferencedFiles: *mut UINT, + ) -> HRESULT, + fn GetDifferencedFile( + iDifferencedFile: UINT, + pbstrPath: *mut BSTR, + pbstrFilespec: *mut BSTR, + pbRecursive: *mut BOOL, + pbstrLsnString: *mut BSTR, + pftLastModifyTime: *mut FILETIME, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] +interface IVssWriterComponents(IVssWriterComponentsVtbl) { + fn GetComponentCount( + pcComponents: *mut UINT, + ) -> HRESULT, + fn GetWriterInfo( + pidInstance: *mut VSS_ID, + pidWriter: *mut VSS_ID, + ) -> HRESULT, + fn GetComponent( + iComponent: UINT, + ppComponent: *mut *mut IVssComponent, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x156c8b5e, 0xf131, 0x4bd7, 0x9c, 0x97, 0xd1, 0x92, 0x3b, 0xe7, 0xe1, 0xfa)] +interface IVssComponentEx(IVssComponentExVtbl): IVssComponent(IVssComponentVtbl) { + fn SetPrepareForBackupFailureMsg( + wszFailureMsg: LPCWSTR, + ) -> HRESULT, + fn SetPostSnapshotFailureMsg( + wszFailureMsg: LPCWSTR, + ) -> HRESULT, + fn GetPrepareForBackupFailureMsg( + pbstrFailureMsg: *mut BSTR, + ) -> HRESULT, + fn GetPostSnapshotFailureMsg( + pbstrFailureMsg: *mut BSTR, + ) -> HRESULT, + fn GetAuthoritativeRestore( + pbAuth: *mut bool, + ) -> HRESULT, + fn GetRollForward( + pRollType: *mut VSS_ROLLFORWARD_TYPE, + pbstrPoint: *mut BSTR, + ) -> HRESULT, + fn GetRestoreName( + pbstrName: *mut BSTR, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x3b5be0f2, 0x07a9, 0x4e4b, 0xbd, 0xd3, 0xcf, 0xdc, 0x8e, 0x2c, 0x0d, 0x2d)] +interface IVssComponentEx2(IVssComponentEx2Vtbl): IVssComponentEx(IVssComponentExVtbl) { + fn SetFailure( + hr: HRESULT, + hrApplication: HRESULT, + wszApplicationMessage: LPCWSTR, + dwReserved: DWORD, + ) -> HRESULT, + fn GetFailure( + phr: *mut HRESULT, + phrApplication: *mut HRESULT, + pbstrApplicationMessage: *mut BSTR, + pdwReserved: *mut DWORD, + ) -> HRESULT, +} +); +RIDL!( +#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] +interface IVssCreateWriterMetadata(IVssCreateWriterMetadataVtbl) { + fn AddIncludeFiles( + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + bRecursive: bool, + wszAlternateLocation: LPCWSTR, + ) -> HRESULT, + fn AddExcludeFiles( + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + bRecursive: bool, + ) -> HRESULT, + fn AddComponent( + ct: VSS_COMPONENT_TYPE, + wszLogicalPath: LPCWSTR, + wszComponentName: LPCWSTR, + wszCaption: LPCWSTR, + pbIcon: *const BYTE, + cbIcon: UINT, + bRestoreMetadata: bool, + bNotifyOnBackupComplete: bool, + bSelectableForRestore: bool, + dwComponentFlags: DWORD, + ) -> HRESULT, + fn AddDatabaseFiles( + wszLogicalPath: LPCWSTR, + wszDatabaseName: LPCWSTR, + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + dwBackupTypeMask: DWORD, + ) -> HRESULT, + fn AddDatabaseLogFiles( + wszLogicalPath: LPCWSTR, + wszDatabaseName: LPCWSTR, + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + dwBackupTypeMask: DWORD, + ) -> HRESULT, + fn AddFilesToFileGroup( + wszLogicalPath: LPCWSTR, + wszGroupName: LPCWSTR, + wszPath: LPCWSTR, + wszFilespec: LPCWSTR, + bRecursive: bool, + wszAlternateLocation: LPCWSTR, + dwBackupTypeMask: DWORD, + ) -> HRESULT, + fn SetRestoreMethod( + method: VSS_RESTOREMETHOD_ENUM, + wszService: LPCWSTR, + wszUserProcedure: LPCWSTR, + writerRestore: VSS_WRITERRESTORE_ENUM, + bRebootRequired: bool, + ) -> HRESULT, + fn AddAlternateLocationMapping( + wszSourcePath: LPCWSTR, + wszSourceFilespec: LPCWSTR, + bRecursive: bool, + wszDestination: LPCWSTR, + ) -> HRESULT, + fn AddComponentDependency( + wszForLogicalPath: LPCWSTR, + wszForComponentName: LPCWSTR, + onWriterId: VSS_ID, + wszOnLogicalPath: LPCWSTR, + wszOnComponentName: LPCWSTR, + ) -> HRESULT, + fn SetBackupSchema( + dwSchemaMask: DWORD, + ) -> HRESULT, + fn GetDocument( + pDoc: *mut *mut VOID, + ) -> HRESULT, //TODO IXMLDOMDocument, + fn SaveAsXML( + pbstrXML: *mut BSTR, + ) -> HRESULT, +} +); +//IVssCreateWriterMetadataEx +//IVssWriterImpl +//IVssCreateExpressWriterMetadata +//IVssExpressWriter +//CVssWriter +//CVssWriterEx +//CVssWriterEx2 diff --git a/src/vendor/winapi/src/um/werapi.rs b/src/vendor/winapi/src/um/werapi.rs new file mode 100644 index 0000000000..cc8850c1d2 --- /dev/null +++ b/src/vendor/winapi/src/um/werapi.rs @@ -0,0 +1,46 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Function prototypes for Windows Error Reporting (WER) +use shared::minwindef::{DWORD, PDWORD}; +use um::winnt::{HANDLE, HRESULT, PCWSTR, PVOID}; +ENUM!{enum WER_REGISTER_FILE_TYPE { + WerRegFileTypeUserDocument = 1, + WerRegFileTypeOther = 2, + WerRegFileTypeMax, +}} +extern "system" { + pub fn WerRegisterFile( + pwzFile: PCWSTR, + regFileType: WER_REGISTER_FILE_TYPE, + dwFlags: DWORD, + ) -> HRESULT; + pub fn WerUnregisterFile( + pwzFilePath: PCWSTR + ) -> HRESULT; + pub fn WerRegisterMemoryBlock( + pvAddress: PVOID, + dwSize: DWORD + ) -> HRESULT; + pub fn WerUnregisterMemoryBlock( + pvAddress: PVOID + ) -> HRESULT; + pub fn WerSetFlags( + dwFlags: DWORD + ) -> HRESULT; + pub fn WerGetFlags( + hProcess: HANDLE, + pdwFlags: PDWORD + ) -> HRESULT; + pub fn WerRegisterRuntimeExceptionModule( + pwszOutOfProcessCallbackDll: PCWSTR, + pContext: PVOID, + ) -> HRESULT; + pub fn WerUnregisterRuntimeExceptionModule( + pwszOutOfProcessCallbackDll: PCWSTR, + pContext: PVOID, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/um/winbase.rs b/src/vendor/winapi/src/um/winbase.rs new file mode 100644 index 0000000000..4dcbd8f27e --- /dev/null +++ b/src/vendor/winapi/src/um/winbase.rs @@ -0,0 +1,2678 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the 32-Bit Windows Base APIs +use ctypes::{c_char, c_int, c_long, c_void}; +use shared::basetsd::{ + DWORD64, DWORD_PTR, LONG_PTR, PDWORD64, PDWORD_PTR, PSIZE_T, PULONG_PTR, SIZE_T, UINT_PTR, + ULONG_PTR, +}; +use shared::guiddef::GUID; +use shared::minwindef::{ + ATOM, BOOL, BYTE, DWORD, FARPROC, FILETIME, HFILE, HGLOBAL, HLOCAL, HMODULE, HRSRC, LPBOOL, + LPBYTE, LPCVOID, LPDWORD, LPFILETIME, LPVOID, LPWORD, PBOOL, PDWORD, PUCHAR, PULONG, PUSHORT, + UCHAR, UINT, ULONG, USHORT, WORD, +}; +use shared::windef::HWND; +use um::cfgmgr32::MAX_PROFILE_LEN; +use um::fileapi::STREAM_INFO_LEVELS; +use um::libloaderapi::{ + ENUMRESLANGPROCA, ENUMRESLANGPROCW, ENUMRESNAMEPROCA, ENUMRESTYPEPROCA, ENUMRESTYPEPROCW, +}; +use um::minwinbase::{ + FILE_INFO_BY_HANDLE_CLASS, FINDEX_INFO_LEVELS, FINDEX_SEARCH_OPS, GET_FILEEX_INFO_LEVELS, + LPOVERLAPPED, LPOVERLAPPED_COMPLETION_ROUTINE, LPSECURITY_ATTRIBUTES, PREASON_CONTEXT, +}; +use um::processthreadsapi::LPSTARTUPINFOA; +use um::winnt::{ + BOOLEAN, CHAR, DWORDLONG, EXECUTION_STATE, FILE_ID_128, HANDLE, HRESULT, INT, LANGID, + LARGE_INTEGER, LATENCY_TIME, LONG, LPCCH, LPCH, LPCSTR, LPCWSTR, LPOSVERSIONINFOEXA, + LPOSVERSIONINFOEXW, LPSTR, LPWSTR, MAXLONG, PBOOLEAN, PCONTEXT, PCWSTR, PFIRMWARE_TYPE, + PHANDLE, PIO_COUNTERS, PJOB_SET_ARRAY, PLUID, POWER_REQUEST_TYPE, PPERFORMANCE_DATA, + PPROCESSOR_NUMBER, PRTL_UMS_SCHEDULER_ENTRY_POINT, PSECURE_MEMORY_CACHE_CALLBACK, PSID, + PSID_NAME_USE, PULONGLONG, PVOID, PWOW64_CONTEXT, PWOW64_LDT_ENTRY, PWSTR, + RTL_UMS_THREAD_INFO_CLASS, STATUS_ABANDONED_WAIT_0, STATUS_USER_APC, STATUS_WAIT_0, + THREAD_BASE_PRIORITY_IDLE, THREAD_BASE_PRIORITY_LOWRT, THREAD_BASE_PRIORITY_MAX, + THREAD_BASE_PRIORITY_MIN, ULARGE_INTEGER, VOID, WAITORTIMERCALLBACK, WCHAR, WOW64_CONTEXT, +}; +use vc::vadefs::va_list; +pub const FILE_BEGIN: DWORD = 0; +pub const FILE_CURRENT: DWORD = 1; +pub const FILE_END: DWORD = 2; +pub const WAIT_FAILED: DWORD = 0xFFFFFFFF; +pub const WAIT_OBJECT_0: DWORD = STATUS_WAIT_0 as u32; +pub const WAIT_ABANDONED: DWORD = STATUS_ABANDONED_WAIT_0 as u32; +pub const WAIT_ABANDONED_0: DWORD = STATUS_ABANDONED_WAIT_0 as u32; +pub const WAIT_IO_COMPLETION: DWORD = STATUS_USER_APC as u32; +pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000; +pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000; +pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000; +pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000; +pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000; +pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000; +pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000; +pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x01000000; +pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000; +pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000; +pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000; +pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000; +pub const FILE_FLAG_OPEN_REQUIRING_OPLOCK: DWORD = 0x00040000; +pub const PROGRESS_CONTINUE: DWORD = 0; +pub const PROGRESS_CANCEL: DWORD = 1; +pub const PROGRESS_STOP: DWORD = 2; +pub const PROGRESS_QUIET: DWORD = 3; +pub const CALLBACK_CHUNK_FINISHED: DWORD = 0x00000000; +pub const CALLBACK_STREAM_SWITCH: DWORD = 0x00000001; +pub const COPY_FILE_FAIL_IF_EXISTS: DWORD = 0x00000001; +pub const COPY_FILE_RESTARTABLE: DWORD = 0x00000002; +pub const COPY_FILE_OPEN_SOURCE_FOR_WRITE: DWORD = 0x00000004; +pub const COPY_FILE_ALLOW_DECRYPTED_DESTINATION: DWORD = 0x00000008; +pub const COPY_FILE_COPY_SYMLINK: DWORD = 0x00000800; +pub const COPY_FILE_NO_BUFFERING: DWORD = 0x00001000; +pub const COPY_FILE_REQUEST_SECURITY_PRIVILEGES: DWORD = 0x00002000; +pub const COPY_FILE_RESUME_FROM_PAUSE: DWORD = 0x00004000; +pub const COPY_FILE_NO_OFFLOAD: DWORD = 0x00040000; +pub const REPLACEFILE_WRITE_THROUGH: DWORD = 0x00000001; +pub const REPLACEFILE_IGNORE_MERGE_ERRORS: DWORD = 0x00000002; +pub const REPLACEFILE_IGNORE_ACL_ERRORS: DWORD = 0x00000004; +pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001; +pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002; +pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003; +pub const PIPE_CLIENT_END: DWORD = 0x00000000; +pub const PIPE_SERVER_END: DWORD = 0x00000001; +pub const PIPE_WAIT: DWORD = 0x00000000; +pub const PIPE_NOWAIT: DWORD = 0x00000001; +pub const PIPE_READMODE_BYTE: DWORD = 0x00000000; +pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002; +pub const PIPE_TYPE_BYTE: DWORD = 0x00000000; +pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004; +pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000; +pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008; +pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255; +pub const SECURITY_CONTEXT_TRACKING: DWORD = 0x00040000; +pub const SECURITY_EFFECTIVE_ONLY: DWORD = 0x00080000; +pub const SECURITY_SQOS_PRESENT: DWORD = 0x00100000; +pub const SECURITY_VALID_SQOS_FLAGS: DWORD = 0x001F0000; +FN!{stdcall PFIBER_START_ROUTINE( + lpFiberParameter: LPVOID, +) -> ()} +pub type LPFIBER_START_ROUTINE = PFIBER_START_ROUTINE; +FN!{stdcall PFIBER_CALLOUT_ROUTINE( + lpParameter: LPVOID, +) -> LPVOID} +// FAIL_FAST_* +pub type LPLDT_ENTRY = LPVOID; // TODO - fix this for 32-bit +//SP_SERIALCOMM +//PST_* +// PCF_* +// SP_* +// BAUD_* +// DATABITS_* +// STOPBITS_* +// PARITY_* +STRUCT!{struct COMMPROP { + wPacketLength: WORD, + wPacketVersion: WORD, + dwServiceMask: DWORD, + dwReserved1: DWORD, + dwMaxTxQueue: DWORD, + dwMaxRxQueue: DWORD, + dwMaxBaud: DWORD, + dwProvSubType: DWORD, + dwProvCapabilities: DWORD, + dwSettableParams: DWORD, + dwSettableBaud: DWORD, + wSettableData: WORD, + wSettableStopParity: WORD, + dwCurrentTxQueue: DWORD, + dwCurrentRxQueue: DWORD, + dwProvSpec1: DWORD, + dwProvSpec2: DWORD, + wcProvChar: [WCHAR; 1], +}} +pub type LPCOMMPROP = *mut COMMPROP; +STRUCT!{struct COMSTAT { + BitFields: DWORD, + cbInQue: DWORD, + cbOutQue: DWORD, +}} +BITFIELD!(COMSTAT BitFields: DWORD [ + fCtsHold set_fCtsHold[0..1], + fDsrHold set_fDsrHold[1..2], + fRlsdHold set_fRlsdHold[2..3], + fXoffHold set_fXoffHold[3..4], + fXoffSent set_fXoffSent[4..5], + fEof set_fEof[5..6], + fTxim set_fTxim[6..7], + fReserved set_fReserved[7..32], +]); +pub type LPCOMSTAT = *mut COMSTAT; +pub const DTR_CONTROL_DISABLE: DWORD = 0x00; +pub const DTR_CONTROL_ENABLE: DWORD = 0x01; +pub const DTR_CONTROL_HANDSHAKE: DWORD = 0x02; +pub const RTS_CONTROL_DISABLE: DWORD = 0x00; +pub const RTS_CONTROL_ENABLE: DWORD = 0x01; +pub const RTS_CONTROL_HANDSHAKE: DWORD = 0x02; +pub const RTS_CONTROL_TOGGLE: DWORD = 0x03; +STRUCT!{struct DCB { + DCBlength: DWORD, + BaudRate: DWORD, + BitFields: DWORD, + wReserved: WORD, + XonLim: WORD, + XoffLim: WORD, + ByteSize: BYTE, + Parity: BYTE, + StopBits: BYTE, + XonChar: c_char, + XoffChar: c_char, + ErrorChar: c_char, + EofChar: c_char, + EvtChar: c_char, + wReserved1: WORD, +}} +BITFIELD!(DCB BitFields: DWORD [ + fBinary set_fBinary[0..1], + fParity set_fParity[1..2], + fOutxCtsFlow set_fOutxCtsFlow[2..3], + fOutxDsrFlow set_fOutxDsrFlow[3..4], + fDtrControl set_fDtrControl[4..6], + fDsrSensitivity set_fDsrSensitivity[6..7], + fTXContinueOnXoff set_fTXContinueOnXoff[7..8], + fOutX set_fOutX[8..9], + fInX set_fInX[9..10], + fErrorChar set_fErrorChar[10..11], + fNull set_fNull[11..12], + fRtsControl set_fRtsControl[12..14], + fAbortOnError set_fAbortOnError[14..15], + fDummy2 set_fDummy2[15..32], +]); +pub type LPDCB = *mut DCB; +STRUCT!{struct COMMTIMEOUTS { + ReadIntervalTimeout: DWORD, + ReadTotalTimeoutMultiplier: DWORD, + ReadTotalTimeoutConstant: DWORD, + WriteTotalTimeoutMultiplier: DWORD, + WriteTotalTimeoutConstant: DWORD, +}} +pub type LPCOMMTIMEOUTS = *mut COMMTIMEOUTS; +STRUCT!{struct COMMCONFIG { + dwSize: DWORD, + wVersion: WORD, + wReserved: WORD, + dcb: DCB, + dwProviderSubType: DWORD, + dwProviderOffset: DWORD, + dwProviderSize: DWORD, + wcProviderData: [WCHAR; 1], +}} +pub type LPCOMMCONFIG = *mut COMMCONFIG; +// GMEM_* +STRUCT!{struct MEMORYSTATUS { + dwLength: DWORD, + dwMemoryLoad: DWORD, + dwTotalPhys: SIZE_T, + dwAvailPhys: SIZE_T, + dwTotalPageFile: SIZE_T, + dwAvailPageFile: SIZE_T, + dwTotalVirtual: SIZE_T, + dwAvailVirtual: SIZE_T, +}} +pub type LPMEMORYSTATUS = *mut MEMORYSTATUS; +// NUMA_NO_PREFERRED_NODE +pub const DEBUG_PROCESS: DWORD = 0x00000001; +pub const DEBUG_ONLY_THIS_PROCESS: DWORD = 0x00000002; +pub const CREATE_SUSPENDED: DWORD = 0x00000004; +pub const DETACHED_PROCESS: DWORD = 0x00000008; +pub const CREATE_NEW_CONSOLE: DWORD = 0x00000010; +pub const NORMAL_PRIORITY_CLASS: DWORD = 0x00000020; +pub const IDLE_PRIORITY_CLASS: DWORD = 0x00000040; +pub const HIGH_PRIORITY_CLASS: DWORD = 0x00000080; +pub const REALTIME_PRIORITY_CLASS: DWORD = 0x00000100; +pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200; +pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400; +pub const CREATE_SEPARATE_WOW_VDM: DWORD = 0x00000800; +pub const CREATE_SHARED_WOW_VDM: DWORD = 0x00001000; +pub const CREATE_FORCEDOS: DWORD = 0x00002000; +pub const BELOW_NORMAL_PRIORITY_CLASS: DWORD = 0x00004000; +pub const ABOVE_NORMAL_PRIORITY_CLASS: DWORD = 0x00008000; +pub const INHERIT_PARENT_AFFINITY: DWORD = 0x00010000; +pub const INHERIT_CALLER_PRIORITY: DWORD = 0x00020000; +pub const CREATE_PROTECTED_PROCESS: DWORD = 0x00040000; +pub const EXTENDED_STARTUPINFO_PRESENT: DWORD = 0x00080000; +pub const PROCESS_MODE_BACKGROUND_BEGIN: DWORD = 0x00100000; +pub const PROCESS_MODE_BACKGROUND_END: DWORD = 0x00200000; +pub const CREATE_BREAKAWAY_FROM_JOB: DWORD = 0x01000000; +pub const CREATE_PRESERVE_CODE_AUTHZ_LEVEL: DWORD = 0x02000000; +pub const CREATE_DEFAULT_ERROR_MODE: DWORD = 0x04000000; +pub const CREATE_NO_WINDOW: DWORD = 0x08000000; +pub const PROFILE_USER: DWORD = 0x10000000; +pub const PROFILE_KERNEL: DWORD = 0x20000000; +pub const PROFILE_SERVER: DWORD = 0x40000000; +pub const CREATE_IGNORE_SYSTEM_DEFAULT: DWORD = 0x80000000; +// STACK_SIZE_PARAM_IS_A_RESERVATION +pub const THREAD_PRIORITY_LOWEST: DWORD = THREAD_BASE_PRIORITY_MIN; +pub const THREAD_PRIORITY_BELOW_NORMAL: DWORD = THREAD_PRIORITY_LOWEST + 1; +pub const THREAD_PRIORITY_NORMAL: DWORD = 0; +pub const THREAD_PRIORITY_HIGHEST: DWORD = THREAD_BASE_PRIORITY_MAX; +pub const THREAD_PRIORITY_ABOVE_NORMAL: DWORD = THREAD_PRIORITY_HIGHEST - 1; +pub const THREAD_PRIORITY_ERROR_RETURN: DWORD = MAXLONG as u32; +pub const THREAD_PRIORITY_TIME_CRITICAL: DWORD = THREAD_BASE_PRIORITY_LOWRT; +pub const THREAD_PRIORITY_IDLE: DWORD = THREAD_BASE_PRIORITY_IDLE; +pub const THREAD_MODE_BACKGROUND_BEGIN: DWORD = 0x00010000; +pub const THREAD_MODE_BACKGROUND_END: DWORD = 0x00020000; +pub const VOLUME_NAME_DOS: DWORD = 0x0; +// VOLUME_NAME_* +// FILE_NAME_* +// JIT_DEBUG_* +pub const DRIVE_UNKNOWN: DWORD = 0; +pub const DRIVE_NO_ROOT_DIR: DWORD = 1; +pub const DRIVE_REMOVABLE: DWORD = 2; +pub const DRIVE_FIXED: DWORD = 3; +pub const DRIVE_REMOTE: DWORD = 4; +pub const DRIVE_CDROM: DWORD = 5; +pub const DRIVE_RAMDISK: DWORD = 6; +// pub fn GetFreeSpace(); +pub const FILE_TYPE_UNKNOWN: DWORD = 0x0000; +pub const FILE_TYPE_DISK: DWORD = 0x0001; +pub const FILE_TYPE_CHAR: DWORD = 0x0002; +pub const FILE_TYPE_PIPE: DWORD = 0x0003; +pub const FILE_TYPE_REMOTE: DWORD = 0x8000; +pub const STD_INPUT_HANDLE: DWORD = 0xFFFFFFF6; +pub const STD_OUTPUT_HANDLE: DWORD = 0xFFFFFFF5; +pub const STD_ERROR_HANDLE: DWORD = 0xFFFFFFF4; +pub const NOPARITY: BYTE = 0; +pub const ODDPARITY: BYTE = 1; +pub const EVENPARITY: BYTE = 2; +pub const MARKPARITY: BYTE = 3; +pub const SPACEPARITY: BYTE = 4; +pub const ONESTOPBIT: BYTE = 0; +pub const ONE5STOPBITS: BYTE = 1; +pub const TWOSTOPBITS: BYTE = 2; +pub const IGNORE: DWORD = 0; +pub const INFINITE: DWORD = 0xFFFFFFFF; +pub const CBR_110: DWORD = 110; +pub const CBR_300: DWORD = 300; +pub const CBR_600: DWORD = 600; +pub const CBR_1200: DWORD = 1200; +pub const CBR_2400: DWORD = 2400; +pub const CBR_4800: DWORD = 4800; +pub const CBR_9600: DWORD = 9600; +pub const CBR_14400: DWORD = 14400; +pub const CBR_19200: DWORD = 19200; +pub const CBR_38400: DWORD = 38400; +pub const CBR_56000: DWORD = 56000; +pub const CBR_57600: DWORD = 57600; +pub const CBR_115200: DWORD = 115200; +pub const CBR_128000: DWORD = 128000; +pub const CBR_256000: DWORD = 256000; +// CE_* +// IE_* +// EV_* +pub const SETXOFF: DWORD = 1; +pub const SETXON: DWORD = 2; +pub const SETRTS: DWORD = 3; +pub const CLRRTS: DWORD = 4; +pub const SETDTR: DWORD = 5; +pub const CLRDTR: DWORD = 6; +pub const RESETDEV: DWORD = 7; +pub const SETBREAK: DWORD = 8; +pub const CLRBREAK: DWORD = 9; +// PURGE_* +pub const MS_CTS_ON: DWORD = 0x0010; +pub const MS_DSR_ON: DWORD = 0x0020; +pub const MS_RING_ON: DWORD = 0x0040; +pub const MS_RLSD_ON: DWORD = 0x0080; +// S_* +// NMPWAIT_* +// FS_* +// OF_* +pub const OFS_MAXPATHNAME: usize = 128; +STRUCT!{struct OFSTRUCT { + cBytes: BYTE, + fFixedDisk: BYTE, + nErrCode: WORD, + Reserved1: WORD, + Reserved2: WORD, + szPathName: [CHAR; OFS_MAXPATHNAME], +}} +pub type POFSTRUCT = *mut OFSTRUCT; +pub type LPOFSTRUCT = *mut OFSTRUCT; +extern "system" { + pub fn GlobalAlloc( + uFlags: UINT, + dwBytes: SIZE_T + ) -> HGLOBAL; + pub fn GlobalReAlloc( + hMem: HGLOBAL, + dwBytes: SIZE_T, + uFlags: UINT + ) -> HGLOBAL; + pub fn GlobalSize( + hMem: HGLOBAL + ) -> SIZE_T; + pub fn GlobalFlags( + hMem: HGLOBAL + ) -> UINT; + pub fn GlobalLock( + hMem: HGLOBAL + ) -> LPVOID; + pub fn GlobalHandle( + pMem: LPCVOID + ) -> HGLOBAL; + pub fn GlobalUnlock( + hMem: HGLOBAL + ) -> BOOL; + pub fn GlobalFree( + hMem: HGLOBAL + ) -> HGLOBAL; + pub fn GlobalCompact( + dwMinFree: DWORD + ) -> SIZE_T; + pub fn GlobalFix( + hMem: HGLOBAL + ); + pub fn GlobalUnfix( + hMem: HGLOBAL + ); + pub fn GlobalWire( + hMem: HGLOBAL + ) -> LPVOID; + pub fn GlobalUnWire( + hMem: HGLOBAL + ) -> BOOL; + pub fn GlobalMemoryStatus( + lpBuffer: LPMEMORYSTATUS + ); + pub fn LocalAlloc( + uFlags: UINT, + uBytes: SIZE_T + ) -> HLOCAL; + pub fn LocalReAlloc( + hMem: HLOCAL, + uBytes: SIZE_T, + uFlags: UINT + ) -> HLOCAL; + pub fn LocalLock( + hMem: HLOCAL + ) -> LPVOID; + pub fn LocalHandle( + pMem: LPCVOID + ) -> HLOCAL; + pub fn LocalUnlock( + hMem: HLOCAL + ) -> BOOL; + pub fn LocalSize( + hMem: HLOCAL + ) -> SIZE_T; + pub fn LocalFlags( + hMem: HLOCAL, + ) -> UINT; + pub fn LocalFree( + hMem: HLOCAL + ) -> HLOCAL; + pub fn LocalShrink( + hMem: HLOCAL, + cbNewSize: UINT + ) -> SIZE_T; + pub fn LocalCompact( + uMinFree: UINT + ) -> SIZE_T; +} +// SCS_* +extern "system" { + pub fn GetBinaryTypeA( + lpApplicationName: LPCSTR, + lpBinaryType: LPDWORD + ) -> BOOL; + pub fn GetBinaryTypeW( + lpApplicationName: LPCWSTR, + lpBinaryType: LPDWORD + ) -> BOOL; + pub fn GetShortPathNameA( + lpszLongPath: LPCSTR, + lpszShortPath: LPSTR, + cchBuffer: DWORD, + ) -> DWORD; + pub fn GetLongPathNameTransactedA( + lpszShortPath: LPCSTR, + lpszLongPath: LPSTR, + cchBuffer: DWORD, + hTransaction: HANDLE, + ) -> DWORD; + pub fn GetLongPathNameTransactedW( + lpszShortPath: LPCWSTR, + lpszLongPath: LPWSTR, + cchBuffer: DWORD, + hTransaction: HANDLE, + ) -> DWORD; + pub fn GetProcessAffinityMask( + hProcess: HANDLE, + lpProcessAffinityMask: PDWORD_PTR, + lpSystemAffinityMask: PDWORD_PTR, + ) -> BOOL; + pub fn SetProcessAffinityMask( + hProcess: HANDLE, + dwProcessAffinityMask: DWORD + ) -> BOOL; + pub fn GetProcessIoCounters( + hProcess: HANDLE, + lpIoCounters: PIO_COUNTERS + ) -> BOOL; + pub fn GetProcessWorkingSetSize( + hProcess: HANDLE, + lpMinimumWorkingSetSize: PSIZE_T, + lpMaximumWorkingSetSize: PSIZE_T, + ) -> BOOL; + pub fn SetProcessWorkingSetSize( + hProcess: HANDLE, + dwMinimumWorkingSetSize: SIZE_T, + dwMaximumWorkingSetSize: SIZE_T, + ) -> BOOL; + pub fn FatalExit( + ExitCode: c_int + ); + pub fn SetEnvironmentStringsA( + NewEnvironment: LPCH + ) -> BOOL; + pub fn SwitchToFiber( + lpFiber: LPVOID + ); + pub fn DeleteFiber( + lpFiber: LPVOID + ); + pub fn ConvertFiberToThread() -> BOOL; + pub fn CreateFiberEx( + dwStackCommitSize: SIZE_T, + dwStackReserveSize: SIZE_T, + dwFlags: DWORD, + lpStartAddress: LPFIBER_START_ROUTINE, + lpParameter: LPVOID, + ) -> LPVOID; + pub fn ConvertThreadToFiberEx( + lpParameter: LPVOID, + dwFlags: DWORD + ) -> LPVOID; + pub fn CreateFiber( + dwStackSize: SIZE_T, + lpStartAddress: LPFIBER_START_ROUTINE, + lpParameter: LPVOID, + ) -> LPVOID; + pub fn ConvertThreadToFiber( + lpParameter: LPVOID + ) -> LPVOID; +} +pub type PUMS_CONTEXT = *mut c_void; +pub type PUMS_COMPLETION_LIST = *mut c_void; +pub type UMS_THREAD_INFO_CLASS = RTL_UMS_THREAD_INFO_CLASS; +pub type PUMS_THREAD_INFO_CLASS = *mut UMS_THREAD_INFO_CLASS; +pub type PUMS_SCHEDULER_ENTRY_POINT = PRTL_UMS_SCHEDULER_ENTRY_POINT; +STRUCT!{struct UMS_SCHEDULER_STARTUP_INFO { + UmsVersion: ULONG, + CompletionList: PUMS_COMPLETION_LIST, + SchedulerProc: PUMS_SCHEDULER_ENTRY_POINT, + SchedulerParam: PVOID, +}} +pub type PUMS_SCHEDULER_STARTUP_INFO = *mut UMS_SCHEDULER_STARTUP_INFO; +STRUCT!{struct UMS_SYSTEM_THREAD_INFORMATION { + UmsVersion: ULONG, + ThreadUmsFlags: ULONG, +}} +BITFIELD!{UMS_SYSTEM_THREAD_INFORMATION ThreadUmsFlags: ULONG [ + IsUmsSchedulerThread set_IsUmsSchedulerThread[0..1], + IsUmsWorkerThread set_IsUmsWorkerThread[1..2], +]} +pub type PUMS_SYSTEM_THREAD_INFORMATION = *mut UMS_SYSTEM_THREAD_INFORMATION; +extern "system" { + #[cfg(target_arch = "x86_64")] + pub fn CreateUmsCompletionList( + UmsCompletionList: *mut PUMS_COMPLETION_LIST + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn DequeueUmsCompletionListItems( + UmsCompletionList: PUMS_COMPLETION_LIST, + WaitTimeOut: DWORD, + UmsThreadList: *mut PUMS_CONTEXT, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn GetUmsCompletionListEvent( + UmsCompletionList: PUMS_COMPLETION_LIST, + UmsCompletionEvent: PHANDLE, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn ExecuteUmsThread( + UmsThread: PUMS_CONTEXT + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn UmsThreadYield( + SchedulerParam: PVOID + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn DeleteUmsCompletionList( + UmsCompletionList: PUMS_COMPLETION_LIST + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn GetCurrentUmsThread() -> PUMS_CONTEXT; + #[cfg(target_arch = "x86_64")] + pub fn GetNextUmsListItem( + UmsContext: PUMS_CONTEXT + ) -> PUMS_CONTEXT; + #[cfg(target_arch = "x86_64")] + pub fn QueryUmsThreadInformation( + UmsThread: PUMS_CONTEXT, + UmsThreadInfoClass: UMS_THREAD_INFO_CLASS, + UmsThreadInformation: PVOID, + UmsThreadInformationLength: ULONG, + ReturnLength: PULONG, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn SetUmsThreadInformation( + UmsThread: PUMS_CONTEXT, + UmsThreadInfoClass: UMS_THREAD_INFO_CLASS, + UmsThreadInformation: PVOID, + UmsThreadInformationLength: ULONG, + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn DeleteUmsThreadContext( + UmsThread: PUMS_CONTEXT + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn CreateUmsThreadContext( + lpUmsThread: *mut PUMS_CONTEXT + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn EnterUmsSchedulingMode( + SchedulerStartupInfo: PUMS_SCHEDULER_STARTUP_INFO + ) -> BOOL; + #[cfg(target_arch = "x86_64")] + pub fn GetUmsSystemThreadInformation( + ThreadHandle: HANDLE, + SystemThreadInfo: PUMS_SYSTEM_THREAD_INFORMATION, + ) -> BOOL; + pub fn SetThreadAffinityMask( + hThread: HANDLE, + dwThreadAffinityMask: DWORD_PTR + ) -> DWORD_PTR; + pub fn SetProcessDEPPolicy( + dwFlags: DWORD + ) -> BOOL; + pub fn GetProcessDEPPolicy( + hProcess: HANDLE, + lpFlags: LPDWORD, + lpPermanent: PBOOL + ) -> BOOL; + pub fn RequestWakeupLatency( + latency: LATENCY_TIME + ) -> BOOL; + pub fn IsSystemResumeAutomatic() -> BOOL; + pub fn GetThreadSelectorEntry( + hThread: HANDLE, + dwSelector: DWORD, + lpSelectorEntry: LPLDT_ENTRY, + ) -> BOOL; + pub fn SetThreadExecutionState( + esFlags: EXECUTION_STATE + ) -> EXECUTION_STATE; + pub fn PowerCreateRequest( + Context: PREASON_CONTEXT + ) -> HANDLE; + pub fn PowerSetRequest( + PowerRequest: HANDLE, + RequestType: POWER_REQUEST_TYPE + ) -> BOOL; + pub fn PowerClearRequest( + PowerRequest: HANDLE, + RequestType: POWER_REQUEST_TYPE + ) -> BOOL; + pub fn RestoreLastError( + dwErrCode: DWORD + ); + pub fn SetFileCompletionNotificationModes( + FileHandle: HANDLE, + Flags: UCHAR + ) -> BOOL; +} +pub const SEM_FAILCRITICALERRORS: UINT = 0x0001; +pub const SEM_NOGPFAULTERRORBOX: UINT = 0x0002; +pub const SEM_NOALIGNMENTFAULTEXCEPT: UINT = 0x0004; +pub const SEM_NOOPENFILEERRORBOX: UINT = 0x8000; +extern "system" { + pub fn Wow64GetThreadContext( + hThread: HANDLE, + lpContext: PWOW64_CONTEXT + ) -> BOOL; + pub fn Wow64SetThreadContext( + hThread: HANDLE, + lpContext: *const WOW64_CONTEXT + ) -> BOOL; + pub fn Wow64GetThreadSelectorEntry( + hThread: HANDLE, + dwSelector: DWORD, + lpSelectorEntry: PWOW64_LDT_ENTRY, + ) -> BOOL; + pub fn Wow64SuspendThread( + hThread: HANDLE + ) -> DWORD; + pub fn DebugSetProcessKillOnExit( + KillOnExit: BOOL + ) -> BOOL; + pub fn DebugBreakProcess( + Process: HANDLE + ) -> BOOL; + pub fn PulseEvent( + hEvent: HANDLE + ) -> BOOL; + pub fn GlobalDeleteAtom( + nAtom: ATOM + ) -> ATOM; + pub fn InitAtomTable( + nSize: DWORD + ) -> BOOL; + pub fn DeleteAtom( + nAtom: ATOM + ) -> ATOM; + pub fn SetHandleCount( + uNumber: UINT + ) -> UINT; + pub fn RequestDeviceWakeup( + hDevice: HANDLE + ) -> BOOL; + pub fn CancelDeviceWakeupRequest( + hDevice: HANDLE + ) -> BOOL; + pub fn GetDevicePowerState( + hDevice: HANDLE, + pfOn: *mut BOOL + ) -> BOOL; + pub fn SetMessageWaitingIndicator( + hMsgIndicator: HANDLE, + ulMsgCount: ULONG + ) -> BOOL; + pub fn SetFileShortNameA( + hFile: HANDLE, + lpShortName: LPCSTR + ) -> BOOL; + pub fn SetFileShortNameW( + hFile: HANDLE, + lpShortName: LPCWSTR + ) -> BOOL; + pub fn LoadModule( + lpModuleName: LPCSTR, + lpParameterBlock: LPVOID + ) -> DWORD; + pub fn WinExec( + lpCmdLine: LPCSTR, + uCmdShow: UINT + ) -> UINT; + // ClearCommBreak + // ClearCommError + // SetupComm + // EscapeCommFunction + // GetCommConfig + // GetCommMask + // GetCommProperties + // GetCommModemStatus + // GetCommState + // GetCommTimeouts + // PurgeComm + // SetCommBreak + // SetCommConfig + // SetCommMask + // SetCommState + // SetCommTimeouts + // TransmitCommChar + // WaitCommEvent + pub fn SetTapePosition( + hDevice: HANDLE, + dwPositionMethod: DWORD, + dwPartition: DWORD, + dwOffsetLow: DWORD, + dwOffsetHigh: DWORD, + bImmediate: BOOL + ) -> DWORD; + pub fn GetTapePosition( + hDevice: HANDLE, + dwPositionType: DWORD, + lpdwPartition: LPDWORD, + lpdwOffsetLow: LPDWORD, + lpdwOffsetHigh: LPDWORD + ) -> DWORD; + pub fn PrepareTape( + hDevice: HANDLE, + dwOperation: DWORD, + bImmediate: BOOL + ) -> DWORD; + pub fn EraseTape( + hDevice: HANDLE, + dwEraseType: DWORD, + bImmediate: BOOL + ) -> DWORD; + pub fn CreateTapePartition( + hDevice: HANDLE, + dwPartitionMethod: DWORD, + dwCount: DWORD, + dwSize: DWORD, + ) -> DWORD; + pub fn WriteTapemark( + hDevice: HANDLE, + dwTapemarkType: DWORD, + dwTapemarkCount: DWORD, + bImmediate: BOOL, + ) -> DWORD; + pub fn GetTapeStatus( + hDevice: HANDLE + ) -> DWORD; + pub fn GetTapeParameters( + hDevice: HANDLE, + dwOperation: DWORD, + lpdwSize: LPDWORD, + lpTapeInformation: LPVOID + ) -> DWORD; + pub fn SetTapeParameters( + hDevice: HANDLE, + dwOperation: DWORD, + lpTapeInformation: LPVOID, + ) -> DWORD; + pub fn MulDiv( + nNumber: c_int, + nNumerator: c_int, + nDenominator: c_int + ) -> c_int; +} +ENUM!{enum DEP_SYSTEM_POLICY_TYPE { + DEPPolicyAlwaysOff = 0, + DEPPolicyAlwaysOn, + DEPPolicyOptIn, + DEPPolicyOptOut, + DEPTotalPolicyCount, +}} +extern "system" { + pub fn GetSystemDEPPolicy() -> DEP_SYSTEM_POLICY_TYPE; + pub fn GetSystemRegistryQuota( + pdwQuotaAllowed: PDWORD, + pdwQuotaUsed: PDWORD + ) -> BOOL; + pub fn FileTimeToDosDateTime( + lpFileTime: *const FILETIME, + lpFatDate: LPWORD, + lpFatTime: LPWORD, + ) -> BOOL; + pub fn DosDateTimeToFileTime( + wFatDate: WORD, + wFatTime: WORD, + lpFileTime: LPFILETIME + ) -> BOOL; + pub fn FormatMessageA( + dwFlags: DWORD, + lpSource: LPCVOID, + dwMessageId: DWORD, + dwLanguageId: DWORD, + lpBuffer: LPSTR, + nSize: DWORD, + Arguments: *mut va_list, + ) -> DWORD; + pub fn FormatMessageW( + dwFlags: DWORD, + lpSource: LPCVOID, + dwMessageId: DWORD, + dwLanguageId: DWORD, + lpBuffer: LPWSTR, + nSize: DWORD, + Arguments: *mut va_list, + ) -> DWORD; +} +pub const FORMAT_MESSAGE_IGNORE_INSERTS: DWORD = 0x00000200; +pub const FORMAT_MESSAGE_FROM_STRING: DWORD = 0x00000400; +pub const FORMAT_MESSAGE_FROM_HMODULE: DWORD = 0x00000800; +pub const FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000; +pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: DWORD = 0x00002000; +pub const FORMAT_MESSAGE_MAX_WIDTH_MASK: DWORD = 0x000000FF; +pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: DWORD = 0x00000100; +extern "system" { + pub fn CreateMailslotA( + lpName: LPCSTR, + nMaxMessageSize: DWORD, + lReadTimeout: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn CreateMailslotW( + lpName: LPCWSTR, + nMaxMessageSize: DWORD, + lReadTimeout: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn GetMailslotInfo( + hMailslot: HANDLE, + lpMaxMessageSize: LPDWORD, + lpNextSize: LPDWORD, + lpMessageCount: LPDWORD, + lpReadTimeout: LPDWORD, + ) -> BOOL; + pub fn SetMailslotInfo( + hMailslot: HANDLE, + lReadTimeout: DWORD + ) -> BOOL; + // pub fn EncryptFileA(); + // pub fn EncryptFileW(); + // pub fn DecryptFileA(); + // pub fn DecryptFileW(); + // pub fn FileEncryptionStatusA(); + // pub fn FileEncryptionStatusW(); + // pub fn OpenEncryptedFileRawA(); + // pub fn OpenEncryptedFileRawW(); + // pub fn ReadEncryptedFileRaw(); + // pub fn WriteEncryptedFileRaw(); + // pub fn CloseEncryptedFileRaw(); + pub fn lstrcmpA( + lpString1: LPCSTR, + lpString2: LPCSTR + ) -> c_int; + pub fn lstrcmpW( + lpString1: LPCWSTR, + lpString2: LPCWSTR + ) -> c_int; + pub fn lstrcmpiA( + lpString1: LPCSTR, + lpString2: LPCSTR + ) -> c_int; + pub fn lstrcmpiW( + lpString1: LPCWSTR, + lpString2: LPCWSTR + ) -> c_int; + pub fn lstrcpynA( + lpString1: LPSTR, + lpString2: LPCSTR, + iMaxLength: c_int + ) -> LPSTR; + pub fn lstrcpynW( + lpString1: LPWSTR, + lpString2: LPCWSTR, + iMaxLength: c_int + ) -> LPSTR; + pub fn lstrcpyA( + lpString1: LPSTR, + lpString2: LPCSTR + ) -> LPSTR; + pub fn lstrcpyW( + lpString1: LPWSTR, + lpString2: LPCWSTR + ) -> LPSTR; + pub fn lstrcatA( + lpString1: LPSTR, + lpString2: LPCSTR + ) -> LPSTR; + pub fn lstrcatW( + lpString1: LPWSTR, + lpString2: LPCWSTR + ) -> LPSTR; + pub fn lstrlenA( + lpString: LPCSTR + ) -> c_int; + pub fn lstrlenW( + lpString: LPCWSTR + ) -> c_int; + pub fn OpenFile( + lpFileName: LPCSTR, + lpReOpenBuff: LPOFSTRUCT, + uStyle: UINT + ) -> HFILE; + pub fn _lopen( + lpPathName: LPCSTR, + iReadWrite: c_int + ) -> HFILE; + pub fn _lcreat( + lpPathName: LPCSTR, + iAttrubute: c_int + ) -> HFILE; + pub fn _lread( + hFile: HFILE, + lpBuffer: LPVOID, + uBytes: UINT + ) -> UINT; + pub fn _lwrite( + hFile: HFILE, + lpBuffer: LPCCH, + uBytes: UINT + ) -> UINT; + pub fn _hread( + hFile: HFILE, + lpBuffer: LPVOID, + lBytes: c_long + ) -> c_long; + pub fn _hwrite( + hFile: HFILE, + lpBuffer: LPCCH, + lBytes: c_long + ) -> c_long; + pub fn _lclose( + hFile: HFILE + ) -> HFILE; + pub fn _llseek( + hFile: HFILE, + lOffset: LONG, + iOrigin: c_int + ) -> LONG; + // pub fn IsTextUnicode(); + // pub fn SignalObjectAndWait(); + pub fn BackupRead( + hFile: HANDLE, + lpBuffer: LPBYTE, + nNumberOfBytesToRead: DWORD, + lpNumberOfBytesRead: LPDWORD, + bAbort: BOOL, + bProcessSecurity: BOOL, + lpContext: *mut LPVOID, + ) -> BOOL; + pub fn BackupSeek( + hFile: HANDLE, + dwLowBytesToSeek: DWORD, + dwHighBytesToSeek: DWORD, + lpdwLowByteSeeked: LPDWORD, + lpdwHighByteSeeked: LPDWORD, + lpContext: *mut LPVOID, + ) -> BOOL; + pub fn BackupWrite( + hFile: HANDLE, + lpBuffer: LPBYTE, + nNumberOfBytesToWrite: DWORD, + lpNumberOfBytesWritten: LPDWORD, + bAbort: BOOL, + bProcessSecurity: BOOL, + lpContext: *mut LPVOID, + ) -> BOOL; +} +//2886 +pub const STARTF_USESHOWWINDOW: DWORD = 0x00000001; +pub const STARTF_USESIZE: DWORD = 0x00000002; +pub const STARTF_USEPOSITION: DWORD = 0x00000004; +pub const STARTF_USECOUNTCHARS: DWORD = 0x00000008; +pub const STARTF_USEFILLATTRIBUTE: DWORD = 0x00000010; +pub const STARTF_RUNFULLSCREEN: DWORD = 0x00000020; +pub const STARTF_FORCEONFEEDBACK: DWORD = 0x00000040; +pub const STARTF_FORCEOFFFEEDBACK: DWORD = 0x00000080; +pub const STARTF_USESTDHANDLES: DWORD = 0x00000100; +pub const STARTF_USEHOTKEY: DWORD = 0x00000200; +pub const STARTF_TITLEISLINKNAME: DWORD = 0x00000800; +pub const STARTF_TITLEISAPPID: DWORD = 0x00001000; +pub const STARTF_PREVENTPINNING: DWORD = 0x00002000; +pub const STARTF_UNTRUSTEDSOURCE: DWORD = 0x00008000; +extern "system" { + pub fn OpenMutexA( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCSTR + ) -> HANDLE; + pub fn CreateSemaphoreA( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, + lInitialCount: LONG, + lMaximumCount: LONG, + lpName: LPCSTR, + ) -> HANDLE; + pub fn OpenSemaphoreA( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCSTR + ) -> HANDLE; + pub fn CreateWaitableTimerA( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, + bManualReset: BOOL, + lpTimerName: LPCSTR, + ) -> HANDLE; + pub fn OpenWaitableTimerA( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpTimerName: LPCSTR, + ) -> HANDLE; + pub fn CreateSemaphoreExA( + lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, + lInitialCount: LONG, + lMaximumCount: LONG, + lpName: LPCSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateWaitableTimerExA( + lpTimerAttributes: LPSECURITY_ATTRIBUTES, + lpTimerName: LPCSTR, + dwFlags: DWORD, + dwDesiredAccess: DWORD, + ) -> HANDLE; + pub fn CreateFileMappingA( + hFile: HANDLE, + lpAttributes: LPSECURITY_ATTRIBUTES, + flProtect: DWORD, + dwMaximumSizeHigh: DWORD, + dwMaximumSizeLow: DWORD, + lpName: LPCSTR, + ) -> HANDLE; + pub fn CreateFileMappingNumaA( + hFile: HANDLE, + lpFileMappingAttributes: LPSECURITY_ATTRIBUTES, + flProtect: DWORD, + dwMaximumSizeHigh: DWORD, + dwMaximumSizeLow: DWORD, + lpName: LPCSTR, + nndPreferred: DWORD, + ) -> HANDLE; + pub fn OpenFileMappingA( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCSTR, + ) -> HANDLE; + pub fn GetLogicalDriveStringsA( + nBufferLength: DWORD, + lpBuffer: LPSTR + ) -> DWORD; + pub fn LoadPackagedLibrary( + lpwLibFileName: LPCWSTR, + Reserved: DWORD + ) -> HMODULE; + pub fn QueryFullProcessImageNameA( + hProcess: HANDLE, + dwFlags: DWORD, + lpExeName: LPSTR, + lpdwSize: PDWORD, + ) -> BOOL; + pub fn QueryFullProcessImageNameW( + hProcess: HANDLE, + dwFlags: DWORD, + lpExeName: LPWSTR, + lpdwSize: PDWORD, + ) -> BOOL; +} +//3233 +extern "system" { + pub fn GetStartupInfoA( + lpStartupInfo: LPSTARTUPINFOA + ); + pub fn GetFirmwareEnvironmentVariableA( + lpName: LPCSTR, + lpGuid: LPCSTR, + pBuffer: PVOID, + nSize: DWORD, + ) -> DWORD; + pub fn GetFirmwareEnvironmentVariableW( + lpName: LPCWSTR, + lpGuid: LPCWSTR, + pBuffer: PVOID, + nSize: DWORD, + ) -> DWORD; + pub fn GetFirmwareEnvironmentVariableExA( + lpName: LPCSTR, + lpGuid: LPCSTR, + pBuffer: PVOID, + nSize: DWORD, + pdwAttribubutes: PDWORD, + ) -> DWORD; + pub fn GetFirmwareEnvironmentVariableExW( + lpName: LPCWSTR, + lpGuid: LPCWSTR, + pBuffer: PVOID, + nSize: DWORD, + pdwAttribubutes: PDWORD, + ) -> DWORD; + pub fn SetFirmwareEnvironmentVariableA( + lpName: LPCSTR, + lpGuid: LPCSTR, + pValue: PVOID, + nSize: DWORD, + ) -> BOOL; + pub fn SetFirmwareEnvironmentVariableW( + lpName: LPCWSTR, + lpGuid: LPCWSTR, + pValue: PVOID, + nSize: DWORD, + ) -> BOOL; + pub fn SetFirmwareEnvironmentVariableExA( + lpName: LPCSTR, + lpGuid: LPCSTR, + pValue: PVOID, + nSize: DWORD, + dwAttributes: DWORD, + ) -> BOOL; + pub fn SetFirmwareEnvironmentVariableExW( + lpName: LPCWSTR, + lpGuid: LPCWSTR, + pValue: PVOID, + nSize: DWORD, + dwAttributes: DWORD, + ) -> BOOL; + pub fn GetFirmwareType( + FirmwareType: PFIRMWARE_TYPE + ) -> BOOL; + pub fn IsNativeVhdBoot( + NativeVhdBoot: PBOOL + ) -> BOOL; + pub fn FindResourceA( + hModule: HMODULE, + lpName: LPCSTR, + lpType: LPCSTR + ) -> HRSRC; + pub fn FindResourceExA( + hModule: HMODULE, + lpName: LPCSTR, + lpType: LPCSTR, + wLanguage: WORD, + ) -> HRSRC; + pub fn EnumResourceTypesA( + hModule: HMODULE, + lpEnumFunc: ENUMRESTYPEPROCA, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceTypesW( + hModule: HMODULE, + lpEnumFunc: ENUMRESTYPEPROCW, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceNamesA( + hModule: HMODULE, + lpType: LPCSTR, + lpEnumFunc: ENUMRESNAMEPROCA, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceLanguagesA( + hModule: HMODULE, + lpType: LPCSTR, + lpName: LPCSTR, + lpEnumFunc: ENUMRESLANGPROCA, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumResourceLanguagesW( + hModule: HMODULE, + lpType: LPCWSTR, + lpName: LPCWSTR, + lpEnumFunc: ENUMRESLANGPROCW, + lParam: LONG_PTR, + ) -> BOOL; + pub fn BeginUpdateResourceA( + pFileName: LPCSTR, + bDeleteExistingResources: BOOL + ) -> HANDLE; + pub fn BeginUpdateResourceW( + pFileName: LPCWSTR, + bDeleteExistingResources: BOOL + ) -> HANDLE; + pub fn UpdateResourceA( + hUpdate: HANDLE, + lpType: LPCSTR, + lpName: LPCSTR, + wLanguage: WORD, + lpData: LPVOID, + cb: DWORD, + ) -> BOOL; + pub fn UpdateResourceW( + hUpdate: HANDLE, + lpType: LPCWSTR, + lpName: LPCWSTR, + wLanguage: WORD, + lpData: LPVOID, + cb: DWORD, + ) -> BOOL; + pub fn EndUpdateResourceA( + hUpdate: HANDLE, + fDiscard: BOOL + ) -> BOOL; + pub fn EndUpdateResourceW( + hUpdate: HANDLE, + fDiscard: BOOL + ) -> BOOL; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn GlobalAddAtomA( + lpString: LPCSTR + ) -> ATOM; + pub fn GlobalAddAtomW( + lpString: LPCWSTR + ) -> ATOM; + pub fn GlobalAddAtomExA( + lpString: LPCSTR, + Flags: DWORD + ) -> ATOM; + pub fn GlobalAddAtomExW( + lpString: LPCWSTR, + Flags: DWORD + ) -> ATOM; + pub fn GlobalFindAtomA( + lpString: LPCSTR + ) -> ATOM; + pub fn GlobalFindAtomW( + lpString: LPCWSTR + ) -> ATOM; + pub fn GlobalGetAtomNameA( + nAtom: ATOM, + lpBuffer: LPSTR, + nSize: c_int + ) -> UINT; + pub fn GlobalGetAtomNameW( + nAtom: ATOM, + lpBuffer: LPWSTR, + nSize: c_int + ) -> UINT; + pub fn AddAtomA( + lpString: LPCSTR + ) -> ATOM; + pub fn AddAtomW( + lpString: LPCWSTR + ) -> ATOM; + pub fn FindAtomA( + lpString: LPCSTR + ) -> ATOM; + pub fn FindAtomW( + lpString: LPCWSTR + ) -> ATOM; + pub fn GetAtomNameA( + nAtom: ATOM, + lpBuffer: LPSTR, + nSize: c_int + ) -> UINT; + pub fn GetAtomNameW( + nAtom: ATOM, + lpBuffer: LPWSTR, + nSize: c_int + ) -> UINT; + pub fn GetProfileIntA( + lpAppName: LPCSTR, + lpKeyName: LPCSTR, + nDefault: INT + ) -> UINT; + pub fn GetProfileIntW( + lpAppName: LPCWSTR, + lpKeyName: LPCWSTR, + nDefault: INT + ) -> UINT; + pub fn GetProfileStringA( + lpAppName: LPCSTR, + lpKeyName: LPCSTR, + lpDefault: LPCSTR, + lpReturnedString: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetProfileStringW( + lpAppName: LPCWSTR, + lpKeyName: LPCWSTR, + lpDefault: LPCWSTR, + lpReturnedString: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn WriteProfileStringA( + lpAppName: LPCSTR, + lpKeyName: LPCSTR, + lpString: LPCSTR + ) -> BOOL; + pub fn WriteProfileStringW( + lpAppName: LPCWSTR, + lpKeyName: LPCWSTR, + lpString: LPCWSTR + ) -> BOOL; + pub fn GetProfileSectionA( + lpAppName: LPCSTR, + lpReturnedString: LPSTR, + nSize: DWORD + ) -> DWORD; + pub fn GetProfileSectionW( + lpAppName: LPCWSTR, + lpReturnedString: LPWSTR, + nSize: DWORD + ) -> DWORD; + pub fn WriteProfileSectionA( + lpAppName: LPCSTR, + lpString: LPCSTR + ) -> BOOL; + pub fn WriteProfileSectionW( + lpAppName: LPCWSTR, + lpString: LPCWSTR + ) -> BOOL; + pub fn GetPrivateProfileIntA( + lpAppName: LPCSTR, + lpKeyName: LPCSTR, + nDefault: INT, + lpFileName: LPCSTR, + ) -> UINT; + pub fn GetPrivateProfileIntW( + lpAppName: LPCWSTR, + lpKeyName: LPCWSTR, + nDefault: INT, + lpFileName: LPCWSTR, + ) -> UINT; + pub fn GetPrivateProfileStringA( + lpAppName: LPCSTR, + lpKeyName: LPCSTR, + lpDefault: LPCSTR, + lpReturnedString: LPSTR, + nSize: DWORD, + lpFileName: LPCSTR, + ) -> DWORD; + pub fn GetPrivateProfileStringW( + lpAppName: LPCWSTR, + lpKeyName: LPCWSTR, + lpDefault: LPCWSTR, + lpReturnedString: LPWSTR, + nSize: DWORD, + lpFileName: LPCWSTR, + ) -> DWORD; + pub fn WritePrivateProfileStringA( + lpAppName: LPCSTR, + lpKeyName: LPCSTR, + lpString: LPCSTR, + lpFileName: LPCSTR, + ) -> BOOL; + pub fn WritePrivateProfileStringW( + lpAppName: LPCWSTR, + lpKeyName: LPCWSTR, + lpString: LPCWSTR, + lpFileName: LPCWSTR, + ) -> BOOL; + pub fn GetPrivateProfileSectionA( + lpAppName: LPCSTR, + lpReturnedString: LPSTR, + nSize: DWORD, + lpFileName: LPCSTR, + ) -> DWORD; + pub fn GetPrivateProfileSectionW( + lpAppName: LPCWSTR, + lpReturnedString: LPWSTR, + nSize: DWORD, + lpFileName: LPCWSTR, + ) -> DWORD; + pub fn WritePrivateProfileSectionA( + lpAppName: LPCSTR, + lpString: LPCSTR, + lpFileName: LPCSTR, + ) -> BOOL; + pub fn WritePrivateProfileSectionW( + lpAppName: LPCWSTR, + lpString: LPCWSTR, + lpFileName: LPCWSTR, + ) -> BOOL; + pub fn GetPrivateProfileSectionNamesA( + lpszReturnBuffer: LPSTR, + nSize: DWORD, + lpFileName: LPCSTR, + ) -> DWORD; + pub fn GetPrivateProfileSectionNamesW( + lpszReturnBuffer: LPWSTR, + nSize: DWORD, + lpFileName: LPCWSTR, + ) -> DWORD; + pub fn GetPrivateProfileStructA( + lpszSection: LPCSTR, + lpszKey: LPCSTR, + lpStruct: LPVOID, + uSizeStruct: UINT, + szFile: LPCSTR, + ) -> BOOL; + pub fn GetPrivateProfileStructW( + lpszSection: LPCWSTR, + lpszKey: LPCWSTR, + lpStruct: LPVOID, + uSizeStruct: UINT, + szFile: LPCWSTR, + ) -> BOOL; + pub fn WritePrivateProfileStructA( + lpszSection: LPCSTR, + lpszKey: LPCSTR, + lpStruct: LPVOID, + uSizeStruct: UINT, + szFile: LPCSTR, + ) -> BOOL; + pub fn WritePrivateProfileStructW( + lpszSection: LPCWSTR, + lpszKey: LPCWSTR, + lpStruct: LPVOID, + uSizeStruct: UINT, + szFile: LPCWSTR, + ) -> BOOL; + pub fn Wow64EnableWow64FsRedirection( + Wow64FsEnableRedirection: BOOLEAN + ) -> BOOLEAN; + pub fn SetDllDirectoryA( + lpPathName: LPCSTR + ) -> BOOL; + pub fn SetDllDirectoryW( + lpPathName: LPCWSTR + ) -> BOOL; + pub fn GetDllDirectoryA( + nBufferLength: DWORD, + lpBuffer: LPSTR + ) -> DWORD; + pub fn GetDllDirectoryW( + nBufferLength: DWORD, + lpBuffer: LPWSTR + ) -> DWORD; + pub fn SetSearchPathMode( + Flags: DWORD + ) -> BOOL; + pub fn CreateDirectoryExA( + lpTemplateDirectory: LPCSTR, + lpNewDirectory: LPCSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateDirectoryExW( + lpTemplateDirectory: LPCWSTR, + lpNewDirectory: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateDirectoryTransactedA( + lpTemplateDirectory: LPCSTR, + lpNewDirectory: LPCSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + hTransaction: HANDLE, + ) -> BOOL; + pub fn CreateDirectoryTransactedW( + lpTemplateDirectory: LPCWSTR, + lpNewDirectory: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + hTransaction: HANDLE, + ) -> BOOL; + pub fn RemoveDirectoryTransactedA( + lpPathName: LPCSTR, + hTransaction: HANDLE + ) -> BOOL; + pub fn RemoveDirectoryTransactedW( + lpPathName: LPCWSTR, + hTransaction: HANDLE + ) -> BOOL; + pub fn GetFullPathNameTransactedA( + lpFileName: LPCSTR, + nBufferLength: DWORD, + lpBuffer: LPSTR, + lpFilePart: *mut LPSTR, + hTransaction: HANDLE, + ) -> DWORD; + pub fn GetFullPathNameTransactedW( + lpFileName: LPCWSTR, + nBufferLength: DWORD, + lpBuffer: LPWSTR, + lpFilePart: *mut LPWSTR, + hTransaction: HANDLE, + ); + pub fn DefineDosDeviceA( + dwFlags: DWORD, + lpDeviceName: LPCSTR, + lpTargetPath: LPCSTR + ) -> BOOL; + pub fn QueryDosDeviceA( + lpDeviceName: LPCSTR, + lpTargetPath: LPSTR, + ucchMax: DWORD + ) -> DWORD; + pub fn CreateFileTransactedA( + lpFileName: LPCSTR, + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, + hTemplateFile: HANDLE, + hTransaction: HANDLE, + pusMiniVersion: PUSHORT, + lpExtendedParameter: PVOID, + ) -> HANDLE; + pub fn CreateFileTransactedW( + lpFileName: LPCWSTR, + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + dwCreationDisposition: DWORD, + dwFlagsAndAttributes: DWORD, + hTemplateFile: HANDLE, + hTransaction: HANDLE, + pusMiniVersion: PUSHORT, + lpExtendedParameter: PVOID, + ) -> HANDLE; + pub fn ReOpenFile( + hOriginalFile: HANDLE, + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + dwFlags: DWORD, + ) -> HANDLE; + pub fn SetFileAttributesTransactedA( + lpFileName: LPCSTR, + dwFileAttributes: DWORD, + hTransaction: HANDLE, + ) -> BOOL; + pub fn SetFileAttributesTransactedW( + lpFileName: LPCWSTR, + dwFileAttributes: DWORD, + hTransaction: HANDLE, + ) -> BOOL; + pub fn GetFileAttributesTransactedA( + lpFileName: LPCSTR, + fInfoLevelId: GET_FILEEX_INFO_LEVELS, + lpFileInformation: LPVOID, + hTransaction: HANDLE, + ) -> BOOL; + pub fn GetFileAttributesTransactedW( + lpFileName: LPCWSTR, + fInfoLevelId: GET_FILEEX_INFO_LEVELS, + lpFileInformation: LPVOID, + hTransaction: HANDLE, + ) -> BOOL; + pub fn GetCompressedFileSizeTransactedA( + lpFileName: LPCSTR, + lpFileSizeHigh: LPDWORD, + hTransaction: HANDLE, + ) -> DWORD; + pub fn GetCompressedFileSizeTransactedW( + lpFileName: LPCWSTR, + lpFileSizeHigh: LPDWORD, + hTransaction: HANDLE, + ); + pub fn DeleteFileTransactedA( + lpFileName: LPCSTR, + hTransaction: HANDLE + ) -> BOOL; + pub fn DeleteFileTransactedW( + lpFileName: LPCWSTR, + hTransaction: HANDLE + ) -> BOOL; + pub fn CheckNameLegalDOS8Dot3A( + lpName: LPCSTR, + lpOemName: LPSTR, + OemNameSize: DWORD, + pbNameContainsSpaces: PBOOL, + pbNameLegal: PBOOL, + ) -> BOOL; + pub fn CheckNameLegalDOS8Dot3W( + lpName: LPCWSTR, + lpOemName: LPSTR, + OemNameSize: DWORD, + pbNameContainsSpaces: PBOOL, + pbNameLegal: PBOOL, + ) -> BOOL; + pub fn FindFirstFileTransactedA( + lpFileName: LPCSTR, + fInfoLevelId: FINDEX_INFO_LEVELS, + lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, + lpSearchFilter: LPVOID, + dwAdditionalFlags: DWORD, + hTransaction: HANDLE, + ) -> HANDLE; + pub fn FindFirstFileTransactedW( + lpFileName: LPCWSTR, + fInfoLevelId: FINDEX_INFO_LEVELS, + lpFindFileData: LPVOID, + fSearchOp: FINDEX_SEARCH_OPS, + lpSearchFilter: LPVOID, + dwAdditionalFlags: DWORD, + hTransaction: HANDLE, + ) -> HANDLE; + pub fn CopyFileA( + lpExistingFileName: LPCSTR, + lpNewFileName: LPCSTR, + bFailIfExists: BOOL + ) -> BOOL; + pub fn CopyFileW( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR, + bFailIfExists: BOOL + ) -> BOOL; +} +FN!{stdcall LPPROGRESS_ROUTINE( + TotalFileSize: LARGE_INTEGER, + TotalBytesTransferred: LARGE_INTEGER, + StreamSize: LARGE_INTEGER, + StreamBytesTransferred: LARGE_INTEGER, + dwStreamNumber: DWORD, + dwCallbackReason: DWORD, + hSourceFile: HANDLE, + hDestinationFile: HANDLE, + lpData: LPVOID, +) -> DWORD} +extern "system" { + pub fn CopyFileExA( + lpExistingFileName: LPCSTR, + lpNewFileName: LPCSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + pbCancel: LPBOOL, + dwCopyFlags: DWORD, + ) -> BOOL; + pub fn CopyFileExW( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + pbCancel: LPBOOL, + dwCopyFlags: DWORD, + ) -> BOOL; + pub fn CopyFileTransactedA( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + pbCancel: LPBOOL, + dwCopyFlags: DWORD, + hTransaction: HANDLE, + ) -> BOOL; + pub fn CopyFileTransactedW( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + pbCancel: LPBOOL, + dwCopyFlags: DWORD, + hTransaction: HANDLE, + ) -> BOOL; +} +ENUM!{enum COPYFILE2_MESSAGE_TYPE { + COPYFILE2_CALLBACK_NONE = 0, + COPYFILE2_CALLBACK_CHUNK_STARTED, + COPYFILE2_CALLBACK_CHUNK_FINISHED, + COPYFILE2_CALLBACK_STREAM_STARTED, + COPYFILE2_CALLBACK_STREAM_FINISHED, + COPYFILE2_CALLBACK_POLL_CONTINUE, + COPYFILE2_CALLBACK_ERROR, + COPYFILE2_CALLBACK_MAX, +}} +ENUM!{enum COPYFILE2_MESSAGE_ACTION { + COPYFILE2_PROGRESS_CONTINUE = 0, + COPYFILE2_PROGRESS_CANCEL, + COPYFILE2_PROGRESS_STOP, + COPYFILE2_PROGRESS_QUIET, + COPYFILE2_PROGRESS_PAUSE, +}} +ENUM!{enum COPYFILE2_COPY_PHASE { + COPYFILE2_PHASE_NONE = 0, + COPYFILE2_PHASE_PREPARE_SOURCE, + COPYFILE2_PHASE_PREPARE_DEST, + COPYFILE2_PHASE_READ_SOURCE, + COPYFILE2_PHASE_WRITE_DESTINATION, + COPYFILE2_PHASE_SERVER_COPY, + COPYFILE2_PHASE_NAMEGRAFT_COPY, + COPYFILE2_PHASE_MAX, +}} +STRUCT!{struct COPYFILE2_MESSAGE_ChunkStarted { + dwStreamNumber: DWORD, + dwReserved: DWORD, + hSourceFile: HANDLE, + hDestinationFile: HANDLE, + uliChunkNumber: ULARGE_INTEGER, + uliChunkSize: ULARGE_INTEGER, + uliStreamSize: ULARGE_INTEGER, + uliTotalFileSize: ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_ChunkFinished { + dwStreamNumber: DWORD, + dwFlags: DWORD, + hSourceFile: HANDLE, + hDestinationFile: HANDLE, + uliChunkNumber: ULARGE_INTEGER, + uliChunkSize: ULARGE_INTEGER, + uliStreamSize: ULARGE_INTEGER, + uliStreamBytesTransferred: ULARGE_INTEGER, + uliTotalFileSize: ULARGE_INTEGER, + uliTotalBytesTransferred: ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_StreamStarted { + dwStreamNumber: DWORD, + dwReserved: DWORD, + hSourceFile: HANDLE, + hDestinationFile: HANDLE, + uliStreamSize: ULARGE_INTEGER, + uliTotalFileSize: ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_StreamFinished { + dwStreamNumber: DWORD, + dwReserved: DWORD, + hSourceFile: HANDLE, + hDestinationFile: HANDLE, + uliStreamSize: ULARGE_INTEGER, + uliStreamBytesTransferred: ULARGE_INTEGER, + uliTotalFileSize: ULARGE_INTEGER, + uliTotalBytesTransferred: ULARGE_INTEGER, +}} +STRUCT!{struct COPYFILE2_MESSAGE_PollContinue { + dwReserved: DWORD, +}} +STRUCT!{struct COPYFILE2_MESSAGE_Error { + CopyPhase: COPYFILE2_COPY_PHASE, + dwStreamNumber: DWORD, + hrFailure: HRESULT, + dwReserved: DWORD, + uliChunkNumber: ULARGE_INTEGER, + uliStreamSize: ULARGE_INTEGER, + uliStreamBytesTransferred: ULARGE_INTEGER, + uliTotalFileSize: ULARGE_INTEGER, + uliTotalBytesTransferred: ULARGE_INTEGER, +}} +UNION!{union COPYFILE2_MESSAGE_Info { + [u64; 8] [u64; 9], + ChunkStarted ChunkStarted_mut: COPYFILE2_MESSAGE_ChunkStarted, + ChunkFinished ChunkFinished_mut: COPYFILE2_MESSAGE_ChunkFinished, + StreamStarted StreamStarted_mut: COPYFILE2_MESSAGE_StreamStarted, + StreamFinished StreamFinished_mut: COPYFILE2_MESSAGE_StreamFinished, + PollContinue PollContinue_mut: COPYFILE2_MESSAGE_PollContinue, + Error Error_mut: COPYFILE2_MESSAGE_Error, +}} +STRUCT!{struct COPYFILE2_MESSAGE { + Type: COPYFILE2_MESSAGE_TYPE, + dwPadding: DWORD, + Info: COPYFILE2_MESSAGE_Info, +}} +FN!{stdcall PCOPYFILE2_PROGRESS_ROUTINE( + pMessage: *const COPYFILE2_MESSAGE, + pvCallbackContext: PVOID, +) -> COPYFILE2_MESSAGE_ACTION} +STRUCT!{struct COPYFILE2_EXTENDED_PARAMETERS { + dwSize: DWORD, + dwCopyFlags: DWORD, + pfCancel: *mut BOOL, + pProgressRoutine: PCOPYFILE2_PROGRESS_ROUTINE, + pvCallbackContext: PVOID, +}} +extern "system" { + pub fn CopyFile2( + pwszExistingFileName: PCWSTR, + pwszNewFileName: PCWSTR, + pExtendedParameters: *mut COPYFILE2_EXTENDED_PARAMETERS, + ) -> HRESULT; + pub fn MoveFileA( + lpExistingFileName: LPCSTR, + lpNewFileName: LPCSTR + ) -> BOOL; + pub fn MoveFileW( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR + ) -> BOOL; + pub fn MoveFileExA( + lpExistingFileName: LPCSTR, + lpNewFileName: LPCSTR, + dwFlags: DWORD + ) -> BOOL; + pub fn MoveFileExW( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR, + dwFlags: DWORD + ) -> BOOL; + pub fn MoveFileWithProgressA( + lpExistingFileName: LPCSTR, + lpNewFileName: LPCSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + dwFlags: DWORD, + ) -> BOOL; + pub fn MoveFileWithProgressW( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + dwFlags: DWORD, + ) -> BOOL; + pub fn MoveFileTransactedA( + lpExistingFileName: LPCSTR, + lpNewFileName: LPCSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + dwFlags: DWORD, + hTransaction: HANDLE, + ) -> BOOL; + pub fn MoveFileTransactedW( + lpExistingFileName: LPCWSTR, + lpNewFileName: LPCWSTR, + lpProgressRoutine: LPPROGRESS_ROUTINE, + lpData: LPVOID, + dwFlags: DWORD, + hTransaction: HANDLE, + ) -> BOOL; +} +pub const MOVEFILE_REPLACE_EXISTING: DWORD = 0x00000001; +pub const MOVEFILE_COPY_ALLOWED: DWORD = 0x00000002; +pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 0x00000004; +pub const MOVEFILE_WRITE_THROUGH: DWORD = 0x00000008; +pub const MOVEFILE_CREATE_HARDLINK: DWORD = 0x00000010; +pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 0x00000020; +extern "system" { + pub fn ReplaceFileA( + lpReplacedFileName: LPCSTR, + lpReplacementFileName: LPCSTR, + lpBackupFileName: LPCSTR, + dwReplaceFlags: DWORD, + lpExclude: LPVOID, + lpReserved: LPVOID, + ); + pub fn ReplaceFileW( + lpReplacedFileName: LPCWSTR, + lpReplacementFileName: LPCWSTR, + lpBackupFileName: LPCWSTR, + dwReplaceFlags: DWORD, + lpExclude: LPVOID, + lpReserved: LPVOID, + ); + pub fn CreateHardLinkA( + lpFileName: LPCSTR, + lpExistingFileName: LPCSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateHardLinkW( + lpFileName: LPCWSTR, + lpExistingFileName: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> BOOL; + pub fn CreateHardLinkTransactedA( + lpFileName: LPCSTR, + lpExistingFileName: LPCSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + hTransaction: HANDLE, + ) -> BOOL; + pub fn CreateHardLinkTransactedW( + lpFileName: LPCWSTR, + lpExistingFileName: LPCWSTR, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + hTransaction: HANDLE, + ); + pub fn FindFirstStreamTransactedW( + lpFileName: LPCWSTR, + InfoLevel: STREAM_INFO_LEVELS, + lpFindStreamData: LPVOID, + dwFlags: DWORD, + hTransaction: HANDLE, + ) -> HANDLE; + pub fn FindFirstFileNameTransactedW( + lpFileName: LPCWSTR, + dwFlags: DWORD, + StringLength: LPDWORD, + LinkName: PWSTR, + hTransaction: HANDLE, + ) -> HANDLE; + pub fn CreateNamedPipeA( + lpName: LPCSTR, + dwOpenMode: DWORD, + dwPipeMode: DWORD, + nMaxInstances: DWORD, + nOutBufferSize: DWORD, + nInBufferSize: DWORD, + nDefaultTimeOut: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + ) -> HANDLE; + pub fn GetNamedPipeHandleStateA( + hNamedPipe: HANDLE, + lpState: LPDWORD, + lpCurInstances: LPDWORD, + lpMaxCollectionCount: LPDWORD, + lpCollectDataTimeout: LPDWORD, + lpUserName: LPSTR, + nMaxUserNameSize: DWORD, + ) -> BOOL; + pub fn CallNamedPipeA( + lpNamedPipeName: LPCSTR, + lpInBuffer: LPVOID, + nInBufferSize: DWORD, + lpOutBuffer: LPVOID, + nOutBufferSize: DWORD, + lpBytesRead: LPDWORD, + nTimeOut: DWORD, + ) -> BOOL; + pub fn WaitNamedPipeA( + lpNamedPipeName: LPCSTR, + nTimeOut: DWORD + ) -> BOOL; + pub fn GetNamedPipeClientComputerNameA( + Pipe: HANDLE, + ClientComputerName: LPSTR, + ClientComputerNameLength: ULONG, + ) -> BOOL; + pub fn GetNamedPipeClientProcessId( + Pipe: HANDLE, + ClientProcessId: PULONG + ) -> BOOL; + pub fn GetNamedPipeClientSessionId( + Pipe: HANDLE, + ClientSessionId: PULONG + ) -> BOOL; + pub fn GetNamedPipeServerProcessId( + Pipe: HANDLE, + ServerProcessId: PULONG + ) -> BOOL; + pub fn GetNamedPipeServerSessionId( + Pipe: HANDLE, + ServerSessionId: PULONG + ) -> BOOL; + pub fn SetVolumeLabelA( + lpRootPathName: LPCSTR, + lpVolumeName: LPCSTR + ) -> BOOL; + pub fn SetVolumeLabelW( + lpRootPathName: LPCWSTR, + lpVolumeName: LPCWSTR + ) -> BOOL; + pub fn SetFileBandwidthReservation( + hFile: HANDLE, + nPeriodMilliseconds: DWORD, + nBytesPerPeriod: DWORD, + bDiscardable: BOOL, + lpTransferSize: LPDWORD, + lpNumOutstandingRequests: LPDWORD, + ) -> BOOL; + pub fn GetFileBandwidthReservation( + hFile: HANDLE, + lpPeriodMilliseconds: LPDWORD, + lpBytesPerPeriod: LPDWORD, + pDiscardable: LPBOOL, + lpTransferSize: LPDWORD, + lpNumOutstandingRequests: LPDWORD, + ) -> BOOL; + // pub fn ClearEventLogA(); + // pub fn ClearEventLogW(); + // pub fn BackupEventLogA(); + // pub fn BackupEventLogW(); + // pub fn CloseEventLog(); + // pub fn DeregisterEventSource(); + // pub fn NotifyChangeEventLog(); + // pub fn GetNumberOfEventLogRecords(); + // pub fn GetOldestEventLogRecord(); + // pub fn OpenEventLogA(); + // pub fn OpenEventLogW(); + // pub fn RegisterEventSourceA(); + // pub fn RegisterEventSourceW(); + // pub fn OpenBackupEventLogA(); + // pub fn OpenBackupEventLogW(); + // pub fn ReadEventLogA(); + // pub fn ReadEventLogW(); + // pub fn ReportEventA(); + // pub fn ReportEventW(); + // pub fn GetEventLogInformation(); + // pub fn OperationStart(); + // pub fn OperationEnd(); + // pub fn AccessCheckAndAuditAlarmA(); + // pub fn AccessCheckByTypeAndAuditAlarmA(); + // pub fn AccessCheckByTypeResultListAndAuditAlarmA(); + // pub fn AccessCheckByTypeResultListAndAuditAlarmByHandleA(); + // pub fn ObjectOpenAuditAlarmA(); + // pub fn ObjectPrivilegeAuditAlarmA(); + // pub fn ObjectCloseAuditAlarmA(); + // pub fn ObjectDeleteAuditAlarmA(); + // pub fn PrivilegedServiceAuditAlarmA(); + // pub fn AddConditionalAce(); + // pub fn SetFileSecurityA(); + // pub fn GetFileSecurityA(); + pub fn ReadDirectoryChangesW( + hDirectory: HANDLE, + lpBuffer: LPVOID, + nBufferLength: DWORD, + bWatchSubtree: BOOL, + dwNotifyFilter: DWORD, + lpBytesReturned: LPDWORD, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; + pub fn MapViewOfFileExNuma( + hFileMappingObject: HANDLE, + dwDesiredAccess: DWORD, + dwFileOffsetHigh: DWORD, + dwFileOffsetLow: DWORD, + dwNumberOfBytesToMap: SIZE_T, + lpBaseAddress: LPVOID, + nndPreferred: DWORD, + ) -> LPVOID; + pub fn IsBadReadPtr( + lp: *const VOID, + ucb: UINT_PTR + ) -> BOOL; + pub fn IsBadWritePtr( + lp: LPVOID, + ucb: UINT_PTR + ) -> BOOL; + pub fn IsBadHugeReadPtr( + lp: *const VOID, + ucb: UINT_PTR + ) -> BOOL; + pub fn IsBadHugeWritePtr( + lp: LPVOID, + ucb: UINT_PTR + ) -> BOOL; + pub fn IsBadCodePtr( + lpfn: FARPROC + ) -> BOOL; + pub fn IsBadStringPtrA( + lpsz: LPCSTR, + ucchMax: UINT_PTR + ) -> BOOL; + pub fn IsBadStringPtrW( + lpsz: LPCWSTR, + ucchMax: UINT_PTR + ) -> BOOL; + // pub fn LookupAccountSidA(); + // pub fn LookupAccountSidW(); + pub fn LookupAccountNameA( + lpSystemName: LPCSTR, + lpAccountName: LPCSTR, + Sid: PSID, + cbSid: LPDWORD, + ReferencedDomainName: LPCSTR, + peUse: PSID_NAME_USE, + ) -> BOOL; + pub fn LookupAccountNameW( + lpSystemName: LPCWSTR, + lpAccountName: LPCWSTR, + Sid: PSID, + cbSid: LPDWORD, + ReferencedDomainName: LPCWSTR, + peUse: PSID_NAME_USE, + ) -> BOOL; + // pub fn LookupAccountNameLocalA(); + // pub fn LookupAccountNameLocalW(); + // pub fn LookupAccountSidLocalA(); + // pub fn LookupAccountSidLocalW(); + pub fn LookupPrivilegeValueA( + lpSystemName: LPCSTR, + lpName: LPCSTR, + lpLuid: PLUID, + ) -> BOOL; + pub fn LookupPrivilegeValueW( + lpSystemName: LPCWSTR, + lpName: LPCWSTR, + lpLuid: PLUID, + ) -> BOOL; + pub fn LookupPrivilegeNameA( + lpSystemName: LPCSTR, + lpLuid: PLUID, + lpName: LPSTR, + cchName: LPDWORD, + ) -> BOOL; + pub fn LookupPrivilegeNameW( + lpSystemName: LPCWSTR, + lpLuid: PLUID, + lpName: LPWSTR, + cchName: LPDWORD, + ) -> BOOL; + // pub fn LookupPrivilegeDisplayNameA(); + // pub fn LookupPrivilegeDisplayNameW(); + pub fn BuildCommDCBA( + lpDef: LPCSTR, + lpDCB: LPDCB + ) -> BOOL; + pub fn BuildCommDCBW( + lpDef: LPCWSTR, + lpDCB: LPDCB + ) -> BOOL; + pub fn BuildCommDCBAndTimeoutsA( + lpDef: LPCSTR, + lpDCB: LPDCB, + lpCommTimeouts: LPCOMMTIMEOUTS, + ) -> BOOL; + pub fn BuildCommDCBAndTimeoutsW( + lpDef: LPCWSTR, + lpDCB: LPDCB, + lpCommTimeouts: LPCOMMTIMEOUTS, + ) -> BOOL; + pub fn CommConfigDialogA( + lpszName: LPCSTR, + hWnd: HWND, + lpCC: LPCOMMCONFIG + ) -> BOOL; + pub fn CommConfigDialogW( + lpszName: LPCWSTR, + hWnd: HWND, + lpCC: LPCOMMCONFIG + ) -> BOOL; + pub fn GetDefaultCommConfigA( + lpszName: LPCSTR, + lpCC: LPCOMMCONFIG, + lpdwSize: LPDWORD + ) -> BOOL; + pub fn GetDefaultCommConfigW( + lpszName: LPCWSTR, + lpCC: LPCOMMCONFIG, + lpdwSize: LPDWORD + ) -> BOOL; + pub fn SetDefaultCommConfigA( + lpszName: LPCSTR, + lpCC: LPCOMMCONFIG, + dwSize: DWORD + ) -> BOOL; + pub fn SetDefaultCommConfigW( + lpszName: LPCWSTR, + lpCC: LPCOMMCONFIG, + dwSize: DWORD + ) -> BOOL; + pub fn GetComputerNameA( + lpBuffer: LPSTR, + nSize: LPDWORD + ) -> BOOL; + pub fn GetComputerNameW( + lpBuffer: LPWSTR, + nSize: LPDWORD + ) -> BOOL; + pub fn DnsHostnameToComputerNameA( + Hostname: LPCSTR, + ComputerName: LPCSTR, + nSize: LPDWORD, + ) -> BOOL; + pub fn DnsHostnameToComputerNameW( + Hostname: LPCWSTR, + ComputerName: LPWSTR, + nSize: LPDWORD, + ) -> BOOL; + pub fn GetUserNameA( + lpBuffer: LPSTR, + pcbBuffer: LPDWORD + ) -> BOOL; + pub fn GetUserNameW( + lpBuffer: LPWSTR, + pcbBuffer: LPDWORD + ) -> BOOL; + // pub fn LogonUserA(); + // pub fn LogonUserW(); + // pub fn LogonUserExA(); + // pub fn LogonUserExW(); + // pub fn CreateProcessWithLogonW(); + // pub fn CreateProcessWithTokenW(); + // pub fn IsTokenUntrusted(); + pub fn RegisterWaitForSingleObject( + phNewWaitObject: PHANDLE, + hObject: HANDLE, + Callback: WAITORTIMERCALLBACK, + Context: PVOID, + dwMilliseconds: ULONG, + dwFlags: ULONG, + ) -> BOOL; + pub fn UnregisterWait( + WaitHandle: HANDLE + ) -> BOOL; + pub fn BindIoCompletionCallback( + FileHandle: HANDLE, + Function: LPOVERLAPPED_COMPLETION_ROUTINE, + Flags: ULONG, + ) -> BOOL; + pub fn SetTimerQueueTimer( + TimerQueue: HANDLE, + Callback: WAITORTIMERCALLBACK, + Parameter: PVOID, + DueTime: DWORD, + Period: DWORD, + PreferIo: BOOL, + ) -> HANDLE; + pub fn CancelTimerQueueTimer( + TimerQueue: HANDLE, + Timer: HANDLE + ) -> BOOL; + pub fn DeleteTimerQueue( + TimerQueue: HANDLE + ) -> BOOL; + // pub fn InitializeThreadpoolEnvironment(); + // pub fn SetThreadpoolCallbackPool(); + // pub fn SetThreadpoolCallbackCleanupGroup(); + // pub fn SetThreadpoolCallbackRunsLong(); + // pub fn SetThreadpoolCallbackLibrary(); + // pub fn SetThreadpoolCallbackPriority(); + // pub fn DestroyThreadpoolEnvironment(); + // pub fn SetThreadpoolCallbackPersistent(); + pub fn CreatePrivateNamespaceA( + lpPrivateNamespaceAttributes: LPSECURITY_ATTRIBUTES, + lpBoundaryDescriptor: LPVOID, + lpAliasPrefix: LPCSTR, + ) -> HANDLE; + pub fn OpenPrivateNamespaceA( + lpBoundaryDescriptor: LPVOID, + lpAliasPrefix: LPCSTR + ) -> HANDLE; + pub fn CreateBoundaryDescriptorA( + Name: LPCSTR, + Flags: ULONG + ) -> HANDLE; + pub fn AddIntegrityLabelToBoundaryDescriptor( + BoundaryDescriptor: *mut HANDLE, + IntegrityLabel: PSID, + ) -> BOOL; +} +pub const HW_PROFILE_GUIDLEN: usize = 39; +// MAX_PROFILE_LEN +pub const DOCKINFO_UNDOCKED: DWORD = 0x1; +pub const DOCKINFO_DOCKED: DWORD = 0x2; +pub const DOCKINFO_USER_SUPPLIED: DWORD = 0x4; +pub const DOCKINFO_USER_UNDOCKED: DWORD = DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED; +pub const DOCKINFO_USER_DOCKED: DWORD = DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED; +STRUCT!{struct HW_PROFILE_INFOA { + dwDockInfo: DWORD, + szHwProfileGuid: [CHAR; HW_PROFILE_GUIDLEN], + szHwProfileName: [CHAR; MAX_PROFILE_LEN], +}} +pub type LPHW_PROFILE_INFOA = *mut HW_PROFILE_INFOA; +STRUCT!{struct HW_PROFILE_INFOW { + dwDockInfo: DWORD, + szHwProfileGuid: [WCHAR; HW_PROFILE_GUIDLEN], + szHwProfileName: [WCHAR; MAX_PROFILE_LEN], +}} +pub type LPHW_PROFILE_INFOW = *mut HW_PROFILE_INFOW; +extern "system" { + pub fn GetCurrentHwProfileA( + lpHwProfileInfo: LPHW_PROFILE_INFOA + ) -> BOOL; + pub fn GetCurrentHwProfileW( + lpHwProfileInfo: LPHW_PROFILE_INFOW + ) -> BOOL; + pub fn VerifyVersionInfoA( + lpVersionInformation: LPOSVERSIONINFOEXA, + dwTypeMask: DWORD, + dwlConditionMask: DWORDLONG, + ) -> BOOL; + pub fn VerifyVersionInfoW( + lpVersionInformation: LPOSVERSIONINFOEXW, + dwTypeMask: DWORD, + dwlConditionMask: DWORDLONG, + ) -> BOOL; +} +STRUCT!{struct SYSTEM_POWER_STATUS { + ACLineStatus: BYTE, + BatteryFlag: BYTE, + BatteryLifePercent: BYTE, + Reserved1: BYTE, + BatteryLifeTime: DWORD, + BatteryFullLifeTime: DWORD, +}} +pub type LPSYSTEM_POWER_STATUS = *mut SYSTEM_POWER_STATUS; +extern "system" { + pub fn GetSystemPowerStatus( + lpSystemPowerStatus: LPSYSTEM_POWER_STATUS + ) -> BOOL; + pub fn SetSystemPowerState( + fSuspend: BOOL, + fForce: BOOL + ) -> BOOL; + pub fn MapUserPhysicalPagesScatter( + VirtualAddresses: *mut PVOID, + NumberOfPages: ULONG_PTR, + PageArray: PULONG_PTR, + ) -> BOOL; + pub fn CreateJobObjectA( + lpJobAttributes: LPSECURITY_ATTRIBUTES, + lpName: LPCSTR + ) -> HANDLE; + pub fn OpenJobObjectA( + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + lpName: LPCSTR + ) -> HANDLE; + pub fn CreateJobSet( + NumJob: ULONG, + UserJobSet: PJOB_SET_ARRAY, + Flags: ULONG + ) -> BOOL; + pub fn FindFirstVolumeA( + lpszVolumeName: LPSTR, + cchBufferLength: DWORD + ) -> HANDLE; + pub fn FindNextVolumeA( + hFindVolume: HANDLE, + lpszVolumeName: LPSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn FindFirstVolumeMountPointA( + lpszRootPathName: LPCSTR, + lpszVolumeMountPoint: LPSTR, + cchBufferLength: DWORD, + ) -> HANDLE; + pub fn FindFirstVolumeMountPointW( + lpszRootPathName: LPCWSTR, + lpszVolumeMountPoint: LPWSTR, + cchBufferLength: DWORD, + ) -> HANDLE; + pub fn FindNextVolumeMountPointA( + hFindVolumeMountPoint: HANDLE, + lpszVolumeMountPoint: LPSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn FindNextVolumeMountPointW( + hFindVolumeMountPoint: HANDLE, + lpszVolumeMountPoint: LPWSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn FindVolumeMountPointClose( + hFindVolumeMountPoint: HANDLE + ) -> BOOL; + pub fn SetVolumeMountPointA( + lpszVolumeMountPoint: LPCSTR, + lpszVolumeName: LPCSTR + ) -> BOOL; + pub fn SetVolumeMountPointW( + lpszVolumeMountPoint: LPCWSTR, + lpszVolumeName: LPCWSTR + ) -> BOOL; + pub fn DeleteVolumeMountPointA( + lpszVolumeMountPoint: LPCSTR + ) -> BOOL; + pub fn GetVolumeNameForVolumeMountPointA( + lpszVolumeMountPoint: LPCSTR, + lpszVolumeName: LPSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn GetVolumePathNameA( + lpszFileName: LPCSTR, + lpszVolumePathName: LPSTR, + cchBufferLength: DWORD, + ) -> BOOL; + pub fn GetVolumePathNamesForVolumeNameA( + lpszVolumeName: LPCSTR, + lpszVolumePathNames: LPCH, + cchBufferLength: DWORD, + lpcchReturnLength: PDWORD, + ) -> BOOL; +} +// ACTCTX_FLAG_* +STRUCT!{struct ACTCTXA { + cbSize: ULONG, + dwFlags: DWORD, + lpSource: LPCSTR, + wProcessorArchitecture: USHORT, + wLangId: LANGID, + lpAssemblyDirectory: LPCSTR, + lpResourceName: LPCSTR, + lpApplicationName: LPCSTR, + hModule: HMODULE, +}} +pub type PACTCTXA = *mut ACTCTXA; +STRUCT!{struct ACTCTXW { + cbSize: ULONG, + dwFlags: DWORD, + lpSource: LPCWSTR, + wProcessorArchitecture: USHORT, + wLangId: LANGID, + lpAssemblyDirectory: LPCWSTR, + lpResourceName: LPCWSTR, + lpApplicationName: LPCWSTR, + hModule: HMODULE, +}} +pub type PACTCTXW = *mut ACTCTXW; +pub type PCACTCTXA = *const ACTCTXA; +pub type PCACTCTXW = *const ACTCTXW; +extern "system" { + pub fn CreateActCtxA( + pActCtx: PCACTCTXA + ) -> HANDLE; + pub fn CreateActCtxW( + pActCtx: PCACTCTXW + ) -> HANDLE; + pub fn AddRefActCtx( + hActCtx: HANDLE + ); + pub fn ReleaseActCtx( + hActCtx: HANDLE + ); + pub fn ZombifyActCtx( + hActCtx: HANDLE + ) -> BOOL; + pub fn ActivateActCtx( + hActCtx: HANDLE, + lpCookie: *mut ULONG_PTR + ) -> BOOL; + pub fn DeactivateActCtx( + dwFlags: DWORD, + ulCookie: ULONG_PTR + ) -> BOOL; + pub fn GetCurrentActCtx( + lphActCtx: *mut HANDLE + ) -> BOOL; +} +STRUCT!{struct ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA { + lpInformation: PVOID, + lpSectionBase: PVOID, + ulSectionLength: ULONG, + lpSectionGlobalDataBase: PVOID, + ulSectionGlobalDataLength: ULONG, +}} +pub type PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA = + *mut ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; +pub type PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA = + *const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; +STRUCT!{struct ACTCTX_SECTION_KEYED_DATA { + cbSize: ULONG, + ulDataFormatVersion: ULONG, + lpData: PVOID, + ulLength: ULONG, + lpSectionGlobalData: PVOID, + ulSectionGlobalDataLength: ULONG, + lpSectionBase: PVOID, + ulSectionTotalLength: ULONG, + hActCtx: HANDLE, + ulAssemblyRosterIndex: ULONG, + ulFlags: ULONG, + AssemblyMetadata: ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, +}} +pub type PACTCTX_SECTION_KEYED_DATA = *mut ACTCTX_SECTION_KEYED_DATA; +pub type PCACTCTX_SECTION_KEYED_DATA = *const ACTCTX_SECTION_KEYED_DATA; +extern "system" { + pub fn FindActCtxSectionStringA( + dwFlags: DWORD, + lpExtensionGuid: *const GUID, + ulSectionId: ULONG, + lpStringToFind: LPCSTR, + ReturnedData: PACTCTX_SECTION_KEYED_DATA, + ) -> BOOL; + pub fn FindActCtxSectionStringW( + dwFlags: DWORD, + lpExtensionGuid: *const GUID, + ulSectionId: ULONG, + lpStringToFind: LPCWSTR, + ReturnedData: PACTCTX_SECTION_KEYED_DATA, + ) -> BOOL; + pub fn FindActCtxSectionGuid( + dwFlags: DWORD, + lpExtensionGuid: *const GUID, + ulSectionId: ULONG, + lpGuidToFind: *const GUID, + ReturnedData: PACTCTX_SECTION_KEYED_DATA, + ) -> BOOL; + pub fn QueryActCtxW( + dwFlags: DWORD, + hActCtx: HANDLE, + pvSubInstance: PVOID, + ulInfoClass: ULONG, + pvBuffer: PVOID, + cbBuffer: SIZE_T, + pcbWrittenOrRequired: *mut SIZE_T, + ) -> BOOL; + pub fn WTSGetActiveConsoleSessionId() -> DWORD; + // pub fn WTSGetServiceSessionId(); + // pub fn WTSIsServerContainer(); + pub fn GetActiveProcessorGroupCount() -> WORD; + pub fn GetMaximumProcessorGroupCount() -> WORD; + pub fn GetActiveProcessorCount( + GroupNumber: WORD + ) -> DWORD; + pub fn GetMaximumProcessorCount( + GroupNumber: WORD + ) -> DWORD; + pub fn GetNumaProcessorNode( + Processor: UCHAR, + NodeNumber: PUCHAR + ) -> BOOL; + pub fn GetNumaNodeNumberFromHandle( + hFile: HANDLE, + NodeNumber: PUSHORT + ) -> BOOL; + pub fn GetNumaProcessorNodeEx( + Processor: PPROCESSOR_NUMBER, + NodeNumber: PUSHORT + ) -> BOOL; + pub fn GetNumaNodeProcessorMask( + Node: UCHAR, + ProcessorMask: PULONGLONG + ) -> BOOL; + pub fn GetNumaAvailableMemoryNode( + Node: UCHAR, + AvailableBytes: PULONGLONG + ) -> BOOL; + pub fn GetNumaAvailableMemoryNodeEx( + Node: USHORT, + AvailableBytes: PULONGLONG, + ) -> BOOL; + pub fn GetNumaProximityNode( + ProximityId: ULONG, + NodeNumber: PUCHAR + ) -> BOOL; +} +FN!{stdcall APPLICATION_RECOVERY_CALLBACK( + pvParameter: PVOID, +) -> DWORD} +// RESTART_* +// RECOVERY_* +extern "system" { + pub fn RegisterApplicationRecoveryCallback( + pRecoveyCallback: APPLICATION_RECOVERY_CALLBACK, + pvParameter: PVOID, + dwPingInterval: DWORD, + dwFlags: DWORD, + ) -> HRESULT; + pub fn UnregisterApplicationRecoveryCallback() -> HRESULT; + pub fn RegisterApplicationRestart( + pwzCommandline: PCWSTR, + dwFlags: DWORD, + ) -> HRESULT; + pub fn UnregisterApplicationRestart() -> HRESULT; + pub fn GetApplicationRecoveryCallback( + hProcess: HANDLE, + pRecoveryCallback: *mut APPLICATION_RECOVERY_CALLBACK, + ppvParameter: *mut PVOID, + pdwPingInterval: PDWORD, + pdwFlags: PDWORD, + ) -> HRESULT; + pub fn GetApplicationRestartSettings( + hProcess: HANDLE, + pwzCommandline: PWSTR, + pcchSize: PDWORD, + pdwFlags: PDWORD, + ) -> HRESULT; + pub fn ApplicationRecoveryInProgress( + pbCancelled: PBOOL + ) -> HRESULT; + pub fn ApplicationRecoveryFinished( + bSuccess: BOOL + ); +} +// FILE_BASIC_INFO, etc. +extern "system" { + pub fn GetFileInformationByHandleEx( + hFile: HANDLE, + FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, + lpFileInformation: LPVOID, + dwBufferSize: DWORD, + ) -> BOOL; +} +ENUM!{enum FILE_ID_TYPE { + FileIdType, + ObjectIdType, + ExtendedFileIdType, + MaximumFileIdType, +}} +UNION!{union FILE_ID_DESCRIPTOR_u { + [u64; 2], + FileId FileId_mut: LARGE_INTEGER, + ObjectId ObjectId_mut: GUID, + ExtendedFileId ExtendedFileId_mut: FILE_ID_128, +}} +STRUCT!{struct FILE_ID_DESCRIPTOR { + dwSize: DWORD, + Type: FILE_ID_TYPE, + u: FILE_ID_DESCRIPTOR_u, +}} +pub type LPFILE_ID_DESCRIPTOR = *mut FILE_ID_DESCRIPTOR; +extern "system" { + pub fn OpenFileById( + hVolumeHint: HANDLE, + lpFileId: LPFILE_ID_DESCRIPTOR, + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + dwFlagsAndAttributes: DWORD, + ) -> HANDLE; + pub fn CreateSymbolicLinkA( + lpSymlinkFileName: LPCSTR, + lpTargetFileName: LPCSTR, + dwFlags: DWORD, + ) -> BOOLEAN; + pub fn CreateSymbolicLinkW( + lpSymlinkFileName: LPCWSTR, + lpTargetFileName: LPCWSTR, + dwFlags: DWORD, + ) -> BOOLEAN; + pub fn QueryActCtxSettingsW( + dwFlags: DWORD, + hActCtx: HANDLE, + settingsNameSpace: PCWSTR, + settingName: PCWSTR, + pvBuffer: PWSTR, + dwBuffer: SIZE_T, + pdwWrittenOrRequired: *mut SIZE_T, + ) -> BOOL; + pub fn CreateSymbolicLinkTransactedA( + lpSymlinkFileName: LPCSTR, + lpTargetFileName: LPCSTR, + dwFlags: DWORD, + hTransaction: HANDLE, + ) -> BOOLEAN; + pub fn CreateSymbolicLinkTransactedW( + lpSymlinkFileName: LPCWSTR, + lpTargetFileName: LPCWSTR, + dwFlags: DWORD, + hTransaction: HANDLE, + ) -> BOOLEAN; + pub fn ReplacePartitionUnit( + TargetPartition: PWSTR, + SparePartition: PWSTR, + Flags: ULONG, + ) -> BOOL; + pub fn AddSecureMemoryCacheCallback( + pfnCallBack: PSECURE_MEMORY_CACHE_CALLBACK + ) -> BOOL; + pub fn RemoveSecureMemoryCacheCallback( + pfnCallBack: PSECURE_MEMORY_CACHE_CALLBACK + ) -> BOOL; + pub fn CopyContext( + Destination: PCONTEXT, + ContextFlags: DWORD, + Source: PCONTEXT + ) -> BOOL; + pub fn InitializeContext( + Buffer: PVOID, + ContextFlags: DWORD, + Context: *mut PCONTEXT, + ContextLength: PDWORD, + ) -> BOOL; + pub fn GetEnabledXStateFeatures() -> DWORD64; + pub fn GetXStateFeaturesMask( + Context: PCONTEXT, + FeatureMask: PDWORD64 + ) -> BOOL; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn LocateXStateFeature( + Context: PCONTEXT, + FeatureId: DWORD, + Length: PDWORD + ) -> PVOID; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + pub fn SetXStateFeaturesMask( + Context: PCONTEXT, + FeatureMask: DWORD64 + ) -> BOOL; + pub fn EnableThreadProfiling( + ThreadHandle: HANDLE, + Flags: DWORD, + HardwareCounters: DWORD64, + PerformanceDataHandle: *mut HANDLE, + ) -> BOOL; + pub fn DisableThreadProfiling( + PerformanceDataHandle: HANDLE + ) -> DWORD; + pub fn QueryThreadProfiling( + ThreadHandle: HANDLE, + Enabled: PBOOLEAN + ) -> DWORD; + pub fn ReadThreadProfilingData( + PerformanceDataHandle: HANDLE, + Flags: DWORD, + PerformanceData: PPERFORMANCE_DATA, + ) -> DWORD; + // intrinsic InterlockedIncrement + // intrinsic InterlockedDecrement + // intrinsic InterlockedExchange + // intrinsic InterlockedExchangeAdd + // intrinsic InterlockedExchangeSubtract + // intrinsic InterlockedCompareExchange + // intrinsic InterlockedAnd + // intrinsic InterlockedOr + // intrinsic InterlockedXor +} diff --git a/src/vendor/winapi/src/um/wincodec.rs b/src/vendor/winapi/src/um/wincodec.rs new file mode 100644 index 0000000000..11818f86ee --- /dev/null +++ b/src/vendor/winapi/src/um/wincodec.rs @@ -0,0 +1,1865 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Mappings for the contents of wincodec.h +use ctypes::c_double; +use shared::basetsd::{UINT32, ULONG_PTR}; +use shared::dxgiformat::DXGI_FORMAT; +use shared::dxgitype::{ + DXGI_JPEG_AC_HUFFMAN_TABLE, DXGI_JPEG_DC_HUFFMAN_TABLE, + DXGI_JPEG_QUANTIZATION_TABLE +}; +use shared::guiddef::{CLSID, GUID, REFCLSID, REFGUID}; +use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, INT, LPVOID, UINT, ULONG}; +use shared::ntdef::{LPCWSTR, LPWSTR, PCWSTR, WCHAR}; +use shared::windef::{HBITMAP, HICON, HPALETTE}; +use shared::winerror::{ + E_ABORT, E_ACCESSDENIED, E_FAIL, E_INVALIDARG, E_NOTIMPL, E_OUTOFMEMORY, HRESULT, + SEVERITY_ERROR +}; +use um::d2d1::ID2D1Image; +use um::d2d1_1::ID2D1Device; +use um::dcommon::D2D1_PIXEL_FORMAT; +use um::objidlbase::{IEnumString, IEnumUnknown, IStream, IStreamVtbl}; +use um::ocidl::IPropertyBag2; +use um::propidl::PROPVARIANT; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::{HANDLE, ULARGE_INTEGER}; +DEFINE_GUID!{CLSID_WICImagingFactory, + 0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa} +DEFINE_GUID!{CLSID_WICImagingFactory1, + 0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa} +DEFINE_GUID!{CLSID_WICImagingFactory2, + 0x317d06e8, 0x5f24, 0x433d, 0xbd, 0xf7, 0x79, 0xce, 0x68, 0xd8, 0xab, 0xc2} +DEFINE_GUID!{GUID_VendorMicrosoft, + 0xf0e749ca, 0xedef, 0x4589, 0xa7, 0x3a, 0xee, 0xe, 0x62, 0x6a, 0x2a, 0x2b} +DEFINE_GUID!{GUID_VendorMicrosoftBuiltIn, + 0x257a30fd, 0x6b6, 0x462b, 0xae, 0xa4, 0x63, 0xf7, 0xb, 0x86, 0xe5, 0x33} +DEFINE_GUID!{CLSID_WICPngDecoder, + 0x389ea17b, 0x5078, 0x4cde, 0xb6, 0xef, 0x25, 0xc1, 0x51, 0x75, 0xc7, 0x51} +DEFINE_GUID!{CLSID_WICPngDecoder1, + 0x389ea17b, 0x5078, 0x4cde, 0xb6, 0xef, 0x25, 0xc1, 0x51, 0x75, 0xc7, 0x51} +DEFINE_GUID!{CLSID_WICPngDecoder2, + 0xe018945b, 0xaa86, 0x4008, 0x9b, 0xd4, 0x67, 0x77, 0xa1, 0xe4, 0x0c, 0x11} +DEFINE_GUID!{CLSID_WICBmpDecoder, + 0x6b462062, 0x7cbf, 0x400d, 0x9f, 0xdb, 0x81, 0x3d, 0xd1, 0x0f, 0x27, 0x78} +DEFINE_GUID!{CLSID_WICIcoDecoder, + 0xc61bfcdf, 0x2e0f, 0x4aad, 0xa8, 0xd7, 0xe0, 0x6b, 0xaf, 0xeb, 0xcd, 0xfe} +DEFINE_GUID!{CLSID_WICJpegDecoder, + 0x9456a480, 0xe88b, 0x43ea, 0x9e, 0x73, 0x0b, 0x2d, 0x9b, 0x71, 0xb1, 0xca} +DEFINE_GUID!{CLSID_WICGifDecoder, + 0x381dda3c, 0x9ce9, 0x4834, 0xa2, 0x3e, 0x1f, 0x98, 0xf8, 0xfc, 0x52, 0xbe} +DEFINE_GUID!{CLSID_WICTiffDecoder, + 0xb54e85d9, 0xfe23, 0x499f, 0x8b, 0x88, 0x6a, 0xce, 0xa7, 0x13, 0x75, 0x2b} +DEFINE_GUID!{CLSID_WICWmpDecoder, + 0xa26cec36, 0x234c, 0x4950, 0xae, 0x16, 0xe3, 0x4a, 0xac, 0xe7, 0x1d, 0x0d} +DEFINE_GUID!{CLSID_WICDdsDecoder, + 0x9053699f, 0xa341, 0x429d, 0x9e, 0x90, 0xee, 0x43, 0x7c, 0xf8, 0x0c, 0x73} +DEFINE_GUID!{CLSID_WICBmpEncoder, + 0x69be8bb4, 0xd66d, 0x47c8, 0x86, 0x5a, 0xed, 0x15, 0x89, 0x43, 0x37, 0x82} +DEFINE_GUID!{CLSID_WICPngEncoder, + 0x27949969, 0x876a, 0x41d7, 0x94, 0x47, 0x56, 0x8f, 0x6a, 0x35, 0xa4, 0xdc} +DEFINE_GUID!{CLSID_WICJpegEncoder, + 0x1a34f5c1, 0x4a5a, 0x46dc, 0xb6, 0x44, 0x1f, 0x45, 0x67, 0xe7, 0xa6, 0x76} +DEFINE_GUID!{CLSID_WICGifEncoder, + 0x114f5598, 0x0b22, 0x40a0, 0x86, 0xa1, 0xc8, 0x3e, 0xa4, 0x95, 0xad, 0xbd} +DEFINE_GUID!{CLSID_WICTiffEncoder, + 0x0131be10, 0x2001, 0x4c5f, 0xa9, 0xb0, 0xcc, 0x88, 0xfa, 0xb6, 0x4c, 0xe8} +DEFINE_GUID!{CLSID_WICWmpEncoder, + 0xac4ce3cb, 0xe1c1, 0x44cd, 0x82, 0x15, 0x5a, 0x16, 0x65, 0x50, 0x9e, 0xc2} +DEFINE_GUID!{CLSID_WICDdsEncoder, + 0xa61dde94, 0x66ce, 0x4ac1, 0x88, 0x1b, 0x71, 0x68, 0x05, 0x88, 0x89, 0x5e} +DEFINE_GUID!{CLSID_WICAdngDecoder, + 0x981d9411, 0x909e, 0x42a7, 0x8f, 0x5d, 0xa7, 0x47, 0xff, 0x05, 0x2e, 0xdb} +DEFINE_GUID!{CLSID_WICJpegQualcommPhoneEncoder, + 0x68ed5c62, 0xf534, 0x4979, 0xb2, 0xb3, 0x68, 0x6a, 0x12, 0xb2, 0xb3, 0x4c} +DEFINE_GUID!{GUID_ContainerFormatBmp, + 0x0af1d87e, 0xfcfe, 0x4188, 0xbd, 0xeb, 0xa7, 0x90, 0x64, 0x71, 0xcb, 0xe3} +DEFINE_GUID!{GUID_ContainerFormatPng, + 0x1b7cfaf4, 0x713f, 0x473c, 0xbb, 0xcd, 0x61, 0x37, 0x42, 0x5f, 0xae, 0xaf} +DEFINE_GUID!{GUID_ContainerFormatIco, + 0xa3a860c4, 0x338f, 0x4c17, 0x91, 0x9a, 0xfb, 0xa4, 0xb5, 0x62, 0x8f, 0x21} +DEFINE_GUID!{GUID_ContainerFormatJpeg, + 0x19e4a5aa, 0x5662, 0x4fc5, 0xa0, 0xc0, 0x17, 0x58, 0x02, 0x8e, 0x10, 0x57} +DEFINE_GUID!{GUID_ContainerFormatTiff, + 0x163bcc30, 0xe2e9, 0x4f0b, 0x96, 0x1d, 0xa3, 0xe9, 0xfd, 0xb7, 0x88, 0xa3} +DEFINE_GUID!{GUID_ContainerFormatGif, + 0x1f8a5601, 0x7d4d, 0x4cbd, 0x9c, 0x82, 0x1b, 0xc8, 0xd4, 0xee, 0xb9, 0xa5} +DEFINE_GUID!{GUID_ContainerFormatWmp, + 0x57a37caa, 0x367a, 0x4540, 0x91, 0x6b, 0xf1, 0x83, 0xc5, 0x09, 0x3a, 0x4b} +DEFINE_GUID!{GUID_ContainerFormatDds, + 0x9967cb95, 0x2e85, 0x4ac8, 0x8c, 0xa2, 0x83, 0xd7, 0xcc, 0xd4, 0x25, 0xc9} +DEFINE_GUID!{GUID_ContainerFormatAdng, + 0xf3ff6d0d, 0x38c0, 0x41c4, 0xb1, 0xfe, 0x1f, 0x38, 0x24, 0xf1, 0x7b, 0x84} +DEFINE_GUID!{CLSID_WICImagingCategories, + 0xfae3d380, 0xfea4, 0x4623, 0x8c, 0x75, 0xc6, 0xb6, 0x11, 0x10, 0xb6, 0x81} +DEFINE_GUID!{CATID_WICBitmapDecoders, + 0x7ed96837, 0x96f0, 0x4812, 0xb2, 0x11, 0xf1, 0x3c, 0x24, 0x11, 0x7e, 0xd3} +DEFINE_GUID!{CATID_WICBitmapEncoders, + 0xac757296, 0x3522, 0x4e11, 0x98, 0x62, 0xc1, 0x7b, 0xe5, 0xa1, 0x76, 0x7e} +DEFINE_GUID!{CATID_WICPixelFormats, + 0x2b46e70f, 0xcda7, 0x473e, 0x89, 0xf6, 0xdc, 0x96, 0x30, 0xa2, 0x39, 0x0b} +DEFINE_GUID!{CATID_WICFormatConverters, + 0x7835eae8, 0xbf14, 0x49d1, 0x93, 0xce, 0x53, 0x3a, 0x40, 0x7b, 0x22, 0x48} +DEFINE_GUID!{CATID_WICMetadataReader, + 0x05af94d8, 0x7174, 0x4cd2, 0xbe, 0x4a, 0x41, 0x24, 0xb8, 0x0e, 0xe4, 0xb8} +DEFINE_GUID!{CATID_WICMetadataWriter, + 0xabe3b9a4, 0x257d, 0x4b97, 0xbd, 0x1a, 0x29, 0x4a, 0xf4, 0x96, 0x22, 0x2e} +DEFINE_GUID!{CLSID_WICDefaultFormatConverter, + 0x1a3f11dc, 0xb514, 0x4b17, 0x8c, 0x5f, 0x21, 0x54, 0x51, 0x38, 0x52, 0xf1} +DEFINE_GUID!{CLSID_WICFormatConverterHighColor, + 0xac75d454, 0x9f37, 0x48f8, 0xb9, 0x72, 0x4e, 0x19, 0xbc, 0x85, 0x60, 0x11} +DEFINE_GUID!{CLSID_WICFormatConverterNChannel, + 0xc17cabb2, 0xd4a3, 0x47d7, 0xa5, 0x57, 0x33, 0x9b, 0x2e, 0xfb, 0xd4, 0xf1} +DEFINE_GUID!{CLSID_WICFormatConverterWMPhoto, + 0x9cb5172b, 0xd600, 0x46ba, 0xab, 0x77, 0x77, 0xbb, 0x7e, 0x3a, 0x00, 0xd9} +DEFINE_GUID!{CLSID_WICPlanarFormatConverter, + 0x184132b8, 0x32f8, 0x4784, 0x91, 0x31, 0xdd, 0x72, 0x24, 0xb2, 0x34, 0x38} +pub type WICColor = UINT32; +STRUCT!{struct WICRect { + X: INT, + Y: INT, + Width: INT, + Height: INT, +}} +pub type WICInProcPointer = *mut BYTE; +ENUM!{enum WICColorContextType { + WICColorContextUninitialized = 0x00000000, + WICColorContextProfile = 0x00000001, + WICColorContextExifColorSpace = 0x00000002, +}} +pub const CODEC_FORCE_DWORD: DWORD = 0x7FFFFFFF; +pub const WIC_JPEG_MAX_COMPONENT_COUNT: UINT = 4; +pub const WIC_JPEG_MAX_TABLE_INDEX: UINT = 3; +pub const WIC_JPEG_SAMPLE_FACTORS_ONE: DWORD = 0x00000011; +pub const WIC_JPEG_SAMPLE_FACTORS_THREE_420: DWORD = 0x00111122; +pub const WIC_JPEG_SAMPLE_FACTORS_THREE_422: DWORD = 0x00111121; +pub const WIC_JPEG_SAMPLE_FACTORS_THREE_440: DWORD = 0x00111112; +pub const WIC_JPEG_SAMPLE_FACTORS_THREE_444: DWORD = 0x00111111; +pub const WIC_JPEG_QUANTIZATION_BASELINE_ONE: DWORD = 0x00000000; +pub const WIC_JPEG_QUANTIZATION_BASELINE_THREE: DWORD = 0x00010100; +pub const WIC_JPEG_HUFFMAN_BASELINE_ONE: DWORD = 0x00000000; +pub const WIC_JPEG_HUFFMAN_BASELINE_THREE: DWORD = 0x00111100; +pub type REFWICPixelFormatGUID = REFGUID; +pub type WICPixelFormatGUID = GUID; +DEFINE_GUID!{GUID_WICPixelFormatDontCare, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x00} +DEFINE_GUID!{GUID_WICPixelFormat1bppIndexed, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x01} +DEFINE_GUID!{GUID_WICPixelFormat2bppIndexed, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x02} +DEFINE_GUID!{GUID_WICPixelFormat4bppIndexed, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x03} +DEFINE_GUID!{GUID_WICPixelFormat8bppIndexed, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x04} +DEFINE_GUID!{GUID_WICPixelFormatBlackWhite, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x05} +DEFINE_GUID!{GUID_WICPixelFormat2bppGray, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x06} +DEFINE_GUID!{GUID_WICPixelFormat4bppGray, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x07} +DEFINE_GUID!{GUID_WICPixelFormat8bppGray, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x08} +DEFINE_GUID!{GUID_WICPixelFormat8bppAlpha, + 0xe6cd0116, 0xeeba, 0x4161, 0xaa, 0x85, 0x27, 0xdd, 0x9f, 0xb3, 0xa8, 0x95} +DEFINE_GUID!{GUID_WICPixelFormat16bppBGR555, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x09} +DEFINE_GUID!{GUID_WICPixelFormat16bppBGR565, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0a} +DEFINE_GUID!{GUID_WICPixelFormat16bppBGRA5551, + 0x05ec7c2b, 0xf1e6, 0x4961, 0xad, 0x46, 0xe1, 0xcc, 0x81, 0x0a, 0x87, 0xd2} +DEFINE_GUID!{GUID_WICPixelFormat16bppGray, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0b} +DEFINE_GUID!{GUID_WICPixelFormat24bppBGR, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0c} +DEFINE_GUID!{GUID_WICPixelFormat24bppRGB, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0d} +DEFINE_GUID!{GUID_WICPixelFormat32bppBGR, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0e} +DEFINE_GUID!{GUID_WICPixelFormat32bppBGRA, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0f} +DEFINE_GUID!{GUID_WICPixelFormat32bppPBGRA, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x10} +DEFINE_GUID!{GUID_WICPixelFormat32bppGrayFloat, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x11} +DEFINE_GUID!{GUID_WICPixelFormat32bppRGB, + 0xd98c6b95, 0x3efe, 0x47d6, 0xbb, 0x25, 0xeb, 0x17, 0x48, 0xab, 0x0c, 0xf1} +DEFINE_GUID!{GUID_WICPixelFormat32bppRGBA, + 0xf5c7ad2d, 0x6a8d, 0x43dd, 0xa7, 0xa8, 0xa2, 0x99, 0x35, 0x26, 0x1a, 0xe9} +DEFINE_GUID!{GUID_WICPixelFormat32bppPRGBA, + 0x3cc4a650, 0xa527, 0x4d37, 0xa9, 0x16, 0x31, 0x42, 0xc7, 0xeb, 0xed, 0xba} +DEFINE_GUID!{GUID_WICPixelFormat48bppRGB, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x15} +DEFINE_GUID!{GUID_WICPixelFormat48bppBGR, + 0xe605a384, 0xb468, 0x46ce, 0xbb, 0x2e, 0x36, 0xf1, 0x80, 0xe6, 0x43, 0x13} +DEFINE_GUID!{GUID_WICPixelFormat64bppRGB, + 0xa1182111, 0x186d, 0x4d42, 0xbc, 0x6a, 0x9c, 0x83, 0x03, 0xa8, 0xdf, 0xf9} +DEFINE_GUID!{GUID_WICPixelFormat64bppRGBA, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x16} +DEFINE_GUID!{GUID_WICPixelFormat64bppBGRA, + 0x1562ff7c, 0xd352, 0x46f9, 0x97, 0x9e, 0x42, 0x97, 0x6b, 0x79, 0x22, 0x46} +DEFINE_GUID!{GUID_WICPixelFormat64bppPRGBA, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x17} +DEFINE_GUID!{GUID_WICPixelFormat64bppPBGRA, + 0x8c518e8e, 0xa4ec, 0x468b, 0xae, 0x70, 0xc9, 0xa3, 0x5a, 0x9c, 0x55, 0x30} +DEFINE_GUID!{GUID_WICPixelFormat16bppGrayFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x13} +DEFINE_GUID!{GUID_WICPixelFormat32bppBGR101010, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x14} +DEFINE_GUID!{GUID_WICPixelFormat48bppRGBFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x12} +DEFINE_GUID!{GUID_WICPixelFormat48bppBGRFixedPoint, + 0x49ca140e, 0xcab6, 0x493b, 0x9d, 0xdf, 0x60, 0x18, 0x7c, 0x37, 0x53, 0x2a} +DEFINE_GUID!{GUID_WICPixelFormat96bppRGBFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x18} +DEFINE_GUID!{GUID_WICPixelFormat96bppRGBFloat, + 0xe3fed78f, 0xe8db, 0x4acf, 0x84, 0xc1, 0xe9, 0x7f, 0x61, 0x36, 0xb3, 0x27} +DEFINE_GUID!{GUID_WICPixelFormat128bppRGBAFloat, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x19} +DEFINE_GUID!{GUID_WICPixelFormat128bppPRGBAFloat, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1a} +DEFINE_GUID!{GUID_WICPixelFormat128bppRGBFloat, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1b} +DEFINE_GUID!{GUID_WICPixelFormat32bppCMYK, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1c} +DEFINE_GUID!{GUID_WICPixelFormat64bppRGBAFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1d} +DEFINE_GUID!{GUID_WICPixelFormat64bppBGRAFixedPoint, + 0x356de33c, 0x54d2, 0x4a23, 0xbb, 0x4, 0x9b, 0x7b, 0xf9, 0xb1, 0xd4, 0x2d} +DEFINE_GUID!{GUID_WICPixelFormat64bppRGBFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x40} +DEFINE_GUID!{GUID_WICPixelFormat128bppRGBAFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1e} +DEFINE_GUID!{GUID_WICPixelFormat128bppRGBFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x41} +DEFINE_GUID!{GUID_WICPixelFormat64bppRGBAHalf, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3a} +DEFINE_GUID!{GUID_WICPixelFormat64bppPRGBAHalf, + 0x58ad26c2, 0xc623, 0x4d9d, 0xb3, 0x20, 0x38, 0x7e, 0x49, 0xf8, 0xc4, 0x42} +DEFINE_GUID!{GUID_WICPixelFormat64bppRGBHalf, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x42} +DEFINE_GUID!{GUID_WICPixelFormat48bppRGBHalf, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3b} +DEFINE_GUID!{GUID_WICPixelFormat32bppRGBE, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3d} +DEFINE_GUID!{GUID_WICPixelFormat16bppGrayHalf, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3e} +DEFINE_GUID!{GUID_WICPixelFormat32bppGrayFixedPoint, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x3f} +DEFINE_GUID!{GUID_WICPixelFormat32bppRGBA1010102, + 0x25238D72, 0xFCF9, 0x4522, 0xb5, 0x14, 0x55, 0x78, 0xe5, 0xad, 0x55, 0xe0} +DEFINE_GUID!{GUID_WICPixelFormat32bppRGBA1010102XR, + 0x00DE6B9A, 0xC101, 0x434b, 0xb5, 0x02, 0xd0, 0x16, 0x5e, 0xe1, 0x12, 0x2c} +DEFINE_GUID!{GUID_WICPixelFormat64bppCMYK, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x1f} +DEFINE_GUID!{GUID_WICPixelFormat24bpp3Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x20} +DEFINE_GUID!{GUID_WICPixelFormat32bpp4Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x21} +DEFINE_GUID!{GUID_WICPixelFormat40bpp5Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x22} +DEFINE_GUID!{GUID_WICPixelFormat48bpp6Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x23} +DEFINE_GUID!{GUID_WICPixelFormat56bpp7Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x24} +DEFINE_GUID!{GUID_WICPixelFormat64bpp8Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x25} +DEFINE_GUID!{GUID_WICPixelFormat48bpp3Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x26} +DEFINE_GUID!{GUID_WICPixelFormat64bpp4Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x27} +DEFINE_GUID!{GUID_WICPixelFormat80bpp5Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x28} +DEFINE_GUID!{GUID_WICPixelFormat96bpp6Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x29} +DEFINE_GUID!{GUID_WICPixelFormat112bpp7Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2a} +DEFINE_GUID!{GUID_WICPixelFormat128bpp8Channels, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2b} +DEFINE_GUID!{GUID_WICPixelFormat40bppCMYKAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2c} +DEFINE_GUID!{GUID_WICPixelFormat80bppCMYKAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2d} +DEFINE_GUID!{GUID_WICPixelFormat32bpp3ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2e} +DEFINE_GUID!{GUID_WICPixelFormat40bpp4ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x2f} +DEFINE_GUID!{GUID_WICPixelFormat48bpp5ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x30} +DEFINE_GUID!{GUID_WICPixelFormat56bpp6ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x31} +DEFINE_GUID!{GUID_WICPixelFormat64bpp7ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x32} +DEFINE_GUID!{GUID_WICPixelFormat72bpp8ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x33} +DEFINE_GUID!{GUID_WICPixelFormat64bpp3ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x34} +DEFINE_GUID!{GUID_WICPixelFormat80bpp4ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x35} +DEFINE_GUID!{GUID_WICPixelFormat96bpp5ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x36} +DEFINE_GUID!{GUID_WICPixelFormat112bpp6ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x37} +DEFINE_GUID!{GUID_WICPixelFormat128bpp7ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x38} +DEFINE_GUID!{GUID_WICPixelFormat144bpp8ChannelsAlpha, + 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x39} +DEFINE_GUID!{GUID_WICPixelFormat8bppY, + 0x91B4DB54, 0x2DF9, 0x42F0, 0xB4, 0x49, 0x29, 0x09, 0xBB, 0x3D, 0xF8, 0x8E} +DEFINE_GUID!{GUID_WICPixelFormat8bppCb, + 0x1339F224, 0x6BFE, 0x4C3E, 0x93, 0x02, 0xE4, 0xF3, 0xA6, 0xD0, 0xCA, 0x2A} +DEFINE_GUID!{GUID_WICPixelFormat8bppCr, + 0xB8145053, 0x2116, 0x49F0, 0x88, 0x35, 0xED, 0x84, 0x4B, 0x20, 0x5C, 0x51} +DEFINE_GUID!{GUID_WICPixelFormat16bppCbCr, + 0xFF95BA6E, 0x11E0, 0x4263, 0xBB, 0x45, 0x01, 0x72, 0x1F, 0x34, 0x60, 0xA4} +DEFINE_GUID!{GUID_WICPixelFormat16bppYQuantizedDctCoefficients, + 0xA355F433, 0x48E8, 0x4A42, 0x84, 0xD8, 0xE2, 0xAA, 0x26, 0xCA, 0x80, 0xA4} +DEFINE_GUID!{GUID_WICPixelFormat16bppCbQuantizedDctCoefficients, + 0xD2C4FF61, 0x56A5, 0x49C2, 0x8B, 0x5C, 0x4C, 0x19, 0x25, 0x96, 0x48, 0x37} +DEFINE_GUID!{GUID_WICPixelFormat16bppCrQuantizedDctCoefficients, + 0x2FE354F0, 0x1680, 0x42D8, 0x92, 0x31, 0xE7, 0x3C, 0x05, 0x65, 0xBF, 0xC1} +ENUM!{enum WICBitmapCreateCacheOption { + WICBitmapNoCache = 0x00000000, + WICBitmapCacheOnDemand = 0x00000001, + WICBitmapCacheOnLoad = 0x00000002, + WICBITMAPCREATECACHEOPTION_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICDecodeOptions { + WICDecodeMetadataCacheOnDemand = 0x00000000, + WICDecodeMetadataCacheOnLoad = 0x00000001, + WICMETADATACACHEOPTION_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICBitmapEncoderCacheOption { + WICBitmapEncoderCacheInMemory = 0x00000000, + WICBitmapEncoderCacheTempFile = 0x00000001, + WICBitmapEncoderNoCache = 0x00000002, + WICBITMAPENCODERCACHEOPTION_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICComponentType { + WICDecoder = 0x00000001, + WICEncoder = 0x00000002, + WICPixelFormatConverter = 0x00000004, + WICMetadataReader = 0x00000008, + WICMetadataWriter = 0x00000010, + WICPixelFormat = 0x00000020, + WICAllComponents = 0x0000003F, + WICCOMPONENTTYPE_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICComponentEnumerateOptions { + WICComponentEnumerateDefault = 0x00000000, + WICComponentEnumerateRefresh = 0x00000001, + WICComponentEnumerateDisabled = 0x80000000, + WICComponentEnumerateUnsigned = 0x40000000, + WICComponentEnumerateBuiltInOnly = 0x20000000, + WICCOMPONENTENUMERATEOPTIONS_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +STRUCT!{struct WICBitmapPattern { + Position: ULARGE_INTEGER, + Length: ULONG, + Pattern: *mut BYTE, + Mask: *mut BYTE, + EndOfStream: BOOL, +}} +ENUM!{enum WICBitmapInterpolationMode { + WICBitmapInterpolationModeNearestNeighbor = 0x00000000, + WICBitmapInterpolationModeLinear = 0x00000001, + WICBitmapInterpolationModeCubic = 0x00000002, + WICBitmapInterpolationModeFant = 0x00000003, + WICBitmapInterpolationModeHighQualityCubic = 0x00000004, + WICBITMAPINTERPOLATIONMODE_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICBitmapPaletteType { + WICBitmapPaletteTypeCustom = 0x00000000, + WICBitmapPaletteTypeMedianCut = 0x00000001, + WICBitmapPaletteTypeFixedBW = 0x00000002, + WICBitmapPaletteTypeFixedHalftone8 = 0x00000003, + WICBitmapPaletteTypeFixedHalftone27 = 0x00000004, + WICBitmapPaletteTypeFixedHalftone64 = 0x00000005, + WICBitmapPaletteTypeFixedHalftone125 = 0x00000006, + WICBitmapPaletteTypeFixedHalftone216 = 0x00000007, + WICBitmapPaletteTypeFixedWebPalette = WICBitmapPaletteTypeFixedHalftone216, + WICBitmapPaletteTypeFixedHalftone252 = 0x00000008, + WICBitmapPaletteTypeFixedHalftone256 = 0x00000009, + WICBitmapPaletteTypeFixedGray4 = 0x0000000A, + WICBitmapPaletteTypeFixedGray16 = 0x0000000B, + WICBitmapPaletteTypeFixedGray256 = 0x0000000C, + WICBITMAPPALETTETYPE_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICBitmapDitherType { + WICBitmapDitherTypeNone = 0x00000000, + WICBitmapDitherTypeSolid = 0x00000000, + WICBitmapDitherTypeOrdered4x4 = 0x00000001, + WICBitmapDitherTypeOrdered8x8 = 0x00000002, + WICBitmapDitherTypeOrdered16x16 = 0x00000003, + WICBitmapDitherTypeSpiral4x4 = 0x00000004, + WICBitmapDitherTypeSpiral8x8 = 0x00000005, + WICBitmapDitherTypeDualSpiral4x4 = 0x00000006, + WICBitmapDitherTypeDualSpiral8x8 = 0x00000007, + WICBitmapDitherTypeErrorDiffusion = 0x00000008, + WICBITMAPDITHERTYPE_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICBitmapAlphaChannelOption { + WICBitmapUseAlpha = 0x00000000, + WICBitmapUsePremultipliedAlpha = 0x00000001, + WICBitmapIgnoreAlpha = 0x00000002, + WICBITMAPALPHACHANNELOPTIONS_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICBitmapTransformOptions { + WICBitmapTransformRotate0 = 0x00000000, + WICBitmapTransformRotate90 = 0x00000001, + WICBitmapTransformRotate180 = 0x00000002, + WICBitmapTransformRotate270 = 0x00000003, + WICBitmapTransformFlipHorizontal = 0x00000008, + WICBitmapTransformFlipVertical = 0x00000010, + WICBITMAPTRANSFORMOPTIONS_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICBitmapLockFlags { + WICBitmapLockRead = 0x00000001, + WICBitmapLockWrite = 0x00000002, + WICBITMAPLOCKFLAGS_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICBitmapDecoderCapabilities { + WICBitmapDecoderCapabilitySameEncoder = 0x00000001, + WICBitmapDecoderCapabilityCanDecodeAllImages = 0x00000002, + WICBitmapDecoderCapabilityCanDecodeSomeImages = 0x00000004, + WICBitmapDecoderCapabilityCanEnumerateMetadata = 0x00000008, + WICBitmapDecoderCapabilityCanDecodeThumbnail = 0x00000010, + WICBITMAPDECODERCAPABILITIES_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICProgressOperation { + WICProgressOperationCopyPixels = 0x00000001, + WICProgressOperationWritePixels = 0x00000002, + WICProgressOperationAll = 0x0000FFFF, + WICPROGRESSOPERATION_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICProgressNotification { + WICProgressNotificationBegin = 0x00010000, + WICProgressNotificationEnd = 0x00020000, + WICProgressNotificationFrequent = 0x00040000, + WICProgressNotificationAll = 0xFFFF0000, + WICPROGRESSNOTIFICATION_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICComponentSigning { + WICComponentSigned = 0x00000001, + WICComponentUnsigned = 0x00000002, + WICComponentSafe = 0x00000004, + WICComponentDisabled = 0x80000000, + WICCOMPONENTSIGNING_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICGifLogicalScreenDescriptorProperties { + WICGifLogicalScreenSignature = 0x00000001, + WICGifLogicalScreenDescriptorWidth = 0x00000002, + WICGifLogicalScreenDescriptorHeight = 0x00000003, + WICGifLogicalScreenDescriptorGlobalColorTableFlag = 0x00000004, + WICGifLogicalScreenDescriptorColorResolution = 0x00000005, + WICGifLogicalScreenDescriptorSortFlag = 0x00000006, + WICGifLogicalScreenDescriptorGlobalColorTableSize = 0x00000007, + WICGifLogicalScreenDescriptorBackgroundColorIndex = 0x00000008, + WICGifLogicalScreenDescriptorPixelAspectRatio = 0x00000009, + WICGifLogicalScreenDescriptorProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICGifImageDescriptorProperties { + WICGifImageDescriptorLeft = 0x00000001, + WICGifImageDescriptorTop = 0x00000002, + WICGifImageDescriptorWidth = 0x00000003, + WICGifImageDescriptorHeight = 0x00000004, + WICGifImageDescriptorLocalColorTableFlag = 0x00000005, + WICGifImageDescriptorInterlaceFlag = 0x00000006, + WICGifImageDescriptorSortFlag = 0x00000007, + WICGifImageDescriptorLocalColorTableSize = 0x00000008, + WICGifImageDescriptorProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICGifGraphicControlExtensionProperties { + WICGifGraphicControlExtensionDisposal = 0x00000001, + WICGifGraphicControlExtensionUserInputFlag = 0x00000002, + WICGifGraphicControlExtensionTransparencyFlag = 0x00000003, + WICGifGraphicControlExtensionDelay = 0x00000004, + WICGifGraphicControlExtensionTransparentColorIndex = 0x00000005, + WICGifGraphicControlExtensionProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICGifApplicationExtensionProperties { + WICGifApplicationExtensionApplication = 0x00000001, + WICGifApplicationExtensionData = 0x00000002, + WICGifApplicationExtensionProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICGifCommentExtensionProperties { + WICGifCommentExtensionText = 0x00000001, + WICGifCommentExtensionProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICJpegCommentProperties { + WICJpegCommentText = 0x00000001, + WICJpegCommentProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICJpegLuminanceProperties { + WICJpegLuminanceTable = 0x00000001, + WICJpegLuminanceProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICJpegChrominanceProperties { + WICJpegChrominanceTable = 0x00000001, + WICJpegChrominanceProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WIC8BIMIptcProperties { + WIC8BIMIptcPString = 0x00000000, + WIC8BIMIptcEmbeddedIPTC = 0x00000001, + WIC8BIMIptcProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WIC8BIMResolutionInfoProperties { + WIC8BIMResolutionInfoPString = 0x00000001, + WIC8BIMResolutionInfoHResolution = 0x00000002, + WIC8BIMResolutionInfoHResolutionUnit = 0x00000003, + WIC8BIMResolutionInfoWidthUnit = 0x00000004, + WIC8BIMResolutionInfoVResolution = 0x00000005, + WIC8BIMResolutionInfoVResolutionUnit = 0x00000006, + WIC8BIMResolutionInfoHeightUnit = 0x00000007, + WIC8BIMResolutionInfoProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WIC8BIMIptcDigestProperties { + WIC8BIMIptcDigestPString = 0x00000001, + WIC8BIMIptcDigestIptcDigest = 0x00000002, + WIC8BIMIptcDigestProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngGamaProperties { + WICPngGamaGamma = 0x00000001, + WICPngGamaProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngBkgdProperties { + WICPngBkgdBackgroundColor = 0x00000001, + WICPngBkgdProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngItxtProperties { + WICPngItxtKeyword = 0x00000001, + WICPngItxtCompressionFlag = 0x00000002, + WICPngItxtLanguageTag = 0x00000003, + WICPngItxtTranslatedKeyword = 0x00000004, + WICPngItxtText = 0x00000005, + WICPngItxtProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngChrmProperties { + WICPngChrmWhitePointX = 0x00000001, + WICPngChrmWhitePointY = 0x00000002, + WICPngChrmRedX = 0x00000003, + WICPngChrmRedY = 0x00000004, + WICPngChrmGreenX = 0x00000005, + WICPngChrmGreenY = 0x00000006, + WICPngChrmBlueX = 0x00000007, + WICPngChrmBlueY = 0x0000008, + WICPngChrmProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngHistProperties { + WICPngHistFrequencies = 0x00000001, + WICPngHistProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngIccpProperties { + WICPngIccpProfileName = 0x00000001, + WICPngIccpProfileData = 0x00000002, + WICPngIccpProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngSrgbProperties { + WICPngSrgbRenderingIntent = 0x00000001, + WICPngSrgbProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngTimeProperties { + WICPngTimeYear = 0x00000001, + WICPngTimeMonth = 0x00000002, + WICPngTimeDay = 0x00000003, + WICPngTimeHour = 0x00000004, + WICPngTimeMinute = 0x00000005, + WICPngTimeSecond = 0x00000006, + WICPngTimeProperties_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICSectionAccessLevel { + WICSectionAccessLevelRead = 0x00000001, + WICSectionAccessLevelReadWrite = 0x00000003, + WICSectionAccessLevel_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPixelFormatNumericRepresentation { + WICPixelFormatNumericRepresentationUnspecified = 0x00000000, + WICPixelFormatNumericRepresentationIndexed = 0x00000001, + WICPixelFormatNumericRepresentationUnsignedInteger = 0x00000002, + WICPixelFormatNumericRepresentationSignedInteger = 0x00000003, + WICPixelFormatNumericRepresentationFixed = 0x00000004, + WICPixelFormatNumericRepresentationFloat = 0x00000005, + WICPixelFormatNumericRepresentation_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPlanarOptions { + WICPlanarOptionsDefault = 0x00000000, + WICPlanarOptionsPreserveSubsampling = 0x00000001, + WICPLANAROPTIONS_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICJpegIndexingOptions { + WICJpegIndexingOptionsGenerateOnDemand = 0x00000000, + WICJpegIndexingOptionsGenerateOnLoad = 0x00000001, + WICJpegIndexingOptions_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICJpegTransferMatrix { + WICJpegTransferMatrixIdentity = 0x00000000, + WICJpegTransferMatrixBT601 = 0x00000001, + WICJpegTransferMatrix_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICJpegScanType { + WICJpegScanTypeInterleaved = 0x00000000, + WICJpegScanTypePlanarComponents = 0x00000001, + WICJpegScanTypeProgressive = 0x00000002, + WICJpegScanType_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +STRUCT!{struct WICImageParameters { + PixelFormat: D2D1_PIXEL_FORMAT, + DpiX: FLOAT, + DpiY: FLOAT, + Top: FLOAT, + Left: FLOAT, + PixelWidth: UINT32, + PixelHeight: UINT32, +}} +STRUCT!{struct WICBitmapPlaneDescription { + Format: WICPixelFormatGUID, + Width: UINT, + Height: UINT, +}} +STRUCT!{struct WICBitmapPlane { + Format: WICPixelFormatGUID, + pbBuffer: *mut BYTE, + cbStride: UINT, + cbBufferSize: UINT, +}} +STRUCT!{struct WICJpegFrameHeader { + Width: UINT, + Height: UINT, + TransferMatrix: WICJpegTransferMatrix, + ScanType: WICJpegScanType, + cComponents: UINT, + ComponentIdentifiers: DWORD, + SampleFactors: DWORD, + QuantizationTableIndices: DWORD, +}} +STRUCT!{struct WICJpegScanHeader { + cComponents: UINT, + RestartInterval: UINT, + ComponentSelectors: DWORD, + HuffmanTableIndices: DWORD, + StartSpectralSelection: BYTE, + EndSpectralSelection: BYTE, + SuccessiveApproximationHigh: BYTE, + SuccessiveApproximationLow: BYTE, +}} +RIDL!(#[uuid(0x00000040, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICPalette(IWICPaletteVtbl): IUnknown(IUnknownVtbl) { + fn InitializePredefined( + ePaletteType: WICBitmapPaletteType, + fAddTransparentColor: BOOL, + ) -> HRESULT, + fn InitializeCustom( + pColors: *const WICColor, + cCount: UINT, + ) -> HRESULT, + fn InitializeFromBitmap( + pISurface: *const IWICBitmapSource, + cCount: UINT, + fAddTransparentColor: BOOL, + ) -> HRESULT, + fn InitializeFromPalette( + pIPalette: *const IWICPalette, + ) -> HRESULT, + fn GetType( + pePaletteType: *mut WICBitmapPaletteType, + ) -> HRESULT, + fn GetColorCount( + pcCount: *mut UINT, + ) -> HRESULT, + fn GetColors( + cCount: UINT, + pColors: *mut WICColor, + pcActualColors: *mut UINT, + ) -> HRESULT, + fn IsBlackWhite( + pfIsBlackWhite: *mut BOOL, + ) -> HRESULT, + fn IsGrayscale( + pfIsGrayscale: *mut BOOL, + ) -> HRESULT, + fn HasAlpha( + pfHasAlpha: *mut BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00000120, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICBitmapSource(IWICBitmapSourceVtbl): IUnknown(IUnknownVtbl) { + fn GetSize( + puiWidth: *mut UINT, + puiHeight: *mut UINT, + ) -> HRESULT, + fn GetPixelFormat( + pPixelFormat: *mut WICPixelFormatGUID, + ) -> HRESULT, + fn GetResolution( + pDpiX: *mut c_double, + pDpiY: *mut c_double, + ) -> HRESULT, + fn CopyPalette( + pIPalette: *const IWICPalette, + ) -> HRESULT, + fn CopyPixels( + prc: *const WICRect, + cbStride: UINT, + cbBufferSize: UINT, + pbBuffer: *mut BYTE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00000301, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICFormatConverter(IWICFormatConverterVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + pISource: *const IWICBitmapSource, + dstFormat: REFWICPixelFormatGUID, + dither: WICBitmapDitherType, + pIPalette: *const IWICPalette, + alphaThresholdPercent: c_double, + paletteTranslate: WICBitmapPaletteType, + ) -> HRESULT, + fn CanConvert( + srcPixelFormat: REFWICPixelFormatGUID, + dstPixelFormat: REFWICPixelFormatGUID, + pfCanConvert: *mut BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xbebee9cb, 0x83b0, 0x4dcc, 0x81, 0x32, 0xb0, 0xaa, 0xa5, 0x5e, 0xac, 0x96)] +interface IWICPlanarFormatConverter(IWICPlanarFormatConverterVtbl): + IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + ppPlanes: *const *const IWICBitmapSource, + cPlanes: UINT, + dstFormat: REFWICPixelFormatGUID, + dither: WICBitmapDitherType, + pIPalette: *const IWICPalette, + alphaThresholdPercent: c_double, + paletteTranslate: WICBitmapPaletteType, + ) -> HRESULT, + fn CanConvert( + pSrcPixelFormats: *const WICPixelFormatGUID, + cSrcPlanes: UINT, + dstPixelFormat: REFWICPixelFormatGUID, + pfCanConvert: *mut BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00000302, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICBitmapScaler(IWICBitmapScalerVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + pISource: *const IWICBitmapSource, + uiWidth: UINT, + uiHeight: UINT, + mode: WICBitmapInterpolationMode, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xe4fbcf03, 0x223d, 0x4e81, 0x93, 0x33, 0xd6, 0x35, 0x55, 0x6d, 0xd1, 0xb5)] +interface IWICBitmapClipper(IWICBitmapClipperVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + pISource: *const IWICBitmapSource, + prc: *const WICRect, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x5009834f, 0x2d6a, 0x41ce, 0x9e, 0x1b, 0x17, 0xc5, 0xaf, 0xf7, 0xa7, 0x82)] +interface IWICBitmapFlipRotator(IWICBitmapFlipRotatorVtbl): + IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + pISource: *const IWICBitmapSource, + options: WICBitmapTransformOptions, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00000123, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICBitmapLock(IWICBitmapLockVtbl): IUnknown(IUnknownVtbl) { + fn GetSize( + puiWidth: *mut UINT, + puiHeight: *mut UINT, + ) -> HRESULT, + fn GetStride( + pcbStride: *mut UINT, + ) -> HRESULT, + fn GetDataPointer( + pcbBufferSize: *mut UINT, + ppbData: *mut WICInProcPointer, + ) -> HRESULT, + fn GetPixelFormat( + pPixelFormat: *mut WICPixelFormatGUID, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00000121, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICBitmap(IWICBitmapVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Lock( + prcLock: *const WICRect, + flags: DWORD, + ppILock: *mut *mut IWICBitmapLock, + ) -> HRESULT, + fn SetPalette( + pIPalette: *const IWICPalette, + ) -> HRESULT, + fn SetResolution( + dpiX: c_double, + dpiY: c_double, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3c613a02, 0x34b2, 0x44ea, 0x9a, 0x7c, 0x45, 0xae, 0xa9, 0xc6, 0xfd, 0x6d)] +interface IWICColorContext(IWICColorContextVtbl): IUnknown(IUnknownVtbl) { + fn InitializeFromFilename( + wzFilename: LPCWSTR, + ) -> HRESULT, + fn InitializeFromMemory( + pbBuffer: *const BYTE, + cbBufferSize: UINT, + ) -> HRESULT, + fn InitializeFromExifColorSpace( + value: UINT, + ) -> HRESULT, + fn GetType( + pType: *mut WICColorContextType, + ) -> HRESULT, + fn GetProfileBytes( + cbBuffer: UINT, + pbBuffer: *mut BYTE, + pcbActual: *mut UINT, + ) -> HRESULT, + fn GetExifColorSpace( + pValue: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xb66f034f, 0xd0e2, 0x40ab, 0xb4, 0x36, 0x6d, 0xe3, 0x9e, 0x32, 0x1a, 0x94)] +interface IWICColorTransform(IWICColorTransformVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { + fn Initialize( + pIBitmapSource: *const IWICBitmapSource, + pIContextSource: *const IWICColorContext, + pIContextDest: *const IWICColorContext, + pixelFmtDest: REFWICPixelFormatGUID, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xb84e2c09, 0x78c9, 0x4ac4, 0x8b, 0xd3, 0x52, 0x4a, 0xe1, 0x66, 0x3a, 0x2f)] +interface IWICFastMetadataEncoder(IWICFastMetadataEncoderVtbl): IUnknown(IUnknownVtbl) { + fn Commit( + ) -> HRESULT, + fn GetMetadataQueryWriter( + ppIMetadataQueryWriter: *mut *mut IWICMetadataQueryWriter, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x135ff860, 0x22b7, 0x4ddf, 0xb0, 0xf6, 0x21, 0x8f, 0x4f, 0x29, 0x9a, 0x43)] +interface IWICStream(IWICStreamVtbl): IStream(IStreamVtbl) { + fn InitializeFromIStream( + pIStream: *const IStream, + ) -> HRESULT, + fn InitializeFromFilename( + wzFileName: LPCWSTR, + dwDesiredAccess: DWORD, + ) -> HRESULT, + fn InitializeFromMemory( + pbBuffer: WICInProcPointer, + cbBufferSize: DWORD, + ) -> HRESULT, + fn InitializeFromIStreamRegion( + pIStream: *const IStream, + ulOffset: ULARGE_INTEGER, + ulMaxSize: ULARGE_INTEGER, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xdc2bb46d, 0x3f07, 0x481e, 0x86, 0x25, 0x22, 0x0c, 0x4a, 0xed, 0xbb, 0x33)] +interface IWICEnumMetadataItem(IWICEnumMetadataItemVtbl): IUnknown(IUnknownVtbl) { + fn Next( + celt: ULONG, + rgeltSchema: *mut PROPVARIANT, + rgeltId: *mut PROPVARIANT, + rgeltValue: *mut PROPVARIANT, + pceltFetched: *mut ULONG, + ) -> HRESULT, + fn Skip( + celt: ULONG, + ) -> HRESULT, + fn Reset() -> HRESULT, + fn Clone( + ppIEnumMetadataItem: *mut *mut IWICEnumMetadataItem, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x30989668, 0xe1c9, 0x4597, 0xb3, 0x95, 0x45, 0x8e, 0xed, 0xb8, 0x08, 0xdf)] +interface IWICMetadataQueryReader(IWICMetadataQueryReaderVtbl): IUnknown(IUnknownVtbl) { + fn GetContainerFormat( + pguidContainerFormat: *mut GUID, + ) -> HRESULT, + fn GetLocation( + cchMaxLength: UINT, + wzNamespace: *mut WCHAR, + pcchActualLength: *mut UINT, + ) -> HRESULT, + fn GetMetadataByName( + wzName: LPCWSTR, + pvarValue: *mut PROPVARIANT, + ) -> HRESULT, + fn GetEnumerator( + ppIEnumString: *mut *mut IEnumString, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa721791a, 0x0def, 0x4d06, 0xbd, 0x91, 0x21, 0x18, 0xbf, 0x1d, 0xb1, 0x0b)] +interface IWICMetadataQueryWriter(IWICMetadataQueryWriterVtbl): + IWICMetadataQueryReader(IWICMetadataQueryReaderVtbl) { + fn SetMetadataByName( + wzName: LPCWSTR, + pvarValue: *const PROPVARIANT, + ) -> HRESULT, + fn RemoveMetadataByName( + wzName: LPCWSTR, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00000103, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICBitmapEncoder(IWICBitmapEncoderVtbl): IUnknown(IUnknownVtbl) { + fn Initialize( + pIStream: *const IStream, + cacheOption: WICBitmapEncoderCacheOption, + ) -> HRESULT, + fn GetContainerFormat( + pguidContainerFormat: *mut GUID, + ) -> HRESULT, + fn GetEncoderInfo( + ppIEncoderInfo: *mut *mut IWICBitmapEncoderInfo, + ) -> HRESULT, + fn SetColorContexts( + cCount: UINT, + ppIColorContext: *const *const IWICColorContext, + ) -> HRESULT, + fn SetPalette( + pIPalette: *const IWICPalette, + ) -> HRESULT, + fn SetThumbnail( + pIThumbnail: *const IWICBitmapSource, + ) -> HRESULT, + fn SetPreview( + pIPreview: *const IWICBitmapSource, + ) -> HRESULT, + fn CreateNewFrame( + ppIFrameEncode: *mut *mut IWICBitmapFrameEncode, + ppIEncoderOptions: *mut *mut IPropertyBag2, + ) -> HRESULT, + fn Commit( + ) -> HRESULT, + fn GetMetadataQueryWriter( + ppIMetadataQueryWriter: *mut *mut IWICMetadataQueryWriter, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x00000105, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94)] +interface IWICBitmapFrameEncode(IWICBitmapFrameEncodeVtbl): IUnknown(IUnknownVtbl) { + fn Initialize( + pIEncoderOptions: *const IPropertyBag2, + ) -> HRESULT, + fn SetSize( + uiWidth: UINT, + uiHeight: UINT, + ) -> HRESULT, + fn SetResolution( + dpiX: c_double, + dpiY: c_double, + ) -> HRESULT, + fn SetPixelFormat( + pPixelFormat: *mut WICPixelFormatGUID, + ) -> HRESULT, + fn SetColorContexts( + cCount: UINT, + ppIColorContext: *const *const IWICColorContext, + ) -> HRESULT, + fn SetPalette( + pIPalette: *const IWICPalette, + ) -> HRESULT, + fn SetThumbnail( + pIThumbnail: *const IWICBitmapSource, + ) -> HRESULT, + fn WritePixels( + lineCount: UINT, + cbStride: UINT, + cbBufferSize: UINT, + pbPixels: *const BYTE, + ) -> HRESULT, + fn WriteSource( + pIBitmapSource: *const IWICBitmapSource, + prc: *const WICRect, + ) -> HRESULT, + fn Commit( + ) -> HRESULT, + fn GetMetadataQueryWriter( + ppIMetadataQueryWriter: *mut *mut IWICMetadataQueryWriter, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xf928b7b8, 0x2221, 0x40c1, 0xb7, 0x2e, 0x7e, 0x82, 0xf1, 0x97, 0x4d, 0x1a)] +interface IWICPlanarBitmapFrameEncode(IWICPlanarBitmapFrameEncodeVtbl): IUnknown(IUnknownVtbl) { + fn WritePixels( + lineCount: UINT, + pPlanes: *const WICBitmapPlane, + cPlanes: UINT, + ) -> HRESULT, + fn WriteSource( + ppPlanes: *const *const IWICBitmapSource, + cPlanes: UINT, + prcSource: *const WICRect, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x04c75bf8, 0x3ce1, 0x473b, 0xac, 0xc5, 0x3c, 0xc4, 0xf5, 0xe9, 0x49, 0x99)] +interface IWICImageEncoder(IWICImageEncoderVtbl): IUnknown(IUnknownVtbl) { + fn WriteFrame( + pImage: *const ID2D1Image, + pFrameEncode: *const IWICBitmapFrameEncode, + pImageParameters: *const WICImageParameters, + ) -> HRESULT, + fn WriteFrameThumbnail( + pImage: *const ID2D1Image, + pFrameEncode: *const IWICBitmapFrameEncode, + pImageParameters: *const WICImageParameters, + ) -> HRESULT, + fn WriteThumbnail( + pImage: *const ID2D1Image, + pEncoder: *const IWICBitmapEncoder, + pImageParameters: *const WICImageParameters, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x9edde9e7, 0x8dee, 0x47ea, 0x99, 0xdf, 0xe6, 0xfa, 0xf2, 0xed, 0x44, 0xbf)] +interface IWICBitmapDecoder(IWICBitmapDecoderVtbl): IUnknown(IUnknownVtbl) { + fn QueryCapability( + pIStream: *const IStream, + pdwCapability: *mut DWORD, + ) -> HRESULT, + fn Initialize( + pIStream: *const IStream, + cacheOptions: WICDecodeOptions, + ) -> HRESULT, + fn GetContainerFormat( + pguidContainerFormat: *mut GUID, + ) -> HRESULT, + fn GetDecoderInfo( + ppIDecoderInfo: *mut *mut IWICBitmapDecoderInfo, + ) -> HRESULT, + fn CopyPalette( + pIPalette: *const IWICPalette, + ) -> HRESULT, + fn GetMetadataQueryReader( + ppIMetadataQueryReader: *mut *mut IWICMetadataQueryReader, + ) -> HRESULT, + fn GetPreview( + ppIBitmapSource: *mut *mut IWICBitmapSource, + ) -> HRESULT, + fn GetColorContexts( + cCount: UINT, + ppIColorContexts: *mut *mut IWICColorContext, + pcActualCount: *mut UINT, + ) -> HRESULT, + fn GetThumbnail( + ppIThumbnail: *mut *mut IWICBitmapSource, + ) -> HRESULT, + fn GetFrameCount( + pCount: *mut UINT, + ) -> HRESULT, + fn GetFrame( + index: UINT, + ppIBitmapFrame: *mut *mut IWICBitmapFrameDecode, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3b16811b, 0x6a43, 0x4ec9, 0xb7, 0x13, 0x3d, 0x5a, 0x0c, 0x13, 0xb9, 0x40)] +interface IWICBitmapSourceTransform(IWICBitmapSourceTransformVtbl): IUnknown(IUnknownVtbl) { + fn CopyPixels( + prc: *const WICRect, + uiWidth: UINT, + uiHeight: UINT, + pguidDstFormat: *const WICPixelFormatGUID, + dstTransform: WICBitmapTransformOptions, + nStride: UINT, + cbBufferSize: UINT, + pbBuffer: *mut BYTE, + ) -> HRESULT, + fn GetClosestSize( + puiWidth: *mut UINT, + puiHeight: *mut UINT, + ) -> HRESULT, + fn GetClosestPixelFormat( + pguidDstFormat: *mut WICPixelFormatGUID, + ) -> HRESULT, + fn DoesSupportTransform( + dstTransform: WICBitmapTransformOptions, + pfIsSupported: *mut BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3aff9cce, 0xbe95, 0x4303, 0xb9, 0x27, 0xe7, 0xd1, 0x6f, 0xf4, 0xa6, 0x13)] +interface IWICPlanarBitmapSourceTransform(IWICPlanarBitmapSourceTransformVtbl): + IUnknown(IUnknownVtbl) { + fn DoesSupportTransform( + puiWidth: *mut UINT, + puiHeight: *mut UINT, + dstTransform: WICBitmapTransformOptions, + dstPlanarOptions: WICPlanarOptions, + pguidDstFormats: *const WICPixelFormatGUID, + pPlaneDescriptions: *mut WICBitmapPlaneDescription, + cPlanes: UINT, + pfIsSupported: *mut BOOL, + ) -> HRESULT, + fn CopyPixels( + prcSource: *const WICRect, + uiWidth: UINT, + uiHeight: UINT, + dstTransform: WICBitmapTransformOptions, + dstPlanarOptions: WICPlanarOptions, + pDstPlanes: *const WICBitmapPlane, + cPlanes: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x3b16811b, 0x6a43, 0x4ec9, 0xa8, 0x13, 0x3d, 0x93, 0x0c, 0x13, 0xb9, 0x40)] +interface IWICBitmapFrameDecode(IWICBitmapFrameDecodeVtbl): + IWICBitmapSource(IWICBitmapSourceVtbl) { + fn GetMetadataQueryReader( + ppIMetadataQueryReader: *mut *mut IWICMetadataQueryReader, + ) -> HRESULT, + fn GetColorContexts( + cCount: UINT, + ppIColorContexts: *mut *mut IWICColorContext, + pcActualCount: *mut UINT, + ) -> HRESULT, + fn GetThumbnail( + ppIThumbnail: *mut *mut IWICBitmapSource, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xdaac296f, 0x7aa5, 0x4dbf, 0x8d, 0x15, 0x22, 0x5c, 0x59, 0x76, 0xf8, 0x91)] +interface IWICProgressiveLevelControl(IWICProgressiveLevelControlVtbl): IUnknown(IUnknownVtbl) { + fn GetLevelCount( + pcLevels: *mut UINT, + ) -> HRESULT, + fn GetCurrentLevel( + pnLevel: *mut UINT, + ) -> HRESULT, + fn SetCurrentLevel( + nLevel: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x4776f9cd, 0x9517, 0x45fa, 0xbf, 0x24, 0xe8, 0x9c, 0x5e, 0xc5, 0xc6, 0x0c)] +interface IWICProgressCallback(IWICProgressCallbackVtbl): IUnknown(IUnknownVtbl) { + fn Notify( + uFrameNum: ULONG, + operation: WICProgressOperation, + dblProgress: c_double, + ) -> HRESULT, +}); +FN!{stdcall PFNProgressNotification( + pvData: LPVOID, + uFrameNum: ULONG, + operation: WICProgressOperation, + dblProgress: c_double, +) -> HRESULT} +RIDL!(#[uuid(0x64c1024e, 0xc3cf, 0x4462, 0x80, 0x78, 0x88, 0xc2, 0xb1, 0x1c, 0x46, 0xd9)] +interface IWICBitmapCodecProgressNotification(IWICBitmapCodecProgressNotificationVtbl): + IUnknown(IUnknownVtbl) { + fn RegisterProgressNotification( + pfnProgressNotification: PFNProgressNotification, + pvData: LPVOID, + dwProgressFlags: DWORD, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x23bc3f0a, 0x698b, 0x4357, 0x88, 0x6b, 0xf2, 0x4d, 0x50, 0x67, 0x13, 0x34)] +interface IWICComponentInfo(IWICComponentInfoVtbl): IUnknown(IUnknownVtbl) { + fn GetComponentType( + pType: *mut WICComponentType, + ) -> HRESULT, + fn GetCLSID( + pclsid: *mut CLSID, + ) -> HRESULT, + fn GetSigningStatus( + pStatus: *mut DWORD, + ) -> HRESULT, + fn GetAuthor( + cchAuthor: UINT, + wzAuthor: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetVendorGUID( + pguidVendor: *mut GUID, + ) -> HRESULT, + fn GetVersion( + cchVersion: UINT, + wzVersion: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetSpecVersion( + cchSpecVersion: UINT, + wzSpecVersion: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetFriendlyName( + cchFriendlyName: UINT, + wzFriendlyName: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x9f34fb65, 0x13f4, 0x4f15, 0xbc, 0x57, 0x37, 0x26, 0xb5, 0xe5, 0x3d, 0x9f)] +interface IWICFormatConverterInfo(IWICFormatConverterInfoVtbl): + IWICComponentInfo(IWICComponentInfoVtbl) { + fn GetPixelFormats( + cFormats: UINT, + pPixelFormatGUIDs: *mut WICPixelFormatGUID, + pcActual: *mut UINT, + ) -> HRESULT, + fn CreateInstance( + ppIConverter: *mut *mut IWICFormatConverter, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xe87a44c4, 0xb76e, 0x4c47, 0x8b, 0x09, 0x29, 0x8e, 0xb1, 0x2a, 0x27, 0x14)] +interface IWICBitmapCodecInfo(IWICBitmapCodecInfoVtbl): IWICComponentInfo(IWICComponentInfoVtbl) { + fn GetContainerFormat( + pguidContainerFormat: *mut GUID, + ) -> HRESULT, + fn GetPixelFormats( + cFormats: UINT, + pguidPixelFormats: *mut GUID, + pcActual: *mut UINT, + ) -> HRESULT, + fn GetColorManagementVersion( + cchColorManagementVersion: UINT, + wzColorManagementVersion: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetDeviceManufacturer( + cchDeviceManufacturer: UINT, + wzDeviceManufacturer: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetDeviceModels( + cchDeviceModels: UINT, + wzDeviceModels: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetMimeTypes( + cchMimeTypes: UINT, + wzMimeTypes: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetFileExtensions( + cchFileExtensions: UINT, + wzFileExtensions: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn DoesSupportAnimation( + pfSupportAnimation: *mut BOOL, + ) -> HRESULT, + fn DoesSupportChromakey( + pfSupportChromakey: *mut BOOL, + ) -> HRESULT, + fn DoesSupportLossless( + pfSupportLossless: *mut BOOL, + ) -> HRESULT, + fn DoesSupportMultiframe( + pfSupportMultiframe: *mut BOOL, + ) -> HRESULT, + fn MatchesMimeType( + wzMimeType: LPCWSTR, + pfMatches: *mut BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x94c9b4ee, 0xa09f, 0x4f92, 0x8a, 0x1e, 0x4a, 0x9b, 0xce, 0x7e, 0x76, 0xfb)] +interface IWICBitmapEncoderInfo(IWICBitmapEncoderInfoVtbl): + IWICBitmapCodecInfo(IWICBitmapCodecInfoVtbl) { + fn CreateInstance( + ppIBitmapEncoder: *mut *mut IWICBitmapEncoder, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xd8cd007f, 0xd08f, 0x4191, 0x9b, 0xfc, 0x23, 0x6e, 0xa7, 0xf0, 0xe4, 0xb5)] +interface IWICBitmapDecoderInfo(IWICBitmapDecoderInfoVtbl): + IWICBitmapCodecInfo(IWICBitmapCodecInfoVtbl) { + fn GetPatterns( + cbSizePatterns: UINT, + pPatterns: *mut WICBitmapPattern, + pcPatterns: *mut UINT, + pcbPatternsActual: *mut UINT, + ) -> HRESULT, + fn MatchesPattern( + pIStream: *const IStream, + pfMatches: *mut BOOL, + ) -> HRESULT, + fn CreateInstance( + ppIBitmapDecoder: *mut *mut IWICBitmapDecoder, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xe8eda601, 0x3d48, 0x431a, 0xab, 0x44, 0x69, 0x05, 0x9b, 0xe8, 0x8b, 0xbe)] +interface IWICPixelFormatInfo(IWICPixelFormatInfoVtbl): IWICComponentInfo(IWICComponentInfoVtbl) { + fn GetFormatGUID( + pFormat: *mut GUID, + ) -> HRESULT, + fn GetColorContext( + ppIColorContext: *mut *mut IWICColorContext, + ) -> HRESULT, + fn GetBitsPerPixel( + puiBitsPerPixel: *mut UINT, + ) -> HRESULT, + fn GetChannelCount( + puiChannelCount: *mut UINT, + ) -> HRESULT, + fn GetChannelMask( + uiChannelIndex: UINT, + cbMaskBuffer: UINT, + pbMaskBuffer: *mut BYTE, + pcbActual: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xa9db33a2, 0xaf5f, 0x43c7, 0xb6, 0x79, 0x74, 0xf5, 0x98, 0x4b, 0x5a, 0xa4)] +interface IWICPixelFormatInfo2(IWICPixelFormatInfo2Vtbl): + IWICPixelFormatInfo(IWICPixelFormatInfoVtbl) { + fn SupportsTransparency( + pfSupportsTransparency: *mut BOOL, + ) -> HRESULT, + fn GetNumericRepresentation( + pNumericRepresentation: *mut WICPixelFormatNumericRepresentation, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xec5ec8a9, 0xc395, 0x4314, 0x9c, 0x77, 0x54, 0xd7, 0xa9, 0x35, 0xff, 0x70)] +interface IWICImagingFactory(IWICImagingFactoryVtbl): IUnknown(IUnknownVtbl) { + fn CreateDecoderFromFilename( + wzFilename: LPCWSTR, + pguidVendor: *const GUID, + dwDesiredAccess: DWORD, + metadataOptions: WICDecodeOptions, + ppIDecoder: *mut *mut IWICBitmapDecoder, + ) -> HRESULT, + fn CreateDecoderFromStream( + pIStream: *const IStream, + pguidVendor: *const GUID, + metadataOptions: WICDecodeOptions, + ppIDecoder: *mut *mut IWICBitmapDecoder, + ) -> HRESULT, + fn CreateDecoderFromFileHandle( + hFile: ULONG_PTR, + pguidVendor: *const GUID, + metadataOptions: WICDecodeOptions, + ppIDecoder: *mut *mut IWICBitmapDecoder, + ) -> HRESULT, + fn CreateComponentInfo( + clsidComponent: REFCLSID, + ppIInfo: *mut *mut IWICComponentInfo, + ) -> HRESULT, + fn CreateDecoder( + guidContainerFormat: REFGUID, + pguidVendor: *const GUID, + ppIDecoder: *mut *mut IWICBitmapDecoder, + ) -> HRESULT, + fn CreateEncoder( + guidContainerFormat: REFGUID, + pguidVendor: *const GUID, + ppIEncoder: *mut *mut IWICBitmapEncoder, + ) -> HRESULT, + fn CreatePalette( + ppIPalette: *mut *mut IWICPalette, + ) -> HRESULT, + fn CreateFormatConverter( + ppIFormatConverter: *mut *mut IWICFormatConverter, + ) -> HRESULT, + fn CreateBitmapScaler( + ppIBitmapScaler: *mut *mut IWICBitmapScaler, + ) -> HRESULT, + fn CreateBitmapClipper( + ppIBitmapClipper: *mut *mut IWICBitmapClipper, + ) -> HRESULT, + fn CreateBitmapFlipRotator( + ppIBitmapFlipRotator: *mut *mut IWICBitmapFlipRotator, + ) -> HRESULT, + fn CreateStream( + ppIWICStream: *mut *mut IWICStream, + ) -> HRESULT, + fn CreateColorContext( + ppIWICColorContext: *mut *mut IWICColorContext, + ) -> HRESULT, + fn CreateColorTransformer( + ppIWICColorTransform: *mut *mut IWICColorTransform, + ) -> HRESULT, + fn CreateBitmap( + uiWidth: UINT, + uiHeight: UINT, + pixelFormat: REFWICPixelFormatGUID, + option: WICBitmapCreateCacheOption, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT, + fn CreateBitmapFromSource( + pIBitmapSource: *const IWICBitmapSource, + option: WICBitmapCreateCacheOption, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT, + fn CreateBitmapFromSourceRect( + pIBitmapSource: *const IWICBitmapSource, + x: UINT, + y: UINT, + width: UINT, + height: UINT, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT, + fn CreateBitmapFromMemory( + uiWidth: UINT, + uiHeight: UINT, + pixelFormat: REFWICPixelFormatGUID, + cbStride: UINT, + cbBufferSize: UINT, + pbBuffer: *const BYTE, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT, + fn CreateBitmapFromHBITMAP( + hBitmap: HBITMAP, + hPalette: HPALETTE, + options: WICBitmapAlphaChannelOption, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT, + fn CreateBitmapFromHICON( + hIcon: HICON, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT, + fn CreateComponentEnumerator( + componentTypes: DWORD, + options: DWORD, + ppIEnumUnknown: *mut *mut IEnumUnknown, + ) -> HRESULT, + fn CreateFastMetadataEncoderFromDecoder( + pIDecoder: *const IWICBitmapDecoder, + ppIFastEncoder: *mut *mut IWICFastMetadataEncoder, + ) -> HRESULT, + fn CreateFastMetadataEncoderFromFrameDecode( + pIFrameDecoder: *const IWICBitmapFrameDecode, + ppIFastEncoder: *mut *mut IWICFastMetadataEncoder, + ) -> HRESULT, + fn CreateQueryWriter( + guidMetadataFormat: REFGUID, + pguidVendor: *const GUID, + ppIQueryWriter: *mut *mut IWICMetadataQueryWriter, + ) -> HRESULT, + fn CreateQueryWriterFromReader( + pIQueryReader: *const IWICMetadataQueryReader, + pguidVendor: *const GUID, + ppIQueryWriter: *mut *mut IWICMetadataQueryWriter, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x7b816b45, 0x1996, 0x4476, 0xb1, 0x32, 0xde, 0x9e, 0x24, 0x7c, 0x8a, 0xf0)] +interface IWICImagingFactory2(IWICImagingFactory2Vtbl): + IWICImagingFactory(IWICImagingFactoryVtbl) { + fn CreateImageEncoder( + pD2DDevice: *const ID2D1Device, + ppWICImageEncoder: *mut *mut IWICImageEncoder, + ) -> HRESULT, +}); +extern "system" { + pub fn WICConvertBitmapSource( + dstFormat: REFWICPixelFormatGUID, + pISrc: *const IWICBitmapSource, + ppIDst: *mut *mut IWICBitmapSource, + ) -> HRESULT; + pub fn WICCreateBitmapFromSection( + width: UINT, + height: UINT, + pixelFormat: REFWICPixelFormatGUID, + hSection: HANDLE, + stride: UINT, + offset: UINT, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT; + pub fn WICCreateBitmapFromSectionEx( + width: UINT, + height: UINT, + pixelFormat: REFWICPixelFormatGUID, + hSection: HANDLE, + stride: UINT, + offset: UINT, + desiredAccessLevel: WICSectionAccessLevel, + ppIBitmap: *mut *mut IWICBitmap, + ) -> HRESULT; + pub fn WICMapGuidToShortName( + guid: REFGUID, + cchName: UINT, + wzName: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT; + pub fn WICMapShortNameToGuid( + wzName: PCWSTR, + pguid: *mut GUID, + ) -> HRESULT; + pub fn WICMapSchemaToName( + guidMetadataFormat: REFGUID, + pwzSchema: LPWSTR, + cchName: UINT, + wzName: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT; +} +pub const FACILITY_WINCODEC_ERR: HRESULT = 0x898; +pub const WINCODEC_ERR_BASE: HRESULT = 0x2000; +/// intsafe.h, 0x216 = 534 = ERROR_ARITHMETIC_OVERFLOW +pub const INTSAFE_E_ARITHMETIC_OVERFLOW: HRESULT = 0x80070216; +#[inline] +pub fn MAKE_WINCODECHR(severity: HRESULT, code: HRESULT) -> HRESULT { + MAKE_HRESULT!(severity, FACILITY_WINCODEC_ERR, WINCODEC_ERR_BASE + code) +} +#[inline] +pub fn MAKE_WINCODECHR_ERR(code: HRESULT) -> HRESULT { + MAKE_WINCODECHR(SEVERITY_ERROR, code) +} +pub const WINCODEC_ERR_GENERIC_ERROR: HRESULT = E_FAIL; +pub const WINCODEC_ERR_INVALIDPARAMETER: HRESULT = E_INVALIDARG; +pub const WINCODEC_ERR_OUTOFMEMORY: HRESULT = E_OUTOFMEMORY; +pub const WINCODEC_ERR_NOTIMPLEMENTED: HRESULT = E_NOTIMPL; +pub const WINCODEC_ERR_ABORTED: HRESULT = E_ABORT; +pub const WINCODEC_ERR_ACCESSDENIED: HRESULT = E_ACCESSDENIED; +pub const WINCODEC_ERR_VALUEOVERFLOW: HRESULT = INTSAFE_E_ARITHMETIC_OVERFLOW; +ENUM!{enum WICTiffCompressionOption { + WICTiffCompressionDontCare = 0x00000000, + WICTiffCompressionNone = 0x00000001, + WICTiffCompressionCCITT3 = 0x00000002, + WICTiffCompressionCCITT4 = 0x00000003, + WICTiffCompressionLZW = 0x00000004, + WICTiffCompressionRLE = 0x00000005, + WICTiffCompressionZIP = 0x00000006, + WICTiffCompressionLZWHDifferencing = 0x00000007, + WICTIFFCOMPRESSIONOPTION_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICJpegYCrCbSubsamplingOption { + WICJpegYCrCbSubsamplingDefault = 0x00000000, + WICJpegYCrCbSubsampling420 = 0x00000001, + WICJpegYCrCbSubsampling422 = 0x00000002, + WICJpegYCrCbSubsampling444 = 0x00000003, + WICJpegYCrCbSubsampling440 = 0x00000004, + WICJPEGYCRCBSUBSAMPLING_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICPngFilterOption { + WICPngFilterUnspecified = 0x00000000, + WICPngFilterNone = 0x00000001, + WICPngFilterSub = 0x00000002, + WICPngFilterUp = 0x00000003, + WICPngFilterAverage = 0x00000004, + WICPngFilterPaeth = 0x00000005, + WICPngFilterAdaptive = 0x00000006, + WICPNGFILTEROPTION_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICNamedWhitePoint { + WICWhitePointDefault = 0x00000001, + WICWhitePointDaylight = 0x00000002, + WICWhitePointCloudy = 0x00000004, + WICWhitePointShade = 0x00000008, + WICWhitePointTungsten = 0x00000010, + WICWhitePointFluorescent = 0x00000020, + WICWhitePointFlash = 0x00000040, + WICWhitePointUnderwater = 0x00000080, + WICWhitePointCustom = 0x00000100, + WICWhitePointAutoWhiteBalance = 0x00000200, + WICWhitePointAsShot = WICWhitePointDefault, + WICNAMEDWHITEPOINT_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICRawCapabilities { + WICRawCapabilityNotSupported = 0x00000000, + WICRawCapabilityGetSupported = 0x00000001, + WICRawCapabilityFullySupported = 0x00000002, + WICRAWCAPABILITIES_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICRawRotationCapabilities { + WICRawRotationCapabilityNotSupported = 0x00000000, + WICRawRotationCapabilityGetSupported = 0x00000001, + WICRawRotationCapabilityNinetyDegreesSupported = 0x00000002, + WICRawRotationCapabilityFullySupported = 0x00000003, + WICRAWROTATIONCAPABILITIES_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +STRUCT!{struct WICRawCapabilitiesInfo { + cbSize: UINT, + CodecMajorVersion: UINT, + CodecMinorVersion: UINT, + ExposureCompensationSupport: WICRawCapabilities, + ContrastSupport: WICRawCapabilities, + RGBWhitePointSupport: WICRawCapabilities, + NamedWhitePointSupport: WICRawCapabilities, + NamedWhitePointSupportMask: UINT, + KelvinWhitePointSupport: WICRawCapabilities, + GammaSupport: WICRawCapabilities, + TintSupport: WICRawCapabilities, + SaturationSupport: WICRawCapabilities, + SharpnessSupport: WICRawCapabilities, + NoiseReductionSupport: WICRawCapabilities, + DestinationColorProfileSupport: WICRawCapabilities, + ToneCurveSupport: WICRawCapabilities, + RotationSupport: WICRawRotationCapabilities, + RenderModeSupport: WICRawCapabilities, +}} +ENUM!{enum WICRawParameterSet { + WICAsShotParameterSet = 0x00000001, + WICUserAdjustedParameterSet = 0x00000002, + WICAutoAdjustedParameterSet = 0x00000003, + WICRAWPARAMETERSET_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICRawRenderMode { + WICRawRenderModeDraft = 0x00000001, + WICRawRenderModeNormal = 0x00000002, + WICRawRenderModeBestQuality = 0x00000003, + WICRAWRENDERMODE_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +STRUCT!{struct WICRawToneCurvePoint { + Input: c_double, + Output: c_double, +}} +STRUCT!{struct WICRawToneCurve { + cPoints: UINT, + aPoints: [WICRawToneCurvePoint; 0], +}} +pub const WICRawChangeNotification_ExposureCompensation: UINT = 0x00000001; +pub const WICRawChangeNotification_NamedWhitePoint: UINT = 0x00000002; +pub const WICRawChangeNotification_KelvinWhitePoint: UINT = 0x00000004; +pub const WICRawChangeNotification_RGBWhitePoint: UINT = 0x00000008; +pub const WICRawChangeNotification_Contrast: UINT = 0x00000010; +pub const WICRawChangeNotification_Gamma: UINT = 0x00000020; +pub const WICRawChangeNotification_Sharpness: UINT = 0x00000040; +pub const WICRawChangeNotification_Saturation: UINT = 0x00000080; +pub const WICRawChangeNotification_Tint: UINT = 0x00000100; +pub const WICRawChangeNotification_NoiseReduction: UINT = 0x00000200; +pub const WICRawChangeNotification_DestinationColorContext: UINT = 0x00000400; +pub const WICRawChangeNotification_ToneCurve: UINT = 0x00000800; +pub const WICRawChangeNotification_Rotation: UINT = 0x00001000; +pub const WICRawChangeNotification_RenderMode: UINT = 0x00002000; +RIDL!(#[uuid(0x95c75a6e, 0x3e8c, 0x4ec2, 0x85, 0xa8, 0xae, 0xbc, 0xc5, 0x51, 0xe5, 0x9b)] +interface IWICDevelopRawNotificationCallback(IWICDevelopRawNotificationCallbackVtbl): + IUnknown(IUnknownVtbl) { + fn Notify( + NotificationMask: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xfbec5e44, 0xf7be, 0x4b65, 0xb7, 0xf8, 0xc0, 0xc8, 0x1f, 0xef, 0x02, 0x6d)] +interface IWICDevelopRaw(IWICDevelopRawVtbl): IWICBitmapFrameDecode(IWICBitmapFrameDecodeVtbl) { + fn QueryRawCapabilitiesInfo( + pInfo: *mut WICRawCapabilitiesInfo, + ) -> HRESULT, + fn LoadParameterSet( + ParameterSet: WICRawParameterSet, + ) -> HRESULT, + fn GetCurrentParameterSet( + ppCurrentParameterSet: *mut *mut IPropertyBag2, + ) -> HRESULT, + fn SetExposureCompensation( + ev: c_double, + ) -> HRESULT, + fn GetExposureCompensation( + pEV: *mut c_double, + ) -> HRESULT, + fn SetWhitePointRGB( + Red: UINT, + Green: UINT, + Blue: UINT, + ) -> HRESULT, + fn GetWhitePointRGB( + pRed: *mut UINT, + pGreen: *mut UINT, + pBlue: *mut UINT, + ) -> HRESULT, + fn SetNamedWhitePoint( + WhitePoint: WICNamedWhitePoint, + ) -> HRESULT, + fn GetNamedWhitePoint( + pWhitePoint: *mut WICNamedWhitePoint, + ) -> HRESULT, + fn SetWhitePointKelvin( + WhitePointKelvin: UINT, + ) -> HRESULT, + fn GetWhitePointKelvin( + pWhitePointKelvin: *mut UINT, + ) -> HRESULT, + fn GetKelvinRangeInfo( + pMinKelvinTemp: *mut UINT, + pMaxKelvinTemp: *mut UINT, + pKelvinTempStepValue: *mut UINT, + ) -> HRESULT, + fn SetContrast( + Contrast: c_double, + ) -> HRESULT, + fn GetContrast( + pContrast: *mut c_double, + ) -> HRESULT, + fn SetGamma( + Gamma: c_double, + ) -> HRESULT, + fn GetGamma( + pGamma: *mut c_double, + ) -> HRESULT, + fn SetSharpness( + Sharpness: c_double, + ) -> HRESULT, + fn GetSharpness( + pSharpness: *mut c_double, + ) -> HRESULT, + fn SetSaturation( + Saturation: c_double, + ) -> HRESULT, + fn GetSaturation( + pSaturation: *mut c_double, + ) -> HRESULT, + fn SetTint( + Tint: c_double, + ) -> HRESULT, + fn GetTint( + pTint: *mut c_double, + ) -> HRESULT, + fn SetNoiseReduction( + NoiseReduction: c_double, + ) -> HRESULT, + fn GetNoiseReduction( + pNoiseReduction: *mut c_double, + ) -> HRESULT, + fn SetDestinationColorContext( + pColorContext: *const IWICColorContext, + ) -> HRESULT, + fn SetToneCurve( + cbToneCurveSize: UINT, + pToneCurve: *const WICRawToneCurve, + ) -> HRESULT, + fn GetToneCurve( + cbToneCurveBufferSize: UINT, + pToneCurve: *mut WICRawToneCurve, + pcbActualToneCurveBufferSize: *mut UINT, + ) -> HRESULT, + fn SetRotation( + Rotation: c_double, + ) -> HRESULT, + fn GetRotation( + pRotation: *mut c_double, + ) -> HRESULT, + fn SetRenderMode( + RenderMode: WICRawRenderMode, + ) -> HRESULT, + fn GetRenderMode( + pRenderMode: *mut WICRawRenderMode, + ) -> HRESULT, + fn SetNotificationCallback( + pCallback: *const IWICDevelopRawNotificationCallback, + ) -> HRESULT, +}); +ENUM!{enum WICDdsDimension { + WICDdsTexture1D = 0x00000000, + WICDdsTexture2D = 0x00000001, + WICDdsTexture3D = 0x00000002, + WICDdsTextureCube = 0x00000003, + WICDDSTEXTURE_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +ENUM!{enum WICDdsAlphaMode { + WICDdsAlphaModeUnknown = 0x00000000, + WICDdsAlphaModeStraight = 0x00000001, + WICDdsAlphaModePremultiplied = 0x00000002, + WICDdsAlphaModeOpaque = 0x00000003, + WICDdsAlphaModeCustom = 0x00000004, + WICDDSALPHAMODE_FORCE_DWORD = CODEC_FORCE_DWORD, +}} +STRUCT!{struct WICDdsParameters { + Width: UINT, + Height: UINT, + Depth: UINT, + MipLevels: UINT, + ArraySize: UINT, + DxgiFormat: DXGI_FORMAT, + Dimension: WICDdsDimension, + AlphaMode: WICDdsAlphaMode, +}} +RIDL!(#[uuid(0x409cd537, 0x8532, 0x40cb, 0x97, 0x74, 0xe2, 0xfe, 0xb2, 0xdf, 0x4e, 0x9c)] +interface IWICDdsDecoder(IWICDdsDecoderVtbl): IUnknown(IUnknownVtbl) { + fn GetParameters( + pParameters: *mut WICDdsParameters, + ) -> HRESULT, + fn GetFrame( + arrayIndex: UINT, + mipLevel: UINT, + sliceIndex: UINT, + ppIBitmapFrame: *mut *mut IWICBitmapFrameDecode, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x5cacdb4c, 0x407e, 0x41b3, 0xb9, 0x36, 0xd0, 0xf0, 0x10, 0xcd, 0x67, 0x32)] +interface IWICDdsEncoder(IWICDdsEncoderVtbl): IUnknown(IUnknownVtbl) { + fn SetParameters( + pParameters: *const WICDdsParameters, + ) -> HRESULT, + fn GetParameters( + pParameters: *mut WICDdsParameters, + ) -> HRESULT, + fn CreateNewFrame( + ppIFrameEncode: *mut *mut IWICBitmapFrameEncode, + pArrayIndex: *mut UINT, + pMipLevel: *mut UINT, + pSliceIndex: *mut UINT, + ) -> HRESULT, +}); +STRUCT!{struct WICDdsFormatInfo { + DxgiFormat: DXGI_FORMAT, + BytesPerBlock: UINT, + BlockWidth: UINT, + BlockHeight: UINT, +}} +RIDL!(#[uuid(0x3d4c0c61, 0x18a4, 0x41e4, 0xbd, 0x80, 0x48, 0x1a, 0x4f, 0xc9, 0xf4, 0x64)] +interface IWICDdsFrameDecode(IWICDdsFrameDecodeVtbl): IUnknown(IUnknownVtbl) { + fn GetSizeInBlocks( + pWidthInBlocks: *mut UINT, + pHeightInBlocks: *mut UINT, + ) -> HRESULT, + fn GetFormatInfo( + pFormatInfo: *mut WICDdsFormatInfo, + ) -> HRESULT, + fn CopyBlocks( + prcBoundsInBlocks: *const WICRect, + cbStride: UINT, + cbBufferSize: UINT, + pbBuffer: *mut BYTE, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x8939f66e, 0xc46a, 0x4c21, 0xa9, 0xd1, 0x98, 0xb3, 0x27, 0xce, 0x16, 0x79)] +interface IWICJpegFrameDecode(IWICJpegFrameDecodeVtbl): IUnknown(IUnknownVtbl) { + fn DoesSupportIndexing( + pfIndexingSupported: *mut BOOL, + ) -> HRESULT, + fn SetIndexing( + options: WICJpegIndexingOptions, + horizontalIntervalSize: UINT, + ) -> HRESULT, + fn ClearIndexing() -> HRESULT, + fn GetAcHuffmanTable( + scanIndex: UINT, + tableIndex: UINT, + pAcHuffmanTable: *mut DXGI_JPEG_AC_HUFFMAN_TABLE, + ) -> HRESULT, + fn GetDcHuffmanTable( + scanIndex: UINT, + tableIndex: UINT, + pDcHuffmanTable: *mut DXGI_JPEG_DC_HUFFMAN_TABLE, + ) -> HRESULT, + fn GetQuantizationTable( + scanIndex: UINT, + tableIndex: UINT, + pQuantizationTable: *mut DXGI_JPEG_QUANTIZATION_TABLE, + ) -> HRESULT, + fn GetFrameHeader( + pFrameHeader: *mut WICJpegFrameHeader, + ) -> HRESULT, + fn GetScanHeader( + scanIndex: UINT, + pScanHeader: *mut WICJpegScanHeader, + ) -> HRESULT, + fn CopyScan( + scanIndex: UINT, + scanOffset: UINT, + cbScanData: UINT, + pbScanData: *mut BYTE, + pcbScanDataActual: *mut UINT, + ) -> HRESULT, + fn CopyMinimalStream( + streamOffset: UINT, + cbStreamData: UINT, + pbStreamData: *mut BYTE, + pcbStreamDataActual: *mut UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x2f0c601f, 0xd2c6, 0x468c, 0xab, 0xfa, 0x49, 0x49, 0x5d, 0x98, 0x3e, 0xd1)] +interface IWICJpegFrameEncode(IWICJpegFrameEncodeVtbl): IUnknown(IUnknownVtbl) { + fn GetAcHuffmanTable( + scanIndex: UINT, + tableIndex: UINT, + pAcHuffmanTable: *mut DXGI_JPEG_AC_HUFFMAN_TABLE, + ) -> HRESULT, + fn GetDcHuffmanTable( + scanIndex: UINT, + tableIndex: UINT, + pDcHuffmanTable: *mut DXGI_JPEG_DC_HUFFMAN_TABLE, + ) -> HRESULT, + fn GetQuantizationTable( + scanIndex: UINT, + tableIndex: UINT, + pQuantizationTable: *mut DXGI_JPEG_QUANTIZATION_TABLE, + ) -> HRESULT, + fn WriteScan( + cbScanData: UINT, + pbScanData: *const BYTE, + ) -> HRESULT, +}); diff --git a/src/vendor/winapi/src/um/wincodecsdk.rs b/src/vendor/winapi/src/um/wincodecsdk.rs new file mode 100644 index 0000000000..7d4c1980a1 --- /dev/null +++ b/src/vendor/winapi/src/um/wincodecsdk.rs @@ -0,0 +1,565 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_uchar, c_ulong}; +use shared::guiddef::{GUID, REFGUID}; +use shared::minwindef::{BOOL, BYTE, DWORD, UINT, ULONG}; +use shared::wtypes::{BSTR, CLIPFORMAT}; +use um::oaidl::LPSAFEARRAY; +use um::objidl::{IPersistStream, IPersistStreamVtbl}; +use um::objidlbase::{IEnumUnknown, IStream}; +use um::ocidl::{IPropertyBag2, PROPBAG2}; +use um::propidl::PROPVARIANT; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::wincodec::{ + IWICComponentInfo, IWICComponentInfoVtbl, IWICEnumMetadataItem, IWICImagingFactory, + IWICImagingFactoryVtbl, IWICMetadataQueryReader, IWICMetadataQueryWriter, +}; +use um::winnt::{HRESULT, ULARGE_INTEGER, WCHAR}; +DEFINE_GUID!{GUID_MetadataFormatUnknown, + 0xa45e592f, 0x9078, 0x4a7c, 0xad, 0xb5, 0x4e, 0xdc, 0x4f, 0xd6, 0x1b, 0x1f} +DEFINE_GUID!{GUID_MetadataFormatIfd, + 0x537396c6, 0x2d8a, 0x4bb6, 0x9b, 0xf8, 0x2f, 0x0a, 0x8e, 0x2a, 0x3a, 0xdf} +DEFINE_GUID!{GUID_MetadataFormatSubIfd, + 0x58a2e128, 0x2db9, 0x4e57, 0xbb, 0x14, 0x51, 0x77, 0x89, 0x1e, 0xd3, 0x31} +DEFINE_GUID!{GUID_MetadataFormatExif, + 0x1c3c4f9d, 0xb84a, 0x467d, 0x94, 0x93, 0x36, 0xcf, 0xbd, 0x59, 0xea, 0x57} +DEFINE_GUID!{GUID_MetadataFormatGps, + 0x7134ab8a, 0x9351, 0x44ad, 0xaf, 0x62, 0x44, 0x8d, 0xb6, 0xb5, 0x02, 0xec} +DEFINE_GUID!{GUID_MetadataFormatInterop, + 0xed686f8e, 0x681f, 0x4c8b, 0xbd, 0x41, 0xa8, 0xad, 0xdb, 0xf6, 0xb3, 0xfc} +DEFINE_GUID!{GUID_MetadataFormatApp0, + 0x79007028, 0x268d, 0x45d6, 0xa3, 0xc2, 0x35, 0x4e, 0x6a, 0x50, 0x4b, 0xc9} +DEFINE_GUID!{GUID_MetadataFormatApp1, + 0x8fd3dfc3, 0xf951, 0x492b, 0x81, 0x7f, 0x69, 0xc2, 0xe6, 0xd9, 0xa5, 0xb0} +DEFINE_GUID!{GUID_MetadataFormatApp13, + 0x326556a2, 0xf502, 0x4354, 0x9c, 0xc0, 0x8e, 0x3f, 0x48, 0xea, 0xf6, 0xb5} +DEFINE_GUID!{GUID_MetadataFormatIPTC, + 0x4fab0914, 0xe129, 0x4087, 0xa1, 0xd1, 0xbc, 0x81, 0x2d, 0x45, 0xa7, 0xb5} +DEFINE_GUID!{GUID_MetadataFormatIRB, + 0x16100d66, 0x8570, 0x4bb9, 0xb9, 0x2d, 0xfd, 0xa4, 0xb2, 0x3e, 0xce, 0x67} +DEFINE_GUID!{GUID_MetadataFormat8BIMIPTC, + 0x0010568c, 0x0852, 0x4e6a, 0xb1, 0x91, 0x5c, 0x33, 0xac, 0x5b, 0x04, 0x30} +DEFINE_GUID!{GUID_MetadataFormat8BIMResolutionInfo, + 0x739f305d, 0x81db, 0x43cb, 0xac, 0x5e, 0x55, 0x01, 0x3e, 0xf9, 0xf0, 0x03} +DEFINE_GUID!{GUID_MetadataFormat8BIMIPTCDigest, + 0x1ca32285, 0x9ccd, 0x4786, 0x8b, 0xd8, 0x79, 0x53, 0x9d, 0xb6, 0xa0, 0x06} +DEFINE_GUID!{GUID_MetadataFormatXMP, + 0xbb5acc38, 0xf216, 0x4cec, 0xa6, 0xc5, 0x5f, 0x6e, 0x73, 0x97, 0x63, 0xa9} +DEFINE_GUID!{GUID_MetadataFormatThumbnail, + 0x243dcee9, 0x8703, 0x40ee, 0x8e, 0xf0, 0x22, 0xa6, 0x00, 0xb8, 0x05, 0x8c} +DEFINE_GUID!{GUID_MetadataFormatChunktEXt, + 0x568d8936, 0xc0a9, 0x4923, 0x90, 0x5d, 0xdf, 0x2b, 0x38, 0x23, 0x8f, 0xbc} +DEFINE_GUID!{GUID_MetadataFormatXMPStruct, + 0x22383cf1, 0xed17, 0x4e2e, 0xaf, 0x17, 0xd8, 0x5b, 0x8f, 0x6b, 0x30, 0xd0} +DEFINE_GUID!{GUID_MetadataFormatXMPBag, + 0x833cca5f, 0xdcb7, 0x4516, 0x80, 0x6f, 0x65, 0x96, 0xab, 0x26, 0xdc, 0xe4} +DEFINE_GUID!{GUID_MetadataFormatXMPSeq, + 0x63e8df02, 0xeb6c, 0x456c, 0xa2, 0x24, 0xb2, 0x5e, 0x79, 0x4f, 0xd6, 0x48} +DEFINE_GUID!{GUID_MetadataFormatXMPAlt, + 0x7b08a675, 0x91aa, 0x481b, 0xa7, 0x98, 0x4d, 0xa9, 0x49, 0x08, 0x61, 0x3b} +DEFINE_GUID!{GUID_MetadataFormatLSD, + 0xe256031e, 0x6299, 0x4929, 0xb9, 0x8d, 0x5a, 0xc8, 0x84, 0xaf, 0xba, 0x92} +DEFINE_GUID!{GUID_MetadataFormatIMD, + 0xbd2bb086, 0x4d52, 0x48dd, 0x96, 0x77, 0xdb, 0x48, 0x3e, 0x85, 0xae, 0x8f} +DEFINE_GUID!{GUID_MetadataFormatGCE, + 0x2a25cad8, 0xdeeb, 0x4c69, 0xa7, 0x88, 0x0e, 0xc2, 0x26, 0x6d, 0xca, 0xfd} +DEFINE_GUID!{GUID_MetadataFormatAPE, + 0x2e043dc2, 0xc967, 0x4e05, 0x87, 0x5e, 0x61, 0x8b, 0xf6, 0x7e, 0x85, 0xc3} +DEFINE_GUID!{GUID_MetadataFormatJpegChrominance, + 0xf73d0dcf, 0xcec6, 0x4f85, 0x9b, 0x0e, 0x1c, 0x39, 0x56, 0xb1, 0xbe, 0xf7} +DEFINE_GUID!{GUID_MetadataFormatJpegLuminance, + 0x86908007, 0xedfc, 0x4860, 0x8d, 0x4b, 0x4e, 0xe6, 0xe8, 0x3e, 0x60, 0x58} +DEFINE_GUID!{GUID_MetadataFormatJpegComment, + 0x220e5f33, 0xafd3, 0x474e, 0x9d, 0x31, 0x7d, 0x4f, 0xe7, 0x30, 0xf5, 0x57} +DEFINE_GUID!{GUID_MetadataFormatGifComment, + 0xc4b6e0e0, 0xcfb4, 0x4ad3, 0xab, 0x33, 0x9a, 0xad, 0x23, 0x55, 0xa3, 0x4a} +DEFINE_GUID!{GUID_MetadataFormatChunkgAMA, + 0xf00935a5, 0x1d5d, 0x4cd1, 0x81, 0xb2, 0x93, 0x24, 0xd7, 0xec, 0xa7, 0x81} +DEFINE_GUID!{GUID_MetadataFormatChunkbKGD, + 0xe14d3571, 0x6b47, 0x4dea, 0xb6, 0x0a, 0x87, 0xce, 0x0a, 0x78, 0xdf, 0xb7} +DEFINE_GUID!{GUID_MetadataFormatChunkiTXt, + 0xc2bec729, 0x0b68, 0x4b77, 0xaa, 0x0e, 0x62, 0x95, 0xa6, 0xac, 0x18, 0x14} +DEFINE_GUID!{GUID_MetadataFormatChunkcHRM, + 0x9db3655b, 0x2842, 0x44b3, 0x80, 0x67, 0x12, 0xe9, 0xb3, 0x75, 0x55, 0x6a} +DEFINE_GUID!{GUID_MetadataFormatChunkhIST, + 0xc59a82da, 0xdb74, 0x48a4, 0xbd, 0x6a, 0xb6, 0x9c, 0x49, 0x31, 0xef, 0x95} +DEFINE_GUID!{GUID_MetadataFormatChunkiCCP, + 0xeb4349ab, 0xb685, 0x450f, 0x91, 0xb5, 0xe8, 0x02, 0xe8, 0x92, 0x53, 0x6c} +DEFINE_GUID!{GUID_MetadataFormatChunksRGB, + 0xc115fd36, 0xcc6f, 0x4e3f, 0x83, 0x63, 0x52, 0x4b, 0x87, 0xc6, 0xb0, 0xd9} +DEFINE_GUID!{GUID_MetadataFormatChunktIME, + 0x6b00ae2d, 0xe24b, 0x460a, 0x98, 0xb6, 0x87, 0x8b, 0xd0, 0x30, 0x72, 0xfd} +DEFINE_GUID!{GUID_MetadataFormatDds, + 0x4a064603, 0x8c33, 0x4e60, 0x9c, 0x29, 0x13, 0x62, 0x31, 0x70, 0x2d, 0x08} +DEFINE_GUID!{CLSID_WICUnknownMetadataReader, + 0x699745c2, 0x5066, 0x4b82, 0xa8, 0xe3, 0xd4, 0x04, 0x78, 0xdb, 0xec, 0x8c} +DEFINE_GUID!{CLSID_WICUnknownMetadataWriter, + 0xa09cca86, 0x27ba, 0x4f39, 0x90, 0x53, 0x12, 0x1f, 0xa4, 0xdc, 0x08, 0xfc} +DEFINE_GUID!{CLSID_WICApp0MetadataWriter, + 0xf3c633a2, 0x46c8, 0x498e, 0x8f, 0xbb, 0xcc, 0x6f, 0x72, 0x1b, 0xbc, 0xde} +DEFINE_GUID!{CLSID_WICApp0MetadataReader, + 0x43324b33, 0xa78f, 0x480f, 0x91, 0x11, 0x96, 0x38, 0xaa, 0xcc, 0xc8, 0x32} +DEFINE_GUID!{CLSID_WICApp1MetadataWriter, + 0xee366069, 0x1832, 0x420f, 0xb3, 0x81, 0x04, 0x79, 0xad, 0x06, 0x6f, 0x19} +DEFINE_GUID!{CLSID_WICApp1MetadataReader, + 0xdde33513, 0x774e, 0x4bcd, 0xae, 0x79, 0x02, 0xf4, 0xad, 0xfe, 0x62, 0xfc} +DEFINE_GUID!{CLSID_WICApp13MetadataWriter, + 0x7b19a919, 0xa9d6, 0x49e5, 0xbd, 0x45, 0x02, 0xc3, 0x4e, 0x4e, 0x4c, 0xd5} +DEFINE_GUID!{CLSID_WICApp13MetadataReader, + 0xaa7e3c50, 0x864c, 0x4604, 0xbc, 0x04, 0x8b, 0x0b, 0x76, 0xe6, 0x37, 0xf6} +DEFINE_GUID!{CLSID_WICIfdMetadataReader, + 0x8f914656, 0x9d0a, 0x4eb2, 0x90, 0x19, 0x0b, 0xf9, 0x6d, 0x8a, 0x9e, 0xe6} +DEFINE_GUID!{CLSID_WICIfdMetadataWriter, + 0xb1ebfc28, 0xc9bd, 0x47a2, 0x8d, 0x33, 0xb9, 0x48, 0x76, 0x97, 0x77, 0xa7} +DEFINE_GUID!{CLSID_WICSubIfdMetadataReader, + 0x50d42f09, 0xecd1, 0x4b41, 0xb6, 0x5d, 0xda, 0x1f, 0xda, 0xa7, 0x56, 0x63} +DEFINE_GUID!{CLSID_WICSubIfdMetadataWriter, + 0x8ade5386, 0x8e9b, 0x4f4c, 0xac, 0xf2, 0xf0, 0x00, 0x87, 0x06, 0xb2, 0x38} +DEFINE_GUID!{CLSID_WICExifMetadataReader, + 0xd9403860, 0x297f, 0x4a49, 0xbf, 0x9b, 0x77, 0x89, 0x81, 0x50, 0xa4, 0x42} +DEFINE_GUID!{CLSID_WICExifMetadataWriter, + 0xc9a14cda, 0xc339, 0x460b, 0x90, 0x78, 0xd4, 0xde, 0xbc, 0xfa, 0xbe, 0x91} +DEFINE_GUID!{CLSID_WICGpsMetadataReader, + 0x3697790b, 0x223b, 0x484e, 0x99, 0x25, 0xc4, 0x86, 0x92, 0x18, 0xf1, 0x7a} +DEFINE_GUID!{CLSID_WICGpsMetadataWriter, + 0xcb8c13e4, 0x62b5, 0x4c96, 0xa4, 0x8b, 0x6b, 0xa6, 0xac, 0xe3, 0x9c, 0x76} +DEFINE_GUID!{CLSID_WICInteropMetadataReader, + 0xb5c8b898, 0x0074, 0x459f, 0xb7, 0x00, 0x86, 0x0d, 0x46, 0x51, 0xea, 0x14} +DEFINE_GUID!{CLSID_WICInteropMetadataWriter, + 0x122ec645, 0xcd7e, 0x44d8, 0xb1, 0x86, 0x2c, 0x8c, 0x20, 0xc3, 0xb5, 0x0f} +DEFINE_GUID!{CLSID_WICThumbnailMetadataReader, + 0xfb012959, 0xf4f6, 0x44d7, 0x9d, 0x09, 0xda, 0xa0, 0x87, 0xa9, 0xdb, 0x57} +DEFINE_GUID!{CLSID_WICThumbnailMetadataWriter, + 0xd049b20c, 0x5dd0, 0x44fe, 0xb0, 0xb3, 0x8f, 0x92, 0xc8, 0xe6, 0xd0, 0x80} +DEFINE_GUID!{CLSID_WICIPTCMetadataReader, + 0x03012959, 0xf4f6, 0x44d7, 0x9d, 0x09, 0xda, 0xa0, 0x87, 0xa9, 0xdb, 0x57} +DEFINE_GUID!{CLSID_WICIPTCMetadataWriter, + 0x1249b20c, 0x5dd0, 0x44fe, 0xb0, 0xb3, 0x8f, 0x92, 0xc8, 0xe6, 0xd0, 0x80} +DEFINE_GUID!{CLSID_WICIRBMetadataReader, + 0xd4dcd3d7, 0xb4c2, 0x47d9, 0xa6, 0xbf, 0xb8, 0x9b, 0xa3, 0x96, 0xa4, 0xa3} +DEFINE_GUID!{CLSID_WICIRBMetadataWriter, + 0x5c5c1935, 0x0235, 0x4434, 0x80, 0xbc, 0x25, 0x1b, 0xc1, 0xec, 0x39, 0xc6} +DEFINE_GUID!{CLSID_WIC8BIMIPTCMetadataReader, + 0x0010668c, 0x0801, 0x4da6, 0xa4, 0xa4, 0x82, 0x65, 0x22, 0xb6, 0xd2, 0x8f} +DEFINE_GUID!{CLSID_WIC8BIMIPTCMetadataWriter, + 0x00108226, 0xee41, 0x44a2, 0x9e, 0x9c, 0x4b, 0xe4, 0xd5, 0xb1, 0xd2, 0xcd} +DEFINE_GUID!{CLSID_WIC8BIMResolutionInfoMetadataReader, + 0x5805137a, 0xe348, 0x4f7c, 0xb3, 0xcc, 0x6d, 0xb9, 0x96, 0x5a, 0x05, 0x99} +DEFINE_GUID!{CLSID_WIC8BIMResolutionInfoMetadataWriter, + 0x4ff2fe0e, 0xe74a, 0x4b71, 0x98, 0xc4, 0xab, 0x7d, 0xc1, 0x67, 0x07, 0xba} +DEFINE_GUID!{CLSID_WIC8BIMIPTCDigestMetadataReader, + 0x02805f1e, 0xd5aa, 0x415b, 0x82, 0xc5, 0x61, 0xc0, 0x33, 0xa9, 0x88, 0xa6} +DEFINE_GUID!{CLSID_WIC8BIMIPTCDigestMetadataWriter, + 0x2db5e62b, 0x0d67, 0x495f, 0x8f, 0x9d, 0xc2, 0xf0, 0x18, 0x86, 0x47, 0xac} +DEFINE_GUID!{CLSID_WICPngTextMetadataReader, + 0x4b59afcc, 0xb8c3, 0x408a, 0xb6, 0x70, 0x89, 0xe5, 0xfa, 0xb6, 0xfd, 0xa7} +DEFINE_GUID!{CLSID_WICPngTextMetadataWriter, + 0xb5ebafb9, 0x253e, 0x4a72, 0xa7, 0x44, 0x07, 0x62, 0xd2, 0x68, 0x56, 0x83} +DEFINE_GUID!{CLSID_WICXMPMetadataReader, + 0x72b624df, 0xae11, 0x4948, 0xa6, 0x5c, 0x35, 0x1e, 0xb0, 0x82, 0x94, 0x19} +DEFINE_GUID!{CLSID_WICXMPMetadataWriter, + 0x1765e14e, 0x1bd4, 0x462e, 0xb6, 0xb1, 0x59, 0x0b, 0xf1, 0x26, 0x2a, 0xc6} +DEFINE_GUID!{CLSID_WICXMPStructMetadataReader, + 0x01b90d9a, 0x8209, 0x47f7, 0x9c, 0x52, 0xe1, 0x24, 0x4b, 0xf5, 0x0c, 0xed} +DEFINE_GUID!{CLSID_WICXMPStructMetadataWriter, + 0x22c21f93, 0x7ddb, 0x411c, 0x9b, 0x17, 0xc5, 0xb7, 0xbd, 0x06, 0x4a, 0xbc} +DEFINE_GUID!{CLSID_WICXMPBagMetadataReader, + 0xe7e79a30, 0x4f2c, 0x4fab, 0x8d, 0x00, 0x39, 0x4f, 0x2d, 0x6b, 0xbe, 0xbe} +DEFINE_GUID!{CLSID_WICXMPBagMetadataWriter, + 0xed822c8c, 0xd6be, 0x4301, 0xa6, 0x31, 0x0e, 0x14, 0x16, 0xba, 0xd2, 0x8f} +DEFINE_GUID!{CLSID_WICXMPSeqMetadataReader, + 0x7f12e753, 0xfc71, 0x43d7, 0xa5, 0x1d, 0x92, 0xf3, 0x59, 0x77, 0xab, 0xb5} +DEFINE_GUID!{CLSID_WICXMPSeqMetadataWriter, + 0x6d68d1de, 0xd432, 0x4b0f, 0x92, 0x3a, 0x09, 0x11, 0x83, 0xa9, 0xbd, 0xa7} +DEFINE_GUID!{CLSID_WICXMPAltMetadataReader, + 0xaa94dcc2, 0xb8b0, 0x4898, 0xb8, 0x35, 0x00, 0x0a, 0xab, 0xd7, 0x43, 0x93} +DEFINE_GUID!{CLSID_WICXMPAltMetadataWriter, + 0x076c2a6c, 0xf78f, 0x4c46, 0xa7, 0x23, 0x35, 0x83, 0xe7, 0x08, 0x76, 0xea} +DEFINE_GUID!{CLSID_WICLSDMetadataReader, + 0x41070793, 0x59e4, 0x479a, 0xa1, 0xf7, 0x95, 0x4a, 0xdc, 0x2e, 0xf5, 0xfc} +DEFINE_GUID!{CLSID_WICLSDMetadataWriter, + 0x73c037e7, 0xe5d9, 0x4954, 0x87, 0x6a, 0x6d, 0xa8, 0x1d, 0x6e, 0x57, 0x68} +DEFINE_GUID!{CLSID_WICGCEMetadataReader, + 0xb92e345d, 0xf52d, 0x41f3, 0xb5, 0x62, 0x08, 0x1b, 0xc7, 0x72, 0xe3, 0xb9} +DEFINE_GUID!{CLSID_WICGCEMetadataWriter, + 0xaf95dc76, 0x16b2, 0x47f4, 0xb3, 0xea, 0x3c, 0x31, 0x79, 0x66, 0x93, 0xe7} +DEFINE_GUID!{CLSID_WICIMDMetadataReader, + 0x7447a267, 0x0015, 0x42c8, 0xa8, 0xf1, 0xfb, 0x3b, 0x94, 0xc6, 0x83, 0x61} +DEFINE_GUID!{CLSID_WICIMDMetadataWriter, + 0x8c89071f, 0x452e, 0x4e95, 0x96, 0x82, 0x9d, 0x10, 0x24, 0x62, 0x71, 0x72} +DEFINE_GUID!{CLSID_WICAPEMetadataReader, + 0x1767b93a, 0xb021, 0x44ea, 0x92, 0x0f, 0x86, 0x3c, 0x11, 0xf4, 0xf7, 0x68} +DEFINE_GUID!{CLSID_WICAPEMetadataWriter, + 0xbd6edfca, 0x2890, 0x482f, 0xb2, 0x33, 0x8d, 0x73, 0x39, 0xa1, 0xcf, 0x8d} +DEFINE_GUID!{CLSID_WICJpegChrominanceMetadataReader, + 0x50b1904b, 0xf28f, 0x4574, 0x93, 0xf4, 0x0b, 0xad, 0xe8, 0x2c, 0x69, 0xe9} +DEFINE_GUID!{CLSID_WICJpegChrominanceMetadataWriter, + 0x3ff566f0, 0x6e6b, 0x49d4, 0x96, 0xe6, 0xb7, 0x88, 0x86, 0x69, 0x2c, 0x62} +DEFINE_GUID!{CLSID_WICJpegLuminanceMetadataReader, + 0x356f2f88, 0x05a6, 0x4728, 0xb9, 0xa4, 0x1b, 0xfb, 0xce, 0x04, 0xd8, 0x38} +DEFINE_GUID!{CLSID_WICJpegLuminanceMetadataWriter, + 0x1d583abc, 0x8a0e, 0x4657, 0x99, 0x82, 0xa3, 0x80, 0xca, 0x58, 0xfb, 0x4b} +DEFINE_GUID!{CLSID_WICJpegCommentMetadataReader, + 0x9f66347c, 0x60c4, 0x4c4d, 0xab, 0x58, 0xd2, 0x35, 0x86, 0x85, 0xf6, 0x07} +DEFINE_GUID!{CLSID_WICJpegCommentMetadataWriter, + 0xe573236f, 0x55b1, 0x4eda, 0x81, 0xea, 0x9f, 0x65, 0xdb, 0x02, 0x90, 0xd3} +DEFINE_GUID!{CLSID_WICGifCommentMetadataReader, + 0x32557d3b, 0x69dc, 0x4f95, 0x83, 0x6e, 0xf5, 0x97, 0x2b, 0x2f, 0x61, 0x59} +DEFINE_GUID!{CLSID_WICGifCommentMetadataWriter, + 0xa02797fc, 0xc4ae, 0x418c, 0xaf, 0x95, 0xe6, 0x37, 0xc7, 0xea, 0xd2, 0xa1} +DEFINE_GUID!{CLSID_WICPngGamaMetadataReader, + 0x3692ca39, 0xe082, 0x4350, 0x9e, 0x1f, 0x37, 0x04, 0xcb, 0x08, 0x3c, 0xd5} +DEFINE_GUID!{CLSID_WICPngGamaMetadataWriter, + 0xff036d13, 0x5d4b, 0x46dd, 0xb1, 0x0f, 0x10, 0x66, 0x93, 0xd9, 0xfe, 0x4f} +DEFINE_GUID!{CLSID_WICPngBkgdMetadataReader, + 0x0ce7a4a6, 0x03e8, 0x4a60, 0x9d, 0x15, 0x28, 0x2e, 0xf3, 0x2e, 0xe7, 0xda} +DEFINE_GUID!{CLSID_WICPngBkgdMetadataWriter, + 0x68e3f2fd, 0x31ae, 0x4441, 0xbb, 0x6a, 0xfd, 0x70, 0x47, 0x52, 0x5f, 0x90} +DEFINE_GUID!{CLSID_WICPngItxtMetadataReader, + 0xaabfb2fa, 0x3e1e, 0x4a8f, 0x89, 0x77, 0x55, 0x56, 0xfb, 0x94, 0xea, 0x23} +DEFINE_GUID!{CLSID_WICPngItxtMetadataWriter, + 0x31879719, 0xe751, 0x4df8, 0x98, 0x1d, 0x68, 0xdf, 0xf6, 0x77, 0x04, 0xed} +DEFINE_GUID!{CLSID_WICPngChrmMetadataReader, + 0xf90b5f36, 0x367b, 0x402a, 0x9d, 0xd1, 0xbc, 0x0f, 0xd5, 0x9d, 0x8f, 0x62} +DEFINE_GUID!{CLSID_WICPngChrmMetadataWriter, + 0xe23ce3eb, 0x5608, 0x4e83, 0xbc, 0xef, 0x27, 0xb1, 0x98, 0x7e, 0x51, 0xd7} +DEFINE_GUID!{CLSID_WICPngHistMetadataReader, + 0x877a0bb7, 0xa313, 0x4491, 0x87, 0xb5, 0x2e, 0x6d, 0x05, 0x94, 0xf5, 0x20} +DEFINE_GUID!{CLSID_WICPngHistMetadataWriter, + 0x8a03e749, 0x672e, 0x446e, 0xbf, 0x1f, 0x2c, 0x11, 0xd2, 0x33, 0xb6, 0xff} +DEFINE_GUID!{CLSID_WICPngIccpMetadataReader, + 0xf5d3e63b, 0xcb0f, 0x4628, 0xa4, 0x78, 0x6d, 0x82, 0x44, 0xbe, 0x36, 0xb1} +DEFINE_GUID!{CLSID_WICPngIccpMetadataWriter, + 0x16671e5f, 0x0ce6, 0x4cc4, 0x97, 0x68, 0xe8, 0x9f, 0xe5, 0x01, 0x8a, 0xde} +DEFINE_GUID!{CLSID_WICPngSrgbMetadataReader, + 0xfb40360c, 0x547e, 0x4956, 0xa3, 0xb9, 0xd4, 0x41, 0x88, 0x59, 0xba, 0x66} +DEFINE_GUID!{CLSID_WICPngSrgbMetadataWriter, + 0xa6ee35c6, 0x87ec, 0x47df, 0x9f, 0x22, 0x1d, 0x5a, 0xad, 0x84, 0x0c, 0x82} +DEFINE_GUID!{CLSID_WICPngTimeMetadataReader, + 0xd94edf02, 0xefe5, 0x4f0d, 0x85, 0xc8, 0xf5, 0xa6, 0x8b, 0x30, 0x00, 0xb1} +DEFINE_GUID!{CLSID_WICPngTimeMetadataWriter, + 0x1ab78400, 0xb5a3, 0x4d91, 0x8a, 0xce, 0x33, 0xfc, 0xd1, 0x49, 0x9b, 0xe6} +DEFINE_GUID!{CLSID_WICDdsMetadataReader, + 0x276c88ca, 0x7533, 0x4a86, 0xb6, 0x76, 0x66, 0xb3, 0x60, 0x80, 0xd4, 0x84} +DEFINE_GUID!{CLSID_WICDdsMetadataWriter, + 0xfd688bbd, 0x31ed, 0x4db7, 0xa7, 0x23, 0x93, 0x49, 0x27, 0xd3, 0x83, 0x67} +ENUM!{enum WICMetadataCreationOptions { + WICMetadataCreationDefault = 0, + WICMetadataCreationAllowUnknown = WICMetadataCreationDefault, + WICMetadataCreationFailUnknown = 0x10000, + WICMetadataCreationMask = 0xffff0000, +}} +ENUM!{enum WICPersistOptions { + WICPersistOptionDefault = 0, + WICPersistOptionLittleEndian = 0, + WICPersistOptionBigEndian = 0x1, + WICPersistOptionStrictFormat = 0x2, + WICPersistOptionNoCacheStream = 0x4, + WICPersistOptionPreferUTF8 = 0x8, + WICPersistOptionMask = 0xffff, +}} +RIDL!(#[uuid(0xfeaa2a8d, 0xb3f3, 0x43e4, 0xb2, 0x5c, 0xd1, 0xde, 0x99, 0x0a, 0x1a, 0xe1)] +interface IWICMetadataBlockReader(IWICMetadataBlockReaderVtbl): IUnknown(IUnknownVtbl) { + fn GetContainerFormat( + pguidContainerFormat: *mut GUID, + ) -> HRESULT, + fn GetCount( + pcCount: *mut UINT, + ) -> HRESULT, + fn GetReaderByIndex( + ppIMetadataReader: *mut *mut IWICMetadataReader, + ) -> HRESULT, + fn GetEnumerator( + ppIEnumMetadata: *mut IEnumUnknown, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x08fb9676, 0xb444, 0x41e8, 0x8d, 0xbe, 0x6a, 0x53, 0xa5, 0x42, 0xbf, 0xf1)] +interface IWICMetadataBlockWriter(IWICMetadataBlockWriterVtbl): + IWICMetadataBlockReader(IWICMetadataBlockReaderVtbl) { + fn InitializeFromBlockReader( + pIMDBlockReader: *mut IWICMetadataBlockReader, + ) -> HRESULT, + fn GetWriterByIndex( + ppIMetadataWriter: *mut *mut IWICMetadataWriter, + ) -> HRESULT, + fn AddWriter( + pIMetadataWriter: *mut IWICMetadataWriter, + ) -> HRESULT, + fn SetWriterByIndex( + pIMetadataWriter: *mut IWICMetadataWriter, + ) -> HRESULT, + fn RemoveWriterByIndex( + nIndex: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x9204fe99, 0xd8fc, 0x4fd5, 0xa0, 0x01, 0x95, 0x36, 0xb0, 0x67, 0xa8, 0x99)] +interface IWICMetadataReader(IWICMetadataReaderVtbl): IUnknown(IUnknownVtbl) { + fn GetMetadataFormat( + pguidMetadataFormat: *mut GUID, + ) -> HRESULT, + fn GetMetadataHandlerInfo( + ppIHandler: *mut *mut IWICMetadataHandlerInfo, + ) -> HRESULT, + fn GetCount( + pcCount: *mut UINT, + ) -> HRESULT, + fn GetValueByIndex( + nIndex: UINT, + pvarSchema: *mut PROPVARIANT, + pvarId: *mut PROPVARIANT, + pvarValue: *mut PROPVARIANT, + ) -> HRESULT, + fn GetValue( + pvarSchema: *const PROPVARIANT, + pvarId: *const PROPVARIANT, + pvarValue: *mut PROPVARIANT, + ) -> HRESULT, + fn GetEnumerator( + ppIEnumMetadata: *mut *mut IWICEnumMetadataItem, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xf7836e16, 0x3be0, 0x470b, 0x86, 0xbb, 0x16, 0x0d, 0x0a, 0xec, 0xd7, 0xde)] +interface IWICMetadataWriter(IWICMetadataWriterVtbl): IWICMetadataReader(IWICMetadataReaderVtbl) { + fn SetValue( + pvarSchema: *const PROPVARIANT, + pvarId: *const PROPVARIANT, + pvarValue: *const PROPVARIANT, + ) -> HRESULT, + fn SetValueByIndex( + nIndex: UINT, + pvarSchema: *const PROPVARIANT, + pvarId: *const PROPVARIANT, + pvarValue: *const PROPVARIANT, + ) -> HRESULT, + fn RemoveValue( + pvarSchema: *const PROPVARIANT, + pvarId: *const PROPVARIANT, + ) -> HRESULT, + fn RemoveValueByIndex( + nIndex: UINT, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x449494bc, 0xb468, 0x4927, 0x96, 0xd7, 0xba, 0x90, 0xd3, 0x1a, 0xb5, 0x05)] +interface IWICStreamProvider(IWICStreamProviderVtbl): IUnknown(IUnknownVtbl) { + fn GetStream( + ppIStream: *mut *mut IStream, + ) -> HRESULT, + fn GetPersistOptions( + pdwPersistOptions: *mut DWORD, + ) -> HRESULT, + fn GetPreferredVendorGUID( + pguidPreferredVendor: *mut GUID, + ) -> HRESULT, + fn RefreshStream() -> HRESULT, +}); +RIDL!(#[uuid(0x00675040, 0x6908, 0x45f8, 0x86, 0xa3, 0x49, 0xc7, 0xdf, 0xd6, 0xd9, 0xad)] +interface IWICPersistStream(IWICPersistStreamVtbl): IPersistStream(IPersistStreamVtbl) { + fn LoadEx( + pIStream: *mut IStream, + pguidPreferredVendor: *const GUID, + dwPersistOptions: DWORD, + ) -> HRESULT, + fn SaveEx( + pIStream: *mut IStream, + dwPersistOptions: DWORD, + fClearDirty: BOOL, + ) -> HRESULT, +}); +RIDL!(#[uuid(0xaba958bf, 0xc672, 0x44d1, 0x8d, 0x61, 0xce, 0x6d, 0xf2, 0xe6, 0x82, 0xc2)] +interface IWICMetadataHandlerInfo(IWICMetadataHandlerInfoVtbl): + IWICComponentInfo(IWICComponentInfoVtbl) { + fn GetMetadataFormat( + pguidMetadataFormat: *mut GUID, + ) -> HRESULT, + fn GetContainerFormats( + cContainerFormats: UINT, + pguidContainerFormats: *mut GUID, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetDeviceManufacturer( + cchDeviceManufacturer: UINT, + wzDeviceManufacturer: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn GetDeviceModels( + cchDeviceModels: UINT, + wzDeviceModels: *mut WCHAR, + pcchActual: *mut UINT, + ) -> HRESULT, + fn DoesRequireFullStream( + pfRequiresFullStream: *mut BOOL, + ) -> HRESULT, + fn DoesSupportPadding( + pfSupportsPadding: *mut BOOL, + ) -> HRESULT, + fn DoesRequireFixedSize( + pfFixedSize: *mut BOOL, + ) -> HRESULT, +}); +STRUCT!{struct WICMetadataPattern { + Position: ULARGE_INTEGER, + Length: ULONG, + Pattern: *mut BYTE, + Mask: *mut BYTE, + DataOffset: ULARGE_INTEGER, +}} +RIDL!(#[uuid(0xeebf1f5b, 0x07c1, 0x4447, 0xa3, 0xab, 0x22, 0xac, 0xaf, 0x78, 0xa8, 0x04)] +interface IWICMetadataReaderInfo(IWICMetadataReaderInfoVtbl): + IWICMetadataHandlerInfo(IWICMetadataHandlerInfoVtbl) { + fn GetPatterns( + guidContainerFormat: REFGUID, + cbSize: UINT, + pPattern: *mut WICMetadataPattern, + pcCount: *mut UINT, + pcbActual: *mut UINT, + ) -> HRESULT, + fn MatchesPattern( + guidContainerFormat: REFGUID, + pIStream: *mut IStream, + pfMatches: *mut BOOL, + ) -> HRESULT, + fn CreateInstance( + ppIReader: *mut *mut IWICMetadataReader, + ) -> HRESULT, +}); +STRUCT!{struct WICMetadataHeader { + Position: ULARGE_INTEGER, + Length: ULONG, + Header: *mut BYTE, + DataOffset: ULARGE_INTEGER, +}} +RIDL!(#[uuid(0xb22e3fba, 0x3925, 0x4323, 0xb5, 0xc1, 0x9e, 0xbf, 0xc4, 0x30, 0xf2, 0x36)] +interface IWICMetadataWriterInfo(IWICMetadataWriterInfoVtbl): + IWICMetadataHandlerInfo(IWICMetadataHandlerInfoVtbl) { + fn GetHeader( + guidContainerFormat: REFGUID, + cbSize: UINT, + pHeader: *mut WICMetadataHeader, + pcbActual: *mut UINT, + ) -> HRESULT, + fn CreateInstance( + ppIWriter: *mut *mut IWICMetadataWriter, + ) -> HRESULT, +}); +RIDL!(#[uuid(0x412d0c3a, 0x9650, 0x44fa, 0xaf, 0x5b, 0xdd, 0x2a, 0x06, 0xc8, 0xe8, 0xfb)] +interface IWICComponentFactory(IWICComponentFactoryVtbl): + IWICImagingFactory(IWICImagingFactoryVtbl) { + fn CreateMetadataReader( + guidMetadataFormat: REFGUID, + pguidVendor: *const GUID, + dwOptions: DWORD, + pIStream: *mut IStream, + ppIReader: *mut *mut IWICMetadataReader, + ) -> HRESULT, + fn CreateMetadataReaderFromContainer( + guidContainerFormat: REFGUID, + pguidVendor: *const GUID, + dwOptions: DWORD, + pIStream: *mut IStream, + ppIReader: *mut *mut IWICMetadataReader, + ) -> HRESULT, + fn CreateMetadataWriter( + guidMetadataFormat: REFGUID, + pguidVendor: *const GUID, + dwMetadataOptions: DWORD, + ppIWriter: *mut *mut IWICMetadataWriter, + ) -> HRESULT, + fn CreateMetadataWriterFromReader( + pIReader: *mut IWICMetadataReader, + pguidVendor: *const GUID, + ppIWriter: *mut *mut IWICMetadataWriter, + ) -> HRESULT, + fn CreateQueryReaderFromBlockReader( + pIBlockReader: *mut IWICMetadataBlockReader, + ppIQueryReader: *mut *mut IWICMetadataQueryReader, + ) -> HRESULT, + fn CreateQueryWriterFromBlockWriter( + pIBlockWriter: *mut IWICMetadataBlockWriter, + ppIQueryWriter: *mut *mut IWICMetadataQueryWriter, + ) -> HRESULT, + fn CreateEncoderPropertyBag( + ppropOptions: *mut PROPBAG2, + cCount: UINT, + ppIPropertyBag: *mut *mut IPropertyBag2, + ) -> HRESULT, +}); +extern "system" { + pub fn WICMatchMetadataContent( + guidContainerFormat: REFGUID, + pguidVendor: *const GUID, + pIStream: *mut IStream, + pguidMetadataFormat: *mut GUID, + ) -> HRESULT; + pub fn WICSerializeMetadataContent( + guidContainerFormat: REFGUID, + pIWriter: *mut IWICMetadataWriter, + dwPersistOptions: DWORD, + pIStream: *mut IStream, + ) -> HRESULT; + pub fn WICGetMetadataContentSize( + guidContainerFormat: REFGUID, + pIWriter: *mut IWICMetadataWriter, + pcbSize: *mut ULARGE_INTEGER, + ) -> HRESULT; + pub fn BSTR_UserSize( + pFlags: *mut c_ulong, + Offset: c_ulong, + pBstr: *mut BSTR, + ) -> c_ulong; + pub fn BSTR_UserMarshal( + pFlags: *mut c_ulong, + pBuffer: *mut c_uchar, + pBstr: *mut BSTR, + ) -> *mut c_uchar; + pub fn BSTR_UserUnmarshal( + pFlags: *mut c_ulong, + pBuffer: *mut c_uchar, + pBstr: *mut BSTR, + ) -> *mut c_uchar; + pub fn BSTR_UserFree( + pFlags: *mut c_ulong, + pBstr: *mut BSTR, + ); + pub fn CLIPFORMAT_UserSize( + pFlags: *mut c_ulong, + Offset: c_ulong, + pCF: *mut CLIPFORMAT, + ) -> c_ulong; + pub fn CLIPFORMAT_UserMarshal( + pFlags: *mut c_ulong, + pBuffer: *mut c_uchar, + pCF: *mut CLIPFORMAT, + ) -> *mut c_uchar; + pub fn CLIPFORMAT_UserUnmarshal( + pFlags: *mut c_ulong, + pBuffer: *mut c_uchar, + pCF: *mut CLIPFORMAT, + ) -> *mut c_uchar; + pub fn CLIPFORMAT_UserFree( + pFlags: *mut c_ulong, + pCF: *mut CLIPFORMAT, + ); + pub fn LPSAFEARRAY_UserSize( + pFlags: *mut c_ulong, + Offset: c_ulong, + phBmp: *mut LPSAFEARRAY, + ) -> c_ulong; + pub fn LPSAFEARRAY_UserMarshal( + pFlags: *mut c_ulong, + pBuffer: *mut c_uchar, + pBstr: *mut LPSAFEARRAY, + ) -> *mut c_uchar; + pub fn LPSAFEARRAY_UserUnmarshal( + pFlags: *mut c_ulong, + pBuffer: *mut c_uchar, + pBstr: *mut LPSAFEARRAY, + ) -> *mut c_uchar; + pub fn LPSAFEARRAY_UserFree( + pFlags: *mut c_ulong, + pBstr: *mut LPSAFEARRAY, + ); +} diff --git a/src/vendor/winapi/src/um/wincon.rs b/src/vendor/winapi/src/um/wincon.rs new file mode 100644 index 0000000000..2e5647b86d --- /dev/null +++ b/src/vendor/winapi/src/um/wincon.rs @@ -0,0 +1,540 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module contains the public data structures, data types, and procedures exported by the NT +//! console subsystem. +use ctypes::c_void; +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID, LPWORD, UINT, ULONG, WORD}; +use shared::windef::{COLORREF, HWND}; +use um::minwinbase::SECURITY_ATTRIBUTES; +use um::wingdi::LF_FACESIZE; +use um::winnt::{CHAR, HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, SHORT, WCHAR}; +STRUCT!{struct COORD { + X: SHORT, + Y: SHORT, +}} +pub type PCOORD = *mut COORD; +STRUCT!{struct SMALL_RECT { + Left: SHORT, + Top: SHORT, + Right: SHORT, + Bottom: SHORT, +}} +pub type PSMALL_RECT = *mut SMALL_RECT; +UNION!{union KEY_EVENT_RECORD_uChar { + [u16; 1], + UnicodeChar UnicodeChar_mut: WCHAR, + AsciiChar AsciiChar_mut: CHAR, +}} +STRUCT!{struct KEY_EVENT_RECORD { + bKeyDown: BOOL, + wRepeatCount: WORD, + wVirtualKeyCode: WORD, + wVirtualScanCode: WORD, + uChar: KEY_EVENT_RECORD_uChar, + dwControlKeyState: DWORD, +}} +pub type PKEY_EVENT_RECORD = *mut KEY_EVENT_RECORD; +pub const RIGHT_ALT_PRESSED: DWORD = 0x0001; +pub const LEFT_ALT_PRESSED: DWORD = 0x0002; +pub const RIGHT_CTRL_PRESSED: DWORD = 0x0004; +pub const LEFT_CTRL_PRESSED: DWORD = 0x0008; +pub const SHIFT_PRESSED: DWORD = 0x0010; +pub const NUMLOCK_ON: DWORD = 0x0020; +pub const SCROLLLOCK_ON: DWORD = 0x0040; +pub const CAPSLOCK_ON: DWORD = 0x0080; +pub const ENHANCED_KEY: DWORD = 0x0100; +pub const NLS_DBCSCHAR: DWORD = 0x00010000; +pub const NLS_ALPHANUMERIC: DWORD = 0x00000000; +pub const NLS_KATAKANA: DWORD = 0x00020000; +pub const NLS_HIRAGANA: DWORD = 0x00040000; +pub const NLS_ROMAN: DWORD = 0x00400000; +pub const NLS_IME_CONVERSION: DWORD = 0x00800000; +pub const NLS_IME_DISABLE: DWORD = 0x20000000; +STRUCT!{struct MOUSE_EVENT_RECORD { + dwMousePosition: COORD, + dwButtonState: DWORD, + dwControlKeyState: DWORD, + dwEventFlags: DWORD, +}} +pub type PMOUSE_EVENT_RECORD = *mut MOUSE_EVENT_RECORD; +pub const FROM_LEFT_1ST_BUTTON_PRESSED: DWORD = 0x0001; +pub const RIGHTMOST_BUTTON_PRESSED: DWORD = 0x0002; +pub const FROM_LEFT_2ND_BUTTON_PRESSED: DWORD = 0x0004; +pub const FROM_LEFT_3RD_BUTTON_PRESSED: DWORD = 0x0008; +pub const FROM_LEFT_4TH_BUTTON_PRESSED: DWORD = 0x0010; +pub const MOUSE_MOVED: DWORD = 0x0001; +pub const DOUBLE_CLICK: DWORD = 0x0002; +pub const MOUSE_WHEELED: DWORD = 0x0004; +pub const MOUSE_HWHEELED: DWORD = 0x0008; +STRUCT!{struct WINDOW_BUFFER_SIZE_RECORD { + dwSize: COORD, +}} +pub type PWINDOW_BUFFER_SIZE_RECORD = *mut WINDOW_BUFFER_SIZE_RECORD; +STRUCT!{struct MENU_EVENT_RECORD { + dwCommandId: UINT, +}} +pub type PMENU_EVENT_RECORD = *mut MENU_EVENT_RECORD; +STRUCT!{struct FOCUS_EVENT_RECORD { + bSetFocus: BOOL, +}} +pub type PFOCUS_EVENT_RECORD = *mut FOCUS_EVENT_RECORD; +UNION!{union INPUT_RECORD_Event { + [u32; 4], + KeyEvent KeyEvent_mut: KEY_EVENT_RECORD, + MouseEvent MouseEvent_mut: MOUSE_EVENT_RECORD, + WindowBufferSizeEvent WindowBufferSizeEvent_mut: WINDOW_BUFFER_SIZE_RECORD, + MenuEvent MenuEvent_mut: MENU_EVENT_RECORD, + FocusEvent FocusEvent_mut: FOCUS_EVENT_RECORD, +}} +STRUCT!{struct INPUT_RECORD { + EventType: WORD, + Event: INPUT_RECORD_Event, +}} +pub type PINPUT_RECORD = *mut INPUT_RECORD; +pub const KEY_EVENT: WORD = 0x0001; +pub const MOUSE_EVENT: WORD = 0x0002; +pub const WINDOW_BUFFER_SIZE_EVENT: WORD = 0x0004; +pub const MENU_EVENT: WORD = 0x0008; +pub const FOCUS_EVENT: WORD = 0x0010; +UNION!{union CHAR_INFO_Char { + [u16; 1], + UnicodeChar UnicodeChar_mut: WCHAR, + AsciiChar AsciiChar_mut: CHAR, +}} +STRUCT!{struct CHAR_INFO { + Char: CHAR_INFO_Char, + Attributes: WORD, +}} +pub type PCHAR_INFO = *mut CHAR_INFO; +pub const FOREGROUND_BLUE: WORD = 0x0001; +pub const FOREGROUND_GREEN: WORD = 0x0002; +pub const FOREGROUND_RED: WORD = 0x0004; +pub const FOREGROUND_INTENSITY: WORD = 0x0008; +pub const BACKGROUND_BLUE: WORD = 0x0010; +pub const BACKGROUND_GREEN: WORD = 0x0020; +pub const BACKGROUND_RED: WORD = 0x0040; +pub const BACKGROUND_INTENSITY: WORD = 0x0080; +pub const COMMON_LVB_LEADING_BYTE: WORD = 0x0100; +pub const COMMON_LVB_TRAILING_BYTE: WORD = 0x0200; +pub const COMMON_LVB_GRID_HORIZONTAL: WORD = 0x0400; +pub const COMMON_LVB_GRID_LVERTICAL: WORD = 0x0800; +pub const COMMON_LVB_GRID_RVERTICAL: WORD = 0x1000; +pub const COMMON_LVB_REVERSE_VIDEO: WORD = 0x4000; +pub const COMMON_LVB_UNDERSCORE: WORD = 0x8000; +pub const COMMON_LVB_SBCSDBCS: WORD = 0x0300; +STRUCT!{struct CONSOLE_SCREEN_BUFFER_INFO { + dwSize: COORD, + dwCursorPosition: COORD, + wAttributes: WORD, + srWindow: SMALL_RECT, + dwMaximumWindowSize: COORD, +}} +pub type PCONSOLE_SCREEN_BUFFER_INFO = *mut CONSOLE_SCREEN_BUFFER_INFO; +STRUCT!{struct CONSOLE_SCREEN_BUFFER_INFOEX { + cbSize: ULONG, + dwSize: COORD, + dwCursorPosition: COORD, + wAttributes: WORD, + srWindow: SMALL_RECT, + dwMaximumWindowSize: COORD, + wPopupAttributes: WORD, + bFullscreenSupported: BOOL, + ColorTable: [COLORREF; 16], +}} +pub type PCONSOLE_SCREEN_BUFFER_INFOEX = *mut CONSOLE_SCREEN_BUFFER_INFOEX; +STRUCT!{struct CONSOLE_CURSOR_INFO { + dwSize: DWORD, + bVisible: BOOL, +}} +pub type PCONSOLE_CURSOR_INFO = *mut CONSOLE_CURSOR_INFO; +STRUCT!{struct CONSOLE_FONT_INFO { + nFont: DWORD, + dwFontSize: COORD, +}} +pub type PCONSOLE_FONT_INFO = *mut CONSOLE_FONT_INFO; +STRUCT!{struct CONSOLE_FONT_INFOEX { + cbSize: ULONG, + nFont: DWORD, + dwFontSize: COORD, + FontFamily: UINT, + FontWeight: UINT, + FaceName: [WCHAR; LF_FACESIZE], +}} +pub type PCONSOLE_FONT_INFOEX = *mut CONSOLE_FONT_INFOEX; +pub const HISTORY_NO_DUP_FLAG: DWORD = 0x1; +STRUCT!{struct CONSOLE_HISTORY_INFO { + cbSize: UINT, + HistoryBufferSize: UINT, + NumberOfHistoryBuffers: UINT, + dwFlags: DWORD, +}} +pub type PCONSOLE_HISTORY_INFO = *mut CONSOLE_HISTORY_INFO; +STRUCT!{struct CONSOLE_SELECTION_INFO { + dwFlags: DWORD, + dwSelectionAnchor: COORD, + srSelection: SMALL_RECT, +}} +pub type PCONSOLE_SELECTION_INFO = *mut CONSOLE_SELECTION_INFO; +pub const CONSOLE_NO_SELECTION: DWORD = 0x0000; +pub const CONSOLE_SELECTION_IN_PROGRESS: DWORD = 0x0001; +pub const CONSOLE_SELECTION_NOT_EMPTY: DWORD = 0x0002; +pub const CONSOLE_MOUSE_SELECTION: DWORD = 0x0004; +pub const CONSOLE_MOUSE_DOWN: DWORD = 0x0008; +FN!{stdcall PHANDLER_ROUTINE( + CtrlType: DWORD, +) -> BOOL} +pub const CTRL_C_EVENT: DWORD = 0; +pub const CTRL_BREAK_EVENT: DWORD = 1; +pub const CTRL_CLOSE_EVENT: DWORD = 2; +pub const CTRL_LOGOFF_EVENT: DWORD = 5; +pub const CTRL_SHUTDOWN_EVENT: DWORD = 6; +pub const ENABLE_PROCESSED_INPUT: DWORD = 0x0001; +pub const ENABLE_LINE_INPUT: DWORD = 0x0002; +pub const ENABLE_ECHO_INPUT: DWORD = 0x0004; +pub const ENABLE_WINDOW_INPUT: DWORD = 0x0008; +pub const ENABLE_MOUSE_INPUT: DWORD = 0x0010; +pub const ENABLE_INSERT_MODE: DWORD = 0x0020; +pub const ENABLE_QUICK_EDIT_MODE: DWORD = 0x0040; +pub const ENABLE_EXTENDED_FLAGS: DWORD = 0x0080; +pub const ENABLE_AUTO_POSITION: DWORD = 0x0100; +pub const ENABLE_VIRTUAL_TERMINAL_INPUT: DWORD = 0x0200; +pub const ENABLE_PROCESSED_OUTPUT: DWORD = 0x0001; +pub const ENABLE_WRAP_AT_EOL_OUTPUT: DWORD = 0x0002; +pub const ENABLE_VIRTUAL_TERMINAL_PROCESSING: DWORD = 0x0004; +pub const DISABLE_NEWLINE_AUTO_RETURN: DWORD = 0x0008; +pub const ENABLE_LVB_GRID_WORLDWIDE: DWORD = 0x0010; +extern "system" { + pub fn PeekConsoleInputW( + hConsoleInput: HANDLE, + lpBuffer: PINPUT_RECORD, + nLength: DWORD, + lpNumberOfEventsRead: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleInputA( + hConsoleInput: HANDLE, + lpBuffer: *const INPUT_RECORD, + nLength: DWORD, + lpNumberOfEventsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleInputW( + hConsoleInput: HANDLE, + lpBuffer: *const INPUT_RECORD, + nLength: DWORD, + lpNumberOfEventsWritten: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleOutputA( + hConsoleOutput: HANDLE, + lpBuffer: PCHAR_INFO, + dwBufferSize: COORD, + dwBufferCoord: COORD, + lpReadRegion: PSMALL_RECT, + ) -> BOOL; + pub fn ReadConsoleOutputW( + hConsoleOutput: HANDLE, + lpBuffer: PCHAR_INFO, + dwBufferSize: COORD, + dwBufferCoord: COORD, + lpReadRegion: PSMALL_RECT, + ) -> BOOL; + pub fn WriteConsoleOutputA( + hConsoleOutput: HANDLE, + lpBuffer: *const CHAR_INFO, + dwBufferSize: COORD, + dwBufferCoord: COORD, + lpWriteRegion: PSMALL_RECT, + ) -> BOOL; + pub fn WriteConsoleOutputW( + hConsoleOutput: HANDLE, + lpBuffer: *const CHAR_INFO, + dwBufferSize: COORD, + dwBufferCoord: COORD, + lpWriteRegion: PSMALL_RECT, + ) -> BOOL; + pub fn ReadConsoleOutputCharacterA( + hConsoleOutput: HANDLE, + lpCharacter: LPSTR, + nLength: DWORD, + dwReadCoord: COORD, + lpNumberOfCharsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleOutputCharacterW( + hConsoleOutput: HANDLE, + lpCharacter: LPWSTR, + nLength: DWORD, + dwReadCoord: COORD, + lpNumberOfCharsRead: LPDWORD, + ) -> BOOL; + pub fn ReadConsoleOutputAttribute( + hConsoleOutput: HANDLE, + lpAttribute: LPWORD, + nLength: DWORD, + dwReadCoord: COORD, + lpNumberOfAttrsRead: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleOutputCharacterA( + hConsoleOutput: HANDLE, + lpCharacter: LPCSTR, + nLength: DWORD, + dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleOutputCharacterW( + hConsoleOutput: HANDLE, + lpCharacter: LPCWSTR, + nLength: DWORD, + dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn WriteConsoleOutputAttribute( + hConsoleOutput: HANDLE, + lpAttribute: *const WORD, + nLength: DWORD, + dwWriteCoord: COORD, + lpNumberOfAttrsWritten: LPDWORD, + ) -> BOOL; + pub fn FillConsoleOutputCharacterA( + hConsoleOutput: HANDLE, + cCharacter: CHAR, + nLength: DWORD, + dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn FillConsoleOutputCharacterW( + hConsoleOutput: HANDLE, + cCharacter: WCHAR, + nLength: DWORD, + dwWriteCoord: COORD, + lpNumberOfCharsWritten: LPDWORD, + ) -> BOOL; + pub fn FillConsoleOutputAttribute( + hConsoleOutput: HANDLE, + wAttribute: WORD, + nLength: DWORD, + dwWriteCoord: COORD, + lpNumberOfAttrsWritten: LPDWORD, + ) -> BOOL; +} +pub const CONSOLE_REAL_OUTPUT_HANDLE: *mut c_void = -2isize as *mut c_void; +pub const CONSOLE_REAL_INPUT_HANDLE: *mut c_void = -3isize as *mut c_void; +extern "system" { + pub fn GetConsoleScreenBufferInfo( + hConsoleOutput: HANDLE, + lpConsoleScreenBufferInfo: PCONSOLE_SCREEN_BUFFER_INFO, + ) -> BOOL; + pub fn GetConsoleScreenBufferInfoEx( + hConsoleOutput: HANDLE, + lpConsoleScreenBufferInfoEx: PCONSOLE_SCREEN_BUFFER_INFOEX, + ) -> BOOL; + pub fn SetConsoleScreenBufferInfoEx( + hConsoleOutput: HANDLE, + lpConsoleScreenBufferInfoEx: PCONSOLE_SCREEN_BUFFER_INFOEX, + ) -> BOOL; + pub fn GetLargestConsoleWindowSize( + hConsoleOutput: HANDLE, + ) -> COORD; + pub fn GetConsoleCursorInfo( + hConsoleOutput: HANDLE, + lpConsoleCursorInfo: PCONSOLE_CURSOR_INFO, + ) -> BOOL; + pub fn GetCurrentConsoleFont( + hConsoleOutput: HANDLE, + bMaximumWindow: BOOL, + lpConsoleCurrentFont: PCONSOLE_FONT_INFO, + ) -> BOOL; + pub fn GetCurrentConsoleFontEx( + hConsoleOutput: HANDLE, + bMaximumWindow: BOOL, + lpConsoleCurrentFontEx: PCONSOLE_FONT_INFOEX, + ) -> BOOL; + pub fn SetCurrentConsoleFontEx( + hConsoleOutput: HANDLE, + bMaximumWindow: BOOL, + lpConsoleCurrentFontEx: PCONSOLE_FONT_INFOEX, + ) -> BOOL; + pub fn GetConsoleHistoryInfo( + lpConsoleHistoryInfo: PCONSOLE_HISTORY_INFO, + ) -> BOOL; + pub fn SetConsoleHistoryInfo( + lpConsoleHistoryInfo: PCONSOLE_HISTORY_INFO, + ) -> BOOL; + pub fn GetConsoleFontSize( + hConsoleOutput: HANDLE, + nFont: DWORD, + ) -> COORD; + pub fn GetConsoleSelectionInfo( + lpConsoleSelectionInfo: PCONSOLE_SELECTION_INFO, + ) -> BOOL; + pub fn GetNumberOfConsoleMouseButtons( + lpNumberOfMouseButtons: LPDWORD, + ) -> BOOL; + pub fn SetConsoleActiveScreenBuffer( + hConsoleOutput: HANDLE, + ) -> BOOL; + pub fn FlushConsoleInputBuffer( + hConsoleInput: HANDLE, + ) -> BOOL; + pub fn SetConsoleScreenBufferSize( + hConsoleOutput: HANDLE, + dwSize: COORD, + ) -> BOOL; + pub fn SetConsoleCursorPosition( + hConsoleOutput: HANDLE, + dwCursorPosition: COORD, + ) -> BOOL; + pub fn SetConsoleCursorInfo( + hConsoleOutput: HANDLE, + lpConsoleCursorInfo: *const CONSOLE_CURSOR_INFO, + ) -> BOOL; + pub fn ScrollConsoleScreenBufferA( + hConsoleOutput: HANDLE, + lpScrollRectangle: *const SMALL_RECT, + lpClipRectangle: *const SMALL_RECT, + dwDestinationOrigin: COORD, + lpFill: *const CHAR_INFO, + ) -> BOOL; + pub fn ScrollConsoleScreenBufferW( + hConsoleOutput: HANDLE, + lpScrollRectangle: *const SMALL_RECT, + lpClipRectangle: *const SMALL_RECT, + dwDestinationOrigin: COORD, + lpFill: *const CHAR_INFO, + ) -> BOOL; + pub fn SetConsoleWindowInfo( + hConsoleOutput: HANDLE, + bAbsolute: BOOL, + lpConsoleWindow: *const SMALL_RECT, + ) -> BOOL; + pub fn SetConsoleTextAttribute( + hConsoleOutput: HANDLE, + wAttributes: WORD, + ) -> BOOL; + pub fn GenerateConsoleCtrlEvent( + dwCtrlEvent: DWORD, + dwProcessGroupId: DWORD, + ) -> BOOL; + pub fn FreeConsole() -> BOOL; + pub fn AttachConsole( + dwProcessId: DWORD, + ) -> BOOL; +} +pub const ATTACH_PARENT_PROCESS: DWORD = 0xFFFFFFFF; +extern "system" { + pub fn GetConsoleTitleA( + lpConsoleTitle: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetConsoleTitleW( + lpConsoleTitle: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetConsoleOriginalTitleA( + lpConsoleTitle: LPSTR, + nSize: DWORD, + ) -> DWORD; + pub fn GetConsoleOriginalTitleW( + lpConsoleTitle: LPWSTR, + nSize: DWORD, + ) -> DWORD; + pub fn SetConsoleTitleA( + lpConsoleTitle: LPCSTR, + ) -> BOOL; + pub fn SetConsoleTitleW( + lpConsoleTitle: LPCWSTR, + ) -> BOOL; +} +STRUCT!{struct CONSOLE_READCONSOLE_CONTROL { + nLength: ULONG, + nInitialChars: ULONG, + dwCtrlWakeupMask: ULONG, + dwControlKeyState: ULONG, +}} +pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL; +pub const CONSOLE_TEXTMODE_BUFFER: DWORD = 1; +extern "system" { + pub fn CreateConsoleScreenBuffer( + dwDesiredAccess: DWORD, + dwShareMode: DWORD, + lpSecurityAttributes: *const SECURITY_ATTRIBUTES, + dwFlags: DWORD, + lpScreenBufferData: LPVOID, + ) -> HANDLE; + pub fn SetConsoleCP( + wCodePageID: UINT, + ) -> BOOL; + pub fn SetConsoleOutputCP( + wCodePageID: UINT, + ) -> BOOL; +} +pub const CONSOLE_FULLSCREEN: DWORD = 1; +pub const CONSOLE_FULLSCREEN_HARDWARE: DWORD = 2; +extern "system" { + pub fn GetConsoleDisplayMode( + lpModeFlags: LPDWORD, + ) -> BOOL; +} +pub const CONSOLE_FULLSCREEN_MODE: DWORD = 1; +pub const CONSOLE_WINDOWED_MODE: DWORD = 2; +extern "system" { + pub fn SetConsoleDisplayMode( + hConsoleOutput: HANDLE, + dwFlags: DWORD, + lpNewScreenBufferDimensions: PCOORD, + ) -> BOOL; + pub fn GetConsoleWindow() -> HWND; + pub fn GetConsoleProcessList( + lpdwProcessList: LPDWORD, + dwProcessCount: DWORD, + ) -> DWORD; + pub fn AddConsoleAliasA( + Source: LPSTR, + Target: LPSTR, + ExeName: LPSTR, + ) -> BOOL; + pub fn AddConsoleAliasW( + Source: LPWSTR, + Target: LPWSTR, + ExeName: LPWSTR, + ) -> BOOL; + pub fn GetConsoleAliasA( + Source: LPSTR, + TargetBuffer: LPSTR, + TargetBufferLength: DWORD, + ExeName: LPSTR, + ) -> DWORD; + pub fn GetConsoleAliasW( + Source: LPWSTR, + TargetBuffer: LPWSTR, + TargetBufferLength: DWORD, + ExeName: LPWSTR, + ) -> DWORD; + pub fn GetConsoleAliasesLengthA( + ExeName: LPSTR, + ) -> DWORD; + pub fn GetConsoleAliasesLengthW( + ExeName: LPWSTR, + ) -> DWORD; + pub fn GetConsoleAliasExesLengthA() -> DWORD; + pub fn GetConsoleAliasExesLengthW() -> DWORD; + pub fn GetConsoleAliasesA( + AliasBuffer: LPSTR, + AliasBufferLength: DWORD, + ExeName: LPSTR, + ) -> DWORD; + pub fn GetConsoleAliasesW( + AliasBuffer: LPWSTR, + AliasBufferLength: DWORD, + ExeName: LPWSTR, + ) -> DWORD; + pub fn GetConsoleAliasExesA( + ExeNameBuffer: LPSTR, + ExeNameBufferLength: DWORD, + ) -> DWORD; + pub fn GetConsoleAliasExesW( + ExeNameBuffer: LPWSTR, + ExeNameBufferLength: DWORD, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/wincred.rs b/src/vendor/winapi/src/um/wincred.rs new file mode 100644 index 0000000000..07d67edf4c --- /dev/null +++ b/src/vendor/winapi/src/um/wincred.rs @@ -0,0 +1,424 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Authentication API Prototypes and Definitions + +use shared::minwindef::{ + BOOL, DWORD, FILETIME, LPBYTE, LPCVOID, LPDWORD, LPVOID, PBOOL, PBYTE, UCHAR, ULONG +}; +use shared::windef::{HBITMAP, HWND}; +use um::sspi::PCtxtHandle; +use um::winnt::{CHAR, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCSTR, PCWSTR, PSTR, PVOID, PWSTR, WCHAR}; + +// STATUS_* +pub const NERR_BASE: DWORD = 2100; +pub const NERR_PasswordExpired: DWORD = NERR_BASE + 142; +pub const CRED_MAX_STRING_LENGTH: DWORD = 256; +pub const CRED_MAX_USERNAME_LENGTH: DWORD = 256 + 1 + 256; +pub const CRED_MAX_GENERIC_TARGET_NAME_LENGTH: DWORD = 32767; +pub const CRED_MAX_DOMAIN_TARGET_NAME_LENGTH: DWORD = 256 + 1 + 80; +pub const CRED_MAX_TARGETNAME_NAMESPACE_LENGTH: DWORD = 256; +pub const CRED_MAX_TARGETNAME_ATTRIBUTE_LENGTH: DWORD = 256; +pub const CRED_MAX_VALUE_SIZE: DWORD = 256; +pub const CRED_MAX_ATTRIBUTES: DWORD = 64; +STRUCT!{struct CREDENTIAL_ATTRIBUTEA { + Keyword: LPSTR, + Flags: DWORD, + ValueSize: DWORD, + Value: LPBYTE, +}} +pub type PCREDENTIAL_ATTRIBUTEA = *mut CREDENTIAL_ATTRIBUTEA; +STRUCT!{struct CREDENTIAL_ATTRIBUTEW { + Keyword: LPWSTR, + Flags: DWORD, + ValueSize: DWORD, + Value: LPBYTE, +}} +pub type PCREDENTIAL_ATTRIBUTEW = *mut CREDENTIAL_ATTRIBUTEW; +pub const CRED_LOGON_TYPES_MASK: DWORD = 0xF000; +pub const CRED_FLAGS_PASSWORD_FOR_CERT: DWORD = 0x0001; +pub const CRED_FLAGS_PROMPT_NOW: DWORD = 0x0002; +pub const CRED_FLAGS_USERNAME_TARGET: DWORD = 0x0004; +pub const CRED_FLAGS_OWF_CRED_BLOB: DWORD = 0x0008; +pub const CRED_FLAGS_REQUIRE_CONFIRMATION: DWORD = 0x0010; +pub const CRED_FLAGS_WILDCARD_MATCH: DWORD = 0x0020; +pub const CRED_FLAGS_VALID_FLAGS: DWORD = 0xF03F; +pub const CRED_FLAGS_VALID_INPUT_FLAGS: DWORD = 0xF01F; +pub const CRED_TYPE_GENERIC: DWORD = 1; +pub const CRED_TYPE_DOMAIN_PASSWORD: DWORD = 2; +pub const CRED_TYPE_DOMAIN_CERTIFICATE: DWORD = 3; +pub const CRED_TYPE_DOMAIN_VISIBLE_PASSWORD: DWORD = 4; +pub const CRED_TYPE_GENERIC_CERTIFICATE: DWORD = 5; +pub const CRED_TYPE_DOMAIN_EXTENDED: DWORD = 6; +pub const CRED_TYPE_MAXIMUM: DWORD = 7; +pub const CRED_TYPE_MAXIMUM_EX: DWORD = CRED_TYPE_MAXIMUM + 1000; +pub const CRED_MAX_CREDENTIAL_BLOB_SIZE: DWORD = 5 * 512; +pub const CRED_PERSIST_NONE: DWORD = 0; +pub const CRED_PERSIST_SESSION: DWORD = 1; +pub const CRED_PERSIST_LOCAL_MACHINE: DWORD = 2; +pub const CRED_PERSIST_ENTERPRISE: DWORD = 3; +STRUCT!{struct CREDENTIALA { + Flags: DWORD, + Type: DWORD, + TargetName: LPSTR, + Comment: LPSTR, + LastWritten: FILETIME, + CredentialBlobSize: DWORD, + CredentialBlob: LPBYTE, + Persist: DWORD, + AttributeCount: DWORD, + Attributes: PCREDENTIAL_ATTRIBUTEA, + TargetAlias: LPSTR, + UserName: LPSTR, +}} +pub type PCREDENTIALA = *mut CREDENTIALA; +STRUCT!{struct CREDENTIALW { + Flags: DWORD, + Type: DWORD, + TargetName: LPWSTR, + Comment: LPWSTR, + LastWritten: FILETIME, + CredentialBlobSize: DWORD, + CredentialBlob: LPBYTE, + Persist: DWORD, + AttributeCount: DWORD, + Attributes: PCREDENTIAL_ATTRIBUTEW, + TargetAlias: LPWSTR, + UserName: LPWSTR, +}} +pub type PCREDENTIALW = *mut CREDENTIALW; +pub const CRED_TI_SERVER_FORMAT_UNKNOWN: ULONG = 0x0001; +pub const CRED_TI_DOMAIN_FORMAT_UNKNOWN: ULONG = 0x0002; +pub const CRED_TI_ONLY_PASSWORD_REQUIRED: ULONG = 0x0004; +pub const CRED_TI_USERNAME_TARGET: ULONG = 0x0008; +pub const CRED_TI_CREATE_EXPLICIT_CRED: ULONG = 0x0010; +pub const CRED_TI_WORKGROUP_MEMBER: ULONG = 0x0020; +pub const CRED_TI_VALID_FLAGS: ULONG = 0xF07F; +STRUCT!{struct CREDENTIAL_TARGET_INFORMATIONA { + TargetName: LPSTR, + NetbiosServerName: LPSTR, + DnsServerName: LPSTR, + NetbiosDomainName: LPSTR, + DnsDomainName: LPSTR, + DnsTreeName: LPSTR, + PackageName: LPSTR, + Flags: ULONG, + CredTypeCount: DWORD, + CredTypes: LPDWORD, +}} +pub type PCREDENTIAL_TARGET_INFORMATIONA = *mut CREDENTIAL_TARGET_INFORMATIONA; +STRUCT!{struct CREDENTIAL_TARGET_INFORMATIONW { + TargetName: LPWSTR, + NetbiosServerName: LPWSTR, + DnsServerName: LPWSTR, + NetbiosDomainName: LPWSTR, + DnsDomainName: LPWSTR, + DnsTreeName: LPWSTR, + PackageName: LPWSTR, + Flags: ULONG, + CredTypeCount: DWORD, + CredTypes: LPDWORD, +}} +pub type PCREDENTIAL_TARGET_INFORMATIONW = *mut CREDENTIAL_TARGET_INFORMATIONW; +pub const CERT_HASH_LENGTH: usize = 20; +STRUCT!{struct CERT_CREDENTIAL_INFO { + cbSize: ULONG, + rgbHashOfCert: [UCHAR; CERT_HASH_LENGTH], +}} +pub type PCERT_CREDENTIAL_INFO = *mut CERT_CREDENTIAL_INFO; +STRUCT!{struct USERNAME_TARGET_CREDENTIAL_INFO { + UserName: LPWSTR, +}} +pub type PUSERNAME_TARGET_CREDENTIAL_INFO = *mut USERNAME_TARGET_CREDENTIAL_INFO; +STRUCT!{struct BINARY_BLOB_CREDENTIAL_INFO { + cbBlob: ULONG, + pbBlob: LPBYTE, +}} +pub type PBINARY_BLOB_CREDENTIAL_INFO = *mut BINARY_BLOB_CREDENTIAL_INFO; +ENUM!{enum CRED_MARSHAL_TYPE { + CertCredential = 1, + UsernameTargetCredential, + BinaryBlobCredential, + UsernameForPackedCredentials, +}} +pub type PCRED_MARSHAL_TYPE = *mut CRED_MARSHAL_TYPE; +ENUM!{enum CRED_PROTECTION_TYPE { + CredUnprotected, + CredUserProtection, + CredTrustedProtection, +}} +pub type PCRED_PROTECTION_TYPE = *mut CRED_PROTECTION_TYPE; +pub const CRED_PACK_PROTECTED_CREDENTIALS: DWORD = 0x1; +pub const CRED_PACK_WOW_BUFFER: DWORD = 0x2; +pub const CRED_PACK_GENERIC_CREDENTIALS: DWORD = 0x4; +pub const CRED_PACK_ID_PROVIDER_CREDENTIALS: DWORD = 0x8; +STRUCT!{struct CREDUI_INFOA { + cbSize: DWORD, + hwndParent: HWND, + pszMessageText: PCSTR, + pszCaptionText: PCSTR, + hbmBanner: HBITMAP, +}} +pub type PCREDUI_INFOA = *mut CREDUI_INFOA; +STRUCT!{struct CREDUI_INFOW { + cbSize: DWORD, + hwndParent: HWND, + pszMessageText: PCWSTR, + pszCaptionText: PCWSTR, + hbmBanner: HBITMAP, +}} +pub type PCREDUI_INFOW = *mut CREDUI_INFOW; +pub const CREDUI_MAX_MESSAGE_LENGTH: DWORD = 1024; +pub const CREDUI_MAX_CAPTION_LENGTH: DWORD = 128; +pub const CREDUI_MAX_GENERIC_TARGET_LENGTH: DWORD = CRED_MAX_GENERIC_TARGET_NAME_LENGTH; +pub const CREDUI_MAX_DOMAIN_TARGET_LENGTH: DWORD = CRED_MAX_DOMAIN_TARGET_NAME_LENGTH; +pub const CREDUI_MAX_USERNAME_LENGTH: DWORD = CRED_MAX_USERNAME_LENGTH; +pub const CREDUI_MAX_PASSWORD_LENGTH: DWORD = 512 / 2; +pub const CREDUI_FLAGS_INCORRECT_PASSWORD: DWORD = 0x00001; +pub const CREDUI_FLAGS_DO_NOT_PERSIST: DWORD = 0x00002; +pub const CREDUI_FLAGS_REQUEST_ADMINISTRATOR: DWORD = 0x00004; +pub const CREDUI_FLAGS_EXCLUDE_CERTIFICATES: DWORD = 0x00008; +pub const CREDUI_FLAGS_REQUIRE_CERTIFICATE: DWORD = 0x00010; +pub const CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX: DWORD = 0x00040; +pub const CREDUI_FLAGS_ALWAYS_SHOW_UI: DWORD = 0x00080; +pub const CREDUI_FLAGS_REQUIRE_SMARTCARD: DWORD = 0x00100; +pub const CREDUI_FLAGS_PASSWORD_ONLY_OK: DWORD = 0x00200; +pub const CREDUI_FLAGS_VALIDATE_USERNAME: DWORD = 0x00400; +pub const CREDUI_FLAGS_COMPLETE_USERNAME: DWORD = 0x00800; +pub const CREDUI_FLAGS_PERSIST: DWORD = 0x01000; +pub const CREDUI_FLAGS_SERVER_CREDENTIAL: DWORD = 0x04000; +pub const CREDUI_FLAGS_EXPECT_CONFIRMATION: DWORD = 0x20000; +pub const CREDUI_FLAGS_GENERIC_CREDENTIALS: DWORD = 0x40000; +pub const CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS: DWORD = 0x80000; +pub const CREDUI_FLAGS_KEEP_USERNAME: DWORD = 0x100000; +pub const CREDUI_FLAGS_PROMPT_VALID: DWORD = CREDUI_FLAGS_INCORRECT_PASSWORD + | CREDUI_FLAGS_DO_NOT_PERSIST | CREDUI_FLAGS_REQUEST_ADMINISTRATOR + | CREDUI_FLAGS_EXCLUDE_CERTIFICATES | CREDUI_FLAGS_REQUIRE_CERTIFICATE + | CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX | CREDUI_FLAGS_ALWAYS_SHOW_UI + | CREDUI_FLAGS_REQUIRE_SMARTCARD | CREDUI_FLAGS_PASSWORD_ONLY_OK + | CREDUI_FLAGS_VALIDATE_USERNAME | CREDUI_FLAGS_COMPLETE_USERNAME | CREDUI_FLAGS_PERSIST + | CREDUI_FLAGS_SERVER_CREDENTIAL | CREDUI_FLAGS_EXPECT_CONFIRMATION + | CREDUI_FLAGS_GENERIC_CREDENTIALS | CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS + | CREDUI_FLAGS_KEEP_USERNAME; +pub const CREDUIWIN_GENERIC: DWORD = 0x00000001; +pub const CREDUIWIN_CHECKBOX: DWORD = 0x00000002; +pub const CREDUIWIN_AUTHPACKAGE_ONLY: DWORD = 0x00000010; +pub const CREDUIWIN_IN_CRED_ONLY: DWORD = 0x00000020; +pub const CREDUIWIN_ENUMERATE_ADMINS: DWORD = 0x00000100; +pub const CREDUIWIN_ENUMERATE_CURRENT_USER: DWORD = 0x00000200; +pub const CREDUIWIN_SECURE_PROMPT: DWORD = 0x00001000; +pub const CREDUIWIN_PREPROMPTING: DWORD = 0x00002000; +pub const CREDUIWIN_PACK_32_WOW: DWORD = 0x10000000; +pub const CREDUIWIN_VALID_FLAGS: DWORD = CREDUIWIN_GENERIC | CREDUIWIN_CHECKBOX + | CREDUIWIN_AUTHPACKAGE_ONLY | CREDUIWIN_IN_CRED_ONLY | CREDUIWIN_ENUMERATE_ADMINS + | CREDUIWIN_ENUMERATE_CURRENT_USER | CREDUIWIN_SECURE_PROMPT | CREDUIWIN_PREPROMPTING + | CREDUIWIN_PACK_32_WOW; +pub const CRED_PRESERVE_CREDENTIAL_BLOB: DWORD = 0x1; +extern "system" { + pub fn CredWriteW( + Credential: PCREDENTIALW, + Flags: DWORD, + ) -> BOOL; + pub fn CredWriteA( + Credential: PCREDENTIALA, + Flags: DWORD, + ) -> BOOL; + pub fn CredReadW( + TargetName: LPCWSTR, + Type: DWORD, + Flags: DWORD, + Credential: *mut PCREDENTIALW, + ) -> BOOL; + pub fn CredReadA( + TargetName: LPCSTR, + Type: DWORD, + Flags: DWORD, + Credential: *mut PCREDENTIALA, + ) -> BOOL; +} +pub const CRED_ENUMERATE_ALL_CREDENTIALS: DWORD = 0x1; +extern "system" { + // pub fn CredEnumerateW(); + // pub fn CredEnumerateA(); + // pub fn CredWriteDomainCredentialsW(); + // pub fn CredWriteDomainCredentialsA(); +} +pub const CRED_CACHE_TARGET_INFORMATION: DWORD = 0x1; +extern "system" { + // pub fn CredReadDomainCredentialsW(); + // pub fn CredReadDomainCredentialsA(); + pub fn CredDeleteW( + TargetName: LPCWSTR, + Type: DWORD, + Flags: DWORD, + ) -> BOOL; + pub fn CredDeleteA( + TargetName: LPCSTR, + Type: DWORD, + Flags: DWORD, + ) -> BOOL; + // pub fn CredRenameW(); + // pub fn CredRenameA(); +} +pub const CRED_ALLOW_NAME_RESOLUTION: DWORD = 0x1; +extern "system" { + // pub fn CredGetTargetInfoW(); + // pub fn CredGetTargetInfoA(); + // pub fn CredMarshalCredentialW(); + // pub fn CredMarshalCredentialA(); + // pub fn CredUnmarshalCredentialW(); + // pub fn CredUnmarshalCredentialA(); + // pub fn CredIsMarshaledCredentialW(); + // pub fn CredIsMarshaledCredentialA(); + pub fn CredUnPackAuthenticationBufferW( + dwFlags: DWORD, + pAuthBuffer: PVOID, + cbAuthBuffer: DWORD, + pszUserName: LPWSTR, + pcchlMaxUserName: *mut DWORD, + pszDomainName: LPWSTR, + pcchMaxDomainName: *mut DWORD, + pszPassword: LPWSTR, + pcchMaxPassword: *mut DWORD, + ) -> BOOL; + pub fn CredUnPackAuthenticationBufferA( + dwFlags: DWORD, + pAuthBuffer: PVOID, + cbAuthBuffer: DWORD, + pszUserName: LPSTR, + pcchlMaxUserName: *mut DWORD, + pszDomainName: LPSTR, + pcchMaxDomainName: *mut DWORD, + pszPassword: LPSTR, + pcchMaxPassword: *mut DWORD, + ) -> BOOL; + pub fn CredPackAuthenticationBufferW( + dwFlags: DWORD, + pszUserName: LPWSTR, + pszPassword: LPWSTR, + pPackedCredentials: PBYTE, + pcbPackedCredentials: *mut DWORD, + ) -> BOOL; + pub fn CredPackAuthenticationBufferA( + dwFlags: DWORD, + pszUserName: LPSTR, + pszPassword: LPSTR, + pPackedCredentials: PBYTE, + pcbPackedCredentials: *mut DWORD, + ) -> BOOL; + // pub fn CredProtectW(); + // pub fn CredProtectA(); + // pub fn CredUnprotectW(); + // pub fn CredUnprotectA(); + // pub fn CredIsProtectedW(); + // pub fn CredIsProtectedA(); + // pub fn CredFindBestCredentialW(); + // pub fn CredFindBestCredentialA(); + // pub fn CredGetSessionTypes(); + pub fn CredFree( + Buffer: PVOID, + ); + pub fn CredUIPromptForCredentialsW( + pUiInfo: PCREDUI_INFOW, + pszTargetName: PCWSTR, + pContext: PCtxtHandle, + dwAuthError: DWORD, + pszUserName: PWSTR, + ulUserNameBufferSize: ULONG, + pszPassword: PWSTR, + ulPasswordBufferSize: ULONG, + save: *mut BOOL, + dwFlags: DWORD, + ) -> DWORD; + pub fn CredUIPromptForCredentialsA( + pUiInfo: PCREDUI_INFOA, + pszTargetName: PCSTR, + pContext: PCtxtHandle, + dwAuthError: DWORD, + pszUserName: PSTR, + ulUserNameBufferSize: ULONG, + pszPassword: PSTR, + ulPasswordBufferSize: ULONG, + save: *mut BOOL, + dwFlags: DWORD, + ) -> DWORD; + pub fn CredUIPromptForWindowsCredentialsW( + pUiInfo: PCREDUI_INFOW, + dwAuthError: DWORD, + pulAuthPackage: *mut ULONG, + pvInAuthBuffer: LPCVOID, + ulInAuthBufferSize: ULONG, + ppvOutAuthBuffer: *mut LPVOID, + pulOutAuthBufferSize: *mut ULONG, + pfSave: *mut BOOL, + dwFlags: DWORD, + ) -> DWORD; + pub fn CredUIPromptForWindowsCredentialsA( + pUiInfo: PCREDUI_INFOA, + dwAuthError: DWORD, + pulAuthPackage: *mut ULONG, + pvInAuthBuffer: LPCVOID, + ulInAuthBufferSize: ULONG, + ppvOutAuthBuffer: *mut LPVOID, + pulOutAuthBufferSize: *mut ULONG, + pfSave: *mut BOOL, + dwFlags: DWORD, + ) -> DWORD; + pub fn CredUIParseUserNameW( + userName: PCWSTR, + user: *mut WCHAR, + userBufferSize: ULONG, + domain: *mut WCHAR, + domainBufferSize: ULONG, + ) -> DWORD; + pub fn CredUIParseUserNameA( + userName: PCSTR, + user: *mut CHAR, + userBufferSize: ULONG, + domain: *mut CHAR, + domainBufferSize: ULONG, + ) -> DWORD; + pub fn CredUICmdLinePromptForCredentialsW( + pszTargetName: PCWSTR, + pContext: PCtxtHandle, + dwAuthError: DWORD, + UserName: PWSTR, + ulUserBufferSize: ULONG, + pszPassword: PWSTR, + ulPasswordBufferSize: ULONG, + pfSave: PBOOL, + dwFlags: DWORD, + ) -> DWORD; + pub fn CredUICmdLinePromptForCredentialsA( + pszTargetName: PCSTR, + pContext: PCtxtHandle, + dwAuthError: DWORD, + UserName: PSTR, + ulUserBufferSize: ULONG, + pszPassword: PSTR, + ulPasswordBufferSize: ULONG, + pfSave: PBOOL, + dwFlags: DWORD, + ) -> DWORD; + pub fn CredUIConfirmCredentialsW( + pszTargetName: PCWSTR, + bConfirm: BOOL, + ) -> DWORD; + pub fn CredUIConfirmCredentialsA( + pszTargetName: PCSTR, + bConfirm: BOOL, + ) -> DWORD; + pub fn CredUIStoreSSOCredW( + pszRealm: PCWSTR, + pszUsername: PCWSTR, + pszPassword: PCWSTR, + bPersist: BOOL, + ) -> DWORD; + pub fn CredUIReadSSOCredW( + pszRealm: PCWSTR, + ppszUsername: *mut PWSTR, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/wincrypt.rs b/src/vendor/winapi/src/um/wincrypt.rs new file mode 100644 index 0000000000..eefc033601 --- /dev/null +++ b/src/vendor/winapi/src/um/wincrypt.rs @@ -0,0 +1,7365 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Cryptographic API Prototypes and Definitions +use ctypes::{c_int, c_uchar, c_uint, c_void}; +use shared::basetsd::ULONG_PTR; +use shared::bcrypt::BCRYPT_KEY_HANDLE; +use shared::guiddef::{GUID, LPCGUID}; +use shared::minwindef::{ + BOOL, BYTE, DWORD, FALSE, FILETIME, HKEY, HMODULE, LPFILETIME, LPVOID, PBYTE, PDWORD, + PFILETIME, TRUE, ULONG, WORD, +}; +use um::minwinbase::PSYSTEMTIME; +use um::ncrypt::NCRYPT_KEY_HANDLE; +use um::winnt::{ + CHAR, HANDLE, HRESULT, LONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCWSTR, PVOID, PWSTR, WCHAR, +}; +use vc::vcruntime::size_t; +//108 +#[inline] +pub fn GET_ALG_CLASS(x: ALG_ID) -> ALG_ID { + x & (7 << 13) +} +#[inline] +pub fn GET_ALG_TYPE(x: ALG_ID) -> ALG_ID { + x & (15 << 9) +} +#[inline] +pub fn GET_ALG_SID(x: ALG_ID) -> ALG_ID { + x & 511 +} +pub const ALG_CLASS_ANY: ALG_ID = 0; +pub const ALG_CLASS_SIGNATURE: ALG_ID = 1 << 13; +pub const ALG_CLASS_MSG_ENCRYPT: ALG_ID = 2 << 13; +pub const ALG_CLASS_DATA_ENCRYPT: ALG_ID = 3 << 13; +pub const ALG_CLASS_HASH: ALG_ID = 4 << 13; +pub const ALG_CLASS_KEY_EXCHANGE: ALG_ID = 5 << 13; +pub const ALG_CLASS_ALL: ALG_ID = 7 << 13; +pub const ALG_TYPE_ANY: ALG_ID = 0; +pub const ALG_TYPE_DSS: ALG_ID = 1 << 9; +pub const ALG_TYPE_RSA: ALG_ID = 2 << 9; +pub const ALG_TYPE_BLOCK: ALG_ID = 3 << 9; +pub const ALG_TYPE_STREAM: ALG_ID = 4 << 9; +pub const ALG_TYPE_DH: ALG_ID = 5 << 9; +pub const ALG_TYPE_SECURECHANNEL: ALG_ID = 6 << 9; +pub const ALG_TYPE_ECDH: ALG_ID = 7 << 9; +pub const ALG_TYPE_THIRDPARTY: ALG_ID = 8 << 9; +pub const ALG_SID_ANY: ALG_ID = 0; +pub const ALG_SID_THIRDPARTY_ANY: ALG_ID = 0; +pub const ALG_SID_RSA_ANY: ALG_ID = 0; +pub const ALG_SID_RSA_PKCS: ALG_ID = 1; +pub const ALG_SID_RSA_MSATWORK: ALG_ID = 2; +pub const ALG_SID_RSA_ENTRUST: ALG_ID = 3; +pub const ALG_SID_RSA_PGP: ALG_ID = 4; +pub const ALG_SID_DSS_ANY: ALG_ID = 0; +pub const ALG_SID_DSS_PKCS: ALG_ID = 1; +pub const ALG_SID_DSS_DMS: ALG_ID = 2; +pub const ALG_SID_ECDSA: ALG_ID = 3; +pub const ALG_SID_DES: ALG_ID = 1; +pub const ALG_SID_3DES: ALG_ID = 3; +pub const ALG_SID_DESX: ALG_ID = 4; +pub const ALG_SID_IDEA: ALG_ID = 5; +pub const ALG_SID_CAST: ALG_ID = 6; +pub const ALG_SID_SAFERSK64: ALG_ID = 7; +pub const ALG_SID_SAFERSK128: ALG_ID = 8; +pub const ALG_SID_3DES_112: ALG_ID = 9; +pub const ALG_SID_CYLINK_MEK: ALG_ID = 12; +pub const ALG_SID_RC5: ALG_ID = 13; +pub const ALG_SID_AES_128: ALG_ID = 14; +pub const ALG_SID_AES_192: ALG_ID = 15; +pub const ALG_SID_AES_256: ALG_ID = 16; +pub const ALG_SID_AES: ALG_ID = 17; +pub const ALG_SID_SKIPJACK: ALG_ID = 10; +pub const ALG_SID_TEK: ALG_ID = 11; +pub const CRYPT_MODE_CBCI: ALG_ID = 6; +pub const CRYPT_MODE_CFBP: ALG_ID = 7; +pub const CRYPT_MODE_OFBP: ALG_ID = 8; +pub const CRYPT_MODE_CBCOFM: ALG_ID = 9; +pub const CRYPT_MODE_CBCOFMI: ALG_ID = 10; +pub const ALG_SID_RC2: ALG_ID = 2; +pub const ALG_SID_RC4: ALG_ID = 1; +pub const ALG_SID_SEAL: ALG_ID = 2; +pub const ALG_SID_DH_SANDF: ALG_ID = 1; +pub const ALG_SID_DH_EPHEM: ALG_ID = 2; +pub const ALG_SID_AGREED_KEY_ANY: ALG_ID = 3; +pub const ALG_SID_KEA: ALG_ID = 4; +pub const ALG_SID_ECDH: ALG_ID = 5; +pub const ALG_SID_ECDH_EPHEM: ALG_ID = 6; +pub const ALG_SID_MD2: ALG_ID = 1; +pub const ALG_SID_MD4: ALG_ID = 2; +pub const ALG_SID_MD5: ALG_ID = 3; +pub const ALG_SID_SHA: ALG_ID = 4; +pub const ALG_SID_SHA1: ALG_ID = 4; +pub const ALG_SID_MAC: ALG_ID = 5; +pub const ALG_SID_RIPEMD: ALG_ID = 6; +pub const ALG_SID_RIPEMD160: ALG_ID = 7; +pub const ALG_SID_SSL3SHAMD5: ALG_ID = 8; +pub const ALG_SID_HMAC: ALG_ID = 9; +pub const ALG_SID_TLS1PRF: ALG_ID = 10; +pub const ALG_SID_HASH_REPLACE_OWF: ALG_ID = 11; +pub const ALG_SID_SHA_256: ALG_ID = 12; +pub const ALG_SID_SHA_384: ALG_ID = 13; +pub const ALG_SID_SHA_512: ALG_ID = 14; +pub const ALG_SID_SSL3_MASTER: ALG_ID = 1; +pub const ALG_SID_SCHANNEL_MASTER_HASH: ALG_ID = 2; +pub const ALG_SID_SCHANNEL_MAC_KEY: ALG_ID = 3; +pub const ALG_SID_PCT1_MASTER: ALG_ID = 4; +pub const ALG_SID_SSL2_MASTER: ALG_ID = 5; +pub const ALG_SID_TLS1_MASTER: ALG_ID = 6; +pub const ALG_SID_SCHANNEL_ENC_KEY: ALG_ID = 7; +pub const ALG_SID_ECMQV: ALG_ID = 1; +pub const ALG_SID_EXAMPLE: ALG_ID = 80; +pub type ALG_ID = c_uint; +pub const CALG_MD2: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2; +pub const CALG_MD4: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4; +pub const CALG_MD5: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5; +pub const CALG_SHA: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA; +pub const CALG_SHA1: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA1; +pub const CALG_MAC: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC; +pub const CALG_RSA_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY; +pub const CALG_DSS_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY; +pub const CALG_NO_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_ANY | ALG_SID_ANY; +pub const CALG_RSA_KEYX: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY; +pub const CALG_DES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES; +pub const CALG_3DES_112: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112; +pub const CALG_3DES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES; +pub const CALG_DESX: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DESX; +pub const CALG_RC2: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2; +pub const CALG_RC4: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4; +pub const CALG_SEAL: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL; +pub const CALG_DH_SF: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF; +pub const CALG_DH_EPHEM: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM; +pub const CALG_AGREEDKEY_ANY: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH + | ALG_SID_AGREED_KEY_ANY; +pub const CALG_KEA_KEYX: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_KEA; +pub const CALG_HUGHES_MD5: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_MD5; +pub const CALG_SKIPJACK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_SKIPJACK; +pub const CALG_TEK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_TEK; +pub const CALG_CYLINK_MEK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_CYLINK_MEK; +pub const CALG_SSL3_SHAMD5: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5; +pub const CALG_SSL3_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SSL3_MASTER; +pub const CALG_SCHANNEL_MASTER_HASH: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SCHANNEL_MASTER_HASH; +pub const CALG_SCHANNEL_MAC_KEY: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SCHANNEL_MAC_KEY; +pub const CALG_SCHANNEL_ENC_KEY: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SCHANNEL_ENC_KEY; +pub const CALG_PCT1_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_PCT1_MASTER; +pub const CALG_SSL2_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_SSL2_MASTER; +pub const CALG_TLS1_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL + | ALG_SID_TLS1_MASTER; +pub const CALG_RC5: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC5; +pub const CALG_HMAC: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC; +pub const CALG_TLS1PRF: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF; +pub const CALG_HASH_REPLACE_OWF: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HASH_REPLACE_OWF; +pub const CALG_AES_128: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_128; +pub const CALG_AES_192: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_192; +pub const CALG_AES_256: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_256; +pub const CALG_AES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES; +pub const CALG_SHA_256: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256; +pub const CALG_SHA_384: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384; +pub const CALG_SHA_512: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512; +pub const CALG_ECDH: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_ECDH; +pub const CALG_ECDH_EPHEM: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ECDH | ALG_SID_ECDH_EPHEM; +pub const CALG_ECMQV: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_ECMQV; +pub const CALG_ECDSA: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_ECDSA; +pub const CALG_NULLCIPHER: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_ANY | 0; +pub const CALG_THIRDPARTY_KEY_EXCHANGE: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_THIRDPARTY + | ALG_SID_THIRDPARTY_ANY; +pub const CALG_THIRDPARTY_SIGNATURE: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_THIRDPARTY + | ALG_SID_THIRDPARTY_ANY; +pub const CALG_THIRDPARTY_CIPHER: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_THIRDPARTY + | ALG_SID_THIRDPARTY_ANY; +pub const CALG_THIRDPARTY_HASH: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_THIRDPARTY + | ALG_SID_THIRDPARTY_ANY; +pub type HCRYPTPROV = ULONG_PTR; +pub type HCRYPTKEY = ULONG_PTR; +pub type HCRYPTHASH = ULONG_PTR; +pub const CRYPT_VERIFYCONTEXT: DWORD = 0xF0000000; +pub const CRYPT_NEWKEYSET: DWORD = 0x00000008; +pub const CRYPT_DELETEKEYSET: DWORD = 0x00000010; +pub const CRYPT_MACHINE_KEYSET: DWORD = 0x00000020; +pub const CRYPT_SILENT: DWORD = 0x00000040; +pub const CRYPT_DEFAULT_CONTAINER_OPTIONAL: DWORD = 0x00000080; +pub const CRYPT_EXPORTABLE: DWORD = 0x00000001; +pub const CRYPT_USER_PROTECTED: DWORD = 0x00000002; +pub const CRYPT_CREATE_SALT: DWORD = 0x00000004; +pub const CRYPT_UPDATE_KEY: DWORD = 0x00000008; +pub const CRYPT_NO_SALT: DWORD = 0x00000010; +pub const CRYPT_PREGEN: DWORD = 0x00000040; +pub const CRYPT_RECIPIENT: DWORD = 0x00000010; +pub const CRYPT_INITIATOR: DWORD = 0x00000040; +pub const CRYPT_ONLINE: DWORD = 0x00000080; +pub const CRYPT_SF: DWORD = 0x00000100; +pub const CRYPT_CREATE_IV: DWORD = 0x00000200; +pub const CRYPT_KEK: DWORD = 0x00000400; +pub const CRYPT_DATA_KEY: DWORD = 0x00000800; +pub const CRYPT_VOLATILE: DWORD = 0x00001000; +pub const CRYPT_SGCKEY: DWORD = 0x00002000; +pub const CRYPT_USER_PROTECTED_STRONG: DWORD = 0x00100000; +pub const CRYPT_ARCHIVABLE: DWORD = 0x00004000; +pub const CRYPT_FORCE_KEY_PROTECTION_HIGH: DWORD = 0x00008000; +pub const RSA1024BIT_KEY: DWORD = 0x04000000; +pub const CRYPT_SERVER: DWORD = 0x00000400; +pub const KEY_LENGTH_MASK: DWORD = 0xFFFF0000; +pub const CRYPT_Y_ONLY: DWORD = 0x00000001; +pub const CRYPT_SSL2_FALLBACK: DWORD = 0x00000002; +pub const CRYPT_DESTROYKEY: DWORD = 0x00000004; +pub const CRYPT_OAEP: DWORD = 0x00000040; +pub const CRYPT_BLOB_VER3: DWORD = 0x00000080; +pub const CRYPT_IPSEC_HMAC_KEY: DWORD = 0x00000100; +pub const CRYPT_DECRYPT_RSA_NO_PADDING_CHECK: DWORD = 0x00000020; +pub const CRYPT_SECRETDIGEST: DWORD = 0x00000001; +pub const CRYPT_OWF_REPL_LM_HASH: DWORD = 0x00000001; +pub const CRYPT_LITTLE_ENDIAN: DWORD = 0x00000001; +pub const CRYPT_NOHASHOID: DWORD = 0x00000001; +pub const CRYPT_TYPE2_FORMAT: DWORD = 0x00000002; +pub const CRYPT_X931_FORMAT: DWORD = 0x00000004; +pub const CRYPT_MACHINE_DEFAULT: DWORD = 0x00000001; +pub const CRYPT_USER_DEFAULT: DWORD = 0x00000002; +pub const CRYPT_DELETE_DEFAULT: DWORD = 0x00000004; +pub const SIMPLEBLOB: DWORD = 0x1; +pub const PUBLICKEYBLOB: DWORD = 0x6; +pub const PRIVATEKEYBLOB: DWORD = 0x7; +pub const PLAINTEXTKEYBLOB: DWORD = 0x8; +pub const OPAQUEKEYBLOB: DWORD = 0x9; +pub const PUBLICKEYBLOBEX: DWORD = 0xA; +pub const SYMMETRICWRAPKEYBLOB: DWORD = 0xB; +pub const KEYSTATEBLOB: DWORD = 0xC; +pub const AT_KEYEXCHANGE: DWORD = 1; +pub const AT_SIGNATURE: DWORD = 2; +pub const CRYPT_USERDATA: DWORD = 1; +pub const KP_IV: DWORD = 1; +pub const KP_SALT: DWORD = 2; +pub const KP_PADDING: DWORD = 3; +pub const KP_MODE: DWORD = 4; +pub const KP_MODE_BITS: DWORD = 5; +pub const KP_PERMISSIONS: DWORD = 6; +pub const KP_ALGID: DWORD = 7; +pub const KP_BLOCKLEN: DWORD = 8; +pub const KP_KEYLEN: DWORD = 9; +pub const KP_SALT_EX: DWORD = 10; +pub const KP_P: DWORD = 11; +pub const KP_G: DWORD = 12; +pub const KP_Q: DWORD = 13; +pub const KP_X: DWORD = 14; +pub const KP_Y: DWORD = 15; +pub const KP_RA: DWORD = 16; +pub const KP_RB: DWORD = 17; +pub const KP_INFO: DWORD = 18; +pub const KP_EFFECTIVE_KEYLEN: DWORD = 19; +pub const KP_SCHANNEL_ALG: DWORD = 20; +pub const KP_CLIENT_RANDOM: DWORD = 21; +pub const KP_SERVER_RANDOM: DWORD = 22; +pub const KP_RP: DWORD = 23; +pub const KP_PRECOMP_MD5: DWORD = 24; +pub const KP_PRECOMP_SHA: DWORD = 25; +pub const KP_CERTIFICATE: DWORD = 26; +pub const KP_CLEAR_KEY: DWORD = 27; +pub const KP_PUB_EX_LEN: DWORD = 28; +pub const KP_PUB_EX_VAL: DWORD = 29; +pub const KP_KEYVAL: DWORD = 30; +pub const KP_ADMIN_PIN: DWORD = 31; +pub const KP_KEYEXCHANGE_PIN: DWORD = 32; +pub const KP_SIGNATURE_PIN: DWORD = 33; +pub const KP_PREHASH: DWORD = 34; +pub const KP_ROUNDS: DWORD = 35; +pub const KP_OAEP_PARAMS: DWORD = 36; +pub const KP_CMS_KEY_INFO: DWORD = 37; +pub const KP_CMS_DH_KEY_INFO: DWORD = 38; +pub const KP_PUB_PARAMS: DWORD = 39; +pub const KP_VERIFY_PARAMS: DWORD = 40; +pub const KP_HIGHEST_VERSION: DWORD = 41; +pub const KP_GET_USE_COUNT: DWORD = 42; +pub const KP_PIN_ID: DWORD = 43; +pub const KP_PIN_INFO: DWORD = 44; +pub const PKCS5_PADDING: DWORD = 1; +pub const RANDOM_PADDING: DWORD = 2; +pub const ZERO_PADDING: DWORD = 3; +pub const CRYPT_MODE_CBC: DWORD = 1; +pub const CRYPT_MODE_ECB: DWORD = 2; +pub const CRYPT_MODE_OFB: DWORD = 3; +pub const CRYPT_MODE_CFB: DWORD = 4; +pub const CRYPT_MODE_CTS: DWORD = 5; +pub const CRYPT_ENCRYPT: DWORD = 0x0001; +pub const CRYPT_DECRYPT: DWORD = 0x0002; +pub const CRYPT_EXPORT: DWORD = 0x0004; +pub const CRYPT_READ: DWORD = 0x0008; +pub const CRYPT_WRITE: DWORD = 0x0010; +pub const CRYPT_MAC: DWORD = 0x0020; +pub const CRYPT_EXPORT_KEY: DWORD = 0x0040; +pub const CRYPT_IMPORT_KEY: DWORD = 0x0080; +pub const CRYPT_ARCHIVE: DWORD = 0x0100; +pub const HP_ALGID: DWORD = 0x0001; +pub const HP_HASHVAL: DWORD = 0x0002; +pub const HP_HASHSIZE: DWORD = 0x0004; +pub const HP_HMAC_INFO: DWORD = 0x0005; +pub const HP_TLS1PRF_LABEL: DWORD = 0x0006; +pub const HP_TLS1PRF_SEED: DWORD = 0x0007; +pub const CRYPT_FAILED: BOOL = FALSE; +pub const CRYPT_SUCCEED: BOOL = TRUE; +#[inline] +pub fn RCRYPT_SUCCEEDED(rt: BOOL) -> bool { + rt == CRYPT_SUCCEED +} +#[inline] +pub fn RCRYPT_FAILED(rt: BOOL) -> bool { + rt == CRYPT_FAILED +} +pub const PP_ENUMALGS: DWORD = 1; +pub const PP_ENUMCONTAINERS: DWORD = 2; +pub const PP_IMPTYPE: DWORD = 3; +pub const PP_NAME: DWORD = 4; +pub const PP_VERSION: DWORD = 5; +pub const PP_CONTAINER: DWORD = 6; +pub const PP_CHANGE_PASSWORD: DWORD = 7; +pub const PP_KEYSET_SEC_DESCR: DWORD = 8; +pub const PP_CERTCHAIN: DWORD = 9; +pub const PP_KEY_TYPE_SUBTYPE: DWORD = 10; +pub const PP_PROVTYPE: DWORD = 16; +pub const PP_KEYSTORAGE: DWORD = 17; +pub const PP_APPLI_CERT: DWORD = 18; +pub const PP_SYM_KEYSIZE: DWORD = 19; +pub const PP_SESSION_KEYSIZE: DWORD = 20; +pub const PP_UI_PROMPT: DWORD = 21; +pub const PP_ENUMALGS_EX: DWORD = 22; +pub const PP_ENUMMANDROOTS: DWORD = 25; +pub const PP_ENUMELECTROOTS: DWORD = 26; +pub const PP_KEYSET_TYPE: DWORD = 27; +pub const PP_ADMIN_PIN: DWORD = 31; +pub const PP_KEYEXCHANGE_PIN: DWORD = 32; +pub const PP_SIGNATURE_PIN: DWORD = 33; +pub const PP_SIG_KEYSIZE_INC: DWORD = 34; +pub const PP_KEYX_KEYSIZE_INC: DWORD = 35; +pub const PP_UNIQUE_CONTAINER: DWORD = 36; +pub const PP_SGC_INFO: DWORD = 37; +pub const PP_USE_HARDWARE_RNG: DWORD = 38; +pub const PP_KEYSPEC: DWORD = 39; +pub const PP_ENUMEX_SIGNING_PROT: DWORD = 40; +pub const PP_CRYPT_COUNT_KEY_USE: DWORD = 41; +pub const PP_USER_CERTSTORE: DWORD = 42; +pub const PP_SMARTCARD_READER: DWORD = 43; +pub const PP_SMARTCARD_GUID: DWORD = 45; +pub const PP_ROOT_CERTSTORE: DWORD = 46; +pub const PP_SMARTCARD_READER_ICON: DWORD = 47; +pub const CRYPT_FIRST: DWORD = 1; +pub const CRYPT_NEXT: DWORD = 2; +pub const CRYPT_SGC_ENUM: DWORD = 4; +pub const CRYPT_IMPL_HARDWARE: DWORD = 1; +pub const CRYPT_IMPL_SOFTWARE: DWORD = 2; +pub const CRYPT_IMPL_MIXED: DWORD = 3; +pub const CRYPT_IMPL_UNKNOWN: DWORD = 4; +pub const CRYPT_IMPL_REMOVABLE: DWORD = 8; +pub const CRYPT_SEC_DESCR: DWORD = 0x00000001; +pub const CRYPT_PSTORE: DWORD = 0x00000002; +pub const CRYPT_UI_PROMPT: DWORD = 0x00000004; +pub const CRYPT_FLAG_PCT1: DWORD = 0x0001; +pub const CRYPT_FLAG_SSL2: DWORD = 0x0002; +pub const CRYPT_FLAG_SSL3: DWORD = 0x0004; +pub const CRYPT_FLAG_TLS1: DWORD = 0x0008; +pub const CRYPT_FLAG_IPSEC: DWORD = 0x0010; +pub const CRYPT_FLAG_SIGNING: DWORD = 0x0020; +pub const CRYPT_SGC: DWORD = 0x0001; +pub const CRYPT_FASTSGC: DWORD = 0x0002; +pub const PP_CLIENT_HWND: DWORD = 1; +pub const PP_CONTEXT_INFO: DWORD = 11; +pub const PP_KEYEXCHANGE_KEYSIZE: DWORD = 12; +pub const PP_SIGNATURE_KEYSIZE: DWORD = 13; +pub const PP_KEYEXCHANGE_ALG: DWORD = 14; +pub const PP_SIGNATURE_ALG: DWORD = 15; +pub const PP_DELETEKEY: DWORD = 24; +pub const PP_PIN_PROMPT_STRING: DWORD = 44; +pub const PP_SECURE_KEYEXCHANGE_PIN: DWORD = 47; +pub const PP_SECURE_SIGNATURE_PIN: DWORD = 48; +pub const PROV_RSA_FULL: DWORD = 1; +pub const PROV_RSA_SIG: DWORD = 2; +pub const PROV_DSS: DWORD = 3; +pub const PROV_FORTEZZA: DWORD = 4; +pub const PROV_MS_EXCHANGE: DWORD = 5; +pub const PROV_SSL: DWORD = 6; +pub const PROV_RSA_SCHANNEL: DWORD = 12; +pub const PROV_DSS_DH: DWORD = 13; +pub const PROV_EC_ECDSA_SIG: DWORD = 14; +pub const PROV_EC_ECNRA_SIG: DWORD = 15; +pub const PROV_EC_ECDSA_FULL: DWORD = 16; +pub const PROV_EC_ECNRA_FULL: DWORD = 17; +pub const PROV_DH_SCHANNEL: DWORD = 18; +pub const PROV_SPYRUS_LYNKS: DWORD = 20; +pub const PROV_RNG: DWORD = 21; +pub const PROV_INTEL_SEC: DWORD = 22; +pub const PROV_REPLACE_OWF: DWORD = 23; +pub const PROV_RSA_AES: DWORD = 24; +pub const MS_DEF_PROV: &'static str = "Microsoft Base Cryptographic Provider v1.0"; +pub const MS_ENHANCED_PROV: &'static str = "Microsoft Enhanced Cryptographic Provider v1.0"; +pub const MS_STRONG_PROV: &'static str = "Microsoft Strong Cryptographic Provider"; +pub const MS_DEF_RSA_SIG_PROV: &'static str = "Microsoft RSA Signature Cryptographic Provider"; +pub const MS_DEF_RSA_SCHANNEL_PROV: &'static str = "Microsoft RSA SChannel Cryptographic Provider"; +pub const MS_DEF_DSS_PROV: &'static str = "Microsoft Base DSS Cryptographic Provider"; +pub const MS_DEF_DSS_DH_PROV: &'static str + = "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"; +pub const MS_ENH_DSS_DH_PROV: &'static str + = "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"; +pub const MS_DEF_DH_SCHANNEL_PROV: &'static str = "Microsoft DH SChannel Cryptographic Provider"; +pub const MS_SCARD_PROV: &'static str = "Microsoft Base Smart Card Crypto Provider"; +pub const MS_ENH_RSA_AES_PROV: &'static str + = "Microsoft Enhanced RSA and AES Cryptographic Provider"; +pub const MS_ENH_RSA_AES_PROV_XP: &'static str + = "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"; +pub const MAXUIDLEN: usize = 64; +pub const EXPO_OFFLOAD_REG_VALUE: &'static str = "ExpoOffload"; +pub const EXPO_OFFLOAD_FUNC_NAME: &'static str = "OffloadModExpo"; +pub const szKEY_CRYPTOAPI_PRIVATE_KEY_OPTIONS: &'static str + = "Software\\Policies\\Microsoft\\Cryptography"; +pub const szKEY_CACHE_ENABLED: &'static str = "CachePrivateKeys"; +pub const szKEY_CACHE_SECONDS: &'static str = "PrivateKeyLifetimeSeconds"; +pub const szPRIV_KEY_CACHE_MAX_ITEMS: &'static str = "PrivKeyCacheMaxItems"; +pub const cPRIV_KEY_CACHE_MAX_ITEMS_DEFAULT: DWORD = 20; +pub const szPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS: &'static str + = "PrivKeyCachePurgeIntervalSeconds"; +pub const cPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS_DEFAULT: DWORD = 86400; +pub const CUR_BLOB_VERSION: DWORD = 2; +STRUCT!{struct CMS_KEY_INFO { + dwVersion: DWORD, + Algid: ALG_ID, + pbOID: *mut BYTE, + cbOID: DWORD, +}} +pub type PCMS_KEY_INFO = *mut CMS_KEY_INFO; +STRUCT!{struct HMAC_INFO { + HashAlgid: ALG_ID, + pbInnerString: *mut BYTE, + cbInnerString: DWORD, + pbOuterString: *mut BYTE, + cbOuterString: DWORD, +}} +pub type PHMAC_INFO = *mut HMAC_INFO; +STRUCT!{struct SCHANNEL_ALG { + dwUse: DWORD, + Algid: ALG_ID, + cBits: DWORD, + dwFlags: DWORD, + dwReserved: DWORD, +}} +pub type PSCHANNEL_ALG = *mut SCHANNEL_ALG; +pub const SCHANNEL_MAC_KEY: DWORD = 0x00000000; +pub const SCHANNEL_ENC_KEY: DWORD = 0x00000001; +pub const INTERNATIONAL_USAGE: DWORD = 0x00000001; +STRUCT!{struct PROV_ENUMALGS { + aiAlgid: ALG_ID, + dwBitLen: DWORD, + dwNameLen: DWORD, + szName: [CHAR; 20], +}} +STRUCT!{struct PROV_ENUMALGS_EX { + aiAlgid: ALG_ID, + dwDefaultLen: DWORD, + dwMinLen: DWORD, + dwMaxLen: DWORD, + dwProtocols: DWORD, + dwNameLen: DWORD, + szName: [CHAR; 20], + dwLongNameLen: DWORD, + szLongName: [CHAR; 40], +}} +STRUCT!{struct BLOBHEADER { + bType: BYTE, + bVersion: BYTE, + reserved: WORD, + aiKeyAlg: ALG_ID, +}} +pub type PUBLICKEYSTRUC = BLOBHEADER; +STRUCT!{struct RSAPUBKEY { + magic: DWORD, + bitlen: DWORD, + pubexp: DWORD, +}} +STRUCT!{struct DHPUBKEY { + magic: DWORD, + bitlen: DWORD, +}} +pub type DSSPUBKEY = DHPUBKEY; +pub type KEAPUBKEY = DHPUBKEY; +pub type TEKPUBKEY = DHPUBKEY; +STRUCT!{struct DSSSEED { + counter: DWORD, + seed: [BYTE; 20], +}} +STRUCT!{struct DHPUBKEY_VER3 { + magic: DWORD, + bitlenP: DWORD, + bitlenQ: DWORD, + bitlenJ: DWORD, + DSSSeed: DSSSEED, +}} +pub type DSSPUBKEY_VER3 = DHPUBKEY_VER3; +STRUCT!{struct DHPRIVKEY_VER3 { + magic: DWORD, + bitlenP: DWORD, + bitlenQ: DWORD, + bitlenJ: DWORD, + bitlenX: DWORD, + DSSSeed: DSSSEED, +}} +pub type DSSPRIVKEY_VER3 = DHPRIVKEY_VER3; +STRUCT!{struct KEY_TYPE_SUBTYPE { + dwKeySpec: DWORD, + Type: GUID, + Subtype: GUID, +}} +pub type PKEY_TYPE_SUBTYPE = *mut KEY_TYPE_SUBTYPE; +STRUCT!{struct CERT_FORTEZZA_DATA_PROP { + SerialNumber: [c_uchar; 8], + CertIndex: c_int, + CertLabel: [c_uchar; 36], +}} +STRUCT!{struct CRYPT_RC4_KEY_STATE { + Key: [c_uchar; 16], + SBox: [c_uchar; 256], + i: c_uchar, + j: c_uchar, +}} +pub type PCRYPT_RC4_KEY_STATE = *mut CRYPT_RC4_KEY_STATE; +STRUCT!{struct CRYPT_DES_KEY_STATE { + Key: [c_uchar; 8], + IV: [c_uchar; 8], + Feedback: [c_uchar; 8], +}} +pub type PCRYPT_DES_KEY_STATE = *mut CRYPT_DES_KEY_STATE; +STRUCT!{struct CRYPT_3DES_KEY_STATE { + Key: [c_uchar; 24], + IV: [c_uchar; 8], + Feedback: [c_uchar; 8], +}} +pub type PCRYPT_3DES_KEY_STATE = *mut CRYPT_3DES_KEY_STATE; +STRUCT!{struct CRYPT_AES_128_KEY_STATE { + Key: [c_uchar; 16], + IV: [c_uchar; 16], + EncryptionState: [[c_uchar; 16]; 11], + DecryptionState: [[c_uchar; 16]; 11], + Feedback: [c_uchar; 16], +}} +pub type PCRYPT_AES_128_KEY_STATE = *mut CRYPT_AES_128_KEY_STATE; +STRUCT!{struct CRYPT_AES_256_KEY_STATE { + Key: [c_uchar; 32], + IV: [c_uchar; 16], + EncryptionState: [[c_uchar; 16]; 15], + DecryptionState: [[c_uchar; 16]; 15], + Feedback: [c_uchar; 16], +}} +pub type PCRYPT_AES_256_KEY_STATE = *mut CRYPT_AES_256_KEY_STATE; +STRUCT!{struct CRYPTOAPI_BLOB { + cbData: DWORD, + pbData: *mut BYTE, +}} +pub type CRYPT_INTEGER_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_INTEGER_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_UINT_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_UINT_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_OBJID_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_OBJID_BLOB = *mut CRYPTOAPI_BLOB; +pub type CERT_NAME_BLOB = CRYPTOAPI_BLOB; +pub type PCERT_NAME_BLOB = *mut CRYPTOAPI_BLOB; +pub type CERT_RDN_VALUE_BLOB = CRYPTOAPI_BLOB; +pub type PCERT_RDN_VALUE_BLOB = *mut CRYPTOAPI_BLOB; +pub type CERT_BLOB = CRYPTOAPI_BLOB; +pub type PCERT_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRL_BLOB = CRYPTOAPI_BLOB; +pub type PCRL_BLOB = *mut CRYPTOAPI_BLOB; +pub type DATA_BLOB = CRYPTOAPI_BLOB; +pub type PDATA_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_DATA_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_DATA_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_HASH_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_HASH_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_DIGEST_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_DIGEST_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_DER_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_DER_BLOB = *mut CRYPTOAPI_BLOB; +pub type CRYPT_ATTR_BLOB = CRYPTOAPI_BLOB; +pub type PCRYPT_ATTR_BLOB = *mut CRYPTOAPI_BLOB; +STRUCT!{struct CMS_DH_KEY_INFO { + dwVersion: DWORD, + Algid: ALG_ID, + pszContentEncObjId: LPSTR, + PubInfo: CRYPT_DATA_BLOB, + pReserved: *mut c_void, +}} +pub type PCMS_DH_KEY_INFO = *mut CMS_DH_KEY_INFO; +extern "system" { + pub fn CryptAcquireContextA( + phProv: *mut HCRYPTPROV, + szContainer: LPCSTR, + szProvider: LPCSTR, + dwProvType: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptAcquireContextW( + phProv: *mut HCRYPTPROV, + szContainer: LPCWSTR, + szProvider: LPCWSTR, + dwProvType: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptReleaseContext( + hProv: HCRYPTPROV, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptGenKey( + hProv: HCRYPTPROV, + Algid: ALG_ID, + dwFlags: DWORD, + phKey: *mut HCRYPTKEY, + ) -> BOOL; + pub fn CryptDeriveKey( + hProv: HCRYPTPROV, + Algid: ALG_ID, + hBaseData: HCRYPTHASH, + dwFlags: DWORD, + phKey: *mut HCRYPTKEY, + ) -> BOOL; + pub fn CryptDestroyKey( + hKey: HCRYPTKEY, + ) -> BOOL; + pub fn CryptSetKeyParam( + hKey: HCRYPTKEY, + dwParam: DWORD, + pbData: *const BYTE, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptGetKeyParam( + hKey: HCRYPTKEY, + dwParam: DWORD, + pbData: *mut BYTE, + pdwDataLen: *mut DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptSetHashParam( + hHash: HCRYPTHASH, + dwParam: DWORD, + pbData: *const BYTE, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptGetHashParam( + hHash: HCRYPTHASH, + dwParam: DWORD, + pbData: *mut BYTE, + pdwDataLen: *mut DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptSetProvParam( + hProv: HCRYPTPROV, + dwParam: DWORD, + pbData: *const BYTE, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptGetProvParam( + hProv: HCRYPTPROV, + dwParam: DWORD, + pbData: *mut BYTE, + pdwDataLen: *mut DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptGenRandom( + hProv: HCRYPTPROV, + dwLen: DWORD, + pbBuffer: *mut BYTE, + ) -> BOOL; + pub fn CryptGetUserKey( + hProv: HCRYPTPROV, + dwKeySpec: DWORD, + phUserKey: *mut HCRYPTKEY, + ) -> BOOL; + pub fn CryptExportKey( + hKey: HCRYPTKEY, + hExpKey: HCRYPTKEY, + dwBlobType: DWORD, + dwFlags: DWORD, + pbData: *mut BYTE, + pdwDataLen: *mut DWORD, + ) -> BOOL; + pub fn CryptImportKey( + hProv: HCRYPTPROV, + pbData: *const BYTE, + dwDataLen: DWORD, + hPubKey: HCRYPTKEY, + dwFlags: DWORD, + phKey: *mut HCRYPTKEY, + ) -> BOOL; + pub fn CryptEncrypt( + hKey: HCRYPTKEY, + hHash: HCRYPTHASH, + Final: BOOL, + dwFlags: DWORD, + pbData: *mut BYTE, + pdwDataLen: *mut DWORD, + dwBufLen: DWORD, + ) -> BOOL; + pub fn CryptDecrypt( + hKey: HCRYPTKEY, + hHash: HCRYPTHASH, + Final: BOOL, + dwFlags: DWORD, + pbData: *mut BYTE, + pdwDataLen: *mut DWORD, + ) -> BOOL; + pub fn CryptCreateHash( + hProv: HCRYPTPROV, + Algid: ALG_ID, + hKey: HCRYPTKEY, + dwFlags: DWORD, + phHash: *mut HCRYPTHASH, + ) -> BOOL; + pub fn CryptHashData( + hHash: HCRYPTHASH, + pbData: *const BYTE, + dwDataLen: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptHashSessionKey( + hHash: HCRYPTHASH, + hKey: HCRYPTKEY, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptDestroyHash( + hHash: HCRYPTHASH, + ) -> BOOL; + pub fn CryptSignHashA( + hHash: HCRYPTHASH, + dwKeySpec: DWORD, + szDescription: LPCSTR, + dwFlags: DWORD, + pbSignature: *mut BYTE, + pdwSigLen: *mut DWORD, + ) -> BOOL; + pub fn CryptSignHashW( + hHash: HCRYPTHASH, + dwKeySpec: DWORD, + szDescription: LPCWSTR, + dwFlags: DWORD, + pbSignature: *mut BYTE, + pdwSigLen: *mut DWORD, + ) -> BOOL; + pub fn CryptVerifySignatureA( + hHash: HCRYPTHASH, + pbSignature: *const BYTE, + dwSigLen: DWORD, + hPubKey: HCRYPTKEY, + szDescription: LPCSTR, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptVerifySignatureW( + hHash: HCRYPTHASH, + pbSignature: *const BYTE, + dwSigLen: DWORD, + hPubKey: HCRYPTKEY, + szDescription: LPCWSTR, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptSetProviderA( + pszProvName: LPCSTR, + dwProvType: DWORD, + ) -> BOOL; + pub fn CryptSetProviderW( + pszProvName: LPCWSTR, + dwProvType: DWORD, + ) -> BOOL; + pub fn CryptSetProviderExA( + pszProvName: LPCSTR, + dwProvType: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptSetProviderExW( + pszProvName: LPCWSTR, + dwProvType: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptGetDefaultProviderA( + dwProvType: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + pszProvName: LPSTR, + pcbProvName: *mut DWORD, + ) -> BOOL; + pub fn CryptGetDefaultProviderW( + dwProvType: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + pszProvName: LPWSTR, + pcbProvName: *mut DWORD, + ) -> BOOL; + pub fn CryptEnumProviderTypesA( + dwIndex: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + pdwProvType: *mut DWORD, + szTypeName: LPSTR, + pcbTypeName: *mut DWORD, + ) -> BOOL; + pub fn CryptEnumProviderTypesW( + dwIndex: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + pdwProvType: *mut DWORD, + szTypeName: LPWSTR, + pcbTypeName: *mut DWORD, + ) -> BOOL; + pub fn CryptEnumProvidersA( + dwIndex: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + pdwProvType: *mut DWORD, + szProvName: LPSTR, + pcbProvName: *mut DWORD, + ) -> BOOL; + pub fn CryptEnumProvidersW( + dwIndex: DWORD, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + pdwProvType: *mut DWORD, + szProvName: LPWSTR, + pcbProvName: *mut DWORD, + ) -> BOOL; + pub fn CryptContextAddRef( + hProv: HCRYPTPROV, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptDuplicateKey( + hKey: HCRYPTKEY, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + phKey: *mut HCRYPTKEY, + ) -> BOOL; + pub fn CryptDuplicateHash( + hHash: HCRYPTHASH, + pdwReserved: *mut DWORD, + dwFlags: DWORD, + phHash: *mut HCRYPTHASH, + ) -> BOOL; +} +extern "C" { + pub fn GetEncSChannel( + pData: *mut *mut BYTE, + dwDecSize: *mut DWORD, + ) -> BOOL; +} +pub type HCRYPTPROV_OR_NCRYPT_KEY_HANDLE = ULONG_PTR; +pub type HCRYPTPROV_LEGACY = ULONG_PTR; +STRUCT!{struct CRYPT_BIT_BLOB { + cbData: DWORD, + pbData: *mut BYTE, + cUnusedBits: DWORD, +}} +pub type PCRYPT_BIT_BLOB = *mut CRYPT_BIT_BLOB; +STRUCT!{struct CRYPT_ALGORITHM_IDENTIFIER { + pszObjId: LPSTR, + Parameters: CRYPT_OBJID_BLOB, +}} +pub type PCRYPT_ALGORITHM_IDENTIFIER = *mut CRYPT_ALGORITHM_IDENTIFIER; +pub const szOID_RSA: &'static str = "1.2.840.113549"; +pub const szOID_PKCS: &'static str = "1.2.840.113549.1"; +pub const szOID_RSA_HASH: &'static str = "1.2.840.113549.2"; +pub const szOID_RSA_ENCRYPT: &'static str = "1.2.840.113549.3"; +pub const szOID_PKCS_1: &'static str = "1.2.840.113549.1.1"; +pub const szOID_PKCS_2: &'static str = "1.2.840.113549.1.2"; +pub const szOID_PKCS_3: &'static str = "1.2.840.113549.1.3"; +pub const szOID_PKCS_4: &'static str = "1.2.840.113549.1.4"; +pub const szOID_PKCS_5: &'static str = "1.2.840.113549.1.5"; +pub const szOID_PKCS_6: &'static str = "1.2.840.113549.1.6"; +pub const szOID_PKCS_7: &'static str = "1.2.840.113549.1.7"; +pub const szOID_PKCS_8: &'static str = "1.2.840.113549.1.8"; +pub const szOID_PKCS_9: &'static str = "1.2.840.113549.1.9"; +pub const szOID_PKCS_10: &'static str = "1.2.840.113549.1.10"; +pub const szOID_PKCS_12: &'static str = "1.2.840.113549.1.12"; +pub const szOID_RSA_RSA: &'static str = "1.2.840.113549.1.1.1"; +pub const szOID_RSA_MD2RSA: &'static str = "1.2.840.113549.1.1.2"; +pub const szOID_RSA_MD4RSA: &'static str = "1.2.840.113549.1.1.3"; +pub const szOID_RSA_MD5RSA: &'static str = "1.2.840.113549.1.1.4"; +pub const szOID_RSA_SHA1RSA: &'static str = "1.2.840.113549.1.1.5"; +pub const szOID_RSA_SETOAEP_RSA: &'static str = "1.2.840.113549.1.1.6"; +pub const szOID_RSAES_OAEP: &'static str = "1.2.840.113549.1.1.7"; +pub const szOID_RSA_MGF1: &'static str = "1.2.840.113549.1.1.8"; +pub const szOID_RSA_PSPECIFIED: &'static str = "1.2.840.113549.1.1.9"; +pub const szOID_RSA_SSA_PSS: &'static str = "1.2.840.113549.1.1.10"; +pub const szOID_RSA_SHA256RSA: &'static str = "1.2.840.113549.1.1.11"; +pub const szOID_RSA_SHA384RSA: &'static str = "1.2.840.113549.1.1.12"; +pub const szOID_RSA_SHA512RSA: &'static str = "1.2.840.113549.1.1.13"; +pub const szOID_RSA_DH: &'static str = "1.2.840.113549.1.3.1"; +pub const szOID_RSA_data: &'static str = "1.2.840.113549.1.7.1"; +pub const szOID_RSA_signedData: &'static str = "1.2.840.113549.1.7.2"; +pub const szOID_RSA_envelopedData: &'static str = "1.2.840.113549.1.7.3"; +pub const szOID_RSA_signEnvData: &'static str = "1.2.840.113549.1.7.4"; +pub const szOID_RSA_digestedData: &'static str = "1.2.840.113549.1.7.5"; +pub const szOID_RSA_hashedData: &'static str = "1.2.840.113549.1.7.5"; +pub const szOID_RSA_encryptedData: &'static str = "1.2.840.113549.1.7.6"; +pub const szOID_RSA_emailAddr: &'static str = "1.2.840.113549.1.9.1"; +pub const szOID_RSA_unstructName: &'static str = "1.2.840.113549.1.9.2"; +pub const szOID_RSA_contentType: &'static str = "1.2.840.113549.1.9.3"; +pub const szOID_RSA_messageDigest: &'static str = "1.2.840.113549.1.9.4"; +pub const szOID_RSA_signingTime: &'static str = "1.2.840.113549.1.9.5"; +pub const szOID_RSA_counterSign: &'static str = "1.2.840.113549.1.9.6"; +pub const szOID_RSA_challengePwd: &'static str = "1.2.840.113549.1.9.7"; +pub const szOID_RSA_unstructAddr: &'static str = "1.2.840.113549.1.9.8"; +pub const szOID_RSA_extCertAttrs: &'static str = "1.2.840.113549.1.9.9"; +pub const szOID_RSA_certExtensions: &'static str = "1.2.840.113549.1.9.14"; +pub const szOID_RSA_SMIMECapabilities: &'static str = "1.2.840.113549.1.9.15"; +pub const szOID_RSA_preferSignedData: &'static str = "1.2.840.113549.1.9.15.1"; +pub const szOID_TIMESTAMP_TOKEN: &'static str = "1.2.840.113549.1.9.16.1.4"; +pub const szOID_RFC3161_counterSign: &'static str = "1.3.6.1.4.1.311.3.3.1"; +pub const szOID_RSA_SMIMEalg: &'static str = "1.2.840.113549.1.9.16.3"; +pub const szOID_RSA_SMIMEalgESDH: &'static str = "1.2.840.113549.1.9.16.3.5"; +pub const szOID_RSA_SMIMEalgCMS3DESwrap: &'static str = "1.2.840.113549.1.9.16.3.6"; +pub const szOID_RSA_SMIMEalgCMSRC2wrap: &'static str = "1.2.840.113549.1.9.16.3.7"; +pub const szOID_RSA_MD2: &'static str = "1.2.840.113549.2.2"; +pub const szOID_RSA_MD4: &'static str = "1.2.840.113549.2.4"; +pub const szOID_RSA_MD5: &'static str = "1.2.840.113549.2.5"; +pub const szOID_RSA_RC2CBC: &'static str = "1.2.840.113549.3.2"; +pub const szOID_RSA_RC4: &'static str = "1.2.840.113549.3.4"; +pub const szOID_RSA_DES_EDE3_CBC: &'static str = "1.2.840.113549.3.7"; +pub const szOID_RSA_RC5_CBCPad: &'static str = "1.2.840.113549.3.9"; +pub const szOID_ANSI_X942: &'static str = "1.2.840.10046"; +pub const szOID_ANSI_X942_DH: &'static str = "1.2.840.10046.2.1"; +pub const szOID_X957: &'static str = "1.2.840.10040"; +pub const szOID_X957_DSA: &'static str = "1.2.840.10040.4.1"; +pub const szOID_X957_SHA1DSA: &'static str = "1.2.840.10040.4.3"; +pub const szOID_ECC_PUBLIC_KEY: &'static str = "1.2.840.10045.2.1"; +pub const szOID_ECC_CURVE_P256: &'static str = "1.2.840.10045.3.1.7"; +pub const szOID_ECC_CURVE_P384: &'static str = "1.3.132.0.34"; +pub const szOID_ECC_CURVE_P521: &'static str = "1.3.132.0.35"; +pub const szOID_ECC_CURVE_BRAINPOOLP160R1: &'static str = "1.3.36.3.3.2.8.1.1.1"; +pub const szOID_ECC_CURVE_BRAINPOOLP160T1: &'static str = "1.3.36.3.3.2.8.1.1.2"; +pub const szOID_ECC_CURVE_BRAINPOOLP192R1: &'static str = "1.3.36.3.3.2.8.1.1.3"; +pub const szOID_ECC_CURVE_BRAINPOOLP192T1: &'static str = "1.3.36.3.3.2.8.1.1.4"; +pub const szOID_ECC_CURVE_BRAINPOOLP224R1: &'static str = "1.3.36.3.3.2.8.1.1.5"; +pub const szOID_ECC_CURVE_BRAINPOOLP224T1: &'static str = "1.3.36.3.3.2.8.1.1.6"; +pub const szOID_ECC_CURVE_BRAINPOOLP256R1: &'static str = "1.3.36.3.3.2.8.1.1.7"; +pub const szOID_ECC_CURVE_BRAINPOOLP256T1: &'static str = "1.3.36.3.3.2.8.1.1.8"; +pub const szOID_ECC_CURVE_BRAINPOOLP320R1: &'static str = "1.3.36.3.3.2.8.1.1.9"; +pub const szOID_ECC_CURVE_BRAINPOOLP320T1: &'static str = "1.3.36.3.3.2.8.1.1.10"; +pub const szOID_ECC_CURVE_BRAINPOOLP384R1: &'static str = "1.3.36.3.3.2.8.1.1.11"; +pub const szOID_ECC_CURVE_BRAINPOOLP384T1: &'static str = "1.3.36.3.3.2.8.1.1.12"; +pub const szOID_ECC_CURVE_BRAINPOOLP512R1: &'static str = "1.3.36.3.3.2.8.1.1.13"; +pub const szOID_ECC_CURVE_BRAINPOOLP512T1: &'static str = "1.3.36.3.3.2.8.1.1.14"; +pub const szOID_ECC_CURVE_EC192WAPI: &'static str = "1.2.156.11235.1.1.2.1"; +pub const szOID_CN_ECDSA_SHA256: &'static str = "1.2.156.11235.1.1.1"; +pub const szOID_ECC_CURVE_NISTP192: &'static str = "1.2.840.10045.3.1.1"; +pub const szOID_ECC_CURVE_NISTP224: &'static str = "1.3.132.0.33"; +pub const szOID_ECC_CURVE_NISTP256: &'static str = szOID_ECC_CURVE_P256; +pub const szOID_ECC_CURVE_NISTP384: &'static str = szOID_ECC_CURVE_P384; +pub const szOID_ECC_CURVE_NISTP521: &'static str = szOID_ECC_CURVE_P521; +pub const szOID_ECC_CURVE_SECP160K1: &'static str = "1.3.132.0.9"; +pub const szOID_ECC_CURVE_SECP160R1: &'static str = "1.3.132.0.8"; +pub const szOID_ECC_CURVE_SECP160R2: &'static str = "1.3.132.0.30"; +pub const szOID_ECC_CURVE_SECP192K1: &'static str = "1.3.132.0.31"; +pub const szOID_ECC_CURVE_SECP192R1: &'static str = szOID_ECC_CURVE_NISTP192; +pub const szOID_ECC_CURVE_SECP224K1: &'static str = "1.3.132.0.32"; +pub const szOID_ECC_CURVE_SECP224R1: &'static str = szOID_ECC_CURVE_NISTP224; +pub const szOID_ECC_CURVE_SECP256K1: &'static str = "1.3.132.0.10"; +pub const szOID_ECC_CURVE_SECP256R1: &'static str = szOID_ECC_CURVE_P256; +pub const szOID_ECC_CURVE_SECP384R1: &'static str = szOID_ECC_CURVE_P384; +pub const szOID_ECC_CURVE_SECP521R1: &'static str = szOID_ECC_CURVE_P521; +pub const szOID_ECC_CURVE_WTLS7: &'static str = szOID_ECC_CURVE_SECP160R2; +pub const szOID_ECC_CURVE_WTLS9: &'static str = "2.23.43.1.4.9"; +pub const szOID_ECC_CURVE_WTLS12: &'static str = szOID_ECC_CURVE_NISTP224; +pub const szOID_ECC_CURVE_X962P192V1: &'static str = "1.2.840.10045.3.1.1"; +pub const szOID_ECC_CURVE_X962P192V2: &'static str = "1.2.840.10045.3.1.2"; +pub const szOID_ECC_CURVE_X962P192V3: &'static str = "1.2.840.10045.3.1.3"; +pub const szOID_ECC_CURVE_X962P239V1: &'static str = "1.2.840.10045.3.1.4"; +pub const szOID_ECC_CURVE_X962P239V2: &'static str = "1.2.840.10045.3.1.5"; +pub const szOID_ECC_CURVE_X962P239V3: &'static str = "1.2.840.10045.3.1.6"; +pub const szOID_ECC_CURVE_X962P256V1: &'static str = szOID_ECC_CURVE_P256; +pub const szOID_ECDSA_SHA1: &'static str = "1.2.840.10045.4.1"; +pub const szOID_ECDSA_SPECIFIED: &'static str = "1.2.840.10045.4.3"; +pub const szOID_ECDSA_SHA256: &'static str = "1.2.840.10045.4.3.2"; +pub const szOID_ECDSA_SHA384: &'static str = "1.2.840.10045.4.3.3"; +pub const szOID_ECDSA_SHA512: &'static str = "1.2.840.10045.4.3.4"; +pub const szOID_NIST_AES128_CBC: &'static str = "2.16.840.1.101.3.4.1.2"; +pub const szOID_NIST_AES192_CBC: &'static str = "2.16.840.1.101.3.4.1.22"; +pub const szOID_NIST_AES256_CBC: &'static str = "2.16.840.1.101.3.4.1.42"; +pub const szOID_NIST_AES128_WRAP: &'static str = "2.16.840.1.101.3.4.1.5"; +pub const szOID_NIST_AES192_WRAP: &'static str = "2.16.840.1.101.3.4.1.25"; +pub const szOID_NIST_AES256_WRAP: &'static str = "2.16.840.1.101.3.4.1.45"; +pub const szOID_DH_SINGLE_PASS_STDDH_SHA1_KDF: &'static str = "1.3.133.16.840.63.0.2"; +pub const szOID_DH_SINGLE_PASS_STDDH_SHA256_KDF: &'static str = "1.3.132.1.11.1"; +pub const szOID_DH_SINGLE_PASS_STDDH_SHA384_KDF: &'static str = "1.3.132.1.11.2"; +pub const szOID_DS: &'static str = "2.5"; +pub const szOID_DSALG: &'static str = "2.5.8"; +pub const szOID_DSALG_CRPT: &'static str = "2.5.8.1"; +pub const szOID_DSALG_HASH: &'static str = "2.5.8.2"; +pub const szOID_DSALG_SIGN: &'static str = "2.5.8.3"; +pub const szOID_DSALG_RSA: &'static str = "2.5.8.1.1"; +pub const szOID_OIW: &'static str = "1.3.14"; +pub const szOID_OIWSEC: &'static str = "1.3.14.3.2"; +pub const szOID_OIWSEC_md4RSA: &'static str = "1.3.14.3.2.2"; +pub const szOID_OIWSEC_md5RSA: &'static str = "1.3.14.3.2.3"; +pub const szOID_OIWSEC_md4RSA2: &'static str = "1.3.14.3.2.4"; +pub const szOID_OIWSEC_desECB: &'static str = "1.3.14.3.2.6"; +pub const szOID_OIWSEC_desCBC: &'static str = "1.3.14.3.2.7"; +pub const szOID_OIWSEC_desOFB: &'static str = "1.3.14.3.2.8"; +pub const szOID_OIWSEC_desCFB: &'static str = "1.3.14.3.2.9"; +pub const szOID_OIWSEC_desMAC: &'static str = "1.3.14.3.2.10"; +pub const szOID_OIWSEC_rsaSign: &'static str = "1.3.14.3.2.11"; +pub const szOID_OIWSEC_dsa: &'static str = "1.3.14.3.2.12"; +pub const szOID_OIWSEC_shaDSA: &'static str = "1.3.14.3.2.13"; +pub const szOID_OIWSEC_mdc2RSA: &'static str = "1.3.14.3.2.14"; +pub const szOID_OIWSEC_shaRSA: &'static str = "1.3.14.3.2.15"; +pub const szOID_OIWSEC_dhCommMod: &'static str = "1.3.14.3.2.16"; +pub const szOID_OIWSEC_desEDE: &'static str = "1.3.14.3.2.17"; +pub const szOID_OIWSEC_sha: &'static str = "1.3.14.3.2.18"; +pub const szOID_OIWSEC_mdc2: &'static str = "1.3.14.3.2.19"; +pub const szOID_OIWSEC_dsaComm: &'static str = "1.3.14.3.2.20"; +pub const szOID_OIWSEC_dsaCommSHA: &'static str = "1.3.14.3.2.21"; +pub const szOID_OIWSEC_rsaXchg: &'static str = "1.3.14.3.2.22"; +pub const szOID_OIWSEC_keyHashSeal: &'static str = "1.3.14.3.2.23"; +pub const szOID_OIWSEC_md2RSASign: &'static str = "1.3.14.3.2.24"; +pub const szOID_OIWSEC_md5RSASign: &'static str = "1.3.14.3.2.25"; +pub const szOID_OIWSEC_sha1: &'static str = "1.3.14.3.2.26"; +pub const szOID_OIWSEC_dsaSHA1: &'static str = "1.3.14.3.2.27"; +pub const szOID_OIWSEC_dsaCommSHA1: &'static str = "1.3.14.3.2.28"; +pub const szOID_OIWSEC_sha1RSASign: &'static str = "1.3.14.3.2.29"; +pub const szOID_OIWDIR: &'static str = "1.3.14.7.2"; +pub const szOID_OIWDIR_CRPT: &'static str = "1.3.14.7.2.1"; +pub const szOID_OIWDIR_HASH: &'static str = "1.3.14.7.2.2"; +pub const szOID_OIWDIR_SIGN: &'static str = "1.3.14.7.2.3"; +pub const szOID_OIWDIR_md2: &'static str = "1.3.14.7.2.2.1"; +pub const szOID_OIWDIR_md2RSA: &'static str = "1.3.14.7.2.3.1"; +pub const szOID_INFOSEC: &'static str = "2.16.840.1.101.2.1"; +pub const szOID_INFOSEC_sdnsSignature: &'static str = "2.16.840.1.101.2.1.1.1"; +pub const szOID_INFOSEC_mosaicSignature: &'static str = "2.16.840.1.101.2.1.1.2"; +pub const szOID_INFOSEC_sdnsConfidentiality: &'static str = "2.16.840.1.101.2.1.1.3"; +pub const szOID_INFOSEC_mosaicConfidentiality: &'static str = "2.16.840.1.101.2.1.1.4"; +pub const szOID_INFOSEC_sdnsIntegrity: &'static str = "2.16.840.1.101.2.1.1.5"; +pub const szOID_INFOSEC_mosaicIntegrity: &'static str = "2.16.840.1.101.2.1.1.6"; +pub const szOID_INFOSEC_sdnsTokenProtection: &'static str = "2.16.840.1.101.2.1.1.7"; +pub const szOID_INFOSEC_mosaicTokenProtection: &'static str = "2.16.840.1.101.2.1.1.8"; +pub const szOID_INFOSEC_sdnsKeyManagement: &'static str = "2.16.840.1.101.2.1.1.9"; +pub const szOID_INFOSEC_mosaicKeyManagement: &'static str = "2.16.840.1.101.2.1.1.10"; +pub const szOID_INFOSEC_sdnsKMandSig: &'static str = "2.16.840.1.101.2.1.1.11"; +pub const szOID_INFOSEC_mosaicKMandSig: &'static str = "2.16.840.1.101.2.1.1.12"; +pub const szOID_INFOSEC_SuiteASignature: &'static str = "2.16.840.1.101.2.1.1.13"; +pub const szOID_INFOSEC_SuiteAConfidentiality: &'static str = "2.16.840.1.101.2.1.1.14"; +pub const szOID_INFOSEC_SuiteAIntegrity: &'static str = "2.16.840.1.101.2.1.1.15"; +pub const szOID_INFOSEC_SuiteATokenProtection: &'static str = "2.16.840.1.101.2.1.1.16"; +pub const szOID_INFOSEC_SuiteAKeyManagement: &'static str = "2.16.840.1.101.2.1.1.17"; +pub const szOID_INFOSEC_SuiteAKMandSig: &'static str = "2.16.840.1.101.2.1.1.18"; +pub const szOID_INFOSEC_mosaicUpdatedSig: &'static str = "2.16.840.1.101.2.1.1.19"; +pub const szOID_INFOSEC_mosaicKMandUpdSig: &'static str = "2.16.840.1.101.2.1.1.20"; +pub const szOID_INFOSEC_mosaicUpdatedInteg: &'static str = "2.16.840.1.101.2.1.1.21"; +pub const szOID_NIST_sha256: &'static str = "2.16.840.1.101.3.4.2.1"; +pub const szOID_NIST_sha384: &'static str = "2.16.840.1.101.3.4.2.2"; +pub const szOID_NIST_sha512: &'static str = "2.16.840.1.101.3.4.2.3"; +STRUCT!{struct CRYPT_OBJID_TABLE { + dwAlgId: DWORD, + pszObjId: LPCSTR, +}} +pub type PCRYPT_OBJID_TABLE = *mut CRYPT_OBJID_TABLE; +STRUCT!{struct CRYPT_HASH_INFO { + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Hash: CRYPT_HASH_BLOB, +}} +pub type PCRYPT_HASH_INFO = *mut CRYPT_HASH_INFO; +STRUCT!{struct CERT_EXTENSION { + pszObjId: LPSTR, + fCritical: BOOL, + Value: CRYPT_OBJID_BLOB, +}} +pub type PCERT_EXTENSION = *mut CERT_EXTENSION; +pub type PCCERT_EXTENSION = *const CERT_EXTENSION; +STRUCT!{struct CRYPT_ATTRIBUTE_TYPE_VALUE { + pszObjId: LPSTR, + Value: CRYPT_OBJID_BLOB, +}} +pub type PCRYPT_ATTRIBUTE_TYPE_VALUE = *mut CRYPT_ATTRIBUTE_TYPE_VALUE; +STRUCT!{struct CRYPT_ATTRIBUTE { + pszObjId: LPSTR, + cValue: DWORD, + rgValue: PCRYPT_ATTR_BLOB, +}} +pub type PCRYPT_ATTRIBUTE = *mut CRYPT_ATTRIBUTE; +STRUCT!{struct CRYPT_ATTRIBUTES { + cAttr: DWORD, + rgAttr: PCRYPT_ATTRIBUTE, +}} +pub type PCRYPT_ATTRIBUTES = *mut CRYPT_ATTRIBUTES; +STRUCT!{struct CERT_RDN_ATTR { + pszObjId: LPSTR, + dwValueType: DWORD, + Value: CERT_RDN_VALUE_BLOB, +}} +pub type PCERT_RDN_ATTR = *mut CERT_RDN_ATTR; +pub const szOID_COMMON_NAME: &'static str = "2.5.4.3"; +pub const szOID_SUR_NAME: &'static str = "2.5.4.4"; +pub const szOID_DEVICE_SERIAL_NUMBER: &'static str = "2.5.4.5"; +pub const szOID_COUNTRY_NAME: &'static str = "2.5.4.6"; +pub const szOID_LOCALITY_NAME: &'static str = "2.5.4.7"; +pub const szOID_STATE_OR_PROVINCE_NAME: &'static str = "2.5.4.8"; +pub const szOID_STREET_ADDRESS: &'static str = "2.5.4.9"; +pub const szOID_ORGANIZATION_NAME: &'static str = "2.5.4.10"; +pub const szOID_ORGANIZATIONAL_UNIT_NAME: &'static str = "2.5.4.11"; +pub const szOID_TITLE: &'static str = "2.5.4.12"; +pub const szOID_DESCRIPTION: &'static str = "2.5.4.13"; +pub const szOID_SEARCH_GUIDE: &'static str = "2.5.4.14"; +pub const szOID_BUSINESS_CATEGORY: &'static str = "2.5.4.15"; +pub const szOID_POSTAL_ADDRESS: &'static str = "2.5.4.16"; +pub const szOID_POSTAL_CODE: &'static str = "2.5.4.17"; +pub const szOID_POST_OFFICE_BOX: &'static str = "2.5.4.18"; +pub const szOID_PHYSICAL_DELIVERY_OFFICE_NAME: &'static str = "2.5.4.19"; +pub const szOID_TELEPHONE_NUMBER: &'static str = "2.5.4.20"; +pub const szOID_TELEX_NUMBER: &'static str = "2.5.4.21"; +pub const szOID_TELETEXT_TERMINAL_IDENTIFIER: &'static str = "2.5.4.22"; +pub const szOID_FACSIMILE_TELEPHONE_NUMBER: &'static str = "2.5.4.23"; +pub const szOID_X21_ADDRESS: &'static str = "2.5.4.24"; +pub const szOID_INTERNATIONAL_ISDN_NUMBER: &'static str = "2.5.4.25"; +pub const szOID_REGISTERED_ADDRESS: &'static str = "2.5.4.26"; +pub const szOID_DESTINATION_INDICATOR: &'static str = "2.5.4.27"; +pub const szOID_PREFERRED_DELIVERY_METHOD: &'static str = "2.5.4.28"; +pub const szOID_PRESENTATION_ADDRESS: &'static str = "2.5.4.29"; +pub const szOID_SUPPORTED_APPLICATION_CONTEXT: &'static str = "2.5.4.30"; +pub const szOID_MEMBER: &'static str = "2.5.4.31"; +pub const szOID_OWNER: &'static str = "2.5.4.32"; +pub const szOID_ROLE_OCCUPANT: &'static str = "2.5.4.33"; +pub const szOID_SEE_ALSO: &'static str = "2.5.4.34"; +pub const szOID_USER_PASSWORD: &'static str = "2.5.4.35"; +pub const szOID_USER_CERTIFICATE: &'static str = "2.5.4.36"; +pub const szOID_CA_CERTIFICATE: &'static str = "2.5.4.37"; +pub const szOID_AUTHORITY_REVOCATION_LIST: &'static str = "2.5.4.38"; +pub const szOID_CERTIFICATE_REVOCATION_LIST: &'static str = "2.5.4.39"; +pub const szOID_CROSS_CERTIFICATE_PAIR: &'static str = "2.5.4.40"; +pub const szOID_GIVEN_NAME: &'static str = "2.5.4.42"; +pub const szOID_INITIALS: &'static str = "2.5.4.43"; +pub const szOID_DN_QUALIFIER: &'static str = "2.5.4.46"; +pub const szOID_DOMAIN_COMPONENT: &'static str = "0.9.2342.19200300.100.1.25"; +pub const szOID_PKCS_12_FRIENDLY_NAME_ATTR: &'static str = "1.2.840.113549.1.9.20"; +pub const szOID_PKCS_12_LOCAL_KEY_ID: &'static str = "1.2.840.113549.1.9.21"; +pub const szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR: &'static str = "1.3.6.1.4.1.311.17.1"; +pub const szOID_LOCAL_MACHINE_KEYSET: &'static str = "1.3.6.1.4.1.311.17.2"; +pub const szOID_PKCS_12_EXTENDED_ATTRIBUTES: &'static str = "1.3.6.1.4.1.311.17.3"; +pub const szOID_PKCS_12_PROTECTED_PASSWORD_SECRET_BAG_TYPE_ID: &'static str + = "1.3.6.1.4.1.311.17.4"; +pub const szOID_KEYID_RDN: &'static str = "1.3.6.1.4.1.311.10.7.1"; +pub const szOID_EV_RDN_LOCALE: &'static str = "1.3.6.1.4.1.311.60.2.1.1"; +pub const szOID_EV_RDN_STATE_OR_PROVINCE: &'static str = "1.3.6.1.4.1.311.60.2.1.2"; +pub const szOID_EV_RDN_COUNTRY: &'static str = "1.3.6.1.4.1.311.60.2.1.3"; +pub const CERT_RDN_ANY_TYPE: DWORD = 0; +pub const CERT_RDN_ENCODED_BLOB: DWORD = 1; +pub const CERT_RDN_OCTET_STRING: DWORD = 2; +pub const CERT_RDN_NUMERIC_STRING: DWORD = 3; +pub const CERT_RDN_PRINTABLE_STRING: DWORD = 4; +pub const CERT_RDN_TELETEX_STRING: DWORD = 5; +pub const CERT_RDN_T61_STRING: DWORD = 5; +pub const CERT_RDN_VIDEOTEX_STRING: DWORD = 6; +pub const CERT_RDN_IA5_STRING: DWORD = 7; +pub const CERT_RDN_GRAPHIC_STRING: DWORD = 8; +pub const CERT_RDN_VISIBLE_STRING: DWORD = 9; +pub const CERT_RDN_ISO646_STRING: DWORD = 9; +pub const CERT_RDN_GENERAL_STRING: DWORD = 10; +pub const CERT_RDN_UNIVERSAL_STRING: DWORD = 11; +pub const CERT_RDN_INT4_STRING: DWORD = 11; +pub const CERT_RDN_BMP_STRING: DWORD = 12; +pub const CERT_RDN_UNICODE_STRING: DWORD = 12; +pub const CERT_RDN_UTF8_STRING: DWORD = 13; +pub const CERT_RDN_TYPE_MASK: DWORD = 0x000000FF; +pub const CERT_RDN_FLAGS_MASK: DWORD = 0xFF000000; +pub const CERT_RDN_ENABLE_T61_UNICODE_FLAG: DWORD = 0x80000000; +pub const CERT_RDN_ENABLE_UTF8_UNICODE_FLAG: DWORD = 0x20000000; +pub const CERT_RDN_FORCE_UTF8_UNICODE_FLAG: DWORD = 0x10000000; +pub const CERT_RDN_DISABLE_CHECK_TYPE_FLAG: DWORD = 0x40000000; +pub const CERT_RDN_DISABLE_IE4_UTF8_FLAG: DWORD = 0x01000000; +pub const CERT_RDN_ENABLE_PUNYCODE_FLAG: DWORD = 0x02000000; +#[inline] +pub fn IS_CERT_RDN_CHAR_STRING(X: DWORD) -> bool { + (X & CERT_RDN_TYPE_MASK) >= CERT_RDN_NUMERIC_STRING +} +STRUCT!{struct CERT_RDN { + cRDNAttr: DWORD, + rgRDNAttr: PCERT_RDN_ATTR, +}} +pub type PCERT_RDN = *mut CERT_RDN; +STRUCT!{struct CERT_NAME_INFO { + cRDN: DWORD, + rgRDN: PCERT_RDN, +}} +pub type PCERT_NAME_INFO = *mut CERT_NAME_INFO; +STRUCT!{struct CERT_NAME_VALUE { + dwValueType: DWORD, + Value: CERT_RDN_VALUE_BLOB, +}} +pub type PCERT_NAME_VALUE = *mut CERT_NAME_VALUE; +STRUCT!{struct CERT_PUBLIC_KEY_INFO { + Algorithm: CRYPT_ALGORITHM_IDENTIFIER, + PublicKey: CRYPT_BIT_BLOB, +}} +pub type PCERT_PUBLIC_KEY_INFO = *mut CERT_PUBLIC_KEY_INFO; +pub const CERT_RSA_PUBLIC_KEY_OBJID: &'static str = szOID_RSA_RSA; +pub const CERT_DEFAULT_OID_PUBLIC_KEY_SIGN: &'static str = szOID_RSA_RSA; +pub const CERT_DEFAULT_OID_PUBLIC_KEY_XCHG: &'static str = szOID_RSA_RSA; +STRUCT!{struct CRYPT_ECC_PRIVATE_KEY_INFO { + dwVersion: DWORD, + PrivateKey: CRYPT_DER_BLOB, + szCurveOid: LPSTR, + PublicKey: CRYPT_BIT_BLOB, +}} +pub type PCRYPT_ECC_PRIVATE_KEY_INFO = *mut CRYPT_ECC_PRIVATE_KEY_INFO; +pub const CRYPT_ECC_PRIVATE_KEY_INFO_v1: DWORD = 1; +STRUCT!{struct CRYPT_PRIVATE_KEY_INFO { + Version: DWORD, + Algorithm: CRYPT_ALGORITHM_IDENTIFIER, + PrivateKey: CRYPT_DER_BLOB, + pAttributes: PCRYPT_ATTRIBUTES, +}} +pub type PCRYPT_PRIVATE_KEY_INFO = *mut CRYPT_PRIVATE_KEY_INFO; +STRUCT!{struct CRYPT_ENCRYPTED_PRIVATE_KEY_INFO { + EncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedPrivateKey: CRYPT_DATA_BLOB, +}} +pub type PCRYPT_ENCRYPTED_PRIVATE_KEY_INFO = *mut CRYPT_ENCRYPTED_PRIVATE_KEY_INFO; +FN!{stdcall PCRYPT_DECRYPT_PRIVATE_KEY_FUNC( + Algorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedPrivateKey: CRYPT_DATA_BLOB, + pbClearTextKey: *mut BYTE, + pcbClearTextKey: *mut DWORD, + pVoidDecryptFunc: LPVOID, +) -> BOOL} +FN!{stdcall PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC( + Algorithm: *mut CRYPT_ALGORITHM_IDENTIFIER, + pClearTextPrivateKey: *mut CRYPT_DATA_BLOB, + pbEncryptedKey: *mut BYTE, + pcbEncryptedKey: *mut DWORD, + pVoidEncryptFunc: LPVOID, +) -> BOOL} +FN!{stdcall PCRYPT_RESOLVE_HCRYPTPROV_FUNC( + pPrivateKeyInfo: *mut CRYPT_PRIVATE_KEY_INFO, + phCryptProv: *mut HCRYPTPROV, + pVoidResolveFunc: LPVOID, +) -> BOOL} +STRUCT!{struct CRYPT_PKCS8_IMPORT_PARAMS { + PrivateKey: CRYPT_DIGEST_BLOB, + pResolvehCryptProvFunc: PCRYPT_RESOLVE_HCRYPTPROV_FUNC, + pVoidResolveFunc: LPVOID, + pDecryptPrivateKeyFunc: PCRYPT_DECRYPT_PRIVATE_KEY_FUNC, + pVoidDecryptFunc: LPVOID, +}} +pub type PCRYPT_PKCS8_IMPORT_PARAMS = *mut CRYPT_PKCS8_IMPORT_PARAMS; +pub type CRYPT_PRIVATE_KEY_BLOB_AND_PARAMS = CRYPT_PKCS8_IMPORT_PARAMS; +pub type PPCRYPT_PRIVATE_KEY_BLOB_AND_PARAMS = *mut CRYPT_PKCS8_IMPORT_PARAMS; +STRUCT!{struct CRYPT_PKCS8_EXPORT_PARAMS { + hCryptProv: HCRYPTPROV, + dwKeySpec: DWORD, + pszPrivateKeyObjId: LPSTR, + pEncryptPrivateKeyFunc: PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC, + pVoidEncryptFunc: LPVOID, +}} +pub type PCRYPT_PKCS8_EXPORT_PARAMS = *mut CRYPT_PKCS8_EXPORT_PARAMS; +STRUCT!{struct CERT_INFO { + dwVersion: DWORD, + SerialNumber: CRYPT_INTEGER_BLOB, + SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Issuer: CERT_NAME_BLOB, + NotBefore: FILETIME, + NotAfter: FILETIME, + Subject: CERT_NAME_BLOB, + SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, + IssuerUniqueId: CRYPT_BIT_BLOB, + SubjectUniqueId: CRYPT_BIT_BLOB, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCERT_INFO = *mut CERT_INFO; +pub const CERT_V1: DWORD = 0; +pub const CERT_V2: DWORD = 1; +pub const CERT_V3: DWORD = 2; +pub const CERT_INFO_VERSION_FLAG: DWORD = 1; +pub const CERT_INFO_SERIAL_NUMBER_FLAG: DWORD = 2; +pub const CERT_INFO_SIGNATURE_ALGORITHM_FLAG: DWORD = 3; +pub const CERT_INFO_ISSUER_FLAG: DWORD = 4; +pub const CERT_INFO_NOT_BEFORE_FLAG: DWORD = 5; +pub const CERT_INFO_NOT_AFTER_FLAG: DWORD = 6; +pub const CERT_INFO_SUBJECT_FLAG: DWORD = 7; +pub const CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG: DWORD = 8; +pub const CERT_INFO_ISSUER_UNIQUE_ID_FLAG: DWORD = 9; +pub const CERT_INFO_SUBJECT_UNIQUE_ID_FLAG: DWORD = 10; +pub const CERT_INFO_EXTENSION_FLAG: DWORD = 11; +STRUCT!{struct CRL_ENTRY { + SerialNumber: CRYPT_INTEGER_BLOB, + RevocationDate: FILETIME, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRL_ENTRY = *mut CRL_ENTRY; +STRUCT!{struct CRL_INFO { + dwVersion: DWORD, + SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Issuer: CERT_NAME_BLOB, + ThisUpdate: FILETIME, + NextUpdate: FILETIME, + cCRLEntry: DWORD, + rgCRLEntry: PCRL_ENTRY, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRL_INFO = *mut CRL_INFO; +pub const CRL_V1: DWORD = 0; +pub const CRL_V2: DWORD = 1; +pub const CERT_BUNDLE_CERTIFICATE: DWORD = 0; +pub const CERT_BUNDLE_CRL: DWORD = 1; +STRUCT!{struct CERT_OR_CRL_BLOB { + dwChoice: DWORD, + cbEncoded: DWORD, + pbEncoded: *mut BYTE, +}} +pub type PCERT_OR_CRL_BLOB = *mut CERT_OR_CRL_BLOB; +STRUCT!{struct CERT_OR_CRL_BUNDLE { + cItem: DWORD, + rgItem: PCERT_OR_CRL_BLOB, +}} +pub type PCERT_OR_CRL_BUNDLE = *mut CERT_OR_CRL_BUNDLE; +STRUCT!{struct CERT_REQUEST_INFO { + dwVersion: DWORD, + Subject: CERT_NAME_BLOB, + SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, + cAttribute: DWORD, + rgAttribute: PCRYPT_ATTRIBUTE, +}} +pub type PCERT_REQUEST_INFO = *mut CERT_REQUEST_INFO; +pub const CERT_REQUEST_V1: DWORD = 0; +STRUCT!{struct CERT_KEYGEN_REQUEST_INFO { + dwVersion: DWORD, + SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, + pwszChallengeString: LPWSTR, +}} +pub type PCERT_KEYGEN_REQUEST_INFO = *mut CERT_KEYGEN_REQUEST_INFO; +pub const CERT_KEYGEN_REQUEST_V1: DWORD = 0; +STRUCT!{struct CERT_SIGNED_CONTENT_INFO { + ToBeSigned: CRYPT_DER_BLOB, + SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Signature: CRYPT_BIT_BLOB, +}} +pub type PCERT_SIGNED_CONTENT_INFO = *mut CERT_SIGNED_CONTENT_INFO; +STRUCT!{struct CTL_USAGE { + cUsageIdentifier: DWORD, + rgpszUsageIdentifier: *mut LPSTR, +}} +pub type PCTL_USAGE = *mut CTL_USAGE; +pub type CERT_ENHKEY_USAGE = CTL_USAGE; +pub type PCERT_ENHKEY_USAGE = *mut CERT_ENHKEY_USAGE; +pub type PCCTL_USAGE = *const CTL_USAGE; +pub type PCCERT_ENHKEY_USAGE = *const CERT_ENHKEY_USAGE; +STRUCT!{struct CTL_ENTRY { + SubjectIdentifier: CRYPT_DATA_BLOB, + cAttribute: DWORD, + rgAttribute: PCRYPT_ATTRIBUTE, +}} +pub type PCTL_ENTRY = *mut CTL_ENTRY; +STRUCT!{struct CTL_INFO { + dwVersion: DWORD, + SubjectUsage: CTL_USAGE, + ListIdentifier: CRYPT_DATA_BLOB, + SequenceNumber: CRYPT_INTEGER_BLOB, + ThisUpdate: FILETIME, + NextUpdate: FILETIME, + SubjectAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + cCTLEntry: DWORD, + rgCTLEntry: PCTL_ENTRY, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCTL_INFO = *mut CTL_INFO; +pub const CTL_V1: DWORD = 0; +STRUCT!{struct CRYPT_TIME_STAMP_REQUEST_INFO { + pszTimeStampAlgorithm: LPSTR, + pszContentType: LPSTR, + Content: CRYPT_OBJID_BLOB, + cAttribute: DWORD, + rgAttribute: PCRYPT_ATTRIBUTE, +}} +pub type PCRYPT_TIME_STAMP_REQUEST_INFO = *mut CRYPT_TIME_STAMP_REQUEST_INFO; +STRUCT!{struct CRYPT_ENROLLMENT_NAME_VALUE_PAIR { + pwszName: LPWSTR, + pwszValue: LPWSTR, +}} +pub type PCRYPT_ENROLLMENT_NAME_VALUE_PAIR = *mut CRYPT_ENROLLMENT_NAME_VALUE_PAIR; +STRUCT!{struct CRYPT_CSP_PROVIDER { + dwKeySpec: DWORD, + pwszProviderName: LPWSTR, + Signature: CRYPT_BIT_BLOB, +}} +pub type PCRYPT_CSP_PROVIDER = *mut CRYPT_CSP_PROVIDER; +pub const CERT_ENCODING_TYPE_MASK: DWORD = 0x0000FFFF; +pub const CMSG_ENCODING_TYPE_MASK: DWORD = 0xFFFF0000; +#[inline] +pub fn GET_CERT_ENCODING_TYPE(X: DWORD) -> DWORD { + X & CERT_ENCODING_TYPE_MASK +} +#[inline] +pub fn GET_CMSG_ENCODING_TYPE(X: DWORD) -> DWORD { + X & CMSG_ENCODING_TYPE_MASK +} +pub const CRYPT_ASN_ENCODING: DWORD = 0x00000001; +pub const CRYPT_NDR_ENCODING: DWORD = 0x00000002; +pub const X509_ASN_ENCODING: DWORD = 0x00000001; +pub const X509_NDR_ENCODING: DWORD = 0x00000002; +pub const PKCS_7_ASN_ENCODING: DWORD = 0x00010000; +pub const PKCS_7_NDR_ENCODING: DWORD = 0x00020000; +extern "system" { + pub fn CryptFormatObject( + dwCertEncodingType: DWORD, + dwFormatType: DWORD, + dwFormatStrType: DWORD, + pFormatStruct: *mut c_void, + lpszStructType: LPCSTR, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + pbFormat: *mut c_void, + pcbFormat: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_FORMAT_STR_MULTI_LINE: DWORD = 0x0001; +pub const CRYPT_FORMAT_STR_NO_HEX: DWORD = 0x0010; +pub const CRYPT_FORMAT_SIMPLE: DWORD = 0x0001; +pub const CRYPT_FORMAT_X509: DWORD = 0x0002; +pub const CRYPT_FORMAT_OID: DWORD = 0x0004; +pub const CRYPT_FORMAT_RDN_SEMICOLON: DWORD = 0x0100; +pub const CRYPT_FORMAT_RDN_CRLF: DWORD = 0x0200; +pub const CRYPT_FORMAT_RDN_UNQUOTE: DWORD = 0x0400; +pub const CRYPT_FORMAT_RDN_REVERSE: DWORD = 0x0800; +pub const CRYPT_FORMAT_COMMA: DWORD = 0x1000; +pub const CRYPT_FORMAT_SEMICOLON: DWORD = CRYPT_FORMAT_RDN_SEMICOLON; +pub const CRYPT_FORMAT_CRLF: DWORD = CRYPT_FORMAT_RDN_CRLF; +FN!{stdcall PFN_CRYPT_ALLOC( + cbSize: size_t, +) -> LPVOID} +FN!{stdcall PFN_CRYPT_FREE( + pv: LPVOID, +) -> ()} +STRUCT!{struct CRYPT_ENCODE_PARA { + cbSize: DWORD, + pfnAlloc: PFN_CRYPT_ALLOC, + pfnFree: PFN_CRYPT_FREE, +}} +pub type PCRYPT_ENCODE_PARA = *mut CRYPT_ENCODE_PARA; +extern "system" { + pub fn CryptEncodeObjectEx( + dwCertEncodingType: DWORD, + lpszStructType: LPCSTR, + pvStructInfo: *const c_void, + dwFlags: DWORD, + pEncodePara: PCRYPT_ENCODE_PARA, + pvEncoded: *mut c_void, + pcbEncoded: *mut DWORD, + ) -> BOOL; + pub fn CryptEncodeObject( + dwCertEncodingType: DWORD, + lpszStructType: LPCSTR, + pvStructInfo: *const c_void, + pbEncoded: *mut BYTE, + pcbEncoded: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: DWORD = 0x8; +pub const CRYPT_ENCODE_ALLOC_FLAG: DWORD = 0x8000; +pub const CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG: DWORD + = CERT_RDN_ENABLE_T61_UNICODE_FLAG; +pub const CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG: DWORD + = CERT_RDN_ENABLE_UTF8_UNICODE_FLAG; +pub const CRYPT_UNICODE_NAME_ENCODE_FORCE_UTF8_UNICODE_FLAG: DWORD + = CERT_RDN_FORCE_UTF8_UNICODE_FLAG; +pub const CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG: DWORD + = CERT_RDN_DISABLE_CHECK_TYPE_FLAG; +pub const CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: DWORD = 0x10000; +pub const CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG: DWORD = 0x20000; +pub const CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG: DWORD = 0x40000; +pub const CRYPT_ENCODE_ENABLE_IA5CONVERSION_FLAG: DWORD = CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG + | CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG; +STRUCT!{struct CRYPT_DECODE_PARA { + cbSize: DWORD, + pfnAlloc: PFN_CRYPT_ALLOC, + pfnFree: PFN_CRYPT_FREE, +}} +pub type PCRYPT_DECODE_PARA = *mut CRYPT_DECODE_PARA; +extern "system" { + pub fn CryptDecodeObjectEx( + dwCertEncodingType: DWORD, + lpszStructType: LPCSTR, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + dwFlags: DWORD, + pDecodePara: PCRYPT_DECODE_PARA, + pvStructInfo: *mut c_void, + pcbStructInfo: *mut DWORD, + ) -> BOOL; + pub fn CryptDecodeObject( + dwCertEncodingType: DWORD, + lpszStructType: LPCSTR, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + dwFlags: DWORD, + pvStructInfo: *mut c_void, + pcbStructInfo: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_DECODE_NOCOPY_FLAG: DWORD = 0x1; +pub const CRYPT_DECODE_TO_BE_SIGNED_FLAG: DWORD = 0x2; +pub const CRYPT_DECODE_SHARE_OID_STRING_FLAG: DWORD = 0x4; +pub const CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: DWORD = 0x8; +pub const CRYPT_DECODE_ALLOC_FLAG: DWORD = 0x8000; +pub const CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG: DWORD + = CERT_RDN_DISABLE_IE4_UTF8_FLAG; +pub const CRYPT_DECODE_ENABLE_PUNYCODE_FLAG: DWORD = 0x02000000; +pub const CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG: DWORD = 0x04000000; +pub const CRYPT_DECODE_ENABLE_IA5CONVERSION_FLAG: DWORD = CRYPT_DECODE_ENABLE_PUNYCODE_FLAG + | CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG; +pub const CRYPT_ENCODE_DECODE_NONE: LPCSTR = 0 as LPCSTR; +pub const X509_CERT: LPCSTR = 1 as LPCSTR; +pub const X509_CERT_TO_BE_SIGNED: LPCSTR = 2 as LPCSTR; +pub const X509_CERT_CRL_TO_BE_SIGNED: LPCSTR = 3 as LPCSTR; +pub const X509_CERT_REQUEST_TO_BE_SIGNED: LPCSTR = 4 as LPCSTR; +pub const X509_EXTENSIONS: LPCSTR = 5 as LPCSTR; +pub const X509_NAME_VALUE: LPCSTR = 6 as LPCSTR; +pub const X509_NAME: LPCSTR = 7 as LPCSTR; +pub const X509_PUBLIC_KEY_INFO: LPCSTR = 8 as LPCSTR; +pub const X509_AUTHORITY_KEY_ID: LPCSTR = 9 as LPCSTR; +pub const X509_KEY_ATTRIBUTES: LPCSTR = 10 as LPCSTR; +pub const X509_KEY_USAGE_RESTRICTION: LPCSTR = 11 as LPCSTR; +pub const X509_ALTERNATE_NAME: LPCSTR = 12 as LPCSTR; +pub const X509_BASIC_CONSTRAINTS: LPCSTR = 13 as LPCSTR; +pub const X509_KEY_USAGE: LPCSTR = 14 as LPCSTR; +pub const X509_BASIC_CONSTRAINTS2: LPCSTR = 15 as LPCSTR; +pub const X509_CERT_POLICIES: LPCSTR = 16 as LPCSTR; +pub const PKCS_UTC_TIME: LPCSTR = 17 as LPCSTR; +pub const PKCS_TIME_REQUEST: LPCSTR = 18 as LPCSTR; +pub const RSA_CSP_PUBLICKEYBLOB: LPCSTR = 19 as LPCSTR; +pub const X509_UNICODE_NAME: LPCSTR = 20 as LPCSTR; +pub const X509_KEYGEN_REQUEST_TO_BE_SIGNED: LPCSTR = 21 as LPCSTR; +pub const PKCS_ATTRIBUTE: LPCSTR = 22 as LPCSTR; +pub const PKCS_CONTENT_INFO_SEQUENCE_OF_ANY: LPCSTR = 23 as LPCSTR; +pub const X509_UNICODE_NAME_VALUE: LPCSTR = 24 as LPCSTR; +pub const X509_ANY_STRING: LPCSTR = X509_NAME_VALUE; +pub const X509_UNICODE_ANY_STRING: LPCSTR = X509_UNICODE_NAME_VALUE; +pub const X509_OCTET_STRING: LPCSTR = 25 as LPCSTR; +pub const X509_BITS: LPCSTR = 26 as LPCSTR; +pub const X509_INTEGER: LPCSTR = 27 as LPCSTR; +pub const X509_MULTI_BYTE_INTEGER: LPCSTR = 28 as LPCSTR; +pub const X509_ENUMERATED: LPCSTR = 29 as LPCSTR; +pub const X509_CHOICE_OF_TIME: LPCSTR = 30 as LPCSTR; +pub const X509_AUTHORITY_KEY_ID2: LPCSTR = 31 as LPCSTR; +pub const X509_AUTHORITY_INFO_ACCESS: LPCSTR = 32 as LPCSTR; +pub const X509_SUBJECT_INFO_ACCESS: LPCSTR = X509_AUTHORITY_INFO_ACCESS; +pub const X509_CRL_REASON_CODE: LPCSTR = X509_ENUMERATED; +pub const PKCS_CONTENT_INFO: LPCSTR = 33 as LPCSTR; +pub const X509_SEQUENCE_OF_ANY: LPCSTR = 34 as LPCSTR; +pub const X509_CRL_DIST_POINTS: LPCSTR = 35 as LPCSTR; +pub const X509_ENHANCED_KEY_USAGE: LPCSTR = 36 as LPCSTR; +pub const PKCS_CTL: LPCSTR = 37 as LPCSTR; +pub const X509_MULTI_BYTE_UINT: LPCSTR = 38 as LPCSTR; +pub const X509_DSS_PUBLICKEY: LPCSTR = X509_MULTI_BYTE_UINT; +pub const X509_DSS_PARAMETERS: LPCSTR = 39 as LPCSTR; +pub const X509_DSS_SIGNATURE: LPCSTR = 40 as LPCSTR; +pub const PKCS_RC2_CBC_PARAMETERS: LPCSTR = 41 as LPCSTR; +pub const PKCS_SMIME_CAPABILITIES: LPCSTR = 42 as LPCSTR; +pub const X509_QC_STATEMENTS_EXT: LPCSTR = 42 as LPCSTR; +pub const PKCS_RSA_PRIVATE_KEY: LPCSTR = 43 as LPCSTR; +pub const PKCS_PRIVATE_KEY_INFO: LPCSTR = 44 as LPCSTR; +pub const PKCS_ENCRYPTED_PRIVATE_KEY_INFO: LPCSTR = 45 as LPCSTR; +pub const X509_PKIX_POLICY_QUALIFIER_USERNOTICE: LPCSTR = 46 as LPCSTR; +pub const X509_DH_PUBLICKEY: LPCSTR = X509_MULTI_BYTE_UINT; +pub const X509_DH_PARAMETERS: LPCSTR = 47 as LPCSTR; +pub const PKCS_ATTRIBUTES: LPCSTR = 48 as LPCSTR; +pub const PKCS_SORTED_CTL: LPCSTR = 49 as LPCSTR; +pub const X509_ECC_SIGNATURE: LPCSTR = 47 as LPCSTR; +pub const X942_DH_PARAMETERS: LPCSTR = 50 as LPCSTR; +pub const X509_BITS_WITHOUT_TRAILING_ZEROES: LPCSTR = 51 as LPCSTR; +pub const X942_OTHER_INFO: LPCSTR = 52 as LPCSTR; +pub const X509_CERT_PAIR: LPCSTR = 53 as LPCSTR; +pub const X509_ISSUING_DIST_POINT: LPCSTR = 54 as LPCSTR; +pub const X509_NAME_CONSTRAINTS: LPCSTR = 55 as LPCSTR; +pub const X509_POLICY_MAPPINGS: LPCSTR = 56 as LPCSTR; +pub const X509_POLICY_CONSTRAINTS: LPCSTR = 57 as LPCSTR; +pub const X509_CROSS_CERT_DIST_POINTS: LPCSTR = 58 as LPCSTR; +pub const CMC_DATA: LPCSTR = 59 as LPCSTR; +pub const CMC_RESPONSE: LPCSTR = 60 as LPCSTR; +pub const CMC_STATUS: LPCSTR = 61 as LPCSTR; +pub const CMC_ADD_EXTENSIONS: LPCSTR = 62 as LPCSTR; +pub const CMC_ADD_ATTRIBUTES: LPCSTR = 63 as LPCSTR; +pub const X509_CERTIFICATE_TEMPLATE: LPCSTR = 64 as LPCSTR; +pub const OCSP_SIGNED_REQUEST: LPCSTR = 65 as LPCSTR; +pub const OCSP_REQUEST: LPCSTR = 66 as LPCSTR; +pub const OCSP_RESPONSE: LPCSTR = 67 as LPCSTR; +pub const OCSP_BASIC_SIGNED_RESPONSE: LPCSTR = 68 as LPCSTR; +pub const OCSP_BASIC_RESPONSE: LPCSTR = 69 as LPCSTR; +pub const X509_LOGOTYPE_EXT: LPCSTR = 70 as LPCSTR; +pub const X509_BIOMETRIC_EXT: LPCSTR = 71 as LPCSTR; +pub const CNG_RSA_PUBLIC_KEY_BLOB: LPCSTR = 72 as LPCSTR; +pub const X509_OBJECT_IDENTIFIER: LPCSTR = 73 as LPCSTR; +pub const X509_ALGORITHM_IDENTIFIER: LPCSTR = 74 as LPCSTR; +pub const PKCS_RSA_SSA_PSS_PARAMETERS: LPCSTR = 75 as LPCSTR; +pub const PKCS_RSAES_OAEP_PARAMETERS: LPCSTR = 76 as LPCSTR; +pub const ECC_CMS_SHARED_INFO: LPCSTR = 77 as LPCSTR; +pub const TIMESTAMP_REQUEST: LPCSTR = 78 as LPCSTR; +pub const TIMESTAMP_RESPONSE: LPCSTR = 79 as LPCSTR; +pub const TIMESTAMP_INFO: LPCSTR = 80 as LPCSTR; +pub const X509_CERT_BUNDLE: LPCSTR = 81 as LPCSTR; +pub const X509_ECC_PRIVATE_KEY: LPCSTR = 82 as LPCSTR; +pub const CNG_RSA_PRIVATE_KEY_BLOB: LPCSTR = 83 as LPCSTR; +pub const X509_SUBJECT_DIR_ATTRS: LPCSTR = 84 as LPCSTR; +pub const X509_ECC_PARAMETERS: LPCSTR = 85 as LPCSTR; +pub const PKCS7_SIGNER_INFO: LPCSTR = 500 as LPCSTR; +pub const CMS_SIGNER_INFO: LPCSTR = 501 as LPCSTR; +pub const szOID_AUTHORITY_KEY_IDENTIFIER: &'static str = "2.5.29.1"; +pub const szOID_KEY_ATTRIBUTES: &'static str = "2.5.29.2"; +pub const szOID_CERT_POLICIES_95: &'static str = "2.5.29.3"; +pub const szOID_KEY_USAGE_RESTRICTION: &'static str = "2.5.29.4"; +pub const szOID_SUBJECT_ALT_NAME: &'static str = "2.5.29.7"; +pub const szOID_ISSUER_ALT_NAME: &'static str = "2.5.29.8"; +pub const szOID_BASIC_CONSTRAINTS: &'static str = "2.5.29.10"; +pub const szOID_KEY_USAGE: &'static str = "2.5.29.15"; +pub const szOID_PRIVATEKEY_USAGE_PERIOD: &'static str = "2.5.29.16"; +pub const szOID_BASIC_CONSTRAINTS2: &'static str = "2.5.29.19"; +pub const szOID_CERT_POLICIES: &'static str = "2.5.29.32"; +pub const szOID_ANY_CERT_POLICY: &'static str = "2.5.29.32.0"; +pub const szOID_INHIBIT_ANY_POLICY: &'static str = "2.5.29.54"; +pub const szOID_AUTHORITY_KEY_IDENTIFIER2: &'static str = "2.5.29.35"; +pub const szOID_SUBJECT_KEY_IDENTIFIER: &'static str = "2.5.29.14"; +pub const szOID_SUBJECT_ALT_NAME2: &'static str = "2.5.29.17"; +pub const szOID_ISSUER_ALT_NAME2: &'static str = "2.5.29.18"; +pub const szOID_CRL_REASON_CODE: &'static str = "2.5.29.21"; +pub const szOID_REASON_CODE_HOLD: &'static str = "2.5.29.23"; +pub const szOID_CRL_DIST_POINTS: &'static str = "2.5.29.31"; +pub const szOID_ENHANCED_KEY_USAGE: &'static str = "2.5.29.37"; +pub const szOID_ANY_ENHANCED_KEY_USAGE: &'static str = "2.5.29.37.0"; +pub const szOID_CRL_NUMBER: &'static str = "2.5.29.20"; +pub const szOID_DELTA_CRL_INDICATOR: &'static str = "2.5.29.27"; +pub const szOID_ISSUING_DIST_POINT: &'static str = "2.5.29.28"; +pub const szOID_FRESHEST_CRL: &'static str = "2.5.29.46"; +pub const szOID_NAME_CONSTRAINTS: &'static str = "2.5.29.30"; +pub const szOID_POLICY_MAPPINGS: &'static str = "2.5.29.33"; +pub const szOID_LEGACY_POLICY_MAPPINGS: &'static str = "2.5.29.5"; +pub const szOID_POLICY_CONSTRAINTS: &'static str = "2.5.29.36"; +pub const szOID_RENEWAL_CERTIFICATE: &'static str = "1.3.6.1.4.1.311.13.1"; +pub const szOID_ENROLLMENT_NAME_VALUE_PAIR: &'static str = "1.3.6.1.4.1.311.13.2.1"; +pub const szOID_ENROLLMENT_CSP_PROVIDER: &'static str = "1.3.6.1.4.1.311.13.2.2"; +pub const szOID_OS_VERSION: &'static str = "1.3.6.1.4.1.311.13.2.3"; +pub const szOID_ENROLLMENT_AGENT: &'static str = "1.3.6.1.4.1.311.20.2.1"; +pub const szOID_PKIX: &'static str = "1.3.6.1.5.5.7"; +pub const szOID_PKIX_PE: &'static str = "1.3.6.1.5.5.7.1"; +pub const szOID_AUTHORITY_INFO_ACCESS: &'static str = "1.3.6.1.5.5.7.1.1"; +pub const szOID_SUBJECT_INFO_ACCESS: &'static str = "1.3.6.1.5.5.7.1.11"; +pub const szOID_BIOMETRIC_EXT: &'static str = "1.3.6.1.5.5.7.1.2"; +pub const szOID_QC_STATEMENTS_EXT: &'static str = "1.3.6.1.5.5.7.1.3"; +pub const szOID_LOGOTYPE_EXT: &'static str = "1.3.6.1.5.5.7.1.12"; +pub const szOID_TLS_FEATURES_EXT: &'static str = "1.3.6.1.5.5.7.1.24"; +pub const szOID_CERT_EXTENSIONS: &'static str = "1.3.6.1.4.1.311.2.1.14"; +pub const szOID_NEXT_UPDATE_LOCATION: &'static str = "1.3.6.1.4.1.311.10.2"; +pub const szOID_REMOVE_CERTIFICATE: &'static str = "1.3.6.1.4.1.311.10.8.1"; +pub const szOID_CROSS_CERT_DIST_POINTS: &'static str = "1.3.6.1.4.1.311.10.9.1"; +pub const szOID_CTL: &'static str = "1.3.6.1.4.1.311.10.1"; +pub const szOID_SORTED_CTL: &'static str = "1.3.6.1.4.1.311.10.1.1"; +pub const szOID_SERIALIZED: &'static str = "1.3.6.1.4.1.311.10.3.3.1"; +pub const szOID_NT_PRINCIPAL_NAME: &'static str = "1.3.6.1.4.1.311.20.2.3"; +pub const szOID_INTERNATIONALIZED_EMAIL_ADDRESS: &'static str = "1.3.6.1.4.1.311.20.2.4"; +pub const szOID_PRODUCT_UPDATE: &'static str = "1.3.6.1.4.1.311.31.1"; +pub const szOID_ANY_APPLICATION_POLICY: &'static str = "1.3.6.1.4.1.311.10.12.1"; +pub const szOID_AUTO_ENROLL_CTL_USAGE: &'static str = "1.3.6.1.4.1.311.20.1"; +pub const szOID_ENROLL_CERTTYPE_EXTENSION: &'static str = "1.3.6.1.4.1.311.20.2"; +pub const szOID_CERT_MANIFOLD: &'static str = "1.3.6.1.4.1.311.20.3"; +pub const szOID_CERTSRV_CA_VERSION: &'static str = "1.3.6.1.4.1.311.21.1"; +pub const szOID_CERTSRV_PREVIOUS_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.2"; +pub const szOID_CRL_VIRTUAL_BASE: &'static str = "1.3.6.1.4.1.311.21.3"; +pub const szOID_CRL_NEXT_PUBLISH: &'static str = "1.3.6.1.4.1.311.21.4"; +pub const szOID_KP_CA_EXCHANGE: &'static str = "1.3.6.1.4.1.311.21.5"; +pub const szOID_KP_PRIVACY_CA: &'static str = "1.3.6.1.4.1.311.21.36"; +pub const szOID_KP_KEY_RECOVERY_AGENT: &'static str = "1.3.6.1.4.1.311.21.6"; +pub const szOID_CERTIFICATE_TEMPLATE: &'static str = "1.3.6.1.4.1.311.21.7"; +pub const szOID_ENTERPRISE_OID_ROOT: &'static str = "1.3.6.1.4.1.311.21.8"; +pub const szOID_RDN_DUMMY_SIGNER: &'static str = "1.3.6.1.4.1.311.21.9"; +pub const szOID_APPLICATION_CERT_POLICIES: &'static str = "1.3.6.1.4.1.311.21.10"; +pub const szOID_APPLICATION_POLICY_MAPPINGS: &'static str = "1.3.6.1.4.1.311.21.11"; +pub const szOID_APPLICATION_POLICY_CONSTRAINTS: &'static str = "1.3.6.1.4.1.311.21.12"; +pub const szOID_ARCHIVED_KEY_ATTR: &'static str = "1.3.6.1.4.1.311.21.13"; +pub const szOID_CRL_SELF_CDP: &'static str = "1.3.6.1.4.1.311.21.14"; +pub const szOID_REQUIRE_CERT_CHAIN_POLICY: &'static str = "1.3.6.1.4.1.311.21.15"; +pub const szOID_ARCHIVED_KEY_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.16"; +pub const szOID_ISSUED_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.17"; +pub const szOID_DS_EMAIL_REPLICATION: &'static str = "1.3.6.1.4.1.311.21.19"; +pub const szOID_REQUEST_CLIENT_INFO: &'static str = "1.3.6.1.4.1.311.21.20"; +pub const szOID_ENCRYPTED_KEY_HASH: &'static str = "1.3.6.1.4.1.311.21.21"; +pub const szOID_CERTSRV_CROSSCA_VERSION: &'static str = "1.3.6.1.4.1.311.21.22"; +pub const szOID_NTDS_REPLICATION: &'static str = "1.3.6.1.4.1.311.25.1"; +pub const szOID_SUBJECT_DIR_ATTRS: &'static str = "2.5.29.9"; +pub const szOID_PKIX_KP: &'static str = "1.3.6.1.5.5.7.3"; +pub const szOID_PKIX_KP_SERVER_AUTH: &'static str = "1.3.6.1.5.5.7.3.1"; +pub const szOID_PKIX_KP_CLIENT_AUTH: &'static str = "1.3.6.1.5.5.7.3.2"; +pub const szOID_PKIX_KP_CODE_SIGNING: &'static str = "1.3.6.1.5.5.7.3.3"; +pub const szOID_PKIX_KP_EMAIL_PROTECTION: &'static str = "1.3.6.1.5.5.7.3.4"; +pub const szOID_PKIX_KP_IPSEC_END_SYSTEM: &'static str = "1.3.6.1.5.5.7.3.5"; +pub const szOID_PKIX_KP_IPSEC_TUNNEL: &'static str = "1.3.6.1.5.5.7.3.6"; +pub const szOID_PKIX_KP_IPSEC_USER: &'static str = "1.3.6.1.5.5.7.3.7"; +pub const szOID_PKIX_KP_TIMESTAMP_SIGNING: &'static str = "1.3.6.1.5.5.7.3.8"; +pub const szOID_PKIX_KP_OCSP_SIGNING: &'static str = "1.3.6.1.5.5.7.3.9"; +pub const szOID_PKIX_OCSP_NOCHECK: &'static str = "1.3.6.1.5.5.7.48.1.5"; +pub const szOID_PKIX_OCSP_NONCE: &'static str = "1.3.6.1.5.5.7.48.1.2"; +pub const szOID_IPSEC_KP_IKE_INTERMEDIATE: &'static str = "1.3.6.1.5.5.8.2.2"; +pub const szOID_PKINIT_KP_KDC: &'static str = "1.3.6.1.5.2.3.5"; +pub const szOID_KP_CTL_USAGE_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.1"; +pub const szOID_KP_TIME_STAMP_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.2"; +pub const szOID_SERVER_GATED_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.3"; +pub const szOID_SGC_NETSCAPE: &'static str = "2.16.840.1.113730.4.1"; +pub const szOID_KP_EFS: &'static str = "1.3.6.1.4.1.311.10.3.4"; +pub const szOID_EFS_RECOVERY: &'static str = "1.3.6.1.4.1.311.10.3.4.1"; +pub const szOID_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.5"; +pub const szOID_ATTEST_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.5.1"; +pub const szOID_NT5_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.6"; +pub const szOID_OEM_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.7"; +pub const szOID_EMBEDDED_NT_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.8"; +pub const szOID_ROOT_LIST_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.9"; +pub const szOID_KP_QUALIFIED_SUBORDINATION: &'static str = "1.3.6.1.4.1.311.10.3.10"; +pub const szOID_KP_KEY_RECOVERY: &'static str = "1.3.6.1.4.1.311.10.3.11"; +pub const szOID_KP_DOCUMENT_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.12"; +pub const szOID_KP_LIFETIME_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.13"; +pub const szOID_KP_MOBILE_DEVICE_SOFTWARE: &'static str = "1.3.6.1.4.1.311.10.3.14"; +pub const szOID_KP_SMART_DISPLAY: &'static str = "1.3.6.1.4.1.311.10.3.15"; +pub const szOID_KP_CSP_SIGNATURE: &'static str = "1.3.6.1.4.1.311.10.3.16"; +pub const szOID_KP_FLIGHT_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.27"; +pub const szOID_PLATFORM_MANIFEST_BINARY_ID: &'static str = "1.3.6.1.4.1.311.10.3.28"; +pub const szOID_DRM: &'static str = "1.3.6.1.4.1.311.10.5.1"; +pub const szOID_DRM_INDIVIDUALIZATION: &'static str = "1.3.6.1.4.1.311.10.5.2"; +pub const szOID_LICENSES: &'static str = "1.3.6.1.4.1.311.10.6.1"; +pub const szOID_LICENSE_SERVER: &'static str = "1.3.6.1.4.1.311.10.6.2"; +pub const szOID_KP_SMARTCARD_LOGON: &'static str = "1.3.6.1.4.1.311.20.2.2"; +pub const szOID_KP_KERNEL_MODE_CODE_SIGNING: &'static str = "1.3.6.1.4.1.311.61.1.1"; +pub const szOID_KP_KERNEL_MODE_TRUSTED_BOOT_SIGNING: &'static str = "1.3.6.1.4.1.311.61.4.1"; +pub const szOID_REVOKED_LIST_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.19"; +pub const szOID_WINDOWS_KITS_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.20"; +pub const szOID_WINDOWS_RT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.21"; +pub const szOID_PROTECTED_PROCESS_LIGHT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.22"; +pub const szOID_WINDOWS_TCB_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.23"; +pub const szOID_PROTECTED_PROCESS_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.24"; +pub const szOID_WINDOWS_THIRD_PARTY_COMPONENT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.25"; +pub const szOID_WINDOWS_SOFTWARE_EXTENSION_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.26"; +pub const szOID_DISALLOWED_LIST: &'static str = "1.3.6.1.4.1.311.10.3.30"; +pub const szOID_PIN_RULES_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.31"; +pub const szOID_PIN_RULES_CTL: &'static str = "1.3.6.1.4.1.311.10.3.32"; +pub const szOID_PIN_RULES_EXT: &'static str = "1.3.6.1.4.1.311.10.3.33"; +pub const szOID_PIN_RULES_DOMAIN_NAME: &'static str = "1.3.6.1.4.1.311.10.3.34"; +pub const szOID_PIN_RULES_LOG_END_DATE_EXT: &'static str = "1.3.6.1.4.1.311.10.3.35"; +pub const szOID_IUM_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.37"; +pub const szOID_EV_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.39"; +pub const szOID_SYNC_ROOT_CTL_EXT: &'static str = "1.3.6.1.4.1.311.10.3.50"; +pub const szOID_HPKP_DOMAIN_NAME_CTL: &'static str = "1.3.6.1.4.1.311.10.3.60"; +pub const szOID_HPKP_HEADER_VALUE_CTL: &'static str = "1.3.6.1.4.1.311.10.3.61"; +pub const szOID_KP_KERNEL_MODE_HAL_EXTENSION_SIGNING: &'static str = "1.3.6.1.4.1.311.61.5.1"; +pub const szOID_WINDOWS_STORE_SIGNER: &'static str = "1.3.6.1.4.1.311.76.3.1"; +pub const szOID_DYNAMIC_CODE_GEN_SIGNER: &'static str = "1.3.6.1.4.1.311.76.5.1"; +pub const szOID_MICROSOFT_PUBLISHER_SIGNER: &'static str = "1.3.6.1.4.1.311.76.8.1"; +pub const szOID_YESNO_TRUST_ATTR: &'static str = "1.3.6.1.4.1.311.10.4.1"; +pub const szOID_SITE_PIN_RULES_INDEX_ATTR: &'static str = "1.3.6.1.4.1.311.10.4.2"; +pub const szOID_SITE_PIN_RULES_FLAGS_ATTR: &'static str = "1.3.6.1.4.1.311.10.4.3"; +pub const szOID_PKIX_POLICY_QUALIFIER_CPS: &'static str = "1.3.6.1.5.5.7.2.1"; +pub const szOID_PKIX_POLICY_QUALIFIER_USERNOTICE: &'static str = "1.3.6.1.5.5.7.2.2"; +pub const szOID_ROOT_PROGRAM_FLAGS: &'static str = "1.3.6.1.4.1.311.60.1.1"; +pub const CERT_ROOT_PROGRAM_FLAG_ORG: DWORD = 0x80; +pub const CERT_ROOT_PROGRAM_FLAG_LSC: DWORD = 0x40; +pub const CERT_ROOT_PROGRAM_FLAG_SUBJECT_LOGO: DWORD = 0x20; +pub const CERT_ROOT_PROGRAM_FLAG_OU: DWORD = 0x10; +pub const CERT_ROOT_PROGRAM_FLAG_ADDRESS: DWORD = 0x08; +pub const szOID_CERT_POLICIES_95_QUALIFIER1: &'static str = "2.16.840.1.113733.1.7.1.1"; +pub const szOID_RDN_TPM_MANUFACTURER: &'static str = "2.23.133.2.1"; +pub const szOID_RDN_TPM_MODEL: &'static str = "2.23.133.2.2"; +pub const szOID_RDN_TPM_VERSION: &'static str = "2.23.133.2.3"; +pub const szOID_RDN_TCG_PLATFORM_MANUFACTURER: &'static str = "2.23.133.2.4"; +pub const szOID_RDN_TCG_PLATFORM_MODEL: &'static str = "2.23.133.2.5"; +pub const szOID_RDN_TCG_PLATFORM_VERSION: &'static str = "2.23.133.2.6"; +pub const szOID_ENROLL_EK_INFO: &'static str = "1.3.6.1.4.1.311.21.23"; +pub const szOID_ENROLL_AIK_INFO: &'static str = "1.3.6.1.4.1.311.21.39"; +pub const szOID_ENROLL_ATTESTATION_STATEMENT: &'static str = "1.3.6.1.4.1.311.21.24"; +pub const szOID_ENROLL_KSP_NAME: &'static str = "1.3.6.1.4.1.311.21.25"; +pub const szOID_ENROLL_EKPUB_CHALLENGE: &'static str = "1.3.6.1.4.1.311.21.26"; +pub const szOID_ENROLL_CAXCHGCERT_HASH: &'static str = "1.3.6.1.4.1.311.21.27"; +pub const szOID_ENROLL_ATTESTATION_CHALLENGE: &'static str = "1.3.6.1.4.1.311.21.28"; +pub const szOID_ENROLL_ENCRYPTION_ALGORITHM: &'static str = "1.3.6.1.4.1.311.21.29"; +pub const szOID_KP_TPM_EK_CERTIFICATE: &'static str = "2.23.133.8.1"; +pub const szOID_KP_TPM_PLATFORM_CERTIFICATE: &'static str = "2.23.133.8.2"; +pub const szOID_KP_TPM_AIK_CERTIFICATE: &'static str = "2.23.133.8.3"; +pub const szOID_ENROLL_EKVERIFYKEY: &'static str = "1.3.6.1.4.1.311.21.30"; +pub const szOID_ENROLL_EKVERIFYCERT: &'static str = "1.3.6.1.4.1.311.21.31"; +pub const szOID_ENROLL_EKVERIFYCREDS: &'static str = "1.3.6.1.4.1.311.21.32"; +pub const szOID_ENROLL_SCEP_ERROR: &'static str = "1.3.6.1.4.1.311.21.33"; +pub const szOID_ENROLL_SCEP_SERVER_STATE: &'static str = "1.3.6.1.4.1.311.21.34"; +pub const szOID_ENROLL_SCEP_CHALLENGE_ANSWER: &'static str = "1.3.6.1.4.1.311.21.35"; +pub const szOID_ENROLL_SCEP_CLIENT_REQUEST: &'static str = "1.3.6.1.4.1.311.21.37"; +pub const szOID_ENROLL_SCEP_SERVER_MESSAGE: &'static str = "1.3.6.1.4.1.311.21.38"; +pub const szOID_ENROLL_SCEP_SERVER_SECRET: &'static str = "1.3.6.1.4.1.311.21.40"; +pub const szOID_ENROLL_KEY_AFFINITY: &'static str = "1.3.6.1.4.1.311.21.41"; +pub const szOID_ENROLL_SCEP_SIGNER_HASH: &'static str = "1.3.6.1.4.1.311.21.42"; +pub const szOID_ENROLL_EK_CA_KEYID: &'static str = "1.3.6.1.4.1.311.21.43"; +pub const szOID_ATTR_SUPPORTED_ALGORITHMS: &'static str = "2.5.4.52"; +pub const szOID_ATTR_TPM_SPECIFICATION: &'static str = "2.23.133.2.16"; +pub const szOID_ATTR_PLATFORM_SPECIFICATION: &'static str = "2.23.133.2.17"; +pub const szOID_ATTR_TPM_SECURITY_ASSERTIONS: &'static str = "2.23.133.2.18"; +STRUCT!{struct CERT_EXTENSIONS { + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCERT_EXTENSIONS = *mut CERT_EXTENSIONS; +pub const CERT_UNICODE_RDN_ERR_INDEX_MASK: DWORD = 0x3FF; +pub const CERT_UNICODE_RDN_ERR_INDEX_SHIFT: DWORD = 22; +pub const CERT_UNICODE_ATTR_ERR_INDEX_MASK: DWORD = 0x003F; +pub const CERT_UNICODE_ATTR_ERR_INDEX_SHIFT: DWORD = 16; +pub const CERT_UNICODE_VALUE_ERR_INDEX_MASK: DWORD = 0x0000FFFF; +pub const CERT_UNICODE_VALUE_ERR_INDEX_SHIFT: DWORD = 0; +#[inline] +pub fn GET_CERT_UNICODE_RDN_ERR_INDEX(X: DWORD) -> DWORD { + (X >> CERT_UNICODE_RDN_ERR_INDEX_SHIFT) & CERT_UNICODE_RDN_ERR_INDEX_MASK +} +#[inline] +pub fn GET_CERT_UNICODE_ATTR_ERR_INDEX(X: DWORD) -> DWORD { + (X >> CERT_UNICODE_ATTR_ERR_INDEX_SHIFT) & CERT_UNICODE_ATTR_ERR_INDEX_MASK +} +#[inline] +pub fn GET_CERT_UNICODE_VALUE_ERR_INDEX(X: DWORD) -> DWORD { + X & CERT_UNICODE_VALUE_ERR_INDEX_MASK +} +STRUCT!{struct CERT_AUTHORITY_KEY_ID_INFO { + KeyId: CRYPT_DATA_BLOB, + CertIssuer: CERT_NAME_BLOB, + CertSerialNumber: CRYPT_INTEGER_BLOB, +}} +pub type PCERT_AUTHORITY_KEY_ID_INFO = *mut CERT_AUTHORITY_KEY_ID_INFO; +STRUCT!{struct CERT_PRIVATE_KEY_VALIDITY { + NotBefore: FILETIME, + NotAfter: FILETIME, +}} +pub type PCERT_PRIVATE_KEY_VALIDITY = *mut CERT_PRIVATE_KEY_VALIDITY; +STRUCT!{struct CERT_KEY_ATTRIBUTES_INFO { + KeyId: CRYPT_DATA_BLOB, + IntendedKeyUsage: CRYPT_BIT_BLOB, + pPrivateKeyUsagePeriod: PCERT_PRIVATE_KEY_VALIDITY, +}} +pub type PCERT_KEY_ATTRIBUTES_INFO = *mut CERT_KEY_ATTRIBUTES_INFO; +pub const CERT_DIGITAL_SIGNATURE_KEY_USAGE: DWORD = 0x80; +pub const CERT_NON_REPUDIATION_KEY_USAGE: DWORD = 0x40; +pub const CERT_KEY_ENCIPHERMENT_KEY_USAGE: DWORD = 0x20; +pub const CERT_DATA_ENCIPHERMENT_KEY_USAGE: DWORD = 0x10; +pub const CERT_KEY_AGREEMENT_KEY_USAGE: DWORD = 0x08; +pub const CERT_KEY_CERT_SIGN_KEY_USAGE: DWORD = 0x04; +pub const CERT_OFFLINE_CRL_SIGN_KEY_USAGE: DWORD = 0x02; +pub const CERT_CRL_SIGN_KEY_USAGE: DWORD = 0x02; +pub const CERT_ENCIPHER_ONLY_KEY_USAGE: DWORD = 0x01; +pub const CERT_DECIPHER_ONLY_KEY_USAGE: DWORD = 0x80; +STRUCT!{struct CERT_POLICY_ID { + cCertPolicyElementId: DWORD, + rgpszCertPolicyElementId: *mut LPSTR, +}} +pub type PCERT_POLICY_ID = *mut CERT_POLICY_ID; +STRUCT!{struct CERT_KEY_USAGE_RESTRICTION_INFO { + cCertPolicyId: DWORD, + rgCertPolicyId: PCERT_POLICY_ID, + RestrictedKeyUsage: CRYPT_BIT_BLOB, +}} +pub type PCERT_KEY_USAGE_RESTRICTION_INFO = *mut CERT_KEY_USAGE_RESTRICTION_INFO; +STRUCT!{struct CERT_OTHER_NAME { + pszObjId: LPSTR, + Value: CRYPT_OBJID_BLOB, +}} +pub type PCERT_OTHER_NAME = *mut CERT_OTHER_NAME; +UNION!{union CERT_ALT_NAME_ENTRY_u { + [usize; 2], + pOtherName pOtherName_mut: PCERT_OTHER_NAME, + pwszRfc822Name pwszRfc822Name_mut: LPWSTR, + pwszDNSName pwszDNSName_mut: LPWSTR, + DirectoryName DirectoryName_mut: CERT_NAME_BLOB, + pwszURL pwszURL_mut: LPWSTR, + IPAddress IPAddress_mut: CRYPT_DATA_BLOB, + pszRegisteredID pszRegisteredID_mut: LPSTR, +}} +STRUCT!{struct CERT_ALT_NAME_ENTRY { + dwAltNameChoice: DWORD, + u: CERT_ALT_NAME_ENTRY_u, +}} +pub type PCERT_ALT_NAME_ENTRY = *mut CERT_ALT_NAME_ENTRY; +pub const CERT_ALT_NAME_OTHER_NAME: DWORD = 1; +pub const CERT_ALT_NAME_RFC822_NAME: DWORD = 2; +pub const CERT_ALT_NAME_DNS_NAME: DWORD = 3; +pub const CERT_ALT_NAME_X400_ADDRESS: DWORD = 4; +pub const CERT_ALT_NAME_DIRECTORY_NAME: DWORD = 5; +pub const CERT_ALT_NAME_EDI_PARTY_NAME: DWORD = 6; +pub const CERT_ALT_NAME_URL: DWORD = 7; +pub const CERT_ALT_NAME_IP_ADDRESS: DWORD = 8; +pub const CERT_ALT_NAME_REGISTERED_ID: DWORD = 9; +STRUCT!{struct CERT_ALT_NAME_INFO { + cAltEntry: DWORD, + rgAltEntry: PCERT_ALT_NAME_ENTRY, +}} +pub type PCERT_ALT_NAME_INFO = *mut CERT_ALT_NAME_INFO; +pub const CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK: DWORD = 0xFF; +pub const CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT: DWORD = 16; +pub const CERT_ALT_NAME_VALUE_ERR_INDEX_MASK: DWORD = 0x0000FFFF; +pub const CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT: DWORD = 0; +#[inline] +pub fn GET_CERT_ALT_NAME_ENTRY_ERR_INDEX(X: DWORD) -> DWORD { + (X >> CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT) & CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK +} +#[inline] +pub fn GET_CERT_ALT_NAME_VALUE_ERR_INDEX(X: DWORD) -> DWORD { + X & CERT_ALT_NAME_VALUE_ERR_INDEX_MASK +} +STRUCT!{struct CERT_BASIC_CONSTRAINTS_INFO { + SubjectType: CRYPT_BIT_BLOB, + fPathLenConstraint: BOOL, + dwPathLenConstraint: DWORD, + cSubtreesConstraint: DWORD, + rgSubtreesConstraint: *mut CERT_NAME_BLOB, +}} +pub type PCERT_BASIC_CONSTRAINTS_INFO = *mut CERT_BASIC_CONSTRAINTS_INFO; +pub const CERT_CA_SUBJECT_FLAG: DWORD = 0x80; +pub const CERT_END_ENTITY_SUBJECT_FLAG: DWORD = 0x40; +STRUCT!{struct CERT_BASIC_CONSTRAINTS2_INFO { + fCA: BOOL, + fPathLenConstraint: BOOL, + dwPathLenConstraint: DWORD, +}} +pub type PCERT_BASIC_CONSTRAINTS2_INFO = *mut CERT_BASIC_CONSTRAINTS2_INFO; +STRUCT!{struct CERT_POLICY_QUALIFIER_INFO { + pszPolicyQualifierId: LPSTR, + Qualifier: CRYPT_OBJID_BLOB, +}} +pub type PCERT_POLICY_QUALIFIER_INFO = *mut CERT_POLICY_QUALIFIER_INFO; +STRUCT!{struct CERT_POLICY_INFO { + pszPolicyIdentifier: LPSTR, + cPolicyQualifier: DWORD, + rgPolicyQualifier: *mut CERT_POLICY_QUALIFIER_INFO, +}} +pub type PCERT_POLICY_INFO = *mut CERT_POLICY_INFO; +STRUCT!{struct CERT_POLICIES_INFO { + cPolicyInfo: DWORD, + rgPolicyInfo: *mut CERT_POLICY_INFO, +}} +pub type PCERT_POLICIES_INFO = *mut CERT_POLICIES_INFO; +STRUCT!{struct CERT_POLICY_QUALIFIER_NOTICE_REFERENCE { + pszOrganization: LPSTR, + cNoticeNumbers: DWORD, + rgNoticeNumbers: *mut c_int, +}} +pub type PCERT_POLICY_QUALIFIER_NOTICE_REFERENCE = *mut CERT_POLICY_QUALIFIER_NOTICE_REFERENCE; +STRUCT!{struct CERT_POLICY_QUALIFIER_USER_NOTICE { + pNoticeReference: *mut CERT_POLICY_QUALIFIER_NOTICE_REFERENCE, + pszDisplayText: LPWSTR, +}} +pub type PCERT_POLICY_QUALIFIER_USER_NOTICE = *mut CERT_POLICY_QUALIFIER_USER_NOTICE; +STRUCT!{struct CPS_URLS { + pszURL: LPWSTR, + pAlgorithm: *mut CRYPT_ALGORITHM_IDENTIFIER, + pDigest: *mut CRYPT_DATA_BLOB, +}} +pub type PCPS_URLS = *mut CPS_URLS; +STRUCT!{struct CERT_POLICY95_QUALIFIER1 { + pszPracticesReference: LPWSTR, + pszNoticeIdentifier: LPSTR, + pszNSINoticeIdentifier: LPSTR, + cCPSURLs: DWORD, + rgCPSURLs: *mut CPS_URLS, +}} +pub type PCERT_POLICY95_QUALIFIER1 = *mut CERT_POLICY95_QUALIFIER1; +STRUCT!{struct CERT_POLICY_MAPPING { + pszIssuerDomainPolicy: LPSTR, + pszSubjectDomainPolicy: LPSTR, +}} +pub type PCERT_POLICY_MAPPING = *mut CERT_POLICY_MAPPING; +STRUCT!{struct CERT_POLICY_MAPPINGS_INFO { + cPolicyMapping: DWORD, + rgPolicyMapping: PCERT_POLICY_MAPPING, +}} +pub type PCERT_POLICY_MAPPINGS_INFO = *mut CERT_POLICY_MAPPINGS_INFO; +STRUCT!{struct CERT_POLICY_CONSTRAINTS_INFO { + fRequireExplicitPolicy: BOOL, + dwRequireExplicitPolicySkipCerts: DWORD, + fInhibitPolicyMapping: BOOL, + dwInhibitPolicyMappingSkipCerts: DWORD, +}} +pub type PCERT_POLICY_CONSTRAINTS_INFO = *mut CERT_POLICY_CONSTRAINTS_INFO; +STRUCT!{struct CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY { + pszObjId: LPSTR, + cValue: DWORD, + rgValue: PCRYPT_DER_BLOB, +}} +pub type PCRYPT_CONTENT_INFO_SEQUENCE_OF_ANY = *mut CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY; +STRUCT!{struct CRYPT_CONTENT_INFO { + pszObjId: LPSTR, + Content: CRYPT_DER_BLOB, +}} +pub type PCRYPT_CONTENT_INFO = *mut CRYPT_CONTENT_INFO; +STRUCT!{struct CRYPT_SEQUENCE_OF_ANY { + cValue: DWORD, + rgValue: PCRYPT_DER_BLOB, +}} +pub type PCRYPT_SEQUENCE_OF_ANY = *mut CRYPT_SEQUENCE_OF_ANY; +STRUCT!{struct CERT_AUTHORITY_KEY_ID2_INFO { + KeyId: CRYPT_DATA_BLOB, + AuthorityCertIssuer: CERT_ALT_NAME_INFO, + AuthorityCertSerialNumber: CRYPT_INTEGER_BLOB, +}} +pub type PCERT_AUTHORITY_KEY_ID2_INFO = *mut CERT_AUTHORITY_KEY_ID2_INFO; +STRUCT!{struct CERT_ACCESS_DESCRIPTION { + pszAccessMethod: LPSTR, + AccessLocation: CERT_ALT_NAME_ENTRY, +}} +pub type PCERT_ACCESS_DESCRIPTION = *mut CERT_ACCESS_DESCRIPTION; +STRUCT!{struct CERT_AUTHORITY_INFO_ACCESS { + cAccDescr: DWORD, + rgAccDescr: PCERT_ACCESS_DESCRIPTION, +}} +pub type PCERT_AUTHORITY_INFO_ACCESS = *mut CERT_AUTHORITY_INFO_ACCESS; +pub type CERT_SUBJECT_INFO_ACCESS = CERT_AUTHORITY_INFO_ACCESS; +pub type PCERT_SUBJECT_INFO_ACCESS = *mut CERT_AUTHORITY_INFO_ACCESS; +pub const szOID_PKIX_ACC_DESCR: &'static str = "1.3.6.1.5.5.7.48"; +pub const szOID_PKIX_OCSP: &'static str = "1.3.6.1.5.5.7.48.1"; +pub const szOID_PKIX_CA_ISSUERS: &'static str = "1.3.6.1.5.5.7.48.2"; +pub const szOID_PKIX_TIME_STAMPING: &'static str = "1.3.6.1.5.5.7.48.3"; +pub const szOID_PKIX_CA_REPOSITORY: &'static str = "1.3.6.1.5.5.7.48.5"; +pub const CRL_REASON_UNSPECIFIED: DWORD = 0; +pub const CRL_REASON_KEY_COMPROMISE: DWORD = 1; +pub const CRL_REASON_CA_COMPROMISE: DWORD = 2; +pub const CRL_REASON_AFFILIATION_CHANGED: DWORD = 3; +pub const CRL_REASON_SUPERSEDED: DWORD = 4; +pub const CRL_REASON_CESSATION_OF_OPERATION: DWORD = 5; +pub const CRL_REASON_CERTIFICATE_HOLD: DWORD = 6; +pub const CRL_REASON_REMOVE_FROM_CRL: DWORD = 8; +pub const CRL_REASON_PRIVILEGE_WITHDRAWN: DWORD = 9; +pub const CRL_REASON_AA_COMPROMISE: DWORD = 10; +UNION!{union CRL_DIST_POINT_NAME_u { + [usize; 2], + FullName FullName_mut: CERT_ALT_NAME_INFO, +}} +STRUCT!{struct CRL_DIST_POINT_NAME { + dwDistPointNameChoice: DWORD, + u: CRL_DIST_POINT_NAME_u, +}} +pub type PCRL_DIST_POINT_NAME = *mut CRL_DIST_POINT_NAME; +pub const CRL_DIST_POINT_NO_NAME: DWORD = 0; +pub const CRL_DIST_POINT_FULL_NAME: DWORD = 1; +pub const CRL_DIST_POINT_ISSUER_RDN_NAME: DWORD = 2; +STRUCT!{struct CRL_DIST_POINT { + DistPointName: CRL_DIST_POINT_NAME, + ReasonFlags: CRYPT_BIT_BLOB, + CRLIssuer: CERT_ALT_NAME_INFO, +}} +pub type PCRL_DIST_POINT = *mut CRL_DIST_POINT; +pub const CRL_REASON_UNUSED_FLAG: DWORD = 0x80; +pub const CRL_REASON_KEY_COMPROMISE_FLAG: DWORD = 0x40; +pub const CRL_REASON_CA_COMPROMISE_FLAG: DWORD = 0x20; +pub const CRL_REASON_AFFILIATION_CHANGED_FLAG: DWORD = 0x10; +pub const CRL_REASON_SUPERSEDED_FLAG: DWORD = 0x08; +pub const CRL_REASON_CESSATION_OF_OPERATION_FLAG: DWORD = 0x04; +pub const CRL_REASON_CERTIFICATE_HOLD_FLAG: DWORD = 0x02; +pub const CRL_REASON_PRIVILEGE_WITHDRAWN_FLAG: DWORD = 0x01; +pub const CRL_REASON_AA_COMPROMISE_FLAG: DWORD = 0x80; +STRUCT!{struct CRL_DIST_POINTS_INFO { + cDistPoint: DWORD, + rgDistPoint: PCRL_DIST_POINT, +}} +pub type PCRL_DIST_POINTS_INFO = *mut CRL_DIST_POINTS_INFO; +pub const CRL_DIST_POINT_ERR_INDEX_MASK: DWORD = 0x7F; +pub const CRL_DIST_POINT_ERR_INDEX_SHIFT: DWORD = 24; +#[inline] +pub fn GET_CRL_DIST_POINT_ERR_INDEX(X: DWORD) -> DWORD { + (X >> CRL_DIST_POINT_ERR_INDEX_SHIFT) & CRL_DIST_POINT_ERR_INDEX_MASK +} +pub const CRL_DIST_POINT_ERR_CRL_ISSUER_BIT: DWORD = 0x80000000; +#[inline] +pub fn IS_CRL_DIST_POINT_ERR_CRL_ISSUER(X: DWORD) -> bool { + 0 != (X & CRL_DIST_POINT_ERR_CRL_ISSUER_BIT) +} +STRUCT!{struct CROSS_CERT_DIST_POINTS_INFO { + dwSyncDeltaTime: DWORD, + cDistPoint: DWORD, + rgDistPoint: PCERT_ALT_NAME_INFO, +}} +pub type PCROSS_CERT_DIST_POINTS_INFO = *mut CROSS_CERT_DIST_POINTS_INFO; +pub const CROSS_CERT_DIST_POINT_ERR_INDEX_MASK: DWORD = 0xFF; +pub const CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT: DWORD = 24; +#[inline] +pub fn GET_CROSS_CERT_DIST_POINT_ERR_INDEX(X: DWORD) -> DWORD { + (X >> CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT) & CROSS_CERT_DIST_POINT_ERR_INDEX_MASK +} +STRUCT!{struct CERT_PAIR { + Forward: CERT_BLOB, + Reverse: CERT_BLOB, +}} +pub type PCERT_PAIR = *mut CERT_PAIR; +STRUCT!{struct CRL_ISSUING_DIST_POINT { + DistPointName: CRL_DIST_POINT_NAME, + fOnlyContainsUserCerts: BOOL, + fOnlyContainsCACerts: BOOL, + OnlySomeReasonFlags: CRYPT_BIT_BLOB, + fIndirectCRL: BOOL, +}} +pub type PCRL_ISSUING_DIST_POINT = *mut CRL_ISSUING_DIST_POINT; +STRUCT!{struct CERT_GENERAL_SUBTREE { + Base: CERT_ALT_NAME_ENTRY, + dwMinimum: DWORD, + fMaximum: BOOL, + dwMaximum: DWORD, +}} +pub type PCERT_GENERAL_SUBTREE = *mut CERT_GENERAL_SUBTREE; +STRUCT!{struct CERT_NAME_CONSTRAINTS_INFO { + cPermittedSubtree: DWORD, + rgPermittedSubtree: PCERT_GENERAL_SUBTREE, + cExcludedSubtree: DWORD, + rgExcludedSubtree: PCERT_GENERAL_SUBTREE, +}} +pub type PCERT_NAME_CONSTRAINTS_INFO = *mut CERT_NAME_CONSTRAINTS_INFO; +pub const CERT_EXCLUDED_SUBTREE_BIT: DWORD = 0x80000000; +#[inline] +pub fn IS_CERT_EXCLUDED_SUBTREE(X: DWORD) -> bool { + 0 != (X & CERT_EXCLUDED_SUBTREE_BIT) +} +pub const SORTED_CTL_EXT_FLAGS_OFFSET: c_int = 0 * 4; +pub const SORTED_CTL_EXT_COUNT_OFFSET: c_int = 1 * 4; +pub const SORTED_CTL_EXT_MAX_COLLISION_OFFSET: c_int = 2 * 4; +pub const SORTED_CTL_EXT_HASH_BUCKET_OFFSET: c_int = 3 * 4; +pub const SORTED_CTL_EXT_HASHED_SUBJECT_IDENTIFIER_FLAG: DWORD = 0x1; +STRUCT!{struct CERT_DSS_PARAMETERS { + p: CRYPT_UINT_BLOB, + q: CRYPT_UINT_BLOB, + g: CRYPT_UINT_BLOB, +}} +pub type PCERT_DSS_PARAMETERS = *mut CERT_DSS_PARAMETERS; +pub const CERT_DSS_R_LEN: usize = 20; +pub const CERT_DSS_S_LEN: usize = 20; +pub const CERT_DSS_SIGNATURE_LEN: usize = CERT_DSS_R_LEN + CERT_DSS_S_LEN; +pub const CERT_MAX_ASN_ENCODED_DSS_SIGNATURE_LEN: usize = 2 + 2 * (2 + 20 + 1); +STRUCT!{struct CERT_DH_PARAMETERS { + p: CRYPT_UINT_BLOB, + g: CRYPT_UINT_BLOB, +}} +pub type PCERT_DH_PARAMETERS = *mut CERT_DH_PARAMETERS; +STRUCT!{struct CERT_ECC_SIGNATURE { + r: CRYPT_UINT_BLOB, + s: CRYPT_UINT_BLOB, +}} +pub type PCERT_ECC_SIGNATURE = *mut CERT_ECC_SIGNATURE; +STRUCT!{struct CERT_X942_DH_VALIDATION_PARAMS { + seed: CRYPT_BIT_BLOB, + pgenCounter: DWORD, +}} +pub type PCERT_X942_DH_VALIDATION_PARAMS = *mut CERT_X942_DH_VALIDATION_PARAMS; +STRUCT!{struct CERT_X942_DH_PARAMETERS { + p: CRYPT_UINT_BLOB, + g: CRYPT_UINT_BLOB, + q: CRYPT_UINT_BLOB, + j: CRYPT_UINT_BLOB, + pValidationParams: PCERT_X942_DH_VALIDATION_PARAMS, +}} +pub type PCERT_X942_DH_PARAMETERS = *mut CERT_X942_DH_PARAMETERS; +pub const CRYPT_X942_COUNTER_BYTE_LENGTH: usize = 4; +pub const CRYPT_X942_KEY_LENGTH_BYTE_LENGTH: usize = 4; +pub const CRYPT_X942_PUB_INFO_BYTE_LENGTH: usize = 512 / 8; +STRUCT!{struct CRYPT_X942_OTHER_INFO { + pszContentEncryptionObjId: LPSTR, + rgbCounter: [BYTE; CRYPT_X942_COUNTER_BYTE_LENGTH], + rgbKeyLength: [BYTE; CRYPT_X942_KEY_LENGTH_BYTE_LENGTH], + PubInfo: CRYPT_DATA_BLOB, +}} +pub type PCRYPT_X942_OTHER_INFO = *mut CRYPT_X942_OTHER_INFO; +pub const CRYPT_ECC_CMS_SHARED_INFO_SUPPPUBINFO_BYTE_LENGTH: usize = 4; +STRUCT!{struct CRYPT_ECC_CMS_SHARED_INFO { + Algorithm: CRYPT_ALGORITHM_IDENTIFIER, + EntityUInfo: CRYPT_DATA_BLOB, + rgbSuppPubInfo: [BYTE; CRYPT_ECC_CMS_SHARED_INFO_SUPPPUBINFO_BYTE_LENGTH], +}} +pub type PCRYPT_ECC_CMS_SHARED_INFO = *mut CRYPT_ECC_CMS_SHARED_INFO; +STRUCT!{struct CRYPT_RC2_CBC_PARAMETERS { + dwVersion: DWORD, + fIV: BOOL, + rgbIV: [BYTE; 8], +}} +pub type PCRYPT_RC2_CBC_PARAMETERS = *mut CRYPT_RC2_CBC_PARAMETERS; +pub const CRYPT_RC2_40BIT_VERSION: DWORD = 160; +pub const CRYPT_RC2_56BIT_VERSION: DWORD = 52; +pub const CRYPT_RC2_64BIT_VERSION: DWORD = 120; +pub const CRYPT_RC2_128BIT_VERSION: DWORD = 58; +STRUCT!{struct CRYPT_SMIME_CAPABILITY { + pszObjId: LPSTR, + Parameters: CRYPT_OBJID_BLOB, +}} +pub type PCRYPT_SMIME_CAPABILITY = *mut CRYPT_SMIME_CAPABILITY; +STRUCT!{struct CRYPT_SMIME_CAPABILITIES { + cCapability: DWORD, + rgCapability: PCRYPT_SMIME_CAPABILITY, +}} +pub type PCRYPT_SMIME_CAPABILITIES = *mut CRYPT_SMIME_CAPABILITIES; +STRUCT!{struct CERT_QC_STATEMENT { + pszStatementId: LPSTR, + StatementInfo: CRYPT_OBJID_BLOB, +}} +pub type PCERT_QC_STATEMENT = *mut CERT_QC_STATEMENT; +STRUCT!{struct CERT_QC_STATEMENTS_EXT_INFO { + cStatement: DWORD, + rgStatement: PCERT_QC_STATEMENT, +}} +pub type PCERT_QC_STATEMENTS_EXT_INFO = *mut CERT_QC_STATEMENTS_EXT_INFO; +pub const szOID_QC_EU_COMPLIANCE: &'static str = "0.4.0.1862.1.1"; +pub const szOID_QC_SSCD: &'static str = "0.4.0.1862.1.4"; +STRUCT!{struct CRYPT_MASK_GEN_ALGORITHM { + pszObjId: LPSTR, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, +}} +pub type PCRYPT_MASK_GEN_ALGORITHM = *mut CRYPT_MASK_GEN_ALGORITHM; +STRUCT!{struct CRYPT_RSA_SSA_PSS_PARAMETERS { + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + MaskGenAlgorithm: CRYPT_MASK_GEN_ALGORITHM, + dwSaltLength: DWORD, + dwTrailerField: DWORD, +}} +pub type PCRYPT_RSA_SSA_PSS_PARAMETERS = *mut CRYPT_RSA_SSA_PSS_PARAMETERS; +pub const PKCS_RSA_SSA_PSS_TRAILER_FIELD_BC: DWORD = 1; +STRUCT!{struct CRYPT_PSOURCE_ALGORITHM { + pszObjId: LPSTR, + EncodingParameters: CRYPT_DATA_BLOB, +}} +pub type PCRYPT_PSOURCE_ALGORITHM = *mut CRYPT_PSOURCE_ALGORITHM; +STRUCT!{struct CRYPT_RSAES_OAEP_PARAMETERS { + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + MaskGenAlgorithm: CRYPT_MASK_GEN_ALGORITHM, + PSourceAlgorithm: CRYPT_PSOURCE_ALGORITHM, +}} +pub type PCRYPT_RSAES_OAEP_PARAMETERS = *mut CRYPT_RSAES_OAEP_PARAMETERS; +pub const szOID_VERISIGN_PRIVATE_6_9: &'static str = "2.16.840.1.113733.1.6.9"; +pub const szOID_VERISIGN_ONSITE_JURISDICTION_HASH: &'static str = "2.16.840.1.113733.1.6.11"; +pub const szOID_VERISIGN_BITSTRING_6_13: &'static str = "2.16.840.1.113733.1.6.13"; +pub const szOID_VERISIGN_ISS_STRONG_CRYPTO: &'static str = "2.16.840.1.113733.1.8.1"; +pub const szOIDVerisign_MessageType: &'static str = "2.16.840.1.113733.1.9.2"; +pub const szOIDVerisign_PkiStatus: &'static str = "2.16.840.1.113733.1.9.3"; +pub const szOIDVerisign_FailInfo: &'static str = "2.16.840.1.113733.1.9.4"; +pub const szOIDVerisign_SenderNonce: &'static str = "2.16.840.1.113733.1.9.5"; +pub const szOIDVerisign_RecipientNonce: &'static str = "2.16.840.1.113733.1.9.6"; +pub const szOIDVerisign_TransactionID: &'static str = "2.16.840.1.113733.1.9.7"; +pub const szOID_NETSCAPE: &'static str = "2.16.840.1.113730"; +pub const szOID_NETSCAPE_CERT_EXTENSION: &'static str = "2.16.840.1.113730.1"; +pub const szOID_NETSCAPE_CERT_TYPE: &'static str = "2.16.840.1.113730.1.1"; +pub const szOID_NETSCAPE_BASE_URL: &'static str = "2.16.840.1.113730.1.2"; +pub const szOID_NETSCAPE_REVOCATION_URL: &'static str = "2.16.840.1.113730.1.3"; +pub const szOID_NETSCAPE_CA_REVOCATION_URL: &'static str = "2.16.840.1.113730.1.4"; +pub const szOID_NETSCAPE_CERT_RENEWAL_URL: &'static str = "2.16.840.1.113730.1.7"; +pub const szOID_NETSCAPE_CA_POLICY_URL: &'static str = "2.16.840.1.113730.1.8"; +pub const szOID_NETSCAPE_SSL_SERVER_NAME: &'static str = "2.16.840.1.113730.1.12"; +pub const szOID_NETSCAPE_COMMENT: &'static str = "2.16.840.1.113730.1.13"; +pub const szOID_NETSCAPE_DATA_TYPE: &'static str = "2.16.840.1.113730.2"; +pub const szOID_NETSCAPE_CERT_SEQUENCE: &'static str = "2.16.840.1.113730.2.5"; +pub const NETSCAPE_SSL_CLIENT_AUTH_CERT_TYPE: DWORD = 0x80; +pub const NETSCAPE_SSL_SERVER_AUTH_CERT_TYPE: DWORD = 0x40; +pub const NETSCAPE_SMIME_CERT_TYPE: DWORD = 0x20; +pub const NETSCAPE_SIGN_CERT_TYPE: DWORD = 0x10; +pub const NETSCAPE_SSL_CA_CERT_TYPE: DWORD = 0x04; +pub const NETSCAPE_SMIME_CA_CERT_TYPE: DWORD = 0x02; +pub const NETSCAPE_SIGN_CA_CERT_TYPE: DWORD = 0x01; +pub const szOID_CT_PKI_DATA: &'static str = "1.3.6.1.5.5.7.12.2"; +pub const szOID_CT_PKI_RESPONSE: &'static str = "1.3.6.1.5.5.7.12.3"; +pub const szOID_PKIX_NO_SIGNATURE: &'static str = "1.3.6.1.5.5.7.6.2"; +pub const szOID_CMC: &'static str = "1.3.6.1.5.5.7.7"; +pub const szOID_CMC_STATUS_INFO: &'static str = "1.3.6.1.5.5.7.7.1"; +pub const szOID_CMC_IDENTIFICATION: &'static str = "1.3.6.1.5.5.7.7.2"; +pub const szOID_CMC_IDENTITY_PROOF: &'static str = "1.3.6.1.5.5.7.7.3"; +pub const szOID_CMC_DATA_RETURN: &'static str = "1.3.6.1.5.5.7.7.4"; +pub const szOID_CMC_TRANSACTION_ID: &'static str = "1.3.6.1.5.5.7.7.5"; +pub const szOID_CMC_SENDER_NONCE: &'static str = "1.3.6.1.5.5.7.7.6"; +pub const szOID_CMC_RECIPIENT_NONCE: &'static str = "1.3.6.1.5.5.7.7.7"; +pub const szOID_CMC_ADD_EXTENSIONS: &'static str = "1.3.6.1.5.5.7.7.8"; +pub const szOID_CMC_ENCRYPTED_POP: &'static str = "1.3.6.1.5.5.7.7.9"; +pub const szOID_CMC_DECRYPTED_POP: &'static str = "1.3.6.1.5.5.7.7.10"; +pub const szOID_CMC_LRA_POP_WITNESS: &'static str = "1.3.6.1.5.5.7.7.11"; +pub const szOID_CMC_GET_CERT: &'static str = "1.3.6.1.5.5.7.7.15"; +pub const szOID_CMC_GET_CRL: &'static str = "1.3.6.1.5.5.7.7.16"; +pub const szOID_CMC_REVOKE_REQUEST: &'static str = "1.3.6.1.5.5.7.7.17"; +pub const szOID_CMC_REG_INFO: &'static str = "1.3.6.1.5.5.7.7.18"; +pub const szOID_CMC_RESPONSE_INFO: &'static str = "1.3.6.1.5.5.7.7.19"; +pub const szOID_CMC_QUERY_PENDING: &'static str = "1.3.6.1.5.5.7.7.21"; +pub const szOID_CMC_ID_POP_LINK_RANDOM: &'static str = "1.3.6.1.5.5.7.7.22"; +pub const szOID_CMC_ID_POP_LINK_WITNESS: &'static str = "1.3.6.1.5.5.7.7.23"; +pub const szOID_CMC_ID_CONFIRM_CERT_ACCEPTANCE: &'static str = "1.3.6.1.5.5.7.7.24"; +pub const szOID_CMC_ADD_ATTRIBUTES: &'static str = "1.3.6.1.4.1.311.10.10.1"; +STRUCT!{struct CMC_TAGGED_ATTRIBUTE { + dwBodyPartID: DWORD, + Attribute: CRYPT_ATTRIBUTE, +}} +pub type PCMC_TAGGED_ATTRIBUTE = *mut CMC_TAGGED_ATTRIBUTE; +STRUCT!{struct CMC_TAGGED_CERT_REQUEST { + dwBodyPartID: DWORD, + SignedCertRequest: CRYPT_DER_BLOB, +}} +pub type PCMC_TAGGED_CERT_REQUEST = *mut CMC_TAGGED_CERT_REQUEST; +UNION!{union CMC_TAGGED_REQUEST_u { + [usize; 1], + pTaggedCertRequest pTaggedCertRequest_mut: PCMC_TAGGED_CERT_REQUEST, +}} +STRUCT!{struct CMC_TAGGED_REQUEST { + dwTaggedRequestChoice: DWORD, + u: CMC_TAGGED_REQUEST_u, +}} +pub type PCMC_TAGGED_REQUEST = *mut CMC_TAGGED_REQUEST; +STRUCT!{struct CMC_TAGGED_CONTENT_INFO { + dwBodyPartID: DWORD, + EncodedContentInfo: CRYPT_DER_BLOB, +}} +pub type PCMC_TAGGED_CONTENT_INFO = *mut CMC_TAGGED_CONTENT_INFO; +STRUCT!{struct CMC_TAGGED_OTHER_MSG { + dwBodyPartID: DWORD, + pszObjId: LPSTR, + Value: CRYPT_OBJID_BLOB, +}} +pub type PCMC_TAGGED_OTHER_MSG = *mut CMC_TAGGED_OTHER_MSG; +STRUCT!{struct CMC_DATA_INFO { + cTaggedAttribute: DWORD, + rgTaggedAttribute: PCMC_TAGGED_ATTRIBUTE, + cTaggedRequest: DWORD, + rgTaggedRequest: PCMC_TAGGED_REQUEST, + cTaggedContentInfo: DWORD, + rgTaggedContentInfo: PCMC_TAGGED_CONTENT_INFO, + cTaggedOtherMsg: DWORD, + rgTaggedOtherMsg: PCMC_TAGGED_OTHER_MSG, +}} +pub type PCMC_DATA_INFO = *mut CMC_DATA_INFO; +STRUCT!{struct CMC_RESPONSE_INFO { + cTaggedAttribute: DWORD, + rgTaggedAttribute: PCMC_TAGGED_ATTRIBUTE, + cTaggedContentInfo: DWORD, + rgTaggedContentInfo: PCMC_TAGGED_CONTENT_INFO, + cTaggedOtherMsg: DWORD, + rgTaggedOtherMsg: PCMC_TAGGED_OTHER_MSG, +}} +pub type PCMC_RESPONSE_INFO = *mut CMC_RESPONSE_INFO; +STRUCT!{struct CMC_PEND_INFO { + PendToken: CRYPT_DATA_BLOB, + PendTime: FILETIME, +}} +pub type PCMC_PEND_INFO = *mut CMC_PEND_INFO; +UNION!{union CMC_STATUS_INFO_u { + [usize; 1], + dwFailInfo dwFailInfo_mut: DWORD, + pPendInfo pPendInfo_mut: PCMC_PEND_INFO, +}} +STRUCT!{struct CMC_STATUS_INFO { + dwStatus: DWORD, + cBodyList: DWORD, + rgdwBodyList: *mut DWORD, + pwszStatusString: LPWSTR, + dwOtherInfoChoice: DWORD, + u: CMC_STATUS_INFO_u, +}} +pub type PCMC_STATUS_INFO = *mut CMC_STATUS_INFO; +pub const CMC_OTHER_INFO_NO_CHOICE: DWORD = 0; +pub const CMC_OTHER_INFO_FAIL_CHOICE: DWORD = 1; +pub const CMC_OTHER_INFO_PEND_CHOICE: DWORD = 2; +pub const CMC_STATUS_SUCCESS: DWORD = 0; +pub const CMC_STATUS_FAILED: DWORD = 2; +pub const CMC_STATUS_PENDING: DWORD = 3; +pub const CMC_STATUS_NO_SUPPORT: DWORD = 4; +pub const CMC_STATUS_CONFIRM_REQUIRED: DWORD = 5; +pub const CMC_FAIL_BAD_ALG: DWORD = 0; +pub const CMC_FAIL_BAD_MESSAGE_CHECK: DWORD = 1; +pub const CMC_FAIL_BAD_REQUEST: DWORD = 2; +pub const CMC_FAIL_BAD_TIME: DWORD = 3; +pub const CMC_FAIL_BAD_CERT_ID: DWORD = 4; +pub const CMC_FAIL_UNSUPORTED_EXT: DWORD = 5; +pub const CMC_FAIL_MUST_ARCHIVE_KEYS: DWORD = 6; +pub const CMC_FAIL_BAD_IDENTITY: DWORD = 7; +pub const CMC_FAIL_POP_REQUIRED: DWORD = 8; +pub const CMC_FAIL_POP_FAILED: DWORD = 9; +pub const CMC_FAIL_NO_KEY_REUSE: DWORD = 10; +pub const CMC_FAIL_INTERNAL_CA_ERROR: DWORD = 11; +pub const CMC_FAIL_TRY_LATER: DWORD = 12; +STRUCT!{struct CMC_ADD_EXTENSIONS_INFO { + dwCmcDataReference: DWORD, + cCertReference: DWORD, + rgdwCertReference: *mut DWORD, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCMC_ADD_EXTENSIONS_INFO = *mut CMC_ADD_EXTENSIONS_INFO; +STRUCT!{struct CMC_ADD_ATTRIBUTES_INFO { + dwCmcDataReference: DWORD, + cCertReference: DWORD, + rgdwCertReference: *mut DWORD, + cAttribute: DWORD, + rgAttribute: PCRYPT_ATTRIBUTE, +}} +pub type PCMC_ADD_ATTRIBUTES_INFO = *mut CMC_ADD_ATTRIBUTES_INFO; +STRUCT!{struct CERT_TEMPLATE_EXT { + pszObjId: LPSTR, + dwMajorVersion: DWORD, + fMinorVersion: BOOL, + dwMinorVersion: DWORD, +}} +pub type PCERT_TEMPLATE_EXT = *mut CERT_TEMPLATE_EXT; +STRUCT!{struct CERT_HASHED_URL { + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Hash: CRYPT_HASH_BLOB, + pwszUrl: LPWSTR, +}} +pub type PCERT_HASHED_URL = *mut CERT_HASHED_URL; +STRUCT!{struct CERT_LOGOTYPE_DETAILS { + pwszMimeType: LPWSTR, + cHashedUrl: DWORD, + rgHashedUrl: PCERT_HASHED_URL, +}} +pub type PCERT_LOGOTYPE_DETAILS = *mut CERT_LOGOTYPE_DETAILS; +STRUCT!{struct CERT_LOGOTYPE_REFERENCE { + cHashedUrl: DWORD, + rgHashedUrl: PCERT_HASHED_URL, +}} +pub type PCERT_LOGOTYPE_REFERENCE = *mut CERT_LOGOTYPE_REFERENCE; +UNION!{union CERT_LOGOTYPE_IMAGE_INFO_u { + [u32; 1], + dwNumBits dwNumBits_mut: DWORD, + dwTableSize dwTableSize_mut: DWORD, +}} +STRUCT!{struct CERT_LOGOTYPE_IMAGE_INFO { + dwLogotypeImageInfoChoice: DWORD, + dwFileSize: DWORD, + dwXSize: DWORD, + dwYSize: DWORD, + dwLogotypeImageResolutionChoice: DWORD, + u: CERT_LOGOTYPE_IMAGE_INFO_u, + pwszLanguage: LPWSTR, +}} +pub type PCERT_LOGOTYPE_IMAGE_INFO = *mut CERT_LOGOTYPE_IMAGE_INFO; +pub const CERT_LOGOTYPE_GRAY_SCALE_IMAGE_INFO_CHOICE: DWORD = 1; +pub const CERT_LOGOTYPE_COLOR_IMAGE_INFO_CHOICE: DWORD = 2; +pub const CERT_LOGOTYPE_NO_IMAGE_RESOLUTION_CHOICE: DWORD = 0; +pub const CERT_LOGOTYPE_BITS_IMAGE_RESOLUTION_CHOICE: DWORD = 1; +pub const CERT_LOGOTYPE_TABLE_SIZE_IMAGE_RESOLUTION_CHOICE: DWORD = 2; +STRUCT!{struct CERT_LOGOTYPE_IMAGE { + LogotypeDetails: CERT_LOGOTYPE_DETAILS, + pLogotypeImageInfo: PCERT_LOGOTYPE_IMAGE_INFO, +}} +pub type PCERT_LOGOTYPE_IMAGE = *mut CERT_LOGOTYPE_IMAGE; +STRUCT!{struct CERT_LOGOTYPE_AUDIO_INFO { + dwFileSize: DWORD, + dwPlayTime: DWORD, + dwChannels: DWORD, + dwSampleRate: DWORD, + pwszLanguage: LPWSTR, +}} +pub type PCERT_LOGOTYPE_AUDIO_INFO = *mut CERT_LOGOTYPE_AUDIO_INFO; +STRUCT!{struct CERT_LOGOTYPE_AUDIO { + LogotypeDetails: CERT_LOGOTYPE_DETAILS, + pLogotypeAudioInfo: PCERT_LOGOTYPE_AUDIO_INFO, +}} +pub type PCERT_LOGOTYPE_AUDIO = *mut CERT_LOGOTYPE_AUDIO; +STRUCT!{struct CERT_LOGOTYPE_DATA { + cLogotypeImage: DWORD, + rgLogotypeImage: PCERT_LOGOTYPE_IMAGE, + cLogotypeAudio: DWORD, + rgLogotypeAudio: PCERT_LOGOTYPE_AUDIO, +}} +pub type PCERT_LOGOTYPE_DATA = *mut CERT_LOGOTYPE_DATA; +UNION!{union CERT_LOGOTYPE_INFO_u { + [usize; 1], + pLogotypeDirectInfo pLogotypeDirectInfo_mut: PCERT_LOGOTYPE_DATA, + pLogotypeIndirectInfo pLogotypeIndirectInfo__mut: PCERT_LOGOTYPE_REFERENCE, +}} +STRUCT!{struct CERT_LOGOTYPE_INFO { + dwLogotypeInfoChoice: DWORD, + u: CERT_LOGOTYPE_INFO_u, +}} +pub type PCERT_LOGOTYPE_INFO = *mut CERT_LOGOTYPE_INFO; +pub const CERT_LOGOTYPE_DIRECT_INFO_CHOICE: DWORD = 1; +pub const CERT_LOGOTYPE_INDIRECT_INFO_CHOICE: DWORD = 2; +STRUCT!{struct CERT_OTHER_LOGOTYPE_INFO { + pszObjId: LPSTR, + LogotypeInfo: CERT_LOGOTYPE_INFO, +}} +pub type PCERT_OTHER_LOGOTYPE_INFO = *mut CERT_OTHER_LOGOTYPE_INFO; +pub const szOID_LOYALTY_OTHER_LOGOTYPE: &'static str = "1.3.6.1.5.5.7.20.1"; +pub const szOID_BACKGROUND_OTHER_LOGOTYPE: &'static str = "1.3.6.1.5.5.7.20.2"; +STRUCT!{struct CERT_LOGOTYPE_EXT_INFO { + cCommunityLogo: DWORD, + rgCommunityLogo: PCERT_LOGOTYPE_INFO, + pIssuerLogo: PCERT_LOGOTYPE_INFO, + pSubjectLogo: PCERT_LOGOTYPE_INFO, + cOtherLogo: DWORD, + rgOtherLogo: PCERT_OTHER_LOGOTYPE_INFO, +}} +pub type PCERT_LOGOTYPE_EXT_INFO = *mut CERT_LOGOTYPE_EXT_INFO; +UNION!{union CERT_BIOMETRIC_DATA_u { + [usize; 1], + dwPredefined dwPredefined_mut: DWORD, + pszObjId pszObjId_mut: LPSTR, +}} +STRUCT!{struct CERT_BIOMETRIC_DATA { + dwTypeOfBiometricDataChoice: DWORD, + u: CERT_BIOMETRIC_DATA_u, + HashedUrl: CERT_HASHED_URL, +}} +pub type PCERT_BIOMETRIC_DATA = *mut CERT_BIOMETRIC_DATA; +pub const CERT_BIOMETRIC_PREDEFINED_DATA_CHOICE: DWORD = 1; +pub const CERT_BIOMETRIC_OID_DATA_CHOICE: DWORD = 2; +pub const CERT_BIOMETRIC_PICTURE_TYPE: DWORD = 0; +pub const CERT_BIOMETRIC_SIGNATURE_TYPE: DWORD = 1; +STRUCT!{struct CERT_BIOMETRIC_EXT_INFO { + cBiometricData: DWORD, + rgBiometricData: PCERT_BIOMETRIC_DATA, +}} +pub type PCERT_BIOMETRIC_EXT_INFO = *mut CERT_BIOMETRIC_EXT_INFO; +STRUCT!{struct OCSP_SIGNATURE_INFO { + SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + Signature: CRYPT_BIT_BLOB, + cCertEncoded: DWORD, + rgCertEncoded: PCERT_BLOB, +}} +pub type POCSP_SIGNATURE_INFO = *mut OCSP_SIGNATURE_INFO; +STRUCT!{struct OCSP_SIGNED_REQUEST_INFO { + ToBeSigned: CRYPT_DER_BLOB, + pOptionalSignatureInfo: POCSP_SIGNATURE_INFO, +}} +pub type POCSP_SIGNED_REQUEST_INFO = *mut OCSP_SIGNED_REQUEST_INFO; +STRUCT!{struct OCSP_CERT_ID { + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + IssuerNameHash: CRYPT_HASH_BLOB, + IssuerKeyHash: CRYPT_HASH_BLOB, + SerialNumber: CRYPT_INTEGER_BLOB, +}} +pub type POCSP_CERT_ID = *mut OCSP_CERT_ID; +STRUCT!{struct OCSP_REQUEST_ENTRY { + CertId: OCSP_CERT_ID, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type POCSP_REQUEST_ENTRY = *mut OCSP_REQUEST_ENTRY; +STRUCT!{struct OCSP_REQUEST_INFO { + dwVersion: DWORD, + pRequestorName: PCERT_ALT_NAME_ENTRY, + cRequestEntry: DWORD, + rgRequestEntry: POCSP_REQUEST_ENTRY, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type POCSP_REQUEST_INFO = *mut OCSP_REQUEST_INFO; +pub const OCSP_REQUEST_V1: DWORD = 0; +STRUCT!{struct OCSP_RESPONSE_INFO { + dwStatus: DWORD, + pszObjId: LPSTR, + Value: CRYPT_OBJID_BLOB, +}} +pub type POCSP_RESPONSE_INFO = *mut OCSP_RESPONSE_INFO; +pub const OCSP_SUCCESSFUL_RESPONSE: DWORD = 0; +pub const OCSP_MALFORMED_REQUEST_RESPONSE: DWORD = 1; +pub const OCSP_INTERNAL_ERROR_RESPONSE: DWORD = 2; +pub const OCSP_TRY_LATER_RESPONSE: DWORD = 3; +pub const OCSP_SIG_REQUIRED_RESPONSE: DWORD = 5; +pub const OCSP_UNAUTHORIZED_RESPONSE: DWORD = 6; +pub const szOID_PKIX_OCSP_BASIC_SIGNED_RESPONSE: &'static str = "1.3.6.1.5.5.7.48.1.1"; +STRUCT!{struct OCSP_BASIC_SIGNED_RESPONSE_INFO { + ToBeSigned: CRYPT_DER_BLOB, + SignatureInfo: OCSP_SIGNATURE_INFO, +}} +pub type POCSP_BASIC_SIGNED_RESPONSE_INFO = *mut OCSP_BASIC_SIGNED_RESPONSE_INFO; +STRUCT!{struct OCSP_BASIC_REVOKED_INFO { + RevocationDate: FILETIME, + dwCrlReasonCode: DWORD, +}} +pub type POCSP_BASIC_REVOKED_INFO = *mut OCSP_BASIC_REVOKED_INFO; +UNION!{union OCSP_BASIC_RESPONSE_ENTRY_u { + [usize; 1], + pRevokedInfo pRevokedInfo_mut: POCSP_BASIC_REVOKED_INFO, +}} +STRUCT!{struct OCSP_BASIC_RESPONSE_ENTRY { + CertId: OCSP_CERT_ID, + dwCertStatus: DWORD, + u: OCSP_BASIC_RESPONSE_ENTRY_u, + ThisUpdate: FILETIME, + NextUpdate: FILETIME, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type POCSP_BASIC_RESPONSE_ENTRY = *mut OCSP_BASIC_RESPONSE_ENTRY; +pub const OCSP_BASIC_GOOD_CERT_STATUS: DWORD = 0; +pub const OCSP_BASIC_REVOKED_CERT_STATUS: DWORD = 1; +pub const OCSP_BASIC_UNKNOWN_CERT_STATUS: DWORD = 2; +UNION!{union OCSP_BASIC_RESPONSE_INFO_u { + [usize; 2], + ByNameResponderId ByNameResponderId_mut: CERT_NAME_BLOB, + ByKeyResponderId ByKeyResponderId_mut: CRYPT_HASH_BLOB, +}} +STRUCT!{struct OCSP_BASIC_RESPONSE_INFO { + dwVersion: DWORD, + dwResponderIdChoice: DWORD, + u: OCSP_BASIC_RESPONSE_INFO_u, + ProducedAt: FILETIME, + cResponseEntry: DWORD, + rgResponseEntry: POCSP_BASIC_RESPONSE_ENTRY, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type POCSP_BASIC_RESPONSE_INFO = *mut OCSP_BASIC_RESPONSE_INFO; +pub const OCSP_BASIC_RESPONSE_V1: DWORD = 0; +pub const OCSP_BASIC_BY_NAME_RESPONDER_ID: DWORD = 1; +pub const OCSP_BASIC_BY_KEY_RESPONDER_ID: DWORD = 2; +STRUCT!{struct CERT_SUPPORTED_ALGORITHM_INFO { + Algorithm: CRYPT_ALGORITHM_IDENTIFIER, + IntendedKeyUsage: CRYPT_BIT_BLOB, + IntendedCertPolicies: CERT_POLICIES_INFO, +}} +pub type PCERT_SUPPORTED_ALGORITHM_INFO = *mut CERT_SUPPORTED_ALGORITHM_INFO; +STRUCT!{struct CERT_TPM_SPECIFICATION_INFO { + pwszFamily: LPWSTR, + dwLevel: DWORD, + dwRevision: DWORD, +}} +pub type PCERT_TPM_SPECIFICATION_INFO = *mut CERT_TPM_SPECIFICATION_INFO; +pub type HCRYPTOIDFUNCSET = *mut c_void; +pub type HCRYPTOIDFUNCADDR = *mut c_void; +pub const CRYPT_OID_ENCODE_OBJECT_FUNC: &'static str = "CryptDllEncodeObject"; +pub const CRYPT_OID_DECODE_OBJECT_FUNC: &'static str = "CryptDllDecodeObject"; +pub const CRYPT_OID_ENCODE_OBJECT_EX_FUNC: &'static str = "CryptDllEncodeObjectEx"; +pub const CRYPT_OID_DECODE_OBJECT_EX_FUNC: &'static str = "CryptDllDecodeObjectEx"; +pub const CRYPT_OID_CREATE_COM_OBJECT_FUNC: &'static str = "CryptDllCreateCOMObject"; +pub const CRYPT_OID_VERIFY_REVOCATION_FUNC: &'static str = "CertDllVerifyRevocation"; +pub const CRYPT_OID_VERIFY_CTL_USAGE_FUNC: &'static str = "CertDllVerifyCTLUsage"; +pub const CRYPT_OID_FORMAT_OBJECT_FUNC: &'static str = "CryptDllFormatObject"; +pub const CRYPT_OID_FIND_OID_INFO_FUNC: &'static str = "CryptDllFindOIDInfo"; +pub const CRYPT_OID_FIND_LOCALIZED_NAME_FUNC: &'static str = "CryptDllFindLocalizedName"; +pub const CRYPT_OID_REGPATH: &'static str = "Software\\Microsoft\\Cryptography\\OID"; +pub const CRYPT_OID_REG_ENCODING_TYPE_PREFIX: &'static str = "EncodingType "; +pub const CRYPT_OID_REG_DLL_VALUE_NAME: &'static str = "Dll"; +pub const CRYPT_OID_REG_FUNC_NAME_VALUE_NAME: &'static str = "FuncName"; +pub const CRYPT_OID_REG_FLAGS_VALUE_NAME: &'static str = "CryptFlags"; +pub const CRYPT_DEFAULT_OID: &'static str = "DEFAULT"; +STRUCT!{struct CRYPT_OID_FUNC_ENTRY { + pszOID: LPCSTR, + pvFuncAddr: *mut c_void, +}} +pub type PCRYPT_OID_FUNC_ENTRY = *mut CRYPT_OID_FUNC_ENTRY; +pub const CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG: DWORD = 1; +extern "system" { + pub fn CryptInstallOIDFunctionAddress( + hModule: HMODULE, + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + cFuncEntry: DWORD, + rgFuncEntry: *const CRYPT_OID_FUNC_ENTRY, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptInitOIDFunctionSet( + pszFuncName: LPCSTR, + dwFlags: DWORD, + ) -> HCRYPTOIDFUNCSET; + pub fn CryptGetOIDFunctionAddress( + hFuncSet: HCRYPTOIDFUNCSET, + dwEncodingType: DWORD, + pszOID: LPCSTR, + dwFlags: DWORD, + ppvFuncAddr: *mut *mut c_void, + phFuncAddr: *mut HCRYPTOIDFUNCADDR, + ) -> BOOL; +} +pub const CRYPT_GET_INSTALLED_OID_FUNC_FLAG: DWORD = 0x1; +extern "system" { + pub fn CryptGetDefaultOIDDllList( + hFuncSet: HCRYPTOIDFUNCSET, + dwEncodingType: DWORD, + pwszDllList: *mut WCHAR, + pcchDllList: *mut DWORD, + ) -> BOOL; + pub fn CryptGetDefaultOIDFunctionAddress( + hFuncSet: HCRYPTOIDFUNCSET, + dwEncodingType: DWORD, + pwszDll: LPCWSTR, + dwFlags: DWORD, + ppvFuncAddr: *mut *mut c_void, + phFuncAddr: *mut HCRYPTOIDFUNCADDR, + ) -> BOOL; + pub fn CryptFreeOIDFunctionAddress( + hFuncAddr: HCRYPTOIDFUNCADDR, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptRegisterOIDFunction( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + pszOID: LPCSTR, + pwszDll: LPCWSTR, + pszOverrideFuncName: LPCSTR, + ) -> BOOL; + pub fn CryptUnregisterOIDFunction( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + pszOID: LPCSTR, + ) -> BOOL; + pub fn CryptRegisterDefaultOIDFunction( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + dwIndex: DWORD, + pwszDll: LPCWSTR, + ) -> BOOL; +} +pub const CRYPT_REGISTER_FIRST_INDEX: DWORD = 0; +pub const CRYPT_REGISTER_LAST_INDEX: DWORD = 0xFFFFFFFF; +extern "system" { + pub fn CryptUnregisterDefaultOIDFunction( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + pwszDll: LPCWSTR, + ) -> BOOL; + pub fn CryptSetOIDFunctionValue( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + pszOID: LPCSTR, + pwszValueName: LPCWSTR, + dwValueType: DWORD, + pbValueData: *const BYTE, + cbValueData: DWORD, + ) -> BOOL; + pub fn CryptGetOIDFunctionValue( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + pszOID: LPCSTR, + pwszValueName: LPCWSTR, + pdwValueType: *mut DWORD, + pbValueData: *mut BYTE, + pcbValueData: *mut DWORD, + ) -> BOOL; +} +FN!{stdcall PFN_CRYPT_ENUM_OID_FUNC( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + pszOID: LPCSTR, + cValue: DWORD, + rgdwValueType: *const DWORD, + rgpwszValueName: *const LPCWSTR, + rgpbValueData: *const *const BYTE, + rgcbValueData: *const DWORD, + pvArg: *mut c_void, +) -> BOOL} +extern "system" { + pub fn CryptEnumOIDFunction( + dwEncodingType: DWORD, + pszFuncName: LPCSTR, + pszOID: LPCSTR, + dwFlags: DWORD, + pvArg: *mut c_void, + pfnEnumOIDFunc: PFN_CRYPT_ENUM_OID_FUNC, + ) -> BOOL; +} +pub const CRYPT_MATCH_ANY_ENCODING_TYPE: DWORD = 0xFFFFFFFF; +pub const CALG_OID_INFO_CNG_ONLY: ALG_ID = 0xFFFFFFFF; +pub const CALG_OID_INFO_PARAMETERS: ALG_ID = 0xFFFFFFFE; +#[inline] +pub fn IS_SPECIAL_OID_INFO_ALGID(Algid: ALG_ID) -> bool { + Algid >= CALG_OID_INFO_PARAMETERS +} +pub const CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM: &'static str = "CryptOIDInfoHashParameters"; +pub const CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM: &'static str = "CryptOIDInfoECCParameters"; +pub const CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM: &'static str = "CryptOIDInfoMgf1Parameters"; +pub const CRYPT_OID_INFO_NO_SIGN_ALGORITHM: &'static str = "CryptOIDInfoNoSign"; +pub const CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM: &'static str = "CryptOIDInfoOAEPParameters"; +pub const CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM: &'static str + = "CryptOIDInfoECCWrapParameters"; +pub const CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM: &'static str = "CryptOIDInfoNoParameters"; +UNION!{union CRYPT_OID_INFO_u { + [u32; 1], + dwValue dwValue_mut: DWORD, + Algid Algid_mut: ALG_ID, + dwLength dwLength_mut: DWORD, +}} +STRUCT!{struct CRYPT_OID_INFO { + cbSize: DWORD, + oszOID: LPCSTR, + pwszName: LPCWSTR, + dwGroupId: DWORD, + u: CRYPT_OID_INFO_u, + ExtraInfo: CRYPT_DATA_BLOB, + pwszCNGAlgid: LPCWSTR, + pwszCNGExtraAlgid: LPCWSTR, +}} +pub type PCRYPT_OID_INFO = *mut CRYPT_OID_INFO; +pub type PCCRYPT_OID_INFO = *const CRYPT_OID_INFO; +pub const CRYPT_HASH_ALG_OID_GROUP_ID: DWORD = 1; +pub const CRYPT_ENCRYPT_ALG_OID_GROUP_ID: DWORD = 2; +pub const CRYPT_PUBKEY_ALG_OID_GROUP_ID: DWORD = 3; +pub const CRYPT_SIGN_ALG_OID_GROUP_ID: DWORD = 4; +pub const CRYPT_RDN_ATTR_OID_GROUP_ID: DWORD = 5; +pub const CRYPT_EXT_OR_ATTR_OID_GROUP_ID: DWORD = 6; +pub const CRYPT_ENHKEY_USAGE_OID_GROUP_ID: DWORD = 7; +pub const CRYPT_POLICY_OID_GROUP_ID: DWORD = 8; +pub const CRYPT_TEMPLATE_OID_GROUP_ID: DWORD = 9; +pub const CRYPT_KDF_OID_GROUP_ID: DWORD = 10; +pub const CRYPT_LAST_OID_GROUP_ID: DWORD = 10; +pub const CRYPT_FIRST_ALG_OID_GROUP_ID: DWORD = CRYPT_HASH_ALG_OID_GROUP_ID; +pub const CRYPT_LAST_ALG_OID_GROUP_ID: DWORD = CRYPT_SIGN_ALG_OID_GROUP_ID; +pub const CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG: DWORD = 0x00000001; +pub const CRYPT_OID_USE_PUBKEY_PARA_FOR_PKCS7_FLAG: DWORD = 0x00000002; +pub const CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG: DWORD = 0x00000004; +pub const CRYPT_OID_PUBKEY_SIGN_ONLY_FLAG: DWORD = 0x80000000; +pub const CRYPT_OID_PUBKEY_ENCRYPT_ONLY_FLAG: DWORD = 0x40000000; +pub const CRYPT_OID_USE_CURVE_NAME_FOR_ENCODE_FLAG: DWORD = 0x20000000; +pub const CRYPT_OID_USE_CURVE_PARAMETERS_FOR_ENCODE_FLAG: DWORD = 0x10000000; +extern "system" { + pub fn CryptFindOIDInfo( + dwKeyType: DWORD, + pvKey: *mut c_void, + dwGroupId: DWORD, + ) -> PCCRYPT_OID_INFO; +} +pub const CRYPT_OID_INFO_OID_KEY: DWORD = 1; +pub const CRYPT_OID_INFO_NAME_KEY: DWORD = 2; +pub const CRYPT_OID_INFO_ALGID_KEY: DWORD = 3; +pub const CRYPT_OID_INFO_SIGN_KEY: DWORD = 4; +pub const CRYPT_OID_INFO_CNG_ALGID_KEY: DWORD = 5; +pub const CRYPT_OID_INFO_CNG_SIGN_KEY: DWORD = 6; +pub const CRYPT_OID_INFO_OID_KEY_FLAGS_MASK: DWORD = 0xFFFF0000; +pub const CRYPT_OID_INFO_PUBKEY_SIGN_KEY_FLAG: DWORD = 0x80000000; +pub const CRYPT_OID_INFO_PUBKEY_ENCRYPT_KEY_FLAG: DWORD = 0x40000000; +pub const CRYPT_OID_DISABLE_SEARCH_DS_FLAG: DWORD = 0x80000000; +pub const CRYPT_OID_PREFER_CNG_ALGID_FLAG: DWORD = 0x40000000; +pub const CRYPT_OID_INFO_OID_GROUP_BIT_LEN_MASK: DWORD = 0x0FFF0000; +pub const CRYPT_OID_INFO_OID_GROUP_BIT_LEN_SHIFT: DWORD = 16; +extern "system" { + pub fn CryptRegisterOIDInfo( + pInfo: PCCRYPT_OID_INFO, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptUnregisterOIDInfo( + pInfo: PCCRYPT_OID_INFO, + ) -> BOOL; +} +FN!{stdcall PFN_CRYPT_ENUM_OID_INFO( + pInfo: PCCRYPT_OID_INFO, + pvArg: *mut c_void, +) -> BOOL} +extern "system" { + pub fn CryptEnumOIDInfo( + dwGroupId: DWORD, + dwFlags: DWORD, + pvArg: *mut c_void, + pfnEnumOIDInfo: PFN_CRYPT_ENUM_OID_INFO, + ) -> BOOL; + pub fn CryptFindLocalizedName( + pwszCryptName: LPCWSTR, + ) -> LPCWSTR; +} +pub const CRYPT_LOCALIZED_NAME_ENCODING_TYPE: DWORD = 0; +pub const CRYPT_LOCALIZED_NAME_OID: &'static str = "LocalizedNames"; +STRUCT!{struct CERT_STRONG_SIGN_SERIALIZED_INFO { + dwFlags: DWORD, + pwszCNGSignHashAlgids: LPWSTR, + pwszCNGPubKeyMinBitLengths: LPWSTR, +}} +pub type PCERT_STRONG_SIGN_SERIALIZED_INFO = *mut CERT_STRONG_SIGN_SERIALIZED_INFO; +pub const CERT_STRONG_SIGN_ECDSA_ALGORITHM: &'static str = "ECDSA"; +UNION!{union CERT_STRONG_SIGN_PARA_u { + [usize; 1], + pvInfo pvInfo_mut: *mut c_void, + pSerializedInfo pSerializedInfo_mut: PCERT_STRONG_SIGN_SERIALIZED_INFO, + pszOID pszOID_mut: LPSTR, +}} +STRUCT!{struct CERT_STRONG_SIGN_PARA { + cbSize: DWORD, + dwInfoChoice: DWORD, + u: CERT_STRONG_SIGN_PARA_u, +}} +pub type PCERT_STRONG_SIGN_PARA = *mut CERT_STRONG_SIGN_PARA; +pub type PCCERT_STRONG_SIGN_PARA = *const CERT_STRONG_SIGN_PARA; +pub const CERT_STRONG_SIGN_SERIALIZED_INFO_CHOICE: DWORD = 1; +pub const CERT_STRONG_SIGN_OID_INFO_CHOICE: DWORD = 2; +pub const CERT_STRONG_SIGN_ENABLE_CRL_CHECK: DWORD = 0x1; +pub const CERT_STRONG_SIGN_ENABLE_OCSP_CHECK: DWORD = 0x2; +pub const szOID_CERT_STRONG_SIGN_OS_PREFIX: &'static str = "1.3.6.1.4.1.311.72.1."; +pub const szOID_CERT_STRONG_SIGN_OS_1: &'static str = "1.3.6.1.4.1.311.72.1.1"; +pub const szOID_CERT_STRONG_SIGN_OS_CURRENT: &'static str = szOID_CERT_STRONG_SIGN_OS_1; +pub const szOID_CERT_STRONG_KEY_OS_PREFIX: &'static str = "1.3.6.1.4.1.311.72.2."; +pub const szOID_CERT_STRONG_KEY_OS_1: &'static str = "1.3.6.1.4.1.311.72.2.1"; +pub const szOID_CERT_STRONG_KEY_OS_CURRENT: &'static str = szOID_CERT_STRONG_KEY_OS_1; +pub type HCRYPTMSG = *mut c_void; +pub const szOID_PKCS_7_DATA: &'static str = "1.2.840.113549.1.7.1"; +pub const szOID_PKCS_7_SIGNED: &'static str = "1.2.840.113549.1.7.2"; +pub const szOID_PKCS_7_ENVELOPED: &'static str = "1.2.840.113549.1.7.3"; +pub const szOID_PKCS_7_SIGNEDANDENVELOPED: &'static str = "1.2.840.113549.1.7.4"; +pub const szOID_PKCS_7_DIGESTED: &'static str = "1.2.840.113549.1.7.5"; +pub const szOID_PKCS_7_ENCRYPTED: &'static str = "1.2.840.113549.1.7.6"; +pub const szOID_PKCS_9_CONTENT_TYPE: &'static str = "1.2.840.113549.1.9.3"; +pub const szOID_PKCS_9_MESSAGE_DIGEST: &'static str = "1.2.840.113549.1.9.4"; +pub const CMSG_DATA: DWORD = 1; +pub const CMSG_SIGNED: DWORD = 2; +pub const CMSG_ENVELOPED: DWORD = 3; +pub const CMSG_SIGNED_AND_ENVELOPED: DWORD = 4; +pub const CMSG_HASHED: DWORD = 5; +pub const CMSG_ENCRYPTED: DWORD = 6; +pub const CMSG_ALL_FLAGS: DWORD = !0; +pub const CMSG_DATA_FLAG: DWORD = 1 << CMSG_DATA; +pub const CMSG_SIGNED_FLAG: DWORD = 1 << CMSG_SIGNED; +pub const CMSG_ENVELOPED_FLAG: DWORD = 1 << CMSG_ENVELOPED; +pub const CMSG_SIGNED_AND_ENVELOPED_FLAG: DWORD = 1 << CMSG_SIGNED_AND_ENVELOPED; +pub const CMSG_HASHED_FLAG: DWORD = 1 << CMSG_HASHED; +pub const CMSG_ENCRYPTED_FLAG: DWORD = 1 << CMSG_ENCRYPTED; +STRUCT!{struct CERT_ISSUER_SERIAL_NUMBER { + Issuer: CERT_NAME_BLOB, + SerialNumber: CRYPT_INTEGER_BLOB, +}} +pub type PCERT_ISSUER_SERIAL_NUMBER = *mut CERT_ISSUER_SERIAL_NUMBER; +UNION!{union CERT_ID_u { + [usize; 4], + IssuerSerialNumber IssuerSerialNumber_mut: CERT_ISSUER_SERIAL_NUMBER, + KeyId KeyId_mut: CRYPT_HASH_BLOB, + HashId HashId_mut: CRYPT_HASH_BLOB, +}} +STRUCT!{struct CERT_ID { + dwIdChoice: DWORD, + u: CERT_ID_u, +}} +pub type PCERT_ID = *mut CERT_ID; +pub const CERT_ID_ISSUER_SERIAL_NUMBER: DWORD = 1; +pub const CERT_ID_KEY_IDENTIFIER: DWORD = 2; +pub const CERT_ID_SHA1_HASH: DWORD = 3; +UNION!{union CMSG_SIGNER_ENCODE_INFO_u { + [usize; 1], + hCryptProv hCryptProv_mut: HCRYPTPROV, + hNCryptKey hNCryptKey_mut: NCRYPT_KEY_HANDLE, + hBCryptKey hBCryptKey_mut: BCRYPT_KEY_HANDLE, +}} +STRUCT!{struct CMSG_SIGNER_ENCODE_INFO { + cbSize: DWORD, + pCertInfo: PCERT_INFO, + u: CMSG_SIGNER_ENCODE_INFO_u, + dwKeySpec: DWORD, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut c_void, + cAuthAttr: DWORD, + rgAuthAttr: PCRYPT_ATTRIBUTE, + cUnauthAttr: DWORD, + rgUnauthAttr: PCRYPT_ATTRIBUTE, + SignerId: CERT_ID, + HashEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashEncryptionAuxInfo: *mut c_void, +}} +pub type PCMSG_SIGNER_ENCODE_INFO = *mut CMSG_SIGNER_ENCODE_INFO; +STRUCT!{struct CMSG_SIGNED_ENCODE_INFO { + cbSize: DWORD, + cSigners: DWORD, + rgSigners: PCMSG_SIGNER_ENCODE_INFO, + cCertEncoded: DWORD, + rgCertEncoded: PCERT_BLOB, + cCrlEncoded: DWORD, + rgCrlEncoded: PCRL_BLOB, + cAttrCertEncoded: DWORD, + rgAttrCertEncoded: PCERT_BLOB, +}} +pub type PCMSG_SIGNED_ENCODE_INFO = *mut CMSG_SIGNED_ENCODE_INFO; +pub type PCMSG_RECIPIENT_ENCODE_INFO = *mut CMSG_RECIPIENT_ENCODE_INFO; +STRUCT!{struct CMSG_ENVELOPED_ENCODE_INFO { + cbSize: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + ContentEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvEncryptionAuxInfo: *mut c_void, + cRecipients: DWORD, + rgpRecipients: *mut PCERT_INFO, + rgCmsRecipients: PCMSG_RECIPIENT_ENCODE_INFO, + cCertEncoded: DWORD, + rgCertEncoded: PCERT_BLOB, + cCrlEncoded: DWORD, + rgCrlEncoded: PCRL_BLOB, + cAttrCertEncoded: DWORD, + rgAttrCertEncoded: PCERT_BLOB, + cUnprotectedAttr: DWORD, + rgUnprotectedAttr: PCRYPT_ATTRIBUTE, +}} +pub type PCMSG_ENVELOPED_ENCODE_INFO = *mut CMSG_ENVELOPED_ENCODE_INFO; +STRUCT!{struct CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO { + cbSize: DWORD, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvKeyEncryptionAuxInfo: *mut c_void, + hCryptProv: HCRYPTPROV_LEGACY, + RecipientPublicKey: CRYPT_BIT_BLOB, + RecipientId: CERT_ID, +}} +pub type PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO = *mut CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO; +STRUCT!{struct CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO { + cbSize: DWORD, + RecipientPublicKey: CRYPT_BIT_BLOB, + RecipientId: CERT_ID, + Date: FILETIME, + pOtherAttr: PCRYPT_ATTRIBUTE_TYPE_VALUE, +}} +pub type PCMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO = *mut CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO; +UNION!{union CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO_u { + [usize; 1], + pEphemeralAlgorithm pEphemeralAlgorithm_mut: PCRYPT_ALGORITHM_IDENTIFIER, + pSenderId pSenderId_mut: PCERT_ID, +}} +STRUCT!{struct CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO { + cbSize: DWORD, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvKeyEncryptionAuxInfo: *mut c_void, + KeyWrapAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvKeyWrapAuxInfo: *mut c_void, + hCryptProv: HCRYPTPROV_LEGACY, + dwKeySpec: DWORD, + dwKeyChoice: DWORD, + u: CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO_u, + UserKeyingMaterial: CRYPT_DATA_BLOB, + cRecipientEncryptedKeys: DWORD, + rgpRecipientEncryptedKeys: *mut PCMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO, +}} +pub type PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO = *mut CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO; +pub const CMSG_KEY_AGREE_EPHEMERAL_KEY_CHOICE: DWORD = 1; +pub const CMSG_KEY_AGREE_STATIC_KEY_CHOICE: DWORD = 2; +UNION!{union CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO_u { + [usize; 1], + hKeyEncryptionKey hKeyEncryptionKey_mut: HCRYPTKEY, + pvKeyEncryptionKey pvKeyEncryptionKey_mut: *mut c_void, +}} +STRUCT!{struct CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO { + cbSize: DWORD, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvKeyEncryptionAuxInfo: *mut c_void, + hCryptProv: HCRYPTPROV, + dwKeyChoice: DWORD, + u: CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO_u, + KeyId: CRYPT_DATA_BLOB, + Date: FILETIME, + pOtherAttr: PCRYPT_ATTRIBUTE_TYPE_VALUE, +}} +pub type PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO = *mut CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO; +pub const CMSG_MAIL_LIST_HANDLE_KEY_CHOICE: DWORD = 1; +UNION!{union CMSG_RECIPIENT_ENCODE_INFO_u { + [usize; 1], + pKeyTrans pKeyTrans_mut: PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO, + pKeyAgree pKeyAgree_mut: PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO, + pMailList pMailList_mut: PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO, +}} +STRUCT!{struct CMSG_RECIPIENT_ENCODE_INFO { + dwRecipientChoice: DWORD, + u: CMSG_RECIPIENT_ENCODE_INFO_u, +}} +pub const CMSG_KEY_TRANS_RECIPIENT: DWORD = 1; +pub const CMSG_KEY_AGREE_RECIPIENT: DWORD = 2; +pub const CMSG_MAIL_LIST_RECIPIENT: DWORD = 3; +STRUCT!{struct CMSG_RC2_AUX_INFO { + cbSize: DWORD, + dwBitLen: DWORD, +}} +pub type PCMSG_RC2_AUX_INFO = *mut CMSG_RC2_AUX_INFO; +STRUCT!{struct CMSG_SP3_COMPATIBLE_AUX_INFO { + cbSize: DWORD, + dwFlags: DWORD, +}} +pub type PCMSG_SP3_COMPATIBLE_AUX_INFO = *mut CMSG_SP3_COMPATIBLE_AUX_INFO; +pub const CMSG_SP3_COMPATIBLE_ENCRYPT_FLAG: DWORD = 0x80000000; +STRUCT!{struct CMSG_RC4_AUX_INFO { + cbSize: DWORD, + dwBitLen: DWORD, +}} +pub type PCMSG_RC4_AUX_INFO = *mut CMSG_RC4_AUX_INFO; +pub const CMSG_RC4_NO_SALT_FLAG: DWORD = 0x40000000; +STRUCT!{struct CMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO { + cbSize: DWORD, + SignedInfo: CMSG_SIGNED_ENCODE_INFO, + EnvelopedInfo: CMSG_ENVELOPED_ENCODE_INFO, +}} +pub type PCMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO = *mut CMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO; +STRUCT!{struct CMSG_HASHED_ENCODE_INFO { + cbSize: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut c_void, +}} +pub type PCMSG_HASHED_ENCODE_INFO = *mut CMSG_HASHED_ENCODE_INFO; +STRUCT!{struct CMSG_ENCRYPTED_ENCODE_INFO { + cbSize: DWORD, + ContentEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvEncryptionAuxInfo: *mut c_void, +}} +pub type PCMSG_ENCRYPTED_ENCODE_INFO = *mut CMSG_ENCRYPTED_ENCODE_INFO; +FN!{stdcall PFN_CMSG_STREAM_OUTPUT( + pvArg: *const c_void, + pbData: *mut BYTE, + cbData: DWORD, + fFinal: BOOL, +) -> BOOL} +pub const CMSG_INDEFINITE_LENGTH: DWORD = 0xFFFFFFFF; +STRUCT!{struct CMSG_STREAM_INFO { + cbContent: DWORD, + pfnStreamOutput: PFN_CMSG_STREAM_OUTPUT, + pvArg: *mut c_void, +}} +pub type PCMSG_STREAM_INFO = *mut CMSG_STREAM_INFO; +pub const CMSG_BARE_CONTENT_FLAG: DWORD = 0x00000001; +pub const CMSG_LENGTH_ONLY_FLAG: DWORD = 0x00000002; +pub const CMSG_DETACHED_FLAG: DWORD = 0x00000004; +pub const CMSG_AUTHENTICATED_ATTRIBUTES_FLAG: DWORD = 0x00000008; +pub const CMSG_CONTENTS_OCTETS_FLAG: DWORD = 0x00000010; +pub const CMSG_MAX_LENGTH_FLAG: DWORD = 0x00000020; +pub const CMSG_CMS_ENCAPSULATED_CONTENT_FLAG: DWORD = 0x00000040; +pub const CMSG_SIGNED_DATA_NO_SIGN_FLAG: DWORD = 0x00000080; +pub const CMSG_CRYPT_RELEASE_CONTEXT_FLAG: DWORD = 0x00008000; +extern "system" { + pub fn CryptMsgOpenToEncode( + dwMsgEncodingType: DWORD, + dwFlags: DWORD, + dwMsgType: DWORD, + pvMsgEncodeInfo: *mut c_void, + pszInnerContentObjID: LPSTR, + pStreamInfo: PCMSG_STREAM_INFO, + ) -> HCRYPTMSG; + pub fn CryptMsgCalculateEncodedLength( + dwMsgEncodingType: DWORD, + dwFlags: DWORD, + dwMsgType: DWORD, + pvMsgEncodeInfo: *const c_void, + pszInnerContentObjID: LPSTR, + cbData: DWORD, + ) -> DWORD; + pub fn CryptMsgOpenToDecode( + dwMsgEncodingType: DWORD, + dwFlags: DWORD, + dwMsgType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + pRecipientInfo: PCERT_INFO, + pStreamInfo: PCMSG_STREAM_INFO, + ) -> HCRYPTMSG; + pub fn CryptMsgDuplicate( + hCryptMsg: HCRYPTMSG, + ) -> HCRYPTMSG; + pub fn CryptMsgClose( + hCryptMsg: HCRYPTMSG, + ) -> BOOL; + pub fn CryptMsgUpdate( + hCryptMsg: HCRYPTMSG, + pbData: *const BYTE, + cbData: DWORD, + fFinal: BOOL, + ) -> BOOL; + pub fn CryptMsgGetParam( + hCryptMsg: HCRYPTMSG, + dwParamType: DWORD, + dwIndex: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, + ) -> BOOL; +} +pub const CMSG_TYPE_PARAM: DWORD = 1; +pub const CMSG_CONTENT_PARAM: DWORD = 2; +pub const CMSG_BARE_CONTENT_PARAM: DWORD = 3; +pub const CMSG_INNER_CONTENT_TYPE_PARAM: DWORD = 4; +pub const CMSG_SIGNER_COUNT_PARAM: DWORD = 5; +pub const CMSG_SIGNER_INFO_PARAM: DWORD = 6; +pub const CMSG_SIGNER_CERT_INFO_PARAM: DWORD = 7; +pub const CMSG_SIGNER_HASH_ALGORITHM_PARAM: DWORD = 8; +pub const CMSG_SIGNER_AUTH_ATTR_PARAM: DWORD = 9; +pub const CMSG_SIGNER_UNAUTH_ATTR_PARAM: DWORD = 10; +pub const CMSG_CERT_COUNT_PARAM: DWORD = 11; +pub const CMSG_CERT_PARAM: DWORD = 12; +pub const CMSG_CRL_COUNT_PARAM: DWORD = 13; +pub const CMSG_CRL_PARAM: DWORD = 14; +pub const CMSG_ENVELOPE_ALGORITHM_PARAM: DWORD = 15; +pub const CMSG_RECIPIENT_COUNT_PARAM: DWORD = 17; +pub const CMSG_RECIPIENT_INDEX_PARAM: DWORD = 18; +pub const CMSG_RECIPIENT_INFO_PARAM: DWORD = 19; +pub const CMSG_HASH_ALGORITHM_PARAM: DWORD = 20; +pub const CMSG_HASH_DATA_PARAM: DWORD = 21; +pub const CMSG_COMPUTED_HASH_PARAM: DWORD = 22; +pub const CMSG_ENCRYPT_PARAM: DWORD = 26; +pub const CMSG_ENCRYPTED_DIGEST: DWORD = 27; +pub const CMSG_ENCODED_SIGNER: DWORD = 28; +pub const CMSG_ENCODED_MESSAGE: DWORD = 29; +pub const CMSG_VERSION_PARAM: DWORD = 30; +pub const CMSG_ATTR_CERT_COUNT_PARAM: DWORD = 31; +pub const CMSG_ATTR_CERT_PARAM: DWORD = 32; +pub const CMSG_CMS_RECIPIENT_COUNT_PARAM: DWORD = 33; +pub const CMSG_CMS_RECIPIENT_INDEX_PARAM: DWORD = 34; +pub const CMSG_CMS_RECIPIENT_ENCRYPTED_KEY_INDEX_PARAM: DWORD = 35; +pub const CMSG_CMS_RECIPIENT_INFO_PARAM: DWORD = 36; +pub const CMSG_UNPROTECTED_ATTR_PARAM: DWORD = 37; +pub const CMSG_SIGNER_CERT_ID_PARAM: DWORD = 38; +pub const CMSG_CMS_SIGNER_INFO_PARAM: DWORD = 39; +STRUCT!{struct CMSG_SIGNER_INFO { + dwVersion: DWORD, + Issuer: CERT_NAME_BLOB, + SerialNumber: CRYPT_INTEGER_BLOB, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + HashEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedHash: CRYPT_DATA_BLOB, + AuthAttrs: CRYPT_ATTRIBUTES, + UnauthAttrs: CRYPT_ATTRIBUTES, +}} +pub type PCMSG_SIGNER_INFO = *mut CMSG_SIGNER_INFO; +STRUCT!{struct CMSG_CMS_SIGNER_INFO { + dwVersion: DWORD, + SignerId: CERT_ID, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + HashEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedHash: CRYPT_DATA_BLOB, + AuthAttrs: CRYPT_ATTRIBUTES, + UnauthAttrs: CRYPT_ATTRIBUTES, +}} +pub type PCMSG_CMS_SIGNER_INFO = *mut CMSG_CMS_SIGNER_INFO; +pub type CMSG_ATTR = CRYPT_ATTRIBUTES; +pub type PCMSG_ATTR = *mut CRYPT_ATTRIBUTES; +pub const CMSG_SIGNED_DATA_V1: DWORD = 1; +pub const CMSG_SIGNED_DATA_V3: DWORD = 3; +pub const CMSG_SIGNED_DATA_PKCS_1_5_VERSION: DWORD = CMSG_SIGNED_DATA_V1; +pub const CMSG_SIGNED_DATA_CMS_VERSION: DWORD = CMSG_SIGNED_DATA_V3; +pub const CMSG_SIGNER_INFO_V1: DWORD = 1; +pub const CMSG_SIGNER_INFO_V3: DWORD = 3; +pub const CMSG_SIGNER_INFO_PKCS_1_5_VERSION: DWORD = CMSG_SIGNER_INFO_V1; +pub const CMSG_SIGNER_INFO_CMS_VERSION: DWORD = CMSG_SIGNER_INFO_V3; +pub const CMSG_HASHED_DATA_V0: DWORD = 0; +pub const CMSG_HASHED_DATA_V2: DWORD = 2; +pub const CMSG_HASHED_DATA_PKCS_1_5_VERSION: DWORD = CMSG_HASHED_DATA_V0; +pub const CMSG_HASHED_DATA_CMS_VERSION: DWORD = CMSG_HASHED_DATA_V2; +pub const CMSG_ENVELOPED_DATA_V0: DWORD = 0; +pub const CMSG_ENVELOPED_DATA_V2: DWORD = 2; +pub const CMSG_ENVELOPED_DATA_PKCS_1_5_VERSION: DWORD = CMSG_ENVELOPED_DATA_V0; +pub const CMSG_ENVELOPED_DATA_CMS_VERSION: DWORD = CMSG_ENVELOPED_DATA_V2; +STRUCT!{struct CMSG_KEY_TRANS_RECIPIENT_INFO { + dwVersion: DWORD, + RecipientId: CERT_ID, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedKey: CRYPT_DATA_BLOB, +}} +pub type PCMSG_KEY_TRANS_RECIPIENT_INFO = *mut CMSG_KEY_TRANS_RECIPIENT_INFO; +STRUCT!{struct CMSG_RECIPIENT_ENCRYPTED_KEY_INFO { + RecipientId: CERT_ID, + EncryptedKey: CRYPT_DATA_BLOB, + Date: FILETIME, + pOtherAttr: PCRYPT_ATTRIBUTE_TYPE_VALUE, +}} +pub type PCMSG_RECIPIENT_ENCRYPTED_KEY_INFO = *mut CMSG_RECIPIENT_ENCRYPTED_KEY_INFO; +UNION!{union CMSG_KEY_AGREE_RECIPIENT_INFO_u { + [usize; 6], + OriginatorCertId OriginatorCertId_mut: CERT_ID, + OriginatorPublicKeyInfo OriginatorPublicKeyInfo_mut: CERT_PUBLIC_KEY_INFO, +}} +STRUCT!{struct CMSG_KEY_AGREE_RECIPIENT_INFO { + dwVersion: DWORD, + dwOriginatorChoice: DWORD, + u: CMSG_KEY_AGREE_RECIPIENT_INFO_u, + UserKeyingMaterial: CRYPT_DATA_BLOB, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + cRecipientEncryptedKeys: DWORD, + rgpRecipientEncryptedKeys: *mut PCMSG_RECIPIENT_ENCRYPTED_KEY_INFO, +}} +pub type PCMSG_KEY_AGREE_RECIPIENT_INFO = *mut CMSG_KEY_AGREE_RECIPIENT_INFO; +pub const CMSG_KEY_AGREE_ORIGINATOR_CERT: DWORD = 1; +pub const CMSG_KEY_AGREE_ORIGINATOR_PUBLIC_KEY: DWORD = 2; +STRUCT!{struct CMSG_MAIL_LIST_RECIPIENT_INFO { + dwVersion: DWORD, + KeyId: CRYPT_DATA_BLOB, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedKey: CRYPT_DATA_BLOB, + Date: FILETIME, + pOtherAttr: PCRYPT_ATTRIBUTE_TYPE_VALUE, +}} +pub type PCMSG_MAIL_LIST_RECIPIENT_INFO = *mut CMSG_MAIL_LIST_RECIPIENT_INFO; +UNION!{union CMSG_CMS_RECIPIENT_INFO_u { + [usize; 1], + pKeyTrans pKeyTrans_mut: PCMSG_KEY_TRANS_RECIPIENT_INFO, + pKeyAgree pKeyAgree_mut: PCMSG_KEY_AGREE_RECIPIENT_INFO, + pMailList pMailList_mut: PCMSG_MAIL_LIST_RECIPIENT_INFO, +}} +STRUCT!{struct CMSG_CMS_RECIPIENT_INFO { + dwRecipientChoice: DWORD, + u: CMSG_CMS_RECIPIENT_INFO_u, +}} +pub type PCMSG_CMS_RECIPIENT_INFO = *mut CMSG_CMS_RECIPIENT_INFO; +pub const CMSG_ENVELOPED_RECIPIENT_V0: DWORD = 0; +pub const CMSG_ENVELOPED_RECIPIENT_V2: DWORD = 2; +pub const CMSG_ENVELOPED_RECIPIENT_V3: DWORD = 3; +pub const CMSG_ENVELOPED_RECIPIENT_V4: DWORD = 4; +pub const CMSG_KEY_TRANS_PKCS_1_5_VERSION: DWORD = CMSG_ENVELOPED_RECIPIENT_V0; +pub const CMSG_KEY_TRANS_CMS_VERSION: DWORD = CMSG_ENVELOPED_RECIPIENT_V2; +pub const CMSG_KEY_AGREE_VERSION: DWORD = CMSG_ENVELOPED_RECIPIENT_V3; +pub const CMSG_MAIL_LIST_VERSION: DWORD = CMSG_ENVELOPED_RECIPIENT_V4; +extern "system" { + pub fn CryptMsgControl( + hCryptMsg: HCRYPTMSG, + dwFlags: DWORD, + dwCtrlType: DWORD, + pvCtrlPara: *const c_void, + ) -> BOOL; +} +pub const CMSG_CTRL_VERIFY_SIGNATURE: DWORD = 1; +pub const CMSG_CTRL_DECRYPT: DWORD = 2; +pub const CMSG_CTRL_VERIFY_HASH: DWORD = 5; +pub const CMSG_CTRL_ADD_SIGNER: DWORD = 6; +pub const CMSG_CTRL_DEL_SIGNER: DWORD = 7; +pub const CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR: DWORD = 8; +pub const CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR: DWORD = 9; +pub const CMSG_CTRL_ADD_CERT: DWORD = 10; +pub const CMSG_CTRL_DEL_CERT: DWORD = 11; +pub const CMSG_CTRL_ADD_CRL: DWORD = 12; +pub const CMSG_CTRL_DEL_CRL: DWORD = 13; +pub const CMSG_CTRL_ADD_ATTR_CERT: DWORD = 14; +pub const CMSG_CTRL_DEL_ATTR_CERT: DWORD = 15; +pub const CMSG_CTRL_KEY_TRANS_DECRYPT: DWORD = 16; +pub const CMSG_CTRL_KEY_AGREE_DECRYPT: DWORD = 17; +pub const CMSG_CTRL_MAIL_LIST_DECRYPT: DWORD = 18; +pub const CMSG_CTRL_VERIFY_SIGNATURE_EX: DWORD = 19; +pub const CMSG_CTRL_ADD_CMS_SIGNER_INFO: DWORD = 20; +pub const CMSG_CTRL_ENABLE_STRONG_SIGNATURE: DWORD = 21; +STRUCT!{struct CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA { + cbSize: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + dwSignerIndex: DWORD, + dwSignerType: DWORD, + pvSigner: *mut c_void, +}} +pub type PCMSG_CTRL_VERIFY_SIGNATURE_EX_PARA = *mut CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA; +pub const CMSG_VERIFY_SIGNER_PUBKEY: DWORD = 1; +pub const CMSG_VERIFY_SIGNER_CERT: DWORD = 2; +pub const CMSG_VERIFY_SIGNER_CHAIN: DWORD = 3; +pub const CMSG_VERIFY_SIGNER_NULL: DWORD = 4; +UNION!{union CMSG_CTRL_DECRYPT_PARA_u { + [usize; 1], + hCryptProv hCryptProv_mut: HCRYPTPROV, + hNCryptKey hNCryptKey_mut: NCRYPT_KEY_HANDLE, +}} +STRUCT!{struct CMSG_CTRL_DECRYPT_PARA { + cbSize: DWORD, + u: CMSG_CTRL_DECRYPT_PARA_u, + dwKeySpec: DWORD, + dwRecipientIndex: DWORD, +}} +pub type PCMSG_CTRL_DECRYPT_PARA = *mut CMSG_CTRL_DECRYPT_PARA; +UNION!{union CMSG_CTRL_KEY_TRANS_DECRYPT_PARA_u { + [usize; 1], + hCryptProv hCryptProv_mut: HCRYPTPROV, + hNCryptKey hNCryptKey_mut: NCRYPT_KEY_HANDLE, +}} +STRUCT!{struct CMSG_CTRL_KEY_TRANS_DECRYPT_PARA { + cbSize: DWORD, + u: CMSG_CTRL_KEY_TRANS_DECRYPT_PARA_u, + dwKeySpec: DWORD, + pKeyTrans: PCMSG_KEY_TRANS_RECIPIENT_INFO, + dwRecipientIndex: DWORD, +}} +pub type PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA = *mut CMSG_CTRL_KEY_TRANS_DECRYPT_PARA; +UNION!{union CMSG_CTRL_KEY_AGREE_DECRYPT_PARA_u { + [usize; 1], + hCryptProv hCryptProv_mut: HCRYPTPROV, + hNCryptKey hNCryptKey_mut: NCRYPT_KEY_HANDLE, +}} +STRUCT!{struct CMSG_CTRL_KEY_AGREE_DECRYPT_PARA { + cbSize: DWORD, + u: CMSG_CTRL_KEY_AGREE_DECRYPT_PARA_u, + dwKeySpec: DWORD, + pKeyAgree: PCMSG_KEY_AGREE_RECIPIENT_INFO, + dwRecipientIndex: DWORD, + dwRecipientEncryptedKeyIndex: DWORD, + OriginatorPublicKey: CRYPT_BIT_BLOB, +}} +pub type PCMSG_CTRL_KEY_AGREE_DECRYPT_PARA = *mut CMSG_CTRL_KEY_AGREE_DECRYPT_PARA; +UNION!{union CMSG_CTRL_MAIL_LIST_DECRYPT_PARA_u { + [usize; 1], + hKeyEncryptionKey hKeyEncryptionKey_mut: HCRYPTKEY, + pvKeyEncryptionKey pvKeyEncryptionKey_mut: *mut c_void, +}} +STRUCT!{struct CMSG_CTRL_MAIL_LIST_DECRYPT_PARA { + cbSize: DWORD, + hCryptProv: HCRYPTPROV, + pMailList: PCMSG_MAIL_LIST_RECIPIENT_INFO, + dwRecipientIndex: DWORD, + dwKeyChoice: DWORD, + u: CMSG_CTRL_MAIL_LIST_DECRYPT_PARA_u, +}} +pub type PCMSG_CTRL_MAIL_LIST_DECRYPT_PARA = *mut CMSG_CTRL_MAIL_LIST_DECRYPT_PARA; +STRUCT!{struct CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA { + cbSize: DWORD, + dwSignerIndex: DWORD, + blob: CRYPT_DATA_BLOB, +}} +pub type PCMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA = *mut CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA; +STRUCT!{struct CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA { + cbSize: DWORD, + dwSignerIndex: DWORD, + dwUnauthAttrIndex: DWORD, +}} +pub type PCMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA = *mut CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA; +extern "system" { + pub fn CryptMsgVerifyCountersignatureEncoded( + hCryptProv: HCRYPTPROV_LEGACY, + dwEncodingType: DWORD, + pbSignerInfo: PBYTE, + cbSignerInfo: DWORD, + pbSignerInfoCountersignature: PBYTE, + cbSignerInfoCountersignature: DWORD, + pciCountersigner: PCERT_INFO, + ) -> BOOL; + pub fn CryptMsgVerifyCountersignatureEncodedEx( + hCryptProv: HCRYPTPROV_LEGACY, + dwEncodingType: DWORD, + pbSignerInfo: PBYTE, + cbSignerInfo: DWORD, + pbSignerInfoCountersignature: PBYTE, + cbSignerInfoCountersignature: DWORD, + dwSignerType: DWORD, + pvSigner: *mut c_void, + dwFlags: DWORD, + pvExtra: *mut c_void, + ) -> BOOL; +} +pub const CMSG_VERIFY_COUNTER_SIGN_ENABLE_STRONG_FLAG: DWORD = 0x00000001; +extern "system" { + pub fn CryptMsgCountersign( + hCryptMsg: HCRYPTMSG, + dwIndex: DWORD, + cCountersigners: DWORD, + rgCountersigners: PCMSG_SIGNER_ENCODE_INFO, + ) -> BOOL; + pub fn CryptMsgCountersignEncoded( + dwEncodingType: DWORD, + pbSignerInfo: PBYTE, + cbSignerInfo: DWORD, + cCountersigners: DWORD, + rgCountersigners: PCMSG_SIGNER_ENCODE_INFO, + pbCountersignature: PBYTE, + pcbCountersignature: PDWORD, + ) -> BOOL; +} +FN!{stdcall PFN_CMSG_ALLOC( + cb: size_t, +) -> ()} +FN!{stdcall PFN_CMSG_FREE( + pv: *mut c_void, +) -> ()} +pub const CMSG_OID_GEN_ENCRYPT_KEY_FUNC: &'static str = "CryptMsgDllGenEncryptKey"; +FN!{stdcall PFN_CMSG_GEN_ENCRYPT_KEY( + phCryptProv: *mut HCRYPTPROV, + paiEncrypt: PCRYPT_ALGORITHM_IDENTIFIER, + pvEncryptAuxInfo: PVOID, + pPublicKeyInfo: PCERT_PUBLIC_KEY_INFO, + pfnAlloc: PFN_CMSG_ALLOC, + phEncryptKey: *mut HCRYPTKEY, + ppbEncryptParameters: *mut PBYTE, + pcbEncryptParameters: PDWORD, +) -> BOOL} +pub const CMSG_OID_EXPORT_ENCRYPT_KEY_FUNC: &'static str = "CryptMsgDllExportEncryptKey"; +FN!{stdcall PFN_CMSG_EXPORT_ENCRYPT_KEY( + hCryptProv: HCRYPTPROV, + hEncryptKey: HCRYPTKEY, + pPublicKeyInfo: PCERT_PUBLIC_KEY_INFO, + pbData: PBYTE, + pcbData: PDWORD, +) -> BOOL} +pub const CMSG_OID_IMPORT_ENCRYPT_KEY_FUNC: &'static str = "CryptMsgDllImportEncryptKey"; +FN!{stdcall PFN_CMSG_IMPORT_ENCRYPT_KEY( + hCryptProv: HCRYPTPROV, + dwKeySpec: DWORD, + paiEncrypt: PCRYPT_ALGORITHM_IDENTIFIER, + paiPubKey: PCRYPT_ALGORITHM_IDENTIFIER, + pbEncodedKey: PBYTE, + cbEncodedKey: DWORD, + phEncryptKey: *mut HCRYPTKEY, +) -> BOOL} +pub const CMSG_DEFAULT_INSTALLABLE_FUNC_OID: LPCSTR = 1 as LPCSTR; +UNION!{union CMSG_CONTENT_ENCRYPT_INFO_u { + [usize; 1], + hContentEncryptKey hContentEncryptKey_mut: HCRYPTKEY, + hCNGContentEncryptKey hCNGContentEncryptKey_mut: BCRYPT_KEY_HANDLE, +}} +STRUCT!{struct CMSG_CONTENT_ENCRYPT_INFO { + cbSize: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + ContentEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvEncryptionAuxInfo: *mut c_void, + cRecipients: DWORD, + rgCmsRecipients: PCMSG_RECIPIENT_ENCODE_INFO, + pfnAlloc: PFN_CMSG_ALLOC, + pfnFree: PFN_CMSG_FREE, + dwEncryptFlags: DWORD, + u: CMSG_CONTENT_ENCRYPT_INFO_u, + dwFlags: DWORD, + fCNG: BOOL, + pbCNGContentEncryptKeyObject: *mut BYTE, + pbContentEncryptKey: *mut BYTE, + cbContentEncryptKey: DWORD, +}} +pub type PCMSG_CONTENT_ENCRYPT_INFO = *mut CMSG_CONTENT_ENCRYPT_INFO; +pub const CMSG_CONTENT_ENCRYPT_PAD_ENCODED_LEN_FLAG: DWORD = 0x00000001; +pub const CMSG_CONTENT_ENCRYPT_FREE_PARA_FLAG: DWORD = 0x00000001; +pub const CMSG_CONTENT_ENCRYPT_FREE_OBJID_FLAG: DWORD = 0x00000002; +pub const CMSG_CONTENT_ENCRYPT_RELEASE_CONTEXT_FLAG: DWORD = 0x00008000; +pub const CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC: &'static str = "CryptMsgDllGenContentEncryptKey"; +pub const CMSG_OID_CAPI1_GEN_CONTENT_ENCRYPT_KEY_FUNC: &'static str + = CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC; +FN!{stdcall PFN_CMSG_GEN_CONTENT_ENCRYPT_KEY( + pContentEncryptInfo: PCMSG_CONTENT_ENCRYPT_INFO, + dwFlags: DWORD, + pvReserved: *mut c_void, +) -> BOOL} +pub const CMSG_OID_CNG_GEN_CONTENT_ENCRYPT_KEY_FUNC: &'static str + = "CryptMsgDllCNGGenContentEncryptKey"; +STRUCT!{struct CMSG_KEY_TRANS_ENCRYPT_INFO { + cbSize: DWORD, + dwRecipientIndex: DWORD, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedKey: CRYPT_DATA_BLOB, + dwFlags: DWORD, +}} +pub type PCMSG_KEY_TRANS_ENCRYPT_INFO = *mut CMSG_KEY_TRANS_ENCRYPT_INFO; +pub const CMSG_KEY_TRANS_ENCRYPT_FREE_PARA_FLAG: DWORD = 0x00000001; +pub const CMSG_KEY_TRANS_ENCRYPT_FREE_OBJID_FLAG: DWORD = 0x00000002; +pub const CMSG_OID_EXPORT_KEY_TRANS_FUNC: &'static str = "CryptMsgDllExportKeyTrans"; +pub const CMSG_OID_CAPI1_EXPORT_KEY_TRANS_FUNC: &'static str = CMSG_OID_EXPORT_KEY_TRANS_FUNC; +FN!{stdcall PFN_CMSG_EXPORT_KEY_TRANS( + pContentEncryptInfo: PCMSG_CONTENT_ENCRYPT_INFO, + pKeyTransEncodeInfo: PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO, + pKeyTransEncryptInfo: PCMSG_KEY_TRANS_ENCRYPT_INFO, + dwFlags: DWORD, + pvReserved: *mut c_void, +) -> BOOL} +pub const CMSG_OID_CNG_EXPORT_KEY_TRANS_FUNC: &'static str = "CryptMsgDllCNGExportKeyTrans"; +STRUCT!{struct CMSG_KEY_AGREE_KEY_ENCRYPT_INFO { + cbSize: DWORD, + EncryptedKey: CRYPT_DATA_BLOB, +}} +pub type PCMSG_KEY_AGREE_KEY_ENCRYPT_INFO = *mut CMSG_KEY_AGREE_KEY_ENCRYPT_INFO; +UNION!{union CMSG_KEY_AGREE_ENCRYPT_INFO_u { + [usize; 6], + OriginatorCertId OriginatorCertId_mut: CERT_ID, + OriginatorPublicKeyInfo OriginatorPublicKeyInfo_mut: CERT_PUBLIC_KEY_INFO, +}} +STRUCT!{struct CMSG_KEY_AGREE_ENCRYPT_INFO { + cbSize: DWORD, + dwRecipientIndex: DWORD, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + UserKeyingMaterial: CRYPT_DATA_BLOB, + dwOriginatorChoice: DWORD, + u: CMSG_KEY_AGREE_ENCRYPT_INFO_u, + cKeyAgreeKeyEncryptInfo: DWORD, + rgpKeyAgreeKeyEncryptInfo: *mut PCMSG_KEY_AGREE_KEY_ENCRYPT_INFO, + dwFlags: DWORD, +}} +pub type PCMSG_KEY_AGREE_ENCRYPT_INFO = *mut CMSG_KEY_AGREE_ENCRYPT_INFO; +pub const CMSG_KEY_AGREE_ENCRYPT_FREE_PARA_FLAG: DWORD = 0x00000001; +pub const CMSG_KEY_AGREE_ENCRYPT_FREE_MATERIAL_FLAG: DWORD = 0x00000002; +pub const CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_ALG_FLAG: DWORD = 0x00000004; +pub const CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_PARA_FLAG: DWORD = 0x00000008; +pub const CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_BITS_FLAG: DWORD = 0x00000010; +pub const CMSG_KEY_AGREE_ENCRYPT_FREE_OBJID_FLAG: DWORD = 0x00000020; +pub const CMSG_OID_EXPORT_KEY_AGREE_FUNC: &'static str = "CryptMsgDllExportKeyAgree"; +pub const CMSG_OID_CAPI1_EXPORT_KEY_AGREE_FUNC: &'static str = CMSG_OID_EXPORT_KEY_AGREE_FUNC; +FN!{stdcall PFN_CMSG_EXPORT_KEY_AGREE( + pContentEncryptInfo: PCMSG_CONTENT_ENCRYPT_INFO, + pKeyAgreeEncodeInfo: PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO, + pKeyAgreeEncryptInfo: PCMSG_KEY_AGREE_ENCRYPT_INFO, + dwFlags: DWORD, + pvReserved: *mut c_void, +) -> BOOL} +pub const CMSG_OID_CNG_EXPORT_KEY_AGREE_FUNC: &'static str = "CryptMsgDllCNGExportKeyAgree"; +STRUCT!{struct CMSG_MAIL_LIST_ENCRYPT_INFO { + cbSize: DWORD, + dwRecipientIndex: DWORD, + KeyEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + EncryptedKey: CRYPT_DATA_BLOB, + dwFlags: DWORD, +}} +pub type PCMSG_MAIL_LIST_ENCRYPT_INFO = *mut CMSG_MAIL_LIST_ENCRYPT_INFO; +pub const CMSG_MAIL_LIST_ENCRYPT_FREE_PARA_FLAG: DWORD = 0x00000001; +pub const CMSG_MAIL_LIST_ENCRYPT_FREE_OBJID_FLAG: DWORD = 0x00000002; +pub const CMSG_OID_EXPORT_MAIL_LIST_FUNC: &'static str = "CryptMsgDllExportMailList"; +pub const CMSG_OID_CAPI1_EXPORT_MAIL_LIST_FUNC: &'static str = CMSG_OID_EXPORT_MAIL_LIST_FUNC; +FN!{stdcall PFN_CMSG_EXPORT_MAIL_LIST( + pContentEncryptInfo: PCMSG_CONTENT_ENCRYPT_INFO, + pMailListEncodeInfo: PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO, + pMailListEncryptInfo: PCMSG_MAIL_LIST_ENCRYPT_INFO, + dwFlags: DWORD, + pvReserved: *mut c_void, +) -> BOOL} +pub const CMSG_OID_IMPORT_KEY_TRANS_FUNC: &'static str = "CryptMsgDllImportKeyTrans"; +pub const CMSG_OID_CAPI1_IMPORT_KEY_TRANS_FUNC: &'static str = CMSG_OID_IMPORT_KEY_TRANS_FUNC; +FN!{stdcall PFN_CMSG_IMPORT_KEY_TRANS( + pContentEncryptionAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pKeyTransDecryptPara: PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA, + dwFlags: DWORD, + pvReserved: *mut c_void, + phContentEncryptKey: *mut HCRYPTKEY, +) -> BOOL} +pub const CMSG_OID_IMPORT_KEY_AGREE_FUNC: &'static str = "CryptMsgDllImportKeyAgree"; +pub const CMSG_OID_CAPI1_IMPORT_KEY_AGREE_FUNC: &'static str = CMSG_OID_IMPORT_KEY_AGREE_FUNC; +FN!{stdcall PFN_CMSG_IMPORT_KEY_AGREE( + pContentEncryptionAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pKeyAgreeDecryptPara: PCMSG_CTRL_KEY_AGREE_DECRYPT_PARA, + dwFlags: DWORD, + pvReserved: *mut c_void, + phContentEncryptKey: *mut HCRYPTKEY, +) -> BOOL} +pub const CMSG_OID_IMPORT_MAIL_LIST_FUNC: &'static str = "CryptMsgDllImportMailList"; +pub const CMSG_OID_CAPI1_IMPORT_MAIL_LIST_FUNC: &'static str = CMSG_OID_IMPORT_MAIL_LIST_FUNC; +FN!{stdcall PFN_CMSG_IMPORT_MAIL_LIST( + pContentEncryptionAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pMailListDecryptPara: PCMSG_CTRL_MAIL_LIST_DECRYPT_PARA, + dwFlags: DWORD, + pvReserved: *mut c_void, + phContentEncryptKey: *mut HCRYPTKEY, +) -> BOOL} +STRUCT!{struct CMSG_CNG_CONTENT_DECRYPT_INFO { + cbSize: DWORD, + ContentEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pfnAlloc: PFN_CMSG_ALLOC, + pfnFree: PFN_CMSG_FREE, + hNCryptKey: NCRYPT_KEY_HANDLE, + pbContentEncryptKey: *mut BYTE, + cbContentEncryptKey: DWORD, + hCNGContentEncryptKey: BCRYPT_KEY_HANDLE, + pbCNGContentEncryptKeyObject: *mut BYTE, +}} +pub type PCMSG_CNG_CONTENT_DECRYPT_INFO = *mut CMSG_CNG_CONTENT_DECRYPT_INFO; +pub const CMSG_OID_CNG_IMPORT_KEY_TRANS_FUNC: &'static str = "CryptMsgDllCNGImportKeyTrans"; +FN!{stdcall PFN_CMSG_CNG_IMPORT_KEY_TRANS( + pCNGContentDecryptInfo: PCMSG_CNG_CONTENT_DECRYPT_INFO, + pKeyTransDecryptPara: PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA, + dwFlags: DWORD, + pvReserved: *mut c_void, +) -> BOOL} +pub const CMSG_OID_CNG_IMPORT_KEY_AGREE_FUNC: &'static str = "CryptMsgDllCNGImportKeyAgree"; +FN!{stdcall PFN_CMSG_CNG_IMPORT_KEY_AGREE( + pCNGContentDecryptInfo: PCMSG_CNG_CONTENT_DECRYPT_INFO, + pKeyAgreeDecryptPara: PCMSG_CTRL_KEY_AGREE_DECRYPT_PARA, + dwFlags: DWORD, + pvReserved: *mut c_void, +) -> BOOL} +pub const CMSG_OID_CNG_IMPORT_CONTENT_ENCRYPT_KEY_FUNC: &'static str + = "CryptMsgDllCNGImportContentEncryptKey"; +FN!{stdcall PFN_CMSG_CNG_IMPORT_CONTENT_ENCRYPT_KEY( + pCNGContentDecryptInfo: PCMSG_CNG_CONTENT_DECRYPT_INFO, + dwFlags: DWORD, + pvReserved: *mut c_void, +) -> BOOL} +pub type HCERTSTORE = *mut c_void; +STRUCT!{struct CERT_CONTEXT { + dwCertEncodingType: DWORD, + pbCertEncoded: *mut BYTE, + cbCertEncoded: DWORD, + pCertInfo: PCERT_INFO, + hCertStore: HCERTSTORE, +}} +pub type PCERT_CONTEXT = *mut CERT_CONTEXT; +pub type PCCERT_CONTEXT = *const CERT_CONTEXT; +STRUCT!{struct CRL_CONTEXT { + dwCertEncodingType: DWORD, + pbCrlEncoded: *mut BYTE, + cbCrlEncoded: DWORD, + pCrlInfo: PCRL_INFO, + hCertStore: HCERTSTORE, +}} +pub type PCRL_CONTEXT = *mut CRL_CONTEXT; +pub type PCCRL_CONTEXT = *const CRL_CONTEXT; +STRUCT!{struct CTL_CONTEXT { + dwMsgAndCertEncodingType: DWORD, + pbCtlEncoded: *mut BYTE, + cbCtlEncoded: DWORD, + pCtlInfo: PCTL_INFO, + hCertStore: HCERTSTORE, + hCryptMsg: HCRYPTMSG, + pbCtlContent: *mut BYTE, + cbCtlContent: DWORD, +}} +pub type PCTL_CONTEXT = *mut CTL_CONTEXT; +pub type PCCTL_CONTEXT = *const CTL_CONTEXT; +pub const CERT_KEY_PROV_HANDLE_PROP_ID: DWORD = 1; +pub const CERT_KEY_PROV_INFO_PROP_ID: DWORD = 2; +pub const CERT_SHA1_HASH_PROP_ID: DWORD = 3; +pub const CERT_MD5_HASH_PROP_ID: DWORD = 4; +pub const CERT_HASH_PROP_ID: DWORD = CERT_SHA1_HASH_PROP_ID; +pub const CERT_KEY_CONTEXT_PROP_ID: DWORD = 5; +pub const CERT_KEY_SPEC_PROP_ID: DWORD = 6; +pub const CERT_IE30_RESERVED_PROP_ID: DWORD = 7; +pub const CERT_PUBKEY_HASH_RESERVED_PROP_ID: DWORD = 8; +pub const CERT_ENHKEY_USAGE_PROP_ID: DWORD = 9; +pub const CERT_CTL_USAGE_PROP_ID: DWORD = CERT_ENHKEY_USAGE_PROP_ID; +pub const CERT_NEXT_UPDATE_LOCATION_PROP_ID: DWORD = 10; +pub const CERT_FRIENDLY_NAME_PROP_ID: DWORD = 11; +pub const CERT_PVK_FILE_PROP_ID: DWORD = 12; +pub const CERT_DESCRIPTION_PROP_ID: DWORD = 13; +pub const CERT_ACCESS_STATE_PROP_ID: DWORD = 14; +pub const CERT_SIGNATURE_HASH_PROP_ID: DWORD = 15; +pub const CERT_SMART_CARD_DATA_PROP_ID: DWORD = 16; +pub const CERT_EFS_PROP_ID: DWORD = 17; +pub const CERT_FORTEZZA_DATA_PROP_ID: DWORD = 18; +pub const CERT_ARCHIVED_PROP_ID: DWORD = 19; +pub const CERT_KEY_IDENTIFIER_PROP_ID: DWORD = 20; +pub const CERT_AUTO_ENROLL_PROP_ID: DWORD = 21; +pub const CERT_PUBKEY_ALG_PARA_PROP_ID: DWORD = 22; +pub const CERT_CROSS_CERT_DIST_POINTS_PROP_ID: DWORD = 23; +pub const CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID: DWORD = 24; +pub const CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: DWORD = 25; +pub const CERT_ENROLLMENT_PROP_ID: DWORD = 26; +pub const CERT_DATE_STAMP_PROP_ID: DWORD = 27; +pub const CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: DWORD = 28; +pub const CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: DWORD = 29; +pub const CERT_EXTENDED_ERROR_INFO_PROP_ID: DWORD = 30; +pub const CERT_RENEWAL_PROP_ID: DWORD = 64; +pub const CERT_ARCHIVED_KEY_HASH_PROP_ID: DWORD = 65; +pub const CERT_AUTO_ENROLL_RETRY_PROP_ID: DWORD = 66; +pub const CERT_AIA_URL_RETRIEVED_PROP_ID: DWORD = 67; +pub const CERT_AUTHORITY_INFO_ACCESS_PROP_ID: DWORD = 68; +pub const CERT_BACKED_UP_PROP_ID: DWORD = 69; +pub const CERT_OCSP_RESPONSE_PROP_ID: DWORD = 70; +pub const CERT_REQUEST_ORIGINATOR_PROP_ID: DWORD = 71; +pub const CERT_SOURCE_LOCATION_PROP_ID: DWORD = 72; +pub const CERT_SOURCE_URL_PROP_ID: DWORD = 73; +pub const CERT_NEW_KEY_PROP_ID: DWORD = 74; +pub const CERT_OCSP_CACHE_PREFIX_PROP_ID: DWORD = 75; +pub const CERT_SMART_CARD_ROOT_INFO_PROP_ID: DWORD = 76; +pub const CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID: DWORD = 77; +pub const CERT_NCRYPT_KEY_HANDLE_PROP_ID: DWORD = 78; +pub const CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID: DWORD = 79; +pub const CERT_SUBJECT_INFO_ACCESS_PROP_ID: DWORD = 80; +pub const CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: DWORD = 81; +pub const CERT_CA_DISABLE_CRL_PROP_ID: DWORD = 82; +pub const CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID: DWORD = 83; +pub const CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID: DWORD = 84; +pub const CERT_SUBJECT_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: DWORD = 85; +pub const CERT_SUBJECT_DISABLE_CRL_PROP_ID: DWORD = 86; +pub const CERT_CEP_PROP_ID: DWORD = 87; +pub const CERT_SIGN_HASH_CNG_ALG_PROP_ID: DWORD = 89; +pub const CERT_SCARD_PIN_ID_PROP_ID: DWORD = 90; +pub const CERT_SCARD_PIN_INFO_PROP_ID: DWORD = 91; +pub const CERT_SUBJECT_PUB_KEY_BIT_LENGTH_PROP_ID: DWORD = 92; +pub const CERT_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID: DWORD = 93; +pub const CERT_ISSUER_PUB_KEY_BIT_LENGTH_PROP_ID: DWORD = 94; +pub const CERT_ISSUER_CHAIN_SIGN_HASH_CNG_ALG_PROP_ID: DWORD = 95; +pub const CERT_ISSUER_CHAIN_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID: DWORD = 96; +pub const CERT_NO_EXPIRE_NOTIFICATION_PROP_ID: DWORD = 97; +pub const CERT_AUTH_ROOT_SHA256_HASH_PROP_ID: DWORD = 98; +pub const CERT_NCRYPT_KEY_HANDLE_TRANSFER_PROP_ID: DWORD = 99; +pub const CERT_HCRYPTPROV_TRANSFER_PROP_ID: DWORD = 100; +pub const CERT_SMART_CARD_READER_PROP_ID: DWORD = 101; +pub const CERT_SEND_AS_TRUSTED_ISSUER_PROP_ID: DWORD = 102; +pub const CERT_KEY_REPAIR_ATTEMPTED_PROP_ID: DWORD = 103; +pub const CERT_DISALLOWED_FILETIME_PROP_ID: DWORD = 104; +pub const CERT_ROOT_PROGRAM_CHAIN_POLICIES_PROP_ID: DWORD = 105; +pub const CERT_SMART_CARD_READER_NON_REMOVABLE_PROP_ID: DWORD = 106; +pub const CERT_SHA256_HASH_PROP_ID: DWORD = 107; +pub const CERT_SCEP_SERVER_CERTS_PROP_ID: DWORD = 108; +pub const CERT_SCEP_RA_SIGNATURE_CERT_PROP_ID: DWORD = 109; +pub const CERT_SCEP_RA_ENCRYPTION_CERT_PROP_ID: DWORD = 110; +pub const CERT_SCEP_CA_CERT_PROP_ID: DWORD = 111; +pub const CERT_SCEP_SIGNER_CERT_PROP_ID: DWORD = 112; +pub const CERT_SCEP_NONCE_PROP_ID: DWORD = 113; +pub const CERT_SCEP_ENCRYPT_HASH_CNG_ALG_PROP_ID: DWORD = 114; +pub const CERT_SCEP_FLAGS_PROP_ID: DWORD = 115; +pub const CERT_SCEP_GUID_PROP_ID: DWORD = 116; +pub const CERT_SERIALIZABLE_KEY_CONTEXT_PROP_ID: DWORD = 117; +pub const CERT_ISOLATED_KEY_PROP_ID: DWORD = 118; +pub const CERT_SERIAL_CHAIN_PROP_ID: DWORD = 119; +pub const CERT_KEY_CLASSIFICATION_PROP_ID: DWORD = 120; +pub const CERT_OCSP_MUST_STAPLE_PROP_ID: DWORD = 121; +pub const CERT_DISALLOWED_ENHKEY_USAGE_PROP_ID: DWORD = 122; +pub const CERT_NONCOMPLIANT_ROOT_URL_PROP_ID: DWORD = 123; +pub const CERT_PIN_SHA256_HASH_PROP_ID: DWORD = 124; +pub const CERT_CLR_DELETE_KEY_PROP_ID: DWORD = 125; +pub const CERT_NOT_BEFORE_FILETIME_PROP_ID: DWORD = 126; +pub const CERT_NOT_BEFORE_ENHKEY_USAGE_PROP_ID: DWORD = 127; +pub const CERT_FIRST_RESERVED_PROP_ID: DWORD = 128; +pub const CERT_LAST_RESERVED_PROP_ID: DWORD = 0x00007FFF; +pub const CERT_FIRST_USER_PROP_ID: DWORD = 0x00008000; +pub const CERT_LAST_USER_PROP_ID: DWORD = 0x0000FFFF; +ENUM!{enum CertKeyType { + KeyTypeOther = 0, + KeyTypeVirtualSmartCard = 1, + KeyTypePhysicalSmartCard = 2, + KeyTypePassport = 3, + KeyTypePassportRemote = 4, + KeyTypePassportSmartCard = 5, + KeyTypeHardware = 6, + KeyTypeSoftware = 7, + KeyTypeSelfSigned = 8, +}} +#[inline] +pub fn IS_CERT_HASH_PROP_ID(X: DWORD) -> bool { + CERT_SHA1_HASH_PROP_ID == X || CERT_MD5_HASH_PROP_ID == X || CERT_SHA256_HASH_PROP_ID == X + || CERT_SIGNATURE_HASH_PROP_ID == X +} +#[inline] +pub fn IS_PUBKEY_HASH_PROP_ID(X: DWORD) -> bool { + CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID == X || CERT_PIN_SHA256_HASH_PROP_ID == X + || CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID == X +} +#[inline] +pub fn IS_CHAIN_HASH_PROP_ID(X: DWORD) -> bool { + CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID == X || CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID == X + || CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID == X || CERT_SUBJECT_NAME_MD5_HASH_PROP_ID == X +} +#[inline] +pub fn IS_STRONG_SIGN_PROP_ID(X: DWORD) -> bool { + CERT_SIGN_HASH_CNG_ALG_PROP_ID == X || CERT_SUBJECT_PUB_KEY_BIT_LENGTH_PROP_ID == X + || CERT_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID == X +} +pub const szOID_CERT_PROP_ID_PREFIX: &'static str = "1.3.6.1.4.1.311.10.11."; +pub const szOID_CERT_KEY_IDENTIFIER_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.20"; +pub const szOID_CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: &'static str + = "1.3.6.1.4.1.311.10.11.28"; +pub const szOID_CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.29"; +pub const szOID_CERT_MD5_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.4"; +pub const szOID_CERT_SIGNATURE_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.15"; +pub const szOID_DISALLOWED_HASH: &'static str = szOID_CERT_SIGNATURE_HASH_PROP_ID; +pub const szOID_CERT_DISALLOWED_FILETIME_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.104"; +pub const CERT_ACCESS_STATE_WRITE_PERSIST_FLAG: DWORD = 0x1; +pub const CERT_ACCESS_STATE_SYSTEM_STORE_FLAG: DWORD = 0x2; +pub const CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG: DWORD = 0x4; +pub const CERT_ACCESS_STATE_GP_SYSTEM_STORE_FLAG: DWORD = 0x8; +pub const CERT_ACCESS_STATE_SHARED_USER_FLAG: DWORD = 0x10; +pub const szOID_ROOT_PROGRAM_AUTO_UPDATE_CA_REVOCATION: &'static str = "1.3.6.1.4.1.311.60.3.1"; +pub const szOID_ROOT_PROGRAM_AUTO_UPDATE_END_REVOCATION: &'static str = "1.3.6.1.4.1.311.60.3.2"; +pub const szOID_ROOT_PROGRAM_NO_OCSP_FAILOVER_TO_CRL: &'static str = "1.3.6.1.4.1.311.60.3.3"; +STRUCT!{struct CRYPT_KEY_PROV_PARAM { + dwParam: DWORD, + pbData: *mut BYTE, + cbData: DWORD, + dwFlags: DWORD, +}} +pub type PCRYPT_KEY_PROV_PARAM = *mut CRYPT_KEY_PROV_PARAM; +STRUCT!{struct CRYPT_KEY_PROV_INFO { + pwszContainerName: LPWSTR, + pwszProvName: LPWSTR, + dwProvType: DWORD, + dwFlags: DWORD, + cProvParam: DWORD, + rgProvParam: PCRYPT_KEY_PROV_PARAM, + dwKeySpec: DWORD, +}} +pub type PCRYPT_KEY_PROV_INFO = *mut CRYPT_KEY_PROV_INFO; +pub const CERT_SET_KEY_PROV_HANDLE_PROP_ID: DWORD = 0x00000001; +pub const CERT_SET_KEY_CONTEXT_PROP_ID: DWORD = 0x00000001; +pub const CERT_NCRYPT_KEY_SPEC: DWORD = 0xFFFFFFFF; +UNION!{union CERT_KEY_CONTEXT_u { + [usize; 1], + hCryptProv hCryptProv_mut: HCRYPTPROV, + hNCryptKey hNCryptKey_mut: NCRYPT_KEY_HANDLE, +}} +STRUCT!{struct CERT_KEY_CONTEXT { + cbSize: DWORD, + u: CERT_KEY_CONTEXT_u, + dwKeySpec: DWORD, +}} +pub type PCERT_KEY_CONTEXT = *mut CERT_KEY_CONTEXT; +STRUCT!{struct ROOT_INFO_LUID { + LowPart: DWORD, + HighPart: LONG, +}} +pub type PROOT_INFO_LUID = *mut ROOT_INFO_LUID; +STRUCT!{struct CRYPT_SMART_CARD_ROOT_INFO { + rgbCardID: [BYTE; 16], + luid: ROOT_INFO_LUID, +}} +pub type PCRYPT_SMART_CARD_ROOT_INFO = *mut CRYPT_SMART_CARD_ROOT_INFO; +pub const CERT_STORE_PROV_MSG: LPCSTR = 1 as LPCSTR; +pub const CERT_STORE_PROV_MEMORY: LPCSTR = 2 as LPCSTR; +pub const CERT_STORE_PROV_FILE: LPCSTR = 3 as LPCSTR; +pub const CERT_STORE_PROV_REG: LPCSTR = 4 as LPCSTR; +pub const CERT_STORE_PROV_PKCS7: LPCSTR = 5 as LPCSTR; +pub const CERT_STORE_PROV_SERIALIZED: LPCSTR = 6 as LPCSTR; +pub const CERT_STORE_PROV_FILENAME_A: LPCSTR = 7 as LPCSTR; +pub const CERT_STORE_PROV_FILENAME_W: LPCSTR = 8 as LPCSTR; +pub const CERT_STORE_PROV_FILENAME: LPCSTR = CERT_STORE_PROV_FILENAME_W; +pub const CERT_STORE_PROV_SYSTEM_A: LPCSTR = 9 as LPCSTR; +pub const CERT_STORE_PROV_SYSTEM_W: LPCSTR = 10 as LPCSTR; +pub const CERT_STORE_PROV_SYSTEM: LPCSTR = CERT_STORE_PROV_SYSTEM_W; +pub const CERT_STORE_PROV_COLLECTION: LPCSTR = 11 as LPCSTR; +pub const CERT_STORE_PROV_SYSTEM_REGISTRY_A: LPCSTR = 12 as LPCSTR; +pub const CERT_STORE_PROV_SYSTEM_REGISTRY_W: LPCSTR = 13 as LPCSTR; +pub const CERT_STORE_PROV_SYSTEM_REGISTRY: LPCSTR = CERT_STORE_PROV_SYSTEM_REGISTRY_W; +pub const CERT_STORE_PROV_PHYSICAL_W: LPCSTR = 14 as LPCSTR; +pub const CERT_STORE_PROV_PHYSICAL: LPCSTR = CERT_STORE_PROV_PHYSICAL_W; +pub const CERT_STORE_PROV_SMART_CARD_W: LPCSTR = 15 as LPCSTR; +pub const CERT_STORE_PROV_SMART_CARD: LPCSTR = CERT_STORE_PROV_SMART_CARD_W; +pub const CERT_STORE_PROV_LDAP_W: LPCSTR = 16 as LPCSTR; +pub const CERT_STORE_PROV_LDAP: LPCSTR = CERT_STORE_PROV_LDAP_W; +pub const CERT_STORE_PROV_PKCS12: LPCSTR = 17 as LPCSTR; +pub const sz_CERT_STORE_PROV_MEMORY: &'static str = "Memory"; +pub const sz_CERT_STORE_PROV_FILENAME_W: &'static str = "File"; +pub const sz_CERT_STORE_PROV_FILENAME: &'static str = sz_CERT_STORE_PROV_FILENAME_W; +pub const sz_CERT_STORE_PROV_SYSTEM_W: &'static str = "System"; +pub const sz_CERT_STORE_PROV_SYSTEM: &'static str = sz_CERT_STORE_PROV_SYSTEM_W; +pub const sz_CERT_STORE_PROV_PKCS7: &'static str = "PKCS7"; +pub const sz_CERT_STORE_PROV_PKCS12: &'static str = "PKCS12"; +pub const sz_CERT_STORE_PROV_SERIALIZED: &'static str = "Serialized"; +pub const sz_CERT_STORE_PROV_COLLECTION: &'static str = "Collection"; +pub const sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W: &'static str = "SystemRegistry"; +pub const sz_CERT_STORE_PROV_SYSTEM_REGISTRY: &'static str = sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W; +pub const sz_CERT_STORE_PROV_PHYSICAL_W: &'static str = "Physical"; +pub const sz_CERT_STORE_PROV_PHYSICAL: &'static str = sz_CERT_STORE_PROV_PHYSICAL_W; +pub const sz_CERT_STORE_PROV_SMART_CARD_W: &'static str = "SmartCard"; +pub const sz_CERT_STORE_PROV_SMART_CARD: &'static str = sz_CERT_STORE_PROV_SMART_CARD_W; +pub const sz_CERT_STORE_PROV_LDAP_W: &'static str = "Ldap"; +pub const sz_CERT_STORE_PROV_LDAP: &'static str = sz_CERT_STORE_PROV_LDAP_W; +pub const CERT_STORE_SIGNATURE_FLAG: DWORD = 0x00000001; +pub const CERT_STORE_TIME_VALIDITY_FLAG: DWORD = 0x00000002; +pub const CERT_STORE_REVOCATION_FLAG: DWORD = 0x00000004; +pub const CERT_STORE_NO_CRL_FLAG: DWORD = 0x00010000; +pub const CERT_STORE_NO_ISSUER_FLAG: DWORD = 0x00020000; +pub const CERT_STORE_BASE_CRL_FLAG: DWORD = 0x00000100; +pub const CERT_STORE_DELTA_CRL_FLAG: DWORD = 0x00000200; +pub const CERT_STORE_NO_CRYPT_RELEASE_FLAG: DWORD = 0x00000001; +pub const CERT_STORE_SET_LOCALIZED_NAME_FLAG: DWORD = 0x00000002; +pub const CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG: DWORD = 0x00000004; +pub const CERT_STORE_DELETE_FLAG: DWORD = 0x00000010; +pub const CERT_STORE_SHARE_STORE_FLAG: DWORD = 0x00000040; +pub const CERT_STORE_SHARE_CONTEXT_FLAG: DWORD = 0x00000080; +pub const CERT_STORE_MANIFOLD_FLAG: DWORD = 0x00000100; +pub const CERT_STORE_ENUM_ARCHIVED_FLAG: DWORD = 0x00000200; +pub const CERT_STORE_UPDATE_KEYID_FLAG: DWORD = 0x00000400; +pub const CERT_STORE_BACKUP_RESTORE_FLAG: DWORD = 0x00000800; +pub const CERT_STORE_READONLY_FLAG: DWORD = 0x00008000; +pub const CERT_STORE_OPEN_EXISTING_FLAG: DWORD = 0x00004000; +pub const CERT_STORE_CREATE_NEW_FLAG: DWORD = 0x00002000; +pub const CERT_STORE_MAXIMUM_ALLOWED_FLAG: DWORD = 0x00001000; +pub const CERT_SYSTEM_STORE_MASK: DWORD = 0xFFFF0000; +pub const CERT_SYSTEM_STORE_RELOCATE_FLAG: DWORD = 0x80000000; +UNION!{union CERT_SYSTEM_STORE_RELOCATE_PARA_u1 { + [usize; 1], + hKeyBase hKeyBase_mut: HKEY, + pvBase pvBase_mut: *mut c_void, +}} +UNION!{union CERT_SYSTEM_STORE_RELOCATE_PARA_u2 { + [usize; 1], + pvSystemStore pvSystemStore__mut: *mut c_void, + pszSystemStore pszSystemStore_mut: LPCSTR, + pwszSystemStore pwszSystemStore_mut: LPCWSTR, +}} +STRUCT!{struct CERT_SYSTEM_STORE_RELOCATE_PARA { + u1: CERT_SYSTEM_STORE_RELOCATE_PARA_u1, + u2: CERT_SYSTEM_STORE_RELOCATE_PARA_u2, +}} +pub type PCERT_SYSTEM_STORE_RELOCATE_PARA = *mut CERT_SYSTEM_STORE_RELOCATE_PARA; +pub const CERT_SYSTEM_STORE_UNPROTECTED_FLAG: DWORD = 0x40000000; +pub const CERT_SYSTEM_STORE_LOCATION_MASK: DWORD = 0x00FF0000; +pub const CERT_SYSTEM_STORE_LOCATION_SHIFT: DWORD = 16; +pub const CERT_SYSTEM_STORE_CURRENT_USER_ID: DWORD = 1; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ID: DWORD = 2; +pub const CERT_SYSTEM_STORE_CURRENT_SERVICE_ID: DWORD = 4; +pub const CERT_SYSTEM_STORE_SERVICES_ID: DWORD = 5; +pub const CERT_SYSTEM_STORE_USERS_ID: DWORD = 6; +pub const CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID: DWORD = 7; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID: DWORD = 8; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID: DWORD = 9; +pub const CERT_SYSTEM_STORE_CURRENT_USER: DWORD = CERT_SYSTEM_STORE_CURRENT_USER_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE: DWORD = CERT_SYSTEM_STORE_LOCAL_MACHINE_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_CURRENT_SERVICE: DWORD = CERT_SYSTEM_STORE_CURRENT_SERVICE_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_SERVICES: DWORD = CERT_SYSTEM_STORE_SERVICES_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_USERS: DWORD = CERT_SYSTEM_STORE_USERS_ID + << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY: DWORD + = CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY: DWORD + = CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE: DWORD + = CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; +pub const CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH: &'static str + = "Software\\Policies\\Microsoft\\SystemCertificates"; +pub const CERT_EFSBLOB_REGPATH: &'static str + = "Software\\Policies\\Microsoft\\SystemCertificates\\EFS"; +pub const CERT_EFSBLOB_VALUE_NAME: &'static str = "EFSBlob"; +pub const CERT_PROT_ROOT_FLAGS_REGPATH: &'static str + = "Software\\Policies\\Microsoft\\SystemCertificates\\Root\\ProtectedRoots"; +pub const CERT_PROT_ROOT_FLAGS_VALUE_NAME: &'static str = "Flags"; +pub const CERT_PROT_ROOT_DISABLE_CURRENT_USER_FLAG: DWORD = 0x1; +pub const CERT_PROT_ROOT_INHIBIT_ADD_AT_INIT_FLAG: DWORD = 0x2; +pub const CERT_PROT_ROOT_INHIBIT_PURGE_LM_FLAG: DWORD = 0x4; +pub const CERT_PROT_ROOT_DISABLE_LM_AUTH_FLAG: DWORD = 0x8; +pub const CERT_PROT_ROOT_ONLY_LM_GPT_FLAG: DWORD = 0x8; +pub const CERT_PROT_ROOT_DISABLE_NT_AUTH_REQUIRED_FLAG: DWORD = 0x10; +pub const CERT_PROT_ROOT_DISABLE_NOT_DEFINED_NAME_CONSTRAINT_FLAG: DWORD = 0x20; +pub const CERT_PROT_ROOT_DISABLE_PEER_TRUST: DWORD = 0x10000; +pub const CERT_PROT_ROOT_PEER_USAGES_VALUE_NAME: &'static str = "PeerUsages"; +pub const CERT_PROT_ROOT_PEER_USAGES_VALUE_NAME_A: &'static str = "PeerUsages"; +pub const CERT_PROT_ROOT_PEER_USAGES_DEFAULT_A: &'static str + = "1.3.6.1.5.5.7.3.2\01.3.6.1.5.5.7.3.4\01.3.6.1.4.1.311.10.3.4\0"; +pub const CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH: &'static str + = "Software\\Policies\\Microsoft\\SystemCertificates\\TrustedPublisher\\Safer"; +pub const CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH: &'static str + = "Software\\Microsoft\\SystemCertificates"; +pub const CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH: &'static str + = "Software\\Microsoft\\SystemCertificates\\TrustedPublisher\\Safer"; +pub const CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME: &'static str = "AuthenticodeFlags"; +pub const CERT_TRUST_PUB_ALLOW_TRUST_MASK: DWORD = 0x00000003; +pub const CERT_TRUST_PUB_ALLOW_END_USER_TRUST: DWORD = 0x00000000; +pub const CERT_TRUST_PUB_ALLOW_MACHINE_ADMIN_TRUST: DWORD = 0x00000001; +pub const CERT_TRUST_PUB_ALLOW_ENTERPRISE_ADMIN_TRUST: DWORD = 0x00000002; +pub const CERT_TRUST_PUB_CHECK_PUBLISHER_REV_FLAG: DWORD = 0x00000100; +pub const CERT_TRUST_PUB_CHECK_TIMESTAMP_REV_FLAG: DWORD = 0x00000200; +pub const CERT_OCM_SUBCOMPONENTS_LOCAL_MACHINE_REGPATH: &'static str + = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Subcomponents"; +pub const CERT_OCM_SUBCOMPONENTS_ROOT_AUTO_UPDATE_VALUE_NAME: &'static str = "RootAutoUpdate"; +pub const CERT_DISABLE_ROOT_AUTO_UPDATE_REGPATH: &'static str + = "Software\\Policies\\Microsoft\\SystemCertificates\\AuthRoot"; +pub const CERT_DISABLE_ROOT_AUTO_UPDATE_VALUE_NAME: &'static str = "DisableRootAutoUpdate"; +pub const CERT_ENABLE_DISALLOWED_CERT_AUTO_UPDATE_VALUE_NAME: &'static str + = "EnableDisallowedCertAutoUpdate"; +pub const CERT_DISABLE_PIN_RULES_AUTO_UPDATE_VALUE_NAME: &'static str + = "DisablePinRulesAutoUpdate"; +pub const CERT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH: &'static str + = "Software\\Microsoft\\SystemCertificates\\AuthRoot\\AutoUpdate"; +pub const CERT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME: &'static str = "RootDirUrl"; +pub const CERT_AUTO_UPDATE_SYNC_FROM_DIR_URL_VALUE_NAME: &'static str = "SyncFromDirUrl"; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH: &'static str + = CERT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME: &'static str + = CERT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_SYNC_DELTA_TIME_VALUE_NAME: &'static str = "SyncDeltaTime"; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_FLAGS_VALUE_NAME: &'static str = "Flags"; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_UNTRUSTED_ROOT_LOGGING_FLAG: DWORD = 0x1; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_PARTIAL_CHAIN_LOGGING_FLAG: DWORD = 0x2; +pub const CERT_AUTO_UPDATE_DISABLE_RANDOM_QUERY_STRING_FLAG: DWORD = 0x4; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_LAST_SYNC_TIME_VALUE_NAME: &'static str = "LastSyncTime"; +pub const CERT_AUTH_ROOT_AUTO_UPDATE_ENCODED_CTL_VALUE_NAME: &'static str = "EncodedCt"; +pub const CERT_AUTH_ROOT_CTL_FILENAME: &'static str = "authroot.st"; +pub const CERT_AUTH_ROOT_CTL_FILENAME_A: &'static str = "authroot.st"; +pub const CERT_AUTH_ROOT_CAB_FILENAME: &'static str = "authrootstl.cab"; +pub const CERT_AUTH_ROOT_SEQ_FILENAME: &'static str = "authrootseq.txt"; +pub const CERT_AUTH_ROOT_CERT_EXT: &'static str = ".crt"; +pub const CERT_DISALLOWED_CERT_AUTO_UPDATE_SYNC_DELTA_TIME_VALUE_NAME: &'static str + = "DisallowedCertSyncDeltaTime"; +pub const CERT_DISALLOWED_CERT_AUTO_UPDATE_LAST_SYNC_TIME_VALUE_NAME: &'static str + = "DisallowedCertLastSyncTime"; +pub const CERT_DISALLOWED_CERT_AUTO_UPDATE_ENCODED_CTL_VALUE_NAME: &'static str + = "DisallowedCertEncodedCt"; +pub const CERT_DISALLOWED_CERT_CTL_FILENAME: &'static str = "disallowedcert.st"; +pub const CERT_DISALLOWED_CERT_CTL_FILENAME_A: &'static str = "disallowedcert.st"; +pub const CERT_DISALLOWED_CERT_CAB_FILENAME: &'static str = "disallowedcertstl.cab"; +pub const CERT_DISALLOWED_CERT_AUTO_UPDATE_LIST_IDENTIFIER: &'static str + = "DisallowedCert_AutoUpdate_1"; +pub const CERT_PIN_RULES_AUTO_UPDATE_SYNC_DELTA_TIME_VALUE_NAME: &'static str + = "PinRulesSyncDeltaTime"; +pub const CERT_PIN_RULES_AUTO_UPDATE_LAST_SYNC_TIME_VALUE_NAME: &'static str + = "PinRulesLastSyncTime"; +pub const CERT_PIN_RULES_AUTO_UPDATE_ENCODED_CTL_VALUE_NAME: &'static str = "PinRulesEncodedCt"; +pub const CERT_PIN_RULES_CTL_FILENAME: &'static str = "pinrules.st"; +pub const CERT_PIN_RULES_CTL_FILENAME_A: &'static str = "pinrules.st"; +pub const CERT_PIN_RULES_CAB_FILENAME: &'static str = "pinrulesstl.cab"; +pub const CERT_PIN_RULES_AUTO_UPDATE_LIST_IDENTIFIER: &'static str = "PinRules_AutoUpdate_1"; +pub const CERT_REGISTRY_STORE_REMOTE_FLAG: DWORD = 0x10000; +pub const CERT_REGISTRY_STORE_SERIALIZED_FLAG: DWORD = 0x20000; +pub const CERT_REGISTRY_STORE_CLIENT_GPT_FLAG: DWORD = 0x80000000; +pub const CERT_REGISTRY_STORE_LM_GPT_FLAG: DWORD = 0x01000000; +STRUCT!{struct CERT_REGISTRY_STORE_CLIENT_GPT_PARA { + hKeyBase: HKEY, + pwszRegPath: LPWSTR, +}} +pub type PCERT_REGISTRY_STORE_CLIENT_GPT_PARA = *mut CERT_REGISTRY_STORE_CLIENT_GPT_PARA; +pub const CERT_REGISTRY_STORE_ROAMING_FLAG: DWORD = 0x40000; +STRUCT!{struct CERT_REGISTRY_STORE_ROAMING_PARA { + hKeyBase: HKEY, + pwszStoreDirectory: LPWSTR, +}} +pub type PCERT_REGISTRY_STORE_ROAMING_PARA = *mut CERT_REGISTRY_STORE_ROAMING_PARA; +pub const CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG: DWORD = 0x80000; +pub const CERT_REGISTRY_STORE_EXTERNAL_FLAG: DWORD = 0x100000; +pub const CERT_IE_DIRTY_FLAGS_REGPATH: &'static str + = "Software\\Microsoft\\Cryptography\\IEDirtyFlags"; +pub const CERT_FILE_STORE_COMMIT_ENABLE_FLAG: DWORD = 0x10000; +pub const CERT_LDAP_STORE_SIGN_FLAG: DWORD = 0x10000; +pub const CERT_LDAP_STORE_AREC_EXCLUSIVE_FLAG: DWORD = 0x20000; +pub const CERT_LDAP_STORE_OPENED_FLAG: DWORD = 0x40000; +STRUCT!{struct CERT_LDAP_STORE_OPENED_PARA { + pvLdapSessionHandle: *mut c_void, + pwszLdapUrl: LPCWSTR, +}} +pub type PCERT_LDAP_STORE_OPENED_PARA = *mut CERT_LDAP_STORE_OPENED_PARA; +pub const CERT_LDAP_STORE_UNBIND_FLAG: DWORD = 0x80000; +extern "system" { + pub fn CertOpenStore( + lpszStoreProvider: LPCSTR, + dwEncodingType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + dwFlags: DWORD, + pvPara: *const c_void, + ) -> HCERTSTORE; +} +pub type HCERTSTOREPROV = *mut c_void; +pub const CRYPT_OID_OPEN_STORE_PROV_FUNC: &'static str = "CertDllOpenStoreProv"; +STRUCT!{struct CERT_STORE_PROV_INFO { + cbSize: DWORD, + cStoreProvFunc: DWORD, + rgpvStoreProvFunc: *mut *mut c_void, + hStoreProv: HCERTSTOREPROV, + dwStoreProvFlags: DWORD, + hStoreProvFuncAddr2: HCRYPTOIDFUNCADDR, +}} +pub type PCERT_STORE_PROV_INFO = *mut CERT_STORE_PROV_INFO; +FN!{stdcall PFN_CERT_DLL_OPEN_STORE_PROV_FUNC( + lpszStoreProvider: LPCSTR, + dwEncodingType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + dwFlags: DWORD, + pvPara: *const c_void, + hCertStore: HCERTSTORE, + pStoreProvInfo: PCERT_STORE_PROV_INFO, +) -> BOOL} +pub const CERT_STORE_PROV_EXTERNAL_FLAG: DWORD = 0x1; +pub const CERT_STORE_PROV_DELETED_FLAG: DWORD = 0x2; +pub const CERT_STORE_PROV_NO_PERSIST_FLAG: DWORD = 0x4; +pub const CERT_STORE_PROV_SYSTEM_STORE_FLAG: DWORD = 0x8; +pub const CERT_STORE_PROV_LM_SYSTEM_STORE_FLAG: DWORD = 0x10; +pub const CERT_STORE_PROV_GP_SYSTEM_STORE_FLAG: DWORD = 0x20; +pub const CERT_STORE_PROV_SHARED_USER_FLAG: DWORD = 0x40; +pub const CERT_STORE_PROV_CLOSE_FUNC: DWORD = 0; +pub const CERT_STORE_PROV_READ_CERT_FUNC: DWORD = 1; +pub const CERT_STORE_PROV_WRITE_CERT_FUNC: DWORD = 2; +pub const CERT_STORE_PROV_DELETE_CERT_FUNC: DWORD = 3; +pub const CERT_STORE_PROV_SET_CERT_PROPERTY_FUNC: DWORD = 4; +pub const CERT_STORE_PROV_READ_CRL_FUNC: DWORD = 5; +pub const CERT_STORE_PROV_WRITE_CRL_FUNC: DWORD = 6; +pub const CERT_STORE_PROV_DELETE_CRL_FUNC: DWORD = 7; +pub const CERT_STORE_PROV_SET_CRL_PROPERTY_FUNC: DWORD = 8; +pub const CERT_STORE_PROV_READ_CTL_FUNC: DWORD = 9; +pub const CERT_STORE_PROV_WRITE_CTL_FUNC: DWORD = 10; +pub const CERT_STORE_PROV_DELETE_CTL_FUNC: DWORD = 11; +pub const CERT_STORE_PROV_SET_CTL_PROPERTY_FUNC: DWORD = 12; +pub const CERT_STORE_PROV_CONTROL_FUNC: DWORD = 13; +pub const CERT_STORE_PROV_FIND_CERT_FUNC: DWORD = 14; +pub const CERT_STORE_PROV_FREE_FIND_CERT_FUNC: DWORD = 15; +pub const CERT_STORE_PROV_GET_CERT_PROPERTY_FUNC: DWORD = 16; +pub const CERT_STORE_PROV_FIND_CRL_FUNC: DWORD = 17; +pub const CERT_STORE_PROV_FREE_FIND_CRL_FUNC: DWORD = 18; +pub const CERT_STORE_PROV_GET_CRL_PROPERTY_FUNC: DWORD = 19; +pub const CERT_STORE_PROV_FIND_CTL_FUNC: DWORD = 20; +pub const CERT_STORE_PROV_FREE_FIND_CTL_FUNC: DWORD = 21; +pub const CERT_STORE_PROV_GET_CTL_PROPERTY_FUNC: DWORD = 22; +FN!{stdcall PFN_CERT_STORE_PROV_CLOSE( + hStoreProv: HCERTSTOREPROV, + dwFlags: DWORD, +) -> ()} +FN!{stdcall PFN_CERT_STORE_PROV_READ_CERT( + hStoreProv: HCERTSTOREPROV, + pStoreCertContext: PCCERT_CONTEXT, + dwFlags: DWORD, + ppProvCertContext: *mut PCCERT_CONTEXT, +) -> BOOL} +pub const CERT_STORE_PROV_WRITE_ADD_FLAG: DWORD = 0x1; +FN!{stdcall PFN_CERT_STORE_PROV_WRITE_CERT( + hStoreProv: HCERTSTOREPROV, + pCertContext: PCCERT_CONTEXT, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_DELETE_CERT( + hStoreProv: HCERTSTOREPROV, + pCertContext: PCCERT_CONTEXT, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_SET_CERT_PROPERTY( + hStoreProv: HCERTSTOREPROV, + pCertContext: PCCERT_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *const c_void, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_READ_CRL( + hStoreProv: HCERTSTOREPROV, + pStoreCrlContext: PCCRL_CONTEXT, + dwFlags: DWORD, + ppProvCrlContext: *mut PCCRL_CONTEXT, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_WRITE_CRL( + hStoreProv: HCERTSTOREPROV, + pCrlContext: PCCRL_CONTEXT, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_DELETE_CRL( + hStoreProv: HCERTSTOREPROV, + pCrlContext: PCCRL_CONTEXT, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_SET_CRL_PROPERTY( + hStoreProv: HCERTSTOREPROV, + pCrlContext: PCCRL_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *const c_void, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_READ_CTL( + hStoreProv: HCERTSTOREPROV, + pStoreCtlContext: PCCTL_CONTEXT, + dwFlags: DWORD, + ppProvCtlContext: *mut PCCTL_CONTEXT, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_WRITE_CTL( + hStoreProv: HCERTSTOREPROV, + pCtlContext: PCCTL_CONTEXT, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_DELETE_CTL( + hStoreProv: HCERTSTOREPROV, + pCtlContext: PCCTL_CONTEXT, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_SET_CTL_PROPERTY( + hStoreProv: HCERTSTOREPROV, + pCtlContext: PCCTL_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *const c_void, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_CONTROL( + hStoreProv: HCERTSTOREPROV, + dwFlags: DWORD, + dwCtrlType: DWORD, + pvCtrlPara: *const c_void, +) -> BOOL} +STRUCT!{struct CERT_STORE_PROV_FIND_INFO { + cbSize: DWORD, + dwMsgAndCertEncodingType: DWORD, + dwFindFlags: DWORD, + dwFindType: DWORD, + pvFindPara: *const c_void, +}} +pub type PCERT_STORE_PROV_FIND_INFO = *mut CERT_STORE_PROV_FIND_INFO; +pub type CCERT_STORE_PROV_FIND_INFO = CERT_STORE_PROV_FIND_INFO; +pub type PCCERT_STORE_PROV_FIND_INFO = *const CERT_STORE_PROV_FIND_INFO; +FN!{stdcall PFN_CERT_STORE_PROV_FIND_CERT( + hStoreProv: HCERTSTOREPROV, + pFindInfo: PCCERT_STORE_PROV_FIND_INFO, + pPrevCertContext: PCCERT_CONTEXT, + dwFlags: DWORD, + ppvStoreProvFindInfo: *mut *mut c_void, + ppProvCertContext: *mut PCCERT_CONTEXT, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_FREE_FIND_CERT( + hStoreProv: HCERTSTOREPROV, + pCertContext: PCCERT_CONTEXT, + pvStoreProvFindInfo: *mut c_void, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_GET_CERT_PROPERTY( + hStoreProv: HCERTSTOREPROV, + pCertContext: PCCERT_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_FIND_CRL( + hStoreProv: HCERTSTOREPROV, + pFindInfo: PCCERT_STORE_PROV_FIND_INFO, + pPrevCrlContext: PCCRL_CONTEXT, + dwFlags: DWORD, + ppvStoreProvFindInfo: *mut *mut c_void, + ppProvCrlContext: *mut PCCRL_CONTEXT, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_FREE_FIND_CRL( + hStoreProv: HCERTSTOREPROV, + pCrlContext: PCCRL_CONTEXT, + pvStoreProvFindInfo: *mut c_void, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_GET_CRL_PROPERTY( + hStoreProv: HCERTSTOREPROV, + pCrlContext: PCCRL_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_FIND_CTL( + hStoreProv: HCERTSTOREPROV, + pFindInfo: PCCERT_STORE_PROV_FIND_INFO, + pPrevCtlContext: PCCTL_CONTEXT, + dwFlags: DWORD, + ppvStoreProvFindInfo: *mut *mut c_void, + ppProvCtlContext: *mut PCCTL_CONTEXT, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_FREE_FIND_CTL( + hStoreProv: HCERTSTOREPROV, + pCtlContext: PCCTL_CONTEXT, + pvStoreProvFindInfo: *mut c_void, + dwFlags: DWORD, +) -> BOOL} +FN!{stdcall PFN_CERT_STORE_PROV_GET_CTL_PROPERTY( + hStoreProv: HCERTSTOREPROV, + pCtlContext: PCCTL_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, +) -> BOOL} +extern "system" { + pub fn CertDuplicateStore( + hCertStore: HCERTSTORE, + ) -> HCERTSTORE; +} +pub const CERT_STORE_SAVE_AS_STORE: DWORD = 1; +pub const CERT_STORE_SAVE_AS_PKCS7: DWORD = 2; +pub const CERT_STORE_SAVE_AS_PKCS12: DWORD = 3; +pub const CERT_STORE_SAVE_TO_FILE: DWORD = 1; +pub const CERT_STORE_SAVE_TO_MEMORY: DWORD = 2; +pub const CERT_STORE_SAVE_TO_FILENAME_A: DWORD = 3; +pub const CERT_STORE_SAVE_TO_FILENAME_W: DWORD = 4; +pub const CERT_STORE_SAVE_TO_FILENAME: DWORD = CERT_STORE_SAVE_TO_FILENAME_W; +extern "system" { + pub fn CertSaveStore( + hCertStore: HCERTSTORE, + dwEncodingType: DWORD, + dwSaveAs: DWORD, + dwSaveTo: DWORD, + pvSaveToPara: *mut c_void, + dwFlags: DWORD, + ) -> BOOL; +} +pub const CERT_CLOSE_STORE_FORCE_FLAG: DWORD = 0x00000001; +pub const CERT_CLOSE_STORE_CHECK_FLAG: DWORD = 0x00000002; +extern "system" { + pub fn CertCloseStore( + hCertStore: HCERTSTORE, + dwFlags: DWORD, + ) -> BOOL; + pub fn CertGetSubjectCertificateFromStore( + hCertStore: HCERTSTORE, + dwCertEncodingType: DWORD, + pCertId: PCERT_INFO, + ) -> PCCERT_CONTEXT; + pub fn CertEnumCertificatesInStore( + hCertStore: HCERTSTORE, + pPrevCertContext: PCCERT_CONTEXT, + ) -> PCCERT_CONTEXT; + pub fn CertFindCertificateInStore( + hCertStore: HCERTSTORE, + dwCertEncodingType: DWORD, + dwFindFlags: DWORD, + dwFindType: DWORD, + pvFindPara: *const c_void, + pPrevCertContext: PCCERT_CONTEXT, + ) -> PCCERT_CONTEXT; +} +pub const CERT_COMPARE_MASK: DWORD = 0xFFFF; +pub const CERT_COMPARE_SHIFT: DWORD = 16; +pub const CERT_COMPARE_ANY: DWORD = 0; +pub const CERT_COMPARE_SHA1_HASH: DWORD = 1; +pub const CERT_COMPARE_NAME: DWORD = 2; +pub const CERT_COMPARE_ATTR: DWORD = 3; +pub const CERT_COMPARE_MD5_HASH: DWORD = 4; +pub const CERT_COMPARE_PROPERTY: DWORD = 5; +pub const CERT_COMPARE_PUBLIC_KEY: DWORD = 6; +pub const CERT_COMPARE_HASH: DWORD = CERT_COMPARE_SHA1_HASH; +pub const CERT_COMPARE_NAME_STR_A: DWORD = 7; +pub const CERT_COMPARE_NAME_STR_W: DWORD = 8; +pub const CERT_COMPARE_KEY_SPEC: DWORD = 9; +pub const CERT_COMPARE_ENHKEY_USAGE: DWORD = 10; +pub const CERT_COMPARE_CTL_USAGE: DWORD = CERT_COMPARE_ENHKEY_USAGE; +pub const CERT_COMPARE_SUBJECT_CERT: DWORD = 11; +pub const CERT_COMPARE_ISSUER_OF: DWORD = 12; +pub const CERT_COMPARE_EXISTING: DWORD = 13; +pub const CERT_COMPARE_SIGNATURE_HASH: DWORD = 14; +pub const CERT_COMPARE_KEY_IDENTIFIER: DWORD = 15; +pub const CERT_COMPARE_CERT_ID: DWORD = 16; +pub const CERT_COMPARE_CROSS_CERT_DIST_POINTS: DWORD = 17; +pub const CERT_COMPARE_PUBKEY_MD5_HASH: DWORD = 18; +pub const CERT_COMPARE_SUBJECT_INFO_ACCESS: DWORD = 19; +pub const CERT_COMPARE_HASH_STR: DWORD = 20; +pub const CERT_COMPARE_HAS_PRIVATE_KEY: DWORD = 21; +pub const CERT_FIND_ANY: DWORD = CERT_COMPARE_ANY << CERT_COMPARE_SHIFT; +pub const CERT_FIND_SHA1_HASH: DWORD = CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT; +pub const CERT_FIND_MD5_HASH: DWORD = CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT; +pub const CERT_FIND_SIGNATURE_HASH: DWORD = CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT; +pub const CERT_FIND_KEY_IDENTIFIER: DWORD = CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT; +pub const CERT_FIND_HASH: DWORD = CERT_FIND_SHA1_HASH; +pub const CERT_FIND_PROPERTY: DWORD = CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT; +pub const CERT_FIND_PUBLIC_KEY: DWORD = CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT; +pub const CERT_FIND_SUBJECT_NAME: DWORD = (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_SUBJECT_ATTR: DWORD = (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_ISSUER_NAME: DWORD = (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_ISSUER_ATTR: DWORD = (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_SUBJECT_STR_A: DWORD = (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_SUBJECT_STR_W: DWORD = (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT) + | CERT_INFO_SUBJECT_FLAG; +pub const CERT_FIND_SUBJECT_STR: DWORD = CERT_FIND_SUBJECT_STR_W; +pub const CERT_FIND_ISSUER_STR_A: DWORD = (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_ISSUER_STR_W: DWORD = (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT) + | CERT_INFO_ISSUER_FLAG; +pub const CERT_FIND_ISSUER_STR: DWORD = CERT_FIND_ISSUER_STR_W; +pub const CERT_FIND_KEY_SPEC: DWORD = CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT; +pub const CERT_FIND_ENHKEY_USAGE: DWORD = CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT; +pub const CERT_FIND_CTL_USAGE: DWORD = CERT_FIND_ENHKEY_USAGE; +pub const CERT_FIND_SUBJECT_CERT: DWORD = CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT; +pub const CERT_FIND_ISSUER_OF: DWORD = CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT; +pub const CERT_FIND_EXISTING: DWORD = CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT; +pub const CERT_FIND_CERT_ID: DWORD = CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT; +pub const CERT_FIND_CROSS_CERT_DIST_POINTS: DWORD = CERT_COMPARE_CROSS_CERT_DIST_POINTS + << CERT_COMPARE_SHIFT; +pub const CERT_FIND_PUBKEY_MD5_HASH: DWORD = CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT; +pub const CERT_FIND_SUBJECT_INFO_ACCESS: DWORD = CERT_COMPARE_SUBJECT_INFO_ACCESS + << CERT_COMPARE_SHIFT; +pub const CERT_FIND_HASH_STR: DWORD = CERT_COMPARE_HASH_STR << CERT_COMPARE_SHIFT; +pub const CERT_FIND_HAS_PRIVATE_KEY: DWORD = CERT_COMPARE_HAS_PRIVATE_KEY << CERT_COMPARE_SHIFT; +pub const CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG: DWORD = 0x1; +pub const CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG: DWORD = 0x2; +pub const CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG: DWORD = 0x4; +pub const CERT_FIND_NO_ENHKEY_USAGE_FLAG: DWORD = 0x8; +pub const CERT_FIND_OR_ENHKEY_USAGE_FLAG: DWORD = 0x10; +pub const CERT_FIND_VALID_ENHKEY_USAGE_FLAG: DWORD = 0x20; +pub const CERT_FIND_OPTIONAL_CTL_USAGE_FLAG: DWORD = CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG; +pub const CERT_FIND_EXT_ONLY_CTL_USAGE_FLAG: DWORD = CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG; +pub const CERT_FIND_PROP_ONLY_CTL_USAGE_FLAG: DWORD = CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG; +pub const CERT_FIND_NO_CTL_USAGE_FLAG: DWORD = CERT_FIND_NO_ENHKEY_USAGE_FLAG; +pub const CERT_FIND_OR_CTL_USAGE_FLAG: DWORD = CERT_FIND_OR_ENHKEY_USAGE_FLAG; +pub const CERT_FIND_VALID_CTL_USAGE_FLAG: DWORD = CERT_FIND_VALID_ENHKEY_USAGE_FLAG; +extern "system" { + pub fn CertGetIssuerCertificateFromStore( + hCertStore: HCERTSTORE, + pSubjectContext: PCCERT_CONTEXT, + pPrevIssuerContext: PCCERT_CONTEXT, + pdwFlags: *mut DWORD, + ) -> PCCERT_CONTEXT; + pub fn CertVerifySubjectCertificateContext( + pSubject: PCCERT_CONTEXT, + pIssuer: PCCERT_CONTEXT, + pdwFlags: *mut DWORD, + ) -> BOOL; + pub fn CertDuplicateCertificateContext( + pCertContext: PCCERT_CONTEXT, + ) -> PCCERT_CONTEXT; + pub fn CertCreateCertificateContext( + dwCertEncodingType: DWORD, + pbCertEncoded: *const BYTE, + cbCertEncoded: DWORD, + ) -> PCCERT_CONTEXT; + pub fn CertFreeCertificateContext( + pCertContext: PCCERT_CONTEXT, + ) -> BOOL; + pub fn CertSetCertificateContextProperty( + pCertContext: PCCERT_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *const c_void, + ) -> BOOL; +} +pub const CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG: DWORD = 0x80000000; +pub const CERT_SET_PROPERTY_INHIBIT_PERSIST_FLAG: DWORD = 0x40000000; +extern "system" { + pub fn CertGetCertificateContextProperty( + pCertContext: PCCERT_CONTEXT, + dwPropId: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, + ) -> BOOL; + pub fn CertEnumCertificateContextProperties( + pCertContext: PCCERT_CONTEXT, + dwPropId: DWORD, + ) -> DWORD; + pub fn CertCreateCTLEntryFromCertificateContextProperties( + pCertContext: PCCERT_CONTEXT, + cOptAttr: DWORD, + rgOptAttr: PCRYPT_ATTRIBUTE, + dwFlags: DWORD, + pvReserved: *mut c_void, + pCtlEntry: PCTL_ENTRY, + pcbCtlEntry: *mut DWORD, + ) -> BOOL; + pub fn CertSetCertificateContextPropertiesFromCTLEntry( + pCertContext: PCCERT_CONTEXT, + pCtlEntry: PCTL_ENTRY, + dwFlags: DWORD, + ) -> BOOL; + pub fn CertGetCRLFromStore( + hCertStore: HCERTSTORE, + pIssuerContext: PCCERT_CONTEXT, + pPrevCrlContext: PCCRL_CONTEXT, + pdwFlags: *mut DWORD, + ) -> PCCRL_CONTEXT; + pub fn CertEnumCRLsInStore( + hCertStore: HCERTSTORE, + pPrevCrlContext: PCCRL_CONTEXT, + ) -> PCCRL_CONTEXT; + pub fn CertFindCRLInStore( + hCertStore: HCERTSTORE, + dwCertEncodingType: DWORD, + dwFindFlags: DWORD, + dwFindType: DWORD, + pvFindPara: *const c_void, + pPrevCrlContext: PCCRL_CONTEXT, + ) -> PCCRL_CONTEXT; +} +pub const CRL_FIND_ANY: DWORD = 0; +pub const CRL_FIND_ISSUED_BY: DWORD = 1; +pub const CRL_FIND_EXISTING: DWORD = 2; +pub const CRL_FIND_ISSUED_FOR: DWORD = 3; +pub const CRL_FIND_ISSUED_BY_AKI_FLAG: DWORD = 0x1; +pub const CRL_FIND_ISSUED_BY_SIGNATURE_FLAG: DWORD = 0x2; +pub const CRL_FIND_ISSUED_BY_DELTA_FLAG: DWORD = 0x4; +pub const CRL_FIND_ISSUED_BY_BASE_FLAG: DWORD = 0x8; +STRUCT!{struct CRL_FIND_ISSUED_FOR_PARA { + pSubjectCert: PCCERT_CONTEXT, + pIssuerCert: PCCERT_CONTEXT, +}} +pub type PCRL_FIND_ISSUED_FOR_PARA = *mut CRL_FIND_ISSUED_FOR_PARA; +pub const CRL_FIND_ISSUED_FOR_SET_STRONG_PROPERTIES_FLAG: DWORD = 0x10; +extern "system" { + pub fn CertDuplicateCRLContext( + pCrlContext: PCCRL_CONTEXT, + ) -> PCCRL_CONTEXT; + pub fn CertCreateCRLContext( + dwCertEncodingType: DWORD, + pbCrlEncoded: *const BYTE, + cbCrlEncoded: DWORD, + ) -> PCCRL_CONTEXT; + pub fn CertFreeCRLContext( + pCrlContext: PCCRL_CONTEXT, + ) -> BOOL; + pub fn CertSetCRLContextProperty( + pCrlContext: PCCRL_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *const c_void, + ) -> BOOL; + pub fn CertGetCRLContextProperty( + pCrlContext: PCCRL_CONTEXT, + dwPropId: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, + ) -> BOOL; + pub fn CertEnumCRLContextProperties( + pCrlContext: PCCRL_CONTEXT, + dwPropId: DWORD, + ) -> DWORD; + pub fn CertFindCertificateInCRL( + pCert: PCCERT_CONTEXT, + pCrlContext: PCCRL_CONTEXT, + dwFlags: DWORD, + pvReserved: *mut c_void, + ppCrlEntry: *mut PCRL_ENTRY, + ) -> BOOL; + pub fn CertIsValidCRLForCertificate( + pCert: PCCERT_CONTEXT, + pCrl: PCCRL_CONTEXT, + dwFlags: DWORD, + pvReserved: *mut c_void, + ) -> BOOL; +} +pub const CERT_STORE_ADD_NEW: DWORD = 1; +pub const CERT_STORE_ADD_USE_EXISTING: DWORD = 2; +pub const CERT_STORE_ADD_REPLACE_EXISTING: DWORD = 3; +pub const CERT_STORE_ADD_ALWAYS: DWORD = 4; +pub const CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: DWORD = 5; +pub const CERT_STORE_ADD_NEWER: DWORD = 6; +pub const CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: DWORD = 7; +extern "system" { + pub fn CertAddEncodedCertificateToStore( + hCertStore: HCERTSTORE, + dwCertEncodingType: DWORD, + pbCertEncoded: *const BYTE, + cbCertEncoded: DWORD, + dwAddDisposition: DWORD, + ppCertContext: *mut PCCERT_CONTEXT, + ) -> BOOL; + pub fn CertAddCertificateContextToStore( + hCertStore: HCERTSTORE, + pCertContext: PCCERT_CONTEXT, + dwAddDisposition: DWORD, + ppStoreContext: *mut PCCERT_CONTEXT, + ) -> BOOL; +} +pub const CERT_STORE_CERTIFICATE_CONTEXT: DWORD = 1; +pub const CERT_STORE_CRL_CONTEXT: DWORD = 2; +pub const CERT_STORE_CTL_CONTEXT: DWORD = 3; +pub const CERT_STORE_ALL_CONTEXT_FLAG: DWORD = !0; +pub const CERT_STORE_CERTIFICATE_CONTEXT_FLAG: DWORD = 1 << CERT_STORE_CERTIFICATE_CONTEXT; +pub const CERT_STORE_CRL_CONTEXT_FLAG: DWORD = 1 << CERT_STORE_CRL_CONTEXT; +pub const CERT_STORE_CTL_CONTEXT_FLAG: DWORD = 1 << CERT_STORE_CTL_CONTEXT; +extern "system" { + pub fn CertAddSerializedElementToStore( + hCertStore: HCERTSTORE, + pbElement: *const BYTE, + cbElement: DWORD, + dwAddDisposition: DWORD, + dwFlags: DWORD, + dwContextTypeFlags: DWORD, + pdwContextType: *mut DWORD, + ppvContext: *mut *const c_void, + ) -> BOOL; + pub fn CertDeleteCertificateFromStore( + pCertContext: PCCERT_CONTEXT, + ) -> BOOL; + pub fn CertAddEncodedCRLToStore( + hCertStore: HCERTSTORE, + dwCertEncodingType: DWORD, + pbCrlEncoded: *const BYTE, + cbCrlEncoded: DWORD, + dwAddDisposition: DWORD, + ppCrlContext: *mut PCCRL_CONTEXT, + ) -> BOOL; + pub fn CertAddCRLContextToStore( + hCertStore: HCERTSTORE, + pCrlContext: PCCRL_CONTEXT, + dwAddDisposition: DWORD, + ppStoreContext: *mut PCCRL_CONTEXT, + ) -> BOOL; + pub fn CertDeleteCRLFromStore( + pCrlContext: PCCRL_CONTEXT, + ) -> BOOL; + pub fn CertSerializeCertificateStoreElement( + pCertContext: PCCERT_CONTEXT, + dwFlags: DWORD, + pbElement: *mut BYTE, + pcbElement: *mut DWORD, + ) -> BOOL; + pub fn CertSerializeCRLStoreElement( + pCrlContext: PCCRL_CONTEXT, + dwFlags: DWORD, + pbElement: *mut BYTE, + pcbElement: *mut DWORD, + ) -> BOOL; + pub fn CertDuplicateCTLContext( + pCtlContext: PCCTL_CONTEXT, + ) -> PCCTL_CONTEXT; + pub fn CertCreateCTLContext( + dwMsgAndCertEncodingType: DWORD, + pbCtlEncoded: *const BYTE, + cbCtlEncoded: DWORD, + ) -> PCCTL_CONTEXT; + pub fn CertFreeCTLContext( + pCtlContext: PCCTL_CONTEXT, + ) -> BOOL; + pub fn CertSetCTLContextProperty( + pCtlContext: PCCTL_CONTEXT, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *const c_void, + ) -> BOOL; + pub fn CertGetCTLContextProperty( + pCtlContext: PCCTL_CONTEXT, + dwPropId: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, + ) -> BOOL; + pub fn CertEnumCTLContextProperties( + pCtlContext: PCCTL_CONTEXT, + dwPropId: DWORD, + ) -> DWORD; + pub fn CertEnumCTLsInStore( + hCertStore: HCERTSTORE, + pPrevCtlContext: PCCTL_CONTEXT, + ) -> PCCTL_CONTEXT; + pub fn CertFindSubjectInCTL( + dwEncodingType: DWORD, + dwSubjectType: DWORD, + pvSubject: *mut c_void, + pCtlContext: PCCTL_CONTEXT, + dwFlags: DWORD, + ) -> PCTL_ENTRY; +} +pub const CTL_ANY_SUBJECT_TYPE: DWORD = 1; +pub const CTL_CERT_SUBJECT_TYPE: DWORD = 2; +STRUCT!{struct CTL_ANY_SUBJECT_INFO { + SubjectAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + SubjectIdentifier: CRYPT_DATA_BLOB, +}} +pub type PCTL_ANY_SUBJECT_INFO = *mut CTL_ANY_SUBJECT_INFO; +extern "system" { + pub fn CertFindCTLInStore( + hCertStore: HCERTSTORE, + dwMsgAndCertEncodingType: DWORD, + dwFindFlags: DWORD, + dwFindType: DWORD, + pvFindPara: *const c_void, + pPrevCtlContext: PCCTL_CONTEXT, + ) -> PCCTL_CONTEXT; +} +pub const CTL_FIND_ANY: DWORD = 0; +pub const CTL_FIND_SHA1_HASH: DWORD = 1; +pub const CTL_FIND_MD5_HASH: DWORD = 2; +pub const CTL_FIND_USAGE: DWORD = 3; +pub const CTL_FIND_SUBJECT: DWORD = 4; +pub const CTL_FIND_EXISTING: DWORD = 5; +STRUCT!{struct CTL_FIND_USAGE_PARA { + cbSize: DWORD, + SubjectUsage: CTL_USAGE, + ListIdentifier: CRYPT_DATA_BLOB, + pSigner: PCERT_INFO, +}} +pub type PCTL_FIND_USAGE_PARA = *mut CTL_FIND_USAGE_PARA; +pub const CTL_FIND_NO_LIST_ID_CBDATA: DWORD = 0xFFFFFFFF; +pub const CTL_FIND_NO_SIGNER_PTR: PCERT_INFO = -1i32 as PCERT_INFO; +pub const CTL_FIND_SAME_USAGE_FLAG: DWORD = 0x1; +STRUCT!{struct CTL_FIND_SUBJECT_PARA { + cbSize: DWORD, + pUsagePara: PCTL_FIND_USAGE_PARA, + dwSubjectType: DWORD, + pvSubject: *mut c_void, +}} +pub type PCTL_FIND_SUBJECT_PARA = *mut CTL_FIND_SUBJECT_PARA; +extern "system" { + pub fn CertAddEncodedCTLToStore( + hCertStore: HCERTSTORE, + dwMsgAndCertEncodingType: DWORD, + pbCtlEncoded: *const BYTE, + cbCtlEncoded: DWORD, + dwAddDisposition: DWORD, + ppCtlContext: *mut PCCTL_CONTEXT, + ) -> BOOL; + pub fn CertAddCTLContextToStore( + hCertStore: HCERTSTORE, + pCtlContext: PCCTL_CONTEXT, + dwAddDisposition: DWORD, + ppStoreContext: *mut PCCTL_CONTEXT, + ) -> BOOL; + pub fn CertSerializeCTLStoreElement( + pCtlContext: PCCTL_CONTEXT, + dwFlags: DWORD, + pbElement: *mut BYTE, + pcbElement: *mut DWORD, + ) -> BOOL; + pub fn CertDeleteCTLFromStore( + pCtlContext: PCCTL_CONTEXT, + ) -> BOOL; + pub fn CertAddCertificateLinkToStore( + hCertStore: HCERTSTORE, + pCertContext: PCCERT_CONTEXT, + dwAddDisposition: DWORD, + ppStoreContext: *mut PCCERT_CONTEXT, + ) -> BOOL; + pub fn CertAddCRLLinkToStore( + hCertStore: HCERTSTORE, + pCrlContext: PCCRL_CONTEXT, + dwAddDisposition: DWORD, + ppStoreContext: *mut PCCRL_CONTEXT, + ) -> BOOL; + pub fn CertAddCTLLinkToStore( + hCertStore: HCERTSTORE, + pCtlContext: PCCTL_CONTEXT, + dwAddDisposition: DWORD, + ppStoreContext: *mut PCCTL_CONTEXT, + ) -> BOOL; + pub fn CertAddStoreToCollection( + hCollectionStore: HCERTSTORE, + hSiblingStore: HCERTSTORE, + dwUpdateFlags: DWORD, + dwPriority: DWORD, + ) -> BOOL; + pub fn CertRemoveStoreFromCollection( + hCollectionStore: HCERTSTORE, + hSiblingStore: HCERTSTORE, + ); + pub fn CertControlStore( + hCertStore: HCERTSTORE, + dwFlags: DWORD, + dwCtrlType: DWORD, + pvCtrlPara: *const c_void, + ) -> BOOL; +} +pub const CERT_STORE_CTRL_RESYNC: DWORD = 1; +pub const CERT_STORE_CTRL_NOTIFY_CHANGE: DWORD = 2; +pub const CERT_STORE_CTRL_COMMIT: DWORD = 3; +pub const CERT_STORE_CTRL_AUTO_RESYNC: DWORD = 4; +pub const CERT_STORE_CTRL_CANCEL_NOTIFY: DWORD = 5; +pub const CERT_STORE_CTRL_INHIBIT_DUPLICATE_HANDLE_FLAG: DWORD = 0x1; +pub const CERT_STORE_CTRL_COMMIT_FORCE_FLAG: DWORD = 0x1; +pub const CERT_STORE_CTRL_COMMIT_CLEAR_FLAG: DWORD = 0x2; +pub const CERT_STORE_LOCALIZED_NAME_PROP_ID: DWORD = 0x1000; +extern "system" { + pub fn CertSetStoreProperty( + hCertStore: HCERTSTORE, + dwPropId: DWORD, + dwFlags: DWORD, + pvData: *const c_void, + ) -> BOOL; + pub fn CertGetStoreProperty( + hCertStore: HCERTSTORE, + dwPropId: DWORD, + pvData: *mut c_void, + pcbData: *mut DWORD, + ) -> BOOL; +} +FN!{stdcall PFN_CERT_CREATE_CONTEXT_SORT_FUNC( + cbTotalEncoded: DWORD, + cbRemainEncoded: DWORD, + cEntry: DWORD, + pvSort: *mut c_void, +) -> BOOL} +STRUCT!{struct CERT_CREATE_CONTEXT_PARA { + cbSize: DWORD, + pfnFree: PFN_CRYPT_FREE, + pvFree: *mut c_void, + pfnSort: PFN_CERT_CREATE_CONTEXT_SORT_FUNC, + pvSort: *mut c_void, +}} +pub type PCERT_CREATE_CONTEXT_PARA = *mut CERT_CREATE_CONTEXT_PARA; +extern "system" { + pub fn CertCreateContext( + dwContextType: DWORD, + dwEncodingType: DWORD, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + dwFlags: DWORD, + pCreatePara: PCERT_CREATE_CONTEXT_PARA, + ) -> *const c_void; +} +pub const CERT_CREATE_CONTEXT_NOCOPY_FLAG: DWORD = 0x1; +pub const CERT_CREATE_CONTEXT_SORTED_FLAG: DWORD = 0x2; +pub const CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG: DWORD = 0x4; +pub const CERT_CREATE_CONTEXT_NO_ENTRY_FLAG: DWORD = 0x8; +STRUCT!{struct CERT_SYSTEM_STORE_INFO { + cbSize: DWORD, +}} +pub type PCERT_SYSTEM_STORE_INFO = *mut CERT_SYSTEM_STORE_INFO; +STRUCT!{struct CERT_PHYSICAL_STORE_INFO { + cbSize: DWORD, + pszOpenStoreProvider: LPSTR, + dwOpenEncodingType: DWORD, + dwOpenFlags: DWORD, + OpenParameters: CRYPT_DATA_BLOB, + dwFlags: DWORD, + dwPriority: DWORD, +}} +pub type PCERT_PHYSICAL_STORE_INFO = *mut CERT_PHYSICAL_STORE_INFO; +pub const CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG: DWORD = 0x1; +pub const CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG: DWORD = 0x2; +pub const CERT_PHYSICAL_STORE_REMOTE_OPEN_DISABLE_FLAG: DWORD = 0x4; +pub const CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG: DWORD = 0x8; +extern "system" { + pub fn CertRegisterSystemStore( + pvSystemStore: *const c_void, + dwFlags: DWORD, + pStoreInfo: PCERT_SYSTEM_STORE_INFO, + pvReserved: *mut c_void, + ) -> BOOL; + pub fn CertRegisterPhysicalStore( + pvSystemStore: *const c_void, + dwFlags: DWORD, + pwszStoreName: LPCWSTR, + pStoreInfo: PCERT_PHYSICAL_STORE_INFO, + pvReserved: *mut c_void, + ) -> BOOL; + pub fn CertUnregisterSystemStore( + pvSystemStore: *const c_void, + dwFlags: DWORD, + ) -> BOOL; + pub fn CertUnregisterPhysicalStore( + pvSystemStore: *const c_void, + dwFlags: DWORD, + pwszStoreName: LPCWSTR, + ) -> BOOL; +} +FN!{stdcall PFN_CERT_ENUM_SYSTEM_STORE_LOCATION( + pwszStoreLocation: LPCWSTR, + dwFlags: DWORD, + pvReserved: *mut c_void, + pvArg: *mut c_void, +) -> BOOL} +FN!{stdcall PFN_CERT_ENUM_SYSTEM_STORE( + pvSystemStore: *const c_void, + dwFlags: DWORD, + pStoreInfo: PCERT_SYSTEM_STORE_INFO, + pvReserved: *mut c_void, + pvArg: *mut c_void, +) -> BOOL} +FN!{stdcall PFN_CERT_ENUM_PHYSICAL_STORE( + pvSystemStore: *const c_void, + dwFlags: DWORD, + pwszStoreName: LPCWSTR, + pStoreInfo: PCERT_PHYSICAL_STORE_INFO, + pvReserved: *mut c_void, + pvArg: *mut c_void, +) -> BOOL} +pub const CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG: DWORD = 0x1; +pub const CERT_PHYSICAL_STORE_DEFAULT_NAME: &'static str = ".Default"; +pub const CERT_PHYSICAL_STORE_GROUP_POLICY_NAME: &'static str = ".GroupPolicy"; +pub const CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME: &'static str = ".LocalMachine"; +pub const CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME: &'static str = ".UserCertificate"; +pub const CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME: &'static str + = ".LocalMachineGroupPolicy"; +pub const CERT_PHYSICAL_STORE_ENTERPRISE_NAME: &'static str = ".Enterprise"; +pub const CERT_PHYSICAL_STORE_AUTH_ROOT_NAME: &'static str = ".AuthRoot"; +pub const CERT_PHYSICAL_STORE_SMART_CARD_NAME: &'static str = ".SmartCard"; +extern "system" { + pub fn CertEnumSystemStoreLocation( + dwFlags: DWORD, + pvArg: *mut c_void, + pfnEnum: PFN_CERT_ENUM_SYSTEM_STORE_LOCATION, + ) -> BOOL; + pub fn CertEnumSystemStore( + dwFlags: DWORD, + pvSystemStoreLocationPara: *mut c_void, + pvArg: *mut c_void, + pfnEnum: PFN_CERT_ENUM_SYSTEM_STORE, + ) -> BOOL; + pub fn CertEnumPhysicalStore( + pvSystemStore: *const c_void, + dwFlags: DWORD, + pvArg: *mut c_void, + pfnEnum: PFN_CERT_ENUM_PHYSICAL_STORE, + ) -> BOOL; +} +pub const CRYPT_OID_OPEN_SYSTEM_STORE_PROV_FUNC: &'static str = "CertDllOpenSystemStoreProv"; +pub const CRYPT_OID_REGISTER_SYSTEM_STORE_FUNC: &'static str = "CertDllRegisterSystemStore"; +pub const CRYPT_OID_UNREGISTER_SYSTEM_STORE_FUNC: &'static str = "CertDllUnregisterSystemStore"; +pub const CRYPT_OID_ENUM_SYSTEM_STORE_FUNC: &'static str = "CertDllEnumSystemStore"; +pub const CRYPT_OID_REGISTER_PHYSICAL_STORE_FUNC: &'static str = "CertDllRegisterPhysicalStore"; +pub const CRYPT_OID_UNREGISTER_PHYSICAL_STORE_FUNC: &'static str + = "CertDllUnregisterPhysicalStore"; +pub const CRYPT_OID_ENUM_PHYSICAL_STORE_FUNC: &'static str = "CertDllEnumPhysicalStore"; +pub const CRYPT_OID_SYSTEM_STORE_LOCATION_VALUE_NAME: &'static str = "SystemStoreLocation"; +extern "system" { + pub fn CertGetEnhancedKeyUsage( + pCertContext: PCCERT_CONTEXT, + dwFlags: DWORD, + pUsage: PCERT_ENHKEY_USAGE, + pcbUsage: *mut DWORD, + ) -> BOOL; + pub fn CertSetEnhancedKeyUsage( + pCertContext: PCCERT_CONTEXT, + pUsage: PCERT_ENHKEY_USAGE, + ) -> BOOL; + pub fn CertAddEnhancedKeyUsageIdentifier( + pCertContext: PCCERT_CONTEXT, + pszUsageIdentifier: LPCSTR, + ) -> BOOL; + pub fn CertRemoveEnhancedKeyUsageIdentifier( + pCertContext: PCCERT_CONTEXT, + pszUsageIdentifier: LPCSTR, + ) -> BOOL; + pub fn CertGetValidUsages( + cCerts: DWORD, + rghCerts: *mut PCCERT_CONTEXT, + cNumOIDs: *mut c_int, + rghOIDs: *mut LPSTR, + pcbOIDs: *mut DWORD, + ) -> BOOL; + pub fn CryptMsgGetAndVerifySigner( + hCryptMsg: HCRYPTMSG, + cSignerStore: DWORD, + rghSignerStore: *mut HCERTSTORE, + dwFlags: DWORD, + ppSigner: *mut PCCERT_CONTEXT, + pdwSignerIndex: *mut DWORD, + ) -> BOOL; +} +pub const CMSG_TRUSTED_SIGNER_FLAG: DWORD = 0x1; +pub const CMSG_SIGNER_ONLY_FLAG: DWORD = 0x2; +pub const CMSG_USE_SIGNER_INDEX_FLAG: DWORD = 0x4; +extern "system" { + pub fn CryptMsgSignCTL( + dwMsgEncodingType: DWORD, + pbCtlContent: *mut BYTE, + cbCtlContent: DWORD, + pSignInfo: PCMSG_SIGNED_ENCODE_INFO, + dwFlags: DWORD, + pbEncoded: *mut BYTE, + pcbEncoded: *mut DWORD, + ) -> BOOL; + pub fn CryptMsgEncodeAndSignCTL( + dwMsgEncodingType: DWORD, + pCtlInfo: PCTL_INFO, + pSignInfo: PCMSG_SIGNED_ENCODE_INFO, + dwFlags: DWORD, + pbEncoded: *mut BYTE, + pcbEncoded: *mut DWORD, + ) -> BOOL; +} +pub const CMSG_ENCODE_SORTED_CTL_FLAG: DWORD = 0x1; +pub const CMSG_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: DWORD = 0x2; +extern "system" { + pub fn CertFindSubjectInSortedCTL( + pSubjectIdentifier: PCRYPT_DATA_BLOB, + pCtlContext: PCCTL_CONTEXT, + dwFlags: DWORD, + pvReserved: *mut c_void, + pEncodedAttributes: PCRYPT_DER_BLOB, + ) -> BOOL; + pub fn CertEnumSubjectInSortedCTL( + pCtlContext: PCCTL_CONTEXT, + ppvNextSubject: *mut *mut c_void, + pSubjectIdentifier: PCRYPT_DER_BLOB, + pEncodedAttributes: PCRYPT_DER_BLOB, + ) -> BOOL; +} +STRUCT!{struct CTL_VERIFY_USAGE_PARA { + cbSize: DWORD, + ListIdentifier: CRYPT_DATA_BLOB, + cCtlStore: DWORD, + rghCtlStore: *mut HCERTSTORE, + cSignerStore: DWORD, + rghSignerStore: *mut HCERTSTORE, +}} +pub type PCTL_VERIFY_USAGE_PARA = *mut CTL_VERIFY_USAGE_PARA; +STRUCT!{struct CTL_VERIFY_USAGE_STATUS { + cbSize: DWORD, + dwError: DWORD, + dwFlags: DWORD, + ppCtl: *mut PCCTL_CONTEXT, + dwCtlEntryIndex: DWORD, + ppSigner: *mut PCCERT_CONTEXT, + dwSignerIndex: DWORD, +}} +pub type PCTL_VERIFY_USAGE_STATUS = *mut CTL_VERIFY_USAGE_STATUS; +pub const CERT_VERIFY_INHIBIT_CTL_UPDATE_FLAG: DWORD = 0x1; +pub const CERT_VERIFY_TRUSTED_SIGNERS_FLAG: DWORD = 0x2; +pub const CERT_VERIFY_NO_TIME_CHECK_FLAG: DWORD = 0x4; +pub const CERT_VERIFY_ALLOW_MORE_USAGE_FLAG: DWORD = 0x8; +pub const CERT_VERIFY_UPDATED_CTL_FLAG: DWORD = 0x1; +extern "system" { + pub fn CertVerifyCTLUsage( + dwEncodingType: DWORD, + dwSubjectType: DWORD, + pvSubject: *mut c_void, + pSubjectUsage: PCTL_USAGE, + dwFlags: DWORD, + pVerifyUsagePara: PCTL_VERIFY_USAGE_PARA, + pVerifyUsageStatus: PCTL_VERIFY_USAGE_STATUS, + ) -> BOOL; +} +STRUCT!{struct CERT_REVOCATION_CRL_INFO { + cbSize: DWORD, + pBaseCrlContext: PCCRL_CONTEXT, + pDeltaCrlContext: PCCRL_CONTEXT, + pCrlEntry: PCRL_ENTRY, + fDeltaCrlEntry: BOOL, +}} +pub type PCERT_REVOCATION_CRL_INFO = *mut CERT_REVOCATION_CRL_INFO; +pub type PCERT_REVOCATION_CHAIN_PARA = *mut CERT_REVOCATION_CHAIN_PARA; +STRUCT!{struct CERT_REVOCATION_PARA { + cbSize: DWORD, + pIssuerCert: PCCERT_CONTEXT, + cCertStore: DWORD, + rgCertStore: *mut HCERTSTORE, + hCrlStore: HCERTSTORE, + pftTimeToUse: LPFILETIME, + dwUrlRetrievalTimeout: DWORD, + fCheckFreshnessTime: BOOL, + dwFreshnessTime: DWORD, + pftCurrentTime: LPFILETIME, + pCrlInfo: PCERT_REVOCATION_CRL_INFO, + pftCacheResync: LPFILETIME, + pChainPara: PCERT_REVOCATION_CHAIN_PARA, +}} +pub type PCERT_REVOCATION_PARA = *mut CERT_REVOCATION_PARA; +STRUCT!{struct CERT_REVOCATION_STATUS { + cbSize: DWORD, + dwIndex: DWORD, + dwError: DWORD, + dwReason: DWORD, + fHasFreshnessTime: BOOL, + dwFreshnessTime: DWORD, +}} +pub type PCERT_REVOCATION_STATUS = *mut CERT_REVOCATION_STATUS; +extern "system" { + pub fn CertVerifyRevocation( + dwEncodingType: DWORD, + dwRevType: DWORD, + cContext: DWORD, + rgpvContext: *mut PVOID, + dwFlags: DWORD, + pRevPara: PCERT_REVOCATION_PARA, + pRevStatus: PCERT_REVOCATION_STATUS, + ) -> BOOL; +} +pub const CERT_CONTEXT_REVOCATION_TYPE: DWORD = 1; +pub const CERT_VERIFY_REV_CHAIN_FLAG: DWORD = 0x00000001; +pub const CERT_VERIFY_CACHE_ONLY_BASED_REVOCATION: DWORD = 0x00000002; +pub const CERT_VERIFY_REV_ACCUMULATIVE_TIMEOUT_FLAG: DWORD = 0x00000004; +pub const CERT_VERIFY_REV_SERVER_OCSP_FLAG: DWORD = 0x00000008; +pub const CERT_VERIFY_REV_NO_OCSP_FAILOVER_TO_CRL_FLAG: DWORD = 0x00000010; +extern "system" { + pub fn CertCompareIntegerBlob( + pInt1: PCRYPT_INTEGER_BLOB, + pInt2: PCRYPT_INTEGER_BLOB, + ) -> BOOL; + pub fn CertCompareCertificate( + dwCertEncodingType: DWORD, + pCertId1: PCERT_INFO, + pCertId2: PCERT_INFO, + ) -> BOOL; + pub fn CertCompareCertificateName( + dwCertEncodingType: DWORD, + pCertName1: PCERT_NAME_BLOB, + pCertName2: PCERT_NAME_BLOB, + ) -> BOOL; + pub fn CertIsRDNAttrsInCertificateName( + dwCertEncodingType: DWORD, + dwFlags: DWORD, + pCertName: PCERT_NAME_BLOB, + pRDN: PCERT_RDN, + ) -> BOOL; + pub fn CertComparePublicKeyInfo( + dwCertEncodingType: DWORD, + pPublicKey1: PCERT_PUBLIC_KEY_INFO, + pPublicKey2: PCERT_PUBLIC_KEY_INFO, + ) -> BOOL; + pub fn CertGetPublicKeyLength( + dwCertEncodingType: DWORD, + pPublicKey: PCERT_PUBLIC_KEY_INFO, + ) -> DWORD; + pub fn CryptVerifyCertificateSignature( + hCryptProv: HCRYPTPROV_LEGACY, + dwCertEncodingType: DWORD, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + pPublicKey: PCERT_PUBLIC_KEY_INFO, + ) -> BOOL; + pub fn CryptVerifyCertificateSignatureEx( + hCryptProv: HCRYPTPROV_LEGACY, + dwCertEncodingType: DWORD, + dwSubjectType: DWORD, + pvSubject: *mut c_void, + dwIssuerType: DWORD, + pvIssuer: *mut c_void, + dwFlags: DWORD, + pvExtra: *mut c_void, + ) -> BOOL; +} +pub const CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB: DWORD = 1; +pub const CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT: DWORD = 2; +pub const CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL: DWORD = 3; +pub const CRYPT_VERIFY_CERT_SIGN_SUBJECT_OCSP_BASIC_SIGNED_RESPONSE: DWORD = 4; +pub const CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY: DWORD = 1; +pub const CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT: DWORD = 2; +pub const CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN: DWORD = 3; +pub const CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL: DWORD = 4; +pub const CRYPT_VERIFY_CERT_SIGN_DISABLE_MD2_MD4_FLAG: DWORD = 0x00000001; +pub const CRYPT_VERIFY_CERT_SIGN_SET_STRONG_PROPERTIES_FLAG: DWORD = 0x00000002; +pub const CRYPT_VERIFY_CERT_SIGN_RETURN_STRONG_PROPERTIES_FLAG: DWORD = 0x00000004; +STRUCT!{struct CRYPT_VERIFY_CERT_SIGN_STRONG_PROPERTIES_INFO { + CertSignHashCNGAlgPropData: CRYPT_DATA_BLOB, + CertIssuerPubKeyBitLengthPropData: CRYPT_DATA_BLOB, +}} +pub type PCRYPT_VERIFY_CERT_SIGN_STRONG_PROPERTIES_INFO + = *mut CRYPT_VERIFY_CERT_SIGN_STRONG_PROPERTIES_INFO; +STRUCT!{struct CRYPT_VERIFY_CERT_SIGN_WEAK_HASH_INFO { + cCNGHashAlgid: DWORD, + rgpwszCNGHashAlgid: *mut PCWSTR, + dwWeakIndex: DWORD, +}} +pub type PCRYPT_VERIFY_CERT_SIGN_WEAK_HASH_INFO = *mut CRYPT_VERIFY_CERT_SIGN_WEAK_HASH_INFO; +extern "system" { + pub fn CertIsStrongHashToSign( + pStrongSignPara: PCCERT_STRONG_SIGN_PARA, + pwszCNGHashAlgid: LPCWSTR, + pSigningCert: PCCERT_CONTEXT, + ) -> BOOL; + pub fn CryptHashToBeSigned( + hCryptProv: HCRYPTPROV_LEGACY, + dwCertEncodingType: DWORD, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + pbComputedHash: *mut BYTE, + pcbComputedHash: *mut DWORD, + ) -> BOOL; + pub fn CryptHashCertificate( + hCryptProv: HCRYPTPROV_LEGACY, + Algid: ALG_ID, + dwFlags: DWORD, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + pbComputedHash: *mut BYTE, + pcbComputedHash: *mut DWORD, + ) -> BOOL; + pub fn CryptHashCertificate2( + pwszCNGHashAlgid: LPCWSTR, + dwFlags: DWORD, + pvReserved: *mut c_void, + pbEncoded: *const BYTE, + cbEncoded: DWORD, + pbComputedHash: *mut BYTE, + pcbComputedHash: *mut DWORD, + ) -> BOOL; + pub fn CryptSignCertificate( + hCryptProvOrNCryptKey: HCRYPTPROV_OR_NCRYPT_KEY_HANDLE, + dwKeySpec: DWORD, + dwCertEncodingType: DWORD, + pbEncodedToBeSigned: *const BYTE, + cbEncodedToBeSigned: DWORD, + pSignatureAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *const c_void, + pbSignature: *mut BYTE, + pcbSignature: *mut DWORD, + ) -> BOOL; + pub fn CryptSignAndEncodeCertificate( + hCryptProvOrNCryptKey: HCRYPTPROV_OR_NCRYPT_KEY_HANDLE, + dwKeySpec: DWORD, + dwCertEncodingType: DWORD, + lpszStructType: LPCSTR, + pvStructInfo: *const c_void, + pSignatureAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *const c_void, + pbEncoded: *mut BYTE, + pcbEncoded: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_OID_EXTRACT_ENCODED_SIGNATURE_PARAMETERS_FUNC: &'static str + = "CryptDllExtractEncodedSignatureParameters"; +FN!{stdcall PFN_CRYPT_EXTRACT_ENCODED_SIGNATURE_PARAMETERS_FUNC( + dwCertEncodingType: DWORD, + pSignatureAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + ppvDecodedSignPara: *mut *mut c_void, + ppwszCNGHashAlgid: LPWSTR, +) -> BOOL} +pub const CRYPT_OID_SIGN_AND_ENCODE_HASH_FUNC: &'static str = "CryptDllSignAndEncodeHash"; +FN!{stdcall PFN_CRYPT_SIGN_AND_ENCODE_HASH_FUNC( + hKey: NCRYPT_KEY_HANDLE, + dwCertEncodingType: DWORD, + pSignatureAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pvDecodedSignPara: *mut c_void, + pwszCNGPubKeyAlgid: LPCWSTR, + pwszCNGHashAlgid: LPCWSTR, + pbComputedHash: *mut BYTE, + cbComputedHash: DWORD, + pbSignature: *mut BYTE, + pcbSignature: *mut DWORD, +) -> BOOL} +pub const CRYPT_OID_VERIFY_ENCODED_SIGNATURE_FUNC: &'static str = "CryptDllVerifyEncodedSignature"; +FN!{stdcall PFN_CRYPT_VERIFY_ENCODED_SIGNATURE_FUNC( + dwCertEncodingType: DWORD, + pPubKeyInfo: PCERT_PUBLIC_KEY_INFO, + pSignatureAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pvDecodedSignPara: *mut c_void, + pwszCNGPubKeyAlgid: LPCWSTR, + pwszCNGHashAlgid: LPCWSTR, + pbComputedHash: *mut BYTE, + cbComputedHash: DWORD, + pbSignature: *mut BYTE, + cbSignature: DWORD, +) -> BOOL} +extern "system" { + pub fn CertVerifyTimeValidity( + pTimeToVerify: LPFILETIME, + pCertInfo: PCERT_INFO, + ) -> LONG; + pub fn CertVerifyCRLTimeValidity( + pTimeToVerify: LPFILETIME, + pCrlInfo: PCRL_INFO, + ) -> LONG; + pub fn CertVerifyValidityNesting( + pSubjectInfo: PCERT_INFO, + pIssuerInfo: PCERT_INFO, + ) -> BOOL; + pub fn CertVerifyCRLRevocation( + dwCertEncodingType: DWORD, + pCertId: PCERT_INFO, + cCrlInfo: DWORD, + rgpCrlInfo: *mut PCRL_INFO, + ) -> BOOL; + pub fn CertAlgIdToOID( + dwAlgId: DWORD, + ) -> LPCSTR; + pub fn CertOIDToAlgId( + pszObjId: LPCSTR, + ) -> DWORD; + pub fn CertFindExtension( + pszObjId: LPCSTR, + cExtensions: DWORD, + rgExtensions: *mut CERT_EXTENSION, + ) -> PCERT_EXTENSION; + pub fn CertFindAttribute( + pszObjId: LPCSTR, + cAttr: DWORD, + rgAttr: *mut CRYPT_ATTRIBUTE, + ) -> PCRYPT_ATTRIBUTE; + pub fn CertFindRDNAttr( + pszObjId: LPCSTR, + pName: PCERT_NAME_INFO, + ) -> PCERT_RDN_ATTR; + pub fn CertGetIntendedKeyUsage( + dwCertEncodingType: DWORD, + pCertInfo: PCERT_INFO, + pbKeyUsage: *mut BYTE, + cbKeyUsage: DWORD, + ) -> BOOL; +} +pub type HCRYPTDEFAULTCONTEXT = *mut c_void; +extern "system" { + pub fn CryptInstallDefaultContext( + hCryptProv: HCRYPTPROV, + dwDefaultType: DWORD, + pvDefaultPara: *const c_void, + dwFlags: DWORD, + pvReserved: *mut c_void, + phDefaultContext: *mut HCRYPTDEFAULTCONTEXT, + ) -> BOOL; +} +pub const CRYPT_DEFAULT_CONTEXT_AUTO_RELEASE_FLAG: DWORD = 0x00000001; +pub const CRYPT_DEFAULT_CONTEXT_PROCESS_FLAG: DWORD = 0x00000002; +pub const CRYPT_DEFAULT_CONTEXT_CERT_SIGN_OID: DWORD = 1; +pub const CRYPT_DEFAULT_CONTEXT_MULTI_CERT_SIGN_OID: DWORD = 2; +STRUCT!{struct CRYPT_DEFAULT_CONTEXT_MULTI_OID_PARA { + cOID: DWORD, + rgpszOID: *mut LPSTR, +}} +pub type PCRYPT_DEFAULT_CONTEXT_MULTI_OID_PARA = *mut CRYPT_DEFAULT_CONTEXT_MULTI_OID_PARA; +extern "system" { + pub fn CryptUninstallDefaultContext( + hDefaultContext: HCRYPTDEFAULTCONTEXT, + dwFlags: DWORD, + pvReserved: *mut c_void, + ) -> BOOL; + pub fn CryptExportPublicKeyInfo( + hCryptProvOrNCryptKey: HCRYPTPROV_OR_NCRYPT_KEY_HANDLE, + dwKeySpec: DWORD, + dwCertEncodingType: DWORD, + pInfo: PCERT_PUBLIC_KEY_INFO, + pcbInfo: *mut DWORD, + ) -> BOOL; + pub fn CryptExportPublicKeyInfoEx( + hCryptProvOrNCryptKey: HCRYPTPROV_OR_NCRYPT_KEY_HANDLE, + dwKeySpec: DWORD, + dwCertEncodingType: DWORD, + pszPublicKeyObjId: LPSTR, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + pInfo: PCERT_PUBLIC_KEY_INFO, + pcbInfo: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC: &'static str = "CryptDllExportPublicKeyInfoEx"; +pub const CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC: &'static str + = "CryptDllExportPublicKeyInfoEx2"; +FN!{stdcall PFN_CRYPT_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC( + hNCryptKey: NCRYPT_KEY_HANDLE, + dwCertEncodingType: DWORD, + pszPublicKeyObjId: LPSTR, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + pInfo: PCERT_PUBLIC_KEY_INFO, + pcbInfo: *mut DWORD, +) -> BOOL} +extern "system" { + pub fn CryptExportPublicKeyInfoFromBCryptKeyHandle( + hBCryptKey: BCRYPT_KEY_HANDLE, + dwCertEncodingType: DWORD, + pszPublicKeyObjId: LPSTR, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + pInfo: PCERT_PUBLIC_KEY_INFO, + pcbInfo: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FROM_BCRYPT_HANDLE_FUNC: &'static str + = "CryptDllExportPublicKeyInfoFromBCryptKeyHandle"; +FN!{stdcall PFN_CRYPT_EXPORT_PUBLIC_KEY_INFO_FROM_BCRYPT_HANDLE_FUNC( + hBCryptKey: BCRYPT_KEY_HANDLE, + dwCertEncodingType: DWORD, + pszPublicKeyObjId: LPSTR, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + pInfo: PCERT_PUBLIC_KEY_INFO, + pcbInfo: *mut DWORD, +) -> BOOL} +extern "system" { + pub fn CryptImportPublicKeyInfo( + hCryptProv: HCRYPTPROV, + dwCertEncodingType: DWORD, + pInfo: PCERT_PUBLIC_KEY_INFO, + phKey: *mut HCRYPTKEY, + ) -> BOOL; +} +pub const CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC: &'static str = "CryptDllImportPublicKeyInfoEx"; +extern "system" { + pub fn CryptImportPublicKeyInfoEx( + hCryptProv: HCRYPTPROV, + dwCertEncodingType: DWORD, + pInfo: PCERT_PUBLIC_KEY_INFO, + aiKeyAlg: ALG_ID, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + phKey: *mut HCRYPTKEY, + ) -> BOOL; + pub fn CryptImportPublicKeyInfoEx2( + dwCertEncodingType: DWORD, + pInfo: PCERT_PUBLIC_KEY_INFO, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + phKey: *mut BCRYPT_KEY_HANDLE, + ) -> BOOL; +} +pub const CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_EX2_FUNC: &'static str + = "CryptDllImportPublicKeyInfoEx2"; +FN!{stdcall PFN_IMPORT_PUBLIC_KEY_INFO_EX2_FUNC( + dwCertEncodingType: DWORD, + pInfo: PCERT_PUBLIC_KEY_INFO, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + phKey: *mut BCRYPT_KEY_HANDLE, +) -> BOOL} +extern "system" { + pub fn CryptAcquireCertificatePrivateKey( + pCert: PCCERT_CONTEXT, + dwFlags: DWORD, + pvParameters: *mut c_void, + phCryptProvOrNCryptKey: *mut HCRYPTPROV_OR_NCRYPT_KEY_HANDLE, + pdwKeySpec: *mut DWORD, + pfCallerFreeProvOrNCryptKey: *mut BOOL, + ) -> BOOL; +} +pub const CRYPT_ACQUIRE_CACHE_FLAG: DWORD = 0x00000001; +pub const CRYPT_ACQUIRE_USE_PROV_INFO_FLAG: DWORD = 0x00000002; +pub const CRYPT_ACQUIRE_COMPARE_KEY_FLAG: DWORD = 0x00000004; +pub const CRYPT_ACQUIRE_NO_HEALING: DWORD = 0x00000008; +pub const CRYPT_ACQUIRE_SILENT_FLAG: DWORD = 0x00000040; +pub const CRYPT_ACQUIRE_WINDOW_HANDLE_FLAG: DWORD = 0x00000080; +pub const CRYPT_ACQUIRE_NCRYPT_KEY_FLAGS_MASK: DWORD = 0x00070000; +pub const CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG: DWORD = 0x00010000; +pub const CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG: DWORD = 0x00020000; +pub const CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG: DWORD = 0x00040000; +extern "system" { + pub fn CryptFindCertificateKeyProvInfo( + pCert: PCCERT_CONTEXT, + dwFlags: DWORD, + pvReserved: *mut c_void, + ) -> BOOL; +} +pub const CRYPT_FIND_USER_KEYSET_FLAG: DWORD = 0x00000001; +pub const CRYPT_FIND_MACHINE_KEYSET_FLAG: DWORD = 0x00000002; +pub const CRYPT_FIND_SILENT_KEYSET_FLAG: DWORD = 0x00000040; +FN!{stdcall PFN_IMPORT_PRIV_KEY_FUNC( + hCryptProv: HCRYPTPROV, + pPrivateKeyInfo: *mut CRYPT_PRIVATE_KEY_INFO, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, +) -> BOOL} +pub const CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC: &'static str = "CryptDllImportPrivateKeyInfoEx"; +extern "system" { + pub fn CryptImportPKCS8( + sPrivateKeyAndParams: CRYPT_PKCS8_IMPORT_PARAMS, + dwFlags: DWORD, + phCryptProv: *mut HCRYPTPROV, + pvAuxInfo: *mut c_void, + ) -> BOOL; +} +FN!{stdcall PFN_EXPORT_PRIV_KEY_FUNC( + hCryptProv: HCRYPTPROV, + dwKeySpec: DWORD, + pszPrivateKeyObjId: LPSTR, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + pPrivateKeyInfo: *mut CRYPT_PRIVATE_KEY_INFO, + pcbPrivateKeyInfo: *mut DWORD, +) -> BOOL} +pub const CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC: &'static str = "CryptDllExportPrivateKeyInfoEx"; +pub const CRYPT_DELETE_KEYSET: DWORD = CRYPT_DELETEKEYSET; +extern "system" { + pub fn CryptExportPKCS8( + hCryptProv: HCRYPTPROV, + dwKeySpec: DWORD, + pszPrivateKeyObjId: LPSTR, + dwFlags: DWORD, + pvAuxInfo: *mut c_void, + pbPrivateKeyBlob: *mut BYTE, + pcbPrivateKeyBlob: *mut DWORD, + ) -> BOOL; + pub fn CryptExportPKCS8Ex( + psExportParams: CRYPT_PKCS8_EXPORT_PARAMS, + dwKeySpec: DWORD, + pvAuxInfo: *mut c_void, + pbPrivateKeyBlob: *mut BYTE, + pcbPrivateKeyBlob: *mut DWORD, + ) -> BOOL; + pub fn CryptHashPublicKeyInfo( + hCryptProv: HCRYPTPROV_LEGACY, + Algid: ALG_ID, + dwFlags: DWORD, + dwCertEncodingType: DWORD, + pInfo: PCERT_PUBLIC_KEY_INFO, + pbComputedHash: *mut BYTE, + pcbComputedHash: *mut DWORD, + ) -> BOOL; + pub fn CertRDNValueToStrA( + dwValueType: DWORD, + pValue: PCERT_RDN_VALUE_BLOB, + psz: LPSTR, + csz: DWORD, + ) -> DWORD; + pub fn CertRDNValueToStrW( + dwValueType: DWORD, + pValue: PCERT_RDN_VALUE_BLOB, + psz: LPWSTR, + csz: DWORD, + ) -> DWORD; + pub fn CertNameToStrA( + dwCertEncodingType: DWORD, + pName: PCERT_NAME_BLOB, + dwStrType: DWORD, + psz: LPSTR, + csz: DWORD, + ) -> DWORD; + pub fn CertNameToStrW( + dwCertEncodingType: DWORD, + pName: PCERT_NAME_BLOB, + dwStrType: DWORD, + psz: LPWSTR, + csz: DWORD, + ) -> DWORD; +} +pub const CERT_SIMPLE_NAME_STR: DWORD = 1; +pub const CERT_OID_NAME_STR: DWORD = 2; +pub const CERT_X500_NAME_STR: DWORD = 3; +pub const CERT_XML_NAME_STR: DWORD = 4; +pub const CERT_NAME_STR_SEMICOLON_FLAG: DWORD = 0x40000000; +pub const CERT_NAME_STR_NO_PLUS_FLAG: DWORD = 0x20000000; +pub const CERT_NAME_STR_NO_QUOTING_FLAG: DWORD = 0x10000000; +pub const CERT_NAME_STR_CRLF_FLAG: DWORD = 0x08000000; +pub const CERT_NAME_STR_COMMA_FLAG: DWORD = 0x04000000; +pub const CERT_NAME_STR_REVERSE_FLAG: DWORD = 0x02000000; +pub const CERT_NAME_STR_FORWARD_FLAG: DWORD = 0x01000000; +pub const CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG: DWORD = 0x00010000; +pub const CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG: DWORD = 0x00020000; +pub const CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG: DWORD = 0x00040000; +pub const CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG: DWORD = 0x00080000; +pub const CERT_NAME_STR_DISABLE_UTF8_DIR_STR_FLAG: DWORD = 0x00100000; +pub const CERT_NAME_STR_ENABLE_PUNYCODE_FLAG: DWORD = 0x00200000; +extern "system" { + pub fn CertStrToNameA( + dwCertEncodingType: DWORD, + pszX500: LPCSTR, + dwStrType: DWORD, + pvReserved: *mut c_void, + pbEncoded: *mut BYTE, + pcbEncoded: *mut DWORD, + ppszError: *mut LPCSTR, + ) -> BOOL; + pub fn CertStrToNameW( + dwCertEncodingType: DWORD, + pszX500: LPCWSTR, + dwStrType: DWORD, + pvReserved: *mut c_void, + pbEncoded: *mut BYTE, + pcbEncoded: *mut DWORD, + ppszError: *mut LPCWSTR, + ) -> BOOL; + pub fn CertGetNameStringA( + pCertContext: PCCERT_CONTEXT, + dwType: DWORD, + dwFlags: DWORD, + pvTypePara: *mut c_void, + pszNameString: LPSTR, + cchNameString: DWORD, + ) -> DWORD; + pub fn CertGetNameStringW( + pCertContext: PCCERT_CONTEXT, + dwType: DWORD, + dwFlags: DWORD, + pvTypePara: *mut c_void, + pszNameString: LPWSTR, + cchNameString: DWORD, + ) -> DWORD; +} +pub const CERT_NAME_EMAIL_TYPE: DWORD = 1; +pub const CERT_NAME_RDN_TYPE: DWORD = 2; +pub const CERT_NAME_ATTR_TYPE: DWORD = 3; +pub const CERT_NAME_SIMPLE_DISPLAY_TYPE: DWORD = 4; +pub const CERT_NAME_FRIENDLY_DISPLAY_TYPE: DWORD = 5; +pub const CERT_NAME_DNS_TYPE: DWORD = 6; +pub const CERT_NAME_URL_TYPE: DWORD = 7; +pub const CERT_NAME_UPN_TYPE: DWORD = 8; +pub const CERT_NAME_ISSUER_FLAG: DWORD = 0x1; +pub const CERT_NAME_DISABLE_IE4_UTF8_FLAG: DWORD = 0x00010000; +pub const CERT_NAME_SEARCH_ALL_NAMES_FLAG: DWORD = 0x2; +FN!{stdcall PFN_CRYPT_GET_SIGNER_CERTIFICATE( + pvGetArg: *mut c_void, + dwCertEncodingType: DWORD, + pSignerId: PCERT_INFO, + hMsgCertStore: HCERTSTORE, +) -> PCCERT_CONTEXT} +STRUCT!{struct CRYPT_SIGN_MESSAGE_PARA { + cbSize: DWORD, + dwMsgEncodingType: DWORD, + pSigningCert: PCCERT_CONTEXT, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut c_void, + cMsgCert: DWORD, + rgpMsgCert: *mut PCCERT_CONTEXT, + cMsgCrl: DWORD, + rgpMsgCrl: *mut PCCRL_CONTEXT, + cAuthAttr: DWORD, + rgAuthAttr: PCRYPT_ATTRIBUTE, + cUnauthAttr: DWORD, + rgUnauthAttr: PCRYPT_ATTRIBUTE, + dwFlags: DWORD, + dwInnerContentType: DWORD, +}} +pub type PCRYPT_SIGN_MESSAGE_PARA = *mut CRYPT_SIGN_MESSAGE_PARA; +pub const CRYPT_MESSAGE_BARE_CONTENT_OUT_FLAG: DWORD = 0x00000001; +pub const CRYPT_MESSAGE_ENCAPSULATED_CONTENT_OUT_FLAG: DWORD = 0x00000002; +pub const CRYPT_MESSAGE_KEYID_SIGNER_FLAG: DWORD = 0x00000004; +pub const CRYPT_MESSAGE_SILENT_KEYSET_FLAG: DWORD = 0x00000040; +STRUCT!{struct CRYPT_VERIFY_MESSAGE_PARA { + cbSize: DWORD, + dwMsgAndCertEncodingType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + pfnGetSignerCertificate: PFN_CRYPT_GET_SIGNER_CERTIFICATE, + pvGetArg: *mut c_void, + pStrongSignPara: PCCERT_STRONG_SIGN_PARA, +}} +pub type PCRYPT_VERIFY_MESSAGE_PARA = *mut CRYPT_VERIFY_MESSAGE_PARA; +STRUCT!{struct CRYPT_ENCRYPT_MESSAGE_PARA { + cbSize: DWORD, + dwMsgEncodingType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + ContentEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvEncryptionAuxInfo: *mut c_void, + dwFlags: DWORD, + dwInnerContentType: DWORD, +}} +pub type PCRYPT_ENCRYPT_MESSAGE_PARA = *mut CRYPT_DECRYPT_MESSAGE_PARA; +pub const CRYPT_MESSAGE_KEYID_RECIPIENT_FLAG: DWORD = 0x4; +STRUCT!{struct CRYPT_DECRYPT_MESSAGE_PARA { + cbSize: DWORD, + dwMsgAndCertEncodingType: DWORD, + cCertStore: DWORD, + rghCertStore: *mut HCERTSTORE, + dwFlags: DWORD, +}} +pub type PCRYPT_DECRYPT_MESSAGE_PARA = *mut CRYPT_DECRYPT_MESSAGE_PARA; +STRUCT!{struct CRYPT_HASH_MESSAGE_PARA { + cbSize: DWORD, + dwMsgEncodingType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut c_void, +}} +pub type PCRYPT_HASH_MESSAGE_PARA = *mut CRYPT_HASH_MESSAGE_PARA; +UNION!{union CRYPT_KEY_SIGN_MESSAGE_PARA_u { + [usize; 1], + hCryptProv hCryptProv_mut: HCRYPTPROV, + hNCryptKey hNCryptKey_mut: NCRYPT_KEY_HANDLE, +}} +STRUCT!{struct CRYPT_KEY_SIGN_MESSAGE_PARA { + cbSize: DWORD, + dwMsgAndCertEncodingType: DWORD, + u: CRYPT_KEY_SIGN_MESSAGE_PARA_u, + dwKeySpec: DWORD, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + pvHashAuxInfo: *mut c_void, + PubKeyAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, +}} +pub type PCRYPT_KEY_SIGN_MESSAGE_PARA = *mut CRYPT_KEY_SIGN_MESSAGE_PARA; +STRUCT!{struct CRYPT_KEY_VERIFY_MESSAGE_PARA { + cbSize: DWORD, + dwMsgEncodingType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, +}} +pub type PCRYPT_KEY_VERIFY_MESSAGE_PARA = *mut CRYPT_KEY_VERIFY_MESSAGE_PARA; +extern "system" { + pub fn CryptSignMessage( + pSignPara: PCRYPT_SIGN_MESSAGE_PARA, + fDetachedSignature: BOOL, + cToBeSigned: DWORD, + rgpbToBeSigned: *mut *const BYTE, + rgcbToBeSigned: *mut DWORD, + pbSignedBlob: *mut BYTE, + pcbSignedBlob: *mut DWORD, + ) -> BOOL; + pub fn CryptVerifyMessageSignature( + pVerifyPara: PCRYPT_VERIFY_MESSAGE_PARA, + dwSignerIndex: DWORD, + pbSignedBlob: *const BYTE, + cbSignedBlob: DWORD, + pbDecoded: *mut BYTE, + pcbDecoded: *mut DWORD, + ppSignerCert: *mut PCCERT_CONTEXT, + ) -> BOOL; + pub fn CryptGetMessageSignerCount( + dwMsgEncodingType: DWORD, + pbSignedBlob: *const BYTE, + cbSignedBlob: DWORD, + ) -> LONG; + pub fn CryptGetMessageCertificates( + dwMsgAndCertEncodingType: DWORD, + hCryptProv: HCRYPTPROV_LEGACY, + dwFlags: DWORD, + pbSignedBlob: *const BYTE, + cbSignedBlob: DWORD, + ) -> HCERTSTORE; + pub fn CryptVerifyDetachedMessageSignature( + pVerifyPara: PCRYPT_VERIFY_MESSAGE_PARA, + dwSignerIndex: DWORD, + pbDetachedSignBlob: *const BYTE, + cbDetachedSignBlob: DWORD, + cToBeSigned: DWORD, + rgpbToBeSigned: *mut *const BYTE, + rgcbToBeSigned: *mut DWORD, + ppSignerCert: *mut PCCERT_CONTEXT, + ) -> BOOL; + pub fn CryptEncryptMessage( + pEncryptPara: PCRYPT_ENCRYPT_MESSAGE_PARA, + cRecipientCert: DWORD, + rgpRecipientCert: *mut PCCERT_CONTEXT, + pbToBeEncrypted: *const BYTE, + cbToBeEncrypted: DWORD, + pbEncryptedBlob: *mut BYTE, + pcbEncryptedBlob: *mut DWORD, + ) -> BOOL; + pub fn CryptDecryptMessage( + pDecryptPara: PCRYPT_DECRYPT_MESSAGE_PARA, + pbEncryptedBlob: *const BYTE, + cbEncryptedBlob: DWORD, + pbDecrypted: *mut BYTE, + pcbDecrypted: *mut DWORD, + ppXchgCert: *mut PCCERT_CONTEXT, + ) -> BOOL; + pub fn CryptSignAndEncryptMessage( + pSignPara: PCRYPT_SIGN_MESSAGE_PARA, + pEncryptPara: PCRYPT_ENCRYPT_MESSAGE_PARA, + cRecipientCert: DWORD, + rgpRecipientCert: *mut PCCERT_CONTEXT, + pbToBeSignedAndEncrypted: *const BYTE, + cbToBeSignedAndEncrypted: DWORD, + pbSignedAndEncryptedBlob: *mut BYTE, + pcbSignedAndEncryptedBlob: *mut DWORD, + ) -> BOOL; + pub fn CryptDecryptAndVerifyMessageSignature( + pDecryptPara: PCRYPT_DECRYPT_MESSAGE_PARA, + pVerifyPara: PCRYPT_VERIFY_MESSAGE_PARA, + dwSignerIndex: DWORD, + pbEncryptedBlob: *const BYTE, + cbEncryptedBlob: DWORD, + pbDecrypted: *mut BYTE, + pcbDecrypted: *mut DWORD, + ppXchgCert: *mut PCCERT_CONTEXT, + ppSignerCert: *mut PCCERT_CONTEXT, + ) -> BOOL; + pub fn CryptDecodeMessage( + dwMsgTypeFlags: DWORD, + pDecryptPara: PCRYPT_DECRYPT_MESSAGE_PARA, + pVerifyPara: PCRYPT_VERIFY_MESSAGE_PARA, + dwSignerIndex: DWORD, + pbEncodedBlob: *const BYTE, + cbEncodedBlob: DWORD, + dwPrevInnerContentType: DWORD, + pdwMsgType: *mut DWORD, + pdwInnerContentType: *mut DWORD, + pbDecoded: *mut BYTE, + pcbDecoded: *mut DWORD, + ppXchgCert: *mut PCCERT_CONTEXT, + ppSignerCert: *mut PCCERT_CONTEXT, + ) -> BOOL; + pub fn CryptHashMessage( + pHashPara: PCRYPT_HASH_MESSAGE_PARA, + fDetachedHash: BOOL, + cToBeHashed: DWORD, + rgpbToBeHashed: *mut *const BYTE, + rgcbToBeHashed: *mut DWORD, + pbHashedBlob: *mut BYTE, + pcbHashedBlob: *mut DWORD, + pbComputedHash: *mut BYTE, + pcbComputedHash: *mut DWORD, + ) -> BOOL; + pub fn CryptVerifyMessageHash( + pHashPara: PCRYPT_HASH_MESSAGE_PARA, + pbHashedBlob: *mut BYTE, + cbHashedBlob: DWORD, + pbToBeHashed: *mut BYTE, + pcbToBeHashed: *mut DWORD, + pbComputedHash: *mut BYTE, + pcbComputedHash: *mut DWORD, + ) -> BOOL; + pub fn CryptVerifyDetachedMessageHash( + pHashPara: PCRYPT_HASH_MESSAGE_PARA, + pbDetachedHashBlob: *mut BYTE, + cbDetachedHashBlob: DWORD, + cToBeHashed: DWORD, + rgpbToBeHashed: *mut *const BYTE, + rgcbToBeHashed: *mut DWORD, + pbComputedHash: *mut BYTE, + pcbComputedHash: *mut DWORD, + ) -> BOOL; + pub fn CryptSignMessageWithKey( + pSignPara: PCRYPT_KEY_SIGN_MESSAGE_PARA, + pbToBeSigned: *const BYTE, + cbToBeSigned: DWORD, + pbSignedBlob: *mut BYTE, + pcbSignedBlob: *mut DWORD, + ) -> BOOL; + pub fn CryptVerifyMessageSignatureWithKey( + pVerifyPara: PCRYPT_KEY_VERIFY_MESSAGE_PARA, + pPublicKeyInfo: PCERT_PUBLIC_KEY_INFO, + pbSignedBlob: *const BYTE, + cbSignedBlob: DWORD, + pbDecoded: *mut BYTE, + pcbDecoded: *mut DWORD, + ) -> BOOL; + pub fn CertOpenSystemStoreA( + hProv: HCRYPTPROV_LEGACY, + szSubsystemProtocol: LPCSTR, + ) -> HCERTSTORE; + pub fn CertOpenSystemStoreW( + hProv: HCRYPTPROV_LEGACY, + szSubsystemProtocol: LPCWSTR, + ) -> HCERTSTORE; + pub fn CertAddEncodedCertificateToSystemStoreA( + szCertStoreName: LPCSTR, + pbCertEncoded: *const BYTE, + cbCertEncoded: DWORD, + ) -> BOOL; + pub fn CertAddEncodedCertificateToSystemStoreW( + szCertStoreName: LPCWSTR, + pbCertEncoded: *const BYTE, + cbCertEncoded: DWORD, + ) -> BOOL; +} +STRUCT!{struct CERT_CHAIN { + cCerts: DWORD, + certs: PCERT_BLOB, + keyLocatorInfo: CRYPT_KEY_PROV_INFO, +}} +pub type PCERT_CHAIN = *mut CERT_CHAIN; +extern "system" { + pub fn FindCertsByIssuer( + pCertChains: PCERT_CHAIN, + pcbCertChains: *mut DWORD, + pcCertChains: *mut DWORD, + pbEncodedIssuerName: *mut BYTE, + cbEncodedIssuerName: DWORD, + pwszPurpose: LPCWSTR, + dwKeySpec: DWORD, + ) -> HRESULT; + pub fn CryptQueryObject( + dwObjectType: DWORD, + pvObject: *const c_void, + dwExpectedContentTypeFlags: DWORD, + dwExpectedFormatTypeFlags: DWORD, + dwFlags: DWORD, + pdwMsgAndCertEncodingType: *mut DWORD, + pdwContentType: *mut DWORD, + pdwFormatType: *mut DWORD, + phCertStore: *mut HCERTSTORE, + phMsg: *mut HCRYPTMSG, + ppvContext: *mut *const c_void, + ) -> BOOL; +} +pub const CERT_QUERY_OBJECT_FILE: DWORD = 0x00000001; +pub const CERT_QUERY_OBJECT_BLOB: DWORD = 0x00000002; +pub const CERT_QUERY_CONTENT_CERT: DWORD = 1; +pub const CERT_QUERY_CONTENT_CTL: DWORD = 2; +pub const CERT_QUERY_CONTENT_CRL: DWORD = 3; +pub const CERT_QUERY_CONTENT_SERIALIZED_STORE: DWORD = 4; +pub const CERT_QUERY_CONTENT_SERIALIZED_CERT: DWORD = 5; +pub const CERT_QUERY_CONTENT_SERIALIZED_CTL: DWORD = 6; +pub const CERT_QUERY_CONTENT_SERIALIZED_CRL: DWORD = 7; +pub const CERT_QUERY_CONTENT_PKCS7_SIGNED: DWORD = 8; +pub const CERT_QUERY_CONTENT_PKCS7_UNSIGNED: DWORD = 9; +pub const CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED: DWORD = 10; +pub const CERT_QUERY_CONTENT_PKCS10: DWORD = 11; +pub const CERT_QUERY_CONTENT_PFX: DWORD = 12; +pub const CERT_QUERY_CONTENT_CERT_PAIR: DWORD = 13; +pub const CERT_QUERY_CONTENT_PFX_AND_LOAD: DWORD = 14; +pub const CERT_QUERY_CONTENT_FLAG_CERT: DWORD = 1 << CERT_QUERY_CONTENT_CERT; +pub const CERT_QUERY_CONTENT_FLAG_CTL: DWORD = 1 << CERT_QUERY_CONTENT_CTL; +pub const CERT_QUERY_CONTENT_FLAG_CRL: DWORD = 1 << CERT_QUERY_CONTENT_CRL; +pub const CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE: DWORD + = 1<< CERT_QUERY_CONTENT_SERIALIZED_STORE; +pub const CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT: DWORD = 1 << CERT_QUERY_CONTENT_SERIALIZED_CERT; +pub const CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL: DWORD = 1 << CERT_QUERY_CONTENT_SERIALIZED_CTL; +pub const CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL: DWORD = 1 << CERT_QUERY_CONTENT_SERIALIZED_CRL; +pub const CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED: DWORD = 1 << CERT_QUERY_CONTENT_PKCS7_SIGNED; +pub const CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED: DWORD = 1 << CERT_QUERY_CONTENT_PKCS7_UNSIGNED; +pub const CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED: DWORD + = 1 << CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED; +pub const CERT_QUERY_CONTENT_FLAG_PKCS10: DWORD = 1 << CERT_QUERY_CONTENT_PKCS10; +pub const CERT_QUERY_CONTENT_FLAG_PFX: DWORD = 1 << CERT_QUERY_CONTENT_PFX; +pub const CERT_QUERY_CONTENT_FLAG_CERT_PAIR: DWORD = 1 << CERT_QUERY_CONTENT_CERT_PAIR; +pub const CERT_QUERY_CONTENT_FLAG_PFX_AND_LOAD: DWORD = 1 << CERT_QUERY_CONTENT_PFX_AND_LOAD; +pub const CERT_QUERY_CONTENT_FLAG_ALL: DWORD = CERT_QUERY_CONTENT_FLAG_CERT + | CERT_QUERY_CONTENT_FLAG_CTL | CERT_QUERY_CONTENT_FLAG_CRL + | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT + | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL + | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED + | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED | CERT_QUERY_CONTENT_FLAG_PKCS10 + | CERT_QUERY_CONTENT_FLAG_PFX | CERT_QUERY_CONTENT_FLAG_CERT_PAIR; +pub const CERT_QUERY_CONTENT_FLAG_ALL_ISSUER_CERT: DWORD = CERT_QUERY_CONTENT_FLAG_CERT + | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT + | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED; +pub const CERT_QUERY_FORMAT_BINARY: DWORD = 1; +pub const CERT_QUERY_FORMAT_BASE64_ENCODED: DWORD = 2; +pub const CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED: DWORD = 3; +pub const CERT_QUERY_FORMAT_FLAG_BINARY: DWORD = 1 << CERT_QUERY_FORMAT_BINARY; +pub const CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED: DWORD = 1 << CERT_QUERY_FORMAT_BASE64_ENCODED; +pub const CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED: DWORD + = 1 << CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED; +pub const CERT_QUERY_FORMAT_FLAG_ALL: DWORD = CERT_QUERY_FORMAT_FLAG_BINARY + | CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED | CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED; +extern "system" { + pub fn CryptMemAlloc( + cbSize: ULONG, + ) -> LPVOID; + pub fn CryptMemRealloc( + pv: LPVOID, + cbSize: ULONG, + ) -> LPVOID; + pub fn CryptMemFree( + pv: LPVOID, + ); +} +pub type HCRYPTASYNC = HANDLE; +pub type PHCRYPTASYNC = *mut HANDLE; +FN!{stdcall PFN_CRYPT_ASYNC_PARAM_FREE_FUNC( + pszParamOid: LPSTR, + pvParam: LPVOID, +) -> ()} +extern "system" { + pub fn CryptCreateAsyncHandle( + dwFlags: DWORD, + phAsync: PHCRYPTASYNC, + ) -> BOOL; + pub fn CryptSetAsyncParam( + hAsync: HCRYPTASYNC, + pszParamOid: LPSTR, + pvParam: LPVOID, + pfnFree: PFN_CRYPT_ASYNC_PARAM_FREE_FUNC, + ) -> BOOL; + pub fn CryptGetAsyncParam( + hAsync: HCRYPTASYNC, + pszParamOid: LPSTR, + ppvParam: *mut LPVOID, + ppfnFree: *mut PFN_CRYPT_ASYNC_PARAM_FREE_FUNC, + ) -> BOOL; + pub fn CryptCloseAsyncHandle( + hAsync: HCRYPTASYNC, + ) -> BOOL; +} +STRUCT!{struct CRYPT_BLOB_ARRAY { + cBlob: DWORD, + rgBlob: PCRYPT_DATA_BLOB, +}} +pub type PCRYPT_BLOB_ARRAY = *mut CRYPT_BLOB_ARRAY; +STRUCT!{struct CRYPT_CREDENTIALS { + cbSize: DWORD, + pszCredentialsOid: LPCSTR, + pvCredentials: LPVOID, +}} +pub type PCRYPT_CREDENTIALS = *mut CRYPT_CREDENTIALS; +pub const CREDENTIAL_OID_PASSWORD_CREDENTIALS_A: LPCSTR = 1 as LPCSTR; +pub const CREDENTIAL_OID_PASSWORD_CREDENTIALS_W: LPCSTR = 2 as LPCSTR; +STRUCT!{struct CRYPT_PASSWORD_CREDENTIALSA { + cbSize: DWORD, + pszUsername: LPSTR, + pszPassword: LPSTR, +}} +pub type PCRYPT_PASSWORD_CREDENTIALSA = *mut CRYPT_PASSWORD_CREDENTIALSA; +STRUCT!{struct CRYPT_PASSWORD_CREDENTIALSW { + cbSize: DWORD, + pszUsername: LPWSTR, + pszPassword: LPWSTR, +}} +pub type PCRYPT_PASSWORD_CREDENTIALSW = *mut CRYPT_PASSWORD_CREDENTIALSW; +pub const SCHEME_OID_RETRIEVE_ENCODED_OBJECT_FUNC: &'static str = "SchemeDllRetrieveEncodedObject"; +pub const SCHEME_OID_RETRIEVE_ENCODED_OBJECTW_FUNC: &'static str + = "SchemeDllRetrieveEncodedObjectW"; +FN!{stdcall PFN_FREE_ENCODED_OBJECT_FUNC( + pszObjectOid: LPCSTR, + pObject: PCRYPT_BLOB_ARRAY, + pvFreeContext: LPVOID, +) -> ()} +pub const CONTEXT_OID_CREATE_OBJECT_CONTEXT_FUNC: &'static str = "ContextDllCreateObjectContext"; +pub const CONTEXT_OID_CERTIFICATE: LPCSTR = 1 as LPCSTR; +pub const CONTEXT_OID_CRL: LPCSTR = 2 as LPCSTR; +pub const CONTEXT_OID_CTL: LPCSTR = 3 as LPCSTR; +pub const CONTEXT_OID_PKCS7: LPCSTR = 4 as LPCSTR; +pub const CONTEXT_OID_CAPI2_ANY: LPCSTR = 5 as LPCSTR; +pub const CONTEXT_OID_OCSP_RESP: LPCSTR = 6 as LPCSTR; +pub const CRYPT_RETRIEVE_MULTIPLE_OBJECTS: DWORD = 0x00000001; +pub const CRYPT_CACHE_ONLY_RETRIEVAL: DWORD = 0x00000002; +pub const CRYPT_WIRE_ONLY_RETRIEVAL: DWORD = 0x00000004; +pub const CRYPT_DONT_CACHE_RESULT: DWORD = 0x00000008; +pub const CRYPT_ASYNC_RETRIEVAL: DWORD = 0x00000010; +pub const CRYPT_STICKY_CACHE_RETRIEVAL: DWORD = 0x00001000; +pub const CRYPT_LDAP_SCOPE_BASE_ONLY_RETRIEVAL: DWORD = 0x00002000; +pub const CRYPT_OFFLINE_CHECK_RETRIEVAL: DWORD = 0x00004000; +pub const CRYPT_LDAP_INSERT_ENTRY_ATTRIBUTE: DWORD = 0x00008000; +pub const CRYPT_LDAP_SIGN_RETRIEVAL: DWORD = 0x00010000; +pub const CRYPT_NO_AUTH_RETRIEVAL: DWORD = 0x00020000; +pub const CRYPT_LDAP_AREC_EXCLUSIVE_RETRIEVAL: DWORD = 0x00040000; +pub const CRYPT_AIA_RETRIEVAL: DWORD = 0x00080000; +pub const CRYPT_HTTP_POST_RETRIEVAL: DWORD = 0x00100000; +pub const CRYPT_PROXY_CACHE_RETRIEVAL: DWORD = 0x00200000; +pub const CRYPT_NOT_MODIFIED_RETRIEVAL: DWORD = 0x00400000; +pub const CRYPT_ENABLE_SSL_REVOCATION_RETRIEVAL: DWORD = 0x00800000; +pub const CRYPT_RANDOM_QUERY_STRING_RETRIEVAL: DWORD = 0x04000000; +pub const CRYPT_ENABLE_FILE_RETRIEVAL: DWORD = 0x08000000; +pub const CRYPT_CREATE_NEW_FLUSH_ENTRY: DWORD = 0x10000000; +pub const CRYPT_VERIFY_CONTEXT_SIGNATURE: DWORD = 0x00000020; +pub const CRYPT_VERIFY_DATA_HASH: DWORD = 0x00000040; +pub const CRYPT_KEEP_TIME_VALID: DWORD = 0x00000080; +pub const CRYPT_DONT_VERIFY_SIGNATURE: DWORD = 0x00000100; +pub const CRYPT_DONT_CHECK_TIME_VALIDITY: DWORD = 0x00000200; +pub const CRYPT_CHECK_FRESHNESS_TIME_VALIDITY: DWORD = 0x00000400; +pub const CRYPT_ACCUMULATIVE_TIMEOUT: DWORD = 0x00000800; +pub const CRYPT_OCSP_ONLY_RETRIEVAL: DWORD = 0x01000000; +pub const CRYPT_NO_OCSP_FAILOVER_TO_CRL_RETRIEVAL: DWORD = 0x02000000; +STRUCT!{struct CRYPTNET_URL_CACHE_PRE_FETCH_INFO { + cbSize: DWORD, + dwObjectType: DWORD, + dwError: DWORD, + dwReserved: DWORD, + ThisUpdateTime: FILETIME, + NextUpdateTime: FILETIME, + PublishTime: FILETIME, +}} +pub type PCRYPTNET_URL_CACHE_PRE_FETCH_INFO = *mut CRYPTNET_URL_CACHE_PRE_FETCH_INFO; +pub const CRYPTNET_URL_CACHE_PRE_FETCH_NONE: DWORD = 0; +pub const CRYPTNET_URL_CACHE_PRE_FETCH_BLOB: DWORD = 1; +pub const CRYPTNET_URL_CACHE_PRE_FETCH_CRL: DWORD = 2; +pub const CRYPTNET_URL_CACHE_PRE_FETCH_OCSP: DWORD = 3; +pub const CRYPTNET_URL_CACHE_PRE_FETCH_AUTOROOT_CAB: DWORD = 5; +pub const CRYPTNET_URL_CACHE_PRE_FETCH_DISALLOWED_CERT_CAB: DWORD = 6; +pub const CRYPTNET_URL_CACHE_PRE_FETCH_PIN_RULES_CAB: DWORD = 7; +STRUCT!{struct CRYPTNET_URL_CACHE_FLUSH_INFO { + cbSize: DWORD, + dwExemptSeconds: DWORD, + ExpireTime: FILETIME, +}} +pub type PCRYPTNET_URL_CACHE_FLUSH_INFO = *mut CRYPTNET_URL_CACHE_FLUSH_INFO; +pub const CRYPTNET_URL_CACHE_DEFAULT_FLUSH: DWORD = 0; +pub const CRYPTNET_URL_CACHE_DISABLE_FLUSH: DWORD = 0xFFFFFFFF; +STRUCT!{struct CRYPTNET_URL_CACHE_RESPONSE_INFO { + cbSize: DWORD, + wResponseType: WORD, + wResponseFlags: WORD, + LastModifiedTime: FILETIME, + dwMaxAge: DWORD, + pwszETag: LPCWSTR, + dwProxyId: DWORD, +}} +pub type PCRYPTNET_URL_CACHE_RESPONSE_INFO = *mut CRYPTNET_URL_CACHE_RESPONSE_INFO; +pub const CRYPTNET_URL_CACHE_RESPONSE_NONE: WORD = 0; +pub const CRYPTNET_URL_CACHE_RESPONSE_HTTP: WORD = 1; +pub const CRYPTNET_URL_CACHE_RESPONSE_VALIDATED: WORD = 0x8000; +STRUCT!{struct CRYPT_RETRIEVE_AUX_INFO { + cbSize: DWORD, + pLastSyncTime: *mut FILETIME, + dwMaxUrlRetrievalByteCount: DWORD, + pPreFetchInfo: PCRYPTNET_URL_CACHE_PRE_FETCH_INFO, + pFlushInfo: PCRYPTNET_URL_CACHE_FLUSH_INFO, + ppResponseInfo: *mut PCRYPTNET_URL_CACHE_RESPONSE_INFO, + pwszCacheFileNamePrefix: LPWSTR, + pftCacheResync: LPFILETIME, + fProxyCacheRetrieval: BOOL, + dwHttpStatusCode: DWORD, + ppwszErrorResponseHeaders: *mut LPWSTR, + ppErrorContentBlob: *mut PCRYPT_DATA_BLOB, +}} +pub type PCRYPT_RETRIEVE_AUX_INFO = *mut CRYPT_RETRIEVE_AUX_INFO; +pub const CRYPT_RETRIEVE_MAX_ERROR_CONTENT_LENGTH: DWORD = 0x1000; +extern "system" { + pub fn CryptRetrieveObjectByUrlA( + pszUrl: LPCSTR, + pszObjectOid: LPCSTR, + dwRetrievalFlags: DWORD, + dwTimeout: DWORD, + ppvObject: *mut LPVOID, + hAsyncRetrieve: HCRYPTASYNC, + pCredentials: PCRYPT_CREDENTIALS, + pvVerify: LPVOID, + pAuxInfo: PCRYPT_RETRIEVE_AUX_INFO, + ) -> BOOL; + pub fn CryptRetrieveObjectByUrlW( + pszUrl: LPCWSTR, + pszObjectOid: LPCSTR, + dwRetrievalFlags: DWORD, + dwTimeout: DWORD, + ppvObject: *mut LPVOID, + hAsyncRetrieve: HCRYPTASYNC, + pCredentials: PCRYPT_CREDENTIALS, + pvVerify: LPVOID, + pAuxInfo: PCRYPT_RETRIEVE_AUX_INFO, + ) -> BOOL; +} +FN!{stdcall PFN_CRYPT_CANCEL_RETRIEVAL( + dwFlags: DWORD, + pvArg: *mut c_void, +) -> BOOL} +extern "system" { + pub fn CryptInstallCancelRetrieval( + pfnCancel: PFN_CRYPT_CANCEL_RETRIEVAL, + pvArg: *const c_void, + dwFlags: DWORD, + pvReserved: *mut c_void, + ) -> BOOL; + pub fn CryptUninstallCancelRetrieval( + dwFlags: DWORD, + pvReserved: *mut c_void, + ) -> BOOL; + pub fn CryptCancelAsyncRetrieval( + hAsyncRetrieval: HCRYPTASYNC, + ) -> BOOL; +} +pub const CRYPT_PARAM_ASYNC_RETRIEVAL_COMPLETION: LPCSTR = 1 as LPCSTR; +FN!{stdcall PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC( + pvCompletion: LPVOID, + dwCompletionCode: DWORD, + pszUrl: LPCSTR, + pszObjectOid: LPSTR, + pvObject: LPVOID, +) -> ()} +STRUCT!{struct CRYPT_ASYNC_RETRIEVAL_COMPLETION { + pfnCompletion: PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC, + pvCompletion: LPVOID, +}} +pub type PCRYPT_ASYNC_RETRIEVAL_COMPLETION = *mut CRYPT_ASYNC_RETRIEVAL_COMPLETION; +pub const CRYPT_PARAM_CANCEL_ASYNC_RETRIEVAL: LPCSTR = 2 as LPCSTR; +FN!{stdcall PFN_CANCEL_ASYNC_RETRIEVAL_FUNC( + hAsyncRetrieve: HCRYPTASYNC, +) -> BOOL} +pub const CRYPT_GET_URL_FROM_PROPERTY: DWORD = 0x00000001; +pub const CRYPT_GET_URL_FROM_EXTENSION: DWORD = 0x00000002; +pub const CRYPT_GET_URL_FROM_UNAUTH_ATTRIBUTE: DWORD = 0x00000004; +pub const CRYPT_GET_URL_FROM_AUTH_ATTRIBUTE: DWORD = 0x00000008; +STRUCT!{struct CRYPT_URL_ARRAY { + cUrl: DWORD, + rgwszUrl: *mut LPWSTR, +}} +pub type PCRYPT_URL_ARRAY = *mut CRYPT_URL_ARRAY; +STRUCT!{struct CRYPT_URL_INFO { + cbSize: DWORD, + dwSyncDeltaTime: DWORD, + cGroup: DWORD, + rgcGroupEntry: *mut DWORD, +}} +pub type PCRYPT_URL_INFO = *mut CRYPT_URL_INFO; +extern "system" { + pub fn CryptGetObjectUrl( + pszUrlOid: LPCSTR, + pvPara: LPVOID, + dwFlags: DWORD, + pUrlArray: PCRYPT_URL_ARRAY, + pcbUrlArray: *mut DWORD, + pUrlInfo: PCRYPT_URL_INFO, + pcbUrlInfo: *mut DWORD, + pvReserved: LPVOID, + ) -> BOOL; +} +pub const URL_OID_GET_OBJECT_URL_FUNC: &'static str = "UrlDllGetObjectUrl"; +pub const URL_OID_CERTIFICATE_ISSUER: LPCSTR = 1 as LPCSTR; +pub const URL_OID_CERTIFICATE_CRL_DIST_POINT: LPCSTR = 2 as LPCSTR; +pub const URL_OID_CTL_ISSUER: LPCSTR = 3 as LPCSTR; +pub const URL_OID_CTL_NEXT_UPDATE: LPCSTR = 4 as LPCSTR; +pub const URL_OID_CRL_ISSUER: LPCSTR = 5 as LPCSTR; +pub const URL_OID_CERTIFICATE_FRESHEST_CRL: LPCSTR = 6 as LPCSTR; +pub const URL_OID_CRL_FRESHEST_CRL: LPCSTR = 7 as LPCSTR; +pub const URL_OID_CROSS_CERT_DIST_POINT: LPCSTR = 8 as LPCSTR; +pub const URL_OID_CERTIFICATE_OCSP: LPCSTR = 9 as LPCSTR; +pub const URL_OID_CERTIFICATE_OCSP_AND_CRL_DIST_POINT: LPCSTR = 10 as LPCSTR; +pub const URL_OID_CERTIFICATE_CRL_DIST_POINT_AND_OCSP: LPCSTR = 11 as LPCSTR; +pub const URL_OID_CROSS_CERT_SUBJECT_INFO_ACCESS: LPCSTR = 12 as LPCSTR; +pub const URL_OID_CERTIFICATE_ONLY_OCSP: LPCSTR = 13 as LPCSTR; +STRUCT!{struct CERT_CRL_CONTEXT_PAIR { + pCertContext: PCCERT_CONTEXT, + pCrlContext: PCCRL_CONTEXT, +}} +pub type PCERT_CRL_CONTEXT_PAIR = *mut CERT_CRL_CONTEXT_PAIR; +pub type PCCERT_CRL_CONTEXT_PAIR = *const CERT_CRL_CONTEXT_PAIR; +STRUCT!{struct CRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO { + cbSize: DWORD, + iDeltaCrlIndicator: c_int, + pftCacheResync: LPFILETIME, + pLastSyncTime: LPFILETIME, + pMaxAgeTime: LPFILETIME, + pChainPara: PCERT_REVOCATION_CHAIN_PARA, + pDeltaCrlIndicator: PCRYPT_INTEGER_BLOB, +}} +pub type PCRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO = *mut CRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO; +extern "system" { + pub fn CryptGetTimeValidObject( + pszTimeValidOid: LPCSTR, + pvPara: LPVOID, + pIssuer: PCCERT_CONTEXT, + pftValidFor: LPFILETIME, + dwFlags: DWORD, + dwTimeout: DWORD, + ppvObject: *mut LPVOID, + pCredentials: PCRYPT_CREDENTIALS, + pExtraInfo: PCRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO, + ) -> BOOL; +} +pub const TIME_VALID_OID_GET_OBJECT_FUNC: &'static str = "TimeValidDllGetObject"; +pub const TIME_VALID_OID_GET_CTL: LPCSTR = 1 as LPCSTR; +pub const TIME_VALID_OID_GET_CRL: LPCSTR = 2 as LPCSTR; +pub const TIME_VALID_OID_GET_CRL_FROM_CERT: LPCSTR = 3 as LPCSTR; +pub const TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CERT: LPCSTR = 4 as LPCSTR; +pub const TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CRL: LPCSTR = 5 as LPCSTR; +extern "system" { + pub fn CryptFlushTimeValidObject( + pszFlushTimeValidOid: LPCSTR, + pvPara: LPVOID, + pIssuer: PCCERT_CONTEXT, + dwFlags: DWORD, + pvReserved: LPVOID, + ) -> BOOL; +} +pub const TIME_VALID_OID_FLUSH_OBJECT_FUNC: &'static str = "TimeValidDllFlushObject"; +pub const TIME_VALID_OID_FLUSH_CTL: LPCSTR = 1 as LPCSTR; +pub const TIME_VALID_OID_FLUSH_CRL: LPCSTR = 2 as LPCSTR; +pub const TIME_VALID_OID_FLUSH_CRL_FROM_CERT: LPCSTR = 3 as LPCSTR; +pub const TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CERT: LPCSTR = 4 as LPCSTR; +pub const TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CRL: LPCSTR = 5 as LPCSTR; +extern "system" { + pub fn CertCreateSelfSignCertificate( + hCryptProvOrNCryptKey: HCRYPTPROV_OR_NCRYPT_KEY_HANDLE, + pSubjectIssuerBlob: PCERT_NAME_BLOB, + dwFlags: DWORD, + pKeyProvInfo: PCRYPT_KEY_PROV_INFO, + pSignatureAlgorithm: PCRYPT_ALGORITHM_IDENTIFIER, + pStartTime: PSYSTEMTIME, + pEndTime: PSYSTEMTIME, + pExtensions: PCERT_EXTENSIONS, + ) -> PCCERT_CONTEXT; +} +pub const CERT_CREATE_SELFSIGN_NO_SIGN: DWORD = 1; +pub const CERT_CREATE_SELFSIGN_NO_KEY_INFO: DWORD = 2; +extern "system" { + pub fn CryptGetKeyIdentifierProperty( + pKeyIdentifier: *const CRYPT_HASH_BLOB, + dwPropId: DWORD, + dwFlags: DWORD, + pwszComputerName: LPCWSTR, + pvReserved: *mut c_void, + pvData: *mut c_void, + pcbData: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_KEYID_MACHINE_FLAG: DWORD = 0x00000020; +pub const CRYPT_KEYID_ALLOC_FLAG: DWORD = 0x00008000; +extern "system" { + pub fn CryptSetKeyIdentifierProperty( + pKeyIdentifier: *const CRYPT_HASH_BLOB, + dwPropId: DWORD, + dwFlags: DWORD, + pwszComputerName: LPCWSTR, + pvReserved: *mut c_void, + pvData: *const c_void, + ) -> BOOL; +} +pub const CRYPT_KEYID_DELETE_FLAG: DWORD = 0x00000010; +pub const CRYPT_KEYID_SET_NEW_FLAG: DWORD = 0x00002000; +FN!{stdcall PFN_CRYPT_ENUM_KEYID_PROP( + pKeyIdentifier: *const CRYPT_HASH_BLOB, + dwFlags: DWORD, + pvReserved: *mut c_void, + pvArg: *mut c_void, + cProp: DWORD, + rgdwPropId: *mut DWORD, + rgpvData: *mut *mut c_void, + rgcbData: *mut DWORD, +) -> BOOL} +extern "system" { + pub fn CryptEnumKeyIdentifierProperties( + pKeyIdentifier: *const CRYPT_HASH_BLOB, + dwPropId: DWORD, + dwFlags: DWORD, + pwszComputerName: LPCWSTR, + pvReserved: *mut c_void, + pvArg: *mut c_void, + pfnEnum: PFN_CRYPT_ENUM_KEYID_PROP, + ) -> BOOL; + pub fn CryptCreateKeyIdentifierFromCSP( + dwCertEncodingType: DWORD, + pszPubKeyOID: LPCSTR, + pPubKeyStruc: *const PUBLICKEYSTRUC, + cbPubKeyStruc: DWORD, + dwFlags: DWORD, + pvReserved: *mut c_void, + pbHash: *mut BYTE, + pcbHash: *mut DWORD, + ) -> BOOL; +} +pub const CERT_CHAIN_CONFIG_REGPATH: &'static str + = "Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CertDllCreateCertificateChainEngine\\Config"; +pub const CERT_CHAIN_MAX_URL_RETRIEVAL_BYTE_COUNT_VALUE_NAME: &'static str + = "MaxUrlRetrievalByteCount"; +pub const CERT_CHAIN_MAX_URL_RETRIEVAL_BYTE_COUNT_DEFAULT: DWORD = 100 * 1024 * 1024; +pub const CERT_CHAIN_CACHE_RESYNC_FILETIME_VALUE_NAME: &'static str = "ChainCacheResyncFiletime"; +pub const CERT_CHAIN_DISABLE_MANDATORY_BASIC_CONSTRAINTS_VALUE_NAME: &'static str + = "DisableMandatoryBasicConstraints"; +pub const CERT_CHAIN_DISABLE_CA_NAME_CONSTRAINTS_VALUE_NAME: &'static str + = "DisableCANameConstraints"; +pub const CERT_CHAIN_DISABLE_UNSUPPORTED_CRITICAL_EXTENSIONS_VALUE_NAME: &'static str + = "DisableUnsupportedCriticalExtensions"; +pub const CERT_CHAIN_MAX_AIA_URL_COUNT_IN_CERT_VALUE_NAME: &'static str = "MaxAIAUrlCountInCert"; +pub const CERT_CHAIN_MAX_AIA_URL_COUNT_IN_CERT_DEFAULT: DWORD = 5; +pub const CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_COUNT_PER_CHAIN_VALUE_NAME: &'static str + = "MaxAIAUrlRetrievalCountPerChain"; +pub const CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_COUNT_PER_CHAIN_DEFAULT: DWORD = 3; +pub const CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_BYTE_COUNT_VALUE_NAME: &'static str + = "MaxAIAUrlRetrievalByteCount"; +pub const CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_BYTE_COUNT_DEFAULT: DWORD = 100000; +pub const CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_CERT_COUNT_VALUE_NAME: &'static str + = "MaxAIAUrlRetrievalCertCount"; +pub const CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_CERT_COUNT_DEFAULT: DWORD = 10; +pub const CERT_CHAIN_OCSP_VALIDITY_SECONDS_VALUE_NAME: &'static str + = "OcspValiditySeconds"; +pub const CERT_CHAIN_OCSP_VALIDITY_SECONDS_DEFAULT: DWORD = 12 * 60 * 60; +pub const CERT_CHAIN_DISABLE_SERIAL_CHAIN_VALUE_NAME: &'static str = "DisableSerialChain"; +pub const CERT_CHAIN_SERIAL_CHAIN_LOG_FILE_NAME_VALUE_NAME: &'static str + = "SerialChainLogFileName"; +pub const CERT_CHAIN_DISABLE_SYNC_WITH_SSL_TIME_VALUE_NAME: &'static str + = "DisableSyncWithSslTime"; +pub const CERT_CHAIN_MAX_SSL_TIME_UPDATED_EVENT_COUNT_VALUE_NAME: &'static str + = "MaxSslTimeUpdatedEventCount"; +pub const CERT_CHAIN_MAX_SSL_TIME_UPDATED_EVENT_COUNT_DEFAULT: DWORD = 5; +pub const CERT_CHAIN_MAX_SSL_TIME_UPDATED_EVENT_COUNT_DISABLE: DWORD = 0xFFFFFFFF; +pub const CERT_CHAIN_SSL_HANDSHAKE_LOG_FILE_NAME_VALUE_NAME: &'static str + = "SslHandshakeLogFileName"; +pub const CERT_CHAIN_ENABLE_WEAK_SIGNATURE_FLAGS_VALUE_NAME: &'static str + = "EnableWeakSignatureFlags"; +pub const CERT_CHAIN_ENABLE_MD2_MD4_FLAG: DWORD = 0x00000001; +pub const CERT_CHAIN_ENABLE_WEAK_RSA_ROOT_FLAG: DWORD = 0x00000002; +pub const CERT_CHAIN_ENABLE_WEAK_LOGGING_FLAG: DWORD = 0x00000004; +pub const CERT_CHAIN_ENABLE_ONLY_WEAK_LOGGING_FLAG: DWORD = 0x00000008; +pub const CERT_CHAIN_MIN_RSA_PUB_KEY_BIT_LENGTH_VALUE_NAME: &'static str = "MinRsaPubKeyBitLength"; +pub const CERT_CHAIN_MIN_RSA_PUB_KEY_BIT_LENGTH_DEFAULT: DWORD = 1023; +pub const CERT_CHAIN_MIN_RSA_PUB_KEY_BIT_LENGTH_DISABLE: DWORD = 0xFFFFFFFF; +pub const CERT_CHAIN_WEAK_RSA_PUB_KEY_TIME_VALUE_NAME: &'static str = "WeakRsaPubKeyTime"; +pub const CERT_CHAIN_WEAK_RSA_PUB_KEY_TIME_DEFAULT: u64 = 0x01CA8A755C6E0000; +pub const CERT_CHAIN_WEAK_SIGNATURE_LOG_DIR_VALUE_NAME: &'static str = "WeakSignatureLogDir"; +pub const CERT_CHAIN_DEFAULT_CONFIG_SUBDIR: &'static str = "Default"; +pub const CERT_CHAIN_WEAK_PREFIX_NAME: &'static str = "Weak"; +pub const CERT_CHAIN_WEAK_THIRD_PARTY_CONFIG_NAME: &'static str = "ThirdParty"; +pub const CERT_CHAIN_WEAK_ALL_CONFIG_NAME: &'static str = "Al"; +pub const CERT_CHAIN_WEAK_FLAGS_NAME: &'static str = "Flags"; +pub const CERT_CHAIN_WEAK_HYGIENE_NAME: &'static str = "Hygiene"; +pub const CERT_CHAIN_WEAK_AFTER_TIME_NAME: &'static str = "AfterTime"; +pub const CERT_CHAIN_WEAK_FILE_HASH_AFTER_TIME_NAME: &'static str = "FileHashAfterTime"; +pub const CERT_CHAIN_WEAK_TIMESTAMP_HASH_AFTER_TIME_NAME: &'static str = "TimestampHashAfterTime"; +pub const CERT_CHAIN_WEAK_MIN_BIT_LENGTH_NAME: &'static str = "MinBitLength"; +pub const CERT_CHAIN_WEAK_SHA256_ALLOW_NAME: &'static str = "Sha256Allow"; +pub const CERT_CHAIN_MIN_PUB_KEY_BIT_LENGTH_DISABLE: DWORD = 0xFFFFFFFF; +pub const CERT_CHAIN_ENABLE_WEAK_SETTINGS_FLAG: DWORD = 0x80000000; +pub const CERT_CHAIN_DISABLE_ALL_EKU_WEAK_FLAG: DWORD = 0x00010000; +pub const CERT_CHAIN_ENABLE_ALL_EKU_HYGIENE_FLAG: DWORD = 0x00020000; +pub const CERT_CHAIN_DISABLE_OPT_IN_SERVER_AUTH_WEAK_FLAG: DWORD = 0x00040000; +pub const CERT_CHAIN_DISABLE_SERVER_AUTH_WEAK_FLAG: DWORD = 0x00100000; +pub const CERT_CHAIN_ENABLE_SERVER_AUTH_HYGIENE_FLAG: DWORD = 0x00200000; +pub const CERT_CHAIN_DISABLE_CODE_SIGNING_WEAK_FLAG: DWORD = 0x00400000; +pub const CERT_CHAIN_DISABLE_MOTW_CODE_SIGNING_WEAK_FLAG: DWORD = 0x00800000; +pub const CERT_CHAIN_ENABLE_CODE_SIGNING_HYGIENE_FLAG: DWORD = 0x01000000; +pub const CERT_CHAIN_ENABLE_MOTW_CODE_SIGNING_HYGIENE_FLAG: DWORD = 0x02000000; +pub const CERT_CHAIN_DISABLE_TIMESTAMP_WEAK_FLAG: DWORD = 0x04000000; +pub const CERT_CHAIN_DISABLE_MOTW_TIMESTAMP_WEAK_FLAG: DWORD = 0x08000000; +pub const CERT_CHAIN_ENABLE_TIMESTAMP_HYGIENE_FLAG: DWORD = 0x10000000; +pub const CERT_CHAIN_ENABLE_MOTW_TIMESTAMP_HYGIENE_FLAG: DWORD = 0x20000000; +pub const CERT_CHAIN_MOTW_IGNORE_AFTER_TIME_WEAK_FLAG: DWORD = 0x40000000; +pub const CERT_CHAIN_DISABLE_FILE_HASH_WEAK_FLAG: DWORD = 0x00001000; +pub const CERT_CHAIN_DISABLE_MOTW_FILE_HASH_WEAK_FLAG: DWORD = 0x00002000; +pub const CERT_CHAIN_DISABLE_TIMESTAMP_HASH_WEAK_FLAG: DWORD = 0x00004000; +pub const CERT_CHAIN_DISABLE_MOTW_TIMESTAMP_HASH_WEAK_FLAG: DWORD = 0x00008000; +pub const CERT_CHAIN_DISABLE_WEAK_FLAGS: DWORD = CERT_CHAIN_DISABLE_ALL_EKU_WEAK_FLAG + | CERT_CHAIN_DISABLE_SERVER_AUTH_WEAK_FLAG | CERT_CHAIN_DISABLE_OPT_IN_SERVER_AUTH_WEAK_FLAG + | CERT_CHAIN_DISABLE_CODE_SIGNING_WEAK_FLAG | CERT_CHAIN_DISABLE_MOTW_CODE_SIGNING_WEAK_FLAG + | CERT_CHAIN_DISABLE_TIMESTAMP_WEAK_FLAG | CERT_CHAIN_DISABLE_MOTW_TIMESTAMP_WEAK_FLAG; +pub const CERT_CHAIN_DISABLE_FILE_HASH_WEAK_FLAGS: DWORD = CERT_CHAIN_DISABLE_FILE_HASH_WEAK_FLAG + | CERT_CHAIN_DISABLE_MOTW_FILE_HASH_WEAK_FLAG; +pub const CERT_CHAIN_DISABLE_TIMESTAMP_HASH_WEAK_FLAGS: DWORD + = CERT_CHAIN_DISABLE_TIMESTAMP_HASH_WEAK_FLAG + | CERT_CHAIN_DISABLE_MOTW_TIMESTAMP_HASH_WEAK_FLAG; +pub const CERT_CHAIN_ENABLE_HYGIENE_FLAGS: DWORD = CERT_CHAIN_ENABLE_ALL_EKU_HYGIENE_FLAG + | CERT_CHAIN_ENABLE_SERVER_AUTH_HYGIENE_FLAG | CERT_CHAIN_ENABLE_CODE_SIGNING_HYGIENE_FLAG + | CERT_CHAIN_ENABLE_MOTW_CODE_SIGNING_HYGIENE_FLAG | CERT_CHAIN_ENABLE_TIMESTAMP_HYGIENE_FLAG + | CERT_CHAIN_ENABLE_MOTW_TIMESTAMP_HYGIENE_FLAG; +pub const CERT_CHAIN_MOTW_WEAK_FLAGS: DWORD = CERT_CHAIN_DISABLE_MOTW_CODE_SIGNING_WEAK_FLAG + | CERT_CHAIN_DISABLE_MOTW_TIMESTAMP_WEAK_FLAG + | CERT_CHAIN_ENABLE_MOTW_CODE_SIGNING_HYGIENE_FLAG + | CERT_CHAIN_ENABLE_MOTW_TIMESTAMP_HYGIENE_FLAG | CERT_CHAIN_MOTW_IGNORE_AFTER_TIME_WEAK_FLAG; +pub const CERT_CHAIN_OPT_IN_WEAK_FLAGS: DWORD = CERT_CHAIN_DISABLE_OPT_IN_SERVER_AUTH_WEAK_FLAG; +pub const CERT_CHAIN_AUTO_CURRENT_USER: DWORD = 1; +pub const CERT_CHAIN_AUTO_LOCAL_MACHINE: DWORD = 2; +pub const CERT_CHAIN_AUTO_IMPERSONATED: DWORD = 3; +pub const CERT_CHAIN_AUTO_PROCESS_INFO: DWORD = 4; +pub const CERT_CHAIN_AUTO_PINRULE_INFO: DWORD = 5; +pub const CERT_CHAIN_AUTO_NETWORK_INFO: DWORD = 6; +pub const CERT_CHAIN_AUTO_SERIAL_LOCAL_MACHINE: DWORD = 7; +pub const CERT_CHAIN_AUTO_HPKP_RULE_INFO: DWORD = 8; +pub const CERT_CHAIN_AUTO_FLAGS_VALUE_NAME: &'static str = "AutoFlags"; +pub const CERT_CHAIN_AUTO_FLUSH_DISABLE_FLAG: DWORD = 0x00000001; +pub const CERT_CHAIN_AUTO_LOG_CREATE_FLAG: DWORD = 0x00000002; +pub const CERT_CHAIN_AUTO_LOG_FREE_FLAG: DWORD = 0x00000004; +pub const CERT_CHAIN_AUTO_LOG_FLUSH_FLAG: DWORD = 0x00000008; +pub const CERT_CHAIN_AUTO_LOG_FLAGS: DWORD = CERT_CHAIN_AUTO_LOG_CREATE_FLAG + | CERT_CHAIN_AUTO_LOG_FREE_FLAG | CERT_CHAIN_AUTO_LOG_FLUSH_FLAG; +pub const CERT_CHAIN_AUTO_FLUSH_FIRST_DELTA_SECONDS_VALUE_NAME: &'static str + = "AutoFlushFirstDeltaSeconds"; +pub const CERT_CHAIN_AUTO_FLUSH_FIRST_DELTA_SECONDS_DEFAULT: DWORD = 5 * 60; +pub const CERT_CHAIN_AUTO_FLUSH_NEXT_DELTA_SECONDS_VALUE_NAME: &'static str + = "AutoFlushNextDeltaSeconds"; +pub const CERT_CHAIN_AUTO_FLUSH_NEXT_DELTA_SECONDS_DEFAULT: DWORD = 30 * 60; +pub const CERT_CHAIN_AUTO_LOG_FILE_NAME_VALUE_NAME: &'static str = "AutoLogFileName"; +pub const CERT_CHAIN_DISABLE_AUTO_FLUSH_PROCESS_NAME_LIST_VALUE_NAME: &'static str + = "DisableAutoFlushProcessNameList"; +pub const CERT_SRV_OCSP_RESP_MIN_VALIDITY_SECONDS_VALUE_NAME: &'static str + = "SrvOcspRespMinValiditySeconds"; +pub const CERT_SRV_OCSP_RESP_MIN_VALIDITY_SECONDS_DEFAULT: DWORD = 10 * 60; +pub const CERT_SRV_OCSP_RESP_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_VALUE_NAME: &'static str + = "SrvOcspRespUrlRetrievalTimeoutMilliseconds"; +pub const CERT_SRV_OCSP_RESP_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_DEFAULT: DWORD = 15 * 1000; +pub const CERT_SRV_OCSP_RESP_MAX_BEFORE_NEXT_UPDATE_SECONDS_VALUE_NAME: &'static str + = "SrvOcspRespMaxBeforeNextUpdateSeconds"; +pub const CERT_SRV_OCSP_RESP_MAX_BEFORE_NEXT_UPDATE_SECONDS_DEFAULT: DWORD = 4 * 60 * 60; +pub const CERT_SRV_OCSP_RESP_MIN_BEFORE_NEXT_UPDATE_SECONDS_VALUE_NAME: &'static str + = "SrvOcspRespMinBeforeNextUpdateSeconds"; +pub const CERT_SRV_OCSP_RESP_MIN_BEFORE_NEXT_UPDATE_SECONDS_DEFAULT: DWORD = 2 * 60; +pub const CERT_SRV_OCSP_RESP_MIN_AFTER_NEXT_UPDATE_SECONDS_VALUE_NAME: &'static str + = "SrvOcspRespMinAfterNextUpdateSeconds"; +pub const CERT_SRV_OCSP_RESP_MIN_AFTER_NEXT_UPDATE_SECONDS_DEFAULT: DWORD = 1 * 60; +pub const CERT_SRV_OCSP_RESP_MIN_SYNC_CERT_FILE_SECONDS_VALUE_NAME: &'static str + = "SrvOcspRespMinSyncCertFileSeconds"; +pub const CERT_SRV_OCSP_RESP_MIN_SYNC_CERT_FILE_SECONDS_DEFAULT: DWORD = 5; +pub const CERT_SRV_OCSP_RESP_MAX_SYNC_CERT_FILE_SECONDS_VALUE_NAME: &'static str + = "SrvOcspRespMaxSyncCertFileSeconds"; +pub const CERT_SRV_OCSP_RESP_MAX_SYNC_CERT_FILE_SECONDS_DEFAULT: DWORD = 1 * 60 * 60; +pub const CRYPTNET_MAX_CACHED_OCSP_PER_CRL_COUNT_VALUE_NAME: &'static str + = "CryptnetMaxCachedOcspPerCrlCount"; +pub const CRYPTNET_MAX_CACHED_OCSP_PER_CRL_COUNT_DEFAULT: DWORD = 500; +pub const CRYPTNET_OCSP_AFTER_CRL_DISABLE: DWORD = 0xFFFFFFFF; +pub const CRYPTNET_URL_CACHE_DEFAULT_FLUSH_EXEMPT_SECONDS_VALUE_NAME: &'static str + = "CryptnetDefaultFlushExemptSeconds"; +pub const CRYPTNET_URL_CACHE_DEFAULT_FLUSH_EXEMPT_SECONDS_DEFAULT: DWORD = 28 * 24 * 60 * 60; +pub const CRYPTNET_PRE_FETCH_MIN_MAX_AGE_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchMinMaxAgeSeconds"; +pub const CRYPTNET_PRE_FETCH_MIN_MAX_AGE_SECONDS_DEFAULT: DWORD = 1 * 60 * 60; +pub const CRYPTNET_PRE_FETCH_MAX_MAX_AGE_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchMaxMaxAgeSeconds"; +pub const CRYPTNET_PRE_FETCH_MAX_MAX_AGE_SECONDS_DEFAULT: DWORD = 14 * 24 * 60 * 60; +pub const CRYPTNET_PRE_FETCH_MIN_OCSP_VALIDITY_PERIOD_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchMinOcspValidityPeriodSeconds"; +pub const CRYPTNET_PRE_FETCH_MIN_OCSP_VALIDITY_PERIOD_SECONDS_DEFAULT: DWORD = 14 * 24 * 60 * 60; +pub const CRYPTNET_PRE_FETCH_AFTER_PUBLISH_PRE_FETCH_DIVISOR_VALUE_NAME: &'static str + = "CryptnetPreFetchAfterPublishPreFetchDivisor"; +pub const CRYPTNET_PRE_FETCH_AFTER_PUBLISH_PRE_FETCH_DIVISOR_DEFAULT: DWORD = 10; +pub const CRYPTNET_PRE_FETCH_BEFORE_NEXT_UPDATE_PRE_FETCH_DIVISOR_VALUE_NAME: &'static str + = "CryptnetPreFetchBeforeNextUpdatePreFetchDivisor"; +pub const CRYPTNET_PRE_FETCH_BEFORE_NEXT_UPDATE_PRE_FETCH_DIVISOR_DEFAULT: DWORD = 20; +pub const CRYPTNET_PRE_FETCH_MIN_BEFORE_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchMinBeforeNextUpdatePreFetchSeconds"; +pub const CRYPTNET_PRE_FETCH_MIN_BEFORE_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_DEFAULT: DWORD + = 1 * 60 * 60; +pub const CRYPTNET_PRE_FETCH_VALIDITY_PERIOD_AFTER_NEXT_UPDATE_PRE_FETCH_DIVISOR_VALUE_NAME: &'static str + = "CryptnetPreFetchValidityPeriodAfterNextUpdatePreFetchDivisor"; +pub const CRYPTNET_PRE_FETCH_VALIDITY_PERIOD_AFTER_NEXT_UPDATE_PRE_FETCH_DIVISOR_DEFAULT: DWORD + = 10; +pub const CRYPTNET_PRE_FETCH_MAX_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchMaxAfterNextUpdatePreFetchPeriodSeconds"; +pub const CRYPTNET_PRE_FETCH_MAX_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_DEFAULT: DWORD + = 4 * 60 * 60; +pub const CRYPTNET_PRE_FETCH_MIN_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchMinAfterNextUpdatePreFetchPeriodSeconds"; +pub const CRYPTNET_PRE_FETCH_MIN_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_DEFAULT: DWORD + = 30 * 60; +pub const CRYPTNET_PRE_FETCH_AFTER_CURRENT_TIME_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchAfterCurrentTimePreFetchPeriodSeconds"; +pub const CRYPTNET_PRE_FETCH_AFTER_CURRENT_TIME_PRE_FETCH_PERIOD_SECONDS_DEFAULT: DWORD + = 30 * 60; +pub const CRYPTNET_PRE_FETCH_TRIGGER_PERIOD_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchTriggerPeriodSeconds"; +pub const CRYPTNET_PRE_FETCH_TRIGGER_PERIOD_SECONDS_DEFAULT: DWORD = 10 * 60; +pub const CRYPTNET_PRE_FETCH_TRIGGER_DISABLE: DWORD = 0xFFFFFFFF; +pub const CRYPTNET_PRE_FETCH_SCAN_AFTER_TRIGGER_DELAY_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchScanAfterTriggerDelaySeconds"; +pub const CRYPTNET_PRE_FETCH_SCAN_AFTER_TRIGGER_DELAY_SECONDS_DEFAULT: DWORD = 60; +pub const CRYPTNET_PRE_FETCH_RETRIEVAL_TIMEOUT_SECONDS_VALUE_NAME: &'static str + = "CryptnetPreFetchRetrievalTimeoutSeconds"; +pub const CRYPTNET_PRE_FETCH_RETRIEVAL_TIMEOUT_SECONDS_DEFAULT: DWORD = 5 * 60; +pub const CRYPTNET_CRL_PRE_FETCH_CONFIG_REGPATH: &'static str + = "Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CertDllCreateCertificateChainEngine\\Config\\CrlPreFetch"; +pub const CRYPTNET_CRL_PRE_FETCH_PROCESS_NAME_LIST_VALUE_NAME: &'static str = "ProcessNameList"; +pub const CRYPTNET_CRL_PRE_FETCH_URL_LIST_VALUE_NAME: &'static str = "PreFetchUrlList"; +pub const CRYPTNET_CRL_PRE_FETCH_DISABLE_INFORMATION_EVENTS_VALUE_NAME: &'static str + = "DisableInformationEvents"; +pub const CRYPTNET_CRL_PRE_FETCH_LOG_FILE_NAME_VALUE_NAME: &'static str = "LogFileName"; +pub const CRYPTNET_CRL_PRE_FETCH_TIMEOUT_SECONDS_VALUE_NAME: &'static str = "TimeoutSeconds"; +pub const CRYPTNET_CRL_PRE_FETCH_TIMEOUT_SECONDS_DEFAULT: DWORD = 5 * 60; +pub const CRYPTNET_CRL_PRE_FETCH_MAX_AGE_SECONDS_VALUE_NAME: &'static str = "MaxAgeSeconds"; +pub const CRYPTNET_CRL_PRE_FETCH_MAX_AGE_SECONDS_DEFAULT: DWORD = 2 * 60 * 60; +pub const CRYPTNET_CRL_PRE_FETCH_MAX_AGE_SECONDS_MIN: DWORD = 5 * 60; +pub const CRYPTNET_CRL_PRE_FETCH_PUBLISH_BEFORE_NEXT_UPDATE_SECONDS_VALUE_NAME: &'static str + = "PublishBeforeNextUpdateSeconds"; +pub const CRYPTNET_CRL_PRE_FETCH_PUBLISH_BEFORE_NEXT_UPDATE_SECONDS_DEFAULT: DWORD = 1 * 60 * 60; +pub const CRYPTNET_CRL_PRE_FETCH_PUBLISH_RANDOM_INTERVAL_SECONDS_VALUE_NAME: &'static str + = "PublishRandomIntervalSeconds"; +pub const CRYPTNET_CRL_PRE_FETCH_PUBLISH_RANDOM_INTERVAL_SECONDS_DEFAULT: DWORD = 5 * 60; +pub const CRYPTNET_CRL_PRE_FETCH_MIN_BEFORE_NEXT_UPDATE_SECONDS_VALUE_NAME: &'static str + = "MinBeforeNextUpdateSeconds"; +pub const CRYPTNET_CRL_PRE_FETCH_MIN_BEFORE_NEXT_UPDATE_SECONDS_DEFAULT: DWORD = 5 * 60; +pub const CRYPTNET_CRL_PRE_FETCH_MIN_AFTER_NEXT_UPDATE_SECONDS_VALUE_NAME: &'static str + = "MinAfterNextUpdateSeconds"; +pub const CRYPTNET_CRL_PRE_FETCH_MIN_AFTER_NEXT_UPDATE_SECONDS_DEFAULT: DWORD = 5 * 60; +pub const CERT_GROUP_POLICY_CHAIN_CONFIG_REGPATH: &'static str + = "Software\\Policies\\Microsoft\\SystemCertificates\\ChainEngine\\Config"; +pub const CERT_CHAIN_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_VALUE_NAME: &'static str + = "ChainUrlRetrievalTimeoutMilliseconds"; +pub const CERT_CHAIN_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_DEFAULT: DWORD = 15 * 1000; +pub const CERT_CHAIN_REV_ACCUMULATIVE_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_VALUE_NAME: &'static str + = "ChainRevAccumulativeUrlRetrievalTimeoutMilliseconds"; +pub const CERT_CHAIN_REV_ACCUMULATIVE_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_DEFAULT: DWORD + = 20 * 1000; +pub const CERT_RETR_BEHAVIOR_INET_AUTH_VALUE_NAME: &'static str = "EnableInetUnknownAuth"; +pub const CERT_RETR_BEHAVIOR_INET_STATUS_VALUE_NAME: &'static str = "EnableInetLocal"; +pub const CERT_RETR_BEHAVIOR_FILE_VALUE_NAME: &'static str = "AllowFileUrlScheme"; +pub const CERT_RETR_BEHAVIOR_LDAP_VALUE_NAME: &'static str = "DisableLDAPSignAndEncrypt"; +pub const CRYPTNET_CACHED_OCSP_SWITCH_TO_CRL_COUNT_VALUE_NAME: &'static str + = "CryptnetCachedOcspSwitchToCrlCount"; +pub const CRYPTNET_CACHED_OCSP_SWITCH_TO_CRL_COUNT_DEFAULT: DWORD = 50; +pub const CRYPTNET_CRL_BEFORE_OCSP_ENABLE: DWORD = 0xFFFFFFFF; +pub const CERT_CHAIN_DISABLE_AIA_URL_RETRIEVAL_VALUE_NAME: &'static str = "DisableAIAUrlRetrieval"; +pub const CERT_CHAIN_OPTIONS_VALUE_NAME: &'static str = "Options"; +pub const CERT_CHAIN_OPTION_DISABLE_AIA_URL_RETRIEVAL: DWORD = 0x2; +pub const CERT_CHAIN_OPTION_ENABLE_SIA_URL_RETRIEVAL: DWORD = 0x4; +pub const CERT_CHAIN_CROSS_CERT_DOWNLOAD_INTERVAL_HOURS_VALUE_NAME: &'static str + = "CrossCertDownloadIntervalHours"; +pub const CERT_CHAIN_CROSS_CERT_DOWNLOAD_INTERVAL_HOURS_DEFAULT: DWORD = 24 * 7; +pub const CERT_CHAIN_CRL_VALIDITY_EXT_PERIOD_HOURS_VALUE_NAME: &'static str + = "CRLValidityExtensionPeriod"; +pub const CERT_CHAIN_CRL_VALIDITY_EXT_PERIOD_HOURS_DEFAULT: DWORD = 12; +pub type HCERTCHAINENGINE = HANDLE; +pub const HCCE_CURRENT_USER: HCERTCHAINENGINE = 0 as HCERTCHAINENGINE; +pub const HCCE_LOCAL_MACHINE: HCERTCHAINENGINE = 0x1 as HCERTCHAINENGINE; +pub const HCCE_SERIAL_LOCAL_MACHINE: HCERTCHAINENGINE = 0x2 as HCERTCHAINENGINE; +pub const CERT_CHAIN_CACHE_END_CERT: DWORD = 0x00000001; +pub const CERT_CHAIN_THREAD_STORE_SYNC: DWORD = 0x00000002; +pub const CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL: DWORD = 0x00000004; +pub const CERT_CHAIN_USE_LOCAL_MACHINE_STORE: DWORD = 0x00000008; +pub const CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE: DWORD = 0x00000010; +pub const CERT_CHAIN_ENABLE_SHARE_STORE: DWORD = 0x00000020; +STRUCT!{struct CERT_CHAIN_ENGINE_CONFIG { + cbSize: DWORD, + hRestrictedRoot: HCERTSTORE, + hRestrictedTrust: HCERTSTORE, + hRestrictedOther: HCERTSTORE, + cAdditionalStore: DWORD, + rghAdditionalStore: *mut HCERTSTORE, + dwFlags: DWORD, + dwUrlRetrievalTimeout: DWORD, + MaximumCachedCertificates: DWORD, + CycleDetectionModulus: DWORD, + hExclusiveRoot: HCERTSTORE, + hExclusiveTrustedPeople: HCERTSTORE, + dwExclusiveFlags: DWORD, +}} +pub type PCERT_CHAIN_ENGINE_CONFIG = *mut CERT_CHAIN_ENGINE_CONFIG; +extern "system" { + pub fn CertCreateCertificateChainEngine( + pConfig: PCERT_CHAIN_ENGINE_CONFIG, + phChainEngine: *mut HCERTCHAINENGINE, + ) -> BOOL; + pub fn CertFreeCertificateChainEngine( + hChainEngine: HCERTCHAINENGINE, + ); + pub fn CertResyncCertificateChainEngine( + hChainEngine: HCERTCHAINENGINE, + ) -> BOOL; +} +STRUCT!{struct CERT_TRUST_STATUS { + dwErrorStatus: DWORD, + dwInfoStatus: DWORD, +}} +pub type PCERT_TRUST_STATUS = *mut CERT_TRUST_STATUS; +pub const CERT_TRUST_NO_ERROR: DWORD = 0x00000000; +pub const CERT_TRUST_IS_NOT_TIME_VALID: DWORD = 0x00000001; +pub const CERT_TRUST_IS_NOT_TIME_NESTED: DWORD = 0x00000002; +pub const CERT_TRUST_IS_REVOKED: DWORD = 0x00000004; +pub const CERT_TRUST_IS_NOT_SIGNATURE_VALID: DWORD = 0x00000008; +pub const CERT_TRUST_IS_NOT_VALID_FOR_USAGE: DWORD = 0x00000010; +pub const CERT_TRUST_IS_UNTRUSTED_ROOT: DWORD = 0x00000020; +pub const CERT_TRUST_REVOCATION_STATUS_UNKNOWN: DWORD = 0x00000040; +pub const CERT_TRUST_IS_CYCLIC: DWORD = 0x00000080; +pub const CERT_TRUST_INVALID_EXTENSION: DWORD = 0x00000100; +pub const CERT_TRUST_INVALID_POLICY_CONSTRAINTS: DWORD = 0x00000200; +pub const CERT_TRUST_INVALID_BASIC_CONSTRAINTS: DWORD = 0x00000400; +pub const CERT_TRUST_INVALID_NAME_CONSTRAINTS: DWORD = 0x00000800; +pub const CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT: DWORD = 0x00001000; +pub const CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT: DWORD = 0x00002000; +pub const CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT: DWORD = 0x00004000; +pub const CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT: DWORD = 0x00008000; +pub const CERT_TRUST_IS_OFFLINE_REVOCATION: DWORD = 0x01000000; +pub const CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY: DWORD = 0x02000000; +pub const CERT_TRUST_IS_PARTIAL_CHAIN: DWORD = 0x00010000; +pub const CERT_TRUST_CTL_IS_NOT_TIME_VALID: DWORD = 0x00020000; +pub const CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID: DWORD = 0x00040000; +pub const CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE: DWORD = 0x00080000; +pub const CERT_TRUST_HAS_EXACT_MATCH_ISSUER: DWORD = 0x00000001; +pub const CERT_TRUST_HAS_KEY_MATCH_ISSUER: DWORD = 0x00000002; +pub const CERT_TRUST_HAS_NAME_MATCH_ISSUER: DWORD = 0x00000004; +pub const CERT_TRUST_IS_SELF_SIGNED: DWORD = 0x00000008; +pub const CERT_TRUST_AUTO_UPDATE_CA_REVOCATION: DWORD = 0x00000010; +pub const CERT_TRUST_AUTO_UPDATE_END_REVOCATION: DWORD = 0x00000020; +pub const CERT_TRUST_NO_OCSP_FAILOVER_TO_CRL: DWORD = 0x00000040; +pub const CERT_TRUST_IS_KEY_ROLLOVER: DWORD = 0x00000080; +pub const CERT_TRUST_SSL_HANDSHAKE_OCSP: DWORD = 0x00040000; +pub const CERT_TRUST_SSL_TIME_VALID_OCSP: DWORD = 0x00080000; +pub const CERT_TRUST_SSL_RECONNECT_OCSP: DWORD = 0x00100000; +pub const CERT_TRUST_HAS_PREFERRED_ISSUER: DWORD = 0x00000100; +pub const CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY: DWORD = 0x00000200; +pub const CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS: DWORD = 0x00000400; +pub const CERT_TRUST_IS_PEER_TRUSTED: DWORD = 0x00000800; +pub const CERT_TRUST_HAS_CRL_VALIDITY_EXTENDED: DWORD = 0x00001000; +pub const CERT_TRUST_IS_FROM_EXCLUSIVE_TRUST_STORE: DWORD = 0x00002000; +pub const CERT_TRUST_IS_CA_TRUSTED: DWORD = 0x00004000; +pub const CERT_TRUST_HAS_AUTO_UPDATE_WEAK_SIGNATURE: DWORD = 0x00008000; +pub const CERT_TRUST_HAS_ALLOW_WEAK_SIGNATURE: DWORD = 0x00020000; +pub const CERT_TRUST_IS_COMPLEX_CHAIN: DWORD = 0x00010000; +pub const CERT_TRUST_SSL_TIME_VALID: DWORD = 0x01000000; +pub const CERT_TRUST_NO_TIME_CHECK: DWORD = 0x02000000; +STRUCT!{struct CERT_REVOCATION_INFO { + cbSize: DWORD, + dwRevocationResult: DWORD, + pszRevocationOid: LPCSTR, + pvOidSpecificInfo: LPVOID, + fHasFreshnessTime: BOOL, + dwFreshnessTime: DWORD, + pCrlInfo: PCERT_REVOCATION_CRL_INFO, +}} +pub type PCERT_REVOCATION_INFO = *mut CERT_REVOCATION_INFO; +STRUCT!{struct CERT_TRUST_LIST_INFO { + cbSize: DWORD, + pCtlEntry: PCTL_ENTRY, + pCtlContext: PCCTL_CONTEXT, +}} +pub type PCERT_TRUST_LIST_INFO = *mut CERT_TRUST_LIST_INFO; +STRUCT!{struct CERT_CHAIN_ELEMENT { + cbSize: DWORD, + pCertContext: PCCERT_CONTEXT, + TrustStatus: CERT_TRUST_STATUS, + pRevocationInfo: PCERT_REVOCATION_INFO, + pIssuanceUsage: PCERT_ENHKEY_USAGE, + pApplicationUsage: PCERT_ENHKEY_USAGE, + pwszExtendedErrorInfo: LPWSTR, +}} +pub type PCERT_CHAIN_ELEMENT = *mut CERT_CHAIN_ELEMENT; +pub type PCCERT_CHAIN_ELEMENT = *const CERT_CHAIN_ELEMENT; +STRUCT!{struct CERT_SIMPLE_CHAIN { + cbSize: DWORD, + TrustStatus: CERT_TRUST_STATUS, + cElement: DWORD, + rgpElement: *mut PCERT_CHAIN_ELEMENT, + pTrustListInfo: PCERT_TRUST_LIST_INFO, + fHasRevocationFreshnessTime: BOOL, + dwRevocationFreshnessTime: DWORD, +}} +pub type PCERT_SIMPLE_CHAIN = *mut CERT_SIMPLE_CHAIN; +pub type PCCERT_SIMPLE_CHAIN = *const CERT_SIMPLE_CHAIN; +pub type PCERT_CHAIN_CONTEXT = *mut CERT_CHAIN_CONTEXT; +pub type PCCERT_CHAIN_CONTEXT = *const CERT_CHAIN_CONTEXT; +STRUCT!{struct CERT_CHAIN_CONTEXT { + cbSize: DWORD, + TrustStatus: CERT_TRUST_STATUS, + cChain: DWORD, + rgpChain: *mut PCERT_SIMPLE_CHAIN, + cLowerQualityChainContext: DWORD, + rgpLowerQualityChainContext: *mut PCCERT_CHAIN_CONTEXT, + fHasRevocationFreshnessTime: BOOL, + dwRevocationFreshnessTime: DWORD, + dwCreateFlags: DWORD, + ChainId: GUID, +}} +pub const USAGE_MATCH_TYPE_AND: DWORD = 0x00000000; +pub const USAGE_MATCH_TYPE_OR: DWORD = 0x00000001; +STRUCT!{struct CERT_USAGE_MATCH { + dwType: DWORD, + Usage: CERT_ENHKEY_USAGE, +}} +pub type PCERT_USAGE_MATCH = *mut CERT_USAGE_MATCH; +STRUCT!{struct CTL_USAGE_MATCH { + dwType: DWORD, + Usage: CTL_USAGE, +}} +pub type PCTL_USAGE_MATCH = *mut CTL_USAGE_MATCH; +STRUCT!{struct CERT_CHAIN_PARA { + cbSize: DWORD, + RequestedUsage: CERT_USAGE_MATCH, + RequestedIssuancePolicy: CERT_USAGE_MATCH, + dwUrlRetrievalTimeout: DWORD, + fCheckRevocationFreshnessTime: BOOL, + dwRevocationFreshnessTime: DWORD, + pftCacheResync: LPFILETIME, + pStrongSignPara: PCCERT_STRONG_SIGN_PARA, + dwStrongSignFlags: DWORD, +}} +pub type PCERT_CHAIN_PARA = *mut CERT_CHAIN_PARA; +pub const CERT_CHAIN_STRONG_SIGN_DISABLE_END_CHECK_FLAG: DWORD = 0x00000001; +pub const CERT_CHAIN_REVOCATION_CHECK_END_CERT: DWORD = 0x10000000; +pub const CERT_CHAIN_REVOCATION_CHECK_CHAIN: DWORD = 0x20000000; +pub const CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT: DWORD = 0x40000000; +pub const CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY: DWORD = 0x80000000; +pub const CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT: DWORD = 0x08000000; +pub const CERT_CHAIN_REVOCATION_CHECK_OCSP_CERT: DWORD = 0x04000000; +pub const CERT_CHAIN_DISABLE_PASS1_QUALITY_FILTERING: DWORD = 0x00000040; +pub const CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS: DWORD = 0x00000080; +pub const CERT_CHAIN_DISABLE_AUTH_ROOT_AUTO_UPDATE: DWORD = 0x00000100; +pub const CERT_CHAIN_TIMESTAMP_TIME: DWORD = 0x00000200; +pub const CERT_CHAIN_ENABLE_PEER_TRUST: DWORD = 0x00000400; +pub const CERT_CHAIN_DISABLE_MY_PEER_TRUST: DWORD = 0x00000800; +pub const CERT_CHAIN_DISABLE_MD2_MD4: DWORD = 0x00001000; +pub const CERT_CHAIN_DISABLE_AIA: DWORD = 0x00002000; +pub const CERT_CHAIN_HAS_MOTW: DWORD = 0x00004000; +pub const CERT_CHAIN_ONLY_ADDITIONAL_AND_AUTH_ROOT: DWORD = 0x00008000; +pub const CERT_CHAIN_OPT_IN_WEAK_SIGNATURE: DWORD = 0x00010000; +extern "system" { + pub fn CertGetCertificateChain( + hChainEngine: HCERTCHAINENGINE, + pCertContext: PCCERT_CONTEXT, + pTime: LPFILETIME, + hAdditionalStore: HCERTSTORE, + pChainPara: PCERT_CHAIN_PARA, + dwFlags: DWORD, + pvReserved: LPVOID, + ppChainContext: *mut PCCERT_CHAIN_CONTEXT, + ) -> BOOL; + pub fn CertFreeCertificateChain( + pChainContext: PCCERT_CHAIN_CONTEXT, + ); + pub fn CertDuplicateCertificateChain( + pChainContext: PCCERT_CHAIN_CONTEXT, + ) -> PCCERT_CHAIN_CONTEXT; +} +STRUCT!{struct CERT_REVOCATION_CHAIN_PARA { + cbSize: DWORD, + hChainEngine: HCERTCHAINENGINE, + hAdditionalStore: HCERTSTORE, + dwChainFlags: DWORD, + dwUrlRetrievalTimeout: DWORD, + pftCurrentTime: LPFILETIME, + pftCacheResync: LPFILETIME, + cbMaxUrlRetrievalByteCount: DWORD, +}} +pub const REVOCATION_OID_CRL_REVOCATION: LPCSTR = 1 as LPCSTR; +STRUCT!{struct CRL_REVOCATION_INFO { + pCrlEntry: PCRL_ENTRY, + pCrlContext: PCCRL_CONTEXT, + pCrlIssuerChain: PCCERT_CHAIN_CONTEXT, +}} +pub type PCRL_REVOCATION_INFO = *mut CRL_REVOCATION_INFO; +extern "system" { + pub fn CertFindChainInStore( + hCertStore: HCERTSTORE, + dwCertEncodingType: DWORD, + dwFindFlags: DWORD, + dwFindType: DWORD, + pvFindPara: *const c_void, + pPrevChainContext: PCCERT_CHAIN_CONTEXT, + ) -> PCCERT_CHAIN_CONTEXT; +} +pub const CERT_CHAIN_FIND_BY_ISSUER: DWORD = 1; +FN!{stdcall PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK( + pCert: PCCERT_CONTEXT, + pvFindArg: *mut c_void, +) -> BOOL} +STRUCT!{struct CERT_CHAIN_FIND_ISSUER_PARA { + cbSize: DWORD, + pszUsageIdentifier: LPCSTR, + dwKeySpec: DWORD, + dwAcquirePrivateKeyFlags: DWORD, + cIssuer: DWORD, + rgIssuer: *mut CERT_NAME_BLOB, + pfnFindCallback: PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK, + pvFindArg: *mut c_void, + pdwIssuerChainIndex: *mut DWORD, + pdwIssuerElementIndex: *mut DWORD, +}} +pub type PCERT_CHAIN_FIND_ISSUER_PARA = *mut CERT_CHAIN_FIND_ISSUER_PARA; +pub type CERT_CHAIN_FIND_BY_ISSUER_PARA = CERT_CHAIN_FIND_ISSUER_PARA; +pub type PCERT_CHAIN_FIND_BY_ISSUER_PARA = *mut CERT_CHAIN_FIND_ISSUER_PARA; +pub const CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG: DWORD = 0x0001; +pub const CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG: DWORD = 0x0002; +pub const CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG: DWORD = 0x0004; +pub const CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG: DWORD = 0x0008; +pub const CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG: DWORD = 0x4000; +pub const CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG: DWORD = 0x8000; +STRUCT!{struct CERT_CHAIN_POLICY_PARA { + cbSize: DWORD, + dwFlags: DWORD, + pvExtraPolicyPara: *mut c_void, +}} +pub type PCERT_CHAIN_POLICY_PARA = *mut CERT_CHAIN_POLICY_PARA; +STRUCT!{struct CERT_CHAIN_POLICY_STATUS { + cbSize: DWORD, + dwError: DWORD, + lChainIndex: LONG, + lElementIndex: LONG, + pvExtraPolicyStatus: *mut c_void, +}} +pub type PCERT_CHAIN_POLICY_STATUS = *mut CERT_CHAIN_POLICY_STATUS; +pub const CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG: DWORD = 0x00000001; +pub const CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG: DWORD = 0x00000002; +pub const CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG: DWORD = 0x00000004; +pub const CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG: DWORD = 0x00000008; +pub const CERT_CHAIN_POLICY_IGNORE_ALL_NOT_TIME_VALID_FLAGS: DWORD + = CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG + | CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG + | CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG; +pub const CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG: DWORD = 0x00000010; +pub const CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG: DWORD = 0x00000020; +pub const CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG: DWORD = 0x00000040; +pub const CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG: DWORD = 0x00000080; +pub const CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG: DWORD = 0x00000100; +pub const CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG: DWORD = 0x00000200; +pub const CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG: DWORD = 0x00000400; +pub const CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG: DWORD = 0x00000800; +pub const CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS: DWORD + = CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG + | CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG + | CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG + | CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG; +pub const CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG: DWORD = 0x00008000; +pub const CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG: DWORD = 0x00004000; +pub const CERT_CHAIN_POLICY_IGNORE_NOT_SUPPORTED_CRITICAL_EXT_FLAG: DWORD = 0x00002000; +pub const CERT_CHAIN_POLICY_IGNORE_PEER_TRUST_FLAG: DWORD = 0x00001000; +pub const CERT_CHAIN_POLICY_IGNORE_WEAK_SIGNATURE_FLAG: DWORD = 0x08000000; +extern "system" { + pub fn CertVerifyCertificateChainPolicy( + pszPolicyOID: LPCSTR, + pChainContext: PCCERT_CHAIN_CONTEXT, + pPolicyPara: PCERT_CHAIN_POLICY_PARA, + pPolicyStatus: PCERT_CHAIN_POLICY_STATUS, + ) -> BOOL; +} +pub const CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC: &'static str + = "CertDllVerifyCertificateChainPolicy"; + +pub const CERT_CHAIN_POLICY_BASE: LPCSTR = 1 as LPCSTR; +pub const CERT_CHAIN_POLICY_AUTHENTICODE: LPCSTR = 2 as LPCSTR; +pub const CERT_CHAIN_POLICY_AUTHENTICODE_TS: LPCSTR = 3 as LPCSTR; +pub const CERT_CHAIN_POLICY_SSL: LPCSTR = 4 as LPCSTR; +pub const CERT_CHAIN_POLICY_BASIC_CONSTRAINTS: LPCSTR = 5 as LPCSTR; +pub const CERT_CHAIN_POLICY_NT_AUTH: LPCSTR = 6 as LPCSTR; +pub const CERT_CHAIN_POLICY_MICROSOFT_ROOT: LPCSTR = 7 as LPCSTR; +pub const CERT_CHAIN_POLICY_EV: LPCSTR = 8 as LPCSTR; +pub const CERT_CHAIN_POLICY_SSL_F12: LPCSTR = 9 as LPCSTR; +pub const CERT_CHAIN_POLICY_SSL_HPKP_HEADER: LPCSTR = 10 as LPCSTR; +pub const CERT_CHAIN_POLICY_THIRD_PARTY_ROOT: LPCSTR = 11 as LPCSTR; +pub const CERT_CHAIN_POLICY_SSL_KEY_PIN: LPCSTR = 12 as LPCSTR; +STRUCT!{struct AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA { + cbSize: DWORD, + dwRegPolicySettings: DWORD, + pSignerInfo: PCMSG_SIGNER_INFO, +}} +pub type PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA + = *mut AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA; +STRUCT!{struct AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS { + cbSize: DWORD, + fCommercial: BOOL, +}} +pub type PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS + = *mut AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS; +STRUCT!{struct AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA { + cbSize: DWORD, + dwRegPolicySettings: DWORD, + fCommercial: BOOL, +}} +pub type PAUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA + = *mut AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA; +UNION!{union HTTPSPolicyCallbackData_u { + [u32; 1], + cbStruct cbStruct_mut: DWORD, + cbSize cbSize_mut: DWORD, +}} +STRUCT!{struct HTTPSPolicyCallbackData { + u: HTTPSPolicyCallbackData_u, + dwAuthType: DWORD, + fdwChecks: DWORD, + pwszServerName: *mut WCHAR, +}} +pub type PHTTPSPolicyCallbackData = *mut HTTPSPolicyCallbackData; +pub type SSL_EXTRA_CERT_CHAIN_POLICY_PARA = HTTPSPolicyCallbackData; +pub type PSSL_EXTRA_CERT_CHAIN_POLICY_PARA = *mut HTTPSPolicyCallbackData; +pub const AUTHTYPE_CLIENT: DWORD = 1; +pub const AUTHTYPE_SERVER: DWORD = 2; +pub const BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_CA_FLAG: DWORD = 0x80000000; +pub const BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_END_ENTITY_FLAG: DWORD = 0x40000000; +pub const MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG: DWORD = 0x00010000; +pub const MICROSOFT_ROOT_CERT_CHAIN_POLICY_CHECK_APPLICATION_ROOT_FLAG: DWORD = 0x00020000; +pub const MICROSOFT_ROOT_CERT_CHAIN_POLICY_DISABLE_FLIGHT_ROOT_FLAG: DWORD = 0x00040000; +STRUCT!{struct EV_EXTRA_CERT_CHAIN_POLICY_PARA { + cbSize: DWORD, + dwRootProgramQualifierFlags: DWORD, +}} +pub type PEV_EXTRA_CERT_CHAIN_POLICY_PARA = *mut EV_EXTRA_CERT_CHAIN_POLICY_PARA; +STRUCT!{struct EV_EXTRA_CERT_CHAIN_POLICY_STATUS { + cbSize: DWORD, + dwQualifiers: DWORD, + dwIssuanceUsageIndex: DWORD, +}} +pub type PEV_EXTRA_CERT_CHAIN_POLICY_STATUS = *mut EV_EXTRA_CERT_CHAIN_POLICY_STATUS; +pub const SSL_F12_ERROR_TEXT_LENGTH: usize = 256; +STRUCT!{struct SSL_F12_EXTRA_CERT_CHAIN_POLICY_STATUS { + cbSize: DWORD, + dwErrorLevel: DWORD, + dwErrorCategory: DWORD, + dwReserved: DWORD, + wszErrorText: [WCHAR; SSL_F12_ERROR_TEXT_LENGTH], +}} +pub type PSSL_F12_EXTRA_CERT_CHAIN_POLICY_STATUS = *mut SSL_F12_EXTRA_CERT_CHAIN_POLICY_STATUS; +pub const CERT_CHAIN_POLICY_SSL_F12_SUCCESS_LEVEL: DWORD = 0; +pub const CERT_CHAIN_POLICY_SSL_F12_WARNING_LEVEL: DWORD = 1; +pub const CERT_CHAIN_POLICY_SSL_F12_ERROR_LEVEL: DWORD = 2; +pub const CERT_CHAIN_POLICY_SSL_F12_NONE_CATEGORY: DWORD = 0; +pub const CERT_CHAIN_POLICY_SSL_F12_WEAK_CRYPTO_CATEGORY: DWORD = 1; +pub const CERT_CHAIN_POLICY_SSL_F12_ROOT_PROGRAM_CATEGORY: DWORD = 2; +pub const SSL_HPKP_PKP_HEADER_INDEX: usize = 0; +pub const SSL_HPKP_PKP_RO_HEADER_INDEX: usize = 1; +pub const SSL_HPKP_HEADER_COUNT: usize = 2; +STRUCT!{struct SSL_HPKP_HEADER_EXTRA_CERT_CHAIN_POLICY_PARA { + cbSize: DWORD, + dwReserved: DWORD, + pwszServerName: LPWSTR, + rgpszHpkpValue: [LPSTR; SSL_HPKP_HEADER_COUNT], +}} +pub type PSSL_HPKP_HEADER_EXTRA_CERT_CHAIN_POLICY_PARA + = *mut SSL_HPKP_HEADER_EXTRA_CERT_CHAIN_POLICY_PARA; +STRUCT!{struct SSL_KEY_PIN_EXTRA_CERT_CHAIN_POLICY_PARA { + cbSize: DWORD, + dwReserved: DWORD, + pwszServerName: PCWSTR, +}} +pub type PSSL_KEY_PIN_EXTRA_CERT_CHAIN_POLICY_PARA = *mut SSL_KEY_PIN_EXTRA_CERT_CHAIN_POLICY_PARA; +pub const SSL_KEY_PIN_ERROR_TEXT_LENGTH: usize = 512; +STRUCT!{struct SSL_KEY_PIN_EXTRA_CERT_CHAIN_POLICY_STATUS { + cbSize: DWORD, + lError: LONG, + wszErrorText: [WCHAR; SSL_KEY_PIN_ERROR_TEXT_LENGTH], +}} +pub type PSSL_KEY_PIN_EXTRA_CERT_CHAIN_POLICY_STATUS + = *mut SSL_KEY_PIN_EXTRA_CERT_CHAIN_POLICY_STATUS; +pub const CERT_CHAIN_POLICY_SSL_KEY_PIN_MISMATCH_ERROR: LONG = -2; +pub const CERT_CHAIN_POLICY_SSL_KEY_PIN_MITM_ERROR: LONG = -1; +pub const CERT_CHAIN_POLICY_SSL_KEY_PIN_SUCCESS: LONG = 0; +pub const CERT_CHAIN_POLICY_SSL_KEY_PIN_MITM_WARNING: LONG = 1; +pub const CERT_CHAIN_POLICY_SSL_KEY_PIN_MISMATCH_WARNING: LONG = 2; +extern "system" { + pub fn CryptStringToBinaryA( + pszString: LPCSTR, + cchString: DWORD, + dwFlags: DWORD, + pbBinary: *mut BYTE, + pcbBinary: *mut DWORD, + pdwSkip: *mut DWORD, + pdwFlags: *mut DWORD, + ) -> BOOL; + pub fn CryptStringToBinaryW( + pszString: LPCWSTR, + cchString: DWORD, + dwFlags: DWORD, + pbBinary: *mut BYTE, + pcbBinary: *mut DWORD, + pdwSkip: *mut DWORD, + pdwFlags: *mut DWORD, + ) -> BOOL; + pub fn CryptBinaryToStringA( + pbBinary: *const BYTE, + cbBinary: DWORD, + dwFlags: DWORD, + pszString: LPSTR, + pcchString: *mut DWORD, + ) -> BOOL; + pub fn CryptBinaryToStringW( + pbBinary: *const BYTE, + cbBinary: DWORD, + dwFlags: DWORD, + pszString: LPWSTR, + pcchString: *mut DWORD, + ) -> BOOL; +} +pub const CRYPT_STRING_BASE64HEADER: DWORD = 0x00000000; +pub const CRYPT_STRING_BASE64: DWORD = 0x00000001; +pub const CRYPT_STRING_BINARY: DWORD = 0x00000002; +pub const CRYPT_STRING_BASE64REQUESTHEADER: DWORD = 0x00000003; +pub const CRYPT_STRING_HEX: DWORD = 0x00000004; +pub const CRYPT_STRING_HEXASCII: DWORD = 0x00000005; +pub const CRYPT_STRING_BASE64_ANY: DWORD = 0x00000006; +pub const CRYPT_STRING_ANY: DWORD = 0x00000007; +pub const CRYPT_STRING_HEX_ANY: DWORD = 0x00000008; +pub const CRYPT_STRING_BASE64X509CRLHEADER: DWORD = 0x00000009; +pub const CRYPT_STRING_HEXADDR: DWORD = 0x0000000a; +pub const CRYPT_STRING_HEXASCIIADDR: DWORD = 0x0000000b; +pub const CRYPT_STRING_HEXRAW: DWORD = 0x0000000c; +pub const CRYPT_STRING_BASE64URI: DWORD = 0x0000000d; +pub const CRYPT_STRING_ENCODEMASK: DWORD = 0x000000ff; +pub const CRYPT_STRING_RESERVED100: DWORD = 0x00000100; +pub const CRYPT_STRING_RESERVED200: DWORD = 0x00000200; +pub const CRYPT_STRING_PERCENTESCAPE: DWORD = 0x08000000; +pub const CRYPT_STRING_HASHDATA: DWORD = 0x10000000; +pub const CRYPT_STRING_STRICT: DWORD = 0x20000000; +pub const CRYPT_STRING_NOCRLF: DWORD = 0x40000000; +pub const CRYPT_STRING_NOCR: DWORD = 0x80000000; +pub const szOID_PKCS_12_PbeIds: &'static str = "1.2.840.113549.1.12.1"; +pub const szOID_PKCS_12_pbeWithSHA1And128BitRC4: &'static str = "1.2.840.113549.1.12.1.1"; +pub const szOID_PKCS_12_pbeWithSHA1And40BitRC4: &'static str = "1.2.840.113549.1.12.1.2"; +pub const szOID_PKCS_12_pbeWithSHA1And3KeyTripleDES: &'static str = "1.2.840.113549.1.12.1.3"; +pub const szOID_PKCS_12_pbeWithSHA1And2KeyTripleDES: &'static str = "1.2.840.113549.1.12.1.4"; +pub const szOID_PKCS_12_pbeWithSHA1And128BitRC2: &'static str = "1.2.840.113549.1.12.1.5"; +pub const szOID_PKCS_12_pbeWithSHA1And40BitRC2: &'static str = "1.2.840.113549.1.12.1.6"; +STRUCT!{struct CRYPT_PKCS12_PBE_PARAMS { + iIterations: c_int, + cbSalt: ULONG, +}} +extern "system" { + pub fn PFXImportCertStore( + pPFX: *mut CRYPT_DATA_BLOB, + szPassword: LPCWSTR, + dwFlags: DWORD, + ) -> HCERTSTORE; +} +pub const PKCS12_IMPORT_SILENT: DWORD = 0x00000040; +pub const CRYPT_USER_KEYSET: DWORD = 0x00001000; +pub const PKCS12_PREFER_CNG_KSP: DWORD = 0x00000100; +pub const PKCS12_ALWAYS_CNG_KSP: DWORD = 0x00000200; +pub const PKCS12_ONLY_CERTIFICATES: DWORD = 0x00000400; +pub const PKCS12_ONLY_NOT_ENCRYPTED_CERTIFICATES: DWORD = 0x00000800; +pub const PKCS12_ALLOW_OVERWRITE_KEY: DWORD = 0x00004000; +pub const PKCS12_NO_PERSIST_KEY: DWORD = 0x00008000; +pub const PKCS12_IMPORT_RESERVED_MASK: DWORD = 0xffff0000; +pub const PKCS12_OBJECT_LOCATOR_ALL_IMPORT_FLAGS: DWORD = PKCS12_ALWAYS_CNG_KSP + | PKCS12_NO_PERSIST_KEY | PKCS12_IMPORT_SILENT | PKCS12_INCLUDE_EXTENDED_PROPERTIES; +pub const PKCS12_ONLY_CERTIFICATES_PROVIDER_TYPE: DWORD = 0; +pub const PKCS12_ONLY_CERTIFICATES_PROVIDER_NAME: &'static str = "PfxProvider"; +pub const PKCS12_ONLY_CERTIFICATES_CONTAINER_NAME: &'static str = "PfxContainer"; +extern "system" { + pub fn PFXIsPFXBlob( + pPFX: *mut CRYPT_DATA_BLOB, + ) -> BOOL; + pub fn PFXVerifyPassword( + pPFX: *mut CRYPT_DATA_BLOB, + szPassword: LPCWSTR, + dwFlags: DWORD, + ) -> BOOL; + pub fn PFXExportCertStoreEx( + hStore: HCERTSTORE, + pPFX: *mut CRYPT_DATA_BLOB, + szPassword: LPCWSTR, + pvPara: *mut c_void, + dwFlags: DWORD, + ) -> BOOL; +} +pub const REPORT_NO_PRIVATE_KEY: DWORD = 0x0001; +pub const REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY: DWORD = 0x0002; +pub const EXPORT_PRIVATE_KEYS: DWORD = 0x0004; +pub const PKCS12_INCLUDE_EXTENDED_PROPERTIES: DWORD = 0x0010; +pub const PKCS12_PROTECT_TO_DOMAIN_SIDS: DWORD = 0x0020; +pub const PKCS12_EXPORT_SILENT: DWORD = 0x0040; +pub const PKCS12_DISABLE_ENCRYPT_CERTIFICATES: DWORD = 0x0100; +pub const PKCS12_ENCRYPT_CERTIFICATES: DWORD = 0x0200; +pub const PKCS12_EXPORT_ECC_CURVE_PARAMETERS: DWORD = 0x1000; +pub const PKCS12_EXPORT_ECC_CURVE_OID: DWORD = 0x2000; +pub const PKCS12_EXPORT_RESERVED_MASK: DWORD = 0xffff0000; +pub const PKCS12_CONFIG_REGPATH: &'static str + = "Software\\Microsoft\\Windows\\CurrentVersion\\PFX"; +pub const PKCS12_ENCRYPT_CERTIFICATES_VALUE_NAME: &'static str = "EncryptCertificates"; +extern "system" { + pub fn PFXExportCertStore( + hStore: HCERTSTORE, + pPFX: *mut CRYPT_DATA_BLOB, + szPassword: LPCWSTR, + dwFlags: DWORD, + ) -> BOOL; +} +pub type HCERT_SERVER_OCSP_RESPONSE = *mut c_void; +pub type PCERT_SERVER_OCSP_RESPONSE_CONTEXT = *mut CERT_SERVER_OCSP_RESPONSE_CONTEXT; +pub type PCCERT_SERVER_OCSP_RESPONSE_CONTEXT = *const CERT_SERVER_OCSP_RESPONSE_CONTEXT; +STRUCT!{struct CERT_SERVER_OCSP_RESPONSE_CONTEXT { + cbSize: DWORD, + pbEncodedOcspResponse: *mut BYTE, + cbEncodedOcspResponse: DWORD, +}} +FN!{stdcall PFN_CERT_SERVER_OCSP_RESPONSE_UPDATE_CALLBACK( + pChainContext: PCCERT_CHAIN_CONTEXT, + pServerOcspResponseContext: PCCERT_SERVER_OCSP_RESPONSE_CONTEXT, + pNewCrlContext: PCCRL_CONTEXT, + pPrevCrlContext: PCCRL_CONTEXT, + pvArg: PVOID, + dwWriteOcspFileError: DWORD, +) -> ()} +STRUCT!{struct CERT_SERVER_OCSP_RESPONSE_OPEN_PARA { + cbSize: DWORD, + dwFlags: DWORD, + pcbUsedSize: *mut DWORD, + pwszOcspDirectory: PWSTR, + pfnUpdateCallback: PFN_CERT_SERVER_OCSP_RESPONSE_UPDATE_CALLBACK, + pvUpdateCallbackArg: PVOID, +}} +pub type PCERT_SERVER_OCSP_RESPONSE_OPEN_PARA = *mut CERT_SERVER_OCSP_RESPONSE_OPEN_PARA; +pub const CERT_SERVER_OCSP_RESPONSE_OPEN_PARA_READ_FLAG: DWORD = 0x00000001; +pub const CERT_SERVER_OCSP_RESPONSE_OPEN_PARA_WRITE_FLAG: DWORD = 0x00000002; +extern "system" { + pub fn CertOpenServerOcspResponse( + pChainContext: PCCERT_CHAIN_CONTEXT, + dwFlags: DWORD, + pvReserved: LPVOID, + ) -> HCERT_SERVER_OCSP_RESPONSE; +} +pub const CERT_SERVER_OCSP_RESPONSE_ASYNC_FLAG: DWORD = 0x00000001; +extern "system" { + pub fn CertAddRefServerOcspResponse( + hServerOcspResponse: HCERT_SERVER_OCSP_RESPONSE, + ); + pub fn CertCloseServerOcspResponse( + hServerOcspResponse: HCERT_SERVER_OCSP_RESPONSE, + dwFlags: DWORD, + ); + pub fn CertGetServerOcspResponseContext( + hServerOcspResponse: HCERT_SERVER_OCSP_RESPONSE, + dwFlags: DWORD, + pvReserved: LPVOID, + ) -> PCCERT_SERVER_OCSP_RESPONSE_CONTEXT; + pub fn CertAddRefServerOcspResponseContext( + pServerOcspResponseContext: PCCERT_SERVER_OCSP_RESPONSE_CONTEXT, + ); + pub fn CertFreeServerOcspResponseContext( + pServerOcspResponseContext: PCCERT_SERVER_OCSP_RESPONSE_CONTEXT, + ); + pub fn CertRetrieveLogoOrBiometricInfo( + pCertContext: PCCERT_CONTEXT, + lpszLogoOrBiometricType: LPCSTR, + dwRetrievalFlags: DWORD, + dwTimeout: DWORD, + dwFlags: DWORD, + pvReserved: *mut c_void, + ppbData: *mut *mut BYTE, + pcbData: *mut DWORD, + ppwszMimeType: *mut LPWSTR, + ) -> BOOL; +} +pub const CERT_RETRIEVE_ISSUER_LOGO: LPCSTR = 1 as LPCSTR; +pub const CERT_RETRIEVE_SUBJECT_LOGO: LPCSTR = 2 as LPCSTR; +pub const CERT_RETRIEVE_COMMUNITY_LOGO: LPCSTR = 3 as LPCSTR; +pub const CERT_RETRIEVE_BIOMETRIC_PREDEFINED_BASE_TYPE: LPCSTR = 1000 as LPCSTR; +pub const CERT_RETRIEVE_BIOMETRIC_PICTURE_TYPE: LPCSTR + = (1000 + CERT_BIOMETRIC_PICTURE_TYPE) as LPCSTR; +pub const CERT_RETRIEVE_BIOMETRIC_SIGNATURE_TYPE: LPCSTR + = (1000 + CERT_BIOMETRIC_SIGNATURE_TYPE) as LPCSTR; +STRUCT!{struct CERT_SELECT_CHAIN_PARA { + hChainEngine: HCERTCHAINENGINE, + pTime: PFILETIME, + hAdditionalStore: HCERTSTORE, + pChainPara: PCERT_CHAIN_PARA, + dwFlags: DWORD, +}} +pub type PCERT_SELECT_CHAIN_PARA = *mut CERT_SELECT_CHAIN_PARA; +pub type PCCERT_SELECT_CHAIN_PARA = *const CERT_SELECT_CHAIN_PARA; +pub const CERT_SELECT_MAX_PARA: DWORD = 500; +STRUCT!{struct CERT_SELECT_CRITERIA { + dwType: DWORD, + cPara: DWORD, + ppPara: *mut *mut c_void, +}} +pub type PCERT_SELECT_CRITERIA = *mut CERT_SELECT_CRITERIA; +pub type PCCERT_SELECT_CRITERIA = *const CERT_SELECT_CRITERIA; +pub const CERT_SELECT_BY_ENHKEY_USAGE: DWORD = 1; +pub const CERT_SELECT_BY_KEY_USAGE: DWORD = 2; +pub const CERT_SELECT_BY_POLICY_OID: DWORD = 3; +pub const CERT_SELECT_BY_PROV_NAME: DWORD = 4; +pub const CERT_SELECT_BY_EXTENSION: DWORD = 5; +pub const CERT_SELECT_BY_SUBJECT_HOST_NAME: DWORD = 6; +pub const CERT_SELECT_BY_ISSUER_ATTR: DWORD = 7; +pub const CERT_SELECT_BY_SUBJECT_ATTR: DWORD = 8; +pub const CERT_SELECT_BY_ISSUER_NAME: DWORD = 9; +pub const CERT_SELECT_BY_PUBLIC_KEY: DWORD = 10; +pub const CERT_SELECT_BY_TLS_SIGNATURES: DWORD = 11; +pub const CERT_SELECT_BY_ISSUER_DISPLAYNAME: DWORD = 12; +pub const CERT_SELECT_BY_FRIENDLYNAME: DWORD = 13; +pub const CERT_SELECT_BY_THUMBPRINT: DWORD = 14; +pub const CERT_SELECT_LAST: DWORD = CERT_SELECT_BY_TLS_SIGNATURES; +pub const CERT_SELECT_MAX: DWORD = CERT_SELECT_LAST * 3; +pub const CERT_SELECT_ALLOW_EXPIRED: DWORD = 0x00000001; +pub const CERT_SELECT_TRUSTED_ROOT: DWORD = 0x00000002; +pub const CERT_SELECT_DISALLOW_SELFSIGNED: DWORD = 0x00000004; +pub const CERT_SELECT_HAS_PRIVATE_KEY: DWORD = 0x00000008; +pub const CERT_SELECT_HAS_KEY_FOR_SIGNATURE: DWORD = 0x00000010; +pub const CERT_SELECT_HAS_KEY_FOR_KEY_EXCHANGE: DWORD = 0x00000020; +pub const CERT_SELECT_HARDWARE_ONLY: DWORD = 0x00000040; +pub const CERT_SELECT_ALLOW_DUPLICATES: DWORD = 0x00000080; +pub const CERT_SELECT_IGNORE_AUTOSELECT: DWORD = 0x00000100; +extern "system" { + pub fn CertSelectCertificateChains( + pSelectionContext: LPCGUID, + dwFlags: DWORD, + pChainParameters: PCCERT_SELECT_CHAIN_PARA, + cCriteria: DWORD, + rgpCriteria: PCCERT_SELECT_CRITERIA, + hStore: HCERTSTORE, + pcSelection: PDWORD, + pprgpSelection: *mut *mut PCCERT_CHAIN_CONTEXT, + ) -> BOOL; + pub fn CertFreeCertificateChainList( + prgpSelection: *mut PCCERT_CHAIN_CONTEXT, + ); +} +pub const TIMESTAMP_VERSION: DWORD = 1; +STRUCT!{struct CRYPT_TIMESTAMP_REQUEST { + dwVersion: DWORD, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + HashedMessage: CRYPT_DER_BLOB, + pszTSAPolicyId: LPSTR, + Nonce: CRYPT_INTEGER_BLOB, + fCertReq: BOOL, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRYPT_TIMESTAMP_REQUEST = *mut CRYPT_TIMESTAMP_REQUEST; +STRUCT!{struct CRYPT_TIMESTAMP_RESPONSE { + dwStatus: DWORD, + cFreeText: DWORD, + rgFreeText: *mut LPWSTR, + FailureInfo: CRYPT_BIT_BLOB, + ContentInfo: CRYPT_DER_BLOB, +}} +pub type PCRYPT_TIMESTAMP_RESPONSE = *mut CRYPT_TIMESTAMP_RESPONSE; +pub const TIMESTAMP_STATUS_GRANTED: DWORD = 0; +pub const TIMESTAMP_STATUS_GRANTED_WITH_MODS: DWORD = 1; +pub const TIMESTAMP_STATUS_REJECTED: DWORD = 2; +pub const TIMESTAMP_STATUS_WAITING: DWORD = 3; +pub const TIMESTAMP_STATUS_REVOCATION_WARNING: DWORD = 4; +pub const TIMESTAMP_STATUS_REVOKED: DWORD = 5; +pub const TIMESTAMP_FAILURE_BAD_ALG: DWORD = 0; +pub const TIMESTAMP_FAILURE_BAD_REQUEST: DWORD = 2; +pub const TIMESTAMP_FAILURE_BAD_FORMAT: DWORD = 5; +pub const TIMESTAMP_FAILURE_TIME_NOT_AVAILABLE: DWORD = 14; +pub const TIMESTAMP_FAILURE_POLICY_NOT_SUPPORTED: DWORD = 15; +pub const TIMESTAMP_FAILURE_EXTENSION_NOT_SUPPORTED: DWORD = 16; +pub const TIMESTAMP_FAILURE_INFO_NOT_AVAILABLE: DWORD = 17; +pub const TIMESTAMP_FAILURE_SYSTEM_FAILURE: DWORD = 25; +STRUCT!{struct CRYPT_TIMESTAMP_ACCURACY { + dwSeconds: DWORD, + dwMillis: DWORD, + dwMicros: DWORD, +}} +pub type PCRYPT_TIMESTAMP_ACCURACY = *mut CRYPT_TIMESTAMP_ACCURACY; +STRUCT!{struct CRYPT_TIMESTAMP_INFO { + dwVersion: DWORD, + pszTSAPolicyId: LPSTR, + HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, + HashedMessage: CRYPT_DER_BLOB, + SerialNumber: CRYPT_INTEGER_BLOB, + ftTime: FILETIME, + pvAccuracy: PCRYPT_TIMESTAMP_ACCURACY, + fOrdering: BOOL, + Nonce: CRYPT_DER_BLOB, + Tsa: CRYPT_DER_BLOB, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRYPT_TIMESTAMP_INFO = *mut CRYPT_TIMESTAMP_INFO; +STRUCT!{struct CRYPT_TIMESTAMP_CONTEXT { + cbEncoded: DWORD, + pbEncoded: *mut BYTE, + pTimeStamp: PCRYPT_TIMESTAMP_INFO, +}} +pub type PCRYPT_TIMESTAMP_CONTEXT = *mut CRYPT_TIMESTAMP_CONTEXT; +STRUCT!{struct CRYPT_TIMESTAMP_PARA { + pszTSAPolicyId: LPCSTR, + fRequestCerts: BOOL, + Nonce: CRYPT_INTEGER_BLOB, + cExtension: DWORD, + rgExtension: PCERT_EXTENSION, +}} +pub type PCRYPT_TIMESTAMP_PARA = *mut CRYPT_TIMESTAMP_PARA; +extern "system" { + pub fn CryptRetrieveTimeStamp( + wszUrl: LPCWSTR, + dwRetrievalFlags: DWORD, + dwTimeout: DWORD, + pszHashId: LPCSTR, + pPara: *const CRYPT_TIMESTAMP_PARA, + pbData: *const BYTE, + cbData: DWORD, + ppTsContext: *mut PCRYPT_TIMESTAMP_CONTEXT, + ppTsSigner: *mut PCCERT_CONTEXT, + phStore: *mut HCERTSTORE, + ) -> BOOL; +} +pub const TIMESTAMP_DONT_HASH_DATA: DWORD = 0x00000001; +pub const TIMESTAMP_VERIFY_CONTEXT_SIGNATURE: DWORD = 0x00000020; +pub const TIMESTAMP_NO_AUTH_RETRIEVAL: DWORD = 0x00020000; +extern "system" { + pub fn CryptVerifyTimeStampSignature( + pbTSContentInfo: *const BYTE, + cbTSContentInfo: DWORD, + pbData: *const BYTE, + cbData: DWORD, + hAdditionalStore: HCERTSTORE, + ppTsContext: *mut PCRYPT_TIMESTAMP_CONTEXT, + ppTsSigner: *mut PCCERT_CONTEXT, + phStore: *mut HCERTSTORE, + ) -> BOOL; +} +pub const CRYPT_OBJECT_LOCATOR_SPN_NAME_TYPE: DWORD = 1; +pub const CRYPT_OBJECT_LOCATOR_LAST_RESERVED_NAME_TYPE: DWORD = 32; +pub const CRYPT_OBJECT_LOCATOR_FIRST_RESERVED_USER_NAME_TYPE: DWORD = 33; +pub const CRYPT_OBJECT_LOCATOR_LAST_RESERVED_USER_NAME_TYPE: DWORD = 0x0000FFFF; +pub const SSL_OBJECT_LOCATOR_PFX_FUNC: &'static str = "SslObjectLocatorInitializePfx"; +pub const SSL_OBJECT_LOCATOR_ISSUER_LIST_FUNC: &'static str + = "SslObjectLocatorInitializeIssuerList"; +pub const SSL_OBJECT_LOCATOR_CERT_VALIDATION_CONFIG_FUNC: &'static str + = "SslObjectLocatorInitializeCertValidationConfig"; +pub const CRYPT_OBJECT_LOCATOR_RELEASE_SYSTEM_SHUTDOWN: DWORD = 1; +pub const CRYPT_OBJECT_LOCATOR_RELEASE_SERVICE_STOP: DWORD = 2; +pub const CRYPT_OBJECT_LOCATOR_RELEASE_PROCESS_EXIT: DWORD = 3; +pub const CRYPT_OBJECT_LOCATOR_RELEASE_DLL_UNLOAD: DWORD = 4; +FN!{stdcall PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FLUSH( + pContext: LPVOID, + rgIdentifierOrNameList: *mut PCERT_NAME_BLOB, + dwIdentifierOrNameListCount: DWORD, +) -> BOOL} +FN!{stdcall PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_GET( + pPluginContext: LPVOID, + pIdentifier: PCRYPT_DATA_BLOB, + dwNameType: DWORD, + pNameBlob: PCERT_NAME_BLOB, + ppbContent: *mut PBYTE, + pcbContent: *mut DWORD, + ppwszPassword: *mut PCWSTR, + ppIdentifier: *mut PCRYPT_DATA_BLOB, +) -> BOOL} +FN!{stdcall PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_RELEASE( + dwReason: DWORD, + pPluginContext: LPVOID, +) -> ()} +FN!{stdcall PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_PASSWORD( + pPluginContext: LPVOID, + pwszPassword: PCWSTR, +) -> ()} +FN!{stdcall PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE( + pPluginContext: LPVOID, + pbData: PBYTE, +) -> ()} +FN!{stdcall PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_IDENTIFIER( + pPluginContext: LPVOID, + pIdentifier: PCRYPT_DATA_BLOB, +) -> ()} +STRUCT!{struct CRYPT_OBJECT_LOCATOR_PROVIDER_TABLE { + cbSize: DWORD, + pfnGet: PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_GET, + pfnRelease: PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_RELEASE, + pfnFreePassword: PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_PASSWORD, + pfnFree: PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE, + pfnFreeIdentifier: PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_IDENTIFIER, +}} +pub type PCRYPT_OBJECT_LOCATOR_PROVIDER_TABLE = *mut CRYPT_OBJECT_LOCATOR_PROVIDER_TABLE; +FN!{stdcall PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_INITIALIZE( + pfnFlush: PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FLUSH, + pContext: LPVOID, + pdwExpectedObjectCount: *mut DWORD, + ppFuncTable: *mut PCRYPT_OBJECT_LOCATOR_PROVIDER_TABLE, + ppPluginContext: *mut *mut c_void, +) -> BOOL} +extern "system" { + pub fn CertIsWeakHash( + dwHashUseType: DWORD, + pwszCNGHashAlgid: LPCWSTR, + dwChainFlags: DWORD, + pSignerChainContext: PCCERT_CHAIN_CONTEXT, + pTimeStamp: LPFILETIME, + pwszFileName: LPCWSTR, + ) -> BOOL; +} +FN!{stdcall PFN_CERT_IS_WEAK_HASH( + dwHashUseType: DWORD, + pwszCNGHashAlgid: LPCWSTR, + dwChainFlags: DWORD, + pSignerChainContext: PCCERT_CHAIN_CONTEXT, + pTimeStamp: LPFILETIME, + pwszFileName: LPCWSTR, +) -> BOOL} +pub const CERT_FILE_HASH_USE_TYPE: DWORD = 1; +pub const CERT_TIMESTAMP_HASH_USE_TYPE: DWORD = 2; diff --git a/src/vendor/winapi/src/um/windowsceip.rs b/src/vendor/winapi/src/um/windowsceip.rs new file mode 100644 index 0000000000..2319d5369b --- /dev/null +++ b/src/vendor/winapi/src/um/windowsceip.rs @@ -0,0 +1,10 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::BOOL; +extern "system" { + pub fn CeipIsOptedIn() -> BOOL; +} diff --git a/src/vendor/winapi/src/um/winevt.rs b/src/vendor/winapi/src/um/winevt.rs new file mode 100644 index 0000000000..5fe8e73e65 --- /dev/null +++ b/src/vendor/winapi/src/um/winevt.rs @@ -0,0 +1,544 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Windows Events API +use ctypes::{c_double, c_float}; +use shared::basetsd::{INT16, INT32, INT64, INT8, UINT16, UINT32, UINT64, UINT8}; +use shared::guiddef::GUID; +use shared::minwindef::{BOOL, DWORD, FILETIME, PBYTE, PDWORD}; +use um::minwinbase::SYSTEMTIME; +use um::winnt::{HANDLE, LCID, LONGLONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PSID, PVOID, ULONGLONG}; +use vc::vcruntime::size_t; +pub type EVT_HANDLE = HANDLE; +pub type PEVT_HANDLE = *mut HANDLE; +ENUM!{enum EVT_VARIANT_TYPE { + EvtVarTypeNull = 0, + EvtVarTypeString = 1, + EvtVarTypeAnsiString = 2, + EvtVarTypeSByte = 3, + EvtVarTypeByte = 4, + EvtVarTypeInt16 = 5, + EvtVarTypeUInt16 = 6, + EvtVarTypeInt32 = 7, + EvtVarTypeUInt32 = 8, + EvtVarTypeInt64 = 9, + EvtVarTypeUInt64 = 10, + EvtVarTypeSingle = 11, + EvtVarTypeDouble = 12, + EvtVarTypeBoolean = 13, + EvtVarTypeBinary = 14, + EvtVarTypeGuid = 15, + EvtVarTypeSizeT = 16, + EvtVarTypeFileTime = 17, + EvtVarTypeSysTime = 18, + EvtVarTypeSid = 19, + EvtVarTypeHexInt32 = 20, + EvtVarTypeHexInt64 = 21, + EvtVarTypeEvtHandle = 32, + EvtVarTypeEvtXml = 35, +}} +pub const EVT_VARIANT_TYPE_MASK: DWORD = 0x7f; +pub const EVT_VARIANT_TYPE_ARRAY: DWORD = 128; +UNION!{union EVT_VARIANT_u { + [u64; 1], + BooleanVal BooleanVal_mut: BOOL, + SByteVal SByteVal_mut: INT8, + Int16Val Int16Val_mut: INT16, + Int32Val Int32Val_mut: INT32, + Int64Val Int64Val_mut: INT64, + ByteVal ByteVal_mut: UINT8, + UInt16Val UInt16Val_mut: UINT16, + UInt32Val UInt32Val_mut: UINT32, + UInt64Val UInt64Val_mut: UINT64, + SingleVal SingleVal_mut: c_float, + DoubleVal DoubleVal_mut: c_double, + FileTimeVal FileTimeVal_mut: ULONGLONG, + SysTimeVal SysTimeVal_mut: *mut SYSTEMTIME, + GuidVal GuidVal_mut: *mut GUID, + StringVal StringVal_mut: LPCWSTR, + AnsiStringVal AnsiStringVal_mut: LPCSTR, + BinaryVal BinaryVal_mut: PBYTE, + SidVal SidVal_mut: PSID, + SizeTVal SizeTVal_mut: size_t, + BooleanArr BooleanArr_mut: *mut BOOL, + SByteArr SByteArr_mut: *mut INT8, + Int16Arr Int16Arr_mut: *mut INT16, + Int32Arr Int32Arr_mut: *mut INT32, + Int64Arr Int64Arr_mut: *mut INT64, + ByteArr ByteArr_mut: *mut UINT8, + UInt16Arr UInt16Arr_mut: *mut UINT16, + UInt32Arr UInt32Arr_mut: *mut UINT32, + UInt64Arr UInt64Arr_mut: *mut UINT64, + SingleArr SingleArr_mut: *mut c_float, + DoubleArr DoubleArr_mut: *mut c_double, + FileTimeArr FileTimeArr_mut: *mut FILETIME, + SysTimeArr SysTimeArr_mut: *mut SYSTEMTIME, + GuidArr GuidArr_mut: *mut GUID, + StringArr StringArr_mut: *mut LPWSTR, + AnsiStringArr AnsiStringArr_mut: *mut LPSTR, + SidArr SidArr_mut: *mut PSID, + SizeTArr SizeTArr_mut: *mut size_t, + EvtHandleVal EvtHandleVal_mut: EVT_HANDLE, + XmlVal XmlVal_mut: LPCWSTR, + XmlValArr XmlValArr_mut: *mut LPCWSTR, +}} +STRUCT!{struct EVT_VARIANT { + u: EVT_VARIANT_u, + Count: DWORD, + Type: DWORD, +}} +pub type PEVT_VARIANT = *mut EVT_VARIANT; +ENUM!{enum EVT_LOGIN_CLASS { + EvtRpcLogin = 1, +}} +ENUM!{enum EVT_RPC_LOGIN_FLAGS { + EvtRpcLoginAuthDefault = 0, + EvtRpcLoginAuthNegotiate, + EvtRpcLoginAuthKerberos, + EvtRpcLoginAuthNTLM, +}} +STRUCT!{struct EVT_RPC_LOGIN { + Server: LPWSTR, + User: LPWSTR, + Domain: LPWSTR, + Password: LPWSTR, + Flags: DWORD, +}} +extern "system" { + pub fn EvtOpenSession( + LoginClass: EVT_LOGIN_CLASS, + Login: PVOID, + Timeout: DWORD, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtClose( + Object: EVT_HANDLE, + ) -> BOOL; + pub fn EvtCancel( + Object: EVT_HANDLE, + ) -> BOOL; + pub fn EvtGetExtendedStatus( + BufferSize: DWORD, + Buffer: LPWSTR, + BufferUsed: PDWORD, + ) -> DWORD; +} +ENUM!{enum EVT_QUERY_FLAGS { + EvtQueryChannelPath = 0x1, + EvtQueryFilePath = 0x2, + EvtQueryForwardDirection = 0x100, + EvtQueryReverseDirection = 0x200, + EvtQueryTolerateQueryErrors = 0x1000, +}} +ENUM!{enum EVT_SEEK_FLAGS { + EvtSeekRelativeToFirst = 1, + EvtSeekRelativeToLast = 2, + EvtSeekRelativeToCurrent = 3, + EvtSeekRelativeToBookmark = 4, + EvtSeekOriginMask = 7, + EvtSeekStrict = 0x10000, +}} +extern "system" { + pub fn EvtQuery( + Session: EVT_HANDLE, + Path: LPCWSTR, + Query: LPCWSTR, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtNext( + ResultSet: EVT_HANDLE, + EventsSize: DWORD, + Events: PEVT_HANDLE, + Timeout: DWORD, + Flags: DWORD, + Returned: PDWORD, + ) -> BOOL; + pub fn EvtSeek( + ResultSet: EVT_HANDLE, + Position: LONGLONG, + Bookmark: EVT_HANDLE, + Timeout: DWORD, + Flags: DWORD, + ) -> BOOL; +} +ENUM!{enum EVT_SUBSCRIBE_FLAGS { + EvtSubscribeToFutureEvents = 1, + EvtSubscribeStartAtOldestRecord = 2, + EvtSubscribeStartAfterBookmark = 3, + EvtSubscribeOriginMask = 3, + EvtSubscribeTolerateQueryErrors = 0x1000, + EvtSubscribeStrict = 0x10000, +}} +ENUM!{enum EVT_SUBSCRIBE_NOTIFY_ACTION { + EvtSubscribeActionError = 0, + EvtSubscribeActionDeliver, +}} +FN!{stdcall EVT_SUBSCRIBE_CALLBACK( + Action: EVT_SUBSCRIBE_NOTIFY_ACTION, + UserContext: PVOID, + Event: EVT_HANDLE, +) -> DWORD} +extern "system" { + pub fn EvtSubscribe( + Session: EVT_HANDLE, + SignalEvent: HANDLE, + ChannelPath: LPCWSTR, + Query: LPCWSTR, + Bookmark: EVT_HANDLE, + Context: PVOID, + Callback: EVT_SUBSCRIBE_CALLBACK, + Flags: DWORD, + ) -> EVT_HANDLE; +} +ENUM!{enum EVT_SYSTEM_PROPERTY_ID { + EvtSystemProviderName = 0, + EvtSystemProviderGuid, + EvtSystemEventID, + EvtSystemQualifiers, + EvtSystemLevel, + EvtSystemTask, + EvtSystemOpcode, + EvtSystemKeywords, + EvtSystemTimeCreated, + EvtSystemEventRecordId, + EvtSystemActivityID, + EvtSystemRelatedActivityID, + EvtSystemProcessID, + EvtSystemThreadID, + EvtSystemChannel, + EvtSystemComputer, + EvtSystemUserID, + EvtSystemVersion, + EvtSystemPropertyIdEND, +}} +ENUM!{enum EVT_RENDER_CONTEXT_FLAGS { + EvtRenderContextValues = 0, + EvtRenderContextSystem, + EvtRenderContextUser, +}} +ENUM!{enum EVT_RENDER_FLAGS { + EvtRenderEventValues = 0, + EvtRenderEventXml, + EvtRenderBookmark, +}} +extern "system" { + pub fn EvtCreateRenderContext( + ValuePathsCount: DWORD, + ValuePaths: *mut LPCWSTR, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtRender( + Context: EVT_HANDLE, + Fragment: EVT_HANDLE, + Flags: DWORD, + BufferSize: DWORD, + Buffer: PVOID, + BufferUsed: PDWORD, + PropertyCount: PDWORD, + ) -> BOOL; +} +ENUM!{enum EVT_FORMAT_MESSAGE_FLAGS { + EvtFormatMessageEvent = 1, + EvtFormatMessageLevel, + EvtFormatMessageTask, + EvtFormatMessageOpcode, + EvtFormatMessageKeyword, + EvtFormatMessageChannel, + EvtFormatMessageProvider, + EvtFormatMessageId, + EvtFormatMessageXml, +}} +extern "system" { + pub fn EvtFormatMessage( + PublisherMetadata: EVT_HANDLE, + Event: EVT_HANDLE, + MessageId: DWORD, + ValueCount: DWORD, + Values: PEVT_VARIANT, + Flags: DWORD, + BufferSize: DWORD, + Buffer: LPWSTR, + BufferUsed: PDWORD, + ) -> BOOL; +} +ENUM!{enum EVT_OPEN_LOG_FLAGS { + EvtOpenChannelPath = 0x1, + EvtOpenFilePath = 0x2, +}} +ENUM!{enum EVT_LOG_PROPERTY_ID { + EvtLogCreationTime = 0, + EvtLogLastAccessTime, + EvtLogLastWriteTime, + EvtLogFileSize, + EvtLogAttributes, + EvtLogNumberOfLogRecords, + EvtLogOldestRecordNumber, + EvtLogFull, +}} +extern "system" { + pub fn EvtOpenLog( + Session: EVT_HANDLE, + Path: LPCWSTR, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtGetLogInfo( + Log: EVT_HANDLE, + PropertyId: EVT_LOG_PROPERTY_ID, + PropertyValueBufferSize: DWORD, + PropertyValueBuffer: PEVT_VARIANT, + PropertyValueBufferUsed: PDWORD, + ) -> BOOL; + pub fn EvtClearLog( + Session: EVT_HANDLE, + ChannelPath: LPCWSTR, + TargetFilePath: LPCWSTR, + Flags: DWORD, + ) -> BOOL; +} +ENUM!{enum EVT_EXPORTLOG_FLAGS { + EvtExportLogChannelPath = 0x1, + EvtExportLogFilePath = 0x2, + EvtExportLogTolerateQueryErrors = 0x1000, + EvtExportLogOverwrite = 0x2000, +}} +extern "system" { + pub fn EvtExportLog( + Session: EVT_HANDLE, + Path: LPCWSTR, + Query: LPCWSTR, + TargetFilePath: LPCWSTR, + Flags: DWORD, + ) -> BOOL; + pub fn EvtArchiveExportedLog( + Session: EVT_HANDLE, + LogFilePath: LPCWSTR, + Locale: LCID, + Flags: DWORD, + ) -> BOOL; +} +ENUM!{enum EVT_CHANNEL_CONFIG_PROPERTY_ID { + EvtChannelConfigEnabled = 0, + EvtChannelConfigIsolation, + EvtChannelConfigType, + EvtChannelConfigOwningPublisher, + EvtChannelConfigClassicEventlog, + EvtChannelConfigAccess, + EvtChannelLoggingConfigRetention, + EvtChannelLoggingConfigAutoBackup, + EvtChannelLoggingConfigMaxSize, + EvtChannelLoggingConfigLogFilePath, + EvtChannelPublishingConfigLevel, + EvtChannelPublishingConfigKeywords, + EvtChannelPublishingConfigControlGuid, + EvtChannelPublishingConfigBufferSize, + EvtChannelPublishingConfigMinBuffers, + EvtChannelPublishingConfigMaxBuffers, + EvtChannelPublishingConfigLatency, + EvtChannelPublishingConfigClockType, + EvtChannelPublishingConfigSidType, + EvtChannelPublisherList, + EvtChannelPublishingConfigFileMax, + EvtChannelConfigPropertyIdEND, +}} +ENUM!{enum EVT_CHANNEL_TYPE { + EvtChannelTypeAdmin = 0, + EvtChannelTypeOperational, + EvtChannelTypeAnalytic, + EvtChannelTypeDebug, +}} +ENUM!{enum EVT_CHANNEL_ISOLATION_TYPE { + EvtChannelIsolationTypeApplication = 0, + EvtChannelIsolationTypeSystem, + EvtChannelIsolationTypeCustom, +}} +ENUM!{enum EVT_CHANNEL_CLOCK_TYPE { + EvtChannelClockTypeSystemTime = 0, + EvtChannelClockTypeQPC, +}} +ENUM!{enum EVT_CHANNEL_SID_TYPE { + EvtChannelSidTypeNone = 0, + EvtChannelSidTypePublishing, +}} +extern "system" { + pub fn EvtOpenChannelEnum( + Session: EVT_HANDLE, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtNextChannelPath( + ChannelEnum: EVT_HANDLE, + ChannelPathBufferSize: DWORD, + ChannelPathBuffer: LPWSTR, + ChannelPathBufferUsed: PDWORD, + ) -> BOOL; + pub fn EvtOpenChannelConfig( + Session: EVT_HANDLE, + ChannelPath: LPCWSTR, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtSaveChannelConfig( + ChannelConfig: EVT_HANDLE, + Flags: DWORD, + ) -> BOOL; + pub fn EvtSetChannelConfigProperty( + ChannelConfig: EVT_HANDLE, + PropertyId: EVT_CHANNEL_CONFIG_PROPERTY_ID, + Flags: DWORD, + PropertyValue: PEVT_VARIANT, + ) -> BOOL; + pub fn EvtGetChannelConfigProperty( + ChannelConfig: EVT_HANDLE, + PropertyId: EVT_CHANNEL_CONFIG_PROPERTY_ID, + Flags: DWORD, + PropertyValueBufferSize: DWORD, + PropertyValueBuffer: PEVT_VARIANT, + PropertyValueBufferUsed: PDWORD, + ) -> BOOL; +} +ENUM!{enum EVT_CHANNEL_REFERENCE_FLAGS { + EvtChannelReferenceImported = 0x1, +}} +ENUM!{enum EVT_PUBLISHER_METADATA_PROPERTY_ID { + EvtPublisherMetadataPublisherGuid = 0, + EvtPublisherMetadataResourceFilePath, + EvtPublisherMetadataParameterFilePath, + EvtPublisherMetadataMessageFilePath, + EvtPublisherMetadataHelpLink, + EvtPublisherMetadataPublisherMessageID, + EvtPublisherMetadataChannelReferences, + EvtPublisherMetadataChannelReferencePath, + EvtPublisherMetadataChannelReferenceIndex, + EvtPublisherMetadataChannelReferenceID, + EvtPublisherMetadataChannelReferenceFlags, + EvtPublisherMetadataChannelReferenceMessageID, + EvtPublisherMetadataLevels, + EvtPublisherMetadataLevelName, + EvtPublisherMetadataLevelValue, + EvtPublisherMetadataLevelMessageID, + EvtPublisherMetadataTasks, + EvtPublisherMetadataTaskName, + EvtPublisherMetadataTaskEventGuid, + EvtPublisherMetadataTaskValue, + EvtPublisherMetadataTaskMessageID, + EvtPublisherMetadataOpcodes, + EvtPublisherMetadataOpcodeName, + EvtPublisherMetadataOpcodeValue, + EvtPublisherMetadataOpcodeMessageID, + EvtPublisherMetadataKeywords, + EvtPublisherMetadataKeywordName, + EvtPublisherMetadataKeywordValue, + EvtPublisherMetadataKeywordMessageID, + EvtPublisherMetadataPropertyIdEND, +}} +extern "system" { + pub fn EvtOpenPublisherEnum( + Session: EVT_HANDLE, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtNextPublisherId( + PublisherEnum: EVT_HANDLE, + PublisherIdBufferSize: DWORD, + PublisherIdBuffer: LPWSTR, + PublisherIdBufferUsed: PDWORD, + ) -> BOOL; + pub fn EvtOpenPublisherMetadata( + Session: EVT_HANDLE, + PublisherId: LPCWSTR, + LogFilePath: LPCWSTR, + Locale: LCID, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtGetPublisherMetadataProperty( + PublisherMetadata: EVT_HANDLE, + PropertyId: EVT_PUBLISHER_METADATA_PROPERTY_ID, + Flags: DWORD, + PublisherMetadataPropertyBufferSize: DWORD, + PublisherMetadataPropertyBuffer: PEVT_VARIANT, + PublisherMetadataPropertyBufferUsed: PDWORD, + ) -> BOOL; +} +ENUM!{enum EVT_EVENT_METADATA_PROPERTY_ID { + EventMetadataEventID, + EventMetadataEventVersion, + EventMetadataEventChannel, + EventMetadataEventLevel, + EventMetadataEventOpcode, + EventMetadataEventTask, + EventMetadataEventKeyword, + EventMetadataEventMessageID, + EventMetadataEventTemplate, + EvtEventMetadataPropertyIdEND, +}} +extern "system" { + pub fn EvtOpenEventMetadataEnum( + PublisherMetadata: EVT_HANDLE, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtNextEventMetadata( + EventMetadataEnum: EVT_HANDLE, + Flags: DWORD, + ) -> EVT_HANDLE; + pub fn EvtGetEventMetadataProperty( + EventMetadata: EVT_HANDLE, + PropertyId: EVT_EVENT_METADATA_PROPERTY_ID, + Flags: DWORD, + EventMetadataPropertyBufferSize: DWORD, + EventMetadataPropertyBuffer: PEVT_VARIANT, + EventMetadataPropertyBufferUsed: PDWORD, + ) -> BOOL; +} +pub type EVT_OBJECT_ARRAY_PROPERTY_HANDLE = HANDLE; +extern "system" { + pub fn EvtGetObjectArraySize( + ObjectArray: EVT_OBJECT_ARRAY_PROPERTY_HANDLE, + ObjectArraySize: PDWORD, + ) -> BOOL; + pub fn EvtGetObjectArrayProperty( + ObjectArray: EVT_OBJECT_ARRAY_PROPERTY_HANDLE, + PropertyId: DWORD, + ArrayIndex: DWORD, + Flags: DWORD, + PropertyValueBufferSize: DWORD, + PropertyValueBuffer: PEVT_VARIANT, + PropertyValueBufferUsed: PDWORD, + ) -> BOOL; +} +ENUM!{enum EVT_QUERY_PROPERTY_ID { + EvtQueryNames, + EvtQueryStatuses, + EvtQueryPropertyIdEND, +}} +ENUM!{enum EVT_EVENT_PROPERTY_ID { + EvtEventQueryIDs = 0, + EvtEventPath, + EvtEventPropertyIdEND, +}} +extern "system" { + pub fn EvtGetQueryInfo( + QueryOrSubscription: EVT_HANDLE, + PropertyId: EVT_QUERY_PROPERTY_ID, + PropertyValueBufferSize: DWORD, + PropertyValueBuffer: PEVT_VARIANT, + PropertyValueBufferUsed: PDWORD, + ) -> BOOL; + pub fn EvtCreateBookmark( + BookmarkXml: LPCWSTR, + ) -> EVT_HANDLE; + pub fn EvtUpdateBookmark( + Bookmark: EVT_HANDLE, + Event: EVT_HANDLE, + ) -> BOOL; + pub fn EvtGetEventInfo( + Event: EVT_HANDLE, + PropertyId: EVT_EVENT_PROPERTY_ID, + PropertyValueBufferSize: DWORD, + PropertyValueBuffer: PEVT_VARIANT, + PropertyValueBufferUsed: PDWORD, + ) -> BOOL; +} +pub const EVT_READ_ACCESS: DWORD = 0x1; +pub const EVT_WRITE_ACCESS: DWORD = 0x2; +pub const EVT_CLEAR_ACCESS: DWORD = 0x4; +pub const EVT_ALL_ACCESS: DWORD = 0x7; diff --git a/src/vendor/winapi/src/um/wingdi.rs b/src/vendor/winapi/src/um/wingdi.rs new file mode 100644 index 0000000000..162c118907 --- /dev/null +++ b/src/vendor/winapi/src/um/wingdi.rs @@ -0,0 +1,5585 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! GDI procedure declarations, constant definitions and macros +use ctypes::{c_char, c_int, c_long, c_short, c_ushort, c_void}; +use shared::basetsd::{UINT16, UINT32, UINT64, ULONG_PTR}; +use shared::minwindef::{ + BOOL, BYTE, DWORD, FLOAT, HGLOBAL, HMETAFILE, HMODULE, HRGN, INT, LOBYTE, LPARAM, LPBYTE, + LPDWORD, LPINT, LPVOID, LPWORD, MAX_PATH, PFLOAT, PROC, UINT, ULONG, USHORT, WORD, +}; +use shared::windef::{ + COLORREF, HBITMAP, HBRUSH, HCOLORSPACE, HDC, HENHMETAFILE, HFONT, HGDIOBJ, HGLRC, HPALETTE, + HPEN, HWND, LPPOINT, LPRECT, LPSIZE, POINT, POINTL, POINTS, RECT, RECTL, SIZEL, +}; +use um::winnt::{ + CHAR, HANDLE, LONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, LUID, PSTR, PVOID, SHORT, VOID, WCHAR, +}; +pub const R2_BLACK: c_int = 1; +pub const R2_NOTMERGEPEN: c_int = 2; +pub const R2_MASKNOTPEN: c_int = 3; +pub const R2_NOTCOPYPEN: c_int = 4; +pub const R2_MASKPENNOT: c_int = 5; +pub const R2_NOT: c_int = 6; +pub const R2_XORPEN: c_int = 7; +pub const R2_NOTMASKPEN: c_int = 8; +pub const R2_MASKPEN: c_int = 9; +pub const R2_NOTXORPEN: c_int = 10; +pub const R2_NOP: c_int = 11; +pub const R2_MERGENOTPEN: c_int = 12; +pub const R2_COPYPEN: c_int = 13; +pub const R2_MERGEPENNOT: c_int = 14; +pub const R2_MERGEPEN: c_int = 15; +pub const R2_WHITE: c_int = 16; +pub const R2_LAST: c_int = 16; +pub const SRCCOPY: DWORD = 0x00CC0020; +pub const SRCPAINT: DWORD = 0x00EE0086; +pub const SRCAND: DWORD = 0x008800C6; +pub const SRCINVERT: DWORD = 0x00660046; +pub const SRCERASE: DWORD = 0x00440328; +pub const NOTSRCCOPY: DWORD = 0x00330008; +pub const NOTSRCERASE: DWORD = 0x001100A6; +pub const MERGECOPY: DWORD = 0x00C000CA; +pub const MERGEPAINT: DWORD = 0x00BB0226; +pub const PATCOPY: DWORD = 0x00F00021; +pub const PATPAINT: DWORD = 0x00FB0A09; +pub const PATINVERT: DWORD = 0x005A0049; +pub const DSTINVERT: DWORD = 0x00550009; +pub const BLACKNESS: DWORD = 0x00000042; +pub const WHITENESS: DWORD = 0x00FF0062; +pub const NOMIRRORBITMAP: DWORD = 0x80000000; +pub const CAPTUREBLT: DWORD = 0x40000000; +#[inline] +pub fn MAKEROP4(fore: DWORD, back: DWORD) -> DWORD { + ((back << 8) & 0xFF000000) | fore +} +pub const GDI_ERROR: ULONG = 0xFFFFFFFF; +pub const HGDI_ERROR: HANDLE = -1isize as HANDLE; +pub const ERROR: c_int = 0; +pub const NULLREGION: c_int = 1; +pub const SIMPLEREGION: c_int = 2; +pub const COMPLEXREGION: c_int = 3; +pub const RGN_ERROR: c_int = ERROR; +pub const RGN_AND: c_int = 1; +pub const RGN_OR: c_int = 2; +pub const RGN_XOR: c_int = 3; +pub const RGN_DIFF: c_int = 4; +pub const RGN_COPY: c_int = 5; +pub const RGN_MIN: c_int = RGN_AND; +pub const RGN_MAX: c_int = RGN_COPY; +pub const BLACKONWHITE: c_int = 1; +pub const WHITEONBLACK: c_int = 2; +pub const COLORONCOLOR: c_int = 3; +pub const HALFTONE: c_int = 4; +pub const MAXSTRETCHBLTMODE: c_int = 4; +pub const STRETCH_ANDSCANS: c_int = BLACKONWHITE; +pub const STRETCH_ORSCANS: c_int = WHITEONBLACK; +pub const STRETCH_DELETESCANS: c_int = COLORONCOLOR; +pub const STRETCH_HALFTONE: c_int = HALFTONE; +pub const ALTERNATE: c_int = 1; +pub const WINDING: c_int = 2; +pub const POLYFILL_LAST: c_int = 2; +pub const LAYOUT_RTL: DWORD = 0x00000001; +pub const LAYOUT_BTT: DWORD = 0x00000002; +pub const LAYOUT_VBH: DWORD = 0x00000004; +pub const LAYOUT_ORIENTATIONMASK: DWORD = (LAYOUT_RTL | LAYOUT_BTT | LAYOUT_VBH); +pub const LAYOUT_BITMAPORIENTATIONPRESERVED: DWORD = 0x00000008; +pub const TA_NOUPDATECP: UINT = 0; +pub const TA_UPDATECP: UINT = 1; +pub const TA_LEFT: UINT = 0; +pub const TA_RIGHT: UINT = 2; +pub const TA_CENTER: UINT = 6; +pub const TA_TOP: UINT = 0; +pub const TA_BOTTOM: UINT = 8; +pub const TA_BASELINE: UINT = 24; +pub const TA_RTLREADING: UINT = 256; +pub const TA_MASK: UINT = TA_BASELINE + TA_CENTER + TA_UPDATECP + TA_RTLREADING; +pub const VTA_BASELINE: UINT = TA_BASELINE; +pub const VTA_LEFT: UINT = TA_BOTTOM; +pub const VTA_RIGHT: UINT = TA_TOP; +pub const VTA_CENTER: UINT = TA_CENTER; +pub const VTA_BOTTOM: UINT = TA_RIGHT; +pub const VTA_TOP: UINT = TA_LEFT; +pub const ETO_OPAQUE: UINT = 0x0002; +pub const ETO_CLIPPED: UINT = 0x0004; +pub const ETO_GLYPH_INDEX: UINT = 0x0010; +pub const ETO_RTLREADING: UINT = 0x0080; +pub const ETO_NUMERICSLOCAL: UINT = 0x0400; +pub const ETO_NUMERICSLATIN: UINT = 0x0800; +pub const ETO_IGNORELANGUAGE: UINT = 0x1000; +pub const ETO_PDY: UINT = 0x2000; +pub const ETO_REVERSE_INDEX_MAP: UINT = 0x10000; +pub const ASPECT_FILTERING: UINT = 0x0001; +pub const DCB_RESET: UINT = 0x0001; +pub const DCB_ACCUMULATE: UINT = 0x0002; +pub const DCB_DIRTY: UINT = DCB_ACCUMULATE; +pub const DCB_SET: UINT = (DCB_RESET | DCB_ACCUMULATE); +pub const DCB_ENABLE: UINT = 0x0004; +pub const DCB_DISABLE: UINT = 0x0008; +pub const META_SETBKCOLOR: WORD = 0x0201; +pub const META_SETBKMODE: WORD = 0x0102; +pub const META_SETMAPMODE: WORD = 0x0103; +pub const META_SETROP2: WORD = 0x0104; +pub const META_SETRELABS: WORD = 0x0105; +pub const META_SETPOLYFILLMODE: WORD = 0x0106; +pub const META_SETSTRETCHBLTMODE: WORD = 0x0107; +pub const META_SETTEXTCHAREXTRA: WORD = 0x0108; +pub const META_SETTEXTCOLOR: WORD = 0x0209; +pub const META_SETTEXTJUSTIFICATION: WORD = 0x020A; +pub const META_SETWINDOWORG: WORD = 0x020B; +pub const META_SETWINDOWEXT: WORD = 0x020C; +pub const META_SETVIEWPORTORG: WORD = 0x020D; +pub const META_SETVIEWPORTEXT: WORD = 0x020E; +pub const META_OFFSETWINDOWORG: WORD = 0x020F; +pub const META_SCALEWINDOWEXT: WORD = 0x0410; +pub const META_OFFSETVIEWPORTORG: WORD = 0x0211; +pub const META_SCALEVIEWPORTEXT: WORD = 0x0412; +pub const META_LINETO: WORD = 0x0213; +pub const META_MOVETO: WORD = 0x0214; +pub const META_EXCLUDECLIPRECT: WORD = 0x0415; +pub const META_INTERSECTCLIPRECT: WORD = 0x0416; +pub const META_ARC: WORD = 0x0817; +pub const META_ELLIPSE: WORD = 0x0418; +pub const META_FLOODFILL: WORD = 0x0419; +pub const META_PIE: WORD = 0x081A; +pub const META_RECTANGLE: WORD = 0x041B; +pub const META_ROUNDRECT: WORD = 0x061C; +pub const META_PATBLT: WORD = 0x061D; +pub const META_SAVEDC: WORD = 0x001E; +pub const META_SETPIXEL: WORD = 0x041F; +pub const META_OFFSETCLIPRGN: WORD = 0x0220; +pub const META_TEXTOUT: WORD = 0x0521; +pub const META_BITBLT: WORD = 0x0922; +pub const META_STRETCHBLT: WORD = 0x0B23; +pub const META_POLYGON: WORD = 0x0324; +pub const META_POLYLINE: WORD = 0x0325; +pub const META_ESCAPE: WORD = 0x0626; +pub const META_RESTOREDC: WORD = 0x0127; +pub const META_FILLREGION: WORD = 0x0228; +pub const META_FRAMEREGION: WORD = 0x0429; +pub const META_INVERTREGION: WORD = 0x012A; +pub const META_PAINTREGION: WORD = 0x012B; +pub const META_SELECTCLIPREGION: WORD = 0x012C; +pub const META_SELECTOBJECT: WORD = 0x012D; +pub const META_SETTEXTALIGN: WORD = 0x012E; +pub const META_CHORD: WORD = 0x0830; +pub const META_SETMAPPERFLAGS: WORD = 0x0231; +pub const META_EXTTEXTOUT: WORD = 0x0a32; +pub const META_SETDIBTODEV: WORD = 0x0d33; +pub const META_SELECTPALETTE: WORD = 0x0234; +pub const META_REALIZEPALETTE: WORD = 0x0035; +pub const META_ANIMATEPALETTE: WORD = 0x0436; +pub const META_SETPALENTRIES: WORD = 0x0037; +pub const META_POLYPOLYGON: WORD = 0x0538; +pub const META_RESIZEPALETTE: WORD = 0x0139; +pub const META_DIBBITBLT: WORD = 0x0940; +pub const META_DIBSTRETCHBLT: WORD = 0x0b41; +pub const META_DIBCREATEPATTERNBRUSH: WORD = 0x0142; +pub const META_STRETCHDIB: WORD = 0x0f43; +pub const META_EXTFLOODFILL: WORD = 0x0548; +pub const META_SETLAYOUT: WORD = 0x0149; +pub const META_DELETEOBJECT: WORD = 0x01f0; +pub const META_CREATEPALETTE: WORD = 0x00f7; +pub const META_CREATEPATTERNBRUSH: WORD = 0x01F9; +pub const META_CREATEPENINDIRECT: WORD = 0x02FA; +pub const META_CREATEFONTINDIRECT: WORD = 0x02FB; +pub const META_CREATEBRUSHINDIRECT: WORD = 0x02FC; +pub const META_CREATEREGION: WORD = 0x06FF; +STRUCT!{struct DRAWPATRECT { + ptPosition: POINT, + ptSize: POINT, + wStyle: WORD, + wPattern: WORD, +}} +pub type PDRAWPATRECT = *mut DRAWPATRECT; +pub const NEWFRAME: c_int = 1; +pub const ABORTDOC: c_int = 2; +pub const NEXTBAND: c_int = 3; +pub const SETCOLORTABLE: c_int = 4; +pub const GETCOLORTABLE: c_int = 5; +pub const FLUSHOUTPUT: c_int = 6; +pub const DRAFTMODE: c_int = 7; +pub const QUERYESCSUPPORT: c_int = 8; +pub const SETABORTPROC: c_int = 9; +pub const STARTDOC: c_int = 10; +pub const ENDDOC: c_int = 11; +pub const GETPHYSPAGESIZE: c_int = 12; +pub const GETPRINTINGOFFSET: c_int = 13; +pub const GETSCALINGFACTOR: c_int = 14; +pub const MFCOMMENT: c_int = 15; +pub const GETPENWIDTH: c_int = 16; +pub const SETCOPYCOUNT: c_int = 17; +pub const SELECTPAPERSOURCE: c_int = 18; +pub const DEVICEDATA: c_int = 19; +pub const PASSTHROUGH: c_int = 19; +pub const GETTECHNOLGY: c_int = 20; +pub const GETTECHNOLOGY: c_int = 20; +pub const SETLINECAP: c_int = 21; +pub const SETLINEJOIN: c_int = 22; +pub const SETMITERLIMIT: c_int = 23; +pub const BANDINFO: c_int = 24; +pub const DRAWPATTERNRECT: c_int = 25; +pub const GETVECTORPENSIZE: c_int = 26; +pub const GETVECTORBRUSHSIZE: c_int = 27; +pub const ENABLEDUPLEX: c_int = 28; +pub const GETSETPAPERBINS: c_int = 29; +pub const GETSETPRINTORIENT: c_int = 30; +pub const ENUMPAPERBINS: c_int = 31; +pub const SETDIBSCALING: c_int = 32; +pub const EPSPRINTING: c_int = 33; +pub const ENUMPAPERMETRICS: c_int = 34; +pub const GETSETPAPERMETRICS: c_int = 35; +pub const POSTSCRIPT_DATA: c_int = 37; +pub const POSTSCRIPT_IGNORE: c_int = 38; +pub const MOUSETRAILS: c_int = 39; +pub const GETDEVICEUNITS: c_int = 42; +pub const GETEXTENDEDTEXTMETRICS: c_int = 256; +pub const GETEXTENTTABLE: c_int = 257; +pub const GETPAIRKERNTABLE: c_int = 258; +pub const GETTRACKKERNTABLE: c_int = 259; +pub const EXTTEXTOUT: c_int = 512; +pub const GETFACENAME: c_int = 513; +pub const DOWNLOADFACE: c_int = 514; +pub const ENABLERELATIVEWIDTHS: c_int = 768; +pub const ENABLEPAIRKERNING: c_int = 769; +pub const SETKERNTRACK: c_int = 770; +pub const SETALLJUSTVALUES: c_int = 771; +pub const SETCHARSET: c_int = 772; +pub const STRETCHBLT: c_int = 2048; +pub const METAFILE_DRIVER: c_int = 2049; +pub const GETSETSCREENPARAMS: c_int = 3072; +pub const QUERYDIBSUPPORT: c_int = 3073; +pub const BEGIN_PATH: c_int = 4096; +pub const CLIP_TO_PATH: c_int = 4097; +pub const END_PATH: c_int = 4098; +pub const EXT_DEVICE_CAPS: c_int = 4099; +pub const RESTORE_CTM: c_int = 4100; +pub const SAVE_CTM: c_int = 4101; +pub const SET_ARC_DIRECTION: c_int = 4102; +pub const SET_BACKGROUND_COLOR: c_int = 4103; +pub const SET_POLY_MODE: c_int = 4104; +pub const SET_SCREEN_ANGLE: c_int = 4105; +pub const SET_SPREAD: c_int = 4106; +pub const TRANSFORM_CTM: c_int = 4107; +pub const SET_CLIP_BOX: c_int = 4108; +pub const SET_BOUNDS: c_int = 4109; +pub const SET_MIRROR_MODE: c_int = 4110; +pub const OPENCHANNEL: c_int = 4110; +pub const DOWNLOADHEADER: c_int = 4111; +pub const CLOSECHANNEL: c_int = 4112; +pub const POSTSCRIPT_PASSTHROUGH: c_int = 4115; +pub const ENCAPSULATED_POSTSCRIPT: c_int = 4116; +pub const POSTSCRIPT_IDENTIFY: c_int = 4117; +pub const POSTSCRIPT_INJECTION: c_int = 4118; +pub const CHECKJPEGFORMAT: c_int = 4119; +pub const CHECKPNGFORMAT: c_int = 4120; +pub const GET_PS_FEATURESETTING: c_int = 4121; +pub const GDIPLUS_TS_QUERYVER: c_int = 4122; +pub const GDIPLUS_TS_RECORD: c_int = 4123; +pub const MILCORE_TS_QUERYVER_RESULT_FALSE: c_int = 0x0; +pub const MILCORE_TS_QUERYVER_RESULT_TRUE: c_int = 0x7FFFFFFF; +pub const SPCLPASSTHROUGH2: c_int = 4568; +pub const PSIDENT_GDICENTRIC: c_int = 0; +pub const PSIDENT_PSCENTRIC: c_int = 1; +STRUCT!{struct PSINJECTDATA { + DataBytes: DWORD, + InjectionPoint: WORD, + PageNumber: WORD, +}} +pub type PPSINJECTDATA = *mut PSINJECTDATA; +pub const PSINJECT_BEGINSTREAM: WORD = 1; +pub const PSINJECT_PSADOBE: WORD = 2; +pub const PSINJECT_PAGESATEND: WORD = 3; +pub const PSINJECT_PAGES: WORD = 4; +pub const PSINJECT_DOCNEEDEDRES: WORD = 5; +pub const PSINJECT_DOCSUPPLIEDRES: WORD = 6; +pub const PSINJECT_PAGEORDER: WORD = 7; +pub const PSINJECT_ORIENTATION: WORD = 8; +pub const PSINJECT_BOUNDINGBOX: WORD = 9; +pub const PSINJECT_DOCUMENTPROCESSCOLORS: WORD = 10; +pub const PSINJECT_COMMENTS: WORD = 11; +pub const PSINJECT_BEGINDEFAULTS: WORD = 12; +pub const PSINJECT_ENDDEFAULTS: WORD = 13; +pub const PSINJECT_BEGINPROLOG: WORD = 14; +pub const PSINJECT_ENDPROLOG: WORD = 15; +pub const PSINJECT_BEGINSETUP: WORD = 16; +pub const PSINJECT_ENDSETUP: WORD = 17; +pub const PSINJECT_TRAILER: WORD = 18; +pub const PSINJECT_EOF: WORD = 19; +pub const PSINJECT_ENDSTREAM: WORD = 20; +pub const PSINJECT_DOCUMENTPROCESSCOLORSATEND: WORD = 21; +pub const PSINJECT_PAGENUMBER: WORD = 100; +pub const PSINJECT_BEGINPAGESETUP: WORD = 101; +pub const PSINJECT_ENDPAGESETUP: WORD = 102; +pub const PSINJECT_PAGETRAILER: WORD = 103; +pub const PSINJECT_PLATECOLOR: WORD = 104; +pub const PSINJECT_SHOWPAGE: WORD = 105; +pub const PSINJECT_PAGEBBOX: WORD = 106; +pub const PSINJECT_ENDPAGECOMMENTS: WORD = 107; +pub const PSINJECT_VMSAVE: WORD = 200; +pub const PSINJECT_VMRESTORE: WORD = 201; +pub const PSINJECT_DLFONT: DWORD = 0xdddddddd; +pub const FEATURESETTING_NUP: WORD = 0; +pub const FEATURESETTING_OUTPUT: WORD = 1; +pub const FEATURESETTING_PSLEVEL: WORD = 2; +pub const FEATURESETTING_CUSTPAPER: WORD = 3; +pub const FEATURESETTING_MIRROR: WORD = 4; +pub const FEATURESETTING_NEGATIVE: WORD = 5; +pub const FEATURESETTING_PROTOCOL: WORD = 6; +pub const FEATURESETTING_PRIVATE_BEGIN: WORD = 0x1000; +pub const FEATURESETTING_PRIVATE_END: WORD = 0x1FFF; +STRUCT!{struct PSFEATURE_OUTPUT { + bPageIndependent: BOOL, + bSetPageDevice: BOOL, +}} +pub type PPSFEATURE_OUTPUT = *mut PSFEATURE_OUTPUT; +STRUCT!{struct PSFEATURE_CUSTPAPER { + lOrientation: LONG, + lWidth: LONG, + lHeight: LONG, + lWidthOffset: LONG, + lHeightOffset: LONG, +}} +pub type PPSFEATURE_CUSTPAPER = *mut PSFEATURE_CUSTPAPER; +pub const PSPROTOCOL_ASCII: c_int = 0; +pub const PSPROTOCOL_BCP: c_int = 1; +pub const PSPROTOCOL_TBCP: c_int = 2; +pub const PSPROTOCOL_BINARY: c_int = 3; +pub const QDI_SETDIBITS: c_int = 1; +pub const QDI_GETDIBITS: c_int = 2; +pub const QDI_DIBTOSCREEN: c_int = 4; +pub const QDI_STRETCHDIB: c_int = 8; +pub const SP_NOTREPORTED: c_int = 0x4000; +pub const SP_ERROR: c_int = -1; +pub const SP_APPABORT: c_int = -2; +pub const SP_USERABORT: c_int = -3; +pub const SP_OUTOFDISK: c_int = -4; +pub const SP_OUTOFMEMORY: c_int = -5; +pub const PR_JOBSTATUS: c_int = 0x0000; +pub const OBJ_PEN: UINT = 1; +pub const OBJ_BRUSH: UINT = 2; +pub const OBJ_DC: UINT = 3; +pub const OBJ_METADC: UINT = 4; +pub const OBJ_PAL: UINT = 5; +pub const OBJ_FONT: UINT = 6; +pub const OBJ_BITMAP: UINT = 7; +pub const OBJ_REGION: UINT = 8; +pub const OBJ_METAFILE: UINT = 9; +pub const OBJ_MEMDC: UINT = 10; +pub const OBJ_EXTPEN: UINT = 11; +pub const OBJ_ENHMETADC: UINT = 12; +pub const OBJ_ENHMETAFILE: UINT = 13; +pub const OBJ_COLORSPACE: UINT = 14; +pub const GDI_OBJ_LAST: UINT = OBJ_COLORSPACE; +pub const MWT_IDENTITY: c_int = 1; +pub const MWT_LEFTMULTIPLY: c_int = 2; +pub const MWT_RIGHTMULTIPLY: c_int = 3; +pub const MWT_MIN: c_int = MWT_IDENTITY; +pub const MWT_MAX: c_int = MWT_RIGHTMULTIPLY; +STRUCT!{struct XFORM { + eM11: FLOAT, + eM12: FLOAT, + eM21: FLOAT, + eM22: FLOAT, + eDx: FLOAT, + eDy: FLOAT, +}} +pub type PXFORM = *mut XFORM; +pub type LPXFORM = *mut XFORM; +STRUCT!{struct BITMAP { + bmType: LONG, + bmWidth: LONG, + bmHeight: LONG, + bmWidthBytes: LONG, + bmPlanes: WORD, + bmBitsPixel: WORD, + bmBits: LPVOID, +}} +pub type PBITMAP = *mut BITMAP; +pub type NPBITMAP = *mut BITMAP; +pub type LPBITMAP = *mut BITMAP; +STRUCT!{struct RGBTRIPLE { + rgbtBlue: BYTE, + rgbtGreen: BYTE, + rgbtRed: BYTE, +}} +pub type PRGBTRIPLE = *mut RGBTRIPLE; +pub type NPRGBTRIPLE = *mut RGBTRIPLE; +pub type LPRGBTRIPLE = *mut RGBTRIPLE; +STRUCT!{struct RGBQUAD { + rgbBlue: BYTE, + rgbGreen: BYTE, + rgbRed: BYTE, + rgbReserved: BYTE, +}} +pub type LPRGBQUAD = *mut RGBQUAD; +pub const CS_ENABLE: DWORD = 0x00000001; +pub const CS_DISABLE: DWORD = 0x00000002; +pub const CS_DELETE_TRANSFORM: DWORD = 0x00000003; +pub const LCS_SIGNATURE: DWORD = 0x5053_4F43; // 'PSOC' +pub const LCS_sRGB: LCSCSTYPE = 0x7352_4742; // 'sRGB' +pub const LCS_WINDOWS_COLOR_SPACE: LCSCSTYPE = 0x5769_6E20; // 'Win ' +pub type LCSCSTYPE = LONG; +pub const LCS_CALIBRATED_RGB: LCSCSTYPE = 0x00000000; +pub type LCSGAMUTMATCH = LONG; +pub const LCS_GM_BUSINESS: LCSGAMUTMATCH = 0x00000001; +pub const LCS_GM_GRAPHICS: LCSGAMUTMATCH = 0x00000002; +pub const LCS_GM_IMAGES: LCSGAMUTMATCH = 0x00000004; +pub const LCS_GM_ABS_COLORIMETRIC: LCSGAMUTMATCH = 0x00000008; +pub const CM_OUT_OF_GAMUT: BYTE = 255; +pub const CM_IN_GAMUT: BYTE = 0; +pub const ICM_ADDPROFILE: UINT = 1; +pub const ICM_DELETEPROFILE: UINT = 2; +pub const ICM_QUERYPROFILE: UINT = 3; +pub const ICM_SETDEFAULTPROFILE: UINT = 4; +pub const ICM_REGISTERICMATCHER: UINT = 5; +pub const ICM_UNREGISTERICMATCHER: UINT = 6; +pub const ICM_QUERYMATCH: UINT = 7; +#[inline] +pub fn GetKValue(cmyk: COLORREF) -> BYTE { + cmyk as BYTE +} +#[inline] +pub fn GetYValue(cmyk: COLORREF) -> BYTE { + (cmyk >> 8) as BYTE +} +#[inline] +pub fn GetMValue(cmyk: COLORREF) -> BYTE { + (cmyk >> 16) as BYTE +} +#[inline] +pub fn GetCValue(cmyk: COLORREF) -> BYTE { + (cmyk >> 24) as BYTE +} +#[inline] +pub fn CMYK(c: BYTE, m: BYTE, y: BYTE, k: BYTE) -> COLORREF { + (k as COLORREF) | ((y as COLORREF) << 8) | ((m as COLORREF) << 16) | ((c as COLORREF) << 24) +} +pub type FXPT16DOT16 = c_long; +pub type LPFXPT16DOT16 = *mut c_long; +pub type FXPT2DOT30 = c_long; +pub type LPFXPT2DOT30 = *mut c_long; +STRUCT!{struct CIEXYZ { + ciexyzX: FXPT2DOT30, + ciexyzY: FXPT2DOT30, + ciexyzZ: FXPT2DOT30, +}} +pub type LPCIEXYZ = *mut CIEXYZ; +STRUCT!{struct CIEXYZTRIPLE { + ciexyzRed: CIEXYZ, + ciexyzGreen: CIEXYZ, + ciexyzBlue: CIEXYZ, +}} +pub type LPCIEXYZTRIPLE = *mut CIEXYZTRIPLE; +STRUCT!{struct LOGCOLORSPACEA { + lcsSignature: DWORD, + lcsVersion: DWORD, + lcsSize: DWORD, + lcsCSType: LCSCSTYPE, + lcsIntent: LCSGAMUTMATCH, + lcsEndpoints: CIEXYZTRIPLE, + lcsGammaRed: DWORD, + lcsGammaGreen: DWORD, + lcsGammaBlue: DWORD, + lcsFilename: [CHAR; MAX_PATH], +}} +pub type LPLOGCOLORSPACEA = *mut LOGCOLORSPACEA; +STRUCT!{struct LOGCOLORSPACEW { + lcsSignature: DWORD, + lcsVersion: DWORD, + lcsSize: DWORD, + lcsCSType: LCSCSTYPE, + lcsIntent: LCSGAMUTMATCH, + lcsEndpoints: CIEXYZTRIPLE, + lcsGammaRed: DWORD, + lcsGammaGreen: DWORD, + lcsGammaBlue: DWORD, + lcsFilename: [WCHAR; MAX_PATH], +}} +pub type LPLOGCOLORSPACEW = *mut LOGCOLORSPACEW; +STRUCT!{struct BITMAPCOREHEADER { + bcSize: DWORD, + bcWidth: WORD, + bcHeight: WORD, + bcPlanes: WORD, + bcBitCount: WORD, +}} +pub type LPBITMAPCOREHEADER = *mut BITMAPCOREHEADER; +pub type PBITMAPCOREHEADER = *mut BITMAPCOREHEADER; +STRUCT!{struct BITMAPINFOHEADER { + biSize: DWORD, + biWidth: LONG, + biHeight: LONG, + biPlanes: WORD, + biBitCount: WORD, + biCompression: DWORD, + biSizeImage: DWORD, + biXPelsPerMeter: LONG, + biYPelsPerMeter: LONG, + biClrUsed: DWORD, + biClrImportant: DWORD, +}} +pub type LPBITMAPINFOHEADER = *mut BITMAPINFOHEADER; +pub type PBITMAPINFOHEADER = *mut BITMAPINFOHEADER; +STRUCT!{struct BITMAPV4HEADER { + bV4Size: DWORD, + bV4Width: LONG, + bV4Height: LONG, + bV4Planes: WORD, + bV4BitCount: WORD, + bV4V4Compression: DWORD, + bV4SizeImage: DWORD, + bV4XPelsPerMeter: LONG, + bV4YPelsPerMeter: LONG, + bV4ClrUsed: DWORD, + bV4ClrImportant: DWORD, + bV4RedMask: DWORD, + bV4GreenMask: DWORD, + bV4BlueMask: DWORD, + bV4AlphaMask: DWORD, + bV4CSType: DWORD, + bV4Endpoints: CIEXYZTRIPLE, + bV4GammaRed: DWORD, + bV4GammaGreen: DWORD, + bV4GammaBlue: DWORD, +}} +pub type LPBITMAPV4HEADER = *mut BITMAPV4HEADER; +pub type PBITMAPV4HEADER = *mut BITMAPV4HEADER; +STRUCT!{struct BITMAPV5HEADER { + bV5Size: DWORD, + bV5Width: LONG, + bV5Height: LONG, + bV5Planes: WORD, + bV5BitCount: WORD, + bV5Compression: DWORD, + bV5SizeImage: DWORD, + bV5XPelsPerMeter: LONG, + bV5YPelsPerMeter: LONG, + bV5ClrUsed: DWORD, + bV5ClrImportant: DWORD, + bV5RedMask: DWORD, + bV5GreenMask: DWORD, + bV5BlueMask: DWORD, + bV5AlphaMask: DWORD, + bV5CSType: DWORD, + bV5Endpoints: CIEXYZTRIPLE, + bV5GammaRed: DWORD, + bV5GammaGreen: DWORD, + bV5GammaBlue: DWORD, + bV5Intent: DWORD, + bV5ProfileData: DWORD, + bV5ProfileSize: DWORD, + bV5Reserved: DWORD, +}} +pub type LPBITMAPV5HEADER = *mut BITMAPV5HEADER; +pub type PBITMAPV5HEADER = *mut BITMAPV5HEADER; +pub const PROFILE_LINKED: LONG = 0x4C49_4E4B; // 'LINK' +pub const PROFILE_EMBEDDED: LONG = 0x4D42_4544; // 'MBED' +pub const BI_RGB: DWORD = 0; +pub const BI_RLE8: DWORD = 1; +pub const BI_RLE4: DWORD = 2; +pub const BI_BITFIELDS: DWORD = 3; +pub const BI_JPEG: DWORD = 4; +pub const BI_PNG: DWORD = 5; +STRUCT!{struct BITMAPINFO { + bmiHeader: BITMAPINFOHEADER, + bmiColors: [RGBQUAD; 0], +}} +pub type LPBITMAPINFO = *mut BITMAPINFO; +pub type PBITMAPINFO = *mut BITMAPINFO; +STRUCT!{struct BITMAPCOREINFO { + bmciHeader: BITMAPCOREHEADER, + bmciColors: [RGBTRIPLE; 0], +}} +pub type LPBITMAPCOREINFO = *mut BITMAPCOREINFO; +pub type PBITMAPCOREINFO = *mut BITMAPCOREINFO; +STRUCT!{struct BITMAPFILEHEADER { + bfType: WORD, + bfSize: DWORD, + bfReserved1: WORD, + bfReserved2: WORD, + bfOffBits: DWORD, +}} +pub type LPBITMAPFILEHEADER = *mut BITMAPFILEHEADER; +pub type PBITMAPFILEHEADER = *mut BITMAPFILEHEADER; +#[inline] +pub fn MAKEPOINTS(l: DWORD) -> POINTS { + unsafe { ::core::mem::transmute::(l) } +} +STRUCT!{struct FONTSIGNATURE { + fsUsb: [DWORD; 4], + fsCsb: [DWORD; 2], +}} +pub type LPFONTSIGNATURE = *mut FONTSIGNATURE; +pub type PFONTSIGNATURE = *mut FONTSIGNATURE; +STRUCT!{struct CHARSETINFO { + ciCharset: UINT, + ciACP: UINT, + fs: FONTSIGNATURE, +}} +pub type PCHARSETINFO = *mut CHARSETINFO; +pub type NPCHARSETINFO = *mut CHARSETINFO; +pub type LPCHARSETINFO = *mut CHARSETINFO; +pub const TCI_SRCCHARSET: c_int = 1; +pub const TCI_SRCCODEPAGE: c_int = 2; +pub const TCI_SRCFONTSIG: c_int = 3; +pub const TCI_SRCLOCALE: c_int = 0x1000; +STRUCT!{struct LOCALESIGNATURE { + lsUsb: [DWORD; 4], + lsCsbDefault: [DWORD; 2], + lsCsbSupported: [DWORD; 2], +}} +pub type PLOCALESIGNATURE = *mut LOCALESIGNATURE; +pub type LPLOCALESIGNATURE = *mut LOCALESIGNATURE; +STRUCT!{struct HANDLETABLE { + objectHandle: [HGDIOBJ; 1], +}} +pub type LPHANDLETABLE = *mut HANDLETABLE; +pub type PHANDLETABLE = *mut HANDLETABLE; +STRUCT!{struct METARECORD { + rdSize: DWORD, + rdFunction: WORD, + rdParm: [WORD; 1], +}} +pub type PMETARECORD = *mut METARECORD; +pub type LPMETARECORD = *mut METARECORD; +STRUCT!{struct METAFILEPICT { + mm: LONG, + xExt: LONG, + yExt: LONG, + hMF: HMETAFILE, +}} +pub type LPMETAFILEPICT = *mut METAFILEPICT; +STRUCT!{struct METAHEADER { + mtType: WORD, + mtHeaderSize: WORD, + mtVersion: WORD, + mtSize: DWORD, + mtNoObjects: WORD, + mtMaxRecord: DWORD, + mtNoParameters: WORD, +}} +pub type PMETAHEADER = *mut METAHEADER; +pub type LPMETAHEADER = *mut METAHEADER; +STRUCT!{struct ENHMETARECORD { + iType: DWORD, + nSize: DWORD, + dParm: [DWORD; 1], +}} +pub type PENHMETARECORD = *mut ENHMETARECORD; +pub type LPENHMETARECORD = *mut ENHMETARECORD; +STRUCT!{struct ENHMETAHEADER { + iType: DWORD, + nSize: DWORD, + rclBounds: RECTL, + rclFrame: RECTL, + dSignature: DWORD, + nVersion: DWORD, + nBytes: DWORD, + nRecords: DWORD, + nHandles: WORD, + sReserved: WORD, + nDescription: DWORD, + offDescription: DWORD, + nPalEntries: DWORD, + szlDevice: SIZEL, + szlMillimeters: SIZEL, + cbPixelFormat: DWORD, + offPixelFormat: DWORD, + bOpenGL: DWORD, + szlMicrometers: SIZEL, +}} +pub type PENHMETAHEADER = *mut ENHMETAHEADER; +pub type LPENHMETAHEADER = *mut ENHMETAHEADER; +pub const TMPF_FIXED_PITCH: BYTE = 0x01; +pub const TMPF_VECTOR: BYTE = 0x02; +pub const TMPF_DEVICE: BYTE = 0x08; +pub const TMPF_TRUETYPE: BYTE = 0x04; +// BCHAR +STRUCT!{struct TEXTMETRICA { + tmHeight: LONG, + tmAscent: LONG, + tmDescent: LONG, + tmInternalLeading: LONG, + tmExternalLeading: LONG, + tmAveCharWidth: LONG, + tmMaxCharWidth: LONG, + tmWeight: LONG, + tmOverhang: LONG, + tmDigitizedAspectX: LONG, + tmDigitizedAspectY: LONG, + tmFirstChar: BYTE, + tmLastChar: BYTE, + tmDefaultChar: BYTE, + tmBreakChar: BYTE, + tmItalic: BYTE, + tmUnderlined: BYTE, + tmStruckOut: BYTE, + tmPitchAndFamily: BYTE, + tmCharSet: BYTE, +}} +pub type PTEXTMETRICA = *mut TEXTMETRICA; +pub type NPTEXTMETRICA = *mut TEXTMETRICA; +pub type LPTEXTMETRICA = *mut TEXTMETRICA; +STRUCT!{struct TEXTMETRICW { + tmHeight: LONG, + tmAscent: LONG, + tmDescent: LONG, + tmInternalLeading: LONG, + tmExternalLeading: LONG, + tmAveCharWidth: LONG, + tmMaxCharWidth: LONG, + tmWeight: LONG, + tmOverhang: LONG, + tmDigitizedAspectX: LONG, + tmDigitizedAspectY: LONG, + tmFirstChar: WCHAR, + tmLastChar: WCHAR, + tmDefaultChar: WCHAR, + tmBreakChar: WCHAR, + tmItalic: BYTE, + tmUnderlined: BYTE, + tmStruckOut: BYTE, + tmPitchAndFamily: BYTE, + tmCharSet: BYTE, +}} +pub type PTEXTMETRICW = *mut TEXTMETRICW; +pub type NPTEXTMETRICW = *mut TEXTMETRICW; +pub type LPTEXTMETRICW = *mut TEXTMETRICW; +pub const NTM_REGULAR: DWORD = 0x00000040; +pub const NTM_BOLD: DWORD = 0x00000020; +pub const NTM_ITALIC: DWORD = 0x00000001; +pub const NTM_NONNEGATIVE_AC: DWORD = 0x00010000; +pub const NTM_PS_OPENTYPE: DWORD = 0x00020000; +pub const NTM_TT_OPENTYPE: DWORD = 0x00040000; +pub const NTM_MULTIPLEMASTER: DWORD = 0x00080000; +pub const NTM_TYPE1: DWORD = 0x00100000; +pub const NTM_DSIG: DWORD = 0x00200000; +STRUCT!{struct NEWTEXTMETRICA { + tmHeight: LONG, + tmAscent: LONG, + tmDescent: LONG, + tmInternalLeading: LONG, + tmExternalLeading: LONG, + tmAveCharWidth: LONG, + tmMaxCharWidth: LONG, + tmWeight: LONG, + tmOverhang: LONG, + tmDigitizedAspectX: LONG, + tmDigitizedAspectY: LONG, + tmFirstChar: BYTE, + tmLastChar: BYTE, + tmDefaultChar: BYTE, + tmBreakChar: BYTE, + tmItalic: BYTE, + tmUnderlined: BYTE, + tmStruckOut: BYTE, + tmPitchAndFamily: BYTE, + tmCharSet: BYTE, + ntmFlags: DWORD, + ntmSizeEM: UINT, + ntmCellHeight: UINT, + ntmAvgWidth: UINT, +}} +pub type PNEWTEXTMETRICA = *mut NEWTEXTMETRICA; +pub type NPNEWTEXTMETRICA = *mut NEWTEXTMETRICA; +pub type LPNEWTEXTMETRICA = *mut NEWTEXTMETRICA; +STRUCT!{struct NEWTEXTMETRICW { + tmHeight: LONG, + tmAscent: LONG, + tmDescent: LONG, + tmInternalLeading: LONG, + tmExternalLeading: LONG, + tmAveCharWidth: LONG, + tmMaxCharWidth: LONG, + tmWeight: LONG, + tmOverhang: LONG, + tmDigitizedAspectX: LONG, + tmDigitizedAspectY: LONG, + tmFirstChar: WCHAR, + tmLastChar: WCHAR, + tmDefaultChar: WCHAR, + tmBreakChar: WCHAR, + tmItalic: BYTE, + tmUnderlined: BYTE, + tmStruckOut: BYTE, + tmPitchAndFamily: BYTE, + tmCharSet: BYTE, + ntmFlags: DWORD, + ntmSizeEM: UINT, + ntmCellHeight: UINT, + ntmAvgWidth: UINT, +}} +pub type PNEWTEXTMETRICW = *mut NEWTEXTMETRICW; +pub type NPNEWTEXTMETRICW = *mut NEWTEXTMETRICW; +pub type LPNEWTEXTMETRICW = *mut NEWTEXTMETRICW; +STRUCT!{struct NEWTEXTMETRICEXA { + ntmTm: NEWTEXTMETRICA, + ntmFontSig: FONTSIGNATURE, +}} +STRUCT!{struct NEWTEXTMETRICEXW { + ntmTm: NEWTEXTMETRICW, + ntmFontSig: FONTSIGNATURE, +}} +STRUCT!{struct PELARRAY { + paXCount: LONG, + paYCount: LONG, + paXExt: LONG, + paYExt: LONG, + paRGBs: BYTE, +}} +pub type PPELARRAY = *mut PELARRAY; +pub type NPPELARRAY = *mut PELARRAY; +pub type LPPELARRAY = *mut PELARRAY; +STRUCT!{struct LOGBRUSH { + lbStyle: UINT, + lbColor: COLORREF, + lbHatch: ULONG_PTR, +}} +pub type PLOGBRUSH = *mut LOGBRUSH; +pub type NPLOGBRUSH = *mut LOGBRUSH; +pub type LPLOGBRUSH = *mut LOGBRUSH; +STRUCT!{struct LOGBRUSH32 { + lbStyle: UINT, + lbColor: COLORREF, + lbHatch: ULONG, +}} +pub type PLOGBRUSH32 = *mut LOGBRUSH32; +pub type NPLOGBRUSH32 = *mut LOGBRUSH32; +pub type LPLOGBRUSH32 = *mut LOGBRUSH32; +pub type PATTERN = LOGBRUSH; +pub type PPATTERN = *mut PATTERN; +pub type NPPATTERN = *mut PATTERN; +pub type LPPATTERN = *mut PATTERN; +STRUCT!{struct LOGPEN { + lopnStyle: UINT, + lopnWidth: POINT, + lopnColor: COLORREF, +}} +pub type PLOGPEN = *mut LOGPEN; +pub type NPLOGPEN = *mut LOGPEN; +pub type LPLOGPEN = *mut LOGPEN; +STRUCT!{struct EXTLOGPEN { + elpPenStyle: DWORD, + elpWidth: DWORD, + elpBrushStyle: UINT, + elpColor: COLORREF, + elpHatch: ULONG_PTR, + elpNumEntries: DWORD, + elpStyleEntry: [DWORD; 1], +}} +pub type PEXTLOGPEN = *mut EXTLOGPEN; +pub type NPEXTLOGPEN = *mut EXTLOGPEN; +pub type LPEXTLOGPEN = *mut EXTLOGPEN; +STRUCT!{struct EXTLOGPEN32 { + elpPenStyle: DWORD, + elpWidth: DWORD, + elpBrushStyle: UINT, + elpColor: COLORREF, + elpHatch: ULONG, + elpNumEntries: DWORD, + elpStyleEntry: [DWORD; 0], +}} +pub type PEXTLOGPEN32 = *mut EXTLOGPEN32; +pub type NPEXTLOGPEN32 = *mut EXTLOGPEN32; +pub type LPEXTLOGPEN32 = *mut EXTLOGPEN32; +STRUCT!{struct PALETTEENTRY { + peRed: BYTE, + peGreen: BYTE, + peBlue: BYTE, + peFlags: BYTE, +}} +pub type PPALETTEENTRY = *mut PALETTEENTRY; +pub type LPPALETTEENTRY = *mut PALETTEENTRY; +STRUCT!{struct LOGPALETTE { + palVersion: WORD, + palNumEntries: WORD, + palPalEntry: [PALETTEENTRY; 1], +}} +pub type PLOGPALETTE = *mut LOGPALETTE; +pub type NPLOGPALETTE = *mut LOGPALETTE; +pub type LPLOGPALETTE = *mut LOGPALETTE; +pub const LF_FACESIZE: usize = 32; +STRUCT!{struct LOGFONTA { + lfHeight: LONG, + lfWidth: LONG, + lfEscapement: LONG, + lfOrientation: LONG, + lfWeight: LONG, + lfItalic: BYTE, + lfUnderline: BYTE, + lfStrikeOut: BYTE, + lfCharSet: BYTE, + lfOutPrecision: BYTE, + lfClipPrecision: BYTE, + lfQuality: BYTE, + lfPitchAndFamily: BYTE, + lfFaceName: [CHAR; LF_FACESIZE], +}} +pub type PLOGFONTA = *mut LOGFONTA; +pub type NPLOGFONTA = *mut LOGFONTA; +pub type LPLOGFONTA = *mut LOGFONTA; +STRUCT!{struct LOGFONTW { + lfHeight: LONG, + lfWidth: LONG, + lfEscapement: LONG, + lfOrientation: LONG, + lfWeight: LONG, + lfItalic: BYTE, + lfUnderline: BYTE, + lfStrikeOut: BYTE, + lfCharSet: BYTE, + lfOutPrecision: BYTE, + lfClipPrecision: BYTE, + lfQuality: BYTE, + lfPitchAndFamily: BYTE, + lfFaceName: [WCHAR; LF_FACESIZE], +}} +pub type PLOGFONTW = *mut LOGFONTW; +pub type NPLOGFONTW = *mut LOGFONTW; +pub type LPLOGFONTW = *mut LOGFONTW; +pub const LF_FULLFACESIZE: usize = 64; +STRUCT!{struct ENUMLOGFONTA { + elfLogFont: LOGFONTA, + elfFullName: [BYTE; LF_FULLFACESIZE], + elfStyle: [BYTE; LF_FACESIZE], +}} +pub type LPENUMLOGFONTA = *mut ENUMLOGFONTA; +STRUCT!{struct ENUMLOGFONTW { + elfLogFont: LOGFONTW, + elfFullName: [WCHAR; LF_FULLFACESIZE], + elfStyle: [WCHAR; LF_FACESIZE], +}} +pub type LPENUMLOGFONTW = *mut ENUMLOGFONTW; +STRUCT!{struct ENUMLOGFONTEXA { + elfLogFont: LOGFONTA, + elfFullName: [BYTE; LF_FULLFACESIZE], + elfStyle: [BYTE; LF_FACESIZE], + elfScript: [BYTE; LF_FACESIZE], +}} +pub type LPENUMLOGFONTEXA = *mut ENUMLOGFONTEXA; +STRUCT!{struct ENUMLOGFONTEXW { + elfLogFont: LOGFONTW, + elfFullName: [WCHAR; LF_FULLFACESIZE], + elfStyle: [WCHAR; LF_FACESIZE], + elfScript: [WCHAR; LF_FACESIZE], +}} +pub type LPENUMLOGFONTEXW = *mut ENUMLOGFONTEXW; +pub const OUT_DEFAULT_PRECIS: DWORD = 0; +pub const OUT_STRING_PRECIS: DWORD = 1; +pub const OUT_CHARACTER_PRECIS: DWORD = 2; +pub const OUT_STROKE_PRECIS: DWORD = 3; +pub const OUT_TT_PRECIS: DWORD = 4; +pub const OUT_DEVICE_PRECIS: DWORD = 5; +pub const OUT_RASTER_PRECIS: DWORD = 6; +pub const OUT_TT_ONLY_PRECIS: DWORD = 7; +pub const OUT_OUTLINE_PRECIS: DWORD = 8; +pub const OUT_SCREEN_OUTLINE_PRECIS: DWORD = 9; +pub const OUT_PS_ONLY_PRECIS: DWORD = 10; +pub const CLIP_DEFAULT_PRECIS: DWORD = 0; +pub const CLIP_CHARACTER_PRECIS: DWORD = 1; +pub const CLIP_STROKE_PRECIS: DWORD = 2; +pub const CLIP_MASK: DWORD = 0xf; +pub const CLIP_LH_ANGLES: DWORD = 1 << 4; +pub const CLIP_TT_ALWAYS: DWORD = 2 << 4; +pub const CLIP_DFA_DISABLE: DWORD = 4 << 4; +pub const CLIP_EMBEDDED: DWORD = 8 << 4; +pub const DEFAULT_QUALITY: DWORD = 0; +pub const DRAFT_QUALITY: DWORD = 1; +pub const PROOF_QUALITY: DWORD = 2; +pub const NONANTIALIASED_QUALITY: DWORD = 3; +pub const ANTIALIASED_QUALITY: DWORD = 4; +pub const CLEARTYPE_QUALITY: DWORD = 5; +pub const CLEARTYPE_NATURAL_QUALITY: DWORD = 6; +pub const DEFAULT_PITCH: DWORD = 0; +pub const FIXED_PITCH: DWORD = 1; +pub const VARIABLE_PITCH: DWORD = 2; +pub const MONO_FONT: DWORD = 8; +pub const ANSI_CHARSET: DWORD = 0; +pub const DEFAULT_CHARSET: DWORD = 1; +pub const SYMBOL_CHARSET: DWORD = 2; +pub const SHIFTJIS_CHARSET: DWORD = 128; +pub const HANGEUL_CHARSET: DWORD = 129; +pub const HANGUL_CHARSET: DWORD = 129; +pub const GB2312_CHARSET: DWORD = 134; +pub const CHINESEBIG5_CHARSET: DWORD = 136; +pub const OEM_CHARSET: DWORD = 255; +pub const JOHAB_CHARSET: DWORD = 130; +pub const HEBREW_CHARSET: DWORD = 177; +pub const ARABIC_CHARSET: DWORD = 178; +pub const GREEK_CHARSET: DWORD = 161; +pub const TURKISH_CHARSET: DWORD = 162; +pub const VIETNAMESE_CHARSET: DWORD = 163; +pub const THAI_CHARSET: DWORD = 222; +pub const EASTEUROPE_CHARSET: DWORD = 238; +pub const RUSSIAN_CHARSET: DWORD = 204; +pub const MAC_CHARSET: DWORD = 77; +pub const BALTIC_CHARSET: DWORD = 186; +pub const FS_LATIN1: DWORD = 0x00000001; +pub const FS_LATIN2: DWORD = 0x00000002; +pub const FS_CYRILLIC: DWORD = 0x00000004; +pub const FS_GREEK: DWORD = 0x00000008; +pub const FS_TURKISH: DWORD = 0x00000010; +pub const FS_HEBREW: DWORD = 0x00000020; +pub const FS_ARABIC: DWORD = 0x00000040; +pub const FS_BALTIC: DWORD = 0x00000080; +pub const FS_VIETNAMESE: DWORD = 0x00000100; +pub const FS_THAI: DWORD = 0x00010000; +pub const FS_JISJAPAN: DWORD = 0x00020000; +pub const FS_CHINESESIMP: DWORD = 0x00040000; +pub const FS_WANSUNG: DWORD = 0x00080000; +pub const FS_CHINESETRAD: DWORD = 0x00100000; +pub const FS_JOHAB: DWORD = 0x00200000; +pub const FS_SYMBOL: DWORD = 0x80000000; +pub const FF_DONTCARE: DWORD = 0 << 4; +pub const FF_ROMAN: DWORD = 1 << 4; +pub const FF_SWISS: DWORD = 2 << 4; +pub const FF_MODERN: DWORD = 3 << 4; +pub const FF_SCRIPT: DWORD = 4 << 4; +pub const FF_DECORATIVE: DWORD = 5 << 4; +pub const FW_DONTCARE: c_int = 0; +pub const FW_THIN: c_int = 100; +pub const FW_EXTRALIGHT: c_int = 200; +pub const FW_LIGHT: c_int = 300; +pub const FW_NORMAL: c_int = 400; +pub const FW_MEDIUM: c_int = 500; +pub const FW_SEMIBOLD: c_int = 600; +pub const FW_BOLD: c_int = 700; +pub const FW_EXTRABOLD: c_int = 800; +pub const FW_HEAVY: c_int = 900; +pub const FW_ULTRALIGHT: c_int = FW_EXTRALIGHT; +pub const FW_REGULAR: c_int = FW_NORMAL; +pub const FW_DEMIBOLD: c_int = FW_SEMIBOLD; +pub const FW_ULTRABOLD: c_int = FW_EXTRABOLD; +pub const FW_BLACK: c_int = FW_HEAVY; +pub const PANOSE_COUNT: DWORD = 10; +pub const PAN_FAMILYTYPE_INDEX: DWORD = 0; +pub const PAN_SERIFSTYLE_INDEX: DWORD = 1; +pub const PAN_WEIGHT_INDEX: DWORD = 2; +pub const PAN_PROPORTION_INDEX: DWORD = 3; +pub const PAN_CONTRAST_INDEX: DWORD = 4; +pub const PAN_STROKEVARIATION_INDEX: DWORD = 5; +pub const PAN_ARMSTYLE_INDEX: DWORD = 6; +pub const PAN_LETTERFORM_INDEX: DWORD = 7; +pub const PAN_MIDLINE_INDEX: DWORD = 8; +pub const PAN_XHEIGHT_INDEX: DWORD = 9; +pub const PAN_CULTURE_LATIN: DWORD = 0; +STRUCT!{struct PANOSE { + bFamilyType: BYTE, + bSerifStyle: BYTE, + bWeight: BYTE, + bProportion: BYTE, + bContrast: BYTE, + bStrokeVariation: BYTE, + bArmStyle: BYTE, + bLetterform: BYTE, + bMidline: BYTE, + bXHeight: BYTE, +}} +pub type LPPANOSE = *mut PANOSE; +pub const PAN_ANY: BYTE = 0; +pub const PAN_NO_FIT: BYTE = 1; +pub const PAN_FAMILY_TEXT_DISPLAY: BYTE = 2; +pub const PAN_FAMILY_SCRIPT: BYTE = 3; +pub const PAN_FAMILY_DECORATIVE: BYTE = 4; +pub const PAN_FAMILY_PICTORIAL: BYTE = 5; +pub const PAN_SERIF_COVE: BYTE = 2; +pub const PAN_SERIF_OBTUSE_COVE: BYTE = 3; +pub const PAN_SERIF_SQUARE_COVE: BYTE = 4; +pub const PAN_SERIF_OBTUSE_SQUARE_COVE: BYTE = 5; +pub const PAN_SERIF_SQUARE: BYTE = 6; +pub const PAN_SERIF_THIN: BYTE = 7; +pub const PAN_SERIF_BONE: BYTE = 8; +pub const PAN_SERIF_EXAGGERATED: BYTE = 9; +pub const PAN_SERIF_TRIANGLE: BYTE = 10; +pub const PAN_SERIF_NORMAL_SANS: BYTE = 11; +pub const PAN_SERIF_OBTUSE_SANS: BYTE = 12; +pub const PAN_SERIF_PERP_SANS: BYTE = 13; +pub const PAN_SERIF_FLARED: BYTE = 14; +pub const PAN_SERIF_ROUNDED: BYTE = 15; +pub const PAN_WEIGHT_VERY_LIGHT: BYTE = 2; +pub const PAN_WEIGHT_LIGHT: BYTE = 3; +pub const PAN_WEIGHT_THIN: BYTE = 4; +pub const PAN_WEIGHT_BOOK: BYTE = 5; +pub const PAN_WEIGHT_MEDIUM: BYTE = 6; +pub const PAN_WEIGHT_DEMI: BYTE = 7; +pub const PAN_WEIGHT_BOLD: BYTE = 8; +pub const PAN_WEIGHT_HEAVY: BYTE = 9; +pub const PAN_WEIGHT_BLACK: BYTE = 10; +pub const PAN_WEIGHT_NORD: BYTE = 11; +pub const PAN_PROP_OLD_STYLE: BYTE = 2; +pub const PAN_PROP_MODERN: BYTE = 3; +pub const PAN_PROP_EVEN_WIDTH: BYTE = 4; +pub const PAN_PROP_EXPANDED: BYTE = 5; +pub const PAN_PROP_CONDENSED: BYTE = 6; +pub const PAN_PROP_VERY_EXPANDED: BYTE = 7; +pub const PAN_PROP_VERY_CONDENSED: BYTE = 8; +pub const PAN_PROP_MONOSPACED: BYTE = 9; +pub const PAN_CONTRAST_NONE: BYTE = 2; +pub const PAN_CONTRAST_VERY_LOW: BYTE = 3; +pub const PAN_CONTRAST_LOW: BYTE = 4; +pub const PAN_CONTRAST_MEDIUM_LOW: BYTE = 5; +pub const PAN_CONTRAST_MEDIUM: BYTE = 6; +pub const PAN_CONTRAST_MEDIUM_HIGH: BYTE = 7; +pub const PAN_CONTRAST_HIGH: BYTE = 8; +pub const PAN_CONTRAST_VERY_HIGH: BYTE = 9; +pub const PAN_STROKE_GRADUAL_DIAG: BYTE = 2; +pub const PAN_STROKE_GRADUAL_TRAN: BYTE = 3; +pub const PAN_STROKE_GRADUAL_VERT: BYTE = 4; +pub const PAN_STROKE_GRADUAL_HORZ: BYTE = 5; +pub const PAN_STROKE_RAPID_VERT: BYTE = 6; +pub const PAN_STROKE_RAPID_HORZ: BYTE = 7; +pub const PAN_STROKE_INSTANT_VERT: BYTE = 8; +pub const PAN_STRAIGHT_ARMS_HORZ: BYTE = 2; +pub const PAN_STRAIGHT_ARMS_WEDGE: BYTE = 3; +pub const PAN_STRAIGHT_ARMS_VERT: BYTE = 4; +pub const PAN_STRAIGHT_ARMS_SINGLE_SERIF: BYTE = 5; +pub const PAN_STRAIGHT_ARMS_DOUBLE_SERIF: BYTE = 6; +pub const PAN_BENT_ARMS_HORZ: BYTE = 7; +pub const PAN_BENT_ARMS_WEDGE: BYTE = 8; +pub const PAN_BENT_ARMS_VERT: BYTE = 9; +pub const PAN_BENT_ARMS_SINGLE_SERIF: BYTE = 10; +pub const PAN_BENT_ARMS_DOUBLE_SERIF: BYTE = 11; +pub const PAN_LETT_NORMAL_CONTACT: BYTE = 2; +pub const PAN_LETT_NORMAL_WEIGHTED: BYTE = 3; +pub const PAN_LETT_NORMAL_BOXED: BYTE = 4; +pub const PAN_LETT_NORMAL_FLATTENED: BYTE = 5; +pub const PAN_LETT_NORMAL_ROUNDED: BYTE = 6; +pub const PAN_LETT_NORMAL_OFF_CENTER: BYTE = 7; +pub const PAN_LETT_NORMAL_SQUARE: BYTE = 8; +pub const PAN_LETT_OBLIQUE_CONTACT: BYTE = 9; +pub const PAN_LETT_OBLIQUE_WEIGHTED: BYTE = 10; +pub const PAN_LETT_OBLIQUE_BOXED: BYTE = 11; +pub const PAN_LETT_OBLIQUE_FLATTENED: BYTE = 12; +pub const PAN_LETT_OBLIQUE_ROUNDED: BYTE = 13; +pub const PAN_LETT_OBLIQUE_OFF_CENTER: BYTE = 14; +pub const PAN_LETT_OBLIQUE_SQUARE: BYTE = 15; +pub const PAN_MIDLINE_STANDARD_TRIMMED: BYTE = 2; +pub const PAN_MIDLINE_STANDARD_POINTED: BYTE = 3; +pub const PAN_MIDLINE_STANDARD_SERIFED: BYTE = 4; +pub const PAN_MIDLINE_HIGH_TRIMMED: BYTE = 5; +pub const PAN_MIDLINE_HIGH_POINTED: BYTE = 6; +pub const PAN_MIDLINE_HIGH_SERIFED: BYTE = 7; +pub const PAN_MIDLINE_CONSTANT_TRIMMED: BYTE = 8; +pub const PAN_MIDLINE_CONSTANT_POINTED: BYTE = 9; +pub const PAN_MIDLINE_CONSTANT_SERIFED: BYTE = 10; +pub const PAN_MIDLINE_LOW_TRIMMED: BYTE = 11; +pub const PAN_MIDLINE_LOW_POINTED: BYTE = 12; +pub const PAN_MIDLINE_LOW_SERIFED: BYTE = 13; +pub const PAN_XHEIGHT_CONSTANT_SMALL: BYTE = 2; +pub const PAN_XHEIGHT_CONSTANT_STD: BYTE = 3; +pub const PAN_XHEIGHT_CONSTANT_LARGE: BYTE = 4; +pub const PAN_XHEIGHT_DUCKING_SMALL: BYTE = 5; +pub const PAN_XHEIGHT_DUCKING_STD: BYTE = 6; +pub const PAN_XHEIGHT_DUCKING_LARGE: BYTE = 7; +pub const ELF_VENDOR_SIZE: usize = 4; +STRUCT!{struct EXTLOGFONTA { + elfLogFont: LOGFONTA, + elfFullName: [BYTE; LF_FULLFACESIZE], + elfStyle: [BYTE; LF_FACESIZE], + elfVersion: DWORD, + elfStyleSize: DWORD, + elfMatch: DWORD, + elfReserved: DWORD, + elfVendorId: [BYTE; ELF_VENDOR_SIZE], + elfCulture: DWORD, + elfPanose: PANOSE, +}} +pub type PEXTLOGFONTA = *mut EXTLOGFONTA; +pub type NPEXTLOGFONTA = *mut EXTLOGFONTA; +pub type LPEXTLOGFONTA = *mut EXTLOGFONTA; +STRUCT!{struct EXTLOGFONTW { + elfLogFont: LOGFONTW, + elfFullNam: [WCHAR; LF_FULLFACESIZE], + elfStyle: [WCHAR; LF_FACESIZE], + elfVersion: DWORD, + elfStyleSize: DWORD, + elfMatch: DWORD, + elfReserved: DWORD, + elfVendorId: [BYTE; ELF_VENDOR_SIZE], + elfCulture: DWORD, + elfPanose: PANOSE, +}} +pub type PEXTLOGFONTW = *mut EXTLOGFONTW; +pub type NPEXTLOGFONTW = *mut EXTLOGFONTW; +pub type LPEXTLOGFONTW = *mut EXTLOGFONTW; +pub const ELF_VERSION: DWORD = 0; +pub const ELF_CULTURE_LATIN: DWORD = 0; +pub const RASTER_FONTTYPE: DWORD = 0x0001; +pub const DEVICE_FONTTYPE: DWORD = 0x0002; +pub const TRUETYPE_FONTTYPE: DWORD = 0x0004; +#[inline] +pub fn RGB(r: BYTE, g: BYTE, b: BYTE) -> COLORREF { + r as COLORREF | ((g as COLORREF) << 8) | ((b as COLORREF) << 16) +} +#[inline] +pub fn PALETTERGB(r: BYTE, g: BYTE, b: BYTE) -> COLORREF { + 0x02000000 | RGB(r, g, b) +} +#[inline] +pub fn PALETTEINDEX(i: WORD) -> COLORREF { + 0x01000000 | i as DWORD +} +pub const PC_RESERVED: DWORD = 0x01; +pub const PC_EXPLICIT: DWORD = 0x02; +pub const PC_NOCOLLAPSE: DWORD = 0x04; +#[inline] +pub fn GetRValue(rgb: COLORREF) -> BYTE { + LOBYTE(rgb as WORD) +} +#[inline] +pub fn GetGValue(rgb: COLORREF) -> BYTE { + LOBYTE((rgb as WORD) >> 8) +} +#[inline] +pub fn GetBValue(rgb: COLORREF) -> BYTE { + LOBYTE((rgb >> 16) as WORD) +} +pub const TRANSPARENT: DWORD = 1; +pub const OPAQUE: DWORD = 2; +pub const BKMODE_LAST: DWORD = 2; +pub const GM_COMPATIBLE: DWORD = 1; +pub const GM_ADVANCED: DWORD = 2; +pub const GM_LAST: DWORD = 2; +pub const PT_CLOSEFIGURE: DWORD = 0x01; +pub const PT_LINETO: DWORD = 0x02; +pub const PT_BEZIERTO: DWORD = 0x04; +pub const PT_MOVETO: DWORD = 0x06; +pub const MM_TEXT: DWORD = 1; +pub const MM_LOMETRIC: DWORD = 2; +pub const MM_HIMETRIC: DWORD = 3; +pub const MM_LOENGLISH: DWORD = 4; +pub const MM_HIENGLISH: DWORD = 5; +pub const MM_TWIPS: DWORD = 6; +pub const MM_ISOTROPIC: DWORD = 7; +pub const MM_ANISOTROPIC: DWORD = 8; +pub const MM_MIN: DWORD = MM_TEXT; +pub const MM_MAX: DWORD = MM_ANISOTROPIC; +pub const MM_MAX_FIXEDSCALE: DWORD = MM_TWIPS; +pub const ABSOLUTE: DWORD = 1; +pub const RELATIVE: DWORD = 2; +pub const WHITE_BRUSH: DWORD = 0; +pub const LTGRAY_BRUSH: DWORD = 1; +pub const GRAY_BRUSH: DWORD = 2; +pub const DKGRAY_BRUSH: DWORD = 3; +pub const BLACK_BRUSH: DWORD = 4; +pub const NULL_BRUSH: DWORD = 5; +pub const HOLLOW_BRUSH: DWORD = NULL_BRUSH; +pub const WHITE_PEN: DWORD = 6; +pub const BLACK_PEN: DWORD = 7; +pub const NULL_PEN: DWORD = 8; +pub const OEM_FIXED_FONT: DWORD = 10; +pub const ANSI_FIXED_FONT: DWORD = 11; +pub const ANSI_VAR_FONT: DWORD = 12; +pub const SYSTEM_FONT: DWORD = 13; +pub const DEVICE_DEFAULT_FONT: DWORD = 14; +pub const DEFAULT_PALETTE: DWORD = 15; +pub const SYSTEM_FIXED_FONT: DWORD = 16; +pub const DEFAULT_GUI_FONT: DWORD = 17; +pub const DC_BRUSH: DWORD = 18; +pub const DC_PEN: DWORD = 19; +pub const STOCK_LAST: DWORD = 19; +pub const CLR_INVALID: COLORREF = 0xFFFFFFFF; +pub const BS_SOLID: DWORD = 0; +pub const BS_NULL: DWORD = 1; +pub const BS_HOLLOW: DWORD = BS_NULL; +pub const BS_HATCHED: DWORD = 2; +pub const BS_PATTERN: DWORD = 3; +pub const BS_INDEXED: DWORD = 4; +pub const BS_DIBPATTERN: DWORD = 5; +pub const BS_DIBPATTERNPT: DWORD = 6; +pub const BS_PATTERN8X8: DWORD = 7; +pub const BS_DIBPATTERN8X8: DWORD = 8; +pub const BS_MONOPATTERN: DWORD = 9; +pub const HS_HORIZONTAL: DWORD = 0; +pub const HS_VERTICAL: DWORD = 1; +pub const HS_FDIAGONAL: DWORD = 2; +pub const HS_BDIAGONAL: DWORD = 3; +pub const HS_CROSS: DWORD = 4; +pub const HS_DIAGCROSS: DWORD = 5; +pub const HS_API_MAX: DWORD = 12; +pub const PS_SOLID: DWORD = 0; +pub const PS_DASH: DWORD = 1; +pub const PS_DOT: DWORD = 2; +pub const PS_DASHDOT: DWORD = 3; +pub const PS_DASHDOTDOT: DWORD = 4; +pub const PS_NULL: DWORD = 5; +pub const PS_INSIDEFRAME: DWORD = 6; +pub const PS_USERSTYLE: DWORD = 7; +pub const PS_ALTERNATE: DWORD = 8; +pub const PS_STYLE_MASK: DWORD = 0x0000000F; +pub const PS_ENDCAP_ROUND: DWORD = 0x00000000; +pub const PS_ENDCAP_SQUARE: DWORD = 0x00000100; +pub const PS_ENDCAP_FLAT: DWORD = 0x00000200; +pub const PS_ENDCAP_MASK: DWORD = 0x00000F00; +pub const PS_JOIN_ROUND: DWORD = 0x00000000; +pub const PS_JOIN_BEVEL: DWORD = 0x00001000; +pub const PS_JOIN_MITER: DWORD = 0x00002000; +pub const PS_JOIN_MASK: DWORD = 0x0000F000; +pub const PS_COSMETIC: DWORD = 0x00000000; +pub const PS_GEOMETRIC: DWORD = 0x00010000; +pub const PS_TYPE_MASK: DWORD = 0x000F0000; +pub const AD_COUNTERCLOCKWISE: DWORD = 1; +pub const AD_CLOCKWISE: DWORD = 2; +pub const DRIVERVERSION: c_int = 0; +pub const TECHNOLOGY: c_int = 2; +pub const HORZSIZE: c_int = 4; +pub const VERTSIZE: c_int = 6; +pub const HORZRES: c_int = 8; +pub const VERTRES: c_int = 10; +pub const BITSPIXEL: c_int = 12; +pub const PLANES: c_int = 14; +pub const NUMBRUSHES: c_int = 16; +pub const NUMPENS: c_int = 18; +pub const NUMMARKERS: c_int = 20; +pub const NUMFONTS: c_int = 22; +pub const NUMCOLORS: c_int = 24; +pub const PDEVICESIZE: c_int = 26; +pub const CURVECAPS: c_int = 28; +pub const LINECAPS: c_int = 30; +pub const POLYGONALCAPS: c_int = 32; +pub const TEXTCAPS: c_int = 34; +pub const CLIPCAPS: c_int = 36; +pub const RASTERCAPS: c_int = 38; +pub const ASPECTX: c_int = 40; +pub const ASPECTY: c_int = 42; +pub const ASPECTXY: c_int = 44; +pub const LOGPIXELSX: c_int = 88; +pub const LOGPIXELSY: c_int = 90; +pub const SIZEPALETTE: c_int = 104; +pub const NUMRESERVED: c_int = 106; +pub const COLORRES: c_int = 108; +pub const PHYSICALWIDTH: c_int = 110; +pub const PHYSICALHEIGHT: c_int = 111; +pub const PHYSICALOFFSETX: c_int = 112; +pub const PHYSICALOFFSETY: c_int = 113; +pub const SCALINGFACTORX: c_int = 114; +pub const SCALINGFACTORY: c_int = 115; +pub const VREFRESH: c_int = 116; +pub const DESKTOPVERTRES: c_int = 117; +pub const DESKTOPHORZRES: c_int = 118; +pub const BLTALIGNMENT: c_int = 119; +pub const SHADEBLENDCAPS: c_int = 120; +pub const COLORMGMTCAPS: c_int = 121; +pub const DT_PLOTTER: DWORD = 0; +pub const DT_RASDISPLAY: DWORD = 1; +pub const DT_RASPRINTER: DWORD = 2; +pub const DT_RASCAMERA: DWORD = 3; +pub const DT_CHARSTREAM: DWORD = 4; +pub const DT_METAFILE: DWORD = 5; +pub const DT_DISPFILE: DWORD = 6; +pub const CC_NONE: DWORD = 0; +pub const CC_CIRCLES: DWORD = 1; +pub const CC_PIE: DWORD = 2; +pub const CC_CHORD: DWORD = 4; +pub const CC_ELLIPSES: DWORD = 8; +pub const CC_WIDE: DWORD = 16; +pub const CC_STYLED: DWORD = 32; +pub const CC_WIDESTYLED: DWORD = 64; +pub const CC_INTERIORS: DWORD = 128; +pub const CC_ROUNDRECT: DWORD = 256; +pub const LC_NONE: DWORD = 0; +pub const LC_POLYLINE: DWORD = 2; +pub const LC_MARKER: DWORD = 4; +pub const LC_POLYMARKER: DWORD = 8; +pub const LC_WIDE: DWORD = 16; +pub const LC_STYLED: DWORD = 32; +pub const LC_WIDESTYLED: DWORD = 64; +pub const LC_INTERIORS: DWORD = 128; +pub const PC_NONE: DWORD = 0; +pub const PC_POLYGON: DWORD = 1; +pub const PC_RECTANGLE: DWORD = 2; +pub const PC_WINDPOLYGON: DWORD = 4; +pub const PC_TRAPEZOID: DWORD = 4; +pub const PC_SCANLINE: DWORD = 8; +pub const PC_WIDE: DWORD = 16; +pub const PC_STYLED: DWORD = 32; +pub const PC_WIDESTYLED: DWORD = 64; +pub const PC_INTERIORS: DWORD = 128; +pub const PC_POLYPOLYGON: DWORD = 256; +pub const PC_PATHS: DWORD = 512; +pub const CP_NONE: DWORD = 0; +pub const CP_RECTANGLE: DWORD = 1; +pub const CP_REGION: DWORD = 2; +pub const TC_OP_CHARACTER: DWORD = 0x00000001; +pub const TC_OP_STROKE: DWORD = 0x00000002; +pub const TC_CP_STROKE: DWORD = 0x00000004; +pub const TC_CR_90: DWORD = 0x00000008; +pub const TC_CR_ANY: DWORD = 0x00000010; +pub const TC_SF_X_YINDEP: DWORD = 0x00000020; +pub const TC_SA_DOUBLE: DWORD = 0x00000040; +pub const TC_SA_INTEGER: DWORD = 0x00000080; +pub const TC_SA_CONTIN: DWORD = 0x00000100; +pub const TC_EA_DOUBLE: DWORD = 0x00000200; +pub const TC_IA_ABLE: DWORD = 0x00000400; +pub const TC_UA_ABLE: DWORD = 0x00000800; +pub const TC_SO_ABLE: DWORD = 0x00001000; +pub const TC_RA_ABLE: DWORD = 0x00002000; +pub const TC_VA_ABLE: DWORD = 0x00004000; +pub const TC_RESERVED: DWORD = 0x00008000; +pub const TC_SCROLLBLT: DWORD = 0x00010000; +pub const RC_BITBLT: DWORD = 1; +pub const RC_BANDING: DWORD = 2; +pub const RC_SCALING: DWORD = 4; +pub const RC_BITMAP64: DWORD = 8; +pub const RC_GDI20_OUTPUT: DWORD = 0x0010; +pub const RC_GDI20_STATE: DWORD = 0x0020; +pub const RC_SAVEBITMAP: DWORD = 0x0040; +pub const RC_DI_BITMAP: DWORD = 0x0080; +pub const RC_PALETTE: DWORD = 0x0100; +pub const RC_DIBTODEV: DWORD = 0x0200; +pub const RC_BIGFONT: DWORD = 0x0400; +pub const RC_STRETCHBLT: DWORD = 0x0800; +pub const RC_FLOODFILL: DWORD = 0x1000; +pub const RC_STRETCHDIB: DWORD = 0x2000; +pub const RC_OP_DX_OUTPUT: DWORD = 0x4000; +pub const RC_DEVBITS: DWORD = 0x8000; +pub const SB_NONE: DWORD = 0x00000000; +pub const SB_CONST_ALPHA: DWORD = 0x00000001; +pub const SB_PIXEL_ALPHA: DWORD = 0x00000002; +pub const SB_PREMULT_ALPHA: DWORD = 0x00000004; +pub const SB_GRAD_RECT: DWORD = 0x00000010; +pub const SB_GRAD_TRI: DWORD = 0x00000020; +pub const CM_NONE: DWORD = 0x00000000; +pub const CM_DEVICE_ICM: DWORD = 0x00000001; +pub const CM_GAMMA_RAMP: DWORD = 0x00000002; +pub const CM_CMYK_COLOR: DWORD = 0x00000004; +pub const DIB_RGB_COLORS: DWORD = 0; +pub const DIB_PAL_COLORS: DWORD = 1; +pub const SYSPAL_ERROR: DWORD = 0; +pub const SYSPAL_STATIC: DWORD = 1; +pub const SYSPAL_NOSTATIC: DWORD = 2; +pub const SYSPAL_NOSTATIC256: DWORD = 3; +pub const CBM_INIT: DWORD = 0x04; +pub const FLOODFILLBORDER: DWORD = 0; +pub const FLOODFILLSURFACE: DWORD = 1; +pub const CCHDEVICENAME: usize = 32; +pub const CCHFORMNAME: usize = 32; +STRUCT!{struct DEVMODE_u1_s1 { + dmOrientation: c_short, + dmPaperSize: c_short, + dmPaperLength: c_short, + dmPaperWidth: c_short, + dmScale: c_short, + dmCopies: c_short, + dmDefaultSource: c_short, + dmPrintQuality: c_short, +}} +STRUCT!{struct DEVMODE_u1_s2 { + dmPosition: POINTL, + dmDisplayOrientation: DWORD, + dmDisplayFixedOutput: DWORD, +}} +UNION!{union DEVMODE_u1 { + [u32; 4], + s1 s1_mut: DEVMODE_u1_s1, + s2 s2_mut: DEVMODE_u1_s2, +}} +UNION!{union DEVMODE_u2 { + [u32; 1], + dmDisplayFlags dmDisplayFlags_mut: DWORD, + dmNup dmNup_mut: DWORD, +}} +STRUCT!{struct DEVMODEA { + dmDeviceName: [CHAR; CCHDEVICENAME], + dmSpecVersion: WORD, + dmDriverVersion: WORD, + dmSize: WORD, + dmDriverExtra: WORD, + dmFields: DWORD, + u1: DEVMODE_u1, + dmColor: c_short, + dmDuplex: c_short, + dmYResolution: c_short, + dmTTOption: c_short, + dmCollate: c_short, + dmFormName: [CHAR; CCHFORMNAME], + dmLogPixels: WORD, + dmBitsPerPel: DWORD, + dmPelsWidth: DWORD, + dmPelsHeight: DWORD, + u2: DEVMODE_u2, + dmDisplayFrequency: DWORD, + dmICMMethod: DWORD, + dmICMIntent: DWORD, + dmMediaType: DWORD, + dmDitherType: DWORD, + dmReserved1: DWORD, + dmReserved2: DWORD, + dmPanningWidth: DWORD, + dmPanningHeight: DWORD, +}} +pub type PDEVMODEA = *mut DEVMODEA; +pub type NPDEVMODEA = *mut DEVMODEA; +pub type LPDEVMODEA = *mut DEVMODEA; +STRUCT!{struct DEVMODEW { + dmDeviceName: [WCHAR; CCHDEVICENAME], + dmSpecVersion: WORD, + dmDriverVersion: WORD, + dmSize: WORD, + dmDriverExtra: WORD, + dmFields: DWORD, + u1: DEVMODE_u1, + dmColor: c_short, + dmDuplex: c_short, + dmYResolution: c_short, + dmTTOption: c_short, + dmCollate: c_short, + dmFormName: [WCHAR; CCHFORMNAME], + dmLogPixels: WORD, + dmBitsPerPel: DWORD, + dmPelsWidth: DWORD, + dmPelsHeight: DWORD, + u2: DEVMODE_u2, + dmDisplayFrequency: DWORD, + dmICMMethod: DWORD, + dmICMIntent: DWORD, + dmMediaType: DWORD, + dmDitherType: DWORD, + dmReserved1: DWORD, + dmReserved2: DWORD, + dmPanningWidth: DWORD, + dmPanningHeight: DWORD, +}} +pub type PDEVMODEW = *mut DEVMODEW; +pub type NPDEVMODEW = *mut DEVMODEW; +pub type LPDEVMODEW = *mut DEVMODEW; +pub const DM_SPECVERSION: DWORD = 0x0401; +pub const DM_ORIENTATION: DWORD = 0x00000001; +pub const DM_PAPERSIZE: DWORD = 0x00000002; +pub const DM_PAPERLENGTH: DWORD = 0x00000004; +pub const DM_PAPERWIDTH: DWORD = 0x00000008; +pub const DM_SCALE: DWORD = 0x00000010; +pub const DM_POSITION: DWORD = 0x00000020; +pub const DM_NUP: DWORD = 0x00000040; +pub const DM_DISPLAYORIENTATION: DWORD = 0x00000080; +pub const DM_COPIES: DWORD = 0x00000100; +pub const DM_DEFAULTSOURCE: DWORD = 0x00000200; +pub const DM_PRINTQUALITY: DWORD = 0x00000400; +pub const DM_COLOR: DWORD = 0x00000800; +pub const DM_DUPLEX: DWORD = 0x00001000; +pub const DM_YRESOLUTION: DWORD = 0x00002000; +pub const DM_TTOPTION: DWORD = 0x00004000; +pub const DM_COLLATE: DWORD = 0x00008000; +pub const DM_FORMNAME: DWORD = 0x00010000; +pub const DM_LOGPIXELS: DWORD = 0x00020000; +pub const DM_BITSPERPEL: DWORD = 0x00040000; +pub const DM_PELSWIDTH: DWORD = 0x00080000; +pub const DM_PELSHEIGHT: DWORD = 0x00100000; +pub const DM_DISPLAYFLAGS: DWORD = 0x00200000; +pub const DM_DISPLAYFREQUENCY: DWORD = 0x00400000; +pub const DM_ICMMETHOD: DWORD = 0x00800000; +pub const DM_ICMINTENT: DWORD = 0x01000000; +pub const DM_MEDIATYPE: DWORD = 0x02000000; +pub const DM_DITHERTYPE: DWORD = 0x04000000; +pub const DM_PANNINGWIDTH: DWORD = 0x08000000; +pub const DM_PANNINGHEIGHT: DWORD = 0x10000000; +pub const DM_DISPLAYFIXEDOUTPUT: DWORD = 0x20000000; +pub const DMORIENT_PORTRAIT: DWORD = 1; +pub const DMORIENT_LANDSCAPE: DWORD = 2; +pub const DMPAPER_FIRST: DWORD = DMPAPER_LETTER; +pub const DMPAPER_LETTER: DWORD = 1; +pub const DMPAPER_LETTERSMALL: DWORD = 2; +pub const DMPAPER_TABLOID: DWORD = 3; +pub const DMPAPER_LEDGER: DWORD = 4; +pub const DMPAPER_LEGAL: DWORD = 5; +pub const DMPAPER_STATEMENT: DWORD = 6; +pub const DMPAPER_EXECUTIVE: DWORD = 7; +pub const DMPAPER_A3: DWORD = 8; +pub const DMPAPER_A4: DWORD = 9; +pub const DMPAPER_A4SMALL: DWORD = 10; +pub const DMPAPER_A5: DWORD = 11; +pub const DMPAPER_B4: DWORD = 12; +pub const DMPAPER_B5: DWORD = 13; +pub const DMPAPER_FOLIO: DWORD = 14; +pub const DMPAPER_QUARTO: DWORD = 15; +pub const DMPAPER_10X14: DWORD = 16; +pub const DMPAPER_11X17: DWORD = 17; +pub const DMPAPER_NOTE: DWORD = 18; +pub const DMPAPER_ENV_9: DWORD = 19; +pub const DMPAPER_ENV_10: DWORD = 20; +pub const DMPAPER_ENV_11: DWORD = 21; +pub const DMPAPER_ENV_12: DWORD = 22; +pub const DMPAPER_ENV_14: DWORD = 23; +pub const DMPAPER_CSHEET: DWORD = 24; +pub const DMPAPER_DSHEET: DWORD = 25; +pub const DMPAPER_ESHEET: DWORD = 26; +pub const DMPAPER_ENV_DL: DWORD = 27; +pub const DMPAPER_ENV_C5: DWORD = 28; +pub const DMPAPER_ENV_C3: DWORD = 29; +pub const DMPAPER_ENV_C4: DWORD = 30; +pub const DMPAPER_ENV_C6: DWORD = 31; +pub const DMPAPER_ENV_C65: DWORD = 32; +pub const DMPAPER_ENV_B4: DWORD = 33; +pub const DMPAPER_ENV_B5: DWORD = 34; +pub const DMPAPER_ENV_B6: DWORD = 35; +pub const DMPAPER_ENV_ITALY: DWORD = 36; +pub const DMPAPER_ENV_MONARCH: DWORD = 37; +pub const DMPAPER_ENV_PERSONAL: DWORD = 38; +pub const DMPAPER_FANFOLD_US: DWORD = 39; +pub const DMPAPER_FANFOLD_STD_GERMAN: DWORD = 40; +pub const DMPAPER_FANFOLD_LGL_GERMAN: DWORD = 41; +pub const DMPAPER_ISO_B4: DWORD = 42; +pub const DMPAPER_JAPANESE_POSTCARD: DWORD = 43; +pub const DMPAPER_9X11: DWORD = 44; +pub const DMPAPER_10X11: DWORD = 45; +pub const DMPAPER_15X11: DWORD = 46; +pub const DMPAPER_ENV_INVITE: DWORD = 47; +pub const DMPAPER_RESERVED_48: DWORD = 48; +pub const DMPAPER_RESERVED_49: DWORD = 49; +pub const DMPAPER_LETTER_EXTRA: DWORD = 50; +pub const DMPAPER_LEGAL_EXTRA: DWORD = 51; +pub const DMPAPER_TABLOID_EXTRA: DWORD = 52; +pub const DMPAPER_A4_EXTRA: DWORD = 53; +pub const DMPAPER_LETTER_TRANSVERSE: DWORD = 54; +pub const DMPAPER_A4_TRANSVERSE: DWORD = 55; +pub const DMPAPER_LETTER_EXTRA_TRANSVERSE: DWORD = 56; +pub const DMPAPER_A_PLUS: DWORD = 57; +pub const DMPAPER_B_PLUS: DWORD = 58; +pub const DMPAPER_LETTER_PLUS: DWORD = 59; +pub const DMPAPER_A4_PLUS: DWORD = 60; +pub const DMPAPER_A5_TRANSVERSE: DWORD = 61; +pub const DMPAPER_B5_TRANSVERSE: DWORD = 62; +pub const DMPAPER_A3_EXTRA: DWORD = 63; +pub const DMPAPER_A5_EXTRA: DWORD = 64; +pub const DMPAPER_B5_EXTRA: DWORD = 65; +pub const DMPAPER_A2: DWORD = 66; +pub const DMPAPER_A3_TRANSVERSE: DWORD = 67; +pub const DMPAPER_A3_EXTRA_TRANSVERSE: DWORD = 68; +pub const DMPAPER_DBL_JAPANESE_POSTCARD: DWORD = 69; +pub const DMPAPER_A6: DWORD = 70; +pub const DMPAPER_JENV_KAKU2: DWORD = 71; +pub const DMPAPER_JENV_KAKU3: DWORD = 72; +pub const DMPAPER_JENV_CHOU3: DWORD = 73; +pub const DMPAPER_JENV_CHOU4: DWORD = 74; +pub const DMPAPER_LETTER_ROTATED: DWORD = 75; +pub const DMPAPER_A3_ROTATED: DWORD = 76; +pub const DMPAPER_A4_ROTATED: DWORD = 77; +pub const DMPAPER_A5_ROTATED: DWORD = 78; +pub const DMPAPER_B4_JIS_ROTATED: DWORD = 79; +pub const DMPAPER_B5_JIS_ROTATED: DWORD = 80; +pub const DMPAPER_JAPANESE_POSTCARD_ROTATED: DWORD = 81; +pub const DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED: DWORD = 82; +pub const DMPAPER_A6_ROTATED: DWORD = 83; +pub const DMPAPER_JENV_KAKU2_ROTATED: DWORD = 84; +pub const DMPAPER_JENV_KAKU3_ROTATED: DWORD = 85; +pub const DMPAPER_JENV_CHOU3_ROTATED: DWORD = 86; +pub const DMPAPER_JENV_CHOU4_ROTATED: DWORD = 87; +pub const DMPAPER_B6_JIS: DWORD = 88; +pub const DMPAPER_B6_JIS_ROTATED: DWORD = 89; +pub const DMPAPER_12X11: DWORD = 90; +pub const DMPAPER_JENV_YOU4: DWORD = 91; +pub const DMPAPER_JENV_YOU4_ROTATED: DWORD = 92; +pub const DMPAPER_P16K: DWORD = 93; +pub const DMPAPER_P32K: DWORD = 94; +pub const DMPAPER_P32KBIG: DWORD = 95; +pub const DMPAPER_PENV_1: DWORD = 96; +pub const DMPAPER_PENV_2: DWORD = 97; +pub const DMPAPER_PENV_3: DWORD = 98; +pub const DMPAPER_PENV_4: DWORD = 99; +pub const DMPAPER_PENV_5: DWORD = 100; +pub const DMPAPER_PENV_6: DWORD = 101; +pub const DMPAPER_PENV_7: DWORD = 102; +pub const DMPAPER_PENV_8: DWORD = 103; +pub const DMPAPER_PENV_9: DWORD = 104; +pub const DMPAPER_PENV_10: DWORD = 105; +pub const DMPAPER_P16K_ROTATED: DWORD = 106; +pub const DMPAPER_P32K_ROTATED: DWORD = 107; +pub const DMPAPER_P32KBIG_ROTATED: DWORD = 108; +pub const DMPAPER_PENV_1_ROTATED: DWORD = 109; +pub const DMPAPER_PENV_2_ROTATED: DWORD = 110; +pub const DMPAPER_PENV_3_ROTATED: DWORD = 111; +pub const DMPAPER_PENV_4_ROTATED: DWORD = 112; +pub const DMPAPER_PENV_5_ROTATED: DWORD = 113; +pub const DMPAPER_PENV_6_ROTATED: DWORD = 114; +pub const DMPAPER_PENV_7_ROTATED: DWORD = 115; +pub const DMPAPER_PENV_8_ROTATED: DWORD = 116; +pub const DMPAPER_PENV_9_ROTATED: DWORD = 117; +pub const DMPAPER_PENV_10_ROTATED: DWORD = 118; +pub const DMPAPER_LAST: DWORD = DMPAPER_PENV_10_ROTATED; +pub const DMPAPER_USER: DWORD = 256; +pub const DMBIN_FIRST: DWORD = DMBIN_UPPER; +pub const DMBIN_UPPER: DWORD = 1; +pub const DMBIN_ONLYONE: DWORD = 1; +pub const DMBIN_LOWER: DWORD = 2; +pub const DMBIN_MIDDLE: DWORD = 3; +pub const DMBIN_MANUAL: DWORD = 4; +pub const DMBIN_ENVELOPE: DWORD = 5; +pub const DMBIN_ENVMANUAL: DWORD = 6; +pub const DMBIN_AUTO: DWORD = 7; +pub const DMBIN_TRACTOR: DWORD = 8; +pub const DMBIN_SMALLFMT: DWORD = 9; +pub const DMBIN_LARGEFMT: DWORD = 10; +pub const DMBIN_LARGECAPACITY: DWORD = 11; +pub const DMBIN_CASSETTE: DWORD = 14; +pub const DMBIN_FORMSOURCE: DWORD = 15; +pub const DMBIN_LAST: DWORD = DMBIN_FORMSOURCE; +pub const DMBIN_USER: DWORD = 256; +pub const DMRES_DRAFT: c_int = -1; +pub const DMRES_LOW: c_int = -2; +pub const DMRES_MEDIUM: c_int = -3; +pub const DMRES_HIGH: c_int = -4; +pub const DMCOLOR_MONOCHROME: DWORD = 1; +pub const DMCOLOR_COLOR: DWORD = 2; +pub const DMDUP_SIMPLEX: DWORD = 1; +pub const DMDUP_VERTICAL: DWORD = 2; +pub const DMDUP_HORIZONTAL: DWORD = 3; +pub const DMTT_BITMAP: DWORD = 1; +pub const DMTT_DOWNLOAD: DWORD = 2; +pub const DMTT_SUBDEV: DWORD = 3; +pub const DMTT_DOWNLOAD_OUTLINE: DWORD = 4; +pub const DMCOLLATE_FALSE: DWORD = 0; +pub const DMCOLLATE_TRUE: DWORD = 1; +pub const DMDO_DEFAULT: DWORD = 0; +pub const DMDO_90: DWORD = 1; +pub const DMDO_180: DWORD = 2; +pub const DMDO_270: DWORD = 3; +pub const DMDFO_DEFAULT: DWORD = 0; +pub const DMDFO_STRETCH: DWORD = 1; +pub const DMDFO_CENTER: DWORD = 2; +pub const DM_INTERLACED: DWORD = 0x00000002; +pub const DMDISPLAYFLAGS_TEXTMODE: DWORD = 0x00000004; +pub const DMNUP_SYSTEM: DWORD = 1; +pub const DMNUP_ONEUP: DWORD = 2; +pub const DMICMMETHOD_NONE: DWORD = 1; +pub const DMICMMETHOD_SYSTEM: DWORD = 2; +pub const DMICMMETHOD_DRIVER: DWORD = 3; +pub const DMICMMETHOD_DEVICE: DWORD = 4; +pub const DMICMMETHOD_USER: DWORD = 256; +pub const DMICM_SATURATE: DWORD = 1; +pub const DMICM_CONTRAST: DWORD = 2; +pub const DMICM_COLORIMETRIC: DWORD = 3; +pub const DMICM_ABS_COLORIMETRIC: DWORD = 4; +pub const DMICM_USER: DWORD = 256; +pub const DMMEDIA_STANDARD: DWORD = 1; +pub const DMMEDIA_TRANSPARENCY: DWORD = 2; +pub const DMMEDIA_GLOSSY: DWORD = 3; +pub const DMMEDIA_USER: DWORD = 256; +pub const DMDITHER_NONE: DWORD = 1; +pub const DMDITHER_COARSE: DWORD = 2; +pub const DMDITHER_FINE: DWORD = 3; +pub const DMDITHER_LINEART: DWORD = 4; +pub const DMDITHER_ERRORDIFFUSION: DWORD = 5; +pub const DMDITHER_RESERVED6: DWORD = 6; +pub const DMDITHER_RESERVED7: DWORD = 7; +pub const DMDITHER_RESERVED8: DWORD = 8; +pub const DMDITHER_RESERVED9: DWORD = 9; +pub const DMDITHER_GRAYSCALE: DWORD = 10; +pub const DMDITHER_USER: DWORD = 256; +STRUCT!{struct DISPLAY_DEVICEA { + cb: DWORD, + DeviceName: [CHAR; 32], + DeviceString: [CHAR; 128], + StateFlags: DWORD, + DeviceID: [CHAR; 128], + DeviceKey: [CHAR; 128], +}} +pub type PDISPLAY_DEVICEA = *mut DISPLAY_DEVICEA; +pub type LPDISPLAY_DEVICEA = *mut DISPLAY_DEVICEA; +STRUCT!{struct DISPLAY_DEVICEW { + cb: DWORD, + DeviceName: [WCHAR; 32], + DeviceString: [WCHAR; 128], + StateFlags: DWORD, + DeviceID: [WCHAR; 128], + DeviceKey: [WCHAR; 128], +}} +pub type PDISPLAY_DEVICEW = *mut DISPLAY_DEVICEW; +pub type LPDISPLAY_DEVICEW = *mut DISPLAY_DEVICEW; +pub const DISPLAY_DEVICE_ATTACHED_TO_DESKTOP: DWORD = 0x00000001; +pub const DISPLAY_DEVICE_MULTI_DRIVER: DWORD = 0x00000002; +pub const DISPLAY_DEVICE_PRIMARY_DEVICE: DWORD = 0x00000004; +pub const DISPLAY_DEVICE_MIRRORING_DRIVER: DWORD = 0x00000008; +pub const DISPLAY_DEVICE_VGA_COMPATIBLE: DWORD = 0x00000010; +pub const DISPLAY_DEVICE_REMOVABLE: DWORD = 0x00000020; +pub const DISPLAY_DEVICE_ACC_DRIVER: DWORD = 0x00000040; +pub const DISPLAY_DEVICE_MODESPRUNED: DWORD = 0x08000000; +pub const DISPLAY_DEVICE_RDPUDD: DWORD = 0x01000000; +pub const DISPLAY_DEVICE_REMOTE: DWORD = 0x04000000; +pub const DISPLAY_DEVICE_DISCONNECT: DWORD = 0x02000000; +pub const DISPLAY_DEVICE_TS_COMPATIBLE: DWORD = 0x00200000; +pub const DISPLAY_DEVICE_UNSAFE_MODES_ON: DWORD = 0x00080000; +pub const DISPLAY_DEVICE_ACTIVE: DWORD = 0x00000001; +pub const DISPLAY_DEVICE_ATTACHED: DWORD = 0x00000002; +pub const DISPLAYCONFIG_MAXPATH: usize = 1024; +STRUCT!{struct DISPLAYCONFIG_RATIONAL { + Numerator: UINT32, + Denominator: UINT32, +}} +ENUM!{enum DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY { + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER = -1i32 as u32, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HD15 = 0, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SVIDEO = 1, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPOSITE_VIDEO = 2, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPONENT_VIDEO = 3, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DVI = 4, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI = 5, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_LVDS = 6, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_D_JPN = 8, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDI = 9, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EXTERNAL = 10, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED = 11, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EXTERNAL = 12, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED = 13, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDTVDONGLE = 14, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_MIRACAST = 15, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INDIRECT_WIRED = 16, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL = 0x80000000, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_FORCE_UINT32 = 0xFFFFFFFF, +}} +ENUM!{enum DISPLAYCONFIG_SCANLINE_ORDERING { + DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED = 0, + DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE = 1, + DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED = 2, + DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_UPPERFIELDFIRST = DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED, + DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_LOWERFIELDFIRST = 3, + DISPLAYCONFIG_SCANLINE_ORDERING_FORCE_UINT32 = 0xFFFFFFFF, +}} +STRUCT!{struct DISPLAYCONFIG_2DREGION { + cx: UINT32, + cy: UINT32, +}} +STRUCT!{struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO_AdditionalSignalInfo { + bitfield: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_VIDEO_SIGNAL_INFO_AdditionalSignalInfo bitfield: UINT32 [ + videoStandard set_videoStandard[0..16], + vSyncFreqDivider set_vSyncFreqDivider[16..22], +]} +UNION!{union DISPLAYCONFIG_VIDEO_SIGNAL_INFO_u { + [u32; 1], + AdditionalSignalInfo AdditionalSignalInfo_mut: + DISPLAYCONFIG_VIDEO_SIGNAL_INFO_AdditionalSignalInfo, + videoStandard videoStandard_mut: UINT32, +}} +STRUCT!{struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO { + pixelRate: UINT64, + hSyncFreq: DISPLAYCONFIG_RATIONAL, + vSyncFreq: DISPLAYCONFIG_RATIONAL, + activeSize: DISPLAYCONFIG_2DREGION, + totalSize: DISPLAYCONFIG_2DREGION, + u: DISPLAYCONFIG_VIDEO_SIGNAL_INFO_u, + scanLineOrdering: DISPLAYCONFIG_SCANLINE_ORDERING, +}} +ENUM!{enum DISPLAYCONFIG_SCALING { + DISPLAYCONFIG_SCALING_IDENTITY = 1, + DISPLAYCONFIG_SCALING_CENTERED = 2, + DISPLAYCONFIG_SCALING_STRETCHED = 3, + DISPLAYCONFIG_SCALING_ASPECTRATIOCENTEREDMAX = 4, + DISPLAYCONFIG_SCALING_CUSTOM = 5, + DISPLAYCONFIG_SCALING_PREFERRED = 128, + DISPLAYCONFIG_SCALING_FORCE_UINT32 = 0xFFFFFFFF, +}} +ENUM!{enum DISPLAYCONFIG_ROTATION { + DISPLAYCONFIG_ROTATION_IDENTITY = 1, + DISPLAYCONFIG_ROTATION_ROTATE90 = 2, + DISPLAYCONFIG_ROTATION_ROTATE180 = 3, + DISPLAYCONFIG_ROTATION_ROTATE270 = 4, + DISPLAYCONFIG_ROTATION_FORCE_UINT32 = 0xFFFFFFFF, +}} +ENUM!{enum DISPLAYCONFIG_MODE_INFO_TYPE { + DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE = 1, + DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2, + DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE = 3, + DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32 = 0xFFFFFFFF, +}} +ENUM!{enum DISPLAYCONFIG_PIXELFORMAT { + DISPLAYCONFIG_PIXELFORMAT_8BPP = 1, + DISPLAYCONFIG_PIXELFORMAT_16BPP = 2, + DISPLAYCONFIG_PIXELFORMAT_24BPP = 3, + DISPLAYCONFIG_PIXELFORMAT_32BPP = 4, + DISPLAYCONFIG_PIXELFORMAT_NONGDI = 5, + DISPLAYCONFIG_PIXELFORMAT_FORCE_UINT32 = 0xffffffff, +}} +STRUCT!{struct DISPLAYCONFIG_SOURCE_MODE { + width: UINT32, + height: UINT32, + pixelFormat: DISPLAYCONFIG_PIXELFORMAT, + position: POINTL, +}} +STRUCT!{struct DISPLAYCONFIG_TARGET_MODE { + targetVideoSignalInfo: DISPLAYCONFIG_VIDEO_SIGNAL_INFO, +}} +UNION!{union DISPLAYCONFIG_MODE_INFO_u { + [u64; 6], + targetMode targetMode_mut: DISPLAYCONFIG_TARGET_MODE, + sourceMode sourceMode_mut: DISPLAYCONFIG_SOURCE_MODE, + desktopImageInfo desktopImageInfo_mut: DISPLAYCONFIG_DESKTOP_IMAGE_INFO, +}} +STRUCT!{struct DISPLAYCONFIG_DESKTOP_IMAGE_INFO { + infoType: DISPLAYCONFIG_MODE_INFO_TYPE, + id: UINT32, + adapterId: LUID, +}} +pub const DISPLAYCONFIG_PATH_MODE_IDX_INVALID: DWORD = 0xffffffff; +pub const DISPLAYCONFIG_PATH_TARGET_MODE_IDX_INVALID: DWORD = 0xffff; +pub const DISPLAYCONFIG_PATH_DESKTOP_IMAGE_IDX_INVALID: DWORD = 0xffff; +pub const DISPLAYCONFIG_PATH_SOURCE_MODE_IDX_INVALID: DWORD = 0xffff; +pub const DISPLAYCONFIG_PATH_CLONE_GROUP_INVALID: DWORD = 0xffff; +STRUCT!{struct DISPLAYCONFIG_PATH_SOURCE_INFO { + adapterId: LUID, + id: UINT32, + modeInfoIdx: UINT32, + statusFlags: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_PATH_SOURCE_INFO modeInfoIdx: UINT32 [ + cloneGroupId set_cloneGroupId[0..16], + sourceModeInfoIdx set_sourceModeInfoIdx[16..32], +]} +pub const DISPLAYCONFIG_SOURCE_IN_USE: DWORD = 0x00000001; +STRUCT!{struct DISPLAYCONFIG_PATH_TARGET_INFO { + adapterId: LUID, + id: UINT32, + modeInfoIdx: UINT32, + outputTechnology: DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY, + rotation: DISPLAYCONFIG_ROTATION, + scaling: DISPLAYCONFIG_SCALING, + refreshRate: DISPLAYCONFIG_RATIONAL, + scanLineOrdering: DISPLAYCONFIG_SCANLINE_ORDERING, + targetAvailable: BOOL, + statusFlags: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_PATH_TARGET_INFO modeInfoIdx: UINT32 [ + desktopModeInfoIdx set_desktopModeInfoIdx[0..16], + targetModeInfoIdx set_targetModeInfoIdx[16..32], +]} +pub const DISPLAYCONFIG_TARGET_IN_USE: DWORD = 0x00000001; +pub const DISPLAYCONFIG_TARGET_FORCIBLE: DWORD = 0x00000002; +pub const DISPLAYCONFIG_TARGET_FORCED_AVAILABILITY_BOOT: DWORD = 0x00000004; +pub const DISPLAYCONFIG_TARGET_FORCED_AVAILABILITY_PATH: DWORD = 0x00000008; +pub const DISPLAYCONFIG_TARGET_FORCED_AVAILABILITY_SYSTEM: DWORD = 0x00000010; +pub const DISPLAYCONFIG_TARGET_IS_HMD: DWORD = 0x00000020; +STRUCT!{struct DISPLAYCONFIG_PATH_INFO { + sourceInfo: DISPLAYCONFIG_PATH_SOURCE_INFO, + targetInfo: DISPLAYCONFIG_PATH_TARGET_INFO, + flags: UINT32, +}} +pub const DISPLAYCONFIG_PATH_ACTIVE: DWORD = 0x00000001; +pub const DISPLAYCONFIG_PATH_PREFERRED_UNSCALED: DWORD = 0x00000004; +pub const DISPLAYCONFIG_PATH_SUPPORT_VIRTUAL_MODE: DWORD = 0x00000008; +pub const DISPLAYCONFIG_PATH_VALID_FLAGS: DWORD = 0x0000000D; +ENUM!{enum DISPLAYCONFIG_TOPOLOGY_ID { + DISPLAYCONFIG_TOPOLOGY_INTERNAL = 0x00000001, + DISPLAYCONFIG_TOPOLOGY_CLONE = 0x00000002, + DISPLAYCONFIG_TOPOLOGY_EXTEND = 0x00000004, + DISPLAYCONFIG_TOPOLOGY_EXTERNAL = 0x00000008, + DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = 0xFFFFFFFF, +}} +ENUM!{enum DISPLAYCONFIG_DEVICE_INFO_TYPE { + DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1, + DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME = 2, + DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE = 3, + DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME = 4, + DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE = 5, + DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE = 6, + DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION = 7, + DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION = 8, + DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO = 9, + DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE = 10, + DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = 0xFFFFFFFF, +}} +STRUCT!{struct DISPLAYCONFIG_DEVICE_INFO_HEADER { + _type: DISPLAYCONFIG_DEVICE_INFO_TYPE, + size: UINT32, + adapterId: LUID, + id: UINT32, +}} +STRUCT!{struct DISPLAYCONFIG_SOURCE_DEVICE_NAME { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + viewGdiDeviceName: [WCHAR; CCHDEVICENAME], +}} +STRUCT!{struct DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS { + value: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS value: UINT32 [ + friendlyNameFromEdid set_friendlyNameFromEdid[0..1], + friendlyNameForced set_friendlyNameForced[1..2], + edidIdsValid set_edidIdsValid[2..3], +]} +STRUCT!{struct DISPLAYCONFIG_TARGET_DEVICE_NAME { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + flags: DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS, + outputTechnology: DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY, + edidManufactureId: UINT16, + edidProductCodeId: UINT16, + connectorInstance: UINT32, + monitorFriendlyDeviceName: [WCHAR; 64], + monitorDevicePath: [WCHAR; 128], +}} +STRUCT!{struct DISPLAYCONFIG_TARGET_PREFERRED_MODE { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + width: UINT32, + height: UINT32, + targetMode: DISPLAYCONFIG_TARGET_MODE, +}} +STRUCT!{struct DISPLAYCONFIG_ADAPTER_NAME { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + adapterDevicePath: [WCHAR; 128], +}} +STRUCT!{struct DISPLAYCONFIG_TARGET_BASE_TYPE { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + baseOutputTechnology: DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY, +}} +STRUCT!{struct DISPLAYCONFIG_SET_TARGET_PERSISTENCE { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + value: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_SET_TARGET_PERSISTENCE value: UINT32 [ + bootPersistenceOn set_bootPersistenceOn[0..1], +]} +STRUCT!{struct DISPLAYCONFIG_SUPPORT_VIRTUAL_RESOLUTION { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + value: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_SUPPORT_VIRTUAL_RESOLUTION value: UINT32 [ + disableMonitorVirtualResolution set_disableMonitorVirtualResolution[0..1], +]} +ENUM!{enum DISPLAYCONFIG_COLOR_ENCODING { + DISPLAYCONFIG_COLOR_ENCODING_RGB = 0, + DISPLAYCONFIG_COLOR_ENCODING_YCBCR444 = 1, + DISPLAYCONFIG_COLOR_ENCODING_YCBCR422 = 2, + DISPLAYCONFIG_COLOR_ENCODING_YCBCR420 = 3, + DISPLAYCONFIG_COLOR_ENCODING_INTENSITY = 4, + DISPLAYCONFIG_COLOR_ENCODING_FORCE_UINT32 = 0xFFFFFFFF, +}} +STRUCT!{struct DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + value: UINT32, + colorEncoding: DISPLAYCONFIG_COLOR_ENCODING, + bitsPerColorChannel: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO value: UINT32 [ + advancedColorSupported set_advancedColorSupported[0..1], + advancedColorEnabled set_advancedColorEnabled[1..2], + reserved set_reserved[2..32], +]} +STRUCT!{struct DISPLAYCONFIG_SET_ADVANCED_COLOR_STATE { + header: DISPLAYCONFIG_DEVICE_INFO_HEADER, + value: UINT32, +}} +BITFIELD!{DISPLAYCONFIG_SET_ADVANCED_COLOR_STATE value: UINT32 [ + enableAdvancedColor set_enableAdvancedColor[0..1], + reserved set_reserved[1..32], +]} +pub const QDC_ALL_PATHS: DWORD = 0x00000001; +pub const QDC_ONLY_ACTIVE_PATHS: DWORD = 0x00000002; +pub const QDC_DATABASE_CURRENT: DWORD = 0x00000004; +pub const QDC_VIRTUAL_MODE_AWARE: DWORD = 0x00000010; +pub const QDC_INCLUDE_HMD: DWORD = 0x00000020; +pub const SDC_TOPOLOGY_INTERNAL: DWORD = 0x00000001; +pub const SDC_TOPOLOGY_CLONE: DWORD = 0x00000002; +pub const SDC_TOPOLOGY_EXTEND: DWORD = 0x00000004; +pub const SDC_TOPOLOGY_EXTERNAL: DWORD = 0x00000008; +pub const SDC_TOPOLOGY_SUPPLIED: DWORD = 0x00000010; +pub const SDC_USE_DATABASE_CURRENT: DWORD = SDC_TOPOLOGY_INTERNAL | SDC_TOPOLOGY_CLONE + | SDC_TOPOLOGY_EXTEND | SDC_TOPOLOGY_EXTERNAL; +pub const SDC_USE_SUPPLIED_DISPLAY_CONFIG: DWORD = 0x00000020; +pub const SDC_VALIDATE: DWORD = 0x00000040; +pub const SDC_APPLY: DWORD = 0x00000080; +pub const SDC_NO_OPTIMIZATION: DWORD = 0x00000100; +pub const SDC_SAVE_TO_DATABASE: DWORD = 0x00000200; +pub const SDC_ALLOW_CHANGES: DWORD = 0x00000400; +pub const SDC_PATH_PERSIST_IF_REQUIRED: DWORD = 0x00000800; +pub const SDC_FORCE_MODE_ENUMERATION: DWORD = 0x00001000; +pub const SDC_ALLOW_PATH_ORDER_CHANGES: DWORD = 0x00002000; +pub const SDC_VIRTUAL_MODE_AWARE: DWORD = 0x00008000; +pub const RDH_RECTANGLES: DWORD = 1; +STRUCT!{struct RGNDATAHEADER { + dwSize: DWORD, + iType: DWORD, + nCount: DWORD, + nRgnSize: DWORD, + rcBound: RECT, +}} +pub type PRGNDATAHEADER = *mut RGNDATAHEADER; +STRUCT!{struct RGNDATA { + rdh: RGNDATAHEADER, + Buffer: [c_char; 0], +}} +pub type PRGNDATA = *mut RGNDATA; +pub type NPRGNDATA = *mut RGNDATA; +pub type LPRGNDATA = *mut RGNDATA; +pub const SYSRGN: INT = 4; +STRUCT!{struct ABC { + abcA: c_int, + abcB: UINT, + abcC: c_int, +}} +pub type PABC = *mut ABC; +pub type NPABC = *mut ABC; +pub type LPABC = *mut ABC; +STRUCT!{struct ABCFLOAT { + abcfA: FLOAT, + abcfB: FLOAT, + abcfC: FLOAT, +}} +pub type PABCFLOAT = *mut ABCFLOAT; +pub type NPABCFLOAT = *mut ABCFLOAT; +pub type LPABCFLOAT = *mut ABCFLOAT; +STRUCT!{struct OUTLINETEXTMETRICA { + otmSize: UINT, + otmTextMetrics: TEXTMETRICA, + otmFiller: BYTE, + otmPanoseNumber: PANOSE, + otmfsSelection: UINT, + otmfsType: UINT, + otmsCharSlopeRise: c_int, + otmsCharSlopeRun: c_int, + otmItalicAngle: c_int, + otmEMSquare: UINT, + otmAscent: c_int, + otmDescent: c_int, + otmLineGap: UINT, + otmsCapEmHeight: UINT, + otmsXHeight: UINT, + otmrcFontBox: RECT, + otmMacAscent: c_int, + otmMacDescent: c_int, + otmMacLineGap: UINT, + otmusMinimumPPEM: UINT, + otmptSubscriptSize: POINT, + otmptSubscriptOffset: POINT, + otmptSuperscriptSize: POINT, + otmptSuperscriptOffset: POINT, + otmsStrikeoutSize: UINT, + otmsStrikeoutPosition: c_int, + otmsUnderscoreSize: c_int, + otmsUnderscorePosition: c_int, + otmpFamilyName: PSTR, + otmpFaceName: PSTR, + otmpStyleName: PSTR, + otmpFullName: PSTR, +}} +pub type POUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; +pub type NPOUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; +pub type LPOUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; +STRUCT!{struct OUTLINETEXTMETRICW { + otmSize: UINT, + otmTextMetrics: TEXTMETRICW, + otmFiller: BYTE, + otmPanoseNumber: PANOSE, + otmfsSelection: UINT, + otmfsType: UINT, + otmsCharSlopeRise: c_int, + otmsCharSlopeRun: c_int, + otmItalicAngle: c_int, + otmEMSquare: UINT, + otmAscent: c_int, + otmDescent: c_int, + otmLineGap: UINT, + otmsCapEmHeight: UINT, + otmsXHeight: UINT, + otmrcFontBox: RECT, + otmMacAscent: c_int, + otmMacDescent: c_int, + otmMacLineGap: UINT, + otmusMinimumPPEM: UINT, + otmptSubscriptSize: POINT, + otmptSubscriptOffset: POINT, + otmptSuperscriptSize: POINT, + otmptSuperscriptOffset: POINT, + otmsStrikeoutSize: UINT, + otmsStrikeoutPosition: c_int, + otmsUnderscoreSize: c_int, + otmsUnderscorePosition: c_int, + otmpFamilyName: PSTR, + otmpFaceName: PSTR, + otmpStyleName: PSTR, + otmpFullName: PSTR, +}} +pub type POUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; +pub type NPOUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; +pub type LPOUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; +STRUCT!{struct POLYTEXTA { + x: c_int, + y: c_int, + n: UINT, + lpstr: LPCSTR, + uiFlags: UINT, + rcl: RECT, + pdx: *mut c_int, +}} +pub type PPOLYTEXTA = *mut POLYTEXTA; +pub type NPPOLYTEXTA = *mut POLYTEXTA; +pub type LPPOLYTEXTA = *mut POLYTEXTA; +STRUCT!{struct POLYTEXTW { + x: c_int, + y: c_int, + n: UINT, + lpstr: LPCWSTR, + uiFlags: UINT, + rcl: RECT, + pdx: *mut c_int, +}} +pub type PPOLYTEXTW = *mut POLYTEXTW; +pub type NPPOLYTEXTW = *mut POLYTEXTW; +pub type LPPOLYTEXTW = *mut POLYTEXTW; +STRUCT!{struct FIXED { + fract: WORD, + value: c_short, +}} +STRUCT!{struct MAT2 { + eM11: FIXED, + eM12: FIXED, + eM21: FIXED, + eM22: FIXED, +}} +pub type LPMAT2 = *mut MAT2; +STRUCT!{struct GLYPHMETRICS { + gmBlackBoxX: UINT, + gmBlackBoxY: UINT, + gmptGlyphOrigin: POINT, + gmCellIncX: c_short, + gmCellIncY: c_short, +}} +pub type LPGLYPHMETRICS = *mut GLYPHMETRICS; +pub const GGO_METRICS: DWORD = 0; +pub const GGO_BITMAP: DWORD = 1; +pub const GGO_NATIVE: DWORD = 2; +pub const GGO_BEZIER: DWORD = 3; +pub const GGO_GRAY2_BITMAP: DWORD = 4; +pub const GGO_GRAY4_BITMAP: DWORD = 5; +pub const GGO_GRAY8_BITMAP: DWORD = 6; +pub const GGO_GLYPH_INDEX: DWORD = 0x0080; +pub const GGO_UNHINTED: DWORD = 0x0100; +pub const TT_POLYGON_TYPE: DWORD = 24; +pub const TT_PRIM_LINE: DWORD = 1; +pub const TT_PRIM_QSPLINE: DWORD = 2; +pub const TT_PRIM_CSPLINE: DWORD = 3; +STRUCT!{struct POINTFX { + x: FIXED, + y: FIXED, +}} +pub type LPPOINTFX = *mut POINTFX; +STRUCT!{struct TTPOLYCURVE { + wType: WORD, + cpfx: WORD, + apfx: [POINTFX; 0], +}} +pub type LPTTPOLYCURVE = *mut TTPOLYCURVE; +STRUCT!{struct TTPOLYGONHEADER { + cb: DWORD, + dwType: DWORD, + pfxStart: POINTFX, +}} +pub type LPTTPOLYGONHEADER = *mut TTPOLYGONHEADER; +pub const GCP_DBCS: DWORD = 0x0001; +pub const GCP_REORDER: DWORD = 0x0002; +pub const GCP_USEKERNING: DWORD = 0x0008; +pub const GCP_GLYPHSHAPE: DWORD = 0x0010; +pub const GCP_LIGATE: DWORD = 0x0020; +pub const GCP_DIACRITIC: DWORD = 0x0100; +pub const GCP_KASHIDA: DWORD = 0x0400; +pub const GCP_ERROR: DWORD = 0x8000; +pub const FLI_MASK: DWORD = 0x103B; +pub const GCP_JUSTIFY: DWORD = 0x00010000; +pub const FLI_GLYPHS: DWORD = 0x00040000; +pub const GCP_CLASSIN: DWORD = 0x00080000; +pub const GCP_MAXEXTENT: DWORD = 0x00100000; +pub const GCP_JUSTIFYIN: DWORD = 0x00200000; +pub const GCP_DISPLAYZWG: DWORD = 0x00400000; +pub const GCP_SYMSWAPOFF: DWORD = 0x00800000; +pub const GCP_NUMERICOVERRIDE: DWORD = 0x01000000; +pub const GCP_NEUTRALOVERRIDE: DWORD = 0x02000000; +pub const GCP_NUMERICSLATIN: DWORD = 0x04000000; +pub const GCP_NUMERICSLOCAL: DWORD = 0x08000000; +pub const GCPCLASS_LATIN: DWORD = 1; +pub const GCPCLASS_HEBREW: DWORD = 2; +pub const GCPCLASS_ARABIC: DWORD = 2; +pub const GCPCLASS_NEUTRAL: DWORD = 3; +pub const GCPCLASS_LOCALNUMBER: DWORD = 4; +pub const GCPCLASS_LATINNUMBER: DWORD = 5; +pub const GCPCLASS_LATINNUMERICTERMINATOR: DWORD = 6; +pub const GCPCLASS_LATINNUMERICSEPARATOR: DWORD = 7; +pub const GCPCLASS_NUMERICSEPARATOR: DWORD = 8; +pub const GCPCLASS_PREBOUNDLTR: DWORD = 0x80; +pub const GCPCLASS_PREBOUNDRTL: DWORD = 0x40; +pub const GCPCLASS_POSTBOUNDLTR: DWORD = 0x20; +pub const GCPCLASS_POSTBOUNDRTL: DWORD = 0x10; +pub const GCPGLYPH_LINKBEFORE: DWORD = 0x8000; +pub const GCPGLYPH_LINKAFTER: DWORD = 0x4000; +STRUCT!{struct GCP_RESULTSA { + lStructSize: DWORD, + lpOutString: LPSTR, + lpOrder: *mut UINT, + lpDx: *mut c_int, + lpCaretPos: *mut c_int, + lpClass: LPSTR, + lpGlyphs: LPWSTR, + nGlyphs: UINT, + nMaxFit: c_int, +}} +pub type LPGCP_RESULTSA = *mut GCP_RESULTSA; +STRUCT!{struct GCP_RESULTSW { + lStructSize: DWORD, + lpOutString: LPWSTR, + lpOrder: *mut UINT, + lpDx: *mut c_int, + lpCaretPos: *mut c_int, + lpClass: LPSTR, + lpGlyphs: LPWSTR, + nGlyphs: UINT, + nMaxFit: c_int, +}} +pub type LPGCP_RESULTSW = *mut GCP_RESULTSW; +STRUCT!{struct RASTERIZER_STATUS { + nSize: c_short, + wFlags: c_short, + nLanguageID: c_short, +}} +pub type LPRASTERIZER_STATUS = *mut RASTERIZER_STATUS; +pub const TT_AVAILABLE: DWORD = 0x0001; +pub const TT_ENABLED: DWORD = 0x0002; +STRUCT!{struct PIXELFORMATDESCRIPTOR { + nSize: WORD, + nVersion: WORD, + dwFlags: DWORD, + iPixelType: BYTE, + cColorBits: BYTE, + cRedBits: BYTE, + cRedShift: BYTE, + cGreenBits: BYTE, + cGreenShift: BYTE, + cBlueBits: BYTE, + cBlueShift: BYTE, + cAlphaBits: BYTE, + cAlphaShift: BYTE, + cAccumBits: BYTE, + cAccumRedBits: BYTE, + cAccumGreenBits: BYTE, + cAccumBlueBits: BYTE, + cAccumAlphaBits: BYTE, + cDepthBits: BYTE, + cStencilBits: BYTE, + cAuxBuffers: BYTE, + iLayerType: BYTE, + bReserved: BYTE, + dwLayerMask: DWORD, + dwVisibleMask: DWORD, + dwDamageMask: DWORD, +}} +pub type PPIXELFORMATDESCRIPTOR = *mut PIXELFORMATDESCRIPTOR; +pub type LPPIXELFORMATDESCRIPTOR = *mut PIXELFORMATDESCRIPTOR; +pub const PFD_TYPE_RGBA: BYTE = 0; +pub const PFD_TYPE_COLORINDEX: BYTE = 1; +pub const PFD_MAIN_PLANE: BYTE = 0; +pub const PFD_OVERLAY_PLANE: BYTE = 1; +pub const PFD_UNDERLAY_PLANE: BYTE = -1i8 as u8; +pub const PFD_DOUBLEBUFFER: DWORD = 0x00000001; +pub const PFD_STEREO: DWORD = 0x00000002; +pub const PFD_DRAW_TO_WINDOW: DWORD = 0x00000004; +pub const PFD_DRAW_TO_BITMAP: DWORD = 0x00000008; +pub const PFD_SUPPORT_GDI: DWORD = 0x00000010; +pub const PFD_SUPPORT_OPENGL: DWORD = 0x00000020; +pub const PFD_GENERIC_FORMAT: DWORD = 0x00000040; +pub const PFD_NEED_PALETTE: DWORD = 0x00000080; +pub const PFD_NEED_SYSTEM_PALETTE: DWORD = 0x00000100; +pub const PFD_SWAP_EXCHANGE: DWORD = 0x00000200; +pub const PFD_SWAP_COPY: DWORD = 0x00000400; +pub const PFD_SWAP_LAYER_BUFFERS: DWORD = 0x00000800; +pub const PFD_GENERIC_ACCELERATED: DWORD = 0x00001000; +pub const PFD_SUPPORT_DIRECTDRAW: DWORD = 0x00002000; +pub const PFD_DIRECT3D_ACCELERATED: DWORD = 0x00004000; +pub const PFD_SUPPORT_COMPOSITION: DWORD = 0x00008000; +pub const PFD_DEPTH_DONTCARE: DWORD = 0x20000000; +pub const PFD_DOUBLEBUFFER_DONTCARE: DWORD = 0x40000000; +pub const PFD_STEREO_DONTCARE: DWORD = 0x80000000; +FN!{stdcall OLDFONTENUMPROCA( + *const LOGFONTA, + *const TEXTMETRICA, + DWORD, + LPARAM, +) -> c_int} +FN!{stdcall OLDFONTENUMPROCW( + *const LOGFONTW, + *const TEXTMETRICW, + DWORD, + LPARAM, +) -> c_int} +pub type FONTENUMPROCA = OLDFONTENUMPROCA; +pub type FONTENUMPROCW = OLDFONTENUMPROCW; +FN!{stdcall GOBJENUMPROC( + LPVOID, + LPARAM, +) -> c_int} +FN!{stdcall LINEDDAPROC( + c_int, + c_int, + LPARAM, +) -> ()} +extern "system" { + pub fn AddFontResourceA( + _: LPCSTR, + ) -> c_int; + pub fn AddFontResourceW( + _: LPCWSTR, + ) -> c_int; + pub fn AnimatePalette( + hPal: HPALETTE, + iStartIndex: UINT, + cEntries: UINT, + ppe: *const PALETTEENTRY, + ) -> BOOL; + pub fn Arc( + hdc: HDC, + x1: c_int, + y1: c_int, + x2: c_int, + y2: c_int, + x3: c_int, + y3: c_int, + x4: c_int, + y4: c_int, + ) -> BOOL; + pub fn BitBlt( + hdc: HDC, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + hdcSrc: HDC, + x1: c_int, + y1: c_int, + rop: DWORD, + ) -> BOOL; + pub fn CancelDC( + hdc: HDC, + ) -> BOOL; + pub fn Chord( + hdc: HDC, + x1: c_int, + y1: c_int, + x2: c_int, + y2: c_int, + x3: c_int, + y3: c_int, + x4: c_int, + y4: c_int, + ) -> BOOL; + pub fn ChoosePixelFormat( + hdc: HDC, + ppfd: *const PIXELFORMATDESCRIPTOR, + ) -> c_int; + pub fn CloseMetaFile( + hdc: HDC, + ) -> HMETAFILE; + pub fn CombineRgn( + hrgnDst: HRGN, + hrgnSrc1: HRGN, + hrgnSrc2: HRGN, + iMode: c_int, + ) -> c_int; + pub fn CopyMetaFileA( + _: HMETAFILE, + _: LPCSTR, + ) -> HMETAFILE; + pub fn CopyMetaFileW( + _: HMETAFILE, + _: LPCWSTR, + ) -> HMETAFILE; + pub fn CreateBitmap( + nWidth: c_int, + nHeight: c_int, + nPlanes: UINT, + nBitCount: UINT, + lpBits: *const c_void, + ) -> HBITMAP; + pub fn CreateBitmapIndirect( + pbm: *const BITMAP, + ) -> HBITMAP; + pub fn CreateBrushIndirect( + plbrush: *const LOGBRUSH, + ) -> HBRUSH; + pub fn CreateCompatibleBitmap( + hdc: HDC, + cx: c_int, + cy: c_int, + ) -> HBITMAP; + pub fn CreateDiscardableBitmap( + hdc: HDC, + cx: c_int, + cy: c_int, + ) -> HBITMAP; + pub fn CreateCompatibleDC( + hdc: HDC, + ) -> HDC; + pub fn CreateDCA( + pwszDriver: LPCSTR, + pwszDevice: LPCSTR, + pszPort: LPCSTR, + pdm: *const DEVMODEA, + ) -> HDC; + pub fn CreateDCW( + pwszDriver: LPCWSTR, + pwszDevice: LPCWSTR, + pszPort: LPCWSTR, + pdm: *const DEVMODEW, + ) -> HDC; + pub fn CreateDIBitmap( + hdc: HDC, + pbmih: *const BITMAPINFOHEADER, + flInit: DWORD, + pjBits: *const c_void, + pbmi: *const BITMAPINFO, + iUsage: UINT, + ) -> HBITMAP; + pub fn CreateDIBPatternBrush( + h: HGLOBAL, + iUsage: UINT, + ) -> HBRUSH; + pub fn CreateDIBPatternBrushPt( + lpPackedDIB: *const c_void, + iUsage: UINT, + ) -> HBRUSH; + pub fn CreateEllipticRgn( + x1: c_int, + y1: c_int, + x2: c_int, + y2: c_int, + ) -> HRGN; + pub fn CreateEllipticRgnIndirect( + lprect: *const RECT, + ) -> HRGN; + pub fn CreateFontIndirectA( + lplf: *const LOGFONTA, + ) -> HFONT; + pub fn CreateFontIndirectW( + lplf: *const LOGFONTW, + ) -> HFONT; + pub fn CreateFontA( + cHeight: c_int, + cWidth: c_int, + cEscapement: c_int, + cOrientation: c_int, + cWeight: c_int, + bItalic: DWORD, + bUnderline: DWORD, + bStrikeOut: DWORD, + iCharSet: DWORD, + iOutPrecision: DWORD, + iClipPrecision: DWORD, + iQuality: DWORD, + iPitchAndFamily: DWORD, + pszFaceName: LPCSTR, + ) -> HFONT; + pub fn CreateFontW( + cHeight: c_int, + cWidth: c_int, + cEscapement: c_int, + cOrientation: c_int, + cWeight: c_int, + bItalic: DWORD, + bUnderline: DWORD, + bStrikeOut: DWORD, + iCharSet: DWORD, + iOutPrecision: DWORD, + iClipPrecision: DWORD, + iQuality: DWORD, + iPitchAndFamily: DWORD, + pszFaceName: LPCWSTR, + ) -> HFONT; + pub fn CreateHatchBrush( + iHatch: c_int, + color: COLORREF, + ) -> HBRUSH; + pub fn CreateICA( + pszDriver: LPCSTR, + pszDevice: LPCSTR, + pszPort: LPCSTR, + pdm: *const DEVMODEA, + ) -> HDC; + pub fn CreateICW( + pszDriver: LPCWSTR, + pszDevice: LPCWSTR, + pszPort: LPCWSTR, + pdm: *const DEVMODEW, + ) -> HDC; + pub fn CreateMetaFileA( + pszFile: LPCSTR, + ) -> HDC; + pub fn CreateMetaFileW( + pszFile: LPCWSTR, + ) -> HDC; + pub fn CreatePalette( + plpal: *const LOGPALETTE, + ) -> HPALETTE; + pub fn CreatePen( + iStyle: c_int, + cWidth: c_int, + color: COLORREF, + ) -> HPEN; + pub fn CreatePenIndirect( + plpen: *const LOGPEN, + ) -> HPEN; + pub fn CreatePolyPolygonRgn( + pptl: *const POINT, + pc: *const INT, + cPoly: c_int, + iMode: c_int, + ) -> HRGN; + pub fn CreatePatternBrush( + hbm: HBITMAP, + ) -> HBRUSH; + pub fn CreateRectRgn( + x1: c_int, + y1: c_int, + x2: c_int, + y2: c_int, + ) -> HRGN; + pub fn CreateRectRgnIndirect( + lprect: *const RECT, + ) -> HRGN; + pub fn CreateRoundRectRgn( + x1: c_int, + y1: c_int, + x2: c_int, + y2: c_int, + w: c_int, + h: c_int, + ) -> HRGN; + pub fn CreateScalableFontResourceA( + fdwHidden: DWORD, + lpszFont: LPCSTR, + lpszFile: LPCSTR, + lpszPath: LPCSTR, + ) -> BOOL; + pub fn CreateScalableFontResourceW( + fdwHidden: DWORD, + lpszFont: LPCWSTR, + lpszFile: LPCWSTR, + lpszPath: LPCWSTR, + ) -> BOOL; + pub fn CreateSolidBrush( + color: COLORREF, + ) -> HBRUSH; + pub fn DeleteDC( + hdc: HDC, + ) -> BOOL; + pub fn DeleteMetaFile( + hmf: HMETAFILE, + ) -> BOOL; + pub fn DeleteObject( + ho: HGDIOBJ, + ) -> BOOL; + pub fn DescribePixelFormat( + hdc: HDC, + iPixelFormat: c_int, + nBytes: UINT, + ppfd: LPPIXELFORMATDESCRIPTOR, + ) -> c_int; +} +FN!{stdcall LPFNDEVMODE( + HWND, + HMODULE, + LPDEVMODEA, + LPSTR, + LPSTR, + LPDEVMODEA, + LPSTR, + UINT, +) -> UINT} +FN!{stdcall LPFNDEVCAPS( + LPSTR, + LPSTR, + UINT, + LPSTR, + LPDEVMODEA, +) -> DWORD} +pub const DM_UPDATE: DWORD = 1; +pub const DM_COPY: DWORD = 2; +pub const DM_PROMPT: DWORD = 4; +pub const DM_MODIFY: DWORD = 8; +pub const DM_IN_BUFFER: DWORD = DM_MODIFY; +pub const DM_IN_PROMPT: DWORD = DM_PROMPT; +pub const DM_OUT_BUFFER: DWORD = DM_COPY; +pub const DM_OUT_DEFAULT: DWORD = DM_UPDATE; +pub const DC_FIELDS: WORD = 1; +pub const DC_PAPERS: WORD = 2; +pub const DC_PAPERSIZE: WORD = 3; +pub const DC_MINEXTENT: WORD = 4; +pub const DC_MAXEXTENT: WORD = 5; +pub const DC_BINS: WORD = 6; +pub const DC_DUPLEX: WORD = 7; +pub const DC_SIZE: WORD = 8; +pub const DC_EXTRA: WORD = 9; +pub const DC_VERSION: WORD = 10; +pub const DC_DRIVER: WORD = 11; +pub const DC_BINNAMES: WORD = 12; +pub const DC_ENUMRESOLUTIONS: WORD = 13; +pub const DC_FILEDEPENDENCIES: WORD = 14; +pub const DC_TRUETYPE: WORD = 15; +pub const DC_PAPERNAMES: WORD = 16; +pub const DC_ORIENTATION: WORD = 17; +pub const DC_COPIES: WORD = 18; +pub const DC_BINADJUST: WORD = 19; +pub const DC_EMF_COMPLIANT: WORD = 20; +pub const DC_DATATYPE_PRODUCED: WORD = 21; +pub const DC_COLLATE: WORD = 22; +pub const DC_MANUFACTURER: WORD = 23; +pub const DC_MODEL: WORD = 24; +pub const DC_PERSONALITY: WORD = 25; +pub const DC_PRINTRATE: WORD = 26; +pub const DC_PRINTRATEUNIT: WORD = 27; +pub const PRINTRATEUNIT_PPM: WORD = 1; +pub const PRINTRATEUNIT_CPS: WORD = 2; +pub const PRINTRATEUNIT_LPM: WORD = 3; +pub const PRINTRATEUNIT_IPM: WORD = 4; +pub const DC_PRINTERMEM: WORD = 28; +pub const DC_MEDIAREADY: WORD = 29; +pub const DC_STAPLE: WORD = 30; +pub const DC_PRINTRATEPPM: WORD = 31; +pub const DC_COLORDEVICE: WORD = 32; +pub const DC_NUP: WORD = 33; +pub const DC_MEDIATYPENAMES: WORD = 34; +pub const DC_MEDIATYPES: WORD = 35; +pub const DCTT_BITMAP: DWORD = 0x0000001; +pub const DCTT_DOWNLOAD: DWORD = 0x0000002; +pub const DCTT_SUBDEV: DWORD = 0x0000004; +pub const DCTT_DOWNLOAD_OUTLINE: DWORD = 0x0000008; +pub const DCBA_FACEUPNONE: DWORD = 0x0000; +pub const DCBA_FACEUPCENTER: DWORD = 0x0001; +pub const DCBA_FACEUPLEFT: DWORD = 0x0002; +pub const DCBA_FACEUPRIGHT: DWORD = 0x0003; +pub const DCBA_FACEDOWNNONE: DWORD = 0x0100; +pub const DCBA_FACEDOWNCENTER: DWORD = 0x0101; +pub const DCBA_FACEDOWNLEFT: DWORD = 0x0102; +pub const DCBA_FACEDOWNRIGHT: DWORD = 0x0103; +extern "system" { + pub fn DeviceCapabilitiesA( + pDevice: LPCSTR, + pPort: LPCSTR, + fwCapability: WORD, + pOutput: LPSTR, + pDevMode: *const DEVMODEA, + ) -> c_int; + pub fn DeviceCapabilitiesW( + pDevice: LPCWSTR, + pPort: LPCWSTR, + fwCapability: WORD, + pOutput: LPWSTR, + pDevMode: *const DEVMODEW, + ) -> c_int; + pub fn DrawEscape( + hdc: HDC, + iEscape: c_int, + cjIn: c_int, + lpIn: LPCSTR, + ) -> c_int; + pub fn Ellipse( + hdc: HDC, + left: c_int, + top: c_int, + right: c_int, + bottom: c_int, + ) -> BOOL; + pub fn EnumFontFamiliesExA( + hdc: HDC, + lpLogfont: LPLOGFONTA, + lpProc: FONTENUMPROCA, + lParam: LPARAM, + dwFlags: DWORD + ) -> c_int; + pub fn EnumFontFamiliesExW( + hdc: HDC, + lpLogfont: LPLOGFONTW, + lpProc: FONTENUMPROCW, + lParam: LPARAM, + dwFlags: DWORD + ) -> c_int; + pub fn EnumFontFamiliesA( + hdc: HDC, + lpLogfont: LPCSTR, + lpProc: FONTENUMPROCA, + lParam: LPARAM + ) -> c_int; + pub fn EnumFontFamiliesW( + hdc: HDC, + lpLogfont: LPCWSTR, + lpProc: FONTENUMPROCW, + lParam: LPARAM + ) -> c_int; + pub fn EnumFontsA( + hdc: HDC, + lpLogfont: LPCSTR, + lpProc: FONTENUMPROCA, + lParam: LPARAM + ) -> c_int; + pub fn EnumFontsW( + hdc: HDC, + lpLogfont: LPCWSTR, + lpProc: FONTENUMPROCW, + lParam: LPARAM + ) -> c_int; + pub fn EnumObjects( + hdc: HDC, + nType: c_int, + lpFunc: GOBJENUMPROC, + lParam: LPARAM + ) -> c_int; + pub fn EqualRgn( + hrgn1: HRGN, + hrgn2: HRGN, + ) -> BOOL; + pub fn Escape( + hdc: HDC, + iEscape: c_int, + cjIn: c_int, + pvIn: LPCSTR, + pvOut: LPVOID, + ) -> c_int; + pub fn ExtEscape( + hdc: HDC, + iEscape: c_int, + cjInput: c_int, + lpInData: LPCSTR, + cjOutput: c_int, + lpOutData: LPSTR + ) -> c_int; + pub fn ExcludeClipRect( + hdc: HDC, + left: c_int, + top: c_int, + right: c_int, + bottom: c_int, + ) -> c_int; + pub fn ExtCreateRegion( + lpx: *const XFORM, + nCount: DWORD, + lpData: *const RGNDATA, + ) -> HRGN; + pub fn ExtFloodFill( + hdc: HDC, + x: c_int, + y: c_int, + color: COLORREF, + utype: UINT, + ) -> BOOL; + pub fn FillRgn( + hdc: HDC, + hrgn: HRGN, + hbr: HBRUSH, + ) -> BOOL; + pub fn FloodFill( + hdc: HDC, + x: c_int, + y: c_int, + color: COLORREF, + ) -> BOOL; + pub fn FrameRgn( + hdc: HDC, + hrgn: HRGN, + hbr: HBRUSH, + w: c_int, + h: c_int, + ) -> BOOL; + pub fn GetROP2( + hdc: HDC, + ) -> c_int; + pub fn GetAspectRatioFilterEx( + hdc: HDC, + lpsize: LPSIZE, + ) -> BOOL; + pub fn GetBkColor( + hdc: HDC, + ) -> COLORREF; + pub fn GetDCBrushColor( + hdc: HDC, + ) -> COLORREF; + pub fn GetDCPenColor( + hdc: HDC, + ) -> COLORREF; + pub fn GetBkMode( + hdc: HDC, + ) -> c_int; + pub fn GetBitmapBits( + hbit: HBITMAP, + cb: LONG, + lpvBits: LPVOID, + ) -> LONG; + pub fn GetBitmapDimensionEx( + hbit: HBITMAP, + lpsize: LPSIZE, + ) -> BOOL; + pub fn GetBoundsRect( + hdc: HDC, + lprect: LPRECT, + flags: UINT, + ) -> UINT; + pub fn GetBrushOrgEx( + hdc: HDC, + lppt: LPPOINT, + ) -> BOOL; + pub fn GetCharWidthA( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpBuffer: LPINT, + ) -> BOOL; + pub fn GetCharWidthW( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpBuffer: LPINT, + ) -> BOOL; + pub fn GetCharWidth32A( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpBuffer: LPINT, + ) -> BOOL; + pub fn GetCharWidth32W( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpBuffer: LPINT, + ) -> BOOL; + pub fn GetCharWidthFloatA( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpBuffer: PFLOAT, + ) -> BOOL; + pub fn GetCharWidthFloatW( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpBuffer: PFLOAT, + ) -> BOOL; + pub fn GetCharABCWidthsA( + hdc: HDC, + wFirst: UINT, + wLast: UINT, + lpABC: LPABC, + ) -> BOOL; + pub fn GetCharABCWidthsW( + hdc: HDC, + wFirst: UINT, + wLast: UINT, + lpABC: LPABC, + ) -> BOOL; + pub fn GetCharABCWidthsFloatA( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpABC: LPABCFLOAT + ) -> BOOL; + pub fn GetCharABCWidthsFloatW( + hdc: HDC, + iFirst: UINT, + iLast: UINT, + lpABC: LPABCFLOAT + ) -> BOOL; + pub fn GetClipBox( + hdc: HDC, + lprect: LPRECT, + ) -> c_int; + pub fn GetClipRgn( + hdc: HDC, + hrgn: HRGN, + ) -> c_int; + pub fn GetMetaRgn( + hdc: HDC, + hrgn: HRGN, + ) -> c_int; + pub fn GetCurrentObject( + hdc: HDC, + tp: UINT, + ) -> HGDIOBJ; + pub fn GetCurrentPositionEx( + hdc: HDC, + lppt: LPPOINT, + ) -> BOOL; + pub fn GetDeviceCaps( + hdc: HDC, + nIndex: c_int, + ) -> c_int; + pub fn GetDIBits( + hdc: HDC, + hbm: HBITMAP, + start: UINT, + cLines: UINT, + lpvBits: LPVOID, + lpbmi: LPBITMAPINFO, + usage: UINT + ) -> c_int; + pub fn GetFontData( + hdc: HDC, + dwTable: DWORD, + dwOffset: DWORD, + pvBuffer: PVOID, + cjBuffer: DWORD + ) -> DWORD; + pub fn GetGlyphOutlineA( + hdc: HDC, + uChar: UINT, + fuFormat: UINT, + lpgm: LPGLYPHMETRICS, + cjBuffer: DWORD, + pvBuffer: LPVOID, + lpmat2: *const MAT2 + ) -> DWORD; + pub fn GetGlyphOutlineW( + hdc: HDC, + uChar: UINT, + fuFormat: UINT, + lpgm: LPGLYPHMETRICS, + cjBuffer: DWORD, + pvBuffer: LPVOID, + lpmat2: *const MAT2 + ) -> DWORD; + pub fn GetGraphicsMode( + hdc: HDC, + ) -> c_int; + pub fn GetMapMode( + hdc: HDC, + ) -> c_int; + pub fn GetMetaFileBitsEx( + hMF: HMETAFILE, + cbBuffer: UINT, + lpData: LPVOID, + ) -> UINT; + pub fn GetMetaFileA( + lpName: LPCSTR, + ) -> HMETAFILE; + pub fn GetMetaFileW( + lpName: LPCWSTR, + ) -> HMETAFILE; + pub fn GetNearestColor( + hdc: HDC, + color: COLORREF, + ) -> COLORREF; + pub fn GetNearestPaletteIndex( + h: HPALETTE, + color: COLORREF, + ) -> UINT; + pub fn GetObjectType( + h: HGDIOBJ, + ) -> DWORD; + pub fn GetOutlineTextMetricsA( + hdc: HDC, + cjCopy: UINT, + potm: LPOUTLINETEXTMETRICA, + ) -> UINT; + pub fn GetOutlineTextMetricsW( + hdc: HDC, + cjCopy: UINT, + potm: LPOUTLINETEXTMETRICW, + ) -> UINT; + pub fn GetPaletteEntries( + hpal: HPALETTE, + iStart: UINT, + cEntries: UINT, + pPalEntries: LPPALETTEENTRY + ) -> UINT; + pub fn GetPixel( + hdc: HDC, + x: c_int, + y: c_int, + ) -> COLORREF; + pub fn GetPixelFormat( + hdc: HDC, + ) -> c_int; + pub fn GetPolyFillMode( + hdc: HDC, + ) -> c_int; + pub fn GetRasterizerCaps( + lpraststat: LPRASTERIZER_STATUS, + cjBytes: UINT, + ) -> BOOL; + pub fn GetRandomRgn ( + hdc: HDC, + hrgn: HRGN, + i: INT, + ) -> c_int; + pub fn GetRegionData( + hrgn: HRGN, + nCount: DWORD, + lpRgnData: LPRGNDATA, + ) -> DWORD; + pub fn GetRgnBox( + hrgn: HRGN, + lprc: LPRECT, + ) -> c_int; + pub fn GetStockObject( + i: c_int, + ) -> HGDIOBJ; + pub fn GetStretchBltMode( + hdc: HDC, + ) -> c_int; + pub fn GetSystemPaletteEntries( + hdc: HDC, + iStart: UINT, + cEntries: UINT, + pPalEntries: LPPALETTEENTRY, + ) -> UINT; + pub fn GetSystemPaletteUse( + hdc: HDC, + ) -> UINT; + pub fn GetTextCharacterExtra( + hdc: HDC, + ) -> c_int; + pub fn GetTextAlign( + hdc: HDC, + ) -> UINT; + pub fn GetTextColor( + hdc: HDC, + ) -> COLORREF; + pub fn GetTextExtentPointA( + hdc: HDC, + lpString: LPCSTR, + c: c_int, + lpsz: LPSIZE, + ) -> BOOL; + pub fn GetTextExtentPointW( + hdc: HDC, + lpString: LPCWSTR, + c: c_int, + lpsz: LPSIZE, + ) -> BOOL; + pub fn GetTextExtentPoint32A( + hdc: HDC, + lpString: LPCSTR, + c: c_int, + psizl: LPSIZE, + ) -> BOOL; + pub fn GetTextExtentPoint32W( + hdc: HDC, + lpString: LPCWSTR, + c: c_int, + psizl: LPSIZE, + ) -> BOOL; + pub fn GetTextExtentExPointA( + hdc: HDC, + lpszString: LPCSTR, + cchString: c_int, + nMaxExtent: c_int, + lpnFit: LPINT, + lpnDx: LPINT, + lpSize: LPSIZE + ) -> BOOL; + pub fn GetTextExtentExPointW( + hdc: HDC, + lpszString: LPCWSTR, + cchString: c_int, + nMaxExtent: c_int, + lpnFit: LPINT, + lpnDx: LPINT, + lpSize: LPSIZE + ) -> BOOL; + pub fn GetTextCharset( + hdc: HDC, + ) -> c_int; + pub fn GetTextCharsetInfo( + hdc: HDC, + lpSig: LPFONTSIGNATURE, + dwFlags: DWORD, + ) -> c_int; + pub fn TranslateCharsetInfo( + lpSrc: *const DWORD, + lpCs: LPCHARSETINFO, + dwFlags: DWORD + ) -> BOOL; + pub fn GetFontLanguageInfo( + hdc: HDC, + ) -> DWORD; + pub fn GetCharacterPlacementA( + hdc: HDC, + lpString: LPCSTR, + nCount: c_int, + nMexExtent: c_int, + lpResults: LPGCP_RESULTSA, + dwFlags: DWORD + ) -> DWORD; + pub fn GetCharacterPlacementW( + hdc: HDC, + lpString: LPCWSTR, + nCount: c_int, + nMexExtent: c_int, + lpResults: LPGCP_RESULTSW, + dwFlags: DWORD + ) -> DWORD; +} +STRUCT!{struct WCRANGE { + wcLow: WCHAR, + cGlyphs: USHORT, +}} +pub type PWCRANGE = *mut WCRANGE; +pub type LPWCRANGE = *mut WCRANGE; +STRUCT!{struct GLYPHSET { + cbThis: DWORD, + flAccel: DWORD, + cGlyphsSupported: DWORD, + cRanges: DWORD, + ranges: [WCRANGE;1], +}} +pub type PGLYPHSET = *mut GLYPHSET; +pub type LPGLYPHSET = *mut GLYPHSET; +pub const GS_8BIT_INDICES: DWORD = 0x00000001; +pub const GGI_MARK_NONEXISTING_GLYPHS: DWORD = 0x0001; +extern "system" { + pub fn GetFontUnicodeRanges( + hdc: HDC, + lpgs: LPGLYPHSET, + ) -> DWORD; + pub fn GetGlyphIndicesA( + hdc: HDC, + lpstr: LPCSTR, + c: c_int, + pgi: LPWORD, + fl: DWORD, + ) -> DWORD; + pub fn GetGlyphIndicesW( + hdc: HDC, + lpstr: LPCWSTR, + c: c_int, + pgi: LPWORD, + fl: DWORD, + ) -> DWORD; + pub fn GetTextExtentPointI( + hdc: HDC, + pgiIn: LPWORD, + cgi: c_int, + psize: LPSIZE, + ) -> BOOL; + pub fn GetTextExtentExPointI( + hdc: HDC, + lpwszString: LPWORD, + cwchString: c_int, + nMaxExtent: c_int, + lpnFit: LPINT, + lpnDx: LPINT, + lpSize: LPSIZE, + ) -> BOOL; + pub fn GetCharWidthI( + hdc: HDC, + giFirst: UINT, + cgi: UINT, + pgi: LPWORD, + piWidths: LPINT, + ) -> BOOL; + pub fn GetCharABCWidthsI( + hdc: HDC, + giFirst: UINT, + cgi: UINT, + pgi: LPWORD, + pabc: LPABC, + ) -> BOOL; +} +pub const STAMP_DESIGNVECTOR: DWORD = 0x8000000 + 0x64 + (0x76 << 8); +pub const STAMP_AXESLIST: DWORD = 0x8000000 + 0x61 + (0x6c << 8); +pub const STAMP_TRUETYPE_VARIATION: DWORD = 0x8000000 + 0x74 + (0x76 << 8); +pub const MM_MAX_NUMAXES: usize = 16; +STRUCT!{struct DESIGNVECTOR { + dvReserved: DWORD, + dvNumAxes: DWORD, + dvValues: [LONG; MM_MAX_NUMAXES], +}} +pub type PDESIGNVECTOR = *mut DESIGNVECTOR; +pub type LPDESIGNVECTOR = *mut DESIGNVECTOR; +extern "system" { + pub fn AddFontResourceExA( + lpszFilename: LPCSTR, + fl: DWORD, + pdv: PVOID, + ) -> c_int; + pub fn AddFontResourceExW( + lpszFilename: LPCWSTR, + fl: DWORD, + pdv: PVOID, + ) -> c_int; + pub fn RemoveFontResourceExA( + name: LPCSTR, + fl: DWORD, + pdv: PVOID, + ) -> BOOL; + pub fn RemoveFontResourceExW( + name: LPCWSTR, + fl: DWORD, + pdv: PVOID, + ) -> BOOL; + pub fn AddFontMemResourceEx( + pbFont: PVOID, + cbSize: DWORD, + pdv: PVOID, + pcFonts: *mut DWORD, + ) -> HANDLE; + pub fn RemoveFontMemResourceEx( + h: HANDLE, + ) -> BOOL; +} +pub const FR_PRIVATE: DWORD = 0x10; +pub const FR_NOT_ENUM: DWORD = 0x20; +pub const MM_MAX_AXES_NAMELEN: usize = 16; +STRUCT!{struct AXISINFOA { + axMinValue: LONG, + axMaxValue: LONG, + axAxisName: [BYTE; MM_MAX_AXES_NAMELEN], +}} +pub type PAXISINFOA = *mut AXISINFOA; +pub type LPAXISINFOA = *mut AXISINFOA; +STRUCT!{struct AXISINFOW { + axMinValue: LONG, + axMaxValue: LONG, + axAxisName: [WCHAR; MM_MAX_AXES_NAMELEN], +}} +pub type PAXISINFOW = *mut AXISINFOW; +pub type LPAXISINFOW = *mut AXISINFOW; +STRUCT!{struct AXESLISTA { + axlReserved: DWORD, + axlNumAxes: DWORD, + axlAxisInfo: [AXISINFOA; MM_MAX_AXES_NAMELEN], +}} +pub type PAXESLISTA = *mut AXESLISTA; +pub type LPAXESLISTA = *mut AXESLISTA; +STRUCT!{struct AXESLISTW { + axlReserved: DWORD, + axlNumAxes: DWORD, + axlAxisInfo: [AXISINFOW; MM_MAX_AXES_NAMELEN], +}} +pub type PAXESLISTW = *mut AXESLISTW; +pub type LPAXESLISTW = *mut AXESLISTW; +STRUCT!{struct ENUMLOGFONTEXDVA { + elfEnumLogfontEx: ENUMLOGFONTEXA, + elfDesignVector: DESIGNVECTOR, +}} +pub type PENUMLOGFONTEXDVA = *mut ENUMLOGFONTEXDVA; +pub type LPENUMLOGFONTEXDVA = *mut ENUMLOGFONTEXDVA; +STRUCT!{struct ENUMLOGFONTEXDVW { + elfEnumLogfontEx: ENUMLOGFONTEXW, + elfDesignVector: DESIGNVECTOR, +}} +pub type PENUMLOGFONTEXDVW = *mut ENUMLOGFONTEXDVW; +pub type LPENUMLOGFONTEXDVW = *mut ENUMLOGFONTEXDVW; +extern "system" { + pub fn CreateFontIndirectExA( + penumlfex: *const ENUMLOGFONTEXDVA, + ) -> HFONT; + pub fn CreateFontIndirectExW( + penumlfex: *const ENUMLOGFONTEXDVW, + ) -> HFONT; +} +STRUCT!{struct ENUMTEXTMETRICA { + etmNewTextMetricEx: NEWTEXTMETRICEXA, + etmAxesList: AXESLISTA, +}} +pub type PENUMTEXTMETRICA = *mut ENUMTEXTMETRICA; +pub type LPENUMTEXTMETRICA = *mut ENUMTEXTMETRICA; +STRUCT!{struct ENUMTEXTMETRICW { + etmNewTextMetricEx: NEWTEXTMETRICEXW, + etmAxesList: AXESLISTW, +}} +pub type PENUMTEXTMETRICW = *mut ENUMTEXTMETRICW; +pub type LPENUMTEXTMETRICW = *mut ENUMTEXTMETRICW; +extern "system" { + pub fn GetViewportExtEx( + hdc: HDC, + lpsize: LPSIZE, + ) -> BOOL; + pub fn GetViewportOrgEx( + hdc: HDC, + lppoint: LPPOINT, + ) -> BOOL; + pub fn GetWindowExtEx( + hdc: HDC, + lpsize: LPSIZE, + ) -> BOOL; + pub fn GetWindowOrgEx( + hdc: HDC, + lppoint: LPPOINT, + ) -> BOOL; + pub fn IntersectClipRect( + hdc: HDC, + left: c_int, + top: c_int, + right: c_int, + bottom: c_int, + ) -> c_int; + pub fn InvertRgn( + hdc: HDC, + hrgn: HRGN, + ) -> BOOL; + pub fn LineDDA( + nXStart: c_int, + nYStart: c_int, + nXEnd: c_int, + nYEnd: c_int, + lpLineFunc: LINEDDAPROC, + lpData: LPARAM, + ) -> BOOL; + pub fn LineTo( + hdc: HDC, + nXEnd: c_int, + nYEnd: c_int, + ) -> BOOL; + pub fn MaskBlt( + hdcDest: HDC, + xDest: c_int, + yDest: c_int, + width: c_int, + height: c_int, + hdcSrc: HDC, + xSrc: c_int, + ySrc: c_int, + hbmMask: HBITMAP, + xMask: c_int, + yMask: c_int, + rop: DWORD, + ) -> BOOL; + pub fn PlgBlt( + hdcDest: HDC, + lpPoint: *const POINT, + hdcSrc: HDC, + xSrc: c_int, + ySrc: c_int, + width: c_int, + height: c_int, + hbmMask: HBITMAP, + xMask: c_int, + yMask: c_int, + ) -> BOOL; + pub fn OffsetClipRgn( + hdc: HDC, + x: c_int, + y: c_int, + ) -> c_int; + pub fn OffsetRgn( + hrgn: HRGN, + x: c_int, + y: c_int, + ) -> c_int; + pub fn PatBlt( + hdc: HDC, + nXLeft: c_int, + nYLeft: c_int, + nWidth: c_int, + nHeight: c_int, + dwRop: DWORD, + ) -> BOOL; + pub fn Pie( + hdc: HDC, + nLeftRect: c_int, + nTopRect: c_int, + nRightRect: c_int, + nBottomRect: c_int, + nXRadial1: c_int, + nYRadial1: c_int, + nXRadial2: c_int, + nYRadial2: c_int, + ) -> BOOL; + pub fn PlayMetaFile( + hdc: HDC, + hmf: HMETAFILE, + ) -> BOOL; + pub fn PaintRgn( + hdc: HDC, + hrgn: HRGN, + ) -> BOOL; + pub fn PolyPolygon( + hdc: HDC, + lpPoints: *const POINT, + lpPolyCounts: *const INT, + cCount: DWORD, + ) -> BOOL; + pub fn PtInRegion( + hrgn: HRGN, + x: c_int, + y: c_int, + ) -> BOOL; + pub fn PtVisible( + hdc: HDC, + x: c_int, + y: c_int, + ) -> BOOL; + pub fn RectInRegion( + hrgn: HRGN, + lprect: *const RECT, + ) -> BOOL; + pub fn RectVisible( + hdc: HDC, + lprect: *const RECT, + ) -> BOOL; + pub fn Rectangle( + hdc: HDC, + left: c_int, + top: c_int, + right: c_int, + bottom: c_int, + ) -> BOOL; + pub fn RestoreDC( + hdc: HDC, + nSavedDC: c_int, + ) -> BOOL; + pub fn ResetDCA( + hdc: HDC, + lpdm: *const DEVMODEA, + ) -> HDC; + pub fn ResetDCW( + hdc: HDC, + lpdm: *const DEVMODEW, + ) -> HDC; + pub fn RealizePalette( + hdc: HDC, + ) -> UINT; + pub fn RemoveFontResourceA( + lpFileName: LPCSTR, + ) -> BOOL; + pub fn RemoveFontResourceW( + lpFileName: LPCWSTR, + ) -> BOOL; + pub fn RoundRect( + hdc: HDC, + nLeftRect: c_int, + nTopRect: c_int, + nRightRect: c_int, + nBottomRect: c_int, + nWidth: c_int, + nHeight: c_int, + ) -> BOOL; + pub fn ResizePalette( + hpal: HPALETTE, + n: UINT, + ) -> BOOL; + pub fn SaveDC( + hdc: HDC, + ) -> c_int; + pub fn SelectClipRgn( + hdc: HDC, + hrgn: HRGN, + ) -> c_int; + pub fn ExtSelectClipRgn( + hdc: HDC, + hrgn: HRGN, + mode: c_int, + ) -> c_int; + pub fn SetMetaRgn( + hdc: HDC, + ) -> c_int; + pub fn SelectObject( + hdc: HDC, + h: HGDIOBJ, + ) -> HGDIOBJ; + pub fn SelectPalette( + hdc: HDC, + hPal: HPALETTE, + bForceBkgd: BOOL, + ) -> HPALETTE; + pub fn SetBkColor( + hdc: HDC, + color: COLORREF, + ) -> COLORREF; + pub fn SetDCBrushColor( + hdc: HDC, + color: COLORREF, + ) -> COLORREF; + pub fn SetDCPenColor( + hdc: HDC, + color: COLORREF, + ) -> COLORREF; + pub fn SetBkMode( + hdc: HDC, + mode: c_int, + ) -> c_int; + pub fn SetBitmapBits( + hbm: HBITMAP, + cb: DWORD, + pvBits: *const VOID, + ) -> LONG; + pub fn SetBoundsRect( + hdc: HDC, + lprect: *const RECT, + flags: UINT, + ) -> UINT; + pub fn SetDIBits( + hdc: HDC, + hbm: HBITMAP, + start: UINT, + cLines: UINT, + lpBits: *const VOID, + lpbmi: *const BITMAPINFO, + ColorUse: UINT, + ) -> c_int; + pub fn SetDIBitsToDevice( + hdc: HDC, + xDest: c_int, + yDest: c_int, + w: DWORD, + h: DWORD, + xSrc: c_int, + ySrc: c_int, + StartScan: UINT, + cLines: UINT, + lpvBits: *const VOID, + lpbmi: *const BITMAPINFO, + ColorUse: UINT, + ) -> c_int; + pub fn SetMapperFlags( + hdc: HDC, + flags: DWORD, + ) -> DWORD; + pub fn SetGraphicsMode( + hdc: HDC, + iMode: c_int, + ) -> c_int; + pub fn SetMapMode( + hdc: HDC, + mode: c_int, + ) -> c_int; + pub fn SetLayout( + hdc: HDC, + l: DWORD, + ) -> DWORD; + pub fn GetLayout( + hdc: HDC, + ) -> DWORD; + pub fn SetMetaFileBitsEx( + cbBuffer: UINT, + lpData: *const BYTE, + ) -> HMETAFILE; + pub fn SetPaletteEntries( + hpal: HPALETTE, + iStart: UINT, + cEntries: UINT, + pPalEntries: *const PALETTEENTRY, + ) -> UINT; + pub fn SetPixel( + hdc: HDC, + x: c_int, + y: c_int, + color: COLORREF, + ) -> COLORREF; + pub fn SetPixelV( + hdc: HDC, + x: c_int, + y: c_int, + color: COLORREF, + ) -> BOOL; + pub fn SetPixelFormat( + hdc: HDC, + iPixelFormat: c_int, + ppfd: *const PIXELFORMATDESCRIPTOR, + ) -> BOOL; + pub fn SetPolyFillMode( + hdc: HDC, + iPolyFillMode: c_int, + ) -> c_int; + pub fn StretchBlt( + hdcDest: HDC, + xDest: c_int, + yDest: c_int, + wDest: c_int, + hDest: c_int, + hdcSrc: HDC, + xSrc: c_int, + ySrc: c_int, + wSrc: c_int, + hSrc: c_int, + rop: DWORD, + ) -> BOOL; + pub fn SetRectRgn( + hrgn: HRGN, + left: c_int, + top: c_int, + right: c_int, + bottom: c_int, + ) -> BOOL; + pub fn StretchDIBits( + hdc: HDC, + XDest: c_int, + YDest: c_int, + nDestWidth: c_int, + nDestHeight: c_int, + XSrc: c_int, + YSrc: c_int, + nSrcWidth: c_int, + nSrcHeight: c_int, + lpBits: *const VOID, + lpBitsInfo: *const BITMAPINFO, + iUsage: UINT, + dwRop: DWORD, + ) -> c_int; + pub fn SetROP2( + hdc: HDC, + rop2: c_int, + ) -> c_int; + pub fn SetStretchBltMode( + hdc: HDC, + mode: c_int, + ) -> c_int; + pub fn SetSystemPaletteUse( + hdc: HDC, + uuse: UINT, + ) -> UINT; + pub fn SetTextCharacterExtra( + hdc: HDC, + extra: c_int, + ) -> c_int; + pub fn SetTextColor( + hdc: HDC, + color: COLORREF, + ) -> COLORREF; + pub fn SetTextAlign( + hdc: HDC, + align: UINT, + ) -> UINT; + pub fn SetTextJustification( + hdc: HDC, + extra: c_int, + count: c_int, + ) -> BOOL; + pub fn UpdateColors( + hdc: HDC, + ) -> BOOL; +} +pub type COLOR16 = c_ushort; +STRUCT!{struct TRIVERTEX { + x: LONG, + y: LONG, + Red: COLOR16, + Green: COLOR16, + Blue: COLOR16, + Alpha: COLOR16, +}} +pub type PTRIVERTEX = *mut TRIVERTEX; +pub type LPTRIVERTEX = *mut TRIVERTEX; +STRUCT!{struct GRADIENT_RECT { + UpperLeft: ULONG, + LowerRight: ULONG, +}} +pub type PGRADIENT_RECT = *mut GRADIENT_RECT; +pub type LPGRADIENT_RECT = *mut GRADIENT_RECT; +STRUCT!{struct BLENDFUNCTION { + BlendOp: BYTE, + BlendFlags: BYTE, + SourceConstantAlpha: BYTE, + AlphaFormat: BYTE, +}} +pub type PBLENDFUNCTION = *mut BLENDFUNCTION; +pub const AC_SRC_OVER: BYTE = 0x00; +pub const AC_SRC_ALPHA: BYTE = 0x01; +extern "system" { + pub fn AlphaBlend( + hdcDest: HDC, + xoriginDest: c_int, + yoriginDest: c_int, + wDest: c_int, + hDest: c_int, + hdcSrc: HDC, + xoriginSrc: c_int, + yoriginSrc: c_int, + wSrc: c_int, + hSrc: c_int, + ftn: BLENDFUNCTION, + ) -> BOOL; + pub fn TransparentBlt( + hdcDest: HDC, + xoriginDest: c_int, + yoriginDest: c_int, + wDest: c_int, + hDest: c_int, + hdcSrc: HDC, + xoriginSrc: c_int, + yoriginSrc: c_int, + wSrc: c_int, + hSrc: c_int, + crTransparent: UINT, + ) -> BOOL; +} +pub const GRADIENT_FILL_RECT_H: ULONG = 0x00000000; +pub const GRADIENT_FILL_RECT_V: ULONG = 0x00000001; +pub const GRADIENT_FILL_TRIANGLE: ULONG = 0x00000002; +pub const GRADIENT_FILL_OP_FLAG: ULONG = 0x000000ff; +extern "system" { + pub fn GradientFill( + hdc: HDC, + pVertex: PTRIVERTEX, + nVertex: ULONG, + pMesh: PVOID, + nMesh: ULONG, + ulMode: ULONG, + ) -> BOOL; + pub fn GdiAlphaBlend( + hdcDest: HDC, + xoriginDest: c_int, + yoriginDest: c_int, + wDest: c_int, + hDest: c_int, + hdcSrc: HDC, + xoriginSrc: c_int, + yoriginSrc: c_int, + wSrc: c_int, + hSrc: c_int, + ftn: BLENDFUNCTION, + ) -> BOOL; + pub fn GdiTransparentBlt( + hdcDest: HDC, + xoriginDest: c_int, + yoriginDest: c_int, + wDest: c_int, + hDest: c_int, + hdcSrc: HDC, + xoriginSrc: c_int, + yoriginSrc: c_int, + wSrc: c_int, + hSrc: c_int, + crTransparent: UINT, + ) -> BOOL; + pub fn GdiGradientFill( + hdc: HDC, + pVertex: PTRIVERTEX, + nVertex: ULONG, + pMesh: PVOID, + nCount: ULONG, + ulMode: ULONG, + ) -> BOOL; + pub fn PlayMetaFileRecord( + hdc: HDC, + lpHandleTable: LPHANDLETABLE, + lpMR: LPMETARECORD, + noObjs: UINT, + ) -> BOOL; +} +FN!{stdcall MFENUMPROC( + hdc: HDC, + lpht: *mut HANDLETABLE, + lpMR: *mut METARECORD, + nObj: c_int, + param: LPARAM, +) -> c_int} +extern "system" { + pub fn EnumMetaFile( + hdc: HDC, + hmf: HMETAFILE, + mproc: MFENUMPROC, + param: LPARAM, + ) -> BOOL; +} +FN!{stdcall ENHMFENUMPROC( + hdc: HDC, + lpht: *mut HANDLETABLE, + lpmr: *const ENHMETARECORD, + nHandles: c_int, + data: LPARAM, +) -> c_int} +extern "system" { + pub fn CloseEnhMetaFile( + hdc: HDC, + ) -> HENHMETAFILE; + pub fn CopyEnhMetaFileA( + hemfSrc: HENHMETAFILE, + lpszFile: LPCSTR, + ) -> HENHMETAFILE; + pub fn CopyEnhMetaFileW( + hemfSrc: HENHMETAFILE, + lpszFile: LPCWSTR, + ) -> HENHMETAFILE; + pub fn CreateEnhMetaFileA( + hdcRef: HDC, + lpFilename: LPCSTR, + lpRect: *const RECT, + lpDescription: LPCSTR, + ) -> HDC; + pub fn CreateEnhMetaFileW( + hdcRef: HDC, + lpFilename: LPCWSTR, + lpRect: *const RECT, + lpDescription: LPCWSTR, + ) -> HDC; + pub fn DeleteEnhMetaFile( + hmf: HENHMETAFILE, + ) -> BOOL; + pub fn EnumEnhMetaFile( + hdc: HDC, + hmf: HENHMETAFILE, + lpProc: ENHMFENUMPROC, + param: LPVOID, + lpRect: *const RECT, + ) -> BOOL; + pub fn GetEnhMetaFileA( + lpName: LPCSTR, + ) -> HENHMETAFILE; + pub fn GetEnhMetaFileW( + lpName: LPCWSTR, + ) -> HENHMETAFILE; + pub fn GetEnhMetaFileBits( + hEMF: HENHMETAFILE, + nSize: UINT, + lpData: LPBYTE, + ) -> UINT; + pub fn GetEnhMetaFileDescriptionA( + hemf: HENHMETAFILE, + cchBuffer: UINT, + lpDescription: LPSTR, + ) -> UINT; + pub fn GetEnhMetaFileDescriptionW( + hemf: HENHMETAFILE, + cchBuffer: UINT, + lpDescription: LPWSTR, + ) -> UINT; + pub fn GetEnhMetaFileHeader( + hemf: HENHMETAFILE, + nSize: UINT, + lpEnhMetaHeader: LPENHMETAHEADER, + ) -> UINT; + pub fn GetEnhMetaFilePaletteEntries( + hemf: HENHMETAFILE, + nNumEntries: UINT, + lpPaletteEntries: LPPALETTEENTRY, + ) -> UINT; + pub fn GetEnhMetaFilePixelFormat( + hemf: HENHMETAFILE, + cbBuffer: UINT, + ppfd: *mut PIXELFORMATDESCRIPTOR, + ) -> UINT; + pub fn GetWinMetaFileBits( + hemf: HENHMETAFILE, + cbData16: UINT, + pData16: LPBYTE, + iMapMode: INT, + hdcRef: HDC, + ) -> UINT; + pub fn PlayEnhMetaFile( + hdc: HDC, + hmf: HENHMETAFILE, + lprect: *const RECT, + ) -> BOOL; + pub fn PlayEnhMetaFileRecord( + hdc: HDC, + pht: LPHANDLETABLE, + pmr: *const ENHMETARECORD, + cht: UINT, + ) -> BOOL; + pub fn SetEnhMetaFileBits( + nSize: UINT, + pb: *const BYTE, + ) -> HENHMETAFILE; + pub fn SetWinMetaFileBits( + nSize: UINT, + lpMeta16Data: *const BYTE, + hdcRef: HDC, + lpMFP: *const METAFILEPICT, + ) -> HENHMETAFILE; + pub fn GdiComment( + hdc: HDC, + nSize: UINT, + lpData: *const BYTE, + ) -> BOOL; + pub fn GetTextMetricsA( + hdc: HDC, + lptm: LPTEXTMETRICA, + ) -> BOOL; + pub fn GetTextMetricsW( + hdc: HDC, + lptm: *mut TEXTMETRICW, + ) -> BOOL; +} +STRUCT!{struct DIBSECTION { + dsBm: BITMAP, + dsBmih: BITMAPINFOHEADER, + dsBitfields: [DWORD; 3], + dshSection: HANDLE, + dsOffset: DWORD, +}} +pub type PDIBSECTION = *mut DIBSECTION; +pub type LPDIBSECTION = *mut DIBSECTION; +extern "system" { + pub fn AngleArc( + hdc: HDC, + X: c_int, + Y: c_int, + dwRadius: DWORD, + eStartAngle: FLOAT, + eSweepAngle: FLOAT, + ) -> BOOL; + pub fn PolyPolyline( + hdc: HDC, + lppt: *const POINT, + lpdwPolyPoints: *const DWORD, + cCount: DWORD, + ) -> BOOL; + pub fn GetWorldTransform( + hdc: HDC, + lpxf: LPXFORM, + ) -> BOOL; + pub fn SetWorldTransform( + hdc: HDC, + lpxf: *const XFORM, + ) -> BOOL; + pub fn ModifyWorldTransform( + hdc: HDC, + lpxf: *const XFORM, + mode: DWORD, + ) -> BOOL; + pub fn CombineTransform( + lpxformResult: LPXFORM, + lpxform1: *const XFORM, + lpxform2: *const XFORM, + ) -> BOOL; +} +#[inline] +pub fn GDI_WIDTHBYTES(bits: DWORD) -> DWORD { + ((bits + 31) & !31) / 8 +} +#[inline] +pub fn GDI_DIBWIDTHBYTES(bi: &BITMAPINFOHEADER) -> DWORD { + GDI_WIDTHBYTES((bi.biWidth as DWORD) * (bi.biBitCount as DWORD)) +} +#[inline] +pub fn GDI__DIBSIZE(bi: &BITMAPINFOHEADER) -> DWORD { + GDI_DIBWIDTHBYTES(bi) * bi.biHeight as DWORD +} +#[inline] +pub fn GDI_DIBSIZE(bi: &BITMAPINFOHEADER) -> DWORD { + if bi.biHeight < 0 { + GDI__DIBSIZE(bi) * -1i32 as DWORD + } else { + GDI__DIBSIZE(bi) + } +} +extern "system" { + pub fn CreateDIBSection( + hdc: HDC, + lpbmi: *const BITMAPINFO, + usage: UINT, + ppvBits: *mut *mut c_void, + hSection: HANDLE, + offset: DWORD, + ) -> HBITMAP; + pub fn GetDIBColorTable( + hdc: HDC, + iStart: UINT, + cEntries: UINT, + prgbq: *mut RGBQUAD, + ) -> UINT; + pub fn SetDIBColorTable( + hdc: HDC, + iStart: UINT, + cEntries: UINT, + prgbq: *const RGBQUAD, + ) -> UINT; +} +pub const CA_NEGATIVE: WORD = 0x0001; +pub const CA_LOG_FILTER: WORD = 0x0002; +pub const ILLUMINANT_DEVICE_DEFAULT: WORD = 0; +pub const ILLUMINANT_A: WORD = 1; +pub const ILLUMINANT_B: WORD = 2; +pub const ILLUMINANT_C: WORD = 3; +pub const ILLUMINANT_D50: WORD = 4; +pub const ILLUMINANT_D55: WORD = 5; +pub const ILLUMINANT_D65: WORD = 6; +pub const ILLUMINANT_D75: WORD = 7; +pub const ILLUMINANT_F2: WORD = 8; +pub const ILLUMINANT_MAX_INDEX: WORD = ILLUMINANT_F2; +pub const ILLUMINANT_TUNGSTEN: WORD = ILLUMINANT_A; +pub const ILLUMINANT_DAYLIGHT: WORD = ILLUMINANT_C; +pub const ILLUMINANT_FLUORESCENT: WORD = ILLUMINANT_F2; +pub const ILLUMINANT_NTSC: WORD = ILLUMINANT_C; +pub const RGB_GAMMA_MIN: WORD = 02500; +pub const RGB_GAMMA_MAX: WORD = 65000; +pub const REFERENCE_WHITE_MIN: WORD = 6000; +pub const REFERENCE_WHITE_MAX: WORD = 10000; +pub const REFERENCE_BLACK_MIN: WORD = 0; +pub const REFERENCE_BLACK_MAX: WORD = 4000; +pub const COLOR_ADJ_MIN: SHORT = -100; +pub const COLOR_ADJ_MAX: SHORT = 100; +STRUCT!{struct COLORADJUSTMENT { + caSize: WORD, + caFlags: WORD, + caIlluminantIndex: WORD, + caRedGamma: WORD, + caGreenGamma: WORD, + caBlueGamma: WORD, + caReferenceBlack: WORD, + caReferenceWhite: WORD, + caContrast: SHORT, + caBrightness: SHORT, + caColorfulness: SHORT, + caRedGreenTint: SHORT, +}} +pub type PCOLORADJUSTMENT = *mut COLORADJUSTMENT; +pub type LPCOLORADJUSTMENT = *mut COLORADJUSTMENT; +extern "system" { + pub fn SetColorAdjustment( + hdc: HDC, + lpca: *const COLORADJUSTMENT, + ) -> BOOL; + pub fn GetColorAdjustment( + hdc: HDC, + lpca: LPCOLORADJUSTMENT, + ) -> BOOL; + pub fn CreateHalftonePalette( + hdc: HDC, + ) -> HPALETTE; +} +FN!{stdcall ABORTPROC( + HDC, + c_int, +) -> BOOL} +STRUCT!{struct DOCINFOA { + cbSize: c_int, + lpszDocName: LPCSTR, + lpszOutput: LPCSTR, + lpszDatatype: LPCSTR, + fwType: DWORD, +}} +pub type LPDOCINFOA = *mut DOCINFOA; +STRUCT!{struct DOCINFOW { + cbSize: c_int, + lpszDocName: LPCWSTR, + lpszOutput: LPCWSTR, + lpszDatatype: LPCWSTR, + fwType: DWORD, +}} +pub type LPDOCINFOW = *mut DOCINFOW; +pub const DI_APPBANDING: DWORD = 0x00000001; +pub const DI_ROPS_READ_DESTINATION: DWORD = 0x00000002; +extern "system" { + pub fn StartDocA( + hdc: HDC, + lpdi: *const DOCINFOA, + ) -> c_int; + pub fn StartDocW( + hdc: HDC, + lpdi: *const DOCINFOW, + ) -> c_int; + pub fn EndDoc( + hdc: HDC, + ) -> c_int; + pub fn StartPage( + hdc: HDC, + ) -> c_int; + pub fn EndPage( + hdc: HDC, + ) -> c_int; + pub fn AbortDoc( + hdc: HDC, + ) -> c_int; + pub fn SetAbortProc( + hdc: HDC, + aproc: ABORTPROC, + ) -> c_int; + pub fn AbortPath( + hdc: HDC, + ) -> BOOL; + pub fn ArcTo( + hdc: HDC, + nLeftRect: c_int, + nTopRect: c_int, + nRightRect: c_int, + nBottomRect: c_int, + nXRadial1: c_int, + nYRadial1: c_int, + nXRadial2: c_int, + nYRadial2: c_int, + ) -> BOOL; + pub fn BeginPath( + hdc: HDC, + ) -> BOOL; + pub fn CloseFigure( + hdc: HDC, + ) -> BOOL; + pub fn EndPath( + hdc: HDC, + ) -> BOOL; + pub fn FillPath( + hdc: HDC, + ) -> BOOL; + pub fn FlattenPath( + hdc: HDC, + ) -> BOOL; + pub fn GetPath( + hdc: HDC, + apt: LPPOINT, + aj: LPBYTE, + cpt: c_int, + ) -> c_int; + pub fn PathToRegion( + hdc: HDC, + ) -> HRGN; + pub fn PolyDraw( + hdc: HDC, + lppt: *const POINT, + lpbTypes: *const BYTE, + cCount: c_int, + ) -> BOOL; + pub fn SelectClipPath( + hdc: HDC, + mode: c_int, + ) -> BOOL; + pub fn SetArcDirection( + hdc: HDC, + ArcDirection: c_int, + ) -> c_int; + pub fn SetMiterLimit( + hdc: HDC, + limit: FLOAT, + old: PFLOAT, + ) -> BOOL; + pub fn StrokeAndFillPath( + hdc: HDC, + ) -> BOOL; + pub fn StrokePath( + hdc: HDC, + ) -> BOOL; + pub fn WidenPath( + hdc: HDC, + ) -> BOOL; + pub fn ExtCreatePen( + iPenStyle: DWORD, + cWidth: DWORD, + plbrush: *const LOGBRUSH, + cStyle: DWORD, + pstyle: *const DWORD, + ) -> HPEN; + pub fn GetMiterLimit( + hdc: HDC, + plimit: PFLOAT, + ) -> BOOL; + pub fn GetArcDirection( + hdc: HDC, + ) -> c_int; + pub fn GetObjectA( + h: HANDLE, + c: c_int, + pv: LPVOID, + ) -> c_int; + pub fn GetObjectW( + h: HANDLE, + c: c_int, + pv: LPVOID, + ) -> c_int; + pub fn MoveToEx( + hdc: HDC, + X: c_int, + Y: c_int, + lpPoint:LPPOINT, + ) -> BOOL; + pub fn TextOutA( + hdc: HDC, + x: c_int, + y: c_int, + lpString: LPCSTR, + c: c_int, + ) -> BOOL; + pub fn TextOutW( + hdc: HDC, + x: c_int, + y: c_int, + lpString: LPCWSTR, + c: c_int, + ) -> BOOL; + pub fn ExtTextOutA( + hdc: HDC, + x: c_int, + y: c_int, + options: UINT, + lprect: *const RECT, + lpString: LPCSTR, + c: UINT, + lpDx: *const INT, + ) -> BOOL; + pub fn ExtTextOutW( + hdc: HDC, + x: c_int, + y: c_int, + options: UINT, + lprect: *const RECT, + lpString: LPCWSTR, + c: UINT, + lpDx: *const INT, + ) -> BOOL; + pub fn PolyTextOutA( + hdc: HDC, + ppt: *const POLYTEXTA, + nstrings: c_int, + ) -> BOOL; + pub fn PolyTextOutW( + hdc: HDC, + ppt: *const POLYTEXTW, + nstrings: c_int, + ) -> BOOL; + pub fn CreatePolygonRgn( + lppt: *const POINT, + cPoints: c_int, + fnPolyFillMode: c_int, + ) -> HRGN; + pub fn DPtoLP( + hdc: HDC, + lppt: *mut POINT, + c: c_int, + ) -> BOOL; + pub fn LPtoDP( + hdc: HDC, + lppt: LPPOINT, + c: c_int, + ) -> BOOL; + pub fn Polygon( + hdc: HDC, + lpPoints: *const POINT, + nCount: c_int, + ) -> BOOL; + pub fn Polyline( + hdc: HDC, + lppt: *const POINT, + cCount: c_int, + ) -> BOOL; + pub fn PolyBezier( + hdc: HDC, + lppt: *const POINT, + cPoints: DWORD, + ) -> BOOL; + pub fn PolyBezierTo( + hdc: HDC, + lppt: *const POINT, + cPoints: DWORD, + ) -> BOOL; + pub fn PolylineTo( + hdc: HDC, + lppt: *const POINT, + cCount: DWORD, + ) -> BOOL; + pub fn SetViewportExtEx( + hdc: HDC, + x: c_int, + y: c_int, + lpsz: LPSIZE, + ) -> BOOL; + pub fn SetViewportOrgEx( + hdc: HDC, + x: c_int, + y: c_int, + lppt: *mut POINT, + ) -> BOOL; + pub fn SetWindowExtEx( + hdc: HDC, + x: c_int, + y: c_int, + lppt: LPSIZE, + ) -> BOOL; + pub fn SetWindowOrgEx( + hdc: HDC, + x: c_int, + y: c_int, + lppt: LPPOINT, + ) -> BOOL; + pub fn OffsetViewportOrgEx( + hdc: HDC, + x: c_int, + y: c_int, + lppt: LPPOINT, + ) -> BOOL; + pub fn OffsetWindowOrgEx( + hdc: HDC, + x: c_int, + y: c_int, + lppt: LPPOINT, + ) -> BOOL; + pub fn ScaleViewportExtEx( + hdc: HDC,xn: c_int, + dx: c_int, + yn: c_int, + yd: c_int, + lpsz: LPSIZE, + ) -> BOOL; + pub fn ScaleWindowExtEx( + hdc: HDC, + xn: c_int, + xd: c_int, + yn: c_int, + yd: c_int, + lpsz: LPSIZE, + ) -> BOOL; + pub fn SetBitmapDimensionEx( + hbm: HBITMAP, + w: c_int, + h: c_int, + lpsz: LPSIZE, + ) -> BOOL; + pub fn SetBrushOrgEx( + hdc: HDC, + x: c_int, + y: c_int, + lppt: LPPOINT, + ) -> BOOL; + pub fn GetTextFaceA( + hdc: HDC, + c: c_int, + lpName: LPSTR, + ) -> c_int; + pub fn GetTextFaceW( + hdc: HDC, + c: c_int, + lpName: LPWSTR, + ) -> c_int; +} +STRUCT!{struct KERNINGPAIR { + wFirst: WORD, + wSecond: WORD, + iKernAmount: c_int, +}} +pub type LPKERNINGPAIR = *mut KERNINGPAIR; +extern "system" { + pub fn GetKerningPairsA( + hdc: HDC, + nPairs: DWORD, + lpKernPair: LPKERNINGPAIR, + ) -> DWORD; + pub fn GetKerningPairsW( + hdc: HDC, + nPairs: DWORD, + lpKernPair: LPKERNINGPAIR, + ) -> DWORD; + pub fn GetDCOrgEx( + hdc: HDC, + lppt: LPPOINT, + ) -> BOOL; + pub fn FixBrushOrgEx( + hdc: HDC, + x: c_int, + y: c_int, + ptl: LPPOINT, + ) -> BOOL; + pub fn UnrealizeObject( + h: HGDIOBJ, + ) -> BOOL; + pub fn GdiFlush() -> BOOL; + pub fn GdiSetBatchLimit( + dw: DWORD, + ) -> DWORD; + pub fn GdiGetBatchLimit() -> DWORD; +} +pub const ICM_OFF: c_int = 1; +pub const ICM_ON: c_int = 2; +pub const ICM_QUERY: c_int = 3; +pub const ICM_DONE_OUTSIDEDC: c_int = 4; +FN!{stdcall ICMENUMPROCA( + LPSTR, + LPARAM, +) -> c_int} +FN!{stdcall ICMENUMPROCW( + LPWSTR, + LPARAM, +) -> c_int} +extern "system" { + pub fn SetICMMode( + hdc: HDC, + mode: c_int, + ) -> c_int; + pub fn CheckColorsInGamut( + hDC: HDC, + lpRGBTriples: LPVOID, + lpBuffer: LPVOID, + nCount: UINT, + ) -> BOOL; + pub fn GetColorSpace( + hdc: HDC, + ) -> HCOLORSPACE; + pub fn GetLogColorSpaceA( + hColorSpace: HCOLORSPACE, + lpBuffer: LPLOGCOLORSPACEA, + nSize: DWORD, + ) -> BOOL; + pub fn GetLogColorSpaceW( + hColorSpace: HCOLORSPACE, + lpBuffer: LPLOGCOLORSPACEW, + nSize: DWORD, + ) -> BOOL; + pub fn CreateColorSpaceA( + lpLogColorSpace: LPLOGCOLORSPACEA, + ) -> HCOLORSPACE; + pub fn CreateColorSpaceW( + lpLogColorSpace: LPLOGCOLORSPACEW, + ) -> HCOLORSPACE; + pub fn SetColorSpace( + hdc: HDC, + hcs: HCOLORSPACE, + ) -> HCOLORSPACE; + pub fn DeleteColorSpace( + hcs: HCOLORSPACE, + ) -> BOOL; + pub fn GetICMProfileA( + hdc: HDC, + pBufSize: LPDWORD, + pszFilename: LPSTR, + ) -> BOOL; + pub fn GetICMProfileW( + hdc: HDC, + pBufSize: LPDWORD, + pszFilename: LPWSTR, + ) -> BOOL; + pub fn SetICMProfileA( + hdc: HDC, + lpFileName: LPSTR, + ) -> BOOL; + pub fn SetICMProfileW( + hdc: HDC, + lpFileName: LPWSTR, + ) -> BOOL; + pub fn GetDeviceGammaRamp( + hdc: HDC, + lpRamp: LPVOID, + ) -> BOOL; + pub fn SetDeviceGammaRamp( + hdc: HDC, + lpRamp: LPVOID, + ) -> BOOL; + pub fn ColorMatchToTarget( + hDC: HDC, + hdcTarget: HDC, + uiAction: UINT, + ) -> BOOL; + pub fn EnumICMProfilesA( + hdc: HDC, + iproc: ICMENUMPROCA, + param: LPARAM, + ) -> c_int; + pub fn EnumICMProfilesW( + hdc: HDC, + iproc: ICMENUMPROCW, + param: LPARAM, + ) -> c_int; + pub fn UpdateICMRegKeyA( + reserved: DWORD, + lpszCMID: LPSTR, + lpszFileName: LPSTR, + command: UINT, + ) -> BOOL; + pub fn UpdateICMRegKeyW( + reserved: DWORD, + lpszCMID: LPWSTR, + lpszFileName: LPWSTR, + command: UINT, + ) -> BOOL; + pub fn ColorCorrectPalette( + hDC: HDC, + hPalette: HPALETTE, + dwFirstEntry: DWORD, + dwNumOfEntries: DWORD, + ) -> BOOL; +} +pub const ENHMETA_SIGNATURE: DWORD = 0x464D4520; +pub const ENHMETA_STOCK_OBJECT: DWORD = 0x80000000; +pub const EMR_HEADER: DWORD = 1; +pub const EMR_POLYBEZIER: DWORD = 2; +pub const EMR_POLYGON: DWORD = 3; +pub const EMR_POLYLINE: DWORD = 4; +pub const EMR_POLYBEZIERTO: DWORD = 5; +pub const EMR_POLYLINETO: DWORD = 6; +pub const EMR_POLYPOLYLINE: DWORD = 7; +pub const EMR_POLYPOLYGON: DWORD = 8; +pub const EMR_SETWINDOWEXTEX: DWORD = 9; +pub const EMR_SETWINDOWORGEX: DWORD = 10; +pub const EMR_SETVIEWPORTEXTEX: DWORD = 11; +pub const EMR_SETVIEWPORTORGEX: DWORD = 12; +pub const EMR_SETBRUSHORGEX: DWORD = 13; +pub const EMR_EOF: DWORD = 14; +pub const EMR_SETPIXELV: DWORD = 15; +pub const EMR_SETMAPPERFLAGS: DWORD = 16; +pub const EMR_SETMAPMODE: DWORD = 17; +pub const EMR_SETBKMODE: DWORD = 18; +pub const EMR_SETPOLYFILLMODE: DWORD = 19; +pub const EMR_SETROP2: DWORD = 20; +pub const EMR_SETSTRETCHBLTMODE: DWORD = 21; +pub const EMR_SETTEXTALIGN: DWORD = 22; +pub const EMR_SETCOLORADJUSTMENT: DWORD = 23; +pub const EMR_SETTEXTCOLOR: DWORD = 24; +pub const EMR_SETBKCOLOR: DWORD = 25; +pub const EMR_OFFSETCLIPRGN: DWORD = 26; +pub const EMR_MOVETOEX: DWORD = 27; +pub const EMR_SETMETARGN: DWORD = 28; +pub const EMR_EXCLUDECLIPRECT: DWORD = 29; +pub const EMR_INTERSECTCLIPRECT: DWORD = 30; +pub const EMR_SCALEVIEWPORTEXTEX: DWORD = 31; +pub const EMR_SCALEWINDOWEXTEX: DWORD = 32; +pub const EMR_SAVEDC: DWORD = 33; +pub const EMR_RESTOREDC: DWORD = 34; +pub const EMR_SETWORLDTRANSFORM: DWORD = 35; +pub const EMR_MODIFYWORLDTRANSFORM: DWORD = 36; +pub const EMR_SELECTOBJECT: DWORD = 37; +pub const EMR_CREATEPEN: DWORD = 38; +pub const EMR_CREATEBRUSHINDIRECT: DWORD = 39; +pub const EMR_DELETEOBJECT: DWORD = 40; +pub const EMR_ANGLEARC: DWORD = 41; +pub const EMR_ELLIPSE: DWORD = 42; +pub const EMR_RECTANGLE: DWORD = 43; +pub const EMR_ROUNDRECT: DWORD = 44; +pub const EMR_ARC: DWORD = 45; +pub const EMR_CHORD: DWORD = 46; +pub const EMR_PIE: DWORD = 47; +pub const EMR_SELECTPALETTE: DWORD = 48; +pub const EMR_CREATEPALETTE: DWORD = 49; +pub const EMR_SETPALETTEENTRIES: DWORD = 50; +pub const EMR_RESIZEPALETTE: DWORD = 51; +pub const EMR_REALIZEPALETTE: DWORD = 52; +pub const EMR_EXTFLOODFILL: DWORD = 53; +pub const EMR_LINETO: DWORD = 54; +pub const EMR_ARCTO: DWORD = 55; +pub const EMR_POLYDRAW: DWORD = 56; +pub const EMR_SETARCDIRECTION: DWORD = 57; +pub const EMR_SETMITERLIMIT: DWORD = 58; +pub const EMR_BEGINPATH: DWORD = 59; +pub const EMR_ENDPATH: DWORD = 60; +pub const EMR_CLOSEFIGURE: DWORD = 61; +pub const EMR_FILLPATH: DWORD = 62; +pub const EMR_STROKEANDFILLPATH: DWORD = 63; +pub const EMR_STROKEPATH: DWORD = 64; +pub const EMR_FLATTENPATH: DWORD = 65; +pub const EMR_WIDENPATH: DWORD = 66; +pub const EMR_SELECTCLIPPATH: DWORD = 67; +pub const EMR_ABORTPATH: DWORD = 68; +pub const EMR_GDICOMMENT: DWORD = 70; +pub const EMR_FILLRGN: DWORD = 71; +pub const EMR_FRAMERGN: DWORD = 72; +pub const EMR_INVERTRGN: DWORD = 73; +pub const EMR_PAINTRGN: DWORD = 74; +pub const EMR_EXTSELECTCLIPRGN: DWORD = 75; +pub const EMR_BITBLT: DWORD = 76; +pub const EMR_STRETCHBLT: DWORD = 77; +pub const EMR_MASKBLT: DWORD = 78; +pub const EMR_PLGBLT: DWORD = 79; +pub const EMR_SETDIBITSTODEVICE: DWORD = 80; +pub const EMR_STRETCHDIBITS: DWORD = 81; +pub const EMR_EXTCREATEFONTINDIRECTW: DWORD = 82; +pub const EMR_EXTTEXTOUTA: DWORD = 83; +pub const EMR_EXTTEXTOUTW: DWORD = 84; +pub const EMR_POLYBEZIER16: DWORD = 85; +pub const EMR_POLYGON16: DWORD = 86; +pub const EMR_POLYLINE16: DWORD = 87; +pub const EMR_POLYBEZIERTO16: DWORD = 88; +pub const EMR_POLYLINETO16: DWORD = 89; +pub const EMR_POLYPOLYLINE16: DWORD = 90; +pub const EMR_POLYPOLYGON16: DWORD = 91; +pub const EMR_POLYDRAW16: DWORD = 92; +pub const EMR_CREATEMONOBRUSH: DWORD = 93; +pub const EMR_CREATEDIBPATTERNBRUSHPT: DWORD = 94; +pub const EMR_EXTCREATEPEN: DWORD = 95; +pub const EMR_POLYTEXTOUTA: DWORD = 96; +pub const EMR_POLYTEXTOUTW: DWORD = 97; +pub const EMR_SETICMMODE: DWORD = 98; +pub const EMR_CREATECOLORSPACE: DWORD = 99; +pub const EMR_SETCOLORSPACE: DWORD = 100; +pub const EMR_DELETECOLORSPACE: DWORD = 101; +pub const EMR_GLSRECORD: DWORD = 102; +pub const EMR_GLSBOUNDEDRECORD: DWORD = 103; +pub const EMR_PIXELFORMAT: DWORD = 104; +pub const EMR_RESERVED_105: DWORD = 105; +pub const EMR_RESERVED_106: DWORD = 106; +pub const EMR_RESERVED_107: DWORD = 107; +pub const EMR_RESERVED_108: DWORD = 108; +pub const EMR_RESERVED_109: DWORD = 109; +pub const EMR_RESERVED_110: DWORD = 110; +pub const EMR_COLORCORRECTPALETTE: DWORD = 111; +pub const EMR_SETICMPROFILEA: DWORD = 112; +pub const EMR_SETICMPROFILEW: DWORD = 113; +pub const EMR_ALPHABLEND: DWORD = 114; +pub const EMR_SETLAYOUT: DWORD = 115; +pub const EMR_TRANSPARENTBLT: DWORD = 116; +pub const EMR_RESERVED_117: DWORD = 117; +pub const EMR_GRADIENTFILL: DWORD = 118; +pub const EMR_RESERVED_119: DWORD = 119; +pub const EMR_RESERVED_120: DWORD = 120; +pub const EMR_COLORMATCHTOTARGETW: DWORD = 121; +pub const EMR_CREATECOLORSPACEW: DWORD = 122; +pub const EMR_MIN: DWORD = 1; +pub const EMR_MAX: DWORD = 122; +STRUCT!{struct EMR { + iType: DWORD, + nSize: DWORD, +}} +pub type PEMR = *mut EMR; +STRUCT!{struct EMRTEXT { + ptlReference: POINTL, + nChars: DWORD, + offString: DWORD, + fOptions: DWORD, + rcl: RECTL, + offDx: DWORD, +}} +pub type PEMRTEXT = *mut EMRTEXT; +STRUCT!{struct EMRABORTPATH { + emr: EMR, +}} +pub type PEMRABORTPATH = *mut EMRABORTPATH; +pub type EMRBEGINPATH = EMRABORTPATH; +pub type PEMRBEGINPATH = *mut EMRABORTPATH; +pub type EMRENDPATH = EMRABORTPATH; +pub type PEMRENDPATH = *mut EMRABORTPATH; +pub type EMRCLOSEFIGURE = EMRABORTPATH; +pub type PEMRCLOSEFIGURE = *mut EMRABORTPATH; +pub type EMRFLATTENPATH = EMRABORTPATH; +pub type PEMRFLATTENPATH = *mut EMRABORTPATH; +pub type EMRWIDENPATH = EMRABORTPATH; +pub type PEMRWIDENPATH = *mut EMRABORTPATH; +pub type EMRSETMETARGN = EMRABORTPATH; +pub type PEMRSETMETARGN = *mut EMRABORTPATH; +pub type EMRSAVEDC = EMRABORTPATH; +pub type PEMRSAVEDC = *mut EMRABORTPATH; +pub type EMRREALIZEPALETTE = EMRABORTPATH; +pub type PEMRREALIZEPALETTE = *mut EMRABORTPATH; +STRUCT!{struct EMRSELECTCLIPPATH { + emr: EMR, + iMode: DWORD, +}} +pub type PEMRSELECTCLIPPATH = *mut EMRSELECTCLIPPATH; +pub type EMRSETBKMODE = EMRSELECTCLIPPATH; +pub type PEMRSETBKMODE = *mut EMRSELECTCLIPPATH; +pub type EMRSETMAPMODE = EMRSELECTCLIPPATH; +pub type PEMRSETMAPMODE = *mut EMRSELECTCLIPPATH; +pub type EMRSETLAYOUT = EMRSELECTCLIPPATH; +pub type PEMRSETLAYOUT = *mut EMRSELECTCLIPPATH; +pub type EMRSETPOLYFILLMODE = EMRSELECTCLIPPATH; +pub type PEMRSETPOLYFILLMODE = *mut EMRSELECTCLIPPATH; +pub type EMRSETROP2 = EMRSELECTCLIPPATH; +pub type PEMRSETROP2 = *mut EMRSELECTCLIPPATH; +pub type EMRSETSTRETCHBLTMODE = EMRSELECTCLIPPATH; +pub type PEMRSETSTRETCHBLTMODE = *mut EMRSELECTCLIPPATH; +pub type EMRSETICMMODE = EMRSELECTCLIPPATH; +pub type PEMRSETICMMODE = *mut EMRSELECTCLIPPATH; +pub type EMRSETTEXTALIGN = EMRSELECTCLIPPATH; +pub type PEMRSETTEXTALIGN = *mut EMRSELECTCLIPPATH; +STRUCT!{struct EMRSETMITERLIMIT { + emr: EMR, + eMiterLimit: FLOAT, +}} +pub type PEMRSETMITERLIMIT = *mut EMRSETMITERLIMIT; +STRUCT!{struct EMRRESTOREDC { + emr: EMR, + iRelative: LONG, +}} +pub type PEMRRESTOREDC = *mut EMRRESTOREDC; +STRUCT!{struct EMRSETARCDIRECTION { + emr: EMR, + iArcDirection: DWORD, +}} +pub type PEMRSETARCDIRECTION = *mut EMRSETARCDIRECTION; +STRUCT!{struct EMRSETMAPPERFLAGS { + emr: EMR, + dwFlags: DWORD, +}} +pub type PEMRSETMAPPERFLAGS = *mut EMRSETMAPPERFLAGS; +STRUCT!{struct EMRSETBKCOLOR { + emr: EMR, + crColor: COLORREF, +}} +pub type PEMRSETBKCOLOR = *mut EMRSETBKCOLOR; +pub type EMRSETTEXTCOLOR = EMRSETBKCOLOR; +pub type PEMRSETTEXTCOLOR = *mut EMRSETBKCOLOR; +STRUCT!{struct EMRSELECTOBJECT { + emr: EMR, + ihObject: DWORD, +}} +pub type PEMRSELECTOBJECT = *mut EMRSELECTOBJECT; +pub type EMRDELETEOBJECT = EMRSELECTOBJECT; +pub type PEMRDELETEOBJECT = *mut EMRSELECTOBJECT; +STRUCT!{struct EMRSELECTPALETTE { + emr: EMR, + ihPal: DWORD, +}} +pub type PEMRSELECTPALETTE = *mut EMRSELECTPALETTE; +STRUCT!{struct EMRRESIZEPALETTE { + emr: EMR, + ihPal: DWORD, + cEntries: DWORD, +}} +pub type PEMRRESIZEPALETTE = *mut EMRRESIZEPALETTE; +STRUCT!{struct EMRSETPALETTEENTRIES { + emr: EMR, + ihPal: DWORD, + iStart: DWORD, + cEntries: DWORD, + aPalEntries: [PALETTEENTRY; 1], +}} +pub type PEMRSETPALETTEENTRIES = *mut EMRSETPALETTEENTRIES; +STRUCT!{struct EMRSETCOLORADJUSTMENT { + emr: EMR, + ColorAdjustment: COLORADJUSTMENT, +}} +pub type PEMRSETCOLORADJUSTMENT = *mut EMRSETCOLORADJUSTMENT; +STRUCT!{struct EMRGDICOMMENT { + emr: EMR, + cbData: DWORD, + Data: [BYTE; 1], +}} +pub type PEMRGDICOMMENT = *mut EMRGDICOMMENT; +STRUCT!{struct EMREOF { + emr: EMR, + nPalEntries: DWORD, + offPalEntries: DWORD, + nSizeLast: DWORD, +}} +pub type PEMREOF = *mut EMREOF; +STRUCT!{struct EMRLINETO { + emr: EMR, + ptl: POINTL, +}} +pub type PEMRLINETO = *mut EMRLINETO; +pub type EMRMOVETOEX = EMRLINETO; +pub type PEMRMOVETOEX = *mut EMRLINETO; +STRUCT!{struct EMROFFSETCLIPRGN { + emr: EMR, + ptlOffset: POINTL, +}} +pub type PEMROFFSETCLIPRGN = *mut EMROFFSETCLIPRGN; +STRUCT!{struct EMRFILLPATH { + emr: EMR, + rclBounds: RECTL, +}} +pub type PEMRFILLPATH = *mut EMRFILLPATH; +pub type EMRSTROKEANDFILLPATH = EMRFILLPATH; +pub type PEMRSTROKEANDFILLPATH = *mut EMRFILLPATH; +pub type EMRSTROKEPATH = EMRFILLPATH; +pub type PEMRSTROKEPATH = *mut EMRFILLPATH; +STRUCT!{struct EMREXCLUDECLIPRECT { + emr: EMR, + rclClip: RECTL, +}} +pub type PEMREXCLUDECLIPRECT = *mut EMREXCLUDECLIPRECT; +pub type EMRINTERSECTCLIPRECT = EMREXCLUDECLIPRECT; +pub type PEMRINTERSECTCLIPRECT = *mut EMREXCLUDECLIPRECT; +STRUCT!{struct EMRSETVIEWPORTORGEX { + emr: EMR, + ptlOrigin: POINTL, +}} +pub type PEMRSETVIEWPORTORGEX = *mut EMRSETVIEWPORTORGEX; +pub type EMRSETWINDOWORGEX = EMRSETVIEWPORTORGEX; +pub type PEMRSETWINDOWORGEX = *mut EMRSETVIEWPORTORGEX; +pub type EMRSETBRUSHORGEX = EMRSETVIEWPORTORGEX; +pub type PEMRSETBRUSHORGEX = *mut EMRSETVIEWPORTORGEX; +STRUCT!{struct EMRSETVIEWPORTEXTEX { + emr: EMR, + szlExtent: SIZEL, +}} +pub type PEMRSETVIEWPORTEXTEX = *mut EMRSETVIEWPORTEXTEX; +pub type EMRSETWINDOWEXTEX = EMRSETVIEWPORTEXTEX; +pub type PEMRSETWINDOWEXTEX = *mut EMRSETVIEWPORTEXTEX; +STRUCT!{struct EMRSCALEVIEWPORTEXTEX { + emr: EMR, + xNum: LONG, + xDenom: LONG, + yNum: LONG, + yDenom: LONG, +}} +pub type PEMRSCALEVIEWPORTEXTEX = *mut EMRSCALEVIEWPORTEXTEX; +pub type EMRSCALEWINDOWEXTEX = EMRSCALEVIEWPORTEXTEX; +pub type PEMRSCALEWINDOWEXTEX = *mut EMRSCALEVIEWPORTEXTEX; +STRUCT!{struct EMRSETWORLDTRANSFORM { + emr: EMR, + xform: XFORM, +}} +pub type PEMRSETWORLDTRANSFORM = *mut EMRSETWORLDTRANSFORM; +STRUCT!{struct EMRMODIFYWORLDTRANSFORM { + emr: EMR, + xform: XFORM, + iMode: DWORD, +}} +pub type PEMRMODIFYWORLDTRANSFORM = *mut EMRMODIFYWORLDTRANSFORM; +STRUCT!{struct EMRSETPIXELV { + emr: EMR, + ptlPixel: POINTL, + crColor: COLORREF, +}} +pub type PEMRSETPIXELV = *mut EMRSETPIXELV; +STRUCT!{struct EMREXTFLOODFILL { + emr: EMR, + ptlStart: POINTL, + crColor: COLORREF, + iMode: DWORD, +}} +pub type PEMREXTFLOODFILL = *mut EMREXTFLOODFILL; +STRUCT!{struct EMRELLIPSE { + emr: EMR, + rclBox: RECTL, +}} +pub type PEMRELLIPSE = *mut EMRELLIPSE; +pub type EMRRECTANGLE = EMRELLIPSE; +pub type PEMRRECTANGLE = *mut EMRELLIPSE; +STRUCT!{struct EMRROUNDRECT { + emr: EMR, + rclBox: RECTL, + szlCorner: SIZEL, +}} +pub type PEMRROUNDRECT = *mut EMRROUNDRECT; +STRUCT!{struct EMRARC { + emr: EMR, + rclBox: RECTL, + ptlStart: POINTL, + ptlEnd: POINTL, +}} +pub type PEMRARC = *mut EMRARC; +pub type EMRARCTO = EMRARC; +pub type PEMRARCTO = *mut EMRARC; +pub type EMRCHORD = EMRARC; +pub type PEMRCHORD = *mut EMRARC; +pub type EMRPIE = EMRARC; +pub type PEMRPIE = *mut EMRARC; +STRUCT!{struct EMRANGLEARC { + emr: EMR, + ptlCenter: POINTL, + nRadius: DWORD, + eStartAngle: FLOAT, + eSweepAngle: FLOAT, +}} +pub type PEMRANGLEARC = *mut EMRANGLEARC; +STRUCT!{struct EMRPOLYLINE { + emr: EMR, + rclBounds: RECTL, + cptl: DWORD, + aptl: [POINTL; 1], +}} +pub type PEMRPOLYLINE = *mut EMRPOLYLINE; +pub type EMRPOLYBEZIER = EMRPOLYLINE; +pub type PEMRPOLYBEZIER = *mut EMRPOLYLINE; +pub type EMRPOLYGON = EMRPOLYLINE; +pub type PEMRPOLYGON = *mut EMRPOLYLINE; +pub type EMRPOLYBEZIERTO = EMRPOLYLINE; +pub type PEMRPOLYBEZIERTO = *mut EMRPOLYLINE; +pub type EMRPOLYLINETO = EMRPOLYLINE; +pub type PEMRPOLYLINETO = *mut EMRPOLYLINE; +STRUCT!{struct EMRPOLYLINE16 { + emr: EMR, + rclBounds: RECTL, + cpts: DWORD, + apts: [POINTL; 1], +}} +pub type PEMRPOLYLINE16 = *mut EMRPOLYLINE16; +pub type EMRPOLYBEZIER16 = EMRPOLYLINE16; +pub type PEMRPOLYBEZIER16 = *mut EMRPOLYLINE16; +pub type EMRPOLYGON16 = EMRPOLYLINE16; +pub type PEMRPOLYGON16 = *mut EMRPOLYLINE16; +pub type EMRPOLYBEZIERTO16 = EMRPOLYLINE16; +pub type PEMRPOLYBEZIERTO16 = *mut EMRPOLYLINE16; +pub type EMRPOLYLINETO16 = EMRPOLYLINE16; +pub type PEMRPOLYLINETO16 = *mut EMRPOLYLINE16; +STRUCT!{struct EMRPOLYDRAW { + emr: EMR, + rclBounds: RECTL, + cptl: DWORD, + aptl: [POINTL; 1], + abTypes: [BYTE; 1], +}} +pub type PEMRPOLYDRAW = *mut EMRPOLYDRAW; +STRUCT!{struct EMRPOLYDRAW16 { + emr: EMR, + rclBounds: RECTL, + cpts: DWORD, + apts: [POINTL; 1], + abTypes: [BYTE; 1], +}} +pub type PEMRPOLYDRAW16 = *mut EMRPOLYDRAW16; +STRUCT!{struct EMRPOLYPOLYLINE { + emr: EMR, + rclBounds: RECTL, + nPolys: DWORD, + cptl: DWORD, + aPolyCounts: [DWORD; 1], + aptl: [POINTL; 1], +}} +pub type PEMRPOLYPOLYLINE = *mut EMRPOLYPOLYLINE; +pub type EMRPOLYPOLYGON = EMRPOLYPOLYLINE; +pub type PEMRPOLYPOLYGON = *mut EMRPOLYPOLYLINE; +STRUCT!{struct EMRPOLYPOLYLINE16 { + emr: EMR, + rclBounds: RECTL, + nPolys: DWORD, + cpts: DWORD, + aPolyCounts: [DWORD; 1], + apts: [POINTL; 1], +}} +pub type PEMRPOLYPOLYLINE16 = *mut EMRPOLYPOLYLINE16; +pub type EMRPOLYPOLYGON16 = EMRPOLYPOLYLINE16; +pub type PEMRPOLYPOLYGON16 = *mut EMRPOLYPOLYLINE16; +STRUCT!{struct EMRINVERTRGN { + emr: EMR, + rclBounds: RECTL, + cbRgnData: DWORD, + RgnData: [BYTE; 1], +}} +pub type PEMRINVERTRGN = *mut EMRINVERTRGN; +pub type EMRPAINTRGN = EMRINVERTRGN; +pub type PEMRPAINTRGN = *mut EMRINVERTRGN; +STRUCT!{struct EMRFILLRGN { + emr: EMR, + rclBounds: RECTL, + cbRgnData: DWORD, + ihBrush: DWORD, + RgnData: [BYTE; 1], +}} +pub type PEMRFILLRGN = *mut EMRFILLRGN; +STRUCT!{struct EMRFRAMERGN { + emr: EMR, + rclBounds: RECTL, + cbRgnData: DWORD, + ihBrush: DWORD, + szlStroke: SIZEL, + RgnData: [BYTE; 1], +}} +pub type PEMRFRAMERGN = *mut EMRFRAMERGN; +STRUCT!{struct EMREXTSELECTCLIPRGN { + emr: EMR, + cbRgnData: DWORD, + iMode: DWORD, + RgnData: [BYTE; 1], +}} +pub type PEMREXTSELECTCLIPRGN = *mut EMREXTSELECTCLIPRGN; +STRUCT!{struct EMREXTTEXTOUTA { + emr: EMR, + rclBounds: RECTL, + iGraphicsMode: DWORD, + exScale: FLOAT, + eyScale: FLOAT, + emrtext: EMRTEXT, +}} +pub type PEMREXTTEXTOUTA = *mut EMREXTTEXTOUTA; +pub type EMREXTTEXTOUTW = EMREXTTEXTOUTA; +pub type PEMREXTTEXTOUTW = *mut EMREXTTEXTOUTA; +STRUCT!{struct EMRPOLYTEXTOUTA { + emr: EMR, + rclBounds: RECTL, + iGraphicsMode: DWORD, + exScale: FLOAT, + eyScale: FLOAT, + cStrings: LONG, + aemrtext: [EMRTEXT; 1], +}} +pub type PEMRPOLYTEXTOUTA = *mut EMRPOLYTEXTOUTA; +pub type EMRPOLYTEXTOUTW = EMRPOLYTEXTOUTA; +pub type PEMRPOLYTEXTOUTW = *mut EMRPOLYTEXTOUTA; +STRUCT!{struct EMRBITBLT { + emr: EMR, + rclBounds: RECTL, + xDest: LONG, + yDest: LONG, + cxDest: LONG, + cyDest: LONG, + dwRop: DWORD, + xSrc: LONG, + ySrc: LONG, + xformSrc: XFORM, + crBkColorSrc: COLORREF, + iUsageSrc: DWORD, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, +}} +pub type PEMRBITBLT = *mut EMRBITBLT; +STRUCT!{struct EMRSTRETCHBLT { + emr: EMR, + rclBounds: RECTL, + xDest: LONG, + yDest: LONG, + cxDest: LONG, + cyDest: LONG, + dwRop: DWORD, + xSrc: LONG, + ySrc: LONG, + xformSrc: XFORM, + crBkColorSrc: COLORREF, + iUsageSrc: DWORD, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, + cxSrc: LONG, + cySrc: LONG, +}} +pub type PEMRSTRETCHBLT = *mut EMRSTRETCHBLT; +STRUCT!{struct EMRMASKBLT { + emr: EMR, + rclBounds: RECTL, + xDest: LONG, + yDest: LONG, + cxDest: LONG, + cyDest: LONG, + dwRop: DWORD, + xSrc: LONG, + ySrc: LONG, + xformSrc: XFORM, + crBkColorSrc: COLORREF, + iUsageSrc: DWORD, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, + xMask: LONG, + yMask: LONG, + iUsageMask: DWORD, + offBmiMask: DWORD, + cbBmiMask: DWORD, + offBitsMask: DWORD, + cbBitsMask: DWORD, +}} +pub type PEMRMASKBLT = *mut EMRMASKBLT; +STRUCT!{struct EMRPLGBLT { + emr: EMR, + rclBounds: RECTL, + aptlDest: [POINTL; 3], + xSrc: LONG, + ySrc: LONG, + cxSrc: LONG, + cySrc: LONG, + xformSrc: XFORM, + crBkColorSrc: COLORREF, + iUsageSrc: DWORD, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, + xMask: LONG, + yMask: LONG, + iUsageMask: DWORD, + offBmiMask: DWORD, + cbBmiMask: DWORD, + offBitsMask: DWORD, + cbBitsMask: DWORD, +}} +pub type PEMRPLGBLT = *mut EMRPLGBLT; +STRUCT!{struct EMRSETDIBITSTODEVICE { + emr: EMR, + rclBounds: RECTL, + xDest: LONG, + yDest: LONG, + xSrc: LONG, + ySrc: LONG, + cxSrc: LONG, + cySrc: LONG, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, + iUsageSrc: DWORD, + iStartScan: DWORD, + cScans: DWORD, +}} +pub type PEMRSETDIBITSTODEVICE = *mut EMRSETDIBITSTODEVICE; +STRUCT!{struct EMRSTRETCHDIBITS { + emr: EMR, + rclBounds: RECTL, + xDest: LONG, + yDest: LONG, + xSrc: LONG, + ySrc: LONG, + cxSrc: LONG, + cySrc: LONG, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, + iUsageSrc: DWORD, + dwRop: DWORD, + cxDest: LONG, + cyDest: LONG, +}} +pub type PEMRSTRETCHDIBITS = *mut EMRSTRETCHDIBITS; +STRUCT!{struct EMREXTCREATEFONTINDIRECTW { + emr: EMR, + ihFont: DWORD, + elfw: EXTLOGFONTW, +}} +pub type PEMREXTCREATEFONTINDIRECTW = *mut EMREXTCREATEFONTINDIRECTW; +STRUCT!{struct EMRCREATEPALETTE { + emr: EMR, + ihPal: DWORD, + lgpl: LOGPALETTE, +}} +pub type PEMRCREATEPALETTE = *mut EMRCREATEPALETTE; +STRUCT!{struct EMRCREATEPEN { + emr: EMR, + ihPen: DWORD, + lopn: LOGPEN, +}} +pub type PEMRCREATEPEN = *mut EMRCREATEPEN; +STRUCT!{struct EMREXTCREATEPEN { + emr: EMR, + ihPen: DWORD, + offBmi: DWORD, + cbBmi: DWORD, + offBits: DWORD, + cbBits: DWORD, + elp: EXTLOGPEN32, +}} +pub type PEMREXTCREATEPEN = *mut EMREXTCREATEPEN; +STRUCT!{struct EMRCREATEBRUSHINDIRECT { + emr: EMR, + ihBrush: DWORD, + lb: LOGBRUSH32, +}} +pub type PEMRCREATEBRUSHINDIRECT = *mut EMRCREATEBRUSHINDIRECT; +STRUCT!{struct EMRCREATEMONOBRUSH { + emr: EMR, + ihBrush: DWORD, + iUsage: DWORD, + offBmi: DWORD, + cbBmi: DWORD, + offBits: DWORD, + cbBits: DWORD, +}} +pub type PEMRCREATEMONOBRUSH = *mut EMRCREATEMONOBRUSH; +STRUCT!{struct EMRCREATEDIBPATTERNBRUSHPT { + emr: EMR, + ihBrush: DWORD, + iUsage: DWORD, + offBmi: DWORD, + cbBmi: DWORD, + offBits: DWORD, + cbBits: DWORD, +}} +pub type PEMRCREATEDIBPATTERNBRUSHPT = *mut EMRCREATEDIBPATTERNBRUSHPT; +STRUCT!{struct EMRFORMAT { + dSignature: DWORD, + nVersion: DWORD, + cbData: DWORD, + offData: DWORD, +}} +pub type PEMRFORMAT = *mut EMRFORMAT; +STRUCT!{struct EMRGLSRECORD { + emr: EMR, + cbData: DWORD, + Data: [BYTE; 1], +}} +pub type PEMRGLSRECORD = *mut EMRGLSRECORD; +STRUCT!{struct EMRGLSBOUNDEDRECORD { + emr: EMR, + rclBounds: RECTL, + cbData: DWORD, + Data: [BYTE; 1], +}} +pub type PEMRGLSBOUNDEDRECORD = *mut EMRGLSBOUNDEDRECORD; +STRUCT!{struct EMRPIXELFORMAT { + emr: EMR, + pfd: PIXELFORMATDESCRIPTOR, +}} +pub type PEMRPIXELFORMAT = *mut EMRPIXELFORMAT; +STRUCT!{struct EMRCREATECOLORSPACE { + emr: EMR, + ihCS: DWORD, + lcs: LOGCOLORSPACEA, +}} +pub type PEMRCREATECOLORSPACE = *mut EMRCREATECOLORSPACE; +STRUCT!{struct EMRSETCOLORSPACE { + emr: EMR, + ihCS: DWORD, +}} +pub type PEMRSETCOLORSPACE = *mut EMRSETCOLORSPACE; +pub type EMRSELECTCOLORSPACE = EMRSETCOLORSPACE; +pub type PEMRSELECTCOLORSPACE = *mut EMRSETCOLORSPACE; +pub type EMRDELETECOLORSPACE = EMRSETCOLORSPACE; +pub type PEMRDELETECOLORSPACE = *mut EMRSETCOLORSPACE; +STRUCT!{struct EMREXTESCAPE { + emr: EMR, + iEscape: INT, + cbEscData: INT, + EscData: [BYTE; 1], +}} +pub type PEMREXTESCAPE = *mut EMREXTESCAPE; +pub type EMRDRAWESCAPE = EMREXTESCAPE; +pub type PEMRDRAWESCAPE = *mut EMREXTESCAPE; +STRUCT!{struct EMRNAMEDESCAPE { + emr: EMR, + iEscape: INT, + cbDriver: INT, + cbEscData: INT, + EscData: [BYTE; 1], +}} +pub type PEMRNAMEDESCAPE = *mut EMRNAMEDESCAPE; +pub const SETICMPROFILE_EMBEDED: DWORD = 0x00000001; +STRUCT!{struct EMRSETICMPROFILE { + emr: EMR, + dwFlags: DWORD, + cbName: DWORD, + cbData: DWORD, + Data: [BYTE; 1], +}} +pub type PEMRSETICMPROFILE = *mut EMRSETICMPROFILE; +pub type EMRSETICMPROFILEA = EMRSETICMPROFILE; +pub type PEMRSETICMPROFILEA = *mut EMRSETICMPROFILE; +pub type EMRSETICMPROFILEW = EMRSETICMPROFILE; +pub type PEMRSETICMPROFILEW = *mut EMRSETICMPROFILE; +pub const CREATECOLORSPACE_EMBEDED: DWORD = 0x00000001; +STRUCT!{struct EMRCREATECOLORSPACEW { + emr: EMR, + ihCS: DWORD, + lcs: LOGCOLORSPACEW, + dwFlags: DWORD, + cbData: DWORD, + Data: [BYTE; 1], +}} +pub type PEMRCREATECOLORSPACEW = *mut EMRCREATECOLORSPACEW; +pub const COLORMATCHTOTARGET_EMBEDED: DWORD = 0x00000001; +STRUCT!{struct EMRCOLORMATCHTOTARGET { + emr: EMR, + dwAction: DWORD, + dwFlags: DWORD, + cbName: DWORD, + cbData: DWORD, + Data: [BYTE; 1], +}} +pub type PEMRCOLORMATCHTOTARGET = *mut EMRCOLORMATCHTOTARGET; +STRUCT!{struct EMRCOLORCORRECTPALETTE { + emr: EMR, + ihPalette: DWORD, + nFirstEntry: DWORD, + nPalEntries: DWORD, + nReserved: DWORD, +}} +pub type PEMRCOLORCORRECTPALETTE = *mut EMRCOLORCORRECTPALETTE; +STRUCT!{struct EMRALPHABLEND { + emr: EMR, + rclBounds: RECTL, + xDest: LONG, + yDest: LONG, + cxDest: LONG, + cyDest: LONG, + dwRop: DWORD, + xSrc: LONG, + ySrc: LONG, + xformSrc: XFORM, + crBkColorSrc: COLORREF, + iUsageSrc: DWORD, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, + cxSrc: LONG, + cySrc: LONG, +}} +pub type PEMRALPHABLEND = *mut EMRALPHABLEND; +STRUCT!{struct EMRGRADIENTFILL { + emr: EMR, + rclBounds: RECTL, + nVer: DWORD, + nTri: DWORD, + ulMode: ULONG, + Ver: [TRIVERTEX; 1], +}} +pub type PEMRGRADIENTFILL = *mut EMRGRADIENTFILL; +STRUCT!{struct EMRTRANSPARENTBLT { + emr: EMR, + rclBounds: RECTL, + xDest: LONG, + yDest: LONG, + cxDest: LONG, + cyDest: LONG, + dwRop: DWORD, + xSrc: LONG, + ySrc: LONG, + xformSrc: XFORM, + crBkColorSrc: COLORREF, + iUsageSrc: DWORD, + offBmiSrc: DWORD, + cbBmiSrc: DWORD, + offBitsSrc: DWORD, + cbBitsSrc: DWORD, + cxSrc: LONG, + cySrc: LONG, +}} +pub type PEMRTRANSPARENTBLT = *mut EMRTRANSPARENTBLT; +pub const GDICOMMENT_IDENTIFIER: DWORD = 0x43494447; +pub const GDICOMMENT_WINDOWS_METAFILE: DWORD = 0x80000001; +pub const GDICOMMENT_BEGINGROUP: DWORD = 0x00000002; +pub const GDICOMMENT_ENDGROUP: DWORD = 0x00000003; +pub const GDICOMMENT_MULTIFORMATS: DWORD = 0x40000004; +pub const EPS_SIGNATURE: DWORD = 0x46535045; +pub const GDICOMMENT_UNICODE_STRING: DWORD = 0x00000040; +pub const GDICOMMENT_UNICODE_END: DWORD = 0x00000080; +extern "system" { + pub fn wglCopyContext( + hglrcSrc: HGLRC, + hglrcDst: HGLRC, + mask: UINT, + ) -> BOOL; + pub fn wglCreateContext( + hdc: HDC, + ) -> HGLRC; + pub fn wglCreateLayerContext( + hdc: HDC, + iLayerPlane: c_int, + ) -> HGLRC; + pub fn wglDeleteContext( + hglrc: HGLRC, + ) -> BOOL; + pub fn wglGetCurrentContext() -> HGLRC; + pub fn wglGetCurrentDC() -> HDC; + pub fn wglGetProcAddress( + lpszProc: LPCSTR, + ) -> PROC; + pub fn wglMakeCurrent( + hdc: HDC, + hglrc: HGLRC, + ) -> BOOL; + pub fn wglShareLists( + hglrc1: HGLRC, + hglrc2: HGLRC, + ) -> BOOL; + pub fn wglUseFontBitmapsA( + hdc: HDC, + first: DWORD, + count: DWORD, + listBase: DWORD, + ) -> BOOL; + pub fn wglUseFontBitmapsW( + hdc: HDC, + first: DWORD, + count: DWORD, + listBase: DWORD, + ) -> BOOL; + pub fn SwapBuffers( + hdc: HDC, + ) -> BOOL; +} +STRUCT!{struct POINTFLOAT { + x: FLOAT, + y: FLOAT, +}} +pub type PPOINTFLOAT = *mut POINTFLOAT; +STRUCT!{struct GLYPHMETRICSFLOAT { + gmfBlackBoxX: FLOAT, + gmfBlackBoxY: FLOAT, + gmfptGlyphOrigin: POINTFLOAT, + gmfCellIncX: FLOAT, + gmfCellIncY: FLOAT, +}} +pub type PGLYPHMETRICSFLOAT = *mut GLYPHMETRICSFLOAT; +pub type LPGLYPHMETRICSFLOAT = *mut GLYPHMETRICSFLOAT; +pub const WGL_FONT_LINES: DWORD = 0; +pub const WGL_FONT_POLYGONS: DWORD = 1; +extern "system" { + pub fn wglUseFontOutlinesA( + hdc: HDC, + first: DWORD, + count: DWORD, + listBase: DWORD, + deviation: FLOAT, + extrusion: FLOAT, + format: c_int, + lpgmf: LPGLYPHMETRICSFLOAT, + ) -> BOOL; + pub fn wglUseFontOutlinesW( + hdc: HDC, + first: DWORD, + count: DWORD, + listBase: DWORD, + deviation: FLOAT, + extrusion: FLOAT, + format: c_int, + lpgmf: LPGLYPHMETRICSFLOAT, + ) -> BOOL; +} +STRUCT!{struct LAYERPLANEDESCRIPTOR { + nSize: WORD, + nVersion: WORD, + dwFlags: DWORD, + iPixelType: BYTE, + cColorBits: BYTE, + cRedBits: BYTE, + cRedShift: BYTE, + cGreenBits: BYTE, + cGreenShift: BYTE, + cBlueBits: BYTE, + cBlueShift: BYTE, + cAlphaBits: BYTE, + cAlphaShift: BYTE, + cAccumBits: BYTE, + cAccumRedBits: BYTE, + cAccumGreenBits: BYTE, + cAccumBlueBits: BYTE, + cAccumAlphaBits: BYTE, + cDepthBits: BYTE, + cStencilBits: BYTE, + cAuxBuffers: BYTE, + iLayerPlane: BYTE, + bReserved: BYTE, + crTransparent: COLORREF, +}} +pub type PLAYERPLANEDESCRIPTOR = *mut LAYERPLANEDESCRIPTOR; +pub type LPLAYERPLANEDESCRIPTOR = *mut LAYERPLANEDESCRIPTOR; +pub const LPD_DOUBLEBUFFER: DWORD = 0x00000001; +pub const LPD_STEREO: DWORD = 0x00000002; +pub const LPD_SUPPORT_GDI: DWORD = 0x00000010; +pub const LPD_SUPPORT_OPENGL: DWORD = 0x00000020; +pub const LPD_SHARE_DEPTH: DWORD = 0x00000040; +pub const LPD_SHARE_STENCIL: DWORD = 0x00000080; +pub const LPD_SHARE_ACCUM: DWORD = 0x00000100; +pub const LPD_SWAP_EXCHANGE: DWORD = 0x00000200; +pub const LPD_SWAP_COPY: DWORD = 0x00000400; +pub const LPD_TRANSPARENT: DWORD = 0x00001000; +pub const LPD_TYPE_RGBA: BYTE = 0; +pub const LPD_TYPE_COLORINDEX: BYTE = 1; +pub const WGL_SWAP_MAIN_PLANE: UINT = 0x00000001; +pub const WGL_SWAP_OVERLAY1: UINT = 0x00000002; +pub const WGL_SWAP_OVERLAY2: UINT = 0x00000004; +pub const WGL_SWAP_OVERLAY3: UINT = 0x00000008; +pub const WGL_SWAP_OVERLAY4: UINT = 0x00000010; +pub const WGL_SWAP_OVERLAY5: UINT = 0x00000020; +pub const WGL_SWAP_OVERLAY6: UINT = 0x00000040; +pub const WGL_SWAP_OVERLAY7: UINT = 0x00000080; +pub const WGL_SWAP_OVERLAY8: UINT = 0x00000100; +pub const WGL_SWAP_OVERLAY9: UINT = 0x00000200; +pub const WGL_SWAP_OVERLAY10: UINT = 0x00000400; +pub const WGL_SWAP_OVERLAY11: UINT = 0x00000800; +pub const WGL_SWAP_OVERLAY12: UINT = 0x00001000; +pub const WGL_SWAP_OVERLAY13: UINT = 0x00002000; +pub const WGL_SWAP_OVERLAY14: UINT = 0x00004000; +pub const WGL_SWAP_OVERLAY15: UINT = 0x00008000; +pub const WGL_SWAP_UNDERLAY1: UINT = 0x00010000; +pub const WGL_SWAP_UNDERLAY2: UINT = 0x00020000; +pub const WGL_SWAP_UNDERLAY3: UINT = 0x00040000; +pub const WGL_SWAP_UNDERLAY4: UINT = 0x00080000; +pub const WGL_SWAP_UNDERLAY5: UINT = 0x00100000; +pub const WGL_SWAP_UNDERLAY6: UINT = 0x00200000; +pub const WGL_SWAP_UNDERLAY7: UINT = 0x00400000; +pub const WGL_SWAP_UNDERLAY8: UINT = 0x00800000; +pub const WGL_SWAP_UNDERLAY9: UINT = 0x01000000; +pub const WGL_SWAP_UNDERLAY10: UINT = 0x02000000; +pub const WGL_SWAP_UNDERLAY11: UINT = 0x04000000; +pub const WGL_SWAP_UNDERLAY12: UINT = 0x08000000; +pub const WGL_SWAP_UNDERLAY13: UINT = 0x10000000; +pub const WGL_SWAP_UNDERLAY14: UINT = 0x20000000; +pub const WGL_SWAP_UNDERLAY15: UINT = 0x40000000; +extern "system" { + pub fn wglDescribeLayerPlane( + hdc: HDC, + iPixelFormat: c_int, + iLayerPlane: c_int, + nBytes: UINT, + plpd: LPLAYERPLANEDESCRIPTOR, + ) -> BOOL; + pub fn wglSetLayerPaletteEntries( + hdc: HDC, + iLayerPlane: c_int, + iStart: c_int, + cEntries: c_int, + pcr: *const COLORREF, + ) -> c_int; + pub fn wglGetLayerPaletteEntries( + hdc: HDC, + iLayerPlane: c_int, + iStart: c_int, + cEntries: c_int, + pcr: *const COLORREF, + ) -> c_int; + pub fn wglRealizeLayerPalette( + hdc: HDC, + iLayerPlane: c_int, + bRealize: BOOL, + ) -> BOOL; + pub fn wglSwapLayerBuffers( + hdc: HDC, + fuPlanes: UINT, + ) -> BOOL; +} +STRUCT!{struct WGLSWAP { + hdc: HDC, + uiFlags: UINT, +}} +pub type PWGLSWAP = *mut WGLSWAP; +pub type LPWGLSWAP = *mut WGLSWAP; +pub const WGL_SWAPMULTIPLE_MAX: usize = 16; +extern "system" { + pub fn wglSwapMultipleBuffers( + n: UINT, + ps: *const WGLSWAP, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/winhttp.rs b/src/vendor/winapi/src/um/winhttp.rs new file mode 100644 index 0000000000..d79bc50cbc --- /dev/null +++ b/src/vendor/winapi/src/um/winhttp.rs @@ -0,0 +1,659 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Windows HTTP Services API constant definitions and macros +use ctypes::c_int; +use shared::basetsd::DWORD_PTR; +use shared::minwindef::{BOOL, DWORD, LPCVOID, LPDWORD, LPVOID, USHORT, WORD}; +use um::minwinbase::SYSTEMTIME; +use um::winnt::{LPCWSTR, LPWSTR, PCWSTR, PVOID, PWSTR}; +pub type HINTERNET = LPVOID; +pub type LPHINTERNET = *mut HINTERNET; +pub type INTERNET_PORT = WORD; +pub type LPINTERNET_PORT = *mut INTERNET_PORT; +pub const INTERNET_DEFAULT_PORT: INTERNET_PORT = 0; +pub const INTERNET_DEFAULT_HTTP_PORT: INTERNET_PORT = 80; +pub const INTERNET_DEFAULT_HTTPS_PORT: INTERNET_PORT = 443; +pub const WINHTTP_FLAG_ASYNC: DWORD = 0x10000000; +pub const WINHTTP_FLAG_SECURE: DWORD = 0x00800000; +pub const WINHTTP_FLAG_ESCAPE_PERCENT: DWORD = 0x00000004; +pub const WINHTTP_FLAG_NULL_CODEPAGE: DWORD = 0x00000008; +pub const WINHTTP_FLAG_BYPASS_PROXY_CACHE: DWORD = 0x00000100; +pub const WINHTTP_FLAG_REFRESH: DWORD = WINHTTP_FLAG_BYPASS_PROXY_CACHE; +pub const WINHTTP_FLAG_ESCAPE_DISABLE: DWORD = 0x00000040; +pub const WINHTTP_FLAG_ESCAPE_DISABLE_QUERY: DWORD = 0x00000080; +STRUCT!{struct WINHTTP_ASYNC_RESULT { + dwResult: DWORD_PTR, + dwError: DWORD, +}} +pub type LPWINHTTP_ASYNC_RESULT = *mut WINHTTP_ASYNC_RESULT; +pub type INTERNET_SCHEME = c_int; +pub type LPINTERNET_SCHEME = *mut c_int; +pub const INTERNET_SCHEME_HTTP: INTERNET_SCHEME = 1; +pub const INTERNET_SCHEME_HTTPS: INTERNET_SCHEME = 2; +pub const INTERNET_SCHEME_FTP: INTERNET_SCHEME = 3; +pub const INTERNET_SCHEME_SOCKS: INTERNET_SCHEME = 4; +STRUCT!{struct URL_COMPONENTS { + dwStructSize: DWORD, + lpszScheme: LPWSTR, + dwSchemeLength: DWORD, + nScheme: INTERNET_SCHEME, + lpszHostName: LPWSTR, + dwHostNameLength: DWORD, + nPort: INTERNET_PORT, + lpszUserName: LPWSTR, + dwUserNameLength: DWORD, + lpszPassword: LPWSTR, + dwPasswordLength: DWORD, + lpszUrlPath: LPWSTR, + dwUrlPathLength: DWORD, + lpszExtraInfo: LPWSTR, + dwExtraInfoLength: DWORD, +}} +pub type LPURL_COMPONENTS = *mut URL_COMPONENTS; +pub type URL_COMPONENTSW = URL_COMPONENTS; +pub type LPURL_COMPONENTSW = LPURL_COMPONENTS; +STRUCT!{struct WINHTTP_PROXY_INFO { + dwAccessType: DWORD, + lpszProxy: LPWSTR, + lpszProxyBypass: LPWSTR, +}} +pub type LPWINHTTP_PROXY_INFO = *mut WINHTTP_PROXY_INFO; +pub type WINHTTP_PROXY_INFOW = WINHTTP_PROXY_INFO; +pub type LPWINHTTP_PROXY_INFOW = LPWINHTTP_PROXY_INFO; +STRUCT!{struct WINHTTP_AUTOPROXY_OPTIONS { + dwFlags: DWORD, + dwAutoDetectFlags: DWORD, + lpszAutoConfigUrl: LPCWSTR, + lpvReserved: LPVOID, + dwReserved: DWORD, + fAutoLogonIfChallenged: BOOL, +}} +pub const WINHTTP_AUTOPROXY_AUTO_DETECT: DWORD = 0x00000001; +pub const WINHTTP_AUTOPROXY_CONFIG_URL: DWORD = 0x00000002; +pub const WINHTTP_AUTOPROXY_HOST_KEEPCASE: DWORD = 0x00000004; +pub const WINHTTP_AUTOPROXY_HOST_LOWERCASE: DWORD = 0x00000008; +pub const WINHTTP_AUTOPROXY_RUN_INPROCESS: DWORD = 0x00010000; +pub const WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY: DWORD = 0x00020000; +pub const WINHTTP_AUTOPROXY_NO_DIRECTACCESS: DWORD = 0x00040000; +pub const WINHTTP_AUTOPROXY_NO_CACHE_CLIENT: DWORD = 0x00080000; +pub const WINHTTP_AUTOPROXY_NO_CACHE_SVC: DWORD = 0x00100000; +pub const WINHTTP_AUTOPROXY_SORT_RESULTS: DWORD = 0x00400000; +pub const WINHTTP_AUTO_DETECT_TYPE_DHCP: DWORD = 0x00000001; +pub const WINHTTP_AUTO_DETECT_TYPE_DNS_A: DWORD = 0x00000002; +STRUCT!{struct WINHTTP_PROXY_RESULT_ENTRY { + fProxy: BOOL, + fBypass: BOOL, + ProxyScheme: INTERNET_SCHEME, + pwszProxy: PWSTR, + ProxyPort: INTERNET_PORT, +}} +STRUCT!{struct WINHTTP_PROXY_RESULT { + cEntries: DWORD, + pEntries: *mut WINHTTP_PROXY_RESULT_ENTRY, +}} +pub const WINHTTP_FIRST_OPTION: DWORD = WINHTTP_OPTION_CALLBACK; +pub const WINHTTP_OPTION_CALLBACK: DWORD = 1; +pub const WINHTTP_OPTION_RESOLVE_TIMEOUT: DWORD = 2; +pub const WINHTTP_OPTION_CONNECT_TIMEOUT: DWORD = 3; +pub const WINHTTP_OPTION_CONNECT_RETRIES: DWORD = 4; +pub const WINHTTP_OPTION_SEND_TIMEOUT: DWORD = 5; +pub const WINHTTP_OPTION_RECEIVE_TIMEOUT: DWORD = 6; +pub const WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT: DWORD = 7; +pub const WINHTTP_OPTION_HANDLE_TYPE: DWORD = 9; +pub const WINHTTP_OPTION_READ_BUFFER_SIZE: DWORD = 12; +pub const WINHTTP_OPTION_WRITE_BUFFER_SIZE: DWORD = 13; +pub const WINHTTP_OPTION_PARENT_HANDLE: DWORD = 21; +pub const WINHTTP_OPTION_EXTENDED_ERROR: DWORD = 24; +pub const WINHTTP_OPTION_SECURITY_FLAGS: DWORD = 31; +pub const WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT: DWORD = 32; +pub const WINHTTP_OPTION_URL: DWORD = 34; +pub const WINHTTP_OPTION_SECURITY_KEY_BITNESS: DWORD = 36; +pub const WINHTTP_OPTION_PROXY: DWORD = 38; +pub const WINHTTP_OPTION_PROXY_RESULT_ENTRY: DWORD = 39; +pub const WINHTTP_OPTION_USER_AGENT: DWORD = 41; +pub const WINHTTP_OPTION_CONTEXT_VALUE: DWORD = 45; +pub const WINHTTP_OPTION_CLIENT_CERT_CONTEXT: DWORD = 47; +pub const WINHTTP_OPTION_REQUEST_PRIORITY: DWORD = 58; +pub const WINHTTP_OPTION_HTTP_VERSION: DWORD = 59; +pub const WINHTTP_OPTION_DISABLE_FEATURE: DWORD = 63; +pub const WINHTTP_OPTION_CODEPAGE: DWORD = 68; +pub const WINHTTP_OPTION_MAX_CONNS_PER_SERVER: DWORD = 73; +pub const WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER: DWORD = 74; +pub const WINHTTP_OPTION_AUTOLOGON_POLICY: DWORD = 77; +pub const WINHTTP_OPTION_SERVER_CERT_CONTEXT: DWORD = 78; +pub const WINHTTP_OPTION_ENABLE_FEATURE: DWORD = 79; +pub const WINHTTP_OPTION_WORKER_THREAD_COUNT: DWORD = 80; +pub const WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT: DWORD = 81; +pub const WINHTTP_OPTION_PASSPORT_COBRANDING_URL: DWORD = 82; +pub const WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH: DWORD = 83; +pub const WINHTTP_OPTION_SECURE_PROTOCOLS: DWORD = 84; +pub const WINHTTP_OPTION_ENABLETRACING: DWORD = 85; +pub const WINHTTP_OPTION_PASSPORT_SIGN_OUT: DWORD = 86; +pub const WINHTTP_OPTION_PASSPORT_RETURN_URL: DWORD = 87; +pub const WINHTTP_OPTION_REDIRECT_POLICY: DWORD = 88; +pub const WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS: DWORD = 89; +pub const WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE: DWORD = 90; +pub const WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE: DWORD = 91; +pub const WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE: DWORD = 92; +pub const WINHTTP_OPTION_CONNECTION_INFO: DWORD = 93; +pub const WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST: DWORD = 94; +pub const WINHTTP_OPTION_SPN: DWORD = 96; +pub const WINHTTP_OPTION_GLOBAL_PROXY_CREDS: DWORD = 97; +pub const WINHTTP_OPTION_GLOBAL_SERVER_CREDS: DWORD = 98; +pub const WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT: DWORD = 99; +pub const WINHTTP_OPTION_REJECT_USERPWD_IN_URL: DWORD = 100; +pub const WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS: DWORD = 101; +pub const WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE: DWORD = 103; +pub const WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE: DWORD = 104; +pub const WINHTTP_OPTION_SERVER_SPN_USED: DWORD = 106; +pub const WINHTTP_OPTION_PROXY_SPN_USED: DWORD = 107; +pub const WINHTTP_OPTION_SERVER_CBT: DWORD = 108; +pub const WINHTTP_OPTION_UNSAFE_HEADER_PARSING: DWORD = 110; +pub const WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS: DWORD = 111; +pub const WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET: DWORD = 114; +pub const WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT: DWORD = 115; +pub const WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL: DWORD = 116; +pub const WINHTTP_OPTION_DECOMPRESSION: DWORD = 118; +pub const WINHTTP_OPTION_WEB_SOCKET_RECEIVE_BUFFER_SIZE: DWORD = 122; +pub const WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE: DWORD = 123; +pub const WINHTTP_LAST_OPTION: DWORD = WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE; +pub const WINHTTP_OPTION_USERNAME: DWORD = 0x1000; +pub const WINHTTP_OPTION_PASSWORD: DWORD = 0x1001; +pub const WINHTTP_OPTION_PROXY_USERNAME: DWORD = 0x1002; +pub const WINHTTP_OPTION_PROXY_PASSWORD: DWORD = 0x1003; +//569 +FN!{stdcall WINHTTP_STATUS_CALLBACK( + hInternet: HINTERNET, + dwContext: DWORD_PTR, + dwInternetStatus: DWORD, + lpvStatusInformation: LPVOID, + dwStatusInformationLength: DWORD, +) -> ()} +pub type LPWINHTTP_STATUS_CALLBACK = *mut WINHTTP_STATUS_CALLBACK; +pub const WINHTTP_CALLBACK_STATUS_RESOLVING_NAME: DWORD = 0x00000001; +pub const WINHTTP_CALLBACK_STATUS_NAME_RESOLVED: DWORD = 0x00000002; +pub const WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER: DWORD = 0x00000004; +pub const WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER: DWORD = 0x00000008; +pub const WINHTTP_CALLBACK_STATUS_SENDING_REQUEST: DWORD = 0x00000010; +pub const WINHTTP_CALLBACK_STATUS_REQUEST_SENT: DWORD = 0x00000020; +pub const WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE: DWORD = 0x00000040; +pub const WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED: DWORD = 0x00000080; +pub const WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION: DWORD = 0x00000100; +pub const WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED: DWORD = 0x00000200; +pub const WINHTTP_CALLBACK_STATUS_HANDLE_CREATED: DWORD = 0x00000400; +pub const WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING: DWORD = 0x00000800; +pub const WINHTTP_CALLBACK_STATUS_DETECTING_PROXY: DWORD = 0x00001000; +pub const WINHTTP_CALLBACK_STATUS_REDIRECT: DWORD = 0x00004000; +pub const WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE: DWORD = 0x00008000; +pub const WINHTTP_CALLBACK_STATUS_SECURE_FAILURE: DWORD = 0x00010000; +pub const WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE: DWORD = 0x00020000; +pub const WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE: DWORD = 0x00040000; +pub const WINHTTP_CALLBACK_STATUS_READ_COMPLETE: DWORD = 0x00080000; +pub const WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE: DWORD = 0x00100000; +pub const WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: DWORD = 0x00200000; +pub const WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE: DWORD = 0x00400000; +pub const WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE: DWORD = 0x01000000; +pub const WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE: DWORD = 0x02000000; +pub const WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE: DWORD = 0x04000000; +pub const WINHTTP_CALLBACK_FLAG_RESOLVE_NAME: DWORD = WINHTTP_CALLBACK_STATUS_RESOLVING_NAME + | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED; +pub const WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER: DWORD = + WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER; +pub const WINHTTP_CALLBACK_FLAG_SEND_REQUEST: DWORD = + WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS_REQUEST_SENT; +pub const WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE: DWORD = + WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED; +pub const WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION: DWORD = + WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED; +pub const WINHTTP_CALLBACK_FLAG_HANDLES: DWORD = + WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING; +pub const WINHTTP_CALLBACK_FLAG_DETECTING_PROXY: DWORD = WINHTTP_CALLBACK_STATUS_DETECTING_PROXY; +pub const WINHTTP_CALLBACK_FLAG_REDIRECT: DWORD = WINHTTP_CALLBACK_STATUS_REDIRECT; +pub const WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE: DWORD = + WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE; +pub const WINHTTP_CALLBACK_FLAG_SECURE_FAILURE: DWORD = WINHTTP_CALLBACK_STATUS_SECURE_FAILURE; +pub const WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE: DWORD = + WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE: DWORD = + WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE; +pub const WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE: DWORD = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE; +pub const WINHTTP_CALLBACK_FLAG_READ_COMPLETE: DWORD = WINHTTP_CALLBACK_STATUS_READ_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE: DWORD = WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_REQUEST_ERROR: DWORD = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; +pub const WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE: DWORD = + WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS: DWORD = + WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE + | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE | WINHTTP_CALLBACK_STATUS_READ_COMPLETE + | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR + | WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE; +pub const WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS: DWORD = 0xffffffff; +pub const WINHTTP_QUERY_MIME_VERSION: DWORD = 0; +pub const WINHTTP_QUERY_CONTENT_TYPE: DWORD = 1; +pub const WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING: DWORD = 2; +pub const WINHTTP_QUERY_CONTENT_ID: DWORD = 3; +pub const WINHTTP_QUERY_CONTENT_DESCRIPTION: DWORD = 4; +pub const WINHTTP_QUERY_CONTENT_LENGTH: DWORD = 5; +pub const WINHTTP_QUERY_CONTENT_LANGUAGE: DWORD = 6; +pub const WINHTTP_QUERY_ALLOW: DWORD = 7; +pub const WINHTTP_QUERY_PUBLIC: DWORD = 8; +pub const WINHTTP_QUERY_DATE: DWORD = 9; +pub const WINHTTP_QUERY_EXPIRES: DWORD = 10; +pub const WINHTTP_QUERY_LAST_MODIFIED: DWORD = 11; +pub const WINHTTP_QUERY_MESSAGE_ID: DWORD = 12; +pub const WINHTTP_QUERY_URI: DWORD = 13; +pub const WINHTTP_QUERY_DERIVED_FROM: DWORD = 14; +pub const WINHTTP_QUERY_COST: DWORD = 15; +pub const WINHTTP_QUERY_LINK: DWORD = 16; +pub const WINHTTP_QUERY_PRAGMA: DWORD = 17; +pub const WINHTTP_QUERY_VERSION: DWORD = 18; +pub const WINHTTP_QUERY_STATUS_CODE: DWORD = 19; +pub const WINHTTP_QUERY_STATUS_TEXT: DWORD = 20; +pub const WINHTTP_QUERY_RAW_HEADERS: DWORD = 21; +pub const WINHTTP_QUERY_RAW_HEADERS_CRLF: DWORD = 22; +pub const WINHTTP_QUERY_CONNECTION: DWORD = 23; +pub const WINHTTP_QUERY_ACCEPT: DWORD = 24; +pub const WINHTTP_QUERY_ACCEPT_CHARSET: DWORD = 25; +pub const WINHTTP_QUERY_ACCEPT_ENCODING: DWORD = 26; +pub const WINHTTP_QUERY_ACCEPT_LANGUAGE: DWORD = 27; +pub const WINHTTP_QUERY_AUTHORIZATION: DWORD = 28; +pub const WINHTTP_QUERY_CONTENT_ENCODING: DWORD = 29; +pub const WINHTTP_QUERY_FORWARDED: DWORD = 30; +pub const WINHTTP_QUERY_FROM: DWORD = 31; +pub const WINHTTP_QUERY_IF_MODIFIED_SINCE: DWORD = 32; +pub const WINHTTP_QUERY_LOCATION: DWORD = 33; +pub const WINHTTP_QUERY_ORIG_URI: DWORD = 34; +pub const WINHTTP_QUERY_REFERER: DWORD = 35; +pub const WINHTTP_QUERY_RETRY_AFTER: DWORD = 36; +pub const WINHTTP_QUERY_SERVER: DWORD = 37; +pub const WINHTTP_QUERY_TITLE: DWORD = 38; +pub const WINHTTP_QUERY_USER_AGENT: DWORD = 39; +pub const WINHTTP_QUERY_WWW_AUTHENTICATE: DWORD = 40; +pub const WINHTTP_QUERY_PROXY_AUTHENTICATE: DWORD = 41; +pub const WINHTTP_QUERY_ACCEPT_RANGES: DWORD = 42; +pub const WINHTTP_QUERY_SET_COOKIE: DWORD = 43; +pub const WINHTTP_QUERY_COOKIE: DWORD = 44; +pub const WINHTTP_QUERY_REQUEST_METHOD: DWORD = 45; +pub const WINHTTP_QUERY_REFRESH: DWORD = 46; +pub const WINHTTP_QUERY_CONTENT_DISPOSITION: DWORD = 47; +pub const WINHTTP_QUERY_AGE: DWORD = 48; +pub const WINHTTP_QUERY_CACHE_CONTROL: DWORD = 49; +pub const WINHTTP_QUERY_CONTENT_BASE: DWORD = 50; +pub const WINHTTP_QUERY_CONTENT_LOCATION: DWORD = 51; +pub const WINHTTP_QUERY_CONTENT_MD5: DWORD = 52; +pub const WINHTTP_QUERY_CONTENT_RANGE: DWORD = 53; +pub const WINHTTP_QUERY_ETAG: DWORD = 54; +pub const WINHTTP_QUERY_HOST: DWORD = 55; +pub const WINHTTP_QUERY_IF_MATCH: DWORD = 56; +pub const WINHTTP_QUERY_IF_NONE_MATCH: DWORD = 57; +pub const WINHTTP_QUERY_IF_RANGE: DWORD = 58; +pub const WINHTTP_QUERY_IF_UNMODIFIED_SINCE: DWORD = 59; +pub const WINHTTP_QUERY_MAX_FORWARDS: DWORD = 60; +pub const WINHTTP_QUERY_PROXY_AUTHORIZATION: DWORD = 61; +pub const WINHTTP_QUERY_RANGE: DWORD = 62; +pub const WINHTTP_QUERY_TRANSFER_ENCODING: DWORD = 63; +pub const WINHTTP_QUERY_UPGRADE: DWORD = 64; +pub const WINHTTP_QUERY_VARY: DWORD = 65; +pub const WINHTTP_QUERY_VIA: DWORD = 66; +pub const WINHTTP_QUERY_WARNING: DWORD = 67; +pub const WINHTTP_QUERY_EXPECT: DWORD = 68; +pub const WINHTTP_QUERY_PROXY_CONNECTION: DWORD = 69; +pub const WINHTTP_QUERY_UNLESS_MODIFIED_SINCE: DWORD = 70; +pub const WINHTTP_QUERY_PROXY_SUPPORT: DWORD = 75; +pub const WINHTTP_QUERY_AUTHENTICATION_INFO: DWORD = 76; +pub const WINHTTP_QUERY_PASSPORT_URLS: DWORD = 77; +pub const WINHTTP_QUERY_PASSPORT_CONFIG: DWORD = 78; +pub const WINHTTP_QUERY_MAX: DWORD = 78; +pub const WINHTTP_QUERY_CUSTOM: DWORD = 65535; +pub const WINHTTP_QUERY_FLAG_REQUEST_HEADERS: DWORD = 0x80000000; +pub const WINHTTP_QUERY_FLAG_SYSTEMTIME: DWORD = 0x40000000; +pub const WINHTTP_QUERY_FLAG_NUMBER: DWORD = 0x20000000; +pub const HTTP_STATUS_CONTINUE: DWORD = 100; +pub const HTTP_STATUS_SWITCH_PROTOCOLS: DWORD = 101; +pub const HTTP_STATUS_OK: DWORD = 200; +pub const HTTP_STATUS_CREATED: DWORD = 201; +pub const HTTP_STATUS_ACCEPTED: DWORD = 202; +pub const HTTP_STATUS_PARTIAL: DWORD = 203; +pub const HTTP_STATUS_NO_CONTENT: DWORD = 204; +pub const HTTP_STATUS_RESET_CONTENT: DWORD = 205; +pub const HTTP_STATUS_PARTIAL_CONTENT: DWORD = 206; +pub const HTTP_STATUS_WEBDAV_MULTI_STATUS: DWORD = 207; +pub const HTTP_STATUS_AMBIGUOUS: DWORD = 300; +pub const HTTP_STATUS_MOVED: DWORD = 301; +pub const HTTP_STATUS_REDIRECT: DWORD = 302; +pub const HTTP_STATUS_REDIRECT_METHOD: DWORD = 303; +pub const HTTP_STATUS_NOT_MODIFIED: DWORD = 304; +pub const HTTP_STATUS_USE_PROXY: DWORD = 305; +pub const HTTP_STATUS_REDIRECT_KEEP_VERB: DWORD = 307; +pub const HTTP_STATUS_BAD_REQUEST: DWORD = 400; +pub const HTTP_STATUS_DENIED: DWORD = 401; +pub const HTTP_STATUS_PAYMENT_REQ: DWORD = 402; +pub const HTTP_STATUS_FORBIDDEN: DWORD = 403; +pub const HTTP_STATUS_NOT_FOUND: DWORD = 404; +pub const HTTP_STATUS_BAD_METHOD: DWORD = 405; +pub const HTTP_STATUS_NONE_ACCEPTABLE: DWORD = 406; +pub const HTTP_STATUS_PROXY_AUTH_REQ: DWORD = 407; +pub const HTTP_STATUS_REQUEST_TIMEOUT: DWORD = 408; +pub const HTTP_STATUS_CONFLICT: DWORD = 409; +pub const HTTP_STATUS_GONE: DWORD = 410; +pub const HTTP_STATUS_LENGTH_REQUIRED: DWORD = 411; +pub const HTTP_STATUS_PRECOND_FAILED: DWORD = 412; +pub const HTTP_STATUS_REQUEST_TOO_LARGE: DWORD = 413; +pub const HTTP_STATUS_URI_TOO_LONG: DWORD = 414; +pub const HTTP_STATUS_UNSUPPORTED_MEDIA: DWORD = 415; +pub const HTTP_STATUS_RETRY_WITH: DWORD = 449; +pub const HTTP_STATUS_SERVER_ERROR: DWORD = 500; +pub const HTTP_STATUS_NOT_SUPPORTED: DWORD = 501; +pub const HTTP_STATUS_BAD_GATEWAY: DWORD = 502; +pub const HTTP_STATUS_SERVICE_UNAVAIL: DWORD = 503; +pub const HTTP_STATUS_GATEWAY_TIMEOUT: DWORD = 504; +pub const HTTP_STATUS_VERSION_NOT_SUP: DWORD = 505; +pub const HTTP_STATUS_FIRST: DWORD = HTTP_STATUS_CONTINUE; +pub const HTTP_STATUS_LAST: DWORD = HTTP_STATUS_VERSION_NOT_SUP; +pub const WINHTTP_ACCESS_TYPE_DEFAULT_PROXY: DWORD = 0; +pub const WINHTTP_ACCESS_TYPE_NO_PROXY: DWORD = 1; +pub const WINHTTP_ACCESS_TYPE_NAMED_PROXY: DWORD = 3; +pub const WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY: DWORD = 4; +STRUCT!{struct WINHTTP_CURRENT_USER_IE_PROXY_CONFIG { + fAutoDetect: BOOL, + lpszAutoConfigUrl: LPWSTR, + lpszProxy: LPWSTR, + lpszProxyBypass: LPWSTR, +}} +pub const WINHTTP_ERROR_BASE: DWORD = 12000; +pub const ERROR_WINHTTP_OUT_OF_HANDLES: DWORD = WINHTTP_ERROR_BASE + 1; +pub const ERROR_WINHTTP_TIMEOUT: DWORD = WINHTTP_ERROR_BASE + 2; +pub const ERROR_WINHTTP_INTERNAL_ERROR: DWORD = WINHTTP_ERROR_BASE + 4; +pub const ERROR_WINHTTP_INVALID_URL: DWORD = WINHTTP_ERROR_BASE + 5; +pub const ERROR_WINHTTP_UNRECOGNIZED_SCHEME: DWORD = WINHTTP_ERROR_BASE + 6; +pub const ERROR_WINHTTP_NAME_NOT_RESOLVED: DWORD = WINHTTP_ERROR_BASE + 7; +pub const ERROR_WINHTTP_INVALID_OPTION: DWORD = WINHTTP_ERROR_BASE + 9; +pub const ERROR_WINHTTP_OPTION_NOT_SETTABLE: DWORD = WINHTTP_ERROR_BASE + 11; +pub const ERROR_WINHTTP_SHUTDOWN: DWORD = WINHTTP_ERROR_BASE + 12; +pub const ERROR_WINHTTP_LOGIN_FAILURE: DWORD = WINHTTP_ERROR_BASE + 15; +pub const ERROR_WINHTTP_OPERATION_CANCELLED: DWORD = WINHTTP_ERROR_BASE + 17; +pub const ERROR_WINHTTP_INCORRECT_HANDLE_TYPE: DWORD = WINHTTP_ERROR_BASE + 18; +pub const ERROR_WINHTTP_INCORRECT_HANDLE_STATE: DWORD = WINHTTP_ERROR_BASE + 19; +pub const ERROR_WINHTTP_CANNOT_CONNECT: DWORD = WINHTTP_ERROR_BASE + 29; +pub const ERROR_WINHTTP_CONNECTION_ERROR: DWORD = WINHTTP_ERROR_BASE + 30; +pub const ERROR_WINHTTP_RESEND_REQUEST: DWORD = WINHTTP_ERROR_BASE + 32; +pub const ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED: DWORD = WINHTTP_ERROR_BASE + 44; +pub const ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN: DWORD = WINHTTP_ERROR_BASE + 100; +pub const ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND: DWORD = WINHTTP_ERROR_BASE + 101; +pub const ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND: DWORD = WINHTTP_ERROR_BASE + 102; +pub const ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN: DWORD = WINHTTP_ERROR_BASE + 103; +pub const ERROR_WINHTTP_HEADER_NOT_FOUND: DWORD = WINHTTP_ERROR_BASE + 150; +pub const ERROR_WINHTTP_INVALID_SERVER_RESPONSE: DWORD = WINHTTP_ERROR_BASE + 152; +pub const ERROR_WINHTTP_INVALID_HEADER: DWORD = WINHTTP_ERROR_BASE + 153; +pub const ERROR_WINHTTP_INVALID_QUERY_REQUEST: DWORD = WINHTTP_ERROR_BASE + 154; +pub const ERROR_WINHTTP_HEADER_ALREADY_EXISTS: DWORD = WINHTTP_ERROR_BASE + 155; +pub const ERROR_WINHTTP_REDIRECT_FAILED: DWORD = WINHTTP_ERROR_BASE + 156; +pub const ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR: DWORD = WINHTTP_ERROR_BASE + 178; +pub const ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT: DWORD = WINHTTP_ERROR_BASE + 166; +pub const ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT: DWORD = WINHTTP_ERROR_BASE + 167; +pub const ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE: DWORD = WINHTTP_ERROR_BASE + 176; +pub const ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR: DWORD = WINHTTP_ERROR_BASE + 177; +pub const ERROR_WINHTTP_NOT_INITIALIZED: DWORD = WINHTTP_ERROR_BASE + 172; +pub const ERROR_WINHTTP_SECURE_FAILURE: DWORD = WINHTTP_ERROR_BASE + 175; +pub const ERROR_WINHTTP_SECURE_CERT_DATE_INVALID: DWORD = WINHTTP_ERROR_BASE + 37; +pub const ERROR_WINHTTP_SECURE_CERT_CN_INVALID: DWORD = WINHTTP_ERROR_BASE + 38; +pub const ERROR_WINHTTP_SECURE_INVALID_CA: DWORD = WINHTTP_ERROR_BASE + 45; +pub const ERROR_WINHTTP_SECURE_CERT_REV_FAILED: DWORD = WINHTTP_ERROR_BASE + 57; +pub const ERROR_WINHTTP_SECURE_CHANNEL_ERROR: DWORD = WINHTTP_ERROR_BASE + 157; +pub const ERROR_WINHTTP_SECURE_INVALID_CERT: DWORD = WINHTTP_ERROR_BASE + 169; +pub const ERROR_WINHTTP_SECURE_CERT_REVOKED: DWORD = WINHTTP_ERROR_BASE + 170; +pub const ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE: DWORD = WINHTTP_ERROR_BASE + 179; +pub const ERROR_WINHTTP_AUTODETECTION_FAILED: DWORD = WINHTTP_ERROR_BASE + 180; +pub const ERROR_WINHTTP_HEADER_COUNT_EXCEEDED: DWORD = WINHTTP_ERROR_BASE + 181; +pub const ERROR_WINHTTP_HEADER_SIZE_OVERFLOW: DWORD = WINHTTP_ERROR_BASE + 182; +pub const ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW: DWORD = WINHTTP_ERROR_BASE + 183; +pub const ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW: DWORD = WINHTTP_ERROR_BASE + 184; +pub const ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY: DWORD = WINHTTP_ERROR_BASE + 185; +pub const ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY: DWORD = WINHTTP_ERROR_BASE + 186; +pub const WINHTTP_ERROR_LAST: DWORD = WINHTTP_ERROR_BASE + 186; +pub const WINHTTP_RESET_STATE: DWORD = 0x00000001; +pub const WINHTTP_RESET_SWPAD_CURRENT_NETWORK: DWORD = 0x00000002; +pub const WINHTTP_RESET_SWPAD_ALL: DWORD = 0x00000004; +pub const WINHTTP_RESET_SCRIPT_CACHE: DWORD = 0x00000008; +pub const WINHTTP_RESET_ALL: DWORD = 0x0000FFFF; +pub const WINHTTP_RESET_NOTIFY_NETWORK_CHANGED: DWORD = 0x00010000; +pub const WINHTTP_RESET_OUT_OF_PROC: DWORD = 0x00020000; +extern "system" { + pub fn WinHttpSetStatusCallback( + hInternet: HINTERNET, + lpfnInternetCallback: WINHTTP_STATUS_CALLBACK, + dwNotificationFlags: DWORD, + dwReserved: DWORD_PTR, + ) -> WINHTTP_STATUS_CALLBACK; + pub fn WinHttpTimeFromSystemTime( + pst: *const SYSTEMTIME, + pwszTime: LPWSTR, + ) -> BOOL; + pub fn WinHttpTimeToSystemTime( + pwszTime: LPCWSTR, + pst: *mut SYSTEMTIME + ) -> BOOL; + pub fn WinHttpCrackUrl( + pwszUrl: LPCWSTR, + dwUrlLength: DWORD, + dwFlags: DWORD, + lpUrlComponents: LPURL_COMPONENTS, + ) -> BOOL; + pub fn WinHttpCreateUrl( + lpUrlComponents: LPURL_COMPONENTS, + dwFlags: DWORD, + pwszUrl: LPWSTR, + pdwUrlLength: LPDWORD, + ) -> BOOL; + pub fn WinHttpCheckPlatform() -> BOOL; + pub fn WinHttpGetDefaultProxyConfiguration( + pProxyInfo: *mut WINHTTP_PROXY_INFO, + ) -> BOOL; + pub fn WinHttpSetDefaultProxyConfiguration( + pProxyInfo: *mut WINHTTP_PROXY_INFO, + ) -> BOOL; + pub fn WinHttpOpen( + pszAgentW: LPCWSTR, + dwAccessType: DWORD, + pszProxyW: LPCWSTR, + pszProxyBypassW: LPCWSTR, + dwFlags: DWORD, + ) -> HINTERNET; + pub fn WinHttpCloseHandle( + hInternet: HINTERNET, + ) -> BOOL; + pub fn WinHttpConnect( + hSession: HINTERNET, + pswzServerName: LPCWSTR, + nServerPort: INTERNET_PORT, + dwReserved: DWORD, + ) -> HINTERNET; + pub fn WinHttpReadData( + hRequest: HINTERNET, + lpBuffer: LPVOID, + dwNumberOfBytesToRead: DWORD, + lpdwNumberOfBytesRead: LPDWORD, + ) -> BOOL; + pub fn WinHttpWriteData( + hRequest: HINTERNET, + lpBuffer: LPCVOID, + dwNumberOfBytesToWrite: DWORD, + lpdwNumberOfBytesWritten: LPDWORD, + ) -> BOOL; + pub fn WinHttpQueryDataAvailable( + hRequest: HINTERNET, + lpdwNumberOfBytesAvailable: LPDWORD, + ) -> BOOL; + pub fn WinHttpQueryOption( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + lpdwBufferLength: LPDWORD, + ) -> BOOL; + pub fn WinHttpSetOption( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + dwBufferLength: DWORD, + ) -> BOOL; + pub fn WinHttpSetTimeouts( + hInternet: HINTERNET, + nResolveTimeout: c_int, + nConnectTimeout: c_int, + nSendTimeout: c_int, + nReceiveTimeout: c_int, + ) -> BOOL; + pub fn WinHttpOpenRequest( + hConnect: HINTERNET, + pwszVerb: LPCWSTR, + pwszObjectName: LPCWSTR, + pwszVersion: LPCWSTR, + pwszReferrer: LPCWSTR, + ppwszAcceptTypes: *mut LPCWSTR, + dwFlags: DWORD, + ) -> HINTERNET; + pub fn WinHttpAddRequestHeaders( + hRequest: HINTERNET, + lpszHeaders: LPCWSTR, + dwHeadersLength: DWORD, + dwModifiers: DWORD, + ) -> BOOL; + pub fn WinHttpSendRequest( + hRequest: HINTERNET, + lpszHeaders: LPCWSTR, + dwHeadersLength: DWORD, + lpOptional: LPVOID, + dwOptionalLength: DWORD, + dwTotalLength: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn WinHttpSetCredentials( + hRequest: HINTERNET, + AuthTargets: DWORD, + AuthScheme: DWORD, + pwszUserName: LPCWSTR, + pwszPassword: LPCWSTR, + pAuthParams: LPVOID, + ) -> BOOL; + pub fn WinHttpQueryAuthSchemes( + hRequest: HINTERNET, + lpdwSupportedSchemes: LPDWORD, + lpdwFirstScheme: LPDWORD, + pdwAuthTarget: LPDWORD, + ) -> BOOL; + pub fn WinHttpReceiveResponse( + hRequest: HINTERNET, + lpReserved: LPVOID, + ) -> BOOL; + pub fn WinHttpQueryHeaders( + hRequest: HINTERNET, + dwInfoLevel: DWORD, + pwszName: LPCWSTR, + lpBuffer: LPVOID, + lpdwBufferLength: LPDWORD, + lpdwIndex: LPDWORD, + ) -> BOOL; + pub fn WinHttpDetectAutoProxyConfigUrl( + dwAutoDetectFlags: DWORD, + ppwstrAutoConfigUrl: *mut LPWSTR, + ) -> BOOL; + pub fn WinHttpGetProxyForUrl( + hSession: HINTERNET, + lpcwszUrl: LPCWSTR, + pAutoProxyOptions: *mut WINHTTP_AUTOPROXY_OPTIONS, + pProxyInfo: *mut WINHTTP_PROXY_INFO, + ) -> BOOL; + pub fn WinHttpCreateProxyResolver( + hSession: HINTERNET, + phResolver: *mut HINTERNET, + ) -> DWORD; + pub fn WinHttpGetProxyForUrlEx( + hResolver: HINTERNET, + pcwszUrl: PCWSTR, + pAutoProxyOptions: *mut WINHTTP_AUTOPROXY_OPTIONS, + pContext: DWORD_PTR, + ) -> DWORD; + pub fn WinHttpGetProxyResult( + hResolver: HINTERNET, + pProxyResult: *mut WINHTTP_PROXY_RESULT, + ) -> DWORD; + pub fn WinHttpFreeProxyResult( + pProxyResult: *mut WINHTTP_PROXY_RESULT, + ); + pub fn WinHttpResetAutoProxy( + hSession: HINTERNET, + dwFlags: DWORD, + ) -> DWORD; + pub fn WinHttpGetIEProxyConfigForCurrentUser( + pProxyConfig: *mut WINHTTP_CURRENT_USER_IE_PROXY_CONFIG, + ) -> BOOL; +} +ENUM!{enum WINHTTP_WEB_SOCKET_OPERATION { + WINHTTP_WEB_SOCKET_SEND_OPERATION = 0, + WINHTTP_WEB_SOCKET_RECEIVE_OPERATION = 1, + WINHTTP_WEB_SOCKET_CLOSE_OPERATION = 2, + WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION = 3, +}} +ENUM!{enum WINHTTP_WEB_SOCKET_BUFFER_TYPE { + WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE = 0, + WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE = 1, + WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE = 2, + WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE = 3, + WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE = 4, +}} +ENUM!{enum WINHTTP_WEB_SOCKET_CLOSE_STATUS { + WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS = 1000, + WINHTTP_WEB_SOCKET_ENDPOINT_TERMINATED_CLOSE_STATUS = 1001, + WINHTTP_WEB_SOCKET_PROTOCOL_ERROR_CLOSE_STATUS = 1002, + WINHTTP_WEB_SOCKET_INVALID_DATA_TYPE_CLOSE_STATUS = 1003, + WINHTTP_WEB_SOCKET_EMPTY_CLOSE_STATUS = 1005, + WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS = 1006, + WINHTTP_WEB_SOCKET_INVALID_PAYLOAD_CLOSE_STATUS = 1007, + WINHTTP_WEB_SOCKET_POLICY_VIOLATION_CLOSE_STATUS = 1008, + WINHTTP_WEB_SOCKET_MESSAGE_TOO_BIG_CLOSE_STATUS = 1009, + WINHTTP_WEB_SOCKET_UNSUPPORTED_EXTENSIONS_CLOSE_STATUS = 1010, + WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS = 1011, + WINHTTP_WEB_SOCKET_SECURE_HANDSHAKE_ERROR_CLOSE_STATUS = 1015, +}} +extern "system" { + pub fn WinHttpWebSocketCompleteUpgrade( + hRequest: HINTERNET, + pContext: DWORD_PTR, + ) -> HINTERNET; + pub fn WinHttpWebSocketSend( + hWebSocket: HINTERNET, + eBufferType: WINHTTP_WEB_SOCKET_BUFFER_TYPE, + pvBuffer: PVOID, + dwBufferLength: DWORD, + ) -> DWORD; + pub fn WinHttpWebSocketReceive( + hWebSocket: HINTERNET, + pvBuffer: PVOID, + dwBufferLength: DWORD, + pdwBytesRead: *mut DWORD, + peBufferType: *mut WINHTTP_WEB_SOCKET_BUFFER_TYPE, + ) -> DWORD; + pub fn WinHttpWebSocketShutdown( + hWebSocket: HINTERNET, + usStatus: USHORT, + pvReason: PVOID, + dwReasonLength: DWORD, + ) -> DWORD; + pub fn WinHttpWebSocketClose( + hWebSocket: HINTERNET, + usStatus: USHORT, + pvReason: PVOID, + dwReasonLength: DWORD, + ) -> DWORD; + pub fn WinHttpWebSocketQueryCloseStatus( + hWebSocket: HINTERNET, + pusStatus: *mut USHORT, + pvReason: PVOID, + dwReasonLength: DWORD, + pdwReasonLengthConsumed: *mut DWORD, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/wininet.rs b/src/vendor/winapi/src/um/wininet.rs new file mode 100644 index 0000000000..9873a335c4 --- /dev/null +++ b/src/vendor/winapi/src/um/wininet.rs @@ -0,0 +1,2365 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Windows Internet Services API procedure declarations, types and constants. +use ctypes::c_int; +use shared::basetsd::DWORD_PTR; +use shared::minwindef::{ + BOOL, DWORD, FALSE, FILETIME, INT, LPBYTE, + LPCVOID, LPDWORD, LPVOID, PBYTE, PDWORD, TRUE, WORD, +}; +use shared::ntdef::{LONG, LONGLONG, PLONG}; +use shared::windef::HWND; +use um::minwinbase::{LPWIN32_FIND_DATAA, LPWIN32_FIND_DATAW, SYSTEMTIME}; +use um::winineti::INTERNET_FLAG_BGUPDATE; +use um::winnt::{ + CHAR, DWORDLONG, HANDLE, LPCSTR, LPCWSTR, + LPSTR, LPWSTR, PCWSTR, PSTR, PWSTR, WCHAR, +}; +pub type HINTERNET = LPVOID; +pub type LPHINTERNET = *mut HINTERNET; +pub type INTERNET_PORT = WORD; +pub type LPINTERNET_PORT = *mut INTERNET_PORT; +pub const INTERNET_INVALID_PORT_NUMBER: DWORD = 0; +pub const INTERNET_DEFAULT_FTP_PORT: DWORD = 21; +pub const INTERNET_DEFAULT_GOPHER_PORT: DWORD = 70; +pub const INTERNET_DEFAULT_HTTP_PORT: DWORD = 80; +pub const INTERNET_DEFAULT_HTTPS_PORT: DWORD = 443; +pub const INTERNET_DEFAULT_SOCKS_PORT: DWORD = 1080; +pub const INTERNET_MAX_HOST_NAME_LENGTH: usize = 256; +pub const INTERNET_MAX_USER_NAME_LENGTH: usize = 128; +pub const INTERNET_MAX_PASSWORD_LENGTH: usize = 128; +pub const INTERNET_MAX_PORT_NUMBER_LENGTH: usize = 5; +pub const INTERNET_MAX_PORT_NUMBER_VALUE: DWORD = 65535; +pub const INTERNET_MAX_PATH_LENGTH: usize = 2048; +pub const INTERNET_MAX_SCHEME_LENGTH: usize = 32; +pub const INTERNET_MAX_URL_LENGTH: usize = INTERNET_MAX_SCHEME_LENGTH + 3 + + INTERNET_MAX_PATH_LENGTH; +pub const INTERNET_KEEP_ALIVE_UNKNOWN: DWORD = -1i32 as u32; +pub const INTERNET_KEEP_ALIVE_ENABLED: DWORD = 1; +pub const INTERNET_KEEP_ALIVE_DISABLED: DWORD = 0; +pub const INTERNET_REQFLAG_FROM_CACHE: DWORD = 0x00000001; +pub const INTERNET_REQFLAG_ASYNC: DWORD = 0x00000002; +pub const INTERNET_REQFLAG_VIA_PROXY: DWORD = 0x00000004; +pub const INTERNET_REQFLAG_NO_HEADERS: DWORD = 0x00000008; +pub const INTERNET_REQFLAG_PASSIVE: DWORD = 0x00000010; +pub const INTERNET_REQFLAG_CACHE_WRITE_DISABLED: DWORD = 0x00000040; +pub const INTERNET_REQFLAG_NET_TIMEOUT: DWORD = 0x00000080; +pub const INTERNET_FLAG_IDN_DIRECT: DWORD = 0x00000001; +pub const INTERNET_FLAG_IDN_PROXY: DWORD = 0x00000002; +pub const INTERNET_FLAG_RELOAD: DWORD = 0x80000000; +pub const INTERNET_FLAG_RAW_DATA: DWORD = 0x40000000; +pub const INTERNET_FLAG_EXISTING_CONNECT: DWORD = 0x20000000; +pub const INTERNET_FLAG_ASYNC: DWORD = 0x10000000; +pub const INTERNET_FLAG_PASSIVE: DWORD = 0x08000000; +pub const INTERNET_FLAG_NO_CACHE_WRITE: DWORD = 0x04000000; +pub const INTERNET_FLAG_DONT_CACHE: DWORD = INTERNET_FLAG_NO_CACHE_WRITE; +pub const INTERNET_FLAG_MAKE_PERSISTENT: DWORD = 0x02000000; +pub const INTERNET_FLAG_FROM_CACHE: DWORD = 0x01000000; +pub const INTERNET_FLAG_OFFLINE: DWORD = INTERNET_FLAG_FROM_CACHE; +pub const INTERNET_FLAG_SECURE: DWORD = 0x00800000; +pub const INTERNET_FLAG_KEEP_CONNECTION: DWORD = 0x00400000; +pub const INTERNET_FLAG_NO_AUTO_REDIRECT: DWORD = 0x00200000; +pub const INTERNET_FLAG_READ_PREFETCH: DWORD = 0x00100000; +pub const INTERNET_FLAG_NO_COOKIES: DWORD = 0x00080000; +pub const INTERNET_FLAG_NO_AUTH: DWORD = 0x00040000; +pub const INTERNET_FLAG_RESTRICTED_ZONE: DWORD = 0x00020000; +pub const INTERNET_FLAG_CACHE_IF_NET_FAIL: DWORD = 0x00010000; +pub const INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP: DWORD = 0x00008000; +pub const INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS: DWORD = 0x00004000; +pub const INTERNET_FLAG_IGNORE_CERT_DATE_INVALID: DWORD = 0x00002000; +pub const INTERNET_FLAG_IGNORE_CERT_CN_INVALID: DWORD = 0x00001000; +pub const INTERNET_FLAG_RESYNCHRONIZE: DWORD = 0x00000800; +pub const INTERNET_FLAG_HYPERLINK: DWORD = 0x00000400; +pub const INTERNET_FLAG_NO_UI: DWORD = 0x00000200; +pub const INTERNET_FLAG_PRAGMA_NOCACHE: DWORD = 0x00000100; +pub const INTERNET_FLAG_CACHE_ASYNC: DWORD = 0x00000080; +pub const INTERNET_FLAG_FORMS_SUBMIT: DWORD = 0x00000040; +pub const INTERNET_FLAG_FWD_BACK: DWORD = 0x00000020; +pub const INTERNET_FLAG_NEED_FILE: DWORD = 0x00000010; +pub const INTERNET_FLAG_MUST_CACHE_REQUEST: DWORD = INTERNET_FLAG_NEED_FILE; +pub const INTERNET_FLAG_TRANSFER_ASCII: DWORD = FTP_TRANSFER_TYPE_ASCII; +pub const INTERNET_FLAG_TRANSFER_BINARY: DWORD = FTP_TRANSFER_TYPE_BINARY; +pub const SECURITY_INTERNET_MASK: DWORD = INTERNET_FLAG_IGNORE_CERT_CN_INVALID + | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS + | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP; +pub const SECURITY_IGNORE_ERROR_MASK: DWORD = INTERNET_FLAG_IGNORE_CERT_CN_INVALID + | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | SECURITY_FLAG_IGNORE_UNKNOWN_CA + | SECURITY_FLAG_IGNORE_REVOCATION; +pub const INTERNET_FLAGS_MASK: DWORD = INTERNET_FLAG_RELOAD | INTERNET_FLAG_RAW_DATA + | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_ASYNC | INTERNET_FLAG_PASSIVE + | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_MAKE_PERSISTENT | INTERNET_FLAG_FROM_CACHE + | INTERNET_FLAG_SECURE | INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_NO_AUTO_REDIRECT + | INTERNET_FLAG_READ_PREFETCH | INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_NO_AUTH + | INTERNET_FLAG_CACHE_IF_NET_FAIL | SECURITY_INTERNET_MASK | INTERNET_FLAG_RESYNCHRONIZE + | INTERNET_FLAG_HYPERLINK | INTERNET_FLAG_NO_UI | INTERNET_FLAG_PRAGMA_NOCACHE + | INTERNET_FLAG_CACHE_ASYNC | INTERNET_FLAG_FORMS_SUBMIT | INTERNET_FLAG_NEED_FILE + | INTERNET_FLAG_RESTRICTED_ZONE | INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_TRANSFER_ASCII + | INTERNET_FLAG_FWD_BACK | INTERNET_FLAG_BGUPDATE; +pub const INTERNET_ERROR_MASK_INSERT_CDROM: DWORD = 0x1; +pub const INTERNET_ERROR_MASK_COMBINED_SEC_CERT: DWORD = 0x2; +pub const INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG: DWORD = 0x4; +pub const INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY: DWORD = 0x8; +pub const INTERNET_OPTIONS_MASK: DWORD = !INTERNET_FLAGS_MASK; +pub const WININET_API_FLAG_ASYNC: DWORD = 0x00000001; +pub const WININET_API_FLAG_SYNC: DWORD = 0x00000004; +pub const WININET_API_FLAG_USE_CONTEXT: DWORD = 0x00000008; +pub const INTERNET_NO_CALLBACK: DWORD = 0; +ENUM!{enum INTERNET_SCHEME { + INTERNET_SCHEME_PARTIAL = -2i32 as u32, + INTERNET_SCHEME_UNKNOWN = -1i32 as u32, + INTERNET_SCHEME_DEFAULT = 0, + INTERNET_SCHEME_FTP, + INTERNET_SCHEME_GOPHER, + INTERNET_SCHEME_HTTP, + INTERNET_SCHEME_HTTPS, + INTERNET_SCHEME_FILE, + INTERNET_SCHEME_NEWS, + INTERNET_SCHEME_MAILTO, + INTERNET_SCHEME_SOCKS, + INTERNET_SCHEME_JAVASCRIPT, + INTERNET_SCHEME_VBSCRIPT, + INTERNET_SCHEME_RES, + INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP, + INTERNET_SCHEME_LAST = INTERNET_SCHEME_RES, +}} +pub type LPINTERNET_SCHEME = *mut INTERNET_SCHEME; +STRUCT!{struct INTERNET_ASYNC_RESULT { + dwResult: DWORD_PTR, + dwError: DWORD, +}} +pub type LPINTERNET_ASYNC_RESULT = *mut INTERNET_ASYNC_RESULT; +STRUCT!{struct INTERNET_DIAGNOSTIC_SOCKET_INFO { + Socket: DWORD_PTR, + SourcePort: DWORD, + DestPort: DWORD, + Flags: DWORD, +}} +pub type LPINTERNET_DIAGNOSTIC_SOCKET_INFO = *mut INTERNET_DIAGNOSTIC_SOCKET_INFO; +pub const IDSI_FLAG_KEEP_ALIVE: DWORD = 0x00000001; +pub const IDSI_FLAG_SECURE: DWORD = 0x00000002; +pub const IDSI_FLAG_PROXY: DWORD = 0x00000004; +pub const IDSI_FLAG_TUNNEL: DWORD = 0x00000008; +STRUCT!{struct INTERNET_PROXY_INFO { + dwAccessType: DWORD, + lpszProxy: LPCWSTR, + lpszProxyBypass: LPCWSTR, +}} +pub type LPINTERNET_PROXY_INFO = *mut INTERNET_PROXY_INFO; +UNION!{union INTERNET_PER_CONN_OPTIONA_Value { + [u32; 2] [u64; 1], + dwValue dwValue_mut: DWORD, + pszValue pszValue_mut: LPSTR, + ftValue ftValue_mut: FILETIME, +}} +STRUCT!{struct INTERNET_PER_CONN_OPTIONA { + dwOption: DWORD, + Value: INTERNET_PER_CONN_OPTIONA_Value, +}} +pub type LPINTERNET_PER_CONN_OPTIONA = *mut INTERNET_PER_CONN_OPTIONA; +UNION!{union INTERNET_PER_CONN_OPTIONW_Value { + [u32; 2] [u64; 1], + dwValue dwValue_mut: DWORD, + pszValue pszValue_mut: LPWSTR, + ftValue ftValue_mut: FILETIME, +}} +STRUCT!{struct INTERNET_PER_CONN_OPTIONW { + dwOption: DWORD, + Value: INTERNET_PER_CONN_OPTIONW_Value, +}} +pub type LPINTERNET_PER_CONN_OPTIONW = *mut INTERNET_PER_CONN_OPTIONW; +STRUCT!{struct INTERNET_PER_CONN_OPTION_LISTA { + dwSize: DWORD, + pszConnection: LPSTR, + dwOptionCount: DWORD, + dwOptionError: DWORD, + pOptions: LPINTERNET_PER_CONN_OPTIONA, +}} +pub type LPINTERNET_PER_CONN_OPTION_LISTA = *mut INTERNET_PER_CONN_OPTION_LISTA; +STRUCT!{struct INTERNET_PER_CONN_OPTION_LISTW { + dwSize: DWORD, + pszConnection: LPWSTR, + dwOptionCount: DWORD, + dwOptionError: DWORD, + pOptions: LPINTERNET_PER_CONN_OPTIONW, +}} +pub type LPINTERNET_PER_CONN_OPTION_LISTW = *mut INTERNET_PER_CONN_OPTION_LISTW; +pub const INTERNET_PER_CONN_FLAGS: DWORD = 1; +pub const INTERNET_PER_CONN_PROXY_SERVER: DWORD = 2; +pub const INTERNET_PER_CONN_PROXY_BYPASS: DWORD = 3; +pub const INTERNET_PER_CONN_AUTOCONFIG_URL: DWORD = 4; +pub const INTERNET_PER_CONN_AUTODISCOVERY_FLAGS: DWORD = 5; +pub const INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL: DWORD = 6; +pub const INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS: DWORD = 7; +pub const INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME: DWORD = 8; +pub const INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL: DWORD = 9; +pub const INTERNET_PER_CONN_FLAGS_UI: DWORD = 10; +pub const PROXY_TYPE_DIRECT: DWORD = 0x00000001; +pub const PROXY_TYPE_PROXY: DWORD = 0x00000002; +pub const PROXY_TYPE_AUTO_PROXY_URL: DWORD = 0x00000004; +pub const PROXY_TYPE_AUTO_DETECT: DWORD = 0x00000008; +pub const AUTO_PROXY_FLAG_USER_SET: DWORD = 0x00000001; +pub const AUTO_PROXY_FLAG_ALWAYS_DETECT: DWORD = 0x00000002; +pub const AUTO_PROXY_FLAG_DETECTION_RUN: DWORD = 0x00000004; +pub const AUTO_PROXY_FLAG_MIGRATED: DWORD = 0x00000008; +pub const AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT: DWORD = 0x00000010; +pub const AUTO_PROXY_FLAG_CACHE_INIT_RUN: DWORD = 0x00000020; +pub const AUTO_PROXY_FLAG_DETECTION_SUSPECT: DWORD = 0x00000040; +STRUCT!{struct INTERNET_VERSION_INFO { + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, +}} +pub type LPINTERNET_VERSION_INFO = *mut INTERNET_VERSION_INFO; +STRUCT!{struct HTTP_VERSION_INFO { + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, +}} +pub type LPHTTP_VERSION_INFO = *mut HTTP_VERSION_INFO; +STRUCT!{struct INTERNET_CONNECTED_INFO { + dwConnectedState: DWORD, + dwFlags: DWORD, +}} +pub type LPINTERNET_CONNECTED_INFO = *mut INTERNET_CONNECTED_INFO; +pub const ISO_FORCE_DISCONNECTED: DWORD = 0x00000001; +STRUCT!{struct URL_COMPONENTSA { + dwStructSize: DWORD, + lpszScheme: LPSTR, + dwSchemeLength: DWORD, + nScheme: INTERNET_SCHEME, + lpszHostName: LPSTR, + dwHostNameLength: DWORD, + nPort: INTERNET_PORT, + lpszUserName: LPSTR, + dwUserNameLength: DWORD, + lpszPassword: LPSTR, + dwPasswordLength: DWORD, + lpszUrlPath: LPSTR, + dwUrlPathLength: DWORD, + lpszExtraInfo: LPSTR, + dwExtraInfoLength: DWORD, +}} +pub type LPURL_COMPONENTSA = *mut URL_COMPONENTSA; +STRUCT!{struct URL_COMPONENTSW { + dwStructSize: DWORD, + lpszScheme: LPWSTR, + dwSchemeLength: DWORD, + nScheme: INTERNET_SCHEME, + lpszHostName: LPWSTR, + dwHostNameLength: DWORD, + nPort: INTERNET_PORT, + lpszUserName: LPWSTR, + dwUserNameLength: DWORD, + lpszPassword: LPWSTR, + dwPasswordLength: DWORD, + lpszUrlPath: LPWSTR, + dwUrlPathLength: DWORD, + lpszExtraInfo: LPWSTR, + dwExtraInfoLength: DWORD, +}} +pub type LPURL_COMPONENTSW = *mut URL_COMPONENTSW; +STRUCT!{struct INTERNET_CERTIFICATE_INFO { + ftExpiry: FILETIME, + ftStart: FILETIME, + lpszSubjectInfo: LPWSTR, + lpszIssuerInfo: LPWSTR, + lpszProtocolName: LPWSTR, + lpszSignatureAlgName: LPWSTR, + lpszEncryptionAlgName: LPWSTR, + dwKeySize: DWORD, +}} +pub type LPINTERNET_CERTIFICATE_INFO = *mut INTERNET_CERTIFICATE_INFO; +STRUCT!{struct INTERNET_BUFFERSA { + dwStructSize: DWORD, + Next: *mut INTERNET_BUFFERSA, + lpcszHeader: LPCSTR, + dwHeadersLength: DWORD, + dwHeadersTotal: DWORD, + lpvBuffer: LPVOID, + dwBufferLength: DWORD, + dwBufferTotal: DWORD, + dwOffsetLow: DWORD, + dwOffsetHigh: DWORD, +}} +pub type LPINTERNET_BUFFERSA = *mut INTERNET_BUFFERSA; +STRUCT!{struct INTERNET_BUFFERSW { + dwStructSize: DWORD, + Next: *mut INTERNET_BUFFERSW, + lpcszHeader: LPCWSTR, + dwHeadersLength: DWORD, + dwHeadersTotal: DWORD, + lpvBuffer: LPVOID, + dwBufferLength: DWORD, + dwBufferTotal: DWORD, + dwOffsetLow: DWORD, + dwOffsetHigh: DWORD, +}} +pub type LPINTERNET_BUFFERSW = *mut INTERNET_BUFFERSW; +pub const INTERNET_RFC1123_FORMAT: DWORD = 0; +pub const INTERNET_RFC1123_BUFSIZE: DWORD = 30; +pub const ICU_ESCAPE: DWORD = 0x80000000; +pub const ICU_USERNAME: DWORD = 0x40000000; +pub const ICU_NO_ENCODE: DWORD = 0x20000000; +pub const ICU_DECODE: DWORD = 0x10000000; +pub const ICU_NO_META: DWORD = 0x08000000; +pub const ICU_ENCODE_SPACES_ONLY: DWORD = 0x04000000; +pub const ICU_BROWSER_MODE: DWORD = 0x02000000; +pub const ICU_ENCODE_PERCENT: DWORD = 0x00001000; +pub const INTERNET_OPEN_TYPE_PRECONFIG: DWORD = 0; +pub const INTERNET_OPEN_TYPE_DIRECT: DWORD = 1; +pub const INTERNET_OPEN_TYPE_PROXY: DWORD = 3; +pub const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY: DWORD = 4; +pub const PRE_CONFIG_INTERNET_ACCESS: DWORD = INTERNET_OPEN_TYPE_PRECONFIG; +pub const LOCAL_INTERNET_ACCESS: DWORD = INTERNET_OPEN_TYPE_DIRECT; +pub const CERN_PROXY_INTERNET_ACCESS: DWORD = INTERNET_OPEN_TYPE_PROXY; +pub const INTERNET_SERVICE_FTP: DWORD = 1; +pub const INTERNET_SERVICE_GOPHER: DWORD = 2; +pub const INTERNET_SERVICE_HTTP: DWORD = 3; +pub const IRF_ASYNC: DWORD = WININET_API_FLAG_ASYNC; +pub const IRF_SYNC: DWORD = WININET_API_FLAG_SYNC; +pub const IRF_USE_CONTEXT: DWORD = WININET_API_FLAG_USE_CONTEXT; +pub const IRF_NO_WAIT: DWORD = 0x00000008; +pub const ISO_GLOBAL: DWORD = 0x00000001; +pub const ISO_REGISTRY: DWORD = 0x00000002; +pub const ISO_VALID_FLAGS: DWORD = ISO_GLOBAL | ISO_REGISTRY; +pub const INTERNET_OPTION_CALLBACK: DWORD = 1; +pub const INTERNET_OPTION_CONNECT_TIMEOUT: DWORD = 2; +pub const INTERNET_OPTION_CONNECT_RETRIES: DWORD = 3; +pub const INTERNET_OPTION_CONNECT_BACKOFF: DWORD = 4; +pub const INTERNET_OPTION_SEND_TIMEOUT: DWORD = 5; +pub const INTERNET_OPTION_CONTROL_SEND_TIMEOUT: DWORD = INTERNET_OPTION_SEND_TIMEOUT; +pub const INTERNET_OPTION_RECEIVE_TIMEOUT: DWORD = 6; +pub const INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT: DWORD = INTERNET_OPTION_RECEIVE_TIMEOUT; +pub const INTERNET_OPTION_DATA_SEND_TIMEOUT: DWORD = 7; +pub const INTERNET_OPTION_DATA_RECEIVE_TIMEOUT: DWORD = 8; +pub const INTERNET_OPTION_HANDLE_TYPE: DWORD = 9; +pub const INTERNET_OPTION_LISTEN_TIMEOUT: DWORD = 11; +pub const INTERNET_OPTION_READ_BUFFER_SIZE: DWORD = 12; +pub const INTERNET_OPTION_WRITE_BUFFER_SIZE: DWORD = 13; +pub const INTERNET_OPTION_ASYNC_ID: DWORD = 15; +pub const INTERNET_OPTION_ASYNC_PRIORITY: DWORD = 16; +pub const INTERNET_OPTION_PARENT_HANDLE: DWORD = 21; +pub const INTERNET_OPTION_KEEP_CONNECTION: DWORD = 22; +pub const INTERNET_OPTION_REQUEST_FLAGS: DWORD = 23; +pub const INTERNET_OPTION_EXTENDED_ERROR: DWORD = 24; +pub const INTERNET_OPTION_OFFLINE_MODE: DWORD = 26; +pub const INTERNET_OPTION_CACHE_STREAM_HANDLE: DWORD = 27; +pub const INTERNET_OPTION_USERNAME: DWORD = 28; +pub const INTERNET_OPTION_PASSWORD: DWORD = 29; +pub const INTERNET_OPTION_ASYNC: DWORD = 30; +pub const INTERNET_OPTION_SECURITY_FLAGS: DWORD = 31; +pub const INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT: DWORD = 32; +pub const INTERNET_OPTION_DATAFILE_NAME: DWORD = 33; +pub const INTERNET_OPTION_URL: DWORD = 34; +pub const INTERNET_OPTION_SECURITY_CERTIFICATE: DWORD = 35; +pub const INTERNET_OPTION_SECURITY_KEY_BITNESS: DWORD = 36; +pub const INTERNET_OPTION_REFRESH: DWORD = 37; +pub const INTERNET_OPTION_PROXY: DWORD = 38; +pub const INTERNET_OPTION_SETTINGS_CHANGED: DWORD = 39; +pub const INTERNET_OPTION_VERSION: DWORD = 40; +pub const INTERNET_OPTION_USER_AGENT: DWORD = 41; +pub const INTERNET_OPTION_END_BROWSER_SESSION: DWORD = 42; +pub const INTERNET_OPTION_PROXY_USERNAME: DWORD = 43; +pub const INTERNET_OPTION_PROXY_PASSWORD: DWORD = 44; +pub const INTERNET_OPTION_CONTEXT_VALUE: DWORD = 45; +pub const INTERNET_OPTION_CONNECT_LIMIT: DWORD = 46; +pub const INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT: DWORD = 47; +pub const INTERNET_OPTION_POLICY: DWORD = 48; +pub const INTERNET_OPTION_DISCONNECTED_TIMEOUT: DWORD = 49; +pub const INTERNET_OPTION_CONNECTED_STATE: DWORD = 50; +pub const INTERNET_OPTION_IDLE_STATE: DWORD = 51; +pub const INTERNET_OPTION_OFFLINE_SEMANTICS: DWORD = 52; +pub const INTERNET_OPTION_SECONDARY_CACHE_KEY: DWORD = 53; +pub const INTERNET_OPTION_CALLBACK_FILTER: DWORD = 54; +pub const INTERNET_OPTION_CONNECT_TIME: DWORD = 55; +pub const INTERNET_OPTION_SEND_THROUGHPUT: DWORD = 56; +pub const INTERNET_OPTION_RECEIVE_THROUGHPUT: DWORD = 57; +pub const INTERNET_OPTION_REQUEST_PRIORITY: DWORD = 58; +pub const INTERNET_OPTION_HTTP_VERSION: DWORD = 59; +pub const INTERNET_OPTION_RESET_URLCACHE_SESSION: DWORD = 60; +pub const INTERNET_OPTION_ERROR_MASK: DWORD = 62; +pub const INTERNET_OPTION_FROM_CACHE_TIMEOUT: DWORD = 63; +pub const INTERNET_OPTION_BYPASS_EDITED_ENTRY: DWORD = 64; +pub const INTERNET_OPTION_HTTP_DECODING: DWORD = 65; +pub const INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO: DWORD = 67; +pub const INTERNET_OPTION_CODEPAGE: DWORD = 68; +pub const INTERNET_OPTION_CACHE_TIMESTAMPS: DWORD = 69; +pub const INTERNET_OPTION_DISABLE_AUTODIAL: DWORD = 70; +pub const INTERNET_OPTION_MAX_CONNS_PER_SERVER: DWORD = 73; +pub const INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: DWORD = 74; +pub const INTERNET_OPTION_PER_CONNECTION_OPTION: DWORD = 75; +pub const INTERNET_OPTION_DIGEST_AUTH_UNLOAD: DWORD = 76; +pub const INTERNET_OPTION_IGNORE_OFFLINE: DWORD = 77; +pub const INTERNET_OPTION_IDENTITY: DWORD = 78; +pub const INTERNET_OPTION_REMOVE_IDENTITY: DWORD = 79; +pub const INTERNET_OPTION_ALTER_IDENTITY: DWORD = 80; +pub const INTERNET_OPTION_SUPPRESS_BEHAVIOR: DWORD = 81; +pub const INTERNET_OPTION_AUTODIAL_MODE: DWORD = 82; +pub const INTERNET_OPTION_AUTODIAL_CONNECTION: DWORD = 83; +pub const INTERNET_OPTION_CLIENT_CERT_CONTEXT: DWORD = 84; +pub const INTERNET_OPTION_AUTH_FLAGS: DWORD = 85; +pub const INTERNET_OPTION_COOKIES_3RD_PARTY: DWORD = 86; +pub const INTERNET_OPTION_DISABLE_PASSPORT_AUTH: DWORD = 87; +pub const INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY: DWORD = 88; +pub const INTERNET_OPTION_EXEMPT_CONNECTION_LIMIT: DWORD = 89; +pub const INTERNET_OPTION_ENABLE_PASSPORT_AUTH: DWORD = 90; +pub const INTERNET_OPTION_HIBERNATE_INACTIVE_WORKER_THREADS: DWORD = 91; +pub const INTERNET_OPTION_ACTIVATE_WORKER_THREADS: DWORD = 92; +pub const INTERNET_OPTION_RESTORE_WORKER_THREAD_DEFAULTS: DWORD = 93; +pub const INTERNET_OPTION_SOCKET_SEND_BUFFER_LENGTH: DWORD = 94; +pub const INTERNET_OPTION_PROXY_SETTINGS_CHANGED: DWORD = 95; +pub const INTERNET_OPTION_DATAFILE_EXT: DWORD = 96; +pub const INTERNET_OPTION_CODEPAGE_PATH: DWORD = 100; +pub const INTERNET_OPTION_CODEPAGE_EXTRA: DWORD = 101; +pub const INTERNET_OPTION_IDN: DWORD = 102; +pub const INTERNET_OPTION_MAX_CONNS_PER_PROXY: DWORD = 103; +pub const INTERNET_OPTION_SUPPRESS_SERVER_AUTH: DWORD = 104; +pub const INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT: DWORD = 105; +pub const INTERNET_OPTION_ENABLE_REDIRECT_CACHE_READ: DWORD = 122; +pub const INTERNET_OPTION_ENCODE_EXTRA: DWORD = 155; +pub const INTERNET_FIRST_OPTION: DWORD = INTERNET_OPTION_CALLBACK; +pub const INTERNET_LAST_OPTION: DWORD = INTERNET_OPTION_ENCODE_EXTRA; +pub const INTERNET_PRIORITY_FOREGROUND: DWORD = 1000; +pub const INTERNET_HANDLE_TYPE_INTERNET: DWORD = 1; +pub const INTERNET_HANDLE_TYPE_CONNECT_FTP: DWORD = 2; +pub const INTERNET_HANDLE_TYPE_CONNECT_GOPHER: DWORD = 3; +pub const INTERNET_HANDLE_TYPE_CONNECT_HTTP: DWORD = 4; +pub const INTERNET_HANDLE_TYPE_FTP_FIND: DWORD = 5; +pub const INTERNET_HANDLE_TYPE_FTP_FIND_HTML: DWORD = 6; +pub const INTERNET_HANDLE_TYPE_FTP_FILE: DWORD = 7; +pub const INTERNET_HANDLE_TYPE_FTP_FILE_HTML: DWORD = 8; +pub const INTERNET_HANDLE_TYPE_GOPHER_FIND: DWORD = 9; +pub const INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML: DWORD = 10; +pub const INTERNET_HANDLE_TYPE_GOPHER_FILE: DWORD = 11; +pub const INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML: DWORD = 12; +pub const INTERNET_HANDLE_TYPE_HTTP_REQUEST: DWORD = 13; +pub const INTERNET_HANDLE_TYPE_FILE_REQUEST: DWORD = 14; +pub const AUTH_FLAG_DISABLE_NEGOTIATE: DWORD = 0x00000001; +pub const AUTH_FLAG_ENABLE_NEGOTIATE: DWORD = 0x00000002; +pub const AUTH_FLAG_DISABLE_BASIC_CLEARCHANNEL: DWORD = 0x00000004; +pub const AUTH_FLAG_DISABLE_SERVER_AUTH: DWORD = 0x00000008; +pub const SECURITY_FLAG_SECURE: DWORD = 0x00000001; +pub const SECURITY_FLAG_STRENGTH_WEAK: DWORD = 0x10000000; +pub const SECURITY_FLAG_STRENGTH_MEDIUM: DWORD = 0x40000000; +pub const SECURITY_FLAG_STRENGTH_STRONG: DWORD = 0x20000000; +pub const SECURITY_FLAG_UNKNOWNBIT: DWORD = 0x80000000; +pub const SECURITY_FLAG_FORTEZZA: DWORD = 0x08000000; +pub const SECURITY_FLAG_NORMALBITNESS: DWORD = SECURITY_FLAG_STRENGTH_WEAK; +pub const SECURITY_FLAG_SSL: DWORD = 0x00000002; +pub const SECURITY_FLAG_SSL3: DWORD = 0x00000004; +pub const SECURITY_FLAG_PCT: DWORD = 0x00000008; +pub const SECURITY_FLAG_PCT4: DWORD = 0x00000010; +pub const SECURITY_FLAG_IETFSSL4: DWORD = 0x00000020; +pub const SECURITY_FLAG_40BIT: DWORD = SECURITY_FLAG_STRENGTH_WEAK; +pub const SECURITY_FLAG_128BIT: DWORD = SECURITY_FLAG_STRENGTH_STRONG; +pub const SECURITY_FLAG_56BIT: DWORD = SECURITY_FLAG_STRENGTH_MEDIUM; +pub const SECURITY_FLAG_IGNORE_REVOCATION: DWORD = 0x00000080; +pub const SECURITY_FLAG_IGNORE_UNKNOWN_CA: DWORD = 0x00000100; +pub const SECURITY_FLAG_IGNORE_WRONG_USAGE: DWORD = 0x00000200; +pub const SECURITY_FLAG_IGNORE_CERT_CN_INVALID: DWORD = INTERNET_FLAG_IGNORE_CERT_CN_INVALID; +pub const SECURITY_FLAG_IGNORE_CERT_DATE_INVALID: DWORD = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID; +pub const SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS: DWORD = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS; +pub const SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP: DWORD = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP; +pub const SECURITY_SET_MASK: DWORD = SECURITY_FLAG_IGNORE_REVOCATION + | SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID + | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | SECURITY_FLAG_IGNORE_WRONG_USAGE; +pub const AUTODIAL_MODE_NEVER: DWORD = 1; +pub const AUTODIAL_MODE_ALWAYS: DWORD = 2; +pub const AUTODIAL_MODE_NO_NETWORK_PRESENT: DWORD = 4; +FN!{stdcall INTERNET_STATUS_CALLBACK( + HINTERNET, + DWORD_PTR, + DWORD, + LPVOID, + DWORD, +) -> ()} +pub type LPINTERNET_STATUS_CALLBACK = *mut INTERNET_STATUS_CALLBACK; +pub const INTERNET_STATUS_RESOLVING_NAME: DWORD = 10; +pub const INTERNET_STATUS_NAME_RESOLVED: DWORD = 11; +pub const INTERNET_STATUS_CONNECTING_TO_SERVER: DWORD = 20; +pub const INTERNET_STATUS_CONNECTED_TO_SERVER: DWORD = 21; +pub const INTERNET_STATUS_SENDING_REQUEST: DWORD = 30; +pub const INTERNET_STATUS_REQUEST_SENT: DWORD = 31; +pub const INTERNET_STATUS_RECEIVING_RESPONSE: DWORD = 40; +pub const INTERNET_STATUS_RESPONSE_RECEIVED: DWORD = 41; +pub const INTERNET_STATUS_CTL_RESPONSE_RECEIVED: DWORD = 42; +pub const INTERNET_STATUS_PREFETCH: DWORD = 43; +pub const INTERNET_STATUS_CLOSING_CONNECTION: DWORD = 50; +pub const INTERNET_STATUS_CONNECTION_CLOSED: DWORD = 51; +pub const INTERNET_STATUS_HANDLE_CREATED: DWORD = 60; +pub const INTERNET_STATUS_HANDLE_CLOSING: DWORD = 70; +pub const INTERNET_STATUS_DETECTING_PROXY: DWORD = 80; +pub const INTERNET_STATUS_REQUEST_COMPLETE: DWORD = 100; +pub const INTERNET_STATUS_REDIRECT: DWORD = 110; +pub const INTERNET_STATUS_INTERMEDIATE_RESPONSE: DWORD = 120; +pub const INTERNET_STATUS_USER_INPUT_REQUIRED: DWORD = 140; +pub const INTERNET_STATUS_STATE_CHANGE: DWORD = 200; +pub const INTERNET_STATUS_COOKIE_SENT: DWORD = 320; +pub const INTERNET_STATUS_COOKIE_RECEIVED: DWORD = 321; +pub const INTERNET_STATUS_PRIVACY_IMPACTED: DWORD = 324; +pub const INTERNET_STATUS_P3P_HEADER: DWORD = 325; +pub const INTERNET_STATUS_P3P_POLICYREF: DWORD = 326; +pub const INTERNET_STATUS_COOKIE_HISTORY: DWORD = 327; +pub const INTERNET_STATE_CONNECTED: DWORD = 0x00000001; +pub const INTERNET_STATE_DISCONNECTED: DWORD = 0x00000002; +pub const INTERNET_STATE_DISCONNECTED_BY_USER: DWORD = 0x00000010; +pub const INTERNET_STATE_IDLE: DWORD = 0x00000100; +pub const INTERNET_STATE_BUSY: DWORD = 0x00000200; +ENUM!{enum InternetCookieState { + COOKIE_STATE_UNKNOWN = 0x0, + COOKIE_STATE_ACCEPT = 0x1, + COOKIE_STATE_PROMPT = 0x2, + COOKIE_STATE_LEASH = 0x3, + COOKIE_STATE_DOWNGRADE = 0x4, + COOKIE_STATE_REJECT = 0x5, + COOKIE_STATE_MAX = COOKIE_STATE_REJECT, +}} +STRUCT!{struct IncomingCookieState { + cSession: c_int, + cPersistent: c_int, + cAccepted: c_int, + cLeashed: c_int, + cDowngraded: c_int, + cBlocked: c_int, + pszLocation: LPCSTR, +}} +STRUCT!{struct OutgoingCookieState { + cSent: c_int, + cSuppressed: c_int, + pszLocation: LPCSTR, +}} +STRUCT!{struct InternetCookieHistory { + fAccepted: BOOL, + fLeashed: BOOL, + fDowngraded: BOOL, + fRejected: BOOL, +}} +STRUCT!{struct CookieDecision { + dwCookieState: DWORD, + fAllowSession: BOOL, +}} +pub const INTERNET_INVALID_STATUS_CALLBACK: usize = -1isize as usize; +pub const FTP_TRANSFER_TYPE_UNKNOWN: DWORD = 0x00000000; +pub const FTP_TRANSFER_TYPE_ASCII: DWORD = 0x00000001; +pub const FTP_TRANSFER_TYPE_BINARY: DWORD = 0x00000002; +pub const FTP_TRANSFER_TYPE_MASK: DWORD = FTP_TRANSFER_TYPE_ASCII | FTP_TRANSFER_TYPE_BINARY; +pub const MAX_GOPHER_DISPLAY_TEXT: usize = 128; +pub const MAX_GOPHER_SELECTOR_TEXT: usize = 256; +pub const MAX_GOPHER_HOST_NAME: usize = INTERNET_MAX_HOST_NAME_LENGTH; +pub const MAX_GOPHER_LOCATOR_LENGTH: usize = 1 + MAX_GOPHER_DISPLAY_TEXT + 1 + + MAX_GOPHER_SELECTOR_TEXT + 1 + MAX_GOPHER_HOST_NAME + 1 + INTERNET_MAX_PORT_NUMBER_LENGTH + + 1 + 1 + 2; +STRUCT!{struct GOPHER_FIND_DATAA { + DisplayString: [CHAR; MAX_GOPHER_DISPLAY_TEXT+ 1], + GopherType: DWORD, + SizeLow: DWORD, + SizeHigh: DWORD, + LastModificationTime: FILETIME, + Locator: [CHAR; MAX_GOPHER_LOCATOR_LENGTH + 1], +}} +pub type LPGOPHER_FIND_DATAA = *mut GOPHER_FIND_DATAA; +STRUCT!{struct GOPHER_FIND_DATAW { + DisplayString: [WCHAR; MAX_GOPHER_DISPLAY_TEXT+ 1], + GopherType: DWORD, + SizeLow: DWORD, + SizeHigh: DWORD, + LastModificationTime: FILETIME, + Locator: [WCHAR; MAX_GOPHER_LOCATOR_LENGTH + 1], +}} +pub type LPGOPHER_FIND_DATAW = *mut GOPHER_FIND_DATAW; +pub const GOPHER_TYPE_TEXT_FILE: DWORD = 0x00000001; +pub const GOPHER_TYPE_DIRECTORY: DWORD = 0x00000002; +pub const GOPHER_TYPE_CSO: DWORD = 0x00000004; +pub const GOPHER_TYPE_ERROR: DWORD = 0x00000008; +pub const GOPHER_TYPE_MAC_BINHEX: DWORD = 0x00000010; +pub const GOPHER_TYPE_DOS_ARCHIVE: DWORD = 0x00000020; +pub const GOPHER_TYPE_UNIX_UUENCODED: DWORD = 0x00000040; +pub const GOPHER_TYPE_INDEX_SERVER: DWORD = 0x00000080; +pub const GOPHER_TYPE_TELNET: DWORD = 0x00000100; +pub const GOPHER_TYPE_BINARY: DWORD = 0x00000200; +pub const GOPHER_TYPE_REDUNDANT: DWORD = 0x00000400; +pub const GOPHER_TYPE_TN3270: DWORD = 0x00000800; +pub const GOPHER_TYPE_GIF: DWORD = 0x00001000; +pub const GOPHER_TYPE_IMAGE: DWORD = 0x00002000; +pub const GOPHER_TYPE_BITMAP: DWORD = 0x00004000; +pub const GOPHER_TYPE_MOVIE: DWORD = 0x00008000; +pub const GOPHER_TYPE_SOUND: DWORD = 0x00010000; +pub const GOPHER_TYPE_HTML: DWORD = 0x00020000; +pub const GOPHER_TYPE_PDF: DWORD = 0x00040000; +pub const GOPHER_TYPE_CALENDAR: DWORD = 0x00080000; +pub const GOPHER_TYPE_INLINE: DWORD = 0x00100000; +pub const GOPHER_TYPE_UNKNOWN: DWORD = 0x20000000; +pub const GOPHER_TYPE_ASK: DWORD = 0x40000000; +pub const GOPHER_TYPE_GOPHER_PLUS: DWORD = 0x80000000; +#[inline] +pub fn IS_GOPHER_FILE(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_FILE_MASK) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_DIRECTORY(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_DIRECTORY) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_PHONE_SERVER(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_CSO) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_ERROR(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_ERROR) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_INDEX_SERVER(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_INDEX_SERVER) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_TELNET_SESSION(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_TELNET) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_BACKUP_SERVER(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_REDUNDANT) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_TN3270_SESSION(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_TN3270) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_ASK(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_ASK) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_PLUS(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_GOPHER_PLUS) != 0 { TRUE } else { FALSE } +} +#[inline] +pub fn IS_GOPHER_TYPE_KNOWN(type_: DWORD) -> BOOL { + if (type_ & GOPHER_TYPE_UNKNOWN) != 0 { FALSE } else { TRUE } +} +pub const GOPHER_TYPE_FILE_MASK: DWORD = GOPHER_TYPE_TEXT_FILE | GOPHER_TYPE_MAC_BINHEX + | GOPHER_TYPE_DOS_ARCHIVE | GOPHER_TYPE_UNIX_UUENCODED | GOPHER_TYPE_BINARY | GOPHER_TYPE_GIF + | GOPHER_TYPE_IMAGE | GOPHER_TYPE_BITMAP | GOPHER_TYPE_MOVIE | GOPHER_TYPE_SOUND + | GOPHER_TYPE_HTML | GOPHER_TYPE_PDF | GOPHER_TYPE_CALENDAR | GOPHER_TYPE_INLINE; +STRUCT!{struct GOPHER_ADMIN_ATTRIBUTE_TYPE { + Comment: LPCWSTR, + EmailAddress: LPCWSTR, +}} +pub type LPGOPHER_ADMIN_ATTRIBUTE_TYPE = *mut GOPHER_ADMIN_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_MOD_DATE_ATTRIBUTE_TYPE { + DateAndTime: FILETIME, +}} +pub type LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE = *mut GOPHER_MOD_DATE_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_TTL_ATTRIBUTE_TYPE { + Ttl: DWORD, +}} +pub type LPGOPHER_TTL_ATTRIBUTE_TYPE = *mut GOPHER_TTL_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_SCORE_ATTRIBUTE_TYPE { + Score: INT, +}} +pub type LPGOPHER_SCORE_ATTRIBUTE_TYPE = *mut GOPHER_SCORE_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE { + LowerBound: INT, + UpperBound: INT, +}} +pub type LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE = *mut GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_SITE_ATTRIBUTE_TYPE { + Site: LPCWSTR, +}} +pub type LPGOPHER_SITE_ATTRIBUTE_TYPE = *mut GOPHER_SITE_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_ORGANIZATION_ATTRIBUTE_TYPE { + Organization: LPCWSTR, +}} +pub type LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE = *mut GOPHER_ORGANIZATION_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_LOCATION_ATTRIBUTE_TYPE { + Location: LPCWSTR, +}} +pub type LPGOPHER_LOCATION_ATTRIBUTE_TYPE = *mut GOPHER_LOCATION_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE { + DegreesNorth: INT, + MinutesNorth: INT, + SecondsNorth: INT, + DegreesEast: INT, + MinutesEast: INT, + SecondsEast: INT, +}} +pub type LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE = + *mut GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_TIMEZONE_ATTRIBUTE_TYPE { + Zone: INT, +}} +pub type LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE = *mut GOPHER_TIMEZONE_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_PROVIDER_ATTRIBUTE_TYPE { + Provider: LPCWSTR, +}} +pub type LPGOPHER_PROVIDER_ATTRIBUTE_TYPE = *mut GOPHER_PROVIDER_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_VERSION_ATTRIBUTE_TYPE { + Version: LPCWSTR, +}} +pub type LPGOPHER_VERSION_ATTRIBUTE_TYPE = *mut GOPHER_VERSION_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_ABSTRACT_ATTRIBUTE_TYPE { + ShortAbstract: LPCWSTR, + AbstractFile: LPCWSTR, +}} +pub type LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE = *mut GOPHER_ABSTRACT_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_VIEW_ATTRIBUTE_TYPE { + ContentType: LPCWSTR, + Language: LPCWSTR, + Size: DWORD, +}} +pub type LPGOPHER_VIEW_ATTRIBUTE_TYPE = *mut GOPHER_VIEW_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_VERONICA_ATTRIBUTE_TYPE { + TreeWalk: BOOL, +}} +pub type LPGOPHER_VERONICA_ATTRIBUTE_TYPE = *mut GOPHER_VERONICA_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_ASK_ATTRIBUTE_TYPE { + QuestionType: LPCWSTR, + QuestionText: LPCWSTR, +}} +pub type LPGOPHER_ASK_ATTRIBUTE_TYPE = *mut GOPHER_ASK_ATTRIBUTE_TYPE; +STRUCT!{struct GOPHER_UNKNOWN_ATTRIBUTE_TYPE { + Text: LPCWSTR, +}} +pub type LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE = *mut GOPHER_UNKNOWN_ATTRIBUTE_TYPE; +UNION!{union GOPHER_ATTRIBUTE_TYPE_AttributeType { + [u32; 6] [u64; 3], + Admin Admin_mut: GOPHER_ADMIN_ATTRIBUTE_TYPE, + ModDate ModDate_mut: GOPHER_MOD_DATE_ATTRIBUTE_TYPE, + Ttl Ttl_mut: GOPHER_TTL_ATTRIBUTE_TYPE, + Score Score_mut: GOPHER_SCORE_ATTRIBUTE_TYPE, + ScoreRange ScoreRange_mut: GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE, + Site Site_mut: GOPHER_SITE_ATTRIBUTE_TYPE, + Organization Organization_mut: GOPHER_ORGANIZATION_ATTRIBUTE_TYPE, + Location Location_mut: GOPHER_LOCATION_ATTRIBUTE_TYPE, + GeographicalLocation GeographicalLocation_mut: GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE, + TimeZone TimeZone_mut: GOPHER_TIMEZONE_ATTRIBUTE_TYPE, + Provider Provider_mut: GOPHER_PROVIDER_ATTRIBUTE_TYPE, + Version Version_mut: GOPHER_VERSION_ATTRIBUTE_TYPE, + Abstract Abstract_mut: GOPHER_ABSTRACT_ATTRIBUTE_TYPE, + View View_mut: GOPHER_VIEW_ATTRIBUTE_TYPE, + Veronica Veronica_mut: GOPHER_VERONICA_ATTRIBUTE_TYPE, + Ask Ask_mut: GOPHER_ASK_ATTRIBUTE_TYPE, + Unknown Unknown_mut: GOPHER_UNKNOWN_ATTRIBUTE_TYPE, +}} +STRUCT!{struct GOPHER_ATTRIBUTE_TYPE { + CategoryId: DWORD, + AttributeId: DWORD, + AttributeType: GOPHER_ATTRIBUTE_TYPE_AttributeType, +}} +pub type LPGOPHER_ATTRIBUTE_TYPE = *mut GOPHER_ATTRIBUTE_TYPE; +pub const MAX_GOPHER_CATEGORY_NAME: DWORD = 128; +pub const MAX_GOPHER_ATTRIBUTE_NAME: DWORD = 128; +pub const MIN_GOPHER_ATTRIBUTE_LENGTH: DWORD = 256; +pub const GOPHER_INFO_CATEGORY: &'static str = " + INFO"; +pub const GOPHER_ADMIN_CATEGORY: &'static str = " + ADMIN"; +pub const GOPHER_VIEWS_CATEGORY: &'static str = " + VIEWS"; +pub const GOPHER_ABSTRACT_CATEGORY: &'static str = " + ABSTRACT"; +pub const GOPHER_VERONICA_CATEGORY: &'static str = " + VERONICA"; +pub const GOPHER_ADMIN_ATTRIBUTE: &'static str = "Admin"; +pub const GOPHER_MOD_DATE_ATTRIBUTE: &'static str = "Mod-Date"; +pub const GOPHER_TTL_ATTRIBUTE: &'static str = "TTL"; +pub const GOPHER_SCORE_ATTRIBUTE: &'static str = "Score"; +pub const GOPHER_RANGE_ATTRIBUTE: &'static str = "Score-range"; +pub const GOPHER_SITE_ATTRIBUTE: &'static str = "Site"; +pub const GOPHER_ORG_ATTRIBUTE: &'static str = "Org"; +pub const GOPHER_LOCATION_ATTRIBUTE: &'static str = "Loc"; +pub const GOPHER_GEOG_ATTRIBUTE: &'static str = "Geog"; +pub const GOPHER_TIMEZONE_ATTRIBUTE: &'static str = "TZ"; +pub const GOPHER_PROVIDER_ATTRIBUTE: &'static str = "Provider"; +pub const GOPHER_VERSION_ATTRIBUTE: &'static str = "Version"; +pub const GOPHER_ABSTRACT_ATTRIBUTE: &'static str = "Abstract"; +pub const GOPHER_VIEW_ATTRIBUTE: &'static str = "View"; +pub const GOPHER_TREEWALK_ATTRIBUTE: &'static str = "treewalk"; +pub const GOPHER_ATTRIBUTE_ID_BASE: DWORD = 0xabcccc00; +pub const GOPHER_CATEGORY_ID_ALL: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 1; +pub const GOPHER_CATEGORY_ID_INFO: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 2; +pub const GOPHER_CATEGORY_ID_ADMIN: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 3; +pub const GOPHER_CATEGORY_ID_VIEWS: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 4; +pub const GOPHER_CATEGORY_ID_ABSTRACT: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 5; +pub const GOPHER_CATEGORY_ID_VERONICA: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 6; +pub const GOPHER_CATEGORY_ID_ASK: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 7; +pub const GOPHER_CATEGORY_ID_UNKNOWN: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 8; +pub const GOPHER_ATTRIBUTE_ID_ALL: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 9; +pub const GOPHER_ATTRIBUTE_ID_ADMIN: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 10; +pub const GOPHER_ATTRIBUTE_ID_MOD_DATE: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 11; +pub const GOPHER_ATTRIBUTE_ID_TTL: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 12; +pub const GOPHER_ATTRIBUTE_ID_SCORE: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 13; +pub const GOPHER_ATTRIBUTE_ID_RANGE: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 14; +pub const GOPHER_ATTRIBUTE_ID_SITE: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 15; +pub const GOPHER_ATTRIBUTE_ID_ORG: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 16; +pub const GOPHER_ATTRIBUTE_ID_LOCATION: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 17; +pub const GOPHER_ATTRIBUTE_ID_GEOG: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 18; +pub const GOPHER_ATTRIBUTE_ID_TIMEZONE: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 19; +pub const GOPHER_ATTRIBUTE_ID_PROVIDER: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 20; +pub const GOPHER_ATTRIBUTE_ID_VERSION: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 21; +pub const GOPHER_ATTRIBUTE_ID_ABSTRACT: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 22; +pub const GOPHER_ATTRIBUTE_ID_VIEW: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 23; +pub const GOPHER_ATTRIBUTE_ID_TREEWALK: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 24; +pub const GOPHER_ATTRIBUTE_ID_UNKNOWN: DWORD = GOPHER_ATTRIBUTE_ID_BASE + 25; +FN!{stdcall GOPHER_ATTRIBUTE_ENUMERATOR( + LPGOPHER_ATTRIBUTE_TYPE, + DWORD, +) -> BOOL} +pub const HTTP_MAJOR_VERSION: DWORD = 1; +pub const HTTP_MINOR_VERSION: DWORD = 0; +pub const HTTP_VERSION: &'static str = "HTTP/1.0"; +pub const HTTP_QUERY_MIME_VERSION: DWORD = 0; +pub const HTTP_QUERY_CONTENT_TYPE: DWORD = 1; +pub const HTTP_QUERY_CONTENT_TRANSFER_ENCODING: DWORD = 2; +pub const HTTP_QUERY_CONTENT_ID: DWORD = 3; +pub const HTTP_QUERY_CONTENT_DESCRIPTION: DWORD = 4; +pub const HTTP_QUERY_CONTENT_LENGTH: DWORD = 5; +pub const HTTP_QUERY_CONTENT_LANGUAGE: DWORD = 6; +pub const HTTP_QUERY_ALLOW: DWORD = 7; +pub const HTTP_QUERY_PUBLIC: DWORD = 8; +pub const HTTP_QUERY_DATE: DWORD = 9; +pub const HTTP_QUERY_EXPIRES: DWORD = 10; +pub const HTTP_QUERY_LAST_MODIFIED: DWORD = 11; +pub const HTTP_QUERY_MESSAGE_ID: DWORD = 12; +pub const HTTP_QUERY_URI: DWORD = 13; +pub const HTTP_QUERY_DERIVED_FROM: DWORD = 14; +pub const HTTP_QUERY_COST: DWORD = 15; +pub const HTTP_QUERY_LINK: DWORD = 16; +pub const HTTP_QUERY_PRAGMA: DWORD = 17; +pub const HTTP_QUERY_VERSION: DWORD = 18; +pub const HTTP_QUERY_STATUS_CODE: DWORD = 19; +pub const HTTP_QUERY_STATUS_TEXT: DWORD = 20; +pub const HTTP_QUERY_RAW_HEADERS: DWORD = 21; +pub const HTTP_QUERY_RAW_HEADERS_CRLF: DWORD = 22; +pub const HTTP_QUERY_CONNECTION: DWORD = 23; +pub const HTTP_QUERY_ACCEPT: DWORD = 24; +pub const HTTP_QUERY_ACCEPT_CHARSET: DWORD = 25; +pub const HTTP_QUERY_ACCEPT_ENCODING: DWORD = 26; +pub const HTTP_QUERY_ACCEPT_LANGUAGE: DWORD = 27; +pub const HTTP_QUERY_AUTHORIZATION: DWORD = 28; +pub const HTTP_QUERY_CONTENT_ENCODING: DWORD = 29; +pub const HTTP_QUERY_FORWARDED: DWORD = 30; +pub const HTTP_QUERY_FROM: DWORD = 31; +pub const HTTP_QUERY_IF_MODIFIED_SINCE: DWORD = 32; +pub const HTTP_QUERY_LOCATION: DWORD = 33; +pub const HTTP_QUERY_ORIG_URI: DWORD = 34; +pub const HTTP_QUERY_REFERER: DWORD = 35; +pub const HTTP_QUERY_RETRY_AFTER: DWORD = 36; +pub const HTTP_QUERY_SERVER: DWORD = 37; +pub const HTTP_QUERY_TITLE: DWORD = 38; +pub const HTTP_QUERY_USER_AGENT: DWORD = 39; +pub const HTTP_QUERY_WWW_AUTHENTICATE: DWORD = 40; +pub const HTTP_QUERY_PROXY_AUTHENTICATE: DWORD = 41; +pub const HTTP_QUERY_ACCEPT_RANGES: DWORD = 42; +pub const HTTP_QUERY_SET_COOKIE: DWORD = 43; +pub const HTTP_QUERY_COOKIE: DWORD = 44; +pub const HTTP_QUERY_REQUEST_METHOD: DWORD = 45; +pub const HTTP_QUERY_REFRESH: DWORD = 46; +pub const HTTP_QUERY_CONTENT_DISPOSITION: DWORD = 47; +pub const HTTP_QUERY_AGE: DWORD = 48; +pub const HTTP_QUERY_CACHE_CONTROL: DWORD = 49; +pub const HTTP_QUERY_CONTENT_BASE: DWORD = 50; +pub const HTTP_QUERY_CONTENT_LOCATION: DWORD = 51; +pub const HTTP_QUERY_CONTENT_MD5: DWORD = 52; +pub const HTTP_QUERY_CONTENT_RANGE: DWORD = 53; +pub const HTTP_QUERY_ETAG: DWORD = 54; +pub const HTTP_QUERY_HOST: DWORD = 55; +pub const HTTP_QUERY_IF_MATCH: DWORD = 56; +pub const HTTP_QUERY_IF_NONE_MATCH: DWORD = 57; +pub const HTTP_QUERY_IF_RANGE: DWORD = 58; +pub const HTTP_QUERY_IF_UNMODIFIED_SINCE: DWORD = 59; +pub const HTTP_QUERY_MAX_FORWARDS: DWORD = 60; +pub const HTTP_QUERY_PROXY_AUTHORIZATION: DWORD = 61; +pub const HTTP_QUERY_RANGE: DWORD = 62; +pub const HTTP_QUERY_TRANSFER_ENCODING: DWORD = 63; +pub const HTTP_QUERY_UPGRADE: DWORD = 64; +pub const HTTP_QUERY_VARY: DWORD = 65; +pub const HTTP_QUERY_VIA: DWORD = 66; +pub const HTTP_QUERY_WARNING: DWORD = 67; +pub const HTTP_QUERY_EXPECT: DWORD = 68; +pub const HTTP_QUERY_PROXY_CONNECTION: DWORD = 69; +pub const HTTP_QUERY_UNLESS_MODIFIED_SINCE: DWORD = 70; +pub const HTTP_QUERY_ECHO_REQUEST: DWORD = 71; +pub const HTTP_QUERY_ECHO_REPLY: DWORD = 72; +pub const HTTP_QUERY_ECHO_HEADERS: DWORD = 73; +pub const HTTP_QUERY_ECHO_HEADERS_CRLF: DWORD = 74; +pub const HTTP_QUERY_PROXY_SUPPORT: DWORD = 75; +pub const HTTP_QUERY_AUTHENTICATION_INFO: DWORD = 76; +pub const HTTP_QUERY_PASSPORT_URLS: DWORD = 77; +pub const HTTP_QUERY_PASSPORT_CONFIG: DWORD = 78; +pub const HTTP_QUERY_X_CONTENT_TYPE_OPTIONS: DWORD = 79; +pub const HTTP_QUERY_P3P: DWORD = 80; +pub const HTTP_QUERY_X_P2P_PEERDIST: DWORD = 81; +pub const HTTP_QUERY_TRANSLATE: DWORD = 82; +pub const HTTP_QUERY_X_UA_COMPATIBLE: DWORD = 83; +pub const HTTP_QUERY_DEFAULT_STYLE: DWORD = 84; +pub const HTTP_QUERY_X_FRAME_OPTIONS: DWORD = 85; +pub const HTTP_QUERY_X_XSS_PROTECTION: DWORD = 86; +pub const HTTP_QUERY_SET_COOKIE2: DWORD = 87; +pub const HTTP_QUERY_DO_NOT_TRACK: DWORD = 88; +pub const HTTP_QUERY_KEEP_ALIVE: DWORD = 89; +pub const HTTP_QUERY_MAX: DWORD = 89; +pub const HTTP_QUERY_CUSTOM: DWORD = 65535; +pub const HTTP_QUERY_FLAG_REQUEST_HEADERS: DWORD = 0x80000000; +pub const HTTP_QUERY_FLAG_SYSTEMTIME: DWORD = 0x40000000; +pub const HTTP_QUERY_FLAG_NUMBER: DWORD = 0x20000000; +pub const HTTP_QUERY_FLAG_COALESCE: DWORD = 0x10000000; +pub const HTTP_QUERY_FLAG_NUMBER64: DWORD = 0x08000000; +pub const HTTP_QUERY_MODIFIER_FLAGS_MASK: DWORD = HTTP_QUERY_FLAG_REQUEST_HEADERS + | HTTP_QUERY_FLAG_SYSTEMTIME | HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_FLAG_COALESCE + | HTTP_QUERY_FLAG_NUMBER64; +pub const HTTP_QUERY_HEADER_MASK: DWORD = !HTTP_QUERY_MODIFIER_FLAGS_MASK; +pub const HTTP_STATUS_CONTINUE: DWORD = 100; +pub const HTTP_STATUS_SWITCH_PROTOCOLS: DWORD = 101; +pub const HTTP_STATUS_OK: DWORD = 200; +pub const HTTP_STATUS_CREATED: DWORD = 201; +pub const HTTP_STATUS_ACCEPTED: DWORD = 202; +pub const HTTP_STATUS_PARTIAL: DWORD = 203; +pub const HTTP_STATUS_NO_CONTENT: DWORD = 204; +pub const HTTP_STATUS_RESET_CONTENT: DWORD = 205; +pub const HTTP_STATUS_PARTIAL_CONTENT: DWORD = 206; +pub const HTTP_STATUS_AMBIGUOUS: DWORD = 300; +pub const HTTP_STATUS_MOVED: DWORD = 301; +pub const HTTP_STATUS_REDIRECT: DWORD = 302; +pub const HTTP_STATUS_REDIRECT_METHOD: DWORD = 303; +pub const HTTP_STATUS_NOT_MODIFIED: DWORD = 304; +pub const HTTP_STATUS_USE_PROXY: DWORD = 305; +pub const HTTP_STATUS_REDIRECT_KEEP_VERB: DWORD = 307; +pub const HTTP_STATUS_BAD_REQUEST: DWORD = 400; +pub const HTTP_STATUS_DENIED: DWORD = 401; +pub const HTTP_STATUS_PAYMENT_REQ: DWORD = 402; +pub const HTTP_STATUS_FORBIDDEN: DWORD = 403; +pub const HTTP_STATUS_NOT_FOUND: DWORD = 404; +pub const HTTP_STATUS_BAD_METHOD: DWORD = 405; +pub const HTTP_STATUS_NONE_ACCEPTABLE: DWORD = 406; +pub const HTTP_STATUS_PROXY_AUTH_REQ: DWORD = 407; +pub const HTTP_STATUS_REQUEST_TIMEOUT: DWORD = 408; +pub const HTTP_STATUS_CONFLICT: DWORD = 409; +pub const HTTP_STATUS_GONE: DWORD = 410; +pub const HTTP_STATUS_LENGTH_REQUIRED: DWORD = 411; +pub const HTTP_STATUS_PRECOND_FAILED: DWORD = 412; +pub const HTTP_STATUS_REQUEST_TOO_LARGE: DWORD = 413; +pub const HTTP_STATUS_URI_TOO_LONG: DWORD = 414; +pub const HTTP_STATUS_UNSUPPORTED_MEDIA: DWORD = 415; +pub const HTTP_STATUS_RETRY_WITH: DWORD = 449; +pub const HTTP_STATUS_SERVER_ERROR: DWORD = 500; +pub const HTTP_STATUS_NOT_SUPPORTED: DWORD = 501; +pub const HTTP_STATUS_BAD_GATEWAY: DWORD = 502; +pub const HTTP_STATUS_SERVICE_UNAVAIL: DWORD = 503; +pub const HTTP_STATUS_GATEWAY_TIMEOUT: DWORD = 504; +pub const HTTP_STATUS_VERSION_NOT_SUP: DWORD = 505; +pub const HTTP_STATUS_FIRST: DWORD = HTTP_STATUS_CONTINUE; +pub const HTTP_STATUS_LAST: DWORD = HTTP_STATUS_VERSION_NOT_SUP; +pub const HTTP_ADDREQ_INDEX_MASK: DWORD = 0x0000FFFF; +pub const HTTP_ADDREQ_FLAGS_MASK: DWORD = 0xFFFF0000; +pub const HTTP_ADDREQ_FLAG_ADD_IF_NEW: DWORD = 0x10000000; +pub const HTTP_ADDREQ_FLAG_ADD: DWORD = 0x20000000; +pub const HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA: DWORD = 0x40000000; +pub const HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON: DWORD = 0x01000000; +pub const HTTP_ADDREQ_FLAG_COALESCE: DWORD = HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA; +pub const HTTP_ADDREQ_FLAG_REPLACE: DWORD = 0x80000000; +pub const HSR_ASYNC: DWORD = WININET_API_FLAG_ASYNC; +pub const HSR_SYNC: DWORD = WININET_API_FLAG_SYNC; +pub const HSR_USE_CONTEXT: DWORD = WININET_API_FLAG_USE_CONTEXT; +pub const HSR_INITIATE: DWORD = 0x00000008; +pub const HSR_DOWNLOAD: DWORD = 0x00000010; +pub const HSR_CHUNKED: DWORD = 0x00000020; +STRUCT!{struct INTERNET_COOKIE2 { + pwszName: PWSTR, + pwszValue: PWSTR, + pwszDomain: PWSTR, + pwszPath: PWSTR, + dwFlags: DWORD, + ftExpires: FILETIME, + fExpiresSet: BOOL, +}} +pub const INTERNET_COOKIE_IS_SECURE: DWORD = 0x01; +pub const INTERNET_COOKIE_IS_SESSION: DWORD = 0x02; +pub const INTERNET_COOKIE_THIRD_PARTY: DWORD = 0x10; +pub const INTERNET_COOKIE_PROMPT_REQUIRED: DWORD = 0x20; +pub const INTERNET_COOKIE_EVALUATE_P3P: DWORD = 0x40; +pub const INTERNET_COOKIE_APPLY_P3P: DWORD = 0x80; +pub const INTERNET_COOKIE_P3P_ENABLED: DWORD = 0x100; +pub const INTERNET_COOKIE_IS_RESTRICTED: DWORD = 0x200; +pub const INTERNET_COOKIE_IE6: DWORD = 0x400; +pub const INTERNET_COOKIE_IS_LEGACY: DWORD = 0x800; +pub const INTERNET_COOKIE_NON_SCRIPT: DWORD = 0x00001000; +pub const INTERNET_COOKIE_HTTPONLY: DWORD = 0x00002000; +pub const FLAG_ICC_FORCE_CONNECTION: DWORD = 0x00000001; +pub const FLAGS_ERROR_UI_FILTER_FOR_ERRORS: DWORD = 0x01; +pub const FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS: DWORD = 0x02; +pub const FLAGS_ERROR_UI_FLAGS_GENERATE_DATA: DWORD = 0x04; +pub const FLAGS_ERROR_UI_FLAGS_NO_UI: DWORD = 0x08; +pub const FLAGS_ERROR_UI_SERIALIZE_DIALOGS: DWORD = 0x10; +FN!{stdcall PFN_AUTH_NOTIFY( + DWORD_PTR, + DWORD, + LPVOID, +) -> DWORD} +STRUCT!{struct INTERNET_AUTH_NOTIFY_DATA { + cbStruct: DWORD, + dwOptions: DWORD, + pfnNotify: PFN_AUTH_NOTIFY, + dwContext: DWORD_PTR, +}} +pub const INTERNET_ERROR_BASE: DWORD = 12000; +pub const ERROR_INTERNET_OUT_OF_HANDLES: DWORD = INTERNET_ERROR_BASE + 1; +pub const ERROR_INTERNET_TIMEOUT: DWORD = INTERNET_ERROR_BASE + 2; +pub const ERROR_INTERNET_EXTENDED_ERROR: DWORD = INTERNET_ERROR_BASE + 3; +pub const ERROR_INTERNET_INTERNAL_ERROR: DWORD = INTERNET_ERROR_BASE + 4; +pub const ERROR_INTERNET_INVALID_URL: DWORD = INTERNET_ERROR_BASE + 5; +pub const ERROR_INTERNET_UNRECOGNIZED_SCHEME: DWORD = INTERNET_ERROR_BASE + 6; +pub const ERROR_INTERNET_NAME_NOT_RESOLVED: DWORD = INTERNET_ERROR_BASE + 7; +pub const ERROR_INTERNET_PROTOCOL_NOT_FOUND: DWORD = INTERNET_ERROR_BASE + 8; +pub const ERROR_INTERNET_INVALID_OPTION: DWORD = INTERNET_ERROR_BASE + 9; +pub const ERROR_INTERNET_BAD_OPTION_LENGTH: DWORD = INTERNET_ERROR_BASE + 10; +pub const ERROR_INTERNET_OPTION_NOT_SETTABLE: DWORD = INTERNET_ERROR_BASE + 11; +pub const ERROR_INTERNET_SHUTDOWN: DWORD = INTERNET_ERROR_BASE + 12; +pub const ERROR_INTERNET_INCORRECT_USER_NAME: DWORD = INTERNET_ERROR_BASE + 13; +pub const ERROR_INTERNET_INCORRECT_PASSWORD: DWORD = INTERNET_ERROR_BASE + 14; +pub const ERROR_INTERNET_LOGIN_FAILURE: DWORD = INTERNET_ERROR_BASE + 15; +pub const ERROR_INTERNET_INVALID_OPERATION: DWORD = INTERNET_ERROR_BASE + 16; +pub const ERROR_INTERNET_OPERATION_CANCELLED: DWORD = INTERNET_ERROR_BASE + 17; +pub const ERROR_INTERNET_INCORRECT_HANDLE_TYPE: DWORD = INTERNET_ERROR_BASE + 18; +pub const ERROR_INTERNET_INCORRECT_HANDLE_STATE: DWORD = INTERNET_ERROR_BASE + 19; +pub const ERROR_INTERNET_NOT_PROXY_REQUEST: DWORD = INTERNET_ERROR_BASE + 20; +pub const ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND: DWORD = INTERNET_ERROR_BASE + 21; +pub const ERROR_INTERNET_BAD_REGISTRY_PARAMETER: DWORD = INTERNET_ERROR_BASE + 22; +pub const ERROR_INTERNET_NO_DIRECT_ACCESS: DWORD = INTERNET_ERROR_BASE + 23; +pub const ERROR_INTERNET_NO_CONTEXT: DWORD = INTERNET_ERROR_BASE + 24; +pub const ERROR_INTERNET_NO_CALLBACK: DWORD = INTERNET_ERROR_BASE + 25; +pub const ERROR_INTERNET_REQUEST_PENDING: DWORD = INTERNET_ERROR_BASE + 26; +pub const ERROR_INTERNET_INCORRECT_FORMAT: DWORD = INTERNET_ERROR_BASE + 27; +pub const ERROR_INTERNET_ITEM_NOT_FOUND: DWORD = INTERNET_ERROR_BASE + 28; +pub const ERROR_INTERNET_CANNOT_CONNECT: DWORD = INTERNET_ERROR_BASE + 29; +pub const ERROR_INTERNET_CONNECTION_ABORTED: DWORD = INTERNET_ERROR_BASE + 30; +pub const ERROR_INTERNET_CONNECTION_RESET: DWORD = INTERNET_ERROR_BASE + 31; +pub const ERROR_INTERNET_FORCE_RETRY: DWORD = INTERNET_ERROR_BASE + 32; +pub const ERROR_INTERNET_INVALID_PROXY_REQUEST: DWORD = INTERNET_ERROR_BASE + 33; +pub const ERROR_INTERNET_NEED_UI: DWORD = INTERNET_ERROR_BASE + 34; +pub const ERROR_INTERNET_HANDLE_EXISTS: DWORD = INTERNET_ERROR_BASE + 36; +pub const ERROR_INTERNET_SEC_CERT_DATE_INVALID: DWORD = INTERNET_ERROR_BASE + 37; +pub const ERROR_INTERNET_SEC_CERT_CN_INVALID: DWORD = INTERNET_ERROR_BASE + 38; +pub const ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: DWORD = INTERNET_ERROR_BASE + 39; +pub const ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR: DWORD = INTERNET_ERROR_BASE + 40; +pub const ERROR_INTERNET_MIXED_SECURITY: DWORD = INTERNET_ERROR_BASE + 41; +pub const ERROR_INTERNET_CHG_POST_IS_NON_SECURE: DWORD = INTERNET_ERROR_BASE + 42; +pub const ERROR_INTERNET_POST_IS_NON_SECURE: DWORD = INTERNET_ERROR_BASE + 43; +pub const ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED: DWORD = INTERNET_ERROR_BASE + 44; +pub const ERROR_INTERNET_INVALID_CA: DWORD = INTERNET_ERROR_BASE + 45; +pub const ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP: DWORD = INTERNET_ERROR_BASE + 46; +pub const ERROR_INTERNET_ASYNC_THREAD_FAILED: DWORD = INTERNET_ERROR_BASE + 47; +pub const ERROR_INTERNET_REDIRECT_SCHEME_CHANGE: DWORD = INTERNET_ERROR_BASE + 48; +pub const ERROR_INTERNET_DIALOG_PENDING: DWORD = INTERNET_ERROR_BASE + 49; +pub const ERROR_INTERNET_RETRY_DIALOG: DWORD = INTERNET_ERROR_BASE + 50; +pub const ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR: DWORD = INTERNET_ERROR_BASE + 52; +pub const ERROR_INTERNET_INSERT_CDROM: DWORD = INTERNET_ERROR_BASE + 53; +pub const ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED: DWORD = INTERNET_ERROR_BASE + 54; +pub const ERROR_INTERNET_SEC_CERT_ERRORS: DWORD = INTERNET_ERROR_BASE + 55; +pub const ERROR_INTERNET_SEC_CERT_NO_REV: DWORD = INTERNET_ERROR_BASE + 56; +pub const ERROR_INTERNET_SEC_CERT_REV_FAILED: DWORD = INTERNET_ERROR_BASE + 57; +pub const ERROR_FTP_TRANSFER_IN_PROGRESS: DWORD = INTERNET_ERROR_BASE + 110; +pub const ERROR_FTP_DROPPED: DWORD = INTERNET_ERROR_BASE + 111; +pub const ERROR_FTP_NO_PASSIVE_MODE: DWORD = INTERNET_ERROR_BASE + 112; +pub const ERROR_GOPHER_PROTOCOL_ERROR: DWORD = INTERNET_ERROR_BASE + 130; +pub const ERROR_GOPHER_NOT_FILE: DWORD = INTERNET_ERROR_BASE + 131; +pub const ERROR_GOPHER_DATA_ERROR: DWORD = INTERNET_ERROR_BASE + 132; +pub const ERROR_GOPHER_END_OF_DATA: DWORD = INTERNET_ERROR_BASE + 133; +pub const ERROR_GOPHER_INVALID_LOCATOR: DWORD = INTERNET_ERROR_BASE + 134; +pub const ERROR_GOPHER_INCORRECT_LOCATOR_TYPE: DWORD = INTERNET_ERROR_BASE + 135; +pub const ERROR_GOPHER_NOT_GOPHER_PLUS: DWORD = INTERNET_ERROR_BASE + 136; +pub const ERROR_GOPHER_ATTRIBUTE_NOT_FOUND: DWORD = INTERNET_ERROR_BASE + 137; +pub const ERROR_GOPHER_UNKNOWN_LOCATOR: DWORD = INTERNET_ERROR_BASE + 138; +pub const ERROR_HTTP_HEADER_NOT_FOUND: DWORD = INTERNET_ERROR_BASE + 150; +pub const ERROR_HTTP_DOWNLEVEL_SERVER: DWORD = INTERNET_ERROR_BASE + 151; +pub const ERROR_HTTP_INVALID_SERVER_RESPONSE: DWORD = INTERNET_ERROR_BASE + 152; +pub const ERROR_HTTP_INVALID_HEADER: DWORD = INTERNET_ERROR_BASE + 153; +pub const ERROR_HTTP_INVALID_QUERY_REQUEST: DWORD = INTERNET_ERROR_BASE + 154; +pub const ERROR_HTTP_HEADER_ALREADY_EXISTS: DWORD = INTERNET_ERROR_BASE + 155; +pub const ERROR_HTTP_REDIRECT_FAILED: DWORD = INTERNET_ERROR_BASE + 156; +pub const ERROR_HTTP_NOT_REDIRECTED: DWORD = INTERNET_ERROR_BASE + 160; +pub const ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION: DWORD = INTERNET_ERROR_BASE + 161; +pub const ERROR_HTTP_COOKIE_DECLINED: DWORD = INTERNET_ERROR_BASE + 162; +pub const ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION: DWORD = INTERNET_ERROR_BASE + 168; +pub const ERROR_INTERNET_SECURITY_CHANNEL_ERROR: DWORD = INTERNET_ERROR_BASE + 157; +pub const ERROR_INTERNET_UNABLE_TO_CACHE_FILE: DWORD = INTERNET_ERROR_BASE + 158; +pub const ERROR_INTERNET_TCPIP_NOT_INSTALLED: DWORD = INTERNET_ERROR_BASE + 159; +pub const ERROR_INTERNET_DISCONNECTED: DWORD = INTERNET_ERROR_BASE + 163; +pub const ERROR_INTERNET_SERVER_UNREACHABLE: DWORD = INTERNET_ERROR_BASE + 164; +pub const ERROR_INTERNET_PROXY_SERVER_UNREACHABLE: DWORD = INTERNET_ERROR_BASE + 165; +pub const ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT: DWORD = INTERNET_ERROR_BASE + 166; +pub const ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT: DWORD = INTERNET_ERROR_BASE + 167; +pub const ERROR_INTERNET_SEC_INVALID_CERT: DWORD = INTERNET_ERROR_BASE + 169; +pub const ERROR_INTERNET_SEC_CERT_REVOKED: DWORD = INTERNET_ERROR_BASE + 170; +pub const ERROR_INTERNET_FAILED_DUETOSECURITYCHECK: DWORD = INTERNET_ERROR_BASE + 171; +pub const ERROR_INTERNET_NOT_INITIALIZED: DWORD = INTERNET_ERROR_BASE + 172; +pub const ERROR_INTERNET_NEED_MSN_SSPI_PKG: DWORD = INTERNET_ERROR_BASE + 173; +pub const ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY: DWORD = INTERNET_ERROR_BASE + 174; +pub const ERROR_INTERNET_DECODING_FAILED: DWORD = INTERNET_ERROR_BASE + 175; +pub const INTERNET_ERROR_LAST: DWORD = ERROR_INTERNET_DECODING_FAILED; +pub const NORMAL_CACHE_ENTRY: DWORD = 0x00000001; +pub const STICKY_CACHE_ENTRY: DWORD = 0x00000004; +pub const EDITED_CACHE_ENTRY: DWORD = 0x00000008; +pub const TRACK_OFFLINE_CACHE_ENTRY: DWORD = 0x00000010; +pub const TRACK_ONLINE_CACHE_ENTRY: DWORD = 0x00000020; +pub const SPARSE_CACHE_ENTRY: DWORD = 0x00010000; +pub const COOKIE_CACHE_ENTRY: DWORD = 0x00100000; +pub const URLHISTORY_CACHE_ENTRY: DWORD = 0x00200000; +pub const URLCACHE_FIND_DEFAULT_FILTER: DWORD = NORMAL_CACHE_ENTRY | COOKIE_CACHE_ENTRY + | URLHISTORY_CACHE_ENTRY | TRACK_OFFLINE_CACHE_ENTRY | TRACK_ONLINE_CACHE_ENTRY + | STICKY_CACHE_ENTRY; +UNION!{union INTERNET_CACHE_ENTRY_INFOA_u { + [u32; 1], + dwReserved dwReserved_mut: DWORD, + dwExemptDelta dwExemptDelta_mut: DWORD, +}} +STRUCT!{struct INTERNET_CACHE_ENTRY_INFOA { + dwStructSize: DWORD, + lpszSourceUrlName: LPSTR, + lpszLocalFileName: LPSTR, + CacheEntryType: DWORD, + dwUseCount: DWORD, + dwHitRate: DWORD, + dwSizeLow: DWORD, + dwSizeHigh: DWORD, + LastModifiedTime: FILETIME, + ExpireTime: FILETIME, + LastAccessTime: FILETIME, + LastSyncTime: FILETIME, + lpHeaderInfo: LPSTR, + dwHeaderInfoSize: DWORD, + lpszFileExtension: LPSTR, + u: INTERNET_CACHE_ENTRY_INFOA_u, +}} +pub type LPINTERNET_CACHE_ENTRY_INFOA = *mut INTERNET_CACHE_ENTRY_INFOA; +UNION!{union INTERNET_CACHE_ENTRY_INFOW_u { + [u32; 1], + dwReserved dwReserved_mut: DWORD, + dwExemptDelta dwExemptDelta_mut: DWORD, +}} +STRUCT!{struct INTERNET_CACHE_ENTRY_INFOW { + dwStructSize: DWORD, + lpszSourceUrlName: LPWSTR, + lpszLocalFileName: LPWSTR, + CacheEntryType: DWORD, + dwUseCount: DWORD, + dwHitRate: DWORD, + dwSizeLow: DWORD, + dwSizeHigh: DWORD, + LastModifiedTime: FILETIME, + ExpireTime: FILETIME, + LastAccessTime: FILETIME, + LastSyncTime: FILETIME, + lpHeaderInfo: LPWSTR, + dwHeaderInfoSize: DWORD, + lpszFileExtension: LPWSTR, + u: INTERNET_CACHE_ENTRY_INFOW_u, +}} +pub type LPINTERNET_CACHE_ENTRY_INFOW = *mut INTERNET_CACHE_ENTRY_INFOW; +STRUCT!{struct INTERNET_CACHE_TIMESTAMPS { + ftExpires: FILETIME, + ftLastModified: FILETIME, +}} +pub type LPINTERNET_CACHE_TIMESTAMPS = *mut INTERNET_CACHE_TIMESTAMPS; +pub type GROUPID = LONGLONG; +pub const CACHEGROUP_ATTRIBUTE_GET_ALL: DWORD = 0xffffffff; +pub const CACHEGROUP_ATTRIBUTE_BASIC: DWORD = 0x00000001; +pub const CACHEGROUP_ATTRIBUTE_FLAG: DWORD = 0x00000002; +pub const CACHEGROUP_ATTRIBUTE_TYPE: DWORD = 0x00000004; +pub const CACHEGROUP_ATTRIBUTE_QUOTA: DWORD = 0x00000008; +pub const CACHEGROUP_ATTRIBUTE_GROUPNAME: DWORD = 0x00000010; +pub const CACHEGROUP_ATTRIBUTE_STORAGE: DWORD = 0x00000020; +pub const CACHEGROUP_FLAG_NONPURGEABLE: DWORD = 0x00000001; +pub const CACHEGROUP_FLAG_GIDONLY: DWORD = 0x00000004; +pub const CACHEGROUP_FLAG_FLUSHURL_ONDELETE: DWORD = 0x00000002; +pub const CACHEGROUP_SEARCH_ALL: DWORD = 0x00000000; +pub const CACHEGROUP_SEARCH_BYURL: DWORD = 0x00000001; +pub const CACHEGROUP_TYPE_INVALID: DWORD = 0x00000001; +pub const CACHEGROUP_READWRITE_MASK: DWORD = CACHEGROUP_ATTRIBUTE_TYPE + | CACHEGROUP_ATTRIBUTE_QUOTA | CACHEGROUP_ATTRIBUTE_GROUPNAME | CACHEGROUP_ATTRIBUTE_STORAGE; +pub const GROUPNAME_MAX_LENGTH: usize = 120; +pub const GROUP_OWNER_STORAGE_SIZE: usize = 4; +STRUCT!{struct INTERNET_CACHE_GROUP_INFOA { + dwGroupSize: DWORD, + dwGroupFlags: DWORD, + dwGroupType: DWORD, + dwDiskUsage: DWORD, + dwDiskQuota: DWORD, + dwOwnerStorage: [DWORD; GROUP_OWNER_STORAGE_SIZE], + szGroupName: [CHAR; GROUPNAME_MAX_LENGTH], +}} +pub type LPINTERNET_CACHE_GROUP_INFOA = *mut INTERNET_CACHE_GROUP_INFOA; +STRUCT!{struct INTERNET_CACHE_GROUP_INFOW { + dwGroupSize: DWORD, + dwGroupFlags: DWORD, + dwGroupType: DWORD, + dwDiskUsage: DWORD, + dwDiskQuota: DWORD, + dwOwnerStorage: [DWORD; GROUP_OWNER_STORAGE_SIZE], + szGroupName: [WCHAR; GROUPNAME_MAX_LENGTH], +}} +pub type LPINTERNET_CACHE_GROUP_INFOW = *mut INTERNET_CACHE_GROUP_INFOW; +pub const CACHE_ENTRY_ATTRIBUTE_FC: DWORD = 0x00000004; +pub const CACHE_ENTRY_HITRATE_FC: DWORD = 0x00000010; +pub const CACHE_ENTRY_MODTIME_FC: DWORD = 0x00000040; +pub const CACHE_ENTRY_EXPTIME_FC: DWORD = 0x00000080; +pub const CACHE_ENTRY_ACCTIME_FC: DWORD = 0x00000100; +pub const CACHE_ENTRY_SYNCTIME_FC: DWORD = 0x00000200; +pub const CACHE_ENTRY_HEADERINFO_FC: DWORD = 0x00000400; +pub const CACHE_ENTRY_EXEMPT_DELTA_FC: DWORD = 0x00000800; +pub const INTERNET_CACHE_GROUP_ADD: DWORD = 0; +pub const INTERNET_CACHE_GROUP_REMOVE: DWORD = 1; +pub const INTERNET_DIAL_FORCE_PROMPT: DWORD = 0x2000; +pub const INTERNET_DIAL_SHOW_OFFLINE: DWORD = 0x4000; +pub const INTERNET_DIAL_UNATTENDED: DWORD = 0x8000; +pub const INTERENT_GOONLINE_REFRESH: DWORD = 0x00000001; +pub const INTERENT_GOONLINE_NOPROMPT: DWORD = 0x00000002; +pub const INTERENT_GOONLINE_MASK: DWORD = 0x00000003; +pub const INTERNET_AUTODIAL_FORCE_ONLINE: DWORD = 1; +pub const INTERNET_AUTODIAL_FORCE_UNATTENDED: DWORD = 2; +pub const INTERNET_AUTODIAL_FAILIFSECURITYCHECK: DWORD = 4; +pub const INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT: DWORD = 8; +pub const INTERNET_AUTODIAL_FLAGS_MASK: DWORD = INTERNET_AUTODIAL_FORCE_ONLINE + | INTERNET_AUTODIAL_FORCE_UNATTENDED | INTERNET_AUTODIAL_FAILIFSECURITYCHECK + | INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT; +pub const PROXY_AUTO_DETECT_TYPE_DHCP: DWORD = 1; +pub const PROXY_AUTO_DETECT_TYPE_DNS_A: DWORD = 2; +STRUCT!{struct AutoProxyHelperVtbl { + IsResolvable: Option BOOL>, + GetIPAddress: Option DWORD>, + ResolveHostName: Option DWORD>, + IsInNet: Option BOOL>, + IsResolvableEx: Option BOOL>, + GetIPAddressEx: Option DWORD>, + ResolveHostNameEx: Option DWORD>, + IsInNetEx: Option BOOL>, + SortIpList: Option DWORD>, +}} +STRUCT!{struct AUTO_PROXY_SCRIPT_BUFFER { + dwStructSize: DWORD, + lpszScriptBuffer: LPSTR, + dwScriptBufferSize: DWORD, +}} +pub type LPAUTO_PROXY_SCRIPT_BUFFER = *mut AUTO_PROXY_SCRIPT_BUFFER; +STRUCT!{struct AutoProxyHelperFunctions { + lpVtbl: *const AutoProxyHelperVtbl, +}} +FN!{stdcall pfnInternetInitializeAutoProxyDll( + DWORD, + LPSTR, + LPSTR, + *mut AutoProxyHelperFunctions, + LPAUTO_PROXY_SCRIPT_BUFFER, +) -> BOOL} +FN!{stdcall pfnInternetDeInitializeAutoProxyDll( + LPSTR, + DWORD, +) -> BOOL} +FN!{stdcall pfnInternetGetProxyInfo( + LPCSTR, + DWORD, + LPSTR, + DWORD, + *mut LPSTR, + LPDWORD, +) -> BOOL} +ENUM!{enum WPAD_CACHE_DELETE { + WPAD_CACHE_DELETE_CURRENT = 0x0, + WPAD_CACHE_DELETE_ALL = 0x1, +}} +pub const INTERNET_CONNECTION_MODEM: DWORD = 0x01; +pub const INTERNET_CONNECTION_LAN: DWORD = 0x02; +pub const INTERNET_CONNECTION_PROXY: DWORD = 0x04; +pub const INTERNET_CONNECTION_MODEM_BUSY: DWORD = 0x08; +pub const INTERNET_RAS_INSTALLED: DWORD = 0x10; +pub const INTERNET_CONNECTION_OFFLINE: DWORD = 0x20; +pub const INTERNET_CONNECTION_CONFIGURED: DWORD = 0x40; +FN!{stdcall PFN_DIAL_HANDLER( + HWND, + LPCSTR, + DWORD, + LPDWORD, +) -> DWORD} +pub const INTERNET_CUSTOMDIAL_CONNECT: DWORD = 0; +pub const INTERNET_CUSTOMDIAL_UNATTENDED: DWORD = 1; +pub const INTERNET_CUSTOMDIAL_DISCONNECT: DWORD = 2; +pub const INTERNET_CUSTOMDIAL_SHOWOFFLINE: DWORD = 4; +pub const INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED: DWORD = 1; +pub const INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE: DWORD = 2; +pub const INTERNET_CUSTOMDIAL_CAN_HANGUP: DWORD = 4; +pub const INTERNET_DIALSTATE_DISCONNECTED: DWORD = 1; +pub const INTERNET_IDENTITY_FLAG_PRIVATE_CACHE: DWORD = 0x01; +pub const INTERNET_IDENTITY_FLAG_SHARED_CACHE: DWORD = 0x02; +pub const INTERNET_IDENTITY_FLAG_CLEAR_DATA: DWORD = 0x04; +pub const INTERNET_IDENTITY_FLAG_CLEAR_COOKIES: DWORD = 0x08; +pub const INTERNET_IDENTITY_FLAG_CLEAR_HISTORY: DWORD = 0x10; +pub const INTERNET_IDENTITY_FLAG_CLEAR_CONTENT: DWORD = 0x20; +pub const INTERNET_SUPPRESS_RESET_ALL: DWORD = 0x00; +pub const INTERNET_SUPPRESS_COOKIE_POLICY: DWORD = 0x01; +pub const INTERNET_SUPPRESS_COOKIE_POLICY_RESET: DWORD = 0x02; +pub const PRIVACY_TEMPLATE_NO_COOKIES: DWORD = 0; +pub const PRIVACY_TEMPLATE_HIGH: DWORD = 1; +pub const PRIVACY_TEMPLATE_MEDIUM_HIGH: DWORD = 2; +pub const PRIVACY_TEMPLATE_MEDIUM: DWORD = 3; +pub const PRIVACY_TEMPLATE_MEDIUM_LOW: DWORD = 4; +pub const PRIVACY_TEMPLATE_LOW: DWORD = 5; +pub const PRIVACY_TEMPLATE_CUSTOM: DWORD = 100; +pub const PRIVACY_TEMPLATE_ADVANCED: DWORD = 101; +pub const PRIVACY_TEMPLATE_MAX: DWORD = PRIVACY_TEMPLATE_LOW; +pub const PRIVACY_TYPE_FIRST_PARTY: DWORD = 0; +pub const PRIVACY_TYPE_THIRD_PARTY: DWORD = 1; +extern "system" { + pub fn CommitUrlCacheEntryA( + lpszUrlName: LPCSTR, + lpszLocalFileName: LPCSTR, + ExpireTime: FILETIME, + LastModifiedTime: FILETIME, + CacheEntryType: DWORD, + lpHeaderInfo: LPBYTE, + cchHeaderInfo: DWORD, + lpszFileExtension: LPCSTR, + lpszOriginalUrl: LPCSTR, + ) -> BOOL; + pub fn CommitUrlCacheEntryW( + lpszUrlName: LPCWSTR, + lpszLocalFileName: LPCWSTR, + ExpireTime: FILETIME, + LastModifiedTime: FILETIME, + CacheEntryType: DWORD, + lpszHeaderInfo: LPWSTR, + cchHeaderInfo: DWORD, + lpszFileExtension: LPCWSTR, + lpszOriginalUrl: LPCWSTR, + ) -> BOOL; + pub fn CreateMD5SSOHash ( + pszChallengeInfo: PWSTR, + pwszRealm: PWSTR, + pwszTarget: PWSTR, + pbHexHash: PBYTE, + ) -> BOOL; + pub fn CreateUrlCacheEntryA( + lpszUrlName: LPCSTR, + dwExpectedFileSize: DWORD, + lpszFileExtension: LPCSTR, + lpszFileName: LPSTR, + dwReserved: DWORD, + ) -> BOOL; + pub fn CreateUrlCacheEntryW( + lpszUrlName: LPCWSTR, + dwExpectedFileSize: DWORD, + lpszFileExtension: LPCWSTR, + lpszFileName: LPWSTR, + dwReserved: DWORD, + ) -> BOOL; + pub fn CreateUrlCacheGroup( + dwFlags: DWORD, + lpReserved: LPVOID, + ) -> GROUPID; + pub fn DeleteUrlCacheEntryA( + lpszUrlName: LPCSTR, + ) -> BOOL; + pub fn DeleteUrlCacheEntryW( + lpszUrlName: LPCWSTR, + ) -> BOOL; + pub fn DeleteUrlCacheGroup( + GroupId: GROUPID, + dwFlags: DWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn DeleteWpadCacheForNetworks( + arg0: WPAD_CACHE_DELETE, + ) -> BOOL; + pub fn DetectAutoProxyUrl( + pszAutoProxyUrl: PSTR, + cchAutoProxyUrl: DWORD, + dwDetectFlags: DWORD, + ) -> BOOL; + pub fn FindCloseUrlCache( + hEnumHandle: HANDLE, + ) -> BOOL; + pub fn FindFirstUrlCacheEntryA( + lpszUrlSearchPattern: LPCSTR, + lpFirstCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + ) -> HANDLE; + pub fn FindFirstUrlCacheEntryExA( + lpszUrlSearchPattern: LPCSTR, + dwFlags: DWORD, + dwFilter: DWORD, + GroupId: GROUPID, + lpFirstCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + lpGroupAttributes: LPVOID, + lpcbGroupAttributes: LPDWORD, + lpReserved: LPVOID, + ) -> HANDLE; + pub fn FindFirstUrlCacheEntryExW( + lpszUrlSearchPattern: LPCWSTR, + dwFlags: DWORD, + dwFilter: DWORD, + GroupId: GROUPID, + lpFirstCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + lpGroupAttributes: LPVOID, + lpcbGroupAttributes: LPDWORD, + lpReserved: LPVOID, + ) -> HANDLE; + pub fn FindFirstUrlCacheEntryW( + lpszUrlSearchPattern: LPCWSTR, + lpFirstCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + ) -> HANDLE; + pub fn FindFirstUrlCacheGroup( + dwFlags: DWORD, + dwFilter: DWORD, + lpSearchCondition: LPVOID, + dwSearchCondition: DWORD, + lpGroupId: *mut GROUPID, + lpReserved: LPVOID, + ) -> HANDLE; + pub fn FindNextUrlCacheEntryA( + hEnumHandle: HANDLE, + lpNextCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + ) -> BOOL; + pub fn FindNextUrlCacheEntryExA( + hEnumHandle: HANDLE, + lpNextCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + lpGroupAttributes: LPVOID, + lpcbGroupAttributes: LPDWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn FindNextUrlCacheEntryExW( + hEnumHandle: HANDLE, + lpNextCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + lpGroupAttributes: LPVOID, + lpcbGroupAttributes: LPDWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn FindNextUrlCacheEntryW( + hEnumHandle: HANDLE, + lpNextCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + ) -> BOOL; + pub fn FindNextUrlCacheGroup( + hFind: HANDLE, + lpGroupId: *mut GROUPID, + lpReserved: LPVOID, + ) -> BOOL; + pub fn FtpCommandA( + hConnect: HINTERNET, + fExpectResponse: BOOL, + dwFlags: DWORD, + lpszCommand: LPCSTR, + dwContext: DWORD_PTR, + phFtpCommand: *mut HINTERNET, + ) -> BOOL; + pub fn FtpCommandW( + hConnect: HINTERNET, + fExpectResponse: BOOL, + dwFlags: DWORD, + lpszCommand: LPCWSTR, + dwContext: DWORD_PTR, + phFtpCommand: *mut HINTERNET, + ) -> BOOL; + pub fn FtpCreateDirectoryA( + hConnect: HINTERNET, + lpszDirectory: LPCSTR, + ) -> BOOL; + pub fn FtpCreateDirectoryW( + hConnect: HINTERNET, + lpszDirectory: LPCWSTR, + ) -> BOOL; + pub fn FtpDeleteFileA( + hConnect: HINTERNET, + lpszFileName: LPCSTR, + ) -> BOOL; + pub fn FtpDeleteFileW( + hConnect: HINTERNET, + lpszFileName: LPCWSTR, + ) -> BOOL; + pub fn FtpFindFirstFileA( + hConnect: HINTERNET, + lpszSearchFile: LPCSTR, + lpFindFileData: LPWIN32_FIND_DATAA, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn FtpFindFirstFileW( + hConnect: HINTERNET, + lpszSearchFile: LPCWSTR, + lpFindFileData: LPWIN32_FIND_DATAW, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn FtpGetCurrentDirectoryA( + hConnect: HINTERNET, + lpszCurrentDirectory: LPSTR, + lpdwCurrentDirectory: LPDWORD, + ) -> BOOL; + pub fn FtpGetCurrentDirectoryW( + hConnect: HINTERNET, + lpszCurrentDirectory: LPWSTR, + lpdwCurrentDirectory: LPDWORD, + ) -> BOOL; + pub fn FtpGetFileA( + hConnect: HINTERNET, + lpszRemoteFile: LPCSTR, + lpszNewFile: LPCSTR, + fFailIfExists: BOOL, + dwFlagsAndAttributes: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn FtpGetFileEx( + hFtpSession: HINTERNET, + lpszRemoteFile: LPCSTR, + lpszNewFile: LPCWSTR, + fFailIfExists: BOOL, + dwFlagsAndAttributes: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn FtpGetFileSize( + hFile: HINTERNET, + lpdwFileSizeHigh: LPDWORD, + ) -> DWORD; + pub fn FtpGetFileW( + hConnect: HINTERNET, + lpszRemoteFile: LPCWSTR, + lpszNewFile: LPCWSTR, + fFailIfExists: BOOL, + dwFlagsAndAttributes: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn FtpOpenFileA( + hConnect: HINTERNET, + lpszFileName: LPCSTR, + dwAccess: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn FtpOpenFileW( + hConnect: HINTERNET, + lpszFileName: LPCWSTR, + dwAccess: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn FtpPutFileA( + hConnect: HINTERNET, + lpszLocalFile: LPCSTR, + lpszNewRemoteFile: LPCSTR, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn FtpPutFileEx( + hFtpSession: HINTERNET, + lpszLocalFile: LPCWSTR, + lpszNewRemoteFile: LPCSTR, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn FtpPutFileW( + hConnect: HINTERNET, + lpszLocalFile: LPCWSTR, + lpszNewRemoteFile: LPCWSTR, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn FtpRemoveDirectoryA( + hConnect: HINTERNET, + lpszDirectory: LPCSTR, + ) -> BOOL; + pub fn FtpRemoveDirectoryW( + hConnect: HINTERNET, + lpszDirectory: LPCWSTR, + ) -> BOOL; + pub fn FtpRenameFileA( + hConnect: HINTERNET, + lpszExisting: LPCSTR, + lpszNew: LPCSTR, + ) -> BOOL; + pub fn FtpRenameFileW( + hConnect: HINTERNET, + lpszExisting: LPCWSTR, + lpszNew: LPCWSTR, + ) -> BOOL; + pub fn FtpSetCurrentDirectoryA( + hConnect: HINTERNET, + lpszDirectory: LPCSTR, + ) -> BOOL; + pub fn FtpSetCurrentDirectoryW( + hConnect: HINTERNET, + lpszDirectory: LPCWSTR, + ) -> BOOL; + pub fn GetUrlCacheEntryInfoA( + lpszUrlName: LPCSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + ) -> BOOL; + pub fn GetUrlCacheEntryInfoExA( + lpszUrl: LPCSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + lpszRedirectUrl: LPSTR, + lpcbRedirectUrl: LPDWORD, + lpReserved: LPVOID, + dwFlags: DWORD, + ) -> BOOL; + pub fn GetUrlCacheEntryInfoExW( + lpszUrl: LPCWSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + lpszRedirectUrl: LPWSTR, + lpcbRedirectUrl: LPDWORD, + lpReserved: LPVOID, + dwFlags: DWORD, + ) -> BOOL; + pub fn GetUrlCacheEntryInfoW( + lpszUrlName: LPCWSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + ) -> BOOL; + pub fn GetUrlCacheGroupAttributeA( + gid: GROUPID, + dwFlags: DWORD, + dwAttributes: DWORD, + lpGroupInfo: LPINTERNET_CACHE_GROUP_INFOA, + lpcbGroupInfo: LPDWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn GetUrlCacheGroupAttributeW( + gid: GROUPID, + dwFlags: DWORD, + dwAttributes: DWORD, + lpGroupInfo: LPINTERNET_CACHE_GROUP_INFOW, + lpcbGroupInfo: LPDWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn GopherCreateLocatorA( + lpszHost: LPCSTR, + nServerPort: INTERNET_PORT, + lpszDisplayString: LPCSTR, + lpszSelectorString: LPCSTR, + dwGopherType: DWORD, + lpszLocator: LPSTR, + lpdwBufferLength: LPDWORD, + ) -> BOOL; + pub fn GopherCreateLocatorW( + lpszHost: LPCWSTR, + nServerPort: INTERNET_PORT, + lpszDisplayString: LPCWSTR, + lpszSelectorString: LPCWSTR, + dwGopherType: DWORD, + lpszLocator: LPWSTR, + lpdwBufferLength: LPDWORD, + ) -> BOOL; + pub fn GopherFindFirstFileA( + hConnect: HINTERNET, + lpszLocator: LPCSTR, + lpszSearchString: LPCSTR, + lpFindData: LPGOPHER_FIND_DATAA, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn GopherFindFirstFileW( + hConnect: HINTERNET, + lpszLocator: LPCWSTR, + lpszSearchString: LPCWSTR, + lpFindData: LPGOPHER_FIND_DATAW, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn GopherGetAttributeA( + hConnect: HINTERNET, + lpszLocator: LPCSTR, + lpszAttributeName: LPCSTR, + lpBuffer: LPBYTE, + dwBufferLength: DWORD, + lpdwCharactersReturned: LPDWORD, + lpfnEnumerator: GOPHER_ATTRIBUTE_ENUMERATOR, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn GopherGetAttributeW( + hConnect: HINTERNET, + lpszLocator: LPCWSTR, + lpszAttributeName: LPCWSTR, + lpBuffer: LPBYTE, + dwBufferLength: DWORD, + lpdwCharactersReturned: LPDWORD, + lpfnEnumerator: GOPHER_ATTRIBUTE_ENUMERATOR, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn GopherGetLocatorTypeA( + lpszLocator: LPCSTR, + lpdwGopherType: LPDWORD, + ) -> BOOL; + pub fn GopherGetLocatorTypeW( + lpszLocator: LPCWSTR, + lpdwGopherType: LPDWORD, + ) -> BOOL; + pub fn GopherOpenFileA( + hConnect: HINTERNET, + lpszLocator: LPCSTR, + lpszView: LPCSTR, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn GopherOpenFileW( + hConnect: HINTERNET, + lpszLocator: LPCWSTR, + lpszView: LPCWSTR, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn HttpAddRequestHeadersA( + hRequest: HINTERNET, + lpszHeaders: LPCSTR, + dwHeadersLength: DWORD, + dwModifiers: DWORD, + ) -> BOOL; + pub fn HttpAddRequestHeadersW( + hRequest: HINTERNET, + lpszHeaders: LPCWSTR, + dwHeadersLength: DWORD, + dwModifiers: DWORD, + ) -> BOOL; + pub fn HttpEndRequestA( + hRequest: HINTERNET, + lpBuffersOut: LPINTERNET_BUFFERSA, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn HttpEndRequestW( + hRequest: HINTERNET, + lpBuffersOut: LPINTERNET_BUFFERSW, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn HttpOpenRequestA( + hConnect: HINTERNET, + lpszVerb: LPCSTR, + lpszObjectName: LPCSTR, + lpszVersion: LPCSTR, + lpszReferrer: LPCSTR, + lplpszAcceptTypes: *mut LPCSTR, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn HttpOpenRequestW( + hConnect: HINTERNET, + lpszVerb: LPCWSTR, + lpszObjectName: LPCWSTR, + lpszVersion: LPCWSTR, + lpszReferrer: LPCWSTR, + lplpszAcceptTypes: *mut LPCWSTR, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn HttpQueryInfoA( + hRequest: HINTERNET, + dwInfoLevel: DWORD, + lpBuffer: LPVOID, + lpdwBufferLength: LPDWORD, + lpdwIndex: LPDWORD, + ) -> BOOL; + pub fn HttpQueryInfoW( + hRequest: HINTERNET, + dwInfoLevel: DWORD, + lpBuffer: LPVOID, + lpdwBufferLength: LPDWORD, + lpdwIndex: LPDWORD, + ) -> BOOL; + pub fn HttpSendRequestA( + hRequest: HINTERNET, + lpszHeaders: LPCSTR, + dwHeadersLength: DWORD, + lpOptional: LPVOID, + dwOptionalLength: DWORD, + ) -> BOOL; + pub fn HttpSendRequestExA( + hRequest: HINTERNET, + lpBuffersIn: LPINTERNET_BUFFERSA, + lpBuffersOut: LPINTERNET_BUFFERSA, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn HttpSendRequestExW( + hRequest: HINTERNET, + lpBuffersIn: LPINTERNET_BUFFERSW, + lpBuffersOut: LPINTERNET_BUFFERSW, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn HttpSendRequestW( + hRequest: HINTERNET, + lpszHeaders: LPCWSTR, + dwHeadersLength: DWORD, + lpOptional: LPVOID, + dwOptionalLength: DWORD, + ) -> BOOL; + pub fn InternetAttemptConnect( + dwReserved: DWORD, + ) -> DWORD; + pub fn InternetAutodial( + dwFlags: DWORD, + hwndParent: HWND, + ) -> BOOL; + pub fn InternetAutodialHangup( + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetCanonicalizeUrlA( + lpszUrl: LPCSTR, + lpszBuffer: LPSTR, + lpdwBufferLength: LPDWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetCanonicalizeUrlW( + lpszUrl: LPCWSTR, + lpszBuffer: LPWSTR, + lpdwBufferLength: LPDWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetCheckConnectionA( + lpszUrl: LPCSTR, + dwFlags: DWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetCheckConnectionW( + lpszUrl: LPCWSTR, + dwFlags: DWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetClearAllPerSiteCookieDecisions() -> BOOL; + pub fn InternetCloseHandle( + hInternet: HINTERNET, + ) -> BOOL; + pub fn InternetCombineUrlA( + lpszBaseUrl: LPCSTR, + lpszRelativeUrl: LPCSTR, + lpszBuffer: LPSTR, + lpdwBufferLength: LPDWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetCombineUrlW( + lpszBaseUrl: LPCWSTR, + lpszRelativeUrl: LPCWSTR, + lpszBuffer: LPWSTR, + lpdwBufferLength: LPDWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetConfirmZoneCrossingA( + hWnd: HWND, + szUrlPrev: LPSTR, + szUrlNew: LPSTR, + bPost: BOOL, + ) -> DWORD; + pub fn InternetConfirmZoneCrossingW( + hWnd: HWND, + szUrlPrev: LPWSTR, + szUrlNew: LPWSTR, + bPost: BOOL, + ) -> DWORD; + pub fn InternetConnectA( + hInternet: HINTERNET, + lpszServerName: LPCSTR, + nServerPort: INTERNET_PORT, + lpszUserName: LPCSTR, + lpszPassword: LPCSTR, + dwService: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn InternetConnectW( + hInternet: HINTERNET, + lpszServerName: LPCWSTR, + nServerPort: INTERNET_PORT, + lpszUserName: LPCWSTR, + lpszPassword: LPCWSTR, + dwService: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn InternetCrackUrlA( + lpszUrl: LPCSTR, + dwUrlLength: DWORD, + dwFlags: DWORD, + lpUrlComponents: LPURL_COMPONENTSA, + ) -> BOOL; + pub fn InternetCrackUrlW( + lpszUrl: LPCWSTR, + dwUrlLength: DWORD, + dwFlags: DWORD, + lpUrlComponents: LPURL_COMPONENTSW, + ) -> BOOL; + pub fn InternetCreateUrlA( + lpUrlComponents: LPURL_COMPONENTSA, + dwFlags: DWORD, + lpszUrl: LPSTR, + lpdwUrlLength: LPDWORD, + ) -> BOOL; + pub fn InternetCreateUrlW( + lpUrlComponents: LPURL_COMPONENTSW, + dwFlags: DWORD, + lpszUrl: LPWSTR, + lpdwUrlLength: LPDWORD, + ) -> BOOL; + pub fn InternetDialA( + hwndParent: HWND, + lpszConnectoid: LPSTR, + dwFlags: DWORD, + lpdwConnection: *mut DWORD_PTR, + dwReserved: DWORD, + ) -> DWORD; + pub fn InternetDialW( + hwndParent: HWND, + lpszConnectoid: LPWSTR, + dwFlags: DWORD, + lpdwConnection: *mut DWORD_PTR, + dwReserved: DWORD, + ) -> DWORD; + pub fn InternetEnumPerSiteCookieDecisionA( + pszSiteName: LPSTR, + pcSiteNameSize: *mut u32, + pdwDecision: *mut u32, + dwIndex: u32, + ) -> BOOL; + pub fn InternetEnumPerSiteCookieDecisionW( + pszSiteName: LPWSTR, + pcSiteNameSize: *mut u32, + pdwDecision: *mut u32, + dwIndex: u32, + ) -> BOOL; + pub fn InternetErrorDlg( + hWnd: HWND, + hRequest: HINTERNET, + dwError: DWORD, + dwFlags: DWORD, + lppvData: *mut LPVOID, + ) -> DWORD; + pub fn InternetFindNextFileA( + hFind: HINTERNET, + lpvFindData: LPVOID, + ) -> BOOL; + pub fn InternetFindNextFileW( + hFind: HINTERNET, + lpvFindData: LPVOID, + ) -> BOOL; + pub fn InternetFreeCookies( + pCookies: *mut INTERNET_COOKIE2, + dwCookieCount: DWORD, + ) -> (); + pub fn InternetGetConnectedState( + lpdwFlags: LPDWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetGetConnectedStateExA( + lpdwFlags: LPDWORD, + lpszConnectionName: LPSTR, + cchNameLen: DWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetGetConnectedStateExW( + lpdwFlags: LPDWORD, + lpszConnectionName: LPWSTR, + cchNameLen: DWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetGetCookieA( + lpszUrl: LPCSTR, + lpszCookieName: LPCSTR, + lpszCookieData: LPSTR, + lpdwSize: LPDWORD, + ) -> BOOL; + pub fn InternetGetCookieEx2( + pcwszUrl: PCWSTR, + pcwszCookieName: PCWSTR, + dwFlags: DWORD, + ppCookies: *mut *mut INTERNET_COOKIE2, + pdwCookieCount: PDWORD, + ) -> DWORD; + pub fn InternetGetCookieExA( + lpszUrl: LPCSTR, + lpszCookieName: LPCSTR, + lpszCookieData: LPSTR, + lpdwSize: LPDWORD, + dwFlags: DWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn InternetGetCookieExW( + lpszUrl: LPCWSTR, + lpszCookieName: LPCWSTR, + lpszCookieData: LPWSTR, + lpdwSize: LPDWORD, + dwFlags: DWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn InternetGetCookieW( + lpszUrl: LPCWSTR, + lpszCookieName: LPCWSTR, + lpszCookieData: LPWSTR, + lpdwSize: LPDWORD, + ) -> BOOL; + pub fn InternetGetLastResponseInfoA( + lpdwError: LPDWORD, + lpszBuffer: LPSTR, + lpdwBufferLength: LPDWORD, + ) -> BOOL; + pub fn InternetGetLastResponseInfoW( + lpdwError: LPDWORD, + lpszBuffer: LPWSTR, + lpdwBufferLength: LPDWORD, + ) -> BOOL; + pub fn InternetGetPerSiteCookieDecisionA( + pchHostName: LPCSTR, + pResult: *mut u32, + ) -> BOOL; + pub fn InternetGetPerSiteCookieDecisionW( + pchHostName: LPCWSTR, + pResult: *mut u32, + ) -> BOOL; + pub fn InternetGoOnlineA( + lpszURL: LPCSTR, + hwndParent: HWND, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetGoOnlineW( + lpszURL: LPCWSTR, + hwndParent: HWND, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetHangUp( + dwConnection: DWORD_PTR, + dwReserved: DWORD, + ) -> DWORD; + pub fn InternetInitializeAutoProxyDll( + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetLockRequestFile( + hInternet: HINTERNET, + lphLockRequestInfo: *mut HANDLE, + ) -> BOOL; + pub fn InternetOpenA( + lpszAgent: LPCSTR, + dwAccessType: DWORD, + lpszProxy: LPCSTR, + lpszProxyBypass: LPCSTR, + dwFlags: DWORD, + ) -> HINTERNET; + pub fn InternetOpenUrlA( + hInternet: HINTERNET, + lpszUrl: LPCSTR, + lpszHeaders: LPCSTR, + dwHeadersLength: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn InternetOpenUrlW( + hInternet: HINTERNET, + lpszUrl: LPCWSTR, + lpszHeaders: LPCWSTR, + dwHeadersLength: DWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> HINTERNET; + pub fn InternetOpenW( + lpszAgent: LPCWSTR, + dwAccessType: DWORD, + lpszProxy: LPCWSTR, + lpszProxyBypass: LPCWSTR, + dwFlags: DWORD, + ) -> HINTERNET; + pub fn InternetQueryDataAvailable( + hFile: HINTERNET, + lpdwNumberOfBytesAvailable: LPDWORD, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn InternetQueryOptionA( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + lpdwBufferLength: LPDWORD, + ) -> BOOL; + pub fn InternetQueryOptionW( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + lpdwBufferLength: LPDWORD, + ) -> BOOL; + pub fn InternetReadFile( + hFile: HINTERNET, + lpBuffer: LPVOID, + dwNumberOfBytesToRead: DWORD, + lpdwNumberOfBytesRead: LPDWORD, + ) -> BOOL; + pub fn InternetReadFileExA( + hFile: HINTERNET, + lpBuffersOut: LPINTERNET_BUFFERSA, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn InternetReadFileExW( + hFile: HINTERNET, + lpBuffersOut: LPINTERNET_BUFFERSW, + dwFlags: DWORD, + dwContext: DWORD_PTR, + ) -> BOOL; + pub fn InternetSetCookieA( + lpszUrl: LPCSTR, + lpszCookieName: LPCSTR, + lpszCookieData: LPCSTR, + ) -> BOOL; + pub fn InternetSetCookieEx2( + pcwszUrl: PCWSTR, + pCookie: *const INTERNET_COOKIE2, + pcwszP3PPolicy: PCWSTR, + dwFlags: DWORD, + pdwCookieState: PDWORD, + ) -> DWORD; + pub fn InternetSetCookieExA( + lpszUrl: LPCSTR, + lpszCookieName: LPCSTR, + lpszCookieData: LPCSTR, + dwFlags: DWORD, + dwReserved: DWORD_PTR, + ) -> DWORD; + pub fn InternetSetCookieExW( + lpszUrl: LPCWSTR, + lpszCookieName: LPCWSTR, + lpszCookieData: LPCWSTR, + dwFlags: DWORD, + dwReserved: DWORD_PTR, + ) -> DWORD; + pub fn InternetSetCookieW( + lpszUrl: LPCWSTR, + lpszCookieName: LPCWSTR, + lpszCookieData: LPCWSTR, + ) -> BOOL; + pub fn InternetSetDialStateA( + lpszConnectoid: LPCSTR, + dwState: DWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetSetDialStateW( + lpszConnectoid: LPCWSTR, + dwState: DWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetSetFilePointer( + hFile: HINTERNET, + lDistanceToMove: LONG, + lpDistanceToMoveHigh: PLONG, + dwMoveMethod: DWORD, + dwContext: DWORD_PTR, + ) -> DWORD; + pub fn InternetSetOptionA( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + dwBufferLength: DWORD, + ) -> BOOL; + pub fn InternetSetOptionExA( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + dwBufferLength: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetSetOptionExW( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + dwBufferLength: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn InternetSetOptionW( + hInternet: HINTERNET, + dwOption: DWORD, + lpBuffer: LPVOID, + dwBufferLength: DWORD, + ) -> BOOL; + pub fn InternetSetPerSiteCookieDecisionA( + pchHostName: LPCSTR, + dwDecision: DWORD, + ) -> BOOL; + pub fn InternetSetPerSiteCookieDecisionW( + pchHostName: LPCWSTR, + dwDecision: DWORD, + ) -> BOOL; + pub fn InternetSetStatusCallbackA( + hInternet: HINTERNET, + lpfnInternetCallback: INTERNET_STATUS_CALLBACK, + ) -> INTERNET_STATUS_CALLBACK; + pub fn InternetSetStatusCallbackW( + hInternet: HINTERNET, + lpfnInternetCallback: INTERNET_STATUS_CALLBACK, + ) -> INTERNET_STATUS_CALLBACK; + pub fn InternetTimeFromSystemTimeA( + pst: *const SYSTEMTIME, + dwRFC: DWORD, + lpszTime: LPSTR, + cbTime: DWORD, + ) -> BOOL; + pub fn InternetTimeFromSystemTimeW( + pst: *const SYSTEMTIME, + dwRFC: DWORD, + lpszTime: LPWSTR, + cbTime: DWORD, + ) -> BOOL; + pub fn InternetTimeToSystemTimeA( + lpszTime: LPCSTR, + pst: *mut SYSTEMTIME, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetTimeToSystemTimeW( + lpszTime: LPCWSTR, + pst: *mut SYSTEMTIME, + dwReserved: DWORD, + ) -> BOOL; + pub fn InternetUnlockRequestFile( + hLockRequestInfo: HANDLE, + ) -> BOOL; + pub fn InternetWriteFile( + hFile: HINTERNET, + lpBuffer: LPCVOID, + dwNumberOfBytesToWrite: DWORD, + lpdwNumberOfBytesWritten: LPDWORD, + ) -> BOOL; + pub fn PrivacyGetZonePreferenceW( + dwZone: DWORD, + dwType: DWORD, + pdwTemplate: LPDWORD, + pszBuffer: LPWSTR, + pdwBufferLength: LPDWORD, + ) -> DWORD; + pub fn PrivacySetZonePreferenceW( + dwZone: DWORD, + dwType: DWORD, + dwTemplate: DWORD, + pszPreference: LPCWSTR, + ) -> DWORD; + pub fn ReadUrlCacheEntryStream( + hUrlCacheStream: HANDLE, + dwLocation: DWORD, + lpBuffer: LPVOID, + lpdwLen: LPDWORD, + Reserved: DWORD, + ) -> BOOL; + pub fn ReadUrlCacheEntryStreamEx( + hUrlCacheStream: HANDLE, + qwLocation: DWORDLONG, + lpBuffer: LPVOID, + lpdwLen: LPDWORD, + ) -> BOOL; + pub fn ResumeSuspendedDownload( + hRequest: HINTERNET, + dwResultCode: DWORD, + ) -> BOOL; + pub fn RetrieveUrlCacheEntryFileA( + lpszUrlName: LPCSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn RetrieveUrlCacheEntryFileW( + lpszUrlName: LPCWSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + dwReserved: DWORD, + ) -> BOOL; + pub fn RetrieveUrlCacheEntryStreamA( + lpszUrlName: LPCSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + lpcbCacheEntryInfo: LPDWORD, + fRandomRead: BOOL, + dwReserved: DWORD, + ) -> HANDLE; + pub fn RetrieveUrlCacheEntryStreamW( + lpszUrlName: LPCWSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + lpcbCacheEntryInfo: LPDWORD, + fRandomRead: BOOL, + dwReserved: DWORD, + ) -> HANDLE; + pub fn SetUrlCacheEntryGroupA( + lpszUrlName: LPCSTR, + dwFlags: DWORD, + GroupId: GROUPID, + pbGroupAttributes: LPBYTE, + cbGroupAttributes: DWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn SetUrlCacheEntryGroupW( + lpszUrlName: LPCWSTR, + dwFlags: DWORD, + GroupId: GROUPID, + pbGroupAttributes: LPBYTE, + cbGroupAttributes: DWORD, + lpReserved: LPVOID, + ) -> BOOL; + pub fn SetUrlCacheEntryInfoA( + lpszUrlName: LPCSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOA, + dwFieldControl: DWORD, + ) -> BOOL; + pub fn SetUrlCacheEntryInfoW( + lpszUrlName: LPCWSTR, + lpCacheEntryInfo: LPINTERNET_CACHE_ENTRY_INFOW, + dwFieldControl: DWORD, + ) -> BOOL; + pub fn SetUrlCacheGroupAttributeA( + gid: GROUPID, + dwFlags: DWORD, + dwAttributes: DWORD, + lpGroupInfo: LPINTERNET_CACHE_GROUP_INFOA, + lpReserved: LPVOID, + ) -> BOOL; + pub fn SetUrlCacheGroupAttributeW( + gid: GROUPID, + dwFlags: DWORD, + dwAttributes: DWORD, + lpGroupInfo: LPINTERNET_CACHE_GROUP_INFOW, + lpReserved: LPVOID, + ) -> BOOL; + pub fn UnlockUrlCacheEntryFileA( + lpszUrlName: LPCSTR, + dwReserved: DWORD, + ) -> BOOL; + pub fn UnlockUrlCacheEntryFileW( + lpszUrlName: LPCWSTR, + dwReserved: DWORD, + ) -> BOOL; + pub fn UnlockUrlCacheEntryStream( + hUrlCacheStream: HANDLE, + Reserved: DWORD, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/winineti.rs b/src/vendor/winapi/src/um/winineti.rs new file mode 100644 index 0000000000..f40fa31961 --- /dev/null +++ b/src/vendor/winapi/src/um/winineti.rs @@ -0,0 +1,143 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Windows Internet Services API procedure declarations, types and constants. +// Currently, this only contains `INTERNET_FLAG_BGUPDATE`, which is needed to correctly define +// `wininet::INTERNET_FLAGS_MASK`. +use shared::minwindef::DWORD; +pub const INTERNET_FLAG_BGUPDATE: DWORD = 0x00000008; +// Functions from wininet.dll that *should* be in this header. +// pub fn AppCacheCheckManifest(); +// pub fn AppCacheCloseHandle(); +// pub fn AppCacheCreateAndCommitFile(); +// pub fn AppCacheDeleteGroup(); +// pub fn AppCacheDeleteIEGroup(); +// pub fn AppCacheDuplicateHandle(); +// pub fn AppCacheFinalize(); +// pub fn AppCacheFreeDownloadList(); +// pub fn AppCacheFreeGroupList(); +// pub fn AppCacheFreeIESpace(); +// pub fn AppCacheFreeSpace(); +// pub fn AppCacheGetDownloadList(); +// pub fn AppCacheGetFallbackUrl(); +// pub fn AppCacheGetGroupList(); +// pub fn AppCacheGetIEGroupList(); +// pub fn AppCacheGetInfo(); +// pub fn AppCacheGetManifestUrl(); +// pub fn AppCacheLookup(); +// pub fn CommitUrlCacheEntryBinaryBlob(); +// pub fn CreateCacheServerRpcBinding(); +// pub fn CreateUrlCacheContainerA(); +// pub fn CreateUrlCacheContainerW(); +// pub fn CreateUrlCacheEntryExW(); +// pub fn DeleteIE3Cache(); +// pub fn DeleteUrlCacheContainerA(); +// pub fn DeleteUrlCacheContainerW(); +// pub fn DoConnectoidsExist(); +// pub fn ExportCookieFileA(); +// pub fn ExportCookieFileW(); +// pub fn FindFirstUrlCacheContainerA(); +// pub fn FindFirstUrlCacheContainerW(); +// pub fn FindNextUrlCacheContainerA(); +// pub fn FindNextUrlCacheContainerW(); +// pub fn FindP3PPolicySymbol(); +// pub fn ForceNexusLookupExW(); +// pub fn FreeP3PObject(); +// pub fn FreeUrlCacheSpaceA(); +// pub fn FreeUrlCacheSpaceW(); +// pub fn GetCacheServerConnection(); +// pub fn GetDiskInfoA(); +// pub fn GetP3PPolicy(); +// pub fn GetP3PRequestStatus(); +// pub fn GetUrlCacheConfigInfoA(); +// pub fn GetUrlCacheConfigInfoW(); +// pub fn GetUrlCacheEntryBinaryBlob(); +// pub fn GetUrlCacheHeaderData(); +// pub fn HttpCheckDavComplianceA(); +// pub fn HttpCheckDavComplianceW(); +// pub fn HttpCloseDependencyHandle(); +// pub fn HttpDuplicateDependencyHandle(); +// pub fn HttpGetServerCredentials(); +// pub fn HttpGetTunnelSocket(); +// pub fn HttpIsHostHstsEnabled(); +// pub fn HttpOpenDependencyHandle(); +// pub fn HttpPushClose(); +// pub fn HttpPushEnable(); +// pub fn HttpPushWait(); +// pub fn HttpWebSocketClose(); +// pub fn HttpWebSocketCompleteUpgrade(); +// pub fn HttpWebSocketQueryCloseStatus(); +// pub fn HttpWebSocketReceive(); +// pub fn HttpWebSocketSend(); +// pub fn HttpWebSocketShutdown(); +// pub fn ImportCookieFileA(); +// pub fn ImportCookieFileW(); +// pub fn IncrementUrlCacheHeaderData(); +// pub fn InternalInternetGetCookie(); +// pub fn InternetAlgIdToStringA(); +// pub fn InternetAlgIdToStringW(); +// pub fn InternetAutodialCallback(); +// pub fn InternetAutoProxyGetProxyForUrl(); +// pub fn InternetAutoProxyOnSendRequestComplete(); +// pub fn InternetFortezzaCommand(); +// pub fn InternetFreeProxyInfoList(); +// pub fn InternetGetCertByURLA(); +// pub fn InternetGetProxyForUrl(); +// pub fn InternetGetSecurityInfoByURLA(); +// pub fn InternetGetSecurityInfoByURLW(); +// pub fn InternetQueryFortezzaStatus(); +// pub fn InternetSecurityProtocolToStringA(); +// pub fn InternetSecurityProtocolToStringW(); +// pub fn InternetShowSecurityInfoByURLA(); +// pub fn InternetShowSecurityInfoByURLW(); +// pub fn InternetWriteFileExA(); +// pub fn InternetWriteFileExW(); +// pub fn IsDialUpConnection(); +// pub fn IsDomainLegalCookieDomainA(); +// pub fn IsDomainLegalCookieDomainW(); +// pub fn IsHostInProxyBypassList(); +// pub fn IsLanConnection(); +// pub fn IsProfilesEnabled(); +// pub fn IsUrlCacheEntryExpiredA(); +// pub fn IsUrlCacheEntryExpiredW(); +// pub fn LoadUrlCacheContent(); +// pub fn MapResourceToPolicy(); +// pub fn ParseX509EncodedCertificateForListBoxEntry(); +// pub fn PerformOperationOverUrlCacheA(); +// pub fn ReadGuidsForConnectedNetworks(); +// pub fn RegisterForNetworkChangeNotification(); +// pub fn RegisterUrlCacheNotification(); +// pub fn RunOnceUrlCache(); +// pub fn SetGlobalJetParameters(); +// pub fn SetUrlCacheConfigInfoA(); +// pub fn SetUrlCacheConfigInfoW(); +// pub fn SetUrlCacheHeaderData(); +// pub fn ShowCertificate(); +// pub fn ShowClientAuthCerts(); +// pub fn ShowSecurityInfo(); +// pub fn ShowX509EncodedCertificate(); +// pub fn UnRegisterNetworkChangeNotification(); +// pub fn UpdateUrlCacheContentPath(); +// pub fn UrlCacheCheckEntriesExist(); +// pub fn UrlCacheCloseEntryHandle(); +// pub fn UrlCacheContainerSetEntryMaximumAge(); +// pub fn UrlCacheCreateContainer(); +// pub fn UrlCacheFindFirstEntry(); +// pub fn UrlCacheFindNextEntry(); +// pub fn UrlCacheFreeEntryInfo(); +// pub fn UrlCacheFreeGlobalSpace(); +// pub fn UrlCacheGetContentPaths(); +// pub fn UrlCacheGetEntryInfo(); +// pub fn UrlCacheGetGlobalCacheSize(); +// pub fn UrlCacheGetGlobalLimit(); +// pub fn UrlCacheReadEntryStream(); +// pub fn UrlCacheReloadSettings(); +// pub fn UrlCacheRetrieveEntryFile(); +// pub fn UrlCacheRetrieveEntryStream(); +// pub fn UrlCacheServer(); +// pub fn UrlCacheSetGlobalLimit(); +// pub fn UrlCacheUpdateEntryExtraData(); +// pub fn UrlZonesDetach(); diff --git a/src/vendor/winapi/src/um/winioctl.rs b/src/vendor/winapi/src/um/winioctl.rs new file mode 100644 index 0000000000..500b94a399 --- /dev/null +++ b/src/vendor/winapi/src/um/winioctl.rs @@ -0,0 +1,846 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the 32-Bit Windows Device I/O control codes. +use shared::devpropdef::DEVPROPKEY; +use shared::minwindef::{BYTE, DWORD, WORD}; +use um::winnt::{ANYSIZE_ARRAY, FILE_READ_DATA, FILE_WRITE_DATA, HANDLE, LARGE_INTEGER, WCHAR}; +DEFINE_GUID!{GUID_DEVINTERFACE_DISK, + 0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_CDROM, + 0x53f56308, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_PARTITION, + 0x53f5630a, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_TAPE, + 0x53f5630b, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_WRITEONCEDISK, + 0x53f5630c, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_VOLUME, + 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_MEDIUMCHANGER, + 0x53f56310, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_FLOPPY, + 0x53f56311, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_CDCHANGER, + 0x53f56312, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_STORAGEPORT, + 0x2accfe60, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} +DEFINE_GUID!{GUID_DEVINTERFACE_VMLUN, + 0x6f416619, 0x9f29, 0x42a5, 0xb2, 0x0b, 0x37, 0xe2, 0x19, 0xca, 0x02, 0xb0} +DEFINE_GUID!{GUID_DEVINTERFACE_SES, + 0x1790c9ec, 0x47d5, 0x4df3, 0xb5, 0xaf, 0x9a, 0xdf, 0x3c, 0xf2, 0x3e, 0x48} +DEFINE_GUID!{WDI_STORAGE_PREDICT_FAILURE_DPS_GUID, + 0xe9f2d03a, 0x747c, 0x41c2, 0xbb, 0x9a, 0x02, 0xc6, 0x2b, 0x6d, 0x5f, 0xcb} +DEFINE_GUID!{GUID_DEVINTERFACE_HIDDEN_VOLUME, + 0x7f108a28, 0x9833, 0x4b3b, 0xb7, 0x80, 0x2c, 0x6b, 0x5f, 0xa5, 0xc0, 0x62} +DEFINE_GUID!{GUID_DEVINTERFACE_UNIFIED_ACCESS_RPMB, + 0x27447c21, 0xbcc3, 0x4d07, 0xa0, 0x5b, 0xa3, 0x39, 0x5b, 0xb4, 0xee, 0xe7} +DEFINE_GUID!{GUID_DEVINTERFACE_COMPORT, + 0x86E0D1E0, 0x8089, 0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73} +DEFINE_GUID!{GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, + 0x4D36E978, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18} +// Some obsolete definitions +// 108 +DEFINE_DEVPROPKEY!{DEVPKEY_Storage_Portable, + 0x4d1ebee8, 0x803, 0x4774, 0x98, 0x42, 0xb7, 0x7d, 0xb5, 0x2, 0x65, 0xe9, 2} +DEFINE_DEVPROPKEY!{DEVPKEY_Storage_Removable_Media, + 0x4d1ebee8, 0x803, 0x4774, 0x98, 0x42, 0xb7, 0x7d, 0xb5, 0x2, 0x65, 0xe9, 3} +DEFINE_DEVPROPKEY!{DEVPKEY_Storage_System_Critical, + 0x4d1ebee8, 0x803, 0x4774, 0x98, 0x42, 0xb7, 0x7d, 0xb5, 0x2, 0x65, 0xe9, 4} +pub type DEVICE_TYPE = DWORD; +pub const FILE_DEVICE_BEEP: DEVICE_TYPE = 0x00000001; +pub const FILE_DEVICE_CD_ROM: DEVICE_TYPE = 0x00000002; +pub const FILE_DEVICE_CD_ROM_FILE_SYSTEM: DEVICE_TYPE = 0x00000003; +pub const FILE_DEVICE_CONTROLLER: DEVICE_TYPE = 0x00000004; +pub const FILE_DEVICE_DATALINK: DEVICE_TYPE = 0x00000005; +pub const FILE_DEVICE_DFS: DEVICE_TYPE = 0x00000006; +pub const FILE_DEVICE_DISK: DEVICE_TYPE = 0x00000007; +pub const FILE_DEVICE_DISK_FILE_SYSTEM: DEVICE_TYPE = 0x00000008; +pub const FILE_DEVICE_FILE_SYSTEM: DEVICE_TYPE = 0x00000009; +pub const FILE_DEVICE_INPORT_PORT: DEVICE_TYPE = 0x0000000a; +pub const FILE_DEVICE_KEYBOARD: DEVICE_TYPE = 0x0000000b; +pub const FILE_DEVICE_MAILSLOT: DEVICE_TYPE = 0x0000000c; +pub const FILE_DEVICE_MIDI_IN: DEVICE_TYPE = 0x0000000d; +pub const FILE_DEVICE_MIDI_OUT: DEVICE_TYPE = 0x0000000e; +pub const FILE_DEVICE_MOUSE: DEVICE_TYPE = 0x0000000f; +pub const FILE_DEVICE_MULTI_UNC_PROVIDER: DEVICE_TYPE = 0x00000010; +pub const FILE_DEVICE_NAMED_PIPE: DEVICE_TYPE = 0x00000011; +pub const FILE_DEVICE_NETWORK: DEVICE_TYPE = 0x00000012; +pub const FILE_DEVICE_NETWORK_BROWSER: DEVICE_TYPE = 0x00000013; +pub const FILE_DEVICE_NETWORK_FILE_SYSTEM: DEVICE_TYPE = 0x00000014; +pub const FILE_DEVICE_NULL: DEVICE_TYPE = 0x00000015; +pub const FILE_DEVICE_PARALLEL_PORT: DEVICE_TYPE = 0x00000016; +pub const FILE_DEVICE_PHYSICAL_NETCARD: DEVICE_TYPE = 0x00000017; +pub const FILE_DEVICE_PRINTER: DEVICE_TYPE = 0x00000018; +pub const FILE_DEVICE_SCANNER: DEVICE_TYPE = 0x00000019; +pub const FILE_DEVICE_SERIAL_MOUSE_PORT: DEVICE_TYPE = 0x0000001a; +pub const FILE_DEVICE_SERIAL_PORT: DEVICE_TYPE = 0x0000001b; +pub const FILE_DEVICE_SCREEN: DEVICE_TYPE = 0x0000001c; +pub const FILE_DEVICE_SOUND: DEVICE_TYPE = 0x0000001d; +pub const FILE_DEVICE_STREAMS: DEVICE_TYPE = 0x0000001e; +pub const FILE_DEVICE_TAPE: DEVICE_TYPE = 0x0000001f; +pub const FILE_DEVICE_TAPE_FILE_SYSTEM: DEVICE_TYPE = 0x00000020; +pub const FILE_DEVICE_TRANSPORT: DEVICE_TYPE = 0x00000021; +pub const FILE_DEVICE_UNKNOWN: DEVICE_TYPE = 0x00000022; +pub const FILE_DEVICE_VIDEO: DEVICE_TYPE = 0x00000023; +pub const FILE_DEVICE_VIRTUAL_DISK: DEVICE_TYPE = 0x00000024; +pub const FILE_DEVICE_WAVE_IN: DEVICE_TYPE = 0x00000025; +pub const FILE_DEVICE_WAVE_OUT: DEVICE_TYPE = 0x00000026; +pub const FILE_DEVICE_8042_PORT: DEVICE_TYPE = 0x00000027; +pub const FILE_DEVICE_NETWORK_REDIRECTOR: DEVICE_TYPE = 0x00000028; +pub const FILE_DEVICE_BATTERY: DEVICE_TYPE = 0x00000029; +pub const FILE_DEVICE_BUS_EXTENDER: DEVICE_TYPE = 0x0000002a; +pub const FILE_DEVICE_MODEM: DEVICE_TYPE = 0x0000002b; +pub const FILE_DEVICE_VDM: DEVICE_TYPE = 0x0000002c; +pub const FILE_DEVICE_MASS_STORAGE: DEVICE_TYPE = 0x0000002d; +pub const FILE_DEVICE_SMB: DEVICE_TYPE = 0x0000002e; +pub const FILE_DEVICE_KS: DEVICE_TYPE = 0x0000002f; +pub const FILE_DEVICE_CHANGER: DEVICE_TYPE = 0x00000030; +pub const FILE_DEVICE_SMARTCARD: DEVICE_TYPE = 0x00000031; +pub const FILE_DEVICE_ACPI: DEVICE_TYPE = 0x00000032; +pub const FILE_DEVICE_DVD: DEVICE_TYPE = 0x00000033; +pub const FILE_DEVICE_FULLSCREEN_VIDEO: DEVICE_TYPE = 0x00000034; +pub const FILE_DEVICE_DFS_FILE_SYSTEM: DEVICE_TYPE = 0x00000035; +pub const FILE_DEVICE_DFS_VOLUME: DEVICE_TYPE = 0x00000036; +pub const FILE_DEVICE_SERENUM: DEVICE_TYPE = 0x00000037; +pub const FILE_DEVICE_TERMSRV: DEVICE_TYPE = 0x00000038; +pub const FILE_DEVICE_KSEC: DEVICE_TYPE = 0x00000039; +pub const FILE_DEVICE_FIPS: DEVICE_TYPE = 0x0000003A; +pub const FILE_DEVICE_INFINIBAND: DEVICE_TYPE = 0x0000003B; +pub const FILE_DEVICE_VMBUS: DEVICE_TYPE = 0x0000003E; +pub const FILE_DEVICE_CRYPT_PROVIDER: DEVICE_TYPE = 0x0000003F; +pub const FILE_DEVICE_WPD: DEVICE_TYPE = 0x00000040; +pub const FILE_DEVICE_BLUETOOTH: DEVICE_TYPE = 0x00000041; +pub const FILE_DEVICE_MT_COMPOSITE: DEVICE_TYPE = 0x00000042; +pub const FILE_DEVICE_MT_TRANSPORT: DEVICE_TYPE = 0x00000043; +pub const FILE_DEVICE_BIOMETRIC: DEVICE_TYPE = 0x00000044; +pub const FILE_DEVICE_PMI: DEVICE_TYPE = 0x00000045; +pub const FILE_DEVICE_EHSTOR: DEVICE_TYPE = 0x00000046; +pub const FILE_DEVICE_DEVAPI: DEVICE_TYPE = 0x00000047; +pub const FILE_DEVICE_GPIO: DEVICE_TYPE = 0x00000048; +pub const FILE_DEVICE_USBEX: DEVICE_TYPE = 0x00000049; +pub const FILE_DEVICE_CONSOLE: DEVICE_TYPE = 0x00000050; +pub const FILE_DEVICE_NFP: DEVICE_TYPE = 0x00000051; +pub const FILE_DEVICE_SYSENV: DEVICE_TYPE = 0x00000052; +pub const FILE_DEVICE_VIRTUAL_BLOCK: DEVICE_TYPE = 0x00000053; +pub const FILE_DEVICE_POINT_OF_SERVICE: DEVICE_TYPE = 0x00000054; +pub const FILE_DEVICE_STORAGE_REPLICATION: DEVICE_TYPE = 0x00000055; +pub const FILE_DEVICE_TRUST_ENV: DEVICE_TYPE = 0x00000056; +pub const FILE_DEVICE_UCM: DEVICE_TYPE = 0x00000057; +pub const FILE_DEVICE_UCMTCPCI: DEVICE_TYPE = 0x00000058; +//224 +pub const METHOD_BUFFERED: DWORD = 0; +pub const METHOD_IN_DIRECT: DWORD = 1; +pub const METHOD_OUT_DIRECT: DWORD = 2; +pub const METHOD_NEITHER: DWORD = 3; +//253 +pub const FILE_ANY_ACCESS: DWORD = 0; +pub const FILE_SPECIAL_ACCESS: DWORD = FILE_ANY_ACCESS; +pub const FILE_READ_ACCESS: DWORD = 0x0001; +pub const FILE_WRITE_ACCESS: DWORD = 0x0002; +//281 +pub const IOCTL_STORAGE_BASE: DWORD = FILE_DEVICE_MASS_STORAGE; +pub const IOCTL_STORAGE_CHECK_VERIFY: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0200, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_CHECK_VERIFY2: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0200, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_MEDIA_REMOVAL: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0201, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_EJECT_MEDIA: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0202, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_LOAD_MEDIA: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0203, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_LOAD_MEDIA2: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0203, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_RESERVE: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_STORAGE_RELEASE: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_STORAGE_FIND_NEW_DEVICES: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0206, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_EJECTION_CONTROL: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0250, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_MCN_CONTROL: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0251, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_MEDIA_TYPES: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0300, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_MEDIA_TYPES_EX: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0301, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0304, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_HOTPLUG_INFO: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0305, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_SET_HOTPLUG_INFO: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0306, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_RESET_BUS: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_STORAGE_RESET_DEVICE: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0401, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_BREAK_RESERVATION: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0405, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_PERSISTENT_RESERVE_IN: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0406, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_PERSISTENT_RESERVE_OUT: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0407, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_GET_DEVICE_NUMBER: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0420, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_PREDICT_FAILURE: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0440, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_FAILURE_PREDICTION_CONFIG: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0441, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_READ_CAPACITY: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0450, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_GET_DEVICE_TELEMETRY: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0470, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_DEVICE_TELEMETRY_NOTIFY: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0471, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_DEVICE_TELEMETRY_QUERY_CAPS: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, + 0x0472, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_GET_DEVICE_TELEMETRY_RAW: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0473, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_QUERY_PROPERTY: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0500, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0501, + METHOD_BUFFERED, FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_GET_LB_PROVISIONING_MAP_RESOURCES: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, + 0x0502, METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_GET_BC_PROPERTIES: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0600, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_STORAGE_ALLOCATE_BC_STREAM: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0601, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_FREE_BC_STREAM: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0602, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, + 0x0620, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_START_DATA_INTEGRITY_CHECK: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0621, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_STOP_DATA_INTEGRITY_CHECK: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0622, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const OBSOLETE_IOCTL_STORAGE_RESET_BUS: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0400, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const OBSOLETE_IOCTL_STORAGE_RESET_DEVICE: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0401, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_STORAGE_ENABLE_IDLE_POWER: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0720, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_GET_IDLE_POWERUP_REASON: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0721, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_POWER_ACTIVE: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0722, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_POWER_IDLE: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0723, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_STORAGE_EVENT_NOTIFICATION: DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0724, + METHOD_BUFFERED, FILE_ANY_ACCESS); +//2627 +pub const IOCTL_DISK_BASE: DWORD = FILE_DEVICE_DISK; +pub const IOCTL_DISK_GET_DRIVE_GEOMETRY: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0000, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_GET_PARTITION_INFO: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0001, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_SET_PARTITION_INFO: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0002, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_DRIVE_LAYOUT: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0003, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_SET_DRIVE_LAYOUT: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0004, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_VERIFY: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_FORMAT_TRACKS: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_REASSIGN_BLOCKS: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_PERFORMANCE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_IS_WRITABLE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_LOGGING: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_FORMAT_TRACKS_EX: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000b, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_HISTOGRAM_STRUCTURE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000c, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_HISTOGRAM_DATA: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_HISTOGRAM_RESET: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_REQUEST_STRUCTURE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000f, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_REQUEST_DATA: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_PERFORMANCE_OFF: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_CONTROLLER_NUMBER: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0011, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const SMART_GET_VERSION: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const SMART_SEND_DRIVE_COMMAND: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const SMART_RCV_DRIVE_DATA: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_PARTITION_INFO_EX: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0012, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_SET_PARTITION_INFO_EX: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0013, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_DRIVE_LAYOUT_EX: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0014, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_SET_DRIVE_LAYOUT_EX: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0015, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_CREATE_DISK: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0016, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_LENGTH_INFO: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0028, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_REASSIGN_BLOCKS_EX: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0029, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_UPDATE_DRIVE_SIZE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0032, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GROW_PARTITION: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0034, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_CACHE_INFORMATION: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0035, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_SET_CACHE_INFORMATION: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0036, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_GET_WRITE_CACHE_STATE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0037, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const OBSOLETE_DISK_GET_WRITE_CACHE_STATE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0037, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_DELETE_DRIVE_LAYOUT: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0040, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_UPDATE_PROPERTIES: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0050, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_FORMAT_DRIVE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x00f3, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_SENSE_DEVICE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x00f8, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_CHECK_VERIFY: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_MEDIA_REMOVAL: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_EJECT_MEDIA: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_LOAD_MEDIA: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_RESERVE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_RELEASE: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const IOCTL_DISK_FIND_NEW_DEVICES: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0206, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_DISK_GET_MEDIA_TYPES: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_DISK_GET_DISK_ATTRIBUTES: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x003c, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_DISK_SET_DISK_ATTRIBUTES: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x003d, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_DISK_RESET_SNAPSHOT_INFO: DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0084, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +//2879 +ENUM!{enum MEDIA_TYPE { + Unknown, + F5_1Pt2_512, + F3_1Pt44_512, + F3_2Pt88_512, + F3_20Pt8_512, + F3_720_512, + F5_360_512, + F5_320_512, + F5_320_1024, + F5_180_512, + F5_160_512, + RemovableMedia, + FixedMedia, + F3_120M_512, + F3_640_512, + F5_640_512, + F5_720_512, + F3_1Pt2_512, + F3_1Pt23_1024, + F5_1Pt23_1024, + F3_128Mb_512, + F3_230Mb_512, + F8_256_128, + F3_200Mb_512, + F3_240M_512, + F3_32M_512, +}} +pub type PMEDIA_TYPE = *mut MEDIA_TYPE; +//2953 +STRUCT!{struct DISK_GEOMETRY { + Cylinders: LARGE_INTEGER, + MediaType: MEDIA_TYPE, + TracksPerCylinder: DWORD, + SectorsPerTrack: DWORD, + BytesPerSector: DWORD, +}} +pub type PDISK_GEOMETRY = *mut DISK_GEOMETRY; +//3907 +pub const IOCTL_CHANGER_BASE: DWORD = FILE_DEVICE_CHANGER; +pub const IOCTL_CHANGER_GET_PARAMETERS: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0000, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_GET_STATUS: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0001, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_GET_PRODUCT_DATA: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0002, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_SET_ACCESS: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0004, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_CHANGER_GET_ELEMENT_STATUS: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0005, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0006, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_SET_POSITION: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0007, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_EXCHANGE_MEDIUM: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0008, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_MOVE_MEDIUM: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0009, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_REINITIALIZE_TRANSPORT: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x000A, + METHOD_BUFFERED, FILE_READ_ACCESS); +pub const IOCTL_CHANGER_QUERY_VOLUME_TAGS: DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x000B, + METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_SERIAL_LSRMST_INSERT: DWORD = CTL_CODE!(FILE_DEVICE_SERIAL_PORT, 31, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_EXPOSE_HARDWARE: DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 128, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_REMOVE_HARDWARE: DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 129, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_PORT_DESC: DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 130, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SERENUM_GET_PORT_NAME: DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 131, + METHOD_BUFFERED, FILE_ANY_ACCESS); +//4690 +pub const FSCTL_REQUEST_OPLOCK_LEVEL_1: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 0, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_OPLOCK_LEVEL_2: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 1, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_BATCH_OPLOCK: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 2, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OPLOCK_BREAK_ACKNOWLEDGE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 3, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OPBATCH_ACK_CLOSE_PENDING: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 4, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OPLOCK_BREAK_NOTIFY: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 5, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_LOCK_VOLUME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_UNLOCK_VOLUME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_DISMOUNT_VOLUME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_IS_VOLUME_MOUNTED: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 10, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_IS_PATHNAME_VALID: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 11, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_MARK_VOLUME_DIRTY: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 12, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_RETRIEVAL_POINTERS: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 14, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_GET_COMPRESSION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SET_COMPRESSION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, + FILE_READ_DATA | FILE_WRITE_DATA); +pub const FSCTL_SET_BOOTLOADER_ACCESSED: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 19, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_MARK_AS_SYSTEM_HIVE: DWORD = FSCTL_SET_BOOTLOADER_ACCESSED; +pub const FSCTL_OPLOCK_BREAK_ACK_NO_2: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 20, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_INVALIDATE_VOLUMES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 21, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_FAT_BPB: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_FILTER_OPLOCK: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 23, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_FILESYSTEM_GET_STATISTICS: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 24, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_NTFS_VOLUME_DATA: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 25, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_NTFS_FILE_RECORD: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 26, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_VOLUME_BITMAP: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_GET_RETRIEVAL_POINTERS: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 28, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_MOVE_FILE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_IS_VOLUME_DIRTY: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_ALLOW_EXTENDED_DASD_IO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 32, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_FIND_FILES_BY_SID: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SET_OBJECT_ID: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_GET_OBJECT_ID: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_DELETE_OBJECT_ID: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_REPARSE_POINT: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 41, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_GET_REPARSE_POINT: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 42, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DELETE_REPARSE_POINT: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 43, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_ENUM_USN_DATA: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 44, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_SECURITY_ID_CHECK: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, + FILE_READ_DATA); +pub const FSCTL_READ_USN_JOURNAL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SET_OBJECT_ID_EXTENDED: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 47, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_CREATE_OR_GET_OBJECT_ID: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 48, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_SPARSE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_ZERO_DATA: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_QUERY_ALLOCATED_RANGES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 51, + METHOD_NEITHER, FILE_READ_DATA); +pub const FSCTL_ENABLE_UPGRADE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_SET_ENCRYPTION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_ENCRYPTION_FSCTL_IO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 54, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_WRITE_RAW_ENCRYPTED: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 55, + METHOD_NEITHER, FILE_SPECIAL_ACCESS); +pub const FSCTL_READ_RAW_ENCRYPTED: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 56, + METHOD_NEITHER, FILE_SPECIAL_ACCESS); +pub const FSCTL_CREATE_USN_JOURNAL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 57, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_READ_FILE_USN_DATA: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 58, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_WRITE_USN_CLOSE_RECORD: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 59, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_EXTEND_VOLUME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_QUERY_USN_JOURNAL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 61, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DELETE_USN_JOURNAL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 62, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_MARK_HANDLE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SIS_COPYFILE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SIS_LINK_FILES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, + FILE_READ_DATA | FILE_WRITE_DATA); +pub const FSCTL_RECALL_FILE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_READ_FROM_PLEX: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, + FILE_READ_DATA); +pub const FSCTL_FILE_PREFETCH: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_MAKE_MEDIA_COMPATIBLE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 76, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_SET_DEFECT_MANAGEMENT: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 77, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_QUERY_SPARING_INFO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 78, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_ON_DISK_VOLUME_INFO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 79, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_VOLUME_COMPRESSION_STATE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 80, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_TXFS_MODIFY_RM: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 81, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_TXFS_QUERY_RM_INFORMATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 82, + METHOD_BUFFERED, FILE_READ_DATA); +pub const FSCTL_TXFS_ROLLFORWARD_REDO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 84, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_TXFS_ROLLFORWARD_UNDO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 85, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_TXFS_START_RM: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 86, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_TXFS_SHUTDOWN_RM: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_TXFS_READ_BACKUP_INFORMATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 88, + METHOD_BUFFERED, FILE_READ_DATA); +pub const FSCTL_TXFS_WRITE_BACKUP_INFORMATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 89, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_TXFS_CREATE_SECONDARY_RM: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 90, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_TXFS_GET_METADATA_INFO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 91, + METHOD_BUFFERED, FILE_READ_DATA); +pub const FSCTL_TXFS_GET_TRANSACTED_VERSION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 92, + METHOD_BUFFERED, FILE_READ_DATA); +pub const FSCTL_TXFS_SAVEPOINT_INFORMATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 94, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_TXFS_CREATE_MINIVERSION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 95, + METHOD_BUFFERED, FILE_WRITE_DATA); +pub const FSCTL_TXFS_TRANSACTION_ACTIVE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 99, + METHOD_BUFFERED, FILE_READ_DATA); +pub const FSCTL_SET_ZERO_ON_DEALLOCATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 101, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_REPAIR: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_GET_REPAIR: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_WAIT_FOR_REPAIR: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_INITIATE_REPAIR: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSC_INTERNAL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SHRINK_VOLUME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, + FILE_SPECIAL_ACCESS); +pub const FSCTL_SET_SHORT_NAME_BEHAVIOR: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 109, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DFSR_SET_GHOST_HANDLE_STATE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 110, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, + 120, METHOD_BUFFERED, FILE_READ_DATA); +pub const FSCTL_TXFS_LIST_TRANSACTIONS: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 121, + METHOD_BUFFERED, FILE_READ_DATA); +pub const FSCTL_QUERY_PAGEFILE_ENCRYPTION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 122, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_RESET_VOLUME_ALLOCATION_HINTS: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 123, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_DEPENDENT_VOLUME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 124, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SD_GLOBAL_CHANGE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 125, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_TXFS_READ_BACKUP_INFORMATION2: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 126, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_LOOKUP_STREAM_FROM_CLUSTER: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 127, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_TXFS_WRITE_BACKUP_INFORMATION2: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 128, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_FILE_TYPE_NOTIFICATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 129, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_FILE_LEVEL_TRIM: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 130, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_GET_BOOT_AREA_INFO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 140, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_RETRIEVAL_POINTER_BASE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 141, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_PERSISTENT_VOLUME_STATE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 142, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_PERSISTENT_VOLUME_STATE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 143, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_REQUEST_OPLOCK: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 144, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSV_TUNNEL_REQUEST: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 145, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_IS_CSV_FILE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_QUERY_FILE_SYSTEM_RECOGNITION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 147, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_GET_VOLUME_PATH_NAME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 148, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT: DWORD = CTL_CODE!( + FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME: DWORD = CTL_CODE!( + FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_IS_FILE_ON_CSV_VOLUME: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 151, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CORRUPTION_HANDLING: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 152, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_OFFLOAD_READ: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 153, METHOD_BUFFERED, + FILE_READ_ACCESS); +pub const FSCTL_OFFLOAD_WRITE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 154, METHOD_BUFFERED, + FILE_WRITE_ACCESS); +pub const FSCTL_CSV_INTERNAL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 155, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_SET_PURGE_FAILURE_MODE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 156, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_FILE_LAYOUT: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 157, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_IS_VOLUME_OWNED_BYCSVFS: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 158, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_GET_INTEGRITY_INFORMATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 159, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_INTEGRITY_INFORMATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 160, + METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA); +pub const FSCTL_QUERY_FILE_REGIONS: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 161, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DEDUP_FILE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 165, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_DEDUP_QUERY_FILE_HASHES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 166, + METHOD_NEITHER, FILE_READ_DATA); +pub const FSCTL_DEDUP_QUERY_RANGE_STATE: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 167, + METHOD_NEITHER, FILE_READ_DATA); +pub const FSCTL_DEDUP_QUERY_REPARSE_INFO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 168, + METHOD_NEITHER, FILE_ANY_ACCESS); +pub const FSCTL_RKF_INTERNAL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 171, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_SCRUB_DATA: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 172, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_REPAIR_COPIES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 173, METHOD_BUFFERED, + FILE_READ_DATA | FILE_WRITE_DATA); +pub const FSCTL_DISABLE_LOCAL_BUFFERING: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 174, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_MGMT_LOCK: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 175, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS: DWORD = CTL_CODE!( + FILE_DEVICE_FILE_SYSTEM, 176, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_ADVANCE_FILE_ID: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 177, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_CSV_SYNC_TUNNEL_REQUEST: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 178, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_QUERY_VETO_FILE_DIRECT_IO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 179, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_WRITE_USN_REASON: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 180, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_CONTROL: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 181, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const FSCTL_GET_REFS_VOLUME_DATA: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 182, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_CSV_H_BREAKING_SYNC_TUNNEL_REQUEST: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, + 185, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_STORAGE_CLASSES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 187, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_REGION_INFO: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 188, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_USN_TRACK_MODIFIED_RANGES: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 189, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, + 192, METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SVHDX_SYNC_TUNNEL_REQUEST: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 193, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SVHDX_SET_INITIATOR_INFORMATION: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 194, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_SET_EXTERNAL_BACKING: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 195, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_GET_EXTERNAL_BACKING: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 196, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_DELETE_EXTERNAL_BACKING: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 197, + METHOD_BUFFERED, FILE_SPECIAL_ACCESS); +pub const FSCTL_ENUM_EXTERNAL_BACKING: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 198, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const FSCTL_ENUM_OVERLAY: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 199, METHOD_NEITHER, + FILE_ANY_ACCESS); +pub const FSCTL_ADD_OVERLAY: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 204, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_REMOVE_OVERLAY: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 205, METHOD_BUFFERED, + FILE_WRITE_DATA); +pub const FSCTL_UPDATE_OVERLAY: DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 206, METHOD_BUFFERED, + FILE_WRITE_DATA); +// FILE_DEVICE_AVIO is defined nowhere +//pub const IOCTL_AVIO_ALLOCATE_STREAM: DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 1, METHOD_BUFFERED, +// FILE_SPECIAL_ACCESS); +//pub const IOCTL_AVIO_FREE_STREAM: DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 2, METHOD_BUFFERED, +// FILE_SPECIAL_ACCESS); +//pub const IOCTL_AVIO_MODIFY_STREAM: DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 3, METHOD_BUFFERED, +// FILE_SPECIAL_ACCESS); +STRUCT!{struct PATHNAME_BUFFER { + PathNameLength: DWORD, + Name: [WCHAR; 1], +}} +pub type PPATHNAME_BUFFER = *mut PATHNAME_BUFFER; +STRUCT!{struct FSCTL_QUERY_FAT_BPB_BUFFER { + First0x24BytesOfBootSector: [BYTE; 0x24], +}} +pub type PFSCTL_QUERY_FAT_BPB_BUFFER = *mut FSCTL_QUERY_FAT_BPB_BUFFER; +STRUCT!{struct NTFS_VOLUME_DATA_BUFFER { + VolumeSerialNumber: LARGE_INTEGER, + NumberSectors: LARGE_INTEGER, + TotalClusters: LARGE_INTEGER, + FreeClusters: LARGE_INTEGER, + TotalReserved: LARGE_INTEGER, + BytesPerSector: DWORD, + BytesPerCluster: DWORD, + BytesPerFileRecordSegment: DWORD, + ClustersPerFileRecordSegment: DWORD, + MftValidDataLength: LARGE_INTEGER, + MftStartLcn: LARGE_INTEGER, + Mft2StartLcn: LARGE_INTEGER, + MftZoneStart: LARGE_INTEGER, + MftZoneEnd: LARGE_INTEGER, +}} +pub type PNTFS_VOLUME_DATA_BUFFER = *mut NTFS_VOLUME_DATA_BUFFER; +STRUCT!{struct NTFS_EXTENDED_VOLUME_DATA { + ByteCount: DWORD, + MajorVersion: WORD, + MinorVersion: WORD, + BytesPerPhysicalSector: DWORD, + LfsMajorVersion: WORD, + LfsMinorVersion: WORD, +}} +pub type PNTFS_EXTENDED_VOLUME_DATA = *mut NTFS_EXTENDED_VOLUME_DATA; +STRUCT!{struct REFS_VOLUME_DATA_BUFFER { + ByteCount: DWORD, + MajorVersion: DWORD, + MinorVersion: DWORD, + BytesPerPhysicalSector: DWORD, + VolumeSerialNumber: LARGE_INTEGER, + NumberSectors: LARGE_INTEGER, + TotalClusters: LARGE_INTEGER, + FreeClusters: LARGE_INTEGER, + TotalReserved: LARGE_INTEGER, + BytesPerSector: DWORD, + BytesPerCluster: DWORD, + MaximumSizeOfResidentFile: LARGE_INTEGER, + Reserved: [LARGE_INTEGER; 10], +}} +pub type PREFS_VOLUME_DATA_BUFFER = *mut REFS_VOLUME_DATA_BUFFER; +STRUCT!{struct STARTING_LCN_INPUT_BUFFER { + StartingLcn: LARGE_INTEGER, +}} +pub type PSTARTING_LCN_INPUT_BUFFER = *mut STARTING_LCN_INPUT_BUFFER; +STRUCT!{struct VOLUME_BITMAP_BUFFER { + StartingLcn: LARGE_INTEGER, + BitmapSize: LARGE_INTEGER, + Buffer: [BYTE; 1], +}} +pub type PVOLUME_BITMAP_BUFFER = *mut VOLUME_BITMAP_BUFFER; +STRUCT!{struct STARTING_VCN_INPUT_BUFFER { + StartingVcn: LARGE_INTEGER, +}} +pub type PSTARTING_VCN_INPUT_BUFFER = *mut STARTING_VCN_INPUT_BUFFER; +STRUCT!{struct RETRIEVAL_POINTERS_BUFFER_INTERNAL { + NextVcn: LARGE_INTEGER, + Lcn: LARGE_INTEGER, +}} +STRUCT!{struct RETRIEVAL_POINTERS_BUFFER { + ExtentCount: DWORD, + StartingVcn: LARGE_INTEGER, + Extents: [RETRIEVAL_POINTERS_BUFFER_INTERNAL; 1], +}} +pub type PRETRIEVAL_POINTERS_BUFFER = *mut RETRIEVAL_POINTERS_BUFFER; +STRUCT!{struct NTFS_FILE_RECORD_INPUT_BUFFER { + FileReferenceNumber: LARGE_INTEGER, +}} +pub type PNTFS_FILE_RECORD_INPUT_BUFFER = *mut NTFS_FILE_RECORD_INPUT_BUFFER; +STRUCT!{struct NTFS_FILE_RECORD_OUTPUT_BUFFER { + FileReferenceNumber: LARGE_INTEGER, + FileRecordLength: DWORD, + FileRecordBuffer: [BYTE; 1], +}} +pub type PNTFS_FILE_RECORD_OUTPUT_BUFFER = *mut NTFS_FILE_RECORD_OUTPUT_BUFFER; +STRUCT!{struct MOVE_FILE_DATA { + FileHandle: HANDLE, + StartingVcn: LARGE_INTEGER, + StartingLcn: LARGE_INTEGER, + ClusterCount: DWORD, +}} +pub type PMOVE_FILE_DATA = *mut MOVE_FILE_DATA; +STRUCT!{struct MOVE_FILE_RECORD_DATA { + FileHandle: HANDLE, + SourceFileRecord: LARGE_INTEGER, + TargetFileRecord: LARGE_INTEGER, +}} +pub type PMOVE_FILE_RECORD_DATA = *mut MOVE_FILE_RECORD_DATA; +//9207 +pub const IOCTL_VOLUME_BASE: DWORD = 0x00000056; +pub const IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 0, + METHOD_BUFFERED, FILE_ANY_ACCESS); +STRUCT!{struct DISK_EXTENT { + DiskNumber: DWORD, + StartingOffset: LARGE_INTEGER, + ExtentLength: LARGE_INTEGER, +}} +pub type PDISK_EXTENT = *mut DISK_EXTENT; +STRUCT!{struct VOLUME_DISK_EXTENTS { + NumberOfDiskExtents: DWORD, + Extents: [DISK_EXTENT; ANYSIZE_ARRAY], +}} +pub type PVOLUME_DISK_EXTENTS = *mut VOLUME_DISK_EXTENTS; +pub const IOCTL_VOLUME_ONLINE: DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_VOLUME_OFFLINE: DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, + FILE_READ_ACCESS | FILE_WRITE_ACCESS); +pub const IOCTL_VOLUME_IS_CLUSTERED: DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_VOLUME_GET_GPT_ATTRIBUTES: DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 14, + METHOD_BUFFERED, FILE_ANY_ACCESS); diff --git a/src/vendor/winapi/src/um/winnetwk.rs b/src/vendor/winapi/src/um/winnetwk.rs new file mode 100644 index 0000000000..a0a6045ac2 --- /dev/null +++ b/src/vendor/winapi/src/um/winnetwk.rs @@ -0,0 +1,447 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Standard WINNET Header File for WIN32 +use shared::basetsd::ULONG_PTR; +use shared::minwindef::{BOOL, DWORD, LPDWORD, LPHANDLE, LPVOID, WORD}; +use shared::windef::HWND; +use shared::winerror::{ + ERROR_ACCESS_DENIED, ERROR_ALREADY_ASSIGNED, ERROR_ALREADY_INITIALIZED, ERROR_BAD_DEVICE, + ERROR_BAD_DEV_TYPE, ERROR_BAD_NET_NAME, ERROR_BAD_PROFILE, ERROR_BAD_PROVIDER, + ERROR_BAD_USERNAME, ERROR_BUSY, ERROR_CANCELLED, ERROR_CANNOT_OPEN_PROFILE, + ERROR_CONNECTED_OTHER_PASSWORD, ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT, + ERROR_CONNECTION_UNAVAIL, ERROR_DEVICE_ALREADY_REMEMBERED, ERROR_DEVICE_IN_USE, + ERROR_EXTENDED_ERROR, ERROR_GEN_FAILURE, ERROR_INVALID_ADDRESS, ERROR_INVALID_HANDLE, + ERROR_INVALID_LEVEL, ERROR_INVALID_PARAMETER, ERROR_INVALID_PASSWORD, ERROR_MORE_DATA, + ERROR_NOT_AUTHENTICATED, ERROR_NOT_CONNECTED, ERROR_NOT_CONTAINER, ERROR_NOT_ENOUGH_MEMORY, + ERROR_NOT_LOGGED_ON, ERROR_NOT_SUPPORTED, ERROR_NO_LOGON_SERVERS, ERROR_NO_MORE_DEVICES, + ERROR_NO_MORE_ITEMS, ERROR_NO_NETWORK, ERROR_NO_NET_OR_BAD_PATH, ERROR_OPEN_FILES, ERROR_RETRY, + ERROR_UNEXP_NET_ERR, NO_ERROR +}; +use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR}; +pub const RESOURCE_CONNECTED: DWORD = 0x00000001; +pub const RESOURCE_GLOBALNET: DWORD = 0x00000002; +pub const RESOURCE_REMEMBERED: DWORD = 0x00000003; +pub const RESOURCE_RECENT: DWORD = 0x00000004; +pub const RESOURCE_CONTEXT: DWORD = 0x00000005; +pub const RESOURCETYPE_ANY: DWORD = 0x00000000; +pub const RESOURCETYPE_DISK: DWORD = 0x00000001; +pub const RESOURCETYPE_PRINT: DWORD = 0x00000002; +pub const RESOURCETYPE_RESERVED: DWORD = 0x00000008; +pub const RESOURCETYPE_UNKNOWN: DWORD = 0xFFFFFFFF; +pub const RESOURCEUSAGE_CONNECTABLE: DWORD = 0x00000001; +pub const RESOURCEUSAGE_CONTAINER: DWORD = 0x00000002; +pub const RESOURCEUSAGE_NOLOCALDEVICE: DWORD = 0x00000004; +pub const RESOURCEUSAGE_SIBLING: DWORD = 0x00000008; +pub const RESOURCEUSAGE_ATTACHED: DWORD = 0x00000010; +pub const RESOURCEUSAGE_ALL: DWORD = RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER + | RESOURCEUSAGE_ATTACHED; +pub const RESOURCEUSAGE_RESERVED: DWORD = 0x80000000; +pub const RESOURCEDISPLAYTYPE_GENERIC: DWORD = 0x00000000; +pub const RESOURCEDISPLAYTYPE_DOMAIN: DWORD = 0x00000001; +pub const RESOURCEDISPLAYTYPE_SERVER: DWORD = 0x00000002; +pub const RESOURCEDISPLAYTYPE_SHARE: DWORD = 0x00000003; +pub const RESOURCEDISPLAYTYPE_FILE: DWORD = 0x00000004; +pub const RESOURCEDISPLAYTYPE_GROUP: DWORD = 0x00000005; +pub const RESOURCEDISPLAYTYPE_NETWORK: DWORD = 0x00000006; +pub const RESOURCEDISPLAYTYPE_ROOT: DWORD = 0x00000007; +pub const RESOURCEDISPLAYTYPE_SHAREADMIN: DWORD = 0x00000008; +pub const RESOURCEDISPLAYTYPE_DIRECTORY: DWORD = 0x00000009; +pub const RESOURCEDISPLAYTYPE_TREE: DWORD = 0x0000000A; +pub const RESOURCEDISPLAYTYPE_NDSCONTAINER: DWORD = 0x0000000B; +STRUCT!{struct NETRESOURCEA { + dwScope: DWORD, + dwType: DWORD, + dwDisplayType: DWORD, + dwUsage: DWORD, + lpLocalName: LPSTR, + lpRemoteName: LPSTR, + lpComment: LPSTR, + lpProvider: LPSTR, +}} +pub type LPNETRESOURCEA = *mut NETRESOURCEA; +STRUCT!{struct NETRESOURCEW { + dwScope: DWORD, + dwType: DWORD, + dwDisplayType: DWORD, + dwUsage: DWORD, + lpLocalName: LPWSTR, + lpRemoteName: LPWSTR, + lpComment: LPWSTR, + lpProvider: LPWSTR, +}} +pub type LPNETRESOURCEW = *mut NETRESOURCEW; +pub const NETPROPERTY_PERSISTENT: DWORD = 1; +pub const CONNECT_UPDATE_PROFILE: DWORD = 0x00000001; +pub const CONNECT_UPDATE_RECENT: DWORD = 0x00000002; +pub const CONNECT_TEMPORARY: DWORD = 0x00000004; +pub const CONNECT_INTERACTIVE: DWORD = 0x00000008; +pub const CONNECT_PROMPT: DWORD = 0x00000010; +pub const CONNECT_NEED_DRIVE: DWORD = 0x00000020; +pub const CONNECT_REFCOUNT: DWORD = 0x00000040; +pub const CONNECT_REDIRECT: DWORD = 0x00000080; +pub const CONNECT_LOCALDRIVE: DWORD = 0x00000100; +pub const CONNECT_CURRENT_MEDIA: DWORD = 0x00000200; +pub const CONNECT_DEFERRED: DWORD = 0x00000400; +pub const CONNECT_RESERVED: DWORD = 0xFF000000; +pub const CONNECT_COMMANDLINE: DWORD = 0x00000800; +pub const CONNECT_CMD_SAVECRED: DWORD = 0x00001000; +pub const CONNECT_CRED_RESET: DWORD = 0x00002000; +extern "system" { + pub fn WNetAddConnection2A( + lpNetResource: LPNETRESOURCEA, + lpPassword: LPCSTR, + lpUsername: LPCSTR, + dwFlags: DWORD, + ) -> DWORD; + pub fn WNetAddConnection2W( + lpNetResource: LPNETRESOURCEW, + lpPassword: LPCWSTR, + lpUsername: LPCWSTR, + dwFlags: DWORD, + ) -> DWORD; + pub fn WNetAddConnection3A( + hwndOwner: HWND, + lpNetResource: LPNETRESOURCEA, + lpPassword: LPCSTR, + lpUsername: LPCSTR, + dwFlags: DWORD, + ) -> DWORD; + pub fn WNetAddConnection3W( + hwndOwner: HWND, + lpNetResource: LPNETRESOURCEW, + lpPassword: LPCWSTR, + lpUsername: LPCWSTR, + dwFlags: DWORD, + ) -> DWORD; + pub fn WNetCancelConnectionA( + lpName: LPCSTR, + fForce: BOOL, + ) -> DWORD; + pub fn WNetCancelConnectionW( + lpName: LPCWSTR, + fForce: BOOL, + ) -> DWORD; + pub fn WNetCancelConnection2A( + lpName: LPCSTR, + dwFlags: DWORD, + fForce: BOOL, + ) -> DWORD; + pub fn WNetCancelConnection2W( + lpName: LPCWSTR, + dwFlags: DWORD, + fForce: BOOL, + ) -> DWORD; + pub fn WNetGetConnectionA( + lpLocalName: LPCSTR, + lpRemoteName: LPSTR, + lpnLength: LPDWORD, + ) -> DWORD; + pub fn WNetGetConnectionW( + lpLocalName: LPCWSTR, + lpRemoteName: LPWSTR, + lpnLength: LPDWORD, + ) -> DWORD; + pub fn WNetUseConnectionA( + hwndOwner: HWND, + lpNetResource: LPNETRESOURCEA, + lpPassword: LPCSTR, + lpUserId: LPCSTR, + dwFlags: DWORD, + lpAccessName: LPSTR, + lpBufferSize: LPDWORD, + lpResult: LPDWORD, + ) -> DWORD; + pub fn WNetUseConnectionW( + hwndOwner: HWND, + lpNetResource: LPNETRESOURCEW, + lpPassword: LPCWSTR, + lpUserId: LPCWSTR, + dwFlags: DWORD, + lpAccessName: LPWSTR, + lpBufferSize: LPDWORD, + lpResult: LPDWORD, + ) -> DWORD; + pub fn WNetConnectionDialog( + hwnd: HWND, + dwType: DWORD, + ) -> DWORD; + pub fn WNetDisconnectDialog( + hwnd: HWND, + dwType: DWORD, + ) -> DWORD; +} +STRUCT!{struct CONNECTDLGSTRUCTA { + cbStructure: DWORD, + hwndOwner: HWND, + lpConnRes: LPNETRESOURCEA, + dwFlags: DWORD, + dwDevNum: DWORD, +}} +pub type LPCONNECTDLGSTRUCTA = *mut CONNECTDLGSTRUCTA; +STRUCT!{struct CONNECTDLGSTRUCTW { + cbStructure: DWORD, + hwndOwner: HWND, + lpConnRes: LPNETRESOURCEW, + dwFlags: DWORD, + dwDevNum: DWORD, +}} +pub type LPCONNECTDLGSTRUCTW = *mut CONNECTDLGSTRUCTW; +pub const CONNDLG_RO_PATH: DWORD = 0x00000001; +pub const CONNDLG_CONN_POINT: DWORD = 0x00000002; +pub const CONNDLG_USE_MRU: DWORD = 0x00000004; +pub const CONNDLG_HIDE_BOX: DWORD = 0x00000008; +pub const CONNDLG_PERSIST: DWORD = 0x00000010; +pub const CONNDLG_NOT_PERSIST: DWORD = 0x00000020; +extern "system" { + pub fn WNetConnectionDialog1A( + lpConnDlgStruct: LPCONNECTDLGSTRUCTA, + ) -> DWORD; + pub fn WNetConnectionDialog1W( + lpConnDlgStruct: LPCONNECTDLGSTRUCTW, + ) -> DWORD; +} +STRUCT!{struct DISCDLGSTRUCTA { + cbStructure: DWORD, + hwndOwner: HWND, + lpLocalName: LPSTR, + lpRemoteName: LPSTR, + dwFlags: DWORD, +}} +pub type LPDISCDLGSTRUCTA = *mut DISCDLGSTRUCTA; +STRUCT!{struct DISCDLGSTRUCTW { + cbStructure: DWORD, + hwndOwner: HWND, + lpLocalName: LPWSTR, + lpRemoteName: LPWSTR, + dwFlags: DWORD, +}} +pub type LPDISCDLGSTRUCTW = *mut DISCDLGSTRUCTW; +pub const DISC_UPDATE_PROFILE: DWORD = 0x00000001; +pub const DISC_NO_FORCE: DWORD = 0x00000040; +extern "system" { + pub fn WNetDisconnectDialog1A( + lpConnDlgStruct: LPDISCDLGSTRUCTA, + ) -> DWORD; + pub fn WNetDisconnectDialog1W( + lpConnDlgStruct: LPDISCDLGSTRUCTW, + ) -> DWORD; + pub fn WNetOpenEnumA( + dwScope: DWORD, + dwType: DWORD, + dwUsage: DWORD, + lpNetResource: LPNETRESOURCEA, + lphEnum: LPHANDLE, + ) -> DWORD; + pub fn WNetOpenEnumW( + dwScope: DWORD, + dwType: DWORD, + dwUsage: DWORD, + lpNetResource: LPNETRESOURCEW, + lphEnum: LPHANDLE, + ) -> DWORD; + pub fn WNetEnumResourceA( + hEnum: HANDLE, + lpcCount: LPDWORD, + lpBuffer: LPVOID, + lpBufferSize: LPDWORD, + ) -> DWORD; + pub fn WNetEnumResourceW( + hEnum: HANDLE, + lpcCount: LPDWORD, + lpBuffer: LPVOID, + lpBufferSize: LPDWORD, + ) -> DWORD; + pub fn WNetCloseEnum( + hEnum: HANDLE, + ) -> DWORD; + pub fn WNetGetResourceParentA( + lpNetResource: LPNETRESOURCEA, + lpBuffer: LPVOID, + lpcbBuffer: LPDWORD, + ) -> DWORD; + pub fn WNetGetResourceParentW( + lpNetResource: LPNETRESOURCEW, + lpBuffer: LPVOID, + lpcbBuffer: LPDWORD, + ) -> DWORD; + pub fn WNetGetResourceInformationA( + lpNetResource: LPNETRESOURCEA, + lpBuffer: LPVOID, + lpcbBuffer: LPDWORD, + lplpSystem: *mut LPSTR, + ) -> DWORD; + pub fn WNetGetResourceInformationW( + lpNetResource: LPNETRESOURCEW, + lpBuffer: LPVOID, + lpcbBuffer: LPDWORD, + lplpSystem: *mut LPWSTR, + ) -> DWORD; +} +pub const UNIVERSAL_NAME_INFO_LEVEL: DWORD = 0x00000001; +pub const REMOTE_NAME_INFO_LEVEL: DWORD = 0x00000002; +STRUCT!{struct UNIVERSAL_NAME_INFOA { + lpUniversalName: LPSTR, +}} +pub type LPUNIVERSAL_NAME_INFOA = *mut UNIVERSAL_NAME_INFOA; +STRUCT!{struct UNIVERSAL_NAME_INFOW { + lpUniversalName: LPWSTR, +}} +pub type LPUNIVERSAL_NAME_INFOW = *mut UNIVERSAL_NAME_INFOW; +STRUCT!{struct REMOTE_NAME_INFOA { + lpUniversalName: LPSTR, + lpConnectionName: LPSTR, + lpRemainingPath: LPSTR, +}} +pub type LPREMOTE_NAME_INFOA = *mut REMOTE_NAME_INFOA; +STRUCT!{struct REMOTE_NAME_INFOW { + lpUniversalName: LPWSTR, + lpConnectionName: LPWSTR, + lpRemainingPath: LPWSTR, +}} +pub type LPREMOTE_NAME_INFOW = *mut REMOTE_NAME_INFOW; +extern "system" { + pub fn WNetGetUniversalNameA( + lpLocalPath: LPCSTR, + dwInfoLevel: DWORD, + lpBuffer: LPVOID, + lpBufferSize: LPDWORD, + ) -> DWORD; + pub fn WNetGetUniversalNameW( + lpLocalPath: LPCWSTR, + dwInfoLevel: DWORD, + lpBuffer: LPVOID, + lpBufferSize: LPDWORD, + ) -> DWORD; + pub fn WNetGetUserA( + lpName: LPCSTR, + lpUserName: LPSTR, + lpnLength: LPDWORD, + ) -> DWORD; + pub fn WNetGetUserW( + lpName: LPCWSTR, + lpUserName: LPWSTR, + lpnLength: LPDWORD, + ) -> DWORD; +} +pub const WNFMT_MULTILINE: DWORD = 0x01; +pub const WNFMT_ABBREVIATED: DWORD = 0x02; +pub const WNFMT_INENUM: DWORD = 0x10; +pub const WNFMT_CONNECTION: DWORD = 0x20; +extern "system" { + pub fn WNetGetProviderNameA( + dwNetType: DWORD, + lpProviderName: LPSTR, + lpBufferSize: LPDWORD, + ) -> DWORD; + pub fn WNetGetProviderNameW( + dwNetType: DWORD, + lpProviderName: LPWSTR, + lpBufferSize: LPDWORD, + ) -> DWORD; +} +STRUCT!{struct NETINFOSTRUCT { + cbStructure: DWORD, + dwProviderVersion: DWORD, + dwStatus: DWORD, + dwCharacteristics: DWORD, + dwHandle: ULONG_PTR, + wNetType: WORD, + dwPrinters: DWORD, + dwDrives: DWORD, +}} +pub type LPNETINFOSTRUCT = *mut NETINFOSTRUCT; +pub const NETINFO_DLL16: DWORD = 0x00000001; +pub const NETINFO_DISKRED: DWORD = 0x00000004; +pub const NETINFO_PRINTERRED: DWORD = 0x00000008; +extern "system" { + pub fn WNetGetNetworkInformationA( + lpProvider: LPCSTR, + lpNetInfoStruct: LPNETINFOSTRUCT, + ) -> DWORD; + pub fn WNetGetNetworkInformationW( + lpProvider: LPCWSTR, + lpNetInfoStruct: LPNETINFOSTRUCT, + ) -> DWORD; + pub fn WNetGetLastErrorA( + lpError: LPDWORD, + lpErrorBuf: LPSTR, + nErrorBufSize: DWORD, + lpNameBuf: LPSTR, + nNameBufSize: DWORD, + ) -> DWORD; + pub fn WNetGetLastErrorW( + lpError: LPDWORD, + lpErrorBuf: LPWSTR, + nErrorBufSize: DWORD, + lpNameBuf: LPWSTR, + nNameBufSize: DWORD, + ) -> DWORD; +} +pub const WN_SUCCESS: DWORD = NO_ERROR; +pub const WN_NO_ERROR: DWORD = NO_ERROR; +pub const WN_NOT_SUPPORTED: DWORD = ERROR_NOT_SUPPORTED; +pub const WN_CANCEL: DWORD = ERROR_CANCELLED; +pub const WN_RETRY: DWORD = ERROR_RETRY; +pub const WN_NET_ERROR: DWORD = ERROR_UNEXP_NET_ERR; +pub const WN_MORE_DATA: DWORD = ERROR_MORE_DATA; +pub const WN_BAD_POINTER: DWORD = ERROR_INVALID_ADDRESS; +pub const WN_BAD_VALUE: DWORD = ERROR_INVALID_PARAMETER; +pub const WN_BAD_USER: DWORD = ERROR_BAD_USERNAME; +pub const WN_BAD_PASSWORD: DWORD = ERROR_INVALID_PASSWORD; +pub const WN_ACCESS_DENIED: DWORD = ERROR_ACCESS_DENIED; +pub const WN_FUNCTION_BUSY: DWORD = ERROR_BUSY; +pub const WN_WINDOWS_ERROR: DWORD = ERROR_UNEXP_NET_ERR; +pub const WN_OUT_OF_MEMORY: DWORD = ERROR_NOT_ENOUGH_MEMORY; +pub const WN_NO_NETWORK: DWORD = ERROR_NO_NETWORK; +pub const WN_EXTENDED_ERROR: DWORD = ERROR_EXTENDED_ERROR; +pub const WN_BAD_LEVEL: DWORD = ERROR_INVALID_LEVEL; +pub const WN_BAD_HANDLE: DWORD = ERROR_INVALID_HANDLE; +pub const WN_NOT_INITIALIZING: DWORD = ERROR_ALREADY_INITIALIZED; +pub const WN_NO_MORE_DEVICES: DWORD = ERROR_NO_MORE_DEVICES; +pub const WN_NOT_CONNECTED: DWORD = ERROR_NOT_CONNECTED; +pub const WN_OPEN_FILES: DWORD = ERROR_OPEN_FILES; +pub const WN_DEVICE_IN_USE: DWORD = ERROR_DEVICE_IN_USE; +pub const WN_BAD_NETNAME: DWORD = ERROR_BAD_NET_NAME; +pub const WN_BAD_LOCALNAME: DWORD = ERROR_BAD_DEVICE; +pub const WN_ALREADY_CONNECTED: DWORD = ERROR_ALREADY_ASSIGNED; +pub const WN_DEVICE_ERROR: DWORD = ERROR_GEN_FAILURE; +pub const WN_CONNECTION_CLOSED: DWORD = ERROR_CONNECTION_UNAVAIL; +pub const WN_NO_NET_OR_BAD_PATH: DWORD = ERROR_NO_NET_OR_BAD_PATH; +pub const WN_BAD_PROVIDER: DWORD = ERROR_BAD_PROVIDER; +pub const WN_CANNOT_OPEN_PROFILE: DWORD = ERROR_CANNOT_OPEN_PROFILE; +pub const WN_BAD_PROFILE: DWORD = ERROR_BAD_PROFILE; +pub const WN_BAD_DEV_TYPE: DWORD = ERROR_BAD_DEV_TYPE; +pub const WN_DEVICE_ALREADY_REMEMBERED: DWORD = ERROR_DEVICE_ALREADY_REMEMBERED; +pub const WN_CONNECTED_OTHER_PASSWORD: DWORD = ERROR_CONNECTED_OTHER_PASSWORD; +pub const WN_CONNECTED_OTHER_PASSWORD_DEFAULT: DWORD = ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT; +pub const WN_NO_MORE_ENTRIES: DWORD = ERROR_NO_MORE_ITEMS; +pub const WN_NOT_CONTAINER: DWORD = ERROR_NOT_CONTAINER; +pub const WN_NOT_AUTHENTICATED: DWORD = ERROR_NOT_AUTHENTICATED; +pub const WN_NOT_LOGGED_ON: DWORD = ERROR_NOT_LOGGED_ON; +pub const WN_NOT_VALIDATED: DWORD = ERROR_NO_LOGON_SERVERS; +STRUCT!{struct NETCONNECTINFOSTRUCT { + cbStructure: DWORD, + dwFlags: DWORD, + dwSpeed: DWORD, + dwDelay: DWORD, + dwOptDataSize: DWORD, +}} +pub type LPNETCONNECTINFOSTRUCT = *mut NETCONNECTINFOSTRUCT; +pub const WNCON_FORNETCARD: DWORD = 0x00000001; +pub const WNCON_NOTROUTED: DWORD = 0x00000002; +pub const WNCON_SLOWLINK: DWORD = 0x00000004; +pub const WNCON_DYNAMIC: DWORD = 0x00000008; +extern "system" { + pub fn MultinetGetConnectionPerformanceA( + lpNetResource: LPNETRESOURCEA, + lpNetConnectInfoStruct: LPNETCONNECTINFOSTRUCT, + ) -> DWORD; + pub fn MultinetGetConnectionPerformanceW( + lpNetResource: LPNETRESOURCEW, + lpNetConnectInfoStruct: LPNETCONNECTINFOSTRUCT, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/winnls.rs b/src/vendor/winapi/src/um/winnls.rs new file mode 100644 index 0000000000..6f8edfa54f --- /dev/null +++ b/src/vendor/winapi/src/um/winnls.rs @@ -0,0 +1,818 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Procedure declarations, constant definitions, and macros for the NLS component. +use ctypes::c_int; +use shared::basetsd::LONG_PTR; +use shared::guiddef::GUID; +use shared::minwindef::{ + BOOL, BYTE, DWORD, INT, LPARAM, LPDWORD, LPINT, LPVOID, LPWORD, MAX_PATH, PDWORD, PULONG, + UINT, +}; +use um::minwinbase::SYSTEMTIME; +use um::winnt::{ + CHAR, LANGID, LCID, LONG, LPCSTR, LPCWCH, LPCWSTR, LPSTR, LPWSTR, PCNZCH, PCNZWCH, PCWSTR, + PCZZWSTR, PULONGLONG, PWSTR, PZZWSTR, ULONGLONG, WCHAR, +}; +pub const MAX_LEADBYTES: usize = 12; +pub const MAX_DEFAULTCHAR: usize = 2; +pub const MB_PRECOMPOSED: DWORD = 0x00000001; +pub const MB_COMPOSITE: DWORD = 0x00000002; +pub const MB_USEGLYPHCHARS: DWORD = 0x00000004; +pub const MB_ERR_INVALID_CHARS: DWORD = 0x00000008; +pub const WC_COMPOSITECHECK: DWORD = 0x00000200; +pub const WC_DISCARDNS: DWORD = 0x00000010; +pub const WC_SEPCHARS: DWORD = 0x00000020; +pub const WC_DEFAULTCHAR: DWORD = 0x00000040; +pub const WC_ERR_INVALID_CHARS: DWORD = 0x00000080; +pub const WC_NO_BEST_FIT_CHARS: DWORD = 0x00000400; +pub const CP_ACP: DWORD = 0; +pub const CP_OEMCP: DWORD = 1; +pub const CP_MACCP: DWORD = 2; +pub const CP_THREAD_ACP: DWORD = 3; +pub const CP_SYMBOL: DWORD = 42; +pub const CP_UTF7: DWORD = 65000; +pub const CP_UTF8: DWORD = 65001; +pub type LGRPID = DWORD; +pub type LCTYPE = DWORD; +pub type CALTYPE = DWORD; +pub type CALID = DWORD; +STRUCT!{struct CPINFO { + MaxCharSize: UINT, + DefaultChar: [BYTE; MAX_DEFAULTCHAR], + LeadByte: [BYTE; MAX_LEADBYTES], +}} +pub type LPCPINFO = *mut CPINFO; +STRUCT!{struct CPINFOEXA { + MaxCharSize: UINT, + DefaultChar: [BYTE; MAX_DEFAULTCHAR], + LeadByte: [BYTE; MAX_LEADBYTES], + UnicodeDefaultChar: WCHAR, + CodePage: UINT, + CodePageName: [CHAR; MAX_PATH], +}} +pub type LPCPINFOEXA = *mut CPINFOEXA; +STRUCT!{struct CPINFOEXW { + MaxCharSize: UINT, + DefaultChar: [BYTE; MAX_DEFAULTCHAR], + LeadByte: [BYTE; MAX_LEADBYTES], + UnicodeDefaultChar: WCHAR, + CodePage: UINT, + CodePageName: [WCHAR; MAX_PATH], +}} +pub type LPCPINFOEXW = *mut CPINFOEXW; +STRUCT!{struct NUMBERFMTA { + NumDigits: UINT, + LeadingZero: UINT, + Grouping: UINT, + lpDecimalSep: LPSTR, + lpThousandSep: LPSTR, + NegativeOrder: UINT, +}} +pub type LPNUMBERFMTA = *mut NUMBERFMTA; +STRUCT!{struct NUMBERFMTW { + NumDigits: UINT, + LeadingZero: UINT, + Grouping: UINT, + lpDecimalSep: LPWSTR, + lpThousandSep: LPWSTR, + NegativeOrder: UINT, +}} +pub type LPNUMBERFMTW = *mut NUMBERFMTW; +STRUCT!{struct CURRENCYFMTA { + NumDigits: UINT, + LeadingZero: UINT, + Grouping: UINT, + lpDecimalSep: LPSTR, + lpThousandSep: LPSTR, + NegativeOrder: UINT, + PositiveOrder: UINT, + lpCurrencySymbol: LPSTR, +}} +pub type LPCURRENCYFMTA = *mut CURRENCYFMTA; +STRUCT!{struct CURRENCYFMTW { + NumDigits: UINT, + LeadingZero: UINT, + Grouping: UINT, + lpDecimalSep: LPWSTR, + lpThousandSep: LPWSTR, + NegativeOrder: UINT, + PositiveOrder: UINT, + lpCurrencySymbol: LPWSTR, +}} +pub type LPCURRENCYFMTW = *mut CURRENCYFMTW; +pub type NLS_FUNCTION = DWORD; +STRUCT!{struct NLSVERSIONINFO { + dwNLSVersionInfoSize: DWORD, + dwNLSVersion: DWORD, + dwDefinedVersion: DWORD, + dwEffectiveId: DWORD, + guidCustomVersion: GUID, +}} +pub type LPNLSVERSIONINFO = *mut NLSVERSIONINFO; +STRUCT!{struct NLSVERSIONINFOEX { + dwNLSVersionInfoSize: DWORD, + dwNLSVersion: DWORD, + dwDefinedVersion: DWORD, + dwEffectiveId: DWORD, + guidCustomVersion: GUID, +}} +pub type LPNLSVERSIONINFOEX = *mut NLSVERSIONINFOEX; +pub type GEOID = LONG; +pub type GEOTYPE = DWORD; +pub type GEOCLASS = DWORD; +ENUM!{enum NORM_FORM { + NormalizationOther = 0, + NormalizationC = 0x1, + NormalizationD = 0x2, + NormalizationKC = 0x5, + NormalizationKD = 0x6, +}} +FN!{stdcall LANGUAGEGROUP_ENUMPROCA( + LGRPID, + LPSTR, + LPSTR, + DWORD, + LONG_PTR, +) -> BOOL} +FN!{stdcall LANGGROUPLOCALE_ENUMPROCA( + LGRPID, + LCID, + LPSTR, + LONG_PTR, +) -> BOOL} +FN!{stdcall UILANGUAGE_ENUMPROCA( + LPSTR, + LONG_PTR, +) -> BOOL} +FN!{stdcall CODEPAGE_ENUMPROCA( + LPSTR, +) -> BOOL} +FN!{stdcall DATEFMT_ENUMPROCA( + LPSTR, +) -> BOOL} +FN!{stdcall DATEFMT_ENUMPROCEXA( + LPSTR, + CALID, +) -> BOOL} +FN!{stdcall TIMEFMT_ENUMPROCA( + LPSTR, +) -> BOOL} +FN!{stdcall CALINFO_ENUMPROCA( + LPSTR, +) -> BOOL} +FN!{stdcall CALINFO_ENUMPROCEXA( + LPSTR, + CALID, +) -> BOOL} +FN!{stdcall LOCALE_ENUMPROCA( + LPSTR, +) -> BOOL} +FN!{stdcall LOCALE_ENUMPROCW( + LPWSTR, +) -> BOOL} +FN!{stdcall LANGUAGEGROUP_ENUMPROCW( + LGRPID, + LPWSTR, + LPWSTR, + DWORD, + LONG_PTR, +) -> BOOL} +FN!{stdcall LANGGROUPLOCALE_ENUMPROCW( + LGRPID, + LCID, + LPWSTR, + LONG_PTR, +) -> BOOL} +FN!{stdcall UILANGUAGE_ENUMPROCW( + LPWSTR, + LONG_PTR, +) -> BOOL} +FN!{stdcall CODEPAGE_ENUMPROCW( + LPWSTR, +) -> BOOL} +FN!{stdcall DATEFMT_ENUMPROCW( + LPWSTR, +) -> BOOL} +FN!{stdcall DATEFMT_ENUMPROCEXW( + LPWSTR, + CALID, +) -> BOOL} +FN!{stdcall TIMEFMT_ENUMPROCW( + LPWSTR, +) -> BOOL} +FN!{stdcall CALINFO_ENUMPROCW( + LPWSTR, +) -> BOOL} +FN!{stdcall CALINFO_ENUMPROCEXW( + LPWSTR, + CALID, +) -> BOOL} +FN!{stdcall GEO_ENUMPROC( + GEOID, +) -> BOOL} +STRUCT!{struct FILEMUIINFO { + dwSize: DWORD, + dwVersion: DWORD, + dwFileType: DWORD, + pChecksum: [BYTE; 16], + pServiceChecksum: [BYTE; 16], + dwLanguageNameOffset: DWORD, + dwTypeIDMainSize: DWORD, + dwTypeIDMainOffset: DWORD, + dwTypeNameMainOffset: DWORD, + dwTypeIDMUISize: DWORD, + dwTypeIDMUIOffset: DWORD, + dwTypeNameMUIOffset: DWORD, + abBuffer: [BYTE; 8], +}} +pub type PFILEMUIINFO = *mut FILEMUIINFO; +FN!{stdcall CALINFO_ENUMPROCEXEX( + LPWSTR, + CALID, + LPWSTR, + LPARAM, +) -> BOOL} +FN!{stdcall DATEFMT_ENUMPROCEXEX( + LPWSTR, + CALID, + LPARAM, +) -> BOOL} +FN!{stdcall TIMEFMT_ENUMPROCEX( + LPWSTR, + LPARAM, +) -> BOOL} +FN!{stdcall LOCALE_ENUMPROCEX( + LPWSTR, + DWORD, + LPARAM, +) -> BOOL} +extern "system" { + pub fn CompareStringA( + Locale: LCID, + dwCmpFlags: DWORD, + lpString1: PCNZCH, + cchCount1: c_int, + lpString2: PCNZCH, + cchCount2: c_int, + ) -> c_int; + pub fn CompareStringEx( + lpLocaleName: LPCWSTR, + dwCmpFlags: DWORD, + lpString1: LPCWCH, + cchCount1: c_int, + lpString2: LPCWCH, + cchCount2: c_int, + lpVersionInformation: LPNLSVERSIONINFO, + lpReserved: LPVOID, + lParam: LPARAM, + ) -> c_int; + pub fn CompareStringW( + Locale: LCID, + dwCmpFlags: DWORD, + lpString1: PCNZWCH, + cchCount1: c_int, + lpString2: PCNZWCH, + cchCount2: c_int, + ) -> c_int; + pub fn ConvertDefaultLocale(Locale: LCID) -> LCID; + pub fn EnumCalendarInfoA( + lpCalInfoEnumProc: CALINFO_ENUMPROCA, + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + ) -> BOOL; + pub fn EnumCalendarInfoExA( + lpCalInfoEnumProcEx: CALINFO_ENUMPROCEXA, + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + ) -> BOOL; + pub fn EnumCalendarInfoExEx( + pCalInfoEnumProcExEx: CALINFO_ENUMPROCEXEX, + lpLocaleName: LPCWSTR, + Calendar: CALID, + lpReserved: LPCWSTR, + CalType: CALTYPE, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumCalendarInfoExW( + lpCalInfoEnumProcEx: CALINFO_ENUMPROCEXW, + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + ) -> BOOL; + pub fn EnumCalendarInfoW( + lpCalInfoEnumProc: CALINFO_ENUMPROCW, + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + ) -> BOOL; + pub fn EnumDateFormatsA( + lpDateFmtEnumProc: DATEFMT_ENUMPROCA, + Locale: LCID, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDateFormatsExA( + lpDateFmtEnumProcEx: DATEFMT_ENUMPROCEXA, + Locale: LCID, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDateFormatsExEx( + lpDateFmtEnumProcExEx: DATEFMT_ENUMPROCEXEX, + lpLocaleName: LPCWSTR, + dwFlags: DWORD, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumDateFormatsExW( + lpDateFmtEnumProcEx: DATEFMT_ENUMPROCEXW, + Locale: LCID, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDateFormatsW( + lpDateFmtEnumProc: DATEFMT_ENUMPROCW, + Locale: LCID, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumLanguageGroupLocalesA( + lpLangGroupLocaleEnumProc: LANGGROUPLOCALE_ENUMPROCA, + LanguageGroup: LGRPID, + dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumLanguageGroupLocalesW( + lpLangGroupLocaleEnumProc: LANGGROUPLOCALE_ENUMPROCW, + LanguageGroup: LGRPID, + dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumSystemCodePagesA( + lpCodePageEnumProc: CODEPAGE_ENUMPROCA, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumSystemCodePagesW( + lpCodePageEnumProc: CODEPAGE_ENUMPROCW, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumSystemGeoID( + GeoClass: GEOCLASS, + ParentGeoId: GEOID, + lpGeoEnumProc: GEO_ENUMPROC, + ) -> BOOL; + pub fn EnumSystemLanguageGroupsA( + lpLanguageGroupEnumProc: LANGUAGEGROUP_ENUMPROCA, + dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumSystemLanguageGroupsW( + lpLanguageGroupEnumProc: LANGUAGEGROUP_ENUMPROCW, + dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumSystemLocalesA( + lpLocaleEnumProc: LOCALE_ENUMPROCA, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumSystemLocalesEx( + lpLocaleEnumProcEx: LOCALE_ENUMPROCEX, + dwFlags: DWORD, + lParam: LPARAM, + lpReserved: LPVOID, + ) -> BOOL; + pub fn EnumSystemLocalesW( + lpLocaleEnumProc: LOCALE_ENUMPROCW, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumTimeFormatsA( + lpTimeFmtEnumProc: TIMEFMT_ENUMPROCA, + Locale: LCID, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumTimeFormatsEx( + lpTimeFmtEnumProcEx: TIMEFMT_ENUMPROCEX, + lpLocaleName: LPCWSTR, + dwFlags: DWORD, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumTimeFormatsW( + lpTimeFmtEnumProc: TIMEFMT_ENUMPROCW, + Locale: LCID, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumUILanguagesA( + lpUILanguageEnumProc: UILANGUAGE_ENUMPROCA, + dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn EnumUILanguagesW( + lpUILanguageEnumProc: UILANGUAGE_ENUMPROCW, + dwFlags: DWORD, + lParam: LONG_PTR, + ) -> BOOL; + pub fn FindNLSString( + Locale: LCID, + dwFindNLSStringFlags: DWORD, + lpStringSource: LPCWSTR, + cchSource: c_int, + lpStringValue: LPCWSTR, + cchValue: c_int, + pcchFound: LPINT, + ) -> c_int; + pub fn FindNLSStringEx( + lpLocaleName: LPCWSTR, + dwFindNLSStringFlags: DWORD, + lpStringSource: LPCWSTR, + cchSource: c_int, + lpStringValue: LPCWSTR, + cchValue: c_int, + pcchFound: LPINT, + lpVersionInformation: LPNLSVERSIONINFO, + lpReserved: LPVOID, + sortHandle: LPARAM, + ) -> c_int; + pub fn FoldStringA( + dwMapFlags: DWORD, + lpSrcStr: LPCSTR, + cchSrc: c_int, + lpDestStr: LPSTR, + cchDest: c_int, + ) -> c_int; + pub fn GetACP() -> UINT; + pub fn GetCPInfo( + CodePage: UINT, + lpCPInfo: LPCPINFO, + ) -> BOOL; + pub fn GetCPInfoExA( + CodePage: UINT, + dwFlags: DWORD, + lpCPInfoEx: LPCPINFOEXA, + ) -> BOOL; + pub fn GetCPInfoExW( + CodePage: UINT, + dwFlags: DWORD, + lpCPInfoEx: LPCPINFOEXW, + ) -> BOOL; + pub fn GetCalendarInfoA( + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + lpCalData: LPSTR, + cchData: c_int, + lpValue: LPDWORD, + ) -> c_int; + pub fn GetCalendarInfoEx( + lpLocaleName: LPCWSTR, + Calendar: CALID, + lpReserved: LPCWSTR, + CalType: CALTYPE, + lpCalData: LPWSTR, + cchData: c_int, + lpValue: LPDWORD, + ) -> c_int; + pub fn GetCalendarInfoW( + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + lpCalData: LPWSTR, + cchData: c_int, + lpValue: LPDWORD, + ) -> c_int; + pub fn GetCurrencyFormatA( + Locale: LCID, + dwFlags: DWORD, + lpValue: LPCSTR, + lpFormat: *const CURRENCYFMTA, + lpCurrencyStr: LPSTR, + cchCurrency: c_int, + ) -> c_int; + pub fn GetCurrencyFormatEx( + lpLocaleName: LPCWSTR, + dwFlags: DWORD, + lpValue: LPCWSTR, + lpFormat: *const CURRENCYFMTW, + lpCurrencyStr: LPWSTR, + cchCurrency: c_int, + ) -> c_int; + pub fn GetCurrencyFormatW( + Locale: LCID, + dwFlags: DWORD, + lpValue: LPCWSTR, + lpFormat: *const CURRENCYFMTW, + lpCurrencyStr: LPWSTR, + cchCurrency: c_int, + ) -> c_int; + pub fn GetDurationFormat( + Locale: LCID, + dwFlags: DWORD, + lpDuration: *const SYSTEMTIME, + ullDuration: ULONGLONG, + lpFormat: LPCWSTR, + lpDurationStr: LPWSTR, + cchDuration: c_int, + ) -> c_int; + pub fn GetDurationFormatEx( + lpLocaleName: LPCWSTR, + dwFlags: DWORD, + lpDuration: *const SYSTEMTIME, + ullDuration: ULONGLONG, + lpFormat: LPCWSTR, + lpDurationStr: LPWSTR, + cchDuration: c_int, + ) -> c_int; + pub fn GetFileMUIInfo( + dwFlags: DWORD, + pcwszFilePath: PCWSTR, + pFileMUIInfo: PFILEMUIINFO, + pcbFileMUIInfo: *mut DWORD, + ) -> BOOL; + pub fn GetFileMUIPath( + dwFlags: DWORD, + pcwszFilePath: PCWSTR, + pwszLanguage: PWSTR, + pcchLanguage: PULONG, + pwszFileMUIPath: PWSTR, + pcchFileMUIPath: PULONG, + pululEnumerator: PULONGLONG, + ) -> BOOL; + pub fn GetGeoInfoA( + Location: GEOID, + GeoType: GEOTYPE, + lpGeoData: LPSTR, + cchData: c_int, + LangId: LANGID, + ) -> c_int; + pub fn GetGeoInfoW( + Location: GEOID, + GeoType: GEOTYPE, + lpGeoData: LPWSTR, + cchData: c_int, + LangId: LANGID, + ) -> c_int; + pub fn GetLocaleInfoA( + Locale: LCID, + LCType: LCTYPE, + lpLCData: LPSTR, + cchData: c_int, + ) -> c_int; + pub fn GetLocaleInfoEx( + lpLocaleName: LPCWSTR, + LCType: LCTYPE, + lpLCData: LPWSTR, + cchData: c_int, + ) -> c_int; + pub fn GetLocaleInfoW( + Locale: LCID, + LCType: LCTYPE, + lpLCData: LPWSTR, + cchData: c_int, + ) -> c_int; + pub fn GetNLSVersion( + Function: NLS_FUNCTION, + Locale: LCID, + lpVersionInformation: LPNLSVERSIONINFO, + ) -> BOOL; + pub fn GetNLSVersionEx( + function: NLS_FUNCTION, + lpLocaleName: LPCWSTR, + lpVersionInformation: LPNLSVERSIONINFOEX, + ) -> BOOL; + pub fn GetNumberFormatA( + Locale: LCID, + dwFlags: DWORD, + lpValue: LPCSTR, + lpFormat: *const NUMBERFMTA, + lpNumberStr: LPSTR, + cchNumber: c_int, + ) -> c_int; + pub fn GetNumberFormatEx( + lpLocaleName: LPCWSTR, + dwFlags: DWORD, + lpValue: LPCWSTR, + lpFormat: *const NUMBERFMTW, + lpNumberStr: LPWSTR, + cchNumber: c_int, + ) -> c_int; + pub fn GetNumberFormatW( + Locale: LCID, + dwFlags: DWORD, + lpValue: LPCWSTR, + lpFormat: *const NUMBERFMTW, + lpNumberStr: LPWSTR, + cchNumber: c_int, + ) -> c_int; + pub fn GetOEMCP() -> UINT; + pub fn GetProcessPreferredUILanguages( + dwFlags: DWORD, + pulNumLanguages: PULONG, + pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn GetStringScripts( + dwFlags: DWORD, + lpString: LPCWSTR, + cchString: c_int, + lpScripts: LPWSTR, + cchScripts: c_int, + ) -> c_int; + pub fn GetStringTypeA( + Locale: LCID, + dwInfoType: DWORD, + lpSrcStr: LPCSTR, + cchSrc: c_int, + lpCharType: LPWORD, + ) -> BOOL; + pub fn GetStringTypeExA( + Locale: LCID, + dwInfoType: DWORD, + lpSrcStr: LPCSTR, + cchSrc: c_int, + lpCharType: LPWORD, + ) -> BOOL; + pub fn GetStringTypeW( + dwInfoType: DWORD, + lpSrcStr: LPCWCH, + cchSrc: c_int, + lpCharType: LPWORD, + ) -> BOOL; + pub fn GetSystemDefaultLCID() -> LCID; + pub fn GetSystemDefaultLangID() -> LANGID; + pub fn GetSystemDefaultLocaleName( + lpLocaleName: LPWSTR, + cchLocaleName: c_int, + ) -> c_int; + pub fn GetSystemDefaultUILanguage() -> LANGID; + pub fn GetSystemPreferredUILanguages( + dwFlags: DWORD, + pulNumLanguages: PULONG, + pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn GetThreadLocale() -> LCID; + pub fn GetThreadPreferredUILanguages( + dwFlags: DWORD, + pulNumLanguages: PULONG, + pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn GetThreadUILanguage() -> LANGID; + pub fn GetUILanguageInfo( + dwFlags: DWORD, + pwmszLanguage: PCZZWSTR, + pwszFallbackLanguages: PZZWSTR, + pcchFallbackLanguages: PDWORD, + pAttributes: PDWORD, + ) -> BOOL; + pub fn GetUserDefaultLCID() -> LCID; + pub fn GetUserDefaultLangID() -> LANGID; + pub fn GetUserDefaultLocaleName( + lpLocaleName: LPWSTR, + cchLocaleName: c_int, + ) -> c_int; + pub fn GetUserDefaultUILanguage() -> LANGID; + pub fn GetUserGeoID(GeoClass: GEOCLASS) -> GEOID; + pub fn GetUserPreferredUILanguages( + dwFlags: DWORD, + pulNumLanguages: PULONG, + pwszLanguagesBuffer: PZZWSTR, + pcchLanguagesBuffer: PULONG, + ) -> BOOL; + pub fn IsDBCSLeadByte( + TestChar: BYTE, + ) -> BOOL; + pub fn IsDBCSLeadByteEx( + CodePage: UINT, + TestChar: BYTE, + ) -> BOOL; + pub fn IsNLSDefinedString( + Function: NLS_FUNCTION, + dwFlags: DWORD, + lpVersionInformation: LPNLSVERSIONINFO, + lpString: LPCWSTR, + cchStr: INT, + ) -> BOOL; + pub fn IsNormalizedString( + NormForm: NORM_FORM, + lpString: LPCWSTR, + cwLength: c_int, + ) -> BOOL; + pub fn IsValidCodePage( + CodePage: UINT, + ) -> BOOL; + pub fn IsValidLanguageGroup( + LanguageGroup: LGRPID, + dwFlags: DWORD, + ) -> BOOL; + pub fn IsValidLocale( + Locale: LCID, + dwFlags: DWORD, + ) -> BOOL; + pub fn IsValidLocaleName( + lpLocaleName: LPCWSTR, + ) -> BOOL; + pub fn IsValidNLSVersion( + function: NLS_FUNCTION, + lpLocaleName: LPCWSTR, + lpVersionInformation: LPNLSVERSIONINFOEX, + ) -> BOOL; + pub fn LCIDToLocaleName( + Locale: LCID, + lpName: LPWSTR, + cchName: c_int, + dwFlags: DWORD, + ) -> c_int; + pub fn LCMapStringA( + Locale: LCID, + dwMapFlags: DWORD, + lpSrcStr: LPCSTR, + cchSrc: c_int, + lpDestStr: LPSTR, + cchDest: c_int, + ) -> c_int; + pub fn LCMapStringEx( + lpLocaleName: LPCWSTR, + dwMapFlags: DWORD, + lpSrcStr: LPCWSTR, + cchSrc: c_int, + lpDestStr: LPWSTR, + cchDest: c_int, + lpVersionInformation: LPNLSVERSIONINFO, + lpReserved: LPVOID, + sortHandle: LPARAM, + ) -> c_int; + pub fn LCMapStringW( + Locale: LCID, + dwMapFlags: DWORD, + lpSrcStr: LPCWSTR, + cchSrc: c_int, + lpDestStr: LPWSTR, + cchDest: c_int, + ) -> c_int; + pub fn LocaleNameToLCID( + lpName: LPCWSTR, + dwFlags: DWORD, + ) -> LCID; + pub fn NormalizeString( + NormForm: NORM_FORM, + lpSrcString: LPCWSTR, + cwSrcLength: c_int, + lpDstString: LPWSTR, + cwDstLength: c_int, + ) -> c_int; + pub fn NotifyUILanguageChange( + dwFlags: DWORD, + pcwstrNewLanguage: PCWSTR, + pcwstrPreviousLanguage: PCWSTR, + dwReserved: DWORD, + pdwStatusRtrn: PDWORD, + ) -> BOOL; + pub fn ResolveLocaleName( + lpNameToResolve: LPCWSTR, + lpLocaleName: LPWSTR, + cchLocaleName: c_int, + ) -> c_int; + pub fn SetCalendarInfoA( + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + lpCalData: LPCSTR, + ) -> BOOL; + pub fn SetCalendarInfoW( + Locale: LCID, + Calendar: CALID, + CalType: CALTYPE, + lpCalData: LPCWSTR, + ) -> BOOL; + pub fn SetLocaleInfoA( + Locale: LCID, + LCType: LCTYPE, + lpLCData: LPCSTR, + ) -> BOOL; + pub fn SetLocaleInfoW( + Locale: LCID, + LCType: LCTYPE, + lpLCData: LPCWSTR, + ) -> BOOL; + pub fn SetProcessPreferredUILanguages( + dwFlags: DWORD, + pwszLanguagesBuffer: PCZZWSTR, + pulNumLanguages: PULONG, + ) -> BOOL; + pub fn SetThreadLocale(Locale: LCID) -> BOOL; + pub fn SetThreadPreferredUILanguages( + dwFlags: DWORD, + pwszLanguagesBuffer: PCZZWSTR, + pulNumLanguages: PULONG, + ) -> BOOL; + pub fn SetThreadUILanguage(LangId: LANGID) -> LANGID; + pub fn SetUserGeoID(GeoId: GEOID) -> BOOL; + pub fn VerifyScripts( + dwFlags: DWORD, + lpLocaleScripts: LPCWSTR, + cchLocaleScripts: c_int, + lpTestScripts: LPCWSTR, + cchTestScripts: c_int, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/winnt.rs b/src/vendor/winapi/src/um/winnt.rs new file mode 100644 index 0000000000..ba91ea61d3 --- /dev/null +++ b/src/vendor/winapi/src/um/winnt.rs @@ -0,0 +1,8380 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This module defines the 32-Bit Windows types and constants that are defined by NT, but exposed +//! through the Win32 API. +use ctypes::{__int64, __uint64, c_char, c_int, c_long, c_short, c_uint, c_ulong, c_void, wchar_t}; +use shared::basetsd::{ + DWORD64, KAFFINITY, LONG64, LONG_PTR, PDWORD64, PLONG64, SIZE_T, ULONG64, ULONG_PTR, +}; +use shared::guiddef::{CLSID, GUID}; +use shared::ktmtypes::{UOW}; +use shared::minwindef::{BYTE, DWORD, FALSE, PDWORD, TRUE, ULONG, USHORT, WORD}; +use vc::excpt::EXCEPTION_DISPOSITION; +use vc::vcruntime::size_t; +pub const ANYSIZE_ARRAY: usize = 1; +#[cfg(target_arch = "x86")] +IFDEF!{ +pub const MAX_NATURAL_ALIGNMENT: usize = 4; +pub const MEMORY_ALLOCATION_ALIGNMENT: usize = 8; +} +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub const MAX_NATURAL_ALIGNMENT: usize = 8; +pub const MEMORY_ALLOCATION_ALIGNMENT: usize = 16; +} +pub const SYSTEM_CACHE_ALIGNMENT_SIZE: usize = 64; +pub type PVOID = *mut c_void; +pub type PVOID64 = u64; // This is a 64-bit pointer, even when in 32-bit +pub type VOID = c_void; +pub type CHAR = c_char; +pub type SHORT = c_short; +pub type LONG = c_long; +pub type INT = c_int; +pub type WCHAR = wchar_t; +pub type PWCHAR = *mut WCHAR; +pub type LPWCH = *mut WCHAR; +pub type PWCH = *mut WCHAR; +pub type LPCWCH = *const WCHAR; +pub type PCWCH = *const WCHAR; +pub type NWPSTR = *mut WCHAR; +pub type LPWSTR = *mut WCHAR; +pub type PWSTR = *mut WCHAR; +pub type PZPWSTR = *mut PWSTR; +pub type PCZPWSTR = *const PWSTR; +pub type LPUWSTR = *mut WCHAR; // Unaligned pointer +pub type PUWSTR = *mut WCHAR; // Unaligned pointer +pub type LPCWSTR = *const WCHAR; +pub type PCWSTR = *const WCHAR; +pub type PZPCWSTR = *mut PCWSTR; +pub type PCZPCWSTR = *const PCWSTR; +pub type LPCUWSTR = *const WCHAR; // Unaligned pointer +pub type PCUWSTR = *const WCHAR; // Unaligned pointer +pub type PZZWSTR = *mut WCHAR; +pub type PCZZWSTR = *const WCHAR; +pub type PUZZWSTR = *mut WCHAR; // Unaligned pointer +pub type PCUZZWSTR = *const WCHAR; // Unaligned pointer +pub type PNZWCH = *mut WCHAR; +pub type PCNZWCH = *const WCHAR; +pub type PUNZWCH = *mut WCHAR; // Unaligned pointer +pub type PCUNZWCH = *const WCHAR; // Unaligned pointer +pub type LPCWCHAR = *const WCHAR; +pub type PCWCHAR = *const WCHAR; +pub type LPCUWCHAR = *const WCHAR; // Unaligned pointer +pub type PCUWCHAR = *const WCHAR; // Unaligned pointer +pub type UCSCHAR = c_ulong; +pub const UCSCHAR_INVALID_CHARACTER: UCSCHAR = 0xffffffff; +pub const MIN_UCSCHAR: UCSCHAR = 0; +pub const MAX_UCSCHAR: UCSCHAR = 0x0010FFFF; +pub type PUCSCHAR = *mut UCSCHAR; +pub type PCUCSCHAR = *const UCSCHAR; +pub type PUCSSTR = *mut UCSCHAR; +pub type PUUCSSTR = *mut UCSCHAR; // Unaligned pointer +pub type PCUCSSTR = *const UCSCHAR; +pub type PCUUCSSTR = *const UCSCHAR; // Unaligned pointer +pub type PUUCSCHAR = *mut UCSCHAR; // Unaligned pointer +pub type PCUUCSCHAR = *const UCSCHAR; // Unaligned pointer +pub type PCHAR = *mut CHAR; +pub type LPCH = *mut CHAR; +pub type PCH = *mut CHAR; +pub type LPCCH = *const CHAR; +pub type PCCH = *const CHAR; +pub type NPSTR = *mut CHAR; +pub type LPSTR = *mut CHAR; +pub type PSTR = *mut CHAR; +pub type PZPSTR = *mut PSTR; +pub type PCZPSTR = *const PSTR; +pub type LPCSTR = *const CHAR; +pub type PCSTR = *const CHAR; +pub type PZPCSTR = *mut PCSTR; +pub type PCZPCSTR = *const PCSTR; +pub type PZZSTR = *mut CHAR; +pub type PCZZSTR = *const CHAR; +pub type PNZCH = *mut CHAR; +pub type PCNZCH = *const CHAR; +// Skipping TCHAR things +pub type PSHORT = *mut SHORT; +pub type PLONG = *mut LONG; +pub const ALL_PROCESSOR_GROUPS: WORD = 0xffff; +STRUCT!{struct PROCESSOR_NUMBER { + Group: WORD, + Number: BYTE, + Reserved: BYTE, +}} +pub type PPROCESSOR_NUMBER = *mut PROCESSOR_NUMBER; +STRUCT!{struct GROUP_AFFINITY { + Mask: KAFFINITY, + Group: WORD, + Reserved: [WORD; 3], +}} +pub type PGROUP_AFFINITY = *mut GROUP_AFFINITY; +#[cfg(target_arch = "x86")] +pub const MAXIMUM_PROC_PER_GROUP: BYTE = 32; +#[cfg(target_arch = "x86_64")] +pub const MAXIMUM_PROC_PER_GROUP: BYTE = 64; +pub const MAXIMUM_PROCESSORS: BYTE = MAXIMUM_PROC_PER_GROUP; +pub type HANDLE = *mut c_void; +pub type PHANDLE = *mut HANDLE; +pub type FCHAR = BYTE; +pub type FSHORT = WORD; +pub type FLONG = DWORD; +pub type HRESULT = c_long; +pub type CCHAR = c_char; +pub type LCID = DWORD; +pub type PLCID = PDWORD; +pub type LANGID = WORD; +ENUM!{enum COMPARTMENT_ID { + UNSPECIFIED_COMPARTMENT_ID = 0, + DEFAULT_COMPARTMENT_ID, +}} +pub type PCOMPARTMENT_ID = *mut COMPARTMENT_ID; +pub const APPLICATION_ERROR_MASK: DWORD = 0x20000000; +pub const ERROR_SEVERITY_SUCCESS: DWORD = 0x00000000; +pub const ERROR_SEVERITY_INFORMATIONAL: DWORD = 0x40000000; +pub const ERROR_SEVERITY_WARNING: DWORD = 0x80000000; +pub const ERROR_SEVERITY_ERROR: DWORD = 0xC0000000; +STRUCT!{struct FLOAT128 { + LowPart: __int64, + HighPart: __int64, +}} +pub type PFLOAT128 = *mut FLOAT128; +pub type LONGLONG = __int64; +pub type ULONGLONG = __uint64; +pub const MAXLONGLONG: LONGLONG = 0x7fffffffffffffff; +pub type PLONGLONG = *mut LONGLONG; +pub type PULONGLONG = *mut ULONGLONG; +pub type USN = LONGLONG; +STRUCT!{struct LARGE_INTEGER_u { + LowPart: DWORD, + HighPart: LONG, +}} +UNION!{union LARGE_INTEGER { + [u64; 1], + QuadPart QuadPart_mut: LONGLONG, + u u_mut: LARGE_INTEGER_u, +}} +pub type PLARGE_INTEGER = *mut LARGE_INTEGER; +STRUCT!{struct ULARGE_INTEGER_u { + LowPart: DWORD, + HighPart: LONG, +}} +UNION!{union ULARGE_INTEGER { + [u64; 1], + QuadPart QuadPart_mut: ULONGLONG, + u u_mut: ULARGE_INTEGER_u, +}} +pub type PULARGE_INTEGER = *mut ULARGE_INTEGER; +pub type RTL_REFERENCE_COUNT = LONG_PTR; +pub type PRTL_REFERENCE_COUNT = *mut LONG_PTR; +pub type RTL_REFERENCE_COUNT32 = LONG; +pub type PRTL_REFERENCE_COUNT32 = *mut LONG; +STRUCT!{struct LUID { + LowPart: DWORD, + HighPart: LONG, +}} +pub type PLUID = *mut LUID; +pub type DWORDLONG = ULONGLONG; +pub type PDWORDLONG = *mut DWORDLONG; +pub const ANSI_NULL: CHAR = 0; +pub const UNICODE_NULL: WCHAR = 0; +pub const UNICODE_STRING_MAX_BYTES: WORD = 65534; +pub const UNICODE_STRING_MAX_CHARS: WORD = 32767; +pub type BOOLEAN = BYTE; +pub type PBOOLEAN = *mut BOOLEAN; +STRUCT!{struct LIST_ENTRY { + Flink: *mut LIST_ENTRY, + Blink: *mut LIST_ENTRY, +}} +pub type PLIST_ENTRY = *mut LIST_ENTRY; +pub type PRLIST_ENTRY = *mut LIST_ENTRY; // Restricted pointer +STRUCT!{struct SINGLE_LIST_ENTRY { + Next: *mut SINGLE_LIST_ENTRY, +}} +pub type PSINGLE_LIST_ENTRY = *mut SINGLE_LIST_ENTRY; +STRUCT!{struct LIST_ENTRY32 { + Flink: DWORD, + Blink: DWORD, +}} +pub type PLIST_ENTRY32 = *mut LIST_ENTRY32; +STRUCT!{struct LIST_ENTRY64 { + Flink: ULONGLONG, + Blink: ULONGLONG, +}} +pub type PLIST_ENTRY64 = *mut LIST_ENTRY64; +STRUCT!{struct OBJECTID { + Lineage: GUID, + Uniquifier: DWORD, +}} +pub const MINCHAR: CHAR = 0x80; +pub const MAXCHAR: CHAR = 0x7f; +pub const MINSHORT: SHORT = 0x8000; +pub const MAXSHORT: SHORT = 0x7fff; +pub const MINLONG: LONG = 0x80000000; +pub const MAXLONG: LONG = 0x7fffffff; +pub const MAXBYTE: BYTE = 0xff; +pub const MAXWORD: WORD = 0xffff; +pub const MAXDWORD: DWORD = 0xffffffff; +FN!{stdcall PEXCEPTION_ROUTINE( + ExceptionRecord: *mut EXCEPTION_RECORD, + EstablisherFrame: PVOID, + ContextRecord: *mut CONTEXT, + DispatcherContext: PVOID, +) -> EXCEPTION_DISPOSITION} +pub const VER_SERVER_NT: DWORD = 0x80000000; +pub const VER_WORKSTATION_NT: DWORD = 0x40000000; +pub const VER_SUITE_SMALLBUSINESS: DWORD = 0x00000001; +pub const VER_SUITE_ENTERPRISE: DWORD = 0x00000002; +pub const VER_SUITE_BACKOFFICE: DWORD = 0x00000004; +pub const VER_SUITE_COMMUNICATIONS: DWORD = 0x00000008; +pub const VER_SUITE_TERMINAL: DWORD = 0x00000010; +pub const VER_SUITE_SMALLBUSINESS_RESTRICTED: DWORD = 0x00000020; +pub const VER_SUITE_EMBEDDEDNT: DWORD = 0x00000040; +pub const VER_SUITE_DATACENTER: DWORD = 0x00000080; +pub const VER_SUITE_SINGLEUSERTS: DWORD = 0x00000100; +pub const VER_SUITE_PERSONAL: DWORD = 0x00000200; +pub const VER_SUITE_BLADE: DWORD = 0x00000400; +pub const VER_SUITE_EMBEDDED_RESTRICTED: DWORD = 0x00000800; +pub const VER_SUITE_SECURITY_APPLIANCE: DWORD = 0x00001000; +pub const VER_SUITE_STORAGE_SERVER: DWORD = 0x00002000; +pub const VER_SUITE_COMPUTE_SERVER: DWORD = 0x00004000; +pub const VER_SUITE_WH_SERVER: DWORD = 0x00008000; +pub const PRODUCT_UNDEFINED: DWORD = 0x00000000; +pub const PRODUCT_ULTIMATE: DWORD = 0x00000001; +pub const PRODUCT_HOME_BASIC: DWORD = 0x00000002; +pub const PRODUCT_HOME_PREMIUM: DWORD = 0x00000003; +pub const PRODUCT_ENTERPRISE: DWORD = 0x00000004; +pub const PRODUCT_HOME_BASIC_N: DWORD = 0x00000005; +pub const PRODUCT_BUSINESS: DWORD = 0x00000006; +pub const PRODUCT_STANDARD_SERVER: DWORD = 0x00000007; +pub const PRODUCT_DATACENTER_SERVER: DWORD = 0x00000008; +pub const PRODUCT_SMALLBUSINESS_SERVER: DWORD = 0x00000009; +pub const PRODUCT_ENTERPRISE_SERVER: DWORD = 0x0000000A; +pub const PRODUCT_STARTER: DWORD = 0x0000000B; +pub const PRODUCT_DATACENTER_SERVER_CORE: DWORD = 0x0000000C; +pub const PRODUCT_STANDARD_SERVER_CORE: DWORD = 0x0000000D; +pub const PRODUCT_ENTERPRISE_SERVER_CORE: DWORD = 0x0000000E; +pub const PRODUCT_ENTERPRISE_SERVER_IA64: DWORD = 0x0000000F; +pub const PRODUCT_BUSINESS_N: DWORD = 0x00000010; +pub const PRODUCT_WEB_SERVER: DWORD = 0x00000011; +pub const PRODUCT_CLUSTER_SERVER: DWORD = 0x00000012; +pub const PRODUCT_HOME_SERVER: DWORD = 0x00000013; +pub const PRODUCT_STORAGE_EXPRESS_SERVER: DWORD = 0x00000014; +pub const PRODUCT_STORAGE_STANDARD_SERVER: DWORD = 0x00000015; +pub const PRODUCT_STORAGE_WORKGROUP_SERVER: DWORD = 0x00000016; +pub const PRODUCT_STORAGE_ENTERPRISE_SERVER: DWORD = 0x00000017; +pub const PRODUCT_SERVER_FOR_SMALLBUSINESS: DWORD = 0x00000018; +pub const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: DWORD = 0x00000019; +pub const PRODUCT_HOME_PREMIUM_N: DWORD = 0x0000001A; +pub const PRODUCT_ENTERPRISE_N: DWORD = 0x0000001B; +pub const PRODUCT_ULTIMATE_N: DWORD = 0x0000001C; +pub const PRODUCT_WEB_SERVER_CORE: DWORD = 0x0000001D; +pub const PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT: DWORD = 0x0000001E; +pub const PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY: DWORD = 0x0000001F; +pub const PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING: DWORD = 0x00000020; +pub const PRODUCT_SERVER_FOUNDATION: DWORD = 0x00000021; +pub const PRODUCT_HOME_PREMIUM_SERVER: DWORD = 0x00000022; +pub const PRODUCT_SERVER_FOR_SMALLBUSINESS_V: DWORD = 0x00000023; +pub const PRODUCT_STANDARD_SERVER_V: DWORD = 0x00000024; +pub const PRODUCT_DATACENTER_SERVER_V: DWORD = 0x00000025; +pub const PRODUCT_ENTERPRISE_SERVER_V: DWORD = 0x00000026; +pub const PRODUCT_DATACENTER_SERVER_CORE_V: DWORD = 0x00000027; +pub const PRODUCT_STANDARD_SERVER_CORE_V: DWORD = 0x00000028; +pub const PRODUCT_ENTERPRISE_SERVER_CORE_V: DWORD = 0x00000029; +pub const PRODUCT_HYPERV: DWORD = 0x0000002A; +pub const PRODUCT_STORAGE_EXPRESS_SERVER_CORE: DWORD = 0x0000002B; +pub const PRODUCT_STORAGE_STANDARD_SERVER_CORE: DWORD = 0x0000002C; +pub const PRODUCT_STORAGE_WORKGROUP_SERVER_CORE: DWORD = 0x0000002D; +pub const PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE: DWORD = 0x0000002E; +pub const PRODUCT_STARTER_N: DWORD = 0x0000002F; +pub const PRODUCT_PROFESSIONAL: DWORD = 0x00000030; +pub const PRODUCT_PROFESSIONAL_N: DWORD = 0x00000031; +pub const PRODUCT_SB_SOLUTION_SERVER: DWORD = 0x00000032; +pub const PRODUCT_SERVER_FOR_SB_SOLUTIONS: DWORD = 0x00000033; +pub const PRODUCT_STANDARD_SERVER_SOLUTIONS: DWORD = 0x00000034; +pub const PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE: DWORD = 0x00000035; +pub const PRODUCT_SB_SOLUTION_SERVER_EM: DWORD = 0x00000036; +pub const PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM: DWORD = 0x00000037; +pub const PRODUCT_SOLUTION_EMBEDDEDSERVER: DWORD = 0x00000038; +pub const PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE: DWORD = 0x00000039; +pub const PRODUCT_PROFESSIONAL_EMBEDDED: DWORD = 0x0000003A; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT: DWORD = 0x0000003B; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL: DWORD = 0x0000003C; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC: DWORD = 0x0000003D; +pub const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC: DWORD = 0x0000003E; +pub const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE: DWORD = 0x0000003F; +pub const PRODUCT_CLUSTER_SERVER_V: DWORD = 0x00000040; +pub const PRODUCT_EMBEDDED: DWORD = 0x00000041; +pub const PRODUCT_STARTER_E: DWORD = 0x00000042; +pub const PRODUCT_HOME_BASIC_E: DWORD = 0x00000043; +pub const PRODUCT_HOME_PREMIUM_E: DWORD = 0x00000044; +pub const PRODUCT_PROFESSIONAL_E: DWORD = 0x00000045; +pub const PRODUCT_ENTERPRISE_E: DWORD = 0x00000046; +pub const PRODUCT_ULTIMATE_E: DWORD = 0x00000047; +pub const PRODUCT_ENTERPRISE_EVALUATION: DWORD = 0x00000048; +pub const PRODUCT_MULTIPOINT_STANDARD_SERVER: DWORD = 0x0000004C; +pub const PRODUCT_MULTIPOINT_PREMIUM_SERVER: DWORD = 0x0000004D; +pub const PRODUCT_STANDARD_EVALUATION_SERVER: DWORD = 0x0000004F; +pub const PRODUCT_DATACENTER_EVALUATION_SERVER: DWORD = 0x00000050; +pub const PRODUCT_ENTERPRISE_N_EVALUATION: DWORD = 0x00000054; +pub const PRODUCT_EMBEDDED_AUTOMOTIVE: DWORD = 0x00000055; +pub const PRODUCT_EMBEDDED_INDUSTRY_A: DWORD = 0x00000056; +pub const PRODUCT_THINPC: DWORD = 0x00000057; +pub const PRODUCT_EMBEDDED_A: DWORD = 0x00000058; +pub const PRODUCT_EMBEDDED_INDUSTRY: DWORD = 0x00000059; +pub const PRODUCT_EMBEDDED_E: DWORD = 0x0000005A; +pub const PRODUCT_EMBEDDED_INDUSTRY_E: DWORD = 0x0000005B; +pub const PRODUCT_EMBEDDED_INDUSTRY_A_E: DWORD = 0x0000005C; +pub const PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER: DWORD = 0x0000005F; +pub const PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER: DWORD = 0x00000060; +pub const PRODUCT_CORE_ARM: DWORD = 0x00000061; +pub const PRODUCT_CORE_N: DWORD = 0x00000062; +pub const PRODUCT_CORE_COUNTRYSPECIFIC: DWORD = 0x00000063; +pub const PRODUCT_CORE_SINGLELANGUAGE: DWORD = 0x00000064; +pub const PRODUCT_CORE: DWORD = 0x00000065; +pub const PRODUCT_PROFESSIONAL_WMC: DWORD = 0x00000067; +pub const PRODUCT_MOBILE_CORE: DWORD = 0x00000068; +pub const PRODUCT_EMBEDDED_INDUSTRY_EVAL: DWORD = 0x00000069; +pub const PRODUCT_EMBEDDED_INDUSTRY_E_EVAL: DWORD = 0x0000006A; +pub const PRODUCT_EMBEDDED_EVAL: DWORD = 0x0000006B; +pub const PRODUCT_EMBEDDED_E_EVAL: DWORD = 0x0000006C; +pub const PRODUCT_NANO_SERVER: DWORD = 0x0000006D; +pub const PRODUCT_CLOUD_STORAGE_SERVER: DWORD = 0x0000006E; +pub const PRODUCT_CORE_CONNECTED: DWORD = 0x0000006F; +pub const PRODUCT_PROFESSIONAL_STUDENT: DWORD = 0x00000070; +pub const PRODUCT_CORE_CONNECTED_N: DWORD = 0x00000071; +pub const PRODUCT_PROFESSIONAL_STUDENT_N: DWORD = 0x00000072; +pub const PRODUCT_CORE_CONNECTED_SINGLELANGUAGE: DWORD = 0x00000073; +pub const PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC: DWORD = 0x00000074; +pub const PRODUCT_CONNECTED_CAR: DWORD = 0x00000075; +pub const PRODUCT_INDUSTRY_HANDHELD: DWORD = 0x00000076; +pub const PRODUCT_PPI_PRO: DWORD = 0x00000077; +pub const PRODUCT_ARM64_SERVER: DWORD = 0x00000078; +pub const PRODUCT_EDUCATION: DWORD = 0x00000079; +pub const PRODUCT_EDUCATION_N: DWORD = 0x0000007A; +pub const PRODUCT_IOTUAP: DWORD = 0x0000007B; +pub const PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER: DWORD = 0x0000007C; +pub const PRODUCT_ENTERPRISE_S: DWORD = 0x0000007D; +pub const PRODUCT_ENTERPRISE_S_N: DWORD = 0x0000007E; +pub const PRODUCT_PROFESSIONAL_S: DWORD = 0x0000007F; +pub const PRODUCT_PROFESSIONAL_S_N: DWORD = 0x00000080; +pub const PRODUCT_ENTERPRISE_S_EVALUATION: DWORD = 0x00000081; +pub const PRODUCT_ENTERPRISE_S_N_EVALUATION: DWORD = 0x00000082; +pub const PRODUCT_HOLOGRAPHIC: DWORD = 0x00000087; +pub const PRODUCT_PRO_SINGLE_LANGUAGE: DWORD = 0x0000008A; +pub const PRODUCT_PRO_CHINA: DWORD = 0x0000008B; +pub const PRODUCT_ENTERPRISE_SUBSCRIPTION: DWORD = 0x0000008C; +pub const PRODUCT_ENTERPRISE_SUBSCRIPTION_N: DWORD = 0x0000008D; +pub const PRODUCT_DATACENTER_NANO_SERVER: DWORD = 0x0000008F; +pub const PRODUCT_STANDARD_NANO_SERVER: DWORD = 0x00000090; +pub const PRODUCT_DATACENTER_A_SERVER_CORE: DWORD = 0x00000091; +pub const PRODUCT_STANDARD_A_SERVER_CORE: DWORD = 0x00000092; +pub const PRODUCT_DATACENTER_WS_SERVER_CORE: DWORD = 0x00000093; +pub const PRODUCT_STANDARD_WS_SERVER_CORE: DWORD = 0x00000094; +pub const PRODUCT_UTILITY_VM: DWORD = 0x00000095; +pub const PRODUCT_DATACENTER_EVALUATION_SERVER_CORE: DWORD = 0x0000009F; +pub const PRODUCT_STANDARD_EVALUATION_SERVER_CORE: DWORD = 0x000000A0; +pub const PRODUCT_PRO_WORKSTATION: DWORD = 0x000000A1; +pub const PRODUCT_PRO_WORKSTATION_N: DWORD = 0x000000A2; +pub const PRODUCT_PRO_FOR_EDUCATION: DWORD = 0x000000A4; +pub const PRODUCT_PRO_FOR_EDUCATION_N: DWORD = 0x000000A5; +pub const PRODUCT_AZURE_SERVER_CORE: DWORD = 0x000000A8; +pub const PRODUCT_AZURE_NANO_SERVER: DWORD = 0x000000A9; +pub const PRODUCT_ENTERPRISEG: DWORD = 0x000000AB; +pub const PRODUCT_ENTERPRISEGN: DWORD = 0x000000AC; +pub const PRODUCT_CLOUD: DWORD = 0x000000B2; +pub const PRODUCT_CLOUDN: DWORD = 0x000000B3; +pub const PRODUCT_UNLICENSED: DWORD = 0xABCDABCD; +pub const LANG_NEUTRAL: WORD = 0x00; +pub const LANG_INVARIANT: WORD = 0x7f; +pub const LANG_AFRIKAANS: WORD = 0x36; +pub const LANG_ALBANIAN: WORD = 0x1c; +pub const LANG_ALSATIAN: WORD = 0x84; +pub const LANG_AMHARIC: WORD = 0x5e; +pub const LANG_ARABIC: WORD = 0x01; +pub const LANG_ARMENIAN: WORD = 0x2b; +pub const LANG_ASSAMESE: WORD = 0x4d; +pub const LANG_AZERI: WORD = 0x2c; +pub const LANG_AZERBAIJANI: WORD = 0x2c; +pub const LANG_BANGLA: WORD = 0x45; +pub const LANG_BASHKIR: WORD = 0x6d; +pub const LANG_BASQUE: WORD = 0x2d; +pub const LANG_BELARUSIAN: WORD = 0x23; +pub const LANG_BENGALI: WORD = 0x45; +pub const LANG_BRETON: WORD = 0x7e; +pub const LANG_BOSNIAN: WORD = 0x1a; +pub const LANG_BOSNIAN_NEUTRAL: WORD = 0x781a; +pub const LANG_BULGARIAN: WORD = 0x02; +pub const LANG_CATALAN: WORD = 0x03; +pub const LANG_CENTRAL_KURDISH: WORD = 0x92; +pub const LANG_CHEROKEE: WORD = 0x5c; +pub const LANG_CHINESE: WORD = 0x04; +pub const LANG_CHINESE_SIMPLIFIED: WORD = 0x04; +pub const LANG_CHINESE_TRADITIONAL: WORD = 0x7c04; +pub const LANG_CORSICAN: WORD = 0x83; +pub const LANG_CROATIAN: WORD = 0x1a; +pub const LANG_CZECH: WORD = 0x05; +pub const LANG_DANISH: WORD = 0x06; +pub const LANG_DARI: WORD = 0x8c; +pub const LANG_DIVEHI: WORD = 0x65; +pub const LANG_DUTCH: WORD = 0x13; +pub const LANG_ENGLISH: WORD = 0x09; +pub const LANG_ESTONIAN: WORD = 0x25; +pub const LANG_FAEROESE: WORD = 0x38; +pub const LANG_FARSI: WORD = 0x29; +pub const LANG_FILIPINO: WORD = 0x64; +pub const LANG_FINNISH: WORD = 0x0b; +pub const LANG_FRENCH: WORD = 0x0c; +pub const LANG_FRISIAN: WORD = 0x62; +pub const LANG_FULAH: WORD = 0x67; +pub const LANG_GALICIAN: WORD = 0x56; +pub const LANG_GEORGIAN: WORD = 0x37; +pub const LANG_GERMAN: WORD = 0x07; +pub const LANG_GREEK: WORD = 0x08; +pub const LANG_GREENLANDIC: WORD = 0x6f; +pub const LANG_GUJARATI: WORD = 0x47; +pub const LANG_HAUSA: WORD = 0x68; +pub const LANG_HAWAIIAN: WORD = 0x75; +pub const LANG_HEBREW: WORD = 0x0d; +pub const LANG_HINDI: WORD = 0x39; +pub const LANG_HUNGARIAN: WORD = 0x0e; +pub const LANG_ICELANDIC: WORD = 0x0f; +pub const LANG_IGBO: WORD = 0x70; +pub const LANG_INDONESIAN: WORD = 0x21; +pub const LANG_INUKTITUT: WORD = 0x5d; +pub const LANG_IRISH: WORD = 0x3c; +pub const LANG_ITALIAN: WORD = 0x10; +pub const LANG_JAPANESE: WORD = 0x11; +pub const LANG_KANNADA: WORD = 0x4b; +pub const LANG_KASHMIRI: WORD = 0x60; +pub const LANG_KAZAK: WORD = 0x3f; +pub const LANG_KHMER: WORD = 0x53; +pub const LANG_KICHE: WORD = 0x86; +pub const LANG_KINYARWANDA: WORD = 0x87; +pub const LANG_KONKANI: WORD = 0x57; +pub const LANG_KOREAN: WORD = 0x12; +pub const LANG_KYRGYZ: WORD = 0x40; +pub const LANG_LAO: WORD = 0x54; +pub const LANG_LATVIAN: WORD = 0x26; +pub const LANG_LITHUANIAN: WORD = 0x27; +pub const LANG_LOWER_SORBIAN: WORD = 0x2e; +pub const LANG_LUXEMBOURGISH: WORD = 0x6e; +pub const LANG_MACEDONIAN: WORD = 0x2f; +pub const LANG_MALAY: WORD = 0x3e; +pub const LANG_MALAYALAM: WORD = 0x4c; +pub const LANG_MALTESE: WORD = 0x3a; +pub const LANG_MANIPURI: WORD = 0x58; +pub const LANG_MAORI: WORD = 0x81; +pub const LANG_MAPUDUNGUN: WORD = 0x7a; +pub const LANG_MARATHI: WORD = 0x4e; +pub const LANG_MOHAWK: WORD = 0x7c; +pub const LANG_MONGOLIAN: WORD = 0x50; +pub const LANG_NEPALI: WORD = 0x61; +pub const LANG_NORWEGIAN: WORD = 0x14; +pub const LANG_OCCITAN: WORD = 0x82; +pub const LANG_ODIA: WORD = 0x48; +pub const LANG_ORIYA: WORD = 0x48; +pub const LANG_PASHTO: WORD = 0x63; +pub const LANG_PERSIAN: WORD = 0x29; +pub const LANG_POLISH: WORD = 0x15; +pub const LANG_PORTUGUESE: WORD = 0x16; +pub const LANG_PULAR: WORD = 0x67; +pub const LANG_PUNJABI: WORD = 0x46; +pub const LANG_QUECHUA: WORD = 0x6b; +pub const LANG_ROMANIAN: WORD = 0x18; +pub const LANG_ROMANSH: WORD = 0x17; +pub const LANG_RUSSIAN: WORD = 0x19; +pub const LANG_SAKHA: WORD = 0x85; +pub const LANG_SAMI: WORD = 0x3b; +pub const LANG_SANSKRIT: WORD = 0x4f; +pub const LANG_SCOTTISH_GAELIC: WORD = 0x91; +pub const LANG_SERBIAN: WORD = 0x1a; +pub const LANG_SERBIAN_NEUTRAL: WORD = 0x7c1a; +pub const LANG_SINDHI: WORD = 0x59; +pub const LANG_SINHALESE: WORD = 0x5b; +pub const LANG_SLOVAK: WORD = 0x1b; +pub const LANG_SLOVENIAN: WORD = 0x24; +pub const LANG_SOTHO: WORD = 0x6c; +pub const LANG_SPANISH: WORD = 0x0a; +pub const LANG_SWAHILI: WORD = 0x41; +pub const LANG_SWEDISH: WORD = 0x1d; +pub const LANG_SYRIAC: WORD = 0x5a; +pub const LANG_TAJIK: WORD = 0x28; +pub const LANG_TAMAZIGHT: WORD = 0x5f; +pub const LANG_TAMIL: WORD = 0x49; +pub const LANG_TATAR: WORD = 0x44; +pub const LANG_TELUGU: WORD = 0x4a; +pub const LANG_THAI: WORD = 0x1e; +pub const LANG_TIBETAN: WORD = 0x51; +pub const LANG_TIGRIGNA: WORD = 0x73; +pub const LANG_TIGRINYA: WORD = 0x73; +pub const LANG_TSWANA: WORD = 0x32; +pub const LANG_TURKISH: WORD = 0x1f; +pub const LANG_TURKMEN: WORD = 0x42; +pub const LANG_UIGHUR: WORD = 0x80; +pub const LANG_UKRAINIAN: WORD = 0x22; +pub const LANG_UPPER_SORBIAN: WORD = 0x2e; +pub const LANG_URDU: WORD = 0x20; +pub const LANG_UZBEK: WORD = 0x43; +pub const LANG_VALENCIAN: WORD = 0x03; +pub const LANG_VIETNAMESE: WORD = 0x2a; +pub const LANG_WELSH: WORD = 0x52; +pub const LANG_WOLOF: WORD = 0x88; +pub const LANG_XHOSA: WORD = 0x34; +pub const LANG_YAKUT: WORD = 0x85; +pub const LANG_YI: WORD = 0x78; +pub const LANG_YORUBA: WORD = 0x6a; +pub const LANG_ZULU: WORD = 0x35; +pub const SUBLANG_NEUTRAL: WORD = 0x00; +pub const SUBLANG_DEFAULT: WORD = 0x01; +pub const SUBLANG_SYS_DEFAULT: WORD = 0x02; +pub const SUBLANG_CUSTOM_DEFAULT: WORD = 0x03; +pub const SUBLANG_CUSTOM_UNSPECIFIED: WORD = 0x04; +pub const SUBLANG_UI_CUSTOM_DEFAULT: WORD = 0x05; +pub const SUBLANG_AFRIKAANS_SOUTH_AFRICA: WORD = 0x01; +pub const SUBLANG_ALBANIAN_ALBANIA: WORD = 0x01; +pub const SUBLANG_ALSATIAN_FRANCE: WORD = 0x01; +pub const SUBLANG_AMHARIC_ETHIOPIA: WORD = 0x01; +pub const SUBLANG_ARABIC_SAUDI_ARABIA: WORD = 0x01; +pub const SUBLANG_ARABIC_IRAQ: WORD = 0x02; +pub const SUBLANG_ARABIC_EGYPT: WORD = 0x03; +pub const SUBLANG_ARABIC_LIBYA: WORD = 0x04; +pub const SUBLANG_ARABIC_ALGERIA: WORD = 0x05; +pub const SUBLANG_ARABIC_MOROCCO: WORD = 0x06; +pub const SUBLANG_ARABIC_TUNISIA: WORD = 0x07; +pub const SUBLANG_ARABIC_OMAN: WORD = 0x08; +pub const SUBLANG_ARABIC_YEMEN: WORD = 0x09; +pub const SUBLANG_ARABIC_SYRIA: WORD = 0x0a; +pub const SUBLANG_ARABIC_JORDAN: WORD = 0x0b; +pub const SUBLANG_ARABIC_LEBANON: WORD = 0x0c; +pub const SUBLANG_ARABIC_KUWAIT: WORD = 0x0d; +pub const SUBLANG_ARABIC_UAE: WORD = 0x0e; +pub const SUBLANG_ARABIC_BAHRAIN: WORD = 0x0f; +pub const SUBLANG_ARABIC_QATAR: WORD = 0x10; +pub const SUBLANG_ARMENIAN_ARMENIA: WORD = 0x01; +pub const SUBLANG_ASSAMESE_INDIA: WORD = 0x01; +pub const SUBLANG_AZERI_LATIN: WORD = 0x01; +pub const SUBLANG_AZERI_CYRILLIC: WORD = 0x02; +pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN: WORD = 0x01; +pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC: WORD = 0x02; +pub const SUBLANG_BANGLA_INDIA: WORD = 0x01; +pub const SUBLANG_BANGLA_BANGLADESH: WORD = 0x02; +pub const SUBLANG_BASHKIR_RUSSIA: WORD = 0x01; +pub const SUBLANG_BASQUE_BASQUE: WORD = 0x01; +pub const SUBLANG_BELARUSIAN_BELARUS: WORD = 0x01; +pub const SUBLANG_BENGALI_INDIA: WORD = 0x01; +pub const SUBLANG_BENGALI_BANGLADESH: WORD = 0x02; +pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: WORD = 0x05; +pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: WORD = 0x08; +pub const SUBLANG_BRETON_FRANCE: WORD = 0x01; +pub const SUBLANG_BULGARIAN_BULGARIA: WORD = 0x01; +pub const SUBLANG_CATALAN_CATALAN: WORD = 0x01; +pub const SUBLANG_CENTRAL_KURDISH_IRAQ: WORD = 0x01; +pub const SUBLANG_CHEROKEE_CHEROKEE: WORD = 0x01; +pub const SUBLANG_CHINESE_TRADITIONAL: WORD = 0x01; +pub const SUBLANG_CHINESE_SIMPLIFIED: WORD = 0x02; +pub const SUBLANG_CHINESE_HONGKONG: WORD = 0x03; +pub const SUBLANG_CHINESE_SINGAPORE: WORD = 0x04; +pub const SUBLANG_CHINESE_MACAU: WORD = 0x05; +pub const SUBLANG_CORSICAN_FRANCE: WORD = 0x01; +pub const SUBLANG_CZECH_CZECH_REPUBLIC: WORD = 0x01; +pub const SUBLANG_CROATIAN_CROATIA: WORD = 0x01; +pub const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: WORD = 0x04; +pub const SUBLANG_DANISH_DENMARK: WORD = 0x01; +pub const SUBLANG_DARI_AFGHANISTAN: WORD = 0x01; +pub const SUBLANG_DIVEHI_MALDIVES: WORD = 0x01; +pub const SUBLANG_DUTCH: WORD = 0x01; +pub const SUBLANG_DUTCH_BELGIAN: WORD = 0x02; +pub const SUBLANG_ENGLISH_US: WORD = 0x01; +pub const SUBLANG_ENGLISH_UK: WORD = 0x02; +pub const SUBLANG_ENGLISH_AUS: WORD = 0x03; +pub const SUBLANG_ENGLISH_CAN: WORD = 0x04; +pub const SUBLANG_ENGLISH_NZ: WORD = 0x05; +pub const SUBLANG_ENGLISH_EIRE: WORD = 0x06; +pub const SUBLANG_ENGLISH_SOUTH_AFRICA: WORD = 0x07; +pub const SUBLANG_ENGLISH_JAMAICA: WORD = 0x08; +pub const SUBLANG_ENGLISH_CARIBBEAN: WORD = 0x09; +pub const SUBLANG_ENGLISH_BELIZE: WORD = 0x0a; +pub const SUBLANG_ENGLISH_TRINIDAD: WORD = 0x0b; +pub const SUBLANG_ENGLISH_ZIMBABWE: WORD = 0x0c; +pub const SUBLANG_ENGLISH_PHILIPPINES: WORD = 0x0d; +pub const SUBLANG_ENGLISH_INDIA: WORD = 0x10; +pub const SUBLANG_ENGLISH_MALAYSIA: WORD = 0x11; +pub const SUBLANG_ENGLISH_SINGAPORE: WORD = 0x12; +pub const SUBLANG_ESTONIAN_ESTONIA: WORD = 0x01; +pub const SUBLANG_FAEROESE_FAROE_ISLANDS: WORD = 0x01; +pub const SUBLANG_FILIPINO_PHILIPPINES: WORD = 0x01; +pub const SUBLANG_FINNISH_FINLAND: WORD = 0x01; +pub const SUBLANG_FRENCH: WORD = 0x01; +pub const SUBLANG_FRENCH_BELGIAN: WORD = 0x02; +pub const SUBLANG_FRENCH_CANADIAN: WORD = 0x03; +pub const SUBLANG_FRENCH_SWISS: WORD = 0x04; +pub const SUBLANG_FRENCH_LUXEMBOURG: WORD = 0x05; +pub const SUBLANG_FRENCH_MONACO: WORD = 0x06; +pub const SUBLANG_FRISIAN_NETHERLANDS: WORD = 0x01; +pub const SUBLANG_FULAH_SENEGAL: WORD = 0x02; +pub const SUBLANG_GALICIAN_GALICIAN: WORD = 0x01; +pub const SUBLANG_GEORGIAN_GEORGIA: WORD = 0x01; +pub const SUBLANG_GERMAN: WORD = 0x01; +pub const SUBLANG_GERMAN_SWISS: WORD = 0x02; +pub const SUBLANG_GERMAN_AUSTRIAN: WORD = 0x03; +pub const SUBLANG_GERMAN_LUXEMBOURG: WORD = 0x04; +pub const SUBLANG_GERMAN_LIECHTENSTEIN: WORD = 0x05; +pub const SUBLANG_GREEK_GREECE: WORD = 0x01; +pub const SUBLANG_GREENLANDIC_GREENLAND: WORD = 0x01; +pub const SUBLANG_GUJARATI_INDIA: WORD = 0x01; +pub const SUBLANG_HAUSA_NIGERIA_LATIN: WORD = 0x01; +pub const SUBLANG_HAWAIIAN_US: WORD = 0x01; +pub const SUBLANG_HEBREW_ISRAEL: WORD = 0x01; +pub const SUBLANG_HINDI_INDIA: WORD = 0x01; +pub const SUBLANG_HUNGARIAN_HUNGARY: WORD = 0x01; +pub const SUBLANG_ICELANDIC_ICELAND: WORD = 0x01; +pub const SUBLANG_IGBO_NIGERIA: WORD = 0x01; +pub const SUBLANG_INDONESIAN_INDONESIA: WORD = 0x01; +pub const SUBLANG_INUKTITUT_CANADA: WORD = 0x01; +pub const SUBLANG_INUKTITUT_CANADA_LATIN: WORD = 0x02; +pub const SUBLANG_IRISH_IRELAND: WORD = 0x02; +pub const SUBLANG_ITALIAN: WORD = 0x01; +pub const SUBLANG_ITALIAN_SWISS: WORD = 0x02; +pub const SUBLANG_JAPANESE_JAPAN: WORD = 0x01; +pub const SUBLANG_KANNADA_INDIA: WORD = 0x01; +pub const SUBLANG_KASHMIRI_SASIA: WORD = 0x02; +pub const SUBLANG_KASHMIRI_INDIA: WORD = 0x02; +pub const SUBLANG_KAZAK_KAZAKHSTAN: WORD = 0x01; +pub const SUBLANG_KHMER_CAMBODIA: WORD = 0x01; +pub const SUBLANG_KICHE_GUATEMALA: WORD = 0x01; +pub const SUBLANG_KINYARWANDA_RWANDA: WORD = 0x01; +pub const SUBLANG_KONKANI_INDIA: WORD = 0x01; +pub const SUBLANG_KOREAN: WORD = 0x01; +pub const SUBLANG_KYRGYZ_KYRGYZSTAN: WORD = 0x01; +pub const SUBLANG_LAO_LAO: WORD = 0x01; +pub const SUBLANG_LATVIAN_LATVIA: WORD = 0x01; +pub const SUBLANG_LITHUANIAN: WORD = 0x01; +pub const SUBLANG_LOWER_SORBIAN_GERMANY: WORD = 0x02; +pub const SUBLANG_LUXEMBOURGISH_LUXEMBOURG: WORD = 0x01; +pub const SUBLANG_MACEDONIAN_MACEDONIA: WORD = 0x01; +pub const SUBLANG_MALAY_MALAYSIA: WORD = 0x01; +pub const SUBLANG_MALAY_BRUNEI_DARUSSALAM: WORD = 0x02; +pub const SUBLANG_MALAYALAM_INDIA: WORD = 0x01; +pub const SUBLANG_MALTESE_MALTA: WORD = 0x01; +pub const SUBLANG_MAORI_NEW_ZEALAND: WORD = 0x01; +pub const SUBLANG_MAPUDUNGUN_CHILE: WORD = 0x01; +pub const SUBLANG_MARATHI_INDIA: WORD = 0x01; +pub const SUBLANG_MOHAWK_MOHAWK: WORD = 0x01; +pub const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: WORD = 0x01; +pub const SUBLANG_MONGOLIAN_PRC: WORD = 0x02; +pub const SUBLANG_NEPALI_INDIA: WORD = 0x02; +pub const SUBLANG_NEPALI_NEPAL: WORD = 0x01; +pub const SUBLANG_NORWEGIAN_BOKMAL: WORD = 0x01; +pub const SUBLANG_NORWEGIAN_NYNORSK: WORD = 0x02; +pub const SUBLANG_OCCITAN_FRANCE: WORD = 0x01; +pub const SUBLANG_ODIA_INDIA: WORD = 0x01; +pub const SUBLANG_ORIYA_INDIA: WORD = 0x01; +pub const SUBLANG_PASHTO_AFGHANISTAN: WORD = 0x01; +pub const SUBLANG_PERSIAN_IRAN: WORD = 0x01; +pub const SUBLANG_POLISH_POLAND: WORD = 0x01; +pub const SUBLANG_PORTUGUESE: WORD = 0x02; +pub const SUBLANG_PORTUGUESE_BRAZILIAN: WORD = 0x01; +pub const SUBLANG_PULAR_SENEGAL: WORD = 0x02; +pub const SUBLANG_PUNJABI_INDIA: WORD = 0x01; +pub const SUBLANG_PUNJABI_PAKISTAN: WORD = 0x02; +pub const SUBLANG_QUECHUA_BOLIVIA: WORD = 0x01; +pub const SUBLANG_QUECHUA_ECUADOR: WORD = 0x02; +pub const SUBLANG_QUECHUA_PERU: WORD = 0x03; +pub const SUBLANG_ROMANIAN_ROMANIA: WORD = 0x01; +pub const SUBLANG_ROMANSH_SWITZERLAND: WORD = 0x01; +pub const SUBLANG_RUSSIAN_RUSSIA: WORD = 0x01; +pub const SUBLANG_SAKHA_RUSSIA: WORD = 0x01; +pub const SUBLANG_SAMI_NORTHERN_NORWAY: WORD = 0x01; +pub const SUBLANG_SAMI_NORTHERN_SWEDEN: WORD = 0x02; +pub const SUBLANG_SAMI_NORTHERN_FINLAND: WORD = 0x03; +pub const SUBLANG_SAMI_LULE_NORWAY: WORD = 0x04; +pub const SUBLANG_SAMI_LULE_SWEDEN: WORD = 0x05; +pub const SUBLANG_SAMI_SOUTHERN_NORWAY: WORD = 0x06; +pub const SUBLANG_SAMI_SOUTHERN_SWEDEN: WORD = 0x07; +pub const SUBLANG_SAMI_SKOLT_FINLAND: WORD = 0x08; +pub const SUBLANG_SAMI_INARI_FINLAND: WORD = 0x09; +pub const SUBLANG_SANSKRIT_INDIA: WORD = 0x01; +pub const SUBLANG_SCOTTISH_GAELIC: WORD = 0x01; +pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN: WORD = 0x06; +pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC: WORD = 0x07; +pub const SUBLANG_SERBIAN_MONTENEGRO_LATIN: WORD = 0x0b; +pub const SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC: WORD = 0x0c; +pub const SUBLANG_SERBIAN_SERBIA_LATIN: WORD = 0x09; +pub const SUBLANG_SERBIAN_SERBIA_CYRILLIC: WORD = 0x0a; +pub const SUBLANG_SERBIAN_CROATIA: WORD = 0x01; +pub const SUBLANG_SERBIAN_LATIN: WORD = 0x02; +pub const SUBLANG_SERBIAN_CYRILLIC: WORD = 0x03; +pub const SUBLANG_SINDHI_INDIA: WORD = 0x01; +pub const SUBLANG_SINDHI_PAKISTAN: WORD = 0x02; +pub const SUBLANG_SINDHI_AFGHANISTAN: WORD = 0x02; +pub const SUBLANG_SINHALESE_SRI_LANKA: WORD = 0x01; +pub const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA: WORD = 0x01; +pub const SUBLANG_SLOVAK_SLOVAKIA: WORD = 0x01; +pub const SUBLANG_SLOVENIAN_SLOVENIA: WORD = 0x01; +pub const SUBLANG_SPANISH: WORD = 0x01; +pub const SUBLANG_SPANISH_MEXICAN: WORD = 0x02; +pub const SUBLANG_SPANISH_MODERN: WORD = 0x03; +pub const SUBLANG_SPANISH_GUATEMALA: WORD = 0x04; +pub const SUBLANG_SPANISH_COSTA_RICA: WORD = 0x05; +pub const SUBLANG_SPANISH_PANAMA: WORD = 0x06; +pub const SUBLANG_SPANISH_DOMINICAN_REPUBLIC: WORD = 0x07; +pub const SUBLANG_SPANISH_VENEZUELA: WORD = 0x08; +pub const SUBLANG_SPANISH_COLOMBIA: WORD = 0x09; +pub const SUBLANG_SPANISH_PERU: WORD = 0x0a; +pub const SUBLANG_SPANISH_ARGENTINA: WORD = 0x0b; +pub const SUBLANG_SPANISH_ECUADOR: WORD = 0x0c; +pub const SUBLANG_SPANISH_CHILE: WORD = 0x0d; +pub const SUBLANG_SPANISH_URUGUAY: WORD = 0x0e; +pub const SUBLANG_SPANISH_PARAGUAY: WORD = 0x0f; +pub const SUBLANG_SPANISH_BOLIVIA: WORD = 0x10; +pub const SUBLANG_SPANISH_EL_SALVADOR: WORD = 0x11; +pub const SUBLANG_SPANISH_HONDURAS: WORD = 0x12; +pub const SUBLANG_SPANISH_NICARAGUA: WORD = 0x13; +pub const SUBLANG_SPANISH_PUERTO_RICO: WORD = 0x14; +pub const SUBLANG_SPANISH_US: WORD = 0x15; +pub const SUBLANG_SWAHILI_KENYA: WORD = 0x01; +pub const SUBLANG_SWEDISH: WORD = 0x01; +pub const SUBLANG_SWEDISH_FINLAND: WORD = 0x02; +pub const SUBLANG_SYRIAC_SYRIA: WORD = 0x01; +pub const SUBLANG_TAJIK_TAJIKISTAN: WORD = 0x01; +pub const SUBLANG_TAMAZIGHT_ALGERIA_LATIN: WORD = 0x02; +pub const SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH: WORD = 0x04; +pub const SUBLANG_TAMIL_INDIA: WORD = 0x01; +pub const SUBLANG_TAMIL_SRI_LANKA: WORD = 0x02; +pub const SUBLANG_TATAR_RUSSIA: WORD = 0x01; +pub const SUBLANG_TELUGU_INDIA: WORD = 0x01; +pub const SUBLANG_THAI_THAILAND: WORD = 0x01; +pub const SUBLANG_TIBETAN_PRC: WORD = 0x01; +pub const SUBLANG_TIGRIGNA_ERITREA: WORD = 0x02; +pub const SUBLANG_TIGRINYA_ERITREA: WORD = 0x02; +pub const SUBLANG_TIGRINYA_ETHIOPIA: WORD = 0x01; +pub const SUBLANG_TSWANA_BOTSWANA: WORD = 0x02; +pub const SUBLANG_TSWANA_SOUTH_AFRICA: WORD = 0x01; +pub const SUBLANG_TURKISH_TURKEY: WORD = 0x01; +pub const SUBLANG_TURKMEN_TURKMENISTAN: WORD = 0x01; +pub const SUBLANG_UIGHUR_PRC: WORD = 0x01; +pub const SUBLANG_UKRAINIAN_UKRAINE: WORD = 0x01; +pub const SUBLANG_UPPER_SORBIAN_GERMANY: WORD = 0x01; +pub const SUBLANG_URDU_PAKISTAN: WORD = 0x01; +pub const SUBLANG_URDU_INDIA: WORD = 0x02; +pub const SUBLANG_UZBEK_LATIN: WORD = 0x01; +pub const SUBLANG_UZBEK_CYRILLIC: WORD = 0x02; +pub const SUBLANG_VALENCIAN_VALENCIA: WORD = 0x02; +pub const SUBLANG_VIETNAMESE_VIETNAM: WORD = 0x01; +pub const SUBLANG_WELSH_UNITED_KINGDOM: WORD = 0x01; +pub const SUBLANG_WOLOF_SENEGAL: WORD = 0x01; +pub const SUBLANG_XHOSA_SOUTH_AFRICA: WORD = 0x01; +pub const SUBLANG_YAKUT_RUSSIA: WORD = 0x01; +pub const SUBLANG_YI_PRC: WORD = 0x01; +pub const SUBLANG_YORUBA_NIGERIA: WORD = 0x01; +pub const SUBLANG_ZULU_SOUTH_AFRICA: WORD = 0x01; +pub const SORT_DEFAULT: WORD = 0x0; +pub const SORT_INVARIANT_MATH: WORD = 0x1; +pub const SORT_JAPANESE_XJIS: WORD = 0x0; +pub const SORT_JAPANESE_UNICODE: WORD = 0x1; +pub const SORT_JAPANESE_RADICALSTROKE: WORD = 0x4; +pub const SORT_CHINESE_BIG5: WORD = 0x0; +pub const SORT_CHINESE_PRCP: WORD = 0x0; +pub const SORT_CHINESE_UNICODE: WORD = 0x1; +pub const SORT_CHINESE_PRC: WORD = 0x2; +pub const SORT_CHINESE_BOPOMOFO: WORD = 0x3; +pub const SORT_CHINESE_RADICALSTROKE: WORD = 0x4; +pub const SORT_KOREAN_KSC: WORD = 0x0; +pub const SORT_KOREAN_UNICODE: WORD = 0x1; +pub const SORT_GERMAN_PHONE_BOOK: WORD = 0x1; +pub const SORT_HUNGARIAN_DEFAULT: WORD = 0x0; +pub const SORT_HUNGARIAN_TECHNICAL: WORD = 0x1; +pub const SORT_GEORGIAN_TRADITIONAL: WORD = 0x0; +pub const SORT_GEORGIAN_MODERN: WORD = 0x1; +macro_rules! MAKELANGID { ($p:expr, $s:expr) => (($s << 10) | $p) } +#[inline] +pub fn MAKELANGID(p: WORD, s: WORD) -> LANGID { + (s << 10) | p +} +#[inline] +pub fn PRIMARYLANGID(lgid: LANGID) -> WORD { + lgid & 0x3ff +} +#[inline] +pub fn SUBLANGID(lgid: LANGID) -> WORD { + lgid >> 10 +} +pub const NLS_VALID_LOCALE_MASK: DWORD = 0x000fffff; +macro_rules! MAKELCID { + ($lgid:expr, $srtid:expr) => ((($srtid as DWORD) << 16) | ($lgid as DWORD)) +} +#[inline] +pub fn MAKELCID(lgid: LANGID, srtid: WORD) -> LCID { + ((srtid as DWORD) << 16) | (lgid as DWORD) +} +#[inline] +pub fn MAKESORTLCID(lgid: LANGID, srtid: WORD, ver: WORD) -> LCID { + MAKELCID(lgid, srtid) | ((ver as DWORD) << 20) +} +#[inline] +pub fn LANGIDFROMLCID(lcid: LCID) -> LANGID { + lcid as LANGID +} +#[inline] +pub fn SORTIDFROMLCID(lcid: LCID) -> WORD { + ((lcid >> 16) & 0xf) as WORD +} +#[inline] +pub fn SORTVERSIONFROMLCID(lcid: LCID) -> WORD { + ((lcid >> 16) & 0xf) as WORD +} +pub const LOCALE_NAME_MAX_LENGTH: usize = 85; +pub const LANG_SYSTEM_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT); +pub const LANG_USER_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_DEFAULT); +pub const LOCALE_SYSTEM_DEFAULT: LCID = MAKELCID!(LANG_SYSTEM_DEFAULT, SORT_DEFAULT); +pub const LOCALE_USER_DEFAULT: LCID = MAKELCID!(LANG_USER_DEFAULT, SORT_DEFAULT); +pub const LOCALE_CUSTOM_DEFAULT: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT); +pub const LOCALE_CUSTOM_UNSPECIFIED: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT); +pub const LOCALE_CUSTOM_UI_DEFAULT: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT); +pub const LOCALE_NEUTRAL: LCID + = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT); +pub const LOCALE_INVARIANT: LCID + = MAKELCID!(MAKELANGID!(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT); +pub const LOCALE_TRANSIENT_KEYBOARD1: LCID = 0x2000; +pub const LOCALE_TRANSIENT_KEYBOARD2: LCID = 0x2400; +pub const LOCALE_TRANSIENT_KEYBOARD3: LCID = 0x2800; +pub const LOCALE_TRANSIENT_KEYBOARD4: LCID = 0x2c00; +pub const LOCALE_UNASSIGNED_LCID: LCID = LOCALE_CUSTOM_UNSPECIFIED; +pub const STATUS_WAIT_0: DWORD = 0x00000000; +pub const STATUS_ABANDONED_WAIT_0: DWORD = 0x00000080; +pub const STATUS_USER_APC: DWORD = 0x000000C0; +pub const STATUS_TIMEOUT: DWORD = 0x00000102; +pub const STATUS_PENDING: DWORD = 0x00000103; +pub const DBG_EXCEPTION_HANDLED: DWORD = 0x00010001; +pub const DBG_CONTINUE: DWORD = 0x00010002; +pub const STATUS_SEGMENT_NOTIFICATION: DWORD = 0x40000005; +pub const STATUS_FATAL_APP_EXIT: DWORD = 0x40000015; +pub const DBG_REPLY_LATER: DWORD = 0x40010001; +pub const DBG_TERMINATE_THREAD: DWORD = 0x40010003; +pub const DBG_TERMINATE_PROCESS: DWORD = 0x40010004; +pub const DBG_CONTROL_C: DWORD = 0x40010005; +pub const DBG_PRINTEXCEPTION_C: DWORD = 0x40010006; +pub const DBG_RIPEXCEPTION: DWORD = 0x40010007; +pub const DBG_CONTROL_BREAK: DWORD = 0x40010008; +pub const DBG_COMMAND_EXCEPTION: DWORD = 0x40010009; +pub const DBG_PRINTEXCEPTION_WIDE_C: DWORD = 0x4001000A; +pub const STATUS_GUARD_PAGE_VIOLATION: DWORD = 0x80000001; +pub const STATUS_DATATYPE_MISALIGNMENT: DWORD = 0x80000002; +pub const STATUS_BREAKPOINT: DWORD = 0x80000003; +pub const STATUS_SINGLE_STEP: DWORD = 0x80000004; +pub const STATUS_LONGJUMP: DWORD = 0x80000026; +pub const STATUS_UNWIND_CONSOLIDATE: DWORD = 0x80000029; +pub const DBG_EXCEPTION_NOT_HANDLED: DWORD = 0x80010001; +pub const STATUS_ACCESS_VIOLATION: DWORD = 0xC0000005; +pub const STATUS_IN_PAGE_ERROR: DWORD = 0xC0000006; +pub const STATUS_INVALID_HANDLE: DWORD = 0xC0000008; +pub const STATUS_INVALID_PARAMETER: DWORD = 0xC000000D; +pub const STATUS_NO_MEMORY: DWORD = 0xC0000017; +pub const STATUS_ILLEGAL_INSTRUCTION: DWORD = 0xC000001D; +pub const STATUS_NONCONTINUABLE_EXCEPTION: DWORD = 0xC0000025; +pub const STATUS_INVALID_DISPOSITION: DWORD = 0xC0000026; +pub const STATUS_ARRAY_BOUNDS_EXCEEDED: DWORD = 0xC000008C; +pub const STATUS_FLOAT_DENORMAL_OPERAND: DWORD = 0xC000008D; +pub const STATUS_FLOAT_DIVIDE_BY_ZERO: DWORD = 0xC000008E; +pub const STATUS_FLOAT_INEXACT_RESULT: DWORD = 0xC000008F; +pub const STATUS_FLOAT_INVALID_OPERATION: DWORD = 0xC0000090; +pub const STATUS_FLOAT_OVERFLOW: DWORD = 0xC0000091; +pub const STATUS_FLOAT_STACK_CHECK: DWORD = 0xC0000092; +pub const STATUS_FLOAT_UNDERFLOW: DWORD = 0xC0000093; +pub const STATUS_INTEGER_DIVIDE_BY_ZERO: DWORD = 0xC0000094; +pub const STATUS_INTEGER_OVERFLOW: DWORD = 0xC0000095; +pub const STATUS_PRIVILEGED_INSTRUCTION: DWORD = 0xC0000096; +pub const STATUS_STACK_OVERFLOW: DWORD = 0xC00000FD; +pub const STATUS_DLL_NOT_FOUND: DWORD = 0xC0000135; +pub const STATUS_ORDINAL_NOT_FOUND: DWORD = 0xC0000138; +pub const STATUS_ENTRYPOINT_NOT_FOUND: DWORD = 0xC0000139; +pub const STATUS_CONTROL_C_EXIT: DWORD = 0xC000013A; +pub const STATUS_DLL_INIT_FAILED: DWORD = 0xC0000142; +pub const STATUS_FLOAT_MULTIPLE_FAULTS: DWORD = 0xC00002B4; +pub const STATUS_FLOAT_MULTIPLE_TRAPS: DWORD = 0xC00002B5; +pub const STATUS_REG_NAT_CONSUMPTION: DWORD = 0xC00002C9; +pub const STATUS_HEAP_CORRUPTION: DWORD = 0xC0000374; +pub const STATUS_STACK_BUFFER_OVERRUN: DWORD = 0xC0000409; +pub const STATUS_INVALID_CRUNTIME_PARAMETER: DWORD = 0xC0000417; +pub const STATUS_ASSERTION_FAILURE: DWORD = 0xC0000420; +pub const STATUS_SXS_EARLY_DEACTIVATION: DWORD = 0xC015000F; +pub const STATUS_SXS_INVALID_DEACTIVATION: DWORD = 0xC0150010; +pub const MAXIMUM_WAIT_OBJECTS: DWORD = 64; +pub const MAXIMUM_SUSPEND_COUNT: CHAR = MAXCHAR; +pub type KSPIN_LOCK = ULONG_PTR; +pub type PKSPIN_LOCK = *mut KSPIN_LOCK; +STRUCT!{struct M128A { // FIXME align 16 + Low: ULONGLONG, + High: LONGLONG, +}} +pub type PM128A = *mut M128A; +#[cfg(target_arch = "x86")] +STRUCT!{struct XSAVE_FORMAT { // FIXME align 16 + ControlWord: WORD, + StatusWord: WORD, + TagWord: BYTE, + Reserved1: BYTE, + ErrorOpcode: WORD, + ErrorOffset: DWORD, + ErrorSelector: WORD, + Reserved2: WORD, + DataOffset: DWORD, + DataSelector: WORD, + Reserved3: WORD, + MxCsr: DWORD, + MxCsr_Mask: DWORD, + FloatRegisters: [M128A; 8], + XmmRegisters: [M128A; 8], + Reserved4: [BYTE; 224], +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct XSAVE_FORMAT { // FIXME align 16 + ControlWord: WORD, + StatusWord: WORD, + TagWord: BYTE, + Reserved1: BYTE, + ErrorOpcode: WORD, + ErrorOffset: DWORD, + ErrorSelector: WORD, + Reserved2: WORD, + DataOffset: DWORD, + DataSelector: WORD, + Reserved3: WORD, + MxCsr: DWORD, + MxCsr_Mask: DWORD, + FloatRegisters: [M128A; 8], + XmmRegisters: [M128A; 16], + Reserved4: [BYTE; 96], +}} +pub type PXSAVE_FORMAT = *mut XSAVE_FORMAT; +STRUCT!{struct XSAVE_AREA_HEADER { // FIXME align 8 + Mask: DWORD64, + CompactionMask: DWORD64, + Reserved2: [DWORD64; 6], +}} +pub type PXSAVE_AREA_HEADER = *mut XSAVE_AREA_HEADER; +STRUCT!{struct XSAVE_AREA { // FIXME align 16 + LegacyState: XSAVE_FORMAT, + Header: XSAVE_AREA_HEADER, +}} +pub type PXSAVE_AREA = *mut XSAVE_AREA; +#[cfg(target_arch = "x86")] +STRUCT!{struct XSTATE_CONTEXT { + Mask: DWORD64, + Length: DWORD, + Reserved1: DWORD, + Area: PXSAVE_AREA, + Reserved2: DWORD, + Buffer: PVOID, + Reserved3: DWORD, +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct XSTATE_CONTEXT { + Mask: DWORD64, + Length: DWORD, + Reserved1: DWORD, + Area: PXSAVE_AREA, + Buffer: PVOID, +}} +pub type PXSTATE_CONTEXT = *mut XSTATE_CONTEXT; +STRUCT!{struct SCOPE_TABLE_AMD64 { + Count: DWORD, + ScopeRecord: [SCOPE_TABLE_AMD64_ScopeRecord; 1], +}} +STRUCT!{struct SCOPE_TABLE_AMD64_ScopeRecord { + BeginAddress: DWORD, + EndAddress: DWORD, + HandlerAddress: DWORD, + JumpTarget: DWORD, +}} +pub type PSCOPE_TABLE_AMD64 = *mut SCOPE_TABLE_AMD64; +// Skip interlocked and bit manipulation stuff because it is all intrinsics +// Use the native Rust equivalents instead +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub const EXCEPTION_READ_FAULT: DWORD = 0; +pub const EXCEPTION_WRITE_FAULT: DWORD = 1; +pub const EXCEPTION_EXECUTE_FAULT: DWORD = 8; +pub const CONTEXT_AMD64: DWORD = 0x00100000; +pub const CONTEXT_CONTROL: DWORD = CONTEXT_AMD64 | 0x00000001; +pub const CONTEXT_INTEGER: DWORD = CONTEXT_AMD64 | 0x00000002; +pub const CONTEXT_SEGMENTS: DWORD = CONTEXT_AMD64 | 0x00000004; +pub const CONTEXT_FLOATING_POINT: DWORD = CONTEXT_AMD64 | 0x00000008; +pub const CONTEXT_DEBUG_REGISTERS: DWORD = CONTEXT_AMD64 | 0x00000010; +pub const CONTEXT_FULL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT; +pub const CONTEXT_ALL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS + | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS; +pub const CONTEXT_XSTATE: DWORD = CONTEXT_AMD64 | 0x00000040; +pub const CONTEXT_EXCEPTION_ACTIVE: DWORD = 0x08000000; +pub const CONTEXT_SERVICE_ACTIVE: DWORD = 0x10000000; +pub const CONTEXT_EXCEPTION_REQUEST: DWORD = 0x40000000; +pub const CONTEXT_EXCEPTION_REPORTING: DWORD = 0x80000000; +pub const INITIAL_MXCSR: DWORD = 0x1f80; +pub const INITIAL_FPCSR: DWORD = 0x027f; +pub type XMM_SAVE_AREA32 = XSAVE_FORMAT; +pub type PXMM_SAVE_AREA32 = *mut XSAVE_FORMAT; +STRUCT!{struct CONTEXT_u_s { + Header: [M128A; 2], + Legacy: [M128A; 8], + Xmm0: M128A, + Xmm1: M128A, + Xmm2: M128A, + Xmm3: M128A, + Xmm4: M128A, + Xmm5: M128A, + Xmm6: M128A, + Xmm7: M128A, + Xmm8: M128A, + Xmm9: M128A, + Xmm10: M128A, + Xmm11: M128A, + Xmm12: M128A, + Xmm13: M128A, + Xmm14: M128A, + Xmm15: M128A, +}} +UNION!{union CONTEXT_u { + [u64; 64], + FltSave FltSave_mut: XMM_SAVE_AREA32, + s s_mut: CONTEXT_u_s, +}} +STRUCT!{struct CONTEXT { // FIXME align 16 + P1Home: DWORD64, + P2Home: DWORD64, + P3Home: DWORD64, + P4Home: DWORD64, + P5Home: DWORD64, + P6Home: DWORD64, + ContextFlags: DWORD, + MxCsr: DWORD, + SegCs: WORD, + SegDs: WORD, + SegEs: WORD, + SegFs: WORD, + SegGs: WORD, + SegSs: WORD, + EFlags: DWORD, + Dr0: DWORD64, + Dr1: DWORD64, + Dr2: DWORD64, + Dr3: DWORD64, + Dr6: DWORD64, + Dr7: DWORD64, + Rax: DWORD64, + Rcx: DWORD64, + Rdx: DWORD64, + Rbx: DWORD64, + Rsp: DWORD64, + Rbp: DWORD64, + Rsi: DWORD64, + Rdi: DWORD64, + R8: DWORD64, + R9: DWORD64, + R10: DWORD64, + R11: DWORD64, + R12: DWORD64, + R13: DWORD64, + R14: DWORD64, + R15: DWORD64, + Rip: DWORD64, + u: CONTEXT_u, + VectorRegister: [M128A; 26], + VectorControl: DWORD64, + DebugControl: DWORD64, + LastBranchToRip: DWORD64, + LastBranchFromRip: DWORD64, + LastExceptionToRip: DWORD64, + LastExceptionFromRip: DWORD64, +}} +pub type PCONTEXT = *mut CONTEXT; +pub type RUNTIME_FUNCTION = IMAGE_RUNTIME_FUNCTION_ENTRY; +pub type PRUNTIME_FUNCTION = *mut IMAGE_RUNTIME_FUNCTION_ENTRY; +pub type SCOPE_TABLE = SCOPE_TABLE_AMD64; +pub type PSCOPE_TABLE = *mut SCOPE_TABLE_AMD64; +pub const RUNTIME_FUNCTION_INDIRECT: DWORD = 0x1; +pub const UNW_FLAG_NHANDLER: DWORD = 0x0; +pub const UNW_FLAG_EHANDLER: DWORD = 0x1; +pub const UNW_FLAG_UHANDLER: DWORD = 0x2; +pub const UNW_FLAG_CHAININFO: DWORD = 0x4; +pub const UNW_FLAG_NO_EPILOGUE: DWORD = 0x80000000; +pub const UNWIND_HISTORY_TABLE_SIZE: usize = 12; +STRUCT!{struct UNWIND_HISTORY_TABLE_ENTRY { + ImageBase: DWORD64, + FunctionEntry: PRUNTIME_FUNCTION, +}} +pub type PUNWIND_HISTORY_TABLE_ENTRY = *mut UNWIND_HISTORY_TABLE_ENTRY; +STRUCT!{struct UNWIND_HISTORY_TABLE { + Count: DWORD, + LocalHint: BYTE, + GlobalHint: BYTE, + Search: BYTE, + Once: BYTE, + LowAddress: DWORD64, + HighAddress: DWORD64, + Entry: [UNWIND_HISTORY_TABLE_ENTRY; UNWIND_HISTORY_TABLE_SIZE], +}} +pub type PUNWIND_HISTORY_TABLE = *mut UNWIND_HISTORY_TABLE; +FN!{cdecl PGET_RUNTIME_FUNCTION_CALLBACK( + ControlPc: DWORD64, + Context: PVOID, +) -> PRUNTIME_FUNCTION} +FN!{cdecl POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK( + Process: HANDLE, + TableAddress: PVOID, + Entries: PDWORD, + Functions: *mut PRUNTIME_FUNCTION, +) -> DWORD} +pub const OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME: &'static str + = "OutOfProcessFunctionTableCallback"; +STRUCT!{struct DISPATCHER_CONTEXT { + ControlPc: DWORD64, + ImageBase: DWORD64, + FunctionEntry: PRUNTIME_FUNCTION, + EstablisherFrame: DWORD64, + ContextRecord: PCONTEXT, + LanguageHandler: PEXCEPTION_ROUTINE, + HandlerData: PVOID, + HistoryTable: PUNWIND_HISTORY_TABLE, + ScopeIndex: DWORD, + Fill0: DWORD, +}} +pub type PDISPATCHER_CONTEXT = *mut DISPATCHER_CONTEXT; +FN!{cdecl PEXCEPTION_FILTER( + ExceptionPointers: *mut EXCEPTION_POINTERS, + EstablisherFrame: PVOID, +) -> LONG} +FN!{cdecl PTERMINATION_HANDLER( + AbnormalTermination: BOOLEAN, + EstablisherFrame: PVOID, +) -> ()} +STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u1_s { + Xmm0: PM128A, + Xmm1: PM128A, + Xmm2: PM128A, + Xmm3: PM128A, + Xmm4: PM128A, + Xmm5: PM128A, + Xmm6: PM128A, + Xmm7: PM128A, + Xmm8: PM128A, + Xmm9: PM128A, + Xmm10: PM128A, + Xmm11: PM128A, + Xmm12: PM128A, + Xmm14: PM128A, + Xmm15: PM128A, +}} +UNION!{union KNONVOLATILE_CONTEXT_POINTERS_u1 { + [u64; 16], + FloatingContext FloatingContext_mut: [PM128A; 16], + s s_mut: KNONVOLATILE_CONTEXT_POINTERS_u1_s, +}} +STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u2_s { + Rax: PDWORD64, + Rcx: PDWORD64, + Rdx: PDWORD64, + Rbx: PDWORD64, + Rsp: PDWORD64, + Rbp: PDWORD64, + Rsi: PDWORD64, + Rdi: PDWORD64, + R8: PDWORD64, + R9: PDWORD64, + R10: PDWORD64, + R11: PDWORD64, + R12: PDWORD64, + R13: PDWORD64, + R14: PDWORD64, + R15: PDWORD64, +}} +UNION!{union KNONVOLATILE_CONTEXT_POINTERS_u2 { + [u64; 16], + IntegerContext IntegerContext_mut: [PDWORD64; 16], + s s_mut: KNONVOLATILE_CONTEXT_POINTERS_u2_s, +}} +STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS { + u1: KNONVOLATILE_CONTEXT_POINTERS_u1, + u2: KNONVOLATILE_CONTEXT_POINTERS_u2, +}} +pub type PKNONVOLATILE_CONTEXT_POINTERS = *mut KNONVOLATILE_CONTEXT_POINTERS; +} // IFDEF(x86_64) +#[cfg(target_arch = "x86")] +IFDEF!{ +pub const EXCEPTION_READ_FAULT: DWORD = 0; +pub const EXCEPTION_WRITE_FAULT: DWORD = 1; +pub const EXCEPTION_EXECUTE_FAULT: DWORD = 8; +pub const SIZE_OF_80387_REGISTERS: usize = 80; +pub const CONTEXT_i386: DWORD = 0x00010000; +pub const CONTEXT_i486: DWORD = 0x00010000; +pub const CONTEXT_CONTROL: DWORD = CONTEXT_i386 | 0x00000001; +pub const CONTEXT_INTEGER: DWORD = CONTEXT_i386 | 0x00000002; +pub const CONTEXT_SEGMENTS: DWORD = CONTEXT_i386 | 0x00000004; +pub const CONTEXT_FLOATING_POINT: DWORD = CONTEXT_i386 | 0x00000008; +pub const CONTEXT_DEBUG_REGISTERS: DWORD = CONTEXT_i386 | 0x00000010; +pub const CONTEXT_EXTENDED_REGISTERS: DWORD = CONTEXT_i386 | 0x00000020; +pub const CONTEXT_FULL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS; +pub const CONTEXT_ALL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS + | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS; +pub const CONTEXT_XSTATE: DWORD = CONTEXT_i386 | 0x00000040; +pub const CONTEXT_EXCEPTION_ACTIVE: DWORD = 0x08000000; +pub const CONTEXT_SERVICE_ACTIVE: DWORD = 0x10000000; +pub const CONTEXT_EXCEPTION_REQUEST: DWORD = 0x40000000; +pub const CONTEXT_EXCEPTION_REPORTING: DWORD = 0x80000000; +STRUCT!{struct FLOATING_SAVE_AREA { + ControlWord: DWORD, + StatusWord: DWORD, + TagWord: DWORD, + ErrorOffset: DWORD, + ErrorSelector: DWORD, + DataOffset: DWORD, + DataSelector: DWORD, + RegisterArea: [BYTE; SIZE_OF_80387_REGISTERS], + Spare0: DWORD, +}} +pub type PFLOATING_SAVE_AREA = *mut FLOATING_SAVE_AREA; +pub const MAXIMUM_SUPPORTED_EXTENSION: usize = 512; +STRUCT!{struct CONTEXT { + ContextFlags: DWORD, + Dr0: DWORD, + Dr1: DWORD, + Dr2: DWORD, + Dr3: DWORD, + Dr6: DWORD, + Dr7: DWORD, + FloatSave: FLOATING_SAVE_AREA, + SegGs: DWORD, + SegFs: DWORD, + SegEs: DWORD, + SegDs: DWORD, + Edi: DWORD, + Esi: DWORD, + Ebx: DWORD, + Edx: DWORD, + Ecx: DWORD, + Eax: DWORD, + Ebp: DWORD, + Eip: DWORD, + SegCs: DWORD, + EFlags: DWORD, + Esp: DWORD, + SegSs: DWORD, + ExtendedRegisters: [BYTE; MAXIMUM_SUPPORTED_EXTENSION], +}} +pub type PCONTEXT = *mut CONTEXT; +STRUCT!{struct LDT_ENTRY_Bytes { + BaseMid: BYTE, + Flags1: BYTE, + Flags2: BYTE, + BaseHi: BYTE, +}} +STRUCT!{struct LDT_ENTRY_Bits { + Bitfield: DWORD, +}} +BITFIELD!{LDT_ENTRY_Bits Bitfield: DWORD [ + BaseMid set_BaseMid[0..8], + Type set_Type[8..13], + Dpl set_Dpl[13..15], + Pres set_Pres[15..16], + LimitHi set_LimitHi[16..20], + Sys set_Sys[20..21], + Reserved_0 set_Reserved_0[21..22], + Default_Big set_Default_Big[22..23], + Granularity set_Granularity[23..24], + BaseHi set_BaseHi[24..32], +]} +UNION!{union LDT_ENTRY_HighWord { + [u32; 1], + Bytes Bytes_mut: LDT_ENTRY_Bytes, + Bits Bits_mut: LDT_ENTRY_Bits, +}} +STRUCT!{struct LDT_ENTRY { + LimitLow: WORD, + BaseLow: WORD, + HighWord: LDT_ENTRY_HighWord, +}} +pub type PLDT_ENTRY = *mut LDT_ENTRY; +} // IFDEF(x86) +pub const WOW64_CONTEXT_i386: DWORD = 0x00010000; +pub const WOW64_CONTEXT_i486: DWORD = 0x00010000; +pub const WOW64_CONTEXT_CONTROL: DWORD = WOW64_CONTEXT_i386 | 0x00000001; +pub const WOW64_CONTEXT_INTEGER: DWORD = WOW64_CONTEXT_i386 | 0x00000002; +pub const WOW64_CONTEXT_SEGMENTS: DWORD = WOW64_CONTEXT_i386 | 0x00000004; +pub const WOW64_CONTEXT_FLOATING_POINT: DWORD = WOW64_CONTEXT_i386 | 0x00000008; +pub const WOW64_CONTEXT_DEBUG_REGISTERS: DWORD = WOW64_CONTEXT_i386 | 0x00000010; +pub const WOW64_CONTEXT_EXTENDED_REGISTERS: DWORD = WOW64_CONTEXT_i386 | 0x00000020; +pub const WOW64_CONTEXT_FULL: DWORD = WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER + | WOW64_CONTEXT_SEGMENTS; +pub const WOW64_CONTEXT_ALL: DWORD = WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER + | WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | WOW64_CONTEXT_DEBUG_REGISTERS + | WOW64_CONTEXT_EXTENDED_REGISTERS; +pub const WOW64_CONTEXT_XSTATE: DWORD = WOW64_CONTEXT_i386 | 0x00000040; +pub const WOW64_CONTEXT_EXCEPTION_ACTIVE: DWORD = 0x08000000; +pub const WOW64_CONTEXT_SERVICE_ACTIVE: DWORD = 0x10000000; +pub const WOW64_CONTEXT_EXCEPTION_REQUEST: DWORD = 0x40000000; +pub const WOW64_CONTEXT_EXCEPTION_REPORTING: DWORD = 0x80000000; +pub const WOW64_SIZE_OF_80387_REGISTERS: usize = 80; +pub const WOW64_MAXIMUM_SUPPORTED_EXTENSION: usize = 512; +STRUCT!{struct WOW64_FLOATING_SAVE_AREA { + ControlWord: DWORD, + StatusWord: DWORD, + TagWord: DWORD, + ErrorOffset: DWORD, + ErrorSelector: DWORD, + DataOffset: DWORD, + DataSelector: DWORD, + RegisterArea: [BYTE; WOW64_SIZE_OF_80387_REGISTERS], + Cr0NpxState: DWORD, +}} +pub type PWOW64_FLOATING_SAVE_AREA = *mut WOW64_FLOATING_SAVE_AREA; +STRUCT!{struct WOW64_CONTEXT { + ContextFlags: DWORD, + Dr0: DWORD, + Dr1: DWORD, + Dr2: DWORD, + Dr3: DWORD, + Dr4: DWORD, + Dr5: DWORD, + Dr6: DWORD, + Dr7: DWORD, + FloatSave: WOW64_FLOATING_SAVE_AREA, + SegGs: DWORD, + SegFs: DWORD, + SegEs: DWORD, + SegDs: DWORD, + Edi: DWORD, + Esi: DWORD, + Ebx: DWORD, + Edx: DWORD, + Ecx: DWORD, + Eax: DWORD, + Ebp: DWORD, + Eip: DWORD, + SegCs: DWORD, + EFlags: DWORD, + Esp: DWORD, + SegSs: DWORD, + ExtendedRegisters: [BYTE; WOW64_MAXIMUM_SUPPORTED_EXTENSION], +}} +pub type PWOW64_CONTEXT = *mut WOW64_CONTEXT; +STRUCT!{struct WOW64_LDT_ENTRY_Bytes { + BaseMid: BYTE, + Flags1: BYTE, + Flags2: BYTE, + BaseHi: BYTE, +}} +STRUCT!{struct WOW64_LDT_ENTRY_Bits { + BitFields: DWORD, +}} +BITFIELD!(WOW64_LDT_ENTRY_Bits BitFields: DWORD [ + BaseMid set_BaseMid[0..8], + Type set_Type[8..13], + Dpl set_Dpl[13..15], + Pres set_Pres[15..16], + LimitHi set_LimitHi[16..20], + Sys set_Sys[20..21], + Reserved_0 set_Reserved_0[21..22], + Default_Big set_Default_Big[22..23], + Granularity set_Granularity[23..24], + BaseHi set_BaseHi[24..32], +]); +UNION!{union WOW64_LDT_ENTRY_HighWord { + [u32; 1], + Bytes Bytes_mut: WOW64_LDT_ENTRY_Bytes, + Bits Bits_mut: WOW64_LDT_ENTRY_Bits, +}} +STRUCT!{struct WOW64_LDT_ENTRY { + LimitLow: WORD, + BaseLow: WORD, + HighWord: WOW64_LDT_ENTRY_HighWord, +}} +pub type PWOW64_LDT_ENTRY = *mut WOW64_LDT_ENTRY; +STRUCT!{struct WOW64_DESCRIPTOR_TABLE_ENTRY { + Selector: DWORD, + Descriptor: WOW64_LDT_ENTRY, +}} +pub type PWOW64_DESCRIPTOR_TABLE_ENTRY = *mut WOW64_DESCRIPTOR_TABLE_ENTRY; +pub const EXCEPTION_NONCONTINUABLE: DWORD = 0x1; +pub const EXCEPTION_UNWINDING: DWORD = 0x2; +pub const EXCEPTION_EXIT_UNWIND: DWORD = 0x4; +pub const EXCEPTION_STACK_INVALID: DWORD = 0x8; +pub const EXCEPTION_NESTED_CALL: DWORD = 0x10; +pub const EXCEPTION_TARGET_UNWIND: DWORD = 0x20; +pub const EXCEPTION_COLLIDED_UNWIND: DWORD = 0x40; +pub const EXCEPTION_UNWIND: DWORD = EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND + | EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND; +#[inline] +pub fn IS_UNWINDING(Flag: DWORD) -> bool { + (Flag & EXCEPTION_UNWIND) != 0 +} +#[inline] +pub fn IS_DISPATCHING(Flag: DWORD) -> bool { + (Flag & EXCEPTION_UNWIND) == 0 +} +#[inline] +pub fn IS_TARGET_UNWIND(Flag: DWORD) -> bool { + (Flag & EXCEPTION_TARGET_UNWIND) != 0 +} +pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15; +STRUCT!{struct EXCEPTION_RECORD { + ExceptionCode: DWORD, + ExceptionFlags: DWORD, + ExceptionRecord: *mut EXCEPTION_RECORD, + ExceptionAddress: PVOID, + NumberParameters: DWORD, + ExceptionInformation: [ULONG_PTR; EXCEPTION_MAXIMUM_PARAMETERS], +}} +pub type PEXCEPTION_RECORD = *mut EXCEPTION_RECORD; +STRUCT!{struct EXCEPTION_RECORD32 { + ExceptionCode: DWORD, + ExceptionFlags: DWORD, + ExceptionRecord: DWORD, + ExceptionAddress: DWORD, + NumberParameters: DWORD, + ExceptionInformation: [DWORD; EXCEPTION_MAXIMUM_PARAMETERS], +}} +pub type PEXCEPTION_RECORD32 = *mut EXCEPTION_RECORD32; +STRUCT!{struct EXCEPTION_RECORD64 { + ExceptionCode: DWORD, + ExceptionFlags: DWORD, + ExceptionRecord: DWORD64, + ExceptionAddress: DWORD64, + NumberParameters: DWORD, + __unusedAlignment: DWORD, + ExceptionInformation: [DWORD64; EXCEPTION_MAXIMUM_PARAMETERS], +}} +pub type PEXCEPTION_RECORD64 = *mut EXCEPTION_RECORD64; +STRUCT!{struct EXCEPTION_POINTERS { + ExceptionRecord: PEXCEPTION_RECORD, + ContextRecord: PCONTEXT, +}} +pub type PEXCEPTION_POINTERS = *mut EXCEPTION_POINTERS; +pub type PACCESS_TOKEN = PVOID; +pub type PSECURITY_DESCRIPTOR = PVOID; +pub type PSID = PVOID; +pub type PCLAIMS_BLOB = PVOID; +pub type ACCESS_MASK = DWORD; +pub type PACCESS_MASK = *mut ACCESS_MASK; +pub const DELETE: DWORD = 0x00010000; +pub const READ_CONTROL: DWORD = 0x00020000; +pub const WRITE_DAC: DWORD = 0x00040000; +pub const WRITE_OWNER: DWORD = 0x00080000; +pub const SYNCHRONIZE: DWORD = 0x00100000; +pub const STANDARD_RIGHTS_REQUIRED: DWORD = 0x000F0000; +pub const STANDARD_RIGHTS_READ: DWORD = READ_CONTROL; +pub const STANDARD_RIGHTS_WRITE: DWORD = READ_CONTROL; +pub const STANDARD_RIGHTS_EXECUTE: DWORD = READ_CONTROL; +pub const STANDARD_RIGHTS_ALL: DWORD = 0x001F0000; +pub const SPECIFIC_RIGHTS_ALL: DWORD = 0x0000FFFF; +pub const ACCESS_SYSTEM_SECURITY: DWORD = 0x01000000; +pub const MAXIMUM_ALLOWED: DWORD = 0x02000000; +pub const GENERIC_READ: DWORD = 0x80000000; +pub const GENERIC_WRITE: DWORD = 0x40000000; +pub const GENERIC_EXECUTE: DWORD = 0x20000000; +pub const GENERIC_ALL: DWORD = 0x10000000; +STRUCT!{struct GENERIC_MAPPING { + GenericRead: ACCESS_MASK, + GenericWrite: ACCESS_MASK, + GenericExecute: ACCESS_MASK, + GenericAll: ACCESS_MASK, +}} +pub type PGENERIC_MAPPING = *mut GENERIC_MAPPING; +STRUCT!{struct LUID_AND_ATTRIBUTES { + Luid: LUID, + Attributes: DWORD, +}} +pub type PLUID_AND_ATTRIBUTES = *mut LUID_AND_ATTRIBUTES; +pub type LUID_AND_ATTRIBUTES_ARRAY = LUID_AND_ATTRIBUTES; +pub type PLUID_AND_ATTRIBUTES_ARRAY = *mut LUID_AND_ATTRIBUTES; +STRUCT!{struct SID_IDENTIFIER_AUTHORITY { + Value: [BYTE; 6], +}} +pub type PSID_IDENTIFIER_AUTHORITY = *mut SID_IDENTIFIER_AUTHORITY; +STRUCT!{struct SID { + Revision: BYTE, + SubAuthorityCount: BYTE, + IdentifierAuthority: SID_IDENTIFIER_AUTHORITY, + SubAuthority: [DWORD; 1], +}} +pub type PISID = *mut SID; +pub const SID_REVISION: BYTE = 1; +pub const SID_MAX_SUB_AUTHORITIES: BYTE = 15; +pub const SID_RECOMMENDED_SUB_AUTHORITIES: BYTE = 1; +pub const SECURITY_MAX_SID_SIZE: usize = 12 - 4 + (SID_MAX_SUB_AUTHORITIES as usize * 4); +pub const SECURITY_MAX_SID_STRING_CHARACTERS: BYTE = 2 + 4 + 15 + (11 * SID_MAX_SUB_AUTHORITIES) + + 1; +UNION!{union SE_SID { + [u32; 17], + Sid Sid_mut: SID, + Buffer Buffer_mut: [BYTE; SECURITY_MAX_SID_SIZE], +}} +pub type PSE_SID = *mut SE_SID; +ENUM!{enum SID_NAME_USE { + SidTypeUser = 1, + SidTypeGroup, + SidTypeDomain, + SidTypeAlias, + SidTypeWellKnownGroup, + SidTypeDeletedAccount, + SidTypeInvalid, + SidTypeUnknown, + SidTypeComputer, + SidTypeLabel, + SidTypeLogonSession, +}} +pub type PSID_NAME_USE = *mut SID_NAME_USE; +STRUCT!{struct SID_AND_ATTRIBUTES { + Sid: PSID, + Attributes: DWORD, +}} +pub type PSID_AND_ATTRIBUTES = *mut SID_AND_ATTRIBUTES; +pub type SID_AND_ATTRIBUTES_ARRAY = SID_AND_ATTRIBUTES; +pub type PSID_AND_ATTRIBUTES_ARRAY = *mut SID_AND_ATTRIBUTES; +pub const SID_HASH_SIZE: usize = 32; +pub type SID_HASH_ENTRY = ULONG_PTR; +pub type PSID_HASH_ENTRY = *mut ULONG_PTR; +STRUCT!{struct SID_AND_ATTRIBUTES_HASH { + SidCount: DWORD, + SidAttr: PSID_AND_ATTRIBUTES, + Hash: [SID_HASH_ENTRY; SID_HASH_SIZE], +}} +pub type PSID_AND_ATTRIBUTES_HASH = *mut SID_AND_ATTRIBUTES_HASH; +pub const SECURITY_NULL_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 0]; +pub const SECURITY_WORLD_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 1]; +pub const SECURITY_LOCAL_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 2]; +pub const SECURITY_CREATOR_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 3]; +pub const SECURITY_NON_UNIQUE_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 4]; +pub const SECURITY_RESOURCE_MANAGER_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 9]; +pub const SECURITY_NULL_RID: DWORD = 0x00000000; +pub const SECURITY_WORLD_RID: DWORD = 0x00000000; +pub const SECURITY_LOCAL_RID: DWORD = 0x00000000; +pub const SECURITY_LOCAL_LOGON_RID: DWORD = 0x00000001; +pub const SECURITY_CREATOR_OWNER_RID: DWORD = 0x00000000; +pub const SECURITY_CREATOR_GROUP_RID: DWORD = 0x00000001; +pub const SECURITY_CREATOR_OWNER_SERVER_RID: DWORD = 0x00000002; +pub const SECURITY_CREATOR_GROUP_SERVER_RID: DWORD = 0x00000003; +pub const SECURITY_CREATOR_OWNER_RIGHTS_RID: DWORD = 0x00000004; +pub const SECURITY_NT_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 5]; +pub const SECURITY_DIALUP_RID: DWORD = 0x00000001; +pub const SECURITY_NETWORK_RID: DWORD = 0x00000002; +pub const SECURITY_BATCH_RID: DWORD = 0x00000003; +pub const SECURITY_INTERACTIVE_RID: DWORD = 0x00000004; +pub const SECURITY_LOGON_IDS_RID: DWORD = 0x00000005; +pub const SECURITY_LOGON_IDS_RID_COUNT: DWORD = 3; +pub const SECURITY_SERVICE_RID: DWORD = 0x00000006; +pub const SECURITY_ANONYMOUS_LOGON_RID: DWORD = 0x00000007; +pub const SECURITY_PROXY_RID: DWORD = 0x00000008; +pub const SECURITY_ENTERPRISE_CONTROLLERS_RID: DWORD = 0x00000009; +pub const SECURITY_SERVER_LOGON_RID: DWORD = SECURITY_ENTERPRISE_CONTROLLERS_RID; +pub const SECURITY_PRINCIPAL_SELF_RID: DWORD = 0x0000000A; +pub const SECURITY_AUTHENTICATED_USER_RID: DWORD = 0x0000000B; +pub const SECURITY_RESTRICTED_CODE_RID: DWORD = 0x0000000C; +pub const SECURITY_TERMINAL_SERVER_RID: DWORD = 0x0000000D; +pub const SECURITY_REMOTE_LOGON_RID: DWORD = 0x0000000E; +pub const SECURITY_THIS_ORGANIZATION_RID: DWORD = 0x0000000F; +pub const SECURITY_IUSER_RID: DWORD = 0x00000011; +pub const SECURITY_LOCAL_SYSTEM_RID: DWORD = 0x00000012; +pub const SECURITY_LOCAL_SERVICE_RID: DWORD = 0x00000013; +pub const SECURITY_NETWORK_SERVICE_RID: DWORD = 0x00000014; +pub const SECURITY_NT_NON_UNIQUE: DWORD = 0x00000015; +pub const SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT: DWORD = 3; +pub const SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID: DWORD = 0x00000016; +pub const SECURITY_BUILTIN_DOMAIN_RID: DWORD = 0x00000020; +pub const SECURITY_WRITE_RESTRICTED_CODE_RID: DWORD = 0x00000021; +pub const SECURITY_PACKAGE_BASE_RID: DWORD = 0x00000040; +pub const SECURITY_PACKAGE_RID_COUNT: DWORD = 2; +pub const SECURITY_PACKAGE_NTLM_RID: DWORD = 0x0000000A; +pub const SECURITY_PACKAGE_SCHANNEL_RID: DWORD = 0x0000000E; +pub const SECURITY_PACKAGE_DIGEST_RID: DWORD = 0x00000015; +pub const SECURITY_CRED_TYPE_BASE_RID: DWORD = 0x00000041; +pub const SECURITY_CRED_TYPE_RID_COUNT: DWORD = 2; +pub const SECURITY_CRED_TYPE_THIS_ORG_CERT_RID: DWORD = 0x00000001; +pub const SECURITY_MIN_BASE_RID: DWORD = 0x00000050; +pub const SECURITY_SERVICE_ID_BASE_RID: DWORD = 0x00000050; +pub const SECURITY_SERVICE_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_RESERVED_ID_BASE_RID: DWORD = 0x00000051; +pub const SECURITY_APPPOOL_ID_BASE_RID: DWORD = 0x00000052; +pub const SECURITY_APPPOOL_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_VIRTUALSERVER_ID_BASE_RID: DWORD = 0x00000053; +pub const SECURITY_VIRTUALSERVER_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_USERMODEDRIVERHOST_ID_BASE_RID: DWORD = 0x00000054; +pub const SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID: DWORD = 0x00000055; +pub const SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_WMIHOST_ID_BASE_RID: DWORD = 0x00000056; +pub const SECURITY_WMIHOST_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_TASK_ID_BASE_RID: DWORD = 0x00000057; +pub const SECURITY_NFS_ID_BASE_RID: DWORD = 0x00000058; +pub const SECURITY_COM_ID_BASE_RID: DWORD = 0x00000059; +pub const SECURITY_WINDOW_MANAGER_BASE_RID: DWORD = 0x0000005A; +pub const SECURITY_RDV_GFX_BASE_RID: DWORD = 0x0000005B; +pub const SECURITY_DASHOST_ID_BASE_RID: DWORD = 0x0000005C; +pub const SECURITY_DASHOST_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_USERMANAGER_ID_BASE_RID: DWORD = 0x0000005D; +pub const SECURITY_USERMANAGER_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_WINRM_ID_BASE_RID: DWORD = 0x0000005E; +pub const SECURITY_WINRM_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_CCG_ID_BASE_RID: DWORD = 0x0000005F; +pub const SECURITY_UMFD_BASE_RID: DWORD = 0x00000060; +pub const SECURITY_VIRTUALACCOUNT_ID_RID_COUNT: DWORD = 6; +pub const SECURITY_MAX_BASE_RID: DWORD = 0x0000006F; +pub const SECURITY_MAX_ALWAYS_FILTERED: DWORD = 0x000003E7; +pub const SECURITY_MIN_NEVER_FILTERED: DWORD = 0x000003E8; +pub const SECURITY_OTHER_ORGANIZATION_RID: DWORD = 0x000003E8; +pub const SECURITY_WINDOWSMOBILE_ID_BASE_RID: DWORD = 0x00000070; +pub const SECURITY_INSTALLER_GROUP_CAPABILITY_BASE: DWORD = 0x20; +pub const SECURITY_INSTALLER_GROUP_CAPABILITY_RID_COUNT: DWORD = 9; +pub const SECURITY_INSTALLER_CAPABILITY_RID_COUNT: DWORD = 10; +pub const SECURITY_LOCAL_ACCOUNT_RID: DWORD = 0x00000071; +pub const SECURITY_LOCAL_ACCOUNT_AND_ADMIN_RID: DWORD = 0x00000072; +pub const DOMAIN_GROUP_RID_AUTHORIZATION_DATA_IS_COMPOUNDED: DWORD = 0x000001F0; +pub const DOMAIN_GROUP_RID_AUTHORIZATION_DATA_CONTAINS_CLAIMS: DWORD = 0x000001F1; +pub const DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS: DWORD = 0x000001F2; +pub const FOREST_USER_RID_MAX: DWORD = 0x000001F3; +pub const DOMAIN_USER_RID_ADMIN: DWORD = 0x000001F4; +pub const DOMAIN_USER_RID_GUEST: DWORD = 0x000001F5; +pub const DOMAIN_USER_RID_KRBTGT: DWORD = 0x000001F6; +pub const DOMAIN_USER_RID_DEFAULT_ACCOUNT: DWORD = 0x000001F7; +pub const DOMAIN_USER_RID_MAX: DWORD = 0x000003E7; +pub const DOMAIN_GROUP_RID_ADMINS: DWORD = 0x00000200; +pub const DOMAIN_GROUP_RID_USERS: DWORD = 0x00000201; +pub const DOMAIN_GROUP_RID_GUESTS: DWORD = 0x00000202; +pub const DOMAIN_GROUP_RID_COMPUTERS: DWORD = 0x00000203; +pub const DOMAIN_GROUP_RID_CONTROLLERS: DWORD = 0x00000204; +pub const DOMAIN_GROUP_RID_CERT_ADMINS: DWORD = 0x00000205; +pub const DOMAIN_GROUP_RID_SCHEMA_ADMINS: DWORD = 0x00000206; +pub const DOMAIN_GROUP_RID_ENTERPRISE_ADMINS: DWORD = 0x00000207; +pub const DOMAIN_GROUP_RID_POLICY_ADMINS: DWORD = 0x00000208; +pub const DOMAIN_GROUP_RID_READONLY_CONTROLLERS: DWORD = 0x00000209; +pub const DOMAIN_GROUP_RID_CLONEABLE_CONTROLLERS: DWORD = 0x0000020A; +pub const DOMAIN_GROUP_RID_CDC_RESERVED: DWORD = 0x0000020C; +pub const DOMAIN_GROUP_RID_PROTECTED_USERS: DWORD = 0x0000020D; +pub const DOMAIN_GROUP_RID_KEY_ADMINS: DWORD = 0x0000020E; +pub const DOMAIN_GROUP_RID_ENTERPRISE_KEY_ADMINS: DWORD = 0x0000020F; +pub const DOMAIN_ALIAS_RID_ADMINS: DWORD = 0x00000220; +pub const DOMAIN_ALIAS_RID_USERS: DWORD = 0x00000221; +pub const DOMAIN_ALIAS_RID_GUESTS: DWORD = 0x00000222; +pub const DOMAIN_ALIAS_RID_POWER_USERS: DWORD = 0x00000223; +pub const DOMAIN_ALIAS_RID_ACCOUNT_OPS: DWORD = 0x00000224; +pub const DOMAIN_ALIAS_RID_SYSTEM_OPS: DWORD = 0x00000225; +pub const DOMAIN_ALIAS_RID_PRINT_OPS: DWORD = 0x00000226; +pub const DOMAIN_ALIAS_RID_BACKUP_OPS: DWORD = 0x00000227; +pub const DOMAIN_ALIAS_RID_REPLICATOR: DWORD = 0x00000228; +pub const DOMAIN_ALIAS_RID_RAS_SERVERS: DWORD = 0x00000229; +pub const DOMAIN_ALIAS_RID_PREW2KCOMPACCESS: DWORD = 0x0000022A; +pub const DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS: DWORD = 0x0000022B; +pub const DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS: DWORD = 0x0000022C; +pub const DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS: DWORD = 0x0000022D; +pub const DOMAIN_ALIAS_RID_MONITORING_USERS: DWORD = 0x0000022E; +pub const DOMAIN_ALIAS_RID_LOGGING_USERS: DWORD = 0x0000022F; +pub const DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS: DWORD = 0x00000230; +pub const DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS: DWORD = 0x00000231; +pub const DOMAIN_ALIAS_RID_DCOM_USERS: DWORD = 0x00000232; +pub const DOMAIN_ALIAS_RID_IUSERS: DWORD = 0x00000238; +pub const DOMAIN_ALIAS_RID_CRYPTO_OPERATORS: DWORD = 0x00000239; +pub const DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP: DWORD = 0x0000023B; +pub const DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP: DWORD = 0x0000023C; +pub const DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP: DWORD = 0x0000023D; +pub const DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP: DWORD = 0x0000023E; +pub const DOMAIN_ALIAS_RID_RDS_REMOTE_ACCESS_SERVERS: DWORD = 0x0000023F; +pub const DOMAIN_ALIAS_RID_RDS_ENDPOINT_SERVERS: DWORD = 0x00000240; +pub const DOMAIN_ALIAS_RID_RDS_MANAGEMENT_SERVERS: DWORD = 0x00000241; +pub const DOMAIN_ALIAS_RID_HYPER_V_ADMINS: DWORD = 0x00000242; +pub const DOMAIN_ALIAS_RID_ACCESS_CONTROL_ASSISTANCE_OPS: DWORD = 0x00000243; +pub const DOMAIN_ALIAS_RID_REMOTE_MANAGEMENT_USERS: DWORD = 0x00000244; +pub const DOMAIN_ALIAS_RID_DEFAULT_ACCOUNT: DWORD = 0x00000245; +pub const DOMAIN_ALIAS_RID_STORAGE_REPLICA_ADMINS: DWORD = 0x00000246; +pub const SECURITY_APP_PACKAGE_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 15]; +pub const SECURITY_APP_PACKAGE_BASE_RID: DWORD = 0x00000002; +pub const SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT: DWORD = 2; +pub const SECURITY_APP_PACKAGE_RID_COUNT: DWORD = 8; +pub const SECURITY_CAPABILITY_BASE_RID: DWORD = 0x00000003; +pub const SECURITY_CAPABILITY_APP_RID: DWORD = 0x00000040; +pub const SECURITY_BUILTIN_CAPABILITY_RID_COUNT: DWORD = 2; +pub const SECURITY_CAPABILITY_RID_COUNT: DWORD = 5; +pub const SECURITY_PARENT_PACKAGE_RID_COUNT: DWORD = SECURITY_APP_PACKAGE_RID_COUNT; +pub const SECURITY_CHILD_PACKAGE_RID_COUNT: DWORD = 12; +pub const SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE: DWORD = 0x00000001; +pub const SECURITY_BUILTIN_PACKAGE_ANY_RESTRICTED_PACKAGE: DWORD = 0x00000002; +pub const SECURITY_CAPABILITY_INTERNET_CLIENT: DWORD = 0x00000001; +pub const SECURITY_CAPABILITY_INTERNET_CLIENT_SERVER: DWORD = 0x00000002; +pub const SECURITY_CAPABILITY_PRIVATE_NETWORK_CLIENT_SERVER: DWORD = 0x00000003; +pub const SECURITY_CAPABILITY_PICTURES_LIBRARY: DWORD = 0x00000004; +pub const SECURITY_CAPABILITY_VIDEOS_LIBRARY: DWORD = 0x00000005; +pub const SECURITY_CAPABILITY_MUSIC_LIBRARY: DWORD = 0x00000006; +pub const SECURITY_CAPABILITY_DOCUMENTS_LIBRARY: DWORD = 0x00000007; +pub const SECURITY_CAPABILITY_ENTERPRISE_AUTHENTICATION: DWORD = 0x00000008; +pub const SECURITY_CAPABILITY_SHARED_USER_CERTIFICATES: DWORD = 0x00000009; +pub const SECURITY_CAPABILITY_REMOVABLE_STORAGE: DWORD = 0x0000000A; +pub const SECURITY_CAPABILITY_APPOINTMENTS: DWORD = 0x0000000B; +pub const SECURITY_CAPABILITY_CONTACTS: DWORD = 0x0000000C; +pub const SECURITY_CAPABILITY_INTERNET_EXPLORER: DWORD = 0x00001000; +pub const SECURITY_MANDATORY_LABEL_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 16]; +pub const SECURITY_MANDATORY_UNTRUSTED_RID: DWORD = 0x00000000; +pub const SECURITY_MANDATORY_LOW_RID: DWORD = 0x00001000; +pub const SECURITY_MANDATORY_MEDIUM_RID: DWORD = 0x00002000; +pub const SECURITY_MANDATORY_MEDIUM_PLUS_RID: DWORD = SECURITY_MANDATORY_MEDIUM_RID + 0x10; +pub const SECURITY_MANDATORY_HIGH_RID: DWORD = 0x00003000; +pub const SECURITY_MANDATORY_SYSTEM_RID: DWORD = 0x00004000; +pub const SECURITY_MANDATORY_MAXIMUM_USER_RID: DWORD = SECURITY_MANDATORY_SYSTEM_RID; +#[inline] +pub fn MANDATORY_LEVEL_TO_MANDATORY_RID(IL: DWORD) -> DWORD { + IL * 0x1000 +} +pub const SECURITY_SCOPED_POLICY_ID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 17]; +pub const SECURITY_AUTHENTICATION_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 18]; +pub const SECURITY_AUTHENTICATION_AUTHORITY_RID_COUNT: DWORD = 1; +pub const SECURITY_AUTHENTICATION_AUTHORITY_ASSERTED_RID: DWORD = 0x00000001; +pub const SECURITY_AUTHENTICATION_SERVICE_ASSERTED_RID: DWORD = 0x00000002; +pub const SECURITY_AUTHENTICATION_FRESH_KEY_AUTH_RID: DWORD = 0x00000003; +pub const SECURITY_AUTHENTICATION_KEY_TRUST_RID: DWORD = 0x00000004; +pub const SECURITY_AUTHENTICATION_KEY_PROPERTY_MFA_RID: DWORD = 0x00000005; +pub const SECURITY_AUTHENTICATION_KEY_PROPERTY_ATTESTATION_RID: DWORD = 0x00000006; +pub const SECURITY_PROCESS_TRUST_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 19]; +pub const SECURITY_PROCESS_TRUST_AUTHORITY_RID_COUNT: DWORD = 2; +pub const SECURITY_PROCESS_PROTECTION_TYPE_FULL_RID: DWORD = 0x00000400; +pub const SECURITY_PROCESS_PROTECTION_TYPE_LITE_RID: DWORD = 0x00000200; +pub const SECURITY_PROCESS_PROTECTION_TYPE_NONE_RID: DWORD = 0x00000000; +pub const SECURITY_PROCESS_PROTECTION_LEVEL_WINTCB_RID: DWORD = 0x00002000; +pub const SECURITY_PROCESS_PROTECTION_LEVEL_WINDOWS_RID: DWORD = 0x00001000; +pub const SECURITY_PROCESS_PROTECTION_LEVEL_APP_RID: DWORD = 0x00000800; +pub const SECURITY_PROCESS_PROTECTION_LEVEL_NONE_RID: DWORD = 0x00000000; +pub const SECURITY_TRUSTED_INSTALLER_RID1: DWORD = 95600888; +pub const SECURITY_TRUSTED_INSTALLER_RID2: DWORD = 341852264; +pub const SECURITY_TRUSTED_INSTALLER_RID3: DWORD = 183103804; +pub const SECURITY_TRUSTED_INSTALLER_RID4: DWORD = 185329263; +pub const SECURITY_TRUSTED_INSTALLER_RID5: DWORD = 227147846; +ENUM!{enum WELL_KNOWN_SID_TYPE { + WinNullSid = 0, + WinWorldSid = 1, + WinLocalSid = 2, + WinCreatorOwnerSid = 3, + WinCreatorGroupSid = 4, + WinCreatorOwnerServerSid = 5, + WinCreatorGroupServerSid = 6, + WinNtAuthoritySid = 7, + WinDialupSid = 8, + WinNetworkSid = 9, + WinBatchSid = 10, + WinInteractiveSid = 11, + WinServiceSid = 12, + WinAnonymousSid = 13, + WinProxySid = 14, + WinEnterpriseControllersSid = 15, + WinSelfSid = 16, + WinAuthenticatedUserSid = 17, + WinRestrictedCodeSid = 18, + WinTerminalServerSid = 19, + WinRemoteLogonIdSid = 20, + WinLogonIdsSid = 21, + WinLocalSystemSid = 22, + WinLocalServiceSid = 23, + WinNetworkServiceSid = 24, + WinBuiltinDomainSid = 25, + WinBuiltinAdministratorsSid = 26, + WinBuiltinUsersSid = 27, + WinBuiltinGuestsSid = 28, + WinBuiltinPowerUsersSid = 29, + WinBuiltinAccountOperatorsSid = 30, + WinBuiltinSystemOperatorsSid = 31, + WinBuiltinPrintOperatorsSid = 32, + WinBuiltinBackupOperatorsSid = 33, + WinBuiltinReplicatorSid = 34, + WinBuiltinPreWindows2000CompatibleAccessSid = 35, + WinBuiltinRemoteDesktopUsersSid = 36, + WinBuiltinNetworkConfigurationOperatorsSid = 37, + WinAccountAdministratorSid = 38, + WinAccountGuestSid = 39, + WinAccountKrbtgtSid = 40, + WinAccountDomainAdminsSid = 41, + WinAccountDomainUsersSid = 42, + WinAccountDomainGuestsSid = 43, + WinAccountComputersSid = 44, + WinAccountControllersSid = 45, + WinAccountCertAdminsSid = 46, + WinAccountSchemaAdminsSid = 47, + WinAccountEnterpriseAdminsSid = 48, + WinAccountPolicyAdminsSid = 49, + WinAccountRasAndIasServersSid = 50, + WinNTLMAuthenticationSid = 51, + WinDigestAuthenticationSid = 52, + WinSChannelAuthenticationSid = 53, + WinThisOrganizationSid = 54, + WinOtherOrganizationSid = 55, + WinBuiltinIncomingForestTrustBuildersSid = 56, + WinBuiltinPerfMonitoringUsersSid = 57, + WinBuiltinPerfLoggingUsersSid = 58, + WinBuiltinAuthorizationAccessSid = 59, + WinBuiltinTerminalServerLicenseServersSid = 60, + WinBuiltinDCOMUsersSid = 61, + WinBuiltinIUsersSid = 62, + WinIUserSid = 63, + WinBuiltinCryptoOperatorsSid = 64, + WinUntrustedLabelSid = 65, + WinLowLabelSid = 66, + WinMediumLabelSid = 67, + WinHighLabelSid = 68, + WinSystemLabelSid = 69, + WinWriteRestrictedCodeSid = 70, + WinCreatorOwnerRightsSid = 71, + WinCacheablePrincipalsGroupSid = 72, + WinNonCacheablePrincipalsGroupSid = 73, + WinEnterpriseReadonlyControllersSid = 74, + WinAccountReadonlyControllersSid = 75, + WinBuiltinEventLogReadersGroup = 76, + WinNewEnterpriseReadonlyControllersSid = 77, + WinBuiltinCertSvcDComAccessGroup = 78, + WinMediumPlusLabelSid = 79, + WinLocalLogonSid = 80, + WinConsoleLogonSid = 81, + WinThisOrganizationCertificateSid = 82, + WinApplicationPackageAuthoritySid = 83, + WinBuiltinAnyPackageSid = 84, + WinCapabilityInternetClientSid = 85, + WinCapabilityInternetClientServerSid = 86, + WinCapabilityPrivateNetworkClientServerSid = 87, + WinCapabilityPicturesLibrarySid = 88, + WinCapabilityVideosLibrarySid = 89, + WinCapabilityMusicLibrarySid = 90, + WinCapabilityDocumentsLibrarySid = 91, + WinCapabilitySharedUserCertificatesSid = 92, + WinCapabilityEnterpriseAuthenticationSid = 93, + WinCapabilityRemovableStorageSid = 94, + WinBuiltinRDSRemoteAccessServersSid = 95, + WinBuiltinRDSEndpointServersSid = 96, + WinBuiltinRDSManagementServersSid = 97, + WinUserModeDriversSid = 98, + WinBuiltinHyperVAdminsSid = 99, + WinAccountCloneableControllersSid = 100, + WinBuiltinAccessControlAssistanceOperatorsSid = 101, + WinBuiltinRemoteManagementUsersSid = 102, + WinAuthenticationAuthorityAssertedSid = 103, + WinAuthenticationServiceAssertedSid = 104, + WinLocalAccountSid = 105, + WinLocalAccountAndAdministratorSid = 106, + WinAccountProtectedUsersSid = 107, + WinCapabilityAppointmentsSid = 108, + WinCapabilityContactsSid = 109, + WinAccountDefaultSystemManagedSid = 110, + WinBuiltinDefaultSystemManagedGroupSid = 111, + WinBuiltinStorageReplicaAdminsSid = 112, + WinAccountKeyAdminsSid = 113, + WinAccountEnterpriseKeyAdminsSid = 114, + WinAuthenticationKeyTrustSid = 115, + WinAuthenticationKeyPropertyMFASid = 116, + WinAuthenticationKeyPropertyAttestationSid = 117, + WinAuthenticationFreshKeyAuthSid = 118, +}} +pub const SYSTEM_LUID: LUID = LUID { LowPart: 0x3e7, HighPart: 0x0 }; +pub const ANONYMOUS_LOGON_LUID: LUID = LUID { LowPart: 0x3e6, HighPart: 0x0 }; +pub const LOCALSERVICE_LUID: LUID = LUID { LowPart: 0x3e5, HighPart: 0x0 }; +pub const NETWORKSERVICE_LUID: LUID = LUID { LowPart: 0x3e4, HighPart: 0x0 }; +pub const IUSER_LUID: LUID = LUID { LowPart: 0x3e3, HighPart: 0x0 }; +pub const SE_GROUP_MANDATORY: DWORD = 0x00000001; +pub const SE_GROUP_ENABLED_BY_DEFAULT: DWORD = 0x00000002; +pub const SE_GROUP_ENABLED: DWORD = 0x00000004; +pub const SE_GROUP_OWNER: DWORD = 0x00000008; +pub const SE_GROUP_USE_FOR_DENY_ONLY: DWORD = 0x00000010; +pub const SE_GROUP_INTEGRITY: DWORD = 0x00000020; +pub const SE_GROUP_INTEGRITY_ENABLED: DWORD = 0x00000040; +pub const SE_GROUP_LOGON_ID: DWORD = 0xC0000000; +pub const SE_GROUP_RESOURCE: DWORD = 0x20000000; +pub const SE_GROUP_VALID_ATTRIBUTES: DWORD = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT + | SE_GROUP_ENABLED | SE_GROUP_OWNER | SE_GROUP_USE_FOR_DENY_ONLY | SE_GROUP_LOGON_ID + | SE_GROUP_RESOURCE | SE_GROUP_INTEGRITY | SE_GROUP_INTEGRITY_ENABLED; +pub const ACL_REVISION: BYTE = 2; +pub const ACL_REVISION_DS: BYTE = 4; +pub const ACL_REVISION1: BYTE = 1; +pub const MIN_ACL_REVISION: BYTE = ACL_REVISION2; +pub const ACL_REVISION2: BYTE = 2; +pub const ACL_REVISION3: BYTE = 3; +pub const ACL_REVISION4: BYTE = 4; +pub const MAX_ACL_REVISION: BYTE = ACL_REVISION4; +STRUCT!{struct ACL { + AclRevision: BYTE, + Sbz1: BYTE, + AclSize: WORD, + AceCount: WORD, + Sbz2: WORD, +}} +pub type PACL = *mut ACL; +STRUCT!{struct ACE_HEADER { + AceType: BYTE, + AceFlags: BYTE, + AceSize: WORD, +}} +pub type PACE_HEADER = *mut ACE_HEADER; +pub const ACCESS_MIN_MS_ACE_TYPE: BYTE = 0x0; +pub const ACCESS_ALLOWED_ACE_TYPE: BYTE = 0x0; +pub const ACCESS_DENIED_ACE_TYPE: BYTE = 0x1; +pub const SYSTEM_AUDIT_ACE_TYPE: BYTE = 0x2; +pub const SYSTEM_ALARM_ACE_TYPE: BYTE = 0x3; +pub const ACCESS_MAX_MS_V2_ACE_TYPE: BYTE = 0x3; +pub const ACCESS_ALLOWED_COMPOUND_ACE_TYPE: BYTE = 0x4; +pub const ACCESS_MAX_MS_V3_ACE_TYPE: BYTE = 0x4; +pub const ACCESS_MIN_MS_OBJECT_ACE_TYPE: BYTE = 0x5; +pub const ACCESS_ALLOWED_OBJECT_ACE_TYPE: BYTE = 0x5; +pub const ACCESS_DENIED_OBJECT_ACE_TYPE: BYTE = 0x6; +pub const SYSTEM_AUDIT_OBJECT_ACE_TYPE: BYTE = 0x7; +pub const SYSTEM_ALARM_OBJECT_ACE_TYPE: BYTE = 0x8; +pub const ACCESS_MAX_MS_OBJECT_ACE_TYPE: BYTE = 0x8; +pub const ACCESS_MAX_MS_V4_ACE_TYPE: BYTE = 0x8; +pub const ACCESS_MAX_MS_ACE_TYPE: BYTE = 0x8; +pub const ACCESS_ALLOWED_CALLBACK_ACE_TYPE: BYTE = 0x9; +pub const ACCESS_DENIED_CALLBACK_ACE_TYPE: BYTE = 0xA; +pub const ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0xB; +pub const ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0xC; +pub const SYSTEM_AUDIT_CALLBACK_ACE_TYPE: BYTE = 0xD; +pub const SYSTEM_ALARM_CALLBACK_ACE_TYPE: BYTE = 0xE; +pub const SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0xF; +pub const SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0x10; +pub const SYSTEM_MANDATORY_LABEL_ACE_TYPE: BYTE = 0x11; +pub const SYSTEM_RESOURCE_ATTRIBUTE_ACE_TYPE: BYTE = 0x12; +pub const SYSTEM_SCOPED_POLICY_ID_ACE_TYPE: BYTE = 0x13; +pub const SYSTEM_PROCESS_TRUST_LABEL_ACE_TYPE: BYTE = 0x14; +pub const SYSTEM_ACCESS_FILTER_ACE_TYPE: BYTE = 0x15; +pub const ACCESS_MAX_MS_V5_ACE_TYPE: BYTE = 0x15; +pub const OBJECT_INHERIT_ACE: BYTE = 0x1; +pub const CONTAINER_INHERIT_ACE: BYTE = 0x2; +pub const NO_PROPAGATE_INHERIT_ACE: BYTE = 0x4; +pub const INHERIT_ONLY_ACE: BYTE = 0x8; +pub const INHERITED_ACE: BYTE = 0x10; +pub const VALID_INHERIT_FLAGS: BYTE = 0x1F; +pub const SUCCESSFUL_ACCESS_ACE_FLAG: BYTE = 0x40; +pub const FAILED_ACCESS_ACE_FLAG: BYTE = 0x80; +pub const TRUST_PROTECTED_FILTER_ACE_FLAG: BYTE = 0x40; +STRUCT!{struct ACCESS_ALLOWED_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PACCESS_ALLOWED_ACE = *mut ACCESS_ALLOWED_ACE; +STRUCT!{struct ACCESS_DENIED_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PACCESS_DENIED_ACE = *mut ACCESS_DENIED_ACE; +STRUCT!{struct SYSTEM_AUDIT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_AUDIT_ACE = *mut SYSTEM_AUDIT_ACE; +STRUCT!{struct SYSTEM_ALARM_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_ALARM_ACE = *mut SYSTEM_ALARM_ACE; +STRUCT!{struct SYSTEM_RESOURCE_ATTRIBUTE_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_RESOURCE_ATTRIBUTE_ACE = *mut SYSTEM_RESOURCE_ATTRIBUTE_ACE; +STRUCT!{struct SYSTEM_SCOPED_POLICY_ID_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_SCOPED_POLICY_ID_ACE = *mut SYSTEM_SCOPED_POLICY_ID_ACE; +STRUCT!{struct SYSTEM_MANDATORY_LABEL_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_MANDATORY_LABEL_ACE = *mut SYSTEM_MANDATORY_LABEL_ACE; +STRUCT!{struct SYSTEM_PROCESS_TRUST_LABEL_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_PROCESS_TRUST_LABEL_ACE = *mut SYSTEM_PROCESS_TRUST_LABEL_ACE; +STRUCT!{struct SYSTEM_ACCESS_FILTER_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_ACCESS_FILTER_ACE = *mut SYSTEM_ACCESS_FILTER_ACE; +pub const SYSTEM_MANDATORY_LABEL_NO_WRITE_UP: ACCESS_MASK = 0x1; +pub const SYSTEM_MANDATORY_LABEL_NO_READ_UP: ACCESS_MASK = 0x2; +pub const SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP: ACCESS_MASK = 0x4; +pub const SYSTEM_MANDATORY_LABEL_VALID_MASK: ACCESS_MASK = SYSTEM_MANDATORY_LABEL_NO_WRITE_UP + | SYSTEM_MANDATORY_LABEL_NO_READ_UP | SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP; +pub const SYSTEM_PROCESS_TRUST_LABEL_VALID_MASK: ACCESS_MASK = 0x00ffffff; +pub const SYSTEM_PROCESS_TRUST_NOCONSTRAINT_MASK: ACCESS_MASK = 0xffffffff; +pub const SYSTEM_ACCESS_FILTER_VALID_MASK: ACCESS_MASK = 0x00ffffff; +pub const SYSTEM_ACCESS_FILTER_NOCONSTRAINT_MASK: ACCESS_MASK = 0xffffffff; +STRUCT!{struct ACCESS_ALLOWED_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PACCESS_ALLOWED_OBJECT_ACE = *mut ACCESS_ALLOWED_OBJECT_ACE; +STRUCT!{struct ACCESS_DENIED_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PACCESS_DENIED_OBJECT_ACE = *mut ACCESS_DENIED_OBJECT_ACE; +STRUCT!{struct SYSTEM_AUDIT_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PSYSTEM_AUDIT_OBJECT_ACE = *mut SYSTEM_AUDIT_OBJECT_ACE; +STRUCT!{struct SYSTEM_ALARM_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PSYSTEM_ALARM_OBJECT_ACE = *mut SYSTEM_ALARM_OBJECT_ACE; +STRUCT!{struct ACCESS_ALLOWED_CALLBACK_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PACCESS_ALLOWED_CALLBACK_ACE = *mut ACCESS_ALLOWED_CALLBACK_ACE; +STRUCT!{struct ACCESS_DENIED_CALLBACK_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PACCESS_DENIED_CALLBACK_ACE = *mut ACCESS_DENIED_CALLBACK_ACE; +STRUCT!{struct SYSTEM_AUDIT_CALLBACK_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_AUDIT_CALLBACK_ACE = *mut SYSTEM_AUDIT_CALLBACK_ACE; +STRUCT!{struct SYSTEM_ALARM_CALLBACK_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + SidStart: DWORD, +}} +pub type PSYSTEM_ALARM_CALLBACK_ACE = *mut SYSTEM_ALARM_CALLBACK_ACE; +STRUCT!{struct ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PACCESS_ALLOWED_CALLBACK_OBJECT_ACE = *mut ACCESS_ALLOWED_CALLBACK_OBJECT_ACE; +STRUCT!{struct ACCESS_DENIED_CALLBACK_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PACCESS_DENIED_CALLBACK_OBJECT_ACE = *mut ACCESS_DENIED_CALLBACK_OBJECT_ACE; +STRUCT!{struct SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE = *mut SYSTEM_AUDIT_CALLBACK_OBJECT_ACE; +STRUCT!{struct SYSTEM_ALARM_CALLBACK_OBJECT_ACE { + Header: ACE_HEADER, + Mask: ACCESS_MASK, + Flags: DWORD, + ObjectType: GUID, + InheritedObjectType: GUID, + SidStart: DWORD, +}} +pub type PSYSTEM_ALARM_CALLBACK_OBJECT_ACE = *mut SYSTEM_ALARM_CALLBACK_OBJECT_ACE; +pub const ACE_OBJECT_TYPE_PRESENT: DWORD = 0x1; +pub const ACE_INHERITED_OBJECT_TYPE_PRESENT: DWORD = 0x2; +ENUM!{enum ACL_INFORMATION_CLASS { + AclRevisionInformation = 1, + AclSizeInformation, +}} +STRUCT!{struct ACL_REVISION_INFORMATION { + AclRevision: DWORD, +}} +pub type PACL_REVISION_INFORMATION = *mut ACL_REVISION_INFORMATION; +STRUCT!{struct ACL_SIZE_INFORMATION { + AceCount: DWORD, + AclBytesInUse: DWORD, + AclBytesFree: DWORD, +}} +pub type PACL_SIZE_INFORMATION = *mut ACL_SIZE_INFORMATION; +pub const SECURITY_DESCRIPTOR_REVISION: DWORD = 1; +pub const SECURITY_DESCRIPTOR_REVISION1: DWORD = 1; +#[cfg(target_arch = "x86_64")] +pub const SECURITY_DESCRIPTOR_MIN_LENGTH: usize = 40; +#[cfg(target_arch = "x86")] +pub const SECURITY_DESCRIPTOR_MIN_LENGTH: usize = 20; +pub type SECURITY_DESCRIPTOR_CONTROL = WORD; +pub type PSECURITY_DESCRIPTOR_CONTROL = *mut WORD; +pub const SE_OWNER_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0001; +pub const SE_GROUP_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0002; +pub const SE_DACL_PRESENT: SECURITY_DESCRIPTOR_CONTROL = 0x0004; +pub const SE_DACL_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0008; +pub const SE_SACL_PRESENT: SECURITY_DESCRIPTOR_CONTROL = 0x0010; +pub const SE_SACL_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0020; +pub const SE_DACL_AUTO_INHERIT_REQ: SECURITY_DESCRIPTOR_CONTROL = 0x0100; +pub const SE_SACL_AUTO_INHERIT_REQ: SECURITY_DESCRIPTOR_CONTROL = 0x0200; +pub const SE_DACL_AUTO_INHERITED: SECURITY_DESCRIPTOR_CONTROL = 0x0400; +pub const SE_SACL_AUTO_INHERITED: SECURITY_DESCRIPTOR_CONTROL = 0x0800; +pub const SE_DACL_PROTECTED: SECURITY_DESCRIPTOR_CONTROL = 0x1000; +pub const SE_SACL_PROTECTED: SECURITY_DESCRIPTOR_CONTROL = 0x2000; +pub const SE_RM_CONTROL_VALID: SECURITY_DESCRIPTOR_CONTROL = 0x4000; +pub const SE_SELF_RELATIVE: SECURITY_DESCRIPTOR_CONTROL = 0x8000; +STRUCT!{struct SECURITY_DESCRIPTOR_RELATIVE { + Revision: BYTE, + Sbz1: BYTE, + Control: SECURITY_DESCRIPTOR_CONTROL, + Owner: DWORD, + Group: DWORD, + Sacl: DWORD, + Dacl: DWORD, +}} +pub type PISECURITY_DESCRIPTOR_RELATIVE = *mut SECURITY_DESCRIPTOR_RELATIVE; +STRUCT!{struct SECURITY_DESCRIPTOR { + Revision: BYTE, + Sbz1: BYTE, + Control: SECURITY_DESCRIPTOR_CONTROL, + Owner: DWORD, + Group: DWORD, + Sacl: DWORD, + Dacl: DWORD, +}} +pub type PISECURITY_DESCRIPTOR = *mut SECURITY_DESCRIPTOR; +STRUCT!{struct SECURITY_OBJECT_AI_PARAMS { + Size: DWORD, + ConstraintMask: DWORD, +}} +pub type PSECURITY_OBJECT_AI_PARAMS = *mut SECURITY_OBJECT_AI_PARAMS; +STRUCT!{struct OBJECT_TYPE_LIST { + Level: WORD, + Sbz: WORD, + ObjectType: *mut GUID, +}} +pub type POBJECT_TYPE_LIST = *mut OBJECT_TYPE_LIST; +pub const ACCESS_OBJECT_GUID: WORD = 0; +pub const ACCESS_PROPERTY_SET_GUID: WORD = 1; +pub const ACCESS_PROPERTY_GUID: WORD = 2; +pub const ACCESS_MAX_LEVEL: WORD = 4; +ENUM!{enum AUDIT_EVENT_TYPE { + AuditEventObjectAccess, + AuditEventDirectoryServiceAccess, +}} +pub const AUDIT_ALLOW_NO_PRIVILEGE: DWORD = 0x1; +pub const ACCESS_DS_SOURCE: &'static str = "DS"; +pub const ACCESS_DS_OBJECT_TYPE_NAME: &'static str = "Directory Service Object"; +pub const SE_PRIVILEGE_ENABLED_BY_DEFAULT: DWORD = 0x00000001; +pub const SE_PRIVILEGE_ENABLED: DWORD = 0x00000002; +pub const SE_PRIVILEGE_REMOVED: DWORD = 0x00000004; +pub const SE_PRIVILEGE_USED_FOR_ACCESS: DWORD = 0x80000000; +pub const SE_PRIVILEGE_VALID_ATTRIBUTES: DWORD = SE_PRIVILEGE_ENABLED_BY_DEFAULT + | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS; +pub const PRIVILEGE_SET_ALL_NECESSARY: DWORD = 1; +STRUCT!{struct PRIVILEGE_SET { + PrivilegeCount: DWORD, + Control: DWORD, + Privilege: [LUID_AND_ATTRIBUTES; ANYSIZE_ARRAY], +}} +pub type PPRIVILEGE_SET = *mut PRIVILEGE_SET; +pub const ACCESS_REASON_TYPE_MASK: ACCESS_REASON = 0x00ff0000; +pub const ACCESS_REASON_DATA_MASK: ACCESS_REASON = 0x0000ffff; +pub const ACCESS_REASON_STAGING_MASK: ACCESS_REASON = 0x80000000; +pub const ACCESS_REASON_EXDATA_MASK: ACCESS_REASON = 0x7f000000; +ENUM!{enum ACCESS_REASON_TYPE { + AccessReasonNone = 0x00000000, + AccessReasonAllowedAce = 0x00010000, + AccessReasonDeniedAce = 0x00020000, + AccessReasonAllowedParentAce = 0x00030000, + AccessReasonDeniedParentAce = 0x00040000, + AccessReasonNotGrantedByCape = 0x00050000, + AccessReasonNotGrantedByParentCape = 0x00060000, + AccessReasonNotGrantedToAppContainer = 0x00070000, + AccessReasonMissingPrivilege = 0x00100000, + AccessReasonFromPrivilege = 0x00200000, + AccessReasonIntegrityLevel = 0x00300000, + AccessReasonOwnership = 0x00400000, + AccessReasonNullDacl = 0x00500000, + AccessReasonEmptyDacl = 0x00600000, + AccessReasonNoSD = 0x00700000, + AccessReasonNoGrant = 0x00800000, + AccessReasonTrustLabel = 0x00900000, + AccessReasonFilterAce = 0x00a00000, +}} +pub type ACCESS_REASON = DWORD; +STRUCT!{struct ACCESS_REASONS { + Data: [ACCESS_REASON; 32], +}} +pub type PACCESS_REASONS = *mut ACCESS_REASONS; +pub const SE_SECURITY_DESCRIPTOR_FLAG_NO_OWNER_ACE: DWORD = 0x00000001; +pub const SE_SECURITY_DESCRIPTOR_FLAG_NO_LABEL_ACE: DWORD = 0x00000002; +pub const SE_SECURITY_DESCRIPTOR_FLAG_NO_ACCESS_FILTER_ACE: DWORD = 0x00000004; +pub const SE_SECURITY_DESCRIPTOR_VALID_FLAGS: DWORD = 0x00000007; +STRUCT!{struct SE_SECURITY_DESCRIPTOR { + Size: DWORD, + Flags: DWORD, + SecurityDescriptor: PSECURITY_DESCRIPTOR, +}} +pub type PSE_SECURITY_DESCRIPTOR = *mut SE_SECURITY_DESCRIPTOR; +STRUCT!{struct SE_ACCESS_REQUEST { + Size: DWORD, + SeSecurityDescriptor: PSE_SECURITY_DESCRIPTOR, + DesiredAccess: ACCESS_MASK, + PreviouslyGrantedAccess: ACCESS_MASK, + PrincipalSelfSid: PSID, + GenericMapping: PGENERIC_MAPPING, + ObjectTypeListCount: DWORD, + ObjectTypeList: POBJECT_TYPE_LIST, +}} +pub type PSE_ACCESS_REQUEST = *mut SE_ACCESS_REQUEST; +STRUCT!{struct SE_ACCESS_REPLY { + Size: DWORD, + ResultListCount: DWORD, + GrantedAccess: PACCESS_MASK, + AccessStatus: PDWORD, + AccessReason: PACCESS_REASONS, + Privileges: *mut PPRIVILEGE_SET, +}} +pub type PSE_ACCESS_REPLY = *mut SE_ACCESS_REPLY; +pub const SE_CREATE_TOKEN_NAME: &'static str = "SeCreateTokenPrivilege"; +pub const SE_ASSIGNPRIMARYTOKEN_NAME: &'static str = "SeAssignPrimaryTokenPrivilege"; +pub const SE_LOCK_MEMORY_NAME: &'static str = "SeLockMemoryPrivilege"; +pub const SE_INCREASE_QUOTA_NAME: &'static str = "SeIncreaseQuotaPrivilege"; +pub const SE_UNSOLICITED_INPUT_NAME: &'static str = "SeUnsolicitedInputPrivilege"; +pub const SE_MACHINE_ACCOUNT_NAME: &'static str = "SeMachineAccountPrivilege"; +pub const SE_TCB_NAME: &'static str = "SeTcbPrivilege"; +pub const SE_SECURITY_NAME: &'static str = "SeSecurityPrivilege"; +pub const SE_TAKE_OWNERSHIP_NAME: &'static str = "SeTakeOwnershipPrivilege"; +pub const SE_LOAD_DRIVER_NAME: &'static str = "SeLoadDriverPrivilege"; +pub const SE_SYSTEM_PROFILE_NAME: &'static str = "SeSystemProfilePrivilege"; +pub const SE_SYSTEMTIME_NAME: &'static str = "SeSystemtimePrivilege"; +pub const SE_PROF_SINGLE_PROCESS_NAME: &'static str = "SeProfileSingleProcessPrivilege"; +pub const SE_INC_BASE_PRIORITY_NAME: &'static str = "SeIncreaseBasePriorityPrivilege"; +pub const SE_CREATE_PAGEFILE_NAME: &'static str = "SeCreatePagefilePrivilege"; +pub const SE_CREATE_PERMANENT_NAME: &'static str = "SeCreatePermanentPrivilege"; +pub const SE_BACKUP_NAME: &'static str = "SeBackupPrivilege"; +pub const SE_RESTORE_NAME: &'static str = "SeRestorePrivilege"; +pub const SE_SHUTDOWN_NAME: &'static str = "SeShutdownPrivilege"; +pub const SE_DEBUG_NAME: &'static str = "SeDebugPrivilege"; +pub const SE_AUDIT_NAME: &'static str = "SeAuditPrivilege"; +pub const SE_SYSTEM_ENVIRONMENT_NAME: &'static str = "SeSystemEnvironmentPrivilege"; +pub const SE_CHANGE_NOTIFY_NAME: &'static str = "SeChangeNotifyPrivilege"; +pub const SE_REMOTE_SHUTDOWN_NAME: &'static str = "SeRemoteShutdownPrivilege"; +pub const SE_UNDOCK_NAME: &'static str = "SeUndockPrivilege"; +pub const SE_SYNC_AGENT_NAME: &'static str = "SeSyncAgentPrivilege"; +pub const SE_ENABLE_DELEGATION_NAME: &'static str = "SeEnableDelegationPrivilege"; +pub const SE_MANAGE_VOLUME_NAME: &'static str = "SeManageVolumePrivilege"; +pub const SE_IMPERSONATE_NAME: &'static str = "SeImpersonatePrivilege"; +pub const SE_CREATE_GLOBAL_NAME: &'static str = "SeCreateGlobalPrivilege"; +pub const SE_TRUSTED_CREDMAN_ACCESS_NAME: &'static str = "SeTrustedCredManAccessPrivilege"; +pub const SE_RELABEL_NAME: &'static str = "SeRelabelPrivilege"; +pub const SE_INC_WORKING_SET_NAME: &'static str = "SeIncreaseWorkingSetPrivilege"; +pub const SE_TIME_ZONE_NAME: &'static str = "SeTimeZonePrivilege"; +pub const SE_CREATE_SYMBOLIC_LINK_NAME: &'static str = "SeCreateSymbolicLinkPrivilege"; +pub const SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME: &'static str + = "SeDelegateSessionUserImpersonatePrivilege"; +pub const SE_ACTIVATE_AS_USER_CAPABILITY: &'static str = "activateAsUser"; +pub const SE_CONSTRAINED_IMPERSONATION_CAPABILITY: &'static str = "constrainedImpersonation"; +pub const SE_SESSION_IMPERSONATION_CAPABILITY: &'static str = "sessionImpersonation"; +pub const SE_MUMA_CAPABILITY: &'static str = "muma"; +pub const SE_DEVELOPMENT_MODE_NETWORK_CAPABILITY: &'static str = "developmentModeNetwork"; +ENUM!{enum SECURITY_IMPERSONATION_LEVEL { + SecurityAnonymous, + SecurityIdentification, + SecurityImpersonation, + SecurityDelegation, +}} +pub type PSECURITY_IMPERSONATION_LEVEL = *mut SECURITY_IMPERSONATION_LEVEL; +pub const SECURITY_MAX_IMPERSONATION_LEVEL: SECURITY_IMPERSONATION_LEVEL = SecurityDelegation; +pub const SECURITY_MIN_IMPERSONATION_LEVEL: SECURITY_IMPERSONATION_LEVEL = SecurityAnonymous; +pub const DEFAULT_IMPERSONATION_LEVEL: SECURITY_IMPERSONATION_LEVEL = SecurityImpersonation; +#[inline] +pub fn VALID_IMPERSONATION_LEVEL(L: SECURITY_IMPERSONATION_LEVEL) -> bool { + (L >= SECURITY_MIN_IMPERSONATION_LEVEL) && (L <= SECURITY_MAX_IMPERSONATION_LEVEL) +} +pub const TOKEN_ASSIGN_PRIMARY: DWORD = 0x0001; +pub const TOKEN_DUPLICATE: DWORD = 0x0002; +pub const TOKEN_IMPERSONATE: DWORD = 0x0004; +pub const TOKEN_QUERY: DWORD = 0x0008; +pub const TOKEN_QUERY_SOURCE: DWORD = 0x0010; +pub const TOKEN_ADJUST_PRIVILEGES: DWORD = 0x0020; +pub const TOKEN_ADJUST_GROUPS: DWORD = 0x0040; +pub const TOKEN_ADJUST_DEFAULT: DWORD = 0x0080; +pub const TOKEN_ADJUST_SESSIONID: DWORD = 0x0100; +pub const TOKEN_ALL_ACCESS_P: DWORD = STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY + | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE + | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT; +pub const TOKEN_ALL_ACCESS: DWORD = TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID; +pub const TOKEN_READ: DWORD = STANDARD_RIGHTS_READ | TOKEN_QUERY; +pub const TOKEN_WRITE: DWORD = STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES + | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT; +pub const TOKEN_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE; +pub const TOKEN_TRUST_CONSTRAINT_MASK: DWORD = STANDARD_RIGHTS_READ | TOKEN_QUERY + | TOKEN_QUERY_SOURCE; +pub const TOKEN_ACCESS_PSEUDO_HANDLE_WIN8: DWORD = TOKEN_QUERY | TOKEN_QUERY_SOURCE; +pub const TOKEN_ACCESS_PSEUDO_HANDLE: DWORD = TOKEN_ACCESS_PSEUDO_HANDLE_WIN8; +ENUM!{enum TOKEN_TYPE { + TokenPrimary = 1, + TokenImpersonation, +}} +pub type PTOKEN_TYPE = *mut TOKEN_TYPE; +ENUM!{enum TOKEN_ELEVATION_TYPE { + TokenElevationTypeDefault = 1, + TokenElevationTypeFull, + TokenElevationTypeLimited, +}} +pub type PTOKEN_ELEVATION_TYPE = *mut TOKEN_ELEVATION_TYPE; +ENUM!{enum TOKEN_INFORMATION_CLASS { + TokenUser = 1, + TokenGroups, + TokenPrivileges, + TokenOwner, + TokenPrimaryGroup, + TokenDefaultDacl, + TokenSource, + TokenType, + TokenImpersonationLevel, + TokenStatistics, + TokenRestrictedSids, + TokenSessionId, + TokenGroupsAndPrivileges, + TokenSessionReference, + TokenSandBoxInert, + TokenAuditPolicy, + TokenOrigin, + TokenElevationType, + TokenLinkedToken, + TokenElevation, + TokenHasRestrictions, + TokenAccessInformation, + TokenVirtualizationAllowed, + TokenVirtualizationEnabled, + TokenIntegrityLevel, + TokenUIAccess, + TokenMandatoryPolicy, + TokenLogonSid, + TokenIsAppContainer, + TokenCapabilities, + TokenAppContainerSid, + TokenAppContainerNumber, + TokenUserClaimAttributes, + TokenDeviceClaimAttributes, + TokenRestrictedUserClaimAttributes, + TokenRestrictedDeviceClaimAttributes, + TokenDeviceGroups, + TokenRestrictedDeviceGroups, + TokenSecurityAttributes, + TokenIsRestricted, + TokenProcessTrustLevel, + TokenPrivateNameSpace, + TokenSingletonAttributes, + TokenBnoIsolation, + MaxTokenInfoClass, +}} +pub type PTOKEN_INFORMATION_CLASS = *mut TOKEN_INFORMATION_CLASS; +STRUCT!{struct TOKEN_USER { + User: SID_AND_ATTRIBUTES, +}} +pub type PTOKEN_USER = *mut TOKEN_USER; +UNION!{union SE_TOKEN_USER_u1 { + [usize; 2], + TokenUser TokenUser_mut: TOKEN_USER, + User User_mut: SID_AND_ATTRIBUTES, +}} +UNION!{union SE_TOKEN_USER_u2 { + [u32; 17], + Sid Sid_mut: SID, + Buffer Buffer_mut: [BYTE; SECURITY_MAX_SID_SIZE], +}} +STRUCT!{struct SE_TOKEN_USER { + u1: SE_TOKEN_USER_u1, + u2: SE_TOKEN_USER_u2, +}} +pub type PSE_TOKEN_USER = *mut SE_TOKEN_USER; +STRUCT!{struct TOKEN_GROUPS { + GroupCount: DWORD, + Groups: [SID_AND_ATTRIBUTES; ANYSIZE_ARRAY], +}} +pub type PTOKEN_GROUPS = *mut TOKEN_GROUPS; +STRUCT!{struct TOKEN_PRIVILEGES { + PrivilegeCount: DWORD, + Privileges: [LUID_AND_ATTRIBUTES; ANYSIZE_ARRAY], +}} +pub type PTOKEN_PRIVILEGES = *mut TOKEN_PRIVILEGES; +STRUCT!{struct TOKEN_OWNER { + Owner: PSID, +}} +pub type PTOKEN_OWNER = *mut TOKEN_OWNER; +STRUCT!{struct TOKEN_PRIMARY_GROUP { + PrimaryGroup: PSID, +}} +pub type PTOKEN_PRIMARY_GROUP = *mut TOKEN_PRIMARY_GROUP; +STRUCT!{struct TOKEN_DEFAULT_DACL { + DefaultDacl: PACL, +}} +pub type PTOKEN_DEFAULT_DACL = *mut TOKEN_DEFAULT_DACL; +STRUCT!{struct TOKEN_USER_CLAIMS { + UserClaims: PCLAIMS_BLOB, +}} +pub type PTOKEN_USER_CLAIMS = *mut TOKEN_USER_CLAIMS; +STRUCT!{struct TOKEN_DEVICE_CLAIMS { + DeviceClaims: PCLAIMS_BLOB, +}} +pub type PTOKEN_DEVICE_CLAIMS = *mut TOKEN_DEVICE_CLAIMS; +STRUCT!{struct TOKEN_GROUPS_AND_PRIVILEGES { + SidCount: DWORD, + SidLength: DWORD, + Sids: PSID_AND_ATTRIBUTES, + RestrictedSidCount: DWORD, + RestrictedSidLength: DWORD, + RestrictedSids: PSID_AND_ATTRIBUTES, + PrivilegeCount: DWORD, + PrivilegeLength: DWORD, + Privileges: PLUID_AND_ATTRIBUTES, + AuthenticationId: LUID, +}} +pub type PTOKEN_GROUPS_AND_PRIVILEGES = *mut TOKEN_GROUPS_AND_PRIVILEGES; +STRUCT!{struct TOKEN_LINKED_TOKEN { + LinkedToken: HANDLE, +}} +pub type PTOKEN_LINKED_TOKEN = *mut TOKEN_LINKED_TOKEN; +STRUCT!{struct TOKEN_ELEVATION { + TokenIsElevated: DWORD, +}} +pub type PTOKEN_ELEVATION = *mut TOKEN_ELEVATION; +STRUCT!{struct TOKEN_MANDATORY_LABEL { + Label: SID_AND_ATTRIBUTES, +}} +pub type PTOKEN_MANDATORY_LABEL = *mut TOKEN_MANDATORY_LABEL; +pub const TOKEN_MANDATORY_POLICY_OFF: DWORD = 0x0; +pub const TOKEN_MANDATORY_POLICY_NO_WRITE_UP: DWORD = 0x1; +pub const TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN: DWORD = 0x2; +pub const TOKEN_MANDATORY_POLICY_VALID_MASK: DWORD = TOKEN_MANDATORY_POLICY_NO_WRITE_UP + | TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN; +STRUCT!{struct TOKEN_MANDATORY_POLICY { + Policy: DWORD, +}} +pub type PTOKEN_MANDATORY_POLICY = *mut TOKEN_MANDATORY_POLICY; +pub type PSECURITY_ATTRIBUTES_OPAQUE = PVOID; +STRUCT!{struct TOKEN_ACCESS_INFORMATION { + SidHash: PSID_AND_ATTRIBUTES_HASH, + RestrictedSidHash: PSID_AND_ATTRIBUTES_HASH, + Privileges: PTOKEN_PRIVILEGES, + AuthenticationId: LUID, + TokenType: TOKEN_TYPE, + ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL, + MandatoryPolicy: TOKEN_MANDATORY_POLICY, + Flags: DWORD, + AppContainerNumber: DWORD, + PackageSid: PSID, + CapabilitiesHash: PSID_AND_ATTRIBUTES_HASH, + TrustLevelSid: PSID, + SecurityAttributes: PSECURITY_ATTRIBUTES_OPAQUE, +}} +pub type PTOKEN_ACCESS_INFORMATION = *mut TOKEN_ACCESS_INFORMATION; +pub const POLICY_AUDIT_SUBCATEGORY_COUNT: usize = 59; +STRUCT!{struct TOKEN_AUDIT_POLICY { + PerUserPolicy: [BYTE; (POLICY_AUDIT_SUBCATEGORY_COUNT >> 1) + 1], +}} +pub type PTOKEN_AUDIT_POLICY = *mut TOKEN_AUDIT_POLICY; +pub const TOKEN_SOURCE_LENGTH: usize = 8; +STRUCT!{struct TOKEN_SOURCE { + SourceName: [CHAR; TOKEN_SOURCE_LENGTH], + SourceIdentifier: LUID, +}} +pub type PTOKEN_SOURCE = *mut TOKEN_SOURCE; +STRUCT!{struct TOKEN_STATISTICS { + TokenId: LUID, + AuthenticationId: LUID, + ExpirationTime: LARGE_INTEGER, + TokenType: TOKEN_TYPE, + ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL, + DynamicCharged: DWORD, + DynamicAvailable: DWORD, + GroupCount: DWORD, + PrivilegeCount: DWORD, + ModifiedId: LUID, +}} +pub type PTOKEN_STATISTICS = *mut TOKEN_STATISTICS; +STRUCT!{struct TOKEN_CONTROL { + TokenId: LUID, + AuthenticationId: LUID, + ModifiedId: LUID, + TokenSource: TOKEN_SOURCE, +}} +pub type PTOKEN_CONTROL = *mut TOKEN_CONTROL; +STRUCT!{struct TOKEN_ORIGIN { + OriginatingLogonSession: LUID, +}} +pub type PTOKEN_ORIGIN = *mut TOKEN_ORIGIN; +ENUM!{enum MANDATORY_LEVEL { + MandatoryLevelUntrusted = 0, + MandatoryLevelLow, + MandatoryLevelMedium, + MandatoryLevelHigh, + MandatoryLevelSystem, + MandatoryLevelSecureProcess, + MandatoryLevelCount, +}} +pub type PMANDATORY_LEVEL = *mut MANDATORY_LEVEL; +STRUCT!{struct TOKEN_APPCONTAINER_INFORMATION { + TokenAppContainer: PSID, +}} +pub type PTOKEN_APPCONTAINER_INFORMATION = *mut TOKEN_APPCONTAINER_INFORMATION; +STRUCT!{struct TOKEN_SID_INFORMATION { + Sid: PSID, +}} +pub type PTOKEN_SID_INFORMATION = *mut TOKEN_SID_INFORMATION; +STRUCT!{struct TOKEN_BNO_ISOLATION_INFORMATION { + IsolationPrefix: PWSTR, + IsolationEnabled: BOOLEAN, +}} +pub type PTOKEN_BNO_ISOLATION_INFORMATION = *mut TOKEN_BNO_ISOLATION_INFORMATION; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INVALID: WORD = 0x00; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64: WORD = 0x01; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64: WORD = 0x02; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING: WORD = 0x03; +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { + Version: DWORD64, + Name: PWSTR, +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE = *mut CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN: WORD = 0x04; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_SID: WORD = 0x05; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN: WORD = 0x06; +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { + pValue: PVOID, + ValueLength: DWORD, +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE = + *mut CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE; +pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING: WORD = 0x10; +pub const CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE: DWORD = 0x0001; +pub const CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE: DWORD = 0x0002; +pub const CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY: DWORD = 0x0004; +pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT: DWORD = 0x0008; +pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED: DWORD = 0x0010; +pub const CLAIM_SECURITY_ATTRIBUTE_MANDATORY: DWORD = 0x0020; +pub const CLAIM_SECURITY_ATTRIBUTE_VALID_FLAGS: DWORD = CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE + | CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE | CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY + | CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT | CLAIM_SECURITY_ATTRIBUTE_DISABLED + | CLAIM_SECURITY_ATTRIBUTE_MANDATORY; +pub const CLAIM_SECURITY_ATTRIBUTE_CUSTOM_FLAGS: DWORD = 0xFFFF0000; +UNION!{union CLAIM_SECURITY_ATTRIBUTE_V1_Values { + [usize; 1], + pInt64 pInt64_mut: PLONG64, + pUint64 pUint64_mut: PDWORD64, + ppString ppString_mut: PWSTR, + pFqbn pFqbn_mut: PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE, + pOctetString pOctetString_mut: PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE, +}} +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_V1 { + Name: PWSTR, + ValueType: WORD, + Reserved: WORD, + Flags: DWORD, + ValueCount: DWORD, + Values: CLAIM_SECURITY_ATTRIBUTE_V1_Values, +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_V1; +UNION!{union CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_Values { + [u32; 1], + pInt64 pInt64_mut: [DWORD; ANYSIZE_ARRAY], + pUint64 pUint64_mut: [DWORD; ANYSIZE_ARRAY], + ppString ppString_mut: [DWORD; ANYSIZE_ARRAY], + pFqbn pFqbn_mut: [DWORD; ANYSIZE_ARRAY], + pOctetString pOctetString_mut: [DWORD; ANYSIZE_ARRAY], +}} +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { + Name: DWORD, + ValueType: WORD, + Reserved: WORD, + Flags: DWORD, + ValueCount: DWORD, + Values: CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_Values, +}} +pub type PCLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1; +pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1: WORD = 1; +pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION: WORD = + CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1; +UNION!{union CLAIM_SECURITY_ATTRIBUTES_INFORMATION_Attribute { + [usize; 1], + pAttributeV1 pAttributeV1_mut: PCLAIM_SECURITY_ATTRIBUTE_V1, +}} +STRUCT!{struct CLAIM_SECURITY_ATTRIBUTES_INFORMATION { + Version: WORD, + Reserved: WORD, + AttributeCount: DWORD, + Attribute: CLAIM_SECURITY_ATTRIBUTES_INFORMATION_Attribute, +}} +pub type PCLAIM_SECURITY_ATTRIBUTES_INFORMATION = *mut CLAIM_SECURITY_ATTRIBUTES_INFORMATION; +pub const SECURITY_DYNAMIC_TRACKING: BOOLEAN = TRUE as u8; +pub const SECURITY_STATIC_TRACKING: BOOLEAN = FALSE as u8; +pub type SECURITY_CONTEXT_TRACKING_MODE = BOOLEAN; +pub type PSECURITY_CONTEXT_TRACKING_MODE = *mut BOOLEAN; +STRUCT!{struct SECURITY_QUALITY_OF_SERVICE { + Length: DWORD, + ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL, + ContextTrackingMode: SECURITY_CONTEXT_TRACKING_MODE, + EffectiveOnly: BOOLEAN, +}} +pub type PSECURITY_QUALITY_OF_SERVICE = *mut SECURITY_QUALITY_OF_SERVICE; +STRUCT!{struct SE_IMPERSONATION_STATE { + Token: PACCESS_TOKEN, + CopyOnOpen: BOOLEAN, + EffectiveOnly: BOOLEAN, + Level: SECURITY_IMPERSONATION_LEVEL, +}} +pub type PSE_IMPERSONATION_STATE = *mut SE_IMPERSONATION_STATE; +pub const DISABLE_MAX_PRIVILEGE: DWORD = 0x1; +pub const SANDBOX_INERT: DWORD = 0x2; +pub const LUA_TOKEN: DWORD = 0x4; +pub const WRITE_RESTRICTED: DWORD = 0x8; +pub type SECURITY_INFORMATION = DWORD; +pub type PSECURITY_INFORMATION = *mut DWORD; +pub const OWNER_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000001; +pub const GROUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000002; +pub const DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000004; +pub const SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000008; +pub const LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000010; +pub const ATTRIBUTE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000020; +pub const SCOPE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000040; +pub const PROCESS_TRUST_LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000080; +pub const ACCESS_FILTER_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000100; +pub const BACKUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00010000; +pub const PROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x80000000; +pub const PROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x40000000; +pub const UNPROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x20000000; +pub const UNPROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x10000000; +pub type SE_SIGNING_LEVEL = BYTE; +pub type PSE_SIGNING_LEVEL = *mut BYTE; +pub const SE_SIGNING_LEVEL_UNCHECKED: BYTE = 0x00000000; +pub const SE_SIGNING_LEVEL_UNSIGNED: BYTE = 0x00000001; +pub const SE_SIGNING_LEVEL_ENTERPRISE: BYTE = 0x00000002; +pub const SE_SIGNING_LEVEL_CUSTOM_1: BYTE = 0x00000003; +pub const SE_SIGNING_LEVEL_AUTHENTICODE: BYTE = 0x00000004; +pub const SE_SIGNING_LEVEL_CUSTOM_2: BYTE = 0x00000005; +pub const SE_SIGNING_LEVEL_STORE: BYTE = 0x00000006; +pub const SE_SIGNING_LEVEL_CUSTOM_3: BYTE = 0x00000007; +pub const SE_SIGNING_LEVEL_ANTIMALWARE: BYTE = SE_SIGNING_LEVEL_CUSTOM_3; +pub const SE_SIGNING_LEVEL_MICROSOFT: BYTE = 0x00000008; +pub const SE_SIGNING_LEVEL_CUSTOM_4: BYTE = 0x00000009; +pub const SE_SIGNING_LEVEL_CUSTOM_5: BYTE = 0x0000000A; +pub const SE_SIGNING_LEVEL_DYNAMIC_CODEGEN: BYTE = 0x0000000B; +pub const SE_SIGNING_LEVEL_WINDOWS: BYTE = 0x0000000C; +pub const SE_SIGNING_LEVEL_CUSTOM_7: BYTE = 0x0000000D; +pub const SE_SIGNING_LEVEL_WINDOWS_TCB: BYTE = 0x0000000E; +pub const SE_SIGNING_LEVEL_CUSTOM_6: BYTE = 0x0000000F; +ENUM!{enum SE_IMAGE_SIGNATURE_TYPE { + SeImageSignatureNone = 0, + SeImageSignatureEmbedded, + SeImageSignatureCache, + SeImageSignatureCatalogCached, + SeImageSignatureCatalogNotCached, + SeImageSignatureCatalogHint, + SeImageSignaturePackageCatalog, +}} +pub type PSE_IMAGE_SIGNATURE_TYPE = *mut SE_IMAGE_SIGNATURE_TYPE; +ENUM!{enum SE_LEARNING_MODE_DATA_TYPE { + SeLearningModeInvalidType = 0, + SeLearningModeSettings, + SeLearningModeMax, +}} +STRUCT!{struct SECURITY_CAPABILITIES { + AppContainerSid: PSID, + Capabilities: PSID_AND_ATTRIBUTES, + CapabilityCount: DWORD, + Reserved: DWORD, +}} +pub type PSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES; +pub type LPSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES; +pub const PROCESS_TERMINATE: DWORD = 0x0001; +pub const PROCESS_CREATE_THREAD: DWORD = 0x0002; +pub const PROCESS_SET_SESSIONID: DWORD = 0x0004; +pub const PROCESS_VM_OPERATION: DWORD = 0x0008; +pub const PROCESS_VM_READ: DWORD = 0x0010; +pub const PROCESS_VM_WRITE: DWORD = 0x0020; +pub const PROCESS_DUP_HANDLE: DWORD = 0x0040; +pub const PROCESS_CREATE_PROCESS: DWORD = 0x0080; +pub const PROCESS_SET_QUOTA: DWORD = 0x0100; +pub const PROCESS_SET_INFORMATION: DWORD = 0x0200; +pub const PROCESS_QUERY_INFORMATION: DWORD = 0x0400; +pub const PROCESS_SUSPEND_RESUME: DWORD = 0x0800; +pub const PROCESS_QUERY_LIMITED_INFORMATION: DWORD = 0x1000; +pub const PROCESS_SET_LIMITED_INFORMATION: DWORD = 0x2000; +pub const PROCESS_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF; +pub const THREAD_TERMINATE: DWORD = 0x0001; +pub const THREAD_SUSPEND_RESUME: DWORD = 0x0002; +pub const THREAD_GET_CONTEXT: DWORD = 0x0008; +pub const THREAD_SET_CONTEXT: DWORD = 0x0010; +pub const THREAD_QUERY_INFORMATION: DWORD = 0x0040; +pub const THREAD_SET_INFORMATION: DWORD = 0x0020; +pub const THREAD_SET_THREAD_TOKEN: DWORD = 0x0080; +pub const THREAD_IMPERSONATE: DWORD = 0x0100; +pub const THREAD_DIRECT_IMPERSONATION: DWORD = 0x0200; +pub const THREAD_SET_LIMITED_INFORMATION: DWORD = 0x0400; +pub const THREAD_QUERY_LIMITED_INFORMATION: DWORD = 0x0800; +pub const THREAD_RESUME: DWORD = 0x1000; +pub const THREAD_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF; +pub const JOB_OBJECT_ASSIGN_PROCESS: DWORD = 0x0001; +pub const JOB_OBJECT_SET_ATTRIBUTES: DWORD = 0x0002; +pub const JOB_OBJECT_QUERY: DWORD = 0x0004; +pub const JOB_OBJECT_TERMINATE: DWORD = 0x0008; +pub const JOB_OBJECT_SET_SECURITY_ATTRIBUTES: DWORD = 0x0010; +pub const JOB_OBJECT_IMPERSONATE: DWORD = 0x0020; +pub const JOB_OBJECT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3F; +STRUCT!{struct JOB_SET_ARRAY { + JobHandle: HANDLE, + MemberLevel: DWORD, + Flags: DWORD, +}} +pub type PJOB_SET_ARRAY = *mut JOB_SET_ARRAY; +pub const FLS_MAXIMUM_AVAILABLE: DWORD = 128; +pub const TLS_MINIMUM_AVAILABLE: DWORD = 64; +STRUCT!{struct EXCEPTION_REGISTRATION_RECORD { + Next: *mut EXCEPTION_REGISTRATION_RECORD, + Handler: PEXCEPTION_ROUTINE, +}} +pub type PEXCEPTION_REGISTRATION_RECORD = *mut EXCEPTION_REGISTRATION_RECORD; +UNION!{union NT_TIB_u { + [usize; 1], + FiberData FiberData_mut: PVOID, + Version Version_mut: DWORD, +}} +STRUCT!{struct NT_TIB { + ExceptionList: *mut EXCEPTION_REGISTRATION_RECORD, + StackBase: PVOID, + StackLimit: PVOID, + SubSystemTib: PVOID, + u: NT_TIB_u, + ArbitraryUserPointer: PVOID, + _Self: *mut NT_TIB, +}} +pub type PNT_TIB = *mut NT_TIB; +UNION!{union NT_TIB32_u { + [u32; 1], + FiberData FiberData_mut: DWORD, + Version Version_mut: DWORD, +}} +STRUCT!{struct NT_TIB32 { + ExceptionList: DWORD, + StackBase: DWORD, + StackLimit: DWORD, + SubSystemTib: DWORD, + u: NT_TIB32_u, + ArbitraryUserPointer: DWORD, + Self_: DWORD, +}} +pub type PNT_TIB32 = *mut NT_TIB32; +UNION!{union NT_TIB64_u { + [u64; 1], + FiberData FiberData_mut: DWORD64, + Version Version_mut: DWORD, +}} +STRUCT!{struct NT_TIB64 { + ExceptionList: DWORD64, + StackBase: DWORD64, + StackLimit: DWORD64, + SubSystemTib: DWORD64, + u: NT_TIB64_u, + ArbitraryUserPointer: DWORD64, + _Self: DWORD64, +}} +pub type PNT_TIB64 = *mut NT_TIB64; +pub const THREAD_DYNAMIC_CODE_ALLOW: DWORD = 1; +pub const THREAD_BASE_PRIORITY_LOWRT: DWORD = 15; +pub const THREAD_BASE_PRIORITY_MAX: DWORD = 2; +pub const THREAD_BASE_PRIORITY_MIN: DWORD = -2i32 as u32; +pub const THREAD_BASE_PRIORITY_IDLE: DWORD = -15i32 as u32; +STRUCT!{struct UMS_CREATE_THREAD_ATTRIBUTES { + UmsVersion: DWORD, + UmsContext: PVOID, + UmsCompletionList: PVOID, +}} +pub type PUMS_CREATE_THREAD_ATTRIBUTES = *mut UMS_CREATE_THREAD_ATTRIBUTES; +STRUCT!{struct WOW64_ARCHITECTURE_INFORMATION { + BitFields: DWORD, +}} +pub type PWOW64_ARCHITECTURE_INFORMATION = *mut WOW64_ARCHITECTURE_INFORMATION; +BITFIELD!(WOW64_ARCHITECTURE_INFORMATION BitFields: DWORD [ + Machine set_Machine[0..16], + KernelMode set_KernelMode[16..17], + UserMode set_UserMode[17..18], + Native set_Native[18..19], + Process set_Process[19..20], + ReservedZero0 set_ReservedZero0[20..32], +]); +pub const MEMORY_PRIORITY_LOWEST: ULONG = 0; +pub const MEMORY_PRIORITY_VERY_LOW: ULONG = 1; +pub const MEMORY_PRIORITY_LOW: ULONG = 2; +pub const MEMORY_PRIORITY_MEDIUM: ULONG = 3; +pub const MEMORY_PRIORITY_BELOW_NORMAL: ULONG = 4; +pub const MEMORY_PRIORITY_NORMAL: ULONG = 5; +STRUCT!{struct QUOTA_LIMITS { + PagedPoolLimit: SIZE_T, + NonPagedPoolLimit: SIZE_T, + MinimumWorkingSetSize: SIZE_T, + MaximumWorkingSetSize: SIZE_T, + PagefileLimit: SIZE_T, + TimeLimit: LARGE_INTEGER, +}} +pub type PQUOTA_LIMITS = *mut QUOTA_LIMITS; +pub const QUOTA_LIMITS_HARDWS_MIN_ENABLE: DWORD = 0x00000001; +pub const QUOTA_LIMITS_HARDWS_MIN_DISABLE: DWORD = 0x00000002; +pub const QUOTA_LIMITS_HARDWS_MAX_ENABLE: DWORD = 0x00000004; +pub const QUOTA_LIMITS_HARDWS_MAX_DISABLE: DWORD = 0x00000008; +pub const QUOTA_LIMITS_USE_DEFAULT_LIMITS: DWORD = 0x00000010; +STRUCT!{struct RATE_QUOTA_LIMIT { + RateData: DWORD, + BitFields: DWORD, +}} +BITFIELD!(RATE_QUOTA_LIMIT BitFields: DWORD [ + RatePercent set_RatePercent[0..7], + Reserved0 set_Reserved0[7..32], +]); +pub type PRATE_QUOTA_LIMIT = *mut RATE_QUOTA_LIMIT; +STRUCT!{struct QUOTA_LIMITS_EX { + PagedPoolLimit: SIZE_T, + NonPagedPoolLimit: SIZE_T, + MinimumWorkingSetSize: SIZE_T, + MaximumWorkingSetSize: SIZE_T, + PagefileLimit: SIZE_T, + TimeLimit: LARGE_INTEGER, + WorkingSetLimit: SIZE_T, + Reserved2: SIZE_T, + Reserved3: SIZE_T, + Reserved4: SIZE_T, + Flags: DWORD, + CpuRateLimit: RATE_QUOTA_LIMIT, +}} +pub type PQUOTA_LIMITS_EX = *mut QUOTA_LIMITS_EX; +STRUCT!{struct IO_COUNTERS { + ReadOperationCount: ULONGLONG, + WriteOperationCount: ULONGLONG, + OtherOperationCount: ULONGLONG, + ReadTransferCount: ULONGLONG, + WriteTransferCount: ULONGLONG, + OtherTransferCount: ULONGLONG, +}} +pub type PIO_COUNTERS = *mut IO_COUNTERS; +pub const MAX_HW_COUNTERS: usize = 16; +pub const THREAD_PROFILING_FLAG_DISPATCH: DWORD = 0x00000001; +ENUM!{enum HARDWARE_COUNTER_TYPE { + PMCCounter, + MaxHardwareCounterType, +}} +pub type PHARDWARE_COUNTER_TYPE = *mut HARDWARE_COUNTER_TYPE; +ENUM!{enum PROCESS_MITIGATION_POLICY { + ProcessDEPPolicy, + ProcessASLRPolicy, + ProcessDynamicCodePolicy, + ProcessStrictHandleCheckPolicy, + ProcessSystemCallDisablePolicy, + ProcessMitigationOptionsMask, + ProcessExtensionPointDisablePolicy, + ProcessControlFlowGuardPolicy, + ProcessSignaturePolicy, + ProcessFontDisablePolicy, + ProcessImageLoadPolicy, + MaxProcessMitigationPolicy, +}} +pub type PPROCESS_MITIGATION_POLICY = *mut PROCESS_MITIGATION_POLICY; +STRUCT!{struct PROCESS_MITIGATION_ASLR_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_ASLR_POLICY Flags: DWORD [ + EnableBottomUpRandomization set_EnableBottomUpRandomization[0..1], + EnableForceRelocateImages set_EnableForceRelocateImages[1..2], + EnableHighEntropy set_EnableHighEntropy[2..3], + DisallowStrippedImages set_DisallowStrippedImages[3..4], + ReservedFlags set_ReservedFlags[4..32], +]); +pub type PPROCESS_MITIGATION_ASLR_POLICY = *mut PROCESS_MITIGATION_ASLR_POLICY; +STRUCT!{struct PROCESS_MITIGATION_DEP_POLICY { + Flags: DWORD, + Permanent: BOOLEAN, +}} +BITFIELD!(PROCESS_MITIGATION_DEP_POLICY Flags: DWORD [ + Enable set_Enable[0..1], + DisableAtlThunkEmulation set_DisableAtlThunkEmulation[1..2], + ReservedFlags set_ReservedFlags[2..32], +]); +pub type PPROCESS_MITIGATION_DEP_POLICY = *mut PROCESS_MITIGATION_DEP_POLICY; +STRUCT!{struct PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY Flags: DWORD [ + RaiseExceptionOnInvalidHandleReference set_RaiseExceptionOnInvalidHandleReference[0..1], + HandleExceptionsPermanentlyEnabled set_HandleExceptionsPermanentlyEnabled[1..2], + ReservedFlags set_ReservedFlags[2..32], +]); +pub type PPROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY + = *mut PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY; +STRUCT!{struct PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY Flags: DWORD [ + DisallowWin32kSystemCalls set_DisallowWin32kSystemCalls[0..1], + ReservedFlags set_ReservedFlags[1..32], +]); +pub type PPROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY + = *mut PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY; +STRUCT!{struct PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY Flags: DWORD [ + DisableExtensionPoints set_DisableExtensionPoints[0..1], + ReservedFlags set_ReservedFlags[1..32], +]); +pub type PPROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY + = *mut PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY; +STRUCT!{struct PROCESS_MITIGATION_DYNAMIC_CODE_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_DYNAMIC_CODE_POLICY Flags: DWORD [ + ProhibitDynamicCode set_ProhibitDynamicCode[0..1], + AllowThreadOptOut set_AllowThreadOptOut[1..2], + AllowRemoteDowngrade set_AllowRemoteDowngrade[2..3], + ReservedFlags set_ReservedFlags[3..32], +]); +pub type PPROCESS_MITIGATION_DYNAMIC_CODE_POLICY = *mut PROCESS_MITIGATION_DYNAMIC_CODE_POLICY; +STRUCT!{struct PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY Flags: DWORD [ + EnableControlFlowGuard set_EnableControlFlowGuard[0..1], + EnableExportSuppression set_EnableExportSuppression[1..2], + StrictMode set_StrictMode[2..3], + ReservedFlags set_ReservedFlags[3..32], +]); +pub type PPROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY + = *mut PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY; +STRUCT!{struct PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY Flags: DWORD [ + MicrosoftSignedOnly set_MicrosoftSignedOnly[0..1], + StoreSignedOnly set_StoreSignedOnly[1..2], + MitigationOptIn set_MitigationOptIn[2..3], + ReservedFlags set_ReservedFlags[3..32], +]); +pub type PPROCESS_MITIGATION_BINARY_SIGNATURE_POLICY + = *mut PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY; +STRUCT!{struct PROCESS_MITIGATION_FONT_DISABLE_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_FONT_DISABLE_POLICY Flags: DWORD [ + DisableNonSystemFonts set_DisableNonSystemFonts[0..1], + AuditNonSystemFontLoading set_AuditNonSystemFontLoading[1..2], + ReservedFlags set_ReservedFlags[2..32], +]); +pub type PPROCESS_MITIGATION_FONT_DISABLE_POLICY = *mut PROCESS_MITIGATION_FONT_DISABLE_POLICY; +STRUCT!{struct PROCESS_MITIGATION_IMAGE_LOAD_POLICY { + Flags: DWORD, +}} +BITFIELD!(PROCESS_MITIGATION_IMAGE_LOAD_POLICY Flags: DWORD [ + NoRemoteImages set_NoRemoteImages[0..1], + NoLowMandatoryLabelImages set_NoLowMandatoryLabelImages[1..2], + PreferSystem32Images set_PreferSystem32Images[2..3], + ReservedFlags set_ReservedFlags[3..32], +]); +pub type PPROCESS_MITIGATION_IMAGE_LOAD_POLICY = *mut PROCESS_MITIGATION_IMAGE_LOAD_POLICY; +STRUCT!{struct JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { + TotalUserTime: LARGE_INTEGER, + TotalKernelTime: LARGE_INTEGER, + ThisPeriodTotalUserTime: LARGE_INTEGER, + ThisPeriodTotalKernelTime: LARGE_INTEGER, + TotalPageFaultCount: DWORD, + TotalProcesses: DWORD, + ActiveProcesses: DWORD, + TotalTerminatedProcesses: DWORD, +}} +pub type PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION = *mut JOBOBJECT_BASIC_ACCOUNTING_INFORMATION; +STRUCT!{struct JOBOBJECT_BASIC_LIMIT_INFORMATION { + PerProcessUserTimeLimit: LARGE_INTEGER, + PerJobUserTimeLimit: LARGE_INTEGER, + LimitFlags: DWORD, + MinimumWorkingSetSize: SIZE_T, + MaximumWorkingSetSize: SIZE_T, + ActiveProcessLimit: DWORD, + Affinity: ULONG_PTR, + PriorityClass: DWORD, + SchedulingClass: DWORD, +}} +pub type PJOBOBJECT_BASIC_LIMIT_INFORMATION = *mut JOBOBJECT_BASIC_LIMIT_INFORMATION; +STRUCT!{struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { + BasicLimitInformation: JOBOBJECT_BASIC_LIMIT_INFORMATION, + IoInfo: IO_COUNTERS, + ProcessMemoryLimit: SIZE_T, + JobMemoryLimit: SIZE_T, + PeakProcessMemoryUsed: SIZE_T, + PeakJobMemoryUsed: SIZE_T, +}} +pub type PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = *mut JOBOBJECT_EXTENDED_LIMIT_INFORMATION; +STRUCT!{struct JOBOBJECT_BASIC_PROCESS_ID_LIST { + NumberOfAssignedProcesses: DWORD, + NumberOfProcessIdsInList: DWORD, + ProcessIdList: [ULONG_PTR; 1], +}} +pub type PJOBOBJECT_BASIC_PROCESS_ID_LIST = *mut JOBOBJECT_BASIC_PROCESS_ID_LIST; +STRUCT!{struct JOBOBJECT_BASIC_UI_RESTRICTIONS { + UIRestrictionsClass: DWORD, +}} +pub type PJOBOBJECT_BASIC_UI_RESTRICTIONS = *mut JOBOBJECT_BASIC_UI_RESTRICTIONS; +STRUCT!{struct JOBOBJECT_SECURITY_LIMIT_INFORMATION { + SecurityLimitFlags: DWORD, + JobToken: HANDLE, + SidsToDisable: PTOKEN_GROUPS, + PrivilegesToDelete: PTOKEN_PRIVILEGES, + RestrictedSids: PTOKEN_GROUPS, +}} +pub type PJOBOBJECT_SECURITY_LIMIT_INFORMATION = *mut JOBOBJECT_SECURITY_LIMIT_INFORMATION; +STRUCT!{struct JOBOBJECT_END_OF_JOB_TIME_INFORMATION { + EndOfJobTimeAction: DWORD, +}} +pub type PJOBOBJECT_END_OF_JOB_TIME_INFORMATION = *mut JOBOBJECT_END_OF_JOB_TIME_INFORMATION; +STRUCT!{struct JOBOBJECT_ASSOCIATE_COMPLETION_PORT { + CompletionKey: PVOID, + CompletionPort: HANDLE, +}} +pub type PJOBOBJECT_ASSOCIATE_COMPLETION_PORT = *mut JOBOBJECT_ASSOCIATE_COMPLETION_PORT; +STRUCT!{struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { + BasicInfo: JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, + IoInfo: IO_COUNTERS, +}} +pub type PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION + = *mut JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; +STRUCT!{struct JOBOBJECT_JOBSET_INFORMATION { + MemberLevel: DWORD, +}} +pub type PJOBOBJECT_JOBSET_INFORMATION = *mut JOBOBJECT_JOBSET_INFORMATION; +ENUM!{enum JOBOBJECT_RATE_CONTROL_TOLERANCE { + ToleranceLow = 1, + ToleranceMedium, + ToleranceHigh, +}} +pub type PJOBOBJECT_RATE_CONTROL_TOLERANCE = *mut JOBOBJECT_RATE_CONTROL_TOLERANCE; +ENUM!{enum JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL { + ToleranceIntervalShort = 1, + ToleranceIntervalMedium, + ToleranceIntervalLong, +}} +pub type PJOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL + = *mut JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL; +STRUCT!{struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION { + IoReadBytesLimit: DWORD64, + IoWriteBytesLimit: DWORD64, + PerJobUserTimeLimit: LARGE_INTEGER, + JobMemoryLimit: DWORD64, + RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, + RateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, + LimitFlags: DWORD, +}} +pub type PJOBOBJECT_NOTIFICATION_LIMIT_INFORMATION = *mut JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION; +UNION!{union JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u1 { + [u64; 1], + JobHighMemoryLimit JobHighMemoryLimit_mut: DWORD64, + JobMemoryLimit JobMemoryLimit_mut: DWORD64, +}} +UNION!{union JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u2 { + [u32; 1], + RateControlTolerance RateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE, + CpuRateControlTolerance CpuRateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE, +}} +UNION!{union JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u3 { + [u32; 1], + RateControlToleranceInterval RateControlToleranceInterval_mut: + JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, + CpuRateControlToleranceInterval CpuRateControlToleranceInterval_mut: + JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, +}} +STRUCT!{struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2 { + IoReadBytesLimit: DWORD64, + IoWriteBytesLimit: DWORD64, + PerJobUserTimeLimit: LARGE_INTEGER, + u1: JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u1, + u2: JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u2, + u3: JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u3, + LimitFlags: DWORD, + IoRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, + JobLowMemoryLimit: DWORD64, + IoRateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, + NetRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, + NetRateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, +}} +STRUCT!{struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION { + LimitFlags: DWORD, + ViolationLimitFlags: DWORD, + IoReadBytes: DWORD64, + IoReadBytesLimit: DWORD64, + IoWriteBytes: DWORD64, + IoWriteBytesLimit: DWORD64, + PerJobUserTime: LARGE_INTEGER, + PerJobUserTimeLimit: LARGE_INTEGER, + JobMemory: DWORD64, + JobMemoryLimit: DWORD64, + RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, + RateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, +}} +pub type PJOBOBJECT_LIMIT_VIOLATION_INFORMATION = *mut JOBOBJECT_LIMIT_VIOLATION_INFORMATION; +UNION!{union JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u1 { + [u64; 1], + JobHighMemoryLimit JobHighMemoryLimit_mut: DWORD64, + JobMemoryLimit JobMemoryLimit_mut: DWORD64, +}} +UNION!{union JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u2 { + [u32; 1], + RateControlTolerance RateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE, + CpuRateControlTolerance CpuRateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE, +}} +UNION!{union JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u3 { + [u32; 1], + RateControlToleranceLimit RateControlToleranceLimit_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE, + CpuRateControlToleranceLimit CpuRateControlToleranceLimit_mut: + JOBOBJECT_RATE_CONTROL_TOLERANCE, +}} +STRUCT!{struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2 { + LimitFlags: DWORD, + ViolationLimitFlags: DWORD, + IoReadBytes: DWORD64, + IoReadBytesLimit: DWORD64, + IoWriteBytes: DWORD64, + IoWriteBytesLimit: DWORD64, + PerJobUserTime: LARGE_INTEGER, + PerJobUserTimeLimit: LARGE_INTEGER, + JobMemory: DWORD64, + u1: JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u1, + u2: JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u2, + u3: JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u3, + JobLowMemoryLimit: DWORD64, + IoRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, + IoRateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, + NetRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE, + NetRateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE, +}} +STRUCT!{struct JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u_s { + MinRate: WORD, + MaxRate: WORD, +}} +UNION!{union JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u { + [u32; 1], + CpuRate CpuRate_mut: DWORD, + Weight Weight_mut: DWORD, + s s_mut: JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u_s, +}} +STRUCT!{struct JOBOBJECT_CPU_RATE_CONTROL_INFORMATION { + ControlFlags: DWORD, + u: JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u, +}} +pub type PJOBOBJECT_CPU_RATE_CONTROL_INFORMATION = *mut JOBOBJECT_CPU_RATE_CONTROL_INFORMATION; +ENUM!{enum JOB_OBJECT_NET_RATE_CONTROL_FLAGS { + JOB_OBJECT_NET_RATE_CONTROL_ENABLE = 0x1, + JOB_OBJECT_NET_RATE_CONTROL_MAX_BANDWIDTH = 0x2, + JOB_OBJECT_NET_RATE_CONTROL_DSCP_TAG = 0x4, + JOB_OBJECT_NET_RATE_CONTROL_VALID_FLAGS = 0x7, +}} +pub const JOB_OBJECT_NET_RATE_CONTROL_MAX_DSCP_TAG: DWORD = 64; +STRUCT!{struct JOBOBJECT_NET_RATE_CONTROL_INFORMATION { + MaxBandwidth: DWORD64, + ControlFlags: JOB_OBJECT_NET_RATE_CONTROL_FLAGS, + DscpTag: BYTE, +}} +ENUM!{enum JOB_OBJECT_IO_RATE_CONTROL_FLAGS { + JOB_OBJECT_IO_RATE_CONTROL_ENABLE = 0x1, + JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME = 0x2, + JOB_OBJECT_IO_RATE_CONTROL_VALID_FLAGS = JOB_OBJECT_IO_RATE_CONTROL_ENABLE + | JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME, +}} +STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE { + MaxIops: LONG64, + MaxBandwidth: LONG64, + ReservationIops: LONG64, + VolumeName: PWSTR, + BaseIoSize: DWORD, + ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS, + VolumeNameLength: WORD, +}} +pub type JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V1 + = JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE; +STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V2 { + MaxIops: LONG64, + MaxBandwidth: LONG64, + ReservationIops: LONG64, + VolumeName: PWSTR, + BaseIoSize: DWORD, + ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS, + VolumeNameLength: WORD, + CriticalReservationIops: LONG64, + ReservationBandwidth: LONG64, + CriticalReservationBandwidth: LONG64, + MaxTimePercent: LONG64, + ReservationTimePercent: LONG64, + CriticalReservationTimePercent: LONG64, +}} +STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V3 { + MaxIops: LONG64, + MaxBandwidth: LONG64, + ReservationIops: LONG64, + VolumeName: PWSTR, + BaseIoSize: DWORD, + ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS, + VolumeNameLength: WORD, + CriticalReservationIops: LONG64, + ReservationBandwidth: LONG64, + CriticalReservationBandwidth: LONG64, + MaxTimePercent: LONG64, + ReservationTimePercent: LONG64, + CriticalReservationTimePercent: LONG64, + SoftMaxIops: LONG64, + SoftMaxBandwidth: LONG64, + SoftMaxTimePercent: LONG64, + LimitExcessNotifyIops: LONG64, + LimitExcessNotifyBandwidth: LONG64, + LimitExcessNotifyTimePercent: LONG64, +}} +ENUM!{enum JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS { + JOBOBJECT_IO_ATTRIBUTION_CONTROL_ENABLE = 0x1, + JOBOBJECT_IO_ATTRIBUTION_CONTROL_DISABLE = 0x2, + JOBOBJECT_IO_ATTRIBUTION_CONTROL_VALID_FLAGS = 0x3, +}} +STRUCT!{struct JOBOBJECT_IO_ATTRIBUTION_STATS { + IoCount: ULONG_PTR, + TotalNonOverlappedQueueTime: ULONGLONG, + TotalNonOverlappedServiceTime: ULONGLONG, + TotalSize: ULONGLONG, +}} +pub type PJOBOBJECT_IO_ATTRIBUTION_STATS = *mut JOBOBJECT_IO_ATTRIBUTION_STATS; +STRUCT!{struct JOBOBJECT_IO_ATTRIBUTION_INFORMATION { + ControlFlags: DWORD, + ReadStats: JOBOBJECT_IO_ATTRIBUTION_STATS, + WriteStats: JOBOBJECT_IO_ATTRIBUTION_STATS, +}} +pub type PJOBOBJECT_IO_ATTRIBUTION_INFORMATION = *mut JOBOBJECT_IO_ATTRIBUTION_INFORMATION; +pub const JOB_OBJECT_TERMINATE_AT_END_OF_JOB: DWORD = 0; +pub const JOB_OBJECT_POST_AT_END_OF_JOB: DWORD = 1; +pub const JOB_OBJECT_MSG_END_OF_JOB_TIME: DWORD = 1; +pub const JOB_OBJECT_MSG_END_OF_PROCESS_TIME: DWORD = 2; +pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT: DWORD = 3; +pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: DWORD = 4; +pub const JOB_OBJECT_MSG_NEW_PROCESS: DWORD = 6; +pub const JOB_OBJECT_MSG_EXIT_PROCESS: DWORD = 7; +pub const JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: DWORD = 8; +pub const JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: DWORD = 9; +pub const JOB_OBJECT_MSG_JOB_MEMORY_LIMIT: DWORD = 10; +pub const JOB_OBJECT_MSG_NOTIFICATION_LIMIT: DWORD = 11; +pub const JOB_OBJECT_MSG_JOB_CYCLE_TIME_LIMIT: DWORD = 12; +pub const JOB_OBJECT_MSG_SILO_TERMINATED: DWORD = 13; +pub const JOB_OBJECT_MSG_MINIMUM: DWORD = 1; +pub const JOB_OBJECT_MSG_MAXIMUM: DWORD = 13; +pub const JOB_OBJECT_VALID_COMPLETION_FILTER: DWORD = ((1 << (JOB_OBJECT_MSG_MAXIMUM + 1)) - 1) + - ((1 << JOB_OBJECT_MSG_MINIMUM) - 1); +pub const JOB_OBJECT_LIMIT_WORKINGSET: DWORD = 0x00000001; +pub const JOB_OBJECT_LIMIT_PROCESS_TIME: DWORD = 0x00000002; +pub const JOB_OBJECT_LIMIT_JOB_TIME: DWORD = 0x00000004; +pub const JOB_OBJECT_LIMIT_ACTIVE_PROCESS: DWORD = 0x00000008; +pub const JOB_OBJECT_LIMIT_AFFINITY: DWORD = 0x00000010; +pub const JOB_OBJECT_LIMIT_PRIORITY_CLASS: DWORD = 0x00000020; +pub const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME: DWORD = 0x00000040; +pub const JOB_OBJECT_LIMIT_SCHEDULING_CLASS: DWORD = 0x00000080; +pub const JOB_OBJECT_LIMIT_PROCESS_MEMORY: DWORD = 0x00000100; +pub const JOB_OBJECT_LIMIT_JOB_MEMORY: DWORD = 0x00000200; +pub const JOB_OBJECT_LIMIT_JOB_MEMORY_HIGH: DWORD = JOB_OBJECT_LIMIT_JOB_MEMORY; +pub const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION: DWORD = 0x00000400; +pub const JOB_OBJECT_LIMIT_BREAKAWAY_OK: DWORD = 0x00000800; +pub const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK: DWORD = 0x00001000; +pub const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: DWORD = 0x00002000; +pub const JOB_OBJECT_LIMIT_SUBSET_AFFINITY: DWORD = 0x00004000; +pub const JOB_OBJECT_LIMIT_JOB_MEMORY_LOW: DWORD = 0x00008000; +pub const JOB_OBJECT_LIMIT_JOB_READ_BYTES: DWORD = 0x00010000; +pub const JOB_OBJECT_LIMIT_JOB_WRITE_BYTES: DWORD = 0x00020000; +pub const JOB_OBJECT_LIMIT_RATE_CONTROL: DWORD = 0x00040000; +pub const JOB_OBJECT_LIMIT_CPU_RATE_CONTROL: DWORD = JOB_OBJECT_LIMIT_RATE_CONTROL; +pub const JOB_OBJECT_LIMIT_IO_RATE_CONTROL: DWORD = 0x00008000; +pub const JOB_OBJECT_LIMIT_NET_RATE_CONTROL: DWORD = 0x00010000; +pub const JOB_OBJECT_LIMIT_VALID_FLAGS: DWORD = 0x0007ffff; +pub const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS: DWORD = 0x000000ff; +pub const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS: DWORD = 0x00007fff; +pub const JOB_OBJECT_NOTIFICATION_LIMIT_VALID_FLAGS: DWORD = JOB_OBJECT_LIMIT_JOB_READ_BYTES + | JOB_OBJECT_LIMIT_JOB_WRITE_BYTES | JOB_OBJECT_LIMIT_JOB_TIME + | JOB_OBJECT_LIMIT_JOB_MEMORY_LOW | JOB_OBJECT_LIMIT_JOB_MEMORY_HIGH + | JOB_OBJECT_LIMIT_CPU_RATE_CONTROL | JOB_OBJECT_LIMIT_IO_RATE_CONTROL + | JOB_OBJECT_LIMIT_NET_RATE_CONTROL; +pub const JOB_OBJECT_UILIMIT_NONE: DWORD = 0x00000000; +pub const JOB_OBJECT_UILIMIT_HANDLES: DWORD = 0x00000001; +pub const JOB_OBJECT_UILIMIT_READCLIPBOARD: DWORD = 0x00000002; +pub const JOB_OBJECT_UILIMIT_WRITECLIPBOARD: DWORD = 0x00000004; +pub const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS: DWORD = 0x00000008; +pub const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS: DWORD = 0x00000010; +pub const JOB_OBJECT_UILIMIT_GLOBALATOMS: DWORD = 0x00000020; +pub const JOB_OBJECT_UILIMIT_DESKTOP: DWORD = 0x00000040; +pub const JOB_OBJECT_UILIMIT_EXITWINDOWS: DWORD = 0x00000080; +pub const JOB_OBJECT_UILIMIT_ALL: DWORD = 0x000000FF; +pub const JOB_OBJECT_UI_VALID_FLAGS: DWORD = 0x000000FF; +pub const JOB_OBJECT_SECURITY_NO_ADMIN: DWORD = 0x00000001; +pub const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN: DWORD = 0x00000002; +pub const JOB_OBJECT_SECURITY_ONLY_TOKEN: DWORD = 0x00000004; +pub const JOB_OBJECT_SECURITY_FILTER_TOKENS: DWORD = 0x00000008; +pub const JOB_OBJECT_SECURITY_VALID_FLAGS: DWORD = 0x0000000f; +pub const JOB_OBJECT_CPU_RATE_CONTROL_ENABLE: DWORD = 0x1; +pub const JOB_OBJECT_CPU_RATE_CONTROL_WEIGHT_BASED: DWORD = 0x2; +pub const JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP: DWORD = 0x4; +pub const JOB_OBJECT_CPU_RATE_CONTROL_NOTIFY: DWORD = 0x8; +pub const JOB_OBJECT_CPU_RATE_CONTROL_MIN_MAX_RATE: DWORD = 0x10; +pub const JOB_OBJECT_CPU_RATE_CONTROL_VALID_FLAGS: DWORD = 0x1f; +ENUM!{enum JOBOBJECTINFOCLASS { + JobObjectBasicAccountingInformation = 1, + JobObjectBasicLimitInformation, + JobObjectBasicProcessIdList, + JobObjectBasicUIRestrictions, + JobObjectSecurityLimitInformation, + JobObjectEndOfJobTimeInformation, + JobObjectAssociateCompletionPortInformation, + JobObjectBasicAndIoAccountingInformation, + JobObjectExtendedLimitInformation, + JobObjectJobSetInformation, + JobObjectGroupInformation, + JobObjectNotificationLimitInformation, + JobObjectLimitViolationInformation, + JobObjectGroupInformationEx, + JobObjectCpuRateControlInformation, + JobObjectCompletionFilter, + JobObjectCompletionCounter, + JobObjectReserved1Information = 18, + JobObjectReserved2Information, + JobObjectReserved3Information, + JobObjectReserved4Information, + JobObjectReserved5Information, + JobObjectReserved6Information, + JobObjectReserved7Information, + JobObjectReserved8Information, + JobObjectReserved9Information, + JobObjectReserved10Information, + JobObjectReserved11Information, + JobObjectReserved12Information, + JobObjectReserved13Information, + JobObjectReserved14Information = 31, + JobObjectNetRateControlInformation, + JobObjectNotificationLimitInformation2, + JobObjectLimitViolationInformation2, + JobObjectCreateSilo, + JobObjectSiloBasicInformation, + JobObjectReserved15Information = 37, + JobObjectReserved16Information = 38, + JobObjectReserved17Information = 39, + JobObjectReserved18Information = 40, + JobObjectReserved19Information = 41, + JobObjectReserved20Information = 42, + JobObjectReserved21Information = 43, + JobObjectReserved22Information = 44, + JobObjectReserved23Information = 45, + JobObjectReserved24Information = 46, + JobObjectReserved25Information = 47, + MaxJobObjectInfoClass, +}} +STRUCT!{struct SILOOBJECT_BASIC_INFORMATION { + SiloId: DWORD, + SiloParentId: DWORD, + NumberOfProcesses: DWORD, + IsInServerSilo: BOOLEAN, + Reserved: [BYTE; 3], +}} +pub type PSILOOBJECT_BASIC_INFORMATION = *mut SILOOBJECT_BASIC_INFORMATION; +ENUM!{enum SERVERSILO_STATE { + SERVERSILO_INITING = 0, + SERVERSILO_STARTED, + SERVERSILO_SHUTTING_DOWN, + SERVERSILO_TERMINATING, + SERVERSILO_TERMINATED, +}} +pub type PSERVERSILO_STATE = *mut SERVERSILO_STATE; +STRUCT!{struct SERVERSILO_BASIC_INFORMATION { + ServiceSessionId: DWORD, + State: SERVERSILO_STATE, + ExitStatus: DWORD, +}} +pub type PSERVERSILO_BASIC_INFORMATION = *mut SERVERSILO_BASIC_INFORMATION; +ENUM!{enum FIRMWARE_TYPE { + FirmwareTypeUnknown, + FirmwareTypeBios, + FirmwareTypeUefi, + FirmwareTypeMax, +}} +pub type PFIRMWARE_TYPE = *mut FIRMWARE_TYPE; +pub const EVENT_MODIFY_STATE: DWORD = 0x0002; +pub const EVENT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3; +pub const MUTANT_QUERY_STATE: DWORD = 0x0001; +pub const MUTANT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | MUTANT_QUERY_STATE; +pub const SEMAPHORE_MODIFY_STATE: DWORD = 0x0002; +pub const SEMAPHORE_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3; +pub const TIMER_QUERY_STATE: DWORD = 0x0001; +pub const TIMER_MODIFY_STATE: DWORD = 0x0002; +pub const TIMER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | TIMER_QUERY_STATE + | TIMER_MODIFY_STATE; +pub const TIME_ZONE_ID_UNKNOWN: DWORD = 0; +pub const TIME_ZONE_ID_STANDARD: DWORD = 1; +pub const TIME_ZONE_ID_DAYLIGHT: DWORD = 2; +ENUM!{enum LOGICAL_PROCESSOR_RELATIONSHIP { + RelationProcessorCore, + RelationNumaNode, + RelationCache, + RelationProcessorPackage, + RelationGroup, + RelationAll = 0xffff, +}} +pub const LTP_PC_SMT: BYTE = 0x1; +ENUM!{enum PROCESSOR_CACHE_TYPE { + CacheUnified, + CacheInstruction, + CacheData, + CacheTrace, +}} +pub const CACHE_FULLY_ASSOCIATIVE: BYTE = 0xFF; +STRUCT!{struct CACHE_DESCRIPTOR { + Level: BYTE, + Associativity: BYTE, + LineSize: WORD, + Size: DWORD, + Type: PROCESSOR_CACHE_TYPE, +}} +pub type PCACHE_DESCRIPTOR = *mut CACHE_DESCRIPTOR; +STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore { + Flags: BYTE, +}} +STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode { + NodeNumber: DWORD, +}} +UNION!{union SYSTEM_LOGICAL_PROCESSOR_INFORMATION_u { + [u64; 2], + ProcessorCore ProcessorCore_mut: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore, + NumaNode NumaNode_mut: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode, + Cache Cache_mut: CACHE_DESCRIPTOR, + Reserved Reserved_mut: [ULONGLONG; 2], +}} +STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION { + ProcessorMask: ULONG_PTR, + Relationship: LOGICAL_PROCESSOR_RELATIONSHIP, + u: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_u, +}} +pub type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION = *mut SYSTEM_LOGICAL_PROCESSOR_INFORMATION; +STRUCT!{struct PROCESSOR_RELATIONSHIP { + Flags: BYTE, + EfficiencyClass: BYTE, + Reserved: [BYTE; 20], + GroupCount: WORD, + GroupMask: [GROUP_AFFINITY; ANYSIZE_ARRAY], +}} +pub type PPROCESSOR_RELATIONSHIP = *mut PROCESSOR_RELATIONSHIP; +STRUCT!{struct NUMA_NODE_RELATIONSHIP { + NodeNumber: DWORD, + Reserved: [BYTE; 20], + GroupMask: GROUP_AFFINITY, +}} +pub type PNUMA_NODE_RELATIONSHIP = *mut NUMA_NODE_RELATIONSHIP; +STRUCT!{struct CACHE_RELATIONSHIP { + Level: BYTE, + Associativity: BYTE, + LineSize: WORD, + CacheSize: DWORD, + Type: PROCESSOR_CACHE_TYPE, + Reserved: [BYTE; 20], + GroupMask: GROUP_AFFINITY, +}} +pub type PCACHE_RELATIONSHIP = *mut CACHE_RELATIONSHIP; +STRUCT!{struct PROCESSOR_GROUP_INFO { + MaximumProcessorCount: BYTE, + ActiveProcessorCount: BYTE, + Reserved: [BYTE; 38], + ActiveProcessorMask: KAFFINITY, +}} +pub type PPROCESSOR_GROUP_INFO = *mut PROCESSOR_GROUP_INFO; +STRUCT!{struct GROUP_RELATIONSHIP { + MaximumGroupCount: WORD, + ActiveGroupCount: WORD, + Reserved: [BYTE; 20], + GroupInfo: [PROCESSOR_GROUP_INFO; ANYSIZE_ARRAY], +}} +pub type PGROUP_RELATIONSHIP = *mut GROUP_RELATIONSHIP; +UNION!{union SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX_u { + [u32; 17] [u64; 9], + Processor Processor_mut: PROCESSOR_RELATIONSHIP, + NumaNode NumaNode_mut: NUMA_NODE_RELATIONSHIP, + Cache Cache_mut: CACHE_RELATIONSHIP, + Group Group_mut: GROUP_RELATIONSHIP, +}} +STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX { + Relationship: LOGICAL_PROCESSOR_RELATIONSHIP, + Size: DWORD, + u: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX_u, +}} +pub type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX = *mut SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; +ENUM!{enum CPU_SET_INFORMATION_TYPE { + CpuSetInformation, +}} +pub type PCPU_SET_INFORMATION_TYPE = *mut CPU_SET_INFORMATION_TYPE; +pub const SYSTEM_CPU_SET_INFORMATION_PARKED: BYTE = 0x1; +pub const SYSTEM_CPU_SET_INFORMATION_ALLOCATED: BYTE = 0x2; +pub const SYSTEM_CPU_SET_INFORMATION_ALLOCATED_TO_TARGET_PROCESS: BYTE = 0x4; +pub const SYSTEM_CPU_SET_INFORMATION_REALTIME: BYTE = 0x8; +STRUCT!{struct SYSTEM_CPU_SET_INFORMATION_CpuSet { + Id: DWORD, + Group: WORD, + LogicalProcessorIndex: BYTE, + CoreIndex: BYTE, + LastLevelCacheIndex: BYTE, + NumaNodeIndex: BYTE, + EfficiencyClass: BYTE, + AllFlags: BYTE, + Reserved: DWORD, + AllocationTag: DWORD64, +}} +BITFIELD!(SYSTEM_CPU_SET_INFORMATION_CpuSet AllFlags: BYTE [ + Parked set_Parked[0..1], + Allocated set_Allocated[1..2], + AllocatedToTargetProcess set_AllocatedToTargetProcess[2..3], + RealTime set_RealTime[3..4], + ReservedFlags set_ReservedFlags[4..8], +]); +STRUCT!{struct SYSTEM_CPU_SET_INFORMATION { + Size: DWORD, + Type: CPU_SET_INFORMATION_TYPE, + CpuSet: SYSTEM_CPU_SET_INFORMATION_CpuSet, +}} +pub type PSYSTEM_CPU_SET_INFORMATION = *mut SYSTEM_CPU_SET_INFORMATION; +STRUCT!{struct SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION { + CycleTime: DWORD64, +}} +pub type PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION = *mut SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION; +pub const PROCESSOR_INTEL_386: DWORD = 386; +pub const PROCESSOR_INTEL_486: DWORD = 486; +pub const PROCESSOR_INTEL_PENTIUM: DWORD = 586; +pub const PROCESSOR_INTEL_IA64: DWORD = 2200; +pub const PROCESSOR_AMD_X8664: DWORD = 8664; +pub const PROCESSOR_MIPS_R4000: DWORD = 4000; +pub const PROCESSOR_ALPHA_21064: DWORD = 21064; +pub const PROCESSOR_PPC_601: DWORD = 601; +pub const PROCESSOR_PPC_603: DWORD = 603; +pub const PROCESSOR_PPC_604: DWORD = 604; +pub const PROCESSOR_PPC_620: DWORD = 620; +pub const PROCESSOR_HITACHI_SH3: DWORD = 10003; +pub const PROCESSOR_HITACHI_SH3E: DWORD = 10004; +pub const PROCESSOR_HITACHI_SH4: DWORD = 10005; +pub const PROCESSOR_MOTOROLA_821: DWORD = 821; +pub const PROCESSOR_SHx_SH3: DWORD = 103; +pub const PROCESSOR_SHx_SH4: DWORD = 104; +pub const PROCESSOR_STRONGARM: DWORD = 2577; +pub const PROCESSOR_ARM720: DWORD = 1824; +pub const PROCESSOR_ARM820: DWORD = 2080; +pub const PROCESSOR_ARM920: DWORD = 2336; +pub const PROCESSOR_ARM_7TDMI: DWORD = 70001; +pub const PROCESSOR_OPTIL: DWORD = 0x494f; +pub const PROCESSOR_ARCHITECTURE_INTEL: WORD = 0; +pub const PROCESSOR_ARCHITECTURE_MIPS: WORD = 1; +pub const PROCESSOR_ARCHITECTURE_ALPHA: WORD = 2; +pub const PROCESSOR_ARCHITECTURE_PPC: WORD = 3; +pub const PROCESSOR_ARCHITECTURE_SHX: WORD = 4; +pub const PROCESSOR_ARCHITECTURE_ARM: WORD = 5; +pub const PROCESSOR_ARCHITECTURE_IA64: WORD = 6; +pub const PROCESSOR_ARCHITECTURE_ALPHA64: WORD = 7; +pub const PROCESSOR_ARCHITECTURE_MSIL: WORD = 8; +pub const PROCESSOR_ARCHITECTURE_AMD64: WORD = 9; +pub const PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: WORD = 10; +pub const PROCESSOR_ARCHITECTURE_NEUTRAL: WORD = 11; +pub const PROCESSOR_ARCHITECTURE_ARM64: WORD = 12; +pub const PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64: WORD = 13; +pub const PROCESSOR_ARCHITECTURE_IA32_ON_ARM64: WORD = 14; +pub const PROCESSOR_ARCHITECTURE_UNKNOWN: WORD = 0xFFFF; +pub const PF_FLOATING_POINT_PRECISION_ERRATA: DWORD = 0; +pub const PF_FLOATING_POINT_EMULATED: DWORD = 1; +pub const PF_COMPARE_EXCHANGE_DOUBLE: DWORD = 2; +pub const PF_MMX_INSTRUCTIONS_AVAILABLE: DWORD = 3; +pub const PF_PPC_MOVEMEM_64BIT_OK: DWORD = 4; +pub const PF_ALPHA_BYTE_INSTRUCTIONS: DWORD = 5; +pub const PF_XMMI_INSTRUCTIONS_AVAILABLE: DWORD = 6; +pub const PF_3DNOW_INSTRUCTIONS_AVAILABLE: DWORD = 7; +pub const PF_RDTSC_INSTRUCTION_AVAILABLE: DWORD = 8; +pub const PF_PAE_ENABLED: DWORD = 9; +pub const PF_XMMI64_INSTRUCTIONS_AVAILABLE: DWORD = 10; +pub const PF_SSE_DAZ_MODE_AVAILABLE: DWORD = 11; +pub const PF_NX_ENABLED: DWORD = 12; +pub const PF_SSE3_INSTRUCTIONS_AVAILABLE: DWORD = 13; +pub const PF_COMPARE_EXCHANGE128: DWORD = 14; +pub const PF_COMPARE64_EXCHANGE128: DWORD = 15; +pub const PF_CHANNELS_ENABLED: DWORD = 16; +pub const PF_XSAVE_ENABLED: DWORD = 17; +pub const PF_ARM_VFP_32_REGISTERS_AVAILABLE: DWORD = 18; +pub const PF_ARM_NEON_INSTRUCTIONS_AVAILABLE: DWORD = 19; +pub const PF_SECOND_LEVEL_ADDRESS_TRANSLATION: DWORD = 20; +pub const PF_VIRT_FIRMWARE_ENABLED: DWORD = 21; +pub const PF_RDWRFSGSBASE_AVAILABLE: DWORD = 22; +pub const PF_FASTFAIL_AVAILABLE: DWORD = 23; +pub const PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE: DWORD = 24; +pub const PF_ARM_64BIT_LOADSTORE_ATOMIC: DWORD = 25; +pub const PF_ARM_EXTERNAL_CACHE_AVAILABLE: DWORD = 26; +pub const PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE: DWORD = 27; +pub const PF_RDRAND_INSTRUCTION_AVAILABLE: DWORD = 28; +pub const PF_ARM_V8_INSTRUCTIONS_AVAILABLE: DWORD = 29; +pub const PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE: DWORD = 30; +pub const PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE: DWORD = 31; +pub const PF_RDTSCP_INSTRUCTION_AVAILABLE: DWORD = 32; +pub const XSTATE_LEGACY_FLOATING_POINT: ULONG64 = 0; +pub const XSTATE_LEGACY_SSE: ULONG64 = 1; +pub const XSTATE_GSSE: ULONG64 = 2; +pub const XSTATE_AVX: ULONG64 = XSTATE_GSSE; +pub const XSTATE_MPX_BNDREGS: ULONG64 = 3; +pub const XSTATE_MPX_BNDCSR: ULONG64 = 4; +pub const XSTATE_AVX512_KMASK: ULONG64 = 5; +pub const XSTATE_AVX512_ZMM_H: ULONG64 = 6; +pub const XSTATE_AVX512_ZMM: ULONG64 = 7; +pub const XSTATE_IPT: ULONG64 = 8; +pub const XSTATE_LWP: ULONG64 = 62; +pub const MAXIMUM_XSTATE_FEATURES: usize = 64; +pub const XSTATE_MASK_LEGACY_FLOATING_POINT: ULONG64 = 1 << XSTATE_LEGACY_FLOATING_POINT; +pub const XSTATE_MASK_LEGACY_SSE: ULONG64 = 1 << XSTATE_LEGACY_SSE; +pub const XSTATE_MASK_LEGACY: ULONG64 = XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE; +pub const XSTATE_MASK_GSSE: ULONG64 = 1 << XSTATE_GSSE; +pub const XSTATE_MASK_AVX: ULONG64 = XSTATE_MASK_GSSE; +pub const XSTATE_MASK_MPX: ULONG64 = (1 << XSTATE_MPX_BNDREGS) | (1 << XSTATE_MPX_BNDCSR); +pub const XSTATE_MASK_AVX512: ULONG64 = (1 << XSTATE_AVX512_KMASK) | (1 << XSTATE_AVX512_ZMM_H) + | (1 << XSTATE_AVX512_ZMM); +pub const XSTATE_MASK_IPT: ULONG64 = 1 << XSTATE_IPT; +pub const XSTATE_MASK_LWP: ULONG64 = 1 << XSTATE_LWP; +pub const XSTATE_MASK_ALLOWED: ULONG64 = XSTATE_MASK_LEGACY | XSTATE_MASK_AVX | XSTATE_MASK_MPX + | XSTATE_MASK_AVX512 | XSTATE_MASK_IPT | XSTATE_MASK_LWP; +pub const XSTATE_MASK_PERSISTENT: ULONG64 = (1 << XSTATE_MPX_BNDCSR) | XSTATE_MASK_LWP; +pub const XSTATE_COMPACTION_ENABLE: ULONG64 = 63; +pub const XSTATE_COMPACTION_ENABLE_MASK: ULONG64 = 1 << XSTATE_COMPACTION_ENABLE; +pub const XSTATE_ALIGN_BIT: ULONG64 = 1; +pub const XSTATE_ALIGN_MASK: ULONG64 = 1 << XSTATE_ALIGN_BIT; +pub const XSTATE_CONTROLFLAG_XSAVEOPT_MASK: ULONG64 = 1; +pub const XSTATE_CONTROLFLAG_XSAVEC_MASK: ULONG64 = 2; +pub const XSTATE_CONTROLFLAG_VALID_MASK: ULONG64 = XSTATE_CONTROLFLAG_XSAVEOPT_MASK + | XSTATE_CONTROLFLAG_XSAVEC_MASK; +STRUCT!{struct XSTATE_FEATURE { + Offset: DWORD, + Size: DWORD, +}} +pub type PXSTATE_FEATURE = *mut XSTATE_FEATURE; +STRUCT!{struct XSTATE_CONFIGURATION { + EnabledFeatures: DWORD64, + EnabledVolatileFeatures: DWORD64, + Size: DWORD, + ControlFlags: DWORD, + Features: [XSTATE_FEATURE; MAXIMUM_XSTATE_FEATURES], + EnabledSupervisorFeatures: DWORD64, + AlignedFeatures: DWORD64, + AllFeatureSize: DWORD, + AllFeatures: [DWORD; MAXIMUM_XSTATE_FEATURES], +}} +BITFIELD!(XSTATE_CONFIGURATION ControlFlags: DWORD [ + OptimizedSave set_OptimizedSave[0..1], + CompactionEnabled set_CompactionEnabled[1..2], +]); +pub type PXSTATE_CONFIGURATION = *mut XSTATE_CONFIGURATION; +STRUCT!{struct MEMORY_BASIC_INFORMATION { + BaseAddress: PVOID, + AllocationBase: PVOID, + AllocationProtect: DWORD, + RegionSize: SIZE_T, + State: DWORD, + Protect: DWORD, + Type: DWORD, +}} +pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION; +STRUCT!{struct MEMORY_BASIC_INFORMATION32 { + BaseAddress: DWORD, + AllocationBase: DWORD, + AllocationProtect: DWORD, + RegionSize: DWORD, + State: DWORD, + Protect: DWORD, + Type: DWORD, +}} +pub type PMEMORY_BASIC_INFORMATION32 = *mut MEMORY_BASIC_INFORMATION32; +STRUCT!{struct MEMORY_BASIC_INFORMATION64 { // FIXME: align 16 + BaseAddress: ULONGLONG, + AllocationBase: ULONGLONG, + AllocationProtect: DWORD, + __alignment1: DWORD, + RegionSize: ULONGLONG, + State: DWORD, + Protect: DWORD, + Type: DWORD, + __alignment2: DWORD, +}} +pub type PMEMORY_BASIC_INFORMATION64 = *mut MEMORY_BASIC_INFORMATION64; +pub const CFG_CALL_TARGET_VALID: ULONG_PTR = 0x00000001; +pub const CFG_CALL_TARGET_PROCESSED: ULONG_PTR = 0x00000002; +pub const CFG_CALL_TARGET_CONVERT_EXPORT_SUPPRESSED_TO_VALID: ULONG_PTR = 0x00000004; +STRUCT!{struct CFG_CALL_TARGET_INFO { + Offset: ULONG_PTR, + Flags: ULONG_PTR, +}} +pub type PCFG_CALL_TARGET_INFO = *mut CFG_CALL_TARGET_INFO; +pub const SECTION_QUERY: DWORD = 0x0001; +pub const SECTION_MAP_WRITE: DWORD = 0x0002; +pub const SECTION_MAP_READ: DWORD = 0x0004; +pub const SECTION_MAP_EXECUTE: DWORD = 0x0008; +pub const SECTION_EXTEND_SIZE: DWORD = 0x0010; +pub const SECTION_MAP_EXECUTE_EXPLICIT: DWORD = 0x0020; +pub const SECTION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY + | SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE; +pub const SESSION_QUERY_ACCESS: DWORD = 0x0001; +pub const SESSION_MODIFY_ACCESS: DWORD = 0x0002; +pub const SESSION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SESSION_QUERY_ACCESS + | SESSION_MODIFY_ACCESS; +pub const MEMORY_PARTITION_QUERY_ACCESS: DWORD = 0x0001; +pub const MEMORY_PARTITION_MODIFY_ACCESS: DWORD = 0x0002; +pub const MEMORY_PARTITION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE + | MEMORY_PARTITION_QUERY_ACCESS | MEMORY_PARTITION_MODIFY_ACCESS; +pub const PAGE_NOACCESS: DWORD = 0x01; +pub const PAGE_READONLY: DWORD = 0x02; +pub const PAGE_READWRITE: DWORD = 0x04; +pub const PAGE_WRITECOPY: DWORD = 0x08; +pub const PAGE_EXECUTE: DWORD = 0x10; +pub const PAGE_EXECUTE_READ: DWORD = 0x20; +pub const PAGE_EXECUTE_READWRITE: DWORD = 0x40; +pub const PAGE_EXECUTE_WRITECOPY: DWORD = 0x80; +pub const PAGE_GUARD: DWORD = 0x100; +pub const PAGE_NOCACHE: DWORD = 0x200; +pub const PAGE_WRITECOMBINE: DWORD = 0x400; +pub const PAGE_REVERT_TO_FILE_MAP: DWORD = 0x80000000; +pub const PAGE_TARGETS_NO_UPDATE: DWORD = 0x40000000; +pub const PAGE_TARGETS_INVALID: DWORD = 0x40000000; +pub const PAGE_ENCLAVE_UNVALIDATED: DWORD = 0x20000000; +pub const MEM_COMMIT: DWORD = 0x1000; +pub const MEM_RESERVE: DWORD = 0x2000; +pub const MEM_DECOMMIT: DWORD = 0x4000; +pub const MEM_RELEASE: DWORD = 0x8000; +pub const MEM_FREE: DWORD = 0x10000; +pub const MEM_PRIVATE: DWORD = 0x20000; +pub const MEM_MAPPED: DWORD = 0x40000; +pub const MEM_RESET: DWORD = 0x80000; +pub const MEM_TOP_DOWN: DWORD = 0x100000; +pub const MEM_WRITE_WATCH: DWORD = 0x200000; +pub const MEM_PHYSICAL: DWORD = 0x400000; +pub const MEM_ROTATE: DWORD = 0x800000; +pub const MEM_DIFFERENT_IMAGE_BASE_OK: DWORD = 0x800000; +pub const MEM_RESET_UNDO: DWORD = 0x1000000; +pub const MEM_LARGE_PAGES: DWORD = 0x20000000; +pub const MEM_4MB_PAGES: DWORD = 0x80000000; +pub const MEM_64K_PAGES: DWORD = MEM_LARGE_PAGES | MEM_PHYSICAL; +pub const SEC_64K_PAGES: DWORD = 0x00080000; +pub const SEC_FILE: DWORD = 0x800000; +pub const SEC_IMAGE: DWORD = 0x1000000; +pub const SEC_PROTECTED_IMAGE: DWORD = 0x2000000; +pub const SEC_RESERVE: DWORD = 0x4000000; +pub const SEC_COMMIT: DWORD = 0x8000000; +pub const SEC_NOCACHE: DWORD = 0x10000000; +pub const SEC_WRITECOMBINE: DWORD = 0x40000000; +pub const SEC_LARGE_PAGES: DWORD = 0x80000000; +pub const SEC_IMAGE_NO_EXECUTE: DWORD = (SEC_IMAGE | SEC_NOCACHE); +pub const MEM_IMAGE: DWORD = SEC_IMAGE; +pub const WRITE_WATCH_FLAG_RESET: DWORD = 0x01; +pub const MEM_UNMAP_WITH_TRANSIENT_BOOST: DWORD = 0x01; +pub const ENCLAVE_TYPE_SGX: DWORD = 0x00000001; +STRUCT!{struct ENCLAVE_CREATE_INFO_SGX { + Secs: [BYTE; 4096], +}} +pub type PENCLAVE_CREATE_INFO_SGX = *mut ENCLAVE_CREATE_INFO_SGX; +STRUCT!{struct ENCLAVE_INIT_INFO_SGX { + SigStruct: [BYTE; 1808], + Reserved1: [BYTE; 240], + EInitToken: [BYTE; 304], + Reserved2: [BYTE; 1744], +}} +pub type PENCLAVE_INIT_INFO_SGX = *mut ENCLAVE_INIT_INFO_SGX; +pub const FILE_READ_DATA: DWORD = 0x0001; +pub const FILE_LIST_DIRECTORY: DWORD = 0x0001; +pub const FILE_WRITE_DATA: DWORD = 0x0002; +pub const FILE_ADD_FILE: DWORD = 0x0002; +pub const FILE_APPEND_DATA: DWORD = 0x0004; +pub const FILE_ADD_SUBDIRECTORY: DWORD = 0x0004; +pub const FILE_CREATE_PIPE_INSTANCE: DWORD = 0x0004; +pub const FILE_READ_EA: DWORD = 0x0008; +pub const FILE_WRITE_EA: DWORD = 0x0010; +pub const FILE_EXECUTE: DWORD = 0x0020; +pub const FILE_TRAVERSE: DWORD = 0x0020; +pub const FILE_DELETE_CHILD: DWORD = 0x0040; +pub const FILE_READ_ATTRIBUTES: DWORD = 0x0080; +pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x0100; +pub const FILE_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF; +pub const FILE_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ | FILE_READ_DATA + | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE; +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_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES + | FILE_EXECUTE | SYNCHRONIZE; +pub const FILE_SHARE_READ: DWORD = 0x00000001; +pub const FILE_SHARE_WRITE: DWORD = 0x00000002; +pub const FILE_SHARE_DELETE: DWORD = 0x00000004; +pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x00000001; +pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x00000002; +pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x00000004; +pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x00000010; +pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x00000020; +pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x00000040; +pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x00000080; +pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x00000100; +pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x00000200; +pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x00000400; +pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x00000800; +pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x00001000; +pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x00002000; +pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x00004000; +pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x00008000; +pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x00010000; +pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x00020000; +pub const FILE_ATTRIBUTE_EA: DWORD = 0x00040000; +pub const FILE_ATTRIBUTE_PINNED: DWORD = 0x00080000; +pub const FILE_ATTRIBUTE_UNPINNED: DWORD = 0x00100000; +pub const FILE_ATTRIBUTE_RECALL_ON_OPEN: DWORD = 0x00040000; +pub const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS: DWORD = 0x00400000; +pub const FILE_NOTIFY_CHANGE_FILE_NAME: DWORD = 0x00000001; +pub const FILE_NOTIFY_CHANGE_DIR_NAME: DWORD = 0x00000002; +pub const FILE_NOTIFY_CHANGE_ATTRIBUTES: DWORD = 0x00000004; +pub const FILE_NOTIFY_CHANGE_SIZE: DWORD = 0x00000008; +pub const FILE_NOTIFY_CHANGE_LAST_WRITE: DWORD = 0x00000010; +pub const FILE_NOTIFY_CHANGE_LAST_ACCESS: DWORD = 0x00000020; +pub const FILE_NOTIFY_CHANGE_CREATION: DWORD = 0x00000040; +pub const FILE_NOTIFY_CHANGE_SECURITY: DWORD = 0x00000100; +pub const FILE_ACTION_ADDED: DWORD = 0x00000001; +pub const FILE_ACTION_REMOVED: DWORD = 0x00000002; +pub const FILE_ACTION_MODIFIED: DWORD = 0x00000003; +pub const FILE_ACTION_RENAMED_OLD_NAME: DWORD = 0x00000004; +pub const FILE_ACTION_RENAMED_NEW_NAME: DWORD = 0x00000005; +pub const MAILSLOT_NO_MESSAGE: DWORD = 0xFFFFFFFF; +pub const MAILSLOT_WAIT_FOREVER: DWORD = 0xFFFFFFFF; +pub const FILE_CASE_SENSITIVE_SEARCH: DWORD = 0x00000001; +pub const FILE_CASE_PRESERVED_NAMES: DWORD = 0x00000002; +pub const FILE_UNICODE_ON_DISK: DWORD = 0x00000004; +pub const FILE_PERSISTENT_ACLS: DWORD = 0x00000008; +pub const FILE_FILE_COMPRESSION: DWORD = 0x00000010; +pub const FILE_VOLUME_QUOTAS: DWORD = 0x00000020; +pub const FILE_SUPPORTS_SPARSE_FILES: DWORD = 0x00000040; +pub const FILE_SUPPORTS_REPARSE_POINTS: DWORD = 0x00000080; +pub const FILE_SUPPORTS_REMOTE_STORAGE: DWORD = 0x00000100; +pub const FILE_RETURNS_CLEANUP_RESULT_INFO: DWORD = 0x00000200; +pub const FILE_VOLUME_IS_COMPRESSED: DWORD = 0x00008000; +pub const FILE_SUPPORTS_OBJECT_IDS: DWORD = 0x00010000; +pub const FILE_SUPPORTS_ENCRYPTION: DWORD = 0x00020000; +pub const FILE_NAMED_STREAMS: DWORD = 0x00040000; +pub const FILE_READ_ONLY_VOLUME: DWORD = 0x00080000; +pub const FILE_SEQUENTIAL_WRITE_ONCE: DWORD = 0x00100000; +pub const FILE_SUPPORTS_TRANSACTIONS: DWORD = 0x00200000; +pub const FILE_SUPPORTS_HARD_LINKS: DWORD = 0x00400000; +pub const FILE_SUPPORTS_EXTENDED_ATTRIBUTES: DWORD = 0x00800000; +pub const FILE_SUPPORTS_OPEN_BY_FILE_ID: DWORD = 0x01000000; +pub const FILE_SUPPORTS_USN_JOURNAL: DWORD = 0x02000000; +pub const FILE_SUPPORTS_INTEGRITY_STREAMS: DWORD = 0x04000000; +pub const FILE_SUPPORTS_BLOCK_REFCOUNTING: DWORD = 0x08000000; +pub const FILE_SUPPORTS_SPARSE_VDL: DWORD = 0x10000000; +pub const FILE_DAX_VOLUME: DWORD = 0x20000000; +pub const FILE_SUPPORTS_GHOSTING: DWORD = 0x40000000; +pub const FILE_INVALID_FILE_ID: LONGLONG = -1; +STRUCT!{struct FILE_ID_128 { + Identifier: [BYTE; 16], +}} +pub type PFILE_ID_128 = *mut FILE_ID_128; +STRUCT!{struct FILE_NOTIFY_INFORMATION { + NextEntryOffset: DWORD, + Action: DWORD, + FileNameLength: DWORD, + FileName: [WCHAR; 1], +}} +STRUCT!{struct FILE_SEGMENT_ELEMENT { + Buffer: PVOID64, + Alignment: ULONGLONG, +}} +pub type PFILE_SEGMENT_ELEMENT = *mut FILE_SEGMENT_ELEMENT; +pub const FLUSH_FLAGS_FILE_DATA_ONLY: ULONG = 0x00000001; +pub const FLUSH_FLAGS_NO_SYNC: ULONG = 0x00000002; +pub const FLUSH_FLAGS_FILE_DATA_SYNC_ONLY: ULONG = 0x00000004; +STRUCT!{struct REPARSE_GUID_DATA_BUFFER_GenericReparseBuffer { + DataBuffer: [BYTE; 1], +}} +STRUCT!{struct REPARSE_GUID_DATA_BUFFER { + ReparseTag: DWORD, + ReparseDataLength: WORD, + Reserved: WORD, + ReparseGuid: GUID, + GenericReparseBuffer: REPARSE_GUID_DATA_BUFFER_GenericReparseBuffer, +}} +pub type PREPARSE_GUID_DATA_BUFFER = *mut REPARSE_GUID_DATA_BUFFER; +pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: DWORD = 16 * 1024; +pub const IO_REPARSE_TAG_RESERVED_ZERO: DWORD = 0; +pub const IO_REPARSE_TAG_RESERVED_ONE: DWORD = 1; +pub const IO_REPARSE_TAG_RESERVED_TWO: DWORD = 2; +pub const IO_REPARSE_TAG_RESERVED_RANGE: DWORD = IO_REPARSE_TAG_RESERVED_TWO; +#[inline] +pub fn IsReparseTagMicrosoft(_tag: DWORD) -> bool { + (_tag & 0x80000000) != 0 +} +#[inline] +pub fn IsReparseTagNameSurrogate(_tag: DWORD) -> bool { + (_tag & 0x20000000) != 0 +} +#[inline] +pub fn IsReparseTagDirectory(_tag: DWORD) -> bool { + (_tag & 0x10000000) != 0 +} +pub const IO_REPARSE_TAG_MOUNT_POINT: DWORD = 0xA0000003; +pub const IO_REPARSE_TAG_HSM: DWORD = 0xC0000004; +pub const IO_REPARSE_TAG_HSM2: DWORD = 0x80000006; +pub const IO_REPARSE_TAG_SIS: DWORD = 0x80000007; +pub const IO_REPARSE_TAG_WIM: DWORD = 0x80000008; +pub const IO_REPARSE_TAG_CSV: DWORD = 0x80000009; +pub const IO_REPARSE_TAG_DFS: DWORD = 0x8000000A; +pub const IO_REPARSE_TAG_SYMLINK: DWORD = 0xA000000C; +pub const IO_REPARSE_TAG_DFSR: DWORD = 0x80000012; +pub const IO_REPARSE_TAG_DEDUP: DWORD = 0x80000013; +pub const IO_REPARSE_TAG_NFS: DWORD = 0x80000014; +pub const IO_REPARSE_TAG_FILE_PLACEHOLDER: DWORD = 0x80000015; +pub const IO_REPARSE_TAG_WOF: DWORD = 0x80000017; +pub const IO_REPARSE_TAG_WCI: DWORD = 0x80000018; +pub const IO_REPARSE_TAG_GLOBAL_REPARSE: DWORD = 0xA0000019; +pub const IO_REPARSE_TAG_CLOUD: DWORD = 0x9000001A; +pub const IO_REPARSE_TAG_CLOUD_ROOT: DWORD = 0x9000101A; +pub const IO_REPARSE_TAG_CLOUD_ON_DEMAND: DWORD = 0x9000201A; +pub const IO_REPARSE_TAG_CLOUD_ROOT_ON_DEMAND: DWORD = 0x9000301A; +pub const IO_REPARSE_TAG_APPEXECLINK: DWORD = 0x8000001B; +pub const IO_REPARSE_TAG_GVFS: DWORD = 0x9000001C; +pub const IO_REPARSE_TAG_WCI_TOMBSTONE: DWORD = 0xA000001F; +pub const IO_REPARSE_TAG_UNHANDLED: DWORD = 0x80000020; +pub const IO_REPARSE_TAG_ONEDRIVE: DWORD = 0x80000021; +pub const IO_REPARSE_TAG_GVFS_TOMBSTONE: DWORD = 0xA0000022; +pub const SCRUB_DATA_INPUT_FLAG_RESUME: DWORD = 0x00000001; +pub const SCRUB_DATA_INPUT_FLAG_SKIP_IN_SYNC: DWORD = 0x00000002; +pub const SCRUB_DATA_INPUT_FLAG_SKIP_NON_INTEGRITY_DATA: DWORD = 0x00000004; +pub const SCRUB_DATA_OUTPUT_FLAG_INCOMPLETE: DWORD = 0x00000001; +pub const SCRUB_DATA_OUTPUT_FLAG_NON_USER_DATA_RANGE: DWORD = 0x00010000; +pub const SCRUB_DATA_OUTPUT_FLAG_PARITY_EXTENT_DATA_RETURNED: DWORD = 0x00020000; +pub const SCRUB_DATA_OUTPUT_FLAG_RESUME_CONTEXT_LENGTH_SPECIFIED: DWORD = 0x00040000; +STRUCT!{struct SCRUB_DATA_INPUT { + Size: DWORD, + Flags: DWORD, + MaximumIos: DWORD, + Reserved: [DWORD; 17], + ResumeContext: [BYTE; 816], +}} +pub type PSCRUB_DATA_INPUT = *mut SCRUB_DATA_INPUT; +STRUCT!{struct SCRUB_PARITY_EXTENT { + Offset: LONGLONG, + Length: ULONGLONG, +}} +pub type PSCRUB_PARITY_EXTENT = *mut SCRUB_PARITY_EXTENT; +STRUCT!{struct SCRUB_PARITY_EXTENT_DATA { + Size: WORD, + Flags: WORD, + NumberOfParityExtents: WORD, + MaximumNumberOfParityExtents: WORD, + ParityExtents: [SCRUB_PARITY_EXTENT; ANYSIZE_ARRAY], +}} +pub type PSCRUB_PARITY_EXTENT_DATA = *mut SCRUB_PARITY_EXTENT_DATA; +STRUCT!{struct SCRUB_DATA_OUTPUT { + Size: DWORD, + Flags: DWORD, + Status: DWORD, + ErrorFileOffset: ULONGLONG, + ErrorLength: ULONGLONG, + NumberOfBytesRepaired: ULONGLONG, + NumberOfBytesFailed: ULONGLONG, + InternalFileReference: ULONGLONG, + ResumeContextLength: WORD, + ParityExtentDataOffset: WORD, + Reserved: [DWORD; 5], + ResumeContext: [BYTE; 816], +}} +pub type PSCRUB_DATA_OUTPUT = *mut SCRUB_DATA_OUTPUT; +ENUM!{enum SharedVirtualDiskSupportType { + SharedVirtualDisksUnsupported = 0, + SharedVirtualDisksSupported = 1, + SharedVirtualDiskSnapshotsSupported = 3, + SharedVirtualDiskCDPSnapshotsSupported = 7, +}} +ENUM!{enum SharedVirtualDiskHandleState { + SharedVirtualDiskHandleStateNone = 0, + SharedVirtualDiskHandleStateFileShared = 1, + SharedVirtualDiskHandleStateHandleShared = 3, +}} +STRUCT!{struct SHARED_VIRTUAL_DISK_SUPPORT { + SharedVirtualDiskSupport: SharedVirtualDiskSupportType, + HandleState: SharedVirtualDiskHandleState, +}} +pub type PSHARED_VIRTUAL_DISK_SUPPORT = *mut SHARED_VIRTUAL_DISK_SUPPORT; +#[inline] +pub fn IsVirtualDiskFileShared(HandleState: SharedVirtualDiskHandleState) -> bool { + (HandleState & SharedVirtualDiskHandleStateFileShared) != 0 +} +pub const IO_COMPLETION_MODIFY_STATE: DWORD = 0x0002; +pub const IO_COMPLETION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3; +pub const IO_QOS_MAX_RESERVATION: DWORD64 = 1000000000; +pub const SMB_CCF_APP_INSTANCE_EA_NAME: &'static str = "ClusteredApplicationInstance"; +pub const NETWORK_APP_INSTANCE_CSV_FLAGS_VALID_ONLY_IF_CSV_COORDINATOR: DWORD = 0x00000001; +STRUCT!{struct NETWORK_APP_INSTANCE_EA { + AppInstanceID: GUID, + CsvFlags: DWORD, +}} +pub type PNETWORK_APP_INSTANCE_EA = *mut NETWORK_APP_INSTANCE_EA; +pub const DUPLICATE_CLOSE_SOURCE: DWORD = 0x00000001; +pub const DUPLICATE_SAME_ACCESS: DWORD = 0x00000002; +DEFINE_GUID!{GUID_MAX_POWER_SAVINGS, + 0xa1841308, 0x3541, 0x4fab, 0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a} +DEFINE_GUID!{GUID_MIN_POWER_SAVINGS, + 0x8c5e7fda, 0xe8bf, 0x4a96, 0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c} +DEFINE_GUID!{GUID_TYPICAL_POWER_SAVINGS, + 0x381b4222, 0xf694, 0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e} +DEFINE_GUID!{NO_SUBGROUP_GUID, + 0xfea3413e, 0x7e05, 0x4911, 0x9a, 0x71, 0x70, 0x03, 0x31, 0xf1, 0xc2, 0x94} +DEFINE_GUID!{ALL_POWERSCHEMES_GUID, + 0x68a1e95e, 0x13ea, 0x41e1, 0x80, 0x11, 0x0c, 0x49, 0x6c, 0xa4, 0x90, 0xb0} +DEFINE_GUID!{GUID_POWERSCHEME_PERSONALITY, + 0x245d8541, 0x3943, 0x4422, 0xb0, 0x25, 0x13, 0xa7, 0x84, 0xf6, 0x79, 0xb7} +DEFINE_GUID!{GUID_ACTIVE_POWERSCHEME, + 0x31f9f286, 0x5084, 0x42fe, 0xb7, 0x20, 0x2b, 0x02, 0x64, 0x99, 0x37, 0x63} +DEFINE_GUID!{GUID_IDLE_RESILIENCY_SUBGROUP, + 0x2e601130, 0x5351, 0x4d9d, 0x8e, 0x4, 0x25, 0x29, 0x66, 0xba, 0xd0, 0x54} +DEFINE_GUID!{GUID_IDLE_RESILIENCY_PERIOD, + 0xc42b79aa, 0xaa3a, 0x484b, 0xa9, 0x8f, 0x2c, 0xf3, 0x2a, 0xa9, 0xa, 0x28} +DEFINE_GUID!{GUID_DEEP_SLEEP_ENABLED, + 0xd502f7ee, 0x1dc7, 0x4efd, 0xa5, 0x5d, 0xf0, 0x4b, 0x6f, 0x5c, 0x5, 0x45} +DEFINE_GUID!{GUID_DEEP_SLEEP_PLATFORM_STATE, + 0xd23f2fb8, 0x9536, 0x4038, 0x9c, 0x94, 0x1c, 0xe0, 0x2e, 0x5c, 0x21, 0x52} +DEFINE_GUID!{GUID_DISK_COALESCING_POWERDOWN_TIMEOUT, + 0xc36f0eb4, 0x2988, 0x4a70, 0x8e, 0xee, 0x8, 0x84, 0xfc, 0x2c, 0x24, 0x33} +DEFINE_GUID!{GUID_EXECUTION_REQUIRED_REQUEST_TIMEOUT, + 0x3166bc41, 0x7e98, 0x4e03, 0xb3, 0x4e, 0xec, 0xf, 0x5f, 0x2b, 0x21, 0x8e} +DEFINE_GUID!{GUID_VIDEO_SUBGROUP, + 0x7516b95f, 0xf776, 0x4464, 0x8c, 0x53, 0x06, 0x16, 0x7f, 0x40, 0xcc, 0x99} +DEFINE_GUID!{GUID_VIDEO_POWERDOWN_TIMEOUT, + 0x3c0bc021, 0xc8a8, 0x4e07, 0xa9, 0x73, 0x6b, 0x14, 0xcb, 0xcb, 0x2b, 0x7e} +DEFINE_GUID!{GUID_VIDEO_ANNOYANCE_TIMEOUT, + 0x82dbcf2d, 0xcd67, 0x40c5, 0xbf, 0xdc, 0x9f, 0x1a, 0x5c, 0xcd, 0x46, 0x63} +DEFINE_GUID!{GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE, + 0xeed904df, 0xb142, 0x4183, 0xb1, 0x0b, 0x5a, 0x11, 0x97, 0xa3, 0x78, 0x64} +DEFINE_GUID!{GUID_VIDEO_DIM_TIMEOUT, + 0x17aaa29b, 0x8b43, 0x4b94, 0xaa, 0xfe, 0x35, 0xf6, 0x4d, 0xaa, 0xf1, 0xee} +DEFINE_GUID!{GUID_VIDEO_ADAPTIVE_POWERDOWN, + 0x90959d22, 0xd6a1, 0x49b9, 0xaf, 0x93, 0xbc, 0xe8, 0x85, 0xad, 0x33, 0x5b} +DEFINE_GUID!{GUID_MONITOR_POWER_ON, + 0x02731015, 0x4510, 0x4526, 0x99, 0xe6, 0xe5, 0xa1, 0x7e, 0xbd, 0x1a, 0xea} +DEFINE_GUID!{GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS, + 0xaded5e82, 0xb909, 0x4619, 0x99, 0x49, 0xf5, 0xd7, 0x1d, 0xac, 0x0b, 0xcb} +DEFINE_GUID!{GUID_DEVICE_POWER_POLICY_VIDEO_DIM_BRIGHTNESS, + 0xf1fbfde2, 0xa960, 0x4165, 0x9f, 0x88, 0x50, 0x66, 0x79, 0x11, 0xce, 0x96} +DEFINE_GUID!{GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS, + 0x8ffee2c6, 0x2d01, 0x46be, 0xad, 0xb9, 0x39, 0x8a, 0xdd, 0xc5, 0xb4, 0xff} +DEFINE_GUID!{GUID_VIDEO_ADAPTIVE_DISPLAY_BRIGHTNESS, + 0xfbd9aa66, 0x9553, 0x4097, 0xba, 0x44, 0xed, 0x6e, 0x9d, 0x65, 0xea, 0xb8} +DEFINE_GUID!{GUID_CONSOLE_DISPLAY_STATE, + 0x6fe69556, 0x704a, 0x47a0, 0x8f, 0x24, 0xc2, 0x8d, 0x93, 0x6f, 0xda, 0x47} +DEFINE_GUID!{GUID_ALLOW_DISPLAY_REQUIRED, + 0xa9ceb8da, 0xcd46, 0x44fb, 0xa9, 0x8b, 0x02, 0xaf, 0x69, 0xde, 0x46, 0x23} +DEFINE_GUID!{GUID_VIDEO_CONSOLE_LOCK_TIMEOUT, + 0x8ec4b3a5, 0x6868, 0x48c2, 0xbe, 0x75, 0x4f, 0x30, 0x44, 0xbe, 0x88, 0xa7} +DEFINE_GUID!{GUID_ADAPTIVE_POWER_BEHAVIOR_SUBGROUP, + 0x8619b916, 0xe004, 0x4dd8, 0x9b, 0x66, 0xda, 0xe8, 0x6f, 0x80, 0x66, 0x98} +DEFINE_GUID!{GUID_NON_ADAPTIVE_INPUT_TIMEOUT, + 0x5adbbfbc, 0x74e, 0x4da1, 0xba, 0x38, 0xdb, 0x8b, 0x36, 0xb2, 0xc8, 0xf3} +DEFINE_GUID!{GUID_ADAPTIVE_INPUT_CONTROLLER_STATE, + 0xe98fae9, 0xf45a, 0x4de1, 0xa7, 0x57, 0x60, 0x31, 0xf1, 0x97, 0xf6, 0xea} +DEFINE_GUID!{GUID_DISK_SUBGROUP, + 0x0012ee47, 0x9041, 0x4b5d, 0x9b, 0x77, 0x53, 0x5f, 0xba, 0x8b, 0x14, 0x42} +DEFINE_GUID!{GUID_DISK_MAX_POWER, + 0x51dea550, 0xbb38, 0x4bc4, 0x99, 0x1b, 0xea, 0xcf, 0x37, 0xbe, 0x5e, 0xc8} +DEFINE_GUID!{GUID_DISK_POWERDOWN_TIMEOUT, + 0x6738e2c4, 0xe8a5, 0x4a42, 0xb1, 0x6a, 0xe0, 0x40, 0xe7, 0x69, 0x75, 0x6e} +DEFINE_GUID!{GUID_DISK_IDLE_TIMEOUT, + 0x58e39ba8, 0xb8e6, 0x4ef6, 0x90, 0xd0, 0x89, 0xae, 0x32, 0xb2, 0x58, 0xd6} +DEFINE_GUID!{GUID_DISK_BURST_IGNORE_THRESHOLD, + 0x80e3c60e, 0xbb94, 0x4ad8, 0xbb, 0xe0, 0x0d, 0x31, 0x95, 0xef, 0xc6, 0x63} +DEFINE_GUID!{GUID_DISK_ADAPTIVE_POWERDOWN, + 0x396a32e1, 0x499a, 0x40b2, 0x91, 0x24, 0xa9, 0x6a, 0xfe, 0x70, 0x76, 0x67} +DEFINE_GUID!{GUID_SLEEP_SUBGROUP, + 0x238c9fa8, 0x0aad, 0x41ed, 0x83, 0xf4, 0x97, 0xbe, 0x24, 0x2c, 0x8f, 0x20} +DEFINE_GUID!{GUID_SLEEP_IDLE_THRESHOLD, + 0x81cd32e0, 0x7833, 0x44f3, 0x87, 0x37, 0x70, 0x81, 0xf3, 0x8d, 0x1f, 0x70} +DEFINE_GUID!{GUID_STANDBY_TIMEOUT, + 0x29f6c1db, 0x86da, 0x48c5, 0x9f, 0xdb, 0xf2, 0xb6, 0x7b, 0x1f, 0x44, 0xda} +DEFINE_GUID!{GUID_UNATTEND_SLEEP_TIMEOUT, + 0x7bc4a2f9, 0xd8fc, 0x4469, 0xb0, 0x7b, 0x33, 0xeb, 0x78, 0x5a, 0xac, 0xa0} +DEFINE_GUID!{GUID_HIBERNATE_TIMEOUT, + 0x9d7815a6, 0x7ee4, 0x497e, 0x88, 0x88, 0x51, 0x5a, 0x05, 0xf0, 0x23, 0x64} +DEFINE_GUID!{GUID_HIBERNATE_FASTS4_POLICY, + 0x94ac6d29, 0x73ce, 0x41a6, 0x80, 0x9f, 0x63, 0x63, 0xba, 0x21, 0xb4, 0x7e} +DEFINE_GUID!{GUID_CRITICAL_POWER_TRANSITION, + 0xb7a27025, 0xe569, 0x46c2, 0xa5, 0x04, 0x2b, 0x96, 0xca, 0xd2, 0x25, 0xa1} +DEFINE_GUID!{GUID_SYSTEM_AWAYMODE, + 0x98a7f580, 0x01f7, 0x48aa, 0x9c, 0x0f, 0x44, 0x35, 0x2c, 0x29, 0xe5, 0xc0} +DEFINE_GUID!{GUID_ALLOW_AWAYMODE, + 0x25dfa149, 0x5dd1, 0x4736, 0xb5, 0xab, 0xe8, 0xa3, 0x7b, 0x5b, 0x81, 0x87} +DEFINE_GUID!{GUID_USER_PRESENCE_PREDICTION, + 0x82011705, 0xfb95, 0x4d46, 0x8d, 0x35, 0x40, 0x42, 0xb1, 0xd2, 0xd, 0xef} +DEFINE_GUID!{GUID_STANDBY_BUDGET_GRACE_PERIOD, + 0x60c07fe1, 0x0556, 0x45cf, 0x99, 0x03, 0xd5, 0x6e, 0x32, 0x21, 0x2, 0x42} +DEFINE_GUID!{GUID_STANDBY_BUDGET_PERCENT, + 0x9fe527be, 0x1b70, 0x48da, 0x93, 0x0d, 0x7b, 0xcf, 0x17, 0xb4, 0x49, 0x90} +DEFINE_GUID!{GUID_STANDBY_RESERVE_GRACE_PERIOD, + 0xc763ee92, 0x71e8, 0x4127, 0x84, 0xeb, 0xf6, 0xed, 0x04, 0x3a, 0x3e, 0x3d} +DEFINE_GUID!{GUID_STANDBY_RESERVE_TIME, + 0x468fe7e5, 0x1158, 0x46ec, 0x88, 0xbc, 0x5b, 0x96, 0xc9, 0xe4, 0x4f, 0xd0} +DEFINE_GUID!{GUID_STANDBY_RESET_PERCENT, + 0x49cb11a5, 0x56e2, 0x4afb, 0x9d, 0x38, 0x3d, 0xf4, 0x78, 0x72, 0xe2, 0x1b} +DEFINE_GUID!{GUID_ALLOW_STANDBY_STATES, + 0xabfc2519, 0x3608, 0x4c2a, 0x94, 0xea, 0x17, 0x1b, 0x0e, 0xd5, 0x46, 0xab} +DEFINE_GUID!{GUID_ALLOW_RTC_WAKE, + 0xbd3b718a, 0x0680, 0x4d9d, 0x8a, 0xb2, 0xe1, 0xd2, 0xb4, 0xac, 0x80, 0x6d} +DEFINE_GUID!{GUID_ALLOW_SYSTEM_REQUIRED, + 0xa4b195f5, 0x8225, 0x47d8, 0x80, 0x12, 0x9d, 0x41, 0x36, 0x97, 0x86, 0xe2} +DEFINE_GUID!{GUID_POWER_SAVING_STATUS, + 0xe00958c0, 0xc213, 0x4ace, 0xac, 0x77, 0xfe, 0xcc, 0xed, 0x2e, 0xee, 0xa5} +DEFINE_GUID!{GUID_ENERGY_SAVER_SUBGROUP, + 0xde830923, 0xa562, 0x41af, 0xa0, 0x86, 0xe3, 0xa2, 0xc6, 0xba, 0xd2, 0xda} +DEFINE_GUID!{GUID_ENERGY_SAVER_BATTERY_THRESHOLD, + 0xe69653ca, 0xcf7f, 0x4f05, 0xaa, 0x73, 0xcb, 0x83, 0x3f, 0xa9, 0x0a, 0xd4} +DEFINE_GUID!{GUID_ENERGY_SAVER_BRIGHTNESS, + 0x13d09884, 0xf74e, 0x474a, 0xa8, 0x52, 0xb6, 0xbd, 0xe8, 0xad, 0x03, 0xa8} +DEFINE_GUID!{GUID_ENERGY_SAVER_POLICY, + 0x5c5bb349, 0xad29, 0x4ee2, 0x9d, 0xb, 0x2b, 0x25, 0x27, 0xf, 0x7a, 0x81} +DEFINE_GUID!{GUID_SYSTEM_BUTTON_SUBGROUP, + 0x4f971e89, 0xeebd, 0x4455, 0xa8, 0xde, 0x9e, 0x59, 0x04, 0x0e, 0x73, 0x47} +pub const POWERBUTTON_ACTION_INDEX_NOTHING: DWORD = 0; +pub const POWERBUTTON_ACTION_INDEX_SLEEP: DWORD = 1; +pub const POWERBUTTON_ACTION_INDEX_HIBERNATE: DWORD = 2; +pub const POWERBUTTON_ACTION_INDEX_SHUTDOWN: DWORD = 3; +pub const POWERBUTTON_ACTION_INDEX_TURN_OFF_THE_DISPLAY: DWORD = 4; +pub const POWERBUTTON_ACTION_VALUE_NOTHING: DWORD = 0; +pub const POWERBUTTON_ACTION_VALUE_SLEEP: DWORD = 2; +pub const POWERBUTTON_ACTION_VALUE_HIBERNATE: DWORD = 3; +pub const POWERBUTTON_ACTION_VALUE_SHUTDOWN: DWORD = 6; +pub const POWERBUTTON_ACTION_VALUE_TURN_OFF_THE_DISPLAY: DWORD = 8; +DEFINE_GUID!{GUID_POWERBUTTON_ACTION, + 0x7648efa3, 0xdd9c, 0x4e3e, 0xb5, 0x66, 0x50, 0xf9, 0x29, 0x38, 0x62, 0x80} +DEFINE_GUID!{GUID_SLEEPBUTTON_ACTION, + 0x96996bc0, 0xad50, 0x47ec, 0x92, 0x3b, 0x6f, 0x41, 0x87, 0x4d, 0xd9, 0xeb} +DEFINE_GUID!{GUID_USERINTERFACEBUTTON_ACTION, + 0xa7066653, 0x8d6c, 0x40a8, 0x91, 0x0e, 0xa1, 0xf5, 0x4b, 0x84, 0xc7, 0xe5} +DEFINE_GUID!{GUID_LIDCLOSE_ACTION, + 0x5ca83367, 0x6e45, 0x459f, 0xa2, 0x7b, 0x47, 0x6b, 0x1d, 0x01, 0xc9, 0x36} +DEFINE_GUID!{GUID_LIDOPEN_POWERSTATE, + 0x99ff10e7, 0x23b1, 0x4c07, 0xa9, 0xd1, 0x5c, 0x32, 0x06, 0xd7, 0x41, 0xb4} +DEFINE_GUID!{GUID_BATTERY_SUBGROUP, + 0xe73a048d, 0xbf27, 0x4f12, 0x97, 0x31, 0x8b, 0x20, 0x76, 0xe8, 0x89, 0x1f} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_0, + 0x637ea02f, 0xbbcb, 0x4015, 0x8e, 0x2c, 0xa1, 0xc7, 0xb9, 0xc0, 0xb5, 0x46} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_0, + 0x9a66d8d7, 0x4ff7, 0x4ef9, 0xb5, 0xa2, 0x5a, 0x32, 0x6c, 0xa2, 0xa4, 0x69} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_0, + 0x5dbb7c9f, 0x38e9, 0x40d2, 0x97, 0x49, 0x4f, 0x8a, 0x0e, 0x9f, 0x64, 0x0f} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_1, + 0xd8742dcb, 0x3e6a, 0x4b3c, 0xb3, 0xfe, 0x37, 0x46, 0x23, 0xcd, 0xcf, 0x06} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_1, + 0x8183ba9a, 0xe910, 0x48da, 0x87, 0x69, 0x14, 0xae, 0x6d, 0xc1, 0x17, 0x0a} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_1, + 0xbcded951, 0x187b, 0x4d05, 0xbc, 0xcc, 0xf7, 0xe5, 0x19, 0x60, 0xc2, 0x58} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_2, + 0x421cba38, 0x1a8e, 0x4881, 0xac, 0x89, 0xe3, 0x3a, 0x8b, 0x04, 0xec, 0xe4} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_2, + 0x07a07ca2, 0xadaf, 0x40d7, 0xb0, 0x77, 0x53, 0x3a, 0xad, 0xed, 0x1b, 0xfa} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_2, + 0x7fd2f0c4, 0xfeb7, 0x4da3, 0x81, 0x17, 0xe3, 0xfb, 0xed, 0xc4, 0x65, 0x82} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_3, + 0x80472613, 0x9780, 0x455e, 0xb3, 0x08, 0x72, 0xd3, 0x00, 0x3c, 0xf2, 0xf8} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_3, + 0x58afd5a6, 0xc2dd, 0x47d2, 0x9f, 0xbf, 0xef, 0x70, 0xcc, 0x5c, 0x59, 0x65} +DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_3, + 0x73613ccf, 0xdbfa, 0x4279, 0x83, 0x56, 0x49, 0x35, 0xf6, 0xbf, 0x62, 0xf3} +DEFINE_GUID!{GUID_PROCESSOR_SETTINGS_SUBGROUP, + 0x54533251, 0x82be, 0x4824, 0x96, 0xc1, 0x47, 0xb6, 0x0b, 0x74, 0x0d, 0x00} +DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_POLICY, + 0x57027304, 0x4af6, 0x4104, 0x92, 0x60, 0xe3, 0xd9, 0x52, 0x48, 0xfc, 0x36} +pub const PERFSTATE_POLICY_CHANGE_IDEAL: DWORD = 0; +pub const PERFSTATE_POLICY_CHANGE_SINGLE: DWORD = 1; +pub const PERFSTATE_POLICY_CHANGE_ROCKET: DWORD = 2; +pub const PERFSTATE_POLICY_CHANGE_IDEAL_AGGRESSIVE: DWORD = 3; +pub const PERFSTATE_POLICY_CHANGE_DECREASE_MAX: DWORD = PERFSTATE_POLICY_CHANGE_ROCKET; +pub const PERFSTATE_POLICY_CHANGE_INCREASE_MAX: DWORD = PERFSTATE_POLICY_CHANGE_IDEAL_AGGRESSIVE; +DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MAXIMUM, + 0xbc5038f7, 0x23e0, 0x4960, 0x96, 0xda, 0x33, 0xab, 0xaf, 0x59, 0x35, 0xec} +DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MAXIMUM_1, + 0xbc5038f7, 0x23e0, 0x4960, 0x96, 0xda, 0x33, 0xab, 0xaf, 0x59, 0x35, 0xed} +DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MINIMUM, + 0x893dee8e, 0x2bef, 0x41e0, 0x89, 0xc6, 0xb5, 0x5d, 0x09, 0x29, 0x96, 0x4c} +DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MINIMUM_1, + 0x893dee8e, 0x2bef, 0x41e0, 0x89, 0xc6, 0xb5, 0x5d, 0x09, 0x29, 0x96, 0x4d} +DEFINE_GUID!{GUID_PROCESSOR_FREQUENCY_LIMIT, + 0x75b0ae3f, 0xbce0, 0x45a7, 0x8c, 0x89, 0xc9, 0x61, 0x1c, 0x25, 0xe1, 0x00} +DEFINE_GUID!{GUID_PROCESSOR_FREQUENCY_LIMIT_1, + 0x75b0ae3f, 0xbce0, 0x45a7, 0x8c, 0x89, 0xc9, 0x61, 0x1c, 0x25, 0xe1, 0x01} +DEFINE_GUID!{GUID_PROCESSOR_ALLOW_THROTTLING, + 0x3b04d4fd, 0x1cc7, 0x4f23, 0xab, 0x1c, 0xd1, 0x33, 0x78, 0x19, 0xc4, 0xbb} +pub const PROCESSOR_THROTTLE_DISABLED: DWORD = 0; +pub const PROCESSOR_THROTTLE_ENABLED: DWORD = 1; +pub const PROCESSOR_THROTTLE_AUTOMATIC: DWORD = 2; +DEFINE_GUID!{GUID_PROCESSOR_IDLESTATE_POLICY, + 0x68f262a7, 0xf621, 0x4069, 0xb9, 0xa5, 0x48, 0x74, 0x16, 0x9b, 0xe2, 0x3c} +DEFINE_GUID!{GUID_PROCESSOR_PERFSTATE_POLICY, + 0xbbdc3814, 0x18e9, 0x4463, 0x8a, 0x55, 0xd1, 0x97, 0x32, 0x7c, 0x45, 0xc0} +DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_THRESHOLD, + 0x06cadf0e, 0x64ed, 0x448a, 0x89, 0x27, 0xce, 0x7b, 0xf9, 0x0e, 0xb3, 0x5d} +DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_THRESHOLD_1, + 0x06cadf0e, 0x64ed, 0x448a, 0x89, 0x27, 0xce, 0x7b, 0xf9, 0x0e, 0xb3, 0x5e} +DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_THRESHOLD, + 0x12a0ab44, 0xfe28, 0x4fa9, 0xb3, 0xbd, 0x4b, 0x64, 0xf4, 0x49, 0x60, 0xa6} +DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_THRESHOLD_1, + 0x12a0ab44, 0xfe28, 0x4fa9, 0xb3, 0xbd, 0x4b, 0x64, 0xf4, 0x49, 0x60, 0xa7} +DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_POLICY, + 0x465e1f50, 0xb610, 0x473a, 0xab, 0x58, 0x0, 0xd1, 0x7, 0x7d, 0xc4, 0x18} +DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_POLICY_1, + 0x465e1f50, 0xb610, 0x473a, 0xab, 0x58, 0x0, 0xd1, 0x7, 0x7d, 0xc4, 0x19} +DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_POLICY, + 0x40fbefc7, 0x2e9d, 0x4d25, 0xa1, 0x85, 0xc, 0xfd, 0x85, 0x74, 0xba, 0xc6} +DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_POLICY_1, + 0x40fbefc7, 0x2e9d, 0x4d25, 0xa1, 0x85, 0xc, 0xfd, 0x85, 0x74, 0xba, 0xc7} +DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_TIME, + 0x984cf492, 0x3bed, 0x4488, 0xa8, 0xf9, 0x42, 0x86, 0xc9, 0x7b, 0xf5, 0xaa} +DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_TIME_1, + 0x984cf492, 0x3bed, 0x4488, 0xa8, 0xf9, 0x42, 0x86, 0xc9, 0x7b, 0xf5, 0xab} +DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_TIME, + 0xd8edeb9b, 0x95cf, 0x4f95, 0xa7, 0x3c, 0xb0, 0x61, 0x97, 0x36, 0x93, 0xc8} +DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_TIME_1, + 0xd8edeb9b, 0x95cf, 0x4f95, 0xa7, 0x3c, 0xb0, 0x61, 0x97, 0x36, 0x93, 0xc9} +DEFINE_GUID!{GUID_PROCESSOR_PERF_TIME_CHECK, + 0x4d2b0152, 0x7d5c, 0x498b, 0x88, 0xe2, 0x34, 0x34, 0x53, 0x92, 0xa2, 0xc5} +DEFINE_GUID!{GUID_PROCESSOR_PERF_BOOST_POLICY, + 0x45bcc044, 0xd885, 0x43e2, 0x86, 0x5, 0xee, 0xe, 0xc6, 0xe9, 0x6b, 0x59} +pub const PROCESSOR_PERF_BOOST_POLICY_DISABLED: DWORD = 0; +pub const PROCESSOR_PERF_BOOST_POLICY_MAX: DWORD = 100; +DEFINE_GUID!{GUID_PROCESSOR_PERF_BOOST_MODE, + 0xbe337238, 0xd82, 0x4146, 0xa9, 0x60, 0x4f, 0x37, 0x49, 0xd4, 0x70, 0xc7} +pub const PROCESSOR_PERF_BOOST_MODE_DISABLED: DWORD = 0; +pub const PROCESSOR_PERF_BOOST_MODE_ENABLED: DWORD = 1; +pub const PROCESSOR_PERF_BOOST_MODE_AGGRESSIVE: DWORD = 2; +pub const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_ENABLED: DWORD = 3; +pub const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE: DWORD = 4; +pub const PROCESSOR_PERF_BOOST_MODE_AGGRESSIVE_AT_GUARANTEED: DWORD = 5; +pub const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE_AT_GUARANTEED: DWORD = 6; +pub const PROCESSOR_PERF_BOOST_MODE_MAX: DWORD + = PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE_AT_GUARANTEED; +DEFINE_GUID!{GUID_PROCESSOR_PERF_AUTONOMOUS_MODE, + 0x8baa4a8a, 0x14c6, 0x4451, 0x8e, 0x8b, 0x14, 0xbd, 0xbd, 0x19, 0x75, 0x37} +pub const PROCESSOR_PERF_AUTONOMOUS_MODE_DISABLED: DWORD = 0; +pub const PROCESSOR_PERF_AUTONOMOUS_MODE_ENABLED: DWORD = 1; +DEFINE_GUID!{GUID_PROCESSOR_PERF_ENERGY_PERFORMANCE_PREFERENCE, + 0x36687f9e, 0xe3a5, 0x4dbf, 0xb1, 0xdc, 0x15, 0xeb, 0x38, 0x1c, 0x68, 0x63} +pub const PROCESSOR_PERF_PERFORMANCE_PREFERENCE: DWORD = 0xff; +pub const PROCESSOR_PERF_ENERGY_PREFERENCE: DWORD = 0; +DEFINE_GUID!{GUID_PROCESSOR_PERF_AUTONOMOUS_ACTIVITY_WINDOW, + 0xcfeda3d0, 0x7697, 0x4566, 0xa9, 0x22, 0xa9, 0x8, 0x6c, 0xd4, 0x9d, 0xfa} +pub const PROCESSOR_PERF_MINIMUM_ACTIVITY_WINDOW: DWORD = 0; +pub const PROCESSOR_PERF_MAXIMUM_ACTIVITY_WINDOW: DWORD = 1270000000; +DEFINE_GUID!{GUID_PROCESSOR_DUTY_CYCLING, + 0x4e4450b3, 0x6179, 0x4e91, 0xb8, 0xf1, 0x5b, 0xb9, 0x93, 0x8f, 0x81, 0xa1} +pub const PROCESSOR_DUTY_CYCLING_DISABLED: DWORD = 0; +pub const PROCESSOR_DUTY_CYCLING_ENABLED: DWORD = 1; +DEFINE_GUID!{GUID_PROCESSOR_IDLE_ALLOW_SCALING, + 0x6c2993b0, 0x8f48, 0x481f, 0xbc, 0xc6, 0x0, 0xdd, 0x27, 0x42, 0xaa, 0x6} +DEFINE_GUID!{GUID_PROCESSOR_IDLE_DISABLE, + 0x5d76a2ca, 0xe8c0, 0x402f, 0xa1, 0x33, 0x21, 0x58, 0x49, 0x2d, 0x58, 0xad} +DEFINE_GUID!{GUID_PROCESSOR_IDLE_STATE_MAXIMUM, + 0x9943e905, 0x9a30, 0x4ec1, 0x9b, 0x99, 0x44, 0xdd, 0x3b, 0x76, 0xf7, 0xa2} +DEFINE_GUID!{GUID_PROCESSOR_IDLE_TIME_CHECK, + 0xc4581c31, 0x89ab, 0x4597, 0x8e, 0x2b, 0x9c, 0x9c, 0xab, 0x44, 0xe, 0x6b} +DEFINE_GUID!{GUID_PROCESSOR_IDLE_DEMOTE_THRESHOLD, + 0x4b92d758, 0x5a24, 0x4851, 0xa4, 0x70, 0x81, 0x5d, 0x78, 0xae, 0xe1, 0x19} +DEFINE_GUID!{GUID_PROCESSOR_IDLE_PROMOTE_THRESHOLD, + 0x7b224883, 0xb3cc, 0x4d79, 0x81, 0x9f, 0x83, 0x74, 0x15, 0x2c, 0xbe, 0x7c} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_INCREASE_THRESHOLD, + 0xdf142941, 0x20f3, 0x4edf, 0x9a, 0x4a, 0x9c, 0x83, 0xd3, 0xd7, 0x17, 0xd1} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_DECREASE_THRESHOLD, + 0x68dd2f27, 0xa4ce, 0x4e11, 0x84, 0x87, 0x37, 0x94, 0xe4, 0x13, 0x5d, 0xfa} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_INCREASE_POLICY, + 0xc7be0679, 0x2817, 0x4d69, 0x9d, 0x02, 0x51, 0x9a, 0x53, 0x7e, 0xd0, 0xc6} +pub const CORE_PARKING_POLICY_CHANGE_IDEAL: DWORD = 0; +pub const CORE_PARKING_POLICY_CHANGE_SINGLE: DWORD = 1; +pub const CORE_PARKING_POLICY_CHANGE_ROCKET: DWORD = 2; +pub const CORE_PARKING_POLICY_CHANGE_MULTISTEP: DWORD = 3; +pub const CORE_PARKING_POLICY_CHANGE_MAX: DWORD = CORE_PARKING_POLICY_CHANGE_MULTISTEP; +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_DECREASE_POLICY, + 0x71021b41, 0xc749, 0x4d21, 0xbe, 0x74, 0xa0, 0x0f, 0x33, 0x5d, 0x58, 0x2b} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MAX_CORES, + 0xea062031, 0x0e34, 0x4ff1, 0x9b, 0x6d, 0xeb, 0x10, 0x59, 0x33, 0x40, 0x28} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MAX_CORES_1, + 0xea062031, 0x0e34, 0x4ff1, 0x9b, 0x6d, 0xeb, 0x10, 0x59, 0x33, 0x40, 0x29} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MIN_CORES, + 0x0cc5b647, 0xc1df, 0x4637, 0x89, 0x1a, 0xde, 0xc3, 0x5c, 0x31, 0x85, 0x83} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MIN_CORES_1, + 0x0cc5b647, 0xc1df, 0x4637, 0x89, 0x1a, 0xde, 0xc3, 0x5c, 0x31, 0x85, 0x84} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_INCREASE_TIME, + 0x2ddd5a84, 0x5a71, 0x437e, 0x91, 0x2a, 0xdb, 0x0b, 0x8c, 0x78, 0x87, 0x32} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_DECREASE_TIME, + 0xdfd10d17, 0xd5eb, 0x45dd, 0x87, 0x7a, 0x9a, 0x34, 0xdd, 0xd1, 0x5c, 0x82} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_DECREASE_FACTOR, + 0x8f7b45e3, 0xc393, 0x480a, 0x87, 0x8c, 0xf6, 0x7a, 0xc3, 0xd0, 0x70, 0x82} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_THRESHOLD, + 0x5b33697b, 0xe89d, 0x4d38, 0xaa, 0x46, 0x9e, 0x7d, 0xfb, 0x7c, 0xd2, 0xf9} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_AFFINITY_WEIGHTING, + 0xe70867f1, 0xfa2f, 0x4f4e, 0xae, 0xa1, 0x4d, 0x8a, 0x0b, 0xa2, 0x3b, 0x20} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_DECREASE_FACTOR, + 0x1299023c, 0xbc28, 0x4f0a, 0x81, 0xec, 0xd3, 0x29, 0x5a, 0x8d, 0x81, 0x5d} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_THRESHOLD, + 0x9ac18e92, 0xaa3c, 0x4e27, 0xb3, 0x07, 0x01, 0xae, 0x37, 0x30, 0x71, 0x29} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_WEIGHTING, + 0x8809c2d8, 0xb155, 0x42d4, 0xbc, 0xda, 0x0d, 0x34, 0x56, 0x51, 0xb1, 0xdb} +DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_THRESHOLD, + 0x943c8cb6, 0x6f93, 0x4227, 0xad, 0x87, 0xe9, 0xa3, 0xfe, 0xec, 0x08, 0xd1} +DEFINE_GUID!{GUID_PROCESSOR_PARKING_CORE_OVERRIDE, + 0xa55612aa, 0xf624, 0x42c6, 0xa4, 0x43, 0x73, 0x97, 0xd0, 0x64, 0xc0, 0x4f} +DEFINE_GUID!{GUID_PROCESSOR_PARKING_PERF_STATE, + 0x447235c7, 0x6a8d, 0x4cc0, 0x8e, 0x24, 0x9e, 0xaf, 0x70, 0xb9, 0x6e, 0x2b} +DEFINE_GUID!{GUID_PROCESSOR_PARKING_PERF_STATE_1, + 0x447235c7, 0x6a8d, 0x4cc0, 0x8e, 0x24, 0x9e, 0xaf, 0x70, 0xb9, 0x6e, 0x2c} +DEFINE_GUID!{GUID_PROCESSOR_PARKING_CONCURRENCY_THRESHOLD, + 0x2430ab6f, 0xa520, 0x44a2, 0x96, 0x01, 0xf7, 0xf2, 0x3b, 0x51, 0x34, 0xb1} +DEFINE_GUID!{GUID_PROCESSOR_PARKING_HEADROOM_THRESHOLD, + 0xf735a673, 0x2066, 0x4f80, 0xa0, 0xc5, 0xdd, 0xee, 0x0c, 0xf1, 0xbf, 0x5d} +DEFINE_GUID!{GUID_PROCESSOR_PARKING_DISTRIBUTION_THRESHOLD, + 0x4bdaf4e9, 0xd103, 0x46d7, 0xa5, 0xf0, 0x62, 0x80, 0x12, 0x16, 0x16, 0xef} +DEFINE_GUID!{GUID_PROCESSOR_PERF_HISTORY, + 0x7d24baa7, 0x0b84, 0x480f, 0x84, 0x0c, 0x1b, 0x07, 0x43, 0xc0, 0x0f, 0x5f} +DEFINE_GUID!{GUID_PROCESSOR_PERF_HISTORY_1, + 0x7d24baa7, 0x0b84, 0x480f, 0x84, 0x0c, 0x1b, 0x07, 0x43, 0xc0, 0x0f, 0x60} +DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_HISTORY, + 0x99b3ef01, 0x752f, 0x46a1, 0x80, 0xfb, 0x77, 0x30, 0x1, 0x1f, 0x23, 0x54} +DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_HISTORY, + 0x300f6f8, 0xabd6, 0x45a9, 0xb7, 0x4f, 0x49, 0x8, 0x69, 0x1a, 0x40, 0xb5} +DEFINE_GUID!{GUID_PROCESSOR_PERF_CORE_PARKING_HISTORY, + 0x77d7f282, 0x8f1a, 0x42cd, 0x85, 0x37, 0x45, 0x45, 0xa, 0x83, 0x9b, 0xe8} +DEFINE_GUID!{GUID_PROCESSOR_PERF_LATENCY_HINT, + 0x0822df31, 0x9c83, 0x441c, 0xa0, 0x79, 0x0d, 0xe4, 0xcf, 0x00, 0x9c, 0x7b} +DEFINE_GUID!{GUID_PROCESSOR_PERF_LATENCY_HINT_PERF, + 0x619b7505, 0x3b, 0x4e82, 0xb7, 0xa6, 0x4d, 0xd2, 0x9c, 0x30, 0x9, 0x71} +DEFINE_GUID!{GUID_PROCESSOR_PERF_LATENCY_HINT_PERF_1, + 0x619b7505, 0x3b, 0x4e82, 0xb7, 0xa6, 0x4d, 0xd2, 0x9c, 0x30, 0x9, 0x72} +DEFINE_GUID!{GUID_PROCESSOR_LATENCY_HINT_MIN_UNPARK, + 0x616cdaa5, 0x695e, 0x4545, 0x97, 0xad, 0x97, 0xdc, 0x2d, 0x1b, 0xdd, 0x88} +DEFINE_GUID!{GUID_PROCESSOR_LATENCY_HINT_MIN_UNPARK_1, + 0x616cdaa5, 0x695e, 0x4545, 0x97, 0xad, 0x97, 0xdc, 0x2d, 0x1b, 0xdd, 0x89} +DEFINE_GUID!{GUID_PROCESSOR_DISTRIBUTE_UTILITY, + 0xe0007330, 0xf589, 0x42ed, 0xa4, 0x01, 0x5d, 0xdb, 0x10, 0xe7, 0x85, 0xd3} +DEFINE_GUID!{GUID_PROCESSOR_HETEROGENEOUS_POLICY, + 0x7f2f5cfa, 0xf10c, 0x4823, 0xb5, 0xe1, 0xe9, 0x3a, 0xe8, 0x5f, 0x46, 0xb5} +DEFINE_GUID!{GUID_PROCESSOR_HETERO_DECREASE_TIME, + 0x7f2492b6, 0x60b1, 0x45e5, 0xae, 0x55, 0x77, 0x3f, 0x8c, 0xd5, 0xca, 0xec} +DEFINE_GUID!{GUID_PROCESSOR_HETERO_INCREASE_TIME, + 0x4009efa7, 0xe72d, 0x4cba, 0x9e, 0xdf, 0x91, 0x08, 0x4e, 0xa8, 0xcb, 0xc3} +DEFINE_GUID!{GUID_PROCESSOR_HETERO_DECREASE_THRESHOLD, + 0xf8861c27, 0x95e7, 0x475c, 0x86, 0x5b, 0x13, 0xc0, 0xcb, 0x3f, 0x9d, 0x6b} +DEFINE_GUID!{GUID_PROCESSOR_HETERO_INCREASE_THRESHOLD, + 0xb000397d, 0x9b0b, 0x483d, 0x98, 0xc9, 0x69, 0x2a, 0x60, 0x60, 0xcf, 0xbf} +DEFINE_GUID!{GUID_PROCESSOR_CLASS0_FLOOR_PERF, + 0xfddc842b, 0x8364, 0x4edc, 0x94, 0xcf, 0xc1, 0x7f, 0x60, 0xde, 0x1c, 0x80} +DEFINE_GUID!{GUID_PROCESSOR_CLASS1_INITIAL_PERF, + 0x1facfc65, 0xa930, 0x4bc5, 0x9f, 0x38, 0x50, 0x4e, 0xc0, 0x97, 0xbb, 0xc0} +DEFINE_GUID!{GUID_SYSTEM_COOLING_POLICY, + 0x94d3a615, 0xa899, 0x4ac5, 0xae, 0x2b, 0xe4, 0xd8, 0xf6, 0x34, 0x36, 0x7f} +DEFINE_GUID!{GUID_LOCK_CONSOLE_ON_WAKE, + 0x0e796bdb, 0x100d, 0x47d6, 0xa2, 0xd5, 0xf7, 0xd2, 0xda, 0xa5, 0x1f, 0x51} +DEFINE_GUID!{GUID_DEVICE_IDLE_POLICY, + 0x4faab71a, 0x92e5, 0x4726, 0xb5, 0x31, 0x22, 0x45, 0x59, 0x67, 0x2d, 0x19} +pub const POWER_DEVICE_IDLE_POLICY_PERFORMANCE: DWORD = 0; +pub const POWER_DEVICE_IDLE_POLICY_CONSERVATIVE: DWORD = 1; +DEFINE_GUID!{GUID_CONNECTIVITY_IN_STANDBY, + 0xf15576e8, 0x98b7, 0x4186, 0xb9, 0x44, 0xea, 0xfa, 0x66, 0x44, 0x02, 0xd9} +pub const POWER_CONNECTIVITY_IN_STANDBY_DISABLED: DWORD = 0; +pub const POWER_CONNECTIVITY_IN_STANDBY_ENABLED: DWORD = 1; +pub const POWER_CONNECTIVITY_IN_STANDBY_DISABLED_LID_CLOSE: DWORD = 2; +DEFINE_GUID!{GUID_DISCONNECTED_STANDBY_MODE, + 0x68afb2d9, 0xee95, 0x47a8, 0x8f, 0x50, 0x41, 0x15, 0x08, 0x80, 0x73, 0xb1} +pub const POWER_DISCONNECTED_STANDBY_MODE_NORMAL: DWORD = 0; +pub const POWER_DISCONNECTED_STANDBY_MODE_AGGRESSIVE: DWORD = 1; +DEFINE_GUID!{GUID_ACDC_POWER_SOURCE, + 0x5d3e9a59, 0xe9d5, 0x4b00, 0xa6, 0xbd, 0xff, 0x34, 0xff, 0x51, 0x65, 0x48} +DEFINE_GUID!{GUID_LIDSWITCH_STATE_CHANGE, + 0xba3e0f4d, 0xb817, 0x4094, 0xa2, 0xd1, 0xd5, 0x63, 0x79, 0xe6, 0xa0, 0xf3} +DEFINE_GUID!{GUID_BATTERY_PERCENTAGE_REMAINING, + 0xa7ad8041, 0xb45a, 0x4cae, 0x87, 0xa3, 0xee, 0xcb, 0xb4, 0x68, 0xa9, 0xe1} +DEFINE_GUID!{GUID_BATTERY_COUNT, + 0x7d263f15, 0xfca4, 0x49e5, 0x85, 0x4b, 0xa9, 0xf2, 0xbf, 0xbd, 0x5c, 0x24} +DEFINE_GUID!{GUID_GLOBAL_USER_PRESENCE, + 0x786e8a1d, 0xb427, 0x4344, 0x92, 0x7, 0x9, 0xe7, 0xb, 0xdc, 0xbe, 0xa9} +DEFINE_GUID!{GUID_SESSION_DISPLAY_STATUS, + 0x2b84c20e, 0xad23, 0x4ddf, 0x93, 0xdb, 0x5, 0xff, 0xbd, 0x7e, 0xfc, 0xa5} +DEFINE_GUID!{GUID_SESSION_USER_PRESENCE, + 0x3c0f4548, 0xc03f, 0x4c4d, 0xb9, 0xf2, 0x23, 0x7e, 0xde, 0x68, 0x63, 0x76} +DEFINE_GUID!{GUID_IDLE_BACKGROUND_TASK, + 0x515c31d8, 0xf734, 0x163d, 0xa0, 0xfd, 0x11, 0xa0, 0x8c, 0x91, 0xe8, 0xf1} +DEFINE_GUID!{GUID_BACKGROUND_TASK_NOTIFICATION, + 0xcf23f240, 0x2a54, 0x48d8, 0xb1, 0x14, 0xde, 0x15, 0x18, 0xff, 0x05, 0x2e} +DEFINE_GUID!{GUID_APPLAUNCH_BUTTON, + 0x1a689231, 0x7399, 0x4e9a, 0x8f, 0x99, 0xb7, 0x1f, 0x99, 0x9d, 0xb3, 0xfa} +DEFINE_GUID!{GUID_PCIEXPRESS_SETTINGS_SUBGROUP, + 0x501a4d13, 0x42af,0x4429, 0x9f, 0xd1, 0xa8, 0x21, 0x8c, 0x26, 0x8e, 0x20} +DEFINE_GUID!{GUID_PCIEXPRESS_ASPM_POLICY, + 0xee12f906, 0xd277, 0x404b, 0xb6, 0xda, 0xe5, 0xfa, 0x1a, 0x57, 0x6d, 0xf5} +DEFINE_GUID!{GUID_ENABLE_SWITCH_FORCED_SHUTDOWN, + 0x833a6b62, 0xdfa4, 0x46d1, 0x82, 0xf8, 0xe0, 0x9e, 0x34, 0xd0, 0x29, 0xd6} +DEFINE_GUID!{GUID_INTSTEER_SUBGROUP, + 0x48672f38, 0x7a9a, 0x4bb2, 0x8b, 0xf8, 0x3d, 0x85, 0xbe, 0x19, 0xde, 0x4e} +DEFINE_GUID!{GUID_INTSTEER_MODE, + 0x2bfc24f9, 0x5ea2, 0x4801, 0x82, 0x13, 0x3d, 0xba, 0xe0, 0x1a, 0xa3, 0x9d} +DEFINE_GUID!{GUID_INTSTEER_LOAD_PER_PROC_TRIGGER, + 0x73cde64d, 0xd720, 0x4bb2, 0xa8, 0x60, 0xc7, 0x55, 0xaf, 0xe7, 0x7e, 0xf2} +DEFINE_GUID!{GUID_INTSTEER_TIME_UNPARK_TRIGGER, + 0xd6ba4903, 0x386f, 0x4c2c, 0x8a, 0xdb, 0x5c, 0x21, 0xb3, 0x32, 0x8d, 0x25} +ENUM!{enum SYSTEM_POWER_STATE { + PowerSystemUnspecified = 0, + PowerSystemWorking = 1, + PowerSystemSleeping1 = 2, + PowerSystemSleeping2 = 3, + PowerSystemSleeping3 = 4, + PowerSystemHibernate = 5, + PowerSystemShutdown = 6, + PowerSystemMaximum = 7, +}} +pub type PSYSTEM_POWER_STATE = *mut SYSTEM_POWER_STATE; +pub const POWER_SYSTEM_MAXIMUM: usize = 7; +ENUM!{enum POWER_ACTION { + PowerActionNone = 0, + PowerActionReserved, + PowerActionSleep, + PowerActionHibernate, + PowerActionShutdown, + PowerActionShutdownReset, + PowerActionShutdownOff, + PowerActionWarmEject, + PowerActionDisplayOff, +}} +pub type PPOWER_ACTION = *mut POWER_ACTION; +ENUM!{enum DEVICE_POWER_STATE { + PowerDeviceUnspecified = 0, + PowerDeviceD0, + PowerDeviceD1, + PowerDeviceD2, + PowerDeviceD3, + PowerDeviceMaximum, +}} +pub type PDEVICE_POWER_STATE = *mut DEVICE_POWER_STATE; +ENUM!{enum MONITOR_DISPLAY_STATE { + PowerMonitorOff = 0, + PowerMonitorOn, + PowerMonitorDim, +}} +pub type PMONITOR_DISPLAY_STATE = *mut MONITOR_DISPLAY_STATE; +ENUM!{enum USER_ACTIVITY_PRESENCE { + PowerUserPresent = 0, + PowerUserNotPresent, + PowerUserInactive, + PowerUserMaximum, + PowerUserInvalid = PowerUserMaximum, +}} +pub type PUSER_ACTIVITY_PRESENCE = *mut USER_ACTIVITY_PRESENCE; +pub const ES_SYSTEM_REQUIRED: DWORD = 0x00000001; +pub const ES_DISPLAY_REQUIRED: DWORD = 0x00000002; +pub const ES_USER_PRESENT: DWORD = 0x00000004; +pub const ES_AWAYMODE_REQUIRED: DWORD = 0x00000040; +pub const ES_CONTINUOUS: DWORD = 0x80000000; +pub type EXECUTION_STATE = DWORD; +pub type PEXECUTION_STATE = *mut DWORD; +ENUM!{enum LATENCY_TIME { + LT_DONT_CARE, + LT_LOWEST_LATENCY, +}} +pub const DIAGNOSTIC_REASON_VERSION: ULONG = 0; +pub const DIAGNOSTIC_REASON_SIMPLE_STRING: ULONG = 0x00000001; +pub const DIAGNOSTIC_REASON_DETAILED_STRING: ULONG = 0x00000002; +pub const DIAGNOSTIC_REASON_NOT_SPECIFIED: ULONG = 0x80000000; +pub const DIAGNOSTIC_REASON_INVALID_FLAGS: ULONG = !0x80000007; +pub const POWER_REQUEST_CONTEXT_VERSION: ULONG = DIAGNOSTIC_REASON_VERSION; +pub const POWER_REQUEST_CONTEXT_SIMPLE_STRING: ULONG = DIAGNOSTIC_REASON_SIMPLE_STRING; +pub const POWER_REQUEST_CONTEXT_DETAILED_STRING: ULONG = DIAGNOSTIC_REASON_DETAILED_STRING; +ENUM!{enum POWER_REQUEST_TYPE { + PowerRequestDisplayRequired, + PowerRequestSystemRequired, + PowerRequestAwayModeRequired, + PowerRequestExecutionRequired, +}} +pub type PPOWER_REQUEST_TYPE = *mut POWER_REQUEST_TYPE; +pub const PDCAP_D0_SUPPORTED: DWORD = 0x00000001; +pub const PDCAP_D1_SUPPORTED: DWORD = 0x00000002; +pub const PDCAP_D2_SUPPORTED: DWORD = 0x00000004; +pub const PDCAP_D3_SUPPORTED: DWORD = 0x00000008; +pub const PDCAP_WAKE_FROM_D0_SUPPORTED: DWORD = 0x00000010; +pub const PDCAP_WAKE_FROM_D1_SUPPORTED: DWORD = 0x00000020; +pub const PDCAP_WAKE_FROM_D2_SUPPORTED: DWORD = 0x00000040; +pub const PDCAP_WAKE_FROM_D3_SUPPORTED: DWORD = 0x00000080; +pub const PDCAP_WARM_EJECT_SUPPORTED: DWORD = 0x00000100; +STRUCT!{struct CM_POWER_DATA { + PD_Size: DWORD, + PD_MostRecentPowerState: DEVICE_POWER_STATE, + PD_Capabilities: DWORD, + PD_D1Latency: DWORD, + PD_D2Latency: DWORD, + PD_D3Latency: DWORD, + PD_PowerStateMapping: [DEVICE_POWER_STATE; POWER_SYSTEM_MAXIMUM], + PD_DeepestSystemWake: SYSTEM_POWER_STATE, +}} +pub type PCM_POWER_DATA = *mut CM_POWER_DATA; +ENUM!{enum POWER_INFORMATION_LEVEL{ + SystemPowerPolicyAc, + SystemPowerPolicyDc, + VerifySystemPolicyAc, + VerifySystemPolicyDc, + SystemPowerCapabilities, + SystemBatteryState, + SystemPowerStateHandler, + ProcessorStateHandler, + SystemPowerPolicyCurrent, + AdministratorPowerPolicy, + SystemReserveHiberFile, + ProcessorInformation, + SystemPowerInformation, + ProcessorStateHandler2, + LastWakeTime, + LastSleepTime, + SystemExecutionState, + SystemPowerStateNotifyHandler, + ProcessorPowerPolicyAc, + ProcessorPowerPolicyDc, + VerifyProcessorPowerPolicyAc, + VerifyProcessorPowerPolicyDc, + ProcessorPowerPolicyCurrent, + SystemPowerStateLogging, + SystemPowerLoggingEntry, + SetPowerSettingValue, + NotifyUserPowerSetting, + PowerInformationLevelUnused0, + SystemMonitorHiberBootPowerOff, + SystemVideoState, + TraceApplicationPowerMessage, + TraceApplicationPowerMessageEnd, + ProcessorPerfStates, + ProcessorIdleStates, + ProcessorCap, + SystemWakeSource, + SystemHiberFileInformation, + TraceServicePowerMessage, + ProcessorLoad, + PowerShutdownNotification, + MonitorCapabilities, + SessionPowerInit, + SessionDisplayState, + PowerRequestCreate, + PowerRequestAction, + GetPowerRequestList, + ProcessorInformationEx, + NotifyUserModeLegacyPowerEvent, + GroupPark, + ProcessorIdleDomains, + WakeTimerList, + SystemHiberFileSize, + ProcessorIdleStatesHv, + ProcessorPerfStatesHv, + ProcessorPerfCapHv, + ProcessorSetIdle, + LogicalProcessorIdling, + UserPresence, + PowerSettingNotificationName, + GetPowerSettingValue, + IdleResiliency, + SessionRITState, + SessionConnectNotification, + SessionPowerCleanup, + SessionLockState, + SystemHiberbootState, + PlatformInformation, + PdcInvocation, + MonitorInvocation, + FirmwareTableInformationRegistered, + SetShutdownSelectedTime, + SuspendResumeInvocation, + PlmPowerRequestCreate, + ScreenOff, + CsDeviceNotification, + PlatformRole, + LastResumePerformance, + DisplayBurst, + ExitLatencySamplingPercentage, + RegisterSpmPowerSettings, + PlatformIdleStates, + ProcessorIdleVeto, + PlatformIdleVeto, + SystemBatteryStatePrecise, + ThermalEvent, + PowerRequestActionInternal, + BatteryDeviceState, + PowerInformationInternal, + ThermalStandby, + SystemHiberFileType, + PhysicalPowerButtonPress, + QueryPotentialDripsConstraint, + EnergyTrackerCreate, + EnergyTrackerQuery, + UpdateBlackBoxRecorder, + PowerInformationLevelMaximum, +}} +ENUM!{enum POWER_USER_PRESENCE_TYPE { + UserNotPresent = 0, + UserPresent = 1, + UserUnknown = 0xff, +}} +pub type PPOWER_USER_PRESENCE_TYPE = *mut POWER_USER_PRESENCE_TYPE; +STRUCT!{struct POWER_USER_PRESENCE { + UserPresence: POWER_USER_PRESENCE_TYPE, +}} +pub type PPOWER_USER_PRESENCE = *mut POWER_USER_PRESENCE; +STRUCT!{struct POWER_SESSION_CONNECT { + Connected: BOOLEAN, + Console: BOOLEAN, +}} +pub type PPOWER_SESSION_CONNECT = *mut POWER_SESSION_CONNECT; +STRUCT!{struct POWER_SESSION_TIMEOUTS { + InputTimeout: DWORD, + DisplayTimeout: DWORD, +}} +pub type PPOWER_SESSION_TIMEOUTS = *mut POWER_SESSION_TIMEOUTS; +STRUCT!{struct POWER_SESSION_RIT_STATE { + Active: BOOLEAN, + LastInputTime: DWORD, +}} +pub type PPOWER_SESSION_RIT_STATE = *mut POWER_SESSION_RIT_STATE; +STRUCT!{struct POWER_SESSION_WINLOGON { + SessionId: DWORD, + Console: BOOLEAN, + Locked: BOOLEAN, +}} +pub type PPOWER_SESSION_WINLOGON = *mut POWER_SESSION_WINLOGON; +STRUCT!{struct POWER_IDLE_RESILIENCY { + CoalescingTimeout: DWORD, + IdleResiliencyPeriod: DWORD, +}} +pub type PPOWER_IDLE_RESILIENCY = *mut POWER_IDLE_RESILIENCY; +ENUM!{enum POWER_MONITOR_REQUEST_REASON { + MonitorRequestReasonUnknown, + MonitorRequestReasonPowerButton, + MonitorRequestReasonRemoteConnection, + MonitorRequestReasonScMonitorpower, + MonitorRequestReasonUserInput, + MonitorRequestReasonAcDcDisplayBurst, + MonitorRequestReasonUserDisplayBurst, + MonitorRequestReasonPoSetSystemState, + MonitorRequestReasonSetThreadExecutionState, + MonitorRequestReasonFullWake, + MonitorRequestReasonSessionUnlock, + MonitorRequestReasonScreenOffRequest, + MonitorRequestReasonIdleTimeout, + MonitorRequestReasonPolicyChange, + MonitorRequestReasonSleepButton, + MonitorRequestReasonLid, + MonitorRequestReasonBatteryCountChange, + MonitorRequestReasonGracePeriod, + MonitorRequestReasonPnP, + MonitorRequestReasonDP, + MonitorRequestReasonSxTransition, + MonitorRequestReasonSystemIdle, + MonitorRequestReasonNearProximity, + MonitorRequestReasonThermalStandby, + MonitorRequestReasonResumePdc, + MonitorRequestReasonResumeS4, + MonitorRequestReasonTerminal, + MonitorRequestReasonPdcSignal, + MonitorRequestReasonAcDcDisplayBurstSuppressed, + MonitorRequestReasonSystemStateEntered, + MonitorRequestReasonWinrt, + MonitorRequestReasonMax, +}} +ENUM!{enum POWER_MONITOR_REQUEST_TYPE { + MonitorRequestTypeOff, + MonitorRequestTypeOnAndPresent, + MonitorRequestTypeToggleOn, +}} +STRUCT!{struct POWER_MONITOR_INVOCATION { + Console: BOOLEAN, + RequestReason: POWER_MONITOR_REQUEST_REASON, +}} +pub type PPOWER_MONITOR_INVOCATION = *mut POWER_MONITOR_INVOCATION; +STRUCT!{struct RESUME_PERFORMANCE { + PostTimeMs: DWORD, + TotalResumeTimeMs: ULONGLONG, + ResumeCompleteTimestamp: ULONGLONG, +}} +pub type PRESUME_PERFORMANCE = *mut RESUME_PERFORMANCE; +ENUM!{enum SYSTEM_POWER_CONDITION { + PoAc, + PoDc, + PoHot, + PoConditionMaximum, +}} +STRUCT!{struct SET_POWER_SETTING_VALUE { + Version: DWORD, + Guid: GUID, + PowerCondition: SYSTEM_POWER_CONDITION, + DataLength: DWORD, + Data: [BYTE; ANYSIZE_ARRAY], +}} +pub type PSET_POWER_SETTING_VALUE = *mut SET_POWER_SETTING_VALUE; +STRUCT!{struct NOTIFY_USER_POWER_SETTING { + Guid: GUID, +}} +pub type PNOTIFY_USER_POWER_SETTING = *mut NOTIFY_USER_POWER_SETTING; +STRUCT!{struct APPLICATIONLAUNCH_SETTING_VALUE { + ActivationTime: LARGE_INTEGER, + Flags: DWORD, + ButtonInstanceID: DWORD, +}} +pub type PAPPLICATIONLAUNCH_SETTING_VALUE = *mut APPLICATIONLAUNCH_SETTING_VALUE; +ENUM!{enum POWER_PLATFORM_ROLE { + PlatformRoleUnspecified = 0, + PlatformRoleDesktop, + PlatformRoleMobile, + PlatformRoleWorkstation, + PlatformRoleEnterpriseServer, + PlatformRoleSOHOServer, + PlatformRoleAppliancePC, + PlatformRolePerformanceServer, + PlatformRoleSlate, + PlatformRoleMaximum, +}} +pub type PPOWER_PLATFORM_ROLE = *mut POWER_PLATFORM_ROLE; +pub const POWER_PLATFORM_ROLE_V1: ULONG = 0x00000001; +pub const POWER_PLATFORM_ROLE_V1_MAX: POWER_PLATFORM_ROLE = PlatformRolePerformanceServer + 1; +pub const POWER_PLATFORM_ROLE_V2: ULONG = 0x00000002; +pub const POWER_PLATFORM_ROLE_V2_MAX: POWER_PLATFORM_ROLE = PlatformRoleSlate + 1; +pub const POWER_PLATFORM_ROLE_VERSION: ULONG = POWER_PLATFORM_ROLE_V2; +pub const POWER_PLATFORM_ROLE_VERSION_MAX: POWER_PLATFORM_ROLE = POWER_PLATFORM_ROLE_V2_MAX; +STRUCT!{struct POWER_PLATFORM_INFORMATION { + AoAc: BOOLEAN, +}} +pub type PPOWER_PLATFORM_INFORMATION = *mut POWER_PLATFORM_INFORMATION; +STRUCT!{struct BATTERY_REPORTING_SCALE { + Granularity: DWORD, + Capacity: DWORD, +}} +pub type PBATTERY_REPORTING_SCALE = *mut BATTERY_REPORTING_SCALE; +STRUCT!{struct PPM_WMI_LEGACY_PERFSTATE { + Frequency: DWORD, + Flags: DWORD, + PercentFrequency: DWORD, +}} +pub type PPPM_WMI_LEGACY_PERFSTATE = *mut PPM_WMI_LEGACY_PERFSTATE; +STRUCT!{struct PPM_WMI_IDLE_STATE { + Latency: DWORD, + Power: DWORD, + TimeCheck: DWORD, + PromotePercent: BYTE, + DemotePercent: BYTE, + StateType: BYTE, + Reserved: BYTE, + StateFlags: DWORD, + Context: DWORD, + IdleHandler: DWORD, + Reserved1: DWORD, +}} +pub type PPPM_WMI_IDLE_STATE = *mut PPM_WMI_IDLE_STATE; +STRUCT!{struct PPM_WMI_IDLE_STATES { + Type: DWORD, + Count: DWORD, + TargetState: DWORD, + OldState: DWORD, + TargetProcessors: DWORD64, + State: [PPM_WMI_IDLE_STATE; ANYSIZE_ARRAY], +}} +pub type PPPM_WMI_IDLE_STATES = *mut PPM_WMI_IDLE_STATES; +STRUCT!{struct PPM_WMI_IDLE_STATES_EX { + Type: DWORD, + Count: DWORD, + TargetState: DWORD, + OldState: DWORD, + TargetProcessors: PVOID, + State: [PPM_WMI_IDLE_STATE; ANYSIZE_ARRAY], +}} +pub type PPPM_WMI_IDLE_STATES_EX = *mut PPM_WMI_IDLE_STATES_EX; +STRUCT!{struct PPM_WMI_PERF_STATE { + Frequency: DWORD, + Power: DWORD, + PercentFrequency: BYTE, + IncreaseLevel: BYTE, + DecreaseLevel: BYTE, + Type: BYTE, + IncreaseTime: DWORD, + DecreaseTime: DWORD, + Control: DWORD64, + Status: DWORD64, + HitCount: DWORD, + Reserved1: DWORD, + Reserved2: DWORD64, + Reserved3: DWORD64, +}} +pub type PPPM_WMI_PERF_STATE = *mut PPM_WMI_PERF_STATE; +STRUCT!{struct PPM_WMI_PERF_STATES { + Count: DWORD, + MaxFrequency: DWORD, + CurrentState: DWORD, + MaxPerfState: DWORD, + MinPerfState: DWORD, + LowestPerfState: DWORD, + ThermalConstraint: DWORD, + BusyAdjThreshold: BYTE, + PolicyType: BYTE, + Type: BYTE, + Reserved: BYTE, + TimerInterval: DWORD, + TargetProcessors: DWORD64, + PStateHandler: DWORD, + PStateContext: DWORD, + TStateHandler: DWORD, + TStateContext: DWORD, + FeedbackHandler: DWORD, + Reserved1: DWORD, + Reserved2: DWORD64, + State: [PPM_WMI_PERF_STATE; ANYSIZE_ARRAY], +}} +pub type PPPM_WMI_PERF_STATES = *mut PPM_WMI_PERF_STATES; +STRUCT!{struct PPM_WMI_PERF_STATES_EX { + Count: DWORD, + MaxFrequency: DWORD, + CurrentState: DWORD, + MaxPerfState: DWORD, + MinPerfState: DWORD, + LowestPerfState: DWORD, + ThermalConstraint: DWORD, + BusyAdjThreshold: BYTE, + PolicyType: BYTE, + Type: BYTE, + Reserved: BYTE, + TimerInterval: DWORD, + TargetProcessors: PVOID, + PStateHandler: DWORD, + PStateContext: DWORD, + TStateHandler: DWORD, + TStateContext: DWORD, + FeedbackHandler: DWORD, + Reserved1: DWORD, + Reserved2: DWORD64, + State: [PPM_WMI_PERF_STATE; ANYSIZE_ARRAY], +}} +pub type PPPM_WMI_PERF_STATES_EX = *mut PPM_WMI_PERF_STATES_EX; +pub const PROC_IDLE_BUCKET_COUNT: usize = 6; +STRUCT!{struct PPM_IDLE_STATE_ACCOUNTING { + IdleTransitions: DWORD, + FailedTransitions: DWORD, + InvalidBucketIndex: DWORD, + TotalTime: DWORD64, + IdleTimeBuckets: [DWORD; PROC_IDLE_BUCKET_COUNT], +}} +pub type PPPM_IDLE_STATE_ACCOUNTING = *mut PPM_IDLE_STATE_ACCOUNTING; +STRUCT!{struct PPM_IDLE_ACCOUNTING { + StateCount: DWORD, + TotalTransitions: DWORD, + ResetCount: DWORD, + StartTime: DWORD64, + State: [PPM_IDLE_STATE_ACCOUNTING; ANYSIZE_ARRAY], +}} +pub type PPPM_IDLE_ACCOUNTING = *mut PPM_IDLE_ACCOUNTING; +pub const PROC_IDLE_BUCKET_COUNT_EX: usize = 16; +STRUCT!{struct PPM_IDLE_STATE_BUCKET_EX { + TotalTimeUs: DWORD64, + MinTimeUs: DWORD, + MaxTimeUs: DWORD, + Count: DWORD, +}} +pub type PPPM_IDLE_STATE_BUCKET_EX = *mut PPM_IDLE_STATE_BUCKET_EX; +STRUCT!{struct PPM_IDLE_STATE_ACCOUNTING_EX { + TotalTime: DWORD64, + IdleTransitions: DWORD, + FailedTransitions: DWORD, + InvalidBucketIndex: DWORD, + MinTimeUs: DWORD, + MaxTimeUs: DWORD, + CancelledTransitions: DWORD, + IdleTimeBuckets: [PPM_IDLE_STATE_BUCKET_EX; PROC_IDLE_BUCKET_COUNT_EX], +}} +pub type PPPM_IDLE_STATE_ACCOUNTING_EX = *mut PPM_IDLE_STATE_ACCOUNTING_EX; +STRUCT!{struct PPM_IDLE_ACCOUNTING_EX { + StateCount: DWORD, + TotalTransitions: DWORD, + ResetCount: DWORD, + AbortCount: DWORD, + StartTime: DWORD64, + State: [PPM_IDLE_STATE_ACCOUNTING_EX; ANYSIZE_ARRAY], +}} +pub type PPPM_IDLE_ACCOUNTING_EX = *mut PPM_IDLE_ACCOUNTING_EX; +pub const ACPI_PPM_SOFTWARE_ALL: DWORD = 0xFC; +pub const ACPI_PPM_SOFTWARE_ANY: DWORD = 0xFD; +pub const ACPI_PPM_HARDWARE_ALL: DWORD = 0xFE; +pub const MS_PPM_SOFTWARE_ALL: DWORD = 0x1; +pub const PPM_FIRMWARE_ACPI1C2: DWORD = 0x00000001; +pub const PPM_FIRMWARE_ACPI1C3: DWORD = 0x00000002; +pub const PPM_FIRMWARE_ACPI1TSTATES: DWORD = 0x00000004; +pub const PPM_FIRMWARE_CST: DWORD = 0x00000008; +pub const PPM_FIRMWARE_CSD: DWORD = 0x00000010; +pub const PPM_FIRMWARE_PCT: DWORD = 0x00000020; +pub const PPM_FIRMWARE_PSS: DWORD = 0x00000040; +pub const PPM_FIRMWARE_XPSS: DWORD = 0x00000080; +pub const PPM_FIRMWARE_PPC: DWORD = 0x00000100; +pub const PPM_FIRMWARE_PSD: DWORD = 0x00000200; +pub const PPM_FIRMWARE_PTC: DWORD = 0x00000400; +pub const PPM_FIRMWARE_TSS: DWORD = 0x00000800; +pub const PPM_FIRMWARE_TPC: DWORD = 0x00001000; +pub const PPM_FIRMWARE_TSD: DWORD = 0x00002000; +pub const PPM_FIRMWARE_PCCH: DWORD = 0x00004000; +pub const PPM_FIRMWARE_PCCP: DWORD = 0x00008000; +pub const PPM_FIRMWARE_OSC: DWORD = 0x00010000; +pub const PPM_FIRMWARE_PDC: DWORD = 0x00020000; +pub const PPM_FIRMWARE_CPC: DWORD = 0x00040000; +pub const PPM_FIRMWARE_LPI: DWORD = 0x00080000; +pub const PPM_PERFORMANCE_IMPLEMENTATION_NONE: DWORD = 0x00000000; +pub const PPM_PERFORMANCE_IMPLEMENTATION_PSTATES: DWORD = 0x00000001; +pub const PPM_PERFORMANCE_IMPLEMENTATION_PCCV1: DWORD = 0x00000002; +pub const PPM_PERFORMANCE_IMPLEMENTATION_CPPC: DWORD = 0x00000003; +pub const PPM_PERFORMANCE_IMPLEMENTATION_PEP: DWORD = 0x00000004; +pub const PPM_IDLE_IMPLEMENTATION_NONE: DWORD = 0x00000000; +pub const PPM_IDLE_IMPLEMENTATION_CSTATES: DWORD = 0x00000001; +pub const PPM_IDLE_IMPLEMENTATION_PEP: DWORD = 0x00000002; +pub const PPM_IDLE_IMPLEMENTATION_MICROPEP: DWORD = 0x00000003; +pub const PPM_IDLE_IMPLEMENTATION_LPISTATES: DWORD = 0x00000004; +DEFINE_GUID!{PPM_PERFSTATE_CHANGE_GUID, + 0xa5b32ddd, 0x7f39, 0x4abc, 0xb8, 0x92, 0x90, 0xe, 0x43, 0xb5, 0x9e, 0xbb} +DEFINE_GUID!{PPM_PERFSTATE_DOMAIN_CHANGE_GUID, + 0x995e6b7f, 0xd653, 0x497a, 0xb9, 0x78, 0x36, 0xa3, 0xc, 0x29, 0xbf, 0x1} +DEFINE_GUID!{PPM_IDLESTATE_CHANGE_GUID, + 0x4838fe4f, 0xf71c, 0x4e51, 0x9e, 0xcc, 0x84, 0x30, 0xa7, 0xac, 0x4c, 0x6c} +DEFINE_GUID!{PPM_PERFSTATES_DATA_GUID, + 0x5708cc20, 0x7d40, 0x4bf4, 0xb4, 0xaa, 0x2b, 0x01, 0x33, 0x8d, 0x01, 0x26} +DEFINE_GUID!{PPM_IDLESTATES_DATA_GUID, + 0xba138e10, 0xe250, 0x4ad7, 0x86, 0x16, 0xcf, 0x1a, 0x7a, 0xd4, 0x10, 0xe7} +DEFINE_GUID!{PPM_IDLE_ACCOUNTING_GUID, + 0xe2a26f78, 0xae07, 0x4ee0, 0xa3, 0x0f, 0xce, 0x54, 0xf5, 0x5a, 0x94, 0xcd} +DEFINE_GUID!{PPM_IDLE_ACCOUNTING_EX_GUID, + 0xd67abd39, 0x81f8, 0x4a5e, 0x81, 0x52, 0x72, 0xe3, 0x1e, 0xc9, 0x12, 0xee} +DEFINE_GUID!{PPM_THERMALCONSTRAINT_GUID, + 0xa852c2c8, 0x1a4c, 0x423b, 0x8c, 0x2c, 0xf3, 0x0d, 0x82, 0x93, 0x1a, 0x88} +DEFINE_GUID!{PPM_PERFMON_PERFSTATE_GUID, + 0x7fd18652, 0xcfe, 0x40d2, 0xb0, 0xa1, 0xb, 0x6, 0x6a, 0x87, 0x75, 0x9e} +DEFINE_GUID!{PPM_THERMAL_POLICY_CHANGE_GUID, + 0x48f377b8, 0x6880, 0x4c7b, 0x8b, 0xdc, 0x38, 0x1, 0x76, 0xc6, 0x65, 0x4d} +STRUCT!{struct PPM_PERFSTATE_EVENT { + State: DWORD, + Status: DWORD, + Latency: DWORD, + Speed: DWORD, + Processor: DWORD, +}} +pub type PPPM_PERFSTATE_EVENT = *mut PPM_PERFSTATE_EVENT; +STRUCT!{struct PPM_PERFSTATE_DOMAIN_EVENT { + State: DWORD, + Latency: DWORD, + Speed: DWORD, + Processors: DWORD64, +}} +pub type PPPM_PERFSTATE_DOMAIN_EVENT = *mut PPM_PERFSTATE_DOMAIN_EVENT; +STRUCT!{struct PPM_IDLESTATE_EVENT { + NewState: DWORD, + OldState: DWORD, + Processors: DWORD64, +}} +pub type PPPM_IDLESTATE_EVENT = *mut PPM_IDLESTATE_EVENT; +STRUCT!{struct PPM_THERMALCHANGE_EVENT { + ThermalConstraint: DWORD, + Processors: DWORD64, +}} +pub type PPPM_THERMALCHANGE_EVENT = *mut PPM_THERMALCHANGE_EVENT; +STRUCT!{struct PPM_THERMAL_POLICY_EVENT { + Mode: BYTE, + Processors: DWORD64, +}} +pub type PPPM_THERMAL_POLICY_EVENT = *mut PPM_THERMAL_POLICY_EVENT; +STRUCT!{struct POWER_ACTION_POLICY { + Action: POWER_ACTION, + Flags: DWORD, + EventCode: DWORD, +}} +pub type PPOWER_ACTION_POLICY = *mut POWER_ACTION_POLICY; +pub const POWER_ACTION_QUERY_ALLOWED: DWORD = 0x00000001; +pub const POWER_ACTION_UI_ALLOWED: DWORD = 0x00000002; +pub const POWER_ACTION_OVERRIDE_APPS: DWORD = 0x00000004; +pub const POWER_ACTION_HIBERBOOT: DWORD = 0x00000008; +pub const POWER_ACTION_USER_NOTIFY: DWORD = 0x00000010; +pub const POWER_ACTION_DOZE_TO_HIBERNATE: DWORD = 0x00000020; +pub const POWER_ACTION_PSEUDO_TRANSITION: DWORD = 0x08000000; +pub const POWER_ACTION_LIGHTEST_FIRST: DWORD = 0x10000000; +pub const POWER_ACTION_LOCK_CONSOLE: DWORD = 0x20000000; +pub const POWER_ACTION_DISABLE_WAKES: DWORD = 0x40000000; +pub const POWER_ACTION_CRITICAL: DWORD = 0x80000000; +pub const POWER_LEVEL_USER_NOTIFY_TEXT: DWORD = 0x00000001; +pub const POWER_LEVEL_USER_NOTIFY_SOUND: DWORD = 0x00000002; +pub const POWER_LEVEL_USER_NOTIFY_EXEC: DWORD = 0x00000004; +pub const POWER_USER_NOTIFY_BUTTON: DWORD = 0x00000008; +pub const POWER_USER_NOTIFY_SHUTDOWN: DWORD = 0x00000010; +pub const POWER_USER_NOTIFY_FORCED_SHUTDOWN: DWORD = 0x00000020; +pub const POWER_FORCE_TRIGGER_RESET: DWORD = 0x80000000; +pub const BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK: DWORD = 0x00000007; +pub const BATTERY_DISCHARGE_FLAGS_ENABLE: DWORD = 0x80000000; +STRUCT!{struct SYSTEM_POWER_LEVEL { + Enable: BOOLEAN, + Spare: [BYTE; 3], + BatteryLevel: DWORD, + PowerPolicy: POWER_ACTION_POLICY, + MinSystemState: SYSTEM_POWER_STATE, +}} +pub type PSYSTEM_POWER_LEVEL = *mut SYSTEM_POWER_LEVEL; +pub const NUM_DISCHARGE_POLICIES: usize = 4; +pub const DISCHARGE_POLICY_CRITICAL: DWORD = 0; +pub const DISCHARGE_POLICY_LOW: DWORD = 1; +STRUCT!{struct SYSTEM_POWER_POLICY { + Revision: DWORD, + PowerButton: POWER_ACTION_POLICY, + SleepButton: POWER_ACTION_POLICY, + LidClose: POWER_ACTION_POLICY, + LidOpenWake: SYSTEM_POWER_STATE, + Reserved: DWORD, + Idle: POWER_ACTION_POLICY, + IdleTimeout: DWORD, + IdleSensitivity: BYTE, + DynamicThrottle: BYTE, + Spare2: [BYTE; 2], + MinSleep: SYSTEM_POWER_STATE, + MaxSleep: SYSTEM_POWER_STATE, + ReducedLatencySleep: SYSTEM_POWER_STATE, + WinLogonFlags: DWORD, + Spare3: DWORD, + DozeS4Timeout: DWORD, + BroadcastCapacityResolution: DWORD, + DischargePolicy: [SYSTEM_POWER_LEVEL; NUM_DISCHARGE_POLICIES], + VideoTimeout: DWORD, + VideoDimDisplay: BOOLEAN, + VideoReserved: [DWORD; 3], + SpindownTimeout: DWORD, + OptimizeForPower: BOOLEAN, + FanThrottleTolerance: BYTE, + ForcedThrottle: BYTE, + MinThrottle: BYTE, + OverThrottled: POWER_ACTION_POLICY, +}} +pub type PSYSTEM_POWER_POLICY = *mut SYSTEM_POWER_POLICY; +pub const PROCESSOR_IDLESTATE_POLICY_COUNT: usize = 0x3; +STRUCT!{struct PROCESSOR_IDLESTATE_INFO { + TimeCheck: DWORD, + DemotePercent: BYTE, + PromotePercent: BYTE, + Spare: [BYTE; 2], +}} +pub type PPROCESSOR_IDLESTATE_INFO = *mut PROCESSOR_IDLESTATE_INFO; +STRUCT!{struct PROCESSOR_IDLESTATE_POLICY_Flags { + AsWORD: WORD, +}} +BITFIELD!(PROCESSOR_IDLESTATE_POLICY_Flags AsWORD: WORD [ + AllowScaling set_AllowScaling[0..1], + Disabled set_Disabled[1..2], + Reserved set_Reserved[2..16], +]); +STRUCT!{struct PROCESSOR_IDLESTATE_POLICY { + Revision: WORD, + Flags: PROCESSOR_IDLESTATE_POLICY_Flags, + PolicyCount: DWORD, + Policy: [PROCESSOR_IDLESTATE_INFO; PROCESSOR_IDLESTATE_POLICY_COUNT], +}} +pub type PPROCESSOR_IDLESTATE_POLICY = *mut PROCESSOR_IDLESTATE_POLICY; +pub const PO_THROTTLE_NONE: DWORD = 0; +pub const PO_THROTTLE_CONSTANT: DWORD = 1; +pub const PO_THROTTLE_DEGRADE: DWORD = 2; +pub const PO_THROTTLE_ADAPTIVE: DWORD = 3; +pub const PO_THROTTLE_MAXIMUM: DWORD = 4; +STRUCT!{struct PROCESSOR_POWER_POLICY_INFO { + TimeCheck: DWORD, + DemoteLimit: DWORD, + PromoteLimit: DWORD, + DemotePercent: BYTE, + PromotePercent: BYTE, + Spare: [BYTE; 2], + Reserved: DWORD, +}} +BITFIELD!(PROCESSOR_POWER_POLICY_INFO Reserved: DWORD [ + AllowDemotion set_AllowDemotion[0..1], + AllowPromotion set_AllowPromotion[1..2], + Reserved set_Reserved[2..32], +]); +pub type PPROCESSOR_POWER_POLICY_INFO = *mut PROCESSOR_POWER_POLICY_INFO; +STRUCT!{struct PROCESSOR_POWER_POLICY { + Revision: DWORD, + DynamicThrottle: BYTE, + Spare: [BYTE; 3], + BitFields: DWORD, + PolicyCount: DWORD, + Policy: [PROCESSOR_POWER_POLICY_INFO; 3], +}} +BITFIELD!(PROCESSOR_POWER_POLICY BitFields: DWORD [ + DisableCStates set_DisableCStates[0..1], + Reserved set_Reserved[1..32], +]); +pub type PPROCESSOR_POWER_POLICY = *mut PROCESSOR_POWER_POLICY; +STRUCT!{struct PROCESSOR_PERFSTATE_POLICY_u_Flags { + AsBYTE: BYTE, +}} +BITFIELD!(PROCESSOR_PERFSTATE_POLICY_u_Flags AsBYTE: BYTE [ + NoDomainAccounting set_NoDomainAccounting[0..1], + IncreasePolicy set_IncreasePolicy[1..3], + DecreasePolicy set_DecreasePolicy[3..5], + Reserved set_Reserved[5..8], +]); +UNION!{union PROCESSOR_PERFSTATE_POLICY_u { + [u8; 1], + Spare Spare_mut: BYTE, + Flags Flags_mut: PROCESSOR_PERFSTATE_POLICY_u_Flags, +}} +STRUCT!{struct PROCESSOR_PERFSTATE_POLICY { + Revision: DWORD, + MaxThrottle: BYTE, + MinThrottle: BYTE, + BusyAdjThreshold: BYTE, + u: PROCESSOR_PERFSTATE_POLICY_u, + TimeCheck: DWORD, + IncreaseTime: DWORD, + DecreaseTime: DWORD, + IncreasePercent: DWORD, + DecreasePercent: DWORD, +}} +pub type PPROCESSOR_PERFSTATE_POLICY = *mut PROCESSOR_PERFSTATE_POLICY; +STRUCT!{struct ADMINISTRATOR_POWER_POLICY { + MinSleep: SYSTEM_POWER_STATE, + MaxSleep: SYSTEM_POWER_STATE, + MinVideoTimeout: DWORD, + MaxVideoTimeout: DWORD, + MinSpindownTimeout: DWORD, + MaxSpindownTimeout: DWORD, +}} +pub type PADMINISTRATOR_POWER_POLICY = *mut ADMINISTRATOR_POWER_POLICY; +ENUM!{enum HIBERFILE_BUCKET_SIZE { + HiberFileBucket1GB = 0, + HiberFileBucket2GB, + HiberFileBucket4GB, + HiberFileBucket8GB, + HiberFileBucket16GB, + HiberFileBucket32GB, + HiberFileBucketUnlimited, + HiberFileBucketMax, +}} +pub const HIBERFILE_TYPE_NONE: BYTE = 0x00; +pub const HIBERFILE_TYPE_REDUCED: BYTE = 0x01; +pub const HIBERFILE_TYPE_FULL: BYTE = 0x02; +pub const HIBERFILE_TYPE_MAX: usize = 0x03; +STRUCT!{struct HIBERFILE_BUCKET { + MaxPhysicalMemory: DWORD64, + PhysicalMemoryPercent: [DWORD; HIBERFILE_TYPE_MAX], +}} +pub type PHIBERFILE_BUCKET = *mut HIBERFILE_BUCKET; +STRUCT!{struct SYSTEM_POWER_CAPABILITIES { + PowerButtonPresent: BOOLEAN, + SleepButtonPresent: BOOLEAN, + LidPresent: BOOLEAN, + SystemS1: BOOLEAN, + SystemS2: BOOLEAN, + SystemS3: BOOLEAN, + SystemS4: BOOLEAN, + SystemS5: BOOLEAN, + HiberFilePresent: BOOLEAN, + FullWake: BOOLEAN, + VideoDimPresent: BOOLEAN, + ApmPresent: BOOLEAN, + UpsPresent: BOOLEAN, + ThermalControl: BOOLEAN, + ProcessorThrottle: BOOLEAN, + ProcessorMinThrottle: BYTE, + ProcessorMaxThrottle: BYTE, + FastSystemS4: BOOLEAN, + Hiberboot: BOOLEAN, + WakeAlarmPresent: BOOLEAN, + AoAc: BOOLEAN, + DiskSpinDown: BOOLEAN, + HiberFileType: BYTE, + AoAcConnectivitySupported: BOOLEAN, + spare3: [BYTE; 6], + SystemBatteriesPresent: BOOLEAN, + BatteriesAreShortTerm: BOOLEAN, + BatteryScale: [BATTERY_REPORTING_SCALE; 3], + AcOnLineWake: SYSTEM_POWER_STATE, + SoftLidWake: SYSTEM_POWER_STATE, + RtcWake: SYSTEM_POWER_STATE, + MinDeviceWakeState: SYSTEM_POWER_STATE, + DefaultLowLatencyWake: SYSTEM_POWER_STATE, +}} +pub type PSYSTEM_POWER_CAPABILITIES = *mut SYSTEM_POWER_CAPABILITIES; +STRUCT!{struct SYSTEM_BATTERY_STATE { + AcOnLine: BOOLEAN, + BatteryPresent: BOOLEAN, + Charging: BOOLEAN, + Discharging: BOOLEAN, + Spare1: [BOOLEAN; 3], + Tag: BYTE, + MaxCapacity: DWORD, + RemainingCapacity: DWORD, + Rate: DWORD, + EstimatedTime: DWORD, + DefaultAlert1: DWORD, + DefaultAlert2: DWORD, +}} +pub type PSYSTEM_BATTERY_STATE = *mut SYSTEM_BATTERY_STATE; +pub const IMAGE_DOS_SIGNATURE: WORD = 0x5A4D; +pub const IMAGE_OS2_SIGNATURE: WORD = 0x454E; +pub const IMAGE_OS2_SIGNATURE_LE: WORD = 0x454C; +pub const IMAGE_VXD_SIGNATURE: WORD = 0x454C; +pub const IMAGE_NT_SIGNATURE: DWORD = 0x00004550; +STRUCT!{struct IMAGE_DOS_HEADER { + e_magic: WORD, + e_cblp: WORD, + e_cp: WORD, + e_crlc: WORD, + e_cparhdr: WORD, + e_minalloc: WORD, + e_maxalloc: WORD, + e_ss: WORD, + e_sp: WORD, + e_csum: WORD, + e_ip: WORD, + e_cs: WORD, + e_lfarlc: WORD, + e_ovno: WORD, + e_res: [WORD; 4], + e_oemid: WORD, + e_oeminfo: WORD, + e_res2: [WORD; 10], + e_lfanew: LONG, +}} +pub type PIMAGE_DOS_HEADER = *mut IMAGE_DOS_HEADER; +STRUCT!{struct IMAGE_OS2_HEADER { + ne_magic: WORD, + ne_ver: CHAR, + ne_rev: CHAR, + ne_enttab: WORD, + ne_cbenttab: WORD, + ne_crc: LONG, + ne_flags: WORD, + ne_autodata: WORD, + ne_heap: WORD, + ne_stack: WORD, + ne_csip: LONG, + ne_sssp: LONG, + ne_cseg: WORD, + ne_cmod: WORD, + ne_cbnrestab: WORD, + ne_segtab: WORD, + ne_rsrctab: WORD, + ne_restab: WORD, + ne_modtab: WORD, + ne_imptab: WORD, + ne_nrestab: LONG, + ne_cmovent: WORD, + ne_align: WORD, + ne_cres: WORD, + ne_exetyp: BYTE, + ne_flagsothers: BYTE, + ne_pretthunks: WORD, + ne_psegrefbytes: WORD, + ne_swaparea: WORD, + ne_expver: WORD, +}} +pub type PIMAGE_OS2_HEADER = *mut IMAGE_OS2_HEADER; +STRUCT!{struct IMAGE_VXD_HEADER { + e32_magic: WORD, + e32_border: BYTE, + e32_worder: BYTE, + e32_level: DWORD, + e32_cpu: WORD, + e32_os: WORD, + e32_ver: DWORD, + e32_mflags: DWORD, + e32_mpages: DWORD, + e32_startobj: DWORD, + e32_eip: DWORD, + e32_stackobj: DWORD, + e32_esp: DWORD, + e32_pagesize: DWORD, + e32_lastpagesize: DWORD, + e32_fixupsize: DWORD, + e32_fixupsum: DWORD, + e32_ldrsize: DWORD, + e32_ldrsum: DWORD, + e32_objtab: DWORD, + e32_objcnt: DWORD, + e32_objmap: DWORD, + e32_itermap: DWORD, + e32_rsrctab: DWORD, + e32_rsrccnt: DWORD, + e32_restab: DWORD, + e32_enttab: DWORD, + e32_dirtab: DWORD, + e32_dircnt: DWORD, + e32_fpagetab: DWORD, + e32_frectab: DWORD, + e32_impmod: DWORD, + e32_impmodcnt: DWORD, + e32_impproc: DWORD, + e32_pagesum: DWORD, + e32_datapage: DWORD, + e32_preload: DWORD, + e32_nrestab: DWORD, + e32_cbnrestab: DWORD, + e32_nressum: DWORD, + e32_autodata: DWORD, + e32_debuginfo: DWORD, + e32_debuglen: DWORD, + e32_instpreload: DWORD, + e32_instdemand: DWORD, + e32_heapsize: DWORD, + e32_res3: [BYTE; 12], + e32_winresoff: DWORD, + e32_winreslen: DWORD, + e32_devid: WORD, + e32_ddkver: WORD, +}} +pub type PIMAGE_VXD_HEADER = *mut IMAGE_VXD_HEADER; +STRUCT!{struct IMAGE_FILE_HEADER { + Machine: WORD, + NumberOfSections: WORD, + TimeDateStamp: DWORD, + PointerToSymbolTable: DWORD, + NumberOfSymbols: DWORD, + SizeOfOptionalHeader: WORD, + Characteristics: WORD, +}} +pub type PIMAGE_FILE_HEADER = *mut IMAGE_FILE_HEADER; +pub const IMAGE_SIZEOF_FILE_HEADER: usize = 20; +pub const IMAGE_FILE_RELOCS_STRIPPED: WORD = 0x0001; +pub const IMAGE_FILE_EXECUTABLE_IMAGE: WORD = 0x0002; +pub const IMAGE_FILE_LINE_NUMS_STRIPPED: WORD = 0x0004; +pub const IMAGE_FILE_LOCAL_SYMS_STRIPPED: WORD = 0x0008; +pub const IMAGE_FILE_AGGRESIVE_WS_TRIM: WORD = 0x0010; +pub const IMAGE_FILE_LARGE_ADDRESS_AWARE: WORD = 0x0020; +pub const IMAGE_FILE_BYTES_REVERSED_LO: WORD = 0x0080; +pub const IMAGE_FILE_32BIT_MACHINE: WORD = 0x0100; +pub const IMAGE_FILE_DEBUG_STRIPPED: WORD = 0x0200; +pub const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP: WORD = 0x0400; +pub const IMAGE_FILE_NET_RUN_FROM_SWAP: WORD = 0x0800; +pub const IMAGE_FILE_SYSTEM: WORD = 0x1000; +pub const IMAGE_FILE_DLL: WORD = 0x2000; +pub const IMAGE_FILE_UP_SYSTEM_ONLY: WORD = 0x4000; +pub const IMAGE_FILE_BYTES_REVERSED_HI: WORD = 0x8000; +pub const IMAGE_FILE_MACHINE_UNKNOWN: WORD = 0; +pub const IMAGE_FILE_MACHINE_TARGET_HOST: WORD = 0x0001; +pub const IMAGE_FILE_MACHINE_I386: WORD = 0x014c; +pub const IMAGE_FILE_MACHINE_R3000: WORD = 0x0162; +pub const IMAGE_FILE_MACHINE_R4000: WORD = 0x0166; +pub const IMAGE_FILE_MACHINE_R10000: WORD = 0x0168; +pub const IMAGE_FILE_MACHINE_WCEMIPSV2: WORD = 0x0169; +pub const IMAGE_FILE_MACHINE_ALPHA: WORD = 0x0184; +pub const IMAGE_FILE_MACHINE_SH3: WORD = 0x01a2; +pub const IMAGE_FILE_MACHINE_SH3DSP: WORD = 0x01a3; +pub const IMAGE_FILE_MACHINE_SH3E: WORD = 0x01a4; +pub const IMAGE_FILE_MACHINE_SH4: WORD = 0x01a6; +pub const IMAGE_FILE_MACHINE_SH5: WORD = 0x01a8; +pub const IMAGE_FILE_MACHINE_ARM: WORD = 0x01c0; +pub const IMAGE_FILE_MACHINE_THUMB: WORD = 0x01c2; +pub const IMAGE_FILE_MACHINE_ARMNT: WORD = 0x01c4; +pub const IMAGE_FILE_MACHINE_AM33: WORD = 0x01d3; +pub const IMAGE_FILE_MACHINE_POWERPC: WORD = 0x01F0; +pub const IMAGE_FILE_MACHINE_POWERPCFP: WORD = 0x01f1; +pub const IMAGE_FILE_MACHINE_IA64: WORD = 0x0200; +pub const IMAGE_FILE_MACHINE_MIPS16: WORD = 0x0266; +pub const IMAGE_FILE_MACHINE_ALPHA64: WORD = 0x0284; +pub const IMAGE_FILE_MACHINE_MIPSFPU: WORD = 0x0366; +pub const IMAGE_FILE_MACHINE_MIPSFPU16: WORD = 0x0466; +pub const IMAGE_FILE_MACHINE_AXP64: WORD = IMAGE_FILE_MACHINE_ALPHA64; +pub const IMAGE_FILE_MACHINE_TRICORE: WORD = 0x0520; +pub const IMAGE_FILE_MACHINE_CEF: WORD = 0x0CEF; +pub const IMAGE_FILE_MACHINE_EBC: WORD = 0x0EBC; +pub const IMAGE_FILE_MACHINE_AMD64: WORD = 0x8664; +pub const IMAGE_FILE_MACHINE_M32R: WORD = 0x9041; +pub const IMAGE_FILE_MACHINE_ARM64: WORD = 0xAA64; +pub const IMAGE_FILE_MACHINE_CEE: WORD = 0xC0EE; +STRUCT!{struct IMAGE_DATA_DIRECTORY { + VirtualAddress: DWORD, + Size: DWORD, +}} +pub type PIMAGE_DATA_DIRECTORY = *mut IMAGE_DATA_DIRECTORY; +pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES: usize = 16; +STRUCT!{struct IMAGE_OPTIONAL_HEADER32 { + Magic: WORD, + MajorLinkerVersion: BYTE, + MinorLinkerVersion: BYTE, + SizeOfCode: DWORD, + SizeOfInitializedData: DWORD, + SizeOfUninitializedData: DWORD, + AddressOfEntryPoint: DWORD, + BaseOfCode: DWORD, + BaseOfData: DWORD, + ImageBase: DWORD, + SectionAlignment: DWORD, + FileAlignment: DWORD, + MajorOperatingSystemVersion: WORD, + MinorOperatingSystemVersion: WORD, + MajorImageVersion: WORD, + MinorImageVersion: WORD, + MajorSubsystemVersion: WORD, + MinorSubsystemVersion: WORD, + Win32VersionValue: DWORD, + SizeOfImage: DWORD, + SizeOfHeaders: DWORD, + CheckSum: DWORD, + Subsystem: WORD, + DllCharacteristics: WORD, + SizeOfStackReserve: DWORD, + SizeOfStackCommit: DWORD, + SizeOfHeapReserve: DWORD, + SizeOfHeapCommit: DWORD, + LoaderFlags: DWORD, + NumberOfRvaAndSizes: DWORD, + DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES], +}} +pub type PIMAGE_OPTIONAL_HEADER32 = *mut IMAGE_OPTIONAL_HEADER32; +STRUCT!{struct IMAGE_ROM_OPTIONAL_HEADER { + Magic: WORD, + MajorLinkerVersion: BYTE, + MinorLinkerVersion: BYTE, + SizeOfCode: DWORD, + SizeOfInitializedData: DWORD, + SizeOfUninitializedData: DWORD, + AddressOfEntryPoint: DWORD, + BaseOfCode: DWORD, + BaseOfData: DWORD, + BaseOfBss: DWORD, + GprMask: DWORD, + CprMask: [DWORD; 4], + GpValue: DWORD, +}} +pub type PIMAGE_ROM_OPTIONAL_HEADER = *mut IMAGE_ROM_OPTIONAL_HEADER; +STRUCT!{struct IMAGE_OPTIONAL_HEADER64 { + Magic: WORD, + MajorLinkerVersion: BYTE, + MinorLinkerVersion: BYTE, + SizeOfCode: DWORD, + SizeOfInitializedData: DWORD, + SizeOfUninitializedData: DWORD, + AddressOfEntryPoint: DWORD, + BaseOfCode: DWORD, + ImageBase: ULONGLONG, + SectionAlignment: DWORD, + FileAlignment: DWORD, + MajorOperatingSystemVersion: WORD, + MinorOperatingSystemVersion: WORD, + MajorImageVersion: WORD, + MinorImageVersion: WORD, + MajorSubsystemVersion: WORD, + MinorSubsystemVersion: WORD, + Win32VersionValue: DWORD, + SizeOfImage: DWORD, + SizeOfHeaders: DWORD, + CheckSum: DWORD, + Subsystem: WORD, + DllCharacteristics: WORD, + SizeOfStackReserve: ULONGLONG, + SizeOfStackCommit: ULONGLONG, + SizeOfHeapReserve: ULONGLONG, + SizeOfHeapCommit: ULONGLONG, + LoaderFlags: DWORD, + NumberOfRvaAndSizes: DWORD, + DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES], +}} +pub type PIMAGE_OPTIONAL_HEADER64 = *mut IMAGE_OPTIONAL_HEADER64; +pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC: WORD = 0x10b; +pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC: WORD = 0x20b; +pub const IMAGE_ROM_OPTIONAL_HDR_MAGIC: WORD = 0x107; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER64; +pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER64; +pub const IMAGE_NT_OPTIONAL_HDR_MAGIC: WORD = IMAGE_NT_OPTIONAL_HDR64_MAGIC; +} +#[cfg(target_arch = "x86")] +IFDEF!{ +pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32; +pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER32; +pub const IMAGE_NT_OPTIONAL_HDR_MAGIC: WORD = IMAGE_NT_OPTIONAL_HDR32_MAGIC; +} +STRUCT!{struct IMAGE_NT_HEADERS64 { + Signature: DWORD, + FileHeader: IMAGE_FILE_HEADER, + OptionalHeader: IMAGE_OPTIONAL_HEADER64, +}} +pub type PIMAGE_NT_HEADERS64 = *mut IMAGE_NT_HEADERS64; +STRUCT!{struct IMAGE_NT_HEADERS32 { + Signature: DWORD, + FileHeader: IMAGE_FILE_HEADER, + OptionalHeader: IMAGE_OPTIONAL_HEADER32, +}} +pub type PIMAGE_NT_HEADERS32 = *mut IMAGE_NT_HEADERS32; +STRUCT!{struct IMAGE_ROM_HEADERS { + FileHeader: IMAGE_FILE_HEADER, + OptionalHeader: IMAGE_ROM_OPTIONAL_HEADER, +}} +pub type PIMAGE_ROM_HEADERS = *mut IMAGE_ROM_HEADERS; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS64; +pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS64; +} +#[cfg(target_arch = "x86")] +IFDEF!{ +pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32; +pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS32; +} +pub const IMAGE_SUBSYSTEM_UNKNOWN: WORD = 0; +pub const IMAGE_SUBSYSTEM_NATIVE: WORD = 1; +pub const IMAGE_SUBSYSTEM_WINDOWS_GUI: WORD = 2; +pub const IMAGE_SUBSYSTEM_WINDOWS_CUI: WORD = 3; +pub const IMAGE_SUBSYSTEM_OS2_CUI: WORD = 5; +pub const IMAGE_SUBSYSTEM_POSIX_CUI: WORD = 7; +pub const IMAGE_SUBSYSTEM_NATIVE_WINDOWS: WORD = 8; +pub const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: WORD = 9; +pub const IMAGE_SUBSYSTEM_EFI_APPLICATION: WORD = 10; +pub const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER: WORD = 11; +pub const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: WORD = 12; +pub const IMAGE_SUBSYSTEM_EFI_ROM: WORD = 13; +pub const IMAGE_SUBSYSTEM_XBOX: WORD = 14; +pub const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION: WORD = 16; +pub const IMAGE_SUBSYSTEM_XBOX_CODE_CATALOG: WORD = 17; +pub const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA: WORD = 0x0020; +pub const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE: WORD = 0x0040; +pub const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY: WORD = 0x0080; +pub const IMAGE_DLLCHARACTERISTICS_NX_COMPAT: WORD = 0x0100; +pub const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION: WORD = 0x0200; +pub const IMAGE_DLLCHARACTERISTICS_NO_SEH: WORD = 0x0400; +pub const IMAGE_DLLCHARACTERISTICS_NO_BIND: WORD = 0x0800; +pub const IMAGE_DLLCHARACTERISTICS_APPCONTAINER: WORD = 0x1000; +pub const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER: WORD = 0x2000; +pub const IMAGE_DLLCHARACTERISTICS_GUARD_CF: WORD = 0x4000; +pub const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE: WORD = 0x8000; +pub const IMAGE_DIRECTORY_ENTRY_EXPORT: WORD = 0; +pub const IMAGE_DIRECTORY_ENTRY_IMPORT: WORD = 1; +pub const IMAGE_DIRECTORY_ENTRY_RESOURCE: WORD = 2; +pub const IMAGE_DIRECTORY_ENTRY_EXCEPTION: WORD = 3; +pub const IMAGE_DIRECTORY_ENTRY_SECURITY: WORD = 4; +pub const IMAGE_DIRECTORY_ENTRY_BASERELOC: WORD = 5; +pub const IMAGE_DIRECTORY_ENTRY_DEBUG: WORD = 6; +pub const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE: WORD = 7; +pub const IMAGE_DIRECTORY_ENTRY_GLOBALPTR: WORD = 8; +pub const IMAGE_DIRECTORY_ENTRY_TLS: WORD = 9; +pub const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG: WORD = 10; +pub const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT: WORD = 11; +pub const IMAGE_DIRECTORY_ENTRY_IAT: WORD = 12; +pub const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT: WORD = 13; +pub const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR: WORD = 14; +STRUCT!{struct ANON_OBJECT_HEADER { + Sig1: WORD, + Sig2: WORD, + Version: WORD, + Machine: WORD, + TimeDateStamp: DWORD, + ClassID: CLSID, + SizeOfData: DWORD, +}} +STRUCT!{struct ANON_OBJECT_HEADER_V2 { + Sig1: WORD, + Sig2: WORD, + Version: WORD, + Machine: WORD, + TimeDateStamp: DWORD, + ClassID: CLSID, + SizeOfData: DWORD, + Flags: DWORD, + MetaDataSize: DWORD, + MetaDataOffset: DWORD, +}} +STRUCT!{struct ANON_OBJECT_HEADER_BIGOBJ { + Sig1: WORD, + Sig2: WORD, + Version: WORD, + Machine: WORD, + TimeDateStamp: DWORD, + ClassID: CLSID, + SizeOfData: DWORD, + Flags: DWORD, + MetaDataSize: DWORD, + MetaDataOffset: DWORD, + NumberOfSections: DWORD, + PointerToSymbolTable: DWORD, + NumberOfSymbols: DWORD, +}} +pub const IMAGE_SIZEOF_SHORT_NAME: usize = 8; +UNION!{union IMAGE_SECTION_HEADER_Misc { + [u32; 1], + PhysicalAddress PhysicalAddress_mut: DWORD, + VirtualSize VirtualSize_mut: DWORD, +}} +STRUCT!{struct IMAGE_SECTION_HEADER { + Name: [BYTE; IMAGE_SIZEOF_SHORT_NAME], + Misc: IMAGE_SECTION_HEADER_Misc, + VirtualAddress: DWORD, + SizeOfRawData: DWORD, + PointerToRawData: DWORD, + PointerToRelocations: DWORD, + PointerToLinenumbers: DWORD, + NumberOfRelocations: WORD, + NumberOfLinenumbers: WORD, + Characteristics: DWORD, +}} +pub type PIMAGE_SECTION_HEADER = *mut IMAGE_SECTION_HEADER; +pub const IMAGE_SIZEOF_SECTION_HEADER: usize = 40; +pub const IMAGE_SCN_TYPE_NO_PAD: DWORD = 0x00000008; +pub const IMAGE_SCN_CNT_CODE: DWORD = 0x00000020; +pub const IMAGE_SCN_CNT_INITIALIZED_DATA: DWORD = 0x00000040; +pub const IMAGE_SCN_CNT_UNINITIALIZED_DATA: DWORD = 0x00000080; +pub const IMAGE_SCN_LNK_OTHER: DWORD = 0x00000100; +pub const IMAGE_SCN_LNK_INFO: DWORD = 0x00000200; +pub const IMAGE_SCN_LNK_REMOVE: DWORD = 0x00000800; +pub const IMAGE_SCN_LNK_COMDAT: DWORD = 0x00001000; +pub const IMAGE_SCN_NO_DEFER_SPEC_EXC: DWORD = 0x00004000; +pub const IMAGE_SCN_GPREL: DWORD = 0x00008000; +pub const IMAGE_SCN_MEM_FARDATA: DWORD = 0x00008000; +pub const IMAGE_SCN_MEM_PURGEABLE: DWORD = 0x00020000; +pub const IMAGE_SCN_MEM_16BIT: DWORD = 0x00020000; +pub const IMAGE_SCN_MEM_LOCKED: DWORD = 0x00040000; +pub const IMAGE_SCN_MEM_PRELOAD: DWORD = 0x00080000; +pub const IMAGE_SCN_ALIGN_1BYTES: DWORD = 0x00100000; +pub const IMAGE_SCN_ALIGN_2BYTES: DWORD = 0x00200000; +pub const IMAGE_SCN_ALIGN_4BYTES: DWORD = 0x00300000; +pub const IMAGE_SCN_ALIGN_8BYTES: DWORD = 0x00400000; +pub const IMAGE_SCN_ALIGN_16BYTES: DWORD = 0x00500000; +pub const IMAGE_SCN_ALIGN_32BYTES: DWORD = 0x00600000; +pub const IMAGE_SCN_ALIGN_64BYTES: DWORD = 0x00700000; +pub const IMAGE_SCN_ALIGN_128BYTES: DWORD = 0x00800000; +pub const IMAGE_SCN_ALIGN_256BYTES: DWORD = 0x00900000; +pub const IMAGE_SCN_ALIGN_512BYTES: DWORD = 0x00A00000; +pub const IMAGE_SCN_ALIGN_1024BYTES: DWORD = 0x00B00000; +pub const IMAGE_SCN_ALIGN_2048BYTES: DWORD = 0x00C00000; +pub const IMAGE_SCN_ALIGN_4096BYTES: DWORD = 0x00D00000; +pub const IMAGE_SCN_ALIGN_8192BYTES: DWORD = 0x00E00000; +pub const IMAGE_SCN_ALIGN_MASK: DWORD = 0x00F00000; +pub const IMAGE_SCN_LNK_NRELOC_OVFL: DWORD = 0x01000000; +pub const IMAGE_SCN_MEM_DISCARDABLE: DWORD = 0x02000000; +pub const IMAGE_SCN_MEM_NOT_CACHED: DWORD = 0x04000000; +pub const IMAGE_SCN_MEM_NOT_PAGED: DWORD = 0x08000000; +pub const IMAGE_SCN_MEM_SHARED: DWORD = 0x10000000; +pub const IMAGE_SCN_MEM_EXECUTE: DWORD = 0x20000000; +pub const IMAGE_SCN_MEM_READ: DWORD = 0x40000000; +pub const IMAGE_SCN_MEM_WRITE: DWORD = 0x80000000; +pub const IMAGE_SCN_SCALE_INDEX: DWORD = 0x00000001; +STRUCT!{struct IMAGE_SYMBOL_N_Name { + Short: DWORD, + Long: DWORD, +}} +UNION!{union IMAGE_SYMBOL_N { + [u32; 2], + ShortName ShortName_mut: [BYTE; 8], + Name Name_mut: IMAGE_SYMBOL_N_Name, + LongName LongName_mut: [DWORD; 2], +}} +STRUCT!{struct IMAGE_SYMBOL { + N: IMAGE_SYMBOL_N, + Value: DWORD, + SectionNumber: SHORT, + Type: WORD, + StorageClass: BYTE, + NumberOfAuxSymbols: BYTE, +}} +pub type PIMAGE_SYMBOL = *mut IMAGE_SYMBOL; +pub const IMAGE_SIZEOF_SYMBOL: usize = 18; +STRUCT!{struct IMAGE_SYMBOL_EX_N_Name { + Short: DWORD, + Long: DWORD, +}} +UNION!{union IMAGE_SYMBOL_EX_N { + [u32; 2], + ShortName ShortName_mut: [BYTE; 8], + Name Name_mut: IMAGE_SYMBOL_EX_N_Name, + LongName LongName_mut: [DWORD; 2], +}} +STRUCT!{struct IMAGE_SYMBOL_EX { + N: IMAGE_SYMBOL_EX_N, + Value: DWORD, + SectionNumber: LONG, + Type: WORD, + StorageClass: BYTE, + NumberOfAuxSymbols: BYTE, +}} +pub type PIMAGE_SYMBOL_EX = *mut IMAGE_SYMBOL_EX; +pub const IMAGE_SYM_UNDEFINED: SHORT = 0; +pub const IMAGE_SYM_ABSOLUTE: SHORT = -1; +pub const IMAGE_SYM_DEBUG: SHORT = -2; +pub const IMAGE_SYM_SECTION_MAX: USHORT = 0xFEFF; +pub const IMAGE_SYM_SECTION_MAX_EX: LONG = MAXLONG; +pub const IMAGE_SYM_TYPE_NULL: WORD = 0x0000; +pub const IMAGE_SYM_TYPE_VOID: WORD = 0x0001; +pub const IMAGE_SYM_TYPE_CHAR: WORD = 0x0002; +pub const IMAGE_SYM_TYPE_SHORT: WORD = 0x0003; +pub const IMAGE_SYM_TYPE_INT: WORD = 0x0004; +pub const IMAGE_SYM_TYPE_LONG: WORD = 0x0005; +pub const IMAGE_SYM_TYPE_FLOAT: WORD = 0x0006; +pub const IMAGE_SYM_TYPE_DOUBLE: WORD = 0x0007; +pub const IMAGE_SYM_TYPE_STRUCT: WORD = 0x0008; +pub const IMAGE_SYM_TYPE_UNION: WORD = 0x0009; +pub const IMAGE_SYM_TYPE_ENUM: WORD = 0x000A; +pub const IMAGE_SYM_TYPE_MOE: WORD = 0x000B; +pub const IMAGE_SYM_TYPE_BYTE: WORD = 0x000C; +pub const IMAGE_SYM_TYPE_WORD: WORD = 0x000D; +pub const IMAGE_SYM_TYPE_UINT: WORD = 0x000E; +pub const IMAGE_SYM_TYPE_DWORD: WORD = 0x000F; +pub const IMAGE_SYM_TYPE_PCODE: WORD = 0x8000; +pub const IMAGE_SYM_DTYPE_NULL: WORD = 0; +pub const IMAGE_SYM_DTYPE_POINTER: WORD = 1; +pub const IMAGE_SYM_DTYPE_FUNCTION: WORD = 2; +pub const IMAGE_SYM_DTYPE_ARRAY: WORD = 3; +pub const IMAGE_SYM_CLASS_END_OF_FUNCTION: BYTE = -1i8 as u8; +pub const IMAGE_SYM_CLASS_NULL: BYTE = 0x0000; +pub const IMAGE_SYM_CLASS_AUTOMATIC: BYTE = 0x0001; +pub const IMAGE_SYM_CLASS_EXTERNAL: BYTE = 0x0002; +pub const IMAGE_SYM_CLASS_STATIC: BYTE = 0x0003; +pub const IMAGE_SYM_CLASS_REGISTER: BYTE = 0x0004; +pub const IMAGE_SYM_CLASS_EXTERNAL_DEF: BYTE = 0x0005; +pub const IMAGE_SYM_CLASS_LABEL: BYTE = 0x0006; +pub const IMAGE_SYM_CLASS_UNDEFINED_LABEL: BYTE = 0x0007; +pub const IMAGE_SYM_CLASS_MEMBER_OF_STRUCT: BYTE = 0x0008; +pub const IMAGE_SYM_CLASS_ARGUMENT: BYTE = 0x0009; +pub const IMAGE_SYM_CLASS_STRUCT_TAG: BYTE = 0x000A; +pub const IMAGE_SYM_CLASS_MEMBER_OF_UNION: BYTE = 0x000B; +pub const IMAGE_SYM_CLASS_UNION_TAG: BYTE = 0x000C; +pub const IMAGE_SYM_CLASS_TYPE_DEFINITION: BYTE = 0x000D; +pub const IMAGE_SYM_CLASS_UNDEFINED_STATIC: BYTE = 0x000E; +pub const IMAGE_SYM_CLASS_ENUM_TAG: BYTE = 0x000F; +pub const IMAGE_SYM_CLASS_MEMBER_OF_ENUM: BYTE = 0x0010; +pub const IMAGE_SYM_CLASS_REGISTER_PARAM: BYTE = 0x0011; +pub const IMAGE_SYM_CLASS_BIT_FIELD: BYTE = 0x0012; +pub const IMAGE_SYM_CLASS_FAR_EXTERNAL: BYTE = 0x0044; +pub const IMAGE_SYM_CLASS_BLOCK: BYTE = 0x0064; +pub const IMAGE_SYM_CLASS_FUNCTION: BYTE = 0x0065; +pub const IMAGE_SYM_CLASS_END_OF_STRUCT: BYTE = 0x0066; +pub const IMAGE_SYM_CLASS_FILE: BYTE = 0x0067; +pub const IMAGE_SYM_CLASS_SECTION: BYTE = 0x0068; +pub const IMAGE_SYM_CLASS_WEAK_EXTERNAL: BYTE = 0x0069; +pub const IMAGE_SYM_CLASS_CLR_TOKEN: BYTE = 0x006B; +pub const N_BTMASK: WORD = 0x000F; +pub const N_TMASK: WORD = 0x0030; +pub const N_TMASK1: WORD = 0x00C0; +pub const N_TMASK2: WORD = 0x00F0; +pub const N_BTSHFT: usize = 4; +pub const N_TSHIFT: usize = 2; +#[inline] +pub fn BTYPE(x: WORD) -> bool { + (x & N_BTMASK) != 0 +} +#[inline] +pub fn ISPTR(x: WORD) -> bool { + (x & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) +} +#[inline] +pub fn ISFCN(x: WORD) -> bool { + (x & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT) +} +#[inline] +pub fn ISARY(x: WORD) -> bool { + (x & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT) +} +#[inline] +pub fn ISTAG(x: BYTE) -> bool { + (x == IMAGE_SYM_CLASS_STRUCT_TAG) || (x == IMAGE_SYM_CLASS_UNION_TAG) + || (x == IMAGE_SYM_CLASS_ENUM_TAG) +} +#[inline] +pub fn INCREF(x: WORD) -> WORD { + ((x & !N_BTMASK) << N_TSHIFT) | (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) | (x & N_BTMASK) +} +#[inline] +pub fn DECREF(x: WORD) -> WORD { + ((x >> N_TSHIFT) & !N_BTMASK) | (x & N_BTMASK) +} +STRUCT!{struct IMAGE_AUX_SYMBOL_TOKEN_DEF { + bAuxType: BYTE, + bReserved: BYTE, + SymbolTableIndex: DWORD, + rgbReserved: [BYTE; 12], +}} +pub type PIMAGE_AUX_SYMBOL_TOKEN_DEF = *mut IMAGE_AUX_SYMBOL_TOKEN_DEF; +STRUCT!{struct IMAGE_AUX_SYMBOL_Sym_Misc_LnSz { + Linenumber: WORD, + Size: WORD, +}} +UNION!{union IMAGE_AUX_SYMBOL_Sym_Misc { + [u32; 1], + LnSz LnSz_mut: IMAGE_AUX_SYMBOL_Sym_Misc_LnSz, + TotalSize TotalSize_mut: DWORD, +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_Sym_FcnAry_Function { + PointerToLinenumber: DWORD, + PointerToNextFunction: DWORD, +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_Sym_FcnAry_Array { + Dimension: [WORD; 4], +}} +UNION!{union IMAGE_AUX_SYMBOL_Sym_FcnAry { + [u32; 2], + Function Function_mut: IMAGE_AUX_SYMBOL_Sym_FcnAry_Function, + Array Array_mut: IMAGE_AUX_SYMBOL_Sym_FcnAry_Array, +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_Sym { + TagIndex: DWORD, + Misc: IMAGE_AUX_SYMBOL_Sym_Misc, + FcnAry: IMAGE_AUX_SYMBOL_Sym_FcnAry, + TvIndex: WORD, +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_File { + Name: [BYTE; IMAGE_SIZEOF_SYMBOL], +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_Section { + Length: DWORD, + NumberOfRelocations: WORD, + NumberOfLinenumbers: WORD, + CheckSum: DWORD, + Number: SHORT, + Selection: BYTE, + bReserved: BYTE, + HighNumber: SHORT, +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_CRC { + crc: DWORD, + rgbReserved: [BYTE; 14], +}} +STRUCT!{struct IMAGE_AUX_SYMBOL { + Sym: IMAGE_AUX_SYMBOL_Sym, + File: IMAGE_AUX_SYMBOL_File, + Section: IMAGE_AUX_SYMBOL_Section, + TokenDef: IMAGE_AUX_SYMBOL_TOKEN_DEF, + CRC: IMAGE_AUX_SYMBOL_CRC, +}} +pub type PIMAGE_AUX_SYMBOL = *mut IMAGE_AUX_SYMBOL; +STRUCT!{struct IMAGE_AUX_SYMBOL_EX_Sym { + WeakDefaultSymIndex: DWORD, + WeakSearchType: DWORD, + rgbReserved: [BYTE; 12], +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_EX_File { + Name: [BYTE; 20], +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_EX_Section { + Length: DWORD, + NumberOfRelocations: WORD, + NumberOfLinenumbers: WORD, + CheckSum: DWORD, + Number: SHORT, + Selection: BYTE, + bReserved: BYTE, + HighNumber: SHORT, + rgbReserved: [BYTE; 2], +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_EX_s { + TokenDef: IMAGE_AUX_SYMBOL_TOKEN_DEF, + rgbReserved: [BYTE; 2], +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_EX_CRC { + crc: DWORD, + rgbReserved: [BYTE; 16], +}} +STRUCT!{struct IMAGE_AUX_SYMBOL_EX { + Sym: IMAGE_AUX_SYMBOL_EX_Sym, + File: IMAGE_AUX_SYMBOL_EX_File, + Section: IMAGE_AUX_SYMBOL_EX_Section, + s: IMAGE_AUX_SYMBOL_EX_s, + CRC: IMAGE_AUX_SYMBOL_EX_CRC, +}} +pub type PIMAGE_AUX_SYMBOL_EX = *mut IMAGE_AUX_SYMBOL_EX; +ENUM!{enum IMAGE_AUX_SYMBOL_TYPE { + IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1, +}} +pub const IMAGE_COMDAT_SELECT_NODUPLICATES: BYTE = 1; +pub const IMAGE_COMDAT_SELECT_ANY: BYTE = 2; +pub const IMAGE_COMDAT_SELECT_SAME_SIZE: BYTE = 3; +pub const IMAGE_COMDAT_SELECT_EXACT_MATCH: BYTE = 4; +pub const IMAGE_COMDAT_SELECT_ASSOCIATIVE: BYTE = 5; +pub const IMAGE_COMDAT_SELECT_LARGEST: BYTE = 6; +pub const IMAGE_COMDAT_SELECT_NEWEST: BYTE = 7; +pub const IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY: BYTE = 1; +pub const IMAGE_WEAK_EXTERN_SEARCH_LIBRARY: BYTE = 2; +pub const IMAGE_WEAK_EXTERN_SEARCH_ALIAS: BYTE = 3; +UNION!{union IMAGE_RELOCATION_u { + [u32; 1], + VirtualAddress VirtualAddress_mut: DWORD, + RelocCount RelocCount_mut: DWORD, +}} +STRUCT!{struct IMAGE_RELOCATION { + u: IMAGE_RELOCATION_u, + SymbolTableIndex: DWORD, + Type: WORD, +}} +pub type PIMAGE_RELOCATION = *mut IMAGE_RELOCATION; +pub const IMAGE_REL_I386_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_I386_DIR16: WORD = 0x0001; +pub const IMAGE_REL_I386_REL16: WORD = 0x0002; +pub const IMAGE_REL_I386_DIR32: WORD = 0x0006; +pub const IMAGE_REL_I386_DIR32NB: WORD = 0x0007; +pub const IMAGE_REL_I386_SEG12: WORD = 0x0009; +pub const IMAGE_REL_I386_SECTION: WORD = 0x000A; +pub const IMAGE_REL_I386_SECREL: WORD = 0x000B; +pub const IMAGE_REL_I386_TOKEN: WORD = 0x000C; +pub const IMAGE_REL_I386_SECREL7: WORD = 0x000D; +pub const IMAGE_REL_I386_REL32: WORD = 0x0014; +pub const IMAGE_REL_MIPS_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_MIPS_REFHALF: WORD = 0x0001; +pub const IMAGE_REL_MIPS_REFWORD: WORD = 0x0002; +pub const IMAGE_REL_MIPS_JMPADDR: WORD = 0x0003; +pub const IMAGE_REL_MIPS_REFHI: WORD = 0x0004; +pub const IMAGE_REL_MIPS_REFLO: WORD = 0x0005; +pub const IMAGE_REL_MIPS_GPREL: WORD = 0x0006; +pub const IMAGE_REL_MIPS_LITERAL: WORD = 0x0007; +pub const IMAGE_REL_MIPS_SECTION: WORD = 0x000A; +pub const IMAGE_REL_MIPS_SECREL: WORD = 0x000B; +pub const IMAGE_REL_MIPS_SECRELLO: WORD = 0x000C; +pub const IMAGE_REL_MIPS_SECRELHI: WORD = 0x000D; +pub const IMAGE_REL_MIPS_TOKEN: WORD = 0x000E; +pub const IMAGE_REL_MIPS_JMPADDR16: WORD = 0x0010; +pub const IMAGE_REL_MIPS_REFWORDNB: WORD = 0x0022; +pub const IMAGE_REL_MIPS_PAIR: WORD = 0x0025; +pub const IMAGE_REL_ALPHA_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_ALPHA_REFLONG: WORD = 0x0001; +pub const IMAGE_REL_ALPHA_REFQUAD: WORD = 0x0002; +pub const IMAGE_REL_ALPHA_GPREL32: WORD = 0x0003; +pub const IMAGE_REL_ALPHA_LITERAL: WORD = 0x0004; +pub const IMAGE_REL_ALPHA_LITUSE: WORD = 0x0005; +pub const IMAGE_REL_ALPHA_GPDISP: WORD = 0x0006; +pub const IMAGE_REL_ALPHA_BRADDR: WORD = 0x0007; +pub const IMAGE_REL_ALPHA_HINT: WORD = 0x0008; +pub const IMAGE_REL_ALPHA_INLINE_REFLONG: WORD = 0x0009; +pub const IMAGE_REL_ALPHA_REFHI: WORD = 0x000A; +pub const IMAGE_REL_ALPHA_REFLO: WORD = 0x000B; +pub const IMAGE_REL_ALPHA_PAIR: WORD = 0x000C; +pub const IMAGE_REL_ALPHA_MATCH: WORD = 0x000D; +pub const IMAGE_REL_ALPHA_SECTION: WORD = 0x000E; +pub const IMAGE_REL_ALPHA_SECREL: WORD = 0x000F; +pub const IMAGE_REL_ALPHA_REFLONGNB: WORD = 0x0010; +pub const IMAGE_REL_ALPHA_SECRELLO: WORD = 0x0011; +pub const IMAGE_REL_ALPHA_SECRELHI: WORD = 0x0012; +pub const IMAGE_REL_ALPHA_REFQ3: WORD = 0x0013; +pub const IMAGE_REL_ALPHA_REFQ2: WORD = 0x0014; +pub const IMAGE_REL_ALPHA_REFQ1: WORD = 0x0015; +pub const IMAGE_REL_ALPHA_GPRELLO: WORD = 0x0016; +pub const IMAGE_REL_ALPHA_GPRELHI: WORD = 0x0017; +pub const IMAGE_REL_PPC_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_PPC_ADDR64: WORD = 0x0001; +pub const IMAGE_REL_PPC_ADDR32: WORD = 0x0002; +pub const IMAGE_REL_PPC_ADDR24: WORD = 0x0003; +pub const IMAGE_REL_PPC_ADDR16: WORD = 0x0004; +pub const IMAGE_REL_PPC_ADDR14: WORD = 0x0005; +pub const IMAGE_REL_PPC_REL24: WORD = 0x0006; +pub const IMAGE_REL_PPC_REL14: WORD = 0x0007; +pub const IMAGE_REL_PPC_TOCREL16: WORD = 0x0008; +pub const IMAGE_REL_PPC_TOCREL14: WORD = 0x0009; +pub const IMAGE_REL_PPC_ADDR32NB: WORD = 0x000A; +pub const IMAGE_REL_PPC_SECREL: WORD = 0x000B; +pub const IMAGE_REL_PPC_SECTION: WORD = 0x000C; +pub const IMAGE_REL_PPC_IFGLUE: WORD = 0x000D; +pub const IMAGE_REL_PPC_IMGLUE: WORD = 0x000E; +pub const IMAGE_REL_PPC_SECREL16: WORD = 0x000F; +pub const IMAGE_REL_PPC_REFHI: WORD = 0x0010; +pub const IMAGE_REL_PPC_REFLO: WORD = 0x0011; +pub const IMAGE_REL_PPC_PAIR: WORD = 0x0012; +pub const IMAGE_REL_PPC_SECRELLO: WORD = 0x0013; +pub const IMAGE_REL_PPC_SECRELHI: WORD = 0x0014; +pub const IMAGE_REL_PPC_GPREL: WORD = 0x0015; +pub const IMAGE_REL_PPC_TOKEN: WORD = 0x0016; +pub const IMAGE_REL_PPC_TYPEMASK: WORD = 0x00FF; +pub const IMAGE_REL_PPC_NEG: WORD = 0x0100; +pub const IMAGE_REL_PPC_BRTAKEN: WORD = 0x0200; +pub const IMAGE_REL_PPC_BRNTAKEN: WORD = 0x0400; +pub const IMAGE_REL_PPC_TOCDEFN: WORD = 0x0800; +pub const IMAGE_REL_SH3_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_SH3_DIRECT16: WORD = 0x0001; +pub const IMAGE_REL_SH3_DIRECT32: WORD = 0x0002; +pub const IMAGE_REL_SH3_DIRECT8: WORD = 0x0003; +pub const IMAGE_REL_SH3_DIRECT8_WORD: WORD = 0x0004; +pub const IMAGE_REL_SH3_DIRECT8_LONG: WORD = 0x0005; +pub const IMAGE_REL_SH3_DIRECT4: WORD = 0x0006; +pub const IMAGE_REL_SH3_DIRECT4_WORD: WORD = 0x0007; +pub const IMAGE_REL_SH3_DIRECT4_LONG: WORD = 0x0008; +pub const IMAGE_REL_SH3_PCREL8_WORD: WORD = 0x0009; +pub const IMAGE_REL_SH3_PCREL8_LONG: WORD = 0x000A; +pub const IMAGE_REL_SH3_PCREL12_WORD: WORD = 0x000B; +pub const IMAGE_REL_SH3_STARTOF_SECTION: WORD = 0x000C; +pub const IMAGE_REL_SH3_SIZEOF_SECTION: WORD = 0x000D; +pub const IMAGE_REL_SH3_SECTION: WORD = 0x000E; +pub const IMAGE_REL_SH3_SECREL: WORD = 0x000F; +pub const IMAGE_REL_SH3_DIRECT32_NB: WORD = 0x0010; +pub const IMAGE_REL_SH3_GPREL4_LONG: WORD = 0x0011; +pub const IMAGE_REL_SH3_TOKEN: WORD = 0x0012; +pub const IMAGE_REL_SHM_PCRELPT: WORD = 0x0013; +pub const IMAGE_REL_SHM_REFLO: WORD = 0x0014; +pub const IMAGE_REL_SHM_REFHALF: WORD = 0x0015; +pub const IMAGE_REL_SHM_RELLO: WORD = 0x0016; +pub const IMAGE_REL_SHM_RELHALF: WORD = 0x0017; +pub const IMAGE_REL_SHM_PAIR: WORD = 0x0018; +pub const IMAGE_REL_SH_NOMODE: WORD = 0x8000; +pub const IMAGE_REL_ARM_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_ARM_ADDR32: WORD = 0x0001; +pub const IMAGE_REL_ARM_ADDR32NB: WORD = 0x0002; +pub const IMAGE_REL_ARM_BRANCH24: WORD = 0x0003; +pub const IMAGE_REL_ARM_BRANCH11: WORD = 0x0004; +pub const IMAGE_REL_ARM_TOKEN: WORD = 0x0005; +pub const IMAGE_REL_ARM_GPREL12: WORD = 0x0006; +pub const IMAGE_REL_ARM_GPREL7: WORD = 0x0007; +pub const IMAGE_REL_ARM_BLX24: WORD = 0x0008; +pub const IMAGE_REL_ARM_BLX11: WORD = 0x0009; +pub const IMAGE_REL_ARM_SECTION: WORD = 0x000E; +pub const IMAGE_REL_ARM_SECREL: WORD = 0x000F; +pub const IMAGE_REL_ARM_MOV32A: WORD = 0x0010; +pub const IMAGE_REL_ARM_MOV32: WORD = 0x0010; +pub const IMAGE_REL_ARM_MOV32T: WORD = 0x0011; +pub const IMAGE_REL_THUMB_MOV32: WORD = 0x0011; +pub const IMAGE_REL_ARM_BRANCH20T: WORD = 0x0012; +pub const IMAGE_REL_THUMB_BRANCH20: WORD = 0x0012; +pub const IMAGE_REL_ARM_BRANCH24T: WORD = 0x0014; +pub const IMAGE_REL_THUMB_BRANCH24: WORD = 0x0014; +pub const IMAGE_REL_ARM_BLX23T: WORD = 0x0015; +pub const IMAGE_REL_THUMB_BLX23: WORD = 0x0015; +pub const IMAGE_REL_AM_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_AM_ADDR32: WORD = 0x0001; +pub const IMAGE_REL_AM_ADDR32NB: WORD = 0x0002; +pub const IMAGE_REL_AM_CALL32: WORD = 0x0003; +pub const IMAGE_REL_AM_FUNCINFO: WORD = 0x0004; +pub const IMAGE_REL_AM_REL32_1: WORD = 0x0005; +pub const IMAGE_REL_AM_REL32_2: WORD = 0x0006; +pub const IMAGE_REL_AM_SECREL: WORD = 0x0007; +pub const IMAGE_REL_AM_SECTION: WORD = 0x0008; +pub const IMAGE_REL_AM_TOKEN: WORD = 0x0009; +pub const IMAGE_REL_ARM64_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_ARM64_ADDR32: WORD = 0x0001; +pub const IMAGE_REL_ARM64_ADDR32NB: WORD = 0x0002; +pub const IMAGE_REL_ARM64_BRANCH26: WORD = 0x0003; +pub const IMAGE_REL_ARM64_PAGEBASE_REL21: WORD = 0x0004; +pub const IMAGE_REL_ARM64_REL21: WORD = 0x0005; +pub const IMAGE_REL_ARM64_PAGEOFFSET_12A: WORD = 0x0006; +pub const IMAGE_REL_ARM64_PAGEOFFSET_12L: WORD = 0x0007; +pub const IMAGE_REL_ARM64_SECREL: WORD = 0x0008; +pub const IMAGE_REL_ARM64_SECREL_LOW12A: WORD = 0x0009; +pub const IMAGE_REL_ARM64_SECREL_HIGH12A: WORD = 0x000A; +pub const IMAGE_REL_ARM64_SECREL_LOW12L: WORD = 0x000B; +pub const IMAGE_REL_ARM64_TOKEN: WORD = 0x000C; +pub const IMAGE_REL_ARM64_SECTION: WORD = 0x000D; +pub const IMAGE_REL_ARM64_ADDR64: WORD = 0x000E; +pub const IMAGE_REL_ARM64_BRANCH19: WORD = 0x000F; +pub const IMAGE_REL_AMD64_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_AMD64_ADDR64: WORD = 0x0001; +pub const IMAGE_REL_AMD64_ADDR32: WORD = 0x0002; +pub const IMAGE_REL_AMD64_ADDR32NB: WORD = 0x0003; +pub const IMAGE_REL_AMD64_REL32: WORD = 0x0004; +pub const IMAGE_REL_AMD64_REL32_1: WORD = 0x0005; +pub const IMAGE_REL_AMD64_REL32_2: WORD = 0x0006; +pub const IMAGE_REL_AMD64_REL32_3: WORD = 0x0007; +pub const IMAGE_REL_AMD64_REL32_4: WORD = 0x0008; +pub const IMAGE_REL_AMD64_REL32_5: WORD = 0x0009; +pub const IMAGE_REL_AMD64_SECTION: WORD = 0x000A; +pub const IMAGE_REL_AMD64_SECREL: WORD = 0x000B; +pub const IMAGE_REL_AMD64_SECREL7: WORD = 0x000C; +pub const IMAGE_REL_AMD64_TOKEN: WORD = 0x000D; +pub const IMAGE_REL_AMD64_SREL32: WORD = 0x000E; +pub const IMAGE_REL_AMD64_PAIR: WORD = 0x000F; +pub const IMAGE_REL_AMD64_SSPAN32: WORD = 0x0010; +pub const IMAGE_REL_IA64_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_IA64_IMM14: WORD = 0x0001; +pub const IMAGE_REL_IA64_IMM22: WORD = 0x0002; +pub const IMAGE_REL_IA64_IMM64: WORD = 0x0003; +pub const IMAGE_REL_IA64_DIR32: WORD = 0x0004; +pub const IMAGE_REL_IA64_DIR64: WORD = 0x0005; +pub const IMAGE_REL_IA64_PCREL21B: WORD = 0x0006; +pub const IMAGE_REL_IA64_PCREL21M: WORD = 0x0007; +pub const IMAGE_REL_IA64_PCREL21F: WORD = 0x0008; +pub const IMAGE_REL_IA64_GPREL22: WORD = 0x0009; +pub const IMAGE_REL_IA64_LTOFF22: WORD = 0x000A; +pub const IMAGE_REL_IA64_SECTION: WORD = 0x000B; +pub const IMAGE_REL_IA64_SECREL22: WORD = 0x000C; +pub const IMAGE_REL_IA64_SECREL64I: WORD = 0x000D; +pub const IMAGE_REL_IA64_SECREL32: WORD = 0x000E; +pub const IMAGE_REL_IA64_DIR32NB: WORD = 0x0010; +pub const IMAGE_REL_IA64_SREL14: WORD = 0x0011; +pub const IMAGE_REL_IA64_SREL22: WORD = 0x0012; +pub const IMAGE_REL_IA64_SREL32: WORD = 0x0013; +pub const IMAGE_REL_IA64_UREL32: WORD = 0x0014; +pub const IMAGE_REL_IA64_PCREL60X: WORD = 0x0015; +pub const IMAGE_REL_IA64_PCREL60B: WORD = 0x0016; +pub const IMAGE_REL_IA64_PCREL60F: WORD = 0x0017; +pub const IMAGE_REL_IA64_PCREL60I: WORD = 0x0018; +pub const IMAGE_REL_IA64_PCREL60M: WORD = 0x0019; +pub const IMAGE_REL_IA64_IMMGPREL64: WORD = 0x001A; +pub const IMAGE_REL_IA64_TOKEN: WORD = 0x001B; +pub const IMAGE_REL_IA64_GPREL32: WORD = 0x001C; +pub const IMAGE_REL_IA64_ADDEND: WORD = 0x001F; +pub const IMAGE_REL_CEF_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_CEF_ADDR32: WORD = 0x0001; +pub const IMAGE_REL_CEF_ADDR64: WORD = 0x0002; +pub const IMAGE_REL_CEF_ADDR32NB: WORD = 0x0003; +pub const IMAGE_REL_CEF_SECTION: WORD = 0x0004; +pub const IMAGE_REL_CEF_SECREL: WORD = 0x0005; +pub const IMAGE_REL_CEF_TOKEN: WORD = 0x0006; +pub const IMAGE_REL_CEE_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_CEE_ADDR32: WORD = 0x0001; +pub const IMAGE_REL_CEE_ADDR64: WORD = 0x0002; +pub const IMAGE_REL_CEE_ADDR32NB: WORD = 0x0003; +pub const IMAGE_REL_CEE_SECTION: WORD = 0x0004; +pub const IMAGE_REL_CEE_SECREL: WORD = 0x0005; +pub const IMAGE_REL_CEE_TOKEN: WORD = 0x0006; +pub const IMAGE_REL_M32R_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_M32R_ADDR32: WORD = 0x0001; +pub const IMAGE_REL_M32R_ADDR32NB: WORD = 0x0002; +pub const IMAGE_REL_M32R_ADDR24: WORD = 0x0003; +pub const IMAGE_REL_M32R_GPREL16: WORD = 0x0004; +pub const IMAGE_REL_M32R_PCREL24: WORD = 0x0005; +pub const IMAGE_REL_M32R_PCREL16: WORD = 0x0006; +pub const IMAGE_REL_M32R_PCREL8: WORD = 0x0007; +pub const IMAGE_REL_M32R_REFHALF: WORD = 0x0008; +pub const IMAGE_REL_M32R_REFHI: WORD = 0x0009; +pub const IMAGE_REL_M32R_REFLO: WORD = 0x000A; +pub const IMAGE_REL_M32R_PAIR: WORD = 0x000B; +pub const IMAGE_REL_M32R_SECTION: WORD = 0x000C; +pub const IMAGE_REL_M32R_SECREL32: WORD = 0x000D; +pub const IMAGE_REL_M32R_TOKEN: WORD = 0x000E; +pub const IMAGE_REL_EBC_ABSOLUTE: WORD = 0x0000; +pub const IMAGE_REL_EBC_ADDR32NB: WORD = 0x0001; +pub const IMAGE_REL_EBC_REL32: WORD = 0x0002; +pub const IMAGE_REL_EBC_SECTION: WORD = 0x0003; +pub const IMAGE_REL_EBC_SECREL: WORD = 0x0004; +UNION!{union IMAGE_LINENUMBER_Type { + [u32; 1], + SymbolTableIndex SymbolTableIndex_mut: DWORD, + VirtualAddress VirtualAddress_mut: DWORD, +}} +STRUCT!{struct IMAGE_LINENUMBER { + Type: IMAGE_LINENUMBER_Type, + Linenumber: WORD, +}} +pub type PIMAGE_LINENUMBER = *mut IMAGE_LINENUMBER; +STRUCT!{struct IMAGE_BASE_RELOCATION { + VirtualAddress: DWORD, + SizeOfBlock: DWORD, +}} +pub type PIMAGE_BASE_RELOCATION = *mut IMAGE_BASE_RELOCATION; +pub const IMAGE_REL_BASED_ABSOLUTE: WORD = 0; +pub const IMAGE_REL_BASED_HIGH: WORD = 1; +pub const IMAGE_REL_BASED_LOW: WORD = 2; +pub const IMAGE_REL_BASED_HIGHLOW: WORD = 3; +pub const IMAGE_REL_BASED_HIGHADJ: WORD = 4; +pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_5: WORD = 5; +pub const IMAGE_REL_BASED_RESERVED: WORD = 6; +pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_7: WORD = 7; +pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_8: WORD = 8; +pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_9: WORD = 9; +pub const IMAGE_REL_BASED_DIR64: WORD = 10; +pub const IMAGE_REL_BASED_IA64_IMM64: WORD = 9; +pub const IMAGE_REL_BASED_MIPS_JMPADDR: WORD = 5; +pub const IMAGE_REL_BASED_MIPS_JMPADDR16: WORD = 9; +pub const IMAGE_REL_BASED_ARM_MOV32: WORD = 5; +pub const IMAGE_REL_BASED_THUMB_MOV32: WORD = 7; +pub const IMAGE_ARCHIVE_START_SIZE: usize = 8; +pub const IMAGE_ARCHIVE_START: &'static str = "!\n"; +pub const IMAGE_ARCHIVE_END: &'static str = "`\n"; +pub const IMAGE_ARCHIVE_PAD: &'static str = "\n"; +pub const IMAGE_ARCHIVE_LINKER_MEMBER: &'static str = "/ "; +pub const IMAGE_ARCHIVE_LONGNAMES_MEMBER: &'static str = "// "; +pub const IMAGE_ARCHIVE_HYBRIDMAP_MEMBER: &'static str = "// "; +STRUCT!{struct IMAGE_ARCHIVE_MEMBER_HEADER { + Name: [BYTE; 16], + Date: [BYTE; 12], + UserID: [BYTE; 6], + GroupID: [BYTE; 6], + Mode: [BYTE; 8], + Size: [BYTE; 10], + EndHeader: [BYTE; 2], +}} +pub type PIMAGE_ARCHIVE_MEMBER_HEADER = *mut IMAGE_ARCHIVE_MEMBER_HEADER; +pub const IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR: usize = 60; +STRUCT!{struct IMAGE_EXPORT_DIRECTORY { + Characteristics: DWORD, + TimeDateStamp: DWORD, + MajorVersion: WORD, + MinorVersion: WORD, + Name: DWORD, + Base: DWORD, + NumberOfFunctions: DWORD, + NumberOfNames: DWORD, + AddressOfFunctions: DWORD, + AddressOfNames: DWORD, + AddressOfNameOrdinals: DWORD, +}} +pub type PIMAGE_EXPORT_DIRECTORY = *mut IMAGE_EXPORT_DIRECTORY; +STRUCT!{struct IMAGE_IMPORT_BY_NAME { + Hint: WORD, + Name: [CHAR; 1], +}} +pub type PIMAGE_IMPORT_BY_NAME = *mut IMAGE_IMPORT_BY_NAME; +UNION!{union IMAGE_THUNK_DATA64_u1 { + [u64; 1], + ForwarderString ForwarderString_mut: ULONGLONG, + Function Function_mut: ULONGLONG, + Ordinal Ordinal_mut: ULONGLONG, + AddressOfData AddressOfData_mut: ULONGLONG, +}} +STRUCT!{struct IMAGE_THUNK_DATA64 { + u1: IMAGE_THUNK_DATA64_u1, +}} +pub type PIMAGE_THUNK_DATA64 = *mut IMAGE_THUNK_DATA64; +UNION!{union IMAGE_THUNK_DATA32_u1 { + [u32; 1], + ForwarderString ForwarderString_mut: DWORD, + Function Function_mut: DWORD, + Ordinal Ordinal_mut: DWORD, + AddressOfData AddressOfData_mut: DWORD, +}} +STRUCT!{struct IMAGE_THUNK_DATA32 { + u1: IMAGE_THUNK_DATA32_u1, +}} +pub type PIMAGE_THUNK_DATA32 = *mut IMAGE_THUNK_DATA32; +pub const IMAGE_ORDINAL_FLAG64: ULONGLONG = 0x8000000000000000; +pub const IMAGE_ORDINAL_FLAG32: DWORD = 0x80000000; +#[inline] +pub fn IMAGE_ORDINAL64(Ordinal: ULONGLONG) -> ULONGLONG { + Ordinal & 0xffff +} +#[inline] +pub fn IMAGE_ORDINAL32(Ordinal: DWORD) -> DWORD { + Ordinal & 0xffff +} +#[inline] +pub fn IMAGE_SNAP_BY_ORDINAL64(Ordinal: ULONGLONG) -> bool { + (Ordinal & IMAGE_ORDINAL_FLAG64) != 0 +} +#[inline] +pub fn IMAGE_SNAP_BY_ORDINAL32(Ordinal: DWORD) -> bool { + (Ordinal & IMAGE_ORDINAL_FLAG32) != 0 +} +FN!{stdcall PIMAGE_TLS_CALLBACK( + DllHandle: PVOID, + Reason: DWORD, + Reserved: PVOID, +) -> ()} +STRUCT!{struct IMAGE_TLS_DIRECTORY64 { + StartAddressOfRawData: ULONGLONG, + EndAddressOfRawData: ULONGLONG, + AddressOfIndex: ULONGLONG, + AddressOfCallBacks: ULONGLONG, + SizeOfZeroFill: DWORD, + Characteristics: DWORD, +}} +BITFIELD!(IMAGE_TLS_DIRECTORY64 Characteristics: DWORD [ + Reserved0 set_Reserved0[0..20], + Alignment set_Alignment[20..24], + Reserved1 set_Reserved1[24..32], +]); +pub type PIMAGE_TLS_DIRECTORY64 = *mut IMAGE_TLS_DIRECTORY64; +STRUCT!{struct IMAGE_TLS_DIRECTORY32 { + StartAddressOfRawData: DWORD, + EndAddressOfRawData: DWORD, + AddressOfIndex: DWORD, + AddressOfCallBacks: DWORD, + SizeOfZeroFill: DWORD, + Characteristics: DWORD, +}} +BITFIELD!(IMAGE_TLS_DIRECTORY32 Characteristics: DWORD [ + Reserved0 set_Reserved0[0..20], + Alignment set_Alignment[20..24], + Reserved1 set_Reserved1[24..32], +]); +pub type PIMAGE_TLS_DIRECTORY32 = *mut IMAGE_TLS_DIRECTORY32; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub const IMAGE_ORDINAL_FLAG: ULONGLONG = IMAGE_ORDINAL_FLAG64; +#[inline] +pub fn IMAGE_ORDINAL(Ordinal: ULONGLONG) -> ULONGLONG { + IMAGE_ORDINAL64(Ordinal) +} +pub type IMAGE_THUNK_DATA = IMAGE_THUNK_DATA64; +pub type PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA64; +#[inline] +pub fn IMAGE_SNAP_BY_ORDINAL(Ordinal: ULONGLONG) -> bool { + IMAGE_SNAP_BY_ORDINAL64(Ordinal) +} +pub type IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY64; +pub type PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY64; +} +#[cfg(target_arch = "x86")] +IFDEF!{ +pub const IMAGE_ORDINAL_FLAG: DWORD = IMAGE_ORDINAL_FLAG32; +#[inline] +pub fn IMAGE_ORDINAL(Ordinal: DWORD) -> DWORD { + IMAGE_ORDINAL32(Ordinal) +} +pub type IMAGE_THUNK_DATA = IMAGE_THUNK_DATA32; +pub type PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA32; +#[inline] +pub fn IMAGE_SNAP_BY_ORDINAL(Ordinal: DWORD) -> bool { + IMAGE_SNAP_BY_ORDINAL32(Ordinal) +} +pub type IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY32; +pub type PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY32; +} +UNION!{union IMAGE_IMPORT_DESCRIPTOR_u { + [u32; 1], + Characteristics Characteristics_mut: DWORD, + OriginalFirstThunk OriginalFirstThunk_mut: DWORD, +}} +STRUCT!{struct IMAGE_IMPORT_DESCRIPTOR { + u: IMAGE_IMPORT_DESCRIPTOR_u, + TimeDateStamp: DWORD, + ForwarderChain: DWORD, + Name: DWORD, + FirstThunk: DWORD, +}} +pub type PIMAGE_IMPORT_DESCRIPTOR = *mut IMAGE_IMPORT_DESCRIPTOR; +STRUCT!{struct IMAGE_BOUND_IMPORT_DESCRIPTOR { + TimeDateStamp: DWORD, + OffsetModuleName: WORD, + NumberOfModuleForwarderRefs: WORD, +}} +pub type PIMAGE_BOUND_IMPORT_DESCRIPTOR = *mut IMAGE_BOUND_IMPORT_DESCRIPTOR; +STRUCT!{struct IMAGE_BOUND_FORWARDER_REF { + TimeDateStamp: DWORD, + OffsetModuleName: WORD, + Reserved: WORD, +}} +pub type PIMAGE_BOUND_FORWARDER_REF = *mut IMAGE_BOUND_FORWARDER_REF; +STRUCT!{struct IMAGE_DELAYLOAD_DESCRIPTOR_Attributes { + AllAttributes: DWORD, +}} +BITFIELD!(IMAGE_DELAYLOAD_DESCRIPTOR_Attributes AllAttributes: DWORD [ + RvaBased set_RvaBased[0..1], + ReservedAttributes set_ReservedAttributes[1..32], +]); +STRUCT!{struct IMAGE_DELAYLOAD_DESCRIPTOR { + Attributes: IMAGE_DELAYLOAD_DESCRIPTOR_Attributes, + DllNameRVA: DWORD, + ModuleHandleRVA: DWORD, + ImportAddressTableRVA: DWORD, + ImportNameTableRVA: DWORD, + BoundImportAddressTableRVA: DWORD, + UnloadInformationTableRVA: DWORD, + TimeDateStamp: DWORD, +}} +pub type PIMAGE_DELAYLOAD_DESCRIPTOR = *mut IMAGE_DELAYLOAD_DESCRIPTOR; +pub type PCIMAGE_DELAYLOAD_DESCRIPTOR = *const IMAGE_DELAYLOAD_DESCRIPTOR; +STRUCT!{struct IMAGE_RESOURCE_DIRECTORY { + Characteristics: DWORD, + TimeDateStamp: DWORD, + MajorVersion: WORD, + MinorVersion: WORD, + NumberOfNamedEntries: WORD, + NumberOfIdEntries: WORD, +}} +pub type PIMAGE_RESOURCE_DIRECTORY = *mut IMAGE_RESOURCE_DIRECTORY; +pub const IMAGE_RESOURCE_NAME_IS_STRING: DWORD = 0x80000000; +pub const IMAGE_RESOURCE_DATA_IS_DIRECTORY: DWORD = 0x80000000; +STRUCT!{struct IMAGE_RESOURCE_DIRECTORY_ENTRY_u_s { + BitFields: DWORD, +}} +BITFIELD!(IMAGE_RESOURCE_DIRECTORY_ENTRY_u_s BitFields: DWORD [ + NameOffset set_NameOffset[0..31], + NameIsString set_NameIsString[31..32], +]); +UNION!{union IMAGE_RESOURCE_DIRECTORY_ENTRY_u { + [u32; 1], + s s_mut: IMAGE_RESOURCE_DIRECTORY_ENTRY_u_s, + Name Name_mut: DWORD, + Id Id_mut: WORD, +}} +STRUCT!{struct IMAGE_RESOURCE_DIRECTORY_ENTRY { + u: IMAGE_RESOURCE_DIRECTORY_ENTRY_u, + OffsetToData: DWORD, +}} +BITFIELD!(IMAGE_RESOURCE_DIRECTORY_ENTRY OffsetToData: DWORD [ + OffsetToDirectory set_OffsetToDirectory[0..31], + DataIsDirectory set_DataIsDirectory[31..32], +]); +pub type PIMAGE_RESOURCE_DIRECTORY_ENTRY = *mut IMAGE_RESOURCE_DIRECTORY_ENTRY; +STRUCT!{struct IMAGE_RESOURCE_DIRECTORY_STRING { + Length: WORD, + NameString: [CHAR; 1], +}} +pub type PIMAGE_RESOURCE_DIRECTORY_STRING = *mut IMAGE_RESOURCE_DIRECTORY_STRING; +STRUCT!{struct IMAGE_RESOURCE_DIR_STRING_U { + Length: WORD, + NameString: [WCHAR; 1], +}} +pub type PIMAGE_RESOURCE_DIR_STRING_U = *mut IMAGE_RESOURCE_DIR_STRING_U; +STRUCT!{struct IMAGE_RESOURCE_DATA_ENTRY { + OffsetToData: DWORD, + Size: DWORD, + CodePage: DWORD, + Reserved: DWORD, +}} +pub type PIMAGE_RESOURCE_DATA_ENTRY = *mut IMAGE_RESOURCE_DATA_ENTRY; +STRUCT!{struct IMAGE_LOAD_CONFIG_CODE_INTEGRITY { + Flags: WORD, + Catalog: WORD, + CatalogOffset: DWORD, + Reserved: DWORD, +}} +pub type PIMAGE_LOAD_CONFIG_CODE_INTEGRITY = *mut IMAGE_LOAD_CONFIG_CODE_INTEGRITY; +STRUCT!{struct IMAGE_DYNAMIC_RELOCATION_TABLE { + Version: DWORD, + Size: DWORD, +}} +pub type PIMAGE_DYNAMIC_RELOCATION_TABLE = *mut IMAGE_DYNAMIC_RELOCATION_TABLE; +STRUCT!{struct IMAGE_DYNAMIC_RELOCATION32 { + Symbol: DWORD, + BaseRelocSize: DWORD, +}} +pub type PIMAGE_DYNAMIC_RELOCATION32 = *mut IMAGE_DYNAMIC_RELOCATION32; +STRUCT!{struct IMAGE_DYNAMIC_RELOCATION64 { + Symbol: ULONGLONG, + BaseRelocSize: DWORD, +}} +pub type PIMAGE_DYNAMIC_RELOCATION64 = *mut IMAGE_DYNAMIC_RELOCATION64; +STRUCT!{struct IMAGE_DYNAMIC_RELOCATION32_V2 { + HeaderSize: DWORD, + FixupInfoSize: DWORD, + Symbol: DWORD, + SymbolGroup: DWORD, + Flags: DWORD, +}} +pub type PIMAGE_DYNAMIC_RELOCATION32_V2 = *mut IMAGE_DYNAMIC_RELOCATION32_V2; +STRUCT!{struct IMAGE_DYNAMIC_RELOCATION64_V2 { + HeaderSize: DWORD, + FixupInfoSize: DWORD, + Symbol: ULONGLONG, + SymbolGroup: DWORD, + Flags: DWORD, +}} +pub type PIMAGE_DYNAMIC_RELOCATION64_V2 = *mut IMAGE_DYNAMIC_RELOCATION64_V2; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub type IMAGE_DYNAMIC_RELOCATION = IMAGE_DYNAMIC_RELOCATION64; +pub type PIMAGE_DYNAMIC_RELOCATION = PIMAGE_DYNAMIC_RELOCATION64; +pub type IMAGE_DYNAMIC_RELOCATION_V2 = IMAGE_DYNAMIC_RELOCATION64_V2; +pub type PIMAGE_DYNAMIC_RELOCATION_V2 = PIMAGE_DYNAMIC_RELOCATION64_V2; +} +#[cfg(target_arch = "x86")] +IFDEF!{ +pub type IMAGE_DYNAMIC_RELOCATION = IMAGE_DYNAMIC_RELOCATION32; +pub type PIMAGE_DYNAMIC_RELOCATION = PIMAGE_DYNAMIC_RELOCATION32; +pub type IMAGE_DYNAMIC_RELOCATION_V2 = IMAGE_DYNAMIC_RELOCATION32_V2; +pub type PIMAGE_DYNAMIC_RELOCATION_V2 = PIMAGE_DYNAMIC_RELOCATION32_V2; +} +pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_PROLOGUE: DWORD = 0x00000001; +pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_EPILOGUE: DWORD = 0x00000002; +STRUCT!{struct IMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER { + PrologueByteCount: BYTE, +}} +pub type PIMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER = *mut IMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER; +STRUCT!{struct IMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER { + EpilogueCount: DWORD, + EpilogueByteCount: BYTE, + BranchDescriptorElementSize: BYTE, + BranchDescriptorCount: WORD, +}} +pub type PIMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER = *mut IMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER; +STRUCT!{struct IMAGE_LOAD_CONFIG_DIRECTORY32 { + Size: DWORD, + TimeDateStamp: DWORD, + MajorVersion: WORD, + MinorVersion: WORD, + GlobalFlagsClear: DWORD, + GlobalFlagsSet: DWORD, + CriticalSectionDefaultTimeout: DWORD, + DeCommitFreeBlockThreshold: DWORD, + DeCommitTotalFreeThreshold: DWORD, + LockPrefixTable: DWORD, + MaximumAllocationSize: DWORD, + VirtualMemoryThreshold: DWORD, + ProcessHeapFlags: DWORD, + ProcessAffinityMask: DWORD, + CSDVersion: WORD, + DependentLoadFlags: WORD, + EditList: DWORD, + SecurityCookie: DWORD, + SEHandlerTable: DWORD, + SEHandlerCount: DWORD, + GuardCFCheckFunctionPointer: DWORD, + GuardCFDispatchFunctionPointer: DWORD, + GuardCFFunctionTable: DWORD, + GuardCFFunctionCount: DWORD, + GuardFlags: DWORD, + CodeIntegrity: IMAGE_LOAD_CONFIG_CODE_INTEGRITY, + GuardAddressTakenIatEntryTable: DWORD, + GuardAddressTakenIatEntryCount: DWORD, + GuardLongJumpTargetTable: DWORD, + GuardLongJumpTargetCount: DWORD, + DynamicValueRelocTable: DWORD, + CHPEMetadataPointer: DWORD, + GuardRFFailureRoutine: DWORD, + GuardRFFailureRoutineFunctionPointer: DWORD, + DynamicValueRelocTableOffset: DWORD, + DynamicValueRelocTableSection: WORD, + Reserved2: WORD, + GuardRFVerifyStackPointerFunctionPointer: DWORD, + HotPatchTableOffset: DWORD, +}} +pub type PIMAGE_LOAD_CONFIG_DIRECTORY32 = *mut IMAGE_LOAD_CONFIG_DIRECTORY32; +STRUCT!{struct IMAGE_LOAD_CONFIG_DIRECTORY64 { + Size: DWORD, + TimeDateStamp: DWORD, + MajorVersion: WORD, + MinorVersion: WORD, + GlobalFlagsClear: DWORD, + GlobalFlagsSet: DWORD, + CriticalSectionDefaultTimeout: DWORD, + DeCommitFreeBlockThreshold: ULONGLONG, + DeCommitTotalFreeThreshold: ULONGLONG, + LockPrefixTable: ULONGLONG, + MaximumAllocationSize: ULONGLONG, + VirtualMemoryThreshold: ULONGLONG, + ProcessAffinityMask: ULONGLONG, + ProcessHeapFlags: DWORD, + CSDVersion: WORD, + DependentLoadFlags: WORD, + EditList: ULONGLONG, + SecurityCookie: ULONGLONG, + SEHandlerTable: ULONGLONG, + SEHandlerCount: ULONGLONG, + GuardCFCheckFunctionPointer: ULONGLONG, + GuardCFDispatchFunctionPointer: ULONGLONG, + GuardCFFunctionTable: ULONGLONG, + GuardCFFunctionCount: ULONGLONG, + GuardFlags: DWORD, + CodeIntegrity: IMAGE_LOAD_CONFIG_CODE_INTEGRITY, + GuardAddressTakenIatEntryTable: ULONGLONG, + GuardAddressTakenIatEntryCount: ULONGLONG, + GuardLongJumpTargetTable: ULONGLONG, + GuardLongJumpTargetCount: ULONGLONG, + DynamicValueRelocTable: ULONGLONG, + CHPEMetadataPointer: ULONGLONG, + GuardRFFailureRoutine: ULONGLONG, + GuardRFFailureRoutineFunctionPointer: ULONGLONG, + DynamicValueRelocTableOffset: DWORD, + DynamicValueRelocTableSection: WORD, + Reserved2: WORD, + GuardRFVerifyStackPointerFunctionPointer: ULONGLONG, + HotPatchTableOffset: DWORD, +}} +pub type PIMAGE_LOAD_CONFIG_DIRECTORY64 = *mut IMAGE_LOAD_CONFIG_DIRECTORY64; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +pub type IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY64; +pub type PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY64; +} +#[cfg(target_arch = "x86")] +IFDEF!{ +pub type IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY32; +pub type PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY32; +} +STRUCT!{struct IMAGE_HOT_PATCH_INFO { + Version: DWORD, + Size: DWORD, + SequenceNumber: DWORD, + BaseImageList: DWORD, + BaseImageCount: DWORD, +}} +pub type PIMAGE_HOT_PATCH_INFO = *mut IMAGE_HOT_PATCH_INFO; +STRUCT!{struct IMAGE_HOT_PATCH_BASE { + SequenceNumber: DWORD, + Flags: DWORD, + OriginalTimeDateStamp: DWORD, + OriginalCheckSum: DWORD, + CodeIntegrityInfo: DWORD, + CodeIntegritySize: DWORD, + PatchTable: DWORD, +}} +pub type PIMAGE_HOT_PATCH_BASE = *mut IMAGE_HOT_PATCH_BASE; +STRUCT!{struct IMAGE_HOT_PATCH_HASHES { + SHA256: [BYTE; 32], + SHA1: [BYTE; 20], +}} +pub type PIMAGE_HOT_PATCH_HASHES = *mut IMAGE_HOT_PATCH_HASHES; +pub const IMAGE_HOT_PATCH_BASE_OBLIGATORY: DWORD = 0x00000001; +pub const IMAGE_HOT_PATCH_CHUNK_INVERSE: DWORD = 0x80000000; +pub const IMAGE_HOT_PATCH_CHUNK_OBLIGATORY: DWORD = 0x40000000; +pub const IMAGE_HOT_PATCH_CHUNK_RESERVED: DWORD = 0x3FF03000; +pub const IMAGE_HOT_PATCH_CHUNK_TYPE: DWORD = 0x000FC000; +pub const IMAGE_HOT_PATCH_CHUNK_SOURCE_RVA: DWORD = 0x00008000; +pub const IMAGE_HOT_PATCH_CHUNK_TARGET_RVA: DWORD = 0x00004000; +pub const IMAGE_HOT_PATCH_CHUNK_SIZE: DWORD = 0x00000FFF; +pub const IMAGE_HOT_PATCH_NONE: DWORD = 0x00000000; +pub const IMAGE_HOT_PATCH_FUNCTION: DWORD = 0x0001C000; +pub const IMAGE_HOT_PATCH_ABSOLUTE: DWORD = 0x0002C000; +pub const IMAGE_HOT_PATCH_REL32: DWORD = 0x0003C000; +pub const IMAGE_HOT_PATCH_CALL_TARGET: DWORD = 0x00044000; +pub const IMAGE_HOT_PATCH_INDIRECT: DWORD = 0x0005C000; +pub const IMAGE_HOT_PATCH_NO_CALL_TARGET: DWORD = 0x00064000; +pub const IMAGE_HOT_PATCH_DYNAMIC_VALUE: DWORD = 0x00078000; +pub const IMAGE_GUARD_CF_INSTRUMENTED: DWORD = 0x00000100; +pub const IMAGE_GUARD_CFW_INSTRUMENTED: DWORD = 0x00000200; +pub const IMAGE_GUARD_CF_FUNCTION_TABLE_PRESENT: DWORD = 0x00000400; +pub const IMAGE_GUARD_SECURITY_COOKIE_UNUSED: DWORD = 0x00000800; +pub const IMAGE_GUARD_PROTECT_DELAYLOAD_IAT: DWORD = 0x00001000; +pub const IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION: DWORD = 0x00002000; +pub const IMAGE_GUARD_CF_EXPORT_SUPPRESSION_INFO_PRESENT: DWORD = 0x00004000; +pub const IMAGE_GUARD_CF_ENABLE_EXPORT_SUPPRESSION: DWORD = 0x00008000; +pub const IMAGE_GUARD_CF_LONGJUMP_TABLE_PRESENT: DWORD = 0x00010000; +pub const IMAGE_GUARD_RF_INSTRUMENTED: DWORD = 0x00020000; +pub const IMAGE_GUARD_RF_ENABLE: DWORD = 0x00040000; +pub const IMAGE_GUARD_RF_STRICT: DWORD = 0x00080000; +pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_MASK: DWORD = 0xF0000000; +pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_SHIFT: usize = 28; +pub const IMAGE_GUARD_FLAG_FID_SUPPRESSED: DWORD = 0x01; +pub const IMAGE_GUARD_FLAG_EXPORT_SUPPRESSED: DWORD = 0x02; +STRUCT!{struct IMAGE_CE_RUNTIME_FUNCTION_ENTRY { + FuncStart: DWORD, + BitFields: DWORD, +}} +BITFIELD!(IMAGE_CE_RUNTIME_FUNCTION_ENTRY BitFields: DWORD [ + PrologLen set_PrologLen[0..8], + FuncLen set_FuncLen[8..30], + ThirtyTwoBit set_ThirtyTwoBit[30..31], + ExceptionFlag set_ExceptionFlag[31..32], +]); +pub type PIMAGE_CE_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_CE_RUNTIME_FUNCTION_ENTRY; +STRUCT!{struct IMAGE_ARM_RUNTIME_FUNCTION_ENTRY { + BeginAddress: DWORD, + UnwindData: DWORD, +}} +BITFIELD!(IMAGE_ARM_RUNTIME_FUNCTION_ENTRY UnwindData: DWORD [ + Flag set_Flag[0..2], + FunctionLength set_FunctionLength[2..13], + Ret set_Ret[13..15], + H set_H[15..16], + Reg set_Reg[16..19], + R set_R[19..20], + L set_L[20..21], + C set_c[21..22], + StackAdjust set_StackAdjust[22..32], +]); +pub type PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ARM_RUNTIME_FUNCTION_ENTRY; +STRUCT!{struct IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY { + BeginAddress: DWORD, + UnwindData: DWORD, +}} +BITFIELD!(IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY UnwindData: DWORD [ + Flag set_Flag[0..2], + FunctionLength set_FunctionLength[2..13], + RegF set_RegF[13..16], + RegI set_RegI[16..20], + H set_H[20..21], + CR set_cR[21..23], + FrameSize set_FrameSize[23..32], +]); +pub type PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY; +STRUCT!{struct IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY { + BeginAddress: ULONGLONG, + EndAddress: ULONGLONG, + ExceptionHandler: ULONGLONG, + HandlerData: ULONGLONG, + PrologEndAddress: ULONGLONG, +}} +pub type PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY; +STRUCT!{struct IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY { + BeginAddress: DWORD, + EndAddress: DWORD, + ExceptionHandler: DWORD, + HandlerData: DWORD, + PrologEndAddress: DWORD, +}} +pub type PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY; +UNION!{union IMAGE_RUNTIME_FUNCTION_ENTRY_u { + [u32; 1], + UnwindInfoAddress UnwindInfoAddress_mut: DWORD, + UnwindData UnwindData_mut: DWORD, +}} +STRUCT!{struct IMAGE_RUNTIME_FUNCTION_ENTRY { + BeginAddress: DWORD, + EndAddress: DWORD, + u: IMAGE_RUNTIME_FUNCTION_ENTRY_u, +}} +pub type PIMAGE_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_RUNTIME_FUNCTION_ENTRY; +pub type IMAGE_IA64_RUNTIME_FUNCTION_ENTRY = IMAGE_RUNTIME_FUNCTION_ENTRY; +pub type PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY = PIMAGE_RUNTIME_FUNCTION_ENTRY; +STRUCT!{struct IMAGE_DEBUG_DIRECTORY { + Characteristics: DWORD, + TimeDateStamp: DWORD, + MajorVersion: WORD, + MinorVersion: WORD, + Type: DWORD, + SizeOfData: DWORD, + AddressOfRawData: DWORD, + PointerToRawData: DWORD, +}} +pub type PIMAGE_DEBUG_DIRECTORY = *mut IMAGE_DEBUG_DIRECTORY; +pub const IMAGE_DEBUG_TYPE_UNKNOWN: DWORD = 0; +pub const IMAGE_DEBUG_TYPE_COFF: DWORD = 1; +pub const IMAGE_DEBUG_TYPE_CODEVIEW: DWORD = 2; +pub const IMAGE_DEBUG_TYPE_FPO: DWORD = 3; +pub const IMAGE_DEBUG_TYPE_MISC: DWORD = 4; +pub const IMAGE_DEBUG_TYPE_EXCEPTION: DWORD = 5; +pub const IMAGE_DEBUG_TYPE_FIXUP: DWORD = 6; +pub const IMAGE_DEBUG_TYPE_OMAP_TO_SRC: DWORD = 7; +pub const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: DWORD = 8; +pub const IMAGE_DEBUG_TYPE_BORLAND: DWORD = 9; +pub const IMAGE_DEBUG_TYPE_RESERVED10: DWORD = 10; +pub const IMAGE_DEBUG_TYPE_CLSID: DWORD = 11; +pub const IMAGE_DEBUG_TYPE_VC_FEATURE: DWORD = 12; +pub const IMAGE_DEBUG_TYPE_POGO: DWORD = 13; +pub const IMAGE_DEBUG_TYPE_ILTCG: DWORD = 14; +pub const IMAGE_DEBUG_TYPE_MPX: DWORD = 15; +pub const IMAGE_DEBUG_TYPE_REPRO: DWORD = 16; +STRUCT!{struct IMAGE_COFF_SYMBOLS_HEADER { + NumberOfSymbols: DWORD, + LvaToFirstSymbol: DWORD, + NumberOfLinenumbers: DWORD, + LvaToFirstLinenumber: DWORD, + RvaToFirstByteOfCode: DWORD, + RvaToLastByteOfCode: DWORD, + RvaToFirstByteOfData: DWORD, + RvaToLastByteOfData: DWORD, +}} +pub type PIMAGE_COFF_SYMBOLS_HEADER = *mut IMAGE_COFF_SYMBOLS_HEADER; +pub const FRAME_FPO: WORD = 0; +pub const FRAME_TRAP: WORD = 1; +pub const FRAME_TSS: WORD = 2; +pub const FRAME_NONFPO: WORD = 3; +STRUCT!{struct FPO_DATA { + ulOffStart: DWORD, + cbProcSize: DWORD, + cdwLocals: DWORD, + cdwParams: WORD, + BitFields: WORD, +}} +BITFIELD!(FPO_DATA BitFields: WORD [ + cbProlog set_cbProlog[0..8], + cbRegs set_cbRegs[8..11], + fHasSEH set_fHasSEH[11..12], + fUseBP set_fUseBP[12..13], + reserved set_reserved[13..14], + cbFrame set_cbFrame[14..16], +]); +pub type PFPO_DATA = *mut FPO_DATA; +pub const SIZEOF_RFPO_DATA: usize = 16; +pub const IMAGE_DEBUG_MISC_EXENAME: DWORD = 1; +STRUCT!{struct IMAGE_DEBUG_MISC { + DataType: DWORD, + Length: DWORD, + Unicode: BOOLEAN, + Reserved: [BYTE; 3], + Data: [BYTE; 1], +}} +pub type PIMAGE_DEBUG_MISC = *mut IMAGE_DEBUG_MISC; +STRUCT!{struct IMAGE_FUNCTION_ENTRY { + StartingAddress: DWORD, + EndingAddress: DWORD, + EndOfPrologue: DWORD, +}} +pub type PIMAGE_FUNCTION_ENTRY = *mut IMAGE_FUNCTION_ENTRY; +UNION!{union IMAGE_FUNCTION_ENTRY64_u { + [u64; 1], + EndOfPrologue EndOfPrologue_mut: ULONGLONG, + UnwindInfoAddress UnwindInfoAddress_mut: ULONGLONG, +}} +STRUCT!{struct IMAGE_FUNCTION_ENTRY64 { + StartingAddress: ULONGLONG, + EndingAddress: ULONGLONG, + u: IMAGE_FUNCTION_ENTRY64_u, +}} +pub type PIMAGE_FUNCTION_ENTRY64 = *mut IMAGE_FUNCTION_ENTRY64; +STRUCT!{struct IMAGE_SEPARATE_DEBUG_HEADER { + Signature: WORD, + Flags: WORD, + Machine: WORD, + Characteristics: WORD, + TimeDateStamp: DWORD, + CheckSum: DWORD, + ImageBase: DWORD, + SizeOfImage: DWORD, + NumberOfSections: DWORD, + ExportedNamesSize: DWORD, + DebugDirectorySize: DWORD, + SectionAlignment: DWORD, + Reserved: [DWORD; 2], +}} +pub type PIMAGE_SEPARATE_DEBUG_HEADER = *mut IMAGE_SEPARATE_DEBUG_HEADER; +STRUCT!{struct NON_PAGED_DEBUG_INFO { + Signature: WORD, + Flags: WORD, + Size: DWORD, + Machine: WORD, + Characteristics: WORD, + TimeDateStamp: DWORD, + CheckSum: DWORD, + SizeOfImage: DWORD, + ImageBase: ULONGLONG, +}} +pub type PNON_PAGED_DEBUG_INFO = *mut NON_PAGED_DEBUG_INFO; +pub const IMAGE_SEPARATE_DEBUG_SIGNATURE: WORD = 0x4944; +pub const NON_PAGED_DEBUG_SIGNATURE: WORD = 0x494E; +pub const IMAGE_SEPARATE_DEBUG_FLAGS_MASK: WORD = 0x8000; +pub const IMAGE_SEPARATE_DEBUG_MISMATCH: WORD = 0x8000; +STRUCT!{struct IMAGE_ARCHITECTURE_HEADER { + BitFields: c_uint, + FirstEntryRVA: DWORD, +}} +BITFIELD!(IMAGE_ARCHITECTURE_HEADER BitFields: c_uint [ + AmaskValue set_AmaskValue[0..1], + unused1 set_unused1[1..8], + AmaskShift set_AmaskShift[8..16], + unused2 set_unused2[8..32], +]); +pub type PIMAGE_ARCHITECTURE_HEADER = *mut IMAGE_ARCHITECTURE_HEADER; +STRUCT!{struct IMAGE_ARCHITECTURE_ENTRY { + FixupInstRVA: DWORD, + NewInst: DWORD, +}} +pub type PIMAGE_ARCHITECTURE_ENTRY = *mut IMAGE_ARCHITECTURE_ENTRY; +pub const IMPORT_OBJECT_HDR_SIG2: WORD = 0xffff; +UNION!{union IMPORT_OBJECT_HEADER_u { + [u16; 1], + Ordinal Ordinal_mut: WORD, + Hint Hint_mut: WORD, +}} +STRUCT!{struct IMPORT_OBJECT_HEADER { + Sig1: WORD, + Sig2: WORD, + Version: WORD, + Machine: WORD, + TimeDateStamp: DWORD, + SizeOfData: DWORD, + u: IMPORT_OBJECT_HEADER_u, + BitFields: WORD, +}} +BITFIELD!(IMPORT_OBJECT_HEADER BitFields: WORD [ + Type set_Type[0..2], + NameType set_NameType[2..5], + Reserved set_Reserved[5..16], +]); +ENUM!{enum IMPORT_OBJECT_TYPE { + IMPORT_OBJECT_CODE = 0, + IMPORT_OBJECT_DATA = 1, + IMPORT_OBJECT_CONST = 2, +}} +ENUM!{enum IMPORT_OBJECT_NAME_TYPE { + IMPORT_OBJECT_ORDINAL = 0, + IMPORT_OBJECT_NAME = 1, + IMPORT_OBJECT_NAME_NO_PREFIX = 2, + IMPORT_OBJECT_NAME_UNDECORATE = 3, + IMPORT_OBJECT_NAME_EXPORTAS = 4, +}} +ENUM!{enum ReplacesCorHdrNumericDefines { + COMIMAGE_FLAGS_ILONLY = 0x00000001, + COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002, + COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004, + COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008, + COMIMAGE_FLAGS_NATIVE_ENTRYPOINT = 0x00000010, + COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000, + COMIMAGE_FLAGS_32BITPREFERRED = 0x00020000, + COR_VERSION_MAJOR_V2 = 2, + COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2, + COR_VERSION_MINOR = 5, + COR_DELETED_NAME_LENGTH = 8, + COR_VTABLEGAP_NAME_LENGTH = 8, + NATIVE_TYPE_MAX_CB = 1, + COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE= 0xFF, + IMAGE_COR_MIH_METHODRVA = 0x01, + IMAGE_COR_MIH_EHRVA = 0x02, + IMAGE_COR_MIH_BASICBLOCK = 0x08, + COR_VTABLE_32BIT = 0x01, + COR_VTABLE_64BIT = 0x02, + COR_VTABLE_FROM_UNMANAGED = 0x04, + COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN = 0x08, + COR_VTABLE_CALL_MOST_DERIVED = 0x10, + IMAGE_COR_EATJ_THUNK_SIZE = 32, + MAX_CLASS_NAME = 1024, + MAX_PACKAGE_NAME = 1024, +}} +UNION!{union IMAGE_COR20_HEADER_u { + [u32; 1], + EntryPointToken EntryPointToken_mut: DWORD, + EntryPointRVA EntryPointRVA_mut: DWORD, +}} +STRUCT!{struct IMAGE_COR20_HEADER { + cb: DWORD, + MajorRuntimeVersion: WORD, + MinorRuntimeVersion: WORD, + MetaData: IMAGE_DATA_DIRECTORY, + Flags: DWORD, + u: IMAGE_COR20_HEADER_u, + Resources: IMAGE_DATA_DIRECTORY, + StrongNameSignature: IMAGE_DATA_DIRECTORY, + CodeManagerTable: IMAGE_DATA_DIRECTORY, + VTableFixups: IMAGE_DATA_DIRECTORY, + ExportAddressTableJumps: IMAGE_DATA_DIRECTORY, + ManagedNativeHeader: IMAGE_DATA_DIRECTORY, +}} +pub type PIMAGE_COR20_HEADER = *mut IMAGE_COR20_HEADER; +extern "system" { + pub fn RtlCaptureStackBackTrace( + FramesToSkip: DWORD, + FramesToCapture: DWORD, + BackTrace: *mut PVOID, + BackTraceHash: PDWORD, + ) -> WORD; + pub fn RtlCaptureContext( + ContextRecord: PCONTEXT, + ); + pub fn RtlUnwind( + TargetFrame: PVOID, + TargetIp: PVOID, + ExceptionRecord: PEXCEPTION_RECORD, + ReturnValue: PVOID, + ); +} +#[cfg(target_arch = "x86_64")] +extern "system" { + pub fn RtlAddFunctionTable( + FunctionTable: PRUNTIME_FUNCTION, + EntryCount: DWORD, + BaseAddress: DWORD64, + ) -> BOOLEAN; + pub fn RtlDeleteFunctionTable( + FunctionTable: PRUNTIME_FUNCTION, + ) -> BOOLEAN; + pub fn RtlInstallFunctionTableCallback( + TableIdentifier: DWORD64, + BaseAddress: DWORD64, + Length: DWORD, + Callback: PGET_RUNTIME_FUNCTION_CALLBACK, + Context: PVOID, + OutOfProcessCallbackDll: PCWSTR, + ) -> BOOLEAN; + pub fn RtlAddGrowableFunctionTable( + DynamicTable: *mut PVOID, + FunctionTable: PRUNTIME_FUNCTION, + EntryCount: DWORD, + MaximumEntryCount: DWORD, + RangeBase: ULONG_PTR, + RangeEnd: ULONG_PTR, + ) -> DWORD; + pub fn RtlGrowFunctionTable( + DynamicTable: PVOID, + NewEntryCount: DWORD, + ); + pub fn RtlDeleteGrowableFunctionTable( + DynamicTable: PVOID, + ); + pub fn RtlLookupFunctionEntry( + ControlPc: DWORD64, + ImageBase: PDWORD64, + HistoryTable: PUNWIND_HISTORY_TABLE, + ) -> PRUNTIME_FUNCTION; +} +#[cfg(target_arch = "x86_64")] +IFDEF!{ +extern "C" { + pub fn RtlRestoreContext( + ContextRecord: PCONTEXT, + ExceptionRecord: *mut EXCEPTION_RECORD, + ); +} +extern "system" { + pub fn RtlUnwindEx( + TargetFrame: PVOID, + TargetIp: PVOID, + ExceptionRecord: PEXCEPTION_RECORD, + ReturnValue: PVOID, + ContextRecord: PCONTEXT, + HistoryTable: PUNWIND_HISTORY_TABLE, + ); + pub fn RtlVirtualUnwind( + HandlerType: DWORD, + ImageBase: DWORD64, + ControlPc: DWORD64, + FunctionEntry: PRUNTIME_FUNCTION, + ContextRecord: PCONTEXT, + HandlerData: *mut PVOID, + EstablisherFrame: PDWORD64, + ContextPointers: PKNONVOLATILE_CONTEXT_POINTERS, + ) -> PEXCEPTION_ROUTINE; +} +} +extern "system" { + pub fn RtlPcToFileHeader( + PcValue: PVOID, + BaseOfImage: *mut PVOID, + ) -> PVOID; + pub fn RtlCompareMemory( + Source1: *const VOID, + Source2: *const VOID, + Length: SIZE_T, + ) -> SIZE_T; +} +STRUCT!{struct SLIST_ENTRY { + Next: *mut SLIST_ENTRY, +}} +pub type PSLIST_ENTRY = *mut SLIST_ENTRY; +#[cfg(target_arch = "x86_64")] +IFDEF!{ +UNION!{union SLIST_HEADER_u { + [u64; 1], + Alignment Alignment_mut: ULONGLONG, + Region Region_mut: ULONGLONG, +}} +STRUCT!{struct SLIST_HEADER_HeaderX64 { + BitFields1: ULONGLONG, + BitFields2: ULONGLONG, +}} +BITFIELD!(SLIST_HEADER_HeaderX64 BitFields1: ULONGLONG [ + Depth set_Depth[0..16], + Sequence set_Sequence[16..64], +]); +BITFIELD!(SLIST_HEADER_HeaderX64 BitFields2: ULONGLONG [ + Reserved set_Reserved[0..4], + NextEntry set_NextEntry[4..64], +]); +STRUCT!{struct SLIST_HEADER { + u: SLIST_HEADER_u, + HeaderX64: SLIST_HEADER_HeaderX64, +}} +pub type PSLIST_HEADER = *mut SLIST_HEADER; +} +#[cfg(target_arch = "x86")] +IFDEF!{ +STRUCT!{struct SLIST_HEADER_s { + Next: SLIST_ENTRY, + Depth: WORD, + Reserved: WORD, +}} +STRUCT!{struct SLIST_HEADER { + Alignment: ULONGLONG, + s: SLIST_HEADER_s, +}} +pub type PSLIST_HEADER = *mut SLIST_HEADER; +} +extern "system" { + pub fn RtlInitializeSListHead( + ListHead: PSLIST_HEADER, + ); + pub fn RtlFirstEntrySList( + ListHead: *const SLIST_HEADER, + ) -> PSLIST_ENTRY; + pub fn RtlInterlockedPopEntrySList( + ListHead: PSLIST_HEADER, + ) -> PSLIST_ENTRY; + pub fn RtlInterlockedPushEntrySList( + ListHead: PSLIST_HEADER, + ListEntry: PSLIST_ENTRY, + ) -> PSLIST_ENTRY; + pub fn RtlInterlockedPushListSListEx( + ListHead: PSLIST_HEADER, + ListEntry: PSLIST_ENTRY, + ListEnd: PSLIST_ENTRY, + Count: DWORD, + ) -> PSLIST_ENTRY; + pub fn RtlInterlockedFlushSList( + ListHead: PSLIST_HEADER, + ) -> PSLIST_ENTRY; + pub fn RtlQueryDepthSList( + ListHead: PSLIST_HEADER, + ) -> WORD; +} +pub const RTL_RUN_ONCE_INIT: RTL_RUN_ONCE = RTL_RUN_ONCE { Ptr: 0 as PVOID }; +pub const RTL_RUN_ONCE_CHECK_ONLY: ULONG = 0x00000001; +pub const RTL_RUN_ONCE_ASYNC: ULONG = 0x00000002; +pub const RTL_RUN_ONCE_INIT_FAILED: ULONG = 0x00000004; +STRUCT!{struct RTL_RUN_ONCE { + Ptr: PVOID, +}} +pub type PRTL_RUN_ONCE = *mut RTL_RUN_ONCE; +STRUCT!{struct RTL_BARRIER { + Reserved1: DWORD, + Reserved2: DWORD, + Reserved3: [ULONG_PTR; 2], + Reserved4: DWORD, + Reserved5: DWORD, +}} +pub type PRTL_BARRIER = *mut RTL_BARRIER; +pub const FAST_FAIL_LEGACY_GS_VIOLATION: c_uint = 0; +pub const FAST_FAIL_VTGUARD_CHECK_FAILURE: c_uint = 1; +pub const FAST_FAIL_STACK_COOKIE_CHECK_FAILURE: c_uint = 2; +pub const FAST_FAIL_CORRUPT_LIST_ENTRY: c_uint = 3; +pub const FAST_FAIL_INCORRECT_STACK: c_uint = 4; +pub const FAST_FAIL_INVALID_ARG: c_uint = 5; +pub const FAST_FAIL_GS_COOKIE_INIT: c_uint = 6; +pub const FAST_FAIL_FATAL_APP_EXIT: c_uint = 7; +pub const FAST_FAIL_RANGE_CHECK_FAILURE: c_uint = 8; +pub const FAST_FAIL_UNSAFE_REGISTRY_ACCESS: c_uint = 9; +pub const FAST_FAIL_GUARD_ICALL_CHECK_FAILURE: c_uint = 10; +pub const FAST_FAIL_GUARD_WRITE_CHECK_FAILURE: c_uint = 11; +pub const FAST_FAIL_INVALID_FIBER_SWITCH: c_uint = 12; +pub const FAST_FAIL_INVALID_SET_OF_CONTEXT: c_uint = 13; +pub const FAST_FAIL_INVALID_REFERENCE_COUNT: c_uint = 14; +pub const FAST_FAIL_INVALID_JUMP_BUFFER: c_uint = 18; +pub const FAST_FAIL_MRDATA_MODIFIED: c_uint = 19; +pub const FAST_FAIL_CERTIFICATION_FAILURE: c_uint = 20; +pub const FAST_FAIL_INVALID_EXCEPTION_CHAIN: c_uint = 21; +pub const FAST_FAIL_CRYPTO_LIBRARY: c_uint = 22; +pub const FAST_FAIL_INVALID_CALL_IN_DLL_CALLOUT: c_uint = 23; +pub const FAST_FAIL_INVALID_IMAGE_BASE: c_uint = 24; +pub const FAST_FAIL_DLOAD_PROTECTION_FAILURE: c_uint = 25; +pub const FAST_FAIL_UNSAFE_EXTENSION_CALL: c_uint = 26; +pub const FAST_FAIL_DEPRECATED_SERVICE_INVOKED: c_uint = 27; +pub const FAST_FAIL_INVALID_BUFFER_ACCESS: c_uint = 28; +pub const FAST_FAIL_INVALID_BALANCED_TREE: c_uint = 29; +pub const FAST_FAIL_INVALID_NEXT_THREAD: c_uint = 30; +pub const FAST_FAIL_GUARD_ICALL_CHECK_SUPPRESSED: c_uint = 31; +pub const FAST_FAIL_APCS_DISABLED: c_uint = 32; +pub const FAST_FAIL_INVALID_IDLE_STATE: c_uint = 33; +pub const FAST_FAIL_MRDATA_PROTECTION_FAILURE: c_uint = 34; +pub const FAST_FAIL_UNEXPECTED_HEAP_EXCEPTION: c_uint = 35; +pub const FAST_FAIL_INVALID_LOCK_STATE: c_uint = 36; +pub const FAST_FAIL_GUARD_JUMPTABLE: c_uint = 37; +pub const FAST_FAIL_INVALID_LONGJUMP_TARGET: c_uint = 38; +pub const FAST_FAIL_INVALID_DISPATCH_CONTEXT: c_uint = 39; +pub const FAST_FAIL_INVALID_THREAD: c_uint = 40; +pub const FAST_FAIL_INVALID_SYSCALL_NUMBER: c_uint = 41; +pub const FAST_FAIL_INVALID_FILE_OPERATION: c_uint = 42; +pub const FAST_FAIL_LPAC_ACCESS_DENIED: c_uint = 43; +pub const FAST_FAIL_GUARD_SS_FAILURE: c_uint = 44; +pub const FAST_FAIL_LOADER_CONTINUITY_FAILURE: c_uint = 45; +pub const FAST_FAIL_GUARD_EXPORT_SUPPRESSION_FAILURE: c_uint = 46; +pub const FAST_FAIL_INVALID_CONTROL_STACK: c_uint = 47; +pub const FAST_FAIL_SET_CONTEXT_DENIED: c_uint = 48; +pub const FAST_FAIL_INVALID_FAST_FAIL_CODE: c_uint = 0xFFFFFFFF; +pub const HEAP_NO_SERIALIZE: DWORD = 0x00000001; +pub const HEAP_GROWABLE: DWORD = 0x00000002; +pub const HEAP_GENERATE_EXCEPTIONS: DWORD = 0x00000004; +pub const HEAP_ZERO_MEMORY: DWORD = 0x00000008; +pub const HEAP_REALLOC_IN_PLACE_ONLY: DWORD = 0x00000010; +pub const HEAP_TAIL_CHECKING_ENABLED: DWORD = 0x00000020; +pub const HEAP_FREE_CHECKING_ENABLED: DWORD = 0x00000040; +pub const HEAP_DISABLE_COALESCE_ON_FREE: DWORD = 0x00000080; +pub const HEAP_CREATE_ALIGN_16: DWORD = 0x00010000; +pub const HEAP_CREATE_ENABLE_TRACING: DWORD = 0x00020000; +pub const HEAP_CREATE_ENABLE_EXECUTE: DWORD = 0x00040000; +pub const HEAP_MAXIMUM_TAG: DWORD = 0x0FFF; +pub const HEAP_PSEUDO_TAG_FLAG: DWORD = 0x8000; +pub const HEAP_TAG_SHIFT: usize = 18; +pub const HEAP_CREATE_SEGMENT_HEAP: DWORD = 0x00000100; +pub const HEAP_CREATE_HARDENED: DWORD = 0x00000200; +#[inline] +pub fn HEAP_MAKE_TAG_FLAGS(TagBase: DWORD, Tag: DWORD) -> DWORD { + TagBase + (Tag << HEAP_TAG_SHIFT) +} +pub const IS_TEXT_UNICODE_ASCII16: INT = 0x0001; +pub const IS_TEXT_UNICODE_REVERSE_ASCII16: INT = 0x0010; +pub const IS_TEXT_UNICODE_STATISTICS: INT = 0x0002; +pub const IS_TEXT_UNICODE_REVERSE_STATISTICS: INT = 0x0020; +pub const IS_TEXT_UNICODE_CONTROLS: INT = 0x0004; +pub const IS_TEXT_UNICODE_REVERSE_CONTROLS: INT = 0x0040; +pub const IS_TEXT_UNICODE_SIGNATURE: INT = 0x0008; +pub const IS_TEXT_UNICODE_REVERSE_SIGNATURE: INT = 0x0080; +pub const IS_TEXT_UNICODE_ILLEGAL_CHARS: INT = 0x0100; +pub const IS_TEXT_UNICODE_ODD_LENGTH: INT = 0x0200; +pub const IS_TEXT_UNICODE_DBCS_LEADBYTE: INT = 0x0400; +pub const IS_TEXT_UNICODE_NULL_BYTES: INT = 0x1000; +pub const IS_TEXT_UNICODE_UNICODE_MASK: INT = 0x000F; +pub const IS_TEXT_UNICODE_REVERSE_MASK: INT = 0x00F0; +pub const IS_TEXT_UNICODE_NOT_UNICODE_MASK: INT = 0x0F00; +pub const IS_TEXT_UNICODE_NOT_ASCII_MASK: INT = 0xF000; +pub const COMPRESSION_FORMAT_NONE: USHORT = 0x0000; +pub const COMPRESSION_FORMAT_DEFAULT: USHORT = 0x0001; +pub const COMPRESSION_FORMAT_LZNT1: USHORT = 0x0002; +pub const COMPRESSION_FORMAT_XPRESS: USHORT = 0x0003; +pub const COMPRESSION_FORMAT_XPRESS_HUFF: USHORT = 0x0004; +pub const COMPRESSION_ENGINE_STANDARD: USHORT = 0x0000; +pub const COMPRESSION_ENGINE_MAXIMUM: USHORT = 0x0100; +pub const COMPRESSION_ENGINE_HIBER: USHORT = 0x0200; +// RtlEqualMemory +#[inline] +pub unsafe fn RtlMoveMemory(Destination: *mut c_void, Source: *const c_void, Length: usize) { + use core::ptr::copy; + copy(Source as *const u8, Destination as *mut u8, Length); +} +#[inline] +pub unsafe fn RtlCopyMemory(Destination: *mut c_void, Source: *const c_void, Length: usize) { + use core::ptr::copy_nonoverlapping; + copy_nonoverlapping(Source as *const u8, Destination as *mut u8, Length); +} +#[inline] +pub unsafe fn RtlFillMemory(Destination: *mut c_void, Length: usize, Fill: u8) { + use core::ptr::write_bytes; + write_bytes(Destination as *mut u8, Fill, Length); +} +#[inline] +pub unsafe fn RtlZeroMemory(Destination: *mut c_void, Length: usize) { + use core::ptr::write_bytes; + write_bytes(Destination as *mut u8, 0, Length); +} +pub const SEF_DACL_AUTO_INHERIT: ULONG = 0x01; +pub const SEF_SACL_AUTO_INHERIT: ULONG = 0x02; +pub const SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT: ULONG = 0x04; +pub const SEF_AVOID_PRIVILEGE_CHECK: ULONG = 0x08; +pub const SEF_AVOID_OWNER_CHECK: ULONG = 0x10; +pub const SEF_DEFAULT_OWNER_FROM_PARENT: ULONG = 0x20; +pub const SEF_DEFAULT_GROUP_FROM_PARENT: ULONG = 0x40; +pub const SEF_MACL_NO_WRITE_UP: ULONG = 0x100; +pub const SEF_MACL_NO_READ_UP: ULONG = 0x200; +pub const SEF_MACL_NO_EXECUTE_UP: ULONG = 0x400; +pub const SEF_AI_USE_EXTRA_PARAMS: ULONG = 0x800; +pub const SEF_AVOID_OWNER_RESTRICTION: ULONG = 0x1000; +pub const SEF_MACL_VALID_FLAGS: ULONG = SEF_MACL_NO_WRITE_UP | SEF_MACL_NO_READ_UP + | SEF_MACL_NO_EXECUTE_UP; +STRUCT!{struct MESSAGE_RESOURCE_ENTRY { + Length: WORD, + Flags: WORD, + Text: [BYTE; 1], +}} +pub type PMESSAGE_RESOURCE_ENTRY = *mut MESSAGE_RESOURCE_ENTRY; +pub const MESSAGE_RESOURCE_UNICODE: WORD = 0x0001; +STRUCT!{struct MESSAGE_RESOURCE_BLOCK { + LowId: DWORD, + HighId: DWORD, + OffsetToEntries: DWORD, +}} +pub type PMESSAGE_RESOURCE_BLOCK = *mut MESSAGE_RESOURCE_BLOCK; +STRUCT!{struct MESSAGE_RESOURCE_DATA { + NumberOfBlocks: DWORD, + Blocks: [MESSAGE_RESOURCE_BLOCK; 1], +}} +pub type PMESSAGE_RESOURCE_DATA = *mut MESSAGE_RESOURCE_DATA; +STRUCT!{struct OSVERSIONINFOA { + dwOSVersionInfoSize: DWORD, + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, + dwBuildNumber: DWORD, + dwPlatformId: DWORD, + szCSDVersion: [CHAR; 128], +}} +pub type POSVERSIONINFOA = *mut OSVERSIONINFOA; +pub type LPOSVERSIONINFOA = *mut OSVERSIONINFOA; +STRUCT!{struct OSVERSIONINFOW { + dwOSVersionInfoSize: DWORD, + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, + dwBuildNumber: DWORD, + dwPlatformId: DWORD, + szCSDVersion: [WCHAR; 128], +}} +pub type POSVERSIONINFOW = *mut OSVERSIONINFOW; +pub type LPOSVERSIONINFOW = *mut OSVERSIONINFOW; +pub type RTL_OSVERSIONINFOW = OSVERSIONINFOW; +pub type PRTL_OSVERSIONINFOW = *mut OSVERSIONINFOW; +STRUCT!{struct OSVERSIONINFOEXA { + dwOSVersionInfoSize: DWORD, + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, + dwBuildNumber: DWORD, + dwPlatformId: DWORD, + szCSDVersion: [CHAR; 128], + wServicePackMajor: WORD, + wServicePackMinor: WORD, + wSuiteMask: WORD, + wProductType: BYTE, + wReserved: BYTE, +}} +pub type POSVERSIONINFOEXA = *mut OSVERSIONINFOEXA; +pub type LPOSVERSIONINFOEXA = *mut OSVERSIONINFOEXA; +STRUCT!{struct OSVERSIONINFOEXW { + dwOSVersionInfoSize: DWORD, + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, + dwBuildNumber: DWORD, + dwPlatformId: DWORD, + szCSDVersion: [WCHAR; 128], + wServicePackMajor: WORD, + wServicePackMinor: WORD, + wSuiteMask: WORD, + wProductType: BYTE, + wReserved: BYTE, +}} +pub type POSVERSIONINFOEXW = *mut OSVERSIONINFOEXW; +pub type LPOSVERSIONINFOEXW = *mut OSVERSIONINFOEXW; +pub type RTL_OSVERSIONINFOEXW = OSVERSIONINFOEXW; +pub type PRTL_OSVERSIONINFOEXW = *mut OSVERSIONINFOEXW; +pub const VER_EQUAL: BYTE = 1; +pub const VER_GREATER: BYTE = 2; +pub const VER_GREATER_EQUAL: BYTE = 3; +pub const VER_LESS: BYTE = 4; +pub const VER_LESS_EQUAL: BYTE = 5; +pub const VER_AND: BYTE = 6; +pub const VER_OR: BYTE = 7; +pub const VER_CONDITION_MASK: BYTE = 7; +pub const VER_NUM_BITS_PER_CONDITION_MASK: BYTE = 3; +pub const VER_MINORVERSION: DWORD = 0x0000001; +pub const VER_MAJORVERSION: DWORD = 0x0000002; +pub const VER_BUILDNUMBER: DWORD = 0x0000004; +pub const VER_PLATFORMID: DWORD = 0x0000008; +pub const VER_SERVICEPACKMINOR: DWORD = 0x0000010; +pub const VER_SERVICEPACKMAJOR: DWORD = 0x0000020; +pub const VER_SUITENAME: DWORD = 0x0000040; +pub const VER_PRODUCT_TYPE: DWORD = 0x0000080; +pub const VER_NT_WORKSTATION: BYTE = 0x0000001; +pub const VER_NT_DOMAIN_CONTROLLER: BYTE = 0x0000002; +pub const VER_NT_SERVER: BYTE = 0x0000003; +pub const VER_PLATFORM_WIN32s: DWORD = 0; +pub const VER_PLATFORM_WIN32_WINDOWS: DWORD = 1; +pub const VER_PLATFORM_WIN32_NT: DWORD = 2; +extern "system" { + pub fn VerSetConditionMask( + ConditionMask: ULONGLONG, + TypeMask: DWORD, + Condition: BYTE, + ) -> ULONGLONG; + pub fn RtlGetProductInfo( + OSMajorVersion: DWORD, + OSMinorVersion: DWORD, + SpMajorVersion: DWORD, + SpMinorVersion: DWORD, + ReturnedProductType: PDWORD, + ) -> BOOLEAN; +} +pub const RTL_UMS_VERSION: DWORD = 0x100; +ENUM!{enum RTL_UMS_THREAD_INFO_CLASS { + UmsThreadInvalidInfoClass = 0, + UmsThreadUserContext, + UmsThreadPriority, + UmsThreadAffinity, + UmsThreadTeb, + UmsThreadIsSuspended, + UmsThreadIsTerminated, + UmsThreadMaxInfoClass, +}} +ENUM!{enum RTL_UMS_SCHEDULER_REASON { + UmsSchedulerStartup = 0, + UmsSchedulerThreadBlocked, + UmsSchedulerThreadYield, +}} +FN!{stdcall PRTL_UMS_SCHEDULER_ENTRY_POINT( + Reason: RTL_UMS_SCHEDULER_REASON, + ActivationPayload: ULONG_PTR, + SchedulerParam: PVOID, +) -> ()} +#[inline] +pub fn IS_VALIDATION_ENABLED(C: DWORD, L: DWORD) -> bool { + (L & C) != 0 +} +pub const VRL_PREDEFINED_CLASS_BEGIN: DWORD = 1 << 0; +pub const VRL_CUSTOM_CLASS_BEGIN: DWORD = 1 << 8; +pub const VRL_CLASS_CONSISTENCY: DWORD = VRL_CUSTOM_CLASS_BEGIN << 8; +pub const VRL_ENABLE_KERNEL_BREAKS: DWORD = 1 << 31; +pub const CTMF_INCLUDE_APPCONTAINER: ULONG = 0x00000001; +pub const CTMF_INCLUDE_LPAC: ULONG = 0x00000002; +pub const CTMF_VALID_FLAGS: ULONG = CTMF_INCLUDE_APPCONTAINER | CTMF_INCLUDE_LPAC; +extern "system" { + pub fn RtlCrc32( + Buffer: *const c_void, + Size: size_t, + InitialCrc: DWORD, + ) -> DWORD; + pub fn RtlCrc64( + Buffer: *const c_void, + Size: size_t, + InitialCrc: ULONGLONG, + ) -> ULONGLONG; +} +ENUM!{enum OS_DEPLOYEMENT_STATE_VALUES { + OS_DEPLOYMENT_STANDARD = 1, + OS_DEPLOYMENT_COMPACT, +}} +extern "system" { + pub fn RtlOsDeploymentState( + Flags: DWORD, + ) -> OS_DEPLOYEMENT_STATE_VALUES; +} +STRUCT!{struct NV_MEMORY_RANGE { + BaseAddress: *mut VOID, + Length: SIZE_T, +}} +pub type PNV_MEMORY_RANGE = *mut NV_MEMORY_RANGE; +pub const FLUSH_NV_MEMORY_IN_FLAG_NO_DRAIN: ULONG = 0x00000001; +pub const FLUSH_NV_MEMORY_DEFAULT_TOKEN: ULONG_PTR = -1isize as usize; +STRUCT!{struct RTL_CRITICAL_SECTION_DEBUG { + Type: WORD, + CreatorBackTraceIndex: WORD, + CriticalSection: *mut RTL_CRITICAL_SECTION, + ProcessLocksList: LIST_ENTRY, + EntryCount: DWORD, + ContentionCount: DWORD, + Flags: DWORD, + CreatorBackTraceIndexHigh: WORD, + SpareWORD: WORD, +}} +pub type PRTL_CRITICAL_SECTION_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG; +pub type RTL_RESOURCE_DEBUG = RTL_CRITICAL_SECTION_DEBUG; +pub type PRTL_RESOURCE_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG; +pub const RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO: ULONG_PTR = 0x01000000; +pub const RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN: ULONG_PTR = 0x02000000; +pub const RTL_CRITICAL_SECTION_FLAG_STATIC_INIT: ULONG_PTR = 0x04000000; +pub const RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE: ULONG_PTR = 0x08000000; +pub const RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO: ULONG_PTR = 0x10000000; +pub const RTL_CRITICAL_SECTION_ALL_FLAG_BITS: ULONG_PTR = 0xFF000000; +pub const RTL_CRITICAL_SECTION_FLAG_RESERVED: ULONG_PTR = RTL_CRITICAL_SECTION_ALL_FLAG_BITS + & !(RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO | RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN + | RTL_CRITICAL_SECTION_FLAG_STATIC_INIT | RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE + | RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); +pub const RTL_CRITICAL_SECTION_DEBUG_FLAG_STATIC_INIT: DWORD = 0x00000001; +STRUCT!{struct RTL_CRITICAL_SECTION { + DebugInfo: PRTL_CRITICAL_SECTION_DEBUG, + LockCount: LONG, + RecursionCount: LONG, + OwningThread: HANDLE, + LockSemaphore: HANDLE, + SpinCount: ULONG_PTR, +}} +pub type PRTL_CRITICAL_SECTION = *mut RTL_CRITICAL_SECTION; +STRUCT!{struct RTL_SRWLOCK { + Ptr: PVOID, +}} +pub type PRTL_SRWLOCK = *mut RTL_SRWLOCK; +pub const RTL_SRWLOCK_INIT: RTL_SRWLOCK = RTL_SRWLOCK { Ptr: 0 as PVOID }; +STRUCT!{struct RTL_CONDITION_VARIABLE { + Ptr: PVOID, +}} +pub type PRTL_CONDITION_VARIABLE = *mut RTL_CONDITION_VARIABLE; +pub const RTL_CONDITION_VARIABLE_INIT: RTL_CONDITION_VARIABLE = RTL_CONDITION_VARIABLE { + Ptr: 0 as PVOID, +}; +pub const RTL_CONDITION_VARIABLE_LOCKMODE_SHARED: DWORD = 0x1; +FN!{stdcall PAPCFUNC( + Parameter: ULONG_PTR, +) -> ()} +FN!{stdcall PVECTORED_EXCEPTION_HANDLER( + ExceptionInfo: *mut EXCEPTION_POINTERS, +) -> LONG} +ENUM!{enum HEAP_INFORMATION_CLASS { + HeapCompatibilityInformation = 0, + HeapEnableTerminationOnCorruption = 1, + HeapOptimizeResources = 3, +}} +pub const HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION: DWORD = 1; +STRUCT!{struct HEAP_OPTIMIZE_RESOURCES_INFORMATION { + Version: DWORD, + Flags: DWORD, +}} +pub type PHEAP_OPTIMIZE_RESOURCES_INFORMATION = *mut HEAP_OPTIMIZE_RESOURCES_INFORMATION; +pub const WT_EXECUTEDEFAULT: ULONG = 0x00000000; +pub const WT_EXECUTEINIOTHREAD: ULONG = 0x00000001; +pub const WT_EXECUTEINUITHREAD: ULONG = 0x00000002; +pub const WT_EXECUTEINWAITTHREAD: ULONG = 0x00000004; +pub const WT_EXECUTEONLYONCE: ULONG = 0x00000008; +pub const WT_EXECUTEINTIMERTHREAD: ULONG = 0x00000020; +pub const WT_EXECUTELONGFUNCTION: ULONG = 0x00000010; +pub const WT_EXECUTEINPERSISTENTIOTHREAD: ULONG = 0x00000040; +pub const WT_EXECUTEINPERSISTENTTHREAD: ULONG = 0x00000080; +pub const WT_TRANSFER_IMPERSONATION: ULONG = 0x00000100; +#[inline] +pub fn WT_SET_MAX_THREADPOOL_THREADS(Flags: ULONG, Limit: ULONG) -> ULONG { + Flags | (Limit << 16) +} +FN!{stdcall WAITORTIMERCALLBACKFUNC( + PVOID, + BOOLEAN, +) -> ()} +FN!{stdcall WORKERCALLBACKFUNC( + PVOID, +) -> ()} +FN!{stdcall APC_CALLBACK_FUNCTION( + DWORD, + PVOID, + PVOID, +) -> ()} +pub type WAITORTIMERCALLBACK = WAITORTIMERCALLBACKFUNC; +FN!{stdcall PFLS_CALLBACK_FUNCTION( + lpFlsData: PVOID, +) -> ()} +FN!{stdcall PSECURE_MEMORY_CACHE_CALLBACK( + Addr: PVOID, + Range: SIZE_T, +) -> BOOLEAN} +pub const WT_EXECUTEINLONGTHREAD: ULONG = 0x00000010; +pub const WT_EXECUTEDELETEWAIT: ULONG = 0x00000008; +ENUM!{enum ACTIVATION_CONTEXT_INFO_CLASS { + ActivationContextBasicInformation = 1, + ActivationContextDetailedInformation = 2, + AssemblyDetailedInformationInActivationContext = 3, + FileInformationInAssemblyOfAssemblyInActivationContext = 4, + RunlevelInformationInActivationContext = 5, + CompatibilityInformationInActivationContext = 6, + ActivationContextManifestResourceName = 7, + MaxActivationContextInfoClass, + AssemblyDetailedInformationInActivationContxt = 3, + FileInformationInAssemblyOfAssemblyInActivationContxt = 4, +}} +pub type ACTIVATIONCONTEXTINFOCLASS = ACTIVATION_CONTEXT_INFO_CLASS; +STRUCT!{struct ACTIVATION_CONTEXT_QUERY_INDEX { + ulAssemblyIndex: DWORD, + ulFileIndexInAssembly: DWORD, +}} +pub type PACTIVATION_CONTEXT_QUERY_INDEX = *mut ACTIVATION_CONTEXT_QUERY_INDEX; +pub type PCACTIVATION_CONTEXT_QUERY_INDEX = *const ACTIVATION_CONTEXT_QUERY_INDEX; +pub const ACTIVATION_CONTEXT_PATH_TYPE_NONE: DWORD = 1; +pub const ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE: DWORD = 2; +pub const ACTIVATION_CONTEXT_PATH_TYPE_URL: DWORD = 3; +pub const ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF: DWORD = 4; +STRUCT!{struct ASSEMBLY_FILE_DETAILED_INFORMATION { + ulFlags: DWORD, + ulFilenameLength: DWORD, + ulPathLength: DWORD, + lpFileName: PCWSTR, + lpFilePath: PCWSTR, +}} +pub type PASSEMBLY_FILE_DETAILED_INFORMATION = *mut ASSEMBLY_FILE_DETAILED_INFORMATION; +pub type PCASSEMBLY_FILE_DETAILED_INFORMATION = *const ASSEMBLY_FILE_DETAILED_INFORMATION; +pub type ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = ASSEMBLY_FILE_DETAILED_INFORMATION; +pub type PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = PASSEMBLY_FILE_DETAILED_INFORMATION; +pub type PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = PCASSEMBLY_FILE_DETAILED_INFORMATION; +STRUCT!{struct ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION { + ulFlags: DWORD, + ulEncodedAssemblyIdentityLength: DWORD, + ulManifestPathType: DWORD, + ulManifestPathLength: DWORD, + liManifestLastWriteTime: LARGE_INTEGER, + ulPolicyPathType: DWORD, + ulPolicyPathLength: DWORD, + liPolicyLastWriteTime: LARGE_INTEGER, + ulMetadataSatelliteRosterIndex: DWORD, + ulManifestVersionMajor: DWORD, + ulManifestVersionMinor: DWORD, + ulPolicyVersionMajor: DWORD, + ulPolicyVersionMinor: DWORD, + ulAssemblyDirectoryNameLength: DWORD, + lpAssemblyEncodedAssemblyIdentity: PCWSTR, + lpAssemblyManifestPath: PCWSTR, + lpAssemblyPolicyPath: PCWSTR, + lpAssemblyDirectoryName: PCWSTR, + ulFileCount: DWORD, +}} +pub type PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION + = *mut ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; +pub type PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION + = *const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; +ENUM!{enum ACTCTX_REQUESTED_RUN_LEVEL { + ACTCTX_RUN_LEVEL_UNSPECIFIED = 0, + ACTCTX_RUN_LEVEL_AS_INVOKER, + ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE, + ACTCTX_RUN_LEVEL_REQUIRE_ADMIN, + ACTCTX_RUN_LEVEL_NUMBERS, +}} +STRUCT!{struct ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION { + ulFlags: DWORD, + RunLevel: ACTCTX_REQUESTED_RUN_LEVEL, + UiAccess: DWORD, +}} +pub type PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION = *mut ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION; +pub type PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION + = *const ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION; +ENUM!{enum ACTCTX_COMPATIBILITY_ELEMENT_TYPE { + ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN = 0, + ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS, + ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION, +}} +STRUCT!{struct COMPATIBILITY_CONTEXT_ELEMENT { + Id: GUID, + Type: ACTCTX_COMPATIBILITY_ELEMENT_TYPE, +}} +pub type PCOMPATIBILITY_CONTEXT_ELEMENT = *mut COMPATIBILITY_CONTEXT_ELEMENT; +pub type PCCOMPATIBILITY_CONTEXT_ELEMENT = *const COMPATIBILITY_CONTEXT_ELEMENT; +STRUCT!{struct ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION { + ElementCount: DWORD, + Elements: [COMPATIBILITY_CONTEXT_ELEMENT; 0], +}} +pub type PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION + = *mut ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION; +pub type PCACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION + = *const ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION; +STRUCT!{struct SUPPORTED_OS_INFO { + MajorVersion: WORD, + MinorVersion: WORD, +}} +pub type PSUPPORTED_OS_INFO = *mut SUPPORTED_OS_INFO; +STRUCT!{struct ACTIVATION_CONTEXT_DETAILED_INFORMATION { + dwFlags: DWORD, + ulFormatVersion: DWORD, + ulAssemblyCount: DWORD, + ulRootManifestPathType: DWORD, + ulRootManifestPathChars: DWORD, + ulRootConfigurationPathType: DWORD, + ulRootConfigurationPathChars: DWORD, + ulAppDirPathType: DWORD, + ulAppDirPathChars: DWORD, + lpRootManifestPath: PCWSTR, + lpRootConfigurationPath: PCWSTR, + lpAppDirPath: PCWSTR, +}} +pub type PACTIVATION_CONTEXT_DETAILED_INFORMATION = *mut ACTIVATION_CONTEXT_DETAILED_INFORMATION; +pub type PCACTIVATION_CONTEXT_DETAILED_INFORMATION + = *const ACTIVATION_CONTEXT_DETAILED_INFORMATION; +pub const CREATE_BOUNDARY_DESCRIPTOR_ADD_APPCONTAINER_SID: DWORD = 0x1; +STRUCT!{struct HARDWARE_COUNTER_DATA { + Type: HARDWARE_COUNTER_TYPE, + Reserved: DWORD, + Value: DWORD64, +}} +pub type PHARDWARE_COUNTER_DATA = *mut HARDWARE_COUNTER_DATA; +pub const PERFORMANCE_DATA_VERSION: BYTE = 1; +STRUCT!{struct PERFORMANCE_DATA { + Size: WORD, + Version: BYTE, + HwCountersCount: BYTE, + ContextSwitchCount: DWORD, + WaitReasonBitMap: DWORD64, + CycleTime: DWORD64, + RetryCount: DWORD, + Reserved: DWORD, + HwCounters: [HARDWARE_COUNTER_DATA; MAX_HW_COUNTERS], +}} +pub type PPERFORMANCE_DATA = *mut PERFORMANCE_DATA; +pub const READ_THREAD_PROFILING_FLAG_DISPATCHING: DWORD = 0x00000001; +pub const READ_THREAD_PROFILING_FLAG_HARDWARE_COUNTERS: DWORD = 0x00000002; +pub const UNIFIEDBUILDREVISION_KEY: &'static str + = "\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion"; +pub const UNIFIEDBUILDREVISION_VALUE: &'static str = "UBR"; +pub const UNIFIEDBUILDREVISION_MIN: DWORD = 0x00000000; +pub const DEVICEFAMILYDEVICEFORM_KEY: &'static str + = "\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\OEM"; +pub const DEVICEFAMILYDEVICEFORM_VALUE: &'static str = "DeviceForm"; +pub const DEVICEFAMILYINFOENUM_UAP: DWORD = 0x00000000; +pub const DEVICEFAMILYINFOENUM_WINDOWS_8X: DWORD = 0x00000001; +pub const DEVICEFAMILYINFOENUM_WINDOWS_PHONE_8X: DWORD = 0x00000002; +pub const DEVICEFAMILYINFOENUM_DESKTOP: DWORD = 0x00000003; +pub const DEVICEFAMILYINFOENUM_MOBILE: DWORD = 0x00000004; +pub const DEVICEFAMILYINFOENUM_XBOX: DWORD = 0x00000005; +pub const DEVICEFAMILYINFOENUM_TEAM: DWORD = 0x00000006; +pub const DEVICEFAMILYINFOENUM_IOT: DWORD = 0x00000007; +pub const DEVICEFAMILYINFOENUM_IOT_HEADLESS: DWORD = 0x00000008; +pub const DEVICEFAMILYINFOENUM_SERVER: DWORD = 0x00000009; +pub const DEVICEFAMILYINFOENUM_HOLOGRAPHIC: DWORD = 0x0000000A; +pub const DEVICEFAMILYINFOENUM_XBOXSRA: DWORD = 0x0000000B; +pub const DEVICEFAMILYINFOENUM_XBOXERA: DWORD = 0x0000000C; +pub const DEVICEFAMILYINFOENUM_SERVER_NANO: DWORD = 0x0000000D; +pub const DEVICEFAMILYINFOENUM_MAX: DWORD = 0x0000000D; +pub const DEVICEFAMILYDEVICEFORM_UNKNOWN: DWORD = 0x00000000; +pub const DEVICEFAMILYDEVICEFORM_PHONE: DWORD = 0x00000001; +pub const DEVICEFAMILYDEVICEFORM_TABLET: DWORD = 0x00000002; +pub const DEVICEFAMILYDEVICEFORM_DESKTOP: DWORD = 0x00000003; +pub const DEVICEFAMILYDEVICEFORM_NOTEBOOK: DWORD = 0x00000004; +pub const DEVICEFAMILYDEVICEFORM_CONVERTIBLE: DWORD = 0x00000005; +pub const DEVICEFAMILYDEVICEFORM_DETACHABLE: DWORD = 0x00000006; +pub const DEVICEFAMILYDEVICEFORM_ALLINONE: DWORD = 0x00000007; +pub const DEVICEFAMILYDEVICEFORM_STICKPC: DWORD = 0x00000008; +pub const DEVICEFAMILYDEVICEFORM_PUCK: DWORD = 0x00000009; +pub const DEVICEFAMILYDEVICEFORM_LARGESCREEN: DWORD = 0x0000000A; +pub const DEVICEFAMILYDEVICEFORM_HMD: DWORD = 0x0000000B; +pub const DEVICEFAMILYDEVICEFORM_INDUSTRY_HANDHELD: DWORD = 0x0000000C; +pub const DEVICEFAMILYDEVICEFORM_INDUSTRY_TABLET: DWORD = 0x0000000D; +pub const DEVICEFAMILYDEVICEFORM_BANKING: DWORD = 0x0000000E; +pub const DEVICEFAMILYDEVICEFORM_BUILDING_AUTOMATION: DWORD = 0x0000000F; +pub const DEVICEFAMILYDEVICEFORM_DIGITAL_SIGNAGE: DWORD = 0x00000010; +pub const DEVICEFAMILYDEVICEFORM_GAMING: DWORD = 0x00000011; +pub const DEVICEFAMILYDEVICEFORM_HOME_AUTOMATION: DWORD = 0x00000012; +pub const DEVICEFAMILYDEVICEFORM_INDUSTRIAL_AUTOMATION: DWORD = 0x00000013; +pub const DEVICEFAMILYDEVICEFORM_KIOSK: DWORD = 0x00000014; +pub const DEVICEFAMILYDEVICEFORM_MAKER_BOARD: DWORD = 0x00000015; +pub const DEVICEFAMILYDEVICEFORM_MEDICAL: DWORD = 0x00000016; +pub const DEVICEFAMILYDEVICEFORM_NETWORKING: DWORD = 0x00000017; +pub const DEVICEFAMILYDEVICEFORM_POINT_OF_SERVICE: DWORD = 0x00000018; +pub const DEVICEFAMILYDEVICEFORM_PRINTING: DWORD = 0x00000019; +pub const DEVICEFAMILYDEVICEFORM_THIN_CLIENT: DWORD = 0x0000001A; +pub const DEVICEFAMILYDEVICEFORM_TOY: DWORD = 0x0000001B; +pub const DEVICEFAMILYDEVICEFORM_VENDING: DWORD = 0x0000001C; +pub const DEVICEFAMILYDEVICEFORM_INDUSTRY_OTHER: DWORD = 0x0000001D; +pub const DEVICEFAMILYDEVICEFORM_MAX: DWORD = 0x0000001D; +extern "system" { + pub fn RtlGetDeviceFamilyInfoEnum( + pullUAPInfo: *mut ULONGLONG, + pulDeviceFamily: *mut DWORD, + pulDeviceForm: *mut DWORD, + ); + pub fn RtlConvertDeviceFamilyInfoToString( + pulDeviceFamilyBufferSize: PDWORD, + pulDeviceFormBufferSize: PDWORD, + DeviceFamily: PWSTR, + DeviceForm: PWSTR, + ) -> DWORD; + pub fn RtlSwitchedVVI( + VersionInfo: PRTL_OSVERSIONINFOEXW, + TypeMask: DWORD, + ConditionMask: ULONGLONG, + ) -> DWORD; +} +pub const DLL_PROCESS_ATTACH: DWORD = 1; +pub const DLL_THREAD_ATTACH: DWORD = 2; +pub const DLL_THREAD_DETACH: DWORD = 3; +pub const DLL_PROCESS_DETACH: DWORD = 0; +pub const EVENTLOG_SEQUENTIAL_READ: DWORD = 0x0001; +pub const EVENTLOG_SEEK_READ: DWORD = 0x0002; +pub const EVENTLOG_FORWARDS_READ: DWORD = 0x0004; +pub const EVENTLOG_BACKWARDS_READ: DWORD = 0x0008; +pub const EVENTLOG_SUCCESS: WORD = 0x0000; +pub const EVENTLOG_ERROR_TYPE: WORD = 0x0001; +pub const EVENTLOG_WARNING_TYPE: WORD = 0x0002; +pub const EVENTLOG_INFORMATION_TYPE: WORD = 0x0004; +pub const EVENTLOG_AUDIT_SUCCESS: WORD = 0x0008; +pub const EVENTLOG_AUDIT_FAILURE: WORD = 0x0010; +pub const EVENTLOG_START_PAIRED_EVENT: WORD = 0x0001; +pub const EVENTLOG_END_PAIRED_EVENT: WORD = 0x0002; +pub const EVENTLOG_END_ALL_PAIRED_EVENTS: WORD = 0x0004; +pub const EVENTLOG_PAIRED_EVENT_ACTIVE: WORD = 0x0008; +pub const EVENTLOG_PAIRED_EVENT_INACTIVE: WORD = 0x0010; +STRUCT!{struct EVENTLOGRECORD { + Length: DWORD, + Reserved: DWORD, + RecordNumber: DWORD, + TimeGenerated: DWORD, + TimeWritten: DWORD, + EventID: DWORD, + EventType: WORD, + NumStrings: WORD, + EventCategory: WORD, + ReservedFlags: WORD, + ClosingRecordNumber: DWORD, + StringOffset: DWORD, + UserSidLength: DWORD, + UserSidOffset: DWORD, + DataLength: DWORD, + DataOffset: DWORD, +}} +pub type PEVENTLOGRECORD = *mut EVENTLOGRECORD; +pub const MAXLOGICALLOGNAMESIZE: usize = 256; +pub type PEVENTSFORLOGFILE = *mut EVENTSFORLOGFILE; +pub type PPACKEDEVENTINFO = *mut PACKEDEVENTINFO; +STRUCT!{struct EVENTSFORLOGFILE { + ulSize: DWORD, + szLogicalLogFile: [WCHAR; MAXLOGICALLOGNAMESIZE], + ulNumRecords: DWORD, + pEventLogRecords: [EVENTLOGRECORD; 0], +}} +STRUCT!{struct PACKEDEVENTINFO { + ulSize: DWORD, + ulNumEventsForLogFile: DWORD, + ulOffsets: [DWORD; 0], +}} +pub const KEY_QUERY_VALUE: u32 = 0x0001; +pub const KEY_SET_VALUE: u32 = 0x0002; +pub const KEY_CREATE_SUB_KEY: u32 = 0x0004; +pub const KEY_ENUMERATE_SUB_KEYS: u32 = 0x0008; +pub const KEY_NOTIFY: u32 = 0x0010; +pub const KEY_CREATE_LINK: u32 = 0x0020; +pub const KEY_WOW64_32KEY: u32 = 0x0200; +pub const KEY_WOW64_64KEY: u32 = 0x0100; +pub const KEY_WOW64_RES: u32 = 0x0300; +pub const KEY_READ: u32 = (STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS + | KEY_NOTIFY) & !SYNCHRONIZE; +pub const KEY_WRITE: u32 = (STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) + & !SYNCHRONIZE; +pub const KEY_EXECUTE: u32 = KEY_READ & !SYNCHRONIZE; +pub const KEY_ALL_ACCESS: u32 = (STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE + | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & !SYNCHRONIZE; +pub const REG_OPTION_RESERVED: DWORD = 0x00000000; +pub const REG_OPTION_NON_VOLATILE: DWORD = 0x00000000; +pub const REG_OPTION_VOLATILE: DWORD = 0x00000001; +pub const REG_OPTION_CREATE_LINK: DWORD = 0x00000002; +pub const REG_OPTION_BACKUP_RESTORE: DWORD = 0x00000004; +pub const REG_OPTION_OPEN_LINK: DWORD = 0x00000008; +pub const REG_OPTION_DONT_VIRTUALIZE: DWORD = 0x00000010; +pub const REG_LEGAL_OPTION: DWORD = REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE + | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE + | REG_OPTION_OPEN_LINK | REG_OPTION_DONT_VIRTUALIZE; +pub const REG_OPEN_LEGAL_OPTION: DWORD = REG_OPTION_RESERVED | REG_OPTION_BACKUP_RESTORE + | REG_OPTION_OPEN_LINK | REG_OPTION_DONT_VIRTUALIZE; +pub const REG_CREATED_NEW_KEY: DWORD = 0x00000001; +pub const REG_OPENED_EXISTING_KEY: DWORD = 0x00000002; +pub const REG_STANDARD_FORMAT: DWORD = 1; +pub const REG_LATEST_FORMAT: DWORD = 2; +pub const REG_NO_COMPRESSION: DWORD = 4; +pub const REG_WHOLE_HIVE_VOLATILE: DWORD = 0x00000001; +pub const REG_REFRESH_HIVE: DWORD = 0x00000002; +pub const REG_NO_LAZY_FLUSH: DWORD = 0x00000004; +pub const REG_FORCE_RESTORE: DWORD = 0x00000008; +pub const REG_APP_HIVE: DWORD = 0x00000010; +pub const REG_PROCESS_PRIVATE: DWORD = 0x00000020; +pub const REG_START_JOURNAL: DWORD = 0x00000040; +pub const REG_HIVE_EXACT_FILE_GROWTH: DWORD = 0x00000080; +pub const REG_HIVE_NO_RM: DWORD = 0x00000100; +pub const REG_HIVE_SINGLE_LOG: DWORD = 0x00000200; +pub const REG_BOOT_HIVE: DWORD = 0x00000400; +pub const REG_LOAD_HIVE_OPEN_HANDLE: DWORD = 0x00000800; +pub const REG_FLUSH_HIVE_FILE_GROWTH: DWORD = 0x00001000; +pub const REG_OPEN_READ_ONLY: DWORD = 0x00002000; +pub const REG_IMMUTABLE: DWORD = 0x00004000; +pub const REG_APP_HIVE_OPEN_READ_ONLY: DWORD = REG_OPEN_READ_ONLY; +pub const REG_FORCE_UNLOAD: DWORD = 1; +pub const REG_UNLOAD_LEGAL_FLAGS: DWORD = REG_FORCE_UNLOAD; +pub const REG_NOTIFY_CHANGE_NAME: DWORD = 0x00000001; +pub const REG_NOTIFY_CHANGE_ATTRIBUTES: DWORD = 0x00000002; +pub const REG_NOTIFY_CHANGE_LAST_SET: DWORD = 0x00000004; +pub const REG_NOTIFY_CHANGE_SECURITY: DWORD = 0x00000008; +pub const REG_NOTIFY_THREAD_AGNOSTIC: DWORD = 0x10000000; +pub const REG_LEGAL_CHANGE_FILTER: DWORD = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES + | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY | REG_NOTIFY_THREAD_AGNOSTIC; +pub const REG_NONE: DWORD = 0; +pub const REG_SZ: DWORD = 1; +pub const REG_EXPAND_SZ: DWORD = 2; +pub const REG_BINARY: DWORD = 3; +pub const REG_DWORD: DWORD = 4; +pub const REG_DWORD_LITTLE_ENDIAN: DWORD = 4; +pub const REG_DWORD_BIG_ENDIAN: DWORD = 5; +pub const REG_LINK: DWORD = 6; +pub const REG_MULTI_SZ: DWORD = 7; +pub const REG_RESOURCE_LIST: DWORD = 8; +pub const REG_FULL_RESOURCE_DESCRIPTOR: DWORD = 9; +pub const REG_RESOURCE_REQUIREMENTS_LIST: DWORD = 10; +pub const REG_QWORD: DWORD = 11; +pub const REG_QWORD_LITTLE_ENDIAN: DWORD = 11; +pub const SERVICE_KERNEL_DRIVER: DWORD = 0x00000001; +pub const SERVICE_FILE_SYSTEM_DRIVER: DWORD = 0x00000002; +pub const SERVICE_ADAPTER: DWORD = 0x00000004; +pub const SERVICE_RECOGNIZER_DRIVER: DWORD = 0x00000008; +pub const SERVICE_DRIVER: DWORD = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER + | SERVICE_RECOGNIZER_DRIVER; +pub const SERVICE_WIN32_OWN_PROCESS: DWORD = 0x00000010; +pub const SERVICE_WIN32_SHARE_PROCESS: DWORD = 0x00000020; +pub const SERVICE_WIN32: DWORD = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS; +pub const SERVICE_USER_SERVICE: DWORD = 0x00000040; +pub const SERVICE_USERSERVICE_INSTANCE: DWORD = 0x00000080; +pub const SERVICE_USER_SHARE_PROCESS: DWORD = SERVICE_USER_SERVICE | SERVICE_WIN32_SHARE_PROCESS; +pub const SERVICE_USER_OWN_PROCESS: DWORD = SERVICE_USER_SERVICE | SERVICE_WIN32_OWN_PROCESS; +pub const SERVICE_INTERACTIVE_PROCESS: DWORD = 0x00000100; +pub const SERVICE_PKG_SERVICE: DWORD = 0x00000200; +pub const SERVICE_TYPE_ALL: DWORD = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER + | SERVICE_INTERACTIVE_PROCESS | SERVICE_USER_SERVICE | SERVICE_USERSERVICE_INSTANCE + | SERVICE_PKG_SERVICE; +pub const SERVICE_BOOT_START: DWORD = 0x00000000; +pub const SERVICE_SYSTEM_START: DWORD = 0x00000001; +pub const SERVICE_AUTO_START: DWORD = 0x00000002; +pub const SERVICE_DEMAND_START: DWORD = 0x00000003; +pub const SERVICE_DISABLED: DWORD = 0x00000004; +pub const SERVICE_ERROR_IGNORE: DWORD = 0x00000000; +pub const SERVICE_ERROR_NORMAL: DWORD = 0x00000001; +pub const SERVICE_ERROR_SEVERE: DWORD = 0x00000002; +pub const SERVICE_ERROR_CRITICAL: DWORD = 0x00000003; +ENUM!{enum SERVICE_NODE_TYPE { + DriverType = SERVICE_KERNEL_DRIVER, + FileSystemType = SERVICE_FILE_SYSTEM_DRIVER, + Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, + Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS, + AdapterType = SERVICE_ADAPTER, + RecognizerType = SERVICE_RECOGNIZER_DRIVER, +}} +ENUM!{enum SERVICE_LOAD_TYPE { + BootLoad = SERVICE_BOOT_START, + SystemLoad = SERVICE_SYSTEM_START, + AutoLoad = SERVICE_AUTO_START, + DemandLoad = SERVICE_DEMAND_START, + DisableLoad = SERVICE_DISABLED, +}} +ENUM!{enum SERVICE_ERROR_TYPE { + IgnoreError = SERVICE_ERROR_IGNORE, + NormalError = SERVICE_ERROR_NORMAL, + SevereError = SERVICE_ERROR_SEVERE, + CriticalError = SERVICE_ERROR_CRITICAL, +}} +pub const CM_SERVICE_NETWORK_BOOT_LOAD: DWORD = 0x00000001; +pub const CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD: DWORD = 0x00000002; +pub const CM_SERVICE_USB_DISK_BOOT_LOAD: DWORD = 0x00000004; +pub const CM_SERVICE_SD_DISK_BOOT_LOAD: DWORD = 0x00000008; +pub const CM_SERVICE_USB3_DISK_BOOT_LOAD: DWORD = 0x00000010; +pub const CM_SERVICE_MEASURED_BOOT_LOAD: DWORD = 0x00000020; +pub const CM_SERVICE_VERIFIER_BOOT_LOAD: DWORD = 0x00000040; +pub const CM_SERVICE_WINPE_BOOT_LOAD: DWORD = 0x00000080; +pub const CM_SERVICE_VALID_PROMOTION_MASK: DWORD = CM_SERVICE_NETWORK_BOOT_LOAD + | CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD | CM_SERVICE_USB_DISK_BOOT_LOAD + | CM_SERVICE_SD_DISK_BOOT_LOAD | CM_SERVICE_USB3_DISK_BOOT_LOAD + | CM_SERVICE_MEASURED_BOOT_LOAD | CM_SERVICE_VERIFIER_BOOT_LOAD | CM_SERVICE_WINPE_BOOT_LOAD; +pub const TAPE_ERASE_SHORT: DWORD = 0; +pub const TAPE_ERASE_LONG: DWORD = 1; +STRUCT!{struct TAPE_ERASE { + Type: DWORD, + Immediate: BOOLEAN, +}} +pub type PTAPE_ERASE = *mut TAPE_ERASE; +pub const TAPE_LOAD: DWORD = 0; +pub const TAPE_UNLOAD: DWORD = 1; +pub const TAPE_TENSION: DWORD = 2; +pub const TAPE_LOCK: DWORD = 3; +pub const TAPE_UNLOCK: DWORD = 4; +pub const TAPE_FORMAT: DWORD = 5; +STRUCT!{struct TAPE_PREPARE { + Operation: DWORD, + Immediate: BOOLEAN, +}} +pub type PTAPE_PREPARE = *mut TAPE_PREPARE; +pub const TAPE_SETMARKS: DWORD = 0; +pub const TAPE_FILEMARKS: DWORD = 1; +pub const TAPE_SHORT_FILEMARKS: DWORD = 2; +pub const TAPE_LONG_FILEMARKS: DWORD = 3; +STRUCT!{struct TAPE_WRITE_MARKS { + Type: DWORD, + Count: DWORD, + Immediate: BOOLEAN, +}} +pub type PTAPE_WRITE_MARKS = *mut TAPE_WRITE_MARKS; +pub const TAPE_ABSOLUTE_POSITION: DWORD = 0; +pub const TAPE_LOGICAL_POSITION: DWORD = 1; +pub const TAPE_PSEUDO_LOGICAL_POSITION: DWORD = 2; +STRUCT!{struct TAPE_GET_POSITION { + Type: DWORD, + Partition: DWORD, + Offset: LARGE_INTEGER, +}} +pub type PTAPE_GET_POSITION = *mut TAPE_GET_POSITION; +pub const TAPE_REWIND: DWORD = 0; +pub const TAPE_ABSOLUTE_BLOCK: DWORD = 1; +pub const TAPE_LOGICAL_BLOCK: DWORD = 2; +pub const TAPE_PSEUDO_LOGICAL_BLOCK: DWORD = 3; +pub const TAPE_SPACE_END_OF_DATA: DWORD = 4; +pub const TAPE_SPACE_RELATIVE_BLOCKS: DWORD = 5; +pub const TAPE_SPACE_FILEMARKS: DWORD = 6; +pub const TAPE_SPACE_SEQUENTIAL_FMKS: DWORD = 7; +pub const TAPE_SPACE_SETMARKS: DWORD = 8; +pub const TAPE_SPACE_SEQUENTIAL_SMKS: DWORD = 9; +STRUCT!{struct TAPE_SET_POSITION { + Method: DWORD, + Partition: DWORD, + Offset: LARGE_INTEGER, + Immediate: BOOLEAN, +}} +pub type PTAPE_SET_POSITION = *mut TAPE_SET_POSITION; +pub const TAPE_DRIVE_FIXED: DWORD = 0x00000001; +pub const TAPE_DRIVE_SELECT: DWORD = 0x00000002; +pub const TAPE_DRIVE_INITIATOR: DWORD = 0x00000004; +pub const TAPE_DRIVE_ERASE_SHORT: DWORD = 0x00000010; +pub const TAPE_DRIVE_ERASE_LONG: DWORD = 0x00000020; +pub const TAPE_DRIVE_ERASE_BOP_ONLY: DWORD = 0x00000040; +pub const TAPE_DRIVE_ERASE_IMMEDIATE: DWORD = 0x00000080; +pub const TAPE_DRIVE_TAPE_CAPACITY: DWORD = 0x00000100; +pub const TAPE_DRIVE_TAPE_REMAINING: DWORD = 0x00000200; +pub const TAPE_DRIVE_FIXED_BLOCK: DWORD = 0x00000400; +pub const TAPE_DRIVE_VARIABLE_BLOCK: DWORD = 0x00000800; +pub const TAPE_DRIVE_WRITE_PROTECT: DWORD = 0x00001000; +pub const TAPE_DRIVE_EOT_WZ_SIZE: DWORD = 0x00002000; +pub const TAPE_DRIVE_ECC: DWORD = 0x00010000; +pub const TAPE_DRIVE_COMPRESSION: DWORD = 0x00020000; +pub const TAPE_DRIVE_PADDING: DWORD = 0x00040000; +pub const TAPE_DRIVE_REPORT_SMKS: DWORD = 0x00080000; +pub const TAPE_DRIVE_GET_ABSOLUTE_BLK: DWORD = 0x00100000; +pub const TAPE_DRIVE_GET_LOGICAL_BLK: DWORD = 0x00200000; +pub const TAPE_DRIVE_SET_EOT_WZ_SIZE: DWORD = 0x00400000; +pub const TAPE_DRIVE_EJECT_MEDIA: DWORD = 0x01000000; +pub const TAPE_DRIVE_CLEAN_REQUESTS: DWORD = 0x02000000; +pub const TAPE_DRIVE_SET_CMP_BOP_ONLY: DWORD = 0x04000000; +pub const TAPE_DRIVE_RESERVED_BIT: DWORD = 0x80000000; +pub const TAPE_DRIVE_LOAD_UNLOAD: DWORD = 0x80000001; +pub const TAPE_DRIVE_TENSION: DWORD = 0x80000002; +pub const TAPE_DRIVE_LOCK_UNLOCK: DWORD = 0x80000004; +pub const TAPE_DRIVE_REWIND_IMMEDIATE: DWORD = 0x80000008; +pub const TAPE_DRIVE_SET_BLOCK_SIZE: DWORD = 0x80000010; +pub const TAPE_DRIVE_LOAD_UNLD_IMMED: DWORD = 0x80000020; +pub const TAPE_DRIVE_TENSION_IMMED: DWORD = 0x80000040; +pub const TAPE_DRIVE_LOCK_UNLK_IMMED: DWORD = 0x80000080; +pub const TAPE_DRIVE_SET_ECC: DWORD = 0x80000100; +pub const TAPE_DRIVE_SET_COMPRESSION: DWORD = 0x80000200; +pub const TAPE_DRIVE_SET_PADDING: DWORD = 0x80000400; +pub const TAPE_DRIVE_SET_REPORT_SMKS: DWORD = 0x80000800; +pub const TAPE_DRIVE_ABSOLUTE_BLK: DWORD = 0x80001000; +pub const TAPE_DRIVE_ABS_BLK_IMMED: DWORD = 0x80002000; +pub const TAPE_DRIVE_LOGICAL_BLK: DWORD = 0x80004000; +pub const TAPE_DRIVE_LOG_BLK_IMMED: DWORD = 0x80008000; +pub const TAPE_DRIVE_END_OF_DATA: DWORD = 0x80010000; +pub const TAPE_DRIVE_RELATIVE_BLKS: DWORD = 0x80020000; +pub const TAPE_DRIVE_FILEMARKS: DWORD = 0x80040000; +pub const TAPE_DRIVE_SEQUENTIAL_FMKS: DWORD = 0x80080000; +pub const TAPE_DRIVE_SETMARKS: DWORD = 0x80100000; +pub const TAPE_DRIVE_SEQUENTIAL_SMKS: DWORD = 0x80200000; +pub const TAPE_DRIVE_REVERSE_POSITION: DWORD = 0x80400000; +pub const TAPE_DRIVE_SPACE_IMMEDIATE: DWORD = 0x80800000; +pub const TAPE_DRIVE_WRITE_SETMARKS: DWORD = 0x81000000; +pub const TAPE_DRIVE_WRITE_FILEMARKS: DWORD = 0x82000000; +pub const TAPE_DRIVE_WRITE_SHORT_FMKS: DWORD = 0x84000000; +pub const TAPE_DRIVE_WRITE_LONG_FMKS: DWORD = 0x88000000; +pub const TAPE_DRIVE_WRITE_MARK_IMMED: DWORD = 0x90000000; +pub const TAPE_DRIVE_FORMAT: DWORD = 0xA0000000; +pub const TAPE_DRIVE_FORMAT_IMMEDIATE: DWORD = 0xC0000000; +pub const TAPE_DRIVE_HIGH_FEATURES: DWORD = 0x80000000; +STRUCT!{struct TAPE_GET_DRIVE_PARAMETERS { + ECC: BOOLEAN, + Compression: BOOLEAN, + DataPadding: BOOLEAN, + ReportSetmarks: BOOLEAN, + DefaultBlockSize: DWORD, + MaximumBlockSize: DWORD, + MinimumBlockSize: DWORD, + MaximumPartitionCount: DWORD, + FeaturesLow: DWORD, + FeaturesHigh: DWORD, + EOTWarningZoneSize: DWORD, +}} +pub type PTAPE_GET_DRIVE_PARAMETERS = *mut TAPE_GET_DRIVE_PARAMETERS; +STRUCT!{struct TAPE_SET_DRIVE_PARAMETERS { + ECC: BOOLEAN, + Compression: BOOLEAN, + DataPadding: BOOLEAN, + ReportSetmarks: BOOLEAN, + EOTWarningZoneSize: DWORD, +}} +pub type PTAPE_SET_DRIVE_PARAMETERS = *mut TAPE_SET_DRIVE_PARAMETERS; +STRUCT!{struct TAPE_GET_MEDIA_PARAMETERS { + Capacity: LARGE_INTEGER, + Remaining: LARGE_INTEGER, + BlockSize: DWORD, + PartitionCount: DWORD, + WriteProtected: BOOLEAN, +}} +pub type PTAPE_GET_MEDIA_PARAMETERS = *mut TAPE_GET_MEDIA_PARAMETERS; +STRUCT!{struct TAPE_SET_MEDIA_PARAMETERS { + BlockSize: DWORD, +}} +pub type PTAPE_SET_MEDIA_PARAMETERS = *mut TAPE_SET_MEDIA_PARAMETERS; +pub const TAPE_FIXED_PARTITIONS: DWORD = 0; +pub const TAPE_SELECT_PARTITIONS: DWORD = 1; +pub const TAPE_INITIATOR_PARTITIONS: DWORD = 2; +STRUCT!{struct TAPE_CREATE_PARTITION { + Method: DWORD, + Count: DWORD, + Size: DWORD, +}} +pub type PTAPE_CREATE_PARTITION = *mut TAPE_CREATE_PARTITION; +pub const TAPE_QUERY_DRIVE_PARAMETERS: DWORD = 0; +pub const TAPE_QUERY_MEDIA_CAPACITY: DWORD = 1; +pub const TAPE_CHECK_FOR_DRIVE_PROBLEM: DWORD = 2; +pub const TAPE_QUERY_IO_ERROR_DATA: DWORD = 3; +pub const TAPE_QUERY_DEVICE_ERROR_DATA: DWORD = 4; +STRUCT!{struct TAPE_WMI_OPERATIONS { + Method: DWORD, + DataBufferSize: DWORD, + DataBuffer: PVOID, +}} +pub type PTAPE_WMI_OPERATIONS = *mut TAPE_WMI_OPERATIONS; +ENUM!{enum TAPE_DRIVE_PROBLEM_TYPE { + TapeDriveProblemNone, + TapeDriveReadWriteWarning, + TapeDriveReadWriteError, + TapeDriveReadWarning, + TapeDriveWriteWarning, + TapeDriveReadError, + TapeDriveWriteError, + TapeDriveHardwareError, + TapeDriveUnsupportedMedia, + TapeDriveScsiConnectionError, + TapeDriveTimetoClean, + TapeDriveCleanDriveNow, + TapeDriveMediaLifeExpired, + TapeDriveSnappedTape, +}} +pub const TRANSACTIONMANAGER_QUERY_INFORMATION: DWORD = 0x0001; +pub const TRANSACTIONMANAGER_SET_INFORMATION: DWORD = 0x0002; +pub const TRANSACTIONMANAGER_RECOVER: DWORD = 0x0004; +pub const TRANSACTIONMANAGER_RENAME: DWORD = 0x0008; +pub const TRANSACTIONMANAGER_CREATE_RM: DWORD = 0x0010; +pub const TRANSACTIONMANAGER_BIND_TRANSACTION: DWORD = 0x0020; +pub const TRANSACTIONMANAGER_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ + | TRANSACTIONMANAGER_QUERY_INFORMATION; +pub const TRANSACTIONMANAGER_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE + | TRANSACTIONMANAGER_SET_INFORMATION | TRANSACTIONMANAGER_RECOVER | TRANSACTIONMANAGER_RENAME + | TRANSACTIONMANAGER_CREATE_RM; +pub const TRANSACTIONMANAGER_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE; +pub const TRANSACTIONMANAGER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED + | TRANSACTIONMANAGER_GENERIC_READ | TRANSACTIONMANAGER_GENERIC_WRITE + | TRANSACTIONMANAGER_GENERIC_EXECUTE | TRANSACTIONMANAGER_BIND_TRANSACTION; +pub const TRANSACTION_QUERY_INFORMATION: DWORD = 0x0001; +pub const TRANSACTION_SET_INFORMATION: DWORD = 0x0002; +pub const TRANSACTION_ENLIST: DWORD = 0x0004; +pub const TRANSACTION_COMMIT: DWORD = 0x0008; +pub const TRANSACTION_ROLLBACK: DWORD = 0x0010; +pub const TRANSACTION_PROPAGATE: DWORD = 0x0020; +pub const TRANSACTION_RIGHT_RESERVED1: DWORD = 0x0040; +pub const TRANSACTION_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ | TRANSACTION_QUERY_INFORMATION + | SYNCHRONIZE; +pub const TRANSACTION_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE | TRANSACTION_SET_INFORMATION + | TRANSACTION_COMMIT | TRANSACTION_ENLIST | TRANSACTION_ROLLBACK | TRANSACTION_PROPAGATE + | SYNCHRONIZE; +pub const TRANSACTION_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | TRANSACTION_COMMIT + | TRANSACTION_ROLLBACK | SYNCHRONIZE; +pub const TRANSACTION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | TRANSACTION_GENERIC_READ + | TRANSACTION_GENERIC_WRITE | TRANSACTION_GENERIC_EXECUTE; +pub const TRANSACTION_RESOURCE_MANAGER_RIGHTS: DWORD = TRANSACTION_GENERIC_READ + | STANDARD_RIGHTS_WRITE | TRANSACTION_SET_INFORMATION | TRANSACTION_ENLIST + | TRANSACTION_ROLLBACK | TRANSACTION_PROPAGATE | SYNCHRONIZE; +pub const RESOURCEMANAGER_QUERY_INFORMATION: DWORD = 0x0001; +pub const RESOURCEMANAGER_SET_INFORMATION: DWORD = 0x0002; +pub const RESOURCEMANAGER_RECOVER: DWORD = 0x0004; +pub const RESOURCEMANAGER_ENLIST: DWORD = 0x0008; +pub const RESOURCEMANAGER_GET_NOTIFICATION: DWORD = 0x0010; +pub const RESOURCEMANAGER_REGISTER_PROTOCOL: DWORD = 0x0020; +pub const RESOURCEMANAGER_COMPLETE_PROPAGATION: DWORD = 0x0040; +pub const RESOURCEMANAGER_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ + | RESOURCEMANAGER_QUERY_INFORMATION | SYNCHRONIZE; +pub const RESOURCEMANAGER_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE + | RESOURCEMANAGER_SET_INFORMATION | RESOURCEMANAGER_RECOVER | RESOURCEMANAGER_ENLIST + | RESOURCEMANAGER_GET_NOTIFICATION | RESOURCEMANAGER_REGISTER_PROTOCOL + | RESOURCEMANAGER_COMPLETE_PROPAGATION | SYNCHRONIZE; +pub const RESOURCEMANAGER_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE + | RESOURCEMANAGER_RECOVER | RESOURCEMANAGER_ENLIST | RESOURCEMANAGER_GET_NOTIFICATION + | RESOURCEMANAGER_COMPLETE_PROPAGATION | SYNCHRONIZE; +pub const RESOURCEMANAGER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED + | RESOURCEMANAGER_GENERIC_READ | RESOURCEMANAGER_GENERIC_WRITE + | RESOURCEMANAGER_GENERIC_EXECUTE; +pub const ENLISTMENT_QUERY_INFORMATION: DWORD = 0x0001; +pub const ENLISTMENT_SET_INFORMATION: DWORD = 0x0002; +pub const ENLISTMENT_RECOVER: DWORD = 0x0004; +pub const ENLISTMENT_SUBORDINATE_RIGHTS: DWORD = 0x0008; +pub const ENLISTMENT_SUPERIOR_RIGHTS: DWORD = 0x0010; +pub const ENLISTMENT_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ | ENLISTMENT_QUERY_INFORMATION; +pub const ENLISTMENT_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE | ENLISTMENT_SET_INFORMATION + | ENLISTMENT_RECOVER | ENLISTMENT_SUBORDINATE_RIGHTS | ENLISTMENT_SUPERIOR_RIGHTS; +pub const ENLISTMENT_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | ENLISTMENT_RECOVER + | ENLISTMENT_SUBORDINATE_RIGHTS | ENLISTMENT_SUPERIOR_RIGHTS; +pub const ENLISTMENT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | ENLISTMENT_GENERIC_READ + | ENLISTMENT_GENERIC_WRITE | ENLISTMENT_GENERIC_EXECUTE; +ENUM!{enum TRANSACTION_OUTCOME { + TransactionOutcomeUndetermined = 1, + TransactionOutcomeCommitted, + TransactionOutcomeAborted, +}} +ENUM!{enum TRANSACTION_STATE { + TransactionStateNormal = 1, + TransactionStateIndoubt, + TransactionStateCommittedNotify, +}} +STRUCT!{struct TRANSACTION_BASIC_INFORMATION { + TransactionId: GUID, + State: DWORD, + Outcome: DWORD, +}} +pub type PTRANSACTION_BASIC_INFORMATION = *mut TRANSACTION_BASIC_INFORMATION; +STRUCT!{struct TRANSACTIONMANAGER_BASIC_INFORMATION { + TmIdentity: GUID, + VirtualClock: LARGE_INTEGER, +}} +pub type PTRANSACTIONMANAGER_BASIC_INFORMATION = *mut TRANSACTIONMANAGER_BASIC_INFORMATION; +STRUCT!{struct TRANSACTIONMANAGER_LOG_INFORMATION { + LogIdentity: GUID, +}} +pub type PTRANSACTIONMANAGER_LOG_INFORMATION = *mut TRANSACTIONMANAGER_LOG_INFORMATION; +STRUCT!{struct TRANSACTIONMANAGER_LOGPATH_INFORMATION { + LogPathLength: DWORD, + LogPath: [WCHAR; 1], +}} +pub type PTRANSACTIONMANAGER_LOGPATH_INFORMATION = *mut TRANSACTIONMANAGER_LOGPATH_INFORMATION; +STRUCT!{struct TRANSACTIONMANAGER_RECOVERY_INFORMATION { + LastRecoveredLsn: ULONGLONG, +}} +pub type PTRANSACTIONMANAGER_RECOVERY_INFORMATION = *mut TRANSACTIONMANAGER_RECOVERY_INFORMATION; +STRUCT!{struct TRANSACTIONMANAGER_OLDEST_INFORMATION { + OldestTransactionGuid: GUID, +}} +pub type PTRANSACTIONMANAGER_OLDEST_INFORMATION = *mut TRANSACTIONMANAGER_OLDEST_INFORMATION; +STRUCT!{struct TRANSACTION_PROPERTIES_INFORMATION { + IsolationLevel: DWORD, + IsolationFlags: DWORD, + Timeout: LARGE_INTEGER, + Outcome: DWORD, + DescriptionLength: DWORD, + Description: [WCHAR; 1], +}} +pub type PTRANSACTION_PROPERTIES_INFORMATION = *mut TRANSACTION_PROPERTIES_INFORMATION; +STRUCT!{struct TRANSACTION_BIND_INFORMATION { + TmHandle: HANDLE, +}} +pub type PTRANSACTION_BIND_INFORMATION = *mut TRANSACTION_BIND_INFORMATION; +STRUCT!{struct TRANSACTION_ENLISTMENT_PAIR { + EnlistmentId: GUID, + ResourceManagerId: GUID, +}} +pub type PTRANSACTION_ENLISTMENT_PAIR = *mut TRANSACTION_ENLISTMENT_PAIR; +STRUCT!{struct TRANSACTION_ENLISTMENTS_INFORMATION { + NumberOfEnlistments: DWORD, + EnlistmentPair: [TRANSACTION_ENLISTMENT_PAIR; 1], +}} +pub type PTRANSACTION_ENLISTMENTS_INFORMATION = *mut TRANSACTION_ENLISTMENTS_INFORMATION; +STRUCT!{struct TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION { + SuperiorEnlistmentPair: TRANSACTION_ENLISTMENT_PAIR, +}} +pub type PTRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION + = *mut TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION; +STRUCT!{struct RESOURCEMANAGER_BASIC_INFORMATION { + ResourceManagerId: GUID, + DescriptionLength: DWORD, + Description: [WCHAR; 1], +}} +pub type PRESOURCEMANAGER_BASIC_INFORMATION = *mut RESOURCEMANAGER_BASIC_INFORMATION; +STRUCT!{struct RESOURCEMANAGER_COMPLETION_INFORMATION { + IoCompletionPortHandle: HANDLE, + CompletionKey: ULONG_PTR, +}} +pub type PRESOURCEMANAGER_COMPLETION_INFORMATION = *mut RESOURCEMANAGER_COMPLETION_INFORMATION; +ENUM!{enum TRANSACTION_INFORMATION_CLASS { + TransactionBasicInformation, + TransactionPropertiesInformation, + TransactionEnlistmentInformation, + TransactionSuperiorEnlistmentInformation, + TransactionBindInformation, + TransactionDTCPrivateInformation, +}} +ENUM!{enum TRANSACTIONMANAGER_INFORMATION_CLASS { + TransactionManagerBasicInformation, + TransactionManagerLogInformation, + TransactionManagerLogPathInformation, + TransactionManagerRecoveryInformation = 4, + TransactionManagerOnlineProbeInformation = 3, + TransactionManagerOldestTransactionInformation = 5, +}} +ENUM!{enum RESOURCEMANAGER_INFORMATION_CLASS { + ResourceManagerBasicInformation, + ResourceManagerCompletionInformation, +}} +STRUCT!{struct ENLISTMENT_BASIC_INFORMATION { + EnlistmentId: GUID, + TransactionId: GUID, + ResourceManagerId: GUID, +}} +pub type PENLISTMENT_BASIC_INFORMATION = *mut ENLISTMENT_BASIC_INFORMATION; +STRUCT!{struct ENLISTMENT_CRM_INFORMATION { + CrmTransactionManagerId: GUID, + CrmResourceManagerId: GUID, + CrmEnlistmentId: GUID, +}} +pub type PENLISTMENT_CRM_INFORMATION = *mut ENLISTMENT_CRM_INFORMATION; +ENUM!{enum ENLISTMENT_INFORMATION_CLASS { + EnlistmentBasicInformation, + EnlistmentRecoveryInformation, + EnlistmentCrmInformation, +}} +STRUCT!{struct TRANSACTION_LIST_ENTRY { + UOW: UOW, +}} +pub type PTRANSACTION_LIST_ENTRY = *mut TRANSACTION_LIST_ENTRY; +STRUCT!{struct TRANSACTION_LIST_INFORMATION { + NumberOfTransactions: DWORD, + TransactionInformation: [TRANSACTION_LIST_ENTRY; 1], +}} +pub type PTRANSACTION_LIST_INFORMATION = *mut TRANSACTION_LIST_INFORMATION; +ENUM!{enum KTMOBJECT_TYPE { + KTMOBJECT_TRANSACTION, + KTMOBJECT_TRANSACTION_MANAGER, + KTMOBJECT_RESOURCE_MANAGER, + KTMOBJECT_ENLISTMENT, + KTMOBJECT_INVALID, +}} +pub type PKTMOBJECT_TYPE = *mut KTMOBJECT_TYPE; +STRUCT!{struct KTMOBJECT_CURSOR { + LastQuery: GUID, + ObjectIdCount: DWORD, + ObjectIds: [GUID; 1], +}} +pub type PKTMOBJECT_CURSOR = *mut KTMOBJECT_CURSOR; +pub type TP_VERSION = DWORD; +pub type PTP_VERSION = *mut DWORD; +STRUCT!{struct TP_CALLBACK_INSTANCE { + dummy: *mut c_void, +}} +pub type PTP_CALLBACK_INSTANCE = *mut TP_CALLBACK_INSTANCE; +FN!{stdcall PTP_SIMPLE_CALLBACK( + Instance: PTP_CALLBACK_INSTANCE, + Context: PVOID, +) -> ()} +STRUCT!{struct TP_POOL { + dummy: *mut c_void, +}} +pub type PTP_POOL = *mut TP_POOL; +ENUM!{enum TP_CALLBACK_PRIORITY { + TP_CALLBACK_PRIORITY_HIGH, + TP_CALLBACK_PRIORITY_NORMAL, + TP_CALLBACK_PRIORITY_LOW, + TP_CALLBACK_PRIORITY_INVALID, + TP_CALLBACK_PRIORITY_COUNT = TP_CALLBACK_PRIORITY_INVALID, +}} +STRUCT!{struct TP_POOL_STACK_INFORMATION { + StackReserve: SIZE_T, + StackCommit: SIZE_T, +}} +pub type PTP_POOL_STACK_INFORMATION = *mut TP_POOL_STACK_INFORMATION; +STRUCT!{struct TP_CLEANUP_GROUP { + dummy: *mut c_void, +}} +pub type PTP_CLEANUP_GROUP = *mut TP_CLEANUP_GROUP; +FN!{stdcall PTP_CLEANUP_GROUP_CANCEL_CALLBACK( + ObjectContext: PVOID, + CleanupContext: PVOID, +) -> ()} +STRUCT!{struct TP_CALLBACK_ENVIRON_V3_u_s { + BitFields: DWORD, +}} +BITFIELD!(TP_CALLBACK_ENVIRON_V3_u_s BitFields: DWORD [ + LongFunction set_LongFunction[0..1], + Persistent set_Persistent[1..2], + Private set_Private[2..32], +]); +UNION!{union TP_CALLBACK_ENVIRON_V3_u { + [u32; 1], + Flags Flags_mut: DWORD, + s s_mut: TP_CALLBACK_ENVIRON_V3_u_s, +}} +STRUCT!{struct TP_CALLBACK_ENVIRON_V3 { + Version: TP_VERSION, + Pool: PTP_POOL, + CleanupGroup: PTP_CLEANUP_GROUP, + CleanupGroupCancelCallback: PTP_CLEANUP_GROUP_CANCEL_CALLBACK, + RaceDll: PVOID, + ActivationContext: *mut ACTIVATION_CONTEXT, + FinalizationCallback: PTP_SIMPLE_CALLBACK, + u: TP_CALLBACK_ENVIRON_V3_u, + CallbackPriority: TP_CALLBACK_PRIORITY, + Size: DWORD, +}} +pub type TP_CALLBACK_ENVIRON = TP_CALLBACK_ENVIRON_V3; +pub type PTP_CALLBACK_ENVIRON = *mut TP_CALLBACK_ENVIRON_V3; +STRUCT!{struct TP_WORK { + dummy: *mut c_void, +}} +pub type PTP_WORK = *mut TP_WORK; +FN!{stdcall PTP_WORK_CALLBACK( + Instance: PTP_CALLBACK_INSTANCE, + Context: PVOID, + Work: PTP_WORK, +) -> ()} +STRUCT!{struct TP_TIMER { + dummy: *mut c_void, +}} +pub type PTP_TIMER = *mut TP_TIMER; +FN!{stdcall PTP_TIMER_CALLBACK( + Instance: PTP_CALLBACK_INSTANCE, + Context: PVOID, + Timer: PTP_TIMER, +) -> ()} +pub type TP_WAIT_RESULT = DWORD; +STRUCT!{struct TP_WAIT { + dummy: *mut c_void, +}} +pub type PTP_WAIT = *mut TP_WAIT; +FN!{stdcall PTP_WAIT_CALLBACK( + Instance: PTP_CALLBACK_INSTANCE, + Context: PVOID, + Wait: PTP_WAIT, + WaitResult: TP_WAIT_RESULT, +) -> ()} +STRUCT!{struct TP_IO { + dummy: *mut c_void, +}} +pub type PTP_IO = *mut TP_IO; +pub const ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION: ULONG = 1; +pub const ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION: ULONG = 2; +pub const ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION: ULONG = 3; +pub const ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION: ULONG = 4; +pub const ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION: ULONG = 5; +pub const ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION: ULONG = 6; +pub const ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION: ULONG = 7; +pub const ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE: ULONG = 8; +pub const ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES: ULONG = 9; +pub const ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS: ULONG = 10; +pub const ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO: ULONG = 11; +STRUCT!{struct ACTIVATION_CONTEXT { + dummy: *mut c_void, +}} diff --git a/src/vendor/winapi/src/um/winreg.rs b/src/vendor/winapi/src/um/winreg.rs new file mode 100644 index 0000000000..06fa43e90a --- /dev/null +++ b/src/vendor/winapi/src/um/winreg.rs @@ -0,0 +1,471 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::DWORD_PTR; +use shared::minwindef::{ + BOOL, BYTE, DWORD, HKEY, LPBYTE, LPCVOID, LPDWORD, PBOOL, PFILETIME, PHKEY, ULONG +}; +use um::minwinbase::LPSECURITY_ATTRIBUTES; +use um::winnt::{ACCESS_MASK, HANDLE, LONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID}; +pub type REGSAM = ACCESS_MASK; +STRUCT!{struct VALENTA { + ve_valuename: LPSTR, + ve_valuelen: DWORD, + ve_valueptr: DWORD_PTR, + ve_type: DWORD, +}} +pub type PVALENTA = *mut VALENTA; +STRUCT!{struct VALENTW { + ve_valuename: LPWSTR, + ve_valuelen: DWORD, + ve_valueptr: DWORD_PTR, + ve_type: DWORD, +}} +pub type PVALENTW = *mut VALENTW; +pub const HKEY_CLASSES_ROOT: HKEY = 0x80000000i32 as isize as HKEY; +pub const HKEY_CURRENT_USER: HKEY = 0x80000001i32 as isize as HKEY; +pub const HKEY_LOCAL_MACHINE: HKEY = 0x80000002i32 as isize as HKEY; +pub const HKEY_USERS: HKEY = 0x80000003i32 as isize as HKEY; +pub const HKEY_PERFORMANCE_DATA: HKEY = 0x80000004i32 as isize as HKEY; +pub const HKEY_PERFORMANCE_TEXT: HKEY = 0x80000050i32 as isize as HKEY; +pub const HKEY_PERFORMANCE_NLSTEXT: HKEY = 0x80000060i32 as isize as HKEY; +pub const HKEY_CURRENT_CONFIG: HKEY = 0x80000005i32 as isize as HKEY; +pub const HKEY_DYN_DATA: HKEY = 0x80000006i32 as isize as HKEY; +pub const HKEY_CURRENT_USER_LOCAL_SETTINGS: HKEY = 0x80000007i32 as isize as HKEY; +pub const REG_MUI_STRING_TRUNCATE: DWORD = 0x00000001; +pub const RRF_RT_REG_NONE: DWORD = 0x00000001; +pub const RRF_RT_REG_SZ: DWORD = 0x00000002; +pub const RRF_RT_REG_EXPAND_SZ: DWORD = 0x00000004; +pub const RRF_RT_REG_BINARY: DWORD = 0x00000008; +pub const RRF_RT_REG_DWORD: DWORD = 0x00000010; +pub const RRF_RT_REG_MULTI_SZ: DWORD = 0x00000020; +pub const RRF_RT_REG_QWORD: DWORD = 0x00000040; +pub const RRF_RT_DWORD: DWORD = RRF_RT_REG_BINARY | RRF_RT_REG_DWORD; +pub const RRF_RT_QWORD: DWORD = RRF_RT_REG_BINARY | RRF_RT_REG_QWORD; +pub const RRF_RT_ANY: DWORD = 0x0000ffff; +pub const RRF_NOEXPAND: DWORD = 0x10000000; +pub const RRF_ZEROONFAILURE: DWORD = 0x20000000; +extern "system" { + pub fn RegCloseKey( + hKey: HKEY + ) -> LONG; + pub fn RegOverridePredefKey( + hKey: HKEY, + hNewHKey: HKEY + ) -> LONG; + pub fn RegOpenUserClassesRoot( + hToken: HANDLE, + dwOptions: DWORD, + samDesired: REGSAM, + phkResult: PHKEY, + ) -> LONG; + pub fn RegOpenCurrentUser( + samDesired: REGSAM, + phkResult: PHKEY + ) -> LONG; + pub fn RegDisablePredefinedCache() -> LONG; + pub fn RegDisablePredefinedCacheEx() -> LONG; + pub fn RegConnectRegistryA( + lpMachineName: LPCSTR, + hKey: HKEY, + phkResult: PHKEY + ) -> LONG; + pub fn RegConnectRegistryW( + lpMachineName: LPCWSTR, + hKey: HKEY, + phkResult: PHKEY + ) -> LONG; + pub fn RegConnectRegistryExA( + lpMachineName: LPCSTR, + hKey: HKEY, + flags: ULONG, + phkResult: PHKEY + ) -> LONG; + pub fn RegConnectRegistryExW( + lpMachineName: LPCWSTR, + hKey: HKEY, + flags: ULONG, + phkResult: PHKEY + ) -> LONG; + pub fn RegCreateKeyA( + hKey: HKEY, + lpSubKey: LPCSTR, + phkResult: PHKEY + ); + pub fn RegCreateKeyW( + hKey: HKEY, + lpSubKey: LPCWSTR, + phkResult: PHKEY + ); + pub fn RegCreateKeyExA( + hKey: HKEY, + lpSubKey: LPCSTR, + Reserved: DWORD, + lpClass: LPSTR, + dwOptions: DWORD, + samDesired: REGSAM, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + phkResult: PHKEY, + lpdwDisposition: LPDWORD, + ) -> LONG; + pub fn RegCreateKeyExW( + hKey: HKEY, + lpSubKey: LPCWSTR, + Reserved: DWORD, + lpClass: LPWSTR, + dwOptions: DWORD, + samDesired: REGSAM, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + phkResult: PHKEY, + lpdwDisposition: LPDWORD, + ) -> LONG; + pub fn RegCreateKeyTransactedA( + hKey: HKEY, + lpSubKey: LPCSTR, + Reserved: DWORD, + lpClass: LPSTR, + dwOptions: DWORD, + samDesired: REGSAM, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + phkResult: PHKEY, + lpdwDisposition: LPDWORD, + hTransaction: HANDLE, + pExtendedParemeter: PVOID, + ) -> LONG; + pub fn RegCreateKeyTransactedW( + hKey: HKEY, + lpSubKey: LPCWSTR, + Reserved: DWORD, + lpClass: LPWSTR, + dwOptions: DWORD, + samDesired: REGSAM, + lpSecurityAttributes: LPSECURITY_ATTRIBUTES, + phkResult: PHKEY, + lpdwDisposition: LPDWORD, + hTransaction: HANDLE, + pExtendedParemeter: PVOID, + ) -> LONG; + pub fn RegDeleteKeyA( + hKey: HKEY, + lpSubKey: LPCSTR + ) -> LONG; + pub fn RegDeleteKeyW( + hKey: HKEY, + lpSubKey: LPCWSTR + ) -> LONG; + pub fn RegDeleteKeyExA( + hKey: HKEY, + lpSubKey: LPCSTR, + samDesired: REGSAM, + Reserved: DWORD, + ) -> LONG; + pub fn RegDeleteKeyExW( + hKey: HKEY, + lpSubKey: LPCWSTR, + samDesired: REGSAM, + Reserved: DWORD, + ) -> LONG; + pub fn RegDeleteKeyTransactedA( + hKey: HKEY, + lpSubKey: LPCSTR, + samDesired: REGSAM, + Reserved: DWORD, + hTransaction: HANDLE, + pExtendedParemeter: PVOID, + ) -> LONG; + pub fn RegDeleteKeyTransactedW( + hKey: HKEY, + lpSubKey: LPCWSTR, + samDesired: REGSAM, + Reserved: DWORD, + hTransaction: HANDLE, + pExtendedParemeter: PVOID, + ) -> LONG; + pub fn RegDisableReflectionKey( + hBase: HKEY + ) -> LONG; + pub fn RegEnableReflectionKey( + hBase: HKEY + ) -> LONG; + pub fn RegQueryReflectionKey( + hBase: HKEY, + bIsReflectionDisabled: PBOOL + ) -> LONG; + pub fn RegDeleteValueA( + hKey: HKEY, + lpValueName: LPCSTR + ) -> LONG; + pub fn RegDeleteValueW( + hKey: HKEY, + lpValueName: LPCWSTR + ) -> LONG; + // pub fn RegEnumKeyA(); + // pub fn RegEnumKeyW(); + pub fn RegEnumKeyExA( + hKey: HKEY, + dwIndex: DWORD, + lpName: LPSTR, + lpcName: LPDWORD, + lpReserved: LPDWORD, + lpClass: LPSTR, + lpcClass: LPDWORD, + lpftLastWriteTime: PFILETIME, + ) -> LONG; + pub fn RegEnumKeyExW( + hKey: HKEY, + dwIndex: DWORD, + lpName: LPWSTR, + lpcName: LPDWORD, + lpReserved: LPDWORD, + lpClass: LPWSTR, + lpcClass: LPDWORD, + lpftLastWriteTime: PFILETIME, + ) -> LONG; + pub fn RegEnumValueA( + hKey: HKEY, + dwIndex: DWORD, + lpValueName: LPSTR, + lpcchValueName: LPDWORD, + lpReserved: LPDWORD, + lpType: LPDWORD, + lpData: LPBYTE, + lpcbData: LPDWORD, + ) -> LONG; + pub fn RegEnumValueW( + hKey: HKEY, + dwIndex: DWORD, + lpValueName: LPWSTR, + lpcchValueName: LPDWORD, + lpReserved: LPDWORD, + lpType: LPDWORD, + lpData: LPBYTE, + lpcbData: LPDWORD, + ) -> LONG; + pub fn RegFlushKey( + hKey: HKEY + ) -> LONG; + // pub fn RegGetKeySecurity(); + // pub fn RegLoadKeyA(); + // pub fn RegLoadKeyW(); + pub fn RegNotifyChangeKeyValue( + hKey: HKEY, + bWatchSubtree: BOOL, + dwNotifyFilter: DWORD, + hEvent: HANDLE, + fAsynchronous: BOOL, + ) -> LONG; + // pub fn RegOpenKeyA(); + // pub fn RegOpenKeyW(); + pub fn RegOpenKeyExA( + hKey: HKEY, + lpSubKey: LPCSTR, + ulOptions: DWORD, + samDesired: REGSAM, + phkResult: PHKEY, + ) -> LONG; + pub fn RegOpenKeyExW( + hKey: HKEY, + lpSubKey: LPCWSTR, + ulOptions: DWORD, + samDesired: REGSAM, + phkResult: PHKEY, + ) -> LONG; + pub fn RegOpenKeyTransactedA( + hKey: HKEY, + lpSubKey: LPCSTR, + ulOptions: DWORD, + samDesired: REGSAM, + phkResult: PHKEY, + hTransaction: HANDLE, + pExtendedParemeter: PVOID, + ) -> LONG; + pub fn RegOpenKeyTransactedW( + hKey: HKEY, + lpSubKey: LPCWSTR, + ulOptions: DWORD, + samDesired: REGSAM, + phkResult: PHKEY, + hTransaction: HANDLE, + pExtendedParemeter: PVOID, + ) -> LONG; + pub fn RegQueryInfoKeyA( + hKey: HKEY, + lpClass: LPSTR, + lpcClass: LPDWORD, + lpReserved: LPDWORD, + lpcSubKeys: LPDWORD, + lpcMaxSubKeyLen: LPDWORD, + lpcMaxClassLen: LPDWORD, + lpcValues: LPDWORD, + lpcMaxValueNameLen: LPDWORD, + lpcMaxValueLen: LPDWORD, + lpcbSecurityDescriptor: LPDWORD, + lpftLastWriteTime: PFILETIME, + ) -> LONG; + pub fn RegQueryInfoKeyW( + hKey: HKEY, + lpClass: LPWSTR, + lpcClass: LPDWORD, + lpReserved: LPDWORD, + lpcSubKeys: LPDWORD, + lpcMaxSubKeyLen: LPDWORD, + lpcMaxClassLen: LPDWORD, + lpcValues: LPDWORD, + lpcMaxValueNameLen: LPDWORD, + lpcMaxValueLen: LPDWORD, + lpcbSecurityDescriptor: LPDWORD, + lpftLastWriteTime: PFILETIME, + ) -> LONG; + // pub fn RegQueryValueA(); + // pub fn RegQueryValueW(); + pub fn RegQueryMultipleValuesA( + hKey: HKEY, + val_list: PVALENTA, + num_vals: DWORD, + lpValueBuf: LPSTR, + ldwTotsize: LPDWORD, + ) -> LONG; + pub fn RegQueryMultipleValuesW( + hKey: HKEY, + val_list: PVALENTW, + num_vals: DWORD, + lpValueBuf: LPWSTR, + ldwTotsize: LPDWORD, + ) -> LONG; + pub fn RegQueryValueExA( + hKey: HKEY, + lpValueName: LPCSTR, + lpReserved: LPDWORD, + lpType: LPDWORD, + lpData: LPBYTE, + lpcbData: LPDWORD, + ) -> LONG; + pub fn RegQueryValueExW( + hKey: HKEY, + lpValueName: LPCWSTR, + lpReserved: LPDWORD, + lpType: LPDWORD, + lpData: LPBYTE, + lpcbData: LPDWORD, + ) -> LONG; + // pub fn RegReplaceKeyA(); + // pub fn RegReplaceKeyW(); + // pub fn RegRestoreKeyA(); + // pub fn RegRestoreKeyW(); + // pub fn RegRenameKey(); + // pub fn RegSaveKeyA(); + // pub fn RegSaveKeyW(); + // pub fn RegSetKeySecurity(); + // pub fn RegSetValueA(); + // pub fn RegSetValueW(); + pub fn RegSetValueExA( + hKey: HKEY, + lpValueName: LPCSTR, + Reserved: DWORD, + dwType: DWORD, + lpData: *const BYTE, + cbData: DWORD, + ) -> LONG; + pub fn RegSetValueExW( + hKey: HKEY, + lpValueName: LPCWSTR, + Reserved: DWORD, + dwType: DWORD, + lpData: *const BYTE, + cbData: DWORD, + ) -> LONG; + // pub fn RegUnLoadKeyA(); + // pub fn RegUnLoadKeyW(); + pub fn RegDeleteKeyValueA( + hKey: HKEY, + lpSubKey: LPCSTR, + lpValueName: LPCSTR + ) -> LONG; + pub fn RegDeleteKeyValueW( + hKey: HKEY, + lpSubKey: LPCWSTR, + lpValueName: LPCWSTR + ) -> LONG; + pub fn RegSetKeyValueA( + hKey: HKEY, + lpSubKey: LPCSTR, + lpValueName: LPCSTR, + dwType: DWORD, + lpData: LPCVOID, + cbData: DWORD, + ) -> LONG; + pub fn RegSetKeyValueW( + hKey: HKEY, + lpSubKey: LPCWSTR, + lpValueName: LPCWSTR, + dwType: DWORD, + lpData: LPCVOID, + cbData: DWORD, + ) -> LONG; + pub fn RegDeleteTreeA( + hKey: HKEY, + lpSubKey: LPCSTR + ) -> LONG; + pub fn RegDeleteTreeW( + hKey: HKEY, + lpSubKey: LPCWSTR + ) -> LONG; + pub fn RegCopyTreeA( + hKeySrc: HKEY, + lpSubKey: LPCSTR, + hKeyDest: HKEY + ) -> LONG; + pub fn RegGetValueA( + hkey: HKEY, + lpSubKey: LPCSTR, + lpValue: LPCSTR, + dwFlags: DWORD, + pdwType: LPDWORD, + pvData: PVOID, + pcbData: LPDWORD, + ) -> LONG; + pub fn RegGetValueW( + hkey: HKEY, + lpSubKey: LPCWSTR, + lpValue: LPCWSTR, + dwFlags: DWORD, + pdwType: LPDWORD, + pvData: PVOID, + pcbData: LPDWORD, + ) -> LONG; + pub fn RegCopyTreeW( + hKeySrc: HKEY, + lpSubKey: LPCWSTR, + hKeyDest: HKEY + ) -> LONG; + // pub fn RegLoadMUIStringA(); + pub fn RegLoadMUIStringW( + hKey: HKEY, + pszValue: LPCWSTR, + pszOutBuf: LPWSTR, + cbOutBuf: DWORD, + pcbData: LPDWORD, + Flags: DWORD, + pszDirectory: LPCWSTR, + ) -> LONG; + // pub fn RegLoadAppKeyA(); + // pub fn RegLoadAppKeyW(); + // pub fn InitiateSystemShutdownA(); + // pub fn InitiateSystemShutdownW(); + pub fn AbortSystemShutdownA( + lpMachineName: LPCSTR + ) -> BOOL; + pub fn AbortSystemShutdownW( + lpMachineName: LPWSTR + ) -> BOOL; + // pub fn InitiateSystemShutdownExA(); + // pub fn InitiateSystemShutdownExW(); + // pub fn InitiateShutdownA(); + // pub fn InitiateShutdownW(); + // pub fn CheckForHiberboot(); + // pub fn RegSaveKeyExA(); + // pub fn RegSaveKeyExW(); +} diff --git a/src/vendor/winapi/src/um/winscard.rs b/src/vendor/winapi/src/um/winscard.rs new file mode 100644 index 0000000000..bfc87eddd2 --- /dev/null +++ b/src/vendor/winapi/src/um/winscard.rs @@ -0,0 +1,710 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Data Protection API Prototypes and Definitions +// This header file provides the definitions and symbols necessary for an +// Application or Smart Card Service Provider to access the Smartcard Subsystem. +use shared::basetsd::ULONG_PTR; +use shared::guiddef::{LPCGUID, LPGUID}; +use shared::minwindef::{BOOL, BYTE, DWORD, LPBYTE, LPCVOID, LPDWORD, LPVOID, PBYTE}; +use shared::rpcdce::UUID; +use shared::windef::{HICON, HWND}; +use um::winnt::{CHAR, HANDLE, LONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PVOID, WCHAR}; +use um::winsmcrd::{LPCSCARD_IO_REQUEST, LPSCARD_IO_REQUEST}; +pub type LPCBYTE = *const BYTE; +pub type SCARDCONTEXT = ULONG_PTR; +pub type PSCARDCONTEXT = *mut SCARDCONTEXT; +pub type LPSCARDCONTEXT = *mut SCARDCONTEXT; +pub type SCARDHANDLE = ULONG_PTR; +pub type PSCARDHANDLE = *mut SCARDHANDLE; +pub type LPSCARDHANDLE = *mut SCARDHANDLE; +pub const SCARD_AUTOALLOCATE: DWORD = -1i32 as u32; +pub const SCARD_SCOPE_USER: DWORD = 0; +pub const SCARD_SCOPE_TERMINAL: DWORD = 1; +pub const SCARD_SCOPE_SYSTEM: DWORD = 2; +extern "system" { + pub fn SCardEstablishContext( + dwScope: DWORD, + pvReserved1: LPCVOID, + pvReserved2: LPCVOID, + phContext: LPSCARDCONTEXT, + ) -> LONG; + pub fn SCardReleaseContext( + hContext: SCARDCONTEXT, + ) -> LONG; + pub fn SCardIsValidContext( + hContext: SCARDCONTEXT, + ) -> LONG; +} +pub const SCARD_PROVIDER_PRIMARY: DWORD = 1; +pub const SCARD_PROVIDER_CSP: DWORD = 2; +pub const SCARD_PROVIDER_KSP: DWORD = 3; +extern "system" { + pub fn SCardListReaderGroupsA( + hContext: SCARDCONTEXT, + mszGroups: LPSTR, + pcchGroups: LPDWORD, + ) -> LONG; + pub fn SCardListReaderGroupsW( + hContext: SCARDCONTEXT, + mszGroups: LPWSTR, + pcchGroups: LPDWORD, + ) -> LONG; + pub fn SCardListReadersA( + hContext: SCARDCONTEXT, + mszGroups: LPCSTR, + mszReaders: LPSTR, + pcchReaders: LPDWORD, + ) -> LONG; + pub fn SCardListReadersW( + hContext: SCARDCONTEXT, + mszGroups: LPCWSTR, + mszReaders: LPWSTR, + pcchReaders: LPDWORD, + ) -> LONG; + pub fn SCardListCardsA( + hContext: SCARDCONTEXT, + pbAtr: LPCBYTE, + rgquidInterfaces: LPCGUID, + cguidInterfaceCount: DWORD, + mszCards: *mut CHAR, + pcchCards: LPDWORD, + ) -> LONG; + pub fn SCardListCardsW( + hContext: SCARDCONTEXT, + pbAtr: LPCBYTE, + rgquidInterfaces: LPCGUID, + cguidInterfaceCount: DWORD, + mszCards: *mut WCHAR, + pcchCards: LPDWORD, + ) -> LONG; + pub fn SCardListInterfacesA( + hContext: SCARDCONTEXT, + szCard: LPCSTR, + pguidInterfaces: LPGUID, + pcguidInterfaces: LPDWORD, + ) -> LONG; + pub fn SCardListInterfacesW( + hContext: SCARDCONTEXT, + szCard: LPCWSTR, + pguidInterfaces: LPGUID, + pcguidInterfaces: LPDWORD, + ) -> LONG; + pub fn SCardGetProviderIdA( + hContext: SCARDCONTEXT, + szCard: LPCSTR, + pguidProviderId: LPGUID, + ) -> LONG; + pub fn SCardGetProviderIdW( + hContext: SCARDCONTEXT, + szCard: LPCWSTR, + pguidProviderId: LPGUID, + ) -> LONG; + pub fn SCardGetCardTypeProviderNameA( + hContext: SCARDCONTEXT, + szCardName: LPCSTR, + dwProviderId: DWORD, + szProvider: *mut CHAR, + pcchProvider: LPDWORD, + ) -> LONG; + pub fn SCardGetCardTypeProviderNameW( + hContext: SCARDCONTEXT, + szCardName: LPCWSTR, + dwProviderId: DWORD, + szProvider: *mut WCHAR, + pcchProvider: LPDWORD, + ) -> LONG; + pub fn SCardIntroduceReaderGroupA( + hContext: SCARDCONTEXT, + szGroupName: LPCSTR, + ) -> LONG; + pub fn SCardIntroduceReaderGroupW( + hContext: SCARDCONTEXT, + szGroupName: LPCWSTR, + ) -> LONG; + pub fn SCardForgetReaderGroupA( + hContext: SCARDCONTEXT, + szGroupName: LPCSTR, + ) -> LONG; + pub fn SCardForgetReaderGroupW( + hContext: SCARDCONTEXT, + szGroupName: LPCWSTR, + ) -> LONG; + pub fn SCardIntroduceReaderA( + hContext: SCARDCONTEXT, + szReaderName: LPCSTR, + szDeviceName: LPCSTR, + ) -> LONG; + pub fn SCardIntroduceReaderW( + hContext: SCARDCONTEXT, + szReaderName: LPCWSTR, + szDeviceName: LPCWSTR, + ) -> LONG; + pub fn SCardForgetReaderA( + hContext: SCARDCONTEXT, + szReaderName: LPCSTR, + ) -> LONG; + pub fn SCardForgetReaderW( + hContext: SCARDCONTEXT, + szReaderName: LPCWSTR, + ) -> LONG; + pub fn SCardAddReaderToGroupA( + hContext: SCARDCONTEXT, + szReaderName: LPCSTR, + szGroupName: LPCSTR, + ) -> LONG; + pub fn SCardAddReaderToGroupW( + hContext: SCARDCONTEXT, + szReaderName: LPCWSTR, + szGroupName: LPCWSTR, + ) -> LONG; + pub fn SCardRemoveReaderFromGroupA( + hContext: SCARDCONTEXT, + szReaderName: LPCSTR, + szGroupName: LPCSTR, + ) -> LONG; + pub fn SCardRemoveReaderFromGroupW( + hContext: SCARDCONTEXT, + szReaderName: LPCWSTR, + szGroupName: LPCWSTR, + ) -> LONG; + pub fn SCardIntroduceCardTypeA( + hContext: SCARDCONTEXT, + szCardName: LPCSTR, + pguidPrimaryProvider: LPCGUID, + rgguidInterfaces: LPCGUID, + dwInterfaceCount: DWORD, + pbAtr: LPCBYTE, + pbAtrMask: LPCBYTE, + cbAtrLen: DWORD, + ) -> LONG; + pub fn SCardIntroduceCardTypeW( + hContext: SCARDCONTEXT, + szCardName: LPCWSTR, + pguidPrimaryProvider: LPCGUID, + rgguidInterfaces: LPCGUID, + dwInterfaceCount: DWORD, + pbAtr: LPCBYTE, + pbAtrMask: LPCBYTE, + cbAtrLen: DWORD, + ) -> LONG; + pub fn SCardSetCardTypeProviderNameA( + hContext: SCARDCONTEXT, + szCardName: LPCSTR, + dwProviderId: DWORD, + szProvider: LPCSTR, + ) -> LONG; + pub fn SCardSetCardTypeProviderNameW( + hContext: SCARDCONTEXT, + szCardName: LPCWSTR, + dwProviderId: DWORD, + szProvider: LPCWSTR, + ) -> LONG; + pub fn SCardForgetCardTypeA( + hContext: SCARDCONTEXT, + szCardName: LPCSTR, + ) -> LONG; + pub fn SCardForgetCardTypeW( + hContext: SCARDCONTEXT, + szCardName: LPCWSTR, + ) -> LONG; + pub fn SCardFreeMemory( + hContext: SCARDCONTEXT, + pvMem: LPCVOID, + ) -> LONG; + pub fn SCardAccessStartedEvent() -> HANDLE; + pub fn SCardReleaseStartedEvent(); +} +STRUCT!{struct SCARD_READERSTATEA { + szReader: LPCSTR, + pvUserData: LPVOID, + dwCurrentState: DWORD, + dwEventState: DWORD, + cbAtr: DWORD, + rgbAtr: [BYTE; 36], +}} +pub type PSCARD_READERSTATEA = *mut SCARD_READERSTATEA; +pub type LPSCARD_READERSTATEA = *mut SCARD_READERSTATEA; +STRUCT!{struct SCARD_READERSTATEW { + szReader: LPCWSTR, + pvUserData: LPVOID, + dwCurrentState: DWORD, + dwEventState: DWORD, + cbAtr: DWORD, + rgbAtr: [BYTE; 36], +}} +pub type PSCARD_READERSTATEW = *mut SCARD_READERSTATEW; +pub type LPSCARD_READERSTATEW = *mut SCARD_READERSTATEW; +pub type SCARD_READERSTATE_A = SCARD_READERSTATEA; +pub type SCARD_READERSTATE_W = SCARD_READERSTATEW; +pub type PSCARD_READERSTATE_A = PSCARD_READERSTATEA; +pub type PSCARD_READERSTATE_W = PSCARD_READERSTATEW; +pub type LPSCARD_READERSTATE_A = LPSCARD_READERSTATEA; +pub type LPSCARD_READERSTATE_W = LPSCARD_READERSTATEW; +pub const SCARD_STATE_UNAWARE: DWORD = 0x00000000; +pub const SCARD_STATE_IGNORE: DWORD = 0x00000001; +pub const SCARD_STATE_CHANGED: DWORD = 0x00000002; +pub const SCARD_STATE_UNKNOWN: DWORD = 0x00000004; +pub const SCARD_STATE_UNAVAILABLE: DWORD = 0x00000008; +pub const SCARD_STATE_EMPTY: DWORD = 0x00000010; +pub const SCARD_STATE_PRESENT: DWORD = 0x00000020; +pub const SCARD_STATE_ATRMATCH: DWORD = 0x00000040; +pub const SCARD_STATE_EXCLUSIVE: DWORD = 0x00000080; +pub const SCARD_STATE_INUSE: DWORD = 0x00000100; +pub const SCARD_STATE_MUTE: DWORD = 0x00000200; +pub const SCARD_STATE_UNPOWERED: DWORD = 0x00000400; +extern "system" { + pub fn SCardLocateCardsA( + hContext: SCARDCONTEXT, + mszCards: LPCSTR, + rgReaderStates: LPSCARD_READERSTATEA, + cReaders: DWORD, + ) -> LONG; + pub fn SCardLocateCardsW( + hContext: SCARDCONTEXT, + mszCards: LPCWSTR, + rgReaderStates: LPSCARD_READERSTATEW, + cReaders: DWORD, + ) -> LONG; +} +STRUCT!{struct SCARD_ATRMASK { + cbAtr: DWORD, + rgbAtr: [BYTE; 36], + rgbMask: [BYTE; 36], +}} +pub type PSCARD_ATRMASK = *mut SCARD_ATRMASK; +pub type LPSCARD_ATRMASK = *mut SCARD_ATRMASK; +extern "system" { + pub fn SCardLocateCardsByATRA( + hContext: SCARDCONTEXT, + rgAtrMasks: LPSCARD_ATRMASK, + cAtrs: DWORD, + rgReaderStates: LPSCARD_READERSTATEA, + cReaders: DWORD, + ) -> LONG; + pub fn SCardLocateCardsByATRW( + hContext: SCARDCONTEXT, + rgAtrMasks: LPSCARD_ATRMASK, + cAtrs: DWORD, + rgReaderStates: LPSCARD_READERSTATEW, + cReaders: DWORD, + ) -> LONG; + pub fn SCardGetStatusChangeA( + hContext: SCARDCONTEXT, + dwTimeout: DWORD, + rgReaderStates: LPSCARD_READERSTATEA, + cReaders: DWORD, + ) -> LONG; + pub fn SCardGetStatusChangeW( + hContext: SCARDCONTEXT, + dwTimeout: DWORD, + rgReaderStates: LPSCARD_READERSTATEW, + cReaders: DWORD, + ) -> LONG; + pub fn SCardCancel( + hContext: SCARDCONTEXT, + ) -> LONG; +} +pub const SCARD_SHARE_EXCLUSIVE: DWORD = 1; +pub const SCARD_SHARE_SHARED: DWORD = 2; +pub const SCARD_SHARE_DIRECT: DWORD = 3; +pub const SCARD_LEAVE_CARD: DWORD = 0; +pub const SCARD_RESET_CARD: DWORD = 1; +pub const SCARD_UNPOWER_CARD: DWORD = 2; +pub const SCARD_EJECT_CARD: DWORD = 3; +extern "system" { + pub fn SCardConnectA( + hContext: SCARDCONTEXT, + szReader: LPCSTR, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + phCard: LPSCARDHANDLE, + pdwActiveProtocol: LPDWORD, + ) -> LONG; + pub fn SCardConnectW( + hContext: SCARDCONTEXT, + szReader: LPCWSTR, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + phCard: LPSCARDHANDLE, + pdwActiveProtocol: LPDWORD, + ) -> LONG; + pub fn SCardReconnect( + hCard: SCARDHANDLE, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + dwInitialization: DWORD, + pdwActiveProtocol: LPDWORD, + ) -> LONG; + pub fn SCardDisconnect( + hCard: SCARDHANDLE, + dwDisposition: DWORD, + ) -> LONG; + pub fn SCardBeginTransaction( + hCard: SCARDHANDLE, + ) -> LONG; + pub fn SCardEndTransaction( + hCard: SCARDHANDLE, + dwDisposition: DWORD, + ) -> LONG; + pub fn SCardState( + hCard: SCARDHANDLE, + pdwState: LPDWORD, + pdwProtocol: LPDWORD, + pbAtr: LPBYTE, + pcbAtrLen: LPDWORD, + ) -> LONG; + pub fn SCardStatusA( + hCard: SCARDHANDLE, + mszReaderNames: LPSTR, + pcchReaderLen: LPDWORD, + pdwState: LPDWORD, + pdwProtocol: LPDWORD, + pbAtr: LPBYTE, + pcbAtrLen: LPDWORD, + ) -> LONG; + pub fn SCardStatusW( + hCard: SCARDHANDLE, + mszReaderNames: LPWSTR, + pcchReaderLen: LPDWORD, + pdwState: LPDWORD, + pdwProtocol: LPDWORD, + pbAtr: LPBYTE, + pcbAtrLen: LPDWORD, + ) -> LONG; + pub fn SCardTransmit( + hCard: SCARDHANDLE, + pioSendPci: LPCSCARD_IO_REQUEST, + pbSendBuffer: LPCBYTE, + cbSendLength: DWORD, + pioRecvPci: LPSCARD_IO_REQUEST, + pbRecvBuffer: LPBYTE, + pcbRecvLength: LPDWORD, + ) -> LONG; + pub fn SCardGetTransmitCount( + hCard: SCARDHANDLE, + pcTransmitCount: LPDWORD, + ) -> LONG; + pub fn SCardControl( + hCard: SCARDHANDLE, + dwControlCode: DWORD, + lpInBuffer: LPCVOID, + cbInBufferSize: DWORD, + lpOutBuffer: LPVOID, + cbOutBufferSize: DWORD, + lpBytesReturned: LPDWORD, + ) -> LONG; + pub fn SCardGetAttrib( + hCard: SCARDHANDLE, + dwAttrId: DWORD, + pbAttr: LPBYTE, + pcbAttrLen: LPDWORD, + ) -> LONG; + pub fn SCardSetAttrib( + hCard: SCARDHANDLE, + dwAttrId: DWORD, + pbAttr: LPCBYTE, + cbAttrLen: DWORD, + ) -> LONG; +} +pub const SC_DLG_MINIMAL_UI: DWORD = 0x01; +pub const SC_DLG_NO_UI: DWORD = 0x02; +pub const SC_DLG_FORCE_UI: DWORD = 0x04; +pub const SCERR_NOCARDNAME: DWORD = 0x4000; +pub const SCERR_NOGUIDS: DWORD = 0x8000; +FN!{stdcall LPOCNCONNPROCA( + SCARDCONTEXT, + LPSTR, + LPSTR, + PVOID, +) -> SCARDHANDLE} +FN!{stdcall LPOCNCONNPROCW( + SCARDCONTEXT, + LPWSTR, + LPWSTR, + PVOID, +) -> SCARDHANDLE} +FN!{stdcall LPOCNCHKPROC( + SCARDCONTEXT, + SCARDHANDLE, + PVOID, +) -> BOOL} +FN!{stdcall LPOCNDSCPROC( + SCARDCONTEXT, + SCARDHANDLE, + PVOID, +) -> ()} +STRUCT!{struct OPENCARD_SEARCH_CRITERIAA { + dwStructSize: DWORD, + lpstrGroupNames: LPSTR, + nMaxGroupNames: DWORD, + rgguidInterfaces: LPCGUID, + cguidInterfaces: DWORD, + lpstrCardNames: LPSTR, + nMaxCardNames: DWORD, + lpfnCheck: LPOCNCHKPROC, + lpfnConnect: LPOCNCONNPROCA, + lpfnDisconnect: LPOCNDSCPROC, + pvUserData: LPVOID, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, +}} +pub type POPENCARD_SEARCH_CRITERIAA = *mut OPENCARD_SEARCH_CRITERIAA; +pub type LPOPENCARD_SEARCH_CRITERIAA = *mut OPENCARD_SEARCH_CRITERIAA; +STRUCT!{struct OPENCARD_SEARCH_CRITERIAW { + dwStructSize: DWORD, + lpstrGroupNames: LPWSTR, + nMaxGroupNames: DWORD, + rgguidInterfaces: LPCGUID, + cguidInterfaces: DWORD, + lpstrCardNames: LPWSTR, + nMaxCardNames: DWORD, + lpfnCheck: LPOCNCHKPROC, + lpfnConnect: LPOCNCONNPROCW, + lpfnDisconnect: LPOCNDSCPROC, + pvUserData: LPVOID, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, +}} +pub type POPENCARD_SEARCH_CRITERIAW = *mut OPENCARD_SEARCH_CRITERIAW; +pub type LPOPENCARD_SEARCH_CRITERIAW = *mut OPENCARD_SEARCH_CRITERIAW; +STRUCT!{struct OPENCARDNAME_EXA { + dwStructSize: DWORD, + hSCardContext: SCARDCONTEXT, + hwndOwner: HWND, + dwFlags: DWORD, + lpstrTitle: LPCSTR, + lpstrSearchDesc: LPCSTR, + hIcon: HICON, + pOpenCardSearchCriteria: POPENCARD_SEARCH_CRITERIAA, + lpfnConnect: LPOCNCONNPROCA, + pvUserData: LPVOID, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + lpstrRdr: LPSTR, + nMaxRdr: DWORD, + lpstrCard: LPSTR, + nMaxCard: DWORD, + dwActiveProtocol: DWORD, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAME_EXA = *mut OPENCARDNAME_EXA; +pub type LPOPENCARDNAME_EXA = *mut OPENCARDNAME_EXA; +STRUCT!{struct OPENCARDNAME_EXW { + dwStructSize: DWORD, + hSCardContext: SCARDCONTEXT, + hwndOwner: HWND, + dwFlags: DWORD, + lpstrTitle: LPCWSTR, + lpstrSearchDesc: LPCWSTR, + hIcon: HICON, + pOpenCardSearchCriteria: POPENCARD_SEARCH_CRITERIAW, + lpfnConnect: LPOCNCONNPROCW, + pvUserData: LPVOID, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + lpstrRdr: LPWSTR, + nMaxRdr: DWORD, + lpstrCard: LPWSTR, + nMaxCard: DWORD, + dwActiveProtocol: DWORD, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAME_EXW = *mut OPENCARDNAME_EXW; +pub type LPOPENCARDNAME_EXW = *mut OPENCARDNAME_EXW; +pub type OPENCARDNAMEA_EX = OPENCARDNAME_EXA; +pub type OPENCARDNAMEW_EX = OPENCARDNAME_EXW; +pub type POPENCARDNAMEA_EX = POPENCARDNAME_EXA; +pub type POPENCARDNAMEW_EX = POPENCARDNAME_EXW; +pub type LPOPENCARDNAMEA_EX = LPOPENCARDNAME_EXA; +pub type LPOPENCARDNAMEW_EX = LPOPENCARDNAME_EXW; +pub const SCARD_READER_SEL_AUTH_PACKAGE: DWORD = -629i32 as u32; +ENUM!{enum READER_SEL_REQUEST_MATCH_TYPE { + RSR_MATCH_TYPE_READER_AND_CONTAINER = 1, + RSR_MATCH_TYPE_SERIAL_NUMBER, + RSR_MATCH_TYPE_ALL_CARDS, +}} +STRUCT!{struct READER_SEL_REQUEST_ReaderAndContainerParameter { + cbReaderNameOffset: DWORD, + cchReaderNameLength: DWORD, + cbContainerNameOffset: DWORD, + cchContainerNameLength: DWORD, + dwDesiredCardModuleVersion: DWORD, + dwCspFlags: DWORD, +}} +STRUCT!{struct READER_SEL_REQUEST_SerialNumberParameter { + cbSerialNumberOffset: DWORD, + cbSerialNumberLength: DWORD, + dwDesiredCardModuleVersion: DWORD, +}} +UNION!{union READER_SEL_REQUEST_u { + [u32; 6], + ReaderAndContainerParameter ReaderAndContainerParameter_mut: + READER_SEL_REQUEST_ReaderAndContainerParameter, + SerialNumberParameter SerialNumberParameter_mut: READER_SEL_REQUEST_SerialNumberParameter, +}} +STRUCT!{struct READER_SEL_REQUEST { + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + MatchType: READER_SEL_REQUEST_MATCH_TYPE, + u: READER_SEL_REQUEST_u, +}} +pub type PREADER_SEL_REQUEST = *mut READER_SEL_REQUEST; +STRUCT!{struct READER_SEL_RESPONSE { + cbReaderNameOffset: DWORD, + cchReaderNameLength: DWORD, + cbCardNameOffset: DWORD, + cchCardNameLength: DWORD, +}} +pub type PREADER_SEL_RESPONSE = *mut READER_SEL_RESPONSE; +STRUCT!{struct OPENCARDNAMEA { + dwStructSize: DWORD, + hwndOwner: HWND, + hSCardContext: SCARDCONTEXT, + lpstrGroupNames: LPSTR, + nMaxGroupNames: DWORD, + lpstrCardNames: LPSTR, + nMaxCardNames: DWORD, + rgguidInterfaces: LPCGUID, + cguidInterfaces: DWORD, + lpstrRdr: LPSTR, + nMaxRdr: DWORD, + lpstrCard: LPSTR, + nMaxCard: DWORD, + lpstrTitle: LPCSTR, + dwFlags: DWORD, + pvUserData: LPVOID, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + dwActiveProtocol: DWORD, + lpfnConnect: LPOCNCONNPROCA, + lpfnCheck: LPOCNCHKPROC, + lpfnDisconnect: LPOCNDSCPROC, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAMEA = *mut OPENCARDNAMEA; +pub type LPOPENCARDNAMEA = *mut OPENCARDNAMEA; +STRUCT!{struct OPENCARDNAMEW { + dwStructSize: DWORD, + hwndOwner: HWND, + hSCardContext: SCARDCONTEXT, + lpstrGroupNames: LPWSTR, + nMaxGroupNames: DWORD, + lpstrCardNames: LPWSTR, + nMaxCardNames: DWORD, + rgguidInterfaces: LPCGUID, + cguidInterfaces: DWORD, + lpstrRdr: LPWSTR, + nMaxRdr: DWORD, + lpstrCard: LPWSTR, + nMaxCard: DWORD, + lpstrTitle: LPCWSTR, + dwFlags: DWORD, + pvUserData: LPVOID, + dwShareMode: DWORD, + dwPreferredProtocols: DWORD, + dwActiveProtocol: DWORD, + lpfnConnect: LPOCNCONNPROCW, + lpfnCheck: LPOCNCHKPROC, + lpfnDisconnect: LPOCNDSCPROC, + hCardHandle: SCARDHANDLE, +}} +pub type POPENCARDNAMEW = *mut OPENCARDNAMEW; +pub type LPOPENCARDNAMEW = *mut OPENCARDNAMEW; +pub type OPENCARDNAME_A = OPENCARDNAMEA; +pub type OPENCARDNAME_W = OPENCARDNAMEW; +pub type POPENCARDNAME_A = POPENCARDNAMEA; +pub type POPENCARDNAME_W = POPENCARDNAMEW; +pub type LPOPENCARDNAME_A = LPOPENCARDNAMEA; +pub type LPOPENCARDNAME_W = LPOPENCARDNAMEW; +extern "system" { + pub fn SCardReadCacheA( + hContext: SCARDCONTEXT, + CardIdentifier: *mut UUID, + FreshnessCounter: DWORD, + LookupName: LPSTR, + Data: PBYTE, + DataLen: *mut DWORD, + ) -> LONG; + pub fn SCardReadCacheW( + hContext: SCARDCONTEXT, + CardIdentifier: *mut UUID, + FreshnessCounter: DWORD, + LookupName: LPWSTR, + Data: PBYTE, + DataLen: *mut DWORD, + ) -> LONG; + pub fn SCardWriteCacheA( + hContext: SCARDCONTEXT, + CardIdentifier: *mut UUID, + FreshnessCounter: DWORD, + LookupName: LPSTR, + Data: PBYTE, + DataLen: DWORD, + ) -> LONG; + pub fn SCardWriteCacheW( + hContext: SCARDCONTEXT, + CardIdentifier: *mut UUID, + FreshnessCounter: DWORD, + LookupName: LPWSTR, + Data: PBYTE, + DataLen: DWORD, + ) -> LONG; + pub fn SCardGetReaderIconA( + hContext: SCARDCONTEXT, + szReaderName: LPCSTR, + pbIcon: LPBYTE, + pcbIcon: LPDWORD, + ) -> LONG; + pub fn SCardGetReaderIconW( + hContext: SCARDCONTEXT, + szReaderName: LPCWSTR, + pbIcon: LPBYTE, + pcbIcon: LPDWORD, + ) -> LONG; + pub fn SCardGetDeviceTypeIdA( + hContext: SCARDCONTEXT, + szReaderName: LPCSTR, + pdwDeviceTypeId: LPDWORD, + ) -> LONG; + pub fn SCardGetDeviceTypeIdW( + hContext: SCARDCONTEXT, + szReaderName: LPCWSTR, + pdwDeviceTypeId: LPDWORD, + ) -> LONG; + pub fn SCardGetReaderDeviceInstanceIdA( + hContext: SCARDCONTEXT, + szReaderName: LPCSTR, + szDeviceInstanceId: LPSTR, + pcchDeviceInstanceId: LPDWORD, + ) -> LONG; + pub fn SCardGetReaderDeviceInstanceIdW( + hContext: SCARDCONTEXT, + szReaderName: LPCWSTR, + szDeviceInstanceId: LPWSTR, + pcchDeviceInstanceId: LPDWORD, + ) -> LONG; + pub fn SCardListReadersWithDeviceInstanceIdA( + hContext: SCARDCONTEXT, + szDeviceInstanceId: LPCSTR, + mszReaders: LPSTR, + pcchReaders: LPDWORD, + ) -> LONG; + pub fn SCardListReadersWithDeviceInstanceIdW( + hContext: SCARDCONTEXT, + szDeviceInstanceId: LPCWSTR, + mszReaders: LPWSTR, + pcchReaders: LPDWORD, + ) -> LONG; +} +pub const SCARD_AUDIT_CHV_FAILURE: DWORD = 0x0; +pub const SCARD_AUDIT_CHV_SUCCESS: DWORD = 0x1; +extern "system" { + pub fn SCardAudit( + hContext: SCARDCONTEXT, + dwEvent: DWORD, + ) -> LONG; +} diff --git a/src/vendor/winapi/src/um/winsmcrd.rs b/src/vendor/winapi/src/um/winsmcrd.rs new file mode 100644 index 0000000000..e8e7601e50 --- /dev/null +++ b/src/vendor/winapi/src/um/winsmcrd.rs @@ -0,0 +1,167 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Smart Card class/port IOCTL codes. +use shared::minwindef::{BYTE, DWORD, ULONG, WORD}; +use um::winioctl::{FILE_ANY_ACCESS, FILE_DEVICE_SMARTCARD, METHOD_BUFFERED}; +pub type UWORD = WORD; +DEFINE_GUID!(GUID_DEVINTERFACE_SMARTCARD_READER, 0x50DD5230, 0xBA8A, 0x11D1, + 0xBF, 0x5D, 0x00, 0x00, 0xF8, 0x05, 0xF5, 0x30); +pub const SCARD_ATR_LENGTHL: DWORD = 33; +pub const SCARD_PROTOCOL_UNDEFINED: DWORD = 0x00000000; +pub const SCARD_PROTOCOL_T0: DWORD = 0x00000001; +pub const SCARD_PROTOCOL_T1: DWORD = 0x00000002; +pub const SCARD_PROTOCOL_RAW: DWORD = 0x00010000; +pub const SCARD_PROTOCOL_Tx: DWORD = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1; +pub const SCARD_PROTOCOL_DEFAULT: DWORD = 0x80000000; +pub const SCARD_PROTOCOL_OPTIMAL: DWORD = 0x00000000; +pub const SCARD_POWER_DOWN: DWORD = 0; +pub const SCARD_COLD_RESET: DWORD = 1; +pub const SCARD_WARM_RESET: DWORD = 2; +pub const IOCTL_SMARTCARD_POWER: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 1, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_ATTRIBUTE: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 2, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_SET_ATTRIBUTE: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 3, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_CONFISCATE: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 4, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_TRANSMIT: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 5, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_EJECT: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 6, METHOD_BUFFERED, + FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_SWALLOW: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 7, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_IS_PRESENT: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 10, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_IS_ABSENT: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 11, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_SET_PROTOCOL: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 12, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_STATE: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 14, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_LAST_ERROR: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 15, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const IOCTL_SMARTCARD_GET_PERF_CNTR: DWORD = CTL_CODE!(FILE_DEVICE_SMARTCARD, 16, + METHOD_BUFFERED, FILE_ANY_ACCESS); +pub const MAXIMUM_ATTR_STRING_LENGTH: DWORD = 32; +pub const MAXIMUM_SMARTCARD_READERS: DWORD = 10; +pub const SCARD_CLASS_VENDOR_INFO: ULONG = 1; +pub const SCARD_CLASS_COMMUNICATIONS: ULONG = 2; +pub const SCARD_CLASS_PROTOCOL: ULONG = 3; +pub const SCARD_CLASS_POWER_MGMT: ULONG = 4; +pub const SCARD_CLASS_SECURITY: ULONG = 5; +pub const SCARD_CLASS_MECHANICAL: ULONG = 6; +pub const SCARD_CLASS_VENDOR_DEFINED: ULONG = 7; +pub const SCARD_CLASS_IFD_PROTOCOL: ULONG = 8; +pub const SCARD_CLASS_ICC_STATE: ULONG = 9; +pub const SCARD_CLASS_PERF: ULONG = 0x7ffe; +pub const SCARD_CLASS_SYSTEM: ULONG = 0x7fff; +pub const SCARD_ATTR_VENDOR_NAME: ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0100; +pub const SCARD_ATTR_VENDOR_IFD_TYPE: ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0101; +pub const SCARD_ATTR_VENDOR_IFD_VERSION: ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0102; +pub const SCARD_ATTR_VENDOR_IFD_SERIAL_NO: ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0103; +pub const SCARD_ATTR_CHANNEL_ID: ULONG = SCARD_CLASS_COMMUNICATIONS << 16 | 0x0110; +pub const SCARD_ATTR_PROTOCOL_TYPES: ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0120; +pub const SCARD_ATTR_DEFAULT_CLK: ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0121; +pub const SCARD_ATTR_MAX_CLK: ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0122; +pub const SCARD_ATTR_DEFAULT_DATA_RATE: ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0123; +pub const SCARD_ATTR_MAX_DATA_RATE: ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0124; +pub const SCARD_ATTR_MAX_IFSD: ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0125; +pub const SCARD_ATTR_POWER_MGMT_SUPPORT: ULONG = SCARD_CLASS_POWER_MGMT << 16 | 0x0131; +pub const SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE: ULONG = SCARD_CLASS_SECURITY << 16 | 0x0140; +pub const SCARD_ATTR_USER_AUTH_INPUT_DEVICE: ULONG = SCARD_CLASS_SECURITY << 16 | 0x0142; +pub const SCARD_ATTR_CHARACTERISTICS: ULONG = SCARD_CLASS_MECHANICAL << 16 | 0x0150; +pub const SCARD_ATTR_CURRENT_PROTOCOL_TYPE: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0201; +pub const SCARD_ATTR_CURRENT_CLK: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0202; +pub const SCARD_ATTR_CURRENT_F: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0203; +pub const SCARD_ATTR_CURRENT_D: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0204; +pub const SCARD_ATTR_CURRENT_N: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0205; +pub const SCARD_ATTR_CURRENT_W: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0206; +pub const SCARD_ATTR_CURRENT_IFSC: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0207; +pub const SCARD_ATTR_CURRENT_IFSD: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0208; +pub const SCARD_ATTR_CURRENT_BWT: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0209; +pub const SCARD_ATTR_CURRENT_CWT: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020a; +pub const SCARD_ATTR_CURRENT_EBC_ENCODING: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020b; +pub const SCARD_ATTR_EXTENDED_BWT: ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020c; +pub const SCARD_ATTR_ICC_PRESENCE: ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0300; +pub const SCARD_ATTR_ICC_INTERFACE_STATUS: ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0301; +pub const SCARD_ATTR_CURRENT_IO_STATE: ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0302; +pub const SCARD_ATTR_ATR_STRING: ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0303; +pub const SCARD_ATTR_ICC_TYPE_PER_ATR: ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0304; +pub const SCARD_ATTR_ESC_RESET: ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA000; +pub const SCARD_ATTR_ESC_CANCEL: ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA003; +pub const SCARD_ATTR_ESC_AUTHREQUEST: ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA005; +pub const SCARD_ATTR_MAXINPUT: ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA007; +pub const SCARD_ATTR_DEVICE_UNIT: ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0001; +pub const SCARD_ATTR_DEVICE_IN_USE: ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0002; +pub const SCARD_ATTR_DEVICE_FRIENDLY_NAME_A: ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0003; +pub const SCARD_ATTR_DEVICE_SYSTEM_NAME_A: ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0004; +pub const SCARD_ATTR_DEVICE_FRIENDLY_NAME_W: ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0005; +pub const SCARD_ATTR_DEVICE_SYSTEM_NAME_W: ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0006; +pub const SCARD_ATTR_SUPRESS_T1_IFS_REQUEST: ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0007; +pub const SCARD_PERF_NUM_TRANSMISSIONS: ULONG = SCARD_CLASS_PERF << 16 | 0x0001; +pub const SCARD_PERF_BYTES_TRANSMITTED: ULONG = SCARD_CLASS_PERF << 16 | 0x0002; +pub const SCARD_PERF_TRANSMISSION_TIME: ULONG = SCARD_CLASS_PERF << 16 | 0x0003; +pub const SCARD_T0_HEADER_LENGTH: DWORD = 7; +pub const SCARD_T0_CMD_LENGTH: DWORD = 5; +pub const SCARD_T1_PROLOGUE_LENGTH: DWORD = 3; +pub const SCARD_T1_EPILOGUE_LENGTH: DWORD = 2; +pub const SCARD_T1_MAX_IFS: DWORD = 254; +pub const SCARD_UNKNOWN: ULONG = 0; +pub const SCARD_ABSENT: ULONG = 1; +pub const SCARD_PRESENT: ULONG = 2; +pub const SCARD_SWALLOWED: ULONG = 3; +pub const SCARD_POWERED: ULONG = 4; +pub const SCARD_NEGOTIABLE: ULONG = 5; +pub const SCARD_SPECIFIC: ULONG = 6; +STRUCT!{struct SCARD_IO_REQUEST { + dwProtocol: DWORD, + cbPciLength: DWORD, +}} +pub type PSCARD_IO_REQUEST = *mut SCARD_IO_REQUEST; +pub type LPSCARD_IO_REQUEST = *mut SCARD_IO_REQUEST; +pub type LPCSCARD_IO_REQUEST = *const SCARD_IO_REQUEST; +STRUCT!{struct SCARD_T0_COMMAND { + bCla: BYTE, + bIns: BYTE, + bP1: BYTE, + bP2: BYTE, + bP3: BYTE, +}} +pub type LPSCARD_T0_COMMAND = *mut SCARD_T0_COMMAND; +UNION!{union SCARD_T0_REQUEST_u { + [u8; 5], + CmdBytes CmdBytes_mut: SCARD_T0_COMMAND, + rgbHeader rgbHeader_mut: [BYTE; 5], +}} +STRUCT!{struct SCARD_T0_REQUEST { + ioRequest: SCARD_IO_REQUEST, + bSw1: BYTE, + bSw2: BYTE, + u: SCARD_T0_REQUEST_u, +}} +pub type PSCARD_T0_REQUEST = *mut SCARD_T0_REQUEST; +pub type LPSCARD_T0_REQUEST = *mut SCARD_T0_REQUEST; +STRUCT!{struct SCARD_T1_REQUEST { + ioRequest: SCARD_IO_REQUEST, +}} +pub type PSCARD_T1_REQUEST = *mut SCARD_T1_REQUEST; +pub type LPSCARD_T1_REQUEST = *mut SCARD_T1_REQUEST; +pub const SCARD_READER_SWALLOWS: ULONG = 0x00000001; +pub const SCARD_READER_EJECTS: ULONG = 0x00000002; +pub const SCARD_READER_CONFISCATES: ULONG = 0x00000004; +pub const SCARD_READER_TYPE_SERIAL: ULONG = 0x01; +pub const SCARD_READER_TYPE_PARALELL: ULONG = 0x02; +pub const SCARD_READER_TYPE_KEYBOARD: ULONG = 0x04; +pub const SCARD_READER_TYPE_SCSI: ULONG = 0x08; +pub const SCARD_READER_TYPE_IDE: ULONG = 0x10; +pub const SCARD_READER_TYPE_USB: ULONG = 0x20; +pub const SCARD_READER_TYPE_PCMCIA: ULONG = 0x40; +pub const SCARD_READER_TYPE_TPM: ULONG = 0x80; +pub const SCARD_READER_TYPE_NFC: ULONG = 0x100; +pub const SCARD_READER_TYPE_UICC: ULONG = 0x200; +pub const SCARD_READER_TYPE_VENDOR: ULONG = 0xF0; diff --git a/src/vendor/winapi/src/um/winsock2.rs b/src/vendor/winapi/src/um/winsock2.rs new file mode 100644 index 0000000000..6074cced31 --- /dev/null +++ b/src/vendor/winapi/src/um/winsock2.rs @@ -0,0 +1,1451 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Definitions to be used with the WinSock 2 DLL and WinSock 2 applications. +use ctypes::{ + __uint32, __uint64, c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, + c_ulong, c_ushort, +}; +use shared::basetsd::{DWORD_PTR, UINT_PTR, ULONG_PTR}; +use shared::guiddef::{GUID, LPGUID}; +use shared::inaddr::in_addr; +use shared::minwindef::{ + BOOL, DWORD, FARPROC, HIWORD, INT, LOWORD, LPDWORD, LPHANDLE, LPINT, LPVOID, MAKELONG, UINT, + ULONG, WORD, WPARAM, +}; +use shared::qos::FLOWSPEC; +use shared::windef::HWND; +use shared::winerror::{ + ERROR_INVALID_HANDLE, ERROR_INVALID_PARAMETER, ERROR_IO_INCOMPLETE, ERROR_IO_PENDING, + ERROR_NOT_ENOUGH_MEMORY, ERROR_OPERATION_ABORTED, WAIT_TIMEOUT, +}; +use shared::ws2def::{ + AF_APPLETALK, AF_ATM, AF_BAN, AF_BTH, AF_CCITT, AF_CHAOS, AF_DATAKIT, AF_DECnet, AF_DLI, + AF_ECMA, AF_FIREFOX, AF_HYLINK, AF_IMPLINK, AF_INET, AF_INET6, AF_IPX, AF_ISO, AF_LAT, + AF_MAX, AF_NS, AF_OSI, AF_PUP, AF_SNA, AF_UNIX, AF_UNKNOWN1, AF_UNSPEC, AF_VOICEVIEW, + INADDR_ANY, LPCSADDR_INFO, LPSOCKADDR, LPWSABUF, LPWSAMSG, PSOCKET_ADDRESS_LIST, SOCKADDR, + SOCKADDR_IN, WSABUF, +}; +use shared::wtypesbase::{BLOB, LPBLOB}; +use um::minwinbase::OVERLAPPED; +use um::winbase::{INFINITE, WAIT_FAILED, WAIT_IO_COMPLETION, WAIT_OBJECT_0}; +use um::winnt::{ + CHAR, HANDLE, LONG, LPCSTR, LPSTR, LPWSTR, MAXIMUM_WAIT_OBJECTS, PWSTR, SHORT, WCHAR, +}; +pub const WINSOCK_VERSION: WORD = 2 | (2 << 8); +pub type u_char = c_uchar; +pub type u_short = c_ushort; +pub type u_int = c_uint; +pub type u_long = c_ulong; +pub type u_int64 = __uint64; +pub type SOCKET = UINT_PTR; +pub const FD_SETSIZE: usize = 64; +STRUCT!{struct fd_set { + fd_count: u_int, + fd_array: [SOCKET; FD_SETSIZE], +}} +extern "system" { + pub fn __WSAFDIsSet( + fd: SOCKET, + _: *mut fd_set, + ) -> c_int; +} +STRUCT!{struct timeval { + tv_sec: c_long, + tv_usec: c_long, +}} +pub const IOCPARM_MASK: c_long = 0x7f; +pub const IOC_VOID: c_long = 0x20000000; +pub const IOC_OUT: c_long = 0x40000000; +pub const IOC_IN: c_long = 0x80000000; +pub const IOC_INOUT: c_long = IOC_IN | IOC_OUT; +pub const FIONREAD: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x66 << 8) | 127; +pub const FIONBIO: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x66 << 8) | 126; +pub const FIOASYNC: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x66 << 8) | 125; +pub const SIOCSHIWAT: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 0; +pub const SIOCGHIWAT: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 1; +pub const SIOCSLOWAT: c_long = IOC_IN | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 2; +pub const SIOCGLOWAT: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 3; +pub const SIOCATMARK: c_long = IOC_OUT | ((4 & IOCPARM_MASK) << 16) | (0x73 << 8) | 7; +STRUCT!{struct hostent { + h_name: *mut c_char, + h_aliases: *mut *mut c_char, + h_addrtype: c_short, + h_length: c_short, + h_addr_list: *mut *mut c_char, +}} +STRUCT!{struct netent { + n_name: *mut c_char, + n_aliases: *mut *mut c_char, + n_addrtype: c_short, + n_net: u_long, +}} +#[cfg(target_arch = "x86")] +STRUCT!{struct servent { + s_name: *mut c_char, + s_aliases: *mut *mut c_char, + s_port: c_short, + s_proto: *mut c_char, +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct servent { + s_name: *mut c_char, + s_aliases: *mut *mut c_char, + s_proto: *mut c_char, + s_port: c_short, +}} +STRUCT!{struct protoent { + p_name: *mut c_char, + p_aliases: *mut *mut c_char, + p_proto: c_short, +}} +pub const IPPORT_ECHO: c_short = 7; +pub const IPPORT_DISCARD: c_short = 9; +pub const IPPORT_SYSTAT: c_short = 11; +pub const IPPORT_DAYTIME: c_short = 13; +pub const IPPORT_NETSTAT: c_short = 15; +pub const IPPORT_FTP: c_short = 21; +pub const IPPORT_TELNET: c_short = 23; +pub const IPPORT_SMTP: c_short = 25; +pub const IPPORT_TIMESERVER: c_short = 37; +pub const IPPORT_NAMESERVER: c_short = 42; +pub const IPPORT_WHOIS: c_short = 43; +pub const IPPORT_MTP: c_short = 57; +pub const IPPORT_TFTP: c_short = 69; +pub const IPPORT_RJE: c_short = 77; +pub const IPPORT_FINGER: c_short = 79; +pub const IPPORT_TTYLINK: c_short = 87; +pub const IPPORT_SUPDUP: c_short = 95; +pub const IPPORT_EXECSERVER: c_short = 512; +pub const IPPORT_LOGINSERVER: c_short = 513; +pub const IPPORT_CMDSERVER: c_short = 514; +pub const IPPORT_EFSSERVER: c_short = 520; +pub const IPPORT_BIFFUDP: c_short = 512; +pub const IPPORT_WHOSERVER: c_short = 513; +pub const IPPORT_ROUTESERVER: c_short = 520; +pub const IPPORT_RESERVED: c_short = 1024; +pub const IMPLINK_IP: c_short = 155; +pub const IMPLINK_LOWEXPER: c_short = 156; +pub const IMPLINK_HIGHEXPER: c_short = 158; +pub const ADDR_ANY: ULONG = INADDR_ANY; +pub const WSADESCRIPTION_LEN: usize = 256; +pub const WSASYS_STATUS_LEN: usize = 128; +#[cfg(target_arch = "x86")] +STRUCT!{struct WSADATA { + wVersion: WORD, + wHighVersion: WORD, + szDescription: [c_char; WSADESCRIPTION_LEN + 1], + szSystemStatus: [c_char; WSASYS_STATUS_LEN + 1], + iMaxSockets: c_ushort, + iMaxUdpDg: c_ushort, + lpVendorInfo: *mut c_char, +}} +#[cfg(target_arch = "x86_64")] +STRUCT!{struct WSADATA { + wVersion: WORD, + wHighVersion: WORD, + iMaxSockets: c_ushort, + iMaxUdpDg: c_ushort, + lpVendorInfo: *mut c_char, + szDescription: [c_char; WSADESCRIPTION_LEN + 1], + szSystemStatus: [c_char; WSASYS_STATUS_LEN + 1], +}} +pub type LPWSADATA = *mut WSADATA; +pub const INVALID_SOCKET: SOCKET = !0; +pub const SOCKET_ERROR: c_int = -1; +pub const FROM_PROTOCOL_INFO: c_int = -1; +pub const SOCK_STREAM: c_int = 1; +pub const SOCK_DGRAM: c_int = 2; +pub const SOCK_RAW: c_int = 3; +pub const SOCK_RDM: c_int = 4; +pub const SOCK_SEQPACKET: c_int = 5; +pub const SO_DEBUG: c_int = 0x0001; +pub const SO_ACCEPTCONN: c_int = 0x0002; +pub const SO_REUSEADDR: c_int = 0x0004; +pub const SO_KEEPALIVE: c_int = 0x0008; +pub const SO_DONTROUTE: c_int = 0x0010; +pub const SO_BROADCAST: c_int = 0x0020; +pub const SO_USELOOPBACK: c_int = 0x0040; +pub const SO_LINGER: c_int = 0x0080; +pub const SO_OOBINLINE: c_int = 0x0100; +pub const SO_DONTLINGER: c_int = !SO_LINGER; +pub const SO_EXCLUSIVEADDRUSE: c_int = !SO_REUSEADDR; +pub const SO_SNDBUF: c_int = 0x1001; +pub const SO_RCVBUF: c_int = 0x1002; +pub const SO_SNDLOWAT: c_int = 0x1003; +pub const SO_RCVLOWAT: c_int = 0x1004; +pub const SO_SNDTIMEO: c_int = 0x1005; +pub const SO_RCVTIMEO: c_int = 0x1006; +pub const SO_ERROR: c_int = 0x1007; +pub const SO_TYPE: c_int = 0x1008; +pub const SO_GROUP_ID: c_int = 0x2001; +pub const SO_GROUP_PRIORITY: c_int = 0x2002; +pub const SO_MAX_MSG_SIZE: c_int = 0x2003; +pub const SO_PROTOCOL_INFOA: c_int = 0x2004; +pub const SO_PROTOCOL_INFOW: c_int = 0x2005; +pub const PVD_CONFIG: c_int = 0x3001; +pub const SO_CONDITIONAL_ACCEPT: c_int = 0x3002; +STRUCT!{struct sockproto { + sp_family: u_short, + sp_protocol: u_short, +}} +pub const PF_UNSPEC: c_int = AF_UNSPEC; +pub const PF_UNIX: c_int = AF_UNIX; +pub const PF_INET: c_int = AF_INET; +pub const PF_IMPLINK: c_int = AF_IMPLINK; +pub const PF_PUP: c_int = AF_PUP; +pub const PF_CHAOS: c_int = AF_CHAOS; +pub const PF_NS: c_int = AF_NS; +pub const PF_IPX: c_int = AF_IPX; +pub const PF_ISO: c_int = AF_ISO; +pub const PF_OSI: c_int = AF_OSI; +pub const PF_ECMA: c_int = AF_ECMA; +pub const PF_DATAKIT: c_int = AF_DATAKIT; +pub const PF_CCITT: c_int = AF_CCITT; +pub const PF_SNA: c_int = AF_SNA; +pub const PF_DECnet: c_int = AF_DECnet; +pub const PF_DLI: c_int = AF_DLI; +pub const PF_LAT: c_int = AF_LAT; +pub const PF_HYLINK: c_int = AF_HYLINK; +pub const PF_APPLETALK: c_int = AF_APPLETALK; +pub const PF_VOICEVIEW: c_int = AF_VOICEVIEW; +pub const PF_FIREFOX: c_int = AF_FIREFOX; +pub const PF_UNKNOWN1: c_int = AF_UNKNOWN1; +pub const PF_BAN: c_int = AF_BAN; +pub const PF_ATM: c_int = AF_ATM; +pub const PF_INET6: c_int = AF_INET6; +pub const PF_BTH: c_int = AF_BTH; +pub const PF_MAX: c_int = AF_MAX; +STRUCT!{struct linger { + l_onoff: u_short, + l_linger: u_short, +}} +pub const SOL_SOCKET: c_int = 0xffff; +pub const SOMAXCONN: c_int = 0x7fffffff; +#[inline] +pub fn SOMAXCONN_HINT(b: c_int) -> c_int { + -b +} +pub const MSG_OOB: c_int = 0x1; +pub const MSG_PEEK: c_int = 0x2; +pub const MSG_DONTROUTE: c_int = 0x4; +pub const MSG_WAITALL: c_int = 0x8; +pub const MSG_PUSH_IMMEDIATE: c_int = 0x20; +pub const MSG_PARTIAL: c_int = 0x8000; +pub const MSG_INTERRUPT: c_int = 0x10; +pub const MSG_MAXIOVLEN: c_int = 16; +pub const MAXGETHOSTSTRUCT: usize = 1024; +pub const FD_READ_BIT: c_long = 0; +pub const FD_READ: c_long = 1 << FD_READ_BIT; +pub const FD_WRITE_BIT: c_long = 1; +pub const FD_WRITE: c_long = 1 << FD_WRITE_BIT; +pub const FD_OOB_BIT: c_long = 2; +pub const FD_OOB: c_long = 1 << FD_OOB_BIT; +pub const FD_ACCEPT_BIT: c_long = 3; +pub const FD_ACCEPT: c_long = 1 << FD_ACCEPT_BIT; +pub const FD_CONNECT_BIT: c_long = 4; +pub const FD_CONNECT: c_long = 1 << FD_CONNECT_BIT; +pub const FD_CLOSE_BIT: c_long = 5; +pub const FD_CLOSE: c_long = 1 << FD_CLOSE_BIT; +pub const FD_QOS_BIT: c_long = 6; +pub const FD_QOS: c_long = 1 << FD_QOS_BIT; +pub const FD_GROUP_QOS_BIT: c_long = 7; +pub const FD_GROUP_QOS: c_long = 1 << FD_GROUP_QOS_BIT; +pub const FD_ROUTING_INTERFACE_CHANGE_BIT: c_long = 8; +pub const FD_ROUTING_INTERFACE_CHANGE: c_long = 1 << FD_ROUTING_INTERFACE_CHANGE_BIT; +pub const FD_ADDRESS_LIST_CHANGE_BIT: c_long = 9; +pub const FD_ADDRESS_LIST_CHANGE: c_long = 1 << FD_ADDRESS_LIST_CHANGE_BIT; +pub const FD_MAX_EVENTS: usize = 10; +pub const FD_ALL_EVENTS: c_long = (1 << FD_MAX_EVENTS) - 1; +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_EUNKOWNPSOBJ: c_int = WSABASEERR + 1024; +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; +#[inline] +pub unsafe fn h_errno() -> c_int { + WSAGetLastError() +} +pub const HOST_NOT_FOUND: c_int = WSAHOST_NOT_FOUND; +pub const TRY_AGAIN: c_int = WSATRY_AGAIN; +pub const NO_RECOVERY: c_int = WSANO_RECOVERY; +pub const NO_DATA: c_int = WSANO_DATA; +pub const WSANO_ADDRESS: c_int = WSANO_DATA; +pub const NO_ADDRESS: c_int = WSANO_ADDRESS; +pub type WSAEVENT = HANDLE; +pub type LPWSAEVENT = LPHANDLE; +pub type WSAOVERLAPPED = OVERLAPPED; +pub type LPWSAOVERLAPPED = *mut OVERLAPPED; +pub const WSA_IO_PENDING: c_int = ERROR_IO_PENDING as i32; +pub const WSA_IO_INCOMPLETE: c_int = ERROR_IO_INCOMPLETE as i32; +pub const WSA_INVALID_HANDLE: c_int = ERROR_INVALID_HANDLE as i32; +pub const WSA_INVALID_PARAMETER: c_int = ERROR_INVALID_PARAMETER as i32; +pub const WSA_NOT_ENOUGH_MEMORY: c_int = ERROR_NOT_ENOUGH_MEMORY as i32; +pub const WSA_OPERATION_ABORTED: c_int = ERROR_OPERATION_ABORTED as i32; +pub const WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT; +pub const WSA_MAXIMUM_WAIT_EVENTS: DWORD = MAXIMUM_WAIT_OBJECTS; +pub const WSA_WAIT_FAILED: DWORD = WAIT_FAILED; +pub const WSA_WAIT_EVENT_0: DWORD = WAIT_OBJECT_0; +pub const WSA_WAIT_IO_COMPLETION: DWORD = WAIT_IO_COMPLETION; +pub const WSA_WAIT_TIMEOUT: DWORD = WAIT_TIMEOUT; +pub const WSA_INFINITE: DWORD = INFINITE; +STRUCT!{struct QOS { + SendingFlowspec: FLOWSPEC, + FLOWSPEC: FLOWSPEC, + ProviderSpecific: WSABUF, +}} +pub type LPQOS = *mut QOS; +pub const CF_ACCEPT: c_int = 0x0000; +pub const CF_REJECT: c_int = 0x0001; +pub const CF_DEFER: c_int = 0x0002; +pub const SD_RECEIVE: c_int = 0x00; +pub const SD_SEND: c_int = 0x01; +pub const SD_BOTH: c_int = 0x02; +pub type GROUP = c_uint; +pub const SG_UNCONSTRAINED_GROUP: GROUP = 0x01; +pub const SG_CONSTRAINED_GROUP: GROUP = 0x02; +STRUCT!{struct WSANETWORKEVENTS { + lNetworkEvents: c_long, + iErrorCode: [c_int; FD_MAX_EVENTS], +}} +pub type LPWSANETWORKEVENTS = *mut WSANETWORKEVENTS; +pub const MAX_PROTOCOL_CHAIN: usize = 7; +pub const BASE_PROTOCOL: c_int = 1; +pub const LAYERED_PROTOCOL: c_int = 0; +STRUCT!{struct WSAPROTOCOLCHAIN { + ChainLen: c_int, + ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN], +}} +pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN; +pub const WSAPROTOCOL_LEN: usize = 255; +STRUCT!{struct WSAPROTOCOL_INFOA { + dwServiceFlags1: DWORD, + dwServiceFlags2: DWORD, + dwServiceFlags3: DWORD, + dwServiceFlags4: DWORD, + dwServiceFlags5: DWORD, + ProviderId: GUID, + dwCatalogEntryId: DWORD, + ProtocolChain: WSAPROTOCOLCHAIN, + iVersion: c_int, + iAddressFamily: c_int, + iMaxSockAddr: c_int, + iMinSockAddr: c_int, + iSocketType: c_int, + iProtocol: c_int, + iProtocolMaxOffset: c_int, + iNetworkByteOrder: c_int, + iSecurityScheme: c_int, + dwMessageSize: DWORD, + dwProviderReserved: DWORD, + szProtocol: [CHAR; WSAPROTOCOL_LEN + 1], +}} +pub type LPWSAPROTOCOL_INFOA = *mut WSAPROTOCOL_INFOA; +STRUCT!{struct WSAPROTOCOL_INFOW { + dwServiceFlags1: DWORD, + dwServiceFlags2: DWORD, + dwServiceFlags3: DWORD, + dwServiceFlags4: DWORD, + dwServiceFlags5: DWORD, + ProviderId: GUID, + dwCatalogEntryId: DWORD, + ProtocolChain: WSAPROTOCOLCHAIN, + iVersion: c_int, + iAddressFamily: c_int, + iMaxSockAddr: c_int, + iMinSockAddr: c_int, + iSocketType: c_int, + iProtocol: c_int, + iProtocolMaxOffset: c_int, + iNetworkByteOrder: c_int, + iSecurityScheme: c_int, + dwMessageSize: DWORD, + dwProviderReserved: DWORD, + szProtocol: [WCHAR; WSAPROTOCOL_LEN + 1], +}} +pub type LPWSAPROTOCOL_INFOW = *mut WSAPROTOCOL_INFOW; +pub const PFL_MULTIPLE_PROTO_ENTRIES: DWORD = 0x00000001; +pub const PFL_RECOMMENDED_PROTO_ENTRY: DWORD = 0x00000002; +pub const PFL_HIDDEN: DWORD = 0x00000004; +pub const PFL_MATCHES_PROTOCOL_ZERO: DWORD = 0x00000008; +pub const PFL_NETWORKDIRECT_PROVIDER: DWORD = 0x00000010; +pub const XP1_CONNECTIONLESS: DWORD = 0x00000001; +pub const XP1_GUARANTEED_DELIVERY: DWORD = 0x00000002; +pub const XP1_GUARANTEED_ORDER: DWORD = 0x00000004; +pub const XP1_MESSAGE_ORIENTED: DWORD = 0x00000008; +pub const XP1_PSEUDO_STREAM: DWORD = 0x00000010; +pub const XP1_GRACEFUL_CLOSE: DWORD = 0x00000020; +pub const XP1_EXPEDITED_DATA: DWORD = 0x00000040; +pub const XP1_CONNECT_DATA: DWORD = 0x00000080; +pub const XP1_DISCONNECT_DATA: DWORD = 0x00000100; +pub const XP1_SUPPORT_BROADCAST: DWORD = 0x00000200; +pub const XP1_SUPPORT_MULTIPOINT: DWORD = 0x00000400; +pub const XP1_MULTIPOINT_CONTROL_PLANE: DWORD = 0x00000800; +pub const XP1_MULTIPOINT_DATA_PLANE: DWORD = 0x00001000; +pub const XP1_QOS_SUPPORTED: DWORD = 0x00002000; +pub const XP1_INTERRUPT: DWORD = 0x00004000; +pub const XP1_UNI_SEND: DWORD = 0x00008000; +pub const XP1_UNI_RECV: DWORD = 0x00010000; +pub const XP1_IFS_HANDLES: DWORD = 0x00020000; +pub const XP1_PARTIAL_MESSAGE: DWORD = 0x00040000; +pub const XP1_SAN_SUPPORT_SDP: DWORD = 0x00080000; +pub const BIGENDIAN: DWORD = 0x0000; +pub const LITTLEENDIAN: DWORD = 0x0001; +pub const SECURITY_PROTOCOL_NONE: DWORD = 0x0000; +pub const JL_SENDER_ONLY: DWORD = 0x01; +pub const JL_RECEIVER_ONLY: DWORD = 0x02; +pub const JL_BOTH: DWORD = 0x04; +pub const WSA_FLAG_OVERLAPPED: DWORD = 0x01; +pub const WSA_FLAG_MULTIPOINT_C_ROOT: DWORD = 0x02; +pub const WSA_FLAG_MULTIPOINT_C_LEAF: DWORD = 0x04; +pub const WSA_FLAG_MULTIPOINT_D_ROOT: DWORD = 0x08; +pub const WSA_FLAG_MULTIPOINT_D_LEAF: DWORD = 0x10; +pub const WSA_FLAG_ACCESS_SYSTEM_SECURITY: DWORD = 0x40; +pub const WSA_FLAG_NO_HANDLE_INHERIT: DWORD = 0x80; +pub const WSA_FLAG_REGISTERED_IO: DWORD = 0x100; +FN!{stdcall LPCONDITIONPROC( + lpCallerId: LPWSABUF, + lpCallerData: LPWSABUF, + lpSQOS: LPQOS, + lpGQOS: LPQOS, + lpCalleeId: LPWSABUF, + lpCalleeData: LPWSABUF, + g: *mut GROUP, + dwCallbackData: DWORD, +) -> c_int} +FN!{stdcall LPWSAOVERLAPPED_COMPLETION_ROUTINE( + dwError: DWORD, + cbTransferred: DWORD, + lpOverlapped: LPWSAOVERLAPPED, + dwFlags: DWORD, +) -> ()} +ENUM!{enum WSACOMPLETIONTYPE { + NSP_NOTIFY_IMMEDIATELY = 0, + NSP_NOTIFY_HWND, + NSP_NOTIFY_EVENT, + NSP_NOTIFY_PORT, + NSP_NOTIFY_APC, +}} +pub type PWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE; +pub type LPWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE; +STRUCT!{struct WSACOMPLETION_WindowMessage { + hWnd: HWND, + uMsg: UINT, + context: WPARAM, +}} +STRUCT!{struct WSACOMPLETION_Event { + lpOverlapped: LPWSAOVERLAPPED, +}} +STRUCT!{struct WSACOMPLETION_Apc { + lpOverlapped: LPWSAOVERLAPPED, + lpfnCompletionProc: LPWSAOVERLAPPED_COMPLETION_ROUTINE, +}} +STRUCT!{struct WSACOMPLETION_Port { + lpOverlapped: LPWSAOVERLAPPED, + hPort: HANDLE, + Key: ULONG_PTR, +}} +UNION!{union WSACOMPLETION_Parameter { + [usize; 3], + WindowMessage WindowMessage_mut: WSACOMPLETION_WindowMessage, + Event Event_mut: WSACOMPLETION_Event, + Apc Apc_mut: WSACOMPLETION_Apc, + Port Port_mut: WSACOMPLETION_Port, +}} +STRUCT!{struct WSACOMPLETION { + Type: WSACOMPLETIONTYPE, + Parameters: WSACOMPLETION_Parameter, +}} +pub type PWSACOMPLETION = *mut WSACOMPLETION; +pub type LPWSACOMPLETION = *mut WSACOMPLETION; +pub const TH_NETDEV: DWORD = 0x00000001; +pub const TH_TAPI: DWORD = 0x00000002; +pub const SERVICE_MULTIPLE: DWORD = 0x00000001; +pub const NS_ALL: DWORD = 0; +pub const NS_SAP: DWORD = 1; +pub const NS_NDS: DWORD = 2; +pub const NS_PEER_BROWSE: DWORD = 3; +pub const NS_SLP: DWORD = 5; +pub const NS_DHCP: DWORD = 6; +pub const NS_TCPIP_LOCAL: DWORD = 10; +pub const NS_TCPIP_HOSTS: DWORD = 11; +pub const NS_DNS: DWORD = 12; +pub const NS_NETBT: DWORD = 13; +pub const NS_WINS: DWORD = 14; +pub const NS_NLA: DWORD = 15; +pub const NS_BTH: DWORD = 16; +pub const NS_LOCALNAME: DWORD = 19; +pub const NS_NBP: DWORD = 20; +pub const NS_MS: DWORD = 30; +pub const NS_STDA: DWORD = 31; +pub const NS_NTDS: DWORD = 32; +pub const NS_EMAIL: DWORD = 37; +pub const NS_PNRPNAME: DWORD = 38; +pub const NS_PNRPCLOUD: DWORD = 39; +pub const NS_X500: DWORD = 40; +pub const NS_NIS: DWORD = 41; +pub const NS_NISPLUS: DWORD = 42; +pub const NS_WRQ: DWORD = 50; +pub const NS_NETDES: DWORD = 60; +pub const RES_UNUSED_1: DWORD = 0x00000001; +pub const RES_FLUSH_CACHE: DWORD = 0x00000002; +pub const RES_SERVICE: DWORD = 0x00000004; +pub const SERVICE_TYPE_VALUE_IPXPORT: &'static str = "IpxSocket"; +pub const SERVICE_TYPE_VALUE_SAPID: &'static str = "SapId"; +pub const SERVICE_TYPE_VALUE_TCPPORT: &'static str = "TcpPort"; +pub const SERVICE_TYPE_VALUE_UDPPORT: &'static str = "UdpPort"; +pub const SERVICE_TYPE_VALUE_OBJECTID: &'static str = "ObjectId"; +STRUCT!{struct AFPROTOCOLS { + iAddressFamily: INT, + iProtocol: INT, +}} +pub type PAFPROTOCOLS = *mut AFPROTOCOLS; +pub type LPAFPROTOCOLS = *mut AFPROTOCOLS; +ENUM!{enum WSAECOMPARATOR { + COMP_EQUAL = 0, + COMP_NOTLESS, +}} +pub type PWSAECOMPARATOR = *mut WSAECOMPARATOR; +pub type LPWSAECOMPARATOR = *mut WSAECOMPARATOR; +STRUCT!{struct WSAVERSION { + dwVersion: DWORD, + ecHow: WSAECOMPARATOR, +}} +pub type PWSAVERSION = *mut WSAVERSION; +pub type LPWSAVERSION = *mut WSAVERSION; +STRUCT!{struct WSAQUERYSETA { + dwSize: DWORD, + lpszServiceInstanceName: LPSTR, + lpServiceClassId: LPGUID, + lpVersion: LPWSAVERSION, + lpszComment: LPSTR, + dwNameSpace: DWORD, + lpNSProviderId: LPGUID, + lpszContext: LPSTR, + dwNumberOfProtocols: DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: LPSTR, + dwNumberOfCsAddrs: DWORD, + lpcsaBuffer: LPCSADDR_INFO, + dwOutputFlags: DWORD, + lpBlob: LPBLOB, +}} +pub type PWSAQUERYSETA = *mut WSAQUERYSETA; +pub type LPWSAQUERYSETA = *mut WSAQUERYSETA; +STRUCT!{struct WSAQUERYSETW { + dwSize: DWORD, + lpszServiceInstanceName: LPWSTR, + lpServiceClassId: LPGUID, + lpVersion: LPWSAVERSION, + lpszComment: LPWSTR, + dwNameSpace: DWORD, + lpNSProviderId: LPGUID, + lpszContext: LPWSTR, + dwNumberOfProtocols: DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: LPWSTR, + dwNumberOfCsAddrs: DWORD, + lpcsaBuffer: LPCSADDR_INFO, + dwOutputFlags: DWORD, + lpBlob: LPBLOB, +}} +pub type PWSAQUERYSETW = *mut WSAQUERYSETW; +pub type LPWSAQUERYSETW = *mut WSAQUERYSETW; +STRUCT!{struct WSAQUERYSET2A { + dwSize: DWORD, + lpszServiceInstanceName: LPSTR, + lpVersion: LPWSAVERSION, + lpszComment: LPSTR, + dwNameSpace: DWORD, + lpNSProviderId: LPGUID, + lpszContext: LPSTR, + dwNumberOfProtocols: DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: LPSTR, + dwNumberOfCsAddrs: DWORD, + lpcsaBuffer: LPCSADDR_INFO, + dwOutputFlags: DWORD, + lpBlob: LPBLOB, +}} +pub type PWSAQUERYSET2A = *mut WSAQUERYSET2A; +pub type LPWSAQUERYSET2A = *mut WSAQUERYSET2A; +STRUCT!{struct WSAQUERYSET2W { + dwSize: DWORD, + lpszServiceInstanceName: LPWSTR, + lpVersion: LPWSAVERSION, + lpszComment: LPWSTR, + dwNameSpace: DWORD, + lpNSProviderId: LPGUID, + lpszContext: LPWSTR, + dwNumberOfProtocols: DWORD, + lpafpProtocols: LPAFPROTOCOLS, + lpszQueryString: LPWSTR, + dwNumberOfCsAddrs: DWORD, + lpcsaBuffer: LPCSADDR_INFO, + dwOutputFlags: DWORD, + lpBlob: LPBLOB, +}} +pub type PWSAQUERYSET2W = *mut WSAQUERYSET2W; +pub type LPWSAQUERYSET2W = *mut WSAQUERYSET2W; +pub const LUP_DEEP: DWORD = 0x0001; +pub const LUP_CONTAINERS: DWORD = 0x0002; +pub const LUP_NOCONTAINERS: DWORD = 0x0004; +pub const LUP_NEAREST: DWORD = 0x0008; +pub const LUP_RETURN_NAME: DWORD = 0x0010; +pub const LUP_RETURN_TYPE: DWORD = 0x0020; +pub const LUP_RETURN_VERSION: DWORD = 0x0040; +pub const LUP_RETURN_COMMENT: DWORD = 0x0080; +pub const LUP_RETURN_ADDR: DWORD = 0x0100; +pub const LUP_RETURN_BLOB: DWORD = 0x0200; +pub const LUP_RETURN_ALIASES: DWORD = 0x0400; +pub const LUP_RETURN_QUERY_STRING: DWORD = 0x0800; +pub const LUP_RETURN_ALL: DWORD = 0x0FF0; +pub const LUP_RES_SERVICE: DWORD = 0x8000; +pub const LUP_FLUSHCACHE: DWORD = 0x1000; +pub const LUP_FLUSHPREVIOUS: DWORD = 0x2000; +pub const LUP_NON_AUTHORITATIVE: DWORD = 0x4000; +pub const LUP_SECURE: DWORD = 0x8000; +pub const LUP_RETURN_PREFERRED_NAMES: DWORD = 0x10000; +pub const LUP_DNS_ONLY: DWORD = 0x20000; +pub const LUP_ADDRCONFIG: DWORD = 0x00100000; +pub const LUP_DUAL_ADDR: DWORD = 0x00200000; +pub const LUP_FILESERVER: DWORD = 0x00400000; +pub const LUP_DISABLE_IDN_ENCODING: DWORD = 0x00800000; +pub const LUP_API_ANSI: DWORD = 0x01000000; +pub const LUP_RESOLUTION_HANDLE: DWORD = 0x80000000; +pub const RESULT_IS_ALIAS: DWORD = 0x0001; +pub const RESULT_IS_ADDED: DWORD = 0x0010; +pub const RESULT_IS_CHANGED: DWORD = 0x0020; +pub const RESULT_IS_DELETED: DWORD = 0x0040; +ENUM!{enum WSAESETSERVICEOP { + RNRSERVICE_REGISTER = 0, + RNRSERVICE_DEREGISTER, + RNRSERVICE_DELETE, +}} +pub type PWSAESETSERVICEOP = *mut WSAESETSERVICEOP; +pub type LPWSAESETSERVICEOP = *mut WSAESETSERVICEOP; +STRUCT!{struct WSANSCLASSINFOA { + lpszName: LPSTR, + dwNameSpace: DWORD, + dwValueType: DWORD, + dwValueSize: DWORD, + lpValue: LPVOID, +}} +pub type PWSANSCLASSINFOA = *mut WSANSCLASSINFOA; +pub type LPWSANSCLASSINFOA = *mut WSANSCLASSINFOA; +STRUCT!{struct WSANSCLASSINFOW { + lpszName: LPWSTR, + dwNameSpace: DWORD, + dwValueType: DWORD, + dwValueSize: DWORD, + lpValue: LPVOID, +}} +pub type PWSANSCLASSINFOW = *mut WSANSCLASSINFOW; +pub type LPWSANSCLASSINFOW = *mut WSANSCLASSINFOW; +STRUCT!{struct WSASERVICECLASSINFOA { + lpServiceClassId: LPGUID, + lpszServiceClassName: LPSTR, + dwCount: DWORD, + lpClassInfos: LPWSANSCLASSINFOA, +}} +pub type PWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA; +pub type LPWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA; +STRUCT!{struct WSASERVICECLASSINFOW { + lpServiceClassId: LPGUID, + lpszServiceClassName: LPWSTR, + dwCount: DWORD, + lpClassInfos: LPWSANSCLASSINFOW, +}} +pub type PWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW; +pub type LPWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW; +STRUCT!{struct WSANAMESPACE_INFOA { + NSProviderId: GUID, + dwNameSpace: DWORD, + fActive: BOOL, + dwVersion: DWORD, + lpszIdentifier: LPSTR, +}} +pub type PWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA; +pub type LPWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA; +STRUCT!{struct WSANAMESPACE_INFOW { + NSProviderId: GUID, + dwNameSpace: DWORD, + fActive: BOOL, + dwVersion: DWORD, + lpszIdentifier: LPWSTR, +}} +pub type PWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW; +pub type LPWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW; +STRUCT!{struct WSANAMESPACE_INFOEXA { + NSProviderId: GUID, + dwNameSpace: DWORD, + fActive: BOOL, + dwVersion: DWORD, + lpszIdentifier: LPSTR, + ProviderSpecific: BLOB, +}} +pub type PWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA; +pub type LPWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA; +STRUCT!{struct WSANAMESPACE_INFOEXW { + NSProviderId: GUID, + dwNameSpace: DWORD, + fActive: BOOL, + dwVersion: DWORD, + lpszIdentifier: LPWSTR, + ProviderSpecific: BLOB, +}} +pub type PWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW; +pub type LPWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW; +pub const POLLRDNORM: SHORT = 0x0100; +pub const POLLRDBAND: SHORT = 0x0200; +pub const POLLIN: SHORT = POLLRDNORM | POLLRDBAND; +pub const POLLPRI: SHORT = 0x0400; +pub const POLLWRNORM: SHORT = 0x0010; +pub const POLLOUT: SHORT = POLLWRNORM; +pub const POLLWRBAND: SHORT = 0x0020; +pub const POLLERR: SHORT = 0x0001; +pub const POLLHUP: SHORT = 0x0002; +pub const POLLNVAL: SHORT = 0x0004; +STRUCT!{struct WSAPOLLFD { + fd: SOCKET, + events: SHORT, + revents: SHORT, +}} +pub type PWSAPOLLFD = *mut WSAPOLLFD; +pub type LPWSAPOLLFD = *mut WSAPOLLFD; +extern "system" { + pub fn accept( + s: SOCKET, + addr: *mut SOCKADDR, + addrlen: *mut c_int, + ) -> SOCKET; + pub fn bind(s: SOCKET, + name: *const SOCKADDR, + namelen: c_int, + ) -> c_int; + pub fn closesocket( + s: SOCKET, + ) -> c_int; + pub fn connect( + s: SOCKET, + name: *const SOCKADDR, + namelen: c_int, + ) -> c_int; + pub fn ioctlsocket( + s: SOCKET, + cmd: c_long, + argp: *mut u_long, + ) -> c_int; + pub fn getpeername( + s: SOCKET, + name: *mut SOCKADDR, + namelen: *mut c_int, + ) -> c_int; + pub fn getsockname( + s: SOCKET, + name: *mut SOCKADDR, + namelen: *mut c_int, + ) -> c_int; + pub fn getsockopt( + s: SOCKET, + level: c_int, + optname: c_int, + optval: *mut c_char, + optlen: *mut c_int, + ) -> c_int; + pub fn htonl( + hostlong: u_long, + ) -> u_long; + pub fn htons( + hostshort: u_short, + ) -> u_short; + pub fn inet_addr( + cp: *const c_char, + ) -> c_ulong; + pub fn inet_ntoa( + _in: in_addr, + ) -> *mut c_char; +} +#[inline] +pub fn _WS2_32_WINSOCK_SWAP_LONG(l: __uint32) -> __uint32 { + ((l >> 24) & 0x000000FF) | ((l >> 8) & 0x0000FF00) | ((l << 8) & 0x00FF0000) + | ((l << 24) & 0xFF000000) +} +#[inline] +pub fn _WS2_32_WINSOCK_SWAP_LONGLONG(l: __uint64) -> __uint64 { + ((l >> 56) & 0x00000000000000FF) | ((l >> 40) & 0x000000000000FF00) + | ((l >> 24) & 0x0000000000FF0000) | ((l >> 8) & 0x00000000FF000000) + | ((l << 8) & 0x000000FF00000000) | ((l << 24) & 0x0000FF0000000000) + | ((l << 40) & 0x00FF000000000000) | ((l << 56) & 0xFF00000000000000) +} +#[inline] +pub fn htonll(Value: __uint64) -> __uint64 { + _WS2_32_WINSOCK_SWAP_LONGLONG(Value) +} +#[inline] +pub fn ntohll(Value: __uint64) -> __uint64 { + _WS2_32_WINSOCK_SWAP_LONGLONG(Value) +} +#[inline] +pub fn htonf(Value: c_float) -> __uint32 { + let Tempval: __uint32 = unsafe { ::core::mem::transmute(Value) }; + _WS2_32_WINSOCK_SWAP_LONG(Tempval) +} +#[inline] +pub fn ntohf(Value: __uint32) -> c_float { + let Tempval = _WS2_32_WINSOCK_SWAP_LONG(Value); + unsafe { ::core::mem::transmute(Tempval) } +} +#[inline] +pub fn htond(Value: c_double) -> __uint64 { + let Tempval: __uint64 = unsafe { ::core::mem::transmute(Value) }; + _WS2_32_WINSOCK_SWAP_LONGLONG(Tempval) +} +#[inline] +pub fn ntohd(Value: __uint64) -> c_double { + let Tempval = _WS2_32_WINSOCK_SWAP_LONGLONG(Value); + unsafe { ::core::mem::transmute(Tempval) } +} +extern "system" { + pub fn listen( + s: SOCKET, + backlog: c_int, + ) -> c_int; + pub fn ntohl( + netlong: u_long, + ) -> u_long; + pub fn ntohs( + netshort: u_short, + ) -> u_short; + pub fn recv( + s: SOCKET, + buf: *mut c_char, + len: c_int, + flags: c_int, + ) -> c_int; + pub fn recvfrom( + s: SOCKET, + buf: *mut c_char, + len: c_int, + flags: c_int, + from: *mut SOCKADDR, + fromlen: *mut c_int, + ) -> c_int; + pub fn select( + nfds: c_int, + readfds: *mut fd_set, + writefds: *mut fd_set, + exceptfds: *mut fd_set, + timeout: *const timeval, + ) -> c_int; + pub fn send( + s: SOCKET, + buf: *const c_char, + len: c_int, + flags: c_int, + ) -> c_int; + pub fn sendto( + s: SOCKET, + buf: *const c_char, + len: c_int, + flags: c_int, + to: *const SOCKADDR, + tolen: c_int, + ) -> c_int; + pub fn setsockopt( + s: SOCKET, + level: c_int, + optname: c_int, + optval: *const c_char, + optlen: c_int, + ) -> c_int; + pub fn shutdown( + s: SOCKET, + how: c_int, + ) -> c_int; + pub fn socket( + af: c_int, + _type: c_int, + protocol: c_int, + ) -> SOCKET; + pub fn gethostbyaddr( + addr: *const c_char, + len: c_int, + _type: c_int, + ) -> *mut hostent; + pub fn gethostbyname( + name: *const c_char, + ) -> *mut hostent; + pub fn gethostname( + name: *mut c_char, + namelen: c_int, + ) -> c_int; + pub fn GetHostNameW( + name: PWSTR, + namelen: c_int, + ) -> c_int; + pub fn getservbyport( + port: c_int, + proto: *const c_char, + ) -> *mut servent; + pub fn getservbyname( + name: *const c_char, + proto: *const c_char, + ) -> *mut servent; + pub fn getprotobynumber( + number: c_int, + ) -> *mut protoent; + pub fn getprotobyname( + name: *const c_char, + ) -> *mut protoent; + pub fn WSAStartup( + wVersionRequested: WORD, + lpWSAData: LPWSADATA, + ) -> c_int; + pub fn WSACleanup() -> c_int; + pub fn WSASetLastError( + iError: c_int, + ); + pub fn WSAGetLastError() -> c_int; + pub fn WSAIsBlocking() -> BOOL; + pub fn WSAUnhookBlockingHook() -> c_int; + pub fn WSASetBlockingHook( + lpBlockFunc: FARPROC, + ) -> FARPROC; + pub fn WSACancelBlockingCall() -> c_int; + pub fn WSAAsyncGetServByName( + hWnd: HWND, + wMsg: u_int, + name: *const c_char, + proto: *const c_char, + buf: *mut c_char, + buflen: c_int, + ) -> HANDLE; + pub fn WSAAsyncGetServByPort( + hWnd: HWND, + wMsg: u_int, + port: c_int, + proto: *const c_char, + buf: *mut c_char, + buflen: c_int, + ) -> HANDLE; + pub fn WSAAsyncGetProtoByName( + hWnd: HWND, + wMsg: u_int, + name: *const c_char, + buf: *mut c_char, + buflen: c_int, + ) -> HANDLE; + pub fn WSAAsyncGetProtoByNumber( + hWnd: HWND, + wMsg: u_int, + number: c_int, + buf: *mut c_char, + buflen: c_int, + ) -> HANDLE; + pub fn WSAAsyncGetHostByName( + hWnd: HWND, + wMsg: u_int, + name: *const c_char, + buf: *mut c_char, + buflen: c_int, + ) -> HANDLE; + pub fn WSAAsyncGetHostByAddr( + hWnd: HWND, + wMsg: u_int, + addr: *const c_char, + len: c_int, + _type: c_int, + buf: *mut c_char, + buflen: c_int, + ) -> HANDLE; + pub fn WSACancelAsyncRequest( + hAsyncTaskHandle: HANDLE, + ) -> c_int; + pub fn WSAAsyncSelect( + s: SOCKET, + hWnd: HWND, + wMsg: u_int, + lEvent: c_long, + ) -> c_int; + pub fn WSAAccept( + s: SOCKET, + addr: *mut SOCKADDR, + addrlen: LPINT, + lpfnCondition: LPCONDITIONPROC, + dwCallbackData: DWORD_PTR, + ) -> SOCKET; + pub fn WSACloseEvent( + hEvent: WSAEVENT, + ) -> BOOL; + pub fn WSAConnect( + s: SOCKET, + name: *const SOCKADDR, + namelen: c_int, + lpCallerData: LPWSABUF, + lpCalleeData: LPWSABUF, + lpSQOS: LPQOS, + lpGQOS: LPQOS, + ) -> c_int; + pub fn WSAConnectByNameW( + s: SOCKET, + nodename: LPWSTR, + servicename: LPWSTR, + LocalAddressLength: LPDWORD, + LocalAddress: LPSOCKADDR, + RemoteAddressLength: LPDWORD, + RemoteAddress: LPSOCKADDR, + timeout: *const timeval, + Reserved: LPWSAOVERLAPPED, + ) -> BOOL; + pub fn WSAConnectByNameA( + s: SOCKET, + nodename: LPCSTR, + servicename: LPCSTR, + LocalAddressLength: LPDWORD, + LocalAddress: LPSOCKADDR, + RemoteAddressLength: LPDWORD, + RemoteAddress: LPSOCKADDR, + timeout: *const timeval, + Reserved: LPWSAOVERLAPPED, + ) -> BOOL; + pub fn WSAConnectByList( + s: SOCKET, + SocketAddress: PSOCKET_ADDRESS_LIST, + LocalAddressLength: LPDWORD, + LocalAddress: LPSOCKADDR, + RemoteAddressLength: LPDWORD, + RemoteAddress: LPSOCKADDR, + timeout: *const timeval, + Reserved: LPWSAOVERLAPPED, + ) -> BOOL; + pub fn WSACreateEvent() -> WSAEVENT; + pub fn WSADuplicateSocketA( + s: SOCKET, + dwProcessId: DWORD, + lpProtocolInfo: LPWSAPROTOCOL_INFOA, + ) -> c_int; + pub fn WSADuplicateSocketW( + s: SOCKET, + dwProcessId: DWORD, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + ) -> c_int; + pub fn WSAEnumNetworkEvents( + s: SOCKET, + hEventObject: WSAEVENT, + lpNetworkEvents: LPWSANETWORKEVENTS, + ) -> c_int; + pub fn WSAEnumProtocolsA( + lpiProtocols: LPINT, + lpProtocolBuffer: LPWSAPROTOCOL_INFOA, + lpdwBufferLength: LPDWORD, + ) -> c_int; + pub fn WSAEnumProtocolsW( + lpiProtocols: LPINT, + lpProtocolBuffer: LPWSAPROTOCOL_INFOW, + lpdwBufferLength: LPDWORD, + ) -> c_int; + pub fn WSAEventSelect( + s: SOCKET, + hEventObject: WSAEVENT, + lNetworkEvents: c_long, + ) -> c_int; + pub fn WSAGetOverlappedResult( + s: SOCKET, + lpOverlapped: LPWSAOVERLAPPED, + lpcbTransfer: LPDWORD, + fWait: BOOL, + lpdwFlags: LPDWORD, + ) -> BOOL; + pub fn WSAGetQOSByName( + s: SOCKET, + lpQOSName: LPWSABUF, + lpQOS: LPQOS, + ) -> BOOL; + pub fn WSAHtonl( + s: SOCKET, + hostlong: u_long, + lpnetlong: *mut u_long, + ) -> c_int; + pub fn WSAHtons(s: SOCKET, + hostshort: u_short, + lpnetshort: *mut u_short, + ) -> c_int; + pub fn WSAIoctl( + s: SOCKET, + dwIoControlCode: DWORD, + lpvInBuffer: LPVOID, + cbInBuffer: DWORD, + lpvOutBuffer: LPVOID, + cbOutBuffer: DWORD, + lpcbBytesReturned: LPDWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> c_int; + pub fn WSAJoinLeaf( + s: SOCKET, + name: *const SOCKADDR, + namelen: c_int, + lpCallerData: LPWSABUF, + lpCalleeData: LPWSABUF, + lpSQOS: LPQOS, + lpGQOS: LPQOS, + dwFlags: DWORD, + ) -> SOCKET; + pub fn WSANtohl( + s: SOCKET, + netlong: u_long, + lphostlong: *mut c_long, + ) -> c_int; + pub fn WSANtohs( + s: SOCKET, + netshort: u_short, + lphostshort: *mut c_short, + ) -> 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 WSARecvDisconnect( + s: SOCKET, + lpInboundDisconnectData: LPWSABUF, + ) -> c_int; + pub fn WSARecvFrom( + s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesRecvd: LPDWORD, + lpFlags: LPDWORD, + lpFrom: *mut SOCKADDR, + lpFromlen: LPINT, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> c_int; + pub fn WSAResetEvent( + hEvent: WSAEVENT, + ) -> BOOL; + pub fn WSASend( + s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesSent: LPDWORD, + dwFlags: DWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> c_int; + pub fn WSASendMsg( + Handle: SOCKET, + lpMsg: LPWSAMSG, + dwFlags: DWORD, + lpNumberOfBytesSent: LPDWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> c_int; + pub fn WSASendDisconnect( + s: SOCKET, + lpOutboundDisconnectData: LPWSABUF, + ) -> c_int; + pub fn WSASendTo( + s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesSent: LPDWORD, + dwFlags: DWORD, + lpTo: *const SOCKADDR, + iToLen: c_int, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> c_int; + pub fn WSASetEvent( + hEvent: WSAEVENT, + ) -> BOOL; + pub fn WSASocketA( + af: c_int, + _type: c_int, + protocol: c_int, + lpProtocolInfo: LPWSAPROTOCOL_INFOA, + g: GROUP, + dwFlags: DWORD, + ) -> SOCKET; + pub fn WSASocketW( + af: c_int, + _type: c_int, + protocol: c_int, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + g: GROUP, + dwFlags: DWORD, + ) -> SOCKET; + pub fn WSAWaitForMultipleEvents( + cEvents: DWORD, + lphEvents: *const WSAEVENT, + fWaitAll: BOOL, + dwTimeout: DWORD, + fAlertable: BOOL, + ) -> DWORD; + pub fn WSAAddressToStringA( + lpsaAddress: LPSOCKADDR, + dwAddressLength: DWORD, + lpProtocolInfo: LPWSAPROTOCOL_INFOA, + lpszAddressString: LPSTR, + lpdwAddressStringLength: LPDWORD, + ) -> INT; + pub fn WSAAddressToStringW( + lpsaAddress: LPSOCKADDR, + dwAddressLength: DWORD, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + lpszAddressString: LPWSTR, + lpdwAddressStringLength: LPDWORD, + ) -> INT; + pub fn WSAStringToAddressA( + AddressString: LPSTR, + AddressFamily: INT, + lpProtocolInfo: LPWSAPROTOCOL_INFOA, + lpAddress: LPSOCKADDR, + lpAddressLength: LPINT, + ) -> INT; + pub fn WSAStringToAddressW( + AddressString: LPWSTR, + AddressFamily: INT, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + lpAddress: LPSOCKADDR, + lpAddressLength: LPINT, + ) -> INT; + pub fn WSALookupServiceBeginA( + lpqsRestrictions: LPWSAQUERYSETA, + dwControlFlags: DWORD, + lphLookup: LPHANDLE, + ) -> INT; + pub fn WSALookupServiceBeginW( + lpqsRestrictions: LPWSAQUERYSETW, + dwControlFlags: DWORD, + lphLookup: LPHANDLE, + ) -> INT; + pub fn WSALookupServiceNextA( + hLookup: HANDLE, + dwControlFlags: DWORD, + lpdwBufferLength: LPDWORD, + lpqsResults: LPWSAQUERYSETA, + ) -> INT; + pub fn WSALookupServiceNextW( + hLookup: HANDLE, + dwControlFlags: DWORD, + lpdwBufferLength: LPDWORD, + lpqsResults: LPWSAQUERYSETW, + ) -> INT; + pub fn WSANSPIoctl( + hLookup: HANDLE, + dwControlFlags: DWORD, + lpvInBuffer: LPVOID, + cbInBuffer: DWORD, + lpvOutBuffer: LPVOID, + cbOutBuffer: DWORD, + lpcbBytesReturned: LPDWORD, + lpCompletion: LPWSACOMPLETION, + ) -> INT; + pub fn WSALookupServiceEnd( + hLookup: HANDLE, + ) -> INT; + pub fn WSAInstallServiceClassA( + lpServiceClassInfo: LPWSASERVICECLASSINFOA, + ) -> INT; + pub fn WSAInstallServiceClassW( + lpServiceClassInfo: LPWSASERVICECLASSINFOW, + ) -> INT; + pub fn WSARemoveServiceClass( + lpServiceClassId: LPGUID, + ) -> INT; + pub fn WSAGetServiceClassInfoA( + lpProviderId: LPGUID, + lpServiceClassId: LPGUID, + lpdwBufSize: LPDWORD, + lpServiceClassInfo: LPWSASERVICECLASSINFOA, + ) -> INT; + pub fn WSAGetServiceClassInfoW( + lpProviderId: LPGUID, + lpServiceClassId: LPGUID, + lpdwBufSize: LPDWORD, + lpServiceClassInfo: LPWSASERVICECLASSINFOW, + ) -> INT; + pub fn WSAEnumNameSpaceProvidersA( + lpdwBufferLength: LPDWORD, + lpnspBuffer: LPWSANAMESPACE_INFOA, + ) -> INT; + pub fn WSAEnumNameSpaceProvidersW( + lpdwBufferLength: LPDWORD, + lpnspBuffer: LPWSANAMESPACE_INFOW, + ) -> INT; + pub fn WSAEnumNameSpaceProvidersExA( + lpdwBufferLength: LPDWORD, + lpnspBuffer: LPWSANAMESPACE_INFOEXA, + ) -> INT; + pub fn WSAEnumNameSpaceProvidersExW( + lpdwBufferLength: LPDWORD, + lpnspBuffer: LPWSANAMESPACE_INFOEXW, + ) -> INT; + pub fn WSAGetServiceClassNameByClassIdA( + lpServiceClassId: LPGUID, + lpszServiceClassName: LPSTR, + lpdwBufferLength: LPDWORD, + ) -> INT; + pub fn WSAGetServiceClassNameByClassIdW( + lpServiceClassId: LPGUID, + lpszServiceClassName: LPWSTR, + lpdwBufferLength: LPDWORD, + ) -> INT; + pub fn WSASetServiceA( + lpqsRegInfo: LPWSAQUERYSETA, + essoperation: WSAESETSERVICEOP, + dwControlFlags: DWORD, + ) -> INT; + pub fn WSASetServiceW( + lpqsRegInfo: LPWSAQUERYSETW, + essoperation: WSAESETSERVICEOP, + dwControlFlags: DWORD, + ) -> INT; + pub fn WSAProviderConfigChange( + lpNotificationHandle: LPHANDLE, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> INT; + pub fn WSAPoll( + fdArray: LPWSAPOLLFD, + fds: ULONG, + timeout: INT, + ) -> c_int; +} +pub type LPSOCKADDR_IN = *mut SOCKADDR_IN; +pub type LINGER = linger; +pub type PLINGER = *mut linger; +pub type LPLINGER = *mut linger; +pub type FD_SET = fd_set; +pub type PFD_SET = *mut fd_set; +pub type LPFD_SET = *mut fd_set; +pub type HOSTENT = hostent; +pub type PHOSTENT = *mut hostent; +pub type LPHOSTENT = *mut hostent; +pub type SERVENT = servent; +pub type PSERVENT = *mut servent; +pub type LPSERVENT = *mut servent; +pub type PROTOENT = protoent; +pub type PPROTOENT = *mut protoent; +pub type LPPROTOENT = *mut protoent; +pub type TIMEVAL = timeval; +pub type PTIMEVAL = *mut timeval; +pub type LPTIMEVAL = *mut timeval; +#[inline] +pub fn WSAMAKEASYNCREPLY(buflen: WORD, error: WORD) -> LONG { + MAKELONG(buflen, error) +} +#[inline] +pub fn WSAMAKESELECTREPLY(event: WORD, error: WORD) -> LONG { + MAKELONG(event, error) +} +#[inline] +pub fn WSAGETASYNCBUFLEN(lParam: DWORD) -> WORD { + LOWORD(lParam) +} +#[inline] +pub fn WSAGETASYNCERROR(lParam: DWORD) -> WORD { + HIWORD(lParam) +} +#[inline] +pub fn WSAGETSELECTEVENT(lParam: DWORD) -> WORD { + LOWORD(lParam) +} +#[inline] +pub fn WSAGETSELECTERROR(lParam: DWORD) -> WORD { + HIWORD(lParam) +} diff --git a/src/vendor/winapi/src/um/winspool.rs b/src/vendor/winapi/src/um/winspool.rs new file mode 100644 index 0000000000..1290e1a07a --- /dev/null +++ b/src/vendor/winapi/src/um/winspool.rs @@ -0,0 +1,2434 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Winspool header file +use shared::guiddef::GUID; +use shared::minwindef::{ + BOOL, BYTE, DWORD, FILETIME, FLOAT, LPBYTE, LPDWORD, LPHANDLE, LPVOID, MAX_PATH, PBYTE, PDWORD, + PULONG, PWORD, UINT, ULONG, WORD, +}; +use shared::windef::{HWND, RECTL, SIZEL}; +use shared::winerror::ERROR_NOT_SUPPORTED; +use um::minwinbase::SYSTEMTIME; +use um::wingdi::{LPDEVMODEA, LPDEVMODEW, PDEVMODEA, PDEVMODEW}; +use um::winnt::{ + ACCESS_MASK, CHAR, DWORDLONG, HANDLE, HRESULT, LANGID, LONG, LONGLONG, LPCSTR, LPCWSTR, LPSTR, + LPWSTR, PCWSTR, PSECURITY_DESCRIPTOR, PVOID, PWSTR, STANDARD_RIGHTS_EXECUTE, + STANDARD_RIGHTS_READ, STANDARD_RIGHTS_REQUIRED, STANDARD_RIGHTS_WRITE, WCHAR, +}; +use vc::vcruntime::size_t; +STRUCT!{struct PRINTER_INFO_1A { + Flags: DWORD, + pDescription: LPSTR, + pName: LPSTR, + pComment: LPSTR, +}} +pub type PPRINTER_INFO_1A = *mut PRINTER_INFO_1A; +pub type LPPRINTER_INFO_1A = *mut PRINTER_INFO_1A; +STRUCT!{struct PRINTER_INFO_1W { + Flags: DWORD, + pDescription: LPWSTR, + pName: LPWSTR, + pComment: LPWSTR, +}} +pub type PPRINTER_INFO_1W = *mut PRINTER_INFO_1W; +pub type LPPRINTER_INFO_1W = *mut PRINTER_INFO_1W; +STRUCT!{struct PRINTER_INFO_2A { + pServerName: LPSTR, + pPrinterName: LPSTR, + pShareName: LPSTR, + pPortName: LPSTR, + pDriverName: LPSTR, + pComment: LPSTR, + pLocation: LPSTR, + pDevMode: LPDEVMODEA, + pSepFile: LPSTR, + pPrintProcessor: LPSTR, + pDatatype: LPSTR, + pParameters: LPSTR, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + Attributes: DWORD, + Priority: DWORD, + DefaultPriority: DWORD, + StartTime: DWORD, + UntilTime: DWORD, + Status: DWORD, + cJobs: DWORD, + AveragePPM: DWORD, +}} +pub type PPRINTER_INFO_2A = *mut PRINTER_INFO_2A; +pub type LPPRINTER_INFO_2A = *mut PRINTER_INFO_2A; +STRUCT!{struct PRINTER_INFO_2W { + pServerName: LPWSTR, + pPrinterName: LPWSTR, + pShareName: LPWSTR, + pPortName: LPWSTR, + pDriverName: LPWSTR, + pComment: LPWSTR, + pLocation: LPWSTR, + pDevMode: LPDEVMODEW, + pSepFile: LPWSTR, + pPrintProcessor: LPWSTR, + pDatatype: LPWSTR, + pParameters: LPWSTR, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + Attributes: DWORD, + Priority: DWORD, + DefaultPriority: DWORD, + StartTime: DWORD, + UntilTime: DWORD, + Status: DWORD, + cJobs: DWORD, + AveragePPM: DWORD, +}} +pub type PPRINTER_INFO_2W = *mut PRINTER_INFO_2W; +pub type LPPRINTER_INFO_2W = *mut PRINTER_INFO_2W; +STRUCT!{struct PRINTER_INFO_3 { + pSecurityDescriptor: PSECURITY_DESCRIPTOR, +}} +pub type PPRINTER_INFO_3 = *mut PRINTER_INFO_3; +pub type LPPRINTER_INFO_3 = *mut PRINTER_INFO_3; +STRUCT!{struct PRINTER_INFO_4A { + pPrinterName: LPSTR, + pServerName: LPSTR, + Attributes: DWORD, +}} +pub type PPRINTER_INFO_4A = *mut PRINTER_INFO_4A; +pub type LPPRINTER_INFO_4A = *mut PRINTER_INFO_4A; +STRUCT!{struct PRINTER_INFO_4W { + pPrinterName: LPWSTR, + pServerName: LPWSTR, + Attributes: DWORD, +}} +pub type PPRINTER_INFO_4W = *mut PRINTER_INFO_4W; +pub type LPPRINTER_INFO_4W = *mut PRINTER_INFO_4W; +STRUCT!{struct PRINTER_INFO_5A { + pPrinterName: LPSTR, + pPortName: LPSTR, + Attributes: DWORD, + DeviceNotSelectedTimeout: DWORD, + TransmissionRetryTimeout: DWORD, +}} +pub type PPRINTER_INFO_5A = *mut PRINTER_INFO_5A; +pub type LPPRINTER_INFO_5A = *mut PRINTER_INFO_5A; +STRUCT!{struct PRINTER_INFO_5W { + pPrinterName: LPWSTR, + pPortName: LPWSTR, + Attributes: DWORD, + DeviceNotSelectedTimeout: DWORD, + TransmissionRetryTimeout: DWORD, +}} +pub type PPRINTER_INFO_5W = *mut PRINTER_INFO_5W; +pub type LPPRINTER_INFO_5W = *mut PRINTER_INFO_5W; +STRUCT!{struct PRINTER_INFO_6 { + dwStatus: DWORD, +}} +pub type PPRINTER_INFO_6 = *mut PRINTER_INFO_6; +pub type LPPRINTER_INFO_6 = *mut PRINTER_INFO_6; +STRUCT!{struct PRINTER_INFO_7A { + pszObjectGUID: LPSTR, + dwAction: DWORD, +}} +pub type PPRINTER_INFO_7A = *mut PRINTER_INFO_7A; +pub type LPPRINTER_INFO_7A = *mut PRINTER_INFO_7A; +STRUCT!{struct PRINTER_INFO_7W { + pszObjectGUID: LPWSTR, + dwAction: DWORD, +}} +pub type PPRINTER_INFO_7W = *mut PRINTER_INFO_7W; +pub type LPPRINTER_INFO_7W = *mut PRINTER_INFO_7W; +pub const DSPRINT_PUBLISH: DWORD = 0x00000001; +pub const DSPRINT_UPDATE: DWORD = 0x00000002; +pub const DSPRINT_UNPUBLISH: DWORD = 0x00000004; +pub const DSPRINT_REPUBLISH: DWORD = 0x00000008; +pub const DSPRINT_PENDING: DWORD = 0x80000000; +STRUCT!{struct PRINTER_INFO_8A { + pDevMode: LPDEVMODEA, +}} +pub type PPRINTER_INFO_8A = *mut PRINTER_INFO_8A; +pub type LPPRINTER_INFO_8A = *mut PRINTER_INFO_8A; +STRUCT!{struct PRINTER_INFO_8W { + pDevMode: LPDEVMODEW, +}} +pub type PPRINTER_INFO_8W = *mut PRINTER_INFO_8W; +pub type LPPRINTER_INFO_8W = *mut PRINTER_INFO_8W; +STRUCT!{struct PRINTER_INFO_9A { + pDevMode: LPDEVMODEA, +}} +pub type PPRINTER_INFO_9A = *mut PRINTER_INFO_9A; +pub type LPPRINTER_INFO_9A = *mut PRINTER_INFO_9A; +STRUCT!{struct PRINTER_INFO_9W { + pDevMode: LPDEVMODEA, +}} +pub type PPRINTER_INFO_9W = *mut PRINTER_INFO_9W; +pub type LPPRINTER_INFO_9W = *mut PRINTER_INFO_9W; +pub const PRINTER_CONTROL_PAUSE: DWORD = 1; +pub const PRINTER_CONTROL_RESUME: DWORD = 2; +pub const PRINTER_CONTROL_PURGE: DWORD = 3; +pub const PRINTER_CONTROL_SET_STATUS: DWORD = 4; +pub const PRINTER_STATUS_PAUSED: DWORD = 0x00000001; +pub const PRINTER_STATUS_ERROR: DWORD = 0x00000002; +pub const PRINTER_STATUS_PENDING_DELETION: DWORD = 0x00000004; +pub const PRINTER_STATUS_PAPER_JAM: DWORD = 0x00000008; +pub const PRINTER_STATUS_PAPER_OUT: DWORD = 0x00000010; +pub const PRINTER_STATUS_MANUAL_FEED: DWORD = 0x00000020; +pub const PRINTER_STATUS_PAPER_PROBLEM: DWORD = 0x00000040; +pub const PRINTER_STATUS_OFFLINE: DWORD = 0x00000080; +pub const PRINTER_STATUS_IO_ACTIVE: DWORD = 0x00000100; +pub const PRINTER_STATUS_BUSY: DWORD = 0x00000200; +pub const PRINTER_STATUS_PRINTING: DWORD = 0x00000400; +pub const PRINTER_STATUS_OUTPUT_BIN_FULL: DWORD = 0x00000800; +pub const PRINTER_STATUS_NOT_AVAILABLE: DWORD = 0x00001000; +pub const PRINTER_STATUS_WAITING: DWORD = 0x00002000; +pub const PRINTER_STATUS_PROCESSING: DWORD = 0x00004000; +pub const PRINTER_STATUS_INITIALIZING: DWORD = 0x00008000; +pub const PRINTER_STATUS_WARMING_UP: DWORD = 0x00010000; +pub const PRINTER_STATUS_TONER_LOW: DWORD = 0x00020000; +pub const PRINTER_STATUS_NO_TONER: DWORD = 0x00040000; +pub const PRINTER_STATUS_PAGE_PUNT: DWORD = 0x00080000; +pub const PRINTER_STATUS_USER_INTERVENTION: DWORD = 0x00100000; +pub const PRINTER_STATUS_OUT_OF_MEMORY: DWORD = 0x00200000; +pub const PRINTER_STATUS_DOOR_OPEN: DWORD = 0x00400000; +pub const PRINTER_STATUS_SERVER_UNKNOWN: DWORD = 0x00800000; +pub const PRINTER_STATUS_POWER_SAVE: DWORD = 0x01000000; +pub const PRINTER_STATUS_SERVER_OFFLINE: DWORD = 0x02000000; +pub const PRINTER_STATUS_DRIVER_UPDATE_NEEDED: DWORD = 0x04000000; +pub const PRINTER_ATTRIBUTE_QUEUED: DWORD = 0x00000001; +pub const PRINTER_ATTRIBUTE_DIRECT: DWORD = 0x00000002; +pub const PRINTER_ATTRIBUTE_DEFAULT: DWORD = 0x00000004; +pub const PRINTER_ATTRIBUTE_SHARED: DWORD = 0x00000008; +pub const PRINTER_ATTRIBUTE_NETWORK: DWORD = 0x00000010; +pub const PRINTER_ATTRIBUTE_HIDDEN: DWORD = 0x00000020; +pub const PRINTER_ATTRIBUTE_LOCAL: DWORD = 0x00000040; +pub const PRINTER_ATTRIBUTE_ENABLE_DEVQ: DWORD = 0x00000080; +pub const PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS: DWORD = 0x00000100; +pub const PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST: DWORD = 0x00000200; +pub const PRINTER_ATTRIBUTE_WORK_OFFLINE: DWORD = 0x00000400; +pub const PRINTER_ATTRIBUTE_ENABLE_BIDI: DWORD = 0x00000800; +pub const PRINTER_ATTRIBUTE_RAW_ONLY: DWORD = 0x00001000; +pub const PRINTER_ATTRIBUTE_PUBLISHED: DWORD = 0x00002000; +pub const PRINTER_ATTRIBUTE_FAX: DWORD = 0x00004000; +pub const PRINTER_ATTRIBUTE_TS: DWORD = 0x00008000; +pub const PRINTER_ATTRIBUTE_PUSHED_USER: DWORD = 0x00020000; +pub const PRINTER_ATTRIBUTE_PUSHED_MACHINE: DWORD = 0x00040000; +pub const PRINTER_ATTRIBUTE_MACHINE: DWORD = 0x00080000; +pub const PRINTER_ATTRIBUTE_FRIENDLY_NAME: DWORD = 0x00100000; +pub const PRINTER_ATTRIBUTE_TS_GENERIC_DRIVER: DWORD = 0x00200000; +pub const PRINTER_ATTRIBUTE_PER_USER: DWORD = 0x00400000; +pub const PRINTER_ATTRIBUTE_ENTERPRISE_CLOUD: DWORD = 0x00800000; +pub const NO_PRIORITY: DWORD = 0; +pub const MAX_PRIORITY: DWORD = 99; +pub const MIN_PRIORITY: DWORD = 1; +pub const DEF_PRIORITY: DWORD = 1; +STRUCT!{struct JOB_INFO_1A { + JobId: DWORD, + pPrinterName: LPSTR, + pMachineName: LPSTR, + pUserName: LPSTR, + pDocument: LPSTR, + pDatatype: LPSTR, + pStatus: LPSTR, + Status: DWORD, + Priority: DWORD, + Position: DWORD, + TotalPages: DWORD, + PagesPrinted: DWORD, + Submitted: SYSTEMTIME, +}} +pub type PJOB_INFO_1A = *mut JOB_INFO_1A; +pub type LPJOB_INFO_1A = *mut JOB_INFO_1A; +STRUCT!{struct JOB_INFO_1W { + JobId: DWORD, + pPrinterName: LPWSTR, + pMachineName: LPWSTR, + pUserName: LPWSTR, + pDocument: LPWSTR, + pDatatype: LPWSTR, + pStatus: LPWSTR, + Status: DWORD, + Priority: DWORD, + Position: DWORD, + TotalPages: DWORD, + PagesPrinted: DWORD, + Submitted: SYSTEMTIME, +}} +pub type PJOB_INFO_1W = *mut JOB_INFO_1W; +pub type LPJOB_INFO_1W = *mut JOB_INFO_1W; +STRUCT!{struct JOB_INFO_2A { + JobId: DWORD, + pPrinterName: LPSTR, + pMachineName: LPSTR, + pUserName: LPSTR, + pDocument: LPSTR, + pNotifyName: LPSTR, + pDatatype: LPSTR, + pPrintProcessor: LPSTR, + pParameters: LPSTR, + pDriverName: LPSTR, + pDevMode: LPDEVMODEA, + pStatus: LPSTR, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + Status: DWORD, + Priority: DWORD, + Position: DWORD, + StartTime: DWORD, + UntilTime: DWORD, + TotalPages: DWORD, + Size: DWORD, + Submitted: SYSTEMTIME, + Time: DWORD, + PagesPrinted: DWORD, +}} +pub type PJOB_INFO_2A = *mut JOB_INFO_2A; +pub type LPJOB_INFO_2A = *mut JOB_INFO_2A; +STRUCT!{struct JOB_INFO_2W { + JobId: DWORD, + pPrinterName: LPWSTR, + pMachineName: LPWSTR, + pUserName: LPWSTR, + pDocument: LPWSTR, + pNotifyName: LPWSTR, + pDatatype: LPWSTR, + pPrintProcessor: LPWSTR, + pParameters: LPWSTR, + pDriverName: LPWSTR, + pDevMode: LPDEVMODEW, + pStatus: LPWSTR, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + Status: DWORD, + Priority: DWORD, + Position: DWORD, + StartTime: DWORD, + UntilTime: DWORD, + TotalPages: DWORD, + Size: DWORD, + Submitted: SYSTEMTIME, + Time: DWORD, + PagesPrinted: DWORD, +}} +pub type PJOB_INFO_2W = *mut JOB_INFO_2W; +pub type LPJOB_INFO_2W = *mut JOB_INFO_2W; +STRUCT!{struct JOB_INFO_3 { + JobId: DWORD, + NextJobId: DWORD, + Reserved: DWORD, +}} +pub type PJOB_INFO_3 = *mut JOB_INFO_3; +pub type LPJOB_INFO_3 = *mut JOB_INFO_3; +STRUCT!{struct JOB_INFO_4A { + JobId: DWORD, + pPrinterName: LPSTR, + pMachineName: LPSTR, + pUserName: LPSTR, + pDocument: LPSTR, + pNotifyName: LPSTR, + pDatatype: LPSTR, + pPrintProcessor: LPSTR, + pParameters: LPSTR, + pDriverName: LPSTR, + pDevMode: LPDEVMODEA, + pStatus: LPSTR, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + Status: DWORD, + Priority: DWORD, + Position: DWORD, + StartTime: DWORD, + UntilTime: DWORD, + TotalPages: DWORD, + Size: DWORD, + Submitted: SYSTEMTIME, + Time: DWORD, + PagesPrinted: DWORD, + SizeHigh: LONG, +}} +pub type PJOB_INFO_4A = *mut JOB_INFO_4A; +pub type LPJOB_INFO_4A = *mut JOB_INFO_4A; +STRUCT!{struct JOB_INFO_4W { + JobId: DWORD, + pPrinterName: LPWSTR, + pMachineName: LPWSTR, + pUserName: LPWSTR, + pDocument: LPWSTR, + pNotifyName: LPWSTR, + pDatatype: LPWSTR, + pPrintProcessor: LPWSTR, + pParameters: LPWSTR, + pDriverName: LPWSTR, + pDevMode: LPDEVMODEW, + pStatus: LPWSTR, + pSecurityDescriptor: PSECURITY_DESCRIPTOR, + Status: DWORD, + Priority: DWORD, + Position: DWORD, + StartTime: DWORD, + UntilTime: DWORD, + TotalPages: DWORD, + Size: DWORD, + Submitted: SYSTEMTIME, + Time: DWORD, + PagesPrinted: DWORD, + SizeHigh: LONG, +}} +pub type PJOB_INFO_4W = *mut JOB_INFO_4W; +pub type LPJOB_INFO_4W = *mut JOB_INFO_4W; +pub const JOB_CONTROL_PAUSE: DWORD = 1; +pub const JOB_CONTROL_RESUME: DWORD = 2; +pub const JOB_CONTROL_CANCEL: DWORD = 3; +pub const JOB_CONTROL_RESTART: DWORD = 4; +pub const JOB_CONTROL_DELETE: DWORD = 5; +pub const JOB_CONTROL_SENT_TO_PRINTER: DWORD = 6; +pub const JOB_CONTROL_LAST_PAGE_EJECTED: DWORD = 7; +pub const JOB_STATUS_PAUSED: DWORD = 0x00000001; +pub const JOB_STATUS_ERROR: DWORD = 0x00000002; +pub const JOB_STATUS_DELETING: DWORD = 0x00000004; +pub const JOB_STATUS_SPOOLING: DWORD = 0x00000008; +pub const JOB_STATUS_PRINTING: DWORD = 0x00000010; +pub const JOB_STATUS_OFFLINE: DWORD = 0x00000020; +pub const JOB_STATUS_PAPEROUT: DWORD = 0x00000040; +pub const JOB_STATUS_PRINTED: DWORD = 0x00000080; +pub const JOB_STATUS_DELETED: DWORD = 0x00000100; +pub const JOB_STATUS_BLOCKED_DEVQ: DWORD = 0x00000200; +pub const JOB_STATUS_USER_INTERVENTION: DWORD = 0x00000400; +pub const JOB_STATUS_RESTART: DWORD = 0x00000800; +pub const JOB_POSITION_UNSPECIFIED: DWORD = 0; +STRUCT!{struct ADDJOB_INFO_1A { + Path: LPSTR, + JobId: DWORD, +}} +pub type PADDJOB_INFO_1A = *mut ADDJOB_INFO_1A; +pub type LPADDJOB_INFO_1A = *mut ADDJOB_INFO_1A; +STRUCT!{struct ADDJOB_INFO_1W { + Path: LPWSTR, + JobId: DWORD, +}} +pub type PADDJOB_INFO_1W = *mut ADDJOB_INFO_1W; +pub type LPADDJOB_INFO_1W = *mut ADDJOB_INFO_1W; +STRUCT!{struct DRIVER_INFO_1A { + pName: LPSTR, +}} +pub type PDRIVER_INFO_1A = *mut DRIVER_INFO_1A; +pub type LPDRIVER_INFO_1A = *mut DRIVER_INFO_1A; +STRUCT!{struct DRIVER_INFO_1W { + pName: LPWSTR, +}} +pub type PDRIVER_INFO_1W = *mut DRIVER_INFO_1W; +pub type LPDRIVER_INFO_1W = *mut DRIVER_INFO_1W; +STRUCT!{struct DRIVER_INFO_2A { + cVersion: DWORD, + pName: LPSTR, + pEnvironment: LPSTR, + pDriverPath: LPSTR, + pDataFile: LPSTR, + pConfigFile: LPSTR, +}} +pub type PDRIVER_INFO_2A = *mut DRIVER_INFO_2A; +pub type LPDRIVER_INFO_2A = *mut DRIVER_INFO_2A; +STRUCT!{struct DRIVER_INFO_2W { + cVersion: DWORD, + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverPath: LPWSTR, + pDataFile: LPWSTR, + pConfigFile: LPWSTR, +}} +pub type PDRIVER_INFO_2W = *mut DRIVER_INFO_2W; +pub type LPDRIVER_INFO_2W = *mut DRIVER_INFO_2W; +STRUCT!{struct DRIVER_INFO_3A { + cVersion: DWORD, + pName: LPSTR, + pEnvironment: LPSTR, + pDriverPath: LPSTR, + pDataFile: LPSTR, + pConfigFile: LPSTR, + pHelpFile: LPSTR, + pDependentFiles: LPSTR, + pMonitorName: LPSTR, + pDefaultDataType: LPSTR, +}} +pub type PDRIVER_INFO_3A = *mut DRIVER_INFO_3A; +pub type LPDRIVER_INFO_3A = *mut DRIVER_INFO_3A; +STRUCT!{struct DRIVER_INFO_3W { + cVersion: DWORD, + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverPath: LPWSTR, + pDataFile: LPWSTR, + pConfigFile: LPWSTR, + pHelpFile: LPWSTR, + pDependentFiles: LPWSTR, + pMonitorName: LPWSTR, + pDefaultDataType: LPWSTR, +}} +pub type PDRIVER_INFO_3W = *mut DRIVER_INFO_3W; +pub type LPDRIVER_INFO_3W = *mut DRIVER_INFO_3W; +STRUCT!{struct DRIVER_INFO_4A { + cVersion: DWORD, + pName: LPSTR, + pEnvironment: LPSTR, + pDriverPath: LPSTR, + pDataFile: LPSTR, + pConfigFile: LPSTR, + pHelpFile: LPSTR, + pDependentFiles: LPSTR, + pMonitorName: LPSTR, + pDefaultDataType: LPSTR, + pszzPreviousNames: LPSTR, +}} +pub type PDRIVER_INFO_4A = *mut DRIVER_INFO_4A; +pub type LPDRIVER_INFO_4A = *mut DRIVER_INFO_4A; +STRUCT!{struct DRIVER_INFO_4W { + cVersion: DWORD, + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverPath: LPWSTR, + pDataFile: LPWSTR, + pConfigFile: LPWSTR, + pHelpFile: LPWSTR, + pDependentFiles: LPWSTR, + pMonitorName: LPWSTR, + pDefaultDataType: LPWSTR, + pszzPreviousNames: LPWSTR, +}} +pub type PDRIVER_INFO_4W = *mut DRIVER_INFO_4W; +pub type LPDRIVER_INFO_4W = *mut DRIVER_INFO_4W; +STRUCT!{struct DRIVER_INFO_5A { + cVersion: DWORD, + pName: LPSTR, + pEnvironment: LPSTR, + pDriverPath: LPSTR, + pDataFile: LPSTR, + pConfigFile: LPSTR, + dwDriverAttributes: DWORD, + dwConfigVersion: DWORD, + dwDriverVersion: DWORD, +}} +pub type PDRIVER_INFO_5A = *mut DRIVER_INFO_5A; +pub type LPDRIVER_INFO_5A = *mut DRIVER_INFO_5A; +STRUCT!{struct DRIVER_INFO_5W { + cVersion: DWORD, + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverPath: LPWSTR, + pDataFile: LPWSTR, + pConfigFile: LPWSTR, + dwDriverAttributes: DWORD, + dwConfigVersion: DWORD, + dwDriverVersion: DWORD, +}} +pub type PDRIVER_INFO_5W = *mut DRIVER_INFO_5W; +pub type LPDRIVER_INFO_5W = *mut DRIVER_INFO_5W; +STRUCT!{struct DRIVER_INFO_6A { + cVersion: DWORD, + pName: LPSTR, + pEnvironment: LPSTR, + pDriverPath: LPSTR, + pDataFile: LPSTR, + pConfigFile: LPSTR, + pHelpFile: LPSTR, + pDependentFiles: LPSTR, + pMonitorName: LPSTR, + pDefaultDataType: LPSTR, + pszzPreviousNames: LPSTR, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + pszMfgName: LPSTR, + pszOEMUrl: LPSTR, + pszHardwareID: LPSTR, + pszProvider: LPSTR, +}} +pub type PDRIVER_INFO_6A = *mut DRIVER_INFO_6A; +pub type LPDRIVER_INFO_6A = *mut DRIVER_INFO_6A; +STRUCT!{struct DRIVER_INFO_6W { + cVersion: DWORD, + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverPath: LPWSTR, + pDataFile: LPWSTR, + pConfigFile: LPWSTR, + pHelpFile: LPWSTR, + pDependentFiles: LPWSTR, + pMonitorName: LPWSTR, + pDefaultDataType: LPWSTR, + pszzPreviousNames: LPWSTR, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + pszMfgName: LPWSTR, + pszOEMUrl: LPWSTR, + pszHardwareID: LPWSTR, + pszProvider: LPWSTR, +}} +pub type PDRIVER_INFO_6W = *mut DRIVER_INFO_6W; +pub type LPDRIVER_INFO_6W = *mut DRIVER_INFO_6W; +pub const PRINTER_DRIVER_PACKAGE_AWARE: DWORD = 0x00000001; +pub const PRINTER_DRIVER_XPS: DWORD = 0x00000002; +pub const PRINTER_DRIVER_SANDBOX_ENABLED: DWORD = 0x00000004; +pub const PRINTER_DRIVER_CLASS: DWORD = 0x00000008; +pub const PRINTER_DRIVER_DERIVED: DWORD = 0x00000010; +pub const PRINTER_DRIVER_NOT_SHAREABLE: DWORD = 0x00000020; +pub const PRINTER_DRIVER_CATEGORY_FAX: DWORD = 0x00000040; +pub const PRINTER_DRIVER_CATEGORY_FILE: DWORD = 0x00000080; +pub const PRINTER_DRIVER_CATEGORY_VIRTUAL: DWORD = 0x00000100; +pub const PRINTER_DRIVER_CATEGORY_SERVICE: DWORD = 0x00000200; +pub const PRINTER_DRIVER_SOFT_RESET_REQUIRED: DWORD = 0x00000400; +pub const PRINTER_DRIVER_SANDBOX_DISABLED: DWORD = 0x00000800; +pub const PRINTER_DRIVER_CATEGORY_3D: DWORD = 0x00001000; +pub const PRINTER_DRIVER_CATEGORY_CLOUD: DWORD = 0x00002000; +STRUCT!{struct DRIVER_INFO_8A { + cVersion: DWORD, + pName: LPSTR, + pEnvironment: LPSTR, + pDriverPath: LPSTR, + pDataFile: LPSTR, + pConfigFile: LPSTR, + pHelpFile: LPSTR, + pDependentFiles: LPSTR, + pMonitorName: LPSTR, + pDefaultDataType: LPSTR, + pszzPreviousNames: LPSTR, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + pszMfgName: LPSTR, + pszOEMUrl: LPSTR, + pszHardwareID: LPSTR, + pszProvider: LPSTR, + pszPrintProcessor: LPSTR, + pszVendorSetup: LPSTR, + pszzColorProfiles: LPSTR, + pszInfPath: LPSTR, + dwPrinterDriverAttributes: DWORD, + pszzCoreDriverDependencies: LPSTR, + ftMinInboxDriverVerDate: FILETIME, + dwlMinInboxDriverVerVersion: DWORDLONG, +}} +pub type PDRIVER_INFO_8A = *mut DRIVER_INFO_8A; +pub type LPDRIVER_INFO_8A = *mut DRIVER_INFO_8A; +STRUCT!{struct DRIVER_INFO_8W { + cVersion: DWORD, + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverPath: LPWSTR, + pDataFile: LPWSTR, + pConfigFile: LPWSTR, + pHelpFile: LPWSTR, + pDependentFiles: LPWSTR, + pMonitorName: LPWSTR, + pDefaultDataType: LPWSTR, + pszzPreviousNames: LPWSTR, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + pszMfgName: LPWSTR, + pszOEMUrl: LPWSTR, + pszHardwareID: LPWSTR, + pszProvider: LPWSTR, + pszPrintProcessor: LPWSTR, + pszVendorSetup: LPWSTR, + pszzColorProfiles: LPWSTR, + pszInfPath: LPWSTR, + dwPrinterDriverAttributes: DWORD, + pszzCoreDriverDependencies: LPWSTR, + ftMinInboxDriverVerDate: FILETIME, + dwlMinInboxDriverVerVersion: DWORDLONG, +}} +pub type PDRIVER_INFO_8W = *mut DRIVER_INFO_8W; +pub type LPDRIVER_INFO_8W = *mut DRIVER_INFO_8W; +pub const DRIVER_KERNELMODE: DWORD = 0x00000001; +pub const DRIVER_USERMODE: DWORD = 0x00000002; +pub const DPD_DELETE_UNUSED_FILES: DWORD = 0x00000001; +pub const DPD_DELETE_SPECIFIC_VERSION: DWORD = 0x00000002; +pub const DPD_DELETE_ALL_FILES: DWORD = 0x00000004; +pub const APD_STRICT_UPGRADE: DWORD = 0x00000001; +pub const APD_STRICT_DOWNGRADE: DWORD = 0x00000002; +pub const APD_COPY_ALL_FILES: DWORD = 0x00000004; +pub const APD_COPY_NEW_FILES: DWORD = 0x00000008; +pub const APD_COPY_FROM_DIRECTORY: DWORD = 0x00000010; +STRUCT!{struct DOC_INFO_1A { + pDocName: LPSTR, + pOutputFile: LPSTR, + pDatatype: LPSTR, +}} +pub type PDOC_INFO_1A = *mut DOC_INFO_1A; +pub type LPDOC_INFO_1A = *mut DOC_INFO_1A; +STRUCT!{struct DOC_INFO_1W { + pDocName: LPWSTR, + pOutputFile: LPWSTR, + pDatatype: LPWSTR, +}} +pub type PDOC_INFO_1W = *mut DOC_INFO_1W; +pub type LPDOC_INFO_1W = *mut DOC_INFO_1W; +STRUCT!{struct FORM_INFO_1A { + Flags: DWORD, + pName: LPSTR, + Size: SIZEL, + ImageableArea: RECTL, +}} +pub type PFORM_INFO_1A = *mut FORM_INFO_1A; +pub type LPFORM_INFO_1A = *mut FORM_INFO_1A; +STRUCT!{struct FORM_INFO_1W { + Flags: DWORD, + pName: LPWSTR, + Size: SIZEL, + ImageableArea: RECTL, +}} +pub type PFORM_INFO_1W = *mut FORM_INFO_1W; +pub type LPFORM_INFO_1W = *mut FORM_INFO_1W; +pub const STRING_NONE: DWORD = 0x00000001; +pub const STRING_MUIDLL: DWORD = 0x00000002; +pub const STRING_LANGPAIR: DWORD = 0x00000004; +pub const MAX_FORM_KEYWORD_LENGTH: usize = 63 + 1; +STRUCT!{struct FORM_INFO_2A { + Flags: DWORD, + pName: LPCSTR, + Size: SIZEL, + ImageableArea: RECTL, + pKeyword: LPCSTR, + StringType: DWORD, + pMuiDll: LPCSTR, + dwResourceId: DWORD, + pDisplayName: LPCSTR, + wLangId: LANGID, +}} +pub type PFORM_INFO_2A = *mut FORM_INFO_2A; +pub type LPFORM_INFO_2A = *mut FORM_INFO_2A; +STRUCT!{struct FORM_INFO_2W { + Flags: DWORD, + pName: LPCWSTR, + Size: SIZEL, + ImageableArea: RECTL, + pKeyword: LPCSTR, + StringType: DWORD, + pMuiDll: LPCWSTR, + dwResourceId: DWORD, + pDisplayName: LPCWSTR, + wLangId: LANGID, +}} +pub type PFORM_INFO_2W = *mut FORM_INFO_2W; +pub type LPFORM_INFO_2W = *mut FORM_INFO_2W; +STRUCT!{struct DOC_INFO_2A { + pDocName: LPSTR, + pOutputFile: LPSTR, + pDatatype: LPSTR, + dwMode: DWORD, + JobId: DWORD, +}} +pub type PDOC_INFO_2A = *mut DOC_INFO_2A; +pub type LPDOC_INFO_2A = *mut DOC_INFO_2A; +STRUCT!{struct DOC_INFO_2W { + pDocName: LPWSTR, + pOutputFile: LPWSTR, + pDatatype: LPWSTR, + dwMode: DWORD, + JobId: DWORD, +}} +pub type PDOC_INFO_2W = *mut DOC_INFO_2W; +pub type LPDOC_INFO_2W = *mut DOC_INFO_2W; +pub const DI_CHANNEL: DWORD = 1; +pub const DI_READ_SPOOL_JOB: DWORD = 3; +STRUCT!{struct DOC_INFO_3A { + pDocName: LPSTR, + pOutputFile: LPSTR, + pDatatype: LPSTR, + dwFlags: DWORD, +}} +pub type PDOC_INFO_3A = *mut DOC_INFO_3A; +pub type LPDOC_INFO_3A = *mut DOC_INFO_3A; +STRUCT!{struct DOC_INFO_3W { + pDocName: LPWSTR, + pOutputFile: LPWSTR, + pDatatype: LPWSTR, + dwFlags: DWORD, +}} +pub type PDOC_INFO_3W = *mut DOC_INFO_3W; +pub type LPDOC_INFO_3W = *mut DOC_INFO_3W; +pub const DI_MEMORYMAP_WRITE: DWORD = 0x00000001; +pub const FORM_USER: DWORD = 0x00000000; +pub const FORM_BUILTIN: DWORD = 0x00000001; +pub const FORM_PRINTER: DWORD = 0x00000002; +STRUCT!{struct PRINTPROCESSOR_INFO_1A { + pName: LPSTR, +}} +pub type PPRINTPROCESSOR_INFO_1A = *mut PRINTPROCESSOR_INFO_1A; +pub type LPPRINTPROCESSOR_INFO_1A = *mut PRINTPROCESSOR_INFO_1A; +STRUCT!{struct PRINTPROCESSOR_INFO_1W { + pName: LPWSTR, +}} +pub type PPRINTPROCESSOR_INFO_1W = *mut PRINTPROCESSOR_INFO_1W; +pub type LPPRINTPROCESSOR_INFO_1W = *mut PRINTPROCESSOR_INFO_1W; +STRUCT!{struct PRINTPROCESSOR_CAPS_1 { + dwLevel: DWORD, + dwNupOptions: DWORD, + dwPageOrderFlags: DWORD, + dwNumberOfCopies: DWORD, +}} +pub type PPRINTPROCESSOR_CAPS_1 = *mut PRINTPROCESSOR_CAPS_1; +STRUCT!{struct PRINTPROCESSOR_CAPS_2 { + dwLevel: DWORD, + dwNupOptions: DWORD, + dwPageOrderFlags: DWORD, + dwNumberOfCopies: DWORD, + dwDuplexHandlingCaps: DWORD, + dwNupDirectionCaps: DWORD, + dwNupBorderCaps: DWORD, + dwBookletHandlingCaps: DWORD, + dwScalingCaps: DWORD, +}} +pub type PPRINTPROCESSOR_CAPS_2 = *mut PRINTPROCESSOR_CAPS_2; +pub const PPCAPS_RIGHT_THEN_DOWN: DWORD = 0x00000001; +pub const PPCAPS_DOWN_THEN_RIGHT: DWORD = 0x00000001 << 1; +pub const PPCAPS_LEFT_THEN_DOWN: DWORD = 0x00000001 << 2; +pub const PPCAPS_DOWN_THEN_LEFT: DWORD = 0x00000001 << 3; +pub const PPCAPS_BORDER_PRINT: DWORD = 0x00000001; +pub const PPCAPS_BOOKLET_EDGE: DWORD = 0x00000001; +pub const PPCAPS_REVERSE_PAGES_FOR_REVERSE_DUPLEX: DWORD = 0x00000001; +pub const PPCAPS_DONT_SEND_EXTRA_PAGES_FOR_DUPLEX: DWORD = 0x00000001 << 1; +pub const PPCAPS_SQUARE_SCALING: DWORD = 0x00000001; +STRUCT!{struct PORT_INFO_1A { + pName: LPSTR, +}} +pub type PPORT_INFO_1A = *mut PORT_INFO_1A; +pub type LPPORT_INFO_1A = *mut PORT_INFO_1A; +STRUCT!{struct PORT_INFO_1W { + pName: LPWSTR, +}} +pub type PPORT_INFO_1W = *mut PORT_INFO_1W; +pub type LPPORT_INFO_1W = *mut PORT_INFO_1W; +STRUCT!{struct PORT_INFO_2A { + pPortName: LPSTR, + pMonitorName: LPSTR, + pDescription: LPSTR, + fPortType: DWORD, + Reserved: DWORD, +}} +pub type PPORT_INFO_2A = *mut PORT_INFO_2A; +pub type LPPORT_INFO_2A = *mut PORT_INFO_2A; +STRUCT!{struct PORT_INFO_2W { + pPortName: LPWSTR, + pMonitorName: LPWSTR, + pDescription: LPWSTR, + fPortType: DWORD, + Reserved: DWORD, +}} +pub type PPORT_INFO_2W = *mut PORT_INFO_2W; +pub type LPPORT_INFO_2W = *mut PORT_INFO_2W; +pub const PORT_TYPE_WRITE: DWORD = 0x0001; +pub const PORT_TYPE_READ: DWORD = 0x0002; +pub const PORT_TYPE_REDIRECTED: DWORD = 0x0004; +pub const PORT_TYPE_NET_ATTACHED: DWORD = 0x0008; +STRUCT!{struct PORT_INFO_3A { + dwStatus: DWORD, + pszStatus: LPSTR, + dwSeverity: DWORD, +}} +pub type PPORT_INFO_3A = *mut PORT_INFO_3A; +pub type LPPORT_INFO_3A = *mut PORT_INFO_3A; +STRUCT!{struct PORT_INFO_3W { + dwStatus: DWORD, + pszStatus: LPWSTR, + dwSeverity: DWORD, +}} +pub type PPORT_INFO_3W = *mut PORT_INFO_3W; +pub type LPPORT_INFO_3W = *mut PORT_INFO_3W; +pub const PORT_STATUS_TYPE_ERROR: DWORD = 1; +pub const PORT_STATUS_TYPE_WARNING: DWORD = 2; +pub const PORT_STATUS_TYPE_INFO: DWORD = 3; +pub const PORT_STATUS_OFFLINE: DWORD = 1; +pub const PORT_STATUS_PAPER_JAM: DWORD = 2; +pub const PORT_STATUS_PAPER_OUT: DWORD = 3; +pub const PORT_STATUS_OUTPUT_BIN_FULL: DWORD = 4; +pub const PORT_STATUS_PAPER_PROBLEM: DWORD = 5; +pub const PORT_STATUS_NO_TONER: DWORD = 6; +pub const PORT_STATUS_DOOR_OPEN: DWORD = 7; +pub const PORT_STATUS_USER_INTERVENTION: DWORD = 8; +pub const PORT_STATUS_OUT_OF_MEMORY: DWORD = 9; +pub const PORT_STATUS_TONER_LOW: DWORD = 10; +pub const PORT_STATUS_WARMING_UP: DWORD = 11; +pub const PORT_STATUS_POWER_SAVE: DWORD = 12; +STRUCT!{struct MONITOR_INFO_1A { + pName: LPSTR, +}} +pub type PMONITOR_INFO_1A = *mut MONITOR_INFO_1A; +pub type LPMONITOR_INFO_1A = *mut MONITOR_INFO_1A; +STRUCT!{struct MONITOR_INFO_1W { + pName: LPWSTR, +}} +pub type PMONITOR_INFO_1W = *mut MONITOR_INFO_1W; +pub type LPMONITOR_INFO_1W = *mut MONITOR_INFO_1W; +STRUCT!{struct MONITOR_INFO_2A { + pName: LPSTR, + pEnvironment: LPSTR, + pDLLName: LPSTR, +}} +pub type PMONITOR_INFO_2A = *mut MONITOR_INFO_2A; +pub type LPMONITOR_INFO_2A = *mut MONITOR_INFO_2A; +STRUCT!{struct MONITOR_INFO_2W { + pName: LPWSTR, + pEnvironment: LPWSTR, + pDLLName: LPWSTR, +}} +pub type PMONITOR_INFO_2W = *mut MONITOR_INFO_2W; +pub type LPMONITOR_INFO_2W = *mut MONITOR_INFO_2W; +STRUCT!{struct DATATYPES_INFO_1A { + pName: LPSTR, +}} +pub type PDATATYPES_INFO_1A = *mut DATATYPES_INFO_1A; +pub type LPDATATYPES_INFO_1A = *mut DATATYPES_INFO_1A; +STRUCT!{struct DATATYPES_INFO_1W { + pName: LPWSTR, +}} +pub type PDATATYPES_INFO_1W = *mut DATATYPES_INFO_1W; +pub type LPDATATYPES_INFO_1W = *mut DATATYPES_INFO_1W; +STRUCT!{struct PRINTER_DEFAULTSA { + pDataType: LPSTR, + pDevMode: LPDEVMODEA, + DesiredAccess: ACCESS_MASK, +}} +pub type PPRINTER_DEFAULTSA = *mut PRINTER_DEFAULTSA; +pub type LPPRINTER_DEFAULTSA = *mut PRINTER_DEFAULTSA; +STRUCT!{struct PRINTER_DEFAULTSW { + pDataType: LPWSTR, + pDevMode: LPDEVMODEW, + DesiredAccess: ACCESS_MASK, +}} +pub type PPRINTER_DEFAULTSW = *mut PRINTER_DEFAULTSW; +pub type LPPRINTER_DEFAULTSW = *mut PRINTER_DEFAULTSW; +STRUCT!{struct PRINTER_ENUM_VALUESA { + pValueName: LPSTR, + cbValueName: DWORD, + dwType: DWORD, + pData: LPBYTE, + cbData: DWORD, +}} +pub type PPRINTER_ENUM_VALUESA = *mut PRINTER_ENUM_VALUESA; +pub type LPPRINTER_ENUM_VALUESA = *mut PRINTER_ENUM_VALUESA; +STRUCT!{struct PRINTER_ENUM_VALUESW { + pValueName: LPWSTR, + cbValueName: DWORD, + dwType: DWORD, + pData: LPBYTE, + cbData: DWORD, +}} +pub type PPRINTER_ENUM_VALUESW = *mut PRINTER_ENUM_VALUESW; +pub type LPPRINTER_ENUM_VALUESW = *mut PRINTER_ENUM_VALUESW; +extern "system" { + pub fn EnumPrintersA( + Flags: DWORD, + Name: LPSTR, + Level: DWORD, + pPrinterEnum: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumPrintersW( + Flags: DWORD, + Name: LPWSTR, + Level: DWORD, + pPrinterEnum: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; +} +pub const PRINTER_ENUM_DEFAULT: DWORD = 0x00000001; +pub const PRINTER_ENUM_LOCAL: DWORD = 0x00000002; +pub const PRINTER_ENUM_CONNECTIONS: DWORD = 0x00000004; +pub const PRINTER_ENUM_FAVORITE: DWORD = 0x00000004; +pub const PRINTER_ENUM_NAME: DWORD = 0x00000008; +pub const PRINTER_ENUM_REMOTE: DWORD = 0x00000010; +pub const PRINTER_ENUM_SHARED: DWORD = 0x00000020; +pub const PRINTER_ENUM_NETWORK: DWORD = 0x00000040; +pub const PRINTER_ENUM_EXPAND: DWORD = 0x00004000; +pub const PRINTER_ENUM_CONTAINER: DWORD = 0x00008000; +pub const PRINTER_ENUM_ICONMASK: DWORD = 0x00ff0000; +pub const PRINTER_ENUM_ICON1: DWORD = 0x00010000; +pub const PRINTER_ENUM_ICON2: DWORD = 0x00020000; +pub const PRINTER_ENUM_ICON3: DWORD = 0x00040000; +pub const PRINTER_ENUM_ICON4: DWORD = 0x00080000; +pub const PRINTER_ENUM_ICON5: DWORD = 0x00100000; +pub const PRINTER_ENUM_ICON6: DWORD = 0x00200000; +pub const PRINTER_ENUM_ICON7: DWORD = 0x00400000; +pub const PRINTER_ENUM_ICON8: DWORD = 0x00800000; +pub const PRINTER_ENUM_HIDE: DWORD = 0x01000000; +pub const PRINTER_ENUM_CATEGORY_ALL: DWORD = 0x02000000; +pub const PRINTER_ENUM_CATEGORY_3D: DWORD = 0x04000000; +pub const SPOOL_FILE_PERSISTENT: DWORD = 0x00000001; +pub const SPOOL_FILE_TEMPORARY: DWORD = 0x00000002; +extern "system" { + pub fn GetSpoolFileHandle( + hPrinter: HANDLE, + ) -> HANDLE; + pub fn CommitSpoolData( + hPrinter: HANDLE, + hSpoolFile: HANDLE, + cbCommit: DWORD, + ) -> HANDLE; + pub fn CloseSpoolFileHandle( + hPrinter: HANDLE, + hSpoolFile: HANDLE, + ) -> BOOL; + pub fn OpenPrinterA( + pPrinterName: LPSTR, + phPrinter: LPHANDLE, + pDefault: LPPRINTER_DEFAULTSA, + ) -> BOOL; + pub fn OpenPrinterW( + pPrinterName: LPWSTR, + phPrinter: LPHANDLE, + pDefault: LPPRINTER_DEFAULTSW, + ) -> BOOL; + pub fn ResetPrinterA( + hPrinter: HANDLE, + pDefault: LPPRINTER_DEFAULTSA, + ) -> BOOL; + pub fn ResetPrinterW( + hPrinter: HANDLE, + pDefault: LPPRINTER_DEFAULTSW, + ) -> BOOL; + pub fn SetJobA( + hPrinter: HANDLE, + JobId: DWORD, + Level: DWORD, + pJob: LPBYTE, + Command: DWORD, + ) -> BOOL; + pub fn SetJobW( + hPrinter: HANDLE, + JobId: DWORD, + Level: DWORD, + pJob: LPBYTE, + Command: DWORD, + ) -> BOOL; + pub fn GetJobA( + hPrinter: HANDLE, + JobId: DWORD, + Level: DWORD, + pJob: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetJobW( + hPrinter: HANDLE, + JobId: DWORD, + Level: DWORD, + pJob: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn EnumJobsA( + hPrinter: HANDLE, + FirstJob: DWORD, + NoJobs: DWORD, + Level: DWORD, + pJob: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumJobsW( + hPrinter: HANDLE, + FirstJob: DWORD, + NoJobs: DWORD, + Level: DWORD, + pJob: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn AddPrinterA( + pName: LPSTR, + Level: DWORD, + pPrinter: LPBYTE, + ) -> HANDLE; + pub fn AddPrinterW( + pName: LPWSTR, + Level: DWORD, + pPrinter: LPBYTE, + ) -> HANDLE; + pub fn DeletePrinter( + hPrinter: HANDLE, + ) -> BOOL; + pub fn SetPrinterA( + hPrinter: HANDLE, + Level: DWORD, + pPrinter: LPBYTE, + Command: DWORD, + ) -> BOOL; + pub fn SetPrinterW( + hPrinter: HANDLE, + Level: DWORD, + pPrinter: LPBYTE, + Command: DWORD, + ) -> BOOL; + pub fn GetPrinterA( + hPrinter: HANDLE, + Level: DWORD, + pPrinter: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetPrinterW( + hPrinter: HANDLE, + Level: DWORD, + pPrinter: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn AddPrinterDriverA( + pName: LPSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + ) -> BOOL; + pub fn AddPrinterDriverW( + pName: LPWSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + ) -> BOOL; + pub fn AddPrinterDriverExA( + pName: LPSTR, + Level: DWORD, + pDriverInfo: PBYTE, + dwFileCopyFlags: DWORD, + ) -> BOOL; + pub fn AddPrinterDriverExW( + pName: LPWSTR, + Level: DWORD, + pDriverInfo: PBYTE, + dwFileCopyFlags: DWORD, + ) -> BOOL; + pub fn EnumPrinterDriversA( + pName: LPSTR, + pEnvironment: LPSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumPrinterDriversW( + pName: LPWSTR, + pEnvironment: LPWSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn GetPrinterDriverA( + hPrinter: HANDLE, + pEnvironment: LPSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetPrinterDriverW( + hPrinter: HANDLE, + pEnvironment: LPWSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetPrinterDriverDirectoryA( + pName: LPSTR, + pEnvironment: LPSTR, + Level: DWORD, + pDriverDirectory: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetPrinterDriverDirectoryW( + pName: LPWSTR, + pEnvironment: LPWSTR, + Level: DWORD, + pDriverDirectory: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn DeletePrinterDriverA( + pName: LPSTR, + pEnvironment: LPSTR, + pDriverName: LPSTR, + ) -> BOOL; + pub fn DeletePrinterDriverW( + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverName: LPWSTR, + ) -> BOOL; + pub fn DeletePrinterDriverExA( + pName: LPSTR, + pEnvironment: LPSTR, + pDriverName: LPSTR, + dwDeleteFlag: DWORD, + dwVersionFlag: DWORD, + ) -> BOOL; + pub fn DeletePrinterDriverExW( + pName: LPWSTR, + pEnvironment: LPWSTR, + pDriverName: LPWSTR, + dwDeleteFlag: DWORD, + dwVersionFlag: DWORD, + ) -> BOOL; + pub fn AddPrintProcessorA( + pName: LPSTR, + pEnvironment: LPSTR, + pPathName: LPSTR, + pPrintProcessorName: LPSTR, + ) -> BOOL; + pub fn AddPrintProcessorW( + pName: LPWSTR, + pEnvironment: LPWSTR, + pPathName: LPWSTR, + pPrintProcessorName: LPWSTR, + ) -> BOOL; + pub fn EnumPrintProcessorsA( + pName: LPSTR, + pEnvironment: LPSTR, + Level: DWORD, + pPrintProcessorInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumPrintProcessorsW( + pName: LPWSTR, + pEnvironment: LPWSTR, + Level: DWORD, + pPrintProcessorInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn GetPrintProcessorDirectoryA( + pName: LPSTR, + pEnvironment: LPSTR, + Level: DWORD, + pPrintProcessorInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetPrintProcessorDirectoryW( + pName: LPWSTR, + pEnvironment: LPWSTR, + Level: DWORD, + pPrintProcessorInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn EnumPrintProcessorDatatypesA( + pName: LPSTR, + pPrintProcessorName: LPSTR, + Level: DWORD, + pDatatypes: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumPrintProcessorDatatypesW( + pName: LPWSTR, + pPrintProcessorName: LPWSTR, + Level: DWORD, + pDatatypes: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn DeletePrintProcessorA( + pName: LPSTR, + pEnvironment: LPSTR, + pPrintProcessorName: LPSTR, + ) -> BOOL; + pub fn DeletePrintProcessorW( + pName: LPWSTR, + pEnvironment: LPWSTR, + pPrintProcessorName: LPWSTR, + ) -> BOOL; + pub fn StartDocPrinterA( + hPrinter: HANDLE, + Level: DWORD, + pDocInfo: LPBYTE, + ) -> DWORD; + pub fn StartDocPrinterW( + hPrinter: HANDLE, + Level: DWORD, + pDocInfo: LPBYTE, + ) -> DWORD; + pub fn StartPagePrinter( + hPrinter: HANDLE, + ) -> BOOL; + pub fn WritePrinter( + hPrinter: HANDLE, + pBuf: LPVOID, + cbBuf: DWORD, + pcWritten: LPDWORD, + ) -> BOOL; + pub fn FlushPrinter( + hPrinter: HANDLE, + pBuf: LPVOID, + cbBuf: DWORD, + pcWritten: LPDWORD, + cSleep: DWORD, + ) -> BOOL; + pub fn EndPagePrinter( + hPrinter: HANDLE, + ) -> BOOL; + pub fn AbortPrinter( + hPrinter: HANDLE, + ) -> BOOL; + pub fn ReadPrinter( + hPrinter: HANDLE, + pBuf: LPVOID, + cbBuf: DWORD, + pNoBytesRead: LPDWORD, + ) -> BOOL; + pub fn EndDocPrinter( + hPrinter: HANDLE, + ) -> BOOL; + pub fn AddJobA( + hPrinter: HANDLE, + Level: DWORD, + pData: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn AddJobW( + hPrinter: HANDLE, + Level: DWORD, + pData: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn ScheduleJob( + hPrinter: HANDLE, + JobId: DWORD, + ) -> BOOL; + pub fn PrinterProperties( + hWnd: HWND, + hPrinter: HANDLE, + ) -> BOOL; + pub fn DocumentPropertiesA( + hWnd: HWND, + hPrinter: HANDLE, + pDeviceName: LPSTR, + pDevModeOutput: PDEVMODEA, + pDevModeInput: PDEVMODEA, + fMode: DWORD, + ) -> LONG; + pub fn DocumentPropertiesW( + hWnd: HWND, + hPrinter: HANDLE, + pDeviceName: LPWSTR, + pDevModeOutput: PDEVMODEW, + pDevModeInput: PDEVMODEW, + fMode: DWORD, + ) -> LONG; + pub fn AdvancedDocumentPropertiesA( + hWnd: HWND, + hPrinter: HANDLE, + pDeviceName: LPSTR, + pDevModeOutput: PDEVMODEA, + pDevModeInput: PDEVMODEA, + ) -> LONG; + pub fn AdvancedDocumentPropertiesW( + hWnd: HWND, + hPrinter: HANDLE, + pDeviceName: LPWSTR, + pDevModeOutput: PDEVMODEW, + pDevModeInput: PDEVMODEW, + ) -> LONG; + pub fn ExtDeviceMode( + hWnd: HWND, + hInst: HANDLE, + pDevModeOutput: LPDEVMODEA, + pDeviceName: LPSTR, + pPort: LPSTR, + pDevModeInput: LPDEVMODEA, + pProfile: LPSTR, + fMode: DWORD, + ) -> LONG; + pub fn GetPrinterDataA( + hPrinter: HANDLE, + pValueName: LPSTR, + pType: LPDWORD, + pData: LPBYTE, + nSize: DWORD, + pcbNeeded: LPDWORD, + ) -> DWORD; + pub fn GetPrinterDataW( + hPrinter: HANDLE, + pValueName: LPWSTR, + pType: LPDWORD, + pData: LPBYTE, + nSize: DWORD, + pcbNeeded: LPDWORD, + ) -> DWORD; + pub fn GetPrinterDataExA( + hPrinter: HANDLE, + pKeyName: LPCSTR, + pValueName: LPCSTR, + pType: LPDWORD, + pData: LPBYTE, + nSize: DWORD, + pcbNeeded: LPDWORD, + ) -> DWORD; + pub fn GetPrinterDataExW( + hPrinter: HANDLE, + pKeyName: LPCWSTR, + pValueName: LPCWSTR, + pType: LPDWORD, + pData: LPBYTE, + nSize: DWORD, + pcbNeeded: LPDWORD, + ) -> DWORD; + pub fn EnumPrinterDataA( + hPrinter: HANDLE, + dwIndex: DWORD, + pValueName: LPSTR, + cbValueName: DWORD, + pcbValueName: LPDWORD, + pType: LPDWORD, + pData: LPBYTE, + cbData: DWORD, + pcbData: LPDWORD, + ) -> DWORD; + pub fn EnumPrinterDataW( + hPrinter: HANDLE, + dwIndex: DWORD, + pValueName: LPWSTR, + cbValueName: DWORD, + pcbValueName: LPDWORD, + pType: LPDWORD, + pData: LPBYTE, + cbData: DWORD, + pcbData: LPDWORD, + ) -> DWORD; + pub fn EnumPrinterDataExA( + hPrinter: HANDLE, + pKeyName: LPCSTR, + pEnumValues: LPBYTE, + cbEnumValues: DWORD, + pcbEnumValues: LPDWORD, + pnEnumValues: LPDWORD, + ) -> DWORD; + pub fn EnumPrinterDataExW( + hPrinter: HANDLE, + pKeyName: LPCWSTR, + pEnumValues: LPBYTE, + cbEnumValues: DWORD, + pcbEnumValues: LPDWORD, + pnEnumValues: LPDWORD, + ) -> DWORD; + pub fn EnumPrinterKeyA( + hPrinter: HANDLE, + pKeyName: LPCSTR, + pSubKey: LPSTR, + cbSubkey: DWORD, + pcbSubkey: LPDWORD, + ) -> DWORD; + pub fn EnumPrinterKeyW( + hPrinter: HANDLE, + pKeyName: LPCWSTR, + pSubKey: LPWSTR, + cbSubkey: DWORD, + pcbSubkey: LPDWORD, + ) -> DWORD; + pub fn SetPrinterDataA( + hPrinter: HANDLE, + pValueName: LPSTR, + Type: DWORD, + pData: LPBYTE, + cbData: DWORD, + ) -> DWORD; + pub fn SetPrinterDataW( + hPrinter: HANDLE, + pValueName: LPWSTR, + Type: DWORD, + pData: LPBYTE, + cbData: DWORD, + ) -> DWORD; + pub fn SetPrinterDataExA( + hPrinter: HANDLE, + pKeyName: LPCSTR, + pValueName: LPCSTR, + Type: DWORD, + pData: LPBYTE, + cbData: DWORD, + ) -> DWORD; + pub fn SetPrinterDataExW( + hPrinter: HANDLE, + pKeyName: LPCWSTR, + pValueName: LPCWSTR, + Type: DWORD, + pData: LPBYTE, + cbData: DWORD, + ) -> DWORD; + pub fn DeletePrinterDataA( + hPrinter: HANDLE, + pValueName: LPSTR, + ) -> DWORD; + pub fn DeletePrinterDataW( + hPrinter: HANDLE, + pValueName: LPWSTR, + ) -> DWORD; + pub fn DeletePrinterDataExA( + hPrinter: HANDLE, + pKeyName: LPCSTR, + pValueName: LPCSTR, + ) -> DWORD; + pub fn DeletePrinterDataExW( + hPrinter: HANDLE, + pKeyName: LPCWSTR, + pValueName: LPCWSTR, + ) -> DWORD; + pub fn DeletePrinterKeyA( + hPrinter: HANDLE, + pKeyName: LPCSTR, + ) -> DWORD; + pub fn DeletePrinterKeyW( + hPrinter: HANDLE, + pKeyName: LPCWSTR, + ) -> DWORD; +} +pub const PRINTER_NOTIFY_TYPE: DWORD = 0x00; +pub const JOB_NOTIFY_TYPE: DWORD = 0x01; +pub const SERVER_NOTIFY_TYPE: DWORD = 0x02; +pub const PRINTER_NOTIFY_FIELD_SERVER_NAME: DWORD = 0x00; +pub const PRINTER_NOTIFY_FIELD_PRINTER_NAME: DWORD = 0x01; +pub const PRINTER_NOTIFY_FIELD_SHARE_NAME: DWORD = 0x02; +pub const PRINTER_NOTIFY_FIELD_PORT_NAME: DWORD = 0x03; +pub const PRINTER_NOTIFY_FIELD_DRIVER_NAME: DWORD = 0x04; +pub const PRINTER_NOTIFY_FIELD_COMMENT: DWORD = 0x05; +pub const PRINTER_NOTIFY_FIELD_LOCATION: DWORD = 0x06; +pub const PRINTER_NOTIFY_FIELD_DEVMODE: DWORD = 0x07; +pub const PRINTER_NOTIFY_FIELD_SEPFILE: DWORD = 0x08; +pub const PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR: DWORD = 0x09; +pub const PRINTER_NOTIFY_FIELD_PARAMETERS: DWORD = 0x0A; +pub const PRINTER_NOTIFY_FIELD_DATATYPE: DWORD = 0x0B; +pub const PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR: DWORD = 0x0C; +pub const PRINTER_NOTIFY_FIELD_ATTRIBUTES: DWORD = 0x0D; +pub const PRINTER_NOTIFY_FIELD_PRIORITY: DWORD = 0x0E; +pub const PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY: DWORD = 0x0F; +pub const PRINTER_NOTIFY_FIELD_START_TIME: DWORD = 0x10; +pub const PRINTER_NOTIFY_FIELD_UNTIL_TIME: DWORD = 0x11; +pub const PRINTER_NOTIFY_FIELD_STATUS: DWORD = 0x12; +pub const PRINTER_NOTIFY_FIELD_STATUS_STRING: DWORD = 0x13; +pub const PRINTER_NOTIFY_FIELD_CJOBS: DWORD = 0x14; +pub const PRINTER_NOTIFY_FIELD_AVERAGE_PPM: DWORD = 0x15; +pub const PRINTER_NOTIFY_FIELD_TOTAL_PAGES: DWORD = 0x16; +pub const PRINTER_NOTIFY_FIELD_PAGES_PRINTED: DWORD = 0x17; +pub const PRINTER_NOTIFY_FIELD_TOTAL_BYTES: DWORD = 0x18; +pub const PRINTER_NOTIFY_FIELD_BYTES_PRINTED: DWORD = 0x19; +pub const PRINTER_NOTIFY_FIELD_OBJECT_GUID: DWORD = 0x1A; +pub const PRINTER_NOTIFY_FIELD_FRIENDLY_NAME: DWORD = 0x1B; +pub const PRINTER_NOTIFY_FIELD_BRANCH_OFFICE_PRINTING: DWORD = 0x1C; +pub const JOB_NOTIFY_FIELD_PRINTER_NAME: DWORD = 0x00; +pub const JOB_NOTIFY_FIELD_MACHINE_NAME: DWORD = 0x01; +pub const JOB_NOTIFY_FIELD_PORT_NAME: DWORD = 0x02; +pub const JOB_NOTIFY_FIELD_USER_NAME: DWORD = 0x03; +pub const JOB_NOTIFY_FIELD_NOTIFY_NAME: DWORD = 0x04; +pub const JOB_NOTIFY_FIELD_DATATYPE: DWORD = 0x05; +pub const JOB_NOTIFY_FIELD_PRINT_PROCESSOR: DWORD = 0x06; +pub const JOB_NOTIFY_FIELD_PARAMETERS: DWORD = 0x07; +pub const JOB_NOTIFY_FIELD_DRIVER_NAME: DWORD = 0x08; +pub const JOB_NOTIFY_FIELD_DEVMODE: DWORD = 0x09; +pub const JOB_NOTIFY_FIELD_STATUS: DWORD = 0x0A; +pub const JOB_NOTIFY_FIELD_STATUS_STRING: DWORD = 0x0B; +pub const JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR: DWORD = 0x0C; +pub const JOB_NOTIFY_FIELD_DOCUMENT: DWORD = 0x0D; +pub const JOB_NOTIFY_FIELD_PRIORITY: DWORD = 0x0E; +pub const JOB_NOTIFY_FIELD_POSITION: DWORD = 0x0F; +pub const JOB_NOTIFY_FIELD_SUBMITTED: DWORD = 0x10; +pub const JOB_NOTIFY_FIELD_START_TIME: DWORD = 0x11; +pub const JOB_NOTIFY_FIELD_UNTIL_TIME: DWORD = 0x12; +pub const JOB_NOTIFY_FIELD_TIME: DWORD = 0x13; +pub const JOB_NOTIFY_FIELD_TOTAL_PAGES: DWORD = 0x14; +pub const JOB_NOTIFY_FIELD_PAGES_PRINTED: DWORD = 0x15; +pub const JOB_NOTIFY_FIELD_TOTAL_BYTES: DWORD = 0x16; +pub const JOB_NOTIFY_FIELD_BYTES_PRINTED: DWORD = 0x17; +pub const JOB_NOTIFY_FIELD_REMOTE_JOB_ID: DWORD = 0x18; +pub const SERVER_NOTIFY_FIELD_PRINT_DRIVER_ISOLATION_GROUP: DWORD = 0x00; +pub const PRINTER_NOTIFY_CATEGORY_ALL: DWORD = 0x001000; +pub const PRINTER_NOTIFY_CATEGORY_3D: DWORD = 0x002000; +STRUCT!{struct PRINTER_NOTIFY_OPTIONS_TYPE { + Type: WORD, + Reserved0: WORD, + Reserved1: DWORD, + Reserved2: DWORD, + Count: DWORD, + pFields: PWORD, +}} +pub type PPRINTER_NOTIFY_OPTIONS_TYPE = *mut PRINTER_NOTIFY_OPTIONS_TYPE; +pub type LPPRINTER_NOTIFY_OPTIONS_TYPE = *mut PRINTER_NOTIFY_OPTIONS_TYPE; +pub const PRINTER_NOTIFY_OPTIONS_REFRESH: DWORD = 0x01; +STRUCT!{struct PRINTER_NOTIFY_OPTIONS { + Version: DWORD, + Flags: DWORD, + Count: DWORD, + pTypes: PPRINTER_NOTIFY_OPTIONS_TYPE, +}} +pub type PPRINTER_NOTIFY_OPTIONS = *mut PRINTER_NOTIFY_OPTIONS; +pub type LPPRINTER_NOTIFY_OPTIONS = *mut PRINTER_NOTIFY_OPTIONS; +pub const PRINTER_NOTIFY_INFO_DISCARDED: DWORD = 0x01; +STRUCT!{struct PRINTER_NOTIFY_INFO_DATA_NotifyData_Data { + cbBuf: DWORD, + pBuf: LPVOID, +}} +UNION!{union PRINTER_NOTIFY_INFO_DATA_NotifyData { + [usize; 2], + adwData adwData_mut: [DWORD; 2], + Data Data_mut: PRINTER_NOTIFY_INFO_DATA_NotifyData_Data, +}} +STRUCT!{struct PRINTER_NOTIFY_INFO_DATA { + Type: WORD, + Field: WORD, + Reserved: DWORD, + Id: DWORD, + NotifyData: PRINTER_NOTIFY_INFO_DATA_NotifyData, +}} +pub type PPRINTER_NOTIFY_INFO_DATA = *mut PRINTER_NOTIFY_INFO_DATA; +pub type LPPRINTER_NOTIFY_INFO_DATA = *mut PRINTER_NOTIFY_INFO_DATA; +STRUCT!{struct PRINTER_NOTIFY_INFO { + Version: DWORD, + Flags: DWORD, + Count: DWORD, + aData: [PRINTER_NOTIFY_INFO_DATA; 1], +}} +pub type PPRINTER_NOTIFY_INFO = *mut PRINTER_NOTIFY_INFO; +pub type LPPRINTER_NOTIFY_INFO = *mut PRINTER_NOTIFY_INFO; +STRUCT!{struct BINARY_CONTAINER { + cbBuf: DWORD, + pData: LPBYTE, +}} +pub type PBINARY_CONTAINER = *mut BINARY_CONTAINER; +UNION!{union BIDI_DATA_u { + [usize; 2], + bData bData_mut: BOOL, + iData iData_mut: LONG, + sData sData_mut: LPWSTR, + fData fData_mut: FLOAT, + biData biData_mut: BINARY_CONTAINER, +}} +STRUCT!{struct BIDI_DATA { + dwBidiType: DWORD, + u: BIDI_DATA_u, +}} +pub type PBIDI_DATA = *mut BIDI_DATA; +pub type LPBIDI_DATA = *mut BIDI_DATA; +STRUCT!{struct BIDI_REQUEST_DATA { + dwReqNumber: DWORD, + pSchema: LPWSTR, + data: BIDI_DATA, +}} +pub type PBIDI_REQUEST_DATA = *mut BIDI_REQUEST_DATA; +pub type LPBIDI_REQUEST_DATA = *mut BIDI_REQUEST_DATA; +STRUCT!{struct BIDI_REQUEST_CONTAINER { + Version: DWORD, + Flags: DWORD, + Count: DWORD, + aData: [BIDI_REQUEST_DATA; 1], +}} +pub type PBIDI_REQUEST_CONTAINER = *mut BIDI_REQUEST_CONTAINER; +pub type LPBIDI_REQUEST_CONTAINER = *mut BIDI_REQUEST_CONTAINER; +STRUCT!{struct BIDI_RESPONSE_DATA { + dwResult: DWORD, + dwReqNumber: DWORD, + pSchema: LPWSTR, + data: BIDI_DATA, +}} +pub type PBIDI_RESPONSE_DATA = *mut BIDI_RESPONSE_DATA; +pub type LPBIDI_RESPONSE_DATA = *mut BIDI_RESPONSE_DATA; +STRUCT!{struct BIDI_RESPONSE_CONTAINER { + Version: DWORD, + Flags: DWORD, + Count: DWORD, + aData: [BIDI_RESPONSE_DATA; 1], +}} +pub type PBIDI_RESPONSE_CONTAINER = *mut BIDI_RESPONSE_CONTAINER; +pub type LPBIDI_RESPONSE_CONTAINER = *mut BIDI_RESPONSE_CONTAINER; +pub const BIDI_ACTION_ENUM_SCHEMA: &'static str = "EnumSchema"; +pub const BIDI_ACTION_GET: &'static str = "Get"; +pub const BIDI_ACTION_SET: &'static str = "Set"; +pub const BIDI_ACTION_GET_ALL: &'static str = "GetAll"; +pub const BIDI_ACTION_GET_WITH_ARGUMENT: &'static str = "GetWithArgument"; +ENUM!{enum BIDI_TYPE { + BIDI_NULL = 0, + BIDI_INT = 1, + BIDI_FLOAT = 2, + BIDI_BOOL = 3, + BIDI_STRING = 4, + BIDI_TEXT = 5, + BIDI_ENUM = 6, + BIDI_BLOB = 7, +}} +pub const BIDI_ACCESS_ADMINISTRATOR: DWORD = 0x1; +pub const BIDI_ACCESS_USER: DWORD = 0x2; +pub const ERROR_BIDI_STATUS_OK: DWORD = 0; +pub const ERROR_BIDI_NOT_SUPPORTED: DWORD = ERROR_NOT_SUPPORTED; +pub const ERROR_BIDI_ERROR_BASE: DWORD = 13000; +pub const ERROR_BIDI_STATUS_WARNING: DWORD = ERROR_BIDI_ERROR_BASE + 1; +pub const ERROR_BIDI_SCHEMA_READ_ONLY: DWORD = ERROR_BIDI_ERROR_BASE + 2; +pub const ERROR_BIDI_SERVER_OFFLINE: DWORD = ERROR_BIDI_ERROR_BASE + 3; +pub const ERROR_BIDI_DEVICE_OFFLINE: DWORD = ERROR_BIDI_ERROR_BASE + 4; +pub const ERROR_BIDI_SCHEMA_NOT_SUPPORTED: DWORD = ERROR_BIDI_ERROR_BASE + 5; +pub const ERROR_BIDI_SET_DIFFERENT_TYPE: DWORD = ERROR_BIDI_ERROR_BASE + 6; +pub const ERROR_BIDI_SET_MULTIPLE_SCHEMAPATH: DWORD = ERROR_BIDI_ERROR_BASE + 7; +pub const ERROR_BIDI_SET_INVALID_SCHEMAPATH: DWORD = ERROR_BIDI_ERROR_BASE + 8; +pub const ERROR_BIDI_SET_UNKNOWN_FAILURE: DWORD = ERROR_BIDI_ERROR_BASE + 9; +pub const ERROR_BIDI_SCHEMA_WRITE_ONLY: DWORD = ERROR_BIDI_ERROR_BASE + 10; +pub const ERROR_BIDI_GET_REQUIRES_ARGUMENT: DWORD = ERROR_BIDI_ERROR_BASE + 11; +pub const ERROR_BIDI_GET_ARGUMENT_NOT_SUPPORTED: DWORD = ERROR_BIDI_ERROR_BASE + 12; +pub const ERROR_BIDI_GET_MISSING_ARGUMENT: DWORD = ERROR_BIDI_ERROR_BASE + 13; +pub const ERROR_BIDI_DEVICE_CONFIG_UNCHANGED: DWORD = ERROR_BIDI_ERROR_BASE + 14; +pub const ERROR_BIDI_NO_LOCALIZED_RESOURCES: DWORD = ERROR_BIDI_ERROR_BASE + 15; +pub const ERROR_BIDI_NO_BIDI_SCHEMA_EXTENSIONS: DWORD = ERROR_BIDI_ERROR_BASE + 16; +pub const ERROR_BIDI_UNSUPPORTED_CLIENT_LANGUAGE: DWORD = ERROR_BIDI_ERROR_BASE + 17; +pub const ERROR_BIDI_UNSUPPORTED_RESOURCE_FORMAT: DWORD = ERROR_BIDI_ERROR_BASE + 18; +extern "system" { + pub fn WaitForPrinterChange( + hPrinter: HANDLE, + Flags: DWORD, + ) -> DWORD; + pub fn FindFirstPrinterChangeNotification( + hPrinter: HANDLE, + fdwFilter: DWORD, + fdwOptions: DWORD, + pPrinterNotifyOptions: LPVOID, + ) -> HANDLE; + pub fn FindNextPrinterChangeNotification( + hChange: HANDLE, + pdwChange: PDWORD, + pPrinterNotifyOptions: LPVOID, + ppPrinterNotifyInfo: *mut LPVOID, + ) -> BOOL; + pub fn FreePrinterNotifyInfo( + pPrinterNotifyInfo: PPRINTER_NOTIFY_INFO, + ) -> BOOL; + pub fn FindClosePrinterChangeNotification( + hChange: HANDLE, + ) -> BOOL; +} +pub const PRINTER_CHANGE_ADD_PRINTER: DWORD = 0x00000001; +pub const PRINTER_CHANGE_SET_PRINTER: DWORD = 0x00000002; +pub const PRINTER_CHANGE_DELETE_PRINTER: DWORD = 0x00000004; +pub const PRINTER_CHANGE_FAILED_CONNECTION_PRINTER: DWORD = 0x00000008; +pub const PRINTER_CHANGE_PRINTER: DWORD = 0x000000FF; +pub const PRINTER_CHANGE_ADD_JOB: DWORD = 0x00000100; +pub const PRINTER_CHANGE_SET_JOB: DWORD = 0x00000200; +pub const PRINTER_CHANGE_DELETE_JOB: DWORD = 0x00000400; +pub const PRINTER_CHANGE_WRITE_JOB: DWORD = 0x00000800; +pub const PRINTER_CHANGE_JOB: DWORD = 0x0000FF00; +pub const PRINTER_CHANGE_ADD_FORM: DWORD = 0x00010000; +pub const PRINTER_CHANGE_SET_FORM: DWORD = 0x00020000; +pub const PRINTER_CHANGE_DELETE_FORM: DWORD = 0x00040000; +pub const PRINTER_CHANGE_FORM: DWORD = 0x00070000; +pub const PRINTER_CHANGE_ADD_PORT: DWORD = 0x00100000; +pub const PRINTER_CHANGE_CONFIGURE_PORT: DWORD = 0x00200000; +pub const PRINTER_CHANGE_DELETE_PORT: DWORD = 0x00400000; +pub const PRINTER_CHANGE_PORT: DWORD = 0x00700000; +pub const PRINTER_CHANGE_ADD_PRINT_PROCESSOR: DWORD = 0x01000000; +pub const PRINTER_CHANGE_DELETE_PRINT_PROCESSOR: DWORD = 0x04000000; +pub const PRINTER_CHANGE_PRINT_PROCESSOR: DWORD = 0x07000000; +pub const PRINTER_CHANGE_SERVER: DWORD = 0x08000000; +pub const PRINTER_CHANGE_ADD_PRINTER_DRIVER: DWORD = 0x10000000; +pub const PRINTER_CHANGE_SET_PRINTER_DRIVER: DWORD = 0x20000000; +pub const PRINTER_CHANGE_DELETE_PRINTER_DRIVER: DWORD = 0x40000000; +pub const PRINTER_CHANGE_PRINTER_DRIVER: DWORD = 0x70000000; +pub const PRINTER_CHANGE_TIMEOUT: DWORD = 0x80000000; +pub const PRINTER_CHANGE_ALL: DWORD = 0x7F77FFFF; +extern "system" { + pub fn PrinterMessageBoxA( + hPrinter: HANDLE, + Error: DWORD, + hWnd: HWND, + pText: LPSTR, + pCaption: LPSTR, + dwType: DWORD, + ) -> DWORD; + pub fn PrinterMessageBoxW( + hPrinter: HANDLE, + Error: DWORD, + hWnd: HWND, + pText: LPWSTR, + pCaption: LPWSTR, + dwType: DWORD, + ) -> DWORD; +} +pub const PRINTER_ERROR_INFORMATION: DWORD = 0x80000000; +pub const PRINTER_ERROR_WARNING: DWORD = 0x40000000; +pub const PRINTER_ERROR_SEVERE: DWORD = 0x20000000; +pub const PRINTER_ERROR_OUTOFPAPER: DWORD = 0x00000001; +pub const PRINTER_ERROR_JAM: DWORD = 0x00000002; +pub const PRINTER_ERROR_OUTOFTONER: DWORD = 0x00000004; +extern "system" { + pub fn ClosePrinter( + hPrinter: HANDLE, + ) -> BOOL; + pub fn AddFormA( + hPrinter: HANDLE, + Level: DWORD, + pForm: LPBYTE, + ) -> BOOL; + pub fn AddFormW( + hPrinter: HANDLE, + Level: DWORD, + pForm: LPBYTE, + ) -> BOOL; + pub fn DeleteFormA( + hPrinter: HANDLE, + pFormName: LPSTR, + ) -> BOOL; + pub fn DeleteFormW( + hPrinter: HANDLE, + pFormName: LPWSTR, + ) -> BOOL; + pub fn GetFormA( + hPrinter: HANDLE, + pFormName: LPSTR, + Level: DWORD, + pForm: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetFormW( + hPrinter: HANDLE, + pFormName: LPWSTR, + Level: DWORD, + pForm: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn SetFormA( + hPrinter: HANDLE, + pFormName: LPSTR, + Level: DWORD, + pForm: LPBYTE, + ) -> BOOL; + pub fn SetFormW( + hPrinter: HANDLE, + pFormName: LPWSTR, + Level: DWORD, + pForm: LPBYTE, + ) -> BOOL; + pub fn EnumFormsA( + hPrinter: HANDLE, + Level: DWORD, + pForm: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumFormsW( + hPrinter: HANDLE, + Level: DWORD, + pForm: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumMonitorsA( + pName: LPSTR, + Level: DWORD, + pMonitor: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumMonitorsW( + pName: LPWSTR, + Level: DWORD, + pMonitor: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn AddMonitorA( + pName: LPSTR, + Level: DWORD, + pMonitors: LPBYTE, + ) -> BOOL; + pub fn AddMonitorW( + pName: LPWSTR, + Level: DWORD, + pMonitors: LPBYTE, + ) -> BOOL; + pub fn DeleteMonitorA( + pName: LPSTR, + pEnvironment: LPSTR, + pMonitorName: LPSTR, + ) -> BOOL; + pub fn DeleteMonitorW( + pName: LPWSTR, + pEnvironment: LPWSTR, + pMonitorName: LPWSTR, + ) -> BOOL; + pub fn EnumPortsA( + pName: LPSTR, + Level: DWORD, + pPort: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn EnumPortsW( + pName: LPWSTR, + Level: DWORD, + pPort: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + pcReturned: LPDWORD, + ) -> BOOL; + pub fn AddPortA( + pName: LPSTR, + hWnd: HWND, + pMonitorName: LPSTR, + ) -> BOOL; + pub fn AddPortW( + pName: LPWSTR, + hWnd: HWND, + pMonitorName: LPWSTR, + ) -> BOOL; + pub fn ConfigurePortA( + pName: LPSTR, + hWnd: HWND, + pPortName: LPSTR, + ) -> BOOL; + pub fn ConfigurePortW( + pName: LPWSTR, + hWnd: HWND, + pPortName: LPWSTR, + ) -> BOOL; + pub fn DeletePortA( + pName: LPSTR, + hWnd: HWND, + pPortName: LPSTR, + ) -> BOOL; + pub fn DeletePortW( + pName: LPWSTR, + hWnd: HWND, + pPortName: LPWSTR, + ) -> BOOL; + pub fn XcvDataW( + hXcv: HANDLE, + pszDataName: PCWSTR, + pInputData: PBYTE, + cbInputData: DWORD, + pOutputData: PBYTE, + cbOutputData: DWORD, + pcbOutputNeeded: PDWORD, + pdwStatus: PDWORD, + ) -> BOOL; + pub fn GetDefaultPrinterA( + pszBuffer: LPSTR, + pcchBuffer: LPDWORD, + ) -> BOOL; + pub fn GetDefaultPrinterW( + pszBuffer: LPWSTR, + pcchBuffer: LPDWORD, + ) -> BOOL; + pub fn SetDefaultPrinterA( + pszPrinter: LPCSTR, + ) -> BOOL; + pub fn SetDefaultPrinterW( + pszPrinter: LPCWSTR, + ) -> BOOL; + pub fn SetPortA( + pName: LPSTR, + pPortName: LPSTR, + dwLevel: DWORD, + pPortInfo: LPBYTE, + ) -> BOOL; + pub fn SetPortW(pName: LPWSTR, + pPortName: LPWSTR, + dwLevel: DWORD, + pPortInfo: LPBYTE, + ) -> BOOL; + pub fn AddPrinterConnectionA( + pName: LPSTR, + ) -> BOOL; + pub fn AddPrinterConnectionW( + pName: LPWSTR, + ) -> BOOL; + pub fn DeletePrinterConnectionA( + pName: LPSTR, + ) -> BOOL; + pub fn DeletePrinterConnectionW( + pName: LPWSTR, + ) -> BOOL; + pub fn ConnectToPrinterDlg( + hwnd: HWND, + Flags: DWORD, + ) -> HANDLE; +} +STRUCT!{struct PROVIDOR_INFO_1A { + pName: LPSTR, + pEnvironment: LPSTR, + pDLLName: LPSTR, +}} +pub type PPROVIDOR_INFO_1A = *mut PROVIDOR_INFO_1A; +pub type LPPROVIDOR_INFO_1A = *mut PROVIDOR_INFO_1A; +STRUCT!{struct PROVIDOR_INFO_1W { + pName: LPWSTR, + pEnvironment: LPWSTR, + pDLLName: LPWSTR, +}} +pub type PPROVIDOR_INFO_1W = *mut PROVIDOR_INFO_1W; +pub type LPPROVIDOR_INFO_1W = *mut PROVIDOR_INFO_1W; +STRUCT!{struct PROVIDOR_INFO_2A { + pOrder: LPSTR, +}} +pub type PPROVIDOR_INFO_2A = *mut PROVIDOR_INFO_2A; +pub type LPPROVIDOR_INFO_2A = *mut PROVIDOR_INFO_2A; +STRUCT!{struct PROVIDOR_INFO_2W { + pOrder: LPWSTR, +}} +pub type PPROVIDOR_INFO_2W = *mut PROVIDOR_INFO_2W; +pub type LPPROVIDOR_INFO_2W = *mut PROVIDOR_INFO_2W; +extern "system" { + pub fn AddPrintProvidorA( + pName: LPSTR, + Level: DWORD, + pProvidorInfo: LPBYTE, + ) -> BOOL; + pub fn AddPrintProvidorW( + pName: LPWSTR, + Level: DWORD, + pProvidorInfo: LPBYTE, + ) -> BOOL; + pub fn DeletePrintProvidorA( + pName: LPSTR, + pEnvironment: LPSTR, + pPrintProvidorName: LPSTR, + ) -> BOOL; + pub fn DeletePrintProvidorW( + pName: LPWSTR, + pEnvironment: LPWSTR, + pPrintProvidorName: LPWSTR, + ) -> BOOL; + pub fn IsValidDevmodeA( + pDevmode: PDEVMODEA, + DevmodeSize: size_t, + ) -> BOOL; + pub fn IsValidDevmodeW( + pDevmode: PDEVMODEW, + DevmodeSize: size_t, + ) -> BOOL; +} +pub const SPLREG_DEFAULT_SPOOL_DIRECTORY: &'static str = "DefaultSpoolDirectory"; +pub const SPLREG_PORT_THREAD_PRIORITY_DEFAULT: &'static str = "PortThreadPriorityDefault"; +pub const SPLREG_PORT_THREAD_PRIORITY: &'static str = "PortThreadPriority"; +pub const SPLREG_SCHEDULER_THREAD_PRIORITY_DEFAULT: &'static str + = "SchedulerThreadPriorityDefault"; +pub const SPLREG_SCHEDULER_THREAD_PRIORITY: &'static str = "SchedulerThreadPriority"; +pub const SPLREG_BEEP_ENABLED: &'static str = "BeepEnabled"; +pub const SPLREG_NET_POPUP: &'static str = "NetPopup"; +pub const SPLREG_RETRY_POPUP: &'static str = "RetryPopup"; +pub const SPLREG_NET_POPUP_TO_COMPUTER: &'static str = "NetPopupToComputer"; +pub const SPLREG_EVENT_LOG: &'static str = "EventLog"; +pub const SPLREG_MAJOR_VERSION: &'static str = "MajorVersion"; +pub const SPLREG_MINOR_VERSION: &'static str = "MinorVersion"; +pub const SPLREG_ARCHITECTURE: &'static str = "Architecture"; +pub const SPLREG_OS_VERSION: &'static str = "OSVersion"; +pub const SPLREG_OS_VERSIONEX: &'static str = "OSVersionEx"; +pub const SPLREG_DS_PRESENT: &'static str = "DsPresent"; +pub const SPLREG_DS_PRESENT_FOR_USER: &'static str = "DsPresentForUser"; +pub const SPLREG_REMOTE_FAX: &'static str = "RemoteFax"; +pub const SPLREG_RESTART_JOB_ON_POOL_ERROR: &'static str = "RestartJobOnPoolError"; +pub const SPLREG_RESTART_JOB_ON_POOL_ENABLED: &'static str = "RestartJobOnPoolEnabled"; +pub const SPLREG_DNS_MACHINE_NAME: &'static str = "DNSMachineName"; +pub const SPLREG_ALLOW_USER_MANAGEFORMS: &'static str = "AllowUserManageForms"; +pub const SPLREG_WEBSHAREMGMT: &'static str = "WebShareMgmt"; +pub const SPLREG_PRINT_DRIVER_ISOLATION_GROUPS_SEPARATOR: &'static str = "\\"; +pub const SPLREG_PRINT_DRIVER_ISOLATION_GROUPS: &'static str = "PrintDriverIsolationGroups"; +pub const SPLREG_PRINT_DRIVER_ISOLATION_TIME_BEFORE_RECYCLE: &'static str + = "PrintDriverIsolationTimeBeforeRecycle"; +pub const SPLREG_PRINT_DRIVER_ISOLATION_MAX_OBJECTS_BEFORE_RECYCLE: &'static str + = "PrintDriverIsolationMaxobjsBeforeRecycle"; +pub const SPLREG_PRINT_DRIVER_ISOLATION_IDLE_TIMEOUT: &'static str + = "PrintDriverIsolationIdleTimeout"; +pub const SPLREG_PRINT_DRIVER_ISOLATION_EXECUTION_POLICY: &'static str + = "PrintDriverIsolationExecutionPolicy"; +pub const SPLREG_PRINT_DRIVER_ISOLATION_OVERRIDE_POLICY: &'static str + = "PrintDriverIsolationOverrideCompat"; +pub const SPLREG_PRINT_QUEUE_V4_DRIVER_DIRECTORY: &'static str = "PrintQueueV4DriverDirectory"; +pub const SERVER_ACCESS_ADMINISTER: DWORD = 0x00000001; +pub const SERVER_ACCESS_ENUMERATE: DWORD = 0x00000002; +pub const PRINTER_ACCESS_ADMINISTER: DWORD = 0x00000004; +pub const PRINTER_ACCESS_USE: DWORD = 0x00000008; +pub const JOB_ACCESS_ADMINISTER: DWORD = 0x00000010; +pub const JOB_ACCESS_READ: DWORD = 0x00000020; +pub const PRINTER_ACCESS_MANAGE_LIMITED: DWORD = 0x00000040; +pub const SERVER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SERVER_ACCESS_ADMINISTER + | SERVER_ACCESS_ENUMERATE; +pub const SERVER_READ: DWORD = STANDARD_RIGHTS_READ | SERVER_ACCESS_ENUMERATE; +pub const SERVER_WRITE: DWORD = STANDARD_RIGHTS_WRITE | SERVER_ACCESS_ADMINISTER + | SERVER_ACCESS_ENUMERATE; +pub const SERVER_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | SERVER_ACCESS_ENUMERATE; +pub const PRINTER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | PRINTER_ACCESS_ADMINISTER + | PRINTER_ACCESS_USE; +pub const PRINTER_READ: DWORD = STANDARD_RIGHTS_READ | PRINTER_ACCESS_USE; +pub const PRINTER_WRITE: DWORD = STANDARD_RIGHTS_WRITE | PRINTER_ACCESS_USE; +pub const PRINTER_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | PRINTER_ACCESS_USE; +pub const JOB_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | JOB_ACCESS_ADMINISTER + | JOB_ACCESS_READ; +pub const JOB_READ: DWORD = STANDARD_RIGHTS_READ | JOB_ACCESS_READ; +pub const JOB_WRITE: DWORD = STANDARD_RIGHTS_WRITE | JOB_ACCESS_ADMINISTER; +pub const JOB_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | JOB_ACCESS_ADMINISTER; +pub const SPLDS_SPOOLER_KEY: &'static str = "DsSpooler"; +pub const SPLDS_DRIVER_KEY: &'static str = "DsDriver"; +pub const SPLDS_USER_KEY: &'static str = "DsUser"; +pub const SPLDS_ASSET_NUMBER: &'static str = "assetNumber"; +pub const SPLDS_BYTES_PER_MINUTE: &'static str = "bytesPerMinute"; +pub const SPLDS_DESCRIPTION: &'static str = "description"; +pub const SPLDS_DRIVER_NAME: &'static str = "driverName"; +pub const SPLDS_DRIVER_VERSION: &'static str = "driverVersion"; +pub const SPLDS_LOCATION: &'static str = "location"; +pub const SPLDS_PORT_NAME: &'static str = "portName"; +pub const SPLDS_PRINT_ATTRIBUTES: &'static str = "printAttributes"; +pub const SPLDS_PRINT_BIN_NAMES: &'static str = "printBinNames"; +pub const SPLDS_PRINT_COLLATE: &'static str = "printCollate"; +pub const SPLDS_PRINT_COLOR: &'static str = "printColor"; +pub const SPLDS_PRINT_DUPLEX_SUPPORTED: &'static str = "printDuplexSupported"; +pub const SPLDS_PRINT_END_TIME: &'static str = "printEndTime"; +pub const SPLDS_PRINTER_CLASS: &'static str = "printQueue"; +pub const SPLDS_PRINTER_NAME: &'static str = "printerName"; +pub const SPLDS_PRINT_KEEP_PRINTED_JOBS: &'static str = "printKeepPrintedJobs"; +pub const SPLDS_PRINT_LANGUAGE: &'static str = "printLanguage"; +pub const SPLDS_PRINT_MAC_ADDRESS: &'static str = "printMACAddress"; +pub const SPLDS_PRINT_MAX_X_EXTENT: &'static str = "printMaxXExtent"; +pub const SPLDS_PRINT_MAX_Y_EXTENT: &'static str = "printMaxYExtent"; +pub const SPLDS_PRINT_MAX_RESOLUTION_SUPPORTED: &'static str = "printMaxResolutionSupported"; +pub const SPLDS_PRINT_MEDIA_READY: &'static str = "printMediaReady"; +pub const SPLDS_PRINT_MEDIA_SUPPORTED: &'static str = "printMediaSupported"; +pub const SPLDS_PRINT_MEMORY: &'static str = "printMemory"; +pub const SPLDS_PRINT_MIN_X_EXTENT: &'static str = "printMinXExtent"; +pub const SPLDS_PRINT_MIN_Y_EXTENT: &'static str = "printMinYExtent"; +pub const SPLDS_PRINT_NETWORK_ADDRESS: &'static str = "printNetworkAddress"; +pub const SPLDS_PRINT_NOTIFY: &'static str = "printNotify"; +pub const SPLDS_PRINT_NUMBER_UP: &'static str = "printNumberUp"; +pub const SPLDS_PRINT_ORIENTATIONS_SUPPORTED: &'static str = "printOrientationsSupported"; +pub const SPLDS_PRINT_OWNER: &'static str = "printOwner"; +pub const SPLDS_PRINT_PAGES_PER_MINUTE: &'static str = "printPagesPerMinute"; +pub const SPLDS_PRINT_RATE: &'static str = "printRate"; +pub const SPLDS_PRINT_RATE_UNIT: &'static str = "printRateUnit"; +pub const SPLDS_PRINT_SEPARATOR_FILE: &'static str = "printSeparatorFile"; +pub const SPLDS_PRINT_SHARE_NAME: &'static str = "printShareName"; +pub const SPLDS_PRINT_SPOOLING: &'static str = "printSpooling"; +pub const SPLDS_PRINT_STAPLING_SUPPORTED: &'static str = "printStaplingSupported"; +pub const SPLDS_PRINT_START_TIME: &'static str = "printStartTime"; +pub const SPLDS_PRINT_STATUS: &'static str = "printStatus"; +pub const SPLDS_PRIORITY: &'static str = "priority"; +pub const SPLDS_SERVER_NAME: &'static str = "serverName"; +pub const SPLDS_SHORT_SERVER_NAME: &'static str = "shortServerName"; +pub const SPLDS_UNC_NAME: &'static str = "uNCName"; +pub const SPLDS_URL: &'static str = "url"; +pub const SPLDS_FLAGS: &'static str = "flags"; +pub const SPLDS_VERSION_NUMBER: &'static str = "versionNumber"; +pub const SPLDS_PRINTER_NAME_ALIASES: &'static str = "printerNameAliases"; +pub const SPLDS_PRINTER_LOCATIONS: &'static str = "printerLocations"; +pub const SPLDS_PRINTER_MODEL: &'static str = "printerModel"; +ENUM!{enum PRINTER_OPTION_FLAGS { + PRINTER_OPTION_NO_CACHE = 1 << 0, + PRINTER_OPTION_CACHE = 1 << 1, + PRINTER_OPTION_CLIENT_CHANGE = 1 << 2, + PRINTER_OPTION_NO_CLIENT_DATA = 1 << 3, +}} +STRUCT!{struct PRINTER_OPTIONSA { + cbSize: UINT, + dwFlags: DWORD, +}} +pub type PPRINTER_OPTIONSA = *mut PRINTER_OPTIONSA; +pub type LPPRINTER_OPTIONSA = *mut PRINTER_OPTIONSA; +STRUCT!{struct PRINTER_OPTIONSW { + cbSize: UINT, + dwFlags: DWORD, +}} +pub type PPRINTER_OPTIONSW = *mut PRINTER_OPTIONSW; +pub type LPPRINTER_OPTIONSW = *mut PRINTER_OPTIONSW; +extern "system" { + pub fn OpenPrinter2A( + pPrinterName: LPCSTR, + phPrinter: LPHANDLE, + pDefault: PPRINTER_DEFAULTSA, + pOptions: PPRINTER_OPTIONSA, + ) -> BOOL; + pub fn OpenPrinter2W( + pPrinterName: LPCWSTR, + phPrinter: LPHANDLE, + pDefault: PPRINTER_DEFAULTSW, + pOptions: PPRINTER_OPTIONSW, + ) -> BOOL; +} +pub const PRINTER_CONNECTION_MISMATCH: DWORD = 0x00000020; +pub const PRINTER_CONNECTION_NO_UI: DWORD = 0x00000040; +STRUCT!{struct PRINTER_CONNECTION_INFO_1A { + dwFlags: DWORD, + pszDriverName: LPSTR, +}} +pub type PPRINTER_CONNECTION_INFO_1A = *mut PRINTER_CONNECTION_INFO_1A; +pub type LPPRINTER_CONNECTION_INFO_1A = *mut PRINTER_CONNECTION_INFO_1A; +STRUCT!{struct PRINTER_CONNECTION_INFO_1W { + dwFlags: DWORD, + pszDriverName: LPWSTR, +}} +pub type PPRINTER_CONNECTION_INFO_1W = *mut PRINTER_CONNECTION_INFO_1W; +pub type LPPRINTER_CONNECTION_INFO_1W = *mut PRINTER_CONNECTION_INFO_1W; +extern "system" { + pub fn AddPrinterConnection2A( + hWnd: HWND, + pszName: LPCSTR, + dwLevel: DWORD, + pConnectionInfo: PVOID, + ) -> BOOL; + pub fn AddPrinterConnection2W( + hWnd: HWND, + pszName: LPCWSTR, + dwLevel: DWORD, + pConnectionInfo: PVOID, + ) -> BOOL; +} +pub const IPDFP_COPY_ALL_FILES: DWORD = 0x00000001; +extern "system" { + pub fn InstallPrinterDriverFromPackageA( + pszServer: LPCSTR, + pszInfPath: LPCSTR, + pszDriverName: LPCSTR, + pszEnvironment: LPCSTR, + dwFlags: DWORD, + ) -> HRESULT; + pub fn InstallPrinterDriverFromPackageW( + pszServer: LPCWSTR, + pszInfPath: LPCWSTR, + pszDriverName: LPCWSTR, + pszEnvironment: LPCWSTR, + dwFlags: DWORD, + ) -> HRESULT; +} +pub const UPDP_SILENT_UPLOAD: DWORD = 0x00000001; +pub const UPDP_UPLOAD_ALWAYS: DWORD = 0x00000002; +pub const UPDP_CHECK_DRIVERSTORE: DWORD = 0x00000004; +extern "system" { + pub fn UploadPrinterDriverPackageA( + pszServer: LPCSTR, + pszInfPath: LPCSTR, + pszEnvironment: LPCSTR, + dwFlags: DWORD, + hwnd: HWND, + pszDestInfPath: LPSTR, + pcchDestInfPath: PULONG, + ) -> HRESULT; + pub fn UploadPrinterDriverPackageW( + pszServer: LPCWSTR, + pszInfPath: LPCWSTR, + pszEnvironment: LPCWSTR, + dwFlags: DWORD, + hwnd: HWND, + pszDestInfPath: LPWSTR, + pcchDestInfPath: PULONG, + ) -> HRESULT; +} +STRUCT!{struct CORE_PRINTER_DRIVERA { + CoreDriverGUID: GUID, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + szPackageID: [CHAR; MAX_PATH], +}} +pub type PCORE_PRINTER_DRIVERA = *mut CORE_PRINTER_DRIVERA; +STRUCT!{struct CORE_PRINTER_DRIVERW { + CoreDriverGUID: GUID, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + szPackageID: [WCHAR; MAX_PATH], +}} +pub type PCORE_PRINTER_DRIVERW = *mut CORE_PRINTER_DRIVERW; +extern "system" { + pub fn GetCorePrinterDriversA( + pszServer: LPCSTR, + pszEnvironment: LPCSTR, + pszzCoreDriverDependencies: LPCSTR, + cCorePrinterDrivers: DWORD, + pCorePrinterDrivers: PCORE_PRINTER_DRIVERA, + ) -> HRESULT; + pub fn GetCorePrinterDriversW( + pszServer: LPCWSTR, + pszEnvironment: LPCWSTR, + pszzCoreDriverDependencies: LPCWSTR, + cCorePrinterDrivers: DWORD, + pCorePrinterDrivers: PCORE_PRINTER_DRIVERW, + ) -> HRESULT; + pub fn CorePrinterDriverInstalledA( + pszServer: LPCSTR, + pszEnvironment: LPCSTR, + CoreDriverGUID: GUID, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + pbDriverInstalled: *mut BOOL, + ) -> HRESULT; + pub fn CorePrinterDriverInstalledW( + pszServer: LPCWSTR, + pszEnvironment: LPCWSTR, + CoreDriverGUID: GUID, + ftDriverDate: FILETIME, + dwlDriverVersion: DWORDLONG, + pbDriverInstalled: *mut BOOL, + ) -> HRESULT; + pub fn GetPrinterDriverPackagePathA( + pszServer: LPCSTR, + pszEnvironment: LPCSTR, + pszLanguage: LPCSTR, + pszPackageID: LPCSTR, + pszDriverPackageCab: LPSTR, + cchDriverPackageCab: DWORD, + pcchRequiredSize: LPDWORD, + ) -> HRESULT; + pub fn GetPrinterDriverPackagePathW( + pszServer: LPCWSTR, + pszEnvironment: LPCWSTR, + pszLanguage: LPCWSTR, + pszPackageID: LPCWSTR, + pszDriverPackageCab: LPWSTR, + cchDriverPackageCab: DWORD, + pcchRequiredSize: LPDWORD, + ) -> HRESULT; + pub fn DeletePrinterDriverPackageA( + pszServer: LPCSTR, + pszInfPath: LPCSTR, + pszEnvironment: LPCSTR, + ) -> HRESULT; + pub fn DeletePrinterDriverPackageW( + pszServer: LPCWSTR, + pszInfPath: LPCWSTR, + pszEnvironment: LPCWSTR, + ) -> HRESULT; +} +ENUM!{enum EPrintPropertyType { + kPropertyTypeString = 1, + kPropertyTypeInt32, + kPropertyTypeInt64, + kPropertyTypeByte, + kPropertyTypeTime, + kPropertyTypeDevMode, + kPropertyTypeSD, + kPropertyTypeNotificationReply, + kPropertyTypeNotificationOptions, + kPropertyTypeBuffer, +}} +ENUM!{enum EPrintXPSJobProgress { + kAddingDocumentSequence = 0, + kDocumentSequenceAdded = 1, + kAddingFixedDocument = 2, + kFixedDocumentAdded = 3, + kAddingFixedPage = 4, + kFixedPageAdded = 5, + kResourceAdded = 6, + kFontAdded = 7, + kImageAdded = 8, + kXpsDocumentCommitted = 9, +}} +ENUM!{enum EPrintXPSJobOperation { + kJobProduction = 1, + kJobConsumption, +}} +STRUCT!{struct PrintPropertyValue_value_propertyBlob { + cbBuf: DWORD, + pBuf: LPVOID, +}} +UNION!{union PrintPropertyValue_value { + [u64; 1] [u64; 2], + propertyByte propertyByte_mut: BYTE, + propertyString propertyString_mut: PWSTR, + propertyInt32 propertyInt32_mut: LONG, + propertyInt64 propertyInt64_mut: LONGLONG, + propertyBlob propertyBlob_mut: PrintPropertyValue_value_propertyBlob, +}} +STRUCT!{struct PrintPropertyValue { + ePropertyType: EPrintPropertyType, + value: PrintPropertyValue_value, +}} +STRUCT!{struct PrintNamedProperty { + propertyName: *mut WCHAR, + propertyValue: PrintPropertyValue, +}} +STRUCT!{struct PrintPropertiesCollection { + numberOfProperties: ULONG, + propertiesCollection: *mut PrintNamedProperty, +}} +extern "system" { + pub fn ReportJobProcessingProgress( + printerHandle: HANDLE, + jobId: ULONG, + jobOperation: EPrintXPSJobOperation, + jobProgress: EPrintXPSJobProgress, + ) -> HRESULT; + pub fn GetPrinterDriver2A( + hWnd: HWND, + hPrinter: HANDLE, + pEnvironment: LPSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; + pub fn GetPrinterDriver2W( + hWnd: HWND, + hPrinter: HANDLE, + pEnvironment: LPWSTR, + Level: DWORD, + pDriverInfo: LPBYTE, + cbBuf: DWORD, + pcbNeeded: LPDWORD, + ) -> BOOL; +} +ENUM!{enum PRINT_EXECUTION_CONTEXT { + PRINT_EXECUTION_CONTEXT_APPLICATION = 0, + PRINT_EXECUTION_CONTEXT_SPOOLER_SERVICE = 1, + PRINT_EXECUTION_CONTEXT_SPOOLER_ISOLATION_HOST = 2, + PRINT_EXECUTION_CONTEXT_FILTER_PIPELINE = 3, + PRINT_EXECUTION_CONTEXT_WOW64 = 4, +}} +STRUCT!{struct PRINT_EXECUTION_DATA { + context: PRINT_EXECUTION_CONTEXT, + clientAppPID: DWORD, +}} +extern "system" { + pub fn GetPrintExecutionData( + pData: *mut PRINT_EXECUTION_DATA, + ) -> BOOL; + pub fn GetJobNamedPropertyValue( + hPrinter: HANDLE, + JobId: DWORD, + pszName: PCWSTR, + pValue: *mut PrintPropertyValue, + ) -> DWORD; + pub fn FreePrintPropertyValue( + pValue: *mut PrintPropertyValue, + ); + pub fn FreePrintNamedPropertyArray( + cProperties: DWORD, + ppProperties: *mut *mut PrintNamedProperty, + ); + pub fn SetJobNamedProperty( + hPrinter: HANDLE, + JobId: DWORD, + pProperty: *const PrintNamedProperty, + ) -> DWORD; + pub fn DeleteJobNamedProperty( + hPrinter: HANDLE, + JobId: DWORD, + pszName: PCWSTR, + ) -> DWORD; + pub fn EnumJobNamedProperties( + hPrinter: HANDLE, + JobId: DWORD, + pcProperties: *mut DWORD, + ppProperties: *mut *mut PrintNamedProperty, + ) -> DWORD; + pub fn GetPrintOutputInfo( + hWnd: HWND, + pszPrinter: PCWSTR, + phFile: *mut HANDLE, + ppszOutputFile: *mut PWSTR, + ) -> HRESULT; +} +pub const MS_PRINT_JOB_OUTPUT_FILE: &'static str = "MsPrintJobOutputFile"; diff --git a/src/vendor/winapi/src/um/winsvc.rs b/src/vendor/winapi/src/um/winsvc.rs new file mode 100644 index 0000000000..056edb68c1 --- /dev/null +++ b/src/vendor/winapi/src/um/winsvc.rs @@ -0,0 +1,367 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Header file for the Service Control Manager + +use shared::minwindef::{BOOL, DWORD, LPBYTE, LPDWORD, LPVOID}; +use um::winnt::{LPCSTR, LPCWSTR, LPSTR, LPWSTR, STANDARD_RIGHTS_REQUIRED}; + +pub const SERVICE_NO_CHANGE: DWORD = 0xffffffff; +pub const SERVICE_ACTIVE: DWORD = 0x00000001; +pub const SERVICE_INACTIVE: DWORD = 0x00000002; +pub const SERVICE_STATE_ALL: DWORD = SERVICE_ACTIVE | SERVICE_INACTIVE; +pub const SERVICE_CONTROL_STOP: DWORD = 0x00000001; +pub const SERVICE_CONTROL_PAUSE: DWORD = 0x00000002; +pub const SERVICE_CONTROL_CONTINUE: DWORD = 0x00000003; +pub const SERVICE_CONTROL_INTERROGATE: DWORD = 0x00000004; +pub const SERVICE_CONTROL_SHUTDOWN: DWORD = 0x00000005; +pub const SERVICE_CONTROL_PARAMCHANGE: DWORD = 0x00000006; +pub const SERVICE_CONTROL_NETBINDADD: DWORD = 0x00000007; +pub const SERVICE_CONTROL_NETBINDREMOVE: DWORD = 0x00000008; +pub const SERVICE_CONTROL_NETBINDENABLE: DWORD = 0x00000009; +pub const SERVICE_CONTROL_NETBINDDISABLE: DWORD = 0x0000000A; +pub const SERVICE_CONTROL_DEVICEEVENT: DWORD = 0x0000000B; +pub const SERVICE_CONTROL_HARDWAREPROFILECHANGE: DWORD = 0x0000000C; +pub const SERVICE_CONTROL_POWEREVENT: DWORD = 0x0000000D; +pub const SERVICE_CONTROL_SESSIONCHANGE: DWORD = 0x0000000E; +pub const SERVICE_CONTROL_PRESHUTDOWN: DWORD = 0x0000000F; +pub const SERVICE_CONTROL_TIMECHANGE: DWORD = 0x00000010; +pub const SERVICE_CONTROL_TRIGGEREVENT: DWORD = 0x00000020; +pub const SERVICE_STOPPED: DWORD = 0x00000001; +pub const SERVICE_START_PENDING: DWORD = 0x00000002; +pub const SERVICE_STOP_PENDING: DWORD = 0x00000003; +pub const SERVICE_RUNNING: DWORD = 0x00000004; +pub const SERVICE_CONTINUE_PENDING: DWORD = 0x00000005; +pub const SERVICE_PAUSE_PENDING: DWORD = 0x00000006; +pub const SERVICE_PAUSED: DWORD = 0x00000007; +pub const SERVICE_ACCEPT_STOP: DWORD = 0x00000001; +pub const SERVICE_ACCEPT_PAUSE_CONTINUE: DWORD = 0x00000002; +pub const SERVICE_ACCEPT_SHUTDOWN: DWORD = 0x00000004; +pub const SERVICE_ACCEPT_PARAMCHANGE: DWORD = 0x00000008; +pub const SERVICE_ACCEPT_NETBINDCHANGE: DWORD = 0x00000010; +pub const SERVICE_ACCEPT_HARDWAREPROFILECHANGE: DWORD = 0x00000020; +pub const SERVICE_ACCEPT_POWEREVENT: DWORD = 0x00000040; +pub const SERVICE_ACCEPT_SESSIONCHANGE: DWORD = 0x00000080; +pub const SERVICE_ACCEPT_PRESHUTDOWN: DWORD = 0x00000100; +pub const SERVICE_ACCEPT_TIMECHANGE: DWORD = 0x00000200; +pub const SERVICE_ACCEPT_TRIGGEREVENT: DWORD = 0x00000400; +// SERVICE_ACCEPT_USER_LOGOFF +pub const SC_MANAGER_CONNECT: DWORD = 0x0001; +pub const SC_MANAGER_CREATE_SERVICE: DWORD = 0x0002; +pub const SC_MANAGER_ENUMERATE_SERVICE: DWORD = 0x0004; +pub const SC_MANAGER_LOCK: DWORD = 0x0008; +pub const SC_MANAGER_QUERY_LOCK_STATUS: DWORD = 0x0010; +pub const SC_MANAGER_MODIFY_BOOT_CONFIG: DWORD = 0x0020; +pub const SC_MANAGER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT + | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK + | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG; +pub const SERVICE_QUERY_CONFIG: DWORD = 0x0001; +pub const SERVICE_CHANGE_CONFIG: DWORD = 0x0002; +pub const SERVICE_QUERY_STATUS: DWORD = 0x0004; +pub const SERVICE_ENUMERATE_DEPENDENTS: DWORD = 0x0008; +pub const SERVICE_START: DWORD = 0x0010; +pub const SERVICE_STOP: DWORD = 0x0020; +pub const SERVICE_PAUSE_CONTINUE: DWORD = 0x0040; +pub const SERVICE_INTERROGATE: DWORD = 0x0080; +pub const SERVICE_USER_DEFINED_CONTROL: DWORD = 0x0100; +pub const SERVICE_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG + | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START + | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL; +pub const SERVICE_RUNS_IN_SYSTEM_PROCESS: DWORD = 0x00000001; +pub const SERVICE_CONFIG_DESCRIPTION: DWORD = 1; +pub const SERVICE_CONFIG_FAILURE_ACTIONS: DWORD = 2; +pub const SERVICE_CONFIG_DELAYED_AUTO_START_INFO: DWORD = 3; +pub const SERVICE_CONFIG_FAILURE_ACTIONS_FLAG: DWORD = 4; +pub const SERVICE_CONFIG_SERVICE_SID_INFO: DWORD = 5; +pub const SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO: DWORD = 6; +pub const SERVICE_CONFIG_PRESHUTDOWN_INFO: DWORD = 7; +pub const SERVICE_CONFIG_TRIGGER_INFO: DWORD = 8; +pub const SERVICE_CONFIG_PREFERRED_NODE: DWORD = 9; +pub const SERVICE_CONFIG_LAUNCH_PROTECTED: DWORD = 12; +pub const SERVICE_NOTIFY_STATUS_CHANGE_1: DWORD = 1; +pub const SERVICE_NOTIFY_STATUS_CHANGE_2: DWORD = 2; +pub const SERVICE_NOTIFY_STATUS_CHANGE: DWORD = SERVICE_NOTIFY_STATUS_CHANGE_2; +pub const SERVICE_NOTIFY_STOPPED: DWORD = 0x00000001; +pub const SERVICE_NOTIFY_START_PENDING: DWORD = 0x00000002; +pub const SERVICE_NOTIFY_STOP_PENDING: DWORD = 0x00000004; +pub const SERVICE_NOTIFY_RUNNING: DWORD = 0x00000008; +pub const SERVICE_NOTIFY_CONTINUE_PENDING: DWORD = 0x00000010; +pub const SERVICE_NOTIFY_PAUSE_PENDING: DWORD = 0x00000020; +pub const SERVICE_NOTIFY_PAUSED: DWORD = 0x00000040; +pub const SERVICE_NOTIFY_CREATED: DWORD = 0x00000080; +pub const SERVICE_NOTIFY_DELETED: DWORD = 0x00000100; +pub const SERVICE_NOTIFY_DELETE_PENDING: DWORD = 0x00000200; +pub const SERVICE_STOP_REASON_FLAG_MIN: DWORD = 0x00000000; +pub const SERVICE_STOP_REASON_FLAG_UNPLANNED: DWORD = 0x10000000; +pub const SERVICE_STOP_REASON_FLAG_CUSTOM: DWORD = 0x20000000; +pub const SERVICE_STOP_REASON_FLAG_PLANNED: DWORD = 0x40000000; +pub const SERVICE_STOP_REASON_FLAG_MAX: DWORD = 0x80000000; +pub const SERVICE_STOP_REASON_MAJOR_MIN: DWORD = 0x00000000; +pub const SERVICE_STOP_REASON_MAJOR_OTHER: DWORD = 0x00010000; +pub const SERVICE_STOP_REASON_MAJOR_HARDWARE: DWORD = 0x00020000; +pub const SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM: DWORD = 0x00030000; +pub const SERVICE_STOP_REASON_MAJOR_SOFTWARE: DWORD = 0x00040000; +pub const SERVICE_STOP_REASON_MAJOR_APPLICATION: DWORD = 0x00050000; +pub const SERVICE_STOP_REASON_MAJOR_NONE: DWORD = 0x00060000; +pub const SERVICE_STOP_REASON_MAJOR_MAX: DWORD = 0x00070000; +pub const SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM: DWORD = 0x00400000; +pub const SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM: DWORD = 0x00ff0000; +pub const SERVICE_STOP_REASON_MINOR_MIN: DWORD = 0x00000000; +pub const SERVICE_STOP_REASON_MINOR_OTHER: DWORD = 0x00000001; +pub const SERVICE_STOP_REASON_MINOR_MAINTENANCE: DWORD = 0x00000002; +pub const SERVICE_STOP_REASON_MINOR_INSTALLATION: DWORD = 0x00000003; +pub const SERVICE_STOP_REASON_MINOR_UPGRADE: DWORD = 0x00000004; +pub const SERVICE_STOP_REASON_MINOR_RECONFIG: DWORD = 0x00000005; +pub const SERVICE_STOP_REASON_MINOR_HUNG: DWORD = 0x00000006; +pub const SERVICE_STOP_REASON_MINOR_UNSTABLE: DWORD = 0x00000007; +pub const SERVICE_STOP_REASON_MINOR_DISK: DWORD = 0x00000008; +pub const SERVICE_STOP_REASON_MINOR_NETWORKCARD: DWORD = 0x00000009; +pub const SERVICE_STOP_REASON_MINOR_ENVIRONMENT: DWORD = 0x0000000a; +pub const SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER: DWORD = 0x0000000b; +pub const SERVICE_STOP_REASON_MINOR_OTHERDRIVER: DWORD = 0x0000000c; +pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK: DWORD = 0x0000000d; +pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE: DWORD = 0x0000000e; +pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX: DWORD = 0x0000000f; +pub const SERVICE_STOP_REASON_MINOR_SECURITY: DWORD = 0x00000010; +pub const SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY: DWORD = 0x00000011; +pub const SERVICE_STOP_REASON_MINOR_WMI: DWORD = 0x00000012; +pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL: DWORD = 0x00000013; +pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL: DWORD = 0x00000014; +pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL: DWORD = 0x00000015; +pub const SERVICE_STOP_REASON_MINOR_MMC: DWORD = 0x00000016; +pub const SERVICE_STOP_REASON_MINOR_NONE: DWORD = 0x00000017; +pub const SERVICE_STOP_REASON_MINOR_MAX: DWORD = 0x00000018; +pub const SERVICE_STOP_REASON_MINOR_MIN_CUSTOM: DWORD = 0x00000100; +pub const SERVICE_STOP_REASON_MINOR_MAX_CUSTOM: DWORD = 0x0000FFFF; +pub const SERVICE_CONTROL_STATUS_REASON_INFO: DWORD = 1; +pub const SERVICE_SID_TYPE_NONE: DWORD = 0x00000000; +pub const SERVICE_SID_TYPE_UNRESTRICTED: DWORD = 0x00000001; +pub const SERVICE_SID_TYPE_RESTRICTED: DWORD = 0x00000002 | SERVICE_SID_TYPE_UNRESTRICTED; +pub const SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL: DWORD = 1; +pub const SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY: DWORD = 2; +pub const SERVICE_TRIGGER_TYPE_DOMAIN_JOIN: DWORD = 3; +pub const SERVICE_TRIGGER_TYPE_FIREWALL_PORT_EVENT: DWORD = 4; +pub const SERVICE_TRIGGER_TYPE_GROUP_POLICY: DWORD = 5; +pub const SERVICE_TRIGGER_TYPE_NETWORK_ENDPOINT: DWORD = 6; +pub const SERVICE_TRIGGER_TYPE_CUSTOM_SYSTEM_STATE_CHANGE: DWORD = 7; +pub const SERVICE_TRIGGER_TYPE_CUSTOM: DWORD = 20; +pub const SERVICE_TRIGGER_DATA_TYPE_BINARY: DWORD = 1; +pub const SERVICE_TRIGGER_DATA_TYPE_STRING: DWORD = 2; +pub const SERVICE_TRIGGER_DATA_TYPE_LEVEL: DWORD = 3; +pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ANY: DWORD = 4; +pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ALL: DWORD = 5; +pub const SERVICE_START_REASON_DEMAND: DWORD = 0x00000001; +pub const SERVICE_START_REASON_AUTO: DWORD = 0x00000002; +pub const SERVICE_START_REASON_TRIGGER: DWORD = 0x00000004; +pub const SERVICE_START_REASON_RESTART_ON_FAILURE: DWORD = 0x00000008; +pub const SERVICE_START_REASON_DELAYEDAUTO: DWORD = 0x00000010; +pub const SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON: DWORD = 1; +pub const SERVICE_LAUNCH_PROTECTED_NONE: DWORD = 0; +pub const SERVICE_LAUNCH_PROTECTED_WINDOWS: DWORD = 1; +pub const SERVICE_LAUNCH_PROTECTED_WINDOWS_LIGHT: DWORD = 2; +pub const SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT: DWORD = 3; +DEFINE_GUID!{NETWORK_MANAGER_FIRST_IP_ADDRESS_ARRIVAL_GUID, + 0x4f27f2de, 0x14e2, 0x430b, 0xa5, 0x49, 0x7c, 0xd4, 0x8c, 0xbc, 0x82, 0x45} +DEFINE_GUID!{NETWORK_MANAGER_LAST_IP_ADDRESS_REMOVAL_GUID, + 0xcc4ba62a, 0x162e, 0x4648, 0x84, 0x7a, 0xb6, 0xbd, 0xf9, 0x93, 0xe3, 0x35} +DEFINE_GUID!{DOMAIN_JOIN_GUID, + 0x1ce20aba, 0x9851, 0x4421, 0x94, 0x30, 0x1d, 0xde, 0xb7, 0x66, 0xe8, 0x09} +DEFINE_GUID!{DOMAIN_LEAVE_GUID, + 0xddaf516e, 0x58c2, 0x4866, 0x95, 0x74, 0xc3, 0xb6, 0x15, 0xd4, 0x2e, 0xa1} +DEFINE_GUID!{FIREWALL_PORT_OPEN_GUID, + 0xb7569e07, 0x8421, 0x4ee0, 0xad, 0x10, 0x86, 0x91, 0x5a, 0xfd, 0xad, 0x09} +DEFINE_GUID!{FIREWALL_PORT_CLOSE_GUID, + 0xa144ed38, 0x8e12, 0x4de4, 0x9d, 0x96, 0xe6, 0x47, 0x40, 0xb1, 0xa5, 0x24} +DEFINE_GUID!{MACHINE_POLICY_PRESENT_GUID, + 0x659fcae6, 0x5bdb, 0x4da9, 0xb1, 0xff, 0xca, 0x2a, 0x17, 0x8d, 0x46, 0xe0} +DEFINE_GUID!{USER_POLICY_PRESENT_GUID, + 0x54fb46c8, 0xf089, 0x464c, 0xb1, 0xfd, 0x59, 0xd1, 0xb6, 0x2c, 0x3b, 0x50} +DEFINE_GUID!{RPC_INTERFACE_EVENT_GUID, + 0xbc90d167, 0x9470, 0x4139, 0xa9, 0xba, 0xbe, 0x0b, 0xbb, 0xf5, 0xb7, 0x4d} +DEFINE_GUID!{NAMED_PIPE_EVENT_GUID, + 0x1f81d131, 0x3fac, 0x4537, 0x9e, 0x0c, 0x7e, 0x7b, 0x0c, 0x2f, 0x4b, 0x55} +DEFINE_GUID!{CUSTOM_SYSTEM_STATE_CHANGE_EVENT_GUID, + 0x2d7a2816, 0x0c5e, 0x45fc, 0x9c, 0xe7, 0x57, 0x0e, 0x5e, 0xcd, 0xe9, 0xc9} +DECLARE_HANDLE!(SC_HANDLE, SC_HANDLE__); +pub type LPSC_HANDLE = *mut SC_HANDLE; +DECLARE_HANDLE!(SERVICE_STATUS_HANDLE, SERVICE_STATUS_HANDLE__); +ENUM!{enum SC_STATUS_TYPE { + SC_STATUS_PROCESS_INFO = 0, +}} +ENUM!{enum _SC_ENUM_TYPE { + SC_ENUM_PROCESS_INFO = 0, +}} +STRUCT!{struct SERVICE_STATUS { + dwServiceType: DWORD, + dwCurrentState: DWORD, + dwControlsAccepted: DWORD, + dwWin32ExitCode: DWORD, + dwServiceSpecificExitCode: DWORD, + dwCheckPoint: DWORD, + dwWaitHint: DWORD, +}} +pub type LPSERVICE_STATUS = *mut SERVICE_STATUS; +FN!{stdcall LPSERVICE_MAIN_FUNCTIONW( + dwNumServicesArgs: DWORD, + lpServiceArgVectors: *mut LPWSTR, +) -> ()} +FN!{stdcall LPSERVICE_MAIN_FUNCTIONA( + dwNumServicesArgs: DWORD, + lpServiceArgVectors: *mut LPSTR, +) -> ()} +STRUCT!{struct SERVICE_TABLE_ENTRYA { + lpServiceName: LPCSTR, + lpServiceProc: LPSERVICE_MAIN_FUNCTIONA, +}} +pub type LPSERVICE_TABLE_ENTRYA = *mut SERVICE_TABLE_ENTRYA; +STRUCT!{struct SERVICE_TABLE_ENTRYW { + lpServiceName: LPCWSTR, + lpServiceProc: LPSERVICE_MAIN_FUNCTIONW, +}} +pub type LPSERVICE_TABLE_ENTRYW = *mut SERVICE_TABLE_ENTRYW; +FN!{stdcall LPHANDLER_FUNCTION( + dwControl: DWORD, +) -> ()} +FN!{stdcall LPHANDLER_FUNCTION_EX( + dwControl: DWORD, + dwEventType: DWORD, + lpEventData: LPVOID, + lpContext: LPVOID, +) -> DWORD} +extern "system" { + // pub fn ChangeServiceConfigA(); + // pub fn ChangeServiceConfigW(); + // pub fn ChangeServiceConfig2A(); + // pub fn ChangeServiceConfig2W(); + pub fn CloseServiceHandle( + hSCObject: SC_HANDLE, + ) -> BOOL; + pub fn ControlService( + hService: SC_HANDLE, + dwControl: DWORD, + lpServiceStatus: LPSERVICE_STATUS, + ) -> BOOL; + pub fn CreateServiceA( + hSCManager: SC_HANDLE, + lpServiceName: LPCSTR, + lpDisplayName: LPCSTR, + dwDesiredAccess: DWORD, + dwServiceType: DWORD, + dwStartType: DWORD, + dwErrorControl: DWORD, + lpBinaryPathName: LPCSTR, + lpLoadOrderGroup: LPCSTR, + lpdwTagId: LPDWORD, + lpDependencies: LPCSTR, + lpServiceStartName: LPCSTR, + lpPassword: LPCSTR, + ) -> SC_HANDLE; + pub fn CreateServiceW( + hSCManager: SC_HANDLE, + lpServiceName: LPCWSTR, + lpDisplayName: LPCWSTR, + dwDesiredAccess: DWORD, + dwServiceType: DWORD, + dwStartType: DWORD, + dwErrorControl: DWORD, + lpBinaryPathName: LPCWSTR, + lpLoadOrderGroup: LPCWSTR, + lpdwTagId: LPDWORD, + lpDependencies: LPCWSTR, + lpServiceStartName: LPCWSTR, + lpPassword: LPCWSTR, + ) -> SC_HANDLE; + pub fn DeleteService( + hService: SC_HANDLE, + ) -> BOOL; + // pub fn EnumDependentServicesA(); + // pub fn EnumDependentServicesW(); + // pub fn EnumServicesStatusA(); + // pub fn EnumServicesStatusW(); + // pub fn EnumServicesStatusExA(); + // pub fn EnumServicesStatusExW(); + // pub fn GetServiceKeyNameA(); + // pub fn GetServiceKeyNameW(); + // pub fn GetServiceDisplayNameA(); + // pub fn GetServiceDisplayNameW(); + // pub fn LockServiceDatabase(); + // pub fn NotifyBootConfigStatus(); + pub fn OpenSCManagerA( + lpMachineName: LPCSTR, + lpDatabaseName: LPCSTR, + dwDesiredAccess: DWORD, + ) -> SC_HANDLE; + pub fn OpenSCManagerW( + lpMachineName: LPCWSTR, + lpDatabaseName: LPCWSTR, + dwDesiredAccess: DWORD, + ) -> SC_HANDLE; + pub fn OpenServiceA( + hSCManager: SC_HANDLE, + lpServiceName: LPCSTR, + dwDesiredAccess: DWORD, + ) -> SC_HANDLE; + pub fn OpenServiceW( + hSCManager: SC_HANDLE, + lpServiceName: LPCWSTR, + dwDesiredAccess: DWORD, + ) -> SC_HANDLE; + // pub fn QueryServiceConfigA(); + // pub fn QueryServiceConfigW(); + // pub fn QueryServiceConfig2A(); + // pub fn QueryServiceConfig2W(); + // pub fn QueryServiceLockStatusA(); + // pub fn QueryServiceLockStatusW(); + // pub fn QueryServiceObjectSecurity(); + pub fn QueryServiceStatus( + hService: SC_HANDLE, + lpServiceStatus: LPSERVICE_STATUS, + ) -> BOOL; + pub fn QueryServiceStatusEx( + hService: SC_HANDLE, + InfoLevel: SC_STATUS_TYPE, + lpBuffer: LPBYTE, + cbBufSize: DWORD, + pcbBytesNeeded: LPDWORD, + ) -> BOOL; + pub fn RegisterServiceCtrlHandlerA( + lpServiceName: LPCSTR, + lpHandlerProc: LPHANDLER_FUNCTION, + ) -> SERVICE_STATUS_HANDLE; + pub fn RegisterServiceCtrlHandlerW( + lpServiceName: LPCWSTR, + lpHandlerProc: LPHANDLER_FUNCTION, + ) -> SERVICE_STATUS_HANDLE; + pub fn RegisterServiceCtrlHandlerExA( + lpServiceName: LPCSTR, + lpHandlerProc: LPHANDLER_FUNCTION_EX, + lpContext: LPVOID, + ) -> SERVICE_STATUS_HANDLE; + pub fn RegisterServiceCtrlHandlerExW( + lpServiceName: LPCWSTR, + lpHandlerProc: LPHANDLER_FUNCTION_EX, + lpContext: LPVOID, + ) -> SERVICE_STATUS_HANDLE; + // pub fn SetServiceObjectSecurity(); + pub fn SetServiceStatus( + hServiceStatus: SERVICE_STATUS_HANDLE, + lpServiceStatus: LPSERVICE_STATUS, + ) -> BOOL; + pub fn StartServiceCtrlDispatcherA( + lpServiceStartTable: *const SERVICE_TABLE_ENTRYA, + ) -> BOOL; + pub fn StartServiceCtrlDispatcherW( + lpServiceStartTable: *const SERVICE_TABLE_ENTRYW, + ) -> BOOL; + // pub fn StartServiceA(); + // pub fn StartServiceW(); + // pub fn UnlockServiceDatabase(); + // pub fn NotifyServiceStatusChangeA(); + // pub fn NotifyServiceStatusChangeW(); + // pub fn ControlServiceExA(); + // pub fn ControlServiceExW(); + // pub fn QueryServiceDynamicInformation(); +} diff --git a/src/vendor/winapi/src/um/winusb.rs b/src/vendor/winapi/src/um/winusb.rs new file mode 100644 index 0000000000..c2dca622a4 --- /dev/null +++ b/src/vendor/winapi/src/um/winusb.rs @@ -0,0 +1,226 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! FFI bindings to winusb. +use shared::minwindef::{BOOL, LPDWORD, PUCHAR, PULONG, UCHAR, ULONG, USHORT}; +use shared::usb::PUSBD_ISO_PACKET_DESCRIPTOR; +use shared::usbspec::PUSB_CONFIGURATION_DESCRIPTOR; +use shared::winusbio::{PWINUSB_PIPE_INFORMATION, PWINUSB_PIPE_INFORMATION_EX}; +use um::minwinbase::LPOVERLAPPED; +use um::winnt::{HANDLE, LARGE_INTEGER, LONG, PVOID}; +pub type WINUSB_INTERFACE_HANDLE = PVOID; +pub type PWINUSB_INTERFACE_HANDLE = *mut PVOID; +pub type WINUSB_ISOCH_BUFFER_HANDLE = PVOID; +pub type PWINUSB_ISOCH_BUFFER_HANDLE = *mut PVOID; +STRUCT!{#[repr(packed)] struct WINUSB_SETUP_PACKET { + RequestType: UCHAR, + Request: UCHAR, + Value: USHORT, + Index: USHORT, + Length: USHORT, +}} +pub type PWINUSB_SETUP_PACKET = *mut WINUSB_SETUP_PACKET; +extern "system" { + pub fn WinUsb_Initialize( + DeviceHandle: HANDLE, + InterfaceHandle: PWINUSB_INTERFACE_HANDLE, + ) -> BOOL; + pub fn WinUsb_Free( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + ) -> BOOL; + pub fn WinUsb_GetAssociatedInterface( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + AssociatedInterfaceIndex: UCHAR, + AssociatedInterfaceHandle: PWINUSB_INTERFACE_HANDLE, + ) -> BOOL; + pub fn WinUsb_GetDescriptor( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + DescriptorType: UCHAR, + Index: UCHAR, + LanguageID: USHORT, + Buffer: PUCHAR, + BufferLength: ULONG, + LengthTransferred: PULONG, + ) -> BOOL; + pub fn WinUsb_QueryInterfaceSettings( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + AlternateInterfaceNumber: UCHAR, + UsbAltInterfaceDescriptor: PUSB_INTERFACE_DESCRIPTOR, + ) -> BOOL; + pub fn WinUsb_QueryDeviceInformation( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + InformationType: ULONG, + BufferLength: PULONG, + Buffer: PVOID, + ) -> BOOL; + pub fn WinUsb_SetCurrentAlternateSetting( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + SettingNumber: UCHAR, + ) -> BOOL; + pub fn WinUsb_GetCurrentAlternateSetting( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + SettingNumber: PUCHAR, + ) -> BOOL; + pub fn WinUsb_QueryPipe( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + AlternateInterfaceNumber: UCHAR, + PipeIndex: UCHAR, + PipeInformationEx: PWINUSB_PIPE_INFORMATION, + ) -> BOOL; + pub fn WinUsb_QueryPipeEx( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + AlternateInterfaceNumber: UCHAR, + PipeIndex: UCHAR, + PipeInformationEx: PWINUSB_PIPE_INFORMATION_EX, + ) -> BOOL; + pub fn WinUsb_SetPipePolicy( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + PolicyType: ULONG, + ValueLength: ULONG, + Value: PVOID, + ) -> BOOL; + pub fn WinUsb_GetPipePolicy( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + PolicyType: ULONG, + ValueLength: PULONG, + Value: PVOID, + ) -> BOOL; + pub fn WinUsb_ReadPipe( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + Buffer: PUCHAR, + BufferLength: ULONG, + LengthTransferred: PULONG, + Overlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WinUsb_WritePipe( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + Buffer: PUCHAR, + BufferLength: ULONG, + LengthTransferred: PULONG, + Overlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WinUsb_ControlTransfer( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + SetupPacket: WINUSB_SETUP_PACKET, + Buffer: PUCHAR, + BufferLength: ULONG, + LengthTransferred: PULONG, + Overlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WinUsb_ResetPipe( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + ) -> BOOL; + pub fn WinUsb_AbortPipe( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + ) -> BOOL; + pub fn WinUsb_FlushPipe( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + ) -> BOOL; + pub fn WinUsb_SetPowerPolicy( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PolicyType: ULONG, + ValueLength: ULONG, + Value: PVOID, + ) -> BOOL; + pub fn WinUsb_GetPowerPolicy( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PolicyType: ULONG, + ValueLength: PULONG, + Value: PVOID, + ) -> BOOL; + pub fn WinUsb_GetOverlappedResult( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + lpOverlapped: LPOVERLAPPED, + lpNumberOfBytesTransferred: LPDWORD, + bWait: BOOL, + ) -> BOOL; + pub fn WinUsb_ParseConfigurationDescriptor( + ConfigurationDescriptor: PUSB_CONFIGURATION_DESCRIPTOR, + StartPosition: PVOID, + InterfaceNumber: LONG, + AlternateSetting: LONG, + InterfaceClass: LONG, + InterfaceSubClass: LONG, + InterfaceProtocol: LONG, + ) -> BOOL; + pub fn WinUsb_ParseDescriptors( + DescriptorBuffer: PVOID, + TotalLength: ULONG, + StartPosition: PVOID, + DescriptorType: LONG, + ) -> BOOL; + pub fn WinUsb_GetCurrentFrameNumber( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + CurrentFrameNumber: PULONG, + TimeStamp: *mut LARGE_INTEGER, + ) -> BOOL; + pub fn WinUsb_GetAdjustedFrameNumber( + CurrentFrameNumber: PULONG, + TimeStamp: LARGE_INTEGER, + ) -> BOOL; + pub fn WinUsb_RegisterIsochBuffer( + InterfaceHandle: WINUSB_INTERFACE_HANDLE, + PipeID: UCHAR, + Buffer: PUCHAR, + BufferLength: ULONG, + IsochBufferHandle: PWINUSB_ISOCH_BUFFER_HANDLE, + ) -> BOOL; + pub fn WinUsb_UnregisterIsochBuffer( + IsochBufferHandle: WINUSB_ISOCH_BUFFER_HANDLE, + ) -> BOOL; + pub fn WinUsb_WriteIsochPipe( + BufferHandle: WINUSB_ISOCH_BUFFER_HANDLE, + Offset: ULONG, + Length: ULONG, + FrameNumber: PULONG, + Overlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WinUsb_ReadIsochPipe( + BufferHandle: WINUSB_ISOCH_BUFFER_HANDLE, + Offset: ULONG, + Length: ULONG, + FrameNumber: PULONG, + NumberOfPackets: ULONG, + IsoPacketDescriptors: PUSBD_ISO_PACKET_DESCRIPTOR, + Overlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WinUsb_WriteIsochPipeAsap( + BufferHandle: WINUSB_ISOCH_BUFFER_HANDLE, + Offset: ULONG, + Length: ULONG, + ContinueStream: BOOL, + Overlapped: LPOVERLAPPED, + ) -> BOOL; + pub fn WinUsb_ReadIsochPipeAsap( + BufferHandle: WINUSB_ISOCH_BUFFER_HANDLE, + Offset: ULONG, + Length: ULONG, + ContinueStream: BOOL, + NumberOfPackets: ULONG, + IsoPacketDescriptors: PUSBD_ISO_PACKET_DESCRIPTOR, + Overlapped: LPOVERLAPPED, + ) -> BOOL; +} + +STRUCT!{struct USB_INTERFACE_DESCRIPTOR { + bLength: UCHAR, + bDescriptorType: UCHAR, + bInterfaceNumber: UCHAR, + bAlternateSetting: UCHAR, + bNumEndpoints: UCHAR, + bInterfaceClass: UCHAR, + bInterfaceSubClass: UCHAR, + bInterfaceProtocol: UCHAR, + iInterface: UCHAR, +}} +pub type PUSB_INTERFACE_DESCRIPTOR = *mut USB_INTERFACE_DESCRIPTOR; diff --git a/src/vendor/winapi/src/um/winuser.rs b/src/vendor/winapi/src/um/winuser.rs new file mode 100644 index 0000000000..4ef82c3c41 --- /dev/null +++ b/src/vendor/winapi/src/um/winuser.rs @@ -0,0 +1,6784 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! USER procedure declarations, constant definitions and macros +use ctypes::{c_int, c_long, c_short, c_uint}; +use shared::basetsd::{ + DWORD_PTR, INT32, INT_PTR, PDWORD_PTR, UINT16, UINT32, UINT64, UINT_PTR, ULONG_PTR, +}; +#[cfg(target_arch = "x86_64")] +use shared::basetsd::LONG_PTR; +use shared::guiddef::{GUID, LPCGUID}; +use shared::minwindef::{ + ATOM, BOOL, BYTE, DWORD, HINSTANCE, HIWORD, HKL, HMODULE, HRGN, HWINSTA, INT, LOWORD, LPARAM, + LPBYTE, LPDWORD, LPINT, LPVOID, LPWORD, LRESULT, PBYTE, PUINT, PULONG, TRUE, UCHAR, UINT, ULONG, + USHORT, WORD, WPARAM, +}; +use shared::windef::{ + COLORREF, HACCEL, HBITMAP, HBRUSH, HCURSOR, HDC, HDESK, HHOOK, HICON, HMENU, HMONITOR, + HWINEVENTHOOK, HWND, LPCRECT, LPPOINT, LPRECT, POINT, RECT, +}; +use um::minwinbase::LPSECURITY_ATTRIBUTES; +use um::wingdi::{ + BLENDFUNCTION, DEVMODEA, DEVMODEW, LOGFONTA, LOGFONTW, PDISPLAY_DEVICEA, PDISPLAY_DEVICEW +}; +use um::winnt::{ + ACCESS_MASK, BOOLEAN, CHAR, HANDLE, LONG, LPCSTR, LPCWSTR, LPSTR, LPWSTR, LUID, + PSECURITY_DESCRIPTOR, PSECURITY_INFORMATION, PVOID, SHORT, VOID, WCHAR, +}; +use vc::limits::UINT_MAX; +use vc::vadefs::va_list; +pub type HDWP = HANDLE; +pub type MENUTEMPLATEA = VOID; +pub type MENUTEMPLATEW = VOID; +pub type LPMENUTEMPLATEA = PVOID; +pub type LPMENUTEMPLATEW = PVOID; +FN!{stdcall WNDPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> LRESULT} +FN!{stdcall DLGPROC( + HWND, + UINT, + WPARAM, + LPARAM, +) -> INT_PTR} +FN!{stdcall TIMERPROC( + HWND, + UINT, + UINT_PTR, + DWORD, +) -> ()} +FN!{stdcall GRAYSTRINGPROC( + HDC, + LPARAM, + c_int, +) -> BOOL} +FN!{stdcall WNDENUMPROC( + HWND, + LPARAM, +) -> BOOL} +FN!{stdcall HOOKPROC( + code: c_int, + wParam: WPARAM, + lParam: LPARAM, +) -> LRESULT} +FN!{stdcall SENDASYNCPROC( + HWND, + UINT, + ULONG_PTR, + LRESULT, +) -> ()} +FN!{stdcall PROPENUMPROCA( + HWND, + LPCSTR, + HANDLE, +) -> BOOL} +FN!{stdcall PROPENUMPROCW( + HWND, + LPCWSTR, + HANDLE, +) -> BOOL} +FN!{stdcall PROPENUMPROCEXA( + HWND, + LPSTR, + HANDLE, + ULONG_PTR, +) -> BOOL} +FN!{stdcall PROPENUMPROCEXW( + HWND, + LPWSTR, + HANDLE, + ULONG_PTR, +) -> BOOL} +FN!{stdcall EDITWORDBREAKPROCA( + lpch: LPSTR, + ichCurrent: c_int, + cch: c_int, + code: c_int, +) -> c_int} +FN!{stdcall EDITWORDBREAKPROCW( + lpch: LPWSTR, + ichCurrent: c_int, + cch: c_int, + code: c_int, +) -> c_int} +FN!{stdcall DRAWSTATEPROC( + hdc: HDC, + lData: LPARAM, + wData: WPARAM, + cx: c_int, + cy: c_int, +) -> BOOL} +FN!{stdcall NAMEENUMPROCA( + LPSTR, + LPARAM, +) -> BOOL} +FN!{stdcall NAMEENUMPROCW( + LPWSTR, + LPARAM, +) -> BOOL} +pub type WINSTAENUMPROCA = NAMEENUMPROCA; +pub type DESKTOPENUMPROCA = NAMEENUMPROCA; +pub type WINSTAENUMPROCW = NAMEENUMPROCW; +pub type DESKTOPENUMPROCW = NAMEENUMPROCW; +#[inline] +pub fn IS_INTRESOURCE(r: ULONG_PTR) -> bool { + (r >> 16) == 0 +} +#[inline] +pub fn MAKEINTRESOURCEA(i: WORD) -> LPSTR { + i as ULONG_PTR as LPSTR +} +#[inline] +pub fn MAKEINTRESOURCEW(i: WORD) -> LPWSTR { + i as ULONG_PTR as LPWSTR +} +pub const RT_CURSOR: LPWSTR = MAKEINTRESOURCE!(1); +pub const RT_BITMAP: LPWSTR = MAKEINTRESOURCE!(2); +pub const RT_ICON: LPWSTR = MAKEINTRESOURCE!(3); +pub const RT_MENU: LPWSTR = MAKEINTRESOURCE!(4); +pub const RT_DIALOG: LPWSTR = MAKEINTRESOURCE!(5); +pub const RT_STRING: LPWSTR = MAKEINTRESOURCE!(6); +pub const RT_FONTDIR: LPWSTR = MAKEINTRESOURCE!(7); +pub const RT_FONT: LPWSTR = MAKEINTRESOURCE!(8); +pub const RT_ACCELERATOR: LPWSTR = MAKEINTRESOURCE!(9); +pub const RT_RCDATA: LPWSTR = MAKEINTRESOURCE!(10); +pub const RT_MESSAGETABLE: LPWSTR = MAKEINTRESOURCE!(11); +pub const DIFFERENCE: WORD = 11; +pub const RT_GROUP_CURSOR: LPWSTR = MAKEINTRESOURCE!(1 + DIFFERENCE); +pub const RT_GROUP_ICON: LPWSTR = MAKEINTRESOURCE!(3 + DIFFERENCE); +pub const RT_VERSION: LPWSTR = MAKEINTRESOURCE!(16); +pub const RT_DLGINCLUDE: LPWSTR = MAKEINTRESOURCE!(17); +pub const RT_PLUGPLAY: LPWSTR = MAKEINTRESOURCE!(19); +pub const RT_VXD: LPWSTR = MAKEINTRESOURCE!(20); +pub const RT_ANICURSOR: LPWSTR = MAKEINTRESOURCE!(21); +pub const RT_ANIICON: LPWSTR = MAKEINTRESOURCE!(22); +pub const RT_HTML: LPWSTR = MAKEINTRESOURCE!(23); +pub const RT_MANIFEST: LPWSTR = MAKEINTRESOURCE!(24); +pub const CREATEPROCESS_MANIFEST_RESOURCE_ID: LPWSTR = MAKEINTRESOURCE!(1); +pub const ISOLATIONAWARE_MANIFEST_RESOURCE_ID: LPWSTR = MAKEINTRESOURCE!(2); +pub const ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID: LPWSTR + = MAKEINTRESOURCE!(3); +pub const MINIMUM_RESERVED_MANIFEST_RESOURCE_ID: LPWSTR = MAKEINTRESOURCE!(1); +pub const MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID: LPWSTR = MAKEINTRESOURCE!(16); +extern "system" { + pub fn wvsprintfA( + _: LPSTR, + _: LPCSTR, + arglist: va_list, + ) -> c_int; + pub fn wvsprintfW( + _: LPWSTR, + _: LPCWSTR, + arglist: va_list, + ) -> c_int; +} +extern "C" { + pub fn wsprintfA( + _: LPSTR, + _: LPCSTR, + ... + ) -> c_int; + pub fn wsprintfW( + _: LPWSTR, + _: LPCWSTR, + ... + ) -> c_int; +} +pub const SETWALLPAPER_DEFAULT: LPWSTR = -1isize as LPWSTR; +pub const SB_HORZ: UINT = 0; +pub const SB_VERT: UINT = 1; +pub const SB_CTL: UINT = 2; +pub const SB_BOTH: UINT = 3; +pub const SB_LINEUP: LPARAM = 0; +pub const SB_LINELEFT: LPARAM = 0; +pub const SB_LINEDOWN: LPARAM = 1; +pub const SB_LINERIGHT: LPARAM = 1; +pub const SB_PAGEUP: LPARAM = 2; +pub const SB_PAGELEFT: LPARAM = 2; +pub const SB_PAGEDOWN: LPARAM = 3; +pub const SB_PAGERIGHT: LPARAM = 3; +pub const SB_THUMBPOSITION: LPARAM = 4; +pub const SB_THUMBTRACK: LPARAM = 5; +pub const SB_TOP: LPARAM = 6; +pub const SB_LEFT: LPARAM = 6; +pub const SB_BOTTOM: LPARAM = 7; +pub const SB_RIGHT: LPARAM = 7; +pub const SB_ENDSCROLL: LPARAM = 8; +pub const SW_HIDE: c_int = 0; +pub const SW_SHOWNORMAL: c_int = 1; +pub const SW_NORMAL: c_int = 1; +pub const SW_SHOWMINIMIZED: c_int = 2; +pub const SW_SHOWMAXIMIZED: c_int = 3; +pub const SW_MAXIMIZE: c_int = 3; +pub const SW_SHOWNOACTIVATE: c_int = 4; +pub const SW_SHOW: c_int = 5; +pub const SW_MINIMIZE: c_int = 6; +pub const SW_SHOWMINNOACTIVE: c_int = 7; +pub const SW_SHOWNA: c_int = 8; +pub const SW_RESTORE: c_int = 9; +pub const SW_SHOWDEFAULT: c_int = 10; +pub const SW_FORCEMINIMIZE: c_int = 11; +pub const SW_MAX: c_int = 11; +pub const HIDE_WINDOW: c_int = 0; +pub const SHOW_OPENWINDOW: c_int = 1; +pub const SHOW_ICONWINDOW: c_int = 2; +pub const SHOW_FULLSCREEN: c_int = 3; +pub const SHOW_OPENNOACTIVATE: c_int = 4; +pub const SW_PARENTCLOSING: LPARAM = 1; +pub const SW_OTHERZOOM: LPARAM = 2; +pub const SW_PARENTOPENING: LPARAM = 3; +pub const SW_OTHERUNZOOM: LPARAM = 4; +pub const AW_HOR_POSITIVE: DWORD = 0x00000001; +pub const AW_HOR_NEGATIVE: DWORD = 0x00000002; +pub const AW_VER_POSITIVE: DWORD = 0x00000004; +pub const AW_VER_NEGATIVE: DWORD = 0x00000008; +pub const AW_CENTER: DWORD = 0x00000010; +pub const AW_HIDE: DWORD = 0x00010000; +pub const AW_ACTIVATE: DWORD = 0x00020000; +pub const AW_SLIDE: DWORD = 0x00040000; +pub const AW_BLEND: DWORD = 0x00080000; +pub const KF_EXTENDED: WORD = 0x0100; +pub const KF_DLGMODE: WORD = 0x0800; +pub const KF_MENUMODE: WORD = 0x1000; +pub const KF_ALTDOWN: WORD = 0x2000; +pub const KF_REPEAT: WORD = 0x4000; +pub const KF_UP: WORD = 0x8000; +pub const VK_LBUTTON: c_int = 0x01; +pub const VK_RBUTTON: c_int = 0x02; +pub const VK_CANCEL: c_int = 0x03; +pub const VK_MBUTTON: c_int = 0x04; +pub const VK_XBUTTON1: c_int = 0x05; +pub const VK_XBUTTON2: c_int = 0x06; +pub const VK_BACK: c_int = 0x08; +pub const VK_TAB: c_int = 0x09; +pub const VK_CLEAR: c_int = 0x0C; +pub const VK_RETURN: c_int = 0x0D; +pub const VK_SHIFT: c_int = 0x10; +pub const VK_CONTROL: c_int = 0x11; +pub const VK_MENU: c_int = 0x12; +pub const VK_PAUSE: c_int = 0x13; +pub const VK_CAPITAL: c_int = 0x14; +pub const VK_KANA: c_int = 0x15; +pub const VK_HANGEUL: c_int = 0x15; +pub const VK_HANGUL: c_int = 0x15; +pub const VK_JUNJA: c_int = 0x17; +pub const VK_FINAL: c_int = 0x18; +pub const VK_HANJA: c_int = 0x19; +pub const VK_KANJI: c_int = 0x19; +pub const VK_ESCAPE: c_int = 0x1B; +pub const VK_CONVERT: c_int = 0x1C; +pub const VK_NONCONVERT: c_int = 0x1D; +pub const VK_ACCEPT: c_int = 0x1E; +pub const VK_MODECHANGE: c_int = 0x1F; +pub const VK_SPACE: c_int = 0x20; +pub const VK_PRIOR: c_int = 0x21; +pub const VK_NEXT: c_int = 0x22; +pub const VK_END: c_int = 0x23; +pub const VK_HOME: c_int = 0x24; +pub const VK_LEFT: c_int = 0x25; +pub const VK_UP: c_int = 0x26; +pub const VK_RIGHT: c_int = 0x27; +pub const VK_DOWN: c_int = 0x28; +pub const VK_SELECT: c_int = 0x29; +pub const VK_PRINT: c_int = 0x2A; +pub const VK_EXECUTE: c_int = 0x2B; +pub const VK_SNAPSHOT: c_int = 0x2C; +pub const VK_INSERT: c_int = 0x2D; +pub const VK_DELETE: c_int = 0x2E; +pub const VK_HELP: c_int = 0x2F; +pub const VK_LWIN: c_int = 0x5B; +pub const VK_RWIN: c_int = 0x5C; +pub const VK_APPS: c_int = 0x5D; +pub const VK_SLEEP: c_int = 0x5F; +pub const VK_NUMPAD0: c_int = 0x60; +pub const VK_NUMPAD1: c_int = 0x61; +pub const VK_NUMPAD2: c_int = 0x62; +pub const VK_NUMPAD3: c_int = 0x63; +pub const VK_NUMPAD4: c_int = 0x64; +pub const VK_NUMPAD5: c_int = 0x65; +pub const VK_NUMPAD6: c_int = 0x66; +pub const VK_NUMPAD7: c_int = 0x67; +pub const VK_NUMPAD8: c_int = 0x68; +pub const VK_NUMPAD9: c_int = 0x69; +pub const VK_MULTIPLY: c_int = 0x6A; +pub const VK_ADD: c_int = 0x6B; +pub const VK_SEPARATOR: c_int = 0x6C; +pub const VK_SUBTRACT: c_int = 0x6D; +pub const VK_DECIMAL: c_int = 0x6E; +pub const VK_DIVIDE: c_int = 0x6F; +pub const VK_F1: c_int = 0x70; +pub const VK_F2: c_int = 0x71; +pub const VK_F3: c_int = 0x72; +pub const VK_F4: c_int = 0x73; +pub const VK_F5: c_int = 0x74; +pub const VK_F6: c_int = 0x75; +pub const VK_F7: c_int = 0x76; +pub const VK_F8: c_int = 0x77; +pub const VK_F9: c_int = 0x78; +pub const VK_F10: c_int = 0x79; +pub const VK_F11: c_int = 0x7A; +pub const VK_F12: c_int = 0x7B; +pub const VK_F13: c_int = 0x7C; +pub const VK_F14: c_int = 0x7D; +pub const VK_F15: c_int = 0x7E; +pub const VK_F16: c_int = 0x7F; +pub const VK_F17: c_int = 0x80; +pub const VK_F18: c_int = 0x81; +pub const VK_F19: c_int = 0x82; +pub const VK_F20: c_int = 0x83; +pub const VK_F21: c_int = 0x84; +pub const VK_F22: c_int = 0x85; +pub const VK_F23: c_int = 0x86; +pub const VK_F24: c_int = 0x87; +pub const VK_NAVIGATION_VIEW: c_int = 0x88; +pub const VK_NAVIGATION_MENU: c_int = 0x89; +pub const VK_NAVIGATION_UP: c_int = 0x8A; +pub const VK_NAVIGATION_DOWN: c_int = 0x8B; +pub const VK_NAVIGATION_LEFT: c_int = 0x8C; +pub const VK_NAVIGATION_RIGHT: c_int = 0x8D; +pub const VK_NAVIGATION_ACCEPT: c_int = 0x8E; +pub const VK_NAVIGATION_CANCEL: c_int = 0x8F; +pub const VK_NUMLOCK: c_int = 0x90; +pub const VK_SCROLL: c_int = 0x91; +pub const VK_OEM_NEC_EQUAL: c_int = 0x92; +pub const VK_OEM_FJ_JISHO: c_int = 0x92; +pub const VK_OEM_FJ_MASSHOU: c_int = 0x93; +pub const VK_OEM_FJ_TOUROKU: c_int = 0x94; +pub const VK_OEM_FJ_LOYA: c_int = 0x95; +pub const VK_OEM_FJ_ROYA: c_int = 0x96; +pub const VK_LSHIFT: c_int = 0xA0; +pub const VK_RSHIFT: c_int = 0xA1; +pub const VK_LCONTROL: c_int = 0xA2; +pub const VK_RCONTROL: c_int = 0xA3; +pub const VK_LMENU: c_int = 0xA4; +pub const VK_RMENU: c_int = 0xA5; +pub const VK_BROWSER_BACK: c_int = 0xA6; +pub const VK_BROWSER_FORWARD: c_int = 0xA7; +pub const VK_BROWSER_REFRESH: c_int = 0xA8; +pub const VK_BROWSER_STOP: c_int = 0xA9; +pub const VK_BROWSER_SEARCH: c_int = 0xAA; +pub const VK_BROWSER_FAVORITES: c_int = 0xAB; +pub const VK_BROWSER_HOME: c_int = 0xAC; +pub const VK_VOLUME_MUTE: c_int = 0xAD; +pub const VK_VOLUME_DOWN: c_int = 0xAE; +pub const VK_VOLUME_UP: c_int = 0xAF; +pub const VK_MEDIA_NEXT_TRACK: c_int = 0xB0; +pub const VK_MEDIA_PREV_TRACK: c_int = 0xB1; +pub const VK_MEDIA_STOP: c_int = 0xB2; +pub const VK_MEDIA_PLAY_PAUSE: c_int = 0xB3; +pub const VK_LAUNCH_MAIL: c_int = 0xB4; +pub const VK_LAUNCH_MEDIA_SELECT: c_int = 0xB5; +pub const VK_LAUNCH_APP1: c_int = 0xB6; +pub const VK_LAUNCH_APP2: c_int = 0xB7; +pub const VK_OEM_1: c_int = 0xBA; +pub const VK_OEM_PLUS: c_int = 0xBB; +pub const VK_OEM_COMMA: c_int = 0xBC; +pub const VK_OEM_MINUS: c_int = 0xBD; +pub const VK_OEM_PERIOD: c_int = 0xBE; +pub const VK_OEM_2: c_int = 0xBF; +pub const VK_OEM_3: c_int = 0xC0; +pub const VK_GAMEPAD_A: c_int = 0xC3; +pub const VK_GAMEPAD_B: c_int = 0xC4; +pub const VK_GAMEPAD_X: c_int = 0xC5; +pub const VK_GAMEPAD_Y: c_int = 0xC6; +pub const VK_GAMEPAD_RIGHT_SHOULDER: c_int = 0xC7; +pub const VK_GAMEPAD_LEFT_SHOULDER: c_int = 0xC8; +pub const VK_GAMEPAD_LEFT_TRIGGER: c_int = 0xC9; +pub const VK_GAMEPAD_RIGHT_TRIGGER: c_int = 0xCA; +pub const VK_GAMEPAD_DPAD_UP: c_int = 0xCB; +pub const VK_GAMEPAD_DPAD_DOWN: c_int = 0xCC; +pub const VK_GAMEPAD_DPAD_LEFT: c_int = 0xCD; +pub const VK_GAMEPAD_DPAD_RIGHT: c_int = 0xCE; +pub const VK_GAMEPAD_MENU: c_int = 0xCF; +pub const VK_GAMEPAD_VIEW: c_int = 0xD0; +pub const VK_GAMEPAD_LEFT_THUMBSTICK_BUTTON: c_int = 0xD1; +pub const VK_GAMEPAD_RIGHT_THUMBSTICK_BUTTON: c_int = 0xD2; +pub const VK_GAMEPAD_LEFT_THUMBSTICK_UP: c_int = 0xD3; +pub const VK_GAMEPAD_LEFT_THUMBSTICK_DOWN: c_int = 0xD4; +pub const VK_GAMEPAD_LEFT_THUMBSTICK_RIGHT: c_int = 0xD5; +pub const VK_GAMEPAD_LEFT_THUMBSTICK_LEFT: c_int = 0xD6; +pub const VK_GAMEPAD_RIGHT_THUMBSTICK_UP: c_int = 0xD7; +pub const VK_GAMEPAD_RIGHT_THUMBSTICK_DOWN: c_int = 0xD8; +pub const VK_GAMEPAD_RIGHT_THUMBSTICK_RIGHT: c_int = 0xD9; +pub const VK_GAMEPAD_RIGHT_THUMBSTICK_LEFT: c_int = 0xDA; +pub const VK_OEM_4: c_int = 0xDB; +pub const VK_OEM_5: c_int = 0xDC; +pub const VK_OEM_6: c_int = 0xDD; +pub const VK_OEM_7: c_int = 0xDE; +pub const VK_OEM_8: c_int = 0xDF; +pub const VK_OEM_AX: c_int = 0xE1; +pub const VK_OEM_102: c_int = 0xE2; +pub const VK_ICO_HELP: c_int = 0xE3; +pub const VK_ICO_00: c_int = 0xE4; +pub const VK_PROCESSKEY: c_int = 0xE5; +pub const VK_ICO_CLEAR: c_int = 0xE6; +pub const VK_PACKET: c_int = 0xE7; +pub const VK_OEM_RESET: c_int = 0xE9; +pub const VK_OEM_JUMP: c_int = 0xEA; +pub const VK_OEM_PA1: c_int = 0xEB; +pub const VK_OEM_PA2: c_int = 0xEC; +pub const VK_OEM_PA3: c_int = 0xED; +pub const VK_OEM_WSCTRL: c_int = 0xEE; +pub const VK_OEM_CUSEL: c_int = 0xEF; +pub const VK_OEM_ATTN: c_int = 0xF0; +pub const VK_OEM_FINISH: c_int = 0xF1; +pub const VK_OEM_COPY: c_int = 0xF2; +pub const VK_OEM_AUTO: c_int = 0xF3; +pub const VK_OEM_ENLW: c_int = 0xF4; +pub const VK_OEM_BACKTAB: c_int = 0xF5; +pub const VK_ATTN: c_int = 0xF6; +pub const VK_CRSEL: c_int = 0xF7; +pub const VK_EXSEL: c_int = 0xF8; +pub const VK_EREOF: c_int = 0xF9; +pub const VK_PLAY: c_int = 0xFA; +pub const VK_ZOOM: c_int = 0xFB; +pub const VK_NONAME: c_int = 0xFC; +pub const VK_PA1: c_int = 0xFD; +pub const VK_OEM_CLEAR: c_int = 0xFE; +pub const WH_MIN: c_int = -1; +pub const WH_MSGFILTER: c_int = -1; +pub const WH_JOURNALRECORD: c_int = 0; +pub const WH_JOURNALPLAYBACK: c_int = 1; +pub const WH_KEYBOARD: c_int = 2; +pub const WH_GETMESSAGE: c_int = 3; +pub const WH_CALLWNDPROC: c_int = 4; +pub const WH_CBT: c_int = 5; +pub const WH_SYSMSGFILTER: c_int = 6; +pub const WH_MOUSE: c_int = 7; +pub const WH_HARDWARE: c_int = 8; +pub const WH_DEBUG: c_int = 9; +pub const WH_SHELL: c_int = 10; +pub const WH_FOREGROUNDIDLE: c_int = 11; +pub const WH_CALLWNDPROCRET: c_int = 12; +pub const WH_KEYBOARD_LL: c_int = 13; +pub const WH_MOUSE_LL: c_int = 14; +pub const WH_MAX: c_int = 14; +pub const WH_MINHOOK: c_int = WH_MIN; +pub const WH_MAXHOOK: c_int = WH_MAX; +pub const HC_ACTION: c_int = 0; +pub const HC_GETNEXT: c_int = 1; +pub const HC_SKIP: c_int = 2; +pub const HC_NOREMOVE: c_int = 3; +pub const HC_NOREM: c_int = HC_NOREMOVE; +pub const HC_SYSMODALON: c_int = 4; +pub const HC_SYSMODALOFF: c_int = 5; +pub const HCBT_MOVESIZE: c_int = 0; +pub const HCBT_MINMAX: c_int = 1; +pub const HCBT_QS: c_int = 2; +pub const HCBT_CREATEWND: c_int = 3; +pub const HCBT_DESTROYWND: c_int = 4; +pub const HCBT_ACTIVATE: c_int = 5; +pub const HCBT_CLICKSKIPPED: c_int = 6; +pub const HCBT_KEYSKIPPED: c_int = 7; +pub const HCBT_SYSCOMMAND: c_int = 8; +pub const HCBT_SETFOCUS: c_int = 9; +STRUCT!{struct CBT_CREATEWNDA { + lpcs: *mut CREATESTRUCTA, + hwndInsertAfter: HWND, +}} +pub type LPCBT_CREATEWNDA = *mut CBT_CREATEWNDA; +STRUCT!{struct CBT_CREATEWNDW { + lpcs: *mut CREATESTRUCTW, + hwndInsertAfter: HWND, +}} +pub type LPCBT_CREATEWNDW = *mut CBT_CREATEWNDW; +STRUCT!{struct CBTACTIVATESTRUCT { + fMouse: BOOL, + hWndActive: HWND, +}} +pub type LPCBTACTIVATESTRUCT = *mut CBTACTIVATESTRUCT; +STRUCT!{struct WTSSESSION_NOTIFICATION { + cbSize: DWORD, + dwSessionId: DWORD, +}} +pub type PWTSSESSION_NOTIFICATION = *mut WTSSESSION_NOTIFICATION; +pub const WTS_CONSOLE_CONNECT: WPARAM = 0x1; +pub const WTS_CONSOLE_DISCONNECT: WPARAM = 0x2; +pub const WTS_REMOTE_CONNECT: WPARAM = 0x3; +pub const WTS_REMOTE_DISCONNECT: WPARAM = 0x4; +pub const WTS_SESSION_LOGON: WPARAM = 0x5; +pub const WTS_SESSION_LOGOFF: WPARAM = 0x6; +pub const WTS_SESSION_LOCK: WPARAM = 0x7; +pub const WTS_SESSION_UNLOCK: WPARAM = 0x8; +pub const WTS_SESSION_REMOTE_CONTROL: WPARAM = 0x9; +pub const WTS_SESSION_CREATE: WPARAM = 0xa; +pub const WTS_SESSION_TERMINATE: WPARAM = 0xb; +pub const MSGF_DIALOGBOX: c_int = 0; +pub const MSGF_MESSAGEBOX: c_int = 1; +pub const MSGF_MENU: c_int = 2; +pub const MSGF_SCROLLBAR: c_int = 5; +pub const MSGF_NEXTWINDOW: c_int = 6; +pub const MSGF_MAX: c_int = 8; +pub const MSGF_USER: c_int = 4096; +pub const HSHELL_WINDOWCREATED: c_int = 1; +pub const HSHELL_WINDOWDESTROYED: c_int = 2; +pub const HSHELL_ACTIVATESHELLWINDOW: c_int = 3; +pub const HSHELL_WINDOWACTIVATED: c_int = 4; +pub const HSHELL_GETMINRECT: c_int = 5; +pub const HSHELL_REDRAW: c_int = 6; +pub const HSHELL_TASKMAN: c_int = 7; +pub const HSHELL_LANGUAGE: c_int = 8; +pub const HSHELL_SYSMENU: c_int = 9; +pub const HSHELL_ENDTASK: c_int = 10; +pub const HSHELL_ACCESSIBILITYSTATE: c_int = 11; +pub const HSHELL_APPCOMMAND: c_int = 12; +pub const HSHELL_WINDOWREPLACED: c_int = 13; +pub const HSHELL_WINDOWREPLACING: c_int = 14; +pub const HSHELL_MONITORCHANGED: c_int = 16; +pub const HSHELL_HIGHBIT: c_int = 0x8000; +pub const HSHELL_FLASH: c_int = HSHELL_REDRAW | HSHELL_HIGHBIT; +pub const HSHELL_RUDEAPPACTIVATED: c_int = HSHELL_WINDOWACTIVATED | HSHELL_HIGHBIT; +pub const APPCOMMAND_BROWSER_BACKWARD: c_short = 1; +pub const APPCOMMAND_BROWSER_FORWARD: c_short = 2; +pub const APPCOMMAND_BROWSER_REFRESH: c_short = 3; +pub const APPCOMMAND_BROWSER_STOP: c_short = 4; +pub const APPCOMMAND_BROWSER_SEARCH: c_short = 5; +pub const APPCOMMAND_BROWSER_FAVORITES: c_short = 6; +pub const APPCOMMAND_BROWSER_HOME: c_short = 7; +pub const APPCOMMAND_VOLUME_MUTE: c_short = 8; +pub const APPCOMMAND_VOLUME_DOWN: c_short = 9; +pub const APPCOMMAND_VOLUME_UP: c_short = 10; +pub const APPCOMMAND_MEDIA_NEXTTRACK: c_short = 11; +pub const APPCOMMAND_MEDIA_PREVIOUSTRACK: c_short = 12; +pub const APPCOMMAND_MEDIA_STOP: c_short = 13; +pub const APPCOMMAND_MEDIA_PLAY_PAUSE: c_short = 14; +pub const APPCOMMAND_LAUNCH_MAIL: c_short = 15; +pub const APPCOMMAND_LAUNCH_MEDIA_SELECT: c_short = 16; +pub const APPCOMMAND_LAUNCH_APP1: c_short = 17; +pub const APPCOMMAND_LAUNCH_APP2: c_short = 18; +pub const APPCOMMAND_BASS_DOWN: c_short = 19; +pub const APPCOMMAND_BASS_BOOST: c_short = 20; +pub const APPCOMMAND_BASS_UP: c_short = 21; +pub const APPCOMMAND_TREBLE_DOWN: c_short = 22; +pub const APPCOMMAND_TREBLE_UP: c_short = 23; +pub const APPCOMMAND_MICROPHONE_VOLUME_MUTE: c_short = 24; +pub const APPCOMMAND_MICROPHONE_VOLUME_DOWN: c_short = 25; +pub const APPCOMMAND_MICROPHONE_VOLUME_UP: c_short = 26; +pub const APPCOMMAND_HELP: c_short = 27; +pub const APPCOMMAND_FIND: c_short = 28; +pub const APPCOMMAND_NEW: c_short = 29; +pub const APPCOMMAND_OPEN: c_short = 30; +pub const APPCOMMAND_CLOSE: c_short = 31; +pub const APPCOMMAND_SAVE: c_short = 32; +pub const APPCOMMAND_PRINT: c_short = 33; +pub const APPCOMMAND_UNDO: c_short = 34; +pub const APPCOMMAND_REDO: c_short = 35; +pub const APPCOMMAND_COPY: c_short = 36; +pub const APPCOMMAND_CUT: c_short = 37; +pub const APPCOMMAND_PASTE: c_short = 38; +pub const APPCOMMAND_REPLY_TO_MAIL: c_short = 39; +pub const APPCOMMAND_FORWARD_MAIL: c_short = 40; +pub const APPCOMMAND_SEND_MAIL: c_short = 41; +pub const APPCOMMAND_SPELL_CHECK: c_short = 42; +pub const APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE: c_short = 43; +pub const APPCOMMAND_MIC_ON_OFF_TOGGLE: c_short = 44; +pub const APPCOMMAND_CORRECTION_LIST: c_short = 45; +pub const APPCOMMAND_MEDIA_PLAY: c_short = 46; +pub const APPCOMMAND_MEDIA_PAUSE: c_short = 47; +pub const APPCOMMAND_MEDIA_RECORD: c_short = 48; +pub const APPCOMMAND_MEDIA_FAST_FORWARD: c_short = 49; +pub const APPCOMMAND_MEDIA_REWIND: c_short = 50; +pub const APPCOMMAND_MEDIA_CHANNEL_UP: c_short = 51; +pub const APPCOMMAND_MEDIA_CHANNEL_DOWN: c_short = 52; +pub const APPCOMMAND_DELETE: c_short = 53; +pub const APPCOMMAND_DWM_FLIP3D: c_short = 54; +pub const FAPPCOMMAND_MOUSE: WORD = 0x8000; +pub const FAPPCOMMAND_KEY: WORD = 0; +pub const FAPPCOMMAND_OEM: WORD = 0x1000; +pub const FAPPCOMMAND_MASK: WORD = 0xF000; +#[inline] +pub fn GET_APPCOMMAND_LPARAM(lParam: LPARAM) -> c_short { + (HIWORD(lParam as DWORD) & !FAPPCOMMAND_MASK) as c_short +} +#[inline] +pub fn GET_DEVICE_LPARAM(lParam: LPARAM) -> WORD { + HIWORD(lParam as DWORD) & FAPPCOMMAND_MASK +} +pub use self::GET_DEVICE_LPARAM as GET_MOUSEORKEY_LPARAM; +pub use shared::minwindef::LOWORD as GET_FLAGS_LPARAM; +pub use self::GET_FLAGS_LPARAM as GET_KEYSTATE_LPARAM; +STRUCT!{struct SHELLHOOKINFO { + hwnd: HWND, + rc: RECT, +}} +pub type LPSHELLHOOKINFO = *mut SHELLHOOKINFO; +STRUCT!{struct EVENTMSG { + message: UINT, + paramL: UINT, + paramH: UINT, + time: DWORD, + hwnd: HWND, +}} +pub type PEVENTMSGMSG = *mut EVENTMSG; +pub type NPEVENTMSGMSG = *mut EVENTMSG; +pub type LPEVENTMSGMSG = *mut EVENTMSG; +pub type PEVENTMSG = *mut EVENTMSG; +pub type NPEVENTMSG = *mut EVENTMSG; +pub type LPEVENTMSG = *mut EVENTMSG; +STRUCT!{struct CWPSTRUCT { + lParam: LPARAM, + wParam: WPARAM, + message: UINT, + hwnd: HWND, +}} +pub type PCWPSTRUCT = *mut CWPSTRUCT; +pub type NPCWPSTRUCT = *mut CWPSTRUCT; +pub type LPCWPSTRUCT = *mut CWPSTRUCT; +STRUCT!{struct CWPRETSTRUCT { + lResult: LRESULT, + lParam: LPARAM, + wParam: WPARAM, + message: UINT, + hwnd: HWND, +}} +pub type PCWPRETSTRUCT = *mut CWPRETSTRUCT; +pub type NPCWPRETSTRUCT = *mut CWPRETSTRUCT; +pub type LPCWPRETSTRUCT = *mut CWPRETSTRUCT; +pub const LLKHF_EXTENDED: DWORD = (KF_EXTENDED >> 8) as u32; +pub const LLKHF_INJECTED: DWORD = 0x00000010; +pub const LLKHF_ALTDOWN: DWORD = (KF_ALTDOWN >> 8) as u32; +pub const LLKHF_UP: DWORD = (KF_UP >> 8) as u32; +pub const LLKHF_LOWER_IL_INJECTED: DWORD = 0x00000002; +pub const LLMHF_INJECTED: DWORD = 0x00000001; +pub const LLMHF_LOWER_IL_INJECTED: DWORD = 0x00000002; +STRUCT!{struct KBDLLHOOKSTRUCT { + vkCode: DWORD, + scanCode: DWORD, + flags: DWORD, + time: DWORD, + dwExtraInfo: ULONG_PTR, +}} +pub type LPKBDLLHOOKSTRUCT = *mut KBDLLHOOKSTRUCT; +pub type PKBDLLHOOKSTRUCT = *mut KBDLLHOOKSTRUCT; +STRUCT!{struct MSLLHOOKSTRUCT { + pt: POINT, + mouseData: DWORD, + flags: DWORD, + time: DWORD, + dwExtraInfo: ULONG_PTR, +}} +pub type LPMSLLHOOKSTRUCT = *mut MSLLHOOKSTRUCT; +pub type PMSLLHOOKSTRUCT = *mut MSLLHOOKSTRUCT; +STRUCT!{struct DEBUGHOOKINFO { + idThread: DWORD, + idThreadInstaller: DWORD, + lParam: LPARAM, + wParam: WPARAM, + code: c_int, +}} +pub type PDEBUGHOOKINFO = *mut DEBUGHOOKINFO; +pub type NPDEBUGHOOKINFO = *mut DEBUGHOOKINFO; +pub type LPDEBUGHOOKINFO = *mut DEBUGHOOKINFO; +STRUCT!{struct MOUSEHOOKSTRUCT { + pt: POINT, + hwnd: HWND, + wHitTestCode: UINT, + dwExtraInfo: ULONG_PTR, +}} +pub type LPMOUSEHOOKSTRUCT = *mut MOUSEHOOKSTRUCT; +pub type PMOUSEHOOKSTRUCT = *mut MOUSEHOOKSTRUCT; +STRUCT!{struct MOUSEHOOKSTRUCTEX { + parent: MOUSEHOOKSTRUCT, + mouseData: DWORD, +}} +pub type LPMOUSEHOOKSTRUCTEX = *mut MOUSEHOOKSTRUCTEX; +pub type PMOUSEHOOKSTRUCTEX = *mut MOUSEHOOKSTRUCTEX; +STRUCT!{struct HARDWAREHOOKSTRUCT { + hwnd: HWND, + message: UINT, + wParam: WPARAM, + lParam: LPARAM, +}} +pub type LPHARDWAREHOOKSTRUCT = *mut HARDWAREHOOKSTRUCT; +pub type PHARDWAREHOOKSTRUCT = *mut HARDWAREHOOKSTRUCT; +pub const HKL_PREV: HKL = 0 as HKL; +pub const HKL_NEXT: HKL = 1 as HKL; +pub const KLF_ACTIVATE: UINT = 0x00000001; +pub const KLF_SUBSTITUTE_OK: UINT = 0x00000002; +pub const KLF_REORDER: UINT = 0x00000008; +pub const KLF_REPLACELANG: UINT = 0x00000010; +pub const KLF_NOTELLSHELL: UINT = 0x00000080; +pub const KLF_SETFORPROCESS: UINT = 0x00000100; +pub const KLF_SHIFTLOCK: UINT = 0x00010000; +pub const KLF_RESET: UINT = 0x40000000; +pub const INPUTLANGCHANGE_SYSCHARSET: WPARAM = 0x0001; +pub const INPUTLANGCHANGE_FORWARD: WPARAM = 0x0002; +pub const INPUTLANGCHANGE_BACKWARD: WPARAM = 0x0004; +pub const KL_NAMELENGTH: usize = 9; +extern "system" { + pub fn LoadKeyboardLayoutA( + pwszKLID: LPCSTR, + Flags: DWORD, + ) -> HKL; + pub fn LoadKeyboardLayoutW( + pwszKLID: LPCWSTR, + Flags: DWORD, + ) -> HKL; + pub fn ActivateKeyboardLayout( + hkl: HKL, + Flags: UINT, + ) -> HKL; + pub fn ToUnicodeEx( + wVirtKey: UINT, + wScanCode: UINT, + lpKeyState: *const BYTE, + pwszBuff: LPWSTR, + cchBuff: c_int, + wFlags: UINT, + dwhkl: HKL, + ) -> c_int; + pub fn UnloadKeyboardLayout( + hkl: HKL, + ) -> BOOL; + pub fn GetKeyboardLayoutNameA( + pwszKLID: LPSTR, + ) -> BOOL; + pub fn GetKeyboardLayoutNameW( + pwszKLID: LPWSTR, + ) -> BOOL; + pub fn GetKeyboardLayoutList( + nBuff: c_int, + lpList: *mut HKL, + ) -> c_int; + pub fn GetKeyboardLayout( + idThread: DWORD, + ) -> HKL; +} +STRUCT!{struct MOUSEMOVEPOINT { + x: c_int, + y: c_int, + time: DWORD, + dwExtraInfo: ULONG_PTR, +}} +pub type PMOUSEMOVEPOINT = *mut MOUSEMOVEPOINT; +pub type LPMOUSEMOVEPOINT = *mut MOUSEMOVEPOINT; +pub const GMMP_USE_DISPLAY_POINTS: DWORD = 1; +pub const GMMP_USE_HIGH_RESOLUTION_POINTS: DWORD = 2; +extern "system" { + pub fn GetMouseMovePointsEx( + cbSize: UINT, + lppt: LPMOUSEMOVEPOINT, + lpptBuf: LPMOUSEMOVEPOINT, + nBufPoints: c_int, + resolution: DWORD, + ) -> c_int; +} +pub const DESKTOP_READOBJECTS: DWORD = 0x0001; +pub const DESKTOP_CREATEWINDOW: DWORD = 0x0002; +pub const DESKTOP_CREATEMENU: DWORD = 0x0004; +pub const DESKTOP_HOOKCONTROL: DWORD = 0x0008; +pub const DESKTOP_JOURNALRECORD: DWORD = 0x0010; +pub const DESKTOP_JOURNALPLAYBACK: DWORD = 0x0020; +pub const DESKTOP_ENUMERATE: DWORD = 0x0040; +pub const DESKTOP_WRITEOBJECTS: DWORD = 0x0080; +pub const DESKTOP_SWITCHDESKTOP: DWORD = 0x0100; +pub const DF_ALLOWOTHERACCOUNTHOOK: DWORD = 0x0001; +extern "system" { + pub fn CreateDesktopA( + lpszDesktop: LPCSTR, + lpszDevice: LPCSTR, + pDevmode: *mut DEVMODEA, + dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, + lpsa: LPSECURITY_ATTRIBUTES, + ) -> HDESK; + pub fn CreateDesktopW( + lpszDesktop: LPCWSTR, + lpszDevice: LPCWSTR, + pDevmode: *mut DEVMODEW, + dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, + lpsa: LPSECURITY_ATTRIBUTES, + ) -> HDESK; + pub fn CreateDesktopExA( + lpszDesktop: LPCSTR, + lpszDevice: LPCSTR, + pDevmode: *mut DEVMODEA, + dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, + lpsa: LPSECURITY_ATTRIBUTES, + ulHeapSize: ULONG, + pvoid: PVOID, + ) -> HDESK; + pub fn CreateDesktopExW( + lpszDesktop: LPCWSTR, + lpszDevice: LPCWSTR, + pDevmode: *mut DEVMODEW, + dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, + lpsa: LPSECURITY_ATTRIBUTES, + ulHeapSize: ULONG, + pvoid: PVOID, + ) -> HDESK; + pub fn OpenDesktopA( + lpszDesktop: LPCSTR, + dwFlags: DWORD, + fInherit: BOOL, + dwDesiredAccess: ACCESS_MASK, + ) -> HDESK; + pub fn OpenDesktopW( + lpszDesktop: LPCWSTR, + dwFlags: DWORD, + fInherit: BOOL, + dwDesiredAccess: ACCESS_MASK, + ) -> HDESK; + pub fn OpenInputDesktop( + dwFlags: DWORD, + fInherit: BOOL, + dwDesiredAccess: ACCESS_MASK, + ) -> HDESK; + pub fn EnumDesktopsA( + hwinsta: HWINSTA, + lpEnumFunc: DESKTOPENUMPROCA, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumDesktopsW( + hwinsta: HWINSTA, + lpEnumFunc: DESKTOPENUMPROCW, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumDesktopWindows( + hDesktop: HDESK, + lpfn: WNDENUMPROC, + lParam: LPARAM, + ) -> BOOL; + pub fn SwitchDesktop( + hDesktop: HDESK, + ) -> BOOL; + pub fn SetThreadDesktop( + hDesktop: HDESK, + ) -> BOOL; + pub fn CloseDesktop( + hDesktop: HDESK, + ) -> BOOL; + pub fn GetThreadDesktop( + dwThreadId: DWORD, + ) -> HDESK; +} +pub const WINSTA_ENUMDESKTOPS: DWORD = 0x0001; +pub const WINSTA_READATTRIBUTES: DWORD = 0x0002; +pub const WINSTA_ACCESSCLIPBOARD: DWORD = 0x0004; +pub const WINSTA_CREATEDESKTOP: DWORD = 0x0008; +pub const WINSTA_WRITEATTRIBUTES: DWORD = 0x0010; +pub const WINSTA_ACCESSGLOBALATOMS: DWORD = 0x0020; +pub const WINSTA_EXITWINDOWS: DWORD = 0x0040; +pub const WINSTA_ENUMERATE: DWORD = 0x0100; +pub const WINSTA_READSCREEN: DWORD = 0x0200; +pub const WINSTA_ALL_ACCESS: DWORD = WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES + | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES + | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS | WINSTA_ENUMERATE | WINSTA_READSCREEN; +pub const CWF_CREATE_ONLY: DWORD = 0x00000001; +pub const WSF_VISIBLE: DWORD = 0x0001; +extern "system" { + pub fn CreateWindowStationA( + lpwinsta: LPCSTR, + dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, + lpsa: LPSECURITY_ATTRIBUTES, + ) -> HWINSTA; + pub fn CreateWindowStationW( + lpwinsta: LPCWSTR, + dwFlags: DWORD, + dwDesiredAccess: ACCESS_MASK, + lpsa: LPSECURITY_ATTRIBUTES, + ) -> HWINSTA; + pub fn OpenWindowStationA( + lpszWinSta: LPCSTR, + fInherit: BOOL, + dwDesiredAccess: ACCESS_MASK, + ) -> HWINSTA; + pub fn OpenWindowStationW( + lpszWinSta: LPCWSTR, + fInherit: BOOL, + dwDesiredAccess: ACCESS_MASK, + ) -> HWINSTA; + pub fn EnumWindowStationsA( + lpEnumFunc: WINSTAENUMPROCA, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumWindowStationsW( + lpEnumFunc: WINSTAENUMPROCW, + lParam: LPARAM, + ) -> BOOL; + pub fn CloseWindowStation( + hWinSta: HWINSTA, + ) -> BOOL; + pub fn SetProcessWindowStation( + hWinSta: HWINSTA, + ) -> BOOL; + pub fn GetProcessWindowStation( + ) -> HWINSTA; + pub fn SetUserObjectSecurity( + hObj: HANDLE, + pSIRequested: PSECURITY_INFORMATION, + pSID: PSECURITY_DESCRIPTOR, + ) -> BOOL; + pub fn GetUserObjectSecurity( + hObj: HANDLE, + pSIRequested: PSECURITY_INFORMATION, + pSID: PSECURITY_DESCRIPTOR, + nLength: DWORD, + lpnLengthNeeded: LPDWORD, + ) -> BOOL; +} +pub const UOI_FLAGS: DWORD = 1; +pub const UOI_NAME: DWORD = 2; +pub const UOI_TYPE: DWORD = 3; +pub const UOI_USER_SID: DWORD = 4; +pub const UOI_HEAPSIZE: DWORD = 5; +pub const UOI_IO: DWORD = 6; +pub const UOI_TIMERPROC_EXCEPTION_SUPPRESSION: DWORD = 7; +STRUCT!{struct USEROBJECTFLAGS { + fInherit: BOOL, + fReserved: BOOL, + dwFlags: DWORD, +}} +pub type PUSEROBJECTFLAGS = *mut USEROBJECTFLAGS; +extern "system" { + pub fn GetUserObjectInformationA( + hObj: HANDLE, + nIndex: c_int, + pvInfo: PVOID, + nLength: DWORD, + lpnLengthNeeded: LPDWORD, + ) -> BOOL; + pub fn GetUserObjectInformationW( + hObj: HANDLE, + nIndex: c_int, + pvInfo: PVOID, + nLength: DWORD, + lpnLengthNeeded: LPDWORD, + ) -> BOOL; + pub fn SetUserObjectInformationA( + hObj: HANDLE, + nIndex: c_int, + pvInfo: PVOID, + nLength: DWORD, + ) -> BOOL; + pub fn SetUserObjectInformationW( + hObj: HANDLE, + nIndex: c_int, + pvInfo: PVOID, + nLength: DWORD, + ) -> BOOL; +} +STRUCT!{struct WNDCLASSEXA { + cbSize: UINT, + style: UINT, + lpfnWndProc: WNDPROC, + cbClsExtra: c_int, + cbWndExtra: c_int, + hInstance: HINSTANCE, + hIcon: HICON, + hCursor: HCURSOR, + hbrBackground: HBRUSH, + lpszMenuName: LPCSTR, + lpszClassName: LPCSTR, + hIconSm: HICON, +}} +pub type PWNDCLASSEXA = *mut WNDCLASSEXA; +pub type NPWNDCLASSEXA = *mut WNDCLASSEXA; +pub type LPWNDCLASSEXA = *mut WNDCLASSEXA; +STRUCT!{struct WNDCLASSEXW { + cbSize: UINT, + style: UINT, + lpfnWndProc: WNDPROC, + cbClsExtra: c_int, + cbWndExtra: c_int, + hInstance: HINSTANCE, + hIcon: HICON, + hCursor: HCURSOR, + hbrBackground: HBRUSH, + lpszMenuName: LPCWSTR, + lpszClassName: LPCWSTR, + hIconSm: HICON, +}} +pub type PWNDCLASSEXW = *mut WNDCLASSEXW; +pub type NPWNDCLASSEXW = *mut WNDCLASSEXW; +pub type LPWNDCLASSEXW = *mut WNDCLASSEXW; +STRUCT!{struct WNDCLASSA { + style: UINT, + lpfnWndProc: WNDPROC, + cbClsExtra: c_int, + cbWndExtra: c_int, + hInstance: HINSTANCE, + hIcon: HICON, + hCursor: HCURSOR, + hbrBackground: HBRUSH, + lpszMenuName: LPCSTR, + lpszClassName: LPCSTR, +}} +pub type PWNDCLASSA = *mut WNDCLASSA; +pub type NPWNDCLASSA = *mut WNDCLASSA; +pub type LPWNDCLASSA = *mut WNDCLASSA; +STRUCT!{struct WNDCLASSW { + style: UINT, + lpfnWndProc: WNDPROC, + cbClsExtra: c_int, + cbWndExtra: c_int, + hInstance: HINSTANCE, + hIcon: HICON, + hCursor: HCURSOR, + hbrBackground: HBRUSH, + lpszMenuName: LPCWSTR, + lpszClassName: LPCWSTR, +}} +pub type PWNDCLASSW = *mut WNDCLASSW; +pub type NPWNDCLASSW = *mut WNDCLASSW; +pub type LPWNDCLASSW = *mut WNDCLASSW; +extern "system" { + pub fn IsHungAppWindow( + hwnd: HWND, + ) -> BOOL; + pub fn DisableProcessWindowsGhosting(); +} +STRUCT!{struct MSG { + hwnd: HWND, + message: UINT, + wParam: WPARAM, + lParam: LPARAM, + time: DWORD, + pt: POINT, +}} +pub type PMSG = *mut MSG; +pub type NPMSG = *mut MSG; +pub type LPMSG = *mut MSG; +//POINTSTOPOINT +//POINTTOPOINTS +//MAKEWPARAM +//MAKELPARAM +//MAKELRESULT +pub const GWL_WNDPROC: c_int = -4; +pub const GWL_HINSTANCE: c_int = -6; +pub const GWL_HWNDPARENT: c_int = -8; +pub const GWL_STYLE: c_int = -16; +pub const GWL_EXSTYLE: c_int = -20; +pub const GWL_USERDATA: c_int = -21; +pub const GWL_ID: c_int = -12; +pub const GWLP_WNDPROC: c_int = -4; +pub const GWLP_HINSTANCE: c_int = -6; +pub const GWLP_HWNDPARENT: c_int = -8; +pub const GWLP_USERDATA: c_int = -21; +pub const GWLP_ID: c_int = -12; +pub const GCL_MENUNAME: c_int = -8; +pub const GCL_HBRBACKGROUND: c_int = -10; +pub const GCL_HCURSOR: c_int = -12; +pub const GCL_HICON: c_int = -14; +pub const GCL_HMODULE: c_int = -16; +pub const GCL_CBWNDEXTRA: c_int = -18; +pub const GCL_CBCLSEXTRA: c_int = -20; +pub const GCL_WNDPROC: c_int = -24; +pub const GCL_STYLE: c_int = -26; +pub const GCW_ATOM: c_int = -32; +pub const GCL_HICONSM: c_int = -34; +pub const GCLP_MENUNAME: c_int = -8; +pub const GCLP_HBRBACKGROUND: c_int = -10; +pub const GCLP_HCURSOR: c_int = -12; +pub const GCLP_HICON: c_int = -14; +pub const GCLP_HMODULE: c_int = -16; +pub const GCLP_WNDPROC: c_int = -24; +pub const GCLP_HICONSM: c_int = -34; +pub const WM_NULL: UINT = 0x0000; +pub const WM_CREATE: UINT = 0x0001; +pub const WM_DESTROY: UINT = 0x0002; +pub const WM_MOVE: UINT = 0x0003; +pub const WM_SIZE: UINT = 0x0005; +pub const WM_ACTIVATE: UINT = 0x0006; +pub const WA_INACTIVE: WORD = 0; +pub const WA_ACTIVE: WORD = 1; +pub const WA_CLICKACTIVE: WORD = 2; +pub const WM_SETFOCUS: UINT = 0x0007; +pub const WM_KILLFOCUS: UINT = 0x0008; +pub const WM_ENABLE: UINT = 0x000A; +pub const WM_SETREDRAW: UINT = 0x000B; +pub const WM_SETTEXT: UINT = 0x000C; +pub const WM_GETTEXT: UINT = 0x000D; +pub const WM_GETTEXTLENGTH: UINT = 0x000E; +pub const WM_PAINT: UINT = 0x000F; +pub const WM_CLOSE: UINT = 0x0010; +pub const WM_QUERYENDSESSION: UINT = 0x0011; +pub const WM_QUERYOPEN: UINT = 0x0013; +pub const WM_ENDSESSION: UINT = 0x0016; +pub const WM_QUIT: UINT = 0x0012; +pub const WM_ERASEBKGND: UINT = 0x0014; +pub const WM_SYSCOLORCHANGE: UINT = 0x0015; +pub const WM_SHOWWINDOW: UINT = 0x0018; +pub const WM_WININICHANGE: UINT = 0x001A; +pub const WM_SETTINGCHANGE: UINT = WM_WININICHANGE; +pub const WM_DEVMODECHANGE: UINT = 0x001B; +pub const WM_ACTIVATEAPP: UINT = 0x001C; +pub const WM_FONTCHANGE: UINT = 0x001D; +pub const WM_TIMECHANGE: UINT = 0x001E; +pub const WM_CANCELMODE: UINT = 0x001F; +pub const WM_SETCURSOR: UINT = 0x0020; +pub const WM_MOUSEACTIVATE: UINT = 0x0021; +pub const WM_CHILDACTIVATE: UINT = 0x0022; +pub const WM_QUEUESYNC: UINT = 0x0023; +pub const WM_GETMINMAXINFO: UINT = 0x0024; +STRUCT!{struct MINMAXINFO { + ptReserved: POINT, + ptMaxSize: POINT, + ptMaxPosition: POINT, + ptMinTrackSize: POINT, + ptMaxTrackSize: POINT, +}} +pub type PMINMAXINFO = *mut MINMAXINFO; +pub type LPMINMAXINFO = *mut MINMAXINFO; +pub const WM_PAINTICON: UINT = 0x0026; +pub const WM_ICONERASEBKGND: UINT = 0x0027; +pub const WM_NEXTDLGCTL: UINT = 0x0028; +pub const WM_SPOOLERSTATUS: UINT = 0x002A; +pub const WM_DRAWITEM: UINT = 0x002B; +pub const WM_MEASUREITEM: UINT = 0x002C; +pub const WM_DELETEITEM: UINT = 0x002D; +pub const WM_VKEYTOITEM: UINT = 0x002E; +pub const WM_CHARTOITEM: UINT = 0x002F; +pub const WM_SETFONT: UINT = 0x0030; +pub const WM_GETFONT: UINT = 0x0031; +pub const WM_SETHOTKEY: UINT = 0x0032; +pub const WM_GETHOTKEY: UINT = 0x0033; +pub const WM_QUERYDRAGICON: UINT = 0x0037; +pub const WM_COMPAREITEM: UINT = 0x0039; +pub const WM_GETOBJECT: UINT = 0x003D; +pub const WM_COMPACTING: UINT = 0x0041; +pub const WM_COMMNOTIFY: UINT = 0x0044; +pub const WM_WINDOWPOSCHANGING: UINT = 0x0046; +pub const WM_WINDOWPOSCHANGED: UINT = 0x0047; +pub const WM_POWER: UINT = 0x0048; +pub const PWR_OK: WPARAM = 1; +pub const PWR_FAIL: WPARAM = -1isize as usize; +pub const PWR_SUSPENDREQUEST: WPARAM = 1; +pub const PWR_SUSPENDRESUME: WPARAM = 2; +pub const PWR_CRITICALRESUME: WPARAM = 3; +pub const WM_COPYDATA: UINT = 0x004A; +pub const WM_CANCELJOURNAL: UINT = 0x004B; +STRUCT!{struct COPYDATASTRUCT { + dwData: ULONG_PTR, + cbData: DWORD, + lpData: PVOID, +}} +pub type PCOPYDATASTRUCT = *mut COPYDATASTRUCT; +STRUCT!{struct MDINEXTMENU { + hmenuIn: HMENU, + hmenuNext: HMENU, + hwndNext: HWND, +}} +pub type PMDINEXTMENU = *mut MDINEXTMENU; +pub type LPMDINEXTMENU = *mut MDINEXTMENU; +pub const WM_NOTIFY: UINT = 0x004E; +pub const WM_INPUTLANGCHANGEREQUEST: UINT = 0x0050; +pub const WM_INPUTLANGCHANGE: UINT = 0x0051; +pub const WM_TCARD: UINT = 0x0052; +pub const WM_HELP: UINT = 0x0053; +pub const WM_USERCHANGED: UINT = 0x0054; +pub const WM_NOTIFYFORMAT: UINT = 0x0055; +pub const NFR_ANSI: LRESULT = 1; +pub const NFR_UNICODE: LRESULT = 2; +pub const NF_QUERY: LPARAM = 3; +pub const NF_REQUERY: LPARAM = 4; +pub const WM_CONTEXTMENU: UINT = 0x007B; +pub const WM_STYLECHANGING: UINT = 0x007C; +pub const WM_STYLECHANGED: UINT = 0x007D; +pub const WM_DISPLAYCHANGE: UINT = 0x007E; +pub const WM_GETICON: UINT = 0x007F; +pub const WM_SETICON: UINT = 0x0080; +pub const WM_NCCREATE: UINT = 0x0081; +pub const WM_NCDESTROY: UINT = 0x0082; +pub const WM_NCCALCSIZE: UINT = 0x0083; +pub const WM_NCHITTEST: UINT = 0x0084; +pub const WM_NCPAINT: UINT = 0x0085; +pub const WM_NCACTIVATE: UINT = 0x0086; +pub const WM_GETDLGCODE: UINT = 0x0087; +pub const WM_SYNCPAINT: UINT = 0x0088; +pub const WM_NCMOUSEMOVE: UINT = 0x00A0; +pub const WM_NCLBUTTONDOWN: UINT = 0x00A1; +pub const WM_NCLBUTTONUP: UINT = 0x00A2; +pub const WM_NCLBUTTONDBLCLK: UINT = 0x00A3; +pub const WM_NCRBUTTONDOWN: UINT = 0x00A4; +pub const WM_NCRBUTTONUP: UINT = 0x00A5; +pub const WM_NCRBUTTONDBLCLK: UINT = 0x00A6; +pub const WM_NCMBUTTONDOWN: UINT = 0x00A7; +pub const WM_NCMBUTTONUP: UINT = 0x00A8; +pub const WM_NCMBUTTONDBLCLK: UINT = 0x00A9; +pub const WM_NCXBUTTONDOWN: UINT = 0x00AB; +pub const WM_NCXBUTTONUP: UINT = 0x00AC; +pub const WM_NCXBUTTONDBLCLK: UINT = 0x00AD; +pub const WM_INPUT_DEVICE_CHANGE: UINT = 0x00FE; +pub const WM_INPUT: UINT = 0x00FF; +pub const WM_KEYFIRST: UINT = 0x0100; +pub const WM_KEYDOWN: UINT = 0x0100; +pub const WM_KEYUP: UINT = 0x0101; +pub const WM_CHAR: UINT = 0x0102; +pub const WM_DEADCHAR: UINT = 0x0103; +pub const WM_SYSKEYDOWN: UINT = 0x0104; +pub const WM_SYSKEYUP: UINT = 0x0105; +pub const WM_SYSCHAR: UINT = 0x0106; +pub const WM_SYSDEADCHAR: UINT = 0x0107; +pub const WM_UNICHAR: UINT = 0x0109; +pub const WM_KEYLAST: UINT = 0x0109; +pub const UNICODE_NOCHAR: WPARAM = 0xFFFF; +pub const WM_IME_STARTCOMPOSITION: UINT = 0x010D; +pub const WM_IME_ENDCOMPOSITION: UINT = 0x010E; +pub const WM_IME_COMPOSITION: UINT = 0x010F; +pub const WM_IME_KEYLAST: UINT = 0x010F; +pub const WM_INITDIALOG: UINT = 0x0110; +pub const WM_COMMAND: UINT = 0x0111; +pub const WM_SYSCOMMAND: UINT = 0x0112; +pub const WM_TIMER: UINT = 0x0113; +pub const WM_HSCROLL: UINT = 0x0114; +pub const WM_VSCROLL: UINT = 0x0115; +pub const WM_INITMENU: UINT = 0x0116; +pub const WM_INITMENUPOPUP: UINT = 0x0117; +pub const WM_GESTURE: UINT = 0x0119; +pub const WM_GESTURENOTIFY: UINT = 0x011A; +pub const WM_MENUSELECT: UINT = 0x011F; +pub const WM_MENUCHAR: UINT = 0x0120; +pub const WM_ENTERIDLE: UINT = 0x0121; +pub const WM_MENURBUTTONUP: UINT = 0x0122; +pub const WM_MENUDRAG: UINT = 0x0123; +pub const WM_MENUGETOBJECT: UINT = 0x0124; +pub const WM_UNINITMENUPOPUP: UINT = 0x0125; +pub const WM_MENUCOMMAND: UINT = 0x0126; +pub const WM_CHANGEUISTATE: UINT = 0x0127; +pub const WM_UPDATEUISTATE: UINT = 0x0128; +pub const WM_QUERYUISTATE: UINT = 0x0129; +pub const UIS_SET: WORD = 1; +pub const UIS_CLEAR: WORD = 2; +pub const UIS_INITIALIZE: WORD = 3; +pub const UISF_HIDEFOCUS: WORD = 0x1; +pub const UISF_HIDEACCEL: WORD = 0x2; +pub const UISF_ACTIVE: WORD = 0x4; +pub const WM_CTLCOLORMSGBOX: UINT = 0x0132; +pub const WM_CTLCOLOREDIT: UINT = 0x0133; +pub const WM_CTLCOLORLISTBOX: UINT = 0x0134; +pub const WM_CTLCOLORBTN: UINT = 0x0135; +pub const WM_CTLCOLORDLG: UINT = 0x0136; +pub const WM_CTLCOLORSCROLLBAR: UINT = 0x0137; +pub const WM_CTLCOLORSTATIC: UINT = 0x0138; +pub const MN_GETHMENU: UINT = 0x01E1; +pub const WM_MOUSEFIRST: UINT = 0x0200; +pub const WM_MOUSEMOVE: UINT = 0x0200; +pub const WM_LBUTTONDOWN: UINT = 0x0201; +pub const WM_LBUTTONUP: UINT = 0x0202; +pub const WM_LBUTTONDBLCLK: UINT = 0x0203; +pub const WM_RBUTTONDOWN: UINT = 0x0204; +pub const WM_RBUTTONUP: UINT = 0x0205; +pub const WM_RBUTTONDBLCLK: UINT = 0x0206; +pub const WM_MBUTTONDOWN: UINT = 0x0207; +pub const WM_MBUTTONUP: UINT = 0x0208; +pub const WM_MBUTTONDBLCLK: UINT = 0x0209; +pub const WM_MOUSEWHEEL: UINT = 0x020A; +pub const WM_XBUTTONDOWN: UINT = 0x020B; +pub const WM_XBUTTONUP: UINT = 0x020C; +pub const WM_XBUTTONDBLCLK: UINT = 0x020D; +pub const WM_MOUSEHWHEEL: UINT = 0x020E; +pub const WM_MOUSELAST: UINT = 0x020E; +pub const WHEEL_DELTA: c_short = 120; +#[inline] +pub fn GET_WHEEL_DELTA_WPARAM(wParam: WPARAM) -> c_short { + HIWORD(wParam as DWORD) as c_short +} +pub const WHEEL_PAGESCROLL: UINT = UINT_MAX; +#[inline] +pub fn GET_KEYSTATE_WPARAM(wParam: WPARAM) -> WORD { + LOWORD(wParam as DWORD) +} +#[inline] +pub fn GET_NCHITTEST_WPARAM(wParam: WPARAM) -> c_short { + LOWORD(wParam as DWORD) as c_short +} +#[inline] +pub fn GET_XBUTTON_WPARAM(wParam: WPARAM) -> WORD { + HIWORD(wParam as DWORD) +} +pub const XBUTTON1: WORD = 0x0001; +pub const XBUTTON2: WORD = 0x0002; +pub const WM_PARENTNOTIFY: UINT = 0x0210; +pub const WM_ENTERMENULOOP: UINT = 0x0211; +pub const WM_EXITMENULOOP: UINT = 0x0212; +pub const WM_NEXTMENU: UINT = 0x0213; +pub const WM_SIZING: UINT = 0x0214; +pub const WM_CAPTURECHANGED: UINT = 0x0215; +pub const WM_MOVING: UINT = 0x0216; +pub const WM_POWERBROADCAST: UINT = 0x0218; +pub const PBT_APMQUERYSUSPEND: WPARAM = 0x0000; +pub const PBT_APMQUERYSTANDBY: WPARAM = 0x0001; +pub const PBT_APMQUERYSUSPENDFAILED: WPARAM = 0x0002; +pub const PBT_APMQUERYSTANDBYFAILED: WPARAM = 0x0003; +pub const PBT_APMSUSPEND: WPARAM = 0x0004; +pub const PBT_APMSTANDBY: WPARAM = 0x0005; +pub const PBT_APMRESUMECRITICAL: WPARAM = 0x0006; +pub const PBT_APMRESUMESUSPEND: WPARAM = 0x0007; +pub const PBT_APMRESUMESTANDBY: WPARAM = 0x0008; +pub const PBTF_APMRESUMEFROMFAILURE: LPARAM = 0x00000001; +pub const PBT_APMBATTERYLOW: WPARAM = 0x0009; +pub const PBT_APMPOWERSTATUSCHANGE: WPARAM = 0x000A; +pub const PBT_APMOEMEVENT: WPARAM = 0x000B; +pub const PBT_APMRESUMEAUTOMATIC: WPARAM = 0x0012; +pub const PBT_POWERSETTINGCHANGE: WPARAM = 0x8013; +STRUCT!{struct POWERBROADCAST_SETTING { + PowerSetting: GUID, + DataLength: DWORD, + Data: [UCHAR; 1], +}} +pub type PPOWERBROADCAST_SETTING = *mut POWERBROADCAST_SETTING; +pub const WM_DEVICECHANGE: UINT = 0x0219; +pub const WM_MDICREATE: UINT = 0x0220; +pub const WM_MDIDESTROY: UINT = 0x0221; +pub const WM_MDIACTIVATE: UINT = 0x0222; +pub const WM_MDIRESTORE: UINT = 0x0223; +pub const WM_MDINEXT: UINT = 0x0224; +pub const WM_MDIMAXIMIZE: UINT = 0x0225; +pub const WM_MDITILE: UINT = 0x0226; +pub const WM_MDICASCADE: UINT = 0x0227; +pub const WM_MDIICONARRANGE: UINT = 0x0228; +pub const WM_MDIGETACTIVE: UINT = 0x0229; +pub const WM_MDISETMENU: UINT = 0x0230; +pub const WM_ENTERSIZEMOVE: UINT = 0x0231; +pub const WM_EXITSIZEMOVE: UINT = 0x0232; +pub const WM_DROPFILES: UINT = 0x0233; +pub const WM_MDIREFRESHMENU: UINT = 0x0234; +pub const WM_POINTERDEVICECHANGE: UINT = 0x238; +pub const WM_POINTERDEVICEINRANGE: UINT = 0x239; +pub const WM_POINTERDEVICEOUTOFRANGE: UINT = 0x23A; +pub const WM_TOUCH: UINT = 0x0240; +pub const WM_NCPOINTERUPDATE: UINT = 0x0241; +pub const WM_NCPOINTERDOWN: UINT = 0x0242; +pub const WM_NCPOINTERUP: UINT = 0x0243; +pub const WM_POINTERUPDATE: UINT = 0x0245; +pub const WM_POINTERDOWN: UINT = 0x0246; +pub const WM_POINTERUP: UINT = 0x0247; +pub const WM_POINTERENTER: UINT = 0x0249; +pub const WM_POINTERLEAVE: UINT = 0x024A; +pub const WM_POINTERACTIVATE: UINT = 0x024B; +pub const WM_POINTERCAPTURECHANGED: UINT = 0x024C; +pub const WM_TOUCHHITTESTING: UINT = 0x024D; +pub const WM_POINTERWHEEL: UINT = 0x024E; +pub const WM_POINTERHWHEEL: UINT = 0x024F; +pub const DM_POINTERHITTEST: UINT = 0x0250; +pub const WM_POINTERROUTEDTO: UINT = 0x0251; +pub const WM_POINTERROUTEDAWAY: UINT = 0x0252; +pub const WM_POINTERROUTEDRELEASED: UINT = 0x0253; +pub const WM_IME_SETCONTEXT: UINT = 0x0281; +pub const WM_IME_NOTIFY: UINT = 0x0282; +pub const WM_IME_CONTROL: UINT = 0x0283; +pub const WM_IME_COMPOSITIONFULL: UINT = 0x0284; +pub const WM_IME_SELECT: UINT = 0x0285; +pub const WM_IME_CHAR: UINT = 0x0286; +pub const WM_IME_REQUEST: UINT = 0x0288; +pub const WM_IME_KEYDOWN: UINT = 0x0290; +pub const WM_IME_KEYUP: UINT = 0x0291; +pub const WM_MOUSEHOVER: UINT = 0x02A1; +pub const WM_MOUSELEAVE: UINT = 0x02A3; +pub const WM_NCMOUSEHOVER: UINT = 0x02A0; +pub const WM_NCMOUSELEAVE: UINT = 0x02A2; +pub const WM_WTSSESSION_CHANGE: UINT = 0x02B1; +pub const WM_TABLET_FIRST: UINT = 0x02c0; +pub const WM_TABLET_LAST: UINT = 0x02df; +pub const WM_DPICHANGED: UINT = 0x02E0; +pub const WM_CUT: UINT = 0x0300; +pub const WM_COPY: UINT = 0x0301; +pub const WM_PASTE: UINT = 0x0302; +pub const WM_CLEAR: UINT = 0x0303; +pub const WM_UNDO: UINT = 0x0304; +pub const WM_RENDERFORMAT: UINT = 0x0305; +pub const WM_RENDERALLFORMATS: UINT = 0x0306; +pub const WM_DESTROYCLIPBOARD: UINT = 0x0307; +pub const WM_DRAWCLIPBOARD: UINT = 0x0308; +pub const WM_PAINTCLIPBOARD: UINT = 0x0309; +pub const WM_VSCROLLCLIPBOARD: UINT = 0x030A; +pub const WM_SIZECLIPBOARD: UINT = 0x030B; +pub const WM_ASKCBFORMATNAME: UINT = 0x030C; +pub const WM_CHANGECBCHAIN: UINT = 0x030D; +pub const WM_HSCROLLCLIPBOARD: UINT = 0x030E; +pub const WM_QUERYNEWPALETTE: UINT = 0x030F; +pub const WM_PALETTEISCHANGING: UINT = 0x0310; +pub const WM_PALETTECHANGED: UINT = 0x0311; +pub const WM_HOTKEY: UINT = 0x0312; +pub const WM_PRINT: UINT = 0x0317; +pub const WM_PRINTCLIENT: UINT = 0x0318; +pub const WM_APPCOMMAND: UINT = 0x0319; +pub const WM_THEMECHANGED: UINT = 0x031A; +pub const WM_CLIPBOARDUPDATE: UINT = 0x031D; +pub const WM_DWMCOMPOSITIONCHANGED: UINT = 0x031E; +pub const WM_DWMNCRENDERINGCHANGED: UINT = 0x031F; +pub const WM_DWMCOLORIZATIONCOLORCHANGED: UINT = 0x0320; +pub const WM_DWMWINDOWMAXIMIZEDCHANGE: UINT = 0x0321; +pub const WM_DWMSENDICONICTHUMBNAIL: UINT = 0x0323; +pub const WM_DWMSENDICONICLIVEPREVIEWBITMAP: UINT = 0x0326; +pub const WM_GETTITLEBARINFOEX: UINT = 0x033F; +pub const WM_HANDHELDFIRST: UINT = 0x0358; +pub const WM_HANDHELDLAST: UINT = 0x035F; +pub const WM_AFXFIRST: UINT = 0x0360; +pub const WM_AFXLAST: UINT = 0x037F; +pub const WM_PENWINFIRST: UINT = 0x0380; +pub const WM_PENWINLAST: UINT = 0x038F; +pub const WM_APP: UINT = 0x8000; +pub const WM_USER: UINT = 0x0400; +pub const WMSZ_LEFT: UINT = 1; +pub const WMSZ_RIGHT: UINT = 2; +pub const WMSZ_TOP: UINT = 3; +pub const WMSZ_TOPLEFT: UINT = 4; +pub const WMSZ_TOPRIGHT: UINT = 5; +pub const WMSZ_BOTTOM: UINT = 6; +pub const WMSZ_BOTTOMLEFT: UINT = 7; +pub const WMSZ_BOTTOMRIGHT: UINT = 8; +pub const HTERROR: LRESULT = (-2); +pub const HTTRANSPARENT: LRESULT = (-1); +pub const HTNOWHERE: LRESULT = 0; +pub const HTCLIENT: LRESULT = 1; +pub const HTCAPTION: LRESULT = 2; +pub const HTSYSMENU: LRESULT = 3; +pub const HTGROWBOX: LRESULT = 4; +pub const HTSIZE: LRESULT = HTGROWBOX; +pub const HTMENU: LRESULT = 5; +pub const HTHSCROLL: LRESULT = 6; +pub const HTVSCROLL: LRESULT = 7; +pub const HTMINBUTTON: LRESULT = 8; +pub const HTMAXBUTTON: LRESULT = 9; +pub const HTLEFT: LRESULT = 10; +pub const HTRIGHT: LRESULT = 11; +pub const HTTOP: LRESULT = 12; +pub const HTTOPLEFT: LRESULT = 13; +pub const HTTOPRIGHT: LRESULT = 14; +pub const HTBOTTOM: LRESULT = 15; +pub const HTBOTTOMLEFT: LRESULT = 16; +pub const HTBOTTOMRIGHT: LRESULT = 17; +pub const HTBORDER: LRESULT = 18; +pub const HTREDUCE: LRESULT = HTMINBUTTON; +pub const HTZOOM: LRESULT = HTMAXBUTTON; +pub const HTSIZEFIRST: LRESULT = HTLEFT; +pub const HTSIZELAST: LRESULT = HTBOTTOMRIGHT; +pub const HTOBJECT: LRESULT = 19; +pub const HTCLOSE: LRESULT = 20; +pub const HTHELP: LRESULT = 21; +pub const SMTO_NORMAL: UINT = 0x0000; +pub const SMTO_BLOCK: UINT = 0x0001; +pub const SMTO_ABORTIFHUNG: UINT = 0x0002; +pub const SMTO_NOTIMEOUTIFNOTHUNG: UINT = 0x0008; +pub const SMTO_ERRORONEXIT: UINT = 0x0020; +pub const MA_ACTIVATE: UINT = 1; +pub const MA_ACTIVATEANDEAT: UINT = 2; +pub const MA_NOACTIVATE: UINT = 3; +pub const MA_NOACTIVATEANDEAT: UINT = 4; +pub const ICON_SMALL: UINT = 0; +pub const ICON_BIG: UINT = 1; +pub const ICON_SMALL2: UINT = 2; +extern "system" { + pub fn RegisterWindowMessageA( + lpString: LPCSTR, + ) -> UINT; + pub fn RegisterWindowMessageW( + lpString: LPCWSTR, + ) -> UINT; +} +pub const SIZE_RESTORED: WPARAM = 0; +pub const SIZE_MINIMIZED: WPARAM = 1; +pub const SIZE_MAXIMIZED: WPARAM = 2; +pub const SIZE_MAXSHOW: WPARAM = 3; +pub const SIZE_MAXHIDE: WPARAM = 4; +pub const SIZENORMAL: WPARAM = SIZE_RESTORED; +pub const SIZEICONIC: WPARAM = SIZE_MINIMIZED; +pub const SIZEFULLSCREEN: WPARAM = SIZE_MAXIMIZED; +pub const SIZEZOOMSHOW: WPARAM = SIZE_MAXSHOW; +pub const SIZEZOOMHIDE: WPARAM = SIZE_MAXHIDE; +STRUCT!{struct WINDOWPOS { + hwnd: HWND, + hwndInsertAfter: HWND, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + flags: UINT, +}} +pub type LPWINDOWPOS = *mut WINDOWPOS; +pub type PWINDOWPOS = *mut WINDOWPOS; +STRUCT!{struct NCCALCSIZE_PARAMS { + rgrc: [RECT; 3], + lppos: PWINDOWPOS, +}} +pub type LPNCCALCSIZE_PARAMS = *mut NCCALCSIZE_PARAMS; +pub const WVR_ALIGNTOP: LRESULT = 0x0010; +pub const WVR_ALIGNLEFT: LRESULT = 0x0020; +pub const WVR_ALIGNBOTTOM: LRESULT = 0x0040; +pub const WVR_ALIGNRIGHT: LRESULT = 0x0080; +pub const WVR_HREDRAW: LRESULT = 0x0100; +pub const WVR_VREDRAW: LRESULT = 0x0200; +pub const WVR_REDRAW: LRESULT = WVR_HREDRAW | WVR_VREDRAW; +pub const WVR_VALIDRECTS: LRESULT = 0x0400; +pub const MK_LBUTTON: WPARAM = 0x0001; +pub const MK_RBUTTON: WPARAM = 0x0002; +pub const MK_SHIFT: WPARAM = 0x0004; +pub const MK_CONTROL: WPARAM = 0x0008; +pub const MK_MBUTTON: WPARAM = 0x0010; +pub const MK_XBUTTON1: WPARAM = 0x0020; +pub const MK_XBUTTON2: WPARAM = 0x0040; +pub const TME_HOVER: DWORD = 0x00000001; +pub const TME_LEAVE: DWORD = 0x00000002; +pub const TME_NONCLIENT: DWORD = 0x00000010; +pub const TME_QUERY: DWORD = 0x40000000; +pub const TME_CANCEL: DWORD = 0x80000000; +pub const HOVER_DEFAULT: DWORD = 0xFFFFFFFF; +STRUCT!{struct TRACKMOUSEEVENT { + cbSize: DWORD, + dwFlags: DWORD, + hwndTrack: HWND, + dwHoverTime: DWORD, +}} +pub type LPTRACKMOUSEEVENT = *mut TRACKMOUSEEVENT; +extern "system" { + pub fn TrackMouseEvent( + lpEventTrack: LPTRACKMOUSEEVENT, + ) -> BOOL; +} +pub const WS_OVERLAPPED: DWORD = 0x00000000; +pub const WS_POPUP: DWORD = 0x80000000; +pub const WS_CHILD: DWORD = 0x40000000; +pub const WS_MINIMIZE: DWORD = 0x20000000; +pub const WS_VISIBLE: DWORD = 0x10000000; +pub const WS_DISABLED: DWORD = 0x08000000; +pub const WS_CLIPSIBLINGS: DWORD = 0x04000000; +pub const WS_CLIPCHILDREN: DWORD = 0x02000000; +pub const WS_MAXIMIZE: DWORD = 0x01000000; +pub const WS_CAPTION: DWORD = 0x00C00000; +pub const WS_BORDER: DWORD = 0x00800000; +pub const WS_DLGFRAME: DWORD = 0x00400000; +pub const WS_VSCROLL: DWORD = 0x00200000; +pub const WS_HSCROLL: DWORD = 0x00100000; +pub const WS_SYSMENU: DWORD = 0x00080000; +pub const WS_THICKFRAME: DWORD = 0x00040000; +pub const WS_GROUP: DWORD = 0x00020000; +pub const WS_TABSTOP: DWORD = 0x00010000; +pub const WS_MINIMIZEBOX: DWORD = 0x00020000; +pub const WS_MAXIMIZEBOX: DWORD = 0x00010000; +pub const WS_TILED: DWORD = WS_OVERLAPPED; +pub const WS_ICONIC: DWORD = WS_MINIMIZE; +pub const WS_SIZEBOX: DWORD = WS_THICKFRAME; +pub const WS_TILEDWINDOW: DWORD = WS_OVERLAPPEDWINDOW; +pub const WS_OVERLAPPEDWINDOW: DWORD = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME + | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; +pub const WS_POPUPWINDOW: DWORD = WS_POPUP | WS_BORDER | WS_SYSMENU; +pub const WS_CHILDWINDOW: DWORD = WS_CHILD; +pub const WS_EX_DLGMODALFRAME: DWORD = 0x00000001; +pub const WS_EX_NOPARENTNOTIFY: DWORD = 0x00000004; +pub const WS_EX_TOPMOST: DWORD = 0x00000008; +pub const WS_EX_ACCEPTFILES: DWORD = 0x00000010; +pub const WS_EX_TRANSPARENT: DWORD = 0x00000020; +pub const WS_EX_MDICHILD: DWORD = 0x00000040; +pub const WS_EX_TOOLWINDOW: DWORD = 0x00000080; +pub const WS_EX_WINDOWEDGE: DWORD = 0x00000100; +pub const WS_EX_CLIENTEDGE: DWORD = 0x00000200; +pub const WS_EX_CONTEXTHELP: DWORD = 0x00000400; +pub const WS_EX_RIGHT: DWORD = 0x00001000; +pub const WS_EX_LEFT: DWORD = 0x00000000; +pub const WS_EX_RTLREADING: DWORD = 0x00002000; +pub const WS_EX_LTRREADING: DWORD = 0x00000000; +pub const WS_EX_LEFTSCROLLBAR: DWORD = 0x00004000; +pub const WS_EX_RIGHTSCROLLBAR: DWORD = 0x00000000; +pub const WS_EX_CONTROLPARENT: DWORD = 0x00010000; +pub const WS_EX_STATICEDGE: DWORD = 0x00020000; +pub const WS_EX_APPWINDOW: DWORD = 0x00040000; +pub const WS_EX_OVERLAPPEDWINDOW: DWORD = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE; +pub const WS_EX_PALETTEWINDOW: DWORD = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST; +pub const WS_EX_LAYERED: DWORD = 0x00080000; +pub const WS_EX_NOINHERITLAYOUT: DWORD = 0x00100000; +pub const WS_EX_NOREDIRECTIONBITMAP: DWORD = 0x00200000; +pub const WS_EX_LAYOUTRTL: DWORD = 0x00400000; +pub const WS_EX_COMPOSITED: DWORD = 0x02000000; +pub const WS_EX_NOACTIVATE: DWORD = 0x08000000; +pub const CS_VREDRAW: UINT = 0x0001; +pub const CS_HREDRAW: UINT = 0x0002; +pub const CS_DBLCLKS: UINT = 0x0008; +pub const CS_OWNDC: UINT = 0x0020; +pub const CS_CLASSDC: UINT = 0x0040; +pub const CS_PARENTDC: UINT = 0x0080; +pub const CS_NOCLOSE: UINT = 0x0200; +pub const CS_SAVEBITS: UINT = 0x0800; +pub const CS_BYTEALIGNCLIENT: UINT = 0x1000; +pub const CS_BYTEALIGNWINDOW: UINT = 0x2000; +pub const CS_GLOBALCLASS: UINT = 0x4000; +pub const CS_IME: UINT = 0x00010000; +pub const CS_DROPSHADOW: UINT = 0x00020000; +pub const PRF_CHECKVISIBLE: UINT = 0x00000001; +pub const PRF_NONCLIENT: UINT = 0x00000002; +pub const PRF_CLIENT: UINT = 0x00000004; +pub const PRF_ERASEBKGND: UINT = 0x00000008; +pub const PRF_CHILDREN: UINT = 0x00000010; +pub const PRF_OWNED: UINT = 0x00000020; +pub const BDR_RAISEDOUTER: UINT = 0x0001; +pub const BDR_SUNKENOUTER: UINT = 0x0002; +pub const BDR_RAISEDINNER: UINT = 0x0004; +pub const BDR_SUNKENINNER: UINT = 0x0008; +pub const BDR_OUTER: UINT = BDR_RAISEDOUTER | BDR_SUNKENOUTER; +pub const BDR_INNER: UINT = BDR_RAISEDINNER | BDR_SUNKENINNER; +pub const BDR_RAISED: UINT = BDR_RAISEDOUTER | BDR_RAISEDINNER; +pub const BDR_SUNKEN: UINT = BDR_SUNKENOUTER | BDR_SUNKENINNER; +pub const EDGE_RAISED: UINT = BDR_RAISEDOUTER | BDR_RAISEDINNER; +pub const EDGE_SUNKEN: UINT = BDR_SUNKENOUTER | BDR_SUNKENINNER; +pub const EDGE_ETCHED: UINT = BDR_SUNKENOUTER | BDR_RAISEDINNER; +pub const EDGE_BUMP: UINT = BDR_RAISEDOUTER | BDR_SUNKENINNER; +pub const BF_LEFT: UINT = 0x0001; +pub const BF_TOP: UINT = 0x0002; +pub const BF_RIGHT: UINT = 0x0004; +pub const BF_BOTTOM: UINT = 0x0008; +pub const BF_TOPLEFT: UINT = BF_TOP | BF_LEFT; +pub const BF_TOPRIGHT: UINT = BF_TOP | BF_RIGHT; +pub const BF_BOTTOMLEFT: UINT = BF_BOTTOM | BF_LEFT; +pub const BF_BOTTOMRIGHT: UINT = BF_BOTTOM | BF_RIGHT; +pub const BF_RECT: UINT = BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM; +pub const BF_DIAGONAL: UINT = 0x0010; +pub const BF_DIAGONAL_ENDTOPRIGHT: UINT = BF_DIAGONAL | BF_TOP | BF_RIGHT; +pub const BF_DIAGONAL_ENDTOPLEFT: UINT = BF_DIAGONAL | BF_TOP | BF_LEFT; +pub const BF_DIAGONAL_ENDBOTTOMLEFT: UINT = BF_DIAGONAL | BF_BOTTOM | BF_LEFT; +pub const BF_DIAGONAL_ENDBOTTOMRIGHT: UINT = BF_DIAGONAL | BF_BOTTOM | BF_RIGHT; +pub const BF_MIDDLE: UINT = 0x0800; +pub const BF_SOFT: UINT = 0x1000; +pub const BF_ADJUST: UINT = 0x2000; +pub const BF_FLAT: UINT = 0x4000; +pub const BF_MONO: UINT = 0x8000; +extern "system" { + pub fn DrawEdge( + hdc: HDC, + qrc: LPRECT, + edge: UINT, + grfFlags: UINT, + ) -> BOOL; +} +pub const DFC_CAPTION: UINT = 1; +pub const DFC_MENU: UINT = 2; +pub const DFC_SCROLL: UINT = 3; +pub const DFC_BUTTON: UINT = 4; +pub const DFC_POPUPMENU: UINT = 5; +pub const DFCS_CAPTIONCLOSE: UINT = 0x0000; +pub const DFCS_CAPTIONMIN: UINT = 0x0001; +pub const DFCS_CAPTIONMAX: UINT = 0x0002; +pub const DFCS_CAPTIONRESTORE: UINT = 0x0003; +pub const DFCS_CAPTIONHELP: UINT = 0x0004; +pub const DFCS_MENUARROW: UINT = 0x0000; +pub const DFCS_MENUCHECK: UINT = 0x0001; +pub const DFCS_MENUBULLET: UINT = 0x0002; +pub const DFCS_MENUARROWRIGHT: UINT = 0x0004; +pub const DFCS_SCROLLUP: UINT = 0x0000; +pub const DFCS_SCROLLDOWN: UINT = 0x0001; +pub const DFCS_SCROLLLEFT: UINT = 0x0002; +pub const DFCS_SCROLLRIGHT: UINT = 0x0003; +pub const DFCS_SCROLLCOMBOBOX: UINT = 0x0005; +pub const DFCS_SCROLLSIZEGRIP: UINT = 0x0008; +pub const DFCS_SCROLLSIZEGRIPRIGHT: UINT = 0x0010; +pub const DFCS_BUTTONCHECK: UINT = 0x0000; +pub const DFCS_BUTTONRADIOIMAGE: UINT = 0x0001; +pub const DFCS_BUTTONRADIOMASK: UINT = 0x0002; +pub const DFCS_BUTTONRADIO: UINT = 0x0004; +pub const DFCS_BUTTON3STATE: UINT = 0x0008; +pub const DFCS_BUTTONPUSH: UINT = 0x0010; +pub const DFCS_INACTIVE: UINT = 0x0100; +pub const DFCS_PUSHED: UINT = 0x0200; +pub const DFCS_CHECKED: UINT = 0x0400; +pub const DFCS_TRANSPARENT: UINT = 0x0800; +pub const DFCS_HOT: UINT = 0x1000; +pub const DFCS_ADJUSTRECT: UINT = 0x2000; +pub const DFCS_FLAT: UINT = 0x4000; +pub const DFCS_MONO: UINT = 0x8000; +extern "system" { + pub fn DrawFrameControl( + hdc: HDC, + lprc: LPRECT, + uType: UINT, + uState: UINT, + ) -> BOOL; +} +pub const DC_ACTIVE: UINT = 0x0001; +pub const DC_SMALLCAP: UINT = 0x0002; +pub const DC_ICON: UINT = 0x0004; +pub const DC_TEXT: UINT = 0x0008; +pub const DC_INBUTTON: UINT = 0x0010; +pub const DC_GRADIENT: UINT = 0x0020; +pub const DC_BUTTONS: UINT = 0x1000; +extern "system" { + pub fn DrawCaption( + hwnd: HWND, + hdc: HDC, + lprect: *const RECT, + flags: UINT, + ) -> BOOL; +} +pub const IDANI_OPEN: c_int = 1; +pub const IDANI_CAPTION: c_int = 3; +extern "system" { + pub fn DrawAnimatedRects( + hwnd: HWND, + idAni: c_int, + lprcFrom: *const RECT, + lprcTo: *const RECT, + ) -> BOOL; +} +pub const CF_TEXT: UINT = 1; +pub const CF_BITMAP: UINT = 2; +pub const CF_METAFILEPICT: UINT = 3; +pub const CF_SYLK: UINT = 4; +pub const CF_DIF: UINT = 5; +pub const CF_TIFF: UINT = 6; +pub const CF_OEMTEXT: UINT = 7; +pub const CF_DIB: UINT = 8; +pub const CF_PALETTE: UINT = 9; +pub const CF_PENDATA: UINT = 10; +pub const CF_RIFF: UINT = 11; +pub const CF_WAVE: UINT = 12; +pub const CF_UNICODETEXT: UINT = 13; +pub const CF_ENHMETAFILE: UINT = 14; +pub const CF_HDROP: UINT = 15; +pub const CF_LOCALE: UINT = 16; +pub const CF_DIBV5: UINT = 17; +pub const CF_MAX: UINT = 18; +pub const CF_OWNERDISPLAY: UINT = 0x0080; +pub const CF_DSPTEXT: UINT = 0x0081; +pub const CF_DSPBITMAP: UINT = 0x0082; +pub const CF_DSPMETAFILEPICT: UINT = 0x0083; +pub const CF_DSPENHMETAFILE: UINT = 0x008E; +pub const CF_PRIVATEFIRST: UINT = 0x0200; +pub const CF_PRIVATELAST: UINT = 0x02FF; +pub const CF_GDIOBJFIRST: UINT = 0x0300; +pub const CF_GDIOBJLAST: UINT = 0x03FF; +pub const FVIRTKEY: BYTE = TRUE as u8; +pub const FNOINVERT: BYTE = 0x02; +pub const FSHIFT: BYTE = 0x04; +pub const FCONTROL: BYTE = 0x08; +pub const FALT: BYTE = 0x10; +STRUCT!{struct ACCEL { + fVirt: BYTE, + key: WORD, + cmd: WORD, +}} +pub type LPACCEL = *mut ACCEL; +STRUCT!{struct PAINTSTRUCT { + hdc: HDC, + fErase: BOOL, + rcPaint: RECT, + fRestore: BOOL, + fIncUpdate: BOOL, + rgbReserved: [BYTE; 32], +}} +pub type PPAINTSTRUCT = *mut PAINTSTRUCT; +pub type NPPAINTSTRUCT = *mut PAINTSTRUCT; +pub type LPPAINTSTRUCT = *mut PAINTSTRUCT; +STRUCT!{struct CREATESTRUCTA { + lpCreateParams: LPVOID, + hInstance: HINSTANCE, + hMenu: HMENU, + hwndParent: HWND, + cy: c_int, + cx: c_int, + y: c_int, + x: c_int, + style: LONG, + lpszName: LPCSTR, + lpszClass: LPCSTR, + dwExStyle: DWORD, +}} +pub type LPCREATESTRUCTA = *mut CREATESTRUCTA; +STRUCT!{struct CREATESTRUCTW { + lpCreateParams: LPVOID, + hInstance: HINSTANCE, + hMenu: HMENU, + hwndParent: HWND, + cy: c_int, + cx: c_int, + y: c_int, + x: c_int, + style: LONG, + lpszName: LPCWSTR, + lpszClass: LPCWSTR, + dwExStyle: DWORD, +}} +pub type LPCREATESTRUCTW = *mut CREATESTRUCTW; +STRUCT!{struct WINDOWPLACEMENT { + length: UINT, + flags: UINT, + showCmd: UINT, + ptMinPosition: POINT, + ptMaxPosition: POINT, + rcNormalPosition: RECT, +}} +pub type PWINDOWPLACEMENT = *mut WINDOWPLACEMENT; +pub type LPWINDOWPLACEMENT = *mut WINDOWPLACEMENT; +pub const WPF_SETMINPOSITION: UINT = 0x0001; +pub const WPF_RESTORETOMAXIMIZED: UINT = 0x0002; +pub const WPF_ASYNCWINDOWPLACEMENT: UINT = 0x0004; +STRUCT!{struct NMHDR { + hwndFrom: HWND, + idFrom: UINT_PTR, + code: UINT, +}} +pub type LPNMHDR = *mut NMHDR; +STRUCT!{struct STYLESTRUCT { + styleOld: DWORD, + styleNew: DWORD, +}} +pub type LPSTYLESTRUCT = *mut STYLESTRUCT; +pub const ODT_MENU: UINT = 1; +pub const ODT_LISTBOX: UINT = 2; +pub const ODT_COMBOBOX: UINT = 3; +pub const ODT_BUTTON: UINT = 4; +pub const ODT_STATIC: UINT = 5; +pub const ODA_DRAWENTIRE: UINT = 0x0001; +pub const ODA_SELECT: UINT = 0x0002; +pub const ODA_FOCUS: UINT = 0x0004; +pub const ODS_SELECTED: UINT = 0x0001; +pub const ODS_GRAYED: UINT = 0x0002; +pub const ODS_DISABLED: UINT = 0x0004; +pub const ODS_CHECKED: UINT = 0x0008; +pub const ODS_FOCUS: UINT = 0x0010; +pub const ODS_DEFAULT: UINT = 0x0020; +pub const ODS_COMBOBOXEDIT: UINT = 0x1000; +pub const ODS_HOTLIGHT: UINT = 0x0040; +pub const ODS_INACTIVE: UINT = 0x0080; +pub const ODS_NOACCEL: UINT = 0x0100; +pub const ODS_NOFOCUSRECT: UINT = 0x0200; +STRUCT!{struct MEASUREITEMSTRUCT { + CtlType: UINT, + CtlID: UINT, + itemID: UINT, + itemWidth: UINT, + itemHeight: UINT, + itemData: ULONG_PTR, +}} +pub type PMEASUREITEMSTRUCT = *mut MEASUREITEMSTRUCT; +pub type LPMEASUREITEMSTRUCT = *mut MEASUREITEMSTRUCT; +STRUCT!{struct DRAWITEMSTRUCT { + CtlType: UINT, + CtlID: UINT, + itemID: UINT, + itemAction: UINT, + itemState: UINT, + hwndItem: HWND, + hDC: HDC, + rcItem: RECT, + itemData: ULONG_PTR, +}} +pub type PDRAWITEMSTRUCT = *mut DRAWITEMSTRUCT; +pub type LPDRAWITEMSTRUCT = *mut DRAWITEMSTRUCT; +STRUCT!{struct DELETEITEMSTRUCT { + CtlType: UINT, + CtlID: UINT, + itemID: UINT, + hwndItem: HWND, + itemData: ULONG_PTR, +}} +pub type PDELETEITEMSTRUCT = *mut DELETEITEMSTRUCT; +pub type LPDELETEITEMSTRUCT = *mut DELETEITEMSTRUCT; +STRUCT!{struct COMPAREITEMSTRUCT { + CtlType: UINT, + CtlID: UINT, + hwndItem: HWND, + itemID1: UINT, + itemData1: ULONG_PTR, + itemID2: UINT, + itemData2: ULONG_PTR, + dwLocaleId: DWORD, +}} +pub type PCOMPAREITEMSTRUCT = *mut COMPAREITEMSTRUCT; +pub type LPCOMPAREITEMSTRUCT = *mut COMPAREITEMSTRUCT; +extern "system" { + pub fn GetMessageA( + lpMsg: LPMSG, + hWnd: HWND, + wMsgFilterMin: UINT, + wMsgFilterMax: UINT, + ) -> BOOL; + pub fn GetMessageW( + lpMsg: LPMSG, + hWnd: HWND, + wMsgFilterMin: UINT, + wMsgFilterMax: UINT, + ) -> BOOL; + pub fn TranslateMessage( + lpmsg: *const MSG, + ) -> BOOL; + pub fn DispatchMessageA( + lpmsg: *const MSG, + ) -> LRESULT; + pub fn DispatchMessageW( + lpmsg: *const MSG, + ) -> LRESULT; + pub fn SetMessageQueue( + cMessagesMax: c_int, + ) -> BOOL; + pub fn PeekMessageA( + lpMsg: LPMSG, + hWnd: HWND, + wMsgFilterMin: UINT, + wMsgFilterMax: UINT, + wRemoveMsg: UINT, + ) -> BOOL; + pub fn PeekMessageW( + lpMsg: LPMSG, + hWnd: HWND, + wMsgFilterMin: UINT, + wMsgFilterMax: UINT, + wRemoveMsg: UINT, + ) -> BOOL; +} +pub const PM_NOREMOVE: UINT = 0x0000; +pub const PM_REMOVE: UINT = 0x0001; +pub const PM_NOYIELD: UINT = 0x0002; +pub const PM_QS_INPUT: UINT = QS_INPUT << 16; +pub const PM_QS_POSTMESSAGE: UINT = (QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16; +pub const PM_QS_PAINT: UINT = QS_PAINT << 16; +pub const PM_QS_SENDMESSAGE: UINT = QS_SENDMESSAGE << 16; +extern "system" { + pub fn RegisterHotKey( + hwnd: HWND, + id: c_int, + fsModifiers: UINT, + vk: UINT, + ) -> BOOL; + pub fn UnregisterHotKey( + hWnd: HWND, + id: c_int, + ) -> BOOL; +} +pub const MOD_ALT: LPARAM = 0x0001; +pub const MOD_CONTROL: LPARAM = 0x0002; +pub const MOD_SHIFT: LPARAM = 0x0004; +pub const MOD_WIN: LPARAM = 0x0008; +pub const MOD_NOREPEAT: LPARAM = 0x4000; +pub const IDHOT_SNAPWINDOW: WPARAM = -1isize as usize; +pub const IDHOT_SNAPDESKTOP: WPARAM = -2isize as usize; +pub const ENDSESSION_CLOSEAPP: UINT = 0x00000001; +pub const ENDSESSION_CRITICAL: UINT = 0x40000000; +pub const ENDSESSION_LOGOFF: UINT = 0x80000000; +pub const EWX_LOGOFF: UINT = 0x00000000; +pub const EWX_SHUTDOWN: UINT = 0x00000001; +pub const EWX_REBOOT: UINT = 0x00000002; +pub const EWX_FORCE: UINT = 0x00000004; +pub const EWX_POWEROFF: UINT = 0x00000008; +pub const EWX_FORCEIFHUNG: UINT = 0x00000010; +pub const EWX_QUICKRESOLVE: UINT = 0x00000020; +pub const EWX_RESTARTAPPS: UINT = 0x00000040; +pub const EWX_HYBRID_SHUTDOWN: UINT = 0x00400000; +pub const EWX_BOOTOPTIONS: UINT = 0x01000000; +// ExitWindows +extern "system" { + pub fn ExitWindowsEx( + uFlags: UINT, + dwReason: DWORD, + ) -> BOOL; + pub fn SwapMouseButton( + fSwap: BOOL, + ) -> BOOL; + pub fn GetMessagePos() -> DWORD; + pub fn GetMessageTime() -> LONG; + pub fn GetMessageExtraInfo() -> LPARAM; + pub fn GetUnpredictedMessagePos() -> DWORD; + pub fn IsWow64Message() -> BOOL; + pub fn SetMessageExtraInfo( + lParam: LPARAM, + ) -> LPARAM; + pub fn SendMessageA( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn SendMessageW( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn SendMessageTimeoutA( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + fuFlags: UINT, + uTimeout: UINT, + lpdwResult: PDWORD_PTR, + ) -> LRESULT; + pub fn SendMessageTimeoutW( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + fuFlags: UINT, + uTimeout: UINT, + lpdwResult: PDWORD_PTR, + ) -> LRESULT; + pub fn SendNotifyMessageA( + hWnd: HWND, + msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> BOOL; + pub fn SendNotifyMessageW( + hWnd: HWND, + msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> BOOL; + pub fn SendMessageCallbackA( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + lpResultCallBack: SENDASYNCPROC, + dwData: ULONG_PTR, + ) -> BOOL; + pub fn SendMessageCallbackW( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + lpResultCallBack: SENDASYNCPROC, + dwData: ULONG_PTR, + ) -> BOOL; +} +STRUCT!{struct BSMINFO { + cbSize: UINT, + hdesk: HDESK, + hwnd: HWND, + luid: LUID, +}} +pub type PBSMINFO = *mut BSMINFO; +extern "system" { + pub fn BroadcastSystemMessageExA( + flags: DWORD, + lpInfo: LPDWORD, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + pbsmInfo: PBSMINFO, + ) -> c_long; + pub fn BroadcastSystemMessageExW( + flags: DWORD, + lpInfo: LPDWORD, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + pbsmInfo: PBSMINFO, + ) -> c_long; + pub fn BroadcastSystemMessageA( + flags: DWORD, + lpInfo: LPDWORD, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LONG; + pub fn BroadcastSystemMessageW( + flags: DWORD, + lpInfo: LPDWORD, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LONG; +} +pub const BSM_ALLCOMPONENTS: DWORD = 0x00000000; +pub const BSM_VXDS: DWORD = 0x00000001; +pub const BSM_NETDRIVER: DWORD = 0x00000002; +pub const BSM_INSTALLABLEDRIVERS: DWORD = 0x00000004; +pub const BSM_APPLICATIONS: DWORD = 0x00000008; +pub const BSM_ALLDESKTOPS: DWORD = 0x00000010; +pub const BSF_QUERY: DWORD = 0x00000001; +pub const BSF_IGNORECURRENTTASK: DWORD = 0x00000002; +pub const BSF_FLUSHDISK: DWORD = 0x00000004; +pub const BSF_NOHANG: DWORD = 0x00000008; +pub const BSF_POSTMESSAGE: DWORD = 0x00000010; +pub const BSF_FORCEIFHUNG: DWORD = 0x00000020; +pub const BSF_NOTIMEOUTIFNOTHUNG: DWORD = 0x00000040; +pub const BSF_ALLOWSFW: DWORD = 0x00000080; +pub const BSF_SENDNOTIFYMESSAGE: DWORD = 0x00000100; +pub const BSF_RETURNHDESK: DWORD = 0x00000200; +pub const BSF_LUID: DWORD = 0x00000400; +pub const BROADCAST_QUERY_DENY: DWORD = 0x424D5144; +pub type HDEVNOTIFY = PVOID; +pub type PHDEVNOTIFY = *mut HDEVNOTIFY; +pub const DEVICE_NOTIFY_WINDOW_HANDLE: DWORD = 0x00000000; +pub const DEVICE_NOTIFY_SERVICE_HANDLE: DWORD = 0x00000001; +pub const DEVICE_NOTIFY_ALL_INTERFACE_CLASSES: DWORD = 0x00000004; +extern "system" { + pub fn RegisterDeviceNotificationA( + hRecipient: HANDLE, + notificationFilter: LPVOID, + flags: DWORD, + ) -> HDEVNOTIFY; + pub fn RegisterDeviceNotificationW( + hRecipient: HANDLE, + notificationFilter: LPVOID, + flags: DWORD, + ) -> HDEVNOTIFY; + pub fn UnregisterDeviceNotification( + Handle: HDEVNOTIFY, + ) -> BOOL; +} +pub type HPOWERNOTIFY = PVOID; +pub type PHPOWERNOTIFY = *mut HPOWERNOTIFY; +extern "system" { + pub fn RegisterPowerSettingNotification( + hRecipient: HANDLE, + PowerSettingGuid: LPCGUID, + Flags: DWORD, + ) -> HPOWERNOTIFY; + pub fn UnregisterPowerSettingNotification( + Handle: HPOWERNOTIFY, + ) -> BOOL; + pub fn RegisterSuspendResumeNotification( + hRecipient: HANDLE, + Flags: DWORD, + ) -> HPOWERNOTIFY; + pub fn UnregisterSuspendResumeNotification( + Handle: HPOWERNOTIFY, + ) -> BOOL; + pub fn PostMessageA( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> BOOL; + pub fn PostMessageW( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> BOOL; + pub fn PostThreadMessageA( + idThread: DWORD, + msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> BOOL; + pub fn PostThreadMessageW( + idThread: DWORD, + msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> BOOL; +} +// PostAppMessageA +// PostAppMessageW +pub const HWND_BROADCAST: HWND = 0xffff as HWND; +pub const HWND_MESSAGE: HWND = -3isize as HWND; +extern "system" { + pub fn AttachThreadInput( + idAttach: DWORD, + idAttachTo: DWORD, + fAttach: BOOL, + ) -> BOOL; + pub fn ReplyMessage( + lResult: LRESULT, + ) -> BOOL; + pub fn WaitMessage() -> BOOL; + pub fn WaitForInputIdle( + hProcess: HANDLE, + dwMilliseconds: DWORD, + ) -> DWORD; + pub fn DefWindowProcA( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn DefWindowProcW( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn PostQuitMessage( + nExitCode: c_int, + ); + pub fn CallWindowProcA( + lpPrevWndFunc: WNDPROC, + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn CallWindowProcW( + lpPrevWndFunc: WNDPROC, + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn InSendMessage() -> BOOL; + pub fn InSendMessageEx( + lpReserved: LPVOID, + ) -> DWORD; +} +pub const ISMEX_NOSEND: DWORD = 0x00000000; +pub const ISMEX_SEND: DWORD = 0x00000001; +pub const ISMEX_NOTIFY: DWORD = 0x00000002; +pub const ISMEX_CALLBACK: DWORD = 0x00000004; +pub const ISMEX_REPLIED: DWORD = 0x00000008; +extern "system" { + pub fn GetDoubleClickTime() -> UINT; + pub fn SetDoubleClickTime( + uInterval: UINT, + ) -> BOOL; + pub fn RegisterClassA( + lpWndClass: *const WNDCLASSA, + ) -> ATOM; + pub fn RegisterClassW( + lpWndClass: *const WNDCLASSW, + ) -> ATOM; + pub fn UnregisterClassA( + lpClassName: LPCSTR, + hInstance: HINSTANCE, + ) -> BOOL; + pub fn UnregisterClassW( + lpClassName: LPCWSTR, + hInstance: HINSTANCE, + ) -> BOOL; + pub fn GetClassInfoA( + hInstance: HINSTANCE, + lpClassName: LPCSTR, + lpWndClass: LPWNDCLASSA, + ) -> BOOL; + pub fn GetClassInfoW( + hInstance: HINSTANCE, + lpClassName: LPCWSTR, + lpWndClass: LPWNDCLASSW, + ) -> BOOL; + pub fn RegisterClassExA( + lpWndClass: *const WNDCLASSEXA, + ) -> ATOM; + pub fn RegisterClassExW( + lpWndClass: *const WNDCLASSEXW, + ) -> ATOM; + pub fn GetClassInfoExA( + hinst: HINSTANCE, + lpszClass: LPCSTR, + lpwcx: LPWNDCLASSEXA, + ) -> BOOL; + pub fn GetClassInfoExW( + hinst: HINSTANCE, + lpszClass: LPCWSTR, + lpwcx: LPWNDCLASSEXW, + ) -> BOOL; +} +pub const CW_USEDEFAULT: c_int = 0x80000000; +pub const HWND_DESKTOP: HWND = 0 as HWND; +FN!{stdcall PREGISTERCLASSNAMEW( + LPCWSTR, +) -> BOOLEAN} +extern "system" { + pub fn CreateWindowExA( + dwExStyle: DWORD, + lpClassName: LPCSTR, + lpWindowName: LPCSTR, + dwStyle: DWORD, + x: c_int, + y: c_int, + nWidth: c_int, + nHeight: c_int, + hWndParent: HWND, + hMenu: HMENU, + hInstance: HINSTANCE, + lpParam: LPVOID, + ) -> HWND; + pub fn CreateWindowExW( + dwExStyle: DWORD, + lpClassName: LPCWSTR, + lpWindowName: LPCWSTR, + dwStyle: DWORD, + x: c_int, + y: c_int, + nWidth: c_int, + nHeight: c_int, + hWndParent: HWND, + hMenu: HMENU, + hInstance: HINSTANCE, + lpParam: LPVOID, + ) -> HWND; +} +// CreateWindowA +// CreateWindowW +extern "system" { + pub fn IsWindow( + hWnd: HWND, + ) -> BOOL; + pub fn IsMenu( + hMenu: HMENU, + ) -> BOOL; + pub fn IsChild( + hWndParent: HWND, + hWnd: HWND, + ) -> BOOL; + pub fn DestroyWindow( + hWnd: HWND, + ) -> BOOL; + pub fn ShowWindow( + hWnd: HWND, + nCmdShow: c_int, + ) -> BOOL; + pub fn AnimateWindow( + hWnd: HWND, + dwTime: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn UpdateLayeredWindow( + hWnd: HWND, + hdcDst: HDC, + pptDst: *mut POINT, + psize: *mut SIZE, + hdcSrc: HDC, + pptSrc: *mut POINT, + crKey: COLORREF, + pblend: *mut BLENDFUNCTION, + dwFlags: DWORD, + ) -> BOOL; +} +STRUCT!{struct UPDATELAYEREDWINDOWINFO { + cbSize: DWORD, + hdcDst: HDC, + pptDst: *const POINT, + psize: *const SIZE, + hdcSrc: HDC, + pptSrc: *const POINT, + crKey: COLORREF, + pblend: *const BLENDFUNCTION, + dwFlags: DWORD, + prcDirty: *const RECT, +}} +pub type PUPDATELAYEREDWINDOWINFO = *mut UPDATELAYEREDWINDOWINFO; +extern "system" { + pub fn UpdateLayeredWindowIndirect( + hWnd: HWND, + pULWInfo: *mut UPDATELAYEREDWINDOWINFO, + ) -> BOOL; + pub fn GetLayeredWindowAttributes( + hwnd: HWND, + pcrKey: *mut COLORREF, + pbAlpha: *mut BYTE, + pdwFlags: *mut DWORD, + ) -> BOOL; +} +pub const PW_CLIENTONLY: DWORD = 0x00000001; +pub const PW_RENDERFULLCONTENT: DWORD = 0x00000002; +extern "system" { + pub fn PrintWindow( + hwnd: HWND, + hdcBlt: HDC, + nFlags: UINT, + ) -> BOOL; + pub fn SetLayeredWindowAttributes( + hwnd: HWND, + crKey: COLORREF, + bAlpha: BYTE, + dwFlags: DWORD, + ) -> BOOL; +} +pub const LWA_COLORKEY: DWORD = 0x00000001; +pub const LWA_ALPHA: DWORD = 0x00000002; +pub const ULW_COLORKEY: DWORD = 0x00000001; +pub const ULW_ALPHA: DWORD = 0x00000002; +pub const ULW_OPAQUE: DWORD = 0x00000004; +pub const ULW_EX_NORESIZE: DWORD = 0x00000008; +extern "system" { + pub fn ShowWindowAsync( + hWnd: HWND, + nCmdShow: c_int, + ) -> BOOL; + pub fn FlashWindow( + hwnd: HWND, + bInvert: BOOL, + ) -> BOOL; +} +STRUCT!{struct FLASHWINFO { + cbSize: UINT, + hwnd: HWND, + dwFlags: DWORD, + uCount: UINT, + dwTimeout: DWORD, +}} +pub type PFLASHWINFO = *mut FLASHWINFO; +extern "system" { + pub fn FlashWindowEx( + pfwi: PFLASHWINFO, + ) -> BOOL; +} +pub const FLASHW_STOP: DWORD = 0; +pub const FLASHW_CAPTION: DWORD = 0x00000001; +pub const FLASHW_TRAY: DWORD = 0x00000002; +pub const FLASHW_ALL: DWORD = FLASHW_CAPTION | FLASHW_TRAY; +pub const FLASHW_TIMER: DWORD = 0x00000004; +pub const FLASHW_TIMERNOFG: DWORD = 0x0000000C; +extern "system" { + pub fn ShowOwnedPopups( + hWnd: HWND, + fShow: BOOL, + ) -> BOOL; + pub fn OpenIcon( + hWnd: HWND, + ) -> BOOL; + pub fn CloseWindow( + hWnd: HWND, + ) -> BOOL; + pub fn MoveWindow( + hWnd: HWND, + X: c_int, + Y: c_int, + nWidth: c_int, + nHeight: c_int, + bRepaint: BOOL, + ) -> BOOL; + pub fn SetWindowPos( + hWnd: HWND, + hWndInsertAfter: HWND, + X: c_int, + Y: c_int, + cx: c_int, + cy: c_int, + uFlags: UINT, + ) -> BOOL; + pub fn GetWindowPlacement( + hWnd: HWND, + lpwndpl: *mut WINDOWPLACEMENT, + ) -> BOOL; + pub fn SetWindowPlacement( + hWnd: HWND, + lpwndpl: *const WINDOWPLACEMENT, + ) -> BOOL; +} +pub const WDA_NONE: DWORD = 0x00000000; +pub const WDA_MONITOR: DWORD = 0x00000001; +extern "system" { + pub fn GetWindowDisplayAffinity( + hWnd: HWND, + pdwAffinity: *mut DWORD, + ) -> BOOL; + pub fn SetWindowDisplayAffinity( + hWnd: HWND, + dwAffinity: DWORD, + ) -> BOOL; + pub fn BeginDeferWindowPos( + nNumWindows: c_int, + ) -> HDWP; + pub fn DeferWindowPos( + hWinPosInfo: HDWP, + hWnd: HWND, + hWndInserAfter: HWND, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + uFlags: UINT, + ) -> HDWP; + pub fn EndDeferWindowPos( + hWinPosInfo: HDWP, + ) -> BOOL; + pub fn IsWindowVisible( + hWnd: HWND, + ) -> BOOL; + pub fn IsIconic( + hWnd: HWND, + ) -> BOOL; + pub fn AnyPopup() -> BOOL; + pub fn BringWindowToTop( + hWnd: HWND, + ) -> BOOL; + pub fn IsZoomed( + hwnd: HWND, + ) -> BOOL; +} +pub const SWP_NOSIZE: UINT = 0x0001; +pub const SWP_NOMOVE: UINT = 0x0002; +pub const SWP_NOZORDER: UINT = 0x0004; +pub const SWP_NOREDRAW: UINT = 0x0008; +pub const SWP_NOACTIVATE: UINT = 0x0010; +pub const SWP_FRAMECHANGED: UINT = 0x0020; +pub const SWP_SHOWWINDOW: UINT = 0x0040; +pub const SWP_HIDEWINDOW: UINT = 0x0080; +pub const SWP_NOCOPYBITS: UINT = 0x0100; +pub const SWP_NOOWNERZORDER: UINT = 0x0200; +pub const SWP_NOSENDCHANGING: UINT = 0x0400; +pub const SWP_DRAWFRAME: UINT = SWP_FRAMECHANGED; +pub const SWP_NOREPOSITION: UINT = SWP_NOOWNERZORDER; +pub const SWP_DEFERERASE: UINT = 0x2000; +pub const SWP_ASYNCWINDOWPOS: UINT = 0x4000; +pub const HWND_TOP: HWND = 0 as HWND; +pub const HWND_BOTTOM: HWND = 1 as HWND; +pub const HWND_TOPMOST: HWND = -1isize as HWND; +pub const HWND_NOTOPMOST: HWND = -2isize as HWND; +STRUCT!{struct DLGTEMPLATE { + style: DWORD, + dwExtendedStyle: DWORD, + cdit: WORD, + x: c_short, + y: c_short, + cx: c_short, + cy: c_short, +}} +pub type LPDLGTEMPLATEA = *mut DLGTEMPLATE; +pub type LPDLGTEMPLATEW = *mut DLGTEMPLATE; +pub type LPCDLGTEMPLATEA = *const DLGTEMPLATE; +pub type LPCDLGTEMPLATEW = *const DLGTEMPLATE; +STRUCT!{struct DLGITEMTEMPLATE { + style: DWORD, + dwExtendedStyle: DWORD, + x: c_short, + y: c_short, + cx: c_short, + cy: c_short, + id: WORD, +}} +pub type PDLGITEMTEMPLATEA = *mut DLGITEMTEMPLATE; +pub type PDLGITEMTEMPLATEW = *mut DLGITEMTEMPLATE; +pub type LPDLGITEMTEMPLATEA = *mut DLGITEMTEMPLATE; +pub type LPDLGITEMTEMPLATEW = *mut DLGITEMTEMPLATE; +extern "system" { + pub fn CreateDialogParamA( + hInstance: HINSTANCE, + lpTemplateName: LPCSTR, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; + pub fn CreateDialogParamW( + hInstance: HINSTANCE, + lpTemplateName: LPCWSTR, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; + pub fn CreateDialogIndirectParamA( + hInstance: HINSTANCE, + lpTemplate: LPCDLGTEMPLATEA, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; + pub fn CreateDialogIndirectParamW( + hInstance: HINSTANCE, + lpTemplate: LPCDLGTEMPLATEW, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> HWND; +} +// CreateDialogA +// CreateDialogW +// CreateDialogIndirectA +// CreateDialogIndirectW +extern "system" { + pub fn DialogBoxParamA( + hInstance: HINSTANCE, + lpTemplateName: LPCSTR, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> INT_PTR; + pub fn DialogBoxParamW( + hInstance: HINSTANCE, + lpTemplateName: LPCWSTR, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> INT_PTR; + pub fn DialogBoxIndirectParamA( + hInstance: HINSTANCE, + hDialogTemplate: LPCDLGTEMPLATEA, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> INT_PTR; + pub fn DialogBoxIndirectParamW( + hInstance: HINSTANCE, + hDialogTemplate: LPCDLGTEMPLATEW, + hWndParent: HWND, + lpDialogFunc: DLGPROC, + dwInitParam: LPARAM, + ) -> INT_PTR; +} +// DialogBoxA +// DialogBoxW +// DialogBoxIndirectA +// DialogBoxIndirectW +extern "system" { + pub fn EndDialog( + hDlg: HWND, + nResult: INT_PTR, + ) -> BOOL; + pub fn GetDlgItem( + hDlg: HWND, + nIDDlgItem: c_int, + ) -> HWND; + pub fn SetDlgItemInt( + hDlg: HWND, + nIDDlgItem: c_int, + uValue: UINT, + bSigned: BOOL, + ) -> BOOL; + pub fn GetDlgItemInt( + hDlg: HWND, + nIDDlgItem: c_int, + lpTranslated: *mut BOOL, + bSigned: BOOL, + ) -> UINT; + pub fn SetDlgItemTextA( + hDlg: HWND, + nIDDlgItem: c_int, + lpString: LPCSTR, + ) -> BOOL; + pub fn SetDlgItemTextW( + hDlg: HWND, + nIDDlgItem: c_int, + lpString: LPCWSTR, + ) -> BOOL; + pub fn GetDlgItemTextA( + hDlg: HWND, + nIDDlgItem: c_int, + lpString: LPSTR, + nMaxCount: c_int, + ) -> UINT; + pub fn GetDlgItemTextW( + hDlg: HWND, + nIDDlgItem: c_int, + lpString: LPWSTR, + nMaxCount: c_int, + ) -> UINT; + pub fn CheckDlgButton( + hDlg: HWND, + nIDButton: c_int, + uCheck: UINT, + ) -> BOOL; + pub fn CheckRadioButton( + hDlg: HWND, + nIDFirstButton: c_int, + nIDLasatButton: c_int, + nIDCheckButton: c_int, + ) -> BOOL; + pub fn IsDlgButtonChecked( + hDlg: HWND, + nIDButton: c_int, + ) -> UINT; + pub fn SendDlgItemMessageA( + hDlg: HWND, + nIDDlgItem: c_int, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn SendDlgItemMessageW( + hDlg: HWND, + nIDDlgItem: c_int, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn GetNextDlgGroupItem( + hDlg: HWND, + hCtl: HWND, + bPrevious: BOOL, + ) -> HWND; + pub fn GetNextDlgTabItem( + hDlg: HWND, + hCtl: HWND, + bPrevious: BOOL, + ) -> HWND; + pub fn GetDlgCtrlID( + hwnd: HWND, + ) -> c_int; + pub fn GetDialogBaseUnits() -> LONG; + pub fn DefDlgProcA( + hDlg: HWND, + msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn DefDlgProcW( + hDlg: HWND, + msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn CallMsgFilterA( + lpMsg: LPMSG, + nCode: c_int, + ) -> BOOL; + pub fn CallMsgFilterW( + lpMsg: LPMSG, + nCode: c_int, + ) -> BOOL; + pub fn OpenClipboard( + hWnd: HWND, + ) -> BOOL; + pub fn CloseClipboard() -> BOOL; + pub fn GetClipboardSequenceNumber() -> DWORD; + pub fn GetClipboardOwner() -> HWND; + pub fn SetClipboardViewer( + hWndNewViewer: HWND, + ) -> HWND; + pub fn GetClipboardViewer() -> HWND; + pub fn ChangeClipboardChain( + hwndRemove: HWND, + hwndNewNext: HWND, + ) -> BOOL; + pub fn SetClipboardData( + uFormat: UINT, + hMem: HANDLE, + ) -> HANDLE; + pub fn GetClipboardData( + uFormat: UINT, + ) -> HANDLE; + pub fn RegisterClipboardFormatA( + lpszFormat: LPCSTR, + ) -> UINT; + pub fn RegisterClipboardFormatW( + lpszFormat: LPCWSTR, + ) -> UINT; + pub fn CountClipboardFormats() -> c_int; + pub fn EnumClipboardFormats( + format: UINT, + ) -> UINT; + pub fn GetClipboardFormatNameA( + format: UINT, + lpszFormatName: LPSTR, + cchMaxCount: c_int, + ) -> c_int; + pub fn GetClipboardFormatNameW( + format: UINT, + lpszFormatName: LPWSTR, + cchMaxCount: c_int, + ) -> c_int; + pub fn EmptyClipboard() -> BOOL; + pub fn IsClipboardFormatAvailable( + format: UINT, + ) -> BOOL; + pub fn GetPriorityClipboardFormat( + paFormatPriorityList: *mut UINT, + cFormats: c_int, + ) -> c_int; + pub fn GetOpenClipboardWindow() -> HWND; + pub fn AddClipboardFormatListener( + hWnd: HWND, + ) -> BOOL; + pub fn RemoveClipboardFormatListener( + hWnd: HWND, + ) -> BOOL; + pub fn GetUpdatedClipboardFormats( + lpuiFormats: PUINT, + cFormats: UINT, + pcFormatsOUT: PUINT, + ) -> BOOL; + pub fn CharToOemA( + pSrc: LPCSTR, + pDst: LPSTR, + ) -> BOOL; + pub fn CharToOemW( + pSrc: LPCWSTR, + pDst: LPSTR, + ) -> BOOL; + pub fn OemToCharA( + pSrc: LPCSTR, + pDst: LPSTR, + ) -> BOOL; + pub fn OemToCharW( + pSrc: LPCSTR, + pDst: LPWSTR, + ) -> BOOL; + pub fn CharToOemBuffA( + lpszSrc: LPCSTR, + lpszDst: LPSTR, + cchDstLength: DWORD, + ) -> BOOL; + pub fn CharToOemBuffW( + lpszSrc: LPCWSTR, + lpszDst: LPSTR, + cchDstLength: DWORD, + ) -> BOOL; + pub fn OemToCharBuffA( + lpszSrc: LPCSTR, + lpszDst: LPSTR, + cchDstLength: DWORD, + ) -> BOOL; + pub fn OemToCharBuffW( + lpszSrc: LPCSTR, + lpszDst: LPWSTR, + cchDstLength: DWORD, + ) -> BOOL; + pub fn CharUpperA( + lpsz: LPSTR, + ) -> LPSTR; + pub fn CharUpperW( + lpsz: LPWSTR, + ) -> LPWSTR; + pub fn CharUpperBuffA( + lpsz: LPSTR, + cchLength: DWORD, + ) -> DWORD; + pub fn CharUpperBuffW( + lpsz: LPWSTR, + cchLength: DWORD, + ) -> DWORD; + pub fn CharLowerA( + lpsz: LPSTR, + ) -> LPSTR; + pub fn CharLowerW( + lpsz: LPWSTR, + ) -> LPWSTR; + pub fn CharLowerBuffA( + lpsz: LPSTR, + cchLength: DWORD, + ) -> DWORD; + pub fn CharLowerBuffW( + lpsz: LPWSTR, + cchLength: DWORD, + ) -> DWORD; + pub fn CharNextA( + lpsz: LPCSTR, + ) -> LPSTR; + pub fn CharNextW( + lpsz: LPCWSTR, + ) -> LPWSTR; + pub fn CharPrevA( + lpszStart: LPCSTR, + lpszCurrent: LPCSTR, + ) -> LPSTR; + pub fn CharPrevW( + lpszStart: LPCWSTR, + lpszCurrent: LPCWSTR, + ) -> LPWSTR; + pub fn CharNextExA( + codePage: WORD, + lpCurrentChar: LPSTR, + dwFlags: DWORD, + ) -> LPSTR; + pub fn CharPrevExA( + codePage: WORD, + lpStart: LPCSTR, + lpCurrentChar: LPCSTR, + dwFlags: DWORD, + ) -> LPSTR; +} +// AnsiToOem +// OemToAnsi +// AnsiToOemBuff +// OemToAnsiBuff +// AnsiUpper +// AnsiUpperBuff +// AnsiLower +// AnsiLowerBuff +// AnsiNext +// AnsiPrev +extern "system" { + pub fn IsCharAlphaA( + ch: CHAR, + ) -> BOOL; + pub fn IsCharAlphaW( + ch: WCHAR, + ) -> BOOL; + pub fn IsCharAlphaNumericA( + ch: CHAR, + ) -> BOOL; + pub fn IsCharAlphaNumericW( + ch: WCHAR, + ) -> BOOL; + pub fn IsCharUpperA( + ch: CHAR, + ) -> BOOL; + pub fn IsCharUpperW( + ch: WCHAR, + ) -> BOOL; + pub fn IsCharLowerA( + ch: CHAR, + ) -> BOOL; + pub fn IsCharLowerW( + ch: WCHAR, + ) -> BOOL; + pub fn SetFocus( + hWnd: HWND, + ) -> HWND; + pub fn GetActiveWindow() -> HWND; + pub fn GetFocus() -> HWND; + pub fn GetKBCodePage() -> UINT; + pub fn GetKeyState( + nVirtKey: c_int, + ) -> SHORT; + pub fn GetAsyncKeyState( + vKey: c_int, + ) -> SHORT; + pub fn GetKeyboardState( + lpKeyState: PBYTE, + ) -> BOOL; + pub fn SetKeyboardState( + lpKeyState: LPBYTE, + ) -> BOOL; + pub fn GetKeyNameTextA( + lparam: LONG, + lpString: LPSTR, + cchSize: c_int, + ) -> c_int; + pub fn GetKeyNameTextW( + lParam: LONG, + lpString: LPWSTR, + cchSize: c_int, + ) -> c_int; + pub fn GetKeyboardType( + nTypeFlag: c_int, + ) -> c_int; + pub fn ToAscii( + uVirtKey: UINT, + uScanCode: UINT, + lpKeyState: *const BYTE, + lpChar: LPWORD, + uFlags: UINT, + ) -> c_int; + pub fn ToAsciiEx( + uVirtKey: UINT, + uScanCode: UINT, + lpKeyState: *const BYTE, + lpChar: LPWORD, + uFlags: UINT, + dwhkl: HKL, + ) -> c_int; + pub fn ToUnicode( + wVirtKey: UINT, + wScanCode: UINT, + lpKeyState: *const BYTE, + lwszBuff: LPWSTR, + cchBuff: c_int, + wFlags: UINT, + ) -> c_int; + pub fn OemKeyScan( + wOemChar: WORD, + ) -> DWORD; + pub fn VkKeyScanA( + ch: CHAR, + ) -> SHORT; + pub fn VkKeyScanW( + ch: WCHAR, + ) -> SHORT; + pub fn VkKeyScanExA( + ch: CHAR, + dwhkl: HKL, + ) -> SHORT; + pub fn VkKeyScanExW( + ch: WCHAR, + dwhkl: HKL, + ) -> SHORT; +} +pub const KEYEVENTF_EXTENDEDKEY: DWORD = 0x0001; +pub const KEYEVENTF_KEYUP: DWORD = 0x0002; +pub const KEYEVENTF_UNICODE: DWORD = 0x0004; +pub const KEYEVENTF_SCANCODE: DWORD = 0x0008; +extern "system" { + pub fn keybd_event( + bVk: BYTE, + bScan: BYTE, + dwFlags: DWORD, + dwExtraInfo: ULONG_PTR, + ); +} +pub const MOUSEEVENTF_MOVE: DWORD = 0x0001; +pub const MOUSEEVENTF_LEFTDOWN: DWORD = 0x0002; +pub const MOUSEEVENTF_LEFTUP: DWORD = 0x0004; +pub const MOUSEEVENTF_RIGHTDOWN: DWORD = 0x0008; +pub const MOUSEEVENTF_RIGHTUP: DWORD = 0x0010; +pub const MOUSEEVENTF_MIDDLEDOWN: DWORD = 0x0020; +pub const MOUSEEVENTF_MIDDLEUP: DWORD = 0x0040; +pub const MOUSEEVENTF_XDOWN: DWORD = 0x0080; +pub const MOUSEEVENTF_XUP: DWORD = 0x0100; +pub const MOUSEEVENTF_WHEEL: DWORD = 0x0800; +pub const MOUSEEVENTF_HWHEEL: DWORD = 0x01000; +pub const MOUSEEVENTF_MOVE_NOCOALESCE: DWORD = 0x2000; +pub const MOUSEEVENTF_VIRTUALDESK: DWORD = 0x4000; +pub const MOUSEEVENTF_ABSOLUTE: DWORD = 0x8000; +extern "system" { + pub fn mouse_event( + dwFlags: DWORD, + dx: DWORD, + dy: DWORD, + dwData: DWORD, + dwExtraInfo: ULONG_PTR, + ); +} +STRUCT!{struct MOUSEINPUT { + dx: LONG, + dy: LONG, + mouseData: DWORD, + dwFlags: DWORD, + time: DWORD, + dwExtraInfo: ULONG_PTR, +}} +pub type PMOUSEINPUT = *mut MOUSEINPUT; +pub type LPMOUSEINPUT = *mut MOUSEINPUT; +STRUCT!{struct KEYBDINPUT { + wVk: WORD, + wScan: WORD, + dwFlags: DWORD, + time: DWORD, + dwExtraInfo: ULONG_PTR, +}} +pub type PKEYBDINPUT = *mut KEYBDINPUT; +pub type LPKEYBDINPUT = *mut KEYBDINPUT; +STRUCT!{struct HARDWAREINPUT { + uMsg: DWORD, + wParamL: WORD, + wParamH: WORD, +}} +pub type PHARDWAREINPUT = *mut HARDWAREINPUT; +pub type LPHARDWAREINPUT= *mut HARDWAREINPUT; +pub const INPUT_MOUSE: DWORD = 0; +pub const INPUT_KEYBOARD: DWORD = 1; +pub const INPUT_HARDWARE: DWORD = 2; +UNION!{union INPUT_u { + [u32; 6] [u64; 4], + mi mi_mut: MOUSEINPUT, + ki ki_mut: KEYBDINPUT, + hi hi_mut: HARDWAREINPUT, +}} +STRUCT!{struct INPUT { + type_: DWORD, + u: INPUT_u, +}} +pub type PINPUT = *mut INPUT; +pub type LPINPUT = *mut INPUT; +extern "system" { + pub fn SendInput( + cInputs: UINT, + pInputs: LPINPUT, + cbSize: c_int, + ) -> UINT; +} +DECLARE_HANDLE!(HTOUCHINPUT, HTOUCHINPUT__); +STRUCT!{struct TOUCHINPUT { + x: LONG, + y: LONG, + hSource: HANDLE, + dwID: DWORD, + dwFlags: DWORD, + dwMask: DWORD, + dwTime: DWORD, + dwExtraInfo: ULONG_PTR, + cxContact: DWORD, + cyContact: DWORD, +}} +pub type PTOUCHINPUT = *mut TOUCHINPUT; +pub type PCTOUCHINPUT = *const TOUCHINPUT; +// TOUCH_COORD_TO_PIXEL +pub const TOUCHEVENTF_MOVE: DWORD = 0x0001; +pub const TOUCHEVENTF_DOWN: DWORD = 0x0002; +pub const TOUCHEVENTF_UP: DWORD = 0x0004; +pub const TOUCHEVENTF_INRANGE: DWORD = 0x0008; +pub const TOUCHEVENTF_PRIMARY: DWORD = 0x0010; +pub const TOUCHEVENTF_NOCOALESCE: DWORD = 0x0020; +pub const TOUCHEVENTF_PEN: DWORD = 0x0040; +pub const TOUCHEVENTF_PALM: DWORD = 0x0080; +pub const TOUCHINPUTMASKF_TIMEFROMSYSTEM: DWORD = 0x0001; +pub const TOUCHINPUTMASKF_EXTRAINFO: DWORD = 0x0002; +pub const TOUCHINPUTMASKF_CONTACTAREA: DWORD = 0x0004; +extern "system" { + pub fn GetTouchInputInfo( + hTouchInput: HTOUCHINPUT, + cInputs: c_uint, + pInputs: PTOUCHINPUT, + cbSize: c_int, + ) -> BOOL; + pub fn CloseTouchInputHandle( + hTouchInput: HTOUCHINPUT, + ) -> BOOL; +} +pub const TWF_FINETOUCH: DWORD = 0x00000001; +pub const TWF_WANTPALM: DWORD = 0x00000002; +extern "system" { + pub fn RegisterTouchWindow( + hWnd: HWND, + flags: ULONG, + ) -> BOOL; + pub fn UnregisterTouchWindow( + hwnd: HWND, + ) -> BOOL; + pub fn IsTouchWindow( + hwnd: HWND, + pulFlags: PULONG, + ) -> BOOL; +} +ENUM!{enum POINTER_INPUT_TYPE { + PT_POINTER = 0x00000001, + PT_TOUCH = 0x00000002, + PT_PEN = 0x00000003, + PT_MOUSE = 0x00000004, + PT_TOUCHPAD = 0x00000005, +}} +ENUM!{enum POINTER_FLAGS { + POINTER_FLAG_NONE = 0x00000000, + POINTER_FLAG_NEW = 0x00000001, + POINTER_FLAG_INRANGE = 0x00000002, + POINTER_FLAG_INCONTACT = 0x00000004, + POINTER_FLAG_FIRSTBUTTON = 0x00000010, + POINTER_FLAG_SECONDBUTTON = 0x00000020, + POINTER_FLAG_THIRDBUTTON = 0x00000040, + POINTER_FLAG_FOURTHBUTTON = 0x00000080, + POINTER_FLAG_FIFTHBUTTON = 0x00000100, + POINTER_FLAG_PRIMARY = 0x00002000, + POINTER_FLAG_CONFIDENCE = 0x00004000, + POINTER_FLAG_CANCELED = 0x00008000, + POINTER_FLAG_DOWN = 0x00010000, + POINTER_FLAG_UPDATE = 0x00020000, + POINTER_FLAG_UP = 0x00040000, + POINTER_FLAG_WHEEL = 0x00080000, + POINTER_FLAG_HWHEEL = 0x00100000, + POINTER_FLAG_CAPTURECHANGED = 0x00200000, + POINTER_FLAG_HASTRANSFORM = 0x00400000, +}} +pub const POINTER_MOD_SHIFT: DWORD = 0x0004; +pub const POINTER_MOD_CTRL: DWORD = 0x0008; +ENUM!{enum POINTER_BUTTON_CHANGE_TYPE { + POINTER_CHANGE_NONE, + POINTER_CHANGE_FIRSTBUTTON_DOWN, + POINTER_CHANGE_FIRSTBUTTON_UP, + POINTER_CHANGE_SECONDBUTTON_DOWN, + POINTER_CHANGE_SECONDBUTTON_UP, + POINTER_CHANGE_THIRDBUTTON_DOWN, + POINTER_CHANGE_THIRDBUTTON_UP, + POINTER_CHANGE_FOURTHBUTTON_DOWN, + POINTER_CHANGE_FOURTHBUTTON_UP, + POINTER_CHANGE_FIFTHBUTTON_DOWN, + POINTER_CHANGE_FIFTHBUTTON_UP, +}} +STRUCT!{struct POINTER_INFO { + pointerType: POINTER_INPUT_TYPE, + pointerId: UINT32, + frameId: UINT32, + pointerFlags: POINTER_FLAGS, + sourceDevice: HANDLE, + hwndTarget: HWND, + ptPixelLocation: POINT, + ptHimetricLocation: POINT, + ptPixelLocationRaw: POINT, + ptHimetricLocationRaw: POINT, + dwTime: DWORD, + historyCount: UINT32, + InputData: INT32, + dwKeyStates: DWORD, + PerformanceCount: UINT64, + ButtonChangeType: POINTER_BUTTON_CHANGE_TYPE, +}} +ENUM!{enum TOUCH_FLAGS { + TOUCH_FLAG_NONE = 0x00000000, +}} +ENUM!{enum TOUCH_MASK { + TOUCH_MASK_NONE = 0x00000000, + TOUCH_MASK_CONTACTAREA = 0x00000001, + TOUCH_MASK_ORIENTATION = 0x00000002, + TOUCH_MASK_PRESSURE = 0x00000004, +}} +STRUCT!{struct POINTER_TOUCH_INFO { + pointerInfo: POINTER_INFO, + touchFlags: TOUCH_FLAGS, + touchMask: TOUCH_MASK, + rcContact: RECT, + rcContactRaw: RECT, + orientation: UINT32, + pressure: UINT32, +}} +ENUM!{enum PEN_FLAGS { + PEN_FLAG_NONE = 0x00000000, + PEN_FLAG_BARREL = 0x00000001, + PEN_FLAG_INVERTED = 0x00000002, + PEN_FLAG_ERASER = 0x00000004, +}} +ENUM!{enum PEN_MASK { + PEN_MASK_NONE = 0x00000000, + PEN_MASK_PRESSURE = 0x00000001, + PEN_MASK_ROTATION = 0x00000002, + PEN_MASK_TILT_X = 0x00000004, + PEN_MASK_TILT_Y = 0x00000008, +}} +STRUCT!{struct POINTER_PEN_INFO { + pointerInfo: POINTER_INFO, + penFlags: PEN_FLAGS, + penMask: PEN_MASK, + pressure: UINT32, + rotation: UINT32, + tiltX: INT32, + tiltY: INT32, +}} +pub const POINTER_MESSAGE_FLAG_NEW: DWORD = 0x00000001; +pub const POINTER_MESSAGE_FLAG_INRANGE: DWORD = 0x00000002; +pub const POINTER_MESSAGE_FLAG_INCONTACT: DWORD = 0x00000004; +pub const POINTER_MESSAGE_FLAG_FIRSTBUTTON: DWORD = 0x00000010; +pub const POINTER_MESSAGE_FLAG_SECONDBUTTON: DWORD = 0x00000020; +pub const POINTER_MESSAGE_FLAG_THIRDBUTTON: DWORD = 0x00000040; +pub const POINTER_MESSAGE_FLAG_FOURTHBUTTON: DWORD = 0x00000080; +pub const POINTER_MESSAGE_FLAG_FIFTHBUTTON: DWORD = 0x00000100; +pub const POINTER_MESSAGE_FLAG_PRIMARY: DWORD = 0x00002000; +pub const POINTER_MESSAGE_FLAG_CONFIDENCE: DWORD = 0x00004000; +pub const POINTER_MESSAGE_FLAG_CANCELED: DWORD = 0x00008000; +pub const PA_ACTIVATE: UINT = MA_ACTIVATE; +pub const PA_NOACTIVATE: UINT = MA_NOACTIVATE; +pub const MAX_TOUCH_COUNT: UINT32 = 256; +pub const TOUCH_FEEDBACK_DEFAULT: DWORD = 0x1; +pub const TOUCH_FEEDBACK_INDIRECT: DWORD = 0x2; +pub const TOUCH_FEEDBACK_NONE: DWORD = 0x3; +extern "system" { + pub fn InitializeTouchInjection( + maxCount: UINT32, + dwMode: DWORD, + ) -> BOOL; + pub fn InjectTouchInput( + count: UINT32, + contacts: *const POINTER_TOUCH_INFO, + ) -> BOOL; +} +STRUCT!{struct USAGE_PROPERTIES { + level: USHORT, + page: USHORT, + usage: USHORT, + logicalMinimum: INT32, + logicalMaximum: INT32, + unit: USHORT, + exponent: USHORT, + count: BYTE, + physicalMinimum: INT32, + physicalMaximum: INT32, +}} +pub type PUSAGE_PROPERTIES = *mut USAGE_PROPERTIES; +UNION!{union POINTER_TYPE_INFO_u { + [u64; 17] [u64; 18], + touchInfo touchInfo_mut: POINTER_TOUCH_INFO, + penInfo penInfo_mut: POINTER_PEN_INFO, +}} +STRUCT!{struct POINTER_TYPE_INFO { + type_: POINTER_INPUT_TYPE, + u: POINTER_TYPE_INFO_u, +}} +pub type PPOINTER_TYPE_INFO = *mut POINTER_TYPE_INFO; +STRUCT!{struct INPUT_INJECTION_VALUE { + page: USHORT, + usage: USHORT, + value: INT32, + index: USHORT, +}} +pub type PINPUT_INJECTION_VALUE = *mut INPUT_INJECTION_VALUE; +extern "system" { + pub fn GetPointerType( + pointerId: UINT32, + pointerType: *mut POINTER_INPUT_TYPE, + ) -> BOOL; + pub fn GetPointerCursorId( + pointerId: UINT32, + cursorId: *mut UINT32, + ) -> BOOL; + pub fn GetPointerInfo( + pointerId: UINT32, + pointerInfo: *mut POINTER_INFO, + ) -> BOOL; + pub fn GetPointerInfoHistory( + pointerId: UINT32, + entriesCount: *mut UINT32, + pointerInfo: *mut POINTER_INFO, + ) -> BOOL; + pub fn GetPointerFrameInfo( + pointerId: UINT32, + pointerCount: *mut UINT32, + pointerInfo: *mut POINTER_INFO, + ) -> BOOL; + pub fn GetPointerFrameInfoHistory( + pointerId: UINT32, + entriesCount: *mut UINT32, + pointerCount: *mut UINT32, + pointerInfo: *mut POINTER_INFO, + ) -> BOOL; + pub fn GetPointerTouchInfo( + pointerId: UINT32, + touchInfo: *mut POINTER_TOUCH_INFO, + ) -> BOOL; + pub fn GetPointerTouchInfoHistory( + pointerId: UINT32, + entriesCount: *mut UINT32, + touchInfo: *mut POINTER_TOUCH_INFO, + ) -> BOOL; + pub fn GetPointerFrameTouchInfo( + pointerId: UINT32, + pointerCount: *mut UINT32, + touchInfo: *mut POINTER_TOUCH_INFO, + ) -> BOOL; + pub fn GetPointerFrameTouchInfoHistory( + pointerId: UINT32, + entriesCount: *mut UINT32, + pointerCount: *mut UINT32, + touchInfo: *mut POINTER_TOUCH_INFO, + ) -> BOOL; + pub fn GetPointerPenInfo( + pointerId: UINT32, + penInfo: *mut POINTER_PEN_INFO, + ) -> BOOL; + pub fn GetPointerPenInfoHistory( + pointerId: UINT32, + entriesCount: *mut UINT32, + penInfo: *mut POINTER_PEN_INFO, + ) -> BOOL; + pub fn GetPointerFramePenInfo( + pointerId: UINT32, + pointerCount: *mut UINT32, + penInfo: *mut POINTER_PEN_INFO, + ) -> BOOL; + pub fn GetPointerFramePenInfoHistory( + pointerId: UINT32, + entriesCount: *mut UINT32, + pointerCount: *mut UINT32, + penInfo: *mut POINTER_PEN_INFO, + ) -> BOOL; + pub fn SkipPointerFrameMessages( + pointerId: UINT32, + ) -> BOOL; + pub fn RegisterPointerInputTarget( + hwnd: HWND, + pointerType: POINTER_INPUT_TYPE, + ) -> BOOL; + pub fn UnregisterPointerInputTarget( + hwnd: HWND, + pointerType: POINTER_INPUT_TYPE, + ) -> BOOL; + pub fn RegisterPointerInputTargetEx( + hwnd: HWND, + pointerType: POINTER_INPUT_TYPE, + fObserve: BOOL, + ) -> BOOL; + pub fn UnregisterPointerInputTargetEx( + hwnd: HWND, + pointerType: POINTER_INPUT_TYPE, + ) -> BOOL; + pub fn EnableMouseInPointer( + fEnable: BOOL, + ) -> BOOL; + pub fn IsMouseInPointerEnabled() -> BOOL; +} +pub const TOUCH_HIT_TESTING_DEFAULT: ULONG = 0x0; +pub const TOUCH_HIT_TESTING_CLIENT: ULONG = 0x1; +pub const TOUCH_HIT_TESTING_NONE: ULONG = 0x2; +extern "system" { + pub fn RegisterTouchHitTestingWindow( + hwnd: HWND, + value: ULONG, + ) -> BOOL; +} +STRUCT!{struct TOUCH_HIT_TESTING_PROXIMITY_EVALUATION { + score: UINT16, + adjustedPoint: POINT, +}} +pub type PTOUCH_HIT_TESTING_PROXIMITY_EVALUATION = *mut TOUCH_HIT_TESTING_PROXIMITY_EVALUATION; +STRUCT!{struct TOUCH_HIT_TESTING_INPUT { + pointerId: UINT32, + point: POINT, + boundingBox: RECT, + nonOccludedBoundingBox: RECT, + orientation: UINT32, +}} +pub type PTOUCH_HIT_TESTING_INPUT = *mut TOUCH_HIT_TESTING_INPUT; +pub const TOUCH_HIT_TESTING_PROXIMITY_CLOSEST: UINT16 = 0x0; +pub const TOUCH_HIT_TESTING_PROXIMITY_FARTHEST: UINT16 = 0xFFF; +extern "system" { + pub fn EvaluateProximityToRect( + controlBoundingBox: *const RECT, + pHitTestingInput: *const TOUCH_HIT_TESTING_INPUT, + pProximityEval: *mut TOUCH_HIT_TESTING_PROXIMITY_EVALUATION, + ) -> BOOL; + pub fn EvaluateProximityToPolygon( + numVertices: UINT32, + controlPolygon: *const POINT, + pHitTestingInput: *const TOUCH_HIT_TESTING_INPUT, + pProximityEval: *mut TOUCH_HIT_TESTING_PROXIMITY_EVALUATION, + ) -> BOOL; + pub fn PackTouchHitTestingProximityEvaluation( + pHitTestingInput: *const TOUCH_HIT_TESTING_INPUT, + pProximityEval: *const TOUCH_HIT_TESTING_PROXIMITY_EVALUATION, + ) -> LRESULT; +} +ENUM!{enum FEEDBACK_TYPE { + FEEDBACK_TOUCH_CONTACTVISUALIZATION = 1, + FEEDBACK_PEN_BARRELVISUALIZATION = 2, + FEEDBACK_PEN_TAP = 3, + FEEDBACK_PEN_DOUBLETAP = 4, + FEEDBACK_PEN_PRESSANDHOLD = 5, + FEEDBACK_PEN_RIGHTTAP = 6, + FEEDBACK_TOUCH_TAP = 7, + FEEDBACK_TOUCH_DOUBLETAP = 8, + FEEDBACK_TOUCH_PRESSANDHOLD = 9, + FEEDBACK_TOUCH_RIGHTTAP = 10, + FEEDBACK_GESTURE_PRESSANDTAP = 11, + FEEDBACK_MAX = 0xFFFFFFFF, +}} +pub const GWFS_INCLUDE_ANCESTORS: DWORD = 0x00000001; +extern "system" { + pub fn GetWindowFeedbackSetting( + hwnd: HWND, + feedback: FEEDBACK_TYPE, + dwFlags: DWORD, + pSize: *mut UINT32, + config: *mut VOID, + ) -> BOOL; + pub fn SetWindowFeedbackSetting( + hwnd: HWND, + feedback: FEEDBACK_TYPE, + dwFlags: DWORD, + size: UINT32, + configuration: *const VOID, + ) -> BOOL; +} +STRUCT!{struct INPUT_TRANSFORM { + m: [[f32; 4]; 4], +}} +extern "system" { + pub fn GetPointerInputTransform( + pointerId: UINT32, + historyCount: UINT32, + inputTransform: *mut INPUT_TRANSFORM, + ) -> BOOL; +} +STRUCT!{struct LASTINPUTINFO { + cbSize: UINT, + dwTime: DWORD, +}} +pub type PLASTINPUTINFO = *mut LASTINPUTINFO; +extern "system" { + pub fn GetLastInputInfo( + plii: PLASTINPUTINFO, + ) -> BOOL; + pub fn MapVirtualKeyA( + nCode: UINT, + uMapType: UINT, + ) -> UINT; + pub fn MapVirtualKeyW( + nCode: UINT, + uMapType: UINT, + ) -> UINT; + pub fn MapVirtualKeyExA( + nCode: UINT, + uMapType: UINT, + dwhkl: HKL, + ) -> UINT; + pub fn MapVirtualKeyExW( + nCode: UINT, + uMapType: UINT, + dwhkl: HKL, + ) -> UINT; +} +pub const MAPVK_VK_TO_VSC: UINT = 0; +pub const MAPVK_VSC_TO_VK: UINT = 1; +pub const MAPVK_VK_TO_CHAR: UINT = 2; +pub const MAPVK_VSC_TO_VK_EX: UINT = 3; +pub const MAPVK_VK_TO_VSC_EX: UINT = 4; +extern "system" { + pub fn GetInputState() -> BOOL; + pub fn GetQueueStatus( + flags: UINT, + ) -> DWORD; + pub fn GetCapture() -> HWND; + pub fn SetCapture( + hWnd: HWND, + ) -> HWND; + pub fn ReleaseCapture() -> BOOL; + pub fn MsgWaitForMultipleObjects( + nCount: DWORD, + pHandles: *const HANDLE, + fWaitAll: BOOL, + dwMilliseconds: DWORD, + dwWakeMask: DWORD, + ) -> DWORD; + pub fn MsgWaitForMultipleObjectsEx( + nCount: DWORD, + pHandles: *const HANDLE, + dwMilliseconds: DWORD, + dwWakeMask: DWORD, + dwFlags: DWORD, + ) -> DWORD; +} +pub const MWMO_WAITALL: UINT = 0x0001; +pub const MWMO_ALERTABLE: UINT = 0x0002; +pub const MWMO_INPUTAVAILABLE: UINT = 0x0004; +pub const QS_KEY: UINT = 0x0001; +pub const QS_MOUSEMOVE: UINT = 0x0002; +pub const QS_MOUSEBUTTON: UINT = 0x0004; +pub const QS_POSTMESSAGE: UINT = 0x0008; +pub const QS_TIMER: UINT = 0x0010; +pub const QS_PAINT: UINT = 0x0020; +pub const QS_SENDMESSAGE: UINT = 0x0040; +pub const QS_HOTKEY: UINT = 0x0080; +pub const QS_ALLPOSTMESSAGE: UINT = 0x0100; +pub const QS_RAWINPUT: UINT = 0x0400; +pub const QS_TOUCH: UINT = 0x0800; +pub const QS_POINTER: UINT = 0x1000; +pub const QS_MOUSE: UINT = QS_MOUSEMOVE | QS_MOUSEBUTTON; +pub const QS_INPUT: UINT = QS_MOUSE | QS_KEY | QS_RAWINPUT | QS_TOUCH | QS_POINTER; +pub const QS_ALLEVENTS: UINT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY; +pub const QS_ALLINPUT: UINT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY + | QS_SENDMESSAGE; +pub const USER_TIMER_MAXIMUM: UINT = 0x7FFFFFFF; +pub const USER_TIMER_MINIMUM: UINT = 0x0000000A; +extern "system" { + pub fn SetTimer( + hWnd: HWND, + nIDEvent: UINT_PTR, + uElapse: UINT, + lpTimerFunc: TIMERPROC, + ) -> UINT_PTR; +} +pub const TIMERV_DEFAULT_COALESCING: ULONG = 0; +pub const TIMERV_NO_COALESCING: ULONG = 0xFFFFFFFF; +pub const TIMERV_COALESCING_MIN: ULONG = 1; +pub const TIMERV_COALESCING_MAX: ULONG = 0x7FFFFFF5; +extern "system" { + pub fn SetCoalescableTimer( + hWnd: HWND, + nIDEvent: UINT_PTR, + uElapse: UINT, + lpTimerFunc: TIMERPROC, + uToleranceDelay: ULONG, + ) -> UINT_PTR; + pub fn KillTimer( + hWnd: HWND, + uIDEvent: UINT_PTR, + ) -> BOOL; + pub fn IsWindowUnicode( + hWnd: HWND, + ) -> BOOL; + pub fn EnableWindow( + hWnd: HWND, + bEnable: BOOL, + ) -> BOOL; + pub fn IsWindowEnabled( + hWnd: HWND, + ) -> BOOL; + pub fn LoadAcceleratorsA( + hInstance: HINSTANCE, + lpTableName: LPCSTR, + ) -> HACCEL; + pub fn LoadAcceleratorsW( + hInstance: HINSTANCE, + lpTableName: LPCWSTR, + ) -> HACCEL; + pub fn CreateAcceleratorTableA( + paccel: LPACCEL, + cAccel: c_int, + ) -> HACCEL; + pub fn CreateAcceleratorTableW( + paccel: LPACCEL, + cAccel: c_int, + ) -> HACCEL; + pub fn DestroyAcceleratorTable( + hAccel: HACCEL, + ) -> BOOL; + pub fn CopyAcceleratorTableA( + hAccelSrc: HACCEL, + lpAccelDst: LPACCEL, + cAccelEntries: c_int, + ) -> c_int; + pub fn CopyAcceleratorTableW( + hAccelSrc: HACCEL, + lpAccelDst: LPACCEL, + cAccelEntries: c_int, + ) -> c_int; + pub fn TranslateAcceleratorA( + hWnd: HWND, + hAccTable: HACCEL, + lpMsg: LPMSG, + ) -> c_int; + pub fn TranslateAcceleratorW( + hWnd: HWND, + hAccTable: HACCEL, + lpMsg: LPMSG, + ) -> c_int; +} +pub const SM_CXSCREEN: c_int = 0; +pub const SM_CYSCREEN: c_int = 1; +pub const SM_CXVSCROLL: c_int = 2; +pub const SM_CYHSCROLL: c_int = 3; +pub const SM_CYCAPTION: c_int = 4; +pub const SM_CXBORDER: c_int = 5; +pub const SM_CYBORDER: c_int = 6; +pub const SM_CXDLGFRAME: c_int = 7; +pub const SM_CYDLGFRAME: c_int = 8; +pub const SM_CYVTHUMB: c_int = 9; +pub const SM_CXHTHUMB: c_int = 10; +pub const SM_CXICON: c_int = 11; +pub const SM_CYICON: c_int = 12; +pub const SM_CXCURSOR: c_int = 13; +pub const SM_CYCURSOR: c_int = 14; +pub const SM_CYMENU: c_int = 15; +pub const SM_CXFULLSCREEN: c_int = 16; +pub const SM_CYFULLSCREEN: c_int = 17; +pub const SM_CYKANJIWINDOW: c_int = 18; +pub const SM_MOUSEPRESENT: c_int = 19; +pub const SM_CYVSCROLL: c_int = 20; +pub const SM_CXHSCROLL: c_int = 21; +pub const SM_DEBUG: c_int = 22; +pub const SM_SWAPBUTTON: c_int = 23; +pub const SM_RESERVED1: c_int = 24; +pub const SM_RESERVED2: c_int = 25; +pub const SM_RESERVED3: c_int = 26; +pub const SM_RESERVED4: c_int = 27; +pub const SM_CXMIN: c_int = 28; +pub const SM_CYMIN: c_int = 29; +pub const SM_CXSIZE: c_int = 30; +pub const SM_CYSIZE: c_int = 31; +pub const SM_CXFRAME: c_int = 32; +pub const SM_CYFRAME: c_int = 33; +pub const SM_CXMINTRACK: c_int = 34; +pub const SM_CYMINTRACK: c_int = 35; +pub const SM_CXDOUBLECLK: c_int = 36; +pub const SM_CYDOUBLECLK: c_int = 37; +pub const SM_CXICONSPACING: c_int = 38; +pub const SM_CYICONSPACING: c_int = 39; +pub const SM_MENUDROPALIGNMENT: c_int = 40; +pub const SM_PENWINDOWS: c_int = 41; +pub const SM_DBCSENABLED: c_int = 42; +pub const SM_CMOUSEBUTTONS: c_int = 43; +pub const SM_CXFIXEDFRAME: c_int = SM_CXDLGFRAME; +pub const SM_CYFIXEDFRAME: c_int = SM_CYDLGFRAME; +pub const SM_CXSIZEFRAME: c_int = SM_CXFRAME; +pub const SM_CYSIZEFRAME: c_int = SM_CYFRAME; +pub const SM_SECURE: c_int = 44; +pub const SM_CXEDGE: c_int = 45; +pub const SM_CYEDGE: c_int = 46; +pub const SM_CXMINSPACING: c_int = 47; +pub const SM_CYMINSPACING: c_int = 48; +pub const SM_CXSMICON: c_int = 49; +pub const SM_CYSMICON: c_int = 50; +pub const SM_CYSMCAPTION: c_int = 51; +pub const SM_CXSMSIZE: c_int = 52; +pub const SM_CYSMSIZE: c_int = 53; +pub const SM_CXMENUSIZE: c_int = 54; +pub const SM_CYMENUSIZE: c_int = 55; +pub const SM_ARRANGE: c_int = 56; +pub const SM_CXMINIMIZED: c_int = 57; +pub const SM_CYMINIMIZED: c_int = 58; +pub const SM_CXMAXTRACK: c_int = 59; +pub const SM_CYMAXTRACK: c_int = 60; +pub const SM_CXMAXIMIZED: c_int = 61; +pub const SM_CYMAXIMIZED: c_int = 62; +pub const SM_NETWORK: c_int = 63; +pub const SM_CLEANBOOT: c_int = 67; +pub const SM_CXDRAG: c_int = 68; +pub const SM_CYDRAG: c_int = 69; +pub const SM_SHOWSOUNDS: c_int = 70; +pub const SM_CXMENUCHECK: c_int = 71; +pub const SM_CYMENUCHECK: c_int = 72; +pub const SM_SLOWMACHINE: c_int = 73; +pub const SM_MIDEASTENABLED: c_int = 74; +pub const SM_MOUSEWHEELPRESENT: c_int = 75; +pub const SM_XVIRTUALSCREEN: c_int = 76; +pub const SM_YVIRTUALSCREEN: c_int = 77; +pub const SM_CXVIRTUALSCREEN: c_int = 78; +pub const SM_CYVIRTUALSCREEN: c_int = 79; +pub const SM_CMONITORS: c_int = 80; +pub const SM_SAMEDISPLAYFORMAT: c_int = 81; +pub const SM_IMMENABLED: c_int = 82; +pub const SM_CXFOCUSBORDER: c_int = 83; +pub const SM_CYFOCUSBORDER: c_int = 84; +pub const SM_TABLETPC: c_int = 86; +pub const SM_MEDIACENTER: c_int = 87; +pub const SM_STARTER: c_int = 88; +pub const SM_SERVERR2: c_int = 89; +pub const SM_MOUSEHORIZONTALWHEELPRESENT: c_int = 91; +pub const SM_CXPADDEDBORDER: c_int = 92; +pub const SM_DIGITIZER: c_int = 94; +pub const SM_MAXIMUMTOUCHES: c_int = 95; +pub const SM_CMETRICS: c_int = 97; +pub const SM_REMOTESESSION: c_int = 0x1000; +pub const SM_SHUTTINGDOWN: c_int = 0x2000; +pub const SM_REMOTECONTROL: c_int = 0x2001; +pub const SM_CARETBLINKINGENABLED: c_int = 0x2002; +pub const SM_CONVERTIBLESLATEMODE: c_int = 0x2003; +pub const SM_SYSTEMDOCKED: c_int = 0x2004; +extern "system" { + pub fn GetSystemMetrics( + nIndex: c_int, + ) -> c_int; + pub fn GetSystemMetricsForDpi( + nIndex: c_int, + dpi: UINT, + ) -> c_int; + pub fn LoadMenuA( + hInstance: HINSTANCE, + lpMenuName: LPCSTR, + ) -> HMENU; + pub fn LoadMenuW( + hInstance: HINSTANCE, + lpMenuName: LPCWSTR, + ) -> HMENU; + pub fn LoadMenuIndirectA( + lpMenuTemplate: *const MENUTEMPLATEA, + ) -> HMENU; + pub fn LoadMenuIndirectW( + lpMenuTemplate: *const MENUTEMPLATEW, + ) -> HMENU; + pub fn GetMenu( + hWnd: HWND, + ) -> HMENU; + pub fn SetMenu( + hWnd: HWND, + hMenu: HMENU, + ) -> BOOL; + pub fn ChangeMenuA( + hMenu: HMENU, + cmd: UINT, + lpszNewItem: LPCSTR, + cmdInsert: UINT, + flags: UINT, + ) -> BOOL; + pub fn ChangeMenuW( + hMenu: HMENU, + cmd: UINT, + lpszNewItem: LPCWSTR, + cmdInsert: UINT, + flags: UINT, + ) -> BOOL; + pub fn HiliteMenuItem( + hWnd: HWND, + hMenu: HMENU, + uIDHiliteItem: UINT, + uHilite: UINT, + ) -> BOOL; + pub fn GetMenuStringA( + hMenu: HMENU, + uIDItem: UINT, + lpString: LPSTR, + cchMax: c_int, + flags: UINT, + ) -> c_int; + pub fn GetMenuStringW( + hMenu: HMENU, + uIDItem: UINT, + lpString: LPWSTR, + cchMax: c_int, + flags: UINT, + ) -> c_int; + pub fn GetMenuState( + hMenu: HMENU, + uId: UINT, + uFlags: UINT, + ) -> UINT; + pub fn DrawMenuBar( + hwnd: HWND, + ) -> BOOL; +} +pub const PMB_ACTIVE: DWORD = 0x00000001; +extern "system" { + pub fn GetSystemMenu( + hWnd: HWND, + bRevert: BOOL, + ) -> HMENU; + pub fn CreateMenu() -> HMENU; + pub fn CreatePopupMenu() ->HMENU; + pub fn DestroyMenu( + hMenu: HMENU, + ) -> BOOL; + pub fn CheckMenuItem( + hMenu: HMENU, + uIDCheckItem: UINT, + uCheck: UINT, + ) -> DWORD; + pub fn EnableMenuItem( + hMenu: HMENU, + uIDEnableItem: UINT, + uEnable: UINT, + ) -> BOOL; + pub fn GetSubMenu( + hMenu: HMENU, + nPos: c_int, + ) -> HMENU; + pub fn GetMenuItemID( + hMenu: HMENU, + nPos: c_int, + ) -> UINT; + pub fn GetMenuItemCount( + hMenu: HMENU, + ) -> c_int; + pub fn InsertMenuA( + hMenu: HMENU, + uPosition: UINT, + uFlags: UINT, + uIDNewItem: UINT_PTR, + lpNewItem: LPCSTR, + ) -> BOOL; + pub fn InsertMenuW( + hMenu: HMENU, + uPosition: UINT, + uFlags: UINT, + uIDNewItem: UINT_PTR, + lpNewItem: LPCWSTR, + ) -> BOOL; + pub fn AppendMenuA( + hMenu: HMENU, + uFlags: UINT, + uIDNewItem: UINT_PTR, + lpNewItem: LPCSTR, + ) -> BOOL; + pub fn AppendMenuW( + hMenu: HMENU, + uFlags: UINT, + uIDNewItem: UINT_PTR, + lpNewItem: LPCWSTR, + ) -> BOOL; + pub fn ModifyMenuA( + hMnu: HMENU, + uPosition: UINT, + uFlags: UINT, + uIDNewItem: UINT_PTR, + lpNewItem: LPCSTR, + ) -> BOOL; + pub fn ModifyMenuW( + hMnu: HMENU, + uPosition: UINT, + uFlags: UINT, + uIDNewItem: UINT_PTR, + lpNewItem: LPCWSTR, + ) -> BOOL; + pub fn RemoveMenu( + hMenu: HMENU, + uPosition: UINT, + uFlags: UINT, + ) -> BOOL; + pub fn DeleteMenu( + hMenu: HMENU, + uPosition: UINT, + uFlags: UINT, + ) -> BOOL; + pub fn SetMenuItemBitmaps( + hMenu: HMENU, + uPosition: UINT, + uFlags: UINT, + hBitmapUnchecked: HBITMAP, + hBitmapChecked: HBITMAP, + ) -> BOOL; + pub fn GetMenuCheckMarkDimensions() -> LONG; + pub fn TrackPopupMenu( + hMenu: HMENU, + uFlags: UINT, + x: c_int, + y: c_int, + nReserved: c_int, + hWnd: HWND, + prcRect: *const RECT, + ) -> BOOL; +} +pub const MNC_IGNORE: DWORD = 0; +pub const MNC_CLOSE: DWORD = 1; +pub const MNC_EXECUTE: DWORD = 2; +pub const MNC_SELECT: DWORD = 3; +STRUCT!{struct TPMPARAMS { + cbSize: UINT, + rcExclude: RECT, +}} +pub type LPTPMPARAMS = *mut TPMPARAMS; +extern "system" { + pub fn TrackPopupMenuEx( + hMenu: HMENU, + uFlags: UINT, + x: INT, + y: INT, + hwnd: HWND, + lptpm: LPTPMPARAMS, + ) -> BOOL; + pub fn CalculatePopupWindowPosition( + anchorPoint: *const POINT, + windowSize: *const SIZE, + flags: UINT, + excludeRect: *mut RECT, + popupWindowPosition: *mut RECT, + ) -> BOOL; +} +pub const MNS_NOCHECK: DWORD = 0x80000000; +pub const MNS_MODELESS: DWORD = 0x40000000; +pub const MNS_DRAGDROP: DWORD = 0x20000000; +pub const MNS_AUTODISMISS: DWORD = 0x10000000; +pub const MNS_NOTIFYBYPOS: DWORD = 0x08000000; +pub const MNS_CHECKORBMP: DWORD = 0x04000000; +pub const MIM_MAXHEIGHT: DWORD = 0x00000001; +pub const MIM_BACKGROUND: DWORD = 0x00000002; +pub const MIM_HELPID: DWORD = 0x00000004; +pub const MIM_MENUDATA: DWORD = 0x00000008; +pub const MIM_STYLE: DWORD = 0x00000010; +pub const MIM_APPLYTOSUBMENUS: DWORD = 0x80000000; +STRUCT!{struct MENUINFO { + cbSize: DWORD, + fMask: DWORD, + dwStyle: DWORD, + cyMax: UINT, + hbrBack: HBRUSH, + dwContextHelpID: DWORD, + dwMenuData: ULONG_PTR, +}} +pub type LPMENUINFO = *mut MENUINFO; +pub type LPCMENUINFO = *const MENUINFO; +extern "system" { + pub fn GetMenuInfo( + hMenu: HMENU, + lpcmi: LPMENUINFO, + ) -> BOOL; + pub fn SetMenuInfo( + hMenu: HMENU, + lpcmi: LPCMENUINFO, + ) -> BOOL; + pub fn EndMenu( + hMenu: HMENU, + uFlags: UINT, + uIDNewItem: UINT_PTR, + lpNewItem: LPCSTR, + ) -> BOOL; +} +pub const MND_CONTINUE: DWORD = 0; +pub const MND_ENDMENU: DWORD = 1; +STRUCT!{struct MENUGETOBJECTINFO { + dwFlags: DWORD, + uPos: UINT, + hmenu: HMENU, + riid: PVOID, + pvObj: PVOID, +}} +pub type PMENUGETOBJECTINFO = *mut MENUGETOBJECTINFO; +pub const MNGOF_TOPGAP: DWORD = 0x00000001; +pub const MNGOF_BOTTOMGAP: DWORD = 0x00000002; +pub const MNGO_NOINTERFACE: DWORD = 0x00000000; +pub const MNGO_NOERROR: DWORD = 0x00000001; +pub const MIIM_STATE: DWORD = 0x00000001; +pub const MIIM_ID: DWORD = 0x00000002; +pub const MIIM_SUBMENU: DWORD = 0x00000004; +pub const MIIM_CHECKMARKS: DWORD = 0x00000008; +pub const MIIM_TYPE: DWORD = 0x00000010; +pub const MIIM_DATA: DWORD = 0x00000020; +pub const MIIM_STRING: DWORD = 0x00000040; +pub const MIIM_BITMAP: DWORD = 0x00000080; +pub const MIIM_FTYPE: DWORD = 0x00000100; +pub const HBMMENU_CALLBACK: HBITMAP = -1isize as HBITMAP; +pub const HBMMENU_SYSTEM: HBITMAP = 1 as HBITMAP; +pub const HBMMENU_MBAR_RESTORE: HBITMAP = 2 as HBITMAP; +pub const HBMMENU_MBAR_MINIMIZE: HBITMAP = 3 as HBITMAP; +pub const HBMMENU_MBAR_CLOSE: HBITMAP = 5 as HBITMAP; +pub const HBMMENU_MBAR_CLOSE_D: HBITMAP = 6 as HBITMAP; +pub const HBMMENU_MBAR_MINIMIZE_D: HBITMAP = 7 as HBITMAP; +pub const HBMMENU_POPUP_CLOSE: HBITMAP = 8 as HBITMAP; +pub const HBMMENU_POPUP_RESTORE: HBITMAP = 9 as HBITMAP; +pub const HBMMENU_POPUP_MAXIMIZE: HBITMAP = 10 as HBITMAP; +pub const HBMMENU_POPUP_MINIMIZE: HBITMAP = 11 as HBITMAP; +STRUCT!{struct MENUITEMINFOA { + cbSize: UINT, + fMask: UINT, + fType: UINT, + fState: UINT, + wID: UINT, + hSubMenu: HMENU, + hbmpChecked: HBITMAP, + hbmpUnchecked: HBITMAP, + dwItemData: ULONG_PTR, + dwTypeData: LPSTR, + cch: UINT, + hbmpItem: HBITMAP, +}} +pub type LPMENUITEMINFOA = *mut MENUITEMINFOA; +pub type LPCMENUITEMINFOA = *const MENUITEMINFOA; +STRUCT!{struct MENUITEMINFOW { + cbSize: UINT, + fMask: UINT, + fType: UINT, + fState: UINT, + wID: UINT, + hSubMenu: HMENU, + hbmpChecked: HBITMAP, + hbmpUnchecked: HBITMAP, + dwItemData: ULONG_PTR, + dwTypeData: LPWSTR, + cch: UINT, + hbmpItem: HBITMAP, +}} +pub type LPMENUITEMINFOW = *mut MENUITEMINFOW; +pub type LPCMENUITEMINFOW = *const MENUITEMINFOW; +extern "system" { + pub fn InsertMenuItemA( + hmenu: HMENU, + item: UINT, + fByPosition: BOOL, + lpmi: LPCMENUITEMINFOA, + ) -> BOOL; + pub fn InsertMenuItemW( + hmenu: HMENU, + item: UINT, + fByPosition: BOOL, + lpmi: LPCMENUITEMINFOW, + ) -> BOOL; + pub fn GetMenuItemInfoA( + hMenu: HMENU, + uItem: UINT, + fByPosition: BOOL, + lpmii: LPMENUITEMINFOA + ) -> BOOL; + pub fn GetMenuItemInfoW( + hMenu: HMENU, + uItem: UINT, + fByPosition: BOOL, + lpmii: LPMENUITEMINFOW + ) -> BOOL; + pub fn SetMenuItemInfoA( + hmenu: HMENU, + item: UINT, + fByPositon: BOOL, + lpmii: LPCMENUITEMINFOA, + ) -> BOOL; + pub fn SetMenuItemInfoW( + hmenu: HMENU, + item: UINT, + fByPositon: BOOL, + lpmii: LPCMENUITEMINFOW, + ) -> BOOL; +} +pub const GMDI_USEDISABLED: DWORD = 0x0001; +pub const GMDI_GOINTOPOPUPS: DWORD = 0x0002; +extern "system" { + pub fn GetMenuDefaultItem( + hMenu: HMENU, + fByPos: UINT, + gmdiFlags: UINT, + ) -> UINT; + pub fn SetMenuDefaultItem( + hMenu: HMENU, + uItem: UINT, + fByPos: UINT, + ) -> BOOL; + pub fn GetMenuItemRect( + hWnd: HWND, + hMenu: HMENU, + uItem: UINT, + lprcItem: LPRECT, + ) -> BOOL; + pub fn MenuItemFromPoint( + hWnd: HWND, + hMenu: HMENU, + ptScreen: POINT, + ) -> c_int; +} +pub const TPM_LEFTBUTTON: UINT = 0x0000; +pub const TPM_RIGHTBUTTON: UINT = 0x0002; +pub const TPM_LEFTALIGN: UINT = 0x0000; +pub const TPM_CENTERALIGN: UINT = 0x0004; +pub const TPM_RIGHTALIGN: UINT = 0x0008; +pub const TPM_TOPALIGN: UINT = 0x0000; +pub const TPM_VCENTERALIGN: UINT = 0x0010; +pub const TPM_BOTTOMALIGN: UINT = 0x0020; +pub const TPM_HORIZONTAL: UINT = 0x0000; +pub const TPM_VERTICAL: UINT = 0x0040; +pub const TPM_NONOTIFY: UINT = 0x0080; +pub const TPM_RETURNCMD: UINT = 0x0100; +pub const TPM_RECURSE: UINT = 0x0001; +pub const TPM_HORPOSANIMATION: UINT = 0x0400; +pub const TPM_HORNEGANIMATION: UINT = 0x0800; +pub const TPM_VERPOSANIMATION: UINT = 0x1000; +pub const TPM_VERNEGANIMATION: UINT = 0x2000; +pub const TPM_NOANIMATION: UINT = 0x4000; +pub const TPM_LAYOUTRTL: UINT = 0x8000; +pub const TPM_WORKAREA: UINT = 0x10000; +STRUCT!{struct DROPSTRUCT { + hwndSource: HWND, + hwndSink: HWND, + wFmt: DWORD, + dwData: ULONG_PTR, + ptDrop: POINT, + dwControlData: DWORD, +}} +pub type PDROPSTRUCT = *mut DROPSTRUCT; +pub type LPDROPSTRUCT = *mut DROPSTRUCT; +pub const DOF_EXECUTABLE: DWORD = 0x8001; +pub const DOF_DOCUMENT: DWORD = 0x8002; +pub const DOF_DIRECTORY: DWORD = 0x8003; +pub const DOF_MULTIPLE: DWORD = 0x8004; +pub const DOF_PROGMAN: DWORD = 0x0001; +pub const DOF_SHELLDATA: DWORD = 0x0002; +pub const DO_DROPFILE: DWORD = 0x454C4946; +pub const DO_PRINTFILE: DWORD = 0x544E5250; +extern "system" { + pub fn DragObject( + hwndParent: HWND, + hwndFrom: HWND, + fmt: UINT, + data: ULONG_PTR, + hcur: HCURSOR, + ) -> DWORD; + pub fn DragDetect( + hwnd: HWND, + pt: POINT, + ) -> BOOL; + pub fn DrawIcon( + hDC: HDC, + x: c_int, + y: c_int, + hIcon: HICON, + ) -> BOOL; +} +pub const DT_TOP: UINT = 0x00000000; +pub const DT_LEFT: UINT = 0x00000000; +pub const DT_CENTER: UINT = 0x00000001; +pub const DT_RIGHT: UINT = 0x00000002; +pub const DT_VCENTER: UINT = 0x00000004; +pub const DT_BOTTOM: UINT = 0x00000008; +pub const DT_WORDBREAK: UINT = 0x00000010; +pub const DT_SINGLELINE: UINT = 0x00000020; +pub const DT_EXPANDTABS: UINT = 0x00000040; +pub const DT_TABSTOP: UINT = 0x00000080; +pub const DT_NOCLIP: UINT = 0x00000100; +pub const DT_EXTERNALLEADING: UINT = 0x00000200; +pub const DT_CALCRECT: UINT = 0x00000400; +pub const DT_NOPREFIX: UINT = 0x00000800; +pub const DT_INTERNAL: UINT = 0x00001000; +pub const DT_EDITCONTROL: UINT = 0x00002000; +pub const DT_PATH_ELLIPSIS: UINT = 0x00004000; +pub const DT_END_ELLIPSIS: UINT = 0x00008000; +pub const DT_MODIFYSTRING: UINT = 0x00010000; +pub const DT_RTLREADING: UINT = 0x00020000; +pub const DT_WORD_ELLIPSIS: UINT = 0x00040000; +pub const DT_NOFULLWIDTHCHARBREAK: UINT = 0x00080000; +pub const DT_HIDEPREFIX: UINT = 0x00100000; +pub const DT_PREFIXONLY: UINT = 0x00200000; +STRUCT!{struct DRAWTEXTPARAMS { + cbSize: UINT, + iTabLength: c_int, + iLeftMargin: c_int, + iRightMargin: c_int, + uiLengthDrawn: UINT, +}} +pub type LPDRAWTEXTPARAMS = *mut DRAWTEXTPARAMS; +extern "system" { + pub fn DrawTextA( + hdc: HDC, + lpchText: LPCSTR, + cchText: c_int, + lprc: LPRECT, + format: UINT, + ) -> c_int; + pub fn DrawTextW( + hdc: HDC, + lpchText: LPCWSTR, + cchText: c_int, + lprc: LPRECT, + format: UINT, + ) -> c_int; + pub fn DrawTextExA( + hdc: HDC, + lpchText: LPCSTR, + cchText: c_int, + lprc: LPRECT, + format: UINT, + lpdtp: LPDRAWTEXTPARAMS, + ) -> c_int; + pub fn DrawTextExW( + hdc: HDC, + lpchText: LPCWSTR, + cchText: c_int, + lprc: LPRECT, + format: UINT, + lpdtp: LPDRAWTEXTPARAMS, + ) -> c_int; + pub fn GrayStringA( + hDC: HDC, + hBrush: HBRUSH, + lpOutputFunc: GRAYSTRINGPROC, + lpData: LPARAM, + nCount: c_int, + X: c_int, + Y: c_int, + nWidth: c_int, + nHeight: c_int, + ) -> BOOL; + pub fn GrayStringW( + hDC: HDC, + hBrush: HBRUSH, + lpOutputFunc: GRAYSTRINGPROC, + lpData: LPARAM, + nCount: c_int, + X: c_int, + Y: c_int, + nWidth: c_int, + nHeight: c_int, + ) -> BOOL; +} +pub const DST_COMPLEX: UINT = 0x0000; +pub const DST_TEXT: UINT = 0x0001; +pub const DST_PREFIXTEXT: UINT = 0x0002; +pub const DST_ICON: UINT = 0x0003; +pub const DST_BITMAP: UINT = 0x0004; +pub const DSS_NORMAL: UINT = 0x0000; +pub const DSS_UNION: UINT = 0x0010; +pub const DSS_DISABLED: UINT = 0x0020; +pub const DSS_MONO: UINT = 0x0080; +pub const DSS_HIDEPREFIX: UINT = 0x0200; +pub const DSS_PREFIXONLY: UINT = 0x0400; +pub const DSS_RIGHT: UINT = 0x8000; +extern "system" { + pub fn DrawStateA( + hdc: HDC, + hbrFore: HBRUSH, + qfnCallBack: DRAWSTATEPROC, + lData: LPARAM, + wData: WPARAM, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + uFlags: UINT, + ) -> BOOL; + pub fn DrawStateW( + hdc: HDC, + hbrFore: HBRUSH, + qfnCallBack: DRAWSTATEPROC, + lData: LPARAM, + wData: WPARAM, + x: c_int, + y: c_int, + cx: c_int, + cy: c_int, + uFlags: UINT, + ) -> BOOL; + pub fn TabbedTextOutA( + hdc: HDC, + x: c_int, + y: c_int, + lpString: LPCSTR, + chCount: c_int, + nTabPositions: c_int, + lpnTabStopPositions: *const INT, + nTabOrigin: c_int, + ) -> LONG; + pub fn TabbedTextOutW( + hdc: HDC, + x: c_int, + y: c_int, + lpString: LPCWSTR, + chCount: c_int, + nTabPositions: c_int, + lpnTabStopPositions: *const INT, + nTabOrigin: c_int, + ) -> LONG; + pub fn GetTabbedTextExtentA( + hdc: HDC, + lpString: LPCSTR, + chCount: c_int, + nTabPositions: c_int, + lpnTabStopPositions: *const INT, + ) -> DWORD; + pub fn GetTabbedTextExtentW( + hdc: HDC, + lpString: LPCWSTR, + chCount: c_int, + nTabPositions: c_int, + lpnTabStopPositions: *const INT, + ) -> DWORD; + pub fn UpdateWindow( + hWnd: HWND, + ) -> BOOL; + pub fn SetActiveWindow( + hWnd: HWND, + ) -> HWND; + pub fn GetForegroundWindow() -> HWND; + pub fn PaintDesktop( + hdc: HDC, + ) -> BOOL; + pub fn SwitchToThisWindow( + hwnd: HWND, + fUnknown: BOOL, + ); + pub fn SetForegroundWindow( + hWnd: HWND, + ) -> BOOL; + pub fn AllowSetForegroundWindow( + dwProcessId: DWORD, + ) -> BOOL; +} +pub const ASFW_ANY: DWORD = -1i32 as u32; +extern "system" { + pub fn LockSetForegroundWindow( + uLockCode: UINT, + ) -> BOOL; +} +pub const LSFW_LOCK: UINT = 1; +pub const LSFW_UNLOCK: UINT = 2; +extern "system" { + pub fn WindowFromDC( + hDC: HDC, + ) -> HWND; + pub fn GetDC( + hWnd: HWND, + ) -> HDC; + pub fn GetDCEx( + hWnd: HWND, + hrgnClip: HRGN, + flags: DWORD, + ) -> HDC; +} +pub const DCX_WINDOW: DWORD = 0x00000001; +pub const DCX_CACHE: DWORD = 0x00000002; +pub const DCX_NORESETATTRS: DWORD = 0x00000004; +pub const DCX_CLIPCHILDREN: DWORD = 0x00000008; +pub const DCX_CLIPSIBLINGS: DWORD = 0x00000010; +pub const DCX_PARENTCLIP: DWORD = 0x00000020; +pub const DCX_EXCLUDERGN: DWORD = 0x00000040; +pub const DCX_INTERSECTRGN: DWORD = 0x00000080; +pub const DCX_EXCLUDEUPDATE: DWORD = 0x00000100; +pub const DCX_INTERSECTUPDATE: DWORD = 0x00000200; +pub const DCX_LOCKWINDOWUPDATE: DWORD = 0x00000400; +pub const DCX_VALIDATE: DWORD = 0x00200000; +extern "system" { + pub fn GetWindowDC( + hWnd: HWND, + ) -> HDC; + pub fn ReleaseDC( + hWnd: HWND, + hDC: HDC, + ) -> c_int; + pub fn BeginPaint( + hwnd: HWND, + lpPaint: LPPAINTSTRUCT, + ) -> HDC; + pub fn EndPaint( + hWnd: HWND, + lpPaint: *const PAINTSTRUCT, + ) -> BOOL; + pub fn GetUpdateRect( + hWnd: HWND, + lpRect: LPRECT, + bErase: BOOL, + ) -> BOOL; + pub fn GetUpdateRgn( + hWnd: HWND, + hRgn: HRGN, + bErase: BOOL, + ) -> c_int; + pub fn SetWindowRgn( + hWnd: HWND, + hRgn: HRGN, + bRedraw: BOOL, + ) -> c_int; + pub fn GetWindowRgn( + hWnd: HWND, + hRgn: HRGN, + ) -> c_int; + pub fn GetWindowRgnBox( + hWnd: HWND, + lprc: LPRECT, + ) -> c_int; + pub fn ExcludeUpdateRgn( + hDC: HDC, + hWnd: HWND, + ) -> c_int; + pub fn InvalidateRect( + hWnd: HWND, + lpRect: *const RECT, + bErase: BOOL, + ) -> BOOL; + pub fn ValidateRect( + hWnd: HWND, + lpRect: *const RECT, + ) -> BOOL; + pub fn InvalidateRgn( + hWnd: HWND, + hRgn: HRGN, + bErase: BOOL, + ) -> BOOL; + pub fn ValidateRgn( + hWnd: HWND, + hRgn: HRGN, + ) -> BOOL; + pub fn RedrawWindow( + hwnd: HWND, + lprcUpdate: *const RECT, + hrgnUpdate: HRGN, + flags: UINT, + ) -> BOOL; +} +pub const RDW_INVALIDATE: UINT = 0x0001; +pub const RDW_INTERNALPAINT: UINT = 0x0002; +pub const RDW_ERASE: UINT = 0x0004; +pub const RDW_VALIDATE: UINT = 0x0008; +pub const RDW_NOINTERNALPAINT: UINT = 0x0010; +pub const RDW_NOERASE: UINT = 0x0020; +pub const RDW_NOCHILDREN: UINT = 0x0040; +pub const RDW_ALLCHILDREN: UINT = 0x0080; +pub const RDW_UPDATENOW: UINT = 0x0100; +pub const RDW_ERASENOW: UINT = 0x0200; +pub const RDW_FRAME: UINT = 0x0400; +pub const RDW_NOFRAME: UINT = 0x0800; +extern "system" { + pub fn LockWindowUpdate( + hWndLock: HWND, + ) -> BOOL; + pub fn ScrollWindow( + hWnd: HWND, + xAmount: c_int, + yAmount: c_int, + lpRect: *const RECT, + lpClipRect: *const RECT, + ) -> BOOL; + pub fn ScrollDC( + hDC: HDC, + dx: c_int, + dy: c_int, + lprcScroll: *const RECT, + lprcClip: *const RECT, + hrgnUpdate: HRGN, + lprcUpdate: LPRECT, + ) -> BOOL; + pub fn ScrollWindowEx( + hWnd: HWND, + dx: c_int, + dy: c_int, + prcScroll: *const RECT, + prcClip: *const RECT, + hrgnUpdate: HRGN, + prcUpdate: LPRECT, + flags: UINT, + ) -> c_int; +} +pub const SW_SCROLLCHILDREN: UINT = 0x0001; +pub const SW_INVALIDATE: UINT = 0x0002; +pub const SW_ERASE: UINT = 0x0004; +pub const SW_SMOOTHSCROLL: UINT = 0x0010; +extern "system" { + pub fn SetScrollPos( + hWnd: HWND, + nBar: c_int, + nPos: c_int, + bRedraw: BOOL, + ) -> c_int; + pub fn GetScrollPos( + hWnd: HWND, + nBar: c_int, + ) -> c_int; + pub fn SetScrollRange( + hWnd: HWND, + nBar: c_int, + nMinPos: c_int, + nMaxPos: c_int, + bRedraw: BOOL, + ) -> BOOL; + pub fn GetScrollRange( + hWnd: HWND, + nBar: c_int, + lpMinPos: LPINT, + lpMaxPos: LPINT, + ) -> BOOL; + pub fn ShowScrollBar( + hWnd: HWND, + wBar: c_int, + bShow: BOOL, + ) -> BOOL; + pub fn EnableScrollBar( + hWnd: HWND, + wSBflags: UINT, + wArrows: UINT, + ) -> BOOL; +} +pub const ESB_ENABLE_BOTH: UINT = 0x0000; +pub const ESB_DISABLE_BOTH: UINT = 0x0003; +pub const ESB_DISABLE_LEFT: UINT = 0x0001; +pub const ESB_DISABLE_RIGHT: UINT = 0x0002; +pub const ESB_DISABLE_UP: UINT = 0x0001; +pub const ESB_DISABLE_DOWN: UINT = 0x0002; +pub const ESB_DISABLE_LTUP: UINT = ESB_DISABLE_LEFT; +pub const ESB_DISABLE_RTDN: UINT = ESB_DISABLE_RIGHT; +extern "system" { + pub fn SetPropA( + hWnd: HWND, + lpString: LPCSTR, + hData: HANDLE, + ) -> BOOL; + pub fn SetPropW( + hWnd: HWND, + lpString: LPCWSTR, + hData: HANDLE, + ) -> BOOL; + pub fn GetPropA( + hwnd: HWND, + lpString: LPCSTR, + ) -> HANDLE; + pub fn GetPropW( + hwnd: HWND, + lpString: LPCWSTR, + ) -> HANDLE; + pub fn RemovePropA( + hWnd: HWND, + lpStr: LPCSTR, + ) -> HANDLE; + pub fn RemovePropW( + hWnd: HWND, + lpStr: LPCWSTR, + ) -> HANDLE; + pub fn EnumPropsExA( + hWnd: HWND, + lpEnumFunc: PROPENUMPROCA, + lParam: LPARAM, + ) -> c_int; + pub fn EnumPropsExW( + hWnd: HWND, + lpEnumFunc: PROPENUMPROCW, + lParam: LPARAM, + ) -> c_int; + pub fn EnumPropsA( + hWnd: HWND, + lpEnumFunc: PROPENUMPROCA, + ) -> c_int; + pub fn EnumPropsW( + hWnd: HWND, + lpEnumFunc: PROPENUMPROCW, + ) -> c_int; + pub fn SetWindowTextA( + hWnd: HWND, + lpString: LPCSTR, + ) -> BOOL; + pub fn SetWindowTextW( + hWnd: HWND, + lpString: LPCWSTR, + ) -> BOOL; + pub fn GetWindowTextA( + hWnd: HWND, + lpString: LPSTR, + nMaxCount: c_int, + ) -> c_int; + pub fn GetWindowTextW( + hWnd: HWND, + lpString: LPWSTR, + nMaxCount: c_int, + ) -> c_int; + pub fn GetWindowTextLengthA( + hWnd: HWND, + ) -> c_int; + pub fn GetWindowTextLengthW( + hWnd: HWND, + ) -> c_int; + pub fn GetClientRect( + hWnd: HWND, + lpRect: LPRECT, + ) -> BOOL; + pub fn GetWindowRect( + hWnd: HWND, + lpRect: LPRECT, + ) -> BOOL; + pub fn AdjustWindowRect( + lpRect: LPRECT, + dwStyle: DWORD, + bMenu: BOOL, + ) -> BOOL; + pub fn AdjustWindowRectEx( + lpRect: LPRECT, + dwStyle: DWORD, + bMenu: BOOL, + dwExStyle: DWORD, + ) -> BOOL; + pub fn AdjustWindowRectExForDpi( + lpRect: LPRECT, + dwStyle: DWORD, + bMenu: BOOL, + dwExStyle: DWORD, + dpi: UINT, + ) -> BOOL; +} +pub const HELPINFO_WINDOW: UINT = 0x0001; +pub const HELPINFO_MENUITEM: UINT = 0x0002; +STRUCT!{struct HELPINFO { + cbSize: UINT, + iContextType: c_int, + iCtrlId: c_int, + hItemHandle: HANDLE, + dwContextId: DWORD, + MousePos: POINT, +}} +pub type LPHELPINFO = *mut HELPINFO; +extern "system" { + pub fn SetWindowContextHelpId( + _: HWND, + _: DWORD, + ) -> BOOL; + pub fn GetWindowContextHelpId( + _: HWND, + ) -> DWORD; + pub fn SetMenuContextHelpId( + _: HMENU, + _: DWORD, + ) -> BOOL; + pub fn GetMenuContextHelpId( + _: HMENU, + ) -> DWORD; +} +pub const MB_OK: UINT = 0x00000000; +pub const MB_OKCANCEL: UINT = 0x00000001; +pub const MB_ABORTRETRYIGNORE: UINT = 0x00000002; +pub const MB_YESNOCANCEL: UINT = 0x00000003; +pub const MB_YESNO: UINT = 0x00000004; +pub const MB_RETRYCANCEL: UINT = 0x00000005; +pub const MB_CANCELTRYCONTINUE: UINT = 0x00000006; +pub const MB_ICONHAND: UINT = 0x00000010; +pub const MB_ICONQUESTION: UINT = 0x00000020; +pub const MB_ICONEXCLAMATION: UINT = 0x00000030; +pub const MB_ICONASTERISK: UINT = 0x00000040; +pub const MB_USERICON: UINT = 0x00000080; +pub const MB_ICONWARNING: UINT = MB_ICONEXCLAMATION; +pub const MB_ICONERROR: UINT = MB_ICONHAND; +pub const MB_ICONINFORMATION: UINT = MB_ICONASTERISK; +pub const MB_ICONSTOP: UINT = MB_ICONHAND; +pub const MB_DEFBUTTON1: UINT = 0x00000000; +pub const MB_DEFBUTTON2: UINT = 0x00000100; +pub const MB_DEFBUTTON3: UINT = 0x00000200; +pub const MB_DEFBUTTON4: UINT = 0x00000300; +pub const MB_APPLMODAL: UINT = 0x00000000; +pub const MB_SYSTEMMODAL: UINT = 0x00001000; +pub const MB_TASKMODAL: UINT = 0x00002000; +pub const MB_HELP: UINT = 0x00004000; +pub const MB_NOFOCUS: UINT = 0x00008000; +pub const MB_SETFOREGROUND: UINT = 0x00010000; +pub const MB_DEFAULT_DESKTOP_ONLY: UINT = 0x00020000; +pub const MB_TOPMOST: UINT = 0x00040000; +pub const MB_RIGHT: UINT = 0x00080000; +pub const MB_RTLREADING: UINT = 0x00100000; +pub const MB_SERVICE_NOTIFICATION: UINT = 0x00200000; +pub const MB_SERVICE_NOTIFICATION_NT3X: UINT = 0x00040000; +pub const MB_TYPEMASK: UINT = 0x0000000F; +pub const MB_ICONMASK: UINT = 0x000000F0; +pub const MB_DEFMASK: UINT = 0x00000F00; +pub const MB_MODEMASK: UINT = 0x00003000; +pub const MB_MISCMASK: UINT = 0x0000C000; +extern "system" { + pub fn MessageBoxA( + hWnd: HWND, + lpText: LPCSTR, + lpCaption: LPCSTR, + uType: UINT, + ) -> c_int; + pub fn MessageBoxW( + hWnd: HWND, + lpText: LPCWSTR, + lpCaption: LPCWSTR, + uType: UINT, + ) -> c_int; + pub fn MessageBoxExA( + hWnd: HWND, + lpText: LPCSTR, + lpCaption: LPCSTR, + uType: UINT, + wLanguageId: WORD, + ) -> c_int; + pub fn MessageBoxExW( + hWnd: HWND, + lpText: LPCWSTR, + lpCaption: LPCWSTR, + uType: UINT, + wLanguageId: WORD, + ) -> c_int; +} +STRUCT!{struct MSGBOXPARAMSA { + cbSize: UINT, + hwndOwner: HWND, + hInstance: HINSTANCE, + lpszText: LPCSTR, + lpszCaption: LPCSTR, + dwStyle: DWORD, + lpszIcon: LPCSTR, + dwContextHelpId: DWORD_PTR, + lpfnMsgBoxCallback: MSGBOXCALLBACK, + dwLanguageId: DWORD, +}} +pub type PMSGBOXPARAMSA = *mut MSGBOXPARAMSA; +pub type LPMSGBOXPARAMSA = *mut MSGBOXPARAMSA; +STRUCT!{struct MSGBOXPARAMSW { + cbSize: UINT, + hwndOwner: HWND, + hInstance: HINSTANCE, + lpszText: LPCWSTR, + lpszCaption: LPCWSTR, + dwStyle: DWORD, + lpszIcon: LPCWSTR, + dwContextHelpId: DWORD_PTR, + lpfnMsgBoxCallback: MSGBOXCALLBACK, + dwLanguageId: DWORD, +}} +pub type PMSGBOXPARAMSW = *mut MSGBOXPARAMSW; +pub type LPMSGBOXPARAMSW = *mut MSGBOXPARAMSW; +extern "system" { + pub fn MessageBoxIndirectA( + lpmbp: *const MSGBOXPARAMSA, + ) -> c_int; + pub fn MessageBoxIndirectW( + lpmbp: *const MSGBOXPARAMSW, + ) -> c_int; + pub fn MessageBeep( + uType: UINT, + ) -> BOOL; + pub fn ShowCursor( + bShow: BOOL, + ) -> c_int; + pub fn SetCursorPos( + X: c_int, + Y: c_int, + ) -> BOOL; + pub fn SetPhysicalCursorPos( + X: c_int, + Y: c_int, + ) -> BOOL; + pub fn SetCursor( + hCursor: HCURSOR, + ) -> HCURSOR; + pub fn GetCursorPos( + lpPoint: LPPOINT, + ) -> BOOL; + pub fn GetPhysicalCursorPos( + lpPoint: LPPOINT, + ) -> BOOL; + pub fn GetClipCursor( + lpRect: LPRECT, + ) -> BOOL; + pub fn GetCursor() -> HCURSOR; + pub fn CreateCaret( + hWnd: HWND, + hBitmap: HBITMAP, + nWidth: c_int, + nHeight: c_int, + ) -> BOOL; + pub fn GetCaretBlinkTime() -> UINT; + pub fn SetCaretBlinkTime( + uMSeconds: UINT, + ) -> BOOL; + pub fn DestroyCaret() -> BOOL; + pub fn HideCaret( + hWnd: HWND, + ) -> BOOL; + pub fn ShowCaret( + hWnd: HWND, + ) -> BOOL; + pub fn SetCaretPos( + X: c_int, + Y: c_int, + ) -> BOOL; + pub fn GetCaretPos( + lpPoint: LPPOINT, + ) -> BOOL; + pub fn ClientToScreen( + hWnd: HWND, + lpPoint: LPPOINT, + ) -> BOOL; + pub fn ScreenToClient( + hWnd: HWND, + lpPoint: LPPOINT, + ) -> BOOL; + pub fn LogicalToPhysicalPoint( + hWnd: HWND, + lpPoint: LPPOINT, + ) -> BOOL; + pub fn PhysicalToLogicalPoint( + hWnd: HWND, + lpPoint: LPPOINT, + ) -> BOOL; + pub fn LogicalToPhysicalPointForPerMonitorDPI( + hWnd: HWND, + lpPoint: LPPOINT, + ) -> BOOL; + pub fn PhysicalToLogicalPointForPerMonitorDPI( + hWnd: HWND, + lpPoint: LPPOINT, + ) -> BOOL; + pub fn MapWindowPoints( + hWndFrom: HWND, + hWndTo: HWND, + lpPoints: LPPOINT, + cPoints: UINT, + ) -> c_int; + pub fn WindowFromPoint( + Point: POINT, + ) -> HWND; + pub fn WindowFromPhysicalPoint( + Point: POINT, + ) -> HWND; + pub fn ChildWindowFromPoint( + hWndParent: HWND, + point: POINT, + ) -> HWND; + pub fn ClipCursor( + lpRect: *const RECT, + ) -> BOOL; +} +pub const CWP_ALL: UINT = 0x0000; +pub const CWP_SKIPINVISIBLE: UINT = 0x0001; +pub const CWP_SKIPDISABLED: UINT = 0x0002; +pub const CWP_SKIPTRANSPARENT: UINT = 0x0004; +extern "system" { + pub fn ChildWindowFromPointEx( + hwnd: HWND, + pt: POINT, + flags: UINT, + ) -> HWND; +} +pub const CTLCOLOR_MSGBOX: c_int = 0; +pub const CTLCOLOR_EDIT: c_int = 1; +pub const CTLCOLOR_LISTBOX: c_int = 2; +pub const CTLCOLOR_BTN: c_int = 3; +pub const CTLCOLOR_DLG: c_int = 4; +pub const CTLCOLOR_SCROLLBAR: c_int = 5; +pub const CTLCOLOR_STATIC: c_int = 6; +pub const CTLCOLOR_MAX: c_int = 7; +pub const COLOR_SCROLLBAR: c_int = 0; +pub const COLOR_BACKGROUND: c_int = 1; +pub const COLOR_ACTIVECAPTION: c_int = 2; +pub const COLOR_INACTIVECAPTION: c_int = 3; +pub const COLOR_MENU: c_int = 4; +pub const COLOR_WINDOW: c_int = 5; +pub const COLOR_WINDOWFRAME: c_int = 6; +pub const COLOR_MENUTEXT: c_int = 7; +pub const COLOR_WINDOWTEXT: c_int = 8; +pub const COLOR_CAPTIONTEXT: c_int = 9; +pub const COLOR_ACTIVEBORDER: c_int = 10; +pub const COLOR_INACTIVEBORDER: c_int = 11; +pub const COLOR_APPWORKSPACE: c_int = 12; +pub const COLOR_HIGHLIGHT: c_int = 13; +pub const COLOR_HIGHLIGHTTEXT: c_int = 14; +pub const COLOR_BTNFACE: c_int = 15; +pub const COLOR_BTNSHADOW: c_int = 16; +pub const COLOR_GRAYTEXT: c_int = 17; +pub const COLOR_BTNTEXT: c_int = 18; +pub const COLOR_INACTIVECAPTIONTEXT: c_int = 19; +pub const COLOR_BTNHIGHLIGHT: c_int = 20; +pub const COLOR_3DDKSHADOW: c_int = 21; +pub const COLOR_3DLIGHT: c_int = 22; +pub const COLOR_INFOTEXT: c_int = 23; +pub const COLOR_INFOBK: c_int = 24; +pub const COLOR_HOTLIGHT: c_int = 26; +pub const COLOR_GRADIENTACTIVECAPTION: c_int = 27; +pub const COLOR_GRADIENTINACTIVECAPTION: c_int = 28; +pub const COLOR_MENUHILIGHT: c_int = 29; +pub const COLOR_MENUBAR: c_int = 30; +pub const COLOR_DESKTOP: c_int = COLOR_BACKGROUND; +pub const COLOR_3DFACE: c_int = COLOR_BTNFACE; +pub const COLOR_3DSHADOW: c_int = COLOR_BTNSHADOW; +pub const COLOR_3DHIGHLIGHT: c_int = COLOR_BTNHIGHLIGHT; +pub const COLOR_3DHILIGHT: c_int = COLOR_BTNHIGHLIGHT; +pub const COLOR_BTNHILIGHT: c_int = COLOR_BTNHIGHLIGHT; +extern "system" { + pub fn GetSysColor( + nIndex: c_int, + ) -> DWORD; + pub fn GetSysColorBrush( + nIndex: c_int, + ) -> HBRUSH; + pub fn SetSysColors( + cElements: c_int, + lpaElements: *const INT, + lpaRgbValues: *const COLORREF, + ) -> BOOL; + pub fn DrawFocusRect( + hDC: HDC, + lprc: *const RECT, + ) -> BOOL; + pub fn FillRect( + hDC: HDC, + lprc: *const RECT, + hbr: HBRUSH, + ) -> c_int; + pub fn FrameRect( + hDC: HDC, + lprc: *const RECT, + hbr: HBRUSH, + ) -> c_int; + pub fn InvertRect( + hDC: HDC, + lprc: *const RECT, + ) -> BOOL; + pub fn SetRect( + lprc: LPRECT, + xLeft: c_int, + yTop: c_int, + xRight: c_int, + yBottom: c_int, + ) -> BOOL; + pub fn SetRectEmpty( + lprc: LPRECT, + ) -> BOOL; + pub fn CopyRect( + lprcDst: LPRECT, + lprcSrc: *const RECT, + ) -> BOOL; + pub fn InflateRect( + lprc: LPRECT, + dx: c_int, + dy: c_int, + ) -> BOOL; + pub fn IntersectRect( + lprcDst: LPRECT, + lprcSrc1: *const RECT, + lprcSrc2: *const RECT, + ) -> BOOL; + pub fn UnionRect( + lprcDst: LPRECT, + lprcSrc1: *const RECT, + lprcSrc2: *const RECT, + ) -> BOOL; + pub fn SubtractRect( + lprcDst: LPRECT, + lprcSrc1: *const RECT, + lprcSrc2: *const RECT, + ) -> BOOL; + pub fn OffsetRect( + lprc: LPRECT, + dx: c_int, + dy: c_int, + ) -> BOOL; + pub fn IsRectEmpty( + lprc: *const RECT, + ) -> BOOL; + pub fn EqualRect( + lprc1: *const RECT, + lprc2: *const RECT, + ) -> BOOL; + pub fn PtInRect( + lprc: *const RECT, + pt: POINT, + ) -> BOOL; + pub fn GetWindowWord( + hWnd: HWND, + nIndex: c_int, + ) -> WORD; + pub fn SetWindowWord( + hwnd: HWND, + nIndex: c_int, + wNewWord: WORD, + ) -> WORD; + pub fn GetWindowLongA( + hWnd: HWND, + nIndex: c_int, + ) -> LONG; + pub fn GetWindowLongW( + hWnd: HWND, + nIndex: c_int, + ) -> LONG; + pub fn SetWindowLongA( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG, + ) -> LONG; + pub fn SetWindowLongW( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG, + ) -> LONG; + #[cfg(target_arch = "x86_64")] + pub fn GetWindowLongPtrA( + hWnd: HWND, + nIndex: c_int, + ) -> LONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn GetWindowLongPtrW( + hWnd: HWND, + nIndex: c_int, + ) -> LONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn SetWindowLongPtrA( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG_PTR, + ) -> LONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn SetWindowLongPtrW( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG_PTR, + ) -> LONG_PTR; +} +#[cfg(target_arch = "x86")] +pub use self::GetWindowLongA as GetWindowLongPtrA; +#[cfg(target_arch = "x86")] +pub use self::GetWindowLongW as GetWindowLongPtrW; +#[cfg(target_arch = "x86")] +pub use self::SetWindowLongA as SetWindowLongPtrA; +#[cfg(target_arch = "x86")] +pub use self::SetWindowLongW as SetWindowLongPtrW; +extern "system" { + pub fn GetClassWord( + hWnd: HWND, + nIndex: c_int, + ) -> WORD; + pub fn SetClassWord( + hWnd: HWND, + nIndex: c_int, + wNewWord: WORD, + ) -> WORD; + pub fn GetClassLongA( + hWnd: HWND, + nIndex: c_int, + ) -> DWORD; + pub fn GetClassLongW( + hWnd: HWND, + nIndex: c_int, + ) -> DWORD; + pub fn SetClassLongA( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG, + ) -> DWORD; + pub fn SetClassLongW( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG, + ) -> DWORD; + #[cfg(target_arch = "x86_64")] + pub fn GetClassLongPtrA( + hWnd: HWND, + nIndex: c_int, + ) -> ULONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn GetClassLongPtrW( + hWnd: HWND, + nIndex: c_int, + ) -> ULONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn SetClassLongPtrA( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG_PTR, + ) -> ULONG_PTR; + #[cfg(target_arch = "x86_64")] + pub fn SetClassLongPtrW( + hWnd: HWND, + nIndex: c_int, + dwNewLong: LONG_PTR, + ) -> ULONG_PTR; +} +#[cfg(target_arch = "x86")] +pub use self::GetClassLongA as GetClassLongPtrA; +#[cfg(target_arch = "x86")] +pub use self::GetClassLongW as GetClassLongPtrW; +#[cfg(target_arch = "x86")] +pub use self::SetClassLongA as SetClassLongPtrA; +#[cfg(target_arch = "x86")] +pub use self::SetClassLongW as SetClassLongPtrW; +extern "system" { + pub fn GetProcessDefaultLayout( + pdwDefaultLayout: *mut DWORD, + ) -> BOOL; + pub fn SetProcessDefaultLayout( + dwDefaultLayout: DWORD, + ) -> BOOL; + pub fn GetDesktopWindow() -> HWND; + pub fn GetParent( + hWnd: HWND, + ) -> HWND; + pub fn SetParent( + hWndChild: HWND, + hWndNewParent: HWND, + ) -> HWND; + pub fn EnumChildWindows( + hWndParent: HWND, + lpEnumFunc: WNDENUMPROC, + lParam: LPARAM, + ) -> BOOL; + pub fn FindWindowA( + lpClassName: LPCSTR, + lpWindowName: LPCSTR, + ) -> HWND; + pub fn FindWindowW( + lpClassName: LPCWSTR, + lpWindowName: LPCWSTR, + ) -> HWND; + pub fn FindWindowExA( + hWndParent: HWND, + hWndChildAfter: HWND, + lpszClass: LPCSTR, + lpszWindow: LPCSTR, + ) -> HWND; + pub fn FindWindowExW( + hWndParent: HWND, + hWndChildAfter: HWND, + lpszClass: LPCWSTR, + lpszWindow: LPCWSTR, + ) -> HWND; + pub fn GetShellWindow() -> HWND; + pub fn RegisterShellHookWindow( + hwnd: HWND, + ) -> BOOL; + pub fn DeregisterShellHookWindow( + hwnd: HWND, + ) -> BOOL; + pub fn EnumWindows( + lpEnumFunc: WNDENUMPROC, + lParam: LPARAM, + ) -> BOOL; + pub fn EnumThreadWindows( + dwThreadId: DWORD, + lpfn: WNDENUMPROC, + lParam: LPARAM, + ) -> BOOL; +} +// EnumTaskWindows +extern "system" { + pub fn GetClassNameA( + hWnd: HWND, + lpClassName: LPCSTR, + nMaxCount: c_int, + ) -> c_int; + pub fn GetClassNameW( + hWnd: HWND, + lpClassName: LPCWSTR, + nMaxCount: c_int, + ) -> c_int; + pub fn GetTopWindow( + hWnd: HWND, + ) -> HWND; +} +// GetNextWindow +// GetSysModalWindow +// SetSysModalWindow +extern "system" { + pub fn GetWindowThreadProcessId( + hWnd: HWND, + lpdwProcessId: LPDWORD, + ) -> DWORD; + pub fn IsGUIThread( + bConvert: BOOL, + ) -> BOOL; + pub fn GetLastActivePopup( + hWnd: HWND, + ) -> HWND; +} +pub const GW_HWNDFIRST: UINT = 0; +pub const GW_HWNDLAST: UINT = 1; +pub const GW_HWNDNEXT: UINT = 2; +pub const GW_HWNDPREV: UINT = 3; +pub const GW_OWNER: UINT = 4; +pub const GW_CHILD: UINT = 5; +pub const GW_ENABLEDPOPUP: UINT = 6; +pub const GW_MAX: UINT = 6; +extern "system" { + pub fn GetWindow( + hWnd: HWND, + uCmd: UINT, + ) -> HWND; + pub fn SetWindowsHookA( + nFilterType: c_int, + pfnFilterProc: HOOKPROC, + ) -> HHOOK; + pub fn SetWindowsHookW( + nFilterType: c_int, + pfnFilterProc: HOOKPROC, + ) -> HHOOK; + pub fn UnhookWindowsHook( + nFilterType: c_int, + pfnFilterProc: HOOKPROC, + ) -> BOOL; + pub fn SetWindowsHookExA( + idHook: c_int, + lpfn: HOOKPROC, + hmod: HINSTANCE, + dwThreadId: DWORD, + ) -> HHOOK; + pub fn SetWindowsHookExW( + idHook: c_int, + lpfn: HOOKPROC, + hmod: HINSTANCE, + dwThreadId: DWORD, + ) -> HHOOK; + pub fn UnhookWindowsHookEx( + hhk: HHOOK, + ) -> BOOL; + pub fn CallNextHookEx( + hhk: HHOOK, + nCode: c_int, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; +} +// DefHookProc +pub const MF_INSERT: UINT = 0x00000000; +pub const MF_CHANGE: UINT = 0x00000080; +pub const MF_APPEND: UINT = 0x00000100; +pub const MF_DELETE: UINT = 0x00000200; +pub const MF_REMOVE: UINT = 0x00001000; +pub const MF_BYCOMMAND: UINT = 0x00000000; +pub const MF_BYPOSITION: UINT = 0x00000400; +pub const MF_SEPARATOR: UINT = 0x00000800; +pub const MF_ENABLED: UINT = 0x00000000; +pub const MF_GRAYED: UINT = 0x00000001; +pub const MF_DISABLED: UINT = 0x00000002; +pub const MF_UNCHECKED: UINT = 0x00000000; +pub const MF_CHECKED: UINT = 0x00000008; +pub const MF_USECHECKBITMAPS: UINT = 0x00000200; +pub const MF_STRING: UINT = 0x00000000; +pub const MF_BITMAP: UINT = 0x00000004; +pub const MF_OWNERDRAW: UINT = 0x00000100; +pub const MF_POPUP: UINT = 0x00000010; +pub const MF_MENUBARBREAK: UINT = 0x00000020; +pub const MF_MENUBREAK: UINT = 0x00000040; +pub const MF_UNHILITE: UINT = 0x00000000; +pub const MF_HILITE: UINT = 0x00000080; +pub const MF_DEFAULT: UINT = 0x00001000; +pub const MF_SYSMENU: UINT = 0x00002000; +pub const MF_HELP: UINT = 0x00004000; +pub const MF_RIGHTJUSTIFY: UINT = 0x00004000; +pub const MF_MOUSESELECT: UINT = 0x00008000; +pub const MF_END: UINT = 0x00000080; +pub const MFT_STRING: UINT = MF_STRING; +pub const MFT_BITMAP: UINT = MF_BITMAP; +pub const MFT_MENUBARBREAK: UINT = MF_MENUBARBREAK; +pub const MFT_MENUBREAK: UINT = MF_MENUBREAK; +pub const MFT_OWNERDRAW: UINT = MF_OWNERDRAW; +pub const MFT_RADIOCHECK: UINT = 0x00000200; +pub const MFT_SEPARATOR: UINT = MF_SEPARATOR; +pub const MFT_RIGHTORDER: UINT = 0x00002000; +pub const MFT_RIGHTJUSTIFY: UINT = MF_RIGHTJUSTIFY; +pub const MFS_GRAYED: UINT = 0x00000003; +pub const MFS_DISABLED: UINT = MFS_GRAYED; +pub const MFS_CHECKED: UINT = MF_CHECKED; +pub const MFS_HILITE: UINT = MF_HILITE; +pub const MFS_ENABLED: UINT = MF_ENABLED; +pub const MFS_UNCHECKED: UINT = MF_UNCHECKED; +pub const MFS_UNHILITE: UINT = MF_UNHILITE; +pub const MFS_DEFAULT: UINT = MF_DEFAULT; +extern "system" { + pub fn CheckMenuRadioItem( + hMenu: HMENU, + first: UINT, + last: UINT, + check: UINT, + flags: UINT, + ) -> BOOL; +} +/********* +* CUTOFF * +*********/ +pub const IDOK: c_int = 1; +pub const IDCANCEL: c_int = 2; +pub const IDABORT: c_int = 3; +pub const IDRETRY: c_int = 4; +pub const IDIGNORE: c_int = 5; +pub const IDYES: c_int = 6; +pub const IDNO: c_int = 7; +pub const IDCLOSE: c_int = 8; +pub const IDHELP: c_int = 9; +pub const IDTRYAGAIN: c_int = 10; +pub const IDCONTINUE: c_int = 11; +pub const IDTIMEOUT: c_int = 32000; +// Edit Control Styles +// +pub const ES_LEFT: DWORD = 0x0000; +pub const ES_CENTER: DWORD = 0x0001; +pub const ES_RIGHT: DWORD = 0x0002; +pub const ES_MULTILINE: DWORD = 0x0004; +pub const ES_UPPERCASE: DWORD = 0x0008; +pub const ES_LOWERCASE: DWORD = 0x0010; +pub const ES_PASSWORD: DWORD = 0x0020; +pub const ES_AUTOVSCROLL: DWORD = 0x0040; +pub const ES_AUTOHSCROLL: DWORD = 0x0080; +pub const ES_NOHIDESEL: DWORD = 0x0100; +pub const ES_OEMCONVERT: DWORD = 0x0400; +pub const ES_READONLY: DWORD = 0x0800; +pub const ES_WANTRETURN: DWORD = 0x1000; +pub const ES_NUMBER: DWORD = 0x2000; +// Edit Control Notification Codes +// +pub const EN_SETFOCUS: WORD = 0x0100; +pub const EN_KILLFOCUS: WORD = 0x0200; +pub const EN_CHANGE: WORD = 0x0300; +pub const EN_UPDATE: WORD = 0x0400; +pub const EN_ERRSPACE: WORD = 0x0500; +pub const EN_MAXTEXT: WORD = 0x0501; +pub const EN_HSCROLL: WORD = 0x0601; +pub const EN_VSCROLL: WORD = 0x0602; +pub const EN_ALIGN_LTR_EC: WORD = 0x0700; +pub const EN_ALIGN_RTL_EC: WORD = 0x0701; +// Edit control EM_SETMARGIN parameters +pub const EC_LEFTMARGIN: WORD = 0x0001; +pub const EC_RIGHTMARGIN: WORD = 0x0002; +pub const EC_USEFONTINFO: WORD = 0xffff; +// wParam of EM_GET/SETIMESTATUS +pub const EMSIS_COMPOSITIONSTRING: WORD = 0x0001; +// lParam for EMSIS_COMPOSITIONSTRING +pub const EIMES_GETCOMPSTRATONCE: WORD = 0x0001; +pub const EIMES_CANCELCOMPSTRINFOCUS: WORD = 0x0002; +pub const EIMES_COMPLETECOMPSTRKILLFOCUS: WORD = 0x0004; +// Edit Control Messages +// +pub const EM_GETSEL: WORD = 0x00B0; +pub const EM_SETSEL: WORD = 0x00B1; +pub const EM_GETRECT: WORD = 0x00B2; +pub const EM_SETRECT: WORD = 0x00B3; +pub const EM_SETRECTNP: WORD = 0x00B4; +pub const EM_SCROLL: WORD = 0x00B5; +pub const EM_LINESCROLL: WORD = 0x00B6; +pub const EM_SCROLLCARET: WORD = 0x00B7; +pub const EM_GETMODIFY: WORD = 0x00B8; +pub const EM_SETMODIFY: WORD = 0x00B9; +pub const EM_GETLINECOUNT: WORD = 0x00BA; +pub const EM_LINEINDEX: WORD = 0x00BB; +pub const EM_SETHANDLE: WORD = 0x00BC; +pub const EM_GETHANDLE: WORD = 0x00BD; +pub const EM_GETTHUMB: WORD = 0x00BE; +pub const EM_LINELENGTH: WORD = 0x00C1; +pub const EM_REPLACESEL: WORD = 0x00C2; +pub const EM_GETLINE: WORD = 0x00C4; +pub const EM_LIMITTEXT: WORD = 0x00C5; +pub const EM_CANUNDO: WORD = 0x00C6; +pub const EM_UNDO: WORD = 0x00C7; +pub const EM_FMTLINES: WORD = 0x00C8; +pub const EM_LINEFROMCHAR: WORD = 0x00C9; +pub const EM_SETTABSTOPS: WORD = 0x00CB; +pub const EM_SETPASSWORDCHAR: WORD = 0x00CC; +pub const EM_EMPTYUNDOBUFFER: WORD = 0x00CD; +pub const EM_GETFIRSTVISIBLELINE: WORD = 0x00CE; +pub const EM_SETREADONLY: WORD = 0x00CF; +pub const EM_SETWORDBREAKPROC: WORD = 0x00D0; +pub const EM_GETWORDBREAKPROC: WORD = 0x00D1; +pub const EM_GETPASSWORDCHAR: WORD = 0x00D2; +pub const EM_SETMARGINS: WORD = 0x00D3; +pub const EM_GETMARGINS: WORD = 0x00D4; +pub const EM_SETLIMITTEXT: WORD = EM_LIMITTEXT; +pub const EM_GETLIMITTEXT: WORD = 0x00D5; +pub const EM_POSFROMCHAR: WORD = 0x00D6; +pub const EM_CHARFROMPOS: WORD = 0x00D7; +pub const EM_SETIMESTATUS: WORD = 0x00D8; +pub const EM_GETIMESTATUS: WORD = 0x00D9; +// EDITWORDBREAKPROC code values +// +pub const WB_LEFT: WORD = 0; +pub const WB_RIGHT: WORD = 1; +pub const WB_ISDELIMITER: WORD = 2; +pub const BN_CLICKED: WORD = 0; +pub const BN_PAINT: WORD = 1; +pub const BN_HILITE: WORD = 2; +pub const BN_UNHILITE: WORD = 3; +pub const BN_DISABLE: WORD = 4; +pub const BN_DOUBLECLICKED: WORD = 5; +pub const BN_PUSHED: WORD = BN_HILITE; +pub const BN_UNPUSHED: WORD = BN_UNHILITE; +pub const BN_DBLCLK: WORD = BN_DOUBLECLICKED; +pub const BN_SETFOCUS: WORD = 6; +pub const BN_KILLFOCUS: WORD = 7; +pub const BS_PUSHBUTTON: DWORD = 0x00000000; +pub const BS_DEFPUSHBUTTON: DWORD = 0x00000001; +pub const BS_CHECKBOX: DWORD = 0x00000002; +pub const BS_AUTOCHECKBOX: DWORD = 0x00000003; +pub const BS_RADIOBUTTON: DWORD = 0x00000004; +pub const BS_3STATE: DWORD = 0x00000005; +pub const BS_AUTO3STATE: DWORD = 0x00000006; +pub const BS_GROUPBOX: DWORD = 0x00000007; +pub const BS_USERBUTTON: DWORD = 0x00000008; +pub const BS_AUTORADIOBUTTON: DWORD = 0x00000009; +pub const BS_PUSHBOX: DWORD = 0x0000000A; +pub const BS_OWNERDRAW: DWORD = 0x0000000B; +pub const BS_TYPEMASK: DWORD = 0x0000000F; +pub const BS_LEFTTEXT: DWORD = 0x00000020; +pub const BS_TEXT: DWORD = 0x00000000; +pub const BS_ICON: DWORD = 0x00000040; +pub const BS_BITMAP: DWORD = 0x00000080; +pub const BS_LEFT: DWORD = 0x00000100; +pub const BS_RIGHT: DWORD = 0x00000200; +pub const BS_CENTER: DWORD = 0x00000300; +pub const BS_TOP: DWORD = 0x00000400; +pub const BS_BOTTOM: DWORD = 0x00000800; +pub const BS_VCENTER: DWORD = 0x00000C00; +pub const BS_PUSHLIKE: DWORD = 0x00001000; +pub const BS_MULTILINE: DWORD = 0x00002000; +pub const BS_NOTIFY: DWORD = 0x00004000; +pub const BS_FLAT: DWORD = 0x00008000; +pub const BS_RIGHTBUTTON: DWORD = BS_LEFTTEXT; +pub const BM_GETCHECK: UINT = 0x00F0; +pub const BM_SETCHECK: UINT = 0x00F1; +pub const BM_GETSTATE: UINT = 0x00F2; +pub const BM_SETSTATE: UINT = 0x00F3; +pub const BM_SETSTYLE: UINT = 0x00F4; +pub const BM_CLICK: UINT = 0x00F5; +pub const BM_GETIMAGE: UINT = 0x00F6; +pub const BM_SETIMAGE: UINT = 0x00F7; +pub const BM_SETDONTCLICK: UINT = 0x00F8; +pub const BST_UNCHECKED: WPARAM = 0x0000; +pub const BST_CHECKED: WPARAM = 0x0001; +pub const BST_INDETERMINATE: WPARAM = 0x0002; +pub const BST_PUSHED: LRESULT = 0x0004; +pub const BST_FOCUS: LRESULT = 0x0008; +pub const SS_LEFT: DWORD = 0x00000000; +pub const SS_CENTER: DWORD = 0x00000001; +pub const SS_RIGHT: DWORD = 0x00000002; +pub const SS_ICON: DWORD = 0x00000003; +pub const SS_BLACKRECT: DWORD = 0x00000004; +pub const SS_GRAYRECT: DWORD = 0x00000005; +pub const SS_WHITERECT: DWORD = 0x00000006; +pub const SS_BLACKFRAME: DWORD = 0x00000007; +pub const SS_GRAYFRAME: DWORD = 0x00000008; +pub const SS_WHITEFRAME: DWORD = 0x00000009; +pub const SS_USERITEM: DWORD = 0x0000000A; +pub const SS_SIMPLE: DWORD = 0x0000000B; +pub const SS_LEFTNOWORDWRAP: DWORD = 0x0000000C; +pub const SS_OWNERDRAW: DWORD = 0x0000000D; +pub const SS_BITMAP: DWORD = 0x0000000E; +pub const SS_ENHMETAFILE: DWORD = 0x0000000F; +pub const SS_ETCHEDHORZ: DWORD = 0x00000010; +pub const SS_ETCHEDVERT: DWORD = 0x00000011; +pub const SS_ETCHEDFRAME: DWORD = 0x00000012; +pub const SS_TYPEMASK: DWORD = 0x0000001F; +pub const SS_REALSIZECONTROL: DWORD = 0x00000040; +pub const SS_NOPREFIX: DWORD = 0x00000080; +pub const SS_NOTIFY: DWORD = 0x00000100; +pub const SS_CENTERIMAGE: DWORD = 0x00000200; +pub const SS_RIGHTJUST: DWORD = 0x00000400; +pub const SS_REALSIZEIMAGE: DWORD = 0x00000800; +pub const SS_SUNKEN: DWORD = 0x00001000; +pub const SS_EDITCONTROL: DWORD = 0x00002000; +pub const SS_ENDELLIPSIS: DWORD = 0x00004000; +pub const SS_PATHELLIPSIS: DWORD = 0x00008000; +pub const SS_WORDELLIPSIS: DWORD = 0x0000C000; +pub const SS_ELLIPSISMASK: DWORD = 0x0000C000; +pub const STM_SETICON: UINT = 0x0170; +pub const STM_GETICON: UINT = 0x0171; +pub const STM_SETIMAGE: UINT = 0x0172; +pub const STM_GETIMAGE: UINT = 0x0173; +pub const STN_CLICKED: WORD = 0; +pub const STN_DBLCLK: WORD = 1; +pub const STN_ENABLE: WORD = 2; +pub const STN_DISABLE: WORD = 3; +pub const STM_MSGMAX: WORD = 0x0174; +extern "system" { + pub fn IsDialogMessageA( + hDlg: HWND, + lpMsg: LPMSG, + ) -> BOOL; + pub fn IsDialogMessageW( + hDlg: HWND, + lpMsg: LPMSG, + ) -> BOOL; + pub fn MapDialogRect( + hDlg: HWND, + lpRect: LPRECT, + ) -> BOOL; + pub fn DlgDirListA( + hDlg: HWND, + lpPathSpec: LPSTR, + nIDListBox: c_int, + nIDStaticPath: c_int, + uFileType: UINT, + ) -> c_int; + pub fn DlgDirListW( + hDlg: HWND, + lpPathSpec: LPWSTR, + nIDListBox: c_int, + nIDStaticPath: c_int, + uFileType: UINT, + ) -> c_int; + pub fn DlgDirSelectExA( + hwndDlg: HWND, + lpString: LPSTR, + chCount: c_int, + idListBox: c_int, + ) -> BOOL; + pub fn DlgDirSelectExW( + hwndDlg: HWND, + lpString: LPWSTR, + chCount: c_int, + idListBox: c_int, + ) -> BOOL; + pub fn DlgDirListComboBoxA( + hDlg: HWND, + lpPathSpec: LPSTR, + nIDComboBox: c_int, + nIDStaticPath: c_int, + uFiletype: UINT, + ) -> c_int; + pub fn DlgDirListComboBoxW( + hDlg: HWND, + lpPathSpec: LPWSTR, + nIDComboBox: c_int, + nIDStaticPath: c_int, + uFiletype: UINT, + ) -> c_int; + pub fn DlgDirSelectComboBoxExA( + hwndDlg: HWND, + lpString: LPSTR, + cchOut: c_int, + idComboBox: c_int, + ) -> BOOL; + pub fn DlgDirSelectComboBoxExW( + hwndDlg: HWND, + lpString: LPWSTR, + cchOut: c_int, + idComboBox: c_int, + ) -> BOOL; +} +pub const DS_ABSALIGN: DWORD = 0x01; +pub const DS_SYSMODAL: DWORD = 0x02; +pub const DS_LOCALEDIT: DWORD = 0x20; +pub const DS_SETFONT: DWORD = 0x40; +pub const DS_MODALFRAME: DWORD = 0x80; +pub const DS_NOIDLEMSG: DWORD = 0x100; +pub const DS_SETFOREGROUND: DWORD = 0x200; +pub const DS_3DLOOK: DWORD = 0x0004; +pub const DS_FIXEDSYS: DWORD = 0x0008; +pub const DS_NOFAILCREATE: DWORD = 0x0010; +pub const DS_CONTROL: DWORD = 0x0400; +pub const DS_CENTER: DWORD = 0x0800; +pub const DS_CENTERMOUSE: DWORD = 0x1000; +pub const DS_CONTEXTHELP: DWORD = 0x2000; +pub const DS_SHELLFONT: DWORD = DS_SETFONT | DS_FIXEDSYS; +pub const DS_USEPIXELS: DWORD = 0x8000; +pub const DM_GETDEFID: UINT = WM_USER + 0; +pub const DM_SETDEFID: UINT = WM_USER + 1; +pub const DM_REPOSITION: UINT = WM_USER + 2; +pub const DC_HASDEFID: WORD = 0x534B; +pub const DLGC_WANTARROWS: LRESULT = 0x0001; +pub const DLGC_WANTTAB: LRESULT = 0x0002; +pub const DLGC_WANTALLKEYS: LRESULT = 0x0004; +pub const DLGC_WANTMESSAGE: LRESULT = 0x0004; +pub const DLGC_HASSETSEL: LRESULT = 0x0008; +pub const DLGC_DEFPUSHBUTTON: LRESULT = 0x0010; +pub const DLGC_UNDEFPUSHBUTTON: LRESULT = 0x0020; +pub const DLGC_RADIOBUTTON: LRESULT = 0x0040; +pub const DLGC_WANTCHARS: LRESULT = 0x0080; +pub const DLGC_STATIC: LRESULT = 0x0100; +pub const DLGC_BUTTON: LRESULT = 0x2000; +pub const LB_OKAY: LRESULT = 0; +pub const LB_ERR: LRESULT = -1; +pub const LB_ERRSPACE: LRESULT = -2; +pub const LBN_ERRSPACE: WORD = -2i16 as u16; +pub const LBN_SELCHANGE: WORD = 1; +pub const LBN_DBLCLK: WORD = 2; +pub const LBN_SELCANCEL: WORD = 3; +pub const LBN_SETFOCUS: WORD = 4; +pub const LBN_KILLFOCUS: WORD = 5; +pub const LB_ADDSTRING: UINT = 0x0180; +pub const LB_INSERTSTRING: UINT = 0x0181; +pub const LB_DELETESTRING: UINT = 0x0182; +pub const LB_SELITEMRANGEEX: UINT = 0x0183; +pub const LB_RESETCONTENT: UINT = 0x0184; +pub const LB_SETSEL: UINT = 0x0185; +pub const LB_SETCURSEL: UINT = 0x0186; +pub const LB_GETSEL: UINT = 0x0187; +pub const LB_GETCURSEL: UINT = 0x0188; +pub const LB_GETTEXT: UINT = 0x0189; +pub const LB_GETTEXTLEN: UINT = 0x018A; +pub const LB_GETCOUNT: UINT = 0x018B; +pub const LB_SELECTSTRING: UINT = 0x018C; +pub const LB_DIR: UINT = 0x018D; +pub const LB_GETTOPINDEX: UINT = 0x018E; +pub const LB_FINDSTRING: UINT = 0x018F; +pub const LB_GETSELCOUNT: UINT = 0x0190; +pub const LB_GETSELITEMS: UINT = 0x0191; +pub const LB_SETTABSTOPS: UINT = 0x0192; +pub const LB_GETHORIZONTALEXTENT: UINT = 0x0193; +pub const LB_SETHORIZONTALEXTENT: UINT = 0x0194; +pub const LB_SETCOLUMNWIDTH: UINT = 0x0195; +pub const LB_ADDFILE: UINT = 0x0196; +pub const LB_SETTOPINDEX: UINT = 0x0197; +pub const LB_GETITEMRECT: UINT = 0x0198; +pub const LB_GETITEMDATA: UINT = 0x0199; +pub const LB_SETITEMDATA: UINT = 0x019A; +pub const LB_SELITEMRANGE: UINT = 0x019B; +pub const LB_SETANCHORINDEX: UINT = 0x019C; +pub const LB_GETANCHORINDEX: UINT = 0x019D; +pub const LB_SETCARETINDEX: UINT = 0x019E; +pub const LB_GETCARETINDEX: UINT = 0x019F; +pub const LB_SETITEMHEIGHT: UINT = 0x01A0; +pub const LB_GETITEMHEIGHT: UINT = 0x01A1; +pub const LB_FINDSTRINGEXACT: UINT = 0x01A2; +pub const LB_SETLOCALE: UINT = 0x01A5; +pub const LB_GETLOCALE: UINT = 0x01A6; +pub const LB_SETCOUNT: UINT = 0x01A7; +pub const LB_INITSTORAGE: UINT = 0x01A8; +pub const LB_ITEMFROMPOINT: UINT = 0x01A9; +pub const LB_MULTIPLEADDSTRING: UINT = 0x01B1; +pub const LB_GETLISTBOXINFO: UINT = 0x01B2; +pub const LB_MSGMAX: UINT = 0x01B3; +pub const LBS_NOTIFY: DWORD = 0x0001; +pub const LBS_SORT: DWORD = 0x0002; +pub const LBS_NOREDRAW: DWORD = 0x0004; +pub const LBS_MULTIPLESEL: DWORD = 0x0008; +pub const LBS_OWNERDRAWFIXED: DWORD = 0x0010; +pub const LBS_OWNERDRAWVARIABLE: DWORD = 0x0020; +pub const LBS_HASSTRINGS: DWORD = 0x0040; +pub const LBS_USETABSTOPS: DWORD = 0x0080; +pub const LBS_NOINTEGRALHEIGHT: DWORD = 0x0100; +pub const LBS_MULTICOLUMN: DWORD = 0x0200; +pub const LBS_WANTKEYBOARDINPUT: DWORD = 0x0400; +pub const LBS_EXTENDEDSEL: DWORD = 0x0800; +pub const LBS_DISABLENOSCROLL: DWORD = 0x1000; +pub const LBS_NODATA: DWORD = 0x2000; +pub const LBS_NOSEL: DWORD = 0x4000; +pub const LBS_COMBOBOX: DWORD = 0x8000; +pub const LBS_STANDARD: DWORD = LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER; +pub const CB_OKAY: LRESULT = 0; +pub const CB_ERR: LRESULT = -1; +pub const CB_ERRSPACE: LRESULT = -2; +pub const CBN_ERRSPACE: WORD = -1i16 as u16; +pub const CBN_SELCHANGE: WORD = 1; +pub const CBN_DBLCLK: WORD = 2; +pub const CBN_SETFOCUS: WORD = 3; +pub const CBN_KILLFOCUS: WORD = 4; +pub const CBN_EDITCHANGE: WORD = 5; +pub const CBN_EDITUPDATE: WORD = 6; +pub const CBN_DROPDOWN: WORD = 7; +pub const CBN_CLOSEUP: WORD = 8; +pub const CBN_SELENDOK: WORD = 9; +pub const CBN_SELENDCANCEL: WORD = 10; +pub const CBS_SIMPLE: DWORD = 0x0001; +pub const CBS_DROPDOWN: DWORD = 0x0002; +pub const CBS_DROPDOWNLIST: DWORD = 0x0003; +pub const CBS_OWNERDRAWFIXED: DWORD = 0x0010; +pub const CBS_OWNERDRAWVARIABLE: DWORD = 0x0020; +pub const CBS_AUTOHSCROLL: DWORD = 0x0040; +pub const CBS_OEMCONVERT: DWORD = 0x0080; +pub const CBS_SORT: DWORD = 0x0100; +pub const CBS_HASSTRINGS: DWORD = 0x0200; +pub const CBS_NOINTEGRALHEIGHT: DWORD = 0x0400; +pub const CBS_DISABLENOSCROLL: DWORD = 0x0800; +pub const CBS_UPPERCASE: DWORD = 0x2000; +pub const CBS_LOWERCASE: DWORD = 0x4000; +pub const CB_MULTIPLEADDSTRING: UINT = 0x0163; +pub const CB_GETCOMBOBOXINFO: UINT = 0x0164; +pub const CB_MSGMAX: UINT = 0x0165; +pub const SBS_HORZ: DWORD = 0x0000; +pub const SBS_VERT: DWORD = 0x0001; +pub const SBS_TOPALIGN: DWORD = 0x0002; +pub const SBS_LEFTALIGN: DWORD = 0x0002; +pub const SBS_BOTTOMALIGN: DWORD = 0x0004; +pub const SBS_RIGHTALIGN: DWORD = 0x0004; +pub const SBS_SIZEBOXTOPLEFTALIGN: DWORD = 0x0002; +pub const SBS_SIZEBOXBOTTOMRIGHTALIGN: DWORD = 0x0004; +pub const SBS_SIZEBOX: DWORD = 0x0008; +pub const SBS_SIZEGRIP: DWORD = 0x0010; +pub const SBM_SETPOS: UINT = 0x00E0; +pub const SBM_GETPOS: UINT = 0x00E1; +pub const SBM_SETRANGE: UINT = 0x00E2; +pub const SBM_SETRANGEREDRAW: UINT = 0x00E6; +pub const SBM_GETRANGE: UINT = 0x00E3; +pub const SBM_ENABLE_ARROWS: UINT = 0x00E4; +pub const SBM_SETSCROLLINFO: UINT = 0x00E9; +pub const SBM_GETSCROLLINFO: UINT = 0x00EA; +pub const SBM_GETSCROLLBARINFO: UINT = 0x00EB; +pub const SIF_RANGE: UINT = 0x0001; +pub const SIF_PAGE: UINT = 0x0002; +pub const SIF_POS: UINT = 0x0004; +pub const SIF_DISABLENOSCROLL: UINT = 0x0008; +pub const SIF_TRACKPOS: UINT = 0x0010; +pub const SIF_ALL: UINT = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS; +STRUCT!{struct SCROLLINFO { + cbSize: UINT, + fMask: UINT, + nMin: c_int, + nMax: c_int, + nPage: UINT, + nPos: c_int, + nTrackPos: c_int, +}} +pub type LPSCROLLINFO = *mut SCROLLINFO; +pub type LPCSCROLLINFO = *const SCROLLINFO; +extern "system" { + pub fn SetScrollInfo( + hwnd: HWND, + nBar: c_int, + lpsi: *const SCROLLINFO, + redraw: BOOL, + ) -> c_int; + pub fn GetScrollInfo( + hwnd: HWND, + nBar: c_int, + lpsi: *mut SCROLLINFO, + ) -> BOOL; +} +pub const CCHILDREN_SCROLLBAR: usize = 5; +pub const CDS_UPDATEREGISTRY: DWORD = 0x00000001; +pub const CDS_TEST: DWORD = 0x00000002; +pub const CDS_FULLSCREEN: DWORD = 0x00000004; +pub const CDS_GLOBAL: DWORD = 0x00000008; +pub const CDS_SET_PRIMARY: DWORD = 0x00000010; +pub const CDS_VIDEOPARAMETERS: DWORD = 0x00000020; +pub const CDS_ENABLE_UNSAFE_MODES: DWORD = 0x00000100; +pub const CDS_DISABLE_UNSAFE_MODES: DWORD = 0x00000200; +pub const CDS_RESET: DWORD = 0x40000000; +pub const CDS_RESET_EX: DWORD = 0x20000000; +pub const CDS_NORESET: DWORD = 0x10000000; +pub const DISP_CHANGE_SUCCESSFUL: LONG = 0; +pub const DISP_CHANGE_RESTART: LONG = 1; +pub const DISP_CHANGE_FAILED: LONG = -1; +pub const DISP_CHANGE_BADMODE: LONG = -2; +pub const DISP_CHANGE_NOTUPDATED: LONG = -3; +pub const DISP_CHANGE_BADFLAGS: LONG = -4; +pub const DISP_CHANGE_BADPARAM: LONG = -5; +pub const DISP_CHANGE_BADDUALVIEW: LONG = -6; +extern "system" { + pub fn ChangeDisplaySettingsA( + lpDevMode: *mut DEVMODEA, + dwFlags: DWORD, + ) -> LONG; + pub fn ChangeDisplaySettingsW( + lpDevMode: *mut DEVMODEW, + dwFlags: DWORD, + ) -> LONG; + pub fn ChangeDisplaySettingsExA( + lpszDeviceName: LPCSTR, + lpDevMode: *mut DEVMODEA, + hwnd: HWND, + dwFlags: DWORD, + lParam: LPVOID, + ) -> LONG; + pub fn ChangeDisplaySettingsExW( + lpszDeviceName: LPCWSTR, + lpDevMode: *mut DEVMODEW, + hwnd: HWND, + dwFlags: DWORD, + lParam: LPVOID, + ) -> LONG; + pub fn EnumDisplaySettingsA( + lpszDeviceName: LPCSTR, + iModeNum: DWORD, + lpDevMode: *mut DEVMODEA, + ) -> BOOL; + pub fn EnumDisplaySettingsW( + lpszDeviceName: LPCWSTR, + iModeNum: DWORD, + lpDevMode: *mut DEVMODEW, + ) -> BOOL; + pub fn EnumDisplaySettingsExA( + lpszDeviceName: LPCSTR, + iModeNum: DWORD, + lpDevMode: *mut DEVMODEA, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDisplaySettingsExW( + lpszDeviceName: LPCWSTR, + iModeNum: DWORD, + lpDevMode: *mut DEVMODEW, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDisplayDevicesA( + lpDevice: LPCSTR, + iDevNum: DWORD, + lpDisplayDevice: PDISPLAY_DEVICEA, + dwFlags: DWORD, + ) -> BOOL; + pub fn EnumDisplayDevicesW( + lpDevice: LPCWSTR, + iDevNum: DWORD, + lpDisplayDevice: PDISPLAY_DEVICEW, + dwFlags: DWORD, + ) -> BOOL; +} +pub const EDD_GET_DEVICE_INTERFACE_NAME: DWORD = 0x00000001; +extern "system" { + pub fn SystemParametersInfoA( + uiAction: UINT, + uiParam: UINT, + pvParam: PVOID, + fWinIni: UINT, + ) -> BOOL; + pub fn SystemParametersInfoW( + uiAction: UINT, + uiParam: UINT, + pvParam: PVOID, + fWinIni: UINT, + ) -> BOOL; +} +pub const ENUM_CURRENT_SETTINGS: DWORD = 0xFFFFFFFF; +pub const ENUM_REGISTRY_SETTINGS: DWORD = 0xFFFFFFFE; +pub const MDITILE_VERTICAL: UINT = 0x0000; +pub const MDITILE_HORIZONTAL: UINT = 0x0001; +pub const MDITILE_SKIPDISABLED: UINT = 0x0002; +pub const MDITILE_ZORDER: UINT = 0x0004; +extern "system" { + pub fn DefFrameProcA( + hwnd: HWND, + hwndMDIClient: HWND, + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn DefFrameProcW( + hwnd: HWND, + hwndMDIClient: HWND, + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn DefMDIChildProcA( + hwnd: HWND, + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn DefMDIChildProcW( + hwnd: HWND, + uMsg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> LRESULT; + pub fn ArrangeIconicWindows( + hWnd: HWND, + ) -> UINT; + pub fn CreateMDIWindowA( + lpClassName: LPCSTR, + lpWindowName: LPCSTR, + dwStyle: DWORD, + X: c_int, + Y: c_int, + nWidth: c_int, + nHeight: c_int, + hWndParent: HWND, + hInstance: HINSTANCE, + lParam: LPARAM, + ) -> HWND; + pub fn CreateMDIWindowW( + lpClassName: LPCWSTR, + lpWindowName: LPCWSTR, + dwStyle: DWORD, + X: c_int, + Y: c_int, + nWidth: c_int, + nHeight: c_int, + hWndParent: HWND, + hInstance: HINSTANCE, + lParam: LPARAM, + ) -> HWND; + pub fn CascadeWindows( + hwndParent: HWND, + wHow: UINT, + lpRect: *const RECT, + cKids: UINT, + lpKids: *const HWND, + ) -> WORD; +} +FN!{stdcall MSGBOXCALLBACK( + LPHELPINFO, +) -> ()} +FN!{stdcall WINEVENTPROC( + HWINEVENTHOOK, + DWORD, + HWND, + LONG, + LONG, + DWORD, + DWORD, +) -> ()} +STRUCT!{struct SCROLLBARINFO { + cbSize: DWORD, + rcScrollBar: RECT, + dxyLineButton: c_int, + xyThumbTop: c_int, + xyThumbBottom: c_int, + reserved: c_int, + rgstate: [DWORD; CCHILDREN_SCROLLBAR + 1], +}} +pub type PSCROLLBARINFO = *mut SCROLLBARINFO; +pub type LPSCROLLBARINFO = *mut SCROLLBARINFO; +STRUCT!{struct SIZE { + cx: LONG, + cy: LONG, +}} +pub type PSIZE = *mut SIZE; +pub type LPSIZE = *mut SIZE; +pub type SIZEL = SIZE; +pub type PSIZEL = *mut SIZEL; +pub type LPSIZEL = *mut SIZEL; +//8855 (Win 7 SDK) +STRUCT!{struct ICONINFO { + fIcon: BOOL, + xHotspot: DWORD, + yHotspot: DWORD, + hbmMask: HBITMAP, + hbmColor: HBITMAP, +}} +pub type PICONINFO = *mut ICONINFO; +//9066 +//10069 +pub const SC_SIZE: WPARAM = 0xF000; +pub const SC_MOVE: WPARAM = 0xF010; +pub const SC_MINIMIZE: WPARAM = 0xF020; +pub const SC_MAXIMIZE: WPARAM = 0xF030; +pub const SC_NEXTWINDOW: WPARAM = 0xF040; +pub const SC_PREVWINDOW: WPARAM = 0xF050; +pub const SC_CLOSE: WPARAM = 0xF060; +pub const SC_VSCROLL: WPARAM = 0xF070; +pub const SC_HSCROLL: WPARAM = 0xF080; +pub const SC_MOUSEMENU: WPARAM = 0xF090; +pub const SC_KEYMENU: WPARAM = 0xF100; +pub const SC_ARRANGE: WPARAM = 0xF110; +pub const SC_RESTORE: WPARAM = 0xF120; +pub const SC_TASKLIST: WPARAM = 0xF130; +pub const SC_SCREENSAVE: WPARAM = 0xF140; +pub const SC_HOTKEY: WPARAM = 0xF150; +pub const SC_DEFAULT: WPARAM = 0xF160; +pub const SC_MONITORPOWER: WPARAM = 0xF170; +pub const SC_CONTEXTHELP: WPARAM = 0xF180; +pub const SC_SEPARATOR: WPARAM = 0xF00F; +extern "system" { + pub fn LoadBitmapA( + hInstance: HINSTANCE, + lpBitmapName: LPCSTR, + ) -> HBITMAP; + pub fn LoadBitmapW( + hInstance: HINSTANCE, + lpBitmapName: LPCWSTR, + ) -> HBITMAP; + pub fn LoadCursorA( + hInstance: HINSTANCE, + lpCursorName: LPCSTR, + ) -> HCURSOR; + pub fn LoadCursorW( + hInstance: HINSTANCE, + lpCursorName: LPCWSTR, + ) -> HCURSOR; + pub fn LoadCursorFromFileA( + lpFileName: LPCSTR, + ) -> HCURSOR; + pub fn LoadCursorFromFileW( + lpFileName: LPCWSTR, + ) -> HCURSOR; + pub fn CreateCursor( + hInst: HINSTANCE, + xHotSpot: c_int, + yHotSpot: c_int, + nWidth: c_int, + nHeight: c_int, + pvAndPlane: *const VOID, + pvXORPlane: *const VOID, + ) -> HCURSOR; + pub fn DestroyCursor( + hCursor: HCURSOR, + ) -> BOOL; +} +pub const IDC_ARROW: LPCWSTR = 32512 as LPCWSTR; +pub const IDC_IBEAM: LPCWSTR = 32513 as LPCWSTR; +pub const IDC_WAIT: LPCWSTR = 32514 as LPCWSTR; +pub const IDC_CROSS: LPCWSTR = 32515 as LPCWSTR; +pub const IDC_UPARROW: LPCWSTR = 32516 as LPCWSTR; +pub const IDC_SIZE: LPCWSTR = 32640 as LPCWSTR; +pub const IDC_ICON: LPCWSTR = 32641 as LPCWSTR; +pub const IDC_SIZENWSE: LPCWSTR = 32642 as LPCWSTR; +pub const IDC_SIZENESW: LPCWSTR = 32643 as LPCWSTR; +pub const IDC_SIZEWE: LPCWSTR = 32644 as LPCWSTR; +pub const IDC_SIZENS: LPCWSTR = 32645 as LPCWSTR; +pub const IDC_SIZEALL: LPCWSTR = 32646 as LPCWSTR; +pub const IDC_NO: LPCWSTR = 32648 as LPCWSTR; +pub const IDC_HAND: LPCWSTR = 32649 as LPCWSTR; +pub const IDC_APPSTARTING: LPCWSTR = 32650 as LPCWSTR; +pub const IDC_HELP: LPCWSTR = 32651 as LPCWSTR; +extern "system" { + pub fn SetSystemCursor( + hcur: HCURSOR, + id: DWORD, + ) -> BOOL; + pub fn CreateIcon( + hInstance: HINSTANCE, + nWidth: c_int, + nHeight: c_int, + cPlanes: BYTE, + cBitsPixel: BYTE, + lpbANDbits: *const BYTE, + lpbXORbits: *const BYTE, + ) -> HICON; + pub fn DestroyIcon( + hIcon: HICON, + ) -> BOOL; + pub fn LookupIconIdFromDirectory( + presbits: PBYTE, + fIcon: BOOL, + ) -> c_int; + pub fn LookupIconIdFromDirectoryEx( + presbits: PBYTE, + fIcon: BOOL, + cxDesired: c_int, + cyDesired: c_int, + Flags: UINT, + ) -> c_int; + pub fn CreateIconFromResource( + presbits: PBYTE, + dwResSize: DWORD, + fIcon: BOOL, + dwVer: DWORD, + ) -> HICON; + pub fn CreateIconFromResourceEx( + presbits: PBYTE, + dwResSize: DWORD, + fIcon: BOOL, + dwVer: DWORD, + cxDesired: c_int, + cyDesired: c_int, + Flags: UINT, + ) -> HICON; +} +pub const IMAGE_BITMAP: UINT = 0; +pub const IMAGE_ICON: UINT = 1; +pub const IMAGE_CURSOR: UINT = 2; +pub const IMAGE_ENHMETAFILE: UINT = 3; +pub const LR_DEFAULTCOLOR: UINT = 0x00000000; +pub const LR_MONOCHROME: UINT = 0x00000001; +pub const LR_COLOR: UINT = 0x00000002; +pub const LR_COPYRETURNORG: UINT = 0x00000004; +pub const LR_COPYDELETEORG: UINT = 0x00000008; +pub const LR_LOADFROMFILE: UINT = 0x00000010; +pub const LR_LOADTRANSPARENT: UINT = 0x00000020; +pub const LR_DEFAULTSIZE: UINT = 0x00000040; +pub const LR_VGACOLOR: UINT = 0x00000080; +pub const LR_LOADMAP3DCOLORS: UINT = 0x00001000; +pub const LR_CREATEDIBSECTION: UINT = 0x00002000; +pub const LR_COPYFROMRESOURCE: UINT = 0x00004000; +pub const LR_SHARED: UINT = 0x00008000; +extern "system" { + pub fn LoadImageA( + hInst: HINSTANCE, + name: LPCSTR, + type_: UINT, + cx: c_int, + cy: c_int, + fuLoad: UINT, + ) -> HANDLE; + pub fn LoadImageW( + hInst: HINSTANCE, + name: LPCWSTR, + type_: UINT, + cx: c_int, + cy: c_int, + fuLoad: UINT, + ) -> HANDLE; + pub fn CopyImage( + h: HANDLE, + type_: UINT, + cx: c_int, + cy: c_int, + flags: UINT, + ) -> HANDLE; + pub fn DrawIconEx( + hdc: HDC, + xLeft: c_int, + yTop: c_int, + hIcon: HICON, + cxWidth: c_int, + cyWidth: c_int, + istepIfAniCur: UINT, + hbrFlickerFreeDraw: HBRUSH, + diFlags: UINT, + ) -> BOOL; + pub fn CreateIconIndirect( + piconinfo: PICONINFO, + ) -> HICON; +} +pub const IDI_APPLICATION: LPCWSTR = 32512 as LPCWSTR; +pub const IDI_HAND: LPCWSTR = 32513 as LPCWSTR; +pub const IDI_QUESTION: LPCWSTR = 32514 as LPCWSTR; +pub const IDI_EXCLAMATION: LPCWSTR = 32515 as LPCWSTR; +pub const IDI_ASTERISK: LPCWSTR = 32516 as LPCWSTR; +pub const IDI_WINLOGO: LPCWSTR = 32517 as LPCWSTR; +pub const IDI_SHIELD: LPCWSTR = 32518 as LPCWSTR; +pub const IDI_WARNING: LPCWSTR = IDI_EXCLAMATION; +pub const IDI_ERROR: LPCWSTR = IDI_HAND; +pub const IDI_INFORMATION: LPCWSTR = IDI_ASTERISK; +extern "system" { + pub fn WinHelpA( + hWndMain: HWND, + lpszHelp: LPCSTR, + uCommand: UINT, + dwData: ULONG_PTR, + ) -> BOOL; + pub fn WinHelpW( + hWndMain: HWND, + lpszHelp: LPCWSTR, + uCommand: UINT, + dwData: ULONG_PTR, + ) -> BOOL; + pub fn CopyIcon( + hIcon: HICON, + ) -> HICON; + pub fn GetIconInfo( + hIcon: HICON, + piconinfo: PICONINFO, + ) -> BOOL; +} +pub const SPI_GETBEEP: UINT = 0x0001; +pub const SPI_SETBEEP: UINT = 0x0002; +pub const SPI_GETMOUSE: UINT = 0x0003; +pub const SPI_SETMOUSE: UINT = 0x0004; +pub const SPI_GETBORDER: UINT = 0x0005; +pub const SPI_SETBORDER: UINT = 0x0006; +pub const SPI_GETKEYBOARDSPEED: UINT = 0x000A; +pub const SPI_SETKEYBOARDSPEED: UINT = 0x000B; +pub const SPI_LANGDRIVER: UINT = 0x000C; +pub const SPI_ICONHORIZONTALSPACING: UINT = 0x000D; +pub const SPI_GETSCREENSAVETIMEOUT: UINT = 0x000E; +pub const SPI_SETSCREENSAVETIMEOUT: UINT = 0x000F; +pub const SPI_GETSCREENSAVEACTIVE: UINT = 0x0010; +pub const SPI_SETSCREENSAVEACTIVE: UINT = 0x0011; +pub const SPI_GETGRIDGRANULARITY: UINT = 0x0012; +pub const SPI_SETGRIDGRANULARITY: UINT = 0x0013; +pub const SPI_SETDESKWALLPAPER: UINT = 0x0014; +pub const SPI_SETDESKPATTERN: UINT = 0x0015; +pub const SPI_GETKEYBOARDDELAY: UINT = 0x0016; +pub const SPI_SETKEYBOARDDELAY: UINT = 0x0017; +pub const SPI_ICONVERTICALSPACING: UINT = 0x0018; +pub const SPI_GETICONTITLEWRAP: UINT = 0x0019; +pub const SPI_SETICONTITLEWRAP: UINT = 0x001A; +pub const SPI_GETMENUDROPALIGNMENT: UINT = 0x001B; +pub const SPI_SETMENUDROPALIGNMENT: UINT = 0x001C; +pub const SPI_SETDOUBLECLKWIDTH: UINT = 0x001D; +pub const SPI_SETDOUBLECLKHEIGHT: UINT = 0x001E; +pub const SPI_GETICONTITLELOGFONT: UINT = 0x001F; +pub const SPI_SETDOUBLECLICKTIME: UINT = 0x0020; +pub const SPI_SETMOUSEBUTTONSWAP: UINT = 0x0021; +pub const SPI_SETICONTITLELOGFONT: UINT = 0x0022; +pub const SPI_GETFASTTASKSWITCH: UINT = 0x0023; +pub const SPI_SETFASTTASKSWITCH: UINT = 0x0024; +pub const SPI_SETDRAGFULLWINDOWS: UINT = 0x0025; +pub const SPI_GETDRAGFULLWINDOWS: UINT = 0x0026; +pub const SPI_GETNONCLIENTMETRICS: UINT = 0x0029; +pub const SPI_SETNONCLIENTMETRICS: UINT = 0x002A; +pub const SPI_GETMINIMIZEDMETRICS: UINT = 0x002B; +pub const SPI_SETMINIMIZEDMETRICS: UINT = 0x002C; +pub const SPI_GETICONMETRICS: UINT = 0x002D; +pub const SPI_SETICONMETRICS: UINT = 0x002E; +pub const SPI_SETWORKAREA: UINT = 0x002F; +pub const SPI_GETWORKAREA: UINT = 0x0030; +pub const SPI_SETPENWINDOWS: UINT = 0x0031; +pub const SPI_GETHIGHCONTRAST: UINT = 0x0042; +pub const SPI_SETHIGHCONTRAST: UINT = 0x0043; +pub const SPI_GETKEYBOARDPREF: UINT = 0x0044; +pub const SPI_SETKEYBOARDPREF: UINT = 0x0045; +pub const SPI_GETSCREENREADER: UINT = 0x0046; +pub const SPI_SETSCREENREADER: UINT = 0x0047; +pub const SPI_GETANIMATION: UINT = 0x0048; +pub const SPI_SETANIMATION: UINT = 0x0049; +pub const SPI_GETFONTSMOOTHING: UINT = 0x004A; +pub const SPI_SETFONTSMOOTHING: UINT = 0x004B; +pub const SPI_SETDRAGWIDTH: UINT = 0x004C; +pub const SPI_SETDRAGHEIGHT: UINT = 0x004D; +pub const SPI_SETHANDHELD: UINT = 0x004E; +pub const SPI_GETLOWPOWERTIMEOUT: UINT = 0x004F; +pub const SPI_GETPOWEROFFTIMEOUT: UINT = 0x0050; +pub const SPI_SETLOWPOWERTIMEOUT: UINT = 0x0051; +pub const SPI_SETPOWEROFFTIMEOUT: UINT = 0x0052; +pub const SPI_GETLOWPOWERACTIVE: UINT = 0x0053; +pub const SPI_GETPOWEROFFACTIVE: UINT = 0x0054; +pub const SPI_SETLOWPOWERACTIVE: UINT = 0x0055; +pub const SPI_SETPOWEROFFACTIVE: UINT = 0x0056; +pub const SPI_SETCURSORS: UINT = 0x0057; +pub const SPI_SETICONS: UINT = 0x0058; +pub const SPI_GETDEFAULTINPUTLANG: UINT = 0x0059; +pub const SPI_SETDEFAULTINPUTLANG: UINT = 0x005A; +pub const SPI_SETLANGTOGGLE: UINT = 0x005B; +pub const SPI_GETWINDOWSEXTENSION: UINT = 0x005C; +pub const SPI_SETMOUSETRAILS: UINT = 0x005D; +pub const SPI_GETMOUSETRAILS: UINT = 0x005E; +pub const SPI_SETSCREENSAVERRUNNING: UINT = 0x0061; +pub const SPI_SCREENSAVERRUNNING: UINT = SPI_SETSCREENSAVERRUNNING; +pub const SPI_GETFILTERKEYS: UINT = 0x0032; +pub const SPI_SETFILTERKEYS: UINT = 0x0033; +pub const SPI_GETTOGGLEKEYS: UINT = 0x0034; +pub const SPI_SETTOGGLEKEYS: UINT = 0x0035; +pub const SPI_GETMOUSEKEYS: UINT = 0x0036; +pub const SPI_SETMOUSEKEYS: UINT = 0x0037; +pub const SPI_GETSHOWSOUNDS: UINT = 0x0038; +pub const SPI_SETSHOWSOUNDS: UINT = 0x0039; +pub const SPI_GETSTICKYKEYS: UINT = 0x003A; +pub const SPI_SETSTICKYKEYS: UINT = 0x003B; +pub const SPI_GETACCESSTIMEOUT: UINT = 0x003C; +pub const SPI_SETACCESSTIMEOUT: UINT = 0x003D; +pub const SPI_GETSERIALKEYS: UINT = 0x003E; +pub const SPI_SETSERIALKEYS: UINT = 0x003F; +pub const SPI_GETSOUNDSENTRY: UINT = 0x0040; +pub const SPI_SETSOUNDSENTRY: UINT = 0x0041; +pub const SPI_GETSNAPTODEFBUTTON: UINT = 0x005F; +pub const SPI_SETSNAPTODEFBUTTON: UINT = 0x0060; +pub const SPI_GETMOUSEHOVERWIDTH: UINT = 0x0062; +pub const SPI_SETMOUSEHOVERWIDTH: UINT = 0x0063; +pub const SPI_GETMOUSEHOVERHEIGHT: UINT = 0x0064; +pub const SPI_SETMOUSEHOVERHEIGHT: UINT = 0x0065; +pub const SPI_GETMOUSEHOVERTIME: UINT = 0x0066; +pub const SPI_SETMOUSEHOVERTIME: UINT = 0x0067; +pub const SPI_GETWHEELSCROLLLINES: UINT = 0x0068; +pub const SPI_SETWHEELSCROLLLINES: UINT = 0x0069; +pub const SPI_GETMENUSHOWDELAY: UINT = 0x006A; +pub const SPI_SETMENUSHOWDELAY: UINT = 0x006B; +pub const SPI_GETWHEELSCROLLCHARS: UINT = 0x006C; +pub const SPI_SETWHEELSCROLLCHARS: UINT = 0x006D; +pub const SPI_GETSHOWIMEUI: UINT = 0x006E; +pub const SPI_SETSHOWIMEUI: UINT = 0x006F; +pub const SPI_GETMOUSESPEED: UINT = 0x0070; +pub const SPI_SETMOUSESPEED: UINT = 0x0071; +pub const SPI_GETSCREENSAVERRUNNING: UINT = 0x0072; +pub const SPI_GETDESKWALLPAPER: UINT = 0x0073; +pub const SPI_GETAUDIODESCRIPTION: UINT = 0x0074; +pub const SPI_SETAUDIODESCRIPTION: UINT = 0x0075; +pub const SPI_GETSCREENSAVESECURE: UINT = 0x0076; +pub const SPI_SETSCREENSAVESECURE: UINT = 0x0077; +pub const SPI_GETHUNGAPPTIMEOUT: UINT = 0x0078; +pub const SPI_SETHUNGAPPTIMEOUT: UINT = 0x0079; +pub const SPI_GETWAITTOKILLTIMEOUT: UINT = 0x007A; +pub const SPI_SETWAITTOKILLTIMEOUT: UINT = 0x007B; +pub const SPI_GETWAITTOKILLSERVICETIMEOUT: UINT = 0x007C; +pub const SPI_SETWAITTOKILLSERVICETIMEOUT: UINT = 0x007D; +pub const SPI_GETMOUSEDOCKTHRESHOLD: UINT = 0x007E; +pub const SPI_SETMOUSEDOCKTHRESHOLD: UINT = 0x007F; +pub const SPI_GETPENDOCKTHRESHOLD: UINT = 0x0080; +pub const SPI_SETPENDOCKTHRESHOLD: UINT = 0x0081; +pub const SPI_GETWINARRANGING: UINT = 0x0082; +pub const SPI_SETWINARRANGING: UINT = 0x0083; +pub const SPI_GETMOUSEDRAGOUTTHRESHOLD: UINT = 0x0084; +pub const SPI_SETMOUSEDRAGOUTTHRESHOLD: UINT = 0x0085; +pub const SPI_GETPENDRAGOUTTHRESHOLD: UINT = 0x0086; +pub const SPI_SETPENDRAGOUTTHRESHOLD: UINT = 0x0087; +pub const SPI_GETMOUSESIDEMOVETHRESHOLD: UINT = 0x0088; +pub const SPI_SETMOUSESIDEMOVETHRESHOLD: UINT = 0x0089; +pub const SPI_GETPENSIDEMOVETHRESHOLD: UINT = 0x008A; +pub const SPI_SETPENSIDEMOVETHRESHOLD: UINT = 0x008B; +pub const SPI_GETDRAGFROMMAXIMIZE: UINT = 0x008C; +pub const SPI_SETDRAGFROMMAXIMIZE: UINT = 0x008D; +pub const SPI_GETSNAPSIZING: UINT = 0x008E; +pub const SPI_SETSNAPSIZING: UINT = 0x008F; +pub const SPI_GETDOCKMOVING: UINT = 0x0090; +pub const SPI_SETDOCKMOVING: UINT = 0x0091; +pub const SPI_GETACTIVEWINDOWTRACKING: UINT = 0x1000; +pub const SPI_SETACTIVEWINDOWTRACKING: UINT = 0x1001; +pub const SPI_GETMENUANIMATION: UINT = 0x1002; +pub const SPI_SETMENUANIMATION: UINT = 0x1003; +pub const SPI_GETCOMBOBOXANIMATION: UINT = 0x1004; +pub const SPI_SETCOMBOBOXANIMATION: UINT = 0x1005; +pub const SPI_GETLISTBOXSMOOTHSCROLLING: UINT = 0x1006; +pub const SPI_SETLISTBOXSMOOTHSCROLLING: UINT = 0x1007; +pub const SPI_GETGRADIENTCAPTIONS: UINT = 0x1008; +pub const SPI_SETGRADIENTCAPTIONS: UINT = 0x1009; +pub const SPI_GETKEYBOARDCUES: UINT = 0x100A; +pub const SPI_SETKEYBOARDCUES: UINT = 0x100B; +pub const SPI_GETMENUUNDERLINES: UINT = SPI_GETKEYBOARDCUES; +pub const SPI_SETMENUUNDERLINES: UINT = SPI_SETKEYBOARDCUES; +pub const SPI_GETACTIVEWNDTRKZORDER: UINT = 0x100C; +pub const SPI_SETACTIVEWNDTRKZORDER: UINT = 0x100D; +pub const SPI_GETHOTTRACKING: UINT = 0x100E; +pub const SPI_SETHOTTRACKING: UINT = 0x100F; +pub const SPI_GETMENUFADE: UINT = 0x1012; +pub const SPI_SETMENUFADE: UINT = 0x1013; +pub const SPI_GETSELECTIONFADE: UINT = 0x1014; +pub const SPI_SETSELECTIONFADE: UINT = 0x1015; +pub const SPI_GETTOOLTIPANIMATION: UINT = 0x1016; +pub const SPI_SETTOOLTIPANIMATION: UINT = 0x1017; +pub const SPI_GETTOOLTIPFADE: UINT = 0x1018; +pub const SPI_SETTOOLTIPFADE: UINT = 0x1019; +pub const SPI_GETCURSORSHADOW: UINT = 0x101A; +pub const SPI_SETCURSORSHADOW: UINT = 0x101B; +pub const SPI_GETMOUSESONAR: UINT = 0x101C; +pub const SPI_SETMOUSESONAR: UINT = 0x101D; +pub const SPI_GETMOUSECLICKLOCK: UINT = 0x101E; +pub const SPI_SETMOUSECLICKLOCK: UINT = 0x101F; +pub const SPI_GETMOUSEVANISH: UINT = 0x1020; +pub const SPI_SETMOUSEVANISH: UINT = 0x1021; +pub const SPI_GETFLATMENU: UINT = 0x1022; +pub const SPI_SETFLATMENU: UINT = 0x1023; +pub const SPI_GETDROPSHADOW: UINT = 0x1024; +pub const SPI_SETDROPSHADOW: UINT = 0x1025; +pub const SPI_GETBLOCKSENDINPUTRESETS: UINT = 0x1026; +pub const SPI_SETBLOCKSENDINPUTRESETS: UINT = 0x1027; +pub const SPI_GETUIEFFECTS: UINT = 0x103E; +pub const SPI_SETUIEFFECTS: UINT = 0x103F; +pub const SPI_GETDISABLEOVERLAPPEDCONTENT: UINT = 0x1040; +pub const SPI_SETDISABLEOVERLAPPEDCONTENT: UINT = 0x1041; +pub const SPI_GETCLIENTAREAANIMATION: UINT = 0x1042; +pub const SPI_SETCLIENTAREAANIMATION: UINT = 0x1043; +pub const SPI_GETCLEARTYPE: UINT = 0x1048; +pub const SPI_SETCLEARTYPE: UINT = 0x1049; +pub const SPI_GETSPEECHRECOGNITION: UINT = 0x104A; +pub const SPI_SETSPEECHRECOGNITION: UINT = 0x104B; +pub const SPI_GETFOREGROUNDLOCKTIMEOUT: UINT = 0x2000; +pub const SPI_SETFOREGROUNDLOCKTIMEOUT: UINT = 0x2001; +pub const SPI_GETACTIVEWNDTRKTIMEOUT: UINT = 0x2002; +pub const SPI_SETACTIVEWNDTRKTIMEOUT: UINT = 0x2003; +pub const SPI_GETFOREGROUNDFLASHCOUNT: UINT = 0x2004; +pub const SPI_SETFOREGROUNDFLASHCOUNT: UINT = 0x2005; +pub const SPI_GETCARETWIDTH: UINT = 0x2006; +pub const SPI_SETCARETWIDTH: UINT = 0x2007; +pub const SPI_GETMOUSECLICKLOCKTIME: UINT = 0x2008; +pub const SPI_SETMOUSECLICKLOCKTIME: UINT = 0x2009; +pub const SPI_GETFONTSMOOTHINGTYPE: UINT = 0x200A; +pub const SPI_SETFONTSMOOTHINGTYPE: UINT = 0x200B; +pub const FE_FONTSMOOTHINGSTANDARD: UINT = 0x0001; +pub const FE_FONTSMOOTHINGCLEARTYPE: UINT = 0x0002; +pub const SPI_GETFONTSMOOTHINGCONTRAST: UINT = 0x200C; +pub const SPI_SETFONTSMOOTHINGCONTRAST: UINT = 0x200D; +pub const SPI_GETFOCUSBORDERWIDTH: UINT = 0x200E; +pub const SPI_SETFOCUSBORDERWIDTH: UINT = 0x200F; +pub const SPI_GETFOCUSBORDERHEIGHT: UINT = 0x2010; +pub const SPI_SETFOCUSBORDERHEIGHT: UINT = 0x2011; +pub const SPI_GETFONTSMOOTHINGORIENTATION: UINT = 0x2012; +pub const SPI_SETFONTSMOOTHINGORIENTATION: UINT = 0x2013; +pub const FE_FONTSMOOTHINGORIENTATIONBGR: UINT = 0x0000; +pub const FE_FONTSMOOTHINGORIENTATIONRGB: UINT = 0x0001; +pub const SPI_GETMINIMUMHITRADIUS: UINT = 0x2014; +pub const SPI_SETMINIMUMHITRADIUS: UINT = 0x2015; +pub const SPI_GETMESSAGEDURATION: UINT = 0x2016; +pub const SPI_SETMESSAGEDURATION: UINT = 0x2017; +//11264 +pub const CB_GETEDITSEL: UINT = 0x0140; +pub const CB_LIMITTEXT: UINT = 0x0141; +pub const CB_SETEDITSEL: UINT = 0x0142; +pub const CB_ADDSTRING: UINT = 0x0143; +pub const CB_DELETESTRING: UINT = 0x0144; +pub const CB_DIR: UINT = 0x0145; +pub const CB_GETCOUNT: UINT = 0x0146; +pub const CB_GETCURSEL: UINT = 0x0147; +pub const CB_GETLBTEXT: UINT = 0x0148; +pub const CB_GETLBTEXTLEN: UINT = 0x0149; +pub const CB_INSERTSTRING: UINT = 0x014A; +pub const CB_RESETCONTENT: UINT = 0x014B; +pub const CB_FINDSTRING: UINT = 0x014C; +pub const CB_SELECTSTRING: UINT = 0x014D; +pub const CB_SETCURSEL: UINT = 0x014E; +pub const CB_SHOWDROPDOWN: UINT = 0x014F; +pub const CB_GETITEMDATA: UINT = 0x0150; +pub const CB_SETITEMDATA: UINT = 0x0151; +pub const CB_GETDROPPEDCONTROLRECT: UINT = 0x0152; +pub const CB_SETITEMHEIGHT: UINT = 0x0153; +pub const CB_GETITEMHEIGHT: UINT = 0x0154; +pub const CB_SETEXTENDEDUI: UINT = 0x0155; +pub const CB_GETEXTENDEDUI: UINT = 0x0156; +pub const CB_GETDROPPEDSTATE: UINT = 0x0157; +pub const CB_FINDSTRINGEXACT: UINT = 0x0158; +pub const CB_SETLOCALE: UINT = 0x0159; +pub const CB_GETLOCALE: UINT = 0x015A; +pub const CB_GETTOPINDEX: UINT = 0x015b; +pub const CB_SETTOPINDEX: UINT = 0x015c; +pub const CB_GETHORIZONTALEXTENT: UINT = 0x015d; +pub const CB_SETHORIZONTALEXTENT: UINT = 0x015e; +pub const CB_GETDROPPEDWIDTH: UINT = 0x015f; +pub const CB_SETDROPPEDWIDTH: UINT = 0x0160; +pub const CB_INITSTORAGE: UINT = 0x0161; +//12141 +STRUCT!{struct NONCLIENTMETRICSA { + cbSize: UINT, + iBorderWidth: c_int, + iScrollWidth: c_int, + iScrollHeight: c_int, + iCaptionWidth: c_int, + iCaptionHeight: c_int, + lfCaptionFont: LOGFONTA, + iSmCaptionWidth: c_int, + iSmCaptionHeight: c_int, + lfSmCaptionFont: LOGFONTA, + iMenuWidth: c_int, + iMenuHeight: c_int, + lfMenuFont: LOGFONTA, + lfStatusFont: LOGFONTA, + lfMessageFont: LOGFONTA, + iPaddedBorderWidth: c_int, +}} +pub type LPNONCLIENTMETRICSA = *mut NONCLIENTMETRICSA; +STRUCT!{struct NONCLIENTMETRICSW { + cbSize: UINT, + iBorderWidth: c_int, + iScrollWidth: c_int, + iScrollHeight: c_int, + iCaptionWidth: c_int, + iCaptionHeight: c_int, + lfCaptionFont: LOGFONTW, + iSmCaptionWidth: c_int, + iSmCaptionHeight: c_int, + lfSmCaptionFont: LOGFONTW, + iMenuWidth: c_int, + iMenuHeight: c_int, + lfMenuFont: LOGFONTW, + lfStatusFont: LOGFONTW, + lfMessageFont: LOGFONTW, + iPaddedBorderWidth: c_int, +}} +pub type LPNONCLIENTMETRICSW = *mut NONCLIENTMETRICSW; +//12869 +extern "system" { + pub fn SetLastErrorEx( + dwErrCode: DWORD, + dwType: DWORD, + ); + pub fn InternalGetWindowText( + hWnd: HWND, + pString: LPWSTR, + cchMaxCount: c_int, + ) -> c_int; + pub fn EndTask( + hWnd: HWND, + fShutDown: BOOL, + fForce: BOOL, + ) -> BOOL; + pub fn CancelShutdown() -> BOOL; +} +pub const MONITOR_DEFAULTTONULL: DWORD = 0x00000000; +pub const MONITOR_DEFAULTTOPRIMARY: DWORD = 0x00000001; +pub const MONITOR_DEFAULTTONEAREST: DWORD = 0x00000002; +//12900 +extern "system" { + pub fn MonitorFromPoint( + pt: POINT, + dwFlags: DWORD, + ) -> HMONITOR; + pub fn MonitorFromRect( + lprc: LPCRECT, + dwFlags: DWORD, + ) -> HMONITOR; + pub fn MonitorFromWindow( + hwnd: HWND, + dwFlags: DWORD, + ) -> HMONITOR; +} +pub const MONITORINFOF_PRIMARY: DWORD = 1; +pub const CCHDEVICENAME: usize = 32; +STRUCT!{struct MONITORINFO { + cbSize: DWORD, + rcMonitor: RECT, + rcWork: RECT, + dwFlags: DWORD, +}} +pub type LPMONITORINFO = *mut MONITORINFO; +STRUCT!{struct MONITORINFOEXA { + cbSize: DWORD, + rcMonitor: RECT, + rcWork: RECT, + dwFlags: DWORD, + szDevice: [CHAR; CCHDEVICENAME], +}} +pub type LPMONITORINFOEXA = *mut MONITORINFOEXA; +STRUCT!{struct MONITORINFOEXW { + cbSize: DWORD, + rcMonitor: RECT, + rcWork: RECT, + dwFlags: DWORD, + szDevice: [WCHAR; CCHDEVICENAME], +}} +pub type LPMONITORINFOEXW = *mut MONITORINFOEXW; +//12971 +extern "system" { + pub fn GetMonitorInfoA( + hMonitor: HMONITOR, + lpmi: LPMONITORINFO, + ) -> BOOL; + pub fn GetMonitorInfoW( + hMonitor: HMONITOR, + lpmi: LPMONITORINFO, + ) -> BOOL; +} +FN!{stdcall MONITORENUMPROC( + HMONITOR, + HDC, + LPRECT, + LPARAM, +) -> BOOL} +extern "system" { + pub fn EnumDisplayMonitors( + hdc: HDC, + lprcClip: LPCRECT, + lpfnEnum: MONITORENUMPROC, + dwData: LPARAM, + ) -> BOOL; + pub fn NotifyWinEvent( + event: DWORD, + hwnd: HWND, + idObject: LONG, + idChild: LONG, + ); + pub fn SetWinEventHook( + eventMin: DWORD, + eventMax: DWORD, + hmodWinEventProc: HMODULE, + pfnWinEventProc: WINEVENTPROC, + idProcess: DWORD, + idThread: DWORD, + dwFlags: DWORD, + ) -> HWINEVENTHOOK; + pub fn IsWinEventHookInstalled( + event: DWORD, + ) -> BOOL; + pub fn UnhookWinEvent( + hWinEventHook: HWINEVENTHOOK, + ) -> BOOL; +//14098 + pub fn BlockInput( + fBlockIt: BOOL, + ) -> BOOL; + pub fn IsProcessDPIAware() -> BOOL; + pub fn GetWindowModuleFileNameA( + hWnd: HWND, + lpszFileName: LPCSTR, + cchFileNameMax: UINT, + ) -> UINT; + pub fn GetWindowModuleFileNameW( + hWnd: HWND, + lpszFileName: LPWSTR, + cchFileNameMax: UINT, + ) -> UINT; + pub fn GetAncestor( + hWnd: HWND, + gaFlags: UINT, + ) -> HWND; + pub fn RealChildWindowFromPoint( + hwndParent: HWND, + ptParentClientCoords: POINT, + ) -> HWND; + pub fn RealGetWindowClassA( + hwnd: HWND, + ptszClassName: LPSTR, + cchClassNameMax: UINT, + ) -> UINT; + pub fn RealGetWindowClassW( + hwnd: HWND, + ptszClassName: LPWSTR, + cchClassNameMax: UINT, + ) -> UINT; + pub fn LockWorkStation() -> BOOL; + pub fn UserHandleGrantAccess( + hUserHandle: HANDLE, + hJob: HANDLE, + bGrant: BOOL, + ) -> BOOL; +} +DECLARE_HANDLE!(HRAWINPUT, HRAWINPUT__); +#[inline] +pub fn GET_RAWINPUT_CODE_WPARAM(wParam: WPARAM) -> WPARAM { wParam & 0xff } +pub const RIM_INPUT: WPARAM = 0; +pub const RIM_INPUTSINK: WPARAM = 1; +STRUCT!{struct RAWINPUTHEADER { + dwType: DWORD, + dwSize: DWORD, + hDevice: HANDLE, + wParam: WPARAM, +}} +pub type PRAWINPUTHEADER = *mut RAWINPUTHEADER; +pub type LPRAWINPUTHEADER = *mut RAWINPUTHEADER; +pub const RIM_TYPEMOUSE: DWORD = 0; +pub const RIM_TYPEKEYBOARD: DWORD = 1; +pub const RIM_TYPEHID: DWORD = 2; +STRUCT!{struct RAWMOUSE { + usFlags: USHORT, + memory_padding: USHORT, // 16bit Padding for 32bit align in following union + usButtonFlags: USHORT, + usButtonData: USHORT, + ulRawButtons: ULONG, + lLastX: LONG, + lLastY: LONG, + ulExtraInformation: ULONG, +}} +pub type PRAWMOUSE = *mut RAWMOUSE; +pub type LPRAWMOUSE = *mut RAWMOUSE; +pub const RI_MOUSE_LEFT_BUTTON_DOWN: USHORT = 0x0001; +pub const RI_MOUSE_LEFT_BUTTON_UP: USHORT = 0x0002; +pub const RI_MOUSE_RIGHT_BUTTON_DOWN: USHORT = 0x0004; +pub const RI_MOUSE_RIGHT_BUTTON_UP: USHORT = 0x0008; +pub const RI_MOUSE_MIDDLE_BUTTON_DOWN: USHORT = 0x0010; +pub const RI_MOUSE_MIDDLE_BUTTON_UP: USHORT = 0x0020; +pub const RI_MOUSE_BUTTON_1_DOWN: USHORT = RI_MOUSE_LEFT_BUTTON_DOWN; +pub const RI_MOUSE_BUTTON_1_UP: USHORT = RI_MOUSE_LEFT_BUTTON_UP; +pub const RI_MOUSE_BUTTON_2_DOWN: USHORT = RI_MOUSE_RIGHT_BUTTON_DOWN; +pub const RI_MOUSE_BUTTON_2_UP: USHORT = RI_MOUSE_RIGHT_BUTTON_UP; +pub const RI_MOUSE_BUTTON_3_DOWN: USHORT = RI_MOUSE_MIDDLE_BUTTON_DOWN; +pub const RI_MOUSE_BUTTON_3_UP: USHORT = RI_MOUSE_MIDDLE_BUTTON_UP; +pub const RI_MOUSE_BUTTON_4_DOWN: USHORT = 0x0040; +pub const RI_MOUSE_BUTTON_4_UP: USHORT = 0x0080; +pub const RI_MOUSE_BUTTON_5_DOWN: USHORT = 0x0100; +pub const RI_MOUSE_BUTTON_5_UP: USHORT = 0x0200; +pub const RI_MOUSE_WHEEL: USHORT = 0x0400; +pub const MOUSE_MOVE_RELATIVE: USHORT = 0; +pub const MOUSE_MOVE_ABSOLUTE: USHORT = 1; +pub const MOUSE_VIRTUAL_DESKTOP: USHORT = 0x02; +pub const MOUSE_ATTRIBUTES_CHANGED: USHORT = 0x04; +pub const MOUSE_MOVE_NOCOALESCE: USHORT = 0x08; +STRUCT!{struct RAWKEYBOARD { + MakeCode: USHORT, + Flags: USHORT, + Reserved: USHORT, + VKey: USHORT, + Message: UINT, + ExtraInformation: ULONG, +}} +pub type PRAWKEYBOARD = *mut RAWKEYBOARD; +pub type LPRAWKEYBOARD = *mut RAWKEYBOARD; +pub const KEYBOARD_OVERRUN_MAKE_CODE: DWORD = 0xFF; +pub const RI_KEY_MAKE: DWORD = 0; +pub const RI_KEY_BREAK: DWORD = 1; +pub const RI_KEY_E0: DWORD = 2; +pub const RI_KEY_E1: DWORD = 4; +pub const RI_KEY_TERMSRV_SET_LED: DWORD = 8; +pub const RI_KEY_TERMSRV_SHADOW: DWORD = 0x10; +STRUCT!{struct RAWHID { + dwSizeHid: DWORD, + dwCount: DWORD, + bRawData: [BYTE; 0], +}} +pub type PRAWHID = *mut RAWHID; +pub type LPRAWHID = *mut RAWHID; +UNION!{union RAWINPUT_data { + [u32; 6], + mouse mouse_mut: RAWMOUSE, + keyboard keyboard_mut: RAWKEYBOARD, + hid hid_mut: RAWHID, +}} +STRUCT!{struct RAWINPUT { + header: RAWINPUTHEADER, + data: RAWINPUT_data, +}} +pub type PRAWINPUT = *mut RAWINPUT; +pub type LPRAWINPUT = *mut RAWINPUT; +pub const RID_INPUT: DWORD = 0x10000003; +pub const RID_HEADER: DWORD = 0x10000005; +extern "system" { + pub fn GetRawInputData( + hRawInput: HRAWINPUT, + uiCommand: UINT, + pData: LPVOID, + pcbSize: PUINT, + cbSizeHeader: UINT, + ) -> UINT; +} +pub const RIDI_PREPARSEDDATA: DWORD = 0x20000005; +pub const RIDI_DEVICENAME: DWORD = 0x20000007; +pub const RIDI_DEVICEINFO: DWORD = 0x2000000b; +STRUCT!{struct RID_DEVICE_INFO_MOUSE { + dwId: DWORD, + dwNumberOfButtons: DWORD, + dwSampleRate: DWORD, + fHasHorizontalWheel: BOOL, +}} +pub type PRID_DEVICE_INFO_MOUSE = *mut RID_DEVICE_INFO_MOUSE; +STRUCT!{struct RID_DEVICE_INFO_KEYBOARD { + dwType: DWORD, + dwSubType: DWORD, + dwKeyboardMode: DWORD, + dwNumberOfFunctionKeys: DWORD, + dwNumberOfIndicators: DWORD, + dwNumberOfKeysTotal: DWORD, +}} +pub type PRID_DEVICE_INFO_KEYBOARD = *mut RID_DEVICE_INFO_KEYBOARD; +STRUCT!{struct RID_DEVICE_INFO_HID { + dwVendorId: DWORD, + dwProductId: DWORD, + dwVersionNumber: DWORD, + usUsagePage: USHORT, + usUsage: USHORT, +}} +pub type PRID_DEVICE_INFO_HID = *mut RID_DEVICE_INFO_HID; +UNION!{union RID_DEVICE_INFO_u { + [u32; 6], + mouse mouse_mut: RID_DEVICE_INFO_MOUSE, + keyboard keyboard_mut: RID_DEVICE_INFO_KEYBOARD, + hid hid_mut: RID_DEVICE_INFO_HID, +}} +STRUCT!{struct RID_DEVICE_INFO { + cbSize: DWORD, + dwType: DWORD, + u: RID_DEVICE_INFO_u, +}} +pub type PRID_DEVICE_INFO = *mut RID_DEVICE_INFO; +pub type LPRID_DEVICE_INFO = *mut RID_DEVICE_INFO; +extern "system" { + pub fn GetRawInputDeviceInfoA( + hDevice: HANDLE, + uiCommand: UINT, + pData: LPVOID, + pcbSize: PUINT, + ) -> UINT; + pub fn GetRawInputDeviceInfoW( + hDevice: HANDLE, + uiCommand: UINT, + pData: LPVOID, + pcbSize: PUINT, + ) -> UINT; + pub fn GetRawInputBuffer( + pData: PRAWINPUT, + pcbSize: PUINT, + cbSizeHeader: UINT, + ) -> UINT; +} +STRUCT!{struct RAWINPUTDEVICE { + usUsagePage: USHORT, + usUsage: USHORT, + dwFlags: DWORD, + hwndTarget: HWND, +}} +pub type PRAWINPUTDEVICE = *mut RAWINPUTDEVICE; +pub type LPRAWINPUTDEVICE = *mut RAWINPUTDEVICE; +pub type PCRAWINPUTDEVICE = *const RAWINPUTDEVICE; +pub const RIDEV_REMOVE: DWORD = 0x00000001; +pub const RIDEV_EXCLUDE: DWORD = 0x00000010; +pub const RIDEV_PAGEONLY: DWORD = 0x00000020; +pub const RIDEV_NOLEGACY: DWORD = 0x00000030; +pub const RIDEV_INPUTSINK: DWORD = 0x00000100; +pub const RIDEV_CAPTUREMOUSE: DWORD = 0x00000200; +pub const RIDEV_NOHOTKEYS: DWORD = 0x00000200; +pub const RIDEV_APPKEYS: DWORD = 0x00000400; +pub const RIDEV_EXINPUTSINK: DWORD = 0x00001000; +pub const RIDEV_DEVNOTIFY: DWORD = 0x00002000; +pub const RIDEV_EXMODEMASK: DWORD = 0x000000F0; +pub const GIDC_ARRIVAL: DWORD = 1; +pub const GIDC_REMOVAL: DWORD = 2; +extern "system" { + pub fn RegisterRawInputDevices( + pRawInputDevices: PCRAWINPUTDEVICE, + uiNumDevices: UINT, + cbSize: UINT, + ) -> BOOL; + pub fn GetRegisteredRawInputDevices( + pRawInputDevices: PRAWINPUTDEVICE, + puiNumDevices: PUINT, + cbSize: UINT, + ) -> UINT; +} +STRUCT!{struct RAWINPUTDEVICELIST { + hDevice: HANDLE, + dwType: DWORD, +}} +pub type PRAWINPUTDEVICELIST = *mut RAWINPUTDEVICELIST; +extern "system" { + pub fn GetRawInputDeviceList( + pRawInputDeviceList: PRAWINPUTDEVICELIST, + puiNumDevices: PUINT, + cbSize: UINT, + ) -> UINT; + pub fn DefRawInputProc( + paRawInput: *mut PRAWINPUT, + nInput: INT, + cbSizeHeader: UINT, + ) -> LRESULT; + pub fn ChangeWindowMessageFilter( + message: UINT, + dwFlag: DWORD, + ) -> BOOL; +} +STRUCT!{struct CHANGEFILTERSTRUCT { + cbSize: DWORD, + ExtStatus: DWORD, +}} +extern "system" { + pub fn ChangeWindowMessageFilterEx( + hwnd: HWND, + message: UINT, + action: DWORD, + pChangeFilterStruct: PCHANGEFILTERSTRUCT, + ) -> BOOL; +} +pub type PCHANGEFILTERSTRUCT = *mut CHANGEFILTERSTRUCT; +// if WINVER >= 0x0601 +// GetSystemMetrics(SM_DIGITIZER) flag values +pub const NID_INTEGRATED_TOUCH: UINT = 0x00000001; +pub const NID_EXTERNAL_TOUCH: UINT = 0x00000002; +pub const NID_INTEGRATED_PEN: UINT = 0x00000004; +pub const NID_EXTERNAL_PEN: UINT = 0x00000008; +pub const NID_MULTI_INPUT: UINT = 0x00000040; +pub const NID_READY: UINT = 0x00000080; +// end if WINVER >= 0x0601 +// System Menu Command Values +// +STRUCT!{struct ANIMATIONINFO { + cbSize: UINT, + iMinAnimate: c_int, +}} +pub type LPANIMATIONINFO = *mut ANIMATIONINFO; +pub const SPIF_UPDATEINIFILE: UINT = 0x0001; +pub const SPIF_SENDWININICHANGE: UINT = 0x0002; +pub const SPIF_SENDCHANGE: UINT = SPIF_SENDWININICHANGE; +extern "system" { + pub fn LoadIconA( + hInstance: HINSTANCE, + lpIconName: LPCSTR, + ) -> HICON; + pub fn LoadIconW( + hInstance: HINSTANCE, + lpIconName: LPCWSTR, + ) -> HICON; + pub fn IsImmersiveProcess( + hProcess: HANDLE, + ) -> BOOL; +} diff --git a/src/vendor/winapi/src/um/winver.rs b/src/vendor/winapi/src/um/winver.rs new file mode 100644 index 0000000000..38476cdffc --- /dev/null +++ b/src/vendor/winapi/src/um/winver.rs @@ -0,0 +1,54 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! Version management functions, types, and definitions +use ctypes::c_void; +use shared::minwindef::{BOOL, DWORD, LPCVOID, LPVOID, PUINT}; +use um::winnt::{LPCSTR, LPCWSTR, LPSTR, LPWSTR}; +extern "system" { + pub fn GetFileVersionInfoSizeA( + lptstrFilename: LPCSTR, + lpdwHandle: *mut DWORD, + ) -> DWORD; + pub fn GetFileVersionInfoSizeW( + lptstrFilename: LPCWSTR, + lpdwHandle: *mut DWORD, + ) -> DWORD; + pub fn GetFileVersionInfoA( + lptstrFilename: LPCSTR, + dwHandle: DWORD, + dwLen: DWORD, + lpData: *mut c_void, + ) -> BOOL; + pub fn GetFileVersionInfoW( + lptstrFilename: LPCWSTR, + dwHandle: DWORD, + dwLen: DWORD, + lpData: *mut c_void, + ) -> BOOL; + pub fn VerQueryValueA( + pBlock: LPCVOID, + lpSubBlock: LPCSTR, + lplpBuffer: &mut LPVOID, + puLen: PUINT, + ) -> BOOL; + pub fn VerQueryValueW( + pBlock: LPCVOID, + lpSubBlock: LPCWSTR, + lplpBuffer: &mut LPVOID, + puLen: PUINT, + ) -> BOOL; + pub fn VerLanguageNameA( + wLang: DWORD, + szLang: LPSTR, + cchLang: DWORD, + ) -> DWORD; + pub fn VerLanguageNameW( + wLang: DWORD, + szLang: LPWSTR, + cchLang: DWORD, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/um/wow64apiset.rs b/src/vendor/winapi/src/um/wow64apiset.rs new file mode 100644 index 0000000000..5adf5c14e2 --- /dev/null +++ b/src/vendor/winapi/src/um/wow64apiset.rs @@ -0,0 +1,28 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::minwindef::{BOOL, PBOOL, UINT}; +use um::winnt::{HANDLE, LPSTR, LPWSTR, PVOID}; +extern "system" { + pub fn Wow64DisableWow64FsRedirection( + OldValue: *mut PVOID, + ) -> BOOL; + pub fn Wow64RevertWow64FsRedirection( + OlValue: PVOID, + ) -> BOOL; + pub fn IsWow64Process( + hProcess: HANDLE, + Wow64Process: PBOOL, + ) -> BOOL; + pub fn GetSystemWow64DirectoryA( + lpBuffer: LPSTR, + uSize: UINT, + ) -> UINT; + pub fn GetSystemWow64DirectoryW( + lpBuffer: LPWSTR, + uSize: UINT, + ) -> UINT; +} diff --git a/src/vendor/winapi/src/um/ws2spi.rs b/src/vendor/winapi/src/um/ws2spi.rs new file mode 100644 index 0000000000..61582f7fb6 --- /dev/null +++ b/src/vendor/winapi/src/um/ws2spi.rs @@ -0,0 +1,910 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Definitions to be used with the WinSock service provider. +use ctypes::{c_char, c_int, c_long, c_uint}; +use shared::basetsd::{DWORD_PTR, PDWORD_PTR, ULONG_PTR}; +use shared::guiddef::{GUID, LPGUID}; +use shared::minwindef::{ + BOOL, DWORD, INT, LPARAM, LPDWORD, LPHANDLE, LPINT, LPVOID, PBYTE, UINT, WORD, WPARAM, +}; +use shared::windef::HWND; +use shared::ws2def::{LPSOCKADDR, LPWSABUF, SOCKADDR}; +use shared::wtypesbase::LPBLOB; +use um::winnt::{HANDLE, LPCWSTR, LPWSTR, PVOID, WCHAR}; +use um::winsock2::{ + GROUP, LPCONDITIONPROC, LPQOS, LPWSACOMPLETION, LPWSANETWORKEVENTS, LPWSAOVERLAPPED, + LPWSAOVERLAPPED_COMPLETION_ROUTINE, LPWSAPROTOCOL_INFOW, LPWSAQUERYSET2W, LPWSAQUERYSETW, + LPWSASERVICECLASSINFOW, SOCKET, WSAESETSERVICEOP, WSAEVENT, fd_set, timeval, +}; +#[cfg(target_arch = "x86_64")] +use um::winsock2::{LPWSANAMESPACE_INFOEXW, LPWSANAMESPACE_INFOW}; +use vc::vcruntime::size_t; +pub const WSPDESCRIPTION_LEN: usize = 255; +pub const WSS_OPERATION_IN_PROGRESS: ULONG_PTR = 0x00000103; +STRUCT!{struct WSPDATA { + wVersion: WORD, + wHighVersion: WORD, + szDescription: [WCHAR; WSPDESCRIPTION_LEN + 1], +}} +pub type LPWSPDATA = *mut WSPDATA; +STRUCT!{struct WSATHREADID { + ThreadHandle: HANDLE, + Reserved: DWORD_PTR, +}} +pub type LPWSATHREADID = *mut WSATHREADID; +FN!{stdcall LPBLOCKINGCALLBACK( + dwContext: DWORD_PTR, +) -> BOOL} +FN!{stdcall LPWSAUSERAPC( + dwContext: DWORD_PTR, +) -> ()} +FN!{stdcall LPWSPACCEPT( + s: SOCKET, + addr: *mut SOCKADDR, + addrlen: LPINT, + lpfnCondition: LPCONDITIONPROC, + dwCallbackData: DWORD_PTR, + lpErrno: LPINT, +) -> SOCKET} +FN!{stdcall LPWSPADDRESSTOSTRING( + lpsaAddress: LPSOCKADDR, + dwAddressLength: DWORD, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + lpszAddressString: LPWSTR, + lpdwAddressStringLength: LPDWORD, + lpErrno: LPINT, +) -> INT} +FN!{stdcall LPWSPASYNCSELECT( + s: SOCKET, + hWnd: HWND, + wMsg: c_uint, + lEvent: c_long, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPBIND( + s: SOCKET, + name: *mut SOCKADDR, + namelen: c_int, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPCANCELBLOCKINGCALL( + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPCLEANUP( + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPCLOSESOCKET( + s: SOCKET, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPCONNECT( + s: SOCKET, + name: *mut SOCKADDR, + namelen: c_int, + lpCallerData: LPWSABUF, + lpCalleeData: LPWSABUF, + lpSQOS: LPQOS, + lpGQOS: LPQOS, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPDUPLICATESOCKET( + s: SOCKET, + dwProcessId: DWORD, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPENUMNETWORKEVENTS( + s: SOCKET, + hEventObject: WSAEVENT, + lpNetworkEvents: LPWSANETWORKEVENTS, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPEVENTSELECT( + s: SOCKET, + hEventObject: WSAEVENT, + lNetworkEvents: c_long, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPGETOVERLAPPEDRESULT( + s: SOCKET, + lpOverlapped: LPWSAOVERLAPPED, + lpcbTransfer: LPDWORD, + fWait: BOOL, + lpdwFlags: LPDWORD, + lpErrno: LPINT, +) -> BOOL} +FN!{stdcall LPWSPGETPEERNAME( + s: SOCKET, + name: *mut SOCKADDR, + namelen: LPINT, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPGETSOCKNAME( + s: SOCKET, + name: *mut SOCKADDR, + namelen: LPINT, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPGETSOCKOPT( + s: SOCKET, + level: c_int, + optname: c_int, + optval: *mut c_char, + optlen: LPINT, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPGETQOSBYNAME( + s: SOCKET, + lpQOSName: LPWSABUF, + lpQOS: LPQOS, + lpErrno: LPINT, +) -> BOOL} +FN!{stdcall LPWSPIOCTL( + s: SOCKET, + dwIoControlCode: DWORD, + lpvInBuffer: LPVOID, + cbInBuffer: DWORD, + lpvOutBuffer: LPVOID, + cbOutBuffer: DWORD, + lpcbBytesReturned: LPDWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPJOINLEAF( + s: SOCKET, + name: *mut SOCKADDR, + namelen: c_int, + lpCallerData: LPWSABUF, + lpCalleeData: LPWSABUF, + lpSQOS: LPQOS, + lpGQOS: LPQOS, + dwFlags: DWORD, + lpErrno: LPINT, +) -> SOCKET} +FN!{stdcall LPWSPLISTEN( + s: SOCKET, + backlog: c_int, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPRECV( + s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesRecvd: LPDWORD, + lpFlags: LPDWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPRECVDISCONNECT( + s: SOCKET, + lpInboundDisconnectData: LPWSABUF, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPRECVFROM( + s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesRecvd: LPDWORD, + lpFlags: LPDWORD, + lpFrom: *mut SOCKADDR, + lpFromlen: LPINT, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPSELECT( + nfds: c_int, + readfds: *mut fd_set, + writefds: *mut fd_set, + exceptfds: *mut fd_set, + timeout: *const timeval, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPSEND( + s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesSent: LPDWORD, + dwFlags: DWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPSENDDISCONNECT( + s: SOCKET, + lpOutboundDisconnectData: LPWSABUF, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPSENDTO( + s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesSent: LPDWORD, + dwFlags: DWORD, + lpTo: *const SOCKADDR, + iTolen: c_int, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPSETSOCKOPT( + s: SOCKET, + level: c_int, + optname: c_int, + optval: *const c_char, + optlen: c_int, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPSHUTDOWN( + s: SOCKET, + how: c_int, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWSPSOCKET( + af: c_int, + _type: c_int, + protocol: c_int, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + g: GROUP, + dwFlags: DWORD, + lpErrno: LPINT, +) -> SOCKET} +FN!{stdcall LPWSPSTRINGTOADDRESS( + AddressString: LPWSTR, + AddressFamily: INT, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + lpAddress: LPSOCKADDR, + lpAddressLength: LPINT, + lpErrno: LPINT, +) -> c_int} +STRUCT!{struct WSPPROC_TABLE{ + lpWSPAccept: LPWSPACCEPT, + lpWSPAddressToString: LPWSPADDRESSTOSTRING, + lpWSPAsyncSelect: LPWSPASYNCSELECT, + lpWSPBind: LPWSPBIND, + lpWSPCancelBlockingCall: LPWSPCANCELBLOCKINGCALL, + lpWSPCleanup: LPWSPCLEANUP, + lpWSPCloseSocket: LPWSPCLOSESOCKET, + lpWSPConnect: LPWSPCONNECT, + lpWSPDuplicateSocket: LPWSPDUPLICATESOCKET, + lpWSPEnumNetworkEvents: LPWSPENUMNETWORKEVENTS, + lpWSPEventSelect: LPWSPEVENTSELECT, + lpWSPGetOverlappedResult: LPWSPGETOVERLAPPEDRESULT, + lpWSPGetPeerName: LPWSPGETPEERNAME, + lpWSPGetSockName: LPWSPGETSOCKNAME, + lpWSPGetSockOpt: LPWSPGETSOCKOPT, + lpWSPGetQOSByName: LPWSPGETQOSBYNAME, + lpWSPIoctl: LPWSPIOCTL, + lpWSPJoinLeaf: LPWSPJOINLEAF, + lpWSPListen: LPWSPLISTEN, + lpWSPRecv: LPWSPRECV, + lpWSPRecvDisconnect: LPWSPRECVDISCONNECT, + lpWSPRecvFrom: LPWSPRECVFROM, + lpWSPSelect: LPWSPSELECT, + lpWSPSend: LPWSPSEND, + lpWSPSendDisconnect: LPWSPSENDDISCONNECT, + lpWSPSendTo: LPWSPSENDTO, + lpWSPSetSockOpt: LPWSPSETSOCKOPT, + lpWSPShutdown: LPWSPSHUTDOWN, + lpWSPSocket: LPWSPSOCKET, + lpWSPStringToAddress: LPWSPSTRINGTOADDRESS, +}} +pub type LPWSPPROC_TABLE = *mut WSPPROC_TABLE; +FN!{stdcall LPWPUCLOSEEVENT( + hEvent: WSAEVENT, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPUCLOSESOCKETHANDLE( + s: SOCKET, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPUCREATEEVENT( + lpErrno: LPINT, +) -> WSAEVENT} +FN!{stdcall LPWPUCREATESOCKETHANDLE( + dwCatalogEntryId: DWORD, + dwContext: DWORD_PTR, + lpErrno: LPINT, +) -> SOCKET} +FN!{stdcall LPWPUFDISSET( + s: SOCKET, + fdset: *mut fd_set, +) -> c_int} +FN!{stdcall LPWPUGETPROVIDERPATH( + lpProviderId: LPGUID, + lpszProviderDllPath: *mut WCHAR, + lpProviderDllPathLen: LPINT, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPUMODIFYIFSHANDLE( + dwCatalogEntryId: DWORD, + ProposedHandle: SOCKET, + lpErrno: LPINT, +) -> SOCKET} +FN!{stdcall LPWPUPOSTMESSAGE( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, +) -> BOOL} +FN!{stdcall LPWPUQUERYBLOCKINGCALLBACK( + dwCatalogEntryId: DWORD, + lplpfnCallback: *mut LPBLOCKINGCALLBACK, + lpdwContext: PDWORD_PTR, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPUQUERYSOCKETHANDLECONTEXT( + s: SOCKET, + lpContext: PDWORD_PTR, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPUQUEUEAPC( + lpThreadId: LPWSATHREADID, + lpfnUserApc: LPWSAUSERAPC, + dwContext: DWORD_PTR, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPURESETEVENT( + hEvent: WSAEVENT, + lpErrno: LPINT, +) -> BOOL} +FN!{stdcall LPWPUSETEVENT( + hEvent: WSAEVENT, + lpErrno: LPINT, +) -> BOOL} +FN!{stdcall LPWPUOPENCURRENTTHREAD( + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPUCLOSETHREAD( + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, +) -> c_int} +FN!{stdcall LPWPUCOMPLETEOVERLAPPEDREQUEST( + s: SOCKET, + lpOverlapped: LPWSAOVERLAPPED, + dwError: DWORD, + cbTransferred: DWORD, + lpErrno: LPINT, +) -> c_int} +STRUCT!{struct WSPUPCALLTABLE { + lpWPUCloseEvent: LPWPUCLOSEEVENT, + lpWPUCloseSocketHandle: LPWPUCLOSESOCKETHANDLE, + lpWPUCreateEvent: LPWPUCREATEEVENT, + lpWPUCreateSocketHandle: LPWPUCREATESOCKETHANDLE, + lpWPUFDIsSet: LPWPUFDISSET, + lpWPUGetProviderPath: LPWPUGETPROVIDERPATH, + lpWPUModifyIFSHandle: LPWPUMODIFYIFSHANDLE, + lpWPUPostMessage: LPWPUPOSTMESSAGE, + lpWPUQueryBlockingCallback: LPWPUQUERYBLOCKINGCALLBACK, + lpWPUQuerySocketHandleContext: LPWPUQUERYSOCKETHANDLECONTEXT, + lpWPUQueueApc: LPWPUQUEUEAPC, + lpWPUResetEvent: LPWPURESETEVENT, + lpWPUSetEvent: LPWPUSETEVENT, + lpWPUOpenCurrentThread: LPWPUOPENCURRENTTHREAD, + lpWPUCloseThread: LPWPUCLOSETHREAD, +}} +pub type LPWSPUPCALLTABLE = *mut WSPUPCALLTABLE; +extern "system" { + pub fn WSPStartup( + wVersionRequested: WORD, + lpWSPData: LPWSPDATA, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + UpcallTable: WSPUPCALLTABLE, + lpProcTable: LPWSPPROC_TABLE, + ) -> c_int; +} +FN!{stdcall LPWSPSTARTUP( + wVersionRequested: WORD, + lpWSPData: LPWSPDATA, + lpProtocolInfo: LPWSAPROTOCOL_INFOW, + UpcallTable: WSPUPCALLTABLE, + lpProcTable: LPWSPPROC_TABLE, +) -> c_int} +extern "system" { + pub fn WSCEnumProtocols( + lpiProtocols: LPINT, + lpProtocolBuffer: LPWSAPROTOCOL_INFOW, + lpdwBufferLength: LPDWORD, + lpErrno: LPINT, + ) -> c_int; +} +FN!{stdcall LPWSCENUMPROTOCOLS( + lpiProtocols: LPINT, + lpProtocolBuffer: LPWSAPROTOCOL_INFOW, + lpdwBufferLength: LPDWORD, + lpErrno: LPINT, +) -> c_int} +extern "system" { + #[cfg(target_arch = "x86_64")] + pub fn WSCEnumProtocols32( + lpiProtocols: LPINT, + lpProtocolBuffer: LPWSAPROTOCOL_INFOW, + lpdwBufferLength: LPDWORD, + lpErrno: LPINT, + ) -> c_int; + pub fn WSCDeinstallProvider( + lpProviderId: LPGUID, + lpErrno: LPINT, + ) -> c_int; +} +FN!{stdcall LPWSCDEINSTALLPROVIDER( + lpProviderId: LPGUID, + lpErrno: LPINT, +) -> c_int} +extern "system" { + #[cfg(target_arch = "x86_64")] + pub fn WSCDeinstallProvider32( + lpProviderId: LPGUID, + lpErrno: LPINT, + ) -> c_int; + pub fn WSCInstallProvider( + lpProviderId: LPGUID, + lpszProviderDllPath: *const WCHAR, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpErrno: LPINT, + ) -> c_int; +} +FN!{stdcall LPWSCINSTALLPROVIDER( + lpProviderId: LPGUID, + lpszProviderDllPath: *const WCHAR, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpErrno: LPINT, +) -> c_int} +extern "system" { + #[cfg(target_arch = "x86_64")] + pub fn WSCInstallProvider64_32( + lpProviderId: LPGUID, + lpszProviderDllPath: *const WCHAR, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpErrno: LPINT, + ) -> c_int; + pub fn WSCGetProviderPath( + lpProviderId: LPGUID, + lpszProviderDllPath: *mut WCHAR, + lpProviderDllPathLen: LPINT, + lpErrno: LPINT, + ) -> c_int; +} +FN!{stdcall LPWSCGETPROVIDERPATH( + lpProviderId: LPGUID, + lpszProviderDllPath: *mut WCHAR, + lpProviderDllPathLen: LPINT, + lpErrno: LPINT, +) -> c_int} +extern "system" { + #[cfg(target_arch = "x86_64")] + pub fn WSCGetProviderPath32( + lpProviderId: LPGUID, + lpszProviderDllPath: *mut WCHAR, + lpProviderDllPathLen: LPINT, + lpErrno: LPINT, + ) -> c_int; + pub fn WSCUpdateProvider( + lpProviderId: LPGUID, + lpszProviderDllPath: *const WCHAR, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpErrno: LPINT, + ) -> c_int; +} +FN!{stdcall LPWSCUPDATEPROVIDER( + lpProviderId: LPGUID, + lpszProviderDllPath: *const WCHAR, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpErrno: LPINT, +) -> c_int} +#[cfg(target_arch = "x86_64")] +extern "system" { + pub fn WSCUpdateProvider32( + lpProviderId: LPGUID, + lpszProviderDllPath: *const WCHAR, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpErrno: LPINT, + ) -> c_int; +} +pub const LSP_SYSTEM: DWORD = 0x80000000; +pub const LSP_INSPECTOR: DWORD = 0x00000001; +pub const LSP_REDIRECTOR: DWORD = 0x00000002; +pub const LSP_PROXY: DWORD = 0x00000004; +pub const LSP_FIREWALL: DWORD = 0x00000008; +pub const LSP_INBOUND_MODIFY: DWORD = 0x00000010; +pub const LSP_OUTBOUND_MODIFY: DWORD = 0x00000020; +pub const LSP_CRYPTO_COMPRESS: DWORD = 0x00000040; +pub const LSP_LOCAL_CACHE: DWORD = 0x00000080; +ENUM!{enum WSC_PROVIDER_INFO_TYPE { + ProviderInfoLspCategories, + ProviderInfoAudit, +}} +STRUCT!{struct WSC_PROVIDER_AUDIT_INFO { + RecordSize: DWORD, + Reserved: PVOID, +}} +extern "system" { + pub fn WSCSetProviderInfo( + lpProviderId: LPGUID, + InfoType: WSC_PROVIDER_INFO_TYPE, + Info: PBYTE, + InfoSize: size_t, + Flags: DWORD, + lpErrno: LPINT, + ) -> c_int; + pub fn WSCGetProviderInfo( + lpProviderId: LPGUID, + InfoType: WSC_PROVIDER_INFO_TYPE, + Info: PBYTE, + InfoSize: *mut size_t, + Flags: DWORD, + lpErrno: LPINT, + ) -> c_int; + #[cfg(target_arch = "x86_64")] + pub fn WSCSetProviderInfo32( + lpProviderId: LPGUID, + InfoType: WSC_PROVIDER_INFO_TYPE, + Info: PBYTE, + InfoSize: size_t, + Flags: DWORD, + lpErrno: LPINT, + ) -> c_int; + #[cfg(target_arch = "x86_64")] + pub fn WSCGetProviderInfo32( + lpProviderId: LPGUID, + InfoType: WSC_PROVIDER_INFO_TYPE, + Info: PBYTE, + InfoSize: *mut size_t, + Flags: DWORD, + lpErrno: LPINT, + ) -> c_int; + pub fn WSCSetApplicationCategory( + Path: LPCWSTR, + PathLength: DWORD, + Extra: LPCWSTR, + ExtraLength: DWORD, + PermittedLspCategories: DWORD, + pPrevPermLspCat: *mut DWORD, + lpErrno: LPINT, + ) -> c_int; + pub fn WSCGetApplicationCategory( + Path: LPCWSTR, + PathLength: DWORD, + Extra: LPCWSTR, + ExtraLength: DWORD, + pPermittedLspCategories: *mut DWORD, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUCloseEvent( + hEvent: WSAEVENT, + lpErrno: LPINT, + ) -> BOOL; + pub fn WPUCloseSocketHandle( + s: SOCKET, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUCreateEvent( + lpErrno: LPINT, + ) -> WSAEVENT; + pub fn WPUCreateSocketHandle( + dwCatalogEntryId: DWORD, + dwContext: DWORD_PTR, + lpErrno: LPINT, + ) -> SOCKET; + pub fn WPUFDIsSet( + s: SOCKET, + fdset: *mut fd_set, + ) -> c_int; + pub fn WPUGetProviderPath( + lpProviderId: LPGUID, + lpszProviderDllPath: *mut WCHAR, + lpProviderDllPathLen: LPINT, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUModifyIFSHandle( + dwCatalogEntryId: DWORD, + ProposedHandle: SOCKET, + lpErrno: LPINT, + ) -> SOCKET; + pub fn WPUPostMessage( + hWnd: HWND, + Msg: UINT, + wParam: WPARAM, + lParam: LPARAM, + ) -> BOOL; + pub fn WPUQueryBlockingCallback( + dwCatalogEntryId: DWORD, + lplpfnCallback: *mut LPBLOCKINGCALLBACK, + lpdwContext: PDWORD_PTR, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUQuerySocketHandleContext( + s: SOCKET, + lpContext: PDWORD_PTR, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUQueueApc( + lpThreadId: LPWSATHREADID, + lpfnUserApc: LPWSAUSERAPC, + dwContext: DWORD_PTR, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUResetEvent( + hEvent: WSAEVENT, + lpErrno: LPINT, + ) -> BOOL; + pub fn WPUSetEvent( + hEvent: WSAEVENT, + lpErrno: LPINT, + ) -> BOOL; + pub fn WPUCompleteOverlappedRequest( + s: SOCKET, + lpOverlapped: LPWSAOVERLAPPED, + dwError: DWORD, + cbTransferred: DWORD, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUOpenCurrentThread( + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, + ) -> c_int; + pub fn WPUCloseThread( + lpThreadId: LPWSATHREADID, + lpErrno: LPINT, + ) -> c_int; + #[cfg(target_arch = "x86_64")] + pub fn WSCEnumNameSpaceProviders32( + lpdwBufferLength: LPDWORD, + lpnspBuffer: LPWSANAMESPACE_INFOW, + ) -> INT; + #[cfg(target_arch = "x86_64")] + pub fn WSCEnumNameSpaceProvidersEx32( + lpdwBufferLength: LPDWORD, + lpnspBuffer: LPWSANAMESPACE_INFOEXW, + ) -> INT; + pub fn WSCInstallNameSpace( + lpszIdentifier: LPWSTR, + lpszPathName: LPWSTR, + dwNameSpace: DWORD, + dwVersion: DWORD, + lpProviderId: LPGUID, + ) -> INT; +} +FN!{stdcall LPWSCINSTALLNAMESPACE( + lpszIdentifier: LPWSTR, + lpszPathName: LPWSTR, + dwNameSpace: DWORD, + dwVersion: DWORD, + lpProviderId: LPGUID, +) -> INT} +extern "system" { + #[cfg(target_arch = "x86_64")] + pub fn WSCInstallNameSpace32( + lpszIdentifier: LPWSTR, + lpszPathName: LPWSTR, + dwNameSpace: DWORD, + dwVersion: DWORD, + lpProviderId: LPGUID, + ) -> INT; + pub fn WSCUnInstallNameSpace( + lpProviderId: LPGUID, + ) -> INT; +} +FN!{stdcall LPWSCUNINSTALLNAMESPACE( + lpProviderId: LPGUID, +) -> INT} +extern "system" { + pub fn WSCInstallNameSpaceEx( + lpszIdentifier: LPWSTR, + lpszPathName: LPWSTR, + dwNameSpace: DWORD, + dwVersion: DWORD, + lpProviderId: LPGUID, + lpProviderSpecific: LPBLOB, + ) -> INT; + #[cfg(target_arch = "x86_64")] + pub fn WSCInstallNameSpaceEx32( + lpszIdentifier: LPWSTR, + lpszPathName: LPWSTR, + dwNameSpace: DWORD, + dwVersion: DWORD, + lpProviderId: LPGUID, + lpProviderSpecific: LPBLOB, + ) -> INT; + #[cfg(target_arch = "x86_64")] + pub fn WSCUnInstallNameSpace32( + lpProviderId: LPGUID, + ) -> INT; + pub fn WSCEnableNSProvider( + lpProviderId: LPGUID, + fEnable: BOOL, + ) -> INT; +} +FN!{stdcall LPWSCENABLENSPROVIDER( + lpProviderId: LPGUID, + fEnable: BOOL, +) -> INT} +extern "system" { + #[cfg(target_arch = "x86_64")] + pub fn WSCEnableNSProvider32( + lpProviderId: LPGUID, + fEnable: BOOL, + ) -> INT; + #[cfg(target_arch = "x86_64")] + pub fn WSCInstallProviderAndChains64_32( + lpProviderId: LPGUID, + lpszProviderDllPath: LPWSTR, + lpszProviderDllPath32: LPWSTR, + lpszLspName: LPWSTR, + dwServiceFlags: DWORD, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpdwCatalogEntryId: LPDWORD, + lpErrno: LPINT, + ) -> c_int; + #[cfg(any(target_arch = "x86", target_arch = "arm"))] + pub fn WSCInstallProviderAndChains( + lpProviderId: LPGUID, + lpszProviderDllPath: LPWSTR, + lpszLspName: LPWSTR, + dwServiceFlags: DWORD, + lpProtocolInfoList: LPWSAPROTOCOL_INFOW, + dwNumberOfEntries: DWORD, + lpdwCatalogEntryId: LPDWORD, + lpErrno: LPINT, + ) -> c_int; +} +FN!{stdcall LPNSPCLEANUP( + lpProviderId: LPGUID, +) -> INT} +FN!{stdcall LPNSPLOOKUPSERVICEBEGIN( + lpProviderId: LPGUID, + lpqsRestrictions: LPWSAQUERYSETW, + lpServiceClassInfo: LPWSASERVICECLASSINFOW, + dwControlFlags: DWORD, + lphLookup: LPHANDLE, +) -> INT} +FN!{stdcall LPNSPLOOKUPSERVICENEXT( + hLookup: HANDLE, + dwControlFlags: DWORD, + lpdwBufferLength: LPDWORD, + lpqsResults: LPWSAQUERYSETW, +) -> INT} +FN!{stdcall LPNSPIOCTL( + hLookup: HANDLE, + dwControlCode: DWORD, + lpvInBuffer: LPVOID, + cbInBuffer: DWORD, + lpvOutBuffer: LPVOID, + cbOutBuffer: DWORD, + lpcbBytesReturned: LPDWORD, + lpCompletion: LPWSACOMPLETION, + lpThreadId: LPWSATHREADID, +) -> INT} +FN!{stdcall LPNSPLOOKUPSERVICEEND( + hLookup: HANDLE, +) -> INT} +FN!{stdcall LPNSPSETSERVICE( + lpProviderId: LPGUID, + lpServiceClassInfo: LPWSASERVICECLASSINFOW, + lpqsRegInfo: LPWSAQUERYSETW, + essOperation: WSAESETSERVICEOP, + dwControlFlags: DWORD, +) -> INT} +FN!{stdcall LPNSPINSTALLSERVICECLASS( + lpProviderId: LPGUID, + lpServiceClassInfo: LPWSASERVICECLASSINFOW, +) -> INT} +FN!{stdcall LPNSPREMOVESERVICECLASS( + lpProviderId: LPGUID, + lpServiceClassId: LPGUID, +) -> INT} +FN!{stdcall LPNSPGETSERVICECLASSINFO( + lpProviderId: LPGUID, + lpdwBufSize: LPDWORD, + lpServiceClassInfo: LPWSASERVICECLASSINFOW, +) -> INT} +STRUCT!{struct NSP_ROUTINE { + cbSize: DWORD, + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, + NSPCleanup: LPNSPCLEANUP, + NSPLookupServiceBegin: LPNSPLOOKUPSERVICEBEGIN, + NSPLookupServiceNext: LPNSPLOOKUPSERVICENEXT, + NSPLookupServiceEnd: LPNSPLOOKUPSERVICEEND, + NSPSetService: LPNSPSETSERVICE, + NSPInstallServiceClass: LPNSPINSTALLSERVICECLASS, + NSPRemoveServiceClass: LPNSPREMOVESERVICECLASS, + NSPGetServiceClassInfo: LPNSPGETSERVICECLASSINFO, + NSPIoctl: LPNSPIOCTL, +}} +pub type LPNSP_ROUTINE = *mut NSP_ROUTINE; +extern "system" { + pub fn NSPStartup( + lpProviderId: LPGUID, + lpnspRoutines: LPNSP_ROUTINE, + ) -> INT; +} +FN!{stdcall LPNSPSTARTUP( + lpProviderId: LPGUID, + lpnspRoutines: LPNSP_ROUTINE, +) -> INT} +FN!{stdcall LPNSPV2STARTUP( + lpProviderId: LPGUID, + ppvClientSessionArg: *mut LPVOID, +) -> INT} +FN!{stdcall LPNSPV2CLEANUP( + lpProviderId: LPGUID, + pvClientSessionArg: LPVOID, +) -> INT} +FN!{stdcall LPNSPV2LOOKUPSERVICEBEGIN( + lpProviderId: LPGUID, + lpqsRestrictions: LPWSAQUERYSET2W, + dwControlFlags: DWORD, + lpvClientSessionArg: LPVOID, + lphLookup: LPHANDLE, +) -> INT} +FN!{stdcall LPNSPV2LOOKUPSERVICENEXTEX( + hAsyncCall: HANDLE, + hLookup: HANDLE, + dwControlFlags: DWORD, + lpdwBufferLength: LPDWORD, + lpqsResults: LPWSAQUERYSET2W, +) -> ()} +FN!{stdcall LPNSPV2LOOKUPSERVICEEND( + hLookup: HANDLE, +) -> INT} +FN!{stdcall LPNSPV2SETSERVICEEX( + hAsyncCall: HANDLE, + lpProviderId: LPGUID, + lpqsRegInfo: LPWSAQUERYSET2W, + essOperation: WSAESETSERVICEOP, + dwControlFlags: DWORD, + lpvClientSessionArg: LPVOID, +) -> ()} +FN!{stdcall LPNSPV2CLIENTSESSIONRUNDOWN( + lpProviderId: LPGUID, + pvClientSessionArg: LPVOID, +) -> ()} +STRUCT!{struct NSPV2_ROUTINE { + cbSize: DWORD, + dwMajorVersion: DWORD, + dwMinorVersion: DWORD, + NSPv2Startup: LPNSPV2STARTUP, + NSPv2Cleanup: LPNSPV2CLEANUP, + NSPv2LookupServiceBegin: LPNSPV2LOOKUPSERVICEBEGIN, + NSPv2LookupServiceNextEx: LPNSPV2LOOKUPSERVICENEXTEX, + NSPv2LookupServiceEnd: LPNSPV2LOOKUPSERVICEEND, + NSPv2SetServiceEx: LPNSPV2SETSERVICEEX, + NSPv2ClientSessionRundown: LPNSPV2CLIENTSESSIONRUNDOWN, +}} +pub type PNSPV2_ROUTINE = *mut NSPV2_ROUTINE; +pub type LPNSPV2_ROUTINE = *mut NSPV2_ROUTINE; +pub type PCNSPV2_ROUTINE = *const NSPV2_ROUTINE; +pub type LPCNSPV2_ROUTINE = *const NSPV2_ROUTINE; +extern "system" { + pub fn WSAAdvertiseProvider( + puuidProviderId: *const GUID, + pNSPv2Routine: *const LPCNSPV2_ROUTINE, + ) -> INT; + pub fn WSAUnadvertiseProvider( + puuidProviderId: *const GUID, + ) -> INT; + pub fn WSAProviderCompleteAsyncCall( + hAsyncCall: HANDLE, + iRetCode: INT, + ) -> INT; +} diff --git a/src/vendor/winapi/src/um/ws2tcpip.rs b/src/vendor/winapi/src/um/ws2tcpip.rs new file mode 100644 index 0000000000..aa594a5c91 --- /dev/null +++ b/src/vendor/winapi/src/um/ws2tcpip.rs @@ -0,0 +1,347 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms +//! WinSock2 Extension for TCP/IP protocols +use ctypes::c_int; +use shared::guiddef::LPGUID; +use shared::minwindef::{DWORD, INT, LPHANDLE, ULONG}; +use shared::mstcpip::{ + SOCKET_PEER_TARGET_NAME, SOCKET_SECURITY_QUERY_INFO, SOCKET_SECURITY_QUERY_TEMPLATE, + SOCKET_SECURITY_SETTINGS, +}; +use shared::winerror::{ + WSAEAFNOSUPPORT, WSAEINVAL, WSAESOCKTNOSUPPORT, WSAHOST_NOT_FOUND, WSANO_RECOVERY, + WSATRY_AGAIN, WSATYPE_NOT_FOUND, WSA_IPSEC_NAME_POLICY_ERROR, WSA_SECURE_HOST_NOT_FOUND, +}; +use shared::ws2def::{ + ADDRINFOA, ADDRINFOEXA, ADDRINFOEXW, ADDRINFOW, PADDRINFOA, PADDRINFOEXA, PADDRINFOEXW, + PADDRINFOW, SOCKADDR, SOCKET_ADDRESS, +}; +use shared::wtypesbase::LPBLOB; +use um::minwinbase::LPOVERLAPPED; +use um::winnt::{PCHAR, PCSTR, PCWSTR, PSTR, PVOID, PWCHAR, PWSTR, VOID}; +use um::winsock2::{ + LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE, SOCKET, WSA_NOT_ENOUGH_MEMORY, timeval, +}; +use vc::vcruntime::size_t; +pub const UDP_NOCHECKSUM: c_int = 1; +pub const UDP_CHECKSUM_COVERAGE: c_int = 20; +pub const EAI_AGAIN: DWORD = WSATRY_AGAIN; +pub const EAI_BADFLAGS: DWORD = WSAEINVAL; +pub const EAI_FAIL: DWORD = WSANO_RECOVERY; +pub const EAI_FAMILY: DWORD = WSAEAFNOSUPPORT; +pub const EAI_MEMORY: DWORD = WSA_NOT_ENOUGH_MEMORY as u32; +pub const EAI_NOSECURENAME: DWORD = WSA_SECURE_HOST_NOT_FOUND; +pub const EAI_NONAME: DWORD = WSAHOST_NOT_FOUND; +pub const EAI_SERVICE: DWORD = WSATYPE_NOT_FOUND; +pub const EAI_SOCKTYPE: DWORD = WSAESOCKTNOSUPPORT; +pub const EAI_IPSECPOLICY: DWORD = WSA_IPSEC_NAME_POLICY_ERROR; +pub const EAI_NODATA: DWORD = EAI_NONAME; +pub type ADDRINFO = ADDRINFOA; +pub type LPADDRINFO = *mut ADDRINFOA; +extern "system" { + pub fn getaddrinfo( + pNodeName: PCSTR, + pServiceName: PCSTR, + pHints: *const ADDRINFOA, + ppResult: *mut PADDRINFOA, + ) -> INT; + pub fn GetAddrInfoW( + pNodeName: PCWSTR, + pServiceName: PCWSTR, + pHints: *const ADDRINFOW, + ppResult: *mut PADDRINFOW, + ) -> INT; +} +FN!{stdcall LPFN_GETADDRINFO( + pNodeName: PCSTR, + pServiceName: PCSTR, + pHints: *const ADDRINFOA, + ppResult: *mut PADDRINFOA, +) -> INT} +FN!{stdcall LPFN_GETADDRINFOW( + pNodeName: PCWSTR, + pServiceName: PCWSTR, + pHints: *const ADDRINFOW, + ppResult: *mut PADDRINFOW, +) -> INT} +FN!{stdcall LPLOOKUPSERVICE_COMPLETION_ROUTINE( + dwError: DWORD, + dwBytes: DWORD, + lpOverlapped: LPWSAOVERLAPPED, +) -> ()} +extern "system" { + pub fn GetAddrInfoExA( + pName: PCSTR, + pServiceName: PCSTR, + dwNameSpace: DWORD, + lpNspId: LPGUID, + hints: *const ADDRINFOEXA, + ppResult: *mut PADDRINFOEXA, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, + ) -> INT; + pub fn GetAddrInfoExW( + pName: PCWSTR, + pServiceName: PCWSTR, + dwNameSpace: DWORD, + lpNspId: LPGUID, + hints: *const ADDRINFOEXW, + ppResult: *mut PADDRINFOEXW, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, + ) -> INT; + pub fn GetAddrInfoExCancel( + lpHandle: LPHANDLE, + ) -> INT; + pub fn GetAddrInfoExOverlappedResult( + lpOverlapped: LPOVERLAPPED, + ) -> INT; +} +FN!{stdcall LPFN_GETADDRINFOEXA( + pName: PCSTR, + pServiceName: PCSTR, + dwNameSpace: DWORD, + lpNspId: LPGUID, + hints: *const ADDRINFOEXA, + ppResult: *mut PADDRINFOEXA, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, +) -> INT} +FN!{stdcall LPFN_GETADDRINFOEXW( + pName: PCWSTR, + pServiceName: PCWSTR, + dwNameSpace: DWORD, + lpNspId: LPGUID, + hints: *const ADDRINFOEXW, + ppResult: *mut PADDRINFOEXW, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, +) -> INT} +FN!{stdcall LPFN_GETADDRINFOEXCANCEL( + lpHandle: LPHANDLE, +) -> INT} +FN!{stdcall LPFN_GETADDRINFOEXOVERLAPPEDRESULT( + lpOverlapped: LPOVERLAPPED, +) -> INT} +extern "system" { + pub fn SetAddrInfoExA( + pName: PCSTR, + pServiceName: PCSTR, + pAddresses: *mut SOCKET_ADDRESS, + dwAddressCount: DWORD, + lpBlob: LPBLOB, + dwFlags: DWORD, + dwNameSpace: DWORD, + lpNspId: LPGUID, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, + ) -> INT; + pub fn SetAddrInfoExW( + pName: PCWSTR, + pServiceName: PCWSTR, + pAddresses: *mut SOCKET_ADDRESS, + dwAddressCount: DWORD, + lpBlob: LPBLOB, + dwFlags: DWORD, + dwNameSpace: DWORD, + lpNspId: LPGUID, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, + ) -> INT; +} +FN!{stdcall LPFN_SETADDRINFOEXA( + pName: PCSTR, + pServiceName: PCSTR, + pAddresses: *mut SOCKET_ADDRESS, + dwAddressCount: DWORD, + lpBlob: LPBLOB, + dwFlags: DWORD, + dwNameSpace: DWORD, + lpNspId: LPGUID, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, +) -> INT} +FN!{stdcall LPFN_SETADDRINFOEXW( + pName: PCWSTR, + pServiceName: PCWSTR, + pAddresses: *mut SOCKET_ADDRESS, + dwAddressCount: DWORD, + lpBlob: LPBLOB, + dwFlags: DWORD, + dwNameSpace: DWORD, + lpNspId: LPGUID, + timeout: *mut timeval, + lpOverlapped: LPOVERLAPPED, + lpCompletionRoutine: LPLOOKUPSERVICE_COMPLETION_ROUTINE, + lpNameHandle: LPHANDLE, +) -> INT} +extern "system" { + pub fn freeaddrinfo( + pAddrInfo: PADDRINFOA, + ); + pub fn FreeAddrInfoW( + pAddrInfo: PADDRINFOW, + ); +} +FN!{stdcall LPFN_FREEADDRINFO( + pAddrInfo: PADDRINFOA, +) -> ()} +FN!{stdcall LPFN_FREEADDRINFOW( + pAddrInfo: PADDRINFOW, +) -> ()} +extern "system" { + pub fn FreeAddrInfoEx( + pAddrInfoEx: PADDRINFOEXA, + ); + pub fn FreeAddrInfoExW( + pAddrInfoEx: PADDRINFOEXW, + ); +} +FN!{stdcall LPFN_FREEADDRINFOEXA( + pAddrInfoEx: PADDRINFOEXA, +) -> ()} +FN!{stdcall LPFN_FREEADDRINFOEXW( + pAddrInfoEx: PADDRINFOEXW, +) -> ()} +pub type socklen_t = c_int; +extern "system" { + pub fn getnameinfo( + pSockaddr: *const SOCKADDR, + SockaddrLength: socklen_t, + pNodeBuffer: PCHAR, + NodeBufferSize: DWORD, + pServiceBuffer: PCHAR, + ServiceBufferSize: DWORD, + Flags: INT, + ) -> INT; + pub fn GetNameInfoW( + pSockaddr: *const SOCKADDR, + SockaddrLength: socklen_t, + pNodeBuffer: PWCHAR, + NodeBufferSize: DWORD, + pServiceBuffer: PWCHAR, + ServiceBufferSize: DWORD, + Flags: INT, + ) -> INT; +} +FN!{stdcall LPFN_GETNAMEINFO( + pSockaddr: *const SOCKADDR, + SockaddrLength: socklen_t, + pNodeBuffer: PCHAR, + NodeBufferSize: DWORD, + pServiceBuffer: PCHAR, + ServiceBufferSize: DWORD, + Flags: INT, +) -> c_int} +FN!{stdcall LPFN_GETNAMEINFOW( + pSockaddr: *const SOCKADDR, + SockaddrLength: socklen_t, + pNodeBuffer: PWCHAR, + NodeBufferSize: DWORD, + pServiceBuffer: PWCHAR, + ServiceBufferSize: DWORD, + Flags: INT, +) -> INT} +extern "system" { + pub fn inet_pton( + Family: INT, + pszAddrString: PCSTR, + pAddrBuf: PVOID, + ) -> INT; + pub fn InetPtonW( + Family: INT, + pszAddrString: PCWSTR, + pAddrBuf: PVOID, + ) -> INT; + pub fn inet_ntop( + Family: INT, + pAddr: *const VOID, + pStringBuf: PSTR, + StringBufSize: size_t, + ) -> PCSTR; + pub fn InetNtopW( + Family: INT, + pAddr: *const VOID, + pStringBuf: PWSTR, + StringBufSize: size_t, + ) -> PCWSTR; +} +FN!{stdcall LPFN_INET_PTONA( + Family: INT, + pszAddrString: PCSTR, + pAddrBuf: PVOID, +) -> INT} +FN!{stdcall LPFN_INET_PTONW( + Family: INT, + pszAddrString: PCWSTR, + pAddrBuf: PVOID, +) -> INT} +FN!{stdcall LPFN_INET_NTOPA( + Family: INT, + pAddr: *const VOID, + pStringBuf: PSTR, + StringBufSize: size_t, +) -> PCSTR} +FN!{stdcall LPFN_INET_NTOPW( + Family: INT, + pAddr: *const VOID, + pStringBuf: PWSTR, + StringBufSize: size_t, +) -> PCWSTR} +pub const GAI_STRERROR_BUFFER_SIZE: usize = 1024; +extern "system" { + pub fn WSASetSocketSecurity( + Socket: SOCKET, + SecuritySettings: *const SOCKET_SECURITY_SETTINGS, + SecuritySettingsLen: ULONG, + Overlapped: LPWSAOVERLAPPED, + CompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> INT; + pub fn WSAQuerySocketSecurity( + Socket: SOCKET, + SecurityQueryTemplate: *const SOCKET_SECURITY_QUERY_TEMPLATE, + SecurityQueryTemplateLen: ULONG, + SecurityQueryInfo: *mut SOCKET_SECURITY_QUERY_INFO, + SecurityQueryInfoLen: *mut ULONG, + Overlapped: LPWSAOVERLAPPED, + CompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> INT; + pub fn WSASetSocketPeerTargetName( + Socket: SOCKET, + PeerTargetName: *const SOCKET_PEER_TARGET_NAME, + PeerTargetNameLen: ULONG, + Overlapped: LPWSAOVERLAPPED, + CompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> INT; + pub fn WSADeleteSocketPeerTargetName( + Socket: SOCKET, + PeerAddr: *const SOCKADDR, + PeerAddrLen: ULONG, + Overlapped: LPWSAOVERLAPPED, + CompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> INT; + pub fn WSAImpersonateSocketPeer( + Socket: SOCKET, + PeerAddr: *const SOCKADDR, + PeerAddrLen: ULONG, + ) -> INT; + pub fn WSARevertImpersonation(); +} diff --git a/src/vendor/winapi/src/um/xinput.rs b/src/vendor/winapi/src/um/xinput.rs new file mode 100644 index 0000000000..87cf2db2c9 --- /dev/null +++ b/src/vendor/winapi/src/um/xinput.rs @@ -0,0 +1,166 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! XInput procedure declarations, constant definitions and macros +use shared::guiddef::GUID; +use shared::minwindef::{BOOL, BYTE, DWORD, UINT, WORD}; +use um::winnt::{LPWSTR, SHORT, WCHAR}; +pub const XINPUT_DEVTYPE_GAMEPAD: BYTE = 0x01; +pub const XINPUT_DEVSUBTYPE_GAMEPAD: BYTE = 0x01; +pub const XINPUT_DEVSUBTYPE_WHEEL: BYTE = 0x02; +pub const XINPUT_DEVSUBTYPE_ARCADE_STICK: BYTE = 0x03; +pub const XINPUT_DEVSUBTYPE_FLIGHT_SICK: BYTE = 0x04; +pub const XINPUT_DEVSUBTYPE_DANCE_PAD: BYTE = 0x05; +pub const XINPUT_DEVSUBTYPE_GUITAR: BYTE = 0x06; +pub const XINPUT_DEVSUBTYPE_DRUM_KIT: BYTE = 0x08; +pub const XINPUT_CAPS_VOICE_SUPPORTED: WORD = 0x0004; +pub const XINPUT_GAMEPAD_DPAD_UP: WORD = 0x0001; +pub const XINPUT_GAMEPAD_DPAD_DOWN: WORD = 0x0002; +pub const XINPUT_GAMEPAD_DPAD_LEFT: WORD = 0x0004; +pub const XINPUT_GAMEPAD_DPAD_RIGHT: WORD = 0x0008; +pub const XINPUT_GAMEPAD_START: WORD = 0x0010; +pub const XINPUT_GAMEPAD_BACK: WORD = 0x0020; +pub const XINPUT_GAMEPAD_LEFT_THUMB: WORD = 0x0040; +pub const XINPUT_GAMEPAD_RIGHT_THUMB: WORD = 0x0080; +pub const XINPUT_GAMEPAD_LEFT_SHOULDER: WORD = 0x0100; +pub const XINPUT_GAMEPAD_RIGHT_SHOULDER: WORD = 0x0200; +pub const XINPUT_GAMEPAD_A: WORD = 0x1000; +pub const XINPUT_GAMEPAD_B: WORD = 0x2000; +pub const XINPUT_GAMEPAD_X: WORD = 0x4000; +pub const XINPUT_GAMEPAD_Y: WORD = 0x8000; +pub const XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE: SHORT = 7849; +pub const XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE: SHORT = 8689; +pub const XINPUT_GAMEPAD_TRIGGER_THRESHOLD: BYTE = 30; +pub const XINPUT_FLAG_GAMEPAD: DWORD = 0x00000001; +pub const BATTERY_DEVTYPE_GAMEPAD: BYTE = 0x00; +pub const BATTERY_DEVTYPE_HEADSET: BYTE = 0x01; +pub const BATTERY_TYPE_DISCONNECTED: BYTE = 0x00; +pub const BATTERY_TYPE_WIRED: BYTE = 0x01; +pub const BATTERY_TYPE_ALKALINE: BYTE = 0x02; +pub const BATTERY_TYPE_NIMH: BYTE = 0x03; +pub const BATTERY_TYPE_UNKNOWN: BYTE = 0xFF; +pub const BATTERY_LEVEL_EMPTY: BYTE = 0x00; +pub const BATTERY_LEVEL_LOW: BYTE = 0x01; +pub const BATTERY_LEVEL_MEDIUM: BYTE = 0x02; +pub const BATTERY_LEVEL_FULL: BYTE = 0x03; +pub const XUSER_MAX_COUNT: DWORD = 4; +pub const XUSER_INDEX_ANY: DWORD = 0x000000FF; +pub const VK_PAD_A: WORD = 0x5800; +pub const VK_PAD_B: WORD = 0x5801; +pub const VK_PAD_X: WORD = 0x5802; +pub const VK_PAD_Y: WORD = 0x5803; +pub const VK_PAD_RSHOULDER: WORD = 0x5804; +pub const VK_PAD_LSHOULDER: WORD = 0x5805; +pub const VK_PAD_LTRIGGER: WORD = 0x5806; +pub const VK_PAD_RTRIGGER: WORD = 0x5807; +pub const VK_PAD_DPAD_UP: WORD = 0x5810; +pub const VK_PAD_DPAD_DOWN: WORD = 0x5811; +pub const VK_PAD_DPAD_LEFT: WORD = 0x5812; +pub const VK_PAD_DPAD_RIGHT: WORD = 0x5813; +pub const VK_PAD_START: WORD = 0x5814; +pub const VK_PAD_BACK: WORD = 0x5815; +pub const VK_PAD_LTHUMB_PRESS: WORD = 0x5816; +pub const VK_PAD_RTHUMB_PRESS: WORD = 0x5817; +pub const VK_PAD_LTHUMB_UP: WORD = 0x5820; +pub const VK_PAD_LTHUMB_DOWN: WORD = 0x5821; +pub const VK_PAD_LTHUMB_RIGHT: WORD = 0x5822; +pub const VK_PAD_LTHUMB_LEFT: WORD = 0x5823; +pub const VK_PAD_LTHUMB_UPLEFT: WORD = 0x5824; +pub const VK_PAD_LTHUMB_UPRIGHT: WORD = 0x5825; +pub const VK_PAD_LTHUMB_DOWNRIGHT: WORD = 0x5826; +pub const VK_PAD_LTHUMB_DOWNLEFT: WORD = 0x5827; +pub const VK_PAD_RTHUMB_UP: WORD = 0x5830; +pub const VK_PAD_RTHUMB_DOWN: WORD = 0x5831; +pub const VK_PAD_RTHUMB_RIGHT: WORD = 0x5832; +pub const VK_PAD_RTHUMB_LEFT: WORD = 0x5833; +pub const VK_PAD_RTHUMB_UPLEFT: WORD = 0x5834; +pub const VK_PAD_RTHUMB_UPRIGHT: WORD = 0x5835; +pub const VK_PAD_RTHUMB_DOWNRIGHT: WORD = 0x5836; +pub const VK_PAD_RTHUMB_DOWNLEFT: WORD = 0x5837; +pub const XINPUT_KEYSTROKE_KEYDOWN: WORD = 0x0001; +pub const XINPUT_KEYSTROKE_KEYUP: WORD = 0x0002; +pub const XINPUT_KEYSTROKE_REPEAT: WORD = 0x0004; +STRUCT!{struct XINPUT_GAMEPAD { + wButtons: WORD, + bLeftTrigger: BYTE, + bRightTrigger: BYTE, + sThumbLX: SHORT, + sThumbLY: SHORT, + sThumbRX: SHORT, + sThumbRY: SHORT, +}} +pub type PXINPUT_GAMEPAD = *mut XINPUT_GAMEPAD; +STRUCT!{struct XINPUT_STATE { + dwPacketNumber: DWORD, + Gamepad: XINPUT_GAMEPAD, +}} +pub type PXINPUT_STATE = *mut XINPUT_STATE; +STRUCT!{struct XINPUT_VIBRATION { + wLeftMotorSpeed: WORD, + wRightMotorSpeed: WORD, +}} +pub type PXINPUT_VIBRATION = *mut XINPUT_VIBRATION; +STRUCT!{struct XINPUT_CAPABILITIES { + Type: BYTE, + SubType: BYTE, + Flags: WORD, + Gamepad: XINPUT_GAMEPAD, + Vibration: XINPUT_VIBRATION, +}} +pub type PXINPUT_CAPABILITIES = *mut XINPUT_CAPABILITIES; +STRUCT!{struct XINPUT_BATTERY_INFORMATION { + BatteryType: BYTE, + BatteryLevel: BYTE, +}} +pub type PXINPUT_BATTERY_INFORMATION = *mut XINPUT_BATTERY_INFORMATION; +STRUCT!{struct XINPUT_KEYSTROKE { + VirtualKey: WORD, + Unicode: WCHAR, + Flags: WORD, + UserIndex: BYTE, + HidCode: BYTE, +}} +pub type PXINPUT_KEYSTROKE = *mut XINPUT_KEYSTROKE; +extern "system" { + pub fn XInputGetState( + dwUserIndex: DWORD, + pState: *mut XINPUT_STATE, + ) -> DWORD; + pub fn XInputSetState( + dwUserIndex: DWORD, + pVibration: *mut XINPUT_VIBRATION, + ) -> DWORD; + pub fn XInputGetCapabilities( + dwUserIndex: DWORD, + dwFlags: DWORD, + pCapabilities: *mut XINPUT_CAPABILITIES, + ) -> DWORD; + pub fn XInputEnable( + enable: BOOL, + ); + pub fn XInputGetAudioDeviceIds( + dwUserIndex: DWORD, + pRenderDeviceId: LPWSTR, + pRenderCount: *mut UINT, + pCaptureDeviceId: LPWSTR, + pCaptureCount: *mut UINT, + ) -> DWORD; + pub fn XInputGetBatteryInformation( + dwUserIndex: DWORD, + devType: BYTE, + pBatteryInformation: *mut XINPUT_BATTERY_INFORMATION, + ) -> DWORD; + pub fn XInputGetKeystroke( + dwUserIndex: DWORD, + dwReserved: DWORD, + pKeystroke: PXINPUT_KEYSTROKE, + ) -> DWORD; + pub fn XInputGetDSoundAudioDeviceGuids( + dwUserIndex: DWORD, + pDSoundRenderGuid: *mut GUID, + pDSoundCaptureGuid: *mut GUID, + ) -> DWORD; +} diff --git a/src/vendor/winapi/src/vc/excpt.rs b/src/vendor/winapi/src/vc/excpt.rs new file mode 100644 index 0000000000..97470d736f --- /dev/null +++ b/src/vendor/winapi/src/vc/excpt.rs @@ -0,0 +1,19 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! The declarations of the compiler-dependent intrinsics, support functions, and keywords which +//! implement the structured exception handling extensions. +ENUM!{enum EXCEPTION_DISPOSITION { + ExceptionContinueExecution, + ExceptionContinueSearch, + ExceptionNestedException, + ExceptionCollidedUnwind, +}} +// While there are functions defined here in `excpt.h`, they are actually intrinsics which have +// special black magic in the msvc compiler. Thus bindings cannot be provided for them. +pub const EXCEPTION_EXECUTE_HANDLER: i32 = 1; +pub const EXCEPTION_CONTINUE_SEARCH: i32 = 0; +pub const EXCEPTION_CONTINUE_EXECUTION: i32 = -1; diff --git a/src/vendor/winapi/src/vc/limits.rs b/src/vendor/winapi/src/vc/limits.rs new file mode 100644 index 0000000000..a20794d7c7 --- /dev/null +++ b/src/vendor/winapi/src/vc/limits.rs @@ -0,0 +1,8 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::{c_uint}; +pub const UINT_MAX: c_uint = 0xffffffff; diff --git a/src/vendor/winapi/src/vc/mod.rs b/src/vendor/winapi/src/vc/mod.rs new file mode 100644 index 0000000000..72c2b57782 --- /dev/null +++ b/src/vendor/winapi/src/vc/mod.rs @@ -0,0 +1,11 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Headers that come with VC. Notably, these are not part of the Windows SDK. +#[cfg(feature = "excpt")] pub mod excpt; +#[cfg(feature = "limits")] pub mod limits; +#[cfg(feature = "vadefs")] pub mod vadefs; +#[cfg(feature = "vcruntime")] pub mod vcruntime; diff --git a/src/vendor/winapi/src/vc/vadefs.rs b/src/vendor/winapi/src/vc/vadefs.rs new file mode 100644 index 0000000000..bd758f3308 --- /dev/null +++ b/src/vendor/winapi/src/vc/vadefs.rs @@ -0,0 +1,9 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use ctypes::c_char; +pub type uintptr_t = usize; +pub type va_list = *mut c_char; diff --git a/src/vendor/winapi/src/vc/vcruntime.rs b/src/vendor/winapi/src/vc/vcruntime.rs new file mode 100644 index 0000000000..9198f21d10 --- /dev/null +++ b/src/vendor/winapi/src/vc/vcruntime.rs @@ -0,0 +1,10 @@ +// Copyright © 2016 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Declarations used throughout the VCRuntime library. +pub type size_t = usize; +pub type ptrdiff_t = isize; +pub type intptr_t = isize; diff --git a/src/vendor/winapi/src/winrt/activation.rs b/src/vendor/winapi/src/winrt/activation.rs new file mode 100644 index 0000000000..44b147acbf --- /dev/null +++ b/src/vendor/winapi/src/winrt/activation.rs @@ -0,0 +1,14 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use um::winnt::{HRESULT}; +use winrt::inspectable::{IInspectable, IInspectableVtbl}; +RIDL!{#[uuid(0x00000035, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)] +interface IActivationFactory(IActivationFactoryVtbl): IInspectable(IInspectableVtbl) { + fn ActivateInstance( + instance: *mut *mut IInspectable, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/winrt/hstring.rs b/src/vendor/winapi/src/winrt/hstring.rs new file mode 100644 index 0000000000..66176ba945 --- /dev/null +++ b/src/vendor/winapi/src/winrt/hstring.rs @@ -0,0 +1,26 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! This interface definition contains typedefs for Windows Runtime data types. +use ctypes::c_char; +use um::winnt::PVOID; +DECLARE_HANDLE!(HSTRING, HSTRING__); +#[cfg(target_arch = "x86")] +UNION!{union HSTRING_HEADER_Reserved { + [u32; 5], + Reserved1 Reserved1_mut: PVOID, + Reserved2 Reserved2_mut: [c_char; 20], +}} +#[cfg(target_arch = "x86_64")] +UNION!{union HSTRING_HEADER_Reserved { + [u64; 3], + Reserved1 Reserved1_mut: PVOID, + Reserved2 Reserved2_mut: [c_char; 24], +}} +STRUCT!{struct HSTRING_HEADER { + Reserved: HSTRING_HEADER_Reserved, +}} +DECLARE_HANDLE!(HSTRING_BUFFER, HSTRING_BUFFER__); diff --git a/src/vendor/winapi/src/winrt/inspectable.rs b/src/vendor/winapi/src/winrt/inspectable.rs new file mode 100644 index 0000000000..7b2292a89a --- /dev/null +++ b/src/vendor/winapi/src/winrt/inspectable.rs @@ -0,0 +1,30 @@ +// Copyright © 2015-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::guiddef::IID; +use shared::minwindef::ULONG; +use um::unknwnbase::{IUnknown, IUnknownVtbl}; +use um::winnt::HRESULT; +use winrt::hstring::HSTRING; +pub type LPINSPECTABLE = *mut IInspectable; +ENUM!{enum TrustLevel { + BaseTrust = 0, + PartialTrust, + FullTrust, +}} +RIDL!{#[uuid(0xaf86e2e0, 0xb12d, 0x4c6a, 0x9c, 0x5a, 0xd7, 0xaa, 0x65, 0x10, 0x1e, 0x90)] +interface IInspectable(IInspectableVtbl): IUnknown(IUnknownVtbl) { + fn GetIids( + iidCount: *mut ULONG, + iids: *mut *mut IID, + ) -> HRESULT, + fn GetRuntimeClassName( + className: *mut HSTRING, + ) -> HRESULT, + fn GetTrustLevel( + trustLevel: *mut TrustLevel, + ) -> HRESULT, +}} diff --git a/src/vendor/winapi/src/winrt/mod.rs b/src/vendor/winapi/src/winrt/mod.rs new file mode 100644 index 0000000000..be9e7fbb07 --- /dev/null +++ b/src/vendor/winapi/src/winrt/mod.rs @@ -0,0 +1,13 @@ +// Copyright © 2016-2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +#[cfg(feature = "activation")] pub mod activation; +#[cfg(feature = "hstring")] pub mod hstring; +#[cfg(feature = "inspectable")] pub mod inspectable; +#[cfg(feature = "roapi")] pub mod roapi; +#[cfg(feature = "robuffer")] pub mod robuffer; +#[cfg(feature = "roerrorapi")] pub mod roerrorapi; +#[cfg(feature = "winstring")] pub mod winstring; diff --git a/src/vendor/winapi/src/winrt/roapi.rs b/src/vendor/winapi/src/winrt/roapi.rs new file mode 100644 index 0000000000..9b3c3c5076 --- /dev/null +++ b/src/vendor/winapi/src/winrt/roapi.rs @@ -0,0 +1,61 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::{UINT32, UINT64}; +use shared::guiddef::REFIID; +use um::objidl::IApartmentShutdown; +use um::winnt::{HRESULT, VOID}; +use winrt::activation::IActivationFactory; +use winrt::hstring::HSTRING; +use winrt::inspectable::IInspectable; +ENUM!{enum RO_INIT_TYPE { + RO_INIT_SINGLETHREADED = 0, + RO_INIT_MULTITHREADED = 1, +}} +pub enum RO_REGISTRATION_COOKIE__ {} +pub type RO_REGISTRATION_COOKIE = *mut RO_REGISTRATION_COOKIE__; +FN!{stdcall PFNGETACTIVATIONFACTORY( + HSTRING, + *mut *mut IActivationFactory, +) -> HRESULT} +extern "system" { + pub fn RoInitialize( + initType: RO_INIT_TYPE, + ) -> HRESULT; + pub fn RoUninitialize(); + pub fn RoActivateInstance( + activatableClassId: HSTRING, + instance: *mut *mut IInspectable, + ) -> HRESULT; + pub fn RoRegisterActivationFactories( + activatableClassIds: *const HSTRING, + activationFactoryCallbacks: *const PFNGETACTIVATIONFACTORY, + count: UINT32, + cookie: *mut RO_REGISTRATION_COOKIE, + ) -> HRESULT; + pub fn RoRevokeActivationFactories( + cookie: RO_REGISTRATION_COOKIE, + ); + pub fn RoGetActivationFactory( + activatableClassId: HSTRING, + iid: REFIID, + factory: *mut *mut VOID, + ) -> HRESULT; +} +DECLARE_HANDLE!(APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, APARTMENT_SHUTDOWN_REGISTRATION_COOKIE__); +extern "system" { + pub fn RoRegisterForApartmentShutdown( + callbackObject: *const IApartmentShutdown, + apartmentIdentifier: *mut UINT64, + regCookie: *mut APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, + ) -> HRESULT; + pub fn RoUnregisterForApartmentShutdown( + regCookie: APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, + ) -> HRESULT; + pub fn RoGetApartmentIdentifier( + apartmentIdentifier: *mut UINT64, + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/winrt/robuffer.rs b/src/vendor/winapi/src/winrt/robuffer.rs new file mode 100644 index 0000000000..646f9701c3 --- /dev/null +++ b/src/vendor/winapi/src/winrt/robuffer.rs @@ -0,0 +1,13 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use um::objidl::IMarshal; +use um::winnt::HRESULT; +extern "system" { + pub fn RoGetBufferMarshaler( + bufferMarshaler: *mut *mut IMarshal + ) -> HRESULT; +} diff --git a/src/vendor/winapi/src/winrt/roerrorapi.rs b/src/vendor/winapi/src/winrt/roerrorapi.rs new file mode 100644 index 0000000000..11a8d2d8aa --- /dev/null +++ b/src/vendor/winapi/src/winrt/roerrorapi.rs @@ -0,0 +1,104 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::{UINT32, UINT_PTR}; +use shared::minwindef::{BOOL, BYTE, UINT, USHORT}; +use um::restrictederrorinfo::IRestrictedErrorInfo; +use um::unknwnbase::IUnknown; +use um::winnt::{HRESULT, PCWSTR, PVOID, VOID}; +use winrt::hstring::HSTRING; +ENUM!{enum RO_ERROR_REPORTING_FLAGS { + RO_ERROR_REPORTING_NONE = 0x00000000, + RO_ERROR_REPORTING_SUPPRESSEXCEPTIONS = 0x00000001, + RO_ERROR_REPORTING_FORCEEXCEPTIONS = 0x00000002, + RO_ERROR_REPORTING_USESETERRORINFO = 0x00000004, + RO_ERROR_REPORTING_SUPPRESSSETERRORINFO = 0x00000008, +}} +extern "system" { + pub fn RoGetErrorReportingFlags( + pflags: *mut UINT32, + ) -> HRESULT; + pub fn RoSetErrorReportingFlags( + flags: UINT32, + ) -> HRESULT; + pub fn RoResolveRestrictedErrorInfoReference( + reference: PCWSTR, + ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo , + ) -> HRESULT; + pub fn SetRestrictedErrorInfo( + pRestrictedErrorInfo: *const IRestrictedErrorInfo, + ) -> HRESULT; + pub fn GetRestrictedErrorInfo( + ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo, + ) -> HRESULT; + pub fn RoOriginateErrorW( + error: HRESULT, + cchMax: UINT, + message: PCWSTR, + ) -> BOOL; + pub fn RoOriginateError( + error: HRESULT, + message: HSTRING, + ) -> BOOL; + pub fn RoTransformErrorW( + oldError: HRESULT, + newError: HRESULT, + cchMax: UINT, + message: PCWSTR, + ) -> BOOL; + pub fn RoTransformError( + oldError: HRESULT, + newError: HRESULT, + message: HSTRING, + ) -> BOOL; + pub fn RoCaptureErrorContext( + hr: HRESULT, + ) -> HRESULT; + pub fn RoFailFastWithErrorContext( + hrError: HRESULT, + ); + pub fn RoOriginateLanguageException( + error: HRESULT, + message: HSTRING, + languageException: *const IUnknown, + ) -> BOOL; + pub fn RoClearError(); + pub fn RoReportUnhandledError( + pRestrictedErrorInfo: *const IRestrictedErrorInfo, + ) -> HRESULT; +} +FN!{stdcall PINSPECT_MEMORY_CALLBACK( + *const VOID, + UINT_PTR, + UINT32, + *mut BYTE, +) -> HRESULT} +extern "system" { + pub fn RoInspectThreadErrorInfo( + targetTebAddress: UINT_PTR, + machine: USHORT, + readMemoryCallback: PINSPECT_MEMORY_CALLBACK, + context: PVOID, + targetErrorInfoAddress: *mut UINT_PTR, + ) -> HRESULT; + pub fn RoInspectCapturedStackBackTrace( + targetErrorInfoAddress: UINT_PTR, + machine: USHORT, + readMemoryCallback: PINSPECT_MEMORY_CALLBACK, + context: PVOID, + frameCount: *mut UINT32, + targetBackTraceAddress: *mut UINT_PTR, + ) -> HRESULT; + pub fn RoGetMatchingRestrictedErrorInfo( + hrIn: HRESULT, + ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo, + ) -> HRESULT; + pub fn RoReportFailedDelegate( + punkDelegate: *const IUnknown, + pRestrictedErrorInfo: *const IRestrictedErrorInfo, + ) -> HRESULT; + pub fn IsErrorPropagationEnabled() -> BOOL; +} diff --git a/src/vendor/winapi/src/winrt/winstring.rs b/src/vendor/winapi/src/winrt/winstring.rs new file mode 100644 index 0000000000..b7c0d8660f --- /dev/null +++ b/src/vendor/winapi/src/winrt/winstring.rs @@ -0,0 +1,151 @@ +// Copyright © 2017 winapi-rs developers +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +use shared::basetsd::{INT32, UINT32, UINT_PTR}; +use shared::minwindef::{BOOL, BYTE, UCHAR, ULONG, USHORT}; +use um::winnt::{HRESULT, PCWSTR, VOID, WCHAR}; +use winrt::hstring::{HSTRING, HSTRING_BUFFER, HSTRING_HEADER}; +extern "system" { + pub fn WindowsCreateString( + sourceString: PCWSTR, + length: UINT32, + string: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsCreateStringReference( + sourceString: PCWSTR, + length: UINT32, + hstringHeader: *mut HSTRING_HEADER, + string: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsDeleteString( + string: HSTRING, + ) -> HRESULT; + pub fn WindowsDuplicateString( + string: HSTRING, + newString: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsGetStringLen( + string: HSTRING, + ) -> UINT32; + pub fn WindowsGetStringRawBuffer( + string: HSTRING, + length: *mut UINT32, + ) -> PCWSTR; + pub fn WindowsIsStringEmpty( + string: HSTRING, + ) -> BOOL; + pub fn WindowsStringHasEmbeddedNull( + string: HSTRING, + hasEmbedNull: *mut BOOL, + ) -> HRESULT; + pub fn WindowsCompareStringOrdinal( + string1: HSTRING, + string2: HSTRING, + result: *mut INT32, + ) -> HRESULT; + pub fn WindowsSubstring( + string: HSTRING, + startIndex: UINT32, + newString: *mut HSTRING, + ) -> HSTRING; + pub fn WindowsSubstringWithSpecifiedLength( + string: HSTRING, + startIndex: UINT32, + length: UINT32, + newString: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsConcatString( + string1: HSTRING, + string2: HSTRING, + newString: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsReplaceString( + string: HSTRING, + stringReplaced: HSTRING, + stringReplaceWith: HSTRING, + newString: *mut HSTRING + ) -> HRESULT; + pub fn WindowsTrimStringStart( + string: HSTRING, + trimString: HSTRING, + newString: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsTrimStringEnd( + string: HSTRING, + trimString: HSTRING, + newString: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsPreallocateStringBuffer( + length: UINT32, + charBuffer: *mut *mut WCHAR, + bufferHandle: *mut HSTRING_BUFFER, + ) -> HRESULT; + pub fn WindowsPromoteStringBuffer( + bufferHandle: HSTRING_BUFFER, + string: *mut HSTRING, + ) -> HRESULT; + pub fn WindowsDeleteStringBuffer( + bufferHandle: HSTRING_BUFFER, + ) -> HRESULT; +} +FN!{stdcall PINSPECT_HSTRING_CALLBACK( + *const VOID, + UINT_PTR, + UINT32, + *mut BYTE, +) -> HRESULT} +extern "system" { + pub fn WindowsInspectString( + targetHString: UINT_PTR, + machine: USHORT, + callback: PINSPECT_HSTRING_CALLBACK, + context: *const VOID, + length: *mut UINT32, + targetStringAddress: *mut UINT_PTR, + ) -> HRESULT; + pub fn HSTRING_UserSize( + pFlags: *const ULONG, + StartingSize: ULONG, + ppidl: *const HSTRING, + ) -> ULONG; + pub fn HSTRING_UserMarshal( + pFlags: *const ULONG, + pBuffer: *mut UCHAR, + ppidl: *const HSTRING, + ) -> *mut UCHAR; + pub fn HSTRING_UserUnmarshal( + pFlags: *const ULONG, + pBuffer: *const UCHAR, + ppidl: *mut HSTRING, + ) -> *mut UCHAR; + pub fn HSTRING_UserFree( + pFlags: *const ULONG, + ppidl: *const HSTRING, + ); + #[cfg(target_arch = "x86_64")] + pub fn HSTRING_UserSize64( + pFlags: *const ULONG, + StartingSize: ULONG, + ppidl: *const HSTRING, + ) -> ULONG; + #[cfg(target_arch = "x86_64")] + pub fn HSTRING_UserMarshal64( + pFlags: *const ULONG, + pBuffer: *mut UCHAR, + ppidl: *const HSTRING, + ) -> *mut UCHAR; + #[cfg(target_arch = "x86_64")] + pub fn HSTRING_UserUnmarshal64( + pFlags: *const ULONG, + pBuffer: *const UCHAR, + ppidl: *mut HSTRING, + ) -> *mut UCHAR; + #[cfg(target_arch = "x86_64")] + pub fn HSTRING_UserFree64( + pFlags: *const ULONG, + ppidl: *const HSTRING, + ); +} diff --git a/version b/version index 14e03bdbd0..208e4b8ff9 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.23.0 (766bd11c8 2018-01-01) \ No newline at end of file +1.24.1 (d3ae9a9e0 2018-02-27) \ No newline at end of file

Baz +"; + + let document = parse_html().one(html); + let matching = document.select_first("p.foo").unwrap(); + let child = matching.as_node().first_child().unwrap(); + assert_eq!(&**child.as_text().unwrap().borrow(), "Foo\n"); + assert_eq!(matching.attributes.borrow().get("class"), Some("foo")); + assert_eq!(matching.attributes.borrow().get(local_name!("class")), Some("foo")); + + assert!(document.select_first("p.bar").is_err()); +} + #[test] fn to_string() { let html = r" diff --git a/src/vendor/lazy_static-0.2.11/.cargo-checksum.json b/src/vendor/lazy_static-0.2.11/.cargo-checksum.json new file mode 100644 index 0000000000..c015cef77b --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"ee9afa8d5e10d088632b66c622d4451a826a4066e0e84052f40b9b3e82c6bec7",".travis.yml":"a1cad0121fd4c6507c8b709fee344367ea73eff40915c2fd6a6108762c84f8f2","Cargo.toml":"b598bd90e0cda5d1d3cec4042310a9e74afbe398a76af48e0d43ea5d3c51f137","Cargo.toml.orig":"ce52e452ff2eb6845fa554f9c18c890a41ee6aec6f090d940252d8dac68d7977","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"c305f498e6d89730d84eaf92e980ba001e259dd40fcb40855947baece2af0895","appveyor.yml":"68c8ff7090ffdfa42b3d65b841d5de67d47a2206e02bf97aaca34b4500ae4bf1","src/core_lazy.rs":"2cea85ad0c2c4f88a5a927815a59270411daa4075510fad0faf671d5f5130fed","src/lazy.rs":"52912a897e8fcc95672e3b3068be82d56548f422edcb60e6ce9570779acb5bc0","src/lib.rs":"facd354cb716ee6941bf9bc8d34c27a2ecd752746c4d5164dbec8cedd80df605","src/nightly_lazy.rs":"34080822b27f3968c872867131448df76acc5aeff259852ff86f6e73b5a913b6","tests/compile-fail/README.md":"296216a459b7bf9947ba540c94b71a48ec90c2632ef5f05248a01dc8611ae149","tests/compile-fail/incorrect_visibility_restriction.rs":"557c94f781d6a2fb6c4be32a2ea252752195ff7b7c889581d95c39f2ce45e7d3","tests/compile-fail/static_is_private.rs":"f778f0759529b2dc8360f9abad1e09ea6662493493d707b3fba6cb1cb3d94af2","tests/compile-fail/static_is_sized.rs":"3b6d632f764ccee5fbd413324d7daeb2ab52dec0c99ea1db11a7eb2bbcad37cb","tests/compile-fail/static_never_used.rs":"5139e2459b4c68b0ed3f5a04452f60895b076acb1b5f344fb6b8ccbd50283a2d","tests/compile_tests.rs":"5710b2c0edc7623b895d67c26180a6c1d4022c154ecd616fab449afc9ba95109","tests/no_std.rs":"2a5236bd3892a253855b4dc192f63138239165fa23b9c3421a9faa5482c780aa","tests/test.rs":"12b100f4790037ca049692d896114d6361373c5321c29e0032c290ee39f1042c"},"package":"76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"} \ No newline at end of file diff --git a/src/vendor/lazy_static-0.2.11/.cargo-ok b/src/vendor/lazy_static-0.2.11/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/lazy_static-0.2.11/.gitignore b/src/vendor/lazy_static-0.2.11/.gitignore new file mode 100644 index 0000000000..bde55ce913 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/.gitignore @@ -0,0 +1,4 @@ +target +doc +Cargo.lock +.cargo diff --git a/src/vendor/lazy_static-0.2.11/.travis.yml b/src/vendor/lazy_static-0.2.11/.travis.yml new file mode 100644 index 0000000000..2e48cc760a --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/.travis.yml @@ -0,0 +1,31 @@ +language: rust +rust: +- nightly +- beta +- stable +before_script: +- | + pip install 'travis-cargo<0.2' --user && + export PATH=`python -m site --user-base`/bin:$PATH +script: +- | + travis-cargo build && + travis-cargo test && + travis-cargo bench && + travis-cargo --only nightly build -- --features spin_no_std && + travis-cargo --only nightly test -- --features spin_no_std && + travis-cargo --only nightly bench -- --features spin_no_std && + travis-cargo --only nightly clean && + travis-cargo --only nightly build -- --features compiletest && + travis-cargo --only nightly test -- --features compiletest && + travis-cargo --only nightly clean && + travis-cargo --only stable doc +after_success: +- travis-cargo --only stable doc-upload +env: + global: + - TRAVIS_CARGO_NIGHTLY_FEATURE=nightly + - secure: YXu24LptjeYirjWYjWGsMT2m3mB7LvQATE6TVo7VEUXv8GYoy2ORIHD83PeImxC93MmZ01QeUezRzuCW51ZcK92VnNSBttlF60SvIX18VsJrV92tsAhievFstqYQ+fB8DIuQ8noU0jPz7GpI+R9dlTRSImAqWOnVIghA+Wzz7Js= +os: + - linux + - osx diff --git a/src/vendor/lazy_static-0.2.11/Cargo.toml b/src/vendor/lazy_static-0.2.11/Cargo.toml new file mode 100644 index 0000000000..c25a8a1850 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/Cargo.toml @@ -0,0 +1,43 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "lazy_static" +version = "0.2.11" +authors = ["Marvin Löbel "] +description = "A macro for declaring lazily evaluated statics in Rust." +documentation = "https://docs.rs/lazy_static" +readme = "README.md" +keywords = ["macro", "lazy", "static"] +categories = ["no-std", "rust-patterns", "memory-management"] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-lang-nursery/lazy-static.rs" +[dependencies.compiletest_rs] +version = "0.3" +optional = true + +[dependencies.spin] +version = "0.4.6" +optional = true + +[features] +compiletest = ["compiletest_rs"] +nightly = [] +spin_no_std = ["nightly", "spin"] +[badges.appveyor] +repository = "rust-lang-nursery/lazy-static.rs" + +[badges.maintenance] +status = "passively-maintained" + +[badges.travis-ci] +repository = "rust-lang-nursery/lazy-static.rs" diff --git a/src/vendor/lazy_static-0.2.11/Cargo.toml.orig b/src/vendor/lazy_static-0.2.11/Cargo.toml.orig new file mode 100644 index 0000000000..477c1aec3e --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/Cargo.toml.orig @@ -0,0 +1,36 @@ +[package] +name = "lazy_static" +# NB: When modifying, also modify html_root_url in lib.rs +version = "0.2.11" +authors = ["Marvin Löbel "] +license = "MIT/Apache-2.0" + +description = "A macro for declaring lazily evaluated statics in Rust." +readme = "README.md" +documentation = "https://docs.rs/lazy_static" + +repository = "https://github.com/rust-lang-nursery/lazy-static.rs" +keywords = ["macro", "lazy", "static"] +categories = [ "no-std", "rust-patterns", "memory-management" ] + +[dependencies.spin] +version = "0.4.6" +optional = true + +[dependencies.compiletest_rs] +version = "0.3" +optional = true + +[features] +nightly = [] +spin_no_std = ["nightly", "spin"] +compiletest = ["compiletest_rs"] + +[badges] +appveyor = { repository = "rust-lang-nursery/lazy-static.rs" } +travis-ci = { repository = "rust-lang-nursery/lazy-static.rs" } + +# is-it-maintained-issue-resolution = { repository = "rust-lang-nursery/lazy-static.rs" } +# is-it-maintained-open-issues = { repository = "rust-lang-nursery/lazy-static.rs" } + +maintenance = { status = "passively-maintained" } diff --git a/src/tools/miri/LICENSE-APACHE b/src/vendor/lazy_static-0.2.11/LICENSE-APACHE similarity index 99% rename from src/tools/miri/LICENSE-APACHE rename to src/vendor/lazy_static-0.2.11/LICENSE-APACHE index a32595fa70..16fe87b06e 100644 --- a/src/tools/miri/LICENSE-APACHE +++ b/src/vendor/lazy_static-0.2.11/LICENSE-APACHE @@ -186,13 +186,13 @@ APPENDIX: How to apply the Apache License to your work. same "printed page" as the copyright notice for easier identification within third-party archives. -Copyright 2016 The Miri Developers +Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/tools/miri/LICENSE-MIT b/src/vendor/lazy_static-0.2.11/LICENSE-MIT similarity index 95% rename from src/tools/miri/LICENSE-MIT rename to src/vendor/lazy_static-0.2.11/LICENSE-MIT index 1f9d89a586..25597d5838 100644 --- a/src/tools/miri/LICENSE-MIT +++ b/src/vendor/lazy_static-0.2.11/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2016 The Miri Developers +Copyright (c) 2010 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/src/vendor/lazy_static-0.2.11/README.md b/src/vendor/lazy_static-0.2.11/README.md new file mode 100644 index 0000000000..ad5380ee1b --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/README.md @@ -0,0 +1,69 @@ +lazy-static.rs +============== + +A macro for declaring lazily evaluated statics in Rust. + +Using this macro, it is possible to have `static`s that require code to be +executed at runtime in order to be initialized. +This includes anything requiring heap allocations, like vectors or hash maps, +as well as anything that requires non-const function calls to be computed. + +[![Travis-CI Status](https://travis-ci.org/rust-lang-nursery/lazy-static.rs.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/lazy-static.rs) + +# Getting Started + +[lazy-static.rs is available on crates.io](https://crates.io/crates/lazy_static). +It is recommended to look there for the newest released version, as well as links to the newest builds of the docs. + +At the point of the last update of this README, the latest published version could be used like this: + +Add the following dependency to your Cargo manifest... + +```toml +[dependencies] +lazy_static = "0.2" +``` + +...and see the [docs](https://docs.rs/lazy_static) for how to use it. + +# Example + +```rust +#[macro_use] +extern crate lazy_static; + +use std::collections::HashMap; + +lazy_static! { + static ref HASHMAP: HashMap = { + let mut m = HashMap::new(); + m.insert(0, "foo"); + m.insert(1, "bar"); + m.insert(2, "baz"); + m + }; +} + +fn main() { + // First access to `HASHMAP` initializes it + println!("The entry for `0` is \"{}\".", HASHMAP.get(&0).unwrap()); + + // Any further access to `HASHMAP` just returns the computed value + println!("The entry for `1` is \"{}\".", HASHMAP.get(&1).unwrap()); +} +``` + +## License + +Licensed under either of + + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any +additional terms or conditions. diff --git a/src/vendor/lazy_static-0.2.11/appveyor.yml b/src/vendor/lazy_static-0.2.11/appveyor.yml new file mode 100644 index 0000000000..82a726c9ae --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/appveyor.yml @@ -0,0 +1,59 @@ +environment: + global: + PROJECT_NAME: lazy_static + # When this was added there were revocation check failures when using the + # libcurl backend as libcurl checks by default, but rustup doesn't provide the + # switch to turn this off. Switch to Hyper which looks to not check for + # revocation by default like libcurl does. + RUSTUP_USE_REQWEST: 1 + CARGO_HTTP_CHECK_REVOKE: false + matrix: + # Stable channel + - TARGET: i686-pc-windows-gnu + CHANNEL: stable + - TARGET: i686-pc-windows-msvc + CHANNEL: stable + - TARGET: x86_64-pc-windows-gnu + CHANNEL: stable + - TARGET: x86_64-pc-windows-msvc + CHANNEL: stable + # Beta channel + - TARGET: i686-pc-windows-gnu + CHANNEL: beta + - TARGET: i686-pc-windows-msvc + CHANNEL: beta + - TARGET: x86_64-pc-windows-gnu + CHANNEL: beta + - TARGET: x86_64-pc-windows-msvc + CHANNEL: beta + # Nightly channel + - TARGET: i686-pc-windows-gnu + CHANNEL: nightly + - TARGET: i686-pc-windows-msvc + CHANNEL: nightly + - TARGET: x86_64-pc-windows-gnu + CHANNEL: nightly + - TARGET: x86_64-pc-windows-msvc + CHANNEL: nightly + +# Install Rust and Cargo +# (Based on from https://github.com/rust-lang/libc/blob/master/appveyor.yml) +install: + - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe + - rustup-init.exe -y --default-toolchain %CHANNEL% --default-host %TARGET% + - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin + - if "%TARGET%" == "i686-pc-windows-gnu" set PATH=%PATH%;C:\msys64\mingw32\bin + - if "%TARGET%" == "x86_64-pc-windows-gnu" set PATH=%PATH%;C:\msys64\mingw64\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo build --verbose + - cargo test + - if [%CHANNEL%]==[nightly] ( + cargo clean && + cargo build --verbose --features "compiletest" && + cargo test --features "compiletest" + ) diff --git a/src/vendor/lazy_static-0.2.11/src/core_lazy.rs b/src/vendor/lazy_static-0.2.11/src/core_lazy.rs new file mode 100644 index 0000000000..90c7aaa9a5 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/src/core_lazy.rs @@ -0,0 +1,33 @@ +// Copyright 2016 lazy-static.rs Developers +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +extern crate spin; + +use self::spin::Once; + +pub struct Lazy(Once); + +impl Lazy { + #[inline(always)] + pub const fn new() -> Self { + Lazy(Once::new()) + } + + #[inline(always)] + pub fn get(&'static self, builder: F) -> &T + where F: FnOnce() -> T + { + self.0.call_once(builder) + } +} + +#[macro_export] +macro_rules! __lazy_static_create { + ($NAME:ident, $T:ty) => { + static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::new(); + } +} diff --git a/src/vendor/lazy_static-0.2.11/src/lazy.rs b/src/vendor/lazy_static-0.2.11/src/lazy.rs new file mode 100644 index 0000000000..aab1e0571a --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/src/lazy.rs @@ -0,0 +1,39 @@ +// Copyright 2016 lazy-static.rs Developers +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +extern crate std; + +use self::std::prelude::v1::*; +use self::std::sync::Once; +pub use self::std::sync::ONCE_INIT; + +pub struct Lazy(pub *const T, pub Once); + +impl Lazy { + #[inline(always)] + pub fn get(&'static mut self, f: F) -> &T + where F: FnOnce() -> T + { + unsafe { + let r = &mut self.0; + self.1.call_once(|| { + *r = Box::into_raw(Box::new(f())); + }); + + &*self.0 + } + } +} + +unsafe impl Sync for Lazy {} + +#[macro_export] +macro_rules! __lazy_static_create { + ($NAME:ident, $T:ty) => { + static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(0 as *const $T, $crate::lazy::ONCE_INIT); + } +} diff --git a/src/vendor/lazy_static-0.2.11/src/lib.rs b/src/vendor/lazy_static-0.2.11/src/lib.rs new file mode 100644 index 0000000000..bb15478d3c --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/src/lib.rs @@ -0,0 +1,212 @@ +// Copyright 2016 lazy-static.rs Developers +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +/*! +A macro for declaring lazily evaluated statics. + +Using this macro, it is possible to have `static`s that require code to be +executed at runtime in order to be initialized. +This includes anything requiring heap allocations, like vectors or hash maps, +as well as anything that requires function calls to be computed. + +# Syntax + +```ignore +lazy_static! { + [pub] static ref NAME_1: TYPE_1 = EXPR_1; + [pub] static ref NAME_2: TYPE_2 = EXPR_2; + ... + [pub] static ref NAME_N: TYPE_N = EXPR_N; +} +``` + +Attributes (including doc comments) are supported as well: + +```rust +# #[macro_use] +# extern crate lazy_static; +# fn main() { +lazy_static! { + /// This is an example for using doc comment attributes + static ref EXAMPLE: u8 = 42; +} +# } +``` + +# Semantics + +For a given `static ref NAME: TYPE = EXPR;`, the macro generates a unique type that +implements `Deref` and stores it in a static with name `NAME`. (Attributes end up +attaching to this type.) + +On first deref, `EXPR` gets evaluated and stored internally, such that all further derefs +can return a reference to the same object. Note that this can lead to deadlocks +if you have multiple lazy statics that depend on each other in their initialization. + +Apart from the lazy initialization, the resulting "static ref" variables +have generally the same properties as regular "static" variables: + +- Any type in them needs to fulfill the `Sync` trait. +- If the type has a destructor, then it will not run when the process exits. + +# Example + +Using the macro: + +```rust +#[macro_use] +extern crate lazy_static; + +use std::collections::HashMap; + +lazy_static! { + static ref HASHMAP: HashMap = { + let mut m = HashMap::new(); + m.insert(0, "foo"); + m.insert(1, "bar"); + m.insert(2, "baz"); + m + }; + static ref COUNT: usize = HASHMAP.len(); + static ref NUMBER: u32 = times_two(21); +} + +fn times_two(n: u32) -> u32 { n * 2 } + +fn main() { + println!("The map has {} entries.", *COUNT); + println!("The entry for `0` is \"{}\".", HASHMAP.get(&0).unwrap()); + println!("A expensive calculation on a static results in: {}.", *NUMBER); +} +``` + +# Implementation details + +The `Deref` implementation uses a hidden static variable that is guarded by a atomic check on each access. On stable Rust, the macro may need to allocate each static on the heap. + +*/ + +#![cfg_attr(feature="spin_no_std", feature(const_fn))] +#![cfg_attr(feature="nightly", feature(unreachable))] + +#![doc(html_root_url = "https://docs.rs/lazy_static/0.2.11")] +#![no_std] + +#[cfg(not(feature="nightly"))] +#[doc(hidden)] +pub mod lazy; + +#[cfg(all(feature="nightly", not(feature="spin_no_std")))] +#[path="nightly_lazy.rs"] +#[doc(hidden)] +pub mod lazy; + +#[cfg(all(feature="nightly", feature="spin_no_std"))] +#[path="core_lazy.rs"] +#[doc(hidden)] +pub mod lazy; + +#[doc(hidden)] +pub use core::ops::Deref as __Deref; + +#[macro_export] +#[doc(hidden)] +macro_rules! __lazy_static_internal { + // optional visibility restrictions are wrapped in `()` to allow for + // explicitly passing otherwise implicit information about private items + ($(#[$attr:meta])* ($($vis:tt)*) static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { + __lazy_static_internal!(@MAKE TY, $(#[$attr])*, ($($vis)*), $N); + __lazy_static_internal!(@TAIL, $N : $T = $e); + lazy_static!($($t)*); + }; + (@TAIL, $N:ident : $T:ty = $e:expr) => { + impl $crate::__Deref for $N { + type Target = $T; + #[allow(unsafe_code)] + fn deref(&self) -> &$T { + unsafe { + #[inline(always)] + fn __static_ref_initialize() -> $T { $e } + + #[inline(always)] + unsafe fn __stability() -> &'static $T { + __lazy_static_create!(LAZY, $T); + LAZY.get(__static_ref_initialize) + } + __stability() + } + } + } + impl $crate::LazyStatic for $N { + fn initialize(lazy: &Self) { + let _ = &**lazy; + } + } + }; + // `vis` is wrapped in `()` to prevent parsing ambiguity + (@MAKE TY, $(#[$attr:meta])*, ($($vis:tt)*), $N:ident) => { + #[allow(missing_copy_implementations)] + #[allow(non_camel_case_types)] + #[allow(dead_code)] + $(#[$attr])* + $($vis)* struct $N {__private_field: ()} + #[doc(hidden)] + $($vis)* static $N: $N = $N {__private_field: ()}; + }; + () => () +} + +#[macro_export] +macro_rules! lazy_static { + ($(#[$attr:meta])* static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { + // use `()` to explicitly forward the information about private items + __lazy_static_internal!($(#[$attr])* () static ref $N : $T = $e; $($t)*); + }; + ($(#[$attr:meta])* pub static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { + __lazy_static_internal!($(#[$attr])* (pub) static ref $N : $T = $e; $($t)*); + }; + ($(#[$attr:meta])* pub ($($vis:tt)+) static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { + __lazy_static_internal!($(#[$attr])* (pub ($($vis)+)) static ref $N : $T = $e; $($t)*); + }; + () => () +} + +/// Support trait for enabling a few common operation on lazy static values. +/// +/// This is implemented by each defined lazy static, and +/// used by the free functions in this crate. +pub trait LazyStatic { + #[doc(hidden)] + fn initialize(lazy: &Self); +} + +/// Takes a shared reference to a lazy static and initializes +/// it if it has not been already. +/// +/// This can be used to control the initialization point of a lazy static. +/// +/// Example: +/// +/// ```rust +/// #[macro_use] +/// extern crate lazy_static; +/// +/// lazy_static! { +/// static ref BUFFER: Vec = (0..65537).collect(); +/// } +/// +/// fn main() { +/// lazy_static::initialize(&BUFFER); +/// +/// // ... +/// work_with_initialized_data(&BUFFER); +/// } +/// # fn work_with_initialized_data(_: &[u8]) {} +/// ``` +pub fn initialize(lazy: &T) { + LazyStatic::initialize(lazy); +} diff --git a/src/vendor/lazy_static-0.2.11/src/nightly_lazy.rs b/src/vendor/lazy_static-0.2.11/src/nightly_lazy.rs new file mode 100644 index 0000000000..0ad0f66e7c --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/src/nightly_lazy.rs @@ -0,0 +1,43 @@ +// Copyright 2016 lazy-static.rs Developers +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +extern crate std; + +use self::std::prelude::v1::*; +use self::std::sync::Once; +pub use self::std::sync::ONCE_INIT; + +pub struct Lazy(pub Option, pub Once); + +impl Lazy { + #[inline(always)] + pub fn get(&'static mut self, f: F) -> &T + where F: FnOnce() -> T + { + { + let r = &mut self.0; + self.1.call_once(|| { + *r = Some(f()); + }); + } + unsafe { + match self.0 { + Some(ref x) => x, + None => std::mem::unreachable(), + } + } + } +} + +unsafe impl Sync for Lazy {} + +#[macro_export] +macro_rules! __lazy_static_create { + ($NAME:ident, $T:ty) => { + static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(None, $crate::lazy::ONCE_INIT); + } +} diff --git a/src/vendor/lazy_static-0.2.11/tests/compile-fail/README.md b/src/vendor/lazy_static-0.2.11/tests/compile-fail/README.md new file mode 100644 index 0000000000..7f80d11284 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/compile-fail/README.md @@ -0,0 +1,22 @@ +This directory contains snippets of code that should yield a +warning/note/help/error at compilation. Syntax of annotations is described in +[rust documentation](https://github.com/rust-lang/rust/blob/master/src/test/COMPILER_TESTS.md). +For more information check out [`compiletest` crate](https://github.com/laumann/compiletest-rs). + +To run compile tests issue `cargo +nightly --test --features compiletest`. + +## Notes on working with `compiletest` crate + +* Currently code that is inside macro should not be annotated, as `compiletest` + crate cannot deal with the fact that macro invocations effectively changes + line numbering. To prevent this add a `// error-pattern:` + on the top of the file and make sure that you set `deny` lint level + if you want to test compiler message different than error. +* `compiletest` crate by default sets `allow(dead_code)` lint level so make sure + that you change it to something suiting your needs even if the warning is + issued prior to any macro invocation. +* If you get a message `error: 0 unexpected errors found, 1 expected errors not found` + despite the fact that some error was bound to occur don't worry - it's a known + issue in the `compiletest` crate and your error was probably not registered - + make sure that your annotations are correct and that you are setting correct + lint levels. diff --git a/src/vendor/lazy_static-0.2.11/tests/compile-fail/incorrect_visibility_restriction.rs b/src/vendor/lazy_static-0.2.11/tests/compile-fail/incorrect_visibility_restriction.rs new file mode 100644 index 0000000000..e2e52381b1 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/compile-fail/incorrect_visibility_restriction.rs @@ -0,0 +1,10 @@ +// incorrect visibility restriction +#[macro_use] +extern crate lazy_static; + +lazy_static! { + pub(nonsense) static ref WRONG: () = (); + //~^ ERROR incorrect visibility restriction +} + +fn main() { } diff --git a/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_private.rs b/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_private.rs new file mode 100644 index 0000000000..a88c1c611d --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_private.rs @@ -0,0 +1,14 @@ +#[macro_use] +extern crate lazy_static; + +mod outer { + pub mod inner { + lazy_static! { + pub(in outer) static ref FOO: () = (); + } + } +} + +fn main() { + assert_eq!(*outer::inner::FOO, ()); //~ ERROR static `FOO` is private +} diff --git a/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_sized.rs b/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_sized.rs new file mode 100644 index 0000000000..3681ad7cd9 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_is_sized.rs @@ -0,0 +1,11 @@ +// error-pattern:the trait bound `str: std::marker::Sized` is not satisfied +#[macro_use] +extern crate lazy_static; + +lazy_static! { + pub static ref FOO: str = panic!(); +} + + +fn main() { +} diff --git a/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_never_used.rs b/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_never_used.rs new file mode 100644 index 0000000000..a6117786c0 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/compile-fail/static_never_used.rs @@ -0,0 +1,10 @@ +// error-pattern:static item is never used: `UNUSED` +#![deny(dead_code)] +#[macro_use] +extern crate lazy_static; + +lazy_static! { + static ref UNUSED: () = (); +} + +fn main() { } diff --git a/src/vendor/lazy_static-0.2.11/tests/compile_tests.rs b/src/vendor/lazy_static-0.2.11/tests/compile_tests.rs new file mode 100644 index 0000000000..3e347d5231 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/compile_tests.rs @@ -0,0 +1,18 @@ +#![cfg(feature="compiletest")] +extern crate compiletest_rs as compiletest; + +fn run_mode(mode: &'static str) { + let mut config = compiletest::Config::default(); + config.mode = mode.parse().expect("Invalid mode"); + config.src_base = ["tests", mode].iter().collect(); + config.target_rustcflags = Some("-L target/debug/ -L target/debug/deps/".to_owned()); + + config.verbose = true; + + compiletest::run_tests(&config); +} + +#[test] +fn compile_test() { + run_mode("compile-fail"); +} diff --git a/src/vendor/lazy_static-0.2.11/tests/no_std.rs b/src/vendor/lazy_static-0.2.11/tests/no_std.rs new file mode 100644 index 0000000000..b460e79328 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/no_std.rs @@ -0,0 +1,21 @@ +#![cfg(feature="spin_no_std")] +#![feature(const_fn)] + +#![no_std] + +#[macro_use] +extern crate lazy_static; + +lazy_static! { + /// Documentation! + pub static ref NUMBER: u32 = times_two(3); +} + +fn times_two(n: u32) -> u32 { + n * 2 +} + +#[test] +fn test_basic() { + assert_eq!(*NUMBER, 6); +} diff --git a/src/vendor/lazy_static-0.2.11/tests/test.rs b/src/vendor/lazy_static-0.2.11/tests/test.rs new file mode 100644 index 0000000000..fbf225d859 --- /dev/null +++ b/src/vendor/lazy_static-0.2.11/tests/test.rs @@ -0,0 +1,164 @@ +#![cfg_attr(feature="nightly", feature(const_fn))] + +#[macro_use] +extern crate lazy_static; +use std::collections::HashMap; + +lazy_static! { + /// Documentation! + pub static ref NUMBER: u32 = times_two(3); + + static ref ARRAY_BOXES: [Box; 3] = [Box::new(1), Box::new(2), Box::new(3)]; + + /// More documentation! + #[allow(unused_variables)] + #[derive(Copy, Clone, Debug)] + pub static ref STRING: String = "hello".to_string(); + + static ref HASHMAP: HashMap = { + let mut m = HashMap::new(); + m.insert(0, "abc"); + m.insert(1, "def"); + m.insert(2, "ghi"); + m + }; + + // This should not compile if the unsafe is removed. + static ref UNSAFE: u32 = unsafe { + std::mem::transmute::(-1) + }; +} + +lazy_static! { + static ref S1: &'static str = "a"; + static ref S2: &'static str = "b"; +} +lazy_static! { + static ref S3: String = [*S1, *S2].join(""); +} + +#[test] +fn s3() { + assert_eq!(&*S3, "ab"); +} + +fn times_two(n: u32) -> u32 { + n * 2 +} + +#[test] +fn test_basic() { + assert_eq!(&**STRING, "hello"); + assert_eq!(*NUMBER, 6); + assert!(HASHMAP.get(&1).is_some()); + assert!(HASHMAP.get(&3).is_none()); + assert_eq!(&*ARRAY_BOXES, &[Box::new(1), Box::new(2), Box::new(3)]); + assert_eq!(*UNSAFE, std::u32::MAX); +} + +#[test] +fn test_repeat() { + assert_eq!(*NUMBER, 6); + assert_eq!(*NUMBER, 6); + assert_eq!(*NUMBER, 6); +} + +#[test] +fn test_meta() { + // this would not compile if STRING were not marked #[derive(Copy, Clone)] + let copy_of_string = STRING; + // just to make sure it was copied + assert!(&STRING as *const _ != ©_of_string as *const _); + + // this would not compile if STRING were not marked #[derive(Debug)] + assert_eq!(format!("{:?}", STRING), "STRING { __private_field: () }".to_string()); +} + +mod visibility { + lazy_static! { + pub static ref FOO: Box = Box::new(0); + static ref BAR: Box = Box::new(98); + } + + pub mod inner { + lazy_static! { + pub(in visibility) static ref BAZ: Box = Box::new(42); + pub(crate) static ref BAG: Box = Box::new(37); + } + } + + #[test] + fn sub_test() { + assert_eq!(**FOO, 0); + assert_eq!(**BAR, 98); + assert_eq!(**inner::BAZ, 42); + assert_eq!(**inner::BAG, 37); + } +} + +#[test] +fn test_visibility() { + assert_eq!(*visibility::FOO, Box::new(0)); + assert_eq!(*visibility::inner::BAG, Box::new(37)); +} + +// This should not cause a warning about a missing Copy implementation +lazy_static! { + pub static ref VAR: i32 = { 0 }; +} + +#[derive(Copy, Clone, Debug, PartialEq)] +struct X; +struct Once(X); +const ONCE_INIT: Once = Once(X); +static DATA: X = X; +static ONCE: X = X; +fn require_sync() -> X { X } +fn transmute() -> X { X } +fn __static_ref_initialize() -> X { X } +fn test(_: Vec) -> X { X } + +// All these names should not be shadowed +lazy_static! { + static ref ITEM_NAME_TEST: X = { + test(vec![X, Once(X).0, ONCE_INIT.0, DATA, ONCE, + require_sync(), transmute(), + // Except this, which will sadly be shadowed by internals: + // __static_ref_initialize() + ]) + }; +} + +#[test] +fn item_name_shadowing() { + assert_eq!(*ITEM_NAME_TEST, X); +} + +use std::sync::atomic::AtomicBool; +use std::sync::atomic::ATOMIC_BOOL_INIT; +use std::sync::atomic::Ordering::SeqCst; + +static PRE_INIT_FLAG: AtomicBool = ATOMIC_BOOL_INIT; + +lazy_static! { + static ref PRE_INIT: () = { + PRE_INIT_FLAG.store(true, SeqCst); + () + }; +} + +#[test] +fn pre_init() { + assert_eq!(PRE_INIT_FLAG.load(SeqCst), false); + lazy_static::initialize(&PRE_INIT); + assert_eq!(PRE_INIT_FLAG.load(SeqCst), true); +} + +lazy_static! { + static ref LIFETIME_NAME: for<'a> fn(&'a u8) = { fn f(_: &u8) {} f }; +} + +#[test] +fn lifetime_name() { + let _ = LIFETIME_NAME; +} diff --git a/src/vendor/lazy_static/.cargo-checksum.json b/src/vendor/lazy_static/.cargo-checksum.json index c015cef77b..0d2a2a12a1 100644 --- a/src/vendor/lazy_static/.cargo-checksum.json +++ b/src/vendor/lazy_static/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"ee9afa8d5e10d088632b66c622d4451a826a4066e0e84052f40b9b3e82c6bec7",".travis.yml":"a1cad0121fd4c6507c8b709fee344367ea73eff40915c2fd6a6108762c84f8f2","Cargo.toml":"b598bd90e0cda5d1d3cec4042310a9e74afbe398a76af48e0d43ea5d3c51f137","Cargo.toml.orig":"ce52e452ff2eb6845fa554f9c18c890a41ee6aec6f090d940252d8dac68d7977","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"c305f498e6d89730d84eaf92e980ba001e259dd40fcb40855947baece2af0895","appveyor.yml":"68c8ff7090ffdfa42b3d65b841d5de67d47a2206e02bf97aaca34b4500ae4bf1","src/core_lazy.rs":"2cea85ad0c2c4f88a5a927815a59270411daa4075510fad0faf671d5f5130fed","src/lazy.rs":"52912a897e8fcc95672e3b3068be82d56548f422edcb60e6ce9570779acb5bc0","src/lib.rs":"facd354cb716ee6941bf9bc8d34c27a2ecd752746c4d5164dbec8cedd80df605","src/nightly_lazy.rs":"34080822b27f3968c872867131448df76acc5aeff259852ff86f6e73b5a913b6","tests/compile-fail/README.md":"296216a459b7bf9947ba540c94b71a48ec90c2632ef5f05248a01dc8611ae149","tests/compile-fail/incorrect_visibility_restriction.rs":"557c94f781d6a2fb6c4be32a2ea252752195ff7b7c889581d95c39f2ce45e7d3","tests/compile-fail/static_is_private.rs":"f778f0759529b2dc8360f9abad1e09ea6662493493d707b3fba6cb1cb3d94af2","tests/compile-fail/static_is_sized.rs":"3b6d632f764ccee5fbd413324d7daeb2ab52dec0c99ea1db11a7eb2bbcad37cb","tests/compile-fail/static_never_used.rs":"5139e2459b4c68b0ed3f5a04452f60895b076acb1b5f344fb6b8ccbd50283a2d","tests/compile_tests.rs":"5710b2c0edc7623b895d67c26180a6c1d4022c154ecd616fab449afc9ba95109","tests/no_std.rs":"2a5236bd3892a253855b4dc192f63138239165fa23b9c3421a9faa5482c780aa","tests/test.rs":"12b100f4790037ca049692d896114d6361373c5321c29e0032c290ee39f1042c"},"package":"76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"ee9afa8d5e10d088632b66c622d4451a826a4066e0e84052f40b9b3e82c6bec7",".travis.yml":"a1cad0121fd4c6507c8b709fee344367ea73eff40915c2fd6a6108762c84f8f2","Cargo.toml":"948510703c4dff2463a2d627d5b8a66d07feafa2b81f4bf7f64dd358d0965ec7","Cargo.toml.orig":"f1817be2c2f611b829bb3292b9987abcbedaddb286ddf7e95ae3ccf85a2e3d75","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"7daae430cf5936e151386856293024e1466cddf62f27a9ff7ee3ef1511698514","appveyor.yml":"68c8ff7090ffdfa42b3d65b841d5de67d47a2206e02bf97aaca34b4500ae4bf1","src/core_lazy.rs":"f20f2fc2bb751cf74622b05ec44675b6a29bfaa67d91a2e55485c665647d2904","src/lazy.rs":"a62cc96b7177a68b25e993592b08a6c706e9020fd565a55afa1fb657efa4052c","src/lib.rs":"7bb7cc7c3f7691f53ce7a6b61c442ffa84472a0b58713e56cf7e044d41c14c6a","src/nightly_lazy.rs":"f930f393f1d35de3336d7f3b554dd54420c8d9fad195ca99ff5a6f91b15e4e7e","tests/compile-fail/README.md":"296216a459b7bf9947ba540c94b71a48ec90c2632ef5f05248a01dc8611ae149","tests/compile-fail/incorrect_visibility_restriction.rs":"557c94f781d6a2fb6c4be32a2ea252752195ff7b7c889581d95c39f2ce45e7d3","tests/compile-fail/static_is_private.rs":"f778f0759529b2dc8360f9abad1e09ea6662493493d707b3fba6cb1cb3d94af2","tests/compile-fail/static_is_sized.rs":"3b6d632f764ccee5fbd413324d7daeb2ab52dec0c99ea1db11a7eb2bbcad37cb","tests/compile-fail/static_never_used.rs":"5139e2459b4c68b0ed3f5a04452f60895b076acb1b5f344fb6b8ccbd50283a2d","tests/compile_tests.rs":"5710b2c0edc7623b895d67c26180a6c1d4022c154ecd616fab449afc9ba95109","tests/no_std.rs":"2a5236bd3892a253855b4dc192f63138239165fa23b9c3421a9faa5482c780aa","tests/test.rs":"12b100f4790037ca049692d896114d6361373c5321c29e0032c290ee39f1042c"},"package":"c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"} \ No newline at end of file diff --git a/src/vendor/lazy_static/Cargo.toml b/src/vendor/lazy_static/Cargo.toml index c25a8a1850..35b35c5f17 100644 --- a/src/vendor/lazy_static/Cargo.toml +++ b/src/vendor/lazy_static/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "lazy_static" -version = "0.2.11" +version = "1.0.0" authors = ["Marvin Löbel "] description = "A macro for declaring lazily evaluated statics in Rust." documentation = "https://docs.rs/lazy_static" @@ -36,6 +36,12 @@ spin_no_std = ["nightly", "spin"] [badges.appveyor] repository = "rust-lang-nursery/lazy-static.rs" +[badges.is-it-maintained-issue-resolution] +repository = "rust-lang-nursery/lazy-static.rs" + +[badges.is-it-maintained-open-issues] +repository = "rust-lang-nursery/lazy-static.rs" + [badges.maintenance] status = "passively-maintained" diff --git a/src/vendor/lazy_static/Cargo.toml.orig b/src/vendor/lazy_static/Cargo.toml.orig index 477c1aec3e..eba4bd4200 100644 --- a/src/vendor/lazy_static/Cargo.toml.orig +++ b/src/vendor/lazy_static/Cargo.toml.orig @@ -1,7 +1,7 @@ [package] name = "lazy_static" # NB: When modifying, also modify html_root_url in lib.rs -version = "0.2.11" +version = "1.0.0" authors = ["Marvin Löbel "] license = "MIT/Apache-2.0" @@ -30,7 +30,7 @@ compiletest = ["compiletest_rs"] appveyor = { repository = "rust-lang-nursery/lazy-static.rs" } travis-ci = { repository = "rust-lang-nursery/lazy-static.rs" } -# is-it-maintained-issue-resolution = { repository = "rust-lang-nursery/lazy-static.rs" } -# is-it-maintained-open-issues = { repository = "rust-lang-nursery/lazy-static.rs" } +is-it-maintained-issue-resolution = { repository = "rust-lang-nursery/lazy-static.rs" } +is-it-maintained-open-issues = { repository = "rust-lang-nursery/lazy-static.rs" } maintenance = { status = "passively-maintained" } diff --git a/src/vendor/lazy_static/README.md b/src/vendor/lazy_static/README.md index ad5380ee1b..2cd30d0467 100644 --- a/src/vendor/lazy_static/README.md +++ b/src/vendor/lazy_static/README.md @@ -21,7 +21,7 @@ Add the following dependency to your Cargo manifest... ```toml [dependencies] -lazy_static = "0.2" +lazy_static = "1.0" ``` ...and see the [docs](https://docs.rs/lazy_static) for how to use it. diff --git a/src/vendor/lazy_static/src/core_lazy.rs b/src/vendor/lazy_static/src/core_lazy.rs index 90c7aaa9a5..ba496a68b6 100644 --- a/src/vendor/lazy_static/src/core_lazy.rs +++ b/src/vendor/lazy_static/src/core_lazy.rs @@ -26,6 +26,7 @@ impl Lazy { } #[macro_export] +#[doc(hidden)] macro_rules! __lazy_static_create { ($NAME:ident, $T:ty) => { static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::new(); diff --git a/src/vendor/lazy_static/src/lazy.rs b/src/vendor/lazy_static/src/lazy.rs index aab1e0571a..6fd490728e 100644 --- a/src/vendor/lazy_static/src/lazy.rs +++ b/src/vendor/lazy_static/src/lazy.rs @@ -32,6 +32,7 @@ impl Lazy { unsafe impl Sync for Lazy {} #[macro_export] +#[doc(hidden)] macro_rules! __lazy_static_create { ($NAME:ident, $T:ty) => { static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(0 as *const $T, $crate::lazy::ONCE_INIT); diff --git a/src/vendor/lazy_static/src/lib.rs b/src/vendor/lazy_static/src/lib.rs index bb15478d3c..2e3682181e 100644 --- a/src/vendor/lazy_static/src/lib.rs +++ b/src/vendor/lazy_static/src/lib.rs @@ -86,14 +86,24 @@ fn main() { # Implementation details -The `Deref` implementation uses a hidden static variable that is guarded by a atomic check on each access. On stable Rust, the macro may need to allocate each static on the heap. +The `Deref` implementation uses a hidden static variable that is guarded by a atomic check on each access. + +# Cargo features + +This crate provides two cargo features: + +- `nightly`: This uses unstable language features only available on the nightly release channel for a more optimal implementation. In practice this currently means avoiding a heap allocation per static. This feature might get deprecated at a later point once all relevant optimizations are usable from stable. +- `spin_no_std` (implies `nightly`): This allows using this crate in a no-std environment, by depending on the standalone `spin` crate. + +Both features depend on unstable language features, which means +no guarantees can be made about them in regard to SemVer stability. */ #![cfg_attr(feature="spin_no_std", feature(const_fn))] #![cfg_attr(feature="nightly", feature(unreachable))] -#![doc(html_root_url = "https://docs.rs/lazy_static/0.2.11")] +#![doc(html_root_url = "https://docs.rs/lazy_static/1.0.0")] #![no_std] #[cfg(not(feature="nightly"))] diff --git a/src/vendor/lazy_static/src/nightly_lazy.rs b/src/vendor/lazy_static/src/nightly_lazy.rs index 0ad0f66e7c..723222a95d 100644 --- a/src/vendor/lazy_static/src/nightly_lazy.rs +++ b/src/vendor/lazy_static/src/nightly_lazy.rs @@ -36,6 +36,7 @@ impl Lazy { unsafe impl Sync for Lazy {} #[macro_export] +#[doc(hidden)] macro_rules! __lazy_static_create { ($NAME:ident, $T:ty) => { static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(None, $crate::lazy::ONCE_INIT); diff --git a/src/vendor/libc/.cargo-checksum.json b/src/vendor/libc/.cargo-checksum.json index 7cea176e7d..2967737330 100644 --- a/src/vendor/libc/.cargo-checksum.json +++ b/src/vendor/libc/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7150ee9391a955b2ef7e0762fc61c0c1aab167620ca36d88d78062d93b8334ba",".travis.yml":"d323dad8a4a6a7f88471a3a671478ee56ef1a6b26472358650a0e7597b239c65","Cargo.toml":"3642623f8dc43de106c0f1e53ba38c09a06e709713360ac45ab661bab95527ed","Cargo.toml.orig":"f611a9760e91e0c79c144bb8fc1e6943534ec0d08329dbe3eadede19ae211c2d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"00fbfd7e989de6ecc270aed1f1c2c20560ac67e6c1564833622b8e34385c6170","appveyor.yml":"fec0ac820d19c40534301966f82524372e4855e4f61eeec486d42bf850d77f71","ci/README.md":"b8debdd9044a773dbccc85e574eed21008784117d77c24a15f207d4b2a173a14","ci/android-install-ndk.sh":"725db9025c5905849916bf7c910f98ff0e753484397c2a1f836d48a576d10890","ci/android-install-sdk.sh":"5c3fbe402ac611239ac7715a61f247d1c55fa012f33a5be0b0127dfc196965cf","ci/android-sysimage.sh":"901415631752827454c827e8c51906ba4260612e4021eda98eb7fff771c7d0e8","ci/docker/aarch64-linux-android/Dockerfile":"e17945fba1786dfe766006f50e79baf3f4151ca0c0c14ae96f91483bf345afd7","ci/docker/aarch64-unknown-linux-gnu/Dockerfile":"5f430271941e1eecdf9d1a5fb701dd5622e2c4b9da03140fd829bf216e55529d","ci/docker/aarch64-unknown-linux-musl/Dockerfile":"3e1cbf0fa728571b9be9769e5a6281c964fa5b26d586265117ccee017ca4022c","ci/docker/arm-linux-androideabi/Dockerfile":"4e0bdc13254f99bd0db195f91331c634050426e3e4a0fcc63ef25ab795fe2d46","ci/docker/arm-unknown-linux-gnueabihf/Dockerfile":"dbb025b53b27e406893184290836a50133ecae8295711d5e05b4e41fac9bd262","ci/docker/arm-unknown-linux-musleabihf/Dockerfile":"7cb6e0f8fb91c97f142a9c827687bbbc1a5e7643a3081160025d0365593a596c","ci/docker/asmjs-unknown-emscripten/Dockerfile":"0d9aea5119c2cd136cc2c0a578105d91210e45901ac49b17c5e45f458b1c7551","ci/docker/i686-linux-android/Dockerfile":"4e8377ec0bd9ad2df23bf2c5373200a12750dc9f28c4f10bc83a0150fe1623ee","ci/docker/i686-unknown-linux-gnu/Dockerfile":"ca61f403bd3eaec7f3e51165ae7f74cd559a65ce657aed4700d726a2aabea648","ci/docker/i686-unknown-linux-musl/Dockerfile":"4ac86fe9e159d454616396a9f3f07ce0f5d99cc4b49898b8d2486e6bdbfed9e9","ci/docker/mips-unknown-linux-gnu/Dockerfile":"6d2a9daa299003497c1d441d07b69f730ad75ee49f34520f959b5158e60072e0","ci/docker/mips-unknown-linux-musl/Dockerfile":"4773b2656a7dd6a3b106fcb737428436652edf3d1f48181de3f62c16bf5bd49d","ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile":"7c4d26232f1c1553a6612d9b0b3faac9887e139eaffa025f70d34113dcee812f","ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile":"edb4144c07ade1a8bd65272ec1d3672ad794e9e6b7d01197896e159a70175b58","ci/docker/mipsel-unknown-linux-musl/Dockerfile":"0ca9c12b5618c6d2df04ff820d56fb28e05b43e45eaa506480126b03c5072d48","ci/docker/powerpc-unknown-linux-gnu/Dockerfile":"4b247dcc399395815ec9153c1247cc03d764896c484eddcb196d0bf8650d6311","ci/docker/powerpc64-unknown-linux-gnu/Dockerfile":"e949717a8ba5e123940729ff47ce1c45989c8b8247c576f1488f698b534e0283","ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile":"018591017f499414a9f79477e1c39baa6a47f71fce6812fb1868fb0fcdfb8cea","ci/docker/s390x-unknown-linux-gnu/Dockerfile":"63bb605e333b8351ee2366def0cfb77f206c66f43bc2d5d9ca18ee0119fa5672","ci/docker/sparc64-unknown-linux-gnu/Dockerfile":"6eae4d575de47aefc429dfb1957856bc7107fc7456883563acdfb9886154e5bb","ci/docker/wasm32-unknown-emscripten/Dockerfile":"bd072d6ae91a9160693e402dd77462d3c9dd0716711e719a62af330ae479eb4e","ci/docker/wasm32-unknown-emscripten/node-wrapper.sh":"6ec19745e08690b7b5d7f882004a8a63b69ac815d66e3f8c5a38d2c3e78b962e","ci/docker/x86_64-linux-android/Dockerfile":"aeeaa540189ca712369c564c9a14cbace63217dadcfaf879a2cb40fbdeb08199","ci/docker/x86_64-rumprun-netbsd/Dockerfile":"e8f9287b267c6058eec42d1bca0007cb9a78a1d244dd8e11088368cb61fb17d6","ci/docker/x86_64-rumprun-netbsd/runtest.rs":"53302e9ed39293c1ec68ab56287593907d4aaf5bac9c1c2857b29f754a71d62b","ci/docker/x86_64-unknown-freebsd/Dockerfile":"dfc00fa7d5dbb24e6864fb62cdbd48536c14c0be2d40fd02de53d1374e4b760a","ci/docker/x86_64-unknown-linux-gnu/Dockerfile":"342e16d6d1dd3c23b735b0705aa04e48261401746edcf24170910d5650eeda56","ci/docker/x86_64-unknown-linux-gnux32/Dockerfile":"ca61f403bd3eaec7f3e51165ae7f74cd559a65ce657aed4700d726a2aabea648","ci/docker/x86_64-unknown-linux-musl/Dockerfile":"e145784741473150473b1bef7cc3c2cf0c6339d4fc480113ac41b4247a9b38ec","ci/dox.sh":"9ea240a4a607036235fd68c01b5d2a59f365768d103d3be774dcf34aa3ff563e","ci/emscripten-entry.sh":"1c1384b4a8b0c055d8095d9d9b2c9dccbdcdb2d5f90fdca34a1976ca8fc379c6","ci/emscripten.sh":"6f66c7b5c3d34a41afc59ceb0a8c3b0880cd6fd9a6344b874ae80bac0639ccb2","ci/ios/deploy_and_run_on_ios_simulator.rs":"3175066fd7f82390f6226d881e1a1dda9767ea2705656870e0d7774e2731800e","ci/landing-page-footer.html":"b70b3112c2147f5c967e7481061ef38bc2d79a28dd55a16fb916d9c9426da2c4","ci/landing-page-head.html":"ad69663fac7924f27d0209bc519d55838e86edfc4133713a6fd08caadac1b142","ci/run-docker.sh":"be83bc5a8b5ef913a7c9941ffca24734716028650c9a876123c4c160672c18de","ci/run-qemu.sh":"bb859421170871ef23a8940c5e150efec0c01b95e32d2ce2d37b79a45d9d346c","ci/run.sh":"f78a0aff66c19002b9a39ef557adb28dcf0a73e18c3eb4934943a4745df8b8fa","ci/runtest-android.rs":"a07ddbdd276aedda7876c7e676774178a60d9aeab95df01275a4ee95f59e3044","ci/style.rs":"60564abc1d5197ed1598426dd0d6ee9939a16d2875b03373538f58843bb616c4","src/dox.rs":"a2b4907054e260e2db31415379d4db87acd91a8d02fb2178679628079910404f","src/lib.rs":"5f6bee7224a6131862e6cba9dfff57a6340329694b97da9d9f30a668271c0f78","src/macros.rs":"e1b0bf5db89faa8fcb39a3fd46cdb5fdcfabb7f3524eb2192157f0188b8a764b","src/redox/mod.rs":"07ae6652bc6f7fe276255bda210eae7a197d3d64d9dede6dadce0478e8890e2b","src/redox/net.rs":"a1e9d2291e2c12833333ac8706b23f388ce5dbe1718bdd7b38fd68c74559f0b4","src/unix/bsd/apple/b32.rs":"d107376452f731f5d8a1e6b544bdcaac826c95a383d4b20e2032f115eb9f3256","src/unix/bsd/apple/b64.rs":"ab141ad0c8c58342c06858f6f34b75eef70e58cb58e7375d460a9be6739b5e6a","src/unix/bsd/apple/mod.rs":"a7e48a4e3edb132c433e76a3f60f85ae2fd3f28f48e79b41f7461076c7233859","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"62689b8aa80d308d425385daf9b4ea2ed20b19e0590dc57b6efa08b266945bbd","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/freebsd/mod.rs":"9a8cb662cb2cbe5facba1b3519748f657b18b3eee30fa43b75125012745a5cb1","src/unix/bsd/freebsdlike/freebsd/x86.rs":"54311d3ebf2bb091ab22361e377e6ef9224aec2ecfe459fbfcedde4932db9c58","src/unix/bsd/freebsdlike/freebsd/x86_64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/mod.rs":"c9895c61e4b01f0b397cbd9d40c977e71774888cad85455bbb23eded85311284","src/unix/bsd/mod.rs":"1546c73fd87103a7282c3ceaa2d1e55f91b8bab2ec705c733351f715722e6b2f","src/unix/bsd/netbsdlike/mod.rs":"edbc1ff82f6a71999cc8664a4e10e43302d33f93b925649b52d97be3821c63d5","src/unix/bsd/netbsdlike/netbsd/mod.rs":"a20d0283670a6a700fa56d12c8a4285ff75ae5a2603706bc17c4cf9799ffd8c3","src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/netbsd/other/mod.rs":"4d9f7091af8e166943ac6f42ce85558909e5b6e61325039bff7adfbcf4b90212","src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs":"f8cd05dacd3a3136c58da5a2fbe26f703767823b28e74fe8a2b57a7bd98d6d5c","src/unix/bsd/netbsdlike/openbsdlike/mod.rs":"3ba4790618db8308e74f8fec16587ae7d584773eefb619948a25a7330b832b3f","src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs":"302817036aa7e7afbc82248cf66b040ef1edfbcb136c9ad243fe20f98df8d6f8","src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs":"f5d8db6f54efd05520b31b764a6bacbf612e1aebce097d2d5bfaaef3b91f37b5","src/unix/haiku/b32.rs":"69ae47fc52c6880e85416b4744500d5655c9ec6131cb737f3b649fceaadce15a","src/unix/haiku/b64.rs":"73e64db09275a8da8d50a13cce2cfa2b136036ddf3a930d2939f337fc995900b","src/unix/haiku/mod.rs":"f3c940954b2a404e07afc512e78b4e496628b9a9036bd9221ee265b67c618f16","src/unix/mod.rs":"1d95051294ac738f852fc6bb85921618efd911b5772a321f7465a73dabb930e9","src/unix/newlib/arm/mod.rs":"2b6dba2e697ab9b4f4bc4dd5f28057249e9b596d1cb395a9322ec87605c4a5c4","src/unix/newlib/mod.rs":"49227cd0ec18911a91b6ab8a278da3b430321c562b393fbfac92edd354b0a7ee","src/unix/notbsd/android/b32/arm.rs":"3625a32c7e58cfe683a53486fbe3d42d4e28f00bea31e19cb46ed2bb0b6a140b","src/unix/notbsd/android/b32/mod.rs":"e9ec6f08e20ea235cd7095604ea6e37c739c1276e9f40fa31a4db4951fa005af","src/unix/notbsd/android/b32/x86.rs":"ae2b7f1d6278caddc007749bb1d09ca33f7593478a0fd7fe98b457dae86c7814","src/unix/notbsd/android/b64/aarch64.rs":"63d65629d79371814910f691672ef593d20244ee09be26f1ebe07ee6212d0163","src/unix/notbsd/android/b64/mod.rs":"63290adc8122c040f9be369ef4180975bcf1a967a717aa75d30371162d5d5fa9","src/unix/notbsd/android/b64/x86_64.rs":"5547aef8dcbaa5a932559f34606fd8d89f6c9c15173d2b1412c12d39b3c1045f","src/unix/notbsd/android/mod.rs":"7fa19bd63dc3582f12769be51e9a1b355d24744e17ea9aef67380f535b58e2b1","src/unix/notbsd/emscripten.rs":"f8d8acf5cef1acd1a6bdd41299054120820865d072c4c2e3c740fbd0c6e9b3e7","src/unix/notbsd/linux/mips/mips32.rs":"f769bbe5c48f77e6bc94e37deccd2866e7e52e7eb1b3cd7611dbad95574e82f8","src/unix/notbsd/linux/mips/mips64.rs":"ef678b48b571428d46fef5b2ca9bef7251b5f27fcd2c38d987d1b80f2ad3ece0","src/unix/notbsd/linux/mips/mod.rs":"515eb57ee1798fadb6654ce845fb49098593815c2130a30010959f36565e65f9","src/unix/notbsd/linux/mod.rs":"1e1a96e85a9ffcd618f7b459ef2a2ccf9487b3eb97c74cff6c7ce83bb115815e","src/unix/notbsd/linux/musl/b32/arm.rs":"d2998b13648696304bb34f0793715d821178baf8e88a45b532764a20b5294232","src/unix/notbsd/linux/musl/b32/mips.rs":"340be794362a4532d709ef23542b10762f710f7bfd0c4fafa5166a3fb9a15b4f","src/unix/notbsd/linux/musl/b32/mod.rs":"3cc7979546258a47df6b0fcd7ad64571826623671857633a7acafe87e05e56a1","src/unix/notbsd/linux/musl/b32/x86.rs":"df114102dcf35bc32f891d4a9e09ce02fbe4c096a196c6b98b10ff87b29dbe4d","src/unix/notbsd/linux/musl/b64/aarch64.rs":"12c590fde2a1450c08934234c4f5bcd94ee7b58ca21f8e93bc930148c15fb0b0","src/unix/notbsd/linux/musl/b64/mod.rs":"b1991ef46a00d2db7ce3e36f6596685c1d508786c4dd4e62cbbf65ac3c256cc0","src/unix/notbsd/linux/musl/b64/powerpc64.rs":"239c5754811e2d75723bd0d540e732630c9817c5f24513d1f02b63e6b27a3a57","src/unix/notbsd/linux/musl/b64/x86_64.rs":"bf8fc10a09bf700084db0381c484ddec3add79aa1726954cb14d21802ff7d199","src/unix/notbsd/linux/musl/mod.rs":"60cf407596bc7b369d2e6a4d8f2e821d203f6a4284cc5e71312d1fb141a81f1d","src/unix/notbsd/linux/other/b32/arm.rs":"d9892f7350b2978335f734f1cd2d7fed60f0f2e66aa05bee3f69549c031f8b14","src/unix/notbsd/linux/other/b32/mod.rs":"ea91ffe90cd71d45a6e00e7d001cfcfafc8a840aa2b372078798b160968bdaf6","src/unix/notbsd/linux/other/b32/powerpc.rs":"253fcd2f9978525285be1903cc08f3fec2dc3b12d1660a33e2995b4f6b810d1c","src/unix/notbsd/linux/other/b32/x86.rs":"49376e3ed0f3ff95c230ac20751911fe3c608dfe15c7c118b069fd7a954d8db9","src/unix/notbsd/linux/other/b64/aarch64.rs":"cd04a0c1f8d090753600143495b975d8fa4eacc96fc6eeacd8f378ba70d8c838","src/unix/notbsd/linux/other/b64/mod.rs":"63e1a3fdf5f4d1b9820934ab344c91aed5e458e7e05908535d2e942d51a08bf8","src/unix/notbsd/linux/other/b64/not_x32.rs":"e1cf87b9dbe89e9fff667c6fc8eff0166a02565ef65aae3dc9304dc70f7a5624","src/unix/notbsd/linux/other/b64/powerpc64.rs":"25de66d04d2200f00a2e6e0eb97484b43c466897cc789598c728323ee311000b","src/unix/notbsd/linux/other/b64/sparc64.rs":"f26439fa0506ffc5efb0314fcef63cd69964bb5602baec2a0bd1439444dac5e3","src/unix/notbsd/linux/other/b64/x32.rs":"e521bd43a2d66f09f03a045b2e1f69f2ca91cff37922ac5b7c437d888799cee6","src/unix/notbsd/linux/other/b64/x86_64.rs":"924d0282f549507ce46bddc4ac2c489641f883c0620438eea1f6d9fbbbdbbe4b","src/unix/notbsd/linux/other/mod.rs":"5b62146535521c1e7730ea7cba53fd9285831616318abcf5134af992d6cca4a3","src/unix/notbsd/linux/s390x.rs":"f11f595427393a90803a180fa9ca77b048d1d76da0634b92f4b038db07f5623b","src/unix/notbsd/mod.rs":"d2643df7dc6c4affb0ea43ff4471558df317e788942dfde5096c2479f6d42f08","src/unix/solaris/mod.rs":"972b7847f7a67135a93f7604928645103e13f2cf00d1b8bc82994a620101a145","src/unix/uclibc/mips/mips32.rs":"31b23e466cffb86116421ec9240b86e7419aacd84b0b1b04d23c7142c8717566","src/unix/uclibc/mips/mips64.rs":"e67eec1636a998b047d89a4cda1c99cb6bc3071db017762675179a68201c4438","src/unix/uclibc/mips/mod.rs":"74817a9b1ee3998d8e0b751a555d57225f70fd979c283c94ada344a162a8b856","src/unix/uclibc/mod.rs":"89429fbdca93bcdd84a35a36583a143dd67d3e282d7dcb6b7f73fd9a9c038108","src/unix/uclibc/x86_64/l4re.rs":"54b4e58ce5a671348c32bc41c1607dbc5c13fa6818cc3e0e0e2b409c300a305e","src/unix/uclibc/x86_64/mod.rs":"bd569360c45a6f2b585cfb47544d223e92243a2ff4f8429b78fecac6b889f9fd","src/windows.rs":"e41357d610608bad81abf285306ad8b127b6f02d5132f63c4942861980b47d59"},"package":"5ba3df4dcb460b9dfbd070d41c94c19209620c191b0340b929ce748a2bcd42d2"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7150ee9391a955b2ef7e0762fc61c0c1aab167620ca36d88d78062d93b8334ba",".travis.yml":"88c852e2bb7718702c73107cef9168fdb68722d45e4b2ba28c2f4a9221caa41c","Cargo.toml":"aa734f5b05557b186be6f25e5e406865c1545d732613213508dd78e591bbdc4e","Cargo.toml.orig":"b1d23a88ec6b227041dc3eb2c60f7de2e8075f56189bcd25dc18a0e5245503af","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"00fbfd7e989de6ecc270aed1f1c2c20560ac67e6c1564833622b8e34385c6170","appveyor.yml":"fec0ac820d19c40534301966f82524372e4855e4f61eeec486d42bf850d77f71","ci/README.md":"b8debdd9044a773dbccc85e574eed21008784117d77c24a15f207d4b2a173a14","ci/android-install-ndk.sh":"725db9025c5905849916bf7c910f98ff0e753484397c2a1f836d48a576d10890","ci/android-install-sdk.sh":"5c3fbe402ac611239ac7715a61f247d1c55fa012f33a5be0b0127dfc196965cf","ci/android-sysimage.sh":"901415631752827454c827e8c51906ba4260612e4021eda98eb7fff771c7d0e8","ci/docker/aarch64-linux-android/Dockerfile":"e17945fba1786dfe766006f50e79baf3f4151ca0c0c14ae96f91483bf345afd7","ci/docker/aarch64-unknown-linux-gnu/Dockerfile":"5f430271941e1eecdf9d1a5fb701dd5622e2c4b9da03140fd829bf216e55529d","ci/docker/aarch64-unknown-linux-musl/Dockerfile":"3e1cbf0fa728571b9be9769e5a6281c964fa5b26d586265117ccee017ca4022c","ci/docker/arm-linux-androideabi/Dockerfile":"4e0bdc13254f99bd0db195f91331c634050426e3e4a0fcc63ef25ab795fe2d46","ci/docker/arm-unknown-linux-gnueabihf/Dockerfile":"dbb025b53b27e406893184290836a50133ecae8295711d5e05b4e41fac9bd262","ci/docker/arm-unknown-linux-musleabihf/Dockerfile":"7cb6e0f8fb91c97f142a9c827687bbbc1a5e7643a3081160025d0365593a596c","ci/docker/asmjs-unknown-emscripten/Dockerfile":"0d9aea5119c2cd136cc2c0a578105d91210e45901ac49b17c5e45f458b1c7551","ci/docker/i686-linux-android/Dockerfile":"4e8377ec0bd9ad2df23bf2c5373200a12750dc9f28c4f10bc83a0150fe1623ee","ci/docker/i686-unknown-linux-gnu/Dockerfile":"ca61f403bd3eaec7f3e51165ae7f74cd559a65ce657aed4700d726a2aabea648","ci/docker/i686-unknown-linux-musl/Dockerfile":"4ac86fe9e159d454616396a9f3f07ce0f5d99cc4b49898b8d2486e6bdbfed9e9","ci/docker/mips-unknown-linux-gnu/Dockerfile":"6d2a9daa299003497c1d441d07b69f730ad75ee49f34520f959b5158e60072e0","ci/docker/mips-unknown-linux-musl/Dockerfile":"4773b2656a7dd6a3b106fcb737428436652edf3d1f48181de3f62c16bf5bd49d","ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile":"7c4d26232f1c1553a6612d9b0b3faac9887e139eaffa025f70d34113dcee812f","ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile":"edb4144c07ade1a8bd65272ec1d3672ad794e9e6b7d01197896e159a70175b58","ci/docker/mipsel-unknown-linux-musl/Dockerfile":"0ca9c12b5618c6d2df04ff820d56fb28e05b43e45eaa506480126b03c5072d48","ci/docker/powerpc-unknown-linux-gnu/Dockerfile":"4b247dcc399395815ec9153c1247cc03d764896c484eddcb196d0bf8650d6311","ci/docker/powerpc64-unknown-linux-gnu/Dockerfile":"e949717a8ba5e123940729ff47ce1c45989c8b8247c576f1488f698b534e0283","ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile":"018591017f499414a9f79477e1c39baa6a47f71fce6812fb1868fb0fcdfb8cea","ci/docker/s390x-unknown-linux-gnu/Dockerfile":"9860f478c5b2dc3bcf76d2cda7f71922a2a2ef54898cc2ed6ea9b9eff094a5c0","ci/docker/sparc64-unknown-linux-gnu/Dockerfile":"0c18141701e485c4559431e3e02f00124b91a2bff616d2863ce829cba1938a88","ci/docker/wasm32-unknown-emscripten/Dockerfile":"bd072d6ae91a9160693e402dd77462d3c9dd0716711e719a62af330ae479eb4e","ci/docker/wasm32-unknown-emscripten/node-wrapper.sh":"0eef37c3c4fb16dbc083148b7e7af45f2ae60bd9a1b3a77e1d43da79efbd30c6","ci/docker/x86_64-linux-android/Dockerfile":"aeeaa540189ca712369c564c9a14cbace63217dadcfaf879a2cb40fbdeb08199","ci/docker/x86_64-rumprun-netbsd/Dockerfile":"e8f9287b267c6058eec42d1bca0007cb9a78a1d244dd8e11088368cb61fb17d6","ci/docker/x86_64-rumprun-netbsd/runtest.rs":"53302e9ed39293c1ec68ab56287593907d4aaf5bac9c1c2857b29f754a71d62b","ci/docker/x86_64-unknown-freebsd/Dockerfile":"dfc00fa7d5dbb24e6864fb62cdbd48536c14c0be2d40fd02de53d1374e4b760a","ci/docker/x86_64-unknown-linux-gnu/Dockerfile":"342e16d6d1dd3c23b735b0705aa04e48261401746edcf24170910d5650eeda56","ci/docker/x86_64-unknown-linux-gnux32/Dockerfile":"ca61f403bd3eaec7f3e51165ae7f74cd559a65ce657aed4700d726a2aabea648","ci/docker/x86_64-unknown-linux-musl/Dockerfile":"e145784741473150473b1bef7cc3c2cf0c6339d4fc480113ac41b4247a9b38ec","ci/dox.sh":"9ea240a4a607036235fd68c01b5d2a59f365768d103d3be774dcf34aa3ff563e","ci/emscripten-entry.sh":"c97bbec520b57af9b1ae264ca991560e99c3852c99b00a2f673c614d1ba17498","ci/emscripten.sh":"6f66c7b5c3d34a41afc59ceb0a8c3b0880cd6fd9a6344b874ae80bac0639ccb2","ci/ios/deploy_and_run_on_ios_simulator.rs":"3175066fd7f82390f6226d881e1a1dda9767ea2705656870e0d7774e2731800e","ci/landing-page-footer.html":"b70b3112c2147f5c967e7481061ef38bc2d79a28dd55a16fb916d9c9426da2c4","ci/landing-page-head.html":"ad69663fac7924f27d0209bc519d55838e86edfc4133713a6fd08caadac1b142","ci/linux-s390x.sh":"d6b732d7795b4ba131326aff893bca6228a7d2eb0e9402f135705413dbbe0dce","ci/linux-sparc64.sh":"afe325f853481d9e18b0e5a376e4f987de7673066ec336ad56e26d929858b427","ci/run-docker.sh":"be83bc5a8b5ef913a7c9941ffca24734716028650c9a876123c4c160672c18de","ci/run-qemu.sh":"bb859421170871ef23a8940c5e150efec0c01b95e32d2ce2d37b79a45d9d346c","ci/run.sh":"c11c1d273ec6b0d72332bd833f3b137caaf69a197bd60b554bbcc4658654565e","ci/runtest-android.rs":"a07ddbdd276aedda7876c7e676774178a60d9aeab95df01275a4ee95f59e3044","ci/style.rs":"60564abc1d5197ed1598426dd0d6ee9939a16d2875b03373538f58843bb616c4","ci/test-runner-linux":"cb3713d9e4fa1d9a7c039dfd077af0939921c1f2bf969c9e680ee66e87dc30a4","src/dox.rs":"a2b4907054e260e2db31415379d4db87acd91a8d02fb2178679628079910404f","src/fuchsia/aarch64.rs":"8366ac6f51e494aad9266ccab2b3a95c5ed7aa3a9f77ea672413283440919743","src/fuchsia/mod.rs":"453282749eff25f6149db007e255f2cd9a7aa81dd435a62300b161f6f9e455fe","src/fuchsia/powerpc64.rs":"390e8db54271a1d5f512d54a21b328091a792378bf9b42b49b6c1a72388da4ec","src/fuchsia/x86_64.rs":"b4a3eff94dcf1ffe41e6500468ca2cff0e97ddbcc75fe079b6ac7adb1e493f56","src/lib.rs":"e644fda8892fb377e0ee112312b5f291c3b6239cbe1f989bc780cdacd8528fc3","src/macros.rs":"e1b0bf5db89faa8fcb39a3fd46cdb5fdcfabb7f3524eb2192157f0188b8a764b","src/redox/mod.rs":"07ae6652bc6f7fe276255bda210eae7a197d3d64d9dede6dadce0478e8890e2b","src/redox/net.rs":"a1e9d2291e2c12833333ac8706b23f388ce5dbe1718bdd7b38fd68c74559f0b4","src/unix/bsd/apple/b32.rs":"d107376452f731f5d8a1e6b544bdcaac826c95a383d4b20e2032f115eb9f3256","src/unix/bsd/apple/b64.rs":"ab141ad0c8c58342c06858f6f34b75eef70e58cb58e7375d460a9be6739b5e6a","src/unix/bsd/apple/mod.rs":"cdbf722cec4fb0b91b1ccce6e4d76caec432509831f792b7937b459587ec573a","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"3f15b1bb47c5ab5ab2ccba0355ed58e1f567a54b1a9668167f51e5d991fae115","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/freebsd/mod.rs":"da75e1a41666093b122b6bf971db232b08d6976632c9bc3b33a2784485ee59b1","src/unix/bsd/freebsdlike/freebsd/x86.rs":"54311d3ebf2bb091ab22361e377e6ef9224aec2ecfe459fbfcedde4932db9c58","src/unix/bsd/freebsdlike/freebsd/x86_64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/mod.rs":"95983883e2efb35f3173b222ce79bd10e44f5ac0589ab9f81d35e89ac56da930","src/unix/bsd/mod.rs":"1546c73fd87103a7282c3ceaa2d1e55f91b8bab2ec705c733351f715722e6b2f","src/unix/bsd/netbsdlike/mod.rs":"37aa5a0b68e803db481e2c252f027b85525dbae013046f6b7c67413051d0034e","src/unix/bsd/netbsdlike/netbsd/mod.rs":"4d6eba4f44b3f025e2fc368e140956a1fb724dc7b0540bb4acafcc93ec0a0cc1","src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/netbsd/other/mod.rs":"4d9f7091af8e166943ac6f42ce85558909e5b6e61325039bff7adfbcf4b90212","src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs":"f8cd05dacd3a3136c58da5a2fbe26f703767823b28e74fe8a2b57a7bd98d6d5c","src/unix/bsd/netbsdlike/openbsdlike/mod.rs":"7a73eef4d49a4aa71d8cb6d90f93810b7a52fedbff78df6180ab6170929a0f59","src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs":"302817036aa7e7afbc82248cf66b040ef1edfbcb136c9ad243fe20f98df8d6f8","src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs":"f5d8db6f54efd05520b31b764a6bacbf612e1aebce097d2d5bfaaef3b91f37b5","src/unix/haiku/b32.rs":"69ae47fc52c6880e85416b4744500d5655c9ec6131cb737f3b649fceaadce15a","src/unix/haiku/b64.rs":"73e64db09275a8da8d50a13cce2cfa2b136036ddf3a930d2939f337fc995900b","src/unix/haiku/mod.rs":"f7116f72149547b9f7bd38db1cd7773f026f3584c18777f8b6e26ba384efe394","src/unix/mod.rs":"1d95051294ac738f852fc6bb85921618efd911b5772a321f7465a73dabb930e9","src/unix/newlib/aarch64/mod.rs":"c408a990f22fb4292a824f38367e9b517e6e6f8623328397ee631cc88b3d1f7d","src/unix/newlib/arm/mod.rs":"2b6dba2e697ab9b4f4bc4dd5f28057249e9b596d1cb395a9322ec87605c4a5c4","src/unix/newlib/mod.rs":"7422845a44de13a2faf15d105670525ed090c6e200c9723178ed735810bbd689","src/unix/notbsd/android/b32/arm.rs":"3625a32c7e58cfe683a53486fbe3d42d4e28f00bea31e19cb46ed2bb0b6a140b","src/unix/notbsd/android/b32/mod.rs":"e9ec6f08e20ea235cd7095604ea6e37c739c1276e9f40fa31a4db4951fa005af","src/unix/notbsd/android/b32/x86.rs":"ae2b7f1d6278caddc007749bb1d09ca33f7593478a0fd7fe98b457dae86c7814","src/unix/notbsd/android/b64/aarch64.rs":"63d65629d79371814910f691672ef593d20244ee09be26f1ebe07ee6212d0163","src/unix/notbsd/android/b64/mod.rs":"63290adc8122c040f9be369ef4180975bcf1a967a717aa75d30371162d5d5fa9","src/unix/notbsd/android/b64/x86_64.rs":"5547aef8dcbaa5a932559f34606fd8d89f6c9c15173d2b1412c12d39b3c1045f","src/unix/notbsd/android/mod.rs":"82f4435fc240ec0e9e9e073a945fb823d49dc731b2b1c4fdfd67c005e841da80","src/unix/notbsd/emscripten.rs":"f8d8acf5cef1acd1a6bdd41299054120820865d072c4c2e3c740fbd0c6e9b3e7","src/unix/notbsd/linux/mips/mips32.rs":"f769bbe5c48f77e6bc94e37deccd2866e7e52e7eb1b3cd7611dbad95574e82f8","src/unix/notbsd/linux/mips/mips64.rs":"ef678b48b571428d46fef5b2ca9bef7251b5f27fcd2c38d987d1b80f2ad3ece0","src/unix/notbsd/linux/mips/mod.rs":"c1a3ce900f4e7ec7ebead61829968607baf5a6258e97e9e654fcce277824ea48","src/unix/notbsd/linux/mod.rs":"d636dc9c7c8a2348912412dfcb0edc8699e8b609561bb0156e4fe783818d57d4","src/unix/notbsd/linux/musl/b32/arm.rs":"d2998b13648696304bb34f0793715d821178baf8e88a45b532764a20b5294232","src/unix/notbsd/linux/musl/b32/mips.rs":"340be794362a4532d709ef23542b10762f710f7bfd0c4fafa5166a3fb9a15b4f","src/unix/notbsd/linux/musl/b32/mod.rs":"3cc7979546258a47df6b0fcd7ad64571826623671857633a7acafe87e05e56a1","src/unix/notbsd/linux/musl/b32/x86.rs":"df114102dcf35bc32f891d4a9e09ce02fbe4c096a196c6b98b10ff87b29dbe4d","src/unix/notbsd/linux/musl/b64/aarch64.rs":"12c590fde2a1450c08934234c4f5bcd94ee7b58ca21f8e93bc930148c15fb0b0","src/unix/notbsd/linux/musl/b64/mod.rs":"b1991ef46a00d2db7ce3e36f6596685c1d508786c4dd4e62cbbf65ac3c256cc0","src/unix/notbsd/linux/musl/b64/powerpc64.rs":"239c5754811e2d75723bd0d540e732630c9817c5f24513d1f02b63e6b27a3a57","src/unix/notbsd/linux/musl/b64/x86_64.rs":"bf8fc10a09bf700084db0381c484ddec3add79aa1726954cb14d21802ff7d199","src/unix/notbsd/linux/musl/mod.rs":"972b3e6a2618d3c2585f657db738d2975ed26481ef096df81fa2b74e275a3212","src/unix/notbsd/linux/other/b32/arm.rs":"d9892f7350b2978335f734f1cd2d7fed60f0f2e66aa05bee3f69549c031f8b14","src/unix/notbsd/linux/other/b32/mod.rs":"f2ce29ed104daf758cd4f61c190d1b5c12f516a428375891d7839d77ade8cbe6","src/unix/notbsd/linux/other/b32/powerpc.rs":"253fcd2f9978525285be1903cc08f3fec2dc3b12d1660a33e2995b4f6b810d1c","src/unix/notbsd/linux/other/b32/x86.rs":"49376e3ed0f3ff95c230ac20751911fe3c608dfe15c7c118b069fd7a954d8db9","src/unix/notbsd/linux/other/b64/aarch64.rs":"30972cfff722b00e974617f48178bd9862da8bde9c391845d7e6233235d58927","src/unix/notbsd/linux/other/b64/mod.rs":"63e1a3fdf5f4d1b9820934ab344c91aed5e458e7e05908535d2e942d51a08bf8","src/unix/notbsd/linux/other/b64/not_x32.rs":"e1cf87b9dbe89e9fff667c6fc8eff0166a02565ef65aae3dc9304dc70f7a5624","src/unix/notbsd/linux/other/b64/powerpc64.rs":"5c20bf2bf528d329ed279f7730469b1131565029fae495803cee8809cc8d27e9","src/unix/notbsd/linux/other/b64/sparc64.rs":"f85a03e1b5f6aa9b2c5b755e40885ab0a1b8131b4c9f22ee3c89512042671fcd","src/unix/notbsd/linux/other/b64/x32.rs":"e521bd43a2d66f09f03a045b2e1f69f2ca91cff37922ac5b7c437d888799cee6","src/unix/notbsd/linux/other/b64/x86_64.rs":"c07dfaca8234bc1291e12a30cb91230f228199024a5aa64e41e350d33b030abb","src/unix/notbsd/linux/other/mod.rs":"5b62146535521c1e7730ea7cba53fd9285831616318abcf5134af992d6cca4a3","src/unix/notbsd/linux/s390x.rs":"f02511c192808ba77d64ba743fd11e1bd2a6786389dde551aebe013ec22f237e","src/unix/notbsd/mod.rs":"d2643df7dc6c4affb0ea43ff4471558df317e788942dfde5096c2479f6d42f08","src/unix/solaris/mod.rs":"a4c788d388a6bc926962e5bceb8a6c35d56870cb3f33faac0d175d7b67d7896f","src/unix/uclibc/mips/mips32.rs":"31b23e466cffb86116421ec9240b86e7419aacd84b0b1b04d23c7142c8717566","src/unix/uclibc/mips/mips64.rs":"e67eec1636a998b047d89a4cda1c99cb6bc3071db017762675179a68201c4438","src/unix/uclibc/mips/mod.rs":"74817a9b1ee3998d8e0b751a555d57225f70fd979c283c94ada344a162a8b856","src/unix/uclibc/mod.rs":"148bfd71963fc59fba2f1ed26ec36d68b1ee288936137980026f56279cedce67","src/unix/uclibc/x86_64/l4re.rs":"54b4e58ce5a671348c32bc41c1607dbc5c13fa6818cc3e0e0e2b409c300a305e","src/unix/uclibc/x86_64/mod.rs":"bd569360c45a6f2b585cfb47544d223e92243a2ff4f8429b78fecac6b889f9fd","src/windows.rs":"e41357d610608bad81abf285306ad8b127b6f02d5132f63c4942861980b47d59"},"package":"36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0"} \ No newline at end of file diff --git a/src/vendor/libc/.travis.yml b/src/vendor/libc/.travis.yml index 053abfe1dc..6acf0a8064 100644 --- a/src/vendor/libc/.travis.yml +++ b/src/vendor/libc/.travis.yml @@ -53,7 +53,8 @@ matrix: - env: TARGET=arm-unknown-linux-musleabihf - env: TARGET=aarch64-unknown-linux-gnu - env: TARGET=aarch64-unknown-linux-musl - rust: beta + # FIXME(#856) + rust: 1.22.1 - os: osx osx_image: xcode8.2 env: TARGET=i386-apple-ios diff --git a/src/vendor/libc/Cargo.toml b/src/vendor/libc/Cargo.toml index 16f0ad234c..551c8c8829 100644 --- a/src/vendor/libc/Cargo.toml +++ b/src/vendor/libc/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "libc" -version = "0.2.33" +version = "0.2.34" authors = ["The Rust Project Developers"] description = "A library for types and bindings to native C functions often found in libc or\nother common platform libraries.\n" homepage = "https://github.com/rust-lang/libc" @@ -25,8 +25,8 @@ repository = "https://github.com/rust-lang/libc" default = ["use_std"] use_std = [] [badges.appveyor] -repository = "rust-lang/libc" project_name = "rust-lang-libs/libc" +repository = "rust-lang/libc" [badges.travis-ci] repository = "rust-lang/libc" diff --git a/src/vendor/libc/Cargo.toml.orig b/src/vendor/libc/Cargo.toml.orig index 0431fee475..c88504207c 100644 --- a/src/vendor/libc/Cargo.toml.orig +++ b/src/vendor/libc/Cargo.toml.orig @@ -1,7 +1,7 @@ [package] name = "libc" -version = "0.2.33" +version = "0.2.34" authors = ["The Rust Project Developers"] license = "MIT/Apache-2.0" readme = "README.md" diff --git a/src/vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/src/vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile index 49a277d884..861f4f9b00 100644 --- a/src/vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile +++ b/src/vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile @@ -1,12 +1,18 @@ FROM ubuntu:17.10 RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-s390x-linux-gnu libc6-dev-s390x-cross + curl ca-certificates \ + gcc libc6-dev \ + gcc-s390x-linux-gnu libc6-dev-s390x-cross \ + qemu-system-s390x \ + cpio + +COPY linux-s390x.sh / +RUN bash /linux-s390x.sh + +COPY test-runner-linux / ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \ - # TODO: in theory we should execute this, but qemu segfaults immediately :( - # CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \ - CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER=true \ + CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="/test-runner-linux s390x" \ CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \ PATH=$PATH:/rust/bin diff --git a/src/vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/src/vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile index 2d53371add..2c551f91fa 100644 --- a/src/vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile +++ b/src/vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile @@ -2,13 +2,18 @@ FROM ubuntu:17.04 RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-sparc64-linux-gnu libc6-dev-sparc64-cross + curl ca-certificates \ + gcc libc6-dev \ + gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \ + qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \ + p7zip-full cpio + +COPY linux-sparc64.sh / +RUN bash /linux-sparc64.sh + +COPY test-runner-linux / ENV CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_LINKER=sparc64-linux-gnu-gcc \ - # TODO: in theory we should execute this, but qemu segfaults immediately - # see https://github.com/rust-lang/libc/issues/822 - # CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-sparc64 -L /usr/sparc64-linux-gnu" \ - CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER=true \ + CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER="/test-runner-linux sparc64" \ CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ PATH=$PATH:/rust/bin diff --git a/src/vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh b/src/vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh index b1936f0410..3122e2e23b 100755 --- a/src/vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh +++ b/src/vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh @@ -7,5 +7,9 @@ shift dir=$(dirname $me) file=$(basename $me) +if echo $file | grep -q wasm; then + exit 0 # FIXME(rust-lang/cargo#4750) +fi + cd $dir exec node $file "$@" diff --git a/src/vendor/libc/ci/emscripten-entry.sh b/src/vendor/libc/ci/emscripten-entry.sh index acaebfe8c7..22ae8b08a3 100755 --- a/src/vendor/libc/ci/emscripten-entry.sh +++ b/src/vendor/libc/ci/emscripten-entry.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2017 The Rust Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution and at # http://rust-lang.org/COPYRIGHT. diff --git a/src/vendor/libc/ci/linux-s390x.sh b/src/vendor/libc/ci/linux-s390x.sh new file mode 100644 index 0000000000..972abeec56 --- /dev/null +++ b/src/vendor/libc/ci/linux-s390x.sh @@ -0,0 +1,18 @@ +set -ex + +mkdir -m 777 /qemu +cd /qemu + +curl -LO https://github.com/qemu/qemu/raw/master/pc-bios/s390-ccw.img +curl -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/kernel.debian +curl -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/initrd.debian + +mv kernel.debian kernel +mv initrd.debian initrd.gz + +mkdir init +cd init +gunzip -c ../initrd.gz | cpio -id +rm ../initrd.gz +cp /usr/s390x-linux-gnu/lib/libgcc_s.so.1 usr/lib/ +chmod a+w . diff --git a/src/vendor/libc/ci/linux-sparc64.sh b/src/vendor/libc/ci/linux-sparc64.sh new file mode 100644 index 0000000000..33a3c46c77 --- /dev/null +++ b/src/vendor/libc/ci/linux-sparc64.sh @@ -0,0 +1,17 @@ +set -ex + +mkdir -m 777 /qemu +cd /qemu + +curl -LO https://cdimage.debian.org/cdimage/ports/debian-9.0-sparc64-NETINST-1.iso +7z e debian-9.0-sparc64-NETINST-1.iso boot/initrd.gz +7z e debian-9.0-sparc64-NETINST-1.iso boot/sparc64 +mv sparc64 kernel +rm debian-9.0-sparc64-NETINST-1.iso + +mkdir init +cd init +gunzip -c ../initrd.gz | cpio -id +rm ../initrd.gz +cp /usr/sparc64-linux-gnu/lib/libgcc_s.so.1 usr/lib/ +chmod a+w . diff --git a/src/vendor/libc/ci/run.sh b/src/vendor/libc/ci/run.sh index 420542a561..02dd35a12b 100755 --- a/src/vendor/libc/ci/run.sh +++ b/src/vendor/libc/ci/run.sh @@ -41,7 +41,11 @@ if [ "$QEMU" != "" ]; then # Do the standard rigamarole of cross-compiling an executable and then the # script to run just executes the binary. - cargo build --manifest-path libc-test/Cargo.toml --target $TARGET --tests + cargo build \ + --manifest-path libc-test/Cargo.toml \ + --target $TARGET \ + --test main + rm $CARGO_TARGET_DIR/$TARGET/debug/main-*.d cp $CARGO_TARGET_DIR/$TARGET/debug/main-* $tmpdir/mount/libc-test echo 'exec $1/libc-test' > $tmpdir/mount/run.sh diff --git a/src/vendor/libc/ci/test-runner-linux b/src/vendor/libc/ci/test-runner-linux new file mode 100755 index 0000000000..5f1fb237c2 --- /dev/null +++ b/src/vendor/libc/ci/test-runner-linux @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +arch=$1 +prog=$2 + +cd /qemu/init +cp -f $2 prog +find . | cpio --create --format='newc' --quiet | gzip > ../initrd.gz +cd .. + +timeout 30s qemu-system-$arch \ + -m 1024 \ + -nographic \ + -kernel kernel \ + -initrd initrd.gz \ + -append init=/prog > output || true + +# remove kernel messages +tr -d '\r' < output | egrep -v '^\[' + +grep PASSED output > /dev/null diff --git a/src/vendor/libc/src/fuchsia/aarch64.rs b/src/vendor/libc/src/fuchsia/aarch64.rs new file mode 100644 index 0000000000..157d3d6e9e --- /dev/null +++ b/src/vendor/libc/src/fuchsia/aarch64.rs @@ -0,0 +1,336 @@ +pub type c_char = u8; +pub type __u64 = ::c_ulonglong; +pub type wchar_t = u32; +pub type nlink_t = u32; +pub type blksize_t = ::c_int; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad0: ::c_ulong, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + __pad1: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_uint; 2], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad0: ::c_ulong, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + __pad1: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_uint; 2], + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong, + } +} + +pub const MINSIGSTKSZ: ::size_t = 6144; +pub const SIGSTKSZ: ::size_t = 12288; + +#[doc(hidden)] +pub const PF_MAX: ::c_int = 43; +#[doc(hidden)] +pub const AF_MAX: ::c_int = PF_MAX; + +pub const SYS_io_setup: ::c_long = 0; +pub const SYS_io_destroy: ::c_long = 1; +pub const SYS_io_submit: ::c_long = 2; +pub const SYS_io_cancel: ::c_long = 3; +pub const SYS_io_getevents: ::c_long = 4; +pub const SYS_setxattr: ::c_long = 5; +pub const SYS_lsetxattr: ::c_long = 6; +pub const SYS_fsetxattr: ::c_long = 7; +pub const SYS_getxattr: ::c_long = 8; +pub const SYS_lgetxattr: ::c_long = 9; +pub const SYS_fgetxattr: ::c_long = 10; +pub const SYS_listxattr: ::c_long = 11; +pub const SYS_llistxattr: ::c_long = 12; +pub const SYS_flistxattr: ::c_long = 13; +pub const SYS_removexattr: ::c_long = 14; +pub const SYS_lremovexattr: ::c_long = 15; +pub const SYS_fremovexattr: ::c_long = 16; +pub const SYS_getcwd: ::c_long = 17; +pub const SYS_lookup_dcookie: ::c_long = 18; +pub const SYS_eventfd2: ::c_long = 19; +pub const SYS_epoll_create1: ::c_long = 20; +pub const SYS_epoll_ctl: ::c_long = 21; +pub const SYS_epoll_pwait: ::c_long = 22; +pub const SYS_dup: ::c_long = 23; +pub const SYS_dup3: ::c_long = 24; +pub const SYS_inotify_init1: ::c_long = 26; +pub const SYS_inotify_add_watch: ::c_long = 27; +pub const SYS_inotify_rm_watch: ::c_long = 28; +pub const SYS_ioctl: ::c_long = 29; +pub const SYS_ioprio_set: ::c_long = 30; +pub const SYS_ioprio_get: ::c_long = 31; +pub const SYS_flock: ::c_long = 32; +pub const SYS_mknodat: ::c_long = 33; +pub const SYS_mkdirat: ::c_long = 34; +pub const SYS_unlinkat: ::c_long = 35; +pub const SYS_symlinkat: ::c_long = 36; +pub const SYS_linkat: ::c_long = 37; +pub const SYS_renameat: ::c_long = 38; +pub const SYS_umount2: ::c_long = 39; +pub const SYS_mount: ::c_long = 40; +pub const SYS_pivot_root: ::c_long = 41; +pub const SYS_nfsservctl: ::c_long = 42; +pub const SYS_fallocate: ::c_long = 47; +pub const SYS_faccessat: ::c_long = 48; +pub const SYS_chdir: ::c_long = 49; +pub const SYS_fchdir: ::c_long = 50; +pub const SYS_chroot: ::c_long = 51; +pub const SYS_fchmod: ::c_long = 52; +pub const SYS_fchmodat: ::c_long = 53; +pub const SYS_fchownat: ::c_long = 54; +pub const SYS_fchown: ::c_long = 55; +pub const SYS_openat: ::c_long = 56; +pub const SYS_close: ::c_long = 57; +pub const SYS_vhangup: ::c_long = 58; +pub const SYS_pipe2: ::c_long = 59; +pub const SYS_quotactl: ::c_long = 60; +pub const SYS_getdents64: ::c_long = 61; +pub const SYS_read: ::c_long = 63; +pub const SYS_write: ::c_long = 64; +pub const SYS_readv: ::c_long = 65; +pub const SYS_writev: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_preadv: ::c_long = 69; +pub const SYS_pwritev: ::c_long = 70; +pub const SYS_pselect6: ::c_long = 72; +pub const SYS_ppoll: ::c_long = 73; +pub const SYS_signalfd4: ::c_long = 74; +pub const SYS_vmsplice: ::c_long = 75; +pub const SYS_splice: ::c_long = 76; +pub const SYS_tee: ::c_long = 77; +pub const SYS_readlinkat: ::c_long = 78; +pub const SYS_sync: ::c_long = 81; +pub const SYS_fsync: ::c_long = 82; +pub const SYS_fdatasync: ::c_long = 83; +pub const SYS_sync_file_range: ::c_long = 84; +pub const SYS_timerfd_create: ::c_long = 85; +pub const SYS_timerfd_settime: ::c_long = 86; +pub const SYS_timerfd_gettime: ::c_long = 87; +pub const SYS_utimensat: ::c_long = 88; +pub const SYS_acct: ::c_long = 89; +pub const SYS_capget: ::c_long = 90; +pub const SYS_capset: ::c_long = 91; +pub const SYS_personality: ::c_long = 92; +pub const SYS_exit: ::c_long = 93; +pub const SYS_exit_group: ::c_long = 94; +pub const SYS_waitid: ::c_long = 95; +pub const SYS_set_tid_address: ::c_long = 96; +pub const SYS_unshare: ::c_long = 97; +pub const SYS_futex: ::c_long = 98; +pub const SYS_set_robust_list: ::c_long = 99; +pub const SYS_get_robust_list: ::c_long = 100; +pub const SYS_nanosleep: ::c_long = 101; +pub const SYS_getitimer: ::c_long = 102; +pub const SYS_setitimer: ::c_long = 103; +pub const SYS_kexec_load: ::c_long = 104; +pub const SYS_init_module: ::c_long = 105; +pub const SYS_delete_module: ::c_long = 106; +pub const SYS_timer_create: ::c_long = 107; +pub const SYS_timer_gettime: ::c_long = 108; +pub const SYS_timer_getoverrun: ::c_long = 109; +pub const SYS_timer_settime: ::c_long = 110; +pub const SYS_timer_delete: ::c_long = 111; +pub const SYS_clock_settime: ::c_long = 112; +pub const SYS_clock_gettime: ::c_long = 113; +pub const SYS_clock_getres: ::c_long = 114; +pub const SYS_clock_nanosleep: ::c_long = 115; +pub const SYS_syslog: ::c_long = 116; +pub const SYS_ptrace: ::c_long = 117; +pub const SYS_sched_setparam: ::c_long = 118; +pub const SYS_sched_setscheduler: ::c_long = 119; +pub const SYS_sched_getscheduler: ::c_long = 120; +pub const SYS_sched_getparam: ::c_long = 121; +pub const SYS_sched_setaffinity: ::c_long = 122; +pub const SYS_sched_getaffinity: ::c_long = 123; +pub const SYS_sched_yield: ::c_long = 124; +pub const SYS_sched_get_priority_max: ::c_long = 125; +pub const SYS_sched_get_priority_min: ::c_long = 126; +pub const SYS_sched_rr_get_interval: ::c_long = 127; +pub const SYS_restart_syscall: ::c_long = 128; +pub const SYS_kill: ::c_long = 129; +pub const SYS_tkill: ::c_long = 130; +pub const SYS_tgkill: ::c_long = 131; +pub const SYS_sigaltstack: ::c_long = 132; +pub const SYS_rt_sigsuspend: ::c_long = 133; +pub const SYS_rt_sigaction: ::c_long = 134; +pub const SYS_rt_sigprocmask: ::c_long = 135; +pub const SYS_rt_sigpending: ::c_long = 136; +pub const SYS_rt_sigtimedwait: ::c_long = 137; +pub const SYS_rt_sigqueueinfo: ::c_long = 138; +pub const SYS_rt_sigreturn: ::c_long = 139; +pub const SYS_setpriority: ::c_long = 140; +pub const SYS_getpriority: ::c_long = 141; +pub const SYS_reboot: ::c_long = 142; +pub const SYS_setregid: ::c_long = 143; +pub const SYS_setgid: ::c_long = 144; +pub const SYS_setreuid: ::c_long = 145; +pub const SYS_setuid: ::c_long = 146; +pub const SYS_setresuid: ::c_long = 147; +pub const SYS_getresuid: ::c_long = 148; +pub const SYS_setresgid: ::c_long = 149; +pub const SYS_getresgid: ::c_long = 150; +pub const SYS_setfsuid: ::c_long = 151; +pub const SYS_setfsgid: ::c_long = 152; +pub const SYS_times: ::c_long = 153; +pub const SYS_setpgid: ::c_long = 154; +pub const SYS_getpgid: ::c_long = 155; +pub const SYS_getsid: ::c_long = 156; +pub const SYS_setsid: ::c_long = 157; +pub const SYS_getgroups: ::c_long = 158; +pub const SYS_setgroups: ::c_long = 159; +pub const SYS_uname: ::c_long = 160; +pub const SYS_sethostname: ::c_long = 161; +pub const SYS_setdomainname: ::c_long = 162; +pub const SYS_getrlimit: ::c_long = 163; +pub const SYS_setrlimit: ::c_long = 164; +pub const SYS_getrusage: ::c_long = 165; +pub const SYS_umask: ::c_long = 166; +pub const SYS_prctl: ::c_long = 167; +pub const SYS_getcpu: ::c_long = 168; +pub const SYS_gettimeofday: ::c_long = 169; +pub const SYS_settimeofday: ::c_long = 170; +pub const SYS_adjtimex: ::c_long = 171; +pub const SYS_getpid: ::c_long = 172; +pub const SYS_getppid: ::c_long = 173; +pub const SYS_getuid: ::c_long = 174; +pub const SYS_geteuid: ::c_long = 175; +pub const SYS_getgid: ::c_long = 176; +pub const SYS_getegid: ::c_long = 177; +pub const SYS_gettid: ::c_long = 178; +pub const SYS_sysinfo: ::c_long = 179; +pub const SYS_mq_open: ::c_long = 180; +pub const SYS_mq_unlink: ::c_long = 181; +pub const SYS_mq_timedsend: ::c_long = 182; +pub const SYS_mq_timedreceive: ::c_long = 183; +pub const SYS_mq_notify: ::c_long = 184; +pub const SYS_mq_getsetattr: ::c_long = 185; +pub const SYS_msgget: ::c_long = 186; +pub const SYS_msgctl: ::c_long = 187; +pub const SYS_msgrcv: ::c_long = 188; +pub const SYS_msgsnd: ::c_long = 189; +pub const SYS_semget: ::c_long = 190; +pub const SYS_semctl: ::c_long = 191; +pub const SYS_semtimedop: ::c_long = 192; +pub const SYS_semop: ::c_long = 193; +pub const SYS_shmget: ::c_long = 194; +pub const SYS_shmctl: ::c_long = 195; +pub const SYS_shmat: ::c_long = 196; +pub const SYS_shmdt: ::c_long = 197; +pub const SYS_socket: ::c_long = 198; +pub const SYS_socketpair: ::c_long = 199; +pub const SYS_bind: ::c_long = 200; +pub const SYS_listen: ::c_long = 201; +pub const SYS_accept: ::c_long = 202; +pub const SYS_connect: ::c_long = 203; +pub const SYS_getsockname: ::c_long = 204; +pub const SYS_getpeername: ::c_long = 205; +pub const SYS_sendto: ::c_long = 206; +pub const SYS_recvfrom: ::c_long = 207; +pub const SYS_setsockopt: ::c_long = 208; +pub const SYS_getsockopt: ::c_long = 209; +pub const SYS_shutdown: ::c_long = 210; +pub const SYS_sendmsg: ::c_long = 211; +pub const SYS_recvmsg: ::c_long = 212; +pub const SYS_readahead: ::c_long = 213; +pub const SYS_brk: ::c_long = 214; +pub const SYS_munmap: ::c_long = 215; +pub const SYS_mremap: ::c_long = 216; +pub const SYS_add_key: ::c_long = 217; +pub const SYS_request_key: ::c_long = 218; +pub const SYS_keyctl: ::c_long = 219; +pub const SYS_clone: ::c_long = 220; +pub const SYS_execve: ::c_long = 221; +pub const SYS_swapon: ::c_long = 224; +pub const SYS_swapoff: ::c_long = 225; +pub const SYS_mprotect: ::c_long = 226; +pub const SYS_msync: ::c_long = 227; +pub const SYS_mlock: ::c_long = 228; +pub const SYS_munlock: ::c_long = 229; +pub const SYS_mlockall: ::c_long = 230; +pub const SYS_munlockall: ::c_long = 231; +pub const SYS_mincore: ::c_long = 232; +pub const SYS_madvise: ::c_long = 233; +pub const SYS_remap_file_pages: ::c_long = 234; +pub const SYS_mbind: ::c_long = 235; +pub const SYS_get_mempolicy: ::c_long = 236; +pub const SYS_set_mempolicy: ::c_long = 237; +pub const SYS_migrate_pages: ::c_long = 238; +pub const SYS_move_pages: ::c_long = 239; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; +pub const SYS_perf_event_open: ::c_long = 241; +pub const SYS_accept4: ::c_long = 242; +pub const SYS_recvmmsg: ::c_long = 243; +pub const SYS_wait4: ::c_long = 260; +pub const SYS_prlimit64: ::c_long = 261; +pub const SYS_fanotify_init: ::c_long = 262; +pub const SYS_fanotify_mark: ::c_long = 263; +pub const SYS_name_to_handle_at: ::c_long = 264; +pub const SYS_open_by_handle_at: ::c_long = 265; +pub const SYS_clock_adjtime: ::c_long = 266; +pub const SYS_syncfs: ::c_long = 267; +pub const SYS_setns: ::c_long = 268; +pub const SYS_sendmmsg: ::c_long = 269; +pub const SYS_process_vm_readv: ::c_long = 270; +pub const SYS_process_vm_writev: ::c_long = 271; +pub const SYS_kcmp: ::c_long = 272; +pub const SYS_finit_module: ::c_long = 273; +pub const SYS_sched_setattr: ::c_long = 274; +pub const SYS_sched_getattr: ::c_long = 275; +pub const SYS_renameat2: ::c_long = 276; +pub const SYS_seccomp: ::c_long = 277; +pub const SYS_getrandom: ::c_long = 278; +pub const SYS_memfd_create: ::c_long = 279; +pub const SYS_bpf: ::c_long = 280; +pub const SYS_execveat: ::c_long = 281; +pub const SYS_userfaultfd: ::c_long = 282; +pub const SYS_membarrier: ::c_long = 283; +pub const SYS_mlock2: ::c_long = 284; +pub const SYS_copy_file_range: ::c_long = 285; +pub const SYS_preadv2: ::c_long = 286; +pub const SYS_pwritev2: ::c_long = 287; +pub const SYS_pkey_mprotect: ::c_long = 288; +pub const SYS_pkey_alloc: ::c_long = 289; +pub const SYS_pkey_free: ::c_long = 290; diff --git a/src/vendor/libc/src/fuchsia/mod.rs b/src/vendor/libc/src/fuchsia/mod.rs new file mode 100644 index 0000000000..ac11fbbdac --- /dev/null +++ b/src/vendor/libc/src/fuchsia/mod.rs @@ -0,0 +1,3920 @@ +//! Definitions found commonly among almost all Unix derivatives +//! +//! More functions and definitions can be found in the more specific modules +//! according to the platform in question. + +use dox::{mem, Option}; + +// PUB_TYPE + +pub type pid_t = i32; +pub type uid_t = u32; +pub type gid_t = u32; +pub type in_addr_t = u32; +pub type in_port_t = u16; +pub type sighandler_t = ::size_t; +pub type cc_t = ::c_uchar; +pub type sa_family_t = u16; +pub type pthread_key_t = ::c_uint; +pub type speed_t = ::c_uint; +pub type tcflag_t = ::c_uint; +pub type clockid_t = ::c_int; +pub type key_t = ::c_int; +pub type id_t = ::c_uint; +pub type useconds_t = u32; +pub type dev_t = u64; +pub type socklen_t = u32; +pub type pthread_t = c_ulong; +pub type mode_t = u32; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; +pub type rlim64_t = u64; +pub type mqd_t = ::c_int; +pub type nfds_t = ::c_ulong; +pub type nl_item = ::c_int; +pub type idtype_t = ::c_uint; +pub type loff_t = ::c_longlong; + +pub type __u8 = ::c_uchar; +pub type __u16 = ::c_ushort; +pub type __s16 = ::c_short; +pub type __u32 = ::c_uint; +pub type __s32 = ::c_int; + +pub type Elf32_Half = u16; +pub type Elf32_Word = u32; +pub type Elf32_Off = u32; +pub type Elf32_Addr = u32; + +pub type Elf64_Half = u16; +pub type Elf64_Word = u32; +pub type Elf64_Off = u64; +pub type Elf64_Addr = u64; +pub type Elf64_Xword = u64; + +pub type clock_t = c_long; +pub type time_t = c_long; +pub type suseconds_t = c_long; +pub type ino_t = u64; +pub type off_t = i64; +pub type blkcnt_t = i64; + +pub type shmatt_t = ::c_ulong; +pub type msgqnum_t = ::c_ulong; +pub type msglen_t = ::c_ulong; +pub type fsblkcnt_t = ::c_ulonglong; +pub type fsfilcnt_t = ::c_ulonglong; +pub type rlim_t = ::c_ulonglong; + +pub type c_long = i64; +pub type c_ulong = u64; + +// FIXME: why are these uninhabited types? that seems... wrong? +// Presumably these should be `()` or an `extern type` (when that stabilizes). +pub enum timezone {} +pub enum DIR {} +pub enum locale_t {} +pub enum fpos64_t {} // TODO: fill this out with a struct + +// PUB_STRUCT + +s! { + pub struct group { + pub gr_name: *mut ::c_char, + pub gr_passwd: *mut ::c_char, + pub gr_gid: ::gid_t, + pub gr_mem: *mut *mut ::c_char, + } + + pub struct utimbuf { + pub actime: time_t, + pub modtime: time_t, + } + + pub struct timeval { + pub tv_sec: time_t, + pub tv_usec: suseconds_t, + } + + // linux x32 compatibility + // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437 + pub struct timespec { + pub tv_sec: time_t, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub tv_nsec: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub tv_nsec: ::c_long, + } + + pub struct rlimit { + pub rlim_cur: rlim_t, + pub rlim_max: rlim_t, + } + + pub struct rusage { + pub ru_utime: timeval, + pub ru_stime: timeval, + pub ru_maxrss: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad1: u32, + pub ru_ixrss: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad2: u32, + pub ru_idrss: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad3: u32, + pub ru_isrss: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad4: u32, + pub ru_minflt: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad5: u32, + pub ru_majflt: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad6: u32, + pub ru_nswap: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad7: u32, + pub ru_inblock: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad8: u32, + pub ru_oublock: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad9: u32, + pub ru_msgsnd: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad10: u32, + pub ru_msgrcv: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad11: u32, + pub ru_nsignals: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad12: u32, + pub ru_nvcsw: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad13: u32, + pub ru_nivcsw: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + __pad14: u32, + + #[cfg(any(target_env = "musl", target_os = "emscripten"))] + __reserved: [c_long; 16], + } + + pub struct in_addr { + pub s_addr: in_addr_t, + } + + pub struct in6_addr { + pub s6_addr: [u8; 16], + __align: [u32; 0], + } + + pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + } + + pub struct ipv6_mreq { + pub ipv6mr_multiaddr: in6_addr, + #[cfg(target_os = "android")] + pub ipv6mr_interface: ::c_int, + #[cfg(not(target_os = "android"))] + pub ipv6mr_interface: ::c_uint, + } + + pub struct hostent { + pub h_name: *mut ::c_char, + pub h_aliases: *mut *mut ::c_char, + pub h_addrtype: ::c_int, + pub h_length: ::c_int, + pub h_addr_list: *mut *mut ::c_char, + } + + pub struct iovec { + pub iov_base: *mut ::c_void, + pub iov_len: ::size_t, + } + + pub struct pollfd { + pub fd: ::c_int, + pub events: ::c_short, + pub revents: ::c_short, + } + + pub struct winsize { + pub ws_row: ::c_ushort, + pub ws_col: ::c_ushort, + pub ws_xpixel: ::c_ushort, + pub ws_ypixel: ::c_ushort, + } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } + + pub struct sigval { + // Actually a union of an int and a void* + pub sival_ptr: *mut ::c_void + } + + // + pub struct itimerval { + pub it_interval: ::timeval, + pub it_value: ::timeval, + } + + // + pub struct tms { + pub tms_utime: ::clock_t, + pub tms_stime: ::clock_t, + pub tms_cutime: ::clock_t, + pub tms_cstime: ::clock_t, + } + + pub struct servent { + pub s_name: *mut ::c_char, + pub s_aliases: *mut *mut ::c_char, + pub s_port: ::c_int, + pub s_proto: *mut ::c_char, + } + + pub struct protoent { + pub p_name: *mut ::c_char, + pub p_aliases: *mut *mut ::c_char, + pub p_proto: ::c_int, + } + + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __td: *mut ::c_void, + __lock: [::c_int; 2], + __err: ::c_int, + __ret: ::ssize_t, + pub aio_offset: off_t, + __next: *mut ::c_void, + __prev: *mut ::c_void, + #[cfg(target_pointer_width = "32")] + __dummy4: [::c_char; 24], + #[cfg(target_pointer_width = "64")] + __dummy4: [::c_char; 16], + } + + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_flags: ::c_int, + pub sa_restorer: ::dox::Option, + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + pub __c_ispeed: ::speed_t, + pub __c_ospeed: ::speed_t, + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct sysinfo { + pub uptime: ::c_ulong, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub __reserved: [::c_char; 256], + } + + pub struct ucred { + pub pid: ::pid_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + } + + pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::c_char; 14], + } + + pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: ::in_port_t, + pub sin_addr: ::in_addr, + pub sin_zero: [u8; 8], + } + + pub struct sockaddr_in6 { + pub sin6_family: sa_family_t, + pub sin6_port: ::in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: ::in6_addr, + pub sin6_scope_id: u32, + } + + pub struct sockaddr_un { + pub sun_family: sa_family_t, + pub sun_path: [::c_char; 108] + } + + pub struct sockaddr_storage { + pub ss_family: sa_family_t, + __ss_align: ::size_t, + __ss_pad2: [u8; 128 - 2 * 8], + } + + pub struct addrinfo { + pub ai_flags: ::c_int, + pub ai_family: ::c_int, + pub ai_socktype: ::c_int, + pub ai_protocol: ::c_int, + pub ai_addrlen: socklen_t, + + pub ai_addr: *mut ::sockaddr, + + pub ai_canonname: *mut c_char, + + pub ai_next: *mut addrinfo, + } + + pub struct sockaddr_nl { + pub nl_family: ::sa_family_t, + nl_pad: ::c_ushort, + pub nl_pid: u32, + pub nl_groups: u32 + } + + pub struct sockaddr_ll { + pub sll_family: ::c_ushort, + pub sll_protocol: ::c_ushort, + pub sll_ifindex: ::c_int, + pub sll_hatype: ::c_ushort, + pub sll_pkttype: ::c_uchar, + pub sll_halen: ::c_uchar, + pub sll_addr: [::c_uchar; 8] + } + + pub struct fd_set { + fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], + } + + pub struct tm { + pub tm_sec: ::c_int, + pub tm_min: ::c_int, + pub tm_hour: ::c_int, + pub tm_mday: ::c_int, + pub tm_mon: ::c_int, + pub tm_year: ::c_int, + pub tm_wday: ::c_int, + pub tm_yday: ::c_int, + pub tm_isdst: ::c_int, + pub tm_gmtoff: ::c_long, + pub tm_zone: *const ::c_char, + } + + pub struct sched_param { + pub sched_priority: ::c_int, + #[cfg(target_env = "musl")] + pub sched_ss_low_priority: ::c_int, + #[cfg(target_env = "musl")] + pub sched_ss_repl_period: ::timespec, + #[cfg(target_env = "musl")] + pub sched_ss_init_budget: ::timespec, + #[cfg(target_env = "musl")] + pub sched_ss_max_repl: ::c_int, + } + + pub struct Dl_info { + pub dli_fname: *const ::c_char, + pub dli_fbase: *mut ::c_void, + pub dli_sname: *const ::c_char, + pub dli_saddr: *mut ::c_void, + } + + #[cfg_attr(any(all(target_arch = "x86", + not(target_env = "musl"), + not(target_os = "android")), + target_arch = "x86_64"), + repr(packed))] + pub struct epoll_event { + pub events: ::uint32_t, + pub u64: ::uint64_t, + } + + pub struct utsname { + pub sysname: [::c_char; 65], + pub nodename: [::c_char; 65], + pub release: [::c_char; 65], + pub version: [::c_char; 65], + pub machine: [::c_char; 65], + pub domainname: [::c_char; 65] + } + + pub struct lconv { + pub decimal_point: *mut ::c_char, + pub thousands_sep: *mut ::c_char, + pub grouping: *mut ::c_char, + pub int_curr_symbol: *mut ::c_char, + pub currency_symbol: *mut ::c_char, + pub mon_decimal_point: *mut ::c_char, + pub mon_thousands_sep: *mut ::c_char, + pub mon_grouping: *mut ::c_char, + pub positive_sign: *mut ::c_char, + pub negative_sign: *mut ::c_char, + pub int_frac_digits: ::c_char, + pub frac_digits: ::c_char, + pub p_cs_precedes: ::c_char, + pub p_sep_by_space: ::c_char, + pub n_cs_precedes: ::c_char, + pub n_sep_by_space: ::c_char, + pub p_sign_posn: ::c_char, + pub n_sign_posn: ::c_char, + pub int_p_cs_precedes: ::c_char, + pub int_p_sep_by_space: ::c_char, + pub int_n_cs_precedes: ::c_char, + pub int_n_sep_by_space: ::c_char, + pub int_p_sign_posn: ::c_char, + pub int_n_sign_posn: ::c_char, + } + + pub struct sigevent { + pub sigev_value: ::sigval, + pub sigev_signo: ::c_int, + pub sigev_notify: ::c_int, + // Actually a union. We only expose sigev_notify_thread_id because it's + // the most useful member + pub sigev_notify_thread_id: ::c_int, + #[cfg(target_pointer_width = "64")] + __unused1: [::c_int; 11], + #[cfg(target_pointer_width = "32")] + __unused1: [::c_int; 12] + } + + pub struct dirent { + pub d_ino: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct dirent64 { + pub d_ino: ::ino64_t, + pub d_off: ::off64_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct rlimit64 { + pub rlim_cur: rlim64_t, + pub rlim_max: rlim64_t, + } + + pub struct glob_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + pub struct ifaddrs { + pub ifa_next: *mut ifaddrs, + pub ifa_name: *mut c_char, + pub ifa_flags: ::c_uint, + pub ifa_addr: *mut ::sockaddr, + pub ifa_netmask: *mut ::sockaddr, + pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union + pub ifa_data: *mut ::c_void + } + + pub struct pthread_mutex_t { + #[cfg(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32")))] + __align: [::c_long; 0], + #[cfg(not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32"))))] + __align: [::c_longlong; 0], + size: [u8; __SIZEOF_PTHREAD_MUTEX_T], + } + + pub struct pthread_rwlock_t { + #[cfg(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32")))] + __align: [::c_long; 0], + #[cfg(not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32"))))] + __align: [::c_longlong; 0], + size: [u8; __SIZEOF_PTHREAD_RWLOCK_T], + } + + pub struct pthread_mutexattr_t { + #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64", + target_arch = "mips64", target_arch = "s390x", + target_arch = "sparc64"))] + __align: [::c_int; 0], + #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64", + target_arch = "mips64", target_arch = "s390x", + target_arch = "sparc64", target_arch = "aarch64")))] + __align: [::c_long; 0], + #[cfg(all(target_arch = "aarch64", target_env = "gnu"))] + __align: [::c_long; 0], + #[cfg(all(target_arch = "aarch64", target_env = "musl"))] + __align: [::c_int; 0], + size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T], + } + + pub struct pthread_rwlockattr_t { + #[cfg(any(target_env = "musl"))] + __align: [::c_int; 0], + #[cfg(not(any(target_env = "musl")))] + __align: [::c_long; 0], + size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + pub struct pthread_cond_t { + #[cfg(any(target_env = "musl"))] + __align: [*const ::c_void; 0], + #[cfg(not(any(target_env = "musl")))] + __align: [::c_longlong; 0], + size: [u8; __SIZEOF_PTHREAD_COND_T], + } + + pub struct pthread_condattr_t { + __align: [::c_int; 0], + size: [u8; __SIZEOF_PTHREAD_CONDATTR_T], + } + + pub struct passwd { + pub pw_name: *mut ::c_char, + pub pw_passwd: *mut ::c_char, + pub pw_uid: ::uid_t, + pub pw_gid: ::gid_t, + pub pw_gecos: *mut ::c_char, + pub pw_dir: *mut ::c_char, + pub pw_shell: *mut ::c_char, + } + + pub struct spwd { + pub sp_namp: *mut ::c_char, + pub sp_pwdp: *mut ::c_char, + pub sp_lstchg: ::c_long, + pub sp_min: ::c_long, + pub sp_max: ::c_long, + pub sp_warn: ::c_long, + pub sp_inact: ::c_long, + pub sp_expire: ::c_long, + pub sp_flag: ::c_ulong, + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + #[cfg(target_endian = "little")] + pub f_fsid: ::c_ulong, + #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] + __f_unused: ::c_int, + #[cfg(target_endian = "big")] + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct dqblk { + pub dqb_bhardlimit: ::uint64_t, + pub dqb_bsoftlimit: ::uint64_t, + pub dqb_curspace: ::uint64_t, + pub dqb_ihardlimit: ::uint64_t, + pub dqb_isoftlimit: ::uint64_t, + pub dqb_curinodes: ::uint64_t, + pub dqb_btime: ::uint64_t, + pub dqb_itime: ::uint64_t, + pub dqb_valid: ::uint32_t, + } + + pub struct signalfd_siginfo { + pub ssi_signo: ::uint32_t, + pub ssi_errno: ::int32_t, + pub ssi_code: ::int32_t, + pub ssi_pid: ::uint32_t, + pub ssi_uid: ::uint32_t, + pub ssi_fd: ::int32_t, + pub ssi_tid: ::uint32_t, + pub ssi_band: ::uint32_t, + pub ssi_overrun: ::uint32_t, + pub ssi_trapno: ::uint32_t, + pub ssi_status: ::int32_t, + pub ssi_int: ::int32_t, + pub ssi_ptr: ::uint64_t, + pub ssi_utime: ::uint64_t, + pub ssi_stime: ::uint64_t, + pub ssi_addr: ::uint64_t, + _pad: [::uint8_t; 48], + } + + pub struct itimerspec { + pub it_interval: ::timespec, + pub it_value: ::timespec, + } + + pub struct fsid_t { + __val: [::c_int; 2], + } + + // x32 compatibility + // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 + pub struct mq_attr { + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_flags: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_maxmsg: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_msgsize: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_curmsgs: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pad: [i64; 4], + + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_flags: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_maxmsg: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_msgsize: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_curmsgs: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pad: [::c_long; 4], + } + + pub struct cpu_set_t { + #[cfg(all(target_pointer_width = "32", + not(target_arch = "x86_64")))] + bits: [u32; 32], + #[cfg(not(all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + bits: [u64; 16], + } + + pub struct if_nameindex { + pub if_index: ::c_uint, + pub if_name: *mut ::c_char, + } + + // System V IPC + pub struct msginfo { + pub msgpool: ::c_int, + pub msgmap: ::c_int, + pub msgmax: ::c_int, + pub msgmnb: ::c_int, + pub msgmni: ::c_int, + pub msgssz: ::c_int, + pub msgtql: ::c_int, + pub msgseg: ::c_ushort, + } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } + + pub struct sembuf { + pub sem_num: ::c_ushort, + pub sem_op: ::c_short, + pub sem_flg: ::c_short, + } + + pub struct input_event { + pub time: ::timeval, + pub type_: ::__u16, + pub code: ::__u16, + pub value: ::__s32, + } + + pub struct input_id { + pub bustype: ::__u16, + pub vendor: ::__u16, + pub product: ::__u16, + pub version: ::__u16, + } + + pub struct input_absinfo { + pub value: ::__s32, + pub minimum: ::__s32, + pub maximum: ::__s32, + pub fuzz: ::__s32, + pub flat: ::__s32, + pub resolution: ::__s32, + } + + pub struct input_keymap_entry { + pub flags: ::__u8, + pub len: ::__u8, + pub index: ::__u16, + pub keycode: ::__u32, + pub scancode: [::__u8; 32], + } + + pub struct input_mask { + pub type_: ::__u32, + pub codes_size: ::__u32, + pub codes_ptr: ::__u64, + } + + pub struct ff_replay { + pub length: ::__u16, + pub delay: ::__u16, + } + + pub struct ff_trigger { + pub button: ::__u16, + pub interval: ::__u16, + } + + pub struct ff_envelope { + pub attack_length: ::__u16, + pub attack_level: ::__u16, + pub fade_length: ::__u16, + pub fade_level: ::__u16, + } + + pub struct ff_constant_effect { + pub level: ::__s16, + pub envelope: ff_envelope, + } + + pub struct ff_ramp_effect { + pub start_level: ::__s16, + pub end_level: ::__s16, + pub envelope: ff_envelope, + } + + pub struct ff_condition_effect { + pub right_saturation: ::__u16, + pub left_saturation: ::__u16, + + pub right_coeff: ::__s16, + pub left_coeff: ::__s16, + + pub deadband: ::__u16, + pub center: ::__s16, + } + + pub struct ff_periodic_effect { + pub waveform: ::__u16, + pub period: ::__u16, + pub magnitude: ::__s16, + pub offset: ::__s16, + pub phase: ::__u16, + + pub envelope: ff_envelope, + + pub custom_len: ::__u32, + pub custom_data: *mut ::__s16, + } + + pub struct ff_rumble_effect { + pub strong_magnitude: ::__u16, + pub weak_magnitude: ::__u16, + } + + pub struct ff_effect { + pub type_: ::__u16, + pub id: ::__s16, + pub direction: ::__u16, + pub trigger: ff_trigger, + pub replay: ff_replay, + // FIXME this is actually a union + #[cfg(target_pointer_width = "64")] + pub u: [u64; 4], + #[cfg(target_pointer_width = "32")] + pub u: [u32; 7], + } + + pub struct dl_phdr_info { + #[cfg(target_pointer_width = "64")] + pub dlpi_addr: Elf64_Addr, + #[cfg(target_pointer_width = "32")] + pub dlpi_addr: Elf32_Addr, + + pub dlpi_name: *const ::c_char, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phdr: *const Elf64_Phdr, + #[cfg(target_pointer_width = "32")] + pub dlpi_phdr: *const Elf32_Phdr, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phnum: Elf64_Half, + #[cfg(target_pointer_width = "32")] + pub dlpi_phnum: Elf32_Half, + + pub dlpi_adds: ::c_ulonglong, + pub dlpi_subs: ::c_ulonglong, + pub dlpi_tls_modid: ::size_t, + pub dlpi_tls_data: *mut ::c_void, + } + + pub struct Elf32_Phdr { + pub p_type: Elf32_Word, + pub p_offset: Elf32_Off, + pub p_vaddr: Elf32_Addr, + pub p_paddr: Elf32_Addr, + pub p_filesz: Elf32_Word, + pub p_memsz: Elf32_Word, + pub p_flags: Elf32_Word, + pub p_align: Elf32_Word, + } + + pub struct Elf64_Phdr { + pub p_type: Elf64_Word, + pub p_flags: Elf64_Word, + pub p_offset: Elf64_Off, + pub p_vaddr: Elf64_Addr, + pub p_paddr: Elf64_Addr, + pub p_filesz: Elf64_Xword, + pub p_memsz: Elf64_Xword, + pub p_align: Elf64_Xword, + } + + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct pthread_attr_t { + __size: [u64; 7] + } + + pub struct sigset_t { + __val: [::c_ulong; 16], + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + pub msg_rtime: ::time_t, + pub msg_ctime: ::time_t, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::c_int, + __pad1: ::c_int, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::socklen_t, + __pad2: ::socklen_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::socklen_t, + pub __pad1: ::c_int, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct sem_t { + __val: [::c_int; 8], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + +// PUB_CONST + +pub const SIG_DFL: sighandler_t = 0 as sighandler_t; +pub const SIG_IGN: sighandler_t = 1 as sighandler_t; +pub const SIG_ERR: sighandler_t = !0 as sighandler_t; + +pub const DT_FIFO: u8 = 1; +pub const DT_CHR: u8 = 2; +pub const DT_DIR: u8 = 4; +pub const DT_BLK: u8 = 6; +pub const DT_REG: u8 = 8; +pub const DT_LNK: u8 = 10; +pub const DT_SOCK: u8 = 12; + +pub const FD_CLOEXEC: ::c_int = 0x1; + +pub const USRQUOTA: ::c_int = 0; +pub const GRPQUOTA: ::c_int = 1; + +pub const SIGIOT: ::c_int = 6; + +pub const S_ISUID: ::c_int = 0x800; +pub const S_ISGID: ::c_int = 0x400; +pub const S_ISVTX: ::c_int = 0x200; + +pub const IF_NAMESIZE: ::size_t = 16; + +pub const LOG_EMERG: ::c_int = 0; +pub const LOG_ALERT: ::c_int = 1; +pub const LOG_CRIT: ::c_int = 2; +pub const LOG_ERR: ::c_int = 3; +pub const LOG_WARNING: ::c_int = 4; +pub const LOG_NOTICE: ::c_int = 5; +pub const LOG_INFO: ::c_int = 6; +pub const LOG_DEBUG: ::c_int = 7; + +pub const LOG_KERN: ::c_int = 0; +pub const LOG_USER: ::c_int = 1 << 3; +pub const LOG_MAIL: ::c_int = 2 << 3; +pub const LOG_DAEMON: ::c_int = 3 << 3; +pub const LOG_AUTH: ::c_int = 4 << 3; +pub const LOG_SYSLOG: ::c_int = 5 << 3; +pub const LOG_LPR: ::c_int = 6 << 3; +pub const LOG_NEWS: ::c_int = 7 << 3; +pub const LOG_UUCP: ::c_int = 8 << 3; +pub const LOG_LOCAL0: ::c_int = 16 << 3; +pub const LOG_LOCAL1: ::c_int = 17 << 3; +pub const LOG_LOCAL2: ::c_int = 18 << 3; +pub const LOG_LOCAL3: ::c_int = 19 << 3; +pub const LOG_LOCAL4: ::c_int = 20 << 3; +pub const LOG_LOCAL5: ::c_int = 21 << 3; +pub const LOG_LOCAL6: ::c_int = 22 << 3; +pub const LOG_LOCAL7: ::c_int = 23 << 3; + +pub const LOG_PID: ::c_int = 0x01; +pub const LOG_CONS: ::c_int = 0x02; +pub const LOG_ODELAY: ::c_int = 0x04; +pub const LOG_NDELAY: ::c_int = 0x08; +pub const LOG_NOWAIT: ::c_int = 0x10; + +pub const LOG_PRIMASK: ::c_int = 7; +pub const LOG_FACMASK: ::c_int = 0x3f8; + +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + +pub const PRIO_MIN: ::c_int = -20; +pub const PRIO_MAX: ::c_int = 20; + +pub const IPPROTO_ICMP: ::c_int = 1; +pub const IPPROTO_ICMPV6: ::c_int = 58; +pub const IPPROTO_TCP: ::c_int = 6; +pub const IPPROTO_UDP: ::c_int = 17; +pub const IPPROTO_IP: ::c_int = 0; +pub const IPPROTO_IPV6: ::c_int = 41; + +pub const INADDR_LOOPBACK: in_addr_t = 2130706433; +pub const INADDR_ANY: in_addr_t = 0; +pub const INADDR_BROADCAST: in_addr_t = 4294967295; +pub const INADDR_NONE: in_addr_t = 4294967295; + +pub const EXIT_FAILURE: ::c_int = 1; +pub const EXIT_SUCCESS: ::c_int = 0; +pub const RAND_MAX: ::c_int = 2147483647; +pub const EOF: ::c_int = -1; +pub const SEEK_SET: ::c_int = 0; +pub const SEEK_CUR: ::c_int = 1; +pub const SEEK_END: ::c_int = 2; +pub const _IOFBF: ::c_int = 0; +pub const _IONBF: ::c_int = 2; +pub const _IOLBF: ::c_int = 1; + +pub const F_DUPFD: ::c_int = 0; +pub const F_GETFD: ::c_int = 1; +pub const F_SETFD: ::c_int = 2; +pub const F_GETFL: ::c_int = 3; +pub const F_SETFL: ::c_int = 4; + +// Linux-specific fcntls +pub const F_SETLEASE: ::c_int = 1024; +pub const F_GETLEASE: ::c_int = 1025; +pub const F_NOTIFY: ::c_int = 1026; +pub const F_CANCELLK: ::c_int = 1029; +pub const F_DUPFD_CLOEXEC: ::c_int = 1030; +pub const F_SETPIPE_SZ: ::c_int = 1031; +pub const F_GETPIPE_SZ: ::c_int = 1032; +pub const F_ADD_SEALS: ::c_int = 1033; +pub const F_GET_SEALS: ::c_int = 1034; + +pub const F_SEAL_SEAL: ::c_int = 0x0001; +pub const F_SEAL_SHRINK: ::c_int = 0x0002; +pub const F_SEAL_GROW: ::c_int = 0x0004; +pub const F_SEAL_WRITE: ::c_int = 0x0008; + +// TODO(#235): Include file sealing fcntls once we have a way to verify them. + +pub const SIGTRAP: ::c_int = 5; + +pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; +pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; + +pub const CLOCK_REALTIME: ::clockid_t = 0; +pub const CLOCK_MONOTONIC: ::clockid_t = 1; +pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; +pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; +pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; +pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; +pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; +pub const CLOCK_BOOTTIME: ::clockid_t = 7; +pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; +pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; +// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep +// 2014.) See also musl/mod.rs +// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; +// pub const CLOCK_TAI: ::clockid_t = 11; +pub const TIMER_ABSTIME: ::c_int = 1; + +pub const RLIMIT_CPU: ::c_int = 0; +pub const RLIMIT_FSIZE: ::c_int = 1; +pub const RLIMIT_DATA: ::c_int = 2; +pub const RLIMIT_STACK: ::c_int = 3; +pub const RLIMIT_CORE: ::c_int = 4; +pub const RLIMIT_LOCKS: ::c_int = 10; +pub const RLIMIT_SIGPENDING: ::c_int = 11; +pub const RLIMIT_MSGQUEUE: ::c_int = 12; +pub const RLIMIT_NICE: ::c_int = 13; +pub const RLIMIT_RTPRIO: ::c_int = 14; + +pub const RUSAGE_SELF: ::c_int = 0; + +pub const O_RDONLY: ::c_int = 0; +pub const O_WRONLY: ::c_int = 1; +pub const O_RDWR: ::c_int = 2; + +pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; + +pub const S_IFIFO: ::mode_t = 4096; +pub const S_IFCHR: ::mode_t = 8192; +pub const S_IFBLK: ::mode_t = 24576; +pub const S_IFDIR: ::mode_t = 16384; +pub const S_IFREG: ::mode_t = 32768; +pub const S_IFLNK: ::mode_t = 40960; +pub const S_IFSOCK: ::mode_t = 49152; +pub const S_IFMT: ::mode_t = 61440; +pub const S_IRWXU: ::mode_t = 448; +pub const S_IXUSR: ::mode_t = 64; +pub const S_IWUSR: ::mode_t = 128; +pub const S_IRUSR: ::mode_t = 256; +pub const S_IRWXG: ::mode_t = 56; +pub const S_IXGRP: ::mode_t = 8; +pub const S_IWGRP: ::mode_t = 16; +pub const S_IRGRP: ::mode_t = 32; +pub const S_IRWXO: ::mode_t = 7; +pub const S_IXOTH: ::mode_t = 1; +pub const S_IWOTH: ::mode_t = 2; +pub const S_IROTH: ::mode_t = 4; +pub const F_OK: ::c_int = 0; +pub const R_OK: ::c_int = 4; +pub const W_OK: ::c_int = 2; +pub const X_OK: ::c_int = 1; +pub const STDIN_FILENO: ::c_int = 0; +pub const STDOUT_FILENO: ::c_int = 1; +pub const STDERR_FILENO: ::c_int = 2; +pub const SIGHUP: ::c_int = 1; +pub const SIGINT: ::c_int = 2; +pub const SIGQUIT: ::c_int = 3; +pub const SIGILL: ::c_int = 4; +pub const SIGABRT: ::c_int = 6; +pub const SIGFPE: ::c_int = 8; +pub const SIGKILL: ::c_int = 9; +pub const SIGSEGV: ::c_int = 11; +pub const SIGPIPE: ::c_int = 13; +pub const SIGALRM: ::c_int = 14; +pub const SIGTERM: ::c_int = 15; + +pub const PROT_NONE: ::c_int = 0; +pub const PROT_READ: ::c_int = 1; +pub const PROT_WRITE: ::c_int = 2; +pub const PROT_EXEC: ::c_int = 4; + +pub const LC_CTYPE: ::c_int = 0; +pub const LC_NUMERIC: ::c_int = 1; +pub const LC_TIME: ::c_int = 2; +pub const LC_COLLATE: ::c_int = 3; +pub const LC_MONETARY: ::c_int = 4; +pub const LC_MESSAGES: ::c_int = 5; +pub const LC_ALL: ::c_int = 6; +pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE); +pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC); +pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME); +pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); +pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); +pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); +// LC_ALL_MASK defined per platform + +pub const MAP_FILE: ::c_int = 0x0000; +pub const MAP_SHARED: ::c_int = 0x0001; +pub const MAP_PRIVATE: ::c_int = 0x0002; +pub const MAP_FIXED: ::c_int = 0x0010; + +pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; + +// MS_ flags for msync(2) +pub const MS_ASYNC: ::c_int = 0x0001; +pub const MS_INVALIDATE: ::c_int = 0x0002; +pub const MS_SYNC: ::c_int = 0x0004; + +// MS_ flags for mount(2) +pub const MS_RDONLY: ::c_ulong = 0x01; +pub const MS_NOSUID: ::c_ulong = 0x02; +pub const MS_NODEV: ::c_ulong = 0x04; +pub const MS_NOEXEC: ::c_ulong = 0x08; +pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; +pub const MS_REMOUNT: ::c_ulong = 0x20; +pub const MS_MANDLOCK: ::c_ulong = 0x40; +pub const MS_DIRSYNC: ::c_ulong = 0x80; +pub const MS_NOATIME: ::c_ulong = 0x0400; +pub const MS_NODIRATIME: ::c_ulong = 0x0800; +pub const MS_BIND: ::c_ulong = 0x1000; +pub const MS_MOVE: ::c_ulong = 0x2000; +pub const MS_REC: ::c_ulong = 0x4000; +pub const MS_SILENT: ::c_ulong = 0x8000; +pub const MS_POSIXACL: ::c_ulong = 0x010000; +pub const MS_UNBINDABLE: ::c_ulong = 0x020000; +pub const MS_PRIVATE: ::c_ulong = 0x040000; +pub const MS_SLAVE: ::c_ulong = 0x080000; +pub const MS_SHARED: ::c_ulong = 0x100000; +pub const MS_RELATIME: ::c_ulong = 0x200000; +pub const MS_KERNMOUNT: ::c_ulong = 0x400000; +pub const MS_I_VERSION: ::c_ulong = 0x800000; +pub const MS_STRICTATIME: ::c_ulong = 0x1000000; +pub const MS_ACTIVE: ::c_ulong = 0x40000000; +pub const MS_NOUSER: ::c_ulong = 0x80000000; +pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; +pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; +pub const MS_RMT_MASK: ::c_ulong = 0x800051; + +pub const EPERM: ::c_int = 1; +pub const ENOENT: ::c_int = 2; +pub const ESRCH: ::c_int = 3; +pub const EINTR: ::c_int = 4; +pub const EIO: ::c_int = 5; +pub const ENXIO: ::c_int = 6; +pub const E2BIG: ::c_int = 7; +pub const ENOEXEC: ::c_int = 8; +pub const EBADF: ::c_int = 9; +pub const ECHILD: ::c_int = 10; +pub const EAGAIN: ::c_int = 11; +pub const ENOMEM: ::c_int = 12; +pub const EACCES: ::c_int = 13; +pub const EFAULT: ::c_int = 14; +pub const ENOTBLK: ::c_int = 15; +pub const EBUSY: ::c_int = 16; +pub const EEXIST: ::c_int = 17; +pub const EXDEV: ::c_int = 18; +pub const ENODEV: ::c_int = 19; +pub const ENOTDIR: ::c_int = 20; +pub const EISDIR: ::c_int = 21; +pub const EINVAL: ::c_int = 22; +pub const ENFILE: ::c_int = 23; +pub const EMFILE: ::c_int = 24; +pub const ENOTTY: ::c_int = 25; +pub const ETXTBSY: ::c_int = 26; +pub const EFBIG: ::c_int = 27; +pub const ENOSPC: ::c_int = 28; +pub const ESPIPE: ::c_int = 29; +pub const EROFS: ::c_int = 30; +pub const EMLINK: ::c_int = 31; +pub const EPIPE: ::c_int = 32; +pub const EDOM: ::c_int = 33; +pub const ERANGE: ::c_int = 34; +pub const EWOULDBLOCK: ::c_int = EAGAIN; + +pub const SCM_RIGHTS: ::c_int = 0x01; +pub const SCM_CREDENTIALS: ::c_int = 0x02; + +pub const PROT_GROWSDOWN: ::c_int = 0x1000000; +pub const PROT_GROWSUP: ::c_int = 0x2000000; + +pub const MAP_TYPE: ::c_int = 0x000f; + +pub const MADV_NORMAL: ::c_int = 0; +pub const MADV_RANDOM: ::c_int = 1; +pub const MADV_SEQUENTIAL: ::c_int = 2; +pub const MADV_WILLNEED: ::c_int = 3; +pub const MADV_DONTNEED: ::c_int = 4; +pub const MADV_FREE: ::c_int = 8; +pub const MADV_REMOVE: ::c_int = 9; +pub const MADV_DONTFORK: ::c_int = 10; +pub const MADV_DOFORK: ::c_int = 11; +pub const MADV_MERGEABLE: ::c_int = 12; +pub const MADV_UNMERGEABLE: ::c_int = 13; +pub const MADV_HUGEPAGE: ::c_int = 14; +pub const MADV_NOHUGEPAGE: ::c_int = 15; +pub const MADV_DONTDUMP: ::c_int = 16; +pub const MADV_DODUMP: ::c_int = 17; +pub const MADV_HWPOISON: ::c_int = 100; +pub const MADV_SOFT_OFFLINE: ::c_int = 101; + +pub const IFF_UP: ::c_int = 0x1; +pub const IFF_BROADCAST: ::c_int = 0x2; +pub const IFF_DEBUG: ::c_int = 0x4; +pub const IFF_LOOPBACK: ::c_int = 0x8; +pub const IFF_POINTOPOINT: ::c_int = 0x10; +pub const IFF_NOTRAILERS: ::c_int = 0x20; +pub const IFF_RUNNING: ::c_int = 0x40; +pub const IFF_NOARP: ::c_int = 0x80; +pub const IFF_PROMISC: ::c_int = 0x100; +pub const IFF_ALLMULTI: ::c_int = 0x200; +pub const IFF_MASTER: ::c_int = 0x400; +pub const IFF_SLAVE: ::c_int = 0x800; +pub const IFF_MULTICAST: ::c_int = 0x1000; +pub const IFF_PORTSEL: ::c_int = 0x2000; +pub const IFF_AUTOMEDIA: ::c_int = 0x4000; +pub const IFF_DYNAMIC: ::c_int = 0x8000; + +pub const SOL_IP: ::c_int = 0; +pub const SOL_TCP: ::c_int = 6; +pub const SOL_UDP: ::c_int = 17; +pub const SOL_IPV6: ::c_int = 41; +pub const SOL_ICMPV6: ::c_int = 58; +pub const SOL_RAW: ::c_int = 255; +pub const SOL_DECNET: ::c_int = 261; +pub const SOL_X25: ::c_int = 262; +pub const SOL_PACKET: ::c_int = 263; +pub const SOL_ATM: ::c_int = 264; +pub const SOL_AAL: ::c_int = 265; +pub const SOL_IRDA: ::c_int = 266; +pub const SOL_NETBEUI: ::c_int = 267; +pub const SOL_LLC: ::c_int = 268; +pub const SOL_DCCP: ::c_int = 269; +pub const SOL_NETLINK: ::c_int = 270; +pub const SOL_TIPC: ::c_int = 271; + +pub const AF_UNSPEC: ::c_int = 0; +pub const AF_UNIX: ::c_int = 1; +pub const AF_LOCAL: ::c_int = 1; +pub const AF_INET: ::c_int = 2; +pub const AF_AX25: ::c_int = 3; +pub const AF_IPX: ::c_int = 4; +pub const AF_APPLETALK: ::c_int = 5; +pub const AF_NETROM: ::c_int = 6; +pub const AF_BRIDGE: ::c_int = 7; +pub const AF_ATMPVC: ::c_int = 8; +pub const AF_X25: ::c_int = 9; +pub const AF_INET6: ::c_int = 10; +pub const AF_ROSE: ::c_int = 11; +pub const AF_DECnet: ::c_int = 12; +pub const AF_NETBEUI: ::c_int = 13; +pub const AF_SECURITY: ::c_int = 14; +pub const AF_KEY: ::c_int = 15; +pub const AF_NETLINK: ::c_int = 16; +pub const AF_ROUTE: ::c_int = AF_NETLINK; +pub const AF_PACKET: ::c_int = 17; +pub const AF_ASH: ::c_int = 18; +pub const AF_ECONET: ::c_int = 19; +pub const AF_ATMSVC: ::c_int = 20; +pub const AF_RDS: ::c_int = 21; +pub const AF_SNA: ::c_int = 22; +pub const AF_IRDA: ::c_int = 23; +pub const AF_PPPOX: ::c_int = 24; +pub const AF_WANPIPE: ::c_int = 25; +pub const AF_LLC: ::c_int = 26; +pub const AF_CAN: ::c_int = 29; +pub const AF_TIPC: ::c_int = 30; +pub const AF_BLUETOOTH: ::c_int = 31; +pub const AF_IUCV: ::c_int = 32; +pub const AF_RXRPC: ::c_int = 33; +pub const AF_ISDN: ::c_int = 34; +pub const AF_PHONET: ::c_int = 35; +pub const AF_IEEE802154: ::c_int = 36; +pub const AF_CAIF: ::c_int = 37; +pub const AF_ALG: ::c_int = 38; + +pub const PF_UNSPEC: ::c_int = AF_UNSPEC; +pub const PF_UNIX: ::c_int = AF_UNIX; +pub const PF_LOCAL: ::c_int = AF_LOCAL; +pub const PF_INET: ::c_int = AF_INET; +pub const PF_AX25: ::c_int = AF_AX25; +pub const PF_IPX: ::c_int = AF_IPX; +pub const PF_APPLETALK: ::c_int = AF_APPLETALK; +pub const PF_NETROM: ::c_int = AF_NETROM; +pub const PF_BRIDGE: ::c_int = AF_BRIDGE; +pub const PF_ATMPVC: ::c_int = AF_ATMPVC; +pub const PF_X25: ::c_int = AF_X25; +pub const PF_INET6: ::c_int = AF_INET6; +pub const PF_ROSE: ::c_int = AF_ROSE; +pub const PF_DECnet: ::c_int = AF_DECnet; +pub const PF_NETBEUI: ::c_int = AF_NETBEUI; +pub const PF_SECURITY: ::c_int = AF_SECURITY; +pub const PF_KEY: ::c_int = AF_KEY; +pub const PF_NETLINK: ::c_int = AF_NETLINK; +pub const PF_ROUTE: ::c_int = AF_ROUTE; +pub const PF_PACKET: ::c_int = AF_PACKET; +pub const PF_ASH: ::c_int = AF_ASH; +pub const PF_ECONET: ::c_int = AF_ECONET; +pub const PF_ATMSVC: ::c_int = AF_ATMSVC; +pub const PF_RDS: ::c_int = AF_RDS; +pub const PF_SNA: ::c_int = AF_SNA; +pub const PF_IRDA: ::c_int = AF_IRDA; +pub const PF_PPPOX: ::c_int = AF_PPPOX; +pub const PF_WANPIPE: ::c_int = AF_WANPIPE; +pub const PF_LLC: ::c_int = AF_LLC; +pub const PF_CAN: ::c_int = AF_CAN; +pub const PF_TIPC: ::c_int = AF_TIPC; +pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; +pub const PF_IUCV: ::c_int = AF_IUCV; +pub const PF_RXRPC: ::c_int = AF_RXRPC; +pub const PF_ISDN: ::c_int = AF_ISDN; +pub const PF_PHONET: ::c_int = AF_PHONET; +pub const PF_IEEE802154: ::c_int = AF_IEEE802154; +pub const PF_CAIF: ::c_int = AF_CAIF; +pub const PF_ALG: ::c_int = AF_ALG; + +pub const SOMAXCONN: ::c_int = 128; + +pub const MSG_OOB: ::c_int = 1; +pub const MSG_PEEK: ::c_int = 2; +pub const MSG_DONTROUTE: ::c_int = 4; +pub const MSG_CTRUNC: ::c_int = 8; +pub const MSG_TRUNC: ::c_int = 0x20; +pub const MSG_DONTWAIT: ::c_int = 0x40; +pub const MSG_EOR: ::c_int = 0x80; +pub const MSG_WAITALL: ::c_int = 0x100; +pub const MSG_FIN: ::c_int = 0x200; +pub const MSG_SYN: ::c_int = 0x400; +pub const MSG_CONFIRM: ::c_int = 0x800; +pub const MSG_RST: ::c_int = 0x1000; +pub const MSG_ERRQUEUE: ::c_int = 0x2000; +pub const MSG_NOSIGNAL: ::c_int = 0x4000; +pub const MSG_MORE: ::c_int = 0x8000; +pub const MSG_WAITFORONE: ::c_int = 0x10000; +pub const MSG_FASTOPEN: ::c_int = 0x20000000; +pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; + +pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; + +pub const SOCK_RAW: ::c_int = 3; +pub const SOCK_RDM: ::c_int = 4; +pub const IP_MULTICAST_IF: ::c_int = 32; +pub const IP_MULTICAST_TTL: ::c_int = 33; +pub const IP_MULTICAST_LOOP: ::c_int = 34; +pub const IP_TTL: ::c_int = 2; +pub const IP_HDRINCL: ::c_int = 3; +pub const IP_ADD_MEMBERSHIP: ::c_int = 35; +pub const IP_DROP_MEMBERSHIP: ::c_int = 36; +pub const IP_TRANSPARENT: ::c_int = 19; +pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; +pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; + +pub const TCP_NODELAY: ::c_int = 1; +pub const TCP_MAXSEG: ::c_int = 2; +pub const TCP_CORK: ::c_int = 3; +pub const TCP_KEEPIDLE: ::c_int = 4; +pub const TCP_KEEPINTVL: ::c_int = 5; +pub const TCP_KEEPCNT: ::c_int = 6; +pub const TCP_SYNCNT: ::c_int = 7; +pub const TCP_LINGER2: ::c_int = 8; +pub const TCP_DEFER_ACCEPT: ::c_int = 9; +pub const TCP_WINDOW_CLAMP: ::c_int = 10; +pub const TCP_INFO: ::c_int = 11; +pub const TCP_QUICKACK: ::c_int = 12; +pub const TCP_CONGESTION: ::c_int = 13; + +pub const IPV6_MULTICAST_LOOP: ::c_int = 19; +pub const IPV6_V6ONLY: ::c_int = 26; + +pub const SO_DEBUG: ::c_int = 1; + +pub const SHUT_RD: ::c_int = 0; +pub const SHUT_WR: ::c_int = 1; +pub const SHUT_RDWR: ::c_int = 2; + +pub const LOCK_SH: ::c_int = 1; +pub const LOCK_EX: ::c_int = 2; +pub const LOCK_NB: ::c_int = 4; +pub const LOCK_UN: ::c_int = 8; + +pub const SS_ONSTACK: ::c_int = 1; +pub const SS_DISABLE: ::c_int = 2; + +pub const PATH_MAX: ::c_int = 4096; + +pub const FD_SETSIZE: usize = 1024; + +pub const EPOLLIN: ::c_int = 0x1; +pub const EPOLLPRI: ::c_int = 0x2; +pub const EPOLLOUT: ::c_int = 0x4; +pub const EPOLLRDNORM: ::c_int = 0x40; +pub const EPOLLRDBAND: ::c_int = 0x80; +pub const EPOLLWRNORM: ::c_int = 0x100; +pub const EPOLLWRBAND: ::c_int = 0x200; +pub const EPOLLMSG: ::c_int = 0x400; +pub const EPOLLERR: ::c_int = 0x8; +pub const EPOLLHUP: ::c_int = 0x10; +pub const EPOLLET: ::c_int = 0x80000000; + +pub const EPOLL_CTL_ADD: ::c_int = 1; +pub const EPOLL_CTL_MOD: ::c_int = 3; +pub const EPOLL_CTL_DEL: ::c_int = 2; + +pub const MNT_DETACH: ::c_int = 0x2; +pub const MNT_EXPIRE: ::c_int = 0x4; + +pub const Q_GETFMT: ::c_int = 0x800004; +pub const Q_GETINFO: ::c_int = 0x800005; +pub const Q_SETINFO: ::c_int = 0x800006; +pub const QIF_BLIMITS: ::uint32_t = 1; +pub const QIF_SPACE: ::uint32_t = 2; +pub const QIF_ILIMITS: ::uint32_t = 4; +pub const QIF_INODES: ::uint32_t = 8; +pub const QIF_BTIME: ::uint32_t = 16; +pub const QIF_ITIME: ::uint32_t = 32; +pub const QIF_LIMITS: ::uint32_t = 5; +pub const QIF_USAGE: ::uint32_t = 10; +pub const QIF_TIMES: ::uint32_t = 48; +pub const QIF_ALL: ::uint32_t = 63; + +pub const MNT_FORCE: ::c_int = 0x1; + +pub const Q_SYNC: ::c_int = 0x800001; +pub const Q_QUOTAON: ::c_int = 0x800002; +pub const Q_QUOTAOFF: ::c_int = 0x800003; +pub const Q_GETQUOTA: ::c_int = 0x800007; +pub const Q_SETQUOTA: ::c_int = 0x800008; + +pub const TCIOFF: ::c_int = 2; +pub const TCION: ::c_int = 3; +pub const TCOOFF: ::c_int = 0; +pub const TCOON: ::c_int = 1; +pub const TCIFLUSH: ::c_int = 0; +pub const TCOFLUSH: ::c_int = 1; +pub const TCIOFLUSH: ::c_int = 2; +pub const NL0: ::c_int = 0x00000000; +pub const NL1: ::c_int = 0x00000100; +pub const TAB0: ::c_int = 0x00000000; +pub const CR0: ::c_int = 0x00000000; +pub const FF0: ::c_int = 0x00000000; +pub const BS0: ::c_int = 0x00000000; +pub const VT0: ::c_int = 0x00000000; +pub const VERASE: usize = 2; +pub const VKILL: usize = 3; +pub const VINTR: usize = 0; +pub const VQUIT: usize = 1; +pub const VLNEXT: usize = 15; +pub const IGNBRK: ::tcflag_t = 0x00000001; +pub const BRKINT: ::tcflag_t = 0x00000002; +pub const IGNPAR: ::tcflag_t = 0x00000004; +pub const PARMRK: ::tcflag_t = 0x00000008; +pub const INPCK: ::tcflag_t = 0x00000010; +pub const ISTRIP: ::tcflag_t = 0x00000020; +pub const INLCR: ::tcflag_t = 0x00000040; +pub const IGNCR: ::tcflag_t = 0x00000080; +pub const ICRNL: ::tcflag_t = 0x00000100; +pub const IXANY: ::tcflag_t = 0x00000800; +pub const IMAXBEL: ::tcflag_t = 0x00002000; +pub const OPOST: ::tcflag_t = 0x1; +pub const CS5: ::tcflag_t = 0x00000000; +pub const CRTSCTS: ::tcflag_t = 0x80000000; +pub const ECHO: ::tcflag_t = 0x00000008; +pub const OCRNL: ::tcflag_t = 0o000010; +pub const ONOCR: ::tcflag_t = 0o000020; +pub const ONLRET: ::tcflag_t = 0o000040; +pub const OFILL: ::tcflag_t = 0o000100; +pub const OFDEL: ::tcflag_t = 0o000200; + +pub const CLONE_VM: ::c_int = 0x100; +pub const CLONE_FS: ::c_int = 0x200; +pub const CLONE_FILES: ::c_int = 0x400; +pub const CLONE_SIGHAND: ::c_int = 0x800; +pub const CLONE_PTRACE: ::c_int = 0x2000; +pub const CLONE_VFORK: ::c_int = 0x4000; +pub const CLONE_PARENT: ::c_int = 0x8000; +pub const CLONE_THREAD: ::c_int = 0x10000; +pub const CLONE_NEWNS: ::c_int = 0x20000; +pub const CLONE_SYSVSEM: ::c_int = 0x40000; +pub const CLONE_SETTLS: ::c_int = 0x80000; +pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; +pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; +pub const CLONE_DETACHED: ::c_int = 0x400000; +pub const CLONE_UNTRACED: ::c_int = 0x800000; +pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; +pub const CLONE_NEWUTS: ::c_int = 0x04000000; +pub const CLONE_NEWIPC: ::c_int = 0x08000000; +pub const CLONE_NEWUSER: ::c_int = 0x10000000; +pub const CLONE_NEWPID: ::c_int = 0x20000000; +pub const CLONE_NEWNET: ::c_int = 0x40000000; +pub const CLONE_IO: ::c_int = 0x80000000; +pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; + +pub const WNOHANG: ::c_int = 0x00000001; +pub const WUNTRACED: ::c_int = 0x00000002; +pub const WSTOPPED: ::c_int = WUNTRACED; +pub const WEXITED: ::c_int = 0x00000004; +pub const WCONTINUED: ::c_int = 0x00000008; +pub const WNOWAIT: ::c_int = 0x01000000; + +// Options set using PTRACE_SETOPTIONS. +pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; +pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; +pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; +pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008; +pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; +pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; +pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; +pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; +pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; +pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; +pub const PTRACE_O_MASK: ::c_int = 0x003000ff; + +// Wait extended result codes for the above trace options. +pub const PTRACE_EVENT_FORK: ::c_int = 1; +pub const PTRACE_EVENT_VFORK: ::c_int = 2; +pub const PTRACE_EVENT_CLONE: ::c_int = 3; +pub const PTRACE_EVENT_EXEC: ::c_int = 4; +pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5; +pub const PTRACE_EVENT_EXIT: ::c_int = 6; +pub const PTRACE_EVENT_SECCOMP: ::c_int = 7; +// PTRACE_EVENT_STOP was added to glibc in 2.26 +// pub const PTRACE_EVENT_STOP: ::c_int = 128; + +pub const __WNOTHREAD: ::c_int = 0x20000000; +pub const __WALL: ::c_int = 0x40000000; +pub const __WCLONE: ::c_int = 0x80000000; + +pub const SPLICE_F_MOVE: ::c_uint = 0x01; +pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; +pub const SPLICE_F_MORE: ::c_uint = 0x04; +pub const SPLICE_F_GIFT: ::c_uint = 0x08; + +pub const RTLD_LOCAL: ::c_int = 0; +pub const RTLD_LAZY: ::c_int = 1; + +pub const POSIX_FADV_NORMAL: ::c_int = 0; +pub const POSIX_FADV_RANDOM: ::c_int = 1; +pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_FADV_WILLNEED: ::c_int = 3; + +pub const AT_FDCWD: ::c_int = -100; +pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; +pub const AT_REMOVEDIR: ::c_int = 0x200; +pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; +pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; +pub const AT_EMPTY_PATH: ::c_int = 0x1000; + +pub const LOG_CRON: ::c_int = 9 << 3; +pub const LOG_AUTHPRIV: ::c_int = 10 << 3; +pub const LOG_FTP: ::c_int = 11 << 3; +pub const LOG_PERROR: ::c_int = 0x20; + +pub const PIPE_BUF: usize = 4096; + +pub const SI_LOAD_SHIFT: ::c_uint = 16; + +pub const SIGEV_SIGNAL: ::c_int = 0; +pub const SIGEV_NONE: ::c_int = 1; +pub const SIGEV_THREAD: ::c_int = 2; + +pub const P_ALL: idtype_t = 0; +pub const P_PID: idtype_t = 1; +pub const P_PGID: idtype_t = 2; + +pub const UTIME_OMIT: c_long = 1073741822; +pub const UTIME_NOW: c_long = 1073741823; + +pub const POLLIN: ::c_short = 0x1; +pub const POLLPRI: ::c_short = 0x2; +pub const POLLOUT: ::c_short = 0x4; +pub const POLLERR: ::c_short = 0x8; +pub const POLLHUP: ::c_short = 0x10; +pub const POLLNVAL: ::c_short = 0x20; +pub const POLLRDNORM: ::c_short = 0x040; +pub const POLLRDBAND: ::c_short = 0x080; + +pub const ABDAY_1: ::nl_item = 0x20000; +pub const ABDAY_2: ::nl_item = 0x20001; +pub const ABDAY_3: ::nl_item = 0x20002; +pub const ABDAY_4: ::nl_item = 0x20003; +pub const ABDAY_5: ::nl_item = 0x20004; +pub const ABDAY_6: ::nl_item = 0x20005; +pub const ABDAY_7: ::nl_item = 0x20006; + +pub const DAY_1: ::nl_item = 0x20007; +pub const DAY_2: ::nl_item = 0x20008; +pub const DAY_3: ::nl_item = 0x20009; +pub const DAY_4: ::nl_item = 0x2000A; +pub const DAY_5: ::nl_item = 0x2000B; +pub const DAY_6: ::nl_item = 0x2000C; +pub const DAY_7: ::nl_item = 0x2000D; + +pub const ABMON_1: ::nl_item = 0x2000E; +pub const ABMON_2: ::nl_item = 0x2000F; +pub const ABMON_3: ::nl_item = 0x20010; +pub const ABMON_4: ::nl_item = 0x20011; +pub const ABMON_5: ::nl_item = 0x20012; +pub const ABMON_6: ::nl_item = 0x20013; +pub const ABMON_7: ::nl_item = 0x20014; +pub const ABMON_8: ::nl_item = 0x20015; +pub const ABMON_9: ::nl_item = 0x20016; +pub const ABMON_10: ::nl_item = 0x20017; +pub const ABMON_11: ::nl_item = 0x20018; +pub const ABMON_12: ::nl_item = 0x20019; + +pub const MON_1: ::nl_item = 0x2001A; +pub const MON_2: ::nl_item = 0x2001B; +pub const MON_3: ::nl_item = 0x2001C; +pub const MON_4: ::nl_item = 0x2001D; +pub const MON_5: ::nl_item = 0x2001E; +pub const MON_6: ::nl_item = 0x2001F; +pub const MON_7: ::nl_item = 0x20020; +pub const MON_8: ::nl_item = 0x20021; +pub const MON_9: ::nl_item = 0x20022; +pub const MON_10: ::nl_item = 0x20023; +pub const MON_11: ::nl_item = 0x20024; +pub const MON_12: ::nl_item = 0x20025; + +pub const AM_STR: ::nl_item = 0x20026; +pub const PM_STR: ::nl_item = 0x20027; + +pub const D_T_FMT: ::nl_item = 0x20028; +pub const D_FMT: ::nl_item = 0x20029; +pub const T_FMT: ::nl_item = 0x2002A; +pub const T_FMT_AMPM: ::nl_item = 0x2002B; + +pub const ERA: ::nl_item = 0x2002C; +pub const ERA_D_FMT: ::nl_item = 0x2002E; +pub const ALT_DIGITS: ::nl_item = 0x2002F; +pub const ERA_D_T_FMT: ::nl_item = 0x20030; +pub const ERA_T_FMT: ::nl_item = 0x20031; + +pub const CODESET: ::nl_item = 14; + +pub const CRNCYSTR: ::nl_item = 0x4000F; + +pub const RUSAGE_THREAD: ::c_int = 1; +pub const RUSAGE_CHILDREN: ::c_int = -1; + +pub const RADIXCHAR: ::nl_item = 0x10000; +pub const THOUSEP: ::nl_item = 0x10001; + +pub const YESEXPR: ::nl_item = 0x50000; +pub const NOEXPR: ::nl_item = 0x50001; +pub const YESSTR: ::nl_item = 0x50002; +pub const NOSTR: ::nl_item = 0x50003; + +pub const FILENAME_MAX: ::c_uint = 4096; +pub const L_tmpnam: ::c_uint = 20; +pub const _PC_LINK_MAX: ::c_int = 0; +pub const _PC_MAX_CANON: ::c_int = 1; +pub const _PC_MAX_INPUT: ::c_int = 2; +pub const _PC_NAME_MAX: ::c_int = 3; +pub const _PC_PATH_MAX: ::c_int = 4; +pub const _PC_PIPE_BUF: ::c_int = 5; +pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; +pub const _PC_NO_TRUNC: ::c_int = 7; +pub const _PC_VDISABLE: ::c_int = 8; +pub const _PC_SYNC_IO: ::c_int = 9; +pub const _PC_ASYNC_IO: ::c_int = 10; +pub const _PC_PRIO_IO: ::c_int = 11; +pub const _PC_SOCK_MAXBUF: ::c_int = 12; +pub const _PC_FILESIZEBITS: ::c_int = 13; +pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; +pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; +pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; +pub const _PC_REC_XFER_ALIGN: ::c_int = 17; +pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; +pub const _PC_SYMLINK_MAX: ::c_int = 19; +pub const _PC_2_SYMLINKS: ::c_int = 20; + +pub const _SC_ARG_MAX: ::c_int = 0; +pub const _SC_CHILD_MAX: ::c_int = 1; +pub const _SC_CLK_TCK: ::c_int = 2; +pub const _SC_NGROUPS_MAX: ::c_int = 3; +pub const _SC_OPEN_MAX: ::c_int = 4; +pub const _SC_STREAM_MAX: ::c_int = 5; +pub const _SC_TZNAME_MAX: ::c_int = 6; +pub const _SC_JOB_CONTROL: ::c_int = 7; +pub const _SC_SAVED_IDS: ::c_int = 8; +pub const _SC_REALTIME_SIGNALS: ::c_int = 9; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; +pub const _SC_TIMERS: ::c_int = 11; +pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; +pub const _SC_PRIORITIZED_IO: ::c_int = 13; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; +pub const _SC_FSYNC: ::c_int = 15; +pub const _SC_MAPPED_FILES: ::c_int = 16; +pub const _SC_MEMLOCK: ::c_int = 17; +pub const _SC_MEMLOCK_RANGE: ::c_int = 18; +pub const _SC_MEMORY_PROTECTION: ::c_int = 19; +pub const _SC_MESSAGE_PASSING: ::c_int = 20; +pub const _SC_SEMAPHORES: ::c_int = 21; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; +pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; +pub const _SC_AIO_MAX: ::c_int = 24; +pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; +pub const _SC_DELAYTIMER_MAX: ::c_int = 26; +pub const _SC_MQ_OPEN_MAX: ::c_int = 27; +pub const _SC_MQ_PRIO_MAX: ::c_int = 28; +pub const _SC_VERSION: ::c_int = 29; +pub const _SC_PAGESIZE: ::c_int = 30; +pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; +pub const _SC_RTSIG_MAX: ::c_int = 31; +pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; +pub const _SC_SEM_VALUE_MAX: ::c_int = 33; +pub const _SC_SIGQUEUE_MAX: ::c_int = 34; +pub const _SC_TIMER_MAX: ::c_int = 35; +pub const _SC_BC_BASE_MAX: ::c_int = 36; +pub const _SC_BC_DIM_MAX: ::c_int = 37; +pub const _SC_BC_SCALE_MAX: ::c_int = 38; +pub const _SC_BC_STRING_MAX: ::c_int = 39; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; +pub const _SC_EXPR_NEST_MAX: ::c_int = 42; +pub const _SC_LINE_MAX: ::c_int = 43; +pub const _SC_RE_DUP_MAX: ::c_int = 44; +pub const _SC_2_VERSION: ::c_int = 46; +pub const _SC_2_C_BIND: ::c_int = 47; +pub const _SC_2_C_DEV: ::c_int = 48; +pub const _SC_2_FORT_DEV: ::c_int = 49; +pub const _SC_2_FORT_RUN: ::c_int = 50; +pub const _SC_2_SW_DEV: ::c_int = 51; +pub const _SC_2_LOCALEDEF: ::c_int = 52; +pub const _SC_UIO_MAXIOV: ::c_int = 60; +pub const _SC_IOV_MAX: ::c_int = 60; +pub const _SC_THREADS: ::c_int = 67; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; +pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; +pub const _SC_TTY_NAME_MAX: ::c_int = 72; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; +pub const _SC_THREAD_STACK_MIN: ::c_int = 75; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; +pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; +pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; +pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82; +pub const _SC_NPROCESSORS_CONF: ::c_int = 83; +pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; +pub const _SC_PHYS_PAGES: ::c_int = 85; +pub const _SC_AVPHYS_PAGES: ::c_int = 86; +pub const _SC_ATEXIT_MAX: ::c_int = 87; +pub const _SC_PASS_MAX: ::c_int = 88; +pub const _SC_XOPEN_VERSION: ::c_int = 89; +pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; +pub const _SC_XOPEN_UNIX: ::c_int = 91; +pub const _SC_XOPEN_CRYPT: ::c_int = 92; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; +pub const _SC_XOPEN_SHM: ::c_int = 94; +pub const _SC_2_CHAR_TERM: ::c_int = 95; +pub const _SC_2_UPE: ::c_int = 97; +pub const _SC_XOPEN_XPG2: ::c_int = 98; +pub const _SC_XOPEN_XPG3: ::c_int = 99; +pub const _SC_XOPEN_XPG4: ::c_int = 100; +pub const _SC_NZERO: ::c_int = 109; +pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; +pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; +pub const _SC_XBS5_LP64_OFF64: ::c_int = 127; +pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; +pub const _SC_XOPEN_LEGACY: ::c_int = 129; +pub const _SC_XOPEN_REALTIME: ::c_int = 130; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; +pub const _SC_ADVISORY_INFO: ::c_int = 132; +pub const _SC_BARRIERS: ::c_int = 133; +pub const _SC_CLOCK_SELECTION: ::c_int = 137; +pub const _SC_CPUTIME: ::c_int = 138; +pub const _SC_THREAD_CPUTIME: ::c_int = 139; +pub const _SC_MONOTONIC_CLOCK: ::c_int = 149; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 153; +pub const _SC_SPIN_LOCKS: ::c_int = 154; +pub const _SC_REGEXP: ::c_int = 155; +pub const _SC_SHELL: ::c_int = 157; +pub const _SC_SPAWN: ::c_int = 159; +pub const _SC_SPORADIC_SERVER: ::c_int = 160; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161; +pub const _SC_TIMEOUTS: ::c_int = 164; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165; +pub const _SC_2_PBS: ::c_int = 168; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169; +pub const _SC_2_PBS_LOCATE: ::c_int = 170; +pub const _SC_2_PBS_MESSAGE: ::c_int = 171; +pub const _SC_2_PBS_TRACK: ::c_int = 172; +pub const _SC_SYMLOOP_MAX: ::c_int = 173; +pub const _SC_STREAMS: ::c_int = 174; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175; +pub const _SC_V6_ILP32_OFF32: ::c_int = 176; +pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177; +pub const _SC_V6_LP64_OFF64: ::c_int = 178; +pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179; +pub const _SC_HOST_NAME_MAX: ::c_int = 180; +pub const _SC_TRACE: ::c_int = 181; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182; +pub const _SC_TRACE_INHERIT: ::c_int = 183; +pub const _SC_TRACE_LOG: ::c_int = 184; +pub const _SC_IPV6: ::c_int = 235; +pub const _SC_RAW_SOCKETS: ::c_int = 236; +pub const _SC_V7_ILP32_OFF32: ::c_int = 237; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238; +pub const _SC_V7_LP64_OFF64: ::c_int = 239; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240; +pub const _SC_SS_REPL_MAX: ::c_int = 241; +pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242; +pub const _SC_TRACE_NAME_MAX: ::c_int = 243; +pub const _SC_TRACE_SYS_MAX: ::c_int = 244; +pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245; +pub const _SC_XOPEN_STREAMS: ::c_int = 246; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248; + +pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; +pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; + +pub const GLOB_ERR: ::c_int = 1 << 0; +pub const GLOB_MARK: ::c_int = 1 << 1; +pub const GLOB_NOSORT: ::c_int = 1 << 2; +pub const GLOB_DOOFFS: ::c_int = 1 << 3; +pub const GLOB_NOCHECK: ::c_int = 1 << 4; +pub const GLOB_APPEND: ::c_int = 1 << 5; +pub const GLOB_NOESCAPE: ::c_int = 1 << 6; + +pub const GLOB_NOSPACE: ::c_int = 1; +pub const GLOB_ABORTED: ::c_int = 2; +pub const GLOB_NOMATCH: ::c_int = 3; + +pub const POSIX_MADV_NORMAL: ::c_int = 0; +pub const POSIX_MADV_RANDOM: ::c_int = 1; +pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_MADV_WILLNEED: ::c_int = 3; + +pub const S_IEXEC: mode_t = 64; +pub const S_IWRITE: mode_t = 128; +pub const S_IREAD: mode_t = 256; + +pub const F_LOCK: ::c_int = 1; +pub const F_TEST: ::c_int = 3; +pub const F_TLOCK: ::c_int = 2; +pub const F_ULOCK: ::c_int = 0; + +pub const IFF_LOWER_UP: ::c_int = 0x10000; +pub const IFF_DORMANT: ::c_int = 0x20000; +pub const IFF_ECHO: ::c_int = 0x40000; + +pub const ST_RDONLY: ::c_ulong = 1; +pub const ST_NOSUID: ::c_ulong = 2; +pub const ST_NODEV: ::c_ulong = 4; +pub const ST_NOEXEC: ::c_ulong = 8; +pub const ST_SYNCHRONOUS: ::c_ulong = 16; +pub const ST_MANDLOCK: ::c_ulong = 64; +pub const ST_WRITE: ::c_ulong = 128; +pub const ST_APPEND: ::c_ulong = 256; +pub const ST_IMMUTABLE: ::c_ulong = 512; +pub const ST_NOATIME: ::c_ulong = 1024; +pub const ST_NODIRATIME: ::c_ulong = 2048; + +pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; +pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; +pub const RTLD_NODELETE: ::c_int = 0x1000; +pub const RTLD_NOW: ::c_int = 0x2; + +pub const TCP_MD5SIG: ::c_int = 14; + +pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + __align: [], + size: [0; __SIZEOF_PTHREAD_MUTEX_T], +}; +pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + __align: [], + size: [0; __SIZEOF_PTHREAD_COND_T], +}; +pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + __align: [], + size: [0; __SIZEOF_PTHREAD_RWLOCK_T], +}; +pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; +pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; +pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; +pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; +pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; +pub const __SIZEOF_PTHREAD_COND_T: usize = 48; + +pub const RENAME_NOREPLACE: ::c_int = 1; +pub const RENAME_EXCHANGE: ::c_int = 2; +pub const RENAME_WHITEOUT: ::c_int = 4; + +pub const SCHED_OTHER: ::c_int = 0; +pub const SCHED_FIFO: ::c_int = 1; +pub const SCHED_RR: ::c_int = 2; +pub const SCHED_BATCH: ::c_int = 3; +pub const SCHED_IDLE: ::c_int = 5; + +// netinet/in.h +// NOTE: These are in addition to the constants defined in src/unix/mod.rs + +// IPPROTO_IP defined in src/unix/mod.rs +/// Hop-by-hop option header +pub const IPPROTO_HOPOPTS: ::c_int = 0; +// IPPROTO_ICMP defined in src/unix/mod.rs +/// group mgmt protocol +pub const IPPROTO_IGMP: ::c_int = 2; +/// for compatibility +pub const IPPROTO_IPIP: ::c_int = 4; +// IPPROTO_TCP defined in src/unix/mod.rs +/// exterior gateway protocol +pub const IPPROTO_EGP: ::c_int = 8; +/// pup +pub const IPPROTO_PUP: ::c_int = 12; +// IPPROTO_UDP defined in src/unix/mod.rs +/// xns idp +pub const IPPROTO_IDP: ::c_int = 22; +/// tp-4 w/ class negotiation +pub const IPPROTO_TP: ::c_int = 29; +/// DCCP +pub const IPPROTO_DCCP: ::c_int = 33; +// IPPROTO_IPV6 defined in src/unix/mod.rs +/// IP6 routing header +pub const IPPROTO_ROUTING: ::c_int = 43; +/// IP6 fragmentation header +pub const IPPROTO_FRAGMENT: ::c_int = 44; +/// resource reservation +pub const IPPROTO_RSVP: ::c_int = 46; +/// General Routing Encap. +pub const IPPROTO_GRE: ::c_int = 47; +/// IP6 Encap Sec. Payload +pub const IPPROTO_ESP: ::c_int = 50; +/// IP6 Auth Header +pub const IPPROTO_AH: ::c_int = 51; +// IPPROTO_ICMPV6 defined in src/unix/mod.rs +/// IP6 no next header +pub const IPPROTO_NONE: ::c_int = 59; +/// IP6 destination option +pub const IPPROTO_DSTOPTS: ::c_int = 60; +pub const IPPROTO_MTP: ::c_int = 92; +pub const IPPROTO_BEETPH: ::c_int = 94; +/// encapsulation header +pub const IPPROTO_ENCAP: ::c_int = 98; +/// Protocol indep. multicast +pub const IPPROTO_PIM: ::c_int = 103; +/// IP Payload Comp. Protocol +pub const IPPROTO_COMP: ::c_int = 108; +/// SCTP +pub const IPPROTO_SCTP: ::c_int = 132; +pub const IPPROTO_MH: ::c_int = 135; +pub const IPPROTO_UDPLITE: ::c_int = 136; +pub const IPPROTO_MPLS: ::c_int = 137; +/// raw IP packet +pub const IPPROTO_RAW: ::c_int = 255; +pub const IPPROTO_MAX: ::c_int = 256; + +pub const AF_IB: ::c_int = 27; +pub const AF_MPLS: ::c_int = 28; +pub const AF_NFC: ::c_int = 39; +pub const AF_VSOCK: ::c_int = 40; +pub const PF_IB: ::c_int = AF_IB; +pub const PF_MPLS: ::c_int = AF_MPLS; +pub const PF_NFC: ::c_int = AF_NFC; +pub const PF_VSOCK: ::c_int = AF_VSOCK; + +// System V IPC +pub const IPC_PRIVATE: ::key_t = 0; + +pub const IPC_CREAT: ::c_int = 0o1000; +pub const IPC_EXCL: ::c_int = 0o2000; +pub const IPC_NOWAIT: ::c_int = 0o4000; + +pub const IPC_RMID: ::c_int = 0; +pub const IPC_SET: ::c_int = 1; +pub const IPC_STAT: ::c_int = 2; +pub const IPC_INFO: ::c_int = 3; +pub const MSG_STAT: ::c_int = 11; +pub const MSG_INFO: ::c_int = 12; + +pub const MSG_NOERROR: ::c_int = 0o10000; +pub const MSG_EXCEPT: ::c_int = 0o20000; +pub const MSG_COPY: ::c_int = 0o40000; + +pub const SHM_R: ::c_int = 0o400; +pub const SHM_W: ::c_int = 0o200; + +pub const SHM_RDONLY: ::c_int = 0o10000; +pub const SHM_RND: ::c_int = 0o20000; +pub const SHM_REMAP: ::c_int = 0o40000; +pub const SHM_EXEC: ::c_int = 0o100000; + +pub const SHM_LOCK: ::c_int = 11; +pub const SHM_UNLOCK: ::c_int = 12; + +pub const SHM_HUGETLB: ::c_int = 0o4000; +pub const SHM_NORESERVE: ::c_int = 0o10000; + +pub const EPOLLRDHUP: ::c_int = 0x2000; +pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; +pub const EPOLLONESHOT: ::c_int = 0x40000000; + +pub const QFMT_VFS_OLD: ::c_int = 1; +pub const QFMT_VFS_V0: ::c_int = 2; +pub const QFMT_VFS_V1: ::c_int = 4; + +pub const EFD_SEMAPHORE: ::c_int = 0x1; + +pub const LOG_NFACILITIES: ::c_int = 24; + +pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; + +pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; +pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; +pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; +pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; +pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; +pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; +pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; + +pub const AI_PASSIVE: ::c_int = 0x0001; +pub const AI_CANONNAME: ::c_int = 0x0002; +pub const AI_NUMERICHOST: ::c_int = 0x0004; +pub const AI_V4MAPPED: ::c_int = 0x0008; +pub const AI_ALL: ::c_int = 0x0010; +pub const AI_ADDRCONFIG: ::c_int = 0x0020; + +pub const AI_NUMERICSERV: ::c_int = 0x0400; + +pub const EAI_BADFLAGS: ::c_int = -1; +pub const EAI_NONAME: ::c_int = -2; +pub const EAI_AGAIN: ::c_int = -3; +pub const EAI_FAIL: ::c_int = -4; +pub const EAI_FAMILY: ::c_int = -6; +pub const EAI_SOCKTYPE: ::c_int = -7; +pub const EAI_SERVICE: ::c_int = -8; +pub const EAI_MEMORY: ::c_int = -10; +pub const EAI_OVERFLOW: ::c_int = -12; + +pub const NI_NUMERICHOST: ::c_int = 1; +pub const NI_NUMERICSERV: ::c_int = 2; +pub const NI_NOFQDN: ::c_int = 4; +pub const NI_NAMEREQD: ::c_int = 8; +pub const NI_DGRAM: ::c_int = 16; + +pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; +pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; +pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; + +pub const EAI_SYSTEM: ::c_int = -11; + +pub const AIO_CANCELED: ::c_int = 0; +pub const AIO_NOTCANCELED: ::c_int = 1; +pub const AIO_ALLDONE: ::c_int = 2; +pub const LIO_READ: ::c_int = 0; +pub const LIO_WRITE: ::c_int = 1; +pub const LIO_NOP: ::c_int = 2; +pub const LIO_WAIT: ::c_int = 0; +pub const LIO_NOWAIT: ::c_int = 1; + +pub const MREMAP_MAYMOVE: ::c_int = 1; +pub const MREMAP_FIXED: ::c_int = 2; + +pub const PR_SET_PDEATHSIG: ::c_int = 1; +pub const PR_GET_PDEATHSIG: ::c_int = 2; + +pub const PR_GET_DUMPABLE: ::c_int = 3; +pub const PR_SET_DUMPABLE: ::c_int = 4; + +pub const PR_GET_UNALIGN: ::c_int = 5; +pub const PR_SET_UNALIGN: ::c_int = 6; +pub const PR_UNALIGN_NOPRINT: ::c_int = 1; +pub const PR_UNALIGN_SIGBUS: ::c_int = 2; + +pub const PR_GET_KEEPCAPS: ::c_int = 7; +pub const PR_SET_KEEPCAPS: ::c_int = 8; + +pub const PR_GET_FPEMU: ::c_int = 9; +pub const PR_SET_FPEMU: ::c_int = 10; +pub const PR_FPEMU_NOPRINT: ::c_int = 1; +pub const PR_FPEMU_SIGFPE: ::c_int = 2; + +pub const PR_GET_FPEXC: ::c_int = 11; +pub const PR_SET_FPEXC: ::c_int = 12; +pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80; +pub const PR_FP_EXC_DIV: ::c_int = 0x010000; +pub const PR_FP_EXC_OVF: ::c_int = 0x020000; +pub const PR_FP_EXC_UND: ::c_int = 0x040000; +pub const PR_FP_EXC_RES: ::c_int = 0x080000; +pub const PR_FP_EXC_INV: ::c_int = 0x100000; +pub const PR_FP_EXC_DISABLED: ::c_int = 0; +pub const PR_FP_EXC_NONRECOV: ::c_int = 1; +pub const PR_FP_EXC_ASYNC: ::c_int = 2; +pub const PR_FP_EXC_PRECISE: ::c_int = 3; + +pub const PR_GET_TIMING: ::c_int = 13; +pub const PR_SET_TIMING: ::c_int = 14; +pub const PR_TIMING_STATISTICAL: ::c_int = 0; +pub const PR_TIMING_TIMESTAMP: ::c_int = 1; + +pub const PR_SET_NAME: ::c_int = 15; +pub const PR_GET_NAME: ::c_int = 16; + +pub const PR_GET_ENDIAN: ::c_int = 19; +pub const PR_SET_ENDIAN: ::c_int = 20; +pub const PR_ENDIAN_BIG: ::c_int = 0; +pub const PR_ENDIAN_LITTLE: ::c_int = 1; +pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2; + +pub const PR_GET_SECCOMP: ::c_int = 21; +pub const PR_SET_SECCOMP: ::c_int = 22; + +pub const PR_CAPBSET_READ: ::c_int = 23; +pub const PR_CAPBSET_DROP: ::c_int = 24; + +pub const PR_GET_TSC: ::c_int = 25; +pub const PR_SET_TSC: ::c_int = 26; +pub const PR_TSC_ENABLE: ::c_int = 1; +pub const PR_TSC_SIGSEGV: ::c_int = 2; + +pub const PR_GET_SECUREBITS: ::c_int = 27; +pub const PR_SET_SECUREBITS: ::c_int = 28; + +pub const PR_SET_TIMERSLACK: ::c_int = 29; +pub const PR_GET_TIMERSLACK: ::c_int = 30; + +pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31; +pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32; + +pub const PR_MCE_KILL: ::c_int = 33; +pub const PR_MCE_KILL_CLEAR: ::c_int = 0; +pub const PR_MCE_KILL_SET: ::c_int = 1; + +pub const PR_MCE_KILL_LATE: ::c_int = 0; +pub const PR_MCE_KILL_EARLY: ::c_int = 1; +pub const PR_MCE_KILL_DEFAULT: ::c_int = 2; + +pub const PR_MCE_KILL_GET: ::c_int = 34; + +pub const PR_SET_MM: ::c_int = 35; +pub const PR_SET_MM_START_CODE: ::c_int = 1; +pub const PR_SET_MM_END_CODE: ::c_int = 2; +pub const PR_SET_MM_START_DATA: ::c_int = 3; +pub const PR_SET_MM_END_DATA: ::c_int = 4; +pub const PR_SET_MM_START_STACK: ::c_int = 5; +pub const PR_SET_MM_START_BRK: ::c_int = 6; +pub const PR_SET_MM_BRK: ::c_int = 7; +pub const PR_SET_MM_ARG_START: ::c_int = 8; +pub const PR_SET_MM_ARG_END: ::c_int = 9; +pub const PR_SET_MM_ENV_START: ::c_int = 10; +pub const PR_SET_MM_ENV_END: ::c_int = 11; +pub const PR_SET_MM_AUXV: ::c_int = 12; +pub const PR_SET_MM_EXE_FILE: ::c_int = 13; +pub const PR_SET_MM_MAP: ::c_int = 14; +pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; + +pub const PR_SET_PTRACER: ::c_int = 0x59616d61; + +pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; +pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; + +pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38; +pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39; + +pub const PR_GET_TID_ADDRESS: ::c_int = 40; + +pub const PR_SET_THP_DISABLE: ::c_int = 41; +pub const PR_GET_THP_DISABLE: ::c_int = 42; + +pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43; +pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44; + +pub const PR_SET_FP_MODE: ::c_int = 45; +pub const PR_GET_FP_MODE: ::c_int = 46; +pub const PR_FP_MODE_FR: ::c_int = 1 << 0; +pub const PR_FP_MODE_FRE: ::c_int = 1 << 1; + +pub const PR_CAP_AMBIENT: ::c_int = 47; +pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1; +pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; +pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; +pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; + +pub const GRND_NONBLOCK: ::c_uint = 0x0001; +pub const GRND_RANDOM: ::c_uint = 0x0002; + +pub const ITIMER_REAL: ::c_int = 0; +pub const ITIMER_VIRTUAL: ::c_int = 1; +pub const ITIMER_PROF: ::c_int = 2; + +pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; +pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK; +pub const TFD_TIMER_ABSTIME: ::c_int = 1; + +pub const XATTR_CREATE: ::c_int = 0x1; +pub const XATTR_REPLACE: ::c_int = 0x2; + +pub const _POSIX_VDISABLE: ::cc_t = 0; + +pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; +pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; +pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08; +pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10; +pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20; +pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40; + +// On Linux, libc doesn't define this constant, libattr does instead. +// We still define it for Linux as it's defined by libc on other platforms, +// and it's mentioned in the man pages for getxattr and setxattr. +pub const ENOATTR: ::c_int = ::ENODATA; + +pub const SO_ORIGINAL_DST: ::c_int = 80; +pub const IUTF8: ::tcflag_t = 0x00004000; +pub const CMSPAR: ::tcflag_t = 0o10000000000; + +pub const MFD_CLOEXEC: ::c_uint = 0x0001; +pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; + +// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has +// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32 +// so we can use that type here to avoid having to cast. +pub const PT_NULL: u32 = 0; +pub const PT_LOAD: u32 = 1; +pub const PT_DYNAMIC: u32 = 2; +pub const PT_INTERP: u32 = 3; +pub const PT_NOTE: u32 = 4; +pub const PT_SHLIB: u32 = 5; +pub const PT_PHDR: u32 = 6; +pub const PT_TLS: u32 = 7; +pub const PT_NUM: u32 = 8; +pub const PT_LOOS: u32 = 0x60000000; +pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; +pub const PT_GNU_STACK: u32 = 0x6474e551; +pub const PT_GNU_RELRO: u32 = 0x6474e552; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 0x00040000; +pub const O_NOATIME: ::c_int = 0x00002000; +pub const O_CLOEXEC: ::c_int = 0x00000100; +pub const O_TMPFILE: ::c_int = 0x00004000; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const BUFSIZ: ::c_uint = 1024; +pub const TMP_MAX: ::c_uint = 10000; +pub const FOPEN_MAX: ::c_uint = 1000; +pub const O_PATH: ::c_int = 0x00400000; +pub const O_EXEC: ::c_int = O_PATH; +pub const O_SEARCH: ::c_int = O_PATH; +pub const O_ACCMODE: ::c_int = (03 | O_SEARCH); +pub const O_NDELAY: ::c_int = O_NONBLOCK; +pub const NI_MAXHOST: ::socklen_t = 255; +pub const PTHREAD_STACK_MIN: ::size_t = 2048; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const POSIX_MADV_DONTNEED: ::c_int = 4; + +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const RLIMIT_RTTIME: ::c_int = 15; +pub const RLIMIT_NLIMITS: ::c_int = 16; + +pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; + +pub const SOCK_DCCP: ::c_int = 6; +pub const SOCK_PACKET: ::c_int = 10; + +pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; +pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; +pub const TCP_THIN_DUPACK: ::c_int = 17; +pub const TCP_USER_TIMEOUT: ::c_int = 18; +pub const TCP_REPAIR: ::c_int = 19; +pub const TCP_REPAIR_QUEUE: ::c_int = 20; +pub const TCP_QUEUE_SEQ: ::c_int = 21; +pub const TCP_REPAIR_OPTIONS: ::c_int = 22; +pub const TCP_FASTOPEN: ::c_int = 23; +pub const TCP_TIMESTAMP: ::c_int = 24; + +pub const SIGUNUSED: ::c_int = ::SIGSYS; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; + +pub const CPU_SETSIZE: ::c_int = 128; + +pub const PTRACE_TRACEME: ::c_int = 0; +pub const PTRACE_PEEKTEXT: ::c_int = 1; +pub const PTRACE_PEEKDATA: ::c_int = 2; +pub const PTRACE_PEEKUSER: ::c_int = 3; +pub const PTRACE_POKETEXT: ::c_int = 4; +pub const PTRACE_POKEDATA: ::c_int = 5; +pub const PTRACE_POKEUSER: ::c_int = 6; +pub const PTRACE_CONT: ::c_int = 7; +pub const PTRACE_KILL: ::c_int = 8; +pub const PTRACE_SINGLESTEP: ::c_int = 9; +pub const PTRACE_GETREGS: ::c_int = 12; +pub const PTRACE_SETREGS: ::c_int = 13; +pub const PTRACE_GETFPREGS: ::c_int = 14; +pub const PTRACE_SETFPREGS: ::c_int = 15; +pub const PTRACE_ATTACH: ::c_int = 16; +pub const PTRACE_DETACH: ::c_int = 17; +pub const PTRACE_GETFPXREGS: ::c_int = 18; +pub const PTRACE_SETFPXREGS: ::c_int = 19; +pub const PTRACE_SYSCALL: ::c_int = 24; +pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; +pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; +pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; +pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; +pub const PTRACE_GETREGSET: ::c_int = 0x4204; +pub const PTRACE_SETREGSET: ::c_int = 0x4205; +pub const PTRACE_SEIZE: ::c_int = 0x4206; +pub const PTRACE_INTERRUPT: ::c_int = 0x4207; +pub const PTRACE_LISTEN: ::c_int = 0x4208; +pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; + +pub const EPOLLWAKEUP: ::c_int = 0x20000000; + +pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; + +pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCINQ: ::c_int = ::FIONREAD; + +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; + +// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux +// kernel 3.10). See also notbsd/mod.rs +pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; +pub const CLOCK_TAI: ::clockid_t = 11; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_MARK: ::c_int = 36; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_BUSY_POLL: ::c_int = 46; + +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; + +pub const O_ASYNC: ::c_int = 0x00000400; + +pub const FIOCLEX: ::c_int = 0x5451; +pub const FIONBIO: ::c_int = 0x5421; + +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_MEMLOCK: ::c_int = 8; + +pub const O_APPEND: ::c_int = 0x00100000; +pub const O_CREAT: ::c_int = 0x00010000; +pub const O_EXCL: ::c_int = 0x00020000; +pub const O_NOCTTY: ::c_int = 0x00000200; +pub const O_NONBLOCK: ::c_int = 0x00000010; +pub const O_SYNC: ::c_int = (0x00000040 | O_DSYNC); +pub const O_RSYNC: ::c_int = O_SYNC; +pub const O_DSYNC: ::c_int = 0x00000020; + +pub const SOCK_NONBLOCK: ::c_int = 2048; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_SEQPACKET: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const EMULTIHOP: ::c_int = 72; +pub const EBADMSG: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const ERFKILL: ::c_int = 132; +pub const EHWPOISON: ::c_int = 133; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const EXTPROC: ::tcflag_t = 0x00010000; + +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; +pub const F_SETOWN: ::c_int = 8; + +pub const VEOF: usize = 4; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; + +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +pub const O_DIRECTORY: ::c_int = 0x00080000; +pub const O_DIRECT: ::c_int = 0x00000800; +pub const O_LARGEFILE: ::c_int = 0x00001000; +pub const O_NOFOLLOW: ::c_int = 0x00000080; + +// intentionally not public, only used for fd_set +cfg_if! { + if #[cfg(target_pointer_width = "32")] { + const ULONG_SIZE: usize = 32; + } else if #[cfg(target_pointer_width = "64")] { + const ULONG_SIZE: usize = 64; + } else { + // Unknown target_pointer_width + } +} + +// END_PUB_CONST + +f! { + pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { + let fd = fd as usize; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + (*set).fds_bits[fd / size] &= !(1 << (fd % size)); + return + } + + pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { + let fd = fd as usize; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 + } + + pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { + let fd = fd as usize; + let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + (*set).fds_bits[fd / size] |= 1 << (fd % size); + return + } + + pub fn FD_ZERO(set: *mut fd_set) -> () { + for slot in (*set).fds_bits.iter_mut() { + *slot = 0; + } + } + + pub fn WIFSTOPPED(status: ::c_int) -> bool { + (status & 0xff) == 0x7f + } + + pub fn WSTOPSIG(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff + } + + pub fn WIFCONTINUED(status: ::c_int) -> bool { + status == 0xffff + } + + pub fn WIFSIGNALED(status: ::c_int) -> bool { + ((status & 0x7f) + 1) as i8 >= 2 + } + + pub fn WTERMSIG(status: ::c_int) -> ::c_int { + status & 0x7f + } + + pub fn WIFEXITED(status: ::c_int) -> bool { + (status & 0x7f) == 0 + } + + pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff + } + + pub fn WCOREDUMP(status: ::c_int) -> bool { + (status & 0x80) != 0 + } + + pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { + (cmd << 8) | (type_ & 0x00ff) + } + + pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { + for slot in cpuset.bits.iter_mut() { + *slot = 0; + } + } + + pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] |= 1 << offset; + () + } + + pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] &= !(1 << offset); + () + } + + pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { + let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + 0 != (cpuset.bits[idx] & (1 << offset)) + } + + pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { + set1.bits == set2.bits + } + + pub fn major(dev: ::dev_t) -> ::c_uint { + let mut major = 0; + major |= (dev & 0x00000000000fff00) >> 8; + major |= (dev & 0xfffff00000000000) >> 32; + major as ::c_uint + } + + pub fn minor(dev: ::dev_t) -> ::c_uint { + let mut minor = 0; + minor |= (dev & 0x00000000000000ff) >> 0; + minor |= (dev & 0x00000ffffff00000) >> 12; + minor as ::c_uint + } + + pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { + let major = major as ::dev_t; + let minor = minor as ::dev_t; + let mut dev = 0; + dev |= (major & 0x00000fff) << 8; + dev |= (major & 0xfffff000) << 32; + dev |= (minor & 0x000000ff) << 0; + dev |= (minor & 0xffffff00) << 12; + dev + } +} + +// EXTERN_FN + +#[link(name = "c")] +#[link(name = "fdio")] +extern {} + +extern { + pub fn getpwnam(name: *const ::c_char) -> *mut passwd; + pub fn getpwuid(uid: ::uid_t) -> *mut passwd; + + pub fn fprintf(stream: *mut ::FILE, + format: *const ::c_char, ...) -> ::c_int; + pub fn printf(format: *const ::c_char, ...) -> ::c_int; + pub fn snprintf(s: *mut ::c_char, n: ::size_t, + format: *const ::c_char, ...) -> ::c_int; + pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; + pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; + pub fn scanf(format: *const ::c_char, ...) -> ::c_int; + pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; + pub fn getchar_unlocked() -> ::c_int; + pub fn putchar_unlocked(c: ::c_int) -> ::c_int; + + pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; + pub fn connect(socket: ::c_int, address: *const sockaddr, + len: socklen_t) -> ::c_int; + pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; + pub fn accept(socket: ::c_int, address: *mut sockaddr, + address_len: *mut socklen_t) -> ::c_int; + pub fn getpeername(socket: ::c_int, address: *mut sockaddr, + address_len: *mut socklen_t) -> ::c_int; + pub fn getsockname(socket: ::c_int, address: *mut sockaddr, + address_len: *mut socklen_t) -> ::c_int; + pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int, + value: *const ::c_void, + option_len: socklen_t) -> ::c_int; + pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int, + socket_vector: *mut ::c_int) -> ::c_int; + pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t, + flags: ::c_int, addr: *const sockaddr, + addrlen: socklen_t) -> ::ssize_t; + pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; + + pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; + pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; + + pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; + + pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; + + pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; + + pub fn pclose(stream: *mut ::FILE) -> ::c_int; + pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; + pub fn fileno(stream: *mut ::FILE) -> ::c_int; + + pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; + pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; + pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; + + pub fn opendir(dirname: *const c_char) -> *mut ::DIR; + pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; + pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, + result: *mut *mut ::dirent) -> ::c_int; + pub fn closedir(dirp: *mut ::DIR) -> ::c_int; + pub fn rewinddir(dirp: *mut ::DIR); + + pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, + flags: ::c_int, ...) -> ::c_int; + pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t, flags: ::c_int) -> ::c_int; + pub fn fchown(fd: ::c_int, + owner: ::uid_t, + group: ::gid_t) -> ::c_int; + pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char, + owner: ::uid_t, group: ::gid_t, + flags: ::c_int) -> ::c_int; + pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, + buf: *mut stat, flags: ::c_int) -> ::c_int; + pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, + newdirfd: ::c_int, newpath: *const ::c_char, + flags: ::c_int) -> ::c_int; + pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t) -> ::c_int; + pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, + buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; + pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, + newdirfd: ::c_int, newpath: *const ::c_char) + -> ::c_int; + pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int, + linkpath: *const ::c_char) -> ::c_int; + pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, + flags: ::c_int) -> ::c_int; + + pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; + pub fn alarm(seconds: ::c_uint) -> ::c_uint; + pub fn chdir(dir: *const c_char) -> ::c_int; + pub fn fchdir(dirfd: ::c_int) -> ::c_int; + pub fn chown(path: *const c_char, uid: uid_t, + gid: gid_t) -> ::c_int; + pub fn lchown(path: *const c_char, uid: uid_t, + gid: gid_t) -> ::c_int; + pub fn close(fd: ::c_int) -> ::c_int; + pub fn dup(fd: ::c_int) -> ::c_int; + pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; + pub fn execl(path: *const c_char, + arg0: *const c_char, ...) -> ::c_int; + pub fn execle(path: *const ::c_char, + arg0: *const ::c_char, ...) -> ::c_int; + pub fn execlp(file: *const ::c_char, + arg0: *const ::c_char, ...) -> ::c_int; + pub fn execv(prog: *const c_char, + argv: *const *const c_char) -> ::c_int; + pub fn execve(prog: *const c_char, argv: *const *const c_char, + envp: *const *const c_char) + -> ::c_int; + pub fn execvp(c: *const c_char, + argv: *const *const c_char) -> ::c_int; + pub fn fork() -> pid_t; + pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; + pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; + pub fn getegid() -> gid_t; + pub fn geteuid() -> uid_t; + pub fn getgid() -> gid_t; + pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) + -> ::c_int; + pub fn getlogin() -> *mut c_char; + pub fn getopt(argc: ::c_int, argv: *const *mut c_char, + optstr: *const c_char) -> ::c_int; + pub fn getpgid(pid: pid_t) -> pid_t; + pub fn getpgrp() -> pid_t; + pub fn getpid() -> pid_t; + pub fn getppid() -> pid_t; + pub fn getuid() -> uid_t; + pub fn isatty(fd: ::c_int) -> ::c_int; + pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; + pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; + pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; + pub fn pause() -> ::c_int; + pub fn pipe(fds: *mut ::c_int) -> ::c_int; + pub fn posix_memalign(memptr: *mut *mut ::c_void, + align: ::size_t, + size: ::size_t) -> ::c_int; + pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) + -> ::ssize_t; + pub fn rmdir(path: *const c_char) -> ::c_int; + pub fn seteuid(uid: uid_t) -> ::c_int; + pub fn setgid(gid: gid_t) -> ::c_int; + pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; + pub fn setsid() -> pid_t; + pub fn setuid(uid: uid_t) -> ::c_int; + pub fn sleep(secs: ::c_uint) -> ::c_uint; + pub fn nanosleep(rqtp: *const timespec, + rmtp: *mut timespec) -> ::c_int; + pub fn tcgetpgrp(fd: ::c_int) -> pid_t; + pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; + pub fn ttyname(fd: ::c_int) -> *mut c_char; + pub fn unlink(c: *const c_char) -> ::c_int; + pub fn wait(status: *mut ::c_int) -> pid_t; + pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) + -> pid_t; + pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) + -> ::ssize_t; + pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, + offset: off_t) -> ::ssize_t; + pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, + offset: off_t) -> ::ssize_t; + pub fn umask(mask: mode_t) -> mode_t; + + pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; + + pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; + + pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn mlockall(flags: ::c_int) -> ::c_int; + pub fn munlockall() -> ::c_int; + + pub fn mmap(addr: *mut ::c_void, + len: ::size_t, + prot: ::c_int, + flags: ::c_int, + fd: ::c_int, + offset: off_t) + -> *mut ::c_void; + pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; + + pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; + pub fn if_indextoname(ifindex: ::c_uint, + ifname: *mut ::c_char) -> *mut ::c_char; + + pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; + + pub fn fsync(fd: ::c_int) -> ::c_int; + + pub fn setenv(name: *const c_char, val: *const c_char, + overwrite: ::c_int) -> ::c_int; + pub fn unsetenv(name: *const c_char) -> ::c_int; + + pub fn symlink(path1: *const c_char, + path2: *const c_char) -> ::c_int; + + pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; + + pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; + + pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int; + pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; + + pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) + -> *mut ::c_char; + + pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; + + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; + pub fn times(buf: *mut ::tms) -> ::clock_t; + + pub fn pthread_self() -> ::pthread_t; + pub fn pthread_join(native: ::pthread_t, + value: *mut *mut ::c_void) -> ::c_int; + pub fn pthread_exit(value: *mut ::c_void); + pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; + pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int; + pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, + stack_size: ::size_t) -> ::c_int; + pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, + state: ::c_int) -> ::c_int; + pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; + pub fn sched_yield() -> ::c_int; + pub fn pthread_key_create(key: *mut pthread_key_t, + dtor: Option) + -> ::c_int; + pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; + pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; + pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) + -> ::c_int; + pub fn pthread_mutex_init(lock: *mut pthread_mutex_t, + attr: *const pthread_mutexattr_t) -> ::c_int; + pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; + pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; + pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; + pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; + + pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; + pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; + pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, + _type: ::c_int) -> ::c_int; + + pub fn pthread_cond_init(cond: *mut pthread_cond_t, + attr: *const pthread_condattr_t) -> ::c_int; + pub fn pthread_cond_wait(cond: *mut pthread_cond_t, + lock: *mut pthread_mutex_t) -> ::c_int; + pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t, + lock: *mut pthread_mutex_t, + abstime: *const ::timespec) -> ::c_int; + pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; + pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; + pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; + pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; + pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; + pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t, + attr: *const pthread_rwlockattr_t) -> ::c_int; + pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; + pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; + pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; + pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; + pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; + pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; + pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; + pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) + -> ::c_int; + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + + pub fn getsockopt(sockfd: ::c_int, + level: ::c_int, + optname: ::c_int, + optval: *mut ::c_void, + optlen: *mut ::socklen_t) -> ::c_int; + pub fn raise(signum: ::c_int) -> ::c_int; + pub fn sigaction(signum: ::c_int, + act: *const sigaction, + oldact: *mut sigaction) -> ::c_int; + + pub fn utimes(filename: *const ::c_char, + times: *const ::timeval) -> ::c_int; + pub fn dlopen(filename: *const ::c_char, + flag: ::c_int) -> *mut ::c_void; + pub fn dlerror() -> *mut ::c_char; + pub fn dlsym(handle: *mut ::c_void, + symbol: *const ::c_char) -> *mut ::c_void; + pub fn dlclose(handle: *mut ::c_void) -> ::c_int; + pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; + + pub fn getaddrinfo(node: *const c_char, + service: *const c_char, + hints: *const addrinfo, + res: *mut *mut addrinfo) -> ::c_int; + pub fn freeaddrinfo(res: *mut addrinfo); + pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; + pub fn res_init() -> ::c_int; + + pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; + pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; + pub fn mktime(tm: *mut tm) -> time_t; + pub fn time(time: *mut time_t) -> time_t; + pub fn gmtime(time_p: *const time_t) -> *mut tm; + pub fn localtime(time_p: *const time_t) -> *mut tm; + + pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, + dev: ::dev_t) -> ::c_int; + pub fn uname(buf: *mut ::utsname) -> ::c_int; + pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; + pub fn getservbyname(name: *const ::c_char, + proto: *const ::c_char) -> *mut servent; + pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; + pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; + pub fn chroot(name: *const ::c_char) -> ::c_int; + pub fn usleep(secs: ::c_uint) -> ::c_int; + pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, + flags: ::c_int) -> ::ssize_t; + pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int) -> ::ssize_t; + pub fn putenv(string: *mut c_char) -> ::c_int; + pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; + pub fn select(nfds: ::c_int, + readfs: *mut fd_set, + writefds: *mut fd_set, + errorfds: *mut fd_set, + timeout: *mut timeval) -> ::c_int; + pub fn setlocale(category: ::c_int, + locale: *const ::c_char) -> *mut ::c_char; + pub fn localeconv() -> *mut lconv; + + pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; + pub fn sem_wait(sem: *mut sem_t) -> ::c_int; + pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; + pub fn sem_post(sem: *mut sem_t) -> ::c_int; + pub fn sem_init(sem: *mut sem_t, + pshared: ::c_int, + value: ::c_uint) + -> ::c_int; + pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; + pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; + + pub fn readlink(path: *const c_char, + buf: *mut c_char, + bufsz: ::size_t) + -> ::ssize_t; + + pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; + pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; + pub fn sigfillset(set: *mut sigset_t) -> ::c_int; + pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; + pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; + + pub fn sigprocmask(how: ::c_int, + set: *const sigset_t, + oldset: *mut sigset_t) + -> ::c_int; + pub fn sigpending(set: *mut sigset_t) -> ::c_int; + + pub fn timegm(tm: *mut ::tm) -> time_t; + + pub fn getsid(pid: pid_t) -> pid_t; + + pub fn sysconf(name: ::c_int) -> ::c_long; + + pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; + + pub fn pselect(nfds: ::c_int, + readfs: *mut fd_set, + writefds: *mut fd_set, + errorfds: *mut fd_set, + timeout: *const timespec, + sigmask: *const sigset_t) -> ::c_int; + pub fn fseeko(stream: *mut ::FILE, + offset: ::off_t, + whence: ::c_int) -> ::c_int; + pub fn ftello(stream: *mut ::FILE) -> ::off_t; + pub fn tcdrain(fd: ::c_int) -> ::c_int; + pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; + pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; + pub fn cfmakeraw(termios: *mut ::termios); + pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; + pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; + pub fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; + pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; + pub fn tcsetattr(fd: ::c_int, + optional_actions: ::c_int, + termios: *const ::termios) -> ::c_int; + pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; + pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; + pub fn tcgetsid(fd: ::c_int) -> ::pid_t; + pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; + pub fn mkstemp(template: *mut ::c_char) -> ::c_int; + pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; + + pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; + + pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); + pub fn closelog(); + pub fn setlogmask(maskpri: ::c_int) -> ::c_int; + pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); + pub fn nice(incr: ::c_int) -> ::c_int; + + pub fn grantpt(fd: ::c_int) -> ::c_int; + pub fn posix_openpt(flags: ::c_int) -> ::c_int; + pub fn ptsname(fd: ::c_int) -> *mut ::c_char; + pub fn unlockpt(fd: ::c_int) -> ::c_int; + + pub fn fdatasync(fd: ::c_int) -> ::c_int; + pub fn mincore(addr: *mut ::c_void, len: ::size_t, + vec: *mut ::c_uchar) -> ::c_int; + pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; + pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; + pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; + pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; + + pub fn pthread_getattr_np(native: ::pthread_t, + attr: *mut ::pthread_attr_t) -> ::c_int; + pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, + stackaddr: *mut *mut ::c_void, + stacksize: *mut ::size_t) -> ::c_int; + pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; + pub fn setgroups(ngroups: ::size_t, + ptr: *const ::gid_t) -> ::c_int; + pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; + pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; + pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int; + pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; + pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int; + pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int; + pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int; + pub fn memrchr(cx: *const ::c_void, + c: ::c_int, + n: ::size_t) -> *mut ::c_void; + + pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, + advise: ::c_int) -> ::c_int; + pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; + pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, + times: *const ::timespec, flag: ::c_int) -> ::c_int; + pub fn duplocale(base: ::locale_t) -> ::locale_t; + pub fn freelocale(loc: ::locale_t); + pub fn newlocale(mask: ::c_int, + locale: *const ::c_char, + base: ::locale_t) -> ::locale_t; + pub fn uselocale(loc: ::locale_t) -> ::locale_t; + pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; + pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; + pub fn fstatat64(dirfd: ::c_int, pathname: *const c_char, + buf: *mut stat64, flags: ::c_int) -> ::c_int; + pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; + pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int; + pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; + pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; + pub fn mmap64(addr: *mut ::c_void, + len: ::size_t, + prot: ::c_int, + flags: ::c_int, + fd: ::c_int, + offset: off64_t) + -> *mut ::c_void; + pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; + pub fn openat64(fd: ::c_int, + path: *const c_char, + oflag: ::c_int, ...) -> ::c_int; + pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, + offset: off64_t) -> ::ssize_t; + pub fn preadv64(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off64_t) -> ::ssize_t; + pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, + offset: off64_t) -> ::ssize_t; + pub fn pwritev64(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off64_t) -> ::ssize_t; + pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; + pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, + result: *mut *mut ::dirent64) -> ::c_int; + pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int; + pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; + pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; + + pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; + + pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t, dev: dev_t) -> ::c_int; + pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, + clock_id: *mut clockid_t) -> ::c_int; + pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, + clock_id: ::clockid_t) -> ::c_int; + pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, + pshared: ::c_int) -> ::c_int; + pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t, + flg: ::c_int) -> ::c_int; + pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, + pshared: ::c_int) -> ::c_int; + pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, + val: *mut ::c_int) -> ::c_int; + pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, + val: ::c_int) -> ::c_int; + pub fn ptsname_r(fd: ::c_int, + buf: *mut ::c_char, + buflen: ::size_t) -> ::c_int; + pub fn clearenv() -> ::c_int; + pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, + options: ::c_int) -> ::c_int; + pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int; + pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int; + pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, + suid: *mut ::uid_t) -> ::c_int; + pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, + sgid: *mut ::gid_t) -> ::c_int; + pub fn acct(filename: *const ::c_char) -> ::c_int; + pub fn brk(addr: *mut ::c_void) -> ::c_int; + pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; + pub fn vfork() -> ::pid_t; + pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; + pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; + pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int, + rusage: *mut ::rusage) -> ::pid_t; + pub fn openpty(amaster: *mut ::c_int, + aslave: *mut ::c_int, + name: *mut ::c_char, + termp: *const termios, + winp: *const ::winsize) -> ::c_int; + pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char, + envp: *const *const ::c_char) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, + envp: *const *const ::c_char) + -> ::c_int; + + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; + pub fn ptrace(request: ::c_int, ...) -> ::c_long; + pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; + + pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; + pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; + pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int, + timeout: *const ::timespec) -> ::c_int; + pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, + nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int; + + pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; + + pub fn setpwent(); + pub fn endpwent(); + pub fn getpwent() -> *mut passwd; + pub fn setspent(); + pub fn endspent(); + pub fn getspent() -> *mut spwd; + pub fn getspnam(__name: *const ::c_char) -> *mut spwd; + + pub fn shm_open(name: *const c_char, oflag: ::c_int, + mode: mode_t) -> ::c_int; + + // System V IPC + pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; + pub fn shmat(shmid: ::c_int, + shmaddr: *const ::c_void, + shmflg: ::c_int) -> *mut ::c_void; + pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; + pub fn shmctl(shmid: ::c_int, + cmd: ::c_int, + buf: *mut ::shmid_ds) -> ::c_int; + pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t; + pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int; + pub fn semop(semid: ::c_int, + sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int; + pub fn semctl(semid: ::c_int, + semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int; + pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int; + pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int; + pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, + msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t; + pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, + msgflg: ::c_int) -> ::c_int; + + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + pub fn __errno_location() -> *mut ::c_int; + + pub fn fopen64(filename: *const c_char, + mode: *const c_char) -> *mut ::FILE; + pub fn freopen64(filename: *const c_char, mode: *const c_char, + file: *mut ::FILE) -> *mut ::FILE; + pub fn tmpfile64() -> *mut ::FILE; + pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; + pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; + pub fn fseeko64(stream: *mut ::FILE, + offset: ::off64_t, + whence: ::c_int) -> ::c_int; + pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; + pub fn fallocate(fd: ::c_int, mode: ::c_int, + offset: ::off_t, len: ::off_t) -> ::c_int; + pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, + len: ::off_t) -> ::c_int; + pub fn readahead(fd: ::c_int, offset: ::off64_t, + count: ::size_t) -> ::ssize_t; + pub fn getxattr(path: *const c_char, name: *const c_char, + value: *mut ::c_void, size: ::size_t) -> ::ssize_t; + pub fn lgetxattr(path: *const c_char, name: *const c_char, + value: *mut ::c_void, size: ::size_t) -> ::ssize_t; + pub fn fgetxattr(filedes: ::c_int, name: *const c_char, + value: *mut ::c_void, size: ::size_t) -> ::ssize_t; + pub fn setxattr(path: *const c_char, name: *const c_char, + value: *const ::c_void, size: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn lsetxattr(path: *const c_char, name: *const c_char, + value: *const ::c_void, size: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn fsetxattr(filedes: ::c_int, name: *const c_char, + value: *const ::c_void, size: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn listxattr(path: *const c_char, list: *mut c_char, + size: ::size_t) -> ::ssize_t; + pub fn llistxattr(path: *const c_char, list: *mut c_char, + size: ::size_t) -> ::ssize_t; + pub fn flistxattr(filedes: ::c_int, list: *mut c_char, + size: ::size_t) -> ::ssize_t; + pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int; + pub fn signalfd(fd: ::c_int, + mask: *const ::sigset_t, + flags: ::c_int) -> ::c_int; + pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int; + pub fn timerfd_gettime(fd: ::c_int, + curr_value: *mut itimerspec) -> ::c_int; + pub fn timerfd_settime(fd: ::c_int, + flags: ::c_int, + new_value: *const itimerspec, + old_value: *mut itimerspec) -> ::c_int; + pub fn pwritev(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t) -> ::ssize_t; + pub fn preadv(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t) -> ::ssize_t; + pub fn quotactl(cmd: ::c_int, + special: *const ::c_char, + id: ::c_int, + data: *mut ::c_char) -> ::c_int; + pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; + pub fn mq_close(mqd: ::mqd_t) -> ::c_int; + pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + pub fn mq_receive(mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msq_prio: *mut ::c_uint) -> ::ssize_t; + pub fn mq_send(mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msq_prio: ::c_uint) -> ::c_int; + pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; + pub fn mq_setattr(mqd: ::mqd_t, + newattr: *const ::mq_attr, + oldattr: *mut ::mq_attr) -> ::c_int; + pub fn epoll_pwait(epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int, + sigmask: *const ::sigset_t) -> ::c_int; + pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; + pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; + pub fn mkostemps(template: *mut ::c_char, + suffixlen: ::c_int, + flags: ::c_int) -> ::c_int; + pub fn sigtimedwait(set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec) -> ::c_int; + pub fn sigwaitinfo(set: *const sigset_t, + info: *mut siginfo_t) -> ::c_int; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_int) -> ::c_int; + pub fn pthread_setschedprio(native: ::pthread_t, + priority: ::c_int) -> ::c_int; + pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit, + old_limit: *mut ::rlimit) -> ::c_int; + pub fn prlimit64(pid: ::pid_t, + resource: ::c_int, + new_limit: *const ::rlimit64, + old_limit: *mut ::rlimit64) -> ::c_int; + pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; + pub fn process_vm_readv(pid: ::pid_t, + local_iov: *const ::iovec, + liovcnt: ::c_ulong, + remote_iov: *const ::iovec, + riovcnt: ::c_ulong, + flags: ::c_ulong) -> isize; + pub fn process_vm_writev(pid: ::pid_t, + local_iov: *const ::iovec, + liovcnt: ::c_ulong, + remote_iov: *const ::iovec, + riovcnt: ::c_ulong, + flags: ::c_ulong) -> isize; + pub fn reboot(how_to: ::c_int) -> ::c_int; + pub fn setfsgid(gid: ::gid_t) -> ::c_int; + pub fn setfsuid(uid: ::uid_t) -> ::c_int; + + // Not available now on Android + pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t) -> ::c_int; + pub fn if_nameindex() -> *mut if_nameindex; + pub fn if_freenameindex(ptr: *mut if_nameindex); + pub fn sync_file_range(fd: ::c_int, offset: ::off64_t, + nbytes: ::off64_t, flags: ::c_uint) -> ::c_int; + pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; + pub fn freeifaddrs(ifa: *mut ::ifaddrs); + + pub fn mremap(addr: *mut ::c_void, + len: ::size_t, + new_len: ::size_t, + flags: ::c_int, + ...) -> *mut ::c_void; + + pub fn glob(pattern: *const c_char, + flags: ::c_int, + errfunc: Option ::c_int>, + pglob: *mut ::glob_t) -> ::c_int; + pub fn globfree(pglob: *mut ::glob_t); + + pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; + + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; + + pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); + + pub fn telldir(dirp: *mut ::DIR) -> ::c_long; + pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; + + pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; + + pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int, addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t) -> ::ssize_t; + pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; + pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; + pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; + + pub fn bind(socket: ::c_int, address: *const ::sockaddr, + address_len: ::socklen_t) -> ::c_int; + + pub fn writev(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int) -> ::ssize_t; + pub fn readv(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int) -> ::ssize_t; + + pub fn sendmsg(fd: ::c_int, + msg: *const ::msghdr, + flags: ::c_int) -> ::ssize_t; + pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) + -> ::ssize_t; + pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; + pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn vhangup() -> ::c_int; + pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, + flags: ::c_int) -> ::c_int; + pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint, + flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; + pub fn sync(); + pub fn syscall(num: ::c_long, ...) -> ::c_long; + pub fn sched_getaffinity(pid: ::pid_t, + cpusetsize: ::size_t, + cpuset: *mut cpu_set_t) -> ::c_int; + pub fn sched_setaffinity(pid: ::pid_t, + cpusetsize: ::size_t, + cpuset: *const cpu_set_t) -> ::c_int; + pub fn epoll_create(size: ::c_int) -> ::c_int; + pub fn epoll_create1(flags: ::c_int) -> ::c_int; + pub fn epoll_wait(epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int) -> ::c_int; + pub fn epoll_ctl(epfd: ::c_int, + op: ::c_int, + fd: ::c_int, + event: *mut ::epoll_event) -> ::c_int; + pub fn pthread_getschedparam(native: ::pthread_t, + policy: *mut ::c_int, + param: *mut ::sched_param) -> ::c_int; + pub fn unshare(flags: ::c_int) -> ::c_int; + pub fn umount(target: *const ::c_char) -> ::c_int; + pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; + pub fn tee(fd_in: ::c_int, + fd_out: ::c_int, + len: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + pub fn splice(fd_in: ::c_int, + off_in: *mut ::loff_t, + fd_out: ::c_int, + off_out: *mut ::loff_t, + len: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; + pub fn sem_timedwait(sem: *mut sem_t, + abstime: *const ::timespec) -> ::c_int; + pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; + pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int; + pub fn swapoff(puath: *const ::c_char) -> ::c_int; + pub fn vmsplice(fd: ::c_int, + iov: *const ::iovec, + nr_segs: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn mount(src: *const ::c_char, + target: *const ::c_char, + fstype: *const ::c_char, + flags: ::c_ulong, + data: *const ::c_void) -> ::c_int; + pub fn personality(persona: ::c_ulong) -> ::c_int; + pub fn prctl(option: ::c_int, ...) -> ::c_int; + pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; + pub fn ppoll(fds: *mut ::pollfd, + nfds: nfds_t, + timeout: *const ::timespec, + sigmask: *const sigset_t) -> ::c_int; + pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, + abstime: *const ::timespec) -> ::c_int; + pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int, + child_stack: *mut ::c_void, + flags: ::c_int, + arg: *mut ::c_void, ...) -> ::c_int; + pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; + pub fn clock_nanosleep(clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec) -> ::c_int; + pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, + guardsize: *mut ::size_t) -> ::c_int; + pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; + pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, + pshared: *mut ::c_int) -> ::c_int; + pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int; + pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; + pub fn pthread_setschedparam(native: ::pthread_t, + policy: ::c_int, + param: *const ::sched_param) -> ::c_int; + pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int; + pub fn sched_setscheduler(pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param) -> ::c_int; + pub fn sendfile(out_fd: ::c_int, + in_fd: ::c_int, + offset: *mut off_t, + count: ::size_t) -> ::ssize_t; + pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; + pub fn getgrgid_r(uid: ::uid_t, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; + pub fn sigaltstack(ss: *const stack_t, + oss: *mut stack_t) -> ::c_int; + pub fn sem_close(sem: *mut sem_t) -> ::c_int; + pub fn getdtablesize() -> ::c_int; + pub fn getgrnam_r(name: *const ::c_char, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; + pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; + pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, + oldset: *mut sigset_t) -> ::c_int; + pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; + pub fn getgrnam(name: *const ::c_char) -> *mut ::group; + pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; + pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; + pub fn sem_unlink(name: *const ::c_char) -> ::c_int; + pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; + pub fn getpwnam_r(name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; + pub fn getpwuid_r(uid: ::uid_t, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; + pub fn sigwait(set: *const sigset_t, + sig: *mut ::c_int) -> ::c_int; + pub fn pthread_atfork(prepare: Option, + parent: Option, + child: Option) -> ::c_int; + pub fn getgrgid(gid: ::gid_t) -> *mut ::group; + pub fn getgrouplist(user: *const ::c_char, + group: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int) -> ::c_int; + pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, + pshared: *mut ::c_int) -> ::c_int; + pub fn popen(command: *const c_char, + mode: *const c_char) -> *mut ::FILE; + pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::c_int, flags: ::c_int) -> ::c_int; + pub fn pthread_create(native: *mut ::pthread_t, + attr: *const ::pthread_attr_t, + f: extern fn(*mut ::c_void) -> *mut ::c_void, + value: *mut ::c_void) -> ::c_int; + pub fn dl_iterate_phdr( + callback: Option ::c_int>, + data: *mut ::c_void + ) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; + } else if #[cfg(any(target_arch = "powerpc64"))] { + mod powerpc64; + pub use self::powerpc64::*; + } else if #[cfg(any(target_arch = "x86_64"))] { + mod x86_64; + pub use self::x86_64::*; + } else { + // Unknown target_arch + } +} diff --git a/src/vendor/libc/src/fuchsia/powerpc64.rs b/src/vendor/libc/src/fuchsia/powerpc64.rs new file mode 100644 index 0000000000..112cd43514 --- /dev/null +++ b/src/vendor/libc/src/fuchsia/powerpc64.rs @@ -0,0 +1,79 @@ +pub type c_char = u8; +pub type wchar_t = i32; +pub type __u64 = ::c_ulong; +pub type nlink_t = u64; +pub type blksize_t = ::c_long; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __reserved: [::c_long; 3], + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } +} + +pub const SYS_pivot_root: ::c_long = 203; +pub const SYS_gettid: ::c_long = 207; +pub const SYS_perf_event_open: ::c_long = 319; +pub const SYS_memfd_create: ::c_long = 360; + +pub const MAP_32BIT: ::c_int = 0x0040; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +#[doc(hidden)] +pub const AF_MAX: ::c_int = 42; +#[doc(hidden)] +pub const PF_MAX: ::c_int = AF_MAX; + +// Syscall table +pub const SYS_renameat2: ::c_long = 357; diff --git a/src/vendor/libc/src/fuchsia/x86_64.rs b/src/vendor/libc/src/fuchsia/x86_64.rs new file mode 100644 index 0000000000..2e4ecccbf7 --- /dev/null +++ b/src/vendor/libc/src/fuchsia/x86_64.rs @@ -0,0 +1,447 @@ +pub type c_char = i8; +pub type wchar_t = i32; +pub type nlink_t = u64; +pub type blksize_t = ::c_long; +pub type __u64 = ::c_ulonglong; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __reserved: [::c_long; 3], + } + + pub struct mcontext_t { + __private: [u64; 32], + } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask: ::sigset_t, + __private: [u8; 512], + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } +} + +// Syscall table + +pub const SYS_read: ::c_long = 0; +pub const SYS_write: ::c_long = 1; +pub const SYS_open: ::c_long = 2; +pub const SYS_close: ::c_long = 3; +pub const SYS_stat: ::c_long = 4; +pub const SYS_fstat: ::c_long = 5; +pub const SYS_lstat: ::c_long = 6; +pub const SYS_poll: ::c_long = 7; +pub const SYS_lseek: ::c_long = 8; +pub const SYS_mmap: ::c_long = 9; +pub const SYS_mprotect: ::c_long = 10; +pub const SYS_munmap: ::c_long = 11; +pub const SYS_brk: ::c_long = 12; +pub const SYS_rt_sigaction: ::c_long = 13; +pub const SYS_rt_sigprocmask: ::c_long = 14; +pub const SYS_rt_sigreturn: ::c_long = 15; +pub const SYS_ioctl: ::c_long = 16; +pub const SYS_pread64: ::c_long = 17; +pub const SYS_pwrite64: ::c_long = 18; +pub const SYS_readv: ::c_long = 19; +pub const SYS_writev: ::c_long = 20; +pub const SYS_access: ::c_long = 21; +pub const SYS_pipe: ::c_long = 22; +pub const SYS_select: ::c_long = 23; +pub const SYS_sched_yield: ::c_long = 24; +pub const SYS_mremap: ::c_long = 25; +pub const SYS_msync: ::c_long = 26; +pub const SYS_mincore: ::c_long = 27; +pub const SYS_madvise: ::c_long = 28; +pub const SYS_shmget: ::c_long = 29; +pub const SYS_shmat: ::c_long = 30; +pub const SYS_shmctl: ::c_long = 31; +pub const SYS_dup: ::c_long = 32; +pub const SYS_dup2: ::c_long = 33; +pub const SYS_pause: ::c_long = 34; +pub const SYS_nanosleep: ::c_long = 35; +pub const SYS_getitimer: ::c_long = 36; +pub const SYS_alarm: ::c_long = 37; +pub const SYS_setitimer: ::c_long = 38; +pub const SYS_getpid: ::c_long = 39; +pub const SYS_sendfile: ::c_long = 40; +pub const SYS_socket: ::c_long = 41; +pub const SYS_connect: ::c_long = 42; +pub const SYS_accept: ::c_long = 43; +pub const SYS_sendto: ::c_long = 44; +pub const SYS_recvfrom: ::c_long = 45; +pub const SYS_sendmsg: ::c_long = 46; +pub const SYS_recvmsg: ::c_long = 47; +pub const SYS_shutdown: ::c_long = 48; +pub const SYS_bind: ::c_long = 49; +pub const SYS_listen: ::c_long = 50; +pub const SYS_getsockname: ::c_long = 51; +pub const SYS_getpeername: ::c_long = 52; +pub const SYS_socketpair: ::c_long = 53; +pub const SYS_setsockopt: ::c_long = 54; +pub const SYS_getsockopt: ::c_long = 55; +pub const SYS_clone: ::c_long = 56; +pub const SYS_fork: ::c_long = 57; +pub const SYS_vfork: ::c_long = 58; +pub const SYS_execve: ::c_long = 59; +pub const SYS_exit: ::c_long = 60; +pub const SYS_wait4: ::c_long = 61; +pub const SYS_kill: ::c_long = 62; +pub const SYS_uname: ::c_long = 63; +pub const SYS_semget: ::c_long = 64; +pub const SYS_semop: ::c_long = 65; +pub const SYS_semctl: ::c_long = 66; +pub const SYS_shmdt: ::c_long = 67; +pub const SYS_msgget: ::c_long = 68; +pub const SYS_msgsnd: ::c_long = 69; +pub const SYS_msgrcv: ::c_long = 70; +pub const SYS_msgctl: ::c_long = 71; +pub const SYS_fcntl: ::c_long = 72; +pub const SYS_flock: ::c_long = 73; +pub const SYS_fsync: ::c_long = 74; +pub const SYS_fdatasync: ::c_long = 75; +pub const SYS_truncate: ::c_long = 76; +pub const SYS_ftruncate: ::c_long = 77; +pub const SYS_getdents: ::c_long = 78; +pub const SYS_getcwd: ::c_long = 79; +pub const SYS_chdir: ::c_long = 80; +pub const SYS_fchdir: ::c_long = 81; +pub const SYS_rename: ::c_long = 82; +pub const SYS_mkdir: ::c_long = 83; +pub const SYS_rmdir: ::c_long = 84; +pub const SYS_creat: ::c_long = 85; +pub const SYS_link: ::c_long = 86; +pub const SYS_unlink: ::c_long = 87; +pub const SYS_symlink: ::c_long = 88; +pub const SYS_readlink: ::c_long = 89; +pub const SYS_chmod: ::c_long = 90; +pub const SYS_fchmod: ::c_long = 91; +pub const SYS_chown: ::c_long = 92; +pub const SYS_fchown: ::c_long = 93; +pub const SYS_lchown: ::c_long = 94; +pub const SYS_umask: ::c_long = 95; +pub const SYS_gettimeofday: ::c_long = 96; +pub const SYS_getrlimit: ::c_long = 97; +pub const SYS_getrusage: ::c_long = 98; +pub const SYS_sysinfo: ::c_long = 99; +pub const SYS_times: ::c_long = 100; +pub const SYS_ptrace: ::c_long = 101; +pub const SYS_getuid: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_getgid: ::c_long = 104; +pub const SYS_setuid: ::c_long = 105; +pub const SYS_setgid: ::c_long = 106; +pub const SYS_geteuid: ::c_long = 107; +pub const SYS_getegid: ::c_long = 108; +pub const SYS_setpgid: ::c_long = 109; +pub const SYS_getppid: ::c_long = 110; +pub const SYS_getpgrp: ::c_long = 111; +pub const SYS_setsid: ::c_long = 112; +pub const SYS_setreuid: ::c_long = 113; +pub const SYS_setregid: ::c_long = 114; +pub const SYS_getgroups: ::c_long = 115; +pub const SYS_setgroups: ::c_long = 116; +pub const SYS_setresuid: ::c_long = 117; +pub const SYS_getresuid: ::c_long = 118; +pub const SYS_setresgid: ::c_long = 119; +pub const SYS_getresgid: ::c_long = 120; +pub const SYS_getpgid: ::c_long = 121; +pub const SYS_setfsuid: ::c_long = 122; +pub const SYS_setfsgid: ::c_long = 123; +pub const SYS_getsid: ::c_long = 124; +pub const SYS_capget: ::c_long = 125; +pub const SYS_capset: ::c_long = 126; +pub const SYS_rt_sigpending: ::c_long = 127; +pub const SYS_rt_sigtimedwait: ::c_long = 128; +pub const SYS_rt_sigqueueinfo: ::c_long = 129; +pub const SYS_rt_sigsuspend: ::c_long = 130; +pub const SYS_sigaltstack: ::c_long = 131; +pub const SYS_utime: ::c_long = 132; +pub const SYS_mknod: ::c_long = 133; +pub const SYS_uselib: ::c_long = 134; +pub const SYS_personality: ::c_long = 135; +pub const SYS_ustat: ::c_long = 136; +pub const SYS_statfs: ::c_long = 137; +pub const SYS_fstatfs: ::c_long = 138; +pub const SYS_sysfs: ::c_long = 139; +pub const SYS_getpriority: ::c_long = 140; +pub const SYS_setpriority: ::c_long = 141; +pub const SYS_sched_setparam: ::c_long = 142; +pub const SYS_sched_getparam: ::c_long = 143; +pub const SYS_sched_setscheduler: ::c_long = 144; +pub const SYS_sched_getscheduler: ::c_long = 145; +pub const SYS_sched_get_priority_max: ::c_long = 146; +pub const SYS_sched_get_priority_min: ::c_long = 147; +pub const SYS_sched_rr_get_interval: ::c_long = 148; +pub const SYS_mlock: ::c_long = 149; +pub const SYS_munlock: ::c_long = 150; +pub const SYS_mlockall: ::c_long = 151; +pub const SYS_munlockall: ::c_long = 152; +pub const SYS_vhangup: ::c_long = 153; +pub const SYS_modify_ldt: ::c_long = 154; +pub const SYS_pivot_root: ::c_long = 155; +pub const SYS__sysctl: ::c_long = 156; +pub const SYS_prctl: ::c_long = 157; +pub const SYS_arch_prctl: ::c_long = 158; +pub const SYS_adjtimex: ::c_long = 159; +pub const SYS_setrlimit: ::c_long = 160; +pub const SYS_chroot: ::c_long = 161; +pub const SYS_sync: ::c_long = 162; +pub const SYS_acct: ::c_long = 163; +pub const SYS_settimeofday: ::c_long = 164; +pub const SYS_mount: ::c_long = 165; +pub const SYS_umount2: ::c_long = 166; +pub const SYS_swapon: ::c_long = 167; +pub const SYS_swapoff: ::c_long = 168; +pub const SYS_reboot: ::c_long = 169; +pub const SYS_sethostname: ::c_long = 170; +pub const SYS_setdomainname: ::c_long = 171; +pub const SYS_iopl: ::c_long = 172; +pub const SYS_ioperm: ::c_long = 173; +pub const SYS_create_module: ::c_long = 174; +pub const SYS_init_module: ::c_long = 175; +pub const SYS_delete_module: ::c_long = 176; +pub const SYS_get_kernel_syms: ::c_long = 177; +pub const SYS_query_module: ::c_long = 178; +pub const SYS_quotactl: ::c_long = 179; +pub const SYS_nfsservctl: ::c_long = 180; +pub const SYS_getpmsg: ::c_long = 181; +pub const SYS_putpmsg: ::c_long = 182; +pub const SYS_afs_syscall: ::c_long = 183; +pub const SYS_tuxcall: ::c_long = 184; +pub const SYS_security: ::c_long = 185; +pub const SYS_gettid: ::c_long = 186; +pub const SYS_readahead: ::c_long = 187; +pub const SYS_setxattr: ::c_long = 188; +pub const SYS_lsetxattr: ::c_long = 189; +pub const SYS_fsetxattr: ::c_long = 190; +pub const SYS_getxattr: ::c_long = 191; +pub const SYS_lgetxattr: ::c_long = 192; +pub const SYS_fgetxattr: ::c_long = 193; +pub const SYS_listxattr: ::c_long = 194; +pub const SYS_llistxattr: ::c_long = 195; +pub const SYS_flistxattr: ::c_long = 196; +pub const SYS_removexattr: ::c_long = 197; +pub const SYS_lremovexattr: ::c_long = 198; +pub const SYS_fremovexattr: ::c_long = 199; +pub const SYS_tkill: ::c_long = 200; +pub const SYS_time: ::c_long = 201; +pub const SYS_futex: ::c_long = 202; +pub const SYS_sched_setaffinity: ::c_long = 203; +pub const SYS_sched_getaffinity: ::c_long = 204; +pub const SYS_set_thread_area: ::c_long = 205; +pub const SYS_io_setup: ::c_long = 206; +pub const SYS_io_destroy: ::c_long = 207; +pub const SYS_io_getevents: ::c_long = 208; +pub const SYS_io_submit: ::c_long = 209; +pub const SYS_io_cancel: ::c_long = 210; +pub const SYS_get_thread_area: ::c_long = 211; +pub const SYS_lookup_dcookie: ::c_long = 212; +pub const SYS_epoll_create: ::c_long = 213; +pub const SYS_epoll_ctl_old: ::c_long = 214; +pub const SYS_epoll_wait_old: ::c_long = 215; +pub const SYS_remap_file_pages: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_set_tid_address: ::c_long = 218; +pub const SYS_restart_syscall: ::c_long = 219; +pub const SYS_semtimedop: ::c_long = 220; +pub const SYS_fadvise64: ::c_long = 221; +pub const SYS_timer_create: ::c_long = 222; +pub const SYS_timer_settime: ::c_long = 223; +pub const SYS_timer_gettime: ::c_long = 224; +pub const SYS_timer_getoverrun: ::c_long = 225; +pub const SYS_timer_delete: ::c_long = 226; +pub const SYS_clock_settime: ::c_long = 227; +pub const SYS_clock_gettime: ::c_long = 228; +pub const SYS_clock_getres: ::c_long = 229; +pub const SYS_clock_nanosleep: ::c_long = 230; +pub const SYS_exit_group: ::c_long = 231; +pub const SYS_epoll_wait: ::c_long = 232; +pub const SYS_epoll_ctl: ::c_long = 233; +pub const SYS_tgkill: ::c_long = 234; +pub const SYS_utimes: ::c_long = 235; +pub const SYS_vserver: ::c_long = 236; +pub const SYS_mbind: ::c_long = 237; +pub const SYS_set_mempolicy: ::c_long = 238; +pub const SYS_get_mempolicy: ::c_long = 239; +pub const SYS_mq_open: ::c_long = 240; +pub const SYS_mq_unlink: ::c_long = 241; +pub const SYS_mq_timedsend: ::c_long = 242; +pub const SYS_mq_timedreceive: ::c_long = 243; +pub const SYS_mq_notify: ::c_long = 244; +pub const SYS_mq_getsetattr: ::c_long = 245; +pub const SYS_kexec_load: ::c_long = 246; +pub const SYS_waitid: ::c_long = 247; +pub const SYS_add_key: ::c_long = 248; +pub const SYS_request_key: ::c_long = 249; +pub const SYS_keyctl: ::c_long = 250; +pub const SYS_ioprio_set: ::c_long = 251; +pub const SYS_ioprio_get: ::c_long = 252; +pub const SYS_inotify_init: ::c_long = 253; +pub const SYS_inotify_add_watch: ::c_long = 254; +pub const SYS_inotify_rm_watch: ::c_long = 255; +pub const SYS_migrate_pages: ::c_long = 256; +pub const SYS_openat: ::c_long = 257; +pub const SYS_mkdirat: ::c_long = 258; +pub const SYS_mknodat: ::c_long = 259; +pub const SYS_fchownat: ::c_long = 260; +pub const SYS_futimesat: ::c_long = 261; +pub const SYS_newfstatat: ::c_long = 262; +pub const SYS_unlinkat: ::c_long = 263; +pub const SYS_renameat: ::c_long = 264; +pub const SYS_linkat: ::c_long = 265; +pub const SYS_symlinkat: ::c_long = 266; +pub const SYS_readlinkat: ::c_long = 267; +pub const SYS_fchmodat: ::c_long = 268; +pub const SYS_faccessat: ::c_long = 269; +pub const SYS_pselect6: ::c_long = 270; +pub const SYS_ppoll: ::c_long = 271; +pub const SYS_unshare: ::c_long = 272; +pub const SYS_set_robust_list: ::c_long = 273; +pub const SYS_get_robust_list: ::c_long = 274; +pub const SYS_splice: ::c_long = 275; +pub const SYS_tee: ::c_long = 276; +pub const SYS_sync_file_range: ::c_long = 277; +pub const SYS_vmsplice: ::c_long = 278; +pub const SYS_move_pages: ::c_long = 279; +pub const SYS_utimensat: ::c_long = 280; +pub const SYS_epoll_pwait: ::c_long = 281; +pub const SYS_signalfd: ::c_long = 282; +pub const SYS_timerfd_create: ::c_long = 283; +pub const SYS_eventfd: ::c_long = 284; +pub const SYS_fallocate: ::c_long = 285; +pub const SYS_timerfd_settime: ::c_long = 286; +pub const SYS_timerfd_gettime: ::c_long = 287; +pub const SYS_accept4: ::c_long = 288; +pub const SYS_signalfd4: ::c_long = 289; +pub const SYS_eventfd2: ::c_long = 290; +pub const SYS_epoll_create1: ::c_long = 291; +pub const SYS_dup3: ::c_long = 292; +pub const SYS_pipe2: ::c_long = 293; +pub const SYS_inotify_init1: ::c_long = 294; +pub const SYS_preadv: ::c_long = 295; +pub const SYS_pwritev: ::c_long = 296; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; +pub const SYS_perf_event_open: ::c_long = 298; +pub const SYS_recvmmsg: ::c_long = 299; +pub const SYS_fanotify_init: ::c_long = 300; +pub const SYS_fanotify_mark: ::c_long = 301; +pub const SYS_prlimit64: ::c_long = 302; +pub const SYS_name_to_handle_at: ::c_long = 303; +pub const SYS_open_by_handle_at: ::c_long = 304; +pub const SYS_clock_adjtime: ::c_long = 305; +pub const SYS_syncfs: ::c_long = 306; +pub const SYS_sendmmsg: ::c_long = 307; +pub const SYS_setns: ::c_long = 308; +pub const SYS_getcpu: ::c_long = 309; +pub const SYS_process_vm_readv: ::c_long = 310; +pub const SYS_process_vm_writev: ::c_long = 311; +pub const SYS_kcmp: ::c_long = 312; +pub const SYS_finit_module: ::c_long = 313; +pub const SYS_sched_setattr: ::c_long = 314; +pub const SYS_sched_getattr: ::c_long = 315; +pub const SYS_renameat2: ::c_long = 316; +pub const SYS_seccomp: ::c_long = 317; +pub const SYS_getrandom: ::c_long = 318; +pub const SYS_memfd_create: ::c_long = 319; +pub const SYS_kexec_file_load: ::c_long = 320; +pub const SYS_bpf: ::c_long = 321; +pub const SYS_execveat: ::c_long = 322; +pub const SYS_userfaultfd: ::c_long = 323; +pub const SYS_membarrier: ::c_long = 324; +pub const SYS_mlock2: ::c_long = 325; +pub const SYS_copy_file_range: ::c_long = 326; +pub const SYS_preadv2: ::c_long = 327; +pub const SYS_pwritev2: ::c_long = 328; +// FIXME syscalls 329-331 have been added in musl 1.16 +// See discussion https://github.com/rust-lang/libc/pull/699 + +// offsets in user_regs_structs, from sys/reg.h +pub const R15: ::c_int = 0; +pub const R14: ::c_int = 1; +pub const R13: ::c_int = 2; +pub const R12: ::c_int = 3; +pub const RBP: ::c_int = 4; +pub const RBX: ::c_int = 5; +pub const R11: ::c_int = 6; +pub const R10: ::c_int = 7; +pub const R9: ::c_int = 8; +pub const R8: ::c_int = 9; +pub const RAX: ::c_int = 10; +pub const RCX: ::c_int = 11; +pub const RDX: ::c_int = 12; +pub const RSI: ::c_int = 13; +pub const RDI: ::c_int = 14; +pub const ORIG_RAX: ::c_int = 15; +pub const RIP: ::c_int = 16; +pub const CS: ::c_int = 17; +pub const EFLAGS: ::c_int = 18; +pub const RSP: ::c_int = 19; +pub const SS: ::c_int = 20; +pub const FS_BASE: ::c_int = 21; +pub const GS_BASE: ::c_int = 22; +pub const DS: ::c_int = 23; +pub const ES: ::c_int = 24; +pub const FS: ::c_int = 25; +pub const GS: ::c_int = 26; + +pub const MAP_32BIT: ::c_int = 0x0040; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +#[doc(hidden)] +pub const AF_MAX: ::c_int = 42; +#[doc(hidden)] +pub const PF_MAX: ::c_int = AF_MAX; diff --git a/src/vendor/libc/src/lib.rs b/src/vendor/libc/src/lib.rs index 366ccff171..74634a1be4 100644 --- a/src/vendor/libc/src/lib.rs +++ b/src/vendor/libc/src/lib.rs @@ -100,176 +100,183 @@ extern crate std as core; #[macro_use] mod macros; mod dox; -// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable -// more optimization opportunities around it recognizing things like -// malloc/free. -#[repr(u8)] -pub enum c_void { - // Two dummy variants so the #[repr] attribute can be used. - #[doc(hidden)] - __variant1, - #[doc(hidden)] - __variant2, -} +cfg_if! { + if #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] { + // empty ... + } else { -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; + // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable + // more optimization opportunities around it recognizing things like + // malloc/free. + #[repr(u8)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; + pub type int8_t = i8; + pub type int16_t = i16; + pub type int32_t = i32; + pub type int64_t = i64; + pub type uint8_t = u8; + pub type uint16_t = u16; + pub type uint32_t = u32; + pub type uint64_t = u64; -pub type size_t = usize; -pub type ptrdiff_t = isize; -pub type intptr_t = isize; -pub type uintptr_t = usize; -pub type ssize_t = isize; + pub type c_schar = i8; + pub type c_uchar = u8; + pub type c_short = i16; + pub type c_ushort = u16; + pub type c_int = i32; + pub type c_uint = u32; + pub type c_float = f32; + pub type c_double = f64; + pub type c_longlong = i64; + pub type c_ulonglong = u64; + pub type intmax_t = i64; + pub type uintmax_t = u64; -pub enum FILE {} -pub enum fpos_t {} // TODO: fill this out with a struct + pub type size_t = usize; + pub type ptrdiff_t = isize; + pub type intptr_t = isize; + pub type uintptr_t = usize; + pub type ssize_t = isize; -extern { - pub fn isalnum(c: c_int) -> c_int; - pub fn isalpha(c: c_int) -> c_int; - pub fn iscntrl(c: c_int) -> c_int; - pub fn isdigit(c: c_int) -> c_int; - pub fn isgraph(c: c_int) -> c_int; - pub fn islower(c: c_int) -> c_int; - pub fn isprint(c: c_int) -> c_int; - pub fn ispunct(c: c_int) -> c_int; - pub fn isspace(c: c_int) -> c_int; - pub fn isupper(c: c_int) -> c_int; - pub fn isxdigit(c: c_int) -> c_int; - pub fn tolower(c: c_int) -> c_int; - pub fn toupper(c: c_int) -> c_int; + pub enum FILE {} + pub enum fpos_t {} // TODO: fill this out with a struct - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "fopen$UNIX2003")] - pub fn fopen(filename: *const c_char, - mode: *const c_char) -> *mut FILE; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "freopen$UNIX2003")] - pub fn freopen(filename: *const c_char, mode: *const c_char, - file: *mut FILE) -> *mut FILE; - pub fn fflush(file: *mut FILE) -> c_int; - pub fn fclose(file: *mut FILE) -> c_int; - pub fn remove(filename: *const c_char) -> c_int; - pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; - pub fn tmpfile() -> *mut FILE; - pub fn setvbuf(stream: *mut FILE, - buffer: *mut c_char, - mode: c_int, - size: size_t) -> c_int; - pub fn setbuf(stream: *mut FILE, buf: *mut c_char); - pub fn getchar() -> c_int; - pub fn putchar(c: c_int) -> c_int; - pub fn fgetc(stream: *mut FILE) -> c_int; - pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; - pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "fputs$UNIX2003")] - pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int; - pub fn puts(s: *const c_char) -> c_int; - pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; - pub fn fread(ptr: *mut c_void, - size: size_t, - nobj: size_t, - stream: *mut FILE) - -> size_t; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "fwrite$UNIX2003")] - pub fn fwrite(ptr: *const c_void, - size: size_t, - nobj: size_t, - stream: *mut FILE) - -> size_t; - pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; - pub fn ftell(stream: *mut FILE) -> c_long; - pub fn rewind(stream: *mut FILE); - #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] - pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] - pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; - pub fn feof(stream: *mut FILE) -> c_int; - pub fn ferror(stream: *mut FILE) -> c_int; - pub fn perror(s: *const c_char); - pub fn atoi(s: *const c_char) -> c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "strtod$UNIX2003")] - pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; - pub fn strtol(s: *const c_char, - endp: *mut *mut c_char, base: c_int) -> c_long; - pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, - base: c_int) -> c_ulong; - pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; - pub fn malloc(size: size_t) -> *mut c_void; - pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; - pub fn free(p: *mut c_void); - pub fn abort() -> !; - pub fn exit(status: c_int) -> !; - pub fn _exit(status: c_int) -> !; - pub fn atexit(cb: extern fn()) -> c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "system$UNIX2003")] - pub fn system(s: *const c_char) -> c_int; - pub fn getenv(s: *const c_char) -> *mut c_char; + extern { + pub fn isalnum(c: c_int) -> c_int; + pub fn isalpha(c: c_int) -> c_int; + pub fn iscntrl(c: c_int) -> c_int; + pub fn isdigit(c: c_int) -> c_int; + pub fn isgraph(c: c_int) -> c_int; + pub fn islower(c: c_int) -> c_int; + pub fn isprint(c: c_int) -> c_int; + pub fn ispunct(c: c_int) -> c_int; + pub fn isspace(c: c_int) -> c_int; + pub fn isupper(c: c_int) -> c_int; + pub fn isxdigit(c: c_int) -> c_int; + pub fn tolower(c: c_int) -> c_int; + pub fn toupper(c: c_int) -> c_int; - pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; - pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) - -> *mut c_char; - pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; - pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; - pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; - pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; - pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; - pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; - pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; - pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; - pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; - pub fn strdup(cs: *const c_char) -> *mut c_char; - pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; - pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; - pub fn strlen(cs: *const c_char) -> size_t; - pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "strerror$UNIX2003")] - pub fn strerror(n: c_int) -> *mut c_char; - pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; - pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; - pub fn wcslen(buf: *const wchar_t) -> size_t; - pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "fopen$UNIX2003")] + pub fn fopen(filename: *const c_char, + mode: *const c_char) -> *mut FILE; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "freopen$UNIX2003")] + pub fn freopen(filename: *const c_char, mode: *const c_char, + file: *mut FILE) -> *mut FILE; + pub fn fflush(file: *mut FILE) -> c_int; + pub fn fclose(file: *mut FILE) -> c_int; + pub fn remove(filename: *const c_char) -> c_int; + pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; + pub fn tmpfile() -> *mut FILE; + pub fn setvbuf(stream: *mut FILE, + buffer: *mut c_char, + mode: c_int, + size: size_t) -> c_int; + pub fn setbuf(stream: *mut FILE, buf: *mut c_char); + pub fn getchar() -> c_int; + pub fn putchar(c: c_int) -> c_int; + pub fn fgetc(stream: *mut FILE) -> c_int; + pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; + pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "fputs$UNIX2003")] + pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int; + pub fn puts(s: *const c_char) -> c_int; + pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; + pub fn fread(ptr: *mut c_void, + size: size_t, + nobj: size_t, + stream: *mut FILE) + -> size_t; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "fwrite$UNIX2003")] + pub fn fwrite(ptr: *const c_void, + size: size_t, + nobj: size_t, + stream: *mut FILE) + -> size_t; + pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; + pub fn ftell(stream: *mut FILE) -> c_long; + pub fn rewind(stream: *mut FILE); + #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] + pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] + pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; + pub fn feof(stream: *mut FILE) -> c_int; + pub fn ferror(stream: *mut FILE) -> c_int; + pub fn perror(s: *const c_char); + pub fn atoi(s: *const c_char) -> c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "strtod$UNIX2003")] + pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; + pub fn strtol(s: *const c_char, + endp: *mut *mut c_char, base: c_int) -> c_long; + pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, + base: c_int) -> c_ulong; + pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; + pub fn malloc(size: size_t) -> *mut c_void; + pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; + pub fn free(p: *mut c_void); + pub fn abort() -> !; + pub fn exit(status: c_int) -> !; + pub fn _exit(status: c_int) -> !; + pub fn atexit(cb: extern fn()) -> c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "system$UNIX2003")] + pub fn system(s: *const c_char) -> c_int; + pub fn getenv(s: *const c_char) -> *mut c_char; - pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; - pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; - pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; - pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; - pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; -} + pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; + pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) + -> *mut c_char; + pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; + pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; + pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; + pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; + pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; + pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; + pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; + pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; + pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; + pub fn strdup(cs: *const c_char) -> *mut c_char; + pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; + pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; + pub fn strlen(cs: *const c_char) -> size_t; + pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "strerror$UNIX2003")] + pub fn strerror(n: c_int) -> *mut c_char; + pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; + pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; + pub fn wcslen(buf: *const wchar_t) -> size_t; + pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t; -// These are all inline functions on android, so they end up just being entirely -// missing on that platform. -#[cfg(not(target_os = "android"))] -extern { - pub fn abs(i: c_int) -> c_int; - pub fn atof(s: *const c_char) -> c_double; - pub fn labs(i: c_long) -> c_long; - pub fn rand() -> c_int; - pub fn srand(seed: c_uint); + pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; + pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; + pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; + pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; + pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; + } + + // These are all inline functions on android, so they end up just being entirely + // missing on that platform. + #[cfg(not(target_os = "android"))] + extern { + pub fn abs(i: c_int) -> c_int; + pub fn atof(s: *const c_char) -> c_double; + pub fn labs(i: c_long) -> c_long; + pub fn rand() -> c_int; + pub fn srand(seed: c_uint); + } + } } cfg_if! { @@ -279,6 +286,9 @@ cfg_if! { } else if #[cfg(target_os = "redox")] { mod redox; pub use redox::*; + } else if #[cfg(target_os = "fuchsia")] { + mod fuchsia; + pub use fuchsia::*; } else if #[cfg(unix)] { mod unix; pub use unix::*; diff --git a/src/vendor/libc/src/unix/bsd/apple/mod.rs b/src/vendor/libc/src/unix/bsd/apple/mod.rs index 5b774703d7..8558957a10 100644 --- a/src/vendor/libc/src/unix/bsd/apple/mod.rs +++ b/src/vendor/libc/src/unix/bsd/apple/mod.rs @@ -23,6 +23,10 @@ pub type nl_item = ::c_int; pub type id_t = ::c_uint; pub type sem_t = ::c_int; pub type idtype_t = ::c_uint; +pub type integer_t = ::c_int; +pub type cpu_type_t = integer_t; +pub type cpu_subtype_t = integer_t; +pub type vm_prot_t = ::c_int; pub enum timezone {} @@ -418,6 +422,60 @@ s! { pub cr_ngroups: ::c_short, pub cr_groups: [::gid_t;16] } + + pub struct mach_header { + pub magic: u32, + pub cputype: cpu_type_t, + pub cpusubtype: cpu_subtype_t, + pub filetype: u32, + pub ncmds: u32, + pub sizeofcmds: u32, + pub flags: u32, + } + + pub struct mach_header_64 { + pub magic: u32, + pub cputype: cpu_type_t, + pub cpusubtype: cpu_subtype_t, + pub filetype: u32, + pub ncmds: u32, + pub sizeofcmds: u32, + pub flags: u32, + pub reserved: u32, + } + + pub struct segment_command { + pub cmd: u32, + pub cmdsize: u32, + pub segname: [::c_char; 16], + pub vmaddr: u32, + pub vmsize: u32, + pub fileoff: u32, + pub filesize: u32, + pub maxprot: vm_prot_t, + pub initprot: vm_prot_t, + pub nsects: u32, + pub flags: u32, + } + + pub struct segment_command_64 { + pub cmd: u32, + pub cmdsize: u32, + pub segname: [::c_char; 16], + pub vmaddr: u64, + pub vmsize: u64, + pub fileoff: u64, + pub filesize: u64, + pub maxprot: vm_prot_t, + pub initprot: vm_prot_t, + pub nsects: u32, + pub flags: u32, + } + + pub struct load_command { + pub cmd: u32, + pub cmdsize: u32, + } } pub const _UTX_USERSIZE: usize = 256; @@ -1063,7 +1121,7 @@ pub const IPPROTO_HOPOPTS: ::c_int = 0; // IPPROTO_ICMP defined in src/unix/mod.rs /// group mgmt protocol pub const IPPROTO_IGMP: ::c_int = 2; -/// gateway^2 (deprecated) +/// gateway2 (deprecated) pub const IPPROTO_GGP: ::c_int = 3; /// for compatibility pub const IPPROTO_IPIP: ::c_int = 4; @@ -1443,7 +1501,24 @@ pub const MSG_RCVMORE: ::c_int = 0x4000; pub const SCM_TIMESTAMP: ::c_int = 0x02; pub const SCM_CREDS: ::c_int = 0x03; -pub const IFF_LOOPBACK: ::c_int = 0x8; +/// https://github.com/aosm/xnu/blob/master/bsd/net/if.h#L140-L156 +pub const IFF_UP: ::c_int = 0x1; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link +pub const IFF_NOTRAILERS: ::c_int = 0x20; // obsolete: avoid use of trailers +pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated +pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100;// receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200;// receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x400;// transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x800;// can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000;// per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000;// per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000;// per link layer defined bit +pub const IFF_ALTPHYS: ::c_int = IFF_LINK2;// use alternate physical connection +pub const IFF_MULTICAST: ::c_int = 0x8000;// supports multicast pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; @@ -1967,6 +2042,12 @@ pub const MAXTHREADNAMESIZE: usize = 64; pub const XUCRED_VERSION: ::c_uint = 0; +pub const LC_SEGMENT: u32 = 0x1; +pub const LC_SEGMENT_64: u32 = 0x19; + +pub const MH_MAGIC: u32 = 0xfeedface; +pub const MH_MAGIC_64: u32 = 0xfeedfacf; + f! { pub fn WSTOPSIG(status: ::c_int) -> ::c_int { status >> 8 @@ -2158,6 +2239,10 @@ extern { pub fn brk(addr: *const ::c_void) -> *mut ::c_void; pub fn sbrk(increment: ::c_int) -> *mut ::c_void; pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + pub fn _dyld_image_count() -> u32; + pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header; + pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> ::intptr_t; + pub fn _dyld_get_image_name(image_index: u32) -> *const ::c_char; } cfg_if! { diff --git a/src/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs index ebfcd4b9d8..88708573b4 100644 --- a/src/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -174,6 +174,7 @@ pub const RAND_MAX: ::c_int = 0x7fff_ffff; pub const PTHREAD_STACK_MIN: ::size_t = 16384; pub const SIGSTKSZ: ::size_t = 40960; pub const MADV_INVAL: ::c_int = 10; +pub const MADV_SETMAP: ::c_int = 11; pub const O_CLOEXEC: ::c_int = 0x00020000; pub const O_DIRECTORY: ::c_int = 0x08000000; pub const F_GETLK: ::c_int = 7; @@ -386,6 +387,32 @@ pub const NOTE_CHILD: ::uint32_t = 0x00000004; pub const SO_SNDSPACE: ::c_int = 0x100a; pub const SO_CPUHINT: ::c_int = 0x1030; +// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101 +pub const IFF_UP: ::c_int = 0x1; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link +pub const IFF_SMART: ::c_int = 0x20; // interface manages own routes +pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated +pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets +pub const IFF_OACTIVE_COMPAT: ::c_int = 0x400; // was transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast +// was interface is in polling mode +pub const IFF_POLLING_COMPAT: ::c_int = 0x10000; +pub const IFF_PPROMISC: ::c_int = 0x20000; // user-requested promisc mode +pub const IFF_MONITOR: ::c_int = 0x40000; // user-requested monitor mode +pub const IFF_STATICARP: ::c_int = 0x80000; // static ARP +pub const IFF_NPOLLING: ::c_int = 0x100000; // interface is in polling mode +pub const IFF_IDIRECT: ::c_int = 0x200000; // direct input + // // sys/netinet/in.h // Protocols (RFC 1700) @@ -687,6 +714,9 @@ pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125; pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126; pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127; +pub const WCONTINUED: ::c_int = 4; +pub const WSTOPPED: ::c_int = 0o177; + extern { pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; diff --git a/src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs index 0ac797ce4c..6ba14f5989 100644 --- a/src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -425,6 +425,38 @@ pub const AF_INET6_SDP: ::c_int = 42; #[doc(hidden)] pub const AF_MAX: ::c_int = 42; +// https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140 +pub const IFF_UP: ::c_int = 0x1; // (n) interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // (i) broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // (n) turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // (i) is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link +// 0x20 was IFF_SMART +pub const IFF_RUNNING: ::c_int = 0x40; // (d) resources allocated +#[deprecated(since="0.2.34", + note="please use the portable `IFF_RUNNING` constant instead")] +pub const IFF_DRV_RUNNING: ::c_int = 0x40; +pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full +#[deprecated(since="0.2.34", + note="please use the portable `IFF_OACTIVE` constant instead")] +pub const IFF_DRV_OACTIVE: ::c_int = 0x400; +pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection +pub const IFF_MULTICAST: ::c_int = 0x8000; // (i) supports multicast +// (i) unconfigurable using ioctl(2) +pub const IFF_CANTCONFIG: ::c_int = 0x10000; +pub const IFF_PPROMISC: ::c_int = 0x20000; // (n) user-requested promisc mode +pub const IFF_MONITOR: ::c_int = 0x40000; // (n) user-requested monitor mode +pub const IFF_STATICARP: ::c_int = 0x80000; // (n) static ARP +pub const IFF_DYING: ::c_int = 0x200000; // (n) interface is winding down +pub const IFF_RENAMING: ::c_int = 0x400000; // (n) interface is being renamed + // sys/netinet/in.h // Protocols (RFC 1700) // NOTE: These are in addition to the constants defined in src/unix/mod.rs @@ -703,6 +735,7 @@ pub const SHM_LOCK: ::c_int = 11; pub const SHM_UNLOCK: ::c_int = 12; pub const SHM_STAT: ::c_int = 13; pub const SHM_INFO: ::c_int = 14; +pub const SHM_ANON: *mut ::c_char = 1 as *mut ::c_char; // The *_MAXID constants never should've been used outside of the // FreeBSD base system. And with the exception of CTL_P1003_1B_MAXID, @@ -834,6 +867,9 @@ extern { pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, msgflg: ::c_int) -> ::c_int; pub fn cfmakesane(termios: *mut ::termios); + pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, + envp: *const *const ::c_char) + -> ::c_int; } cfg_if! { diff --git a/src/vendor/libc/src/unix/bsd/freebsdlike/mod.rs b/src/vendor/libc/src/unix/bsd/freebsdlike/mod.rs index 8cc87ce9f5..5703e073b7 100644 --- a/src/vendor/libc/src/unix/bsd/freebsdlike/mod.rs +++ b/src/vendor/libc/src/unix/bsd/freebsdlike/mod.rs @@ -640,8 +640,6 @@ pub const SO_RCVTIMEO: ::c_int = 0x1006; pub const SO_ERROR: ::c_int = 0x1007; pub const SO_TYPE: ::c_int = 0x1008; -pub const IFF_LOOPBACK: ::c_int = 0x8; - pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; @@ -1107,9 +1105,6 @@ extern { timeout: *const ::timespec, sigmask: *const sigset_t) -> ::c_int; pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; - pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, - envp: *const *const ::c_char) - -> ::c_int; } cfg_if! { diff --git a/src/vendor/libc/src/unix/bsd/netbsdlike/mod.rs b/src/vendor/libc/src/unix/bsd/netbsdlike/mod.rs index f9caca9e7a..9179e6afa2 100644 --- a/src/vendor/libc/src/unix/bsd/netbsdlike/mod.rs +++ b/src/vendor/libc/src/unix/bsd/netbsdlike/mod.rs @@ -448,8 +448,6 @@ pub const MSG_MCAST: ::c_int = 0x200; pub const MSG_NOSIGNAL: ::c_int = 0x400; pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800; -pub const IFF_LOOPBACK: ::c_int = 0x8; - pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; diff --git a/src/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs index cc9798c764..16f127e9cc 100644 --- a/src/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -346,6 +346,24 @@ pub const SO_TIMESTAMP: ::c_int = 0x2000; pub const SO_OVERFLOWED: ::c_int = 0x1009; pub const SO_NOHEADER: ::c_int = 0x100a; +// https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373 +pub const IFF_UP: ::c_int = 0x0001; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x0002; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x0004; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x0008; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x0010; // interface is point-to-point link +pub const IFF_NOTRAILERS: ::c_int = 0x0020; // avoid use of trailers +pub const IFF_RUNNING: ::c_int = 0x0040; // resources allocated +pub const IFF_NOARP: ::c_int = 0x0080; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x0400; // transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x0800; // can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast + // sys/netinet/in.h // Protocols (RFC 1700) // NOTE: These are in addition to the constants defined in src/unix/mod.rs diff --git a/src/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs index 227e8b3659..aeb302f188 100644 --- a/src/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs +++ b/src/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs @@ -221,6 +221,24 @@ pub const SO_RTABLE: ::c_int = 0x1021; pub const SO_PEERCRED: ::c_int = 0x1022; pub const SO_SPLICE: ::c_int = 0x1023; +// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187 +pub const IFF_UP: ::c_int = 0x1; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link +pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers +pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated +pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast + // sys/netinet/in.h // Protocols (RFC 1700) // NOTE: These are in addition to the constants defined in src/unix/mod.rs @@ -651,6 +669,8 @@ pub const SOCK_CLOEXEC: ::c_int = 0x8000; pub const SOCK_NONBLOCK: ::c_int = 0x4000; pub const SOCK_DNS: ::c_int = 0x1000; +pub const WCONTINUED: ::c_int = 8; + f! { pub fn WIFCONTINUED(status: ::c_int) -> bool { status & 0o177777 == 0o177777 diff --git a/src/vendor/libc/src/unix/haiku/mod.rs b/src/vendor/libc/src/unix/haiku/mod.rs index 2b05e8ef87..01ad1e12a7 100644 --- a/src/vendor/libc/src/unix/haiku/mod.rs +++ b/src/vendor/libc/src/unix/haiku/mod.rs @@ -606,7 +606,20 @@ pub const MADV_RANDOM: ::c_int = 3; pub const MADV_WILLNEED: ::c_int = 4; pub const MADV_DONTNEED: ::c_int = 5; +// https://github.com/haiku/haiku/blob/master/headers/posix/net/if.h#L80 +pub const IFF_UP: ::c_int = 0x0001; +pub const IFF_BROADCAST: ::c_int = 0x0002; // valid broadcast address pub const IFF_LOOPBACK: ::c_int = 0x0008; +pub const IFF_POINTOPOINT: ::c_int = 0x0010; // point-to-point link +pub const IFF_NOARP: ::c_int = 0x0040; // no address resolution +pub const IFF_AUTOUP: ::c_int = 0x0080; // auto dial +pub const IFF_PROMISC: ::c_int = 0x0100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x0200; // receive all multicast packets +pub const IFF_SIMPLEX: ::c_int = 0x0800; // doesn't receive own transmissions +pub const IFF_LINK: ::c_int = 0x1000; // has link +pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000; +pub const IFF_CONFIGURING: ::c_int = 0x4000; +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast pub const AF_UNSEC: ::c_int = 0; pub const AF_INET: ::c_int = 1; @@ -1099,6 +1112,7 @@ extern { addrlen: *mut ::socklen_t) -> ::ssize_t; pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; + pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; pub fn bind(socket: ::c_int, address: *const ::sockaddr, diff --git a/src/vendor/libc/src/unix/newlib/aarch64/mod.rs b/src/vendor/libc/src/unix/newlib/aarch64/mod.rs new file mode 100644 index 0000000000..96f381a391 --- /dev/null +++ b/src/vendor/libc/src/unix/newlib/aarch64/mod.rs @@ -0,0 +1,5 @@ +pub type c_char = u8; +pub type wchar_t = u32; + +pub type c_long = i64; +pub type c_ulong = u64; diff --git a/src/vendor/libc/src/unix/newlib/mod.rs b/src/vendor/libc/src/unix/newlib/mod.rs index d895541124..6cf8633e6b 100644 --- a/src/vendor/libc/src/unix/newlib/mod.rs +++ b/src/vendor/libc/src/unix/newlib/mod.rs @@ -517,6 +517,26 @@ pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; pub const INET_ADDRSTRLEN: ::c_int = 16; +// https://github. +// com/bminor/newlib/blob/master/newlib/libc/sys/linux/include/net/if.h#L121 +pub const IFF_UP: ::c_int = 0x1; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link +pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers +pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated +pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast + pub const IPPROTO_IP: ::c_int = 0; pub const IPPROTO_UDP: ::c_int = 17; pub const IPPROTO_TCP: ::c_int = 6; @@ -659,6 +679,9 @@ cfg_if! { if #[cfg(target_arch = "arm")] { mod arm; pub use self::arm::*; + } else if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; } else { // Only tested on ARM so far. Other platforms might have different // definitions for types and constants. diff --git a/src/vendor/libc/src/unix/notbsd/android/mod.rs b/src/vendor/libc/src/unix/notbsd/android/mod.rs index 88e5cea236..3eb5eb4bcb 100644 --- a/src/vendor/libc/src/unix/notbsd/android/mod.rs +++ b/src/vendor/libc/src/unix/notbsd/android/mod.rs @@ -848,6 +848,9 @@ pub const NETLINK_NO_ENOBUFS: ::c_int = 5; pub const NETLINK_RX_RING: ::c_int = 6; pub const NETLINK_TX_RING: ::c_int = 7; +pub const GRND_NONBLOCK: ::c_uint = 0x0001; +pub const GRND_RANDOM: ::c_uint = 0x0002; + pub const NLA_F_NESTED: ::c_int = 1 << 15; pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14; pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER); @@ -882,6 +885,9 @@ pub const IUTF8: ::tcflag_t = 0x00004000; pub const CMSPAR: ::tcflag_t = 0o10000000000; pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; +pub const MFD_CLOEXEC: ::c_uint = 0x0001; +pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; + f! { pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { for slot in cpuset.__bits.iter_mut() { @@ -1121,6 +1127,7 @@ extern { attr: *const ::pthread_attr_t, f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int; + pub fn __errno() -> *mut ::c_int; } cfg_if! { diff --git a/src/vendor/libc/src/unix/notbsd/linux/mips/mod.rs b/src/vendor/libc/src/unix/notbsd/linux/mips/mod.rs index 1b4eb25cfa..a94e2bcddb 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/mips/mod.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/mips/mod.rs @@ -50,6 +50,7 @@ pub const O_TRUNC: ::c_int = 512; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_CLOEXEC: ::c_int = 0x80000; pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const EBFONT: ::c_int = 59; pub const ENOSTR: ::c_int = 60; diff --git a/src/vendor/libc/src/unix/notbsd/linux/mod.rs b/src/vendor/libc/src/unix/notbsd/linux/mod.rs index e85797670f..46cf538f17 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/mod.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/mod.rs @@ -23,6 +23,17 @@ pub type __s16 = ::c_short; pub type __u32 = ::c_uint; pub type __s32 = ::c_int; +pub type Elf32_Half = u16; +pub type Elf32_Word = u32; +pub type Elf32_Off = u32; +pub type Elf32_Addr = u32; + +pub type Elf64_Half = u16; +pub type Elf64_Word = u32; +pub type Elf64_Off = u64; +pub type Elf64_Addr = u64; +pub type Elf64_Xword = u64; + pub enum fpos64_t {} // TODO: fill this out with a struct s! { @@ -391,6 +402,52 @@ s! { #[cfg(target_pointer_width = "32")] pub u: [u32; 7], } + + pub struct dl_phdr_info { + #[cfg(target_pointer_width = "64")] + pub dlpi_addr: Elf64_Addr, + #[cfg(target_pointer_width = "32")] + pub dlpi_addr: Elf32_Addr, + + pub dlpi_name: *const ::c_char, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phdr: *const Elf64_Phdr, + #[cfg(target_pointer_width = "32")] + pub dlpi_phdr: *const Elf32_Phdr, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phnum: Elf64_Half, + #[cfg(target_pointer_width = "32")] + pub dlpi_phnum: Elf32_Half, + + pub dlpi_adds: ::c_ulonglong, + pub dlpi_subs: ::c_ulonglong, + pub dlpi_tls_modid: ::size_t, + pub dlpi_tls_data: *mut ::c_void, + } + + pub struct Elf32_Phdr { + pub p_type: Elf32_Word, + pub p_offset: Elf32_Off, + pub p_vaddr: Elf32_Addr, + pub p_paddr: Elf32_Addr, + pub p_filesz: Elf32_Word, + pub p_memsz: Elf32_Word, + pub p_flags: Elf32_Word, + pub p_align: Elf32_Word, + } + + pub struct Elf64_Phdr { + pub p_type: Elf64_Word, + pub p_flags: Elf64_Word, + pub p_offset: Elf64_Off, + pub p_vaddr: Elf64_Addr, + pub p_paddr: Elf64_Addr, + pub p_filesz: Elf64_Xword, + pub p_memsz: Elf64_Xword, + pub p_align: Elf64_Xword, + } } pub const ABDAY_1: ::nl_item = 0x20000; @@ -996,6 +1053,9 @@ pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; +pub const GRND_NONBLOCK: ::c_uint = 0x0001; +pub const GRND_RANDOM: ::c_uint = 0x0002; + pub const ITIMER_REAL: ::c_int = 0; pub const ITIMER_VIRTUAL: ::c_int = 1; pub const ITIMER_PROF: ::c_int = 2; @@ -1024,7 +1084,26 @@ pub const ENOATTR: ::c_int = ::ENODATA; pub const SO_ORIGINAL_DST: ::c_int = 80; pub const IUTF8: ::tcflag_t = 0x00004000; pub const CMSPAR: ::tcflag_t = 0o10000000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const MFD_CLOEXEC: ::c_uint = 0x0001; +pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; + +// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has +// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32 +// so we can use that type here to avoid having to cast. +pub const PT_NULL: u32 = 0; +pub const PT_LOAD: u32 = 1; +pub const PT_DYNAMIC: u32 = 2; +pub const PT_INTERP: u32 = 3; +pub const PT_NOTE: u32 = 4; +pub const PT_SHLIB: u32 = 5; +pub const PT_PHDR: u32 = 6; +pub const PT_TLS: u32 = 7; +pub const PT_NUM: u32 = 8; +pub const PT_LOOS: u32 = 0x60000000; +pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; +pub const PT_GNU_STACK: u32 = 0x6474e551; +pub const PT_GNU_RELRO: u32 = 0x6474e552; f! { pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { @@ -1483,6 +1562,14 @@ extern { attr: *const ::pthread_attr_t, f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int; + pub fn dl_iterate_phdr( + callback: Option ::c_int>, + data: *mut ::c_void + ) -> ::c_int; } cfg_if! { diff --git a/src/vendor/libc/src/unix/notbsd/linux/musl/mod.rs b/src/vendor/libc/src/unix/notbsd/linux/musl/mod.rs index 4ac058db10..30e8e51d9f 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/musl/mod.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/musl/mod.rs @@ -90,6 +90,7 @@ pub const NCCS: usize = 32; pub const O_TRUNC: ::c_int = 512; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_CLOEXEC: ::c_int = 0x80000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const EBFONT: ::c_int = 59; pub const ENOSTR: ::c_int = 60; diff --git a/src/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs b/src/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs index 727bebaca2..8536353fb4 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs @@ -87,6 +87,7 @@ pub const O_DSYNC: ::c_int = 4096; pub const O_FSYNC: ::c_int = 0x101000; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const MAP_GROWSDOWN: ::c_int = 0x0100; diff --git a/src/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs b/src/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs index 1a95fcc8a4..923047efef 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs @@ -145,6 +145,7 @@ pub const O_DSYNC: ::c_int = 4096; pub const O_FSYNC: ::c_int = 0x101000; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const MAP_GROWSDOWN: ::c_int = 0x0100; diff --git a/src/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs b/src/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs index 77f82290fa..65f2fa200d 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs @@ -132,6 +132,7 @@ pub const O_DSYNC: ::c_int = 4096; pub const O_FSYNC: ::c_int = 0x101000; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const MAP_GROWSDOWN: ::c_int = 0x0100; diff --git a/src/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs b/src/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs index f3e4fe604d..819246ea9b 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs @@ -145,6 +145,7 @@ pub const O_DSYNC: ::c_int = 0x2000; pub const O_FSYNC: ::c_int = 0x802000; pub const O_NOATIME: ::c_int = 0x200000; pub const O_PATH: ::c_int = 0x1000000; +pub const O_TMPFILE: ::c_int = 0o200000000 | O_DIRECTORY; pub const MAP_GROWSDOWN: ::c_int = 0x0200; @@ -349,9 +350,6 @@ pub const SO_SNDTIMEO: ::c_int = 0x4000; pub const FIOCLEX: ::c_ulong = 0x20006601; pub const FIONBIO: ::c_ulong = 0x8004667e; -pub const SYS_gettid: ::c_long = 143; -pub const SYS_perf_event_open: ::c_long = 327; - pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; @@ -435,6 +433,346 @@ pub const TIOCGWINSZ: ::c_ulong = 0x40087468; pub const TIOCSWINSZ: ::c_ulong = 0x80087467; pub const FIONREAD: ::c_ulong = 0x4004667f; +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_wait4: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execv: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_chown: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_brk: ::c_long = 17; +pub const SYS_perfctr: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_capget: ::c_long = 21; +pub const SYS_capset: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_vmsplice: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_sigaltstack: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_stat: ::c_long = 38; +pub const SYS_sendfile: ::c_long = 39; +pub const SYS_lstat: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_umount2: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_memory_ordering: ::c_long = 52; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_reboot: ::c_long = 55; +pub const SYS_symlink: ::c_long = 57; +pub const SYS_readlink: ::c_long = 58; +pub const SYS_execve: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_fstat: ::c_long = 62; +pub const SYS_fstat64: ::c_long = 63; +pub const SYS_getpagesize: ::c_long = 64; +pub const SYS_msync: ::c_long = 65; +pub const SYS_vfork: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_mmap: ::c_long = 71; +pub const SYS_munmap: ::c_long = 73; +pub const SYS_mprotect: ::c_long = 74; +pub const SYS_madvise: ::c_long = 75; +pub const SYS_vhangup: ::c_long = 76; +pub const SYS_mincore: ::c_long = 78; +pub const SYS_getgroups: ::c_long = 79; +pub const SYS_setgroups: ::c_long = 80; +pub const SYS_getpgrp: ::c_long = 81; +pub const SYS_setitimer: ::c_long = 83; +pub const SYS_swapon: ::c_long = 85; +pub const SYS_getitimer: ::c_long = 86; +pub const SYS_sethostname: ::c_long = 88; +pub const SYS_dup2: ::c_long = 90; +pub const SYS_fcntl: ::c_long = 92; +pub const SYS_select: ::c_long = 93; +pub const SYS_fsync: ::c_long = 95; +pub const SYS_setpriority: ::c_long = 96; +pub const SYS_socket: ::c_long = 97; +pub const SYS_connect: ::c_long = 98; +pub const SYS_accept: ::c_long = 99; +pub const SYS_getpriority: ::c_long = 100; +pub const SYS_rt_sigreturn: ::c_long = 101; +pub const SYS_rt_sigaction: ::c_long = 102; +pub const SYS_rt_sigprocmask: ::c_long = 103; +pub const SYS_rt_sigpending: ::c_long = 104; +pub const SYS_rt_sigtimedwait: ::c_long = 105; +pub const SYS_rt_sigqueueinfo: ::c_long = 106; +pub const SYS_rt_sigsuspend: ::c_long = 107; +pub const SYS_setresuid: ::c_long = 108; +pub const SYS_getresuid: ::c_long = 109; +pub const SYS_setresgid: ::c_long = 110; +pub const SYS_getresgid: ::c_long = 111; +pub const SYS_recvmsg: ::c_long = 113; +pub const SYS_sendmsg: ::c_long = 114; +pub const SYS_gettimeofday: ::c_long = 116; +pub const SYS_getrusage: ::c_long = 117; +pub const SYS_getsockopt: ::c_long = 118; +pub const SYS_getcwd: ::c_long = 119; +pub const SYS_readv: ::c_long = 120; +pub const SYS_writev: ::c_long = 121; +pub const SYS_settimeofday: ::c_long = 122; +pub const SYS_fchown: ::c_long = 123; +pub const SYS_fchmod: ::c_long = 124; +pub const SYS_recvfrom: ::c_long = 125; +pub const SYS_setreuid: ::c_long = 126; +pub const SYS_setregid: ::c_long = 127; +pub const SYS_rename: ::c_long = 128; +pub const SYS_truncate: ::c_long = 129; +pub const SYS_ftruncate: ::c_long = 130; +pub const SYS_flock: ::c_long = 131; +pub const SYS_lstat64: ::c_long = 132; +pub const SYS_sendto: ::c_long = 133; +pub const SYS_shutdown: ::c_long = 134; +pub const SYS_socketpair: ::c_long = 135; +pub const SYS_mkdir: ::c_long = 136; +pub const SYS_rmdir: ::c_long = 137; +pub const SYS_utimes: ::c_long = 138; +pub const SYS_stat64: ::c_long = 139; +pub const SYS_sendfile64: ::c_long = 140; +pub const SYS_getpeername: ::c_long = 141; +pub const SYS_futex: ::c_long = 142; +pub const SYS_gettid: ::c_long = 143; +pub const SYS_getrlimit: ::c_long = 144; +pub const SYS_setrlimit: ::c_long = 145; +pub const SYS_pivot_root: ::c_long = 146; +pub const SYS_prctl: ::c_long = 147; +pub const SYS_pciconfig_read: ::c_long = 148; +pub const SYS_pciconfig_write: ::c_long = 149; +pub const SYS_getsockname: ::c_long = 150; +pub const SYS_inotify_init: ::c_long = 151; +pub const SYS_inotify_add_watch: ::c_long = 152; +pub const SYS_poll: ::c_long = 153; +pub const SYS_getdents64: ::c_long = 154; +pub const SYS_inotify_rm_watch: ::c_long = 156; +pub const SYS_statfs: ::c_long = 157; +pub const SYS_fstatfs: ::c_long = 158; +pub const SYS_umount: ::c_long = 159; +pub const SYS_sched_set_affinity: ::c_long = 160; +pub const SYS_sched_get_affinity: ::c_long = 161; +pub const SYS_getdomainname: ::c_long = 162; +pub const SYS_setdomainname: ::c_long = 163; +pub const SYS_utrap_install: ::c_long = 164; +pub const SYS_quotactl: ::c_long = 165; +pub const SYS_set_tid_address: ::c_long = 166; +pub const SYS_mount: ::c_long = 167; +pub const SYS_ustat: ::c_long = 168; +pub const SYS_setxattr: ::c_long = 169; +pub const SYS_lsetxattr: ::c_long = 170; +pub const SYS_fsetxattr: ::c_long = 171; +pub const SYS_getxattr: ::c_long = 172; +pub const SYS_lgetxattr: ::c_long = 173; +pub const SYS_getdents: ::c_long = 174; +pub const SYS_setsid: ::c_long = 175; +pub const SYS_fchdir: ::c_long = 176; +pub const SYS_fgetxattr: ::c_long = 177; +pub const SYS_listxattr: ::c_long = 178; +pub const SYS_llistxattr: ::c_long = 179; +pub const SYS_flistxattr: ::c_long = 180; +pub const SYS_removexattr: ::c_long = 181; +pub const SYS_lremovexattr: ::c_long = 182; +pub const SYS_sigpending: ::c_long = 183; +pub const SYS_query_module: ::c_long = 184; +pub const SYS_setpgid: ::c_long = 185; +pub const SYS_fremovexattr: ::c_long = 186; +pub const SYS_tkill: ::c_long = 187; +pub const SYS_exit_group: ::c_long = 188; +pub const SYS_uname: ::c_long = 189; +pub const SYS_init_module: ::c_long = 190; +pub const SYS_personality: ::c_long = 191; +pub const SYS_remap_file_pages: ::c_long = 192; +pub const SYS_epoll_create: ::c_long = 193; +pub const SYS_epoll_ctl: ::c_long = 194; +pub const SYS_epoll_wait: ::c_long = 195; +pub const SYS_ioprio_set: ::c_long = 196; +pub const SYS_getppid: ::c_long = 197; +pub const SYS_sigaction: ::c_long = 198; +pub const SYS_sgetmask: ::c_long = 199; +pub const SYS_ssetmask: ::c_long = 200; +pub const SYS_sigsuspend: ::c_long = 201; +pub const SYS_oldlstat: ::c_long = 202; +pub const SYS_uselib: ::c_long = 203; +pub const SYS_readdir: ::c_long = 204; +pub const SYS_readahead: ::c_long = 205; +pub const SYS_socketcall: ::c_long = 206; +pub const SYS_syslog: ::c_long = 207; +pub const SYS_lookup_dcookie: ::c_long = 208; +pub const SYS_fadvise64: ::c_long = 209; +pub const SYS_fadvise64_64: ::c_long = 210; +pub const SYS_tgkill: ::c_long = 211; +pub const SYS_waitpid: ::c_long = 212; +pub const SYS_swapoff: ::c_long = 213; +pub const SYS_sysinfo: ::c_long = 214; +pub const SYS_ipc: ::c_long = 215; +pub const SYS_sigreturn: ::c_long = 216; +pub const SYS_clone: ::c_long = 217; +pub const SYS_ioprio_get: ::c_long = 218; +pub const SYS_adjtimex: ::c_long = 219; +pub const SYS_sigprocmask: ::c_long = 220; +pub const SYS_create_module: ::c_long = 221; +pub const SYS_delete_module: ::c_long = 222; +pub const SYS_get_kernel_syms: ::c_long = 223; +pub const SYS_getpgid: ::c_long = 224; +pub const SYS_bdflush: ::c_long = 225; +pub const SYS_sysfs: ::c_long = 226; +pub const SYS_afs_syscall: ::c_long = 227; +pub const SYS_setfsuid: ::c_long = 228; +pub const SYS_setfsgid: ::c_long = 229; +pub const SYS__newselect: ::c_long = 230; +pub const SYS_splice: ::c_long = 232; +pub const SYS_stime: ::c_long = 233; +pub const SYS_statfs64: ::c_long = 234; +pub const SYS_fstatfs64: ::c_long = 235; +pub const SYS__llseek: ::c_long = 236; +pub const SYS_mlock: ::c_long = 237; +pub const SYS_munlock: ::c_long = 238; +pub const SYS_mlockall: ::c_long = 239; +pub const SYS_munlockall: ::c_long = 240; +pub const SYS_sched_setparam: ::c_long = 241; +pub const SYS_sched_getparam: ::c_long = 242; +pub const SYS_sched_setscheduler: ::c_long =243; +pub const SYS_sched_getscheduler: ::c_long =244; +pub const SYS_sched_yield: ::c_long = 245; +pub const SYS_sched_get_priority_max: ::c_long =246; +pub const SYS_sched_get_priority_min: ::c_long =247; +pub const SYS_sched_rr_get_interval: ::c_long = 248; +pub const SYS_nanosleep: ::c_long = 249; +pub const SYS_mremap: ::c_long = 250; +pub const SYS__sysctl: ::c_long = 251; +pub const SYS_getsid: ::c_long = 252; +pub const SYS_fdatasync: ::c_long = 253; +pub const SYS_nfsservctl: ::c_long = 254; +pub const SYS_sync_file_range: ::c_long = 255; +pub const SYS_clock_settime: ::c_long = 256; +pub const SYS_clock_gettime: ::c_long = 257; +pub const SYS_clock_getres: ::c_long = 258; +pub const SYS_clock_nanosleep: ::c_long = 259; +pub const SYS_sched_getaffinity: ::c_long = 260; +pub const SYS_sched_setaffinity: ::c_long = 261; +pub const SYS_timer_settime: ::c_long = 262; +pub const SYS_timer_gettime: ::c_long = 263; +pub const SYS_timer_getoverrun: ::c_long = 264; +pub const SYS_timer_delete: ::c_long = 265; +pub const SYS_timer_create: ::c_long = 266; +pub const SYS_io_setup: ::c_long = 268; +pub const SYS_io_destroy: ::c_long = 269; +pub const SYS_io_submit: ::c_long = 270; +pub const SYS_io_cancel: ::c_long = 271; +pub const SYS_io_getevents: ::c_long = 272; +pub const SYS_mq_open: ::c_long = 273; +pub const SYS_mq_unlink: ::c_long = 274; +pub const SYS_mq_timedsend: ::c_long = 275; +pub const SYS_mq_timedreceive: ::c_long = 276; +pub const SYS_mq_notify: ::c_long = 277; +pub const SYS_mq_getsetattr: ::c_long = 278; +pub const SYS_waitid: ::c_long = 279; +pub const SYS_tee: ::c_long = 280; +pub const SYS_add_key: ::c_long = 281; +pub const SYS_request_key: ::c_long = 282; +pub const SYS_keyctl: ::c_long = 283; +pub const SYS_openat: ::c_long = 284; +pub const SYS_mkdirat: ::c_long = 285; +pub const SYS_mknodat: ::c_long = 286; +pub const SYS_fchownat: ::c_long = 287; +pub const SYS_futimesat: ::c_long = 288; +pub const SYS_fstatat64: ::c_long = 289; +pub const SYS_unlinkat: ::c_long = 290; +pub const SYS_renameat: ::c_long = 291; +pub const SYS_linkat: ::c_long = 292; +pub const SYS_symlinkat: ::c_long = 293; +pub const SYS_readlinkat: ::c_long = 294; +pub const SYS_fchmodat: ::c_long = 295; +pub const SYS_faccessat: ::c_long = 296; +pub const SYS_pselect6: ::c_long = 297; +pub const SYS_ppoll: ::c_long = 298; +pub const SYS_unshare: ::c_long = 299; +pub const SYS_set_robust_list: ::c_long = 300; +pub const SYS_get_robust_list: ::c_long = 301; +pub const SYS_migrate_pages: ::c_long =302; +pub const SYS_mbind: ::c_long = 303; +pub const SYS_get_mempolicy: ::c_long = 304; +pub const SYS_set_mempolicy: ::c_long = 305; +pub const SYS_kexec_load: ::c_long = 306; +pub const SYS_move_pages: ::c_long = 307; +pub const SYS_getcpu: ::c_long = 308; +pub const SYS_epoll_pwait: ::c_long = 309; +pub const SYS_utimensat: ::c_long = 310; +pub const SYS_signalfd: ::c_long = 311; +pub const SYS_timerfd_create: ::c_long = 312; +pub const SYS_eventfd: ::c_long = 313; +pub const SYS_fallocate: ::c_long = 314; +pub const SYS_timerfd_settime: ::c_long = 315; +pub const SYS_timerfd_gettime: ::c_long = 316; +pub const SYS_signalfd4: ::c_long = 317; +pub const SYS_eventfd2: ::c_long = 318; +pub const SYS_epoll_create1: ::c_long = 319; +pub const SYS_dup3: ::c_long = 320; +pub const SYS_pipe2: ::c_long = 321; +pub const SYS_inotify_init1: ::c_long = 322; +pub const SYS_accept4: ::c_long = 323; +pub const SYS_preadv: ::c_long = 324; +pub const SYS_pwritev: ::c_long = 325; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 326; +pub const SYS_perf_event_open: ::c_long = 327; +pub const SYS_recvmmsg: ::c_long = 328; +pub const SYS_fanotify_init: ::c_long = 329; +pub const SYS_fanotify_mark: ::c_long = 330; +pub const SYS_prlimit64: ::c_long = 331; +pub const SYS_name_to_handle_at: ::c_long = 332; +pub const SYS_open_by_handle_at: ::c_long = 333; +pub const SYS_clock_adjtime: ::c_long = 334; +pub const SYS_syncfs: ::c_long = 335; +pub const SYS_sendmmsg: ::c_long = 336; +pub const SYS_setns: ::c_long = 337; +pub const SYS_process_vm_readv: ::c_long = 338; +pub const SYS_process_vm_writev: ::c_long = 339; +pub const SYS_kern_features: ::c_long = 340; +pub const SYS_kcmp: ::c_long = 341; +pub const SYS_finit_module: ::c_long = 342; +pub const SYS_sched_setattr: ::c_long = 343; +pub const SYS_sched_getattr: ::c_long = 344; +pub const SYS_renameat2: ::c_long = 345; +pub const SYS_seccomp: ::c_long = 346; +pub const SYS_getrandom: ::c_long = 347; +pub const SYS_memfd_create: ::c_long = 348; +pub const SYS_bpf: ::c_long = 349; +pub const SYS_execveat: ::c_long = 350; +pub const SYS_membarrier: ::c_long = 351; +pub const SYS_userfaultfd: ::c_long = 352; +pub const SYS_bind: ::c_long = 353; +pub const SYS_listen: ::c_long = 354; +pub const SYS_setsockopt: ::c_long = 355; +pub const SYS_mlock2: ::c_long = 356; +pub const SYS_copy_file_range: ::c_long = 357; +pub const SYS_preadv2: ::c_long = 358; +pub const SYS_pwritev2: ::c_long = 359; + #[link(name = "util")] extern { pub fn sysctl(name: *mut ::c_int, diff --git a/src/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs index f643325113..5689aaa20f 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs @@ -249,6 +249,7 @@ pub const O_DSYNC: ::c_int = 4096; pub const O_FSYNC: ::c_int = 0x101000; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const MAP_GROWSDOWN: ::c_int = 0x0100; diff --git a/src/vendor/libc/src/unix/notbsd/linux/s390x.rs b/src/vendor/libc/src/unix/notbsd/linux/s390x.rs index c2373f5744..aef8825994 100644 --- a/src/vendor/libc/src/unix/notbsd/linux/s390x.rs +++ b/src/vendor/libc/src/unix/notbsd/linux/s390x.rs @@ -323,10 +323,11 @@ pub const SFD_CLOEXEC: ::c_int = 0x080000; pub const NCCS: usize = 32; pub const O_TRUNC: ::c_int = 512; -pub const O_LARGEFILE: ::c_int = 0o0100000; +pub const O_LARGEFILE: ::c_int = 0; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_CLOEXEC: ::c_int = 0x80000; pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const EBFONT: ::c_int = 59; pub const ENOSTR: ::c_int = 60; @@ -913,8 +914,8 @@ pub const ECHOPRT: ::tcflag_t = 0o002000; pub const ECHOKE: ::tcflag_t = 0o004000; pub const PENDIN: ::tcflag_t = 0o040000; -pub const POLLWRNORM: ::c_short = 0x004; -pub const POLLWRBAND: ::c_short = 0x100; +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; pub const IXON: ::tcflag_t = 0o002000; pub const IXOFF: ::tcflag_t = 0o010000; @@ -1219,20 +1220,20 @@ pub const SYS_mlock2: ::c_long = 374; pub const SYS_copy_file_range: ::c_long = 375; pub const SYS_preadv2: ::c_long = 376; pub const SYS_pwritev2: ::c_long = 377; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; +pub const SYS_lchown: ::c_long = 198; +pub const SYS_setuid: ::c_long = 213; +pub const SYS_getuid: ::c_long = 199; +pub const SYS_setgid: ::c_long = 214; +pub const SYS_getgid: ::c_long = 200; +pub const SYS_geteuid: ::c_long = 201; +pub const SYS_setreuid: ::c_long = 203; +pub const SYS_setregid: ::c_long = 204; +pub const SYS_getrlimit: ::c_long = 191; +pub const SYS_getgroups: ::c_long = 205; +pub const SYS_fchown: ::c_long = 207; +pub const SYS_setresuid: ::c_long = 208; +pub const SYS_setresgid: ::c_long = 210; +pub const SYS_getresgid: ::c_long = 211; pub const SYS_select: ::c_long = 142; pub const SYS_getegid: ::c_long = 202; pub const SYS_setgroups: ::c_long = 206; diff --git a/src/vendor/libc/src/unix/solaris/mod.rs b/src/vendor/libc/src/unix/solaris/mod.rs index a6c2d4bf97..4350a28eee 100644 --- a/src/vendor/libc/src/unix/solaris/mod.rs +++ b/src/vendor/libc/src/unix/solaris/mod.rs @@ -32,7 +32,6 @@ pub type sa_family_t = u16; pub type pthread_t = ::c_uint; pub type pthread_key_t = ::c_uint; pub type blksize_t = ::c_int; -pub type fflags_t = ::c_int; pub type nl_item = ::c_int; pub type id_t = ::c_int; pub type idtype_t = ::c_uint; @@ -119,7 +118,7 @@ s! { } pub struct cmsghdr { - pub cmsg_len: ::size_t, + pub cmsg_len: ::socklen_t, pub cmsg_level: ::c_int, pub cmsg_type: ::c_int, } @@ -177,7 +176,7 @@ s! { pub d_ino: ::ino_t, pub d_off: ::off_t, pub d_reclen: u16, - pub d_name: [::c_char; 1] + pub d_name: [::c_char; 3] } pub struct glob_t { @@ -352,7 +351,7 @@ s! { pub portev_source: ::c_ushort, pub portev_pad: ::c_ushort, pub portev_object: ::uintptr_t, - pub portev_user: ::uintptr_t, + pub portev_user: *mut ::c_void, } } @@ -867,7 +866,48 @@ pub const SO_TYPE: ::c_int = 0x1008; pub const MSG_PEEK: ::c_int = 0x2; -pub const IFF_LOOPBACK: ::c_int = 0x8; +// https://docs.oracle.com/cd/E23824_01/html/821-1475/if-7p.html +pub const IFF_UP: ::c_int = 0x0000000001; // Address is up +pub const IFF_BROADCAST: ::c_int = 0x0000000002; // Broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x0000000004; // Turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x0000000008; // Loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x0000000010; // Interface is p-to-p +pub const IFF_NOTRAILERS: ::c_int = 0x0000000020; // Avoid use of trailers +pub const IFF_RUNNING: ::c_int = 0x0000000040; // Resources allocated +pub const IFF_NOARP: ::c_int = 0x0000000080; // No address res. protocol +pub const IFF_PROMISC: ::c_int = 0x0000000100; // Receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x0000000200; // Receive all multicast pkts +pub const IFF_INTELLIGENT: ::c_int = 0x0000000400; // Protocol code on board +pub const IFF_MULTICAST: ::c_int = 0x0000000800; // Supports multicast +// Multicast using broadcst. add. +pub const IFF_MULTI_BCAST: ::c_int = 0x0000001000; +pub const IFF_UNNUMBERED: ::c_int = 0x0000002000; // Non-unique address +pub const IFF_DHCPRUNNING: ::c_int = 0x0000004000; // DHCP controls interface +pub const IFF_PRIVATE: ::c_int = 0x0000008000; // Do not advertise +pub const IFF_NOXMIT: ::c_int = 0x0000010000; // Do not transmit pkts +// No address - just on-link subnet +pub const IFF_NOLOCAL: ::c_int = 0x0000020000; +pub const IFF_DEPRECATED: ::c_int = 0x0000040000; // Address is deprecated +pub const IFF_ADDRCONF: ::c_int = 0x0000080000; // Addr. from stateless addrconf +pub const IFF_ROUTER: ::c_int = 0x0000100000; // Router on interface +pub const IFF_NONUD: ::c_int = 0x0000200000; // No NUD on interface +pub const IFF_ANYCAST: ::c_int = 0x0000400000; // Anycast address +pub const IFF_NORTEXCH: ::c_int = 0x0000800000; // Don't xchange rout. info +pub const IFF_IPV4: ::c_int = 0x0001000000; // IPv4 interface +pub const IFF_IPV6: ::c_int = 0x0002000000; // IPv6 interface +pub const IFF_NOFAILOVER: ::c_int = 0x0008000000; // in.mpathd test address +pub const IFF_FAILED: ::c_int = 0x0010000000; // Interface has failed +pub const IFF_STANDBY: ::c_int = 0x0020000000; // Interface is a hot-spare +pub const IFF_INACTIVE: ::c_int = 0x0040000000; // Functioning but not used +pub const IFF_OFFLINE: ::c_int = 0x0080000000; // Interface is offline +// If CoS marking is supported +pub const IFF_COS_ENABLED: ::c_longlong = 0x0200000000; +pub const IFF_PREFERRED: ::c_longlong = 0x0400000000; // Prefer as source addr. +pub const IFF_TEMPORARY: ::c_longlong = 0x0800000000; // RFC3041 +pub const IFF_FIXEDMTU: ::c_longlong = 0x1000000000; // MTU set with SIOCSLIFMTU +pub const IFF_VIRTUAL: ::c_longlong = 0x2000000000; // Cannot send/receive pkts +pub const IFF_DUPLICATE: ::c_longlong = 0x4000000000; // Local address in use +pub const IFF_IPMP: ::c_longlong = 0x8000000000; // IPMP IP interface pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; @@ -1221,7 +1261,7 @@ extern { mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; - pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn sethostname(name: *mut ::c_char, len: ::c_int) -> ::c_int; pub fn if_nameindex() -> *mut if_nameindex; pub fn if_freenameindex(ptr: *mut if_nameindex); pub fn pthread_create(native: *mut ::pthread_t, @@ -1266,7 +1306,8 @@ extern { flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::ssize_t; pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; - pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; + pub fn futimesat(fd: ::c_int, path: *const ::c_char, + times: *const ::timeval) -> ::c_int; pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; @@ -1289,13 +1330,13 @@ extern { pub fn port_create() -> ::c_int; pub fn port_associate(port: ::c_int, source: ::c_int, object: ::uintptr_t, - events: ::c_int, user: ::uintptr_t) -> ::c_int; + events: ::c_int, user: *mut ::c_void) -> ::c_int; pub fn port_dissociate(port: ::c_int, source: ::c_int, object: ::uintptr_t) -> ::c_int; pub fn port_get(port: ::c_int, pe: *mut port_event, - timeout: *const ::timespec) -> ::c_int; + timeout: *mut ::timespec) -> ::c_int; pub fn port_getn(port: ::c_int, pe_list: *mut port_event, max: ::c_uint, - nget: *mut ::c_uint, timeout: *const ::timespec) + nget: *mut ::c_uint, timeout: *mut ::timespec) -> ::c_int; pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char) @@ -1306,9 +1347,6 @@ extern { buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003")] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn sem_close(sem: *mut sem_t) -> ::c_int; @@ -1319,8 +1357,6 @@ extern { buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003")] pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; @@ -1328,22 +1364,18 @@ extern { pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] pub fn getpwnam_r(name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] pub fn getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch ="x86"), - link_name = "sigwait$UNIX2003")] #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; @@ -1351,8 +1383,6 @@ extern { parent: Option, child: Option) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003")] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; } diff --git a/src/vendor/libc/src/unix/uclibc/mod.rs b/src/vendor/libc/src/unix/uclibc/mod.rs index 87521b2a81..df5ea71e8e 100644 --- a/src/vendor/libc/src/unix/uclibc/mod.rs +++ b/src/vendor/libc/src/unix/uclibc/mod.rs @@ -653,21 +653,24 @@ pub const MADV_MERGEABLE: ::c_int = 12; pub const MADV_UNMERGEABLE: ::c_int = 13; pub const MADV_HWPOISON: ::c_int = 100; -pub const IFF_UP: ::c_int = 0x1; -pub const IFF_BROADCAST: ::c_int = 0x2; -pub const IFF_DEBUG: ::c_int = 0x4; -pub const IFF_LOOPBACK: ::c_int = 0x8; -pub const IFF_POINTOPOINT: ::c_int = 0x10; -pub const IFF_NOTRAILERS: ::c_int = 0x20; -pub const IFF_RUNNING: ::c_int = 0x40; -pub const IFF_NOARP: ::c_int = 0x80; -pub const IFF_PROMISC: ::c_int = 0x100; -pub const IFF_ALLMULTI: ::c_int = 0x200; -pub const IFF_MASTER: ::c_int = 0x400; -pub const IFF_SLAVE: ::c_int = 0x800; -pub const IFF_MULTICAST: ::c_int = 0x1000; -pub const IFF_PORTSEL: ::c_int = 0x2000; -pub const IFF_AUTOMEDIA: ::c_int = 0x4000; +// https://github.com/kraj/uClibc/blob/master/include/net/if.h#L44 +pub const IFF_UP: ::c_int = 0x1; // Interface is up. +pub const IFF_BROADCAST: ::c_int = 0x2; // Broadcast address valid. +pub const IFF_DEBUG: ::c_int = 0x4; // Turn on debugging. +pub const IFF_LOOPBACK: ::c_int = 0x8; // Is a loopback net. +pub const IFF_POINTOPOINT: ::c_int = 0x10; // Interface is point-to-point link. +pub const IFF_NOTRAILERS: ::c_int = 0x20; // Avoid use of trailers. +pub const IFF_RUNNING: ::c_int = 0x40; // Resources allocated. +pub const IFF_NOARP: ::c_int = 0x80; // No address resolution protocol. +pub const IFF_PROMISC: ::c_int = 0x100; // Receive all packets. +// Not supported +pub const IFF_ALLMULTI: ::c_int = 0x200; // Receive all multicast packets. +pub const IFF_MASTER: ::c_int = 0x400; // Master of a load balancer. +pub const IFF_SLAVE: ::c_int = 0x800; // Slave of a load balancer. +pub const IFF_MULTICAST: ::c_int = 0x1000; // Supports multicast. +pub const IFF_PORTSEL: ::c_int = 0x2000; // Can set media type. +pub const IFF_AUTOMEDIA: ::c_int = 0x4000; // Auto media select active. +// Dialup device with changing addresses. pub const IFF_DYNAMIC: ::c_int = 0x8000; pub const SOL_IP: ::c_int = 0; diff --git a/src/vendor/log-0.3.9/.cargo-checksum.json b/src/vendor/log-0.3.9/.cargo-checksum.json new file mode 100644 index 0000000000..8994b632d8 --- /dev/null +++ b/src/vendor/log-0.3.9/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"12cc0f91b51fedf41ae1670d1624ee1d78a284bdb101645b60a06a12de16c069",".travis.yml":"2cdde67eec211928d7e667e5ade109cdf0f74c3417c47cc48905929c5c165230","Cargo.toml":"827b8cdf64e9652b178d6033fdcb4fc04a1382edf67ce4f2c6dce39943349f10","Cargo.toml.orig":"0ff88c1e309ee34f00e70c88071067cdf43b6fb69ec65f8e0186df7ec0f60aa3","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7c831cff45cfd33333cc246815dccb25bfa0b981053656e707828fe3f25151da","appveyor.yml":"c61473b8c780ad2626282ce2b2ba0ef278082b6afe151a62ff419f33eaf90221","src/lib.rs":"8238bde9046b1b4a0d21b5ae9029abd672a7d314581b1fd8d0890b2a3052d443","src/macros.rs":"9068d69d32e989ac273ce73659125d31cf4a166076eefdad74dfbdf9506cf9c4"},"package":"e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"} \ No newline at end of file diff --git a/src/vendor/log-0.3.9/.cargo-ok b/src/vendor/log-0.3.9/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/log-0.3.9/.gitignore b/src/vendor/log-0.3.9/.gitignore new file mode 100644 index 0000000000..2c96eb1b65 --- /dev/null +++ b/src/vendor/log-0.3.9/.gitignore @@ -0,0 +1,2 @@ +target/ +Cargo.lock diff --git a/src/vendor/log-0.3.9/.travis.yml b/src/vendor/log-0.3.9/.travis.yml new file mode 100644 index 0000000000..4799815828 --- /dev/null +++ b/src/vendor/log-0.3.9/.travis.yml @@ -0,0 +1,30 @@ +language: rust +sudo: false +rust: + - stable + - beta + - nightly +before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH +script: + - cargo build --verbose + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo build --verbose --no-default-features) + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo build --verbose --features nightly) + - cargo test --verbose + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --no-default-features) + - cargo test --verbose --manifest-path log-test/Cargo.toml + - cargo test --verbose --manifest-path env/Cargo.toml + - cargo test --verbose --manifest-path env/Cargo.toml --no-default-features + - cargo run --verbose --manifest-path tests/max_level_features/Cargo.toml + - cargo run --verbose --manifest-path tests/max_level_features/Cargo.toml --release + - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo doc --no-deps --features nightly) + - CARGO_TARGET_DIR=target cargo doc --no-deps --manifest-path env/Cargo.toml +after_success: + - travis-cargo --only nightly doc-upload +env: + global: + secure: "VPHgnszydMudYTY8cthHj/Dmxqp7OmTiu4Sa/705Udsx+tYblTv+8WdThkClo3C/asStVcxlaRWAp91UX32/k4SfkPz17XId3Wadyt03r73ANm6ZOWY+qty+3/LINm54kuTxYUDDTbD6NaFNPFQLIE0xCpJeiXUQTlaMk6z0W3M=" + +notifications: + email: + on_success: never diff --git a/src/vendor/log-0.3.9/Cargo.toml b/src/vendor/log-0.3.9/Cargo.toml new file mode 100644 index 0000000000..1bea809c6b --- /dev/null +++ b/src/vendor/log-0.3.9/Cargo.toml @@ -0,0 +1,45 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "log" +version = "0.3.9" +authors = ["The Rust Project Developers"] +description = "A lightweight logging facade for Rust\n" +homepage = "https://github.com/rust-lang/log" +documentation = "https://doc.rust-lang.org/log" +readme = "README.md" +categories = ["development-tools::debugging"] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-lang/log" + +[lib] +doctest = false +[dependencies.log] +version = "0.4" + +[features] +default = ["use_std"] +max_level_debug = ["log/max_level_debug"] +max_level_error = ["log/max_level_error"] +max_level_info = ["log/max_level_info"] +max_level_off = ["log/max_level_off"] +max_level_trace = ["log/max_level_trace"] +max_level_warn = ["log/max_level_warn"] +nightly = [] +release_max_level_debug = ["log/release_max_level_debug"] +release_max_level_error = ["log/release_max_level_error"] +release_max_level_info = ["log/release_max_level_info"] +release_max_level_off = ["log/release_max_level_off"] +release_max_level_trace = ["log/release_max_level_trace"] +release_max_level_warn = ["log/release_max_level_warn"] +use_std = ["log/std"] diff --git a/src/vendor/log-0.3.9/Cargo.toml.orig b/src/vendor/log-0.3.9/Cargo.toml.orig new file mode 100644 index 0000000000..77691be50f --- /dev/null +++ b/src/vendor/log-0.3.9/Cargo.toml.orig @@ -0,0 +1,39 @@ +[package] + +name = "log" +version = "0.3.9" +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/rust-lang/log" +documentation = "https://doc.rust-lang.org/log" +homepage = "https://github.com/rust-lang/log" +description = """ +A lightweight logging facade for Rust +""" +categories = ["development-tools::debugging"] + +[lib] +doctest = false + +[features] +max_level_off = ["log/max_level_off"] +max_level_error = ["log/max_level_error"] +max_level_warn = ["log/max_level_warn"] +max_level_info = ["log/max_level_info"] +max_level_debug = ["log/max_level_debug"] +max_level_trace = ["log/max_level_trace"] + +release_max_level_off = ["log/release_max_level_off"] +release_max_level_error = ["log/release_max_level_error"] +release_max_level_warn = ["log/release_max_level_warn"] +release_max_level_info = ["log/release_max_level_info"] +release_max_level_debug = ["log/release_max_level_debug"] +release_max_level_trace = ["log/release_max_level_trace"] + +nightly = [] +use_std = ["log/std"] +default = ["use_std"] + +[dependencies] +log = "0.4" diff --git a/src/vendor/log-0.3.9/LICENSE-APACHE b/src/vendor/log-0.3.9/LICENSE-APACHE new file mode 100644 index 0000000000..16fe87b06e --- /dev/null +++ b/src/vendor/log-0.3.9/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/src/vendor/log-0.3.9/LICENSE-MIT b/src/vendor/log-0.3.9/LICENSE-MIT new file mode 100644 index 0000000000..39d4bdb5ac --- /dev/null +++ b/src/vendor/log-0.3.9/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/src/vendor/log-0.3.9/README.md b/src/vendor/log-0.3.9/README.md new file mode 100644 index 0000000000..0e9dc58ae7 --- /dev/null +++ b/src/vendor/log-0.3.9/README.md @@ -0,0 +1,160 @@ +log +=== + +A Rust library providing a lightweight logging *facade*. + +[![Build Status](https://travis-ci.org/rust-lang-nursery/log.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/log) +[![Build status](https://ci.appveyor.com/api/projects/status/nopdjmmjt45xcrki?svg=true)](https://ci.appveyor.com/project/alexcrichton/log) + +* [`log` documentation](https://doc.rust-lang.org/log) +* [`env_logger` documentation](https://doc.rust-lang.org/log/env_logger) + +A logging facade provides a single logging API that abstracts over the actual +logging implementation. Libraries can use the logging API provided by this +crate, and the consumer of those libraries can choose the logging +implementation that is most suitable for its use case. + +## Usage + +## In libraries + +Libraries should link only to the `log` crate, and use the provided macros to +log whatever information will be useful to downstream consumers: + +```toml +[dependencies] +log = "0.3" +``` + +```rust +#[macro_use] +extern crate log; + +pub fn shave_the_yak(yak: &Yak) { + trace!("Commencing yak shaving"); + + loop { + match find_a_razor() { + Ok(razor) => { + info!("Razor located: {}", razor); + yak.shave(razor); + break; + } + Err(err) => { + warn!("Unable to locate a razor: {}, retrying", err); + } + } + } +} +``` + +## In executables + +Executables should choose a logger implementation and initialize it early in the +runtime of the program. Logger implementations will typically include a +function to do this. Any log messages generated before the logger is +initialized will be ignored. + +The executable itself may use the `log` crate to log as well. + +The `env_logger` crate provides a logger implementation that mirrors the +functionality of the old revision of the `log` crate. + +```toml +[dependencies] +log = "0.3" +env_logger = "0.3" +``` + +```rust +#[macro_use] +extern crate log; +extern crate env_logger; + +fn main() { + env_logger::init().unwrap(); + + info!("starting up"); + + // ... +} +``` + +## In tests + +Tests can use the `env_logger` crate to see log messages generated during that test: + +```toml +[dependencies] +log = "0.3" + +[dev-dependencies] +env_logger = "0.3" +``` + +```rust +#[macro_use] +extern crate log; + +fn add_one(num: i32) -> i32 { + info!("add_one called with {}", num); + num + 1 +} + +#[cfg(test)] +mod tests { + use super::*; + extern crate env_logger; + + #[test] + fn it_adds_one() { + let _ = env_logger::init(); + info!("can log from the test too"); + assert_eq!(3, add_one(2)); + } + + #[test] + fn it_handles_negative_numbers() { + let _ = env_logger::init(); + info!("logging from another test"); + assert_eq!(-7, add_one(-8)); + } +} +``` + +Assuming the module under test is called `my_lib`, running the tests with the +`RUST_LOG` filtering to info messages from this module looks like: + +```bash +$ RUST_LOG=my_lib=info cargo test + Running target/debug/my_lib-... + +running 2 tests +INFO:my_lib::tests: logging from another test +INFO:my_lib: add_one called with -8 +test tests::it_handles_negative_numbers ... ok +INFO:my_lib::tests: can log from the test too +INFO:my_lib: add_one called with 2 +test tests::it_adds_one ... ok + +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured +``` + +Note that `env_logger::init()` needs to be called in each test in which you +want to enable logging. Additionally, the default behavior of tests to +run in parallel means that logging output may be interleaved with test output. +Either run tests in a single thread by specifying `RUST_TEST_THREADS=1` or by +running one test by specifying its name as an argument to the test binaries as +directed by the `cargo test` help docs: + +```bash +$ RUST_LOG=my_lib=info cargo test it_adds_one + Running target/debug/my_lib-... + +running 1 test +INFO:my_lib::tests: can log from the test too +INFO:my_lib: add_one called with 2 +test tests::it_adds_one ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured +``` diff --git a/src/vendor/log-0.3.9/appveyor.yml b/src/vendor/log-0.3.9/appveyor.yml new file mode 100644 index 0000000000..841011deb2 --- /dev/null +++ b/src/vendor/log-0.3.9/appveyor.yml @@ -0,0 +1,18 @@ +environment: + matrix: + - TARGET: x86_64-pc-windows-msvc + - TARGET: i686-pc-windows-msvc + - TARGET: i686-pc-windows-gnu +install: + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" + - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" + - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin + - SET PATH=%PATH%;C:\MinGW\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo test --verbose + - cargo test --manifest-path env/Cargo.toml diff --git a/src/vendor/log-0.3.9/src/lib.rs b/src/vendor/log-0.3.9/src/lib.rs new file mode 100644 index 0000000000..1abdf31572 --- /dev/null +++ b/src/vendor/log-0.3.9/src/lib.rs @@ -0,0 +1,1091 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A lightweight logging facade. +//! +//! A logging facade provides a single logging API that abstracts over the +//! actual logging implementation. Libraries can use the logging API provided +//! by this crate, and the consumer of those libraries can choose the logging +//! framework that is most suitable for its use case. +//! +//! If no logging implementation is selected, the facade falls back to a "noop" +//! implementation that ignores all log messages. The overhead in this case +//! is very small - just an integer load, comparison and jump. +//! +//! A log request consists of a target, a level, and a body. A target is a +//! string which defaults to the module path of the location of the log +//! request, though that default may be overridden. Logger implementations +//! typically use the target to filter requests based on some user +//! configuration. +//! +//! # Use +//! +//! ## In libraries +//! +//! Libraries should link only to the `log` crate, and use the provided +//! macros to log whatever information will be useful to downstream consumers. +//! +//! ### Examples +//! +//! ```rust +//! # #![allow(unstable)] +//! #[macro_use] +//! extern crate log; +//! +//! # #[derive(Debug)] pub struct Yak(String); +//! # impl Yak { fn shave(&self, _: u32) {} } +//! # fn find_a_razor() -> Result { Ok(1) } +//! pub fn shave_the_yak(yak: &Yak) { +//! info!(target: "yak_events", "Commencing yak shaving for {:?}", yak); +//! +//! loop { +//! match find_a_razor() { +//! Ok(razor) => { +//! info!("Razor located: {}", razor); +//! yak.shave(razor); +//! break; +//! } +//! Err(err) => { +//! warn!("Unable to locate a razor: {}, retrying", err); +//! } +//! } +//! } +//! } +//! # fn main() {} +//! ``` +//! +//! ## In executables +//! +//! Executables should choose a logging framework and initialize it early in the +//! runtime of the program. Logging frameworks will typically include a +//! function to do this. Any log messages generated before the framework is +//! initialized will be ignored. +//! +//! The executable itself may use the `log` crate to log as well. +//! +//! ### Warning +//! +//! The logging system may only be initialized once. +//! +//! ### Examples +//! +//! ```rust,ignore +//! #[macro_use] +//! extern crate log; +//! extern crate my_logger; +//! +//! fn main() { +//! my_logger::init(); +//! +//! info!("starting up"); +//! +//! // ... +//! } +//! ``` +//! +//! # Logger implementations +//! +//! Loggers implement the `Log` trait. Here's a very basic example that simply +//! logs all messages at the `Error`, `Warn` or `Info` levels to stdout: +//! +//! ```rust +//! extern crate log; +//! +//! use log::{LogRecord, LogLevel, LogMetadata}; +//! +//! struct SimpleLogger; +//! +//! impl log::Log for SimpleLogger { +//! fn enabled(&self, metadata: &LogMetadata) -> bool { +//! metadata.level() <= LogLevel::Info +//! } +//! +//! fn log(&self, record: &LogRecord) { +//! if self.enabled(record.metadata()) { +//! println!("{} - {}", record.level(), record.args()); +//! } +//! } +//! } +//! +//! # fn main() {} +//! ``` +//! +//! Loggers are installed by calling the `set_logger` function. It takes a +//! closure which is provided a `MaxLogLevel` token and returns a `Log` trait +//! object. The `MaxLogLevel` token controls the global maximum log level. The +//! logging facade uses this as an optimization to improve performance of log +//! messages at levels that are disabled. In the case of our example logger, +//! we'll want to set the maximum log level to `Info`, since we ignore any +//! `Debug` or `Trace` level log messages. A logging framework should provide a +//! function that wraps a call to `set_logger`, handling initialization of the +//! logger: +//! +//! ```rust +//! # extern crate log; +//! # use log::{LogLevel, LogLevelFilter, SetLoggerError, LogMetadata}; +//! # struct SimpleLogger; +//! # impl log::Log for SimpleLogger { +//! # fn enabled(&self, _: &LogMetadata) -> bool { false } +//! # fn log(&self, _: &log::LogRecord) {} +//! # } +//! # fn main() {} +//! # #[cfg(feature = "use_std")] +//! pub fn init() -> Result<(), SetLoggerError> { +//! log::set_logger(|max_log_level| { +//! max_log_level.set(LogLevelFilter::Info); +//! Box::new(SimpleLogger) +//! }) +//! } +//! ``` +//! +//! # Use with `no_std` +//! +//! To use the `log` crate without depending on `libstd`, you need to specify +//! `default-features = false` when specifying the dependency in `Cargo.toml`. +//! This makes no difference to libraries using `log` since the logging API +//! remains the same. However executables will need to use the `set_logger_raw` +//! function to initialize a logger and the `shutdown_logger_raw` function to +//! shut down the global logger before exiting: +//! +//! ```rust +//! # extern crate log; +//! # use log::{LogLevel, LogLevelFilter, SetLoggerError, ShutdownLoggerError, +//! # LogMetadata}; +//! # struct SimpleLogger; +//! # impl log::Log for SimpleLogger { +//! # fn enabled(&self, _: &LogMetadata) -> bool { false } +//! # fn log(&self, _: &log::LogRecord) {} +//! # } +//! # impl SimpleLogger { +//! # fn flush(&self) {} +//! # } +//! # fn main() {} +//! pub fn init() -> Result<(), SetLoggerError> { +//! unsafe { +//! log::set_logger_raw(|max_log_level| { +//! static LOGGER: SimpleLogger = SimpleLogger; +//! max_log_level.set(LogLevelFilter::Info); +//! &SimpleLogger +//! }) +//! } +//! } +//! pub fn shutdown() -> Result<(), ShutdownLoggerError> { +//! log::shutdown_logger_raw().map(|logger| { +//! let logger = unsafe { &*(logger as *const SimpleLogger) }; +//! logger.flush(); +//! }) +//! } +//! ``` + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://doc.rust-lang.org/log/")] +#![warn(missing_docs)] +#![cfg_attr(feature = "nightly", feature(panic_handler))] + +#![cfg_attr(not(feature = "use_std"), no_std)] + +// When compiled for the rustc compiler itself we want to make sure that this is +// an unstable crate +#![cfg_attr(rustbuild, feature(staged_api, rustc_private))] +#![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] + +#[cfg(not(feature = "use_std"))] +extern crate core as std; +extern crate log; + +use std::cmp; +#[cfg(feature = "use_std")] +use std::error; +use std::fmt; +use std::mem; +use std::ops::Deref; +use std::str::FromStr; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +#[macro_use] +mod macros; + +// The setup here is a bit weird to make shutdown_logger_raw work. +// +// There are four different states that we care about: the logger's +// uninitialized, the logger's initializing (set_logger's been called but +// LOGGER hasn't actually been set yet), the logger's active, or the logger is +// shut down after calling shutdown_logger_raw. +// +// The LOGGER static holds a pointer to the global logger. It is protected by +// the STATE static which determines whether LOGGER has been initialized yet. +// +// The shutdown_logger_raw routine needs to make sure that no threads are +// actively logging before it returns. The number of actively logging threads is +// tracked in the REFCOUNT static. The routine first sets STATE back to +// INITIALIZING. All logging calls past that point will immediately return +// without accessing the logger. At that point, the at_exit routine just waits +// for the refcount to reach 0 before deallocating the logger. Note that the +// refcount does not necessarily monotonically decrease at this point, as new +// log calls still increment and decrement it, but the interval in between is +// small enough that the wait is really just for the active log calls to finish. + +static mut LOGGER: *const Log = &NopLogger; +static STATE: AtomicUsize = ATOMIC_USIZE_INIT; +static REFCOUNT: AtomicUsize = ATOMIC_USIZE_INIT; + +const INITIALIZING: usize = 1; +const INITIALIZED: usize = 2; + +static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", + "DEBUG", "TRACE"]; + +/// An enum representing the available verbosity levels of the logging framework +/// +/// A `LogLevel` may be compared directly to a `LogLevelFilter`. +#[repr(usize)] +#[derive(Copy, Eq, Debug)] +pub enum LogLevel { + /// The "error" level. + /// + /// Designates very serious errors. + Error = 1, // This way these line up with the discriminants for LogLevelFilter below + /// The "warn" level. + /// + /// Designates hazardous situations. + Warn, + /// The "info" level. + /// + /// Designates useful information. + Info, + /// The "debug" level. + /// + /// Designates lower priority information. + Debug, + /// The "trace" level. + /// + /// Designates very low priority, often extremely verbose, information. + Trace, +} + +impl Clone for LogLevel { + #[inline] + fn clone(&self) -> LogLevel { + *self + } +} + +impl PartialEq for LogLevel { + #[inline] + fn eq(&self, other: &LogLevel) -> bool { + *self as usize == *other as usize + } +} + +impl PartialEq for LogLevel { + #[inline] + fn eq(&self, other: &LogLevelFilter) -> bool { + *self as usize == *other as usize + } +} + +impl PartialOrd for LogLevel { + #[inline] + fn partial_cmp(&self, other: &LogLevel) -> Option { + Some(self.cmp(other)) + } +} + +impl PartialOrd for LogLevel { + #[inline] + fn partial_cmp(&self, other: &LogLevelFilter) -> Option { + Some((*self as usize).cmp(&(*other as usize))) + } +} + +impl Ord for LogLevel { + #[inline] + fn cmp(&self, other: &LogLevel) -> cmp::Ordering { + (*self as usize).cmp(&(*other as usize)) + } +} + +fn ok_or(t: Option, e: E) -> Result { + match t { + Some(t) => Ok(t), + None => Err(e), + } +} + +// Reimplemented here because std::ascii is not available in libcore +fn eq_ignore_ascii_case(a: &str, b: &str) -> bool { + fn to_ascii_uppercase(c: u8) -> u8 { + if c >= b'a' && c <= b'z' { + c - b'a' + b'A' + } else { + c + } + } + + if a.len() == b.len() { + a.bytes() + .zip(b.bytes()) + .all(|(a, b)| to_ascii_uppercase(a) == to_ascii_uppercase(b)) + } else { + false + } +} + +impl FromStr for LogLevel { + type Err = (); + fn from_str(level: &str) -> Result { + ok_or(LOG_LEVEL_NAMES.iter() + .position(|&name| eq_ignore_ascii_case(name, level)) + .into_iter() + .filter(|&idx| idx != 0) + .map(|idx| LogLevel::from_usize(idx).unwrap()) + .next(), ()) + } +} + +impl fmt::Display for LogLevel { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.pad(LOG_LEVEL_NAMES[*self as usize]) + } +} + +impl LogLevel { + fn from_usize(u: usize) -> Option { + match u { + 1 => Some(LogLevel::Error), + 2 => Some(LogLevel::Warn), + 3 => Some(LogLevel::Info), + 4 => Some(LogLevel::Debug), + 5 => Some(LogLevel::Trace), + _ => None + } + } + + fn from_new(level: log::Level) -> LogLevel { + match level { + log::Level::Error => LogLevel::Error, + log::Level::Warn => LogLevel::Warn, + log::Level::Info => LogLevel::Info, + log::Level::Debug => LogLevel::Debug, + log::Level::Trace => LogLevel::Trace, + } + } + + fn to_new(&self) -> log::Level { + match *self { + LogLevel::Error => log::Level::Error, + LogLevel::Warn => log::Level::Warn, + LogLevel::Info => log::Level::Info, + LogLevel::Debug => log::Level::Debug, + LogLevel::Trace => log::Level::Trace, + } + } + + /// Returns the most verbose logging level. + #[inline] + pub fn max() -> LogLevel { + LogLevel::Trace + } + + /// Converts the `LogLevel` to the equivalent `LogLevelFilter`. + #[inline] + pub fn to_log_level_filter(&self) -> LogLevelFilter { + LogLevelFilter::from_usize(*self as usize).unwrap() + } +} + +/// An enum representing the available verbosity level filters of the logging +/// framework. +/// +/// A `LogLevelFilter` may be compared directly to a `LogLevel`. +#[repr(usize)] +#[derive(Copy, Eq, Debug)] +pub enum LogLevelFilter { + /// A level lower than all log levels. + Off, + /// Corresponds to the `Error` log level. + Error, + /// Corresponds to the `Warn` log level. + Warn, + /// Corresponds to the `Info` log level. + Info, + /// Corresponds to the `Debug` log level. + Debug, + /// Corresponds to the `Trace` log level. + Trace, +} + +// Deriving generates terrible impls of these traits + +impl Clone for LogLevelFilter { + #[inline] + fn clone(&self) -> LogLevelFilter { + *self + } +} + +impl PartialEq for LogLevelFilter { + #[inline] + fn eq(&self, other: &LogLevelFilter) -> bool { + *self as usize == *other as usize + } +} + +impl PartialEq for LogLevelFilter { + #[inline] + fn eq(&self, other: &LogLevel) -> bool { + other.eq(self) + } +} + +impl PartialOrd for LogLevelFilter { + #[inline] + fn partial_cmp(&self, other: &LogLevelFilter) -> Option { + Some(self.cmp(other)) + } +} + +impl PartialOrd for LogLevelFilter { + #[inline] + fn partial_cmp(&self, other: &LogLevel) -> Option { + other.partial_cmp(self).map(|x| x.reverse()) + } +} + +impl Ord for LogLevelFilter { + #[inline] + fn cmp(&self, other: &LogLevelFilter) -> cmp::Ordering { + (*self as usize).cmp(&(*other as usize)) + } +} + +impl FromStr for LogLevelFilter { + type Err = (); + fn from_str(level: &str) -> Result { + ok_or(LOG_LEVEL_NAMES.iter() + .position(|&name| eq_ignore_ascii_case(name, level)) + .map(|p| LogLevelFilter::from_usize(p).unwrap()), ()) + } +} + +impl fmt::Display for LogLevelFilter { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "{}", LOG_LEVEL_NAMES[*self as usize]) + } +} + +impl LogLevelFilter { + fn from_usize(u: usize) -> Option { + match u { + 0 => Some(LogLevelFilter::Off), + 1 => Some(LogLevelFilter::Error), + 2 => Some(LogLevelFilter::Warn), + 3 => Some(LogLevelFilter::Info), + 4 => Some(LogLevelFilter::Debug), + 5 => Some(LogLevelFilter::Trace), + _ => None + } + } + + fn from_new(filter: log::LevelFilter) -> LogLevelFilter { + match filter { + log::LevelFilter::Off => LogLevelFilter::Off, + log::LevelFilter::Error => LogLevelFilter::Error, + log::LevelFilter::Warn => LogLevelFilter::Warn, + log::LevelFilter::Info => LogLevelFilter::Info, + log::LevelFilter::Debug => LogLevelFilter::Debug, + log::LevelFilter::Trace => LogLevelFilter::Trace, + } + } + + fn to_new(&self) -> log::LevelFilter { + match *self { + LogLevelFilter::Off => log::LevelFilter::Off, + LogLevelFilter::Error => log::LevelFilter::Error, + LogLevelFilter::Warn => log::LevelFilter::Warn, + LogLevelFilter::Info => log::LevelFilter::Info, + LogLevelFilter::Debug => log::LevelFilter::Debug, + LogLevelFilter::Trace => log::LevelFilter::Trace, + } + } + + /// Returns the most verbose logging level filter. + #[inline] + pub fn max() -> LogLevelFilter { + LogLevelFilter::Trace + } + + /// Converts `self` to the equivalent `LogLevel`. + /// + /// Returns `None` if `self` is `LogLevelFilter::Off`. + #[inline] + pub fn to_log_level(&self) -> Option { + LogLevel::from_usize(*self as usize) + } +} + +/// The "payload" of a log message. +pub struct LogRecord<'a> { + metadata: LogMetadata<'a>, + location: &'a LogLocation, + args: fmt::Arguments<'a>, +} + +impl<'a> LogRecord<'a> { + /// The message body. + pub fn args(&self) -> &fmt::Arguments<'a> { + &self.args + } + + /// Metadata about the log directive. + pub fn metadata(&self) -> &LogMetadata { + &self.metadata + } + + /// The location of the log directive. + pub fn location(&self) -> &LogLocation { + self.location + } + + /// The verbosity level of the message. + pub fn level(&self) -> LogLevel { + self.metadata.level() + } + + /// The name of the target of the directive. + pub fn target(&self) -> &str { + self.metadata.target() + } +} + +/// Metadata about a log message. +pub struct LogMetadata<'a> { + level: LogLevel, + target: &'a str, +} + +impl<'a> LogMetadata<'a> { + /// The verbosity level of the message. + pub fn level(&self) -> LogLevel { + self.level + } + + /// The name of the target of the directive. + pub fn target(&self) -> &str { + self.target + } +} + +/// A trait encapsulating the operations required of a logger +pub trait Log: Sync+Send { + /// Determines if a log message with the specified metadata would be + /// logged. + /// + /// This is used by the `log_enabled!` macro to allow callers to avoid + /// expensive computation of log message arguments if the message would be + /// discarded anyway. + fn enabled(&self, metadata: &LogMetadata) -> bool; + + /// Logs the `LogRecord`. + /// + /// Note that `enabled` is *not* necessarily called before this method. + /// Implementations of `log` should perform all necessary filtering + /// internally. + fn log(&self, record: &LogRecord); +} + +// Just used as a dummy initial value for LOGGER +struct NopLogger; + +impl Log for NopLogger { + fn enabled(&self, _: &LogMetadata) -> bool { false } + + fn log(&self, _: &LogRecord) {} +} + +/// The location of a log message. +/// +/// # Warning +/// +/// The fields of this struct are public so that they may be initialized by the +/// `log!` macro. They are subject to change at any time and should never be +/// accessed directly. +#[derive(Copy, Clone, Debug)] +pub struct LogLocation { + #[doc(hidden)] + pub __module_path: &'static str, + #[doc(hidden)] + pub __file: &'static str, + #[doc(hidden)] + pub __line: u32, +} + +impl LogLocation { + /// The module path of the message. + pub fn module_path(&self) -> &str { + self.__module_path + } + + /// The source file containing the message. + pub fn file(&self) -> &str { + self.__file + } + + /// The line containing the message. + pub fn line(&self) -> u32 { + self.__line + } +} + +/// A token providing read and write access to the global maximum log level +/// filter. +/// +/// The maximum log level is used as an optimization to avoid evaluating log +/// messages that will be ignored by the logger. Any message with a level +/// higher than the maximum log level filter will be ignored. A logger should +/// make sure to keep the maximum log level filter in sync with its current +/// configuration. +pub struct MaxLogLevelFilter(()); + +impl fmt::Debug for MaxLogLevelFilter { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "MaxLogLevelFilter") + } +} + +impl MaxLogLevelFilter { + /// Gets the current maximum log level filter. + pub fn get(&self) -> LogLevelFilter { + max_log_level() + } + + /// Sets the maximum log level. + pub fn set(&self, level: LogLevelFilter) { + log::set_max_level(level.to_new()) + } +} + +/// Returns the current maximum log level. +/// +/// The `log!`, `error!`, `warn!`, `info!`, `debug!`, and `trace!` macros check +/// this value and discard any message logged at a higher level. The maximum +/// log level is set by the `MaxLogLevel` token passed to loggers. +#[inline(always)] +pub fn max_log_level() -> LogLevelFilter { + LogLevelFilter::from_new(log::max_level()) +} + +/// Sets the global logger. +/// +/// The `make_logger` closure is passed a `MaxLogLevel` object, which the +/// logger should use to keep the global maximum log level in sync with the +/// highest log level that the logger will not ignore. +/// +/// This function may only be called once in the lifetime of a program. Any log +/// events that occur before the call to `set_logger` completes will be +/// ignored. +/// +/// This function does not typically need to be called manually. Logger +/// implementations should provide an initialization method that calls +/// `set_logger` internally. +/// +/// Requires the `use_std` feature (enabled by default). +#[cfg(feature = "use_std")] +pub fn set_logger(make_logger: M) -> Result<(), SetLoggerError> + where M: FnOnce(MaxLogLevelFilter) -> Box { + unsafe { set_logger_raw(|max_level| mem::transmute(make_logger(max_level))) } +} + +/// Sets the global logger from a raw pointer. +/// +/// This function is similar to `set_logger` except that it is usable in +/// `no_std` code. +/// +/// The `make_logger` closure is passed a `MaxLogLevel` object, which the +/// logger should use to keep the global maximum log level in sync with the +/// highest log level that the logger will not ignore. +/// +/// This function may only be called once in the lifetime of a program. Any log +/// events that occur before the call to `set_logger_raw` completes will be +/// ignored. +/// +/// This function does not typically need to be called manually. Logger +/// implementations should provide an initialization method that calls +/// `set_logger_raw` internally. +/// +/// # Safety +/// +/// The pointer returned by `make_logger` must remain valid for the entire +/// duration of the program or until `shutdown_logger_raw` is called. In +/// addition, `shutdown_logger` *must not* be called after this function. +pub unsafe fn set_logger_raw(make_logger: M) -> Result<(), SetLoggerError> + where M: FnOnce(MaxLogLevelFilter) -> *const Log { + static ADAPTOR: LoggerAdaptor = LoggerAdaptor; + match log::set_logger(&ADAPTOR) { + Ok(()) => { + LOGGER = make_logger(MaxLogLevelFilter(())); + STATE.store(INITIALIZED, Ordering::SeqCst); + Ok(()) + } + Err(_) => Err(SetLoggerError(())), + } +} + +/// Shuts down the global logger. +/// +/// This function may only be called once in the lifetime of a program, and may +/// not be called before `set_logger`. Once the global logger has been shut +/// down, it can no longer be re-initialized by `set_logger`. Any log events +/// that occur after the call to `shutdown_logger` completes will be ignored. +/// +/// The logger that was originally created by the call to to `set_logger` is +/// returned on success. At that point it is guaranteed that no other threads +/// are concurrently accessing the logger object. +#[cfg(feature = "use_std")] +pub fn shutdown_logger() -> Result, ShutdownLoggerError> { + shutdown_logger_raw().map(|l| unsafe { mem::transmute(l) }) +} + +/// Shuts down the global logger. +/// +/// This function is similar to `shutdown_logger` except that it is usable in +/// `no_std` code. +/// +/// This function may only be called once in the lifetime of a program, and may +/// not be called before `set_logger_raw`. Once the global logger has been shut +/// down, it can no longer be re-initialized by `set_logger_raw`. Any log +/// events that occur after the call to `shutdown_logger_raw` completes will be +/// ignored. +/// +/// The pointer that was originally passed to `set_logger_raw` is returned on +/// success. At that point it is guaranteed that no other threads are +/// concurrently accessing the logger object. +pub fn shutdown_logger_raw() -> Result<*const Log, ShutdownLoggerError> { + // Set to INITIALIZING to prevent re-initialization after + if STATE.compare_and_swap(INITIALIZED, INITIALIZING, + Ordering::SeqCst) != INITIALIZED { + return Err(ShutdownLoggerError(())); + } + + while REFCOUNT.load(Ordering::SeqCst) != 0 { + // FIXME add a sleep here when it doesn't involve timers + } + + unsafe { + let logger = LOGGER; + LOGGER = &NopLogger; + Ok(logger) + } +} + +/// The type returned by `set_logger` if `set_logger` has already been called. +#[allow(missing_copy_implementations)] +#[derive(Debug)] +pub struct SetLoggerError(()); + +impl fmt::Display for SetLoggerError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "attempted to set a logger after the logging system \ + was already initialized") + } +} + +// The Error trait is not available in libcore +#[cfg(feature = "use_std")] +impl error::Error for SetLoggerError { + fn description(&self) -> &str { "set_logger() called multiple times" } +} + +/// The type returned by `shutdown_logger_raw` if `shutdown_logger_raw` has +/// already been called or if `set_logger_raw` has not been called yet. +#[allow(missing_copy_implementations)] +#[derive(Debug)] +pub struct ShutdownLoggerError(()); + +impl fmt::Display for ShutdownLoggerError { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "attempted to shut down the logger without an active logger") + } +} + +// The Error trait is not available in libcore +#[cfg(feature = "use_std")] +impl error::Error for ShutdownLoggerError { + fn description(&self) -> &str { "shutdown_logger() called without an active logger" } +} + +/// Deprecated +/// +/// Use https://crates.io/crates/log-panics instead. +#[cfg(all(feature = "nightly", feature = "use_std"))] +pub fn log_panics() { + std::panic::set_hook(Box::new(panic::log)); +} + +// inner module so that the reporting module is log::panic instead of log +#[cfg(all(feature = "nightly", feature = "use_std"))] +mod panic { + use std::panic::PanicInfo; + use std::thread; + + pub fn log(info: &PanicInfo) { + let thread = thread::current(); + let thread = thread.name().unwrap_or(""); + + let msg = match info.payload().downcast_ref::<&'static str>() { + Some(s) => *s, + None => match info.payload().downcast_ref::() { + Some(s) => &s[..], + None => "Box", + } + }; + + match info.location() { + Some(location) => { + error!("thread '{}' panicked at '{}': {}:{}", + thread, + msg, + location.file(), + location.line()) + } + None => error!("thread '{}' panicked at '{}'", thread, msg), + } + } +} + +struct LoggerGuard(&'static Log); + +impl Drop for LoggerGuard { + fn drop(&mut self) { + REFCOUNT.fetch_sub(1, Ordering::SeqCst); + } +} + +impl Deref for LoggerGuard { + type Target = Log; + + fn deref(&self) -> &(Log + 'static) { + self.0 + } +} + +fn logger() -> Option { + REFCOUNT.fetch_add(1, Ordering::SeqCst); + if STATE.load(Ordering::SeqCst) != INITIALIZED { + REFCOUNT.fetch_sub(1, Ordering::SeqCst); + None + } else { + Some(LoggerGuard(unsafe { &*LOGGER })) + } +} + +struct LoggerAdaptor; + +impl log::Log for LoggerAdaptor { + fn log(&self, record: &log::Record) { + if let Some(logger) = logger() { + let record = LogRecord { + metadata: LogMetadata { + level: LogLevel::from_new(record.level()), + target: record.target(), + }, + // file and module path aren't static in 0.4 so we can't forward them. + location: &LogLocation { + __file: "", + __line: record.line().unwrap_or(0), + __module_path: "", + }, + args: *record.args(), + }; + logger.log(&record); + } + } + + fn enabled(&self, metadata: &log::Metadata) -> bool { + match logger() { + Some(logger) => { + let metadata = LogMetadata { + level: LogLevel::from_new(metadata.level()), + target: metadata.target(), + }; + logger.enabled(&metadata) + } + None => false + } + } + + fn flush(&self) {} +} + +// WARNING +// This is not considered part of the crate's public API. It is subject to +// change at any time. +#[doc(hidden)] +pub fn __enabled(level: LogLevel, target: &str) -> bool { + match logger() { + Some(logger) => { + let metadata = LogMetadata { + level: level, + target: target, + }; + logger.enabled(&metadata) + } + None => { + log::Log::enabled( + log::logger(), + &log::Metadata::builder() + .level(level.to_new()) + .target(target) + .build() + ) + } + } +} + +// WARNING +// This is not considered part of the crate's public API. It is subject to +// change at any time. +#[doc(hidden)] +pub fn __log(level: LogLevel, target: &str, loc: &LogLocation, + args: fmt::Arguments) { + match logger() { + Some(logger) => { + let record = LogRecord { + metadata: LogMetadata { + level: level, + target: target, + }, + location: loc, + args: args, + }; + logger.log(&record); + } + None => { + log::Log::log( + log::logger(), + &log::Record::builder() + .level(level.to_new()) + .target(target) + .file(Some(loc.__file)) + .line(Some(loc.__line)) + .module_path(Some(loc.__module_path)) + .args(args) + .build() + ) + } + } +} + +// WARNING +// This is not considered part of the crate's public API. It is subject to +// change at any time. +#[inline(always)] +#[doc(hidden)] +pub fn __static_max_level() -> LogLevelFilter { + LogLevelFilter::from_new(log::STATIC_MAX_LEVEL) +} + +#[cfg(test)] +mod tests { + extern crate std; + use tests::std::string::ToString; + use super::{LogLevel, LogLevelFilter}; + + #[test] + fn test_loglevelfilter_from_str() { + let tests = [ + ("off", Ok(LogLevelFilter::Off)), + ("error", Ok(LogLevelFilter::Error)), + ("warn", Ok(LogLevelFilter::Warn)), + ("info", Ok(LogLevelFilter::Info)), + ("debug", Ok(LogLevelFilter::Debug)), + ("trace", Ok(LogLevelFilter::Trace)), + ("OFF", Ok(LogLevelFilter::Off)), + ("ERROR", Ok(LogLevelFilter::Error)), + ("WARN", Ok(LogLevelFilter::Warn)), + ("INFO", Ok(LogLevelFilter::Info)), + ("DEBUG", Ok(LogLevelFilter::Debug)), + ("TRACE", Ok(LogLevelFilter::Trace)), + ("asdf", Err(())), + ]; + for &(s, ref expected) in &tests { + assert_eq!(expected, &s.parse()); + } + } + + #[test] + fn test_loglevel_from_str() { + let tests = [ + ("OFF", Err(())), + ("error", Ok(LogLevel::Error)), + ("warn", Ok(LogLevel::Warn)), + ("info", Ok(LogLevel::Info)), + ("debug", Ok(LogLevel::Debug)), + ("trace", Ok(LogLevel::Trace)), + ("ERROR", Ok(LogLevel::Error)), + ("WARN", Ok(LogLevel::Warn)), + ("INFO", Ok(LogLevel::Info)), + ("DEBUG", Ok(LogLevel::Debug)), + ("TRACE", Ok(LogLevel::Trace)), + ("asdf", Err(())), + ]; + for &(s, ref expected) in &tests { + assert_eq!(expected, &s.parse()); + } + } + + #[test] + fn test_loglevel_show() { + assert_eq!("INFO", LogLevel::Info.to_string()); + assert_eq!("ERROR", LogLevel::Error.to_string()); + } + + #[test] + fn test_loglevelfilter_show() { + assert_eq!("OFF", LogLevelFilter::Off.to_string()); + assert_eq!("ERROR", LogLevelFilter::Error.to_string()); + } + + #[test] + fn test_cross_cmp() { + assert!(LogLevel::Debug > LogLevelFilter::Error); + assert!(LogLevelFilter::Warn < LogLevel::Trace); + assert!(LogLevelFilter::Off < LogLevel::Error); + } + + #[test] + fn test_cross_eq() { + assert!(LogLevel::Error == LogLevelFilter::Error); + assert!(LogLevelFilter::Off != LogLevel::Error); + assert!(LogLevel::Trace == LogLevelFilter::Trace); + } + + #[test] + fn test_to_log_level() { + assert_eq!(Some(LogLevel::Error), LogLevelFilter::Error.to_log_level()); + assert_eq!(None, LogLevelFilter::Off.to_log_level()); + assert_eq!(Some(LogLevel::Debug), LogLevelFilter::Debug.to_log_level()); + } + + #[test] + fn test_to_log_level_filter() { + assert_eq!(LogLevelFilter::Error, LogLevel::Error.to_log_level_filter()); + assert_eq!(LogLevelFilter::Trace, LogLevel::Trace.to_log_level_filter()); + } + + #[test] + #[cfg(feature = "use_std")] + fn test_error_trait() { + use std::error::Error; + use super::SetLoggerError; + let e = SetLoggerError(()); + assert_eq!(e.description(), "set_logger() called multiple times"); + } +} diff --git a/src/vendor/log-0.3.9/src/macros.rs b/src/vendor/log-0.3.9/src/macros.rs new file mode 100644 index 0000000000..7037f9ac0d --- /dev/null +++ b/src/vendor/log-0.3.9/src/macros.rs @@ -0,0 +1,155 @@ +// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +/// The standard logging macro. +/// +/// This macro will generically log with the specified `LogLevel` and `format!` +/// based argument list. +/// +/// The `max_level_*` features can be used to statically disable logging at +/// various levels. +#[macro_export] +macro_rules! log { + (target: $target:expr, $lvl:expr, $($arg:tt)+) => ({ + static _LOC: $crate::LogLocation = $crate::LogLocation { + __line: line!(), + __file: file!(), + __module_path: module_path!(), + }; + let lvl = $lvl; + if lvl <= $crate::__static_max_level() && lvl <= $crate::max_log_level() { + $crate::__log(lvl, $target, &_LOC, format_args!($($arg)+)) + } + }); + ($lvl:expr, $($arg:tt)+) => (log!(target: module_path!(), $lvl, $($arg)+)) +} + +/// Logs a message at the error level. +/// +/// Logging at this level is disabled if the `max_level_off` feature is present. +#[macro_export] +macro_rules! error { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Error, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Error, $($arg)*); + ) +} + +/// Logs a message at the warn level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off` or `max_level_error`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off` or `max_level_error`. +#[macro_export] +macro_rules! warn { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Warn, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Warn, $($arg)*); + ) +} + +/// Logs a message at the info level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off`, `max_level_error`, or `max_level_warn`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off`, `release_max_level_error`, or +/// `release_max_level_warn`. +#[macro_export] +macro_rules! info { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Info, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Info, $($arg)*); + ) +} + +/// Logs a message at the debug level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off`, `max_level_error`, `max_level_warn`, or +/// `max_level_info`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off`, `release_max_level_error`, +/// `release_max_level_warn`, or `release_max_level_info`. +#[macro_export] +macro_rules! debug { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Debug, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Debug, $($arg)*); + ) +} + +/// Logs a message at the trace level. +/// +/// Logging at this level is disabled if any of the following features are +/// present: `max_level_off`, `max_level_error`, `max_level_warn`, +/// `max_level_info`, or `max_level_debug`. +/// +/// When building in release mode (i.e., without the `debug_assertions` option), +/// logging at this level is also disabled if any of the following features are +/// present: `release_max_level_off`, `release_max_level_error`, +/// `release_max_level_warn`, `release_max_level_info`, or +/// `release_max_level_debug`. +#[macro_export] +macro_rules! trace { + (target: $target:expr, $($arg:tt)*) => ( + log!(target: $target, $crate::LogLevel::Trace, $($arg)*); + ); + ($($arg:tt)*) => ( + log!($crate::LogLevel::Trace, $($arg)*); + ) +} + +/// Determines if a message logged at the specified level in that module will +/// be logged. +/// +/// This can be used to avoid expensive computation of log message arguments if +/// the message would be ignored anyway. +/// +/// # Examples +/// +/// ```rust +/// # #[macro_use] +/// # extern crate log; +/// use log::LogLevel::Debug; +/// +/// # fn foo() { +/// if log_enabled!(Debug) { +/// let data = expensive_call(); +/// debug!("expensive debug data: {} {}", data.x, data.y); +/// } +/// # } +/// # struct Data { x: u32, y: u32 } +/// # fn expensive_call() -> Data { Data { x: 0, y: 0 } } +/// # fn main() {} +/// ``` +#[macro_export] +macro_rules! log_enabled { + (target: $target:expr, $lvl:expr) => ({ + let lvl = $lvl; + lvl <= $crate::__static_max_level() && lvl <= $crate::max_log_level() && + $crate::__enabled(lvl, $target) + }); + ($lvl:expr) => (log_enabled!(target: module_path!(), $lvl)) +} diff --git a/src/vendor/log/.cargo-checksum.json b/src/vendor/log/.cargo-checksum.json index 542f06e5ae..181409e126 100644 --- a/src/vendor/log/.cargo-checksum.json +++ b/src/vendor/log/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"12cc0f91b51fedf41ae1670d1624ee1d78a284bdb101645b60a06a12de16c069",".travis.yml":"985cf95c79f32c65766927fd6ef5079f8c14f235ddb4213e6410d90a86a95811","Cargo.toml":"0a4a756f7ef47f5dfa221a173b21f9ec496b448aafcd9bde08d9d16935b55007","Cargo.toml.orig":"511fe1dec6d79cbadb22c9f61c9153627bb57b2cfc975e1d558574a409659d6e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"aa8356455efcc3d49f66e7fa394eac292c9158164dff074e32c699b64891cb4b","appveyor.yml":"c61473b8c780ad2626282ce2b2ba0ef278082b6afe151a62ff419f33eaf90221","src/lib.rs":"75b44acfc9627b821cd725649db07693a43b2e44b2fac19b79354c6d950c4038","src/macros.rs":"3953610da3ee2dc393262b753f2406d1864a1cbd74d2bd20d279e09aabfe7131","tests/filters.rs":"cc61ed41a6cd77e5aef91cc8c76216b492d8de34f00635254f3835a3d964ce22"},"package":"880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"12cc0f91b51fedf41ae1670d1624ee1d78a284bdb101645b60a06a12de16c069",".travis.yml":"8e95f3543ff36e1fd0e2e2fcc98b31e20dcc19d220f3d7d19bfb9aeb61030823","CHANGELOG.md":"cdfe104547fca9d80b95cff2c6ef5af7cdcd0a17886ec3722c157a598abec018","Cargo.toml":"ba13b382a64b910241ce4fc2ac4f45dd3a8f404f762f07958004a41de1cb55df","Cargo.toml.orig":"5bd3dcbf7f39c429ab7729276a5cdd6dfbbb7ca35ef8945dd22bdf7503e6319f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"95873097578066ef6a0cc395f1aad5596762570ba1476757643fb319e3892481","appveyor.yml":"d5376a881aef6dc3bed6a6b51f1f1c3801b88fc77a12895f6953190256e965bc","src/lib.rs":"4ffa677655636a6c111026d318c92bb53bd91988e601fcdcdbe1f43b1997b8fd","src/macros.rs":"064c96e154b58b61b8a4f11cab9c0664dd171010f578af438fad0dc1d796ac5c","src/serde.rs":"7617ffa21dde363a06389f8e26661f35550c1a01ff142f81275e95f42b79c854","tests/filters.rs":"6aee024d4594b4fde772e35c5d3318e5aa5d9aa4eaeafb04e4c7c922be4ac837"},"package":"89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"} \ No newline at end of file diff --git a/src/vendor/log/.travis.yml b/src/vendor/log/.travis.yml index 1b82ecd3ae..f8b4ff4074 100644 --- a/src/vendor/log/.travis.yml +++ b/src/vendor/log/.travis.yml @@ -1,28 +1,19 @@ language: rust sudo: false rust: + - 1.16.0 - stable - beta - nightly -before_script: - - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH script: - cargo build --verbose - - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo build --verbose --no-default-features) - - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo build --verbose --features nightly) + - cargo build --verbose --features serde + - cargo build --verbose --features std - cargo test --verbose - - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --no-default-features) - - cargo test --verbose --manifest-path env/Cargo.toml - - cargo test --verbose --manifest-path env/Cargo.toml --no-default-features + - cargo test --verbose --features serde + - cargo test --verbose --features std - cargo run --verbose --manifest-path tests/max_level_features/Cargo.toml - cargo run --verbose --manifest-path tests/max_level_features/Cargo.toml --release - - ([ $TRAVIS_RUST_VERSION != nightly ] || cargo doc --no-deps --features nightly) - - CARGO_TARGET_DIR=target cargo doc --no-deps --manifest-path env/Cargo.toml -after_success: - - travis-cargo --only nightly doc-upload -env: - global: - secure: "VPHgnszydMudYTY8cthHj/Dmxqp7OmTiu4Sa/705Udsx+tYblTv+8WdThkClo3C/asStVcxlaRWAp91UX32/k4SfkPz17XId3Wadyt03r73ANm6ZOWY+qty+3/LINm54kuTxYUDDTbD6NaFNPFQLIE0xCpJeiXUQTlaMk6z0W3M=" notifications: email: diff --git a/src/vendor/log/CHANGELOG.md b/src/vendor/log/CHANGELOG.md new file mode 100644 index 0000000000..b26b418b7a --- /dev/null +++ b/src/vendor/log/CHANGELOG.md @@ -0,0 +1,83 @@ +# Change Log + +## [Unreleased] + +## [0.4.1] - 2017-12-30 + +### Fixed + +* Some doc links were fixed. + +## [0.4.0] - 2017-12-24 + +The changes in this release include cleanup of some obscure functionality and a more robust public +API designed to support bridges to other logging systems, and provide more flexibility to new +features in the future. + +### Compatibility + +Vast portions of the Rust ecosystem use the 0.3.x release series of log, and we don't want to force +the community to go through the pain of upgrading every crate to 0.4.x at the exact same time. Along +with 0.4.0, we've published a new 0.3.9 release which acts as a "shim" over 0.4.0. This will allow +crates using either version to coexist without losing messages from one side or the other. + +There is one caveat - a log message generated by a crate using 0.4.x but consumed by a logging +implementation using 0.3.x will not have a file name or module path. Applications affected by this +can upgrade their logging implementations to one using 0.4.x to avoid losing this information. The +other direction does not lose any information, fortunately! + +**TL;DR** Libraries should feel comfortable upgrading to 0.4.0 without treating that as a breaking +change. Applications may need to update their logging implementation (e.g. env-logger) to a newer +version using log 0.4.x to avoid losing module and file information. + +### New + +* The crate is now `no_std` by default. +* `Level` and `LevelFilter` now implement `Serialize` and `Deserialize` when the `serde` feature is + enabled. +* The `Record` and `Metadata` types can now be constructed by third-party code via a builder API. +* The `logger` free function returns a reference to the logger implementation. This, along with the + ability to construct `Record`s, makes it possible to bridge from another logging framework to + this one without digging into the private internals of the crate. The standard `error!` `warn!`, + etc, macros now exclusively use the public API of the crate rather than "secret" internal APIs. +* `Log::flush` has been added to allow crates to tell the logging implementation to ensure that all + "in flight" log events have been persisted. This can be used, for example, just before an + application exits to ensure that asynchronous log sinks finish their work. + +### Removed + +* The `shutdown` and `shutdown_raw` functions have been removed. Supporting shutdown significantly + complicated the implementation and imposed a performance cost on each logging operation. +* The `log_panics` function and its associated `nightly` Cargo feature have been removed. Use the + [log-panics](https://crates.io/crates/log-panics) instead. + +### Changed + +* The `Log` prefix has been removed from type names. For example, `LogLevelFilter` is now + `LevelFilter`, and `LogRecord` is now `Record`. +* The `MaxLogLevelFilter` object has been removed in favor of a `set_max_level` free function. +* The `set_logger` free functions have been restructured. The logger is now directly passed to the + functions rather than a closure which returns the logger. `set_logger` now takes a `&'static + Log` and is usable in `no_std` contexts in place of the old `set_logger_raw`. `set_boxed_logger` + is a convenience function which takes a `Box` but otherwise acts like `set_logger`. It + requires the `std` feature. +* The `file` and `module_path` values in `Record` no longer have the `'static` lifetime to support + integration with other logging frameworks that don't provide a `'static` lifetime for the + equivalent values. +* The `file`, `line`, and `module_path` values in `Record` are now `Option`s to support integration + with other logging frameworks that don't provide those values. + +### In the Future + +* We're looking to add support for *structured* logging - the inclusion of extra key-value pairs of + information in a log event in addition to the normal string message. This should be able to be + added in a backwards compatible manner to the 0.4.x series when the design is worked out. + +## Older + +Look at the [release tags] for information about older releases. + +[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.1...HEAD +[0.4.1]: https://github.com/rust-lang-nursery/log/compare/0.4.0...0.4.1 +[0.4.0]: https://github.com/rust-lang-nursery/log/compare/0.3.8...0.4.0 +[release tags]: https://github.com/rust-lang-nursery/log/releases diff --git a/src/vendor/log/Cargo.toml b/src/vendor/log/Cargo.toml index 8ab7f22e5a..510a771890 100644 --- a/src/vendor/log/Cargo.toml +++ b/src/vendor/log/Cargo.toml @@ -12,36 +12,46 @@ [package] name = "log" -version = "0.3.8" +version = "0.4.1" authors = ["The Rust Project Developers"] description = "A lightweight logging facade for Rust\n" homepage = "https://github.com/rust-lang/log" documentation = "https://docs.rs/log" readme = "README.md" +keywords = ["logging"] categories = ["development-tools::debugging"] license = "MIT/Apache-2.0" repository = "https://github.com/rust-lang/log" +[package.metadata.docs.rs] +features = ["std", "serde"] [[test]] name = "filters" harness = false +[dependencies.cfg-if] +version = "0.1.2" + +[dependencies.serde] +version = "1.0" +optional = true +default-features = false +[dev-dependencies.serde_test] +version = "1.0" [features] -max_level_info = [] -nightly = [] -max_level_warn = [] -release_max_level_debug = [] -release_max_level_info = [] -release_max_level_off = [] -release_max_level_error = [] max_level_debug = [] -release_max_level_warn = [] -use_std = [] +max_level_error = [] +max_level_info = [] max_level_off = [] max_level_trace = [] +max_level_warn = [] +release_max_level_debug = [] +release_max_level_error = [] +release_max_level_info = [] +release_max_level_off = [] release_max_level_trace = [] -max_level_error = [] -default = ["use_std"] +release_max_level_warn = [] +std = [] [badges.appveyor] repository = "alexcrichton/log" diff --git a/src/vendor/log/Cargo.toml.orig b/src/vendor/log/Cargo.toml.orig index 66638c65ef..fc53fe0f37 100644 --- a/src/vendor/log/Cargo.toml.orig +++ b/src/vendor/log/Cargo.toml.orig @@ -1,7 +1,7 @@ [package] name = "log" -version = "0.3.8" +version = "0.4.1" # remember to update html_root_url authors = ["The Rust Project Developers"] license = "MIT/Apache-2.0" readme = "README.md" @@ -12,6 +12,10 @@ description = """ A lightweight logging facade for Rust """ categories = ["development-tools::debugging"] +keywords = ["logging"] + +[package.metadata.docs.rs] +features = ["std", "serde"] [[test]] name = "filters" @@ -32,10 +36,15 @@ release_max_level_info = [] release_max_level_debug = [] release_max_level_trace = [] -nightly = [] -use_std = [] -default = ["use_std"] +std = [] [badges] travis-ci = { repository = "rust-lang-nursery/log" } appveyor = { repository = "alexcrichton/log" } + +[dependencies] +cfg-if = "0.1.2" +serde = { version = "1.0", optional = true, default-features = false } + +[dev-dependencies] +serde_test = "1.0" diff --git a/src/vendor/log/README.md b/src/vendor/log/README.md index 1ff4a89ba7..c1c2dbff82 100644 --- a/src/vendor/log/README.md +++ b/src/vendor/log/README.md @@ -6,8 +6,7 @@ A Rust library providing a lightweight logging *facade*. [![Build Status](https://travis-ci.org/rust-lang-nursery/log.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/log) [![Build status](https://ci.appveyor.com/api/projects/status/nopdjmmjt45xcrki?svg=true)](https://ci.appveyor.com/project/alexcrichton/log) -* [`log` documentation](https://doc.rust-lang.org/log) -* [`env_logger` documentation](https://doc.rust-lang.org/log/env_logger) +* [`log` documentation](https://docs.rs/log) A logging facade provides a single logging API that abstracts over the actual logging implementation. Libraries can use the logging API provided by this @@ -23,7 +22,7 @@ log whatever information will be useful to downstream consumers: ```toml [dependencies] -log = "0.3" +log = "0.4" ``` ```rust @@ -50,128 +49,26 @@ pub fn shave_the_yak(yak: &Yak) { ## In executables +In order to produce log output executables have to use a logger implementation compatible with the facade. +There are many available implementations to chose from, here are some of the most popular ones: + +* Simple minimal loggers: + * [`env_logger`](https://docs.rs/env_logger/*/env_logger/) + * [`simple_logger`](https://github.com/borntyping/rust-simple_logger) + * [`simplelog`](https://github.com/drakulix/simplelog.rs) + * [`pretty_env_logger`](https://docs.rs/pretty_env_logger/*/pretty_env_logger/) + * [`stderrlog`](https://docs.rs/stderrlog/*/stderrlog/) + * [`flexi_logger`](https://docs.rs/flexi_logger/*/flexi_logger/) +* Complex configurable frameworks: + * [`log4rs`](https://docs.rs/log4rs/*/log4rs/) + * [`fern`](https://docs.rs/fern/*/fern/) +* Adaptors for other facilities: + * [`syslog`](https://docs.rs/syslog/*/syslog/) + * [`slog-stdlog`](https://docs.rs/slog-stdlog/*/slog_stdlog/) + Executables should choose a logger implementation and initialize it early in the runtime of the program. Logger implementations will typically include a function to do this. Any log messages generated before the logger is initialized will be ignored. The executable itself may use the `log` crate to log as well. - -The `env_logger` crate provides a logger implementation that mirrors the -functionality of the old revision of the `log` crate. - -```toml -[dependencies] -log = "0.3" -env_logger = "0.3" -``` - -```rust -#[macro_use] -extern crate log; -extern crate env_logger; - -fn main() { - env_logger::init().unwrap(); - - info!("starting up"); - - // ... -} -``` - -## In tests - -Tests can use the `env_logger` crate to see log messages generated during that test: - -```toml -[dependencies] -log = "0.3" - -[dev-dependencies] -env_logger = "0.3" -``` - -```rust -#[macro_use] -extern crate log; - -fn add_one(num: i32) -> i32 { - info!("add_one called with {}", num); - num + 1 -} - -#[cfg(test)] -mod tests { - use super::*; - extern crate env_logger; - - #[test] - fn it_adds_one() { - let _ = env_logger::init(); - info!("can log from the test too"); - assert_eq!(3, add_one(2)); - } - - #[test] - fn it_handles_negative_numbers() { - let _ = env_logger::init(); - info!("logging from another test"); - assert_eq!(-7, add_one(-8)); - } -} -``` - -Assuming the module under test is called `my_lib`, running the tests with the -`RUST_LOG` filtering to info messages from this module looks like: - -```bash -$ RUST_LOG=my_lib=info cargo test - Running target/debug/my_lib-... - -running 2 tests -INFO:my_lib::tests: logging from another test -INFO:my_lib: add_one called with -8 -test tests::it_handles_negative_numbers ... ok -INFO:my_lib::tests: can log from the test too -INFO:my_lib: add_one called with 2 -test tests::it_adds_one ... ok - -test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured -``` - -Note that `env_logger::init()` needs to be called in each test in which you -want to enable logging. Additionally, the default behavior of tests to -run in parallel means that logging output may be interleaved with test output. -Either run tests in a single thread by specifying `RUST_TEST_THREADS=1` or by -running one test by specifying its name as an argument to the test binaries as -directed by the `cargo test` help docs: - -```bash -$ RUST_LOG=my_lib=info cargo test it_adds_one - Running target/debug/my_lib-... - -running 1 test -INFO:my_lib::tests: can log from the test too -INFO:my_lib: add_one called with 2 -test tests::it_adds_one ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -``` - -## Configuring log target - -By default, `env_logger` logs to stderr. If you want to log to stdout instead, -you can use the `LogBuilder` to change the log target: - -```rust -use std::env; -use env_logger::{LogBuilder, LogTarget}; - -let mut builder = LogBuilder::new(); -builder.target(LogTarget::Stdout); -if env::var("RUST_LOG").is_ok() { - builder.parse(&env::var("RUST_LOG").unwrap()); -} -builder.init().unwrap(); -``` diff --git a/src/vendor/log/appveyor.yml b/src/vendor/log/appveyor.yml index 841011deb2..eb6786dd11 100644 --- a/src/vendor/log/appveyor.yml +++ b/src/vendor/log/appveyor.yml @@ -15,4 +15,5 @@ build: false test_script: - cargo test --verbose - - cargo test --manifest-path env/Cargo.toml + - cargo test --verbose --features serde + - cargo test --verbose --features std diff --git a/src/vendor/log/src/lib.rs b/src/vendor/log/src/lib.rs index 04a410e146..e68cf40bcb 100644 --- a/src/vendor/log/src/lib.rs +++ b/src/vendor/log/src/lib.rs @@ -13,7 +13,7 @@ //! The `log` crate provides a single logging API that abstracts over the //! actual logging implementation. Libraries can use the logging API provided //! by this crate, and the consumer of those libraries can choose the logging -//! framework that is most suitable for its use case. +//! implementation that is most suitable for its use case. //! //! If no logging implementation is selected, the facade falls back to a "noop" //! implementation that ignores all log messages. The overhead in this case @@ -26,6 +26,20 @@ //! //! # Use //! +//! The basic use of the log crate is through the five logging macros: [`error!`], +//! [`warn!`], [`info!`], [`debug!`] and [`trace!`] +//! where `error!` represents the highest-priority log level, and `trace!` the lowest. +//! +//! Each of these macros accept format strings similarly to [`println!`]. +//! +//! +//! [`error!`]: ./macro.error.html +//! [`warn!`]: ./macro.warn.html +//! [`info!`]: ./macro.info.html +//! [`debug!`]: ./macro.debug.html +//! [`trace!`]: ./macro.trace.html +//! [`println!`]: https://doc.rust-lang.org/stable/std/macro.println.html +//! //! ## In libraries //! //! Libraries should link only to the `log` crate, and use the provided @@ -62,10 +76,10 @@ //! //! ## In executables //! -//! Executables should choose a logging framework and initialize it early in the -//! runtime of the program. Logging frameworks will typically include a -//! function to do this. Any log messages generated before the framework is -//! initialized will be ignored. +//! Executables should choose a logging implementation and initialize it early in the +//! runtime of the program. Logging implementations will typically include a +//! function to do this. Any log messages generated before +//! the implementation is initialized will be ignored. //! //! The executable itself may use the `log` crate to log as well. //! @@ -73,26 +87,28 @@ //! //! The logging system may only be initialized once. //! -//! ### Examples +//! # Available logging implementations //! -//! ```rust,ignore -//! #[macro_use] -//! extern crate log; -//! extern crate env_logger; +//! In order to produce log output executables have to use +//! a logger implementation compatible with the facade. +//! There are many available implementations to choose from, +//! here are some of the most popular ones: //! -//! fn main() { -//! // Select env_logger, one possible logger implementation -//! // (see https://doc.rust-lang.org/log/env_logger/index.html) -//! env_logger::init().unwrap(); -//! -//! info!("starting up"); -//! error!("error: {}", 404); -//! -//! // ... -//! } -//! ``` +//! * Simple minimal loggers: +//! * [env_logger] +//! * [simple_logger] +//! * [simplelog] +//! * [pretty_env_logger] +//! * [stderrlog] +//! * [flexi_logger] +//! * Complex configurable frameworks: +//! * [log4rs] +//! * [fern] +//! * Adaptors for other facilities: +//! * [syslog] +//! * [slog-stdlog] //! -//! # Logger implementations +//! # Implementing a Logger //! //! Loggers implement the [`Log`] trait. Here's a very basic example that simply //! logs all messages at the [`Error`][level_link], [`Warn`][level_link] or @@ -101,174 +117,201 @@ //! ```rust //! extern crate log; //! -//! use log::{LogRecord, LogLevel, LogMetadata}; +//! use log::{Record, Level, Metadata}; //! //! struct SimpleLogger; //! //! impl log::Log for SimpleLogger { -//! fn enabled(&self, metadata: &LogMetadata) -> bool { -//! metadata.level() <= LogLevel::Info +//! fn enabled(&self, metadata: &Metadata) -> bool { +//! metadata.level() <= Level::Info //! } //! -//! fn log(&self, record: &LogRecord) { +//! fn log(&self, record: &Record) { //! if self.enabled(record.metadata()) { //! println!("{} - {}", record.level(), record.args()); //! } //! } +//! +//! fn flush(&self) {} //! } //! //! # fn main() {} //! ``` //! //! Loggers are installed by calling the [`set_logger`] function. It takes a -//! closure which is provided a [`MaxLogLevelFilter`] token and returns a -//! [`Log`] trait object. The [`MaxLogLevelFilter`] token controls the global +//! closure which is provided a [`MaxLevelFilter`] token and returns a +//! [`Log`] trait object. The [`MaxLevelFilter`] token controls the global //! maximum log level. The logging facade uses this as an optimization to //! improve performance of log messages at levels that are disabled. In the //! case of our example logger, we'll want to set the maximum log level to //! [`Info`][level_link], since we ignore any [`Debug`][level_link] or -//! [`Trace`][level_link] level log messages. A logging framework should -//! provide a function that wraps a call to [`set_logger`], handling +//! [`Trace`][level_link] level log messages. A logging implementation +//! should provide a function that wraps a call to [`set_logger`], handling //! initialization of the logger: //! //! ```rust //! # extern crate log; -//! # use log::{LogLevel, LogLevelFilter, SetLoggerError, LogMetadata}; +//! # use log::{Level, Metadata}; //! # struct SimpleLogger; //! # impl log::Log for SimpleLogger { -//! # fn enabled(&self, _: &LogMetadata) -> bool { false } -//! # fn log(&self, _: &log::LogRecord) {} -//! # } -//! # fn main() {} -//! # #[cfg(feature = "use_std")] -//! pub fn init() -> Result<(), SetLoggerError> { -//! log::set_logger(|max_log_level| { -//! max_log_level.set(LogLevelFilter::Info); -//! Box::new(SimpleLogger) -//! }) -//! } -//! ``` -//! -//! # Use with `no_std` -//! -//! To use the `log` crate without depending on `libstd`, you need to specify -//! `default-features = false` when specifying the dependency in `Cargo.toml`. -//! This makes no difference to libraries using `log` since the logging API -//! remains the same. However executables will need to use the [`set_logger_raw`] -//! function to initialize a logger and the [`shutdown_logger_raw`] function to -//! shut down the global logger before exiting: -//! -//! ```rust -//! # extern crate log; -//! # use log::{LogLevel, LogLevelFilter, SetLoggerError, ShutdownLoggerError, -//! # LogMetadata}; -//! # struct SimpleLogger; -//! # impl log::Log for SimpleLogger { -//! # fn enabled(&self, _: &LogMetadata) -> bool { false } -//! # fn log(&self, _: &log::LogRecord) {} -//! # } -//! # impl SimpleLogger { +//! # fn enabled(&self, _: &Metadata) -> bool { false } +//! # fn log(&self, _: &log::Record) {} //! # fn flush(&self) {} //! # } //! # fn main() {} +//! use log::{SetLoggerError, LevelFilter}; +//! +//! static LOGGER: SimpleLogger = SimpleLogger; +//! //! pub fn init() -> Result<(), SetLoggerError> { -//! unsafe { -//! log::set_logger_raw(|max_log_level| { -//! static LOGGER: SimpleLogger = SimpleLogger; -//! max_log_level.set(LogLevelFilter::Info); -//! &SimpleLogger -//! }) -//! } -//! } -//! pub fn shutdown() -> Result<(), ShutdownLoggerError> { -//! log::shutdown_logger_raw().map(|logger| { -//! let logger = unsafe { &*(logger as *const SimpleLogger) }; -//! logger.flush(); -//! }) +//! log::set_logger(&LOGGER) //! } //! ``` //! +//! # Use with `std` +//! +//! `set_logger` requires you to provide a `&'static Log`, which can be hard if +//! your logger depends on some runtime configuration. The `set_boxed_logger` +//! function is available with the `std` Cargo feature. It is identical to +//! `set_logger` except that it requires you to provide a `Box` rather than +//! a `&'static Log`: +//! +//! ```rust +//! # extern crate log; +//! # use log::{Level, LevelFilter, Log, SetLoggerError, Metadata}; +//! # struct SimpleLogger; +//! # impl log::Log for SimpleLogger { +//! # fn enabled(&self, _: &Metadata) -> bool { false } +//! # fn log(&self, _: &log::Record) {} +//! # fn flush(&self) {} +//! # } +//! # fn main() {} +//! # #[cfg(feature = "std")] +//! pub fn init() -> Result<(), SetLoggerError> { +//! log::set_boxed_logger(Box::new(SimpleLogger)) +//! } +//! ``` +//! +//! # Compile time filters +//! +//! Log levels can be statically disabled at compile time via Cargo features. Log invocations at +//! disabled levels will be skipped and will not even be present in the resulting binary unless the +//! log level is specified dynamically. This level is configured separately for release and debug +//! builds. The features are: +//! +//! * `max_level_off` +//! * `max_level_error` +//! * `max_level_warn` +//! * `max_level_info` +//! * `max_level_debug` +//! * `max_level_trace` +//! * `release_max_level_off` +//! * `release_max_level_error` +//! * `release_max_level_warn` +//! * `release_max_level_info` +//! * `release_max_level_debug` +//! * `release_max_level_trace` +//! +//! These features control the value of the `STATIC_MAX_LEVEL` constant. The logging macros check +//! this value before logging a message. By default, no levels are disabled. +//! +//! For example, a crate can disable trace level logs in debug builds and trace, info, and warn +//! level logs in release builds with the following configuration: +//! +//! ```toml +//! [dependencies] +//! log = { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] } +//! ``` +//! +//! # Version compatibility +//! +//! The 0.3 and 0.4 versions of the `log` crate are almost entirely compatible. Log messages +//! made using `log` 0.3 will forward transparently to a logger implementation using `log` 0.4. Log +//! messages made using `log` 0.4 will forward to a logger implementation using `log` 0.3, but the +//! module path and file name information associated with the message will unfortunately be lost. +//! //! [`Log`]: trait.Log.html -//! [level_link]: enum.LogLevel.html +//! [level_link]: enum.Level.html //! [`set_logger`]: fn.set_logger.html -//! [`MaxLogLevelFilter`]: struct.MaxLogLevelFilter.html -//! [`set_logger_raw`]: fn.set_logger_raw.html +//! [`MaxLevelFilter`]: struct.MaxLevelFilter.html +//! [`try_set_logger_raw`]: fn.try_set_logger_raw.html //! [`shutdown_logger_raw`]: fn.shutdown_logger_raw.html +//! [env_logger]: https://docs.rs/env_logger/*/env_logger/ +//! [simple_logger]: https://github.com/borntyping/rust-simple_logger +//! [simplelog]: https://github.com/drakulix/simplelog.rs +//! [pretty_env_logger]: https://docs.rs/pretty_env_logger/*/pretty_env_logger/ +//! [stderrlog]: https://docs.rs/stderrlog/*/stderrlog/ +//! [flexi_logger]: https://docs.rs/flexi_logger/*/flexi_logger/ +//! [syslog]: https://docs.rs/syslog/*/syslog/ +//! [slog-stdlog]: https://docs.rs/slog-stdlog/*/slog_stdlog/ +//! [log4rs]: https://docs.rs/log4rs/*/log4rs/ +//! [fern]: https://docs.rs/fern/*/fern/ #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://doc.rust-lang.org/log/")] + html_root_url = "https://docs.rs/log/0.4.1")] #![warn(missing_docs)] #![deny(missing_debug_implementations)] -#![cfg_attr(feature = "nightly", feature(panic_handler))] -#![cfg_attr(not(feature = "use_std"), no_std)] +#![cfg_attr(not(feature = "std"), no_std)] // When compiled for the rustc compiler itself we want to make sure that this is // an unstable crate #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] -#[cfg(not(feature = "use_std"))] +#[cfg(not(feature = "std"))] extern crate core as std; +#[macro_use] +extern crate cfg_if; + use std::cmp; -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] use std::error; use std::fmt; use std::mem; -use std::ops::Deref; use std::str::FromStr; use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; + #[macro_use] mod macros; +mod serde; -// The setup here is a bit weird to make shutdown_logger_raw work. -// -// There are four different states that we care about: the logger's -// uninitialized, the logger's initializing (set_logger's been called but -// LOGGER hasn't actually been set yet), the logger's active, or the logger is -// shut down after calling shutdown_logger_raw. -// // The LOGGER static holds a pointer to the global logger. It is protected by // the STATE static which determines whether LOGGER has been initialized yet. -// -// The shutdown_logger_raw routine needs to make sure that no threads are -// actively logging before it returns. The number of actively logging threads is -// tracked in the REFCOUNT static. The routine first sets STATE back to -// INITIALIZING. All logging calls past that point will immediately return -// without accessing the logger. At that point, the at_exit routine just waits -// for the refcount to reach 0 before deallocating the logger. Note that the -// refcount does not necessarily monotonically decrease at this point, as new -// log calls still increment and decrement it, but the interval in between is -// small enough that the wait is really just for the active log calls to finish. - -static mut LOGGER: *const Log = &NopLogger; +static mut LOGGER: &'static Log = &NopLogger; static STATE: AtomicUsize = ATOMIC_USIZE_INIT; -static REFCOUNT: AtomicUsize = ATOMIC_USIZE_INIT; +// There are three different states that we care about: the logger's +// uninitialized, the logger's initializing (set_logger's been called but +// LOGGER hasn't actually been set yet), or the logger's active. const UNINITIALIZED: usize = 0; const INITIALIZING: usize = 1; const INITIALIZED: usize = 2; static MAX_LOG_LEVEL_FILTER: AtomicUsize = ATOMIC_USIZE_INIT; -static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", - "DEBUG", "TRACE"]; +static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"]; -/// An enum representing the available verbosity levels of the logging framework. +static SET_LOGGER_ERROR: &'static str = "attempted to set a logger after the logging system was \ + already initialized"; +static LEVEL_PARSE_ERROR: &'static str = "attempted to convert a string that doesn't match an \ + existing log level"; + +/// An enum representing the available verbosity levels of the logger. /// -/// Typical usage includes: checking if a certain `LogLevel` is enabled with -/// [`log_enabled!`](macro.log_enabled.html), specifying the `LogLevel` of -/// [`log!`](macro.log.html), and comparing a `LogLevel` directly to a -/// [`LogLevelFilter`](enum.LogLevelFilter.html). +/// Typical usage includes: checking if a certain `Level` is enabled with +/// [`log_enabled!`](macro.log_enabled.html), specifying the `Level` of +/// [`log!`](macro.log.html), and comparing a `Level` directly to a +/// [`LevelFilter`](enum.LevelFilter.html). #[repr(usize)] #[derive(Copy, Eq, Debug, Hash)] -pub enum LogLevel { +pub enum Level { /// The "error" level. /// /// Designates very serious errors. - Error = 1, // This way these line up with the discriminants for LogLevelFilter below + Error = 1, // This way these line up with the discriminants for LevelFilter below /// The "warn" level. /// /// Designates hazardous situations. @@ -287,44 +330,44 @@ pub enum LogLevel { Trace, } -impl Clone for LogLevel { +impl Clone for Level { #[inline] - fn clone(&self) -> LogLevel { + fn clone(&self) -> Level { *self } } -impl PartialEq for LogLevel { +impl PartialEq for Level { #[inline] - fn eq(&self, other: &LogLevel) -> bool { + fn eq(&self, other: &Level) -> bool { *self as usize == *other as usize } } -impl PartialEq for LogLevel { +impl PartialEq for Level { #[inline] - fn eq(&self, other: &LogLevelFilter) -> bool { + fn eq(&self, other: &LevelFilter) -> bool { *self as usize == *other as usize } } -impl PartialOrd for LogLevel { +impl PartialOrd for Level { #[inline] - fn partial_cmp(&self, other: &LogLevel) -> Option { + fn partial_cmp(&self, other: &Level) -> Option { Some(self.cmp(other)) } } -impl PartialOrd for LogLevel { +impl PartialOrd for Level { #[inline] - fn partial_cmp(&self, other: &LogLevelFilter) -> Option { + fn partial_cmp(&self, other: &LevelFilter) -> Option { Some((*self as usize).cmp(&(*other as usize))) } } -impl Ord for LogLevel { +impl Ord for Level { #[inline] - fn cmp(&self, other: &LogLevel) -> cmp::Ordering { + fn cmp(&self, other: &Level) -> cmp::Ordering { (*self as usize).cmp(&(*other as usize)) } } @@ -347,68 +390,72 @@ fn eq_ignore_ascii_case(a: &str, b: &str) -> bool { } if a.len() == b.len() { - a.bytes() - .zip(b.bytes()) - .all(|(a, b)| to_ascii_uppercase(a) == to_ascii_uppercase(b)) + a.bytes().zip(b.bytes()).all(|(a, b)| { + to_ascii_uppercase(a) == to_ascii_uppercase(b) + }) } else { false } } -impl FromStr for LogLevel { - type Err = (); - fn from_str(level: &str) -> Result { - ok_or(LOG_LEVEL_NAMES.iter() - .position(|&name| eq_ignore_ascii_case(name, level)) - .into_iter() - .filter(|&idx| idx != 0) - .map(|idx| LogLevel::from_usize(idx).unwrap()) - .next(), ()) +impl FromStr for Level { + type Err = ParseLevelError; + fn from_str(level: &str) -> Result { + ok_or( + LOG_LEVEL_NAMES + .iter() + .position(|&name| eq_ignore_ascii_case(name, level)) + .into_iter() + .filter(|&idx| idx != 0) + .map(|idx| Level::from_usize(idx).unwrap()) + .next(), + ParseLevelError(()), + ) } } -impl fmt::Display for LogLevel { +impl fmt::Display for Level { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.pad(LOG_LEVEL_NAMES[*self as usize]) } } -impl LogLevel { - fn from_usize(u: usize) -> Option { +impl Level { + fn from_usize(u: usize) -> Option { match u { - 1 => Some(LogLevel::Error), - 2 => Some(LogLevel::Warn), - 3 => Some(LogLevel::Info), - 4 => Some(LogLevel::Debug), - 5 => Some(LogLevel::Trace), - _ => None + 1 => Some(Level::Error), + 2 => Some(Level::Warn), + 3 => Some(Level::Info), + 4 => Some(Level::Debug), + 5 => Some(Level::Trace), + _ => None, } } /// Returns the most verbose logging level. #[inline] - pub fn max() -> LogLevel { - LogLevel::Trace + pub fn max() -> Level { + Level::Trace } - /// Converts the `LogLevel` to the equivalent `LogLevelFilter`. + /// Converts the `Level` to the equivalent `LevelFilter`. #[inline] - pub fn to_log_level_filter(&self) -> LogLevelFilter { - LogLevelFilter::from_usize(*self as usize).unwrap() + pub fn to_level_filter(&self) -> LevelFilter { + LevelFilter::from_usize(*self as usize).unwrap() } } -/// An enum representing the available verbosity level filters of the logging -/// framework. +/// An enum representing the available verbosity level filters of the logger. /// -/// A `LogLevelFilter` may be compared directly to a [`LogLevel`](enum.LogLevel.html). -/// Use this type to [`get()`](struct.MaxLogLevelFilter.html#method.get) and -/// [`set()`](struct.MaxLogLevelFilter.html#method.set) the -/// [`MaxLogLevelFilter`](struct.MaxLogLevelFilter.html), or to match with the getter -/// [`max_log_level()`](fn.max_log_level.html). +/// A `LevelFilter` may be compared directly to a [`Level`]. Use this type +/// to get and set the maximum log level with [`max_level()`] and [`set_max_level`]. +/// +/// [`Level`]: enum.Level.html +/// [`max_level()`]: fn.max_level.html +/// [`set_max_level`]: fn.set_max_level.html #[repr(usize)] #[derive(Copy, Eq, Debug, Hash)] -pub enum LogLevelFilter { +pub enum LevelFilter { /// A level lower than all log levels. Off, /// Corresponds to the `Error` log level. @@ -425,616 +472,868 @@ pub enum LogLevelFilter { // Deriving generates terrible impls of these traits -impl Clone for LogLevelFilter { +impl Clone for LevelFilter { #[inline] - fn clone(&self) -> LogLevelFilter { + fn clone(&self) -> LevelFilter { *self } } -impl PartialEq for LogLevelFilter { +impl PartialEq for LevelFilter { #[inline] - fn eq(&self, other: &LogLevelFilter) -> bool { + fn eq(&self, other: &LevelFilter) -> bool { *self as usize == *other as usize } } -impl PartialEq for LogLevelFilter { +impl PartialEq for LevelFilter { #[inline] - fn eq(&self, other: &LogLevel) -> bool { + fn eq(&self, other: &Level) -> bool { other.eq(self) } } -impl PartialOrd for LogLevelFilter { +impl PartialOrd for LevelFilter { #[inline] - fn partial_cmp(&self, other: &LogLevelFilter) -> Option { + fn partial_cmp(&self, other: &LevelFilter) -> Option { Some(self.cmp(other)) } } -impl PartialOrd for LogLevelFilter { +impl PartialOrd for LevelFilter { #[inline] - fn partial_cmp(&self, other: &LogLevel) -> Option { + fn partial_cmp(&self, other: &Level) -> Option { other.partial_cmp(self).map(|x| x.reverse()) } } -impl Ord for LogLevelFilter { +impl Ord for LevelFilter { #[inline] - fn cmp(&self, other: &LogLevelFilter) -> cmp::Ordering { + fn cmp(&self, other: &LevelFilter) -> cmp::Ordering { (*self as usize).cmp(&(*other as usize)) } } -impl FromStr for LogLevelFilter { - type Err = (); - fn from_str(level: &str) -> Result { - ok_or(LOG_LEVEL_NAMES.iter() - .position(|&name| eq_ignore_ascii_case(name, level)) - .map(|p| LogLevelFilter::from_usize(p).unwrap()), ()) +impl FromStr for LevelFilter { + type Err = ParseLevelError; + fn from_str(level: &str) -> Result { + ok_or( + LOG_LEVEL_NAMES + .iter() + .position(|&name| eq_ignore_ascii_case(name, level)) + .map(|p| LevelFilter::from_usize(p).unwrap()), + ParseLevelError(()), + ) } } -impl fmt::Display for LogLevelFilter { +impl fmt::Display for LevelFilter { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "{}", LOG_LEVEL_NAMES[*self as usize]) } } -impl LogLevelFilter { - fn from_usize(u: usize) -> Option { +impl LevelFilter { + fn from_usize(u: usize) -> Option { match u { - 0 => Some(LogLevelFilter::Off), - 1 => Some(LogLevelFilter::Error), - 2 => Some(LogLevelFilter::Warn), - 3 => Some(LogLevelFilter::Info), - 4 => Some(LogLevelFilter::Debug), - 5 => Some(LogLevelFilter::Trace), - _ => None + 0 => Some(LevelFilter::Off), + 1 => Some(LevelFilter::Error), + 2 => Some(LevelFilter::Warn), + 3 => Some(LevelFilter::Info), + 4 => Some(LevelFilter::Debug), + 5 => Some(LevelFilter::Trace), + _ => None, } } /// Returns the most verbose logging level filter. #[inline] - pub fn max() -> LogLevelFilter { - LogLevelFilter::Trace + pub fn max() -> LevelFilter { + LevelFilter::Trace } - /// Converts `self` to the equivalent `LogLevel`. + /// Converts `self` to the equivalent `Level`. /// - /// Returns `None` if `self` is `LogLevelFilter::Off`. + /// Returns `None` if `self` is `LevelFilter::Off`. #[inline] - pub fn to_log_level(&self) -> Option { - LogLevel::from_usize(*self as usize) + pub fn to_level(&self) -> Option { + Level::from_usize(*self as usize) } } -/// The "payload" of a log message. This structure is primarily used as a -/// parameter in the [`log`] method of the [`Log`] trait. +/// The "payload" of a log message. /// -/// [`log`]: trait.Log.html#tymethod.log +/// # Use +/// +/// `Record` structures are passed as parameters to the [`log`][method.log] +/// method of the [`Log`] trait. Logger implementors manipulate these +/// structures in order to display log messages. `Record`s are automatically +/// created by the [`log!`] macro and so are not seen by log users. +/// +/// Note that the [`level()`] and [`target()`] accessors are equivalent to +/// `self.metadata().level()` and `self.metadata().target()` respectively. +/// These methods are provided as a convenience for users of this structure. +/// +/// # Example +/// +/// The following example shows a simple logger that displays the level, +/// module path, and message of any `Record` that is passed to it. +/// +/// ```rust +/// # extern crate log; +/// struct SimpleLogger; +/// +/// impl log::Log for SimpleLogger { +/// fn enabled(&self, metadata: &log::Metadata) -> bool { +/// true +/// } +/// +/// fn log(&self, record: &log::Record) { +/// if !self.enabled(record.metadata()) { +/// return; +/// } +/// +/// println!("{}:{} -- {}", +/// record.level(), +/// record.target(), +/// record.args()); +/// } +/// fn flush(&self) {} +/// } +/// ``` +/// +/// [method.log]: trait.Log.html#tymethod.log /// [`Log`]: trait.Log.html -#[derive(Debug)] -pub struct LogRecord<'a> { - metadata: LogMetadata<'a>, - location: &'a LogLocation, +/// [`log!`]: macro.log.html +/// [`level()`]: struct.Record.html#method.level +/// [`target()`]: struct.Record.html#method.target +#[derive(Clone, Debug)] +pub struct Record<'a> { + metadata: Metadata<'a>, args: fmt::Arguments<'a>, + module_path: Option<&'a str>, + file: Option<&'a str>, + line: Option, } -impl<'a> LogRecord<'a> { +impl<'a> Record<'a> { + /// Returns a new builder. + #[inline] + pub fn builder() -> RecordBuilder<'a> { + RecordBuilder::new() + } + /// The message body. + #[inline] pub fn args(&self) -> &fmt::Arguments<'a> { &self.args } /// Metadata about the log directive. - pub fn metadata(&self) -> &LogMetadata { + #[inline] + pub fn metadata(&self) -> &Metadata<'a> { &self.metadata } - /// The location of the log directive. - pub fn location(&self) -> &LogLocation { - self.location - } - /// The verbosity level of the message. - pub fn level(&self) -> LogLevel { + #[inline] + pub fn level(&self) -> Level { self.metadata.level() } /// The name of the target of the directive. - pub fn target(&self) -> &str { + #[inline] + pub fn target(&self) -> &'a str { self.metadata.target() } + + /// The module path of the message. + #[inline] + pub fn module_path(&self) -> Option<&'a str> { + self.module_path + } + + /// The source file containing the message. + #[inline] + pub fn file(&self) -> Option<&'a str> { + self.file + } + + /// The line containing the message. + #[inline] + pub fn line(&self) -> Option { + self.line + } +} + +/// Builder for [`Record`](struct.Record.html). +/// +/// Typically should only be used by log library creators or for testing and "shim loggers". +/// The `RecordBuilder` can set the different parameters of `Record` object, and returns +/// the created object when `build` is called. +/// +/// # Examples +/// +/// +/// ```rust +/// use log::{Level, Record}; +/// +/// let record = Record::builder() +/// .args(format_args!("Error!")) +/// .level(Level::Error) +/// .target("myApp") +/// .file(Some("server.rs")) +/// .line(Some(144)) +/// .module_path(Some("server")) +/// .build(); +/// ``` +/// +/// Alternatively, use [`MetadataBuilder`](struct.MetadataBuilder.html): +/// +/// ```rust +/// use log::{Record, Level, MetadataBuilder}; +/// +/// let error_metadata = MetadataBuilder::new() +/// .target("myApp") +/// .level(Level::Error) +/// .build(); +/// +/// let record = Record::builder() +/// .metadata(error_metadata) +/// .args(format_args!("Error!")) +/// .line(Some(433)) +/// .file(Some("app.rs")) +/// .module_path(Some("server")) +/// .build(); +/// ``` +#[derive(Debug)] +pub struct RecordBuilder<'a> { + record: Record<'a>, +} + +impl<'a> RecordBuilder<'a> { + /// Construct new `RecordBuilder`. + /// + /// The default options are: + /// + /// - `args`: [`format_args!("")`] + /// - `metadata`: [`Metadata::builder().build()`] + /// - `module_path`: `None` + /// - `file`: `None` + /// - `line`: `None` + /// + /// [`format_args!("")`]: https://doc.rust-lang.org/std/macro.format_args.html + /// [`Metadata::builder().build()`]: struct.MetadataBuilder.html#method.build + #[inline] + pub fn new() -> RecordBuilder<'a> { + RecordBuilder { + record: Record { + args: format_args!(""), + metadata: Metadata::builder().build(), + module_path: None, + file: None, + line: None, + }, + } + } + + /// Set [`args`](struct.Record.html#method.args). + #[inline] + pub fn args(&mut self, args: fmt::Arguments<'a>) -> &mut RecordBuilder<'a> { + self.record.args = args; + self + } + + /// Set [`metadata`](struct.Record.html#method.metadata). Construct a `Metadata` object with [`MetadataBuilder`](struct.MetadataBuilder.html). + #[inline] + pub fn metadata(&mut self, metadata: Metadata<'a>) -> &mut RecordBuilder<'a> { + self.record.metadata = metadata; + self + } + + /// Set [`Metadata::level`](struct.Metadata.html#method.level). + #[inline] + pub fn level(&mut self, level: Level) -> &mut RecordBuilder<'a> { + self.record.metadata.level = level; + self + } + + /// Set [`Metadata::target`](struct.Metadata.html#method.target) + #[inline] + pub fn target(&mut self, target: &'a str) -> &mut RecordBuilder<'a> { + self.record.metadata.target = target; + self + } + + /// Set [`module_path`](struct.Record.html#method.module_path) + #[inline] + pub fn module_path(&mut self, path: Option<&'a str>) -> &mut RecordBuilder<'a> { + self.record.module_path = path; + self + } + + /// Set [`file`](struct.Record.html#method.file) + #[inline] + pub fn file(&mut self, file: Option<&'a str>) -> &mut RecordBuilder<'a> { + self.record.file = file; + self + } + + /// Set [`line`](struct.Record.html#method.line) + #[inline] + pub fn line(&mut self, line: Option) -> &mut RecordBuilder<'a> { + self.record.line = line; + self + } + + /// Invoke the builder and return a `Record` + #[inline] + pub fn build(&self) -> Record<'a> { + self.record.clone() + } } /// Metadata about a log message. -#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] -pub struct LogMetadata<'a> { - level: LogLevel, +/// +/// # Use +/// +/// `Metadata` structs are created when users of the library use +/// logging macros. +/// +/// They are consumed by implementations of the `Log` trait in the +/// `enabled` method. +/// +/// `Record`s use `Metadata` to determine the log message's severity +/// and target. +/// +/// Users should use the `log_enabled!` macro in their code to avoid +/// constructing expensive log messages. +/// +/// # Examples +/// +/// ```rust +/// # #[macro_use] +/// # extern crate log; +/// # +/// use log::{Record, Level, Metadata}; +/// +/// struct MyLogger; +/// +/// impl log::Log for MyLogger { +/// fn enabled(&self, metadata: &Metadata) -> bool { +/// metadata.level() <= Level::Info +/// } +/// +/// fn log(&self, record: &Record) { +/// if self.enabled(record.metadata()) { +/// println!("{} - {}", record.level(), record.args()); +/// } +/// } +/// fn flush(&self) {} +/// } +/// +/// # fn main(){} +/// ``` +#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] +pub struct Metadata<'a> { + level: Level, target: &'a str, } -impl<'a> LogMetadata<'a> { +impl<'a> Metadata<'a> { + /// Returns a new builder. + #[inline] + pub fn builder() -> MetadataBuilder<'a> { + MetadataBuilder::new() + } + /// The verbosity level of the message. - pub fn level(&self) -> LogLevel { + #[inline] + pub fn level(&self) -> Level { self.level } /// The name of the target of the directive. - pub fn target(&self) -> &str { + #[inline] + pub fn target(&self) -> &'a str { self.target } } -/// A trait encapsulating the operations required of a logger -pub trait Log: Sync+Send { +/// Builder for [`Metadata`](struct.Metadata.html). +/// +/// Typically should only be used by log library creators or for testing and "shim loggers". +/// The `MetadataBuilder` can set the different parameters of a `Metadata` object, and returns +/// the created object when `build` is called. +/// +/// # Example +/// +/// ```rust +/// let target = "myApp"; +/// use log::{Level, MetadataBuilder}; +/// let metadata = MetadataBuilder::new() +/// .level(Level::Debug) +/// .target(target) +/// .build(); +/// ``` +#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] +pub struct MetadataBuilder<'a> { + metadata: Metadata<'a>, +} + +impl<'a> MetadataBuilder<'a> { + /// Construct a new `MetadataBuilder`. + /// + /// The default options are: + /// + /// - `level`: `Level::Info` + /// - `target`: `""` + #[inline] + pub fn new() -> MetadataBuilder<'a> { + MetadataBuilder { + metadata: Metadata { + level: Level::Info, + target: "", + }, + } + } + + /// Setter for [`level`](struct.Metadata.html#method.level). + #[inline] + pub fn level(&mut self, arg: Level) -> &mut MetadataBuilder<'a> { + self.metadata.level = arg; + self + } + + /// Setter for [`target`](struct.Metadata.html#method.target). + #[inline] + pub fn target(&mut self, target: &'a str) -> &mut MetadataBuilder<'a> { + self.metadata.target = target; + self + } + + /// Returns a `Metadata` object. + #[inline] + pub fn build(&self) -> Metadata<'a> { + self.metadata.clone() + } +} + +/// A trait encapsulating the operations required of a logger. +pub trait Log: Sync + Send { /// Determines if a log message with the specified metadata would be /// logged. /// /// This is used by the `log_enabled!` macro to allow callers to avoid /// expensive computation of log message arguments if the message would be /// discarded anyway. - fn enabled(&self, metadata: &LogMetadata) -> bool; + fn enabled(&self, metadata: &Metadata) -> bool; - /// Logs the `LogRecord`. + /// Logs the `Record`. /// /// Note that `enabled` is *not* necessarily called before this method. /// Implementations of `log` should perform all necessary filtering /// internally. - fn log(&self, record: &LogRecord); + fn log(&self, record: &Record); + + /// Flushes any buffered records. + fn flush(&self); } // Just used as a dummy initial value for LOGGER struct NopLogger; impl Log for NopLogger { - fn enabled(&self, _: &LogMetadata) -> bool { false } + fn enabled(&self, _: &Metadata) -> bool { + false + } - fn log(&self, _: &LogRecord) {} + fn log(&self, _: &Record) {} + fn flush(&self) {} } -/// The location of a log message. +/// Sets the global maximum log level. /// -/// # Warning -/// -/// The fields of this struct are public so that they may be initialized by the -/// `log!` macro. They are subject to change at any time and should never be -/// accessed directly. -#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub struct LogLocation { - #[doc(hidden)] - pub __module_path: &'static str, - #[doc(hidden)] - pub __file: &'static str, - #[doc(hidden)] - pub __line: u32, -} - -impl LogLocation { - /// The module path of the message. - pub fn module_path(&self) -> &str { - self.__module_path - } - - /// The source file containing the message. - pub fn file(&self) -> &str { - self.__file - } - - /// The line containing the message. - pub fn line(&self) -> u32 { - self.__line - } -} - -/// A token providing read and write access to the global maximum log level -/// filter. -/// -/// The maximum log level is used as an optimization to avoid evaluating log -/// messages that will be ignored by the logger. Any message with a level -/// higher than the maximum log level filter will be ignored. A logger should -/// make sure to keep the maximum log level filter in sync with its current -/// configuration. -#[allow(missing_copy_implementations)] -pub struct MaxLogLevelFilter(()); - -impl fmt::Debug for MaxLogLevelFilter { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "MaxLogLevelFilter") - } -} - -impl MaxLogLevelFilter { - /// Gets the current maximum log level filter. - pub fn get(&self) -> LogLevelFilter { - max_log_level() - } - - /// Sets the maximum log level. - pub fn set(&self, level: LogLevelFilter) { - MAX_LOG_LEVEL_FILTER.store(level as usize, Ordering::SeqCst) - } +/// Generally, this should only be called by the active logging implementation. +#[inline] +pub fn set_max_level(level: LevelFilter) { + MAX_LOG_LEVEL_FILTER.store(level as usize, Ordering::SeqCst) } /// Returns the current maximum log level. /// -/// The `log!`, `error!`, `warn!`, `info!`, `debug!`, and `trace!` macros check +/// The [`log!`], [`error!`], [`warn!`], [`info!`], [`debug!`], and [`trace!`] macros check /// this value and discard any message logged at a higher level. The maximum -/// log level is set by the `MaxLogLevel` token passed to loggers. +/// log level is set by the [`set_max_level`] function. +/// +/// [`log!`]: macro.log.html +/// [`error!`]: macro.error.html +/// [`warn!`]: macro.warn.html +/// [`info!`]: macro.info.html +/// [`debug!`]: macro.debug.html +/// [`trace!`]: macro.trace.html +/// [`set_max_level`]: fn.set_max_level.html #[inline(always)] -pub fn max_log_level() -> LogLevelFilter { +pub fn max_level() -> LevelFilter { unsafe { mem::transmute(MAX_LOG_LEVEL_FILTER.load(Ordering::Relaxed)) } } -/// Sets the global logger. +/// Sets the global logger to a `Box`. /// -/// The `make_logger` closure is passed a `MaxLogLevel` object, which the -/// logger should use to keep the global maximum log level in sync with the -/// highest log level that the logger will not ignore. +/// This is a simple convenience wrapper over `set_logger`, which takes a +/// `Box` rather than a `&'static Log`. See the documentation for +/// [`set_logger`] for more details. +/// +/// Requires the `std` feature. +/// +/// # Errors +/// +/// An error is returned if a logger has already been set. +/// +/// [`set_logger`]: fn.set_logger.html +#[cfg(feature = "std")] +pub fn set_boxed_logger(logger: Box) -> Result<(), SetLoggerError> { + set_logger_inner(|| unsafe { &*Box::into_raw(logger) }) +} + +/// Sets the global logger to a `&'static Log`. /// /// This function may only be called once in the lifetime of a program. Any log -/// events that occur before the call to `set_logger` completes will be -/// ignored. +/// events that occur before the call to `set_logger` completes will be ignored. /// /// This function does not typically need to be called manually. Logger -/// implementations should provide an initialization method that calls -/// `set_logger` internally. +/// implementations should provide an initialization method that installs the +/// logger internally. /// -/// Requires the `use_std` feature (enabled by default). -#[cfg(feature = "use_std")] -pub fn set_logger(make_logger: M) -> Result<(), SetLoggerError> - where M: FnOnce(MaxLogLevelFilter) -> Box { - unsafe { set_logger_raw(|max_level| mem::transmute(make_logger(max_level))) } +/// # Errors +/// +/// An error is returned if a logger has already been set. +/// +/// # Examples +/// +/// ```rust +/// # #[macro_use] +/// # extern crate log; +/// # +/// use log::{Record, Level, Metadata, LevelFilter}; +/// +/// static MY_LOGGER: MyLogger = MyLogger; +/// +/// struct MyLogger; +/// +/// impl log::Log for MyLogger { +/// fn enabled(&self, metadata: &Metadata) -> bool { +/// metadata.level() <= Level::Info +/// } +/// +/// fn log(&self, record: &Record) { +/// if self.enabled(record.metadata()) { +/// println!("{} - {}", record.level(), record.args()); +/// } +/// } +/// fn flush(&self) {} +/// } +/// +/// # fn main(){ +/// log::set_logger(&MY_LOGGER).unwrap(); +/// log::set_max_level(LevelFilter::Info); +/// +/// info!("hello log"); +/// warn!("warning"); +/// error!("oops"); +/// # } +/// ``` +pub fn set_logger(logger: &'static Log) -> Result<(), SetLoggerError> { + set_logger_inner(|| logger) } -/// Sets the global logger from a raw pointer. -/// -/// This function is similar to `set_logger` except that it is usable in -/// `no_std` code. -/// -/// The `make_logger` closure is passed a `MaxLogLevel` object, which the -/// logger should use to keep the global maximum log level in sync with the -/// highest log level that the logger will not ignore. -/// -/// This function may only be called once in the lifetime of a program. Any log -/// events that occur before the call to `set_logger_raw` completes will be -/// ignored. -/// -/// This function does not typically need to be called manually. Logger -/// implementations should provide an initialization method that calls -/// `set_logger_raw` internally. -/// -/// # Safety -/// -/// The pointer returned by `make_logger` must remain valid for the entire -/// duration of the program or until `shutdown_logger_raw` is called. In -/// addition, `shutdown_logger` *must not* be called after this function. -pub unsafe fn set_logger_raw(make_logger: M) -> Result<(), SetLoggerError> - where M: FnOnce(MaxLogLevelFilter) -> *const Log { - if STATE.compare_and_swap(UNINITIALIZED, INITIALIZING, - Ordering::SeqCst) != UNINITIALIZED { - return Err(SetLoggerError(())); - } - - LOGGER = make_logger(MaxLogLevelFilter(())); - STATE.store(INITIALIZED, Ordering::SeqCst); - Ok(()) -} - -/// Shuts down the global logger. -/// -/// This function may only be called once in the lifetime of a program, and may -/// not be called before `set_logger`. Once the global logger has been shut -/// down, it can no longer be re-initialized by `set_logger`. Any log events -/// that occur after the call to `shutdown_logger` completes will be ignored. -/// -/// The logger that was originally created by the call to to `set_logger` is -/// returned on success. At that point it is guaranteed that no other threads -/// are concurrently accessing the logger object. -#[cfg(feature = "use_std")] -pub fn shutdown_logger() -> Result, ShutdownLoggerError> { - shutdown_logger_raw().map(|l| unsafe { mem::transmute(l) }) -} - -/// Shuts down the global logger. -/// -/// This function is similar to `shutdown_logger` except that it is usable in -/// `no_std` code. -/// -/// This function may only be called once in the lifetime of a program, and may -/// not be called before `set_logger_raw`. Once the global logger has been shut -/// down, it can no longer be re-initialized by `set_logger_raw`. Any log -/// events that occur after the call to `shutdown_logger_raw` completes will be -/// ignored. -/// -/// The pointer that was originally passed to `set_logger_raw` is returned on -/// success. At that point it is guaranteed that no other threads are -/// concurrently accessing the logger object. -pub fn shutdown_logger_raw() -> Result<*const Log, ShutdownLoggerError> { - // Set the global log level to stop other thread from logging - MAX_LOG_LEVEL_FILTER.store(0, Ordering::SeqCst); - - // Set to INITIALIZING to prevent re-initialization after - if STATE.compare_and_swap(INITIALIZED, INITIALIZING, - Ordering::SeqCst) != INITIALIZED { - return Err(ShutdownLoggerError(())); - } - - while REFCOUNT.load(Ordering::SeqCst) != 0 { - // FIXME add a sleep here when it doesn't involve timers - } - +fn set_logger_inner(make_logger: F) -> Result<(), SetLoggerError> +where + F: FnOnce() -> &'static Log +{ unsafe { - let logger = LOGGER; - LOGGER = &NopLogger; - Ok(logger) + if STATE.compare_and_swap(UNINITIALIZED, INITIALIZING, Ordering::SeqCst) != UNINITIALIZED { + return Err(SetLoggerError(())); + } + + LOGGER = make_logger(); + STATE.store(INITIALIZED, Ordering::SeqCst); + Ok(()) } } -/// The type returned by `set_logger` if `set_logger` has already been called. +/// The type returned by [`set_logger`] if [`set_logger`] has already been called. +/// +/// [`set_logger`]: fn.set_logger.html #[allow(missing_copy_implementations)] #[derive(Debug)] pub struct SetLoggerError(()); impl fmt::Display for SetLoggerError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "attempted to set a logger after the logging system \ - was already initialized") + fmt.write_str(SET_LOGGER_ERROR) } } // The Error trait is not available in libcore -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] impl error::Error for SetLoggerError { - fn description(&self) -> &str { "set_logger() called multiple times" } + fn description(&self) -> &str { + SET_LOGGER_ERROR + } } -/// The type returned by `shutdown_logger_raw` if `shutdown_logger_raw` has -/// already been called or if `set_logger_raw` has not been called yet. +/// The type returned by [`from_str`] when the string doesn't match any of the log levels. +/// +/// [`from_str`]: https://doc.rust-lang.org/std/str/trait.FromStr.html#tymethod.from_str #[allow(missing_copy_implementations)] -#[derive(Debug)] -pub struct ShutdownLoggerError(()); +#[derive(Debug, PartialEq)] +pub struct ParseLevelError(()); -impl fmt::Display for ShutdownLoggerError { +impl fmt::Display for ParseLevelError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "attempted to shut down the logger without an active logger") + fmt.write_str(LEVEL_PARSE_ERROR) } } // The Error trait is not available in libcore -#[cfg(feature = "use_std")] -impl error::Error for ShutdownLoggerError { - fn description(&self) -> &str { "shutdown_logger() called without an active logger" } +#[cfg(feature = "std")] +impl error::Error for ParseLevelError { + fn description(&self) -> &str { + LEVEL_PARSE_ERROR + } } -/// Deprecated +/// Returns a reference to the logger. /// -/// Use https://crates.io/crates/log-panics instead. -#[cfg(all(feature = "nightly", feature = "use_std"))] -pub fn log_panics() { - std::panic::set_hook(Box::new(panic::log)); -} - -// inner module so that the reporting module is log::panic instead of log -#[cfg(all(feature = "nightly", feature = "use_std"))] -mod panic { - use std::panic::PanicInfo; - use std::thread; - - pub fn log(info: &PanicInfo) { - let thread = thread::current(); - let thread = thread.name().unwrap_or(""); - - let msg = match info.payload().downcast_ref::<&'static str>() { - Some(s) => *s, - None => match info.payload().downcast_ref::() { - Some(s) => &s[..], - None => "Box", - } - }; - - match info.location() { - Some(location) => { - error!("thread '{}' panicked at '{}': {}:{}", - thread, - msg, - location.file(), - location.line()) - } - None => error!("thread '{}' panicked at '{}'", thread, msg), +/// If a logger has not been set, a no-op implementation is returned. +pub fn logger() -> &'static Log { + unsafe { + if STATE.load(Ordering::SeqCst) != INITIALIZED { + static NOP: NopLogger = NopLogger; + &NOP + } else { + LOGGER } } } -struct LoggerGuard(&'static Log); +/// The statically resolved maximum log level. +/// +/// See the crate level documentation for information on how to configure this. +/// +/// This value is checked by the log macros, but not by the `Log`ger returned by +/// the [`logger`] function. Code that manually calls functions on that value +/// should compare the level against this value. +/// +/// [`logger`]: fn.logger.html +pub const STATIC_MAX_LEVEL: LevelFilter = MAX_LEVEL_INNER; -impl Drop for LoggerGuard { - fn drop(&mut self) { - REFCOUNT.fetch_sub(1, Ordering::SeqCst); - } -} - -impl Deref for LoggerGuard { - type Target = Log; - - fn deref(&self) -> &(Log + 'static) { - self.0 - } -} - -fn logger() -> Option { - REFCOUNT.fetch_add(1, Ordering::SeqCst); - if STATE.load(Ordering::SeqCst) != INITIALIZED { - REFCOUNT.fetch_sub(1, Ordering::SeqCst); - None +cfg_if! { + if #[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Off; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Error; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Warn; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Info; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Debug; + } else if #[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Trace; + } else if #[cfg(feature = "max_level_off")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Off; + } else if #[cfg(feature = "max_level_error")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Error; + } else if #[cfg(feature = "max_level_warn")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Warn; + } else if #[cfg(feature = "max_level_info")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Info; + } else if #[cfg(feature = "max_level_debug")] { + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Debug; } else { - Some(LoggerGuard(unsafe { &*LOGGER })) - } -} - -// WARNING -// This is not considered part of the crate's public API. It is subject to -// change at any time. -#[doc(hidden)] -pub fn __enabled(level: LogLevel, target: &str) -> bool { - if let Some(logger) = logger() { - logger.enabled(&LogMetadata { level: level, target: target }) - } else { - false - } -} - -// WARNING -// This is not considered part of the crate's public API. It is subject to -// change at any time. -#[doc(hidden)] -pub fn __log(level: LogLevel, target: &str, loc: &LogLocation, - args: fmt::Arguments) { - if let Some(logger) = logger() { - let record = LogRecord { - metadata: LogMetadata { - level: level, - target: target, - }, - location: loc, - args: args - }; - logger.log(&record) - } -} - -// WARNING -// This is not considered part of the crate's public API. It is subject to -// change at any time. -#[inline(always)] -#[doc(hidden)] -pub fn __static_max_level() -> LogLevelFilter { - if !cfg!(debug_assertions) { - // This is a release build. Check `release_max_level_*` first. - if cfg!(feature = "release_max_level_off") { - return LogLevelFilter::Off - } else if cfg!(feature = "release_max_level_error") { - return LogLevelFilter::Error - } else if cfg!(feature = "release_max_level_warn") { - return LogLevelFilter::Warn - } else if cfg!(feature = "release_max_level_info") { - return LogLevelFilter::Info - } else if cfg!(feature = "release_max_level_debug") { - return LogLevelFilter::Debug - } else if cfg!(feature = "release_max_level_trace") { - return LogLevelFilter::Trace - } - } - if cfg!(feature = "max_level_off") { - LogLevelFilter::Off - } else if cfg!(feature = "max_level_error") { - LogLevelFilter::Error - } else if cfg!(feature = "max_level_warn") { - LogLevelFilter::Warn - } else if cfg!(feature = "max_level_info") { - LogLevelFilter::Info - } else if cfg!(feature = "max_level_debug") { - LogLevelFilter::Debug - } else { - LogLevelFilter::Trace + const MAX_LEVEL_INNER: LevelFilter = LevelFilter::Trace; } } #[cfg(test)] mod tests { - extern crate std; - use tests::std::string::ToString; - use super::{LogLevel, LogLevelFilter}; + extern crate std; + use tests::std::string::ToString; + use super::{Level, LevelFilter, ParseLevelError}; - #[test] - fn test_loglevelfilter_from_str() { - let tests = [ - ("off", Ok(LogLevelFilter::Off)), - ("error", Ok(LogLevelFilter::Error)), - ("warn", Ok(LogLevelFilter::Warn)), - ("info", Ok(LogLevelFilter::Info)), - ("debug", Ok(LogLevelFilter::Debug)), - ("trace", Ok(LogLevelFilter::Trace)), - ("OFF", Ok(LogLevelFilter::Off)), - ("ERROR", Ok(LogLevelFilter::Error)), - ("WARN", Ok(LogLevelFilter::Warn)), - ("INFO", Ok(LogLevelFilter::Info)), - ("DEBUG", Ok(LogLevelFilter::Debug)), - ("TRACE", Ok(LogLevelFilter::Trace)), - ("asdf", Err(())), - ]; - for &(s, ref expected) in &tests { - assert_eq!(expected, &s.parse()); - } - } + #[test] + fn test_levelfilter_from_str() { + let tests = [ + ("off", Ok(LevelFilter::Off)), + ("error", Ok(LevelFilter::Error)), + ("warn", Ok(LevelFilter::Warn)), + ("info", Ok(LevelFilter::Info)), + ("debug", Ok(LevelFilter::Debug)), + ("trace", Ok(LevelFilter::Trace)), + ("OFF", Ok(LevelFilter::Off)), + ("ERROR", Ok(LevelFilter::Error)), + ("WARN", Ok(LevelFilter::Warn)), + ("INFO", Ok(LevelFilter::Info)), + ("DEBUG", Ok(LevelFilter::Debug)), + ("TRACE", Ok(LevelFilter::Trace)), + ("asdf", Err(ParseLevelError(()))), + ]; + for &(s, ref expected) in &tests { + assert_eq!(expected, &s.parse()); + } + } - #[test] - fn test_loglevel_from_str() { - let tests = [ - ("OFF", Err(())), - ("error", Ok(LogLevel::Error)), - ("warn", Ok(LogLevel::Warn)), - ("info", Ok(LogLevel::Info)), - ("debug", Ok(LogLevel::Debug)), - ("trace", Ok(LogLevel::Trace)), - ("ERROR", Ok(LogLevel::Error)), - ("WARN", Ok(LogLevel::Warn)), - ("INFO", Ok(LogLevel::Info)), - ("DEBUG", Ok(LogLevel::Debug)), - ("TRACE", Ok(LogLevel::Trace)), - ("asdf", Err(())), - ]; - for &(s, ref expected) in &tests { - assert_eq!(expected, &s.parse()); - } - } + #[test] + fn test_level_from_str() { + let tests = [ + ("OFF", Err(ParseLevelError(()))), + ("error", Ok(Level::Error)), + ("warn", Ok(Level::Warn)), + ("info", Ok(Level::Info)), + ("debug", Ok(Level::Debug)), + ("trace", Ok(Level::Trace)), + ("ERROR", Ok(Level::Error)), + ("WARN", Ok(Level::Warn)), + ("INFO", Ok(Level::Info)), + ("DEBUG", Ok(Level::Debug)), + ("TRACE", Ok(Level::Trace)), + ("asdf", Err(ParseLevelError(()))), + ]; + for &(s, ref expected) in &tests { + assert_eq!(expected, &s.parse()); + } + } - #[test] - fn test_loglevel_show() { - assert_eq!("INFO", LogLevel::Info.to_string()); - assert_eq!("ERROR", LogLevel::Error.to_string()); - } + #[test] + fn test_level_show() { + assert_eq!("INFO", Level::Info.to_string()); + assert_eq!("ERROR", Level::Error.to_string()); + } - #[test] - fn test_loglevelfilter_show() { - assert_eq!("OFF", LogLevelFilter::Off.to_string()); - assert_eq!("ERROR", LogLevelFilter::Error.to_string()); - } + #[test] + fn test_levelfilter_show() { + assert_eq!("OFF", LevelFilter::Off.to_string()); + assert_eq!("ERROR", LevelFilter::Error.to_string()); + } - #[test] - fn test_cross_cmp() { - assert!(LogLevel::Debug > LogLevelFilter::Error); - assert!(LogLevelFilter::Warn < LogLevel::Trace); - assert!(LogLevelFilter::Off < LogLevel::Error); - } + #[test] + fn test_cross_cmp() { + assert!(Level::Debug > LevelFilter::Error); + assert!(LevelFilter::Warn < Level::Trace); + assert!(LevelFilter::Off < Level::Error); + } - #[test] - fn test_cross_eq() { - assert!(LogLevel::Error == LogLevelFilter::Error); - assert!(LogLevelFilter::Off != LogLevel::Error); - assert!(LogLevel::Trace == LogLevelFilter::Trace); - } + #[test] + fn test_cross_eq() { + assert!(Level::Error == LevelFilter::Error); + assert!(LevelFilter::Off != Level::Error); + assert!(Level::Trace == LevelFilter::Trace); + } - #[test] - fn test_to_log_level() { - assert_eq!(Some(LogLevel::Error), LogLevelFilter::Error.to_log_level()); - assert_eq!(None, LogLevelFilter::Off.to_log_level()); - assert_eq!(Some(LogLevel::Debug), LogLevelFilter::Debug.to_log_level()); - } + #[test] + fn test_to_level() { + assert_eq!(Some(Level::Error), LevelFilter::Error.to_level()); + assert_eq!(None, LevelFilter::Off.to_level()); + assert_eq!(Some(Level::Debug), LevelFilter::Debug.to_level()); + } - #[test] - fn test_to_log_level_filter() { - assert_eq!(LogLevelFilter::Error, LogLevel::Error.to_log_level_filter()); - assert_eq!(LogLevelFilter::Trace, LogLevel::Trace.to_log_level_filter()); - } + #[test] + fn test_to_level_filter() { + assert_eq!(LevelFilter::Error, Level::Error.to_level_filter()); + assert_eq!(LevelFilter::Trace, Level::Trace.to_level_filter()); + } - #[test] - #[cfg(feature = "use_std")] - fn test_error_trait() { - use std::error::Error; - use super::SetLoggerError; - let e = SetLoggerError(()); - assert_eq!(e.description(), "set_logger() called multiple times"); - } + #[test] + #[cfg(feature = "std")] + fn test_error_trait() { + use std::error::Error; + use super::SetLoggerError; + let e = SetLoggerError(()); + assert_eq!( + e.description(), + "attempted to set a logger after the logging system \ + was already initialized" + ); + } + + #[test] + fn test_metadata_builder() { + use super::MetadataBuilder; + let target = "myApp"; + let metadata_test = MetadataBuilder::new() + .level(Level::Debug) + .target(target) + .build(); + assert_eq!(metadata_test.level(), Level::Debug); + assert_eq!(metadata_test.target(), "myApp"); + } + + #[test] + fn test_metadata_convenience_builder() { + use super::Metadata; + let target = "myApp"; + let metadata_test = Metadata::builder() + .level(Level::Debug) + .target(target) + .build(); + assert_eq!(metadata_test.level(), Level::Debug); + assert_eq!(metadata_test.target(), "myApp"); + } + + #[test] + fn test_record_builder() { + use super::{MetadataBuilder, RecordBuilder}; + let target = "myApp"; + let metadata = MetadataBuilder::new().target(target).build(); + let fmt_args = format_args!("hello"); + let record_test = RecordBuilder::new() + .args(fmt_args) + .metadata(metadata) + .module_path(Some("foo")) + .file(Some("bar")) + .line(Some(30)) + .build(); + assert_eq!(record_test.metadata().target(), "myApp"); + assert_eq!(record_test.module_path(), Some("foo")); + assert_eq!(record_test.file(), Some("bar")); + assert_eq!(record_test.line(), Some(30)); + } + + #[test] + fn test_record_convenience_builder() { + use super::{Metadata, Record}; + let target = "myApp"; + let metadata = Metadata::builder().target(target).build(); + let fmt_args = format_args!("hello"); + let record_test = Record::builder() + .args(fmt_args) + .metadata(metadata) + .module_path(Some("foo")) + .file(Some("bar")) + .line(Some(30)) + .build(); + assert_eq!(record_test.target(), "myApp"); + assert_eq!(record_test.module_path(), Some("foo")); + assert_eq!(record_test.file(), Some("bar")); + assert_eq!(record_test.line(), Some(30)); + } + + #[test] + fn test_record_complete_builder() { + use super::{Record, Level}; + let target = "myApp"; + let record_test = Record::builder() + .module_path(Some("foo")) + .file(Some("bar")) + .line(Some(30)) + .target(target) + .level(Level::Error) + .build(); + assert_eq!(record_test.target(), "myApp"); + assert_eq!(record_test.level(), Level::Error); + assert_eq!(record_test.module_path(), Some("foo")); + assert_eq!(record_test.file(), Some("bar")); + assert_eq!(record_test.line(), Some(30)); + } } diff --git a/src/vendor/log/src/macros.rs b/src/vendor/log/src/macros.rs index f9a7788d2e..25f697f753 100644 --- a/src/vendor/log/src/macros.rs +++ b/src/vendor/log/src/macros.rs @@ -7,41 +7,44 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. + /// The standard logging macro. /// -/// This macro will generically log with the specified `LogLevel` and `format!` +/// This macro will generically log with the specified `Level` and `format!` /// based argument list. /// -/// The `max_level_*` features can be used to statically disable logging at -/// various levels. -/// /// # Examples /// /// ```rust /// # #[macro_use] /// # extern crate log; -/// use log::LogLevel; +/// use log::Level; /// /// # fn main() { /// let data = (42, "Forty-two"); /// let private_data = "private"; /// -/// log!(LogLevel::Error, "Received errors: {}, {}", data.0, data.1); -/// log!(target: "app_events", LogLevel::Warn, "App warning: {}, {}, {}", +/// log!(Level::Error, "Received errors: {}, {}", data.0, data.1); +/// log!(target: "app_events", Level::Warn, "App warning: {}, {}, {}", /// data.0, data.1, private_data); /// # } /// ``` #[macro_export] macro_rules! log { (target: $target:expr, $lvl:expr, $($arg:tt)+) => ({ - static _LOC: $crate::LogLocation = $crate::LogLocation { - __line: line!(), - __file: file!(), - __module_path: module_path!(), - }; let lvl = $lvl; - if lvl <= $crate::__static_max_level() && lvl <= $crate::max_log_level() { - $crate::__log(lvl, $target, &_LOC, format_args!($($arg)+)) + if lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() { + $crate::Log::log( + $crate::logger(), + &$crate::RecordBuilder::new() + .args(format_args!($($arg)+)) + .level(lvl) + .target($target) + .module_path(Some(module_path!())) + .file(Some(file!())) + .line(Some(line!())) + .build() + ) } }); ($lvl:expr, $($arg:tt)+) => (log!(target: module_path!(), $lvl, $($arg)+)) @@ -49,8 +52,6 @@ macro_rules! log { /// Logs a message at the error level. /// -/// Logging at this level is disabled if the `max_level_off` feature is present. -/// /// # Examples /// /// ```rust @@ -66,22 +67,15 @@ macro_rules! log { #[macro_export] macro_rules! error { (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::LogLevel::Error, $($arg)*); + log!(target: $target, $crate::Level::Error, $($arg)*); ); ($($arg:tt)*) => ( - log!($crate::LogLevel::Error, $($arg)*); + log!($crate::Level::Error, $($arg)*); ) } /// Logs a message at the warn level. /// -/// Logging at this level is disabled if any of the following features are -/// present: `max_level_off` or `max_level_error`. -/// -/// When building in release mode (i.e., without the `debug_assertions` option), -/// logging at this level is also disabled if any of the following features are -/// present: `release_max_level_off` or `max_level_error`. -/// /// # Examples /// /// ```rust @@ -97,23 +91,15 @@ macro_rules! error { #[macro_export] macro_rules! warn { (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::LogLevel::Warn, $($arg)*); + log!(target: $target, $crate::Level::Warn, $($arg)*); ); ($($arg:tt)*) => ( - log!($crate::LogLevel::Warn, $($arg)*); + log!($crate::Level::Warn, $($arg)*); ) } /// Logs a message at the info level. /// -/// Logging at this level is disabled if any of the following features are -/// present: `max_level_off`, `max_level_error`, or `max_level_warn`. -/// -/// When building in release mode (i.e., without the `debug_assertions` option), -/// logging at this level is also disabled if any of the following features are -/// present: `release_max_level_off`, `release_max_level_error`, or -/// `release_max_level_warn`. -/// /// # Examples /// /// ```rust @@ -131,24 +117,15 @@ macro_rules! warn { #[macro_export] macro_rules! info { (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::LogLevel::Info, $($arg)*); + log!(target: $target, $crate::Level::Info, $($arg)*); ); ($($arg:tt)*) => ( - log!($crate::LogLevel::Info, $($arg)*); + log!($crate::Level::Info, $($arg)*); ) } /// Logs a message at the debug level. /// -/// Logging at this level is disabled if any of the following features are -/// present: `max_level_off`, `max_level_error`, `max_level_warn`, or -/// `max_level_info`. -/// -/// When building in release mode (i.e., without the `debug_assertions` option), -/// logging at this level is also disabled if any of the following features are -/// present: `release_max_level_off`, `release_max_level_error`, -/// `release_max_level_warn`, or `release_max_level_info`. -/// /// # Examples /// /// ```rust @@ -165,25 +142,15 @@ macro_rules! info { #[macro_export] macro_rules! debug { (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::LogLevel::Debug, $($arg)*); + log!(target: $target, $crate::Level::Debug, $($arg)*); ); ($($arg:tt)*) => ( - log!($crate::LogLevel::Debug, $($arg)*); + log!($crate::Level::Debug, $($arg)*); ) } /// Logs a message at the trace level. /// -/// Logging at this level is disabled if any of the following features are -/// present: `max_level_off`, `max_level_error`, `max_level_warn`, -/// `max_level_info`, or `max_level_debug`. -/// -/// When building in release mode (i.e., without the `debug_assertions` option), -/// logging at this level is also disabled if any of the following features are -/// present: `release_max_level_off`, `release_max_level_error`, -/// `release_max_level_warn`, `release_max_level_info`, or -/// `release_max_level_debug`. -/// /// # Examples /// /// ```rust @@ -202,10 +169,10 @@ macro_rules! debug { #[macro_export] macro_rules! trace { (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::LogLevel::Trace, $($arg)*); + log!(target: $target, $crate::Level::Trace, $($arg)*); ); ($($arg:tt)*) => ( - log!($crate::LogLevel::Trace, $($arg)*); + log!($crate::Level::Trace, $($arg)*); ) } @@ -220,13 +187,17 @@ macro_rules! trace { /// ```rust /// # #[macro_use] /// # extern crate log; -/// use log::LogLevel::Debug; +/// use log::Level::Debug; /// /// # fn foo() { /// if log_enabled!(Debug) { /// let data = expensive_call(); /// debug!("expensive debug data: {} {}", data.x, data.y); /// } +/// if log_enabled!(target: "Global", Debug) { +/// let data = expensive_call(); +/// debug!(target: "Global", "expensive debug data: {} {}", data.x, data.y); +/// } /// # } /// # struct Data { x: u32, y: u32 } /// # fn expensive_call() -> Data { Data { x: 0, y: 0 } } @@ -236,8 +207,14 @@ macro_rules! trace { macro_rules! log_enabled { (target: $target:expr, $lvl:expr) => ({ let lvl = $lvl; - lvl <= $crate::__static_max_level() && lvl <= $crate::max_log_level() && - $crate::__enabled(lvl, $target) + lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() && + $crate::Log::enabled( + $crate::logger(), + &$crate::MetadataBuilder::new() + .level(lvl) + .target($target) + .build(), + ) }); ($lvl:expr) => (log_enabled!(target: module_path!(), $lvl)) } diff --git a/src/vendor/log/src/serde.rs b/src/vendor/log/src/serde.rs new file mode 100644 index 0000000000..4b9afa55da --- /dev/null +++ b/src/vendor/log/src/serde.rs @@ -0,0 +1,258 @@ +#![cfg(feature = "serde")] + +extern crate serde; +use self::serde::ser::{Serialize, Serializer}; +use self::serde::de::{Deserialize, DeserializeSeed, Deserializer, Visitor, EnumAccess, + VariantAccess, Error}; + +use {Level, LevelFilter, LOG_LEVEL_NAMES}; + +use std::fmt; +use std::str::FromStr; + +// The Deserialize impls are handwritten to be case insensitive using FromStr. + +impl Serialize for Level { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + Level::Error => serializer.serialize_unit_variant("Level", 0, "ERROR"), + Level::Warn => serializer.serialize_unit_variant("Level", 1, "WARN"), + Level::Info => serializer.serialize_unit_variant("Level", 2, "INFO"), + Level::Debug => serializer.serialize_unit_variant("Level", 3, "DEBUG"), + Level::Trace => serializer.serialize_unit_variant("Level", 4, "TRACE"), + } + } +} + +impl<'de> Deserialize<'de> for Level { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LevelIdentifier; + + impl<'de> Visitor<'de> for LevelIdentifier { + type Value = Level; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("log level") + } + + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + // Case insensitive. + FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES[1..])) + } + } + + impl<'de> DeserializeSeed<'de> for LevelIdentifier { + type Value = Level; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_identifier(LevelIdentifier) + } + } + + struct LevelEnum; + + impl<'de> Visitor<'de> for LevelEnum { + type Value = Level; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("log level") + } + + fn visit_enum(self, value: A) -> Result + where + A: EnumAccess<'de>, + { + let (level, variant) = value.variant_seed(LevelIdentifier)?; + // Every variant is a unit variant. + variant.unit_variant()?; + Ok(level) + } + } + + deserializer.deserialize_enum("Level", &LOG_LEVEL_NAMES[1..], LevelEnum) + } +} + +impl Serialize for LevelFilter { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + LevelFilter::Off => serializer.serialize_unit_variant("LevelFilter", 0, "OFF"), + LevelFilter::Error => serializer.serialize_unit_variant("LevelFilter", 1, "ERROR"), + LevelFilter::Warn => serializer.serialize_unit_variant("LevelFilter", 2, "WARN"), + LevelFilter::Info => serializer.serialize_unit_variant("LevelFilter", 3, "INFO"), + LevelFilter::Debug => serializer.serialize_unit_variant("LevelFilter", 4, "DEBUG"), + LevelFilter::Trace => serializer.serialize_unit_variant("LevelFilter", 5, "TRACE"), + } + } +} + +impl<'de> Deserialize<'de> for LevelFilter { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LevelFilterIdentifier; + + impl<'de> Visitor<'de> for LevelFilterIdentifier { + type Value = LevelFilter; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("log level filter") + } + + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + // Case insensitive. + FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES)) + } + } + + impl<'de> DeserializeSeed<'de> for LevelFilterIdentifier { + type Value = LevelFilter; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_identifier(LevelFilterIdentifier) + } + } + + struct LevelFilterEnum; + + impl<'de> Visitor<'de> for LevelFilterEnum { + type Value = LevelFilter; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("log level filter") + } + + fn visit_enum(self, value: A) -> Result + where + A: EnumAccess<'de>, + { + let (level_filter, variant) = value.variant_seed(LevelFilterIdentifier)?; + // Every variant is a unit variant. + variant.unit_variant()?; + Ok(level_filter) + } + } + + deserializer.deserialize_enum("LevelFilter", &LOG_LEVEL_NAMES, LevelFilterEnum) + } +} + +#[cfg(test)] +mod tests { + extern crate serde_test; + use self::serde_test::{Token, assert_tokens, assert_de_tokens, assert_de_tokens_error}; + + use {Level, LevelFilter}; + + fn level_token(variant: &'static str) -> Token { + Token::UnitVariant { + name: "Level", + variant: variant, + } + } + + fn level_filter_token(variant: &'static str) -> Token { + Token::UnitVariant { + name: "LevelFilter", + variant: variant, + } + } + + #[test] + fn test_level_ser_de() { + let cases = [ + (Level::Error, [level_token("ERROR")]), + (Level::Warn, [level_token("WARN")]), + (Level::Info, [level_token("INFO")]), + (Level::Debug, [level_token("DEBUG")]), + (Level::Trace, [level_token("TRACE")]), + ]; + + for &(s, expected) in &cases { + assert_tokens(&s, &expected); + } + } + + #[test] + fn test_level_case_insensitive() { + let cases = [ + (Level::Error, [level_token("error")]), + (Level::Warn, [level_token("warn")]), + (Level::Info, [level_token("info")]), + (Level::Debug, [level_token("debug")]), + (Level::Trace, [level_token("trace")]), + ]; + + for &(s, expected) in &cases { + assert_de_tokens(&s, &expected); + } + } + + #[test] + fn test_level_de_error() { + let msg = "unknown variant `errorx`, expected one of \ + `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`"; + assert_de_tokens_error::(&[level_token("errorx")], msg); + } + + #[test] + fn test_level_filter_ser_de() { + let cases = [ + (LevelFilter::Off, [level_filter_token("OFF")]), + (LevelFilter::Error, [level_filter_token("ERROR")]), + (LevelFilter::Warn, [level_filter_token("WARN")]), + (LevelFilter::Info, [level_filter_token("INFO")]), + (LevelFilter::Debug, [level_filter_token("DEBUG")]), + (LevelFilter::Trace, [level_filter_token("TRACE")]), + ]; + + for &(s, expected) in &cases { + assert_tokens(&s, &expected); + } + } + + #[test] + fn test_level_filter_case_insensitive() { + let cases = [ + (LevelFilter::Off, [level_filter_token("off")]), + (LevelFilter::Error, [level_filter_token("error")]), + (LevelFilter::Warn, [level_filter_token("warn")]), + (LevelFilter::Info, [level_filter_token("info")]), + (LevelFilter::Debug, [level_filter_token("debug")]), + (LevelFilter::Trace, [level_filter_token("trace")]), + ]; + + for &(s, expected) in &cases { + assert_de_tokens(&s, &expected); + } + } + + #[test] + fn test_level_filter_de_error() { + let msg = "unknown variant `errorx`, expected one of \ + `OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`"; + assert_de_tokens_error::(&[level_filter_token("errorx")], msg); + } +} diff --git a/src/vendor/log/tests/filters.rs b/src/vendor/log/tests/filters.rs index e08d46db19..84449ccfe8 100644 --- a/src/vendor/log/tests/filters.rs +++ b/src/vendor/log/tests/filters.rs @@ -1,76 +1,66 @@ -#[macro_use] extern crate log; +#[macro_use] +extern crate log; use std::sync::{Arc, Mutex}; -use log::{LogLevel, LogLevelFilter, Log, LogRecord, LogMetadata}; -use log::MaxLogLevelFilter; +use log::{Level, LevelFilter, Log, Record, Metadata}; -#[cfg(feature = "use_std")] -use log::set_logger; -#[cfg(not(feature = "use_std"))] -fn set_logger(make_logger: M) -> Result<(), log::SetLoggerError> - where M: FnOnce(MaxLogLevelFilter) -> Box { - unsafe { - log::set_logger_raw(|x| std::mem::transmute(make_logger(x))) - } +#[cfg(feature = "std")] +use log::set_boxed_logger; + +#[cfg(not(feature = "std"))] +fn set_boxed_logger(logger: Box) -> Result<(), log::SetLoggerError> { + log::set_logger(unsafe { &*Box::into_raw(logger) }) } struct State { - last_log: Mutex>, - filter: MaxLogLevelFilter, + last_log: Mutex>, } struct Logger(Arc); impl Log for Logger { - fn enabled(&self, _: &LogMetadata) -> bool { + fn enabled(&self, _: &Metadata) -> bool { true } - fn log(&self, record: &LogRecord) { + fn log(&self, record: &Record) { *self.0.last_log.lock().unwrap() = Some(record.level()); } + fn flush(&self) {} } fn main() { - let mut a = None; - set_logger(|max| { - let me = Arc::new(State { - last_log: Mutex::new(None), - filter: max, - }); - a = Some(me.clone()); - Box::new(Logger(me)) - }).unwrap(); - let a = a.unwrap(); + let me = Arc::new(State { last_log: Mutex::new(None) }); + let a = me.clone(); + set_boxed_logger(Box::new(Logger(me))).unwrap(); - test(&a, LogLevelFilter::Off); - test(&a, LogLevelFilter::Error); - test(&a, LogLevelFilter::Warn); - test(&a, LogLevelFilter::Info); - test(&a, LogLevelFilter::Debug); - test(&a, LogLevelFilter::Trace); + test(&a, LevelFilter::Off); + test(&a, LevelFilter::Error); + test(&a, LevelFilter::Warn); + test(&a, LevelFilter::Info); + test(&a, LevelFilter::Debug); + test(&a, LevelFilter::Trace); } -fn test(a: &State, filter: LogLevelFilter) { - a.filter.set(filter); +fn test(a: &State, filter: LevelFilter) { + log::set_max_level(filter); error!(""); - last(&a, t(LogLevel::Error, filter)); + last(&a, t(Level::Error, filter)); warn!(""); - last(&a, t(LogLevel::Warn, filter)); + last(&a, t(Level::Warn, filter)); info!(""); - last(&a, t(LogLevel::Info, filter)); + last(&a, t(Level::Info, filter)); debug!(""); - last(&a, t(LogLevel::Debug, filter)); + last(&a, t(Level::Debug, filter)); trace!(""); - last(&a, t(LogLevel::Trace, filter)); + last(&a, t(Level::Trace, filter)); - fn t(lvl: LogLevel, filter: LogLevelFilter) -> Option { - if lvl <= filter {Some(lvl)} else {None} + fn t(lvl: Level, filter: LevelFilter) -> Option { + if lvl <= filter { Some(lvl) } else { None } } } -fn last(state: &State, expected: Option) { - let mut lvl = state.last_log.lock().unwrap(); - assert_eq!(*lvl, expected); - *lvl = None; +fn last(state: &State, expected: Option) { + let lvl = state.last_log.lock().unwrap().take(); + assert_eq!(lvl, expected); } diff --git a/src/vendor/log_settings/.cargo-checksum.json b/src/vendor/log_settings/.cargo-checksum.json new file mode 100644 index 0000000000..a60131d4ce --- /dev/null +++ b/src/vendor/log_settings/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805","Cargo.toml":"3829bea94a7246bb3d46448fcd408b7caca18362e601e2abaee3ae2f664d5e99","src/lib.rs":"54cf663751972633fe1fc5740faf325482d3b0167ccbb396ab7e88f8da3bbddc","tests/smoke.rs":"d5eff5887ab0f15968b44f1f6de3881200a3b5bca910ff77ee7603b52589128c"},"package":"3d382732ea0fbc09790c4899db3255bdea0fc78b54bf234bd18a63bb603915b6"} \ No newline at end of file diff --git a/src/vendor/log_settings/.cargo-ok b/src/vendor/log_settings/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/log_settings/.gitignore b/src/vendor/log_settings/.gitignore new file mode 100644 index 0000000000..a9d37c560c --- /dev/null +++ b/src/vendor/log_settings/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/src/vendor/log_settings/Cargo.toml b/src/vendor/log_settings/Cargo.toml new file mode 100644 index 0000000000..39ec96af2b --- /dev/null +++ b/src/vendor/log_settings/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "log_settings" +version = "0.1.1" +authors = ["Oliver Schneider "] +license = "MIT" +description = "a tiny crate allowing libraries to change logger settings" +keywords = ["log", "settings"] +repository = "https://github.com/oli-obk/log_settings" + +[dependencies] +lazy_static = "0.2.1" diff --git a/src/vendor/log_settings/src/lib.rs b/src/vendor/log_settings/src/lib.rs new file mode 100644 index 0000000000..e61142cbb1 --- /dev/null +++ b/src/vendor/log_settings/src/lib.rs @@ -0,0 +1,70 @@ +//! This crate enables libraries that use the `log` crate (or an equivalent) to communicate with +//! the actual logger, without requiring the library to know about the type of logger that is used. +//! The crate +//! +//! # On the library side +//! +//! You can set a value by accessing the `Settings` struct through the `settings` function. +//! +//! ```rust +//! extern crate log_settings; +//! log_settings::settings().indentation += 1; +//! ``` +//! +//! # On the executable side +//! +//! You can read a value by accessing the `Settings` struct through the `settings` function. +//! +//! ```rust +//! #[macro_use] extern crate log; +//! extern crate env_logger; +//! extern crate log_settings; +//! +//! use std::env; +//! use log::{LogRecord, LogLevelFilter}; +//! use env_logger::LogBuilder; +//! +//! fn main() { +//! let format = |record: &LogRecord| { +//! // prepend spaces to indent the final string +//! let indentation = log_settings::settings().indentation; +//! let spaces = " "; +//! let indentation = s[..std::cmp::max(indentation, spaces.len())]; +//! format!("{}{} - {}", indentation, record.level(), record.args()) +//! }; +//! +//! let mut builder = LogBuilder::new(); +//! builder.format(format).filter(None, LogLevelFilter::Info); +//! +//! if env::var("RUST_LOG").is_ok() { +//! builder.parse(&env::var("RUST_LOG").unwrap()); +//! } +//! +//! builder.init().unwrap(); +//! } +//! ``` + +#[macro_use] extern crate lazy_static; + +use std::sync::{Mutex, MutexGuard}; + +lazy_static! { + static ref SETTINGS: Mutex = Mutex::new(Settings{ + indentation: 0, + __dont_match_on_this: (), + }); +} + +/// Contains various settings that libraries might want to set to notify loggers that also use this +/// crate of internal library states +pub struct Settings { + /// sets the indentation level of the log messages + pub indentation: usize, + // prevents users from destructuring or creating a Settings struct + __dont_match_on_this: (), +} + +/// obtains a handle to the internal settings struct +pub fn settings<'a>() -> MutexGuard<'a, Settings> { + SETTINGS.lock().expect("the global setting mutex has been poisoned") +} diff --git a/src/vendor/log_settings/tests/smoke.rs b/src/vendor/log_settings/tests/smoke.rs new file mode 100644 index 0000000000..145a994f33 --- /dev/null +++ b/src/vendor/log_settings/tests/smoke.rs @@ -0,0 +1,20 @@ +extern crate log_settings; + +#[test] +fn smoke() { + log_settings::settings().indentation = 5; +} + +#[test] +fn set_get() { + { + log_settings::settings().indentation = 6; + } + assert_eq!(log_settings::settings().indentation, 6); +} + +#[test] +fn set_get2() { + log_settings::settings().indentation = 42; + assert_eq!(log_settings::settings().indentation, 42); +} diff --git a/src/vendor/markup5ever/.cargo-checksum.json b/src/vendor/markup5ever/.cargo-checksum.json index 3f50fafaeb..8ca6ef316b 100644 --- a/src/vendor/markup5ever/.cargo-checksum.json +++ b/src/vendor/markup5ever/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"adf854be884a3adef56cbe8fe4195c005f9c2c7f8193da8a505cb120aa85d89f","Cargo.toml.orig":"d86f3727c0dee64add953a6bb0c50b760d816804ea6d6dd18fd23b4c71fa7214","build.rs":"a24279fd42194de0344249fd3c9546b9af9f4d72b3794910540d8e226bb20a10","data/entities.json":"3d029331b82668ac319bc81802de45b24396df76816d9ba6cf8807c0a1e59a29","data/mod.rs":"9e1c6fd0a8d0c2754275866ccb055ef9f96426e57e1a335e2c28bda1567aabe6","interface/mod.rs":"c3f2ad922211a33974f45148b836a55d225e5aa56748aec917cf65f78302c670","interface/tree_builder.rs":"726d7e4d11f76c6126d3bb54ff22d0cb59d91fb5f5bb59e4449c92d86e7e8322","lib.rs":"d8f235719b33bb6e951207c1345d7273b5637098b14a05887e84140269d59c07","local_names.txt":"3cd210c521a5c40f3550d330cbdb9db4eb4faf09938d01474e49f07decf64072","rcdom.rs":"7c2a57940562ba2a914c37a516d8fca97f341f2f8516402b413e828f7b321830","serialize.rs":"268e8b3a5430c8e74236e25fef21027a735bc5c23d3e5c6781e4421c6ff40ec0","util/buffer_queue.rs":"be2d05f72246351639887ce4649baf63586c4f4edcb1d7a47970f18b26430c48","util/smallcharset.rs":"0950bdf60873e5930c9f2f98bf6bc5939593a9c79703564cb3d7b53887802d11"},"package":"ff834ac7123c6a37826747e5ca09db41fd7a83126792021c2e636ad174bb77d3"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"f3d6904d067c49729595496a61df0ca30be4b4e74c7ae18bb5c636cafedfbe8b","Cargo.toml.orig":"a34a316d7f191f13c4c1ca8f932281884dd759fc099bb46d53fb9ef210bca82d","build.rs":"a24279fd42194de0344249fd3c9546b9af9f4d72b3794910540d8e226bb20a10","data/entities.json":"3d029331b82668ac319bc81802de45b24396df76816d9ba6cf8807c0a1e59a29","data/mod.rs":"9e1c6fd0a8d0c2754275866ccb055ef9f96426e57e1a335e2c28bda1567aabe6","interface/mod.rs":"c3f2ad922211a33974f45148b836a55d225e5aa56748aec917cf65f78302c670","interface/tree_builder.rs":"7c1b81405e8ab52a100a61ea8e8c58fdab20dc9d08d1d4ca03ed6e9a3e7c2b52","lib.rs":"d8f235719b33bb6e951207c1345d7273b5637098b14a05887e84140269d59c07","local_names.txt":"3cd210c521a5c40f3550d330cbdb9db4eb4faf09938d01474e49f07decf64072","rcdom.rs":"500abb11d9e28a5a8ac8ef67b5c95e0954c3a79d025c6c7d673703e9714b8dda","serialize.rs":"6ba656313da89482b17f0a36f48a5079e716ed551339033a60db25ff0d2c16d7","util/buffer_queue.rs":"be2d05f72246351639887ce4649baf63586c4f4edcb1d7a47970f18b26430c48","util/smallcharset.rs":"0950bdf60873e5930c9f2f98bf6bc5939593a9c79703564cb3d7b53887802d11"},"package":"047150a0e03b57e638fc45af33a0b63a0362305d5b9f92ecef81df472a4cceb0"} \ No newline at end of file diff --git a/src/vendor/markup5ever/Cargo.toml b/src/vendor/markup5ever/Cargo.toml index 2e46500cc1..94b32fb94d 100644 --- a/src/vendor/markup5ever/Cargo.toml +++ b/src/vendor/markup5ever/Cargo.toml @@ -12,16 +12,21 @@ [package] name = "markup5ever" -version = "0.3.2" +version = "0.5.0" authors = ["The html5ever Project Developers"] build = "build.rs" description = "Common code for xml5ever and html5ever" documentation = "https://docs.rs/markup5ever" +categories = ["parser-implementations", "web-programming"] license = "MIT / Apache-2.0" repository = "https://github.com/servo/html5ever" [lib] path = "lib.rs" +[dependencies.heapsize_derive] +version = "0.1" +optional = true + [dependencies.phf] version = "0.7" @@ -29,24 +34,19 @@ version = "0.7" version = ">= 0.3, < 0.5" optional = true -[dependencies.tendril] -version = "0.3.1" - -[dependencies.heapsize_derive] -version = "0.1" -optional = true - [dependencies.string_cache] version = "0.6" -[build-dependencies.string_cache_codegen] -version = "0.4" +[dependencies.tendril] +version = "0.4" [build-dependencies.phf_codegen] version = "0.7.3" +[build-dependencies.string_cache_codegen] +version = "0.4" + [build-dependencies.rustc-serialize] version = "0.3.15" [features] -unstable = [] heap_size = ["heapsize", "heapsize_derive", "string_cache/heapsize"] diff --git a/src/vendor/markup5ever/Cargo.toml.orig b/src/vendor/markup5ever/Cargo.toml.orig index b7951645af..1171eebda7 100644 --- a/src/vendor/markup5ever/Cargo.toml.orig +++ b/src/vendor/markup5ever/Cargo.toml.orig @@ -1,24 +1,24 @@ [package] name = "markup5ever" -version = "0.3.2" # At next breaking change: also remove the "unstable" feature, now a no-op; update tendril to 0.4 +version = "0.5.0" authors = [ "The html5ever Project Developers" ] license = "MIT / Apache-2.0" repository = "https://github.com/servo/html5ever" description = "Common code for xml5ever and html5ever" documentation = "https://docs.rs/markup5ever" build = "build.rs" +categories = [ "parser-implementations", "web-programming" ] [lib] path = "lib.rs" [features] heap_size = ["heapsize", "heapsize_derive", "string_cache/heapsize"] -unstable = [] [dependencies] string_cache = "0.6" phf = "0.7" -tendril = "0.3.1" +tendril = "0.4" heapsize = { version = ">= 0.3, < 0.5", optional = true } heapsize_derive = { version = "0.1", optional = true } diff --git a/src/vendor/markup5ever/interface/tree_builder.rs b/src/vendor/markup5ever/interface/tree_builder.rs index dd690e18dd..af240aacba 100644 --- a/src/vendor/markup5ever/interface/tree_builder.rs +++ b/src/vendor/markup5ever/interface/tree_builder.rs @@ -140,6 +140,14 @@ pub trait TreeSink { /// The child node will not already have a parent. fn append(&mut self, parent: &Self::Handle, child: NodeOrText); + /// When the insertion point is decided by the existence of a parent node of the + /// element, we consider both possibilities and send the element which will be used + /// if a parent node exists, along with the element to be used if there isn't one. + fn append_based_on_parent_node(&mut self, + element: &Self::Handle, + prev_element: &Self::Handle, + child: NodeOrText); + /// Append a `DOCTYPE` element to the `Document` node. fn append_doctype_to_document(&mut self, name: StrTendril, @@ -188,7 +196,10 @@ pub trait TreeSink { fn add_attrs_if_missing(&mut self, target: &Self::Handle, attrs: Vec); /// Associate the given form-associatable element with the form element - fn associate_with_form(&mut self, _target: &Self::Handle, _form: &Self::Handle) {} + fn associate_with_form(&mut self, + _target: &Self::Handle, + _form: &Self::Handle, + _nodes: (&Self::Handle, Option<&Self::Handle>)) {} /// Detach the given node from its parent. fn remove_from_parent(&mut self, target: &Self::Handle); diff --git a/src/vendor/markup5ever/rcdom.rs b/src/vendor/markup5ever/rcdom.rs index 84fb4fe17a..d93449b428 100644 --- a/src/vendor/markup5ever/rcdom.rs +++ b/src/vendor/markup5ever/rcdom.rs @@ -265,6 +265,18 @@ impl TreeSink for RcDom { parent.children.borrow_mut().insert(i, child); } + fn append_based_on_parent_node(&mut self, + element: &Self::Handle, + prev_element: &Self::Handle, + child: NodeOrText) { + + if self.has_parent_node(element) { + self.append_before_sibling(element, child); + } else { + self.append(prev_element, child); + } + } + fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril, @@ -326,7 +338,7 @@ impl Default for RcDom { impl Serialize for Handle { fn serialize(&self, serializer: &mut S, traversal_scope: TraversalScope) -> io::Result<()> where S: Serializer { - match (traversal_scope, &self.data) { + match (&traversal_scope, &self.data) { (_, &NodeData::Element { ref name, ref attrs, .. }) => { if traversal_scope == IncludeNode { try!(serializer.start_elem(name.clone(), @@ -343,28 +355,28 @@ impl Serialize for Handle { Ok(()) } - (ChildrenOnly, &NodeData::Document) => { + (&ChildrenOnly(_), &NodeData::Document) => { for handle in self.children.borrow().iter() { try!(handle.clone().serialize(serializer, IncludeNode)); } Ok(()) } - (ChildrenOnly, _) => Ok(()), + (&ChildrenOnly(_), _) => Ok(()), - (IncludeNode, &NodeData::Doctype { ref name, .. }) => { + (&IncludeNode, &NodeData::Doctype { ref name, .. }) => { serializer.write_doctype(&name) } - (IncludeNode, &NodeData::Text { ref contents }) => { + (&IncludeNode, &NodeData::Text { ref contents }) => { serializer.write_text(&contents.borrow()) } - (IncludeNode, &NodeData::Comment { ref contents }) => { + (&IncludeNode, &NodeData::Comment { ref contents }) => { serializer.write_comment(&contents) } - (IncludeNode, &NodeData::ProcessingInstruction { ref target, ref contents }) => { + (&IncludeNode, &NodeData::ProcessingInstruction { ref target, ref contents }) => { serializer.write_processing_instruction(target, contents) }, - (IncludeNode, &NodeData::Document) => { + (&IncludeNode, &NodeData::Document) => { panic!("Can't serialize Document node itself") } } diff --git a/src/vendor/markup5ever/serialize.rs b/src/vendor/markup5ever/serialize.rs index 89ec0db433..eb3a9a6a5c 100644 --- a/src/vendor/markup5ever/serialize.rs +++ b/src/vendor/markup5ever/serialize.rs @@ -11,10 +11,10 @@ use QualName; use std::io; //§ serializing-html-fragments -#[derive(Copy, Clone, PartialEq)] +#[derive(Clone, PartialEq)] pub enum TraversalScope { IncludeNode, - ChildrenOnly + ChildrenOnly(Option) } pub trait Serialize { diff --git a/src/vendor/memchr-1.0.2/.cargo-checksum.json b/src/vendor/memchr/.cargo-checksum.json similarity index 74% rename from src/vendor/memchr-1.0.2/.cargo-checksum.json rename to src/vendor/memchr/.cargo-checksum.json index be2ee8a94d..46c656c48a 100644 --- a/src/vendor/memchr-1.0.2/.cargo-checksum.json +++ b/src/vendor/memchr/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"d471402ab06e94fb67bda462107845d5b20d9813b6f759fa4ac7f79448f3665c",".travis.yml":"7c44542bc6662b5af4f15a98b2bcf052a57190922eb280bce93688785c31e323","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"38694643a2d98dc66c1ea8583b9ee49210e8d92205835e43d9a8cc3216e680fe","Cargo.toml.orig":"0e97528a535e459febb42ca80c172b45bd6127b22bc4c68106afa28eb6342908","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","Makefile":"a45a128685a2ae7d4fa39d310786674417ee113055ef290a11f88002285865fc","README.md":"74e385c51a2402527a61a500d66e509fea97961f15bfffab85040064e576fe31","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","appveyor.yml":"b5c1a28f805854370f24e530df912764a9520f4581b33da090f44cec0eef181c","benches/bench.rs":"87cfb76154c3c322691201c6f5649b37665ed8bf1cf303bca971309a4eef6b61","ctags.rust":"3d128d3cc59f702e68953ba2fe6c3f46bc6991fc575308db060482d5da0c79f3","session.vim":"95cb1d7caf0ff7fbe76ec911988d908ddd883381c925ba64b537695bc9f021c4","src/lib.rs":"98c86c86fd996455d7ec94bdfdcedd3ded3b2a7016480d3474808cfe36d00a63"},"package":"148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"d471402ab06e94fb67bda462107845d5b20d9813b6f759fa4ac7f79448f3665c",".travis.yml":"7c44542bc6662b5af4f15a98b2bcf052a57190922eb280bce93688785c31e323","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"b37fbdbb466bbb057f4d715381c45ab26e37cdc469b97d901abdcb4b44733fc1","Cargo.toml.orig":"51ce481bc3aff31ff6f08613b2d11bc21de358731bdfb42035efb1bff88b1d3b","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","Makefile":"a45a128685a2ae7d4fa39d310786674417ee113055ef290a11f88002285865fc","README.md":"74e385c51a2402527a61a500d66e509fea97961f15bfffab85040064e576fe31","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","appveyor.yml":"b5c1a28f805854370f24e530df912764a9520f4581b33da090f44cec0eef181c","benches/bench.rs":"87cfb76154c3c322691201c6f5649b37665ed8bf1cf303bca971309a4eef6b61","ctags.rust":"3d128d3cc59f702e68953ba2fe6c3f46bc6991fc575308db060482d5da0c79f3","session.vim":"95cb1d7caf0ff7fbe76ec911988d908ddd883381c925ba64b537695bc9f021c4","src/lib.rs":"bd483dd7732610710f592861a77c733a321600267cf0a8237b5ac1b05d5e3c20"},"package":"796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"} \ No newline at end of file diff --git a/src/vendor/memchr/.cargo-ok b/src/vendor/memchr/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/memchr-1.0.2/.gitignore b/src/vendor/memchr/.gitignore similarity index 100% rename from src/vendor/memchr-1.0.2/.gitignore rename to src/vendor/memchr/.gitignore diff --git a/src/vendor/memchr-1.0.2/.travis.yml b/src/vendor/memchr/.travis.yml similarity index 100% rename from src/vendor/memchr-1.0.2/.travis.yml rename to src/vendor/memchr/.travis.yml diff --git a/src/vendor/memchr/COPYING b/src/vendor/memchr/COPYING new file mode 100644 index 0000000000..bb9c20a094 --- /dev/null +++ b/src/vendor/memchr/COPYING @@ -0,0 +1,3 @@ +This project is dual-licensed under the Unlicense and MIT licenses. + +You may use this code under the terms of either license. diff --git a/src/vendor/memchr-1.0.2/Cargo.toml b/src/vendor/memchr/Cargo.toml similarity index 95% rename from src/vendor/memchr-1.0.2/Cargo.toml rename to src/vendor/memchr/Cargo.toml index 2bb28a8eaa..70cac52c32 100644 --- a/src/vendor/memchr-1.0.2/Cargo.toml +++ b/src/vendor/memchr/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "memchr" -version = "1.0.2" +version = "2.0.1" authors = ["Andrew Gallant ", "bluss"] description = "Safe interface to memchr." homepage = "https://github.com/BurntSushi/rust-memchr" @@ -32,7 +32,8 @@ version = "0.2.18" optional = true default-features = false [dev-dependencies.quickcheck] -version = "0.4.1" +version = "0.5" +default-features = false [features] default = ["use_std", "libc"] diff --git a/src/vendor/memchr-1.0.2/Cargo.toml.orig b/src/vendor/memchr/Cargo.toml.orig similarity index 89% rename from src/vendor/memchr-1.0.2/Cargo.toml.orig rename to src/vendor/memchr/Cargo.toml.orig index 99ec41441a..3e73e7e684 100644 --- a/src/vendor/memchr-1.0.2/Cargo.toml.orig +++ b/src/vendor/memchr/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "memchr" -version = "1.0.2" #:version +version = "2.0.1" #:version authors = ["Andrew Gallant ", "bluss"] description = "Safe interface to memchr." documentation = "https://docs.rs/memchr/" @@ -26,7 +26,7 @@ use_std = ["libc", "libc/use_std"] libc = { version = "0.2.18", default-features = false, optional = true } [dev-dependencies] -quickcheck = "0.4.1" +quickcheck = { version = "0.5", default-features = false } [profile.test] opt-level = 3 diff --git a/src/vendor/memchr/LICENSE-MIT b/src/vendor/memchr/LICENSE-MIT new file mode 100644 index 0000000000..3b0a5dc09c --- /dev/null +++ b/src/vendor/memchr/LICENSE-MIT @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Andrew Gallant + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/vendor/memchr-1.0.2/Makefile b/src/vendor/memchr/Makefile similarity index 100% rename from src/vendor/memchr-1.0.2/Makefile rename to src/vendor/memchr/Makefile diff --git a/src/vendor/memchr-1.0.2/README.md b/src/vendor/memchr/README.md similarity index 100% rename from src/vendor/memchr-1.0.2/README.md rename to src/vendor/memchr/README.md diff --git a/src/vendor/memchr/UNLICENSE b/src/vendor/memchr/UNLICENSE new file mode 100644 index 0000000000..68a49daad8 --- /dev/null +++ b/src/vendor/memchr/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/src/vendor/memchr-1.0.2/appveyor.yml b/src/vendor/memchr/appveyor.yml similarity index 100% rename from src/vendor/memchr-1.0.2/appveyor.yml rename to src/vendor/memchr/appveyor.yml diff --git a/src/vendor/memchr-1.0.2/benches/bench.rs b/src/vendor/memchr/benches/bench.rs similarity index 100% rename from src/vendor/memchr-1.0.2/benches/bench.rs rename to src/vendor/memchr/benches/bench.rs diff --git a/src/vendor/memchr-1.0.2/ctags.rust b/src/vendor/memchr/ctags.rust similarity index 100% rename from src/vendor/memchr-1.0.2/ctags.rust rename to src/vendor/memchr/ctags.rust diff --git a/src/vendor/memchr-1.0.2/session.vim b/src/vendor/memchr/session.vim similarity index 100% rename from src/vendor/memchr-1.0.2/session.vim rename to src/vendor/memchr/session.vim diff --git a/src/vendor/memchr-1.0.2/src/lib.rs b/src/vendor/memchr/src/lib.rs similarity index 72% rename from src/vendor/memchr-1.0.2/src/lib.rs rename to src/vendor/memchr/src/lib.rs index 7faf32353b..2d87ec790e 100644 --- a/src/vendor/memchr-1.0.2/src/lib.rs +++ b/src/vendor/memchr/src/lib.rs @@ -1,10 +1,11 @@ /*! -This crate defines two functions, `memchr` and `memrchr`, which expose a safe interface -to the corresponding functions in `libc`. +This crate defines two functions, `memchr` and `memrchr`, which expose a safe +interface to the corresponding functions in `libc`. */ #![deny(missing_docs)] #![allow(unused_imports)] +#![doc(html_root_url = "https://docs.rs/memchr/2.0.0")] #![cfg_attr(not(feature = "use_std"), no_std)] @@ -12,12 +13,16 @@ to the corresponding functions in `libc`. #[macro_use] extern crate std; -#[cfg(feature = "libc")] +#[cfg(all(feature = "libc", not(target_arch = "wasm32")))] extern crate libc; -#[cfg(feature = "libc")] +#[macro_use] +#[cfg(test)] +extern crate quickcheck; + +#[cfg(all(feature = "libc", not(target_arch = "wasm32")))] use libc::c_void; -#[cfg(feature = "libc")] +#[cfg(all(feature = "libc", not(target_arch = "wasm32")))] use libc::{c_int, size_t}; #[cfg(feature = "use_std")] @@ -66,6 +71,36 @@ fn repeat_byte(b: u8) -> usize { rep } +macro_rules! iter_next { + // Common code for the memchr iterators: + // update haystack and position and produce the index + // + // self: &mut Self where Self is the iterator + // search_result: Option which is the result of the corresponding + // memchr function. + // + // Returns Option (the next iterator element) + ($self_:expr, $search_result:expr) => { + $search_result.map(move |index| { + // split and take the remaining back half + $self_.haystack = $self_.haystack.split_at(index + 1).1; + let found_position = $self_.position + index; + $self_.position = found_position + 1; + found_position + }) + } +} + +macro_rules! iter_next_back { + ($self_:expr, $search_result:expr) => { + $search_result.map(move |index| { + // split and take the remaining front half + $self_.haystack = $self_.haystack.split_at(index).0; + $self_.position + index + }) + } +} + /// An iterator for memchr pub struct Memchr<'a> { needle: u8, @@ -90,30 +125,17 @@ impl<'a> Iterator for Memchr<'a> { type Item = usize; fn next(&mut self) -> Option { - let search_result = memchr(self.needle, &self.haystack); - match search_result { - Some(index) => { - // Move our internal position - self.haystack = self.haystack.split_at(index + 1).1; - self.position = self.position + index + 1; - Some(self.position) - } - None => None, - } + iter_next!(self, memchr(self.needle, &self.haystack)) + } + + fn size_hint(&self) -> (usize, Option) { + (0, Some(self.haystack.len())) } } impl<'a> DoubleEndedIterator for Memchr<'a> { fn next_back(&mut self) -> Option { - let search_result = memrchr(self.needle, &self.haystack); - match search_result { - Some(index) => { - // Move our internal position - self.haystack = self.haystack.split_at(index).0; - Some(self.position + index + 1) - } - None => None, - } + iter_next_back!(self, memrchr(self.needle, &self.haystack)) } } @@ -140,6 +162,7 @@ impl<'a> DoubleEndedIterator for Memchr<'a> { pub fn memchr(needle: u8, haystack: &[u8]) -> Option { // libc memchr #[cfg(all(feature = "libc", + not(target_arch = "wasm32"), any(not(target_os = "windows"), not(any(target_pointer_width = "32", target_pointer_width = "64")))))] @@ -160,7 +183,8 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option { } // use fallback on windows, since it's faster - #[cfg(all(any(not(feature = "libc"), target_os = "windows"), + // use fallback on wasm32, since it doesn't have libc + #[cfg(all(any(not(feature = "libc"), target_os = "windows", target_arch = "wasm32"), any(target_pointer_width = "32", target_pointer_width = "64")))] fn memchr_specific(needle: u8, haystack: &[u8]) -> Option { @@ -258,16 +282,11 @@ impl<'a> Iterator for Memchr2<'a> { type Item = usize; fn next(&mut self) -> Option { - let search_result = memchr2(self.needle1, self.needle2, &self.haystack); - match search_result { - Some(index) => { - // Move our internal position - self.haystack = self.haystack.split_at(index + 1).1; - self.position = self.position + index + 1; - Some(self.position) - } - None => None, - } + iter_next!(self, memchr2(self.needle1, self.needle2, &self.haystack)) + } + + fn size_hint(&self) -> (usize, Option) { + (0, Some(self.haystack.len())) } } @@ -319,7 +338,12 @@ pub struct Memchr3<'a> { impl<'a> Memchr3<'a> { /// Create a new Memchr2 that's initalized to zero with a haystack - pub fn new(needle1: u8, needle2: u8, needle3: u8, haystack: &[u8]) -> Memchr3 { + pub fn new( + needle1: u8, + needle2: u8, + needle3: u8, + haystack: &[u8], + ) -> Memchr3 { Memchr3 { needle1: needle1, needle2: needle2, @@ -334,21 +358,24 @@ impl<'a> Iterator for Memchr3<'a> { type Item = usize; fn next(&mut self) -> Option { - let search_result = memchr3(self.needle1, self.needle2, self.needle3, &self.haystack); - match search_result { - Some(index) => { - // Move our internal position - self.haystack = self.haystack.split_at(index + 1).1; - self.position = self.position + index + 1; - Some(self.position) - } - None => None, - } + iter_next!( + self, + memchr3(self.needle1, self.needle2, self.needle3, &self.haystack) + ) + } + + fn size_hint(&self) -> (usize, Option) { + (0, Some(self.haystack.len())) } } /// Like `memchr`, but searches for three bytes instead of one. -pub fn memchr3(needle1: u8, needle2: u8, needle3: u8, haystack: &[u8]) -> Option { +pub fn memchr3( + needle1: u8, + needle2: u8, + needle3: u8, + haystack: &[u8], +) -> Option { fn slow(b1: u8, b2: u8, b3: u8, haystack: &[u8]) -> Option { haystack.iter().position(|&b| b == b1 || b == b2 || b == b3) } @@ -392,14 +419,17 @@ mod fallback { #[cfg(not(feature = "use_std"))] use core::cmp; - use super::{LO_U64, HI_U64, LO_USIZE, HI_USIZE, USIZE_BYTES, contains_zero_byte, repeat_byte}; + use super::{ + LO_U64, HI_U64, LO_USIZE, HI_USIZE, USIZE_BYTES, + contains_zero_byte, repeat_byte, + }; /// Return the first index matching the byte `a` in `text`. pub fn memchr(x: u8, text: &[u8]) -> Option { // Scan for a single byte value by reading two `usize` words at a time. // // Split `text` in three parts - // - unaligned inital part, before the first word aligned address in text + // - unaligned inital part, before first word aligned address in text // - body, scan by 2 words at a time // - the last remaining part, < 2 word size let len = text.len(); @@ -410,7 +440,8 @@ mod fallback { let mut offset; if align > 0 { offset = cmp::min(USIZE_BYTES - align, len); - if let Some(index) = text[..offset].iter().position(|elt| *elt == x) { + let pos = text[..offset].iter().position(|elt| *elt == x); + if let Some(index) = pos { return Some(index); } } else { @@ -458,7 +489,8 @@ mod fallback { let mut offset; if end_align > 0 { offset = if end_align >= len { 0 } else { len - end_align }; - if let Some(index) = text[offset..].iter().rposition(|elt| *elt == x) { + let pos = text[offset..].iter().rposition(|elt| *elt == x); + if let Some(index) = pos { return Some(offset + index); } } else { @@ -491,8 +523,8 @@ mod fallback { #[cfg(test)] mod tests { - extern crate quickcheck; use std::prelude::v1::*; + use quickcheck; use super::{memchr, memrchr, memchr2, memchr3, Memchr, Memchr2, Memchr3}; // Use a macro to test both native and fallback impls on all configurations @@ -500,7 +532,7 @@ mod tests { ($mod_name:ident, $memchr:path, $memrchr:path) => { mod $mod_name { use std::prelude::v1::*; - use super::quickcheck; + use quickcheck; #[test] fn matches_one() { assert_eq!(Some(0), $memchr(b'a', b"a")); @@ -599,7 +631,8 @@ mod tests { }; for byte in 0..256u32 { let byte = byte as u8; - if $memchr(byte, &data) != data.iter().position(|elt| *elt == byte) { + let pos = data.iter().position(|elt| *elt == byte); + if $memchr(byte, &data) != pos { return false; } } @@ -620,7 +653,8 @@ mod tests { }; for byte in 0..256u32 { let byte = byte as u8; - if $memrchr(byte, &data) != data.iter().rposition(|elt| *elt == byte) { + let pos = data.iter().rposition(|elt| *elt == byte); + if $memrchr(byte, &data) != pos { return false; } } @@ -734,6 +768,42 @@ mod tests { assert_eq!(None, memchr3(b'a', b'b', b'c', b"xyz")); } + // return an iterator of the 0-based indices of haystack that match the + // needle + fn positions1<'a>(needle: u8, haystack: &'a [u8]) + -> Box + 'a> + { + Box::new(haystack.iter() + .enumerate() + .filter(move |&(_, &elt)| elt == needle) + .map(|t| t.0)) + } + + fn positions2<'a>(needle1: u8, needle2: u8, haystack: &'a [u8]) + -> Box + 'a> + { + Box::new(haystack + .iter() + .enumerate() + .filter(move |&(_, &elt)| elt == needle1 || elt == needle2) + .map(|t| t.0)) + } + + fn positions3<'a>( + needle1: u8, + needle2: u8, + needle3: u8, + haystack: &'a [u8], + ) -> Box + 'a> { + Box::new(haystack + .iter() + .enumerate() + .filter(move |&(_, &elt)| { + elt == needle1 || elt == needle2 || elt == needle3 + }) + .map(|t| t.0)) + } + #[test] fn memchr_iter() { let haystack = b"aaaabaaaab"; @@ -741,35 +811,41 @@ mod tests { let first = memchr_iter.next(); let second = memchr_iter.next(); let third = memchr_iter.next(); - assert_eq!(Some(5), first); - assert_eq!(Some(10), second); - assert_eq!(None, third); + + let mut answer_iter = positions1(b'b', haystack); + assert_eq!(answer_iter.next(), first); + assert_eq!(answer_iter.next(), second); + assert_eq!(answer_iter.next(), third); } #[test] fn memchr2_iter() { - let haystack = b"ab"; + let haystack = b"axxb"; let mut memchr_iter = Memchr2::new(b'a', b'b', haystack); let first = memchr_iter.next(); let second = memchr_iter.next(); let third = memchr_iter.next(); - assert_eq!(Some(1), first); - assert_eq!(Some(2), second); - assert_eq!(None, third); + + let mut answer_iter = positions2(b'a', b'b', haystack); + assert_eq!(answer_iter.next(), first); + assert_eq!(answer_iter.next(), second); + assert_eq!(answer_iter.next(), third); } #[test] fn memchr3_iter() { - let haystack = b"abc"; + let haystack = b"axxbc"; let mut memchr_iter = Memchr3::new(b'a', b'b', b'c', haystack); let first = memchr_iter.next(); let second = memchr_iter.next(); let third = memchr_iter.next(); let fourth = memchr_iter.next(); - assert_eq!(Some(1), first); - assert_eq!(Some(2), second); - assert_eq!(Some(3), third); - assert_eq!(None, fourth); + + let mut answer_iter = positions3(b'a', b'b', b'c', haystack); + assert_eq!(answer_iter.next(), first); + assert_eq!(answer_iter.next(), second); + assert_eq!(answer_iter.next(), third); + assert_eq!(answer_iter.next(), fourth); } #[test] @@ -781,10 +857,11 @@ mod tests { let third = memchr_iter.next(); let fourth = memchr_iter.next_back(); - assert_eq!(Some(5), first); - assert_eq!(Some(15), second); - assert_eq!(Some(10), third); - assert_eq!(None, fourth); + let mut answer_iter = positions1(b'b', haystack); + assert_eq!(answer_iter.next(), first); + assert_eq!(answer_iter.next_back(), second); + assert_eq!(answer_iter.next(), third); + assert_eq!(answer_iter.next_back(), fourth); } #[test] @@ -796,16 +873,22 @@ mod tests { let third = memchr_iter.next_back(); let fourth = memchr_iter.next_back(); - assert_eq!(Some(15), first); - assert_eq!(Some(10), second); - assert_eq!(Some(5), third); - assert_eq!(None, fourth); + let mut answer_iter = positions1(b'b', haystack); + assert_eq!(answer_iter.next_back(), first); + assert_eq!(answer_iter.next_back(), second); + assert_eq!(answer_iter.next_back(), third); + assert_eq!(answer_iter.next_back(), fourth); } #[test] fn qc_never_fail_memchr3() { - fn prop(needle1: u8, needle2: u8, needle3: u8, haystack: Vec) -> bool { + fn prop( + needle1: u8, + needle2: u8, + needle3: u8, + haystack: Vec, + ) -> bool { memchr3(needle1, needle2, needle3, &haystack); true } @@ -824,7 +907,8 @@ mod tests { }; for byte in 0..256u32 { let byte = byte as u8; - if memchr(byte, &data) != data.iter().position(|elt| *elt == byte) { + let pos = data.iter().position(|elt| *elt == byte); + if memchr(byte, &data) != pos { return false; } } @@ -845,7 +929,8 @@ mod tests { }; for byte in 0..256u32 { let byte = byte as u8; - if memrchr(byte, &data) != data.iter().rposition(|elt| *elt == byte) { + let pos = data.iter().rposition(|elt| *elt == byte); + if memrchr(byte, &data) != pos { return false; } } @@ -867,7 +952,9 @@ mod tests { for b1 in 0..256u32 { for b2 in 0..256u32 { let (b1, b2) = (b1 as u8, b2 as u8); - let expected = data.iter().position(|&b| b == b1 || b == b2); + let expected = data + .iter() + .position(|&b| b == b1 || b == b2); let got = memchr2(b1, b2, &data); if expected != got { return false; @@ -878,4 +965,98 @@ mod tests { } quickcheck::quickcheck(prop as fn(Vec, u8) -> bool); } + + // take items from a DEI, taking front for each true and back for each + // false. Return a vector with the concatenation of the fronts and the + // reverse of the backs. + fn double_ended_take(mut iter: I, take_side: J) -> Vec + where I: DoubleEndedIterator, + J: Iterator, + { + let mut found_front = Vec::new(); + let mut found_back = Vec::new(); + + for take_front in take_side { + if take_front { + if let Some(pos) = iter.next() { + found_front.push(pos); + } else { + break; + } + } else { + if let Some(pos) = iter.next_back() { + found_back.push(pos); + } else { + break; + } + }; + } + + let mut all_found = found_front; + all_found.extend(found_back.into_iter().rev()); + all_found + } + + + quickcheck! { + fn qc_memchr_double_ended_iter(needle: u8, data: Vec, + take_side: Vec) -> bool + { + // make nonempty + let mut take_side = take_side; + if take_side.is_empty() { take_side.push(true) }; + + let iter = Memchr::new(needle, &data); + let all_found = double_ended_take( + iter, take_side.iter().cycle().cloned()); + + all_found.iter().cloned().eq(positions1(needle, &data)) + } + + fn qc_memchr1_iter(data: Vec) -> bool { + let needle = 0; + let answer = positions1(needle, &data); + answer.eq(Memchr::new(needle, &data)) + } + + fn qc_memchr1_rev_iter(data: Vec) -> bool { + let needle = 0; + let answer = positions1(needle, &data); + answer.rev().eq(Memchr::new(needle, &data).rev()) + } + + fn qc_memchr2_iter(data: Vec) -> bool { + let needle1 = 0; + let needle2 = 1; + let answer = positions2(needle1, needle2, &data); + answer.eq(Memchr2::new(needle1, needle2, &data)) + } + + fn qc_memchr3_iter(data: Vec) -> bool { + let needle1 = 0; + let needle2 = 1; + let needle3 = 2; + let answer = positions3(needle1, needle2, needle3, &data); + answer.eq(Memchr3::new(needle1, needle2, needle3, &data)) + } + + fn qc_memchr1_iter_size_hint(data: Vec) -> bool { + // test that the size hint is within reasonable bounds + let needle = 0; + let mut iter = Memchr::new(needle, &data); + let mut real_count = data + .iter() + .filter(|&&elt| elt == needle) + .count(); + + while let Some(index) = iter.next() { + real_count -= 1; + let (lower, upper) = iter.size_hint(); + assert!(lower <= real_count); + assert!(upper.unwrap() >= real_count); + assert!(upper.unwrap() <= data.len() - index); + } + true + } + } } diff --git a/src/vendor/num-traits/.cargo-checksum.json b/src/vendor/num-traits/.cargo-checksum.json index f2d9d01010..634abd22b9 100644 --- a/src/vendor/num-traits/.cargo-checksum.json +++ b/src/vendor/num-traits/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"92adda23269f6c20f8a7ba6ff6afab4c0a3756dfade9ff9513ef0546864a2848","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","src/bounds.rs":"3666fbdf8b347fa1daad3ee92e3ac4a10df99d26bc340b877d5bbba914b61782","src/cast.rs":"c44c11863751810ef40763ac3470facdf0c3f0d16db9474d3e566a8c78eafdaa","src/float.rs":"fd768b5bb403cd5056d3b588074ed5571c40279d6a7da8c4f3c46ac4713f89fd","src/identities.rs":"c78281aa689c5f376a2cfbe1e81aefd54d634f410671ce1660a2c117b3ae6b04","src/int.rs":"b7b42dfa10423308f858216ac63fa52e26c49a7bc8900cd98de210992efc3f5f","src/lib.rs":"84c84706da4df88b87a0f5ed2e412dcfc644f9f849db2dc4302faa5d8b79379a","src/ops/checked.rs":"bc667779636f81c7eca138c6d57252a6bb6ca4cd1f0ff706a993067044d86f94","src/ops/mod.rs":"668ea4d117bc1fdf7eaf0fe16692fa40dfbdfcbc7a2010237fe395ce0086e02e","src/ops/saturating.rs":"46821d815c90c16b2f6bec0b94b4d7ebdbddf3ea42edc0467de738c56abf6436","src/ops/wrapping.rs":"a444c7eb3366f2ad4c3a9938f1158b1994b9da4bbf9097884b5e8e27a9b581dd","src/pow.rs":"73b611ad8d595ef917871ba859ff0c25efc2382220d30568e5fbb930bf6b4daa","src/sign.rs":"732736f44c3c410f43da98eb3c8887319d94ad2c4883d614a9c353659402b315"},"package":"99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"3d24ace42f6604297f16fb6e9a8aecb11644083bcc14eccb5d04002146444cd4","Cargo.toml.orig":"fa415c31a4b32518c131eb6896b91eec1d9af6d1303978f8297ed5a38ad3f0ee","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","src/bounds.rs":"c744ca32dcb31447abc1132b2ef6f7c102d4ffa3dbc36a24a384520ec8702839","src/cast.rs":"a067d47329c30672ad9764e34a551cd566b5023f17a35673b35dbab6388043d2","src/float.rs":"fd768b5bb403cd5056d3b588074ed5571c40279d6a7da8c4f3c46ac4713f89fd","src/identities.rs":"ed67758e226fb78a14496776533a6d97d9f813294aadc73958e3005fd0e66599","src/int.rs":"b7b42dfa10423308f858216ac63fa52e26c49a7bc8900cd98de210992efc3f5f","src/lib.rs":"75b1b8b714b51f6169be13e8043bc0e9341a5aeb04e61c5446a5ce5cb241e101","src/ops/checked.rs":"bc667779636f81c7eca138c6d57252a6bb6ca4cd1f0ff706a993067044d86f94","src/ops/mod.rs":"668ea4d117bc1fdf7eaf0fe16692fa40dfbdfcbc7a2010237fe395ce0086e02e","src/ops/saturating.rs":"46821d815c90c16b2f6bec0b94b4d7ebdbddf3ea42edc0467de738c56abf6436","src/ops/wrapping.rs":"a444c7eb3366f2ad4c3a9938f1158b1994b9da4bbf9097884b5e8e27a9b581dd","src/pow.rs":"73b611ad8d595ef917871ba859ff0c25efc2382220d30568e5fbb930bf6b4daa","src/sign.rs":"732736f44c3c410f43da98eb3c8887319d94ad2c4883d614a9c353659402b315"},"package":"cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"} \ No newline at end of file diff --git a/src/vendor/num-traits/Cargo.toml b/src/vendor/num-traits/Cargo.toml index f55687e70e..e089d3ad93 100644 --- a/src/vendor/num-traits/Cargo.toml +++ b/src/vendor/num-traits/Cargo.toml @@ -1,13 +1,25 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] +name = "num-traits" +version = "0.1.41" authors = ["The Rust Project Developers"] description = "Numeric traits for generic mathematics" -documentation = "http://rust-num.github.io/num" homepage = "https://github.com/rust-num/num" +documentation = "http://rust-num.github.io/num" keywords = ["mathematics", "numerics"] -categories = [ "algorithms", "science" ] +categories = ["algorithms", "science"] license = "MIT/Apache-2.0" repository = "https://github.com/rust-num/num" -name = "num-traits" -version = "0.1.40" [dependencies] diff --git a/src/vendor/num-traits/Cargo.toml.orig b/src/vendor/num-traits/Cargo.toml.orig new file mode 100644 index 0000000000..e6918511f2 --- /dev/null +++ b/src/vendor/num-traits/Cargo.toml.orig @@ -0,0 +1,13 @@ +[package] +authors = ["The Rust Project Developers"] +description = "Numeric traits for generic mathematics" +documentation = "http://rust-num.github.io/num" +homepage = "https://github.com/rust-num/num" +keywords = ["mathematics", "numerics"] +categories = [ "algorithms", "science" ] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-num/num" +name = "num-traits" +version = "0.1.41" + +[dependencies] diff --git a/src/vendor/num-traits/src/bounds.rs b/src/vendor/num-traits/src/bounds.rs index ea5c811a7d..83fdd0fd72 100644 --- a/src/vendor/num-traits/src/bounds.rs +++ b/src/vendor/num-traits/src/bounds.rs @@ -77,17 +77,17 @@ for_each_tuple!(bounded_tuple); bounded_impl!(f64, f64::MIN, f64::MAX); -macro_rules! test_wrapping_bounded { - ($($t:ty)+) => { - $( - assert_eq!(Wrapping::<$t>::min_value().0, <$t>::min_value()); - assert_eq!(Wrapping::<$t>::max_value().0, <$t>::max_value()); - )+ - }; -} - #[test] fn wrapping_bounded() { + macro_rules! test_wrapping_bounded { + ($($t:ty)+) => { + $( + assert_eq!(Wrapping::<$t>::min_value().0, <$t>::min_value()); + assert_eq!(Wrapping::<$t>::max_value().0, <$t>::max_value()); + )+ + }; + } + test_wrapping_bounded!(usize u8 u16 u32 u64 isize i8 i16 i32 i64); } diff --git a/src/vendor/num-traits/src/cast.rs b/src/vendor/num-traits/src/cast.rs index 8949834a1e..62e6bf6f46 100644 --- a/src/vendor/num-traits/src/cast.rs +++ b/src/vendor/num-traits/src/cast.rs @@ -466,29 +466,29 @@ fn to_primitive_float() { assert!((f64::NAN).to_f32().map_or(false, |f| f.is_nan())); } -macro_rules! test_wrapping_to_primitive { - ($($t:ty)+) => { - $({ - let i: $t = 0; - let w = Wrapping(i); - assert_eq!(i.to_u8(), w.to_u8()); - assert_eq!(i.to_u16(), w.to_u16()); - assert_eq!(i.to_u32(), w.to_u32()); - assert_eq!(i.to_u64(), w.to_u64()); - assert_eq!(i.to_usize(), w.to_usize()); - assert_eq!(i.to_i8(), w.to_i8()); - assert_eq!(i.to_i16(), w.to_i16()); - assert_eq!(i.to_i32(), w.to_i32()); - assert_eq!(i.to_i64(), w.to_i64()); - assert_eq!(i.to_isize(), w.to_isize()); - assert_eq!(i.to_f32(), w.to_f32()); - assert_eq!(i.to_f64(), w.to_f64()); - })+ - }; -} - #[test] fn wrapping_to_primitive() { + macro_rules! test_wrapping_to_primitive { + ($($t:ty)+) => { + $({ + let i: $t = 0; + let w = Wrapping(i); + assert_eq!(i.to_u8(), w.to_u8()); + assert_eq!(i.to_u16(), w.to_u16()); + assert_eq!(i.to_u32(), w.to_u32()); + assert_eq!(i.to_u64(), w.to_u64()); + assert_eq!(i.to_usize(), w.to_usize()); + assert_eq!(i.to_i8(), w.to_i8()); + assert_eq!(i.to_i16(), w.to_i16()); + assert_eq!(i.to_i32(), w.to_i32()); + assert_eq!(i.to_i64(), w.to_i64()); + assert_eq!(i.to_isize(), w.to_isize()); + assert_eq!(i.to_f32(), w.to_f32()); + assert_eq!(i.to_f64(), w.to_f64()); + })+ + }; + } + test_wrapping_to_primitive!(usize u8 u16 u32 u64 isize i8 i16 i32 i64); } diff --git a/src/vendor/num-traits/src/identities.rs b/src/vendor/num-traits/src/identities.rs index 2f520e0878..79882edda2 100644 --- a/src/vendor/num-traits/src/identities.rs +++ b/src/vendor/num-traits/src/identities.rs @@ -120,19 +120,19 @@ impl One for Wrapping where Wrapping: Mul> { #[inline(always)] pub fn one() -> T { One::one() } -macro_rules! test_wrapping_identities { - ($($t:ty)+) => { - $( - assert_eq!(zero::<$t>(), zero::>().0); - assert_eq!(one::<$t>(), one::>().0); - assert_eq!((0 as $t).is_zero(), Wrapping(0 as $t).is_zero()); - assert_eq!((1 as $t).is_zero(), Wrapping(1 as $t).is_zero()); - )+ - }; -} - #[test] fn wrapping_identities() { + macro_rules! test_wrapping_identities { + ($($t:ty)+) => { + $( + assert_eq!(zero::<$t>(), zero::>().0); + assert_eq!(one::<$t>(), one::>().0); + assert_eq!((0 as $t).is_zero(), Wrapping(0 as $t).is_zero()); + assert_eq!((1 as $t).is_zero(), Wrapping(1 as $t).is_zero()); + )+ + }; + } + test_wrapping_identities!(isize i8 i16 i32 i64 usize u8 u16 u32 u64); } diff --git a/src/vendor/num-traits/src/lib.rs b/src/vendor/num-traits/src/lib.rs index 41422c8d04..0cfc2c7ce7 100644 --- a/src/vendor/num-traits/src/lib.rs +++ b/src/vendor/num-traits/src/lib.rs @@ -361,24 +361,26 @@ fn from_str_radix_unwrap() { assert_eq!(f, 0.0); } -macro_rules! test_wrapping_from_str_radix { - ($($t:ty)+) => { - $( - for &(s, r) in &[("42", 10), ("42", 2), ("-13.0", 10), ("foo", 10)] { - let w = Wrapping::<$t>::from_str_radix(s, r).map(|w| w.0); - assert_eq!(w, <$t as Num>::from_str_radix(s, r)); - } - )+ - }; -} #[test] fn wrapping_is_num() { fn require_num(_: &T) {} require_num(&Wrapping(42_u32)); require_num(&Wrapping(-42)); } + #[test] fn wrapping_from_str_radix() { + macro_rules! test_wrapping_from_str_radix { + ($($t:ty)+) => { + $( + for &(s, r) in &[("42", 10), ("42", 2), ("-13.0", 10), ("foo", 10)] { + let w = Wrapping::<$t>::from_str_radix(s, r).map(|w| w.0); + assert_eq!(w, <$t as Num>::from_str_radix(s, r)); + } + )+ + }; + } + test_wrapping_from_str_radix!(usize u8 u16 u32 u64 isize i8 i16 i32 i64); } diff --git a/src/vendor/parking_lot/.cargo-checksum.json b/src/vendor/parking_lot/.cargo-checksum.json new file mode 100644 index 0000000000..95b3a46401 --- /dev/null +++ b/src/vendor/parking_lot/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"04d3d7425ce24e59d25df35da9c54f3ccd429c62ed8c9cf37b5ed2757afe96f1","Cargo.toml":"39c5a4625df2eb3cd14b3ccdf5aa8fee2f3fa98875b33e84bcd552b9edcfb4ba","Cargo.toml.orig":"1ef5a5846f87314e1cc507ac9fd8c6092fc9736ffcf9125cf63e3b93df6736d8","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"d77973d50b9c4b65626289c172fdefca4b4b6aba1000538613ce1f4caefafc32","appveyor.yml":"cfa9c3ae2476c879fe4240c306d45de6c2c04025212d8217fa76690888117594","src/condvar.rs":"1a3de60460e832d7ff76a82d5dac3f387fe2255e6a8ad4a686fe37f134c088c7","src/deadlock.rs":"e5323cd9b9a022e901520263bec4e2b3b1d1a5070c588dc015c1ae94cebeb3f0","src/elision.rs":"8cfbc5c8115c326ea23f3b4cfc0392577ea5092cde5dbf7b50776a13aec1857f","src/lib.rs":"531ee1ab2783c5234440125a3144746ece5224f8af5bdb5be3eb18dc76d61c64","src/mutex.rs":"d0f28a8a0ee55f930d4f1414da0856a843ee52a351738f55150044e91879496b","src/once.rs":"9feb9af73c7fac8f79bc32fc8769e8ae9a9d17f9e6ef88e2c0757fdd873b8bd9","src/raw_mutex.rs":"79402d550ea27e9e1bb0c9fb5bbc6849fa1b7c6e56cac5286fa116ce3e8ff0c2","src/raw_remutex.rs":"86e1e339567c12f91e3274ca3126c4af004fd30dff88a6cd261fc67680e33798","src/raw_rwlock.rs":"e98897d3e1731a7a85b9ef50faadd22ff8ffcd5bcddfc7385797d26f8444e39b","src/remutex.rs":"2500a969c3add4e5637f0940c06bf7549f289d0f3d0c17bebdc07c614425f59c","src/rwlock.rs":"07c7a165d4434d397c355826b544f64f0d68585cc254b6d129c050083080fc59","src/stable.rs":"4562ea9a408bd3917df6d30c8354bf51f46bc69b3360815813730743204adfdc","src/util.rs":"2d07c0c010a857790ae2ed6a1215eeed8af76859e076797ea1ba8dec82169e84"},"package":"3e7f7c9857874e54afeb950eebeae662b1e51a2493666d2ea4c0a5d91dcf0412"} \ No newline at end of file diff --git a/src/vendor/parking_lot/.cargo-ok b/src/vendor/parking_lot/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/parking_lot/.gitignore b/src/vendor/parking_lot/.gitignore new file mode 100644 index 0000000000..a9d37c560c --- /dev/null +++ b/src/vendor/parking_lot/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/src/vendor/parking_lot/.travis.yml b/src/vendor/parking_lot/.travis.yml new file mode 100644 index 0000000000..f3fdf462f2 --- /dev/null +++ b/src/vendor/parking_lot/.travis.yml @@ -0,0 +1,40 @@ +language: rust +sudo: false + +rust: +- 1.18.0 +- stable +- beta +- nightly + +before_script: +- | + pip install 'travis-cargo<0.2' --user && + export PATH=$HOME/.local/bin:$PATH + +script: +- cd core; +- travis-cargo build; +- cd ..; +- travis-cargo build +- travis-cargo test +- travis-cargo test -- --features=deadlock_detection +- travis-cargo --only nightly doc -- --all-features --no-deps -p parking_lot -p parking_lot_core +- if [ "$TRAVIS_RUST_VERSION" != "1.8.0" ]; then + cd benchmark; + travis-cargo build; + travis-cargo run -- --release --bin mutex 2 1 0 1; + travis-cargo run -- --release --bin rwlock 1 1 1 0 1; + cd ..; + fi + +after_success: +- travis-cargo --only nightly doc-upload + +env: + global: + - TRAVIS_CARGO_NIGHTLY_FEATURE=nightly + - RUST_TEST_THREADS=1 + +notifications: + email: false diff --git a/src/vendor/parking_lot/Cargo.toml b/src/vendor/parking_lot/Cargo.toml new file mode 100644 index 0000000000..b801050a06 --- /dev/null +++ b/src/vendor/parking_lot/Cargo.toml @@ -0,0 +1,35 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "parking_lot" +version = "0.5.3" +authors = ["Amanieu d'Antras "] +description = "More compact and efficient implementations of the standard synchronization primitives." +documentation = "https://amanieu.github.io/parking_lot/parking_lot/index.html" +readme = "README.md" +keywords = ["mutex", "condvar", "rwlock", "once", "thread"] +license = "Apache-2.0/MIT" +repository = "https://github.com/Amanieu/parking_lot" +[dependencies.owning_ref] +version = "0.3" +optional = true + +[dependencies.parking_lot_core] +version = "0.2" +[dev-dependencies.rand] +version = "0.3" + +[features] +deadlock_detection = ["parking_lot_core/deadlock_detection"] +default = ["owning_ref"] +nightly = ["parking_lot_core/nightly"] diff --git a/src/vendor/parking_lot/Cargo.toml.orig b/src/vendor/parking_lot/Cargo.toml.orig new file mode 100644 index 0000000000..d2f93e6df2 --- /dev/null +++ b/src/vendor/parking_lot/Cargo.toml.orig @@ -0,0 +1,25 @@ +[package] +name = "parking_lot" +version = "0.5.3" +authors = ["Amanieu d'Antras "] +description = "More compact and efficient implementations of the standard synchronization primitives." +documentation = "https://amanieu.github.io/parking_lot/parking_lot/index.html" +license = "Apache-2.0/MIT" +repository = "https://github.com/Amanieu/parking_lot" +readme = "README.md" +keywords = ["mutex", "condvar", "rwlock", "once", "thread"] + +[dependencies] +parking_lot_core = { path = "core", version = "0.2" } +owning_ref = { version = "0.3", optional = true } + +[dev-dependencies] +rand = "0.3" + +[features] +default = ["owning_ref"] +nightly = ["parking_lot_core/nightly"] +deadlock_detection = ["parking_lot_core/deadlock_detection"] + +[workspace] +exclude = ["benchmark"] diff --git a/src/vendor/parking_lot/LICENSE-APACHE b/src/vendor/parking_lot/LICENSE-APACHE new file mode 100644 index 0000000000..16fe87b06e --- /dev/null +++ b/src/vendor/parking_lot/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/src/vendor/parking_lot/LICENSE-MIT b/src/vendor/parking_lot/LICENSE-MIT new file mode 100644 index 0000000000..40b8817a47 --- /dev/null +++ b/src/vendor/parking_lot/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2016 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/src/vendor/parking_lot/README.md b/src/vendor/parking_lot/README.md new file mode 100644 index 0000000000..feeab77dff --- /dev/null +++ b/src/vendor/parking_lot/README.md @@ -0,0 +1,132 @@ +parking_lot +============ + +[![Build Status](https://travis-ci.org/Amanieu/parking_lot.svg?branch=master)](https://travis-ci.org/Amanieu/parking_lot) [![Build status](https://ci.appveyor.com/api/projects/status/wppcc32ttpud0a30/branch/master?svg=true)](https://ci.appveyor.com/project/Amanieu/parking-lot/branch/master) [![Crates.io](https://img.shields.io/crates/v/parking_lot.svg)](https://crates.io/crates/parking_lot) + +[Documentation (synchronization primitives)](https://amanieu.github.io/parking_lot/parking_lot/index.html) + +[Documentation (core parking lot API)](https://amanieu.github.io/parking_lot/parking_lot_core/index.html) + +This library provides implementations of `Mutex`, `RwLock`, `Condvar` and +`Once` that are smaller, faster and more flexible than those in the Rust +standard library, as well as a `ReentrantMutex` type which supports recursive +locking. It also exposes a low-level API for creating your own efficient +synchronization primitives. + +When tested on x86_64 Linux, `parking_lot::Mutex` was found to be 1.5x +faster than `std::sync::Mutex` when uncontended, and up to 5x faster when +contended from multiple threads. The numbers for `RwLock` vary depending on +the number of reader and writer threads, but are almost always faster than +the standard library `RwLock`, and even up to 50x faster in some cases. + +## Features + +The primitives provided by this library have several advantages over those +in the Rust standard library: + +1. `Mutex` and `Once` only require 1 byte of storage space, while `Condvar` + and `RwLock` only require 1 word of storage space. On the other hand the + standard library primitives require a dynamically allocated `Box` to hold + OS-specific synchronization primitives. The small size of `Mutex` in + particular encourages the use of fine-grained locks to increase + parallelism. +2. Since they consist of just a single atomic variable, have constant + initializers and don't need destructors, these primitives can be used as + `static` global variables. The standard library primitives require + dynamic initialization and thus need to be lazily initialized with + `lazy_static!`. +3. Uncontended lock acquisition and release is done through fast inline + paths which only require a single atomic operation. +4. Microcontention (a contended lock with a short critical section) is + efficiently handled by spinning a few times while trying to acquire a + lock. +5. The locks are adaptive and will suspend a thread after a few failed spin + attempts. This makes the locks suitable for both long and short critical + sections. +6. `Condvar`, `RwLock` and `Once` work on Windows XP, unlike the standard + library versions of those types. +7. `RwLock` takes advantage of hardware lock elision on processors that + support it, which can lead to huge performance wins with many readers. +8. `RwLock` uses a task-fair locking policy, which avoids reader and writer + starvation, whereas the standard library version makes no guarantees. +9. `Condvar` is guaranteed not to produce spurious wakeups. A thread will + only be woken up if it timed out or it was woken up by a notification. +10. `Condvar::notify_all` will only wake up a single thread and requeue the + rest to wait on the associated `Mutex`. This avoids a thundering herd + problem where all threads try to acquire the lock at the same time. +11. `RwLock` supports atomically downgrading a write lock into a read lock. +12. `Mutex` and `RwLock` allow raw unlocking without a RAII guard object. +13. `Mutex<()>` and `RwLock<()>` allow raw locking without a RAII guard + object. +14. `Mutex` and `RwLock` support [eventual fairness](https://trac.webkit.org/changeset/203350) + which allows them to be fair on average without sacrificing performance. +15. A `ReentrantMutex` type which supports recursive locking. +16. An *experimental* deadlock detector that works for `Mutex`, + `RwLock` and `ReentrantMutex`. This feature is disabled by default and + can be enabled via the `deadlock_detection` feature. +17. `RwLock` supports atomically upgrading an "upgradable" read lock into a + write lock. + +## The parking lot + +To keep these primitives small, all thread queuing and suspending +functionality is offloaded to the *parking lot*. The idea behind this is +based on the Webkit [`WTF::ParkingLot`](https://webkit.org/blog/6161/locking-in-webkit/) +class, which essentially consists of a hash table mapping of lock addresses +to queues of parked (sleeping) threads. The Webkit parking lot was itself +inspired by Linux [futexes](http://man7.org/linux/man-pages/man2/futex.2.html), +but it is more powerful since it allows invoking callbacks while holding a queue +lock. + +## Nightly vs stable + +There are a few restrictions when using this library on stable Rust: + +- `Mutex` and `Once` will use 1 word of space instead of 1 byte. +- You will have to use `lazy_static!` to statically initialize `Mutex`, + `Condvar` and `RwLock` types instead of `const fn`. +- `RwLock` will not be able to take advantage of hardware lock elision for + readers, which improves performance when there are multiple readers. +- Slightly less efficient code may be generated for `compare_exchange` + operations. This should not affect architectures like x86 though. + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +parking_lot = "0.5" +``` + +and this to your crate root: + +```rust +extern crate parking_lot; +``` + +To enable nightly-only features, add this to your `Cargo.toml` instead: + +```toml +[dependencies] +parking_lot = {version = "0.5", features = ["nightly"]} +``` + +The core parking lot API is provided by the `parking_lot_core` crate. It is +separate from the synchronization primitives in the `parking_lot` crate so that +changes to the core API do not cause breaking changes for users of `parking_lot`. + +## License + +Licensed under either of + + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any +additional terms or conditions. diff --git a/src/vendor/parking_lot/appveyor.yml b/src/vendor/parking_lot/appveyor.yml new file mode 100644 index 0000000000..7ee53f9e1a --- /dev/null +++ b/src/vendor/parking_lot/appveyor.yml @@ -0,0 +1,29 @@ +environment: + TRAVIS_CARGO_NIGHTLY_FEATURE: nightly + RUST_TEST_THREADS: 1 + matrix: + - TARGET: nightly-x86_64-pc-windows-msvc + - TARGET: nightly-i686-pc-windows-msvc + - TARGET: nightly-x86_64-pc-windows-gnu + - TARGET: nightly-i686-pc-windows-gnu + - TARGET: 1.18.0-x86_64-pc-windows-msvc + - TARGET: 1.18.0-i686-pc-windows-msvc + - TARGET: 1.18.0-x86_64-pc-windows-gnu + - TARGET: 1.18.0-i686-pc-windows-gnu + +install: + - SET PATH=C:\Python27;C:\Python27\Scripts;%PATH%;%APPDATA%\Python\Scripts + - pip install "travis-cargo<0.2" --user + - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe" -FileName "rust-install.exe" + - ps: .\rust-install.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null + - ps: $env:PATH="$env:PATH;C:\rust\bin" + - rustc -vV + - cargo -vV + +build_script: + - travis-cargo build + +test_script: + - travis-cargo test + - travis-cargo test -- --features=deadlock_detection + - travis-cargo doc diff --git a/src/vendor/parking_lot/src/condvar.rs b/src/vendor/parking_lot/src/condvar.rs new file mode 100644 index 0000000000..d6efab3c20 --- /dev/null +++ b/src/vendor/parking_lot/src/condvar.rs @@ -0,0 +1,513 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::sync::atomic::{AtomicPtr, Ordering}; +use std::time::{Duration, Instant}; +use std::ptr; +use parking_lot_core::{self, ParkResult, RequeueOp, UnparkResult, DEFAULT_PARK_TOKEN}; +use mutex::{guard_lock, MutexGuard}; +use raw_mutex::{RawMutex, TOKEN_HANDOFF, TOKEN_NORMAL}; +use deadlock; + +/// A type indicating whether a timed wait on a condition variable returned +/// due to a time out or not. +#[derive(Debug, PartialEq, Eq, Copy, Clone)] +pub struct WaitTimeoutResult(bool); + +impl WaitTimeoutResult { + /// Returns whether the wait was known to have timed out. + #[inline] + pub fn timed_out(&self) -> bool { + self.0 + } +} + +/// A Condition Variable +/// +/// Condition variables represent the ability to block a thread such that it +/// consumes no CPU time while waiting for an event to occur. Condition +/// variables are typically associated with a boolean predicate (a condition) +/// and a mutex. The predicate is always verified inside of the mutex before +/// determining that thread must block. +/// +/// Note that this module places one additional restriction over the system +/// condition variables: each condvar can be used with only one mutex at a +/// time. Any attempt to use multiple mutexes on the same condition variable +/// simultaneously will result in a runtime panic. However it is possible to +/// switch to a different mutex if there are no threads currently waiting on +/// the condition variable. +/// +/// # Differences from the standard library `Condvar` +/// +/// - No spurious wakeups: A wait will only return a non-timeout result if it +/// was woken up by `notify_one` or `notify_all`. +/// - `Condvar::notify_all` will only wake up a single thread, the rest are +/// requeued to wait for the `Mutex` to be unlocked by the thread that was +/// woken up. +/// - Only requires 1 word of space, whereas the standard library boxes the +/// `Condvar` due to platform limitations. +/// - Can be statically constructed (requires the `const_fn` nightly feature). +/// - Does not require any drop glue when dropped. +/// - Inline fast path for the uncontended case. +/// +/// # Examples +/// +/// ``` +/// use parking_lot::{Mutex, Condvar}; +/// use std::sync::Arc; +/// use std::thread; +/// +/// let pair = Arc::new((Mutex::new(false), Condvar::new())); +/// let pair2 = pair.clone(); +/// +/// // Inside of our lock, spawn a new thread, and then wait for it to start +/// thread::spawn(move|| { +/// let &(ref lock, ref cvar) = &*pair2; +/// let mut started = lock.lock(); +/// *started = true; +/// cvar.notify_one(); +/// }); +/// +/// // wait for the thread to start up +/// let &(ref lock, ref cvar) = &*pair; +/// let mut started = lock.lock(); +/// while !*started { +/// cvar.wait(&mut started); +/// } +/// ``` +pub struct Condvar { + state: AtomicPtr, +} + +impl Condvar { + /// Creates a new condition variable which is ready to be waited on and + /// notified. + #[cfg(feature = "nightly")] + #[inline] + pub const fn new() -> Condvar { + Condvar { + state: AtomicPtr::new(ptr::null_mut()), + } + } + + /// Creates a new condition variable which is ready to be waited on and + /// notified. + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new() -> Condvar { + Condvar { + state: AtomicPtr::new(ptr::null_mut()), + } + } + + /// Wakes up one blocked thread on this condvar. + /// + /// If there is a blocked thread on this condition variable, then it will + /// be woken up from its call to `wait` or `wait_timeout`. Calls to + /// `notify_one` are not buffered in any way. + /// + /// To wake up all threads, see `notify_all()`. + #[inline] + pub fn notify_one(&self) { + // Nothing to do if there are no waiting threads + if self.state.load(Ordering::Relaxed).is_null() { + return; + } + + self.notify_one_slow(); + } + + #[cold] + #[inline(never)] + fn notify_one_slow(&self) { + unsafe { + // Unpark one thread + let addr = self as *const _ as usize; + let callback = |result: UnparkResult| { + // Clear our state if there are no more waiting threads + if !result.have_more_threads { + self.state.store(ptr::null_mut(), Ordering::Relaxed); + } + TOKEN_NORMAL + }; + parking_lot_core::unpark_one(addr, callback); + } + } + + /// Wakes up all blocked threads on this condvar. + /// + /// This method will ensure that any current waiters on the condition + /// variable are awoken. Calls to `notify_all()` are not buffered in any + /// way. + /// + /// To wake up only one thread, see `notify_one()`. + #[inline] + pub fn notify_all(&self) { + // Nothing to do if there are no waiting threads + let state = self.state.load(Ordering::Relaxed); + if state.is_null() { + return; + } + + self.notify_all_slow(state); + } + + #[cold] + #[inline(never)] + fn notify_all_slow(&self, mutex: *mut RawMutex) { + unsafe { + // Unpark one thread and requeue the rest onto the mutex + let from = self as *const _ as usize; + let to = mutex as usize; + let validate = || { + // Make sure that our atomic state still points to the same + // mutex. If not then it means that all threads on the current + // mutex were woken up and a new waiting thread switched to a + // different mutex. In that case we can get away with doing + // nothing. + if self.state.load(Ordering::Relaxed) != mutex { + return RequeueOp::Abort; + } + + // Clear our state since we are going to unpark or requeue all + // threads. + self.state.store(ptr::null_mut(), Ordering::Relaxed); + + // Unpark one thread if the mutex is unlocked, otherwise just + // requeue everything to the mutex. This is safe to do here + // since unlocking the mutex when the parked bit is set requires + // locking the queue. There is the possibility of a race if the + // mutex gets locked after we check, but that doesn't matter in + // this case. + if (*mutex).mark_parked_if_locked() { + RequeueOp::RequeueAll + } else { + RequeueOp::UnparkOneRequeueRest + } + }; + let callback = |op, result: UnparkResult| { + // If we requeued threads to the mutex, mark it as having + // parked threads. The RequeueAll case is already handled above. + if op == RequeueOp::UnparkOneRequeueRest && result.have_more_threads { + (*mutex).mark_parked(); + } + TOKEN_NORMAL + }; + parking_lot_core::unpark_requeue(from, to, validate, callback); + } + } + + /// Blocks the current thread until this condition variable receives a + /// notification. + /// + /// This function will atomically unlock the mutex specified (represented by + /// `mutex_guard`) and block the current thread. This means that any calls + /// to `notify_*()` which happen logically after the mutex is unlocked are + /// candidates to wake this thread up. When this function call returns, the + /// lock specified will have been re-acquired. + /// + /// # Panics + /// + /// This function will panic if another thread is waiting on the `Condvar` + /// with a different `Mutex` object. + #[inline] + pub fn wait(&self, mutex_guard: &mut MutexGuard) { + self.wait_until_internal(guard_lock(mutex_guard), None); + } + + /// Waits on this condition variable for a notification, timing out after + /// the specified time instant. + /// + /// The semantics of this function are equivalent to `wait()` except that + /// the thread will be blocked roughly until `timeout` is reached. This + /// method should not be used for precise timing due to anomalies such as + /// preemption or platform differences that may not cause the maximum + /// amount of time waited to be precisely `timeout`. + /// + /// Note that the best effort is made to ensure that the time waited is + /// measured with a monotonic clock, and not affected by the changes made to + /// the system time. + /// + /// The returned `WaitTimeoutResult` value indicates if the timeout is + /// known to have elapsed. + /// + /// Like `wait`, the lock specified will be re-acquired when this function + /// returns, regardless of whether the timeout elapsed or not. + /// + /// # Panics + /// + /// This function will panic if another thread is waiting on the `Condvar` + /// with a different `Mutex` object. + #[inline] + pub fn wait_until( + &self, + mutex_guard: &mut MutexGuard, + timeout: Instant, + ) -> WaitTimeoutResult { + self.wait_until_internal(guard_lock(mutex_guard), Some(timeout)) + } + + // This is a non-generic function to reduce the monomorphization cost of + // using `wait_until`. + fn wait_until_internal(&self, mutex: &RawMutex, timeout: Option) -> WaitTimeoutResult { + unsafe { + let result; + let mut bad_mutex = false; + let mut requeued = false; + { + let addr = self as *const _ as usize; + let lock_addr = mutex as *const _ as *mut _; + let validate = || { + // Ensure we don't use two different mutexes with the same + // Condvar at the same time. This is done while locked to + // avoid races with notify_one + let state = self.state.load(Ordering::Relaxed); + if state.is_null() { + self.state.store(lock_addr, Ordering::Relaxed); + } else if state != lock_addr { + bad_mutex = true; + return false; + } + true + }; + let before_sleep = || { + // Unlock the mutex before sleeping... + mutex.unlock(false); + }; + let timed_out = |k, was_last_thread| { + // If we were requeued to a mutex, then we did not time out. + // We'll just park ourselves on the mutex again when we try + // to lock it later. + requeued = k != addr; + + // If we were the last thread on the queue then we need to + // clear our state. This is normally done by the + // notify_{one,all} functions when not timing out. + if !requeued && was_last_thread { + self.state.store(ptr::null_mut(), Ordering::Relaxed); + } + }; + result = parking_lot_core::park( + addr, + validate, + before_sleep, + timed_out, + DEFAULT_PARK_TOKEN, + timeout, + ); + } + + // Panic if we tried to use multiple mutexes with a Condvar. Note + // that at this point the MutexGuard is still locked. It will be + // unlocked by the unwinding logic. + if bad_mutex { + panic!("attempted to use a condition variable with more than one mutex"); + } + + // ... and re-lock it once we are done sleeping + if result == ParkResult::Unparked(TOKEN_HANDOFF) { + deadlock::acquire_resource(mutex as *const _ as usize); + } else { + mutex.lock(); + } + + WaitTimeoutResult(!(result.is_unparked() || requeued)) + } + } + + /// Waits on this condition variable for a notification, timing out after a + /// specified duration. + /// + /// The semantics of this function are equivalent to `wait()` except that + /// the thread will be blocked for roughly no longer than `timeout`. This + /// method should not be used for precise timing due to anomalies such as + /// preemption or platform differences that may not cause the maximum + /// amount of time waited to be precisely `timeout`. + /// + /// Note that the best effort is made to ensure that the time waited is + /// measured with a monotonic clock, and not affected by the changes made to + /// the system time. + /// + /// The returned `WaitTimeoutResult` value indicates if the timeout is + /// known to have elapsed. + /// + /// Like `wait`, the lock specified will be re-acquired when this function + /// returns, regardless of whether the timeout elapsed or not. + #[inline] + pub fn wait_for( + &self, + guard: &mut MutexGuard, + timeout: Duration, + ) -> WaitTimeoutResult { + self.wait_until(guard, Instant::now() + timeout) + } +} + +impl Default for Condvar { + #[inline] + fn default() -> Condvar { + Condvar::new() + } +} + +#[cfg(test)] +mod tests { + use std::sync::mpsc::channel; + use std::sync::Arc; + use std::thread; + use std::time::{Duration, Instant}; + use {Condvar, Mutex}; + + #[test] + fn smoke() { + let c = Condvar::new(); + c.notify_one(); + c.notify_all(); + } + + #[test] + fn notify_one() { + let m = Arc::new(Mutex::new(())); + let m2 = m.clone(); + let c = Arc::new(Condvar::new()); + let c2 = c.clone(); + + let mut g = m.lock(); + let _t = thread::spawn(move || { + let _g = m2.lock(); + c2.notify_one(); + }); + c.wait(&mut g); + } + + #[test] + fn notify_all() { + const N: usize = 10; + + let data = Arc::new((Mutex::new(0), Condvar::new())); + let (tx, rx) = channel(); + for _ in 0..N { + let data = data.clone(); + let tx = tx.clone(); + thread::spawn(move || { + let &(ref lock, ref cond) = &*data; + let mut cnt = lock.lock(); + *cnt += 1; + if *cnt == N { + tx.send(()).unwrap(); + } + while *cnt != 0 { + cond.wait(&mut cnt); + } + tx.send(()).unwrap(); + }); + } + drop(tx); + + let &(ref lock, ref cond) = &*data; + rx.recv().unwrap(); + let mut cnt = lock.lock(); + *cnt = 0; + cond.notify_all(); + drop(cnt); + + for _ in 0..N { + rx.recv().unwrap(); + } + } + + #[test] + fn wait_for() { + let m = Arc::new(Mutex::new(())); + let m2 = m.clone(); + let c = Arc::new(Condvar::new()); + let c2 = c.clone(); + + let mut g = m.lock(); + let no_timeout = c.wait_for(&mut g, Duration::from_millis(1)); + assert!(no_timeout.timed_out()); + let _t = thread::spawn(move || { + let _g = m2.lock(); + c2.notify_one(); + }); + let timeout_res = c.wait_for(&mut g, Duration::from_millis(u32::max_value() as u64)); + assert!(!timeout_res.timed_out()); + drop(g); + } + + #[test] + fn wait_until() { + let m = Arc::new(Mutex::new(())); + let m2 = m.clone(); + let c = Arc::new(Condvar::new()); + let c2 = c.clone(); + + let mut g = m.lock(); + let no_timeout = c.wait_until(&mut g, Instant::now() + Duration::from_millis(1)); + assert!(no_timeout.timed_out()); + let _t = thread::spawn(move || { + let _g = m2.lock(); + c2.notify_one(); + }); + let timeout_res = c.wait_until( + &mut g, + Instant::now() + Duration::from_millis(u32::max_value() as u64), + ); + assert!(!timeout_res.timed_out()); + drop(g); + } + + #[test] + #[should_panic] + fn two_mutexes() { + let m = Arc::new(Mutex::new(())); + let m2 = m.clone(); + let m3 = Arc::new(Mutex::new(())); + let c = Arc::new(Condvar::new()); + let c2 = c.clone(); + + // Make sure we don't leave the child thread dangling + struct PanicGuard<'a>(&'a Condvar); + impl<'a> Drop for PanicGuard<'a> { + fn drop(&mut self) { + self.0.notify_one(); + } + } + + let (tx, rx) = channel(); + let g = m.lock(); + let _t = thread::spawn(move || { + let mut g = m2.lock(); + tx.send(()).unwrap(); + c2.wait(&mut g); + }); + drop(g); + rx.recv().unwrap(); + let _g = m.lock(); + let _guard = PanicGuard(&*c); + let _ = c.wait(&mut m3.lock()); + } + + #[test] + fn two_mutexes_disjoint() { + let m = Arc::new(Mutex::new(())); + let m2 = m.clone(); + let m3 = Arc::new(Mutex::new(())); + let c = Arc::new(Condvar::new()); + let c2 = c.clone(); + + let mut g = m.lock(); + let _t = thread::spawn(move || { + let _g = m2.lock(); + c2.notify_one(); + }); + c.wait(&mut g); + drop(g); + + let _ = c.wait_for(&mut m3.lock(), Duration::from_millis(1)); + } +} diff --git a/src/vendor/parking_lot/src/deadlock.rs b/src/vendor/parking_lot/src/deadlock.rs new file mode 100644 index 0000000000..8a83565dd0 --- /dev/null +++ b/src/vendor/parking_lot/src/deadlock.rs @@ -0,0 +1,219 @@ +//! [Experimental] Deadlock detection +//! +//! This feature is optional and can be enabled via the `deadlock_detection` feature flag. +//! +//! # Example +//! +//! ``` +//! #[cfg(feature = "deadlock_detection")] +//! { // only for #[cfg] +//! use std::thread; +//! use std::time::Duration; +//! use parking_lot::deadlock; +//! +//! // Create a background thread which checks for deadlocks every 10s +//! thread::spawn(move || { +//! loop { +//! thread::sleep(Duration::from_secs(10)); +//! let deadlocks = deadlock::check_deadlock(); +//! if deadlocks.is_empty() { +//! continue; +//! } +//! +//! println!("{} deadlocks detected", deadlocks.len()); +//! for (i, threads) in deadlocks.iter().enumerate() { +//! println!("Deadlock #{}", i); +//! for t in threads { +//! println!("Thread Id {:#?}", t.thread_id()); +//! println!("{:#?}", t.backtrace()); +//! } +//! } +//! } +//! }); +//! } // only for #[cfg] +//! ``` + + +#[cfg(feature = "deadlock_detection")] +pub use parking_lot_core::deadlock::check_deadlock; +pub(crate) use parking_lot_core::deadlock::{acquire_resource, release_resource}; + +#[cfg(test)] +#[cfg(feature = "deadlock_detection")] +mod tests { + use std::thread::{self, sleep}; + use std::sync::{Arc, Barrier}; + use std::time::Duration; + use {Mutex, ReentrantMutex, RwLock}; + + fn check_deadlock() -> bool { + use parking_lot_core::deadlock::check_deadlock; + !check_deadlock().is_empty() + } + + #[test] + fn test_mutex_deadlock() { + let m1: Arc> = Default::default(); + let m2: Arc> = Default::default(); + let m3: Arc> = Default::default(); + let b = Arc::new(Barrier::new(4)); + + let m1_ = m1.clone(); + let m2_ = m2.clone(); + let m3_ = m3.clone(); + let b1 = b.clone(); + let b2 = b.clone(); + let b3 = b.clone(); + + assert!(!check_deadlock()); + + let _t1 = thread::spawn(move || { + let _g = m1.lock(); + b1.wait(); + let _ = m2_.lock(); + }); + + let _t2 = thread::spawn(move || { + let _g = m2.lock(); + b2.wait(); + let _ = m3_.lock(); + }); + + let _t3 = thread::spawn(move || { + let _g = m3.lock(); + b3.wait(); + let _ = m1_.lock(); + }); + + assert!(!check_deadlock()); + + b.wait(); + sleep(Duration::from_millis(50)); + assert!(check_deadlock()); + + assert!(!check_deadlock()); + } + + #[test] + fn test_mutex_deadlock_reentrant() { + let m1: Arc> = Default::default(); + + assert!(!check_deadlock()); + + let _t1 = thread::spawn(move || { + let _g = m1.lock(); + let _ = m1.lock(); + }); + + sleep(Duration::from_millis(50)); + assert!(check_deadlock()); + + assert!(!check_deadlock()); + } + + #[test] + fn test_remutex_deadlock() { + let m1: Arc> = Default::default(); + let m2: Arc> = Default::default(); + let m3: Arc> = Default::default(); + let b = Arc::new(Barrier::new(4)); + + let m1_ = m1.clone(); + let m2_ = m2.clone(); + let m3_ = m3.clone(); + let b1 = b.clone(); + let b2 = b.clone(); + let b3 = b.clone(); + + assert!(!check_deadlock()); + + let _t1 = thread::spawn(move || { + let _g = m1.lock(); + let _g = m1.lock(); + b1.wait(); + let _ = m2_.lock(); + }); + + let _t2 = thread::spawn(move || { + let _g = m2.lock(); + let _g = m2.lock(); + b2.wait(); + let _ = m3_.lock(); + }); + + let _t3 = thread::spawn(move || { + let _g = m3.lock(); + let _g = m3.lock(); + b3.wait(); + let _ = m1_.lock(); + }); + + assert!(!check_deadlock()); + + b.wait(); + sleep(Duration::from_millis(50)); + assert!(check_deadlock()); + + assert!(!check_deadlock()); + } + + #[test] + fn test_rwlock_deadlock() { + let m1: Arc> = Default::default(); + let m2: Arc> = Default::default(); + let m3: Arc> = Default::default(); + let b = Arc::new(Barrier::new(4)); + + let m1_ = m1.clone(); + let m2_ = m2.clone(); + let m3_ = m3.clone(); + let b1 = b.clone(); + let b2 = b.clone(); + let b3 = b.clone(); + + assert!(!check_deadlock()); + + let _t1 = thread::spawn(move || { + let _g = m1.read(); + b1.wait(); + let _g = m2_.write(); + }); + + let _t2 = thread::spawn(move || { + let _g = m2.read(); + b2.wait(); + let _g = m3_.write(); + }); + + let _t3 = thread::spawn(move || { + let _g = m3.read(); + b3.wait(); + let _ = m1_.write(); + }); + + assert!(!check_deadlock()); + + b.wait(); + sleep(Duration::from_millis(50)); + assert!(check_deadlock()); + + assert!(!check_deadlock()); + } + + #[test] + fn test_rwlock_deadlock_reentrant() { + let m1: Arc> = Default::default(); + + assert!(!check_deadlock()); + + let _t1 = thread::spawn(move || { + let _g = m1.read(); + let _ = m1.write(); + }); + + sleep(Duration::from_millis(50)); + assert!(check_deadlock()); + + assert!(!check_deadlock()); + } +} diff --git a/src/vendor/parking_lot/src/elision.rs b/src/vendor/parking_lot/src/elision.rs new file mode 100644 index 0000000000..147601fd51 --- /dev/null +++ b/src/vendor/parking_lot/src/elision.rs @@ -0,0 +1,133 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::AtomicUsize; +#[cfg(not(feature = "nightly"))] +use stable::AtomicUsize; + +// Extension trait to add lock elision primitives to atomic types +pub trait AtomicElisionExt { + type IntType; + + // Perform a compare_exchange and start a transaction + fn elision_acquire( + &self, + current: Self::IntType, + new: Self::IntType, + ) -> Result; + // Perform a compare_exchange and end a transaction + fn elision_release( + &self, + current: Self::IntType, + new: Self::IntType, + ) -> Result; +} + +// Indicates whether the target architecture supports lock elision +#[inline] +pub fn have_elision() -> bool { + cfg!(all( + feature = "nightly", + any(target_arch = "x86", target_arch = "x86_64"), + )) +} + +// This implementation is never actually called because it is guarded by +// have_elision(). +#[cfg(not(all(feature = "nightly", any(target_arch = "x86", target_arch = "x86_64"))))] +impl AtomicElisionExt for AtomicUsize { + type IntType = usize; + + #[inline] + fn elision_acquire(&self, _: usize, _: usize) -> Result { + unreachable!(); + } + + #[inline] + fn elision_release(&self, _: usize, _: usize) -> Result { + unreachable!(); + } +} + +#[cfg(all(feature = "nightly", target_arch = "x86"))] +impl AtomicElisionExt for AtomicUsize { + type IntType = usize; + + #[inline] + fn elision_acquire(&self, current: usize, new: usize) -> Result { + unsafe { + let prev: usize; + asm!("xacquire; lock; cmpxchgl $2, $1" + : "={eax}" (prev), "+*m" (self) + : "r" (new), "{eax}" (current) + : "memory" + : "volatile"); + if prev == current { + Ok(prev) + } else { + Err(prev) + } + } + } + + #[inline] + fn elision_release(&self, current: usize, new: usize) -> Result { + unsafe { + let prev: usize; + asm!("xrelease; lock; cmpxchgl $2, $1" + : "={eax}" (prev), "+*m" (self) + : "r" (new), "{eax}" (current) + : "memory" + : "volatile"); + if prev == current { + Ok(prev) + } else { + Err(prev) + } + } + } +} + +#[cfg(all(feature = "nightly", target_arch = "x86_64"))] +impl AtomicElisionExt for AtomicUsize { + type IntType = usize; + + #[inline] + fn elision_acquire(&self, current: usize, new: usize) -> Result { + unsafe { + let prev: usize; + asm!("xacquire; lock; cmpxchgq $2, $1" + : "={rax}" (prev), "+*m" (self) + : "r" (new), "{rax}" (current) + : "memory" + : "volatile"); + if prev == current { + Ok(prev) + } else { + Err(prev) + } + } + } + + #[inline] + fn elision_release(&self, current: usize, new: usize) -> Result { + unsafe { + let prev: usize; + asm!("xrelease; lock; cmpxchgq $2, $1" + : "={rax}" (prev), "+*m" (self) + : "r" (new), "{rax}" (current) + : "memory" + : "volatile"); + if prev == current { + Ok(prev) + } else { + Err(prev) + } + } + } +} diff --git a/src/vendor/parking_lot/src/lib.rs b/src/vendor/parking_lot/src/lib.rs new file mode 100644 index 0000000000..32df19e617 --- /dev/null +++ b/src/vendor/parking_lot/src/lib.rs @@ -0,0 +1,75 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +//! This library provides implementations of `Mutex`, `RwLock`, `Condvar` and +//! `Once` that are smaller, faster and more flexible than those in the Rust +//! standard library. It also provides a `ReentrantMutex` type. + +#![warn(missing_docs)] +#![cfg_attr(feature = "nightly", feature(const_fn))] +#![cfg_attr(feature = "nightly", feature(const_atomic_u8_new))] +#![cfg_attr(feature = "nightly", feature(const_atomic_usize_new))] +#![cfg_attr(feature = "nightly", feature(const_cell_new))] +#![cfg_attr(feature = "nightly", feature(const_ptr_null_mut))] +#![cfg_attr(feature = "nightly", feature(const_atomic_ptr_new))] +#![cfg_attr(feature = "nightly", feature(const_unsafe_cell_new))] +#![cfg_attr(feature = "nightly", feature(const_size_of))] +#![cfg_attr(feature = "nightly", feature(integer_atomics))] +#![cfg_attr(feature = "nightly", feature(asm))] + +#[cfg(feature = "owning_ref")] +extern crate owning_ref; + +extern crate parking_lot_core; + +#[cfg(not(feature = "nightly"))] +mod stable; + +mod util; +mod elision; +mod raw_mutex; +mod raw_remutex; +mod raw_rwlock; +mod condvar; +mod mutex; +mod remutex; +mod rwlock; +mod once; + +#[cfg(feature = "deadlock_detection")] +pub mod deadlock; +#[cfg(not(feature = "deadlock_detection"))] +mod deadlock; + +pub use once::{Once, OnceState, ONCE_INIT}; +pub use mutex::{Mutex, MutexGuard}; +pub use remutex::{ReentrantMutex, ReentrantMutexGuard}; +pub use condvar::{Condvar, WaitTimeoutResult}; +pub use rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard, RwLockUpgradableReadGuard}; + +#[cfg(feature = "owning_ref")] +use owning_ref::OwningRef; + +/// Typedef of an owning reference that uses a `MutexGuard` as the owner. +#[cfg(feature = "owning_ref")] +pub type MutexGuardRef<'a, T, U = T> = OwningRef, U>; + +/// Typedef of an owning reference that uses a `ReentrantMutexGuard` as the owner. +#[cfg(feature = "owning_ref")] +pub type ReentrantMutexGuardRef<'a, T, U = T> = OwningRef, U>; + +/// Typedef of an owning reference that uses a `RwLockReadGuard` as the owner. +#[cfg(feature = "owning_ref")] +pub type RwLockReadGuardRef<'a, T, U = T> = OwningRef, U>; + +/// Typedef of an owning reference that uses a `RwLockWriteGuard` as the owner. +#[cfg(feature = "owning_ref")] +pub type RwLockWriteGuardRef<'a, T, U = T> = OwningRef, U>; + +/// Typedef of an owning reference that uses a `RwLockUpgradableReadGuard` as the owner. +#[cfg(feature = "owning_ref")] +pub type RwLockUpgradableReadGuardRef<'a, T, U = T> = OwningRef, U>; diff --git a/src/vendor/parking_lot/src/mutex.rs b/src/vendor/parking_lot/src/mutex.rs new file mode 100644 index 0000000000..f7a8b81094 --- /dev/null +++ b/src/vendor/parking_lot/src/mutex.rs @@ -0,0 +1,535 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::cell::UnsafeCell; +use std::ops::{Deref, DerefMut}; +use std::time::{Duration, Instant}; +use std::fmt; +use std::mem; +use std::marker::PhantomData; +use raw_mutex::RawMutex; + +#[cfg(feature = "owning_ref")] +use owning_ref::StableAddress; + +/// A mutual exclusion primitive useful for protecting shared data +/// +/// This mutex will block threads waiting for the lock to become available. The +/// mutex can also be statically initialized or created via a `new` +/// constructor. Each mutex has a type parameter which represents the data that +/// it is protecting. The data can only be accessed through the RAII guards +/// returned from `lock` and `try_lock`, which guarantees that the data is only +/// ever accessed when the mutex is locked. +/// +/// # Fairness +/// +/// A typical unfair lock can often end up in a situation where a single thread +/// quickly acquires and releases the same mutex in succession, which can starve +/// other threads waiting to acquire the mutex. While this improves performance +/// because it doesn't force a context switch when a thread tries to re-acquire +/// a mutex it has just released, this can starve other threads. +/// +/// This mutex uses [eventual fairness](https://trac.webkit.org/changeset/203350) +/// to ensure that the lock will be fair on average without sacrificing +/// performance. This is done by forcing a fair unlock on average every 0.5ms, +/// which will force the lock to go to the next thread waiting for the mutex. +/// +/// Additionally, any critical section longer than 1ms will always use a fair +/// unlock, which has a negligible performance impact compared to the length of +/// the critical section. +/// +/// You can also force a fair unlock by calling `MutexGuard::unlock_fair` when +/// unlocking a mutex instead of simply dropping the `MutexGuard`. +/// +/// # Differences from the standard library `Mutex` +/// +/// - No poisoning, the lock is released normally on panic. +/// - Only requires 1 byte of space, whereas the standard library boxes the +/// `Mutex` due to platform limitations. +/// - Can be statically constructed (requires the `const_fn` nightly feature). +/// - Does not require any drop glue when dropped. +/// - Inline fast path for the uncontended case. +/// - Efficient handling of micro-contention using adaptive spinning. +/// - Allows raw locking & unlocking without a guard. +/// - Supports eventual fairness so that the mutex is fair on average. +/// - Optionally allows making the mutex fair by calling `MutexGuard::unlock_fair`. +/// +/// # Examples +/// +/// ``` +/// use std::sync::Arc; +/// use parking_lot::Mutex; +/// use std::thread; +/// use std::sync::mpsc::channel; +/// +/// const N: usize = 10; +/// +/// // Spawn a few threads to increment a shared variable (non-atomically), and +/// // let the main thread know once all increments are done. +/// // +/// // Here we're using an Arc to share memory among threads, and the data inside +/// // the Arc is protected with a mutex. +/// let data = Arc::new(Mutex::new(0)); +/// +/// let (tx, rx) = channel(); +/// for _ in 0..10 { +/// let (data, tx) = (data.clone(), tx.clone()); +/// thread::spawn(move || { +/// // The shared state can only be accessed once the lock is held. +/// // Our non-atomic increment is safe because we're the only thread +/// // which can access the shared state when the lock is held. +/// let mut data = data.lock(); +/// *data += 1; +/// if *data == N { +/// tx.send(()).unwrap(); +/// } +/// // the lock is unlocked here when `data` goes out of scope. +/// }); +/// } +/// +/// rx.recv().unwrap(); +/// ``` +pub struct Mutex { + raw: RawMutex, + data: UnsafeCell, +} + +unsafe impl Send for Mutex {} +unsafe impl Sync for Mutex {} + +/// An RAII implementation of a "scoped lock" of a mutex. When this structure is +/// dropped (falls out of scope), the lock will be unlocked. +/// +/// The data protected by the mutex can be accessed through this guard via its +/// `Deref` and `DerefMut` implementations. +#[must_use] +pub struct MutexGuard<'a, T: ?Sized + 'a> { + raw: &'a RawMutex, + data: *mut T, + marker: PhantomData<&'a mut T>, +} + +unsafe impl<'a, T: ?Sized + Sync + 'a> Sync for MutexGuard<'a, T> {} + +impl Mutex { + /// Creates a new mutex in an unlocked state ready for use. + #[cfg(feature = "nightly")] + #[inline] + pub const fn new(val: T) -> Mutex { + Mutex { + data: UnsafeCell::new(val), + raw: RawMutex::new(), + } + } + + /// Creates a new mutex in an unlocked state ready for use. + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new(val: T) -> Mutex { + Mutex { + data: UnsafeCell::new(val), + raw: RawMutex::new(), + } + } + + /// Consumes this mutex, returning the underlying data. + #[inline] + pub fn into_inner(self) -> T { + unsafe { self.data.into_inner() } + } +} + +impl Mutex { + #[inline] + fn guard(&self) -> MutexGuard { + MutexGuard { + raw: &self.raw, + data: self.data.get(), + marker: PhantomData, + } + } + + /// Acquires a mutex, blocking the current thread until it is able to do so. + /// + /// This function will block the local thread until it is available to acquire + /// the mutex. Upon returning, the thread is the only thread with the mutex + /// held. An RAII guard is returned to allow scoped unlock of the lock. When + /// the guard goes out of scope, the mutex will be unlocked. + /// + /// Attempts to lock a mutex in the thread which already holds the lock will + /// result in a deadlock. + #[inline] + pub fn lock(&self) -> MutexGuard { + self.raw.lock(); + self.guard() + } + + /// Attempts to acquire this lock. + /// + /// If the lock could not be acquired at this time, then `None` is returned. + /// Otherwise, an RAII guard is returned. The lock will be unlocked when the + /// guard is dropped. + /// + /// This function does not block. + #[inline] + pub fn try_lock(&self) -> Option> { + if self.raw.try_lock() { + Some(self.guard()) + } else { + None + } + } + + /// Attempts to acquire this lock until a timeout is reached. + /// + /// If the lock could not be acquired before the timeout expired, then + /// `None` is returned. Otherwise, an RAII guard is returned. The lock will + /// be unlocked when the guard is dropped. + #[inline] + pub fn try_lock_for(&self, timeout: Duration) -> Option> { + if self.raw.try_lock_for(timeout) { + Some(self.guard()) + } else { + None + } + } + + /// Attempts to acquire this lock until a timeout is reached. + /// + /// If the lock could not be acquired before the timeout expired, then + /// `None` is returned. Otherwise, an RAII guard is returned. The lock will + /// be unlocked when the guard is dropped. + #[inline] + pub fn try_lock_until(&self, timeout: Instant) -> Option> { + if self.raw.try_lock_until(timeout) { + Some(self.guard()) + } else { + None + } + } + + /// Returns a mutable reference to the underlying data. + /// + /// Since this call borrows the `Mutex` mutably, no actual locking needs to + /// take place---the mutable borrow statically guarantees no locks exist. + #[inline] + pub fn get_mut(&mut self) -> &mut T { + unsafe { &mut *self.data.get() } + } + + /// Releases the mutex. + /// + /// # Safety + /// + /// This function must only be called if the mutex was locked using + /// `raw_lock` or `raw_try_lock`, or if a `MutexGuard` from this mutex was + /// leaked (e.g. with `mem::forget`). The mutex must be locked. + #[inline] + pub unsafe fn raw_unlock(&self) { + self.raw.unlock(false); + } + + /// Releases the mutex using a fair unlock protocol. + /// + /// See `MutexGuard::unlock_fair`. + /// + /// # Safety + /// + /// This function must only be called if the mutex was locked using + /// `raw_lock` or `raw_try_lock`, or if a `MutexGuard` from this mutex was + /// leaked (e.g. with `mem::forget`). The mutex must be locked. + #[inline] + pub unsafe fn raw_unlock_fair(&self) { + self.raw.unlock(true); + } +} +impl Mutex<()> { + /// Acquires a mutex, blocking the current thread until it is able to do so. + /// + /// This is similar to `lock`, except that a `MutexGuard` is not returned. + /// Instead you will need to call `raw_unlock` to release the mutex. + #[inline] + pub fn raw_lock(&self) { + self.raw.lock(); + } + + /// Attempts to acquire this lock. + /// + /// This is similar to `try_lock`, except that a `MutexGuard` is not + /// returned. Instead you will need to call `raw_unlock` to release the + /// mutex. + #[inline] + pub fn raw_try_lock(&self) -> bool { + self.raw.try_lock() + } +} + +impl Default for Mutex { + #[inline] + fn default() -> Mutex { + Mutex::new(Default::default()) + } +} + +impl fmt::Debug for Mutex { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.try_lock() { + Some(guard) => write!(f, "Mutex {{ data: {:?} }}", &*guard), + None => write!(f, "Mutex {{ }}"), + } + } +} + +impl<'a, T: ?Sized + 'a> MutexGuard<'a, T> { + /// Unlocks the mutex using a fair unlock protocol. + /// + /// By default, mutexes are unfair and allow the current thread to re-lock + /// the mutex before another has the chance to acquire the lock, even if + /// that thread has been blocked on the mutex for a long time. This is the + /// default because it allows much higher throughput as it avoids forcing a + /// context switch on every mutex unlock. This can result in one thread + /// acquiring a mutex many more times than other threads. + /// + /// However in some cases it can be beneficial to ensure fairness by forcing + /// the lock to pass on to a waiting thread if there is one. This is done by + /// using this method instead of dropping the `MutexGuard` normally. + #[inline] + pub fn unlock_fair(self) { + self.raw.unlock(true); + mem::forget(self); + } + + /// Make a new `MutexGuard` for a component of the locked data. + /// + /// This operation cannot fail as the `MutexGuard` passed + /// in already locked the mutex. + /// + /// This is an associated function that needs to be + /// used as `MutexGuard::map(...)`. A method would interfere with methods of + /// the same name on the contents of the locked data. + #[inline] + pub fn map(orig: Self, f: F) -> MutexGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + { + let raw = orig.raw; + let data = f(unsafe { &mut *orig.data }); + mem::forget(orig); + MutexGuard { + raw, + data, + marker: PhantomData, + } + } +} + +impl<'a, T: ?Sized + 'a> Deref for MutexGuard<'a, T> { + type Target = T; + #[inline] + fn deref(&self) -> &T { + unsafe { &*self.data } + } +} + +impl<'a, T: ?Sized + 'a> DerefMut for MutexGuard<'a, T> { + #[inline] + fn deref_mut(&mut self) -> &mut T { + unsafe { &mut *self.data } + } +} + +impl<'a, T: ?Sized + 'a> Drop for MutexGuard<'a, T> { + #[inline] + fn drop(&mut self) { + self.raw.unlock(false); + } +} + +#[cfg(feature = "owning_ref")] +unsafe impl<'a, T: ?Sized> StableAddress for MutexGuard<'a, T> {} + +// Helper function used by Condvar, not publicly exported +#[inline] +pub(crate) fn guard_lock<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a RawMutex { + &guard.raw +} + +#[cfg(test)] +mod tests { + use std::sync::mpsc::channel; + use std::sync::Arc; + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::thread; + use {Condvar, Mutex}; + + struct Packet(Arc<(Mutex, Condvar)>); + + #[derive(Eq, PartialEq, Debug)] + struct NonCopy(i32); + + unsafe impl Send for Packet {} + unsafe impl Sync for Packet {} + + #[test] + fn smoke() { + let m = Mutex::new(()); + drop(m.lock()); + drop(m.lock()); + } + + #[test] + fn lots_and_lots() { + const J: u32 = 1000; + const K: u32 = 3; + + let m = Arc::new(Mutex::new(0)); + + fn inc(m: &Mutex) { + for _ in 0..J { + *m.lock() += 1; + } + } + + let (tx, rx) = channel(); + for _ in 0..K { + let tx2 = tx.clone(); + let m2 = m.clone(); + thread::spawn(move || { + inc(&m2); + tx2.send(()).unwrap(); + }); + let tx2 = tx.clone(); + let m2 = m.clone(); + thread::spawn(move || { + inc(&m2); + tx2.send(()).unwrap(); + }); + } + + drop(tx); + for _ in 0..2 * K { + rx.recv().unwrap(); + } + assert_eq!(*m.lock(), J * K * 2); + } + + #[test] + fn try_lock() { + let m = Mutex::new(()); + *m.try_lock().unwrap() = (); + } + + #[test] + fn test_into_inner() { + let m = Mutex::new(NonCopy(10)); + assert_eq!(m.into_inner(), NonCopy(10)); + } + + #[test] + fn test_into_inner_drop() { + struct Foo(Arc); + impl Drop for Foo { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } + } + let num_drops = Arc::new(AtomicUsize::new(0)); + let m = Mutex::new(Foo(num_drops.clone())); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + { + let _inner = m.into_inner(); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + } + assert_eq!(num_drops.load(Ordering::SeqCst), 1); + } + + #[test] + fn test_get_mut() { + let mut m = Mutex::new(NonCopy(10)); + *m.get_mut() = NonCopy(20); + assert_eq!(m.into_inner(), NonCopy(20)); + } + + #[test] + fn test_mutex_arc_condvar() { + let packet = Packet(Arc::new((Mutex::new(false), Condvar::new()))); + let packet2 = Packet(packet.0.clone()); + let (tx, rx) = channel(); + let _t = thread::spawn(move || { + // wait until parent gets in + rx.recv().unwrap(); + let &(ref lock, ref cvar) = &*packet2.0; + let mut lock = lock.lock(); + *lock = true; + cvar.notify_one(); + }); + + let &(ref lock, ref cvar) = &*packet.0; + let mut lock = lock.lock(); + tx.send(()).unwrap(); + assert!(!*lock); + while !*lock { + cvar.wait(&mut lock); + } + } + + #[test] + fn test_mutex_arc_nested() { + // Tests nested mutexes and access + // to underlying data. + let arc = Arc::new(Mutex::new(1)); + let arc2 = Arc::new(Mutex::new(arc)); + let (tx, rx) = channel(); + let _t = thread::spawn(move || { + let lock = arc2.lock(); + let lock2 = lock.lock(); + assert_eq!(*lock2, 1); + tx.send(()).unwrap(); + }); + rx.recv().unwrap(); + } + + #[test] + fn test_mutex_arc_access_in_unwind() { + let arc = Arc::new(Mutex::new(1)); + let arc2 = arc.clone(); + let _ = thread::spawn(move || -> () { + struct Unwinder { + i: Arc>, + } + impl Drop for Unwinder { + fn drop(&mut self) { + *self.i.lock() += 1; + } + } + let _u = Unwinder { i: arc2 }; + panic!(); + }).join(); + let lock = arc.lock(); + assert_eq!(*lock, 2); + } + + #[test] + fn test_mutex_unsized() { + let mutex: &Mutex<[i32]> = &Mutex::new([1, 2, 3]); + { + let b = &mut *mutex.lock(); + b[0] = 4; + b[2] = 5; + } + let comp: &[i32] = &[4, 2, 5]; + assert_eq!(&*mutex.lock(), comp); + } + + #[test] + fn test_mutexguard_sync() { + fn sync(_: T) {} + + let mutex = Mutex::new(()); + sync(mutex.lock()); + } +} diff --git a/src/vendor/parking_lot/src/once.rs b/src/vendor/parking_lot/src/once.rs new file mode 100644 index 0000000000..9fc53ec0ea --- /dev/null +++ b/src/vendor/parking_lot/src/once.rs @@ -0,0 +1,470 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{fence, ATOMIC_U8_INIT, AtomicU8, Ordering}; +#[cfg(feature = "nightly")] +type U8 = u8; +#[cfg(not(feature = "nightly"))] +use stable::{fence, ATOMIC_U8_INIT, AtomicU8, Ordering}; +#[cfg(not(feature = "nightly"))] +type U8 = usize; +use std::mem; +use std::fmt; +use parking_lot_core::{self, SpinWait, DEFAULT_PARK_TOKEN, DEFAULT_UNPARK_TOKEN}; +use util::UncheckedOptionExt; + +const DONE_BIT: U8 = 1; +const POISON_BIT: U8 = 2; +const LOCKED_BIT: U8 = 4; +const PARKED_BIT: U8 = 8; + +/// Current state of a `Once`. +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub enum OnceState { + /// A closure has not been executed yet + New, + + /// A closure was executed but panicked. + Poisoned, + + /// A thread is currently executing a closure. + InProgress, + + /// A closure has completed sucessfully. + Done, +} + +impl OnceState { + /// Returns whether the associated `Once` has been poisoned. + /// + /// Once an initalization routine for a `Once` has panicked it will forever + /// indicate to future forced initialization routines that it is poisoned. + #[inline] + pub fn poisoned(&self) -> bool { + match *self { + OnceState::Poisoned => true, + _ => false, + } + } + + /// Returns whether the associated `Once` has successfullly executed a + /// closure. + #[inline] + pub fn done(&self) -> bool { + match *self { + OnceState::Done => true, + _ => false, + } + } +} + +/// A synchronization primitive which can be used to run a one-time +/// initialization. Useful for one-time initialization for globals, FFI or +/// related functionality. +/// +/// # Differences from the standard library `Once` +/// +/// - Only requires 1 byte of space, instead of 1 word. +/// - Not required to be `'static`. +/// - Relaxed memory barriers in the fast path, which can significantly improve +/// performance on some architectures. +/// - Efficient handling of micro-contention using adaptive spinning. +/// +/// # Examples +/// +/// ``` +/// use parking_lot::{Once, ONCE_INIT}; +/// +/// static START: Once = ONCE_INIT; +/// +/// START.call_once(|| { +/// // run initialization here +/// }); +/// ``` +pub struct Once(AtomicU8); + +/// Initialization value for static `Once` values. +pub const ONCE_INIT: Once = Once(ATOMIC_U8_INIT); + +impl Once { + /// Creates a new `Once` value. + #[cfg(feature = "nightly")] + #[inline] + pub const fn new() -> Once { + Once(AtomicU8::new(0)) + } + + /// Creates a new `Once` value. + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new() -> Once { + Once(AtomicU8::new(0)) + } + + /// Returns the current state of this `Once`. + #[inline] + pub fn state(&self) -> OnceState { + let state = self.0.load(Ordering::Acquire); + if state & DONE_BIT != 0 { + OnceState::Done + } else if state & LOCKED_BIT != 0 { + OnceState::InProgress + } else if state & POISON_BIT != 0 { + OnceState::Poisoned + } else { + OnceState::New + } + } + + /// Performs an initialization routine once and only once. The given closure + /// will be executed if this is the first time `call_once` has been called, + /// and otherwise the routine will *not* be invoked. + /// + /// This method will block the calling thread if another initialization + /// routine is currently running. + /// + /// When this function returns, it is guaranteed that some initialization + /// has run and completed (it may not be the closure specified). It is also + /// guaranteed that any memory writes performed by the executed closure can + /// be reliably observed by other threads at this point (there is a + /// happens-before relation between the closure and code executing after the + /// return). + /// + /// # Examples + /// + /// ``` + /// use parking_lot::{Once, ONCE_INIT}; + /// + /// static mut VAL: usize = 0; + /// static INIT: Once = ONCE_INIT; + /// + /// // Accessing a `static mut` is unsafe much of the time, but if we do so + /// // in a synchronized fashion (e.g. write once or read all) then we're + /// // good to go! + /// // + /// // This function will only call `expensive_computation` once, and will + /// // otherwise always return the value returned from the first invocation. + /// fn get_cached_val() -> usize { + /// unsafe { + /// INIT.call_once(|| { + /// VAL = expensive_computation(); + /// }); + /// VAL + /// } + /// } + /// + /// fn expensive_computation() -> usize { + /// // ... + /// # 2 + /// } + /// ``` + /// + /// # Panics + /// + /// The closure `f` will only be executed once if this is called + /// concurrently amongst many threads. If that closure panics, however, then + /// it will *poison* this `Once` instance, causing all future invocations of + /// `call_once` to also panic. + #[inline] + pub fn call_once(&self, f: F) + where + F: FnOnce(), + { + if self.0.load(Ordering::Acquire) == DONE_BIT { + return; + } + + let mut f = Some(f); + self.call_once_slow(false, &mut |_| unsafe { f.take().unchecked_unwrap()() }); + } + + /// Performs the same function as `call_once` except ignores poisoning. + /// + /// If this `Once` has been poisoned (some initialization panicked) then + /// this function will continue to attempt to call initialization functions + /// until one of them doesn't panic. + /// + /// The closure `f` is yielded a structure which can be used to query the + /// state of this `Once` (whether initialization has previously panicked or + /// not). + #[inline] + pub fn call_once_force(&self, f: F) + where + F: FnOnce(OnceState), + { + if self.0.load(Ordering::Acquire) == DONE_BIT { + return; + } + + let mut f = Some(f); + self.call_once_slow(true, &mut |state| unsafe { + f.take().unchecked_unwrap()(state) + }); + } + + // This is a non-generic function to reduce the monomorphization cost of + // using `call_once` (this isn't exactly a trivial or small implementation). + // + // Additionally, this is tagged with `#[cold]` as it should indeed be cold + // and it helps let LLVM know that calls to this function should be off the + // fast path. Essentially, this should help generate more straight line code + // in LLVM. + // + // Finally, this takes an `FnMut` instead of a `FnOnce` because there's + // currently no way to take an `FnOnce` and call it via virtual dispatch + // without some allocation overhead. + #[cold] + #[inline(never)] + fn call_once_slow(&self, ignore_poison: bool, f: &mut FnMut(OnceState)) { + let mut spinwait = SpinWait::new(); + let mut state = self.0.load(Ordering::Relaxed); + loop { + // If another thread called the closure, we're done + if state & DONE_BIT != 0 { + // An acquire fence is needed here since we didn't load the + // state with Ordering::Acquire. + fence(Ordering::Acquire); + return; + } + + // If the state has been poisoned and we aren't forcing, then panic + if state & POISON_BIT != 0 && !ignore_poison { + // Need the fence here as well for the same reason + fence(Ordering::Acquire); + panic!("Once instance has previously been poisoned"); + } + + // Grab the lock if it isn't locked, even if there is a queue on it. + // We also clear the poison bit since we are going to try running + // the closure again. + if state & LOCKED_BIT == 0 { + match self.0.compare_exchange_weak( + state, + (state | LOCKED_BIT) & !POISON_BIT, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => break, + Err(x) => state = x, + } + continue; + } + + // If there is no queue, try spinning a few times + if state & PARKED_BIT == 0 && spinwait.spin() { + state = self.0.load(Ordering::Relaxed); + continue; + } + + // Set the parked bit + if state & PARKED_BIT == 0 { + if let Err(x) = self.0.compare_exchange_weak( + state, + state | PARKED_BIT, + Ordering::Relaxed, + Ordering::Relaxed, + ) { + state = x; + continue; + } + } + + // Park our thread until we are woken up by the thread that owns the + // lock. + unsafe { + let addr = self as *const _ as usize; + let validate = || self.0.load(Ordering::Relaxed) == LOCKED_BIT | PARKED_BIT; + let before_sleep = || {}; + let timed_out = |_, _| unreachable!(); + parking_lot_core::park( + addr, + validate, + before_sleep, + timed_out, + DEFAULT_PARK_TOKEN, + None, + ); + } + + // Loop back and check if the done bit was set + spinwait.reset(); + state = self.0.load(Ordering::Relaxed); + } + + struct PanicGuard<'a>(&'a Once); + impl<'a> Drop for PanicGuard<'a> { + fn drop(&mut self) { + // Mark the state as poisoned, unlock it and unpark all threads. + let once = self.0; + let state = once.0.swap(POISON_BIT, Ordering::Release); + if state & PARKED_BIT != 0 { + unsafe { + let addr = once as *const _ as usize; + parking_lot_core::unpark_all(addr, DEFAULT_UNPARK_TOKEN); + } + } + } + } + + // At this point we have the lock, so run the closure. Make sure we + // properly clean up if the closure panicks. + let guard = PanicGuard(self); + let once_state = if state & POISON_BIT != 0 { + OnceState::Poisoned + } else { + OnceState::New + }; + f(once_state); + mem::forget(guard); + + // Now unlock the state, set the done bit and unpark all threads + let state = self.0.swap(DONE_BIT, Ordering::Release); + if state & PARKED_BIT != 0 { + unsafe { + let addr = self as *const _ as usize; + parking_lot_core::unpark_all(addr, DEFAULT_UNPARK_TOKEN); + } + } + } +} + +impl Default for Once { + #[inline] + fn default() -> Once { + Once::new() + } +} + +impl fmt::Debug for Once { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Once {{ state: {:?} }}", &self.state()) + } +} + +#[cfg(test)] +mod tests { + #[cfg(feature = "nightly")] + use std::panic; + use std::sync::mpsc::channel; + use std::thread; + use {Once, ONCE_INIT}; + + #[test] + fn smoke_once() { + static O: Once = ONCE_INIT; + let mut a = 0; + O.call_once(|| a += 1); + assert_eq!(a, 1); + O.call_once(|| a += 1); + assert_eq!(a, 1); + } + + #[test] + fn stampede_once() { + static O: Once = ONCE_INIT; + static mut RUN: bool = false; + + let (tx, rx) = channel(); + for _ in 0..10 { + let tx = tx.clone(); + thread::spawn(move || { + for _ in 0..4 { + thread::yield_now() + } + unsafe { + O.call_once(|| { + assert!(!RUN); + RUN = true; + }); + assert!(RUN); + } + tx.send(()).unwrap(); + }); + } + + unsafe { + O.call_once(|| { + assert!(!RUN); + RUN = true; + }); + assert!(RUN); + } + + for _ in 0..10 { + rx.recv().unwrap(); + } + } + + #[cfg(feature = "nightly")] + #[test] + fn poison_bad() { + static O: Once = ONCE_INIT; + + // poison the once + let t = panic::catch_unwind(|| { + O.call_once(|| panic!()); + }); + assert!(t.is_err()); + + // poisoning propagates + let t = panic::catch_unwind(|| { + O.call_once(|| {}); + }); + assert!(t.is_err()); + + // we can subvert poisoning, however + let mut called = false; + O.call_once_force(|p| { + called = true; + assert!(p.poisoned()) + }); + assert!(called); + + // once any success happens, we stop propagating the poison + O.call_once(|| {}); + } + + #[cfg(feature = "nightly")] + #[test] + fn wait_for_force_to_finish() { + static O: Once = ONCE_INIT; + + // poison the once + let t = panic::catch_unwind(|| { + O.call_once(|| panic!()); + }); + assert!(t.is_err()); + + // make sure someone's waiting inside the once via a force + let (tx1, rx1) = channel(); + let (tx2, rx2) = channel(); + let t1 = thread::spawn(move || { + O.call_once_force(|p| { + assert!(p.poisoned()); + tx1.send(()).unwrap(); + rx2.recv().unwrap(); + }); + }); + + rx1.recv().unwrap(); + + // put another waiter on the once + let t2 = thread::spawn(|| { + let mut called = false; + O.call_once(|| { + called = true; + }); + assert!(!called); + }); + + tx2.send(()).unwrap(); + + assert!(t1.join().is_ok()); + assert!(t2.join().is_ok()); + } +} diff --git a/src/vendor/parking_lot/src/raw_mutex.rs b/src/vendor/parking_lot/src/raw_mutex.rs new file mode 100644 index 0000000000..891082361e --- /dev/null +++ b/src/vendor/parking_lot/src/raw_mutex.rs @@ -0,0 +1,274 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{AtomicU8, Ordering}; +#[cfg(feature = "nightly")] +type U8 = u8; +#[cfg(not(feature = "nightly"))] +use stable::{AtomicU8, Ordering}; +#[cfg(not(feature = "nightly"))] +type U8 = usize; +use std::time::{Duration, Instant}; +use parking_lot_core::{self, ParkResult, SpinWait, UnparkResult, UnparkToken, DEFAULT_PARK_TOKEN}; +use deadlock; + +// UnparkToken used to indicate that that the target thread should attempt to +// lock the mutex again as soon as it is unparked. +pub const TOKEN_NORMAL: UnparkToken = UnparkToken(0); + +// UnparkToken used to indicate that the mutex is being handed off to the target +// thread directly without unlocking it. +pub const TOKEN_HANDOFF: UnparkToken = UnparkToken(1); + +const LOCKED_BIT: U8 = 1; +const PARKED_BIT: U8 = 2; + +pub struct RawMutex { + state: AtomicU8, +} + +impl RawMutex { + #[cfg(feature = "nightly")] + #[inline] + pub const fn new() -> RawMutex { + RawMutex { + state: AtomicU8::new(0), + } + } + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new() -> RawMutex { + RawMutex { + state: AtomicU8::new(0), + } + } + + #[inline] + pub fn lock(&self) { + if self.state + .compare_exchange_weak(0, LOCKED_BIT, Ordering::Acquire, Ordering::Relaxed) + .is_err() + { + self.lock_slow(None); + } + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + + #[inline] + pub fn try_lock_until(&self, timeout: Instant) -> bool { + let result = if self.state + .compare_exchange_weak(0, LOCKED_BIT, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + { + true + } else { + self.lock_slow(Some(timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock_for(&self, timeout: Duration) -> bool { + let result = if self.state + .compare_exchange_weak(0, LOCKED_BIT, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + { + true + } else { + self.lock_slow(Some(Instant::now() + timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock(&self) -> bool { + let mut state = self.state.load(Ordering::Relaxed); + loop { + if state & LOCKED_BIT != 0 { + return false; + } + match self.state.compare_exchange_weak( + state, + state | LOCKED_BIT, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + return true; + } + Err(x) => state = x, + } + } + } + + #[inline] + pub fn unlock(&self, force_fair: bool) { + unsafe { deadlock::release_resource(self as *const _ as usize) }; + if self.state + .compare_exchange_weak(LOCKED_BIT, 0, Ordering::Release, Ordering::Relaxed) + .is_ok() + { + return; + } + self.unlock_slow(force_fair); + } + + // Used by Condvar when requeuing threads to us, must be called while + // holding the queue lock. + #[inline] + pub(crate) fn mark_parked_if_locked(&self) -> bool { + let mut state = self.state.load(Ordering::Relaxed); + loop { + if state & LOCKED_BIT == 0 { + return false; + } + match self.state.compare_exchange_weak( + state, + state | PARKED_BIT, + Ordering::Relaxed, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + } + } + + // Used by Condvar when requeuing threads to us, must be called while + // holding the queue lock. + #[inline] + pub(crate) fn mark_parked(&self) { + self.state.fetch_or(PARKED_BIT, Ordering::Relaxed); + } + + #[cold] + #[inline(never)] + fn lock_slow(&self, timeout: Option) -> bool { + let mut spinwait = SpinWait::new(); + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Grab the lock if it isn't locked, even if there is a queue on it + if state & LOCKED_BIT == 0 { + match self.state.compare_exchange_weak( + state, + state | LOCKED_BIT, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + continue; + } + + // If there is no queue, try spinning a few times + if state & PARKED_BIT == 0 && spinwait.spin() { + state = self.state.load(Ordering::Relaxed); + continue; + } + + // Set the parked bit + if state & PARKED_BIT == 0 { + if let Err(x) = self.state.compare_exchange_weak( + state, + state | PARKED_BIT, + Ordering::Relaxed, + Ordering::Relaxed, + ) { + state = x; + continue; + } + } + + // Park our thread until we are woken up by an unlock + unsafe { + let addr = self as *const _ as usize; + let validate = || self.state.load(Ordering::Relaxed) == LOCKED_BIT | PARKED_BIT; + let before_sleep = || {}; + let timed_out = |_, was_last_thread| { + // Clear the parked bit if we were the last parked thread + if was_last_thread { + self.state.fetch_and(!PARKED_BIT, Ordering::Relaxed); + } + }; + match parking_lot_core::park( + addr, + validate, + before_sleep, + timed_out, + DEFAULT_PARK_TOKEN, + timeout, + ) { + // The thread that unparked us passed the lock on to us + // directly without unlocking it. + ParkResult::Unparked(TOKEN_HANDOFF) => return true, + + // We were unparked normally, try acquiring the lock again + ParkResult::Unparked(_) => (), + + // The validation function failed, try locking again + ParkResult::Invalid => (), + + // Timeout expired + ParkResult::TimedOut => return false, + } + } + + // Loop back and try locking again + spinwait.reset(); + state = self.state.load(Ordering::Relaxed); + } + } + + #[cold] + #[inline(never)] + fn unlock_slow(&self, force_fair: bool) { + // Unlock directly if there are no parked threads + if self.state + .compare_exchange(LOCKED_BIT, 0, Ordering::Release, Ordering::Relaxed) + .is_ok() + { + return; + } + + // Unpark one thread and leave the parked bit set if there might + // still be parked threads on this address. + unsafe { + let addr = self as *const _ as usize; + let callback = |result: UnparkResult| { + // If we are using a fair unlock then we should keep the + // mutex locked and hand it off to the unparked thread. + if result.unparked_threads != 0 && (force_fair || result.be_fair) { + // Clear the parked bit if there are no more parked + // threads. + if !result.have_more_threads { + self.state.store(LOCKED_BIT, Ordering::Relaxed); + } + return TOKEN_HANDOFF; + } + + // Clear the locked bit, and the parked bit as well if there + // are no more parked threads. + if result.have_more_threads { + self.state.store(PARKED_BIT, Ordering::Release); + } else { + self.state.store(0, Ordering::Release); + } + TOKEN_NORMAL + }; + parking_lot_core::unpark_one(addr, callback); + } + } +} diff --git a/src/vendor/parking_lot/src/raw_remutex.rs b/src/vendor/parking_lot/src/raw_remutex.rs new file mode 100644 index 0000000000..5387d7180e --- /dev/null +++ b/src/vendor/parking_lot/src/raw_remutex.rs @@ -0,0 +1,102 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::time::{Duration, Instant}; +use std::cell::Cell; +use raw_mutex::RawMutex; + +// Helper function to get a thread id +fn get_thread_id() -> usize { + // The address of a thread-local variable is guaranteed to be unique to the + // current thread, and is also guaranteed to be non-zero. + thread_local!(static KEY: u8 = unsafe { ::std::mem::uninitialized() }); + KEY.with(|x| x as *const _ as usize) +} + +pub struct RawReentrantMutex { + owner: AtomicUsize, + lock_count: Cell, + mutex: RawMutex, +} + +unsafe impl Sync for RawReentrantMutex {} + +impl RawReentrantMutex { + #[cfg(feature = "nightly")] + #[inline] + pub const fn new() -> RawReentrantMutex { + RawReentrantMutex { + owner: AtomicUsize::new(0), + lock_count: Cell::new(0), + mutex: RawMutex::new(), + } + } + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new() -> RawReentrantMutex { + RawReentrantMutex { + owner: AtomicUsize::new(0), + lock_count: Cell::new(0), + mutex: RawMutex::new(), + } + } + + #[inline] + fn lock_internal bool>(&self, try_lock: F) -> bool { + let id = get_thread_id(); + if self.owner.load(Ordering::Relaxed) == id { + self.lock_count.set( + self.lock_count + .get() + .checked_add(1) + .expect("ReentrantMutex lock count overflow"), + ); + } else { + if !try_lock() { + return false; + } + self.owner.store(id, Ordering::Relaxed); + self.lock_count.set(1); + } + true + } + + #[inline] + pub fn lock(&self) { + self.lock_internal(|| { + self.mutex.lock(); + true + }); + } + + #[inline] + pub fn try_lock_until(&self, timeout: Instant) -> bool { + self.lock_internal(|| self.mutex.try_lock_until(timeout)) + } + + #[inline] + pub fn try_lock_for(&self, timeout: Duration) -> bool { + self.lock_internal(|| self.mutex.try_lock_for(timeout)) + } + + #[inline] + pub fn try_lock(&self) -> bool { + self.lock_internal(|| self.mutex.try_lock()) + } + + #[inline] + pub fn unlock(&self, force_fair: bool) { + let lock_count = self.lock_count.get() - 1; + if lock_count == 0 { + self.owner.store(0, Ordering::Relaxed); + self.mutex.unlock(force_fair); + } else { + self.lock_count.set(lock_count); + } + } +} diff --git a/src/vendor/parking_lot/src/raw_rwlock.rs b/src/vendor/parking_lot/src/raw_rwlock.rs new file mode 100644 index 0000000000..d2e55f9f05 --- /dev/null +++ b/src/vendor/parking_lot/src/raw_rwlock.rs @@ -0,0 +1,1185 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::cell::Cell; +#[cfg(not(feature = "nightly"))] +use stable::{AtomicUsize, Ordering}; +use std::time::{Duration, Instant}; +use parking_lot_core::{self, FilterOp, ParkResult, ParkToken, SpinWait, UnparkResult}; +use elision::{have_elision, AtomicElisionExt}; +use raw_mutex::{TOKEN_HANDOFF, TOKEN_NORMAL}; +use deadlock; + +const USABLE_BITS_MASK: usize = { + #[cfg(feature = "nightly")] + { + const TOTAL_BITS: usize = ::std::mem::size_of::() * 8; + // specifies the number of usable bits, useful to test the + // implementation with fewer bits (the current implementation + // requires this to be at least 4) + const USABLE_BITS: usize = TOTAL_BITS; + (!0) >> (TOTAL_BITS - USABLE_BITS) + } + #[cfg(not(feature = "nightly"))] + { + !0 + } +}; + +const PARKED_BIT: usize = 0b001; +const UPGRADING_BIT: usize = 0b010; +// A shared guard acquires a single guard resource +const SHARED_GUARD: usize = 0b100; +const GUARD_COUNT_MASK: usize = USABLE_BITS_MASK & !(SHARED_GUARD - 1); +// An exclusive lock acquires all of guard resource (i.e. it is exclusive) +const EXCLUSIVE_GUARD: usize = GUARD_COUNT_MASK; +// An upgradable lock acquires just over half of the guard resource +// This should be (GUARD_COUNT_MASK + SHARED_GUARD) >> 1, however this might +// overflow, so we shift before adding (which is okay since the least +// significant bit is zero for both GUARD_COUNT_MASK and SHARED_GUARD) +const UPGRADABLE_GUARD: usize = (GUARD_COUNT_MASK >> 1) + (SHARED_GUARD >> 1); + +// Token indicating what type of lock queued threads are trying to acquire +const TOKEN_SHARED: ParkToken = ParkToken(SHARED_GUARD); +const TOKEN_EXCLUSIVE: ParkToken = ParkToken(EXCLUSIVE_GUARD); +const TOKEN_UPGRADABLE: ParkToken = ParkToken(UPGRADABLE_GUARD); +const TOKEN_UPGRADING: ParkToken = ParkToken((EXCLUSIVE_GUARD - UPGRADABLE_GUARD) | UPGRADING_BIT); + +#[inline(always)] +fn checked_add(left: usize, right: usize) -> Option { + if USABLE_BITS_MASK == !0 { + left.checked_add(right) + } else { + debug_assert!(left <= USABLE_BITS_MASK && right <= USABLE_BITS_MASK); + let res = left + right; + if res & USABLE_BITS_MASK < right { + None + } else { + Some(res) + } + } +} + +pub struct RawRwLock { + state: AtomicUsize, +} + +impl RawRwLock { + #[cfg(feature = "nightly")] + #[inline] + pub const fn new() -> RawRwLock { + RawRwLock { + state: AtomicUsize::new(0), + } + } + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new() -> RawRwLock { + RawRwLock { + state: AtomicUsize::new(0), + } + } + + #[inline] + pub fn lock_exclusive(&self) { + if self.state + .compare_exchange_weak(0, EXCLUSIVE_GUARD, Ordering::Acquire, Ordering::Relaxed) + .is_err() + { + let result = self.lock_exclusive_slow(None); + debug_assert!(result); + } + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + + #[inline] + pub fn try_lock_exclusive_until(&self, timeout: Instant) -> bool { + let result = if self.state + .compare_exchange_weak(0, EXCLUSIVE_GUARD, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + { + true + } else { + self.lock_exclusive_slow(Some(timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock_exclusive_for(&self, timeout: Duration) -> bool { + let result = if self.state + .compare_exchange_weak(0, EXCLUSIVE_GUARD, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + { + true + } else { + self.lock_exclusive_slow(Some(Instant::now() + timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock_exclusive(&self) -> bool { + if self.state + .compare_exchange(0, EXCLUSIVE_GUARD, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + true + } else { + false + } + } + + #[inline] + pub fn unlock_exclusive(&self, force_fair: bool) { + unsafe { deadlock::release_resource(self as *const _ as usize) }; + if self.state + .compare_exchange_weak(EXCLUSIVE_GUARD, 0, Ordering::Release, Ordering::Relaxed) + .is_ok() + { + return; + } + self.unlock_exclusive_slow(force_fair); + } + + #[inline] + pub fn exclusive_to_shared(&self) { + let state = self.state + .fetch_sub(EXCLUSIVE_GUARD - SHARED_GUARD, Ordering::Release); + + // Wake up parked shared and upgradable threads if there are any + if state & PARKED_BIT != 0 { + self.exclusive_to_shared_slow(); + } + } + + #[inline(always)] + fn try_lock_shared_fast(&self, recursive: bool) -> bool { + let state = self.state.load(Ordering::Relaxed); + + // We can't allow grabbing a shared lock while there are parked threads + // since that could lead to writer starvation. + if !recursive && state & PARKED_BIT != 0 { + return false; + } + + // Use hardware lock elision to avoid cache conflicts when multiple + // readers try to acquire the lock. We only do this if the lock is + // completely empty since elision handles conflicts poorly. + if have_elision() && state == 0 { + self.state.elision_acquire(0, SHARED_GUARD).is_ok() + } else if let Some(new_state) = checked_add(state, SHARED_GUARD) { + self.state + .compare_exchange_weak(state, new_state, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + } else { + false + } + } + + #[inline] + pub fn lock_shared(&self, recursive: bool) { + if !self.try_lock_shared_fast(recursive) { + let result = self.lock_shared_slow(recursive, None); + debug_assert!(result); + } + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + + #[inline] + pub fn try_lock_shared_until(&self, recursive: bool, timeout: Instant) -> bool { + let result = if self.try_lock_shared_fast(recursive) { + true + } else { + self.lock_shared_slow(recursive, Some(timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock_shared_for(&self, recursive: bool, timeout: Duration) -> bool { + let result = if self.try_lock_shared_fast(recursive) { + true + } else { + self.lock_shared_slow(recursive, Some(Instant::now() + timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock_shared(&self, recursive: bool) -> bool { + let result = if self.try_lock_shared_fast(recursive) { + true + } else { + self.try_lock_shared_slow(recursive) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn unlock_shared(&self, force_fair: bool) { + unsafe { deadlock::release_resource(self as *const _ as usize) }; + let state = self.state.load(Ordering::Relaxed); + if state & PARKED_BIT == 0 + || (state & UPGRADING_BIT == 0 && state & GUARD_COUNT_MASK != SHARED_GUARD) + { + if have_elision() { + if self.state + .elision_release(state, state - SHARED_GUARD) + .is_ok() + { + return; + } + } else { + if self.state + .compare_exchange_weak( + state, + state - SHARED_GUARD, + Ordering::Release, + Ordering::Relaxed, + ) + .is_ok() + { + return; + } + } + } + self.unlock_shared_slow(force_fair); + } + + #[inline(always)] + fn try_lock_upgradable_fast(&self) -> bool { + let state = self.state.load(Ordering::Relaxed); + + // We can't allow grabbing an upgradable lock while there are parked threads + // since that could lead to writer starvation. + if state & PARKED_BIT != 0 { + return false; + } + + if let Some(new_state) = checked_add(state, UPGRADABLE_GUARD) { + self.state + .compare_exchange_weak(state, new_state, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + } else { + false + } + } + + #[inline] + pub fn lock_upgradable(&self) { + if !self.try_lock_upgradable_fast() { + let result = self.lock_upgradable_slow(None); + debug_assert!(result); + } + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + + #[inline] + pub fn try_lock_upgradable_until(&self, timeout: Instant) -> bool { + let result = if self.try_lock_upgradable_fast() { + true + } else { + self.lock_upgradable_slow(Some(timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock_upgradable_for(&self, timeout: Duration) -> bool { + let result = if self.try_lock_upgradable_fast() { + true + } else { + self.lock_upgradable_slow(Some(Instant::now() + timeout)) + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn try_lock_upgradable(&self) -> bool { + let result = if self.try_lock_upgradable_fast() { + true + } else { + self.try_lock_upgradable_slow() + }; + if result { + unsafe { deadlock::acquire_resource(self as *const _ as usize) }; + } + result + } + + #[inline] + pub fn unlock_upgradable(&self, force_fair: bool) { + unsafe { deadlock::release_resource(self as *const _ as usize) }; + if self.state + .compare_exchange_weak(UPGRADABLE_GUARD, 0, Ordering::Release, Ordering::Relaxed) + .is_ok() + { + return; + } + self.unlock_upgradable_slow(force_fair); + } + + #[inline] + pub fn upgradable_to_shared(&self) { + let state = self.state + .fetch_sub(UPGRADABLE_GUARD - SHARED_GUARD, Ordering::Relaxed); + + // Wake up parked shared and upgradable threads if there are any + if state & PARKED_BIT != 0 { + self.upgradable_to_shared_slow(state); + } + } + + #[inline] + pub fn upgradable_to_exclusive(&self) { + if self.state + .compare_exchange_weak( + UPGRADABLE_GUARD, + EXCLUSIVE_GUARD, + Ordering::Relaxed, + Ordering::Relaxed, + ) + .is_err() + { + let result = self.upgradable_to_exclusive_slow(None); + debug_assert!(result); + } + } + + #[inline] + pub fn try_upgradable_to_exclusive_until(&self, timeout: Instant) -> bool { + if self.state + .compare_exchange_weak( + UPGRADABLE_GUARD, + EXCLUSIVE_GUARD, + Ordering::Relaxed, + Ordering::Relaxed, + ) + .is_ok() + { + true + } else { + self.upgradable_to_exclusive_slow(Some(timeout)) + } + } + + #[inline] + pub fn try_upgradable_to_exclusive_for(&self, timeout: Duration) -> bool { + if self.state + .compare_exchange_weak( + UPGRADABLE_GUARD, + EXCLUSIVE_GUARD, + Ordering::Relaxed, + Ordering::Relaxed, + ) + .is_ok() + { + true + } else { + self.upgradable_to_exclusive_slow(Some(Instant::now() + timeout)) + } + } + + #[inline] + pub fn try_upgradable_to_exclusive(&self) -> bool { + self.state + .compare_exchange( + UPGRADABLE_GUARD, + EXCLUSIVE_GUARD, + Ordering::Relaxed, + Ordering::Relaxed, + ) + .is_ok() + } + + #[cold] + #[inline(never)] + fn lock_exclusive_slow(&self, timeout: Option) -> bool { + let mut spinwait = SpinWait::new(); + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Grab the lock if it isn't locked, even if there are other + // threads parked. + if let Some(new_state) = checked_add(state, EXCLUSIVE_GUARD) { + match self.state.compare_exchange_weak( + state, + new_state, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + continue; + } + + // If there are no parked threads and only one reader or writer, try + // spinning a few times. + if (state == EXCLUSIVE_GUARD || state == SHARED_GUARD || state == UPGRADABLE_GUARD) + && spinwait.spin() + { + state = self.state.load(Ordering::Relaxed); + continue; + } + + // Park our thread until we are woken up by an unlock + unsafe { + let addr = self as *const _ as usize; + let validate = || { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // If the rwlock is free, abort the park and try to grab + // it immediately. + if state & GUARD_COUNT_MASK == 0 { + return false; + } + + // Nothing to do if the parked bit is already set + if state & PARKED_BIT != 0 { + return true; + } + + // Set the parked bit + match self.state.compare_exchange_weak( + state, + state | PARKED_BIT, + Ordering::Relaxed, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + } + }; + let before_sleep = || {}; + let timed_out = |_, was_last_thread| { + // Clear the parked bit if we were the last parked thread + if was_last_thread { + self.state.fetch_and(!PARKED_BIT, Ordering::Relaxed); + } + }; + match parking_lot_core::park( + addr, + validate, + before_sleep, + timed_out, + TOKEN_EXCLUSIVE, + timeout, + ) { + // The thread that unparked us passed the lock on to us + // directly without unlocking it. + ParkResult::Unparked(TOKEN_HANDOFF) => return true, + + // We were unparked normally, try acquiring the lock again + ParkResult::Unparked(_) => (), + + // The validation function failed, try locking again + ParkResult::Invalid => (), + + // Timeout expired + ParkResult::TimedOut => return false, + } + } + + // Loop back and try locking again + spinwait.reset(); + state = self.state.load(Ordering::Relaxed); + } + } + + #[cold] + #[inline(never)] + fn unlock_exclusive_slow(&self, force_fair: bool) { + // Unlock directly if there are no parked threads + if self.state + .compare_exchange(EXCLUSIVE_GUARD, 0, Ordering::Release, Ordering::Relaxed) + .is_ok() + { + return; + }; + + // There are threads to unpark. We unpark threads up to the guard capacity. + let guard_count = Cell::new(0); + unsafe { + let addr = self as *const _ as usize; + let filter = |ParkToken(token)| -> FilterOp { + match checked_add(guard_count.get(), token) { + Some(new_guard_count) => { + guard_count.set(new_guard_count); + FilterOp::Unpark + } + None => FilterOp::Stop, + } + }; + let callback = |result: UnparkResult| { + // If we are using a fair unlock then we should keep the + // rwlock locked and hand it off to the unparked threads. + if result.unparked_threads != 0 && (force_fair || result.be_fair) { + // We need to set the guard count accordingly. + let mut new_state = guard_count.get(); + + if result.have_more_threads { + new_state |= PARKED_BIT; + } + + self.state.store(new_state, Ordering::Release); + TOKEN_HANDOFF + } else { + // Clear the parked bit if there are no more parked threads. + if result.have_more_threads { + self.state.store(PARKED_BIT, Ordering::Release); + } else { + self.state.store(0, Ordering::Release); + } + TOKEN_NORMAL + } + }; + parking_lot_core::unpark_filter(addr, filter, callback); + } + } + + #[cold] + #[inline(never)] + fn exclusive_to_shared_slow(&self) { + unsafe { + let addr = self as *const _ as usize; + let mut guard_count = SHARED_GUARD; + let filter = |ParkToken(token)| -> FilterOp { + match checked_add(guard_count, token) { + Some(new_guard_count) => { + guard_count = new_guard_count; + FilterOp::Unpark + } + None => FilterOp::Stop, + } + }; + let callback = |result: UnparkResult| { + // Clear the parked bit if there no more parked threads + if !result.have_more_threads { + self.state.fetch_and(!PARKED_BIT, Ordering::Relaxed); + } + TOKEN_NORMAL + }; + parking_lot_core::unpark_filter(addr, filter, callback); + } + } + + #[cold] + #[inline(never)] + fn lock_shared_slow(&self, recursive: bool, timeout: Option) -> bool { + let mut spinwait = SpinWait::new(); + let mut spinwait_shared = SpinWait::new(); + let mut state = self.state.load(Ordering::Relaxed); + let mut unparked = false; + loop { + // Use hardware lock elision to avoid cache conflicts when multiple + // readers try to acquire the lock. We only do this if the lock is + // completely empty since elision handles conflicts poorly. + if have_elision() && state == 0 { + match self.state.elision_acquire(0, SHARED_GUARD) { + Ok(_) => return true, + Err(x) => state = x, + } + } + + // Grab the lock if there are no exclusive threads locked or + // waiting. However if we were unparked then we are allowed to grab + // the lock even if there are pending exclusive threads. + if unparked || recursive || state & PARKED_BIT == 0 { + if let Some(new_state) = checked_add(state, SHARED_GUARD) { + if self.state + .compare_exchange_weak( + state, + new_state, + Ordering::Acquire, + Ordering::Relaxed, + ) + .is_ok() + { + return true; + } + + // If there is high contention on the reader count then we want + // to leave some time between attempts to acquire the lock to + // let other threads make progress. + spinwait_shared.spin_no_yield(); + state = self.state.load(Ordering::Relaxed); + continue; + } else { + // We were unparked spuriously, reset unparked flag. + unparked = false; + } + } + + // If there are no parked threads, try spinning a few times + if state & PARKED_BIT == 0 && spinwait.spin() { + state = self.state.load(Ordering::Relaxed); + continue; + } + + // Park our thread until we are woken up by an unlock + unsafe { + let addr = self as *const _ as usize; + let validate = || { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Nothing to do if the parked bit is already set + if state & PARKED_BIT != 0 { + return true; + } + + // If the parked bit is not set then it means we are at + // the front of the queue. If there is space for another + // lock then we should abort the park and try acquiring + // the lock again. + if state & GUARD_COUNT_MASK != GUARD_COUNT_MASK { + return false; + } + + // Set the parked bit + match self.state.compare_exchange_weak( + state, + state | PARKED_BIT, + Ordering::Relaxed, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + } + }; + let before_sleep = || {}; + let timed_out = |_, was_last_thread| { + // Clear the parked bit if we were the last parked thread + if was_last_thread { + self.state.fetch_and(!PARKED_BIT, Ordering::Relaxed); + } + }; + match parking_lot_core::park( + addr, + validate, + before_sleep, + timed_out, + TOKEN_SHARED, + timeout, + ) { + // The thread that unparked us passed the lock on to us + // directly without unlocking it. + ParkResult::Unparked(TOKEN_HANDOFF) => return true, + + // We were unparked normally, try acquiring the lock again + ParkResult::Unparked(_) => (), + + // The validation function failed, try locking again + ParkResult::Invalid => (), + + // Timeout expired + ParkResult::TimedOut => return false, + } + } + + // Loop back and try locking again + spinwait.reset(); + spinwait_shared.reset(); + state = self.state.load(Ordering::Relaxed); + unparked = true; + } + } + + #[cold] + #[inline(never)] + fn try_lock_shared_slow(&self, recursive: bool) -> bool { + let mut state = self.state.load(Ordering::Relaxed); + loop { + if !recursive && state & PARKED_BIT != 0 { + return false; + } + if have_elision() && state == 0 { + match self.state.elision_acquire(0, SHARED_GUARD) { + Ok(_) => return true, + Err(x) => state = x, + } + } else { + match checked_add(state, SHARED_GUARD) { + Some(new_state) => match self.state.compare_exchange_weak( + state, + new_state, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + }, + None => return false, + } + } + } + } + + #[cold] + #[inline(never)] + fn unlock_shared_slow(&self, force_fair: bool) { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Just release the lock if there are no parked thread or if we are + // not the last shared thread. + if state & PARKED_BIT == 0 + || (state & UPGRADING_BIT == 0 && state & GUARD_COUNT_MASK != SHARED_GUARD) + || (state & UPGRADING_BIT != 0 + && state & GUARD_COUNT_MASK != UPGRADABLE_GUARD + SHARED_GUARD) + { + match self.state.compare_exchange_weak( + state, + state - SHARED_GUARD, + Ordering::Release, + Ordering::Relaxed, + ) { + Ok(_) => return, + Err(x) => state = x, + } + continue; + } + + break; + } + + // There are threads to unpark. If there is a thread waiting to be + // upgraded, we find that thread and let it upgrade, otherwise we + // unpark threads up to the guard capacity. Note that there is a + // potential race condition here: another thread might grab a shared + // lock between now and when we actually release our lock. + let additional_guards = Cell::new(0); + let has_upgraded = Cell::new(if state & UPGRADING_BIT == 0 { + None + } else { + Some(false) + }); + unsafe { + let addr = self as *const _ as usize; + let filter = |ParkToken(token)| -> FilterOp { + match has_upgraded.get() { + None => match checked_add(additional_guards.get(), token) { + Some(x) => { + additional_guards.set(x); + FilterOp::Unpark + } + None => FilterOp::Stop, + }, + Some(false) => if token & UPGRADING_BIT != 0 { + additional_guards.set(token & !UPGRADING_BIT); + has_upgraded.set(Some(true)); + FilterOp::Unpark + } else { + FilterOp::Skip + }, + Some(true) => FilterOp::Stop, + } + }; + let callback = |result: UnparkResult| { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Release our shared lock + let mut new_state = state - SHARED_GUARD; + + // Clear the parked bit if there are no more threads in + // the queue. + if !result.have_more_threads { + new_state &= !PARKED_BIT; + } + + // Clear the upgrading bit if we are upgrading a thread. + if let Some(true) = has_upgraded.get() { + new_state &= !UPGRADING_BIT; + } + + // Consider using fair unlocking. If we are, then we should set + // the state to the new value and tell the threads that we are + // handing the lock directly. + let token = if result.unparked_threads != 0 && (force_fair || result.be_fair) { + match checked_add(new_state, additional_guards.get()) { + Some(x) => { + new_state = x; + TOKEN_HANDOFF + } + None => TOKEN_NORMAL, + } + } else { + TOKEN_NORMAL + }; + + match self.state.compare_exchange_weak( + state, + new_state, + Ordering::Release, + Ordering::Relaxed, + ) { + Ok(_) => return token, + Err(x) => state = x, + } + } + }; + parking_lot_core::unpark_filter(addr, filter, callback); + } + } + + #[cold] + #[inline(never)] + fn lock_upgradable_slow(&self, timeout: Option) -> bool { + let mut spinwait = SpinWait::new(); + let mut spinwait_shared = SpinWait::new(); + let mut state = self.state.load(Ordering::Relaxed); + let mut unparked = false; + loop { + // Grab the lock if there are no exclusive or upgradable threads + // locked or waiting. However if we were unparked then we are + // allowed to grab the lock even if there are pending exclusive threads. + if unparked || state & PARKED_BIT == 0 { + if let Some(new_state) = checked_add(state, UPGRADABLE_GUARD) { + if self.state + .compare_exchange_weak( + state, + new_state, + Ordering::Acquire, + Ordering::Relaxed, + ) + .is_ok() + { + return true; + } + + // If there is high contention on the reader count then we want + // to leave some time between attempts to acquire the lock to + // let other threads make progress. + spinwait_shared.spin_no_yield(); + state = self.state.load(Ordering::Relaxed); + continue; + } else { + // We were unparked spuriously, reset unparked flag. + unparked = false; + } + } + + // If there are no parked threads, try spinning a few times + if state & PARKED_BIT == 0 && spinwait.spin() { + state = self.state.load(Ordering::Relaxed); + continue; + } + + // Park our thread until we are woken up by an unlock + unsafe { + let addr = self as *const _ as usize; + let validate = || { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Nothing to do if the parked bit is already set + if state & PARKED_BIT != 0 { + return true; + } + + // If the parked bit is not set then it means we are at + // the front of the queue. If there is space for an + // upgradable lock then we should abort the park and try + // acquiring the lock again. + if state & UPGRADABLE_GUARD != UPGRADABLE_GUARD { + return false; + } + + // Set the parked bit + match self.state.compare_exchange_weak( + state, + state | PARKED_BIT, + Ordering::Relaxed, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + } + }; + let before_sleep = || {}; + let timed_out = |_, was_last_thread| { + // Clear the parked bit if we were the last parked thread + if was_last_thread { + self.state.fetch_and(!PARKED_BIT, Ordering::Relaxed); + } + }; + match parking_lot_core::park( + addr, + validate, + before_sleep, + timed_out, + TOKEN_UPGRADABLE, + timeout, + ) { + // The thread that unparked us passed the lock on to us + // directly without unlocking it. + ParkResult::Unparked(TOKEN_HANDOFF) => return true, + + // We were unparked normally, try acquiring the lock again + ParkResult::Unparked(_) => (), + + // The validation function failed, try locking again + ParkResult::Invalid => (), + + // Timeout expired + ParkResult::TimedOut => return false, + } + } + + // Loop back and try locking again + spinwait.reset(); + spinwait_shared.reset(); + state = self.state.load(Ordering::Relaxed); + unparked = true; + } + } + + #[cold] + #[inline(never)] + fn try_lock_upgradable_slow(&self) -> bool { + let mut state = self.state.load(Ordering::Relaxed); + loop { + if state & PARKED_BIT != 0 { + return false; + } + + match checked_add(state, UPGRADABLE_GUARD) { + Some(new_state) => match self.state.compare_exchange_weak( + state, + new_state, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + }, + None => return false, + } + } + } + + #[cold] + #[inline(never)] + fn unlock_upgradable_slow(&self, force_fair: bool) { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Just release the lock if there are no parked threads. + if state & PARKED_BIT == 0 { + match self.state.compare_exchange_weak( + state, + state - UPGRADABLE_GUARD, + Ordering::Release, + Ordering::Relaxed, + ) { + Ok(_) => return, + Err(x) => state = x, + } + continue; + } + + break; + } + + // There are threads to unpark. We unpark threads up to the guard capacity. + let additional_guards = Cell::new(0); + unsafe { + let addr = self as *const _ as usize; + let filter = |ParkToken(token)| -> FilterOp { + match checked_add(additional_guards.get(), token) { + Some(x) => { + additional_guards.set(x); + FilterOp::Unpark + } + None => FilterOp::Stop, + } + }; + let callback = |result: UnparkResult| { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Release our upgradable lock + let mut new_state = state - UPGRADABLE_GUARD; + + // Clear the parked bit if there are no more threads in + // the queue + if !result.have_more_threads { + new_state &= !PARKED_BIT; + } + + // Consider using fair unlocking. If we are, then we should set + // the state to the new value and tell the threads that we are + // handing the lock directly. + let token = if result.unparked_threads != 0 && (force_fair || result.be_fair) { + match checked_add(new_state, additional_guards.get()) { + Some(x) => { + new_state = x; + TOKEN_HANDOFF + } + None => TOKEN_NORMAL, + } + } else { + TOKEN_NORMAL + }; + + match self.state.compare_exchange_weak( + state, + new_state, + Ordering::Release, + Ordering::Relaxed, + ) { + Ok(_) => return token, + Err(x) => state = x, + } + } + }; + parking_lot_core::unpark_filter(addr, filter, callback); + } + } + + #[cold] + #[inline(never)] + fn upgradable_to_shared_slow(&self, state: usize) { + unsafe { + let addr = self as *const _ as usize; + let mut guard_count = (state & GUARD_COUNT_MASK) - UPGRADABLE_GUARD; + let filter = |ParkToken(token)| -> FilterOp { + match checked_add(guard_count, token) { + Some(x) => { + guard_count = x; + FilterOp::Unpark + } + None => FilterOp::Stop, + } + }; + let callback = |result: UnparkResult| { + // Clear the parked bit if there no more parked threads + if !result.have_more_threads { + self.state.fetch_and(!PARKED_BIT, Ordering::Relaxed); + } + TOKEN_NORMAL + }; + parking_lot_core::unpark_filter(addr, filter, callback); + } + } + + #[cold] + #[inline(never)] + fn upgradable_to_exclusive_slow(&self, timeout: Option) -> bool { + let mut spinwait = SpinWait::new(); + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Grab the lock if it isn't locked, even if there are other + // threads parked. + if let Some(new_state) = checked_add(state, EXCLUSIVE_GUARD - UPGRADABLE_GUARD) { + match self.state.compare_exchange_weak( + state, + new_state, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + continue; + } + + // If there are no parked threads and only one other reader, try + // spinning a few times. + if state == UPGRADABLE_GUARD + SHARED_GUARD && spinwait.spin() { + state = self.state.load(Ordering::Relaxed); + continue; + } + + // Park our thread until we are woken up by an unlock + unsafe { + let addr = self as *const _ as usize; + let validate = || { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // If the rwlock is free, abort the park and try to grab + // it immediately. + if state & GUARD_COUNT_MASK == UPGRADABLE_GUARD { + return false; + } + + // Set the upgrading and parked bits + match self.state.compare_exchange_weak( + state, + state | (UPGRADING_BIT | PARKED_BIT), + Ordering::Relaxed, + Ordering::Relaxed, + ) { + Ok(_) => return true, + Err(x) => state = x, + } + } + }; + let before_sleep = || {}; + let timed_out = |_, was_last_thread| { + // Clear the upgrading bit + let mut flags = UPGRADING_BIT; + + // Clear the parked bit if we were the last parked thread + if was_last_thread { + flags |= PARKED_BIT; + } + + self.state.fetch_and(!flags, Ordering::Relaxed); + }; + match parking_lot_core::park( + addr, + validate, + before_sleep, + timed_out, + TOKEN_UPGRADING, + timeout, + ) { + // The thread that unparked us passed the lock on to us + // directly without unlocking it. + ParkResult::Unparked(TOKEN_HANDOFF) => return true, + + // We were unparked normally, try acquiring the lock again + ParkResult::Unparked(_) => (), + + // The validation function failed, try locking again + ParkResult::Invalid => (), + + // Timeout expired + ParkResult::TimedOut => return false, + } + } + + // Loop back and try locking again + spinwait.reset(); + state = self.state.load(Ordering::Relaxed); + } + } +} diff --git a/src/vendor/parking_lot/src/remutex.rs b/src/vendor/parking_lot/src/remutex.rs new file mode 100644 index 0000000000..c43c74b474 --- /dev/null +++ b/src/vendor/parking_lot/src/remutex.rs @@ -0,0 +1,338 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::cell::UnsafeCell; +use std::ops::Deref; +use std::time::{Duration, Instant}; +use std::fmt; +use std::mem; +use std::marker::PhantomData; +use raw_remutex::RawReentrantMutex; + +#[cfg(feature = "owning_ref")] +use owning_ref::StableAddress; + +/// A mutex which can be recursively locked by a single thread. +/// +/// This type is identical to `Mutex` except for the following points: +/// +/// - Locking multiple times from the same thread will work correctly instead of +/// deadlocking. +/// - `ReentrantMutexGuard` does not give mutable references to the locked data. +/// Use a `RefCell` if you need this. +/// - `ReentrantMutexGuard` is not `Send`. +/// +/// See [`Mutex`](struct.Mutex.html) for more details about the underlying mutex +/// primitive. +pub struct ReentrantMutex { + raw: RawReentrantMutex, + data: UnsafeCell, +} + +unsafe impl Send for ReentrantMutex {} +unsafe impl Sync for ReentrantMutex {} + +/// An RAII implementation of a "scoped lock" of a reentrant mutex. When this structure +/// is dropped (falls out of scope), the lock will be unlocked. +/// +/// The data protected by the mutex can be accessed through this guard via its +/// `Deref` implementation. +#[must_use] +pub struct ReentrantMutexGuard<'a, T: ?Sized + 'a> { + raw: &'a RawReentrantMutex, + data: *const T, + marker: PhantomData<&'a T>, +} + +unsafe impl<'a, T: ?Sized + Sync + 'a> Sync for ReentrantMutexGuard<'a, T> {} + +impl ReentrantMutex { + /// Creates a new reentrant mutex in an unlocked state ready for use. + #[cfg(feature = "nightly")] + #[inline] + pub const fn new(val: T) -> ReentrantMutex { + ReentrantMutex { + data: UnsafeCell::new(val), + raw: RawReentrantMutex::new(), + } + } + + /// Creates a new reentrant mutex in an unlocked state ready for use. + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new(val: T) -> ReentrantMutex { + ReentrantMutex { + data: UnsafeCell::new(val), + raw: RawReentrantMutex::new(), + } + } + + /// Consumes this reentrant mutex, returning the underlying data. + #[inline] + pub fn into_inner(self) -> T { + unsafe { self.data.into_inner() } + } +} + +impl ReentrantMutex { + #[inline] + fn guard(&self) -> ReentrantMutexGuard { + ReentrantMutexGuard { + raw: &self.raw, + data: self.data.get(), + marker: PhantomData, + } + } + + /// Acquires a reentrant mutex, blocking the current thread until it is able + /// to do so. + /// + /// If the mutex is held by another thread then this function will block the + /// local thread until it is available to acquire the mutex. If the mutex is + /// already held by the current thread then this function will increment the + /// lock reference count and return immediately. Upon returning, + /// the thread is the only thread with the mutex held. An RAII guard is + /// returned to allow scoped unlock of the lock. When the guard goes out of + /// scope, the mutex will be unlocked. + #[inline] + pub fn lock(&self) -> ReentrantMutexGuard { + self.raw.lock(); + self.guard() + } + + /// Attempts to acquire this lock. + /// + /// If the lock could not be acquired at this time, then `None` is returned. + /// Otherwise, an RAII guard is returned. The lock will be unlocked when the + /// guard is dropped. + /// + /// This function does not block. + #[inline] + pub fn try_lock(&self) -> Option> { + if self.raw.try_lock() { + Some(self.guard()) + } else { + None + } + } + + /// Attempts to acquire this lock until a timeout is reached. + /// + /// If the lock could not be acquired before the timeout expired, then + /// `None` is returned. Otherwise, an RAII guard is returned. The lock will + /// be unlocked when the guard is dropped. + #[inline] + pub fn try_lock_for(&self, timeout: Duration) -> Option> { + if self.raw.try_lock_for(timeout) { + Some(self.guard()) + } else { + None + } + } + + /// Attempts to acquire this lock until a timeout is reached. + /// + /// If the lock could not be acquired before the timeout expired, then + /// `None` is returned. Otherwise, an RAII guard is returned. The lock will + /// be unlocked when the guard is dropped. + #[inline] + pub fn try_lock_until(&self, timeout: Instant) -> Option> { + if self.raw.try_lock_until(timeout) { + Some(self.guard()) + } else { + None + } + } + + /// Returns a mutable reference to the underlying data. + /// + /// Since this call borrows the `ReentrantMutex` mutably, no actual locking needs to + /// take place---the mutable borrow statically guarantees no locks exist. + #[inline] + pub fn get_mut(&mut self) -> &mut T { + unsafe { &mut *self.data.get() } + } + + /// Releases the mutex. + /// + /// # Safety + /// + /// This function must only be called if the mutex was locked using + /// `raw_lock` or `raw_try_lock`, or if a `ReentrantMutexGuard` from this mutex was + /// leaked (e.g. with `mem::forget`). The mutex must be locked. + #[inline] + pub unsafe fn raw_unlock(&self) { + self.raw.unlock(false); + } + + /// Releases the mutex using a fair unlock protocol. + /// + /// See `ReentrantMutexGuard::unlock_fair`. + /// + /// # Safety + /// + /// This function must only be called if the mutex was locked using + /// `raw_lock` or `raw_try_lock`, or if a `ReentrantMutexGuard` from this mutex was + /// leaked (e.g. with `mem::forget`). The mutex must be locked. + #[inline] + pub unsafe fn raw_unlock_fair(&self) { + self.raw.unlock(true); + } +} +impl ReentrantMutex<()> { + /// Acquires a mutex, blocking the current thread until it is able to do so. + /// + /// This is similar to `lock`, except that a `ReentrantMutexGuard` is not returned. + /// Instead you will need to call `raw_unlock` to release the mutex. + #[inline] + pub fn raw_lock(&self) { + self.raw.lock(); + } + + /// Attempts to acquire this lock. + /// + /// This is similar to `try_lock`, except that a `ReentrantMutexGuard` is not + /// returned. Instead you will need to call `raw_unlock` to release the + /// mutex. + #[inline] + pub fn raw_try_lock(&self) -> bool { + self.raw.try_lock() + } +} + +impl Default for ReentrantMutex { + #[inline] + fn default() -> ReentrantMutex { + ReentrantMutex::new(Default::default()) + } +} + +impl fmt::Debug for ReentrantMutex { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.try_lock() { + Some(guard) => write!(f, "ReentrantMutex {{ data: {:?} }}", &*guard), + None => write!(f, "ReentrantMutex {{ }}"), + } + } +} + +impl<'a, T: ?Sized + 'a> ReentrantMutexGuard<'a, T> { + /// Unlocks the mutex using a fair unlock protocol. + /// + /// By default, mutexes are unfair and allow the current thread to re-lock + /// the mutex before another has the chance to acquire the lock, even if + /// that thread has been blocked on the mutex for a long time. This is the + /// default because it allows much higher throughput as it avoids forcing a + /// context switch on every mutex unlock. This can result in one thread + /// acquiring a mutex many more times than other threads. + /// + /// However in some cases it can be beneficial to ensure fairness by forcing + /// the lock to pass on to a waiting thread if there is one. This is done by + /// using this method instead of dropping the `ReentrantMutexGuard` normally. + #[inline] + pub fn unlock_fair(self) { + self.raw.unlock(true); + mem::forget(self); + } + + /// Make a new `ReentrantMutexGuard` for a component of the locked data. + /// + /// This operation cannot fail as the `ReentrantMutexGuard` passed + /// in already locked the mutex. + /// + /// This is an associated function that needs to be + /// used as `ReentrantMutexGuard::map(...)`. A method would interfere with + /// methods of the same name on the contents of the locked data. + #[inline] + pub fn map(orig: Self, f: F) -> ReentrantMutexGuard<'a, U> + where + F: FnOnce(&T) -> &U, + { + let raw = orig.raw; + let data = f(unsafe { &*orig.data }); + mem::forget(orig); + ReentrantMutexGuard { + raw, + data, + marker: PhantomData, + } + } +} + +impl<'a, T: ?Sized + 'a> Deref for ReentrantMutexGuard<'a, T> { + type Target = T; + #[inline] + fn deref(&self) -> &T { + unsafe { &*self.data } + } +} + +impl<'a, T: ?Sized + 'a> Drop for ReentrantMutexGuard<'a, T> { + #[inline] + fn drop(&mut self) { + self.raw.unlock(false); + } +} + +#[cfg(feature = "owning_ref")] +unsafe impl<'a, T: ?Sized> StableAddress for ReentrantMutexGuard<'a, T> {} + +#[cfg(test)] +mod tests { + use std::cell::RefCell; + use std::sync::Arc; + use std::thread; + use ReentrantMutex; + + #[test] + fn smoke() { + let m = ReentrantMutex::new(()); + { + let a = m.lock(); + { + let b = m.lock(); + { + let c = m.lock(); + assert_eq!(*c, ()); + } + assert_eq!(*b, ()); + } + assert_eq!(*a, ()); + } + } + + #[test] + fn is_mutex() { + let m = Arc::new(ReentrantMutex::new(RefCell::new(0))); + let m2 = m.clone(); + let lock = m.lock(); + let child = thread::spawn(move || { + let lock = m2.lock(); + assert_eq!(*lock.borrow(), 4950); + }); + for i in 0..100 { + let lock = m.lock(); + *lock.borrow_mut() += i; + } + drop(lock); + child.join().unwrap(); + } + + #[test] + fn trylock_works() { + let m = Arc::new(ReentrantMutex::new(())); + let m2 = m.clone(); + let _lock = m.try_lock(); + let _lock2 = m.try_lock(); + thread::spawn(move || { + let lock = m2.try_lock(); + assert!(lock.is_none()); + }).join() + .unwrap(); + let _lock3 = m.try_lock(); + } +} diff --git a/src/vendor/parking_lot/src/rwlock.rs b/src/vendor/parking_lot/src/rwlock.rs new file mode 100644 index 0000000000..3ea4fed739 --- /dev/null +++ b/src/vendor/parking_lot/src/rwlock.rs @@ -0,0 +1,1444 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::cell::UnsafeCell; +use std::ops::{Deref, DerefMut}; +use std::time::{Duration, Instant}; +use std::fmt; +use std::mem; +use std::marker::PhantomData; +use raw_rwlock::RawRwLock; + +#[cfg(feature = "owning_ref")] +use owning_ref::StableAddress; + +/// A reader-writer lock +/// +/// This type of lock allows a number of readers or at most one writer at any +/// point in time. The write portion of this lock typically allows modification +/// of the underlying data (exclusive access) and the read portion of this lock +/// typically allows for read-only access (shared access). +/// +/// This lock uses a task-fair locking policy which avoids both reader and +/// writer starvation. This means that readers trying to acquire the lock will +/// block even if the lock is unlocked when there are writers waiting to acquire +/// the lock. Because of this, attempts to recursively acquire a read lock +/// within a single thread may result in a deadlock. +/// +/// The type parameter `T` represents the data that this lock protects. It is +/// required that `T` satisfies `Send` to be shared across threads and `Sync` to +/// allow concurrent access through readers. The RAII guards returned from the +/// locking methods implement `Deref` (and `DerefMut` for the `write` methods) +/// to allow access to the contained of the lock. +/// +/// # Fairness +/// +/// A typical unfair lock can often end up in a situation where a single thread +/// quickly acquires and releases the same lock in succession, which can starve +/// other threads waiting to acquire the rwlock. While this improves performance +/// because it doesn't force a context switch when a thread tries to re-acquire +/// a rwlock it has just released, this can starve other threads. +/// +/// This rwlock uses [eventual fairness](https://trac.webkit.org/changeset/203350) +/// to ensure that the lock will be fair on average without sacrificing +/// performance. This is done by forcing a fair unlock on average every 0.5ms, +/// which will force the lock to go to the next thread waiting for the rwlock. +/// +/// Additionally, any critical section longer than 1ms will always use a fair +/// unlock, which has a negligible performance impact compared to the length of +/// the critical section. +/// +/// You can also force a fair unlock by calling `RwLockReadGuard::unlock_fair` +/// or `RwLockWriteGuard::unlock_fair` when unlocking a mutex instead of simply +/// dropping the guard. +/// +/// # Differences from the standard library `RwLock` +/// +/// - Supports atomically downgrading a write lock into a read lock. +/// - Task-fair locking policy instead of an unspecified platform default. +/// - No poisoning, the lock is released normally on panic. +/// - Only requires 1 word of space, whereas the standard library boxes the +/// `RwLock` due to platform limitations. +/// - Can be statically constructed (requires the `const_fn` nightly feature). +/// - Does not require any drop glue when dropped. +/// - Inline fast path for the uncontended case. +/// - Efficient handling of micro-contention using adaptive spinning. +/// - Allows raw locking & unlocking without a guard. +/// - Supports eventual fairness so that the rwlock is fair on average. +/// - Optionally allows making the rwlock fair by calling +/// `RwLockReadGuard::unlock_fair` and `RwLockWriteGuard::unlock_fair`. +/// +/// # Examples +/// +/// ``` +/// use parking_lot::RwLock; +/// +/// let lock = RwLock::new(5); +/// +/// // many reader locks can be held at once +/// { +/// let r1 = lock.read(); +/// let r2 = lock.read(); +/// assert_eq!(*r1, 5); +/// assert_eq!(*r2, 5); +/// } // read locks are dropped at this point +/// +/// // only one write lock may be held, however +/// { +/// let mut w = lock.write(); +/// *w += 1; +/// assert_eq!(*w, 6); +/// } // write lock is dropped here +/// ``` +pub struct RwLock { + raw: RawRwLock, + data: UnsafeCell, +} + +unsafe impl Send for RwLock {} +unsafe impl Sync for RwLock {} + +/// RAII structure used to release the shared read access of a lock when +/// dropped. +#[must_use] +pub struct RwLockReadGuard<'a, T: ?Sized + 'a> { + raw: &'a RawRwLock, + data: *const T, + marker: PhantomData<&'a T>, +} + +unsafe impl<'a, T: ?Sized + Sync + 'a> Sync for RwLockReadGuard<'a, T> {} + +/// RAII structure used to release the exclusive write access of a lock when +/// dropped. +#[must_use] +pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> { + raw: &'a RawRwLock, + data: *mut T, + marker: PhantomData<&'a mut T>, +} + +unsafe impl<'a, T: ?Sized + Sync + 'a> Sync for RwLockWriteGuard<'a, T> {} + +/// RAII structure used to release the upgradable read access of a lock when +/// dropped. +#[must_use] +pub struct RwLockUpgradableReadGuard<'a, T: ?Sized + 'a> { + raw: &'a RawRwLock, + data: *mut T, + marker: PhantomData<&'a T>, +} + +unsafe impl<'a, T: ?Sized + Sync + 'a> Sync for RwLockUpgradableReadGuard<'a, T> {} + +impl RwLock { + /// Creates a new instance of an `RwLock` which is unlocked. + /// + /// # Examples + /// + /// ``` + /// use parking_lot::RwLock; + /// + /// let lock = RwLock::new(5); + /// ``` + #[cfg(feature = "nightly")] + #[inline] + pub const fn new(val: T) -> RwLock { + RwLock { + data: UnsafeCell::new(val), + raw: RawRwLock::new(), + } + } + + /// Creates a new instance of an `RwLock` which is unlocked. + /// + /// # Examples + /// + /// ``` + /// use parking_lot::RwLock; + /// + /// let lock = RwLock::new(5); + /// ``` + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new(val: T) -> RwLock { + RwLock { + data: UnsafeCell::new(val), + raw: RawRwLock::new(), + } + } + + /// Consumes this `RwLock`, returning the underlying data. + #[inline] + pub fn into_inner(self) -> T { + unsafe { self.data.into_inner() } + } +} + +impl RwLock { + #[inline] + fn read_guard(&self) -> RwLockReadGuard { + RwLockReadGuard { + raw: &self.raw, + data: self.data.get(), + marker: PhantomData, + } + } + + #[inline] + fn write_guard(&self) -> RwLockWriteGuard { + RwLockWriteGuard { + raw: &self.raw, + data: self.data.get(), + marker: PhantomData, + } + } + + #[inline] + fn upgradable_guard(&self) -> RwLockUpgradableReadGuard { + RwLockUpgradableReadGuard { + raw: &self.raw, + data: self.data.get(), + marker: PhantomData, + } + } + + /// Locks this rwlock with shared read access, blocking the current thread + /// until it can be acquired. + /// + /// The calling thread will be blocked until there are no more writers which + /// hold the lock. There may be other readers currently inside the lock when + /// this method returns. + /// + /// Note that attempts to recursively acquire a read lock on a `RwLock` when + /// the current thread already holds one may result in a deadlock. + /// + /// Returns an RAII guard which will release this thread's shared access + /// once it is dropped. + #[inline] + pub fn read(&self) -> RwLockReadGuard { + self.raw.lock_shared(false); + self.read_guard() + } + + /// Attempts to acquire this rwlock with shared read access. + /// + /// If the access could not be granted at this time, then `None` is returned. + /// Otherwise, an RAII guard is returned which will release the shared access + /// when it is dropped. + /// + /// This function does not block. + #[inline] + pub fn try_read(&self) -> Option> { + if self.raw.try_lock_shared(false) { + Some(self.read_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with shared read access until a timeout + /// is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the shared access when it is dropped. + #[inline] + pub fn try_read_for(&self, timeout: Duration) -> Option> { + if self.raw.try_lock_shared_for(false, timeout) { + Some(self.read_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with shared read access until a timeout + /// is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the shared access when it is dropped. + #[inline] + pub fn try_read_until(&self, timeout: Instant) -> Option> { + if self.raw.try_lock_shared_until(false, timeout) { + Some(self.read_guard()) + } else { + None + } + } + + /// Locks this rwlock with shared read access, blocking the current thread + /// until it can be acquired. + /// + /// The calling thread will be blocked until there are no more writers which + /// hold the lock. There may be other readers currently inside the lock when + /// this method returns. + /// + /// Unlike `read`, this method is guaranteed to succeed without blocking if + /// another read lock is held at the time of the call. This allows a thread + /// to recursively lock a `RwLock`. However using this method can cause + /// writers to starve since readers no longer block if a writer is waiting + /// for the lock. + /// + /// Returns an RAII guard which will release this thread's shared access + /// once it is dropped. + #[inline] + pub fn read_recursive(&self) -> RwLockReadGuard { + self.raw.lock_shared(true); + self.read_guard() + } + + /// Attempts to acquire this rwlock with shared read access. + /// + /// If the access could not be granted at this time, then `None` is returned. + /// Otherwise, an RAII guard is returned which will release the shared access + /// when it is dropped. + /// + /// This method is guaranteed to succeed if another read lock is held at the + /// time of the call. See the documentation for `read_recursive` for details. + /// + /// This function does not block. + #[inline] + pub fn try_read_recursive(&self) -> Option> { + if self.raw.try_lock_shared(true) { + Some(self.read_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with shared read access until a timeout + /// is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the shared access when it is dropped. + /// + /// This method is guaranteed to succeed without blocking if another read + /// lock is held at the time of the call. See the documentation for + /// `read_recursive` for details. + #[inline] + pub fn try_read_recursive_for(&self, timeout: Duration) -> Option> { + if self.raw.try_lock_shared_for(true, timeout) { + Some(self.read_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with shared read access until a timeout + /// is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the shared access when it is dropped. + #[inline] + pub fn try_read_recursive_until(&self, timeout: Instant) -> Option> { + if self.raw.try_lock_shared_until(true, timeout) { + Some(self.read_guard()) + } else { + None + } + } + + /// Locks this rwlock with exclusive write access, blocking the current + /// thread until it can be acquired. + /// + /// This function will not return while other writers or other readers + /// currently have access to the lock. + /// + /// Returns an RAII guard which will drop the write access of this rwlock + /// when dropped. + #[inline] + pub fn write(&self) -> RwLockWriteGuard { + self.raw.lock_exclusive(); + self.write_guard() + } + + /// Attempts to lock this rwlock with exclusive write access. + /// + /// If the lock could not be acquired at this time, then `None` is returned. + /// Otherwise, an RAII guard is returned which will release the lock when + /// it is dropped. + /// + /// This function does not block. + #[inline] + pub fn try_write(&self) -> Option> { + if self.raw.try_lock_exclusive() { + Some(self.write_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with exclusive write access until a + /// timeout is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the exclusive access when it is dropped. + #[inline] + pub fn try_write_for(&self, timeout: Duration) -> Option> { + if self.raw.try_lock_exclusive_for(timeout) { + Some(self.write_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with exclusive write access until a + /// timeout is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the exclusive access when it is dropped. + #[inline] + pub fn try_write_until(&self, timeout: Instant) -> Option> { + if self.raw.try_lock_exclusive_until(timeout) { + Some(self.write_guard()) + } else { + None + } + } + + /// Locks this rwlock with upgradable read access, blocking the current thread + /// until it can be acquired. + /// + /// The calling thread will be blocked until there are no more writers or other + /// upgradable reads which hold the lock. There may be other readers currently + /// inside the lock when this method returns. + /// + /// Returns an RAII guard which will release this thread's shared access + /// once it is dropped. + #[inline] + pub fn upgradable_read(&self) -> RwLockUpgradableReadGuard { + self.raw.lock_upgradable(); + self.upgradable_guard() + } + + /// Attempts to acquire this rwlock with upgradable read access. + /// + /// If the access could not be granted at this time, then `None` is returned. + /// Otherwise, an RAII guard is returned which will release the shared access + /// when it is dropped. + /// + /// This function does not block. + #[inline] + pub fn try_upgradable_read(&self) -> Option> { + if self.raw.try_lock_upgradable() { + Some(self.upgradable_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with upgradable read access until a timeout + /// is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the shared access when it is dropped. + #[inline] + pub fn try_upgradable_read_for( + &self, + timeout: Duration, + ) -> Option> { + if self.raw.try_lock_upgradable_for(timeout) { + Some(self.upgradable_guard()) + } else { + None + } + } + + /// Attempts to acquire this rwlock with upgradable read access until a timeout + /// is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// `None` is returned. Otherwise, an RAII guard is returned which will + /// release the shared access when it is dropped. + #[inline] + pub fn try_upgradable_read_until( + &self, + timeout: Instant, + ) -> Option> { + if self.raw.try_lock_upgradable_until(timeout) { + Some(self.upgradable_guard()) + } else { + None + } + } + + /// Returns a mutable reference to the underlying data. + /// + /// Since this call borrows the `RwLock` mutably, no actual locking needs to + /// take place---the mutable borrow statically guarantees no locks exist. + #[inline] + pub fn get_mut(&mut self) -> &mut T { + unsafe { &mut *self.data.get() } + } + + + /// Releases shared read access of the rwlock. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_read` or `raw_try_read`, or if an `RwLockReadGuard` from this + /// rwlock was leaked (e.g. with `mem::forget`). The rwlock must be locked + /// with shared read access. + #[inline] + pub unsafe fn raw_unlock_read(&self) { + self.raw.unlock_shared(false); + } + + /// Releases exclusive write access of the rwlock. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_write` or `raw_try_write`, or if an `RwLockWriteGuard` from this + /// rwlock was leaked (e.g. with `mem::forget`). The rwlock must be locked + /// with exclusive write access. + #[inline] + pub unsafe fn raw_unlock_write(&self) { + self.raw.unlock_exclusive(false); + } + + /// Releases upgradable read access of the rwlock. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_upgradable_read` or `raw_try_upgradable_read`, or if an + /// `RwLockUpgradableReadGuard` from this rwlock was leaked (e.g. with + /// `mem::forget`). The rwlock must be locked with upgradable read access. + #[inline] + pub unsafe fn raw_unlock_upgradable_read(&self) { + self.raw.unlock_upgradable(false); + } + + /// Releases shared read access of the rwlock using a fair unlock protocol. + /// + /// See `RwLockReadGuard::unlock_fair`. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_write` or `raw_try_write`, a raw upgradable read lock was upgraded + /// using `raw_upgrade` or `raw_try_upgrade`, or if an `RwLockWriteGuard` + /// from this rwlock was leaked (e.g. with `mem::forget`). The rwlock must + /// be locked with exclusive write access. + #[inline] + pub unsafe fn raw_unlock_read_fair(&self) { + self.raw.unlock_shared(true); + } + + /// Releases exclusive write access of the rwlock using a fair unlock + /// protocol. + /// + /// See `RwLockWriteGuard::unlock_fair`. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_write` or `raw_try_write`, a raw upgradable read lock was upgraded + /// using `raw_upgrade` or `raw_try_upgrade`, or if an `RwLockWriteGuard` + /// from this rwlock was leaked (e.g. with `mem::forget`). The rwlock must + /// be locked with exclusive write access. + #[inline] + pub unsafe fn raw_unlock_write_fair(&self) { + self.raw.unlock_exclusive(true); + } + + /// Releases upgradable read access of the rwlock using a fair unlock + /// protocol. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_upgradable_read` or `raw_try_upgradable_read`, or if an + /// `RwLockUpgradableReadGuard` from this rwlock was leaked (e.g. with + /// `mem::forget`). The rwlock must be locked with upgradable read access. + #[inline] + pub unsafe fn raw_unlock_upgradable_read_fair(&self) { + self.raw.unlock_upgradable(true); + } + + /// Atomically downgrades a write lock into a shared read lock without + /// allowing any writers to take exclusive access of the lock in the meantime. + /// + /// See `RwLockWriteGuard::downgrade`. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_write` or `raw_try_write`, or if an `RwLockWriteGuard` from this + /// rwlock was leaked (e.g. with `mem::forget`). The rwlock must be locked + /// with exclusive write access. + #[inline] + pub unsafe fn raw_downgrade(&self) { + self.raw.exclusive_to_shared(); + } + + /// Atomically downgrades an upgradable read lock into a shared read lock + /// without allowing any writers to take exclusive access of the lock in + /// the meantime. + /// + /// See `RwLockUpgradableReadGuard::downgrade`. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_upgradable_read` or `raw_try_upgradable_read`, or if an + /// `RwLockUpgradableReadGuard` from this rwlock was leaked (e.g. with + /// `mem::forget`). The rwlock must be locked with upgradable read access. + #[inline] + pub unsafe fn raw_downgrade_upgradable_read(&self) { + self.raw.upgradable_to_shared(); + } +} + +impl RwLock<()> { + /// Locks this rwlock with shared read access, blocking the current thread + /// until it can be acquired. + /// + /// This is similar to `read`, except that a `RwLockReadGuard` is not + /// returned. Instead you will need to call `raw_unlock` to release the + /// rwlock. + #[inline] + pub fn raw_read(&self) { + self.raw.lock_shared(false); + } + + /// Attempts to acquire this rwlock with shared read access. + /// + /// This is similar to `try_read`, except that a `RwLockReadGuard` is not + /// returned. Instead you will need to call `raw_unlock` to release the + /// rwlock. + #[inline] + pub fn raw_try_read(&self) -> bool { + self.raw.try_lock_shared(false) + } + + /// Locks this rwlock with shared read access, blocking the current thread + /// until it can be acquired. + /// + /// This is similar to `read_recursive`, except that a `RwLockReadGuard` is + /// not returned. Instead you will need to call `raw_unlock` to release the + /// rwlock. + #[inline] + pub fn raw_read_recursive(&self) { + self.raw.lock_shared(true); + } + + /// Attempts to acquire this rwlock with shared read access. + /// + /// This is similar to `try_read_recursive`, except that a `RwLockReadGuard` is not + /// returned. Instead you will need to call `raw_unlock` to release the + /// rwlock. + #[inline] + pub fn raw_try_read_recursive(&self) -> bool { + self.raw.try_lock_shared(true) + } + + /// Locks this rwlock with exclusive write access, blocking the current + /// thread until it can be acquired. + /// + /// This is similar to `write`, except that a `RwLockReadGuard` is not + /// returned. Instead you will need to call `raw_unlock` to release the + /// rwlock. + #[inline] + pub fn raw_write(&self) { + self.raw.lock_exclusive(); + } + + /// Attempts to lock this rwlock with exclusive write access. + /// + /// This is similar to `try_write`, except that a `RwLockReadGuard` is not + /// returned. Instead you will need to call `raw_unlock` to release the + /// rwlock. + #[inline] + pub fn raw_try_write(&self) -> bool { + self.raw.try_lock_exclusive() + } + + /// Locks this rwlock with upgradable read access, blocking the current thread + /// until it can be acquired. + /// + /// This is similar to `upgradable_read`, except that a + /// `RwLockUpgradableReadGuard` is not returned. Instead you will need to call + /// `raw_unlock` to release the rwlock. + #[inline] + pub fn raw_upgradable_read(&self) { + self.raw.lock_upgradable(); + } + + /// Attempts to acquire this rwlock with upgradable read access. + /// + /// This is similar to `try_upgradable_read`, except that a + /// `RwLockUpgradableReadGuard` is not returned. Instead you will need to call + /// `raw_unlock` to release the rwlock. + #[inline] + pub fn raw_try_upgradable_read(&self) -> bool { + self.raw.try_lock_upgradable() + } + + /// Upgrades this rwlock from upgradable read access to exclusive write access, + /// blocking the current thread until it can be acquired. + /// + /// See `RwLockUpgradableReadGuard::upgrade`. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_upgradable_read` or `raw_try_upgradable_read`, or if an + /// `RwLockUpgradableReadGuard` from this rwlock was leaked (e.g. with + /// `mem::forget`). The rwlock must be locked with upgradable read access. + #[inline] + pub unsafe fn raw_upgrade(&self) { + self.raw.upgradable_to_exclusive(); + } + + /// Attempts to upgrade this rwlock from upgradable read access to exclusive + /// write access. + /// + /// See `RwLockUpgradableReadGuard::try_upgrade`. + /// + /// # Safety + /// + /// This function must only be called if the rwlock was locked using + /// `raw_upgradable_read` or `raw_try_upgradable_read`, or if an + /// `RwLockUpgradableReadGuard` from this rwlock was leaked (e.g. with + /// `mem::forget`). The rwlock must be locked with upgradable read access. + #[inline] + pub unsafe fn raw_try_upgrade(&self) -> bool { + self.raw.try_upgradable_to_exclusive() + } +} + +impl Default for RwLock { + #[inline] + fn default() -> RwLock { + RwLock::new(Default::default()) + } +} + +impl fmt::Debug for RwLock { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.try_read() { + Some(guard) => write!(f, "RwLock {{ data: {:?} }}", &*guard), + None => write!(f, "RwLock {{ }}"), + } + } +} + +impl<'a, T: ?Sized + 'a> RwLockReadGuard<'a, T> { + /// Unlocks the `RwLock` using a fair unlock protocol. + /// + /// By default, `RwLock` is unfair and allow the current thread to re-lock + /// the rwlock before another has the chance to acquire the lock, even if + /// that thread has been blocked on the `RwLock` for a long time. This is + /// the default because it allows much higher throughput as it avoids + /// forcing a context switch on every rwlock unlock. This can result in one + /// thread acquiring a `RwLock` many more times than other threads. + /// + /// However in some cases it can be beneficial to ensure fairness by forcing + /// the lock to pass on to a waiting thread if there is one. This is done by + /// using this method instead of dropping the `RwLockReadGuard` normally. + #[inline] + pub fn unlock_fair(self) { + self.raw.unlock_shared(true); + mem::forget(self); + } + + /// Make a new `RwLockReadGuard` for a component of the locked data. + /// + /// This operation cannot fail as the `RwLockReadGuard` passed + /// in already locked the data. + /// + /// This is an associated function that needs to be + /// used as `RwLockReadGuard::map(...)`. A method would interfere with methods of + /// the same name on the contents of the locked data. + #[inline] + pub fn map(orig: Self, f: F) -> RwLockReadGuard<'a, U> + where + F: FnOnce(&T) -> &U, + { + let raw = orig.raw; + let data = f(unsafe { &*orig.data }); + mem::forget(orig); + RwLockReadGuard { + raw, + data, + marker: PhantomData, + } + } +} + +impl<'a, T: ?Sized + 'a> Deref for RwLockReadGuard<'a, T> { + type Target = T; + #[inline] + fn deref(&self) -> &T { + unsafe { &*self.data } + } +} + +impl<'a, T: ?Sized + 'a> Drop for RwLockReadGuard<'a, T> { + #[inline] + fn drop(&mut self) { + self.raw.unlock_shared(false); + } +} + +#[cfg(feature = "owning_ref")] +unsafe impl<'a, T: ?Sized> StableAddress for RwLockReadGuard<'a, T> {} + +impl<'a, T: ?Sized + 'a> RwLockWriteGuard<'a, T> { + /// Atomically downgrades a write lock into a read lock without allowing any + /// writers to take exclusive access of the lock in the meantime. + /// + /// Note that if there are any writers currently waiting to take the lock + /// then other readers may not be able to acquire the lock even if it was + /// downgraded. + pub fn downgrade(self) -> RwLockReadGuard<'a, T> { + self.raw.exclusive_to_shared(); + let raw = self.raw; + // Reborrow the value to avoid moving self.borrow, + // which isn't allow for types with destructors + let data = unsafe { &*self.data }; + mem::forget(self); + RwLockReadGuard { + raw, + data, + marker: PhantomData, + } + } + + /// Make a new `RwLockWriteGuard` for a component of the locked data. + /// + /// This operation cannot fail as the `RwLockWriteGuard` passed + /// in already locked the data. + /// + /// This is an associated function that needs to be + /// used as `RwLockWriteGuard::map(...)`. A method would interfere with methods of + /// the same name on the contents of the locked data. + #[inline] + pub fn map(orig: Self, f: F) -> RwLockWriteGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + { + let raw = orig.raw; + let data = f(unsafe { &mut *orig.data }); + mem::forget(orig); + RwLockWriteGuard { + raw, + data, + marker: PhantomData, + } + } + + /// Unlocks the `RwLock` using a fair unlock protocol. + /// + /// By default, `RwLock` is unfair and allow the current thread to re-lock + /// the rwlock before another has the chance to acquire the lock, even if + /// that thread has been blocked on the `RwLock` for a long time. This is + /// the default because it allows much higher throughput as it avoids + /// forcing a context switch on every rwlock unlock. This can result in one + /// thread acquiring a `RwLock` many more times than other threads. + /// + /// However in some cases it can be beneficial to ensure fairness by forcing + /// the lock to pass on to a waiting thread if there is one. This is done by + /// using this method instead of dropping the `RwLockWriteGuard` normally. + #[inline] + pub fn unlock_fair(self) { + self.raw.unlock_exclusive(true); + mem::forget(self); + } +} + +impl<'a, T: ?Sized + 'a> Deref for RwLockWriteGuard<'a, T> { + type Target = T; + #[inline] + fn deref(&self) -> &T { + unsafe { &*self.data } + } +} + +impl<'a, T: ?Sized + 'a> DerefMut for RwLockWriteGuard<'a, T> { + #[inline] + fn deref_mut(&mut self) -> &mut T { + unsafe { &mut *self.data } + } +} + +impl<'a, T: ?Sized + 'a> Drop for RwLockWriteGuard<'a, T> { + #[inline] + fn drop(&mut self) { + self.raw.unlock_exclusive(false); + } +} + +#[cfg(feature = "owning_ref")] +unsafe impl<'a, T: ?Sized> StableAddress for RwLockWriteGuard<'a, T> {} + +impl<'a, T: ?Sized + 'a> RwLockUpgradableReadGuard<'a, T> { + /// Atomically downgrades an upgradable read lock lock into a shared read lock + /// without allowing any writers to take exclusive access of the lock in the + /// meantime. + /// + /// Note that if there are any writers currently waiting to take the lock + /// then other readers may not be able to acquire the lock even if it was + /// downgraded. + pub fn downgrade(self) -> RwLockReadGuard<'a, T> { + self.raw.upgradable_to_shared(); + let raw = self.raw; + // Reborrow the value to avoid moving self.borrow, + // which isn't allow for types with destructors + let data = unsafe { &*self.data }; + mem::forget(self); + RwLockReadGuard { + raw, + data, + marker: PhantomData, + } + } + + /// Atomically upgrades an upgradable read lock lock into a exclusive write lock, + /// blocking the current thread until it can be aquired. + pub fn upgrade(self) -> RwLockWriteGuard<'a, T> { + self.raw.upgradable_to_exclusive(); + let raw = self.raw; + // Reborrow the value to avoid moving self.borrow, + // which isn't allow for types with destructors + let data = unsafe { &mut *self.data }; + mem::forget(self); + RwLockWriteGuard { + raw, + data, + marker: PhantomData, + } + } + + /// Tries to atomically upgrade an upgradable read lock into a exclusive write lock. + /// + /// If the access could not be granted at this time, then the current guard is returned. + pub fn try_upgrade(self) -> Result, Self> { + if self.raw.try_upgradable_to_exclusive() { + let raw = self.raw; + // Reborrow the value to avoid moving self.borrow, + // which isn't allow for types with destructors + let data = unsafe { &mut *self.data }; + mem::forget(self); + Ok(RwLockWriteGuard { + raw, + data, + marker: PhantomData, + }) + } else { + Err(self) + } + } + + /// Tries to atomically upgrade an upgradable read lock into a exclusive + /// write lock, until a timeout is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// the current guard is returned. + pub fn try_upgrade_for(self, timeout: Duration) -> Result, Self> { + if self.raw.try_upgradable_to_exclusive_for(timeout) { + let raw = self.raw; + // Reborrow the value to avoid moving self.borrow, + // which isn't allow for types with destructors + let data = unsafe { &mut *self.data }; + mem::forget(self); + Ok(RwLockWriteGuard { + raw, + data, + marker: PhantomData, + }) + } else { + Err(self) + } + } + + /// Tries to atomically upgrade an upgradable read lock into a exclusive + /// write lock, until a timeout is reached. + /// + /// If the access could not be granted before the timeout expires, then + /// the current guard is returned. + #[inline] + pub fn try_upgrade_until(self, timeout: Instant) -> Result, Self> { + if self.raw.try_upgradable_to_exclusive_until(timeout) { + let raw = self.raw; + // Reborrow the value to avoid moving self.borrow, + // which isn't allow for types with destructors + let data = unsafe { &mut *self.data }; + mem::forget(self); + Ok(RwLockWriteGuard { + raw, + data, + marker: PhantomData, + }) + } else { + Err(self) + } + } + + /// Unlocks the `RwLock` using a fair unlock protocol. + /// + /// By default, `RwLock` is unfair and allow the current thread to re-lock + /// the rwlock before another has the chance to acquire the lock, even if + /// that thread has been blocked on the `RwLock` for a long time. This is + /// the default because it allows much higher throughput as it avoids + /// forcing a context switch on every rwlock unlock. This can result in one + /// thread acquiring a `RwLock` many more times than other threads. + /// + /// However in some cases it can be beneficial to ensure fairness by forcing + /// the lock to pass on to a waiting thread if there is one. This is done by + /// using this method instead of dropping the `RwLockUpgradableReadGuard` normally. + #[inline] + pub fn unlock_fair(self) { + self.raw.unlock_upgradable(true); + mem::forget(self); + } +} + +impl<'a, T: ?Sized + 'a> Deref for RwLockUpgradableReadGuard<'a, T> { + type Target = T; + #[inline] + fn deref(&self) -> &T { + unsafe { &*self.data } + } +} + +impl<'a, T: ?Sized + 'a> Drop for RwLockUpgradableReadGuard<'a, T> { + #[inline] + fn drop(&mut self) { + self.raw.unlock_upgradable(false); + } +} + +#[cfg(feature = "owning_ref")] +unsafe impl<'a, T: ?Sized> StableAddress for RwLockUpgradableReadGuard<'a, T> {} + +#[cfg(test)] +mod tests { + extern crate rand; + use self::rand::Rng; + use std::sync::mpsc::channel; + use std::thread; + use std::sync::Arc; + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::time::Duration; + use RwLock; + + #[derive(Eq, PartialEq, Debug)] + struct NonCopy(i32); + + #[test] + fn smoke() { + let l = RwLock::new(()); + drop(l.read()); + drop(l.write()); + drop(l.upgradable_read()); + drop((l.read(), l.read())); + drop((l.read(), l.upgradable_read())); + drop(l.write()); + } + + #[test] + fn frob() { + const N: u32 = 10; + const M: u32 = 1000; + + let r = Arc::new(RwLock::new(())); + + let (tx, rx) = channel::<()>(); + for _ in 0..N { + let tx = tx.clone(); + let r = r.clone(); + thread::spawn(move || { + let mut rng = rand::thread_rng(); + for _ in 0..M { + if rng.gen_weighted_bool(N) { + drop(r.write()); + } else { + drop(r.read()); + } + } + drop(tx); + }); + } + drop(tx); + let _ = rx.recv(); + } + + #[test] + fn test_rw_arc_no_poison_wr() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let _lock = arc2.write(); + panic!(); + }).join(); + let lock = arc.read(); + assert_eq!(*lock, 1); + } + + #[test] + fn test_rw_arc_no_poison_ww() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let _lock = arc2.write(); + panic!(); + }).join(); + let lock = arc.write(); + assert_eq!(*lock, 1); + } + + #[test] + fn test_rw_arc_no_poison_rr() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let _lock = arc2.read(); + panic!(); + }).join(); + let lock = arc.read(); + assert_eq!(*lock, 1); + } + + #[test] + fn test_rw_arc_no_poison_rw() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _: Result<(), _> = thread::spawn(move || { + let _lock = arc2.read(); + panic!() + }).join(); + let lock = arc.write(); + assert_eq!(*lock, 1); + } + + #[test] + fn test_ruw_arc() { + let arc = Arc::new(RwLock::new(0)); + let arc2 = arc.clone(); + let (tx, rx) = channel(); + + thread::spawn(move || { + for _ in 0..10 { + let mut lock = arc2.write(); + let tmp = *lock; + *lock = -1; + thread::yield_now(); + *lock = tmp + 1; + } + tx.send(()).unwrap(); + }); + + let mut children = Vec::new(); + + // Upgradable readers try to catch the writer in the act and also + // try to touch the value + for _ in 0..5 { + let arc3 = arc.clone(); + children.push(thread::spawn(move || { + let lock = arc3.upgradable_read(); + let tmp = *lock; + assert!(tmp >= 0); + thread::yield_now(); + let mut lock = lock.upgrade(); + assert_eq!(tmp, *lock); + *lock = -1; + thread::yield_now(); + *lock = tmp + 1; + })); + } + + // Readers try to catch the writers in the act + for _ in 0..5 { + let arc4 = arc.clone(); + children.push(thread::spawn(move || { + let lock = arc4.read(); + assert!(*lock >= 0); + })); + } + + // Wait for children to pass their asserts + for r in children { + assert!(r.join().is_ok()); + } + + // Wait for writer to finish + rx.recv().unwrap(); + let lock = arc.read(); + assert_eq!(*lock, 15); + } + + #[test] + fn test_rw_arc() { + let arc = Arc::new(RwLock::new(0)); + let arc2 = arc.clone(); + let (tx, rx) = channel(); + + thread::spawn(move || { + let mut lock = arc2.write(); + for _ in 0..10 { + let tmp = *lock; + *lock = -1; + thread::yield_now(); + *lock = tmp + 1; + } + tx.send(()).unwrap(); + }); + + // Readers try to catch the writer in the act + let mut children = Vec::new(); + for _ in 0..5 { + let arc3 = arc.clone(); + children.push(thread::spawn(move || { + let lock = arc3.read(); + assert!(*lock >= 0); + })); + } + + // Wait for children to pass their asserts + for r in children { + assert!(r.join().is_ok()); + } + + // Wait for writer to finish + rx.recv().unwrap(); + let lock = arc.read(); + assert_eq!(*lock, 10); + } + + #[test] + fn test_rw_arc_access_in_unwind() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _ = thread::spawn(move || -> () { + struct Unwinder { + i: Arc>, + } + impl Drop for Unwinder { + fn drop(&mut self) { + let mut lock = self.i.write(); + *lock += 1; + } + } + let _u = Unwinder { i: arc2 }; + panic!(); + }).join(); + let lock = arc.read(); + assert_eq!(*lock, 2); + } + + #[test] + fn test_rwlock_unsized() { + let rw: &RwLock<[i32]> = &RwLock::new([1, 2, 3]); + { + let b = &mut *rw.write(); + b[0] = 4; + b[2] = 5; + } + let comp: &[i32] = &[4, 2, 5]; + assert_eq!(&*rw.read(), comp); + } + + #[test] + fn test_rwlock_try_read() { + let lock = RwLock::new(0isize); + { + let read_guard = lock.read(); + + let read_result = lock.try_read(); + assert!( + read_result.is_some(), + "try_read should succeed while read_guard is in scope" + ); + + drop(read_guard); + } + { + let upgrade_guard = lock.upgradable_read(); + + let read_result = lock.try_read(); + assert!( + read_result.is_some(), + "try_read should succeed while upgrade_guard is in scope" + ); + + drop(upgrade_guard); + } + { + let write_guard = lock.write(); + + let read_result = lock.try_read(); + assert!( + read_result.is_none(), + "try_read should fail while write_guard is in scope" + ); + + drop(write_guard); + } + } + + #[test] + fn test_rwlock_try_write() { + let lock = RwLock::new(0isize); + { + let read_guard = lock.read(); + + let write_result = lock.try_write(); + assert!( + write_result.is_none(), + "try_write should fail while read_guard is in scope" + ); + + drop(read_guard); + } + { + let upgrade_guard = lock.upgradable_read(); + + let write_result = lock.try_write(); + assert!( + write_result.is_none(), + "try_write should fail while upgrade_guard is in scope" + ); + + drop(upgrade_guard); + } + { + let write_guard = lock.write(); + + let write_result = lock.try_write(); + assert!( + write_result.is_none(), + "try_write should fail while write_guard is in scope" + ); + + drop(write_guard); + } + } + + #[test] + fn test_rwlock_try_upgrade() { + let lock = RwLock::new(0isize); + { + let read_guard = lock.read(); + + let upgrade_result = lock.try_upgradable_read(); + assert!( + upgrade_result.is_some(), + "try_upgradable_read should succeed while read_guard is in scope" + ); + + drop(read_guard); + } + { + let upgrade_guard = lock.upgradable_read(); + + let upgrade_result = lock.try_upgradable_read(); + assert!( + upgrade_result.is_none(), + "try_upgradable_read should fail while upgrade_guard is in scope" + ); + + drop(upgrade_guard); + } + { + let write_guard = lock.write(); + + let upgrade_result = lock.try_upgradable_read(); + assert!( + upgrade_result.is_none(), + "try_upgradable should fail while write_guard is in scope" + ); + + drop(write_guard); + } + } + + #[test] + fn test_into_inner() { + let m = RwLock::new(NonCopy(10)); + assert_eq!(m.into_inner(), NonCopy(10)); + } + + #[test] + fn test_into_inner_drop() { + struct Foo(Arc); + impl Drop for Foo { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } + } + let num_drops = Arc::new(AtomicUsize::new(0)); + let m = RwLock::new(Foo(num_drops.clone())); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + { + let _inner = m.into_inner(); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + } + assert_eq!(num_drops.load(Ordering::SeqCst), 1); + } + + #[test] + fn test_get_mut() { + let mut m = RwLock::new(NonCopy(10)); + *m.get_mut() = NonCopy(20); + assert_eq!(m.into_inner(), NonCopy(20)); + } + + #[test] + fn test_rwlockguard_sync() { + fn sync(_: T) {} + + let rwlock = RwLock::new(()); + sync(rwlock.read()); + sync(rwlock.write()); + } + + #[test] + fn test_rwlock_downgrade() { + let x = Arc::new(RwLock::new(0)); + let mut handles = Vec::new(); + for _ in 0..8 { + let x = x.clone(); + handles.push(thread::spawn(move || { + for _ in 0..100 { + let mut writer = x.write(); + *writer += 1; + let cur_val = *writer; + let reader = writer.downgrade(); + assert_eq!(cur_val, *reader); + } + })); + } + for handle in handles { + handle.join().unwrap() + } + assert_eq!(*x.read(), 800); + } + + #[test] + fn test_rwlock_recursive() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _lock1 = arc.read(); + thread::spawn(move || { + let _lock = arc2.write(); + }); + thread::sleep(Duration::from_millis(100)); + + // A normal read would block here since there is a pending writer + let _lock2 = arc.read_recursive(); + } +} diff --git a/src/vendor/parking_lot/src/stable.rs b/src/vendor/parking_lot/src/stable.rs new file mode 100644 index 0000000000..8539850d51 --- /dev/null +++ b/src/vendor/parking_lot/src/stable.rs @@ -0,0 +1,87 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#![allow(dead_code)] + +use std::sync::atomic; + +// Re-export this for convenience +pub use std::sync::atomic::{fence, Ordering}; + +// Wrapper around AtomicUsize for non-nightly which has usable compare_exchange +// and compare_exchange_weak methods. +pub struct AtomicUsize(atomic::AtomicUsize); +pub use self::AtomicUsize as AtomicU8; + +// Constants for static initialization +pub const ATOMIC_USIZE_INIT: AtomicUsize = AtomicUsize(atomic::ATOMIC_USIZE_INIT); +pub use self::ATOMIC_USIZE_INIT as ATOMIC_U8_INIT; + +impl AtomicUsize { + #[inline] + pub fn new(val: usize) -> AtomicUsize { + AtomicUsize(atomic::AtomicUsize::new(val)) + } + #[inline] + pub fn load(&self, order: Ordering) -> usize { + self.0.load(order) + } + #[inline] + pub fn store(&self, val: usize, order: Ordering) { + self.0.store(val, order); + } + #[inline] + pub fn swap(&self, val: usize, order: Ordering) -> usize { + self.0.swap(val, order) + } + #[inline] + pub fn fetch_add(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_add(val, order) + } + #[inline] + pub fn fetch_sub(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_sub(val, order) + } + #[inline] + pub fn fetch_and(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_and(val, order) + } + #[inline] + pub fn fetch_or(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_or(val, order) + } + #[inline] + pub fn compare_exchange( + &self, + old: usize, + new: usize, + order: Ordering, + _: Ordering, + ) -> Result { + let res = self.0.compare_and_swap(old, new, order); + if res == old { + Ok(res) + } else { + Err(res) + } + } + #[inline] + pub fn compare_exchange_weak( + &self, + old: usize, + new: usize, + order: Ordering, + _: Ordering, + ) -> Result { + let res = self.0.compare_and_swap(old, new, order); + if res == old { + Ok(res) + } else { + Err(res) + } + } +} diff --git a/src/vendor/parking_lot/src/util.rs b/src/vendor/parking_lot/src/util.rs new file mode 100644 index 0000000000..c7dfd32250 --- /dev/null +++ b/src/vendor/parking_lot/src/util.rs @@ -0,0 +1,32 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +// Option::unchecked_unwrap +pub trait UncheckedOptionExt { + unsafe fn unchecked_unwrap(self) -> T; +} + +impl UncheckedOptionExt for Option { + #[inline] + unsafe fn unchecked_unwrap(self) -> T { + match self { + Some(x) => x, + None => unreachable(), + } + } +} + +// Equivalent to intrinsics::unreachable() in release mode +#[inline] +unsafe fn unreachable() -> ! { + if cfg!(debug_assertions) { + unreachable!(); + } else { + enum Void {} + match *(1 as *const Void) {} + } +} diff --git a/src/vendor/parking_lot_core/.cargo-checksum.json b/src/vendor/parking_lot_core/.cargo-checksum.json new file mode 100644 index 0000000000..304d5253f0 --- /dev/null +++ b/src/vendor/parking_lot_core/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"b90c47038cc8654d7d2a41c0549b897c17be253cbd83c07cccd19b6eede7693d","Cargo.toml.orig":"b08479dc64469f7ac8fc62932a1ba9756e058b438a32539cc74527f6a8dcd9b3","src/lib.rs":"c17ce1ee49301f6782ac1b67fc6e4a69fb93e4269f2467dc68917710da61f7d7","src/parking_lot.rs":"95b327fa48867a9160f37396edd45945d18bb80a39c0eb5c848258c6198e81e5","src/spinwait.rs":"5aee4a6e8d33eec1b6a81b21ff3b223460d8fa2d37e633b31b8ca27fabe659cb","src/stable.rs":"4562ea9a408bd3917df6d30c8354bf51f46bc69b3360815813730743204adfdc","src/thread_parker/generic.rs":"0c30db3d1c96bd5ef284a4761a829aba8d21fc813b3d1d70b2baf5f00744e006","src/thread_parker/linux.rs":"3fd3ed3757d6b00b1d95e76023e2c4c682d9a93bbff181e8d21a67c1ef813f63","src/thread_parker/unix.rs":"ff5a543f21895c8114bd4f89b5764882beab1f3a37ddbd8fc31c783e1db3f1c1","src/thread_parker/windows/keyed_event.rs":"b54b0855b10ed2c188ce42094c6e4069e92e325f870d0c0f8244bfe2d7811b66","src/thread_parker/windows/mod.rs":"dc5359b10275a4aaee04024c202b115d267e4ea15917546b042c4035c0218136","src/thread_parker/windows/waitaddress.rs":"2da78bfe09e4262a6cd6271d6416a9debdb3fd3abb1993be1c68515952576874","src/util.rs":"2d07c0c010a857790ae2ed6a1215eeed8af76859e076797ea1ba8dec82169e84","src/word_lock.rs":"6ab156a775c46423bbb7dae520f181dde1747140d52ba995850969498559c7b2"},"package":"6bf05dc61189828dfd7a59fd6e66d538e88d6b30390da1124a291e09fd3098b3"} \ No newline at end of file diff --git a/src/vendor/parking_lot_core/.cargo-ok b/src/vendor/parking_lot_core/.cargo-ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/vendor/parking_lot_core/Cargo.toml b/src/vendor/parking_lot_core/Cargo.toml new file mode 100644 index 0000000000..e5746d1988 --- /dev/null +++ b/src/vendor/parking_lot_core/Cargo.toml @@ -0,0 +1,49 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "parking_lot_core" +version = "0.2.9" +authors = ["Amanieu d'Antras "] +description = "An advanced API for creating custom synchronization primitives." +documentation = "https://amanieu.github.io/parking_lot/parking_lot_core/index.html" +keywords = ["mutex", "condvar", "rwlock", "once", "thread"] +license = "Apache-2.0/MIT" +repository = "https://github.com/Amanieu/parking_lot" +[dependencies.backtrace] +version = "0.3.2" +optional = true + +[dependencies.petgraph] +version = "0.4.5" +optional = true + +[dependencies.rand] +version = "0.3" + +[dependencies.smallvec] +version = "0.6" + +[dependencies.thread-id] +version = "3.2.0" +optional = true + +[features] +deadlock_detection = ["petgraph", "thread-id", "backtrace"] +nightly = [] +[target."cfg(unix)".dependencies.libc] +version = "0.2.15" +[target."cfg(windows)".dependencies.kernel32-sys] +version = "0.2" + +[target."cfg(windows)".dependencies.winapi] +version = "0.2" diff --git a/src/vendor/parking_lot_core/Cargo.toml.orig b/src/vendor/parking_lot_core/Cargo.toml.orig new file mode 100644 index 0000000000..ba08196e31 --- /dev/null +++ b/src/vendor/parking_lot_core/Cargo.toml.orig @@ -0,0 +1,27 @@ +[package] +name = "parking_lot_core" +version = "0.2.9" +authors = ["Amanieu d'Antras "] +description = "An advanced API for creating custom synchronization primitives." +documentation = "https://amanieu.github.io/parking_lot/parking_lot_core/index.html" +license = "Apache-2.0/MIT" +repository = "https://github.com/Amanieu/parking_lot" +keywords = ["mutex", "condvar", "rwlock", "once", "thread"] + +[dependencies] +smallvec = "0.6" +rand = "0.3" +petgraph = { version = "0.4.5", optional = true } +thread-id = { version = "3.2.0", optional = true } +backtrace = { version = "0.3.2", optional = true } + +[target.'cfg(unix)'.dependencies] +libc = "0.2.15" + +[target.'cfg(windows)'.dependencies] +winapi = "0.2" +kernel32-sys = "0.2" + +[features] +nightly = [] +deadlock_detection = ["petgraph", "thread-id", "backtrace"] diff --git a/src/vendor/parking_lot_core/src/lib.rs b/src/vendor/parking_lot_core/src/lib.rs new file mode 100644 index 0000000000..4197e09b48 --- /dev/null +++ b/src/vendor/parking_lot_core/src/lib.rs @@ -0,0 +1,88 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +//! This library exposes a low-level API for creating your own efficient +//! synchronization primitives. +//! +//! # The parking lot +//! +//! To keep synchronization primitives small, all thread queuing and suspending +//! functionality is offloaded to the *parking lot*. The idea behind this is based +//! on the Webkit [`WTF::ParkingLot`](https://webkit.org/blog/6161/locking-in-webkit/) +//! class, which essentially consists of a hash table mapping of lock addresses +//! to queues of parked (sleeping) threads. The Webkit parking lot was itself +//! inspired by Linux [futexes](http://man7.org/linux/man-pages/man2/futex.2.html), +//! but it is more powerful since it allows invoking callbacks while holding a +//! queue lock. +//! +//! There are two main operations that can be performed on the parking lot: +//! +//! - *Parking* refers to suspending the thread while simultaneously enqueuing it +//! on a queue keyed by some address. +//! - *Unparking* refers to dequeuing a thread from a queue keyed by some address +//! and resuming it. +//! +//! See the documentation of the individual functions for more details. +//! +//! # Building custom synchronization primitives +//! +//! Building custom synchronization primitives is very simple since the parking +//! lot takes care of all the hard parts for you. A simple example for a +//! custom primitive would be to integrate a `Mutex` inside another data type. +//! Since a mutex only requires 2 bits, it can share space with other data. +//! For example, one could create an `ArcMutex` type that combines the atomic +//! reference count and the two mutex bits in the same atomic word. + +#![warn(missing_docs)] +#![cfg_attr(feature = "nightly", feature(const_fn, thread_local_state))] +#![cfg_attr(all(feature = "nightly", target_os = "linux"), feature(integer_atomics))] +#![cfg_attr(feature = "nightly", feature(asm))] + +extern crate rand; +extern crate smallvec; + +#[cfg(feature = "deadlock_detection")] +extern crate backtrace; +#[cfg(feature = "deadlock_detection")] +extern crate petgraph; +#[cfg(feature = "deadlock_detection")] +extern crate thread_id; + +#[cfg(unix)] +extern crate libc; + +#[cfg(windows)] +extern crate kernel32; +#[cfg(windows)] +extern crate winapi; + +#[cfg(all(feature = "nightly", target_os = "linux"))] +#[path = "thread_parker/linux.rs"] +mod thread_parker; +#[cfg(all(unix, not(all(feature = "nightly", target_os = "linux"))))] +#[path = "thread_parker/unix.rs"] +mod thread_parker; +#[cfg(windows)] +#[path = "thread_parker/windows/mod.rs"] +mod thread_parker; +#[cfg(not(any(windows, unix)))] +#[path = "thread_parker/generic.rs"] +mod thread_parker; + +#[cfg(not(feature = "nightly"))] +mod stable; + +mod util; +mod spinwait; +mod word_lock; +mod parking_lot; + +pub use parking_lot::{FilterOp, ParkResult, ParkToken, RequeueOp, UnparkResult, UnparkToken}; +pub use parking_lot::{DEFAULT_PARK_TOKEN, DEFAULT_UNPARK_TOKEN}; +pub use parking_lot::{park, unpark_all, unpark_filter, unpark_one, unpark_requeue}; +pub use spinwait::SpinWait; +pub use parking_lot::deadlock; diff --git a/src/vendor/parking_lot_core/src/parking_lot.rs b/src/vendor/parking_lot_core/src/parking_lot.rs new file mode 100644 index 0000000000..5065bb715d --- /dev/null +++ b/src/vendor/parking_lot_core/src/parking_lot.rs @@ -0,0 +1,1392 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +#[cfg(not(feature = "nightly"))] +use stable::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::time::{Duration, Instant}; +use std::cell::{Cell, UnsafeCell}; +use std::ptr; +use std::mem; +use std::thread::LocalKey; +#[cfg(not(feature = "nightly"))] +use std::panic; +use smallvec::SmallVec; +use rand::{self, Rng, XorShiftRng}; +use thread_parker::ThreadParker; +use word_lock::WordLock; +use util::UncheckedOptionExt; + +static NUM_THREADS: AtomicUsize = ATOMIC_USIZE_INIT; +static HASHTABLE: AtomicUsize = ATOMIC_USIZE_INIT; + +// Even with 3x more buckets than threads, the memory overhead per thread is +// still only a few hundred bytes per thread. +const LOAD_FACTOR: usize = 3; + +struct HashTable { + // Hash buckets for the table + entries: Box<[Bucket]>, + + // Number of bits used for the hash function + hash_bits: u32, + + // Previous table. This is only kept to keep leak detectors happy. + _prev: *const HashTable, +} + +impl HashTable { + fn new(num_threads: usize, prev: *const HashTable) -> Box { + let new_size = (num_threads * LOAD_FACTOR).next_power_of_two(); + let hash_bits = 0usize.leading_zeros() - new_size.leading_zeros() - 1; + let bucket = Bucket { + mutex: WordLock::new(), + queue_head: Cell::new(ptr::null()), + queue_tail: Cell::new(ptr::null()), + fair_timeout: UnsafeCell::new(FairTimeout::new()), + _padding: unsafe { mem::uninitialized() }, + }; + Box::new(HashTable { + entries: vec![bucket; new_size].into_boxed_slice(), + hash_bits: hash_bits, + _prev: prev, + }) + } +} + +struct Bucket { + // Lock protecting the queue + mutex: WordLock, + + // Linked list of threads waiting on this bucket + queue_head: Cell<*const ThreadData>, + queue_tail: Cell<*const ThreadData>, + + // Next time at which point be_fair should be set + fair_timeout: UnsafeCell, + + // Padding to avoid false sharing between buckets. Ideally we would just + // align the bucket structure to 64 bytes, but Rust doesn't support that + // yet. + _padding: [u8; 64], +} + +// Implementation of Clone for Bucket, needed to make vec![] work +impl Clone for Bucket { + fn clone(&self) -> Bucket { + Bucket { + mutex: WordLock::new(), + queue_head: Cell::new(ptr::null()), + queue_tail: Cell::new(ptr::null()), + fair_timeout: UnsafeCell::new(FairTimeout::new()), + _padding: unsafe { mem::uninitialized() }, + } + } +} + +struct FairTimeout { + // Next time at which point be_fair should be set + timeout: Instant, + + // Random number generator for calculating the next timeout + rng: XorShiftRng, +} + +impl FairTimeout { + fn new() -> FairTimeout { + FairTimeout { + timeout: Instant::now(), + rng: rand::weak_rng(), + } + } + + // Determine whether we should force a fair unlock, and update the timeout + fn should_timeout(&mut self) -> bool { + let now = Instant::now(); + if now > self.timeout { + self.timeout = now + Duration::new(0, self.rng.gen_range(0, 1000000)); + true + } else { + false + } + } +} + +struct ThreadData { + parker: ThreadParker, + + // Key that this thread is sleeping on. This may change if the thread is + // requeued to a different key. + key: AtomicUsize, + + // Linked list of parked threads in a bucket + next_in_queue: Cell<*const ThreadData>, + + // UnparkToken passed to this thread when it is unparked + unpark_token: Cell, + + // ParkToken value set by the thread when it was parked + park_token: Cell, + + // Is the thread parked with a timeout? + parked_with_timeout: Cell, + + // Extra data for deadlock detection + // TODO: once supported in stable replace with #[cfg...] & remove dummy struct/impl + #[allow(dead_code)] deadlock_data: deadlock::DeadlockData, +} + +impl ThreadData { + fn new() -> ThreadData { + // Keep track of the total number of live ThreadData objects and resize + // the hash table accordingly. + let num_threads = NUM_THREADS.fetch_add(1, Ordering::Relaxed) + 1; + unsafe { + grow_hashtable(num_threads); + } + + ThreadData { + parker: ThreadParker::new(), + key: AtomicUsize::new(0), + next_in_queue: Cell::new(ptr::null()), + unpark_token: Cell::new(DEFAULT_UNPARK_TOKEN), + park_token: Cell::new(DEFAULT_PARK_TOKEN), + parked_with_timeout: Cell::new(false), + deadlock_data: deadlock::DeadlockData::new(), + } + } +} + +// Returns a ThreadData structure for the current thread +unsafe fn get_thread_data(local: &mut Option) -> &ThreadData { + // Try to read from thread-local storage, but return None if the TLS has + // already been destroyed. + #[cfg(feature = "nightly")] + fn try_get_tls(key: &'static LocalKey) -> Option<*const ThreadData> { + key.try_with(|x| x as *const ThreadData).ok() + } + #[cfg(not(feature = "nightly"))] + fn try_get_tls(key: &'static LocalKey) -> Option<*const ThreadData> { + panic::catch_unwind(|| key.with(|x| x as *const ThreadData)).ok() + } + + // Unlike word_lock::ThreadData, parking_lot::ThreadData is always expensive + // to construct. Try to use a thread-local version if possible. + thread_local!(static THREAD_DATA: ThreadData = ThreadData::new()); + if let Some(tls) = try_get_tls(&THREAD_DATA) { + return &*tls; + } + + // Otherwise just create a ThreadData on the stack + *local = Some(ThreadData::new()); + local.as_ref().unwrap() +} + +impl Drop for ThreadData { + fn drop(&mut self) { + NUM_THREADS.fetch_sub(1, Ordering::Relaxed); + } +} + +// Get a pointer to the latest hash table, creating one if it doesn't exist yet. +unsafe fn get_hashtable() -> *const HashTable { + let mut table = HASHTABLE.load(Ordering::Acquire); + + // If there is no table, create one + if table == 0 { + let new_table = Box::into_raw(HashTable::new(LOAD_FACTOR, ptr::null())); + + // If this fails then it means some other thread created the hash + // table first. + match HASHTABLE.compare_exchange( + 0, + new_table as usize, + Ordering::Release, + Ordering::Relaxed, + ) { + Ok(_) => return new_table, + Err(x) => table = x, + } + + // Free the table we created + Box::from_raw(new_table); + } + + table as *const HashTable +} + +// Grow the hash table so that it is big enough for the given number of threads. +// This isn't performance-critical since it is only done when a ThreadData is +// created, which only happens once per thread. +unsafe fn grow_hashtable(num_threads: usize) { + // If there is no table, create one + if HASHTABLE.load(Ordering::Relaxed) == 0 { + let new_table = Box::into_raw(HashTable::new(num_threads, ptr::null())); + + // If this fails then it means some other thread created the hash + // table first. + if HASHTABLE + .compare_exchange(0, new_table as usize, Ordering::Release, Ordering::Relaxed) + .is_ok() + { + return; + } + + // Free the table we created + Box::from_raw(new_table); + } + + let mut old_table; + loop { + old_table = HASHTABLE.load(Ordering::Acquire) as *mut HashTable; + + // Check if we need to resize the existing table + if (*old_table).entries.len() >= LOAD_FACTOR * num_threads { + return; + } + + // Lock all buckets in the old table + for b in &(*old_table).entries[..] { + b.mutex.lock(); + } + + // Now check if our table is still the latest one. Another thread could + // have grown the hash table between us reading HASHTABLE and locking + // the buckets. + if HASHTABLE.load(Ordering::Relaxed) == old_table as usize { + break; + } + + // Unlock buckets and try again + for b in &(*old_table).entries[..] { + b.mutex.unlock(); + } + } + + // Create the new table + let new_table = HashTable::new(num_threads, old_table); + + // Move the entries from the old table to the new one + for b in &(*old_table).entries[..] { + let mut current = b.queue_head.get(); + while !current.is_null() { + let next = (*current).next_in_queue.get(); + let hash = hash((*current).key.load(Ordering::Relaxed), new_table.hash_bits); + if new_table.entries[hash].queue_tail.get().is_null() { + new_table.entries[hash].queue_head.set(current); + } else { + (*new_table.entries[hash].queue_tail.get()) + .next_in_queue + .set(current); + } + new_table.entries[hash].queue_tail.set(current); + (*current).next_in_queue.set(ptr::null()); + current = next; + } + } + + // Publish the new table. No races are possible at this point because + // any other thread trying to grow the hash table is blocked on the bucket + // locks in the old table. + HASHTABLE.store(Box::into_raw(new_table) as usize, Ordering::Release); + + // Unlock all buckets in the old table + for b in &(*old_table).entries[..] { + b.mutex.unlock(); + } +} + +// Hash function for addresses +#[cfg(target_pointer_width = "32")] +fn hash(key: usize, bits: u32) -> usize { + key.wrapping_mul(0x9E3779B9) >> (32 - bits) +} +#[cfg(target_pointer_width = "64")] +fn hash(key: usize, bits: u32) -> usize { + key.wrapping_mul(0x9E3779B97F4A7C15) >> (64 - bits) +} + +// Lock the bucket for the given key +unsafe fn lock_bucket<'a>(key: usize) -> &'a Bucket { + let mut bucket; + loop { + let hashtable = get_hashtable(); + + let hash = hash(key, (*hashtable).hash_bits); + bucket = &(*hashtable).entries[hash]; + + // Lock the bucket + bucket.mutex.lock(); + + // If no other thread has rehashed the table before we grabbed the lock + // then we are good to go! The lock we grabbed prevents any rehashes. + if HASHTABLE.load(Ordering::Relaxed) == hashtable as usize { + return bucket; + } + + // Unlock the bucket and try again + bucket.mutex.unlock(); + } +} + +// Lock the bucket for the given key, but check that the key hasn't been changed +// in the meantime due to a requeue. +unsafe fn lock_bucket_checked<'a>(key: &AtomicUsize) -> (usize, &'a Bucket) { + let mut bucket; + loop { + let hashtable = get_hashtable(); + let current_key = key.load(Ordering::Relaxed); + + let hash = hash(current_key, (*hashtable).hash_bits); + bucket = &(*hashtable).entries[hash]; + + // Lock the bucket + bucket.mutex.lock(); + + // Check that both the hash table and key are correct while the bucket + // is locked. Note that the key can't change once we locked the proper + // bucket for it, so we just keep trying until we have the correct key. + if HASHTABLE.load(Ordering::Relaxed) == hashtable as usize + && key.load(Ordering::Relaxed) == current_key + { + return (current_key, bucket); + } + + // Unlock the bucket and try again + bucket.mutex.unlock(); + } +} + +// Lock the two buckets for the given pair of keys +unsafe fn lock_bucket_pair<'a>(key1: usize, key2: usize) -> (&'a Bucket, &'a Bucket) { + let mut bucket1; + loop { + let hashtable = get_hashtable(); + + // Get the lowest bucket first + let hash1 = hash(key1, (*hashtable).hash_bits); + let hash2 = hash(key2, (*hashtable).hash_bits); + if hash1 <= hash2 { + bucket1 = &(*hashtable).entries[hash1]; + } else { + bucket1 = &(*hashtable).entries[hash2]; + } + + // Lock the first bucket + bucket1.mutex.lock(); + + // If no other thread has rehashed the table before we grabbed the lock + // then we are good to go! The lock we grabbed prevents any rehashes. + if HASHTABLE.load(Ordering::Relaxed) == hashtable as usize { + // Now lock the second bucket and return the two buckets + if hash1 == hash2 { + return (bucket1, bucket1); + } else if hash1 < hash2 { + let bucket2 = &(*hashtable).entries[hash2]; + bucket2.mutex.lock(); + return (bucket1, bucket2); + } else { + let bucket2 = &(*hashtable).entries[hash1]; + bucket2.mutex.lock(); + return (bucket2, bucket1); + } + } + + // Unlock the bucket and try again + bucket1.mutex.unlock(); + } +} + +// Unlock a pair of buckets +unsafe fn unlock_bucket_pair(bucket1: &Bucket, bucket2: &Bucket) { + if bucket1 as *const _ == bucket2 as *const _ { + bucket1.mutex.unlock(); + } else if bucket1 as *const _ < bucket2 as *const _ { + bucket2.mutex.unlock(); + bucket1.mutex.unlock(); + } else { + bucket1.mutex.unlock(); + bucket2.mutex.unlock(); + } +} + +/// Result of a park operation. +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub enum ParkResult { + /// We were unparked by another thread with the given token. + Unparked(UnparkToken), + + /// The validation callback returned false. + Invalid, + + /// The timeout expired. + TimedOut, +} + +impl ParkResult { + /// Returns true if we were unparked by another thread. + pub fn is_unparked(self) -> bool { + if let ParkResult::Unparked(_) = self { + true + } else { + false + } + } +} + +/// Result of an unpark operation. +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub struct UnparkResult { + /// The number of threads that were unparked. + pub unparked_threads: usize, + + /// Whether there are any threads remaining in the queue. This only returns + /// true if a thread was unparked. + pub have_more_threads: bool, + + /// This is set to true on average once every 0.5ms for any given key. It + /// should be used to switch to a fair unlocking mechanism for a particular + /// unlock. + pub be_fair: bool, +} + +/// Operation that `unpark_requeue` should perform. +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub enum RequeueOp { + /// Abort the operation without doing anything. + Abort, + + /// Unpark one thread and requeue the rest onto the target queue. + UnparkOneRequeueRest, + + /// Requeue all threads onto the target queue. + RequeueAll, +} + +/// Operation that `unpark_filter` should perform for each thread. +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub enum FilterOp { + /// Unpark the thread and continue scanning the list of parked threads. + Unpark, + + /// Don't unpark the thread and continue scanning the list of parked threads. + Skip, + + /// Don't unpark the thread and stop scanning the list of parked threads. + Stop, +} + +/// A value which is passed from an unparker to a parked thread. +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub struct UnparkToken(pub usize); + +/// A value associated with a parked thread which can be used by `unpark_filter`. +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +pub struct ParkToken(pub usize); + +/// A default unpark token to use. +pub const DEFAULT_UNPARK_TOKEN: UnparkToken = UnparkToken(0); + +/// A default park token to use. +pub const DEFAULT_PARK_TOKEN: ParkToken = ParkToken(0); + +/// Parks the current thread in the queue associated with the given key. +/// +/// The `validate` function is called while the queue is locked and can abort +/// the operation by returning false. If `validate` returns true then the +/// current thread is appended to the queue and the queue is unlocked. +/// +/// The `before_sleep` function is called after the queue is unlocked but before +/// the thread is put to sleep. The thread will then sleep until it is unparked +/// or the given timeout is reached. +/// +/// The `timed_out` function is also called while the queue is locked, but only +/// if the timeout was reached. It is passed the key of the queue it was in when +/// it timed out, which may be different from the original key if +/// `unpark_requeue` was called. It is also passed a bool which indicates +/// whether it was the last thread in the queue. +/// +/// # Safety +/// +/// You should only call this function with an address that you control, since +/// you could otherwise interfere with the operation of other synchronization +/// primitives. +/// +/// The `validate` and `timed_out` functions are called while the queue is +/// locked and must not panic or call into any function in `parking_lot`. +/// +/// The `before_sleep` function is called outside the queue lock and is allowed +/// to call `unpark_one`, `unpark_all`, `unpark_requeue` or `unpark_filter`, but +/// it is not allowed to call `park` or panic. +#[inline] +pub unsafe fn park( + key: usize, + validate: V, + before_sleep: B, + timed_out: T, + park_token: ParkToken, + timeout: Option, +) -> ParkResult +where + V: FnOnce() -> bool, + B: FnOnce(), + T: FnOnce(usize, bool), +{ + let mut v = Some(validate); + let mut b = Some(before_sleep); + let mut t = Some(timed_out); + park_internal( + key, + &mut || v.take().unchecked_unwrap()(), + &mut || b.take().unchecked_unwrap()(), + &mut |key, was_last_thread| t.take().unchecked_unwrap()(key, was_last_thread), + park_token, + timeout, + ) +} + +// Non-generic version to reduce monomorphization cost +unsafe fn park_internal( + key: usize, + validate: &mut FnMut() -> bool, + before_sleep: &mut FnMut(), + timed_out: &mut FnMut(usize, bool), + park_token: ParkToken, + timeout: Option, +) -> ParkResult { + // Grab our thread data, this also ensures that the hash table exists + let mut thread_data = None; + let thread_data = get_thread_data(&mut thread_data); + + // Lock the bucket for the given key + let bucket = lock_bucket(key); + + // If the validation function fails, just return + if !validate() { + bucket.mutex.unlock(); + return ParkResult::Invalid; + } + + // Append our thread data to the queue and unlock the bucket + thread_data.parked_with_timeout.set(timeout.is_some()); + thread_data.next_in_queue.set(ptr::null()); + thread_data.key.store(key, Ordering::Relaxed); + thread_data.park_token.set(park_token); + thread_data.parker.prepare_park(); + if !bucket.queue_head.get().is_null() { + (*bucket.queue_tail.get()).next_in_queue.set(thread_data); + } else { + bucket.queue_head.set(thread_data); + } + bucket.queue_tail.set(thread_data); + bucket.mutex.unlock(); + + // Invoke the pre-sleep callback + before_sleep(); + + // Park our thread and determine whether we were woken up by an unpark or by + // our timeout. Note that this isn't precise: we can still be unparked since + // we are still in the queue. + let unparked = match timeout { + Some(timeout) => thread_data.parker.park_until(timeout), + None => { + thread_data.parker.park(); + // call deadlock detection on_unpark hook + deadlock::on_unpark(thread_data); + true + } + }; + + // If we were unparked, return now + if unparked { + return ParkResult::Unparked(thread_data.unpark_token.get()); + } + + // Lock our bucket again. Note that the hashtable may have been rehashed in + // the meantime. Our key may also have changed if we were requeued. + let (key, bucket) = lock_bucket_checked(&thread_data.key); + + // Now we need to check again if we were unparked or timed out. Unlike the + // last check this is precise because we hold the bucket lock. + if !thread_data.parker.timed_out() { + bucket.mutex.unlock(); + return ParkResult::Unparked(thread_data.unpark_token.get()); + } + + // We timed out, so we now need to remove our thread from the queue + let mut link = &bucket.queue_head; + let mut current = bucket.queue_head.get(); + let mut previous = ptr::null(); + while !current.is_null() { + if current == thread_data { + let next = (*current).next_in_queue.get(); + link.set(next); + let mut was_last_thread = true; + if bucket.queue_tail.get() == current { + bucket.queue_tail.set(previous); + } else { + // Scan the rest of the queue to see if there are any other + // entries with the given key. + let mut scan = next; + while !scan.is_null() { + if (*scan).key.load(Ordering::Relaxed) == key { + was_last_thread = false; + break; + } + scan = (*scan).next_in_queue.get(); + } + } + + // Callback to indicate that we timed out, and whether we were the + // last thread on the queue. + timed_out(key, was_last_thread); + break; + } else { + link = &(*current).next_in_queue; + previous = current; + current = link.get(); + } + } + + // There should be no way for our thread to have been removed from the queue + // if we timed out. + debug_assert!(!current.is_null()); + + // Unlock the bucket, we are done + bucket.mutex.unlock(); + ParkResult::TimedOut +} + +/// Unparks one thread from the queue associated with the given key. +/// +/// The `callback` function is called while the queue is locked and before the +/// target thread is woken up. The `UnparkResult` argument to the function +/// indicates whether a thread was found in the queue and whether this was the +/// last thread in the queue. This value is also returned by `unpark_one`. +/// +/// The `callback` function should return an `UnparkToken` value which will be +/// passed to the thread that is unparked. If no thread is unparked then the +/// returned value is ignored. +/// +/// # Safety +/// +/// You should only call this function with an address that you control, since +/// you could otherwise interfere with the operation of other synchronization +/// primitives. +/// +/// The `callback` function is called while the queue is locked and must not +/// panic or call into any function in `parking_lot`. +#[inline] +pub unsafe fn unpark_one(key: usize, callback: C) -> UnparkResult +where + C: FnOnce(UnparkResult) -> UnparkToken, +{ + let mut c = Some(callback); + unpark_one_internal(key, &mut |result| c.take().unchecked_unwrap()(result)) +} + +// Non-generic version to reduce monomorphization cost +unsafe fn unpark_one_internal( + key: usize, + callback: &mut FnMut(UnparkResult) -> UnparkToken, +) -> UnparkResult { + // Lock the bucket for the given key + let bucket = lock_bucket(key); + + // Find a thread with a matching key and remove it from the queue + let mut link = &bucket.queue_head; + let mut current = bucket.queue_head.get(); + let mut previous = ptr::null(); + let mut result = UnparkResult { + unparked_threads: 0, + have_more_threads: false, + be_fair: false, + }; + while !current.is_null() { + if (*current).key.load(Ordering::Relaxed) == key { + // Remove the thread from the queue + let next = (*current).next_in_queue.get(); + link.set(next); + if bucket.queue_tail.get() == current { + bucket.queue_tail.set(previous); + } else { + // Scan the rest of the queue to see if there are any other + // entries with the given key. + let mut scan = next; + while !scan.is_null() { + if (*scan).key.load(Ordering::Relaxed) == key { + result.have_more_threads = true; + break; + } + scan = (*scan).next_in_queue.get(); + } + } + + // Invoke the callback before waking up the thread + result.unparked_threads = 1; + result.be_fair = (*bucket.fair_timeout.get()).should_timeout(); + let token = callback(result); + + // Set the token for the target thread + (*current).unpark_token.set(token); + + // This is a bit tricky: we first lock the ThreadParker to prevent + // the thread from exiting and freeing its ThreadData if its wait + // times out. Then we unlock the queue since we don't want to keep + // the queue locked while we perform a system call. Finally we wake + // up the parked thread. + let handle = (*current).parker.unpark_lock(); + bucket.mutex.unlock(); + handle.unpark(); + + return result; + } else { + link = &(*current).next_in_queue; + previous = current; + current = link.get(); + } + } + + // No threads with a matching key were found in the bucket + callback(result); + bucket.mutex.unlock(); + result +} + +/// Unparks all threads in the queue associated with the given key. +/// +/// The given `UnparkToken` is passed to all unparked threads. +/// +/// This function returns the number of threads that were unparked. +/// +/// # Safety +/// +/// You should only call this function with an address that you control, since +/// you could otherwise interfere with the operation of other synchronization +/// primitives. +pub unsafe fn unpark_all(key: usize, unpark_token: UnparkToken) -> usize { + // Lock the bucket for the given key + let bucket = lock_bucket(key); + + // Remove all threads with the given key in the bucket + let mut link = &bucket.queue_head; + let mut current = bucket.queue_head.get(); + let mut previous = ptr::null(); + let mut threads = SmallVec::<[_; 8]>::new(); + while !current.is_null() { + if (*current).key.load(Ordering::Relaxed) == key { + // Remove the thread from the queue + let next = (*current).next_in_queue.get(); + link.set(next); + if bucket.queue_tail.get() == current { + bucket.queue_tail.set(previous); + } + + // Set the token for the target thread + (*current).unpark_token.set(unpark_token); + + // Don't wake up threads while holding the queue lock. See comment + // in unpark_one. For now just record which threads we need to wake + // up. + threads.push((*current).parker.unpark_lock()); + current = next; + } else { + link = &(*current).next_in_queue; + previous = current; + current = link.get(); + } + } + + // Unlock the bucket + bucket.mutex.unlock(); + + // Now that we are outside the lock, wake up all the threads that we removed + // from the queue. + let num_threads = threads.len(); + for handle in threads.into_iter() { + handle.unpark(); + } + + num_threads +} + +/// Removes all threads from the queue associated with `key_from`, optionally +/// unparks the first one and requeues the rest onto the queue associated with +/// `key_to`. +/// +/// The `validate` function is called while both queues are locked and can abort +/// the operation by returning `RequeueOp::Abort`. It can also choose to +/// unpark the first thread in the source queue while moving the rest by +/// returning `RequeueOp::UnparkFirstRequeueRest`. Returning +/// `RequeueOp::RequeueAll` will move all threads to the destination queue. +/// +/// The `callback` function is also called while both queues are locked. It is +/// passed the `RequeueOp` returned by `validate` and an `UnparkResult` +/// indicating whether a thread was unparked and whether there are threads still +/// parked in the new queue. This `UnparkResult` value is also returned by +/// `unpark_requeue`. +/// +/// The `callback` function should return an `UnparkToken` value which will be +/// passed to the thread that is unparked. If no thread is unparked then the +/// returned value is ignored. +/// +/// # Safety +/// +/// You should only call this function with an address that you control, since +/// you could otherwise interfere with the operation of other synchronization +/// primitives. +/// +/// The `validate` and `callback` functions are called while the queue is locked +/// and must not panic or call into any function in `parking_lot`. +#[inline] +pub unsafe fn unpark_requeue( + key_from: usize, + key_to: usize, + validate: V, + callback: C, +) -> UnparkResult +where + V: FnOnce() -> RequeueOp, + C: FnOnce(RequeueOp, UnparkResult) -> UnparkToken, +{ + let mut v = Some(validate); + let mut c = Some(callback); + unpark_requeue_internal( + key_from, + key_to, + &mut || v.take().unchecked_unwrap()(), + &mut |op, r| c.take().unchecked_unwrap()(op, r), + ) +} + +// Non-generic version to reduce monomorphization cost +unsafe fn unpark_requeue_internal( + key_from: usize, + key_to: usize, + validate: &mut FnMut() -> RequeueOp, + callback: &mut FnMut(RequeueOp, UnparkResult) -> UnparkToken, +) -> UnparkResult { + // Lock the two buckets for the given key + let (bucket_from, bucket_to) = lock_bucket_pair(key_from, key_to); + + // If the validation function fails, just return + let mut result = UnparkResult { + unparked_threads: 0, + have_more_threads: false, + be_fair: false, + }; + let op = validate(); + if op == RequeueOp::Abort { + unlock_bucket_pair(bucket_from, bucket_to); + return result; + } + + // Remove all threads with the given key in the source bucket + let mut link = &bucket_from.queue_head; + let mut current = bucket_from.queue_head.get(); + let mut previous = ptr::null(); + let mut requeue_threads: *const ThreadData = ptr::null(); + let mut requeue_threads_tail: *const ThreadData = ptr::null(); + let mut wakeup_thread = None; + while !current.is_null() { + if (*current).key.load(Ordering::Relaxed) == key_from { + // Remove the thread from the queue + let next = (*current).next_in_queue.get(); + link.set(next); + if bucket_from.queue_tail.get() == current { + bucket_from.queue_tail.set(previous); + } + + // Prepare the first thread for wakeup and requeue the rest. + if op == RequeueOp::UnparkOneRequeueRest && wakeup_thread.is_none() { + wakeup_thread = Some(current); + result.unparked_threads = 1; + } else { + if !requeue_threads.is_null() { + (*requeue_threads_tail).next_in_queue.set(current); + } else { + requeue_threads = current; + } + requeue_threads_tail = current; + (*current).key.store(key_to, Ordering::Relaxed); + result.have_more_threads = true; + } + current = next; + } else { + link = &(*current).next_in_queue; + previous = current; + current = link.get(); + } + } + + // Add the requeued threads to the destination bucket + if !requeue_threads.is_null() { + (*requeue_threads_tail).next_in_queue.set(ptr::null()); + if !bucket_to.queue_head.get().is_null() { + (*bucket_to.queue_tail.get()) + .next_in_queue + .set(requeue_threads); + } else { + bucket_to.queue_head.set(requeue_threads); + } + bucket_to.queue_tail.set(requeue_threads_tail); + } + + // Invoke the callback before waking up the thread + if result.unparked_threads != 0 { + result.be_fair = (*bucket_from.fair_timeout.get()).should_timeout(); + } + let token = callback(op, result); + + // See comment in unpark_one for why we mess with the locking + if let Some(wakeup_thread) = wakeup_thread { + (*wakeup_thread).unpark_token.set(token); + let handle = (*wakeup_thread).parker.unpark_lock(); + unlock_bucket_pair(bucket_from, bucket_to); + handle.unpark(); + } else { + unlock_bucket_pair(bucket_from, bucket_to); + } + + result +} + +/// Unparks a number of threads from the front of the queue associated with +/// `key` depending on the results of a filter function which inspects the +/// `ParkToken` associated with each thread. +/// +/// The `filter` function is called for each thread in the queue or until +/// `FilterOp::Stop` is returned. This function is passed the `ParkToken` +/// associated with a particular thread, which is unparked if `FilterOp::Unpark` +/// is returned. +/// +/// The `callback` function is also called while both queues are locked. It is +/// passed an `UnparkResult` indicating the number of threads that were unparked +/// and whether there are still parked threads in the queue. This `UnparkResult` +/// value is also returned by `unpark_filter`. +/// +/// The `callback` function should return an `UnparkToken` value which will be +/// passed to all threads that are unparked. If no thread is unparked then the +/// returned value is ignored. +/// +/// # Safety +/// +/// You should only call this function with an address that you control, since +/// you could otherwise interfere with the operation of other synchronization +/// primitives. +/// +/// The `filter` and `callback` functions are called while the queue is locked +/// and must not panic or call into any function in `parking_lot`. +#[inline] +pub unsafe fn unpark_filter(key: usize, mut filter: F, callback: C) -> UnparkResult +where + F: FnMut(ParkToken) -> FilterOp, + C: FnOnce(UnparkResult) -> UnparkToken, +{ + let mut c = Some(callback); + unpark_filter_internal(key, &mut filter, &mut |r| c.take().unchecked_unwrap()(r)) +} + +// Non-generic version to reduce monomorphization cost +unsafe fn unpark_filter_internal( + key: usize, + filter: &mut FnMut(ParkToken) -> FilterOp, + callback: &mut FnMut(UnparkResult) -> UnparkToken, +) -> UnparkResult { + // Lock the bucket for the given key + let bucket = lock_bucket(key); + + // Go through the queue looking for threads with a matching key + let mut link = &bucket.queue_head; + let mut current = bucket.queue_head.get(); + let mut previous = ptr::null(); + let mut threads = SmallVec::<[_; 8]>::new(); + let mut result = UnparkResult { + unparked_threads: 0, + have_more_threads: false, + be_fair: false, + }; + while !current.is_null() { + if (*current).key.load(Ordering::Relaxed) == key { + // Call the filter function with the thread's ParkToken + let next = (*current).next_in_queue.get(); + match filter((*current).park_token.get()) { + FilterOp::Unpark => { + // Remove the thread from the queue + link.set(next); + if bucket.queue_tail.get() == current { + bucket.queue_tail.set(previous); + } + + // Add the thread to our list of threads to unpark + threads.push((current, None)); + + current = next; + } + FilterOp::Skip => { + result.have_more_threads = true; + link = &(*current).next_in_queue; + previous = current; + current = link.get(); + } + FilterOp::Stop => { + result.have_more_threads = true; + break; + } + } + } else { + link = &(*current).next_in_queue; + previous = current; + current = link.get(); + } + } + + // Invoke the callback before waking up the threads + result.unparked_threads = threads.len(); + if result.unparked_threads != 0 { + result.be_fair = (*bucket.fair_timeout.get()).should_timeout(); + } + let token = callback(result); + + // Pass the token to all threads that are going to be unparked and prepare + // them for unparking. + for t in threads.iter_mut() { + (*t.0).unpark_token.set(token); + t.1 = Some((*t.0).parker.unpark_lock()); + } + + bucket.mutex.unlock(); + + // Now that we are outside the lock, wake up all the threads that we removed + // from the queue. + for (_, handle) in threads.into_iter() { + handle.unchecked_unwrap().unpark(); + } + + result +} + +/// [Experimental] Deadlock detection +/// +/// Enabled via the `deadlock_detection` feature flag. +pub mod deadlock { + #[cfg(feature = "deadlock_detection")] + use super::deadlock_impl; + + #[cfg(feature = "deadlock_detection")] + pub(super) use super::deadlock_impl::DeadlockData; + + #[cfg(not(feature = "deadlock_detection"))] + pub(super) struct DeadlockData {} + + #[cfg(not(feature = "deadlock_detection"))] + impl DeadlockData { + pub(super) fn new() -> Self { + DeadlockData {} + } + } + + /// Acquire a resource identified by key in the deadlock detector + /// Noop if deadlock_detection feature isn't enabled. + /// Note: Call after the resource is acquired + #[inline] + pub unsafe fn acquire_resource(_key: usize) { + #[cfg(feature = "deadlock_detection")] + deadlock_impl::acquire_resource(_key); + } + + /// Release a resource identified by key in the deadlock detector. + /// Noop if deadlock_detection feature isn't enabled. + /// Note: Call before the resource is released + /// # Panics + /// Panics if the resource was already released or wasn't acquired in this thread. + #[inline] + pub unsafe fn release_resource(_key: usize) { + #[cfg(feature = "deadlock_detection")] + deadlock_impl::release_resource(_key); + } + + /// Returns all deadlocks detected *since* the last call. + /// Each cycle consist of a vector of `DeadlockedThread`. + #[cfg(feature = "deadlock_detection")] + #[inline] + pub fn check_deadlock() -> Vec> { + deadlock_impl::check_deadlock() + } + + #[inline] + pub(super) unsafe fn on_unpark(_td: &super::ThreadData) { + #[cfg(feature = "deadlock_detection")] + deadlock_impl::on_unpark(_td); + } +} + +#[cfg(feature = "deadlock_detection")] +mod deadlock_impl { + use super::{get_hashtable, get_thread_data, lock_bucket, ThreadData, NUM_THREADS}; + use std::cell::{Cell, UnsafeCell}; + use std::sync::mpsc; + use std::sync::atomic::Ordering; + use std::collections::HashSet; + use thread_id; + use backtrace::Backtrace; + use petgraph; + use petgraph::graphmap::DiGraphMap; + + /// Representation of a deadlocked thread + pub struct DeadlockedThread { + thread_id: usize, + backtrace: Backtrace, + } + + impl DeadlockedThread { + /// The system thread id + pub fn thread_id(&self) -> usize { + self.thread_id + } + + /// The thread backtrace + pub fn backtrace(&self) -> &Backtrace { + &self.backtrace + } + } + + pub struct DeadlockData { + // Currently owned resources (keys) + resources: UnsafeCell>, + + // Set when there's a pending callstack request + deadlocked: Cell, + + // Sender used to report the backtrace + backtrace_sender: UnsafeCell>>, + + // System thread id + thread_id: usize, + } + + impl DeadlockData { + pub fn new() -> Self { + DeadlockData { + resources: UnsafeCell::new(Vec::new()), + deadlocked: Cell::new(false), + backtrace_sender: UnsafeCell::new(None), + thread_id: thread_id::get(), + } + } + } + + pub(super) unsafe fn on_unpark(td: &ThreadData) { + if td.deadlock_data.deadlocked.get() { + let sender = (*td.deadlock_data.backtrace_sender.get()).take().unwrap(); + sender + .send(DeadlockedThread { + thread_id: td.deadlock_data.thread_id, + backtrace: Backtrace::new(), + }) + .unwrap(); + // make sure to close this sender + drop(sender); + + // park until the end of the time + td.parker.prepare_park(); + td.parker.park(); + unreachable!("unparked deadlocked thread!"); + } + } + + pub unsafe fn acquire_resource(key: usize) { + let mut thread_data = None; + let thread_data = get_thread_data(&mut thread_data); + (*thread_data.deadlock_data.resources.get()).push(key); + } + + pub unsafe fn release_resource(key: usize) { + let mut thread_data = None; + let thread_data = get_thread_data(&mut thread_data); + let resources = &mut (*thread_data.deadlock_data.resources.get()); + match resources.iter().rposition(|x| *x == key) { + Some(p) => resources.swap_remove(p), + None => panic!("key {} not found in thread resources", key), + }; + } + + pub fn check_deadlock() -> Vec> { + unsafe { + // fast pass + if check_wait_graph_fast() { + // double check + check_wait_graph_slow() + } else { + Vec::new() + } + } + } + + // Simple algorithm that builds a wait graph f the threads and the resources, + // then checks for the presence of cycles (deadlocks). + // This variant isn't precise as it doesn't lock the entire table before checking + unsafe fn check_wait_graph_fast() -> bool { + let table = get_hashtable(); + let thread_count = NUM_THREADS.load(Ordering::Relaxed); + let mut graph = DiGraphMap::::with_capacity(thread_count * 2, thread_count * 2); + + for b in &(*table).entries[..] { + b.mutex.lock(); + let mut current = b.queue_head.get(); + while !current.is_null() { + if !(*current).parked_with_timeout.get() + && !(*current).deadlock_data.deadlocked.get() + { + // .resources are waiting for their owner + for &resource in &(*(*current).deadlock_data.resources.get()) { + graph.add_edge(resource, current as usize, ()); + } + // owner waits for resource .key + graph.add_edge(current as usize, (*current).key.load(Ordering::Relaxed), ()); + } + current = (*current).next_in_queue.get(); + } + b.mutex.unlock(); + } + + petgraph::algo::is_cyclic_directed(&graph) + } + + #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] + enum WaitGraphNode { + Thread(*const ThreadData), + Resource(usize), + } + + use self::WaitGraphNode::*; + + // Contrary to the _fast variant this locks the entrie table before looking for cycles. + // Returns all detected thread wait cycles. + // Note that once a cycle is reported it's never reported again. + unsafe fn check_wait_graph_slow() -> Vec> { + let mut table = get_hashtable(); + loop { + // Lock all buckets in the old table + for b in &(*table).entries[..] { + b.mutex.lock(); + } + + // Now check if our table is still the latest one. Another thread could + // have grown the hash table between us getting and locking the hash table. + let new_table = get_hashtable(); + if new_table == table { + break; + } + + // Unlock buckets and try again + for b in &(*table).entries[..] { + b.mutex.unlock(); + } + + table = new_table; + } + + let thread_count = NUM_THREADS.load(Ordering::Relaxed); + let mut graph = + DiGraphMap::::with_capacity(thread_count * 2, thread_count * 2); + + for b in &(*table).entries[..] { + let mut current = b.queue_head.get(); + while !current.is_null() { + if !(*current).parked_with_timeout.get() + && !(*current).deadlock_data.deadlocked.get() + { + // .resources are waiting for their owner + for &resource in &(*(*current).deadlock_data.resources.get()) { + graph.add_edge(Resource(resource), Thread(current), ()); + } + // owner waits for resource .key + graph.add_edge( + Thread(current), + Resource((*current).key.load(Ordering::Relaxed)), + (), + ); + } + current = (*current).next_in_queue.get(); + } + } + + for b in &(*table).entries[..] { + b.mutex.unlock(); + } + + // find cycles + let cycles = graph_cycles(&graph); + + let mut results = Vec::with_capacity(cycles.len()); + + for cycle in cycles { + let (sender, receiver) = mpsc::channel(); + for td in cycle { + let bucket = lock_bucket((*td).key.load(Ordering::Relaxed)); + (*td).deadlock_data.deadlocked.set(true); + *(*td).deadlock_data.backtrace_sender.get() = Some(sender.clone()); + let handle = (*td).parker.unpark_lock(); + bucket.mutex.unlock(); + // unpark the deadlocked thread! + // on unpark it'll notice the deadlocked flag and report back + handle.unpark(); + } + // make sure to drop our sender before collecting results + drop(sender); + results.push(receiver.iter().collect()); + } + + results + } + + // normalize a cycle to start with the "smallest" node + fn normalize_cycle(input: &[T]) -> Vec { + let min_pos = input + .iter() + .enumerate() + .min_by_key(|&(_, &t)| t) + .map(|(p, _)| p) + .unwrap_or(0); + input + .iter() + .cycle() + .skip(min_pos) + .take(input.len()) + .cloned() + .collect() + } + + // returns all thread cycles in the wait graph + fn graph_cycles(g: &DiGraphMap) -> Vec> { + use petgraph::visit::NodeIndexable; + use petgraph::visit::depth_first_search; + use petgraph::visit::DfsEvent; + + let mut cycles = HashSet::new(); + let mut path = Vec::with_capacity(g.node_bound()); + // start from threads to get the correct threads cycle + let threads = g.nodes() + .filter(|n| if let &Thread(_) = n { true } else { false }); + + depth_first_search(g, threads, |e| match e { + DfsEvent::Discover(Thread(n), _) => path.push(n), + DfsEvent::Finish(Thread(_), _) => { + path.pop(); + } + DfsEvent::BackEdge(_, Thread(n)) => { + let from = path.iter().rposition(|&i| i == n).unwrap(); + cycles.insert(normalize_cycle(&path[from..])); + } + _ => (), + }); + + cycles.iter().cloned().collect() + } +} diff --git a/src/vendor/parking_lot_core/src/spinwait.rs b/src/vendor/parking_lot_core/src/spinwait.rs new file mode 100644 index 0000000000..08df63603e --- /dev/null +++ b/src/vendor/parking_lot_core/src/spinwait.rs @@ -0,0 +1,149 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(windows)] +use kernel32; +#[cfg(unix)] +use libc; +#[cfg(not(any(windows, unix)))] +use std::thread; +#[cfg(not(feature = "nightly"))] +use std::sync::atomic::{fence, Ordering}; + +// Yields the rest of the current timeslice to the OS +#[cfg(windows)] +#[inline] +fn thread_yield() { + unsafe { + // We don't use SwitchToThread here because it doesn't consider all + // threads in the system and the thread we are waiting for may not get + // selected. + kernel32::Sleep(0); + } +} +#[cfg(unix)] +#[inline] +fn thread_yield() { + unsafe { + libc::sched_yield(); + } +} +#[cfg(not(any(windows, unix)))] +#[inline] +fn thread_yield() { + thread::yield_now(); +} + +// Wastes some CPU time for the given number of iterations, preferably also +// using a hint to indicate to the CPU that we are spinning. +#[cfg(all(feature = "nightly", any(target_arch = "x86", target_arch = "x86_64")))] +#[inline] +fn cpu_relax(iterations: u32) { + for _ in 0..iterations { + unsafe { + asm!("pause" ::: "memory" : "volatile"); + } + } +} +#[cfg(all(feature = "nightly", target_arch = "aarch64"))] +#[inline] +fn cpu_relax(iterations: u32) { + for _ in 0..iterations { + unsafe { + asm!("yield" ::: "memory" : "volatile"); + } + } +} +#[cfg(all(feature = "nightly", + not(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64"))))] +#[inline] +fn cpu_relax(iterations: u32) { + for _ in 0..iterations { + unsafe { + asm!("" ::: "memory" : "volatile"); + } + } +} +#[cfg(not(feature = "nightly"))] +#[inline] +fn cpu_relax(iterations: u32) { + // This is a bit tricky: we rely on the fact that LLVM doesn't optimize + // atomic operations and effectively treats them as volatile. + for _ in 0..iterations { + fence(Ordering::SeqCst); + } +} + +/// A counter used to perform exponential backoff in spin loops. +pub struct SpinWait { + counter: u32, +} + +impl SpinWait { + /// Creates a new `SpinWait`. + #[cfg(feature = "nightly")] + #[inline] + pub const fn new() -> SpinWait { + SpinWait { counter: 0 } + } + + /// Creates a new `SpinWait`. + #[cfg(not(feature = "nightly"))] + #[inline] + pub fn new() -> SpinWait { + SpinWait { counter: 0 } + } + + /// Resets a `SpinWait` to its initial state. + #[inline] + pub fn reset(&mut self) { + self.counter = 0; + } + + /// Spins until the sleep threshold has been reached. + /// + /// This function returns whether the sleep threshold has been reached, at + /// which point further spinning has diminishing returns and the thread + /// should be parked instead. + /// + /// The spin strategy will initially use a CPU-bound loop but will fall back + /// to yielding the CPU to the OS after a few iterations. + #[inline] + pub fn spin(&mut self) -> bool { + if self.counter >= 20 { + return false; + } + self.counter += 1; + if self.counter <= 10 { + cpu_relax(4 << self.counter); + } else { + thread_yield(); + } + true + } + + /// Spins without yielding the thread to the OS. + /// + /// Instead, the backoff is simply capped at a maximum value. This can be + /// used to improve throughput in `compare_exchange` loops that have high + /// contention. + #[inline] + pub fn spin_no_yield(&mut self) { + self.counter += 1; + if self.counter > 10 { + self.counter = 10; + } + cpu_relax(4 << self.counter); + } +} + +impl Default for SpinWait { + #[inline] + fn default() -> SpinWait { + SpinWait::new() + } +} diff --git a/src/vendor/parking_lot_core/src/stable.rs b/src/vendor/parking_lot_core/src/stable.rs new file mode 100644 index 0000000000..8539850d51 --- /dev/null +++ b/src/vendor/parking_lot_core/src/stable.rs @@ -0,0 +1,87 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#![allow(dead_code)] + +use std::sync::atomic; + +// Re-export this for convenience +pub use std::sync::atomic::{fence, Ordering}; + +// Wrapper around AtomicUsize for non-nightly which has usable compare_exchange +// and compare_exchange_weak methods. +pub struct AtomicUsize(atomic::AtomicUsize); +pub use self::AtomicUsize as AtomicU8; + +// Constants for static initialization +pub const ATOMIC_USIZE_INIT: AtomicUsize = AtomicUsize(atomic::ATOMIC_USIZE_INIT); +pub use self::ATOMIC_USIZE_INIT as ATOMIC_U8_INIT; + +impl AtomicUsize { + #[inline] + pub fn new(val: usize) -> AtomicUsize { + AtomicUsize(atomic::AtomicUsize::new(val)) + } + #[inline] + pub fn load(&self, order: Ordering) -> usize { + self.0.load(order) + } + #[inline] + pub fn store(&self, val: usize, order: Ordering) { + self.0.store(val, order); + } + #[inline] + pub fn swap(&self, val: usize, order: Ordering) -> usize { + self.0.swap(val, order) + } + #[inline] + pub fn fetch_add(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_add(val, order) + } + #[inline] + pub fn fetch_sub(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_sub(val, order) + } + #[inline] + pub fn fetch_and(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_and(val, order) + } + #[inline] + pub fn fetch_or(&self, val: usize, order: Ordering) -> usize { + self.0.fetch_or(val, order) + } + #[inline] + pub fn compare_exchange( + &self, + old: usize, + new: usize, + order: Ordering, + _: Ordering, + ) -> Result { + let res = self.0.compare_and_swap(old, new, order); + if res == old { + Ok(res) + } else { + Err(res) + } + } + #[inline] + pub fn compare_exchange_weak( + &self, + old: usize, + new: usize, + order: Ordering, + _: Ordering, + ) -> Result { + let res = self.0.compare_and_swap(old, new, order); + if res == old { + Ok(res) + } else { + Err(res) + } + } +} diff --git a/src/vendor/parking_lot_core/src/thread_parker/generic.rs b/src/vendor/parking_lot_core/src/thread_parker/generic.rs new file mode 100644 index 0000000000..f26d4561dd --- /dev/null +++ b/src/vendor/parking_lot_core/src/thread_parker/generic.rs @@ -0,0 +1,98 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::sync::{Condvar, Mutex, MutexGuard}; +use std::cell::Cell; +use std::time::Instant; + +// Helper type for putting a thread to sleep until some other thread wakes it up +pub struct ThreadParker { + should_park: Cell, + mutex: Mutex<()>, + condvar: Condvar, +} + +impl ThreadParker { + pub fn new() -> ThreadParker { + ThreadParker { + should_park: Cell::new(false), + mutex: Mutex::new(()), + condvar: Condvar::new(), + } + } + + // Prepares the parker. This should be called before adding it to the queue. + pub unsafe fn prepare_park(&self) { + self.should_park.set(true); + } + + // Checks if the park timed out. This should be called while holding the + // queue lock after park_until has returned false. + pub unsafe fn timed_out(&self) -> bool { + // We need to grab the mutex here because another thread may be + // concurrently executing UnparkHandle::unpark, which is done without + // holding the queue lock. + let _lock = self.mutex.lock().unwrap(); + self.should_park.get() + } + + // Parks the thread until it is unparked. This should be called after it has + // been added to the queue, after unlocking the queue. + pub unsafe fn park(&self) { + let mut lock = self.mutex.lock().unwrap(); + while self.should_park.get() { + lock = self.condvar.wait(lock).unwrap(); + } + } + + // Parks the thread until it is unparked or the timeout is reached. This + // should be called after it has been added to the queue, after unlocking + // the queue. Returns true if we were unparked and false if we timed out. + pub unsafe fn park_until(&self, timeout: Instant) -> bool { + let mut lock = self.mutex.lock().unwrap(); + while self.should_park.get() { + let now = Instant::now(); + if timeout <= now { + return false; + } + let (new_lock, _) = self.condvar.wait_timeout(lock, timeout - now).unwrap(); + lock = new_lock; + } + true + } + + // Locks the parker to prevent the target thread from exiting. This is + // necessary to ensure that thread-local ThreadData objects remain valid. + // This should be called while holding the queue lock. + pub unsafe fn unpark_lock(&self) -> UnparkHandle { + UnparkHandle { + thread_parker: self, + _guard: self.mutex.lock().unwrap(), + } + } +} + +// Handle for a thread that is about to be unparked. We need to mark the thread +// as unparked while holding the queue lock, but we delay the actual unparking +// until after the queue lock is released. +pub struct UnparkHandle<'a> { + thread_parker: *const ThreadParker, + _guard: MutexGuard<'a, ()>, +} + +impl<'a> UnparkHandle<'a> { + // Wakes up the parked thread. This should be called after the queue lock is + // released to avoid blocking the queue for too long. + pub unsafe fn unpark(self) { + (*self.thread_parker).should_park.set(false); + + // We notify while holding the lock here to avoid races with the target + // thread. In particular, the thread could exit after we unlock the + // mutex, which would make the condvar access invalid memory. + (*self.thread_parker).condvar.notify_one(); + } +} diff --git a/src/vendor/parking_lot_core/src/thread_parker/linux.rs b/src/vendor/parking_lot_core/src/thread_parker/linux.rs new file mode 100644 index 0000000000..ff159c47a2 --- /dev/null +++ b/src/vendor/parking_lot_core/src/thread_parker/linux.rs @@ -0,0 +1,116 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::sync::atomic::{AtomicI32, Ordering}; +use std::time::Instant; +use libc; + +const FUTEX_WAIT: i32 = 0; +const FUTEX_WAKE: i32 = 1; +const FUTEX_PRIVATE: i32 = 128; + +// Helper type for putting a thread to sleep until some other thread wakes it up +pub struct ThreadParker { + futex: AtomicI32, +} + +impl ThreadParker { + pub fn new() -> ThreadParker { + ThreadParker { + futex: AtomicI32::new(0), + } + } + + // Prepares the parker. This should be called before adding it to the queue. + pub unsafe fn prepare_park(&self) { + self.futex.store(1, Ordering::Relaxed); + } + + // Checks if the park timed out. This should be called while holding the + // queue lock after park_until has returned false. + pub unsafe fn timed_out(&self) -> bool { + self.futex.load(Ordering::Relaxed) != 0 + } + + // Parks the thread until it is unparked. This should be called after it has + // been added to the queue, after unlocking the queue. + pub unsafe fn park(&self) { + while self.futex.load(Ordering::Acquire) != 0 { + let r = libc::syscall(libc::SYS_futex, &self.futex, FUTEX_WAIT | FUTEX_PRIVATE, 1, 0); + debug_assert!(r == 0 || r == -1); + if r == -1 { + debug_assert!( + *libc::__errno_location() == libc::EINTR + || *libc::__errno_location() == libc::EAGAIN + ); + } + } + } + + // Parks the thread until it is unparked or the timeout is reached. This + // should be called after it has been added to the queue, after unlocking + // the queue. Returns true if we were unparked and false if we timed out. + pub unsafe fn park_until(&self, timeout: Instant) -> bool { + while self.futex.load(Ordering::Acquire) != 0 { + let now = Instant::now(); + if timeout <= now { + return false; + } + let diff = timeout - now; + if diff.as_secs() as libc::time_t as u64 != diff.as_secs() { + // Timeout overflowed, just sleep indefinitely + self.park(); + return true; + } + let ts = libc::timespec { + tv_sec: diff.as_secs() as libc::time_t, + tv_nsec: diff.subsec_nanos() as libc::c_long, + }; + let r = libc::syscall(libc::SYS_futex, &self.futex, FUTEX_WAIT | FUTEX_PRIVATE, 1, &ts); + debug_assert!(r == 0 || r == -1); + if r == -1 { + debug_assert!( + *libc::__errno_location() == libc::EINTR + || *libc::__errno_location() == libc::EAGAIN + || *libc::__errno_location() == libc::ETIMEDOUT + ); + } + } + true + } + + // Locks the parker to prevent the target thread from exiting. This is + // necessary to ensure that thread-local ThreadData objects remain valid. + // This should be called while holding the queue lock. + pub unsafe fn unpark_lock(&self) -> UnparkHandle { + // We don't need to lock anything, just clear the state + self.futex.store(0, Ordering::Release); + + UnparkHandle { futex: &self.futex } + } +} + +// Handle for a thread that is about to be unparked. We need to mark the thread +// as unparked while holding the queue lock, but we delay the actual unparking +// until after the queue lock is released. +pub struct UnparkHandle { + futex: *const AtomicI32, +} + +impl UnparkHandle { + // Wakes up the parked thread. This should be called after the queue lock is + // released to avoid blocking the queue for too long. + pub unsafe fn unpark(self) { + // The thread data may have been freed at this point, but it doesn't + // matter since the syscall will just return EFAULT in that case. + let r = libc::syscall(libc::SYS_futex, self.futex, FUTEX_WAKE | FUTEX_PRIVATE, 1); + debug_assert!(r == 0 || r == 1 || r == -1); + if r == -1 { + debug_assert_eq!(*libc::__errno_location(), libc::EFAULT); + } + } +} diff --git a/src/vendor/parking_lot_core/src/thread_parker/unix.rs b/src/vendor/parking_lot_core/src/thread_parker/unix.rs new file mode 100644 index 0000000000..fd837e11c7 --- /dev/null +++ b/src/vendor/parking_lot_core/src/thread_parker/unix.rs @@ -0,0 +1,227 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::cell::{Cell, UnsafeCell}; +use std::time::{Duration, Instant}; +use libc; +use std::mem; +#[cfg(any(target_os = "macos", target_os = "ios"))] +use std::ptr; + +// Helper type for putting a thread to sleep until some other thread wakes it up +pub struct ThreadParker { + should_park: Cell, + mutex: UnsafeCell, + condvar: UnsafeCell, + initialized: Cell, +} + +impl ThreadParker { + pub fn new() -> ThreadParker { + ThreadParker { + should_park: Cell::new(false), + mutex: UnsafeCell::new(libc::PTHREAD_MUTEX_INITIALIZER), + condvar: UnsafeCell::new(libc::PTHREAD_COND_INITIALIZER), + initialized: Cell::new(false), + } + } + + // Initializes the condvar to use CLOCK_MONOTONIC instead of CLOCK_REALTIME. + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "android"))] + unsafe fn init(&self) {} + #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] + unsafe fn init(&self) { + let mut attr: libc::pthread_condattr_t = mem::uninitialized(); + let r = libc::pthread_condattr_init(&mut attr); + debug_assert_eq!(r, 0); + let r = libc::pthread_condattr_setclock(&mut attr, libc::CLOCK_MONOTONIC); + debug_assert_eq!(r, 0); + let r = libc::pthread_cond_init(self.condvar.get(), &attr); + debug_assert_eq!(r, 0); + let r = libc::pthread_condattr_destroy(&mut attr); + debug_assert_eq!(r, 0); + } + + // Prepares the parker. This should be called before adding it to the queue. + pub unsafe fn prepare_park(&self) { + self.should_park.set(true); + if !self.initialized.get() { + self.init(); + self.initialized.set(true); + } + } + + // Checks if the park timed out. This should be called while holding the + // queue lock after park_until has returned false. + pub unsafe fn timed_out(&self) -> bool { + // We need to grab the mutex here because another thread may be + // concurrently executing UnparkHandle::unpark, which is done without + // holding the queue lock. + let r = libc::pthread_mutex_lock(self.mutex.get()); + debug_assert_eq!(r, 0); + let should_park = self.should_park.get(); + let r = libc::pthread_mutex_unlock(self.mutex.get()); + debug_assert_eq!(r, 0); + should_park + } + + // Parks the thread until it is unparked. This should be called after it has + // been added to the queue, after unlocking the queue. + pub unsafe fn park(&self) { + let r = libc::pthread_mutex_lock(self.mutex.get()); + debug_assert_eq!(r, 0); + while self.should_park.get() { + let r = libc::pthread_cond_wait(self.condvar.get(), self.mutex.get()); + debug_assert_eq!(r, 0); + } + let r = libc::pthread_mutex_unlock(self.mutex.get()); + debug_assert_eq!(r, 0); + } + + // Parks the thread until it is unparked or the timeout is reached. This + // should be called after it has been added to the queue, after unlocking + // the queue. Returns true if we were unparked and false if we timed out. + pub unsafe fn park_until(&self, timeout: Instant) -> bool { + let r = libc::pthread_mutex_lock(self.mutex.get()); + debug_assert_eq!(r, 0); + while self.should_park.get() { + let now = Instant::now(); + if timeout <= now { + let r = libc::pthread_mutex_unlock(self.mutex.get()); + debug_assert_eq!(r, 0); + return false; + } + + if let Some(ts) = timeout_to_timespec(timeout - now) { + let r = libc::pthread_cond_timedwait(self.condvar.get(), self.mutex.get(), &ts); + if ts.tv_sec < 0 { + // On some systems, negative timeouts will return EINVAL. In + // that case we won't sleep and will just busy loop instead, + // which is the best we can do. + debug_assert!(r == 0 || r == libc::ETIMEDOUT || r == libc::EINVAL); + } else { + debug_assert!(r == 0 || r == libc::ETIMEDOUT); + } + } else { + // Timeout calculation overflowed, just sleep indefinitely + let r = libc::pthread_cond_wait(self.condvar.get(), self.mutex.get()); + debug_assert_eq!(r, 0); + } + } + let r = libc::pthread_mutex_unlock(self.mutex.get()); + debug_assert_eq!(r, 0); + true + } + + // Locks the parker to prevent the target thread from exiting. This is + // necessary to ensure that thread-local ThreadData objects remain valid. + // This should be called while holding the queue lock. + pub unsafe fn unpark_lock(&self) -> UnparkHandle { + let r = libc::pthread_mutex_lock(self.mutex.get()); + debug_assert_eq!(r, 0); + + UnparkHandle { + thread_parker: self, + } + } +} + +impl Drop for ThreadParker { + fn drop(&mut self) { + // On DragonFly pthread_mutex_destroy() returns EINVAL if called on a + // mutex that was just initialized with libc::PTHREAD_MUTEX_INITIALIZER. + // Once it is used (locked/unlocked) or pthread_mutex_init() is called, + // this behaviour no longer occurs. The same applies to condvars. + unsafe { + let r = libc::pthread_mutex_destroy(self.mutex.get()); + if cfg!(target_os = "dragonfly") { + debug_assert!(r == 0 || r == libc::EINVAL); + } else { + debug_assert_eq!(r, 0); + } + let r = libc::pthread_cond_destroy(self.condvar.get()); + if cfg!(target_os = "dragonfly") { + debug_assert!(r == 0 || r == libc::EINVAL); + } else { + debug_assert_eq!(r, 0); + } + } + } +} + +// Handle for a thread that is about to be unparked. We need to mark the thread +// as unparked while holding the queue lock, but we delay the actual unparking +// until after the queue lock is released. +pub struct UnparkHandle { + thread_parker: *const ThreadParker, +} + +impl UnparkHandle { + // Wakes up the parked thread. This should be called after the queue lock is + // released to avoid blocking the queue for too long. + pub unsafe fn unpark(self) { + (*self.thread_parker).should_park.set(false); + + // We notify while holding the lock here to avoid races with the target + // thread. In particular, the thread could exit after we unlock the + // mutex, which would make the condvar access invalid memory. + let r = libc::pthread_cond_signal((*self.thread_parker).condvar.get()); + debug_assert_eq!(r, 0); + let r = libc::pthread_mutex_unlock((*self.thread_parker).mutex.get()); + debug_assert_eq!(r, 0); + } +} + +// Returns the current time on the clock used by pthread_cond_t as a timespec. +#[cfg(any(target_os = "macos", target_os = "ios"))] +unsafe fn timespec_now() -> libc::timespec { + let mut now: libc::timeval = mem::uninitialized(); + let r = libc::gettimeofday(&mut now, ptr::null_mut()); + debug_assert_eq!(r, 0); + libc::timespec { + tv_sec: now.tv_sec, + tv_nsec: now.tv_usec as libc::c_long * 1000, + } +} +#[cfg(not(any(target_os = "macos", target_os = "ios")))] +unsafe fn timespec_now() -> libc::timespec { + let mut now: libc::timespec = mem::uninitialized(); + let clock = if cfg!(target_os = "android") { + // Android doesn't support pthread_condattr_setclock, so we need to + // specify the timeout in CLOCK_REALTIME. + libc::CLOCK_REALTIME + } else { + libc::CLOCK_MONOTONIC + }; + let r = libc::clock_gettime(clock, &mut now); + debug_assert_eq!(r, 0); + now +} + +// Converts a relative timeout into an absolute timeout in the clock used by +// pthread_cond_t. +unsafe fn timeout_to_timespec(timeout: Duration) -> Option { + // Handle overflows early on + if timeout.as_secs() > libc::time_t::max_value() as u64 { + return None; + } + + let now = timespec_now(); + let mut nsec = now.tv_nsec + timeout.subsec_nanos() as libc::c_long; + let mut sec = now.tv_sec.checked_add(timeout.as_secs() as libc::time_t); + if nsec >= 1_000_000_000 { + nsec -= 1_000_000_000; + sec = sec.and_then(|sec| sec.checked_add(1)); + } + + sec.map(|sec| { + libc::timespec { + tv_nsec: nsec, + tv_sec: sec, + } + }) +} diff --git a/src/vendor/parking_lot_core/src/thread_parker/windows/keyed_event.rs b/src/vendor/parking_lot_core/src/thread_parker/windows/keyed_event.rs new file mode 100644 index 0000000000..48d10bc33b --- /dev/null +++ b/src/vendor/parking_lot_core/src/thread_parker/windows/keyed_event.rs @@ -0,0 +1,199 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{AtomicUsize, Ordering}; +#[cfg(not(feature = "nightly"))] +use stable::{AtomicUsize, Ordering}; +use std::time::Instant; +use std::ptr; +use std::mem; +use winapi; +use kernel32; + +const STATE_UNPARKED: usize = 0; +const STATE_PARKED: usize = 1; +const STATE_TIMED_OUT: usize = 2; + +#[allow(non_snake_case)] +pub struct KeyedEvent { + handle: winapi::HANDLE, + NtReleaseKeyedEvent: extern "system" fn( + EventHandle: winapi::HANDLE, + Key: winapi::PVOID, + Alertable: winapi::BOOLEAN, + Timeout: winapi::PLARGE_INTEGER, + ) -> winapi::NTSTATUS, + NtWaitForKeyedEvent: extern "system" fn( + EventHandle: winapi::HANDLE, + Key: winapi::PVOID, + Alertable: winapi::BOOLEAN, + Timeout: winapi::PLARGE_INTEGER, + ) -> winapi::NTSTATUS, +} + +impl KeyedEvent { + unsafe fn wait_for( + &self, + key: winapi::PVOID, + timeout: winapi::PLARGE_INTEGER, + ) -> winapi::NTSTATUS { + (self.NtWaitForKeyedEvent)(self.handle, key, 0, timeout) + } + + unsafe fn release(&self, key: winapi::PVOID) -> winapi::NTSTATUS { + (self.NtReleaseKeyedEvent)(self.handle, key, 0, ptr::null_mut()) + } + + #[allow(non_snake_case)] + pub unsafe fn create() -> Option { + let ntdll = kernel32::GetModuleHandleA(b"ntdll.dll\0".as_ptr() as winapi::LPCSTR); + if ntdll.is_null() { + return None; + } + + let NtCreateKeyedEvent = + kernel32::GetProcAddress(ntdll, b"NtCreateKeyedEvent\0".as_ptr() as winapi::LPCSTR); + if NtCreateKeyedEvent.is_null() { + return None; + } + let NtReleaseKeyedEvent = + kernel32::GetProcAddress(ntdll, b"NtReleaseKeyedEvent\0".as_ptr() as winapi::LPCSTR); + if NtReleaseKeyedEvent.is_null() { + return None; + } + let NtWaitForKeyedEvent = + kernel32::GetProcAddress(ntdll, b"NtWaitForKeyedEvent\0".as_ptr() as winapi::LPCSTR); + if NtWaitForKeyedEvent.is_null() { + return None; + } + + let NtCreateKeyedEvent: extern "system" fn( + KeyedEventHandle: winapi::PHANDLE, + DesiredAccess: winapi::ACCESS_MASK, + ObjectAttributes: winapi::PVOID, + Flags: winapi::ULONG, + ) -> winapi::NTSTATUS = mem::transmute(NtCreateKeyedEvent); + let mut handle = mem::uninitialized(); + let status = NtCreateKeyedEvent( + &mut handle, + winapi::GENERIC_READ | winapi::GENERIC_WRITE, + ptr::null_mut(), + 0, + ); + if status != winapi::STATUS_SUCCESS { + return None; + } + + Some(KeyedEvent { + handle: handle, + NtReleaseKeyedEvent: mem::transmute(NtReleaseKeyedEvent), + NtWaitForKeyedEvent: mem::transmute(NtWaitForKeyedEvent), + }) + } + + pub unsafe fn prepare_park(&'static self, key: &AtomicUsize) { + key.store(STATE_PARKED, Ordering::Relaxed); + } + + pub unsafe fn timed_out(&'static self, key: &AtomicUsize) -> bool { + key.load(Ordering::Relaxed) == STATE_TIMED_OUT + } + + pub unsafe fn park(&'static self, key: &AtomicUsize) { + let status = self.wait_for(key as *const _ as winapi::PVOID, ptr::null_mut()); + debug_assert_eq!(status, winapi::STATUS_SUCCESS); + } + + pub unsafe fn park_until(&'static self, key: &AtomicUsize, timeout: Instant) -> bool { + let now = Instant::now(); + if timeout <= now { + // If another thread unparked us, we need to call + // NtWaitForKeyedEvent otherwise that thread will stay stuck at + // NtReleaseKeyedEvent. + if key.swap(STATE_TIMED_OUT, Ordering::Relaxed) == STATE_UNPARKED { + self.park(key); + return true; + } + return false; + } + + // NT uses a timeout in units of 100ns. We use a negative value to + // indicate a relative timeout based on a monotonic clock. + let diff = timeout - now; + let nt_timeout = (diff.as_secs() as winapi::LARGE_INTEGER) + .checked_mul(-10000000) + .and_then(|x| { + x.checked_sub((diff.subsec_nanos() as winapi::LARGE_INTEGER + 99) / 100) + }); + let mut nt_timeout = match nt_timeout { + Some(x) => x, + None => { + // Timeout overflowed, just sleep indefinitely + self.park(key); + return true; + } + }; + + let status = self.wait_for(key as *const _ as winapi::PVOID, &mut nt_timeout); + if status == winapi::STATUS_SUCCESS { + return true; + } + debug_assert_eq!(status, winapi::STATUS_TIMEOUT); + + // If another thread unparked us, we need to call NtWaitForKeyedEvent + // otherwise that thread will stay stuck at NtReleaseKeyedEvent. + if key.swap(STATE_TIMED_OUT, Ordering::Relaxed) == STATE_UNPARKED { + self.park(key); + return true; + } + false + } + + pub unsafe fn unpark_lock(&'static self, key: &AtomicUsize) -> UnparkHandle { + // If the state was STATE_PARKED then we need to wake up the thread + if key.swap(STATE_UNPARKED, Ordering::Relaxed) == STATE_PARKED { + UnparkHandle { + key: key, + keyed_event: self, + } + } else { + UnparkHandle { + key: ptr::null(), + keyed_event: self, + } + } + } +} + +impl Drop for KeyedEvent { + fn drop(&mut self) { + unsafe { + let ok = kernel32::CloseHandle(self.handle); + debug_assert_eq!(ok, winapi::TRUE); + } + } +} + +// Handle for a thread that is about to be unparked. We need to mark the thread +// as unparked while holding the queue lock, but we delay the actual unparking +// until after the queue lock is released. +pub struct UnparkHandle { + key: *const AtomicUsize, + keyed_event: &'static KeyedEvent, +} + +impl UnparkHandle { + // Wakes up the parked thread. This should be called after the queue lock is + // released to avoid blocking the queue for too long. + pub unsafe fn unpark(self) { + if !self.key.is_null() { + let status = self.keyed_event.release(self.key as winapi::PVOID); + debug_assert_eq!(status, winapi::STATUS_SUCCESS); + } + } +} diff --git a/src/vendor/parking_lot_core/src/thread_parker/windows/mod.rs b/src/vendor/parking_lot_core/src/thread_parker/windows/mod.rs new file mode 100644 index 0000000000..63dd59392c --- /dev/null +++ b/src/vendor/parking_lot_core/src/thread_parker/windows/mod.rs @@ -0,0 +1,139 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +#[cfg(not(feature = "nightly"))] +use stable::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::time::Instant; + +mod keyed_event; +mod waitaddress; + +enum Backend { + KeyedEvent(keyed_event::KeyedEvent), + WaitAddress(waitaddress::WaitAddress), +} + +impl Backend { + unsafe fn get() -> &'static Backend { + static BACKEND: AtomicUsize = ATOMIC_USIZE_INIT; + + // Fast path: use the existing object + let backend = BACKEND.load(Ordering::Acquire); + if backend != 0 { + return &*(backend as *const Backend); + }; + + // Try to create a new Backend + let backend; + if let Some(waitaddress) = waitaddress::WaitAddress::create() { + backend = Backend::WaitAddress(waitaddress); + } else if let Some(keyed_event) = keyed_event::KeyedEvent::create() { + backend = Backend::KeyedEvent(keyed_event); + } else { + panic!( + "parking_lot requires either NT Keyed Events (WinXP+) or \ + WaitOnAddress/WakeByAddress (Win8+)" + ); + } + + // Try to create a new object + let backend = Box::into_raw(Box::new(backend)); + match BACKEND.compare_exchange(0, backend as usize, Ordering::Release, Ordering::Relaxed) { + Ok(_) => &*(backend as *const Backend), + Err(x) => { + // We lost the race, free our object and return the global one + Box::from_raw(backend); + &*(x as *const Backend) + } + } + } +} + +// Helper type for putting a thread to sleep until some other thread wakes it up +pub struct ThreadParker { + key: AtomicUsize, + backend: &'static Backend, +} + +impl ThreadParker { + pub fn new() -> ThreadParker { + // Initialize the backend here to ensure we don't get any panics + // later on, which could leave synchronization primitives in a broken + // state. + ThreadParker { + key: AtomicUsize::new(0), + backend: unsafe { Backend::get() }, + } + } + + // Prepares the parker. This should be called before adding it to the queue. + pub unsafe fn prepare_park(&self) { + match *self.backend { + Backend::KeyedEvent(ref x) => x.prepare_park(&self.key), + Backend::WaitAddress(ref x) => x.prepare_park(&self.key), + } + } + + // Checks if the park timed out. This should be called while holding the + // queue lock after park_until has returned false. + pub unsafe fn timed_out(&self) -> bool { + match *self.backend { + Backend::KeyedEvent(ref x) => x.timed_out(&self.key), + Backend::WaitAddress(ref x) => x.timed_out(&self.key), + } + } + + // Parks the thread until it is unparked. This should be called after it has + // been added to the queue, after unlocking the queue. + pub unsafe fn park(&self) { + match *self.backend { + Backend::KeyedEvent(ref x) => x.park(&self.key), + Backend::WaitAddress(ref x) => x.park(&self.key), + } + } + + // Parks the thread until it is unparked or the timeout is reached. This + // should be called after it has been added to the queue, after unlocking + // the queue. Returns true if we were unparked and false if we timed out. + pub unsafe fn park_until(&self, timeout: Instant) -> bool { + match *self.backend { + Backend::KeyedEvent(ref x) => x.park_until(&self.key, timeout), + Backend::WaitAddress(ref x) => x.park_until(&self.key, timeout), + } + } + + // Locks the parker to prevent the target thread from exiting. This is + // necessary to ensure that thread-local ThreadData objects remain valid. + // This should be called while holding the queue lock. + pub unsafe fn unpark_lock(&self) -> UnparkHandle { + match *self.backend { + Backend::KeyedEvent(ref x) => UnparkHandle::KeyedEvent(x.unpark_lock(&self.key)), + Backend::WaitAddress(ref x) => UnparkHandle::WaitAddress(x.unpark_lock(&self.key)), + } + } +} + +// Handle for a thread that is about to be unparked. We need to mark the thread +// as unparked while holding the queue lock, but we delay the actual unparking +// until after the queue lock is released. +pub enum UnparkHandle { + KeyedEvent(keyed_event::UnparkHandle), + WaitAddress(waitaddress::UnparkHandle), +} + +impl UnparkHandle { + // Wakes up the parked thread. This should be called after the queue lock is + // released to avoid blocking the queue for too long. + pub unsafe fn unpark(self) { + match self { + UnparkHandle::KeyedEvent(x) => x.unpark(), + UnparkHandle::WaitAddress(x) => x.unpark(), + } + } +} diff --git a/src/vendor/parking_lot_core/src/thread_parker/windows/waitaddress.rs b/src/vendor/parking_lot_core/src/thread_parker/windows/waitaddress.rs new file mode 100644 index 0000000000..cef91f89a1 --- /dev/null +++ b/src/vendor/parking_lot_core/src/thread_parker/windows/waitaddress.rs @@ -0,0 +1,138 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{AtomicUsize, Ordering}; +#[cfg(not(feature = "nightly"))] +use stable::{AtomicUsize, Ordering}; +use std::time::Instant; +use std::mem; +use winapi; +use kernel32; + +#[allow(non_snake_case)] +pub struct WaitAddress { + WaitOnAddress: extern "system" fn( + Address: winapi::PVOID, + CompareAddress: winapi::PVOID, + AddressSize: winapi::SIZE_T, + dwMilliseconds: winapi::DWORD, + ) -> winapi::BOOL, + WakeByAddressSingle: extern "system" fn(Address: winapi::PVOID), +} + +impl WaitAddress { + #[allow(non_snake_case)] + pub unsafe fn create() -> Option { + // MSDN claims that that WaitOnAddress and WakeByAddressSingle are + // located in kernel32.dll, but they are lying... + let synch_dll = kernel32::GetModuleHandleA(b"api-ms-win-core-synch-l1-2-0.dll\0".as_ptr() + as winapi::LPCSTR); + if synch_dll.is_null() { + return None; + } + + let WaitOnAddress = + kernel32::GetProcAddress(synch_dll, b"WaitOnAddress\0".as_ptr() as winapi::LPCSTR); + if WaitOnAddress.is_null() { + return None; + } + let WakeByAddressSingle = kernel32::GetProcAddress( + synch_dll, + b"WakeByAddressSingle\0".as_ptr() as winapi::LPCSTR, + ); + if WakeByAddressSingle.is_null() { + return None; + } + Some(WaitAddress { + WaitOnAddress: mem::transmute(WaitOnAddress), + WakeByAddressSingle: mem::transmute(WakeByAddressSingle), + }) + } + + pub unsafe fn prepare_park(&'static self, key: &AtomicUsize) { + key.store(1, Ordering::Relaxed); + } + + pub unsafe fn timed_out(&'static self, key: &AtomicUsize) -> bool { + key.load(Ordering::Relaxed) != 0 + } + + pub unsafe fn park(&'static self, key: &AtomicUsize) { + while key.load(Ordering::Acquire) != 0 { + let cmp = 1usize; + let r = (self.WaitOnAddress)( + key as *const _ as winapi::PVOID, + &cmp as *const _ as winapi::PVOID, + mem::size_of::() as winapi::SIZE_T, + winapi::INFINITE, + ); + debug_assert!(r == winapi::TRUE); + } + } + + pub unsafe fn park_until(&'static self, key: &AtomicUsize, timeout: Instant) -> bool { + while key.load(Ordering::Acquire) != 0 { + let now = Instant::now(); + if timeout <= now { + return false; + } + let diff = timeout - now; + let timeout = diff.as_secs() + .checked_mul(1000) + .and_then(|x| { + x.checked_add((diff.subsec_nanos() as u64 + 999999) / 1000000) + }) + .map(|ms| { + if ms > ::max_value() as u64 { + winapi::INFINITE + } else { + ms as winapi::DWORD + } + }) + .unwrap_or(winapi::INFINITE); + let cmp = 1usize; + let r = (self.WaitOnAddress)( + key as *const _ as winapi::PVOID, + &cmp as *const _ as winapi::PVOID, + mem::size_of::() as winapi::SIZE_T, + timeout, + ); + if r == winapi::FALSE { + debug_assert_eq!(kernel32::GetLastError(), winapi::ERROR_TIMEOUT); + } + } + true + } + + pub unsafe fn unpark_lock(&'static self, key: &AtomicUsize) -> UnparkHandle { + // We don't need to lock anything, just clear the state + key.store(0, Ordering::Release); + + UnparkHandle { + key: key, + waitaddress: self, + } + } +} + + +// Handle for a thread that is about to be unparked. We need to mark the thread +// as unparked while holding the queue lock, but we delay the actual unparking +// until after the queue lock is released. +pub struct UnparkHandle { + key: *const AtomicUsize, + waitaddress: &'static WaitAddress, +} + +impl UnparkHandle { + // Wakes up the parked thread. This should be called after the queue lock is + // released to avoid blocking the queue for too long. + pub unsafe fn unpark(self) { + (self.waitaddress.WakeByAddressSingle)(self.key as winapi::PVOID); + } +} diff --git a/src/vendor/parking_lot_core/src/util.rs b/src/vendor/parking_lot_core/src/util.rs new file mode 100644 index 0000000000..c7dfd32250 --- /dev/null +++ b/src/vendor/parking_lot_core/src/util.rs @@ -0,0 +1,32 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +// Option::unchecked_unwrap +pub trait UncheckedOptionExt { + unsafe fn unchecked_unwrap(self) -> T; +} + +impl UncheckedOptionExt for Option { + #[inline] + unsafe fn unchecked_unwrap(self) -> T { + match self { + Some(x) => x, + None => unreachable(), + } + } +} + +// Equivalent to intrinsics::unreachable() in release mode +#[inline] +unsafe fn unreachable() -> ! { + if cfg!(debug_assertions) { + unreachable!(); + } else { + enum Void {} + match *(1 as *const Void) {} + } +} diff --git a/src/vendor/parking_lot_core/src/word_lock.rs b/src/vendor/parking_lot_core/src/word_lock.rs new file mode 100644 index 0000000000..9d1ed0057d --- /dev/null +++ b/src/vendor/parking_lot_core/src/word_lock.rs @@ -0,0 +1,281 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +#[cfg(feature = "nightly")] +use std::sync::atomic::{fence, AtomicUsize, Ordering}; +#[cfg(not(feature = "nightly"))] +use stable::{fence, AtomicUsize, Ordering}; +use std::ptr; +use std::mem; +use std::cell::Cell; +use std::thread::LocalKey; +#[cfg(not(feature = "nightly"))] +use std::panic; +use spinwait::SpinWait; +use thread_parker::ThreadParker; + +struct ThreadData { + parker: ThreadParker, + + // Linked list of threads in the queue. The queue is split into two parts: + // the processed part and the unprocessed part. When new nodes are added to + // the list, they only have the next pointer set, and queue_tail is null. + // + // Nodes are processed with the queue lock held, which consists of setting + // the prev pointer for each node and setting the queue_tail pointer on the + // first processed node of the list. + // + // This setup allows nodes to be added to the queue without a lock, while + // still allowing O(1) removal of nodes from the processed part of the list. + // The only cost is the O(n) processing, but this only needs to be done + // once for each node, and therefore isn't too expensive. + queue_tail: Cell<*const ThreadData>, + prev: Cell<*const ThreadData>, + next: Cell<*const ThreadData>, +} + +impl ThreadData { + fn new() -> ThreadData { + ThreadData { + parker: ThreadParker::new(), + queue_tail: Cell::new(ptr::null()), + prev: Cell::new(ptr::null()), + next: Cell::new(ptr::null()), + } + } +} + +// Returns a ThreadData structure for the current thread +unsafe fn get_thread_data(local: &mut Option) -> &ThreadData { + // Try to read from thread-local storage, but return None if the TLS has + // already been destroyed. + #[cfg(feature = "nightly")] + fn try_get_tls(key: &'static LocalKey) -> Option<*const ThreadData> { + key.try_with(|x| x as *const ThreadData).ok() + } + #[cfg(not(feature = "nightly"))] + fn try_get_tls(key: &'static LocalKey) -> Option<*const ThreadData> { + panic::catch_unwind(|| key.with(|x| x as *const ThreadData)).ok() + } + + // If ThreadData is expensive to construct, then we want to use a cached + // version in thread-local storage if possible. + if !cfg!(windows) && !cfg!(all(feature = "nightly", target_os = "linux")) { + thread_local!(static THREAD_DATA: ThreadData = ThreadData::new()); + if let Some(tls) = try_get_tls(&THREAD_DATA) { + return &*tls; + } + } + + // Otherwise just create a ThreadData on the stack + *local = Some(ThreadData::new()); + local.as_ref().unwrap() +} + +const LOCKED_BIT: usize = 1; +const QUEUE_LOCKED_BIT: usize = 2; +const QUEUE_MASK: usize = !3; + +// Word-sized lock that is used to implement the parking_lot API. Since this +// can't use parking_lot, it instead manages its own queue of waiting threads. +pub struct WordLock { + state: AtomicUsize, +} + +impl WordLock { + #[inline] + pub fn new() -> WordLock { + WordLock { + state: AtomicUsize::new(0), + } + } + + #[inline] + pub unsafe fn lock(&self) { + if self.state + .compare_exchange_weak(0, LOCKED_BIT, Ordering::Acquire, Ordering::Relaxed) + .is_ok() + { + return; + } + self.lock_slow(); + } + + #[inline] + pub unsafe fn unlock(&self) { + let state = self.state.fetch_sub(LOCKED_BIT, Ordering::Release); + if state & QUEUE_LOCKED_BIT != 0 || state & QUEUE_MASK == 0 { + return; + } + self.unlock_slow(); + } + + #[cold] + #[inline(never)] + unsafe fn lock_slow(&self) { + let mut spinwait = SpinWait::new(); + let mut state = self.state.load(Ordering::Relaxed); + loop { + // Grab the lock if it isn't locked, even if there is a queue on it + if state & LOCKED_BIT == 0 { + match self.state.compare_exchange_weak( + state, + state | LOCKED_BIT, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => return, + Err(x) => state = x, + } + continue; + } + + // If there is no queue, try spinning a few times + if state & QUEUE_MASK == 0 && spinwait.spin() { + state = self.state.load(Ordering::Relaxed); + continue; + } + + // Get our thread data and prepare it for parking + let mut thread_data = None; + let thread_data = get_thread_data(&mut thread_data); + assert!(mem::align_of_val(thread_data) > !QUEUE_MASK); + thread_data.parker.prepare_park(); + + // Add our thread to the front of the queue + let queue_head = (state & QUEUE_MASK) as *const ThreadData; + if queue_head.is_null() { + thread_data.queue_tail.set(thread_data); + thread_data.prev.set(ptr::null()); + } else { + thread_data.queue_tail.set(ptr::null()); + thread_data.prev.set(ptr::null()); + thread_data.next.set(queue_head); + } + if let Err(x) = self.state.compare_exchange_weak( + state, + (state & !QUEUE_MASK) | thread_data as *const _ as usize, + Ordering::Release, + Ordering::Relaxed, + ) { + state = x; + continue; + } + + // Sleep until we are woken up by an unlock + thread_data.parker.park(); + + // Loop back and try locking again + spinwait.reset(); + self.state.load(Ordering::Relaxed); + } + } + + #[cold] + #[inline(never)] + unsafe fn unlock_slow(&self) { + let mut state = self.state.load(Ordering::Relaxed); + loop { + // We just unlocked the WordLock. Just check if there is a thread + // to wake up. If the queue is locked then another thread is already + // taking care of waking up a thread. + if state & QUEUE_LOCKED_BIT != 0 || state & QUEUE_MASK == 0 { + return; + } + + // Try to grab the queue lock + match self.state.compare_exchange_weak( + state, + state | QUEUE_LOCKED_BIT, + Ordering::Acquire, + Ordering::Relaxed, + ) { + Ok(_) => break, + Err(x) => state = x, + } + } + + // Now we have the queue lock and the queue is non-empty + 'outer: loop { + // First, we need to fill in the prev pointers for any newly added + // threads. We do this until we reach a node that we previously + // processed, which has a non-null queue_tail pointer. + let queue_head = (state & QUEUE_MASK) as *const ThreadData; + let mut queue_tail; + let mut current = queue_head; + loop { + queue_tail = (*current).queue_tail.get(); + if !queue_tail.is_null() { + break; + } + let next = (*current).next.get(); + (*next).prev.set(current); + current = next; + } + + // Set queue_tail on the queue head to indicate that the whole list + // has prev pointers set correctly. + (*queue_head).queue_tail.set(queue_tail); + + // If the WordLock is locked, then there is no point waking up a + // thread now. Instead we let the next unlocker take care of waking + // up a thread. + if state & LOCKED_BIT != 0 { + match self.state.compare_exchange_weak( + state, + state & !QUEUE_LOCKED_BIT, + Ordering::Release, + Ordering::Relaxed, + ) { + Ok(_) => return, + Err(x) => state = x, + } + + // Need an acquire fence before reading the new queue + fence(Ordering::Acquire); + continue; + } + + // Remove the last thread from the queue and unlock the queue + let new_tail = (*queue_tail).prev.get(); + if new_tail.is_null() { + loop { + match self.state.compare_exchange_weak( + state, + state & LOCKED_BIT, + Ordering::Release, + Ordering::Relaxed, + ) { + Ok(_) => break, + Err(x) => state = x, + } + + // If the compare_exchange failed because a new thread was + // added to the queue then we need to re-scan the queue to + // find the previous element. + if state & QUEUE_MASK == 0 { + continue; + } else { + // Need an acquire fence before reading the new queue + fence(Ordering::Acquire); + continue 'outer; + } + } + } else { + (*queue_head).queue_tail.set(new_tail); + self.state.fetch_and(!QUEUE_LOCKED_BIT, Ordering::Release); + } + + // Finally, wake up the thread we removed from the queue. Note that + // we don't need to worry about any races here since the thread is + // guaranteed to be sleeping right now and we are the only one who + // can wake it up. + (*queue_tail).parker.unpark_lock().unpark(); + break; + } + } +} diff --git a/src/vendor/rand/.cargo-checksum.json b/src/vendor/rand/.cargo-checksum.json index 464b0e064d..afbc25eb14 100644 --- a/src/vendor/rand/.cargo-checksum.json +++ b/src/vendor/rand/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"c5edd03cb5679918a6d85f64c0a634ed83022ff85ea78f440f39fd281bd29c02","Cargo.toml":"3dbce5caad1d0265badcfe385d578ac29d4e9b755f1909b1c2b67dc498d39d71","Cargo.toml.orig":"6d4310d44acb3c840c25024b85bb0c35dad0eee019ef77e386074df6c5dcc7e6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"51831128477b9c9db0ec632ed6b6164f4e70e2d5f21eb5b3a391ecb9ab35e727","appveyor.yml":"6bf2f0c8f17d2dc4957dd39aba9a88ced3130200cf847a76d47b6c8fdcc2cbd8","benches/bench.rs":"2d3481c524841c532b9b9705073b223fd4b308c86ed7c9188b7fcd8e595ad459","benches/distributions/exponential.rs":"99cb59c013a0b6bb390d34c5649b341fc3b88ea7df0caf2470bdda8798f9fe3d","benches/distributions/gamma.rs":"3533f311e4b55d743c5b01a7eb6529c94fd97726ef6702a6372f914f5f33666b","benches/distributions/mod.rs":"0028f1cb96f61152ed5b49a4fe91227d809ef6d19035592c36032a538af7f95e","benches/distributions/normal.rs":"4e10c18cb583ccb96301ea953c8e0aa9ee3b6662060271d1b8d19ca23364dc6b","src/chacha.rs":"529c20ca1eff845da4cdca9ac995bcb8e698e48a61fbae91f09e3b4600ac57c3","src/distributions/exponential.rs":"103c8412c8a581b71835f1c00e40f6370e7702adf9d499243933a793d132d4e7","src/distributions/gamma.rs":"7a3f85c8daad4e56e334586ddb9fc9d83df3b0699738ed681a6c41e4ed455be9","src/distributions/mod.rs":"c3188ec234261ceba8b0231450f1bcfa486bdb7ad6a5aa9e1880aca4f4e02c74","src/distributions/normal.rs":"1562b43f80e4d5f83a8deb5af18de5a18dfeeeeda11fefc577da26672b14c949","src/distributions/range.rs":"c0ac6858d6a3979de7996feca22d190fde0bfb6f758d43030efa04a1a0fdcc17","src/distributions/ziggurat_tables.rs":"4eacf94fc352c91c455a6623de6a721e53842e1690f13a5662b6a79c7fbb73de","src/isaac.rs":"1725114b2d63c6fe4c0f4f7e0c36fc993a47f0322350d13abc631b0806bb71ed","src/lib.rs":"60ecdc3088993488df0a1914bd090fe00e4ea13272d1f3d51fd887e29e4cda3e","src/os.rs":"a27abd65bc29296e447961977c0ce5b44469d6231990783751a84dba36fe1044","src/rand_impls.rs":"cf411028341f67fd196ccde6200eea563c993f59d360a030b3d7d3ee15447a7d","src/read.rs":"bd0eb508a6b659dc578d546fc2f231484aed80c73cfe8c475e0d65c8d699a769","src/reseeding.rs":"73b2539b86b4cb8068e54716c7fd53e0d70b6c0de787a0749431b17019c9d826"},"package":"6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"d6038b33878806f8a5aea752262338d5bcb4d7cc17cc7fdd6dd1fd7aa1884cf8","Cargo.toml":"5ca98349911ac94bd50602734b72fd601fab27b37e5611b2f15fcea62f43d527","Cargo.toml.orig":"0c77013e61e3f0a368a764ccf0c2d5561aac96b34534cc427af3cb902243dc9a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"51831128477b9c9db0ec632ed6b6164f4e70e2d5f21eb5b3a391ecb9ab35e727","appveyor.yml":"6bf2f0c8f17d2dc4957dd39aba9a88ced3130200cf847a76d47b6c8fdcc2cbd8","benches/bench.rs":"2d3481c524841c532b9b9705073b223fd4b308c86ed7c9188b7fcd8e595ad459","benches/distributions/exponential.rs":"99cb59c013a0b6bb390d34c5649b341fc3b88ea7df0caf2470bdda8798f9fe3d","benches/distributions/gamma.rs":"3533f311e4b55d743c5b01a7eb6529c94fd97726ef6702a6372f914f5f33666b","benches/distributions/mod.rs":"0028f1cb96f61152ed5b49a4fe91227d809ef6d19035592c36032a538af7f95e","benches/distributions/normal.rs":"4e10c18cb583ccb96301ea953c8e0aa9ee3b6662060271d1b8d19ca23364dc6b","src/chacha.rs":"529c20ca1eff845da4cdca9ac995bcb8e698e48a61fbae91f09e3b4600ac57c3","src/distributions/exponential.rs":"103c8412c8a581b71835f1c00e40f6370e7702adf9d499243933a793d132d4e7","src/distributions/gamma.rs":"7a3f85c8daad4e56e334586ddb9fc9d83df3b0699738ed681a6c41e4ed455be9","src/distributions/mod.rs":"c3188ec234261ceba8b0231450f1bcfa486bdb7ad6a5aa9e1880aca4f4e02c74","src/distributions/normal.rs":"1562b43f80e4d5f83a8deb5af18de5a18dfeeeeda11fefc577da26672b14c949","src/distributions/range.rs":"c0ac6858d6a3979de7996feca22d190fde0bfb6f758d43030efa04a1a0fdcc17","src/distributions/ziggurat_tables.rs":"4eacf94fc352c91c455a6623de6a721e53842e1690f13a5662b6a79c7fbb73de","src/isaac.rs":"1725114b2d63c6fe4c0f4f7e0c36fc993a47f0322350d13abc631b0806bb71ed","src/lib.rs":"029201fac07fdc909f1cf1c3e2c057e29330538463b7ede2d09afc03783c2a23","src/os.rs":"4ae90d4a62b17ff0131d9cf3fc800f5ecc72fabf120a8ea071ceb279ded75e3f","src/rand_impls.rs":"cf411028341f67fd196ccde6200eea563c993f59d360a030b3d7d3ee15447a7d","src/read.rs":"bd0eb508a6b659dc578d546fc2f231484aed80c73cfe8c475e0d65c8d699a769","src/reseeding.rs":"73b2539b86b4cb8068e54716c7fd53e0d70b6c0de787a0749431b17019c9d826"},"package":"9e7944d95d25ace8f377da3ac7068ce517e4c646754c43a1b1849177bbf72e59"} \ No newline at end of file diff --git a/src/vendor/rand/.travis.yml b/src/vendor/rand/.travis.yml index 1cb2e68cbb..f4be3790ab 100644 --- a/src/vendor/rand/.travis.yml +++ b/src/vendor/rand/.travis.yml @@ -1,7 +1,5 @@ language: rust sudo: false -before_script: - - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH matrix: include: @@ -11,16 +9,19 @@ matrix: os: osx - rust: beta - rust: nightly + before_script: + - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH script: - - cargo test + - cargo doc --no-deps --all-features + - cargo bench - cargo test --features nightly - - cargo test --manifest-path rand-derive/Cargo.toml - - cargo doc --no-deps --features nightly + after_success: + - travis-cargo --only nightly doc-upload + script: - cargo test - cargo test --manifest-path rand-derive/Cargo.toml -after_success: - - travis-cargo --only nightly doc-upload + env: global: secure: "BdDntVHSompN+Qxz5Rz45VI4ZqhD72r6aPl166FADlnkIwS6N6FLWdqs51O7G5CpoMXEDvyYrjmRMZe/GYLIG9cmqmn/wUrWPO+PauGiIuG/D2dmfuUNvSTRcIe7UQLXrfP3yyfZPgqsH6pSnNEVopquQKy3KjzqepgriOJtbyY=" diff --git a/src/vendor/rand/Cargo.toml b/src/vendor/rand/Cargo.toml index 106ed81305..7dcd58028e 100644 --- a/src/vendor/rand/Cargo.toml +++ b/src/vendor/rand/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "rand" -version = "0.3.18" +version = "0.3.19" authors = ["The Rust Project Developers"] description = "Random number generators and other randomness functionality.\n" homepage = "https://github.com/rust-lang-nursery/rand" @@ -25,10 +25,10 @@ repository = "https://github.com/rust-lang-nursery/rand" [dependencies.libc] version = "0.2" [dev-dependencies.log] -version = "0.3.0" +version = "0.3, <=0.3.8" [features] -nightly = ["i128_support"] i128_support = [] +nightly = ["i128_support"] [target."cfg(target_os = \"fuchsia\")".dependencies.fuchsia-zircon] -version = "^0.2.1" +version = "0.3" diff --git a/src/vendor/rand/Cargo.toml.orig b/src/vendor/rand/Cargo.toml.orig index 6f9eb64e31..44dbd4e147 100644 --- a/src/vendor/rand/Cargo.toml.orig +++ b/src/vendor/rand/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "rand" -version = "0.3.18" +version = "0.3.19" authors = ["The Rust Project Developers"] license = "MIT/Apache-2.0" readme = "README.md" @@ -21,10 +21,12 @@ nightly = ["i128_support"] libc = "0.2" [dev-dependencies] -log = "0.3.0" +# log 0.3.9 is a wrapper around 0.4.0 which doesn't work with rustc 1.15 +# To keep our CI pin on 1.15 we require log <= 0.3.8. +log = "0.3, <=0.3.8" [workspace] members = ["rand-derive"] [target.'cfg(target_os = "fuchsia")'.dependencies] -fuchsia-zircon = "^0.2.1" +fuchsia-zircon = "0.3" diff --git a/src/vendor/rand/src/lib.rs b/src/vendor/rand/src/lib.rs index 3c7d2cc514..64ca6fdcf6 100644 --- a/src/vendor/rand/src/lib.rs +++ b/src/vendor/rand/src/lib.rs @@ -304,8 +304,8 @@ type w32 = w; /// /// [`Open01`]: struct.Open01.html /// [`Closed01`]: struct.Closed01.html -/// [`Exp1`]: struct.Exp1.html -/// [`StandardNormal`]: struct.StandardNormal.html +/// [`Exp1`]: distributions/exponential/struct.Exp1.html +/// [`StandardNormal`]: distributions/normal/struct.StandardNormal.html /// /// The following aggregate types also implement `Rand` as long as their /// component types implement it: diff --git a/src/vendor/rand/src/os.rs b/src/vendor/rand/src/os.rs index 1eb903a225..a54e4eaa32 100644 --- a/src/vendor/rand/src/os.rs +++ b/src/vendor/rand/src/os.rs @@ -53,13 +53,13 @@ impl fmt::Debug for OsRng { } } -fn next_u32(mut fill_buf: &mut FnMut(&mut [u8])) -> u32 { +fn next_u32(fill_buf: &mut FnMut(&mut [u8])) -> u32 { let mut buf: [u8; 4] = [0; 4]; fill_buf(&mut buf); unsafe { mem::transmute::<[u8; 4], u32>(buf) } } -fn next_u64(mut fill_buf: &mut FnMut(&mut [u8])) -> u64 { +fn next_u64(fill_buf: &mut FnMut(&mut [u8])) -> u64 { let mut buf: [u8; 8] = [0; 8]; fill_buf(&mut buf); unsafe { mem::transmute::<[u8; 8], u64>(buf) } diff --git a/src/vendor/redox_syscall/.cargo-checksum.json b/src/vendor/redox_syscall/.cargo-checksum.json index bd3244c213..77d4577fcb 100644 --- a/src/vendor/redox_syscall/.cargo-checksum.json +++ b/src/vendor/redox_syscall/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"944bf600c6230664922a011cbca026699969f2f89f6c7ff689835836ccd7b1de","Cargo.toml":"c725f317bb27871da237c88ca08a137e2dbe1f2864d48ffd9fe65e545cd9207a","Cargo.toml.orig":"baff7de9aba21f24dc85864e5062612d72c258c8160a0a089651daf0b8e0fb13","LICENSE":"efcfee7981ff72431fffb06925cad00a23dce079ed4354f61030ad5abdb78829","README.md":"f2aabeb00e422ebe0f5ccdde1449fca7e8da5e563fb84024db83742ca12633fc","src/arch/arm.rs":"44ed9097879fce0ebe85d29e25ba378fb3ee7fcd649b569207495ed601c42a1c","src/arch/x86.rs":"e72a7f653c25b1ea5595af7ce991fe0e5c96547e127fc67e4967d60abbe1d3bd","src/arch/x86_64.rs":"499a0c997756c1cac5f4b4b98cff474a4e759695d3664712bd1a92d5d4a4a5f1","src/call.rs":"9b8517947298b82f0ccde0e97288856fee20d484470996d4bd19b725ecb7892b","src/data.rs":"8602d05b437216e6774658902f2d5fb030edc7510754ce7277fd299ab53a6b8b","src/error.rs":"b23c12db8cafb64f3b909a95bdd47cf03f62f6fa1201b40892febf46ec56bcb4","src/flag.rs":"4e10f5aeeba8406d50155332d59f7933c933dd7a03cc0a8316237e389c30e278","src/io/dma.rs":"4ab65016b3bc9121f0844dc4b8de77608eba327c0e0d930900254242b2c204b0","src/io/io.rs":"1bcb36d1867e9bab6a8186cd6928efe70ae2655e9f9d0dd3def20bc0fb6a82f6","src/io/mmio.rs":"bd475c815d483cc2b187348c32e10f94df0ca756ee8d14260b6ca3c660b2a73a","src/io/mod.rs":"4df12af3e82e6b5fe22112c9f51552112ee4811b7d1131d2a43d608d8d1cac09","src/io/pio.rs":"219fcd317d6c490a14794ec4db9de3e305c722dda720043c67076bda60632bb8","src/lib.rs":"988fb0b0bd3b396345f11ef46617072aeaf9307d3fa05a4d2a2ee9d590598bba","src/number.rs":"f9779b8abf0473ffbc81614746eb6ef5648129984a69eb43e4890a5b4c0aaedf","src/scheme.rs":"fe4cfac446eb1951795f588648afa0f6014566a7e2aa423f5f6f1dad45fe8583"},"package":"8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"944bf600c6230664922a011cbca026699969f2f89f6c7ff689835836ccd7b1de","Cargo.toml":"4c637987488c71b124a5bee158d3752aef774bcf076b4d14fde9f5cf5b49796c","Cargo.toml.orig":"11ee9e9d82208410ca284cc99163940b1268cd4d491a44321ee47b3c19c7eb8e","LICENSE":"efcfee7981ff72431fffb06925cad00a23dce079ed4354f61030ad5abdb78829","README.md":"f2aabeb00e422ebe0f5ccdde1449fca7e8da5e563fb84024db83742ca12633fc","src/arch/arm.rs":"44ed9097879fce0ebe85d29e25ba378fb3ee7fcd649b569207495ed601c42a1c","src/arch/x86.rs":"e72a7f653c25b1ea5595af7ce991fe0e5c96547e127fc67e4967d60abbe1d3bd","src/arch/x86_64.rs":"499a0c997756c1cac5f4b4b98cff474a4e759695d3664712bd1a92d5d4a4a5f1","src/call.rs":"424bcb40b1a06c9a3d156dc7640395d4657b215c7bee5e27d521e8f830915484","src/data.rs":"8602d05b437216e6774658902f2d5fb030edc7510754ce7277fd299ab53a6b8b","src/error.rs":"b23c12db8cafb64f3b909a95bdd47cf03f62f6fa1201b40892febf46ec56bcb4","src/flag.rs":"4e10f5aeeba8406d50155332d59f7933c933dd7a03cc0a8316237e389c30e278","src/io/dma.rs":"4ab65016b3bc9121f0844dc4b8de77608eba327c0e0d930900254242b2c204b0","src/io/io.rs":"1bcb36d1867e9bab6a8186cd6928efe70ae2655e9f9d0dd3def20bc0fb6a82f6","src/io/mmio.rs":"bd475c815d483cc2b187348c32e10f94df0ca756ee8d14260b6ca3c660b2a73a","src/io/mod.rs":"4df12af3e82e6b5fe22112c9f51552112ee4811b7d1131d2a43d608d8d1cac09","src/io/pio.rs":"219fcd317d6c490a14794ec4db9de3e305c722dda720043c67076bda60632bb8","src/lib.rs":"988fb0b0bd3b396345f11ef46617072aeaf9307d3fa05a4d2a2ee9d590598bba","src/number.rs":"ee28dc0f4fcd371a72eb633c539051e8d30ae8d03e9f312aa60c863e47a63232","src/scheme.rs":"479301bfbd25e7fedb35d2a0cfb06fed7cd366716d15785db09220e1db12adb9"},"package":"ab105df655884ede59d45b7070c8a65002d921461ee813a024558ca16030eea0"} \ No newline at end of file diff --git a/src/vendor/redox_syscall/Cargo.toml b/src/vendor/redox_syscall/Cargo.toml index 6b6523f610..20524ae4da 100644 --- a/src/vendor/redox_syscall/Cargo.toml +++ b/src/vendor/redox_syscall/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "redox_syscall" -version = "0.1.31" +version = "0.1.32" authors = ["Jeremy Soller "] description = "A Rust library to access raw Redox system calls" documentation = "https://docs.rs/redox_syscall" diff --git a/src/vendor/redox_syscall/Cargo.toml.orig b/src/vendor/redox_syscall/Cargo.toml.orig index bd912d844c..1efb2f14ab 100644 --- a/src/vendor/redox_syscall/Cargo.toml.orig +++ b/src/vendor/redox_syscall/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "redox_syscall" -version = "0.1.31" +version = "0.1.32" description = "A Rust library to access raw Redox system calls" license = "MIT" authors = ["Jeremy Soller "] diff --git a/src/vendor/redox_syscall/src/call.rs b/src/vendor/redox_syscall/src/call.rs index 9dd081a776..e934ea8c40 100644 --- a/src/vendor/redox_syscall/src/call.rs +++ b/src/vendor/redox_syscall/src/call.rs @@ -83,7 +83,19 @@ pub fn exit(status: usize) -> Result { unsafe { syscall1(SYS_EXIT, status) } } -/// Register a file for event-based I/O +/// Change file permissions +pub fn fchmod(fd: usize, mode: u16) -> Result { + unsafe { syscall2(SYS_FCHMOD, fd, mode as usize) } + +} + +/// Change file ownership +pub fn fchown(fd: usize, uid: u32, gid: u32) -> Result { + unsafe { syscall3(SYS_FCHOWN, fd, uid as usize, gid as usize) } + +} + +/// Change file descriptor flags pub fn fcntl(fd: usize, cmd: usize, arg: usize) -> Result { unsafe { syscall3(SYS_FCNTL, fd, cmd, arg) } } diff --git a/src/vendor/redox_syscall/src/number.rs b/src/vendor/redox_syscall/src/number.rs index bf0ca5720c..0c48e2fc3e 100644 --- a/src/vendor/redox_syscall/src/number.rs +++ b/src/vendor/redox_syscall/src/number.rs @@ -22,6 +22,8 @@ pub const SYS_DUP2: usize = SYS_CLASS_FILE | SYS_RET_FILE | 63; pub const SYS_READ: usize = SYS_CLASS_FILE | SYS_ARG_MSLICE | 3; pub const SYS_WRITE: usize = SYS_CLASS_FILE | SYS_ARG_SLICE | 4; pub const SYS_LSEEK: usize = SYS_CLASS_FILE | 19; +pub const SYS_FCHMOD: usize = SYS_CLASS_FILE | 94; +pub const SYS_FCHOWN: usize = SYS_CLASS_FILE | 207; pub const SYS_FCNTL: usize = SYS_CLASS_FILE | 55; pub const SYS_FEVENT: usize = SYS_CLASS_FILE | 927; pub const SYS_FMAP: usize = SYS_CLASS_FILE | 90; diff --git a/src/vendor/redox_syscall/src/scheme.rs b/src/vendor/redox_syscall/src/scheme.rs index d58bd2900a..3ce711da8b 100644 --- a/src/vendor/redox_syscall/src/scheme.rs +++ b/src/vendor/redox_syscall/src/scheme.rs @@ -14,6 +14,8 @@ pub trait Scheme { SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }), SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }), SYS_LSEEK => self.seek(packet.b, packet.c, packet.d), + SYS_FCHMOD => self.fchmod(packet.b, packet.c as u16), + SYS_FCHOWN => self.fchown(packet.b, packet.c as u32, packet.d as u32), SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d), SYS_FEVENT => self.fevent(packet.b, packet.c), SYS_FMAP => self.fmap(packet.b, packet.c, packet.d), @@ -83,6 +85,16 @@ pub trait Scheme { Err(Error::new(EBADF)) } + #[allow(unused_variables)] + fn fchmod(&self, id: usize, mode: u16) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fchown(&self, id: usize, uid: u32, gid: u32) -> Result { + Err(Error::new(EBADF)) + } + #[allow(unused_variables)] fn fcntl(&self, id: usize, cmd: usize, arg: usize) -> Result { Err(Error::new(EBADF)) @@ -146,6 +158,8 @@ pub trait SchemeMut { SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }), SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }), SYS_LSEEK => self.seek(packet.b, packet.c, packet.d), + SYS_FCHMOD => self.fchmod(packet.b, packet.c as u16), + SYS_FCHOWN => self.fchown(packet.b, packet.c as u32, packet.d as u32), SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d), SYS_FEVENT => self.fevent(packet.b, packet.c), SYS_FMAP => self.fmap(packet.b, packet.c, packet.d), @@ -214,6 +228,16 @@ pub trait SchemeMut { Err(Error::new(EBADF)) } + #[allow(unused_variables)] + fn fchmod(&mut self, id: usize, mode: u16) -> Result { + Err(Error::new(EBADF)) + } + + #[allow(unused_variables)] + fn fchown(&mut self, id: usize, uid: u32, gid: u32) -> Result { + Err(Error::new(EBADF)) + } + #[allow(unused_variables)] fn fcntl(&mut self, id: usize, cmd: usize, arg: usize) -> Result { Err(Error::new(EBADF)) diff --git a/src/vendor/regex/.cargo-checksum.json b/src/vendor/regex/.cargo-checksum.json index b4e7af00e3..aa1800a6ae 100644 --- a/src/vendor/regex/.cargo-checksum.json +++ b/src/vendor/regex/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"8b6714394049c525c670701ed615954c3f6b0b6cda9d909d5e8c4d8446b4dc57",".travis.yml":"28fc87d41a27bc03d9a8c6b5f7bc1bca55444dbd0001100b85060acada1449d7","CHANGELOG.md":"1056eb04d324b46354605713b40b76bb68d29e5d6ff7ab8d67a58f24534d1860","Cargo.toml":"db32762fb82d997942d0ccebdfab132e742a3d384b2f3b10b2e1000515bd40e7","HACKING.md":"37ea34650ce307a1d561aa915ada82cc8b44153085f327aa2b342fcf8e7afc62","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","PERFORMANCE.md":"d23d6dbe3791bc0689c5a876922b8264d6d3069b577772440b8caa01867f0cb4","README.md":"e88b7b2f1982115b1bfa8dd1b305ae1315af6f426c919009d80b63007509ed1c","appveyor.yml":"6855c14a64fec423d67c1ddcc47644593ae3ad1f26e8d157cd5c395efee1efc0","ci/after_success.sh":"6c9562098234f7484e2496918386505185c43018c3f3d17f8df95a59457d8f1f","ci/run-kcov":"721a0ebfb72deb34e4b45141279eae5b4a40c22d47159e01b4e6f176ed3bbc22","ci/run-shootout-test":"be7edb66a4a65eaef6a2b7e6036b4b732effa8dcd931bf4cbd591d0ca32b8264","ci/script.sh":"7f640b7a469c2764f6c12dc84a75fa956c24bc1f611cd72f1ae3a53bacd3ee06","examples/bug347.rs":"93fde9707dd78978dffed46b08bde095a515151bc94f892c0159ac3c0060852d","examples/regexdna-input.txt":"156a49710bb3e1ed4bc2bbb0af0f383b747b3d0281453cfff39c296124c598f8","examples/regexdna-output.txt":"35e85b19b70a893d752fd43e54e1e9da08bac43559191cea85b33387c24c4cc1","examples/shootout-regex-dna-bytes.rs":"3d36b08dd34c51d022e9b3a3dcfbc780bc9dc3d46a601256db5d4d5e2213119c","examples/shootout-regex-dna-cheat.rs":"4b5a590ec88a9ba67cc4a34621cb038a400d45e64a15a354f3e07fdaf41a935b","examples/shootout-regex-dna-replace.rs":"15677e7de356427fe2b983e918de073a7a730337b090d4ab0e815e1e66f74f73","examples/shootout-regex-dna-single-cheat.rs":"5e743b3a6ec968713ce064a289b1fbd11c302add824d1c749a2ffb546c73128e","examples/shootout-regex-dna-single.rs":"021292ec6999be33a9b8e833759bf3509dc0e6b6365fad8e3a882cf3835b0405","examples/shootout-regex-dna.rs":"b892242cea6b6b16f0511ea672c24a49909585224fb69085f0f2fca77ce30aea","examples/shootout-regex-redux-1.rs":"191f47847f5466261a308c8cdc19a3502603a208f40e4e650024dec80241b9e3","examples/shootout-regex-redux-chunked.rs":"6da0b6af66df64dfe45fb2e08532e2b3712cebcf0d3f19ff8d5f87fe712278c9","examples/shootout-regex-redux.rs":"c587bef968feb9c329f5c1896f79ec09e509885dec27091678b28a221a5d40e8","scripts/frequencies.py":"df2cac150bc4ed42d2d97762535a5f260f3fe06d9d516721f68a52671a3b7a3b","scripts/regex-match-tests.py":"f1b3ad870c893510172bd84f8328b66ee99cd7aee7715a95a858468ff3e33635","scripts/unicode.py":"4b1330e733bbc22e677e22855bf8a88ab134aae56a10fda97081320aa12a6228","src/backtrack.rs":"221e12b4afaff096f8a61bb274eade928845e194e1ec37fa75b684b18c126b1b","src/compile.rs":"4c2159961364d001e9191840a878c3c3ca0b641f2356ba2abcc3356581b7b47c","src/dfa.rs":"985b5f880814452edae862347584f2e53c08eaccae0e01ee5c5d8564dd8381ad","src/error.rs":"b4052872f9a7bc48c478fe73e145ac1acf7533140f827999808fadcba09754d3","src/exec.rs":"b696cd65cca692d4ddf55e60bcd29986c5f2fd43a2e32ffea23c0c95548915d9","src/expand.rs":"94d7fb06544639d94338fc426bd15d1883efd4e0204552c9def667b9b415ef63","src/freqs.rs":"e25871eec51d1c02c15abbc04d61dbea71fb2dbc15f370c98279687416c969de","src/input.rs":"c2710458e38398a0eba357c76c38fde42b50c22b6e39764ea68984fab3acfab7","src/lib.rs":"1652707e4c259cd39e5c45011c5c8d001f582944527af8d78637600bfe162b44","src/literals.rs":"7a2efe252c21660794bd27054e997151763c8f0ea68c2be7994e1a36f4811675","src/pattern.rs":"4e820c17a2b983050f47d3fd13282094ce9f27b75fd852fcec438d61f07f0b0b","src/pikevm.rs":"bc9d00bd5aed5463121fc98ce9390381137f842c821da48242b2f6fae1137f22","src/prog.rs":"3b3d472ced5958e140e96d367067ab53edba72804c80009a46131ec904a75f2a","src/re_builder.rs":"d14baf810f1248a030eca31475989115f6254a438acbba1eec14b59ed58d2f12","src/re_bytes.rs":"a5b7afee1460fb1957284a2483e6708f6357acc7c13288dee409b6aa0fa15b74","src/re_plugin.rs":"74999c35abc02cb7c18adb74c1d8ebd08b56141f66f174c67b7157c5c27e2a49","src/re_set.rs":"43f40dba1273b8b359d4010616be62b41f71b1d803f0c6e4b04169dc57cb6318","src/re_trait.rs":"37d791af9cc737e0a144be64ddb7104114222e5034cfc9c948078b0b2c799295","src/re_unicode.rs":"34cff9ae054084d870803f1c8d092847fe32a34c9572e67bfc524da03cbfc905","src/simd_accel/mod.rs":"a3eb2c7fcc296137cfc135da47cdfe745606e8159c3263591bebced2c09fdd54","src/simd_accel/teddy128.rs":"4b913c67f5b7105f75b02fff092c3d76895612425c3f8b3e5ded2c41aae4279c","src/simd_fallback/mod.rs":"4cb8a77e2d3e167e9bfc47cb7e4734179f743c2f727e26838864d9959275239b","src/simd_fallback/teddy128.rs":"502d3bff4c78963f343875aa00b15e3625f3ee2ba1de01f029211292a5721912","src/sparse.rs":"04e70bb0bd006f806e8c9cf19825625e907036304823bc03b6c8f2e5046a38ef","src/testdata/LICENSE":"58cf078acc03da3e280a938c2bd9943f554fc9b6ced89ad93ba35ca436872899","src/testdata/README":"45f869e37f798905c773bfbe0ef19a5fb7e585cbf0b7c21b5b5a784e8cec3c14","src/testdata/basic.dat":"3756a5bdd6f387ed34731197fbdaab8521b0ae1726250100ba235756cb42b4b1","src/testdata/nullsubexpr.dat":"496ac0278eec3b6d9170faace14554569032dd3d909618364d9326156de39ecf","src/testdata/repetition.dat":"1f7959063015b284b18a4a2c1c8b416d438a2d6c4b1a362da43406b865f50e69","src/utf8.rs":"75a4516d636566938e896f10687fc16b3ecd8b09de0093015359eb0d11471d5d","tests/api.rs":"803faacd9ac5efc149959ff63a2132f5ca155f75a246b79807c549b464b5c497","tests/api_str.rs":"aef1388c9de8fe9044539745d1975c734e9d268ff02a2dbb1edc5b754cc56d77","tests/bytes.rs":"ae7601bf69307c541b56d85b6f77369051f55096dddfa9d81d470adb54f42a5d","tests/crazy.rs":"bf3a1c3b8620d7d4c9aa72ab5e027fec02ef4bcec45a884e89ad70e82c445a8d","tests/flags.rs":"cd3788760defc667b32adb2732b6657b289372e1051fc240dfd0e435e2835353","tests/fowler.rs":"e0b7420fa5b636301d4c11cd4dfb803ec09fa7b27be47c594d231167de1241e3","tests/macros.rs":"e0329eedbe073e9dca649e651bc869ef2e6030b4b2a2d5959033b58bfddeb858","tests/macros_bytes.rs":"647c42525b8df5151f4f4cab40f515dd2fa5a05246562f5575902e162b0af2c0","tests/macros_str.rs":"124767f6ff33766502e89050ad498d3aba21e975aefeaf64ae76b0abe13b4fdb","tests/misc.rs":"c8cc85ac916980ebd053df2444fe9b795a00f2ac42c5cd828fc3df487f689265","tests/multiline.rs":"4e872a9473bc229d955716c18c77aa3530625a8f3a28ecaefdb70b9aff0f0a8b","tests/noparse.rs":"9c5acf252655f8daba67d5aa15a98f556a8bb5de87de9ecc8e8e3b50614a65c2","tests/plugin.rs":"9a51dfcbdad4e2a19f43598d74e0dd745a862a01b4165fce387a94083e5b588f","tests/regression.rs":"28bd9e3b6df7b8b48b4c2e069f72f4f59d5e64b091ed2559bd3b0516e27f626a","tests/replace.rs":"4a65b863ad012366328062784e323f13c4bbccce89ff709196e4d84d94ef1636","tests/searcher.rs":"124c9909a1e8fcfddee8ecfae3a1fb9d76f9ddac62fda23d9b895744728a0aa8","tests/set.rs":"0cecf5d2acb3d0df2b051e0ab56a4a853bb58c0e922480f5e460b9a05a0d16af","tests/shortest_match.rs":"7ca223e0a61b1a26a1f36465ab49de021475295e18f4d6421497461af1e107be","tests/suffix_reverse.rs":"cd497c1a51246a8fc727062133470e0c6300620ad80333d20d63c0ee4224ef1c","tests/test_backtrack.rs":"b07a114b2eb7f1f17357629be9c8458e31f7952fb2c327d66d9415f08855c624","tests/test_backtrack_bytes.rs":"dd3cec3c630d6f41892c9111bee87227bf47126651b2402672c30b084fa9c28c","tests/test_backtrack_utf8bytes.rs":"b576b933d6be21f8cedb281e456441d4278350b0145a139dbccb1861639a54f9","tests/test_default.rs":"768a1fabafc7eb815bfaf55c22606dc884e1dbb88d7fc40fd561e8faaa61e6d9","tests/test_default_bytes.rs":"c0b66b63abd263f3fc7e5fcacf4a93cb7fc40c17b764edf8700ae9ba1ab950ff","tests/test_nfa.rs":"aad36ca01f3f7eb23633a1207056e9056d686be2ef6e3661fad83805fa482927","tests/test_nfa_bytes.rs":"198f7b58c5c7dd0a05f16ddb3b9b63dab29ef2a56448378ac602c5d087c01e4e","tests/test_nfa_utf8bytes.rs":"854d80114ca1bed14d4ad3f2b3bf292ff0fa44e12d7d3f2ec6dd17cbbaa82175","tests/test_plugin.rs":"84be9cabe1cf8fb208638475436b020a75e9ec3e7f885af39e5404adb6fcae03","tests/unicode.rs":"7bd3095678fa227dc722f2b5f60a072c2b1752a5ac8df234cd023ece34c80d8a","tests/word_boundary.rs":"7081317ddcec1e82dd4a2090a571c6abf2ff4bbfa8cd10395e1eb3f386157fae","tests/word_boundary_ascii.rs":"cd0be5b5b485de0ba7994b42e2864585556c3d2d8bf5eab05b58931d9aaf4b87","tests/word_boundary_unicode.rs":"ae4ac0689c6b42ff7628a681d6d99a124d254f35eb1b809137859d3a8afe84fc"},"package":"1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"8b6714394049c525c670701ed615954c3f6b0b6cda9d909d5e8c4d8446b4dc57",".travis.yml":"28fc87d41a27bc03d9a8c6b5f7bc1bca55444dbd0001100b85060acada1449d7","CHANGELOG.md":"1056eb04d324b46354605713b40b76bb68d29e5d6ff7ab8d67a58f24534d1860","Cargo.toml":"d887476408e3d0967d6a1e580d367994c9adcfd7fc5daada8d1573570d7a75e3","Cargo.toml.orig":"a7b43ed5f0b965636278035af02f48e5b06febaed8a6d0c605b8a0a1017f9bba","HACKING.md":"862f66eb940cd7a0d7832ca2805038e535fbbbd647856aadd608ec694252ebb5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","PERFORMANCE.md":"d23d6dbe3791bc0689c5a876922b8264d6d3069b577772440b8caa01867f0cb4","README.md":"80049be7ba75c1499eb0664312e557c4073c6b05a3612610a37f6af1c1a6a2a0","appveyor.yml":"6855c14a64fec423d67c1ddcc47644593ae3ad1f26e8d157cd5c395efee1efc0","ci/after_success.sh":"6c9562098234f7484e2496918386505185c43018c3f3d17f8df95a59457d8f1f","ci/run-kcov":"721a0ebfb72deb34e4b45141279eae5b4a40c22d47159e01b4e6f176ed3bbc22","ci/run-shootout-test":"be7edb66a4a65eaef6a2b7e6036b4b732effa8dcd931bf4cbd591d0ca32b8264","ci/script.sh":"7f640b7a469c2764f6c12dc84a75fa956c24bc1f611cd72f1ae3a53bacd3ee06","examples/regexdna-input.txt":"156a49710bb3e1ed4bc2bbb0af0f383b747b3d0281453cfff39c296124c598f8","examples/regexdna-output.txt":"35e85b19b70a893d752fd43e54e1e9da08bac43559191cea85b33387c24c4cc1","examples/shootout-regex-dna-bytes.rs":"f097a923fef2e9bd9a9abd3686eea84830e8050bb750bcab840b6575873227ff","examples/shootout-regex-dna-cheat.rs":"4b5a590ec88a9ba67cc4a34621cb038a400d45e64a15a354f3e07fdaf41a935b","examples/shootout-regex-dna-replace.rs":"15677e7de356427fe2b983e918de073a7a730337b090d4ab0e815e1e66f74f73","examples/shootout-regex-dna-single-cheat.rs":"5e743b3a6ec968713ce064a289b1fbd11c302add824d1c749a2ffb546c73128e","examples/shootout-regex-dna-single.rs":"c86969adb0fb08c5e23f749ec6922a58404da7d0e1925c848957a5144ddc8815","examples/shootout-regex-dna.rs":"e627f1e5e24c1cf4e9c9d52b844b6d971c59b7169b0e8762d8d9d1cb7debc6e6","scripts/frequencies.py":"df2cac150bc4ed42d2d97762535a5f260f3fe06d9d516721f68a52671a3b7a3b","scripts/regex-match-tests.py":"f1b3ad870c893510172bd84f8328b66ee99cd7aee7715a95a858468ff3e33635","scripts/unicode.py":"4b1330e733bbc22e677e22855bf8a88ab134aae56a10fda97081320aa12a6228","src/backtrack.rs":"0372ada608dca9c8d3e1fabf56e33498f8ff4fbdfd445873c4a4be6657465c68","src/compile.rs":"2b0de642862bb8c9d29add6934e9a1a4b27732f1b339471d1097bbcf866c03df","src/dfa.rs":"8c02af79e785d593e1db7f8c5adf02bdb98eefaa6e08007f19eadc2bf6d9f2a5","src/error.rs":"9473a3c9cb82022a1c7f373199c6e00f66e3f7e294c9055b75aed30458253036","src/exec.rs":"488d02a435399c54594c86c0912457379e90cf907d074f315571c28da1118b47","src/expand.rs":"4333da32d6fbb05ec05bead810eb659c5b012e2d361a9bb9e24bb30e8939fb88","src/freqs.rs":"e25871eec51d1c02c15abbc04d61dbea71fb2dbc15f370c98279687416c969de","src/input.rs":"051b42026cad99fc7643306a75f6d6b0cff22da9ced0de06ccdaef6456724680","src/lib.rs":"e2d44b8c0d7ce57860316302914208070e7fbe1c37a8ea59d5f240ffba42f71b","src/literals.rs":"3cb0d3b346c2e0e438da45d151c9efb65871307f10dec4abc01d62135041fdd2","src/pattern.rs":"4e820c17a2b983050f47d3fd13282094ce9f27b75fd852fcec438d61f07f0b0b","src/pikevm.rs":"9600a8b135075f8cf62683e6b08c73834873a203347d275f1e9ca3a97221dbeb","src/prog.rs":"cba3a933c5dae41c832d3a7bc56b98238c4a450ca44c072878fdaae6f12b0b89","src/re_builder.rs":"5d0d935bcd9de02d68cf11373136b8c36bfa1d97b2225247811a22ae4f0c2530","src/re_bytes.rs":"d2fa9541a98632f77ba072cfcefb5368426c0e5c9acf654d999331f0e4afe5df","src/re_plugin.rs":"74999c35abc02cb7c18adb74c1d8ebd08b56141f66f174c67b7157c5c27e2a49","src/re_set.rs":"43f40dba1273b8b359d4010616be62b41f71b1d803f0c6e4b04169dc57cb6318","src/re_trait.rs":"8ecbdd8db8c8e4194acd71e4a751aa8409bbd495015a01bb7c8b425677f3fa39","src/re_unicode.rs":"6c535b91b9a4d2634650126e3033b2b0245a3cae271190045a2d07630b042b42","src/simd_accel/mod.rs":"a3eb2c7fcc296137cfc135da47cdfe745606e8159c3263591bebced2c09fdd54","src/simd_accel/teddy128.rs":"4b913c67f5b7105f75b02fff092c3d76895612425c3f8b3e5ded2c41aae4279c","src/simd_fallback/mod.rs":"4cb8a77e2d3e167e9bfc47cb7e4734179f743c2f727e26838864d9959275239b","src/simd_fallback/teddy128.rs":"502d3bff4c78963f343875aa00b15e3625f3ee2ba1de01f029211292a5721912","src/sparse.rs":"04e70bb0bd006f806e8c9cf19825625e907036304823bc03b6c8f2e5046a38ef","src/testdata/LICENSE":"58cf078acc03da3e280a938c2bd9943f554fc9b6ced89ad93ba35ca436872899","src/testdata/README":"45f869e37f798905c773bfbe0ef19a5fb7e585cbf0b7c21b5b5a784e8cec3c14","src/testdata/basic.dat":"3756a5bdd6f387ed34731197fbdaab8521b0ae1726250100ba235756cb42b4b1","src/testdata/nullsubexpr.dat":"496ac0278eec3b6d9170faace14554569032dd3d909618364d9326156de39ecf","src/testdata/repetition.dat":"1f7959063015b284b18a4a2c1c8b416d438a2d6c4b1a362da43406b865f50e69","src/utf8.rs":"b0db05e53f2922219a5725fdae61c7715921bb3cf69ffe5045cdc78da10dc97e","tests/api.rs":"803faacd9ac5efc149959ff63a2132f5ca155f75a246b79807c549b464b5c497","tests/api_str.rs":"8ccb6c3dfe0220229ad33fcaf9dea420b414aea17c7498d978efd1b8aceaa980","tests/bytes.rs":"701422f68d55f950fdba32550e16b4bd20b06b37cbac06749558d16f7f58a3a7","tests/crazy.rs":"e5ba1e90b144abad586c09baf87db4c62bc83a952fbef2465a16263d756bc04b","tests/flags.rs":"cd3788760defc667b32adb2732b6657b289372e1051fc240dfd0e435e2835353","tests/fowler.rs":"e0b7420fa5b636301d4c11cd4dfb803ec09fa7b27be47c594d231167de1241e3","tests/macros.rs":"f021b62e3ce8d122f6450a5aab36972eccf4c21c62a53c604924d4d01d90c0d8","tests/macros_bytes.rs":"dffa91e2e572f5b223b83eba4d32732b1d76cfcfebfbd7f836eeaa929f637657","tests/macros_str.rs":"4f665f039cd5408fc7b4c0fab2983ef3ebd3dc1cd52f7b7e46d7644a2e85b428","tests/misc.rs":"c8cc85ac916980ebd053df2444fe9b795a00f2ac42c5cd828fc3df487f689265","tests/multiline.rs":"4e872a9473bc229d955716c18c77aa3530625a8f3a28ecaefdb70b9aff0f0a8b","tests/noparse.rs":"9c5acf252655f8daba67d5aa15a98f556a8bb5de87de9ecc8e8e3b50614a65c2","tests/plugin.rs":"9a51dfcbdad4e2a19f43598d74e0dd745a862a01b4165fce387a94083e5b588f","tests/regression.rs":"28bd9e3b6df7b8b48b4c2e069f72f4f59d5e64b091ed2559bd3b0516e27f626a","tests/replace.rs":"8ffd360f062170cd2b1b5f5635830598f773488ae512d22a9a328c34eca9e09f","tests/searcher.rs":"124c9909a1e8fcfddee8ecfae3a1fb9d76f9ddac62fda23d9b895744728a0aa8","tests/set.rs":"0cecf5d2acb3d0df2b051e0ab56a4a853bb58c0e922480f5e460b9a05a0d16af","tests/shortest_match.rs":"7ca223e0a61b1a26a1f36465ab49de021475295e18f4d6421497461af1e107be","tests/suffix_reverse.rs":"cd497c1a51246a8fc727062133470e0c6300620ad80333d20d63c0ee4224ef1c","tests/test_backtrack.rs":"b07a114b2eb7f1f17357629be9c8458e31f7952fb2c327d66d9415f08855c624","tests/test_backtrack_bytes.rs":"dd3cec3c630d6f41892c9111bee87227bf47126651b2402672c30b084fa9c28c","tests/test_backtrack_utf8bytes.rs":"b576b933d6be21f8cedb281e456441d4278350b0145a139dbccb1861639a54f9","tests/test_default.rs":"768a1fabafc7eb815bfaf55c22606dc884e1dbb88d7fc40fd561e8faaa61e6d9","tests/test_default_bytes.rs":"c5228278e0a1d8fab5157dfd2b52642fd0ec68db346dc133f4c16f178d63e856","tests/test_nfa.rs":"aad36ca01f3f7eb23633a1207056e9056d686be2ef6e3661fad83805fa482927","tests/test_nfa_bytes.rs":"198f7b58c5c7dd0a05f16ddb3b9b63dab29ef2a56448378ac602c5d087c01e4e","tests/test_nfa_utf8bytes.rs":"854d80114ca1bed14d4ad3f2b3bf292ff0fa44e12d7d3f2ec6dd17cbbaa82175","tests/test_plugin.rs":"84be9cabe1cf8fb208638475436b020a75e9ec3e7f885af39e5404adb6fcae03","tests/unicode.rs":"7bd3095678fa227dc722f2b5f60a072c2b1752a5ac8df234cd023ece34c80d8a","tests/word_boundary.rs":"7081317ddcec1e82dd4a2090a571c6abf2ff4bbfa8cd10395e1eb3f386157fae","tests/word_boundary_ascii.rs":"cd0be5b5b485de0ba7994b42e2864585556c3d2d8bf5eab05b58931d9aaf4b87","tests/word_boundary_unicode.rs":"ae4ac0689c6b42ff7628a681d6d99a124d254f35eb1b809137859d3a8afe84fc"},"package":"ac6ab4e9218ade5b423358bbd2567d1617418403c7a512603630181813316322"} \ No newline at end of file diff --git a/src/vendor/regex/Cargo.toml b/src/vendor/regex/Cargo.toml index 664f34b16d..a15115cee2 100644 --- a/src/vendor/regex/Cargo.toml +++ b/src/vendor/regex/Cargo.toml @@ -1,94 +1,96 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g. crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] name = "regex" -version = "0.2.2" #:version +version = "0.2.3" authors = ["The Rust Project Developers"] -license = "MIT/Apache-2.0" -readme = "README.md" -repository = "https://github.com/rust-lang/regex" -documentation = "https://doc.rust-lang.org/regex" +description = "An implementation of regular expressions for Rust. This implementation uses\nfinite automata and guarantees linear time matching on all inputs.\n" homepage = "https://github.com/rust-lang/regex" -description = """ -An implementation of regular expressions for Rust. This implementation uses -finite automata and guarantees linear time matching on all inputs. -""" +documentation = "https://doc.rust-lang.org/regex" +readme = "README.md" categories = ["text-processing"] - -[dependencies] -# For very fast prefix literal matching. -aho-corasick = "0.6.0" -# For skipping along search text quickly when a leading byte is known. -memchr = "1.0.0" -# For managing regex caches quickly across multiple threads. -thread_local = "0.3.2" -# For parsing regular expressions. -regex-syntax = { path = "regex-syntax", version = "0.4.1" } -# For accelerating text search. -simd = { version = "0.1.1", optional = true } -# For compiling UTF-8 decoding into automata. -utf8-ranges = "1.0.0" - -[dev-dependencies] -# For examples. -lazy_static = "0.2.2" -# For property based tests. -quickcheck = { version = "0.4.1", default-features = false } -# For generating random test data. -rand = "0.3.15" - -[features] -# Enable to use the unstable pattern traits defined in std. -pattern = [] -# Enable to use simd acceleration. -simd-accel = ["simd"] - -[lib] -# There are no benchmarks in the library code itself -bench = false - -# Run the test suite on the default behavior of Regex::new. -# This includes a mish mash of NFAs and DFAs, which are chosen automatically -# based on the regex. We test both of the NFA implementations by forcing their -# usage with the test definitions below. (We can't test the DFA implementations -# in the same way since they can't be used for every regex tested.) -[[test]] -path = "tests/test_default.rs" -name = "default" - -# The same as the default tests, but run on bytes::Regex. -[[test]] -path = "tests/test_default_bytes.rs" -name = "default-bytes" - -# Run the test suite on the NFA algorithm over Unicode codepoints. -[[test]] -path = "tests/test_nfa.rs" -name = "nfa" - -# Run the test suite on the NFA algorithm over bytes that match UTF-8 only. -[[test]] -path = "tests/test_nfa_utf8bytes.rs" -name = "nfa-utf8bytes" - -# Run the test suite on the NFA algorithm over arbitrary bytes. -[[test]] -path = "tests/test_nfa_bytes.rs" -name = "nfa-bytes" - -# Run the test suite on the backtracking engine over Unicode codepoints. -[[test]] -path = "tests/test_backtrack.rs" -name = "backtrack" - -# Run the test suite on the backtracking engine over bytes that match UTF-8 -# only. -[[test]] -path = "tests/test_backtrack_utf8bytes.rs" -name = "backtrack-utf8bytes" - -# Run the test suite on the backtracking engine over arbitrary bytes. -[[test]] -path = "tests/test_backtrack_bytes.rs" -name = "backtrack-bytes" - +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-lang/regex" [profile.test] debug = true + +[lib] +bench = false + +[[test]] +name = "default" +path = "tests/test_default.rs" + +[[test]] +name = "default-bytes" +path = "tests/test_default_bytes.rs" + +[[test]] +name = "nfa" +path = "tests/test_nfa.rs" + +[[test]] +name = "nfa-utf8bytes" +path = "tests/test_nfa_utf8bytes.rs" + +[[test]] +name = "nfa-bytes" +path = "tests/test_nfa_bytes.rs" + +[[test]] +name = "backtrack" +path = "tests/test_backtrack.rs" + +[[test]] +name = "backtrack-utf8bytes" +path = "tests/test_backtrack_utf8bytes.rs" + +[[test]] +name = "backtrack-bytes" +path = "tests/test_backtrack_bytes.rs" +[dependencies.aho-corasick] +version = "0.6.0" + +[dependencies.memchr] +version = "2.0.0" + +[dependencies.regex-syntax] +version = "0.4.1" + +[dependencies.simd] +version = "0.1.1" +optional = true + +[dependencies.thread_local] +version = "0.3.2" + +[dependencies.utf8-ranges] +version = "1.0.0" +[dev-dependencies.lazy_static] +version = "0.2.2" + +[dev-dependencies.quickcheck] +version = "0.4.1" +default-features = false + +[dev-dependencies.rand] +version = "0.3.15" + +[features] +pattern = [] +simd-accel = ["simd"] +[badges.appveyor] +repository = "rust-lang-libs/regex" + +[badges.travis-ci] +repository = "rust-lang/regex" diff --git a/src/vendor/regex/Cargo.toml.orig b/src/vendor/regex/Cargo.toml.orig new file mode 100644 index 0000000000..697f78b99e --- /dev/null +++ b/src/vendor/regex/Cargo.toml.orig @@ -0,0 +1,98 @@ +[package] +name = "regex" +version = "0.2.3" #:version +authors = ["The Rust Project Developers"] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/rust-lang/regex" +documentation = "https://doc.rust-lang.org/regex" +homepage = "https://github.com/rust-lang/regex" +description = """ +An implementation of regular expressions for Rust. This implementation uses +finite automata and guarantees linear time matching on all inputs. +""" +categories = ["text-processing"] + +[badges] +travis-ci = { repository = "rust-lang/regex" } +appveyor = { repository = "rust-lang-libs/regex" } + +[dependencies] +# For very fast prefix literal matching. +aho-corasick = "0.6.0" +# For skipping along search text quickly when a leading byte is known. +memchr = "2.0.0" +# For managing regex caches quickly across multiple threads. +thread_local = "0.3.2" +# For parsing regular expressions. +regex-syntax = { path = "regex-syntax", version = "0.4.1" } +# For accelerating text search. +simd = { version = "0.1.1", optional = true } +# For compiling UTF-8 decoding into automata. +utf8-ranges = "1.0.0" + +[dev-dependencies] +# For examples. +lazy_static = "0.2.2" +# For property based tests. +quickcheck = { version = "0.4.1", default-features = false } +# For generating random test data. +rand = "0.3.15" + +[features] +# Enable to use the unstable pattern traits defined in std. +pattern = [] +# Enable to use simd acceleration. +simd-accel = ["simd"] + +[lib] +# There are no benchmarks in the library code itself +bench = false + +# Run the test suite on the default behavior of Regex::new. +# This includes a mish mash of NFAs and DFAs, which are chosen automatically +# based on the regex. We test both of the NFA implementations by forcing their +# usage with the test definitions below. (We can't test the DFA implementations +# in the same way since they can't be used for every regex tested.) +[[test]] +path = "tests/test_default.rs" +name = "default" + +# The same as the default tests, but run on bytes::Regex. +[[test]] +path = "tests/test_default_bytes.rs" +name = "default-bytes" + +# Run the test suite on the NFA algorithm over Unicode codepoints. +[[test]] +path = "tests/test_nfa.rs" +name = "nfa" + +# Run the test suite on the NFA algorithm over bytes that match UTF-8 only. +[[test]] +path = "tests/test_nfa_utf8bytes.rs" +name = "nfa-utf8bytes" + +# Run the test suite on the NFA algorithm over arbitrary bytes. +[[test]] +path = "tests/test_nfa_bytes.rs" +name = "nfa-bytes" + +# Run the test suite on the backtracking engine over Unicode codepoints. +[[test]] +path = "tests/test_backtrack.rs" +name = "backtrack" + +# Run the test suite on the backtracking engine over bytes that match UTF-8 +# only. +[[test]] +path = "tests/test_backtrack_utf8bytes.rs" +name = "backtrack-utf8bytes" + +# Run the test suite on the backtracking engine over arbitrary bytes. +[[test]] +path = "tests/test_backtrack_bytes.rs" +name = "backtrack-bytes" + +[profile.test] +debug = true diff --git a/src/vendor/regex/HACKING.md b/src/vendor/regex/HACKING.md index 28b9fcb5d7..9556de6ecc 100644 --- a/src/vendor/regex/HACKING.md +++ b/src/vendor/regex/HACKING.md @@ -313,3 +313,25 @@ https://github.com/BurntSushi/cargo-benchcmp The `run-bench` utility can run benchmarks for PCRE and Oniguruma too. See `./run-bench --help`. + +## Dev Docs + +When digging your teeth into the codebase for the first time, the +crate documentation can be a great resource. By default `rustdoc` +will strip out all documentation of private crate members in an +effort to help consumers of the crate focus on the *interface* +without having to concern themselves with the *implimentation*. +Normally this is a great thing, but if you want to start hacking +on regex internals it is not what you want. Many of the private members +of this crate are well documented with rustdoc style comments, and +it would be a shame to miss out on the opportunity that presents. +You can generate the private docs with: + +``` +> rustdoc --crate-name docs src/lib.rs -o target/doc -L target/debug/deps --no-defaults --passes collapse-docs --passes unindent-comments +``` + +Then just point your browser at `target/doc/regex/index.html`. + +See https://github.com/rust-lang/rust/issues/15347 for more info +about generating developer docs for internal use. diff --git a/src/vendor/regex/README.md b/src/vendor/regex/README.md index 1384fb5542..ebffe39d2c 100644 --- a/src/vendor/regex/README.md +++ b/src/vendor/regex/README.md @@ -233,8 +233,11 @@ examples](https://doc.rust-lang.org/regex/regex_syntax/index.html). # License -`regex` is primarily distributed under the terms of both the MIT license and -the Apache License (Version 2.0), with portions covered by various BSD-like -licenses. +This project is licensed under either of -See LICENSE-APACHE, and LICENSE-MIT for details. + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or + http://opensource.org/licenses/MIT) + +at your option. diff --git a/src/vendor/regex/examples/bug347.rs b/src/vendor/regex/examples/bug347.rs deleted file mode 100644 index 88b9677b9e..0000000000 --- a/src/vendor/regex/examples/bug347.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate regex; - -use regex::Regex; - -fn main() { - let re = Regex::new("^(aba|a)c*(b|$)").unwrap(); - println!("{:?}", re.find("abaca")); - println!("{:?}", re.captures("abaca")); -} diff --git a/src/vendor/regex/examples/shootout-regex-dna-bytes.rs b/src/vendor/regex/examples/shootout-regex-dna-bytes.rs index ec57157c8e..4010324db7 100644 --- a/src/vendor/regex/examples/shootout-regex-dna-bytes.rs +++ b/src/vendor/regex/examples/shootout-regex-dna-bytes.rs @@ -55,7 +55,7 @@ fn main() { (regex!("Y"), &b"(c|t)"[..]), ]; let mut seq = seq; - for (re, replacement) in substs.into_iter() { + for (re, replacement) in substs { seq = re.replace_all(&seq, replacement).into_owned(); } diff --git a/src/vendor/regex/examples/shootout-regex-dna-single.rs b/src/vendor/regex/examples/shootout-regex-dna-single.rs index a84bc63c12..ed48b8b010 100644 --- a/src/vendor/regex/examples/shootout-regex-dna-single.rs +++ b/src/vendor/regex/examples/shootout-regex-dna-single.rs @@ -48,7 +48,7 @@ fn main() { (regex!("Y"), "(c|t)"), ]; let mut seq = seq; - for (re, replacement) in substs.into_iter() { + for (re, replacement) in substs { seq = re.replace_all(&seq, replacement).into_owned(); } println!("\n{}\n{}\n{}", ilen, clen, seq.len()); diff --git a/src/vendor/regex/examples/shootout-regex-dna.rs b/src/vendor/regex/examples/shootout-regex-dna.rs index ec0060d7f4..2171bb3eab 100644 --- a/src/vendor/regex/examples/shootout-regex-dna.rs +++ b/src/vendor/regex/examples/shootout-regex-dna.rs @@ -55,7 +55,7 @@ fn main() { (regex!("Y"), "(c|t)"), ]; let mut seq = seq; - for (re, replacement) in substs.into_iter() { + for (re, replacement) in substs { seq = re.replace_all(&seq, replacement).into_owned(); } diff --git a/src/vendor/regex/examples/shootout-regex-redux-1.rs b/src/vendor/regex/examples/shootout-regex-redux-1.rs deleted file mode 100644 index fa9cee4693..0000000000 --- a/src/vendor/regex/examples/shootout-regex-redux-1.rs +++ /dev/null @@ -1,86 +0,0 @@ -// The Computer Language Benchmarks Game -// http://benchmarksgame.alioth.debian.org/ -// -// regex-dna program contributed by the Rust Project Developers -// contributed by BurntSushi -// contributed by TeXitoi -// converted from regex-dna program -// contributed by Matt Brubeck - -extern crate regex; - -use std::borrow::Cow; -use std::fs::File; -use std::io::{self, Read}; -use std::sync::Arc; -use std::thread; - -macro_rules! regex { ($re:expr) => { ::regex::bytes::Regex::new($re).unwrap() } } - -/// Read the input into memory. -fn read() -> io::Result> { - // Pre-allocate a buffer based on the input file size. - let mut stdin = File::open("/dev/stdin")?; - let size = stdin.metadata()?.len() as usize; - let mut buf = Vec::with_capacity(size + 1); - - stdin.read_to_end(&mut buf)?; - Ok(buf) -} - -fn main() { - let mut seq = read().unwrap(); - let ilen = seq.len(); - - // Remove headers and newlines. - seq = regex!(r"(?m)^>.*$|\n").replace_all(&seq, &b""[..]).into_owned(); - let clen = seq.len(); - - // Search for occurrences of the following patterns: - let variants = vec![ - regex!("agggtaaa|tttaccct"), - regex!("[cgt]gggtaaa|tttaccc[acg]"), - regex!("a[act]ggtaaa|tttacc[agt]t"), - regex!("ag[act]gtaaa|tttac[agt]ct"), - regex!("agg[act]taaa|ttta[agt]cct"), - regex!("aggg[acg]aaa|ttt[cgt]ccct"), - regex!("agggt[cgt]aa|tt[acg]accct"), - regex!("agggta[cgt]a|t[acg]taccct"), - regex!("agggtaa[cgt]|[acg]ttaccct"), - ]; - - // Count each pattern in parallel. Use an Arc (atomic reference-counted - // pointer) to share the sequence between threads without copying it. - let seq_arc = Arc::new(seq); - let mut counts = vec![]; - for variant in variants { - let seq = seq_arc.clone(); - let restr = variant.to_string(); - let future = thread::spawn(move || variant.find_iter(&seq).count()); - counts.push((restr, future)); - } - - // Replace the following patterns, one at a time: - let substs = vec![ - (regex!("tHa[Nt]"), &b"<4>"[..]), - (regex!("aND|caN|Ha[DS]|WaS"), &b"<3>"[..]), - (regex!("a[NSt]|BY"), &b"<2>"[..]), - (regex!("<[^>]*>"), &b"|"[..]), - (regex!("\\|[^|][^|]*\\|"), &b"-"[..]), - ]; - - // Use Cow here to avoid one extra copy of the sequence, by borrowing from - // the Arc during the first iteration. - let mut seq = Cow::Borrowed(&seq_arc[..]); - - // Perform the replacements in sequence: - for (re, replacement) in substs { - seq = Cow::Owned(re.replace_all(&seq, replacement).into_owned()); - } - - // Print the results: - for (variant, count) in counts { - println!("{} {}", variant, count.join().unwrap()); - } - println!("\n{}\n{}\n{}", ilen, clen, seq.len()); -} diff --git a/src/vendor/regex/examples/shootout-regex-redux-chunked.rs b/src/vendor/regex/examples/shootout-regex-redux-chunked.rs deleted file mode 100644 index df9985d683..0000000000 --- a/src/vendor/regex/examples/shootout-regex-redux-chunked.rs +++ /dev/null @@ -1,82 +0,0 @@ -// The Computer Language Benchmarks Game -// http://benchmarksgame.alioth.debian.org/ -// -// regex-dna program contributed by the Rust Project Developers -// contributed by BurntSushi -// contributed by TeXitoi -// converted from regex-dna program - -extern crate regex; - -use std::io::{self, Read}; -use std::sync::Arc; -use std::thread; - -macro_rules! regex { ($re:expr) => { ::regex::bytes::Regex::new($re).unwrap() } } - -fn main() { - let squash = regex!("(?m)^>.*$|\n"); - let variants = Arc::new(vec![ - regex!("agggtaaa|tttaccct"), - regex!("[cgt]gggtaaa|tttaccc[acg]"), - regex!("a[act]ggtaaa|tttacc[agt]t"), - regex!("ag[act]gtaaa|tttac[agt]ct"), - regex!("agg[act]taaa|ttta[agt]cct"), - regex!("aggg[acg]aaa|ttt[cgt]ccct"), - regex!("agggt[cgt]aa|tt[acg]accct"), - regex!("agggta[cgt]a|t[acg]taccct"), - regex!("agggtaa[cgt]|[acg]ttaccct"), - ]); - let substs = Arc::new(vec![ - (regex!("tHa[Nt]"), &b"<4>"[..]), - (regex!("aND|caN|Ha[DS]|WaS"), &b"<3>"[..]), - (regex!("a[NSt]|BY"), &b"<2>"[..]), - (regex!("<[^>]*>"), &b"|"[..]), - (regex!("\\|[^|][^|]*\\|"), &b"-"[..]), - ]); - - let mut seq = Vec::with_capacity(51 * (1 << 20)); - io::stdin().read_to_end(&mut seq).unwrap(); - let ilen = seq.len(); - - let seq = Arc::new(squash.replace_all(&seq, &b""[..]).into_owned()); - let clen = seq.len(); - let mut workers = vec![]; - let njobs = 4; - let per = variants.len() / njobs; - for i in 0..njobs { - let seq = seq.clone(); - let variants = variants.clone(); - let substs = substs.clone(); - workers.push(thread::spawn(move || { - let (start, end) = (i * per, i * per + per); - let mut var_counts = vec![]; - for variant in &variants[start..end] { - var_counts.push(( - variant.to_string(), - variant.find_iter(&seq).count(), - )); - } - let chunk_len = seq.len() / njobs; - let mut chunk = substs[0].0.replace_all( - &seq[i * chunk_len..i * chunk_len + chunk_len], - substs[0].1, - ).into_owned(); - for &(ref re, ref replacement) in substs.iter().skip(1) { - chunk = re.replace_all(&chunk, &**replacement).into_owned(); - } - (var_counts, chunk.len()) - })); - } - let last_var = variants[8].find_iter(&seq).count(); - let mut seq_len = 0; - for worker in workers { - let (var_counts, chunk_len) = worker.join().unwrap(); - seq_len += chunk_len; - for (variant, count) in var_counts { - println!("{} {}", variant, count); - } - } - println!("{} {}", variants[8].to_string(), last_var); - println!("\n{}\n{}\n{}", ilen, clen, seq_len); -} diff --git a/src/vendor/regex/examples/shootout-regex-redux.rs b/src/vendor/regex/examples/shootout-regex-redux.rs deleted file mode 100644 index 0b41ab3c5e..0000000000 --- a/src/vendor/regex/examples/shootout-regex-redux.rs +++ /dev/null @@ -1,103 +0,0 @@ -// The Computer Language Benchmarks Game -// http://benchmarksgame.alioth.debian.org/ -// -// regex-dna program contributed by the Rust Project Developers -// contributed by BurntSushi -// contributed by TeXitoi -// converted from regex-dna program -// contributed by Matt Brubeck - -extern crate regex; - -use std::fs::File; -use std::io::{self, Read}; -use std::sync::Arc; -use std::thread; - -use regex::bytes::Regex; - -macro_rules! regex { ($re:expr) => { Regex::new($re).unwrap() } } - -/// Read the input into memory. -fn read() -> io::Result> { - // Pre-allocate a buffer based on the input file size. - let mut stdin = File::open("/dev/stdin")?; - let size = stdin.metadata()?.len() as usize; - let mut buf = Vec::with_capacity(size + 1); - - stdin.read_to_end(&mut buf)?; - Ok(buf) -} - -/// Perform a replacement into the given buffer. -fn replace( - re: &Regex, - haystack: &[u8], - replacement: &[u8], - dst: &mut Vec, -) { - dst.clear(); - let mut last_match = 0; - for m in re.find_iter(haystack) { - dst.extend_from_slice(&haystack[last_match..m.start()]); - dst.extend_from_slice(replacement); - last_match = m.end(); - } - dst.extend_from_slice(&haystack[last_match..]); -} - -fn main() { - let mut seq2 = read().unwrap(); - let ilen = seq2.len(); - - // Remove headers and newlines. - let squash = regex!(r"(?m)^>.*$|\n"); - let seq = Arc::new(squash.replace_all(&seq2, &b""[..]).into_owned()); - let clen = seq.len(); - - // Search for occurrences of the following patterns: - let variants = vec![ - regex!("agggtaaa|tttaccct"), - regex!("[cgt]gggtaaa|tttaccc[acg]"), - regex!("a[act]ggtaaa|tttacc[agt]t"), - regex!("ag[act]gtaaa|tttac[agt]ct"), - regex!("agg[act]taaa|ttta[agt]cct"), - regex!("aggg[acg]aaa|ttt[cgt]ccct"), - regex!("agggt[cgt]aa|tt[acg]accct"), - regex!("agggta[cgt]a|t[acg]taccct"), - regex!("agggtaa[cgt]|[acg]ttaccct"), - ]; - - // Count each pattern in parallel. Use an Arc (atomic reference-counted - // pointer) to share the sequence between threads without copying it. - let mut counts = vec![]; - for variant in variants { - let seq = seq.clone(); - let restr = variant.to_string(); - let future = thread::spawn(move || variant.find_iter(&seq).count()); - counts.push((restr, future)); - } - // Print the counts. - for (variant, count) in counts { - println!("{} {}", variant, count.join().unwrap()); - } - let mut seq1 = Arc::try_unwrap(seq).unwrap(); - - // Replace the following patterns, one at a time: - let substs = vec![ - (regex!(r"tHa[Nt]"), &b"<4>"[..]), - (regex!(r"aND|caN|Ha[DS]|WaS"), &b"<3>"[..]), - (regex!(r"a[NSt]|BY"), &b"<2>"[..]), - (regex!(r"<[^>]*>"), &b"|"[..]), - (regex!(r"\|[^|][^|]*\|"), &b"-"[..]), - ]; - - // Perform the replacements in sequence: - for (re, replacement) in substs { - replace(&re, &seq1, replacement, &mut seq2); - ::std::mem::swap(&mut seq1, &mut seq2); - } - - // Print the final results: - println!("\n{}\n{}\n{}", ilen, clen, seq1.len()); -} diff --git a/src/vendor/regex/src/backtrack.rs b/src/vendor/regex/src/backtrack.rs index 78bc39e93e..6e71e2c2f3 100644 --- a/src/vendor/regex/src/backtrack.rs +++ b/src/vendor/regex/src/backtrack.rs @@ -100,7 +100,7 @@ impl<'a, 'm, 'r, 's, I: Input> Bounded<'a, 'm, 'r, 's, I> { start: usize, ) -> bool { let mut cache = cache.borrow_mut(); - let mut cache = &mut cache.backtrack; + let cache = &mut cache.backtrack; let start = input.at(start); let mut b = Bounded { prog: prog, @@ -216,6 +216,9 @@ impl<'a, 'm, 'r, 's, I: Input> Bounded<'a, 'm, 'r, 's, I> { // from the stack. Namely, if we're pushing a job only to run it // next, avoid the push and just mutate `ip` (and possibly `at`) // in place. + if self.has_visited(ip, at) { + return false; + } match self.prog[ip] { Match(slot) => { if slot < self.matches.len() { @@ -275,9 +278,6 @@ impl<'a, 'm, 'r, 's, I: Input> Bounded<'a, 'm, 'r, 's, I> { return false; } } - if self.has_visited(ip, at) { - return false; - } } } diff --git a/src/vendor/regex/src/compile.rs b/src/vendor/regex/src/compile.rs index 0acdebb112..b72ba757fa 100644 --- a/src/vendor/regex/src/compile.rs +++ b/src/vendor/regex/src/compile.rs @@ -205,6 +205,58 @@ impl Compiler { Ok(self.compiled) } + /// Compile expr into self.insts, returning a patch on success, + /// or an error if we run out of memory. + /// + /// All of the c_* methods of the compiler share the contract outlined + /// here. + /// + /// The main thing that a c_* method does is mutate `self.insts` + /// to add a list of mostly compiled instructions required to execute + /// the given expression. `self.insts` contains MaybeInsts rather than + /// Insts because there is some backpatching required. + /// + /// The `Patch` value returned by each c_* method provides metadata + /// about the compiled instructions emitted to `self.insts`. The + /// `entry` member of the patch refers to the first instruction + /// (the entry point), while the `hole` member contains zero or + /// more offsets to partial instructions that need to be backpatched. + /// The c_* routine can't know where its list of instructions are going to + /// jump to after execution, so it is up to the caller to patch + /// these jumps to point to the right place. So compiling some + /// expression, e, we would end up with a situation that looked like: + /// + /// ```text + /// self.insts = [ ..., i1, i2, ..., iexit1, ..., iexitn, ...] + /// ^ ^ ^ + /// | \ / + /// entry \ / + /// hole + /// ``` + /// + /// To compile two expressions, e1 and e2, concatinated together we + /// would do: + /// + /// ```ignore + /// let patch1 = self.c(e1); + /// let patch2 = self.c(e2); + /// ``` + /// + /// while leaves us with a situation that looks like + /// + /// ```text + /// self.insts = [ ..., i1, ..., iexit1, ..., i2, ..., iexit2 ] + /// ^ ^ ^ ^ + /// | | | | + /// entry1 hole1 entry2 hole2 + /// ``` + /// + /// Then to merge the two patches together into one we would backpatch + /// hole1 with entry2 and return a new patch that enters at entry1 + /// and has hole2 for a hole. In fact, if you look at the c_concat + /// method you will see that it does exactly this, though it handles + /// a list of expressions rather than just the two that we use for + /// an example. fn c(&mut self, expr: &Expr) -> Result { use prog; use syntax::Expr::*; @@ -833,7 +885,7 @@ impl<'a, 'b> CompileClass<'a, 'b> { let mut utf8_seqs = self.c.utf8_seqs.take().unwrap(); self.c.suffix_cache.clear(); - for (i, ref range) in self.ranges.iter().enumerate() { + for (i, range) in self.ranges.iter().enumerate() { let is_last_range = i + 1 == self.ranges.len(); utf8_seqs.reset(range.start, range.end); let mut it = (&mut utf8_seqs).peekable(); @@ -916,7 +968,7 @@ impl<'a, 'b> CompileClass<'a, 'b> { } } -/// SuffixCache is a simple bounded hash map for caching suffix entries in +/// `SuffixCache` is a simple bounded hash map for caching suffix entries in /// UTF-8 automata. For example, consider the Unicode range \u{0}-\u{FFFF}. /// The set of byte ranges looks like this: /// @@ -1050,6 +1102,9 @@ impl ByteClassSet { } fn u32_to_usize(n: u32) -> usize { + // In case usize is less than 32 bits, we need to guard against overflow. + // On most platforms this compiles to nothing. + // TODO Use `std::convert::TryFrom` once it's stable. if (n as u64) > (::std::usize::MAX as u64) { panic!("BUG: {} is too big to be pointer sized", n) } diff --git a/src/vendor/regex/src/dfa.rs b/src/vendor/regex/src/dfa.rs index d3c007c350..91dc6a6251 100644 --- a/src/vendor/regex/src/dfa.rs +++ b/src/vendor/regex/src/dfa.rs @@ -58,7 +58,7 @@ use sparse::SparseSet; /// Return true if and only if the given program can be executed by a DFA. /// /// Generally, a DFA is always possible. A pathological case where it is not -/// possible is if the number of NFA states exceeds u32::MAX, in which case, +/// possible is if the number of NFA states exceeds `u32::MAX`, in which case, /// this function will return false. /// /// This function will also return false if the given program has any Unicode @@ -104,7 +104,7 @@ pub struct Cache { qnext: SparseSet, } -/// CacheInner is logically just a part of Cache, but groups together fields +/// `CacheInner` is logically just a part of Cache, but groups together fields /// that aren't passed as function parameters throughout search. (This split /// is mostly an artifact of the borrow checker. It is happily paid.) #[derive(Clone, Debug)] @@ -162,8 +162,8 @@ struct CacheInner { /// It is laid out in row-major order, with states as rows and byte class /// transitions as columns. /// -/// The transition table is responsible for producing valid StatePtrs. A -/// StatePtr points to the start of a particular row in this table. When +/// The transition table is responsible for producing valid `StatePtrs`. A +/// `StatePtr` points to the start of a particular row in this table. When /// indexing to find the next state this allows us to avoid a multiplication /// when computing an index into the table. #[derive(Clone)] @@ -252,7 +252,7 @@ impl Result { } } -/// State is a DFA state. It contains an ordered set of NFA states (not +/// `State` is a DFA state. It contains an ordered set of NFA states (not /// necessarily complete) and a smattering of flags. /// /// The flags are packed into the first byte of data. @@ -271,7 +271,7 @@ struct State{ data: Box<[u8]>, } -/// InstPtr is a 32 bit pointer into a sequence of opcodes (i.e., it indexes +/// `InstPtr` is a 32 bit pointer into a sequence of opcodes (i.e., it indexes /// an NFA state). /// /// Throughout this library, this is usually set to `usize`, but we force a @@ -322,7 +322,8 @@ impl State { } } -/// StatePtr is a 32 bit pointer to the start of a row in the transition table. +/// `StatePtr` is a 32 bit pointer to the start of a row in the transition +/// table. /// /// It has many special values. There are two types of special values: /// sentinels and flags. @@ -345,7 +346,8 @@ impl State { /// /// The other type of state pointer is a state pointer with special flag bits. /// There are two flags: a start flag and a match flag. The lower bits of both -/// kinds always contain a "valid" StatePtr (indicated by the STATE_MAX mask). +/// kinds always contain a "valid" `StatePtr` (indicated by the `STATE_MAX` +/// mask). /// /// The start flag means that the state is a start state, and therefore may be /// subject to special prefix scanning optimizations. @@ -462,7 +464,7 @@ impl<'a> Fsm<'a> { at: usize, ) -> Result { let mut cache = cache.borrow_mut(); - let mut cache = &mut cache.dfa; + let cache = &mut cache.dfa; let mut dfa = Fsm { prog: prog, start: 0, // filled in below @@ -495,7 +497,7 @@ impl<'a> Fsm<'a> { at: usize, ) -> Result { let mut cache = cache.borrow_mut(); - let mut cache = &mut cache.dfa_reverse; + let cache = &mut cache.dfa_reverse; let mut dfa = Fsm { prog: prog, start: 0, // filled in below @@ -529,7 +531,7 @@ impl<'a> Fsm<'a> { ) -> Result { debug_assert!(matches.len() == prog.matches.len()); let mut cache = cache.borrow_mut(); - let mut cache = &mut cache.dfa; + let cache = &mut cache.dfa; let mut dfa = Fsm { prog: prog, start: 0, // filled in below @@ -998,16 +1000,20 @@ impl<'a> Fsm<'a> { } } } - let mut cache = true; - if b.is_eof() && self.prog.matches.len() > 1 { - // If we're processing the last byte of the input and we're - // matching a regex set, then make the next state contain the - // previous states transitions. We do this so that the main - // matching loop can extract all of the match instructions. - mem::swap(qcur, qnext); - // And don't cache this state because it's totally bunk. - cache = false; - } + + let cache = + if b.is_eof() && self.prog.matches.len() > 1 { + // If we're processing the last byte of the input and we're + // matching a regex set, then make the next state contain the + // previous states transitions. We do this so that the main + // matching loop can extract all of the match instructions. + mem::swap(qcur, qnext); + // And don't cache this state because it's totally bunk. + false + } else { + true + }; + // We've now built up the set of NFA states that ought to comprise the // next DFA state, so try to find it in the cache, and if it doesn't // exist, cache it. @@ -1030,7 +1036,7 @@ impl<'a> Fsm<'a> { next = self.start_ptr(next); } if next <= STATE_MAX && self.state(next).flags().is_match() { - next = STATE_MATCH | next; + next |= STATE_MATCH; } debug_assert!(next != STATE_UNKNOWN); // And now store our state in the current state's next list. @@ -1113,9 +1119,9 @@ impl<'a> Fsm<'a> { NotWordBoundary if flags.not_word_boundary => { self.cache.stack.push(inst.goto as InstPtr); } - StartLine | EndLine | StartText | EndText => {} - WordBoundaryAscii | NotWordBoundaryAscii => {} - WordBoundary | NotWordBoundary => {} + StartLine | EndLine | StartText | EndText + | WordBoundaryAscii | NotWordBoundaryAscii + | WordBoundary | NotWordBoundary => {} } } Save(ref inst) => self.cache.stack.push(inst.goto as InstPtr), @@ -1167,12 +1173,12 @@ impl<'a> Fsm<'a> { return Some(si); } // If the cache has gotten too big, wipe it. - if self.approximate_size() > self.prog.dfa_size_limit { - if !self.clear_cache_and_save(current_state) { + if self.approximate_size() > self.prog.dfa_size_limit + && !self.clear_cache_and_save(current_state) + { // Ooops. DFA is giving up. return None; } - } // Allocate room for our state and add it. self.add_state(key) } @@ -1210,8 +1216,7 @@ impl<'a> Fsm<'a> { let ip = usize_to_u32(ip); match self.prog[ip as usize] { Char(_) | Ranges(_) => unreachable!(), - Save(_) => {} - Split(_) => {} + Save(_) | Split(_) => {} Bytes(_) => push_inst_ptr(&mut insts, &mut prev, ip), EmptyLook(_) => { state_flags.set_empty(); @@ -1301,7 +1306,7 @@ impl<'a> Fsm<'a> { self.cache.trans.clear(); self.cache.states.clear(); self.cache.compiled.clear(); - for s in self.cache.start_states.iter_mut() { + for s in &mut self.cache.start_states { *s = STATE_UNKNOWN; } // The unwraps are OK because we just cleared the cache and therefore @@ -1411,9 +1416,9 @@ impl<'a> Fsm<'a> { let mut empty_flags = EmptyFlags::default(); let mut state_flags = StateFlags::default(); empty_flags.start = at == 0; - empty_flags.end = text.len() == 0; + empty_flags.end = text.is_empty(); empty_flags.start_line = at == 0 || text[at - 1] == b'\n'; - empty_flags.end_line = text.len() == 0; + empty_flags.end_line = text.is_empty(); let is_word_last = at > 0 && Byte::byte(text[at - 1]).is_ascii_word(); let is_word = at < text.len() && Byte::byte(text[at]).is_ascii_word(); @@ -1440,9 +1445,9 @@ impl<'a> Fsm<'a> { let mut empty_flags = EmptyFlags::default(); let mut state_flags = StateFlags::default(); empty_flags.start = at == text.len(); - empty_flags.end = text.len() == 0; + empty_flags.end = text.is_empty(); empty_flags.start_line = at == text.len() || text[at] == b'\n'; - empty_flags.end_line = text.len() == 0; + empty_flags.end_line = text.is_empty(); let is_word_last = at < text.len() && Byte::byte(text[at]).is_ascii_word(); diff --git a/src/vendor/regex/src/error.rs b/src/vendor/regex/src/error.rs index c95d67acdd..869107bdfa 100644 --- a/src/vendor/regex/src/error.rs +++ b/src/vendor/regex/src/error.rs @@ -13,7 +13,7 @@ use std::fmt; use syntax; /// An error that occurred during parsing or compiling a regular expression. -#[derive(Debug)] +#[derive(Clone, Debug, PartialEq)] pub enum Error { /// A syntax error. Syntax(String), diff --git a/src/vendor/regex/src/exec.rs b/src/vendor/regex/src/exec.rs index 3192ce7928..458e47d3b0 100644 --- a/src/vendor/regex/src/exec.rs +++ b/src/vendor/regex/src/exec.rs @@ -31,7 +31,7 @@ use re_trait::{RegularExpression, Slot, Locations, as_slots}; use re_unicode; use utf8::next_utf8; -/// Exec manages the execution of a regular expression. +/// `Exec` manages the execution of a regular expression. /// /// In particular, this manages the various compiled forms of a single regular /// expression and the choice of which matching engine to use to execute a @@ -43,7 +43,7 @@ pub struct Exec { cache: CachedThreadLocal, } -/// ExecNoSync is like Exec, except it embeds a reference to a cache. This +/// `ExecNoSync` is like `Exec`, except it embeds a reference to a cache. This /// means it is no longer Sync, but we can now avoid the overhead of /// synchronization to fetch the cache. #[derive(Debug)] @@ -54,10 +54,10 @@ pub struct ExecNoSync<'c> { cache: &'c ProgramCache, } -/// ExecNoSyncStr is like ExecNoSync, but matches on &str instead of &[u8]. +/// `ExecNoSyncStr` is like `ExecNoSync`, but matches on &str instead of &[u8]. pub struct ExecNoSyncStr<'c>(ExecNoSync<'c>); -/// ExecReadOnly comprises all read only state for a regex. Namely, all such +/// `ExecReadOnly` comprises all read only state for a regex. Namely, all such /// state is determined at compile time and never changes during search. #[derive(Debug)] struct ExecReadOnly { @@ -263,8 +263,8 @@ impl ExecBuilder { } Ok(Parsed { exprs: exprs, - prefixes: prefixes.unwrap_or(Literals::empty()), - suffixes: suffixes.unwrap_or(Literals::empty()), + prefixes: prefixes.unwrap_or_else(Literals::empty), + suffixes: suffixes.unwrap_or_else(Literals::empty), bytes: bytes, }) } @@ -397,7 +397,7 @@ impl<'c> RegularExpression for ExecNoSync<'c> { MatchType::DfaAnchoredReverse => { match dfa::Fsm::reverse( &self.ro.dfa_reverse, - &self.cache, + self.cache, true, &text[start..], text.len(), @@ -445,7 +445,7 @@ impl<'c> RegularExpression for ExecNoSync<'c> { MatchType::DfaAnchoredReverse => { match dfa::Fsm::reverse( &self.ro.dfa_reverse, - &self.cache, + self.cache, true, &text[start..], text.len(), @@ -633,7 +633,7 @@ impl<'c> ExecNoSync<'c> { use dfa::Result::*; let end = match dfa::Fsm::forward( &self.ro.dfa, - &self.cache, + self.cache, false, text, start, @@ -646,7 +646,7 @@ impl<'c> ExecNoSync<'c> { // Now run the DFA in reverse to find the start of the match. match dfa::Fsm::reverse( &self.ro.dfa_reverse, - &self.cache, + self.cache, false, &text[start..], end - start, @@ -672,7 +672,7 @@ impl<'c> ExecNoSync<'c> { use dfa::Result::*; match dfa::Fsm::reverse( &self.ro.dfa_reverse, - &self.cache, + self.cache, false, &text[start..], text.len() - start, @@ -686,7 +686,7 @@ impl<'c> ExecNoSync<'c> { /// Finds the end of the shortest match using only the DFA. #[inline(always)] // reduces constant overhead fn shortest_dfa(&self, text: &[u8], start: usize) -> dfa::Result { - dfa::Fsm::forward(&self.ro.dfa, &self.cache, true, text, start) + dfa::Fsm::forward(&self.ro.dfa, self.cache, true, text, start) } /// Finds the end of the shortest match using only the DFA by scanning for @@ -731,13 +731,13 @@ impl<'c> ExecNoSync<'c> { let mut end = start; while end <= text.len() { start = end; - end = end + match lcs.find(&text[end..]) { + end += match lcs.find(&text[end..]) { None => return Some(NoMatch(text.len())), Some(start) => start + lcs.len(), }; match dfa::Fsm::reverse( &self.ro.dfa_reverse, - &self.cache, + self.cache, false, &text[start..end], end - start, @@ -778,7 +778,7 @@ impl<'c> ExecNoSync<'c> { // leftmost-first match.) match dfa::Fsm::forward( &self.ro.dfa, - &self.cache, + self.cache, false, text, match_start, @@ -939,7 +939,7 @@ impl<'c> ExecNoSync<'c> { if self.ro.nfa.uses_bytes() { pikevm::Fsm::exec( &self.ro.nfa, - &self.cache, + self.cache, matches, slots, quit_after_match, @@ -948,7 +948,7 @@ impl<'c> ExecNoSync<'c> { } else { pikevm::Fsm::exec( &self.ro.nfa, - &self.cache, + self.cache, matches, slots, quit_after_match, @@ -968,7 +968,7 @@ impl<'c> ExecNoSync<'c> { if self.ro.nfa.uses_bytes() { backtrack::Bounded::exec( &self.ro.nfa, - &self.cache, + self.cache, matches, slots, ByteInput::new(text, self.ro.nfa.only_utf8), @@ -976,7 +976,7 @@ impl<'c> ExecNoSync<'c> { } else { backtrack::Bounded::exec( &self.ro.nfa, - &self.cache, + self.cache, matches, slots, CharInput::new(text), @@ -1003,14 +1003,14 @@ impl<'c> ExecNoSync<'c> { } match self.ro.match_type { Literal(ty) => { - debug_assert!(matches.len() == 1); + debug_assert_eq!(matches.len(), 1); matches[0] = self.find_literals(ty, text, start).is_some(); matches[0] } Dfa | DfaAnchoredReverse | DfaSuffix | DfaMany => { match dfa::Fsm::forward_many( &self.ro.dfa, - &self.cache, + self.cache, matches, text, start, @@ -1251,7 +1251,7 @@ enum MatchNfaType { PikeVM, } -/// ProgramCache maintains reusable allocations for each matching engine +/// `ProgramCache` maintains reusable allocations for each matching engine /// available to a particular program. pub type ProgramCache = RefCell; diff --git a/src/vendor/regex/src/expand.rs b/src/vendor/regex/src/expand.rs index 55873f88bb..a5e43b5279 100644 --- a/src/vendor/regex/src/expand.rs +++ b/src/vendor/regex/src/expand.rs @@ -89,8 +89,8 @@ pub fn expand_bytes( dst.extend(replacement); } -/// CaptureRef represents a reference to a capture group inside some text. The -/// reference is either a capture group name or a number. +/// `CaptureRef` represents a reference to a capture group inside some text. +/// The reference is either a capture group name or a number. /// /// It is also tagged with the position in the text immediately proceding the /// capture reference. @@ -150,7 +150,7 @@ fn find_cap_ref>( // therefore be valid UTF-8. If we really cared, we could avoid this UTF-8 // check with either unsafe or by parsing the number straight from &[u8]. let cap = str::from_utf8(&rep[i..cap_end]) - .ok().expect("valid UTF-8 capture name"); + .expect("valid UTF-8 capture name"); if brace { if !rep.get(cap_end).map_or(false, |&b| b == b'}') { return None; diff --git a/src/vendor/regex/src/input.rs b/src/vendor/regex/src/input.rs index afb946342c..87bf72d72f 100644 --- a/src/vendor/regex/src/input.rs +++ b/src/vendor/regex/src/input.rs @@ -58,6 +58,12 @@ impl InputAt { self.len } + /// Returns whether the UTF-8 width of the character at this position + /// is zero. + pub fn is_empty(&self) -> bool { + self.len == 0 + } + /// Returns the byte offset of this position. pub fn pos(&self) -> usize { self.pos @@ -98,6 +104,9 @@ pub trait Input { /// The number of bytes in the input. fn len(&self) -> usize; + /// Whether the input is empty. + fn is_empty(&self) -> bool { self.len() == 0 } + /// Return the given input as a sequence of bytes. fn as_bytes(&self) -> &[u8]; } @@ -214,10 +223,6 @@ impl<'t> Input for CharInput<'t> { } /// An input reader over bytes. -/// -/// N.B. We represent the reader with a string for now, since that gives us -/// easy access to necessary Unicode decoding (used for word boundary look -/// ahead/look behind). #[derive(Clone, Copy, Debug)] pub struct ByteInput<'t> { text: &'t [u8], @@ -247,7 +252,7 @@ impl<'t> Input for ByteInput<'t> { InputAt { pos: i, c: None.into(), - byte: self.get(i).map(|&b| b), + byte: self.get(i).cloned(), len: 1, } } @@ -325,7 +330,7 @@ impl<'t> Input for ByteInput<'t> { } fn as_bytes(&self) -> &[u8] { - &self.text + self.text } } @@ -374,9 +379,8 @@ impl Char { /// If the byte is absent, then false is returned. pub fn is_word_byte(self) -> bool { match char::from_u32(self.0) { - None => false, Some(c) if c <= '\u{7F}' => syntax::is_word_byte(c as u8), - Some(_) => false, + None | Some(_) => false, } } diff --git a/src/vendor/regex/src/lib.rs b/src/vendor/regex/src/lib.rs index 128932e620..3f1ab5daa3 100644 --- a/src/vendor/regex/src/lib.rs +++ b/src/vendor/regex/src/lib.rs @@ -374,7 +374,7 @@ the `x` flag and clears the `y` flag. All flags are by default disabled unless stated otherwise. They are: